diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-07-23 14:58:04 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-07-23 14:58:04 +0400 |
commit | 635f506d0c70a5b202b65dbf5fb957eebdd2e924 (patch) | |
tree | e0ffd25d591e8680942c7ae7a7914da0852cdd1e | |
parent | 272d65b0ccd81a971374b07258960ceee0337a0a (diff) | |
parent | 5901f9871a1a57f951da535f7e72c157bfaef522 (diff) | |
download | gcc-48-635f506d0c70a5b202b65dbf5fb957eebdd2e924.tar.gz |
Merge svn://svn.debian.org/svn/gcccvs/branches/sid/gcc-4.8
Conflicts:
debian/changelog
debian/control
62 files changed, 4263 insertions, 312244 deletions
diff --git a/debian/changelog b/debian/changelog index b265620..1a5fc4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,113 @@ +gcc-4.8 (4.8.3-6) UNRELEASED; urgency=medium + + * Don't gzip the xz compressed testsuite logs and summaries. + + -- Matthias Klose <doko@debian.org> Thu, 17 Jul 2014 19:52:33 +0200 + +gcc-4.8 (4.8.3-5) unstable; urgency=medium + + * Update to SVN 20140717 (r212756) from the gcc-4_8-branch. + * Warn about ppc ELFv2 ABI issues, which will change in GCC 4.10. + * Fix installing test logs and summaries. + + -- Matthias Klose <doko@debian.org> Thu, 17 Jul 2014 16:12:10 +0200 + +gcc-4.8 (4.8.3-4) unstable; urgency=medium + + * Update to SVN 20140626 (r212014) from the gcc-4_8-branch. + + [ Aurelien Jarno ] + * Fix PR c++/61336, taken from the trunk. + + [ Matthias Klose ] + * Fix removal of python byte-code files in libstdc++6. Addresses: #751435. + * Fix a segfault in the driver from calling free on non-malloc'd area. + * Remove version requirement for dependency on make. Addresses: #751891. + * Drop versioned build dependency on gdb, and apply the pretty printer + patch for libstdc++ based on the release. + + -- Matthias Klose <doko@debian.org> Thu, 26 Jun 2014 10:59:38 +0200 + +gcc-4.8 (4.8.3-3) unstable; urgency=medium + + * Update to SVN 20140606 (r211339) from the gcc-4_8-branch. + * Don't install the libstdc++ pretty printer file into the debug directory, + but into the gdb auto-load directory. + * Fix the removal of the libstdc++6 package, removing byte-compiled pretty + printer files and pycache directories. + * Fix PR c++/61046, taken from the trunk. LP: #1313102. + + -- Matthias Klose <doko@debian.org> Sat, 07 Jun 2014 02:28:40 +0200 + +gcc-4.8 (4.8.3-2) unstable; urgency=medium + + * Update to SVN 20140527 (r210956) from the gcc-4_8-branch. + - Fix PR target/61208. Closes: #748422. + + -- Matthias Klose <doko@debian.org> Tue, 27 May 2014 09:31:55 +0200 + +gcc-4.8 (4.8.3-1) unstable; urgency=medium + + * GCC 4.8.3 release. + * Update the gdc tarball, drop the gdc-updates patch. + * Refresh patches. + * Build libitm on AArch64, patch taken from the trunk. + * Drop the libstdc++-arm-wno-abi patch, not needed anymore in 4.8. + + -- Matthias Klose <doko@debian.org> Tue, 20 May 2014 00:27:51 +0200 + +gcc-4.8 (4.8.2-23) unstable; urgency=medium + + * GCC 4.8.3 release candidate 1. + * Update to SVN 20140516 (r210514) from the gcc-4_8-branch. + * Apply the proposed patch for PR driver/61126. + * Update the libstdc++v-python3 patch. Closes: #748317. + * Update the gcc-default-format-security patch (Steve Beattie). LP: #1317305. + * Apply the proposed patch for PR c/57653. Closes: #734345. + * Run some test cases explicity with -fno-stack-protector which fail + with -fstack-protector. + + -- Matthias Klose <doko@debian.org> Sun, 18 May 2014 17:48:38 +0200 + +gcc-4.8 (4.8.2-22) unstable; urgency=medium + + * Update to SVN 20140508 (r210209) from the gcc-4_8-branch. + * Install only versioned gcc-ar gcc-nm gcc-ranlib binaries for the hppa64 + cross compiler, update hppa64 alternatives. Closes: #745967. + * Fix the as and ld symlinks for the hppa64 cross compiler. + * Ensure that the common libs (built from the next GCC version) are + available when building without common libs. + * Fix java.security symlink in libgcj14. Closes: #746786. + * Move the libstdc++ gdb pretty printers into libstdc++6, install the + -gdb.py files into /usr/share/gdb/auto-load. + * Set the 'Multi-Arch: same' attribute for packages, cross built with + with_deps_on_target_arch_pkgs=yes (Helmit Grohne). Closes: #716795. + * Build the gcc-X.Y-base package with with_deps_on_target_arch_pkgs=yes + (Helmit Grohne). Closes: #744782. + * Apply the proposed patch for PR driver/61106. Closes: #747345. + + -- Matthias Klose <doko@debian.org> Thu, 08 May 2014 14:09:04 +0200 + +gcc-4.8 (4.8.2-21) unstable; urgency=medium + + * Update to SVN 20140424 (r209749) from the gcc-4_8-branch. + * gcc-4.8: Re-add lost dependency on libgcc-4.8-dev. Closes: #745709. + + -- Matthias Klose <doko@debian.org> Thu, 24 Apr 2014 16:34:10 +0200 + +gcc-4.8 (4.8.2-20) unstable; urgency=medium + + * Update to SVN 20140423 (r209678) from the gcc-4_8-branch. + * Explicitly configure with --disable-multilib on sparc64 when no + multilibs are requested (Helmut Grohne). Closes: #743342. + * Update powerpcspe patches for the branch (Helmut Grohne). Closes: #743718. + * Remove more mudflap left overs. Addresses: #742606. + * Adjust common_libs, libraries common to GCC 4.9. + * Disable running the testsuite on kfreebsd, hangs the buildds. + * Stop build packages built by GCC 4.9. + + -- Matthias Klose <doko@debian.org> Wed, 23 Apr 2014 11:13:07 +0200 + gcc-4.8 (4.8.2-20~dyson1) unstable; urgency=medium * Install only fixed sys/nsctl/nsctl.h sys/feature_tests.h sys/int_const.h @@ -8,14 +118,6 @@ gcc-4.8 (4.8.2-20~dyson1) unstable; urgency=medium -- Igor Pashev <pashev.igor@gmail.com> Sun, 20 Apr 2014 09:01:09 +0400 -gcc-4.8 (4.8.2-20) UNRELEASED; urgency=medium - - * Explicitly configure with --disable-multilib on sparc64 when no - multilibs are requested (Helmut Grohne). Closes: #743342. - * Update powerpcspe patches for the branch (Helmut Grohne). Closes: #743718. - - -- Matthias Klose <doko@debian.org> Mon, 07 Apr 2014 16:22:30 +0200 - gcc-4.8 (4.8.2-19) unstable; urgency=medium * Update to SVN 20140404 (r209122) from the gcc-4_8-branch. diff --git a/debian/control b/debian/control index fc0b479..25054a9 100644 --- a/debian/control +++ b/debian/control @@ -4,18 +4,18 @@ Priority: optional Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org> Uploaders: Matthias Klose <doko@debian.org> Standards-Version: 3.9.5 -Build-Depends: debhelper (>= 5.0.62), g++-multilib [amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32], - libc6.1-dev (>= 2.10+6) [alpha ia64] | libc0.3-dev (>= 2.10+6) [hurd-i386] | libc0.1-dev (>= 2.10+6) [kfreebsd-i386 kfreebsd-amd64] | libc6-dev (>= 2.10+6) | libc1-dev (>= 2.10+6) [illumos-amd64], libc6-dev (>= 2.13-31) [armel armhf], libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el s390x sparc64 x32], libn32gcc1 [mips mipsel mips64 mips64el], lib64gcc1 [i386 mips mipsel mipsn32 mipsn32el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el], libc1-dev-illumos-i386 (>= 2.10+6) [illumos-amd64], libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg [!illumos-any], +Build-Depends: debhelper (>= 5.0.62), g++-multilib [amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32], + libc6.1-dev (>= 2.13-5) [alpha ia64] | libc0.3-dev (>= 2.13-5) [hurd-i386] | libc0.1-dev (>= 2.13-5) [kfreebsd-i386 kfreebsd-amd64] | libc6-dev (>= 2.13-5), libc6-dev (>= 2.13-31) [armel armhf], libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el s390x sparc64 x32], libn32gcc1 [mips mipsel mips64 mips64el], lib64gcc1 [i386 mips mipsel mipsn32 mipsn32el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el], libc6-dev-x32 [amd64 i386], libx32gcc1 [amd64 i386], libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg, kfreebsd-kernel-headers (>= 0.84) [kfreebsd-any], - m4, libtool, autoconf2.64, + m4, libtool, autoconf2.64, gcc-4.9-base, libunwind7-dev (>= 0.98.5-6) [ia64], libatomic-ops-dev [ia64], zlib1g-dev, gawk, lzma, xz-utils, patchutils, binutils (>= 2.23.52) | binutils-multiarch (>= 2.23.52), binutils-hppa64 (>= 2.23.52) [hppa], gperf (>= 3.0.1), bison (>= 1:2.3), flex, gettext, texinfo (>= 4.3), locales, sharutils, - procps, zlib1g-dev, libantlr-java, python, libffi-dev, netbase, + procps, zlib1g-dev, libantlr-java, python, libffi-dev, fastjar, libmagic-dev, libecj-java (>= 3.3.0-2), zip, libasound2-dev [ !hurd-any !kfreebsd-any], libxtst-dev, libxt-dev, libgtk2.0-dev (>= 2.4.4-2), libart-2.0-dev, libcairo2-dev, g++-4.8 [armel armhf], netbase, libcloog-isl-dev (>= 0.18), libmpc-dev (>= 1.0), libmpfr-dev (>= 3.0.0-9~), libgmp-dev (>= 2:5.0.1~), - dejagnu [!m68k !hurd-amd64 !hurd-i386 !hurd-alpha], autogen, realpath (>= 1.9.12) | coreutils (>= 8.15), chrpath, lsb-release, quilt + dejagnu [!m68k !hurd-amd64 !hurd-i386 !hurd-alpha !kfreebsd-amd64 !kfreebsd-i386 !kfreebsd-alpha], autogen, realpath (>= 1.9.12), chrpath, lsb-release, quilt Build-Depends-Indep: doxygen (>= 1.7.2), graphviz (>= 2.2), ghostscript, texlive-latex-base, xsltproc, libxml2-utils, docbook-xsl-ns, Homepage: http://gcc.gnu.org/ XS-Vcs-Browser: http://svn.debian.org/viewsvn/gcccvs/branches/sid/gcc-4.8/ @@ -33,52 +33,6 @@ Description: GCC, the GNU Compiler Collection (base package) This package contains files common to all languages and libraries contained in the GNU Compiler Collection (GCC). -Package: libgcc1 -Architecture: any -Section: libs -Priority: required -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Multi-Arch: same -Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Provides: libgcc1-armel [armel], libgcc1-armhf [armhf] -Description: GCC support library - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: libgcc1-dbg -Architecture: any -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libgcc1 (= ${gcc:EpochVersion}), ${misc:Depends} -Multi-Arch: same -Provides: libgcc1-dbg-armel [armel], libgcc1-dbg-armhf [armhf] -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - -Package: libgcc2 -Architecture: m68k -Section: libs -Priority: required -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Multi-Arch: same -Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Description: GCC support library - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: libgcc2-dbg -Architecture: m68k -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libgcc2 (= ${gcc:Version}), ${misc:Depends} -Multi-Arch: same -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - Package: libgcc-4.8-dev Architecture: any Section: libdevel @@ -90,47 +44,6 @@ Description: GCC support library (development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. -Package: libgcc4 -Architecture: hppa -Multi-Arch: same -Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Section: libs -Priority: required -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GCC support library - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: libgcc4-dbg -Architecture: hppa -Multi-Arch: same -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libgcc4 (= ${gcc:Version}), ${misc:Depends} -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - -Package: lib64gcc1 -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${misc:Depends} -Conflicts: libgcc1 (<= 1:3.3-0pre9) -Description: GCC support library (64bit) - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: lib64gcc1-dbg -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64gcc1 (= ${gcc:EpochVersion}), ${misc:Depends} -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - Package: lib64gcc-4.8-dev Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 Section: libdevel @@ -141,27 +54,8 @@ Description: GCC support library (64bit development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. -Package: lib32gcc1 -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: libs -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: GCC support library (32 bit Version) - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: lib32gcc1-dbg -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32gcc1 (= ${gcc:EpochVersion}), ${misc:Depends} -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - Package: lib32gcc-4.8-dev -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: libdevel Priority: optional Recommends: ${dep:libcdev} @@ -170,25 +64,6 @@ Description: GCC support library (32 bit development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. -Package: libn32gcc1 -Architecture: mips mipsel mips64 mips64el -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${misc:Depends} -Conflicts: libgcc1 (<= 1:3.3-0pre9) -Description: GCC support library (n32) - Shared version of the support library, a library of internal subroutines - that GCC uses to overcome shortcomings of particular machines, or - special needs for some languages. - -Package: libn32gcc1-dbg -Architecture: mips mipsel mips64 mips64el -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32gcc1 (= ${gcc:EpochVersion}), ${misc:Depends} -Description: GCC support library (debug symbols) - Debug symbols for the GCC support library. - Package: libn32gcc-4.8-dev Architecture: mips mipsel mips64 mips64el Section: libdevel @@ -199,13 +74,23 @@ Description: GCC support library (n32 development files) This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. +Package: libx32gcc-4.8-dev +Architecture: amd64 i386 +Section: libdevel +Priority: optional +Recommends: ${dep:libcdev} +Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libgccbiarch}, ${dep:libsspbiarch}, ${dep:libgompbiarch}, ${dep:libitmbiarch}, ${dep:libatomicbiarch}, ${dep:libbtracebiarch}, ${dep:libasanbiarch}, ${dep:libtsanbiarch}, ${dep:libqmathbiarch}, ${shlibs:Depends}, ${misc:Depends} +Description: GCC support library (x32 development files) + This package contains the headers and static library files necessary for + building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. + Package: gcc-4.8 Architecture: any Section: devel Priority: optional Depends: cpp-4.8 (= ${gcc:Version}), gcc-4.8-base (= ${gcc:Version}), binutils (>= ${binutils:Version}), - libgcc-4.8-dev (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} + ${dep:libgccdev}, ${shlibs:Depends}, ${misc:Depends} Recommends: ${dep:libcdev} Suggests: ${gcc:multilib}, gcc-4.8-doc (>= ${gcc:SoftVersion}), gcc-4.8-locales (>= ${gcc:SoftVersion}), libgcc1-dbg (>= ${libgcc:Version}), libgomp1-dbg (>= ${gcc:Version}), libitm1-dbg (>= ${gcc:Version}), libatomic1-dbg (>= ${gcc:Version}), libasan0-dbg (>= ${gcc:Version}), libtsan0-dbg (>= ${gcc:Version}), libbacktrace1-dbg (>= ${gcc:Version}), libquadmath0-dbg (>= ${gcc:Version}), ${dep:libcloog}, ${dep:gold} Provides: c-compiler @@ -213,7 +98,7 @@ Description: GNU C compiler This is the GNU C compiler, a fairly portable optimizing compiler for C. Package: gcc-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), gcc-4.8 (= ${gcc:Version}), ${dep:libcbiarchdev}, ${dep:libgccbiarchdev}, ${shlibs:Depends}, ${misc:Depends} @@ -238,7 +123,7 @@ Architecture: hppa Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Conflicts: gcc-3.3-hppa64 (<= 1:3.3.4-5), gcc-3.4-hppa64 (<= 3.4.1-3) +Conflicts: gcc-3.3-hppa64 (<= 1:3.3.4-5), gcc-3.4-hppa64 (<= 3.4.1-3), gcc-4.7-hppa64 (<< 4.7.3-13), gcc-4.9-hppa64 (<< 4.9.0-2) Description: GNU C compiler (cross compiler for hppa64) This is the GNU C compiler, a fairly portable optimizing compiler for C. @@ -256,14 +141,6 @@ Description: GNU C preprocessor This package has been separated from gcc for the benefit of those who require the preprocessor but not the compiler. -Package: cpp-4.8-doc -Architecture: all -Section: doc -Priority: optional -Depends: gcc-4.8-base (>= ${gcc:SoftVersion}), dpkg (>= 1.15.4) | install-info, ${misc:Depends} -Description: Documentation for the GNU C preprocessor (cpp) - Documentation for the GNU C preprocessor in info format. - Package: gcc-4.8-locales Architecture: all Section: devel @@ -288,7 +165,7 @@ Description: GNU C++ compiler This is the GNU C++ compiler, a fairly portable optimizing compiler for C++. Package: g++-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), g++-4.8 (= ${gcc:Version}), gcc-4.8-multilib (= ${gcc:Version}), ${dep:libcxxbiarchdev}, ${shlibs:Depends}, ${misc:Depends} @@ -299,245 +176,108 @@ Description: GNU C++ compiler (multilib files) On architectures with multilib support, the package contains files and dependencies for the non-default multilib architecture(s). -Package: libssp0 -Architecture: any -Multi-Arch: same -Pre-Depends: multiarch-support -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GCC stack smashing protection library - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: lib32ssp0 -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Replaces: libssp0 (<< 4.1) -Conflicts: ${confl:lib32} -Description: GCC stack smashing protection library (32bit) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: lib64ssp0 -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Replaces: libssp0 (<< 4.1) -Description: GCC stack smashing protection library (64bit) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: libn32ssp0 -Architecture: mips mipsel mips64 mips64el -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Replaces: libssp0 (<< 4.1) -Description: GCC stack smashing protection library (n32) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: libx32ssp0 -Architecture: -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Replaces: libssp0 (<< 4.1) -Description: GCC stack smashing protection library (x32) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: libhfssp0 -Architecture: -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC stack smashing protection library (hard float ABI) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: libsfssp0 -Architecture: -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC stack smashing protection library (soft float ABI) - GCC can now emit code for protecting applications from stack-smashing attacks. - The protection is realized by buffer overflow detection and reordering of - stack variables to avoid pointer corruption. - -Package: libgomp1 +Package: libasan0 Section: libs Architecture: any +Provides: libasan0-armel [armel], libasan0-armhf [armhf] Multi-Arch: same Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Provides: libgomp1-armel [armel], libgomp1-armhf [armhf] Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GCC OpenMP (GOMP) support library - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Description: AddressSanitizer -- a fast memory error detector + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: libgomp1-dbg +Package: libasan0-dbg Architecture: any Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libgomp1 (= ${gcc:Version}), ${misc:Depends} +Depends: gcc-4.8-base (= ${gcc:Version}), libasan0 (= ${gcc:Version}), ${misc:Depends} +Provides: libasan0-dbg-armel [armel], libasan0-dbg-armhf [armhf] Multi-Arch: same -Provides: libgomp1-dbg-armel [armel], libgomp1-dbg-armhf [armhf] -Description: GCC OpenMP (GOMP) support library (debug symbols) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Description: AddressSanitizer -- a fast memory error detector (debug symbols) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: lib32gomp1 +Package: lib32asan0 Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} Conflicts: ${confl:lib32} -Description: GCC OpenMP (GOMP) support library (32bit) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Description: AddressSanitizer -- a fast memory error detector (32bit) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: lib32gomp1-dbg -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Package: lib32asan0-dbg +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32gomp1 (= ${gcc:Version}), ${misc:Depends} -Description: GCC OpenMP (GOMP) support library (32 bit debug symbols) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Depends: gcc-4.8-base (= ${gcc:Version}), lib32asan0 (= ${gcc:Version}), ${misc:Depends} +Description: AddressSanitizer -- a fast memory error detector (32 bit debug symbols) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: lib64gomp1 +Package: lib64asan0 Section: libs Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC OpenMP (GOMP) support library (64bit) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Description: AddressSanitizer -- a fast memory error detector (64bit) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: lib64gomp1-dbg +Package: lib64asan0-dbg Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64gomp1 (= ${gcc:Version}), ${misc:Depends} -Description: GCC OpenMP (GOMP) support library (64bit debug symbols) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. +Depends: gcc-4.8-base (= ${gcc:Version}), lib64asan0 (= ${gcc:Version}), ${misc:Depends} +Description: AddressSanitizer -- a fast memory error detector (64bit debug symbols) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: libn32gomp1 +Package: libn32asan0 Section: libs Architecture: mips mipsel mips64 mips64el -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC OpenMP (GOMP) support library (n32) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - in the GNU Compiler Collection. - -Package: libn32gomp1-dbg -Architecture: mips mipsel mips64 mips64el -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32gomp1 (= ${gcc:Version}), ${misc:Depends} -Description: GCC OpenMP (GOMP) support library (n32 debug symbols) - GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers - -Package: libatomic1 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: multiarch-support -Provides: libatomic1-armel [armel], libatomic1-armhf [armhf] -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: support library providing __atomic built-in functions - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. - -Package: libatomic1-dbg -Architecture: any -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libatomic1 (= ${gcc:Version}), ${misc:Depends} -Multi-Arch: same -Provides: libatomic1-dbg-armel [armel], libatomic1-dbg-armhf [armhf] -Description: support library providing __atomic built-in functions (debug symbols) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. - -Package: lib32atomic1 -Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: support library providing __atomic built-in functions (32bit) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. - -Package: lib32atomic1-dbg -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32atomic1 (= ${gcc:Version}), ${misc:Depends} -Description: support library providing __atomic built-in functions (32 bit debug symbols) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. - -Package: lib64atomic1 -Section: libs -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: support library providing __atomic built-in functions (64bit) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. +Description: AddressSanitizer -- a fast memory error detector (n32) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: lib64atomic1-dbg -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 +Package: libn32asan0-dbg +Architecture: mips mipsel mips64 mips64el Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64atomic1 (= ${gcc:Version}), ${misc:Depends} -Description: support library providing __atomic built-in functions (64bit debug symbols) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. +Depends: gcc-4.8-base (= ${gcc:Version}), libn32asan0 (= ${gcc:Version}), ${misc:Depends} +Description: AddressSanitizer -- a fast memory error detector (n32 debug symbols) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: libn32atomic1 +Package: libx32asan0 Section: libs -Architecture: mips mipsel mips64 mips64el +Architecture: amd64 i386 Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: support library providing __atomic built-in functions (n32) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. +Description: AddressSanitizer -- a fast memory error detector (x32) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. -Package: libn32atomic1-dbg -Architecture: mips mipsel mips64 mips64el +Package: libx32asan0-dbg +Architecture: amd64 i386 Section: debug Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32atomic1 (= ${gcc:Version}), ${misc:Depends} -Description: support library providing __atomic built-in functions (n32 debug symbols) - library providing __atomic built-in functions. When an atomic call cannot - be turned into lock-free instructions, GCC will make calls into this library. +Depends: gcc-4.8-base (= ${gcc:Version}), libx32asan0 (= ${gcc:Version}), ${misc:Depends} +Description: AddressSanitizer -- a fast memory error detector (x32 debug symbols) + AddressSanitizer (ASan) is a fast memory error detector. It finds + use-after-free and {heap,stack,global}-buffer overflow bugs in C/C++ programs. Package: libtsan0 Section: libs Architecture: any +Provides: libtsan0-armel [armel], libtsan0-armhf [armhf] Multi-Arch: same Pre-Depends: multiarch-support -Provides: libtsan0-armel [armel], libtsan0-armhf [armhf] Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} Description: ThreadSanitizer -- a Valgrind-based detector of data races (runtime) @@ -549,92 +289,12 @@ Architecture: any Section: debug Priority: extra Depends: gcc-4.8-base (= ${gcc:Version}), libtsan0 (= ${gcc:Version}), ${misc:Depends} -Multi-Arch: same Provides: libtsan0-dbg-armel [armel], libtsan0-dbg-armhf [armhf] +Multi-Arch: same Description: ThreadSanitizer -- a Valgrind-based detector of data races (debug symbols) ThreadSanitizer (Tsan) is a data race detector for C/C++ programs. The Linux and Mac versions are based on Valgrind. -Package: libquadmath0 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: multiarch-support -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GCC Quad-Precision Math Library - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. The library is used to provide on such - targets the REAL(16) type in the GNU Fortran compiler. - -Package: libquadmath0-dbg -Architecture: any -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libquadmath0 (= ${gcc:Version}), ${misc:Depends} -Multi-Arch: same -Description: GCC Quad-Precision Math Library (debug symbols) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. - -Package: lib32quadmath0 -Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: GCC Quad-Precision Math Library (32bit) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. The library is used to provide on such - targets the REAL(16) type in the GNU Fortran compiler. - -Package: lib32quadmath0-dbg -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32quadmath0 (= ${gcc:Version}), ${misc:Depends} -Description: GCC Quad-Precision Math Library (32 bit debug symbols) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. - -Package: lib64quadmath0 -Section: libs -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC Quad-Precision Math Library (64bit) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. The library is used to provide on such - targets the REAL(16) type in the GNU Fortran compiler. - -Package: lib64quadmath0-dbg -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64quadmath0 (= ${gcc:Version}), ${misc:Depends} -Description: GCC Quad-Precision Math Library (64bit debug symbols) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. - -Package: libn32quadmath0 -Section: libs -Architecture: mips mipsel mips64 mips64el -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: GCC Quad-Precision Math Library (n32) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. The library is used to provide on such - targets the REAL(16) type in the GNU Fortran compiler. - -Package: libn32quadmath0-dbg -Architecture: mips mipsel mips64 mips64el -Section: debug -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32quadmath0 (= ${gcc:Version}), ${misc:Depends} -Description: GCC Quad-Precision Math Library (n32 debug symbols) - A library, which provides quad-precision mathematical functions on targets - supporting the __float128 datatype. - Package: gobjc++-4.8 Architecture: any Priority: optional @@ -647,7 +307,7 @@ Description: GNU Objective-C++ compiler gcc backend to generate optimized code. Package: gobjc++-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), gobjc++-4.8 (= ${gcc:Version}), g++-4.8-multilib (= ${gcc:Version}), gobjc-4.8-multilib (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} @@ -670,7 +330,7 @@ Description: GNU Objective-C compiler gcc backend to generate optimized code. Package: gobjc-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), gobjc-4.8 (= ${gcc:Version}), gcc-4.8-multilib (= ${gcc:Version}), ${dep:libobjcbiarchdev}, ${shlibs:Depends}, ${misc:Depends} @@ -701,7 +361,7 @@ Description: Runtime library for GNU Objective-C applications (64bit development GNU ObjC applications. Package: lib32objc-4.8-dev -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: libdevel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), lib32gcc-4.8-dev (= ${gcc:Version}), lib32objc4 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} @@ -718,75 +378,14 @@ Description: Runtime library for GNU Objective-C applications (n32 development f This package contains the headers and static library files needed to build GNU ObjC applications. -Package: libobjc4 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: multiarch-support -Provides: libobjc4-armel [armel], libobjc4-armhf [armhf] -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Objective-C applications - Library needed for GNU ObjC applications linked against the shared library. - -Package: libobjc4-dbg -Section: debug -Architecture: any -Multi-Arch: same -Provides: libobjc4-dbg-armel [armel], libobjc4-dbg-armhf [armhf] -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libobjc4 (= ${gcc:Version}), libgcc1-dbg (>= ${libgcc:Version}), ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (debug symbols) - Library needed for GNU ObjC applications linked against the shared library. - -Package: lib64objc4 -Section: libs -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (64bit) - Library needed for GNU ObjC applications linked against the shared library. - -Package: lib64objc4-dbg -Section: debug -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64objc4 (= ${gcc:Version}), lib64gcc1-dbg (>= ${gcc:EpochVersion}), ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (64 bit debug symbols) - Library needed for GNU ObjC applications linked against the shared library. - -Package: lib32objc4 -Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: Runtime library for GNU Objective-C applications (32bit) - Library needed for GNU ObjC applications linked against the shared library. - -Package: lib32objc4-dbg -Section: debug -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32objc4 (= ${gcc:Version}), lib32gcc1-dbg (>= ${gcc:EpochVersion}), ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (32 bit debug symbols) - Library needed for GNU ObjC applications linked against the shared library. - -Package: libn32objc4 -Section: libs -Architecture: mips mipsel mips64 mips64el +Package: libx32objc-4.8-dev +Architecture: amd64 i386 +Section: libdevel Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (n32) - Library needed for GNU ObjC applications linked against the shared library. - -Package: libn32objc4-dbg -Section: debug -Architecture: mips mipsel mips64 mips64el -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32objc4 (= ${gcc:Version}), libn32gcc1-dbg (>= ${gcc:EpochVersion}), ${misc:Depends} -Description: Runtime library for GNU Objective-C applications (n32 debug symbols) - Library needed for GNU ObjC applications linked against the shared library. +Depends: gcc-4.8-base (= ${gcc:Version}), libx32gcc-4.8-dev (= ${gcc:Version}), libx32objc4 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Runtime library for GNU Objective-C applications (x32 development files) + This package contains the headers and static library files needed to build + GNU ObjC applications. Package: gfortran-4.8 Architecture: any @@ -800,7 +399,7 @@ Description: GNU Fortran compiler gcc backend to generate optimized code. Package: gfortran-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), gfortran-4.8 (= ${gcc:Version}), gcc-4.8-multilib (= ${gcc:Version}), ${dep:libgfortranbiarchdev}, ${shlibs:Depends}, ${misc:Depends} @@ -811,14 +410,6 @@ Description: GNU Fortran compiler (multilib files) On architectures with multilib support, the package contains files and dependencies for the non-default multilib architecture(s). -Package: gfortran-4.8-doc -Architecture: all -Section: doc -Priority: optional -Depends: gcc-4.8-base (>= ${gcc:SoftVersion}), dpkg (>= 1.15.4) | install-info, ${misc:Depends} -Description: Documentation for the GNU Fortran compiler (gfortran) - Documentation for the GNU Fortran compiler in info format. - Package: libgfortran-4.8-dev Architecture: any Section: libdevel @@ -839,7 +430,7 @@ Description: Runtime library for GNU Fortran applications (64bit development fil GNU Fortran applications. Package: lib32gfortran-4.8-dev -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: libdevel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), lib32gcc-4.8-dev (= ${gcc:Version}), lib32gfortran3 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} @@ -856,84 +447,14 @@ Description: Runtime library for GNU Fortran applications (n32 development files This package contains the headers and static library files needed to build GNU Fortran applications. -Package: libgfortran3 -Section: libs -Architecture: any -Multi-Arch: same -Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Provides: libgfortran3-armel [armel], libgfortran3-armhf [armhf] -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Fortran applications - Library needed for GNU Fortran applications linked against the - shared library. - -Package: libgfortran3-dbg -Section: debug -Architecture: any -Multi-Arch: same -Provides: libgfortran3-dbg-armel [armel], libgfortran3-dbg-armhf [armhf] -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libgfortran3 (= ${gcc:Version}), libgcc1-dbg (>= ${libgcc:Version}), ${misc:Depends} -Description: Runtime library for GNU Fortran applications (debug symbols) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: lib64gfortran3 -Section: libs -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Fortran applications (64bit) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: lib64gfortran3-dbg -Section: debug -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib64gfortran3 (= ${gcc:Version}), ${misc:Depends} -Description: Runtime library for GNU Fortran applications (64bit debug symbols) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: lib32gfortran3 -Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: Runtime library for GNU Fortran applications (32bit) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: lib32gfortran3-dbg -Section: debug -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32gfortran3 (= ${gcc:Version}), ${misc:Depends} -Description: Runtime library for GNU Fortran applications (32 bit debug symbols) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: libn32gfortran3 -Section: libs -Architecture: mips mipsel mips64 mips64el +Package: libx32gfortran-4.8-dev +Architecture: amd64 i386 +Section: libdevel Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} -Description: Runtime library for GNU Fortran applications (n32) - Library needed for GNU Fortran applications linked against the - shared library. - -Package: libn32gfortran3-dbg -Section: debug -Architecture: mips mipsel mips64 mips64el -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), libn32gfortran3 (= ${gcc:Version}), ${misc:Depends} -Description: Runtime library for GNU Fortran applications (n32 debug symbols) - Library needed for GNU Fortran applications linked against the - shared library. +Depends: gcc-4.8-base (= ${gcc:Version}), libx32gcc-4.8-dev (= ${gcc:Version}), libx32gfortran3 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Runtime library for GNU Fortran applications (x32 development files) + This package contains the headers and static library files needed to build + GNU Fortran applications. Package: gccgo-4.8 Architecture: any @@ -946,7 +467,7 @@ Description: GNU Go compiler by the gcc compiler. It uses the gcc backend to generate optimized code. Package: gccgo-4.8-multilib -Architecture: amd64 i386 illumos-amd64 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 +Architecture: amd64 i386 kfreebsd-amd64 mips mips64 mips64el mipsel mipsn32 mipsn32el powerpc ppc64 s390 s390x sparc sparc64 x32 Section: devel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), gccgo-4.8 (= ${gcc:Version}), gcc-4.8-multilib (= ${gcc:Version}), ${dep:libgobiarch}, ${shlibs:Depends}, ${misc:Depends} @@ -958,20 +479,12 @@ Description: GNU Go compiler (multilib files) On architectures with multilib support, the package contains files and dependencies for the non-default multilib architecture(s). -Package: gccgo-4.8-doc -Architecture: all -Section: doc -Priority: optional -Depends: gcc-4.8-base (>= ${gcc:SoftVersion}), dpkg (>= 1.15.4) | install-info, ${misc:Depends} -Description: Documentation for the GNU Go compiler (gccgo) - Documentation for the GNU Go compiler in info format. - Package: libgo4 Section: libs Architecture: any +Provides: libgo4-armel [armel], libgo4-armhf [armhf] Multi-Arch: same Pre-Depends: multiarch-support -Provides: libgo4-armel [armel], libgo4-armhf [armhf] Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} Replaces: libgo3 @@ -982,8 +495,8 @@ Description: Runtime library for GNU Go applications Package: libgo4-dbg Section: debug Architecture: any -Multi-Arch: same Provides: libgo4-dbg-armel [armel], libgo4-dbg-armhf [armhf] +Multi-Arch: same Priority: extra Depends: gcc-4.8-base (= ${gcc:Version}), libgo4 (= ${gcc:Version}), ${misc:Depends} Description: Runtime library for GNU Go applications (debug symbols) @@ -1011,7 +524,7 @@ Description: Runtime library for GNU Go applications (64bit debug symbols) Package: lib32go4 Section: libs -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} Conflicts: ${confl:lib32} @@ -1022,7 +535,7 @@ Description: Runtime library for GNU Go applications (32bit) Package: lib32go4-dbg Section: debug -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Priority: extra Depends: gcc-4.8-base (= ${gcc:Version}), lib32go4 (= ${gcc:Version}), ${misc:Depends} Description: Runtime library for GNU Go applications (32 bit debug symbols) @@ -1048,6 +561,25 @@ Description: Runtime library for GNU Go applications (n32 debug symbols) Library needed for GNU Go applications linked against the shared library. +Package: libx32go4 +Section: libs +Architecture: amd64 i386 +Priority: optional +Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libcbiarch}, ${shlibs:Depends}, ${misc:Depends} +Replaces: libx32go3 +Description: Runtime library for GNU Go applications (x32) + Library needed for GNU Go applications linked against the + shared library. + +Package: libx32go4-dbg +Section: debug +Architecture: amd64 i386 +Priority: extra +Depends: gcc-4.8-base (= ${gcc:Version}), libx32go4 (= ${gcc:Version}), ${misc:Depends} +Description: Runtime library for GNU Go applications (x32 debug symbols) + Library needed for GNU Go applications linked against the + shared library. + Package: gcj-4.8 Section: java Architecture: any @@ -1200,60 +732,6 @@ Description: libgcj API documentation and example programs Autogenerated documentation describing the API of the libgcj library. Sources and precompiled example programs from the Classpath library. -Package: libstdc++6 -Architecture: any -Section: libs -Priority: important -Depends: gcc-4.8-base (= ${gcc:Version}), ${dep:libc}, ${shlibs:Depends}, ${misc:Depends} -Multi-Arch: same -Pre-Depends: multiarch-support -Breaks: ${multiarch:breaks} -Provides: libstdc++6-armel [armel], libstdc++6-armhf [armhf] -Conflicts: scim (<< 1.4.2-1) -Description: GNU Standard C++ Library v3 - This package contains an additional runtime library for C++ programs - built with the GNU compiler. - . - libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which - was included up to g++-2.95. The first version of libstdc++-v3 appeared - in g++-3.0. - -Package: lib32stdc++6 -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 -Section: libs -Priority: extra -Depends: gcc-4.8-base (= ${gcc:Version}), lib32gcc1 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Conflicts: ${confl:lib32} -Description: GNU Standard C++ Library v3 (32 bit Version) - This package contains an additional runtime library for C++ programs - built with the GNU compiler. - -Package: lib64stdc++6 -Architecture: i386 powerpc sparc s390 mips mipsel mipsn32 mipsn32el x32 -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), lib64gcc1 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GNU Standard C++ Library v3 (64bit) - This package contains an additional runtime library for C++ programs - built with the GNU compiler. - . - libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which - was included up to g++-2.95. The first version of libstdc++-v3 appeared - in g++-3.0. - -Package: libn32stdc++6 -Architecture: mips mipsel mips64 mips64el -Section: libs -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), libn32gcc1 (>= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GNU Standard C++ Library v3 (n32) - This package contains an additional runtime library for C++ programs - built with the GNU compiler. - . - libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which - was included up to g++-2.95. The first version of libstdc++-v3 appeared - in g++-3.0. - Package: libstdc++-4.8-dev Architecture: any Multi-Arch: same @@ -1288,8 +766,8 @@ Architecture: any Section: debug Priority: extra Depends: gcc-4.8-base (= ${gcc:Version}), libstdc++6 (>= ${gcc:Version}), libgcc1-dbg (>= ${libgcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Multi-Arch: same Provides: libstdc++6-4.8-dbg-armel [armel], libstdc++6-4.8-dbg-armhf [armhf] +Multi-Arch: same Recommends: libstdc++-4.8-dev (= ${gcc:Version}) Conflicts: libstdc++5-dbg, libstdc++5-3.3-dbg, libstdc++6-dbg, libstdc++6-4.0-dbg, libstdc++6-4.1-dbg, libstdc++6-4.2-dbg, libstdc++6-4.3-dbg, libstdc++6-4.4-dbg, libstdc++6-4.5-dbg, libstdc++6-4.6-dbg, libstdc++6-4.7-dbg Description: GNU Standard C++ Library v3 (debugging files) @@ -1297,7 +775,7 @@ Description: GNU Standard C++ Library v3 (debugging files) debugging symbols. Package: lib32stdc++-4.8-dev -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: libdevel Priority: optional Depends: gcc-4.8-base (= ${gcc:Version}), lib32gcc-4.8-dev (= ${gcc:Version}), lib32stdc++6 (>= ${gcc:Version}), libstdc++-4.8-dev (= ${gcc:Version}), ${misc:Depends} @@ -1310,7 +788,7 @@ Description: GNU Standard C++ Library v3 (development files) in g++-3.0. Package: lib32stdc++6-4.8-dbg -Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el illumos-amd64 +Architecture: amd64 ppc64 kfreebsd-amd64 s390x sparc64 x32 mipsn32 mipsn32el mips64 mips64el Section: debug Priority: extra Depends: gcc-4.8-base (= ${gcc:Version}), lib32stdc++6 (>= ${gcc:Version}), libstdc++-4.8-dev (= ${gcc:Version}), lib32gcc1-dbg (>= ${gcc:EpochVersion}), ${shlibs:Depends}, ${misc:Depends} @@ -1365,6 +843,29 @@ Description: GNU Standard C++ Library v3 (debugging files) This package contains the shared library of libstdc++ compiled with debugging symbols. +Package: libx32stdc++-4.8-dev +Architecture: amd64 i386 +Section: libdevel +Priority: optional +Depends: gcc-4.8-base (= ${gcc:Version}), libx32gcc-4.8-dev (= ${gcc:Version}), libx32stdc++6 (>= ${gcc:Version}), libstdc++-4.8-dev (= ${gcc:Version}), ${misc:Depends} +Description: GNU Standard C++ Library v3 (development files) + This package contains the headers and static library files necessary for + building C++ programs which use libstdc++. + . + libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which + was included up to g++-2.95. The first version of libstdc++-v3 appeared + in g++-3.0. + +Package: libx32stdc++6-4.8-dbg +Architecture: amd64 i386 +Section: debug +Priority: extra +Depends: gcc-4.8-base (= ${gcc:Version}), libx32stdc++6 (>= ${gcc:Version}), libstdc++-4.8-dev (= ${gcc:Version}), libx32gcc1-dbg (>= ${gcc:EpochVersion}), ${shlibs:Depends}, ${misc:Depends} +Conflicts: libx32stdc++6-dbg, libx32stdc++6-4.6-dbg, libx32stdc++6-4.7-dbg +Description: GNU Standard C++ Library v3 (debugging files) + This package contains the shared library of libstdc++ compiled with + debugging symbols. + Package: libstdc++-4.8-doc Architecture: all Section: doc @@ -1379,6 +880,41 @@ Description: GNU Standard C++ Library v3 (documentation files) alphabetical list, compound list, file list, namespace members, compound members and file members. +Package: gdc-4.8 +Architecture: any +Priority: optional +Depends: gcc-4.8-base (>= ${gcc:SoftVersion}), g++-4.8 (>= ${gcc:SoftVersion}), ${dep:gdccross}, ${dep:phobosdev}, ${shlibs:Depends}, ${misc:Depends} +Provides: gdc, d-compiler, d-v2-compiler +Replaces: gdc (<< 4.4.6-5) +Description: GNU D compiler (version 2), based on the GCC backend + This is the GNU D compiler, which compiles D on platforms supported by gcc. + It uses the gcc backend to generate optimised code. + . + This compiler supports D language version 2. + +Package: libphobos-4.8-dev +Architecture: armel armhf amd64 i386 x32 kfreebsd-amd64 kfreebsd-i386 +Section: libdevel +Priority: optional +Depends: gcc-4.8-base (= ${gcc:Version}), zlib1g-dev, ${shlibs:Depends}, ${misc:Depends} +Provides: libphobos-dev +Replaces: gdc-4.8 (<< 4.8.2-19) +Description: Phobos D standard library + This is the Phobos standard library that comes with the D2 compiler. + . + For more information check http://www.dlang.org/phobos/ + +Package: libphobos-4.8-dbg +Section: debug +Architecture: armel armhf amd64 i386 x32 kfreebsd-amd64 kfreebsd-i386 +Priority: extra +Depends: gcc-4.8-base (= ${gcc:Version}), libphobos-4.8-dev (= ${gdc:Version}), ${misc:Depends} +Provides: libphobos-dbg +Description: The Phobos D standard library (debug symbols) + This is the Phobos standard library that comes with the D2 compiler. + . + For more information check http://www.dlang.org/phobos/ + Package: gcc-4.8-soft-float Architecture: arm armel armhf Priority: optional @@ -1388,34 +924,10 @@ Description: GCC soft-floating-point gcc libraries (ARM) These are versions of basic static libraries such as libgcc.a compiled with the -msoft-float option, for CPUs without a floating-point unit. -Package: fixincludes -Architecture: any -Priority: optional -Depends: gcc-4.8-base (= ${gcc:Version}), gcc-4.8 (= ${gcc:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: Fix non-ANSI header files - FixIncludes was created to fix non-ANSI system header files. Many - system manufacturers supply proprietary headers that are not ANSI compliant. - The GNU compilers cannot compile non-ANSI headers. Consequently, the - FixIncludes shell script was written to fix the header files. - . - Not all packages with header files are installed on the system, when the - package is built, so we make fixincludes available at build time of other - packages, such that checking tools like lintian can make use of it. - -Package: gcc-4.8-doc -Architecture: all -Section: doc -Priority: optional -Depends: gcc-4.8-base (>= ${gcc:SoftVersion}), dpkg (>= 1.15.4) | install-info, ${misc:Depends} -Conflicts: gcc-docs (<< 2.95.2) -Replaces: gcc (<=2.7.2.3-4.3), gcc-docs (<< 2.95.2) -Description: Documentation for the GNU compilers (gcc, gobjc, g++) - Documentation for the GNU compilers in info format. - Package: gcc-4.8-source Architecture: all Priority: optional -Depends: make (>= 3.81), autoconf2.64, quilt, patchutils, gawk, ${misc:Depends} +Depends: make, autoconf2.64, quilt, patchutils, gawk, ${misc:Depends} Description: Source of the GNU Compiler Collection This package contains the sources and patches which are needed to build the GNU Compiler Collection (GCC). diff --git a/debian/control.m4 b/debian/control.m4 index 667e31e..2edc124 100644 --- a/debian/control.m4 +++ b/debian/control.m4 @@ -21,6 +21,7 @@ define(`MAINTAINER', `Debian GCC Maintainers <debian-gcc@lists.debian.org>') define(`depifenabled', `ifelse(index(enabled_languages, `$1'), -1, `', `$2')') define(`ifenabled', `ifelse(index(enabled_languages, `$1'), -1, `dnl', `$2')') +ifdef(`TARGET',`ifdef(`CROSS_ARCH',`',`undefine(`MULTIARCH')')') define(`CROSS_ARCH', ifdef(`CROSS_ARCH', CROSS_ARCH, `all')) define(`libdep', `lib$2$1`'LS`'AQ (ifelse(`$3',`',`>=',`$3') ifelse(`$4',`',`${gcc:Version}',`$4'))') define(`libdevdep', `lib$2$1`'LS`'AQ (ifelse(`$3',`',`=',`$3') ifelse(`$4',`',`${gcc:Version}',`$4'))') @@ -64,7 +65,7 @@ Build-Depends: debhelper (>= 5.0.62), Build-Depends: debhelper (>= 5.0.62), GCC_MULTILIB_BUILD_DEP LIBC_BUILD_DEP, LIBC_BIARCH_BUILD_DEP LIBC_DBG_DEP kfreebsd-kernel-headers (>= 0.84) [kfreebsd-any], - AUTO_BUILD_DEP AUTOGEN_BUILD_DEP + AUTO_BUILD_DEP AUTOGEN_BUILD_DEP BASE_BUILD_DEP libunwind7-dev (>= 0.98.5-6) [ia64], libatomic-ops-dev [ia64], zlib1g-dev, gawk, lzma, xz-utils, patchutils, BINUTILS_BUILD_DEP, binutils-hppa64 (>= BINUTILSBDV) [hppa], @@ -125,11 +126,10 @@ define(`BASEDEP', `gnat`'PV-base (= ${gnat:Version})') define(`SOFTBASEDEP', `gnat`'PV-base (>= ${gnat:SoftVersion})') ') -ifdef(`TARGET', `', ` ifenabled(`gccbase',` Package: gcc`'PV-base -Architecture: any +Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') ifdef(`MULTIARCH', `Multi-Arch: same ')`'dnl Section: libs @@ -146,8 +146,7 @@ ifdef(`BASE_ONLY', `dnl This version of GCC is not yet available for this architecture. Please use the compilers from the gcc-snapshot package for testing. ')`'dnl -')`'dnl -')`'dnl native +')`'dnl gccbase ifenabled(`gccxbase',` dnl override default base package dependencies to cross version @@ -224,11 +223,11 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: ifdef(`TARGET',`devel',`libs') Priority: ifdef(`TARGET',`extra',required) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`Provides: libgcc1-TARGET-dcv1', +ifdef(`TARGET',`Provides: libgcc1-TARGET-dcv1',`Provides: libgcc1-armel [armel], libgcc1-armhf [armhf]') ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -')`Provides: libgcc1-armel [armel], libgcc1-armhf [armhf]') +')`'dnl BUILT_USING`'dnl Description: GCC support library`'ifdef(`TARGET)',` (TARGET)', `') Shared version of the support library, a library of internal subroutines @@ -245,11 +244,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(gcc1,,=,${gcc:EpochVersion}), ${misc:Depends} -ifdef(`TARGET',`',`dnl +ifdef(`TARGET',`',`Provides: libgcc1-dbg-armel [armel], libgcc1-dbg-armhf [armhf] +')`'dnl ifdef(`MULTIARCH',`Multi-Arch: same -')dnl -Provides: libgcc1-dbg-armel [armel], libgcc1-dbg-armhf [armhf] -')dnl +')`'dnl BUILT_USING`'dnl Description: GCC support library (debug symbols)`'ifdef(`TARGET)',` (TARGET)', `') Debug symbols for the GCC support library. @@ -265,10 +263,11 @@ Section: ifdef(`TARGET',`devel',`libs') Priority: ifdef(`TARGET',`extra',required) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} ifdef(`TARGET',`Provides: libgcc2-TARGET-dcv1 -',ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -'))`'dnl +')`'dnl BUILT_USING`'dnl Description: GCC support library`'ifdef(`TARGET)',` (TARGET)', `') Shared version of the support library, a library of internal subroutines @@ -285,8 +284,8 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`m68k') Section: debug Priority: extra Depends: BASEDEP, libdep(gcc2,,=,${gcc:Version}), ${misc:Depends} -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: GCC support library (debug symbols)`'ifdef(`TARGET)',` (TARGET)', `') Debug symbols for the GCC support library. @@ -304,8 +303,8 @@ Section: libdevel Priority: optional Recommends: ${dep:libcdev} Depends: BASEDEP, ${dep:libgcc}, ${dep:libssp}, ${dep:libgomp}, ${dep:libitm}, ${dep:libatomic}, ${dep:libbtrace}, ${dep:libasan}, ${dep:libtsan}, ${dep:libqmath}, ${dep:libunwinddev}, ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: GCC support library (development files) This package contains the headers and static library files necessary for @@ -315,10 +314,10 @@ Description: GCC support library (development files) ifenabled(`lib4gcc',` Package: libgcc4`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`hppa') -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -'))`'dnl +')`'dnl Section: ifdef(`TARGET',`devel',`libs') Priority: ifdef(`TARGET',`extra',required) Depends: ifdef(`STANDALONEJAVA',`gcj`'PV-base (>= ${gcj:Version})',`BASEDEP'), ${shlibs:Depends}, ${misc:Depends} @@ -335,8 +334,8 @@ ifdef(`TARGET', `dnl Package: libgcc4-dbg`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`hppa') -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Section: debug Priority: extra Depends: BASEDEP, libdep(gcc4,,=,${gcc:Version}), ${misc:Depends} @@ -702,7 +701,7 @@ Section: devel Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: cpp`'PV`'TS (= ${gcc:Version}),ifenabled(`gccbase',` BASEDEP,') binutils`'TS (>= ${binutils:Version}), - depifenabled(`libgcc',`libdevdep(gcc`'PV-dev`',), ')${shlibs:Depends}, ${misc:Depends} + ${dep:libgccdev}, ${shlibs:Depends}, ${misc:Depends} Recommends: ${dep:libcdev} Suggests: ${gcc:multilib}, gcc`'PV-doc (>= ${gcc:SoftVersion}), gcc`'PV-locales (>= ${gcc:SoftVersion}), libdbgdep(gcc`'GCC_SO-dbg,,>=,${libgcc:Version}), libdbgdep(gomp`'GOMP_SO-dbg,), libdbgdep(itm`'ITM_SO-dbg,), libdbgdep(atomic`'ATOMIC_SO-dbg,), libdbgdep(asan`'ASAN_SO-dbg,), libdbgdep(tsan`'TSAN_SO-dbg,), libdbgdep(backtrace`'BTRACE_SO-dbg,), libdbgdep(quadmath`'QMATH_SO-dbg,), ${dep:libcloog}, ${dep:gold} Provides: c-compiler`'TS @@ -750,7 +749,7 @@ Architecture: ifdef(`TARGET',`any',hppa) Section: devel Priority: PRI(optional) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} -Conflicts: gcc-3.3-hppa64 (<= 1:3.3.4-5), gcc-3.4-hppa64 (<= 3.4.1-3) +Conflicts: gcc-3.3-hppa64 (<= 1:3.3.4-5), gcc-3.4-hppa64 (<= 3.4.1-3), gcc-4.7-hppa64 (<< 4.7.3-13), gcc-4.9-hppa64 (<< 4.9.0-2) BUILT_USING`'dnl Description: GNU C compiler (cross compiler for hppa64) This is the GNU C compiler, a fairly portable optimizing compiler for C. @@ -931,10 +930,12 @@ ifenabled(`libgomp',` Package: libgomp`'GOMP_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libgomp'GOMP_SO`-armel [armel], libgomp'GOMP_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -')`Provides: libgomp'GOMP_SO`-armel [armel], libgomp'GOMP_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -947,8 +948,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(gomp`'GOMP_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libgomp'GOMP_SO`-dbg-armel [armel], libgomp'GOMP_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libgomp'GOMP_SO`-dbg-armel [armel], libgomp'GOMP_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: GCC OpenMP (GOMP) support library (debug symbols) GOMP is an implementation of OpenMP for the C, C++, and Fortran compilers @@ -1101,9 +1104,11 @@ ifenabled(`libitm',` Package: libitm`'ITM_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libitm'ITM_SO`-armel [armel], libitm'ITM_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libitm'ITM_SO`-armel [armel], libitm'ITM_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1117,8 +1122,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(itm`'ITM_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libitm'ITM_SO`-dbg-armel [armel], libitm'ITM_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libitm'ITM_SO`-dbg-armel [armel], libitm'ITM_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: GNU Transactional Memory Library (debug symbols) GNU Transactional Memory Library (libitm) provides transaction support for @@ -1287,9 +1294,11 @@ ifenabled(`libatomic',` Package: libatomic`'ATOMIC_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libatomic'ATOMIC_SO`-armel [armel], libatomic'ATOMIC_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libatomic'ATOMIC_SO`-armel [armel], libatomic'ATOMIC_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1302,8 +1311,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(atomic`'ATOMIC_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libatomic'ATOMIC_SO`-dbg-armel [armel], libatomic'ATOMIC_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libatomic'ATOMIC_SO`-dbg-armel [armel], libatomic'ATOMIC_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: support library providing __atomic built-in functions (debug symbols) library providing __atomic built-in functions. When an atomic call cannot @@ -1458,9 +1469,11 @@ ifenabled(`libasan',` Package: libasan`'ASAN_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libasan'ASAN_SO`-armel [armel], libasan'ASAN_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libasan'ASAN_SO`-armel [armel], libasan'ASAN_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1473,8 +1486,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(asan`'ASAN_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libasan'ASAN_SO`-dbg-armel [armel], libasan'ASAN_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libasan'ASAN_SO`-dbg-armel [armel], libasan'ASAN_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: AddressSanitizer -- a fast memory error detector (debug symbols) AddressSanitizer (ASan) is a fast memory error detector. It finds @@ -1629,9 +1644,11 @@ ifenabled(`libtsan',` Package: libtsan`'TSAN_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libtsan'TSAN_SO`-armel [armel], libtsan'TSAN_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libtsan'TSAN_SO`-armel [armel], libtsan'TSAN_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1644,8 +1661,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(tsan`'TSAN_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libtsan'TSAN_SO`-dbg-armel [armel], libtsan'TSAN_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libtsan'TSAN_SO`-dbg-armel [armel], libtsan'TSAN_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: ThreadSanitizer -- a Valgrind-based detector of data races (debug symbols) ThreadSanitizer (Tsan) is a data race detector for C/C++ programs. @@ -1804,9 +1823,11 @@ ifenabled(`libbacktrace',` Package: libbacktrace`'BTRACE_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libbacktrace'BTRACE_SO`-armel [armel], libbacktrace'BTRACE_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libbacktrace'BTRACE_SO`-armel [armel], libbacktrace'BTRACE_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1819,8 +1840,10 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(backtrace`'BTRACE_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libbacktrace'BTRACE_SO`-dbg-armel [armel], libbacktrace'BTRACE_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libbacktrace'BTRACE_SO`-dbg-armel [armel], libbacktrace'BTRACE_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: stack backtrace library (debug symbols) libbacktrace uses the GCC unwind interface to collect a stack trace, @@ -1976,9 +1999,9 @@ ifenabled(`libqmath',` Package: libquadmath`'QMATH_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -1992,8 +2015,8 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(quadmath`'QMATH_SO,,=), ${misc:Depends} -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: GCC Quad-Precision Math Library (debug symbols) A library, which provides quad-precision mathematical functions on targets @@ -2199,8 +2222,8 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: libdevel Priority: optional Depends: BASEDEP, libdevdep(gcc`'PV-dev,), libdep(objc`'OBJC_SO,), ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: Runtime library for GNU Objective-C applications (development files) This package contains the headers and static library files needed to build @@ -2277,10 +2300,12 @@ ifenabled(`libobjc',` Package: libobjc`'OBJC_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libobjc'OBJC_SO`-armel [armel], libobjc'OBJC_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support ifelse(OBJC_SO,`2',`Breaks: ${multiarch:breaks} -',`')')`Provides: libobjc'OBJC_SO`-armel [armel], libobjc'OBJC_SO`-armhf [armhf]') +',`')')`'dnl Priority: ifdef(`TARGET',`extra',`PRI(optional)') Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -2290,8 +2315,10 @@ Description: Runtime library for GNU Objective-C applications Package: libobjc`'OBJC_SO-dbg`'LS Section: debug Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libobjc'OBJC_SO`-dbg-armel [armel], libobjc'OBJC_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libobjc'OBJC_SO`-dbg-armel [armel], libobjc'OBJC_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Priority: extra Depends: BASEDEP, libdep(objc`'OBJC_SO,,=), libdbgdep(gcc`'GCC_SO-dbg,,>=,${libgcc:Version}), ${misc:Depends} BUILT_USING`'dnl @@ -2483,8 +2510,8 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: ifdef(`TARGET',`devel',`libdevel') Priority: optional Depends: BASEDEP, libdevdep(gcc`'PV-dev`',), libdep(gfortran`'FORTRAN_SO,), ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl BUILT_USING`'dnl Description: Runtime library for GNU Fortran applications (development files) This package contains the headers and static library files needed to build @@ -2561,10 +2588,12 @@ ifenabled(`libgfortran',` Package: libgfortran`'FORTRAN_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libgfortran'FORTRAN_SO`-armel [armel], libgfortran'FORTRAN_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -')`Provides: libgfortran'FORTRAN_SO`-armel [armel], libgfortran'FORTRAN_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',PRI(optional)) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -2575,8 +2604,10 @@ Description: Runtime library for GNU Fortran applications Package: libgfortran`'FORTRAN_SO-dbg`'LS Section: debug Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libgfortran'FORTRAN_SO`-dbg-armel [armel], libgfortran'FORTRAN_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libgfortran'FORTRAN_SO`-dbg-armel [armel], libgfortran'FORTRAN_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Priority: extra Depends: BASEDEP, libdep(gfortran`'FORTRAN_SO,,=), libdbgdep(gcc`'GCC_SO-dbg,,>=,${libgcc:Version}), ${misc:Depends} BUILT_USING`'dnl @@ -2787,9 +2818,11 @@ ifenabled(`libggo',` Package: libgo`'GO_SO`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`TARGET',`',`Provides: libgo'GO_SO`-armel [armel], libgo'GO_SO`-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -')`Provides: libgo'GO_SO`-armel [armel], libgo'GO_SO`-armhf [armhf]') +')`'dnl Priority: ifdef(`TARGET',`extra',PRI(optional)) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} Replaces: libgo3`'LS @@ -2801,8 +2834,10 @@ Description: Runtime library for GNU Go applications Package: libgo`'GO_SO-dbg`'LS Section: debug Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same -')`Provides: libgo'GO_SO`-dbg-armel [armel], libgo'GO_SO`-dbg-armhf [armhf]') +ifdef(`TARGET',`',`Provides: libgo'GO_SO`-dbg-armel [armel], libgo'GO_SO`-dbg-armhf [armhf] +')`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Priority: extra Depends: BASEDEP, libdep(go`'GO_SO,,=), ${misc:Depends} BUILT_USING`'dnl @@ -3152,12 +3187,13 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: ifdef(`TARGET',`devel',`libs') Priority: ifdef(`TARGET',`extra',PRI(important)) Depends: BASEDEP, ${dep:libc}, ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`Provides: libstdc++CXX_SO-TARGET-dcv1', +ifdef(`TARGET',`Provides: libstdc++CXX_SO-TARGET-dcv1',`Provides: libstdc++'CXX_SO`-armel [armel], libstdc++'CXX_SO`-armhf [armhf]') ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support Breaks: ${multiarch:breaks} -')`Provides: libstdc++'CXX_SO`-armel [armel], libstdc++'CXX_SO`-armhf [armhf]') +')`'dnl Conflicts: scim (<< 1.4.2-1) +Replaces: libstdc++CXX_SO`'PV-dbg`'LS (<< 4.8.2-22) BUILT_USING`'dnl Description: GNU Standard C++ Library v3`'ifdef(`TARGET)',` (TARGET)', `') This package contains an additional runtime library for C++ programs @@ -3328,8 +3364,8 @@ Description: GNU Standard C++ Library v3 [NEON version] ifenabled(`c++dev',` Package: libstdc++`'PV-dev`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Section: ifdef(`TARGET',`devel',`libdevel') Priority: ifdef(`TARGET',`extra',PRI(optional)) Depends: BASEDEP, libdevdep(gcc`'PV-dev,,=), libdep(stdc++CXX_SO,,>=), ${dep:libcdev}, ${misc:Depends} @@ -3354,8 +3390,8 @@ ifdef(`TARGET', `dnl Package: libstdc++`'PV-pic`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`',ifdef(`MULTIARCH', `Multi-Arch: same -'))`'dnl +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Section: ifdef(`TARGET',`devel',`libdevel') Priority: extra Depends: BASEDEP, libdep(stdc++CXX_SO,), libdevdep(stdc++`'PV-dev,), ${misc:Depends} @@ -3378,10 +3414,9 @@ Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') Section: debug Priority: extra Depends: BASEDEP, libdep(stdc++CXX_SO,), libdbgdep(gcc`'GCC_SO-dbg,,>=,${libgcc:Version}), ${shlibs:Depends}, ${misc:Depends} -ifdef(`TARGET',`Provides: libstdc++CXX_SO-dbg-TARGET-dcv1',`dnl -ifdef(`MULTIARCH', `Multi-Arch: same',`dnl') -Provides: libstdc++'CXX_SO`'PV`-dbg-armel [armel], libstdc++'CXX_SO`'PV`-dbg-armhf [armhf]dnl -') +ifdef(`TARGET',`Provides: libstdc++CXX_SO-dbg-TARGET-dcv1',`Provides: libstdc++'CXX_SO`'PV`-dbg-armel [armel], libstdc++'CXX_SO`'PV`-dbg-armhf [armhf]') +ifdef(`MULTIARCH', `Multi-Arch: same +')`'dnl Recommends: libdevdep(stdc++`'PV-dev,) Conflicts: libstdc++5-dbg`'LS, libstdc++5-3.3-dbg`'LS, libstdc++6-dbg`'LS, libstdc++6-4.0-dbg`'LS, libstdc++6-4.1-dbg`'LS, libstdc++6-4.2-dbg`'LS, libstdc++6-4.3-dbg`'LS, libstdc++6-4.4-dbg`'LS, libstdc++6-4.5-dbg`'LS, libstdc++6-4.6-dbg`'LS, libstdc++6-4.7-dbg`'LS BUILT_USING`'dnl @@ -3678,9 +3713,9 @@ ifenabled(`libgnat',` Package: libgnat`'-GNAT_V`'LS Section: ifdef(`TARGET',`devel',`libs') Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: PRI(optional) Depends: BASEDEP, ${shlibs:Depends}, ${misc:Depends} BUILT_USING`'dnl @@ -3696,9 +3731,9 @@ Description: runtime for applications compiled with GNAT (shared library) Package: libgnat`'-GNAT_V-dbg`'LS Section: debug Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: extra Depends: BASEDEP, libgnat`'-GNAT_V`'LS (= ${gnat:Version}), ${misc:Depends} BUILT_USING`'dnl @@ -3731,9 +3766,9 @@ Description: GNU Ada compiler selected components (development files) Package: libgnatvsn`'GNAT_V`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: PRI(optional) Section: ifdef(`TARGET',`devel',`libs') Depends: BASEDEP, libgnat`'-GNAT_V`'LS (= ${gnat:Version}), ${misc:Depends} @@ -3750,9 +3785,9 @@ Description: GNU Ada compiler selected components (shared library) Package: libgnatvsn`'GNAT_V-dbg`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: extra Section: debug Depends: BASEDEP, libgnatvsn`'GNAT_V`'LS (= ${gnat:Version}), ${misc:Depends} @@ -3792,9 +3827,9 @@ Description: GNU Ada compiler Project Manager (development files) Package: libgnatprj`'GNAT_V`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: PRI(optional) Section: ifdef(`TARGET',`devel',`libs') Depends: BASEDEP, libgnat`'-GNAT_V`'LS (= ${gnat:Version}), libgnatvsn`'GNAT_V`'LS (= ${gnat:Version}), ${misc:Depends} @@ -3814,9 +3849,9 @@ Description: GNU Ada compiler Project Manager (shared library) Package: libgnatprj`'GNAT_V-dbg`'LS Architecture: ifdef(`TARGET',`CROSS_ARCH',`any') -ifdef(`TARGET',`dnl',ifdef(`MULTIARCH', `Multi-Arch: same +ifdef(`MULTIARCH', `Multi-Arch: same Pre-Depends: multiarch-support -'))`'dnl +')`'dnl Priority: extra Section: debug Depends: BASEDEP, libgnatprj`'GNAT_V`'LS (= ${gnat:Version}), ${misc:Depends} @@ -3980,7 +4015,7 @@ ifenabled(`source',` Package: gcc`'PV-source Architecture: all Priority: PRI(optional) -Depends: make (>= 3.81), autoconf2.64, quilt, patchutils, gawk, ${misc:Depends} +Depends: make, autoconf2.64, quilt, patchutils, gawk, ${misc:Depends} Description: Source of the GNU Compiler Collection This package contains the sources and patches which are needed to build the GNU Compiler Collection (GCC). diff --git a/debian/gcc-BV-hppa64.postinst b/debian/gcc-BV-hppa64.postinst index ed5d095..a70af39 100644 --- a/debian/gcc-BV-hppa64.postinst +++ b/debian/gcc-BV-hppa64.postinst @@ -2,11 +2,13 @@ prio=$(echo @BV@ | sed 's/\.//g') -update-alternatives --quiet \ - --install /usr/bin/hppa64-linux-gnu-gcc \ - hppa64-linux-gnu-gcc \ - /usr/bin/hppa64-linux-gnu-gcc-@BV@ \ +for i in cpp gcc gcc-ar gcc-nm gcc-ranlib; do + update-alternatives --quiet \ + --install /usr/bin/hppa64-linux-gnu-$i \ + hppa64-linux-gnu-$i \ + /usr/bin/hppa64-linux-gnu-$i-@BV@ \ $prio +done #DEBHELPER# diff --git a/debian/gcc-BV-hppa64.prerm b/debian/gcc-BV-hppa64.prerm index 88aa45b..d4ca7a4 100644 --- a/debian/gcc-BV-hppa64.prerm +++ b/debian/gcc-BV-hppa64.prerm @@ -1,8 +1,10 @@ #! /bin/sh -e if [ "$1" != "upgrade" ]; then - update-alternatives --quiet \ - --remove hppa64-linux-gcc /usr/bin/hppa64-linux-gnu-gcc-@BV@ + for i in cpp gcc gcc-ar gcc-nm gcc-ranlib; do + update-alternatives --quiet \ + --remove hppa64-linux-gcc /usr/bin/hppa64-linux-gnu-gcc-@BV@ + done fi #DEBHELPER# diff --git a/debian/libitm1.symbols b/debian/libitm1.symbols index 1b53660..6f22170 100644 --- a/debian/libitm1.symbols +++ b/debian/libitm1.symbols @@ -1,5 +1,5 @@ libitm.so.1 libitm1 #MINVER# #include "libitm1.symbols.common" (arch=amd64 i386 x32)#include "libitm1.symbols.x86" -(arch=!alpha !amd64 !ia64 !ppc64 !ppc64el !s390x !sparc64 !kfreebsd-amd64)#include "libitm1.symbols.32bit" -(arch=alpha amd64 ia64 ppc64 ppc64el s390x sparc64 kfreebsd-amd64)#include "libitm1.symbols.64bit" +(arch=!alpha !amd64 !arm64 !ia64 !ppc64 !ppc64el !s390x !sparc64 !kfreebsd-amd64)#include "libitm1.symbols.32bit" +(arch=alpha amd64 arm64 ia64 ppc64 ppc64el s390x sparc64 kfreebsd-amd64)#include "libitm1.symbols.64bit" diff --git a/debian/libstdc++CXX.prerm b/debian/libstdc++CXX.prerm new file mode 100644 index 0000000..34b9d91 --- /dev/null +++ b/debian/libstdc++CXX.prerm @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +case "$1" in + remove) + files=$(dpkg -L libstdc++@CXX@@TARGET_QUAL@ | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}') + rm -f $files + dirs=$(dpkg -L libstdc++@CXX@@TARGET_QUAL@ | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {NF--; print}' | sort -u) + find $dirs -mindepth 1 -maxdepth 1 -name __pycache__ -type d -empty | xargs -r rmdir +esac + +#DEBHELPER# diff --git a/debian/patches/ada-kfreebsd.diff b/debian/patches/ada-kfreebsd.diff index 7b5b03b..21e8f91 100644 --- a/debian/patches/ada-kfreebsd.diff +++ b/debian/patches/ada-kfreebsd.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/ada/terminals.c =================================================================== --- a/src/gcc/ada/terminals.c +++ b/src/gcc/ada/terminals.c -@@ -987,6 +987,7 @@ +@@ -987,6 +987,7 @@ __gnat_setup_winsize (void *desc, int ro /* On some system termio is either absent or including it will disable termios (HP-UX) */ #if ! defined (__hpux__) && ! defined (FREEBSD) && \ @@ -179,7 +179,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in =================================================================== --- a/src/gcc/ada/gcc-interface/Makefile.in +++ b/src/gcc/ada/gcc-interface/Makefile.in -@@ -1194,7 +1194,7 @@ +@@ -1221,7 +1221,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd% a-intnam.ads<a-intnam-freebsd.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ @@ -188,7 +188,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in s-osinte.ads<s-osinte-kfreebsd-gnu.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-posix.adb \ -@@ -1225,7 +1225,7 @@ +@@ -1252,7 +1252,7 @@ ifeq ($(strip $(filter-out x86_64 kfreeb a-numaux.ads<a-numaux-x86.ads \ s-inmaop.adb<s-inmaop-posix.adb \ s-intman.adb<s-intman-posix.adb \ @@ -201,7 +201,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads =================================================================== --- a/src/gcc/ada/s-osinte-kfreebsd-gnu.ads +++ b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads -@@ -45,6 +45,7 @@ +@@ -45,6 +45,7 @@ package System.OS_Interface is pragma Preelaborate; pragma Linker_Options ("-lpthread"); @@ -209,7 +209,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads subtype int is Interfaces.C.int; subtype char is Interfaces.C.char; -@@ -206,9 +207,7 @@ +@@ -206,9 +207,7 @@ package System.OS_Interface is function nanosleep (rqtp, rmtp : access timespec) return int; pragma Import (C, nanosleep, "nanosleep"); @@ -220,7 +220,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads function clock_gettime (clock_id : clockid_t; -@@ -252,6 +251,16 @@ +@@ -252,6 +251,16 @@ package System.OS_Interface is function getpid return pid_t; pragma Import (C, getpid, "getpid"); @@ -237,7 +237,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads ------------- -- Threads -- ------------- -@@ -282,6 +291,14 @@ +@@ -282,6 +291,14 @@ package System.OS_Interface is PTHREAD_SCOPE_PROCESS : constant := 0; PTHREAD_SCOPE_SYSTEM : constant := 2; @@ -252,7 +252,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads ----------- -- Stack -- ----------- -@@ -419,31 +436,25 @@ +@@ -419,31 +436,25 @@ package System.OS_Interface is PTHREAD_PRIO_PROTECT : constant := 2; PTHREAD_PRIO_INHERIT : constant := 1; @@ -288,7 +288,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads type struct_sched_param is record sched_priority : int; -- scheduling priority -@@ -570,8 +581,8 @@ +@@ -570,8 +581,8 @@ private -- #define sa_handler __sigaction_u._handler -- #define sa_sigaction __sigaction_u._sigaction @@ -299,7 +299,7 @@ Index: b/src/gcc/ada/s-osinte-kfreebsd-gnu.ads -- sigcontext type is opaque, so it is architecturally neutral. -- It is always passed as an access type, so define it as an empty record -- since the contents are not used anywhere. -@@ -588,9 +599,6 @@ +@@ -588,9 +599,6 @@ private end record; pragma Convention (C, timespec); @@ -326,7 +326,7 @@ Index: b/src/gcc/ada/s-oscons-tmplt.c =================================================================== --- a/src/gcc/ada/s-oscons-tmplt.c +++ b/src/gcc/ada/s-oscons-tmplt.c -@@ -1414,7 +1414,7 @@ +@@ -1414,7 +1414,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU /* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */ # define CLOCK_RT_Ada "-1" diff --git a/debian/patches/arm-multilib-defaults.diff b/debian/patches/arm-multilib-defaults.diff index d0f2933..1900a52 100644 --- a/debian/patches/arm-multilib-defaults.diff +++ b/debian/patches/arm-multilib-defaults.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/config.gcc =================================================================== --- a/src/gcc/config.gcc +++ b/src/gcc/config.gcc -@@ -3249,10 +3249,18 @@ +@@ -3267,10 +3267,18 @@ case "${target}" in esac case "$with_float" in @@ -25,7 +25,7 @@ Index: b/src/gcc/config.gcc *) echo "Unknown floating point type used in --with-float=$with_float" 1>&2 exit 1 -@@ -3289,6 +3297,9 @@ +@@ -3307,6 +3315,9 @@ case "${target}" in "" \ | arm | thumb ) #OK diff --git a/debian/patches/arm-sanitizer.diff b/debian/patches/arm-sanitizer.diff index 8dd918c..7bd8593 100644 --- a/debian/patches/arm-sanitizer.diff +++ b/debian/patches/arm-sanitizer.diff @@ -46,7 +46,7 @@ Index: b/src/libsanitizer/configure.tgt =================================================================== --- a/src/libsanitizer/configure.tgt +++ b/src/libsanitizer/configure.tgt -@@ -29,6 +29,8 @@ +@@ -32,6 +32,8 @@ case "${target}" in ;; sparc*-*-linux*) ;; @@ -59,7 +59,7 @@ Index: b/src/gcc/testsuite/lib/target-supports.exp =================================================================== --- a/src/gcc/testsuite/lib/target-supports.exp +++ b/src/gcc/testsuite/lib/target-supports.exp -@@ -4591,6 +4591,33 @@ +@@ -4711,6 +4711,33 @@ proc check_effective_target_simulator { return 0 } @@ -97,7 +97,7 @@ Index: b/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C =================================================================== --- a/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C +++ b/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C -@@ -37,9 +37,9 @@ +@@ -37,9 +37,9 @@ int main() { // { dg-output "ERROR: AddressSanitizer:? heap-buffer-overflow on address\[^\n\r]*" } // { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } @@ -114,7 +114,7 @@ Index: b/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C =================================================================== --- a/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C +++ b/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C -@@ -45,9 +45,9 @@ +@@ -45,9 +45,9 @@ int main(int argc, char *argv[]) { } // { dg-output "ERROR: AddressSanitizer: heap-use-after-free.*(\n|\r\n|\r)" } @@ -131,7 +131,7 @@ Index: b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c +++ b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c -@@ -15,7 +15,7 @@ +@@ -15,7 +15,7 @@ int main(int argc, char **argv) { /* { dg-output "WRITE of size \[0-9\]* at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)strncpy|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ @@ -157,7 +157,7 @@ Index: b/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c +++ b/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c -@@ -19,4 +19,4 @@ +@@ -19,4 +19,4 @@ int main() { /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*stack-overflow-1.c:16|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ @@ -167,7 +167,7 @@ Index: b/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c +++ b/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c -@@ -11,12 +11,12 @@ +@@ -11,12 +11,12 @@ int main() { /* { dg-output "ERROR: AddressSanitizer:? heap-use-after-free on address\[^\n\r]*" } */ /* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */ @@ -200,7 +200,7 @@ Index: b/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c +++ b/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c -@@ -25,7 +25,7 @@ +@@ -25,7 +25,7 @@ int main(int argc, char **argv) { /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ @@ -214,7 +214,7 @@ Index: b/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c +++ b/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c -@@ -18,6 +18,6 @@ +@@ -18,6 +18,6 @@ int main() /* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */ /* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */ @@ -226,7 +226,7 @@ Index: b/src/gcc/config/arm/arm.c =================================================================== --- a/src/gcc/config/arm/arm.c +++ b/src/gcc/config/arm/arm.c -@@ -280,6 +280,7 @@ +@@ -279,6 +279,7 @@ static unsigned arm_add_stmt_cost (void static void arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1, bool op0_preserve_value); @@ -234,7 +234,7 @@ Index: b/src/gcc/config/arm/arm.c /* Table of machine attributes. */ static const struct attribute_spec arm_attribute_table[] = -@@ -649,6 +650,9 @@ +@@ -648,6 +649,9 @@ static const struct attribute_spec arm_a #define TARGET_CANONICALIZE_COMPARISON \ arm_canonicalize_comparison @@ -244,7 +244,7 @@ Index: b/src/gcc/config/arm/arm.c struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ -@@ -27450,4 +27454,12 @@ +@@ -27462,4 +27466,12 @@ arm_validize_comparison (rtx *comparison } diff --git a/debian/patches/cross-ma-install-location.diff b/debian/patches/cross-ma-install-location.diff index eb32082..6cc923d 100644 --- a/debian/patches/cross-ma-install-location.diff +++ b/debian/patches/cross-ma-install-location.diff @@ -185,26 +185,6 @@ multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /. ---- a/src/libmudflap/configure.ac -+++ b/src/libmudflap/configure.ac -@@ -157,15 +157,8 @@ - toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' - ;; - no) -- if test -n "$with_cross_host" && -- test x"$with_cross_host" != x"no"; then -- # Install a library built with a cross compiler in tooldir, not libdir. -- toolexecdir='$(exec_prefix)/$(target_alias)' -- toolexeclibdir='$(toolexecdir)/lib' -- else -- toolexecdir='$(libdir)/gcc-lib/$(target_alias)' -- toolexeclibdir='$(libdir)' -- fi -+ toolexecdir='$(libdir)/gcc-lib/$(target_alias)' -+ toolexeclibdir='$(libdir)' - multi_os_directory=`$CC -print-multi-os-directory` - case $multi_os_directory in - .) ;; # Avoid trailing /. --- a/src/libobjc/configure.ac +++ b/src/libobjc/configure.ac @@ -109,15 +109,8 @@ diff --git a/debian/patches/g++-multiarch-incdir.diff b/debian/patches/g++-multiarch-incdir.diff index 3040ed9..be086b4 100644 --- a/debian/patches/g++-multiarch-incdir.diff +++ b/debian/patches/g++-multiarch-incdir.diff @@ -5,7 +5,7 @@ Index: b/src/libstdc++-v3/include/Makefile.am =================================================================== --- a/src/libstdc++-v3/include/Makefile.am +++ b/src/libstdc++-v3/include/Makefile.am -@@ -828,7 +828,7 @@ +@@ -828,7 +828,7 @@ endif host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR) default_host_alias = @default_host_alias@ host_builddir = ./${default_host_alias}/bits @@ -18,9 +18,9 @@ Index: b/src/libstdc++-v3/include/Makefile.in =================================================================== --- a/src/libstdc++-v3/include/Makefile.in +++ b/src/libstdc++-v3/include/Makefile.in -@@ -1105,7 +1105,7 @@ +@@ -1083,7 +1083,7 @@ profile_impl_headers = \ + @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers} host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR) - default_host_alias = @default_host_alias@ host_builddir = ./${default_host_alias}/bits -host_installdir = ${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits +host_installdir = $(if $(shell $(CC) -print-multiarch),/usr/include/$(shell $(filter-out -m%,$(CC)) -print-multiarch)/c++/$(notdir ${gxx_include_dir})$(MULTISUBDIR)/bits,${gxx_include_dir}/${default_host_alias}$(MULTISUBDIR)/bits) @@ -31,7 +31,7 @@ Index: b/src/gcc/Makefile.in =================================================================== --- a/src/gcc/Makefile.in +++ b/src/gcc/Makefile.in -@@ -1106,6 +1106,7 @@ +@@ -1107,6 +1107,7 @@ FLAGS_TO_PASS = \ "prefix=$(prefix)" \ "local_prefix=$(local_prefix)" \ "gxx_include_dir=$(gcc_gxx_include_dir)" \ @@ -39,7 +39,7 @@ Index: b/src/gcc/Makefile.in "build_tooldir=$(build_tooldir)" \ "gcc_tooldir=$(gcc_tooldir)" \ "bindir=$(bindir)" \ -@@ -1542,6 +1543,14 @@ +@@ -1543,6 +1544,14 @@ ifneq ($(xmake_file),) include $(xmake_file) endif @@ -54,7 +54,7 @@ Index: b/src/gcc/Makefile.in # all-tree.def includes all the tree.def files. all-tree.def: s-alltree; @true s-alltree: Makefile -@@ -3986,7 +3995,7 @@ +@@ -3987,7 +3996,7 @@ PREPROCESSOR_DEFINES = \ -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \ -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \ @@ -67,7 +67,7 @@ Index: b/src/gcc/cppdefault.c =================================================================== --- a/src/gcc/cppdefault.c +++ b/src/gcc/cppdefault.c -@@ -49,6 +49,8 @@ +@@ -49,6 +49,8 @@ const struct default_include cpp_include /* Pick up GNU C++ target-dependent include files. */ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, @@ -80,7 +80,7 @@ Index: b/src/gcc/incpath.c =================================================================== --- a/src/gcc/incpath.c +++ b/src/gcc/incpath.c -@@ -160,6 +160,18 @@ +@@ -160,6 +160,18 @@ add_standard_paths (const char *sysroot, } str = reconcat (str, str, dir_separator_str, imultiarch, NULL); @@ -99,7 +99,7 @@ Index: b/src/gcc/incpath.c } add_path (str, SYSTEM, p->cxx_aware, false); } -@@ -224,7 +236,16 @@ +@@ -224,7 +236,16 @@ add_standard_paths (const char *sysroot, free (str); continue; } diff --git a/debian/patches/gcc-as-needed.diff b/debian/patches/gcc-as-needed.diff index 5a50a09..799ee27 100644 --- a/debian/patches/gcc-as-needed.diff +++ b/debian/patches/gcc-as-needed.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/config/aarch64/aarch64-linux.h =================================================================== --- a/src/gcc/config/aarch64/aarch64-linux.h +++ b/src/gcc/config/aarch64/aarch64-linux.h -@@ -25,6 +25,7 @@ +@@ -27,6 +27,7 @@ #define LINUX_TARGET_LINK_SPEC "%{h*} \ --hash-style=gnu \ @@ -55,7 +55,7 @@ Index: b/src/gcc/config/rs6000/linux64.h =================================================================== --- a/src/gcc/config/rs6000/linux64.h +++ b/src/gcc/config/rs6000/linux64.h -@@ -385,11 +385,11 @@ +@@ -416,11 +416,11 @@ " -m elf64ppc") #endif @@ -73,7 +73,7 @@ Index: b/src/gcc/config/rs6000/sysv4.h =================================================================== --- a/src/gcc/config/rs6000/sysv4.h +++ b/src/gcc/config/rs6000/sysv4.h -@@ -799,7 +799,7 @@ +@@ -773,7 +773,7 @@ #define GNU_USER_DYNAMIC_LINKER \ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) @@ -132,6 +132,8 @@ Index: b/src/gcc/config/arm/linux-elf.h %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ SUBTARGET_EXTRA_LINK_SPEC +Index: b/src/gcc/config/mips/gnu-user.h +=================================================================== --- a/src/gcc/config/mips/gnu-user.h +++ b/src/gcc/config/mips/gnu-user.h @@ -56,6 +56,7 @@ @@ -142,6 +144,8 @@ Index: b/src/gcc/config/arm/linux-elf.h %{shared:-shared} \ %{!shared: \ %{!static: \ +Index: b/src/gcc/config/mips/gnu-user64.h +=================================================================== --- a/src/gcc/config/mips/gnu-user64.h +++ b/src/gcc/config/mips/gnu-user64.h @@ -34,6 +34,7 @@ @@ -152,6 +156,8 @@ Index: b/src/gcc/config/arm/linux-elf.h %(endian_spec) \ %{!shared: \ %{!static: \ +Index: b/src/libjava/Makefile.am +=================================================================== --- a/src/libjava/Makefile.am +++ b/src/libjava/Makefile.am @@ -625,7 +625,7 @@ @@ -163,6 +169,8 @@ Index: b/src/gcc/config/arm/linux-elf.h rm .libs/libgcj_bc.so.1; \ $(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1 +Index: b/src/libjava/Makefile.in +=================================================================== --- a/src/libjava/Makefile.in +++ b/src/libjava/Makefile.in @@ -10573,7 +10573,7 @@ @@ -174,6 +182,8 @@ Index: b/src/gcc/config/arm/linux-elf.h rm .libs/libgcj_bc.so.1; \ $(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1 +Index: b/src/libstdc++-v3/testsuite/30_threads/try_lock/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/try_lock/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/try_lock/2.cc @@ -1,5 +1,5 @@ @@ -183,6 +193,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +++ b/src/libstdc++-v3/testsuite/30_threads/try_lock/4.cc @@ -1,5 +1,5 @@ @@ -192,15 +204,19 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc @@ -1,5 +1,5 @@ - // { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } --// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } -+// { dg-options " -std=gnu++0x -pthread -Wl,--no-as-needed" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } + // { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin1[1-9]* powerpc-ibm-aix* } } +-// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } ++// { dg-options " -std=gnu++0x -pthread -Wl,--no-as-needed" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc @@ -1,5 +1,5 @@ @@ -210,6 +226,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc @@ -1,5 +1,5 @@ @@ -219,6 +237,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc @@ -1,5 +1,5 @@ @@ -228,6 +248,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc @@ -1,5 +1,5 @@ @@ -237,6 +259,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc @@ -1,5 +1,5 @@ @@ -246,6 +270,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc @@ -1,5 +1,5 @@ @@ -255,6 +281,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc @@ -1,5 +1,5 @@ @@ -264,6 +292,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc +++ b/src/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc @@ -1,5 +1,5 @@ @@ -273,6 +303,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc @@ -1,5 +1,5 @@ @@ -282,6 +314,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc @@ -1,5 +1,5 @@ @@ -291,6 +325,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc @@ -1,5 +1,5 @@ @@ -300,6 +336,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc @@ -1,5 +1,5 @@ @@ -309,6 +347,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/async/any.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/async/any.cc +++ b/src/libstdc++-v3/testsuite/30_threads/async/any.cc @@ -1,5 +1,5 @@ @@ -318,6 +358,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/async/42819.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/async/42819.cc +++ b/src/libstdc++-v3/testsuite/30_threads/async/42819.cc @@ -1,5 +1,5 @@ @@ -327,6 +369,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/async/sync.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/async/sync.cc +++ b/src/libstdc++-v3/testsuite/30_threads/async/sync.cc @@ -1,5 +1,5 @@ @@ -336,6 +380,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/async/async.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/async/async.cc +++ b/src/libstdc++-v3/testsuite/30_threads/async/async.cc @@ -1,5 +1,5 @@ @@ -345,6 +391,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/async/49668.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/async/49668.cc +++ b/src/libstdc++-v3/testsuite/30_threads/async/49668.cc @@ -1,5 +1,5 @@ @@ -354,6 +402,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc @@ -1,5 +1,5 @@ @@ -363,6 +413,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc @@ -1,5 +1,5 @@ @@ -372,6 +424,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc @@ -1,5 +1,5 @@ @@ -381,6 +435,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc @@ -1,5 +1,5 @@ @@ -390,6 +446,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc @@ -1,5 +1,5 @@ @@ -399,6 +457,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc @@ -1,5 +1,5 @@ @@ -408,6 +468,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc @@ -1,5 +1,5 @@ @@ -417,6 +479,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc @@ -1,5 +1,5 @@ @@ -426,6 +490,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc @@ -1,5 +1,5 @@ @@ -435,6 +501,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc +++ b/src/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc @@ -1,5 +1,5 @@ @@ -444,6 +512,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/call_once/39909.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/call_once/39909.cc +++ b/src/libstdc++-v3/testsuite/30_threads/call_once/39909.cc @@ -1,5 +1,5 @@ @@ -453,6 +523,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/call_once/49668.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/call_once/49668.cc +++ b/src/libstdc++-v3/testsuite/30_threads/call_once/49668.cc @@ -1,5 +1,5 @@ @@ -462,6 +534,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc @@ -1,5 +1,5 @@ @@ -471,6 +545,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc @@ -1,5 +1,5 @@ @@ -480,6 +556,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc @@ -1,5 +1,5 @@ @@ -489,6 +567,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc @@ -1,5 +1,5 @@ @@ -498,6 +578,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc @@ -1,5 +1,5 @@ @@ -507,6 +589,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc @@ -1,5 +1,5 @@ @@ -516,6 +600,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc @@ -1,5 +1,5 @@ @@ -525,6 +611,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc @@ -1,5 +1,5 @@ @@ -534,6 +622,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc @@ -1,5 +1,5 @@ @@ -543,6 +633,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc @@ -1,5 +1,5 @@ @@ -552,6 +644,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc @@ -1,5 +1,5 @@ @@ -561,6 +655,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc @@ -1,5 +1,5 @@ @@ -570,6 +666,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc @@ -1,5 +1,5 @@ @@ -579,6 +677,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc @@ -1,5 +1,5 @@ @@ -588,6 +688,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/lock/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/lock/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/lock/2.cc @@ -1,5 +1,5 @@ @@ -597,6 +699,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/lock/4.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/lock/4.cc +++ b/src/libstdc++-v3/testsuite/30_threads/lock/4.cc @@ -1,5 +1,5 @@ @@ -606,6 +710,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/this_thread/1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/this_thread/1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/this_thread/1.cc @@ -1,5 +1,5 @@ @@ -615,6 +721,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/members/1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/members/1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/members/1.cc @@ -1,5 +1,5 @@ @@ -624,6 +732,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/members/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/members/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/members/2.cc @@ -1,5 +1,5 @@ @@ -633,6 +743,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/members/3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/members/3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/members/3.cc @@ -1,5 +1,5 @@ @@ -642,6 +754,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc @@ -1,5 +1,5 @@ @@ -651,6 +765,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc @@ -1,5 +1,5 @@ @@ -660,6 +776,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc @@ -1,5 +1,5 @@ @@ -669,6 +787,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc @@ -1,5 +1,5 @@ @@ -678,6 +798,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc @@ -1,5 +1,5 @@ @@ -687,6 +809,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc @@ -1,5 +1,5 @@ @@ -696,6 +820,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc @@ -1,5 +1,5 @@ @@ -705,6 +831,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc @@ -1,5 +1,5 @@ @@ -714,6 +842,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc @@ -1,5 +1,5 @@ @@ -723,6 +853,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc @@ -1,5 +1,5 @@ @@ -732,6 +864,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc +++ b/src/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc @@ -1,5 +1,5 @@ @@ -741,6 +875,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/valid.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/valid.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/valid.cc @@ -1,5 +1,5 @@ @@ -750,6 +886,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/get2.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/get2.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/get2.cc @@ -1,5 +1,5 @@ @@ -759,6 +897,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/share.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/share.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/share.cc @@ -1,5 +1,5 @@ @@ -768,6 +908,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/wait.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/wait.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/wait.cc @@ -1,5 +1,5 @@ @@ -777,6 +919,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc @@ -1,5 +1,5 @@ @@ -786,6 +930,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/get.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/get.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/get.cc @@ -1,5 +1,5 @@ @@ -795,6 +941,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/45133.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/45133.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/45133.cc @@ -1,5 +1,5 @@ @@ -804,6 +952,8 @@ Index: b/src/gcc/config/arm/linux-elf.h // { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } // { dg-require-cstdint "" } +Index: b/src/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc +=================================================================== --- a/src/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc +++ b/src/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc @@ -1,5 +1,5 @@ diff --git a/debian/patches/gcc-base-version.diff b/debian/patches/gcc-base-version.diff index 97836b8..347b8c9 100644 --- a/debian/patches/gcc-base-version.diff +++ b/debian/patches/gcc-base-version.diff @@ -5,19 +5,19 @@ Index: b/src/gcc/BASE-VER --- a/src/gcc/BASE-VER +++ b/src/gcc/BASE-VER @@ -1 +1 @@ --4.8.2 +-4.8.3 +4.8 Index: b/src/gcc/FULL-VER =================================================================== --- /dev/null +++ b/src/gcc/FULL-VER @@ -0,0 +1 @@ -+4.8.2 ++4.8.3 Index: b/src/gcc/Makefile.in =================================================================== --- a/src/gcc/Makefile.in +++ b/src/gcc/Makefile.in -@@ -795,11 +795,13 @@ +@@ -796,11 +796,13 @@ GTM_H = tm.h $(tm_file_list) in TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) # Variables for version information. @@ -32,7 +32,7 @@ Index: b/src/gcc/Makefile.in BASEVER_c := $(shell cat $(BASEVER)) DEVPHASE_c := $(shell cat $(DEVPHASE)) DATESTAMP_c := $(shell cat $(DATESTAMP)) -@@ -818,7 +820,7 @@ +@@ -819,7 +821,7 @@ version := $(BASEVER_c) # development phase collapsed to the empty string in release mode # (i.e. if DEVPHASE_c is empty). The space immediately after the # comma in the $(if ...) constructs is significant - do not remove it. @@ -41,7 +41,7 @@ Index: b/src/gcc/Makefile.in DEVPHASE_s := "\"$(if $(DEVPHASE_c), ($(DEVPHASE_c)))\"" DATESTAMP_s := "\"$(if $(DEVPHASE_c), $(DATESTAMP_c))\"" PKGVERSION_s:= "\"@PKGVERSION@\"" -@@ -2020,9 +2022,9 @@ +@@ -2021,9 +2023,9 @@ incpath.o: incpath.c incpath.h $(CONFIG_ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \ $(MACHMODE_H) @@ -53,7 +53,7 @@ Index: b/src/gcc/Makefile.in # Language-independent files. -@@ -2090,11 +2092,11 @@ +@@ -2091,11 +2093,11 @@ options-save.o: options-save.c $(CONFIG_ dumpvers: dumpvers.c @@ -67,7 +67,7 @@ Index: b/src/gcc/Makefile.in gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(HASHTAB_H) $(SPLAY_TREE_H) $(OBSTACK_H) $(BITMAP_H) \ -@@ -2679,10 +2681,10 @@ +@@ -2680,10 +2682,10 @@ common/common-targhooks.o : common/commo coretypes.h $(INPUT_H) $(TM_H) $(COMMON_TARGET_H) common/common-targhooks.h bversion.h: s-bversion; @true @@ -82,7 +82,7 @@ Index: b/src/gcc/Makefile.in echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> bversion.h $(STAMP) s-bversion -@@ -3798,9 +3800,9 @@ +@@ -3799,9 +3801,9 @@ build/%.o : # dependencies provided by ## build/version.o is compiled by the $(COMPILER_FOR_BUILD) but needs ## several C macro definitions, just like version.o build/version.o: version.c version.h \ @@ -94,7 +94,7 @@ Index: b/src/gcc/Makefile.in -DREVISION=$(REVISION_s) \ -DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \ -DBUGURL=$(BUGURL_s) -o $@ $< -@@ -3994,7 +3996,7 @@ +@@ -3995,7 +3997,7 @@ PREPROCESSOR_DEFINES = \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ @TARGET_SYSTEM_ROOT_DEFINE@ @@ -103,7 +103,7 @@ Index: b/src/gcc/Makefile.in cppbuiltin.o: cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TARGET_H) $(TARGET_DEF) $(TREE_H) $(CPP_ID_DATA_H) \ cppbuiltin.h version.h Makefile -@@ -4015,8 +4017,8 @@ +@@ -4016,8 +4018,8 @@ build/gcov-iov$(build_exeext): build/gco build/gcov-iov.o -o $@ gcov-iov.h: s-iov @@ -114,7 +114,7 @@ Index: b/src/gcc/Makefile.in > tmp-gcov-iov.h $(SHELL) $(srcdir)/../move-if-change tmp-gcov-iov.h gcov-iov.h $(STAMP) s-iov -@@ -4281,8 +4283,8 @@ +@@ -4282,8 +4284,8 @@ TEXI_GCCINSTALL_FILES = install.texi ins TEXI_CPPINT_FILES = cppinternals.texi gcc-common.texi gcc-vers.texi # gcc-vers.texi is generated from the version files. @@ -125,7 +125,7 @@ Index: b/src/gcc/Makefile.in if [ "$(DEVPHASE_c)" = "experimental" ]; \ then echo "@set DEVELOPMENT"; \ else echo "@clear DEVELOPMENT"; \ -@@ -4660,9 +4662,11 @@ +@@ -4661,9 +4663,11 @@ install-common: native lang.install-comm install-driver: installdirs xgcc$(exeext) -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext) @@ -141,7 +141,7 @@ Index: b/src/libjava/Makefile.am =================================================================== --- a/src/libjava/Makefile.am +++ b/src/libjava/Makefile.am -@@ -772,7 +772,7 @@ +@@ -772,7 +772,7 @@ install_data_local_split = 50 install-data-local: $(PRE_INSTALL) ## Install the .pc file. @@ -154,7 +154,7 @@ Index: b/src/libjava/Makefile.in =================================================================== --- a/src/libjava/Makefile.in +++ b/src/libjava/Makefile.in -@@ -12426,7 +12426,7 @@ +@@ -12426,7 +12426,7 @@ install-exec-hook: install-binPROGRAMS i @BUILD_ECJ1_TRUE@ mv $(DESTDIR)$(libexecsubdir)/`echo ecjx | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(libexecsubdir)/ecj1$(host_exeext) install-data-local: $(PRE_INSTALL) @@ -167,7 +167,7 @@ Index: b/src/libjava/testsuite/lib/libjava.exp =================================================================== --- a/src/libjava/testsuite/lib/libjava.exp +++ b/src/libjava/testsuite/lib/libjava.exp -@@ -177,7 +177,7 @@ +@@ -177,7 +177,7 @@ proc libjava_init { args } { set text [eval exec "$GCJ_UNDER_TEST -B$specdir -v 2>@ stdout"] regexp " version \[^\n\r\]*" $text version diff --git a/debian/patches/gcc-default-format-security.diff b/debian/patches/gcc-default-format-security.diff index 22d1c55..0d11b56 100644 --- a/debian/patches/gcc-default-format-security.diff +++ b/debian/patches/gcc-default-format-security.diff @@ -23,7 +23,7 @@ Index: b/src/gcc/doc/invoke.texi #endif +/* no separate spec, just shove it into the ssp default spec */ -+#define FORMAT_SECURITY_SPEC "%{!Wno-format-security:%{!Wformat|!Wformat=2|!Wall:-Wformat} -Wformat-security}" ++#define FORMAT_SECURITY_SPEC "%{!Wformat:%{!Wformat=2:%{!Wformat=0:%{!Wall:-Wformat} %{!Wno-format-security:-Wformat-security}}}}" + #ifndef SSP_DEFAULT_SPEC #ifdef TARGET_LIBC_PROVIDES_SSP @@ -34,4 +34,4 @@ Index: b/src/gcc/doc/invoke.texi +#define SSP_DEFAULT_SPEC FORMAT_SECURITY_SPEC #endif #endif - + diff --git a/debian/patches/gcc-elfv2-abi-warn1.diff b/debian/patches/gcc-elfv2-abi-warn1.diff new file mode 100644 index 0000000..437ba17 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn1.diff @@ -0,0 +1,99 @@ +# DP: ppc64el, fix ELFv2 homogeneous float aggregate ABI bug + +Subject: [PATCH, rs6000, 4.8/4.9] Fix ELFv2 homogeneous float aggregate ABI bug + +Hello, + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00994.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument + does not fit fully into floating-point registers, and there is still + space in the register parameter area, issue -Wpsabi note that the ABI + will change in a future GCC release. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-1.c: New test. + + +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -10225,6 +10225,7 @@ rs6000_function_arg (cumulative_args_t c + rtx r, off; + int i, k = 0; + unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; ++ int fpr_words; + + /* Do we also need to pass this argument in the parameter + save area? */ +@@ -10253,6 +10254,37 @@ rs6000_function_arg (cumulative_args_t c + rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); + } + ++ /* If there were not enough FPRs to hold the argument, the rest ++ usually goes into memory. However, if the current position ++ is still within the register parameter area, a portion may ++ actually have to go into GPRs. ++ ++ Note that it may happen that the portion of the argument ++ passed in the first "half" of the first GPR was already ++ passed in the last FPR as well. ++ ++ For unnamed arguments, we already set up GPRs to cover the ++ whole argument in rs6000_psave_function_arg, so there is ++ nothing further to do at this point. ++ ++ GCC 4.8/4.9 Note: This was implemented incorrectly in earlier ++ GCC releases. To avoid any ABI change on the release branch, ++ we retain that original implementation here, but warn if we ++ encounter a case where the ABI will change in the future. */ ++ fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8); ++ if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG ++ && cum->nargs_prototype > 0) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing homogeneous float aggregates" ++ " will change in a future GCC release"); ++ } ++ } ++ + return rs6000_finish_function_arg (mode, rvec, k); + } + else if (align_words < GP_ARG_NUM_REG) +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +@@ -0,0 +1,12 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-options "-mabi=elfv2" } */ ++ ++struct f8 ++ { ++ float x[8]; ++ }; ++ ++void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */ ++{ ++} ++ diff --git a/debian/patches/gcc-elfv2-abi-warn2.diff b/debian/patches/gcc-elfv2-abi-warn2.diff new file mode 100644 index 0000000..5309998 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn2.diff @@ -0,0 +1,106 @@ +# DP: ppc64el, fix aggregate alignment ABI issue + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00995.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue + -Wpsabi note when encountering a type where future GCC releases + will apply different alignment requirements. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-2.c: New test. + + +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -9180,14 +9180,51 @@ rs6000_function_arg_boundary (enum machi + || (type && TREE_CODE (type) == VECTOR_TYPE + && int_size_in_bytes (type) >= 16)) + return 128; +- else if (((TARGET_MACHO && rs6000_darwin64_abi) +- || DEFAULT_ABI == ABI_ELFv2 +- || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) +- && mode == BLKmode +- && type && TYPE_ALIGN (type) > 64) ++ ++ /* Aggregate types that need > 8 byte alignment are quadword-aligned ++ in the parameter area in the ELFv2 ABI, and in the AIX ABI unless ++ -mcompat-align-parm is used. */ ++ if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm) ++ || DEFAULT_ABI == ABI_ELFv2) ++ && type && TYPE_ALIGN (type) > 64) ++ { ++ /* "Aggregate" means any AGGREGATE_TYPE except for single-element ++ or homogeneous float/vector aggregates here. We already handled ++ vector aggregates above, but still need to check for float here. */ ++ bool aggregate_p = (AGGREGATE_TYPE_P (type) ++ && !SCALAR_FLOAT_MODE_P (elt_mode)); ++ ++ /* We used to check for BLKmode instead of the above aggregate type ++ check. Warn when this results in any difference to the ABI. */ ++ if (aggregate_p != (mode == BLKmode)) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing aggregates with %d-byte alignment" ++ " will change in a future GCC release", ++ (int) TYPE_ALIGN (type) / BITS_PER_UNIT); ++ } ++ } ++ ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep using the BLKmode check, but warn if there will be differences ++ in future GCC releases. */ ++ if (mode == BLKmode) ++ return 128; ++ } ++ ++ /* Similar for the Darwin64 ABI. Note that for historical reasons we ++ implement the "aggregate type" check as a BLKmode check here; this ++ means certain aggregate types are in fact not aligned. */ ++ if (TARGET_MACHO && rs6000_darwin64_abi ++ && mode == BLKmode ++ && type && TYPE_ALIGN (type) > 64) + return 128; +- else +- return PARM_BOUNDARY; ++ ++ return PARM_BOUNDARY; + } + + /* The offset in words to the start of the parameter save area. */ +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +@@ -0,0 +1,11 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++ ++struct test ++ { ++ long a __attribute__((aligned (16))); ++ }; ++ ++void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */ ++{ ++} ++ diff --git a/debian/patches/gcc-elfv2-abi-warn3.diff b/debian/patches/gcc-elfv2-abi-warn3.diff new file mode 100644 index 0000000..637d8d7 --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn3.diff @@ -0,0 +1,158 @@ +# DP: ppc64*, fix alignment of non-Altivec vector struct fields + +this is the variant intended for the 4.8/4.9 branches of the patch: +https://gcc.gnu.org/ml/gcc-patches/2014-07/msg01072.html + +As discussed, it does *not* actually change ABI, but only warn when +encountering a situation where the ABI will change in a future GCC. +(Avoiding the specific term "GCC 4.10" here since I'm not certain +whether the next GCC release will in fact be called that ...) + +Tested on powerpc64-linux and powerpc64le-linux; also verified using +the ABI compat suite (against an unpatched GCC) that this patch does +not change the ABI. + +OK for 4.8/4.9 once the mainline patch is in? + +Bye, +Ulrich + + +gcc/ChangeLog: + + * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): + Add prototype. + * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New + function. Issue -Wpsabi warning if future GCC releases will use + different field alignment rules for this type. + * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. + * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. + +gcc/testsuite/ChangeLog: + + * gcc.target/powerpc/ppc64-abi-warn-3.c: New test. + + * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050316-3.x: New file. Add -Wno-psabi. + * gcc.c-torture/execute/pr23135.x: Likewise. + +--- a/src/gcc/config/rs6000/rs6000-protos.h ++++ b/src/gcc/config/rs6000/rs6000-protos.h +@@ -155,6 +155,7 @@ extern void rs6000_split_logical (rtx [] + + #ifdef TREE_CODE + extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); ++extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); + extern unsigned int rs6000_special_round_type_align (tree, unsigned int, + unsigned int); + extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, +--- a/src/gcc/config/rs6000/rs6000.c ++++ b/src/gcc/config/rs6000/rs6000.c +@@ -5871,6 +5871,34 @@ rs6000_data_alignment (tree type, unsign + return align; + } + ++/* Previous GCC releases forced all vector types to have 16-byte alignment. */ ++ ++bool ++rs6000_special_adjust_field_align_p (tree field, unsigned int computed) ++{ ++ if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE) ++ { ++ if (computed != 128) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the layout of aggregates containing vectors with" ++ " %d-byte alignment will change in a future GCC release", ++ computed / BITS_PER_UNIT); ++ } ++ } ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep the special treatment of vector types, but warn if there will ++ be differences in future GCC releases. */ ++ return true; ++ } ++ ++ return false; ++} ++ + /* AIX increases natural record alignment to doubleword if the first + field is an FP double while the FP fields remain word aligned. */ + +--- a/src/gcc/config/rs6000/sysv4.h ++++ b/src/gcc/config/rs6000/sysv4.h +@@ -292,7 +292,7 @@ do { \ + /* An expression for the alignment of a structure field FIELD if the + alignment computed in the usual way is COMPUTED. */ + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 : COMPUTED) + + #undef BIGGEST_FIELD_ALIGNMENT +--- a/src/gcc/config/rs6000/linux64.h ++++ b/src/gcc/config/rs6000/linux64.h +@@ -246,7 +246,7 @@ extern int dot_symbols; + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +--- a/src/gcc/config/rs6000/freebsd64.h ++++ b/src/gcc/config/rs6000/freebsd64.h +@@ -367,7 +367,7 @@ extern int dot_symbols; + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +--- a/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x +@@ -4,4 +4,5 @@ if { [check_effective_target_int16] } { + return 1 + } + ++set additional_flags "-Wno-psabi" + return 0; +--- /dev/null ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-3.x +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +--- a/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x ++++ b/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x +@@ -6,4 +6,5 @@ if { [istarget "i?86-*-*"] || [istarget + set additional_flags "-mno-mmx" + } + ++set additional_flags "-Wno-psabi" + return 0 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr23135.x +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +@@ -0,0 +1,9 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-require-effective-target powerpc_altivec_ok } */ ++/* { dg-options "-maltivec" } */ ++ ++struct test ++ { ++ int a __attribute__((vector_size (8))); ++ }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */ ++ diff --git a/debian/patches/gcc-elfv2-abi-warn4.diff b/debian/patches/gcc-elfv2-abi-warn4.diff new file mode 100644 index 0000000..5b11ece --- /dev/null +++ b/debian/patches/gcc-elfv2-abi-warn4.diff @@ -0,0 +1,56 @@ +# DP: Reliably prune GCC notes in C++ compat suite + +in testing the rs6000 ABI patches I noted a weird effect: usually, the +-Wpsabi warning notes are ignored in the compat test suites, so we get +a clean test run anyway. + +However, when running the C++ version of the struct-layout-1.exp case +*alone* (using RUNTESTFLAGS=struct-layout-1.exp), suddenly tests are +failing because of those extra notes. This does *not* happen with +the C version of that suite ... + +It turns out that that pruning those notes is supposed to happen +from within gcc-defs.exp:${tool}_check_compile: + if { [info proc ${tool}-dg-prune] != "" } { + global target_triplet + set gcc_output [${tool}-dg-prune $target_triplet $gcc_output] + } + +However, the g++-dg-prune routine is defined in g++-dg.exp, which +is never included from g++.dg/compat/struct-layout-1.exp (directly +or indirectly). Now, when running the full suite, that file would +have been loaded by some earlier g++.dg .exp file, so everything +works out. But when running struct-layout-1.exp stand-alone, the +g++-dg-prune routine is never defined and thus silently no pruning +takes place. + +To fix this, the following patch simply loads g++-dg.exp directly +from g++.dg/compat/struct-layout-1.exp. + +Tested on powerpc64-linux and powerpc64le-linux. + +OK for mainline (and 4.8/4.9 once the rs6000 ABI patches are +backported there)? + +Bye, +Ulrich + + +gcc/testsuite/ChangeLog: + + * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp + + +--- a/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp ++++ b/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp +@@ -89,6 +89,9 @@ proc compat-use-tst-compiler { } { + # This must be done after the compat-use-*-compiler definitions. + load_lib compat.exp + ++# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp) ++load_lib g++-dg.exp ++ + g++_init + + # Save variables for the C++ compiler under test, which each test will + diff --git a/debian/patches/gcc-gfdl-build.diff b/debian/patches/gcc-gfdl-build.diff index 13cf834..e13123f 100644 --- a/debian/patches/gcc-gfdl-build.diff +++ b/debian/patches/gcc-gfdl-build.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/Makefile.in =================================================================== --- a/src/gcc/Makefile.in +++ b/src/gcc/Makefile.in -@@ -3678,30 +3678,8 @@ +@@ -3679,30 +3679,8 @@ s-tm-texi: $(srcdir)/doc/../doc/tm.texi # \r is not portable to Solaris tr, therefore we have a special # case for ASCII. We use \r for other encodings like EBCDIC. s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in diff --git a/debian/patches/gcc-hash-style-gnu.diff b/debian/patches/gcc-hash-style-gnu.diff index 204ecc7..b097a0e 100644 --- a/debian/patches/gcc-hash-style-gnu.diff +++ b/debian/patches/gcc-hash-style-gnu.diff @@ -38,7 +38,7 @@ Index: b/src/gcc/config/alpha/linux-elf.h =================================================================== --- a/src/gcc/config/alpha/linux-elf.h +++ b/src/gcc/config/alpha/linux-elf.h -@@ -37,7 +37,7 @@ +@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. #define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER @@ -51,7 +51,7 @@ Index: b/src/gcc/config/ia64/linux.h =================================================================== --- a/src/gcc/config/ia64/linux.h +++ b/src/gcc/config/ia64/linux.h -@@ -58,7 +58,7 @@ +@@ -58,7 +58,7 @@ do { \ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" #undef LINK_SPEC @@ -64,7 +64,7 @@ Index: b/src/gcc/config/rs6000/linux64.h =================================================================== --- a/src/gcc/config/rs6000/linux64.h +++ b/src/gcc/config/rs6000/linux64.h -@@ -385,11 +385,11 @@ +@@ -405,11 +405,11 @@ extern int dot_symbols; " -m elf64ppc") #endif @@ -82,7 +82,7 @@ Index: b/src/gcc/config/rs6000/sysv4.h =================================================================== --- a/src/gcc/config/rs6000/sysv4.h +++ b/src/gcc/config/rs6000/sysv4.h -@@ -788,7 +788,7 @@ +@@ -773,7 +773,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF #define GNU_USER_DYNAMIC_LINKER \ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) @@ -95,7 +95,7 @@ Index: b/src/gcc/config/s390/linux.h =================================================================== --- a/src/gcc/config/s390/linux.h +++ b/src/gcc/config/s390/linux.h -@@ -65,7 +65,7 @@ +@@ -65,7 +65,7 @@ along with GCC; see the file COPYING3. #undef LINK_SPEC #define LINK_SPEC \ @@ -108,7 +108,7 @@ Index: b/src/gcc/config/sparc/linux.h =================================================================== --- a/src/gcc/config/sparc/linux.h +++ b/src/gcc/config/sparc/linux.h -@@ -86,7 +86,7 @@ +@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" #undef LINK_SPEC @@ -133,7 +133,7 @@ Index: b/src/gcc/config/i386/gnu-user.h =================================================================== --- a/src/gcc/config/i386/gnu-user.h +++ b/src/gcc/config/i386/gnu-user.h -@@ -74,7 +74,7 @@ +@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3. { "link_emulation", GNU_USER_LINK_EMULATION },\ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } @@ -146,7 +146,7 @@ Index: b/src/gcc/config/i386/gnu-user64.h =================================================================== --- a/src/gcc/config/i386/gnu-user64.h +++ b/src/gcc/config/i386/gnu-user64.h -@@ -56,6 +56,7 @@ +@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTI "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \ %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \ %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \ diff --git a/debian/patches/gcc-linaro-doc.diff b/debian/patches/gcc-linaro-doc.diff index 08cb9b3..798e762 100644 --- a/debian/patches/gcc-linaro-doc.diff +++ b/debian/patches/gcc-linaro-doc.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/doc/extend.texi =================================================================== --- a/src/gcc/doc/extend.texi +++ b/src/gcc/doc/extend.texi -@@ -8781,6 +8781,7 @@ +@@ -8792,6 +8792,7 @@ instructions, but allow the compiler to * Alpha Built-in Functions:: * ARM iWMMXt Built-in Functions:: * ARM NEON Intrinsics:: @@ -12,7 +12,7 @@ Index: b/src/gcc/doc/extend.texi * AVR Built-in Functions:: * Blackfin Built-in Functions:: * FR-V Built-in Functions:: -@@ -9046,6 +9047,14 @@ +@@ -9058,6 +9059,14 @@ when the @option{-mfpu=neon} switch is u @include arm-neon-intrinsics.texi @@ -91,7 +91,7 @@ Index: b/src/gcc/doc/tm.texi =================================================================== --- a/src/gcc/doc/tm.texi +++ b/src/gcc/doc/tm.texi -@@ -10926,8 +10926,16 @@ +@@ -10926,8 +10926,16 @@ Fold a call to a machine specific built- @samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the built-in function. @var{n_args} is the number of arguments passed to the function; the arguments themselves are pointed to by @var{argp}. @@ -114,7 +114,7 @@ Index: b/src/gcc/doc/tm.texi.in =================================================================== --- a/src/gcc/doc/tm.texi.in +++ b/src/gcc/doc/tm.texi.in -@@ -10772,10 +10772,13 @@ +@@ -10772,10 +10772,13 @@ Fold a call to a machine specific built- @samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the built-in function. @var{n_args} is the number of arguments passed to the function; the arguments themselves are pointed to by @var{argp}. @@ -134,7 +134,7 @@ Index: b/src/gcc/doc/invoke.texi =================================================================== --- a/src/gcc/doc/invoke.texi +++ b/src/gcc/doc/invoke.texi -@@ -418,7 +418,7 @@ +@@ -418,7 +418,7 @@ Objective-C and Objective-C++ Dialects}. -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol -ftree-switch-conversion -ftree-tail-merge @gol @@ -143,7 +143,7 @@ Index: b/src/gcc/doc/invoke.texi -funit-at-a-time -funroll-all-loops -funroll-loops @gol -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol -@@ -510,7 +510,9 @@ +@@ -510,7 +510,9 @@ Objective-C and Objective-C++ Dialects}. -mtp=@var{name} -mtls-dialect=@var{dialect} @gol -mword-relocations @gol -mfix-cortex-m3-ldrd @gol @@ -154,7 +154,7 @@ Index: b/src/gcc/doc/invoke.texi @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol -@@ -6590,7 +6592,7 @@ +@@ -6604,7 +6606,7 @@ optimizations designed to reduce code si @option{-Os} disables the following optimization flags: @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol @@ -163,7 +163,7 @@ Index: b/src/gcc/doc/invoke.texi @item -Ofast @opindex Ofast -@@ -7831,19 +7833,20 @@ +@@ -7845,19 +7847,20 @@ Perform loop vectorization on trees. Thi Perform basic block vectorization on trees. This flag is enabled by default at @option{-O3} and when @option{-ftree-vectorize} is enabled. @@ -196,7 +196,7 @@ Index: b/src/gcc/doc/invoke.texi @item -ftree-vrp @opindex ftree-vrp -@@ -9239,13 +9242,15 @@ +@@ -9253,13 +9256,15 @@ constraints. The default value is 0. @item vect-max-version-for-alignment-checks The maximum number of run-time checks that can be performed when @@ -216,7 +216,7 @@ Index: b/src/gcc/doc/invoke.texi @item max-iterations-to-track The maximum number of iterations of a loop the brute-force algorithm -@@ -10966,6 +10971,8 @@ +@@ -10980,6 +10985,8 @@ Feature modifiers used with @option{-mar the following: @table @samp @@ -225,21 +225,10 @@ Index: b/src/gcc/doc/invoke.texi @item crypto Enable Crypto extension. This implies Advanced SIMD is enabled. @item fp -@@ -11263,8 +11270,8 @@ - @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, - @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, - @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, --@samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, --@samp{cortex-m4}, @samp{cortex-m3}, -+@samp{cortex-a15}, @samp{cortex-a53}, @samp{cortex-r4}, @samp{cortex-r4f}, -+@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m4}, @samp{cortex-m3}, - @samp{cortex-m1}, - @samp{cortex-m0}, - @samp{cortex-m0plus}, -@@ -11317,9 +11324,12 @@ +@@ -11266,9 +11273,12 @@ of the @option{-mcpu=} option. Permissi @samp{armv6}, @samp{armv6j}, @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, - @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, + @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m} -@samp{armv8-a}, +@samp{armv8-a}, @samp{armv8-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. @@ -250,7 +239,18 @@ Index: b/src/gcc/doc/invoke.texi @option{-march=native} causes the compiler to auto-detect the architecture of the build computer. At present, this feature is only supported on Linux, and not all architectures are recognized. If the auto-detect is -@@ -11527,6 +11537,17 @@ +@@ -11298,8 +11308,8 @@ Permissible names are: @samp{arm2}, @sam + @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, + @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, + @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, +-@samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, +-@samp{cortex-m4}, @samp{cortex-m3}, ++@samp{cortex-a15}, @samp{cortex-a53}, @samp{cortex-r4}, @samp{cortex-r4f}, ++@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m4}, @samp{cortex-m3}, + @samp{cortex-m1}, + @samp{cortex-m0}, + @samp{cortex-m0plus}, +@@ -11546,6 +11556,17 @@ setting of this option. If unaligned ac preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be defined. @@ -2475,7 +2475,7 @@ Index: b/src/gcc/doc/md.texi =================================================================== --- a/src/gcc/doc/md.texi +++ b/src/gcc/doc/md.texi -@@ -1711,9 +1711,6 @@ +@@ -1711,9 +1711,6 @@ Floating point constant zero @item Z Integer constant zero @@ -2485,7 +2485,7 @@ Index: b/src/gcc/doc/md.texi @item Ush The high part (bits 12 and upwards) of the pc-relative address of a symbol within 4GB of the instruction -@@ -8828,7 +8825,8 @@ +@@ -8868,7 +8865,8 @@ can be quite tedious to describe these f (define_cond_exec [@var{predicate-pattern}] "@var{condition}" @@ -2495,7 +2495,7 @@ Index: b/src/gcc/doc/md.texi @end smallexample @var{predicate-pattern} is the condition that must be true for the -@@ -8849,6 +8847,13 @@ +@@ -8889,6 +8887,13 @@ In order to handle the general case, the @code{current_insn_predicate} that will contain the entire predicate if the current insn is predicated, and will otherwise be @code{NULL}. diff --git a/debian/patches/gcc-multiarch.diff b/debian/patches/gcc-multiarch.diff index 6a7e1b9..a785d30 100644 --- a/debian/patches/gcc-multiarch.diff +++ b/debian/patches/gcc-multiarch.diff @@ -17,7 +17,7 @@ Index: b/src/libstdc++-v3/python/hook.in =================================================================== --- a/src/libstdc++-v3/python/hook.in +++ b/src/libstdc++-v3/python/hook.in -@@ -47,14 +47,18 @@ +@@ -47,14 +47,18 @@ if gdb.current_objfile () is not None: libdir = libdir[len (prefix):] # Compute the ".."s needed to get from libdir to the prefix. @@ -53,7 +53,7 @@ Index: b/src/gcc/config/sparc/t-linux64 =================================================================== --- a/src/gcc/config/sparc/t-linux64 +++ b/src/gcc/config/sparc/t-linux64 -@@ -27,3 +27,5 @@ +@@ -27,3 +27,5 @@ MULTILIB_OPTIONS = m64/m32 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:sparc64-linux-gnu) MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:sparc-linux-gnu) @@ -63,7 +63,7 @@ Index: b/src/gcc/config/s390/t-linux64 =================================================================== --- a/src/gcc/config/s390/t-linux64 +++ b/src/gcc/config/s390/t-linux64 -@@ -9,3 +9,5 @@ +@@ -9,3 +9,5 @@ MULTILIB_OPTIONS = m64/m31 MULTILIB_DIRNAMES = 64 32 MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu) MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) @@ -86,7 +86,7 @@ Index: b/src/gcc/config/rs6000/t-linux64 =================================================================== --- a/src/gcc/config/rs6000/t-linux64 +++ b/src/gcc/config/rs6000/t-linux64 -@@ -30,3 +30,5 @@ +@@ -30,3 +30,5 @@ MULTILIB_DIRNAMES := 64 32 MULTILIB_EXTRA_OPTS := MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) @@ -96,7 +96,7 @@ Index: b/src/gcc/config/i386/t-linux64 =================================================================== --- a/src/gcc/config/i386/t-linux64 +++ b/src/gcc/config/i386/t-linux64 -@@ -36,3 +36,13 @@ +@@ -36,3 +36,13 @@ MULTILIB_DIRNAMES = $(patsubst m%, %, MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) @@ -129,7 +129,7 @@ Index: b/src/gcc/config.gcc =================================================================== --- a/src/gcc/config.gcc +++ b/src/gcc/config.gcc -@@ -1806,8 +1806,11 @@ +@@ -1806,8 +1806,11 @@ mips*-mti-linux*) mips64*-*-linux* | mipsisa64*-*-linux*) tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h" tmake_file="${tmake_file} mips/t-linux64" @@ -142,7 +142,7 @@ Index: b/src/gcc/config.gcc mips64el-st-linux-gnu) tm_file="${tm_file} mips/st.h" tmake_file="${tmake_file} mips/t-st" -@@ -3746,7 +3749,7 @@ +@@ -3749,7 +3752,7 @@ case ${target} in i[34567]86-*-darwin* | x86_64-*-darwin*) ;; i[34567]86-*-linux* | x86_64-*-linux*) @@ -155,7 +155,7 @@ Index: b/src/gcc/java/jvspec.c =================================================================== --- a/src/gcc/java/jvspec.c +++ b/src/gcc/java/jvspec.c -@@ -59,7 +59,7 @@ +@@ -59,7 +59,7 @@ static const char jvgenmain_spec[] = "jvgenmain %{findirect-dispatch} %{D*} %b %m.i |\n\ cc1 %m.i %1 \ %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*}\ @@ -168,7 +168,7 @@ Index: b/src/gcc/config/aarch64/t-aarch64-linux =================================================================== --- a/src/gcc/config/aarch64/t-aarch64-linux +++ b/src/gcc/config/aarch64/t-aarch64-linux -@@ -22,4 +22,4 @@ +@@ -22,4 +22,4 @@ LIB1ASMSRC = aarch64/lib1funcs.asm LIB1ASMFUNCS = _aarch64_sync_cache_range AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) diff --git a/debian/patches/gcc-rs6000-update.diff b/debian/patches/gcc-rs6000-update.diff deleted file mode 100644 index 1069b50..0000000 --- a/debian/patches/gcc-rs6000-update.diff +++ /dev/null @@ -1,70 +0,0 @@ -when trying to build Ada for powerpc64le-linux, I ran into an ICE -in fixup_args_size_notes. - -It turns out that the p8 fusion peephole acts on these two insns -from the epilog sequence: - -(insn 1693 1078 1079 91 (set (reg:DI 7 7) - (plus:DI (reg/f:DI 31 31) - (const_int 65536 [0x10000]))) 82 {*adddi3_internal1} - (nil)) -(insn 1079 1693 1511 91 (set (reg/f:DI 1 1) - (mem/c:DI (plus:DI (reg:DI 7 7) - (const_int -16096 [0xffffffffffffc120])) [233 %sfp+49440 S8 A64])) 519 {*movdi_internal64} - (expr_list:REG_DEAD (reg:DI 7 7) - (expr_list:REG_ARGS_SIZE (const_int 0 [0]) - (nil)))) - -and replaces them by: - -(insn 1776 1078 1777 91 (set (reg/f:DI 1 1) - (plus:DI (reg/f:DI 31 31) - (const_int 65536 [0x10000]))) -1 - (nil)) - -(insn 1777 1776 1511 91 (set (reg/f:DI 1 1) - (mem/c:DI (plus:DI (reg/f:DI 1 1) - (const_int -16096 [0xffffffffffffc120])) [233 S8 A8])) -1 - (expr_list:REG_ARGS_SIZE (const_int 0 [0]) - (nil))) - -Then peephole common code thinks it needs to re-create the REG_ARGS_SIZE -note and fails since the code is too complex for it to understand. (Which -is reasonable since it doesn't know what value is being restored from the -stack here.) - -However, the more fundamental problem seems to be that this transformation -should be invalid anyway, since it creates an intermediate state where -the stack pointer points to a location without proper backchain, which -violates the ABI. - -The following patch fixes this by disabling the fusion peephole in those -cases where it would introduce a new use of the stack pointer as temporary -register. - -Tested on powerpc64le-linux. OK for mainline (and 4.8 after the big patch -series is committed)? - -Bye, -Ulrich - -ChangeLog: - - * config/rs6000/rs6000.c (fusion_gpr_load_p): Refuse optimization - if it would clobber the stack pointer, even temporarily. - ---- a/src/gcc/config/rs6000/rs6000.c -+++ b/src/gcc/config/rs6000/rs6000.c -@@ -32519,6 +32519,11 @@ - - if (!peep2_reg_dead_p (2, addis_reg)) - return false; -+ -+ /* If the target register being loaded is the stack pointer, we must -+ avoid loading any other value into it, even temporarily. */ -+ if (REG_P (target) && REGNO (target) == STACK_POINTER_REGNUM) -+ return false; - } - - base_reg = XEXP (addr, 0); - diff --git a/debian/patches/gcc-setmultilib-fix.diff b/debian/patches/gcc-setmultilib-fix.diff new file mode 100644 index 0000000..950057b --- /dev/null +++ b/debian/patches/gcc-setmultilib-fix.diff @@ -0,0 +1,22 @@ +--- a/src/gcc/gcc.c ++++ b/src/gcc/gcc.c +@@ -8038,10 +8038,15 @@ + q2++; + if (*q2 == ':') + ml_end = q2; +- new_multilib_os_dir = XNEWVEC (char, ml_end - q); +- memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1); +- new_multilib_os_dir[ml_end - q - 1] = '\0'; +- multilib_os_dir = *new_multilib_os_dir ? new_multilib_os_dir : "."; ++ if (ml_end - q == 1) ++ multilib_os_dir = xstrdup ("."); ++ else ++ { ++ new_multilib_os_dir = XNEWVEC (char, ml_end - q); ++ memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1); ++ new_multilib_os_dir[ml_end - q - 1] = '\0'; ++ multilib_os_dir = new_multilib_os_dir; ++ } + + if (q2 < end && *q2 == ':') + { diff --git a/debian/patches/gcc-textdomain.diff b/debian/patches/gcc-textdomain.diff index 68b8878..7c1b914 100644 --- a/debian/patches/gcc-textdomain.diff +++ b/debian/patches/gcc-textdomain.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/intl.c =================================================================== --- a/src/gcc/intl.c +++ b/src/gcc/intl.c -@@ -55,8 +55,8 @@ +@@ -55,8 +55,8 @@ gcc_init_libintl (void) setlocale (LC_ALL, ""); #endif @@ -19,7 +19,7 @@ Index: b/src/gcc/Makefile.in =================================================================== --- a/src/gcc/Makefile.in +++ b/src/gcc/Makefile.in -@@ -5260,8 +5260,8 @@ +@@ -5261,8 +5261,8 @@ install-po: dir=$(localedir)/$$lang/LC_MESSAGES; \ echo $(mkinstalldirs) $(DESTDIR)$$dir; \ $(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \ @@ -34,7 +34,7 @@ Index: b/src/libcpp/init.c =================================================================== --- a/src/libcpp/init.c +++ b/src/libcpp/init.c -@@ -144,7 +144,7 @@ +@@ -144,7 +144,7 @@ init_library (void) init_trigraph_map (); #ifdef ENABLE_NLS @@ -47,7 +47,7 @@ Index: b/src/libcpp/system.h =================================================================== --- a/src/libcpp/system.h +++ b/src/libcpp/system.h -@@ -280,7 +280,7 @@ +@@ -280,7 +280,7 @@ extern int errno; #endif #ifndef _ @@ -60,7 +60,7 @@ Index: b/src/libcpp/Makefile.in =================================================================== --- a/src/libcpp/Makefile.in +++ b/src/libcpp/Makefile.in -@@ -49,6 +49,7 @@ +@@ -49,6 +49,7 @@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ PACKAGE = @PACKAGE@ @@ -68,7 +68,7 @@ Index: b/src/libcpp/Makefile.in RANLIB = @RANLIB@ SHELL = @SHELL@ USED_CATALOGS = @USED_CATALOGS@ -@@ -71,10 +72,11 @@ +@@ -71,10 +72,11 @@ depcomp = $(SHELL) $(srcdir)/../depcomp INCLUDES = -I$(srcdir) -I. -I$(srcdir)/../include @INCINTL@ \ -I$(srcdir)/include @@ -82,7 +82,7 @@ Index: b/src/libcpp/Makefile.in # The name of the compiler to use. COMPILER = $(CXX) -@@ -163,8 +165,8 @@ +@@ -163,8 +165,8 @@ install-strip install: all installdirs else continue; \ fi; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ diff --git a/debian/patches/gdc-4.8.diff b/debian/patches/gdc-4.8.diff index d2d276c..833c09c 100644 --- a/debian/patches/gdc-4.8.diff +++ b/debian/patches/gdc-4.8.diff @@ -5,7 +5,7 @@ Index: b/src/gcc/config/rs6000/rs6000.c =================================================================== --- a/src/gcc/config/rs6000/rs6000.c +++ b/src/gcc/config/rs6000/rs6000.c -@@ -21584,7 +21584,8 @@ +@@ -24977,7 +24977,8 @@ rs6000_output_function_epilogue (FILE *f either, so for now use 0. */ if (! strcmp (language_string, "GNU C") || ! strcmp (language_string, "GNU GIMPLE") @@ -19,7 +19,7 @@ Index: b/src/gcc/dwarf2out.c =================================================================== --- a/src/gcc/dwarf2out.c +++ b/src/gcc/dwarf2out.c -@@ -18909,6 +18909,8 @@ +@@ -18909,6 +18909,8 @@ gen_compile_unit_die (const char *filena language = DW_LANG_C89; if (strcmp (language_string, "GNU C++") == 0) language = DW_LANG_C_plus_plus; @@ -32,7 +32,7 @@ Index: b/src/gcc/gcc.c =================================================================== --- a/src/gcc/gcc.c +++ b/src/gcc/gcc.c -@@ -1003,6 +1003,7 @@ +@@ -1003,6 +1003,7 @@ static const struct compiler default_com {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0}, {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0}, {".go", "#Go", 0, 1, 0}, diff --git a/debian/patches/gdc-libphobos-build.diff b/debian/patches/gdc-libphobos-build.diff index ef56771..996eaa1 100644 --- a/debian/patches/gdc-libphobos-build.diff +++ b/debian/patches/gdc-libphobos-build.diff @@ -1,17 +1,5 @@ # DP: This implements building of libphobos library in GCC. -Index: b/src/configure -=================================================================== ---- a/src/configure -+++ b/src/configure -@@ -2781,7 +2781,8 @@ - ${libgcj} \ - target-libobjc \ - target-libada \ -- target-libgo" -+ target-libgo \ -+ target-libphobos" - # these tools are built using the target libraries, and are intended to # run only in the target environment Index: b/src/configure.ac diff --git a/debian/patches/gdc-updates.diff b/debian/patches/gdc-updates.diff deleted file mode 100644 index ea8a28d..0000000 --- a/debian/patches/gdc-updates.diff +++ /dev/null @@ -1,227397 +0,0 @@ -# DP: gdc updates up to 20140401. - ---- a/src/gcc/d/ChangeLog 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/gcc/d/ChangeLog 2014-04-01 16:32:51.000000000 +0100 -@@ -1,694 +1,280 @@ --2013-06-01 Johannes Pfau <johannespfau@gmail.com> -+2014-03-31 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-codegen.cc(maybe_set_builtin_frontend): Check parameter and -- return types of intrinsics. -+ * d-codegen.cc(error_mark_p): Removed function, replace uses with -+ error_operand_p. -+ (error_mark): Removed function, replace uses with error_mark_node. -+ * d-ctype.cc(Type::toCtype): Return d_unknown_type_node for frontend -+ error types. -+ * d-objfile.cc(VarDeclaration::toObjFile): Don't build CONST_DECLs for -+ non-scalar manifests. -+ -+2014-03-23 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(Dsymbol::toImport): Prevent GC from collecting -+ IMPORTED_DECL nodes whilst front-end compilation in progress. -+ -+2014-03-19 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(AggLayout::visit): Rename to layout_aggregate_type. -+ (AggLayout::doFields, AggLayout::doInterfaces): Remove function and -+ move implementation into layout_aggregate_type. -+ (AggLayout::addField): Rename to insert_aggregate_field. -+ (AggLayout::finish): Rename to finish_aggregate_type. -+ * d-codegen.h(AggLayout): Update definition. -+ * d-ctype.cc(TypeStruct::toCtype): Update for glue changes. -+ (TypeFunction::toCtype): Fix ICE on generic function types. -+ (TypeClass::toCtype): Move generation of vptr and monitor fields into -+ layout_aggregate_type. Moved generation of TYPE_METHODS from ... -+ * d-objfile.cc(FuncDeclaration::toObjFile): ... here into -+ TypeClass::toCtype. Don't build up TYPE_METHODS on a per-function -+ basis, generate the entire vtable. -+ -+2014-03-18 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(Dsymbol::toSymbolX): Set the symbol prettyIdent. -+ (Dsymbol::toImport): Emit packages as their fully qualified names. -+ (ClassDeclaration::toSymbol): Distinguish between the classinfo -+ assembler and decl name. -+ (InterfaceDeclaration::toSymbol): Likewise for interface symbol. -+ (Module::toSymbol): Likewise for moduleinfo symbol. -+ (ClassDeclaration::toVtblSymbol): Likewise for class vtable symbol. -+ (AggregateDeclaration::toInitializer) -+ (TypedefDeclaration::toInitializer, EnumDeclaration::toInitializer): -+ Likewise for default initialisers. -+ * d-objfile.cc(Module::genobjfile): Don't set-up moduleinfo symbol -+ storage twice. -+ -+2014-03-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(d_decl_context): Fix null pointer dereference. -+ * d-objfile.cc(FuncDeclaration::toObjFile): Don't override the setting -+ of DECL_CONTEXT on the declaration here. -+ (d_finish_symbol): Likewise. -+ * d-objfile.cc(VarDeclaration::toObjFile): Move the generation of -+ manifest constants to ... -+ * d-decls.cc(VarDeclaration::toSymbol): ... here, and emit them as -+ CONST_DECLs. Set the DECL_CONTEXT for all variable symbols. -+ -+ * d-builtins.cc(d_gcc_magic_builtins_module): Don't store compiler -+ generated builtins in Symbol::isym, use Symbol::csym instead. -+ (d_gcc_magic_libbuiltins_check): Likewise. -+ * d-codegen.cc(d_decl_context): Return the imported symbol tree of -+ modules where the NAMESPACE_DECL is now stored. -+ (d_build_module): Remove function. Move implementation to ... -+ * d-decls.cc(Dsymbol::toImport): ... here. Build an IMPORTED_DECL for -+ all imported declarations. -+ (FuncDeclaration::toSymbol): Remove special handling of Symbol::isym. -+ (Module::toSymbol): Remove call to d_build_module. -+ * d-objfile.cc(Dsymbol::toObjFile): Handle emission of IMPORTED_DECL -+ symbols to debug. -+ -+2014-03-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(build_attributes): Ensure D-specific attributes have -+ their value interpreted through CTFE. -+ -+2014-02-21 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(d_build_module): Update signature to accept a Loc -+ location to the module declaration. -+ * d-decls.cc(Module::toSymbol): Update call to d_build_module. -+ Set TREE_PUBLIC/DECL_EXTERNAL to distingush which modules are being -+ compiled. -+ * d-objfile.cc(Dsymbol::toObjFile): Handle Import symbols, and emit -+ debug information for imported modules. -+ (ImportStatement::toIR): Likewise. -+ (set_input_location): New function to implement the equivalent of -+ set_decl_location, but instead sets input_location. -+ -+2014-02-19 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-objfile.cc(build_call_function): Call set_input_location -+ to set debug info correctly -+ -+2014-02-18 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(VarDeclaration::toObjFile): Remove toplevel check. -+ DECL_CONTEXT is never set on manifest constants. -+ (d_finish_compilation): Remove fancy check on force outputting -+ symbols to object file. -+ (build_type_decl): Don't emit the qualified identifier in debug -+ information. The fully qualified name is now determined through the -+ NAMESPACE_DECL context chain. -+ * d-ctype.cc(TypeEnum::toCtype): Likewise for enum members. -+ (VarDeclaration::toSymbol): Likewise for static variables. -+ (FuncDeclaration::toSymbol): Likewise for functions. -+ -+ * d-decls.cc(FuncDeclaration::toSymbol): Don't emit the 'D main' -+ symbol to debug as plain 'main'. -+ * d-objfile.cc(VarDeclaration::toObjFile): Don't emit the qualified -+ identifier of manifest constants in debug information. -+ -+2014-02-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(d_build_module): New function. -+ * d-decls.cc(Module::toSymbol): Use d_build_module to build up the -+ qualified module namespace. -+ -+ * d-codegen.cc(expand_intrinsic_op, expand_intrinsic_op2): New -+ functions to build a call to a builtin code. -+ (expand_intrinsic_bsr, expand_intrinsic_bt): New functions to expand a -+ BUILTIN_FRONTEND call to core.bitop intrinsics. -+ (expand_intrinsic_vaarg, expand_intrinsic_vastart): New functions to -+ expand a BUILTIN_FRONTEND call to core.vararg intrinsics. -+ (maybe_expand_builtin): Update. -+ -+2014-02-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(Module::toSymbol): Build a NAMESPACE_DECL to populate the -+ DECL_CONTEXT of toplevel functions. -+ * d-codegen.cc(d_decl_context): Return the enclosing module -+ NAMESPACE_DECL as the decl context only when the symbol is extern(D) -+ and not D main. - --2013-06-01 Iain Buclaw <ibuclaw@gdcproject.org> -+2014-02-15 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-codegen.cc(IRState::var): Handle variables used for NRVO. -- * d-ir.cc(ReturnStatement::toIR): Return result decl directly if NRVO. -- * d-objfile.cc(Symbol::SnamedResult): New member to hold the named -- RESULT_DECL of the function. -- (FuncDeclaration::toObjFile): Set-up function for NRVO. -- (build_tlssections): Align _tlsstart and _tlsend symbols to target -- address size. -- * d-ctype(TypeFunction::toSymbol): Mark functions returning non-POD -- structs as TREE_ADDRESSABLE to force return in memory. -- * d-decls.cc(FuncDeclaration::toSymbol): Propagate TREE_ADDRESSABLE -- from the original function type. -- --2013-05-29 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-target.cc: New source file to handle Target structure. -- -- * d-builtins.c(d_bi_init): Remove function. -- (d_gcc_type_align): Move to Target::alignsize. -- (d_gcc_field_align): Move to Target::fieldalign. -- (d_init_builtins): Build va_list type for D frontend. -- * d-lang.cc(d_init): Use isLP64 to determine LP64 targets. -- (d_add_builtin_version): Set is64bit if target is X86_64. -- * d-codegen.cc(convert_for_assignment): Use memset to implement front -- end code (struct = 0) here, rather than build an empty constructor. -- * d-elem.cc(AssignExp::toElem): Remove handling of (struct = 0) and -- call convert_for_assignment. -- --2013-05-28 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-gcc-complex_t.h: Rename to complex_t.h. -- * d-gcc-real.cc: Rename to d-longdouble.cc. -- * d-gcc-real.h: Rename to longdouble.h -- * d-port.cc: New source file to handle Port structure. -- * gdc_alloca.h: Remove source. -- -- * d-longdouble.cc(real_t): Rename to longdouble. -- (longdouble::getnan): Move to Port::nan. -- (longdouble::getsnan): Move to Port::snan. -- (longdouble::getinfinity): Move to Port::infinity. -- (longdouble::isInf): Move to Port::isInfinite. -- (longdouble::isNan): Move to Port::isNan. -- (longdouble::isSignallingNan): Move to Port::isSignallingNan. -- * d-builtins.c(gcc_d_backend_init): Rename to d_backend_init. -- (gcc_d_backend_term): Rename to d_backend_term. -- (gcc_type_to_d_type): Don't map 128bit integers to D front end. -- -- * d-elem.cc(AssignExp::toElem): Remove handling of fillHoles, use -- memset to implement (struct = 0). -- (StructLiteralExp::toElem): Handle fillHoles here, creating a -- temporary var that is zero init'd with memset and returned. -- --2013-05-27 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::localVar): Rename to build_local_var. -- (IRState::exprVar): Rename to create_temporary_var. -- (IRState::maybeExprvar): Rename to maybe_temporary_var. -- (IRState::pointerIntSum): Rename to build_array_index. -- * d-lang.cc(d_handle_target_attribute): New function to handle D -- target attributes. -- --2013-05-26 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-incpath.cc(prefixed_path): Add cpp_GCC_INCLUDE_DIR back in as -- second method for relocation. -- * d-elem.cc(IndexExp::toElem): Fix call to _aaGetX as from -- IRState::toElemLvalue. -- * d-codegen.cc(IRState::toElemLvalue): Remove function. -- (IRState::convertForAssignment): Rename to convert_for_assignment. -- (IRState::convertForCondition): Rename to convert_for_condition. -- (IRState::checkedIndex): Rename to d_checked_index. -- (IRState::boundsCond): Rename to d_bounds_condition. -- (IRState::arrayBoundsCheck): Rename to array_bounds_check. -- (IRState::assertCall): Rename to d_assert_call. -- (IRState::doLineNote): Move to irstate.h. -- * d-irstate.cc(IRBase::getLocalContext): Remove function. -- * d-decls.cc(VarDeclaration::toSymbol): Build decl lang specific for -- decl to point back to D front end type. -- (FuncDeclaration::toSymbol): Likewise. -- --2013-05-23 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(AggLayout::finish): Unset TYPE_SIZE before -- re-calculating. -- * d-ctype.cc(TypeStruct::toCtype): Don't call decl_attribute on the -- type twice. -- --2013-05-21 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-lang.cc(d_gcc_dump_source): Remove function. -- (d_post_options): Set flag_excess_precision_cmd as standard. -- * d-gcc-real.cc(real_t::convert): Remove function. -- (real_t::floatCompare): Remove function. -- (real_t::operator): Always perform floating point compilation at the -- precision of the target real mode. -- * d-todt.cc(dt_last): Remove function. -- (dtlist_to_tree): Rename to dtvector_to_tree. -- (dt_cons): Replace TREE_CHAIN implementation for use of CONSTRUCTOR. -- (dt_chainon): Likewise. -- (dt_container): Likewise. -- (dt_container2): Likewise. -- (StructInitializer::toDt): Likewise. -- (StructLiteralExp::toDt): Likewise. -- --2013-05-17 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::convertTo): Replace with d_convert and -- convert_expr. -- (IRState::declContext): Replace with d_decl_context. -- (IRState::functionNeedsChain): Replace with needs_static_chain. -- (IRState::label): Replace with d_build_label. -- (IRState::emitTemplates): Move to ObjectFile. -- (functionDegenerateClosure): Replace with is_degenerate_closure. -- (get_object_method): Assert that function is a method. -- (IRState::startCond): Move to IRBase. -- (IRState::startElse): Likewise. -- (IRState::endCond): Likewise. -- (IRState::startLoop): Likewise. -- (IRState::continueHere): Likewise. -- (IRState::setContinueLabel): Likewise. -- (IRState::exitIfFalse): Likewise. -- (IRState::endLoop): Likewise. -- (IRState::startCase): Likewise. -- (IRState::doCase): Likewise. -- (IRState::endCase): Likewise. -- (IRState::continueLoop): Likewise. -- (IRState::exitLoop): Likewise. -- (IRState::startTry): Likewise. -- (IRState::startCatches): Likewise. -- (IRState::startCatch): Likewise. -- (IRState::endCatch): Likewise. -- (IRState::endCatches): Likewise. -- (IRState::startFinally): Likewise. -- (IRState::endFinally): Likewise. -- (IRState::doReturn): Likewise. -- (IRState::doJump): Likewise. -- (IRState::pushLabel): Likewise. -- (IRState::checkSwitchCase): Likewise. -- (IRState::checkGoto): Likewise. -- (IRState::checkPreviousGoto): Likewise. -- -- * d-elem.cc(CatAssignExp::toElem): Call postblit on appending array of -- structs if required. -- --2013-05-16 Johannes Pfau <johannespfau@gmail.com> -+ * d-decls.cc(VarDeclaration::toSymbol): Don't call -+ setup_symbol_storage until after SET_DECL_ASSEMBLER_NAME has been set. - -- * d-incpath.cc(prefixed_path): use cpp_PREFIX instead of -- cpp_GCC_INCLUDE_DIR for relocation. -- --2013-05-16 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::convertForAssignment): Remove use of -- CtorEltMaker wrapper for vec<constructor_elt, va_gc>. -- (d_array_value): Likewise. -- (build_delegate_cst): Likewise. -- (extract_from_method_call): Likewise. -- * d-elem.cc(NewExp::toElem): Likewise. -- (ArrayLiteralExp::toElem): Likewise. -- (AssocArrayLiteralExp::toElem): Likewise. -- (StructLiteralExp::toElem): Likewise. -- (NullExp::toElem): Likewise. -- (VectorExp::toElem): Likewise. -- * d-objfile.cc(build_moduleinfo): Likewise. -- * d-todt.cc(dt_container): Likewise. -- (dt_container2): Likewise. -- -- * d-asmstmt.cc(ExtAsmStatement::toIR): Remove use of ListMaker -- wrapper for tree chaining. -- * d-builtins.c(d_bi_builtin_func): Likewise. -- (d_bi_builtin_type): Likewise. -- (d_gcc_magic_builtins_module): Likewise. -- (d_gcc_magic_libbuiltins_module): Likewise. -- * d-codegen.cc(build_attributes): Likewise. -- (IRState::call): Likewise. -- (IRState::buildFrameForFunction): Likewise. -- (AggLayout::doFields): Likewise. -- (AggLayout::addField): Likewise. -- * d-ctype.cc(TypeEnum::toCtype): Likewise. -- (TypeFunction::toCtype): Likewise. -- * d-todt.cc(dt_container2): Likewise. -- -- * d-codegen.cc(IRState::getFrameInfo): Replace with get_frameinfo. -- (IRState::buildFrameForFunction): Replace with build_frame_type. -- (IRState::isClassNestedInFunction): Replace with d_nested_class. -- (IRState::isStructNestedInFunction): Replace with d_nested_struct. -- (IRState::getFrameForFunction): Fold into IRState::getFrameForSymbol. -- (IRState::getFrameForNestedClass): Likewise. -- (IRState::getFrameForNestedStruct): Likewise. -- --2013-05-15 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::buildFrameForFunction): Also copy the -- parameters of functions with 'in' contracts to a local frame decl. -- * d-lang.cc(d_handle_flatten_attribute): New function to handle D -- flatten attributes. -- --2013-05-14 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::chainLink): Remove function. -- (IRState::chainFunc): Remove function. -- (IRState::sthis): New member which holds the chain of function. -- (IRState::buildChain): Update to use new static chain decl. -- (IRState::getFrameInfo): Likewise. -- * d-objfile.cc(FuncDeclaration::buildClosure): Likewise. -- (FuncDeclaration::toObjFile): Default the function static chain decl -- to null unless vthis is given for the function. -- --2013-05-13 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-lang.cc(d_handle_noinline_attribute): New function to handle D -- noinline attributes. -- (d_handle_forceinline_attribute): New function to handle D forceinline -- attributes. -- * d-elem.cc(StructLiteralExp::toElem): Return the struct initialiser -- symbol directly if the tree has already been built. -- * d-decls.cc(Dsymbol::toSymbolX): Constify the mangling name to use. -- --2013-05-10 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-typinf.cc: New file containing type info routines originally in -- the D Front End. -- -- * d-todt.cc(dt_last): New helper function to retrieve last node in a -- dt_t tree list. -- (dt_cons): New helper function to append nodes to the end of a list. -- (dt_chainon): New helper function to concatenate two lists together. -- (dt_container): New helper function to build a ctor from a list. -- (build_vptr_monitor): New helper function to generate the class -- vtable, and put out __vptr and __monitor. -- symbol default values in a class declaration. -- (dtlist_to_tree): New helper function to convert a dt_t list into a -- constructor tree. -- (Type::toDt): Implement routines for new dt_t format. -- (TypeInfoDeclaration::toDt): Likewise. -- (Initializer::toDt): Likewise. -- (Expression::toDt): Likewise. -- (Declaration::toDt): Likewise. -- -- * d-objfile.cc(Dsymbol::toObjFile): Update for new dt_t format. -- (Module::genmoduleinfo): Likewise. -- (Symbol::Symbol): Moved from symbol.cc -- (Obj::objmod): Remove abstraction layer. -- (Obj::moduleinfo): Renamed to build_moduleinfo. -- (obj_tlssections): Renamed to build_tlssections. -- (outdata): Renamed to d_finish_symbol. -- (check_static_sym): Moved into d_finish_symbol. -- -- * d-codegen.cc(d_gcc_emit_local_variable): Remove. -- -- * d-decls.cc(Dsymbol::toSymbolX): Update to not call symbol_calloc. -- (FuncDeclaration::toThunkSymbol): Likewise. -- (ClassDeclaration::toSymbol): Build type as d_unknown_type_node. -- (InterfaceDeclaration::toSymbol): Likewise. -- (Module::toSymbol): Likewise. -- (ClassDeclaration::toVtblSymbol): Update call to toSymbolX. -- (AggregateDeclaration::toInitializer): Likewise. -- (TypedefDeclaration::toInitializer): Likewise. -- (EnumDeclaration::toInitializer): Likewise. -- -- * d-ir.cc(CaseStatement::toIR): Don't call static_sym. -- -- * d-lang.cc(rtlsym): Remove symbol. -- (D_DECL_READONLY_STATIC): Remove macro. -- (d_unknown_type_node): New LANG_TYPE node for marking TypeInfo_Class, -- Interface, and ModuleInfo types that are of a variable size determined -- at compile time. -- -- * d-elem.cc(StringExp::toElem): Clean up for new dt_t format. -- -- * symbol.cc: Remove file. -- --2013-05-08 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::getFrameInfo): Don't create a frame/closure -- for member functions, only required for nested. -- * d-elem.cc(Expression::toElemDtor): Call dtors in the correct order. -- (DeclarationExp::toElem): Don't call dtor on static, manifest, or -- extern symbols upon declaration. -- (AssignExp::toElem): Only call postblit on lvalues in assignment. -- (ArrayLiteralExp::toElem): Always generate literals on heap. -- --2013-05-06 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-elem.cc(StructLiteralExp::toElem): Return the default initialiser -- symbol if one exists. -- * d-builtins.c(d_gcc_magic_libbuiltins_check): Override the function -- type with the correct built-in function type as defined in backend. -- --2013-04-15 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-elem.cc(IdentityExp::toElem): Remove special handling of class, -- reference and array types. -- --2013-04-12 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(maybe_make_temp): Save call expressions so aren't -- evaluated more than once. -- (d_has_side_effects): Remove check for exceptional class types. -- --2013-04-10 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-decls.cc(FuncDeclaration::toSymbol): Harden logic for marking -- functions pure as in 'has no side effects'. -- --2013-04-07 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-decls.cc(FuncDeclaration::toSymbol): Push deferred functions to -- FuncDeclaration::deferred. -- * d-elem.cc(DelegateExp::toElem): Likewise. -- (FuncExp::toElem): Likewise. -- * d-objfile.cc(ObjectFile::shouldEmit): Likewise. -- (FuncDeclaration::toObjFile): Process all deferred functions in -- FuncDeclaration::deferred. -- * symbol.cc(Symbol::deferredNestedFuncs): Remove. -- --2013-04-05 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-elem.cc(FuncExp::toElem): Defer function literals and lambdas -- until parent function has finished processing. -- --2013-04-04 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::buildChain): Use __frame decl directly when -- setting up the function frame. -- (maybe_set_builtin_frontend): Exit early if symbol has no parent. -- * d-decls.cc(FuncDeclaration::toSymbol): Defer all nested functions, -- not just templated instances. -- * d-objfile.cc(FuncDeclaration::toObjFile): Delay processed deferred -- nested functions until function has finished being generated. -- (ObjectFile::shouldEmit): Don't emit nested functions if the parent -- function hasn't finished processing. -- --2013-04-03 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(maybe_set_builtin_frontend): Merged from -- maybe_set_builtin and maybe_set_libcall. -- * d-decls.cc(FuncDeclaration::toSymbol): Use -- maybe_set_builtin_frontend. -- --2013-03-31 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-lang.cc(d_init_options): Default module info emission to on. -- (d_handle_option): New femit-moduleinfo switch. -- * d-objfile.cc(Module::genobjfile): Don't emit module if disabled -- explicitly. -- * d-builtins(is_intrinsic_module_p): New function to test whether -- module is core.bitops. -- (is_math_module_p): New function to test whether module is std.math or -- core.stdc.math. -- (is_builtin_va_arg_p): New function to test whether symbol is -- specially handled va_arg template. -- (is_builtin_va_start_p): New function to test whether symbol is -- specially handled va_start template. -- * d-codegen.cc(IRState::binding): Replace with bind_expr. -- (IRState::mathModule): Replace with std_math_module. -- (IRState::mathCoreModule): Replace with core_math_module. -- (IRState::intrinsicModule): Replace with std_intrinsic_module. -- (IRState::cstdargTemplateDecl): Replace with va_arg_template. -- (IRState::stdargTemplateDecl): Replace with va_arg2_template. -- (IRState::cstdargStartTemplateDecl): Replace with va_start_template. -- (IRState::getLibCallDecl): Replace with get_libcall. -- (IRState::maybeSetLibCallDecl): Replace with maybe_set_libcall. -- (IRState::libCall): Replace with build_libcall. -- (IRState::maybeSetUpBuiltin): Replace with maybe_set_builtin. -- (IRState::Intrinsic): Move enum out of IRState. -- --2013-03-30 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::darrayPtrRef): Replace with d_array_ptr. -- (IRState::darrayLenRef): Replace with d_array_length. -- (IRState::darrayVal): Replace with d_array_value. -- (IRState::darrayString): Replace with d_array_string. -- (IRState::arrayLength): Replace with get_array_length. -- (get_object_method): Remove dependancy on irs parameter. -- * d-lang.cc(d_init): Use static bool std_inc to determine whether to -- include standard module paths. -- (d_post_options): Canonicalize the input filename. -- (d_parse_file): Correctly catch cases where input file is stdin. -- --2013-03-27 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::getFrameInfo) Create a custom static chain for -- all nested functions. -- * d-gcc-includes.h: Rename to d-system.h -- --2013-03-23 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-builtins.c(d_bi_init): Set REALPAD to be TYPE_PRECISION of -- long_double_type_node. -- * d-codegen.cc(IRState::twoFieldType): Replace with -- build_two_field_type. -- (IRState::arrayOpNotImplemented): Replace with unhandled_arrayop_p. -- (IRState::delegateMethodRef): Replace with delegate_method. -- (IRState::delegateObjectRef): Replace with delegate_object. -- (IRState::delegateVal): Replace with build_delegate_cst. -- (IRState::methodCallExpr): Replace with build_method_call. -- (IRState::extractMethodCallExpr): Replace with -- extract_from_method_call. -- (IRState::objectInstanceMethod): Replace with get_object_method. -- (IRState::twoFieldCtor): Remove. -- (IRState::call): Assert that if calling a normal FUNCTION_TYPE, -- 'object' is not set. -- * d-ctype.cc(TypeDelegate::toCtype): Build a METHOD_TYPE for the .func -- field type in delegates. -- * d-lang.h(D_IS_METHOD_CALL_EXPR): Rename to D_METHOD_CALL_EXPR. -- * d-objfile.cc(FuncDeclaration::toObjFile): Remove assert for chain -- function. -- --2013-03-20 Johannes Pfau <johannespfau@gmail.com> -- -- * d-codegen.cc(IRState::objectInstanceMethod): Recursively check -- for TOKsuper / TOKdottype. Do not ignore CastExp. -- * d-elem.cc(IdentityExp::toElem): Ignore padding in bitwise floating -- point comparisons. -- * testsuite: Cleanup. Remove invalid tests, adjust tests, etc. -- --2013-03-20 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::objectInstanceMethod): Get function pointer -- off function TREE_TYPE. -- (build_deref): Handle cases where expression to dereference is an -- address expression. -- (modify_expr): New function overload to set return type directly. -- * d-elem.cc(CatAssignExp::toElem): Use new modify_expr. -- (AssignExp::toElem): Likewise. -- * d-decls.cc(FuncDeclaration::toSymbol): Don't build a method type for -- nested functions / delegates. Just add on the hidden 'this' pointer -- containing the custom static chain/closure object. -- -- * d-codegen.cc(GlobalValues): Replace with current_module, -- current_irs, object_file. -- (IRState::getFuncType): Replace with get_function_type. -- (IRState::isCallByAlias): Replace with call_by_alias_p. -- (IRState::isFuncType): Replace with function_type_p. -- (IRState::doExp): Remove. -- -- * d-asmstmt.cc(ExtAsmStatement::syntaxCopy): Use arraySyntaxCopy to -- copy front end expressions. -- -- * d-codegen.cc(AssignExp::toElem): Call _d_arrayassign / _d_arrayctor -- when assigning arrays of structs. -- --2013-03-18 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::realPart): Replace with real_part. -- (IRState::imagPart): Replace with imaginary_part. -- (IRState::integerConstant): Replace with build_integer_cst. -- (IRState::floatConstant): Replace with build_float_cst. -- (IRState::hwi2toli): Replace with cst_to_hwi. -- (IRState::addressOf): Replace with build_address. -- (IRState::markAddressable): Replace with d_mark_addressable. -- (IRState::markUsed): Replace with d_mark_used. -- (IRState::markRead): Replace with d_mark_read. -- (IRState::indirect): Replace with indirect_ref. -- (IRState::pvoidOkay): Replace with void_okay_p. -- (IRState::maybeCompound): Replace with maybe_compound_expr. -- (IRState::maybeVoidCompound): Replace with maybe_vcompound_expr. -- (IRState::isErrorMark): Replace with error_mark_p. -- (IRState::getTargetSizeConst): Replace with tree_to_hwi. -- (IRState::modify): Replace with modify_expr. -- (IRState::vmodify): Replace with vmodify_expr. -- (IRState::vinit): Replace with build_vinit. -- (IRState::nop): Replace with build_nop. -- (IRState::vconvert): Replace with build_vconvert. -- (IRState::boolOp): Replace with build_boolop. -- (IRState::compound): Replace with compound_expr. -- (IRState::voidCompound): Replace with vcompound_expr. -- (IRState::component): Replace with component_ref. -- (IRState::errorMark): Replace with error_mark. -- (IRState::typesSame): Replace with d_types_same. -- (IRState::typesCompatible): Replace with d_types_compatible. -- (IRState::getDType): Replace with build_dtype. -- (IRState::getObjectType): Replace with build_object_type. -- (IRState::isDeclarationReferenceType): Replace with decl_reference_p. -- (IRState::trueDeclarationType): Replace with declaration_type. -- (IRState::isArgumentReferenceType): Replace with arg_reference_p. -- (IRState::trueArgumentType): Replace with type_passed_as. -- (IRState::arrayType): Replace with d_array_type. -- (IRState::addTypeAttribute): Replace with insert_type_attributes. -- (IRState::addDeclAttribute): Replace with insert_decl_attributes. -- (IRState::attributes): Replace with build_attributes. -- (IRState::addTypeModifiers): Replace with insert_type_modifiers. -- (IRState::maybeMakeTemp): Replace with maybe_make_temp. -- (IRState::isFreeOfSideEffects): Replace with d_has_side_effects. -- (IRState::pointerOffsetOp): Replace with build_offset_op. -- (IRState::pointerOffset): Replace with build_offset. -- (IRState::buildCall): Replace with d_build_call. -- (IRState::exceptionObject): Replace with build_exception_object. -- --2013-03-17 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-asmstmt.cc(d_build_asm_stmt): Remove. -- (ExtAsmStatement::ExtAsmStatement): Update to match renamed members. -- (ExtAsmStatement::syntaxCopy): Likewise. -- (ExtAsmStatement::semantic): Likewise. -- (ExtAsmStatement::toCBuffer): Likewise. -- (ExtAsmStatement::comeFrom): New. -- (ExtAsmStatement::blockExit): Don't error if must not throw. -- (naturalString): Remove. -- (ExtAsmStatement::toIR): Inline IRState::doAsm implementation. -- * d-codegen.cc(IRState::doAsm): Remove. -- * d-decls.cc(FuncDeclaration::toSymbol): Don't generate 'naked' -- attribute. -- (binfo_for): Move into d-decls.cc. -- (intfc_binfo_for): Likewise. -- (ClassDeclaration::toDebug): Likewise. -- (EnumDeclaration::toDebug): Likewise. -- (TypedefDeclaration::toDebug): Likewise. -- (StructDeclaration::toDebug): Likewise. -- * d-objfile.cc(FuncDeclaration::toObjFile): Move into d-objfile.cc. -- (FuncDeclaration::buildClosure): Likewise. -- (Module::genobjfile): Likewise. -- * d-glue.cc: Remove file. -- --2013-03-16 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-ir.cc(SynchronizedStatement::toIR): Remove implementation as is -- now handled by the frontend. -- --2013-03-15 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(IRState::maybeExpandSpecialCall): Handle ref argptr -- arguments. -- --2013-03-13 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-builtins.c(handle_alias_attribute): New function to handle -- internal 'alias' attribute. -- (handle_weakref_attribute): New function to handle internal 'weakref' -- attribute. -- * d-objfile.cc(ObjectFile::outputThunk): Define thunks to external -- symbols as weakref, alias -- --2013-03-12 Johannes Pfau <johannespfau@gmail.com> -- -- * patch-versym-os-4.8.x(mingw32.h): Fix typo -- * patch-versym-cpu-4.8.x(mips.h): Fix typo -- Update version symbols to latest dlang specification. -- --2013-03-10 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-decls.cc(FuncDeclaration::toSymbol): Delay setting TREE_TYPE as -- function type could be hidden in a nested function not yet built. -- * d-codegen.cc(IRState::findThis): Don't get 'this' from outer -- function if it's a closure type. This has already been handled by -- IRState::getFrameForSymbol. -- (IRState::buildChain): Give frame decl debug name '__frame'. -- Always set '__chain' link field. -- (IRState::getFrameInfo): Don't build a frame for all nested functions. -- Search through nested aggregates for static chain in outer functions. -- * d-codegen.h(IRState::useParentChain): Remove. -- * d-glue.cc(FuncDeclaration::toObjFile): Don't call useParentChain. -- Don't create a local var for the chain link for a function. -- (FuncDeclaration::buildClosure): Always set '__chain' link field. -- --2013-03-08 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(d_gcc_force_templates): Only check for emitting -- templates as private. -- * d-lang.cc(d_handle_option): Remove -femit-templates= option. -- * d-objfile.cc(ObjectFile::makeDeclOneOnly): Fix code logic so -- fallback method could be reached. -- * d-objfile.h(TEall, TEauto): Remove. -- --2013-03-07 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-ir.cc(ReturnStatement::toIR): Don't call postblit on return. -- * d-codegen.cc(IRState::trueDeclarationType): Don't set -- D_TYPE_ADDRESSABLE. -- (IRState::makeTemp): Remove. -- (IRState::maybeMakeTemp): Copy makeTemp into function. -- * d-glue.cc(d_genericize): Remove D_TYPE_ADDRESSABLE handling. -- * d-lang.h(D_TYPE_ADDRESSABLE): Remove macro. -- --2013-03-04 Johannes Pfau <johannespfau@gmail.com> -- -- * d-ctype.cc(Type::toCtype): Always call gen.addTypeModifiers to -- make sure TYPE_MAIN_VARIANT is set. Reuse tree from unqualified -- variant for that. Also cache the resulting qualified tree. -- (TypeTypedef::toCtype): Likewise. -- (TypeEnum::toCtype): Likewise. -- (TypeStruct::toCtype): Likewise. -- (TypeFunction::toCtype): Likewise. -- (TypeVector::toCtype): Likewise. -- (TypeSArray::toCtype): Likewise. -- (TypeDArray::toCtype): Likewise. -- (TypeAArray::toCtype): Likewise. -- (TypeDelegate::toCtype): Likewise. -- (TypeClass::toCtype): Likewise. -- * d-objfile.cc(ObjectFile::giveDeclUniqueName): Make sure DECL_NAME is set -- --2013-03-01 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-decls.cc(VarDeclaration::toSymbol): Remove use of c_ident. -+ * d-decls.cc(VarDeclaration::toSymbol): Give prettyIdent precedence -+ for the DECL_NAME over the simple identifier. - (FuncDeclaration::toSymbol): Likewise. -- * d-builtins.c(handle_noreturn_attribute): Assert that this is only -- used for internal purposes. -- (handle_const_attribute): Likewise. -- (handle_malloc_attribute): Likewise. -- (handle_pure_attribute): Likewise. -- (handle_nonnull_attribute): Likewise. -- (handle_nothrow_attribute): Likewise. -- (handle_sentinel_attribute): Likewise. -- (handle_transaction_pure_attribute): Likewise. -- (handle_returns_twice_attribute): Likewise. -- * d-glue.cc(FuncDeclaration::toObjFile): Result variables have no -- default initialiser. -- * d-codegen.cc(IRState::emitLocalVar): Add in assert that the local -- variable has no initialiser if called with no_init = true. -- (IRState::getLibCallDecl): Mark exceptional library functions as -- noreturn. -- (IRState::attributes): Gracefully handle @attribute, and -- @attribute(null). -- --2013-02-28 Jernej Krempus <jkrempus@gmail.com> -- -- * d-builtins.c(d_attribute_table): Renamed it to -- d_builtins_attribute_table. -- * d-lang.cc(d_attribute_table): Added an empty table -- * d-lang.cc(LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Defined it as -- d_builtins_attribute_table. -- * d-lang.h(d_builtins_attribute_table): Added a declaration. -- * d-codegen.cc(IRState::attributes): Changed it so it goes through -- in_attrs and looks for any @gcc.attribute.attribute("attr_name"). -- * d-objfile.cc(ObjectFile::setupSymbolStorage): Pass userAttributes -- instead of attributes in all calls to IRState::attributes. -- * d-ctype.cc(TypeTypedef::toCtype): Likewise. -- (TypeEnum::toCtype): Likewise. -- (TypeStruct::toCtype): Likewise. -- (TypeClass::toCtype): Likewise. -- * libphobos/libdruntime/gcc/attribute.d: New file. -- --2013-02-28 Iain Buclaw <ibuclaw@gdcproject.org> -+ * d-objfile.cc(d_finish_symbol): Remove setting DECL_NAME as -+ prettyIdent, this has already been done in Declaration::toSymbol. -+ (d_finish_function): Likewise. - -- * d-lang.cc(d_handle_option): Remove OPT_fdeprecated and -- OPT_Wsign_compare, add handling for OPT_Wdeprecated. -- (d_post_options): Handle Wdeprecated and Werror switch combination. -- --2013-02-27 Iain Buclaw <ibuclaw@gdcproject.org> -- -- * d-codegen.cc(ArrayScope::ArrayScope): Don't setup length var if its -- value is known at compile time. -- (ArrayScope::setArrayExp): Likewise. -- * d-decls.cc(uniqueName): Remove function. -- (VarDeclaration::toSymbol): Set decl assembler name directly. -+ * d-decls.cc(VarDeclaration::toSymbol): Call set_user_assembler_name -+ if pragma(mangle) was seen. - (FuncDeclaration::toSymbol): Likewise. - --2013-02-15 Iain Buclaw <ibuclaw@gdcproject.org> -+2014-02-12 Johannes Pfau <johannespfau@gmail.com> - -- * Make-lang.in(GDC_EXTENDED_ASM_SYNTAX): Remove macro. -+ * d-decls.cc(FuncDeclaration::toSymbol): Do not set TREE_NOTHROW on -+ nothrow functions. -+ * d-decls.cc(TypeInfoDeclaration::toSymbol): Call relayout_decl after -+ changing the type. - --2013-02-14 Iain Buclaw <ibuclaw@gdcproject.org> -+2014-02-03 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-lang.h(D_DECL_IS_CONTRACT): Remove macro. -- * d-decls.cc(FuncDeclaration::toSymbol): Likewise. - --2013-02-13 Iain Buclaw <ibuclaw@gdcproject.org> -+ * d-codegen.cc(d_build_call): Remove special handling of -+ flag_split_darrays switch. -+ (maybe_expand_builtin): Likewise. -+ * d-elem.cc(CatExp::toElem): Likewise. -+ * lang.opt(fsplit-dynamic-arrays): Remove. - -- * d-lang.cc(d_gcc_is_target_win32): Remove. -- (d_add_builtin_version): New function to handle define_builtin -- callback from backend. -- * d-codegen.cc(IRState::maybeExpandSpecialCall): Remove intrinsic bt. -+2014-02-02 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-builtins.c: Merge with d-builtins2.cc. -- * d-builtins2.cc: Remove. -+ * d-glue.cc(readFile, writeFile, ensurePathToNameExists): Define. -+ * d-incpath.cc(add_import_path): Update for frontend changes. -+ (add_fileimp_path): Likewise. -+ * d-lang.cc(deps_write): Likewise. -+ (d_parse_file): Likewise. -+ * d-todt.cc(Dts): Update define for frontend changes. -+ * d-decls.cc(ClassDeclaration::toVtblSymbol): Don't mark __vtbl -+ symbols as virtual. They are global static symbols. - --2013-02-07 Johannes Pfau <johannespfau@gmail.com> -+2014-01-12 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-lang.cc(d_init): Use gcc's config system for predefined OS versions. -- * setup-gcc.sh: Likewise. -- * target-ver-syms.sh: Likewise. -+ * d-decls.cc(EnumDeclaration::toDebug): Build TYPE_DECL only for -+ enumeral types. - --2013-02-05 Iain Buclaw <ibuclaw@ubuntu.com> -+2014-01-06 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-builtins2.cc(gcc_type_to_d_type): Remove STRUCTTHISREF condition. -- * d-decls.cc(FuncDeclaration::toSymbol): Likewise. -- * d-elem.cc(ThisExp::toElem): Likewise. -- * d-ctype.cc(TypeSArray::toCtype): Remove SARRAYVALUE condition. -- * d-codegen.cc(IRState::isDeclarationReferenceType): Likewise. -- (IRState::isArgumentReferenceType): Likewise. -+ * d-ctype.cc(TypeClass::toCtype): Don't add __monitor field for -+ extern(C++) classes. - --2013-02-01 Johannes Pfau <johannespfau@gmail.com> -+ * d-builtins.c(d_gcc_magic_module): Remove tdata. -+ * d-codegen.cc(build_interface_binfo): Likewise. -+ * d-ctype.cc(TypeEnum::toCtype): Likewise. -+ (TypeClass::toCtype): Likewise. -+ * d-lang.cc(deps_write): Likewise. -+ -+2014-01-05 Iain Buclaw <ibuclaw@gdcproject.org> - -- * d-lang.cc(d_init): Use gcc's config system for predefined CPU versions. -- (d_init): Fix definition of D_LP64 version. -- * setup-gcc.sh: Likewise. -- * target-ver-syms.sh: Likewise. -+ * d-ctype.cc(TypeEnum::toCtype): Don't push CONST_DECLs into current -+ function. -+ * d-decls.cc(FuncDeclaration::toThunkSymbol): Don't mark symbol as -+ TREE_PRIVATE, just TREE_PUBLIC as false. -+ (StructLiteralExp::toSymbol): Likewise. -+ (ClassReferenceExp::toSymbol): Likewise. -+ * d-objfile.cc(d_comdat_linkage): Likewise. -+ (d_finish_symbol): Likewise. -+ (build_moduleinfo): Likewise. -+ -+ * config-lang.in: Add d-lang.cc to gtfiles. -+ * d-irstate.h(IRState::varsInScope): Change from Array to vec<> type. -+ (IRState::statementList_): Likewise. -+ (IRState::scopes_): Likewise. -+ (IRState::loops_): Likewise. -+ (IRState::labels_): Likewise. -+ * d-lang.h(d_bi_builtin_func): Remove declaration. -+ (d_bi_builtin_type): Likewise. -+ (d_keep_list): Likewise. -+ * d-objfile.h(Symbol::thunks): Change from Array to vec<> type. -+ (ModuleInfo::classes): Likewise. -+ (ModuleInfo::ctors): Likewise. -+ (ModuleInfo::dtors): Likewise. -+ (ModuleInfo::ctorgates): Likewise. -+ (ModuleInfo::sharedctors): Likewise. -+ (ModuleInfo::shareddtors): Likewise. -+ (ModuleInfo::sharedctorgates): Likewise. -+ (ModuleInfo::unitTests): Likewise. -+ (build_simple_function): Remove declaration. -+ (build_call_function): Likewise. -+ (build_ctor_function): Likewise. -+ (build_dtor_function): Likewise. -+ (build_unittest_function): Likewise. -+ * d-builtins.c(bi_fn_list): Rename to gcc_builtins_functions. -+ (bi_lib_list): Rename to gcc_builtins_libfuncs. -+ (bi_type_list): Rename to gcc_builtins_types. -+ (builtin_converted_types): Remove. -+ (builtin_converted_decls): Change from Array to vec<> type. -+ (gcc_type_to_d_type): Update. -+ (d_bi_builtin_func): Remove and move to d_builtin_function. -+ (d_bi_builtin_type): Remove and move to d_register_builtin_type. -+ (d_gcc_magic_builtins_module): Update. -+ * d-ctype.cc(TypeClass::toCtype): Remove unused var. -+ * d-decls.cc(FuncDeclaration::toThunkSymbol): Update for change to -+ vec<> type. -+ * d-elem.cc(CatExp::toElem): Change stashed vars from Array to vec<>. -+ (Expression::toElemDtor): Update for change to vec<> type. -+ * d-irstate.cc(IRState::startFunction): Likewise. -+ (IRState::endFunction): Likewise. -+ (IRState::addExp): Likewise. -+ (IRState::pushStatementList): Likewise. -+ (IRState::popStatementList): Likewise. -+ (IRState::getLabelBlock): Likewise. -+ (IRState::getLoopForLabel): Likewise. -+ (IRState::beginFlow): Likewise. -+ (IRState::endFlow): Likewise. -+ (IRState::startScope): Likewise. -+ (IRState::pushLabel): Likewise. -+ (IRState::checkGoto): Likewise. -+ (IRState::checkPreviousGoto): Change from Array to Blocks type. -+ * d-lang.cc(global_declarations): Change from Array to vec<> type. -+ (d_add_global_declaration): Update for change to vec<> type. -+ (d_write_global_declarations): Likewise. -+ (d_keep_list): Make static to source file. -+ * d-objfile.cc(static_ctor_list): Change from Array to vec<> type. -+ (static_dtor_list): Likewise. -+ (Module::genobjfile): Update for change to vec<> type. -+ (d_finish_module): Likewise. -+ (d_finish_function): Likewise. -+ (deferred_thunks): Change from ArrayBase<> to vec<> type. -+ (write_deferred_thunks): Update for change to vec<> type. -+ (use_thunk): Likewise. -+ (build_simple_function): Make static to source file. -+ (build_call_function): Likewise. -+ (build_ctor_function): Likewise. -+ (build_dtor_function): Likewise. -+ (build_unittest_function): Likewise. -+ -+2014-01-02 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(setup_symbol_storage): Use output_module_p on template -+ instantiating module to determine if symbol is externally compiled. -+ (d_finish_function): Set function local if function body was compiled. -+ * d-decls.cc(Dsymbol::toSymbolX): Use unsigned integer format for the -+ prefix string length. - ---- a/src/gcc/d/ChangeLog-2013 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/ChangeLog-2013 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,1215 @@ -+2013-12-27 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(build_two_field_type): Declare builtin types as -+ toplevel declarations. -+ * d-ctype(EnumDeclaration::toDebug): Build type decl in debug code. -+ * d-lang.cc(nametype): Rename to d_nametype. -+ -+2013-12-23 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(EnumDeclaration::toDebug): Don't send array types to -+ rest_of_type_compilation. -+ -+2013-12-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-spec.cc(lang_specific_driver): Require linking in library for all -+ files except D interface files. -+ * d-lang.cc(d_write_global_declarations): Call d_finish_compilation. -+ * d-objfile.cc(mark_needed): Mark static. -+ (d_finish_symbol): Don't call mark_needed. -+ (d_finish_function): Likewise. -+ (d_finish_compilation): New function to wrapup all global -+ declarations, mark templates/comdats as needed if required, and start -+ the final compilation. -+ -+2013-12-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-ctype.cc(TypeVector::toCtype): Treat void vectors as ubyte. -+ * d-objfile.cc(VarDeclaration::toObjFile): Gag all errors compiling -+ manifest constants. -+ * d-todt.cc(TypeVector::toDt): New function to generate correct static -+ data for vector initialisers. -+ -+2013-12-05 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_init_options_struct): Don't define strict aliasing. -+ (d_get_alias_set): New function to return language-specific alias set. -+ * d-convert.cc(d_convert_basic): Always zero extend pointer to integer -+ conversions. -+ -+2013-12-04 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(maybe_set_builtin_frontend): Assert that all runtime -+ library functions have been set-up correctly. -+ (libcall_ids): Remove unhandled library functions. -+ (get_libcall): Likewise. -+ * d-codegen.h(LibCall): Likewise. -+ * d-objfile.cc(output_symbol_p): Remove. -+ -+2013-12-03 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_init_options): Update for frontend changes. -+ (d_handle_option): Set frontend allInst option if -femit-templates. -+ * d-objfile.cc(output_template_p): Want to emit all instantiated -+ templates if -femit-templates or -fdebug was passed to the compiler. -+ * d-objfile.h(TemplateEmission): Define TEallinst. -+ * d-todt.cc(StructDeclaration::toDt): Update for frontend changes. -+ * d-spec.cc(THREAD_LIBRARY): Define default thread library to link if -+ one is not already specified in the configuration process. -+ (TIME_LIBRARY): Define default real time library to link if one is not -+ already specified in the configuration process. -+ (LIBSTDCXX): Define C++ library to link if compiling C++ and D sources. -+ (lang_specific_driver): Update implementation to use new macros. -+ -+2013-12-02 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(CatAssignExp::toElem): Don't call postblit after element -+ append to array. -+ (NewExp::toElem): Handle calling 'new' on opaque types. -+ (ArrayLiteralExp::toElem): Ensure array literal elements have no side -+ effects by making temporaries as necessary. -+ * d-todt.cc(StructLiteralExp::toDt): Update for frontend changes. -+ * d-codegen.cc(build_frame_type): Check for scoped variables if -+ building a closure. -+ * d-objfile.cc(d_finish_symbol): Relax toDt checking rule. -+ -+2013-12-01 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-asmstmt.cc(ExtAsmStatement::ExtAsmStatement): Remove labels -+ member from class. -+ * d-codegen.cc(d_gcc_force_templates): Remove. -+ (convert_expr): Update for frontend changes. -+ (convert_for_assignment): Likewise. -+ (maybe_set_builtin_frontend): Update for changes to libdruntime -+ core.bitops signatures. -+ * d-ctype.cc(TypeFunction::toCtype): Update for frontend changes. -+ * d-decls.cc(Dsymbol::toSymbolX): Likewise. -+ (VarDeclaration::toSymbol): Likewise. -+ (FuncDeclaration::toSymbol): Don't defer nested functions here. -+ * d-elem.cc(PowAssignExp::toElem): Update for frontend changes. -+ (DeleteExp::toElem): Likewise. -+ (AssertExp::toElem): Don't call invariant on an extern C++ class. -+ * d-glue.cc(Global::init): Initialise new stdmsg member. -+ * d-lang.cc(d_handle_option): Handle -fdeps switch. Remove TEprivate -+ for -femit-templates switch. -+ (genCmain): Update for frontend changes. -+ (d_parse_file): Likewise. -+ * d-longdouble.cc(longdouble::dump): Likewise. -+ * d-objfile.cc(ClassDeclaration::toObjFile): Update for frontend -+ changes. -+ (InterfaceDeclaration::toObjFile): Likewise. -+ (EnumDeclaration::toObjFile): Likewise. -+ (Symbol::Symbol): Remove outputSymbol member. -+ (output_symbol_p): Mark static. -+ (output_declaration_p): Determine symbol codegen status from -+ semanticRun. -+ (output_template_p): New function to determine whether an instantiated -+ template is to be written to object file. -+ (FuncDeclaration::toObjFile): Use semanticRun to update codegen status -+ of function. -+ (FuncDeclaration::buildClosure): Error if putting a scoped variable in -+ a closure. -+ (Module::genobjfile): Update for frontend changes. -+ (d_comdat_linkage): Don't determine linkage from TE setting. Mark all -+ comdat symbols as DECL_COMDAT. -+ (setup_symbol_storage): Use output_template_p to determine whether the -+ symbol is being written to object file. -+ (mark_needed): New function to mark decls that must be emitted. -+ (d_finish_symbol): Mark finished symbols as needed. -+ (d_finish_function): Mark finished functions as needed. -+ (build_simple_function): Set semanticRun for glue changes. -+ * d-objfile.h(OutputStage): Remove enum. -+ * d-todt.cc(build_vptr_monitor): Update for frontend changes. -+ (StructInitializer::toDt): Likewise. -+ (StructDeclaration::toDt): Likewise. -+ (TypeInfoEnumDeclaration::toDt): Likewise. -+ (TypeInfoStructDeclaration::toDt): Likewise. -+ (Type::getTypeInfo): Likewise. -+ -+2013-11-30 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(genCmain): Implement code generation of __entrypoint -+ module to provide the target C main function. -+ (deps_write): Ignore the module __entrypoint when writing make deps. -+ (d_parse_file): Handle writing __entrypoint module to object file. -+ * d-objfile.cc(d_finish_symbol): Remove special handling of _tlsstart -+ symbol, but ensure _tlsend gets written to the thread common section. -+ (d_finish_function): Remove call to build_tlssections. -+ (build_tlssections): Remove. -+ -+2013-11-29 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(ClassDeclaration::toVtblSymbol): Use TypeSArray::makeType -+ to generate frontend static array type. -+ * d-glue.cc(Dsymbol::ungagSpeculative): Define. -+ * d-lang.cc(genCmain): Define as empty. -+ (d_parse_file): Update for frontend changes. -+ * d-objfile.cc(StructDeclaration::toObjFile): Likewise. -+ * d-typinf.cc(TypeBasic::builtinTypeInfo): Likewise. -+ * d-longdouble.cc(longdouble::isIdenticalTo): Remove. -+ * d-port.cc(Port::fequal): Define. -+ -+2013-11-28 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.cc(gcc_type_to_d_type): Use TypeSArray::makeType to -+ generate frontend static array types. -+ * d-codegen.cc(build_attributes): Use optimize as don't want the -+ ctfeInterpret of TypeExp expressions. -+ (get_object_method): Update for frontend changes. -+ (get_libcall): Update to use Type::dtypeinfo. -+ * d-elem.cc(IndexExp::toElem): Don't generate bounds checking codegen -+ if frontend explictly requests it. -+ (ArrayLiteralExp::toElem): Use TypeSArray::makeType to generate -+ frontend static array type. -+ (StructLiteralExp::toElem): Update for frontend changes. -+ * d-glue.cc(Global::increaseErrorCount): Define. -+ * d-objfile.cc(Module::genmoduleinfo): Remove moduleinfo 'New' -+ implementation for libdruntime changes. -+ * d-todt.cc(StructLiteralExp::toDt): Literal initialisers override -+ default initialisers. -+ (TypeInfoDeclaration::toDt): Update to use Type::dtypeinfo. -+ (TypeInfoStructDeclaration::toDt): Update for frontend changes. -+ * d-typinf.c(Type::getInternalTypeInfo): Update to use -+ Type::dtypeinfo. -+ -+2013-11-25 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-asmstmt.cc(ExtAsmStatement::comeFromImpl): Define for frontend -+ implementation changes. -+ * d-codegen.cc(get_libcall): Update to use Type::typeinfoclass. -+ * d-codegen.cc(WrappedExp): Define as class. -+ * d-convert.cc(d_convert_basic): Fix format warnings. -+ * d-decls.cc(ModuleInfoDeclaration::toSymbol): Remove. -+ (FuncDeclaration::toSymbol): Use mangleExact to get decl mangle. -+ * d-elem.cc(ClassReferenceExp::toElem): Return reference to class. -+ * d-glue.cc(verror): Fix format warnings. -+ (verrorSupplemental): Likewise. -+ (vwarning): Likewise. -+ (vdeprecation): Likewise. -+ (escapePath): Define for frontend implementation changes. -+ * d-irstate.cc(IRState::getLoopForLabel): Implement breaking on named -+ scope labels in for/while loops. -+ * d-lang.cc(d_handle_option): Add handler for new -fdeps and -+ -fmake-deps options. -+ (d_parse_file): Handle new -fdeps and fmake-deps options. -+ * d-objfile.cc(Dsymbol::toObjFile): Update to use RootObject. -+ (Type::typeinfoclass): Update to use Type::typeinfoclass. -+ (InterfaceDeclaration::toObjFile): Likewise. -+ * d-objfile.h(Symbol): Remove inheritance from Object. -+ * d-todt.cc(TypeInfoStructDeclaration::toDt): Update to use -+ Type::immutableOf. -+ -+2013-11-24 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(gcc_type_to_d_type): Use TREE_INT_CST_LOW macro instead -+ of tree_low_cst. -+ (eval_builtin): Likewise. -+ (gcc_cst_to_d_expr): Use tree_cst_hwi. -+ * d-codegen.cc(tree_to_hwi): Remove call to deleted host_integerp. -+ (maybe_expand_builtin): Use TREE_INT_CST_LOW macro. -+ * d-lang.cc(d_parse_file): Update debug_hooks call for middle-end -+ changes. -+ * d-system.h: Update includes for middle-end changes. -+ -+2013-11-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(finish_thunk): Update for conversion of symtab types to -+ a true class hierarchy. -+ -+ * d-ctype.cc(TypeClass::toCtype): Fix ABI to emit correct vtable and -+ monitor field names. -+ -+ * d-ctype.cc(TypeClass:toCtype): Set TYPE_LANG_SPECIFIC on record as -+ well as reference type. -+ * d-lang.cc(d_classify_record): New langhook to return appropriate -+ class/interface/struct type to the debugger. -+ -+2013-10-27 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(ArrayLiteralExp::toElem): Build empty constructor for zero -+ sized arrays. -+ -+2013-10-23 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(AssignExp::toElem): Optimise assigning array literal to a -+ static array. -+ (ArrayLiteralExp::toElem): Do not allocate static or const array -+ literals on the heap using the GC. -+ -+2013-10-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(DEF_FUNCTION_TYPE_8): Define. -+ -+2013-10-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(gcc_cst_to_d_expr): Add support for VECTOR_CST to -+ Expression conversion. -+ (d_gcc_paint_type): Add support for painting to/from array literals. -+ -+2013-10-01 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(cvtLocToloc_t): Rename to get_linemap. -+ * d-glue.cc: New source to provide interface for defined globals and -+ error handling called from the front-end. -+ -+2013-09-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::call): Rename to d_build_call. -+ (IRState::emitLocalVar): Rename to build_local_var. -+ (IRState::buildAssignOp): Move to BinExp::toElemBin. -+ (IRState::IRState): Remove IRState class. -+ * d-irstate.cc(IRBase::IRBase): Rename to IRState, remove inheritance -+ from Object class. -+ * d-decls.cc(VarDeclaration::toSymbol): Remove redundant CONST_DECL -+ code as VarDeclaration::toObjFile does not emit manifest constants. -+ * d-ctype.cc(TypeEnum::toCtype): Generate CONST_DECLs for enumeration -+ members for correct debugging. -+ * d-objfile.cc(build_type_decl): Use fully qualified type name in -+ debugging code. -+ (VarDeclaration::toObjFile): Emit manifest constant values in debug -+ code generation. -+ -+2013-09-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(SliceExp::toElem): Don't build D array for slices that -+ return a static array. -+ -+2013-09-03 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::buildOp): Rename to build_binary_op. -+ -+2013-09-01 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(binfo_for): Rename to build_class_binfo. -+ (intfc_binfo_for): Rename to build_interface_binfo. -+ (ClassDeclaration::toDebug): Move binfo generation into toCtype. -+ * d-lang.cc(pushlevel): Rename to push_binding_level. -+ (poplevel): Rename to pop_binding_level. -+ (global_bindings_p): Rename to d_global_bindings_p, add langhook. -+ (pushdecl): Rename to d_pushdecl, add langhook. -+ (getdecls): Rename to d_getdecls, add langhook. -+ (set_block): Remove function. -+ (insert_block): Remove function. -+ * d-irstate.cc(IRBase::startBindings): Inline set_block here. -+ (IRBase::endBindings): Inline insert_block here. -+ -+2013-08-29 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-spec.c (lang_specific_spec_functions): Remove. -+ -+2013-08-28 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::doArraySet): Rename to IRBase::doArraySet. -+ (IRState::arraySetExpr): Remove function. -+ (IRState::expandDecl): Rename to expand_decl. -+ (IRState::typeinfoReference): Rename to build_typeinfo. -+ (IRState::buildChain): Merge into FuncDeclaration::buildClosure. -+ (IRState::getVThis): Rename to build_vthis. -+ (IRState::maybeExpandSpecialCall): Rename to maybe_expand_builtin. -+ (IRState::toDArray): Rename to d_array_convert. -+ -+2013-08-26 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(convert_expr): Check that the class type the codegen is -+ casting from is a base class of the class type the codegen is casting -+ to, not the other way round. -+ -+2013-08-14 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(ArrayLiteralExp::toElem): Return null for zero length -+ array literals. -+ -+2013-08-07 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(finish_thunk): Don't emit thunks to external symbols as -+ weakref declarations. -+ * d-codegen.cc(IRState::maybeExpandSpecialCall): Remove intrinsic yl2x -+ and yl2xp1 builtins. -+ (maybe_set_builtin_frontend): Likewise. -+ -+2013-07-09 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(d_gcc_magic_builtins_module): Set builtins solely -+ provided by the compiler as @safe, pure and nothrow. -+ * d-codegen.cc(IRState::getVThis): Don't set outer 'this' of structs -+ to be parent function chain if no frame has been created. -+ -+2013-07-08 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(Expression::toElemDtor): Wrap temp variables destructor -+ calls in a try/finally expression. -+ -+2013-07-05 Johannes Pfau <johannespfau@gmail.com> -+ -+ * patch-versym-os-4.8.x: Set versions on powerpc and alpha. -+ Remove SysV4 support and therefore fix macro redefinition warnings. -+ * patch-versym-os-4.9.x: Likewise. -+ -+2013-07-03 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-longdouble.cc(longdouble::set): Intepret set values at higher -+ precision for min/max properties. -+ * d-codegen.cc(maybe_set_builtin_frontend): Add yl2x and yl2xp1 -+ math intrinsics. -+ (IRState::maybeExpandSpecialCall): Likewise. -+ -+2013-07-02 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(Module::genobjfile): Don't free current_module_info. -+ * d-codegen.cc(IRState::buildAssignOp): Don't create a SAVE_EXPR -+ around comma expressions used as lvalues. -+ * d-todt.cc(TypeSArray::toDtElem): Get underlying vector basetype when -+ layouting out data in a static array. -+ -+2013-06-29 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * complex_t.h: Move into dfrontend. -+ * d-builtins.c(gcc_cst_to_d_expr): Explicitly create longdouble. -+ * d-longdouble.cc(longdouble::parse): Remove function. -+ (longdouble::longdouble): Remove constructors from longdouble. -+ Replaced with operator= template and longdouble::set. -+ (longdouble::rv): Update for new class layout. -+ (longdouble::from_shwi): New function to create a longdouble value -+ from a HOST_WIDE_INT. -+ (longdouble::from_uhwi): Likewise, but from an unsigned HOST_WIDE_INT. -+ (longdouble::to_shwi): New function to return a HOST_WIDE_INT value -+ from a longdouble. -+ (longdouble::to_uhwi): Likewise, but from an unsigedn HOST_WIDE_INT. -+ (longdouble::set): New function to explicitly set longdouble value. -+ (longdouble::toInt): Remove function. -+ (longdouble::isZero): Remove function. -+ (longdouble::isNegative): Remove function. -+ * d-port.cc(Port::nan): Rename to Port::ldbl_nan. -+ (Port::infinity): Rename to Port::ldbl_infinity. -+ (Port::ldbl_max): New static field. -+ (Port::init): Set ldbl_max to be maximimum value for long double type. -+ (Port::strtof): New function to convert string to longdouble. -+ (Port::strtod): Likewise. -+ (Port::strtold): Likewise. -+ -+2013-06-24 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(make_alias_for_thunk): Do not set -+ TREE_SYMBOL_REFERENCED. -+ -+2013-06-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(build_struct_memcmp): New function. -+ * d-elem.cc(IdentityExp::toElem): Use build_struct_memcmp for field -+ comparisons of small structs. -+ -+2013-06-13 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(make_temp): New function. -+ * d-decls.cc(StructLiteralExp::toSymbol): Implement correctly to -+ generate an anonymous symbol to reference to in the codegen. -+ (ClassReferenceExp::toSymbol): Likewise, but also use an anonymous -+ type as size is not determined until the data has been layed out. -+ * d-elem.cc(EqualExp::toElem): Optimise comparisons of arrays of basic -+ types, also ensure left-to-right evaluation. -+ (SliceExp::toElem): Handle returing slice as a static array type. -+ (AddrExp::toElem): Handle taking the address of StructLiteralExp and -+ ClassReferenceExp symbols. -+ (FuncExp::toElem): Relax type checking to allow returning function -+ addresses as generic pointer types. -+ (ArrayLiteralExp::toElem): Implicitly convert static arrays of void to -+ static arrays of ubyte. -+ (StructLiteralExp::toElem): Remove code generation of postblit calls, -+ now taken care of in the front end. -+ * d-objfile.cc(Module::genmoduleinfo): Emit module name as a null -+ terminated static array. -+ * d-ctype.cc(TypeAArray::toCtype): Pass AA types around like pointers. -+ -+2013-06-11 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * dfrontend: Update to D front-end version 2.063. -+ -+ * d-builtins.c(gcc_type_to_d_type): Use Loc for unknown locations. -+ (d_gcc_magic_builtins_module): Likewise. -+ (gcc_cst_to_d_expr): Likewise. -+ * d-codegen.cc(get_libcall): Use FuncDeclaration::genCfunc to build -+ D runtime library functions. -+ * d-decl.cc(SymbolDeclaration::SymbolDeclaration): Remove function. -+ (StructLiteralExp::toSymbol): New function. -+ (ClassReferenceExp::toSymbol): New function. -+ * d-elem.cc(AssertExp::toElem): Call struct/class invariants only if -+ compiler is generating invariant code. -+ (TupleExp::toElem): Update for new front-end. -+ (ClassReferenceExp::toElem): New function. -+ * d-lang.cc(d_init_options): Set compiler.vendor front-end parameter. -+ (d_init): Call Expression::init. -+ * d-objfile.cc(InterfaceDeclaration::toObjFile): Correctly set the -+ xgetRTInfo field in the record layout. -+ * d-todt.cc(CastExp::toDt): New function. -+ (AddrExp::toDt): New function. -+ (ClassReferenceExp::toDt): New function. -+ (ClassReferenceExp::toDtI): New function. -+ (ClassReferenceExp::toInstanceDt): New function. -+ (ClassReferenceExp::toDt2): New function. -+ -+2013-06-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-objfile.cc(FuncDeclaration::toObjFile): Set 'this' parameter as -+ implicitly read-only. -+ * d-codegen.cc(declaration_type): Set 'this' declaration type as -+ implicitly const. -+ (build_frame_type): Set frame or closure type as implicitly const. -+ -+2013-06-09 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(d_init_builtins): Make d_unknown_type_node a -+ RECORD_TYPE. -+ * d-lang.cc(d_build_eh_type_type): Cast the returned typeinfo decl to -+ void pointer type. -+ -+2013-06-07 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::var): Rename to get_decl_tree. -+ (IRState::convertForArgument): Rename to convert_for_argument. -+ (IRState::floatMod): Rename to build_float_modulus. -+ (IRState::findThis): Rename to find_this_tree. -+ (IRState::emitLocalVar): Update signature. -+ (IRState::arrayElemRef): Remove function. -+ * d-elem.cc(IndexExp::toElem): Move implementation of -+ IRState::arrayElemRef here. -+ -+2013-06-04 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(cmodule): Rename to current_module_decl. -+ (object_file): Remove variable. -+ * d-objfile.cc(ObjectFile::moduleInfo): Rename to current_module_info. -+ (ObjectFile::modules): Rename to output_modules. -+ (ObjectFile::staticCtorList): Rename to static_ctor_list. -+ (ObjectFile::staticDtorList): Rename to static_dtor_list. -+ (ObjectFile::emitTemplates): Rename to flag_emit_templates. -+ (ObjectFile::beginModule): Remove function. -+ (ObjectFile::endModule): Remove function. -+ (ObjectFile::finish): Rename to d_finish_module. -+ (ObjectFile::doLineNote): Remove function. -+ (ObjectFile::setLoc): Rename to set_input_location. -+ (ObjectFile::setDeclLoc): Rename to set_decl_location. -+ (ObjectFile::setCfunEndLoc): Rename to set_function_end_locus. -+ (ObjectFile::giveDeclUniqueName): Rename to get_unique_name. -+ (ObjectFile::setupSymbolStorage): Rename to setup_symbol_storage. -+ (ObjectFile::setupStaticStorage): Remove function. -+ (ObjectFile::makeDeclOneOnly): Rename to d_comdat_linkage. -+ (ObjectFile::outputStaticSymbol): Rename to d_finish_symbol. -+ (ObjectFile::outputFunction): Rename to d_finish_function. -+ (ObjectFile::addAggMethod): Remove function. -+ (ObjectFile::initTypeDecl): Rename to build_type_decl. -+ (ObjectFile::declareType): Remove function. -+ (ObjectFile::shouldEmit): Rename to output_declaration_p. -+ (ObjectFile::shouldEmit): Rename variant to output_symbol_p. -+ (ObjectFile::doThunk): Rename to use_thunk. -+ (ObjectFile::stripVarDecl): Remove function. -+ (ObjectFile::doSimpleFunction): Rename to build_simple_function. -+ (ObjectFile::doFunctionToCallFunctions): Rename to -+ build_call_function. -+ (ObjectFile::doCtorFunction): Rename to build_ctor_function. -+ (ObjectFile::doDtorFunction): Rename to build_dtor_function. -+ (ObjectFile::doUnittestFunction): Rename to build_unittest_function. -+ (ObjectFile::hasModule): Rename to output_module_p. -+ (ObjectFile::outputThunk): Rename to finish_thunk. -+ (write_deferred_thunks): New function to emit deferred thunks. -+ -+2013-06-03 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(VarDeclaration::toSymbol): Don't set default tls model. -+ * d-objfile.cc(ObjectFile::setupSymbolStorage): Set default tls -+ model for var decls before determining whether symbol is public. -+ (build_tlssections): Likewise for TLS symbols. -+ -+2013-06-01 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-codegen.cc(maybe_set_builtin_frontend): Check parameter and -+ return types of intrinsics. -+ -+2013-06-01 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::var): Handle variables used for NRVO. -+ * d-ir.cc(ReturnStatement::toIR): Return result decl directly if NRVO. -+ * d-objfile.cc(Symbol::SnamedResult): New member to hold the named -+ RESULT_DECL of the function. -+ (FuncDeclaration::toObjFile): Set-up function for NRVO. -+ (build_tlssections): Align _tlsstart and _tlsend symbols to target -+ address size. -+ * d-ctype(TypeFunction::toSymbol): Mark functions returning non-POD -+ structs as TREE_ADDRESSABLE to force return in memory. -+ * d-decls.cc(FuncDeclaration::toSymbol): Propagate TREE_ADDRESSABLE -+ from the original function type. -+ -+2013-05-29 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-target.cc: New source file to handle Target structure. -+ -+ * d-builtins.c(d_bi_init): Remove function. -+ (d_gcc_type_align): Move to Target::alignsize. -+ (d_gcc_field_align): Move to Target::fieldalign. -+ (d_init_builtins): Build va_list type for D frontend. -+ * d-lang.cc(d_init): Use isLP64 to determine LP64 targets. -+ (d_add_builtin_version): Set is64bit if target is X86_64. -+ * d-codegen.cc(convert_for_assignment): Use memset to implement front -+ end code (struct = 0) here, rather than build an empty constructor. -+ * d-elem.cc(AssignExp::toElem): Remove handling of (struct = 0) and -+ call convert_for_assignment. -+ -+2013-05-28 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-gcc-complex_t.h: Rename to complex_t.h. -+ * d-gcc-real.cc: Rename to d-longdouble.cc. -+ * d-gcc-real.h: Rename to longdouble.h -+ * d-port.cc: New source file to handle Port structure. -+ * gdc_alloca.h: Remove source. -+ -+ * d-longdouble.cc(real_t): Rename to longdouble. -+ (longdouble::getnan): Move to Port::nan. -+ (longdouble::getsnan): Move to Port::snan. -+ (longdouble::getinfinity): Move to Port::infinity. -+ (longdouble::isInf): Move to Port::isInfinite. -+ (longdouble::isNan): Move to Port::isNan. -+ (longdouble::isSignallingNan): Move to Port::isSignallingNan. -+ * d-builtins.c(gcc_d_backend_init): Rename to d_backend_init. -+ (gcc_d_backend_term): Rename to d_backend_term. -+ (gcc_type_to_d_type): Don't map 128bit integers to D front end. -+ -+ * d-elem.cc(AssignExp::toElem): Remove handling of fillHoles, use -+ memset to implement (struct = 0). -+ (StructLiteralExp::toElem): Handle fillHoles here, creating a -+ temporary var that is zero init'd with memset and returned. -+ -+2013-05-27 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::localVar): Rename to build_local_var. -+ (IRState::exprVar): Rename to create_temporary_var. -+ (IRState::maybeExprvar): Rename to maybe_temporary_var. -+ (IRState::pointerIntSum): Rename to build_array_index. -+ * d-lang.cc(d_handle_target_attribute): New function to handle D -+ target attributes. -+ -+2013-05-26 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-incpath.cc(prefixed_path): Add cpp_GCC_INCLUDE_DIR back in as -+ second method for relocation. -+ * d-elem.cc(IndexExp::toElem): Fix call to _aaGetX as from -+ IRState::toElemLvalue. -+ * d-codegen.cc(IRState::toElemLvalue): Remove function. -+ (IRState::convertForAssignment): Rename to convert_for_assignment. -+ (IRState::convertForCondition): Rename to convert_for_condition. -+ (IRState::checkedIndex): Rename to d_checked_index. -+ (IRState::boundsCond): Rename to d_bounds_condition. -+ (IRState::arrayBoundsCheck): Rename to array_bounds_check. -+ (IRState::assertCall): Rename to d_assert_call. -+ (IRState::doLineNote): Move to irstate.h. -+ * d-irstate.cc(IRBase::getLocalContext): Remove function. -+ * d-decls.cc(VarDeclaration::toSymbol): Build decl lang specific for -+ decl to point back to D front end type. -+ (FuncDeclaration::toSymbol): Likewise. -+ -+2013-05-23 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(AggLayout::finish): Unset TYPE_SIZE before -+ re-calculating. -+ * d-ctype.cc(TypeStruct::toCtype): Don't call decl_attribute on the -+ type twice. -+ -+2013-05-21 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_gcc_dump_source): Remove function. -+ (d_post_options): Set flag_excess_precision_cmd as standard. -+ * d-gcc-real.cc(real_t::convert): Remove function. -+ (real_t::floatCompare): Remove function. -+ (real_t::operator): Always perform floating point compilation at the -+ precision of the target real mode. -+ * d-todt.cc(dt_last): Remove function. -+ (dtlist_to_tree): Rename to dtvector_to_tree. -+ (dt_cons): Replace TREE_CHAIN implementation for use of CONSTRUCTOR. -+ (dt_chainon): Likewise. -+ (dt_container): Likewise. -+ (dt_container2): Likewise. -+ (StructInitializer::toDt): Likewise. -+ (StructLiteralExp::toDt): Likewise. -+ -+2013-05-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::convertTo): Replace with d_convert and -+ convert_expr. -+ (IRState::declContext): Replace with d_decl_context. -+ (IRState::functionNeedsChain): Replace with needs_static_chain. -+ (IRState::label): Replace with d_build_label. -+ (IRState::emitTemplates): Move to ObjectFile. -+ (functionDegenerateClosure): Replace with is_degenerate_closure. -+ (get_object_method): Assert that function is a method. -+ (IRState::startCond): Move to IRBase. -+ (IRState::startElse): Likewise. -+ (IRState::endCond): Likewise. -+ (IRState::startLoop): Likewise. -+ (IRState::continueHere): Likewise. -+ (IRState::setContinueLabel): Likewise. -+ (IRState::exitIfFalse): Likewise. -+ (IRState::endLoop): Likewise. -+ (IRState::startCase): Likewise. -+ (IRState::doCase): Likewise. -+ (IRState::endCase): Likewise. -+ (IRState::continueLoop): Likewise. -+ (IRState::exitLoop): Likewise. -+ (IRState::startTry): Likewise. -+ (IRState::startCatches): Likewise. -+ (IRState::startCatch): Likewise. -+ (IRState::endCatch): Likewise. -+ (IRState::endCatches): Likewise. -+ (IRState::startFinally): Likewise. -+ (IRState::endFinally): Likewise. -+ (IRState::doReturn): Likewise. -+ (IRState::doJump): Likewise. -+ (IRState::pushLabel): Likewise. -+ (IRState::checkSwitchCase): Likewise. -+ (IRState::checkGoto): Likewise. -+ (IRState::checkPreviousGoto): Likewise. -+ -+ * d-elem.cc(CatAssignExp::toElem): Call postblit on appending array of -+ structs if required. -+ -+2013-05-16 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-incpath.cc(prefixed_path): use cpp_PREFIX instead of -+ cpp_GCC_INCLUDE_DIR for relocation. -+ -+2013-05-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::convertForAssignment): Remove use of -+ CtorEltMaker wrapper for vec<constructor_elt, va_gc>. -+ (d_array_value): Likewise. -+ (build_delegate_cst): Likewise. -+ (extract_from_method_call): Likewise. -+ * d-elem.cc(NewExp::toElem): Likewise. -+ (ArrayLiteralExp::toElem): Likewise. -+ (AssocArrayLiteralExp::toElem): Likewise. -+ (StructLiteralExp::toElem): Likewise. -+ (NullExp::toElem): Likewise. -+ (VectorExp::toElem): Likewise. -+ * d-objfile.cc(build_moduleinfo): Likewise. -+ * d-todt.cc(dt_container): Likewise. -+ (dt_container2): Likewise. -+ -+ * d-asmstmt.cc(ExtAsmStatement::toIR): Remove use of ListMaker -+ wrapper for tree chaining. -+ * d-builtins.c(d_bi_builtin_func): Likewise. -+ (d_bi_builtin_type): Likewise. -+ (d_gcc_magic_builtins_module): Likewise. -+ (d_gcc_magic_libbuiltins_module): Likewise. -+ * d-codegen.cc(build_attributes): Likewise. -+ (IRState::call): Likewise. -+ (IRState::buildFrameForFunction): Likewise. -+ (AggLayout::doFields): Likewise. -+ (AggLayout::addField): Likewise. -+ * d-ctype.cc(TypeEnum::toCtype): Likewise. -+ (TypeFunction::toCtype): Likewise. -+ * d-todt.cc(dt_container2): Likewise. -+ -+ * d-codegen.cc(IRState::getFrameInfo): Replace with get_frameinfo. -+ (IRState::buildFrameForFunction): Replace with build_frame_type. -+ (IRState::isClassNestedInFunction): Replace with d_nested_class. -+ (IRState::isStructNestedInFunction): Replace with d_nested_struct. -+ (IRState::getFrameForFunction): Fold into IRState::getFrameForSymbol. -+ (IRState::getFrameForNestedClass): Likewise. -+ (IRState::getFrameForNestedStruct): Likewise. -+ -+2013-05-15 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::buildFrameForFunction): Also copy the -+ parameters of functions with 'in' contracts to a local frame decl. -+ * d-lang.cc(d_handle_flatten_attribute): New function to handle D -+ flatten attributes. -+ -+2013-05-14 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::chainLink): Remove function. -+ (IRState::chainFunc): Remove function. -+ (IRState::sthis): New member which holds the chain of function. -+ (IRState::buildChain): Update to use new static chain decl. -+ (IRState::getFrameInfo): Likewise. -+ * d-objfile.cc(FuncDeclaration::buildClosure): Likewise. -+ (FuncDeclaration::toObjFile): Default the function static chain decl -+ to null unless vthis is given for the function. -+ -+2013-05-13 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_handle_noinline_attribute): New function to handle D -+ noinline attributes. -+ (d_handle_forceinline_attribute): New function to handle D forceinline -+ attributes. -+ * d-elem.cc(StructLiteralExp::toElem): Return the struct initialiser -+ symbol directly if the tree has already been built. -+ * d-decls.cc(Dsymbol::toSymbolX): Constify the mangling name to use. -+ -+2013-05-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-typinf.cc: New file containing type info routines originally in -+ the D Front End. -+ -+ * d-todt.cc(dt_last): New helper function to retrieve last node in a -+ dt_t tree list. -+ (dt_cons): New helper function to append nodes to the end of a list. -+ (dt_chainon): New helper function to concatenate two lists together. -+ (dt_container): New helper function to build a ctor from a list. -+ (build_vptr_monitor): New helper function to generate the class -+ vtable, and put out __vptr and __monitor. -+ symbol default values in a class declaration. -+ (dtlist_to_tree): New helper function to convert a dt_t list into a -+ constructor tree. -+ (Type::toDt): Implement routines for new dt_t format. -+ (TypeInfoDeclaration::toDt): Likewise. -+ (Initializer::toDt): Likewise. -+ (Expression::toDt): Likewise. -+ (Declaration::toDt): Likewise. -+ -+ * d-objfile.cc(Dsymbol::toObjFile): Update for new dt_t format. -+ (Module::genmoduleinfo): Likewise. -+ (Symbol::Symbol): Moved from symbol.cc -+ (Obj::objmod): Remove abstraction layer. -+ (Obj::moduleinfo): Renamed to build_moduleinfo. -+ (obj_tlssections): Renamed to build_tlssections. -+ (outdata): Renamed to d_finish_symbol. -+ (check_static_sym): Moved into d_finish_symbol. -+ -+ * d-codegen.cc(d_gcc_emit_local_variable): Remove. -+ -+ * d-decls.cc(Dsymbol::toSymbolX): Update to not call symbol_calloc. -+ (FuncDeclaration::toThunkSymbol): Likewise. -+ (ClassDeclaration::toSymbol): Build type as d_unknown_type_node. -+ (InterfaceDeclaration::toSymbol): Likewise. -+ (Module::toSymbol): Likewise. -+ (ClassDeclaration::toVtblSymbol): Update call to toSymbolX. -+ (AggregateDeclaration::toInitializer): Likewise. -+ (TypedefDeclaration::toInitializer): Likewise. -+ (EnumDeclaration::toInitializer): Likewise. -+ -+ * d-ir.cc(CaseStatement::toIR): Don't call static_sym. -+ -+ * d-lang.cc(rtlsym): Remove symbol. -+ (D_DECL_READONLY_STATIC): Remove macro. -+ (d_unknown_type_node): New LANG_TYPE node for marking TypeInfo_Class, -+ Interface, and ModuleInfo types that are of a variable size determined -+ at compile time. -+ -+ * d-elem.cc(StringExp::toElem): Clean up for new dt_t format. -+ -+ * symbol.cc: Remove file. -+ -+2013-05-08 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::getFrameInfo): Don't create a frame/closure -+ for member functions, only required for nested. -+ * d-elem.cc(Expression::toElemDtor): Call dtors in the correct order. -+ (DeclarationExp::toElem): Don't call dtor on static, manifest, or -+ extern symbols upon declaration. -+ (AssignExp::toElem): Only call postblit on lvalues in assignment. -+ (ArrayLiteralExp::toElem): Always generate literals on heap. -+ -+2013-05-06 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(StructLiteralExp::toElem): Return the default initialiser -+ symbol if one exists. -+ * d-builtins.c(d_gcc_magic_libbuiltins_check): Override the function -+ type with the correct built-in function type as defined in backend. -+ -+2013-04-15 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(IdentityExp::toElem): Remove special handling of class, -+ reference and array types. -+ -+2013-04-12 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(maybe_make_temp): Save call expressions so aren't -+ evaluated more than once. -+ (d_has_side_effects): Remove check for exceptional class types. -+ -+2013-04-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(FuncDeclaration::toSymbol): Harden logic for marking -+ functions pure as in 'has no side effects'. -+ -+2013-04-07 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(FuncDeclaration::toSymbol): Push deferred functions to -+ FuncDeclaration::deferred. -+ * d-elem.cc(DelegateExp::toElem): Likewise. -+ (FuncExp::toElem): Likewise. -+ * d-objfile.cc(ObjectFile::shouldEmit): Likewise. -+ (FuncDeclaration::toObjFile): Process all deferred functions in -+ FuncDeclaration::deferred. -+ * symbol.cc(Symbol::deferredNestedFuncs): Remove. -+ -+2013-04-05 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-elem.cc(FuncExp::toElem): Defer function literals and lambdas -+ until parent function has finished processing. -+ -+2013-04-04 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::buildChain): Use __frame decl directly when -+ setting up the function frame. -+ (maybe_set_builtin_frontend): Exit early if symbol has no parent. -+ * d-decls.cc(FuncDeclaration::toSymbol): Defer all nested functions, -+ not just templated instances. -+ * d-objfile.cc(FuncDeclaration::toObjFile): Delay processed deferred -+ nested functions until function has finished being generated. -+ (ObjectFile::shouldEmit): Don't emit nested functions if the parent -+ function hasn't finished processing. -+ -+2013-04-03 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(maybe_set_builtin_frontend): Merged from -+ maybe_set_builtin and maybe_set_libcall. -+ * d-decls.cc(FuncDeclaration::toSymbol): Use -+ maybe_set_builtin_frontend. -+ -+2013-03-31 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_init_options): Default module info emission to on. -+ (d_handle_option): New femit-moduleinfo switch. -+ * d-objfile.cc(Module::genobjfile): Don't emit module if disabled -+ explicitly. -+ * d-builtins(is_intrinsic_module_p): New function to test whether -+ module is core.bitops. -+ (is_math_module_p): New function to test whether module is std.math or -+ core.stdc.math. -+ (is_builtin_va_arg_p): New function to test whether symbol is -+ specially handled va_arg template. -+ (is_builtin_va_start_p): New function to test whether symbol is -+ specially handled va_start template. -+ * d-codegen.cc(IRState::binding): Replace with bind_expr. -+ (IRState::mathModule): Replace with std_math_module. -+ (IRState::mathCoreModule): Replace with core_math_module. -+ (IRState::intrinsicModule): Replace with std_intrinsic_module. -+ (IRState::cstdargTemplateDecl): Replace with va_arg_template. -+ (IRState::stdargTemplateDecl): Replace with va_arg2_template. -+ (IRState::cstdargStartTemplateDecl): Replace with va_start_template. -+ (IRState::getLibCallDecl): Replace with get_libcall. -+ (IRState::maybeSetLibCallDecl): Replace with maybe_set_libcall. -+ (IRState::libCall): Replace with build_libcall. -+ (IRState::maybeSetUpBuiltin): Replace with maybe_set_builtin. -+ (IRState::Intrinsic): Move enum out of IRState. -+ -+2013-03-30 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::darrayPtrRef): Replace with d_array_ptr. -+ (IRState::darrayLenRef): Replace with d_array_length. -+ (IRState::darrayVal): Replace with d_array_value. -+ (IRState::darrayString): Replace with d_array_string. -+ (IRState::arrayLength): Replace with get_array_length. -+ (get_object_method): Remove dependancy on irs parameter. -+ * d-lang.cc(d_init): Use static bool std_inc to determine whether to -+ include standard module paths. -+ (d_post_options): Canonicalize the input filename. -+ (d_parse_file): Correctly catch cases where input file is stdin. -+ -+2013-03-27 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::getFrameInfo) Create a custom static chain for -+ all nested functions. -+ * d-gcc-includes.h: Rename to d-system.h -+ -+2013-03-23 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(d_bi_init): Set REALPAD to be TYPE_PRECISION of -+ long_double_type_node. -+ * d-codegen.cc(IRState::twoFieldType): Replace with -+ build_two_field_type. -+ (IRState::arrayOpNotImplemented): Replace with unhandled_arrayop_p. -+ (IRState::delegateMethodRef): Replace with delegate_method. -+ (IRState::delegateObjectRef): Replace with delegate_object. -+ (IRState::delegateVal): Replace with build_delegate_cst. -+ (IRState::methodCallExpr): Replace with build_method_call. -+ (IRState::extractMethodCallExpr): Replace with -+ extract_from_method_call. -+ (IRState::objectInstanceMethod): Replace with get_object_method. -+ (IRState::twoFieldCtor): Remove. -+ (IRState::call): Assert that if calling a normal FUNCTION_TYPE, -+ 'object' is not set. -+ * d-ctype.cc(TypeDelegate::toCtype): Build a METHOD_TYPE for the .func -+ field type in delegates. -+ * d-lang.h(D_IS_METHOD_CALL_EXPR): Rename to D_METHOD_CALL_EXPR. -+ * d-objfile.cc(FuncDeclaration::toObjFile): Remove assert for chain -+ function. -+ -+2013-03-20 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-codegen.cc(IRState::objectInstanceMethod): Recursively check -+ for TOKsuper / TOKdottype. Do not ignore CastExp. -+ * d-elem.cc(IdentityExp::toElem): Ignore padding in bitwise floating -+ point comparisons. -+ * testsuite: Cleanup. Remove invalid tests, adjust tests, etc. -+ -+2013-03-20 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::objectInstanceMethod): Get function pointer -+ off function TREE_TYPE. -+ (build_deref): Handle cases where expression to dereference is an -+ address expression. -+ (modify_expr): New function overload to set return type directly. -+ * d-elem.cc(CatAssignExp::toElem): Use new modify_expr. -+ (AssignExp::toElem): Likewise. -+ * d-decls.cc(FuncDeclaration::toSymbol): Don't build a method type for -+ nested functions / delegates. Just add on the hidden 'this' pointer -+ containing the custom static chain/closure object. -+ -+ * d-codegen.cc(GlobalValues): Replace with current_module, -+ current_irs, object_file. -+ (IRState::getFuncType): Replace with get_function_type. -+ (IRState::isCallByAlias): Replace with call_by_alias_p. -+ (IRState::isFuncType): Replace with function_type_p. -+ (IRState::doExp): Remove. -+ -+ * d-asmstmt.cc(ExtAsmStatement::syntaxCopy): Use arraySyntaxCopy to -+ copy front end expressions. -+ -+ * d-codegen.cc(AssignExp::toElem): Call _d_arrayassign / _d_arrayctor -+ when assigning arrays of structs. -+ -+2013-03-18 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::realPart): Replace with real_part. -+ (IRState::imagPart): Replace with imaginary_part. -+ (IRState::integerConstant): Replace with build_integer_cst. -+ (IRState::floatConstant): Replace with build_float_cst. -+ (IRState::hwi2toli): Replace with cst_to_hwi. -+ (IRState::addressOf): Replace with build_address. -+ (IRState::markAddressable): Replace with d_mark_addressable. -+ (IRState::markUsed): Replace with d_mark_used. -+ (IRState::markRead): Replace with d_mark_read. -+ (IRState::indirect): Replace with indirect_ref. -+ (IRState::pvoidOkay): Replace with void_okay_p. -+ (IRState::maybeCompound): Replace with maybe_compound_expr. -+ (IRState::maybeVoidCompound): Replace with maybe_vcompound_expr. -+ (IRState::isErrorMark): Replace with error_mark_p. -+ (IRState::getTargetSizeConst): Replace with tree_to_hwi. -+ (IRState::modify): Replace with modify_expr. -+ (IRState::vmodify): Replace with vmodify_expr. -+ (IRState::vinit): Replace with build_vinit. -+ (IRState::nop): Replace with build_nop. -+ (IRState::vconvert): Replace with build_vconvert. -+ (IRState::boolOp): Replace with build_boolop. -+ (IRState::compound): Replace with compound_expr. -+ (IRState::voidCompound): Replace with vcompound_expr. -+ (IRState::component): Replace with component_ref. -+ (IRState::errorMark): Replace with error_mark. -+ (IRState::typesSame): Replace with d_types_same. -+ (IRState::typesCompatible): Replace with d_types_compatible. -+ (IRState::getDType): Replace with build_dtype. -+ (IRState::getObjectType): Replace with build_object_type. -+ (IRState::isDeclarationReferenceType): Replace with decl_reference_p. -+ (IRState::trueDeclarationType): Replace with declaration_type. -+ (IRState::isArgumentReferenceType): Replace with arg_reference_p. -+ (IRState::trueArgumentType): Replace with type_passed_as. -+ (IRState::arrayType): Replace with d_array_type. -+ (IRState::addTypeAttribute): Replace with insert_type_attributes. -+ (IRState::addDeclAttribute): Replace with insert_decl_attributes. -+ (IRState::attributes): Replace with build_attributes. -+ (IRState::addTypeModifiers): Replace with insert_type_modifiers. -+ (IRState::maybeMakeTemp): Replace with maybe_make_temp. -+ (IRState::isFreeOfSideEffects): Replace with d_has_side_effects. -+ (IRState::pointerOffsetOp): Replace with build_offset_op. -+ (IRState::pointerOffset): Replace with build_offset. -+ (IRState::buildCall): Replace with d_build_call. -+ (IRState::exceptionObject): Replace with build_exception_object. -+ -+2013-03-17 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-asmstmt.cc(d_build_asm_stmt): Remove. -+ (ExtAsmStatement::ExtAsmStatement): Update to match renamed members. -+ (ExtAsmStatement::syntaxCopy): Likewise. -+ (ExtAsmStatement::semantic): Likewise. -+ (ExtAsmStatement::toCBuffer): Likewise. -+ (ExtAsmStatement::comeFrom): New. -+ (ExtAsmStatement::blockExit): Don't error if must not throw. -+ (naturalString): Remove. -+ (ExtAsmStatement::toIR): Inline IRState::doAsm implementation. -+ * d-codegen.cc(IRState::doAsm): Remove. -+ * d-decls.cc(FuncDeclaration::toSymbol): Don't generate 'naked' -+ attribute. -+ (binfo_for): Move into d-decls.cc. -+ (intfc_binfo_for): Likewise. -+ (ClassDeclaration::toDebug): Likewise. -+ (EnumDeclaration::toDebug): Likewise. -+ (TypedefDeclaration::toDebug): Likewise. -+ (StructDeclaration::toDebug): Likewise. -+ * d-objfile.cc(FuncDeclaration::toObjFile): Move into d-objfile.cc. -+ (FuncDeclaration::buildClosure): Likewise. -+ (Module::genobjfile): Likewise. -+ * d-glue.cc: Remove file. -+ -+2013-03-16 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-ir.cc(SynchronizedStatement::toIR): Remove implementation as is -+ now handled by the frontend. -+ -+2013-03-15 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(IRState::maybeExpandSpecialCall): Handle ref argptr -+ arguments. -+ -+2013-03-13 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-builtins.c(handle_alias_attribute): New function to handle -+ internal 'alias' attribute. -+ (handle_weakref_attribute): New function to handle internal 'weakref' -+ attribute. -+ * d-objfile.cc(ObjectFile::outputThunk): Define thunks to external -+ symbols as weakref, alias -+ -+2013-03-12 Johannes Pfau <johannespfau@gmail.com> -+ -+ * patch-versym-os-4.8.x(mingw32.h): Fix typo -+ * patch-versym-cpu-4.8.x(mips.h): Fix typo -+ Update version symbols to latest dlang specification. -+ -+2013-03-10 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(FuncDeclaration::toSymbol): Delay setting TREE_TYPE as -+ function type could be hidden in a nested function not yet built. -+ * d-codegen.cc(IRState::findThis): Don't get 'this' from outer -+ function if it's a closure type. This has already been handled by -+ IRState::getFrameForSymbol. -+ (IRState::buildChain): Give frame decl debug name '__frame'. -+ Always set '__chain' link field. -+ (IRState::getFrameInfo): Don't build a frame for all nested functions. -+ Search through nested aggregates for static chain in outer functions. -+ * d-codegen.h(IRState::useParentChain): Remove. -+ * d-glue.cc(FuncDeclaration::toObjFile): Don't call useParentChain. -+ Don't create a local var for the chain link for a function. -+ (FuncDeclaration::buildClosure): Always set '__chain' link field. -+ -+2013-03-08 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(d_gcc_force_templates): Only check for emitting -+ templates as private. -+ * d-lang.cc(d_handle_option): Remove -femit-templates= option. -+ * d-objfile.cc(ObjectFile::makeDeclOneOnly): Fix code logic so -+ fallback method could be reached. -+ * d-objfile.h(TEall, TEauto): Remove. -+ -+2013-03-07 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-ir.cc(ReturnStatement::toIR): Don't call postblit on return. -+ * d-codegen.cc(IRState::trueDeclarationType): Don't set -+ D_TYPE_ADDRESSABLE. -+ (IRState::makeTemp): Remove. -+ (IRState::maybeMakeTemp): Copy makeTemp into function. -+ * d-glue.cc(d_genericize): Remove D_TYPE_ADDRESSABLE handling. -+ * d-lang.h(D_TYPE_ADDRESSABLE): Remove macro. -+ -+2013-03-04 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-ctype.cc(Type::toCtype): Always call gen.addTypeModifiers to -+ make sure TYPE_MAIN_VARIANT is set. Reuse tree from unqualified -+ variant for that. Also cache the resulting qualified tree. -+ (TypeTypedef::toCtype): Likewise. -+ (TypeEnum::toCtype): Likewise. -+ (TypeStruct::toCtype): Likewise. -+ (TypeFunction::toCtype): Likewise. -+ (TypeVector::toCtype): Likewise. -+ (TypeSArray::toCtype): Likewise. -+ (TypeDArray::toCtype): Likewise. -+ (TypeAArray::toCtype): Likewise. -+ (TypeDelegate::toCtype): Likewise. -+ (TypeClass::toCtype): Likewise. -+ * d-objfile.cc(ObjectFile::giveDeclUniqueName): Make sure DECL_NAME is set -+ -+2013-03-01 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-decls.cc(VarDeclaration::toSymbol): Remove use of c_ident. -+ (FuncDeclaration::toSymbol): Likewise. -+ * d-builtins.c(handle_noreturn_attribute): Assert that this is only -+ used for internal purposes. -+ (handle_const_attribute): Likewise. -+ (handle_malloc_attribute): Likewise. -+ (handle_pure_attribute): Likewise. -+ (handle_nonnull_attribute): Likewise. -+ (handle_nothrow_attribute): Likewise. -+ (handle_sentinel_attribute): Likewise. -+ (handle_transaction_pure_attribute): Likewise. -+ (handle_returns_twice_attribute): Likewise. -+ * d-glue.cc(FuncDeclaration::toObjFile): Result variables have no -+ default initialiser. -+ * d-codegen.cc(IRState::emitLocalVar): Add in assert that the local -+ variable has no initialiser if called with no_init = true. -+ (IRState::getLibCallDecl): Mark exceptional library functions as -+ noreturn. -+ (IRState::attributes): Gracefully handle @attribute, and -+ @attribute(null). -+ -+2013-02-28 Jernej Krempus <jkrempus@gmail.com> -+ -+ * d-builtins.c(d_attribute_table): Renamed it to -+ d_builtins_attribute_table. -+ * d-lang.cc(d_attribute_table): Added an empty table -+ * d-lang.cc(LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Defined it as -+ d_builtins_attribute_table. -+ * d-lang.h(d_builtins_attribute_table): Added a declaration. -+ * d-codegen.cc(IRState::attributes): Changed it so it goes through -+ in_attrs and looks for any @gcc.attribute.attribute("attr_name"). -+ * d-objfile.cc(ObjectFile::setupSymbolStorage): Pass userAttributes -+ instead of attributes in all calls to IRState::attributes. -+ * d-ctype.cc(TypeTypedef::toCtype): Likewise. -+ (TypeEnum::toCtype): Likewise. -+ (TypeStruct::toCtype): Likewise. -+ (TypeClass::toCtype): Likewise. -+ * libphobos/libdruntime/gcc/attribute.d: New file. -+ -+2013-02-28 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_handle_option): Remove OPT_fdeprecated and -+ OPT_Wsign_compare, add handling for OPT_Wdeprecated. -+ (d_post_options): Handle Wdeprecated and Werror switch combination. -+ -+2013-02-27 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-codegen.cc(ArrayScope::ArrayScope): Don't setup length var if its -+ value is known at compile time. -+ (ArrayScope::setArrayExp): Likewise. -+ * d-decls.cc(uniqueName): Remove function. -+ (VarDeclaration::toSymbol): Set decl assembler name directly. -+ (FuncDeclaration::toSymbol): Likewise. -+ -+2013-02-15 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * Make-lang.in(GDC_EXTENDED_ASM_SYNTAX): Remove macro. -+ -+2013-02-14 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.h(D_DECL_IS_CONTRACT): Remove macro. -+ * d-decls.cc(FuncDeclaration::toSymbol): Likewise. -+ -+2013-02-13 Iain Buclaw <ibuclaw@gdcproject.org> -+ -+ * d-lang.cc(d_gcc_is_target_win32): Remove. -+ (d_add_builtin_version): New function to handle define_builtin -+ callback from backend. -+ * d-codegen.cc(IRState::maybeExpandSpecialCall): Remove intrinsic bt. -+ -+ * d-builtins.c: Merge with d-builtins2.cc. -+ * d-builtins2.cc: Remove. -+ -+2013-02-07 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-lang.cc(d_init): Use gcc's config system for predefined OS versions. -+ * setup-gcc.sh: Likewise. -+ * target-ver-syms.sh: Likewise. -+ -+2013-02-05 Iain Buclaw <ibuclaw@ubuntu.com> -+ -+ * d-builtins2.cc(gcc_type_to_d_type): Remove STRUCTTHISREF condition. -+ * d-decls.cc(FuncDeclaration::toSymbol): Likewise. -+ * d-elem.cc(ThisExp::toElem): Likewise. -+ * d-ctype.cc(TypeSArray::toCtype): Remove SARRAYVALUE condition. -+ * d-codegen.cc(IRState::isDeclarationReferenceType): Likewise. -+ (IRState::isArgumentReferenceType): Likewise. -+ -+2013-02-01 Johannes Pfau <johannespfau@gmail.com> -+ -+ * d-lang.cc(d_init): Use gcc's config system for predefined CPU versions. -+ (d_init): Fix definition of D_LP64 version. -+ * setup-gcc.sh: Likewise. -+ * target-ver-syms.sh: Likewise. -+ ---- a/src/gcc/d/complex_t.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/complex_t.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,132 +0,0 @@ --// complex_t.h -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- --// GCC is free software; you can redistribute it and/or modify it under --// the terms of the GNU General Public License as published by the Free --// Software Foundation; either version 3, or (at your option) any later --// version. -- --// GCC is distributed in the hope that it will be useful, but WITHOUT ANY --// WARRANTY; without even the implied warranty of MERCHANTABILITY or --// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --// for more details. -- --// You should have received a copy of the GNU General Public License --// along with GCC; see the file COPYING3. If not see --// <http://www.gnu.org/licenses/>. -- --#ifndef GCC_DCMPLR_COMPLEX_T_H --#define GCC_DCMPLR_COMPLEX_T_H -- --/* Roll our own complex type for compilers that don't support complex -- */ -- -- --struct complex_t --{ -- longdouble re; -- longdouble im; -- -- complex_t (void) -- { -- this->re = 0; -- this->im = 0; -- } -- -- complex_t (longdouble re) -- { -- this->re = re; -- this->im = 0; -- } -- -- complex_t (longdouble re, longdouble im) -- { -- this->re = re; -- this->im = im; -- } -- -- complex_t operator+ (complex_t y) -- { -- complex_t r; -- r.re = this->re + y.re; -- r.im = this->im + y.im; -- return r; -- } -- -- complex_t operator- (complex_t y) -- { -- complex_t r; -- r.re = this->re - y.re; -- r.im = this->im - y.im; -- return r; -- } -- -- complex_t operator- (void) -- { -- complex_t r; -- r.re = -this->re; -- r.im = -this->im; -- return r; -- } -- -- complex_t operator* (complex_t y) -- { return complex_t (this->re * y.re - this->im * y.im, this->im * y.re + this->re * y.im); } -- -- complex_t operator/ (complex_t y) -- { -- longdouble abs_y_re = y.re.isNegative() ? -y.re : y.re; -- longdouble abs_y_im = y.im.isNegative() ? -y.im : y.im; -- longdouble r, den; -- -- if (abs_y_re < abs_y_im) -- { -- r = y.re / y.im; -- den = y.im + r * y.re; -- return complex_t ((this->re * r + this->im) / den, -- (this->im * r - this->re) / den); -- } -- else -- { -- r = y.im / y.re; -- den = y.re + r * y.im; -- return complex_t ((this->re + r * this->im) / den, -- (this->im - r * this->re) / den); -- } -- } -- -- operator bool (void) -- { return !re.isZero() || !im.isZero(); } -- -- int operator== (complex_t y) -- { return this->re == y.re && this->im == y.im; } -- -- int operator!= (complex_t y) -- { return this->re != y.re || this->im != y.im; } --}; -- --inline complex_t operator* (longdouble x, complex_t y) --{ -- return complex_t (x) * y; --} -- --inline complex_t operator* (complex_t x, longdouble y) --{ -- return x * complex_t (y); --} -- --inline complex_t operator/ (complex_t x, longdouble y) --{ -- return x / complex_t (y); --} -- --inline longdouble creall (complex_t x) --{ -- return x.re; --} -- --inline longdouble cimagl (complex_t x) --{ -- return x.im; --} -- --#endif ---- a/src/gcc/d/config-lang.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/config-lang.in 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - # config-lang.in for D front-end - - # GDC -- D front-end for GCC --# Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+# Copyright (C) 2011-2013 Free Software Foundation, Inc. - # - # This program is free software; you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -14,20 +14,25 @@ - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with GCC; see the file COPYING3. If not see --# <http://www.gnu.org/licenses/>. -+# along with this program. If not, see <http://www.gnu.org/licenses/>. -+ -+# Configure looks for the existence of this file to auto-config each language. -+# We define several parameters used by configure: -+# -+# language - name of language as it would appear in $(LANGUAGES) -+# compilers - value to add to $(COMPILERS) - - language="d" - - compilers="cc1d\$(exeext)" - --stagestuff="gdc\$(exeext) gdc-cross\$(exeext) cc1d\$(exeext)" -- --gtfiles="\$(srcdir)/d/d-lang.h \$(srcdir)/d/d-builtins.c" -+target_libs="target-libphobos target-zlib target-libbacktrace" - --target_libs="target-libphobos target-zlib" -- --lang_requires=c++ -+# The D frontend is written in C++, so we need to build the C++ -+# compiler during stage 1. - lang_requires_boot_languages=c++ - -+gtfiles="\$(srcdir)/d/d-builtins.c \$(srcdir)/d/d-lang.h" -+ -+# Do not build by default. - build_by_default="no" ---- a/src/gcc/d/d-asmstmt.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-asmstmt.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-asmstmt.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -49,7 +49,7 @@ AsmStatement::toIR (IRState *) - ExtAsmStatement::ExtAsmStatement (Loc loc, Expression *insn, - Expressions *args, Identifiers *names, - Expressions *constraints, int outputargs, -- Expressions *clobbers, Dsymbols * labels) -+ Expressions *clobbers) - : Statement (loc) - { - this->insn = insn; -@@ -58,7 +58,6 @@ ExtAsmStatement::ExtAsmStatement (Loc lo - this->constraints = constraints; - this->outputargs = outputargs; - this->clobbers = clobbers; -- this->labels = labels; - } - - // Create a copy of ExtAsmStatement. -@@ -70,15 +69,13 @@ ExtAsmStatement::syntaxCopy (void) - Expressions *args = NULL; - Expressions *constraints = NULL; - Expressions *clobbers = NULL; -- Dsymbols *labels = NULL; - - args = Expression::arraySyntaxCopy (this->args); - constraints = Expression::arraySyntaxCopy (this->constraints); - clobbers = Expression::arraySyntaxCopy (this->clobbers); -- labels = Dsymbol::arraySyntaxCopy (this->labels); - - return new ExtAsmStatement (this->loc, insn, args, this->names, constraints, -- this->outputargs, clobbers, labels); -+ this->outputargs, clobbers); - } - - // Semantically analyze ExtAsmStatement where SC is the scope of the statment. -@@ -200,9 +197,10 @@ ExtAsmStatement::toCBuffer (OutBuffer *b - - // TRUE if statement 'comes from' somewhere else, like a goto. - --int ExtAsmStatement::comeFrom() -+bool -+ExtAsmStatement::comeFromImpl() - { -- return 1; -+ return true; - } - - // Return how an ExtAsmStatement exits. ---- a/src/gcc/d/d-builtins.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-builtins.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* d-builtins.c -- D frontend for GCC. -- Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free -@@ -24,13 +24,23 @@ - #include "template.h" - #include "d-codegen.h" - --static tree bi_fn_list; --static tree bi_lib_list; --static tree bi_type_list; -+static GTY(()) vec<tree, va_gc> *gcc_builtins_functions = NULL; -+static GTY(()) vec<tree, va_gc> *gcc_builtins_libfuncs = NULL; -+static GTY(()) vec<tree, va_gc> *gcc_builtins_types = NULL; - - // Necessary for built-in struct types --static Array builtin_converted_types; --static Dsymbols builtin_converted_decls; -+struct builtin_sym -+{ -+ builtin_sym (Dsymbol *d, Type *t, tree c) -+ : decl(d), dtype(t), ctype(c) -+ { } -+ -+ Dsymbol *decl; -+ Type *dtype; -+ tree ctype; -+}; -+ -+static vec<builtin_sym *, va_gc> *builtin_converted_decls = NULL; - - // Built-in symbols that require special handling. - static Module *std_intrinsic_module; -@@ -71,7 +81,6 @@ tree d_global_trees[DTI_MAX]; - static Type * - gcc_type_to_d_type (tree t) - { -- Expression *e; - Type *d; - unsigned type_size; - bool is_unsigned; -@@ -121,7 +130,7 @@ gcc_type_to_d_type (tree t) - return Type::tbool; - - case INTEGER_TYPE: -- type_size = tree_low_cst (TYPE_SIZE_UNIT (t), 1); -+ type_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (t)); - is_unsigned = TYPE_UNSIGNED (t); - - // This search assumes that integer types come before char and bit... -@@ -136,7 +145,7 @@ gcc_type_to_d_type (tree t) - break; - - case REAL_TYPE: -- type_size = tree_low_cst (TYPE_SIZE_UNIT (t), 1); -+ type_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (t)); - for (size_t i = 0; i < TMAX; i++) - { - d = Type::basic[i]; -@@ -146,7 +155,7 @@ gcc_type_to_d_type (tree t) - break; - - case COMPLEX_TYPE: -- type_size = tree_low_cst (TYPE_SIZE_UNIT (t), 1); -+ type_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (t)); - for (size_t i = 0; i < TMAX; i++) - { - d = Type::basic[i]; -@@ -170,10 +179,7 @@ gcc_type_to_d_type (tree t) - length = size_binop (PLUS_EXPR, size_one_node, - convert (sizetype, length)); - -- e = new IntegerExp (0, tree_to_hwi (length), -- Type::tindex); -- d = new TypeSArray (d, e); -- d = d->semantic (0, NULL); -+ d = TypeSArray::makeType (Loc(), d, tree_to_hwi (length)); - d->ctype = t; - return d; - } -@@ -183,8 +189,7 @@ gcc_type_to_d_type (tree t) - d = gcc_type_to_d_type (TREE_TYPE (t)); - if (d) - { -- e = new IntegerExp (0, TYPE_VECTOR_SUBPARTS (t), Type::tindex); -- d = new TypeSArray (d, e); -+ d = TypeSArray::makeType (Loc(), d, TYPE_VECTOR_SUBPARTS (t)); - - if (d->nextOf()->isTypeBasic() == NULL) - break; -@@ -194,18 +199,17 @@ gcc_type_to_d_type (tree t) - if (type_size != 8 && type_size != 16 && type_size != 32) - break; - -- d = new TypeVector (0, d); -- d = d->semantic (0, NULL); -+ d = new TypeVector (Loc(), d); - return d; - } - break; - - case RECORD_TYPE: -- for (size_t i = 0; i < builtin_converted_types.dim; i += 2) -+ for (size_t i = 0; i < vec_safe_length (builtin_converted_decls); ++i) - { -- tree ti = (tree) builtin_converted_types.data[i]; -+ tree ti = (*builtin_converted_decls)[i]->ctype; - if (TYPE_MAIN_VARIANT (ti) == TYPE_MAIN_VARIANT (t)) -- return (Type *) builtin_converted_types.data[i + 1]; -+ return (*builtin_converted_decls)[i]->dtype; - } - - if (TYPE_NAME (t)) -@@ -217,7 +221,7 @@ gcc_type_to_d_type (tree t) - structname = structname_buf; - } - -- sdecl = new StructDeclaration (0, Lexer::idPool (structname)); -+ sdecl = new StructDeclaration (Loc(), Lexer::idPool (structname)); - // The gcc.builtins module may not exist yet, so cannot set - // sdecl->parent here. If it is va_list, the parent needs to - // be set to the object module which will not exist when -@@ -225,22 +229,18 @@ gcc_type_to_d_type (tree t) - sdecl->structsize = int_size_in_bytes (t); - sdecl->alignsize = TYPE_ALIGN_UNIT (t); - sdecl->sizeok = SIZEOKdone; -- -- d = new TypeStruct (sdecl); -- d->ctype = t; -- -- sdecl->type = d; -- sdecl->handle = d; -+ sdecl->type = new TypeStruct (sdecl); -+ sdecl->type->ctype = t; -+ sdecl->handle = sdecl->type; -+ sdecl->type->merge(); - - // Does not seem necessary to convert fields, but the - // members field must be non-null for the above size - // setting to stick. - sdecl->members = new Dsymbols; -- -- builtin_converted_types.push (t); -- builtin_converted_types.push (d); -- builtin_converted_decls.push (sdecl); -- return d; -+ d = sdecl->type; -+ vec_safe_push (builtin_converted_decls, new builtin_sym (sdecl, d, t)); -+ return sdecl->type; - - case FUNCTION_TYPE: - typefunc_ret= gcc_type_to_d_type (TREE_TYPE (t)); -@@ -290,30 +290,6 @@ gcc_type_to_d_type (tree t) - } - - --// Hook from d_builtin_function. --// Add DECL to builtin functions list for maybe processing later --// if gcc.builtins was imported into the current module. -- --void --d_bi_builtin_func (tree decl) --{ -- if (!flag_no_builtin && DECL_ASSEMBLER_NAME_SET_P (decl)) -- bi_lib_list = chainon (bi_lib_list, build_tree_list (0, decl)); -- -- bi_fn_list = chainon (bi_fn_list, build_tree_list (0, decl)); --} -- --// Hook from d_register_builtin_type. --// Add DECL to builtin types list for maybe processing later --// if gcc.builtins was imported into the current module. -- --void --d_bi_builtin_type (tree decl) --{ -- bi_type_list = chainon (bi_type_list, build_tree_list (0, decl)); --} -- -- - // Returns TRUE if M is a module that contains specially handled intrinsics. - // If module was never imported into current compilation, return false. - -@@ -445,10 +421,10 @@ static void - d_gcc_magic_builtins_module (Module *m) - { - Dsymbols *funcs = new Dsymbols; -+ tree decl; - -- for (tree n = bi_fn_list; n != NULL_TREE; n = TREE_CHAIN (n)) -+ for (size_t i = 0; vec_safe_iterate (gcc_builtins_functions, i, &decl); ++i) - { -- tree decl = TREE_VALUE (n); - const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); - TypeFunction *dtf = (TypeFunction *) gcc_type_to_d_type (TREE_TYPE (decl)); - -@@ -460,33 +436,34 @@ d_gcc_magic_builtins_module (Module *m) - if (dtf->parameters && dtf->parameters->dim == 0 && dtf->varargs) - continue; - -- // %% D2 - builtins are trusted and optionally nothrow. -- // The purity of a builtins can vary depending on compiler -- // flags set at init, or by the -foptions passed, such as -+ // D2 @safe/pure/nothrow functions. -+ // It is assumed that builtins solely provided by the compiler are -+ // considered @safe, pure and nothrow. Builtins that correspond to -+ // functions in the standard library that don't throw are considered -+ // @trusted. The purity of a builtin can vary depending on compiler -+ // flags set upon initialisation, or by the -foptions passed, such as - // flag_unsafe_math_optimizations. -- -- // Similiarly, if a builtin does not correspond to a function -- // in the standard library (is provided by the compiler), then -- // will also mark the function as weakly pure in the D frontend. -- dtf->trust = TREE_NOTHROW (decl) ? TRUSTtrusted : TRUSTsystem; -- dtf->isnothrow = TREE_NOTHROW (decl); -+ dtf->isnothrow = TREE_NOTHROW (decl) || !DECL_ASSEMBLER_NAME_SET_P (decl); - dtf->purity = DECL_PURE_P (decl) ? PUREstrong : - TREE_READONLY (decl) ? PUREconst : - DECL_IS_NOVOPS (decl) ? PUREweak : - !DECL_ASSEMBLER_NAME_SET_P (decl) ? PUREweak : - PUREimpure; -+ dtf->trust = !DECL_ASSEMBLER_NAME_SET_P (decl) ? TRUSTsafe : -+ TREE_NOTHROW (decl) ? TRUSTtrusted : -+ TRUSTsystem; - -- FuncDeclaration *func = new FuncDeclaration (0, 0, Lexer::idPool (name), -+ FuncDeclaration *func = new FuncDeclaration (Loc(), Loc(), Lexer::idPool (name), - STCextern, dtf); -- func->isym = new Symbol; -- func->isym->Stree = decl; -+ func->csym = new Symbol; -+ func->csym->Sident = name; -+ func->csym->Stree = decl; - - funcs->push (func); - } - -- for (tree n = bi_type_list; n != NULL_TREE; n = TREE_CHAIN (n)) -+ for (size_t i = 0; vec_safe_iterate (gcc_builtins_types, i, &decl); ++i) - { -- tree decl = TREE_VALUE (n); - tree type = TREE_TYPE (decl); - const char *name = IDENTIFIER_POINTER (DECL_NAME (decl)); - Type *dt = gcc_type_to_d_type (type); -@@ -494,7 +471,7 @@ d_gcc_magic_builtins_module (Module *m) - if (!dt) - continue; - -- funcs->push (new AliasDeclaration (0, Lexer::idPool (name), dt)); -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool (name), dt)); - } - - // Iterate through the target-specific builtin types for va_list. -@@ -510,13 +487,13 @@ d_gcc_magic_builtins_module (Module *m) - if (!dt) - continue; - -- funcs->push (new AliasDeclaration (0, Lexer::idPool (name), dt)); -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool (name), dt)); - } - } - -- for (size_t i = 0; i < builtin_converted_decls.dim ; ++i) -+ for (size_t i = 0; i < vec_safe_length (builtin_converted_decls); ++i) - { -- Dsymbol *sym = builtin_converted_decls[i]; -+ Dsymbol *sym = (*builtin_converted_decls)[i]->decl; - // va_list is a pain. It can be referenced without importing - // gcc.builtins so it really needs to go in the object module. - if (!sym->parent) -@@ -524,48 +501,48 @@ d_gcc_magic_builtins_module (Module *m) - Declaration *decl = sym->isDeclaration(); - if (!decl || decl->type != Type::tvalist) - { -- sym->parent = m; - // Currently, there is no need to run semantic, but we do - // want to output inits, etc. -+ sym->parent = m; - funcs->push (sym); - } - } - } - - // va_list should already be built, so no need to convert to D type again. -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_va_list"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_va_list"), - Type::tvalist)); - - // Provide access to target-specific integer types. -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_clong"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_clong"), - gcc_type_to_d_type (long_integer_type_node))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_culong"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_culong"), - gcc_type_to_d_type (long_unsigned_type_node))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_machine_byte"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_machine_byte"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (byte_mode, 0)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_machine_ubyte"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_machine_ubyte"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (byte_mode, 1)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_machine_int"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_machine_int"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (word_mode, 0)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_machine_uint"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_machine_uint"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (word_mode, 1)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_pointer_int"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_pointer_int"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (ptr_mode, 0)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_pointer_uint"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_pointer_uint"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (ptr_mode, 1)))); - - // _Unwind_Word has it's own target specific mode. -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_unwind_int"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_unwind_int"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (targetm.unwind_word_mode(), 0)))); - -- funcs->push (new AliasDeclaration (0, Lexer::idPool ("__builtin_unwind_uint"), -+ funcs->push (new AliasDeclaration (Loc(), Lexer::idPool ("__builtin_unwind_uint"), - gcc_type_to_d_type (lang_hooks.types.type_for_mode (targetm.unwind_word_mode(), 1)))); - - m->members->push (new LinkDeclaration (LINKc, funcs)); -@@ -595,9 +572,10 @@ d_gcc_magic_libbuiltins_check (Dsymbol * - } - else if (fd && !fd->fbody) - { -- for (tree n = bi_lib_list; n != NULL_TREE; n = TREE_CHAIN (n)) -+ tree decl; -+ -+ for (size_t i = 0; vec_safe_iterate (gcc_builtins_libfuncs, i, &decl); ++i) - { -- tree decl = TREE_VALUE (n); - gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); - - const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); -@@ -614,8 +592,9 @@ d_gcc_magic_libbuiltins_check (Dsymbol * - (*tf->parameters)[i]->storageClass |= STCref; - } - } -- fd->isym = new Symbol; -- fd->isym->Stree = decl; -+ fd->csym = new Symbol; -+ fd->csym->Sident = name; -+ fd->csym->Stree = decl; - return; - } - } -@@ -649,19 +628,19 @@ d_gcc_magic_module (Module *m) - - if (md->packages->dim == 1) - { -- if (!strcmp ((md->packages->tdata()[0])->string, "gcc")) -+ if (!strcmp ((*md->packages)[0]->string, "gcc")) - { - if (!strcmp (md->id->string, "builtins")) - d_gcc_magic_builtins_module (m); - } -- else if (!strcmp ((md->packages->tdata()[0])->string, "core")) -+ else if (!strcmp ((*md->packages)[0]->string, "core")) - { - if (!strcmp (md->id->string, "bitop")) - std_intrinsic_module = m; - else if (!strcmp (md->id->string, "math")) - core_math_module = m; - } -- else if (!strcmp ((md->packages->tdata()[0])->string, "std")) -+ else if (!strcmp ((*md->packages)[0]->string, "std")) - { - if (!strcmp (md->id->string, "math")) - std_math_module = m; -@@ -669,8 +648,8 @@ d_gcc_magic_module (Module *m) - } - else if (md->packages->dim == 2) - { -- if (!strcmp ((md->packages->tdata()[0])->string, "core") -- && !strcmp ((md->packages->tdata()[1])->string, "stdc")) -+ if (!strcmp ((*md->packages)[0]->string, "core") -+ && !strcmp ((*md->packages)[1]->string, "stdc")) - { - if (!strcmp (md->id->string, "stdarg")) - d_gcc_magic_stdarg_module (m); -@@ -699,31 +678,51 @@ gcc_cst_to_d_expr (tree cst) - complex_t value; - value.re = TREE_REAL_CST (TREE_REALPART (cst)); - value.im = TREE_REAL_CST (TREE_IMAGPART (cst)); -- return new ComplexExp (0, value, type); -+ return new ComplexExp (Loc(), value, type); - } - else if (code == INTEGER_CST) - { -- dinteger_t value = cst_to_hwi (TREE_INT_CST (cst)); -- return new IntegerExp (0, value, type); -+ dinteger_t value = tree_to_hwi (cst); -+ return new IntegerExp (Loc(), value, type); - } - else if (code == REAL_CST) - { -- real_t value = TREE_REAL_CST (cst); -- return new RealExp (0, value, type); -+ real_value value = TREE_REAL_CST (cst); -+ return new RealExp (Loc(), ldouble(value), type); - } - else if (code == STRING_CST) - { - const void *string = TREE_STRING_POINTER (cst); - size_t len = TREE_STRING_LENGTH (cst); -- return new StringExp (0, CONST_CAST (void *, string), len); -+ return new StringExp (Loc(), CONST_CAST (void *, string), len); -+ } -+ else if (code == VECTOR_CST) -+ { -+ dinteger_t nunits = VECTOR_CST_NELTS (cst); -+ Expressions *elements = new Expressions; -+ elements->setDim (nunits); -+ -+ for (size_t i = 0; i < nunits; i++) -+ { -+ Expression *elem = gcc_cst_to_d_expr (VECTOR_CST_ELT (cst, i)); -+ if (elem == NULL) -+ return NULL; -+ -+ (*elements)[i] = elem; -+ } -+ -+ Expression *e = new ArrayLiteralExp (Loc(), elements); -+ e->type = ((TypeVector *) type)->basetype; -+ -+ return new VectorExp (Loc(), e, type); - } - } -+ - return NULL; - } - --// Helper for d_gcc_eval_builtin. Evaluate builtin D --// function BUILTIN whose argument list is ARGUMENTS. --// Return result; NULL if cannot evaluate it. -+// Helper for d_gcc_eval_builtin. Evaluate builtin D function BUILTIN whose -+// argument list is ARGUMENTS. Return result; NULL if cannot evaluate it. - - Expression * - eval_builtin (Loc loc, BUILTIN builtin, Expressions *arguments) -@@ -732,10 +731,10 @@ eval_builtin (Loc loc, BUILTIN builtin, - Expression *arg0 = (*arguments)[0]; - Type *t0 = arg0->type; - -- static IRState irs; - tree callee = NULL_TREE; - tree result; -- irs.doLineNote (loc); -+ -+ set_input_location (loc); - - switch (builtin) - { -@@ -806,14 +805,14 @@ eval_builtin (Loc loc, BUILTIN builtin, - } - - TypeFunction *tf = (TypeFunction *) gcc_type_to_d_type (TREE_TYPE (callee)); -- result = irs.call (tf, callee, NULL, arguments); -+ result = d_build_call (tf, callee, NULL, arguments); - result = fold (result); - - // Special case bsr. - if (builtin == BUILTINbsr) - { - tree type = t0->toCtype(); -- tree lhs = size_int (tree_low_cst (TYPE_SIZE (type), 1) - 1); -+ tree lhs = size_int (TREE_INT_CST_LOW (TYPE_SIZE (type)) - 1); - result = fold_build2(MINUS_EXPR, type, - fold_convert (type, lhs), result); - } -@@ -826,7 +825,6 @@ eval_builtin (Loc loc, BUILTIN builtin, - } - - return e; -- - } - - // Evaluate builtin D function FD whose argument list is ARGUMENTS. -@@ -845,10 +843,8 @@ d_gcc_eval_builtin (Loc loc, FuncDeclara - TypeFunction *tf = (TypeFunction *) fd->type; - tree callee = NULL_TREE; - -- // cirstate is not available. -- IRState irs; -- irs.doLineNote (loc); -- tree result = irs.call (tf, callee, NULL, arguments); -+ set_input_location (loc); -+ tree result = d_build_call (tf, callee, NULL, arguments); - result = fold (result); - - // Builtin should be successfully evaluated. -@@ -860,27 +856,85 @@ d_gcc_eval_builtin (Loc loc, FuncDeclara - } - } - -+// Perform a reinterpret cast of EXPR to type TYPE for use in CTFE. -+// The front end should have already ensured that EXPR is a constant, -+// so we just lower the value to GCC and return the converted CST. -+ - Expression * - d_gcc_paint_type (Expression *expr, Type *type) - { - /* We support up to 512-bit values. */ - unsigned char buffer[64]; -- int len; -- Expression *e; - tree cst; - -- if (type->isintegral()) -+ Type *tb = type->toBasetype(); -+ -+ if (expr->type->isintegral()) -+ cst = build_integer_cst (expr->toInteger(), expr->type->toCtype()); -+ else if (expr->type->isfloating()) - cst = build_float_cst (expr->toReal(), expr->type); -+ else if (expr->op == TOKarrayliteral) -+ { -+ // Build array as VECTOR_CST, assumes EXPR is constant. -+ Expressions *elements = ((ArrayLiteralExp *) expr)->elements; -+ vec<constructor_elt, va_gc> *elms = NULL; -+ -+ vec_safe_reserve (elms, elements->dim); -+ for (size_t i = 0; i < elements->dim; i++) -+ { -+ Expression *e = (*elements)[i]; -+ if (e->type->isintegral()) -+ { -+ tree value = build_integer_cst (e->toInteger(), e->type->toCtype()); -+ CONSTRUCTOR_APPEND_ELT (elms, size_int (i), value); -+ } -+ else if (e->type->isfloating()) -+ { -+ tree value = build_float_cst (e->toReal(), e->type); -+ CONSTRUCTOR_APPEND_ELT (elms, size_int (i), value); -+ } -+ else -+ gcc_unreachable(); -+ } -+ -+ // Build vector type. -+ int nunits = ((TypeSArray *) expr->type)->dim->toUInteger(); -+ Type *telem = expr->type->nextOf(); -+ tree vectype = build_vector_type (telem->toCtype(), nunits); -+ -+ cst = build_vector_from_ctor (vectype, elms); -+ } - else -- cst = build_integer_cst (expr->toInteger(), expr->type->toCtype()); -+ gcc_unreachable(); - -- len = native_encode_expr (cst, buffer, sizeof (buffer)); -- cst = native_interpret_expr (type->toCtype(), buffer, len); -+ // Encode CST to buffer. -+ int len = native_encode_expr (cst, buffer, sizeof (buffer)); - -- e = gcc_cst_to_d_expr (cst); -- gcc_assert (e != NULL); -+ if (tb->ty == Tsarray) -+ { -+ // Interpret value as a vector of the same size, -+ // then return the array literal. -+ int nunits = ((TypeSArray *) type)->dim->toUInteger(); -+ Type *elem = type->nextOf(); -+ tree vectype = build_vector_type (elem->toCtype(), nunits); - -- return e; -+ cst = native_interpret_expr (vectype, buffer, len); -+ -+ Expression *e = gcc_cst_to_d_expr (cst); -+ gcc_assert (e != NULL && e->op == TOKvector); -+ -+ return ((VectorExp *) e)->e1; -+ } -+ else -+ { -+ // Normal interpret cast. -+ cst = native_interpret_expr (type->toCtype(), buffer, len); -+ -+ Expression *e = gcc_cst_to_d_expr (cst); -+ gcc_assert (e != NULL); -+ -+ return e; -+ } - } - - /* Used to help initialize the builtin-types.def table. When a type of -@@ -979,9 +1033,9 @@ lookup_ctype_name (const char *p) - } - - static void --do_build_builtin_fn (enum built_in_function fncode, -+do_build_builtin_fn (built_in_function fncode, - const char *name, -- enum built_in_class fnclass, -+ built_in_class fnclass, - tree fntype, bool both_p, bool fallback_p, - tree fnattrs, bool implicit_p) - { -@@ -1014,6 +1068,7 @@ enum d_builtin_type - #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME, - #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME, - #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME, -+#define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7, ARG8) NAME, - #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME, - #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME, - #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME, -@@ -1031,6 +1086,7 @@ enum d_builtin_type - #undef DEF_FUNCTION_TYPE_5 - #undef DEF_FUNCTION_TYPE_6 - #undef DEF_FUNCTION_TYPE_7 -+#undef DEF_FUNCTION_TYPE_8 - #undef DEF_FUNCTION_TYPE_VAR_0 - #undef DEF_FUNCTION_TYPE_VAR_1 - #undef DEF_FUNCTION_TYPE_VAR_2 -@@ -1177,7 +1233,7 @@ d_init_builtins (void) - D_TYPE_IMAGINARY_FLOAT (d_ireal_type_node) = 1; - - /* Used for ModuleInfo, ClassInfo, and Interface decls. */ -- d_unknown_type_node = make_node (LANG_TYPE); -+ d_unknown_type_node = make_node (RECORD_TYPE); - - { - /* Make sure we get a unique function type, so we can give -@@ -1217,6 +1273,10 @@ d_init_builtins (void) - #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ - ARG6, ARG7) \ - def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7); -+#define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \ -+ ARG6, ARG7, ARG8) \ -+ def_fn_type (ENUM, RETURN, 0, 8, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \ -+ ARG7, ARG8); - #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \ - def_fn_type (ENUM, RETURN, 1, 0); - #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \ -@@ -1241,6 +1301,8 @@ d_init_builtins (void) - #undef DEF_FUNCTION_TYPE_4 - #undef DEF_FUNCTION_TYPE_5 - #undef DEF_FUNCTION_TYPE_6 -+#undef DEF_FUNCTION_TYPE_7 -+#undef DEF_FUNCTION_TYPE_8 - #undef DEF_FUNCTION_TYPE_VAR_0 - #undef DEF_FUNCTION_TYPE_VAR_1 - #undef DEF_FUNCTION_TYPE_VAR_2 -@@ -1267,7 +1329,10 @@ d_init_builtins (void) - build_common_builtin_nodes (); - } - --/* Registration of machine- or os-specific builtin types. */ -+/* Registration of machine- or os-specific builtin types. -+ Add to builtin types list for maybe processing later -+ if gcc.builtins was imported into the current module. */ -+ - void - d_register_builtin_type (tree type, const char *name) - { -@@ -1278,28 +1343,25 @@ d_register_builtin_type (tree type, cons - if (!TYPE_NAME (type)) - TYPE_NAME (type) = decl; - -- d_bi_builtin_type (decl); -+ vec_safe_push (gcc_builtins_types, decl); - } - --/* Return a definition for a builtin function named NAME and whose data type -- is TYPE. TYPE should be a function type with argument types. -- FUNCTION_CODE tells later passes how to compile calls to this function. -- See tree.h for its possible values. -- -- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, -- the name to be called if we can't opencode the function. If -- ATTRS is nonzero, use that for the function's attribute list. */ -+/* Add DECL to builtin functions list for maybe processing later -+ if gcc.builtins was imported into the current module. */ - - tree - d_builtin_function (tree decl) - { -- d_bi_builtin_func (decl); -+ if (!flag_no_builtin && DECL_ASSEMBLER_NAME_SET_P (decl)) -+ vec_safe_push (gcc_builtins_libfuncs, decl); -+ -+ vec_safe_push (gcc_builtins_functions, decl); - return decl; - } - - - /* Table of machine-independent attributes supported in GIMPLE. */ --const struct attribute_spec d_builtins_attribute_table[] = -+const attribute_spec d_builtins_attribute_table[] = - { - /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, - affects_type_identity } */ -@@ -1345,7 +1407,7 @@ const struct attribute_spec d_builtins_a - /* Give the specifications for the format attributes, used by C and all - descendants. */ - --const struct attribute_spec d_format_attribute_table[] = -+const attribute_spec d_format_attribute_table[] = - { - /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, - affects_type_identity } */ -@@ -1687,30 +1749,29 @@ ignore_attribute (tree * ARG_UNUSED (nod - } - - --/* Backend init. */ -+// Backend init. - - void - d_backend_init (void) - { -- init_global_binding_level (); -+ init_global_binding_level(); - -- /* This allows the code in d-builtins2 to not have to worry about -- converting (C signed char *) to (D char *) for string arguments of -- built-in functions. -- Parameters are (signed_char = false, short_double = false). */ -+ // This allows the code in d-builtins.c to not have to worry about -+ // converting (C signed char *) to (D char *) for string arguments of -+ // built-in functions. -+ // Parameters are (signed_char = false, short_double = false). - build_common_tree_nodes (false, false); - -- d_init_builtins (); -+ d_init_builtins(); - - if (flag_exceptions) -- d_init_exceptions (); -+ d_init_exceptions(); - -- /* This is the C main, not the D main. */ -+ // This is the C main, not the D main. - main_identifier_node = get_identifier ("main"); - } - -- --/* Backend term. */ -+// Backend term. - - void - d_backend_term (void) ---- a/src/gcc/d/d-codegen.cc 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/gcc/d/d-codegen.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-codegen.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -25,140 +25,92 @@ - #include "dfrontend/target.h" - - --Module *cmodule; --IRState *cirstate; --ObjectFile *object_file; -+Module *current_module_decl; -+IRState *current_irstate; - - --// Public routine called from D frontend to hide from glue interface. --// Returns TRUE if all templates are being emitted, either publicly --// or privately, into the current compilation. -- --bool --d_gcc_force_templates (void) --{ -- return ObjectFile::emitTemplates == TEprivate; --} -- - // Return the DECL_CONTEXT for symbol DSYM. - - tree - d_decl_context (Dsymbol *dsym) - { -- Dsymbol *orig_sym = dsym; -+ Dsymbol *parent = dsym; - AggregateDeclaration *ad; - -- while ((dsym = dsym->toParent2())) -+ while ((parent = parent->toParent2())) - { -- if (dsym->isFuncDeclaration()) -+ if (parent->isFuncDeclaration()) - { -- // dwarf2out chokes without this check... (output_pubnames) -- FuncDeclaration *f = orig_sym->isFuncDeclaration(); -- if (f && !needs_static_chain (f)) -+ FuncDeclaration *fd = dsym->isFuncDeclaration(); -+ if (fd && !needs_static_chain (fd)) - return NULL_TREE; - -- return dsym->toSymbol()->Stree; -+ return parent->toSymbol()->Stree; - } -- else if ((ad = dsym->isAggregateDeclaration())) -+ else if ((ad = parent->isAggregateDeclaration())) - { - tree context = ad->type->toCtype(); -+ // Want the underlying RECORD_TYPE. - if (ad->isClassDeclaration()) -- { -- // RECORD_TYPE instead of REFERENCE_TYPE -- context = TREE_TYPE (context); -- } -+ context = TREE_TYPE (context); -+ - return context; - } -- else if (dsym->isModule()) -- return dsym->toSymbol()->ScontextDecl; -+ else if (parent->isModule()) -+ { -+ // We've reached the top-level module namespace. -+ // Set DECL_CONTEXT as the NAMESPACE_DECL of the enclosing -+ // module, but only for extern(D) symbols. -+ Declaration *decl = dsym->isDeclaration(); -+ if (decl != NULL && decl->linkage != LINKd) -+ return NULL_TREE; -+ -+ return parent->toImport()->Stree; -+ } - } - - return NULL_TREE; - } - --// Add local variable VD into the current body. If NO_INIT, --// then variable does not have a default initialiser. -+// Add local variable VD into the current body of function fd. - - void --IRState::emitLocalVar (VarDeclaration *vd, bool no_init) -+build_local_var (VarDeclaration *vd, FuncDeclaration *fd) - { -- if (vd->isDataseg() || vd->isMember()) -- return; -+ gcc_assert (!vd->isDataseg() && !vd->isMember()); - - Symbol *sym = vd->toSymbol(); -- tree var_decl = sym->Stree; -- -- gcc_assert (!TREE_STATIC (var_decl)); -- pushdecl (var_decl); -+ tree var = sym->Stree; - -- if (TREE_CODE (var_decl) == CONST_DECL) -- return; -+ gcc_assert (!TREE_STATIC (var)); - -- DECL_CONTEXT (var_decl) = current_function_decl; -+ set_input_location (vd->loc); -+ d_pushdecl (var); -+ DECL_CONTEXT (var) = fd->toSymbol()->Stree; - - // Compiler generated symbols -- if (vd == this->func->vresult || vd == this->func->v_argptr -- || vd == this->func->v_arguments_var) -- DECL_ARTIFICIAL (var_decl) = 1; -+ if (vd == fd->vresult || vd == fd->v_argptr || vd == fd->v_arguments_var) -+ DECL_ARTIFICIAL (var) = 1; - -- tree var_exp; - if (sym->SframeField) - { - // Fixes debugging local variables. -- SET_DECL_VALUE_EXPR (var_decl, var (vd)); -- DECL_HAS_VALUE_EXPR_P (var_decl) = 1; -- } -- var_exp = var_decl; -- -- // Complete initializer expression (include MODIFY_EXPR, e.g.) -- tree init_exp = NULL_TREE; -- tree init_val = NULL_TREE; -- -- if (!no_init && !DECL_INITIAL (var_decl) && vd->init) -- { -- if (!vd->init->isVoidInitializer()) -- { -- ExpInitializer *exp_init = vd->init->isExpInitializer(); -- Expression *ie = exp_init->toExpression(); -- init_exp = ie->toElem (this); -- } -- else -- no_init = true; -- } -- else -- gcc_assert (vd->init == NULL); -- -- if (!no_init) -- { -- object_file->doLineNote (vd->loc); -- -- if (!init_val) -- { -- init_val = DECL_INITIAL (var_decl); -- DECL_INITIAL (var_decl) = NULL_TREE; -- } -- if (!init_exp && init_val) -- init_exp = build_vinit (var_exp, init_val); -- -- if (init_exp) -- addExp (init_exp); -- else if (!init_val && vd->size (vd->loc)) -- // Zero-length arrays do not have an initializer -- warning (OPT_Wuninitialized, "uninitialized variable '%s'", vd->ident ? vd->ident->string : "(no name)"); -+ SET_DECL_VALUE_EXPR (var, get_decl_tree (vd, fd)); -+ DECL_HAS_VALUE_EXPR_P (var) = 1; - } - } - - // Return an unnamed local temporary of type TYPE. - - tree --build_local_var (tree type) -+build_local_temp (tree type) - { - tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL_TREE, type); - - DECL_CONTEXT (decl) = current_function_decl; - DECL_ARTIFICIAL (decl) = 1; - DECL_IGNORED_P (decl) = 1; -- pushdecl (decl); -+ d_pushdecl (decl); - - return decl; - } -@@ -205,22 +157,22 @@ maybe_temporary_var (tree exp, tree *out - // Emit an INIT_EXPR for decl DECL. - - void --IRState::expandDecl (tree decl) -+expand_decl (tree decl) - { -- // nothing, pushdecl will add decl to a BIND_EXPR -+ // Nothing, d_pushdecl will add decl to a BIND_EXPR - if (DECL_INITIAL (decl)) - { - tree exp = build_vinit (decl, DECL_INITIAL (decl)); -- addExp (exp); -+ current_irstate->addExp (exp); - DECL_INITIAL (decl) = NULL_TREE; - } - } - --// Return the correct decl to be used for variable VD. --// Could be a VAR_DECL, or a FIELD_DECL from a closure. -+// Return the correct decl to be used for variable DECL accessed from -+// function FUNC. Could be a VAR_DECL, or a FIELD_DECL from a closure. - - tree --IRState::var (Declaration *decl) -+get_decl_tree (Declaration *decl, FuncDeclaration *func) - { - VarDeclaration *vd = decl->isVarDeclaration(); - -@@ -236,12 +188,10 @@ IRState::var (Declaration *decl) - else if (vsym->SframeField != NULL_TREE) - { - // Get the closure holding the var decl. -- FuncDeclaration *fd = vd->toParent2()->isFuncDeclaration(); -- tree frame_ref = get_framedecl (this->func, fd); -- tree field = vsym->SframeField; -+ FuncDeclaration *parent = vd->toParent2()->isFuncDeclaration(); -+ tree frame_ref = get_framedecl (func, parent); - -- gcc_assert (field != NULL_TREE); -- return component_ref (build_deref (frame_ref), field); -+ return component_ref (build_deref (frame_ref), vsym->SframeField); - } - } - -@@ -255,33 +205,33 @@ tree - d_convert (tree type, tree exp) - { - // Check this first before passing to build_dtype. -- if (error_mark_p (type) || error_mark_p (TREE_TYPE (exp))) -+ if (error_operand_p (type) || error_operand_p (exp)) - return error_mark_node; - -- Type *target_type = build_dtype (type); -- Type *expr_type = build_dtype (TREE_TYPE (exp)); -+ Type *totype = build_dtype (type); -+ Type *etype = build_dtype (TREE_TYPE (exp)); - -- if (target_type && expr_type) -- return convert_expr (exp, expr_type, target_type); -+ if (totype && etype) -+ return convert_expr (exp, etype, totype); - - return convert (type, exp); - } - --// Return expression EXP, whose type has been convert from EXP_TYPE to TARGET_TYPE. -+// Return expression EXP, whose type has been convert from ETYPE to TOTYPE. - - tree --convert_expr (tree exp, Type *exp_type, Type *target_type) -+convert_expr (tree exp, Type *etype, Type *totype) - { - tree result = NULL_TREE; - -- gcc_assert (exp_type && target_type); -- Type *ebtype = exp_type->toBasetype(); -- Type *tbtype = target_type->toBasetype(); -+ gcc_assert (etype && totype); -+ Type *ebtype = etype->toBasetype(); -+ Type *tbtype = totype->toBasetype(); - -- if (d_types_same (exp_type, target_type)) -+ if (d_types_same (etype, totype)) - return exp; - -- if (error_mark_p (exp)) -+ if (error_operand_p (exp)) - return exp; - - switch (ebtype->ty) -@@ -290,8 +240,7 @@ convert_expr (tree exp, Type *exp_type, - if (tbtype->ty == Tdelegate) - { - exp = maybe_make_temp (exp); -- return build_delegate_cst (delegate_method (exp), delegate_object (exp), -- target_type); -+ return build_delegate_cst (delegate_method (exp), delegate_object (exp), totype); - } - else if (tbtype->ty == Tpointer) - { -@@ -301,28 +250,28 @@ convert_expr (tree exp, Type *exp_type, - } - else - { -- ::error ("can't convert a delegate expression to %s", target_type->toChars()); -- return error_mark (target_type); -+ error ("can't convert a delegate expression to %s", totype->toChars()); -+ return error_mark_node; - } - break; - - case Tstruct: - if (tbtype->ty == Tstruct) - { -- if (target_type->size() == exp_type->size()) -+ if (totype->size() == etype->size()) - { - // Allowed to cast to structs with same type size. -- result = build_vconvert (target_type->toCtype(), exp); -+ result = build_vconvert (totype->toCtype(), exp); - } - else if (tbtype->ty == Taarray) - { - tbtype = ((TypeAArray *) tbtype)->getImpl()->type; -- return convert_expr (exp, exp_type, tbtype); -+ return convert_expr (exp, etype, tbtype); - } - else - { -- ::error ("can't convert struct %s to %s", exp_type->toChars(), target_type->toChars()); -- return error_mark (target_type); -+ error ("can't convert struct %s to %s", etype->toChars(), totype->toChars()); -+ return error_mark_node; - } - } - // else, default conversion, which should produce an error -@@ -331,62 +280,56 @@ convert_expr (tree exp, Type *exp_type, - case Tclass: - if (tbtype->ty == Tclass) - { -- ClassDeclaration *target_class_decl = ((TypeClass *) tbtype)->sym; -- ClassDeclaration *obj_class_decl = ((TypeClass *) ebtype)->sym; -- bool use_dynamic = false; -+ ClassDeclaration *cdfrom = tbtype->isClassHandle(); -+ ClassDeclaration *cdto = ebtype->isClassHandle(); - int offset; - -- if (target_class_decl->isBaseOf (obj_class_decl, &offset)) -+ if (cdfrom->isBaseOf (cdto, &offset) && offset != OFFSET_RUNTIME) - { - // Casting up the inheritance tree: Don't do anything special. - // Cast to an implemented interface: Handle at compile time. -- if (offset == OFFSET_RUNTIME) -- use_dynamic = true; -- else if (offset) -+ if (offset) - { -- tree t = target_type->toCtype(); -+ tree t = totype->toCtype(); - exp = maybe_make_temp (exp); - return build3 (COND_EXPR, t, - build_boolop (NE_EXPR, exp, d_null_pointer), - build_nop (t, build_offset (exp, size_int (offset))), - build_nop (t, d_null_pointer)); - } -- else -- { -- // d_convert will make a NOP cast -- break; -- } -- } -- else if (target_class_decl == obj_class_decl) -- { -- // d_convert will make a NOP cast -+ -+ // d_convert will make a no-op cast - break; - } -- else if (!obj_class_decl->isCOMclass()) -- use_dynamic = true; - -- if (use_dynamic) -- { -- // Otherwise, do dynamic cast -- tree args[2]; -+ // More cases for no-op cast -+ if (cdfrom == cdto) -+ break; - -- args[0] = exp; -- args[1] = build_address (target_class_decl->toSymbol()->Stree); -+ if (cdfrom->cpp && cdto->cpp) -+ break; - -- return build_libcall (obj_class_decl->isInterfaceDeclaration() -- ? LIBCALL_INTERFACE_CAST : LIBCALL_DYNAMIC_CAST, 2, args); -- } -- else -+ // Casting from a C++ interface to a class/non-C++ interface -+ // always results in null as there is no runtime information, -+ // and no way one can derive from the other. -+ if (cdto->isCOMclass() || cdfrom->cpp != cdto->cpp) - { -- warning (OPT_Wcast_result, "cast to %s will produce null result", target_type->toChars()); -- result = d_convert (target_type->toCtype(), d_null_pointer); -+ warning (OPT_Wcast_result, "cast to %s will produce null result", totype->toChars()); -+ result = d_convert (totype->toCtype(), d_null_pointer); -+ // Make sure the expression is still evaluated if necessary - if (TREE_SIDE_EFFECTS (exp)) -- { -- // make sure the expression is still evaluated if necessary -- result = compound_expr (exp, result); -- } -+ result = compound_expr (exp, result); -+ - return result; - } -+ -+ // The offset can only be determined at runtime, do dynamic cast -+ tree args[2]; -+ args[0] = exp; -+ args[1] = build_address (cdfrom->toSymbol()->Stree); -+ -+ return build_libcall (cdto->isInterfaceDeclaration() -+ ? LIBCALL_INTERFACE_CAST : LIBCALL_DYNAMIC_CAST, 2, args); - } - // else default conversion - break; -@@ -394,7 +337,7 @@ convert_expr (tree exp, Type *exp_type, - case Tsarray: - if (tbtype->ty == Tpointer) - { -- result = build_nop (target_type->toCtype(), build_address (exp)); -+ result = build_nop (totype->toCtype(), build_address (exp)); - } - else if (tbtype->ty == Tarray) - { -@@ -406,40 +349,40 @@ convert_expr (tree exp, Type *exp_type, - - if ((dim * esize) % tsize != 0) - { -- ::error ("cannot cast %s to %s since sizes don't line up", -- exp_type->toChars(), target_type->toChars()); -- return error_mark (target_type); -+ error ("cannot cast %s to %s since sizes don't line up", -+ etype->toChars(), totype->toChars()); -+ return error_mark_node; - } - dim = (dim * esize) / tsize; - - // Assumes casting to dynamic array of same type or void -- return d_array_value (target_type->toCtype(), -- size_int (dim), build_nop (ptrtype, build_address (exp))); -+ return d_array_value (totype->toCtype(), size_int (dim), -+ build_nop (ptrtype, build_address (exp))); - } - else if (tbtype->ty == Tsarray) - { - // D apparently allows casting a static array to any static array type -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - } - else if (tbtype->ty == Tstruct) - { - // And allows casting a static array to any struct type too. - // %% type sizes should have already been checked by the frontend. -- gcc_assert (target_type->size() == exp_type->size()); -- result = build_vconvert (target_type->toCtype(), exp); -+ gcc_assert (totype->size() == etype->size()); -+ result = build_vconvert (totype->toCtype(), exp); - } - else - { -- ::error ("cannot cast expression of type %s to type %s", -- exp_type->toChars(), target_type->toChars()); -- return error_mark (target_type); -+ error ("cannot cast expression of type %s to type %s", -+ etype->toChars(), totype->toChars()); -+ return error_mark_node; - } - break; - - case Tarray: - if (tbtype->ty == Tpointer) - { -- return d_convert (target_type->toCtype(), d_array_ptr (exp)); -+ return d_convert (totype->toCtype(), d_array_ptr (exp)); - } - else if (tbtype->ty == Tarray) - { -@@ -452,7 +395,7 @@ convert_expr (tree exp, Type *exp_type, - if (sz_src == sz_dst) - { - // Convert from void[] or elements are the same size -- don't change length -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - } - else - { -@@ -463,49 +406,49 @@ convert_expr (tree exp, Type *exp_type, - args[1] = build_integer_cst (sz_src * mult, Type::tsize_t->toCtype()); - args[2] = exp; - -- return build_libcall (LIBCALL_ARRAYCAST, 3, args, target_type->toCtype()); -+ return build_libcall (LIBCALL_ARRAYCAST, 3, args, totype->toCtype()); - } - } - else if (tbtype->ty == Tsarray) - { - // %% Strings are treated as dynamic arrays D2. - if (ebtype->isString() && tbtype->isString()) -- return indirect_ref (target_type->toCtype(), d_array_ptr (exp)); -+ return indirect_ref (totype->toCtype(), d_array_ptr (exp)); - } - else - { -- ::error ("cannot cast expression of type %s to %s", -- exp_type->toChars(), target_type->toChars()); -- return error_mark (target_type); -+ error ("cannot cast expression of type %s to %s", -+ etype->toChars(), totype->toChars()); -+ return error_mark_node; - } - break; - - case Taarray: - if (tbtype->ty == Taarray) -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - else if (tbtype->ty == Tstruct) - { - ebtype = ((TypeAArray *) ebtype)->getImpl()->type; -- return convert_expr (exp, ebtype, target_type); -+ return convert_expr (exp, ebtype, totype); - } - // Can convert associative arrays to void pointers. - else if (tbtype == Type::tvoidptr) -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - // else, default conversion, which should product an error - break; - - case Tpointer: - // Can convert void pointers to associative arrays too... - if (tbtype->ty == Taarray && ebtype == Type::tvoidptr) -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - break; - - case Tnull: - if (tbtype->ty == Tarray) - { - tree ptrtype = tbtype->nextOf()->pointerTo()->toCtype(); -- return d_array_value (target_type->toCtype(), -- size_int (0), build_nop (ptrtype, exp)); -+ return d_array_value (totype->toCtype(), size_int (0), -+ build_nop (ptrtype, exp)); - } - break; - -@@ -513,57 +456,61 @@ convert_expr (tree exp, Type *exp_type, - if (tbtype->ty == Tsarray) - { - if (tbtype->size() == ebtype->size()) -- return build_vconvert (target_type->toCtype(), exp); -+ return build_vconvert (totype->toCtype(), exp); - } - break; - - default: -- exp = fold_convert (exp_type->toCtype(), exp); -+ exp = fold_convert (etype->toCtype(), exp); - gcc_assert (TREE_CODE (exp) != STRING_CST); - break; - } - - return result ? result : -- convert (target_type->toCtype(), exp); -+ convert (totype->toCtype(), exp); - } - - --// Apply semantics of assignment to a values of type TARGET_TYPE to EXPR -+// Apply semantics of assignment to a values of type TOTYPE to EXPR - // (e.g., pointer = array -> pointer = &array[0]) - --// Return a TREE representation of EXPR implictly converted to TARGET_TYPE -+// Return a TREE representation of EXPR implictly converted to TOTYPE - // for use in assignment expressions MODIFY_EXPR, INIT_EXPR... - - tree --convert_for_assignment (tree expr, Type *exp_type, Type *target_type) -+convert_for_assignment (tree expr, Type *etype, Type *totype) - { -- Type *ebtype = exp_type->toBasetype(); -- Type *tbtype = target_type->toBasetype(); -+ Type *ebtype = etype->toBasetype(); -+ Type *tbtype = totype->toBasetype(); - - // Assuming this only has to handle converting a non Tsarray type to - // arbitrarily dimensioned Tsarrays. - if (tbtype->ty == Tsarray) - { -- Type *sa_elem_type = tbtype->nextOf()->toBasetype(); -- -- while (sa_elem_type->ty == Tsarray) -- sa_elem_type = sa_elem_type->nextOf()->toBasetype(); -+ Type *telem = tbtype->nextOf()->baseElemOf(); - -- if (d_types_compatible (sa_elem_type, ebtype)) -+ if (d_types_compatible (telem, ebtype)) - { - // %% what about implicit converions...? - TypeSArray *sa_type = (TypeSArray *) tbtype; - uinteger_t count = sa_type->dim->toUInteger(); - -- tree ctor = build_constructor (target_type->toCtype(), NULL); -+ tree ctor = build_constructor (totype->toCtype(), NULL); - if (count) - { - vec<constructor_elt, va_gc> *ce = NULL; - tree index = build2 (RANGE_EXPR, Type::tsize_t->toCtype(), - integer_zero_node, build_integer_cst (count - 1)); -- tree value = convert_for_assignment (expr, exp_type, sa_type->next); -+ tree value = convert_for_assignment (expr, etype, sa_type->next); -+ -+ // Can't use VAR_DECLs in CONSTRUCTORS. -+ if (TREE_CODE (value) == VAR_DECL) -+ { -+ value = DECL_INITIAL (value); -+ gcc_assert (value); -+ } - -- CONSTRUCTOR_APPEND_ELT (ce, index, object_file->stripVarDecl (value)); -+ CONSTRUCTOR_APPEND_ELT (ce, index, value); - CONSTRUCTOR_ELTS (ctor) = ce; - } - TREE_READONLY (ctor) = 1; -@@ -579,7 +526,7 @@ convert_for_assignment (tree expr, Type - if (integer_zerop (expr)) - { - StructDeclaration *sd = ((TypeStruct *) tbtype)->sym; -- tree var = build_local_var (target_type->toCtype()); -+ tree var = build_local_temp (totype->toCtype()); - - tree init = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMSET), 3, - build_address (var), expr, -@@ -591,29 +538,25 @@ convert_for_assignment (tree expr, Type - gcc_unreachable(); - } - -- return convert_expr (expr, exp_type, target_type); -+ return convert_expr (expr, etype, totype); - } - - // Return a TREE representation of EXPR converted to represent parameter type ARG. - - tree --IRState::convertForArgument (Expression *expr, Parameter *arg) -+convert_for_argument (tree exp_tree, Expression *expr, Parameter *arg) - { - if (arg_reference_p (arg)) - { -- tree exp_tree = expr->toElem (this); -- // front-end already sometimes automatically takes the address -- // TODO: Make this safer? Can this be confused by a non-zero SymOff? -+ // Front-end already sometimes automatically takes the address - if (expr->op != TOKaddress && expr->op != TOKsymoff && expr->op != TOKadd) - exp_tree = build_address (exp_tree); - - return convert (type_passed_as (arg), exp_tree); - } -- else -- { -- // Lazy arguments: expr should already be a delegate -- return expr->toElem (this); -- } -+ -+ // Lazy arguments: expr should already be a delegate -+ return exp_tree; - } - - // Perform default promotions for data used in expressions. -@@ -633,7 +576,7 @@ convert_for_condition (tree expr, Type * - { - case Taarray: - // Shouldn't this be... -- // result = build_libcall (LIBCALL_AALEN, 1, &expr); -+ // result = _aaLen (&expr); - result = component_ref (expr, TYPE_FIELDS (TREE_TYPE (expr))); - break; - -@@ -687,17 +630,17 @@ convert_for_condition (tree expr, Type * - // EXP must be a static array or dynamic array. - - tree --IRState::toDArray (Expression *exp) -+d_array_convert (Expression *exp) - { - TY ty = exp->type->toBasetype()->ty; - -- if (ty == Tsarray) -+ if (ty == Tarray) -+ return exp->toElem (current_irstate); -+ else if (ty == Tsarray) - { - Type *totype = exp->type->toBasetype()->nextOf()->arrayOf(); -- return convert_expr (exp->toElem (this), exp->type, totype); -+ return convert_expr (exp->toElem (current_irstate), exp->type, totype); - } -- else if (ty == Tarray) -- return exp->toElem (this); - - // Invalid type passed. - gcc_unreachable(); -@@ -736,6 +679,8 @@ declaration_type (Declaration *decl) - TypeDelegate *t = new TypeDelegate (tf); - decl_type = t->merge()->toCtype(); - } -+ else if (decl->isThisDeclaration()) -+ decl_type = insert_type_modifiers (decl_type, MODconst); - - return decl_type; - } -@@ -765,6 +710,7 @@ tree - type_passed_as (Parameter *arg) - { - tree arg_type = arg->type->toCtype(); -+ - if (arg_reference_p (arg)) - arg_type = build_reference_type (arg_type); - else if (arg->storageClass & STClazy) -@@ -773,6 +719,7 @@ type_passed_as (Parameter *arg) - TypeDelegate *t = new TypeDelegate (tf); - arg_type = t->merge()->toCtype(); - } -+ - return arg_type; - } - -@@ -794,11 +741,13 @@ d_array_type (Type *d_type, uinteger_t s - NULL_TREE); - - tree array_type = build_array_type (type_node, index_type_node); -+ - if (size == 0) - { - TYPE_SIZE (array_type) = bitsize_zero_node; - TYPE_SIZE_UNIT (array_type) = size_zero_node; - } -+ - return array_type; - } - -@@ -853,7 +802,7 @@ d_attribute_p (const char* name) - return false; - - table = new StringTable(); -- table->init(n); -+ table->_init(n); - - for (const attribute_spec *p = d_attribute_table; p->name; p++) - table->insert(p->name, strlen(p->name)); -@@ -876,19 +825,22 @@ build_attributes (Expressions *in_attrs) - - for (size_t i = 0; i < in_attrs->dim; i++) - { -- Expression *attr = (*in_attrs)[i]->ctfeInterpret(); -+ Expression *attr = (*in_attrs)[i]->optimize (WANTexpand); - Dsymbol *sym = attr->type->toDsymbol (0); - - if (!sym) - continue; - -- Dsymbol *mod = (Dsymbol*) sym->getModule(); -+ Dsymbol *mod = (Dsymbol*) sym->getModule(); - if (!(strcmp(mod->toChars(), "attribute") == 0 -- && mod->parent -+ && mod->parent != NULL - && strcmp(mod->parent->toChars(), "gcc") == 0 - && !mod->parent->parent)) - continue; - -+ if (attr->op == TOKcall) -+ attr = attr->ctfeInterpret(); -+ - gcc_assert(attr->op == TOKstructliteral); - Expressions *elem = ((StructLiteralExp*) attr)->elements; - -@@ -921,7 +873,7 @@ build_attributes (Expressions *in_attrs) - aet = build_string (s->len, (const char *) s->string); - } - else -- aet = ae->toElem (cirstate); -+ aet = ae->toElem (current_irstate); - - args = chainon (args, build_tree_list (0, aet)); - } -@@ -975,31 +927,29 @@ tree - build_integer_cst (dinteger_t value, tree type) - { - // The type is error_mark_node, we can't do anything. -- if (error_mark_p (type)) -+ if (error_operand_p (type)) - return type; - - return build_int_cst_type (type, value); - } - --// Build REAL_CST of type TARGET_TYPE with the value VALUE. -+// Build REAL_CST of type TOTYPE with the value VALUE. - - tree --build_float_cst (const real_t& value, Type *target_type) -+build_float_cst (const real_t& value, Type *totype) - { - real_t new_value; -- TypeBasic *tb = target_type->isTypeBasic(); -+ TypeBasic *tb = totype->isTypeBasic(); - - gcc_assert (tb != NULL); - - tree type_node = tb->toCtype(); - real_convert (&new_value.rv(), TYPE_MODE (type_node), &value.rv()); - -+ // Value grew as a result of the conversion. %% precision bug ?? -+ // For now just revert back to original. - if (new_value > value) -- { -- // value grew as a result of the conversion. %% precision bug ?? -- // For now just revert back to original. -- new_value = value; -- } -+ new_value = value; - - return build_real (type_node, new_value.rv()); - } -@@ -1022,8 +972,11 @@ cst_to_hwi (double_int cst) - dinteger_t - tree_to_hwi (tree t) - { -- if (host_integerp (t, 0) || host_integerp (t, 1)) -- return tree_low_cst (t, 1); -+ if (TREE_INT_CST_HIGH (t) == 0 -+ || (TREE_INT_CST_HIGH (t) == -1 -+ && (HOST_WIDE_INT) TREE_INT_CST_LOW (t) < 0 -+ && !TYPE_UNSIGNED (TREE_TYPE (t)))) -+ return TREE_INT_CST_LOW (t); - - return cst_to_hwi (TREE_INT_CST (t)); - } -@@ -1034,7 +987,7 @@ tree - d_array_length (tree exp) - { - // backend will ICE otherwise -- if (error_mark_p (exp)) -+ if (error_operand_p (exp)) - return exp; - - // Get the backend type for the array and pick out the array -@@ -1049,7 +1002,7 @@ tree - d_array_ptr (tree exp) - { - // backend will ICE otherwise -- if (error_mark_p (exp)) -+ if (error_operand_p (exp)) - return exp; - - // Get the backend type for the array and pick out the array -@@ -1091,7 +1044,7 @@ tree - d_array_string (const char *str) - { - unsigned len = strlen (str); -- // Assumes str is null-terminated. -+ // Assumes STR is 0-terminated. - tree str_tree = build_string (len + 1, str); - - TREE_TYPE (str_tree) = d_array_type (Type::tchar, len); -@@ -1117,8 +1070,8 @@ get_array_length (tree exp, Type *type) - return d_array_length (exp); - - default: -- ::error ("can't determine the length of a %s", type->toChars()); -- return error_mark (type); -+ error ("can't determine the length of a %s", type->toChars()); -+ return error_mark_node; - } - } - -@@ -1140,6 +1093,52 @@ unhandled_arrayop_p (BinExp *exp) - return false; - } - -+// Create BINFO for a ClassDeclaration's inheritance tree. -+// Interfaces are not included. -+ -+tree -+build_class_binfo (tree super, ClassDeclaration *cd) -+{ -+ tree binfo = make_tree_binfo (1); -+ tree ctype = cd->type->toCtype(); -+ -+ // Want RECORD_TYPE, not REFERENCE_TYPE -+ BINFO_TYPE (binfo) = TREE_TYPE (ctype); -+ BINFO_INHERITANCE_CHAIN (binfo) = super; -+ BINFO_OFFSET (binfo) = integer_zero_node; -+ -+ if (cd->baseClass) -+ BINFO_BASE_APPEND (binfo, build_class_binfo (binfo, cd->baseClass)); -+ -+ return binfo; -+} -+ -+// Create BINFO for an InterfaceDeclaration's inheritance tree. -+// In order to access all inherited methods in the debugger, -+// the entire tree must be described. -+// This function makes assumptions about interface layout. -+ -+tree -+build_interface_binfo (tree super, ClassDeclaration *cd, unsigned& offset) -+{ -+ tree binfo = make_tree_binfo (cd->baseclasses->dim); -+ tree ctype = cd->type->toCtype(); -+ -+ // Want RECORD_TYPE, not REFERENCE_TYPE -+ BINFO_TYPE (binfo) = TREE_TYPE (ctype); -+ BINFO_INHERITANCE_CHAIN (binfo) = super; -+ BINFO_OFFSET (binfo) = size_int (offset * Target::ptrsize); -+ BINFO_VIRTUAL_P (binfo) = 1; -+ -+ for (size_t i = 0; i < cd->baseclasses->dim; i++, offset++) -+ { -+ BaseClass *bc = (*cd->baseclasses)[i]; -+ BINFO_BASE_APPEND (binfo, build_interface_binfo (binfo, bc->base, offset)); -+ } -+ -+ return binfo; -+} -+ - // Returns the .funcptr component from the D delegate EXP. - - tree -@@ -1163,7 +1162,7 @@ delegate_object (tree exp) - } - - // Build a delegate literal of type TYPE whose pointer function is --// METHOD, and hidden object is OBJECT. -+// METHOD, and hidden object is OBJECT. - - tree - build_delegate_cst (tree method, tree object, Type *type) -@@ -1254,7 +1253,7 @@ get_object_method (tree thisexp, Express - - if (objexp->op == TOKsuper - || objtype->ty == Tstruct || objtype->ty == Tpointer -- || func->isFinal() || !func->isVirtual() || is_dottype) -+ || func->isFinalFunc() || !func->isVirtual() || is_dottype) - { - if (objtype->ty == Tstruct) - thisexp = build_address (thisexp); -@@ -1287,56 +1286,58 @@ get_object_method (tree thisexp, Express - tree - build_two_field_type (tree t1, tree t2, Type *type, const char *n1, const char *n2) - { -- tree rec_type = make_node (RECORD_TYPE); -+ tree rectype = make_node (RECORD_TYPE); - tree f0 = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier (n1), t1); - tree f1 = build_decl (BUILTINS_LOCATION, FIELD_DECL, get_identifier (n2), t2); -- DECL_CONTEXT (f0) = rec_type; -- DECL_CONTEXT (f1) = rec_type; -- TYPE_FIELDS (rec_type) = chainon (f0, f1); -- layout_type (rec_type); -+ -+ DECL_CONTEXT (f0) = rectype; -+ DECL_CONTEXT (f1) = rectype; -+ TYPE_FIELDS (rectype) = chainon (f0, f1); -+ layout_type (rectype); -+ - if (type) - { -- /* This is needed so that maybeExpandSpecialCall knows to -- split dynamic array varargs. */ -- TYPE_LANG_SPECIFIC (rec_type) = build_d_type_lang_specific (type); -- -- /* ObjectFile::declareType will try to declare it as top-level type -- which can break debugging info for element types. */ -- tree stub_decl = build_decl (BUILTINS_LOCATION, TYPE_DECL, -- get_identifier (type->toChars()), rec_type); -- TYPE_STUB_DECL (rec_type) = stub_decl; -- TYPE_NAME (rec_type) = stub_decl; -- DECL_ARTIFICIAL (stub_decl) = 1; -- rest_of_decl_compilation (stub_decl, 0, 0); -+ tree ident = get_identifier (type->toChars()); -+ tree stubdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, ident, rectype); -+ -+ TYPE_STUB_DECL (rectype) = stubdecl; -+ TYPE_NAME (rectype) = stubdecl; -+ DECL_ARTIFICIAL (stubdecl) = 1; -+ rest_of_decl_compilation (stubdecl, 1, 0); - } -- return rec_type; -+ -+ return rectype; - } - --// Create a SAVE_EXPR if T might have unwanted side effects if referenced -+// Create a SAVE_EXPR if EXP might have unwanted side effects if referenced - // more than once in an expression. - - tree --maybe_make_temp (tree t) -+make_temp (tree exp) - { -- if (d_has_side_effects (t)) -- { -- if (TREE_CODE (t) == CALL_EXPR -- || TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE) -- return save_expr (t); -- else -- return stabilize_reference (t); -- } -+ if (TREE_CODE (exp) == CALL_EXPR -+ || TREE_CODE (TREE_TYPE (exp)) != ARRAY_TYPE) -+ return save_expr (exp); -+ else -+ return stabilize_reference (exp); -+} - -- return t; -+tree -+maybe_make_temp (tree exp) -+{ -+ if (d_has_side_effects (exp)) -+ return make_temp (exp); -+ -+ return exp; - } - --// Return TRUE if T can not be evaluated multiple times (i.e., in a loop body) -+// Return TRUE if EXP can not be evaluated multiple times (i.e., in a loop body) - // without unwanted side effects. - - bool --d_has_side_effects (tree expr) -+d_has_side_effects (tree exp) - { -- tree t = STRIP_NOPS (expr); -+ tree t = STRIP_NOPS (exp); - - // SAVE_EXPR is safe to reference more than once, but not to - // expand in a loop. -@@ -1362,14 +1363,14 @@ tree - build_address (tree exp) - { - tree t, ptrtype; -- tree exp_type = TREE_TYPE (exp); -+ tree type = TREE_TYPE (exp); - d_mark_addressable (exp); - - // Gimplify doesn't like &(* (ptr-to-array-type)) with static arrays - if (TREE_CODE (exp) == INDIRECT_REF) - { - t = TREE_OPERAND (exp, 0); -- ptrtype = build_pointer_type (exp_type); -+ ptrtype = build_pointer_type (type); - t = build_nop (ptrtype, t); - } - else -@@ -1377,18 +1378,18 @@ build_address (tree exp) - /* Just convert string literals (char[]) to C-style strings (char *), otherwise - the latter method (char[]*) causes conversion problems during gimplification. */ - if (TREE_CODE (exp) == STRING_CST) -- ptrtype = build_pointer_type (TREE_TYPE (exp_type)); -+ ptrtype = build_pointer_type (TREE_TYPE (type)); - /* Special case for va_list. The backends will be expecting a pointer to vatype, - * but some targets use an array. So fix it. */ -- else if (TYPE_MAIN_VARIANT (exp_type) == TYPE_MAIN_VARIANT (va_list_type_node)) -+ else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (va_list_type_node)) - { -- if (TREE_CODE (TYPE_MAIN_VARIANT (exp_type)) == ARRAY_TYPE) -- ptrtype = build_pointer_type (TREE_TYPE (exp_type)); -+ if (TREE_CODE (TYPE_MAIN_VARIANT (type)) == ARRAY_TYPE) -+ ptrtype = build_pointer_type (TREE_TYPE (type)); - else -- ptrtype = build_pointer_type (exp_type); -+ ptrtype = build_pointer_type (type); - } - else -- ptrtype = build_pointer_type (exp_type); -+ ptrtype = build_pointer_type (type); - - t = build1 (ADDR_EXPR, ptrtype, exp); - } -@@ -1532,6 +1533,79 @@ d_mark_read (tree exp) - return exp; - } - -+// Build equality expression between two RECORD_TYPES T1 and T2. -+// CODE is the EQ_EXPR or NE_EXPR comparison. -+// SD is the front-end struct type. -+ -+tree -+build_struct_memcmp (tree_code code, StructDeclaration *sd, tree t1, tree t2) -+{ -+ tree_code tcode = (code == EQ_EXPR) ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR; -+ tree tmemcmp = NULL_TREE; -+ -+ // Let backend take care of empty struct or union comparisons. -+ if (!sd->fields.dim || sd->isUnionDeclaration()) -+ { -+ tmemcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ build_address (t1), build_address (t2), -+ size_int (sd->structsize)); -+ -+ return build_boolop (code, tmemcmp, integer_zero_node); -+ } -+ -+ for (size_t i = 0; i < sd->fields.dim; i++) -+ { -+ VarDeclaration *vd = sd->fields[i]; -+ tree sfield = vd->toSymbol()->Stree; -+ -+ tree t1ref = component_ref (t1, sfield); -+ tree t2ref = component_ref (t2, sfield); -+ tree tcmp; -+ -+ if (vd->type->ty == Tstruct) -+ { -+ // Compare inner data structures. -+ StructDeclaration *decl = ((TypeStruct *) vd->type)->sym; -+ tcmp = build_struct_memcmp (code, decl, t1ref, t2ref); -+ } -+ else -+ { -+ tree stype = vd->type->toCtype(); -+ machine_mode mode = int_mode_for_mode (TYPE_MODE (stype)); -+ -+ if (vd->type->isintegral()) -+ { -+ // Integer comparison, no special handling required. -+ tcmp = build_boolop (code, t1ref, t2ref); -+ } -+ else if (mode != BLKmode) -+ { -+ // Compare field bits as their corresponding integer type. -+ // *((T*) &t1) == *((T*) &t2) -+ tree tmode = lang_hooks.types.type_for_mode (mode, 1); -+ -+ t1ref = build_vconvert (tmode, t1ref); -+ t2ref = build_vconvert (tmode, t2ref); -+ -+ tcmp = build_boolop (code, t1ref, t2ref); -+ } -+ else -+ { -+ // Simple memcmp between types. -+ tcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ build_address (t1ref), build_address (t2ref), -+ TYPE_SIZE_UNIT (stype)); -+ -+ tcmp = build_boolop (code, tcmp, integer_zero_node); -+ } -+ } -+ -+ tmemcmp = (tmemcmp) ? build_boolop (tcode, tmemcmp, tcmp) : tcmp; -+ } -+ -+ return tmemcmp; -+} -+ - // Cast EXP (which should be a pointer) to TYPE * and then indirect. The - // back-end requires this cast in many cases. - -@@ -1606,7 +1680,7 @@ build_array_index (tree ptr, tree index) - } - - // backend will ICE otherwise -- if (error_mark_p (result_type_node)) -+ if (error_operand_p (result_type_node)) - return result_type_node; - - if (integer_zerop (index)) -@@ -1619,7 +1693,7 @@ build_array_index (tree ptr, tree index) - // OP could be a plus or minus expression. - - tree --build_offset_op (enum tree_code op, tree ptr, tree idx) -+build_offset_op (tree_code op, tree ptr, tree idx) - { - gcc_assert (op == MINUS_EXPR || op == PLUS_EXPR); - -@@ -1656,7 +1730,7 @@ void_okay_p (tree t) - // and ARG1. Perform relevant conversions needs for correct code operations. - - tree --IRState::buildOp (tree_code code, tree type, tree arg0, tree arg1) -+build_binary_op (tree_code code, tree type, tree arg0, tree arg1) - { - tree t0 = TREE_TYPE (arg0); - tree t1 = TREE_TYPE (arg1); -@@ -1667,7 +1741,7 @@ IRState::buildOp (tree_code code, tree t - - // Deal with float mod expressions immediately. - if (code == FLOAT_MOD_EXPR) -- return floatMod (TREE_TYPE (arg0), arg0, arg1); -+ return build_float_modulus (TREE_TYPE (arg0), arg0, arg1); - - if (POINTER_TYPE_P (t0) && INTEGRAL_TYPE_P (t1)) - return build_nop (type, build_offset_op (code, arg0, arg1)); -@@ -1687,8 +1761,8 @@ IRState::buildOp (tree_code code, tree t - } - else if (INTEGRAL_TYPE_P (type) && (TYPE_UNSIGNED (type) != unsignedp)) - { -- t = build2 (code, unsignedp ? d_unsigned_type (type) : d_signed_type (type), -- arg0, arg1); -+ tree inttype = unsignedp ? d_unsigned_type (type) : d_signed_type (type); -+ t = build2 (code, inttype, arg0, arg1); - } - else - { -@@ -1705,34 +1779,6 @@ IRState::buildOp (tree_code code, tree t - return d_convert (type, t); - } - --// Build an assignment expression of code CODE, data type TYPE, and --// operands E1 and E2. -- --tree --IRState::buildAssignOp (tree_code code, Type *type, Expression *e1, Expression *e2) --{ -- // Skip casts for lhs assignment. -- Expression *e1b = e1; -- while (e1b->op == TOKcast) -- { -- CastExp *ce = (CastExp *) e1b; -- gcc_assert (d_types_compatible (ce->type, ce->to)); -- e1b = ce->e1; -- } -- -- // Prevent multiple evaluations of LHS -- tree lhs = e1b->toElem (this); -- lhs = stabilize_reference (lhs); -- -- tree rhs = buildOp (code, e1->type->toCtype(), -- convert_expr (lhs, e1b->type, e1->type), e2->toElem (this)); -- -- tree expr = modify_expr (lhs, convert_expr (rhs, e1->type, e1b->type)); -- -- return convert_expr (expr, e1b->type, type); --} -- -- - // Builds an array bounds checking condition, returning INDEX if true, - // else throws a RangeError exception. - -@@ -1781,7 +1827,7 @@ array_bounds_check (void) - if (result == 1) - { - // For D2 safe functions only -- FuncDeclaration *func = cirstate->func; -+ FuncDeclaration *func = current_irstate->func; - if (func && func->type->ty == Tfunction) - { - TypeFunction *tf = (TypeFunction *) func->type; -@@ -1793,133 +1839,6 @@ array_bounds_check (void) - return false; - } - --// Builds an array index expression from AE. ASC may build a --// BIND_EXPR if temporaries were created for bounds checking. -- --tree --IRState::arrayElemRef (IndexExp *ae, ArrayScope *asc) --{ -- Expression *e1 = ae->e1; -- Expression *e2 = ae->e2; -- -- Type *base_type = e1->type->toBasetype(); -- TY base_type_ty = base_type->ty; -- // expression that holds the array data. -- tree array_expr = e1->toElem (this); -- // expression that indexes the array data -- tree subscript_expr = e2->toElem (this); -- // base pointer to the elements -- tree ptr_exp; -- // reference the the element -- tree elem_ref; -- -- switch (base_type_ty) -- { -- case Tarray: -- case Tsarray: -- array_expr = asc->setArrayExp (array_expr, e1->type); -- -- // If it's a static array and the index is constant, -- // the front end has already checked the bounds. -- if (array_bounds_check() && !(base_type_ty == Tsarray && e2->isConst())) -- { -- tree array_len_expr; -- // implement bounds check as a conditional expression: -- // array [inbounds(index) ? index : { throw ArrayBoundsError }] -- -- // First, set up the index expression to only be evaluated once. -- tree index_expr = maybe_make_temp (subscript_expr); -- -- if (base_type_ty == Tarray) -- { -- array_expr = maybe_make_temp (array_expr); -- array_len_expr = d_array_length (array_expr); -- } -- else -- array_len_expr = ((TypeSArray *) base_type)->dim->toElem (this); -- -- subscript_expr = d_checked_index (ae->loc, index_expr, -- array_len_expr, false); -- } -- -- if (base_type_ty == Tarray) -- ptr_exp = d_array_ptr (array_expr); -- else -- ptr_exp = build_address (array_expr); -- -- // This conversion is required for static arrays and is just-to-be-safe -- // for dynamic arrays -- ptr_exp = convert (base_type->nextOf()->pointerTo()->toCtype(), ptr_exp); -- break; -- -- case Tpointer: -- // Ignores array scope. -- ptr_exp = array_expr; -- break; -- -- default: -- gcc_unreachable(); -- } -- -- ptr_exp = void_okay_p (ptr_exp); -- subscript_expr = asc->finish (subscript_expr); -- elem_ref = indirect_ref (TREE_TYPE (TREE_TYPE (ptr_exp)), -- build_array_index (ptr_exp, subscript_expr)); -- -- return elem_ref; --} -- -- --void --IRState::doArraySet (tree in_ptr, tree in_value, tree in_count) --{ -- startBindings(); -- -- tree count = build_local_var (size_type_node); -- DECL_INITIAL (count) = in_count; -- expandDecl (count); -- -- tree ptr = build_local_var (TREE_TYPE (in_ptr)); -- DECL_INITIAL (ptr) = in_ptr; -- expandDecl (ptr); -- -- tree ptr_type = TREE_TYPE (ptr); -- tree count_type = TREE_TYPE (count); -- -- tree value = NULL_TREE; -- -- if (!d_has_side_effects (in_value)) -- value = in_value; -- else -- { -- value = build_local_var (TREE_TYPE (in_value)); -- DECL_INITIAL (value) = in_value; -- expandDecl (value); -- } -- -- startLoop (NULL); -- continueHere(); -- exitIfFalse (build2 (NE_EXPR, boolean_type_node, -- d_convert (TREE_TYPE (count), integer_zero_node), count)); -- -- addExp (vmodify_expr (build_deref (ptr), value)); -- addExp (vmodify_expr (ptr, build_offset (ptr, TYPE_SIZE_UNIT (TREE_TYPE (ptr_type))))); -- addExp (vmodify_expr (count, build2 (MINUS_EXPR, count_type, count, -- d_convert (count_type, integer_one_node)))); -- -- endLoop(); -- endBindings(); --} -- --// Create a tree node to set multiple elements to a single value --tree --IRState::arraySetExpr (tree ptr, tree value, tree count) --{ -- pushStatementList(); -- doArraySet (ptr, value, count); -- return popStatementList(); --} -- - // Builds a BIND_EXPR around BODY for the variables VAR_CHAIN. - - tree -@@ -1935,7 +1854,7 @@ bind_expr (tree var_chain, tree body) - body = compound_expr (ini, body); - } - -- return save_expr (build3 (BIND_EXPR, TREE_TYPE (body), var_chain, body, NULL_TREE)); -+ return make_temp (build3 (BIND_EXPR, TREE_TYPE (body), var_chain, body, NULL_TREE)); - } - - // Like compound_expr, but ARG0 or ARG1 might be NULL_TREE. -@@ -1964,17 +1883,6 @@ maybe_vcompound_expr (tree arg0, tree ar - return vcompound_expr (arg0, arg1); - } - --// Returns TRUE if T is an ERROR_MARK node. -- --bool --error_mark_p (tree t) --{ -- return (t == error_mark_node -- || (t && TREE_TYPE (t) == error_mark_node) -- || (t && TREE_CODE (t) == NOP_EXPR -- && TREE_OPERAND (t, 0) == error_mark_node)); --} -- - // Returns the TypeFunction class for Type T. - // Assumes T is already ->toBasetype() - -@@ -2014,133 +1922,46 @@ call_by_alias_p (FuncDeclaration *caller - return true; - } - --// Entry point for call routines. Extracts the callee, object, --// and function type from expression EXPR, passing down ARGUMENTS. -- --tree --IRState::call (Expression *expr, Expressions *arguments) --{ -- // Calls to delegates can sometimes look like this: -- if (expr->op == TOKcomma) -- { -- CommaExp *ce = (CommaExp *) expr; -- expr = ce->e2; -- -- VarExp *ve; -- gcc_assert (ce->e2->op == TOKvar); -- ve = (VarExp *) ce->e2; -- gcc_assert (ve->var->isFuncDeclaration() && !ve->var->needThis()); -- } -- -- Type *t = expr->type->toBasetype(); -- TypeFunction *tf = NULL; -- tree callee = expr->toElem (this); -- tree object = NULL_TREE; -- -- if (D_METHOD_CALL_EXPR (callee)) -- { -- /* This could be a delegate expression (TY == Tdelegate), but not -- actually a delegate variable. */ -- // %% Is this ever not a DotVarExp ? -- if (expr->op == TOKdotvar) -- { -- /* This gets the true function type, the latter way can sometimes -- be incorrect. Example: ref functions in D2. */ -- tf = get_function_type (((DotVarExp *) expr)->var->type); -- } -- else -- tf = get_function_type (t); -- -- extract_from_method_call (callee, callee, object); -- } -- else if (t->ty == Tdelegate) -- { -- tf = (TypeFunction *) ((TypeDelegate *) t)->next; -- callee = maybe_make_temp (callee); -- object = delegate_object (callee); -- callee = delegate_method (callee); -- } -- else if (expr->op == TOKvar) -- { -- FuncDeclaration *fd = ((VarExp *) expr)->var->isFuncDeclaration(); -- gcc_assert (fd); -- tf = (TypeFunction *) fd->type; -- if (fd->isNested()) -- { -- if (call_by_alias_p (func, fd)) -- { -- // Re-evaluate symbol storage treating 'fd' as public. -- object_file->setupSymbolStorage (fd, callee, true); -- } -- object = getFrameForSymbol (fd); -- } -- else if (fd->needThis()) -- { -- expr->error ("need 'this' to access member %s", fd->toChars()); -- object = d_null_pointer; // continue processing... -- } -- } -- else -- { -- tf = get_function_type (t); -- } -- return call (tf, callee, object, arguments); --} -- --// Like above, but is assumed to be a direct call to FUNC_DECL. --// ARGS are the arguments passed. -+// Entry point for call routines. Builds a function call to FD. -+// OBJECT is the 'this' reference passed and ARGS are the arguments to FD. - - tree --IRState::call (FuncDeclaration *func_decl, Expressions *args) -+d_build_call (FuncDeclaration *fd, tree object, Expressions *args) - { -- // Otherwise need to copy code from above -- gcc_assert (!func_decl->isNested()); -- -- return call (get_function_type (func_decl->type), -- func_decl->toSymbol()->Stree, NULL_TREE, args); -+ return d_build_call (get_function_type (fd->type), -+ build_address (fd->toSymbol()->Stree), object, args); - } - --// Like above, but FUNC_DECL is a nested function, method, delegate or lambda. --// OBJECT is the 'this' reference passed and ARGS are the arguments passed. -- --tree --IRState::call (FuncDeclaration *func_decl, tree object, Expressions *args) --{ -- return call (get_function_type (func_decl->type), -- build_address (func_decl->toSymbol()->Stree), object, args); --} -- --// Builds a CALL_EXPR of type FUNC_TYPE to CALLABLE. OBJECT holds the 'this' pointer, -+// Builds a CALL_EXPR of type TF to CALLABLE. OBJECT holds the 'this' pointer, - // ARGUMENTS are evaluated in left to right order, saved and promoted before passing. - - tree --IRState::call (TypeFunction *func_type, tree callable, tree object, Expressions *arguments) -+d_build_call (TypeFunction *tf, tree callable, tree object, Expressions *arguments) - { -- tree func_type_node = TREE_TYPE (callable); -- tree actual_callee = callable; -+ IRState *irs = current_irstate; -+ tree ctype = TREE_TYPE (callable); -+ tree callee = callable; - tree saved_args = NULL_TREE; - - tree arg_list = NULL_TREE; - -- if (POINTER_TYPE_P (func_type_node)) -- func_type_node = TREE_TYPE (func_type_node); -+ if (POINTER_TYPE_P (ctype)) -+ ctype = TREE_TYPE (ctype); - else -- actual_callee = build_address (callable); -+ callee = build_address (callable); - -- gcc_assert (function_type_p (func_type_node)); -- gcc_assert (func_type != NULL); -- gcc_assert (func_type->ty == Tfunction); -+ gcc_assert (function_type_p (ctype)); -+ gcc_assert (tf != NULL); -+ gcc_assert (tf->ty == Tfunction); - - // Evaluate the callee before calling it. -- if (TREE_SIDE_EFFECTS (actual_callee)) -+ if (TREE_SIDE_EFFECTS (callee)) - { -- actual_callee = maybe_make_temp (actual_callee); -- saved_args = actual_callee; -+ callee = maybe_make_temp (callee); -+ saved_args = callee; - } - -- bool is_d_vararg = func_type->varargs == 1 && func_type->linkage == LINKd; -- -- if (TREE_CODE (func_type_node) == FUNCTION_TYPE) -+ if (TREE_CODE (ctype) == FUNCTION_TYPE) - { - if (object != NULL_TREE) - gcc_unreachable(); -@@ -2151,72 +1972,82 @@ IRState::call (TypeFunction *func_type, - if (TREE_CODE (callable) == FUNCTION_DECL) - { - error ("need 'this' to access member %s", IDENTIFIER_POINTER (DECL_NAME (callable))); -- return error_mark (func_type); -+ return error_mark_node; - } - - // Probably an internal error - gcc_unreachable(); - } -+ - /* If this is a delegate call or a nested function being called as - a delegate, the object should not be NULL. */ - if (object != NULL_TREE) - arg_list = build_tree_list (NULL_TREE, object); - -- Parameters *formal_args = func_type->parameters; // can be NULL for genCfunc decls -- size_t n_formal_args = formal_args ? (int) Parameter::dim (formal_args) : 0; -- size_t n_actual_args = arguments ? arguments->dim : 0; -- size_t fi = 0; -- -- // assumes arguments->dim <= formal_args->dim if (!this->varargs) -- for (size_t ai = 0; ai < n_actual_args; ++ai) -+ if (arguments) - { -- tree arg_tree; -- Expression *arg_exp = (*arguments)[ai]; -- -- if (ai == 0 && is_d_vararg) -- { -- // The hidden _arguments parameter -- arg_tree = arg_exp->toElem (this); -- } -- else if (fi < n_formal_args) -+ // First pass, evaluated expanded tuples in function arguments. -+ for (size_t i = 0; i < arguments->dim; ++i) - { -- // Actual arguments for declared formal arguments -- Parameter *formal_arg = Parameter::getNth (formal_args, fi); -- arg_tree = convertForArgument (arg_exp, formal_arg); -- ++fi; -+ Lagain: -+ Expression *arg = (*arguments)[i]; -+ gcc_assert (arg->op != TOKtuple); -+ -+ if (arg->op == TOKcomma) -+ { -+ CommaExp *ce = (CommaExp *) arg; -+ tree tce = ce->e1->toElem (irs); -+ saved_args = maybe_vcompound_expr (saved_args, tce); -+ (*arguments)[i] = ce->e2; -+ goto Lagain; -+ } - } -- else -+ -+ // if _arguments[] is the first argument. -+ size_t dvarargs = (tf->linkage == LINKd && tf->varargs == 1); -+ size_t nparams = Parameter::dim (tf->parameters); -+ -+ // Assumes arguments->dim <= formal_args->dim if (!this->varargs) -+ for (size_t i = 0; i < arguments->dim; ++i) - { -- if (flag_split_darrays && arg_exp->type->toBasetype()->ty == Tarray) -+ Expression *arg = (*arguments)[i]; -+ tree targ; -+ -+ if (i < dvarargs) - { -- tree da_exp = maybe_make_temp (arg_exp->toElem (this)); -- arg_list = chainon (arg_list, build_tree_list (0, d_array_length (da_exp))); -- arg_list = chainon (arg_list, build_tree_list (0, d_array_ptr (da_exp))); -- continue; -+ // The hidden _arguments parameter -+ targ = arg->toElem (irs); -+ } -+ else if (i - dvarargs < nparams && i >= dvarargs) -+ { -+ // Actual arguments for declared formal arguments -+ Parameter *parg = Parameter::getNth (tf->parameters, i - dvarargs); -+ targ = convert_for_argument (arg->toElem (irs), arg, parg); - } - else - { -- arg_tree = arg_exp->toElem (this); -- /* Not all targets support passing unpromoted types, so -- promote anyway. */ -- tree prom_type = lang_hooks.types.type_promotes_to (TREE_TYPE (arg_tree)); -- if (prom_type != TREE_TYPE (arg_tree)) -- arg_tree = convert (prom_type, arg_tree); -+ // Not all targets support passing unpromoted types, so -+ // promote anyway. -+ targ = arg->toElem (irs); -+ tree ptype = lang_hooks.types.type_promotes_to (TREE_TYPE (targ)); -+ -+ if (ptype != TREE_TYPE (targ)) -+ targ = convert (ptype, targ); - } -- } -- /* Evaluate the argument before passing to the function. -- Needed for left to right evaluation. */ -- if (func_type->linkage == LINKd && TREE_SIDE_EFFECTS (arg_tree)) -- { -- arg_tree = maybe_make_temp (arg_tree); -- saved_args = maybe_vcompound_expr (saved_args, arg_tree); -- } - -- arg_list = chainon (arg_list, build_tree_list (0, arg_tree)); -+ // Evaluate the argument before passing to the function. -+ // Needed for left to right evaluation. -+ if (tf->linkage == LINKd && TREE_SIDE_EFFECTS (targ)) -+ { -+ targ = maybe_make_temp (targ); -+ saved_args = maybe_vcompound_expr (saved_args, targ); -+ } -+ arg_list = chainon (arg_list, build_tree_list (0, targ)); -+ } - } - -- tree result = d_build_call (TREE_TYPE (func_type_node), actual_callee, arg_list); -- result = maybeExpandSpecialCall (result); -+ tree result = d_build_call_list (TREE_TYPE (ctype), callee, arg_list); -+ result = maybe_expand_builtin (result); - - return maybe_compound_expr (saved_args, result); - } -@@ -2253,21 +2084,11 @@ d_assert_call (Loc loc, LibCall libcall, - // List kept in ascii collating order to allow binary search - - static const char *libcall_ids[LIBCALL_count] = { -- /*"_d_invariant",*/ "_D9invariant12_d_invariantFC6ObjectZv", -- "_aApplyRcd1", "_aApplyRcd2", "_aApplyRcw1", "_aApplyRcw2", -- "_aApplyRdc1", "_aApplyRdc2", "_aApplyRdw1", "_aApplyRdw2", -- "_aApplyRwc1", "_aApplyRwc2", "_aApplyRwd1", "_aApplyRwd2", -- "_aApplycd1", "_aApplycd2", "_aApplycw1", "_aApplycw2", -- "_aApplydc1", "_aApplydc2", "_aApplydw1", "_aApplydw2", -- "_aApplywc1", "_aApplywc2", "_aApplywd1", "_aApplywd2", -- "_aaApply", "_aaApply2", -+ "_D9invariant12_d_invariantFC6ObjectZv", - "_aaDelX", "_aaEqual", - "_aaGetRvalueX", "_aaGetX", -- "_aaInX", "_aaLen", -- "_adCmp", "_adCmp2", -- "_adDupT", "_adEq", "_adEq2", -- "_adReverse", "_adReverseChar", "_adReverseWchar", -- "_adSort", "_adSortChar", "_adSortWchar", -+ "_aaInX", -+ "_adCmp2", "_adEq2", - "_d_allocmemory", "_d_array_bounds", - "_d_arrayappendT", "_d_arrayappendcTX", - "_d_arrayappendcd", "_d_arrayappendwd", -@@ -2280,11 +2101,9 @@ static const char *libcall_ids[LIBCALL_c - "_d_assert", "_d_assert_msg", - "_d_assocarrayliteralTX", - "_d_callfinalizer", "_d_callinterfacefinalizer", -- "_d_criticalenter", "_d_criticalexit", - "_d_delarray", "_d_delarray_t", "_d_delclass", - "_d_delinterface", "_d_delmemory", - "_d_dynamic_cast", "_d_hidden_func", "_d_interface_cast", -- "_d_monitorenter", "_d_monitorexit", - "_d_newarrayT", "_d_newarrayiT", - "_d_newarraymTX", "_d_newarraymiTX", - "_d_newclass", "_d_newitemT", "_d_newitemiT", -@@ -2304,9 +2123,7 @@ get_libcall (LibCall libcall) - { - FuncDeclaration *decl = libcall_decls[libcall]; - -- static Type *aa_type = NULL; -- static Type *dg_type = NULL; -- static Type *dg2_type = NULL; -+ static Type *aatype = NULL; - - if (!decl) - { -@@ -2315,27 +2132,8 @@ get_libcall (LibCall libcall) - bool varargs = false; - - // Build generic AA type void*[void*] -- if (aa_type == NULL) -- aa_type = new TypeAArray (Type::tvoidptr, Type::tvoidptr); -- -- // Build generic delegate type int(void*) -- if (dg_type == NULL) -- { -- Parameters *fn_parms = new Parameters; -- fn_parms->push (new Parameter (STCin, Type::tvoidptr, NULL, NULL)); -- Type *fn_type = new TypeFunction (fn_parms, Type::tint32, false, LINKd); -- dg_type = new TypeDelegate (fn_type); -- } -- -- // Build generic delegate type int(void*, void*) -- if (dg2_type == NULL) -- { -- Parameters *fn_parms = new Parameters; -- fn_parms->push (new Parameter (STCin, Type::tvoidptr, NULL, NULL)); -- fn_parms->push (new Parameter (STCin, Type::tvoidptr, NULL, NULL)); -- Type *fn_type = new TypeFunction (fn_parms, Type::tint32, false, LINKd); -- dg2_type = new TypeDelegate (fn_type); -- } -+ if (aatype == NULL) -+ aatype = new TypeAArray (Type::tvoidptr, Type::tvoidptr); - - switch (libcall) - { -@@ -2365,20 +2163,20 @@ get_libcall (LibCall libcall) - break; - - case LIBCALL_NEWCLASS: -- targs.push (ClassDeclaration::classinfo->type->constOf()); -- treturn = build_object_type (); -+ targs.push (Type::typeinfoclass->type->constOf()); -+ treturn = build_object_type(); - break; - - case LIBCALL_NEWARRAYT: - case LIBCALL_NEWARRAYIT: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - treturn = Type::tvoid->arrayOf(); - break; - - case LIBCALL_NEWARRAYMTX: - case LIBCALL_NEWARRAYMITX: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - targs.push (Type::tsize_t); - treturn = Type::tvoid->arrayOf(); -@@ -2386,7 +2184,7 @@ get_libcall (LibCall libcall) - - case LIBCALL_NEWITEMT: - case LIBCALL_NEWITEMIT: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - treturn = Type::tvoidptr; - break; - -@@ -2406,7 +2204,7 @@ get_libcall (LibCall libcall) - - case LIBCALL_DELARRAYT: - targs.push (Type::tvoid->arrayOf()->pointerTo()); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - break; - - case LIBCALL_DELMEMORY: -@@ -2420,7 +2218,7 @@ get_libcall (LibCall libcall) - - case LIBCALL_ARRAYSETLENGTHT: - case LIBCALL_ARRAYSETLENGTHIT: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - targs.push (Type::tvoid->arrayOf()->pointerTo()); - treturn = Type::tvoid->arrayOf(); -@@ -2428,59 +2226,52 @@ get_libcall (LibCall libcall) - - case LIBCALL_DYNAMIC_CAST: - case LIBCALL_INTERFACE_CAST: -- targs.push (build_object_type ()); -- targs.push (ClassDeclaration::classinfo->type); -- treturn = build_object_type (); -+ targs.push (build_object_type()); -+ targs.push (Type::typeinfoclass->type); -+ treturn = build_object_type(); - break; - -- case LIBCALL_ADEQ: - case LIBCALL_ADEQ2: -- case LIBCALL_ADCMP: - case LIBCALL_ADCMP2: - targs.push (Type::tvoid->arrayOf()); - targs.push (Type::tvoid->arrayOf()); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - treturn = Type::tint32; - break; - - case LIBCALL_AAEQUAL: -- targs.push (Type::typeinfo->type->constOf()); -- targs.push (aa_type); -- targs.push (aa_type); -+ targs.push (Type::dtypeinfo->type->constOf()); -+ targs.push (aatype); -+ targs.push (aatype); - treturn = Type::tint32; - break; - -- case LIBCALL_AALEN: -- targs.push (aa_type); -- treturn = Type::tsize_t; -- break; -- - case LIBCALL_AAINX: -- targs.push (aa_type); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (aatype); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tvoidptr); - treturn = Type::tvoidptr; - break; - - case LIBCALL_AAGETX: -- targs.push (aa_type->pointerTo()); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (aatype->pointerTo()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - targs.push (Type::tvoidptr); - treturn = Type::tvoidptr; - break; - - case LIBCALL_AAGETRVALUEX: -- targs.push (aa_type); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (aatype); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - targs.push (Type::tvoidptr); - treturn = Type::tvoidptr; - break; - - case LIBCALL_AADELX: -- targs.push (aa_type); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (aatype); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tvoidptr); - treturn = Type::tbool; - break; -@@ -2500,28 +2291,29 @@ get_libcall (LibCall libcall) - break; - - case LIBCALL_ARRAYCATT: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tint8->arrayOf()); - targs.push (Type::tint8->arrayOf()); - treturn = Type::tint8->arrayOf(); - break; - - case LIBCALL_ARRAYCATNT: -- targs.push (Type::typeinfo->type->constOf()); -- targs.push (Type::tuns32); // Currently 'uint', even if 64-bit -+ targs.push (Type::dtypeinfo->type->constOf()); -+ // Currently 'uint', even if 64-bit -+ targs.push (Type::tuns32); - varargs = true; - treturn = Type::tvoid->arrayOf(); - break; - - case LIBCALL_ARRAYAPPENDT: -- targs.push (Type::typeinfo->type); //->constOf()); -+ targs.push (Type::dtypeinfo->type); //->constOf()); - targs.push (Type::tint8->arrayOf()->pointerTo()); - targs.push (Type::tint8->arrayOf()); - treturn = Type::tvoid->arrayOf(); - break; - - case LIBCALL_ARRAYAPPENDCTX: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tint8->arrayOf()->pointerTo()); - targs.push (Type::tsize_t); - treturn = Type::tint8->arrayOf(); -@@ -2541,7 +2333,7 @@ get_libcall (LibCall libcall) - - case LIBCALL_ARRAYASSIGN: - case LIBCALL_ARRAYCTOR: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tvoid->arrayOf()); - targs.push (Type::tvoid->arrayOf()); - treturn = Type::tvoid->arrayOf(); -@@ -2552,20 +2344,13 @@ get_libcall (LibCall libcall) - targs.push (Type::tvoidptr); - targs.push (Type::tvoidptr); - targs.push (Type::tsize_t); -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - treturn = Type::tvoidptr; - break; - -- case LIBCALL_MONITORENTER: -- case LIBCALL_MONITOREXIT: - case LIBCALL_THROW: - case LIBCALL_INVARIANT: -- targs.push (build_object_type ()); -- break; -- -- case LIBCALL_CRITICALENTER: -- case LIBCALL_CRITICALEXIT: -- targs.push (Type::tvoidptr); -+ targs.push (build_object_type()); - break; - - case LIBCALL_SWITCH_USTRING: -@@ -2585,117 +2370,20 @@ get_libcall (LibCall libcall) - targs.push (Type::tchar->arrayOf()); - treturn = Type::tint32; - break; -+ - case LIBCALL_ASSOCARRAYLITERALTX: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tvoid->arrayOf()); - targs.push (Type::tvoid->arrayOf()); - treturn = Type::tvoidptr; - break; - - case LIBCALL_ARRAYLITERALTX: -- targs.push (Type::typeinfo->type->constOf()); -+ targs.push (Type::dtypeinfo->type->constOf()); - targs.push (Type::tsize_t); - treturn = Type::tvoidptr; - break; - -- case LIBCALL_ADSORTCHAR: -- case LIBCALL_ADREVERSECHAR: -- targs.push (Type::tchar->arrayOf()); -- treturn = Type::tchar->arrayOf(); -- break; -- -- case LIBCALL_ADSORTWCHAR: -- case LIBCALL_ADREVERSEWCHAR: -- targs.push (Type::twchar->arrayOf()); -- treturn = Type::twchar->arrayOf(); -- break; -- -- case LIBCALL_ADDUPT: -- targs.push (Type::typeinfo->type->constOf()); -- targs.push (Type::tvoid->arrayOf()); -- treturn = Type::tvoid->arrayOf(); -- break; -- -- case LIBCALL_ADREVERSE: -- targs.push (Type::tvoid->arrayOf()); -- targs.push (Type::tsize_t); -- treturn = Type::tvoid->arrayOf(); -- break; -- -- case LIBCALL_ADSORT: -- targs.push (Type::tvoid->arrayOf()); -- targs.push (Type::typeinfo->type->constOf()); -- treturn = Type::tvoid->arrayOf(); -- break; -- -- case LIBCALL_AAAPPLY: -- targs.push (aa_type); -- targs.push (Type::tsize_t); -- targs.push (dg_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAAPPLY2: -- targs.push (aa_type); -- targs.push (Type::tsize_t); -- targs.push (dg2_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYCD1: -- case LIBCALL_AAPPLYCW1: -- case LIBCALL_AAPPLYRCD1: -- case LIBCALL_AAPPLYRCW1: -- targs.push (Type::tchar->arrayOf()); -- targs.push (dg_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYCD2: -- case LIBCALL_AAPPLYCW2: -- case LIBCALL_AAPPLYRCD2: -- case LIBCALL_AAPPLYRCW2: -- targs.push (Type::tchar->arrayOf()); -- targs.push (dg2_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYDC1: -- case LIBCALL_AAPPLYDW1: -- case LIBCALL_AAPPLYRDC1: -- case LIBCALL_AAPPLYRDW1: -- targs.push (Type::tdchar->arrayOf()); -- targs.push (dg_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYDC2: -- case LIBCALL_AAPPLYDW2: -- case LIBCALL_AAPPLYRDC2: -- case LIBCALL_AAPPLYRDW2: -- targs.push (Type::tdchar->arrayOf()); -- targs.push (dg2_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYWC1: -- case LIBCALL_AAPPLYWD1: -- case LIBCALL_AAPPLYRWC1: -- case LIBCALL_AAPPLYRWD1: -- targs.push (Type::twchar->arrayOf()); -- targs.push (dg_type); -- treturn = Type::tint32; -- break; -- -- case LIBCALL_AAPPLYWC2: -- case LIBCALL_AAPPLYWD2: -- case LIBCALL_AAPPLYRWC2: -- case LIBCALL_AAPPLYRWD2: -- targs.push (Type::twchar->arrayOf()); -- targs.push (dg2_type); -- treturn = Type::tint32; -- break; -- - case LIBCALL_HIDDEN_FUNC: - /* Argument is an Object, but can't use that as - LIBCALL_HIDDEN_FUNC is needed before the Object type is -@@ -2707,22 +2395,17 @@ get_libcall (LibCall libcall) - gcc_unreachable(); - } - -- // Build extern(C) function. -- Identifier *id = Lexer::idPool(libcall_ids[libcall]); -- TypeFunction *tf = new TypeFunction(NULL, treturn, 0, LINKc); -- tf->varargs = varargs ? 1 : 0; -- -- decl = new FuncDeclaration(0, 0, id, STCstatic, tf); -- decl->protection = PROTpublic; -- decl->linkage = LINKc; -- - // Add parameter types. - Parameters *args = new Parameters; - args->setDim (targs.dim); - for (size_t i = 0; i < targs.dim; i++) - (*args)[i] = new Parameter (0, targs[i], NULL, NULL); - -- tf->parameters = args; -+ // Build extern(C) function. -+ decl = FuncDeclaration::genCfunc (args, treturn, libcall_ids[libcall]); -+ -+ TypeFunction *tf = (TypeFunction *) decl->type; -+ tf->varargs = varargs ? 1 : 0; - libcall_decls[libcall] = decl; - - // These functions do not return except through catching a thrown exception. -@@ -2753,7 +2436,7 @@ build_libcall (LibCall libcall, unsigned - for (int i = n_args - 1; i >= 0; i--) - arg_list = tree_cons (NULL_TREE, args[i], arg_list); - -- tree result = d_build_call (type->toCtype(), callee, arg_list); -+ tree result = d_build_call_list (type->toCtype(), callee, arg_list); - - // Assumes caller knows what it is doing. - if (force_type != NULL_TREE) -@@ -2767,7 +2450,7 @@ build_libcall (LibCall libcall, unsigned - // attributes of the funcion and the SIDE_EFFECTS flags of the arguments. - - tree --d_build_call (tree type, tree callee, tree args) -+d_build_call_list (tree type, tree callee, tree args) - { - int nargs = list_length (args); - tree *pargs = new tree[nargs]; -@@ -2778,7 +2461,7 @@ d_build_call (tree type, tree callee, tr - } - - // Conveniently construct the function arguments for passing --// to the real d_build_call function. -+// to the d_build_call_list function. - - tree - d_build_call_nary (tree callee, int n_args, ...) -@@ -2792,22 +2475,166 @@ d_build_call_nary (tree callee, int n_ar - arg_list = tree_cons (NULL_TREE, va_arg (ap, tree), arg_list); - va_end (ap); - -- return d_build_call (TREE_TYPE (fntype), build_address (callee), nreverse (arg_list)); -+ return d_build_call_list (TREE_TYPE (fntype), build_address (callee), nreverse (arg_list)); -+} -+ -+// Call an fold the intrinsic call CALLEE with the argument ARG -+// with the built-in function CODE passed. -+ -+static tree -+expand_intrinsic_op (built_in_function code, tree callee, tree arg) -+{ -+ tree exp = d_build_call_nary (builtin_decl_explicit (code), 1, arg); -+ return fold_convert (TREE_TYPE (callee), fold (exp)); -+} -+ -+// Like expand_intrinsic_op, but takes two arguments. -+ -+static tree -+expand_intrinsic_op2 (built_in_function code, tree callee, tree arg1, tree arg2) -+{ -+ tree exp = d_build_call_nary (builtin_decl_explicit (code), 2, arg1, arg2); -+ return fold_convert (TREE_TYPE (callee), fold (exp)); -+} -+ -+// Expand a front-end instrinsic call to bsr whose arguments are ARG. -+// The original call expression is held in CALLEE. -+ -+static tree -+expand_intrinsic_bsr (tree callee, tree arg) -+{ -+ // Intrinsic bsr gets turned into (size - 1) - count_leading_zeros(arg). -+ // %% TODO: The return value is supposed to be undefined if arg is zero. -+ tree type = TREE_TYPE (arg); -+ tree tsize = build_integer_cst (TREE_INT_CST_LOW (TYPE_SIZE (type)) - 1, type); -+ tree exp = expand_intrinsic_op (BUILT_IN_CLZL, callee, arg); -+ -+ // Handle int -> long conversions. -+ if (TREE_TYPE (exp) != type) -+ exp = fold_convert (type, exp); -+ -+ exp = fold_build2 (MINUS_EXPR, type, tsize, exp); -+ return fold_convert (TREE_TYPE (callee), exp); -+} -+ -+// Expand the front-end built-in function INTRINSIC, which is either a -+// call to bt, btc, btr, or bts. These intrinsics take two arguments, -+// ARG1 and ARG2, and the original call expression is held in CALLEE. -+ -+static tree -+expand_intrinsic_bt (Intrinsic intrinsic, tree callee, tree arg1, tree arg2) -+{ -+ tree type = TREE_TYPE (TREE_TYPE (arg1)); -+ tree exp = build_integer_cst (TREE_INT_CST_LOW (TYPE_SIZE (type)), type); -+ tree_code code; -+ tree tval; -+ -+ // arg1[arg2 / exp] -+ arg1 = build_array_index (arg1, fold_build2 (TRUNC_DIV_EXPR, type, arg2, exp)); -+ arg1 = indirect_ref (type, arg1); -+ -+ // mask = 1 << (arg2 % exp); -+ arg2 = fold_build2 (TRUNC_MOD_EXPR, type, arg2, exp); -+ arg2 = fold_build2 (LSHIFT_EXPR, type, size_one_node, arg2); -+ -+ // cond = arg1[arg2 / size] & mask; -+ exp = fold_build2 (BIT_AND_EXPR, type, arg1, arg2); -+ -+ // cond ? -1 : 0; -+ exp = fold_build3 (COND_EXPR, TREE_TYPE (callee), d_truthvalue_conversion (exp), -+ integer_minus_one_node, integer_zero_node); -+ -+ // Update the bit as needed. -+ code = (intrinsic == INTRINSIC_BTC) ? BIT_XOR_EXPR : -+ (intrinsic == INTRINSIC_BTR) ? BIT_AND_EXPR : -+ (intrinsic == INTRINSIC_BTS) ? BIT_IOR_EXPR : ERROR_MARK; -+ gcc_assert (code != ERROR_MARK); -+ -+ // arg1[arg2 / size] op= mask -+ if (intrinsic == INTRINSIC_BTR) -+ arg2 = fold_build1 (BIT_NOT_EXPR, TREE_TYPE (arg2), arg2); -+ -+ tval = build_local_temp (TREE_TYPE (callee)); -+ exp = vmodify_expr (tval, exp); -+ arg1 = vmodify_expr (arg1, fold_build2 (code, TREE_TYPE (arg1), arg1, arg2)); -+ -+ return compound_expr (exp, compound_expr (arg1, tval)); -+} -+ -+// Expand a front-end built-in call to va_arg, whose arguments are -+// ARG1 and optionally ARG2. -+// The original call expression is held in CALLEE. -+ -+// The cases handled here are: -+// va_arg!T(ap); -+// => return (T) VA_ARG_EXP<ap> -+// -+// va_arg!T(ap, T arg); -+// => return arg = (T) VA_ARG_EXP<ap>; -+ -+static tree -+expand_intrinsic_vaarg (tree callee, tree arg1, tree arg2) -+{ -+ tree type; -+ -+ STRIP_NOPS (arg1); -+ -+ if (TREE_CODE (arg1) == ADDR_EXPR) -+ arg1 = TREE_OPERAND (arg1, 0); -+ -+ if (arg2 == NULL_TREE) -+ type = TREE_TYPE (callee); -+ else -+ { -+ STRIP_NOPS (arg2); -+ gcc_assert (TREE_CODE (arg2) == ADDR_EXPR); -+ arg2 = TREE_OPERAND (arg2, 0); -+ type = TREE_TYPE (arg2); -+ } -+ -+ // Silently convert promoted types. -+ tree ptype = lang_hooks.types.type_promotes_to (type); -+ tree exp = build1 (VA_ARG_EXPR, ptype, arg1); -+ -+ if (type != ptype) -+ exp = fold_convert (type, exp); -+ -+ if (arg2 != NULL_TREE) -+ exp = vmodify_expr (arg2, exp); -+ -+ return exp; - } - --// If CALL_EXP is a BUILT_IN_FRONTEND, expand and return inlined -+// Expand a front-end built-in call to va_start, whose arguments are -+// ARG1 and ARG2. The original call expression is held in CALLEE. -+ -+static tree -+expand_intrinsic_vastart (tree callee, tree arg1, tree arg2) -+{ -+ // The va_list argument should already have its address taken. -+ // The second argument, however, is inout and that needs to be -+ // fixed to prevent a warning. -+ -+ // Could be casting... so need to check type too? -+ STRIP_NOPS (arg1); -+ STRIP_NOPS (arg2); -+ gcc_assert (TREE_CODE (arg1) == ADDR_EXPR && TREE_CODE (arg2) == ADDR_EXPR); -+ -+ arg2 = TREE_OPERAND (arg2, 0); -+ // Assuming nobody tries to change the return type. -+ return expand_intrinsic_op2 (BUILT_IN_VA_START, callee, arg1, arg2); -+} -+ -+// If CALLEXP is a BUILT_IN_FRONTEND, expand and return inlined - // compiler generated instructions. Most map onto GCC builtins, - // others require a little extra work around them. - - tree --IRState::maybeExpandSpecialCall (tree call_exp) -+maybe_expand_builtin (tree callexp) - { - // More code duplication from C -- CallExpr ce (call_exp); -+ CallExpr ce (callexp); - tree callee = ce.callee(); -- tree op1 = NULL_TREE, op2 = NULL_TREE; -- tree exp = NULL_TREE, val; -- enum tree_code code; - - if (POINTER_TYPE_P (TREE_TYPE (callee))) - callee = TREE_OPERAND (callee, 0); -@@ -2816,210 +2643,107 @@ IRState::maybeExpandSpecialCall (tree ca - && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_FRONTEND) - { - Intrinsic intrinsic = (Intrinsic) DECL_FUNCTION_CODE (callee); -+ tree op1, op2; - tree type; -- Type *d_type; -+ - switch (intrinsic) - { - case INTRINSIC_BSF: -- /* builtin count_trailing_zeros matches behaviour of bsf. -- %% TODO: The return value is supposed to be undefined if op1 is zero. */ -+ // builtin count_trailing_zeros matches behaviour of bsf. -+ // %% TODO: The return value is supposed to be undefined if op1 is zero. - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_CTZL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_CTZL, callexp, op1); - - case INTRINSIC_BSR: -- /* bsr becomes 31-(clz), but parameter passed to bsf may not be a 32bit type!! -- %% TODO: The return value is supposed to be undefined if op1 is zero. */ - op1 = ce.nextArg(); -- type = TREE_TYPE (op1); -- -- op2 = build_integer_cst (tree_low_cst (TYPE_SIZE (type), 1) - 1, type); -- exp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_CLZL), 1, op1); -- -- // Handle int -> long conversions. -- if (TREE_TYPE (exp) != type) -- exp = fold_convert (type, exp); -- -- return fold_build2 (MINUS_EXPR, type, op2, exp); -+ return expand_intrinsic_bsr (callexp, op1); - - case INTRINSIC_BTC: - case INTRINSIC_BTR: - case INTRINSIC_BTS: - op1 = ce.nextArg(); - op2 = ce.nextArg(); -- type = TREE_TYPE (TREE_TYPE (op1)); -- -- exp = build_integer_cst (tree_low_cst (TYPE_SIZE (type), 1), type); -- -- // op1[op2 / exp] -- op1 = build_array_index (op1, fold_build2 (TRUNC_DIV_EXPR, type, op2, exp)); -- op1 = indirect_ref (type, op1); -- -- // mask = 1 << (op2 % exp); -- op2 = fold_build2 (TRUNC_MOD_EXPR, type, op2, exp); -- op2 = fold_build2 (LSHIFT_EXPR, type, size_one_node, op2); -- -- // cond = op1[op2 / size] & mask; -- exp = fold_build2 (BIT_AND_EXPR, type, op1, op2); -- -- // cond ? -1 : 0; -- exp = build3 (COND_EXPR, TREE_TYPE (call_exp), d_truthvalue_conversion (exp), -- integer_minus_one_node, integer_zero_node); -- -- // Update the bit as needed. -- code = (intrinsic == INTRINSIC_BTC) ? BIT_XOR_EXPR : -- (intrinsic == INTRINSIC_BTR) ? BIT_AND_EXPR : -- (intrinsic == INTRINSIC_BTS) ? BIT_IOR_EXPR : ERROR_MARK; -- gcc_assert (code != ERROR_MARK); -- -- // op1[op2 / size] op= mask -- if (intrinsic == INTRINSIC_BTR) -- op2 = build1 (BIT_NOT_EXPR, TREE_TYPE (op2), op2); -- -- val = build_local_var (TREE_TYPE (call_exp)); -- exp = vmodify_expr (val, exp); -- op1 = vmodify_expr (op1, fold_build2 (code, TREE_TYPE (op1), op1, op2)); -- return compound_expr (exp, compound_expr (op1, val)); -+ return expand_intrinsic_bt (intrinsic, callexp, op1, op2); - - case INTRINSIC_BSWAP: - /* Backend provides builtin bswap32. - Assumes first argument and return type is uint. */ - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_BSWAP32), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_BSWAP32, callexp, op1); - -- case INTRINSIC_COS: - // Math intrinsics just map to their GCC equivalents. -+ case INTRINSIC_COS: - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_COSL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_COSL, callexp, op1); - - case INTRINSIC_SIN: - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_SINL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_SINL, callexp, op1); - - case INTRINSIC_RNDTOL: -- // %% not sure if llroundl stands as a good replacement -- // for the expected behaviour of rndtol. -+ // Not sure if llroundl stands as a good replacement for the -+ // expected behaviour of rndtol. - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_LLROUNDL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_LLROUNDL, callexp, op1); - - case INTRINSIC_SQRT: - // Have float, double and real variants of sqrt. - op1 = ce.nextArg(); -- type = TREE_TYPE (op1); -- // Could have used mathfn_built_in, but that only returns -- // implicit built in decls. -- if (TYPE_MAIN_VARIANT (type) == double_type_node) -- exp = builtin_decl_explicit (BUILT_IN_SQRT); -- else if (TYPE_MAIN_VARIANT (type) == float_type_node) -- exp = builtin_decl_explicit (BUILT_IN_SQRTF); -- else if (TYPE_MAIN_VARIANT (type) == long_double_type_node) -- exp = builtin_decl_explicit (BUILT_IN_SQRTL); -+ type = TYPE_MAIN_VARIANT (TREE_TYPE (op1)); - // op1 is an integral type - use double precision. -- else if (INTEGRAL_TYPE_P (TYPE_MAIN_VARIANT (type))) -- { -- op1 = convert (double_type_node, op1); -- exp = builtin_decl_explicit (BUILT_IN_SQRT); -- } -+ if (INTEGRAL_TYPE_P (type)) -+ op1 = convert (double_type_node, op1); - -- gcc_assert (exp); // Should never trigger. -- return d_build_call_nary (exp, 1, op1); -+ if (type == double_type_node) -+ return expand_intrinsic_op (BUILT_IN_SQRT, callexp, op1); -+ else if (type == float_type_node) -+ return expand_intrinsic_op (BUILT_IN_SQRTF, callexp, op1); -+ else if (type == long_double_type_node) -+ return expand_intrinsic_op (BUILT_IN_SQRTL, callexp, op1); -+ -+ gcc_unreachable(); -+ break; - - case INTRINSIC_LDEXP: - op1 = ce.nextArg(); - op2 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_LDEXPL), 2, op1, op2); -+ return expand_intrinsic_op2 (BUILT_IN_LDEXPL, callexp, op1, op2); - - case INTRINSIC_FABS: - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_FABSL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_FABSL, callexp, op1); - - case INTRINSIC_RINT: - op1 = ce.nextArg(); -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_RINTL), 1, op1); -+ return expand_intrinsic_op (BUILT_IN_RINTL, callexp, op1); - - case INTRINSIC_VA_ARG: -- case INTRINSIC_C_VA_ARG: - op1 = ce.nextArg(); -- STRIP_NOPS (op1); -- -- if (TREE_CODE (op1) == ADDR_EXPR) -- op1 = TREE_OPERAND (op1, 0); -- -- if (intrinsic == INTRINSIC_C_VA_ARG) -- type = TREE_TYPE (TREE_TYPE (callee)); -- else -- { -- op2 = ce.nextArg(); -- STRIP_NOPS (op2); -- gcc_assert (TREE_CODE (op2) == ADDR_EXPR); -- op2 = TREE_OPERAND (op2, 0); -- type = TREE_TYPE (op2); -- } -- -- d_type = build_dtype (type); -- if (flag_split_darrays -- && (d_type && d_type->toBasetype()->ty == Tarray)) -- { -- /* should create a temp var of type TYPE and move the binding -- to outside this expression. */ -- tree ltype = TREE_TYPE (TYPE_FIELDS (type)); -- tree ptype = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (type))); -- tree lvar = create_temporary_var (ltype); -- tree pvar = create_temporary_var (ptype); -- -- op1 = stabilize_reference (op1); -- -- tree e1 = vmodify_expr (lvar, build1 (VA_ARG_EXPR, ltype, op1)); -- tree e2 = vmodify_expr (pvar, build1 (VA_ARG_EXPR, ptype, op1)); -- tree val = d_array_value (type, lvar, pvar); -- -- exp = compound_expr (compound_expr (e1, e2), val); -- exp = bind_expr (lvar, bind_expr (pvar, exp)); -- } -- else -- { -- tree type2 = lang_hooks.types.type_promotes_to (type); -- exp = build1 (VA_ARG_EXPR, type2, op1); -- // silently convert promoted type... -- if (type != type2) -- exp = convert (type, exp); -- } -- -- if (intrinsic == INTRINSIC_VA_ARG) -- exp = vmodify_expr (op2, exp); -+ op2 = ce.nextArg(); -+ return expand_intrinsic_vaarg (callexp, op1, op2); - -- return exp; -+ case INTRINSIC_C_VA_ARG: -+ op1 = ce.nextArg(); -+ return expand_intrinsic_vaarg (callexp, op1, NULL_TREE); - - case INTRINSIC_VA_START: -- /* The va_list argument should already have its -- address taken. The second argument, however, is -- inout and that needs to be fixed to prevent a warning. */ - op1 = ce.nextArg(); - op2 = ce.nextArg(); -- type = TREE_TYPE (op1); -- -- // could be casting... so need to check type too? -- STRIP_NOPS (op1); -- STRIP_NOPS (op2); -- gcc_assert (TREE_CODE (op1) == ADDR_EXPR -- && TREE_CODE (op2) == ADDR_EXPR); -- -- op2 = TREE_OPERAND (op2, 0); -- // assuming nobody tries to change the return type -- return d_build_call_nary (builtin_decl_explicit (BUILT_IN_VA_START), 2, op1, op2); -+ return expand_intrinsic_vastart (callexp, op1, op2); - - default: - gcc_unreachable(); - } - } - -- return call_exp; -+ return callexp; - } - - // Build and return the correct call to fmod depending on TYPE. - // ARG0 and ARG1 are the arguments pass to the function. - - tree --IRState::floatMod (tree type, tree arg0, tree arg1) -+build_float_modulus (tree type, tree arg0, tree arg1) - { - tree fmodfn = NULL_TREE; - tree basetype = type; -@@ -3037,7 +2761,7 @@ IRState::floatMod (tree type, tree arg0, - if (!fmodfn) - { - // %qT pretty prints the tree type. -- ::error ("tried to perform floating-point modulo division on %qT", type); -+ error ("tried to perform floating-point modulo division on %qT", type); - return error_mark_node; - } - -@@ -3056,11 +2780,11 @@ IRState::floatMod (tree type, tree arg0, - // Returns typeinfo reference for type T. - - tree --IRState::typeinfoReference (Type *t) -+build_typeinfo (Type *t) - { -- tree ti_ref = t->getInternalTypeInfo (NULL)->toElem (this); -- gcc_assert (POINTER_TYPE_P (TREE_TYPE (ti_ref))); -- return ti_ref; -+ tree tinfo = t->getInternalTypeInfo (NULL)->toElem (current_irstate); -+ gcc_assert (POINTER_TYPE_P (TREE_TYPE (tinfo))); -+ return tinfo; - } - - // Checks if DECL is an intrinsic or runtime library function that -@@ -3081,29 +2805,23 @@ maybe_set_builtin_frontend (FuncDeclarat - if (libcall_decls[libcall] == decl) - return; - -+ // This should have been done either by the front-end or get_libcall. - TypeFunction *tf = (TypeFunction *) decl->type; -- if (tf->parameters == NULL) -- { -- FuncDeclaration *new_decl = get_libcall (libcall); -- new_decl->toSymbol(); -- -- decl->type = new_decl->type; -- decl->csym = new_decl->csym; -- } -+ gcc_assert (tf->parameters != NULL); - - libcall_decls[libcall] = decl; - } - else - { - // Check if it's a front-end builtin. -- static const char FeZe [] = "FNaNbNfeZe"; // @safe pure nothrow real function(real) -- static const char FeZe2[] = "FNaNbNeeZe"; // @trusted pure nothrow real function(real) -- static const char FuintZint[] = "FNaNbNfkZi"; // @safe pure nothrow int function(uint) -- static const char FuintZuint[] = "FNaNbNfkZk"; // @safe pure nothrow uint function(uint) -- static const char FulongZint[] = "FNaNbNfmZi"; // @safe pure nothrow int function(uint) -- static const char FrealZlong [] = "FNaNbNfeZl"; // @safe pure nothrow long function(real) -- static const char FlongplongZint [] = "FNaNbNfPmmZi"; // @safe pure nothrow int function(long*, long) -- static const char FintpintZint [] = "FNaNbNfPkkZi"; // @safe pure nothrow int function(int*, int) -+ static const char FeZe [] = "FNaNbNfeZe"; // @safe pure nothrow real function(real) -+ static const char FeZe2[] = "FNaNbNeeZe"; // @trusted pure nothrow real function(real) -+ static const char FuintZint[] = "FNaNbNfkZi"; // @safe pure nothrow int function(uint) -+ static const char FuintZuint[] = "FNaNbNfkZk"; // @safe pure nothrow uint function(uint) -+ static const char FulongZint[] = "FNaNbNfmZi"; // @safe pure nothrow int function(uint) -+ static const char FrealZlong [] = "FNaNbNfeZl"; // @safe pure nothrow long function(real) -+ static const char FlongplongZint [] = "FNaNbPmmZi"; // pure nothrow int function(long*, long) -+ static const char FintpintZint [] = "FNaNbPkkZi"; // pure nothrow int function(int*, int) - static const char FrealintZint [] = "FNaNbNfeiZe"; // @safe pure nothrow real function(real, int) - - Dsymbol *dsym = decl->toParent(); -@@ -3130,20 +2848,20 @@ maybe_set_builtin_frontend (FuncDeclarat - - switch (i) - { -- case 0: -- case 1: -+ case INTRINSIC_BSF: -+ case INTRINSIC_BSR: - if (!(strcmp (ftype->deco, FuintZint) == 0 || strcmp (ftype->deco, FulongZint) == 0)) - return; - break; - -- case 2: -+ case INTRINSIC_BSWAP: - if (!(strcmp (ftype->deco, FuintZuint) == 0)) - return; - break; - -- case 3: -- case 4: -- case 5: -+ case INTRINSIC_BTC: -+ case INTRINSIC_BTR: -+ case INTRINSIC_BTS: - if (!(strcmp (ftype->deco, FlongplongZint) == 0 || strcmp (ftype->deco, FintpintZint) == 0)) - return; - break; -@@ -3161,8 +2879,7 @@ maybe_set_builtin_frontend (FuncDeclarat - // Matches order of Intrinsic enum - static const char *math_names[] = { - "cos", "fabs", "ldexp", -- "rint", "rndtol", "sin", -- "sqrt", -+ "rint", "rndtol", "sin", "sqrt", - }; - const size_t sz = sizeof (math_names) / sizeof (char *); - int i = binary (decl->ident->string, math_names, sz); -@@ -3170,38 +2887,39 @@ maybe_set_builtin_frontend (FuncDeclarat - if (i == -1) - return; - -+ // Adjust 'i' for this range of enums -+ i += INTRINSIC_COS; -+ gcc_assert (i >= INTRINSIC_COS && i <= INTRINSIC_SQRT); -+ - switch (i) - { -- case 0: -- case 1: -- case 3: -- case 5: -+ case INTRINSIC_COS: -+ case INTRINSIC_FABS: -+ case INTRINSIC_RINT: -+ case INTRINSIC_SIN: - if (!(strcmp (ftype->deco, FeZe) == 0 || strcmp (ftype->deco, FeZe2) == 0)) - return; - break; - -- case 2: -+ case INTRINSIC_LDEXP: - if (!(strcmp (ftype->deco, FrealintZint) == 0)) - return; - break; - -- case 4: -+ case INTRINSIC_RNDTOL: - if (!(strcmp (ftype->deco, FrealZlong) == 0)) - return; - break; - -- case 6: -- if (!(strcmp (ftype->deco, "FNaNbNfdZd") == 0 || //double -- strcmp (ftype->deco, "FNaNbNffZf") == 0 || //& float version -- strcmp (ftype->deco, FeZe) == 0 || -- strcmp (ftype->deco, FeZe2) == 0)) -+ case INTRINSIC_SQRT: -+ if (!(strcmp (ftype->deco, "FNaNbNfdZd") == 0 -+ || strcmp (ftype->deco, "FNaNbNffZf") == 0 -+ || strcmp (ftype->deco, FeZe) == 0 -+ || strcmp (ftype->deco, FeZe2) == 0)) - return; - break; - } - -- // Adjust 'i' for this range of enums -- i += INTRINSIC_COS; -- gcc_assert (i >= INTRINSIC_COS && i <= INTRINSIC_SQRT); - tree t = decl->toSymbol()->Stree; - - // rndtol returns a long type, sqrt any float type, -@@ -3278,24 +2996,24 @@ d_build_label (Loc loc, Identifier *iden - - // Not setting this doesn't seem to cause problems (unlike VAR_DECLs). - if (loc.filename) -- object_file->setDeclLoc (decl, loc); -+ set_decl_location (decl, loc); - - return decl; - } - --// If NESTED_SYM is a nested function, return the static chain to be --// used when invoking that function. -+// If SYM is a nested function, return the static chain to be -+// used when calling that function from FUNC. - --// If NESTED_SYM is a nested class or struct, return the static chain --// to be used when creating an instance of the class. -+// If SYM is a nested class or struct, return the static chain -+// to be used when creating an instance of the class from FUNC. - - tree --IRState::getFrameForSymbol (Dsymbol *nested_sym) -+get_frame_for_symbol (FuncDeclaration *func, Dsymbol *sym) - { -- FuncDeclaration *nested_func = NULL; -+ FuncDeclaration *nested_func = sym->isFuncDeclaration(); - FuncDeclaration *outer_func = NULL; - -- if ((nested_func = nested_sym->isFuncDeclaration())) -+ if (nested_func != NULL) - { - // Check that the nested function is properly defined. - if (!nested_func->fbody) -@@ -3308,16 +3026,19 @@ IRState::getFrameForSymbol (Dsymbol *nes - outer_func = nested_func->toParent2()->isFuncDeclaration(); - gcc_assert (outer_func != NULL); - -- if (this->func != outer_func) -+ if (func != outer_func) - { -- Dsymbol *this_func = this->func; -- if (!this->func->vthis) // if no frame pointer for this function -+ // If no frame pointer for this function -+ if (!func->vthis) - { -- nested_sym->error ("is a nested function and cannot be accessed from %s", this->func->toChars()); -+ sym->error ("is a nested function and cannot be accessed from %s", func->toChars()); - return d_null_pointer; - } -- /* Make sure we can get the frame pointer to the outer function, -- else we'll ICE later in tree-ssa. */ -+ -+ Dsymbol *this_func = func; -+ -+ // Make sure we can get the frame pointer to the outer function, -+ // else we'll ICE later in tree-ssa. - while (nested_func != this_func) - { - FuncDeclaration *fd; -@@ -3327,7 +3048,7 @@ IRState::getFrameForSymbol (Dsymbol *nes - // Special case for __ensure and __require. - if (nested_func->ident == Id::ensure || nested_func->ident == Id::require) - { -- outer_func = this->func; -+ outer_func = func; - break; - } - -@@ -3335,12 +3056,14 @@ IRState::getFrameForSymbol (Dsymbol *nes - { - if (outer_func == fd->toParent2()) - break; -+ - gcc_assert (fd->isNested() || fd->vthis); - } - else if ((cd = this_func->isClassDeclaration())) - { - if (!cd->isNested() || !cd->vthis) - goto cannot_get_frame; -+ - if (outer_func == cd->toParent2()) - break; - } -@@ -3348,13 +3071,14 @@ IRState::getFrameForSymbol (Dsymbol *nes - { - if (!sd->isNested() || !sd->vthis) - goto cannot_get_frame; -+ - if (outer_func == sd->toParent2()) - break; - } - else - { -- cannot_get_frame: -- this->func->error ("cannot get frame pointer to %s", nested_sym->toChars()); -+ cannot_get_frame: -+ func->error ("cannot get frame pointer to %s", sym->toChars()); - return d_null_pointer; - } - this_func = this_func->toParent2(); -@@ -3366,33 +3090,41 @@ IRState::getFrameForSymbol (Dsymbol *nes - /* It's a class (or struct). NewExp::toElem has already determined its - outer scope is not another class, so it must be a function. */ - -- Dsymbol *sym = nested_sym; -- -- while (sym && !(outer_func = sym->isFuncDeclaration())) -+ while (sym && !sym->isFuncDeclaration()) - sym = sym->toParent2(); - -+ outer_func = (FuncDeclaration *) sym; -+ - /* Make sure we can access the frame of outer_func. */ -- if (outer_func != this->func) -+ if (outer_func != func) - { -- Dsymbol *o = nested_func = this->func; -- do { -+ nested_func = func; -+ while (nested_func && nested_func != outer_func) -+ { -+ Dsymbol *outer = nested_func->toParent2(); -+ - if (!nested_func->isNested()) - { - if (!nested_func->isMember2()) - goto cannot_access_frame; - } -- while ((o = o->toParent2())) -+ -+ while (outer) - { -- if ((nested_func = o->isFuncDeclaration())) -+ if (outer->isFuncDeclaration()) - break; -+ -+ outer = outer->toParent2(); - } -- } while (o && o != outer_func); - -- if (!o) -+ nested_func = (FuncDeclaration *) outer; -+ } -+ -+ if (!nested_func) - { -- cannot_access_frame: -+ cannot_access_frame: - error ("cannot access frame of function '%s' from '%s'", -- outer_func->toChars(), this->func->toChars()); -+ outer_func->toChars(), func->toChars()); - return d_null_pointer; - } - } -@@ -3400,11 +3132,12 @@ IRState::getFrameForSymbol (Dsymbol *nes - - if (!outer_func) - outer_func = nested_func->toParent2()->isFuncDeclaration(); -+ - gcc_assert (outer_func != NULL); - - FuncFrameInfo *ffo = get_frameinfo (outer_func); - if (ffo->creates_frame || ffo->static_chain) -- return get_framedecl (this->func, outer_func); -+ return get_framedecl (func, outer_func); - - return d_null_pointer; - } -@@ -3444,48 +3177,47 @@ d_nested_struct (StructDeclaration *sd) - } - - --// Starting from the current function, try to find a suitable value of --// 'this' in nested function instances. -- --// A suitable 'this' value is an instance of OCD or a class that has --// OCD as a base. -+// Starting from the current function FUNC, try to find a suitable value of -+// 'this' in nested function instances. A suitable 'this' value is an -+// instance of OCD or a class that has OCD as a base. - --tree --IRState::findThis (ClassDeclaration *ocd) -+static tree -+find_this_tree (FuncDeclaration *func, ClassDeclaration *ocd) - { -- FuncDeclaration *fd = func; -- -- while (fd) -+ while (func) - { -- AggregateDeclaration *ad = fd->isThis(); -+ AggregateDeclaration *ad = func->isThis(); - ClassDeclaration *cd = ad ? ad->isClassDeclaration() : NULL; - - if (cd != NULL) - { - if (ocd == cd) -- return var (fd->vthis); -+ return get_decl_tree (func->vthis, func); - else if (ocd->isBaseOf (cd, NULL)) -- return convert_expr (var (fd->vthis), cd->type, ocd->type); -- else -- fd = d_nested_class (cd); -+ return convert_expr (get_decl_tree (func->vthis, func), cd->type, ocd->type); -+ -+ func = d_nested_class (cd); - } - else - { -- if (fd->isNested()) -- fd = fd->toParent2()->isFuncDeclaration(); -- else -- fd = NULL; -+ if (func->isNested()) -+ { -+ func = func->toParent2()->isFuncDeclaration(); -+ continue; -+ } -+ -+ func = NULL; - } - } -+ - return NULL_TREE; - } - --// Return the outer class/struct 'this' value. --// This is here mostly due to removing duplicate code, --// and clean implementation purposes. -+// Retrieve the outer class/struct 'this' value of DECL from the function FD -+// where E is the expression requiring 'this'. - - tree --IRState::getVThis (Dsymbol *decl, Expression *e) -+build_vthis (Dsymbol *decl, FuncDeclaration *fd, Expression *e) - { - ClassDeclaration *cd = decl->isClassDeclaration(); - StructDeclaration *sd = decl->isStructDeclaration(); -@@ -3500,25 +3232,23 @@ IRState::getVThis (Dsymbol *decl, Expres - - if (cdo) - { -- vthis_value = findThis (cdo); -+ vthis_value = find_this_tree (fd, cdo); - if (vthis_value == NULL_TREE) - e->error ("outer class %s 'this' needed to 'new' nested class %s", - cdo->toChars(), cd->toChars()); - } - else if (fdo) - { -- /* If a class nested in a function has no methods -- and there are no other nested functions, -- lower_nested_functions is never called and any -- STATIC_CHAIN_EXPR created here will never be -- translated. Use a null pointer for the link in -- this case. */ -+ // If a class nested in a function has no methods and there -+ // are no other nested functions, any static chain created -+ // here will never be translated. Use a null pointer for the -+ // link in this case. - FuncFrameInfo *ffo = get_frameinfo (fdo); - if (ffo->creates_frame || ffo->static_chain - || fdo->hasNestedFrameRefs()) -- vthis_value = getFrameForSymbol (cd); -+ vthis_value = get_frame_for_symbol (fd, cd); - else if (fdo->vthis && fdo->vthis->type != Type::tvoidptr) -- vthis_value = var (fdo->vthis); -+ vthis_value = get_decl_tree (fdo->vthis, fd); - else - vthis_value = d_null_pointer; - } -@@ -3533,7 +3263,7 @@ IRState::getVThis (Dsymbol *decl, Expres - - if (cdo) - { -- vthis_value = findThis (cdo); -+ vthis_value = find_this_tree (fd, cdo); - if (vthis_value == NULL_TREE) - e->error ("outer class %s 'this' needed to create nested struct %s", - cdo->toChars(), sd->toChars()); -@@ -3543,9 +3273,7 @@ IRState::getVThis (Dsymbol *decl, Expres - FuncFrameInfo *ffo = get_frameinfo (fdo); - if (ffo->creates_frame || ffo->static_chain - || fdo->hasNestedFrameRefs()) -- vthis_value = getFrameForSymbol (sd); -- else if (fdo->vthis && fdo->vthis->type != Type::tvoidptr) -- vthis_value = var (fdo->vthis); -+ vthis_value = get_frame_for_symbol (fd, sd); - else - vthis_value = d_null_pointer; - } -@@ -3556,53 +3284,6 @@ IRState::getVThis (Dsymbol *decl, Expres - return vthis_value; - } - --// Build static chain decl for FUNC to be passed to nested functions in D. -- --void --IRState::buildChain (FuncDeclaration *func) --{ -- FuncFrameInfo *ffi = get_frameinfo (func); -- -- if (ffi->is_closure) -- { -- // Build closure pointer, which is initialised on heap. -- func->buildClosure (this); -- return; -- } -- -- if (!ffi->creates_frame) -- return; -- -- tree frame_rec_type = build_frame_type (func); -- gcc_assert(COMPLETE_TYPE_P (frame_rec_type)); -- -- tree frame_decl = build_local_var (frame_rec_type); -- DECL_NAME (frame_decl) = get_identifier ("__frame"); -- DECL_IGNORED_P (frame_decl) = 0; -- expandDecl (frame_decl); -- -- // set the first entry to the parent frame, if any -- tree chain_field = component_ref (frame_decl, TYPE_FIELDS (frame_rec_type)); -- tree chain_expr = vmodify_expr (chain_field, this->sthis); -- addExp (chain_expr); -- -- // copy parameters that are referenced nonlocally -- for (size_t i = 0; i < func->closureVars.dim; i++) -- { -- VarDeclaration *v = func->closureVars[i]; -- if (!v->isParameter()) -- continue; -- -- Symbol *vsym = v->toSymbol(); -- -- tree frame_field = component_ref (frame_decl, vsym->SframeField); -- tree frame_expr = vmodify_expr (frame_field, vsym->Stree); -- addExp (frame_expr); -- } -- -- this->sthis = build_address (frame_decl); --} -- - tree - build_frame_type (FuncDeclaration *func) - { -@@ -3620,6 +3301,7 @@ build_frame_type (FuncDeclaration *func) - tree ptr_field = build_decl (BUILTINS_LOCATION, FIELD_DECL, - get_identifier ("__chain"), ptr_type_node); - DECL_CONTEXT (ptr_field) = frame_rec_type; -+ TYPE_READONLY (frame_rec_type) = 1; - - tree fields = chainon (NULL_TREE, ptr_field); - -@@ -3672,15 +3354,20 @@ build_frame_type (FuncDeclaration *func) - v->ident ? get_identifier (v->ident->string) : NULL_TREE, - declaration_type (v)); - s->SframeField = field; -- object_file->setDeclLoc (field, v); -+ set_decl_location (field, v); - DECL_CONTEXT (field) = frame_rec_type; - fields = chainon (fields, field); - TREE_USED (s->Stree) = 1; - -- /* Can't do nrvo if the variable is put in a frame. */ -+ // Can't do nrvo if the variable is put in a frame. - if (func->nrvo_can && func->nrvo_var == v) - func->nrvo_can = 0; -+ -+ // Because the value needs to survive the end of the scope. -+ if (ffi->is_closure && v->needsAutoDtor()) -+ v->error("has scoped destruction, cannot build closure"); - } -+ - TYPE_FIELDS (frame_rec_type) = fields; - layout_type (frame_rec_type); - d_keep (frame_rec_type); -@@ -3782,7 +3469,7 @@ get_frameinfo (FuncDeclaration *fd) - tree - get_framedecl (FuncDeclaration *inner, FuncDeclaration *outer) - { -- tree result = cirstate->sthis; -+ tree result = current_irstate->sthis; - FuncDeclaration *fd = inner; - - while (fd && fd != outer) -@@ -3835,7 +3522,7 @@ get_framedecl (FuncDeclaration *inner, F - } - - // Special case: If a function returns a nested class with functions --// but there are no "closure variables" the frontend (needsClosure) -+// but there are no "closure variables" the frontend (needsClosure) - // returns false even though the nested class _is_ returned from the - // function. (See case 4 in needsClosure) - // A closure is strictly speaking not necessary, but we also can not -@@ -3853,7 +3540,7 @@ is_degenerate_closure (FuncDeclaration * - gcc_assert(tret); - tret = tret->toBasetype(); - if (tret->ty == Tclass || tret->ty == Tstruct) -- { -+ { - Dsymbol *st = tret->toDsymbol(NULL); - for (Dsymbol *s = st->parent; s; s = s->parent) - { -@@ -3880,7 +3567,7 @@ needs_static_chain (FuncDeclaration *f) - { - s = f->toParent(); - ti = s->isTemplateInstance(); -- if (ti && ti->isnested == NULL && ti->parent->isModule()) -+ if (ti && ti->enclosing == NULL && ti->parent->isModule()) - return false; - - pf = f->toParent2()->isFuncDeclaration(); -@@ -3916,7 +3603,7 @@ needs_static_chain (FuncDeclaration *f) - // Construct a WrappedExp, whose components are an EXP_NODE, which contains - // a list of instructions in GCC to be passed through. - --WrappedExp::WrappedExp (Loc loc, enum TOK op, tree exp_node, Type *type) -+WrappedExp::WrappedExp (Loc loc, TOK op, tree exp_node, Type *type) - : Expression (loc, op, sizeof (WrappedExp)) - { - this->exp_node = exp_node; -@@ -3943,135 +3630,149 @@ WrappedExp::toElem (IRState *) - // out base class fields first, and adds all interfaces last. - - void --AggLayout::visit (AggregateDeclaration *decl) -+layout_aggregate_type (AggLayout *al, AggregateDeclaration *decl) - { -- ClassDeclaration *class_decl = decl->isClassDeclaration(); -+ ClassDeclaration *cd = decl->isClassDeclaration(); -+ bool inherited_p = (al->decl != decl); - -- if (class_decl && class_decl->baseClass) -- AggLayout::visit (class_decl->baseClass); -+ if (cd != NULL) -+ { -+ if (cd->baseClass) -+ layout_aggregate_type (al, cd->baseClass); -+ else -+ { -+ // This is the base class (Object) or interface. -+ tree objtype = TREE_TYPE (cd->type->toCtype()); - -- if (decl->fields.dim) -- doFields (&decl->fields, decl); -+ // Add the virtual table pointer, and optionally the monitor fields. -+ tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, -+ get_identifier ("__vptr"), d_vtbl_ptr_type_node); -+ DECL_ARTIFICIAL (field) = 1; -+ DECL_IGNORED_P (field) = inherited_p; - -- if (class_decl && class_decl->vtblInterfaces) -- doInterfaces (class_decl->vtblInterfaces); --} -+ insert_aggregate_field (al, field, 0); - -+ DECL_VIRTUAL_P (field) = 1; -+ DECL_FCONTEXT (field) = objtype; -+ TYPE_VFIELD (al->type) = field; - --// Add all FIELDS into aggregate AGG. -+ if (cd->cpp == false) -+ { -+ field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, -+ get_identifier ("__monitor"), ptr_type_node); -+ DECL_FCONTEXT (field) = objtype; -+ DECL_ARTIFICIAL (field) = 1; -+ DECL_IGNORED_P (field) = inherited_p; -+ insert_aggregate_field (al, field, Target::ptrsize); -+ } -+ } -+ } - --void --AggLayout::doFields (VarDeclarations *fields, AggregateDeclaration *agg) --{ -- bool inherited = agg != this->aggDecl_; -- tree fcontext; -+ if (decl->fields.dim) -+ { -+ tree fcontext = decl->type->toCtype(); - -- fcontext = agg->type->toCtype(); -- if (POINTER_TYPE_P (fcontext)) -- fcontext = TREE_TYPE (fcontext); -+ if (POINTER_TYPE_P (fcontext)) -+ fcontext = TREE_TYPE (fcontext); - -- for (size_t i = 0; i < fields->dim; i++) -- { -- // %% D anonymous unions just put the fields into the outer struct... -- // does this cause problems? -- VarDeclaration *var_decl = (*fields)[i]; -- gcc_assert (var_decl && var_decl->storage_class & STCfield); -+ for (size_t i = 0; i < decl->fields.dim; i++) -+ { -+ // D anonymous unions just put the fields into the outer struct... -+ // Does this cause problems? -+ VarDeclaration *var = decl->fields[i]; -+ gcc_assert (var && var->isField()); - -- tree ident = var_decl->ident ? get_identifier (var_decl->ident->string) : NULL_TREE; -- tree field_decl = build_decl (UNKNOWN_LOCATION, FIELD_DECL, ident, -- declaration_type (var_decl)); -- object_file->setDeclLoc (field_decl, var_decl); -- var_decl->csym = new Symbol; -- var_decl->csym->Stree = field_decl; -+ tree ident = var->ident ? get_identifier (var->ident->string) : NULL_TREE; -+ tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, ident, -+ declaration_type (var)); -+ set_decl_location (field, var); -+ var->csym = new Symbol; -+ var->csym->Stree = field; - -- DECL_CONTEXT (field_decl) = this->aggType_; -- DECL_FCONTEXT (field_decl) = fcontext; -- DECL_FIELD_OFFSET (field_decl) = size_int (var_decl->offset); -- DECL_FIELD_BIT_OFFSET (field_decl) = bitsize_zero_node; -+ DECL_CONTEXT (field) = al->type; -+ DECL_FCONTEXT (field) = fcontext; -+ DECL_FIELD_OFFSET (field) = size_int (var->offset); -+ DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node; - -- DECL_ARTIFICIAL (field_decl) = DECL_IGNORED_P (field_decl) = inherited; -- SET_DECL_OFFSET_ALIGN (field_decl, TYPE_ALIGN (TREE_TYPE (field_decl))); -+ DECL_ARTIFICIAL (field) = inherited_p; -+ DECL_IGNORED_P (field) = inherited_p; -+ SET_DECL_OFFSET_ALIGN (field, TYPE_ALIGN (TREE_TYPE (field))); - -- layout_decl (field_decl, 0); -+ TREE_THIS_VOLATILE (field) = TYPE_VOLATILE (TREE_TYPE (field)); -+ layout_decl (field, 0); - -- TREE_THIS_VOLATILE (field_decl) = TYPE_VOLATILE (TREE_TYPE (field_decl)); -+ if (var->size (var->loc)) -+ { -+ gcc_assert (DECL_MODE (field) != VOIDmode); -+ gcc_assert (DECL_SIZE (field) != NULL_TREE); -+ } - -- if (var_decl->size (var_decl->loc)) -- { -- gcc_assert (DECL_MODE (field_decl) != VOIDmode); -- gcc_assert (DECL_SIZE (field_decl) != NULL_TREE); -+ TYPE_FIELDS(al->type) = chainon (TYPE_FIELDS (al->type), field); - } -- -- TYPE_FIELDS(this->aggType_) = chainon (TYPE_FIELDS (this->aggType_), field_decl); - } --} - --// Write out all interfaces BASES for a class. -- --void --AggLayout::doInterfaces (BaseClasses *bases) --{ -- for (size_t i = 0; i < bases->dim; i++) -+ if (cd && cd->vtblInterfaces) - { -- BaseClass *bc = (*bases)[i]; -- tree decl = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, -- Type::tvoidptr->pointerTo()->toCtype()); -- DECL_ARTIFICIAL (decl) = 1; -- DECL_IGNORED_P (decl) = 1; -- addField (decl, bc->offset); -+ for (size_t i = 0; i < cd->vtblInterfaces->dim; i++) -+ { -+ BaseClass *bc = (*cd->vtblInterfaces)[i]; -+ tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, -+ Type::tvoidptr->pointerTo()->toCtype()); -+ DECL_ARTIFICIAL (field) = 1; -+ DECL_IGNORED_P (field) = 1; -+ insert_aggregate_field (al, field, bc->offset); -+ } - } - } - --// Add single field FIELD_DECL at OFFSET into aggregate. -+// Add a compiler generated field DECL at OFFSET into aggregate. - - void --AggLayout::addField (tree field_decl, size_t offset) -+insert_aggregate_field (AggLayout *al, tree decl, size_t offset) - { -- Loc l (this->aggDecl_->getModule(), 1); -- -- DECL_CONTEXT (field_decl) = this->aggType_; -- SET_DECL_OFFSET_ALIGN (field_decl, TYPE_ALIGN (TREE_TYPE (field_decl))); -- DECL_FIELD_OFFSET (field_decl) = size_int (offset); -- DECL_FIELD_BIT_OFFSET (field_decl) = bitsize_zero_node; -+ DECL_CONTEXT (decl) = al->type; -+ SET_DECL_OFFSET_ALIGN (decl, TYPE_ALIGN (TREE_TYPE (decl))); -+ DECL_FIELD_OFFSET (decl) = size_int (offset); -+ DECL_FIELD_BIT_OFFSET (decl) = bitsize_zero_node; - - // Must set this or we crash with DWARF debugging. -- object_file->setDeclLoc (field_decl, l); -+ set_decl_location (decl, al->decl->loc); - -- TREE_THIS_VOLATILE (field_decl) = TYPE_VOLATILE (TREE_TYPE (field_decl)); -+ TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (TREE_TYPE (decl)); - -- layout_decl (field_decl, 0); -- TYPE_FIELDS(this->aggType_) = chainon (TYPE_FIELDS (this->aggType_), field_decl); -+ layout_decl (decl, 0); -+ TYPE_FIELDS(al->type) = chainon (TYPE_FIELDS (al->type), decl); - } - --// Wrap-up and compute finalised aggregate type. ATTRS are --// if any GCC attributes were applied to the type declaration. -+// Wrap-up and compute finalised aggregate type. Writing out -+// any GCC attributes that were applied to the type declaration. - - void --AggLayout::finish (Expressions *attrs) -+finish_aggregate_type (AggLayout *al, Expressions *attrs) - { -- unsigned structsize = this->aggDecl_->structsize; -- unsigned alignsize = this->aggDecl_->alignsize; -+ unsigned structsize = al->decl->structsize; -+ unsigned alignsize = al->decl->alignsize; - -- TYPE_SIZE (this->aggType_) = NULL_TREE; -+ TYPE_SIZE (al->type) = NULL_TREE; - - if (attrs) -- decl_attributes (&this->aggType_, build_attributes (attrs), -+ decl_attributes (&al->type, build_attributes (attrs), - ATTR_FLAG_TYPE_IN_PLACE); - -- TYPE_SIZE (this->aggType_) = bitsize_int (structsize * BITS_PER_UNIT); -- TYPE_SIZE_UNIT (this->aggType_) = size_int (structsize); -- TYPE_ALIGN (this->aggType_) = alignsize * BITS_PER_UNIT; -- TYPE_PACKED (this->aggType_) = (alignsize == 1); -+ TYPE_SIZE (al->type) = bitsize_int (structsize * BITS_PER_UNIT); -+ TYPE_SIZE_UNIT (al->type) = size_int (structsize); -+ TYPE_ALIGN (al->type) = alignsize * BITS_PER_UNIT; -+ TYPE_PACKED (al->type) = (alignsize == 1); - -- compute_record_mode (this->aggType_); -+ compute_record_mode (al->type); - - // Set up variants. -- for (tree x = TYPE_MAIN_VARIANT (this->aggType_); x; x = TYPE_NEXT_VARIANT (x)) -+ for (tree x = TYPE_MAIN_VARIANT (al->type); x; x = TYPE_NEXT_VARIANT (x)) - { -- TYPE_FIELDS (x) = TYPE_FIELDS (this->aggType_); -- TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (this->aggType_); -- TYPE_ALIGN (x) = TYPE_ALIGN (this->aggType_); -- TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (this->aggType_); -+ TYPE_FIELDS (x) = TYPE_FIELDS (al->type); -+ TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (al->type); -+ TYPE_ALIGN (x) = TYPE_ALIGN (al->type); -+ TYPE_USER_ALIGN (x) = TYPE_USER_ALIGN (al->type); - } - } - ---- a/src/gcc/d/d-codegen.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-codegen.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-codegen.h -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -45,34 +45,12 @@ enum LibCall - { - LIBCALL_NONE = -1, - LIBCALL_INVARIANT, -- LIBCALL_AAPPLYRCD1, LIBCALL_AAPPLYRCD2, -- LIBCALL_AAPPLYRCW1, LIBCALL_AAPPLYRCW2, -- LIBCALL_AAPPLYRDC1, LIBCALL_AAPPLYRDC2, -- LIBCALL_AAPPLYRDW1, LIBCALL_AAPPLYRDW2, -- LIBCALL_AAPPLYRWC1, LIBCALL_AAPPLYRWC2, -- LIBCALL_AAPPLYRWD1, LIBCALL_AAPPLYRWD2, -- LIBCALL_AAPPLYCD1, LIBCALL_AAPPLYCD2, -- LIBCALL_AAPPLYCW1, LIBCALL_AAPPLYCW2, -- LIBCALL_AAPPLYDC1, LIBCALL_AAPPLYDC2, -- LIBCALL_AAPPLYDW1, LIBCALL_AAPPLYDW2, -- LIBCALL_AAPPLYWC1, LIBCALL_AAPPLYWC2, -- LIBCALL_AAPPLYWD1, LIBCALL_AAPPLYWD2, -- LIBCALL_AAAPPLY, LIBCALL_AAAPPLY2, - - LIBCALL_AADELX, LIBCALL_AAEQUAL, - LIBCALL_AAGETRVALUEX, LIBCALL_AAGETX, - LIBCALL_AAINX, -- LIBCALL_AALEN, - -- LIBCALL_ADCMP, LIBCALL_ADCMP2, -- LIBCALL_ADDUPT, -- LIBCALL_ADEQ, LIBCALL_ADEQ2, -- LIBCALL_ADREVERSE, -- LIBCALL_ADREVERSECHAR, -- LIBCALL_ADREVERSEWCHAR, -- LIBCALL_ADSORT, -- LIBCALL_ADSORTCHAR, -- LIBCALL_ADSORTWCHAR, -+ LIBCALL_ADCMP2, LIBCALL_ADEQ2, - - LIBCALL_ALLOCMEMORY, - LIBCALL_ARRAY_BOUNDS, -@@ -96,9 +74,6 @@ enum LibCall - LIBCALL_CALLFINALIZER, - LIBCALL_CALLINTERFACEFINALIZER, - -- LIBCALL_CRITICALENTER, -- LIBCALL_CRITICALEXIT, -- - LIBCALL_DELARRAY, LIBCALL_DELARRAYT, - LIBCALL_DELCLASS, LIBCALL_DELINTERFACE, - LIBCALL_DELMEMORY, -@@ -107,9 +82,6 @@ enum LibCall - LIBCALL_HIDDEN_FUNC, - LIBCALL_INTERFACE_CAST, - -- LIBCALL_MONITORENTER, -- LIBCALL_MONITOREXIT, -- - LIBCALL_NEWARRAYT, LIBCALL_NEWARRAYIT, - LIBCALL_NEWARRAYMTX, LIBCALL_NEWARRAYMITX, - LIBCALL_NEWCLASS, LIBCALL_NEWITEMT, -@@ -147,6 +119,8 @@ extern tree d_mark_used (tree exp); - extern tree d_mark_read (tree exp); - extern tree build_address (tree exp); - -+extern tree build_struct_memcmp (tree_code code, StructDeclaration *sd, tree arg0, tree arg1); -+ - // Routines to handle variables that are references. - extern bool decl_reference_p (Declaration *decl); - extern tree declaration_type (Declaration *decl); -@@ -163,6 +137,7 @@ extern tree insert_type_modifiers (tree - extern tree build_two_field_type (tree t1, tree t2, Type *type, const char *n1, const char *n2); - - extern tree build_exception_object (void); -+extern tree build_float_modulus (tree type, tree t1, tree t2); - - extern tree indirect_ref (tree type, tree exp); - extern tree build_deref (tree exp); -@@ -171,9 +146,6 @@ extern tree maybe_compound_expr (tree ar - extern tree maybe_vcompound_expr (tree arg0, tree arg1); - - extern tree bind_expr (tree var_chain, tree body); -- --extern bool error_mark_p (tree t); -- - extern tree d_build_label (Loc loc, Identifier *ident); - - // Type conversion. -@@ -184,9 +156,11 @@ extern tree convert_expr (tree exp, Type - extern tree convert_for_assignment (tree expr, Type *exp_type, Type *target_type); - extern tree convert_for_condition (tree expr, Type *type); - -+extern tree d_array_convert (Expression *exp); -+ - // Simple constants - extern tree build_integer_cst (dinteger_t value, tree type = integer_type_node); --extern tree build_float_cst (const real_t& value, Type *target_type); -+extern tree build_float_cst (const real_t& value, Type *totype); - - extern dinteger_t cst_to_hwi (double_int cst); - extern dinteger_t tree_to_hwi (tree t); -@@ -205,12 +179,15 @@ extern tree get_array_length (tree exp, - extern tree void_okay_p (tree t); - - // Various expressions -+extern tree build_binary_op (tree_code code, tree type, tree arg0, tree arg1); - extern tree build_array_index (tree ptr, tree index); --extern tree build_offset_op (enum tree_code op, tree ptr, tree idx); -+extern tree build_offset_op (tree_code op, tree ptr, tree idx); - extern tree build_offset (tree ptr_node, tree byte_offset); - - // Function calls --extern tree d_build_call (tree type, tree callee, tree args); -+extern tree d_build_call (FuncDeclaration *fd, tree object, Expressions *args); -+extern tree d_build_call (TypeFunction *tf, tree callable, tree object, Expressions *arguments); -+extern tree d_build_call_list (tree type, tree callee, tree args); - extern tree d_build_call_nary (tree callee, int n_args, ...); - - extern tree d_assert_call (Loc loc, LibCall libcall, tree msg = NULL_TREE); -@@ -220,14 +197,24 @@ extern tree build_frame_type (FuncDeclar - extern FuncFrameInfo *get_frameinfo (FuncDeclaration *fd); - extern tree get_framedecl (FuncDeclaration *inner, FuncDeclaration *outer); - -+extern tree build_vthis (Dsymbol *decl, FuncDeclaration *fd, Expression *e); -+ -+// Static chain for nested functions -+extern tree get_frame_for_symbol (FuncDeclaration *func, Dsymbol *sym); -+ - extern bool needs_static_chain (FuncDeclaration *f); - - // Local variables --extern tree build_local_var (tree type); -+extern void build_local_var (VarDeclaration *vd, FuncDeclaration *fd); -+extern tree build_local_temp (tree type); - extern tree create_temporary_var (tree type); - extern tree maybe_temporary_var (tree exp, tree *out_var); -+extern void expand_decl (tree decl); -+ -+extern tree get_decl_tree (Declaration *decl, FuncDeclaration *func); - - // Temporaries (currently just SAVE_EXPRs) -+extern tree make_temp (tree t); - extern tree maybe_make_temp (tree t); - extern bool d_has_side_effects (tree t); - -@@ -238,6 +225,10 @@ extern bool array_bounds_check (void); - extern tree d_checked_index (Loc loc, tree index, tree upr, bool inclusive); - extern tree d_bounds_condition (tree index, tree upr, bool inclusive); - -+// Classes -+extern tree build_class_binfo (tree super, ClassDeclaration *cd); -+extern tree build_interface_binfo (tree super, ClassDeclaration *cd, unsigned& offset); -+ - // Delegates - extern tree delegate_method (tree exp); - extern tree delegate_object (tree exp); -@@ -255,6 +246,8 @@ extern tree maybe_expand_builtin (tree c - - extern void maybe_set_builtin_frontend (FuncDeclaration *decl); - -+extern tree build_typeinfo (Type *t); -+ - // Type management for D frontend types. - // Returns TRUE if T1 and T2 are mutably the same type. - inline bool -@@ -342,7 +335,7 @@ build_vconvert (tree t, tree e) - } - - inline tree --build_boolop (enum tree_code code, tree arg0, tree arg1) -+build_boolop (tree_code code, tree arg0, tree arg1) - { - return fold_build2_loc (input_location, code, boolean_type_node, arg0, arg1); - } -@@ -359,14 +352,6 @@ vcompound_expr (tree arg0, tree arg1) - return build2_loc (input_location, COMPOUND_EXPR, void_type_node, arg0, arg1); - } - --// Giving error_mark_node a type allows for some assumptions about --// the type of an arbitrary expression. --inline tree --error_mark (Type *t) --{ -- return build1_loc (input_location, NOP_EXPR, t->toCtype(), error_mark_node); --} -- - // Routines for built in structured types - inline tree - real_part (tree c) -@@ -391,99 +376,34 @@ extern TypeFunction *get_function_type ( - extern bool call_by_alias_p (FuncDeclaration *caller, FuncDeclaration *callee); - - --// Code generation routines should be in a separate namespace, but so many --// routines need a reference to an IRState to expand Expressions. Solution --// is to make IRState the code generation namespace with the actual IR state --// routines as a mixin. Also a lot of routines are static (don't need IR --// state or expand Expressions), but are still called using . or ->. -- --// Functions without a verb create trees --// Functions with 'do' affect the current instruction stream (or output assembler code). --// functions with other names are for attribute manipulate, etc. -- --struct IRState : IRBase --{ -- public: -- // ** Local variables -- void emitLocalVar (VarDeclaration *v, bool no_init = false); -- -- void expandDecl (tree t_decl); -- -- tree var (Declaration *decl); -- -- // ** Type conversion -- tree convertForArgument (Expression *exp, Parameter *arg); -- tree toDArray (Expression *exp); -- -- // ** Various expressions -- static tree buildOp (enum tree_code code, tree type, tree arg0, tree arg1); -- tree buildAssignOp (enum tree_code code, Type *type, Expression *e1, Expression *e2); -- -- tree arrayElemRef (IndexExp *aer_exp, ArrayScope *aryscp); -- -- void doArraySet (tree in_ptr, tree in_value, tree in_count); -- tree arraySetExpr (tree ptr, tree value, tree count); -- -- // ** Function calls -- tree call (Expression *expr, Expressions *arguments); -- tree call (FuncDeclaration *func_decl, Expressions *args); -- tree call (FuncDeclaration *func_decl, tree object, Expressions *args); -- tree call (TypeFunction *guess, tree callable, tree object, Expressions *arguments); -- -- static tree floatMod (tree type, tree arg0, tree arg1); -- -- tree typeinfoReference (Type *t); -- -- void buildChain (FuncDeclaration *func); -- -- tree findThis (ClassDeclaration *target_cd); -- tree getVThis (Dsymbol *decl, Expression *e); -- -- // Static chain for nested functions -- tree getFrameForSymbol (Dsymbol *nested_sym); -- -- protected: -- tree maybeExpandSpecialCall (tree call_exp); --}; -- - // Globals. --extern Module *cmodule; --extern IRState *cirstate; --extern ObjectFile *object_file; -+extern Module *current_module_decl; -+extern IRState *current_irstate; - - // Various helpers that need extra state - --struct WrappedExp : Expression -+class WrappedExp : public Expression - { -+public: - tree exp_node; -- WrappedExp (Loc loc, enum TOK op, tree exp_node, Type *type); -+ WrappedExp (Loc loc, TOK op, tree exp_node, Type *type); - void toCBuffer (OutBuffer *buf, HdrGenState *hgs); - elem *toElem (IRState *irs); - }; - --class AggLayout -+struct AggLayout - { -- public: -- AggLayout (AggregateDeclaration *ini_agg_decl, tree ini_agg_type) -- : aggDecl_(ini_agg_decl), -- aggType_(ini_agg_type) -- { } -- -- void go (void) -- { visit (this->aggDecl_); } -- -- void visit (AggregateDeclaration *decl); -- -- void doFields (VarDeclarations *fields, AggregateDeclaration *agg); -- void doInterfaces (BaseClasses *bases); -- void addField (tree field_decl, size_t offset); -- void finish (Expressions *attrs); -- -- private: -- AggregateDeclaration *aggDecl_; -- tree aggType_; -+ AggLayout (AggregateDeclaration *indecl, tree intype) -+ : decl (indecl), type (intype) { } -+ -+ AggregateDeclaration *decl; -+ tree type; - }; - -+extern void layout_aggregate_type (AggLayout *al, AggregateDeclaration *decl); -+extern void insert_aggregate_field (AggLayout *al, tree field, size_t offset); -+extern void finish_aggregate_type (AggLayout *al, Expressions *attrs); -+ - class ArrayScope - { - public: ---- a/src/gcc/d/d-convert.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-convert.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-convert.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -26,19 +26,19 @@ static tree - d_convert_basic (tree type, tree expr) - { - tree e = expr; -- enum tree_code code = TREE_CODE (type); -- const char *invalid_conv_diag; -- tree ret; -+ tree_code code = TREE_CODE (type); - - if (type == error_mark_node - || expr == error_mark_node - || TREE_TYPE (expr) == error_mark_node) - return error_mark_node; - -- invalid_conv_diag = targetm.invalid_conversion (TREE_TYPE (expr), type); -+ const char *invalid_conv_diag -+ = targetm.invalid_conversion (TREE_TYPE (expr), type); -+ - if (invalid_conv_diag) - { -- error (invalid_conv_diag); -+ error ("%s", invalid_conv_diag); - return error_mark_node; - } - -@@ -50,11 +50,12 @@ d_convert_basic (tree type, tree expr) - && TYPE_DOMAIN (type) == TYPE_DOMAIN (TREE_TYPE (expr))) - return expr; - -- ret = targetm.convert_to_type (type, expr); -+ tree ret = targetm.convert_to_type (type, expr); - if (ret) - return ret; - - STRIP_TYPE_NOPS (e); -+ tree etype = TREE_TYPE (e); - - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))) - return fold_convert (type, expr); -@@ -73,6 +74,14 @@ d_convert_basic (tree type, tree expr) - - case INTEGER_TYPE: - case ENUMERAL_TYPE: -+ if (TREE_CODE (etype) == POINTER_TYPE -+ || TREE_CODE (etype) == REFERENCE_TYPE) -+ { -+ // Convert to an unsigned integer of the correct width first. -+ tree utype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype), 1); -+ e = fold_build1 (CONVERT_EXPR, utype, e); -+ } -+ - ret = convert_to_integer (type, e); - goto maybe_fold; - -@@ -121,7 +130,7 @@ d_convert_basic (tree type, tree expr) - tree - convert (tree type, tree expr) - { -- enum tree_code code = TREE_CODE (type); -+ tree_code code = TREE_CODE (type); - tree etype = TREE_TYPE (expr); - - switch (code) ---- a/src/gcc/d/d-ctype.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-ctype.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-ctype.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -32,7 +32,7 @@ Type::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - switch (ty) - { -@@ -134,7 +134,7 @@ Type::toCtype (void) - - - case Terror: -- return error_mark_node; -+ return d_unknown_type_node; - - /* We can get Tident with forward references. There seems to - be a legitame case (dstress:debug_info_03). I have not seen this -@@ -186,7 +186,7 @@ TypeTypedef::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - tree basetype = sym->basetype->toCtype(); - const char *name = toChars(); -@@ -217,10 +217,10 @@ TypeEnum::toCtype (void) - { - if (!ctype) - { -- /* Enums in D2 can have a base type that is not necessarily integral. -- So don't bother trying to make an ENUMERAL_TYPE using them. */ - if (!sym->memtype->isintegral() || sym->memtype->ty == Tbool) - { -+ // Enums in D2 can have a base type that is not necessarily integral. -+ // So don't bother trying to make an ENUMERAL_TYPE using them. - ctype = sym->memtype->toCtype(); - } - else -@@ -234,9 +234,8 @@ TypeEnum::toCtype (void) - if (flag_short_enums) - TYPE_PACKED (ctype) = 1; - -- TYPE_PRECISION (ctype) = size (0) * 8; -+ TYPE_PRECISION (ctype) = size (sym->loc) * 8; - TYPE_SIZE (ctype) = 0; -- TYPE_MAIN_VARIANT (ctype) = TYPE_MAIN_VARIANT (cmemtype); - - if (sym->userAttributes) - decl_attributes (&ctype, build_attributes (sym->userAttributes), -@@ -247,34 +246,34 @@ TypeEnum::toCtype (void) - layout_type (ctype); - TYPE_UNSIGNED (ctype) = TYPE_UNSIGNED (cmemtype); - -- // Move this to toDebug() ? - tree enum_values = NULL_TREE; - if (sym->members) - { - for (size_t i = 0; i < sym->members->dim; i++) - { -- EnumMember *member = (sym->members->tdata()[i])->isEnumMember(); -+ EnumMember *member = (*sym->members)[i]->isEnumMember(); - // Templated functions can seep through to the backend - just ignore for now. - if (member == NULL) - continue; - -- char *ident = NULL; -- if (sym->ident) -- ident = concat (sym->ident->string, ".", -- member->ident->string, NULL); -- -- tree tident = get_identifier (ident ? ident : member->ident->string); -- tree tvalue = build_integer_cst (member->value->toInteger(), ctype); -- enum_values = chainon (enum_values, build_tree_list (tident, tvalue)); -+ tree ident = get_identifier (member->ident->string); -+ tree value = build_integer_cst (member->value->toInteger(), cmemtype); -+ -+ // Build a identifier for the enumeration constant. -+ tree decl = build_decl (UNKNOWN_LOCATION, CONST_DECL, ident, cmemtype); -+ set_decl_location (decl, member->loc); -+ DECL_CONTEXT (decl) = ctype; -+ TREE_CONSTANT (decl) = 1; -+ TREE_READONLY (decl) = 1; -+ DECL_INITIAL (decl) = value; - -- if (sym->ident) -- free (ident); -+ // Add this enumeration constant to the list for this type. -+ enum_values = chainon (enum_values, build_tree_list (ident, decl)); - } - } -- TYPE_VALUES (ctype) = enum_values; - -- object_file->initTypeDecl (ctype, sym); -- object_file->declareType (ctype, sym); -+ TYPE_VALUES (ctype) = enum_values; -+ build_type_decl (ctype, sym); - } - } - -@@ -291,7 +290,7 @@ TypeStruct::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - // need to set this right away in case of self-references - ctype = make_node (sym->isUnionDeclaration() ? UNION_TYPE : RECORD_TYPE); -@@ -307,11 +306,11 @@ TypeStruct::toCtype (void) - TYPE_PACKED (ctype) = (sym->alignsize == 1); - compute_record_mode (ctype); - -- AggLayout agg_layout (sym, ctype); -- agg_layout.go(); -- agg_layout.finish (sym->userAttributes); -+ AggLayout al = AggLayout (sym, ctype); -+ layout_aggregate_type (&al, sym); -+ finish_aggregate_type (&al, sym->userAttributes); - -- object_file->initTypeDecl (ctype, sym); -+ build_type_decl (ctype, sym); - TYPE_CONTEXT (ctype) = d_decl_context (sym); - } - } -@@ -335,7 +334,7 @@ TypeFunction::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - tree type_list = NULL_TREE; - tree ret_type; -@@ -372,12 +371,16 @@ TypeFunction::toCtype (void) - TYPE_LANG_SPECIFIC (ctype) = build_d_type_lang_specific (this); - d_keep (ctype); - -- if (next->toBasetype()->ty == Tstruct) -+ if (ret_type != void_type_node) - { -- // Non-POD structs must return in memory. -- TypeStruct *ts = (TypeStruct *) next->toBasetype(); -- if (!ts->sym->isPOD()) -- TREE_ADDRESSABLE (ctype) = 1; -+ Type *tn = next->baseElemOf(); -+ if (tn->ty == Tstruct) -+ { -+ // Non-POD structs must return in memory. -+ TypeStruct *ts = (TypeStruct *) tn->toBasetype(); -+ if (!ts->sym->isPOD()) -+ TREE_ADDRESSABLE (ctype) = 1; -+ } - } - - switch (linkage) -@@ -394,7 +397,7 @@ TypeFunction::toCtype (void) - break; - - default: -- fprintf (stderr, "linkage = %d\n", linkage); -+ fprintf (global.stdmsg, "linkage = %d\n", linkage); - gcc_unreachable(); - } - } -@@ -403,7 +406,7 @@ TypeFunction::toCtype (void) - return ctype; - } - --enum RET -+RET - TypeFunction::retStyle (void) - { - /* Return by reference or pointer. */ -@@ -426,13 +429,13 @@ TypeVector::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - int nunits = ((TypeSArray *) basetype)->dim->toUInteger(); - tree inner = elementType()->toCtype(); - - if (inner == void_type_node) -- inner = Type::tint8->toCtype(); -+ inner = Type::tuns8->toCtype(); - - ctype = build_vector_type (inner, nunits); - layout_type (ctype); -@@ -518,7 +521,7 @@ TypeAArray::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - /* Library functions expect a struct-of-pointer which could be passed - differently from a pointer. */ -@@ -528,6 +531,7 @@ TypeAArray::toCtype (void) - DECL_CONTEXT (ptr) = ctype; - TYPE_FIELDS (ctype) = ptr; - TYPE_NAME (ctype) = get_identifier (toChars()); -+ TYPE_TRANSPARENT_AGGR (ctype) = 1; - layout_type (ctype); - - TYPE_LANG_SPECIFIC (ctype) = build_d_type_lang_specific (this); -@@ -548,7 +552,7 @@ TypePointer::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - ctype = build_pointer_type (next->toCtype()); - } -@@ -567,7 +571,7 @@ TypeDelegate::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { - gcc_assert (next->toBasetype()->ty == Tfunction); - tree nexttype = next->toCtype(); -@@ -599,81 +603,48 @@ TypeClass::toCtype (void) - ctype = castMod(0)->toCtype(); - ctype = insert_type_modifiers (ctype, mod); - } -- else -+ else - { -- tree rec_type; -- Array base_class_decls; -- bool inherited = sym->baseClass != 0; -- tree obj_rec_type; -- tree vfield; -- -- /* Need to set ctype right away in case of self-references to -- the type during this call. */ -- rec_type = make_node (RECORD_TYPE); -- ctype = build_reference_type (rec_type); -- d_keep (ctype); // because BINFO moved out to toDebug -- -- obj_rec_type = TREE_TYPE (build_object_type()->toCtype()); -+ // Need to set ctype right away in case of self-references to -+ // the type during this call. -+ tree basetype = make_node (RECORD_TYPE); -+ ctype = build_reference_type (basetype); -+ d_keep (ctype); - -- // Note that this is set on the reference type, not the record type. -+ // Note that this is set on both the reference type and record type. - TYPE_LANG_SPECIFIC (ctype) = build_d_type_lang_specific (this); -+ TYPE_LANG_SPECIFIC (basetype) = TYPE_LANG_SPECIFIC (ctype); - -- AggLayout agg_layout (sym, rec_type); -- -- // Most of this silly code is just to produce correct debugging information. -+ // Add the fields of each base class -+ AggLayout al = AggLayout (sym, basetype); -+ layout_aggregate_type (&al, sym); -+ finish_aggregate_type (&al, sym->userAttributes); - -- /* gdb apparently expects the vtable field to be named -- "_vptr$...." (stabsread.c) Otherwise, the debugger gives -- lots of annoying error messages. C++ appends the class -- name of the first base witht that field after the '$'. */ -- /* update: annoying messages might not appear anymore after making -- other changes */ -- // Add the virtual table pointer -- tree decl = build_decl (UNKNOWN_LOCATION, FIELD_DECL, -- get_identifier ("_vptr$"), d_vtbl_ptr_type_node); -- agg_layout.addField (decl, 0); // %% target stuff.. -- -- if (inherited) -- { -- vfield = copy_node (decl); -- DECL_ARTIFICIAL (decl) = DECL_IGNORED_P (decl) = 1; -- } -+ // Create BINFO even if debugging is off. This is needed to keep -+ // references to inherited types. -+ if (!sym->isInterfaceDeclaration()) -+ TYPE_BINFO (basetype) = build_class_binfo (NULL_TREE, sym); - else - { -- vfield = decl; -+ unsigned offset = 0; -+ TYPE_BINFO (basetype) = build_interface_binfo (NULL_TREE, sym, offset); - } -- DECL_VIRTUAL_P (vfield) = 1; -- TYPE_VFIELD (rec_type) = vfield; // This only seems to affect debug info -- TREE_ADDRESSABLE (rec_type) = 1; - -- if (!sym->isInterfaceDeclaration()) -+ // Same for virtual methods too. -+ for (size_t i = 0; i < sym->vtbl.dim; i++) - { -- DECL_FCONTEXT (vfield) = obj_rec_type; -- -- // Add the monitor -- // %% target type -- decl = build_decl (UNKNOWN_LOCATION, FIELD_DECL, -- get_identifier ("_monitor"), ptr_type_node); -- DECL_FCONTEXT (decl) = obj_rec_type; -- DECL_ARTIFICIAL (decl) = DECL_IGNORED_P (decl) = inherited; -- agg_layout.addField (decl, Target::ptrsize); -+ FuncDeclaration *fd = sym->vtbl[i]->isFuncDeclaration(); -+ tree method = fd ? fd->toSymbol()->Stree : NULL_TREE; - -- // Add the fields of each base class -- agg_layout.go(); -- } -- else -- { -- ClassDeclaration *p = sym; -- while (p->baseclasses->dim) -- p = (p->baseclasses->tdata()[0])->base; -- -- DECL_FCONTEXT (vfield) = TREE_TYPE (p->type->toCtype()); -+ if (method && DECL_CONTEXT (method) == basetype) -+ { -+ DECL_CHAIN (method) = TYPE_METHODS (basetype); -+ TYPE_METHODS (basetype) = method; -+ } - } - -- agg_layout.finish (sym->userAttributes); -- -- object_file->initTypeDecl (rec_type, sym); -- TYPE_CONTEXT (rec_type) = d_decl_context (sym); -+ build_type_decl (basetype, sym); -+ TYPE_CONTEXT (basetype) = d_decl_context (sym); - } - } - ---- a/src/gcc/d/d-decls.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-decls.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-decls.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -28,34 +28,16 @@ - #include "init.h" - #include "module.h" - #include "statement.h" -+#include "ctfe.h" - - #include "dfrontend/target.h" - --// Construct a SymbolDeclaration, whose components are a symbol S --// and a struct declaration DSYM. -- --SymbolDeclaration::SymbolDeclaration (Loc loc, Symbol *s, StructDeclaration *dsym) -- : Declaration (new Identifier (s->Sident, TOKidentifier)) --{ -- this->loc = loc; -- sym = s; -- this->dsym = dsym; -- storage_class |= STCconst; --} -- - // Create the symbol with tree for struct initialisers. - - Symbol * - SymbolDeclaration::toSymbol (void) - { -- // Create the actual back-end value if not yet done -- if (!sym->Stree) -- { -- if (dsym) -- dsym->toInitializer(); -- gcc_assert (sym->Stree); -- } -- return sym; -+ return dsym->toInitializer(); - } - - -@@ -65,14 +47,19 @@ SymbolDeclaration::toSymbol (void) - Symbol * - Dsymbol::toSymbolX (const char *prefix, int, type *, const char *suffix) - { -- const char *n = mangle(); -- unsigned nlen = strlen (n); -- size_t sz = (2 + nlen + sizeof (size_t) * 3 + strlen (prefix) + strlen (suffix) + 1); -+ const char *symbol = mangle(); -+ unsigned prefixlen = strlen (prefix); -+ size_t sz = (2 + strlen (symbol) + sizeof (size_t) * 3 + prefixlen + strlen (suffix) + 1); - Symbol *s = new Symbol(); - - s->Sident = XNEWVEC (const char, sz); -- snprintf (CONST_CAST (char *, s->Sident), sz, "_D%s%zu%s%s", -- n, strlen (prefix), prefix, suffix); -+ snprintf (CONST_CAST (char *, s->Sident), sz, "_D%s%u%s%s", -+ symbol, prefixlen, prefix, suffix); -+ -+ s->prettyIdent = XNEWVEC (const char, sz); -+ snprintf (CONST_CAST (char *, s->prettyIdent), sz, "%s.%s", -+ toPrettyChars(), prefix); -+ - return s; - } - -@@ -80,30 +67,69 @@ Dsymbol::toSymbolX (const char *prefix, - Symbol * - Dsymbol::toSymbol (void) - { -- fprintf (stderr, "Dsymbol::toSymbol() '%s', kind = '%s'\n", toChars(), kind()); -+ fprintf (global.stdmsg, "Dsymbol::toSymbol() '%s', kind = '%s'\n", toChars(), kind()); - gcc_unreachable(); // BUG: implement - return NULL; - } - --// Generate an import symbol from symbol. -+// Generate an import symbol for debug. If this is a module or package symbol, -+// then build the chain of NAMESPACE_DECLs. - - Symbol * - Dsymbol::toImport (void) - { - if (!isym) - { -- if (!csym) -- csym = toSymbol(); -- isym = toImport (csym); -+ Module *m = this->isModule(); -+ if (m != NULL) -+ { -+ isym = new Symbol(); -+ isym->prettyIdent = this->toPrettyChars(); -+ -+ // Build the module namespace, this is considered toplevel, -+ // regardless if there are parent packages. -+ tree decl = build_decl (UNKNOWN_LOCATION, NAMESPACE_DECL, -+ get_identifier (isym->prettyIdent), -+ void_type_node); -+ isym->Stree = decl; -+ d_keep (decl); -+ -+ Loc loc = (m->md != NULL) ? m->md->loc : Loc (m, 1); -+ set_decl_location (decl, loc); -+ -+ if (output_module_p (m)) -+ DECL_EXTERNAL (decl) = 1; -+ -+ TREE_PUBLIC (decl) = 1; -+ DECL_CONTEXT (decl) = NULL_TREE; -+ } -+ else -+ { -+ // Any other kind of symbol should have their csym set. -+ // If this is an unexpected import, the compiler will throw an error. -+ if (!csym) -+ csym = toSymbol(); -+ -+ isym = toImport (csym); -+ } - } -+ - return isym; - } - -+// Generate an IMPORTED_DECL from symbol SYM. -+ - Symbol * --Dsymbol::toImport (Symbol *) -+Dsymbol::toImport (Symbol *sym) - { -- // This is not used in GDC (yet?) -- return NULL; -+ tree decl = make_node (IMPORTED_DECL); -+ TREE_TYPE (decl) = void_type_node; -+ IMPORTED_DECL_ASSOCIATED_DECL (decl) = sym->Stree; -+ d_keep (decl); -+ -+ Symbol *s = new Symbol(); -+ s->Stree = decl; -+ return s; - } - - -@@ -114,12 +140,9 @@ VarDeclaration::toSymbol (void) - { - if (!csym) - { -- tree var_decl; -- enum tree_code decl_kind; -- - // For field declaration, it is possible for toSymbol to be called - // before the parent's toCtype() -- if (storage_class & STCfield) -+ if (isField()) - { - AggregateDeclaration *parent_decl = toParent()->isAggregateDeclaration(); - gcc_assert (parent_decl); -@@ -139,115 +162,88 @@ VarDeclaration::toSymbol (void) - else - csym->Sident = ident->string; - -- if (storage_class & STCparameter) -- decl_kind = PARM_DECL; -- else if (storage_class & STCmanifest) -- decl_kind = CONST_DECL; -- else -- decl_kind = VAR_DECL; -- -- var_decl = build_decl (UNKNOWN_LOCATION, decl_kind, get_identifier (csym->Sident), -- declaration_type (this)); -- -- csym->Stree = var_decl; -+ tree_code code = isParameter() ? PARM_DECL -+ : !canTakeAddressOf() ? CONST_DECL -+ : VAR_DECL; -+ -+ tree decl = build_decl (UNKNOWN_LOCATION, code, -+ get_identifier (ident->string), -+ declaration_type (this)); -+ DECL_CONTEXT (decl) = d_decl_context (this); -+ set_decl_location (decl, this); - -- if (decl_kind != CONST_DECL) -+ if (isParameter()) - { -- if (isDataseg()) -- { -- tree id = get_identifier (csym->Sident); -- if (protection == PROTpublic || storage_class & (STCstatic | STCextern)) -- id = targetm.mangle_decl_assembler_name (var_decl, id); -- SET_DECL_ASSEMBLER_NAME (var_decl, id); -- } -+ DECL_ARG_TYPE (decl) = TREE_TYPE (decl); -+ gcc_assert (TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL); - } -+ else if (!canTakeAddressOf()) -+ { -+ // Manifest constants have no address in memory. -+ TREE_CONSTANT (decl) = 1; -+ TREE_READONLY (decl) = 1; -+ TREE_STATIC (decl) = 0; -+ } -+ else if (isDataseg()) -+ { -+ if (this->mangleOverride) -+ set_user_assembler_name (decl, this->mangleOverride); -+ else -+ { -+ tree mangle = get_identifier (csym->Sident); - -- DECL_LANG_SPECIFIC (var_decl) = build_d_decl_lang_specific (this); -- d_keep (var_decl); -- object_file->setDeclLoc (var_decl, this); -- -- if (decl_kind == VAR_DECL) -- object_file->setupSymbolStorage (this, var_decl); -- else if (decl_kind == PARM_DECL) -- { -- /* from gcc code: Some languages have different nominal and real types. */ -- // %% What about DECL_ORIGINAL_TYPE, DECL_ARG_TYPE_AS_WRITTEN, DECL_ARG_TYPE ? -- DECL_ARG_TYPE (var_decl) = TREE_TYPE (var_decl); -- DECL_CONTEXT (var_decl) = d_decl_context (this); -- gcc_assert (TREE_CODE (DECL_CONTEXT (var_decl)) == FUNCTION_DECL); -- } -- else if (decl_kind == CONST_DECL) -- { -- /* Not sure how much of an optimization this is... It is needed -- for foreach loops on tuples which 'declare' the index variable -- as a constant for each iteration. */ -- Expression *e = NULL; -+ if (protection == PROTpublic || storage_class & (STCstatic | STCextern)) -+ mangle = targetm.mangle_decl_assembler_name (decl, mangle); - -- if (init) -- { -- if (!init->isVoidInitializer()) -- { -- e = init->toExpression(); -- gcc_assert (e != NULL); -- } -+ SET_DECL_ASSEMBLER_NAME (decl, mangle); - } -- else -- e = type->defaultInit(); - -- if (e) -- DECL_INITIAL (var_decl) = e->toElem (cirstate); -+ setup_symbol_storage (this, decl, false); - } - -+ DECL_LANG_SPECIFIC (decl) = build_d_decl_lang_specific (this); -+ d_keep (decl); -+ csym->Stree = decl; -+ - // Can't set TREE_STATIC, etc. until we get to toObjFile as this could be -- // called from a varaible in an imported module -- // %% (out const X x) doesn't mean the reference is const... -+ // called from a variable in an imported module. - if ((isConst() || isImmutable()) && (storage_class & STCinit) - && !decl_reference_p (this)) - { -- // %% CONST_DECLS don't have storage, so we can't use those, -- // but it would be nice to get the benefit of them (could handle in -- // VarExp -- makeAddressOf could switch back to the VAR_DECL -- -- if (!TREE_STATIC (var_decl)) -- TREE_READONLY (var_decl) = 1; -+ if (!TREE_STATIC (decl)) -+ TREE_READONLY (decl) = 1; - else - csym->Sreadonly = true; - -- // can at least do this... -- // const doesn't seem to matter for aggregates, so prevent problems.. -+ // Const doesn't seem to matter for aggregates, so prevent problems. - if (isConst() && isDataseg()) -- TREE_CONSTANT (var_decl) = 1; -+ TREE_CONSTANT (decl) = 1; - } - - // Propagate volatile. -- if (TYPE_VOLATILE (TREE_TYPE (var_decl))) -- TREE_THIS_VOLATILE (var_decl) = 1; -+ if (TYPE_VOLATILE (TREE_TYPE (decl))) -+ TREE_THIS_VOLATILE (decl) = 1; - - #if TARGET_DLLIMPORT_DECL_ATTRIBUTES - // Have to test for import first - if (isImportedSymbol()) - { -- insert_decl_attributes (var_decl, "dllimport"); -- DECL_DLLIMPORT_P (var_decl) = 1; -+ insert_decl_attribute (decl, "dllimport"); -+ DECL_DLLIMPORT_P (decl) = 1; - } - else if (isExport()) -- insert_decl_attributes (var_decl, "dllexport"); -+ insert_decl_attribute (decl, "dllexport"); - #endif - -- if (isDataseg() && isThreadlocal()) -+ if (global.params.vtls && isDataseg() && isThreadlocal()) - { -- // Tell backend this is a thread local decl. -- DECL_TLS_MODEL (var_decl) = decl_default_tls_model (var_decl); -- -- if (global.params.vtls) -- { -- char *p = loc.toChars(); -- fprintf (stderr, "%s: %s is thread local\n", p ? p : "", toChars()); -- if (p) -- free (p); -- } -+ char *p = loc.toChars(); -+ fprintf (global.stdmsg, "%s: %s is thread local\n", p ? p : "", toChars()); -+ if (p) -+ free (p); - } - } -+ - return csym; - } - -@@ -259,14 +255,6 @@ ClassInfoDeclaration::toSymbol (void) - return cd->toSymbol(); - } - --// Create the symbol with tree for moduleinfo decls. -- --Symbol * --ModuleInfoDeclaration::toSymbol (void) --{ -- return mod->toSymbol(); --} -- - // Create the symbol with tree for typeinfo decls. - - Symbol * -@@ -280,12 +268,14 @@ TypeInfoDeclaration::toSymbol (void) - // given TypeInfo. It is the actual data, not a reference - gcc_assert (TREE_CODE (TREE_TYPE (csym->Stree)) == REFERENCE_TYPE); - TREE_TYPE (csym->Stree) = TREE_TYPE (TREE_TYPE (csym->Stree)); -+ relayout_decl (csym->Stree); - TREE_USED (csym->Stree) = 1; - -- // In gdc, built-in typeinfo will be referenced as one-only. -+ // Built-in typeinfo will be referenced as one-only. - D_DECL_ONE_ONLY (csym->Stree) = 1; -- object_file->makeDeclOneOnly (csym->Stree); -+ d_comdat_linkage (csym->Stree); - } -+ - return csym; - } - -@@ -317,180 +307,154 @@ FuncDeclaration::toSymbol (void) - { - csym = new Symbol(); - -- if (!isym) -- { -- tree id; -- TypeFunction *ftype = (TypeFunction *) (tintro ? tintro : type); -- tree fndecl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, -- NULL_TREE, NULL_TREE); -- tree fntype = NULL_TREE; -- tree vindex = NULL_TREE; -+ TypeFunction *ftype = (TypeFunction *) (tintro ? tintro : type); -+ tree fntype = NULL_TREE; -+ tree vindex = NULL_TREE; - -- csym->Stree = fndecl; -- -- if (ident) -- id = get_identifier (ident->string); -- else -- { -- static unsigned unamed_seq = 0; -- char buf[64]; -- snprintf (buf, sizeof(buf), "___unamed_%u", ++unamed_seq); -- id = get_identifier (buf); -- } -- DECL_NAME (fndecl) = id; -- DECL_CONTEXT (fndecl) = d_decl_context (this); -- -- if (needs_static_chain (this)) -- { -- D_DECL_STATIC_CHAIN (fndecl) = 1; -- // Save context and set decl_function_context for cgraph. -- csym->ScontextDecl = DECL_CONTEXT (fndecl); -- DECL_CONTEXT (fndecl) = decl_function_context (fndecl); -- } -+ // Save mangle/debug names for making thunks. -+ csym->Sident = mangleExact(); -+ csym->prettyIdent = toPrettyChars(); - -+ tree id = get_identifier (this->isMain() -+ ? csym->prettyIdent : ident->string); -+ tree fndecl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, id, NULL_TREE); -+ DECL_CONTEXT (fndecl) = d_decl_context (this); - -- /* Nested functions may not have its toObjFile called before the outer -- function is finished. GCC requires that nested functions be finished -- first so we need to arrange for toObjFile to be called earlier. */ -- Dsymbol *outer = toParent2(); -- if (outer && outer->isFuncDeclaration()) -- { -- Symbol *osym = outer->toSymbol(); -+ csym->Stree = fndecl; - -- if (osym->outputStage != Finished) -- ((FuncDeclaration *) outer)->deferred.push (this); -- } -+ if (needs_static_chain (this)) -+ { -+ D_DECL_STATIC_CHAIN (fndecl) = 1; -+ // Save context and set decl_function_context for cgraph. -+ csym->ScontextDecl = DECL_CONTEXT (fndecl); -+ DECL_CONTEXT (fndecl) = decl_function_context (fndecl); -+ } - -- TREE_TYPE (fndecl) = ftype->toCtype(); -- DECL_LANG_SPECIFIC (fndecl) = build_d_decl_lang_specific (this); -- d_keep (fndecl); -+ TREE_TYPE (fndecl) = ftype->toCtype(); -+ DECL_LANG_SPECIFIC (fndecl) = build_d_decl_lang_specific (this); -+ d_keep (fndecl); - -- if (isNested()) -- { -- /* Even if D-style nested functions are not implemented, add an -- extra argument to be compatible with delegates. */ -- fntype = build_method_type (void_type_node, TREE_TYPE (fndecl)); -- } -- else if (isThis()) -- { -- // Do this even if there is no debug info. It is needed to make -- // sure member functions are not called statically -- AggregateDeclaration *agg_decl = isMember2(); -- tree handle = agg_decl->handle->toCtype(); -- -- // If handle is a pointer type, get record type. -- if (!agg_decl->isStructDeclaration()) -- handle = TREE_TYPE (handle); -+ if (isNested()) -+ { -+ // Even if D-style nested functions are not implemented, add an -+ // extra argument to be compatible with delegates. -+ fntype = build_method_type (void_type_node, TREE_TYPE (fndecl)); -+ } -+ else if (isThis()) -+ { -+ // Do this even if there is no debug info. It is needed to make -+ // sure member functions are not called statically -+ AggregateDeclaration *agg_decl = isMember2(); -+ tree handle = agg_decl->handle->toCtype(); - -- fntype = build_method_type (handle, TREE_TYPE (fndecl)); -+ // If handle is a pointer type, get record type. -+ if (!agg_decl->isStructDeclaration()) -+ handle = TREE_TYPE (handle); - -- if (isVirtual()) -- vindex = size_int (vtblIndex); -- } -- else if (isMain() && ftype->nextOf()->toBasetype()->ty == Tvoid) -- { -- // void main() implicitly converted to int main(). -- fntype = build_function_type (integer_type_node, TYPE_ARG_TYPES (TREE_TYPE (fndecl))); -- } -+ fntype = build_method_type (handle, TREE_TYPE (fndecl)); - -- if (fntype != NULL_TREE) -- { -- TYPE_ATTRIBUTES (fntype) = TYPE_ATTRIBUTES (TREE_TYPE (fndecl)); -- TYPE_LANG_SPECIFIC (fntype) = TYPE_LANG_SPECIFIC (TREE_TYPE (fndecl)); -- TREE_ADDRESSABLE (fntype) = TREE_ADDRESSABLE (TREE_TYPE (fndecl)); -- TREE_TYPE (fndecl) = fntype; -- d_keep (fntype); -- } -+ if (isVirtual() && vtblIndex != -1) -+ vindex = size_int (vtblIndex); -+ } -+ else if (isMain() && ftype->nextOf()->toBasetype()->ty == Tvoid) -+ { -+ // void main() implicitly converted to int main(). -+ fntype = build_function_type (integer_type_node, TYPE_ARG_TYPES (TREE_TYPE (fndecl))); -+ } - -- if (ident) -- { -- csym->Sident = mangle(); // save for making thunks -- csym->prettyIdent = toPrettyChars(); -- tree id = get_identifier (csym->Sident); -- id = targetm.mangle_decl_assembler_name (fndecl, id); -- SET_DECL_ASSEMBLER_NAME (fndecl, id); -- } -+ if (fntype != NULL_TREE) -+ { -+ TYPE_ATTRIBUTES (fntype) = TYPE_ATTRIBUTES (TREE_TYPE (fndecl)); -+ TYPE_LANG_SPECIFIC (fntype) = TYPE_LANG_SPECIFIC (TREE_TYPE (fndecl)); -+ TREE_ADDRESSABLE (fntype) = TREE_ADDRESSABLE (TREE_TYPE (fndecl)); -+ TREE_TYPE (fndecl) = fntype; -+ d_keep (fntype); -+ } - -- if (vindex) -- { -- DECL_VINDEX (fndecl) = vindex; -- DECL_VIRTUAL_P (fndecl) = 1; -- } -+ if (this->mangleOverride) -+ set_user_assembler_name (fndecl, this->mangleOverride); -+ else -+ { -+ tree mangle = get_identifier (csym->Sident); -+ mangle = targetm.mangle_decl_assembler_name (fndecl, mangle); -+ SET_DECL_ASSEMBLER_NAME (fndecl, mangle); -+ } - -- if (isMember2() || isFuncLiteralDeclaration()) -- { -- // See grokmethod in cp/decl.c -- DECL_DECLARED_INLINE_P (fndecl) = 1; -- DECL_NO_INLINE_WARNING_P (fndecl) = 1; -- } -- // Don't know what to do with this. -- else if (flag_inline_functions && canInline (0, 1, 0)) -- { -- DECL_DECLARED_INLINE_P (fndecl) = 1; -- DECL_NO_INLINE_WARNING_P (fndecl) = 1; -- } -+ if (vindex) -+ { -+ DECL_VINDEX (fndecl) = vindex; -+ DECL_VIRTUAL_P (fndecl) = 1; -+ } - -- if (naked) -- { -- DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) = 1; -- DECL_UNINLINABLE (fndecl) = 1; -- } -+ if (isMember2() || isFuncLiteralDeclaration()) -+ { -+ // See grokmethod in cp/decl.c -+ DECL_DECLARED_INLINE_P (fndecl) = 1; -+ DECL_NO_INLINE_WARNING_P (fndecl) = 1; -+ } -+ // Don't know what to do with this. -+ else if (flag_inline_functions && canInline (0, 1, 0)) -+ { -+ DECL_DECLARED_INLINE_P (fndecl) = 1; -+ DECL_NO_INLINE_WARNING_P (fndecl) = 1; -+ } - -- // These are always compiler generated. -- if (isArrayOp) -- { -- DECL_ARTIFICIAL (fndecl) = 1; -- D_DECL_ONE_ONLY (fndecl) = 1; -- } -- // So are ensure and require contracts. -- if (ident == Id::ensure || ident == Id::require) -- { -- DECL_ARTIFICIAL (fndecl) = 1; -- TREE_PUBLIC (fndecl) = 1; -- } -+ if (naked) -+ { -+ DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) = 1; -+ DECL_UNINLINABLE (fndecl) = 1; -+ } - -- if (isStatic()) -- TREE_STATIC (fndecl) = 1; -+ // These are always compiler generated. -+ if (isArrayOp) -+ { -+ DECL_ARTIFICIAL (fndecl) = 1; -+ D_DECL_ONE_ONLY (fndecl) = 1; -+ } -+ // So are ensure and require contracts. -+ if (ident == Id::ensure || ident == Id::require) -+ { -+ DECL_ARTIFICIAL (fndecl) = 1; -+ TREE_PUBLIC (fndecl) = 1; -+ } - -- // Assert contracts in functions cause implicit side effects that could -- // cause wrong codegen if pure/nothrow is thrown in the equation. -- if (!global.params.useAssert) -- { -- // Cannot mark as pure as in 'no side effects' if the function either -- // returns by ref, or has an internal state 'this'. -- // Note, pure D functions don't imply nothrow. -- if (isPure() == PUREstrong && vthis == NULL -- && ftype->isnothrow && ftype->retStyle() == RETstack) -- DECL_PURE_P (fndecl) = 1; -+ // Storage class attributes -+ if (storage_class & STCstatic) -+ TREE_STATIC (fndecl) = 1; - -- if (ftype->isnothrow) -- TREE_NOTHROW (fndecl) = 1; -- } -+ // Assert contracts in functions cause implicit side effects that could -+ // cause wrong codegen if pure/nothrow is thrown in the equation. -+ if (!global.params.useAssert) -+ { -+ // Cannot mark as pure as in 'no side effects' if the function either -+ // returns by ref, or has an internal state 'this'. -+ // Note, pure D functions don't imply nothrow. -+ if (isPure() == PUREstrong && vthis == NULL -+ && ftype->isnothrow && ftype->retStyle() == RETstack) -+ DECL_PURE_P (fndecl) = 1; -+ } - - #if TARGET_DLLIMPORT_DECL_ATTRIBUTES -- // Have to test for import first -- if (isImportedSymbol()) -- { -- insert_decl_attributes (fndecl, "dllimport"); -- DECL_DLLIMPORT_P (fndecl) = 1; -- } -- else if (isExport()) -- insert_decl_attributes (fndecl, "dllexport"); -+ // Have to test for import first -+ if (isImportedSymbol()) -+ { -+ insert_decl_attribute (fndecl, "dllimport"); -+ DECL_DLLIMPORT_P (fndecl) = 1; -+ } -+ else if (isExport()) -+ insert_decl_attribute (fndecl, "dllexport"); - #endif -- object_file->setDeclLoc (fndecl, this); -- object_file->setupSymbolStorage (this, fndecl); -- if (!ident) -- TREE_PUBLIC (fndecl) = 0; -+ set_decl_location (fndecl, this); -+ setup_symbol_storage (this, fndecl, false); - -- TREE_USED (fndecl) = 1; // %% Probably should be a little more intelligent about this -+ if (!ident) -+ TREE_PUBLIC (fndecl) = 0; - -- maybe_set_builtin_frontend (this); -- } -- else -- { -- csym->Stree = isym->Stree; -- } -+ TREE_USED (fndecl) = 1; // %% Probably should be a little more intelligent about this -+ -+ maybe_set_builtin_frontend (this); - } -+ - return csym; - } - -@@ -511,7 +475,7 @@ FuncDeclaration::toThunkSymbol (int offs - is a list of all thunks for a given function. */ - bool found = false; - -- for (size_t i = 0; i < csym->thunks.dim; i++) -+ for (size_t i = 0; i < csym->thunks.length(); i++) - { - thunk = csym->thunks[i]; - if (thunk->offset == offset) -@@ -525,7 +489,7 @@ FuncDeclaration::toThunkSymbol (int offs - { - thunk = new Thunk(); - thunk->offset = offset; -- csym->thunks.push (thunk); -+ csym->thunks.safe_push (thunk); - } - - if (!thunk->symbol) -@@ -540,14 +504,14 @@ FuncDeclaration::toThunkSymbol (int offs - tree thunk_decl = build_decl (DECL_SOURCE_LOCATION (target_func_decl), - FUNCTION_DECL, NULL_TREE, TREE_TYPE (target_func_decl)); - DECL_LANG_SPECIFIC (thunk_decl) = DECL_LANG_SPECIFIC (target_func_decl); -- DECL_CONTEXT (thunk_decl) = d_decl_context (this); // from c++... - TREE_READONLY (thunk_decl) = TREE_READONLY (target_func_decl); - TREE_THIS_VOLATILE (thunk_decl) = TREE_THIS_VOLATILE (target_func_decl); - TREE_NOTHROW (thunk_decl) = TREE_NOTHROW (target_func_decl); - -- /* Thunks inherit the public/private access of the function they are targetting. */ -+ DECL_CONTEXT (thunk_decl) = d_decl_context (this); -+ -+ /* Thunks inherit the public access of the function they are targetting. */ - TREE_PUBLIC (thunk_decl) = TREE_PUBLIC (target_func_decl); -- TREE_PRIVATE (thunk_decl) = TREE_PRIVATE (target_func_decl); - DECL_EXTERNAL (thunk_decl) = 0; - - /* Thunks are always addressable. */ -@@ -569,10 +533,11 @@ FuncDeclaration::toThunkSymbol (int offs - d_keep (thunk_decl); - sthunk->Stree = thunk_decl; - -- object_file->doThunk (thunk_decl, target_func_decl, offset); -+ use_thunk (thunk_decl, target_func_decl, offset); - - thunk->symbol = sthunk; - } -+ - return thunk->symbol; - } - -@@ -587,16 +552,19 @@ ClassDeclaration::toSymbol (void) - csym = toSymbolX ("__Class", 0, 0, "Z"); - - tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL, -- get_identifier (csym->Sident), d_unknown_type_node); -+ get_identifier (csym->prettyIdent), d_unknown_type_node); -+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (csym->Sident)); - csym->Stree = decl; - d_keep (decl); - -- object_file->setupStaticStorage (this, decl); -- object_file->setDeclLoc (decl, this); -+ setup_symbol_storage (this, decl, true); -+ set_decl_location (decl, this); - -+ DECL_ARTIFICIAL (decl) = 1; - // ClassInfo cannot be const data, because we use the monitor on it. - TREE_CONSTANT (decl) = 0; - } -+ - return csym; - } - -@@ -610,19 +578,22 @@ InterfaceDeclaration::toSymbol (void) - csym = toSymbolX ("__Interface", 0, 0, "Z"); - - tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL, -- get_identifier (csym->Sident), d_unknown_type_node); -+ get_identifier (csym->prettyIdent), d_unknown_type_node); -+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (csym->Sident)); - csym->Stree = decl; - d_keep (decl); - -- object_file->setupStaticStorage (this, decl); -- object_file->setDeclLoc (decl, this); -+ setup_symbol_storage (this, decl, true); -+ set_decl_location (decl, this); - -+ DECL_ARTIFICIAL (decl) = 1; - TREE_CONSTANT (decl) = 1; - } -+ - return csym; - } - --// Create the "ModuleInfo" symbol for given module. -+// Create the "ModuleInfo" symbol for a given module. - - Symbol * - Module::toSymbol (void) -@@ -632,20 +603,85 @@ Module::toSymbol (void) - csym = toSymbolX ("__ModuleInfo", 0, 0, "Z"); - - tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL, -- get_identifier (csym->Sident), d_unknown_type_node); -+ get_identifier (csym->prettyIdent), d_unknown_type_node); -+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (csym->Sident)); - csym->Stree = decl; - d_keep (decl); - -- object_file->setupStaticStorage (this, decl); -- object_file->setDeclLoc (decl, this); -+ setup_symbol_storage (this, decl, true); -+ set_decl_location (decl, this); - -+ DECL_ARTIFICIAL (decl) = 1; - // Not readonly, moduleinit depends on this. - TREE_CONSTANT (decl) = 0; - TREE_READONLY (decl) = 0; - } -+ - return csym; - } - -+Symbol * -+StructLiteralExp::toSymbol (void) -+{ -+ if (!sym) -+ { -+ sym = new Symbol(); -+ -+ // Build reference symbol. -+ tree ctype = type->toCtype(); -+ tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, ctype); -+ get_unique_name (decl, "*"); -+ set_decl_location (decl, loc); -+ -+ TREE_PUBLIC (decl) = 0; -+ TREE_STATIC (decl) = 1; -+ TREE_READONLY (decl) = 1; -+ TREE_USED (decl) = 1; -+ DECL_ARTIFICIAL (decl) = 1; -+ -+ sym->Stree = decl; -+ this->sinit = sym; -+ -+ toDt (&sym->Sdt); -+ d_finish_symbol (sym); -+ } -+ -+ return sym; -+} -+ -+Symbol * -+ClassReferenceExp::toSymbol (void) -+{ -+ if (!value->sym) -+ { -+ value->sym = new Symbol(); -+ -+ // Build reference symbol. -+ tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, d_unknown_type_node); -+ char *ident; -+ -+ ASM_FORMAT_PRIVATE_NAME (ident, "*", DECL_UID (decl)); -+ DECL_NAME (decl) = get_identifier (ident); -+ set_decl_location (decl, loc); -+ -+ TREE_PUBLIC (decl) = 0; -+ TREE_STATIC (decl) = 1; -+ TREE_READONLY (decl) = 1; -+ TREE_USED (decl) = 1; -+ DECL_ARTIFICIAL (decl) = 1; -+ -+ value->sym->Stree = decl; -+ value->sym->Sident = ident; -+ -+ toInstanceDt (&value->sym->Sdt); -+ d_finish_symbol (value->sym); -+ -+ value->sinit = value->sym; -+ } -+ -+ return value->sym; -+} -+ - // Create the "vtbl" symbol for ClassDeclaration. - // This is accessible via the ClassData, but since it is frequently - // needed directly (like for rtti comparisons), make it directly accessible. -@@ -655,30 +691,26 @@ ClassDeclaration::toVtblSymbol (void) - { - if (!vtblsym) - { -- tree decl; -- - vtblsym = toSymbolX ("__vtbl", 0, 0, "Z"); - - /* The DECL_INITIAL value will have a different type object from the - VAR_DECL. The back end seems to accept this. */ -- TypeSArray *vtbl_type = new TypeSArray (Type::tvoidptr, -- new IntegerExp (loc, vtbl.dim, Type::tindex)); -- -- decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier (vtblsym->Sident), vtbl_type->toCtype()); -+ Type *vtbltype = TypeSArray::makeType (loc, Type::tvoidptr, vtbl.dim); -+ tree decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, -+ get_identifier (vtblsym->prettyIdent), vtbltype->toCtype()); -+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (vtblsym->Sident)); - vtblsym->Stree = decl; - d_keep (decl); - -- object_file->setupStaticStorage (this, decl); -- object_file->setDeclLoc (decl, this); -+ setup_symbol_storage (this, decl, true); -+ set_decl_location (decl, this); - - TREE_READONLY (decl) = 1; - TREE_CONSTANT (decl) = 1; - TREE_ADDRESSABLE (decl) = 1; -- // from cp/class.c -- DECL_CONTEXT (decl) = d_decl_context (this); - DECL_ARTIFICIAL (decl) = 1; -- DECL_VIRTUAL_P (decl) = 1; -+ -+ DECL_CONTEXT (decl) = d_decl_context (this); - DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN; - } - return vtblsym; -@@ -700,31 +732,37 @@ AggregateDeclaration::toInitializer (voi - { - if (!sinit) - { -+ StructDeclaration *sd = isStructDeclaration(); - sinit = toSymbolX ("__init", 0, 0, "Z"); - -- StructDeclaration *sd = isStructDeclaration(); - if (sd) - sinit->Salignment = sd->alignment; - } - -- if (!sinit->Stree && object_file != NULL) -+ if (!sinit->Stree && current_module_decl) - { -- tree struct_type = type->toCtype(); -- if (POINTER_TYPE_P (struct_type)) -- struct_type = TREE_TYPE (struct_type); // for TypeClass, want the RECORD_TYPE, not the REFERENCE_TYPE -- tree t = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier (sinit->Sident), struct_type); -- sinit->Stree = t; -- d_keep (t); -- -- object_file->setupStaticStorage (this, t); -- object_file->setDeclLoc (t, this); -- -- TREE_ADDRESSABLE (t) = 1; -- TREE_READONLY (t) = 1; -- TREE_CONSTANT (t) = 1; -- DECL_CONTEXT (t) = 0; // These are always global -+ tree stype; -+ if (isStructDeclaration()) -+ stype = type->toCtype(); -+ else -+ stype = TREE_TYPE (type->toCtype()); -+ -+ sinit->Stree = build_decl (UNKNOWN_LOCATION, VAR_DECL, -+ get_identifier (sinit->prettyIdent), stype); -+ SET_DECL_ASSEMBLER_NAME (sinit->Stree, get_identifier (sinit->Sident)); -+ d_keep (sinit->Stree); -+ -+ setup_symbol_storage (this, sinit->Stree, true); -+ set_decl_location (sinit->Stree, this); -+ -+ TREE_ADDRESSABLE (sinit->Stree) = 1; -+ TREE_READONLY (sinit->Stree) = 1; -+ TREE_CONSTANT (sinit->Stree) = 1; -+ DECL_ARTIFICIAL (sinit->Stree) = 1; -+ // These initialisers are always global. -+ DECL_CONTEXT (sinit->Stree) = NULL_TREE; - } -+ - return sinit; - } - -@@ -733,28 +771,25 @@ AggregateDeclaration::toInitializer (voi - Symbol * - TypedefDeclaration::toInitializer (void) - { -- Symbol *s; -- - if (!sinit) -+ sinit = toSymbolX ("__init", 0, 0, "Z"); -+ -+ if (!sinit->Stree && current_module_decl) - { -- s = toSymbolX ("__init", 0, 0, "Z"); -- sinit = s; -- sinit->Sdt = ((TypeTypedef *) type)->sym->init->toDt(); -- } -- -- if (!sinit->Stree && object_file != NULL) -- { -- tree t = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier (sinit->Sident), type->toCtype()); -- sinit->Stree = t; -- d_keep (t); -- -- object_file->setupStaticStorage (this, t); -- object_file->setDeclLoc (t, this); -- TREE_CONSTANT (t) = 1; -- TREE_READONLY (t) = 1; -- DECL_CONTEXT (t) = 0; -+ sinit->Stree = build_decl (UNKNOWN_LOCATION, VAR_DECL, -+ get_identifier (sinit->prettyIdent), type->toCtype()); -+ SET_DECL_ASSEMBLER_NAME (sinit->Stree, get_identifier (sinit->Sident)); -+ d_keep (sinit->Stree); -+ -+ setup_symbol_storage (this, sinit->Stree, true); -+ set_decl_location (sinit->Stree, this); -+ -+ TREE_CONSTANT (sinit->Stree) = 1; -+ TREE_READONLY (sinit->Stree) = 1; -+ DECL_ARTIFICIAL (sinit->Stree) = 1; -+ DECL_CONTEXT (sinit->Stree) = NULL_TREE; - } -+ - return sinit; - } - -@@ -763,92 +798,43 @@ TypedefDeclaration::toInitializer (void) - Symbol * - EnumDeclaration::toInitializer (void) - { -- Symbol *s; -- - if (!sinit) - { - Identifier *ident_save = ident; - if (!ident) - ident = Lexer::uniqueId("__enum"); -- s = toSymbolX ("__init", 0, 0, "Z"); -+ sinit = toSymbolX ("__init", 0, 0, "Z"); - ident = ident_save; -- sinit = s; - } - -- if (!sinit->Stree && object_file != NULL) -+ if (!sinit->Stree && current_module_decl) - { -- tree t = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier (sinit->Sident), type->toCtype()); -- sinit->Stree = t; -- d_keep (t); -- -- object_file->setupStaticStorage (this, t); -- object_file->setDeclLoc (t, this); -- TREE_CONSTANT (t) = 1; -- TREE_READONLY (t) = 1; -- DECL_CONTEXT (t) = 0; -+ sinit->Stree = build_decl (UNKNOWN_LOCATION, VAR_DECL, -+ get_identifier (sinit->prettyIdent), type->toCtype()); -+ SET_DECL_ASSEMBLER_NAME (sinit->Stree, get_identifier (sinit->Sident)); -+ d_keep (sinit->Stree); -+ -+ setup_symbol_storage (this, sinit->Stree, true); -+ set_decl_location (sinit->Stree, this); -+ -+ TREE_CONSTANT (sinit->Stree) = 1; -+ TREE_READONLY (sinit->Stree) = 1; -+ DECL_ARTIFICIAL (sinit->Stree) = 1; -+ DECL_CONTEXT (sinit->Stree) = NULL_TREE; - } -+ - return sinit; - } - - --/* Create debug information for a ClassDeclaration's inheritance tree. -- Interfaces are not included. */ --static tree --binfo_for (tree tgt_binfo, ClassDeclaration *cls) --{ -- tree binfo = make_tree_binfo (1); -- // Want RECORD_TYPE, not REFERENCE_TYPE -- TREE_TYPE (binfo) = TREE_TYPE (cls->type->toCtype()); -- BINFO_INHERITANCE_CHAIN (binfo) = tgt_binfo; -- BINFO_OFFSET (binfo) = integer_zero_node; -- -- if (cls->baseClass) -- BINFO_BASE_APPEND (binfo, binfo_for (binfo, cls->baseClass)); -- -- return binfo; --} -- --/* Create debug information for an InterfaceDeclaration's inheritance -- tree. In order to access all inherited methods in the debugger, -- the entire tree must be described. -- -- This function makes assumptions about inherface layout. */ --static tree --intfc_binfo_for (tree tgt_binfo, ClassDeclaration *iface, unsigned& inout_offset) --{ -- tree binfo = make_tree_binfo (iface->baseclasses->dim); -- -- // Want RECORD_TYPE, not REFERENCE_TYPE -- TREE_TYPE (binfo) = TREE_TYPE (iface->type->toCtype()); -- BINFO_INHERITANCE_CHAIN (binfo) = tgt_binfo; -- BINFO_OFFSET (binfo) = size_int (inout_offset * Target::ptrsize); -- -- for (size_t i = 0; i < iface->baseclasses->dim; i++, inout_offset++) -- { -- BaseClass *bc = iface->baseclasses->tdata()[i]; -- BINFO_BASE_APPEND (binfo, intfc_binfo_for (binfo, bc->base, inout_offset)); -- } -- -- return binfo; --} -+// - - void - ClassDeclaration::toDebug (void) - { -- /* Used to create BINFO even if debugging was off. This was needed to keep -- references to inherited types. */ - tree rec_type = TREE_TYPE (type->toCtype()); -- -- if (!isInterfaceDeclaration()) -- TYPE_BINFO (rec_type) = binfo_for (NULL_TREE, this); -- else -- { -- unsigned offset = 0; -- TYPE_BINFO (rec_type) = intfc_binfo_for (NULL_TREE, this, offset); -- } -- -- object_file->declareType (rec_type, this); -+ build_type_decl (rec_type, this); -+ rest_of_type_compilation (rec_type, 1); - } - - void -@@ -860,9 +846,12 @@ EnumDeclaration::toDebug (void) - - tree ctype = type->toCtype(); - -+ if (TREE_CODE (ctype) == ENUMERAL_TYPE) -+ build_type_decl (ctype, this); -+ - // The ctype is not necessarily enum, which doesn't sit well with - // rest_of_type_compilation. Can call this on structs though. -- if (AGGREGATE_TYPE_P (ctype) || TREE_CODE (ctype) == ENUMERAL_TYPE) -+ if (RECORD_OR_UNION_TYPE_P (ctype) || TREE_CODE (ctype) == ENUMERAL_TYPE) - rest_of_type_compilation (ctype, 1); - } - -@@ -875,7 +864,7 @@ void - StructDeclaration::toDebug (void) - { - tree ctype = type->toCtype(); -- object_file->declareType (ctype, this); -+ build_type_decl (ctype, this); - rest_of_type_compilation (ctype, 1); - } - ---- a/src/gcc/d/d-dmd-gcc.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-dmd-gcc.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* d-dmd-gcc.h -- D frontend for GCC. -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free -@@ -30,10 +30,6 @@ - /* used in module.c */ - extern void d_gcc_magic_module (Module *); - --/* used in template.c */ --extern bool d_gcc_force_templates (void); --extern Module *d_gcc_get_output_module (void); -- - /* used in interpret.c */ - extern Expression *d_gcc_eval_builtin (Loc, FuncDeclaration *, Expressions *); - ---- a/src/gcc/d/d-elem.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-elem.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-elem.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -17,17 +17,18 @@ - - #include "d-system.h" - --#include "id.h" --#include "module.h" - #include "d-lang.h" - #include "d-codegen.h" - -+#include "id.h" -+#include "module.h" -+#include "ctfe.h" - - elem * - Expression::toElem (IRState *) - { - error ("abstract Expression::toElem called"); -- return error_mark (type); -+ return error_mark_node; - } - - elem * -@@ -45,47 +46,64 @@ IdentityExp::toElem (IRState *irs) - Type *tb1 = e1->type->toBasetype(); - Type *tb2 = e2->type->toBasetype(); - -- tree_code code = op == TOKidentity ? EQ_EXPR : NE_EXPR; -+ tree_code code = (op == TOKidentity) ? EQ_EXPR : NE_EXPR; - -- if (tb1->ty == Tstruct || tb1->isfloating()) -+ if ((tb1->ty == Tsarray || tb1->ty == Tarray) -+ && (tb2->ty == Tsarray || tb2->ty == Tarray)) - { -- tree size; -- if (tb1->isfloating()) -- { -- // Assume all padding is at the end of the type. -- size = build_integer_cst (TYPE_PRECISION (e1->type->toCtype()) / BITS_PER_UNIT); -- } -- else -- size = build_integer_cst (e1->type->size()); -+ // Convert arrays to D array types. -+ return build2 (code, type->toCtype(), -+ d_array_convert (e1), d_array_convert (e2)); -+ } -+ else if (tb1->isfloating()) -+ { -+ tree t1 = e1->toElem (irs); -+ tree t2 = e2->toElem (irs); -+ // Assume all padding is at the end of the type. -+ tree size = build_integer_cst (TYPE_PRECISION (e1->type->toCtype()) / BITS_PER_UNIT); - -- // Do bit compare. -- tree t_memcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -- build_address (e1->toElem (irs)), -- build_address (e2->toElem (irs)), -- size); -+ // Do bit compare of floats. -+ tree tmemcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ build_address (t1), build_address (t2), size); - -- return build_boolop (code, t_memcmp, integer_zero_node); -+ return build_boolop (code, tmemcmp, integer_zero_node); - } -- else if ((tb1->ty == Tsarray || tb1->ty == Tarray) -- && (tb2->ty == Tsarray || tb2->ty == Tarray)) -+ else if (tb1->ty == Tstruct) - { -- return build2 (code, type->toCtype(), -- irs->toDArray (e1), irs->toDArray (e2)); -- } -- else -- { -- // For operands of other types, identity is defined as being the same as equality. - tree t1 = e1->toElem (irs); - tree t2 = e2->toElem (irs); - -- if (type->iscomplex()) -+ if (TYPE_MODE (TREE_TYPE (t1)) != BLKmode) - { -+ // Bitwise comparison of small structs not returned in memory may -+ // not work due to data holes loosing its zero padding upon return. -+ // Instead do field-by-field comparison of the two structs. -+ StructDeclaration *sd = ((TypeStruct *) tb1)->sym; -+ gcc_assert (d_types_same (tb1, tb2)); -+ -+ // Make temporaries to prevent multiple evaluations. - t1 = maybe_make_temp (t1); - t2 = maybe_make_temp (t2); -+ -+ return build_struct_memcmp (code, sd, t1, t2); - } -+ else -+ { -+ // Do bit compare of structs. -+ tree size = build_integer_cst (e1->type->size()); -+ -+ tree tmemcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ build_address (t1), build_address (t2), size); - -- tree t_cmp = build_boolop (code, t1, t2); -- return d_convert (type->toCtype(), t_cmp); -+ return build_boolop (code, tmemcmp, integer_zero_node); -+ } -+ } -+ else -+ { -+ // For operands of other types, identity is defined as being the same as equality. -+ tree tcmp = build_boolop (code, e1->toElem (irs), e2->toElem (irs)); -+ -+ return d_convert (type->toCtype(), tcmp); - } - } - -@@ -95,35 +113,110 @@ EqualExp::toElem (IRState *irs) - Type *tb1 = e1->type->toBasetype(); - Type *tb2 = e2->type->toBasetype(); - -- tree_code code = op == TOKequal ? EQ_EXPR : NE_EXPR; -+ tree_code code = (op == TOKequal) ? EQ_EXPR : NE_EXPR; - - if (tb1->ty == Tstruct) - { -- // Do bit compare of struct's -- tree t_memcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -- build_address (e1->toElem (irs)), -- build_address (e2->toElem (irs)), -- build_integer_cst (e1->type->size())); -+ // Do bit compare of structs -+ tree tmemcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ build_address (e1->toElem (irs)), -+ build_address (e2->toElem (irs)), -+ build_integer_cst (e1->type->size())); - -- return build2 (code, type->toCtype(), t_memcmp, integer_zero_node); -+ return build2 (code, type->toCtype(), tmemcmp, integer_zero_node); - } - else if ((tb1->ty == Tsarray || tb1->ty == Tarray) - && (tb2->ty == Tsarray || tb2->ty == Tarray)) - { -- // _adEq2 compares each element. -- Type *telem = tb1->nextOf()->toBasetype(); -- tree args[3]; -- tree result; -+ Type *t1elem = tb1->nextOf()->toBasetype(); -+ Type *t2elem = tb1->nextOf()->toBasetype(); - -- args[0] = irs->toDArray (e1); -- args[1] = irs->toDArray (e2); -- args[2] = irs->typeinfoReference (telem->arrayOf()); -- result = d_convert (type->toCtype(), build_libcall (LIBCALL_ADEQ2, 3, args)); -+ if ((t1elem->isintegral() || t1elem->ty == Tvoid) && t1elem->ty == t2elem->ty) -+ { -+ // Optimise comparisons of arrays of basic types. -+ // For arrays of integers/characters, and void[], replace _adEq2 call with: -+ // e1 == e2 => e1.length == e2.length && memcmp (e1.ptr, e2.ptr, size) == 0; -+ // e1 != e2 => e1.length != e2.length || memcmp (e1.ptr, e2.ptr, size) != 0; -+ // 'size' is e1.length * sizeof(e1[0]) for dynamic arrays, or sizeof(e1) for static arrays. -+ tree t1 = e1->toElem (irs); -+ tree t2 = e2->toElem (irs); -+ // Length, for comparison. -+ tree t1len, t2len; -+ // Pointer to data and data size, to pass to memcmp. -+ tree t1ptr, t2ptr; -+ tree t1size, t2size; -+ -+ // Make temporaries to prevent multiple evaluations. -+ tree t1saved = maybe_make_temp (t1); -+ tree t2saved = maybe_make_temp (t2); -+ -+ if (tb1->ty == Tarray) -+ { -+ t1len = d_array_length (t1saved); -+ t1ptr = d_array_ptr (t1saved); -+ t1size = build2 (MULT_EXPR, size_type_node, t1len, size_int (t1elem->size())); -+ } -+ else -+ { -+ t1len = size_int (((TypeSArray *) tb1)->dim->toInteger()); -+ t1ptr = build_address (t1saved); -+ t1size = size_int (tb1->size()); -+ } - -- if (op == TOKnotequal) -- return build1 (TRUTH_NOT_EXPR, type->toCtype(), result); -+ if (tb2->ty == Tarray) -+ { -+ t2len = d_array_length (t2saved); -+ t2ptr = d_array_ptr (t2saved); -+ t2size = build2 (MULT_EXPR, size_type_node, t2len, size_int (t2elem->size())); -+ } -+ else -+ { -+ t2len = size_int (((TypeSArray *) tb2)->dim->toInteger()); -+ t2ptr = build_address (t2saved); -+ t2size = size_int (tb2->size()); -+ } - -- return result; -+ tree tmemcmp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCMP), 3, -+ t1ptr, t2ptr, (tb2->ty == Tsarray) ? t2size : t1size); -+ -+ tree result = build2 (code, type->toCtype(), tmemcmp, integer_zero_node); -+ -+ if (tb1->ty == Tsarray && tb2->ty == Tsarray) -+ gcc_assert (tb1->size() == tb2->size()); -+ else -+ { -+ tree_code tcode = (op == TOKequal) ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR; -+ tree tlencmp = build2 (code, size_type_node, t1len, t2len); -+ -+ result = build_boolop (tcode, tlencmp, result); -+ } -+ -+ // Ensure left-to-right order of evaluation. -+ if (t2 != t2saved) -+ result = compound_expr (t2saved, result); -+ -+ if (t1 != t1saved) -+ result = compound_expr (t1saved, result); -+ -+ return result; -+ } -+ else -+ { -+ // _adEq2 compares each element. -+ tree args[3]; -+ tree result; -+ -+ args[0] = d_array_convert (e1); -+ args[1] = d_array_convert (e2); -+ args[2] = build_typeinfo (t1elem->arrayOf()); -+ -+ result = d_convert (type->toCtype(), build_libcall (LIBCALL_ADEQ2, 3, args)); -+ -+ if (op == TOKnotequal) -+ return build1 (TRUTH_NOT_EXPR, type->toCtype(), result); -+ -+ return result; -+ } - } - else if (tb1->ty == Taarray && tb2->ty == Taarray) - { -@@ -131,7 +224,7 @@ EqualExp::toElem (IRState *irs) - tree args[3]; - tree result; - -- args[0] = irs->typeinfoReference (taa1); -+ args[0] = build_typeinfo (taa1); - args[1] = e1->toElem (irs); - args[2] = e2->toElem (irs); - result = d_convert (type->toCtype(), build_libcall (LIBCALL_AAEQUAL, 3, args)); -@@ -143,33 +236,25 @@ EqualExp::toElem (IRState *irs) - } - else - { -- tree t1 = e1->toElem (irs); -- tree t2 = e2->toElem (irs); -+ tree tcmp = build_boolop (code, e1->toElem (irs), e2->toElem (irs)); - -- if (type->iscomplex()) -- { -- t1 = maybe_make_temp (t1); -- t2 = maybe_make_temp (t2); -- } -- -- tree t_cmp = build_boolop (code, t1, t2); -- return d_convert (type->toCtype(), t_cmp); -+ return d_convert (type->toCtype(), tcmp); - } - } - - elem * - InExp::toElem (IRState *irs) - { -- Type *e2_base_type = e2->type->toBasetype(); -+ Type *tb2 = e2->type->toBasetype(); - AddrOfExpr aoe; -- gcc_assert (e2_base_type->ty == Taarray); -+ gcc_assert (tb2->ty == Taarray); - -- Type *key_type = ((TypeAArray *) e2_base_type)->index->toBasetype(); -+ Type *tkey = ((TypeAArray *) tb2)->index->toBasetype(); - tree args[3]; - - args[0] = e2->toElem (irs); -- args[1] = irs->typeinfoReference (key_type); -- args[2] = aoe.set (convert_expr (e1->toElem (irs), e1->type, key_type)); -+ args[1] = build_typeinfo (tkey); -+ args[2] = aoe.set (convert_expr (e1->toElem (irs), e1->type, tkey)); - - return convert (type->toCtype(), - aoe.finish (build_libcall (LIBCALL_AAINX, 3, args))); -@@ -250,9 +335,9 @@ CmpExp::toElem (IRState *irs) - Type *telem = tb1->nextOf()->toBasetype(); - tree args[3]; - -- args[0] = irs->toDArray (e1); -- args[1] = irs->toDArray (e2); -- args[2] = irs->typeinfoReference (telem->arrayOf()); -+ args[0] = d_array_convert (e1); -+ args[1] = d_array_convert (e2); -+ args[2] = build_typeinfo (telem->arrayOf()); - result = build_libcall (LIBCALL_ADCMP2, 3, args); - - // %% For float element types, warn that NaN is not taken into account? -@@ -294,14 +379,7 @@ AndAndExp::toElem (IRState *irs) - tree t1 = convert_for_condition (e1->toElem (irs), e1->type); - tree t2 = convert_for_condition (e2->toElem (irs), e2->type); - -- if (type->iscomplex()) -- { -- t1 = maybe_make_temp (t1); -- t2 = maybe_make_temp (t2); -- } -- -- tree t = build_boolop (TRUTH_ANDIF_EXPR, t1, t2); -- return d_convert (type->toCtype(), t); -+ return d_convert (type->toCtype(), build_boolop (TRUTH_ANDIF_EXPR, t1, t2)); - } - else - { -@@ -319,14 +397,7 @@ OrOrExp::toElem (IRState *irs) - tree t1 = convert_for_condition (e1->toElem (irs), e1->type); - tree t2 = convert_for_condition (e2->toElem (irs), e2->type); - -- if (type->iscomplex()) -- { -- t1 = maybe_make_temp (t1); -- t2 = maybe_make_temp (t2); -- } -- -- tree t = build_boolop (TRUTH_ORIF_EXPR, t1, t2); -- return d_convert (type->toCtype(), t); -+ return d_convert (type->toCtype(), build_boolop (TRUTH_ORIF_EXPR, t1, t2)); - } - else - { -@@ -341,90 +412,90 @@ elem * - XorExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (BIT_XOR_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (BIT_XOR_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - OrExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (BIT_IOR_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (BIT_IOR_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - AndExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (BIT_AND_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (BIT_AND_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - UshrExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (UNSIGNED_RSHIFT_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (UNSIGNED_RSHIFT_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - ShrExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (RSHIFT_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (RSHIFT_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - ShlExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (LSHIFT_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (LSHIFT_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - ModExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (e1->type->isfloating() ? FLOAT_MOD_EXPR : TRUNC_MOD_EXPR, -- type->toCtype(), e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (e1->type->isfloating() ? FLOAT_MOD_EXPR : TRUNC_MOD_EXPR, -+ type->toCtype(), e1->toElem (irs), e2->toElem (irs)); - } - - elem * - DivExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (e1->type->isintegral() ? TRUNC_DIV_EXPR : RDIV_EXPR, -- type->toCtype(), e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (e1->type->isintegral() ? TRUNC_DIV_EXPR : RDIV_EXPR, -+ type->toCtype(), e1->toElem (irs), e2->toElem (irs)); - } - - elem * - MulExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildOp (MULT_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (MULT_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * -@@ -455,7 +526,7 @@ PowExp::toElem (IRState *irs) - error ("Array operation %s not implemented", toChars()); - else - error ("%s ^^ %s is not supported", e1->type->toChars(), e2->type->toChars()); -- return error_mark (type); -+ return error_mark_node; - } - - e1_t = d_convert (powtype, e1->toElem (irs)); -@@ -481,31 +552,26 @@ CatExp::toElem (IRState *irs) - - // Flatten multiple concatenations - unsigned n_operands = 2; -- unsigned n_args; -- tree *args; -- Array elem_vars; -- tree result; -- -- { -- Expression *e = e1; -- while (e->op == TOKcat) -- { -- e = ((CatExp *) e)->e1; -- n_operands += 1; -- } -- } -+ { -+ Expression *e = e1; -+ while (e->op == TOKcat) -+ { -+ e = ((CatExp *) e)->e1; -+ n_operands += 1; -+ } -+ } - -- n_args = (1 + (n_operands > 2 ? 1 : 0) + -- n_operands * (n_operands > 2 && flag_split_darrays ? 2 : 1)); -+ unsigned n_args = (1 + (n_operands > 2 ? 1 : 0) + n_operands); - -- args = new tree[n_args]; -- args[0] = irs->typeinfoReference (type); -+ tree *args = new tree[n_args]; -+ args[0] = build_typeinfo (type); - - if (n_operands > 2) - args[1] = build_integer_cst (n_operands, Type::tuns32->toCtype()); - - unsigned ai = n_args - 1; - CatExp *ce = this; -+ vec<tree, va_gc> *elem_vars = NULL; - - while (ce) - { -@@ -521,32 +587,26 @@ CatExp::toElem (IRState *irs) - size_int (1), build_address (expr)); - - if (elem_var) -- elem_vars.push (elem_var); -+ vec_safe_push (elem_vars, elem_var); - } - else -- array_exp = irs->toDArray (oe); -+ array_exp = d_array_convert (oe); - -- if (n_operands > 2 && flag_split_darrays) -- { -- array_exp = maybe_make_temp (array_exp); -- args[ai--] = d_array_ptr (array_exp); // note: filling array -- args[ai--] = d_array_length (array_exp); // backwards, so ptr 1st -- } -- else -- args[ai--] = array_exp; -+ args[ai--] = array_exp; - -- if (ce) -+ if (ce != NULL) - { - if (ce->e1->op != TOKcat) - { -+ // Finish with atomtic lhs - oe = ce->e1; - ce = NULL; -- // finish with atomtic lhs - } - else - { -+ // Continue with lhs CatExp - ce = (CatExp *) ce->e1; -- break; // continue with lhs CatExp -+ break; - } - } - else -@@ -555,14 +615,11 @@ CatExp::toElem (IRState *irs) - } - all_done: - -- result = build_libcall (n_operands > 2 ? LIBCALL_ARRAYCATNT : LIBCALL_ARRAYCATT, -- n_args, args, type->toCtype()); -+ tree result = build_libcall (n_operands > 2 ? LIBCALL_ARRAYCATNT : LIBCALL_ARRAYCATT, -+ n_args, args, type->toCtype()); - -- for (size_t i = 0; i < elem_vars.dim; ++i) -- { -- tree elem_var = (tree) elem_vars.data[i]; -- result = bind_expr (elem_var, result); -- } -+ for (size_t i = 0; i < vec_safe_length (elem_vars); ++i) -+ result = bind_expr ((*elem_vars)[i], result); - - return result; - } -@@ -571,7 +628,7 @@ elem * - MinExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - - // %% faster: check if result is complex - if ((e1->type->isreal() && e2->type->isimaginary()) -@@ -590,15 +647,15 @@ MinExp::toElem (IRState *irs) - } - - // The front end has already taken care of pointer-int and pointer-pointer -- return irs->buildOp (MINUS_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (MINUS_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); - } - - elem * - AddExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - - // %% faster: check if result is complex - if ((e1->type->isreal() && e2->type->isimaginary()) -@@ -615,116 +672,168 @@ AddExp::toElem (IRState *irs) - } - - // The front end has already taken care of (pointer + integer) -- return irs->buildOp (PLUS_EXPR, type->toCtype(), -- e1->toElem (irs), e2->toElem (irs)); -+ return build_binary_op (PLUS_EXPR, type->toCtype(), -+ e1->toElem (irs), e2->toElem (irs)); -+} -+ -+elem * -+BinExp::toElemBin (IRState *irs, int op) -+{ -+ tree_code code = (tree_code) op; -+ -+ // Skip casts for lhs assignment. -+ Expression *e1b = e1; -+ while (e1b->op == TOKcast) -+ { -+ CastExp *ce = (CastExp *) e1b; -+ gcc_assert (d_types_compatible (ce->type, ce->to)); -+ e1b = ce->e1; -+ } -+ -+ // Prevent multiple evaluations of LHS, but watch out! -+ // The LHS expression could be an assignment, to which -+ // it's operation gets lost during gimplification. -+ tree lexpr = NULL_TREE; -+ tree lhs; -+ -+ if (e1b->op == TOKcomma) -+ { -+ CommaExp *ce = (CommaExp *) e1b; -+ lexpr = ce->e1->toElem (irs); -+ lhs = ce->e2->toElem (irs); -+ } -+ else -+ lhs = e1b->toElem (irs); -+ -+ // Build assignment expression. Stabilize lhs for assignment. -+ lhs = stabilize_reference (lhs); -+ -+ tree rhs = build_binary_op (code, e1->type->toCtype(), -+ convert_expr (lhs, e1b->type, e1->type), e2->toElem (irs)); -+ -+ tree expr = modify_expr (lhs, convert_expr (rhs, e1->type, e1b->type)); -+ -+ if (lexpr) -+ expr = compound_expr (lexpr, expr); -+ -+ return expr; - } - - elem * - XorAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (BIT_XOR_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, BIT_XOR_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - OrAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (BIT_IOR_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, BIT_IOR_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - AndAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (BIT_AND_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, BIT_AND_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - UshrAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (UNSIGNED_RSHIFT_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, UNSIGNED_RSHIFT_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - ShrAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (RSHIFT_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, RSHIFT_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - ShlAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (LSHIFT_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, LSHIFT_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - ModAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (e1->type->isfloating() ? -- FLOAT_MOD_EXPR : TRUNC_MOD_EXPR, -- type, e1, e2); -+ tree exp = toElemBin (irs, e1->type->isfloating() ? -+ FLOAT_MOD_EXPR : TRUNC_MOD_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - DivAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (e1->type->isintegral() ? -- TRUNC_DIV_EXPR : RDIV_EXPR, -- type, e1, e2); -+ tree exp = toElemBin (irs, e1->type->isintegral() ? -+ TRUNC_DIV_EXPR : RDIV_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - MulAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (MULT_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, MULT_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - PowAssignExp::toElem (IRState *) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - - gcc_unreachable(); - } - - // Determine if type is an array of structs that need a postblit. -+ - static StructDeclaration * - needsPostblit (Type *t) - { -- t = t->toBasetype(); -- while (t->ty == Tsarray) -- t = t->nextOf()->toBasetype(); -+ t = t->baseElemOf(); -+ - if (t->ty == Tstruct) -- { StructDeclaration *sd = ((TypeStruct *) t)->sym; -+ { -+ StructDeclaration *sd = ((TypeStruct *) t)->sym; - if (sd->postblit) - return sd; - } -+ - return NULL; - } - -@@ -760,9 +869,9 @@ CatAssignExp::toElem (IRState *irs) - // Append an array - tree args[3]; - -- args[0] = irs->typeinfoReference (type); -+ args[0] = build_typeinfo (type); - args[1] = build_address (e1->toElem (irs)); -- args[2] = irs->toDArray (e2); -+ args[2] = d_array_convert (e2); - - result = build_libcall (LIBCALL_ARRAYAPPENDT, 3, args, type->toCtype()); - } -@@ -771,12 +880,12 @@ CatAssignExp::toElem (IRState *irs) - // Append an element - tree args[3]; - -- args[0] = irs->typeinfoReference (type); -+ args[0] = build_typeinfo (type); - args[1] = build_address (e1->toElem (irs)); - args[2] = size_one_node; - - result = build_libcall (LIBCALL_ARRAYAPPENDCTX, 3, args, type->toCtype()); -- result = save_expr (result); -+ result = make_temp (result); - - // Assign e2 to last element - tree off_exp = d_array_length (result); -@@ -789,17 +898,8 @@ CatAssignExp::toElem (IRState *irs) - - // Evaluate expression before appending - tree e2e = e2->toElem (irs); -- e2e = save_expr (e2e); -+ e2e = maybe_make_temp (e2e); - result = modify_expr (etype->toCtype(), build_deref (ptr_exp), e2e); -- -- // Maybe call postblit on e2. -- StructDeclaration *sd = needsPostblit (tb2); -- if (sd != NULL) -- { -- Expressions args; -- tree callexp = irs->call (sd->postblit, build_address (e2e), &args); -- result = compound_expr (callexp, result); -- } - result = compound_expr (e2e, result); - } - } -@@ -811,18 +911,20 @@ elem * - MinAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (MINUS_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, MINUS_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * - AddAssignExp::toElem (IRState *irs) - { - if (unhandled_arrayop_p (this)) -- return error_mark (type); -+ return error_mark_node; - -- return irs->buildAssignOp (PLUS_EXPR, type, e1, e2); -+ tree exp = toElemBin (irs, PLUS_EXPR); -+ return convert_expr (exp, e1->type, type); - } - - elem * -@@ -840,7 +942,7 @@ AssignExp::toElem (IRState *irs) - tree args[3]; - LibCall libcall; - -- args[0] = irs->typeinfoReference (ale->e1->type); -+ args[0] = build_typeinfo (ale->e1->type); - args[1] = convert_expr (e2->toElem (irs), e2->type, Type::tsize_t); - args[2] = build_address (ale->e1->toElem (irs)); - libcall = etype->isZeroInit() ? LIBCALL_ARRAYSETLENGTHT : LIBCALL_ARRAYSETLENGTHIT; -@@ -852,7 +954,30 @@ AssignExp::toElem (IRState *irs) - // Look for array[] = n; - if (e1->op == TOKslice) - { -- Type *etype = e1->type->toBasetype()->nextOf()->toBasetype(); -+ SliceExp *se = (SliceExp *) e1; -+ Type *stype = se->e1->type->toBasetype(); -+ Type *tb2 = e2->type->toBasetype(); -+ Type *etype = stype->nextOf()->toBasetype(); -+ -+ // Optimize static array assignment with array literal. -+ // Front-end writes these as an assignment of a dynamic -+ // array literal with a slice. -+ if (se->lwr == NULL && stype->ty == Tsarray -+ && e2->op == TOKarrayliteral -+ && tb2->nextOf()->mutableOf()->implicitConvTo(stype->nextOf())) -+ { -+ Expression *e1 = se->e1; -+ Type *t2save = e2->type; -+ -+ // Treat [e2] as a static array literal. -+ e2->type = stype; -+ tree t1 = e1->toElem (irs); -+ tree t2 = convert_for_assignment (e2->toElem (irs), e2->type, e1->type); -+ tree result = modify_expr (e1->type->toCtype(), t1, t2); -+ e2->type = t2save; -+ -+ return convert_expr (result, e1->type, type); -+ } - - // Determine if we need to do postblit. - int postblit = 0; -@@ -863,7 +988,7 @@ AssignExp::toElem (IRState *irs) - || (e2->op == TOKcast && ((UnaExp *) e2)->e1->isLvalue()))) - postblit = 1; - -- if (d_types_compatible (etype, e2->type->toBasetype())) -+ if (d_types_compatible (etype, tb2)) - { - // Set a range of elements to one value. - tree t1 = maybe_make_temp (e1->toElem (irs)); -@@ -879,7 +1004,7 @@ AssignExp::toElem (IRState *irs) - args[0] = d_array_ptr (t1); - args[1] = aoe.set (e2->toElem (irs)); - args[2] = d_array_length (t1); -- args[3] = irs->typeinfoReference (etype); -+ args[3] = build_typeinfo (etype); - libcall = (op == TOKconstruct) ? LIBCALL_ARRAYSETCTOR : LIBCALL_ARRAYSETASSIGN; - - tree call = build_libcall (libcall, 4, args); -@@ -887,8 +1012,7 @@ AssignExp::toElem (IRState *irs) - } - } - -- tree set_exp = irs->arraySetExpr (d_array_ptr (t1), -- e2->toElem (irs), d_array_length (t1)); -+ tree set_exp = irs->doArraySet (d_array_ptr (t1), e2->toElem (irs), d_array_length (t1)); - return compound_expr (set_exp, t1); - } - -@@ -898,9 +1022,9 @@ AssignExp::toElem (IRState *irs) - tree args[3]; - LibCall libcall; - -- args[0] = irs->typeinfoReference (etype); -- args[1] = irs->toDArray (e1); -- args[2] = irs->toDArray (e2); -+ args[0] = build_typeinfo (etype); -+ args[1] = d_array_convert (e1); -+ args[2] = d_array_convert (e2); - libcall = (op == TOKconstruct) ? LIBCALL_ARRAYCTOR : LIBCALL_ARRAYASSIGN; - - return build_libcall (libcall, 3, args, type->toCtype()); -@@ -911,15 +1035,15 @@ AssignExp::toElem (IRState *irs) - tree args[3]; - - args[0] = build_integer_cst (etype->size(), Type::tsize_t->toCtype()); -- args[1] = irs->toDArray (e2); -- args[2] = irs->toDArray (e1); -+ args[1] = d_array_convert (e2); -+ args[2] = d_array_convert (e1); - - return build_libcall (LIBCALL_ARRAYCOPY, 3, args, type->toCtype()); - } - else - { -- tree t1 = maybe_make_temp (irs->toDArray (e1)); -- tree t2 = irs->toDArray (e2); -+ tree t1 = maybe_make_temp (d_array_convert (e1)); -+ tree t2 = d_array_convert (e2); - tree size = fold_build2 (MULT_EXPR, size_type_node, - d_convert (size_type_node, d_array_length (t1)), - size_int (etype->size())); -@@ -960,7 +1084,7 @@ AssignExp::toElem (IRState *irs) - if (sd->isNested()) - { - tree vthis_field = sd->vthis->toSymbol()->Stree; -- tree vthis_value = irs->getVThis (sd, this); -+ tree vthis_value = build_vthis (sd, irs->func, this); - - tree vthis_exp = modify_expr (component_ref (lhs, vthis_field), vthis_value); - result = compound_expr (result, vthis_exp); -@@ -1004,7 +1128,7 @@ IndexExp::toElem (IRState *irs) - - if (tb1->ty == Taarray) - { -- Type *key_type = ((TypeAArray *) tb1)->index->toBasetype(); -+ Type *tkey = ((TypeAArray *) tb1)->index->toBasetype(); - AddrOfExpr aoe; - tree args[4]; - LibCall libcall; -@@ -1021,15 +1145,15 @@ IndexExp::toElem (IRState *irs) - args[0] = e1->toElem (irs); - } - -- args[1] = irs->typeinfoReference (key_type); -+ args[1] = build_typeinfo (tkey); - args[2] = build_integer_cst (tb1->nextOf()->size(), Type::tsize_t->toCtype()); -- args[3] = aoe.set (convert_expr (e2->toElem (irs), e2->type, key_type)); -+ args[3] = aoe.set (convert_expr (e2->toElem (irs), e2->type, tkey)); - - index = aoe.finish (build_libcall (libcall, 4, args, type->pointerTo()->toCtype())); - -- if (array_bounds_check()) -+ if (array_bounds_check() && !skipboundscheck) - { -- index = save_expr (index); -+ index = make_temp (index); - index = build3 (COND_EXPR, TREE_TYPE (index), d_truthvalue_conversion (index), - index, d_assert_call (loc, LIBCALL_ARRAY_BOUNDS)); - } -@@ -1038,11 +1162,69 @@ IndexExp::toElem (IRState *irs) - } - else - { -- /* arrayElemRef will call aryscp.finish. This result -- of this function may be used as an lvalue and we -- do not want it to be a BIND_EXPR. */ -- ArrayScope aryscp (lengthVar, loc); -- return irs->arrayElemRef (this, &aryscp); -+ // Build an array index expression. ArrayScope may build a BIND_EXPR -+ // if temporaries were created for bounds checking. -+ ArrayScope arrscope (lengthVar, loc); -+ -+ // The expression that holds the array data. -+ tree t1 = e1->toElem (irs); -+ // The expression that indexes the array data. -+ tree t2 = e2->toElem (irs); -+ // The base pointer to the elements. -+ tree ptrexp; -+ -+ switch (tb1->ty) -+ { -+ case Tarray: -+ case Tsarray: -+ t1 = arrscope.setArrayExp (t1, e1->type); -+ -+ // If it's a static array and the index is constant, -+ // the front end has already checked the bounds. -+ if (array_bounds_check() && !(tb1->ty == Tsarray && e2->isConst())) -+ { -+ // Implement bounds check as a conditional expression: -+ // array [inbounds(index) ? index : { throw ArrayBoundsError}] -+ tree length; -+ -+ // First, set up the index expression to only be evaluated once. -+ tree index = maybe_make_temp (t2); -+ -+ if (tb1->ty == Tarray) -+ { -+ t1 = maybe_make_temp (t1); -+ length = d_array_length (t1); -+ } -+ else -+ length = ((TypeSArray *) tb1)->dim->toElem (irs); -+ -+ t2 = d_checked_index (loc, index, length, false); -+ } -+ -+ if (tb1->ty == Tarray) -+ ptrexp = d_array_ptr (t1); -+ else -+ ptrexp = build_address (t1); -+ -+ // This conversion is required for static arrays and is -+ // just-to-be-safe for dynamic arrays. -+ ptrexp = convert (tb1->nextOf()->pointerTo()->toCtype(), ptrexp); -+ break; -+ -+ case Tpointer: -+ // Ignores ArrayScope. -+ ptrexp = t1; -+ break; -+ -+ default: -+ gcc_unreachable(); -+ } -+ -+ ptrexp = void_okay_p (ptrexp); -+ t2 = arrscope.finish (t2); -+ -+ return indirect_ref (TREE_TYPE (TREE_TYPE (ptrexp)), -+ build_array_index (ptrexp, t2)); - } - } - -@@ -1065,24 +1247,24 @@ ArrayLengthExp::toElem (IRState *irs) - { - // Tsarray case seems to be handled by front-end - error ("unexpected type for array length: %s", type->toChars()); -- return error_mark (type); -+ return error_mark_node; - } - } - - elem * - SliceExp::toElem (IRState *irs) - { -- // This function assumes that the front end casts the result to a dynamic array. -- gcc_assert (type->toBasetype()->ty == Tarray); -+ Type *tb = type->toBasetype(); -+ gcc_assert (tb->ty == Tarray || tb->ty == Tsarray); - - // Use convert-to-dynamic-array code if possible - if (e1->type->toBasetype()->ty == Tsarray && !upr && !lwr) - return convert_expr (e1->toElem (irs), e1->type, type); - -- Type *orig_array_type = e1->type->toBasetype(); -+ Type *tb1 = e1->type->toBasetype(); - - tree orig_array_expr, orig_pointer_expr; -- tree final_len_expr, final_ptr_expr; -+ tree len_expr, ptr_expr; - tree array_len_expr = NULL_TREE; - tree lwr_tree = NULL_TREE; - tree upr_tree = NULL_TREE; -@@ -1094,18 +1276,18 @@ SliceExp::toElem (IRState *irs) - // specs don't say bounds if are checked for error or clipped to current size - - // Get the data pointer for static and dynamic arrays -- orig_pointer_expr = convert_expr (orig_array_expr, orig_array_type, -- orig_array_type->nextOf()->pointerTo()); -+ orig_pointer_expr = convert_expr (orig_array_expr, tb1, -+ tb1->nextOf()->pointerTo()); - -- final_ptr_expr = orig_pointer_expr; -+ ptr_expr = orig_pointer_expr; - -- // orig_array_expr is already a save_expr if necessary, so -- // we don't make array_len_expr a save_expr which is, at most, -+ // orig_array_expr is already a SAVE_EXPR if necessary, so -+ // we don't make array_len_expr a SAVE_EXPR which is, at most, - // a COMPONENT_REF on top of orig_array_expr. -- if (orig_array_type->ty == Tarray) -+ if (tb1->ty == Tarray) - array_len_expr = d_array_length (orig_array_expr); -- else if (orig_array_type->ty == Tsarray) -- array_len_expr = ((TypeSArray *) orig_array_type)->dim->toElem (irs); -+ else if (tb1->ty == Tsarray) -+ array_len_expr = ((TypeSArray *) tb1)->dim->toElem (irs); - - if (lwr) - { -@@ -1115,8 +1297,8 @@ SliceExp::toElem (IRState *irs) - { - lwr_tree = maybe_make_temp (lwr_tree); - // Adjust .ptr offset -- final_ptr_expr = build_array_index (void_okay_p (final_ptr_expr), lwr_tree); -- final_ptr_expr = build_nop (TREE_TYPE (orig_pointer_expr), final_ptr_expr); -+ ptr_expr = build_array_index (void_okay_p (ptr_expr), lwr_tree); -+ ptr_expr = build_nop (TREE_TYPE (orig_pointer_expr), ptr_expr); - } - else - lwr_tree = NULL_TREE; -@@ -1132,58 +1314,66 @@ SliceExp::toElem (IRState *irs) - // %% && ! is zero - if (array_len_expr) - { -- final_len_expr = d_checked_index (loc, upr_tree, array_len_expr, true); -+ len_expr = d_checked_index (loc, upr_tree, array_len_expr, true); - } - else - { - // Still need to check bounds lwr <= upr for pointers. -- gcc_assert (orig_array_type->ty == Tpointer); -- final_len_expr = upr_tree; -+ gcc_assert (tb1->ty == Tpointer); -+ len_expr = upr_tree; - } - if (lwr_tree) - { - // Enforces lwr <= upr. No need to check lwr <= length as - // we've already ensured that upr <= length. - tree lwr_bounds_check = d_checked_index (loc, lwr_tree, upr_tree, true); -- final_len_expr = compound_expr (lwr_bounds_check, final_len_expr); -+ len_expr = compound_expr (lwr_bounds_check, len_expr); - } - } - else - { -- final_len_expr = upr_tree; -+ len_expr = upr_tree; - } - - if (lwr_tree) - { - // %% Need to ensure lwr always gets evaluated first, as it may be a function call. - // Does (-lwr + upr) rather than (upr - lwr) -- final_len_expr = build2 (PLUS_EXPR, TREE_TYPE (final_len_expr), -- build1 (NEGATE_EXPR, TREE_TYPE (lwr_tree), lwr_tree), -- final_len_expr); -+ len_expr = build2 (PLUS_EXPR, TREE_TYPE (len_expr), -+ build1 (NEGATE_EXPR, TREE_TYPE (lwr_tree), lwr_tree), len_expr); - } - } - else - { - // If this is the case, than there is no lower bound specified and - // there is no need to subtract. -- switch (orig_array_type->ty) -+ switch (tb1->ty) - { - case Tarray: -- final_len_expr = d_array_length (orig_array_expr); -+ len_expr = d_array_length (orig_array_expr); - break; - - case Tsarray: -- final_len_expr = ((TypeSArray *) orig_array_type)->dim->toElem (irs); -+ len_expr = ((TypeSArray *) tb1)->dim->toElem (irs); - break; - - default: -- ::error ("Attempt to take length of something that was not an array"); -- return error_mark (type); -+ error ("Attempt to take length of something that was not an array"); -+ return error_mark_node; - } - } - -- tree result = d_array_value (type->toCtype(), final_len_expr, final_ptr_expr); -- return aryscp.finish (result); -+ tree exp; -+ -+ if (tb->ty == Tarray) -+ exp = d_array_value (type->toCtype(), len_expr, ptr_expr); -+ else -+ { -+ gcc_assert (lwr && tb->ty == Tsarray); -+ exp = indirect_ref (type->toCtype(), ptr_expr); -+ } -+ -+ return aryscp.finish (exp); - } - - elem * -@@ -1193,11 +1383,9 @@ CastExp::toElem (IRState *irs) - Type *tbtype = to->toBasetype(); - tree t = e1->toElem (irs); - -+ // Just evaluate e1 if it has any side effects - if (tbtype->ty == Tvoid) -- { -- // Just evaluate e1 if it has any side effects -- return build1 (NOP_EXPR, tbtype->toCtype(), t); -- } -+ return build1 (NOP_EXPR, tbtype->toCtype(), t); - - return convert_expr (t, ebtype, tbtype); - } -@@ -1231,15 +1419,13 @@ DeleteExp::toElem (IRState *irs) - else if (tb1->ty == Tarray) - { - // Might need to run destructor on array contents -- Type *next_type = tb1->nextOf()->toBasetype(); -+ Type *telem = tb1->nextOf()->baseElemOf(); - tree ti = d_null_pointer; - tree args[2]; - -- while (next_type->ty == Tsarray) -- next_type = next_type->nextOf()->toBasetype(); -- if (next_type->ty == Tstruct) -+ if (telem->ty == Tstruct) - { -- TypeStruct *ts = (TypeStruct *) next_type; -+ TypeStruct *ts = (TypeStruct *) telem; - if (ts->sym->dtor) - ti = tb1->nextOf()->getTypeInfo (NULL)->toElem (irs); - } -@@ -1258,7 +1444,7 @@ DeleteExp::toElem (IRState *irs) - else - { - error ("don't know how to delete %s", e1->toChars()); -- return error_mark (type); -+ return error_mark_node; - } - } - -@@ -1271,20 +1457,20 @@ RemoveExp::toElem (IRState *irs) - if (array->type->toBasetype()->ty == Taarray) - { - Type *a_type = array->type->toBasetype(); -- Type *key_type = ((TypeAArray *) a_type)->index->toBasetype(); -+ Type *tkey = ((TypeAArray *) a_type)->index->toBasetype(); - AddrOfExpr aoe; - tree args[3]; - - args[0] = array->toElem (irs); -- args[1] = irs->typeinfoReference (key_type); -- args[2] = aoe.set (convert_expr (index->toElem (irs), index->type, key_type)); -+ args[1] = build_typeinfo (tkey); -+ args[2] = aoe.set (convert_expr (index->toElem (irs), index->type, tkey)); - - return aoe.finish (build_libcall (LIBCALL_AADELX, 3, args)); - } - else - { - error ("%s is not an associative array", array->toChars()); -- return error_mark (type); -+ return error_mark_node; - } - } - -@@ -1326,7 +1512,7 @@ NegExp::toElem (IRState *irs) - if (ty1 == Tarray || ty1 == Tsarray) - { - error ("Array operation %s not implemented", toChars()); -- return error_mark (type); -+ return error_mark_node; - } - - return build1 (NEGATE_EXPR, type->toCtype(), e1->toElem (irs)); -@@ -1360,7 +1546,7 @@ PtrExp::toElem (IRState *irs) - if (!decl_reference_p (sym_exp->var)) - { - rec_type = sym_exp->var->type->toBasetype(); -- rec_tree = irs->var (sym_exp->var); -+ rec_tree = get_decl_tree (sym_exp->var, irs->func); - the_offset = sym_exp->offset; - } - } -@@ -1374,8 +1560,10 @@ PtrExp::toElem (IRState *irs) - if (field->offset == the_offset - && d_types_same (field->type, this->type)) - { -- if (error_mark_p (rec_tree)) -- return rec_tree; // backend will ICE otherwise -+ // Catch errors, backend will ICE otherwise. -+ if (error_operand_p (rec_tree)) -+ return rec_tree; -+ - return component_ref (rec_tree, field->toSymbol()->Stree); - } - else if (field->offset > the_offset) -@@ -1389,25 +1577,104 @@ PtrExp::toElem (IRState *irs) - elem * - AddrExp::toElem (IRState *irs) - { -- tree addrexp = build_address (e1->toElem (irs)); -- return build_nop (type->toCtype(), addrexp); -+ tree exp; -+ -+ if (e1->op == TOKstructliteral) -+ { -+ StructLiteralExp *sle = ((StructLiteralExp *) e1)->origin; -+ exp = build_address (sle->toElem (irs)); -+ } -+ else -+ exp = build_address (e1->toElem (irs)); -+ -+ return build_nop (type->toCtype(), exp); - } - - elem * - CallExp::toElem (IRState *irs) - { -- tree call_exp = irs->call (e1, arguments); -+ Type *tb = e1->type->toBasetype(); -+ Expression *e1b = e1; -+ tree object = NULL_TREE; -+ -+ // Calls to delegates can sometimes look like this: -+ if (e1b->op == TOKcomma) -+ { -+ e1b = ((CommaExp *) e1b)->e2; -+ gcc_assert (e1b->op == TOKvar); -+ -+ Declaration *var = ((VarExp *) e1b)->var; -+ gcc_assert (var->isFuncDeclaration() && !var->needThis()); -+ } -+ -+ tree callee = e1b->toElem (irs); -+ TypeFunction *tf = NULL; -+ -+ if (D_METHOD_CALL_EXPR (callee)) -+ { -+ // This could be a delegate expression (TY == Tdelegate), but not -+ // actually a delegate variable. -+ if (e1b->op == TOKdotvar) -+ { -+ // This gets the true function type, getting the function type from -+ // e1->type can sometimes be incorrect, eg: ref return functions. -+ tf = get_function_type (((DotVarExp *) e1b)->var->type); -+ } -+ else -+ tf = get_function_type (tb); -+ -+ extract_from_method_call (callee, callee, object); -+ } -+ else if (tb->ty == Tdelegate) -+ { -+ // Delegate call, extract .object and .funcptr from var. -+ callee = maybe_make_temp (callee); -+ tf = get_function_type (tb); -+ object = delegate_object (callee); -+ callee = delegate_method (callee); -+ } -+ else if (e1b->op == TOKvar) -+ { -+ FuncDeclaration *fd = ((VarExp *) e1b)->var->isFuncDeclaration(); -+ gcc_assert (fd); -+ tf = get_function_type (fd->type); -+ -+ if (fd->isNested()) -+ { -+ // Maybe re-evaluate symbol storage treating 'fd' as public. -+ if (call_by_alias_p (irs->func, fd)) -+ setup_symbol_storage (fd, callee, true); -+ -+ object = get_frame_for_symbol (irs->func, fd); -+ } -+ else if (fd->needThis()) -+ { -+ e1b->error ("need 'this' to access member %s", fd->toChars()); -+ // Continue processing... -+ object = d_null_pointer; -+ } -+ } -+ else -+ { -+ // Normal direct function call. -+ tf = get_function_type (tb); -+ } -+ -+ gcc_assert (tf != NULL); -+ -+ // Now we have the type, callee and maybe object reference, -+ // build the call expression. -+ tree exp = d_build_call (tf, callee, object, arguments); - -- TypeFunction *tf = get_function_type (e1->type->toBasetype()); - if (tf->isref) -- call_exp = build_deref (call_exp); -+ exp = build_deref (exp); - - // Some library calls are defined to return a generic type. -- // this->type is the real type. (See crash2.d) -+ // this->type is the real type we want to return. - if (type->isTypeBasic()) -- call_exp = d_convert (type->toCtype(), call_exp); -+ exp = d_convert (type->toCtype(), exp); - -- return call_exp; -+ return exp; - } - - /******************************************* -@@ -1417,9 +1684,9 @@ CallExp::toElem (IRState *irs) - elem * - Expression::toElemDtor (IRState *irs) - { -- size_t starti = irs->varsInScope ? irs->varsInScope->dim : 0; -- tree t = toElem (irs); -- size_t endi = irs->varsInScope ? irs->varsInScope->dim : 0; -+ size_t starti = irs->varsInScope.length(); -+ tree exp = toElem (irs); -+ size_t endi = irs->varsInScope.length(); - - // Codegen can be improved by determining if no exceptions can be thrown - // between the ctor and dtor, and eliminating the ctor and dtor. -@@ -1429,10 +1696,10 @@ Expression::toElemDtor (IRState *irs) - tree tdtors = NULL_TREE; - for (size_t i = starti; i != endi; ++i) - { -- VarDeclaration *vd = irs->varsInScope->tdata()[i]; -+ VarDeclaration *vd = irs->varsInScope[i]; - if (vd) - { -- irs->varsInScope->tdata()[i] = NULL; -+ irs->varsInScope[i] = NULL; - tree td = vd->edtor->toElem (irs); - // Execute in reverse order. - tdtors = maybe_compound_expr (tdtors, td); -@@ -1441,11 +1708,35 @@ Expression::toElemDtor (IRState *irs) - - if (tdtors != NULL_TREE) - { -- t = save_expr (t); -- t = compound_expr (compound_expr (t, tdtors), t); -+ if (op == TOKcall) -+ { -+ // Wrap expression and dtors in a try/finally expression. -+ tree body = exp; -+ -+ if (type->ty == Tvoid) -+ exp = build2 (TRY_FINALLY_EXPR, void_type_node, body, tdtors); -+ else -+ { -+ body = maybe_make_temp (body); -+ tree tfexp = build2 (TRY_FINALLY_EXPR, void_type_node, body, tdtors); -+ exp = compound_expr (tfexp, body); -+ } -+ } -+ else if (op == TOKcomma && ((CommaExp *) this)->e2->op == TOKvar) -+ { -+ // Split comma expressions, so as don't require a save_expr. -+ tree lexp = TREE_OPERAND (exp, 0); -+ tree rvalue = TREE_OPERAND (exp, 1); -+ exp = compound_expr (compound_expr (lexp, tdtors), rvalue); -+ } -+ else -+ { -+ exp = maybe_make_temp (exp); -+ exp = compound_expr (compound_expr (exp, tdtors), exp); -+ } - } - -- return t; -+ return exp; - } - - -@@ -1453,8 +1744,7 @@ elem * - DotTypeExp::toElem (IRState *irs) - { - // Just a pass through to e1. -- tree t = e1->toElem (irs); -- return t; -+ return e1->toElem (irs); - } - - // The result will probably just be converted to a CONSTRUCTOR for a Tdelegate struct -@@ -1479,7 +1769,7 @@ DelegateExp::toElem (IRState *irs) - if (!func->isThis()) - { - error ("delegates are only for non-static functions"); -- return error_mark (type); -+ return error_mark_node; - } - - return get_object_method (e1->toElem (irs), e1, func, type); -@@ -1492,7 +1782,7 @@ DelegateExp::toElem (IRState *irs) - if (e1->op == TOKnull) - this_tree = e1->toElem (irs); - else -- this_tree = irs->getFrameForSymbol (func); -+ this_tree = get_frame_for_symbol (irs->func, func); - } - else - { -@@ -1536,8 +1826,8 @@ DotVarExp::toElem (IRState *irs) - } - else if (var_decl) - { -- if (!(var_decl->storage_class & STCfield)) -- return irs->var (var_decl); -+ if (!var_decl->isField()) -+ return get_decl_tree (var_decl, irs->func); - else - { - tree this_tree = e1->toElem (irs); -@@ -1553,38 +1843,51 @@ DotVarExp::toElem (IRState *irs) - default: - break; - } -- ::error ("Don't know how to handle %s", toChars()); -- return error_mark (type); -+ -+ error ("Don't know how to handle %s", toChars()); -+ return error_mark_node; - } - - elem * - AssertExp::toElem (IRState *irs) - { -- // %% todo: Do we call a Tstruct's invariant if -- // e1 is a pointer to the struct? - if (global.params.useAssert) - { - Type *tb1 = e1->type->toBasetype(); -- TY ty = tb1->ty; -- tree assert_call; -+ tree tmsg = NULL_TREE; -+ LibCall libcall; - -+ // Build _d_assert call. - if (irs->func->isUnitTestDeclaration()) - { -- assert_call = (msg != NULL) -- ? d_assert_call (loc, LIBCALL_UNITTEST_MSG, msg->toElem (irs)) -- : d_assert_call (loc, LIBCALL_UNITTEST, NULL_TREE); -+ if (msg) -+ { -+ tmsg = msg->toElemDtor (irs); -+ libcall = LIBCALL_UNITTEST_MSG; -+ } -+ else -+ libcall = LIBCALL_UNITTEST; - } - else - { -- assert_call = (msg != NULL) -- ? d_assert_call (loc, LIBCALL_ASSERT_MSG, msg->toElem (irs)) -- : d_assert_call (loc, LIBCALL_ASSERT, NULL_TREE); -+ if (msg) -+ { -+ tmsg = msg->toElemDtor (irs); -+ libcall = LIBCALL_ASSERT_MSG; -+ } -+ else -+ libcall = LIBCALL_ASSERT; - } - -- if (ty == Tclass) -+ tree assert_call = d_assert_call (loc, libcall, tmsg); -+ -+ // Build condition that we are asserting in this contract. -+ if (tb1->ty == Tclass) - { - ClassDeclaration *cd = tb1->isClassHandle(); - tree arg = e1->toElem (irs); -+ tree invc = NULL_TREE; -+ - if (cd->isCOMclass()) - { - return build3 (COND_EXPR, void_type_node, -@@ -1592,13 +1895,15 @@ AssertExp::toElem (IRState *irs) - d_void_zero_node, assert_call); - } - else if (cd->isInterfaceDeclaration()) -- { -- arg = convert_expr (arg, tb1, build_object_type()); -- } -- // this does a null pointer check before calling _d_invariant -+ arg = convert_expr (arg, tb1, build_object_type()); -+ -+ if (global.params.useInvariants && !cd->isCPPclass()) -+ invc = build_libcall (LIBCALL_INVARIANT, 1, &arg); -+ -+ // This does a null pointer check before calling _d_invariant - return build3 (COND_EXPR, void_type_node, - build_boolop (NE_EXPR, arg, d_null_pointer), -- build_libcall (LIBCALL_INVARIANT, 1, &arg), assert_call); -+ invc ? invc : d_void_zero_node, assert_call); - } - else - { -@@ -1608,18 +1913,15 @@ AssertExp::toElem (IRState *irs) - tree invc = NULL_TREE; - tree e1_t = e1->toElem (irs); - -- if (ty == Tpointer) -+ if (global.params.useInvariants -+ && tb1->ty == Tpointer && tb1->nextOf()->ty == Tstruct) - { -- Type *sub_type = tb1->nextOf()->toBasetype(); -- if (sub_type->ty == Tstruct) -+ FuncDeclaration *inv = ((TypeStruct *) tb1->nextOf())->sym->inv; -+ if (inv != NULL) - { -- AggregateDeclaration *agg_decl = ((TypeStruct *) sub_type)->sym; -- if (agg_decl->inv) -- { -- Expressions args; -- e1_t = maybe_make_temp (e1_t); -- invc = irs->call (agg_decl->inv, e1_t, &args); -- } -+ Expressions args; -+ e1_t = maybe_make_temp (e1_t); -+ invc = d_build_call (inv, e1_t, &args); - } - } - result = build3 (COND_EXPR, void_type_node, -@@ -1636,6 +1938,7 @@ elem * - DeclarationExp::toElem (IRState *irs) - { - VarDeclaration *vd = declaration->isVarDeclaration(); -+ - if (vd != NULL) - { - if (!vd->isStatic() && !(vd->storage_class & STCmanifest) -@@ -1643,16 +1946,10 @@ DeclarationExp::toElem (IRState *irs) - { - // Put variable on list of things needing destruction - if (vd->edtor && !vd->noscope) -- { -- if (!irs->varsInScope) -- irs->varsInScope = new VarDeclarations(); -- irs->varsInScope->push (vd); -- } -+ irs->varsInScope.safe_push (vd); - } - } - -- // VarDeclaration::toObjFile was modified to call d_gcc_emit_local_variable -- // if needed. This assumes irs == cirstate - irs->pushStatementList(); - declaration->toObjFile (0); - tree t = irs->popStatementList(); -@@ -1670,37 +1967,27 @@ DeclarationExp::toElem (IRState *irs) - elem * - FuncExp::toElem (IRState *irs) - { -- Type *func_type = type->toBasetype(); -+ Type *ftype = type->toBasetype(); - -- if (func_type->ty == Tpointer) -+ // This check is for lambda's, remove 'vthis' as function isn't nested. -+ if (fd->tok == TOKreserved && ftype->ty == Tpointer) - { -- // This check is for lambda's, remove 'vthis' as function isn't nested. -- if (fd->tok == TOKreserved && fd->vthis) -- { -- fd->tok = TOKfunction; -- fd->vthis = NULL; -- } -- -- func_type = func_type->nextOf()->toBasetype(); -+ fd->tok = TOKfunction; -+ fd->vthis = NULL; - } - - // Emit after current function body has finished. -- irs->func->deferred.push (fd); -+ if (irs->func) -+ irs->func->deferred.push (fd); - - // If nested, this will be a trampoline... -- switch (func_type->ty) -+ if (fd->isNested()) - { -- case Tfunction: -- return build_nop (type->toCtype(), build_address (fd->toSymbol()->Stree)); -- -- case Tdelegate: - return build_method_call (build_address (fd->toSymbol()->Stree), -- irs->getFrameForSymbol (fd), type); -- -- default: -- ::error ("Unexpected FuncExp type"); -- return error_mark (type); -+ get_frame_for_symbol (irs->func, fd), type); - } -+ -+ return build_nop (type->toCtype(), build_address (fd->toSymbol()->Stree)); - } - - elem * -@@ -1720,14 +2007,14 @@ SymbolExp::toElem (IRState *irs) - if (var->needThis()) - { - error ("need 'this' to access member %s", var->ident->string); -- return error_mark (type); -+ return error_mark_node; - } - - // __ctfe is always false at runtime - if (var->ident == Id::ctfe) - return integer_zero_node; - -- exp = irs->var (var); -+ exp = get_decl_tree (var, irs->func); - TREE_USED (exp) = 1; - - // For variables that are references (currently only out/inout arguments; -@@ -1741,7 +2028,7 @@ SymbolExp::toElem (IRState *irs) - { - size_t offset = ((SymOffExp *) this)->offset; - -- exp = irs->var (var); -+ exp = get_decl_tree (var, irs->func); - TREE_USED (exp) = 1; - - if (decl_reference_p (var)) -@@ -1786,15 +2073,15 @@ NewExp::toElem (IRState *irs) - // Call allocator (custom allocator or _d_newclass). - if (onstack) - { -- tree stack_var = build_local_var (rec_type); -- irs->expandDecl (stack_var); -+ tree stack_var = build_local_temp (rec_type); -+ expand_decl (stack_var); - new_call = build_address (stack_var); - setup_exp = modify_expr (indirect_ref (rec_type, new_call), - class_decl->toInitializer()->Stree); - } - else if (allocator) - { -- new_call = irs->call (allocator, newargs); -+ new_call = d_build_call (allocator, NULL_TREE, newargs); - new_call = maybe_make_temp (new_call); - // copy memory... - setup_exp = modify_expr (indirect_ref (rec_type, new_call), -@@ -1829,7 +2116,7 @@ NewExp::toElem (IRState *irs) - } - else - { -- vthis_value = irs->getVThis (class_decl, this); -+ vthis_value = build_vthis (class_decl, irs->func, this); - } - - if (vthis_value) -@@ -1843,55 +2130,57 @@ NewExp::toElem (IRState *irs) - - // Call constructor. - if (member) -- result = irs->call (member, new_call, arguments); -+ result = d_build_call (member, new_call, arguments); - else - result = new_call; - } - // New'ing a struct. - else if (tb->ty == Tpointer && tb->nextOf()->toBasetype()->ty == Tstruct) - { -+ Type *htype = newtype->toBasetype(); -+ gcc_assert (htype->ty == Tstruct); - gcc_assert (!onstack); - -- Type * handle_type = newtype->toBasetype(); -- gcc_assert (handle_type->ty == Tstruct); -- TypeStruct *struct_type = (TypeStruct *) handle_type; -- StructDeclaration *sd = struct_type->sym; -- Expression *init = struct_type->defaultInit (loc); -- -+ TypeStruct *stype = (TypeStruct *) htype; -+ StructDeclaration *sd = stype->sym; -+ Expression *init = stype->defaultInit (loc); - tree new_call; -- tree setup_exp; -- tree init_exp; -+ -+ // Struct size is unknown. -+ if (sd->size (loc) == 0) -+ return d_convert (type->toCtype(), integer_zero_node); - - if (allocator) -- new_call = irs->call (allocator, newargs); -+ new_call = d_build_call (allocator, NULL_TREE, newargs); - else - { -- libcall = struct_type->isZeroInit (loc) ? LIBCALL_NEWITEMT : LIBCALL_NEWITEMIT; -+ libcall = stype->isZeroInit (loc) ? LIBCALL_NEWITEMT : LIBCALL_NEWITEMIT; - tree arg = type->getTypeInfo(NULL)->toElem (irs); - new_call = build_libcall (libcall, 1, &arg); - } - new_call = build_nop (tb->toCtype(), new_call); - - // Save the result allocation call. -- init_exp = convert_for_assignment (init->toElem (irs), init->type, struct_type); -+ tree init_exp = convert_for_assignment (init->toElem (irs), init->type, stype); - new_call = maybe_make_temp (new_call); -- setup_exp = modify_expr (build_deref (new_call), init_exp); -+ -+ tree setup_exp = modify_expr (build_deref (new_call), init_exp); - new_call = compound_expr (setup_exp, new_call); - - // Set vthis for nested structs/classes. - if (sd->isNested()) - { -- tree vthis_value = irs->getVThis (sd, this); -+ tree vthis_value = build_vthis (sd, irs->func, this); - tree vthis_field; - new_call = maybe_make_temp (new_call); -- vthis_field = component_ref (indirect_ref (struct_type->toCtype(), new_call), -+ vthis_field = component_ref (indirect_ref (stype->toCtype(), new_call), - sd->vthis->toSymbol()->Stree); - new_call = compound_expr (modify_expr (vthis_field, vthis_value), new_call); - } - - // Call constructor. - if (member) -- result = irs->call (member, new_call, arguments); -+ result = d_build_call (member, new_call, arguments); - else - result = new_call; - } -@@ -1908,8 +2197,13 @@ NewExp::toElem (IRState *irs) - { - // Single dimension array allocations. - Expression *arg = (*arguments)[0]; -- libcall = tarray->next->isZeroInit() ? LIBCALL_NEWARRAYT : LIBCALL_NEWARRAYIT; - tree args[2]; -+ -+ // Elem size is unknown. -+ if (tarray->next->size() == 0) -+ return d_array_value (type->toCtype(), size_int (0), d_null_pointer); -+ -+ libcall = tarray->next->isZeroInit() ? LIBCALL_NEWARRAYT : LIBCALL_NEWARRAYIT; - args[0] = type->getTypeInfo(NULL)->toElem (irs); - args[1] = arg->toElem (irs); - result = build_libcall (libcall, 2, args, tb->toCtype()); -@@ -1933,6 +2227,7 @@ NewExp::toElem (IRState *irs) - telem = telem->toBasetype()->nextOf(); - gcc_assert (telem); - } -+ - CONSTRUCTOR_ELTS (dims_init) = elms; - DECL_INITIAL (dims_var) = dims_init; - -@@ -1947,9 +2242,14 @@ NewExp::toElem (IRState *irs) - // New'ing a pointer - else if (tb->ty == Tpointer) - { -- TypePointer *pointer_type = (TypePointer *) tb; -+ TypePointer *tpointer = (TypePointer *) tb; -+ -+ // Elem size is unknown. -+ if (tpointer->next->size() == 0) -+ return d_convert (type->toCtype(), integer_zero_node); -+ -+ libcall = tpointer->next->isZeroInit (loc) ? LIBCALL_NEWITEMT : LIBCALL_NEWITEMIT; - -- libcall = pointer_type->next->isZeroInit (loc) ? LIBCALL_NEWITEMT : LIBCALL_NEWITEMIT; - tree arg = type->getTypeInfo(NULL)->toElem (irs); - result = build_libcall (libcall, 1, &arg, tb->toCtype()); - } -@@ -1962,15 +2262,15 @@ NewExp::toElem (IRState *irs) - elem * - ScopeExp::toElem (IRState *) - { -- ::error ("%s is not an expression", toChars()); -- return error_mark (type); -+ error ("%s is not an expression", toChars()); -+ return error_mark_node; - } - - elem * - TypeExp::toElem (IRState *) - { -- ::error ("type %s is not an expression", toChars()); -- return error_mark (type); -+ error ("type %s is not an expression", toChars()); -+ return error_mark_node; - } - - elem * -@@ -2043,7 +2343,7 @@ StringExp::toElem (IRState *) - - default: - error ("Invalid type for string constant: %s", type->toChars()); -- return error_mark (type); -+ return error_mark_node; - } - - return value; -@@ -2052,45 +2352,76 @@ StringExp::toElem (IRState *) - elem * - TupleExp::toElem (IRState *irs) - { -- tree result = NULL_TREE; -- if (exps && exps->dim) -+ tree exp = NULL_TREE; -+ -+ if (e0) -+ exp = e0->toElem (irs); -+ -+ for (size_t i = 0; i < exps->dim; ++i) - { -- for (size_t i = 0; i < exps->dim; ++i) -- { -- Expression *e = (*exps)[i]; -- result = maybe_vcompound_expr (result, e->toElem (irs)); -- } -+ Expression *e = (*exps)[i]; -+ exp = maybe_vcompound_expr (exp, e->toElem (irs)); - } -- else -- result = d_void_zero_node; - -- return result; -+ if (exp == NULL_TREE) -+ exp = d_void_zero_node; -+ -+ return exp; - } - - elem * - ArrayLiteralExp::toElem (IRState *irs) - { -- Type *typeb = type->toBasetype(); -- gcc_assert (typeb->ty == Tarray || typeb->ty == Tsarray || typeb->ty == Tpointer); -- Type *etype = typeb->nextOf(); -- tree sa_type = d_array_type (etype, elements->dim); -+ Type *tb = type->toBasetype(); -+ gcc_assert (tb->ty == Tarray || tb->ty == Tsarray || tb->ty == Tpointer); -+ -+ // Convert void[n] to ubyte[n] -+ if (tb->ty == Tsarray && tb->nextOf()->toBasetype()->ty == Tvoid) -+ tb = TypeSArray::makeType(loc, Type::tuns8, ((TypeSArray *)tb)->dim->toUInteger()); -+ -+ Type *etype = tb->nextOf(); -+ tree tsa = d_array_type (etype, elements->dim); - tree result = NULL_TREE; -+ bool constant_p = tb->isImmutable(); -+ -+ // Handle empty array literals. -+ if (elements->dim == 0) -+ { -+ if (tb->ty == Tarray) -+ return d_array_value (type->toCtype(), size_int (0), d_null_pointer); -+ else -+ return build_constructor (tsa, NULL); -+ } - -- /* Build an expression that assigns the expressions in ELEMENTS to a constructor. */ -+ // Build an expression that assigns the expressions in ELEMENTS to a constructor. - vec<constructor_elt, va_gc> *elms = NULL; - vec_safe_reserve (elms, elements->dim); - - for (size_t i = 0; i < elements->dim; i++) - { - Expression *e = (*elements)[i]; -+ tree elem = e->toElem (irs); -+ -+ elem = maybe_make_temp (elem); - CONSTRUCTOR_APPEND_ELT (elms, build_integer_cst (i, size_type_node), -- convert_expr (e->toElem (irs), e->type, etype)); -+ convert_expr (elem, e->type, etype)); -+ -+ if (constant_p && !e->isConst()) -+ constant_p = false; - } - -- tree ctor = build_constructor (sa_type, elms); -+ tree ctor = build_constructor (tsa, elms); - tree args[2]; - -- args[0] = irs->typeinfoReference (etype->arrayOf()); -+ // Nothing else to do for static arrays. -+ if (tb->ty == Tsarray) -+ return d_convert (type->toCtype(), ctor); -+ -+ // Don't allocate immutable arrays on the heap. -+ if (tb->ty == Tarray && constant_p) -+ return d_array_value (type->toCtype(), size_int (elements->dim), build_address (ctor)); -+ -+ args[0] = build_typeinfo (etype->arrayOf()); - args[1] = build_integer_cst (elements->dim, size_type_node); - - // Call _d_arrayliteralTX (ti, dim); -@@ -2099,7 +2430,7 @@ ArrayLiteralExp::toElem (IRState *irs) - - // memcpy (mem, &ctor, size) - tree size = fold_build2 (MULT_EXPR, size_type_node, -- size_int (elements->dim), size_int (typeb->nextOf()->size())); -+ size_int (elements->dim), size_int (tb->nextOf()->size())); - - result = d_build_call_nary (builtin_decl_explicit (BUILT_IN_MEMCPY), 3, - mem, build_address (ctor), size); -@@ -2107,10 +2438,8 @@ ArrayLiteralExp::toElem (IRState *irs) - // Returns array pointed to by MEM. - result = maybe_compound_expr (result, mem); - -- if (typeb->ty == Tarray) -+ if (tb->ty == Tarray) - result = d_array_value (type->toCtype(), size_int (elements->dim), result); -- else if (typeb->ty == Tsarray) -- result = indirect_ref (sa_type, result); - - return result; - } -@@ -2171,7 +2500,7 @@ AssocArrayLiteralExp::toElem (IRState *i - - tree args[3]; - -- args[0] = irs->typeinfoReference (aa_type); -+ args[0] = build_typeinfo (aa_type); - args[1] = d_array_value (index->arrayOf()->toCtype(), size_int (keys->dim), keys_ptr); - args[2] = d_array_value (next->arrayOf()->toCtype(), size_int (keys->dim), vals_ptr); - result = maybe_compound_expr (result, build_libcall (LIBCALL_ASSOCARRAYLITERALTX, 3, args)); -@@ -2196,100 +2525,69 @@ StructLiteralExp::toElem (IRState *irs) - if (sinit && sinit->Stree) - return sinit->Stree; - -- if (elements) -- { -- size_t dim = elements->dim; -- gcc_assert (dim <= sd->fields.dim - sd->isnested); -+ // CTFE may fill the hidden pointer by NullExp. -+ size_t dim = elements ? elements->dim : 0; -+ gcc_assert (dim <= sd->fields.dim); - -- for (size_t i = 0; i < dim; i++) -- { -- if (!(*elements)[i]) -- continue; -+ for (size_t i = 0; i < dim; i++) -+ { -+ if (!(*elements)[i]) -+ continue; - -- Expression *exp = (*elements)[i]; -- Type *exp_type = exp->type->toBasetype(); -- tree exp_tree = NULL_TREE; -- tree call_exp = NULL_TREE; -+ Expression *exp = (*elements)[i]; -+ Type *exp_type = exp->type->toBasetype(); -+ tree exp_tree = NULL_TREE; - -- VarDeclaration *fld = sd->fields[i]; -- Type *fld_type = fld->type->toBasetype(); -+ VarDeclaration *fld = sd->fields[i]; -+ Type *fld_type = fld->type->toBasetype(); - -- if (fld_type->ty == Tsarray) -+ if (fld_type->ty == Tsarray) -+ { -+ if (d_types_compatible (exp_type, fld_type)) - { -- if (d_types_compatible (exp_type, fld_type)) -- { -- StructDeclaration *sd = needsPostblit (fld_type); -- if (sd != NULL) -- { -- // Generate _d_arrayctor (ti, from = exp, to = exp_tree) -- Type *ti = fld_type->nextOf(); -- tree args[3]; -- -- exp_tree = build_local_var (exp_type->toCtype()); -- args[0] = irs->typeinfoReference (ti); -- args[1] = irs->toDArray (exp); -- args[2] = convert_expr (exp_tree, exp_type, ti->arrayOf()); -- call_exp = build_libcall (LIBCALL_ARRAYCTOR, 3, args); -- } -- else -- { -- // %% This would call _d_newarrayT ... use memcpy? -- exp_tree = convert_expr (exp->toElem (irs), exp->type, fld->type); -- } -- } -- else -- { -- // %% Could use memset if is zero init... -- exp_tree = build_local_var (fld_type->toCtype()); -- Type *etype = fld_type; -- -- while (etype->ty == Tsarray) -- etype = etype->nextOf(); -- -- gcc_assert (fld_type->size() % etype->size() == 0); -- tree size = fold_build2 (TRUNC_DIV_EXPR, size_type_node, -- size_int (fld_type->size()), size_int (etype->size())); -- -- tree ptr_tree = build_nop (etype->pointerTo()->toCtype(), -- build_address (exp_tree)); -- tree set_exp = irs->arraySetExpr (ptr_tree, exp->toElem (irs), size); -- exp_tree = compound_expr (set_exp, exp_tree); -- } -+ // %% This would call _d_newarrayT ... use memcpy? -+ exp_tree = convert_expr (exp->toElem (irs), exp->type, fld->type); - } - else - { -- exp_tree = convert_expr (exp->toElem (irs), exp->type, fld->type); -- StructDeclaration *sd = needsPostblit (fld_type); -- if (sd && exp->isLvalue()) -- { -- // Call __postblit (&exp_tree) -- Expressions args; -- call_exp = irs->call (sd->postblit, build_address (exp_tree), &args); -- } -+ // %% Could use memset if is zero init... -+ exp_tree = build_local_temp (fld_type->toCtype()); -+ Type *etype = fld_type; -+ -+ while (etype->ty == Tsarray) -+ etype = etype->nextOf(); -+ -+ gcc_assert (fld_type->size() % etype->size() == 0); -+ tree size = fold_build2 (TRUNC_DIV_EXPR, size_type_node, -+ size_int (fld_type->size()), size_int (etype->size())); -+ -+ tree ptr_tree = build_nop (etype->pointerTo()->toCtype(), -+ build_address (exp_tree)); -+ tree set_exp = irs->doArraySet (ptr_tree, exp->toElem (irs), size); -+ exp_tree = compound_expr (set_exp, exp_tree); - } -+ } -+ else -+ exp_tree = convert_expr (exp->toElem (irs), exp->type, fld->type); - -- if (call_exp) -- irs->addExp (call_exp); -- -- CONSTRUCTOR_APPEND_ELT (ce, fld->toSymbol()->Stree, exp_tree); -+ CONSTRUCTOR_APPEND_ELT (ce, fld->toSymbol()->Stree, exp_tree); - -- // Unions only have one field that gets assigned. -- if (sd->isUnionDeclaration()) -- break; -- } -+ // Unions only have one field that gets assigned. -+ if (sd->isUnionDeclaration()) -+ break; - } - -- if (sd->isNested()) -+ if (sd->isNested() && dim != sd->fields.dim) - { - // Maybe setup hidden pointer to outer scope context. - tree vthis_field = sd->vthis->toSymbol()->Stree; -- tree vthis_value = irs->getVThis (sd, this); -+ tree vthis_value = build_vthis (sd, irs->func, this); - CONSTRUCTOR_APPEND_ELT (ce, vthis_field, vthis_value); - gcc_assert (sinit == NULL); - } - - tree ctor = build_constructor (type->toCtype(), ce); -- tree var = build_local_var (TREE_TYPE (ctor)); -+ tree var = build_local_temp (TREE_TYPE (ctor)); - tree init = NULL_TREE; - - if (fillHoles) -@@ -2347,16 +2645,17 @@ elem * - ThisExp::toElem (IRState *irs) - { - tree this_tree = NULL_TREE; -+ FuncDeclaration *fd = irs->func; - - if (var) - { - gcc_assert(var->isVarDeclaration()); -- this_tree = irs->var (var); -+ this_tree = get_decl_tree (var, fd); - } - else - { -- gcc_assert (irs->func && irs->func->vthis); -- this_tree = irs->var (irs->func->vthis); -+ gcc_assert (fd && fd->vthis); -+ this_tree = get_decl_tree (fd->vthis, fd); - } - - if (type->ty == Tstruct) -@@ -2404,3 +2703,13 @@ VectorExp::toElem (IRState *irs) - } - } - -+elem * -+ClassReferenceExp::toElem (IRState *) -+{ -+ // ClassReferenceExp builds the RECORD_TYPE, -+ // we want to return a reference to it. -+ tree exp = toSymbol()->Stree; -+ -+ return build_address (exp); -+} -+ ---- a/src/gcc/d/dfrontend/aav.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/aav.c 2014-04-01 16:32:51.000000000 +0100 -@@ -14,20 +14,17 @@ - - #include <stdio.h> - #include <string.h> -+#include <stdlib.h> - #include <assert.h> - - #include "aav.h" - --static const size_t prime_list[] = { -- 31UL, -- 97UL, 389UL, -- 1543UL, 6151UL, -- 24593UL, 98317UL, -- 393241UL, 1572869UL, -- 6291469UL, 25165843UL, -- 100663319UL, 402653189UL, -- 1610612741UL, 4294967291UL, --}; -+ -+inline size_t hash(size_t a) -+{ -+ a ^= (a >> 20) ^ (a >> 12); -+ return a ^ (a >> 7) ^ (a >> 4); -+} - - struct aaA - { -@@ -42,9 +39,9 @@ struct AA - size_t b_length; - size_t nodes; // total number of aaA nodes - aaA* binit[4]; // initial value of b[] --}; - --static const AA bbinit = { NULL, }; -+ aaA aafirst; // a lot of these AA's have only one entry -+}; - - /**************************************************** - * Determine number of entries in associative array. -@@ -67,16 +64,20 @@ Value* _aaGet(AA** paa, Key key) - - if (!*paa) - { AA *a = new AA(); -- *a = bbinit; - a->b = a->binit; - a->b_length = sizeof(a->binit) / sizeof(a->binit[0]); -+ a->nodes = 0; -+ a->binit[0] = NULL; -+ a->binit[1] = NULL; -+ a->binit[2] = NULL; -+ a->binit[3] = NULL; - *paa = a; - assert((*paa)->b_length == 4); - } - //printf("paa = %p, *paa = %p\n", paa, *paa); - - assert((*paa)->b_length); -- size_t i = (size_t)key % (*paa)->b_length; -+ size_t i = hash((size_t)key) & ((*paa)->b_length - 1); - aaA** pe = &(*paa)->b[i]; - aaA *e; - while ((e = *pe) != NULL) -@@ -88,15 +89,17 @@ Value* _aaGet(AA** paa, Key key) - - // Not found, create new elem - //printf("create new one\n"); -- e = new aaA(); -+ -+ size_t nodes = ++(*paa)->nodes; -+ e = (nodes != 1) ? new aaA() : &(*paa)->aafirst; -+ //e = new aaA(); - e->next = NULL; - e->key = key; - e->value = NULL; - *pe = e; - -- size_t nodes = ++(*paa)->nodes; -- //printf("length = %d, nodes = %d\n", paa.a.b.length, nodes); -- if (nodes > (*paa)->b_length * 4) -+ //printf("length = %d, nodes = %d\n", (*paa)->b_length, nodes); -+ if (nodes > (*paa)->b_length * 2) - { - //printf("rehash\n"); - _aaRehash(paa); -@@ -114,14 +117,11 @@ Value* _aaGet(AA** paa, Key key) - Value _aaGetRvalue(AA* aa, Key key) - { - //printf("_aaGetRvalue(key = %p)\n", key); -- if (!aa) -- return NULL; -- -- size_t len = aa->b_length; -- -- if (len) -+ if (aa) - { -- size_t i = (size_t)key % len; -+ size_t i; -+ size_t len = aa->b_length; -+ i = hash((size_t)key) & (len-1); - aaA* e = aa->b[i]; - while (e) - { -@@ -143,39 +143,33 @@ void _aaRehash(AA** paa) - //printf("Rehash\n"); - if (*paa) - { -- AA newb = bbinit; - AA *aa = *paa; -- size_t len = _aaLen(*paa); -- if (len) -- { size_t i; -- -- for (i = 0; i < sizeof(prime_list)/sizeof(prime_list[0]) - 1; i++) -- { -- if (len <= prime_list[i]) -- break; -- } -- len = prime_list[i]; -- newb.b = new aaA*[len]; -- memset(newb.b, 0, len * sizeof(aaA*)); -- newb.b_length = len; -+ if (aa) -+ { -+ size_t len = aa->b_length; -+ if (len == 4) -+ len = 32; -+ else -+ len *= 4; -+ aaA** newb = new aaA*[len]; -+ memset(newb, 0, len * sizeof(aaA*)); - - for (size_t k = 0; k < aa->b_length; k++) - { aaA *e = aa->b[k]; - while (e) - { aaA* enext = e->next; -- size_t j = (size_t)e->key % len; -- e->next = newb.b[j]; -- newb.b[j] = e; -+ size_t j = hash((size_t)e->key) & (len-1); -+ e->next = newb[j]; -+ newb[j] = e; - e = enext; - } - } - if (aa->b != aa->binit) - delete[] aa->b; - -- newb.nodes = aa->nodes; -+ aa->b = newb; -+ aa->b_length = len; - } -- -- **paa = newb; - } - } - ---- a/src/gcc/d/dfrontend/access.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/access.c 2014-04-01 16:32:51.000000000 +0100 -@@ -38,14 +38,14 @@ int hasPackageAccess(Scope *sc, Dsymbol - * Return PROT access for Dsymbol smember in this declaration. - */ - --enum PROT AggregateDeclaration::getAccess(Dsymbol *smember) -+PROT AggregateDeclaration::getAccess(Dsymbol *smember) - { - return PROTpublic; - } - --enum PROT StructDeclaration::getAccess(Dsymbol *smember) -+PROT StructDeclaration::getAccess(Dsymbol *smember) - { -- enum PROT access_ret = PROTnone; -+ PROT access_ret = PROTnone; - - #if LOG - printf("+StructDeclaration::getAccess(this = '%s', smember = '%s')\n", -@@ -62,9 +62,9 @@ enum PROT StructDeclaration::getAccess(D - return access_ret; - } - --enum PROT ClassDeclaration::getAccess(Dsymbol *smember) -+PROT ClassDeclaration::getAccess(Dsymbol *smember) - { -- enum PROT access_ret = PROTnone; -+ PROT access_ret = PROTnone; - - #if LOG - printf("+ClassDeclaration::getAccess(this = '%s', smember = '%s')\n", -@@ -84,7 +84,7 @@ enum PROT ClassDeclaration::getAccess(Ds - for (size_t i = 0; i < baseclasses->dim; i++) - { BaseClass *b = (*baseclasses)[i]; - -- enum PROT access = b->base->getAccess(smember); -+ PROT access = b->base->getAccess(smember); - switch (access) - { - case PROTnone: -@@ -152,7 +152,7 @@ static int accessCheckX( - { - for (size_t i = 0; i < cdthis->baseclasses->dim; i++) - { BaseClass *b = (*cdthis->baseclasses)[i]; -- enum PROT access = b->base->getAccess(smember); -+ PROT access = b->base->getAccess(smember); - if (access >= PROTprotected || - accessCheckX(smember, sfunc, b->base, cdscope) - ) -@@ -192,7 +192,7 @@ void AggregateDeclaration::accessCheck(L - - FuncDeclaration *f = sc->func; - AggregateDeclaration *cdscope = sc->getStructClassScope(); -- enum PROT access; -+ PROT access; - - #if LOG - printf("AggregateDeclaration::accessCheck() for %s.%s in function %s() in scope %s\n", -@@ -214,7 +214,7 @@ void AggregateDeclaration::accessCheck(L - //assert(smember->parent->isBaseOf(this, NULL)); - - if (smemberparent == this) -- { enum PROT access2 = smember->prot(); -+ { PROT access2 = smember->prot(); - - result = access2 >= PROTpublic || - hasPrivateAccess(f) || -@@ -290,25 +290,60 @@ int hasPackageAccess(Scope *sc, Dsymbol - printf("hasPackageAccess(s = '%s', sc = '%p')\n", s->toChars(), sc); - #endif - -+ Package *pkg = NULL; - for (; s; s = s->parent) - { -- if (s->isPackage() && !s->isModule()) -+ if (Module *m = s->isModule()) -+ { -+ DsymbolTable *dst = Package::resolve(m->md ? m->md->packages : NULL, NULL, NULL); -+ assert(dst); -+ Dsymbol *s2 = dst->lookup(m->ident); -+ assert(s2); -+ Package *p = s2->isPackage(); -+ if (p && p->isPkgMod == PKGmodule) -+ { -+ assert(p->mod == m); -+ pkg = p; -+ break; -+ } -+ } -+ else if ((pkg = s->isPackage()) != NULL) - break; - } - #if LOG -- if (s) -- printf("\tthis is in package '%s'\n", s->toChars()); -+ if (pkg) -+ printf("\tthis is in package '%s'\n", pkg->toChars()); - #endif - -- if (s && s == sc->module->parent) -+ if (pkg) - { -+ if (pkg == sc->module->parent) -+ { - #if LOG -- printf("\ts is in same package as sc\n"); -+ printf("\ts is in same package as sc\n"); - #endif -- return 1; -+ return 1; -+ } -+ if (pkg->isPkgMod == PKGmodule && pkg->mod == sc->module) -+ { -+#if LOG -+ printf("\ts is in same package.d module as sc\n"); -+#endif -+ return 1; -+ } -+ s = sc->module->parent; -+ for (; s; s = s->parent) -+ { -+ if (s == pkg) -+ { -+#if LOG -+ printf("\ts is in ancestor package of sc\n"); -+#endif -+ return 1; -+ } -+ } - } - -- - #if LOG - printf("\tno package access\n"); - #endif -@@ -375,6 +410,9 @@ int AggregateDeclaration::hasPrivateAcce - - void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d) - { -+ if (sc->flags & SCOPEnoaccesscheck) -+ return; -+ - #if LOG - if (e) - { printf("accessCheck(%s . %s)\n", e->toChars(), d->toChars()); -@@ -395,7 +433,8 @@ void accessCheck(Loc loc, Scope *sc, Exp - } - } - else if (e->type->ty == Tclass) -- { // Do access check -+ { -+ // Do access check - ClassDeclaration *cd = (ClassDeclaration *)(((TypeClass *)e->type)->sym); - if (e->op == TOKsuper) - { -@@ -406,7 +445,8 @@ void accessCheck(Loc loc, Scope *sc, Exp - cd->accessCheck(loc, sc, d); - } - else if (e->type->ty == Tstruct) -- { // Do access check -+ { -+ // Do access check - StructDeclaration *cd = (StructDeclaration *)(((TypeStruct *)e->type)->sym); - cd->accessCheck(loc, sc, d); - } ---- a/src/gcc/d/dfrontend/aggregate.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/aggregate.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -18,21 +18,21 @@ - #include "root.h" - - #include "dsymbol.h" -+#include "declaration.h" - --struct Identifier; --struct Type; --struct TypeFunction; --struct Expression; --struct FuncDeclaration; --struct CtorDeclaration; --struct DtorDeclaration; --struct InvariantDeclaration; --struct NewDeclaration; --struct DeleteDeclaration; --struct InterfaceDeclaration; --struct TypeInfoClassDeclaration; --struct VarDeclaration; -- -+class Identifier; -+class Type; -+class TypeFunction; -+class Expression; -+class FuncDeclaration; -+class CtorDeclaration; -+class DtorDeclaration; -+class InvariantDeclaration; -+class NewDeclaration; -+class DeleteDeclaration; -+class InterfaceDeclaration; -+class TypeInfoClassDeclaration; -+class VarDeclaration; - #ifdef IN_GCC - typedef union tree_node dt_t; - #else -@@ -46,33 +46,41 @@ enum Sizeok - SIZEOKfwd, // error in computing size of aggregate - }; - --struct AggregateDeclaration : ScopeDsymbol -+class AggregateDeclaration : public ScopeDsymbol - { -+public: - Type *type; - StorageClass storage_class; -- enum PROT protection; -+ PROT protection; - Type *handle; // 'this' type - unsigned structsize; // size of struct - unsigned alignsize; // size of struct for alignment purposes - int hasUnions; // set if aggregate has overlapping fields - VarDeclarations fields; // VarDeclaration fields -- enum Sizeok sizeok; // set when structsize contains valid data -+ Sizeok sizeok; // set when structsize contains valid data - Dsymbol *deferred; // any deferred semantic2() or semantic3() symbol - bool isdeprecated; // !=0 if deprecated - - #if DMDV2 -- bool isnested; // !=0 if is nested -+ Dsymbol *enclosing; /* !=NULL if is nested -+ * pointing to the dsymbol that directly enclosing it. -+ * 1. The function that enclosing it (nested struct and class) -+ * 2. The class that enclosing it (nested class only) -+ * 3. If enclosing aggregate is template, its enclosing dsymbol. -+ * See AggregateDeclaraton::makeNested for the details. -+ */ - VarDeclaration *vthis; // 'this' parameter if this aggregate is nested - #endif - // Special member functions -- InvariantDeclaration *inv; // invariant -+ FuncDeclarations invs; // Array of invariants -+ FuncDeclaration *inv; // invariant - NewDeclaration *aggNew; // allocator - DeleteDeclaration *aggDelete; // deallocator - - #if DMDV2 -- //CtorDeclaration *ctor; - Dsymbol *ctor; // CtorDeclaration or TemplateDeclaration -- CtorDeclaration *defaultCtor; // default constructor -+ CtorDeclaration *defaultCtor; // default constructor - should have no arguments, because -+ // it would be stored in TypeInfo_Class.defaultConstructor - Dsymbol *aliasthis; // forward unresolved lookups to aliasthis - bool noDefaultCtor; // no default construction - #endif -@@ -95,18 +103,22 @@ struct AggregateDeclaration : ScopeDsymb - Type *getType(); - int firstFieldInUnion(int indx); // first field in union that includes indx - int numFieldsInUnion(int firstIndex); // #fields in union starting at index -- int isDeprecated(); // is aggregate deprecated? -+ bool isDeprecated(); // is aggregate deprecated? - FuncDeclaration *buildDtor(Scope *sc); -- int isNested(); -- int isExport(); -+ FuncDeclaration *buildInv(Scope *sc); -+ bool isNested(); -+ void makeNested(); -+ bool isExport(); -+ void searchCtor(); - - void emitComment(Scope *sc); - void toJson(JsonOut *json); - void toDocBuffer(OutBuffer *buf, Scope *sc); - -- FuncDeclaration *hasIdentityOpAssign(Scope *sc, Dsymbol *assign); -+ FuncDeclaration *hasIdentityOpAssign(Scope *sc); -+ FuncDeclaration *hasIdentityOpEquals(Scope *sc); - -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); - - // For access checking - virtual PROT getAccess(Dsymbol *smember); // determine access to smember -@@ -114,7 +126,7 @@ struct AggregateDeclaration : ScopeDsymb - int hasPrivateAccess(Dsymbol *smember); // does smember have private access to members of this class? - void accessCheck(Loc loc, Scope *sc, Dsymbol *smember); - -- enum PROT prot(); -+ PROT prot(); - - // Back end - Symbol *stag; // tag symbol for debug data -@@ -124,8 +136,18 @@ struct AggregateDeclaration : ScopeDsymb - AggregateDeclaration *isAggregateDeclaration() { return this; } - }; - --struct StructDeclaration : AggregateDeclaration -+struct StructFlags -+{ -+ typedef unsigned Type; -+ enum Enum -+ { -+ hasPointers = 0x1, // NB: should use noPointers as in ClassFlags -+ }; -+}; -+ -+class StructDeclaration : public AggregateDeclaration - { -+public: - int zeroInit; // !=0 if initialize with 0 fill - #if DMDV2 - int hasIdentityAssign; // !=0 if has identity opAssign -@@ -135,7 +157,9 @@ struct StructDeclaration : AggregateDecl - FuncDeclaration *postblit; // aggregate postblit - - FuncDeclaration *xeq; // TypeInfo_Struct.xopEquals -+ FuncDeclaration *xcmp; // TypeInfo_Struct.xopCmp - static FuncDeclaration *xerreq; // object.xopEquals -+ static FuncDeclaration *xerrcmp; // object.xopCmp - - structalign_t alignment; // alignment applied outside of the struct - #endif -@@ -149,7 +173,7 @@ struct StructDeclaration : AggregateDecl - void semantic(Scope *sc); - Dsymbol *search(Loc, Identifier *ident, int flags); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); - const char *kind(); - void finalizeSize(Scope *sc); - bool isPOD(); -@@ -160,12 +184,11 @@ struct StructDeclaration : AggregateDecl - int needOpAssign(); - int needOpEquals(); - FuncDeclaration *buildOpAssign(Scope *sc); -- FuncDeclaration *buildOpEquals(Scope *sc); - FuncDeclaration *buildPostBlit(Scope *sc); - FuncDeclaration *buildCpCtor(Scope *sc); -- -+ FuncDeclaration *buildOpEquals(Scope *sc); - FuncDeclaration *buildXopEquals(Scope *sc); -- void makeNested(); -+ FuncDeclaration *buildXopCmp(Scope *sc); - #endif - void toDocBuffer(OutBuffer *buf, Scope *sc); - -@@ -178,8 +201,9 @@ struct StructDeclaration : AggregateDecl - StructDeclaration *isStructDeclaration() { return this; } - }; - --struct UnionDeclaration : StructDeclaration -+class UnionDeclaration : public StructDeclaration - { -+public: - UnionDeclaration(Loc loc, Identifier *id); - Dsymbol *syntaxCopy(Dsymbol *s); - const char *kind(); -@@ -190,10 +214,10 @@ struct UnionDeclaration : StructDeclarat - struct BaseClass - { - Type *type; // (before semantic processing) -- enum PROT protection; // protection for the base interface -+ PROT protection; // protection for the base interface - - ClassDeclaration *base; -- int offset; // 'this' pointer offset -+ unsigned offset; // 'this' pointer offset - FuncDeclarations vtbl; // for interfaces: Array of FuncDeclaration's - // making up the vtbl[] - -@@ -202,7 +226,7 @@ struct BaseClass - // are a copy of the InterfaceDeclaration::interfaces - - BaseClass(); -- BaseClass(Type *type, enum PROT protection); -+ BaseClass(Type *type, PROT protection); - - int fillVtbl(ClassDeclaration *cd, FuncDeclarations *vtbl, int newinstance); - void copyBaseInterfaces(BaseClasses *); -@@ -211,10 +235,26 @@ struct BaseClass - extern int CLASSINFO_SIZE; // value of ClassInfo.size - extern int CLASSINFO_SIZE_64; // value of ClassInfo.size - --struct ClassDeclaration : AggregateDeclaration -+struct ClassFlags - { -+ typedef unsigned Type; -+ enum Enum -+ { -+ isCOMclass = 0x1, -+ noPointers = 0x2, -+ hasOffTi = 0x4, -+ hasCtor = 0x8, -+ hasGetMembers = 0x10, -+ hasTypeInfo = 0x20, -+ isAbstract = 0x40, -+ isCPPclass = 0x80, -+ }; -+}; -+ -+class ClassDeclaration : public AggregateDeclaration -+{ -+public: - static ClassDeclaration *object; -- static ClassDeclaration *classinfo; - static ClassDeclaration *throwable; - static ClassDeclaration *exception; - static ClassDeclaration *errorException; -@@ -242,15 +282,17 @@ struct ClassDeclaration : AggregateDecla - TypeInfoClassDeclaration *vclassinfo; // the ClassInfo object for this ClassDeclaration - int com; // !=0 if this is a COM class (meaning - // it derives from IUnknown) -- int isscope; // !=0 if this is an auto class -- int isabstract; // !=0 if abstract class --#if DMDV1 -- bool isnested; // !=0 if is nested -- VarDeclaration *vthis; // 'this' parameter if this class is nested -+#if DMDV2 -+ int cpp; // !=0 if this is a C++ interface - #endif -+ int isscope; // !=0 if this is an auto class -+ int isabstract; // !=0 if abstract class - int inuse; // to prevent recursive attempts -+ Semantic doAncestorsSemantic; // Before searching symbol, whole ancestors should finish -+ // calling semantic() at least once, due to fill symtab -+ // and do addMember(). [== Semantic(Start,In,Done)] - -- ClassDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses); -+ ClassDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses, bool inObject = false); - Dsymbol *syntaxCopy(Dsymbol *s); - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -267,18 +309,16 @@ struct ClassDeclaration : AggregateDecla - #endif - FuncDeclaration *findFunc(Identifier *ident, TypeFunction *tf); - void interfaceSemantic(Scope *sc); --#if DMDV1 -- int isNested(); --#endif - int isCOMclass(); - virtual int isCOMinterface(); - #if DMDV2 -+ int isCPPclass(); - virtual int isCPPinterface(); - #endif -- int isAbstract(); -+ bool isAbstract(); - virtual int vtblOffset(); - const char *kind(); -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); - void toDocBuffer(OutBuffer *buf, Scope *sc); - - PROT getAccess(Dsymbol *smember); // determine access to smember -@@ -299,11 +339,9 @@ struct ClassDeclaration : AggregateDecla - ClassDeclaration *isClassDeclaration() { return (ClassDeclaration *)this; } - }; - --struct InterfaceDeclaration : ClassDeclaration -+class InterfaceDeclaration : public ClassDeclaration - { --#if DMDV2 -- int cpp; // !=0 if this is a C++ interface --#endif -+public: - InterfaceDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses); - Dsymbol *syntaxCopy(Dsymbol *s); - void semantic(Scope *sc); ---- a/src/gcc/d/dfrontend/aliasthis.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/aliasthis.c 2014-04-01 16:32:51.000000000 +0100 -@@ -36,8 +36,22 @@ Expression *resolveAliasThis(Scope *sc, - L1: - if (ad && ad->aliasthis) - { -+ bool isstatic = (e->op == TOKtype); - e = new DotIdExp(e->loc, e, ad->aliasthis->ident); - e = e->semantic(sc); -+ if (isstatic && ad->aliasthis->needThis()) -+ { -+ /* non-@property function is not called inside typeof(), -+ * so resolve it ahead. -+ */ -+ int save = sc->intypeof; -+ sc->intypeof = 1; // bypass "need this" error check -+ e = resolveProperties(sc, e); -+ sc->intypeof = save; -+ -+ e = new TypeExp(e->loc, new TypeTypeof(e->loc, e)); -+ e = e->semantic(sc); -+ } - e = resolveProperties(sc, e); - } - } -@@ -74,7 +88,7 @@ void AliasThis::semantic(Scope *sc) - assert(ad->members); - Dsymbol *s = ad->search(loc, ident, 0); - if (!s) -- { s = sc->search(loc, ident, 0); -+ { s = sc->search(loc, ident, NULL); - if (s) - ::error(loc, "%s is not a member of %s", s->toChars(), ad->toChars()); - else ---- a/src/gcc/d/dfrontend/aliasthis.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/aliasthis.h 2014-04-01 16:32:51.000000000 +0100 -@@ -22,8 +22,9 @@ - - #if DMDV2 - --struct AliasThis : Dsymbol -+class AliasThis : public Dsymbol - { -+public: - // alias Identifier this; - Identifier *ident; - ---- a/src/gcc/d/dfrontend/apply.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/apply.c 2014-04-01 16:32:51.000000000 +0100 -@@ -26,9 +26,7 @@ - * Creating an iterator for this would be much more complex. - */ - --typedef int (*fp_t)(Expression *, void *); -- --int Expression::apply(fp_t fp, void *param) -+int Expression::apply(apply_fp_t fp, void *param) - { - return (*fp)(this, param); - } -@@ -36,14 +34,9 @@ int Expression::apply(fp_t fp, void *par - /****************************** - * Perform apply() on an t if not null - */ --template<typename T> --int condApply(T* t, fp_t fp, void* param) --{ -- return t ? t->apply(fp, param) : 0; --} -+#define condApply(t, fp, param) (t ? t->apply(fp, param) : 0) - -- --int NewExp::apply(int (*fp)(Expression *, void *), void *param) -+int NewExp::apply(apply_fp_t fp, void *param) - { - //printf("NewExp::apply(): %s\n", toChars()); - -@@ -53,7 +46,7 @@ int NewExp::apply(int (*fp)(Expression * - (*fp)(this, param); - } - --int NewAnonClassExp::apply(int (*fp)(Expression *, void *), void *param) -+int NewAnonClassExp::apply(apply_fp_t fp, void *param) - { - //printf("NewAnonClassExp::apply(): %s\n", toChars()); - -@@ -63,47 +56,47 @@ int NewAnonClassExp::apply(int (*fp)(Exp - (*fp)(this, param); - } - --int UnaExp::apply(fp_t fp, void *param) -+int UnaExp::apply(apply_fp_t fp, void *param) - { - return e1->apply(fp, param) || - (*fp)(this, param); - } - --int BinExp::apply(fp_t fp, void *param) -+int BinExp::apply(apply_fp_t fp, void *param) - { - return e1->apply(fp, param) || - e2->apply(fp, param) || - (*fp)(this, param); - } - --int AssertExp::apply(fp_t fp, void *param) -+int AssertExp::apply(apply_fp_t fp, void *param) - { -- //printf("CallExp::apply(fp_t fp, void *param): %s\n", toChars()); -+ //printf("CallExp::apply(apply_fp_t fp, void *param): %s\n", toChars()); - return e1->apply(fp, param) || - condApply(msg, fp, param) || - (*fp)(this, param); - } - - --int CallExp::apply(fp_t fp, void *param) -+int CallExp::apply(apply_fp_t fp, void *param) - { -- //printf("CallExp::apply(fp_t fp, void *param): %s\n", toChars()); -+ //printf("CallExp::apply(apply_fp_t fp, void *param): %s\n", toChars()); - return e1->apply(fp, param) || - condApply(arguments, fp, param) || - (*fp)(this, param); - } - - --int ArrayExp::apply(fp_t fp, void *param) -+int ArrayExp::apply(apply_fp_t fp, void *param) - { -- //printf("ArrayExp::apply(fp_t fp, void *param): %s\n", toChars()); -+ //printf("ArrayExp::apply(apply_fp_t fp, void *param): %s\n", toChars()); - return e1->apply(fp, param) || - condApply(arguments, fp, param) || - (*fp)(this, param); - } - - --int SliceExp::apply(fp_t fp, void *param) -+int SliceExp::apply(apply_fp_t fp, void *param) - { - return e1->apply(fp, param) || - condApply(lwr, fp, param) || -@@ -112,14 +105,14 @@ int SliceExp::apply(fp_t fp, void *param - } - - --int ArrayLiteralExp::apply(fp_t fp, void *param) -+int ArrayLiteralExp::apply(apply_fp_t fp, void *param) - { - return condApply(elements, fp, param) || - (*fp)(this, param); - } - - --int AssocArrayLiteralExp::apply(fp_t fp, void *param) -+int AssocArrayLiteralExp::apply(apply_fp_t fp, void *param) - { - return condApply(keys, fp, param) || - condApply(values, fp, param) || -@@ -127,21 +120,27 @@ int AssocArrayLiteralExp::apply(fp_t fp, - } - - --int StructLiteralExp::apply(fp_t fp, void *param) -+int StructLiteralExp::apply(apply_fp_t fp, void *param) - { -- return condApply(elements, fp, param) || -+ if(stageflags & stageApply) return 0; -+ int old = stageflags; -+ stageflags |= stageApply; -+ int ret = condApply(elements, fp, param) || - (*fp)(this, param); -+ stageflags = old; -+ return ret; - } - - --int TupleExp::apply(fp_t fp, void *param) -+int TupleExp::apply(apply_fp_t fp, void *param) - { -- return condApply(exps, fp, param) || -+ return (e0 ? (*fp)(e0, param) : 0) || -+ condApply(exps, fp, param) || - (*fp)(this, param); - } - - --int CondExp::apply(fp_t fp, void *param) -+int CondExp::apply(apply_fp_t fp, void *param) - { - return econd->apply(fp, param) || - e1->apply(fp, param) || ---- a/src/gcc/d/dfrontend/argtypes.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/argtypes.c 2014-04-01 16:32:51.000000000 +0100 -@@ -26,9 +26,6 @@ - #include "aggregate.h" - #include "hdrgen.h" - --#define tfloat2 tfloat64 --//#define tfloat2 tcomplex32 -- - /**************************************************** - * This breaks a type down into 'simpler' types that can be passed to a function - * in registers, and returned in registers. -@@ -84,7 +81,7 @@ TypeTuple *TypeBasic::toArgTypes() - - case Tcomplex32: - if (global.params.is64bit) -- t1 = Type::tfloat2; -+ t1 = Type::tfloat64; - else - { - t1 = Type::tfloat64; -@@ -157,14 +154,6 @@ TypeTuple *TypeSArray::toArgTypes() - #endif - } - --TypeTuple *TypeDArray::toArgTypes() --{ -- /* Should be done as if it were: -- * struct S { size_t length; void* ptr; } -- */ -- return new TypeTuple(Type::tsize_t, Type::tvoidptr); --} -- - TypeTuple *TypeAArray::toArgTypes() - { - return new TypeTuple(Type::tvoidptr); -@@ -175,14 +164,6 @@ TypeTuple *TypePointer::toArgTypes() - return new TypeTuple(Type::tvoidptr); - } - --TypeTuple *TypeDelegate::toArgTypes() --{ -- /* Should be done as if it were: -- * struct S { void* ptr; void* funcptr; } -- */ -- return new TypeTuple(Type::tvoidptr, Type::tvoidptr); --} -- - /************************************* - * Convert a floating point type into the equivalent integral type. - */ -@@ -223,8 +204,8 @@ Type *argtypemerge(Type *t1, Type *t2, u - if (!t2) - return t1; - -- unsigned sz1 = t1->size(0); -- unsigned sz2 = t2->size(0); -+ unsigned sz1 = t1->size(Loc()); -+ unsigned sz2 = t2->size(Loc()); - - if (t1->ty != t2->ty && - (t1->ty == Tfloat80 || t2->ty == Tfloat80)) -@@ -232,7 +213,7 @@ Type *argtypemerge(Type *t1, Type *t2, u - - // [float,float] => [cfloat] - if (t1->ty == Tfloat32 && t2->ty == Tfloat32 && offset2 == 4) -- return Type::tfloat2; -+ return Type::tfloat64; - - // Merging floating and non-floating types produces the non-floating type - if (t1->isfloating()) -@@ -276,6 +257,38 @@ Type *argtypemerge(Type *t1, Type *t2, u - return t; - } - -+TypeTuple *TypeDArray::toArgTypes() -+{ -+ /* Should be done as if it were: -+ * struct S { size_t length; void* ptr; } -+ */ -+ if (global.params.is64bit && !global.params.isLP64) -+ { -+ // For AMD64 ILP32 ABI, D arrays fit into a single integer register. -+ unsigned offset = Type::tsize_t->size(Loc()); -+ Type *t = argtypemerge(Type::tsize_t, Type::tvoidptr, offset); -+ if (t) -+ return new TypeTuple(t); -+ } -+ return new TypeTuple(Type::tsize_t, Type::tvoidptr); -+} -+ -+TypeTuple *TypeDelegate::toArgTypes() -+{ -+ /* Should be done as if it were: -+ * struct S { size_t length; void* ptr; } -+ */ -+ if (global.params.is64bit && !global.params.isLP64) -+ { -+ // For AMD64 ILP32 ABI, delegates fit into a single integer register. -+ unsigned offset = Type::tsize_t->size(Loc()); -+ Type *t = argtypemerge(Type::tsize_t, Type::tvoidptr, offset); -+ if (t) -+ return new TypeTuple(t); -+ } -+ return new TypeTuple(Type::tvoidptr, Type::tvoidptr); -+} -+ - TypeTuple *TypeStruct::toArgTypes() - { - //printf("TypeStruct::toArgTypes() %s\n", toChars()); -@@ -287,7 +300,7 @@ TypeTuple *TypeStruct::toArgTypes() - } - Type *t1 = NULL; - Type *t2 = NULL; -- d_uns64 sz = size(0); -+ d_uns64 sz = size(Loc()); - assert(sz < 0xFFFFFFFF); - switch ((unsigned)sz) - { -@@ -312,8 +325,6 @@ TypeTuple *TypeStruct::toArgTypes() - if (global.params.is64bit && sym->fields.dim) - { - #if 1 -- unsigned sz1 = 0; -- unsigned sz2 = 0; - t1 = NULL; - for (size_t i = 0; i < sym->fields.dim; i++) - { VarDeclaration *f = sym->fields[i]; -@@ -349,7 +360,7 @@ TypeTuple *TypeStruct::toArgTypes() - goto Lmemory; - - // Fields that overlap the 8byte boundary goto Lmemory -- unsigned fieldsz = f->type->size(0); -+ unsigned fieldsz = f->type->size(Loc()); - if (f->offset < 8 && (f->offset + fieldsz) > 8) - goto Lmemory; - } ---- a/src/gcc/d/dfrontend/array.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/array.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,222 +0,0 @@ -- --// Copyright (c) 1999-2013 by Digital Mars --// All Rights Reserved --// written by Walter Bright --// http://www.digitalmars.com --// License for redistribution is by either the Artistic License --// in artistic.txt, or the GNU General Public License in gnu.txt. --// See the included readme.txt for details. -- --#include <stdio.h> --#include <stdlib.h> --#include <string.h> --#include <assert.h> -- --#include "port.h" --#include "root.h" --#include "rmem.h" -- -- --/********************************* Array ****************************/ -- --Array::Array() --{ -- data = SMALLARRAYCAP ? &smallarray[0] : NULL; -- dim = 0; -- allocdim = SMALLARRAYCAP; --} -- --Array::~Array() --{ -- if (data != &smallarray[0]) -- mem.free(data); --} -- --void Array::mark() --{ -- mem.mark(data); -- for (size_t u = 0; u < dim; u++) -- mem.mark(data[u]); // BUG: what if arrays of Object's? --} -- --void Array::reserve(size_t nentries) --{ -- //printf("Array::reserve: dim = %d, allocdim = %d, nentries = %d\n", (int)dim, (int)allocdim, (int)nentries); -- if (allocdim - dim < nentries) -- { -- if (allocdim == 0) -- { // Not properly initialized, someone memset it to zero -- if (nentries <= SMALLARRAYCAP) -- { allocdim = SMALLARRAYCAP; -- data = SMALLARRAYCAP ? &smallarray[0] : NULL; -- } -- else -- { allocdim = nentries; -- data = (void **)mem.malloc(allocdim * sizeof(*data)); -- } -- } -- else if (allocdim == SMALLARRAYCAP) -- { -- allocdim = dim + nentries; -- data = (void **)mem.malloc(allocdim * sizeof(*data)); -- memcpy(data, &smallarray[0], dim * sizeof(*data)); -- } -- else -- { allocdim = dim + nentries; -- data = (void **)mem.realloc(data, allocdim * sizeof(*data)); -- } -- } --} -- --void Array::setDim(size_t newdim) --{ -- if (dim < newdim) -- { -- reserve(newdim - dim); -- } -- dim = newdim; --} -- --void Array::fixDim() --{ -- if (dim != allocdim) -- { -- if (allocdim >= SMALLARRAYCAP) -- { -- if (dim <= SMALLARRAYCAP) -- { -- memcpy(&smallarray[0], data, dim * sizeof(*data)); -- mem.free(data); -- } -- else -- data = (void **)mem.realloc(data, dim * sizeof(*data)); -- } -- allocdim = dim; -- } --} -- --void Array::push(void *ptr) --{ -- reserve(1); -- data[dim++] = ptr; --} -- --void *Array::pop() --{ -- return data[--dim]; --} -- --void Array::shift(void *ptr) --{ -- reserve(1); -- memmove(data + 1, data, dim * sizeof(*data)); -- data[0] = ptr; -- dim++; --} -- --void Array::insert(size_t index, void *ptr) --{ -- reserve(1); -- memmove(data + index + 1, data + index, (dim - index) * sizeof(*data)); -- data[index] = ptr; -- dim++; --} -- -- --void Array::insert(size_t index, Array *a) --{ -- if (a) -- { -- size_t d = a->dim; -- reserve(d); -- if (dim != index) -- memmove(data + index + d, data + index, (dim - index) * sizeof(*data)); -- memcpy(data + index, a->data, d * sizeof(*data)); -- dim += d; -- } --} -- -- --/*********************************** -- * Append array a to this array. -- */ -- --void Array::append(Array *a) --{ -- insert(dim, a); --} -- --void Array::remove(size_t i) --{ -- if (dim - i - 1) -- memmove(data + i, data + i + 1, (dim - i - 1) * sizeof(data[0])); -- dim--; --} -- --char *Array::toChars() --{ -- char **buf = (char **)malloc(dim * sizeof(char *)); -- assert(buf); -- size_t len = 2; -- for (size_t u = 0; u < dim; u++) -- { -- buf[u] = ((Object *)data[u])->toChars(); -- len += strlen(buf[u]) + 1; -- } -- char *str = (char *)mem.malloc(len); -- -- str[0] = '['; -- char *p = str + 1; -- for (size_t u = 0; u < dim; u++) -- { -- if (u) -- *p++ = ','; -- len = strlen(buf[u]); -- memcpy(p,buf[u],len); -- p += len; -- } -- *p++ = ']'; -- *p = 0; -- free(buf); -- return str; --} -- --void Array::zero() --{ -- memset(data,0,dim * sizeof(data[0])); --} -- --void *Array::tos() --{ -- return dim ? data[dim - 1] : NULL; --} -- --int --#if _WIN32 -- __cdecl --#endif -- Array_sort_compare(const void *x, const void *y) --{ -- Object *ox = *(Object **)x; -- Object *oy = *(Object **)y; -- -- return ox->compare(oy); --} -- --void Array::sort() --{ -- if (dim) -- { -- qsort(data, dim, sizeof(Object *), Array_sort_compare); -- } --} -- --Array *Array::copy() --{ -- Array *a = new Array(); -- -- a->setDim(dim); -- memcpy(a->data, data, dim * sizeof(void *)); -- return a; --} -- ---- a/src/gcc/d/dfrontend/array.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/array.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,296 @@ -+ -+// Copyright (c) 1999-2011 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef ARRAY_H -+#define ARRAY_H -+ -+#if __DMC__ -+#pragma once -+#endif -+ -+#include <assert.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+ -+#include "object.h" -+#ifdef IN_GCC -+// rmem uses functions poisoned by GCC. -+void *mem_malloc(size_t size); -+void *mem_realloc(void *p, size_t size); -+void mem_free(void *p); -+#else -+#include "rmem.h" -+#endif -+ -+template <typename TYPE> -+struct Array -+{ -+ size_t dim; -+ TYPE **data; -+ -+ private: -+ size_t allocdim; -+ #define SMALLARRAYCAP 1 -+ TYPE *smallarray[SMALLARRAYCAP]; // inline storage for small arrays -+ -+ public: -+ Array() -+ { -+ data = SMALLARRAYCAP ? &smallarray[0] : NULL; -+ dim = 0; -+ allocdim = SMALLARRAYCAP; -+ } -+ -+ ~Array() -+ { -+ if (data != &smallarray[0]) -+#ifdef IN_GCC -+ mem_free(data); -+#else -+ mem.free(data); -+#endif -+ } -+ -+ char *toChars() -+ { -+#ifdef IN_GCC -+ char **buf = (char **)mem_malloc(dim * sizeof(char *)); -+#else -+ char **buf = (char **)mem.malloc(dim * sizeof(char *)); -+#endif -+ assert(buf); -+ size_t len = 2; -+ for (size_t u = 0; u < dim; u++) -+ { -+ buf[u] = ((RootObject *)data[u])->toChars(); -+ len += strlen(buf[u]) + 1; -+ } -+#ifdef IN_GCC -+ char *str = (char *)mem_malloc(len); -+#else -+ char *str = (char *)mem.malloc(len); -+#endif -+ -+ str[0] = '['; -+ char *p = str + 1; -+ for (size_t u = 0; u < dim; u++) -+ { -+ if (u) -+ *p++ = ','; -+ len = strlen(buf[u]); -+ memcpy(p,buf[u],len); -+ p += len; -+ } -+ *p++ = ']'; -+ *p = 0; -+#ifdef IN_GCC -+ mem_free(buf); -+#else -+ mem.free(buf); -+#endif -+ return str; -+ } -+ -+ void reserve(size_t nentries) -+ { -+ //printf("Array::reserve: dim = %d, allocdim = %d, nentries = %d\n", (int)dim, (int)allocdim, (int)nentries); -+ if (allocdim - dim < nentries) -+ { -+ if (allocdim == 0) -+ { // Not properly initialized, someone memset it to zero -+ if (nentries <= SMALLARRAYCAP) -+ { allocdim = SMALLARRAYCAP; -+ data = SMALLARRAYCAP ? &smallarray[0] : NULL; -+ } -+ else -+ { allocdim = nentries; -+#ifdef IN_GCC -+ data = (TYPE **)mem_malloc(allocdim * sizeof(*data)); -+#else -+ data = (TYPE **)mem.malloc(allocdim * sizeof(*data)); -+#endif -+ } -+ } -+ else if (allocdim == SMALLARRAYCAP) -+ { -+ allocdim = dim + nentries; -+#ifdef IN_GCC -+ data = (TYPE **)mem_malloc(allocdim * sizeof(*data)); -+#else -+ data = (TYPE **)mem.malloc(allocdim * sizeof(*data)); -+#endif -+ memcpy(data, &smallarray[0], dim * sizeof(*data)); -+ } -+ else -+ { allocdim = dim + nentries; -+#ifdef IN_GCC -+ data = (TYPE **)mem_realloc(data, allocdim * sizeof(*data)); -+#else -+ data = (TYPE **)mem.realloc(data, allocdim * sizeof(*data)); -+#endif -+ } -+ } -+ } -+ -+ void setDim(size_t newdim) -+ { -+ if (dim < newdim) -+ { -+ reserve(newdim - dim); -+ } -+ dim = newdim; -+ } -+ -+ void fixDim() -+ { -+ if (dim != allocdim) -+ { -+ if (allocdim >= SMALLARRAYCAP) -+ { -+ if (dim <= SMALLARRAYCAP) -+ { -+ memcpy(&smallarray[0], data, dim * sizeof(*data)); -+#ifdef IN_GCC -+ mem_free(data); -+#else -+ mem.free(data); -+#endif -+ } -+ else -+#ifdef IN_GCC -+ data = (TYPE **)mem_realloc(data, dim * sizeof(*data)); -+#else -+ data = (TYPE **)mem.realloc(data, dim * sizeof(*data)); -+#endif -+ } -+ allocdim = dim; -+ } -+ } -+ -+ TYPE *pop() -+ { -+ return data[--dim]; -+ } -+ -+ void shift(TYPE *ptr) -+ { -+ reserve(1); -+ memmove(data + 1, data, dim * sizeof(*data)); -+ data[0] = ptr; -+ dim++; -+ } -+ -+ void remove(size_t i) -+ { -+ if (dim - i - 1) -+ memmove(data + i, data + i + 1, (dim - i - 1) * sizeof(data[0])); -+ dim--; -+ } -+ -+ void zero() -+ { -+ memset(data,0,dim * sizeof(data[0])); -+ } -+ -+ TYPE *tos() -+ { -+ return dim ? data[dim - 1] : NULL; -+ } -+ -+ void sort() -+ { -+ struct ArraySort -+ { -+ static int Array_sort_compare(const void *x, const void *y) -+ { -+ RootObject *ox = *(RootObject **)const_cast<void *>(x); -+ RootObject *oy = *(RootObject **)const_cast<void *>(y); -+ -+ return ox->compare(oy); -+ } -+ }; -+ -+ if (dim) -+ { -+ qsort(data, dim, sizeof(RootObject *), &ArraySort::Array_sort_compare); -+ } -+ } -+ -+ TYPE **tdata() -+ { -+ return data; -+ } -+ -+ TYPE*& operator[] (size_t index) -+ { -+#ifdef DEBUG -+ assert(index < dim); -+#endif -+ return data[index]; -+ } -+ -+ void insert(size_t index, TYPE *v) -+ { -+ reserve(1); -+ memmove(data + index + 1, data + index, (dim - index) * sizeof(*data)); -+ data[index] = v; -+ dim++; -+ } -+ -+ void insert(size_t index, Array *a) -+ { -+ if (a) -+ { -+ size_t d = a->dim; -+ reserve(d); -+ if (dim != index) -+ memmove(data + index + d, data + index, (dim - index) * sizeof(*data)); -+ memcpy(data + index, a->data, d * sizeof(*data)); -+ dim += d; -+ } -+ } -+ -+ void append(Array *a) -+ { -+ insert(dim, a); -+ } -+ -+ void push(TYPE *a) -+ { -+ reserve(1); -+ data[dim++] = a; -+ } -+ -+ Array *copy() -+ { -+ Array *a = new Array(); -+ -+ a->setDim(dim); -+ memcpy(a->data, data, dim * sizeof(*data)); -+ return a; -+ } -+ -+ typedef int (*Array_apply_ft_t)(TYPE *, void *); -+ int apply(Array_apply_ft_t fp, void *param) -+ { -+ for (size_t i = 0; i < dim; i++) -+ { TYPE *e = (*this)[i]; -+ -+ if (e) -+ { -+ if (e->apply(fp, param)) -+ return 1; -+ } -+ } -+ return 0; -+ } -+}; -+ -+#endif ---- a/src/gcc/d/dfrontend/arrayop.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/arrayop.c 2014-04-01 16:32:51.000000000 +0100 -@@ -32,6 +32,276 @@ extern int binary(const char *p , const - - AA *arrayfuncs; - -+/************************************** -+ * Structure to contain information needed to insert an array op call -+ */ -+ -+struct ArrayOp -+{ -+ FuncDeclaration *cFunc; // Stub for optimized druntime version -+ FuncDeclaration *dFunc; // Full D version for ctfe -+}; -+ -+/************************************** -+ * Search for a druntime array op -+ */ -+int isDruntimeArrayOp(Identifier *ident) -+{ -+ /* Some of the array op functions are written as library functions, -+ * presumably to optimize them with special CPU vector instructions. -+ * List those library functions here, in alpha order. -+ */ -+ static const char *libArrayopFuncs[] = -+ { -+ "_arrayExpSliceAddass_a", -+ "_arrayExpSliceAddass_d", // T[]+=T -+ "_arrayExpSliceAddass_f", // T[]+=T -+ "_arrayExpSliceAddass_g", -+ "_arrayExpSliceAddass_h", -+ "_arrayExpSliceAddass_i", -+ "_arrayExpSliceAddass_k", -+ "_arrayExpSliceAddass_s", -+ "_arrayExpSliceAddass_t", -+ "_arrayExpSliceAddass_u", -+ "_arrayExpSliceAddass_w", -+ -+ "_arrayExpSliceDivass_d", // T[]/=T -+ "_arrayExpSliceDivass_f", // T[]/=T -+ -+ "_arrayExpSliceMinSliceAssign_a", -+ "_arrayExpSliceMinSliceAssign_d", // T[]=T-T[] -+ "_arrayExpSliceMinSliceAssign_f", // T[]=T-T[] -+ "_arrayExpSliceMinSliceAssign_g", -+ "_arrayExpSliceMinSliceAssign_h", -+ "_arrayExpSliceMinSliceAssign_i", -+ "_arrayExpSliceMinSliceAssign_k", -+ "_arrayExpSliceMinSliceAssign_s", -+ "_arrayExpSliceMinSliceAssign_t", -+ "_arrayExpSliceMinSliceAssign_u", -+ "_arrayExpSliceMinSliceAssign_w", -+ -+ "_arrayExpSliceMinass_a", -+ "_arrayExpSliceMinass_d", // T[]-=T -+ "_arrayExpSliceMinass_f", // T[]-=T -+ "_arrayExpSliceMinass_g", -+ "_arrayExpSliceMinass_h", -+ "_arrayExpSliceMinass_i", -+ "_arrayExpSliceMinass_k", -+ "_arrayExpSliceMinass_s", -+ "_arrayExpSliceMinass_t", -+ "_arrayExpSliceMinass_u", -+ "_arrayExpSliceMinass_w", -+ -+ "_arrayExpSliceMulass_d", // T[]*=T -+ "_arrayExpSliceMulass_f", // T[]*=T -+ "_arrayExpSliceMulass_i", -+ "_arrayExpSliceMulass_k", -+ "_arrayExpSliceMulass_s", -+ "_arrayExpSliceMulass_t", -+ "_arrayExpSliceMulass_u", -+ "_arrayExpSliceMulass_w", -+ -+ "_arraySliceExpAddSliceAssign_a", -+ "_arraySliceExpAddSliceAssign_d", // T[]=T[]+T -+ "_arraySliceExpAddSliceAssign_f", // T[]=T[]+T -+ "_arraySliceExpAddSliceAssign_g", -+ "_arraySliceExpAddSliceAssign_h", -+ "_arraySliceExpAddSliceAssign_i", -+ "_arraySliceExpAddSliceAssign_k", -+ "_arraySliceExpAddSliceAssign_s", -+ "_arraySliceExpAddSliceAssign_t", -+ "_arraySliceExpAddSliceAssign_u", -+ "_arraySliceExpAddSliceAssign_w", -+ -+ "_arraySliceExpDivSliceAssign_d", // T[]=T[]/T -+ "_arraySliceExpDivSliceAssign_f", // T[]=T[]/T -+ -+ "_arraySliceExpMinSliceAssign_a", -+ "_arraySliceExpMinSliceAssign_d", // T[]=T[]-T -+ "_arraySliceExpMinSliceAssign_f", // T[]=T[]-T -+ "_arraySliceExpMinSliceAssign_g", -+ "_arraySliceExpMinSliceAssign_h", -+ "_arraySliceExpMinSliceAssign_i", -+ "_arraySliceExpMinSliceAssign_k", -+ "_arraySliceExpMinSliceAssign_s", -+ "_arraySliceExpMinSliceAssign_t", -+ "_arraySliceExpMinSliceAssign_u", -+ "_arraySliceExpMinSliceAssign_w", -+ -+ "_arraySliceExpMulSliceAddass_d", // T[] += T[]*T -+ "_arraySliceExpMulSliceAddass_f", -+ "_arraySliceExpMulSliceAddass_r", -+ -+ "_arraySliceExpMulSliceAssign_d", // T[]=T[]*T -+ "_arraySliceExpMulSliceAssign_f", // T[]=T[]*T -+ "_arraySliceExpMulSliceAssign_i", -+ "_arraySliceExpMulSliceAssign_k", -+ "_arraySliceExpMulSliceAssign_s", -+ "_arraySliceExpMulSliceAssign_t", -+ "_arraySliceExpMulSliceAssign_u", -+ "_arraySliceExpMulSliceAssign_w", -+ -+ "_arraySliceExpMulSliceMinass_d", // T[] -= T[]*T -+ "_arraySliceExpMulSliceMinass_f", -+ "_arraySliceExpMulSliceMinass_r", -+ -+ "_arraySliceSliceAddSliceAssign_a", -+ "_arraySliceSliceAddSliceAssign_d", // T[]=T[]+T[] -+ "_arraySliceSliceAddSliceAssign_f", // T[]=T[]+T[] -+ "_arraySliceSliceAddSliceAssign_g", -+ "_arraySliceSliceAddSliceAssign_h", -+ "_arraySliceSliceAddSliceAssign_i", -+ "_arraySliceSliceAddSliceAssign_k", -+ "_arraySliceSliceAddSliceAssign_r", // T[]=T[]+T[] -+ "_arraySliceSliceAddSliceAssign_s", -+ "_arraySliceSliceAddSliceAssign_t", -+ "_arraySliceSliceAddSliceAssign_u", -+ "_arraySliceSliceAddSliceAssign_w", -+ -+ "_arraySliceSliceAddass_a", -+ "_arraySliceSliceAddass_d", // T[]+=T[] -+ "_arraySliceSliceAddass_f", // T[]+=T[] -+ "_arraySliceSliceAddass_g", -+ "_arraySliceSliceAddass_h", -+ "_arraySliceSliceAddass_i", -+ "_arraySliceSliceAddass_k", -+ "_arraySliceSliceAddass_s", -+ "_arraySliceSliceAddass_t", -+ "_arraySliceSliceAddass_u", -+ "_arraySliceSliceAddass_w", -+ -+ "_arraySliceSliceMinSliceAssign_a", -+ "_arraySliceSliceMinSliceAssign_d", // T[]=T[]-T[] -+ "_arraySliceSliceMinSliceAssign_f", // T[]=T[]-T[] -+ "_arraySliceSliceMinSliceAssign_g", -+ "_arraySliceSliceMinSliceAssign_h", -+ "_arraySliceSliceMinSliceAssign_i", -+ "_arraySliceSliceMinSliceAssign_k", -+ "_arraySliceSliceMinSliceAssign_r", // T[]=T[]-T[] -+ "_arraySliceSliceMinSliceAssign_s", -+ "_arraySliceSliceMinSliceAssign_t", -+ "_arraySliceSliceMinSliceAssign_u", -+ "_arraySliceSliceMinSliceAssign_w", -+ -+ "_arraySliceSliceMinass_a", -+ "_arraySliceSliceMinass_d", // T[]-=T[] -+ "_arraySliceSliceMinass_f", // T[]-=T[] -+ "_arraySliceSliceMinass_g", -+ "_arraySliceSliceMinass_h", -+ "_arraySliceSliceMinass_i", -+ "_arraySliceSliceMinass_k", -+ "_arraySliceSliceMinass_s", -+ "_arraySliceSliceMinass_t", -+ "_arraySliceSliceMinass_u", -+ "_arraySliceSliceMinass_w", -+ -+ "_arraySliceSliceMulSliceAssign_d", // T[]=T[]*T[] -+ "_arraySliceSliceMulSliceAssign_f", // T[]=T[]*T[] -+ "_arraySliceSliceMulSliceAssign_i", -+ "_arraySliceSliceMulSliceAssign_k", -+ "_arraySliceSliceMulSliceAssign_s", -+ "_arraySliceSliceMulSliceAssign_t", -+ "_arraySliceSliceMulSliceAssign_u", -+ "_arraySliceSliceMulSliceAssign_w", -+ -+ "_arraySliceSliceMulass_d", // T[]*=T[] -+ "_arraySliceSliceMulass_f", // T[]*=T[] -+ "_arraySliceSliceMulass_i", -+ "_arraySliceSliceMulass_k", -+ "_arraySliceSliceMulass_s", -+ "_arraySliceSliceMulass_t", -+ "_arraySliceSliceMulass_u", -+ "_arraySliceSliceMulass_w", -+ }; -+ char *name = ident->toChars(); -+ int i = binary(name, libArrayopFuncs, sizeof(libArrayopFuncs) / sizeof(char *)); -+ if (i != -1) -+ return 1; -+ -+#ifdef DEBUG // Make sure our array is alphabetized -+ for (i = 0; i < sizeof(libArrayopFuncs) / sizeof(char *); i++) -+ { -+ if (strcmp(name, libArrayopFuncs[i]) == 0) -+ assert(0); -+ } -+#endif -+ return 0; -+} -+ -+ArrayOp *buildArrayOp(Identifier *ident, BinExp *exp, Scope *sc, Loc loc) -+{ -+ Parameters *fparams = new Parameters(); -+ Expression *loopbody = exp->buildArrayLoop(fparams); -+ -+ ArrayOp *op = new ArrayOp; -+ if (isDruntimeArrayOp(ident)) -+ op->cFunc = FuncDeclaration::genCfunc(fparams, exp->type, ident); -+ else -+ op->cFunc = NULL; -+ -+ /* Construct the function body: -+ * foreach (i; 0 .. p.length) for (size_t i = 0; i < p.length; i++) -+ * loopbody; -+ * return p; -+ */ -+ -+ Parameter *p = (*fparams)[0 /*fparams->dim - 1*/]; -+#if DMDV1 -+ // for (size_t i = 0; i < p.length; i++) -+ Initializer *init = new ExpInitializer(0, new IntegerExp(0, 0, Type::tsize_t)); -+ Dsymbol *d = new VarDeclaration(0, Type::tsize_t, Id::p, init); -+ Statement *s1 = new ForStatement(0, -+ new ExpStatement(0, d), -+ new CmpExp(TOKlt, 0, new IdentifierExp(0, Id::p), new ArrayLengthExp(0, new IdentifierExp(0, p->ident))), -+ new PostExp(TOKplusplus, 0, new IdentifierExp(0, Id::p)), -+ new ExpStatement(0, loopbody)); -+#else -+ // foreach (i; 0 .. p.length) -+ Statement *s1 = new ForeachRangeStatement(Loc(), TOKforeach, -+ new Parameter(0, NULL, Id::p, NULL), -+ new IntegerExp(Loc(), 0, Type::tsize_t), -+ new ArrayLengthExp(Loc(), new IdentifierExp(Loc(), p->ident)), -+ new ExpStatement(Loc(), loopbody)); -+#endif -+ //printf("%s\n", s1->toChars()); -+ Statement *s2 = new ReturnStatement(Loc(), new IdentifierExp(Loc(), p->ident)); -+ //printf("s2: %s\n", s2->toChars()); -+ Statement *fbody = new CompoundStatement(Loc(), s1, s2); -+ -+ // Built-in array ops should be @trusted, pure and nothrow -+ StorageClass stc = STCtrusted | STCpure | STCnothrow; -+ -+ /* Construct the function -+ */ -+ TypeFunction *ftype = new TypeFunction(fparams, exp->type, 0, LINKc, stc); -+ //printf("ftype: %s\n", ftype->toChars()); -+ FuncDeclaration *fd = new FuncDeclaration(Loc(), Loc(), ident, STCundefined, ftype); -+ fd->fbody = fbody; -+ fd->protection = PROTpublic; -+ fd->linkage = LINKc; -+ fd->isArrayOp = 1; -+ -+ if (!op->cFunc) -+ sc->module->importedFrom->members->push(fd); -+ -+ sc = sc->push(); -+ sc->parent = sc->module->importedFrom; -+ sc->stc = 0; -+ sc->linkage = LINKc; -+ fd->semantic(sc); -+ fd->semantic2(sc); -+ fd->semantic3(sc); -+ sc->pop(); -+ -+ if (op->cFunc) -+ { -+ op->cFunc->dArrayOp = fd; -+ op->cFunc->type = fd->type; -+ } -+ op->dFunc = fd; -+ return op; -+} -+ - /********************************************** - * Check that there are no uses of arrays without []. - */ -@@ -39,6 +309,13 @@ bool isArrayOpValid(Expression *e) - { - if (e->op == TOKslice) - return true; -+ if (e->op == TOKarrayliteral) -+ { -+ Type *t = e->type->toBasetype(); -+ while (t->ty == Tarray || t->ty == Tsarray) -+ t = t->nextOf()->toBasetype(); -+ return (t->ty != Tvoid); -+ } - Type *tb = e->type->toBasetype(); - - if ( (tb->ty == Tarray) || (tb->ty == Tsarray) ) -@@ -127,268 +404,19 @@ Expression *BinExp::arrayOp(Scope *sc) - char *name = buf.toChars(); - Identifier *ident = Lexer::idPool(name); - -- /* Look up name in hash table -- */ -- FuncDeclaration **pfd = (FuncDeclaration **)_aaGet(&arrayfuncs, ident); -- FuncDeclaration *fd = (FuncDeclaration *)*pfd; -- if (!fd) -- { -- /* Some of the array op functions are written as library functions, -- * presumably to optimize them with special CPU vector instructions. -- * List those library functions here, in alpha order. -- */ -- static const char *libArrayopFuncs[] = -- { -- "_arrayExpSliceAddass_a", -- "_arrayExpSliceAddass_d", // T[]+=T -- "_arrayExpSliceAddass_f", // T[]+=T -- "_arrayExpSliceAddass_g", -- "_arrayExpSliceAddass_h", -- "_arrayExpSliceAddass_i", -- "_arrayExpSliceAddass_k", -- "_arrayExpSliceAddass_s", -- "_arrayExpSliceAddass_t", -- "_arrayExpSliceAddass_u", -- "_arrayExpSliceAddass_w", -- -- "_arrayExpSliceDivass_d", // T[]/=T -- "_arrayExpSliceDivass_f", // T[]/=T -- -- "_arrayExpSliceMinSliceAssign_a", -- "_arrayExpSliceMinSliceAssign_d", // T[]=T-T[] -- "_arrayExpSliceMinSliceAssign_f", // T[]=T-T[] -- "_arrayExpSliceMinSliceAssign_g", -- "_arrayExpSliceMinSliceAssign_h", -- "_arrayExpSliceMinSliceAssign_i", -- "_arrayExpSliceMinSliceAssign_k", -- "_arrayExpSliceMinSliceAssign_s", -- "_arrayExpSliceMinSliceAssign_t", -- "_arrayExpSliceMinSliceAssign_u", -- "_arrayExpSliceMinSliceAssign_w", -- -- "_arrayExpSliceMinass_a", -- "_arrayExpSliceMinass_d", // T[]-=T -- "_arrayExpSliceMinass_f", // T[]-=T -- "_arrayExpSliceMinass_g", -- "_arrayExpSliceMinass_h", -- "_arrayExpSliceMinass_i", -- "_arrayExpSliceMinass_k", -- "_arrayExpSliceMinass_s", -- "_arrayExpSliceMinass_t", -- "_arrayExpSliceMinass_u", -- "_arrayExpSliceMinass_w", -- -- "_arrayExpSliceMulass_d", // T[]*=T -- "_arrayExpSliceMulass_f", // T[]*=T -- "_arrayExpSliceMulass_i", -- "_arrayExpSliceMulass_k", -- "_arrayExpSliceMulass_s", -- "_arrayExpSliceMulass_t", -- "_arrayExpSliceMulass_u", -- "_arrayExpSliceMulass_w", -- -- "_arraySliceExpAddSliceAssign_a", -- "_arraySliceExpAddSliceAssign_d", // T[]=T[]+T -- "_arraySliceExpAddSliceAssign_f", // T[]=T[]+T -- "_arraySliceExpAddSliceAssign_g", -- "_arraySliceExpAddSliceAssign_h", -- "_arraySliceExpAddSliceAssign_i", -- "_arraySliceExpAddSliceAssign_k", -- "_arraySliceExpAddSliceAssign_s", -- "_arraySliceExpAddSliceAssign_t", -- "_arraySliceExpAddSliceAssign_u", -- "_arraySliceExpAddSliceAssign_w", -- -- "_arraySliceExpDivSliceAssign_d", // T[]=T[]/T -- "_arraySliceExpDivSliceAssign_f", // T[]=T[]/T -- -- "_arraySliceExpMinSliceAssign_a", -- "_arraySliceExpMinSliceAssign_d", // T[]=T[]-T -- "_arraySliceExpMinSliceAssign_f", // T[]=T[]-T -- "_arraySliceExpMinSliceAssign_g", -- "_arraySliceExpMinSliceAssign_h", -- "_arraySliceExpMinSliceAssign_i", -- "_arraySliceExpMinSliceAssign_k", -- "_arraySliceExpMinSliceAssign_s", -- "_arraySliceExpMinSliceAssign_t", -- "_arraySliceExpMinSliceAssign_u", -- "_arraySliceExpMinSliceAssign_w", -- -- "_arraySliceExpMulSliceAddass_d", // T[] += T[]*T -- "_arraySliceExpMulSliceAddass_f", -- "_arraySliceExpMulSliceAddass_r", -- -- "_arraySliceExpMulSliceAssign_d", // T[]=T[]*T -- "_arraySliceExpMulSliceAssign_f", // T[]=T[]*T -- "_arraySliceExpMulSliceAssign_i", -- "_arraySliceExpMulSliceAssign_k", -- "_arraySliceExpMulSliceAssign_s", -- "_arraySliceExpMulSliceAssign_t", -- "_arraySliceExpMulSliceAssign_u", -- "_arraySliceExpMulSliceAssign_w", -- -- "_arraySliceExpMulSliceMinass_d", // T[] -= T[]*T -- "_arraySliceExpMulSliceMinass_f", -- "_arraySliceExpMulSliceMinass_r", -- -- "_arraySliceSliceAddSliceAssign_a", -- "_arraySliceSliceAddSliceAssign_d", // T[]=T[]+T[] -- "_arraySliceSliceAddSliceAssign_f", // T[]=T[]+T[] -- "_arraySliceSliceAddSliceAssign_g", -- "_arraySliceSliceAddSliceAssign_h", -- "_arraySliceSliceAddSliceAssign_i", -- "_arraySliceSliceAddSliceAssign_k", -- "_arraySliceSliceAddSliceAssign_r", // T[]=T[]+T[] -- "_arraySliceSliceAddSliceAssign_s", -- "_arraySliceSliceAddSliceAssign_t", -- "_arraySliceSliceAddSliceAssign_u", -- "_arraySliceSliceAddSliceAssign_w", -- -- "_arraySliceSliceAddass_a", -- "_arraySliceSliceAddass_d", // T[]+=T[] -- "_arraySliceSliceAddass_f", // T[]+=T[] -- "_arraySliceSliceAddass_g", -- "_arraySliceSliceAddass_h", -- "_arraySliceSliceAddass_i", -- "_arraySliceSliceAddass_k", -- "_arraySliceSliceAddass_s", -- "_arraySliceSliceAddass_t", -- "_arraySliceSliceAddass_u", -- "_arraySliceSliceAddass_w", -- -- "_arraySliceSliceMinSliceAssign_a", -- "_arraySliceSliceMinSliceAssign_d", // T[]=T[]-T[] -- "_arraySliceSliceMinSliceAssign_f", // T[]=T[]-T[] -- "_arraySliceSliceMinSliceAssign_g", -- "_arraySliceSliceMinSliceAssign_h", -- "_arraySliceSliceMinSliceAssign_i", -- "_arraySliceSliceMinSliceAssign_k", -- "_arraySliceSliceMinSliceAssign_r", // T[]=T[]-T[] -- "_arraySliceSliceMinSliceAssign_s", -- "_arraySliceSliceMinSliceAssign_t", -- "_arraySliceSliceMinSliceAssign_u", -- "_arraySliceSliceMinSliceAssign_w", -- -- "_arraySliceSliceMinass_a", -- "_arraySliceSliceMinass_d", // T[]-=T[] -- "_arraySliceSliceMinass_f", // T[]-=T[] -- "_arraySliceSliceMinass_g", -- "_arraySliceSliceMinass_h", -- "_arraySliceSliceMinass_i", -- "_arraySliceSliceMinass_k", -- "_arraySliceSliceMinass_s", -- "_arraySliceSliceMinass_t", -- "_arraySliceSliceMinass_u", -- "_arraySliceSliceMinass_w", -- -- "_arraySliceSliceMulSliceAssign_d", // T[]=T[]*T[] -- "_arraySliceSliceMulSliceAssign_f", // T[]=T[]*T[] -- "_arraySliceSliceMulSliceAssign_i", -- "_arraySliceSliceMulSliceAssign_k", -- "_arraySliceSliceMulSliceAssign_s", -- "_arraySliceSliceMulSliceAssign_t", -- "_arraySliceSliceMulSliceAssign_u", -- "_arraySliceSliceMulSliceAssign_w", -- -- "_arraySliceSliceMulass_d", // T[]*=T[] -- "_arraySliceSliceMulass_f", // T[]*=T[] -- "_arraySliceSliceMulass_i", -- "_arraySliceSliceMulass_k", -- "_arraySliceSliceMulass_s", -- "_arraySliceSliceMulass_t", -- "_arraySliceSliceMulass_u", -- "_arraySliceSliceMulass_w", -- }; -+ ArrayOp **pOp = (ArrayOp **)_aaGet(&arrayfuncs, ident); -+ ArrayOp *op = *pOp; - -- int i = binary(name, libArrayopFuncs, sizeof(libArrayopFuncs) / sizeof(char *)); -- if (i == -1) -- { --#ifdef DEBUG // Make sure our array is alphabetized -- for (i = 0; i < sizeof(libArrayopFuncs) / sizeof(char *); i++) -- { -- if (strcmp(name, libArrayopFuncs[i]) == 0) -- assert(0); -- } --#endif -- /* Not in library, so generate it. -- * Construct the function body: -- * foreach (i; 0 .. p.length) for (size_t i = 0; i < p.length; i++) -- * loopbody; -- * return p; -- */ -- -- Parameters *fparams = new Parameters(); -- Expression *loopbody = buildArrayLoop(fparams); -- Parameter *p = (*fparams)[0 /*fparams->dim - 1*/]; --#if DMDV1 -- // for (size_t i = 0; i < p.length; i++) -- Initializer *init = new ExpInitializer(0, new IntegerExp(0, 0, Type::tsize_t)); -- Dsymbol *d = new VarDeclaration(0, Type::tsize_t, Id::p, init); -- Statement *s1 = new ForStatement(0, -- new ExpStatement(0, d), -- new CmpExp(TOKlt, 0, new IdentifierExp(0, Id::p), new ArrayLengthExp(0, new IdentifierExp(0, p->ident))), -- new PostExp(TOKplusplus, 0, new IdentifierExp(0, Id::p)), -- new ExpStatement(0, loopbody)); --#else -- // foreach (i; 0 .. p.length) -- Statement *s1 = new ForeachRangeStatement(0, TOKforeach, -- new Parameter(0, NULL, Id::p, NULL), -- new IntegerExp(0, 0, Type::tsize_t), -- new ArrayLengthExp(0, new IdentifierExp(0, p->ident)), -- new ExpStatement(0, loopbody)); --#endif -- Statement *s2 = new ReturnStatement(0, new IdentifierExp(0, p->ident)); -- //printf("s2: %s\n", s2->toChars()); -- Statement *fbody = new CompoundStatement(0, s1, s2); -- -- /* Construct the function -- */ -- TypeFunction *ftype = new TypeFunction(fparams, type, 0, LINKc); -- //printf("ftype: %s\n", ftype->toChars()); -- fd = new FuncDeclaration(loc, 0, ident, STCundefined, ftype); -- fd->fbody = fbody; -- fd->protection = PROTpublic; -- fd->linkage = LINKc; -- fd->isArrayOp = 1; -- -- sc->module->importedFrom->members->push(fd); -- -- sc = sc->push(); -- sc->parent = sc->module->importedFrom; -- sc->stc = 0; -- sc->linkage = LINKc; -- fd->semantic(sc); -- fd->semantic2(sc); -- fd->semantic3(sc); -- sc->pop(); -- } -- else -- { /* In library, refer to it. -- */ -- fd = FuncDeclaration::genCfunc(type, ident); --#ifdef IN_GCC -- /* Setup function parameters for GCC backend -- */ -- TypeFunction * tf = (TypeFunction *) fd->type; -- Parameters * targs = new Parameters; -- targs->setDim(arguments->dim); -- for (unsigned i = 0; i < arguments->dim; i++) -- { -- targs->tdata()[i] = new Parameter(STCin, -- ((*arguments)[i])->type, NULL, NULL); -- } -- tf->parameters = targs; --#endif -- } -- *pfd = fd; // cache symbol in hash table -- } -+ if (!op) -+ op = buildArrayOp(ident, this, sc, loc); - -- /* Call the function fd(arguments) -- */ -- Expression *ec = new VarExp(0, fd); -+ *pOp = op; -+ -+ FuncDeclaration *fd = op->cFunc ? op->cFunc : op->dFunc; -+ Expression *ec = new VarExp(loc, fd); - Expression *e = new CallExp(loc, ec, arguments); -- e->type = type; -- return e; -+ -+ return e->semantic(sc); - } - - Expression *BinAssignExp::arrayOp(Scope *sc) -@@ -430,6 +458,12 @@ void CastExp::buildArrayIdent(OutBuffer - Expression::buildArrayIdent(buf, arguments); - } - -+void ArrayLiteralExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) -+{ -+ buf->writestring("Slice"); -+ arguments->shift(this); -+} -+ - void SliceExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) - { - buf->writestring("Slice"); -@@ -445,30 +479,30 @@ void AssignExp::buildArrayIdent(OutBuffe - buf->writestring("Assign"); - } - --#define X(Str) \ --void Str##AssignExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) \ --{ \ -- /* Evaluate assign expressions right to left \ -- */ \ -- e2->buildArrayIdent(buf, arguments); \ -- e1->buildArrayIdent(buf, arguments); \ -- buf->writestring(#Str); \ -- buf->writestring("ass"); \ --} -- --X(Add) --X(Min) --X(Mul) --X(Div) --X(Mod) --X(Xor) --X(And) --X(Or) -+void BinAssignExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) -+{ -+ /* Evaluate assign expressions right to left -+ */ -+ e2->buildArrayIdent(buf, arguments); -+ e1->buildArrayIdent(buf, arguments); -+ const char *s; -+ switch(op) -+ { -+ case TOKaddass: s = "Addass"; break; -+ case TOKminass: s = "Subass"; break; -+ case TOKmulass: s = "Mulass"; break; -+ case TOKdivass: s = "Divass"; break; -+ case TOKmodass: s = "Modass"; break; -+ case TOKxorass: s = "Xorass"; break; -+ case TOKandass: s = "Andass"; break; -+ case TOKorass: s = "Orass"; break; - #if DMDV2 --X(Pow) -+ case TOKpowass: s = "Powass"; break; - #endif -- --#undef X -+ default: assert(0); -+ } -+ buf->writestring(s); -+} - - void NegExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) - { -@@ -482,29 +516,35 @@ void ComExp::buildArrayIdent(OutBuffer * - buf->writestring("Com"); - } - --#define X(Str) \ --void Str##Exp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) \ --{ \ -- /* Evaluate assign expressions left to right \ -- */ \ -- e1->buildArrayIdent(buf, arguments); \ -- e2->buildArrayIdent(buf, arguments); \ -- buf->writestring(#Str); \ --} -- --X(Add) --X(Min) --X(Mul) --X(Div) --X(Mod) --X(Xor) --X(And) --X(Or) -+void BinExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments) -+{ -+ /* Evaluate assign expressions left to right -+ */ -+ const char *s = NULL; -+ switch(op) -+ { -+ case TOKadd: s = "Add"; break; -+ case TOKmin: s = "Sub"; break; -+ case TOKmul: s = "Mul"; break; -+ case TOKdiv: s = "Div"; break; -+ case TOKmod: s = "Mod"; break; -+ case TOKxor: s = "Xor"; break; -+ case TOKand: s = "And"; break; -+ case TOKor: s = "Or"; break; - #if DMDV2 --X(Pow) -+ case TOKpow: s = "Pow"; break; - #endif -- --#undef X -+ default: break; -+ } -+ if (s) -+ { -+ e1->buildArrayIdent(buf, arguments); -+ e2->buildArrayIdent(buf, arguments); -+ buf->writestring(s); -+ } -+ else -+ Expression::buildArrayIdent(buf, arguments); -+} - - /****************************************** - * Construct the inner loop for the array operation function, -@@ -516,7 +556,7 @@ Expression *Expression::buildArrayLoop(P - Identifier *id = Identifier::generateId("c", fparams->dim); - Parameter *param = new Parameter(0, type, id, NULL); - fparams->shift(param); -- Expression *e = new IdentifierExp(0, id); -+ Expression *e = new IdentifierExp(Loc(), id); - return e; - } - -@@ -531,16 +571,29 @@ Expression *CastExp::buildArrayLoop(Para - return Expression::buildArrayLoop(fparams); - } - -+Expression *ArrayLiteralExp::buildArrayLoop(Parameters *fparams) -+{ -+ Identifier *id = Identifier::generateId("p", fparams->dim); -+ Parameter *param = new Parameter(STCconst, type, id, NULL); -+ fparams->shift(param); -+ Expression *e = new IdentifierExp(Loc(), id); -+ Expressions *arguments = new Expressions(); -+ Expression *index = new IdentifierExp(Loc(), Id::p); -+ arguments->push(index); -+ e = new ArrayExp(Loc(), e, arguments); -+ return e; -+} -+ - Expression *SliceExp::buildArrayLoop(Parameters *fparams) - { - Identifier *id = Identifier::generateId("p", fparams->dim); - Parameter *param = new Parameter(STCconst, type, id, NULL); - fparams->shift(param); -- Expression *e = new IdentifierExp(0, id); -+ Expression *e = new IdentifierExp(Loc(), id); - Expressions *arguments = new Expressions(); -- Expression *index = new IdentifierExp(0, Id::p); -+ Expression *index = new IdentifierExp(Loc(), Id::p); - arguments->push(index); -- e = new ArrayExp(0, e, arguments); -+ e = new ArrayExp(Loc(), e, arguments); - return e; - } - -@@ -555,81 +608,85 @@ Expression *AssignExp::buildArrayLoop(Pa - * where b is a byte fails because (c + p[i]) is an int - * which cannot be implicitly cast to byte. - */ -- ex2 = new CastExp(0, ex2, e1->type->nextOf()); -+ ex2 = new CastExp(Loc(), ex2, e1->type->nextOf()); - #endif - Expression *ex1 = e1->buildArrayLoop(fparams); - Parameter *param = (*fparams)[0]; - param->storageClass = 0; -- Expression *e = new AssignExp(0, ex1, ex2); -+ Expression *e = new AssignExp(Loc(), ex1, ex2); - return e; - } - --#define X(Str) \ --Expression *Str##AssignExp::buildArrayLoop(Parameters *fparams) \ --{ \ -- /* Evaluate assign expressions right to left \ -- */ \ -- Expression *ex2 = e2->buildArrayLoop(fparams); \ -- Expression *ex1 = e1->buildArrayLoop(fparams); \ -- Parameter *param = (*fparams)[0]; \ -- param->storageClass = 0; \ -- Expression *e = new Str##AssignExp(loc, ex1, ex2); \ -- return e; \ --} -- --X(Add) --X(Min) --X(Mul) --X(Div) --X(Mod) --X(Xor) --X(And) --X(Or) -+Expression *BinAssignExp::buildArrayLoop(Parameters *fparams) -+{ -+ /* Evaluate assign expressions right to left -+ */ -+ Expression *ex2 = e2->buildArrayLoop(fparams); -+ Expression *ex1 = e1->buildArrayLoop(fparams); -+ Parameter *param = (*fparams)[0]; -+ param->storageClass = 0; -+ Expression *e; -+ switch(op) -+ { -+ case TOKaddass: return new AddAssignExp(loc, ex1, ex2); -+ case TOKminass: return new MinAssignExp(loc, ex1, ex2); -+ case TOKmulass: return new MulAssignExp(loc, ex1, ex2); -+ case TOKdivass: return new DivAssignExp(loc, ex1, ex2); -+ case TOKmodass: return new ModAssignExp(loc, ex1, ex2); -+ case TOKxorass: return new XorAssignExp(loc, ex1, ex2); -+ case TOKandass: return new AndAssignExp(loc, ex1, ex2); -+ case TOKorass: return new OrAssignExp(loc, ex1, ex2); - #if DMDV2 --X(Pow) -+ case TOKpowass: return new PowAssignExp(loc, ex1, ex2); - #endif -- --#undef X -+ default: -+ assert(0); -+ return NULL; -+ } -+} - - Expression *NegExp::buildArrayLoop(Parameters *fparams) - { - Expression *ex1 = e1->buildArrayLoop(fparams); -- Expression *e = new NegExp(0, ex1); -+ Expression *e = new NegExp(Loc(), ex1); - return e; - } - - Expression *ComExp::buildArrayLoop(Parameters *fparams) - { - Expression *ex1 = e1->buildArrayLoop(fparams); -- Expression *e = new ComExp(0, ex1); -+ Expression *e = new ComExp(Loc(), ex1); - return e; - } - --#define X(Str) \ --Expression *Str##Exp::buildArrayLoop(Parameters *fparams) \ --{ \ -- /* Evaluate assign expressions left to right \ -- */ \ -- Expression *ex1 = e1->buildArrayLoop(fparams); \ -- Expression *ex2 = e2->buildArrayLoop(fparams); \ -- Expression *e = new Str##Exp(0, ex1, ex2); \ -- return e; \ --} -- --X(Add) --X(Min) --X(Mul) --X(Div) --X(Mod) --X(Xor) --X(And) --X(Or) -+Expression *BinExp::buildArrayLoop(Parameters *fparams) -+{ -+ switch(op) -+ { -+ case TOKadd: -+ case TOKmin: -+ case TOKmul: -+ case TOKdiv: -+ case TOKmod: -+ case TOKxor: -+ case TOKand: -+ case TOKor: - #if DMDV2 --X(Pow) -+ case TOKpow: - #endif -- --#undef X -- -+ { -+ /* Evaluate assign expressions left to right -+ */ -+ BinExp *e = (BinExp *)copy(); -+ e->e1 = e->e1->buildArrayLoop(fparams); -+ e->e2 = e->e2->buildArrayLoop(fparams); -+ e->type = NULL; -+ return e; -+ } -+ default: -+ return Expression::buildArrayLoop(fparams); -+ } -+} - - /*********************************************** - * Test if operand is a valid array op operand. -@@ -640,6 +697,13 @@ int Expression::isArrayOperand() - //printf("Expression::isArrayOperand() %s\n", toChars()); - if (op == TOKslice) - return 1; -+ if (op == TOKarrayliteral) -+ { -+ Type *t = type->toBasetype(); -+ while (t->ty == Tarray || t->ty == Tsarray) -+ t = t->nextOf()->toBasetype(); -+ return (t->ty != Tvoid); -+ } - if (type->toBasetype()->ty == Tarray) - { - switch (op) ---- a/src/gcc/d/dfrontend/arraytypes.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/arraytypes.h 2014-04-01 16:32:51.000000000 +0100 -@@ -18,66 +18,71 @@ - - #include "root.h" - --typedef ArrayBase<struct TemplateParameter> TemplateParameters; -+typedef Array<class TemplateParameter> TemplateParameters; - --typedef ArrayBase<struct Expression> Expressions; -+typedef Array<class Expression> Expressions; - --typedef ArrayBase<struct Statement> Statements; -+typedef Array<class Statement> Statements; - --typedef ArrayBase<struct BaseClass> BaseClasses; -+typedef Array<class BaseClass> BaseClasses; - --typedef ArrayBase<struct ClassDeclaration> ClassDeclarations; -+typedef Array<class ClassDeclaration> ClassDeclarations; - --typedef ArrayBase<struct Dsymbol> Dsymbols; -+typedef Array<class Dsymbol> Dsymbols; - --typedef ArrayBase<struct Object> Objects; -+typedef Array<class RootObject> Objects; - --typedef ArrayBase<struct FuncDeclaration> FuncDeclarations; -+typedef Array<class FuncDeclaration> FuncDeclarations; - --typedef ArrayBase<struct Parameter> Parameters; -+typedef Array<class Parameter> Parameters; - --typedef ArrayBase<struct Identifier> Identifiers; -+typedef Array<class Identifier> Identifiers; - --typedef ArrayBase<struct Initializer> Initializers; -+typedef Array<class Initializer> Initializers; - --typedef ArrayBase<struct VarDeclaration> VarDeclarations; -+typedef Array<class VarDeclaration> VarDeclarations; - --typedef ArrayBase<struct Type> Types; -+typedef Array<class Type> Types; - --typedef ArrayBase<struct ScopeDsymbol> ScopeDsymbols; -+typedef Array<class ScopeDsymbol> ScopeDsymbols; - --typedef ArrayBase<struct Catch> Catches; -+typedef Array<class Catch> Catches; - --typedef ArrayBase<struct StaticDtorDeclaration> StaticDtorDeclarations; -+typedef Array<class StaticDtorDeclaration> StaticDtorDeclarations; - --typedef ArrayBase<struct SharedStaticDtorDeclaration> SharedStaticDtorDeclarations; -+typedef Array<class SharedStaticDtorDeclaration> SharedStaticDtorDeclarations; - --typedef ArrayBase<struct AliasDeclaration> AliasDeclarations; -+typedef Array<class AliasDeclaration> AliasDeclarations; - --typedef ArrayBase<struct Module> Modules; -+typedef Array<class Module> Modules; - --typedef ArrayBase<struct File> Files; -+typedef Array<class File> Files; - --typedef ArrayBase<struct CaseStatement> CaseStatements; -+typedef Array<class CaseStatement> CaseStatements; - --typedef ArrayBase<struct CompoundStatement> CompoundStatements; -+typedef Array<class CompoundStatement> CompoundStatements; - --typedef ArrayBase<struct GotoCaseStatement> GotoCaseStatements; -+typedef Array<class GotoCaseStatement> GotoCaseStatements; - --typedef ArrayBase<struct ReturnStatement> ReturnStatements; -+typedef Array<class ReturnStatement> ReturnStatements; - --typedef ArrayBase<struct TemplateInstance> TemplateInstances; -+typedef Array<class TemplateInstance> TemplateInstances; - --//typedef ArrayBase<char> Strings; -+//typedef Array<char> Strings; - --typedef ArrayBase<void> Voids; -+typedef Array<void> Voids; - - #ifdef IN_GCC --typedef ArrayBase<struct Label> Blocks; -+typedef Array<struct Label> Blocks; - #else --typedef ArrayBase<struct block> Blocks; -+typedef Array<struct block> Blocks; - #endif - --typedef ArrayBase<struct Symbol> Symbols; -+typedef Array<struct Symbol> Symbols; - -+#ifdef IN_GCC -+typedef Array<union tree_node> Dts; -+#else -+typedef Array<struct dt_t> Dts; -+#endif - #endif ---- a/src/gcc/d/dfrontend/artistic.txt 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/artistic.txt 2014-04-01 16:32:51.000000000 +0100 -@@ -1,117 +1,117 @@ --
--
--
--
-- The "Artistic License"
--
-- Preamble
--
--The intent of this document is to state the conditions under which a
--Package may be copied, such that the Copyright Holder maintains some
--semblance of artistic control over the development of the package,
--while giving the users of the package the right to use and distribute
--the Package in a more-or-less customary fashion, plus the right to make
--reasonable modifications.
--
--Definitions:
--
-- "Package" refers to the collection of files distributed by the
-- Copyright Holder, and derivatives of that collection of files
-- created through textual modification.
--
-- "Standard Version" refers to such a Package if it has not been
-- modified, or has been modified in accordance with the wishes
-- of the Copyright Holder as specified below.
--
-- "Copyright Holder" is whoever is named in the copyright or
-- copyrights for the package.
--
-- "You" is you, if you're thinking about copying or distributing
-- this Package.
--
-- "Reasonable copying fee" is whatever you can justify on the
-- basis of media cost, duplication charges, time of people involved,
-- and so on. (You will not be required to justify it to the
-- Copyright Holder, but only to the computing community at large
-- as a market that must bear the fee.)
--
-- "Freely Available" means that no fee is charged for the item
-- itself, though there may be fees involved in handling the item.
-- It also means that recipients of the item may redistribute it
-- under the same conditions they received it.
--
--1. You may make and give away verbatim copies of the source form of the
--Standard Version of this Package without restriction, provided that you
--duplicate all of the original copyright notices and associated disclaimers.
--
--2. You may apply bug fixes, portability fixes and other modifications
--derived from the Public Domain or from the Copyright Holder. A Package
--modified in such a way shall still be considered the Standard Version.
--
--3. You may otherwise modify your copy of this Package in any way, provided
--that you insert a prominent notice in each changed file stating how and
--when you changed that file, and provided that you do at least ONE of the
--following:
--
-- a) place your modifications in the Public Domain or otherwise make them
-- Freely Available, such as by posting said modifications to Usenet or
-- an equivalent medium, or placing the modifications on a major archive
-- site such as uunet.uu.net, or by allowing the Copyright Holder to include
-- your modifications in the Standard Version of the Package.
--
-- b) use the modified Package only within your corporation or organization.
--
-- c) rename any non-standard executables so the names do not conflict
-- with standard executables, which must also be provided, and provide
-- a separate manual page for each non-standard executable that clearly
-- documents how it differs from the Standard Version.
--
-- d) make other distribution arrangements with the Copyright Holder.
--
--4. You may distribute the programs of this Package in object code or
--executable form, provided that you do at least ONE of the following:
--
-- a) distribute a Standard Version of the executables and library files,
-- together with instructions (in the manual page or equivalent) on where
-- to get the Standard Version.
--
-- b) accompany the distribution with the machine-readable source of
-- the Package with your modifications.
--
-- c) give non-standard executables non-standard names, and clearly
-- document the differences in manual pages (or equivalent), together
-- with instructions on where to get the Standard Version.
--
-- d) make other distribution arrangements with the Copyright Holder.
--
--5. You may charge a reasonable copying fee for any distribution of this
--Package. You may charge any fee you choose for support of this
--Package. You may not charge a fee for this Package itself. However,
--you may distribute this Package in aggregate with other (possibly
--commercial) programs as part of a larger (possibly commercial) software
--distribution provided that you do not advertise this Package as a
--product of your own. You may embed this Package's interpreter within
--an executable of yours (by linking); this shall be construed as a mere
--form of aggregation, provided that the complete Standard Version of the
--interpreter is so embedded.
--
--6. The source code and object code supplied as input to or produced as
--output from the programs of this Package do not automatically fall
--under the copyright of this Package, but belong to whoever generated
--them, and may be sold commercially, and may be aggregated with this
--Package.
--
--7. Aggregation of this Package with a commercial distribution is always
--permitted provided that the use of this Package is embedded; that is,
--when no overt attempt is made to make this Package's interfaces visible
--to the end user of the commercial distribution. Such use shall not be
--construed as a distribution of this Package.
--
--8. The name of the Copyright Holder may not be used to endorse or promote
--products derived from this software without specific prior written permission.
--
--9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
--IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
--WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
--
-- The End
-+ -+ -+ -+ -+ The "Artistic License" -+ -+ Preamble -+ -+The intent of this document is to state the conditions under which a -+Package may be copied, such that the Copyright Holder maintains some -+semblance of artistic control over the development of the package, -+while giving the users of the package the right to use and distribute -+the Package in a more-or-less customary fashion, plus the right to make -+reasonable modifications. -+ -+Definitions: -+ -+ "Package" refers to the collection of files distributed by the -+ Copyright Holder, and derivatives of that collection of files -+ created through textual modification. -+ -+ "Standard Version" refers to such a Package if it has not been -+ modified, or has been modified in accordance with the wishes -+ of the Copyright Holder as specified below. -+ -+ "Copyright Holder" is whoever is named in the copyright or -+ copyrights for the package. -+ -+ "You" is you, if you're thinking about copying or distributing -+ this Package. -+ -+ "Reasonable copying fee" is whatever you can justify on the -+ basis of media cost, duplication charges, time of people involved, -+ and so on. (You will not be required to justify it to the -+ Copyright Holder, but only to the computing community at large -+ as a market that must bear the fee.) -+ -+ "Freely Available" means that no fee is charged for the item -+ itself, though there may be fees involved in handling the item. -+ It also means that recipients of the item may redistribute it -+ under the same conditions they received it. -+ -+1. You may make and give away verbatim copies of the source form of the -+Standard Version of this Package without restriction, provided that you -+duplicate all of the original copyright notices and associated disclaimers. -+ -+2. You may apply bug fixes, portability fixes and other modifications -+derived from the Public Domain or from the Copyright Holder. A Package -+modified in such a way shall still be considered the Standard Version. -+ -+3. You may otherwise modify your copy of this Package in any way, provided -+that you insert a prominent notice in each changed file stating how and -+when you changed that file, and provided that you do at least ONE of the -+following: -+ -+ a) place your modifications in the Public Domain or otherwise make them -+ Freely Available, such as by posting said modifications to Usenet or -+ an equivalent medium, or placing the modifications on a major archive -+ site such as uunet.uu.net, or by allowing the Copyright Holder to include -+ your modifications in the Standard Version of the Package. -+ -+ b) use the modified Package only within your corporation or organization. -+ -+ c) rename any non-standard executables so the names do not conflict -+ with standard executables, which must also be provided, and provide -+ a separate manual page for each non-standard executable that clearly -+ documents how it differs from the Standard Version. -+ -+ d) make other distribution arrangements with the Copyright Holder. -+ -+4. You may distribute the programs of this Package in object code or -+executable form, provided that you do at least ONE of the following: -+ -+ a) distribute a Standard Version of the executables and library files, -+ together with instructions (in the manual page or equivalent) on where -+ to get the Standard Version. -+ -+ b) accompany the distribution with the machine-readable source of -+ the Package with your modifications. -+ -+ c) give non-standard executables non-standard names, and clearly -+ document the differences in manual pages (or equivalent), together -+ with instructions on where to get the Standard Version. -+ -+ d) make other distribution arrangements with the Copyright Holder. -+ -+5. You may charge a reasonable copying fee for any distribution of this -+Package. You may charge any fee you choose for support of this -+Package. You may not charge a fee for this Package itself. However, -+you may distribute this Package in aggregate with other (possibly -+commercial) programs as part of a larger (possibly commercial) software -+distribution provided that you do not advertise this Package as a -+product of your own. You may embed this Package's interpreter within -+an executable of yours (by linking); this shall be construed as a mere -+form of aggregation, provided that the complete Standard Version of the -+interpreter is so embedded. -+ -+6. The source code and object code supplied as input to or produced as -+output from the programs of this Package do not automatically fall -+under the copyright of this Package, but belong to whoever generated -+them, and may be sold commercially, and may be aggregated with this -+Package. -+ -+7. Aggregation of this Package with a commercial distribution is always -+permitted provided that the use of this Package is embedded; that is, -+when no overt attempt is made to make this Package's interfaces visible -+to the end user of the commercial distribution. Such use shall not be -+construed as a distribution of this Package. -+ -+8. The name of the Copyright Holder may not be used to endorse or promote -+products derived from this software without specific prior written permission. -+ -+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR -+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -+ -+ The End ---- a/src/gcc/d/dfrontend/async.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/async.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,337 +0,0 @@ -- --// Copyright (c) 2009-2012 by Digital Mars --// All Rights Reserved --// written by Walter Bright --// http://www.digitalmars.com --// License for redistribution is by either the Artistic License --// in artistic.txt, or the GNU General Public License in gnu.txt. --// See the included readme.txt for details. -- --#define _MT 1 -- --#include <stdio.h> --#include <stdlib.h> --#include <assert.h> -- --#ifndef IN_GCC -- --#if _WIN32 -- --#include <windows.h> --#include <errno.h> --#include <process.h> -- --#include "root.h" -- --static unsigned __stdcall startthread(void *p); -- --struct FileData --{ -- File *file; -- int result; -- HANDLE event; --}; -- --struct AsyncRead --{ -- static AsyncRead *create(size_t nfiles); -- void addFile(File *file); -- void start(); -- int read(size_t i); -- static void dispose(AsyncRead *); -- -- HANDLE hThread; -- -- size_t filesdim; -- size_t filesmax; -- FileData files[1]; --}; -- -- --AsyncRead *AsyncRead::create(size_t nfiles) --{ -- AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) + -- (nfiles - 1) * sizeof(FileData)); -- aw->filesmax = nfiles; -- return aw; --} -- --void AsyncRead::addFile(File *file) --{ -- //printf("addFile(file = %p)\n", file); -- //printf("filesdim = %d, filesmax = %d\n", filesdim, filesmax); -- assert(filesdim < filesmax); -- files[filesdim].file = file; -- files[filesdim].event = CreateEvent(NULL, TRUE, FALSE, NULL); -- ResetEvent(files[filesdim].event); -- filesdim++; --} -- --void AsyncRead::start() --{ -- //printf("aw->filesdim = %p %d\n", this, filesdim); -- if (filesdim) -- { -- unsigned threadaddr; -- hThread = (HANDLE) _beginthreadex(NULL, -- 0, -- &startthread, -- this, -- 0, -- (unsigned *)&threadaddr); -- -- if (hThread) -- { -- SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST); -- } -- else -- { -- assert(0); -- } -- } --} -- --int AsyncRead::read(size_t i) --{ -- FileData *f = &files[i]; -- WaitForSingleObject(f->event, INFINITE); -- Sleep(0); // give up time slice -- return f->result; --} -- --void AsyncRead::dispose(AsyncRead *aw) --{ -- free(aw); --} -- -- -- --unsigned __stdcall startthread(void *p) --{ -- AsyncRead *aw = (AsyncRead *)p; -- -- //printf("aw->filesdim = %p %d\n", aw, aw->filesdim); -- for (size_t i = 0; i < aw->filesdim; i++) -- { FileData *f = &aw->files[i]; -- -- f->result = f->file->read(); -- SetEvent(f->event); -- } -- _endthreadex(EXIT_SUCCESS); -- return EXIT_SUCCESS; // if skidding --} -- --#elif linux // Posix -- --#include <errno.h> --#include <pthread.h> --#include <time.h> -- --#include "root.h" -- --void *startthread(void *arg); -- --void err_abort(int status, const char *msg) --{ -- fprintf(stderr, "fatal error = %d, %s\n", status, msg); -- exit(EXIT_FAILURE); --} -- --struct FileData --{ -- File *file; -- int result; -- -- pthread_mutex_t mutex; -- pthread_cond_t cond; -- int value; --}; -- --struct AsyncRead --{ -- static AsyncRead *create(size_t nfiles); -- void addFile(File *file); -- void start(); -- int read(size_t i); -- static void dispose(AsyncRead *); -- -- size_t filesdim; -- size_t filesmax; -- FileData files[1]; --}; -- -- --AsyncRead *AsyncRead::create(size_t nfiles) --{ -- AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) + -- (nfiles - 1) * sizeof(FileData)); -- aw->filesmax = nfiles; -- return aw; --} -- --void AsyncRead::addFile(File *file) --{ -- //printf("addFile(file = %p)\n", file); -- //printf("filesdim = %d, filesmax = %d\n", filesdim, filesmax); -- assert(filesdim < filesmax); -- FileData *f = &files[filesdim]; -- f->file = file; -- -- int status = pthread_mutex_init(&f->mutex, NULL); -- if (status != 0) -- err_abort(status, "init mutex"); -- status = pthread_cond_init(&f->cond, NULL); -- if (status != 0) -- err_abort(status, "init cond"); -- -- filesdim++; --} -- --void AsyncRead::start() --{ -- //printf("aw->filesdim = %p %d\n", this, filesdim); -- if (filesdim) -- { -- pthread_t thread_id; -- int status = pthread_create(&thread_id, -- NULL, -- &startthread, -- this); -- if (status != 0) -- err_abort(status, "create thread"); -- } --} -- --int AsyncRead::read(size_t i) --{ -- FileData *f = &files[i]; -- -- // Wait for the event -- int status = pthread_mutex_lock(&f->mutex); -- if (status != 0) -- err_abort(status, "lock mutex"); -- while (f->value == 0) -- { -- status = pthread_cond_wait(&f->cond, &f->mutex); -- if (status != 0) -- err_abort(status, "wait on condition"); -- } -- status = pthread_mutex_unlock(&f->mutex); -- if (status != 0) -- err_abort(status, "unlock mutex"); -- -- return f->result; --} -- --void AsyncRead::dispose(AsyncRead *aw) --{ -- //printf("AsyncRead::dispose()\n"); -- for (int i = 0; i < aw->filesdim; i++) -- { -- FileData *f = &aw->files[i]; -- int status = pthread_cond_destroy(&f->cond); -- if (status != 0) -- err_abort(status, "cond destroy"); -- status = pthread_mutex_destroy(&f->mutex); -- if (status != 0) -- err_abort(status, "mutex destroy"); -- } -- free(aw); --} -- -- --void *startthread(void *p) --{ -- AsyncRead *aw = (AsyncRead *)p; -- -- //printf("startthread: aw->filesdim = %p %d\n", aw, aw->filesdim); -- size_t dim = aw->filesdim; -- for (size_t i = 0; i < dim; i++) -- { FileData *f = &aw->files[i]; -- -- f->result = f->file->read(); -- -- // Set event -- int status = pthread_mutex_lock(&f->mutex); -- if (status != 0) -- err_abort(status, "lock mutex"); -- f->value = 1; -- status = pthread_cond_signal(&f->cond); -- if (status != 0) -- err_abort(status, "signal condition"); -- status = pthread_mutex_unlock(&f->mutex); -- if (status != 0) -- err_abort(status, "unlock mutex"); -- } -- -- return NULL; // end thread --} -- --#endif -- --#else -- --#include <stdio.h> --#include <errno.h> -- --#include "root.h" -- --struct FileData --{ -- File *file; -- int result; -- //HANDLE event; --}; -- --struct AsyncRead --{ -- static AsyncRead *create(size_t nfiles); -- void addFile(File *file); -- void start(); -- int read(size_t i); -- static void dispose(AsyncRead *); -- -- //HANDLE hThread; -- -- size_t filesdim; -- size_t filesmax; -- FileData files[1]; --}; -- -- --AsyncRead *AsyncRead::create(size_t nfiles) --{ -- AsyncRead *aw = (AsyncRead *)calloc(1, sizeof(AsyncRead) + -- (nfiles - 1) * sizeof(FileData)); -- aw->filesmax = nfiles; -- return aw; --} -- --void AsyncRead::addFile(File *file) --{ -- //printf("addFile(file = %p)\n", file); -- //printf("filesdim = %d, filesmax = %d\n", filesdim, filesmax); -- assert(filesdim < filesmax); -- files[filesdim].file = file; -- //files[filesdim].event = CreateEvent(NULL, TRUE, FALSE, NULL); -- //ResetEvent(files[filesdim].event); -- filesdim++; --} -- --void AsyncRead::start() --{ --} -- --int AsyncRead::read(size_t i) --{ -- FileData *f = &files[i]; -- f->result = f->file->read(); -- return f->result; --} -- --void AsyncRead::dispose(AsyncRead *aw) --{ -- free(aw); --} -- --#endif ---- a/src/gcc/d/dfrontend/async.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/async.h 1970-01-01 01:00:00.000000000 +0100 -@@ -1,33 +0,0 @@ -- --// Copyright (c) 2009-2009 by Digital Mars --// All Rights Reserved --// written by Walter Bright --// http://www.digitalmars.com --// License for redistribution is by either the Artistic License --// in artistic.txt, or the GNU General Public License in gnu.txt. --// See the included readme.txt for details. -- --#ifndef ASYNC_H --#define ASYNC_H -- --#if __DMC__ --#pragma once --#endif -- -- --/******************* -- * Simple interface to read files asynchronously in another -- * thread. -- */ -- --struct AsyncRead --{ -- static AsyncRead *create(size_t nfiles); -- void addFile(File *file); -- void start(); -- int read(size_t i); -- static void dispose(AsyncRead *); --}; -- -- --#endif ---- a/src/gcc/d/dfrontend/attrib.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/attrib.c 2014-04-01 16:32:51.000000000 +0100 -@@ -27,6 +27,8 @@ - #include "module.h" - #include "parse.h" - #include "template.h" -+#include "hdrgen.h" -+#include "utf.h" - - - /********************************* AttribDeclaration ****************************/ -@@ -77,7 +79,7 @@ int AttribDeclaration::addMember(Scope * - } - - void AttribDeclaration::setScopeNewSc(Scope *sc, -- StorageClass stc, enum LINK linkage, enum PROT protection, int explicitProtection, -+ StorageClass stc, LINK linkage, PROT protection, int explicitProtection, - structalign_t structalign) - { - if (decl) -@@ -112,7 +114,7 @@ void AttribDeclaration::setScopeNewSc(Sc - } - - void AttribDeclaration::semanticNewSc(Scope *sc, -- StorageClass stc, enum LINK linkage, enum PROT protection, int explicitProtection, -+ StorageClass stc, LINK linkage, PROT protection, int explicitProtection, - structalign_t structalign) - { - if (decl) -@@ -202,7 +204,7 @@ void AttribDeclaration::inlineScan() - } - } - --void AttribDeclaration::addComment(unsigned char *comment) -+void AttribDeclaration::addComment(utf8_t *comment) - { - //printf("AttribDeclaration::addComment %s\n", comment); - if (comment) -@@ -257,7 +259,7 @@ void AttribDeclaration::setFieldOffset(A - } - } - --int AttribDeclaration::hasPointers() -+bool AttribDeclaration::hasPointers() - { - Dsymbols *d = include(NULL, NULL); - -@@ -267,10 +269,10 @@ int AttribDeclaration::hasPointers() - { - Dsymbol *s = (*d)[i]; - if (s->hasPointers()) -- return 1; -+ return true; - } - } -- return 0; -+ return false; - } - - bool AttribDeclaration::hasStaticCtorOrDtor() -@@ -294,7 +296,7 @@ const char *AttribDeclaration::kind() - return "attribute"; - } - --int AttribDeclaration::oneMember(Dsymbol **ps, Identifier *ident) -+bool AttribDeclaration::oneMember(Dsymbol **ps, Identifier *ident) - { - Dsymbols *d = include(NULL, NULL); - -@@ -337,6 +339,10 @@ void AttribDeclaration::toCBuffer(OutBuf - { - if (decl->dim == 0) - buf->writestring("{}"); -+ else if (hgs->hdrgen && decl->dim == 1 && (*decl)[0]->isUnitTestDeclaration()) -+ { // hack for bugzilla 8081 -+ buf->writestring("{}"); -+ } - else if (decl->dim == 1) - ((*decl)[0])->toCBuffer(buf, hgs); - else -@@ -376,10 +382,10 @@ Dsymbol *StorageClassDeclaration::syntax - return scd; - } - --int StorageClassDeclaration::oneMember(Dsymbol **ps, Identifier *ident) -+bool StorageClassDeclaration::oneMember(Dsymbol **ps, Identifier *ident) - { - -- int t = Dsymbol::oneMembers(decl, ps, ident); -+ bool t = Dsymbol::oneMembers(decl, ps, ident); - if (t && *ps) - { - /* This is to deal with the following case: -@@ -468,8 +474,8 @@ const char *StorageClassDeclaration::stc - struct SCstring - { - StorageClass stc; -- enum TOK tok; -- Identifier *id; -+ TOK tok; -+ const char *id; - }; - - static SCstring table[] = -@@ -495,13 +501,13 @@ const char *StorageClassDeclaration::stc - { STCnothrow, TOKnothrow }, - { STCpure, TOKpure }, - { STCref, TOKref }, -- { STCtls, TOKtls }, -+ { STCtls }, - { STCgshared, TOKgshared }, -- { STCproperty, TOKat, Id::property }, -- { STCsafe, TOKat, Id::safe }, -- { STCtrusted, TOKat, Id::trusted }, -- { STCsystem, TOKat, Id::system }, -- { STCdisable, TOKat, Id::disable }, -+ { STCproperty, TOKat, "property" }, -+ { STCsafe, TOKat, "safe" }, -+ { STCtrusted, TOKat, "trusted" }, -+ { STCsystem, TOKat, "system" }, -+ { STCdisable, TOKat, "disable" }, - #endif - }; - -@@ -512,12 +518,15 @@ const char *StorageClassDeclaration::stc - if (stc & tbl) - { - stc &= ~tbl; -- enum TOK tok = table[i].tok; -+ if (tbl == STCtls) // TOKtls was removed -+ return "__thread"; -+ -+ TOK tok = table[i].tok; - #if DMDV2 - if (tok == TOKat) - { - tmp[0] = '@'; -- strcpy(tmp + 1, table[i].id->toChars()); -+ strcpy(tmp + 1, table[i].id); - return tmp; - } - else -@@ -536,7 +545,7 @@ void StorageClassDeclaration::stcToCBuff - const char *p = stcToChars(tmp, stc); - if (!p) - break; -- assert(strlen(p) < sizeof(tmp)); -+ assert(strlen(p) < sizeof(tmp) / sizeof(tmp[0])); - buf->writestring(p); - buf->writeByte(' '); - } -@@ -588,7 +597,7 @@ void DeprecatedDeclaration::toCBuffer(Ou - - /********************************* LinkDeclaration ****************************/ - --LinkDeclaration::LinkDeclaration(enum LINK p, Dsymbols *decl) -+LinkDeclaration::LinkDeclaration(LINK p, Dsymbols *decl) - : AttribDeclaration(decl) - { - //printf("LinkDeclaration(linkage = %d, decl = %p)\n", p, decl); -@@ -626,7 +635,7 @@ void LinkDeclaration::semantic3(Scope *s - { - //printf("LinkDeclaration::semantic3(linkage = %d, decl = %p)\n", linkage, decl); - if (decl) -- { enum LINK linkage_save = sc->linkage; -+ { LINK linkage_save = sc->linkage; - - sc->linkage = linkage; - for (size_t i = 0; i < decl->dim; i++) -@@ -670,7 +679,7 @@ char *LinkDeclaration::toChars() - - /********************************* ProtDeclaration ****************************/ - --ProtDeclaration::ProtDeclaration(enum PROT p, Dsymbols *decl) -+ProtDeclaration::ProtDeclaration(PROT p, Dsymbols *decl) - : AttribDeclaration(decl) - { - protection = p; -@@ -725,7 +734,7 @@ void ProtDeclaration::semantic(Scope *sc - } - } - --void ProtDeclaration::protectionToCBuffer(OutBuffer *buf, enum PROT protection) -+void ProtDeclaration::protectionToCBuffer(OutBuffer *buf, PROT protection) - { - const char *p; - -@@ -790,7 +799,7 @@ void AlignDeclaration::toCBuffer(OutBuff - - /********************************* AnonDeclaration ****************************/ - --AnonDeclaration::AnonDeclaration(Loc loc, int isunion, Dsymbols *decl) -+AnonDeclaration::AnonDeclaration(Loc loc, bool isunion, Dsymbols *decl) - : AttribDeclaration(decl) - { - this->loc = loc; -@@ -956,6 +965,30 @@ void PragmaDeclaration::setScope(Scope * - { - } - -+static unsigned setMangleOverride(Dsymbol *s, char *sym) -+{ -+ AttribDeclaration *ad = s->isAttribDeclaration(); -+ -+ if (ad) -+ { -+ Dsymbols *decls = ad->include(NULL, NULL); -+ unsigned nestedCount = 0; -+ -+ if (decls && decls->dim) -+ for (size_t i = 0; i < decls->dim; ++i) -+ nestedCount += setMangleOverride((*decls)[i], sym); -+ -+ return nestedCount; -+ } -+ else if (s->isFuncDeclaration() || s->isVarDeclaration()) -+ { -+ s->isDeclaration()->mangleOverride = sym; -+ return 1; -+ } -+ else -+ return 0; -+} -+ - void PragmaDeclaration::semantic(Scope *sc) - { // Should be merged with PragmaStatement - -@@ -968,10 +1001,13 @@ void PragmaDeclaration::semantic(Scope * - { - Expression *e = (*args)[i]; - -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -- if (e->op != TOKerror && e->op != TOKtype) -- e = e->ctfeInterpret(); -+ sc = sc->endCTFE(); -+ -+ // pragma(msg) is allowed to contain types as well as expressions -+ e = ctfeInterpretForPragmaMsg(e); - if (e->op == TOKerror) - { errorSupplemental(loc, "while evaluating pragma(msg, %s)", (*args)[i]->toChars()); - return; -@@ -979,12 +1015,12 @@ void PragmaDeclaration::semantic(Scope * - StringExp *se = e->toString(); - if (se) - { -- fprintf(stdmsg, "%.*s", (int)se->len, (char *)se->string); -+ fprintf(stderr, "%.*s", (int)se->len, (char *)se->string); - } - else -- fprintf(stdmsg, "%s", e->toChars()); -+ fprintf(stderr, "%s", e->toChars()); - } -- fprintf(stdmsg, "\n"); -+ fprintf(stderr, "\n"); - } - goto Lnodecl; - } -@@ -996,8 +1032,11 @@ void PragmaDeclaration::semantic(Scope * - { - Expression *e = (*args)[0]; - -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - e = e->ctfeInterpret(); - (*args)[0] = e; - if (e->op == TOKerror) -@@ -1005,12 +1044,25 @@ void PragmaDeclaration::semantic(Scope * - StringExp *se = e->toString(); - if (!se) - error("string expected for library name, not '%s'", e->toChars()); -- else if (global.params.verbose) -+ else - { - char *name = (char *)mem.malloc(se->len + 1); - memcpy(name, se->string, se->len); - name[se->len] = 0; -- fprintf(stdmsg, "library %s\n", name); -+ if (global.params.verbose) -+ fprintf(global.stdmsg, "library %s\n", name); -+ if (global.params.moduleDeps && !global.params.moduleDepsFile) -+ { -+ OutBuffer *ob = global.params.moduleDeps; -+ Module* imod = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ ob->writestring("depsLib "); -+ ob->writestring(imod->toPrettyChars()); -+ ob->writestring(" ("); -+ escapePath(ob, imod->srcfile->toChars()); -+ ob->writestring(") : "); -+ ob->writestring((char *) name); -+ ob->writenl(); -+ } - mem.free(name); - } - } -@@ -1024,8 +1076,12 @@ void PragmaDeclaration::semantic(Scope * - else - { - Expression *e = (*args)[0]; -+ -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - e = e->ctfeInterpret(); - (*args)[0] = e; - Dsymbol *sa = getDsymbol(e); -@@ -1035,31 +1091,106 @@ void PragmaDeclaration::semantic(Scope * - goto Lnodecl; - } - #endif -+ else if (ident == Id::mangle) -+ { -+ if (!args || args->dim != 1) -+ error("string expected for mangled name"); -+ else -+ { -+ Expression *e = (*args)[0]; -+ -+ e = e->semantic(sc); -+ e = e->ctfeInterpret(); -+ (*args)[0] = e; -+ -+ if (e->op == TOKerror) -+ goto Lnodecl; -+ -+ StringExp *se = e->toString(); -+ -+ if (!se) -+ { -+ error("string expected for mangled name, not '%s'", e->toChars()); -+ return; -+ } -+ -+ if (!se->len) -+ error("zero-length string not allowed for mangled name"); -+ -+ if (se->sz != 1) -+ error("mangled name characters can only be of type char"); -+ -+#if 1 -+ /* Note: D language specification should not have any assumption about backend -+ * implementation. Ideally pragma(mangle) can accept a string of any content. -+ * -+ * Therefore, this validation is compiler implementation specific. -+ */ -+ for (size_t i = 0; i < se->len; ) -+ { -+ utf8_t *p = (utf8_t *)se->string; -+ dchar_t c = p[i]; -+ if (c < 0x80) -+ { -+ if (c >= 'A' && c <= 'Z' || -+ c >= 'a' && c <= 'z' || -+ c >= '0' && c <= '9' || -+ c != 0 && strchr("$%().:?@[]_", c)) -+ { -+ ++i; -+ continue; -+ } -+ else -+ { -+ error("char 0x%02x not allowed in mangled name", c); -+ break; -+ } -+ } -+ -+ if (const char* msg = utf_decodeChar((utf8_t *)se->string, se->len, &i, &c)) -+ { -+ error("%s", msg); -+ break; -+ } -+ -+ if (!isUniAlpha(c)) -+ { -+ error("char 0x%04x not allowed in mangled name", c); -+ break; -+ } -+ } -+#endif -+ } -+ } - else if (global.params.ignoreUnsupportedPragmas) - { - if (global.params.verbose) - { - /* Print unrecognized pragmas - */ -- fprintf(stdmsg, "pragma %s", ident->toChars()); -+ fprintf(global.stdmsg, "pragma %s", ident->toChars()); - if (args) - { - for (size_t i = 0; i < args->dim; i++) - { - Expression *e = (*args)[i]; -+ -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - e = e->ctfeInterpret(); - if (i == 0) -- printf(" ("); -+ fprintf(global.stdmsg, " ("); - else -- printf(","); -- printf("%s", e->toChars()); -+ fprintf(global.stdmsg, ","); -+ fprintf(global.stdmsg, "%s", e->toChars()); - } - if (args->dim) -- printf(")"); -+ fprintf(global.stdmsg, ")"); - } -- printf("\n"); -+ fprintf(global.stdmsg, "\n"); - } - goto Lnodecl; - } -@@ -1074,6 +1205,20 @@ Ldecl: - Dsymbol *s = (*decl)[i]; - - s->semantic(sc); -+ -+ if (ident == Id::mangle) -+ { -+ StringExp *e = (*args)[0]->toString(); -+ -+ char *name = (char *)mem.malloc(e->len + 1); -+ memcpy(name, e->string, e->len); -+ name[e->len] = 0; -+ -+ unsigned cnt = setMangleOverride(s, name); -+ -+ if (cnt > 1) -+ error("can only apply to a single declaration"); -+ } - } - } - return; -@@ -1086,10 +1231,10 @@ Lnodecl: - } - } - --int PragmaDeclaration::oneMember(Dsymbol **ps, Identifier *ident) -+bool PragmaDeclaration::oneMember(Dsymbol **ps, Identifier *ident) - { - *ps = NULL; -- return TRUE; -+ return true; - } - - const char *PragmaDeclaration::kind() -@@ -1132,7 +1277,7 @@ Dsymbol *ConditionalDeclaration::syntaxC - } - - --int ConditionalDeclaration::oneMember(Dsymbol **ps, Identifier *ident) -+bool ConditionalDeclaration::oneMember(Dsymbol **ps, Identifier *ident) - { - //printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition->inc); - if (condition->inc) -@@ -1140,8 +1285,13 @@ int ConditionalDeclaration::oneMember(Ds - Dsymbols *d = condition->include(NULL, NULL) ? decl : elsedecl; - return Dsymbol::oneMembers(d, ps, ident); - } -- *ps = NULL; -- return TRUE; -+ else -+ { -+ bool res = (Dsymbol::oneMembers( decl, ps, ident) && *ps == NULL && -+ Dsymbol::oneMembers(elsedecl, ps, ident) && *ps == NULL); -+ *ps = NULL; -+ return res; -+ } - } - - void ConditionalDeclaration::emitComment(Scope *sc) -@@ -1205,7 +1355,7 @@ void ConditionalDeclaration::importAll(S - } - } - --void ConditionalDeclaration::addComment(unsigned char *comment) -+void ConditionalDeclaration::addComment(utf8_t *comment) - { - /* Because addComment is called by the parser, if we called - * include() it would define a version before it was used. -@@ -1302,7 +1452,13 @@ Dsymbols *StaticIfDeclaration::include(S - - if (condition->inc == 0) - { -+ /* Bugzilla 10101: Condition evaluation may cause self-recursive -+ * condition evaluation. To resolve it, temporarily save sc into scope. -+ */ -+ bool x = !scope && sc; -+ if (x) scope = sc; - Dsymbols *d = ConditionalDeclaration::include(sc, sd); -+ if (x) scope = NULL; - - // Set the scopes lazily. - if (scope && d) -@@ -1411,6 +1567,9 @@ Dsymbol *CompileDeclaration::syntaxCopy( - int CompileDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) - { - //printf("CompileDeclaration::addMember(sc = %p, sd = %p, memnum = %d)\n", sc, sd, memnum); -+ if (compiled) -+ return 1; -+ - this->sd = sd; - if (memnum == 0) - { /* No members yet, so parse the mixin now -@@ -1425,8 +1584,10 @@ int CompileDeclaration::addMember(Scope - void CompileDeclaration::compileIt(Scope *sc) - { - //printf("CompileDeclaration::compileIt(loc = %d) %s\n", loc.linnum, exp->toChars()); -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); -+ sc = sc->endCTFE(); - exp = exp->ctfeInterpret(); - StringExp *se = exp->toString(); - if (!se) -@@ -1435,12 +1596,15 @@ void CompileDeclaration::compileIt(Scope - else - { - se = se->toUTF8(sc); -- Parser p(sc->module, (unsigned char *)se->string, se->len, 0); -- p.loc = loc; -+ Parser p(sc->module, (utf8_t *)se->string, se->len, 0); -+ p.scanloc = loc; - p.nextToken(); -+ unsigned errors = global.errors; - decl = p.parseDeclDefs(0); - if (p.token.value != TOKeof) - exp->error("incomplete mixin declaration (%s)", se->toChars()); -+ if (global.errors != errors) -+ decl = NULL; - } - } - -@@ -1533,8 +1697,8 @@ Expressions *UserAttributeDeclaration::c - * (do not append to left operand, as this is a copy-on-write operation) - */ - udas = new Expressions(); -- udas->push(new TupleExp(0, udas1)); -- udas->push(new TupleExp(0, udas2)); -+ udas->push(new TupleExp(Loc(), udas1)); -+ udas->push(new TupleExp(Loc(), udas2)); - } - return udas; - } -@@ -1559,8 +1723,8 @@ void UserAttributeDeclaration::setScope( - { - // Create a tuple that combines them - Expressions *exps = new Expressions(); -- exps->push(new TupleExp(0, newsc->userAttributes)); -- exps->push(new TupleExp(0, atts)); -+ exps->push(new TupleExp(Loc(), newsc->userAttributes)); -+ exps->push(new TupleExp(Loc(), atts)); - newsc->userAttributes = exps; - } - } ---- a/src/gcc/d/dfrontend/attrib.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/attrib.h 2014-04-01 16:32:51.000000000 +0100 -@@ -17,18 +17,19 @@ - - #include "dsymbol.h" - --struct Expression; --struct Statement; --struct LabelDsymbol; --struct Initializer; --struct Module; --struct Condition; -+class Expression; -+class Statement; -+class LabelDsymbol; -+class Initializer; -+class Module; -+class Condition; - struct HdrGenState; - - /**************************************************************/ - --struct AttribDeclaration : Dsymbol -+class AttribDeclaration : public Dsymbol - { -+public: - Dsymbols *decl; // array of Dsymbol's - - AttribDeclaration(Dsymbols *decl); -@@ -36,21 +37,21 @@ struct AttribDeclaration : Dsymbol - int apply(Dsymbol_apply_ft_t fp, void *param); - int addMember(Scope *sc, ScopeDsymbol *s, int memnum); - void setScopeNewSc(Scope *sc, -- StorageClass newstc, enum LINK linkage, enum PROT protection, int explictProtection, -+ StorageClass newstc, LINK linkage, PROT protection, int explictProtection, - structalign_t structalign); - void semanticNewSc(Scope *sc, -- StorageClass newstc, enum LINK linkage, enum PROT protection, int explictProtection, -+ StorageClass newstc, LINK linkage, PROT protection, int explictProtection, - structalign_t structalign); - void semantic(Scope *sc); - void semantic2(Scope *sc); - void semantic3(Scope *sc); - void inlineScan(); -- void addComment(unsigned char *comment); -+ void addComment(utf8_t *comment); - void emitComment(Scope *sc); - const char *kind(); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); -- int hasPointers(); -+ bool hasPointers(); - bool hasStaticCtorOrDtor(); - void checkCtorConstInit(); - void addLocalClass(ClassDeclarations *); -@@ -61,23 +62,25 @@ struct AttribDeclaration : Dsymbol - void toObjFile(int multiobj); // compile to .obj file - }; - --struct StorageClassDeclaration : AttribDeclaration -+class StorageClassDeclaration : public AttribDeclaration - { -+public: - StorageClass stc; - - StorageClassDeclaration(StorageClass stc, Dsymbols *decl); - Dsymbol *syntaxCopy(Dsymbol *s); - void setScope(Scope *sc); - void semantic(Scope *sc); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - static const char *stcToChars(char tmp[], StorageClass& stc); - static void stcToCBuffer(OutBuffer *buf, StorageClass stc); - }; - --struct DeprecatedDeclaration : StorageClassDeclaration -+class DeprecatedDeclaration : public StorageClassDeclaration - { -+public: - Expression *msg; - - DeprecatedDeclaration(Expression *msg, Dsymbols *decl); -@@ -86,11 +89,12 @@ struct DeprecatedDeclaration : StorageCl - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct LinkDeclaration : AttribDeclaration -+class LinkDeclaration : public AttribDeclaration - { -- enum LINK linkage; -+public: -+ LINK linkage; - -- LinkDeclaration(enum LINK p, Dsymbols *decl); -+ LinkDeclaration(LINK p, Dsymbols *decl); - Dsymbol *syntaxCopy(Dsymbol *s); - void setScope(Scope *sc); - void semantic(Scope *sc); -@@ -99,22 +103,24 @@ struct LinkDeclaration : AttribDeclarati - char *toChars(); - }; - --struct ProtDeclaration : AttribDeclaration -+class ProtDeclaration : public AttribDeclaration - { -- enum PROT protection; -+public: -+ PROT protection; - -- ProtDeclaration(enum PROT p, Dsymbols *decl); -+ ProtDeclaration(PROT p, Dsymbols *decl); - Dsymbol *syntaxCopy(Dsymbol *s); - void importAll(Scope *sc); - void setScope(Scope *sc); - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -- static void protectionToCBuffer(OutBuffer *buf, enum PROT protection); -+ static void protectionToCBuffer(OutBuffer *buf, PROT protection); - }; - --struct AlignDeclaration : AttribDeclaration -+class AlignDeclaration : public AttribDeclaration - { -+public: - unsigned salign; - - AlignDeclaration(unsigned sa, Dsymbols *decl); -@@ -124,13 +130,14 @@ struct AlignDeclaration : AttribDeclarat - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct AnonDeclaration : AttribDeclaration -+class AnonDeclaration : public AttribDeclaration - { -+public: - bool isunion; - structalign_t alignment; - int sem; // 1 if successful semantic() - -- AnonDeclaration(Loc loc, int isunion, Dsymbols *decl); -+ AnonDeclaration(Loc loc, bool isunion, Dsymbols *decl); - Dsymbol *syntaxCopy(Dsymbol *s); - void semantic(Scope *sc); - void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); -@@ -138,39 +145,42 @@ struct AnonDeclaration : AttribDeclarati - const char *kind(); - }; - --struct PragmaDeclaration : AttribDeclaration -+class PragmaDeclaration : public AttribDeclaration - { -+public: - Expressions *args; // array of Expression's - - PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Dsymbols *decl); - Dsymbol *syntaxCopy(Dsymbol *s); - void semantic(Scope *sc); - void setScope(Scope *sc); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - const char *kind(); - void toObjFile(int multiobj); // compile to .obj file - }; - --struct ConditionalDeclaration : AttribDeclaration -+class ConditionalDeclaration : public AttribDeclaration - { -+public: - Condition *condition; - Dsymbols *elsedecl; // array of Dsymbol's for else block - - ConditionalDeclaration(Condition *condition, Dsymbols *decl, Dsymbols *elsedecl); - Dsymbol *syntaxCopy(Dsymbol *s); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void emitComment(Scope *sc); - Dsymbols *include(Scope *sc, ScopeDsymbol *s); -- void addComment(unsigned char *comment); -+ void addComment(utf8_t *comment); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void toJson(JsonOut *json); - void importAll(Scope *sc); - void setScope(Scope *sc); - }; - --struct StaticIfDeclaration : ConditionalDeclaration -+class StaticIfDeclaration : public ConditionalDeclaration - { -+public: - ScopeDsymbol *sd; - int addisdone; - -@@ -186,8 +196,9 @@ struct StaticIfDeclaration : Conditional - - // Mixin declarations - --struct CompileDeclaration : AttribDeclaration -+class CompileDeclaration : public AttribDeclaration - { -+public: - Expression *exp; - - ScopeDsymbol *sd; -@@ -206,8 +217,9 @@ struct CompileDeclaration : AttribDeclar - * User defined attributes look like: - * [ args, ... ] - */ --struct UserAttributeDeclaration : AttribDeclaration -+class UserAttributeDeclaration : public AttribDeclaration - { -+public: - Expressions *atts; - - UserAttributeDeclaration(Expressions *atts, Dsymbols *decl); ---- a/src/gcc/d/dfrontend/builtin.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/builtin.c 2014-04-01 16:32:51.000000000 +0100 -@@ -30,7 +30,7 @@ - * Determine if function is a builtin one that we can - * evaluate at compile time. - */ --enum BUILTIN FuncDeclaration::isBuiltin() -+BUILTIN FuncDeclaration::isBuiltin() - { - static const char FeZe [] = "FNaNbNfeZe"; // @safe pure nothrow real function(real) - static const char FeZe2[] = "FNaNbNeeZe"; // @trusted pure nothrow real function(real) -@@ -165,7 +165,7 @@ uinteger_t eval_bswap(Expression *arg0) - * Return result; NULL if cannot evaluate it. - */ - --Expression *eval_builtin(Loc loc, enum BUILTIN builtin, Expressions *arguments) -+Expression *eval_builtin(Loc loc, BUILTIN builtin, Expressions *arguments) - { - assert(arguments && arguments->dim); - Expression *arg0 = (*arguments)[0]; -@@ -174,27 +174,27 @@ Expression *eval_builtin(Loc loc, enum B - { - case BUILTINsin: - if (arg0->op == TOKfloat64) -- e = new RealExp(0, sinl(arg0->toReal()), arg0->type); -+ e = new RealExp(Loc(), sinl(arg0->toReal()), arg0->type); - break; - - case BUILTINcos: - if (arg0->op == TOKfloat64) -- e = new RealExp(0, cosl(arg0->toReal()), arg0->type); -+ e = new RealExp(Loc(), cosl(arg0->toReal()), arg0->type); - break; - - case BUILTINtan: - if (arg0->op == TOKfloat64) -- e = new RealExp(0, tanl(arg0->toReal()), arg0->type); -+ e = new RealExp(Loc(), tanl(arg0->toReal()), arg0->type); - break; - - case BUILTINsqrt: - if (arg0->op == TOKfloat64) -- e = new RealExp(0, sqrtl(arg0->toReal()), arg0->type); -+ e = new RealExp(Loc(), sqrtl(arg0->toReal()), arg0->type); - break; - - case BUILTINfabs: - if (arg0->op == TOKfloat64) -- e = new RealExp(0, fabsl(arg0->toReal()), arg0->type); -+ e = new RealExp(Loc(), fabsl(arg0->toReal()), arg0->type); - break; - // These math intrinsics are not yet implemented - case BUILTINatan2: ---- a/src/gcc/d/dfrontend/canthrow.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/canthrow.c 2014-04-01 16:32:51.000000000 +0100 -@@ -56,14 +56,15 @@ int lambdaCanThrow(Expression *e, void * - switch (e->op) - { - case TOKdeclaration: -- { DeclarationExp *de = (DeclarationExp *)e; -+ { -+ DeclarationExp *de = (DeclarationExp *)e; - pct->can = Dsymbol_canThrow(de->declaration, pct->mustnot); - break; - } - - case TOKcall: -- { CallExp *ce = (CallExp *)e; -- -+ { -+ CallExp *ce = (CallExp *)e; - if (global.errors && !ce->e1->type) - break; // error recovery - -@@ -79,14 +80,15 @@ int lambdaCanThrow(Expression *e, void * - else - { - if (pct->mustnot) -- e->error("%s is not nothrow", ce->e1->toChars()); -+ e->error("'%s' is not nothrow", ce->f ? ce->f->toPrettyChars() : ce->e1->toChars()); - pct->can = TRUE; - } - break; - } - - case TOKnew: -- { NewExp *ne = (NewExp *)e; -+ { -+ NewExp *ne = (NewExp *)e; - if (ne->member) - { - // See if constructor call can throw -@@ -102,6 +104,33 @@ int lambdaCanThrow(Expression *e, void * - break; - } - -+ case TOKassign: -+ case TOKconstruct: -+ { -+ /* Element-wise assignment could invoke postblits. -+ */ -+ AssignExp *ae = (AssignExp *)e; -+ if (ae->e1->op != TOKslice) -+ break; -+ -+ Type *tv = ae->e1->type->toBasetype()->nextOf()->baseElemOf(); -+ if (tv->ty != Tstruct) -+ break; -+ StructDeclaration *sd = ((TypeStruct *)tv)->sym; -+ if (!sd->postblit || sd->postblit->type->ty != Tfunction) -+ break; -+ -+ if (((TypeFunction *)sd->postblit->type)->isnothrow) -+ ; -+ else -+ { -+ if (pct->mustnot) -+ e->error("'%s' is not nothrow", sd->postblit->toPrettyChars()); -+ pct->can = TRUE; -+ } -+ break; -+ } -+ - case TOKnewanonclass: - assert(0); // should have been lowered by semantic() - break; -@@ -175,7 +204,7 @@ int Dsymbol_canThrow(Dsymbol *s, bool mu - else if ((td = s->isTupleDeclaration()) != NULL) - { - for (size_t i = 0; i < td->objects->dim; i++) -- { Object *o = (*td->objects)[i]; -+ { RootObject *o = (*td->objects)[i]; - if (o->dyncast() == DYNCAST_EXPRESSION) - { Expression *eo = (Expression *)o; - if (eo->op == TOKdsymbol) ---- a/src/gcc/d/dfrontend/cast.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/cast.c 2014-04-01 16:32:51.000000000 +0100 -@@ -20,6 +20,7 @@ - #include "aggregate.h" - #include "template.h" - #include "scope.h" -+#include "id.h" - - //#define DUMP .dump(__PRETTY_FUNCTION__, this) - #define DUMP -@@ -162,7 +163,7 @@ MATCH Expression::implicitConvTo(Type *t - type = Type::terror; - } - Expression *e = optimize(WANTvalue | WANTflags); -- if (e->type == t) -+ if (e->type->equals(t)) - return MATCHexact; - if (e != this) - { //printf("\toptimized to %s of type %s\n", e->toChars(), e->type->toChars()); -@@ -280,7 +281,11 @@ MATCH IntegerExp::implicitConvTo(Type *t - goto Lyes; - - case Tint8: -- if ((signed char)value != value) -+ if (ty == Tuns64 && value & ~0x7FUL) -+ goto Lno; -+ //else if (ty == Tint64 && 0x7FUL < value && value < ~0x7FUL) -+ // goto Lno; -+ else if ((signed char)value != value) - goto Lno; - goto Lyes; - -@@ -294,7 +299,11 @@ MATCH IntegerExp::implicitConvTo(Type *t - goto Lyes; - - case Tint16: -- if ((short)value != value) -+ if (ty == Tuns64 && value & ~0x7FFFUL) -+ goto Lno; -+ //else if (ty == Tint64 && 0x7FFFUL < value && value < ~0x7FFFUL) -+ // goto Lno; -+ else if ((short)value != value) - goto Lno; - goto Lyes; - -@@ -310,6 +319,10 @@ MATCH IntegerExp::implicitConvTo(Type *t - if (ty == Tuns32) - { - } -+ else if (ty == Tuns64 && value & ~0x7FFFFFFFUL) -+ goto Lno; -+ //else if (ty == Tint64 && 0x7FFFFFFFUL < value && value < ~0x7FFFFFFFUL) -+ // goto Lno; - else if ((int)value != value) - goto Lno; - goto Lyes; -@@ -327,27 +340,6 @@ MATCH IntegerExp::implicitConvTo(Type *t - goto Lno; - goto Lyes; - --#ifdef IN_GCC -- case Tfloat32: -- case Tfloat64: -- case Tfloat80: -- { -- real_t f; -- if (type->isunsigned()) -- { -- f = real_t((d_uns64) value); -- if ((d_uns64) f.toInt() != (d_uns64) value) -- goto Lno; -- } -- else -- { -- f = real_t((d_int64) value); -- if ((d_int64) f.toInt() != (d_int64) value) -- goto Lno; -- } -- goto Lyes; -- } --#else - case Tfloat32: - { - volatile float f; -@@ -359,8 +351,8 @@ MATCH IntegerExp::implicitConvTo(Type *t - } - else - { -- f = (float)(long long)value; -- if (f != (long long)value) -+ f = (float)(sinteger_t)value; -+ if (f != (sinteger_t)value) - goto Lno; - } - goto Lyes; -@@ -377,8 +369,8 @@ MATCH IntegerExp::implicitConvTo(Type *t - } - else - { -- f = (double)(long long)value; -- if (f != (long long)value) -+ f = (double)(sinteger_t)value; -+ if (f != (sinteger_t)value) - goto Lno; - } - goto Lyes; -@@ -395,13 +387,13 @@ MATCH IntegerExp::implicitConvTo(Type *t - } - else - { -- f = ldouble((long long)value); -- if (f != (long long)value) -+ f = ldouble((sinteger_t)value); -+ if (f != (sinteger_t)value) - goto Lno; - } - goto Lyes; - } --#endif -+ - case Tpointer: - //printf("type = %s\n", type->toBasetype()->toChars()); - //printf("t = %s\n", t->toBasetype()->toChars()); -@@ -426,6 +418,11 @@ Lno: - return MATCHnomatch; - } - -+MATCH ErrorExp::implicitConvTo(Type *t) -+{ -+ return MATCHnomatch; -+} -+ - MATCH NullExp::implicitConvTo(Type *t) - { - #if 0 -@@ -439,7 +436,7 @@ MATCH NullExp::implicitConvTo(Type *t) - * and mutable to immutable. It works because, after all, a null - * doesn't actually point to anything. - */ -- if (t->invariantOf()->equals(type->invariantOf())) -+ if (t->immutableOf()->equals(type->immutableOf())) - return MATCHconst; - - return Expression::implicitConvTo(t); -@@ -460,9 +457,12 @@ MATCH StructLiteralExp::implicitConvTo(T - { - m = MATCHconst; - for (size_t i = 0; i < elements->dim; i++) -- { Expression *e = (*elements)[i]; -+ { -+ Expression *e = (*elements)[i]; -+ if (!e) -+ continue; - Type *te = e->type; -- te = te->castMod(t->mod); -+ te = sd->fields[i]->type->addMod(t->mod); - MATCH m2 = e->implicitConvTo(te); - //printf("\t%s => %s, match = %d\n", e->toChars(), te->toChars(), m2); - if (m2 < m) -@@ -659,8 +659,35 @@ MATCH CallExp::implicitConvTo(Type *t) - /* Allow the result of strongly pure functions to - * convert to immutable - */ -- if (f && f->isPure() == PUREstrong && !f->type->hasWild()) -- return type->invariantOf()->implicitConvTo(t); -+ if (f && f->isolateReturn()) -+ return type->immutableOf()->implicitConvTo(t); -+ -+ /* The result of arr.dup and arr.idup can be unique essentially. -+ * So deal with this case specially. -+ */ -+ if (!f && e1->op == TOKvar && ((VarExp *)e1)->var->ident == Id::adDup && -+ t->toBasetype()->ty == Tarray) -+ { -+ assert(type->toBasetype()->ty == Tarray); -+ assert(arguments->dim == 2); -+ Expression *eorg = (*arguments)[1]; -+ Type *tn = t->nextOf(); -+ if (type->nextOf()->implicitConvTo(tn) < MATCHconst) -+ { -+ /* If the operand is an unique array literal, then allow conversion. -+ */ -+ if (eorg->op != TOKarrayliteral) -+ return MATCHnomatch; -+ Expressions *elements = ((ArrayLiteralExp *)eorg)->elements; -+ for (size_t i = 0; i < elements->dim; i++) -+ { -+ if (!(*elements)[i]->implicitConvTo(tn)) -+ return MATCHnomatch; -+ } -+ } -+ m = type->immutableOf()->implicitConvTo(t); -+ return m; -+ } - - return MATCHnomatch; - } -@@ -990,10 +1017,43 @@ MATCH NewExp::implicitConvTo(Type *t) - return MATCHnomatch; - } - -+Type *SliceExp::toStaticArrayType() -+{ -+ if (lwr && upr) -+ { -+ Expression *lwr = this->lwr->optimize(WANTvalue); -+ Expression *upr = this->upr->optimize(WANTvalue); -+ if (lwr->isConst() && upr->isConst()) -+ { -+ size_t len = upr->toUInteger() - lwr->toUInteger(); -+ return TypeSArray::makeType(loc, type->toBasetype()->nextOf(), len); -+ } -+ } -+ return NULL; -+} -+ -+MATCH SliceExp::implicitConvTo(Type *t) -+{ -+ MATCH result = Expression::implicitConvTo(t); -+ -+ Type *tb = t->toBasetype(); -+ Type *typeb = type->toBasetype(); -+ if (result == MATCHnomatch && -+ tb->ty == Tsarray && typeb->ty == Tarray && -+ lwr && upr) -+ { -+ typeb = toStaticArrayType(); -+ if (typeb) -+ result = typeb->implicitConvTo(t); -+ } -+ return result; -+} -+ - /* ==================== castTo ====================== */ - - /************************************** - * Do an explicit cast. -+ * Assume that the 'this' expression does not have any indirections. - */ - - Expression *Expression::castTo(Scope *sc, Type *t) -@@ -1003,12 +1063,21 @@ Expression *Expression::castTo(Scope *sc - printf("Expression::castTo(this=%s, type=%s, t=%s)\n", - toChars(), type->toChars(), t->toChars()); - #endif -- if (type == t) -+ if (type->equals(t)) - return this; -+ if (op == TOKvar) -+ { -+ VarDeclaration *v = ((VarExp *)this)->var->isVarDeclaration(); -+ if (v && v->storage_class & STCmanifest) -+ { -+ Expression *e = ctfeInterpret(); -+ return e->castTo(sc, t); -+ } -+ } - Expression *e = this; - Type *tb = t->toBasetype(); - Type *typeb = type->toBasetype(); -- if (tb != typeb) -+ if (!tb->equals(typeb)) - { - // Do (type *) cast of (type [dim]) - if (tb->ty == Tpointer && -@@ -1076,7 +1145,7 @@ Expression *Expression::castTo(Scope *sc - e = e->semantic(sc); - return e; - } -- else if (typeb->implicitConvTo(tb) == MATCHconst && t == type->constOf()) -+ else if (typeb->implicitConvTo(tb) == MATCHconst && t->equals(type->constOf())) - { - Expression *e = copy(); - e->type = t; -@@ -1103,8 +1172,9 @@ Expression *ErrorExp::castTo(Scope *sc, - - - Expression *RealExp::castTo(Scope *sc, Type *t) --{ Expression *e = this; -- if (type != t) -+{ -+ Expression *e = this; -+ if (!type->equals(t)) - { - if ((type->isreal() && t->isreal()) || - (type->isimaginary() && t->isimaginary()) -@@ -1120,8 +1190,9 @@ Expression *RealExp::castTo(Scope *sc, T - - - Expression *ComplexExp::castTo(Scope *sc, Type *t) --{ Expression *e = this; -- if (type != t) -+{ -+ Expression *e = this; -+ if (!type->equals(t)) - { - if (type->iscomplex() && t->iscomplex()) - { e = copy(); -@@ -1136,8 +1207,8 @@ Expression *ComplexExp::castTo(Scope *sc - - Expression *NullExp::castTo(Scope *sc, Type *t) - { -- //printf("NullExp::castTo(t = %p)\n", t); -- if (type == t) -+ //printf("NullExp::castTo(t = %s) %s\n", t->toChars(), toChars()); -+ if (type->equals(t)) - { - committed = 1; - return this; -@@ -1148,7 +1219,7 @@ Expression *NullExp::castTo(Scope *sc, T - Type *tb = t->toBasetype(); - #if 0 - e->type = type->toBasetype(); -- if (tb != e->type) -+ if (!tb->equals(e->type)) - { - // NULL implicitly converts to any pointer type or dynamic array - if (e->type->ty == Tpointer && e->type->nextOf()->ty == Tvoid && -@@ -1179,10 +1250,22 @@ Expression *NullExp::castTo(Scope *sc, T - return e->Expression::castTo(sc, t); - } - #endif -+ if (tb->ty == Tsarray || tb->ty == Tstruct) -+ { -+ error("cannot cast null to %s", t->toChars()); -+ } - e->type = t; - return e; - } - -+Expression *StructLiteralExp::castTo(Scope *sc, Type *t) -+{ -+ Expression *e = Expression::castTo(sc, t); -+ if (e->op == TOKstructliteral) -+ ((StructLiteralExp *)e)->stype = t; // commit type -+ return e; -+} -+ - Expression *StringExp::castTo(Scope *sc, Type *t) - { - /* This follows copy-on-write; any changes to 'this' -@@ -1206,7 +1289,7 @@ Expression *StringExp::castTo(Scope *sc, - copied = 1; - } - -- if (type == t) -+ if (type->equals(t)) - { - return se; - } -@@ -1217,7 +1300,7 @@ Expression *StringExp::castTo(Scope *sc, - return Expression::castTo(sc, t); - - Type *typeb = type->toBasetype(); -- if (typeb == tb) -+ if (typeb->equals(tb)) - { - if (!copied) - { se = (StringExp *)copy(); -@@ -1236,6 +1319,16 @@ Expression *StringExp::castTo(Scope *sc, - se->len = (len * sz) / se->sz; - se->committed = 1; - se->type = t; -+ -+ /* Assure space for terminating 0 -+ */ -+ if ((se->len + 1) * se->sz > (len + 1) * sz) -+ { -+ void *s = (void *)mem.malloc((se->len + 1) * se->sz); -+ memcpy(s, se->string, se->len * se->sz); -+ memset((char *)s + se->len * se->sz, 0, se->sz); -+ se->string = s; -+ } - return se; - } - -@@ -1285,7 +1378,7 @@ Expression *StringExp::castTo(Scope *sc, - case X(Tchar, Twchar): - for (size_t u = 0; u < len;) - { unsigned c; -- const char *p = utf_decodeChar((unsigned char *)se->string, len, &u, &c); -+ const char *p = utf_decodeChar((utf8_t *)se->string, len, &u, &c); - if (p) - error("%s", p); - else -@@ -1298,7 +1391,7 @@ Expression *StringExp::castTo(Scope *sc, - case X(Tchar, Tdchar): - for (size_t u = 0; u < len;) - { unsigned c; -- const char *p = utf_decodeChar((unsigned char *)se->string, len, &u, &c); -+ const char *p = utf_decodeChar((utf8_t *)se->string, len, &u, &c); - if (p) - error("%s", p); - buffer.write4(c); -@@ -1397,7 +1490,7 @@ L2: - // Copy when changing the string literal - size_t newsz = se->sz; - size_t d = (dim2 < se->len) ? dim2 : se->len; -- void *s = (unsigned char *)mem.malloc((dim2 + 1) * newsz); -+ void *s = (void *)mem.malloc((dim2 + 1) * newsz); - memcpy(s, se->string, d * newsz); - // Extend with 0, add terminating 0 - memset((char *)s + d * newsz, 0, (dim2 + 1 - d) * newsz); -@@ -1426,7 +1519,7 @@ Expression *AddrExp::castTo(Scope *sc, T - - tb = t->toBasetype(); - type = type->toBasetype(); -- if (tb != type) -+ if (!tb->equals(type)) - { - // Look for pointers to functions where the functions are overloaded. - -@@ -1486,7 +1579,12 @@ Expression *AddrExp::castTo(Scope *sc, T - - - Expression *TupleExp::castTo(Scope *sc, Type *t) --{ TupleExp *e = (TupleExp *)copy(); -+{ -+ if (type->equals(t)) -+ return this; -+ -+ TupleExp *e = (TupleExp *)copy(); -+ e->e0 = e0 ? e0->copy() : NULL; - e->exps = (Expressions *)exps->copy(); - for (size_t i = 0; i < e->exps->dim; i++) - { Expression *ex = (*e->exps)[i]; -@@ -1511,7 +1609,9 @@ Expression *ArrayLiteralExp::castTo(Scop - if ((tb->ty == Tarray || tb->ty == Tsarray) && - (typeb->ty == Tarray || typeb->ty == Tsarray) && - // Not trying to convert non-void[] to void[] -- !(tb->nextOf()->toBasetype()->ty == Tvoid && typeb->nextOf()->toBasetype()->ty != Tvoid)) -+ !(tb->nextOf()->toBasetype()->ty == Tvoid && typeb->nextOf()->toBasetype()->ty != Tvoid) && -+ // Not trying to convert void[n] to others -+ !(typeb->ty == Tsarray && typeb->nextOf()->toBasetype()->ty == Tvoid)) - { - if (tb->ty == Tsarray) - { TypeSArray *tsa = (TypeSArray *)tb; -@@ -1598,12 +1698,12 @@ Expression *SymOffExp::castTo(Scope *sc, - printf("SymOffExp::castTo(this=%s, type=%s, t=%s)\n", - toChars(), type->toChars(), t->toChars()); - #endif -- if (type == t && hasOverloads == 0) -+ if (type == t && !hasOverloads) - return this; - Expression *e; - Type *tb = t->toBasetype(); - Type *typeb = type->toBasetype(); -- if (tb != typeb) -+ if (!tb->equals(typeb)) - { - // Look for pointers to functions where the functions are overloaded. - FuncDeclaration *f; -@@ -1656,7 +1756,7 @@ Expression *SymOffExp::castTo(Scope *sc, - else - { e = copy(); - e->type = t; -- ((SymOffExp *)e)->hasOverloads = 0; -+ ((SymOffExp *)e)->hasOverloads = false; - } - return e; - } -@@ -1667,12 +1767,12 @@ Expression *DelegateExp::castTo(Scope *s - printf("DelegateExp::castTo(this=%s, type=%s, t=%s)\n", - toChars(), type->toChars(), t->toChars()); - #endif -- static char msg[] = "cannot form delegate due to covariant return type"; -+ static const char msg[] = "cannot form delegate due to covariant return type"; - - Expression *e = this; - Type *tb = t->toBasetype(); - Type *typeb = type->toBasetype(); -- if (tb != typeb || hasOverloads) -+ if (!tb->equals(typeb) || hasOverloads) - { - // Look for delegates to functions where the functions are overloaded. - FuncDeclaration *f; -@@ -1717,14 +1817,15 @@ Expression *FuncExp::castTo(Scope *sc, T - if (e) - { - if (e != this) -- e = e->castTo(sc, t); -- else if (!e->type->equals(t)) -+ return e->castTo(sc, t); -+ if (!e->type->equals(t) && e->type->implicitConvTo(t)) - { -- assert(e->type->nextOf()->covariant(t->nextOf()) == 1); -+ assert(t->ty == Tpointer && t->nextOf()->ty == Tvoid || // Bugzilla 9928 -+ e->type->nextOf()->covariant(t->nextOf()) == 1); - e = e->copy(); - e->type = t; -+ return e; - } -- return e; - } - return Expression::castTo(sc, t); - } -@@ -1733,7 +1834,7 @@ Expression *CondExp::castTo(Scope *sc, T - { - Expression *e = this; - -- if (type != t) -+ if (!type->equals(t)) - { - if (1 || e1->op == TOKstring || e2->op == TOKstring) - { e = new CondExp(loc, econd, e1->castTo(sc, t), e2->castTo(sc, t)); -@@ -1762,19 +1863,50 @@ Expression *CommaExp::castTo(Scope *sc, - return e; - } - -+Expression *SliceExp::castTo(Scope *sc, Type *t) -+{ -+ Type *typeb = type->toBasetype(); -+ Type *tb = t->toBasetype(); -+ Expression *e; -+ if (typeb->ty == Tarray && tb->ty == Tsarray) -+ { -+ /* If a SliceExp has Tsarray, it will become lvalue. -+ * That's handled in SliceExp::isLvalue and toLvalue -+ */ -+ e = copy(); -+ e->type = t; -+ } -+ else if (typeb->ty == Tarray && tb->ty == Tarray && -+ typeb->nextOf()->constConv(tb->nextOf()) == MATCHconst) -+ { -+ // immutable(T)[] to const(T)[] -+ // T [] to const(T)[] -+ e = copy(); -+ e->type = t; -+ } -+ else -+ { -+ e = Expression::castTo(sc, t); -+ } -+ return e; -+} -+ - /* ==================== inferType ====================== */ - - /**************************************** - * Set type inference target -+ * t Target type - * flag 1: don't put an error when inference fails -+ * sc it is used for the semantic of t, when != NULL -+ * tparams template parameters should be inferred - */ - --Expression *Expression::inferType(Type *t, int flag, TemplateParameters *tparams) -+Expression *Expression::inferType(Type *t, int flag, Scope *sc, TemplateParameters *tparams) - { - return this; - } - --Expression *ArrayLiteralExp::inferType(Type *t, int flag, TemplateParameters *tparams) -+Expression *ArrayLiteralExp::inferType(Type *t, int flag, Scope *sc, TemplateParameters *tparams) - { - if (t) - { -@@ -1785,7 +1917,7 @@ Expression *ArrayLiteralExp::inferType(T - for (size_t i = 0; i < elements->dim; i++) - { Expression *e = (*elements)[i]; - if (e) -- { e = e->inferType(tn, flag, tparams); -+ { e = e->inferType(tn, flag, sc, tparams); - (*elements)[i] = e; - } - } -@@ -1794,7 +1926,7 @@ Expression *ArrayLiteralExp::inferType(T - return this; - } - --Expression *AssocArrayLiteralExp::inferType(Type *t, int flag, TemplateParameters *tparams) -+Expression *AssocArrayLiteralExp::inferType(Type *t, int flag, Scope *sc, TemplateParameters *tparams) - { - if (t) - { -@@ -1806,14 +1938,14 @@ Expression *AssocArrayLiteralExp::inferT - for (size_t i = 0; i < keys->dim; i++) - { Expression *e = (*keys)[i]; - if (e) -- { e = e->inferType(ti, flag, tparams); -+ { e = e->inferType(ti, flag, sc, tparams); - (*keys)[i] = e; - } - } - for (size_t i = 0; i < values->dim; i++) - { Expression *e = (*values)[i]; - if (e) -- { e = e->inferType(tv, flag, tparams); -+ { e = e->inferType(tv, flag, sc, tparams); - (*values)[i] = e; - } - } -@@ -1822,7 +1954,7 @@ Expression *AssocArrayLiteralExp::inferT - return this; - } - --Expression *FuncExp::inferType(Type *to, int flag, TemplateParameters *tparams) -+Expression *FuncExp::inferType(Type *to, int flag, Scope *sc, TemplateParameters *tparams) - { - if (!to) - return this; -@@ -1880,7 +2012,10 @@ Expression *FuncExp::inferType(Type *to, - Type *tprm = p->type; - if (tprm->reliesOnTident(tparams)) - goto L1; -- tprm = tprm->semantic(loc, td->scope); -+ if (sc) -+ tprm = tprm->semantic(loc, sc); -+ if (tprm->ty == Terror) -+ goto L1; - tiargs->push(tprm); - u = dim; // break inner loop - } -@@ -1936,13 +2071,13 @@ L1: - return e; - } - --Expression *CondExp::inferType(Type *t, int flag, TemplateParameters *tparams) -+Expression *CondExp::inferType(Type *t, int flag, Scope *sc, TemplateParameters *tparams) - { - if (t) - { - t = t->toBasetype(); -- e1 = e1->inferType(t, flag, tparams); -- e2 = e2->inferType(t, flag, tparams); -+ e1 = e1->inferType(t, flag, sc, tparams); -+ e2 = e2->inferType(t, flag, sc, tparams); - } - return this; - } -@@ -1969,7 +2104,7 @@ Expression *BinExp::scaleFactor(Scope *s - if (!t->equals(t2b)) - e2 = e2->castTo(sc, t); - eoff = e2; -- e2 = new MulExp(loc, e2, new IntegerExp(0, stride, t)); -+ e2 = new MulExp(loc, e2, new IntegerExp(Loc(), stride, t)); - e2->type = t; - type = e1->type; - } -@@ -1985,7 +2120,7 @@ Expression *BinExp::scaleFactor(Scope *s - else - e = e1; - eoff = e; -- e = new MulExp(loc, e, new IntegerExp(0, stride, t)); -+ e = new MulExp(loc, e, new IntegerExp(Loc(), stride, t)); - e->type = t; - type = e2->type; - e1 = e2; -@@ -2070,6 +2205,14 @@ int typeMerge(Scope *sc, Expression *e, - assert(t1); - Type *t = t1; - -+ /* The start type of alias this type recursion. -+ * In following case, we should save A, and stop recursion -+ * if it appears again. -+ * X -> Y -> [A] -> B -> A -> B -> ... -+ */ -+ Type *att1 = NULL; -+ Type *att2 = NULL; -+ - //if (t1) printf("\tt1 = %s\n", t1->toChars()); - //if (t2) printf("\tt2 = %s\n", t2->toChars()); - #ifdef DEBUG -@@ -2089,13 +2232,13 @@ Lagain: - - if (t1b->ty == ty1) // if no promotions - { -- if (t1 == t2) -+ if (t1->equals(t2)) - { - t = t1; - goto Lret; - } - -- if (t1b == t2b) -+ if (t1b->equals(t2b)) - { - t = t1b; - goto Lret; -@@ -2117,8 +2260,14 @@ Lagain: - t1 = t1b; - t2 = t2b; - -- if (t1 == t2) -+ if (t1->ty == Ttuple || t2->ty == Ttuple) -+ goto Lincompatible; -+ -+ if (t1->equals(t2)) - { -+ // merging can not result in new enum type -+ if (t->ty == Tenum) -+ t = t1b; - } - else if ((t1->ty == Tpointer && t2->ty == Tpointer) || - (t1->ty == Tdelegate && t2->ty == Tdelegate)) -@@ -2127,7 +2276,7 @@ Lagain: - Type *t1n = t1->nextOf(); - Type *t2n = t2->nextOf(); - -- if (t1n == t2n) -+ if (t1n->equals(t2n)) - ; - else if (t1n->ty == Tvoid) // pointers to void are always compatible - t = t2; -@@ -2373,12 +2522,22 @@ Lcc: - } - else if (t1->ty == Tstruct && ((TypeStruct *)t1)->sym->aliasthis) - { -+ if (att1 && e1->type == att1) -+ goto Lincompatible; -+ if (!att1 && e1->type->checkAliasThisRec()) -+ att1 = e1->type; -+ //printf("att tmerge(c || c) e1 = %s\n", e1->type->toChars()); - e1 = resolveAliasThis(sc, e1); - t1 = e1->type; - continue; - } - else if (t2->ty == Tstruct && ((TypeStruct *)t2)->sym->aliasthis) - { -+ if (att2 && e2->type == att2) -+ goto Lincompatible; -+ if (!att2 && e2->type->checkAliasThisRec()) -+ att2 = e2->type; -+ //printf("att tmerge(c || c) e2 = %s\n", e2->type->toChars()); - e2 = resolveAliasThis(sc, e2); - t2 = e2->type; - continue; -@@ -2414,11 +2573,21 @@ Lcc: - Expression *e2b = NULL; - if (ts2->sym->aliasthis) - { -+ if (att2 && e2->type == att2) -+ goto Lincompatible; -+ if (!att2 && e2->type->checkAliasThisRec()) -+ att2 = e2->type; -+ //printf("att tmerge(s && s) e2 = %s\n", e2->type->toChars()); - e2b = resolveAliasThis(sc, e2); - i1 = e2b->implicitConvTo(t1); - } - if (ts1->sym->aliasthis) - { -+ if (att1 && e1->type == att1) -+ goto Lincompatible; -+ if (!att1 && e1->type->checkAliasThisRec()) -+ att1 = e1->type; -+ //printf("att tmerge(s && s) e1 = %s\n", e1->type->toChars()); - e1b = resolveAliasThis(sc, e1); - i2 = e1b->implicitConvTo(t2); - } -@@ -2446,6 +2615,11 @@ Lcc: - { - if (t1->ty == Tstruct && ((TypeStruct *)t1)->sym->aliasthis) - { -+ if (att1 && e1->type == att1) -+ goto Lincompatible; -+ if (!att1 && e1->type->checkAliasThisRec()) -+ att1 = e1->type; -+ //printf("att tmerge(s || s) e1 = %s\n", e1->type->toChars()); - e1 = resolveAliasThis(sc, e1); - t1 = e1->type; - t = t1; -@@ -2453,6 +2627,11 @@ Lcc: - } - if (t2->ty == Tstruct && ((TypeStruct *)t2)->sym->aliasthis) - { -+ if (att2 && e2->type == att2) -+ goto Lincompatible; -+ if (!att2 && e2->type->checkAliasThisRec()) -+ att2 = e2->type; -+ //printf("att tmerge(s || s) e2 = %s\n", e2->type->toChars()); - e2 = resolveAliasThis(sc, e2); - t2 = e2->type; - t = t2; -@@ -2595,6 +2774,11 @@ Expression *BinExp::typeCombine(Scope *s - - if (!typeMerge(sc, this, &type, &e1, &e2)) - goto Lerror; -+ // If the types have no value, return an error -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - return this; - - Lerror: -@@ -2634,6 +2818,8 @@ Expression *Expression::integralPromotio - case Tdchar: - e = e->castTo(sc, Type::tuns32); - break; -+ default: -+ break; - } - return e; - } -@@ -2648,8 +2834,8 @@ Expression *Expression::integralPromotio - - int arrayTypeCompatible(Loc loc, Type *t1, Type *t2) - { -- t1 = t1->toBasetype(); -- t2 = t2->toBasetype(); -+ t1 = t1->toBasetype()->merge2(); -+ t2 = t2->toBasetype()->merge2(); - - if ((t1->ty == Tarray || t1->ty == Tsarray || t1->ty == Tpointer) && - (t2->ty == Tarray || t2->ty == Tsarray || t2->ty == Tpointer)) -@@ -2712,7 +2898,7 @@ IntRange Expression::getIntRange() - - IntRange IntegerExp::getIntRange() - { -- return IntRange(value).cast(type) DUMP; -+ return IntRange(SignExtendedNumber(value)).cast(type) DUMP; - } - - IntRange CastExp::getIntRange() ---- a/src/gcc/d/dfrontend/class.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/class.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -32,16 +32,15 @@ - - /********************************* ClassDeclaration ****************************/ - --ClassDeclaration *ClassDeclaration::classinfo; - ClassDeclaration *ClassDeclaration::object; - ClassDeclaration *ClassDeclaration::throwable; - ClassDeclaration *ClassDeclaration::exception; - ClassDeclaration *ClassDeclaration::errorException; - --ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses) -+ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses, bool inObject) - : AggregateDeclaration(loc, id) - { -- static char msg[] = "only object.d can define this reserved class name"; -+ static const char msg[] = "only object.d can define this reserved class name"; - - if (baseclasses) - // Actually, this is a transfer -@@ -77,158 +76,160 @@ ClassDeclaration::ClassDeclaration(Loc l - if (id->toChars()[0] == 'T') - { - if (id == Id::TypeInfo) -- { if (Type::typeinfo) -- Type::typeinfo->error("%s", msg); -- Type::typeinfo = this; -+ { if (!inObject) -+ error("%s", msg); -+ Type::dtypeinfo = this; - } - - if (id == Id::TypeInfo_Class) -- { if (Type::typeinfoclass) -- Type::typeinfoclass->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoclass = this; - } - - if (id == Id::TypeInfo_Interface) -- { if (Type::typeinfointerface) -- Type::typeinfointerface->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfointerface = this; - } - - if (id == Id::TypeInfo_Struct) -- { if (Type::typeinfostruct) -- Type::typeinfostruct->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfostruct = this; - } - - if (id == Id::TypeInfo_Typedef) -- { if (Type::typeinfotypedef) -- Type::typeinfotypedef->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfotypedef = this; - } - - if (id == Id::TypeInfo_Pointer) -- { if (Type::typeinfopointer) -- Type::typeinfopointer->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfopointer = this; - } - - if (id == Id::TypeInfo_Array) -- { if (Type::typeinfoarray) -- Type::typeinfoarray->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoarray = this; - } - - if (id == Id::TypeInfo_StaticArray) -- { //if (Type::typeinfostaticarray) -+ { //if (!inObject) - //Type::typeinfostaticarray->error("%s", msg); - Type::typeinfostaticarray = this; - } - - if (id == Id::TypeInfo_AssociativeArray) -- { if (Type::typeinfoassociativearray) -- Type::typeinfoassociativearray->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoassociativearray = this; - } - - if (id == Id::TypeInfo_Enum) -- { if (Type::typeinfoenum) -- Type::typeinfoenum->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoenum = this; - } - - if (id == Id::TypeInfo_Function) -- { if (Type::typeinfofunction) -- Type::typeinfofunction->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfofunction = this; - } - - if (id == Id::TypeInfo_Delegate) -- { if (Type::typeinfodelegate) -- Type::typeinfodelegate->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfodelegate = this; - } - - if (id == Id::TypeInfo_Tuple) -- { if (Type::typeinfotypelist) -- Type::typeinfotypelist->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfotypelist = this; - } - - #if DMDV2 - if (id == Id::TypeInfo_Const) -- { if (Type::typeinfoconst) -- Type::typeinfoconst->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoconst = this; - } - - if (id == Id::TypeInfo_Invariant) -- { if (Type::typeinfoinvariant) -- Type::typeinfoinvariant->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoinvariant = this; - } - - if (id == Id::TypeInfo_Shared) -- { if (Type::typeinfoshared) -- Type::typeinfoshared->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfoshared = this; - } - - if (id == Id::TypeInfo_Wild) -- { if (Type::typeinfowild) -- Type::typeinfowild->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfowild = this; - } - - if (id == Id::TypeInfo_Vector) -- { if (Type::typeinfovector) -- Type::typeinfovector->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - Type::typeinfovector = this; - } - #endif - } - - if (id == Id::Object) -- { if (object) -- object->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - object = this; - } - - if (id == Id::Throwable) -- { if (throwable) -- throwable->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - throwable = this; - } - - if (id == Id::Exception) -- { if (exception) -- exception->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - exception = this; - } - - if (id == Id::Error) -- { if (errorException) -- errorException->error("%s", msg); -+ { if (!inObject) -+ error("%s", msg); - errorException = this; - } - -- //if (id == Id::ClassInfo) -- if (id == Id::TypeInfo_Class) -- { if (classinfo) -- classinfo->error("%s", msg); -- classinfo = this; -- } -- -+#if !MODULEINFO_IS_STRUCT -+ #ifdef DMDV2 -+ if (id == Id::ModuleInfo && !Module::moduleinfo) -+ Module::moduleinfo = this; -+ #else - if (id == Id::ModuleInfo) - { if (Module::moduleinfo) -- Module::moduleinfo->error("%s", msg); -+ error("%s", msg); - Module::moduleinfo = this; - } -+ #endif -+#endif - } - - com = 0; -+ cpp = 0; - isscope = 0; - isabstract = 0; - inuse = 0; -+ doAncestorsSemantic = SemanticStart; - } - - Dsymbol *ClassDeclaration::syntaxCopy(Dsymbol *s) -@@ -277,7 +278,7 @@ void ClassDeclaration::semantic(Scope *s - type = type->semantic(loc, sc); - handle = type; - -- if (!members) // if forward reference -+ if (!members) // if opaque declaration - { //printf("\tclass '%s' is forward referenced\n", toChars()); - return; - } -@@ -292,13 +293,13 @@ void ClassDeclaration::semantic(Scope *s - - Scope *scx = NULL; - if (scope) -- { sc = scope; -+ { -+ sc = scope; - scx = scope; // save so we don't make redundant copies - scope = NULL; - } - unsigned dprogress_save = Module::dprogress; -- -- int errors = global.gaggedErrors; -+ int errors = global.errors; - - if (sc->stc & STCdeprecated) - { -@@ -307,17 +308,21 @@ void ClassDeclaration::semantic(Scope *s - userAttributes = sc->userAttributes; - - if (sc->linkage == LINKcpp) -- error("cannot create C++ classes"); -+ cpp = 1; - - // Expand any tuples in baseclasses[] - for (size_t i = 0; i < baseclasses->dim; ) -- { BaseClass *b = (*baseclasses)[i]; -+ { -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); -+ -+ BaseClass *b = (*baseclasses)[i]; - b->type = b->type->semantic(loc, sc); -- Type *tb = b->type->toBasetype(); - -+ Type *tb = b->type->toBasetype(); - if (tb->ty == Ttuple) - { TypeTuple *tup = (TypeTuple *)tb; -- enum PROT protection = b->protection; -+ PROT protection = b->protection; - baseclasses->remove(i); - size_t dim = Parameter::dim(tup->arguments); - for (size_t j = 0; j < dim; j++) -@@ -332,21 +337,23 @@ void ClassDeclaration::semantic(Scope *s - - // See if there's a base class as first in baseclasses[] - if (baseclasses->dim) -- { TypeClass *tc; -- BaseClass *b; -- Type *tb; -+ { -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); - -- b = (*baseclasses)[0]; -+ BaseClass *b = (*baseclasses)[0]; - //b->type = b->type->semantic(loc, sc); -- tb = b->type->toBasetype(); -+ -+ Type *tb = b->type->toBasetype(); - if (tb->ty != Tclass) -- { if (b->type != Type::terror) -+ { -+ if (b->type != Type::terror) - error("base type must be class or interface, not %s", b->type->toChars()); - baseclasses->remove(0); - } - else - { -- tc = (TypeClass *)(tb); -+ TypeClass *tc = (TypeClass *)(tb); - - if (tc->sym->isDeprecated()) - { -@@ -374,7 +381,7 @@ void ClassDeclaration::semantic(Scope *s - } - if (!tc->sym->symtab || tc->sym->sizeok == SIZEOKnone) - { // Try to resolve forward reference -- if (/*sc->mustsemantic &&*/ tc->sym->scope) -+ if (/*doAncestorsSemantic == SemanticIn &&*/ tc->sym->scope) - tc->sym->semantic(NULL); - } - if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == SIZEOKnone) -@@ -402,19 +409,18 @@ void ClassDeclaration::semantic(Scope *s - // Treat the remaining entries in baseclasses as interfaces - // Check for errors, handle forward references - for (size_t i = (baseClass ? 1 : 0); i < baseclasses->dim; ) -- { TypeClass *tc; -- BaseClass *b; -- Type *tb; -+ { -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); - -- b = (*baseclasses)[i]; -+ BaseClass *b = (*baseclasses)[i]; - b->type = b->type->semantic(loc, sc); -- tb = b->type->toBasetype(); -- if (tb->ty == Tclass) -- tc = (TypeClass *)tb; -- else -- tc = NULL; -+ -+ Type *tb = b->type->toBasetype(); -+ TypeClass *tc = (tb->ty == Tclass) ? (TypeClass *)tb : NULL; - if (!tc || !tc->sym->isInterfaceDeclaration()) -- { if (b->type != Type::terror) -+ { -+ if (b->type != Type::terror) - error("base type must be interface, not %s", b->type->toChars()); - baseclasses->remove(i); - continue; -@@ -442,7 +448,7 @@ void ClassDeclaration::semantic(Scope *s - - if (!tc->sym->symtab) - { // Try to resolve forward reference -- if (/*sc->mustsemantic &&*/ tc->sym->scope) -+ if (/*doAncestorsSemantic == SemanticIn &&*/ tc->sym->scope) - tc->sym->semantic(NULL); - } - -@@ -462,64 +468,69 @@ void ClassDeclaration::semantic(Scope *s - } - i++; - } -+ if (doAncestorsSemantic == SemanticIn) -+ doAncestorsSemantic = SemanticDone; - - -- // If no base class, and this is not an Object, use Object as base class -- if (!baseClass && ident != Id::Object) -+ if (sizeok == SIZEOKnone) - { -- if (!object) -+ // If no base class, and this is not an Object, use Object as base class -+ if (!baseClass && ident != Id::Object && !cpp) - { -- error("missing or corrupt object.d"); -- fatal(); -- } -- -- Type *t = object->type; -- t = t->semantic(loc, sc)->toBasetype(); -- assert(t->ty == Tclass); -- TypeClass *tc = (TypeClass *)t; -+ if (!object) -+ { -+ error("missing or corrupt object.d"); -+ fatal(); -+ } - -- BaseClass *b = new BaseClass(tc, PROTpublic); -- baseclasses->shift(b); -+ Type *t = object->type; -+ t = t->semantic(loc, sc)->toBasetype(); -+ assert(t->ty == Tclass); -+ TypeClass *tc = (TypeClass *)t; - -- baseClass = tc->sym; -- assert(!baseClass->isInterfaceDeclaration()); -- b->base = baseClass; -- } -+ BaseClass *b = new BaseClass(tc, PROTpublic); -+ baseclasses->shift(b); - -- interfaces_dim = baseclasses->dim; -- interfaces = baseclasses->tdata(); -+ baseClass = tc->sym; -+ assert(!baseClass->isInterfaceDeclaration()); -+ b->base = baseClass; -+ } - -+ interfaces_dim = baseclasses->dim; -+ interfaces = baseclasses->tdata(); - -- if (baseClass) -- { -- if (baseClass->storage_class & STCfinal) -- error("cannot inherit from final class %s", baseClass->toChars()); -+ if (baseClass) -+ { -+ if (baseClass->storage_class & STCfinal) -+ error("cannot inherit from final class %s", baseClass->toChars()); - -- interfaces_dim--; -- interfaces++; -+ interfaces_dim--; -+ interfaces++; - -- // Copy vtbl[] from base class -- vtbl.setDim(baseClass->vtbl.dim); -- memcpy(vtbl.tdata(), baseClass->vtbl.tdata(), sizeof(void *) * vtbl.dim); -+ // Copy vtbl[] from base class -+ vtbl.setDim(baseClass->vtbl.dim); -+ memcpy(vtbl.tdata(), baseClass->vtbl.tdata(), sizeof(void *) * vtbl.dim); - -- // Inherit properties from base class -- com = baseClass->isCOMclass(); -- isscope = baseClass->isscope; -- vthis = baseClass->vthis; -- storage_class |= baseClass->storage_class & STC_TYPECTOR; -- } -- else -- { -- // No base class, so this is the root of the class hierarchy -- vtbl.setDim(0); -- vtbl.push(this); // leave room for classinfo as first member -- } -+ // Inherit properties from base class -+ com = baseClass->isCOMclass(); -+ if (baseClass->isCPPclass()) -+ cpp = 1; -+ isscope = baseClass->isscope; -+ vthis = baseClass->vthis; -+ enclosing = baseClass->enclosing; -+ storage_class |= baseClass->storage_class & STC_TYPECTOR; -+ } -+ else -+ { -+ // No base class, so this is the root of the class hierarchy -+ vtbl.setDim(0); -+ if (vtblOffset()) -+ vtbl.push(this); // leave room for classinfo as first member -+ } - -- protection = sc->protection; -- storage_class |= sc->stc; -+ protection = sc->protection; -+ storage_class |= sc->stc; - -- if (sizeok == SIZEOKnone) -- { - interfaceSemantic(sc); - - for (size_t i = 0; i < members->dim; i++) -@@ -532,8 +543,8 @@ void ClassDeclaration::semantic(Scope *s - * member which is a pointer to the enclosing scope. - */ - if (vthis) // if inheriting from nested class -- { // Use the base class's 'this' member -- isnested = true; -+ { -+ // Use the base class's 'this' member - if (storage_class & STCstatic) - error("static class cannot inherit from nested class %s", baseClass->toChars()); - if (toParent2() != baseClass->toParent2() && -@@ -554,57 +565,26 @@ void ClassDeclaration::semantic(Scope *s - baseClass->toChars(), - baseClass->toParent2()->toChars()); - } -- isnested = false; -+ enclosing = NULL; - } - } -- else if (!(storage_class & STCstatic)) -- { Dsymbol *s = toParent2(); -- if (s) -- { -- AggregateDeclaration *ad = s->isClassDeclaration(); -- FuncDeclaration *fd = s->isFuncDeclaration(); -- -+ else -+ makeNested(); - -- if (ad || fd) -- { isnested = true; -- Type *t; -- if (ad) -- t = ad->handle; -- else if (fd) -- { AggregateDeclaration *ad2 = fd->isMember2(); -- if (ad2) -- t = ad2->handle; -- else -- { -- t = Type::tvoidptr; -- } -- } -- else -- assert(0); -- if (t->ty == Tstruct) // ref to struct -- t = Type::tvoidptr; -- assert(!vthis); -- vthis = new ThisDeclaration(loc, t); -- members->push(vthis); -- } -- } -- } -+ if (storage_class & STCauto) -+ error("storage class 'auto' is invalid when declaring a class, did you mean to use 'scope'?"); -+ if (storage_class & STCscope) -+ isscope = 1; -+ if (storage_class & STCabstract) -+ isabstract = 1; - } - -- if (storage_class & STCauto) -- error("storage class 'auto' is invalid when declaring a class, did you mean to use 'scope'?"); -- if (storage_class & STCscope) -- isscope = 1; -- if (storage_class & STCabstract) -- isabstract = 1; -- - sc = sc->push(this); - //sc->stc &= ~(STCfinal | STCauto | STCscope | STCstatic | STCabstract | STCdeprecated | STC_TYPECTOR | STCtls | STCgshared); - //sc->stc |= storage_class & STC_TYPECTOR; - sc->stc &= STCsafe | STCtrusted | STCsystem; - sc->parent = this; - sc->inunion = 0; -- - if (isCOMclass()) - { - if (global.params.isWindows) -@@ -619,13 +599,19 @@ void ClassDeclaration::semantic(Scope *s - sc->explicitProtection = 0; - sc->structalign = STRUCTALIGN_DEFAULT; - if (baseClass) -- { sc->offset = baseClass->structsize; -+ { -+ sc->offset = baseClass->structsize; - alignsize = baseClass->alignsize; --// if (isnested) -+ sc->offset = (sc->offset + alignsize - 1) & ~(alignsize - 1); -+// if (enclosing) - // sc->offset += Target::ptrsize; // room for uplevel context pointer - } - else -- { sc->offset = Target::ptrsize * 2; // allow room for __vptr and __monitor -+ { -+ if (cpp) -+ sc->offset = Target::ptrsize; // allow room for __vptr -+ else -+ sc->offset = Target::ptrsize * 2; // allow room for __vptr and __monitor - alignsize = Target::ptrsize; - } - sc->userAttributes = NULL; -@@ -638,50 +624,45 @@ void ClassDeclaration::semantic(Scope *s - * resolve individual members like enums. - */ - for (size_t i = 0; i < members_dim; i++) -- { Dsymbol *s = (*members)[i]; -- /* There are problems doing this in the general case because -- * Scope keeps track of things like 'offset' -- */ -- if (s->isEnumDeclaration() || -- (s->isAggregateDeclaration() && s->ident) || -- s->isTemplateMixin() || -- s->isAttribDeclaration() || -- s->isAliasDeclaration()) -- { -- //printf("[%d] setScope %s %s, sc = %p\n", i, s->kind(), s->toChars(), sc); -- s->setScope(sc); -- } -+ { -+ Dsymbol *s = (*members)[i]; -+ //printf("[%d] setScope %s %s, sc = %p\n", i, s->kind(), s->toChars(), sc); -+ s->setScope(sc); - } - - for (size_t i = 0; i < members_dim; i++) -- { Dsymbol *s = (*members)[i]; -+ { -+ Dsymbol *s = (*members)[i]; -+ -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); - s->semantic(sc); - } - - // Set the offsets of the fields and determine the size of the class - - unsigned offset = structsize; -- bool isunion = isUnionDeclaration() != NULL; - for (size_t i = 0; i < members->dim; i++) -- { Dsymbol *s = (*members)[i]; -+ { -+ Dsymbol *s = (*members)[i]; - s->setFieldOffset(this, &offset, false); - } - sc->offset = structsize; - -- if (global.gag && global.gaggedErrors != errors) -- { // The type is no good, yet the error messages were gagged. -+ if (global.errors != errors) -+ { -+ // The type is no good. - type = Type::terror; - } - - if (sizeok == SIZEOKfwd) // failed due to forward references -- { // semantic() failed due to forward references -+ { -+ // semantic() failed due to forward references - // Unwind what we did, and defer it for later -- - for (size_t i = 0; i < fields.dim; i++) -- { Dsymbol *s = fields[i]; -- VarDeclaration *vd = s->isVarDeclaration(); -- if (vd) -- vd->offset = 0; -+ { -+ if (VarDeclaration *v = fields[i]) -+ v->offset = 0; - } - fields.setDim(0); - structsize = 0; -@@ -707,43 +688,52 @@ void ClassDeclaration::semantic(Scope *s - /* Look for special member functions. - * They must be in this class, not in a base class. - */ -- ctor = search(0, Id::ctor, 0); --#if DMDV1 -- if (ctor && (ctor->toParent() != this || !ctor->isCtorDeclaration())) -- ctor = NULL; --#else -+ searchCtor(); - if (ctor && (ctor->toParent() != this || !(ctor->isCtorDeclaration() || ctor->isTemplateDeclaration()))) - ctor = NULL; // search() looks through ancestor classes --#endif -+ if (!ctor && noDefaultCtor) -+ { -+ // A class object is always created by constructor, so this check is legitimate. -+ for (size_t i = 0; i < fields.dim; i++) -+ { -+ VarDeclaration *v = fields[i]->isVarDeclaration(); -+ if (v->storage_class & STCnodefaultctor) -+ ::error(v->loc, "field %s must be initialized in constructor", v->toChars()); -+ } -+ } - --// dtor = (DtorDeclaration *)search(Id::dtor, 0); --// if (dtor && dtor->toParent() != this) --// dtor = NULL; -- --// inv = (InvariantDeclaration *)search(Id::classInvariant, 0); --// if (inv && inv->toParent() != this) --// inv = NULL; -+ inv = buildInv(sc); - - // Can be in base class -- aggNew = (NewDeclaration *)search(0, Id::classNew, 0); -- aggDelete = (DeleteDeclaration *)search(0, Id::classDelete, 0); -+ aggNew = (NewDeclaration *)search(Loc(), Id::classNew, 0); -+ aggDelete = (DeleteDeclaration *)search(Loc(), Id::classDelete, 0); - -- // If this class has no constructor, but base class does, create -- // a constructor: -+ // If this class has no constructor, but base class has a default -+ // ctor, create a constructor: - // this() { } - if (!ctor && baseClass && baseClass->ctor) - { -- //printf("Creating default this(){} for class %s\n", toChars()); -- Type *tf = new TypeFunction(NULL, NULL, 0, LINKd, 0); -- CtorDeclaration *ctor = new CtorDeclaration(loc, 0, 0, tf); -- ctor->isImplicit = true; -- ctor->fbody = new CompoundStatement(0, new Statements()); -- members->push(ctor); -- ctor->addMember(sc, this, 1); -- *sc = scsave; // why? What about sc->nofree? -- ctor->semantic(sc); -- this->ctor = ctor; -- defaultCtor = ctor; -+ if (FuncDeclaration *fd = resolveFuncCall(loc, sc, baseClass->ctor, NULL, NULL, NULL, 1)) -+ { -+ //printf("Creating default this(){} for class %s\n", toChars()); -+ TypeFunction *btf = (TypeFunction *)fd->type; -+ TypeFunction *tf = new TypeFunction(NULL, NULL, 0, LINKd, fd->storage_class); -+ tf->purity = btf->purity; -+ tf->isnothrow = btf->isnothrow; -+ tf->trust = btf->trust; -+ CtorDeclaration *ctor = new CtorDeclaration(loc, Loc(), 0, tf); -+ ctor->fbody = new CompoundStatement(Loc(), new Statements()); -+ members->push(ctor); -+ ctor->addMember(sc, this, 1); -+ *sc = scsave; // why? What about sc->nofree? -+ ctor->semantic(sc); -+ this->ctor = ctor; -+ defaultCtor = ctor; -+ } -+ else -+ { -+ error("Cannot implicitly generate a default ctor when base class %s is missing a default ctor", baseClass->toPrettyChars()); -+ } - } - - #if 0 -@@ -782,13 +772,10 @@ void ClassDeclaration::semantic(Scope *s - Module::dprogress++; - - dtor = buildDtor(sc); -- if (Dsymbol *assign = search_function(this, Id::assign)) -+ if (FuncDeclaration *f = hasIdentityOpAssign(sc)) - { -- if (FuncDeclaration *f = hasIdentityOpAssign(sc, assign)) -- { -- if (!(f->storage_class & STCdisable)) -- error("identity assignment operator overload is illegal"); -- } -+ if (!(f->storage_class & STCdisable)) -+ error(f->loc, "identity assignment operator overload is illegal"); - } - sc->pop(); - -@@ -808,6 +795,13 @@ void ClassDeclaration::semantic(Scope *s - deferred->semantic2(sc); - deferred->semantic3(sc); - } -+ -+ if (type->ty == Tclass && ((TypeClass *)type)->sym != this) -+ { -+ error("failed semantic analysis"); -+ this->errors = true; -+ type = Type::terror; -+ } - } - - void ClassDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -824,7 +818,7 @@ void ClassDeclaration::toCBuffer(OutBuff - BaseClass *b = (*baseclasses)[i]; - - if (i) -- buf->writeByte(','); -+ buf->writestring(", "); - //buf->writestring(b->base->ident->toChars()); - b->type->toCBuffer(buf, NULL, hgs); - } -@@ -891,10 +885,10 @@ int ClassDeclaration::isBaseOf(ClassDecl - { - /* cd->baseClass might not be set if cd is forward referenced. - */ -- if (!cd->baseClass && cd->baseclasses->dim && !cd->isInterfaceDeclaration()) -+ if (!cd->baseClass && cd->scope && !cd->isInterfaceDeclaration()) - { - cd->semantic(NULL); -- if (!cd->baseClass) -+ if (!cd->baseClass && cd->scope) - cd->error("base class is forward referenced by %s", toChars()); - } - -@@ -928,19 +922,17 @@ Dsymbol *ClassDeclaration::search(Loc lo - Dsymbol *s; - //printf("%s.ClassDeclaration::search('%s')\n", toChars(), ident->toChars()); - -- if (scope && !symtab) -- { Scope *sc = scope; -- sc->mustsemantic++; -- // If speculatively gagged, ungag now. -- unsigned oldgag = global.gag; -- if (global.isSpeculativeGagging()) -- global.gag = 0; -- semantic(sc); -- global.gag = oldgag; -- sc->mustsemantic--; -+ //if (scope) printf("%s doAncestorsSemantic = %d\n", toChars(), doAncestorsSemantic); -+ if (scope && doAncestorsSemantic == SemanticStart) -+ { -+ // must semantic on base class/interfaces -+ doAncestorsSemantic = SemanticIn; -+ semantic(scope); -+ if (doAncestorsSemantic != SemanticDone) -+ doAncestorsSemantic = SemanticStart; - } - -- if (!members || !symtab) -+ if (!members || !symtab) // opaque or semantic() is not yet called - { - error("is forward referenced when looking for '%s'", ident->toChars()); - //*(char*)0=0; -@@ -982,6 +974,8 @@ ClassDeclaration *ClassDeclaration::sear - { - BaseClass *b = (*baseclasses)[i]; - ClassDeclaration *cdb = b->type->isClassHandle(); -+ if (!cdb) // Bugzilla 10616 -+ return NULL; - if (cdb->ident->equals(ident)) - return cdb; - cdb = cdb->searchBase(loc, ident); -@@ -997,18 +991,22 @@ ClassDeclaration *ClassDeclaration::sear - */ - - #if DMDV2 --int isf(void *param, FuncDeclaration *fd) -+int isf(void *param, Dsymbol *s) - { -+ FuncDeclaration *fd = s->isFuncDeclaration(); -+ if (!fd) -+ return 0; - //printf("param = %p, fd = %p %s\n", param, fd, fd->toChars()); -- return param == fd; -+ return (RootObject *)param == fd; - } - - int ClassDeclaration::isFuncHidden(FuncDeclaration *fd) - { - //printf("ClassDeclaration::isFuncHidden(class = %s, fd = %s)\n", toChars(), fd->toChars()); -- Dsymbol *s = search(0, fd->ident, 4|2); -+ Dsymbol *s = search(Loc(), fd->ident, 4|2); - if (!s) -- { //printf("not found\n"); -+ { -+ //printf("not found\n"); - /* Because, due to a hack, if there are multiple definitions - * of fd->ident, NULL is returned. - */ -@@ -1019,9 +1017,10 @@ int ClassDeclaration::isFuncHidden(FuncD - if (os) - { - for (size_t i = 0; i < os->a.dim; i++) -- { Dsymbol *s2 = os->a[i]; -+ { -+ Dsymbol *s2 = os->a[i]; - FuncDeclaration *f2 = s2->isFuncDeclaration(); -- if (f2 && overloadApply(f2, &isf, fd)) -+ if (f2 && overloadApply(f2, (void *)fd, &isf)) - return 0; - } - return 1; -@@ -1030,7 +1029,7 @@ int ClassDeclaration::isFuncHidden(FuncD - { - FuncDeclaration *fdstart = s->isFuncDeclaration(); - //printf("%s fdstart = %p\n", s->kind(), fdstart); -- if (overloadApply(fdstart, &isf, fd)) -+ if (overloadApply(fdstart, (void *)fd, &isf)) - return 0; - - return !fd->parent->isTemplateMixin(); -@@ -1139,9 +1138,13 @@ void ClassDeclaration::interfaceSemantic - if (b->base->isCOMinterface()) - com = 1; - -+#if 1 - if (b->base->isCPPinterface() && id) - id->cpp = 1; -- -+#else -+ if (b->base->isCPPinterface()) -+ cpp = 1; -+#endif - vtblInterfaces->push(b); - b->copyBaseInterfaces(vtblInterfaces); - } -@@ -1161,6 +1164,11 @@ int ClassDeclaration::isCOMinterface() - } - - #if DMDV2 -+int ClassDeclaration::isCPPclass() -+{ -+ return cpp; -+} -+ - int ClassDeclaration::isCPPinterface() - { - return 0; -@@ -1171,10 +1179,10 @@ int ClassDeclaration::isCPPinterface() - /**************************************** - */ - --int ClassDeclaration::isAbstract() -+bool ClassDeclaration::isAbstract() - { - if (isabstract) -- return TRUE; -+ return true; - for (size_t i = 1; i < vtbl.dim; i++) - { - FuncDeclaration *fd = vtbl[i]->isFuncDeclaration(); -@@ -1183,10 +1191,10 @@ int ClassDeclaration::isAbstract() - if (!fd || fd->isAbstract()) - { - isabstract |= 1; -- return TRUE; -+ return true; - } - } -- return FALSE; -+ return false; - } - - -@@ -1195,11 +1203,14 @@ int ClassDeclaration::isAbstract() - * For class objects, yes, this is where the classinfo ptr goes. - * For COM interfaces, no. - * For non-COM interfaces, yes, this is where the Interface ptr goes. -+ * Returns: -+ * 0 vtbl[0] is first virtual function pointer -+ * 1 vtbl[0] is classinfo/interfaceinfo pointer - */ - - int ClassDeclaration::vtblOffset() - { -- return 1; -+ return cpp ? 0 : 1; - } - - /**************************************** -@@ -1223,8 +1234,6 @@ void ClassDeclaration::addLocalClass(Cla - InterfaceDeclaration::InterfaceDeclaration(Loc loc, Identifier *id, BaseClasses *baseclasses) - : ClassDeclaration(loc, id, baseclasses) - { -- com = 0; -- cpp = 0; - if (id == Id::IUnknown) // IUnknown is the root of all COM interfaces - { com = 1; - cpp = 1; // IUnknown is also a C++ interface -@@ -1271,12 +1280,13 @@ void InterfaceDeclaration::semantic(Scop - - Scope *scx = NULL; - if (scope) -- { sc = scope; -+ { -+ sc = scope; - scx = scope; // save so we don't make redundant copies - scope = NULL; - } - -- int errors = global.gaggedErrors; -+ int errors = global.errors; - - if (sc->stc & STCdeprecated) - { -@@ -1286,13 +1296,17 @@ void InterfaceDeclaration::semantic(Scop - - // Expand any tuples in baseclasses[] - for (size_t i = 0; i < baseclasses->dim; ) -- { BaseClass *b = (*baseclasses)[i]; -+ { -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); -+ -+ BaseClass *b = (*baseclasses)[i]; - b->type = b->type->semantic(loc, sc); -- Type *tb = b->type->toBasetype(); - -+ Type *tb = b->type->toBasetype(); - if (tb->ty == Ttuple) - { TypeTuple *tup = (TypeTuple *)tb; -- enum PROT protection = b->protection; -+ PROT protection = b->protection; - baseclasses->remove(i); - size_t dim = Parameter::dim(tup->arguments); - for (size_t j = 0; j < dim; j++) -@@ -1310,19 +1324,18 @@ void InterfaceDeclaration::semantic(Scop - - // Check for errors, handle forward references - for (size_t i = 0; i < baseclasses->dim; ) -- { TypeClass *tc; -- BaseClass *b; -- Type *tb; -+ { -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); - -- b = (*baseclasses)[i]; -+ BaseClass *b = (*baseclasses)[i]; - b->type = b->type->semantic(loc, sc); -- tb = b->type->toBasetype(); -- if (tb->ty == Tclass) -- tc = (TypeClass *)tb; -- else -- tc = NULL; -+ -+ Type *tb = b->type->toBasetype(); -+ TypeClass *tc = (tb->ty == Tclass) ? (TypeClass *)tb : NULL; - if (!tc || !tc->sym->isInterfaceDeclaration()) -- { if (b->type != Type::terror) -+ { -+ if (b->type != Type::terror) - error("base type must be interface, not %s", b->type->toChars()); - baseclasses->remove(i); - continue; -@@ -1346,7 +1359,7 @@ void InterfaceDeclaration::semantic(Scop - } - if (!b->base->symtab) - { // Try to resolve forward reference -- if (sc->mustsemantic && b->base->scope) -+ if (doAncestorsSemantic == SemanticIn && b->base->scope) - b->base->semantic(NULL); - } - if (!b->base->symtab || b->base->scope || b->base->inuse) -@@ -1366,6 +1379,8 @@ void InterfaceDeclaration::semantic(Scop - #endif - i++; - } -+ if (doAncestorsSemantic == SemanticIn) -+ doAncestorsSemantic = SemanticDone; - - interfaces_dim = baseclasses->dim; - interfaces = baseclasses->tdata(); -@@ -1417,9 +1432,9 @@ void InterfaceDeclaration::semantic(Scop - sc = sc->push(this); - sc->stc &= STCsafe | STCtrusted | STCsystem; - sc->parent = this; -- if (isCOMinterface()) -+ if (com) - sc->linkage = LINKwindows; -- else if (isCPPinterface()) -+ else if (cpp) - sc->linkage = LINKcpp; - sc->structalign = STRUCTALIGN_DEFAULT; - sc->protection = PROTpublic; -@@ -1448,11 +1463,14 @@ void InterfaceDeclaration::semantic(Scop - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *s = (*members)[i]; -+ -+ // Ungag errors when not speculative -+ Ungag ungag = ungagSpeculative(); - s->semantic(sc); - } - -- if (global.gag && global.gaggedErrors != errors) -- { // The type is no good, yet the error messages were gagged. -+ if (global.errors != errors) -+ { // The type is no good. - type = Type::terror; - } - -@@ -1460,6 +1478,13 @@ void InterfaceDeclaration::semantic(Scop - //members->print(); - sc->pop(); - //printf("-InterfaceDeclaration::semantic(%s), type = %p\n", toChars(), type); -+ -+ if (type->ty == Tclass && ((TypeClass *)type)->sym != this) -+ { -+ error("failed semantic analysis"); -+ this->errors = true; -+ type = Type::terror; -+ } - } - - -@@ -1594,7 +1619,7 @@ BaseClass::BaseClass() - memset(this, 0, sizeof(BaseClass)); - } - --BaseClass::BaseClass(Type *type, enum PROT protection) -+BaseClass::BaseClass(Type *type, PROT protection) - { - //printf("BaseClass(this = %p, '%s')\n", this, type->toChars()); - this->type = type; -@@ -1619,7 +1644,6 @@ BaseClass::BaseClass(Type *type, enum PR - - int BaseClass::fillVtbl(ClassDeclaration *cd, FuncDeclarations *vtbl, int newinstance) - { -- ClassDeclaration *id = base; - int result = 0; - - //printf("BaseClass::fillVtbl(this='%s', cd='%s')\n", base->toChars(), cd->toChars()); -@@ -1651,8 +1675,7 @@ int BaseClass::fillVtbl(ClassDeclaration - if (newinstance && - fd->toParent() != cd && - ifd->toParent() == base) -- cd->error("interface function %s.%s is not implemented", -- id->toChars(), ifd->ident->toChars()); -+ cd->error("interface function '%s' is not implemented", ifd->toFullSignature()); - - if (fd->toParent() == cd) - result = 1; -@@ -1662,9 +1685,7 @@ int BaseClass::fillVtbl(ClassDeclaration - //printf(" not found\n"); - // BUG: should mark this class as abstract? - if (!cd->isAbstract()) -- cd->error("interface function %s.%s%s isn't implemented", -- id->toChars(), ifd->ident->toChars(), -- Parameter::argsTypesToChars(tf->parameters, tf->varargs)); -+ cd->error("interface function '%s' is not implemented", ifd->toFullSignature()); - - fd = NULL; - } ---- a/src/gcc/d/dfrontend/clone.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/clone.c 2014-04-01 16:32:51.000000000 +0100 -@@ -25,43 +25,71 @@ - - - /******************************************* -+ * Merge function attributes pure, nothrow, @safe, and @disable -+ */ -+StorageClass mergeFuncAttrs(StorageClass s1, StorageClass s2) -+{ -+ StorageClass stc = 0; -+ StorageClass sa = s1 & s2; -+ StorageClass so = s1 | s2; -+ -+ if (so & STCsystem) -+ stc |= STCsystem; -+ else if (sa & STCtrusted) -+ stc |= STCtrusted; -+ else if ((so & (STCtrusted | STCsafe)) == (STCtrusted | STCsafe)) -+ stc |= STCtrusted; -+ else if (sa & STCsafe) -+ stc |= STCsafe; -+ -+ if (sa & STCpure) -+ stc |= STCpure; -+ -+ if (sa & STCnothrow) -+ stc |= STCnothrow; -+ -+ if (so & STCdisable) -+ stc |= STCdisable; -+ -+ return stc; -+} -+ -+/******************************************* - * Check given opAssign symbol is really identity opAssign or not. - */ - --FuncDeclaration *AggregateDeclaration::hasIdentityOpAssign(Scope *sc, Dsymbol *assign) -+FuncDeclaration *AggregateDeclaration::hasIdentityOpAssign(Scope *sc) - { -+ Dsymbol *assign = search_function(this, Id::assign); - if (assign) - { -- assert(assign->ident == Id::assign); -- - /* check identity opAssign exists - */ - Expression *er = new NullExp(loc, type); // dummy rvalue - Expression *el = new IdentifierExp(loc, Id::p); // dummy lvalue - el->type = type; -- Expressions ar; ar.push(er); -- Expressions al; al.push(el); -+ Expressions *a = new Expressions(); -+ a->setDim(1); - FuncDeclaration *f = NULL; -- if (FuncDeclaration *fd = assign->isFuncDeclaration()) -+ -+ unsigned errors = global.startGagging(); // Do not report errors, even if the -+ unsigned oldspec = global.speculativeGag; // template opAssign fbody makes it. -+ global.speculativeGag = global.gag; -+ sc = sc->push(); -+ sc->speculative = true; -+ -+ for (size_t i = 0; i < 2; i++) - { -- f = fd->overloadResolve(loc, er, &ar, 1); -- if (!f) f = fd->overloadResolve(loc, er, &al, 1); -+ (*a)[0] = (i == 0 ? er : el); -+ f = resolveFuncCall(loc, sc, assign, NULL, type, a, 1); -+ if (f) -+ break; - } -- if (TemplateDeclaration *td = assign->isTemplateDeclaration()) -- { -- unsigned errors = global.startGagging(); // Do not report errors, even if the -- unsigned oldspec = global.speculativeGag; // template opAssign fbody makes it. -- global.speculativeGag = global.gag; -- Scope *sc2 = sc->push(); -- sc2->speculative = true; - -- f = td->deduceFunctionTemplate(sc2, loc, NULL, er, &ar, 1); -- if (!f) f = td->deduceFunctionTemplate(sc2, loc, NULL, er, &al, 1); -+ sc = sc->pop(); -+ global.speculativeGag = oldspec; -+ global.endGagging(errors); - -- sc2->pop(); -- global.speculativeGag = oldspec; -- global.endGagging(errors); -- } - if (f) - { - int varargs; -@@ -104,16 +132,13 @@ int StructDeclaration::needOpAssign() - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - if (v->storage_class & STCref) - continue; -- Type *tv = v->type->toBasetype(); -- while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- tv = tv->nextOf()->toBasetype(); -- } -+ Type *tv = v->type->baseElemOf(); - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->needOpAssign()) - goto Lneed; -@@ -133,41 +158,80 @@ Lneed: - * Build opAssign for struct. - * ref S opAssign(S s) { ... } - * -- * Note that s will be constructed onto the stack, probably copy-constructed. -- * Then, the body is: -- * S tmp = this; // bit copy -- * this = s; // bit copy -- * tmp.dtor(); -+ * Note that s will be constructed onto the stack, and probably -+ * copy-constructed in caller site. -+ * -+ * If S has copy copy construction and/or destructor, -+ * the body will make bit-wise object swap: -+ * S __tmp = this; // bit copy -+ * this = s; // bit copy -+ * __tmp.dtor(); - * Instead of running the destructor on s, run it on tmp instead. -+ * -+ * Otherwise, the body will make member-wise assignments: -+ * Then, the body is: -+ * this.field1 = s.field1; -+ * this.field2 = s.field2; -+ * ...; - */ - - FuncDeclaration *StructDeclaration::buildOpAssign(Scope *sc) - { -- Dsymbol *assign = search_function(this, Id::assign); -- if (assign) -+ if (FuncDeclaration *f = hasIdentityOpAssign(sc)) - { -- if (FuncDeclaration *f = hasIdentityOpAssign(sc, assign)) -- return f; -- // Even if non-identity opAssign is defined, built-in identity opAssign -- // will be defined. (Is this an exception of operator overloading rule?) -+ hasIdentityAssign = 1; -+ return f; - } -+ // Even if non-identity opAssign is defined, built-in identity opAssign -+ // will be defined. - - if (!needOpAssign()) - return NULL; - - //printf("StructDeclaration::buildOpAssign() %s\n", toChars()); -+ StorageClass stc = STCsafe | STCnothrow | STCpure; -+ Loc declLoc = this->loc; -+ Loc loc = Loc(); // internal code should have no loc to prevent coverage -+ -+ if (dtor || postblit) -+ { -+ if (dtor) -+ stc = mergeFuncAttrs(stc, dtor->storage_class); -+ } -+ else -+ { -+ for (size_t i = 0; i < fields.dim; i++) -+ { -+ Dsymbol *s = fields[i]; -+ VarDeclaration *v = s->isVarDeclaration(); -+ assert(v && v->isField()); -+ if (v->storage_class & STCref) -+ continue; -+ Type *tv = v->type->baseElemOf(); -+ if (tv->ty == Tstruct) -+ { -+ TypeStruct *ts = (TypeStruct *)tv; -+ StructDeclaration *sd = ts->sym; -+ if (FuncDeclaration *f = sd->hasIdentityOpAssign(sc)) -+ stc = mergeFuncAttrs(stc, f->storage_class); -+ } -+ } -+ } - - Parameters *fparams = new Parameters; - fparams->push(new Parameter(STCnodtor, type, Id::p, NULL)); -- Type *ftype = new TypeFunction(fparams, handle, FALSE, LINKd); -- ((TypeFunction *)ftype)->isref = 1; -+ Type *tf = new TypeFunction(fparams, handle, 0, LINKd, stc | STCref); - -- FuncDeclaration *fop = new FuncDeclaration(loc, 0, Id::assign, STCundefined, ftype); -+ FuncDeclaration *fop = new FuncDeclaration(declLoc, Loc(), Id::assign, stc, tf); - - Expression *e = NULL; -- if (postblit) -- { /* Swap: -- * tmp = *this; *this = s; tmp.dtor(); -+ if (stc & STCdisable) -+ { -+ } -+ else if (dtor || postblit) -+ { -+ /* Do swap this and rhs -+ * tmp = this; this = s; tmp.dtor(); - */ - //printf("\tswap copy\n"); - Identifier *idtmp = Lexer::uniqueId("__tmp"); -@@ -175,20 +239,20 @@ FuncDeclaration *StructDeclaration::buil - AssignExp *ec = NULL; - if (dtor) - { -- tmp = new VarDeclaration(0, type, idtmp, new VoidInitializer(0)); -+ tmp = new VarDeclaration(loc, type, idtmp, new VoidInitializer(loc)); - tmp->noscope = 1; - tmp->storage_class |= STCctfe; -- e = new DeclarationExp(0, tmp); -- ec = new AssignExp(0, -- new VarExp(0, tmp), -- new ThisExp(0) -+ e = new DeclarationExp(loc, tmp); -+ ec = new AssignExp(loc, -+ new VarExp(loc, tmp), -+ new ThisExp(loc) - ); - ec->op = TOKblit; - e = Expression::combine(e, ec); - } -- ec = new AssignExp(0, -- new ThisExp(0), -- new IdentifierExp(0, Id::p)); -+ ec = new AssignExp(loc, -+ new ThisExp(loc), -+ new IdentifierExp(loc, Id::p)); - ec->op = TOKblit; - e = Expression::combine(e, ec); - if (dtor) -@@ -196,38 +260,44 @@ FuncDeclaration *StructDeclaration::buil - /* Instead of running the destructor on s, run it - * on tmp. This avoids needing to copy tmp back in to s. - */ -- Expression *ec2 = new DotVarExp(0, new VarExp(0, tmp), dtor, 0); -- ec2 = new CallExp(0, ec2); -+ Expression *ec2 = new DotVarExp(loc, new VarExp(loc, tmp), dtor, 0); -+ ec2 = new CallExp(loc, ec2); - e = Expression::combine(e, ec2); - } - } - else -- { /* Do memberwise copy -+ { -+ /* Do memberwise copy - */ - //printf("\tmemberwise copy\n"); - for (size_t i = 0; i < fields.dim; i++) - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - // this.v = s.v; -- AssignExp *ec = new AssignExp(0, -- new DotVarExp(0, new ThisExp(0), v, 0), -- new DotVarExp(0, new IdentifierExp(0, Id::p), v, 0)); -+ AssignExp *ec = new AssignExp(loc, -+ new DotVarExp(loc, new ThisExp(loc), v, 0), -+ new DotVarExp(loc, new IdentifierExp(loc, Id::p), v, 0)); - e = Expression::combine(e, ec); - } - } -- Statement *s1 = new ExpStatement(0, e); -+ if (e) -+ { -+ Statement *s1 = new ExpStatement(loc, e); - -- /* Add: -- * return this; -- */ -- e = new ThisExp(0); -- Statement *s2 = new ReturnStatement(0, e); -+ /* Add: -+ * return this; -+ */ -+ e = new ThisExp(loc); -+ Statement *s2 = new ReturnStatement(loc, e); - -- fop->fbody = new CompoundStatement(0, s1, s2); -+ fop->fbody = new CompoundStatement(loc, s1, s2); -+ } - - Dsymbol *s = fop; -+#if 1 // workaround until fixing issue 1528 -+ Dsymbol *assign = search_function(this, Id::assign); - if (assign && assign->isTemplateDeclaration()) - { - // Wrap a template around the function declaration -@@ -238,6 +308,7 @@ FuncDeclaration *StructDeclaration::buil - new TemplateDeclaration(assign->loc, fop->ident, tpl, NULL, decldefs, 0); - s = tempdecl; - } -+#endif - members->push(s); - s->addMember(sc, this, 1); - this->hasIdentityAssign = 1; // temporary mark identity assignable -@@ -281,10 +352,8 @@ int StructDeclaration::needOpEquals() - if (hasIdentityEquals) - goto Lneed; - --#if 0 - if (isUnionDeclaration()) - goto Ldontneed; --#endif - - /* If any of the fields has an opEquals, then we - * need it too. -@@ -293,24 +362,22 @@ int StructDeclaration::needOpEquals() - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - if (v->storage_class & STCref) - continue; - Type *tv = v->type->toBasetype(); --#if 0 - if (tv->isfloating()) - goto Lneed; - if (tv->ty == Tarray) - goto Lneed; -+ if (tv->ty == Taarray) -+ goto Lneed; - if (tv->ty == Tclass) - goto Lneed; --#endif -- while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- tv = tv->nextOf()->toBasetype(); -- } -+ tv = tv->baseElemOf(); - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->needOpEquals()) - goto Lneed; -@@ -326,180 +393,299 @@ Lneed: - #undef X - } - -+FuncDeclaration *AggregateDeclaration::hasIdentityOpEquals(Scope *sc) -+{ -+ Dsymbol *eq = search_function(this, Id::eq); -+ if (eq) -+ { -+ /* check identity opEquals exists -+ */ -+ Expression *er = new NullExp(loc, NULL); // dummy rvalue -+ Expression *el = new IdentifierExp(loc, Id::p); // dummy lvalue -+ Expressions *a = new Expressions(); -+ a->setDim(1); -+ for (size_t i = 0; ; i++) -+ { -+ Type *tthis; -+ if (i == 0) tthis = type; -+ if (i == 1) tthis = type->constOf(); -+ if (i == 2) tthis = type->immutableOf(); -+ if (i == 3) tthis = type->sharedOf(); -+ if (i == 4) tthis = type->sharedConstOf(); -+ if (i == 5) break; -+ FuncDeclaration *f = NULL; -+ -+ unsigned errors = global.startGagging(); // Do not report errors, even if the -+ unsigned oldspec = global.speculativeGag; // template opAssign fbody makes it. -+ global.speculativeGag = global.gag; -+ sc = sc->push(); -+ sc->speculative = true; -+ -+ for (size_t j = 0; j < 2; j++) -+ { -+ (*a)[0] = (j == 0 ? er : el); -+ (*a)[0]->type = tthis; -+ f = resolveFuncCall(loc, sc, eq, NULL, tthis, a, 1); -+ if (f) -+ break; -+ } -+ -+ sc = sc->pop(); -+ global.speculativeGag = oldspec; -+ global.endGagging(errors); -+ -+ if (f) -+ return f; -+ } -+ } -+ return NULL; -+} -+ - /****************************************** - * Build opEquals for struct. - * const bool opEquals(const S s) { ... } -+ * -+ * By fixing bugzilla 3789, opEquals is changed to be never implicitly generated. -+ * Now, struct objects comparison s1 == s2 is translated to: -+ * s1.tupleof == s2.tupleof -+ * to calculate structural equality. See EqualExp::semantic. - */ - - FuncDeclaration *StructDeclaration::buildOpEquals(Scope *sc) - { -- Dsymbol *eq = search_function(this, Id::eq); -- if (eq) -+ if (FuncDeclaration *f = hasIdentityOpEquals(sc)) - { -- for (size_t i = 0; i <= 1; i++) -- { -- Expression *e = -- i == 0 ? new NullExp(loc, type->constOf()) // dummy rvalue -- : type->constOf()->defaultInit(); // dummy lvalue -- Expressions *arguments = new Expressions(); -- arguments->push(e); -+ hasIdentityEquals = 1; -+ } -+ return NULL; -+} - -- // check identity opEquals exists -- FuncDeclaration *fd = eq->isFuncDeclaration(); -- if (fd) -- { fd = fd->overloadResolve(loc, e, arguments, 1); -- if (fd && !(fd->storage_class & STCdisable)) -- return fd; -- } -+/****************************************** -+ * Build __xopEquals for TypeInfo_Struct -+ * static bool __xopEquals(ref const S p, ref const S q) -+ * { -+ * return p == q; -+ * } -+ * -+ * This is called by TypeInfo.equals(p1, p2). If the struct does not support -+ * const objects comparison, it will throw "not implemented" Error in runtime. -+ */ -+ -+FuncDeclaration *StructDeclaration::buildXopEquals(Scope *sc) -+{ -+ if (!needOpEquals()) -+ return NULL; // bitwise comparison would work - -- TemplateDeclaration *td = eq->isTemplateDeclaration(); -- if (td) -- { fd = td->deduceFunctionTemplate(sc, loc, NULL, e, arguments, 1); -- if (fd && !(fd->storage_class & STCdisable)) -- return fd; -+ //printf("StructDeclaration::buildXopEquals() %s\n", toChars()); -+ if (Dsymbol *eq = search_function(this, Id::eq)) -+ { -+ if (FuncDeclaration *fd = eq->isFuncDeclaration()) -+ { -+ TypeFunction *tfeqptr; -+ { -+ Scope sc; -+ -+ /* const bool opEquals(ref const S s); -+ */ -+ Parameters *parameters = new Parameters; -+ parameters->push(new Parameter(STCref | STCconst, type, NULL, NULL)); -+ tfeqptr = new TypeFunction(parameters, Type::tbool, 0, LINKd); -+ tfeqptr->mod = MODconst; -+ tfeqptr = (TypeFunction *)tfeqptr->semantic(Loc(), &sc); - } -+ fd = fd->overloadExactMatch(tfeqptr); -+ if (fd) -+ return fd; - } -- return NULL; - } - -- if (!needOpEquals()) -- return NULL; -+ if (!xerreq) -+ { -+ Identifier *id = Lexer::idPool("_xopEquals"); -+ Expression *e = new IdentifierExp(loc, Id::empty); -+ e = new DotIdExp(loc, e, Id::object); -+ e = new DotIdExp(loc, e, id); -+ e = e->semantic(sc); -+ Dsymbol *s = getDsymbol(e); -+ if (!s) -+ { -+ ::error(Loc(), "ICE: %s not found in object module. You must update druntime", id->toChars()); -+ fatal(); -+ } -+ assert(s); -+ xerreq = s->isFuncDeclaration(); -+ } - -- //printf("StructDeclaration::buildOpEquals() %s\n", toChars()); -+ Loc declLoc = Loc(); // loc is unnecessary so __xopEquals is never called directly -+ Loc loc = Loc(); // loc is unnecessary so errors are gagged - - Parameters *parameters = new Parameters; -- parameters->push(new Parameter(STCin, type, Id::p, NULL)); -+ parameters->push(new Parameter(STCref | STCconst, type, Id::p, NULL)); -+ parameters->push(new Parameter(STCref | STCconst, type, Id::q, NULL)); - TypeFunction *tf = new TypeFunction(parameters, Type::tbool, 0, LINKd); -- tf->mod = MODconst; - tf = (TypeFunction *)tf->semantic(loc, sc); - -- FuncDeclaration *fop = new FuncDeclaration(loc, 0, Id::eq, STCundefined, tf); -- -- Expression *e = NULL; -- /* Do memberwise compare -- */ -- //printf("\tmemberwise compare\n"); -- for (size_t i = 0; i < fields.dim; i++) -- { -- Dsymbol *s = fields[i]; -- VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -- if (v->storage_class & STCref) -- assert(0); // what should we do with this? -- // this.v == s.v; -- EqualExp *ec = new EqualExp(TOKequal, loc, -- new DotVarExp(loc, new ThisExp(loc), v, 0), -- new DotVarExp(loc, new IdentifierExp(loc, Id::p), v, 0)); -- if (e) -- e = new AndAndExp(loc, e, ec); -- else -- e = ec; -- } -- if (!e) -- e = new IntegerExp(loc, 1, Type::tbool); -- fop->fbody = new ReturnStatement(loc, e); -+ Identifier *id = Lexer::idPool("__xopEquals"); -+ FuncDeclaration *fop = new FuncDeclaration(declLoc, Loc(), id, STCstatic, tf); - -- members->push(fop); -- fop->addMember(sc, this, 1); -+ Expression *e1 = new IdentifierExp(loc, Id::p); -+ Expression *e2 = new IdentifierExp(loc, Id::q); -+ Expression *e = new EqualExp(TOKequal, loc, e1, e2); - -- sc = sc->push(); -- sc->stc = 0; -- sc->linkage = LINKd; -+ fop->fbody = new ReturnStatement(loc, e); - -- fop->semantic(sc); -+ unsigned errors = global.startGagging(); // Do not report errors -+ Scope *sc2 = sc->push(); -+ sc2->stc = 0; -+ sc2->linkage = LINKd; - -- sc->pop(); -+ fop->semantic(sc2); -+ fop->semantic2(sc2); - -- //printf("-StructDeclaration::buildOpEquals() %s\n", toChars()); -+ sc2->pop(); -+ if (global.endGagging(errors)) // if errors happened -+ fop = xerreq; - - return fop; - } - - /****************************************** -- * Build __xopEquals for TypeInfo_Struct -- * bool __xopEquals(in void* p, in void* q) { ... } -+ * Build __xopCmp for TypeInfo_Struct -+ * static bool __xopCmp(ref const S p, ref const S q) -+ * { -+ * return p.opCmp(q); -+ * } -+ * -+ * This is called by TypeInfo.compare(p1, p2). If the struct does not support -+ * const objects comparison, it will throw "not implemented" Error in runtime. - */ - --FuncDeclaration *StructDeclaration::buildXopEquals(Scope *sc) -+FuncDeclaration *StructDeclaration::buildXopCmp(Scope *sc) - { -- if (!search_function(this, Id::eq)) -+ //printf("StructDeclaration::buildXopCmp() %s\n", toChars()); -+ if (Dsymbol *cmp = search_function(this, Id::cmp)) -+ { -+ if (FuncDeclaration *fd = cmp->isFuncDeclaration()) -+ { -+ TypeFunction *tfcmpptr; -+ { -+ Scope sc; -+ -+ /* const int opCmp(ref const S s); -+ */ -+ Parameters *parameters = new Parameters; -+ parameters->push(new Parameter(STCref | STCconst, type, NULL, NULL)); -+ tfcmpptr = new TypeFunction(parameters, Type::tint32, 0, LINKd); -+ tfcmpptr->mod = MODconst; -+ tfcmpptr = (TypeFunction *)tfcmpptr->semantic(Loc(), &sc); -+ } -+ fd = fd->overloadExactMatch(tfcmpptr); -+ if (fd) -+ return fd; -+ } -+ } -+ else -+ { -+#if 0 // FIXME: doesn't work for recursive alias this -+ /* Check opCmp member exists. -+ * Consider 'alias this', but except opDispatch. -+ */ -+ Expression *e = new DsymbolExp(loc, this); -+ e = new DotIdExp(loc, e, Id::cmp); -+ Scope *sc2 = sc->push(); -+ e = e->trySemantic(sc2); -+ sc2->pop(); -+ if (e) -+ { -+ Dsymbol *s = NULL; -+ switch (e->op) -+ { -+ case TOKoverloadset: s = ((OverExp *)e)->vars; break; -+ case TOKimport: s = ((ScopeExp *)e)->sds; break; -+ case TOKvar: s = ((VarExp *)e)->var; break; -+ default: break; -+ } -+ if (!s || s->ident != Id::cmp) -+ e = NULL; // there's no valid member 'opCmp' -+ } -+ if (!e) -+ return NULL; // bitwise comparison would work -+ /* Essentially, a struct which does not define opCmp is not comparable. -+ * At this time, typeid(S).compare might be correct that throwing "not implement" Error. -+ * But implementing it would break existing code, such as: -+ * -+ * struct S { int value; } // no opCmp -+ * int[S] aa; // Currently AA key uses bitwise comparison -+ * // (It's default behavior of TypeInfo_Strust.compare). -+ * -+ * Not sure we should fix this inconsistency, so just keep current behavior. -+ */ -+#else - return NULL; -+#endif -+ } - -- /* static bool__xopEquals(in void* p, in void* q) { -- * return ( *cast(const S*)(p) ).opEquals( *cast(const S*)(q) ); -- * } -- */ -+ if (!xerrcmp) -+ { -+ Identifier *id = Lexer::idPool("_xopCmp"); -+ Expression *e = new IdentifierExp(loc, Id::empty); -+ e = new DotIdExp(loc, e, Id::object); -+ e = new DotIdExp(loc, e, id); -+ e = e->semantic(sc); -+ Dsymbol *s = getDsymbol(e); -+ if (!s) -+ { -+ ::error(Loc(), "ICE: %s not found in object module. You must update druntime", id->toChars()); -+ fatal(); -+ } -+ assert(s); -+ xerrcmp = s->isFuncDeclaration(); -+ } - -- Parameters *parameters = new Parameters; -- parameters->push(new Parameter(STCin, Type::tvoidptr, Id::p, NULL)); -- parameters->push(new Parameter(STCin, Type::tvoidptr, Id::q, NULL)); -- TypeFunction *tf = new TypeFunction(parameters, Type::tbool, 0, LINKd); -- tf = (TypeFunction *)tf->semantic(0, sc); -+ Loc declLoc = Loc(); // loc is unnecessary so __xopCmp is never called directly -+ Loc loc = Loc(); // loc is unnecessary so errors are gagged - -- Identifier *id = Lexer::idPool("__xopEquals"); -- FuncDeclaration *fop = new FuncDeclaration(0, 0, id, STCstatic, tf); -+ Parameters *parameters = new Parameters; -+ parameters->push(new Parameter(STCref | STCconst, type, Id::p, NULL)); -+ parameters->push(new Parameter(STCref | STCconst, type, Id::q, NULL)); -+ TypeFunction *tf = new TypeFunction(parameters, Type::tint32, 0, LINKd); -+ tf = (TypeFunction *)tf->semantic(loc, sc); - -- Expression *e = new CallExp(0, -- new DotIdExp(0, -- new PtrExp(0, new CastExp(0, -- new IdentifierExp(0, Id::p), type->pointerTo()->constOf())), -- Id::eq), -- new PtrExp(0, new CastExp(0, -- new IdentifierExp(0, Id::q), type->pointerTo()->constOf()))); -+ Identifier *id = Lexer::idPool("__xopCmp"); -+ FuncDeclaration *fop = new FuncDeclaration(declLoc, Loc(), id, STCstatic, tf); - -- fop->fbody = new ReturnStatement(0, e); -+ Expression *e1 = new IdentifierExp(loc, Id::p); -+ Expression *e2 = new IdentifierExp(loc, Id::q); -+ Expression *e = new CallExp(loc, new DotIdExp(loc, e1, Id::cmp), e2); - -- size_t index = members->dim; -- members->push(fop); -+ fop->fbody = new ReturnStatement(loc, e); - -- unsigned errors = global.startGagging(); // Do not report errors, even if the -- unsigned oldspec = global.speculativeGag; // template opAssign fbody makes it. -- global.speculativeGag = global.gag; -+ unsigned errors = global.startGagging(); // Do not report errors - Scope *sc2 = sc->push(); - sc2->stc = 0; - sc2->linkage = LINKd; -- sc2->speculative = true; - - fop->semantic(sc2); - fop->semantic2(sc2); -- fop->semantic3(sc2); - - sc2->pop(); -- global.speculativeGag = oldspec; - if (global.endGagging(errors)) // if errors happened -- { -- members->remove(index); -- -- if (!xerreq) -- { -- Expression *e = new IdentifierExp(0, Id::empty); -- e = new DotIdExp(0, e, Id::object); -- e = new DotIdExp(0, e, Lexer::idPool("_xopEquals")); -- e = e->semantic(sc); -- Dsymbol *s = getDsymbol(e); -- FuncDeclaration *fd = s->isFuncDeclaration(); -- -- xerreq = fd; -- } -- fop = xerreq; -- } -- else -- fop->addMember(sc, this, 1); -+ fop = xerrcmp; - - return fop; - } - -- - /******************************************* - * Build copy constructor for struct. -+ * void __cpctpr(ref const S s) const [pure nothrow @trusted] -+ * { -+ * (*cast(S*)&this) = *cast(S*)s; -+ * (*cast(S*)&this).postBlit(); -+ * } -+ * - * Copy constructors are compiler generated only, and are only - * callable from the compiler. They are not user accessible. -- * A copy constructor is: -- * void cpctpr(ref const S s) const -- * { -- * (*cast(S*)&this) = *cast(S*)s; -- * (*cast(S*)&this).postBlit(); -- * } -+ * - * This is done so: - * - postBlit() never sees uninitialized data - * - memcpy can be much more efficient than memberwise copy -@@ -508,62 +694,59 @@ FuncDeclaration *StructDeclaration::buil - - FuncDeclaration *StructDeclaration::buildCpCtor(Scope *sc) - { -- //printf("StructDeclaration::buildCpCtor() %s\n", toChars()); -- FuncDeclaration *fcp = NULL; -- - /* Copy constructor is only necessary if there is a postblit function, - * otherwise the code generator will just do a bit copy. - */ -- if (postblit) -- { -- //printf("generating cpctor\n"); -- -- StorageClass stc = postblit->storage_class & -- (STCdisable | STCsafe | STCtrusted | STCsystem | STCpure | STCnothrow); -- if (stc & (STCsafe | STCtrusted)) -- stc = stc & ~STCsafe | STCtrusted; -- -- Parameters *fparams = new Parameters; -- fparams->push(new Parameter(STCref, type->constOf(), Id::p, NULL)); -- Type *ftype = new TypeFunction(fparams, Type::tvoid, FALSE, LINKd, stc); -- ftype->mod = MODconst; -- -- fcp = new FuncDeclaration(loc, 0, Id::cpctor, stc, ftype); -- -- if (!(fcp->storage_class & STCdisable)) -- { -- // Build *this = p; -- Expression *e = new ThisExp(0); -- AssignExp *ea = new AssignExp(0, -- new PtrExp(0, new CastExp(0, new AddrExp(0, e), type->mutableOf()->pointerTo())), -- new PtrExp(0, new CastExp(0, new AddrExp(0, new IdentifierExp(0, Id::p)), type->mutableOf()->pointerTo())) -- ); -- ea->op = TOKblit; -- Statement *s = new ExpStatement(0, ea); -- -- // Build postBlit(); -- e = new ThisExp(0); -- e = new PtrExp(0, new CastExp(0, new AddrExp(0, e), type->mutableOf()->pointerTo())); -- e = new DotVarExp(0, e, postblit, 0); -- e = new CallExp(0, e); -+ if (!postblit) -+ return NULL; - -- s = new CompoundStatement(0, s, new ExpStatement(0, e)); -- fcp->fbody = s; -- } -- else -- fcp->fbody = new ExpStatement(0, (Expression *)NULL); -+ //printf("StructDeclaration::buildCpCtor() %s\n", toChars()); -+ StorageClass stc = STCsafe | STCnothrow | STCpure; -+ Loc declLoc = postblit->loc; -+ Loc loc = Loc(); // internal code should have no loc to prevent coverage -+ -+ stc = mergeFuncAttrs(stc, postblit->storage_class); -+ if (stc & STCsafe) // change to @trusted for unsafe casts -+ stc = (stc & ~STCsafe) | STCtrusted; - -- members->push(fcp); -+ Parameters *fparams = new Parameters; -+ fparams->push(new Parameter(STCref, type->constOf(), Id::p, NULL)); -+ Type *tf = new TypeFunction(fparams, Type::tvoid, 0, LINKd, stc); -+ tf->mod = MODconst; - -- sc = sc->push(); -- sc->stc = 0; -- sc->linkage = LINKd; -+ FuncDeclaration *fcp = new FuncDeclaration(declLoc, Loc(), Id::cpctor, stc, tf); - -- fcp->semantic(sc); -+ if (!(stc & STCdisable)) -+ { -+ // Build *this = p; -+ Expression *e = new ThisExp(loc); -+ AssignExp *ea = new AssignExp(loc, -+ new PtrExp(loc, new CastExp(loc, new AddrExp(loc, e), type->mutableOf()->pointerTo())), -+ new PtrExp(loc, new CastExp(loc, new AddrExp(loc, new IdentifierExp(loc, Id::p)), type->mutableOf()->pointerTo())) -+ ); -+ ea->op = TOKblit; -+ Statement *s = new ExpStatement(loc, ea); -+ -+ // Build postBlit(); -+ e = new ThisExp(loc); -+ e = new PtrExp(loc, new CastExp(loc, new AddrExp(loc, e), type->mutableOf()->pointerTo())); -+ e = new DotVarExp(loc, e, postblit, 0); -+ e = new CallExp(loc, e); - -- sc->pop(); -+ s = new CompoundStatement(loc, s, new ExpStatement(loc, e)); -+ fcp->fbody = s; - } - -+ members->push(fcp); -+ -+ sc = sc->push(); -+ sc->stc = 0; -+ sc->linkage = LINKd; -+ -+ fcp->semantic(sc); -+ -+ sc->pop(); -+ - return fcp; - } - -@@ -579,30 +762,33 @@ FuncDeclaration *StructDeclaration::buil - FuncDeclaration *StructDeclaration::buildPostBlit(Scope *sc) - { - //printf("StructDeclaration::buildPostBlit() %s\n", toChars()); -- Expression *e = NULL; -- StorageClass stc = 0; -+ StorageClass stc = STCsafe | STCnothrow | STCpure; -+ Loc declLoc = postblits.dim ? postblits[0]->loc : this->loc; -+ Loc loc = Loc(); // internal code should have no loc to prevent coverage - -+ Expression *e = NULL; - for (size_t i = 0; i < fields.dim; i++) - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - if (v->storage_class & STCref) - continue; - Type *tv = v->type->toBasetype(); - dinteger_t dim = 1; - while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- dim *= ((TypeSArray *)tv)->dim->toInteger(); -- tv = tv->nextOf()->toBasetype(); -+ { -+ TypeSArray *tsa = (TypeSArray *)tv; -+ dim *= tsa->dim->toInteger(); -+ tv = tsa->next->toBasetype(); - } - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->postblit && dim) - { -- stc |= sd->postblit->storage_class & STCdisable; -- -+ stc = mergeFuncAttrs(stc, sd->postblit->storage_class); - if (stc & STCdisable) - { - e = NULL; -@@ -610,24 +796,24 @@ FuncDeclaration *StructDeclaration::buil - } - - // this.v -- Expression *ex = new ThisExp(0); -- ex = new DotVarExp(0, ex, v, 0); -+ Expression *ex = new ThisExp(loc); -+ ex = new DotVarExp(loc, ex, v, 0); - - if (v->type->toBasetype()->ty == Tstruct) - { // this.v.postblit() -- ex = new DotVarExp(0, ex, sd->postblit, 0); -- ex = new CallExp(0, ex); -+ ex = new DotVarExp(loc, ex, sd->postblit, 0); -+ ex = new CallExp(loc, ex); - } - else - { - // Typeinfo.postblit(cast(void*)&this.v); -- Expression *ea = new AddrExp(0, ex); -- ea = new CastExp(0, ea, Type::tvoid->pointerTo()); -+ Expression *ea = new AddrExp(loc, ex); -+ ea = new CastExp(loc, ea, Type::tvoid->pointerTo()); - - Expression *et = v->type->getTypeInfo(sc); -- et = new DotIdExp(0, et, Id::postblit); -+ et = new DotIdExp(loc, et, Id::postblit); - -- ex = new CallExp(0, et, ea); -+ ex = new CallExp(loc, et, ea); - } - e = Expression::combine(e, ex); // combine in forward order - } -@@ -638,8 +824,8 @@ FuncDeclaration *StructDeclaration::buil - */ - if (e || (stc & STCdisable)) - { //printf("Building __fieldPostBlit()\n"); -- PostBlitDeclaration *dd = new PostBlitDeclaration(loc, 0, stc, Lexer::idPool("__fieldPostBlit")); -- dd->fbody = new ExpStatement(0, e); -+ PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Lexer::idPool("__fieldPostBlit")); -+ dd->fbody = new ExpStatement(loc, e); - postblits.shift(dd); - members->push(dd); - dd->semantic(sc); -@@ -655,21 +841,23 @@ FuncDeclaration *StructDeclaration::buil - - default: - e = NULL; -+ stc = STCsafe | STCnothrow | STCpure; - for (size_t i = 0; i < postblits.dim; i++) -- { FuncDeclaration *fd = postblits[i]; -- stc |= fd->storage_class & STCdisable; -+ { -+ FuncDeclaration *fd = postblits[i]; -+ stc = mergeFuncAttrs(stc, fd->storage_class); - if (stc & STCdisable) - { - e = NULL; - break; - } -- Expression *ex = new ThisExp(0); -- ex = new DotVarExp(0, ex, fd, 0); -- ex = new CallExp(0, ex); -+ Expression *ex = new ThisExp(loc); -+ ex = new DotVarExp(loc, ex, fd, 0); -+ ex = new CallExp(loc, ex); - e = Expression::combine(e, ex); - } -- PostBlitDeclaration *dd = new PostBlitDeclaration(loc, 0, stc, Lexer::idPool("__aggrPostBlit")); -- dd->fbody = new ExpStatement(0, e); -+ PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Lexer::idPool("__aggrPostBlit")); -+ dd->fbody = new ExpStatement(loc, e); - members->push(dd); - dd->semantic(sc); - return dd; -@@ -689,48 +877,59 @@ FuncDeclaration *StructDeclaration::buil - FuncDeclaration *AggregateDeclaration::buildDtor(Scope *sc) - { - //printf("AggregateDeclaration::buildDtor() %s\n", toChars()); -- Expression *e = NULL; -+ StorageClass stc = STCsafe | STCnothrow | STCpure; -+ Loc declLoc = dtors.dim ? dtors[0]->loc : this->loc; -+ Loc loc = Loc(); // internal code should have no loc to prevent coverage - -+ Expression *e = NULL; - #if DMDV2 - for (size_t i = 0; i < fields.dim; i++) - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - if (v->storage_class & STCref) - continue; - Type *tv = v->type->toBasetype(); - dinteger_t dim = 1; - while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- dim *= ((TypeSArray *)tv)->dim->toInteger(); -- tv = tv->nextOf()->toBasetype(); -+ { -+ TypeSArray *tsa = (TypeSArray *)tv; -+ dim *= tsa->dim->toInteger(); -+ tv = tsa->next->toBasetype(); - } - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->dtor && dim) -- { Expression *ex; -+ { -+ stc = mergeFuncAttrs(stc, sd->dtor->storage_class); -+ if (stc & STCdisable) -+ { -+ e = NULL; -+ break; -+ } - - // this.v -- ex = new ThisExp(0); -- ex = new DotVarExp(0, ex, v, 0); -+ Expression *ex = new ThisExp(loc); -+ ex = new DotVarExp(loc, ex, v, 0); - - if (v->type->toBasetype()->ty == Tstruct) - { // this.v.dtor() -- ex = new DotVarExp(0, ex, sd->dtor, 0); -- ex = new CallExp(0, ex); -+ ex = new DotVarExp(loc, ex, sd->dtor, 0); -+ ex = new CallExp(loc, ex); - } - else - { - // Typeinfo.destroy(cast(void*)&this.v); -- Expression *ea = new AddrExp(0, ex); -- ea = new CastExp(0, ea, Type::tvoid->pointerTo()); -+ Expression *ea = new AddrExp(loc, ex); -+ ea = new CastExp(loc, ea, Type::tvoid->pointerTo()); - - Expression *et = v->type->getTypeInfo(sc); -- et = new DotIdExp(0, et, Id::destroy); -+ et = new DotIdExp(loc, et, Id::destroy); - -- ex = new CallExp(0, et, ea); -+ ex = new CallExp(loc, et, ea); - } - e = Expression::combine(ex, e); // combine in reverse order - } -@@ -739,10 +938,10 @@ FuncDeclaration *AggregateDeclaration::b - - /* Build our own "destructor" which executes e - */ -- if (e) -+ if (e || (stc & STCdisable)) - { //printf("Building __fieldDtor()\n"); -- DtorDeclaration *dd = new DtorDeclaration(loc, 0, Lexer::idPool("__fieldDtor")); -- dd->fbody = new ExpStatement(0, e); -+ DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Lexer::idPool("__fieldDtor")); -+ dd->fbody = new ExpStatement(loc, e); - dtors.shift(dd); - members->push(dd); - dd->semantic(sc); -@@ -759,19 +958,82 @@ FuncDeclaration *AggregateDeclaration::b - - default: - e = NULL; -+ stc = STCsafe | STCnothrow | STCpure; - for (size_t i = 0; i < dtors.dim; i++) -- { FuncDeclaration *fd = dtors[i]; -- Expression *ex = new ThisExp(0); -- ex = new DotVarExp(0, ex, fd, 0); -- ex = new CallExp(0, ex); -+ { -+ FuncDeclaration *fd = dtors[i]; -+ stc = mergeFuncAttrs(stc, fd->storage_class); -+ if (stc & STCdisable) -+ { -+ e = NULL; -+ break; -+ } -+ Expression *ex = new ThisExp(loc); -+ ex = new DotVarExp(loc, ex, fd, 0); -+ ex = new CallExp(loc, ex); - e = Expression::combine(ex, e); - } -- DtorDeclaration *dd = new DtorDeclaration(loc, 0, Lexer::idPool("__aggrDtor")); -- dd->fbody = new ExpStatement(0, e); -+ DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Lexer::idPool("__aggrDtor")); -+ dd->fbody = new ExpStatement(loc, e); - members->push(dd); - dd->semantic(sc); - return dd; - } - } - -+/****************************************** -+ * Create inclusive invariant for struct/class by aggregating -+ * all the invariants in invs[]. -+ * void __invariant() const [pure nothrow @trusted] -+ * { -+ * invs[0](), invs[1](), ...; -+ * } -+ */ -+ -+FuncDeclaration *AggregateDeclaration::buildInv(Scope *sc) -+{ -+ StorageClass stc = STCsafe | STCnothrow | STCpure; -+ Loc declLoc = this->loc; -+ Loc loc = Loc(); // internal code should have no loc to prevent coverage -+ -+ switch (invs.dim) -+ { -+ case 0: -+ return NULL; -+ -+ case 1: -+ // Don't return invs[0] so it has uniquely generated name. -+ /* fall through */ -+ -+ default: -+ Expression *e = NULL; -+ StorageClass stcx = 0; -+ for (size_t i = 0; i < invs.dim; i++) -+ { -+ stc = mergeFuncAttrs(stc, invs[i]->storage_class); -+ if (stc & STCdisable) -+ { -+ // What should do? -+ } -+ StorageClass stcy = invs[i]->storage_class & (STCshared | STCsynchronized); -+ if (i == 0) -+ stcx = stcy; -+ else if (stcx ^ stcy) -+ { -+ #if 1 // currently rejects -+ error(invs[i]->loc, "mixing invariants with shared/synchronized differene is not supported"); -+ e = NULL; -+ break; -+ #endif -+ } -+ e = Expression::combine(e, new CallExp(loc, new VarExp(loc, invs[i]))); -+ } -+ InvariantDeclaration *inv; -+ inv = new InvariantDeclaration(declLoc, Loc(), stc | stcx, Id::classInvariant); -+ inv->fbody = new ExpStatement(loc, e); -+ members->push(inv); -+ inv->semantic(sc); -+ return inv; -+ } -+} - ---- a/src/gcc/d/dfrontend/complex_t.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/complex_t.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,76 @@ -+ -+// Compiler implementation of the D programming language -+// Copyright (c) 1999-2006 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright and Burton Radons -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef DMD_COMPLEX_T_H -+#define DMD_COMPLEX_T_H -+ -+/* Roll our own complex type for compilers that don't support complex -+ */ -+ -+struct complex_t -+{ -+ longdouble re; -+ longdouble im; -+ -+ complex_t() { this->re = 0; this->im = 0; } -+ complex_t(longdouble re) { this->re = re; this->im = 0; } -+ complex_t(double re) { this->re = re; this->im = 0; } -+ complex_t(longdouble re, longdouble im) { this->re = re; this->im = im; } -+ complex_t(double re, double im) { this->re = re; this->im = im; } -+ -+ complex_t operator + (complex_t y) { complex_t r; r.re = re + y.re; r.im = im + y.im; return r; } -+ complex_t operator - (complex_t y) { complex_t r; r.re = re - y.re; r.im = im - y.im; return r; } -+ complex_t operator - () { complex_t r; r.re = -re; r.im = -im; return r; } -+ complex_t operator * (complex_t y) { return complex_t(re * y.re - im * y.im, im * y.re + re * y.im); } -+ -+ complex_t operator / (complex_t y) -+ { -+ longdouble abs_y_re = y.re < 0 ? -y.re : y.re; -+ longdouble abs_y_im = y.im < 0 ? -y.im : y.im; -+ longdouble r, den; -+ -+ if (abs_y_re < abs_y_im) -+ { -+ r = y.re / y.im; -+ den = y.im + r * y.re; -+ return complex_t((re * r + im) / den, -+ (im * r - re) / den); -+ } -+ else -+ { -+ r = y.im / y.re; -+ den = y.re + r * y.im; -+ return complex_t((re + r * im) / den, -+ (im - r * re) / den); -+ } -+ } -+ -+ operator bool () { return re || im; } -+ -+ int operator == (complex_t y) { return re == y.re && im == y.im; } -+ int operator != (complex_t y) { return re != y.re || im != y.im; } -+}; -+ -+inline complex_t operator * (longdouble x, complex_t y) { return complex_t(x) * y; } -+inline complex_t operator * (complex_t x, longdouble y) { return x * complex_t(y); } -+inline complex_t operator / (complex_t x, longdouble y) { return x / complex_t(y); } -+ -+ -+inline longdouble creall(complex_t x) -+{ -+ return x.re; -+} -+ -+inline longdouble cimagl(complex_t x) -+{ -+ return x.im; -+} -+ -+#endif ---- a/src/gcc/d/dfrontend/cond.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/cond.c 2014-04-01 16:32:51.000000000 +0100 -@@ -52,7 +52,7 @@ Condition::Condition(Loc loc) - /* ============================================================ */ - - DVCondition::DVCondition(Module *mod, unsigned level, Identifier *ident) -- : Condition(0) -+ : Condition(Loc()) - { - this->mod = mod; - this->level = level; -@@ -84,16 +84,41 @@ DebugCondition::DebugCondition(Module *m - { - } - -+// Helper for printing dependency information -+void printDepsConditional(Scope *sc, DVCondition* condition, const char* depType) -+{ -+ if (!global.params.moduleDeps || global.params.moduleDepsFile) -+ return; -+ OutBuffer *ob = global.params.moduleDeps; -+ Module* imod = sc ? (sc->instantiatingModule ? sc->instantiatingModule : sc->module) : condition->mod; -+ if (!imod) -+ return; -+ ob->writestring(depType); -+ ob->writestring(imod->toPrettyChars()); -+ ob->writestring(" ("); -+ escapePath(ob, imod->srcfile->toChars()); -+ ob->writestring(") : "); -+ if (condition->ident) -+ ob->printf("%s\n", condition->ident->toChars()); -+ else -+ ob->printf("%d\n", condition->level); -+} -+ -+ - int DebugCondition::include(Scope *sc, ScopeDsymbol *s) - { - //printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel); - if (inc == 0) - { - inc = 2; -+ bool definedInModule = false; - if (ident) - { - if (findCondition(mod->debugids, ident)) -+ { - inc = 1; -+ definedInModule = true; -+ } - else if (findCondition(global.params.debugids, ident)) - inc = 1; - else -@@ -104,6 +129,8 @@ int DebugCondition::include(Scope *sc, S - } - else if (level <= global.params.debuglevel || level <= mod->debuglevel) - inc = 1; -+ if (!definedInModule) -+ printDepsConditional(sc, this, "depsDebug "); - } - return (inc == 1); - } -@@ -123,24 +150,87 @@ void VersionCondition::setGlobalLevel(un - global.params.versionlevel = level; - } - --void VersionCondition::checkPredefined(Loc loc, const char *ident) -+bool VersionCondition::isPredefined(const char *ident) - { - static const char* reserved[] = - { -- "DigitalMars", "X86", "X86_64", -- "Windows", "Win32", "Win64", -+ "DigitalMars", -+ "GNU", -+ "LDC", -+ "SDC", -+ "Windows", -+ "Win32", -+ "Win64", - "linux", --#if DMDV2 -- /* Although Posix is predefined by D1, disallowing its -- * redefinition breaks makefiles and older builds. -- */ -- "Posix", -- "D_NET", --#endif -- "OSX", "FreeBSD", -+ "OSX", -+ "FreeBSD", - "OpenBSD", -+ "NetBSD", -+ "DragonFlyBSD", -+ "BSD", - "Solaris", -- "LittleEndian", "BigEndian", -+ "Posix", -+ "AIX", -+ "Haiku", -+ "SkyOS", -+ "SysV3", -+ "SysV4", -+ "Hurd", -+ "Android", -+ "Cygwin", -+ "MinGW", -+ "X86", -+ "X86_64", -+ "ARM", -+ "ARM_Thumb", -+ "ARM_SoftFloat", -+ "ARM_SoftFP", -+ "ARM_HardFloat", -+ "AArch64", -+ "PPC", -+ "PPC_SoftFloat", -+ "PPC_HardFloat", -+ "PPC64", -+ "IA64", -+ "MIPS32", -+ "MIPS64", -+ "MIPS_O32", -+ "MIPS_N32", -+ "MIPS_O64", -+ "MIPS_N64", -+ "MIPS_EABI", -+ "MIPS_SoftFloat", -+ "MIPS_HardFloat", -+ "SPARC", -+ "SPARC_V8Plus", -+ "SPARC_SoftFloat", -+ "SPARC_HardFloat", -+ "SPARC64", -+ "S390", -+ "S390X", -+ "HPPA", -+ "HPPA64", -+ "SH", -+ "SH64", -+ "Alpha", -+ "Alpha_SoftFloat", -+ "Alpha_HardFloat", -+ "LittleEndian", -+ "BigEndian", -+ "D_Coverage", -+ "D_Ddoc", -+ "D_InlineAsm_X86", -+ "D_InlineAsm_X86_64", -+ "D_LP64", -+ "D_X32", -+ "D_HardFloat", -+ "D_SoftFloat", -+ "D_PIC", -+ "D_SIMD", -+ "D_Version2", -+ "D_NoBoundsChecks", -+ "unittest", -+ "assert", - "all", - "none", - }; -@@ -148,21 +238,17 @@ void VersionCondition::checkPredefined(L - for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) - { - if (strcmp(ident, reserved[i]) == 0) -- goto Lerror; -+ return true; - } - - if (ident[0] == 'D' && ident[1] == '_') -- goto Lerror; -- -- return; -- -- Lerror: -- error(loc, "version identifier '%s' is reserved and cannot be set", ident); -+ return true; -+ return false; - } - - void VersionCondition::addGlobalIdent(const char *ident) - { -- checkPredefined(0, ident); -+ checkPredefined(Loc(), ident); - addPredefinedGlobalIdent(ident); - } - -@@ -186,10 +272,14 @@ int VersionCondition::include(Scope *sc, - if (inc == 0) - { - inc = 2; -+ bool definedInModule=false; - if (ident) - { - if (findCondition(mod->versionids, ident)) -+ { - inc = 1; -+ definedInModule = true; -+ } - else if (findCondition(global.params.versionids, ident)) - inc = 1; - else -@@ -201,6 +291,8 @@ int VersionCondition::include(Scope *sc, - } - else if (level <= global.params.versionlevel || level <= mod->versionlevel) - inc = 1; -+ if (!definedInModule && (!ident || (!isPredefined(ident->toChars()) && ident != Lexer::idPool(Token::toChars(TOKunittest)) && ident != Lexer::idPool(Token::toChars(TOKassert))))) -+ printDepsConditional(sc, this, "depsVersion "); - } - return (inc == 1); - } -@@ -243,9 +335,7 @@ int StaticIfCondition::include(Scope *sc - { - error(loc, (nest > 1000) ? "unresolvable circular static if expression" - : "error evaluating static if expression"); -- if (!global.gag) -- inc = 2; // so we don't see the error message again -- return 0; -+ goto Lerror; - } - - if (!sc) -@@ -259,21 +349,25 @@ int StaticIfCondition::include(Scope *sc - sc = sc->push(sc->scopesym); - sc->sd = s; // s gets any addMember() - sc->flags |= SCOPEstaticif; -+ -+ sc = sc->startCTFE(); - Expression *e = exp->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - sc->pop(); -+ --nest; -+ - if (!e->type->checkBoolean()) - { - if (e->type->toBasetype() != Type::terror) - exp->error("expression %s of type %s does not have a boolean value", exp->toChars(), e->type->toChars()); -- inc = 0; -- return 0; -+ goto Lerror; - } - e = e->ctfeInterpret(); -- --nest; - if (e->op == TOKerror) -- { exp = e; -- inc = 0; -+ { -+ goto Lerror; - } - else if (e->isBool(TRUE)) - inc = 1; -@@ -282,144 +376,20 @@ int StaticIfCondition::include(Scope *sc - else - { - e->error("expression %s is not constant or does not evaluate to a bool", e->toChars()); -- inc = 2; -+ goto Lerror; - } - } - return (inc == 1); -+ -+Lerror: -+ if (!global.gag) -+ inc = 2; // so we don't see the error message again -+ return 0; - } - - void StaticIfCondition::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { -- buf->writestring("static if("); -+ buf->writestring("static if ("); - exp->toCBuffer(buf, hgs); - buf->writeByte(')'); - } -- -- --/**************************** IftypeCondition *******************************/ -- --IftypeCondition::IftypeCondition(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec) -- : Condition(loc) --{ -- this->targ = targ; -- this->id = id; -- this->tok = tok; -- this->tspec = tspec; --} -- --Condition *IftypeCondition::syntaxCopy() --{ -- return new IftypeCondition(loc, -- targ->syntaxCopy(), -- id, -- tok, -- tspec ? tspec->syntaxCopy() : NULL); --} -- --int IftypeCondition::include(Scope *sc, ScopeDsymbol *sd) --{ -- //printf("IftypeCondition::include()\n"); -- if (inc == 0) -- { -- if (!sc) -- { -- error(loc, "iftype conditional cannot be at global scope"); -- inc = 2; -- return 0; -- } -- Type *t = targ->trySemantic(loc, sc); -- if (t) -- targ = t; -- else -- inc = 2; // condition is false -- -- if (!t) -- { -- } -- else if (id && tspec) -- { -- /* Evaluate to TRUE if targ matches tspec. -- * If TRUE, declare id as an alias for the specialized type. -- */ -- -- MATCH m; -- TemplateTypeParameter tp(loc, id, NULL, NULL); -- -- TemplateParameters parameters; -- parameters.setDim(1); -- parameters[0] = &tp; -- -- Objects dedtypes; -- dedtypes.setDim(1); -- -- m = targ->deduceType(sc, tspec, ¶meters, &dedtypes); -- if (m == MATCHnomatch || -- (m != MATCHexact && tok == TOKequal)) -- inc = 2; -- else -- { -- inc = 1; -- Type *tded = (Type *)dedtypes[0]; -- if (!tded) -- tded = targ; -- Dsymbol *s = new AliasDeclaration(loc, id, tded); -- s->semantic(sc); -- sc->insert(s); -- if (sd) -- s->addMember(sc, sd, 1); -- } -- } -- else if (id) -- { -- /* Declare id as an alias for type targ. Evaluate to TRUE -- */ -- Dsymbol *s = new AliasDeclaration(loc, id, targ); -- s->semantic(sc); -- sc->insert(s); -- if (sd) -- s->addMember(sc, sd, 1); -- inc = 1; -- } -- else if (tspec) -- { -- /* Evaluate to TRUE if targ matches tspec -- */ -- tspec = tspec->semantic(loc, sc); -- //printf("targ = %s\n", targ->toChars()); -- //printf("tspec = %s\n", tspec->toChars()); -- if (tok == TOKcolon) -- { if (targ->implicitConvTo(tspec)) -- inc = 1; -- else -- inc = 2; -- } -- else /* == */ -- { if (targ->equals(tspec)) -- inc = 1; -- else -- inc = 2; -- } -- } -- else -- inc = 1; -- //printf("inc = %d\n", inc); -- } -- return (inc == 1); --} -- --void IftypeCondition::toCBuffer(OutBuffer *buf, HdrGenState *hgs) --{ -- buf->writestring("iftype("); -- targ->toCBuffer(buf, id, hgs); -- if (tspec) -- { -- if (tok == TOKcolon) -- buf->writestring(" : "); -- else -- buf->writestring(" == "); -- tspec->toCBuffer(buf, NULL, hgs); -- } -- buf->writeByte(')'); --} -- -- ---- a/src/gcc/d/dfrontend/cond.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/cond.h 2014-04-01 16:32:51.000000000 +0100 -@@ -11,21 +11,22 @@ - #ifndef DMD_DEBCOND_H - #define DMD_DEBCOND_H - --struct Expression; --struct Identifier; -+class Expression; -+class Identifier; - struct OutBuffer; --struct Module; -+class Module; - struct Scope; --struct ScopeDsymbol; --struct DebugCondition; -+class ScopeDsymbol; -+class DebugCondition; - #include "lexer.h" // dmdhg - enum TOK; - struct HdrGenState; - - int findCondition(Strings *ids, Identifier *ident); - --struct Condition -+class Condition - { -+public: - Loc loc; - int inc; // 0: not computed yet - // 1: include -@@ -39,8 +40,9 @@ struct Condition - virtual DebugCondition *isDebugCondition() { return NULL; } - }; - --struct DVCondition : Condition -+class DVCondition : public Condition - { -+public: - unsigned level; - Identifier *ident; - Module *mod; -@@ -50,11 +52,11 @@ struct DVCondition : Condition - Condition *syntaxCopy(); - }; - --struct DebugCondition : DVCondition -+class DebugCondition : public DVCondition - { -+public: - static void setGlobalLevel(unsigned level); - static void addGlobalIdent(const char *ident); -- static void addPredefinedGlobalIdent(const char *ident); - - DebugCondition(Module *mod, unsigned level, Identifier *ident); - -@@ -63,10 +65,16 @@ struct DebugCondition : DVCondition - DebugCondition *isDebugCondition() { return this; } - }; - --struct VersionCondition : DVCondition -+class VersionCondition : public DVCondition - { -+public: - static void setGlobalLevel(unsigned level); -- static void checkPredefined(Loc loc, const char *ident); -+ static bool isPredefined(const char *ident); -+ static void checkPredefined(Loc loc, const char *ident) -+ { -+ if (isPredefined(ident)) -+ error(loc, "version identifier '%s' is reserved and cannot be set", ident); -+ } - static void addGlobalIdent(const char *ident); - static void addPredefinedGlobalIdent(const char *ident); - -@@ -76,8 +84,9 @@ struct VersionCondition : DVCondition - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct StaticIfCondition : Condition -+class StaticIfCondition : public Condition - { -+public: - Expression *exp; - int nest; // limit circular dependencies - -@@ -87,20 +96,4 @@ struct StaticIfCondition : Condition - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct IftypeCondition : Condition --{ -- /* iftype (targ id tok tspec) -- */ -- Type *targ; -- Identifier *id; // can be NULL -- enum TOK tok; // ':' or '==' -- Type *tspec; // can be NULL -- -- IftypeCondition(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec); -- Condition *syntaxCopy(); -- int include(Scope *sc, ScopeDsymbol *s); -- void toCBuffer(OutBuffer *buf, HdrGenState *hgs); --}; -- -- - #endif ---- a/src/gcc/d/dfrontend/constfold.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/constfold.c 2014-04-01 16:32:51.000000000 +0100 -@@ -326,11 +326,7 @@ Expression *Mul(Type *type, Expression * - - if (type->isfloating()) - { complex_t c; --#ifdef IN_GCC -- real_t r; --#else - d_float80 r; --#endif - - if (e1->type->isreal()) - { -@@ -397,11 +393,7 @@ Expression *Div(Type *type, Expression * - - if (type->isfloating()) - { complex_t c; --#ifdef IN_GCC -- real_t r; --#else - d_float80 r; --#endif - - //e1->type->print(); - //e2->type->print(); -@@ -578,8 +570,8 @@ Expression *Pow(Type *type, Expression * - } - else - { -- r = new RealExp(loc, e1->toReal(), Type::tfloat64); -- v = new RealExp(loc, ldouble(1.0), Type::tfloat64); -+ r = new IntegerExp(loc, e1->toInteger(), e1->type); -+ v = new IntegerExp(loc, 1, e1->type); - } - - while (n != 0) -@@ -603,7 +595,7 @@ Expression *Pow(Type *type, Expression * - // x ^^ y for x < 0 and y not an integer is not defined - if (e1->toReal() < 0.0) - { -- e = new RealExp(loc, ldouble(Port::nan), type); -+ e = new RealExp(loc, Port::ldbl_nan, type); - } - else if (e2->toReal() == 0.5) - { -@@ -753,7 +745,7 @@ Expression *Xor(Type *type, Expression * - - /* Also returns EXP_CANT_INTERPRET if cannot be computed. - */ --Expression *Equal(enum TOK op, Type *type, Expression *e1, Expression *e2) -+Expression *Equal(TOK op, Type *type, Expression *e1, Expression *e2) - { Expression *e; - Loc loc = e1->loc; - int cmp; -@@ -951,7 +943,7 @@ Expression *Equal(enum TOK op, Type *typ - return e; - } - --Expression *Identity(enum TOK op, Type *type, Expression *e1, Expression *e2) -+Expression *Identity(TOK op, Type *type, Expression *e1, Expression *e2) - { - Loc loc = e1->loc; - int cmp; -@@ -998,7 +990,7 @@ Expression *Identity(enum TOK op, Type * - } - - --Expression *Cmp(enum TOK op, Type *type, Expression *e1, Expression *e2) -+Expression *Cmp(TOK op, Type *type, Expression *e1, Expression *e2) - { Expression *e; - Loc loc = e1->loc; - dinteger_t n; -@@ -1222,7 +1214,7 @@ Expression *Cast(Type *type, Type *to, E - } - - if (e1->op == TOKarrayliteral && typeb == tb) -- return e1; -+ return expType(to, e1); - - if (e1->isConst() != 1) - return EXP_CANT_INTERPRET; -@@ -1233,23 +1225,7 @@ Expression *Cast(Type *type, Type *to, E - { - if (e1->type->isfloating()) - { dinteger_t result; --#ifdef IN_GCC -- Type * rt = e1->type; -- if (rt->iscomplex()) -- { -- switch (rt->toBasetype()->ty) -- { -- case Tcomplex32: rt = Type::tfloat32; break; -- case Tcomplex64: rt = Type::tfloat64; break; -- case Tcomplex80: rt = Type::tfloat80; break; -- default: -- assert(0); -- } -- } -- d_int64 r = e1->toReal().toInt(rt, type); --#else - real_t r = e1->toReal(); --#endif - - switch (typeb->ty) - { -@@ -1345,6 +1321,8 @@ Expression *ArrayLength(Type *type, Expr - - e = new IntegerExp(loc, dim, type); - } -+ else if (e1->type->toBasetype()->ty == Tsarray) -+ e = ((TypeSArray *)e1->type->toBasetype())->dim; - else - e = EXP_CANT_INTERPRET; - return e; -@@ -1386,6 +1364,7 @@ Expression *Index(Type *type, Expression - { ArrayLiteralExp *ale = (ArrayLiteralExp *)e1; - e = (*ale->elements)[i]; - e->type = type; -+ e->loc = loc; - if (e->hasSideEffect()) - e = EXP_CANT_INTERPRET; - } -@@ -1404,6 +1383,7 @@ Expression *Index(Type *type, Expression - else - { e = (*ale->elements)[i]; - e->type = type; -+ e->loc = loc; - if (e->hasSideEffect()) - e = EXP_CANT_INTERPRET; - } -@@ -1424,6 +1404,7 @@ Expression *Index(Type *type, Expression - if (ex->isBool(TRUE)) - { e = (*ae->values)[i]; - e->type = type; -+ e->loc = loc; - if (e->hasSideEffect()) - e = EXP_CANT_INTERPRET; - break; -@@ -1465,12 +1446,12 @@ Expression *Slice(Type *type, Expression - StringExp *es; - - s = mem.malloc((len + 1) * sz); -- memcpy((unsigned char *)s, (unsigned char *)es1->string + ilwr * sz, len * sz); -- memset((unsigned char *)s + len * sz, 0, sz); -+ memcpy((utf8_t *)s, (utf8_t *)es1->string + ilwr * sz, len * sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - es = new StringExp(loc, s, len, es1->postfix); - es->sz = sz; -- es->committed = 1; -+ es->committed = es1->committed; - es->type = type; - e = es; - } -@@ -1508,7 +1489,7 @@ void sliceAssignArrayLiteralFromString(A - { - size_t newlen = newval->len; - size_t sz = newval->sz; -- unsigned char *s = (unsigned char *)newval->string; -+ utf8_t *s = (utf8_t *)newval->string; - Type *elemType = existingAE->type->nextOf(); - for (size_t j = 0; j < newlen; j++) - { -@@ -1532,7 +1513,7 @@ void sliceAssignArrayLiteralFromString(A - */ - void sliceAssignStringFromArrayLiteral(StringExp *existingSE, ArrayLiteralExp *newae, size_t firstIndex) - { -- unsigned char *s = (unsigned char *)existingSE->string; -+ utf8_t *s = (utf8_t *)existingSE->string; - for (size_t j = 0; j < newae->elements->dim; j++) - { - unsigned value = (unsigned)((*newae->elements)[j]->toInteger()); -@@ -1553,7 +1534,7 @@ void sliceAssignStringFromArrayLiteral(S - */ - void sliceAssignStringFromString(StringExp *existingSE, StringExp *newstr, size_t firstIndex) - { -- unsigned char *s = (unsigned char *)existingSE->string; -+ utf8_t *s = (utf8_t *)existingSE->string; - size_t sz = existingSE->sz; - assert(sz == newstr->sz); - memcpy(s + firstIndex * sz, newstr->string, sz * newstr->len); -@@ -1564,8 +1545,8 @@ void sliceAssignStringFromString(StringE - */ - int sliceCmpStringWithString(StringExp *se1, StringExp *se2, size_t lo1, size_t lo2, size_t len) - { -- unsigned char *s1 = (unsigned char *)se1->string; -- unsigned char *s2 = (unsigned char *)se2->string; -+ utf8_t *s1 = (utf8_t *)se1->string; -+ utf8_t *s2 = (utf8_t *)se2->string; - size_t sz = se1->sz; - assert(sz == se2->sz); - -@@ -1577,11 +1558,9 @@ int sliceCmpStringWithString(StringExp * - */ - int sliceCmpStringWithArray(StringExp *se1, ArrayLiteralExp *ae2, size_t lo1, size_t lo2, size_t len) - { -- unsigned char *s = (unsigned char *)se1->string; -+ utf8_t *s = (utf8_t *)se1->string; - size_t sz = se1->sz; - -- int c = 0; -- - for (size_t j = 0; j < len; j++) - { - unsigned value = (unsigned)((*ae2->elements)[j + lo2]->toInteger()); -@@ -1637,12 +1616,12 @@ Expression *Cat(Type *type, Expression * - size_t len = (t->ty == tn->ty) ? 1 : utf_codeLength(sz, v); - s = mem.malloc((len + 1) * sz); - if (t->ty == tn->ty) -- memcpy((unsigned char *)s, &v, sz); -+ memcpy((utf8_t *)s, &v, sz); - else - utf_encode(sz, s, v); - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1696,10 +1675,10 @@ Expression *Cat(Type *type, Expression * - } - s = mem.malloc((len + 1) * sz); - memcpy(s, es1->string, es1->len * sz); -- memcpy((unsigned char *)s + es1->len * sz, es2->string, es2->len * sz); -+ memcpy((utf8_t *)s + es1->len * sz, es2->string, es2->len * sz); - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1761,12 +1740,12 @@ Expression *Cat(Type *type, Expression * - s = mem.malloc((len + 1) * sz); - memcpy(s, es1->string, es1->len * sz); - if (homoConcat) -- memcpy((unsigned char *)s + (sz * es1->len), &v, sz); -+ memcpy((utf8_t *)s + (sz * es1->len), &v, sz); - else -- utf_encode(sz, (unsigned char *)s + (sz * es1->len), v); -+ utf_encode(sz, (utf8_t *)s + (sz * es1->len), v); - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1785,11 +1764,11 @@ Expression *Cat(Type *type, Expression * - dinteger_t v = e1->toInteger(); - - s = mem.malloc((len + 1) * sz); -- memcpy((unsigned char *)s, &v, sz); -- memcpy((unsigned char *)s + sz, es2->string, es2->len * sz); -+ memcpy((utf8_t *)s, &v, sz); -+ memcpy((utf8_t *)s + sz, es2->string, es2->len * sz); - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1810,8 +1789,7 @@ Expression *Cat(Type *type, Expression * - - if (type->toBasetype()->ty == Tsarray) - { -- e->type = new TypeSArray(t1->nextOf(), new IntegerExp(loc, es1->elements->dim, Type::tindex)); -- e->type = e->type->semantic(loc, NULL); -+ e->type = TypeSArray::makeType(loc, t1->nextOf(), es1->elements->dim); - } - else - e->type = type; -@@ -1835,8 +1813,7 @@ Expression *Cat(Type *type, Expression * - - if (type->toBasetype()->ty == Tsarray) - { -- e->type = new TypeSArray(t1->nextOf(), new IntegerExp(loc, es->elements->dim, Type::tindex)); -- e->type = e->type->semantic(loc, NULL); -+ e->type = TypeSArray::makeType(loc, t1->nextOf(), es->elements->dim); - } - else - e->type = type; -@@ -1858,8 +1835,7 @@ Expression *Cat(Type *type, Expression * - - if (type->toBasetype()->ty == Tsarray) - { -- e->type = new TypeSArray(e2->type, new IntegerExp(loc, es1->elements->dim, Type::tindex)); -- e->type = e->type->semantic(loc, NULL); -+ e->type = TypeSArray::makeType(loc, e2->type, es1->elements->dim); - } - else - e->type = type; -@@ -1875,8 +1851,7 @@ Expression *Cat(Type *type, Expression * - - if (type->toBasetype()->ty == Tsarray) - { -- e->type = new TypeSArray(e1->type, new IntegerExp(loc, es2->elements->dim, Type::tindex)); -- e->type = e->type->semantic(loc, NULL); -+ e->type = TypeSArray::makeType(loc, e1->type, es2->elements->dim); - } - else - e->type = type; ---- a/src/gcc/d/dfrontend/cppmangle.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/cppmangle.c 2014-04-01 16:32:51.000000000 +0100 -@@ -129,16 +129,24 @@ void cpp_mangle_name(OutBuffer *buf, Cpp - buf->writeByte('N'); - - FuncDeclaration *fd = s->isFuncDeclaration(); -- if (!fd) -+ VarDeclaration *vd = s->isVarDeclaration(); -+ if (fd && fd->type->isConst()) - { -- s->error("C++ static variables not supported"); -- } -- else if (fd->type->isConst()) - buf->writeByte('K'); -- -- prefix_name(buf, cms, p); -- source_name(buf, s); -- -+ } -+ if (vd && !(vd->storage_class & (STCextern | STCgshared))) -+ { -+ s->error("C++ static non- __gshared non-extern variables not supported"); -+ } -+ if (vd || fd) -+ { -+ prefix_name(buf, cms, p); -+ source_name(buf, s); -+ } -+ else -+ { -+ assert(0); -+ } - buf->writeByte('E'); - } - else -@@ -402,11 +410,17 @@ void TypeTypedef::toCppMangle(OutBuffer - - void TypeClass::toCppMangle(OutBuffer *buf, CppMangleState *cms) - { -- if (!cms->substitute(buf, this)) -- { buf->writeByte('P'); -+ if (!cms->exist(this)) -+ { -+ buf->writeByte('P'); -+ - if (!cms->substitute(buf, sym)) - cpp_mangle_name(buf, cms, sym); -+ -+ cms->store(this); - } -+ else -+ cms->substitute(buf, this); - } - - struct ArgsCppMangleCtx -@@ -420,7 +434,7 @@ static int argsCppMangleDg(void *ctx, si - { - ArgsCppMangleCtx *p = (ArgsCppMangleCtx *)ctx; - -- Type *t = arg->type; -+ Type *t = arg->type->merge2(); - if (arg->storageClass & (STCout | STCref)) - t = t->referenceTo(); - else if (arg->storageClass & STClazy) -@@ -430,7 +444,7 @@ static int argsCppMangleDg(void *ctx, si - t = t->merge(); - } - if (t->ty == Tsarray) -- { // Mangle static arrays as pointers -+ { // Mangle static arrays as pointers. - t = t->pointerTo(); - } - ---- a/src/gcc/d/dfrontend/ctfeexpr.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/ctfeexpr.c 2014-04-01 16:32:51.000000000 +0100 -@@ -44,9 +44,9 @@ Expression *ClassReferenceExp::interpret - return this; - } - --char *ClassReferenceExp::toChars() -+void ClassReferenceExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { -- return value->toChars(); -+ buf->writestring(value->toChars()); - } - - ClassDeclaration *ClassReferenceExp::originalClass() -@@ -160,8 +160,10 @@ char *ThrownExceptionExp::toChars() - // Generate an error message when this exception is not caught - void ThrownExceptionExp::generateUncaughtError() - { -- thrown->error("Uncaught CTFE exception %s(%s)", thrown->type->toChars(), -- thrown->value->elements->tdata()[0]->toChars()); -+ Expression *e = (*thrown->value->elements)[0]; -+ StringExp* se = e->toString(); -+ thrown->error("Uncaught CTFE exception %s(%s)", thrown->type->toChars(), se ? se->toChars() : e->toChars()); -+ - /* Also give the line where the throw statement was. We won't have it - * in the case where the ThrowStatement is generated internally - * (eg, in ScopeStatement) -@@ -174,6 +176,8 @@ void ThrownExceptionExp::generateUncaugh - // True if 'e' is EXP_CANT_INTERPRET, or an exception - bool exceptionOrCantInterpret(Expression *e) - { -+ assert(EXP_CANT_INTERPRET && "EXP_CANT_INTERPRET must be distinct from " -+ "null, Expression::init not called?"); - if (e == EXP_CANT_INTERPRET) return true; - if (!e || e == EXP_GOTO_INTERPRET || e == EXP_VOID_INTERPRET - || e == EXP_BREAK_INTERPRET || e == EXP_CONTINUE_INTERPRET) -@@ -229,7 +233,7 @@ Expressions *copyLiteralArray(Expression - Expressions *newelems = new Expressions(); - newelems->setDim(oldelems->dim); - for (size_t i = 0; i < oldelems->dim; i++) -- newelems->tdata()[i] = copyLiteral(oldelems->tdata()[i]); -+ (*newelems)[i] = copyLiteral((*oldelems)[i]); - return newelems; - } - -@@ -240,8 +244,7 @@ Expression *copyLiteral(Expression *e) - if (e->op == TOKstring) // syntaxCopy doesn't make a copy for StringExp! - { - StringExp *se = (StringExp *)e; -- unsigned char *s; -- s = (unsigned char *)mem.calloc(se->len + 1, se->sz); -+ utf8_t *s = (utf8_t *)mem.calloc(se->len + 1, se->sz); - memcpy(s, se->string, se->len * se->sz); - StringExp *se2 = new StringExp(se->loc, s, se->len); - se2->committed = se->committed; -@@ -281,7 +284,7 @@ Expression *copyLiteral(Expression *e) - newelems->setDim(oldelems->dim); - for (size_t i = 0; i < newelems->dim; i++) - { -- Expression *m = oldelems->tdata()[i]; -+ Expression *m = (*oldelems)[i]; - // We need the struct definition to detect block assignment - AggregateDeclaration *sd = se->sd; - Dsymbol *s = sd->fields[i]; -@@ -301,7 +304,7 @@ Expression *copyLiteral(Expression *e) - } - else if (v->type->ty != Tarray && v->type->ty!=Taarray) // NOTE: do not copy array references - m = copyLiteral(m); -- newelems->tdata()[i] = m; -+ (*newelems)[i] = m; - } - #if DMDV2 - StructLiteralExp *r = new StructLiteralExp(e->loc, se->sd, newelems, se->stype); -@@ -310,6 +313,7 @@ Expression *copyLiteral(Expression *e) - #endif - r->type = e->type; - r->ownedByCtfe = true; -+ r->origin = ((StructLiteralExp*)e)->origin; - return r; - } - else if (e->op == TOKfunction || e->op == TOKdelegate -@@ -317,7 +321,7 @@ Expression *copyLiteral(Expression *e) - || e->op == TOKvar - || e->op == TOKint64 || e->op == TOKfloat64 - || e->op == TOKchar || e->op == TOKcomplex80 -- || e->op == TOKvoid) -+ || e->op == TOKvoid || e->op == TOKvector) - { // Simple value types - Expression *r = e->syntaxCopy(); - r->type = e->type; -@@ -331,12 +335,12 @@ Expression *copyLiteral(Expression *e) - else if (e->op == TOKindex) - r = new IndexExp(e->loc, ((IndexExp *)e)->e1, ((IndexExp *)e)->e2); - else if (e->op == TOKdotvar) -- r = new DotVarExp(e->loc, ((DotVarExp *)e)->e1, -- ((DotVarExp *)e)->var - #if DMDV2 -- , ((DotVarExp *)e)->hasOverloads -+ r = new DotVarExp(e->loc, ((DotVarExp *)e)->e1, -+ ((DotVarExp *)e)->var, ((DotVarExp *)e)->hasOverloads); -+#else -+ r = new DotVarExp(e->loc, ((DotVarExp *)e)->e1, ((DotVarExp *)e)->var); - #endif -- ); - else - assert(0); - r->type = e->type; -@@ -351,6 +355,8 @@ Expression *copyLiteral(Expression *e) - } - else if (e->op == TOKclassreference) - return new ClassReferenceExp(e->loc, ((ClassReferenceExp *)e)->value, e->type); -+ else if (e->op == TOKerror) -+ return e; - else - { - e->error("Internal Compiler Error: CTFE literal %s", e->toChars()); -@@ -367,8 +373,13 @@ Expression *copyLiteral(Expression *e) - */ - Expression *paintTypeOntoLiteral(Type *type, Expression *lit) - { -- if (lit->type == type) -+ if (lit->type->equals(type)) -+ return lit; -+ -+ // If it is a cast to inout, retain the original type. -+ if (type->hasWild()) - return lit; -+ - Expression *e; - if (lit->op == TOKslice) - { -@@ -383,13 +394,13 @@ Expression *paintTypeOntoLiteral(Type *t - else if (lit->op == TOKarrayliteral) - { - e = new SliceExp(lit->loc, lit, -- new IntegerExp(0, 0, Type::tsize_t), ArrayLength(Type::tsize_t, lit)); -+ new IntegerExp(Loc(), 0, Type::tsize_t), ArrayLength(Type::tsize_t, lit)); - } - else if (lit->op == TOKstring) - { - // For strings, we need to introduce another level of indirection - e = new SliceExp(lit->loc, lit, -- new IntegerExp(0, 0, Type::tsize_t), ArrayLength(Type::tsize_t, lit)); -+ new IntegerExp(Loc(), 0, Type::tsize_t), ArrayLength(Type::tsize_t, lit)); - } - else if (lit->op == TOKassocarrayliteral) - { -@@ -458,6 +469,13 @@ ArrayLiteralExp *createBlockDuplicatedAr - { - Expressions *elements = new Expressions(); - elements->setDim(dim); -+ if (type->ty == Tsarray && type->nextOf()->ty == Tsarray && -+ elem->type->ty != Tsarray) -+ { -+ // If it is a multidimensional array literal, do it recursively -+ elem = createBlockDuplicatedArrayLiteral(loc, type->nextOf(), elem, -+ ((TypeSArray *)type->nextOf())->dim->toInteger()); -+ } - bool mustCopy = needToCopyLiteral(elem); - for (size_t i = 0; i < dim; i++) - { if (mustCopy) -@@ -477,8 +495,7 @@ ArrayLiteralExp *createBlockDuplicatedAr - StringExp *createBlockDuplicatedStringLiteral(Loc loc, Type *type, - unsigned value, size_t dim, int sz) - { -- unsigned char *s; -- s = (unsigned char *)mem.calloc(dim + 1, sz); -+ utf8_t *s = (utf8_t *)mem.calloc(dim + 1, sz); - for (size_t elemi = 0; elemi < dim; ++elemi) - { - switch (sz) -@@ -529,13 +546,23 @@ TypeAArray *toBuiltinAAType(Type *t) - assert(sym->ident == Id::AssociativeArray); - TemplateInstance *tinst = sym->parent->isTemplateInstance(); - assert(tinst); -- return new TypeAArray((Type *)(tinst->tiargs->tdata()[1]), (Type *)(tinst->tiargs->tdata()[0])); -+ return new TypeAArray((Type *)(*tinst->tiargs)[1], (Type *)(*tinst->tiargs)[0]); - #else - assert(0); - return NULL; - #endif - } - -+/************** TypeInfo operations ************************************/ -+ -+// Return true if type is TypeInfo_Class -+bool isTypeInfo_Class(Type *type) -+{ -+ return type->ty == Tclass && -+ (( Type::dtypeinfo == ((TypeClass*)type)->sym) -+ || Type::dtypeinfo->isBaseOf(((TypeClass*)type)->sym, NULL)); -+} -+ - /************** Pointer operations ************************************/ - - // Return true if t is a pointer (not a function pointer) -@@ -557,20 +584,36 @@ int isTrueBool(Expression *e) - * destPointee may be void. - */ - bool isSafePointerCast(Type *srcPointee, Type *destPointee) --{ // It's OK if both are the same (modulo const) -+{ -+ // It's safe to cast S** to D** if it's OK to cast S* to D* -+ while (srcPointee->ty == Tpointer && destPointee->ty == Tpointer) -+ { -+ srcPointee = srcPointee->nextOf(); -+ destPointee = destPointee->nextOf(); -+ } -+ - #if DMDV2 -- if (srcPointee->castMod(0) == destPointee->castMod(0)) -- return true; --#else -+ // It's OK if both are the same (modulo const) -+ srcPointee = srcPointee->castMod(0); -+ destPointee = destPointee->castMod(0); -+#endif - if (srcPointee == destPointee) - return true; --#endif -+ -+ // It's OK if function pointers differ only in safe/pure/nothrow -+ if (srcPointee->ty == Tfunction && destPointee->ty == Tfunction) -+ return srcPointee->covariant(destPointee) == 1; -+ - // it's OK to cast to void* - if (destPointee->ty == Tvoid) - return true; -- // It's OK if they are the same size integers, eg int* and uint* -- return srcPointee->isintegral() && destPointee->isintegral() -- && srcPointee->size() == destPointee->size(); -+ -+ // It's OK if they are the same size (static array of) integers, eg: -+ // int* --> uint* -+ // int[5][] --> uint[5][] -+ return srcPointee->baseElemOf()->isintegral() && -+ destPointee->baseElemOf()->isintegral() && -+ srcPointee->size() == destPointee->size(); - } - - Expression *getAggregateFromPointer(Expression *e, dinteger_t *ofs) -@@ -578,6 +621,8 @@ Expression *getAggregateFromPointer(Expr - *ofs = 0; - if (e->op == TOKaddress) - e = ((AddrExp *)e)->e1; -+ if (e->op == TOKsymoff) -+ *ofs = ((SymOffExp *)e)->offset; - if (e->op == TOKdotvar) - { - Expression *ex = ((DotVarExp *)e)->e1; -@@ -590,7 +635,7 @@ Expression *getAggregateFromPointer(Expr - i = ((ClassReferenceExp *)ex)->getFieldIndex(e->type, v->offset); - else - i = se->getFieldIndex(e->type, v->offset); -- e = se->elements->tdata()[i]; -+ e = (*se->elements)[i]; - } - if (e->op == TOKindex) - { -@@ -611,11 +656,19 @@ Expression *getAggregateFromPointer(Expr - */ - bool pointToSameMemoryBlock(Expression *agg1, Expression *agg2) - { -+ // For integers cast to pointers, we regard them as non-comparable -+ // unless they are identical. (This may be overly strict). -+ if (agg1->op == TOKint64 && agg2->op == TOKint64 -+ && agg1->toInteger() == agg2->toInteger()) -+ return true; -+ - // Note that type painting can occur with VarExp, so we - // must compare the variables being pointed to. - return agg1 == agg2 || - (agg1->op == TOKvar && agg2->op == TOKvar && -- ((VarExp *)agg1)->var == ((VarExp *)agg2)->var); -+ ((VarExp *)agg1)->var == ((VarExp *)agg2)->var) || -+ (agg1->op == TOKsymoff && agg2->op == TOKsymoff && -+ ((SymOffExp *)agg1)->var == ((SymOffExp *)agg2)->var); - } - - // return e1 - e2 as an integer, or error if not possible -@@ -634,11 +687,16 @@ Expression *pointerDifference(Loc loc, T - { - if (((StringExp *)agg1)->string == ((StringExp *)agg2)->string) - { -- Type *pointee = ((TypePointer *)agg1->type)->next; -- dinteger_t sz = pointee->size(); -- return new IntegerExp(loc, (ofs1-ofs2)*sz, type); -+ Type *pointee = ((TypePointer *)agg1->type)->next; -+ dinteger_t sz = pointee->size(); -+ return new IntegerExp(loc, (ofs1-ofs2)*sz, type); - } - } -+ else if (agg1->op == TOKsymoff && agg2->op == TOKsymoff && -+ ((SymOffExp *)agg1)->var == ((SymOffExp *)agg2)->var) -+ { -+ return new IntegerExp(loc, ofs1-ofs2, type); -+ } - error(loc, "%s - %s cannot be interpreted at compile time: cannot subtract " - "pointers to two different memory blocks", - e1->toChars(), e2->toChars()); -@@ -647,7 +705,7 @@ Expression *pointerDifference(Loc loc, T - - // Return eptr op e2, where eptr is a pointer, e2 is an integer, - // and op is TOKadd or TOKmin --Expression *pointerArithmetic(Loc loc, enum TOK op, Type *type, -+Expression *pointerArithmetic(Loc loc, TOK op, Type *type, - Expression *eptr, Expression *e2) - { - if (eptr->type->nextOf()->ty == Tvoid) -@@ -659,21 +717,36 @@ Expression *pointerArithmetic(Loc loc, e - if (eptr->op == TOKaddress) - eptr = ((AddrExp *)eptr)->e1; - Expression *agg1 = getAggregateFromPointer(eptr, &ofs1); -- if (agg1->op != TOKstring && agg1->op != TOKarrayliteral) -+ if (agg1->op == TOKsymoff) -+ { -+ if (((SymOffExp *)agg1)->var->type->ty != Tsarray) -+ { -+ error(loc, "cannot perform pointer arithmetic on arrays of unknown length at compile time"); -+ return EXP_CANT_INTERPRET; -+ } -+ } -+ else if (agg1->op != TOKstring && agg1->op != TOKarrayliteral) - { - error(loc, "cannot perform pointer arithmetic on non-arrays at compile time"); - return EXP_CANT_INTERPRET; - } - ofs2 = e2->toInteger(); - Type *pointee = ((TypePointer *)agg1->type)->next; -+ sinteger_t indx = ofs1; - dinteger_t sz = pointee->size(); -- Expression *dollar = ArrayLength(Type::tsize_t, agg1); -- assert(dollar != EXP_CANT_INTERPRET); -+ Expression *dollar; -+ if (agg1->op == TOKsymoff) -+ { -+ dollar = ((TypeSArray *)(((SymOffExp *)agg1)->var->type))->dim; -+ indx = ofs1/sz; -+ } -+ else -+ { -+ dollar = ArrayLength(Type::tsize_t, agg1); -+ assert(dollar != EXP_CANT_INTERPRET); -+ } - dinteger_t len = dollar->toInteger(); - -- Expression *val = agg1; -- TypeArray *tar = (TypeArray *)val->type; -- sinteger_t indx = ofs1; - if (op == TOKadd || op == TOKaddass || op == TOKplusplus) - indx = indx + ofs2/sz; - else if (op == TOKmin || op == TOKminass || op == TOKminusminus) -@@ -683,14 +756,24 @@ Expression *pointerArithmetic(Loc loc, e - error(loc, "CTFE Internal compiler error: bad pointer operation"); - return EXP_CANT_INTERPRET; - } -- if (val->op != TOKarrayliteral && val->op != TOKstring) -+ -+ if (indx < 0 || indx > len) - { -- error(loc, "CTFE Internal compiler error: pointer arithmetic %s", val->toChars()); -+ error(loc, "cannot assign pointer to index %lld inside memory block [0..%lld]", indx, len); - return EXP_CANT_INTERPRET; - } -- if (indx < 0 || indx > len) -+ -+ if (agg1->op == TOKsymoff) - { -- error(loc, "cannot assign pointer to index %lld inside memory block [0..%lld]", indx, len); -+ SymOffExp *se = new SymOffExp(loc, ((SymOffExp *)agg1)->var, indx*sz); -+ se->type = type; -+ return se; -+ } -+ -+ Expression *val = agg1; -+ if (val->op != TOKarrayliteral && val->op != TOKstring) -+ { -+ error(loc, "CTFE Internal compiler error: pointer arithmetic %s", val->toChars()); - return EXP_CANT_INTERPRET; - } - -@@ -702,14 +785,12 @@ Expression *pointerArithmetic(Loc loc, e - - // Return 1 if true, 0 if false - // -1 if comparison is illegal because they point to non-comparable memory blocks --int comparePointers(Loc loc, enum TOK op, Type *type, Expression *agg1, dinteger_t ofs1, -+int comparePointers(Loc loc, TOK op, Type *type, Expression *agg1, dinteger_t ofs1, - Expression *agg2, dinteger_t ofs2) - { - if ( pointToSameMemoryBlock(agg1, agg2) ) - { -- dinteger_t cm = ofs1 - ofs2; - dinteger_t n; -- dinteger_t zero = 0; - switch(op) - { - case TOKlt: n = (ofs1 < ofs2); break; -@@ -743,6 +824,8 @@ int comparePointers(Loc loc, enum TOK op - case TOKnotequal: - cmp = (null1 == null2); - break; -+ default: -+ assert(0); - } - } - else -@@ -801,7 +884,7 @@ Expression *paintFloatInt(Expression *fr - if (to->isintegral()) - { - u.f = fromVal->toReal(); -- return new IntegerExp(fromVal->loc, ldouble(u.x), to); -+ return new IntegerExp(fromVal->loc, (dinteger_t)ldouble(u.x), to); - } - else - { -@@ -845,6 +928,9 @@ void intUnary(TOK op, IntegerExp *e) - case TOKtilde: - e->value = ~e->value; - break; -+ default: -+ assert(0); -+ break; - } - } - -@@ -1047,6 +1133,8 @@ bool isCtfeComparable(Expression *e) - if (x->isConst() != 1 && - x->op != TOKnull && - x->op != TOKstring && -+ x->op != TOKfunction && -+ x->op != TOKdelegate && - x->op != TOKarrayliteral && - x->op != TOKstructliteral && - x->op != TOKclassreference) -@@ -1202,16 +1290,16 @@ int ctfeCmpArrays(Loc loc, Expression *e - { lo1 = ((SliceExp *)x)->lwr->toInteger(); - x = ((SliceExp*)x)->e1; - } -- StringExp *se1 = (x->op == TOKstring) ? (StringExp *)x : 0; -- ArrayLiteralExp *ae1 = (x->op == TOKarrayliteral) ? (ArrayLiteralExp *)x : 0; -+ StringExp *se1 = (x->op == TOKstring) ? (StringExp *)x : NULL; -+ ArrayLiteralExp *ae1 = (x->op == TOKarrayliteral) ? (ArrayLiteralExp *)x : NULL; - - x = e2; - if (x->op == TOKslice) - { lo2 = ((SliceExp *)x)->lwr->toInteger(); - x = ((SliceExp*)x)->e1; - } -- StringExp *se2 = (x->op == TOKstring) ? (StringExp *)x : 0; -- ArrayLiteralExp *ae2 = (x->op == TOKarrayliteral) ? (ArrayLiteralExp *)x : 0; -+ StringExp *se2 = (x->op == TOKstring) ? (StringExp *)x : NULL; -+ ArrayLiteralExp *ae2 = (x->op == TOKarrayliteral) ? (ArrayLiteralExp *)x : NULL; - - // Now both must be either TOKarrayliteral or TOKstring - if (se1 && se2) -@@ -1244,6 +1332,21 @@ int ctfeCmpArrays(Loc loc, Expression *e - return 0; - } - -+/* Given a delegate expression e, return .funcptr. -+ * If e is NullExp, return NULL. -+ */ -+FuncDeclaration *funcptrOf(Expression *e) -+{ -+ assert(e->type->ty == Tdelegate); -+ -+ if (e->op == TOKdelegate) -+ return ((DelegateExp *)e)->func; -+ if (e->op == TOKfunction) -+ return ((FuncExp *)e)->fd; -+ assert(e->op == TOKnull); -+ return NULL; -+} -+ - bool isArray(Expression *e) - { - return e->op == TOKarrayliteral || e->op == TOKstring || -@@ -1261,13 +1364,16 @@ int ctfeRawCmp(Loc loc, Expression *e1, - return 0; - return 1; - } -+ -+ // null == null, regardless of type -+ - if (e1->op == TOKnull && e2->op == TOKnull) - return 0; - - if (e1->type->ty == Tpointer && e2->type->ty == Tpointer) -- { // Can only be an equality test. -- if (e1->op == TOKnull && e2->op == TOKnull) -- return 0; -+ { -+ // Can only be an equality test. -+ - dinteger_t ofs1, ofs2; - Expression *agg1 = getAggregateFromPointer(e1, &ofs1); - Expression *agg2 = getAggregateFromPointer(e2, &ofs2); -@@ -1278,6 +1384,35 @@ int ctfeRawCmp(Loc loc, Expression *e1, - } - return 1; - } -+ if (e1->type->ty == Tdelegate && e2->type->ty == Tdelegate) -+ { -+ // If .funcptr isn't the same, they are not equal -+ -+ if (funcptrOf(e1) != funcptrOf(e2)) -+ return 1; -+ -+ // If both are delegate literals, assume they have the -+ // same closure pointer. TODO: We don't support closures yet! -+ if (e1->op == TOKfunction && e2->op == TOKfunction) -+ return 0; -+ assert(e1->op == TOKdelegate && e2->op == TOKdelegate); -+ -+ // Same .funcptr. Do they have the same .ptr? -+ Expression * ptr1 = ((DelegateExp *)e1)->e1; -+ Expression * ptr2 = ((DelegateExp *)e2)->e1; -+ -+ dinteger_t ofs1, ofs2; -+ Expression *agg1 = getAggregateFromPointer(ptr1, &ofs1); -+ Expression *agg2 = getAggregateFromPointer(ptr2, &ofs2); -+ // If they are TOKvar, it means they are FuncDeclarations -+ if ((agg1 == agg2 && ofs1 == ofs2) || -+ (agg1->op == TOKvar && agg2->op == TOKvar && -+ ((VarExp *)agg1)->var == ((VarExp *)agg2)->var)) -+ { -+ return 0; -+ } -+ return 1; -+ } - if (isArray(e1) && isArray(e2)) - { - uinteger_t len1 = resolveArrayLength(e1); -@@ -1367,7 +1502,7 @@ int ctfeRawCmp(Loc loc, Expression *e1, - - - /// Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1 --int ctfeEqual(Loc loc, enum TOK op, Expression *e1, Expression *e2) -+int ctfeEqual(Loc loc, TOK op, Expression *e1, Expression *e2) - { - int cmp = !ctfeRawCmp(loc, e1, e2); - if (op == TOKnotequal) -@@ -1377,7 +1512,7 @@ int ctfeEqual(Loc loc, enum TOK op, Expr - - - /// Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1 --int ctfeIdentity(Loc loc, enum TOK op, Expression *e1, Expression *e2) -+int ctfeIdentity(Loc loc, TOK op, Expression *e1, Expression *e2) - { - int cmp; - if (e1->op == TOKnull) -@@ -1414,10 +1549,12 @@ int ctfeIdentity(Loc loc, enum TOK op, E - - - /// Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1 --int ctfeCmp(Loc loc, enum TOK op, Expression *e1, Expression *e2) -+int ctfeCmp(Loc loc, TOK op, Expression *e1, Expression *e2) - { - int n; -- if (e1->type->isString() && e2->type->isString()) -+ Type *t1 = e1->type->toBasetype(); -+ Type *t2 = e2->type->toBasetype(); -+ if (t1->isString() && t2->isString()) - { - int cmp = ctfeRawCmp(loc, e1, e2); - switch (op) -@@ -1440,15 +1577,15 @@ int ctfeCmp(Loc loc, enum TOK op, Expres - assert(0); - } - } -- else if (e1->type->isreal()) -+ else if (t1->isreal()) - { - n = realCmp(op, e1->toReal(), e2->toReal()); - } -- else if (e1->type->isimaginary()) -+ else if (t1->isimaginary()) - { - n = realCmp(op, e1->toImaginary(), e2->toImaginary()); - } -- else if (e1->type->isunsigned() || e2->type->isunsigned()) -+ else if (t1->isunsigned() || t2->isunsigned()) - { - n = intUnsignedCmp(op, e1->toInteger(), e2->toInteger()); - } -@@ -1478,15 +1615,16 @@ Expression *ctfeCat(Type *type, Expressi - void *s = mem.malloc((len + 1) * sz); - memcpy((char *)s + sz * es2->elements->dim, es1->string, es1->len * sz); - for (size_t i = 0; i < es2->elements->dim; i++) -- { Expression *es2e = es2->elements->tdata()[i]; -+ { -+ Expression *es2e = (*es2->elements)[i]; - if (es2e->op != TOKint64) - return EXP_CANT_INTERPRET; - dinteger_t v = es2e->toInteger(); -- memcpy((unsigned char *)s + i * sz, &v, sz); -+ memcpy((utf8_t *)s + i * sz, &v, sz); - } - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - StringExp *es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1508,15 +1646,16 @@ Expression *ctfeCat(Type *type, Expressi - void *s = mem.malloc((len + 1) * sz); - memcpy(s, es1->string, es1->len * sz); - for (size_t i = 0; i < es2->elements->dim; i++) -- { Expression *es2e = es2->elements->tdata()[i]; -+ { -+ Expression *es2e = (*es2->elements)[i]; - if (es2e->op != TOKint64) - return EXP_CANT_INTERPRET; - dinteger_t v = es2e->toInteger(); -- memcpy((unsigned char *)s + (es1->len + i) * sz, &v, sz); -+ memcpy((utf8_t *)s + (es1->len + i) * sz, &v, sz); - } - - // Add terminating 0 -- memset((unsigned char *)s + len * sz, 0, sz); -+ memset((utf8_t *)s + len * sz, 0, sz); - - StringExp *es = new StringExp(loc, s, len); - es->sz = sz; -@@ -1525,6 +1664,32 @@ Expression *ctfeCat(Type *type, Expressi - e = es; - return e; - } -+ else if (e1->op == TOKarrayliteral && e2->op == TOKarrayliteral && -+ t1->nextOf()->equals(t2->nextOf())) -+ { -+ // [ e1 ] ~ [ e2 ] ---> [ e1, e2 ] -+ ArrayLiteralExp *es1 = (ArrayLiteralExp *)e1; -+ ArrayLiteralExp *es2 = (ArrayLiteralExp *)e2; -+ -+ es1 = new ArrayLiteralExp(es1->loc, copyLiteralArray(es1->elements)); -+ es1->elements->insert(es1->elements->dim, copyLiteralArray(es2->elements)); -+ e = es1; -+ e->type = type; -+ return e; -+ } -+ else if (e1->op == TOKarrayliteral && e2->op == TOKnull && -+ t1->nextOf()->equals(t2->nextOf())) -+ { -+ // [ e1 ] ~ null ----> [ e1 ].dup -+ return paintTypeOntoLiteral(type, copyLiteral(e1)); -+ } -+ else if (e1->op == TOKnull && e2->op == TOKarrayliteral && -+ t1->nextOf()->equals(t2->nextOf())) -+ { -+ // null ~ [ e2 ] ----> [ e2 ].dup -+ return paintTypeOntoLiteral(type, copyLiteral(e2)); -+ } -+ - return Cat(type, e1, e2); - } - -@@ -1538,11 +1703,11 @@ Expression *findKeyInAA(Loc loc, AssocAr - for (size_t i = ae->keys->dim; i;) - { - i--; -- Expression *ekey = ae->keys->tdata()[i]; -+ Expression *ekey = (*ae->keys)[i]; - int eq = ctfeEqual(loc, TOKequal, ekey, e2); - if (eq) - { -- return ae->values->tdata()[i]; -+ return (*ae->values)[i]; - } - } - return NULL; -@@ -1572,7 +1737,7 @@ Expression *ctfeIndex(Loc loc, Type *typ - error(loc, "array index %llu is out of bounds %s[0 .. %llu]", indx, e1->toChars(), (ulonglong)ale->elements->dim); - return EXP_CANT_INTERPRET; - } -- Expression *e = ale->elements->tdata()[indx]; -+ Expression *e = (*ale->elements)[indx]; - return paintTypeOntoLiteral(type, e); - } - -@@ -1589,6 +1754,15 @@ Expression *ctfeCast(Loc loc, Type *type - else - return new NullExp(loc, to); - } -+ // Allow TypeInfo type painting -+ if (isTypeInfo_Class(e->type) && e->type->implicitConvTo(to)) -+ return paintTypeOntoLiteral(to, e); -+#if DMDV2 -+ // Allow casting away const for struct literals -+ if (e->op == TOKstructliteral && -+ e->type->toBasetype()->castMod(0) == to->toBasetype()->castMod(0)) -+ return paintTypeOntoLiteral(to, e); -+#endif - Expression *r = Cast(type, to, e); - if (r == EXP_CANT_INTERPRET) - error(loc, "cannot cast %s to %s at compile time", e->toChars(), to->toChars()); -@@ -1645,8 +1819,8 @@ void assignInPlace(Expression *dest, Exp - - for (size_t i= 0; i < oldelems->dim; ++i) - { -- Expression *e = newelems->tdata()[i]; -- Expression *o = oldelems->tdata()[i]; -+ Expression *e = (*newelems)[i]; -+ Expression *o = (*oldelems)[i]; - if (e->op == TOKstructliteral) - { - assert(o->op == e->op); -@@ -1658,7 +1832,7 @@ void assignInPlace(Expression *dest, Exp - } - else - { -- oldelems->tdata()[i] = newelems->tdata()[i]; -+ (*oldelems)[i] = (*newelems)[i]; - } - } - } -@@ -1668,10 +1842,10 @@ void recursiveBlockAssign(ArrayLiteralEx - assert( ae->type->ty == Tsarray || ae->type->ty == Tarray); - #if DMDV2 - Type *desttype = ((TypeArray *)ae->type)->next->castMod(0); -- bool directblk = (val->type->toBasetype()->castMod(0)) == desttype; -+ bool directblk = (val->type->toBasetype()->castMod(0))->equals(desttype); - #else - Type *desttype = ((TypeArray *)ae->type)->next; -- bool directblk = (val->type->toBasetype()) == desttype; -+ bool directblk = (val->type->toBasetype())->equals(desttype); - #endif - - bool cow = !(val->op == TOKstructliteral || val->op == TOKarrayliteral -@@ -1679,16 +1853,16 @@ void recursiveBlockAssign(ArrayLiteralEx - - for (size_t k = 0; k < ae->elements->dim; k++) - { -- if (!directblk && ae->elements->tdata()[k]->op == TOKarrayliteral) -+ if (!directblk && (*ae->elements)[k]->op == TOKarrayliteral) - { -- recursiveBlockAssign((ArrayLiteralExp *)ae->elements->tdata()[k], val, wantRef); -+ recursiveBlockAssign((ArrayLiteralExp *)(*ae->elements)[k], val, wantRef); - } - else - { - if (wantRef || cow) -- ae->elements->tdata()[k] = val; -+ (*ae->elements)[k] = val; - else -- assignInPlace(ae->elements->tdata()[k], val); -+ assignInPlace((*ae->elements)[k], val); - } - } - } -@@ -1704,7 +1878,7 @@ Expressions *changeOneElement(Expression - if (j == indexToChange) - (*expsx)[j] = newelem; - else -- (*expsx)[j] = oldelems->tdata()[j]; -+ (*expsx)[j] = (*oldelems)[j]; - } - return expsx; - } -@@ -1735,10 +1909,11 @@ Expression *assignAssocArrayElement(Loc - int updated = 0; - for (size_t j = valuesx->dim; j; ) - { j--; -- Expression *ekey = aae->keys->tdata()[j]; -+ Expression *ekey = (*aae->keys)[j]; - int eq = ctfeEqual(loc, TOKequal, ekey, index); - if (eq) -- { valuesx->tdata()[j] = newval; -+ { -+ (*valuesx)[j] = newval; - updated = 1; - } - } -@@ -1756,7 +1931,7 @@ Expression *assignAssocArrayElement(Loc - Expression *changeArrayLiteralLength(Loc loc, TypeArray *arrayType, - Expression *oldval, size_t oldlen, size_t newlen) - { -- Type *elemType = elemType = arrayType->next; -+ Type *elemType = arrayType->next; - assert(elemType); - Expression *defaultElem = elemType->defaultInitLiteral(loc); - Expressions *elements = new Expressions(); -@@ -1772,7 +1947,7 @@ Expression *changeArrayLiteralLength(Loc - if (oldval->op == TOKstring) - { - StringExp *oldse = (StringExp *)oldval; -- unsigned char *s = (unsigned char *)mem.calloc(newlen + 1, oldse->sz); -+ utf8_t *s = (utf8_t *)mem.calloc(newlen + 1, oldse->sz); - memcpy(s, oldse->string, copylen * oldse->sz); - unsigned defaultValue = (unsigned)(defaultElem->toInteger()); - for (size_t elemi = copylen; elemi < newlen; ++elemi) -@@ -1824,11 +1999,12 @@ Expression *changeArrayLiteralLength(Loc - - bool isCtfeValueValid(Expression *newval) - { -- if ( - #if DMDV2 -- newval->type->ty == Tnull || -+ bool isnull = newval->type->ty == Tnull; -+#else -+ bool isnull = false; - #endif -- isPointer(newval->type) ) -+ if (isnull || isPointer(newval->type)) - { - if (newval->op == TOKaddress || newval->op == TOKnull || - newval->op == TOKstring) -@@ -1880,13 +2056,30 @@ bool isCtfeValueValid(Expression *newval - if (ie->e2->op == TOKvar) - return true; - } -- if (newval->op == TOKfunction) return true; // function/delegate literal -- if (newval->op == TOKdelegate) return true; -+ -+ if (newval->op == TOKfunction) -+ return true; // function literal or delegate literal -+ -+ if (newval->op == TOKvector) -+ return true; // vector literal -+ -+ if (newval->op == TOKdelegate) -+ { -+ Expression *dge = ((DelegateExp *)newval)->e1; -+ if (dge->op == TOKvar && ((VarExp *)dge)->var->isFuncDeclaration()) -+ return true; // &nestedfunc -+ -+ if (dge->op == TOKstructliteral || dge->op == TOKclassreference) -+ return true; // &struct.func or &clasinst.func -+ } - if (newval->op == TOKsymoff) // function pointer - { - if (((SymOffExp *)newval)->var->isFuncDeclaration()) - return true; -+ if (((SymOffExp *)newval)->var->isDataseg()) -+ return true; // pointer to static variable - } -+ - if (newval->op == TOKint64 || newval->op == TOKfloat64 || - newval->op == TOKchar || newval->op == TOKcomplex80) - return true; ---- a/src/gcc/d/dfrontend/ctfe.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/ctfe.h 2014-04-01 16:32:51.000000000 +0100 -@@ -14,6 +14,7 @@ - #pragma once - #endif /* __DMC__ */ - -+#include "arraytypes.h" - - /** - Global status of the CTFE engine. Mostly used for performance diagnostics -@@ -29,22 +30,17 @@ struct CtfeStatus - static int numAssignments; // total number of assignments executed - }; - -- --/** Expression subclasses which only exist in CTFE */ -- --#define TOKclassreference ((TOK)(TOKMAX+1)) --#define TOKthrownexception ((TOK)(TOKMAX+2)) -- - /** - A reference to a class, or an interface. We need this when we - point to a base class (we must record what the type is). - */ --struct ClassReferenceExp : Expression -+class ClassReferenceExp : public Expression - { -+public: - StructLiteralExp *value; - ClassReferenceExp(Loc loc, StructLiteralExp *lit, Type *type); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- char *toChars(); -+ void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - ClassDeclaration *originalClass(); - VarDeclaration *getFieldAt(unsigned index); - -@@ -53,6 +49,12 @@ struct ClassReferenceExp : Expression - /// Return index of the field, or -1 if not found - /// Same as getFieldIndex, but checks for a direct match with the VarDeclaration - int findFieldIndexByName(VarDeclaration *v); -+ dt_t **toDt(dt_t **pdt); -+ dt_t **toDtI(dt_t **pdt, int offset); -+ Symbol* toSymbol(); -+ dt_t **toInstanceDt(dt_t **pdt); -+ dt_t **toDt2(dt_t **pdt, ClassDeclaration *cd, Dts *dts); -+ elem *toElem(IRState *irs); - }; - - /// Return index of the field, or -1 if not found -@@ -62,8 +64,9 @@ int findFieldIndexByName(StructDeclarati - - /** An uninitialized value - */ --struct VoidInitExp : Expression -+class VoidInitExp : public Expression - { -+public: - VarDeclaration *var; - - VoidInitExp(VarDeclaration *var, Type *type); -@@ -75,8 +78,9 @@ struct VoidInitExp : Expression - /** Fake class which holds the thrown exception. - Used for implementing exception handling. - */ --struct ThrownExceptionExp : Expression -+class ThrownExceptionExp : public Expression - { -+public: - ClassReferenceExp *thrown; // the thing being tossed - ThrownExceptionExp(Loc loc, ClassReferenceExp *victim); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -@@ -175,11 +179,11 @@ Expression *pointerDifference(Loc loc, T - - /// Return 1 if true, 0 if false - /// -1 if comparison is illegal because they point to non-comparable memory blocks --int comparePointers(Loc loc, enum TOK op, Type *type, Expression *agg1, dinteger_t ofs1, Expression *agg2, dinteger_t ofs2); -+int comparePointers(Loc loc, TOK op, Type *type, Expression *agg1, dinteger_t ofs1, Expression *agg2, dinteger_t ofs2); - - // Return eptr op e2, where eptr is a pointer, e2 is an integer, - // and op is TOKadd or TOKmin --Expression *pointerArithmetic(Loc loc, enum TOK op, Type *type, -+Expression *pointerArithmetic(Loc loc, TOK op, Type *type, - Expression *eptr, Expression *e2); - - // True if conversion from type 'from' to 'to' involves a reinterpret_cast -@@ -201,6 +205,9 @@ TypeAArray *toBuiltinAAType(Type *t); - */ - Expression *findKeyInAA(Loc loc, AssocArrayLiteralExp *ae, Expression *e2); - -+/// True if type is TypeInfo_Class -+bool isTypeInfo_Class(Type *type); -+ - /*********************************************** - In-place integer operations - ***********************************************/ -@@ -221,13 +228,13 @@ void intBinary(TOK op, IntegerExp *dest, - bool isCtfeComparable(Expression *e); - - /// Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1 --int ctfeEqual(Loc loc, enum TOK op, Expression *e1, Expression *e2); -+int ctfeEqual(Loc loc, TOK op, Expression *e1, Expression *e2); - - /// Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1 --int ctfeIdentity(Loc loc, enum TOK op, Expression *e1, Expression *e2); -+int ctfeIdentity(Loc loc, TOK op, Expression *e1, Expression *e2); - - /// Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1 --int ctfeCmp(Loc loc, enum TOK op, Expression *e1, Expression *e2); -+int ctfeCmp(Loc loc, TOK op, Expression *e1, Expression *e2); - - /// Returns e1 ~ e2. Resolves slices before concatenation. - Expression *ctfeCat(Type *type, Expression *e1, Expression *e2); ---- a/src/gcc/d/dfrontend/declaration.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/declaration.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -24,13 +24,14 @@ - #include "expression.h" - #include "statement.h" - #include "hdrgen.h" -+#include "ctfe.h" - #include "target.h" - - AggregateDeclaration *isAggregate(Type *t); // from opover.c - - void checkFrameAccess(Loc loc, Scope *sc, AggregateDeclaration *ad) - { -- if (!ad->isnested) -+ if (!ad->isNested()) - return; - - Dsymbol *s = sc->func; -@@ -83,6 +84,7 @@ Declaration::Declaration(Identifier *id) - linkage = LINKdefault; - inuse = 0; - sem = SemanticStart; -+ mangleOverride = NULL; - } - - void Declaration::semantic(Scope *sc) -@@ -100,27 +102,27 @@ unsigned Declaration::size(Loc loc) - return type->size(); - } - --int Declaration::isDelete() -+bool Declaration::isDelete() - { -- return FALSE; -+ return false; - } - --int Declaration::isDataseg() -+bool Declaration::isDataseg() - { -- return FALSE; -+ return false; - } - --int Declaration::isThreadlocal() -+bool Declaration::isThreadlocal() - { -- return FALSE; -+ return false; - } - --int Declaration::isCodeseg() -+bool Declaration::isCodeseg() - { -- return FALSE; -+ return false; - } - --enum PROT Declaration::prot() -+PROT Declaration::prot() - { - return protection; - } -@@ -138,18 +140,20 @@ int Declaration::checkModify(Loc loc, Sc - if (v && v->canassign) - return 2; - -- if ((sc->flags & SCOPEcontract) && isParameter()) -+ if (isParameter() || isResult()) - { -- if (!flag) error(loc, "cannot modify parameter '%s' in contract", toChars()); -- return 0; -- } -- if ((sc->flags & SCOPEcontract) && isResult()) -- { -- if (!flag) error(loc, "cannot modify result '%s' in contract", toChars()); -- return 0; -+ for (Scope *scx = sc; scx; scx = scx->enclosing) -+ { -+ if (scx->func == parent && (scx->flags & SCOPEcontract)) -+ { -+ const char *s = isParameter() && parent->ident != Id::ensure ? "parameter" : "result"; -+ if (!flag) error(loc, "cannot modify %s '%s' in contract", s, toChars()); -+ return 2; // do not report type related errors -+ } -+ } - } - -- if (v && isCtorinit()) -+ if (v && (isCtorinit() || isField())) - { // It's only modifiable if inside the right constructor - if ((storage_class & (STCforeach | STCref)) == (STCforeach | STCref)) - return 2; -@@ -180,7 +184,7 @@ TupleDeclaration::TupleDeclaration(Loc l - this->loc = loc; - this->type = NULL; - this->objects = objects; -- this->isexp = 0; -+ this->isexp = false; - this->tupletype = NULL; - } - -@@ -208,7 +212,7 @@ Type *TupleDeclaration::getType() - /* It's only a type tuple if all the Object's are types - */ - for (size_t i = 0; i < objects->dim; i++) -- { Object *o = (*objects)[i]; -+ { RootObject *o = (*objects)[i]; - - if (o->dyncast() != DYNCAST_TYPE) - { -@@ -243,17 +247,17 @@ Type *TupleDeclaration::getType() - - tupletype = new TypeTuple(args); - if (hasdeco) -- return tupletype->semantic(0, NULL); -+ return tupletype->semantic(Loc(), NULL); - } - - return tupletype; - } - --int TupleDeclaration::needThis() -+bool TupleDeclaration::needThis() - { - //printf("TupleDeclaration::needThis(%s)\n", toChars()); - for (size_t i = 0; i < objects->dim; i++) -- { Object *o = (*objects)[i]; -+ { RootObject *o = (*objects)[i]; - if (o->dyncast() == DYNCAST_EXPRESSION) - { Expression *e = (Expression *)o; - if (e->op == TOKdsymbol) -@@ -261,12 +265,12 @@ int TupleDeclaration::needThis() - Declaration *d = ve->s->isDeclaration(); - if (d && d->needThis()) - { -- return 1; -+ return true; - } - } - } - } -- return 0; -+ return false; - } - - -@@ -367,7 +371,7 @@ void TypedefDeclaration::semantic2(Scope - Initializer *savedinit = init; - int errors = global.errors; - init = init->semantic(sc, basetype, INITinterpret); -- if (errors != global.errors) -+ if (errors != global.errors || init->isErrorInitializer()) - { - init = savedinit; - return; -@@ -420,7 +424,7 @@ AliasDeclaration::AliasDeclaration(Loc l - this->htype = NULL; - this->haliassym = NULL; - this->overnext = NULL; -- this->inSemantic = 0; -+ this->inSemantic = false; - assert(type); - } - -@@ -436,7 +440,7 @@ AliasDeclaration::AliasDeclaration(Loc l - this->htype = NULL; - this->haliassym = NULL; - this->overnext = NULL; -- this->inSemantic = 0; -+ this->inSemantic = false; - assert(s); - } - -@@ -481,7 +485,7 @@ void AliasDeclaration::semantic(Scope *s - aliassym->semantic(sc); - return; - } -- this->inSemantic = 1; -+ this->inSemantic = true; - - #if DMDV1 // don't really know why this is here - if (storage_class & STCconst) -@@ -514,6 +518,12 @@ void AliasDeclaration::semantic(Scope *s - * try to alias y to 3. - */ - s = type->toDsymbol(sc); -+ if (s && s == this) -+ { -+ error("cannot resolve"); -+ s = NULL; -+ type = Type::terror; -+ } - if (s - #if DMDV2 - && ((s->getType() && type->equals(s->getType())) || s->isEnumMember()) -@@ -555,8 +565,8 @@ void AliasDeclaration::semantic(Scope *s - //printf("\talias resolved to type %s\n", type->toChars()); - } - if (overnext) -- ScopeDsymbol::multiplyDefined(0, overnext, this); -- this->inSemantic = 0; -+ ScopeDsymbol::multiplyDefined(Loc(), overnext, this); -+ this->inSemantic = false; - - if (global.gag && errors != global.errors) - type = savedtype; -@@ -581,7 +591,7 @@ void AliasDeclaration::semantic(Scope *s - { - FuncAliasDeclaration *fa = new FuncAliasDeclaration(f); - if (!fa->overloadInsert(overnext)) -- ScopeDsymbol::multiplyDefined(0, overnext, f); -+ ScopeDsymbol::multiplyDefined(Loc(), overnext, f); - overnext = NULL; - s = fa; - s->parent = sc->parent; -@@ -599,7 +609,7 @@ void AliasDeclaration::semantic(Scope *s - } - } - if (overnext) -- ScopeDsymbol::multiplyDefined(0, overnext, this); -+ ScopeDsymbol::multiplyDefined(Loc(), overnext, this); - if (s == this) - { - assert(global.errors); -@@ -610,16 +620,16 @@ void AliasDeclaration::semantic(Scope *s - type = savedtype; - overnext = savedovernext; - aliassym = NULL; -- inSemantic = 0; -+ inSemantic = false; - return; - } - } - //printf("setting aliassym %s to %s %s\n", toChars(), s->kind(), s->toChars()); - aliassym = s; -- this->inSemantic = 0; -+ this->inSemantic = false; - } - --int AliasDeclaration::overloadInsert(Dsymbol *s) -+bool AliasDeclaration::overloadInsert(Dsymbol *s) - { - /* Don't know yet what the aliased symbol is, so assume it can - * be overloaded and check later for correctness. -@@ -642,10 +652,10 @@ int AliasDeclaration::overloadInsert(Dsy - { - if (s == this) - { -- return TRUE; -+ return true; - } - overnext = s; -- return TRUE; -+ return true; - } - else - { -@@ -671,15 +681,21 @@ Dsymbol *AliasDeclaration::toAlias() - assert(this != aliassym); - //static int count; if (++count == 10) *(char*)0=0; - if (inSemantic) -- { error("recursive alias declaration"); -+ { -+ error("recursive alias declaration"); -+ -+ // Avoid breaking "recursive alias" state during errors gagged -+ if (global.isSpeculativeGagging()) -+ return this; -+ - aliassym = new AliasDeclaration(loc, ident, Type::terror); - type = Type::terror; - } - else if (aliassym || type->deco) - ; // semantic is already done. -- else if (import) -+ else if (import && import->scope) - { -- /* If this is an internal alias for selective import, -+ /* If this is an internal alias for selective/renamed import, - * resolve it under the correct scope. - */ - import->semantic(NULL); -@@ -816,8 +832,13 @@ void VarDeclaration::semantic(Scope *sc) - // return; - // sem = SemanticIn; - -+ if (sem >= SemanticDone) -+ return; -+ -+ Scope *scx = NULL; - if (scope) - { sc = scope; -+ scx = sc; - scope = NULL; - } - -@@ -839,6 +860,11 @@ void VarDeclaration::semantic(Scope *sc) - if (!type) - { inuse++; - -+ // Infering the type requires running semantic, -+ // so mark the scope as ctfe if required -+ bool needctfe = (storage_class & (STCmanifest | STCstatic)); -+ if (needctfe) sc = sc->startCTFE(); -+ - //printf("inferring type for %s with init %s\n", toChars(), init->toChars()); - ArrayInitializer *ai = init->isArrayInitializer(); - if (ai) -@@ -858,8 +884,11 @@ void VarDeclaration::semantic(Scope *sc) - type = type->nextOf()->arrayOf(); - } - else -+ { - type = init->inferType(sc); -+ } - -+ if (needctfe) sc = sc->endCTFE(); - // type = type->semantic(loc, sc); - - inuse--; -@@ -879,7 +908,9 @@ void VarDeclaration::semantic(Scope *sc) - else - { if (!originalType) - originalType = type->syntaxCopy(); -+ inuse++; - type = type->semantic(loc, sc); -+ inuse--; - } - //printf(" semantic type = %s\n", type ? type->toChars() : "null"); - -@@ -933,6 +964,7 @@ void VarDeclaration::semantic(Scope *sc) - FuncDeclaration *fd = parent->isFuncDeclaration(); - - Type *tb = type->toBasetype(); -+ Type *tbn = tb->baseElemOf(); - if (tb->ty == Tvoid && !(storage_class & STClazy)) - { - if (inferred) -@@ -969,7 +1001,7 @@ void VarDeclaration::semantic(Scope *sc) - size_t nelems = Parameter::dim(tt->arguments); - Objects *exps = new Objects(); - exps->setDim(nelems); -- Expression *ie = init ? init->toExpression() : NULL; -+ Expression *ie = (init && !init->isVoidInitializer()) ? init->toExpression() : NULL; - if (ie) ie = ie->semantic(sc); - - if (nelems > 0 && ie) -@@ -1005,6 +1037,7 @@ void VarDeclaration::semantic(Scope *sc) - - iexps->remove(pos); - iexps->insert(pos, te->exps); -+ (*iexps)[pos] = Expression::combine(te->e0, (*iexps)[pos]); - goto Lexpand1; - } - else if (isAliasThisTuple(e)) -@@ -1060,16 +1093,19 @@ void VarDeclaration::semantic(Scope *sc) - Lnomatch: - - if (ie && ie->op == TOKtuple) -- { size_t tedim = ((TupleExp *)ie)->exps->dim; -+ { -+ TupleExp *te = (TupleExp *)ie; -+ size_t tedim = te->exps->dim; - if (tedim != nelems) - { ::error(loc, "tuple of %d elements cannot be assigned to tuple of %d elements", (int)tedim, (int)nelems); - for (size_t u = tedim; u < nelems; u++) // fill dummy expression -- ((TupleExp *)ie)->exps->push(new ErrorExp()); -+ te->exps->push(new ErrorExp()); - } - } - - for (size_t i = 0; i < nelems; i++) -- { Parameter *arg = Parameter::getNth(tt->arguments, i); -+ { -+ Parameter *arg = Parameter::getNth(tt->arguments, i); - - OutBuffer buf; - buf.printf("_%s_field_%llu", ident->toChars(), (ulonglong)i); -@@ -1077,16 +1113,24 @@ Lnomatch: - const char *name = (const char *)buf.extractData(); - Identifier *id = Lexer::idPool(name); - -- Expression *einit = ie; -- if (ie && ie->op == TOKtuple) -- { einit = (*((TupleExp *)ie)->exps)[i]; -- } -- Initializer *ti = init; -- if (einit) -- { ti = new ExpInitializer(einit->loc, einit); -+ Initializer *ti; -+ if (ie) -+ { -+ Expression *einit = ie; -+ if (ie->op == TOKtuple) -+ { -+ TupleExp *te = (TupleExp *)ie; -+ einit = (*te->exps)[i]; -+ if (i == 0) -+ einit = Expression::combine(te->e0, einit); -+ } -+ ti = new ExpInitializer(einit->loc, einit); - } -+ else -+ ti = init ? init->syntaxCopy() : NULL; - - VarDeclaration *v = new VarDeclaration(loc, arg->type, id, ti); -+ v->storage_class |= storage_class; - if (arg->storageClass & STCparameter) - v->storage_class |= arg->storageClass; - //printf("declaring field %s of type %s\n", v->toChars(), v->type->toChars()); -@@ -1103,7 +1147,7 @@ Lnomatch: - } - TupleDeclaration *v2 = new TupleDeclaration(loc, ident, exps); - v2->parent = this->parent; -- v2->isexp = 1; -+ v2->isexp = true; - aliassym = v2; - return; - } -@@ -1126,7 +1170,10 @@ Lnomatch: - else if (type->isWild()) - storage_class |= STCwild; - -- if (isSynchronized()) -+ if (storage_class & (STCmanifest | STCstatic | STCgshared)) -+ { -+ } -+ else if (isSynchronized()) - { - error("variable %s cannot be synchronized", toChars()); - } -@@ -1151,24 +1198,46 @@ Lnomatch: - AggregateDeclaration *aad = parent->isAggregateDeclaration(); - if (aad) - { --#if DMDV2 -+#if PULL93 - assert(!(storage_class & (STCextern | STCstatic | STCtls | STCgshared))); -- -+ if (storage_class & (STCconst | STCimmutable) && init && -+ global.params.vfield) -+ { -+ const char *p = loc.toChars(); -+ const char *s = (storage_class & STCimmutable) ? "immutable" : "const"; -+ fprintf(global.stdmsg, "%s: %s.%s is %s field\n", p ? p : "", ad->toPrettyChars(), toChars(), s); -+ } -+ storage_class |= STCfield; -+#if DMDV2 -+ if (tbn->ty == Tstruct && ((TypeStruct *)tbn)->sym->noDefaultCtor || -+ tbn->ty == Tclass && ((TypeClass *)tbn)->sym->noDefaultCtor) -+ { -+ if (!isThisDeclaration()) -+ aad->noDefaultCtor = TRUE; -+ } -+#endif -+#else - if (storage_class & (STCconst | STCimmutable) && init) - { -+ StorageClass stc = storage_class & (STCconst | STCimmutable); -+ warning(loc, "%s field with initializer should be static, __gshared, or an enum", -+ StorageClassDeclaration::stcToChars(NULL, stc)); - if (!tb->isTypeBasic()) - storage_class |= STCstatic; - } - else --#endif - { - storage_class |= STCfield; - #if DMDV2 -- if (tb->ty == Tstruct && ((TypeStruct *)tb)->sym->noDefaultCtor || -- tb->ty == Tclass && ((TypeClass *)tb)->sym->noDefaultCtor) -- aad->noDefaultCtor = TRUE; -+ if ((tbn->ty == Tstruct && ((TypeStruct *)tbn)->sym->noDefaultCtor) || -+ (tbn->ty == Tclass && ((TypeClass *)tbn)->sym->noDefaultCtor)) -+ { -+ if (!isThisDeclaration()) -+ aad->noDefaultCtor = TRUE; -+ } - #endif - } -+#endif - } - - InterfaceDeclaration *id = parent->isInterfaceDeclaration(); -@@ -1221,25 +1290,35 @@ Lnomatch: - { - if (func->fes) - func = func->fes->func; -- if (!((TypeFunction *)func->type)->iswild) -+ bool isWild = false; -+ for (FuncDeclaration *fd = func; fd; fd = fd->toParent2()->isFuncDeclaration()) -+ { -+ if (((TypeFunction *)fd->type)->iswild) -+ { -+ isWild = true; -+ break; -+ } -+ } -+ if (!isWild) - { - error("inout variables can only be declared inside inout functions"); - } - } - } - -- if (!(storage_class & (STCctfe | STCref)) && tb->ty == Tstruct && -- ((TypeStruct *)tb)->sym->noDefaultCtor) -+ if (!(storage_class & (STCctfe | STCref | STCresult)) && tbn->ty == Tstruct && -+ ((TypeStruct *)tbn)->sym->noDefaultCtor) - { - if (!init) -- { if (storage_class & STCfield) -+ { -+ if (isField()) - /* For fields, we'll check the constructor later to make sure it is initialized - */ - storage_class |= STCnodefaultctor; - else if (storage_class & STCparameter) - ; - else -- error("initializer required for type %s", type->toChars()); -+ error("default construction is disabled for type %s", type->toChars()); - } - } - #endif -@@ -1268,8 +1347,8 @@ Lnomatch: - else if (storage_class & STCmanifest) - error("manifest constants must have initializers"); - -- enum TOK op = TOKconstruct; -- if (!init && !sc->inunion && !isStatic() && fd && -+ TOK op = TOKconstruct; -+ if (!init && !sc->inunion && !(storage_class & (STCstatic | STCgshared | STCextern)) && fd && - (!(storage_class & (STCfield | STCin | STCforeach | STCparameter | STCresult)) - || (storage_class & STCout)) && - type->size() != 0) -@@ -1344,7 +1423,6 @@ Lnomatch: - init = new ExpInitializer(e->loc, e); - } - -- StructInitializer *si = init->isStructInitializer(); - ExpInitializer *ei = init->isExpInitializer(); - - if (ei && isScope()) -@@ -1413,7 +1491,7 @@ Lnomatch: - if (t->ty != Tsarray) - break; - dim *= ((TypeSArray *)t)->dim->toInteger(); -- e1->type = new TypeSArray(t->nextOf(), new IntegerExp(0, dim, Type::tindex)); -+ e1->type = TypeSArray::makeType(Loc(), t->nextOf(), dim); - } - } - e1 = new SliceExp(loc, e1, NULL, NULL); -@@ -1440,7 +1518,7 @@ Lnomatch: - /* Look for form of constructor call which is: - * *__ctmp.ctor(arguments...) - */ -- if (1) -+ if ((*pinit)->type->implicitConvTo(t)) - { CallExp *ce = (CallExp *)(*pinit); - if (ce->e1->op == TOKdotvar) - { DotVarExp *dve = (DotVarExp *)ce->e1; -@@ -1459,17 +1537,19 @@ Lnomatch: - */ - storage_class &= ~(STCref | STCforeach | STCparameter); - -- Expression *e; -+ Expression *e = new VarExp(loc, this); - if (sd->zeroInit == 1) - { -- e = new ConstructExp(loc, new VarExp(loc, this), new IntegerExp(loc, 0, Type::tint32)); -+ e = new ConstructExp(loc, e, new IntegerExp(loc, 0, Type::tint32)); - } - else if (sd->isNested()) -- { e = new AssignExp(loc, new VarExp(loc, this), t->defaultInitLiteral(loc)); -+ { -+ e = new AssignExp(loc, e, t->defaultInitLiteral(loc)); - e->op = TOKblit; - } - else -- { e = new AssignExp(loc, new VarExp(loc, this), t->defaultInit(loc)); -+ { -+ e = new AssignExp(loc, e, t->defaultInit(loc)); - e->op = TOKblit; - } - e->type = t; -@@ -1548,6 +1628,11 @@ Lnomatch: - init = init->semantic(sc, type, INITinterpret); - } - } -+ else if (parent->isAggregateDeclaration()) -+ { -+ scope = scx ? scx : new Scope(*sc); -+ scope->setNoFree(); -+ } - else if (storage_class & (STCconst | STCimmutable | STCmanifest) || - type->isConst() || type->isImmutable()) - { -@@ -1557,18 +1642,21 @@ Lnomatch: - * Ignore failure. - */ - -- if (!global.errors && !inferred) -+ if (!inferred) - { -- unsigned errors = global.startGagging(); -- Expression *exp; -- Initializer *i2 = init; -+ unsigned errors = global.errors; - inuse++; -+#if DMDV2 - if (ei) - { -- exp = ei->exp->syntaxCopy(); -+ Expression *exp = ei->exp->syntaxCopy(); -+ -+ bool needctfe = isDataseg() || (storage_class & STCmanifest); -+ if (needctfe) sc = sc->startCTFE(); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); --#if DMDV2 -+ if (needctfe) sc = sc->endCTFE(); -+ - Type *tb = type->toBasetype(); - Type *ti = exp->type->toBasetype(); - -@@ -1584,103 +1672,35 @@ Lnomatch: - * because the postblit doesn't get run on the initialization of w. - */ - if (ti->ty == Tstruct) -- { StructDeclaration *sd = ((TypeStruct *)ti)->sym; -+ { -+ StructDeclaration *sd = ((TypeStruct *)ti)->sym; - /* Look to see if initializer involves a copy constructor - * (which implies a postblit) - */ - if (sd->cpctor && // there is a copy constructor -- tb->equals(ti)) // rvalue is the same struct -+ tb->toDsymbol(NULL) == sd) // exp is the same struct - { - // The only allowable initializer is a (non-copy) constructor -- if (exp->op == TOKcall) -- { -- CallExp *ce = (CallExp *)exp; -- if (ce->e1->op == TOKdotvar) -- { -- DotVarExp *dve = (DotVarExp *)ce->e1; -- if (dve->var->isCtorDeclaration()) -- goto LNoCopyConstruction; -- } -- } -- global.gag--; -- error("of type struct %s uses this(this), which is not allowed in static initialization", tb->toChars()); -- global.gag++; -- -- LNoCopyConstruction: -- ; -+ if (exp->isLvalue()) -+ error("of type struct %s uses this(this), which is not allowed in static initialization", tb->toChars()); - } - } -- -- // Look for implicit constructor call -- if (tb->ty == Tstruct && -- !(ti->ty == Tstruct && tb->toDsymbol(sc) == ti->toDsymbol(sc)) && -- !exp->implicitConvTo(type)) -- { -- StructDeclaration *sd = ((TypeStruct *)tb)->sym; -- if (sd->ctor) -- { // Look for constructor first -- // Rewrite as e1.ctor(arguments) -- Expression *e; -- e = new StructLiteralExp(loc, sd, NULL, NULL); -- e = new DotIdExp(loc, e, Id::ctor); -- e = new CallExp(loc, e, exp); -- e = e->semantic(sc); -- exp = e->ctfeInterpret(); -- } -- } --#endif -- exp = exp->implicitCastTo(sc, type); -- } -- else if (si || ai) -- { i2 = init->syntaxCopy(); -- i2 = i2->semantic(sc, type, INITinterpret); -+ ei->exp = exp; - } -+#endif -+ init = init->semantic(sc, type, INITinterpret); - inuse--; -- if (global.endGagging(errors)) // if errors happened -+ if (global.errors > errors) - { --#if DMDV2 -- /* Save scope for later use, to try again -- */ -- scope = new Scope(*sc); -- scope->setNoFree(); --#endif -+ init = new ErrorInitializer(); -+ type = Type::terror; - } -- else if (ei) -- { -- if (isDataseg() || (storage_class & STCmanifest)) -- exp = exp->ctfeInterpret(); -- else -- exp = exp->optimize(WANTvalue); -- switch (exp->op) -- { -- case TOKint64: -- case TOKfloat64: -- case TOKstring: -- case TOKarrayliteral: -- case TOKassocarrayliteral: -- case TOKstructliteral: -- case TOKnull: -- ei->exp = exp; // no errors, keep result -- break; -- -- default: --#if DMDV2 -- /* Save scope for later use, to try again -- */ -- scope = new Scope(*sc); -- scope->setNoFree(); --#endif -- break; -- } -- } -- else -- init = i2; // no errors, keep result - } -- } -- else if (parent->isAggregateDeclaration()) -- { -- scope = new Scope(*sc); -- scope->setNoFree(); -+ else -+ { -+ scope = scx ? scx : new Scope(*sc); -+ scope->setNoFree(); -+ } - } - sc = sc->pop(); - } -@@ -1691,7 +1711,10 @@ Ldtor: - edtor = callScopeDtor(sc); - if (edtor) - { -- edtor = edtor->semantic(sc); -+ if (sc->func && storage_class & (STCstatic | STCgshared)) -+ edtor = edtor->semantic(sc->module->scope); -+ else -+ edtor = edtor->semantic(sc); - - #if 0 // currently disabled because of std.stdio.stdin, stdout and stderr - if (isDataseg() && !(storage_class & STCextern)) -@@ -1700,6 +1723,9 @@ Ldtor: - } - - sem = SemanticDone; -+ -+ if (type->toBasetype()->ty == Terror) -+ errors = true; - } - - void VarDeclaration::semantic2(Scope *sc) -@@ -1743,6 +1769,55 @@ void VarDeclaration::semantic2(Scope *sc - init = init->semantic(sc, type, INITinterpret); - inuse--; - } -+ if (storage_class & STCmanifest) -+ { -+ #if 0 -+ if ((type->ty == Tclass)&&type->isMutable()) -+ { -+ error("is mutable. Only const and immutable class enum are allowed, not %s", type->toChars()); -+ } -+ else if (type->ty == Tpointer && type->nextOf()->ty == Tstruct && type->nextOf()->isMutable()) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ if (ei->exp->op == TOKaddress && ((AddrExp *)ei->exp)->e1->op == TOKstructliteral) -+ { -+ error("is a pointer to mutable struct. Only pointers to const or immutable struct enum are allowed, not %s", type->toChars()); -+ } -+ } -+ #else -+ if (type->ty == Tclass && init) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ if (ei->exp->op == TOKclassreference) -+ error(": Unable to initialize enum with class or pointer to struct. Use static const variable instead."); -+ } -+ else if (type->ty == Tpointer && type->nextOf()->ty == Tstruct) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ if (ei && ei->exp->op == TOKaddress && ((AddrExp *)ei->exp)->e1->op == TOKstructliteral) -+ { -+ error(": Unable to initialize enum with class or pointer to struct. Use static const variable instead."); -+ } -+ } -+ #endif -+ } -+ else if (init && isThreadlocal()) -+ { -+ if ((type->ty == Tclass)&&type->isMutable()&&!type->isShared()) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ if (ei->exp->op == TOKclassreference) -+ error("is mutable. Only const or immutable class thread local variable are allowed, not %s", type->toChars()); -+ } -+ else if (type->ty == Tpointer && type->nextOf()->ty == Tstruct && type->nextOf()->isMutable() &&!type->nextOf()->isShared()) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ if (ei && ei->exp->op == TOKaddress && ((AddrExp *)ei->exp)->e1->op == TOKstructliteral) -+ { -+ error("is a pointer to mutable struct. Only pointers to const, immutable or shared struct thread local variable are allowed are allowed, not %s", type->toChars()); -+ } -+ } -+ } - sem = Semantic2Done; - } - -@@ -1755,7 +1830,7 @@ void VarDeclaration::setFieldOffset(Aggr - TupleDeclaration *v2 = aliassym->isTupleDeclaration(); - assert(v2); - for (size_t i = 0; i < v2->objects->dim; i++) -- { Object *o = (*v2->objects)[i]; -+ { RootObject *o = (*v2->objects)[i]; - assert(o->dyncast() == DYNCAST_EXPRESSION); - Expression *e = (Expression *)o; - assert(e->op == TOKdsymbol); -@@ -1765,7 +1840,7 @@ void VarDeclaration::setFieldOffset(Aggr - return; - } - -- if (!(storage_class & STCfield)) -+ if (!isField()) - return; - assert(!(storage_class & (STCstatic | STCextern | STCparameter | STCtls))); - -@@ -1786,47 +1861,32 @@ void VarDeclaration::setFieldOffset(Aggr - { // References are the size of a pointer - t = Type::tvoidptr; - } -- if (t->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)t; --#if DMDV2 -- if (ts->sym == ad) -- { -- ad->error("cannot have field %s with same struct type", toChars()); -- } --#endif -- -- if (ts->sym->sizeok != SIZEOKdone && ts->sym->scope) -- ts->sym->semantic(NULL); -- if (ts->sym->sizeok != SIZEOKdone) -- { -- ad->sizeok = SIZEOKfwd; // cannot finish; flag as forward referenced -- return; -- } -- } -- if (t->ty == Tident) -+ if (t->ty == Tstruct || t->ty == Tsarray) - { -- ad->sizeok = SIZEOKfwd; // cannot finish; flag as forward referenced -- return; -- } --#if DMDV2 -- else if (t->ty == Tsarray) -- { -- Type *tv = t->toBasetype(); -- while (tv->ty == Tsarray) -- { -- tv = tv->nextOf()->toBasetype(); -- } -+ Type *tv = t->baseElemOf(); - if (tv->ty == Tstruct) - { - TypeStruct *ts = (TypeStruct *)tv; -- if (ad == ts->sym) -+ if (ts->sym == ad) -+ { -+ const char *s = (t->ty == Tsarray) ? "static array of " : ""; -+ ad->error("cannot have field %s with %ssame struct type", toChars(), s); -+ } -+ if (ts->sym->sizeok != SIZEOKdone && ts->sym->scope) -+ ts->sym->semantic(NULL); -+ if (ts->sym->sizeok != SIZEOKdone) - { -- ad->error("cannot have field %s with same struct type", toChars()); -+ ad->sizeok = SIZEOKfwd; // cannot finish; flag as forward referenced - return; - } - } - } --#endif -+ if (t->ty == Tident) -+ { -+ ad->sizeok = SIZEOKfwd; // cannot finish; flag as forward referenced -+ return; -+ } -+ - - unsigned memsize = t->size(loc); // size of member - unsigned memalignsize = Target::fieldalign(t); // size of member for alignment purposes -@@ -1885,9 +1945,10 @@ AggregateDeclaration *VarDeclaration::is - if (!(storage_class & (STCstatic | STCextern | STCmanifest | STCtemplateparameter | - STCtls | STCgshared | STCctfe))) - { -+#if !PULL93 - if ((storage_class & (STCconst | STCimmutable | STCwild)) && init) - return NULL; -- -+#endif - for (Dsymbol *s = this; s; s = s->parent) - { - ad = s->isMember(); -@@ -1899,24 +1960,29 @@ AggregateDeclaration *VarDeclaration::is - return ad; - } - --int VarDeclaration::needThis() -+bool VarDeclaration::needThis() - { - //printf("VarDeclaration::needThis(%s, x%x)\n", toChars(), storage_class); -- return storage_class & STCfield; -+ return isField(); -+} -+ -+bool VarDeclaration::isExport() -+{ -+ return protection == PROTexport; - } - --int VarDeclaration::isImportedSymbol() -+bool VarDeclaration::isImportedSymbol() - { - if (protection == PROTexport && !init && - (storage_class & STCstatic || parent->isModule())) -- return TRUE; -- return FALSE; -+ return true; -+ return false; - } - - void VarDeclaration::checkCtorConstInit() - { - #if 0 /* doesn't work if more than one static ctor */ -- if (ctorinit == 0 && isCtorinit() && !(storage_class & STCfield)) -+ if (ctorinit == 0 && isCtorinit() && !isField()) - error("missing initializer in static constructor for const variable"); - #endif - } -@@ -1970,6 +2036,16 @@ void VarDeclaration::checkNestedReferenc - if (FuncLiteralDeclaration *fld = s->isFuncLiteralDeclaration()) - { - fld->tok = TOKdelegate; -+ -+ /* This is necessary to avoid breaking tests for 8751 & 8793. -+ * See: compilable/testInference.d -+ */ -+ if (type->isMutable() || // mutable variable -+ !type->implicitConvTo(type->immutableOf()) || // has any mutable indirections -+ !fdv->isPureBypassingInference()) // does not belong to pure function -+ { -+ fld->setImpure(); // Bugzilla 9415 -+ } - } - } - -@@ -2021,28 +2097,37 @@ ExpInitializer *VarDeclaration::getExpIn - * Otherwise, return NULL. - */ - --Expression *VarDeclaration::getConstInitializer() -+Expression *VarDeclaration::getConstInitializer(bool needFullType) - { -- if ((isConst() || isImmutable() || storage_class & STCmanifest) && -- storage_class & STCinit) -+ assert(type && init); -+ -+ // Ungag errors when not speculative -+ unsigned oldgag = global.gag; -+ if (global.isSpeculativeGagging()) - { -- ExpInitializer *ei = getExpInitializer(); -- if (ei) -- return ei->exp; -- else if (init) -- { -- return init->toExpression(); -- } -+ Dsymbol *sym = toParent()->isAggregateDeclaration(); -+ if (sym && !sym->isSpeculative()) -+ global.gag = 0; - } - -- return NULL; -+ if (scope) -+ { -+ inuse++; -+ init = init->semantic(scope, type, INITinterpret); -+ scope = NULL; -+ inuse--; -+ } -+ Expression *e = init->toExpression(needFullType ? type : NULL); -+ -+ global.gag = oldgag; -+ return e; - } - - /************************************* -- * Return !=0 if we can take the address of this variable. -+ * Return true if we can take the address of this variable. - */ - --int VarDeclaration::canTakeAddressOf() -+bool VarDeclaration::canTakeAddressOf() - { - #if 0 - /* Global variables and struct/class fields of the form: -@@ -2051,18 +2136,18 @@ int VarDeclaration::canTakeAddressOf() - */ - if ((isConst() || isImmutable()) && - storage_class & STCinit && -- (!(storage_class & (STCstatic | STCextern)) || (storage_class & STCfield)) && -+ (!(storage_class & (STCstatic | STCextern)) || isField()) && - (!parent || toParent()->isModule() || toParent()->isTemplateInstance()) && - type->toBasetype()->isTypeBasic() - ) - { -- return 0; -+ return false; - } - #else - if (storage_class & STCmanifest) -- return 0; -+ return false; - #endif -- return 1; -+ return true; - } - - -@@ -2071,7 +2156,7 @@ int VarDeclaration::canTakeAddressOf() - * Includes extern variables. - */ - --int VarDeclaration::isDataseg() -+bool VarDeclaration::isDataseg() - { - #if 0 - printf("VarDeclaration::isDataseg(%p, '%s')\n", this, toChars()); -@@ -2079,12 +2164,12 @@ int VarDeclaration::isDataseg() - printf("parent = '%s'\n", parent->toChars()); - #endif - if (storage_class & STCmanifest) -- return 0; -+ return false; - Dsymbol *parent = this->toParent(); - if (!parent && !(storage_class & STCstatic)) - { error("forward referenced"); - type = Type::terror; -- return 0; -+ return false; - } - return canTakeAddressOf() && - (storage_class & (STCstatic | STCextern | STCtls | STCgshared) || -@@ -2096,7 +2181,7 @@ int VarDeclaration::isDataseg() - * Does symbol go into thread local storage? - */ - --int VarDeclaration::isThreadlocal() -+bool VarDeclaration::isThreadlocal() - { - //printf("VarDeclaration::isThreadlocal(%p, '%s')\n", this, toChars()); - #if 0 //|| TARGET_OSX -@@ -2109,7 +2194,7 @@ int VarDeclaration::isThreadlocal() - /* Data defaults to being thread-local. It is not thread-local - * if it is immutable, const or shared. - */ -- int i = isDataseg() && -+ bool i = isDataseg() && - !(storage_class & (STCimmutable | STCconst | STCshared | STCgshared)); - //printf("\treturn %d\n", i); - return i; -@@ -2120,29 +2205,29 @@ int VarDeclaration::isThreadlocal() - * Can variable be read and written by CTFE? - */ - --int VarDeclaration::isCTFE() -+bool VarDeclaration::isCTFE() - { - return (storage_class & STCctfe) != 0; // || !isDataseg(); - } - --int VarDeclaration::hasPointers() -+bool VarDeclaration::hasPointers() - { - //printf("VarDeclaration::hasPointers() %s, ty = %d\n", toChars(), type->ty); - return (!isDataseg() && type->hasPointers()); - } - - /****************************************** -- * Return TRUE if variable needs to call the destructor. -+ * Return true if variable needs to call the destructor. - */ - --int VarDeclaration::needsAutoDtor() -+bool VarDeclaration::needsAutoDtor() - { - //printf("VarDeclaration::needsAutoDtor() %s\n", toChars()); - - if (noscope || !edtor) -- return FALSE; -+ return false; - -- return TRUE; -+ return true; - } - - -@@ -2163,19 +2248,14 @@ Expression *VarDeclaration::callScopeDto - } - - // Destructors for structs and arrays of structs -- bool array = false; -- Type *tv = type->toBasetype(); -- while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- array = true; -- tv = tv->nextOf()->toBasetype(); -- } -+ Type *tv = type->baseElemOf(); - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->dtor) - { -- if (array) -+ if (type->toBasetype()->ty == Tsarray) - { - // Typeinfo.destroy(cast(void*)&v); - Expression *ea = new SymOffExp(loc, this, 0, 0); -@@ -2236,15 +2316,24 @@ Expression *VarDeclaration::callScopeDto - - void ObjectNotFound(Identifier *id) - { -- Type::error(0, "%s not found. object.d may be incorrectly installed or corrupt.", id->toChars()); -+ Type::error(Loc(), "%s not found. object.d may be incorrectly installed or corrupt.", id->toChars()); - fatal(); - } - -+/******************************** SymbolDeclaration ********************************/ -+ -+SymbolDeclaration::SymbolDeclaration(Loc loc, StructDeclaration *dsym) -+ : Declaration(dsym->ident) -+{ -+ this->loc = loc; -+ this->dsym = dsym; -+ storage_class |= STCconst; -+} - - /********************************* ClassInfoDeclaration ****************************/ - - ClassInfoDeclaration::ClassInfoDeclaration(ClassDeclaration *cd) -- : VarDeclaration(0, ClassDeclaration::classinfo->type, cd->ident, NULL) -+ : VarDeclaration(Loc(), Type::typeinfoclass->type, cd->ident, NULL) - { - this->cd = cd; - storage_class = STCstatic | STCgshared; -@@ -2260,29 +2349,10 @@ void ClassInfoDeclaration::semantic(Scop - { - } - --/********************************* ModuleInfoDeclaration ****************************/ -- --ModuleInfoDeclaration::ModuleInfoDeclaration(Module *mod) -- : VarDeclaration(0, Module::moduleinfo->type, mod->ident, NULL) --{ -- this->mod = mod; -- storage_class = STCstatic | STCgshared; --} -- --Dsymbol *ModuleInfoDeclaration::syntaxCopy(Dsymbol *s) --{ -- assert(0); // should never be produced by syntax -- return NULL; --} -- --void ModuleInfoDeclaration::semantic(Scope *sc) --{ --} -- - /********************************* TypeInfoDeclaration ****************************/ - - TypeInfoDeclaration::TypeInfoDeclaration(Type *tinfo, int internal) -- : VarDeclaration(0, Type::typeinfo->type, tinfo->getTypeInfoIdent(internal), NULL) -+ : VarDeclaration(Loc(), Type::dtypeinfo->type, tinfo->getTypeInfoIdent(internal), NULL) - { - this->tinfo = tinfo; - storage_class = STCstatic | STCgshared; -@@ -2301,6 +2371,17 @@ void TypeInfoDeclaration::semantic(Scope - assert(linkage == LINKc); - } - -+char *TypeInfoDeclaration::toChars() -+{ -+ //printf("TypeInfoDeclaration::toChars() tinfo = %s\n", tinfo->toChars()); -+ OutBuffer buf; -+ buf.writestring("typeid("); -+ buf.writestring(tinfo->toChars()); -+ buf.writeByte(')'); -+ buf.writeByte(0); -+ return buf.extractData(); -+} -+ - /***************************** TypeInfoConstDeclaration **********************/ - - #if DMDV2 ---- a/src/gcc/d/dfrontend/declaration.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/declaration.h 2014-04-01 16:32:51.000000000 +0100 -@@ -19,19 +19,19 @@ - #include "lexer.h" - #include "mtype.h" - --struct Expression; --struct Statement; --struct LabelDsymbol; --struct Initializer; --struct Module; -+class Expression; -+class Statement; -+class LabelDsymbol; -+class Initializer; -+class Module; - struct InlineScanState; --struct ForeachStatement; --struct FuncDeclaration; --struct ExpInitializer; --struct StructDeclaration; --struct TupleType; -+class ForeachStatement; -+class FuncDeclaration; -+class ExpInitializer; -+class StructDeclaration; - struct InterState; - struct IRState; -+struct CompiledCtfeFunction; - - enum PROT; - enum LINK; -@@ -87,15 +87,11 @@ enum PURE; - #define STCtemp 0x10000000000LL // temporary variable introduced by inlining - // and used only in backend process, so it's rvalue - --#define STCStorageClass (STCauto | STCscope | STCstatic | STCextern | STCconst | STCfinal | \ -- STCabstract | STCsynchronized | STCdeprecated | STCoverride | STClazy | STCalias | \ -- STCout | STCin | \ -- STCmanifest | STCimmutable | STCshared | STCnothrow | STCpure | STCref | STCtls | \ -- STCgshared | STCproperty | STCsafe | STCtrusted | STCsystem | STCdisable) -- --#ifdef BUG6652 --#define STCbug6652 0x800000000000LL // --#endif -+const StorageClass STCStorageClass = (STCauto | STCscope | STCstatic | STCextern | STCconst | STCfinal | -+ STCabstract | STCsynchronized | STCdeprecated | STCoverride | STClazy | STCalias | -+ STCout | STCin | -+ STCmanifest | STCimmutable | STCshared | STCnothrow | STCpure | STCref | STCtls | -+ STCgshared | STCproperty | STCsafe | STCtrusted | STCsystem | STCdisable); - - struct Match - { -@@ -106,11 +102,10 @@ struct Match - FuncDeclaration *anyf; // pick a func, any func, to use for error recovery - }; - --void overloadResolveX(Match *m, FuncDeclaration *f, -- Expression *ethis, Expressions *arguments); --int overloadApply(FuncDeclaration *fstart, -- int (*fp)(void *, FuncDeclaration *), -- void *param); -+void functionResolve(Match *m, Dsymbol *fd, Loc loc, Scope *sc, Objects *tiargs, Type *tthis, Expressions *fargs); -+int overloadApply(Dsymbol *fstart, void *param, int (*fp)(void *, Dsymbol *)); -+ -+void ObjectNotFound(Identifier *id); - - enum Semantic - { -@@ -122,16 +117,17 @@ enum Semantic - - /**************************************************************/ - --struct Declaration : Dsymbol -+class Declaration : public Dsymbol - { -+public: - Type *type; - Type *originalType; // before semantic analysis - StorageClass storage_class; -- enum PROT protection; -- enum LINK linkage; -+ PROT protection; -+ LINK linkage; - int inuse; // used to detect cycles -- -- enum Semantic sem; -+ const char *mangleOverride; // overridden symbol with pragma(mangle, "...") -+ Semantic sem; - - Declaration(Identifier *id); - void semantic(Scope *sc); -@@ -143,44 +139,46 @@ struct Declaration : Dsymbol - - void emitComment(Scope *sc); - void toJson(JsonOut *json); -- void jsonProperties(JsonOut *json); -+ virtual void jsonProperties(JsonOut *json); - void toDocBuffer(OutBuffer *buf, Scope *sc); - -- char *mangle(bool isv = false); -- int isStatic() { return storage_class & STCstatic; } -- virtual int isDelete(); -- virtual int isDataseg(); -- virtual int isThreadlocal(); -- virtual int isCodeseg(); -- int isCtorinit() { return storage_class & STCctorinit; } -- int isFinal() { return storage_class & STCfinal; } -- int isAbstract() { return storage_class & STCabstract; } -- int isConst() { return storage_class & STCconst; } -- int isImmutable() { return storage_class & STCimmutable; } -- int isWild() { return storage_class & STCwild; } -- int isAuto() { return storage_class & STCauto; } -- int isScope() { return storage_class & STCscope; } -- int isSynchronized() { return storage_class & STCsynchronized; } -- int isParameter() { return storage_class & STCparameter; } -- int isDeprecated() { return storage_class & STCdeprecated; } -- int isOverride() { return storage_class & STCoverride; } -- StorageClass isResult() { return storage_class & STCresult; } -- -- int isIn() { return storage_class & STCin; } -- int isOut() { return storage_class & STCout; } -- int isRef() { return storage_class & STCref; } -+ const char *mangle(bool isv = false); -+ bool isStatic() { return (storage_class & STCstatic) != 0; } -+ virtual bool isDelete(); -+ virtual bool isDataseg(); -+ virtual bool isThreadlocal(); -+ virtual bool isCodeseg(); -+ bool isCtorinit() { return (storage_class & STCctorinit) != 0; } -+ bool isFinal() { return (storage_class & STCfinal) != 0; } -+ bool isAbstract() { return (storage_class & STCabstract) != 0; } -+ bool isConst() { return (storage_class & STCconst) != 0; } -+ bool isImmutable() { return (storage_class & STCimmutable) != 0; } -+ bool isWild() { return (storage_class & STCwild) != 0; } -+ bool isAuto() { return (storage_class & STCauto) != 0; } -+ bool isScope() { return (storage_class & STCscope) != 0; } -+ bool isSynchronized() { return (storage_class & STCsynchronized) != 0; } -+ bool isParameter() { return (storage_class & STCparameter) != 0; } -+ bool isDeprecated() { return (storage_class & STCdeprecated) != 0; } -+ bool isOverride() { return (storage_class & STCoverride) != 0; } -+ bool isResult() { return (storage_class & STCresult) != 0; } -+ bool isField() { return (storage_class & STCfield) != 0; } -+ -+ bool isIn() { return (storage_class & STCin) != 0; } -+ bool isOut() { return (storage_class & STCout) != 0; } -+ bool isRef() { return (storage_class & STCref) != 0; } - -- enum PROT prot(); -+ PROT prot(); - - Declaration *isDeclaration() { return this; } - }; - - /**************************************************************/ - --struct TupleDeclaration : Declaration -+class TupleDeclaration : public Declaration - { -+public: - Objects *objects; -- int isexp; // 1: expression tuple -+ bool isexp; // true: expression tuple - - TypeTuple *tupletype; // !=NULL if this is a type tuple - -@@ -188,15 +186,16 @@ struct TupleDeclaration : Declaration - Dsymbol *syntaxCopy(Dsymbol *); - const char *kind(); - Type *getType(); -- int needThis(); -+ bool needThis(); - - TupleDeclaration *isTupleDeclaration() { return this; } - }; - - /**************************************************************/ - --struct TypedefDeclaration : Declaration -+class TypedefDeclaration : public Declaration - { -+public: - Type *basetype; - Initializer *init; - -@@ -204,7 +203,7 @@ struct TypedefDeclaration : Declaration - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - void semantic2(Scope *sc); -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); - const char *kind(); - Type *getType(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -226,18 +225,19 @@ struct TypedefDeclaration : Declaration - - /**************************************************************/ - --struct AliasDeclaration : Declaration -+class AliasDeclaration : public Declaration - { -+public: - Dsymbol *aliassym; - Dsymbol *overnext; // next in overload list - Dsymbol *import; // !=NULL if unresolved internal alias for selective import -- int inSemantic; -+ bool inSemantic; - - AliasDeclaration(Loc loc, Identifier *ident, Type *type); - AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); -- int overloadInsert(Dsymbol *s); -+ bool overloadInsert(Dsymbol *s); - const char *kind(); - Type *getType(); - Dsymbol *toAlias(); -@@ -252,8 +252,9 @@ struct AliasDeclaration : Declaration - - /**************************************************************/ - --struct VarDeclaration : Declaration -+class VarDeclaration : public Declaration - { -+public: - Initializer *init; - unsigned offset; - bool noscope; // no auto semantics -@@ -298,27 +299,27 @@ struct VarDeclaration : Declaration - Type *htype; - Initializer *hinit; - AggregateDeclaration *isThis(); -- int needThis(); -- int isImportedSymbol(); -- int isDataseg(); -- int isThreadlocal(); -- int isCTFE(); -- int hasPointers(); -+ bool needThis(); -+ bool isExport(); -+ bool isImportedSymbol(); -+ bool isDataseg(); -+ bool isThreadlocal(); -+ bool isCTFE(); -+ bool hasPointers(); - #if DMDV2 -- int canTakeAddressOf(); -- int needsAutoDtor(); -+ bool canTakeAddressOf(); -+ bool needsAutoDtor(); - #endif - Expression *callScopeDtor(Scope *sc); - ExpInitializer *getExpInitializer(); -- Expression *getConstInitializer(); -+ Expression *getConstInitializer(bool needFullType = true); - void checkCtorConstInit(); - void checkNestedReference(Scope *sc, Loc loc); - Dsymbol *toAlias(); -- - Symbol *toSymbol(); - void toObjFile(int multiobj); // compile to .obj file - int cvMember(unsigned char *p); -- -+ const char *mangle(bool isv = false); - // Eliminate need for dynamic_cast - VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } - }; -@@ -327,12 +328,12 @@ struct VarDeclaration : Declaration - - // This is a shell around a back end symbol - --struct SymbolDeclaration : Declaration -+class SymbolDeclaration : public Declaration - { -- Symbol *sym; -+public: - StructDeclaration *dsym; - -- SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); -+ SymbolDeclaration(Loc loc, StructDeclaration *dsym); - - Symbol *toSymbol(); - -@@ -340,8 +341,9 @@ struct SymbolDeclaration : Declaration - SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } - }; - --struct ClassInfoDeclaration : VarDeclaration -+class ClassInfoDeclaration : public VarDeclaration - { -+public: - ClassDeclaration *cd; - - ClassInfoDeclaration(ClassDeclaration *cd); -@@ -354,27 +356,15 @@ struct ClassInfoDeclaration : VarDeclara - Symbol *toSymbol(); - }; - --struct ModuleInfoDeclaration : VarDeclaration --{ -- Module *mod; -- -- ModuleInfoDeclaration(Module *mod); -- Dsymbol *syntaxCopy(Dsymbol *); -- void semantic(Scope *sc); -- -- void emitComment(Scope *sc); -- void toJson(JsonOut *json); -- -- Symbol *toSymbol(); --}; -- --struct TypeInfoDeclaration : VarDeclaration -+class TypeInfoDeclaration : public VarDeclaration - { -+public: - Type *tinfo; - - TypeInfoDeclaration(Type *tinfo, int internal); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); -+ char *toChars(); - - void emitComment(Scope *sc); - void toJson(JsonOut *json); -@@ -382,124 +372,143 @@ struct TypeInfoDeclaration : VarDeclarat - Symbol *toSymbol(); - void toObjFile(int multiobj); // compile to .obj file - virtual void toDt(dt_t **pdt); -+ -+ TypeInfoDeclaration *isTypeInfoDeclaration() { return this; } - }; - --struct TypeInfoStructDeclaration : TypeInfoDeclaration -+class TypeInfoStructDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoStructDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoClassDeclaration : TypeInfoDeclaration -+class TypeInfoClassDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoClassDeclaration(Type *tinfo); - Symbol *toSymbol(); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration -+class TypeInfoInterfaceDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoInterfaceDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoTypedefDeclaration : TypeInfoDeclaration -+class TypeInfoTypedefDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoTypedefDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoPointerDeclaration : TypeInfoDeclaration -+class TypeInfoPointerDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoPointerDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoArrayDeclaration : TypeInfoDeclaration -+class TypeInfoArrayDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoArrayDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration -+class TypeInfoStaticArrayDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoStaticArrayDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration -+class TypeInfoAssociativeArrayDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoAssociativeArrayDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoEnumDeclaration : TypeInfoDeclaration -+class TypeInfoEnumDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoEnumDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoFunctionDeclaration : TypeInfoDeclaration -+class TypeInfoFunctionDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoFunctionDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoDelegateDeclaration : TypeInfoDeclaration -+class TypeInfoDelegateDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoDelegateDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoTupleDeclaration : TypeInfoDeclaration -+class TypeInfoTupleDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoTupleDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - - #if DMDV2 --struct TypeInfoConstDeclaration : TypeInfoDeclaration -+class TypeInfoConstDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoConstDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoInvariantDeclaration : TypeInfoDeclaration -+class TypeInfoInvariantDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoInvariantDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoSharedDeclaration : TypeInfoDeclaration -+class TypeInfoSharedDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoSharedDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoWildDeclaration : TypeInfoDeclaration -+class TypeInfoWildDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoWildDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); - }; - --struct TypeInfoVectorDeclaration : TypeInfoDeclaration -+class TypeInfoVectorDeclaration : public TypeInfoDeclaration - { -+public: - TypeInfoVectorDeclaration(Type *tinfo); - - void toDt(dt_t **pdt); -@@ -508,8 +517,9 @@ struct TypeInfoVectorDeclaration : TypeI - - /**************************************************************/ - --struct ThisDeclaration : VarDeclaration -+class ThisDeclaration : public VarDeclaration - { -+public: - ThisDeclaration(Loc loc, Type *t); - Dsymbol *syntaxCopy(Dsymbol *); - ThisDeclaration *isThisDeclaration() { return this; } -@@ -548,14 +558,15 @@ enum BUILTIN - #endif - }; - --Expression *eval_builtin(Loc loc, enum BUILTIN builtin, Expressions *arguments); -+Expression *eval_builtin(Loc loc, BUILTIN builtin, Expressions *arguments); - - #else - enum BUILTIN { }; - #endif - --struct FuncDeclaration : Declaration -+class FuncDeclaration : public Declaration - { -+public: - Types *fthrows; // Array of Type's of exceptions (not used) - Statement *frequire; - Statement *fensure; -@@ -581,23 +592,26 @@ struct FuncDeclaration : Declaration - VarDeclaration *v_argsave; // save area for args passed in registers for variadic functions - VarDeclarations *parameters; // Array of VarDeclaration's for parameters - DsymbolTable *labtab; // statement label symbol table -- Declaration *overnext; // next in overload list -+ Dsymbol *overnext; // next in overload list -+ FuncDeclaration *overnext0; // next in overload list (only used during IFTI) - Loc endloc; // location of closing curly bracket - int vtblIndex; // for member functions, index into vtbl[] -- bool naked; // !=0 if naked -+ bool naked; // true if naked - ILS inlineStatusStmt; - ILS inlineStatusExp; -+ -+ CompiledCtfeFunction *ctfeCode; // Compiled code for interpreter - int inlineNest; // !=0 if nested inline -- bool isArrayOp; // !=0 if array operation -- enum PASS semanticRun; -+ bool isArrayOp; // true if array operation -+ FuncDeclaration *dArrayOp; // D version of array op for ctfe - int semantic3Errors; // !=0 if errors in semantic3 - // this function's frame ptr - ForeachStatement *fes; // if foreach body, this is the foreach -- bool introducing; // !=0 if 'introducing' function -+ bool introducing; // true if 'introducing' function - Type *tintro; // if !=NULL, then this is the type - // of the 'introducing' function - // this one is overriding -- int inferRetType; // !=0 if return type is to be inferred -+ bool inferRetType; // true if return type is to be inferred - StorageClass storage_class2; // storage class for template onemember's - - // Things that should really go into Scope -@@ -607,14 +621,14 @@ struct FuncDeclaration : Declaration - // 8 if there's inline asm - - // Support for NRVO (named return value optimization) -- bool nrvo_can; // !=0 means we can do it -+ bool nrvo_can; // true means we can do it - VarDeclaration *nrvo_var; // variable to replace with shidden - Symbol *shidden; // hidden pointer passed to function - - ReturnStatements *returns; - - #if DMDV2 -- enum BUILTIN builtin; // set if this is a known, builtin -+ BUILTIN builtin; // set if this is a known, builtin - // function we can evaluate at compile - // time - -@@ -645,16 +659,16 @@ struct FuncDeclaration : Declaration - bool functionSemantic3(); - // called from semantic3 - VarDeclaration *declareThis(Scope *sc, AggregateDeclaration *ad); -- int equals(Object *o); -+ bool equals(RootObject *o); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); - void toJson(JsonOut *json); - int overrides(FuncDeclaration *fd); - int findVtblIndex(Dsymbols *vtbl, int dim); -- int overloadInsert(Dsymbol *s); -+ bool overloadInsert(Dsymbol *s); - FuncDeclaration *overloadExactMatch(Type *t); -- FuncDeclaration *overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags = 0); -+ TemplateDeclaration *findTemplateDeclRoot(); - MATCH leastAsSpecialized(FuncDeclaration *g); - LabelDsymbol *searchLabel(Identifier *ident); - AggregateDeclaration *isThis(); -@@ -662,33 +676,37 @@ struct FuncDeclaration : Declaration - int getLevel(Loc loc, Scope *sc, FuncDeclaration *fd); // lexical nesting level difference - void appendExp(Expression *e); - void appendState(Statement *s); -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); -+ const char *mangleExact(bool isv = false); - const char *toPrettyChars(); -- int isMain(); -- int isWinMain(); -- int isDllMain(); -- enum BUILTIN isBuiltin(); -- int isExport(); -- int isImportedSymbol(); -- int isAbstract(); -- int isCodeseg(); -- int isOverloadable(); -- int hasOverloads(); -- enum PURE isPure(); -- enum PURE isPureBypassingInference(); -+ const char *toFullSignature(); // for diagnostics, e.g. 'int foo(int x, int y) pure' -+ bool isMain(); -+ bool isWinMain(); -+ bool isDllMain(); -+ BUILTIN isBuiltin(); -+ bool isExport(); -+ bool isImportedSymbol(); -+ bool isCodeseg(); -+ bool isOverloadable(); -+ bool hasOverloads(); -+ PURE isPure(); -+ PURE isPureBypassingInference(); - bool setImpure(); -- int isSafe(); -+ bool isSafe(); - bool isSafeBypassingInference(); -- int isTrusted(); -+ bool isTrusted(); - bool setUnsafe(); -- virtual int isNested(); -- int needThis(); -- int isVirtualMethod(); -- virtual int isVirtual(); -- virtual int isFinal(); -- virtual int addPreInvariant(); -- virtual int addPostInvariant(); -+ bool isolateReturn(); -+ bool parametersIntersect(Type *t); -+ virtual bool isNested(); -+ bool needThis(); -+ bool isVirtualMethod(); -+ virtual bool isVirtual(); -+ virtual bool isFinalFunc(); -+ virtual bool addPreInvariant(); -+ virtual bool addPostInvariant(); - Expression *interpret(InterState *istate, Expressions *arguments, Expression *thisexp = NULL); -+ void ctfeCompile(); - void inlineScan(); - int canInline(int hasthis, int hdrscan, int statementsToo); - Expression *expandInline(InlineScanState *iss, Expression *ethis, Expressions *arguments, Statement **ps); -@@ -696,15 +714,15 @@ struct FuncDeclaration : Declaration - void toDocBuffer(OutBuffer *buf, Scope *sc); - FuncDeclaration *isUnique(); - void checkNestedReference(Scope *sc, Loc loc); -- int needsClosure(); -- int hasNestedFrameRefs(); -+ bool needsClosure(); -+ bool hasNestedFrameRefs(); - void buildResultVar(); - Statement *mergeFrequire(Statement *); -- Statement *mergeFensure(Statement *); -+ Statement *mergeFensure(Statement *, Identifier *oid); - Parameters *getParameters(int *pvarargs); - -- static FuncDeclaration *genCfunc(Type *treturn, const char *name); -- static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); -+ static FuncDeclaration *genCfunc(Parameters *args, Type *treturn, const char *name); -+ static FuncDeclaration *genCfunc(Parameters *args, Type *treturn, Identifier *id); - - Symbol *toSymbol(); - Symbol *toThunkSymbol(int offset); // thunk version -@@ -718,105 +736,110 @@ struct FuncDeclaration : Declaration - }; - - #if DMDV2 --FuncDeclaration *resolveFuncCall(Scope *sc, Loc loc, Dsymbol *s, -+FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, - Objects *tiargs, -- Expression *ethis, -+ Type *tthis, - Expressions *arguments, -- int flags); -+ int flags = 0); - #endif - --struct FuncAliasDeclaration : FuncDeclaration -+class FuncAliasDeclaration : public FuncDeclaration - { -+public: - FuncDeclaration *funcalias; -- int hasOverloads; -+ bool hasOverloads; - -- FuncAliasDeclaration(FuncDeclaration *funcalias, int hasOverloads = 1); -+ FuncAliasDeclaration(FuncDeclaration *funcalias, bool hasOverloads = true); - - FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } - const char *kind(); - Symbol *toSymbol(); -- char *mangle(bool isv = false) { return toAliasFunc()->mangle(isv); } -+ const char *mangle(bool isv = false); - - FuncDeclaration *toAliasFunc(); - }; - --struct FuncLiteralDeclaration : FuncDeclaration -+class FuncLiteralDeclaration : public FuncDeclaration - { -- enum TOK tok; // TOKfunction or TOKdelegate -+public: -+ TOK tok; // TOKfunction or TOKdelegate - Type *treq; // target of return type inference - -- FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, -- ForeachStatement *fes); -+ FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, TOK tok, -+ ForeachStatement *fes, Identifier *id = NULL); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Dsymbol *syntaxCopy(Dsymbol *); -- int isNested(); -- int isVirtual(); -+ bool isNested(); -+ bool isVirtual(); - - FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } - const char *kind(); - }; - --struct CtorDeclaration : FuncDeclaration -+class CtorDeclaration : public FuncDeclaration - { -+public: - CtorDeclaration(Loc loc, Loc endloc, StorageClass stc, Type *type); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - const char *kind(); - char *toChars(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -- bool isImplicit; // implicitly generated ctor -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - - CtorDeclaration *isCtorDeclaration() { return this; } - }; - - #if DMDV2 --struct PostBlitDeclaration : FuncDeclaration -+class PostBlitDeclaration : public FuncDeclaration - { -+public: - PostBlitDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void toJson(JsonOut *json); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -- int overloadInsert(Dsymbol *s); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); -+ bool overloadInsert(Dsymbol *s); - void emitComment(Scope *sc); - - PostBlitDeclaration *isPostBlitDeclaration() { return this; } - }; - #endif - --struct DtorDeclaration : FuncDeclaration -+class DtorDeclaration : public FuncDeclaration - { -+public: - DtorDeclaration(Loc loc, Loc endloc); -- DtorDeclaration(Loc loc, Loc endloc, Identifier *id); -+ DtorDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - const char *kind(); - char *toChars(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -- int overloadInsert(Dsymbol *s); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); -+ bool overloadInsert(Dsymbol *s); - void emitComment(Scope *sc); - - DtorDeclaration *isDtorDeclaration() { return this; } - }; - --struct StaticCtorDeclaration : FuncDeclaration -+class StaticCtorDeclaration : public FuncDeclaration - { -+public: - StaticCtorDeclaration(Loc loc, Loc endloc); - StaticCtorDeclaration(Loc loc, Loc endloc, const char *name); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - AggregateDeclaration *isThis(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - bool hasStaticCtorOrDtor(); - void emitComment(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -825,8 +848,9 @@ struct StaticCtorDeclaration : FuncDecla - }; - - #if DMDV2 --struct SharedStaticCtorDeclaration : StaticCtorDeclaration -+class SharedStaticCtorDeclaration : public StaticCtorDeclaration - { -+public: - SharedStaticCtorDeclaration(Loc loc, Loc endloc); - Dsymbol *syntaxCopy(Dsymbol *); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -835,18 +859,20 @@ struct SharedStaticCtorDeclaration : Sta - }; - #endif - --struct StaticDtorDeclaration : FuncDeclaration --{ VarDeclaration *vgate; // 'gate' variable -+class StaticDtorDeclaration : public FuncDeclaration -+{ -+public: -+ VarDeclaration *vgate; // 'gate' variable - -- StaticDtorDeclaration(Loc loc, Loc endloc); -- StaticDtorDeclaration(Loc loc, Loc endloc, const char *name); -+ StaticDtorDeclaration(Loc loc, Loc endloc, StorageClass stc); -+ StaticDtorDeclaration(Loc loc, Loc endloc, const char *name, StorageClass stc); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - AggregateDeclaration *isThis(); -- int isVirtual(); -+ bool isVirtual(); - bool hasStaticCtorOrDtor(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - void emitComment(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -@@ -854,9 +880,10 @@ struct StaticDtorDeclaration : FuncDecla - }; - - #if DMDV2 --struct SharedStaticDtorDeclaration : StaticDtorDeclaration -+class SharedStaticDtorDeclaration : public StaticDtorDeclaration - { -- SharedStaticDtorDeclaration(Loc loc, Loc endloc); -+public: -+ SharedStaticDtorDeclaration(Loc loc, Loc endloc, StorageClass stc); - Dsymbol *syntaxCopy(Dsymbol *); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -@@ -864,36 +891,42 @@ struct SharedStaticDtorDeclaration : Sta - }; - #endif - --struct InvariantDeclaration : FuncDeclaration -+class InvariantDeclaration : public FuncDeclaration - { -- InvariantDeclaration(Loc loc, Loc endloc); -+public: -+ InvariantDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id = NULL); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - void emitComment(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - InvariantDeclaration *isInvariantDeclaration() { return this; } - }; - --struct UnitTestDeclaration : FuncDeclaration -+class UnitTestDeclaration : public FuncDeclaration - { -- UnitTestDeclaration(Loc loc, Loc endloc); -+public: -+ char *codedoc; /** For documented unittest. */ -+ UnitTestDeclaration(Loc loc, Loc endloc, char *codedoc); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - AggregateDeclaration *isThis(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); -+ void emitComment(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - UnitTestDeclaration *isUnitTestDeclaration() { return this; } - }; - --struct NewDeclaration : FuncDeclaration --{ Parameters *arguments; -+class NewDeclaration : public FuncDeclaration -+{ -+public: -+ Parameters *arguments; - int varargs; - - NewDeclaration(Loc loc, Loc endloc, Parameters *arguments, int varargs); -@@ -901,26 +934,28 @@ struct NewDeclaration : FuncDeclaration - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - const char *kind(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - - NewDeclaration *isNewDeclaration() { return this; } - }; - - --struct DeleteDeclaration : FuncDeclaration --{ Parameters *arguments; -+class DeleteDeclaration : public FuncDeclaration -+{ -+public: -+ Parameters *arguments; - - DeleteDeclaration(Loc loc, Loc endloc, Parameters *arguments); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - const char *kind(); -- int isDelete(); -- int isVirtual(); -- int addPreInvariant(); -- int addPostInvariant(); -+ bool isDelete(); -+ bool isVirtual(); -+ bool addPreInvariant(); -+ bool addPostInvariant(); - DeleteDeclaration *isDeleteDeclaration() { return this; } - }; - ---- a/src/gcc/d/dfrontend/delegatize.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/delegatize.c 2014-04-01 16:32:51.000000000 +0100 -@@ -116,7 +116,7 @@ int lambdaCheckForNestedRef(Expression * - { SymOffExp *se = (SymOffExp *)e; - VarDeclaration *v = se->var->isVarDeclaration(); - if (v) -- v->checkNestedReference(sc, 0); -+ v->checkNestedReference(sc, Loc()); - break; - } - -@@ -124,7 +124,7 @@ int lambdaCheckForNestedRef(Expression * - { VarExp *ve = (VarExp *)e; - VarDeclaration *v = ve->var->isVarDeclaration(); - if (v) -- v->checkNestedReference(sc, 0); -+ v->checkNestedReference(sc, Loc()); - break; - } - -@@ -133,7 +133,7 @@ int lambdaCheckForNestedRef(Expression * - { ThisExp *te = (ThisExp *)e; - VarDeclaration *v = te->var->isVarDeclaration(); - if (v) -- v->checkNestedReference(sc, 0); -+ v->checkNestedReference(sc, Loc()); - break; - } - -@@ -142,7 +142,7 @@ int lambdaCheckForNestedRef(Expression * - VarDeclaration *v = de->declaration->isVarDeclaration(); - if (v) - { -- v->checkNestedReference(sc, 0); -+ v->checkNestedReference(sc, Loc()); - - /* Some expressions cause the frontend to create a temporary. - * For example, structs with cpctors replace the original ---- a/src/gcc/d/dfrontend/doc.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/doc.c 2014-04-01 16:32:51.000000000 +0100 -@@ -44,12 +44,13 @@ struct Escape - const char *escapeChar(unsigned c); - }; - --struct Section -+class Section - { -- unsigned char *name; -+public: -+ utf8_t *name; - size_t namelen; - -- unsigned char *body; -+ utf8_t *body; - size_t bodylen; - - int nooutput; -@@ -57,17 +58,19 @@ struct Section - virtual void write(DocComment *dc, Scope *sc, Dsymbol *s, OutBuffer *buf); - }; - --struct ParamSection : Section -+class ParamSection : public Section - { -+public: - void write(DocComment *dc, Scope *sc, Dsymbol *s, OutBuffer *buf); - }; - --struct MacroSection : Section -+class MacroSection : public Section - { -+public: - void write(DocComment *dc, Scope *sc, Dsymbol *s, OutBuffer *buf); - }; - --typedef ArrayBase<Section> Sections; -+typedef Array<Section> Sections; - - struct DocComment - { -@@ -83,32 +86,35 @@ struct DocComment - summary(NULL), copyright(NULL), macros(NULL), pmacrotable(NULL), pescapetable(NULL) - { } - -- static DocComment *parse(Scope *sc, Dsymbol *s, unsigned char *comment); -- static void parseMacros(Escape **pescapetable, Macro **pmacrotable, unsigned char *m, size_t mlen); -- static void parseEscapes(Escape **pescapetable, unsigned char *textstart, size_t textlen); -+ static DocComment *parse(Scope *sc, Dsymbol *s, utf8_t *comment); -+ static void parseMacros(Escape **pescapetable, Macro **pmacrotable, utf8_t *m, size_t mlen); -+ static void parseEscapes(Escape **pescapetable, utf8_t *textstart, size_t textlen); - -- void parseSections(unsigned char *comment); -+ void parseSections(utf8_t *comment); - void writeSections(Scope *sc, Dsymbol *s, OutBuffer *buf); - }; - - - int cmp(const char *stringz, void *s, size_t slen); - int icmp(const char *stringz, void *s, size_t slen); --int isDitto(unsigned char *comment); --unsigned char *skipwhitespace(unsigned char *p); -+int isDitto(utf8_t *comment); -+utf8_t *skipwhitespace(utf8_t *p); - size_t skiptoident(OutBuffer *buf, size_t i); - size_t skippastident(OutBuffer *buf, size_t i); - size_t skippastURL(OutBuffer *buf, size_t i); - void highlightText(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset); - void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset, bool anchor = true); - void highlightCode2(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset); --Parameter *isFunctionParameter(Dsymbol *s, unsigned char *p, size_t len); -+TypeFunction *isTypeFunction(Dsymbol *s); -+Parameter *isFunctionParameter(Dsymbol *s, utf8_t *p, size_t len); -+TemplateParameter *isTemplateParameter(Dsymbol *s, utf8_t *p, size_t len); -+ -+int isIdStart(utf8_t *p); -+int isIdTail(utf8_t *p); -+int isIndentWS(utf8_t *p); -+int utfStride(utf8_t *p); - --int isIdStart(unsigned char *p); --int isIdTail(unsigned char *p); --int utfStride(unsigned char *p); -- --static unsigned char ddoc_default[] = "\ -+static const char ddoc_default[] = "\ - DDOC = <html><head>\n\ - <META http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n\ - <title>$(TITLE)</title>\n\ -@@ -140,6 +146,7 @@ LINK2 = <a href=\"$1\">$+</a>\n\ - LPAREN= (\n\ - RPAREN= )\n\ - DOLLAR= $\n\ -+DEPRECATED= $0\n\ - \n\ - RED = <font color=red>$0</font>\n\ - BLUE = <font color=blue>$0</font>\n\ -@@ -183,6 +190,7 @@ DDOC_CLASS_MEMBERS = $(DDOC_MEMBERS $0) - DDOC_STRUCT_MEMBERS = $(DDOC_MEMBERS $0)\n\ - DDOC_ENUM_MEMBERS = $(DDOC_MEMBERS $0)\n\ - DDOC_TEMPLATE_MEMBERS = $(DDOC_MEMBERS $0)\n\ -+DDOC_ENUM_BASETYPE = $0\n\ - DDOC_PARAMS = $(B Params:)$(BR)\n$(TABLE $0)$(BR)\n\ - DDOC_PARAM_ROW = $(TR $0)\n\ - DDOC_PARAM_ID = $(TD $0)\n\ -@@ -199,11 +207,11 @@ ESCAPES = /</</\n\ - /&/&/\n\ - "; - --static char ddoc_decl_s[] = "$(DDOC_DECL "; --static char ddoc_decl_e[] = ")\n"; -+static const char ddoc_decl_s[] = "$(DDOC_DECL "; -+static const char ddoc_decl_e[] = ")\n"; - --static char ddoc_decl_dd_s[] = "$(DDOC_DECL_DD "; --static char ddoc_decl_dd_e[] = ")\n"; -+static const char ddoc_decl_dd_s[] = "$(DDOC_DECL_DD "; -+static const char ddoc_decl_dd_e[] = ")\n"; - - - /**************************************************** -@@ -222,7 +230,7 @@ void Module::gendocfile() - { mbuf_done = 1; - - // Use our internal default -- mbuf.write(ddoc_default, sizeof(ddoc_default) - 1); -+ mbuf.write(ddoc_default, strlen(ddoc_default)); - - // Override with DDOCFILE specified in the sc.ini file - char *p = getenv("DDOCFILE"); -@@ -234,7 +242,7 @@ void Module::gendocfile() - { - FileName f((*global.params.ddocfiles)[i]); - File file(&f); -- file.readv(); -+ readFile(loc, &file); - // BUG: convert file contents to UTF-8 before use - - //printf("file: '%.*s'\n", file.len, file.buffer); -@@ -254,7 +262,7 @@ void Module::gendocfile() - - // Set the title to be the name of the module - { const char *p = toPrettyChars(); -- Macro::define(¯otable, (unsigned char *)"TITLE", 5, (unsigned char *)p, strlen(p)); -+ Macro::define(¯otable, (utf8_t *)"TITLE", 5, (utf8_t *)p, strlen(p)); - } - - // Set time macros -@@ -262,20 +270,20 @@ void Module::gendocfile() - time(&t); - char *p = ctime(&t); - p = mem.strdup(p); -- Macro::define(¯otable, (unsigned char *)"DATETIME", 8, (unsigned char *)p, strlen(p)); -- Macro::define(¯otable, (unsigned char *)"YEAR", 4, (unsigned char *)p + 20, 4); -+ Macro::define(¯otable, (utf8_t *)"DATETIME", 8, (utf8_t *)p, strlen(p)); -+ Macro::define(¯otable, (utf8_t *)"YEAR", 4, (utf8_t *)p + 20, 4); - } - - char *srcfilename = srcfile->toChars(); -- Macro::define(¯otable, (unsigned char *)"SRCFILENAME", 11, (unsigned char *)srcfilename, strlen(srcfilename)); -+ Macro::define(¯otable, (utf8_t *)"SRCFILENAME", 11, (utf8_t *)srcfilename, strlen(srcfilename)); - - char *docfilename = docfile->toChars(); -- Macro::define(¯otable, (unsigned char *)"DOCFILENAME", 11, (unsigned char *)docfilename, strlen(docfilename)); -+ Macro::define(¯otable, (utf8_t *)"DOCFILENAME", 11, (utf8_t *)docfilename, strlen(docfilename)); - - if (dc->copyright) - { - dc->copyright->nooutput = 1; -- Macro::define(¯otable, (unsigned char *)"COPYRIGHT", 9, dc->copyright->body, dc->copyright->bodylen); -+ Macro::define(¯otable, (utf8_t *)"COPYRIGHT", 9, dc->copyright->body, dc->copyright->bodylen); - } - - buf.printf("$(DDOC_COMMENT Generated by Ddoc from %s)\n", srcfile->toChars()); -@@ -297,7 +305,7 @@ void Module::gendocfile() - } - - //printf("BODY= '%.*s'\n", buf.offset, buf.data); -- Macro::define(¯otable, (unsigned char *)"BODY", 4, buf.data, buf.offset); -+ Macro::define(¯otable, (utf8_t *)"BODY", 4, buf.data, buf.offset); - - OutBuffer buf2; - buf2.writestring("$(DDOC)\n"); -@@ -311,10 +319,10 @@ void Module::gendocfile() - { - buf.setsize(0); - buf.reserve(buf2.offset); -- unsigned char *p = buf2.data; -+ utf8_t *p = buf2.data; - for (size_t j = 0; j < buf2.offset; j++) - { -- unsigned char c = p[j]; -+ utf8_t c = p[j]; - if (c == 0xFF && j + 1 < buf2.offset) - { - j++; -@@ -339,13 +347,13 @@ void Module::gendocfile() - assert(docfile); - docfile->setbuffer(buf.data, buf.offset); - docfile->ref = 1; -- FileName::ensurePathToNameExists(docfile->toChars()); -- docfile->writev(); -+ ensurePathToNameExists(Loc(), docfile->toChars()); -+ writeFile(loc, docfile); - #else - /* Remove all the escape sequences from buf2 - */ - { size_t i = 0; -- unsigned char *p = buf2.data; -+ utf8_t *p = buf2.data; - for (size_t j = 0; j < buf2.offset; j++) - { - if (p[j] == 0xFF && j + 1 < buf2.offset) -@@ -362,8 +370,8 @@ void Module::gendocfile() - // Transfer image to file - docfile->setbuffer(buf2.data, buf2.offset); - docfile->ref = 1; -- FileName::ensurePathToNameExists(docfile->toChars()); -- docfile->writev(); -+ ensurePathToNameExists(Loc(), docfile->toChars()); -+ writeFile(loc, docfile); - #endif - } - -@@ -378,7 +386,7 @@ void escapeDdocString(OutBuffer *buf, si - { - for (size_t u = start; u < buf->offset; u++) - { -- unsigned char c = buf->data[u]; -+ utf8_t c = buf->data[u]; - switch(c) - { - case '$': -@@ -408,13 +416,20 @@ void escapeDdocString(OutBuffer *buf, si - - * Fix by replacing unmatched ( with $(LPAREN) and unmatched ) with $(RPAREN). - */ --void escapeStrayParenthesis(OutBuffer *buf, size_t start, Loc loc) -+void escapeStrayParenthesis(OutBuffer *buf, size_t start, Dsymbol *s) - { - unsigned par_open = 0; -+ Loc loc = s->loc; -+ -+ if (Module *m = s->isModule()) -+ { -+ if (m->md) -+ loc = m->md->loc; -+ } - - for (size_t u = start; u < buf->offset; u++) - { -- unsigned char c = buf->data[u]; -+ utf8_t c = buf->data[u]; - switch(c) - { - case '(': -@@ -449,7 +464,7 @@ void escapeStrayParenthesis(OutBuffer *b - { par_open = 0; - for (size_t u = buf->offset; u > start;) - { u--; -- unsigned char c = buf->data[u]; -+ utf8_t c = buf->data[u]; - switch(c) - { - case ')': -@@ -473,8 +488,93 @@ void escapeStrayParenthesis(OutBuffer *b - } - } - -+static bool emitAnchorName(OutBuffer *buf, Dsymbol *s) -+{ -+ if (!s || s->isPackage() || s->isModule()) -+ return false; -+ -+ TemplateDeclaration *td; -+ bool dot; -+ -+ // Add parent names first -+ dot = emitAnchorName(buf, s->parent); -+ // Eponymous template members can share the parent anchor name -+ if (s->parent && (td = s->parent->isTemplateDeclaration()) != NULL && -+ td->onemember == s) -+ return dot; -+ if (dot) -+ buf->writeByte('.'); -+ // Use "this" not "__ctor" -+ if (s->isCtorDeclaration() || ((td = s->isTemplateDeclaration()) != NULL && -+ td->onemember && td->onemember->isCtorDeclaration())) -+ buf->writestring("this"); -+ else -+ { -+ /* We just want the identifier, not overloads like TemplateDeclaration::toChars. -+ * We don't want the template parameter list and constraints. */ -+ buf->writestring(s->Dsymbol::toChars()); -+ } -+ -+ return true; -+} -+ -+static void emitAnchor(OutBuffer *buf, Dsymbol *s) -+{ -+ buf->writestring("$(DDOC_ANCHOR "); -+ emitAnchorName(buf, s); -+ buf->writeByte(')'); -+} -+ - /******************************* emitComment **********************************/ - -+/** Get leading indentation from 'src' which represents lines of code. */ -+static size_t getCodeIndent(const char *src) -+{ -+ while (src && *src == '\n') -+ ++src; // skip until we find the first non-empty line -+ -+ size_t codeIndent = 0; -+ while (src && (*src == ' ' || *src == '\t')) -+ { -+ codeIndent++; -+ src++; -+ } -+ return codeIndent; -+} -+ -+void emitUnittestComment(Scope *sc, Dsymbol *s, size_t ofs) -+{ -+ OutBuffer *buf = sc->docbuf; -+ -+ for (UnitTestDeclaration *utd = s->ddocUnittest; utd; utd = utd->ddocUnittest) -+ { -+ if (utd->protection == PROTprivate || !utd->comment || !utd->fbody) -+ continue; -+ -+ // Strip whitespaces to avoid showing empty summary -+ utf8_t *c = utd->comment; -+ while (*c == ' ' || *c == '\t' || *c == '\n' || *c == '\r') ++c; -+ -+ OutBuffer codebuf; -+ codebuf.writestring("$(DDOC_EXAMPLES \n"); -+ size_t o = codebuf.offset; -+ codebuf.writestring((char *)c); -+ -+ if (utd->codedoc) -+ { -+ size_t i = getCodeIndent(utd->codedoc); -+ while (i--) codebuf.writeByte(' '); -+ codebuf.writestring("----\n"); -+ codebuf.writestring(utd->codedoc); -+ codebuf.writestring("----\n"); -+ highlightText(sc, s, &codebuf, o); -+ } -+ -+ codebuf.writestring(")"); -+ buf->insert(buf->offset - ofs, codebuf.data, codebuf.offset); -+ } -+} -+ - /* - * Emit doc comment to documentation file - */ -@@ -505,34 +605,12 @@ void Dsymbol::emitDitto(Scope *sc) - buf->spread(sc->lastoffset, b.offset); - memcpy(buf->data + sc->lastoffset, b.data, b.offset); - sc->lastoffset += b.offset; --} -- --void emitUnittestComment(Scope *sc, Dsymbol *s, UnitTestDeclaration *test) --{ -- static char pre[] = "$(D_CODE \n"; -- OutBuffer *buf = sc->docbuf; -- -- buf->writestring("$(DDOC_SECTION "); -- buf->writestring("$(B Example:)"); -- for (UnitTestDeclaration *utd = test; utd; utd = utd->unittest) -- { -- if (utd->protection == PROTprivate || !utd->comment || !utd->fbody) -- continue; -- -- OutBuffer codebuf; -- const char *body = utd->fbody->toChars(); -- if (strlen(body)) -- { -- codebuf.writestring(pre); -- codebuf.writestring(body); -- codebuf.writestring(")"); -- codebuf.writeByte(0); -- highlightCode2(sc, s, &codebuf, 0); -- buf->writestring(codebuf.toChars()); -- } -- } - -- buf->writestring(")"); -+ Dsymbol *s = this; -+ if (!s->ddocUnittest && parent) -+ s = parent->isTemplateDeclaration(); -+ if (s) -+ emitUnittestComment(sc, s, strlen(ddoc_decl_dd_e)); - } - - void ScopeDsymbol::emitMemberComments(Scope *sc) -@@ -586,6 +664,7 @@ void emitProtection(OutBuffer *buf, PROT - - void Dsymbol::emitComment(Scope *sc) { } - void InvariantDeclaration::emitComment(Scope *sc) { } -+void UnitTestDeclaration::emitComment(Scope *sc) { } - #if DMDV2 - void PostBlitDeclaration::emitComment(Scope *sc) { } - #endif -@@ -593,7 +672,6 @@ void DtorDeclaration::emitComment(Scope - void StaticCtorDeclaration::emitComment(Scope *sc) { } - void StaticDtorDeclaration::emitComment(Scope *sc) { } - void ClassInfoDeclaration::emitComment(Scope *sc) { } --void ModuleInfoDeclaration::emitComment(Scope *sc) { } - void TypeInfoDeclaration::emitComment(Scope *sc) { } - - -@@ -650,8 +728,10 @@ void AggregateDeclaration::emitComment(S - dc->pmacrotable = &sc->module->macrotable; - - buf->writestring(ddoc_decl_s); -- toDocBuffer(buf, sc); -- sc->lastoffset = buf->offset; -+ size_t o = buf->offset; -+ toDocBuffer(buf, sc); -+ highlightCode(sc, this, buf, o); -+ sc->lastoffset = buf->offset; - buf->writestring(ddoc_decl_e); - - buf->writestring(ddoc_decl_dd_s); -@@ -666,7 +746,7 @@ void TemplateDeclaration::emitComment(Sc - if (prot() == PROTprivate) - return; - -- unsigned char *com = comment; -+ utf8_t *com = comment; - int hasmembers = 1; - - Dsymbol *ss = this; -@@ -747,7 +827,9 @@ void EnumDeclaration::emitComment(Scope - dc->pmacrotable = &sc->module->macrotable; - - buf->writestring(ddoc_decl_s); -+ size_t o = buf->offset; - toDocBuffer(buf, sc); -+ highlightCode(sc, this, buf, o); - sc->lastoffset = buf->offset; - buf->writestring(ddoc_decl_e); - -@@ -767,7 +849,6 @@ void EnumMember::emitComment(Scope *sc) - - OutBuffer *buf = sc->docbuf; - DocComment *dc = DocComment::parse(sc, this, comment); -- size_t o; - - if (!dc) - { -@@ -777,7 +858,7 @@ void EnumMember::emitComment(Scope *sc) - dc->pmacrotable = &sc->module->macrotable; - - buf->writestring(ddoc_decl_s); -- o = buf->offset; -+ size_t o = buf->offset; - toDocBuffer(buf, sc); - highlightCode(sc, this, buf, o); - sc->lastoffset = buf->offset; -@@ -788,42 +869,6 @@ void EnumMember::emitComment(Scope *sc) - buf->writestring(ddoc_decl_dd_e); - } - --static bool emitAnchorName(OutBuffer *buf, Dsymbol *s) --{ -- if (!s || s->isPackage() || s->isModule()) -- return false; -- -- TemplateDeclaration *td; -- bool dot; -- -- // Add parent names first -- dot = emitAnchorName(buf, s->parent); -- // Eponymous template members can share the parent anchor name -- if (s->parent && (td = s->parent->isTemplateDeclaration()) != NULL && -- td->onemember == s) -- return dot; -- if (dot) -- buf->writeByte('.'); -- // Use "this" not "__ctor" -- if (s->isCtorDeclaration() || ((td = s->isTemplateDeclaration()) != NULL && -- td->onemember && td->onemember->isCtorDeclaration())) -- buf->writestring("this"); -- else -- { -- /* We just want the identifier, not overloads like TemplateDeclaration::toChars. -- * We don't want the template parameter list and constraints. */ -- buf->writestring(s->Dsymbol::toChars()); -- } -- return true; --} -- --static void emitAnchor(OutBuffer *buf, Dsymbol *s) --{ -- buf->writestring("$(DDOC_ANCHOR "); -- emitAnchorName(buf, s); -- buf->writeByte(')'); --} -- - /******************************* toDocBuffer **********************************/ - - void Dsymbol::toDocBuffer(OutBuffer *buf, Scope *sc) -@@ -851,14 +896,17 @@ void prefix(OutBuffer *buf, Dsymbol *s) - else if (d->isAbstract()) - buf->writestring("abstract "); - -- if (d->isConst()) -- buf->writestring("const "); --#if DMDV2 -- if (d->isImmutable()) -- buf->writestring("immutable "); --#endif -- if (d->isSynchronized()) -- buf->writestring("synchronized "); -+ if (!d->isFuncDeclaration()) // toCBufferWithAttributes handles this -+ { -+ if (d->isConst()) -+ buf->writestring("const "); -+ #if DMDV2 -+ if (d->isImmutable()) -+ buf->writestring("immutable "); -+ #endif -+ if (d->isSynchronized()) -+ buf->writestring("synchronized "); -+ } - } - } - -@@ -867,6 +915,9 @@ void declarationToDocBuffer(Declaration - //printf("declarationToDocBuffer() %s, originalType = %s, td = %s\n", decl->toChars(), decl->originalType ? decl->originalType->toChars() : "--", td ? td->toChars() : "--"); - if (decl->ident) - { -+ if (decl->isDeprecated()) -+ buf->writestring("$(DEPRECATED "); -+ - prefix(buf, decl); - - if (decl->type) -@@ -883,6 +934,20 @@ void declarationToDocBuffer(Declaration - } - else - buf->writestring(decl->ident->toChars()); -+ -+ // emit constraints if declaration is a templated declaration -+ if (td && td->constraint) -+ { -+ HdrGenState hgs; -+ hgs.ddoc = 1; -+ buf->writestring(" if ("); -+ td->constraint->toCBuffer(buf, &hgs); -+ buf->writeByte(')'); -+ } -+ -+ if (decl->isDeprecated()) -+ buf->writestring(")"); -+ - buf->writestring(";\n"); - } - } -@@ -901,7 +966,7 @@ void AliasDeclaration::toDocBuffer(OutBu - buf->writestring("deprecated "); - - emitProtection(buf, protection); -- buf->writestring("alias "); -+ buf->printf("alias %s = ", toChars()); - - if (Dsymbol *s = aliassym) // ident alias - { -@@ -923,8 +988,6 @@ void AliasDeclaration::toDocBuffer(OutBu - } - } - -- buf->writestring(" "); -- buf->writestring(toChars()); - buf->writestring(";\n"); - } - } -@@ -1033,11 +1096,10 @@ void AggregateDeclaration::toDocBuffer(O - { - if (ident) - { -- emitAnchor(buf, this); - #if 0 - emitProtection(buf, protection); - #endif -- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); -+ buf->printf("%s %s", kind(), toChars()); - buf->writestring(";\n"); - } - } -@@ -1061,8 +1123,7 @@ void StructDeclaration::toDocBuffer(OutB - } - else - { -- emitAnchor(buf, this); -- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); -+ buf->printf("%s %s", kind(), toChars()); - } - buf->writestring(";\n"); - } -@@ -1087,10 +1148,9 @@ void ClassDeclaration::toDocBuffer(OutBu - } - else - { -- emitAnchor(buf, this); -- if (isAbstract()) -+ if (!isInterfaceDeclaration() && isAbstract()) - buf->writestring("abstract "); -- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); -+ buf->printf("%s %s", kind(), toChars()); - } - int any = 0; - for (size_t i = 0; i < baseclasses->dim; i++) -@@ -1127,8 +1187,14 @@ void EnumDeclaration::toDocBuffer(OutBuf - { - if (ident) - { -- emitAnchor(buf, this); -- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); -+ buf->printf("%s %s", kind(), toChars()); -+ if (memtype) -+ { -+ buf->writestring(": $(DDOC_ENUM_BASETYPE "); -+ HdrGenState *hgs = NULL; -+ memtype->toCBuffer(buf, NULL, hgs); -+ buf->writestring(")"); -+ } - buf->writestring(";\n"); - } - } -@@ -1144,7 +1210,7 @@ void EnumMember::toDocBuffer(OutBuffer * - - /********************************* DocComment *********************************/ - --DocComment *DocComment::parse(Scope *sc, Dsymbol *s, unsigned char *comment) -+DocComment *DocComment::parse(Scope *sc, Dsymbol *s, utf8_t *comment) - { - //printf("parse(%s): '%s'\n", s->toChars(), comment); - if (sc->lastdc && isDitto(comment)) -@@ -1181,20 +1247,21 @@ DocComment *DocComment::parse(Scope *sc, - * then (*pcomment)[0 .. idlen] is the identifier. - */ - --void DocComment::parseSections(unsigned char *comment) --{ unsigned char *p; -- unsigned char *pstart; -- unsigned char *pend; -- unsigned char *idstart; -+void DocComment::parseSections(utf8_t *comment) -+{ utf8_t *p; -+ utf8_t *pstart; -+ utf8_t *pend; -+ utf8_t *idstart; - size_t idlen; - -- unsigned char *name = NULL; -+ utf8_t *name = NULL; - size_t namelen = 0; - - //printf("parseSections('%s')\n", comment); - p = comment; - while (*p) - { -+ utf8_t *pstart0 = p; - p = skipwhitespace(p); - pstart = p; - pend = p; -@@ -1210,6 +1277,11 @@ void DocComment::parseSections(unsigned - // Check for start/end of a code section - if (*p == '-') - { -+ if (!inCode) -+ { // restore leading indentation -+ while (pstart0 < pstart && isIndentWS(pstart-1)) --pstart; -+ } -+ - int numdash = 0; - while (*p == '-') - { -@@ -1224,7 +1296,7 @@ void DocComment::parseSections(unsigned - - if (!inCode && isIdStart(p)) - { -- unsigned char *q = p + utfStride(p); -+ utf8_t *q = p + utfStride(p); - while (isIdTail(q)) - q += utfStride(q); - if (*q == ':') // identifier: ends it -@@ -1298,7 +1370,7 @@ void DocComment::parseSections(unsigned - void DocComment::writeSections(Scope *sc, Dsymbol *s, OutBuffer *buf) - { - //printf("DocComment::writeSections()\n"); -- if (sections.dim) -+ if (sections.dim || s->ddocUnittest) - { - buf->writestring("$(DDOC_SECTIONS \n"); - for (size_t i = 0; i < sections.dim; i++) -@@ -1314,13 +1386,13 @@ void DocComment::writeSections(Scope *sc - buf->writestring("$(DDOC_SUMMARY "); - size_t o = buf->offset; - buf->write(sec->body, sec->bodylen); -- escapeStrayParenthesis(buf, o, s->loc); -+ escapeStrayParenthesis(buf, o, s); - highlightText(sc, s, buf, o); - buf->writestring(")\n"); - } - } -- if (s->unittest) -- emitUnittestComment(sc, s, s->unittest); -+ if (s->ddocUnittest) -+ emitUnittestComment(sc, s, 0); - buf->writestring(")\n"); - } - else -@@ -1356,10 +1428,10 @@ void Section::write(DocComment *dc, Scop - buf->writestring("$(DDOC_SECTION_H "); - size_t o = buf->offset; - for (size_t u = 0; u < namelen; u++) -- { unsigned char c = name[u]; -+ { utf8_t c = name[u]; - buf->writeByte((c == '_') ? ' ' : c); - } -- escapeStrayParenthesis(buf, o, s->loc); -+ escapeStrayParenthesis(buf, o, s); - buf->writestring(":)\n"); - } - else -@@ -1369,7 +1441,7 @@ void Section::write(DocComment *dc, Scop - L1: - size_t o = buf->offset; - buf->write(body, bodylen); -- escapeStrayParenthesis(buf, o, s->loc); -+ escapeStrayParenthesis(buf, o, s); - highlightText(sc, s, buf, o); - buf->writestring(")\n"); - } -@@ -1379,20 +1451,20 @@ void Section::write(DocComment *dc, Scop - - void ParamSection::write(DocComment *dc, Scope *sc, Dsymbol *s, OutBuffer *buf) - { -- unsigned char *p = body; -+ utf8_t *p = body; - size_t len = bodylen; -- unsigned char *pend = p + len; -+ utf8_t *pend = p + len; - -- unsigned char *tempstart; -+ utf8_t *tempstart; - size_t templen; - -- unsigned char *namestart; -+ utf8_t *namestart; - size_t namelen = 0; // !=0 if line continuation - -- unsigned char *textstart; -+ utf8_t *textstart; - size_t textlen; - -- size_t o; -+ size_t o, paramcount = 0; - Parameter *arg; - - buf->writestring("$(DDOC_PARAMS \n"); -@@ -1442,23 +1514,37 @@ void ParamSection::write(DocComment *dc, - - L1: - //printf("param '%.*s' = '%.*s'\n", namelen, namestart, textlen, textstart); -+ ++paramcount; - HdrGenState hgs; - buf->writestring("$(DDOC_PARAM_ROW "); - buf->writestring("$(DDOC_PARAM_ID "); - o = buf->offset; - arg = isFunctionParameter(s, namestart, namelen); - if (arg && arg->type && arg->ident) -+ { - arg->type->toCBuffer(buf, arg->ident, &hgs); -+ } - else -+ { -+ if (isTemplateParameter(s, namestart, namelen)) -+ { -+ // 10236: Don't count template parameters for params check -+ --paramcount; -+ } -+ else if (!arg) -+ { -+ warning(s->loc, "Ddoc: function declaration has no parameter '%.*s'", namelen, namestart); -+ } - buf->write(namestart, namelen); -- escapeStrayParenthesis(buf, o, s->loc); -+ } -+ escapeStrayParenthesis(buf, o, s); - highlightCode(sc, s, buf, o, false); - buf->writestring(")\n"); - - buf->writestring("$(DDOC_PARAM_DESC "); - o = buf->offset; - buf->write(textstart, textlen); -- escapeStrayParenthesis(buf, o, s->loc); -+ escapeStrayParenthesis(buf, o, s); - highlightText(sc, s, buf, o); - buf->writestring(")"); - buf->writestring(")\n"); -@@ -1491,6 +1577,16 @@ void ParamSection::write(DocComment *dc, - if (namelen) - goto L1; // write out last one - buf->writestring(")\n"); -+ -+ TypeFunction *tf = isTypeFunction(s); -+ if (tf) -+ { -+ size_t pcount = tf->parameters ? tf->parameters->dim : 0; -+ if (pcount != paramcount) -+ { -+ warning(s->loc, "Ddoc: parameter count mismatch"); -+ } -+ } - } - - /*************************************************** -@@ -1510,19 +1606,19 @@ void MacroSection::write(DocComment *dc, - * name2 = value2 - */ - --void DocComment::parseMacros(Escape **pescapetable, Macro **pmacrotable, unsigned char *m, size_t mlen) -+void DocComment::parseMacros(Escape **pescapetable, Macro **pmacrotable, utf8_t *m, size_t mlen) - { -- unsigned char *p = m; -+ utf8_t *p = m; - size_t len = mlen; -- unsigned char *pend = p + len; -+ utf8_t *pend = p + len; - -- unsigned char *tempstart; -+ utf8_t *tempstart; - size_t templen; - -- unsigned char *namestart; -+ utf8_t *namestart; - size_t namelen = 0; // !=0 if line continuation - -- unsigned char *textstart; -+ utf8_t *textstart; - size_t textlen; - - while (p < pend) -@@ -1635,7 +1731,7 @@ Ldone: - * by whitespace and/or commas. - */ - --void DocComment::parseEscapes(Escape **pescapetable, unsigned char *textstart, size_t textlen) -+void DocComment::parseEscapes(Escape **pescapetable, utf8_t *textstart, size_t textlen) - { Escape *escapetable = *pescapetable; - - if (!escapetable) -@@ -1644,8 +1740,8 @@ void DocComment::parseEscapes(Escape **p - *pescapetable = escapetable; - } - //printf("parseEscapes('%.*s') pescapetable = %p\n", textlen, textstart, pescapetable); -- unsigned char *p = textstart; -- unsigned char *pend = p + textlen; -+ utf8_t *p = textstart; -+ utf8_t *pend = p + textlen; - - while (1) - { -@@ -1659,9 +1755,9 @@ void DocComment::parseEscapes(Escape **p - } - if (p[0] != '/' || p[2] != '/') - return; -- unsigned char c = p[1]; -+ utf8_t c = p[1]; - p += 3; -- unsigned char *start = p; -+ utf8_t *start = p; - while (1) - { - if (p >= pend) -@@ -1707,11 +1803,11 @@ int icmp(const char *stringz, void *s, s - * Return !=0 if comment consists entirely of "ditto". - */ - --int isDitto(unsigned char *comment) -+int isDitto(utf8_t *comment) - { - if (comment) - { -- unsigned char *p = skipwhitespace(comment); -+ utf8_t *p = skipwhitespace(comment); - - if (Port::memicmp((char *)p, "ditto", 5) == 0 && *skipwhitespace(p + 5) == 0) - return 1; -@@ -1723,7 +1819,7 @@ int isDitto(unsigned char *comment) - * Skip white space. - */ - --unsigned char *skipwhitespace(unsigned char *p) -+utf8_t *skipwhitespace(utf8_t *p) - { - for (; 1; p++) - { switch (*p) -@@ -1752,7 +1848,7 @@ size_t skiptoident(OutBuffer *buf, size_ - { dchar_t c; - - size_t oi = i; -- if (utf_decodeChar((unsigned char *)buf->data, buf->offset, &i, &c)) -+ if (utf_decodeChar((utf8_t *)buf->data, buf->offset, &i, &c)) - /* Ignore UTF errors, but still consume input - */ - break; -@@ -1779,7 +1875,7 @@ size_t skippastident(OutBuffer *buf, siz - { dchar_t c; - - size_t oi = i; -- if (utf_decodeChar((unsigned char *)buf->data, buf->offset, &i, &c)) -+ if (utf_decodeChar((utf8_t *)buf->data, buf->offset, &i, &c)) - /* Ignore UTF errors, but still consume input - */ - break; -@@ -1807,7 +1903,7 @@ size_t skippastident(OutBuffer *buf, siz - - size_t skippastURL(OutBuffer *buf, size_t i) - { size_t length = buf->offset - i; -- unsigned char *p = &buf->data[i]; -+ utf8_t *p = &buf->data[i]; - size_t j; - unsigned sawdot = 0; - -@@ -1823,7 +1919,7 @@ size_t skippastURL(OutBuffer *buf, size_ - goto Lno; - - for (; j < length; j++) -- { unsigned char c = p[j]; -+ { utf8_t c = p[j]; - if (isalnum(c)) - continue; - if (c == '-' || c == '_' || c == '?' || -@@ -1849,7 +1945,7 @@ Lno: - /**************************************************** - */ - --int isKeyword(unsigned char *p, size_t len) -+int isKeyword(utf8_t *p, size_t len) - { - static const char *table[] = { "true", "false", "null" }; - -@@ -1864,10 +1960,17 @@ int isKeyword(unsigned char *p, size_t l - /**************************************************** - */ - --Parameter *isFunctionParameter(Dsymbol *s, unsigned char *p, size_t len) -+TypeFunction *isTypeFunction(Dsymbol *s) - { - FuncDeclaration *f = s->isFuncDeclaration(); - -+ /* Check whether s refers to an eponymous function template. -+ */ -+ if (f == NULL && s->isTemplateDeclaration() && s->isTemplateDeclaration()->onemember) -+ { -+ f = s->isTemplateDeclaration()->onemember->isFuncDeclaration(); -+ } -+ - /* f->type may be NULL for template members. - */ - if (f && f->type) -@@ -1880,15 +1983,45 @@ Parameter *isFunctionParameter(Dsymbol * - else - tf = (TypeFunction *)f->type; - -- if (tf->parameters) -+ return tf; -+ } -+ return NULL; -+} -+ -+/**************************************************** -+ */ -+ -+Parameter *isFunctionParameter(Dsymbol *s, utf8_t *p, size_t len) -+{ -+ TypeFunction *tf = isTypeFunction(s); -+ if (tf && tf->parameters) -+ { -+ for (size_t k = 0; k < tf->parameters->dim; k++) - { -- for (size_t k = 0; k < tf->parameters->dim; k++) -- { Parameter *arg = (*tf->parameters)[k]; -+ Parameter *arg = (*tf->parameters)[k]; -+ if (arg->ident && cmp(arg->ident->toChars(), p, len) == 0) -+ { -+ return arg; -+ } -+ } -+ } -+ return NULL; -+} - -- if (arg->ident && cmp(arg->ident->toChars(), p, len) == 0) -- { -- return arg; -- } -+/**************************************************** -+ */ -+ -+TemplateParameter *isTemplateParameter(Dsymbol *s, utf8_t *p, size_t len) -+{ -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (td && td->origParameters) -+ { -+ for (size_t k = 0; k < td->origParameters->dim; k++) -+ { -+ TemplateParameter *arg = (*td->origParameters)[k]; -+ if (arg->ident && cmp(arg->ident->toChars(), p, len) == 0) -+ { -+ return arg; - } - } - } -@@ -1904,18 +2037,19 @@ void highlightText(Scope *sc, Dsymbol *s - //printf("highlightText()\n"); - const char *sid = s->ident->toChars(); - FuncDeclaration *f = s->isFuncDeclaration(); -- unsigned char *p; -+ utf8_t *p; - const char *se; - - int leadingBlank = 1; - int inCode = 0; - //int inComment = 0; // in <!-- ... --> comment - size_t iCodeStart; // start of code section -+ size_t codeIndent = 0; - - size_t iLineStart = offset; - - for (size_t i = offset; i < buf->offset; i++) -- { unsigned char c = buf->data[i]; -+ { utf8_t c = buf->data[i]; - - Lcont: - switch (c) -@@ -1930,7 +2064,7 @@ void highlightText(Scope *sc, Dsymbol *s - { - static char blankline[] = "$(DDOC_BLANKLINE)\n"; - -- i = buf->insert(i, blankline, sizeof(blankline) - 1); -+ i = buf->insert(i, blankline, strlen(blankline)); - } - leadingBlank = 1; - iLineStart = i + 1; -@@ -2083,6 +2217,30 @@ void highlightText(Scope *sc, Dsymbol *s - - codebuf.write(buf->data + iCodeStart, i - iCodeStart); - codebuf.writeByte(0); -+ -+ // Remove leading indentations from all lines -+ bool lineStart = true; -+ utf8_t *endp = codebuf.data + codebuf.offset; -+ for (utf8_t *p = codebuf.data; p < endp; ) -+ { -+ if (lineStart) -+ { -+ size_t j = codeIndent; -+ utf8_t *q = p; -+ while (j-- > 0 && q < endp && isIndentWS(q)) -+ ++q; -+ codebuf.remove(p - codebuf.data, q - p); -+ assert(codebuf.data <= p); -+ assert(p < codebuf.data + codebuf.offset); -+ lineStart = false; -+ endp = codebuf.data + codebuf.offset; // update -+ continue; -+ } -+ if (*p == '\n') -+ lineStart = true; -+ ++p; -+ } -+ - highlightCode2(sc, s, &codebuf, 0); - buf->remove(iCodeStart, i - iCodeStart); - i = buf->insert(iCodeStart, codebuf.data, codebuf.offset); -@@ -2093,7 +2251,8 @@ void highlightText(Scope *sc, Dsymbol *s - { static char pre[] = "$(D_CODE \n"; - - inCode = 1; -- i = buf->insert(i, pre, sizeof(pre) - 1); -+ codeIndent = istart - iLineStart; // save indent count -+ i = buf->insert(i, pre, strlen(pre)); - iCodeStart = i; - i--; // place i on > - leadingBlank = true; -@@ -2172,7 +2331,7 @@ void highlightCode(Scope *sc, Dsymbol *s - - //printf("highlightCode(s = '%s', kind = %s)\n", sid, s->kind()); - for (size_t i = offset; i < buf->offset; i++) -- { unsigned char c = buf->data[i]; -+ { utf8_t c = buf->data[i]; - const char *se; - - se = sc->module->escapetable->escapeChar(c); -@@ -2211,7 +2370,7 @@ void highlightCode(Scope *sc, Dsymbol *s - /**************************************** - */ - --void highlightCode3(Scope *sc, OutBuffer *buf, unsigned char *p, unsigned char *pend) -+void highlightCode3(Scope *sc, OutBuffer *buf, utf8_t *p, utf8_t *pend) - { - for (; p < pend; p++) - { const char *s = sc->module->escapetable->escapeChar(*p); -@@ -2229,15 +2388,18 @@ void highlightCode3(Scope *sc, OutBuffer - - void highlightCode2(Scope *sc, Dsymbol *s, OutBuffer *buf, size_t offset) - { -- char *sid = s->ident->toChars(); -+ const char *sid = s->ident->toChars(); - FuncDeclaration *f = s->isFuncDeclaration(); - unsigned errorsave = global.errors; - Lexer lex(NULL, buf->data, 0, buf->offset - 1, 0, 1); - Token tok; - OutBuffer res; -- unsigned char *lastp = buf->data; -+ utf8_t *lastp = buf->data; - const char *highlight; - -+ if (s->isModule() && ((Module *)s)->isDocFile) -+ sid = ""; -+ - //printf("highlightCode2('%.*s')\n", buf->offset - 1, buf->data); - res.reserve(buf->offset); - while (1) -@@ -2280,10 +2442,16 @@ void highlightCode2(Scope *sc, Dsymbol * - break; - } - if (highlight) -+ { - res.writestring(highlight); -- highlightCode3(sc, &res, tok.ptr, lex.p); -- if (highlight) -+ size_t o = res.offset; -+ highlightCode3(sc, &res, tok.ptr, lex.p); -+ if (tok.value == TOKcomment || tok.value == TOKstring) -+ escapeDdocString(&res, o); // Bugzilla 7656, 7715, and 10519 - res.writeByte(')'); -+ } -+ else -+ highlightCode3(sc, &res, tok.ptr, lex.p); - if (tok.value == TOKeof) - break; - lastp = lex.p; -@@ -2328,7 +2496,7 @@ const char *Escape::escapeChar(unsigned - * Determine if p points to the start of an identifier. - */ - --int isIdStart(unsigned char *p) -+int isIdStart(utf8_t *p) - { - unsigned c = *p; - if (isalpha(c) || c == '_') -@@ -2347,7 +2515,7 @@ int isIdStart(unsigned char *p) - * Determine if p points to the rest of an identifier. - */ - --int isIdTail(unsigned char *p) -+int isIdTail(utf8_t *p) - { - unsigned c = *p; - if (isalnum(c) || c == '_') -@@ -2362,11 +2530,20 @@ int isIdTail(unsigned char *p) - return 0; - } - -+/**************************************** -+ * Determine if p points to the indentation space. -+ */ -+ -+int isIndentWS(utf8_t *p) -+{ -+ return (*p == ' ') || (*p == '\t'); -+} -+ - /***************************************** - * Return number of bytes in UTF character. - */ - --int utfStride(unsigned char *p) -+int utfStride(utf8_t *p) - { - unsigned c = *p; - if (c < 0x80) ---- a/src/gcc/d/dfrontend/dsymbol.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/dsymbol.c 2014-04-01 16:32:51.000000000 +0100 -@@ -45,12 +45,14 @@ Dsymbol::Dsymbol() - this->parent = NULL; - this->csym = NULL; - this->isym = NULL; -- this->loc = 0; -+ this->loc = Loc(); - this->comment = NULL; - this->scope = NULL; -+ this->semanticRun = PASSinit; - this->errors = false; -+ this->depmsg = NULL; - this->userAttributes = NULL; -- this->unittest = NULL; -+ this->ddocUnittest = NULL; - } - - Dsymbol::Dsymbol(Identifier *ident) -@@ -60,25 +62,25 @@ Dsymbol::Dsymbol(Identifier *ident) - this->parent = NULL; - this->csym = NULL; - this->isym = NULL; -- this->loc = 0; -+ this->loc = Loc(); - this->comment = NULL; - this->scope = NULL; -+ this->semanticRun = PASSinit; - this->errors = false; - this->depmsg = NULL; - this->userAttributes = NULL; -- this->unittest = NULL; -+ this->ddocUnittest = NULL; - } - --int Dsymbol::equals(Object *o) --{ Dsymbol *s; -- -+bool Dsymbol::equals(RootObject *o) -+{ - if (this == o) -- return TRUE; -- s = (Dsymbol *)(o); -+ return true; -+ Dsymbol *s = (Dsymbol *)(o); - // Overload sets don't have an ident - if (s && ident && s->ident && ident->equals(s->ident)) -- return TRUE; -- return FALSE; -+ return true; -+ return false; - } - - /************************************** -@@ -98,23 +100,23 @@ Dsymbol *Dsymbol::syntaxCopy(Dsymbol *s) - /************************************** - * Determine if this symbol is only one. - * Returns: -- * FALSE, *ps = NULL: There are 2 or more symbols -- * TRUE, *ps = NULL: There are zero symbols -- * TRUE, *ps = symbol: The one and only one symbol -+ * false, *ps = NULL: There are 2 or more symbols -+ * true, *ps = NULL: There are zero symbols -+ * true, *ps = symbol: The one and only one symbol - */ - --int Dsymbol::oneMember(Dsymbol **ps, Identifier *ident) -+bool Dsymbol::oneMember(Dsymbol **ps, Identifier *ident) - { - //printf("Dsymbol::oneMember()\n"); - *ps = this; -- return TRUE; -+ return true; - } - - /***************************************** - * Same as Dsymbol::oneMember(), but look at an array of Dsymbols. - */ - --int Dsymbol::oneMembers(Dsymbols *members, Dsymbol **ps, Identifier *ident) -+bool Dsymbol::oneMembers(Dsymbols *members, Dsymbol **ps, Identifier *ident) - { - //printf("Dsymbol::oneMembers() %d\n", members ? members->dim : 0); - Dsymbol *s = NULL; -@@ -124,46 +126,61 @@ int Dsymbol::oneMembers(Dsymbols *member - for (size_t i = 0; i < members->dim; i++) - { Dsymbol *sx = (*members)[i]; - -- int x = sx->oneMember(ps, ident); -+ bool x = sx->oneMember(ps, ident); - //printf("\t[%d] kind %s = %d, s = %p\n", i, sx->kind(), x, *ps); - if (!x) - { - //printf("\tfalse 1\n"); - assert(*ps == NULL); -- return FALSE; -+ return false; - } - if (*ps) - { -- if (ident) -- { -- if (!(*ps)->ident || !(*ps)->ident->equals(ident)) -- continue; -- } -+ assert(ident); -+ if (!(*ps)->ident || !(*ps)->ident->equals(ident)) -+ continue; - if (!s) - s = *ps; - else if (s->isOverloadable() && (*ps)->isOverloadable()) -- ; // keep head of overload set -+ { -+ // keep head of overload set -+ FuncDeclaration *f1 = s->isFuncDeclaration(); -+ FuncDeclaration *f2 = (*ps)->isFuncDeclaration(); -+ if (f1 && f2) -+ { -+ assert(!f1->isFuncAliasDeclaration()); -+ assert(!f2->isFuncAliasDeclaration()); -+ for (; f1 != f2; f1 = f1->overnext0) -+ { -+ if (f1->overnext0 == NULL) -+ { -+ f1->overnext0 = f2; -+ break; -+ } -+ } -+ } -+ } - else // more than one symbol - { *ps = NULL; - //printf("\tfalse 2\n"); -- return FALSE; -+ return false; - } - } - } - } - *ps = s; // s is the one symbol, NULL if none - //printf("\ttrue\n"); -- return TRUE; -+ return true; - } - - /***************************************** - * Is Dsymbol a variable that contains pointers? - */ - --int Dsymbol::hasPointers() -+bool Dsymbol::hasPointers() - { - //printf("Dsymbol::hasPointers() %s\n", toChars()); -- return 0; -+ return false; - } - - bool Dsymbol::hasStaticCtorOrDtor() -@@ -176,6 +193,11 @@ void Dsymbol::setFieldOffset(AggregateDe - { - } - -+Identifier *Dsymbol::getIdent() -+{ -+ return ident; -+} -+ - char *Dsymbol::toChars() - { - return ident ? ident->toChars() : (char *)"__anonymous"; -@@ -301,9 +323,9 @@ TemplateInstance *Dsymbol::isSpeculative - return NULL; - } - --int Dsymbol::isAnonymous() -+bool Dsymbol::isAnonymous() - { -- return ident ? 0 : 1; -+ return ident == NULL; - } - - /************************************* -@@ -329,10 +351,6 @@ void Dsymbol::importAll(Scope *sc) - * Does semantic analysis on the public face of declarations. - */ - --void Dsymbol::semantic0(Scope *sc) --{ --} -- - void Dsymbol::semantic(Scope *sc) - { - error("%p has no semantic routine", this); -@@ -400,8 +418,7 @@ void *symbol_search_fp(void *arg, const - assert(id); - - Dsymbol *s = (Dsymbol *)arg; -- Module::clearCache(); -- return s->search(0, id, 4|2); -+ return (void *)s->search(Loc(), id, 4|2); - } - - Dsymbol *Dsymbol::search_correct(Identifier *ident) -@@ -409,7 +426,7 @@ Dsymbol *Dsymbol::search_correct(Identif - if (global.gag) - return NULL; // don't do it for speculative compiles; too time consuming - -- return (Dsymbol *)speller(ident->toChars(), &symbol_search_fp, this, idchars); -+ return (Dsymbol *)speller(ident->toChars(), &symbol_search_fp, (void *)this, idchars); - } - - /*************************************** -@@ -419,7 +436,7 @@ Dsymbol *Dsymbol::search_correct(Identif - * symbol found, NULL if not - */ - --Dsymbol *Dsymbol::searchX(Loc loc, Scope *sc, Identifier *id) -+Dsymbol *Dsymbol::searchX(Loc loc, Scope *sc, RootObject *id) - { - //printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident->toChars()); - Dsymbol *s = toAlias(); -@@ -428,7 +445,7 @@ Dsymbol *Dsymbol::searchX(Loc loc, Scope - switch (id->dyncast()) - { - case DYNCAST_IDENTIFIER: -- sm = s->search(loc, id, 0); -+ sm = s->search(loc, (Identifier *)id, 0); - break; - - case DYNCAST_DSYMBOL: -@@ -436,7 +453,7 @@ Dsymbol *Dsymbol::searchX(Loc loc, Scope - //printf("\ttemplate instance id\n"); - Dsymbol *st = (Dsymbol *)id; - TemplateInstance *ti = st->isTemplateInstance(); -- id = ti->name; -+ Identifier *id = ti->name; - sm = s->search(loc, id, 0); - if (!sm) - { -@@ -469,10 +486,10 @@ Dsymbol *Dsymbol::searchX(Loc loc, Scope - return sm; - } - --int Dsymbol::overloadInsert(Dsymbol *s) -+bool Dsymbol::overloadInsert(Dsymbol *s) - { - //printf("Dsymbol::overloadInsert('%s')\n", s->toChars()); -- return FALSE; -+ return false; - } - - void Dsymbol::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -486,9 +503,9 @@ unsigned Dsymbol::size(Loc loc) - return 0; - } - --int Dsymbol::isforwardRef() -+bool Dsymbol::isforwardRef() - { -- return FALSE; -+ return false; - } - - AggregateDeclaration *Dsymbol::isThis() -@@ -523,30 +540,30 @@ void Dsymbol::defineRef(Dsymbol *s) - assert(0); - } - --int Dsymbol::isExport() -+bool Dsymbol::isExport() - { -- return FALSE; -+ return false; - } - --int Dsymbol::isImportedSymbol() -+bool Dsymbol::isImportedSymbol() - { -- return FALSE; -+ return false; - } - --int Dsymbol::isDeprecated() -+bool Dsymbol::isDeprecated() - { -- return FALSE; -+ return false; - } - - #if DMDV2 --int Dsymbol::isOverloadable() -+bool Dsymbol::isOverloadable() - { -- return 0; -+ return false; - } - --int Dsymbol::hasOverloads() -+bool Dsymbol::hasOverloads() - { -- return 0; -+ return false; - } - #endif - -@@ -568,9 +585,9 @@ Type *Dsymbol::getType() - return NULL; - } - --int Dsymbol::needThis() -+bool Dsymbol::needThis() - { -- return FALSE; -+ return false; - } - - int Dsymbol::apply(Dsymbol_apply_ft_t fp, void *param) -@@ -593,7 +610,7 @@ int Dsymbol::addMember(Scope *sc, ScopeD - s2 = sd->symtab->lookup(ident); - if (!s2->overloadInsert(this)) - { -- sd->multiplyDefined(0, this, s2); -+ sd->multiplyDefined(Loc(), this, s2); - } - } - if (sd->isAggregateDeclaration() || sd->isEnumDeclaration()) -@@ -728,7 +745,7 @@ Module *Dsymbol::getAccessModule() - if (m) - return m; - TemplateInstance *ti = s->isTemplateInstance(); -- if (ti && ti->isnested) -+ if (ti && ti->enclosing) - /* Because of local template instantiation, the parent isn't where the access - * rights come from - it's the template declaration - */ -@@ -742,7 +759,7 @@ Module *Dsymbol::getAccessModule() - /************************************* - */ - --enum PROT Dsymbol::prot() -+PROT Dsymbol::prot() - { - return PROTpublic; - } -@@ -776,7 +793,7 @@ Dsymbols *Dsymbol::arraySyntaxCopy(Dsymb - * Ignore NULL comments. - */ - --void Dsymbol::addComment(unsigned char *comment) -+void Dsymbol::addComment(utf8_t *comment) - { - //if (comment) - //printf("adding comment '%s' to symbol %p '%s'\n", comment, this, toChars()); -@@ -794,8 +811,8 @@ void Dsymbol::addComment(unsigned char * - /********************************* OverloadSet ****************************/ - - #if DMDV2 --OverloadSet::OverloadSet() -- : Dsymbol() -+OverloadSet::OverloadSet(Identifier *ident) -+ : Dsymbol(ident) - { - } - -@@ -844,35 +861,44 @@ Dsymbol *ScopeDsymbol::syntaxCopy(Dsymbo - return sd; - } - -+/***************************************** -+ * This function is #1 on the list of functions that eat cpu time. -+ * Be very, very careful about slowing it down. -+ */ -+ - Dsymbol *ScopeDsymbol::search(Loc loc, Identifier *ident, int flags) - { - //printf("%s->ScopeDsymbol::search(ident='%s', flags=x%x)\n", toChars(), ident->toChars(), flags); - //if (strcmp(ident->toChars(),"c") == 0) *(char*)0=0; - - // Look in symbols declared in this module -- Dsymbol *s = symtab ? symtab->lookup(ident) : NULL; -- //printf("\ts = %p, imports = %p, %d\n", s, imports, imports ? imports->dim : 0); -- if (s) -+ Dsymbol *s1 = symtab ? symtab->lookup(ident) : NULL; -+ //printf("\ts1 = %p, imports = %p, %d\n", s1, imports, imports ? imports->dim : 0); -+ if (s1) - { -- //printf("\ts = '%s.%s'\n",toChars(),s->toChars()); -+ //printf("\ts = '%s.%s'\n",toChars(),s1->toChars()); -+ return s1; - } -- else if (imports) -+ else if (!imports) -+ return NULL; -+ else - { -+ Dsymbol *s = NULL; - OverloadSet *a = NULL; - - // Look in imported modules - for (size_t i = 0; i < imports->dim; i++) -- { Dsymbol *ss = (*imports)[i]; -- Dsymbol *s2; -- -+ { - // If private import, don't search it - if (flags & 1 && prots[i] == PROTprivate) - continue; - -+ Dsymbol *ss = (*imports)[i]; -+ - //printf("\tscanning import '%s', prots = %d, isModule = %p, isImport = %p\n", ss->toChars(), prots[i], ss->isModule(), ss->isImport()); - /* Don't find private members if ss is a module - */ -- s2 = ss->search(loc, ident, ss->isModule() ? 1 : 0); -+ Dsymbol *s2 = ss->search(loc, ident, ss->isModule() ? 1 : 0); - if (!s) - s = s2; - else if (s2 && s != s2) -@@ -904,12 +930,23 @@ Dsymbol *ScopeDsymbol::search(Loc loc, I - ) - ) - { -+ /* Bugzilla 8668: -+ * Public selective import adds AliasDeclaration in module. -+ * To make an overload set, resolve aliases in here and -+ * get actual overload roots which accessible via s and s2. -+ */ -+ s = s->toAlias(); -+ s2 = s2->toAlias(); -+ - /* If both s2 and s are overloadable (though we only - * need to check s once) - */ - if (s2->isOverloadable() && (a || s->isOverloadable())) - { if (!a) -- a = new OverloadSet(); -+ { -+ a = new OverloadSet(s->ident); -+ a->parent = this; -+ } - /* Don't add to a[] if s2 is alias of previous sym - */ - for (size_t j = 0; j < a->a.dim; j++) -@@ -946,33 +983,17 @@ Dsymbol *ScopeDsymbol::search(Loc loc, I - - if (s) - { -- if (!(flags & 2)) -- { Declaration *d = s->isDeclaration(); -- if (d && d->protection == PROTprivate && -- !d->parent->isTemplateMixin()) -- error(loc, "%s is private", d->toPrettyChars()); -- -- AggregateDeclaration *ad = s->isAggregateDeclaration(); -- if (ad && ad->protection == PROTprivate && -- !ad->parent->isTemplateMixin()) -- error(loc, "%s is private", ad->toPrettyChars()); -- -- EnumDeclaration *ed = s->isEnumDeclaration(); -- if (ed && ed->protection == PROTprivate && -- !ed->parent->isTemplateMixin()) -- error(loc, "%s is private", ed->toPrettyChars()); -- -- TemplateDeclaration *td = s->isTemplateDeclaration(); -- if (td && td->protection == PROTprivate && -- !td->parent->isTemplateMixin()) -- error(loc, "%s is private", td->toPrettyChars()); -+ if (!(flags & 2) && s->prot() == PROTprivate && !s->parent->isTemplateMixin()) -+ { -+ if (!s->isImport()) -+ error(loc, "%s %s is private", s->kind(), s->toPrettyChars()); - } - } -+ return s; - } -- return s; - } - --void ScopeDsymbol::importScope(Dsymbol *s, enum PROT protection) -+void ScopeDsymbol::importScope(Dsymbol *s, PROT protection) - { - //printf("%s->ScopeDsymbol::importScope(%s, %d)\n", toChars(), s->toChars(), protection); - -@@ -999,7 +1020,7 @@ void ScopeDsymbol::importScope(Dsymbol * - } - } - --int ScopeDsymbol::isforwardRef() -+bool ScopeDsymbol::isforwardRef() - { - return (members == NULL); - } -@@ -1054,7 +1075,7 @@ Dsymbol *ScopeDsymbol::nameCollision(Dsy - return sprev; - } - } -- multiplyDefined(0, s, sprev); -+ multiplyDefined(Loc(), s, sprev); - return sprev; - } - -@@ -1205,7 +1226,7 @@ FuncDeclaration *ScopeDsymbol::findGetMe - - Type *tret = NULL; - tfgetmembers = new TypeFunction(arguments, tret, 0, LINKd); -- tfgetmembers = (TypeFunction *)tfgetmembers->semantic(0, &sc); -+ tfgetmembers = (TypeFunction *)tfgetmembers->semantic(Loc(), &sc); - } - if (fdx) - fdx = fdx->overloadExactMatch(tfgetmembers); -@@ -1229,7 +1250,24 @@ WithScopeSymbol::WithScopeSymbol(WithSta - Dsymbol *WithScopeSymbol::search(Loc loc, Identifier *ident, int flags) - { - // Acts as proxy to the with class declaration -- return withstate->exp->type->toDsymbol(NULL)->search(loc, ident, 0); -+ Dsymbol *s = NULL; -+ Expression *eold = NULL; -+ for (Expression *e = withstate->exp; e != eold; e = resolveAliasThis(scope, e)) -+ { -+ Type *t = e->type->toBasetype(); -+ if (t->ty == Taarray) -+ s = ((TypeAArray *)t)->getImpl(); -+ else -+ s = t->toDsymbol(NULL); -+ if (s) -+ { -+ s = s->search(loc, ident, 0); -+ if (s) -+ return s; -+ } -+ eold = e; -+ } -+ return NULL; - } - - /****************************** ArrayScopeSymbol ******************************/ -@@ -1275,8 +1313,8 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - { /* $ gives the number of elements in the tuple - */ - VarDeclaration *v = new VarDeclaration(loc, Type::tsize_t, Id::dollar, NULL); -- Expression *e = new IntegerExp(0, td->objects->dim, Type::tsize_t); -- v->init = new ExpInitializer(0, e); -+ Expression *e = new IntegerExp(Loc(), td->objects->dim, Type::tsize_t); -+ v->init = new ExpInitializer(Loc(), e); - v->storage_class |= STCstatic | STCconst; - v->semantic(sc); - return v; -@@ -1286,8 +1324,8 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - { /* $ gives the number of type entries in the type tuple - */ - VarDeclaration *v = new VarDeclaration(loc, Type::tsize_t, Id::dollar, NULL); -- Expression *e = new IntegerExp(0, type->arguments->dim, Type::tsize_t); -- v->init = new ExpInitializer(0, e); -+ Expression *e = new IntegerExp(Loc(), type->arguments->dim, Type::tsize_t); -+ v->init = new ExpInitializer(Loc(), e); - v->storage_class |= STCstatic | STCconst; - v->semantic(sc); - return v; -@@ -1351,8 +1389,8 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - { /* It is for an expression tuple, so the - * length will be a const. - */ -- Expression *e = new IntegerExp(0, ((TupleExp *)ce)->exps->dim, Type::tsize_t); -- v = new VarDeclaration(loc, Type::tsize_t, Id::dollar, new ExpInitializer(0, e)); -+ Expression *e = new IntegerExp(Loc(), ((TupleExp *)ce)->exps->dim, Type::tsize_t); -+ v = new VarDeclaration(loc, Type::tsize_t, Id::dollar, new ExpInitializer(Loc(), e)); - v->storage_class |= STCstatic | STCconst; - } - else if (ce->type && (t = ce->type->toBasetype()) != NULL && -@@ -1376,29 +1414,6 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - return NULL; - s = s->toAlias(); - -- if (ce->hasSideEffect()) -- { -- /* Even if opDollar is needed, 'ce' should be evaluate only once. So -- * Rewrite: -- * ce.opIndex( ... use of $ ... ) -- * ce.opSlice( ... use of $ ... ) -- * as: -- * (ref __dop = ce, __dop).opIndex( ... __dop.opDollar ...) -- * (ref __dop = ce, __dop).opSlice( ... __dop.opDollar ...) -- */ -- Identifier *id = Lexer::uniqueId("__dop"); -- ExpInitializer *ei = new ExpInitializer(loc, ce); -- VarDeclaration *v = new VarDeclaration(loc, NULL, id, ei); -- v->storage_class |= STCctfe | STCforeach | STCref; -- DeclarationExp *de = new DeclarationExp(loc, v); -- VarExp *ve = new VarExp(loc, v); -- v->semantic(sc); -- de->type = ce->type; -- ve->type = ce->type; -- ((UnaExp *)exp)->e1 = new CommaExp(loc, de, ve); -- ce = ve; -- } -- - Expression *e = NULL; - // Check for multi-dimensional opDollar(dim) template. - if (TemplateDeclaration *td = s->isTemplateDeclaration()) -@@ -1414,7 +1429,7 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - } - - Objects *tdargs = new Objects(); -- Expression *edim = new IntegerExp(0, dim, Type::tsize_t); -+ Expression *edim = new IntegerExp(Loc(), dim, Type::tsize_t); - edim = edim->semantic(sc); - tdargs->push(edim); - -@@ -1444,7 +1459,7 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - t = e->type->toBasetype(); - if (t && t->ty == Tfunction) - e = new CallExp(e->loc, e); -- v = new VarDeclaration(loc, NULL, Id::dollar, new ExpInitializer(0, e)); -+ v = new VarDeclaration(loc, NULL, Id::dollar, new ExpInitializer(Loc(), e)); - } - else - { /* For arrays, $ will either be a compile-time constant -@@ -1452,7 +1467,7 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - * or a variable (in which case an expression is created in - * toir.c). - */ -- VoidInitializer *e = new VoidInitializer(0); -+ VoidInitializer *e = new VoidInitializer(Loc()); - e->type = Type::tsize_t; - v = new VarDeclaration(loc, Type::tsize_t, Id::dollar, e); - v->storage_class |= STCctfe; // it's never a true static variable -@@ -1470,90 +1485,42 @@ Dsymbol *ArrayScopeSymbol::search(Loc lo - - DsymbolTable::DsymbolTable() - { --#if STRINGTABLE -- tab = new StringTable; -- tab->init(); --#else - tab = NULL; --#endif --} -- --DsymbolTable::~DsymbolTable() --{ --#if STRINGTABLE -- delete tab; --#endif - } - - Dsymbol *DsymbolTable::lookup(Identifier *ident) - { --#if STRINGTABLE --#ifdef DEBUG -- assert(ident); -- assert(tab); --#endif -- //printf("DsymbolTable::lookup(%s)\n", (char*)ident->string); -- StringValue *sv = tab->lookup((char*)ident->string, ident->len); -- return (Dsymbol *)(sv ? sv->ptrvalue : NULL); --#else - //printf("DsymbolTable::lookup(%s)\n", (char*)ident->string); - return (Dsymbol *)_aaGetRvalue(tab, ident); --#endif - } - - Dsymbol *DsymbolTable::insert(Dsymbol *s) - { - //printf("DsymbolTable::insert(this = %p, '%s')\n", this, s->ident->toChars()); - Identifier *ident = s->ident; --#if STRINGTABLE --#ifdef DEBUG -- assert(ident); -- assert(tab); --#endif -- StringValue *sv = tab->insert(ident->toChars(), ident->len); -- if (!sv) -- return NULL; // already in table -- sv->ptrvalue = s; -- return s; --#else - Dsymbol **ps = (Dsymbol **)_aaGet(&tab, ident); - if (*ps) - return NULL; // already in table - *ps = s; - return s; --#endif - } - - Dsymbol *DsymbolTable::insert(Identifier *ident, Dsymbol *s) - { - //printf("DsymbolTable::insert()\n"); --#if STRINGTABLE -- StringValue *sv = tab->insert(ident->toChars(), ident->len); -- if (!sv) -- return NULL; // already in table -- sv->ptrvalue = s; -- return s; --#else - Dsymbol **ps = (Dsymbol **)_aaGet(&tab, ident); - if (*ps) - return NULL; // already in table - *ps = s; - return s; --#endif - } - - Dsymbol *DsymbolTable::update(Dsymbol *s) - { - Identifier *ident = s->ident; --#if STRINGTABLE -- StringValue *sv = tab->update(ident->toChars(), ident->len); -- sv->ptrvalue = s; -- return s; --#else - Dsymbol **ps = (Dsymbol **)_aaGet(&tab, ident); - *ps = s; - return s; --#endif - } - - ---- a/src/gcc/d/dfrontend/dsymbol.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/dsymbol.h 2014-04-01 16:32:51.000000000 +0100 -@@ -21,56 +21,56 @@ - #include "mars.h" - #include "arraytypes.h" - --struct Identifier; -+class Identifier; - struct Scope; --struct DsymbolTable; --struct Declaration; --struct ThisDeclaration; --struct TupleDeclaration; --struct TypedefDeclaration; --struct AliasDeclaration; --struct AggregateDeclaration; --struct EnumDeclaration; --struct ClassDeclaration; --struct InterfaceDeclaration; --struct StructDeclaration; --struct UnionDeclaration; --struct FuncDeclaration; --struct FuncAliasDeclaration; --struct FuncLiteralDeclaration; --struct CtorDeclaration; --struct PostBlitDeclaration; --struct DtorDeclaration; --struct StaticCtorDeclaration; --struct StaticDtorDeclaration; --struct SharedStaticCtorDeclaration; --struct SharedStaticDtorDeclaration; --struct InvariantDeclaration; --struct UnitTestDeclaration; --struct NewDeclaration; --struct VarDeclaration; --struct AttribDeclaration; -+class DsymbolTable; -+class Declaration; -+class ThisDeclaration; -+class TypeInfoDeclaration; -+class TupleDeclaration; -+class TypedefDeclaration; -+class AliasDeclaration; -+class AggregateDeclaration; -+class EnumDeclaration; -+class ClassDeclaration; -+class InterfaceDeclaration; -+class StructDeclaration; -+class UnionDeclaration; -+class FuncDeclaration; -+class FuncAliasDeclaration; -+class FuncLiteralDeclaration; -+class CtorDeclaration; -+class PostBlitDeclaration; -+class DtorDeclaration; -+class StaticCtorDeclaration; -+class StaticDtorDeclaration; -+class SharedStaticCtorDeclaration; -+class SharedStaticDtorDeclaration; -+class InvariantDeclaration; -+class UnitTestDeclaration; -+class NewDeclaration; -+class VarDeclaration; -+class AttribDeclaration; - struct Symbol; --struct Package; --struct Module; --struct Import; --struct Type; --struct TypeTuple; --struct WithStatement; --struct LabelDsymbol; --struct ScopeDsymbol; --struct TemplateDeclaration; --struct TemplateInstance; --struct TemplateMixin; --struct EnumMember; --struct ScopeDsymbol; --struct WithScopeSymbol; --struct ArrayScopeSymbol; --struct SymbolDeclaration; --struct Expression; --struct DeleteDeclaration; -+class Package; -+class Module; -+class Import; -+class Type; -+class TypeTuple; -+class WithStatement; -+class LabelDsymbol; -+class ScopeDsymbol; -+class TemplateDeclaration; -+class TemplateInstance; -+class TemplateMixin; -+class EnumMember; -+class WithScopeSymbol; -+class ArrayScopeSymbol; -+class SymbolDeclaration; -+class Expression; -+class DeleteDeclaration; - struct HdrGenState; --struct OverloadSet; -+class OverloadSet; - struct AA; - struct JsonOut; - #ifdef IN_GCC -@@ -103,35 +103,40 @@ enum PASS - PASSinit, // initial state - PASSsemantic, // semantic() started - PASSsemanticdone, // semantic() done -- PASSsemantic2, // semantic2() run -+ PASSsemantic2, // semantic2() started -+ PASSsemantic2done, // semantic2() done - PASSsemantic3, // semantic3() started - PASSsemantic3done, // semantic3() done -+ PASSinline, // inline started -+ PASSinlinedone, // inline done - PASSobj, // toObjFile() run - }; - - typedef int (*Dsymbol_apply_ft_t)(Dsymbol *, void *); - --struct Dsymbol : Object -+class Dsymbol : public RootObject - { -+public: - Identifier *ident; - Dsymbol *parent; - Symbol *csym; // symbol for code generator - Symbol *isym; // import version of csym -- unsigned char *comment; // documentation comment for this Dsymbol -+ utf8_t *comment; // documentation comment for this Dsymbol - Loc loc; // where defined - Scope *scope; // !=NULL means context to use for semantic() - bool errors; // this symbol failed to pass semantic() -+ PASS semanticRun; - char *depmsg; // customized deprecation message - Expressions *userAttributes; // user defined attributes from UserAttributeDeclaration -- UnitTestDeclaration *unittest; // !=NULL means there's a unittest associated with this symbol -+ UnitTestDeclaration *ddocUnittest; // !=NULL means there's a ddoc unittest associated with this symbol (only use this with ddoc) - - Dsymbol(); - Dsymbol(Identifier *); - char *toChars(); - Loc& getLoc(); - char *locToChars(); -- int equals(Object *o); -- int isAnonymous(); -+ bool equals(RootObject *o); -+ bool isAnonymous(); - void error(Loc loc, const char *format, ...); - void error(const char *format, ...); - void deprecation(Loc loc, const char *format, ...); -@@ -144,11 +149,13 @@ struct Dsymbol : Object - Dsymbol *toParent2(); - TemplateInstance *inTemplateInstance(); - TemplateInstance *isSpeculative(); -+ Ungag ungagSpeculative(); - - int dyncast() { return DYNCAST_DSYMBOL; } // kludge for template.isSymbol() - - static Dsymbols *arraySyntaxCopy(Dsymbols *a); - -+ virtual Identifier *getIdent(); - virtual const char *toPrettyChars(); - virtual const char *kind(); - virtual Dsymbol *toAlias(); // resolve real symbol -@@ -156,51 +163,49 @@ struct Dsymbol : Object - virtual int addMember(Scope *sc, ScopeDsymbol *s, int memnum); - virtual void setScope(Scope *sc); - virtual void importAll(Scope *sc); -- virtual void semantic0(Scope *sc); - virtual void semantic(Scope *sc); - virtual void semantic2(Scope *sc); - virtual void semantic3(Scope *sc); - virtual void inlineScan(); - virtual Dsymbol *search(Loc loc, Identifier *ident, int flags); - Dsymbol *search_correct(Identifier *id); -- Dsymbol *searchX(Loc loc, Scope *sc, Identifier *id); -- virtual int overloadInsert(Dsymbol *s); -- char *toHChars(); -+ Dsymbol *searchX(Loc loc, Scope *sc, RootObject *id); -+ virtual bool overloadInsert(Dsymbol *s); - virtual void toHBuffer(OutBuffer *buf, HdrGenState *hgs); - virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - virtual void toDocBuffer(OutBuffer *buf, Scope *sc); - virtual void toJson(JsonOut *json); - virtual void jsonProperties(JsonOut *json); - virtual unsigned size(Loc loc); -- virtual int isforwardRef(); -+ virtual bool isforwardRef(); - virtual void defineRef(Dsymbol *s); - virtual AggregateDeclaration *isThis(); // is a 'this' required to access the member - AggregateDeclaration *isAggregateMember(); // are we a member of an aggregate? - AggregateDeclaration *isAggregateMember2(); // are we a member of an aggregate? - ClassDeclaration *isClassMember(); // are we a member of a class? -- virtual int isExport(); // is Dsymbol exported? -- virtual int isImportedSymbol(); // is Dsymbol imported? -- virtual int isDeprecated(); // is Dsymbol deprecated? -+ virtual bool isExport(); // is Dsymbol exported? -+ virtual bool isImportedSymbol(); // is Dsymbol imported? -+ virtual bool isDeprecated(); // is Dsymbol deprecated? - #if DMDV2 -- virtual int isOverloadable(); -- virtual int hasOverloads(); -+ virtual bool isOverloadable(); -+ virtual bool hasOverloads(); - #endif - virtual LabelDsymbol *isLabel(); // is this a LabelDsymbol? - virtual AggregateDeclaration *isMember(); // is this symbol a member of an AggregateDeclaration? - virtual Type *getType(); // is this a type? -- virtual char *mangle(bool isv = false); -- virtual int needThis(); // need a 'this' pointer? -- virtual enum PROT prot(); -+ virtual const char *mangle(bool isv = false); -+ virtual bool needThis(); // need a 'this' pointer? -+ virtual PROT prot(); - virtual Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees -- virtual int oneMember(Dsymbol **ps, Identifier *ident); -- static int oneMembers(Dsymbols *members, Dsymbol **ps, Identifier *ident = NULL); -+ virtual bool oneMember(Dsymbol **ps, Identifier *ident); -+ static bool oneMembers(Dsymbols *members, Dsymbol **ps, Identifier *ident); - virtual void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); -- virtual int hasPointers(); -+ virtual bool hasPointers(); - virtual bool hasStaticCtorOrDtor(); - virtual void addLocalClass(ClassDeclarations *) { } - virtual void checkCtorConstInit() { } - -- virtual void addComment(unsigned char *comment); -+ virtual void addComment(utf8_t *comment); - virtual void emitComment(Scope *sc); - void emitDitto(Scope *sc); - -@@ -224,6 +229,7 @@ struct Dsymbol : Object - virtual TemplateMixin *isTemplateMixin() { return NULL; } - virtual Declaration *isDeclaration() { return NULL; } - virtual ThisDeclaration *isThisDeclaration() { return NULL; } -+ virtual TypeInfoDeclaration *isTypeInfoDeclaration() { return NULL; } - virtual TupleDeclaration *isTupleDeclaration() { return NULL; } - virtual TypedefDeclaration *isTypedefDeclaration() { return NULL; } - virtual AliasDeclaration *isAliasDeclaration() { return NULL; } -@@ -259,8 +265,9 @@ struct Dsymbol : Object - - // Dsymbol that generates a scope - --struct ScopeDsymbol : Dsymbol -+class ScopeDsymbol : public Dsymbol - { -+public: - Dsymbols *members; // all Dsymbol's in this scope - DsymbolTable *symtab; // members[] sorted into table - -@@ -271,8 +278,8 @@ struct ScopeDsymbol : Dsymbol - ScopeDsymbol(Identifier *id); - Dsymbol *syntaxCopy(Dsymbol *s); - Dsymbol *search(Loc loc, Identifier *ident, int flags); -- void importScope(Dsymbol *s, enum PROT protection); -- int isforwardRef(); -+ void importScope(Dsymbol *s, PROT protection); -+ bool isforwardRef(); - void defineRef(Dsymbol *s); - static void multiplyDefined(Loc loc, Dsymbol *s1, Dsymbol *s2); - Dsymbol *nameCollision(Dsymbol *s); -@@ -294,8 +301,9 @@ struct ScopeDsymbol : Dsymbol - - // With statement scope - --struct WithScopeSymbol : ScopeDsymbol -+class WithScopeSymbol : public ScopeDsymbol - { -+public: - WithStatement *withstate; - - WithScopeSymbol(WithStatement *withstate); -@@ -306,8 +314,9 @@ struct WithScopeSymbol : ScopeDsymbol - - // Array Index/Slice scope - --struct ArrayScopeSymbol : ScopeDsymbol -+class ArrayScopeSymbol : public ScopeDsymbol - { -+public: - Expression *exp; // IndexExp or SliceExp - TypeTuple *type; // for tuple[length] - TupleDeclaration *td; // for tuples of objects -@@ -324,11 +333,12 @@ struct ArrayScopeSymbol : ScopeDsymbol - // Overload Sets - - #if DMDV2 --struct OverloadSet : Dsymbol -+class OverloadSet : public Dsymbol - { -+public: - Dsymbols a; // array of Dsymbols - -- OverloadSet(); -+ OverloadSet(Identifier *ident); - void push(Dsymbol *s); - OverloadSet *isOverloadSet() { return this; } - const char *kind(); -@@ -337,12 +347,12 @@ struct OverloadSet : Dsymbol - - // Table of Dsymbol's - --struct DsymbolTable : Object -+class DsymbolTable : public RootObject - { -+public: - AA *tab; - - DsymbolTable(); -- ~DsymbolTable(); - - // Look up Identifier. Return Dsymbol if found, NULL if not. - Dsymbol *lookup(Identifier *ident); ---- a/src/gcc/d/dfrontend/entity.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/entity.c 2014-04-01 16:32:51.000000000 +0100 -@@ -11,6 +11,8 @@ - #include <string.h> - #include <ctype.h> - -+#include "port.h" -+ - /********************************************* - * Convert from named entity to its encoding. - * For reference: -@@ -25,2344 +27,2344 @@ struct NameId - }; - - static NameId namesA[]={ -- "Aacgr", 0x00386, // GREEK CAPITAL LETTER ALPHA WITH TONOS -- "aacgr", 0x003AC, // GREEK SMALL LETTER ALPHA WITH TONOS -- "Aacute", 0x000C1, // LATIN CAPITAL LETTER A WITH ACUTE -- "aacute", 0x000E1, // LATIN SMALL LETTER A WITH ACUTE -- "Abreve", 0x00102, // LATIN CAPITAL LETTER A WITH BREVE -- "abreve", 0x00103, // LATIN SMALL LETTER A WITH BREVE -- "ac", 0x0223E, // INVERTED LAZY S -- "acd", 0x0223F, // SINE WAVE --// "acE", 0x0223E;0x00333, // INVERTED LAZY S with double underline -- "Acirc", 0x000C2, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX -- "acirc", 0x000E2, // LATIN SMALL LETTER A WITH CIRCUMFLEX -- "acute", 0x000B4, // ACUTE ACCENT -- "Acy", 0x00410, // CYRILLIC CAPITAL LETTER A -- "acy", 0x00430, // CYRILLIC SMALL LETTER A -- "AElig", 0x000C6, // LATIN CAPITAL LETTER AE -- "aelig", 0x000E6, // LATIN SMALL LETTER AE -- "af", 0x02061, // FUNCTION APPLICATION -- "Afr", 0x1D504, // MATHEMATICAL FRAKTUR CAPITAL A -- "afr", 0x1D51E, // MATHEMATICAL FRAKTUR SMALL A -- "Agr", 0x00391, // GREEK CAPITAL LETTER ALPHA -- "agr", 0x003B1, // GREEK SMALL LETTER ALPHA -- "Agrave", 0x000C0, // LATIN CAPITAL LETTER A WITH GRAVE -- "agrave", 0x000E0, // LATIN SMALL LETTER A WITH GRAVE -- "alefsym", 0x02135, // ALEF SYMBOL -- "aleph", 0x02135, // ALEF SYMBOL -- "Alpha", 0x00391, // GREEK CAPITAL LETTER ALPHA -- "alpha", 0x003B1, // GREEK SMALL LETTER ALPHA -- "Amacr", 0x00100, // LATIN CAPITAL LETTER A WITH MACRON -- "amacr", 0x00101, // LATIN SMALL LETTER A WITH MACRON -- "amalg", 0x02A3F, // AMALGAMATION OR COPRODUCT -- "amp", 0x00026, // AMPERSAND -- "AMP", 0x00026, // AMPERSAND -- "and", 0x02227, // LOGICAL AND -- "And", 0x02A53, // DOUBLE LOGICAL AND -- "andand", 0x02A55, // TWO INTERSECTING LOGICAL AND -- "andd", 0x02A5C, // LOGICAL AND WITH HORIZONTAL DASH -- "andslope", 0x02A58, // SLOPING LARGE AND -- "andv", 0x02A5A, // LOGICAL AND WITH MIDDLE STEM -- "ang", 0x02220, // ANGLE -- "ange", 0x029A4, // ANGLE WITH UNDERBAR -- "angle", 0x02220, // ANGLE -- "angmsd", 0x02221, // MEASURED ANGLE -- "angmsdaa", 0x029A8, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT -- "angmsdab", 0x029A9, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT -- "angmsdac", 0x029AA, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT -- "angmsdad", 0x029AB, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT -- "angmsdae", 0x029AC, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP -- "angmsdaf", 0x029AD, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP -- "angmsdag", 0x029AE, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN -- "angmsdah", 0x029AF, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN -- "angrt", 0x0221F, // RIGHT ANGLE -- "angrtvb", 0x022BE, // RIGHT ANGLE WITH ARC -- "angrtvbd", 0x0299D, // MEASURED RIGHT ANGLE WITH DOT -- "angsph", 0x02222, // SPHERICAL ANGLE -- "angst", 0x000C5, // LATIN CAPITAL LETTER A WITH RING ABOVE -- "angzarr", 0x0237C, // RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW -- "Aogon", 0x00104, // LATIN CAPITAL LETTER A WITH OGONEK -- "aogon", 0x00105, // LATIN SMALL LETTER A WITH OGONEK -- "Aopf", 0x1D538, // MATHEMATICAL DOUBLE-STRUCK CAPITAL A -- "aopf", 0x1D552, // MATHEMATICAL DOUBLE-STRUCK SMALL A -- "ap", 0x02248, // ALMOST EQUAL TO -- "apacir", 0x02A6F, // ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT -- "ape", 0x0224A, // ALMOST EQUAL OR EQUAL TO -- "apE", 0x02A70, // APPROXIMATELY EQUAL OR EQUAL TO -- "apid", 0x0224B, // TRIPLE TILDE -- "apos", 0x00027, // APOSTROPHE -- "ApplyFunction", 0x02061, // FUNCTION APPLICATION -- "approx", 0x02248, // ALMOST EQUAL TO -- "approxeq", 0x0224A, // ALMOST EQUAL OR EQUAL TO -- "Aring", 0x000C5, // LATIN CAPITAL LETTER A WITH RING ABOVE -- "aring", 0x000E5, // LATIN SMALL LETTER A WITH RING ABOVE -- "Ascr", 0x1D49C, // MATHEMATICAL SCRIPT CAPITAL A -- "ascr", 0x1D4B6, // MATHEMATICAL SCRIPT SMALL A -- "Assign", 0x02254, // COLON EQUALS -- "ast", 0x0002A, // ASTERISK -- "asymp", 0x02248, // ALMOST EQUAL TO -- "asympeq", 0x0224D, // EQUIVALENT TO -- "Atilde", 0x000C3, // LATIN CAPITAL LETTER A WITH TILDE -- "atilde", 0x000E3, // LATIN SMALL LETTER A WITH TILDE -- "Auml", 0x000C4, // LATIN CAPITAL LETTER A WITH DIAERESIS -- "auml", 0x000E4, // LATIN SMALL LETTER A WITH DIAERESIS -- "awconint", 0x02233, // ANTICLOCKWISE CONTOUR INTEGRAL -- "awint", 0x02A11, // ANTICLOCKWISE INTEGRATION -- NULL, 0 -+ {"Aacgr", 0x00386}, // GREEK CAPITAL LETTER ALPHA WITH TONOS -+ {"aacgr", 0x003AC}, // GREEK SMALL LETTER ALPHA WITH TONOS -+ {"Aacute", 0x000C1}, // LATIN CAPITAL LETTER A WITH ACUTE -+ {"aacute", 0x000E1}, // LATIN SMALL LETTER A WITH ACUTE -+ {"Abreve", 0x00102}, // LATIN CAPITAL LETTER A WITH BREVE -+ {"abreve", 0x00103}, // LATIN SMALL LETTER A WITH BREVE -+ {"ac", 0x0223E}, // INVERTED LAZY S -+ {"acd", 0x0223F}, // SINE WAVE -+// {"acE", 0x0223E;0x00333}, // INVERTED LAZY S with double underline -+ {"Acirc", 0x000C2}, // LATIN CAPITAL LETTER A WITH CIRCUMFLEX -+ {"acirc", 0x000E2}, // LATIN SMALL LETTER A WITH CIRCUMFLEX -+ {"acute", 0x000B4}, // ACUTE ACCENT -+ {"Acy", 0x00410}, // CYRILLIC CAPITAL LETTER A -+ {"acy", 0x00430}, // CYRILLIC SMALL LETTER A -+ {"AElig", 0x000C6}, // LATIN CAPITAL LETTER AE -+ {"aelig", 0x000E6}, // LATIN SMALL LETTER AE -+ {"af", 0x02061}, // FUNCTION APPLICATION -+ {"Afr", 0x1D504}, // MATHEMATICAL FRAKTUR CAPITAL A -+ {"afr", 0x1D51E}, // MATHEMATICAL FRAKTUR SMALL A -+ {"Agr", 0x00391}, // GREEK CAPITAL LETTER ALPHA -+ {"agr", 0x003B1}, // GREEK SMALL LETTER ALPHA -+ {"Agrave", 0x000C0}, // LATIN CAPITAL LETTER A WITH GRAVE -+ {"agrave", 0x000E0}, // LATIN SMALL LETTER A WITH GRAVE -+ {"alefsym", 0x02135}, // ALEF SYMBOL -+ {"aleph", 0x02135}, // ALEF SYMBOL -+ {"Alpha", 0x00391}, // GREEK CAPITAL LETTER ALPHA -+ {"alpha", 0x003B1}, // GREEK SMALL LETTER ALPHA -+ {"Amacr", 0x00100}, // LATIN CAPITAL LETTER A WITH MACRON -+ {"amacr", 0x00101}, // LATIN SMALL LETTER A WITH MACRON -+ {"amalg", 0x02A3F}, // AMALGAMATION OR COPRODUCT -+ {"amp", 0x00026}, // AMPERSAND -+ {"AMP", 0x00026}, // AMPERSAND -+ {"and", 0x02227}, // LOGICAL AND -+ {"And", 0x02A53}, // DOUBLE LOGICAL AND -+ {"andand", 0x02A55}, // TWO INTERSECTING LOGICAL AND -+ {"andd", 0x02A5C}, // LOGICAL AND WITH HORIZONTAL DASH -+ {"andslope", 0x02A58}, // SLOPING LARGE AND -+ {"andv", 0x02A5A}, // LOGICAL AND WITH MIDDLE STEM -+ {"ang", 0x02220}, // ANGLE -+ {"ange", 0x029A4}, // ANGLE WITH UNDERBAR -+ {"angle", 0x02220}, // ANGLE -+ {"angmsd", 0x02221}, // MEASURED ANGLE -+ {"angmsdaa", 0x029A8}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT -+ {"angmsdab", 0x029A9}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT -+ {"angmsdac", 0x029AA}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT -+ {"angmsdad", 0x029AB}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT -+ {"angmsdae", 0x029AC}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP -+ {"angmsdaf", 0x029AD}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP -+ {"angmsdag", 0x029AE}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN -+ {"angmsdah", 0x029AF}, // MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN -+ {"angrt", 0x0221F}, // RIGHT ANGLE -+ {"angrtvb", 0x022BE}, // RIGHT ANGLE WITH ARC -+ {"angrtvbd", 0x0299D}, // MEASURED RIGHT ANGLE WITH DOT -+ {"angsph", 0x02222}, // SPHERICAL ANGLE -+ {"angst", 0x000C5}, // LATIN CAPITAL LETTER A WITH RING ABOVE -+ {"angzarr", 0x0237C}, // RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW -+ {"Aogon", 0x00104}, // LATIN CAPITAL LETTER A WITH OGONEK -+ {"aogon", 0x00105}, // LATIN SMALL LETTER A WITH OGONEK -+ {"Aopf", 0x1D538}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL A -+ {"aopf", 0x1D552}, // MATHEMATICAL DOUBLE-STRUCK SMALL A -+ {"ap", 0x02248}, // ALMOST EQUAL TO -+ {"apacir", 0x02A6F}, // ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT -+ {"ape", 0x0224A}, // ALMOST EQUAL OR EQUAL TO -+ {"apE", 0x02A70}, // APPROXIMATELY EQUAL OR EQUAL TO -+ {"apid", 0x0224B}, // TRIPLE TILDE -+ {"apos", 0x00027}, // APOSTROPHE -+ {"ApplyFunction", 0x02061}, // FUNCTION APPLICATION -+ {"approx", 0x02248}, // ALMOST EQUAL TO -+ {"approxeq", 0x0224A}, // ALMOST EQUAL OR EQUAL TO -+ {"Aring", 0x000C5}, // LATIN CAPITAL LETTER A WITH RING ABOVE -+ {"aring", 0x000E5}, // LATIN SMALL LETTER A WITH RING ABOVE -+ {"Ascr", 0x1D49C}, // MATHEMATICAL SCRIPT CAPITAL A -+ {"ascr", 0x1D4B6}, // MATHEMATICAL SCRIPT SMALL A -+ {"Assign", 0x02254}, // COLON EQUALS -+ {"ast", 0x0002A}, // ASTERISK -+ {"asymp", 0x02248}, // ALMOST EQUAL TO -+ {"asympeq", 0x0224D}, // EQUIVALENT TO -+ {"Atilde", 0x000C3}, // LATIN CAPITAL LETTER A WITH TILDE -+ {"atilde", 0x000E3}, // LATIN SMALL LETTER A WITH TILDE -+ {"Auml", 0x000C4}, // LATIN CAPITAL LETTER A WITH DIAERESIS -+ {"auml", 0x000E4}, // LATIN SMALL LETTER A WITH DIAERESIS -+ {"awconint", 0x02233}, // ANTICLOCKWISE CONTOUR INTEGRAL -+ {"awint", 0x02A11}, // ANTICLOCKWISE INTEGRATION -+ {NULL, 0} - }; - - static NameId namesB[]={ -- "backcong", 0x0224C, // ALL EQUAL TO -- "backepsilon", 0x003F6, // GREEK REVERSED LUNATE EPSILON SYMBOL -- "backprime", 0x02035, // REVERSED PRIME -- "backsim", 0x0223D, // REVERSED TILDE -- "backsimeq", 0x022CD, // REVERSED TILDE EQUALS -- "Backslash", 0x02216, // SET MINUS --// "b.alpha", 0x1D6C2, // MATHEMATICAL BOLD SMALL ALPHA -- "Barv", 0x02AE7, // SHORT DOWN TACK WITH OVERBAR -- "barvee", 0x022BD, // NOR -- "barwed", 0x02305, // PROJECTIVE -- "Barwed", 0x02306, // PERSPECTIVE -- "barwedge", 0x02305, // PROJECTIVE --// "b.beta", 0x1D6C3, // MATHEMATICAL BOLD SMALL BETA -- "bbrk", 0x023B5, // BOTTOM SQUARE BRACKET -- "bbrktbrk", 0x023B6, // BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET --// "b.chi", 0x1D6D8, // MATHEMATICAL BOLD SMALL CHI -- "bcong", 0x0224C, // ALL EQUAL TO -- "Bcy", 0x00411, // CYRILLIC CAPITAL LETTER BE -- "bcy", 0x00431, // CYRILLIC SMALL LETTER BE --// "b.Delta", 0x1D6AB, // MATHEMATICAL BOLD CAPITAL DELTA --// "b.delta", 0x1D6C5, // MATHEMATICAL BOLD SMALL DELTA -- "bdquo", 0x0201E, // DOUBLE LOW-9 QUOTATION MARK -- "becaus", 0x02235, // BECAUSE -- "because", 0x02235, // BECAUSE -- "Because", 0x02235, // BECAUSE -- "bemptyv", 0x029B0, // REVERSED EMPTY SET -- "bepsi", 0x003F6, // GREEK REVERSED LUNATE EPSILON SYMBOL --// "b.epsi", 0x1D6C6, // MATHEMATICAL BOLD SMALL EPSILON --// "b.epsiv", 0x1D6DC, // MATHEMATICAL BOLD EPSILON SYMBOL -- "bernou", 0x0212C, // SCRIPT CAPITAL B -- "Bernoullis", 0x0212C, // SCRIPT CAPITAL B -- "Beta", 0x00392, // GREEK CAPITAL LETTER BETA -- "beta", 0x003B2, // GREEK SMALL LETTER BETA --// "b.eta", 0x1D6C8, // MATHEMATICAL BOLD SMALL ETA -- "beth", 0x02136, // BET SYMBOL -- "between", 0x0226C, // BETWEEN -- "Bfr", 0x1D505, // MATHEMATICAL FRAKTUR CAPITAL B -- "bfr", 0x1D51F, // MATHEMATICAL FRAKTUR SMALL B --// "b.Gamma", 0x1D6AA, // MATHEMATICAL BOLD CAPITAL GAMMA --// "b.gamma", 0x1D6C4, // MATHEMATICAL BOLD SMALL GAMMA --// "b.Gammad", 0x1D7CA, // MATHEMATICAL BOLD CAPITAL DIGAMMA --// "b.gammad", 0x1D7CB, // MATHEMATICAL BOLD SMALL DIGAMMA -- "Bgr", 0x00392, // GREEK CAPITAL LETTER BETA -- "bgr", 0x003B2, // GREEK SMALL LETTER BETA -- "bigcap", 0x022C2, // N-ARY INTERSECTION -- "bigcirc", 0x025EF, // LARGE CIRCLE -- "bigcup", 0x022C3, // N-ARY UNION -- "bigodot", 0x02A00, // N-ARY CIRCLED DOT OPERATOR -- "bigoplus", 0x02A01, // N-ARY CIRCLED PLUS OPERATOR -- "bigotimes", 0x02A02, // N-ARY CIRCLED TIMES OPERATOR -- "bigsqcup", 0x02A06, // N-ARY SQUARE UNION OPERATOR -- "bigstar", 0x02605, // BLACK STAR -- "bigtriangledown", 0x025BD, // WHITE DOWN-POINTING TRIANGLE -- "bigtriangleup", 0x025B3, // WHITE UP-POINTING TRIANGLE -- "biguplus", 0x02A04, // N-ARY UNION OPERATOR WITH PLUS -- "bigvee", 0x022C1, // N-ARY LOGICAL OR -- "bigwedge", 0x022C0, // N-ARY LOGICAL AND --// "b.iota", 0x1D6CA, // MATHEMATICAL BOLD SMALL IOTA --// "b.kappa", 0x1D6CB, // MATHEMATICAL BOLD SMALL KAPPA --// "b.kappav", 0x1D6DE, // MATHEMATICAL BOLD KAPPA SYMBOL -- "bkarow", 0x0290D, // RIGHTWARDS DOUBLE DASH ARROW -- "blacklozenge", 0x029EB, // BLACK LOZENGE -- "blacksquare", 0x025AA, // BLACK SMALL SQUARE -- "blacktriangle", 0x025B4, // BLACK UP-POINTING SMALL TRIANGLE -- "blacktriangledown", 0x025BE, // BLACK DOWN-POINTING SMALL TRIANGLE -- "blacktriangleleft", 0x025C2, // BLACK LEFT-POINTING SMALL TRIANGLE -- "blacktriangleright", 0x025B8, // BLACK RIGHT-POINTING SMALL TRIANGLE --// "b.Lambda", 0x1D6B2, // MATHEMATICAL BOLD CAPITAL LAMDA --// "b.lambda", 0x1D6CC, // MATHEMATICAL BOLD SMALL LAMDA -- "blank", 0x02423, // OPEN BOX -- "blk12", 0x02592, // MEDIUM SHADE -- "blk14", 0x02591, // LIGHT SHADE -- "blk34", 0x02593, // DARK SHADE -- "block", 0x02588, // FULL BLOCK --// "b.mu", 0x1D6CD, // MATHEMATICAL BOLD SMALL MU --// "bne", 0x0003D;0x020E5, // EQUALS SIGN with reverse slash --// "bnequiv", 0x02261;0x020E5, // IDENTICAL TO with reverse slash -- "bnot", 0x02310, // REVERSED NOT SIGN -- "bNot", 0x02AED, // REVERSED DOUBLE STROKE NOT SIGN --// "b.nu", 0x1D6CE, // MATHEMATICAL BOLD SMALL NU --// "b.Omega", 0x1D6C0, // MATHEMATICAL BOLD CAPITAL OMEGA --// "b.omega", 0x1D6DA, // MATHEMATICAL BOLD SMALL OMEGA -- "Bopf", 0x1D539, // MATHEMATICAL DOUBLE-STRUCK CAPITAL B -- "bopf", 0x1D553, // MATHEMATICAL DOUBLE-STRUCK SMALL B -- "bot", 0x022A5, // UP TACK -- "bottom", 0x022A5, // UP TACK -- "bowtie", 0x022C8, // BOWTIE -- "boxbox", 0x029C9, // TWO JOINED SQUARES -- "boxdl", 0x02510, // BOX DRAWINGS LIGHT DOWN AND LEFT -- "boxdL", 0x02555, // BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE -- "boxDl", 0x02556, // BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE -- "boxDL", 0x02557, // BOX DRAWINGS DOUBLE DOWN AND LEFT -- "boxdr", 0x0250C, // BOX DRAWINGS LIGHT DOWN AND RIGHT -- "boxdR", 0x02552, // BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE -- "boxDr", 0x02553, // BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE -- "boxDR", 0x02554, // BOX DRAWINGS DOUBLE DOWN AND RIGHT -- "boxh", 0x02500, // BOX DRAWINGS LIGHT HORIZONTAL -- "boxH", 0x02550, // BOX DRAWINGS DOUBLE HORIZONTAL -- "boxhd", 0x0252C, // BOX DRAWINGS LIGHT DOWN AND HORIZONTAL -- "boxHd", 0x02564, // BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE -- "boxhD", 0x02565, // BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE -- "boxHD", 0x02566, // BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL -- "boxhu", 0x02534, // BOX DRAWINGS LIGHT UP AND HORIZONTAL -- "boxHu", 0x02567, // BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE -- "boxhU", 0x02568, // BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE -- "boxHU", 0x02569, // BOX DRAWINGS DOUBLE UP AND HORIZONTAL -- "boxminus", 0x0229F, // SQUARED MINUS -- "boxplus", 0x0229E, // SQUARED PLUS -- "boxtimes", 0x022A0, // SQUARED TIMES -- "boxul", 0x02518, // BOX DRAWINGS LIGHT UP AND LEFT -- "boxuL", 0x0255B, // BOX DRAWINGS UP SINGLE AND LEFT DOUBLE -- "boxUl", 0x0255C, // BOX DRAWINGS UP DOUBLE AND LEFT SINGLE -- "boxUL", 0x0255D, // BOX DRAWINGS DOUBLE UP AND LEFT -- "boxur", 0x02514, // BOX DRAWINGS LIGHT UP AND RIGHT -- "boxuR", 0x02558, // BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE -- "boxUr", 0x02559, // BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE -- "boxUR", 0x0255A, // BOX DRAWINGS DOUBLE UP AND RIGHT -- "boxv", 0x02502, // BOX DRAWINGS LIGHT VERTICAL -- "boxV", 0x02551, // BOX DRAWINGS DOUBLE VERTICAL -- "boxvh", 0x0253C, // BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL -- "boxvH", 0x0256A, // BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE -- "boxVh", 0x0256B, // BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE -- "boxVH", 0x0256C, // BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL -- "boxvl", 0x02524, // BOX DRAWINGS LIGHT VERTICAL AND LEFT -- "boxvL", 0x02561, // BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE -- "boxVl", 0x02562, // BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE -- "boxVL", 0x02563, // BOX DRAWINGS DOUBLE VERTICAL AND LEFT -- "boxvr", 0x0251C, // BOX DRAWINGS LIGHT VERTICAL AND RIGHT -- "boxvR", 0x0255E, // BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE -- "boxVr", 0x0255F, // BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE -- "boxVR", 0x02560, // BOX DRAWINGS DOUBLE VERTICAL AND RIGHT --// "b.Phi", 0x1D6BD, // MATHEMATICAL BOLD CAPITAL PHI --// "b.phi", 0x1D6D7, // MATHEMATICAL BOLD SMALL PHI --// "b.phiv", 0x1D6DF, // MATHEMATICAL BOLD PHI SYMBOL --// "b.Pi", 0x1D6B7, // MATHEMATICAL BOLD CAPITAL PI --// "b.pi", 0x1D6D1, // MATHEMATICAL BOLD SMALL PI --// "b.piv", 0x1D6E1, // MATHEMATICAL BOLD PI SYMBOL -- "bprime", 0x02035, // REVERSED PRIME --// "b.Psi", 0x1D6BF, // MATHEMATICAL BOLD CAPITAL PSI --// "b.psi", 0x1D6D9, // MATHEMATICAL BOLD SMALL PSI -- "breve", 0x002D8, // BREVE -- "Breve", 0x002D8, // BREVE --// "b.rho", 0x1D6D2, // MATHEMATICAL BOLD SMALL RHO --// "b.rhov", 0x1D6E0, // MATHEMATICAL BOLD RHO SYMBOL -- "brvbar", 0x000A6, // BROKEN BAR -- "Bscr", 0x0212C, // SCRIPT CAPITAL B -- "bscr", 0x1D4B7, // MATHEMATICAL SCRIPT SMALL B -- "bsemi", 0x0204F, // REVERSED SEMICOLON --// "b.Sigma", 0x1D6BA, // MATHEMATICAL BOLD CAPITAL SIGMA --// "b.sigma", 0x1D6D4, // MATHEMATICAL BOLD SMALL SIGMA --// "b.sigmav", 0x1D6D3, // MATHEMATICAL BOLD SMALL FINAL SIGMA -- "bsim", 0x0223D, // REVERSED TILDE -- "bsime", 0x022CD, // REVERSED TILDE EQUALS -- "bsol", 0x0005C, // REVERSE SOLIDUS -- "bsolb", 0x029C5, // SQUARED FALLING DIAGONAL SLASH -- "bsolhsub", 0x027C8, // REVERSE SOLIDUS PRECEDING SUBSET --// "b.tau", 0x1D6D5, // MATHEMATICAL BOLD SMALL TAU --// "b.Theta", 0x1D6AF, // MATHEMATICAL BOLD CAPITAL THETA --// "b.thetas", 0x1D6C9, // MATHEMATICAL BOLD SMALL THETA --// "b.thetav", 0x1D6DD, // MATHEMATICAL BOLD THETA SYMBOL -- "bull", 0x02022, // BULLET -- "bullet", 0x02022, // BULLET -- "bump", 0x0224E, // GEOMETRICALLY EQUIVALENT TO -- "bumpe", 0x0224F, // DIFFERENCE BETWEEN -- "bumpE", 0x02AAE, // EQUALS SIGN WITH BUMPY ABOVE -- "Bumpeq", 0x0224E, // GEOMETRICALLY EQUIVALENT TO -- "bumpeq", 0x0224F, // DIFFERENCE BETWEEN --// "b.Upsi", 0x1D6BC, // MATHEMATICAL BOLD CAPITAL UPSILON --// "b.upsi", 0x1D6D6, // MATHEMATICAL BOLD SMALL UPSILON --// "b.Xi", 0x1D6B5, // MATHEMATICAL BOLD CAPITAL XI --// "b.xi", 0x1D6CF, // MATHEMATICAL BOLD SMALL XI --// "b.zeta", 0x1D6C7, // MATHEMATICAL BOLD SMALL ZETA -- NULL, 0 -+ {"backcong", 0x0224C}, // ALL EQUAL TO -+ {"backepsilon", 0x003F6}, // GREEK REVERSED LUNATE EPSILON SYMBOL -+ {"backprime", 0x02035}, // REVERSED PRIME -+ {"backsim", 0x0223D}, // REVERSED TILDE -+ {"backsimeq", 0x022CD}, // REVERSED TILDE EQUALS -+ {"Backslash", 0x02216}, // SET MINUS -+// "b.alpha", 0x1D6C2}, // MATHEMATICAL BOLD SMALL ALPHA -+ {"Barv", 0x02AE7}, // SHORT DOWN TACK WITH OVERBAR -+ {"barvee", 0x022BD}, // NOR -+ {"barwed", 0x02305}, // PROJECTIVE -+ {"Barwed", 0x02306}, // PERSPECTIVE -+ {"barwedge", 0x02305}, // PROJECTIVE -+// "b.beta", 0x1D6C3}, // MATHEMATICAL BOLD SMALL BETA -+ {"bbrk", 0x023B5}, // BOTTOM SQUARE BRACKET -+ {"bbrktbrk", 0x023B6}, // BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET -+// "b.chi", 0x1D6D8}, // MATHEMATICAL BOLD SMALL CHI -+ {"bcong", 0x0224C}, // ALL EQUAL TO -+ {"Bcy", 0x00411}, // CYRILLIC CAPITAL LETTER BE -+ {"bcy", 0x00431}, // CYRILLIC SMALL LETTER BE -+// "b.Delta", 0x1D6AB}, // MATHEMATICAL BOLD CAPITAL DELTA -+// "b.delta", 0x1D6C5}, // MATHEMATICAL BOLD SMALL DELTA -+ {"bdquo", 0x0201E}, // DOUBLE LOW-9 QUOTATION MARK -+ {"becaus", 0x02235}, // BECAUSE -+ {"because", 0x02235}, // BECAUSE -+ {"Because", 0x02235}, // BECAUSE -+ {"bemptyv", 0x029B0}, // REVERSED EMPTY SET -+ {"bepsi", 0x003F6}, // GREEK REVERSED LUNATE EPSILON SYMBOL -+// "b.epsi", 0x1D6C6}, // MATHEMATICAL BOLD SMALL EPSILON -+// "b.epsiv", 0x1D6DC}, // MATHEMATICAL BOLD EPSILON SYMBOL -+ {"bernou", 0x0212C}, // SCRIPT CAPITAL B -+ {"Bernoullis", 0x0212C}, // SCRIPT CAPITAL B -+ {"Beta", 0x00392}, // GREEK CAPITAL LETTER BETA -+ {"beta", 0x003B2}, // GREEK SMALL LETTER BETA -+// "b.eta", 0x1D6C8}, // MATHEMATICAL BOLD SMALL ETA -+ {"beth", 0x02136}, // BET SYMBOL -+ {"between", 0x0226C}, // BETWEEN -+ {"Bfr", 0x1D505}, // MATHEMATICAL FRAKTUR CAPITAL B -+ {"bfr", 0x1D51F}, // MATHEMATICAL FRAKTUR SMALL B -+// "b.Gamma", 0x1D6AA}, // MATHEMATICAL BOLD CAPITAL GAMMA -+// "b.gamma", 0x1D6C4}, // MATHEMATICAL BOLD SMALL GAMMA -+// "b.Gammad", 0x1D7CA}, // MATHEMATICAL BOLD CAPITAL DIGAMMA -+// "b.gammad", 0x1D7CB}, // MATHEMATICAL BOLD SMALL DIGAMMA -+ {"Bgr", 0x00392}, // GREEK CAPITAL LETTER BETA -+ {"bgr", 0x003B2}, // GREEK SMALL LETTER BETA -+ {"bigcap", 0x022C2}, // N-ARY INTERSECTION -+ {"bigcirc", 0x025EF}, // LARGE CIRCLE -+ {"bigcup", 0x022C3}, // N-ARY UNION -+ {"bigodot", 0x02A00}, // N-ARY CIRCLED DOT OPERATOR -+ {"bigoplus", 0x02A01}, // N-ARY CIRCLED PLUS OPERATOR -+ {"bigotimes", 0x02A02}, // N-ARY CIRCLED TIMES OPERATOR -+ {"bigsqcup", 0x02A06}, // N-ARY SQUARE UNION OPERATOR -+ {"bigstar", 0x02605}, // BLACK STAR -+ {"bigtriangledown", 0x025BD}, // WHITE DOWN-POINTING TRIANGLE -+ {"bigtriangleup", 0x025B3}, // WHITE UP-POINTING TRIANGLE -+ {"biguplus", 0x02A04}, // N-ARY UNION OPERATOR WITH PLUS -+ {"bigvee", 0x022C1}, // N-ARY LOGICAL OR -+ {"bigwedge", 0x022C0}, // N-ARY LOGICAL AND -+// "b.iota", 0x1D6CA}, // MATHEMATICAL BOLD SMALL IOTA -+// "b.kappa", 0x1D6CB}, // MATHEMATICAL BOLD SMALL KAPPA -+// "b.kappav", 0x1D6DE}, // MATHEMATICAL BOLD KAPPA SYMBOL -+ {"bkarow", 0x0290D}, // RIGHTWARDS DOUBLE DASH ARROW -+ {"blacklozenge", 0x029EB}, // BLACK LOZENGE -+ {"blacksquare", 0x025AA}, // BLACK SMALL SQUARE -+ {"blacktriangle", 0x025B4}, // BLACK UP-POINTING SMALL TRIANGLE -+ {"blacktriangledown", 0x025BE}, // BLACK DOWN-POINTING SMALL TRIANGLE -+ {"blacktriangleleft", 0x025C2}, // BLACK LEFT-POINTING SMALL TRIANGLE -+ {"blacktriangleright", 0x025B8}, // BLACK RIGHT-POINTING SMALL TRIANGLE -+// "b.Lambda", 0x1D6B2}, // MATHEMATICAL BOLD CAPITAL LAMDA -+// "b.lambda", 0x1D6CC}, // MATHEMATICAL BOLD SMALL LAMDA -+ {"blank", 0x02423}, // OPEN BOX -+ {"blk12", 0x02592}, // MEDIUM SHADE -+ {"blk14", 0x02591}, // LIGHT SHADE -+ {"blk34", 0x02593}, // DARK SHADE -+ {"block", 0x02588}, // FULL BLOCK -+// "b.mu", 0x1D6CD}, // MATHEMATICAL BOLD SMALL MU -+// "bne", 0x0003D;0x020E5}, // EQUALS SIGN with reverse slash -+// "bnequiv", 0x02261;0x020E5}, // IDENTICAL TO with reverse slash -+ {"bnot", 0x02310}, // REVERSED NOT SIGN -+ {"bNot", 0x02AED}, // REVERSED DOUBLE STROKE NOT SIGN -+// "b.nu", 0x1D6CE}, // MATHEMATICAL BOLD SMALL NU -+// "b.Omega", 0x1D6C0}, // MATHEMATICAL BOLD CAPITAL OMEGA -+// "b.omega", 0x1D6DA}, // MATHEMATICAL BOLD SMALL OMEGA -+ {"Bopf", 0x1D539}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL B -+ {"bopf", 0x1D553}, // MATHEMATICAL DOUBLE-STRUCK SMALL B -+ {"bot", 0x022A5}, // UP TACK -+ {"bottom", 0x022A5}, // UP TACK -+ {"bowtie", 0x022C8}, // BOWTIE -+ {"boxbox", 0x029C9}, // TWO JOINED SQUARES -+ {"boxdl", 0x02510}, // BOX DRAWINGS LIGHT DOWN AND LEFT -+ {"boxdL", 0x02555}, // BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE -+ {"boxDl", 0x02556}, // BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE -+ {"boxDL", 0x02557}, // BOX DRAWINGS DOUBLE DOWN AND LEFT -+ {"boxdr", 0x0250C}, // BOX DRAWINGS LIGHT DOWN AND RIGHT -+ {"boxdR", 0x02552}, // BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE -+ {"boxDr", 0x02553}, // BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE -+ {"boxDR", 0x02554}, // BOX DRAWINGS DOUBLE DOWN AND RIGHT -+ {"boxh", 0x02500}, // BOX DRAWINGS LIGHT HORIZONTAL -+ {"boxH", 0x02550}, // BOX DRAWINGS DOUBLE HORIZONTAL -+ {"boxhd", 0x0252C}, // BOX DRAWINGS LIGHT DOWN AND HORIZONTAL -+ {"boxHd", 0x02564}, // BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE -+ {"boxhD", 0x02565}, // BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE -+ {"boxHD", 0x02566}, // BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL -+ {"boxhu", 0x02534}, // BOX DRAWINGS LIGHT UP AND HORIZONTAL -+ {"boxHu", 0x02567}, // BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE -+ {"boxhU", 0x02568}, // BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE -+ {"boxHU", 0x02569}, // BOX DRAWINGS DOUBLE UP AND HORIZONTAL -+ {"boxminus", 0x0229F}, // SQUARED MINUS -+ {"boxplus", 0x0229E}, // SQUARED PLUS -+ {"boxtimes", 0x022A0}, // SQUARED TIMES -+ {"boxul", 0x02518}, // BOX DRAWINGS LIGHT UP AND LEFT -+ {"boxuL", 0x0255B}, // BOX DRAWINGS UP SINGLE AND LEFT DOUBLE -+ {"boxUl", 0x0255C}, // BOX DRAWINGS UP DOUBLE AND LEFT SINGLE -+ {"boxUL", 0x0255D}, // BOX DRAWINGS DOUBLE UP AND LEFT -+ {"boxur", 0x02514}, // BOX DRAWINGS LIGHT UP AND RIGHT -+ {"boxuR", 0x02558}, // BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE -+ {"boxUr", 0x02559}, // BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE -+ {"boxUR", 0x0255A}, // BOX DRAWINGS DOUBLE UP AND RIGHT -+ {"boxv", 0x02502}, // BOX DRAWINGS LIGHT VERTICAL -+ {"boxV", 0x02551}, // BOX DRAWINGS DOUBLE VERTICAL -+ {"boxvh", 0x0253C}, // BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL -+ {"boxvH", 0x0256A}, // BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE -+ {"boxVh", 0x0256B}, // BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE -+ {"boxVH", 0x0256C}, // BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL -+ {"boxvl", 0x02524}, // BOX DRAWINGS LIGHT VERTICAL AND LEFT -+ {"boxvL", 0x02561}, // BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE -+ {"boxVl", 0x02562}, // BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE -+ {"boxVL", 0x02563}, // BOX DRAWINGS DOUBLE VERTICAL AND LEFT -+ {"boxvr", 0x0251C}, // BOX DRAWINGS LIGHT VERTICAL AND RIGHT -+ {"boxvR", 0x0255E}, // BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE -+ {"boxVr", 0x0255F}, // BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE -+ {"boxVR", 0x02560}, // BOX DRAWINGS DOUBLE VERTICAL AND RIGHT -+// "b.Phi", 0x1D6BD}, // MATHEMATICAL BOLD CAPITAL PHI -+// "b.phi", 0x1D6D7}, // MATHEMATICAL BOLD SMALL PHI -+// "b.phiv", 0x1D6DF}, // MATHEMATICAL BOLD PHI SYMBOL -+// "b.Pi", 0x1D6B7}, // MATHEMATICAL BOLD CAPITAL PI -+// "b.pi", 0x1D6D1}, // MATHEMATICAL BOLD SMALL PI -+// "b.piv", 0x1D6E1}, // MATHEMATICAL BOLD PI SYMBOL -+ {"bprime", 0x02035}, // REVERSED PRIME -+// "b.Psi", 0x1D6BF}, // MATHEMATICAL BOLD CAPITAL PSI -+// "b.psi", 0x1D6D9}, // MATHEMATICAL BOLD SMALL PSI -+ {"breve", 0x002D8}, // BREVE -+ {"Breve", 0x002D8}, // BREVE -+// "b.rho", 0x1D6D2}, // MATHEMATICAL BOLD SMALL RHO -+// "b.rhov", 0x1D6E0}, // MATHEMATICAL BOLD RHO SYMBOL -+ {"brvbar", 0x000A6}, // BROKEN BAR -+ {"Bscr", 0x0212C}, // SCRIPT CAPITAL B -+ {"bscr", 0x1D4B7}, // MATHEMATICAL SCRIPT SMALL B -+ {"bsemi", 0x0204F}, // REVERSED SEMICOLON -+// "b.Sigma", 0x1D6BA}, // MATHEMATICAL BOLD CAPITAL SIGMA -+// "b.sigma", 0x1D6D4}, // MATHEMATICAL BOLD SMALL SIGMA -+// "b.sigmav", 0x1D6D3}, // MATHEMATICAL BOLD SMALL FINAL SIGMA -+ {"bsim", 0x0223D}, // REVERSED TILDE -+ {"bsime", 0x022CD}, // REVERSED TILDE EQUALS -+ {"bsol", 0x0005C}, // REVERSE SOLIDUS -+ {"bsolb", 0x029C5}, // SQUARED FALLING DIAGONAL SLASH -+ {"bsolhsub", 0x027C8}, // REVERSE SOLIDUS PRECEDING SUBSET -+// "b.tau", 0x1D6D5}, // MATHEMATICAL BOLD SMALL TAU -+// "b.Theta", 0x1D6AF}, // MATHEMATICAL BOLD CAPITAL THETA -+// "b.thetas", 0x1D6C9}, // MATHEMATICAL BOLD SMALL THETA -+// "b.thetav", 0x1D6DD}, // MATHEMATICAL BOLD THETA SYMBOL -+ {"bull", 0x02022}, // BULLET -+ {"bullet", 0x02022}, // BULLET -+ {"bump", 0x0224E}, // GEOMETRICALLY EQUIVALENT TO -+ {"bumpe", 0x0224F}, // DIFFERENCE BETWEEN -+ {"bumpE", 0x02AAE}, // EQUALS SIGN WITH BUMPY ABOVE -+ {"Bumpeq", 0x0224E}, // GEOMETRICALLY EQUIVALENT TO -+ {"bumpeq", 0x0224F}, // DIFFERENCE BETWEEN -+// "b.Upsi", 0x1D6BC}, // MATHEMATICAL BOLD CAPITAL UPSILON -+// "b.upsi", 0x1D6D6}, // MATHEMATICAL BOLD SMALL UPSILON -+// "b.Xi", 0x1D6B5}, // MATHEMATICAL BOLD CAPITAL XI -+// "b.xi", 0x1D6CF}, // MATHEMATICAL BOLD SMALL XI -+// "b.zeta", 0x1D6C7}, // MATHEMATICAL BOLD SMALL ZETA -+ {NULL, 0} - }; - - static NameId namesC[]={ -- "Cacute", 0x00106, // LATIN CAPITAL LETTER C WITH ACUTE -- "cacute", 0x00107, // LATIN SMALL LETTER C WITH ACUTE -- "cap", 0x02229, // INTERSECTION -- "Cap", 0x022D2, // DOUBLE INTERSECTION -- "capand", 0x02A44, // INTERSECTION WITH LOGICAL AND -- "capbrcup", 0x02A49, // INTERSECTION ABOVE BAR ABOVE UNION -- "capcap", 0x02A4B, // INTERSECTION BESIDE AND JOINED WITH INTERSECTION -- "capcup", 0x02A47, // INTERSECTION ABOVE UNION -- "capdot", 0x02A40, // INTERSECTION WITH DOT -- "CapitalDifferentialD", 0x02145, // DOUBLE-STRUCK ITALIC CAPITAL D --// "caps", 0x02229;0x0FE00, // INTERSECTION with serifs -- "caret", 0x02041, // CARET INSERTION POINT -- "caron", 0x002C7, // CARON -- "Cayleys", 0x0212D, // BLACK-LETTER CAPITAL C -- "ccaps", 0x02A4D, // CLOSED INTERSECTION WITH SERIFS -- "Ccaron", 0x0010C, // LATIN CAPITAL LETTER C WITH CARON -- "ccaron", 0x0010D, // LATIN SMALL LETTER C WITH CARON -- "Ccedil", 0x000C7, // LATIN CAPITAL LETTER C WITH CEDILLA -- "ccedil", 0x000E7, // LATIN SMALL LETTER C WITH CEDILLA -- "Ccirc", 0x00108, // LATIN CAPITAL LETTER C WITH CIRCUMFLEX -- "ccirc", 0x00109, // LATIN SMALL LETTER C WITH CIRCUMFLEX -- "Cconint", 0x02230, // VOLUME INTEGRAL -- "ccups", 0x02A4C, // CLOSED UNION WITH SERIFS -- "ccupssm", 0x02A50, // CLOSED UNION WITH SERIFS AND SMASH PRODUCT -- "Cdot", 0x0010A, // LATIN CAPITAL LETTER C WITH DOT ABOVE -- "cdot", 0x0010B, // LATIN SMALL LETTER C WITH DOT ABOVE -- "cedil", 0x000B8, // CEDILLA -- "Cedilla", 0x000B8, // CEDILLA -- "cemptyv", 0x029B2, // EMPTY SET WITH SMALL CIRCLE ABOVE -- "cent", 0x000A2, // CENT SIGN -- "centerdot", 0x000B7, // MIDDLE DOT -- "CenterDot", 0x000B7, // MIDDLE DOT -- "Cfr", 0x0212D, // BLACK-LETTER CAPITAL C -- "cfr", 0x1D520, // MATHEMATICAL FRAKTUR SMALL C -- "CHcy", 0x00427, // CYRILLIC CAPITAL LETTER CHE -- "chcy", 0x00447, // CYRILLIC SMALL LETTER CHE -- "check", 0x02713, // CHECK MARK -- "checkmark", 0x02713, // CHECK MARK -- "Chi", 0x003A7, // GREEK CAPITAL LETTER CHI -- "chi", 0x003C7, // GREEK SMALL LETTER CHI -- "cir", 0x025CB, // WHITE CIRCLE -- "circ", 0x002C6, // MODIFIER LETTER CIRCUMFLEX ACCENT -- "circeq", 0x02257, // RING EQUAL TO -- "circlearrowleft", 0x021BA, // ANTICLOCKWISE OPEN CIRCLE ARROW -- "circlearrowright", 0x021BB, // CLOCKWISE OPEN CIRCLE ARROW -- "circledast", 0x0229B, // CIRCLED ASTERISK OPERATOR -- "circledcirc", 0x0229A, // CIRCLED RING OPERATOR -- "circleddash", 0x0229D, // CIRCLED DASH -- "CircleDot", 0x02299, // CIRCLED DOT OPERATOR -- "circledR", 0x000AE, // REGISTERED SIGN -- "circledS", 0x024C8, // CIRCLED LATIN CAPITAL LETTER S -- "CircleMinus", 0x02296, // CIRCLED MINUS -- "CirclePlus", 0x02295, // CIRCLED PLUS -- "CircleTimes", 0x02297, // CIRCLED TIMES -- "cire", 0x02257, // RING EQUAL TO -- "cirE", 0x029C3, // CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT -- "cirfnint", 0x02A10, // CIRCULATION FUNCTION -- "cirmid", 0x02AEF, // VERTICAL LINE WITH CIRCLE ABOVE -- "cirscir", 0x029C2, // CIRCLE WITH SMALL CIRCLE TO THE RIGHT -- "ClockwiseContourIntegral", 0x02232, // CLOCKWISE CONTOUR INTEGRAL -- "CloseCurlyDoubleQuote", 0x0201D, // RIGHT DOUBLE QUOTATION MARK -- "CloseCurlyQuote", 0x02019, // RIGHT SINGLE QUOTATION MARK -- "clubs", 0x02663, // BLACK CLUB SUIT -- "clubsuit", 0x02663, // BLACK CLUB SUIT -- "colon", 0x0003A, // COLON -- "Colon", 0x02237, // PROPORTION -- "colone", 0x02254, // COLON EQUALS -- "Colone", 0x02A74, // DOUBLE COLON EQUAL -- "coloneq", 0x02254, // COLON EQUALS -- "comma", 0x0002C, // COMMA -- "commat", 0x00040, // COMMERCIAL AT -- "comp", 0x02201, // COMPLEMENT -- "compfn", 0x02218, // RING OPERATOR -- "complement", 0x02201, // COMPLEMENT -- "complexes", 0x02102, // DOUBLE-STRUCK CAPITAL C -- "cong", 0x02245, // APPROXIMATELY EQUAL TO -- "congdot", 0x02A6D, // CONGRUENT WITH DOT ABOVE -- "Congruent", 0x02261, // IDENTICAL TO -- "conint", 0x0222E, // CONTOUR INTEGRAL -- "Conint", 0x0222F, // SURFACE INTEGRAL -- "ContourIntegral", 0x0222E, // CONTOUR INTEGRAL -- "Copf", 0x02102, // DOUBLE-STRUCK CAPITAL C -- "copf", 0x1D554, // MATHEMATICAL DOUBLE-STRUCK SMALL C -- "coprod", 0x02210, // N-ARY COPRODUCT -- "Coproduct", 0x02210, // N-ARY COPRODUCT -- "copy", 0x000A9, // COPYRIGHT SIGN -- "COPY", 0x000A9, // COPYRIGHT SIGN -- "copysr", 0x02117, // SOUND RECORDING COPYRIGHT -- "CounterClockwiseContourIntegral", 0x02233, // ANTICLOCKWISE CONTOUR INTEGRAL -- "crarr", 0x021B5, // DOWNWARDS ARROW WITH CORNER LEFTWARDS -- "cross", 0x02717, // BALLOT X -- "Cross", 0x02A2F, // VECTOR OR CROSS PRODUCT -- "Cscr", 0x1D49E, // MATHEMATICAL SCRIPT CAPITAL C -- "cscr", 0x1D4B8, // MATHEMATICAL SCRIPT SMALL C -- "csub", 0x02ACF, // CLOSED SUBSET -- "csube", 0x02AD1, // CLOSED SUBSET OR EQUAL TO -- "csup", 0x02AD0, // CLOSED SUPERSET -- "csupe", 0x02AD2, // CLOSED SUPERSET OR EQUAL TO -- "ctdot", 0x022EF, // MIDLINE HORIZONTAL ELLIPSIS -- "cudarrl", 0x02938, // RIGHT-SIDE ARC CLOCKWISE ARROW -- "cudarrr", 0x02935, // ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS -- "cuepr", 0x022DE, // EQUAL TO OR PRECEDES -- "cuesc", 0x022DF, // EQUAL TO OR SUCCEEDS -- "cularr", 0x021B6, // ANTICLOCKWISE TOP SEMICIRCLE ARROW -- "cularrp", 0x0293D, // TOP ARC ANTICLOCKWISE ARROW WITH PLUS -- "cup", 0x0222A, // UNION -- "Cup", 0x022D3, // DOUBLE UNION -- "cupbrcap", 0x02A48, // UNION ABOVE BAR ABOVE INTERSECTION -- "CupCap", 0x0224D, // EQUIVALENT TO -- "cupcap", 0x02A46, // UNION ABOVE INTERSECTION -- "cupcup", 0x02A4A, // UNION BESIDE AND JOINED WITH UNION -- "cupdot", 0x0228D, // MULTISET MULTIPLICATION -- "cupor", 0x02A45, // UNION WITH LOGICAL OR --// "cups", 0x0222A;0x0FE00, // UNION with serifs -- "curarr", 0x021B7, // CLOCKWISE TOP SEMICIRCLE ARROW -- "curarrm", 0x0293C, // TOP ARC CLOCKWISE ARROW WITH MINUS -- "curlyeqprec", 0x022DE, // EQUAL TO OR PRECEDES -- "curlyeqsucc", 0x022DF, // EQUAL TO OR SUCCEEDS -- "curlyvee", 0x022CE, // CURLY LOGICAL OR -- "curlywedge", 0x022CF, // CURLY LOGICAL AND -- "curren", 0x000A4, // CURRENCY SIGN -- "curvearrowleft", 0x021B6, // ANTICLOCKWISE TOP SEMICIRCLE ARROW -- "curvearrowright", 0x021B7, // CLOCKWISE TOP SEMICIRCLE ARROW -- "cuvee", 0x022CE, // CURLY LOGICAL OR -- "cuwed", 0x022CF, // CURLY LOGICAL AND -- "cwconint", 0x02232, // CLOCKWISE CONTOUR INTEGRAL -- "cwint", 0x02231, // CLOCKWISE INTEGRAL -- "cylcty", 0x0232D, // CYLINDRICITY -- NULL, 0 -+ {"Cacute", 0x00106}, // LATIN CAPITAL LETTER C WITH ACUTE -+ {"cacute", 0x00107}, // LATIN SMALL LETTER C WITH ACUTE -+ {"cap", 0x02229}, // INTERSECTION -+ {"Cap", 0x022D2}, // DOUBLE INTERSECTION -+ {"capand", 0x02A44}, // INTERSECTION WITH LOGICAL AND -+ {"capbrcup", 0x02A49}, // INTERSECTION ABOVE BAR ABOVE UNION -+ {"capcap", 0x02A4B}, // INTERSECTION BESIDE AND JOINED WITH INTERSECTION -+ {"capcup", 0x02A47}, // INTERSECTION ABOVE UNION -+ {"capdot", 0x02A40}, // INTERSECTION WITH DOT -+ {"CapitalDifferentialD", 0x02145}, // DOUBLE-STRUCK ITALIC CAPITAL D -+// "caps", 0x02229;0x0FE00}, // INTERSECTION with serifs -+ {"caret", 0x02041}, // CARET INSERTION POINT -+ {"caron", 0x002C7}, // CARON -+ {"Cayleys", 0x0212D}, // BLACK-LETTER CAPITAL C -+ {"ccaps", 0x02A4D}, // CLOSED INTERSECTION WITH SERIFS -+ {"Ccaron", 0x0010C}, // LATIN CAPITAL LETTER C WITH CARON -+ {"ccaron", 0x0010D}, // LATIN SMALL LETTER C WITH CARON -+ {"Ccedil", 0x000C7}, // LATIN CAPITAL LETTER C WITH CEDILLA -+ {"ccedil", 0x000E7}, // LATIN SMALL LETTER C WITH CEDILLA -+ {"Ccirc", 0x00108}, // LATIN CAPITAL LETTER C WITH CIRCUMFLEX -+ {"ccirc", 0x00109}, // LATIN SMALL LETTER C WITH CIRCUMFLEX -+ {"Cconint", 0x02230}, // VOLUME INTEGRAL -+ {"ccups", 0x02A4C}, // CLOSED UNION WITH SERIFS -+ {"ccupssm", 0x02A50}, // CLOSED UNION WITH SERIFS AND SMASH PRODUCT -+ {"Cdot", 0x0010A}, // LATIN CAPITAL LETTER C WITH DOT ABOVE -+ {"cdot", 0x0010B}, // LATIN SMALL LETTER C WITH DOT ABOVE -+ {"cedil", 0x000B8}, // CEDILLA -+ {"Cedilla", 0x000B8}, // CEDILLA -+ {"cemptyv", 0x029B2}, // EMPTY SET WITH SMALL CIRCLE ABOVE -+ {"cent", 0x000A2}, // CENT SIGN -+ {"centerdot", 0x000B7}, // MIDDLE DOT -+ {"CenterDot", 0x000B7}, // MIDDLE DOT -+ {"Cfr", 0x0212D}, // BLACK-LETTER CAPITAL C -+ {"cfr", 0x1D520}, // MATHEMATICAL FRAKTUR SMALL C -+ {"CHcy", 0x00427}, // CYRILLIC CAPITAL LETTER CHE -+ {"chcy", 0x00447}, // CYRILLIC SMALL LETTER CHE -+ {"check", 0x02713}, // CHECK MARK -+ {"checkmark", 0x02713}, // CHECK MARK -+ {"Chi", 0x003A7}, // GREEK CAPITAL LETTER CHI -+ {"chi", 0x003C7}, // GREEK SMALL LETTER CHI -+ {"cir", 0x025CB}, // WHITE CIRCLE -+ {"circ", 0x002C6}, // MODIFIER LETTER CIRCUMFLEX ACCENT -+ {"circeq", 0x02257}, // RING EQUAL TO -+ {"circlearrowleft", 0x021BA}, // ANTICLOCKWISE OPEN CIRCLE ARROW -+ {"circlearrowright", 0x021BB}, // CLOCKWISE OPEN CIRCLE ARROW -+ {"circledast", 0x0229B}, // CIRCLED ASTERISK OPERATOR -+ {"circledcirc", 0x0229A}, // CIRCLED RING OPERATOR -+ {"circleddash", 0x0229D}, // CIRCLED DASH -+ {"CircleDot", 0x02299}, // CIRCLED DOT OPERATOR -+ {"circledR", 0x000AE}, // REGISTERED SIGN -+ {"circledS", 0x024C8}, // CIRCLED LATIN CAPITAL LETTER S -+ {"CircleMinus", 0x02296}, // CIRCLED MINUS -+ {"CirclePlus", 0x02295}, // CIRCLED PLUS -+ {"CircleTimes", 0x02297}, // CIRCLED TIMES -+ {"cire", 0x02257}, // RING EQUAL TO -+ {"cirE", 0x029C3}, // CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT -+ {"cirfnint", 0x02A10}, // CIRCULATION FUNCTION -+ {"cirmid", 0x02AEF}, // VERTICAL LINE WITH CIRCLE ABOVE -+ {"cirscir", 0x029C2}, // CIRCLE WITH SMALL CIRCLE TO THE RIGHT -+ {"ClockwiseContourIntegral", 0x02232}, // CLOCKWISE CONTOUR INTEGRAL -+ {"CloseCurlyDoubleQuote", 0x0201D}, // RIGHT DOUBLE QUOTATION MARK -+ {"CloseCurlyQuote", 0x02019}, // RIGHT SINGLE QUOTATION MARK -+ {"clubs", 0x02663}, // BLACK CLUB SUIT -+ {"clubsuit", 0x02663}, // BLACK CLUB SUIT -+ {"colon", 0x0003A}, // COLON -+ {"Colon", 0x02237}, // PROPORTION -+ {"colone", 0x02254}, // COLON EQUALS -+ {"Colone", 0x02A74}, // DOUBLE COLON EQUAL -+ {"coloneq", 0x02254}, // COLON EQUALS -+ {"comma", 0x0002C}, // COMMA -+ {"commat", 0x00040}, // COMMERCIAL AT -+ {"comp", 0x02201}, // COMPLEMENT -+ {"compfn", 0x02218}, // RING OPERATOR -+ {"complement", 0x02201}, // COMPLEMENT -+ {"complexes", 0x02102}, // DOUBLE-STRUCK CAPITAL C -+ {"cong", 0x02245}, // APPROXIMATELY EQUAL TO -+ {"congdot", 0x02A6D}, // CONGRUENT WITH DOT ABOVE -+ {"Congruent", 0x02261}, // IDENTICAL TO -+ {"conint", 0x0222E}, // CONTOUR INTEGRAL -+ {"Conint", 0x0222F}, // SURFACE INTEGRAL -+ {"ContourIntegral", 0x0222E}, // CONTOUR INTEGRAL -+ {"Copf", 0x02102}, // DOUBLE-STRUCK CAPITAL C -+ {"copf", 0x1D554}, // MATHEMATICAL DOUBLE-STRUCK SMALL C -+ {"coprod", 0x02210}, // N-ARY COPRODUCT -+ {"Coproduct", 0x02210}, // N-ARY COPRODUCT -+ {"copy", 0x000A9}, // COPYRIGHT SIGN -+ {"COPY", 0x000A9}, // COPYRIGHT SIGN -+ {"copysr", 0x02117}, // SOUND RECORDING COPYRIGHT -+ {"CounterClockwiseContourIntegral", 0x02233}, // ANTICLOCKWISE CONTOUR INTEGRAL -+ {"crarr", 0x021B5}, // DOWNWARDS ARROW WITH CORNER LEFTWARDS -+ {"cross", 0x02717}, // BALLOT X -+ {"Cross", 0x02A2F}, // VECTOR OR CROSS PRODUCT -+ {"Cscr", 0x1D49E}, // MATHEMATICAL SCRIPT CAPITAL C -+ {"cscr", 0x1D4B8}, // MATHEMATICAL SCRIPT SMALL C -+ {"csub", 0x02ACF}, // CLOSED SUBSET -+ {"csube", 0x02AD1}, // CLOSED SUBSET OR EQUAL TO -+ {"csup", 0x02AD0}, // CLOSED SUPERSET -+ {"csupe", 0x02AD2}, // CLOSED SUPERSET OR EQUAL TO -+ {"ctdot", 0x022EF}, // MIDLINE HORIZONTAL ELLIPSIS -+ {"cudarrl", 0x02938}, // RIGHT-SIDE ARC CLOCKWISE ARROW -+ {"cudarrr", 0x02935}, // ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS -+ {"cuepr", 0x022DE}, // EQUAL TO OR PRECEDES -+ {"cuesc", 0x022DF}, // EQUAL TO OR SUCCEEDS -+ {"cularr", 0x021B6}, // ANTICLOCKWISE TOP SEMICIRCLE ARROW -+ {"cularrp", 0x0293D}, // TOP ARC ANTICLOCKWISE ARROW WITH PLUS -+ {"cup", 0x0222A}, // UNION -+ {"Cup", 0x022D3}, // DOUBLE UNION -+ {"cupbrcap", 0x02A48}, // UNION ABOVE BAR ABOVE INTERSECTION -+ {"CupCap", 0x0224D}, // EQUIVALENT TO -+ {"cupcap", 0x02A46}, // UNION ABOVE INTERSECTION -+ {"cupcup", 0x02A4A}, // UNION BESIDE AND JOINED WITH UNION -+ {"cupdot", 0x0228D}, // MULTISET MULTIPLICATION -+ {"cupor", 0x02A45}, // UNION WITH LOGICAL OR -+// "cups", 0x0222A;0x0FE00}, // UNION with serifs -+ {"curarr", 0x021B7}, // CLOCKWISE TOP SEMICIRCLE ARROW -+ {"curarrm", 0x0293C}, // TOP ARC CLOCKWISE ARROW WITH MINUS -+ {"curlyeqprec", 0x022DE}, // EQUAL TO OR PRECEDES -+ {"curlyeqsucc", 0x022DF}, // EQUAL TO OR SUCCEEDS -+ {"curlyvee", 0x022CE}, // CURLY LOGICAL OR -+ {"curlywedge", 0x022CF}, // CURLY LOGICAL AND -+ {"curren", 0x000A4}, // CURRENCY SIGN -+ {"curvearrowleft", 0x021B6}, // ANTICLOCKWISE TOP SEMICIRCLE ARROW -+ {"curvearrowright", 0x021B7}, // CLOCKWISE TOP SEMICIRCLE ARROW -+ {"cuvee", 0x022CE}, // CURLY LOGICAL OR -+ {"cuwed", 0x022CF}, // CURLY LOGICAL AND -+ {"cwconint", 0x02232}, // CLOCKWISE CONTOUR INTEGRAL -+ {"cwint", 0x02231}, // CLOCKWISE INTEGRAL -+ {"cylcty", 0x0232D}, // CYLINDRICITY -+ {NULL, 0} - }; - - static NameId namesD[]={ -- "dagger", 0x02020, // DAGGER -- "Dagger", 0x02021, // DOUBLE DAGGER -- "daleth", 0x02138, // DALET SYMBOL -- "darr", 0x02193, // DOWNWARDS ARROW -- "Darr", 0x021A1, // DOWNWARDS TWO HEADED ARROW -- "dArr", 0x021D3, // DOWNWARDS DOUBLE ARROW -- "dash", 0x02010, // HYPHEN -- "dashv", 0x022A3, // LEFT TACK -- "Dashv", 0x02AE4, // VERTICAL BAR DOUBLE LEFT TURNSTILE -- "dbkarow", 0x0290F, // RIGHTWARDS TRIPLE DASH ARROW -- "dblac", 0x002DD, // DOUBLE ACUTE ACCENT -- "Dcaron", 0x0010E, // LATIN CAPITAL LETTER D WITH CARON -- "dcaron", 0x0010F, // LATIN SMALL LETTER D WITH CARON -- "Dcy", 0x00414, // CYRILLIC CAPITAL LETTER DE -- "dcy", 0x00434, // CYRILLIC SMALL LETTER DE -- "DD", 0x02145, // DOUBLE-STRUCK ITALIC CAPITAL D -- "dd", 0x02146, // DOUBLE-STRUCK ITALIC SMALL D -- "ddagger", 0x02021, // DOUBLE DAGGER -- "ddarr", 0x021CA, // DOWNWARDS PAIRED ARROWS -- "DDotrahd", 0x02911, // RIGHTWARDS ARROW WITH DOTTED STEM -- "ddotseq", 0x02A77, // EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW -- "deg", 0x000B0, // DEGREE SIGN -- "Del", 0x02207, // NABLA -- "Delta", 0x00394, // GREEK CAPITAL LETTER DELTA -- "delta", 0x003B4, // GREEK SMALL LETTER DELTA -- "demptyv", 0x029B1, // EMPTY SET WITH OVERBAR -- "dfisht", 0x0297F, // DOWN FISH TAIL -- "Dfr", 0x1D507, // MATHEMATICAL FRAKTUR CAPITAL D -- "dfr", 0x1D521, // MATHEMATICAL FRAKTUR SMALL D -- "Dgr", 0x00394, // GREEK CAPITAL LETTER DELTA -- "dgr", 0x003B4, // GREEK SMALL LETTER DELTA -- "dHar", 0x02965, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -- "dharl", 0x021C3, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -- "dharr", 0x021C2, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -- "DiacriticalAcute", 0x000B4, // ACUTE ACCENT -- "DiacriticalDot", 0x002D9, // DOT ABOVE -- "DiacriticalDoubleAcute", 0x002DD, // DOUBLE ACUTE ACCENT -- "DiacriticalGrave", 0x00060, // GRAVE ACCENT -- "DiacriticalTilde", 0x002DC, // SMALL TILDE -- "diam", 0x022C4, // DIAMOND OPERATOR -- "diamond", 0x022C4, // DIAMOND OPERATOR -- "Diamond", 0x022C4, // DIAMOND OPERATOR -- "diamondsuit", 0x02666, // BLACK DIAMOND SUIT -- "diams", 0x02666, // BLACK DIAMOND SUIT -- "die", 0x000A8, // DIAERESIS -- "DifferentialD", 0x02146, // DOUBLE-STRUCK ITALIC SMALL D -- "digamma", 0x003DD, // GREEK SMALL LETTER DIGAMMA -- "disin", 0x022F2, // ELEMENT OF WITH LONG HORIZONTAL STROKE -- "div", 0x000F7, // DIVISION SIGN -- "divide", 0x000F7, // DIVISION SIGN -- "divideontimes", 0x022C7, // DIVISION TIMES -- "divonx", 0x022C7, // DIVISION TIMES -- "DJcy", 0x00402, // CYRILLIC CAPITAL LETTER DJE -- "djcy", 0x00452, // CYRILLIC SMALL LETTER DJE -- "dlcorn", 0x0231E, // BOTTOM LEFT CORNER -- "dlcrop", 0x0230D, // BOTTOM LEFT CROP -- "dollar", 0x00024, // DOLLAR SIGN -- "Dopf", 0x1D53B, // MATHEMATICAL DOUBLE-STRUCK CAPITAL D -- "dopf", 0x1D555, // MATHEMATICAL DOUBLE-STRUCK SMALL D -- "Dot", 0x000A8, // DIAERESIS -- "dot", 0x002D9, // DOT ABOVE -- "DotDot", 0x020DC, // COMBINING FOUR DOTS ABOVE -- "doteq", 0x02250, // APPROACHES THE LIMIT -- "doteqdot", 0x02251, // GEOMETRICALLY EQUAL TO -- "DotEqual", 0x02250, // APPROACHES THE LIMIT -- "dotminus", 0x02238, // DOT MINUS -- "dotplus", 0x02214, // DOT PLUS -- "dotsquare", 0x022A1, // SQUARED DOT OPERATOR -- "doublebarwedge", 0x02306, // PERSPECTIVE -- "DoubleContourIntegral", 0x0222F, // SURFACE INTEGRAL -- "DoubleDot", 0x000A8, // DIAERESIS -- "DoubleDownArrow", 0x021D3, // DOWNWARDS DOUBLE ARROW -- "DoubleLeftArrow", 0x021D0, // LEFTWARDS DOUBLE ARROW -- "DoubleLeftRightArrow", 0x021D4, // LEFT RIGHT DOUBLE ARROW -- "DoubleLeftTee", 0x02AE4, // VERTICAL BAR DOUBLE LEFT TURNSTILE -- "DoubleLongLeftArrow", 0x027F8, // LONG LEFTWARDS DOUBLE ARROW -- "DoubleLongLeftRightArrow", 0x027FA, // LONG LEFT RIGHT DOUBLE ARROW -- "DoubleLongRightArrow", 0x027F9, // LONG RIGHTWARDS DOUBLE ARROW -- "DoubleRightArrow", 0x021D2, // RIGHTWARDS DOUBLE ARROW -- "DoubleRightTee", 0x022A8, // TRUE -- "DoubleUpArrow", 0x021D1, // UPWARDS DOUBLE ARROW -- "DoubleUpDownArrow", 0x021D5, // UP DOWN DOUBLE ARROW -- "DoubleVerticalBar", 0x02225, // PARALLEL TO -- "downarrow", 0x02193, // DOWNWARDS ARROW -- "DownArrow", 0x02193, // DOWNWARDS ARROW -- "Downarrow", 0x021D3, // DOWNWARDS DOUBLE ARROW -- "DownArrowBar", 0x02913, // DOWNWARDS ARROW TO BAR -- "DownArrowUpArrow", 0x021F5, // DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW -- "DownBreve", 0x00311, // COMBINING INVERTED BREVE -- "downdownarrows", 0x021CA, // DOWNWARDS PAIRED ARROWS -- "downharpoonleft", 0x021C3, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -- "downharpoonright", 0x021C2, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -- "DownLeftRightVector", 0x02950, // LEFT BARB DOWN RIGHT BARB DOWN HARPOON -- "DownLeftTeeVector", 0x0295E, // LEFTWARDS HARPOON WITH BARB DOWN FROM BAR -- "DownLeftVector", 0x021BD, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -- "DownLeftVectorBar", 0x02956, // LEFTWARDS HARPOON WITH BARB DOWN TO BAR -- "DownRightTeeVector", 0x0295F, // RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR -- "DownRightVector", 0x021C1, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -- "DownRightVectorBar", 0x02957, // RIGHTWARDS HARPOON WITH BARB DOWN TO BAR -- "DownTee", 0x022A4, // DOWN TACK -- "DownTeeArrow", 0x021A7, // DOWNWARDS ARROW FROM BAR -- "drbkarow", 0x02910, // RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW -- "drcorn", 0x0231F, // BOTTOM RIGHT CORNER -- "drcrop", 0x0230C, // BOTTOM RIGHT CROP -- "Dscr", 0x1D49F, // MATHEMATICAL SCRIPT CAPITAL D -- "dscr", 0x1D4B9, // MATHEMATICAL SCRIPT SMALL D -- "DScy", 0x00405, // CYRILLIC CAPITAL LETTER DZE -- "dscy", 0x00455, // CYRILLIC SMALL LETTER DZE -- "dsol", 0x029F6, // SOLIDUS WITH OVERBAR -- "Dstrok", 0x00110, // LATIN CAPITAL LETTER D WITH STROKE -- "dstrok", 0x00111, // LATIN SMALL LETTER D WITH STROKE -- "dtdot", 0x022F1, // DOWN RIGHT DIAGONAL ELLIPSIS -- "dtri", 0x025BF, // WHITE DOWN-POINTING SMALL TRIANGLE -- "dtrif", 0x025BE, // BLACK DOWN-POINTING SMALL TRIANGLE -- "duarr", 0x021F5, // DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW -- "duhar", 0x0296F, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -- "dwangle", 0x029A6, // OBLIQUE ANGLE OPENING UP -- "DZcy", 0x0040F, // CYRILLIC CAPITAL LETTER DZHE -- "dzcy", 0x0045F, // CYRILLIC SMALL LETTER DZHE -- "dzigrarr", 0x027FF, // LONG RIGHTWARDS SQUIGGLE ARROW -- NULL, 0 -+ {"dagger", 0x02020}, // DAGGER -+ {"Dagger", 0x02021}, // DOUBLE DAGGER -+ {"daleth", 0x02138}, // DALET SYMBOL -+ {"darr", 0x02193}, // DOWNWARDS ARROW -+ {"Darr", 0x021A1}, // DOWNWARDS TWO HEADED ARROW -+ {"dArr", 0x021D3}, // DOWNWARDS DOUBLE ARROW -+ {"dash", 0x02010}, // HYPHEN -+ {"dashv", 0x022A3}, // LEFT TACK -+ {"Dashv", 0x02AE4}, // VERTICAL BAR DOUBLE LEFT TURNSTILE -+ {"dbkarow", 0x0290F}, // RIGHTWARDS TRIPLE DASH ARROW -+ {"dblac", 0x002DD}, // DOUBLE ACUTE ACCENT -+ {"Dcaron", 0x0010E}, // LATIN CAPITAL LETTER D WITH CARON -+ {"dcaron", 0x0010F}, // LATIN SMALL LETTER D WITH CARON -+ {"Dcy", 0x00414}, // CYRILLIC CAPITAL LETTER DE -+ {"dcy", 0x00434}, // CYRILLIC SMALL LETTER DE -+ {"DD", 0x02145}, // DOUBLE-STRUCK ITALIC CAPITAL D -+ {"dd", 0x02146}, // DOUBLE-STRUCK ITALIC SMALL D -+ {"ddagger", 0x02021}, // DOUBLE DAGGER -+ {"ddarr", 0x021CA}, // DOWNWARDS PAIRED ARROWS -+ {"DDotrahd", 0x02911}, // RIGHTWARDS ARROW WITH DOTTED STEM -+ {"ddotseq", 0x02A77}, // EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW -+ {"deg", 0x000B0}, // DEGREE SIGN -+ {"Del", 0x02207}, // NABLA -+ {"Delta", 0x00394}, // GREEK CAPITAL LETTER DELTA -+ {"delta", 0x003B4}, // GREEK SMALL LETTER DELTA -+ {"demptyv", 0x029B1}, // EMPTY SET WITH OVERBAR -+ {"dfisht", 0x0297F}, // DOWN FISH TAIL -+ {"Dfr", 0x1D507}, // MATHEMATICAL FRAKTUR CAPITAL D -+ {"dfr", 0x1D521}, // MATHEMATICAL FRAKTUR SMALL D -+ {"Dgr", 0x00394}, // GREEK CAPITAL LETTER DELTA -+ {"dgr", 0x003B4}, // GREEK SMALL LETTER DELTA -+ {"dHar", 0x02965}, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -+ {"dharl", 0x021C3}, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -+ {"dharr", 0x021C2}, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -+ {"DiacriticalAcute", 0x000B4}, // ACUTE ACCENT -+ {"DiacriticalDot", 0x002D9}, // DOT ABOVE -+ {"DiacriticalDoubleAcute", 0x002DD}, // DOUBLE ACUTE ACCENT -+ {"DiacriticalGrave", 0x00060}, // GRAVE ACCENT -+ {"DiacriticalTilde", 0x002DC}, // SMALL TILDE -+ {"diam", 0x022C4}, // DIAMOND OPERATOR -+ {"diamond", 0x022C4}, // DIAMOND OPERATOR -+ {"Diamond", 0x022C4}, // DIAMOND OPERATOR -+ {"diamondsuit", 0x02666}, // BLACK DIAMOND SUIT -+ {"diams", 0x02666}, // BLACK DIAMOND SUIT -+ {"die", 0x000A8}, // DIAERESIS -+ {"DifferentialD", 0x02146}, // DOUBLE-STRUCK ITALIC SMALL D -+ {"digamma", 0x003DD}, // GREEK SMALL LETTER DIGAMMA -+ {"disin", 0x022F2}, // ELEMENT OF WITH LONG HORIZONTAL STROKE -+ {"div", 0x000F7}, // DIVISION SIGN -+ {"divide", 0x000F7}, // DIVISION SIGN -+ {"divideontimes", 0x022C7}, // DIVISION TIMES -+ {"divonx", 0x022C7}, // DIVISION TIMES -+ {"DJcy", 0x00402}, // CYRILLIC CAPITAL LETTER DJE -+ {"djcy", 0x00452}, // CYRILLIC SMALL LETTER DJE -+ {"dlcorn", 0x0231E}, // BOTTOM LEFT CORNER -+ {"dlcrop", 0x0230D}, // BOTTOM LEFT CROP -+ {"dollar", 0x00024}, // DOLLAR SIGN -+ {"Dopf", 0x1D53B}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL D -+ {"dopf", 0x1D555}, // MATHEMATICAL DOUBLE-STRUCK SMALL D -+ {"Dot", 0x000A8}, // DIAERESIS -+ {"dot", 0x002D9}, // DOT ABOVE -+ {"DotDot", 0x020DC}, // COMBINING FOUR DOTS ABOVE -+ {"doteq", 0x02250}, // APPROACHES THE LIMIT -+ {"doteqdot", 0x02251}, // GEOMETRICALLY EQUAL TO -+ {"DotEqual", 0x02250}, // APPROACHES THE LIMIT -+ {"dotminus", 0x02238}, // DOT MINUS -+ {"dotplus", 0x02214}, // DOT PLUS -+ {"dotsquare", 0x022A1}, // SQUARED DOT OPERATOR -+ {"doublebarwedge", 0x02306}, // PERSPECTIVE -+ {"DoubleContourIntegral", 0x0222F}, // SURFACE INTEGRAL -+ {"DoubleDot", 0x000A8}, // DIAERESIS -+ {"DoubleDownArrow", 0x021D3}, // DOWNWARDS DOUBLE ARROW -+ {"DoubleLeftArrow", 0x021D0}, // LEFTWARDS DOUBLE ARROW -+ {"DoubleLeftRightArrow", 0x021D4}, // LEFT RIGHT DOUBLE ARROW -+ {"DoubleLeftTee", 0x02AE4}, // VERTICAL BAR DOUBLE LEFT TURNSTILE -+ {"DoubleLongLeftArrow", 0x027F8}, // LONG LEFTWARDS DOUBLE ARROW -+ {"DoubleLongLeftRightArrow", 0x027FA}, // LONG LEFT RIGHT DOUBLE ARROW -+ {"DoubleLongRightArrow", 0x027F9}, // LONG RIGHTWARDS DOUBLE ARROW -+ {"DoubleRightArrow", 0x021D2}, // RIGHTWARDS DOUBLE ARROW -+ {"DoubleRightTee", 0x022A8}, // TRUE -+ {"DoubleUpArrow", 0x021D1}, // UPWARDS DOUBLE ARROW -+ {"DoubleUpDownArrow", 0x021D5}, // UP DOWN DOUBLE ARROW -+ {"DoubleVerticalBar", 0x02225}, // PARALLEL TO -+ {"downarrow", 0x02193}, // DOWNWARDS ARROW -+ {"DownArrow", 0x02193}, // DOWNWARDS ARROW -+ {"Downarrow", 0x021D3}, // DOWNWARDS DOUBLE ARROW -+ {"DownArrowBar", 0x02913}, // DOWNWARDS ARROW TO BAR -+ {"DownArrowUpArrow", 0x021F5}, // DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW -+ {"DownBreve", 0x00311}, // COMBINING INVERTED BREVE -+ {"downdownarrows", 0x021CA}, // DOWNWARDS PAIRED ARROWS -+ {"downharpoonleft", 0x021C3}, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -+ {"downharpoonright", 0x021C2}, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -+ {"DownLeftRightVector", 0x02950}, // LEFT BARB DOWN RIGHT BARB DOWN HARPOON -+ {"DownLeftTeeVector", 0x0295E}, // LEFTWARDS HARPOON WITH BARB DOWN FROM BAR -+ {"DownLeftVector", 0x021BD}, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -+ {"DownLeftVectorBar", 0x02956}, // LEFTWARDS HARPOON WITH BARB DOWN TO BAR -+ {"DownRightTeeVector", 0x0295F}, // RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR -+ {"DownRightVector", 0x021C1}, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -+ {"DownRightVectorBar", 0x02957}, // RIGHTWARDS HARPOON WITH BARB DOWN TO BAR -+ {"DownTee", 0x022A4}, // DOWN TACK -+ {"DownTeeArrow", 0x021A7}, // DOWNWARDS ARROW FROM BAR -+ {"drbkarow", 0x02910}, // RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW -+ {"drcorn", 0x0231F}, // BOTTOM RIGHT CORNER -+ {"drcrop", 0x0230C}, // BOTTOM RIGHT CROP -+ {"Dscr", 0x1D49F}, // MATHEMATICAL SCRIPT CAPITAL D -+ {"dscr", 0x1D4B9}, // MATHEMATICAL SCRIPT SMALL D -+ {"DScy", 0x00405}, // CYRILLIC CAPITAL LETTER DZE -+ {"dscy", 0x00455}, // CYRILLIC SMALL LETTER DZE -+ {"dsol", 0x029F6}, // SOLIDUS WITH OVERBAR -+ {"Dstrok", 0x00110}, // LATIN CAPITAL LETTER D WITH STROKE -+ {"dstrok", 0x00111}, // LATIN SMALL LETTER D WITH STROKE -+ {"dtdot", 0x022F1}, // DOWN RIGHT DIAGONAL ELLIPSIS -+ {"dtri", 0x025BF}, // WHITE DOWN-POINTING SMALL TRIANGLE -+ {"dtrif", 0x025BE}, // BLACK DOWN-POINTING SMALL TRIANGLE -+ {"duarr", 0x021F5}, // DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW -+ {"duhar", 0x0296F}, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -+ {"dwangle", 0x029A6}, // OBLIQUE ANGLE OPENING UP -+ {"DZcy", 0x0040F}, // CYRILLIC CAPITAL LETTER DZHE -+ {"dzcy", 0x0045F}, // CYRILLIC SMALL LETTER DZHE -+ {"dzigrarr", 0x027FF}, // LONG RIGHTWARDS SQUIGGLE ARROW -+ {NULL, 0} - }; - - static NameId namesE[]={ -- "Eacgr", 0x00388, // GREEK CAPITAL LETTER EPSILON WITH TONOS -- "eacgr", 0x003AD, // GREEK SMALL LETTER EPSILON WITH TONOS -- "Eacute", 0x000C9, // LATIN CAPITAL LETTER E WITH ACUTE -- "eacute", 0x000E9, // LATIN SMALL LETTER E WITH ACUTE -- "easter", 0x02A6E, // EQUALS WITH ASTERISK -- "Ecaron", 0x0011A, // LATIN CAPITAL LETTER E WITH CARON -- "ecaron", 0x0011B, // LATIN SMALL LETTER E WITH CARON -- "ecir", 0x02256, // RING IN EQUAL TO -- "Ecirc", 0x000CA, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX -- "ecirc", 0x000EA, // LATIN SMALL LETTER E WITH CIRCUMFLEX -- "ecolon", 0x02255, // EQUALS COLON -- "Ecy", 0x0042D, // CYRILLIC CAPITAL LETTER E -- "ecy", 0x0044D, // CYRILLIC SMALL LETTER E -- "eDDot", 0x02A77, // EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW -- "Edot", 0x00116, // LATIN CAPITAL LETTER E WITH DOT ABOVE -- "edot", 0x00117, // LATIN SMALL LETTER E WITH DOT ABOVE -- "eDot", 0x02251, // GEOMETRICALLY EQUAL TO -- "ee", 0x02147, // DOUBLE-STRUCK ITALIC SMALL E -- "EEacgr", 0x00389, // GREEK CAPITAL LETTER ETA WITH TONOS -- "eeacgr", 0x003AE, // GREEK SMALL LETTER ETA WITH TONOS -- "EEgr", 0x00397, // GREEK CAPITAL LETTER ETA -- "eegr", 0x003B7, // GREEK SMALL LETTER ETA -- "efDot", 0x02252, // APPROXIMATELY EQUAL TO OR THE IMAGE OF -- "Efr", 0x1D508, // MATHEMATICAL FRAKTUR CAPITAL E -- "efr", 0x1D522, // MATHEMATICAL FRAKTUR SMALL E -- "eg", 0x02A9A, // DOUBLE-LINE EQUAL TO OR GREATER-THAN -- "Egr", 0x00395, // GREEK CAPITAL LETTER EPSILON -- "egr", 0x003B5, // GREEK SMALL LETTER EPSILON -- "Egrave", 0x000C8, // LATIN CAPITAL LETTER E WITH GRAVE -- "egrave", 0x000E8, // LATIN SMALL LETTER E WITH GRAVE -- "egs", 0x02A96, // SLANTED EQUAL TO OR GREATER-THAN -- "egsdot", 0x02A98, // SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE -- "el", 0x02A99, // DOUBLE-LINE EQUAL TO OR LESS-THAN -- "Element", 0x02208, // ELEMENT OF -- "elinters", 0x023E7, // ELECTRICAL INTERSECTION -- "ell", 0x02113, // SCRIPT SMALL L -- "els", 0x02A95, // SLANTED EQUAL TO OR LESS-THAN -- "elsdot", 0x02A97, // SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE -- "Emacr", 0x00112, // LATIN CAPITAL LETTER E WITH MACRON -- "emacr", 0x00113, // LATIN SMALL LETTER E WITH MACRON -- "empty", 0x02205, // EMPTY SET -- "emptyset", 0x02205, // EMPTY SET -- "EmptySmallSquare", 0x025FB, // WHITE MEDIUM SQUARE -- "emptyv", 0x02205, // EMPTY SET -- "EmptyVerySmallSquare", 0x025AB, // WHITE SMALL SQUARE -- "emsp", 0x02003, // EM SPACE -- "emsp13", 0x02004, // THREE-PER-EM SPACE -- "emsp14", 0x02005, // FOUR-PER-EM SPACE -- "ENG", 0x0014A, // LATIN CAPITAL LETTER ENG -- "eng", 0x0014B, // LATIN SMALL LETTER ENG -- "ensp", 0x02002, // EN SPACE -- "Eogon", 0x00118, // LATIN CAPITAL LETTER E WITH OGONEK -- "eogon", 0x00119, // LATIN SMALL LETTER E WITH OGONEK -- "Eopf", 0x1D53C, // MATHEMATICAL DOUBLE-STRUCK CAPITAL E -- "eopf", 0x1D556, // MATHEMATICAL DOUBLE-STRUCK SMALL E -- "epar", 0x022D5, // EQUAL AND PARALLEL TO -- "eparsl", 0x029E3, // EQUALS SIGN AND SLANTED PARALLEL -- "eplus", 0x02A71, // EQUALS SIGN ABOVE PLUS SIGN -- "epsi", 0x003B5, // GREEK SMALL LETTER EPSILON -- "Epsilon", 0x00395, // GREEK CAPITAL LETTER EPSILON -- "epsilon", 0x003B5, // GREEK SMALL LETTER EPSILON -- "epsiv", 0x003F5, // GREEK LUNATE EPSILON SYMBOL -- "eqcirc", 0x02256, // RING IN EQUAL TO -- "eqcolon", 0x02255, // EQUALS COLON -- "eqsim", 0x02242, // MINUS TILDE -- "eqslantgtr", 0x02A96, // SLANTED EQUAL TO OR GREATER-THAN -- "eqslantless", 0x02A95, // SLANTED EQUAL TO OR LESS-THAN -- "Equal", 0x02A75, // TWO CONSECUTIVE EQUALS SIGNS -- "equals", 0x0003D, // EQUALS SIGN -- "EqualTilde", 0x02242, // MINUS TILDE -- "equest", 0x0225F, // QUESTIONED EQUAL TO -- "Equilibrium", 0x021CC, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -- "equiv", 0x02261, // IDENTICAL TO -- "equivDD", 0x02A78, // EQUIVALENT WITH FOUR DOTS ABOVE -- "eqvparsl", 0x029E5, // IDENTICAL TO AND SLANTED PARALLEL -- "erarr", 0x02971, // EQUALS SIGN ABOVE RIGHTWARDS ARROW -- "erDot", 0x02253, // IMAGE OF OR APPROXIMATELY EQUAL TO -- "escr", 0x0212F, // SCRIPT SMALL E -- "Escr", 0x02130, // SCRIPT CAPITAL E -- "esdot", 0x02250, // APPROACHES THE LIMIT -- "esim", 0x02242, // MINUS TILDE -- "Esim", 0x02A73, // EQUALS SIGN ABOVE TILDE OPERATOR -- "Eta", 0x00397, // GREEK CAPITAL LETTER ETA -- "eta", 0x003B7, // GREEK SMALL LETTER ETA -- "ETH", 0x000D0, // LATIN CAPITAL LETTER ETH -- "eth", 0x000F0, // LATIN SMALL LETTER ETH -- "Euml", 0x000CB, // LATIN CAPITAL LETTER E WITH DIAERESIS -- "euml", 0x000EB, // LATIN SMALL LETTER E WITH DIAERESIS -- "euro", 0x020AC, // EURO SIGN -- "excl", 0x00021, // EXCLAMATION MARK -- "exist", 0x02203, // THERE EXISTS -- "Exists", 0x02203, // THERE EXISTS -- "expectation", 0x02130, // SCRIPT CAPITAL E -- "exponentiale", 0x02147, // DOUBLE-STRUCK ITALIC SMALL E -- "ExponentialE", 0x02147, // DOUBLE-STRUCK ITALIC SMALL E -- NULL, 0 -+ {"Eacgr", 0x00388}, // GREEK CAPITAL LETTER EPSILON WITH TONOS -+ {"eacgr", 0x003AD}, // GREEK SMALL LETTER EPSILON WITH TONOS -+ {"Eacute", 0x000C9}, // LATIN CAPITAL LETTER E WITH ACUTE -+ {"eacute", 0x000E9}, // LATIN SMALL LETTER E WITH ACUTE -+ {"easter", 0x02A6E}, // EQUALS WITH ASTERISK -+ {"Ecaron", 0x0011A}, // LATIN CAPITAL LETTER E WITH CARON -+ {"ecaron", 0x0011B}, // LATIN SMALL LETTER E WITH CARON -+ {"ecir", 0x02256}, // RING IN EQUAL TO -+ {"Ecirc", 0x000CA}, // LATIN CAPITAL LETTER E WITH CIRCUMFLEX -+ {"ecirc", 0x000EA}, // LATIN SMALL LETTER E WITH CIRCUMFLEX -+ {"ecolon", 0x02255}, // EQUALS COLON -+ {"Ecy", 0x0042D}, // CYRILLIC CAPITAL LETTER E -+ {"ecy", 0x0044D}, // CYRILLIC SMALL LETTER E -+ {"eDDot", 0x02A77}, // EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW -+ {"Edot", 0x00116}, // LATIN CAPITAL LETTER E WITH DOT ABOVE -+ {"edot", 0x00117}, // LATIN SMALL LETTER E WITH DOT ABOVE -+ {"eDot", 0x02251}, // GEOMETRICALLY EQUAL TO -+ {"ee", 0x02147}, // DOUBLE-STRUCK ITALIC SMALL E -+ {"EEacgr", 0x00389}, // GREEK CAPITAL LETTER ETA WITH TONOS -+ {"eeacgr", 0x003AE}, // GREEK SMALL LETTER ETA WITH TONOS -+ {"EEgr", 0x00397}, // GREEK CAPITAL LETTER ETA -+ {"eegr", 0x003B7}, // GREEK SMALL LETTER ETA -+ {"efDot", 0x02252}, // APPROXIMATELY EQUAL TO OR THE IMAGE OF -+ {"Efr", 0x1D508}, // MATHEMATICAL FRAKTUR CAPITAL E -+ {"efr", 0x1D522}, // MATHEMATICAL FRAKTUR SMALL E -+ {"eg", 0x02A9A}, // DOUBLE-LINE EQUAL TO OR GREATER-THAN -+ {"Egr", 0x00395}, // GREEK CAPITAL LETTER EPSILON -+ {"egr", 0x003B5}, // GREEK SMALL LETTER EPSILON -+ {"Egrave", 0x000C8}, // LATIN CAPITAL LETTER E WITH GRAVE -+ {"egrave", 0x000E8}, // LATIN SMALL LETTER E WITH GRAVE -+ {"egs", 0x02A96}, // SLANTED EQUAL TO OR GREATER-THAN -+ {"egsdot", 0x02A98}, // SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE -+ {"el", 0x02A99}, // DOUBLE-LINE EQUAL TO OR LESS-THAN -+ {"Element", 0x02208}, // ELEMENT OF -+ {"elinters", 0x023E7}, // ELECTRICAL INTERSECTION -+ {"ell", 0x02113}, // SCRIPT SMALL L -+ {"els", 0x02A95}, // SLANTED EQUAL TO OR LESS-THAN -+ {"elsdot", 0x02A97}, // SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE -+ {"Emacr", 0x00112}, // LATIN CAPITAL LETTER E WITH MACRON -+ {"emacr", 0x00113}, // LATIN SMALL LETTER E WITH MACRON -+ {"empty", 0x02205}, // EMPTY SET -+ {"emptyset", 0x02205}, // EMPTY SET -+ {"EmptySmallSquare", 0x025FB}, // WHITE MEDIUM SQUARE -+ {"emptyv", 0x02205}, // EMPTY SET -+ {"EmptyVerySmallSquare", 0x025AB}, // WHITE SMALL SQUARE -+ {"emsp", 0x02003}, // EM SPACE -+ {"emsp13", 0x02004}, // THREE-PER-EM SPACE -+ {"emsp14", 0x02005}, // FOUR-PER-EM SPACE -+ {"ENG", 0x0014A}, // LATIN CAPITAL LETTER ENG -+ {"eng", 0x0014B}, // LATIN SMALL LETTER ENG -+ {"ensp", 0x02002}, // EN SPACE -+ {"Eogon", 0x00118}, // LATIN CAPITAL LETTER E WITH OGONEK -+ {"eogon", 0x00119}, // LATIN SMALL LETTER E WITH OGONEK -+ {"Eopf", 0x1D53C}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL E -+ {"eopf", 0x1D556}, // MATHEMATICAL DOUBLE-STRUCK SMALL E -+ {"epar", 0x022D5}, // EQUAL AND PARALLEL TO -+ {"eparsl", 0x029E3}, // EQUALS SIGN AND SLANTED PARALLEL -+ {"eplus", 0x02A71}, // EQUALS SIGN ABOVE PLUS SIGN -+ {"epsi", 0x003B5}, // GREEK SMALL LETTER EPSILON -+ {"Epsilon", 0x00395}, // GREEK CAPITAL LETTER EPSILON -+ {"epsilon", 0x003B5}, // GREEK SMALL LETTER EPSILON -+ {"epsiv", 0x003F5}, // GREEK LUNATE EPSILON SYMBOL -+ {"eqcirc", 0x02256}, // RING IN EQUAL TO -+ {"eqcolon", 0x02255}, // EQUALS COLON -+ {"eqsim", 0x02242}, // MINUS TILDE -+ {"eqslantgtr", 0x02A96}, // SLANTED EQUAL TO OR GREATER-THAN -+ {"eqslantless", 0x02A95}, // SLANTED EQUAL TO OR LESS-THAN -+ {"Equal", 0x02A75}, // TWO CONSECUTIVE EQUALS SIGNS -+ {"equals", 0x0003D}, // EQUALS SIGN -+ {"EqualTilde", 0x02242}, // MINUS TILDE -+ {"equest", 0x0225F}, // QUESTIONED EQUAL TO -+ {"Equilibrium", 0x021CC}, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -+ {"equiv", 0x02261}, // IDENTICAL TO -+ {"equivDD", 0x02A78}, // EQUIVALENT WITH FOUR DOTS ABOVE -+ {"eqvparsl", 0x029E5}, // IDENTICAL TO AND SLANTED PARALLEL -+ {"erarr", 0x02971}, // EQUALS SIGN ABOVE RIGHTWARDS ARROW -+ {"erDot", 0x02253}, // IMAGE OF OR APPROXIMATELY EQUAL TO -+ {"escr", 0x0212F}, // SCRIPT SMALL E -+ {"Escr", 0x02130}, // SCRIPT CAPITAL E -+ {"esdot", 0x02250}, // APPROACHES THE LIMIT -+ {"esim", 0x02242}, // MINUS TILDE -+ {"Esim", 0x02A73}, // EQUALS SIGN ABOVE TILDE OPERATOR -+ {"Eta", 0x00397}, // GREEK CAPITAL LETTER ETA -+ {"eta", 0x003B7}, // GREEK SMALL LETTER ETA -+ {"ETH", 0x000D0}, // LATIN CAPITAL LETTER ETH -+ {"eth", 0x000F0}, // LATIN SMALL LETTER ETH -+ {"Euml", 0x000CB}, // LATIN CAPITAL LETTER E WITH DIAERESIS -+ {"euml", 0x000EB}, // LATIN SMALL LETTER E WITH DIAERESIS -+ {"euro", 0x020AC}, // EURO SIGN -+ {"excl", 0x00021}, // EXCLAMATION MARK -+ {"exist", 0x02203}, // THERE EXISTS -+ {"Exists", 0x02203}, // THERE EXISTS -+ {"expectation", 0x02130}, // SCRIPT CAPITAL E -+ {"exponentiale", 0x02147}, // DOUBLE-STRUCK ITALIC SMALL E -+ {"ExponentialE", 0x02147}, // DOUBLE-STRUCK ITALIC SMALL E -+ {NULL, 0} - }; - - static NameId namesF[]={ -- "fallingdotseq", 0x02252, // APPROXIMATELY EQUAL TO OR THE IMAGE OF -- "Fcy", 0x00424, // CYRILLIC CAPITAL LETTER EF -- "fcy", 0x00444, // CYRILLIC SMALL LETTER EF -- "female", 0x02640, // FEMALE SIGN -- "ffilig", 0x0FB03, // LATIN SMALL LIGATURE FFI -- "fflig", 0x0FB00, // LATIN SMALL LIGATURE FF -- "ffllig", 0x0FB04, // LATIN SMALL LIGATURE FFL -- "Ffr", 0x1D509, // MATHEMATICAL FRAKTUR CAPITAL F -- "ffr", 0x1D523, // MATHEMATICAL FRAKTUR SMALL F -- "filig", 0x0FB01, // LATIN SMALL LIGATURE FI -- "FilledSmallSquare", 0x025FC, // BLACK MEDIUM SQUARE -- "FilledVerySmallSquare", 0x025AA, // BLACK SMALL SQUARE --// "fjlig", 0x00066;0x0006A, // fj ligature -- "flat", 0x0266D, // MUSIC FLAT SIGN -- "fllig", 0x0FB02, // LATIN SMALL LIGATURE FL -- "fltns", 0x025B1, // WHITE PARALLELOGRAM -- "fnof", 0x00192, // LATIN SMALL LETTER F WITH HOOK -- "Fopf", 0x1D53D, // MATHEMATICAL DOUBLE-STRUCK CAPITAL F -- "fopf", 0x1D557, // MATHEMATICAL DOUBLE-STRUCK SMALL F -- "forall", 0x02200, // FOR ALL -- "ForAll", 0x02200, // FOR ALL -- "fork", 0x022D4, // PITCHFORK -- "forkv", 0x02AD9, // ELEMENT OF OPENING DOWNWARDS -- "Fouriertrf", 0x02131, // SCRIPT CAPITAL F -- "fpartint", 0x02A0D, // FINITE PART INTEGRAL -- "frac12", 0x000BD, // VULGAR FRACTION ONE HALF -- "frac13", 0x02153, // VULGAR FRACTION ONE THIRD -- "frac14", 0x000BC, // VULGAR FRACTION ONE QUARTER -- "frac15", 0x02155, // VULGAR FRACTION ONE FIFTH -- "frac16", 0x02159, // VULGAR FRACTION ONE SIXTH -- "frac18", 0x0215B, // VULGAR FRACTION ONE EIGHTH -- "frac23", 0x02154, // VULGAR FRACTION TWO THIRDS -- "frac25", 0x02156, // VULGAR FRACTION TWO FIFTHS -- "frac34", 0x000BE, // VULGAR FRACTION THREE QUARTERS -- "frac35", 0x02157, // VULGAR FRACTION THREE FIFTHS -- "frac38", 0x0215C, // VULGAR FRACTION THREE EIGHTHS -- "frac45", 0x02158, // VULGAR FRACTION FOUR FIFTHS -- "frac56", 0x0215A, // VULGAR FRACTION FIVE SIXTHS -- "frac58", 0x0215D, // VULGAR FRACTION FIVE EIGHTHS -- "frac78", 0x0215E, // VULGAR FRACTION SEVEN EIGHTHS -- "frasl", 0x02044, // FRACTION SLASH -- "frown", 0x02322, // FROWN -- "Fscr", 0x02131, // SCRIPT CAPITAL F -- "fscr", 0x1D4BB, // MATHEMATICAL SCRIPT SMALL F -- NULL, 0 -+ {"fallingdotseq", 0x02252}, // APPROXIMATELY EQUAL TO OR THE IMAGE OF -+ {"Fcy", 0x00424}, // CYRILLIC CAPITAL LETTER EF -+ {"fcy", 0x00444}, // CYRILLIC SMALL LETTER EF -+ {"female", 0x02640}, // FEMALE SIGN -+ {"ffilig", 0x0FB03}, // LATIN SMALL LIGATURE FFI -+ {"fflig", 0x0FB00}, // LATIN SMALL LIGATURE FF -+ {"ffllig", 0x0FB04}, // LATIN SMALL LIGATURE FFL -+ {"Ffr", 0x1D509}, // MATHEMATICAL FRAKTUR CAPITAL F -+ {"ffr", 0x1D523}, // MATHEMATICAL FRAKTUR SMALL F -+ {"filig", 0x0FB01}, // LATIN SMALL LIGATURE FI -+ {"FilledSmallSquare", 0x025FC}, // BLACK MEDIUM SQUARE -+ {"FilledVerySmallSquare", 0x025AA}, // BLACK SMALL SQUARE -+// "fjlig", 0x00066;0x0006A}, // fj ligature -+ {"flat", 0x0266D}, // MUSIC FLAT SIGN -+ {"fllig", 0x0FB02}, // LATIN SMALL LIGATURE FL -+ {"fltns", 0x025B1}, // WHITE PARALLELOGRAM -+ {"fnof", 0x00192}, // LATIN SMALL LETTER F WITH HOOK -+ {"Fopf", 0x1D53D}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL F -+ {"fopf", 0x1D557}, // MATHEMATICAL DOUBLE-STRUCK SMALL F -+ {"forall", 0x02200}, // FOR ALL -+ {"ForAll", 0x02200}, // FOR ALL -+ {"fork", 0x022D4}, // PITCHFORK -+ {"forkv", 0x02AD9}, // ELEMENT OF OPENING DOWNWARDS -+ {"Fouriertrf", 0x02131}, // SCRIPT CAPITAL F -+ {"fpartint", 0x02A0D}, // FINITE PART INTEGRAL -+ {"frac12", 0x000BD}, // VULGAR FRACTION ONE HALF -+ {"frac13", 0x02153}, // VULGAR FRACTION ONE THIRD -+ {"frac14", 0x000BC}, // VULGAR FRACTION ONE QUARTER -+ {"frac15", 0x02155}, // VULGAR FRACTION ONE FIFTH -+ {"frac16", 0x02159}, // VULGAR FRACTION ONE SIXTH -+ {"frac18", 0x0215B}, // VULGAR FRACTION ONE EIGHTH -+ {"frac23", 0x02154}, // VULGAR FRACTION TWO THIRDS -+ {"frac25", 0x02156}, // VULGAR FRACTION TWO FIFTHS -+ {"frac34", 0x000BE}, // VULGAR FRACTION THREE QUARTERS -+ {"frac35", 0x02157}, // VULGAR FRACTION THREE FIFTHS -+ {"frac38", 0x0215C}, // VULGAR FRACTION THREE EIGHTHS -+ {"frac45", 0x02158}, // VULGAR FRACTION FOUR FIFTHS -+ {"frac56", 0x0215A}, // VULGAR FRACTION FIVE SIXTHS -+ {"frac58", 0x0215D}, // VULGAR FRACTION FIVE EIGHTHS -+ {"frac78", 0x0215E}, // VULGAR FRACTION SEVEN EIGHTHS -+ {"frasl", 0x02044}, // FRACTION SLASH -+ {"frown", 0x02322}, // FROWN -+ {"Fscr", 0x02131}, // SCRIPT CAPITAL F -+ {"fscr", 0x1D4BB}, // MATHEMATICAL SCRIPT SMALL F -+ {NULL, 0} - }; - - static NameId namesG[]={ -- "gacute", 0x001F5, // LATIN SMALL LETTER G WITH ACUTE -- "Gamma", 0x00393, // GREEK CAPITAL LETTER GAMMA -- "gamma", 0x003B3, // GREEK SMALL LETTER GAMMA -- "Gammad", 0x003DC, // GREEK LETTER DIGAMMA -- "gammad", 0x003DD, // GREEK SMALL LETTER DIGAMMA -- "gap", 0x02A86, // GREATER-THAN OR APPROXIMATE -- "Gbreve", 0x0011E, // LATIN CAPITAL LETTER G WITH BREVE -- "gbreve", 0x0011F, // LATIN SMALL LETTER G WITH BREVE -- "Gcedil", 0x00122, // LATIN CAPITAL LETTER G WITH CEDILLA -- "Gcirc", 0x0011C, // LATIN CAPITAL LETTER G WITH CIRCUMFLEX -- "gcirc", 0x0011D, // LATIN SMALL LETTER G WITH CIRCUMFLEX -- "Gcy", 0x00413, // CYRILLIC CAPITAL LETTER GHE -- "gcy", 0x00433, // CYRILLIC SMALL LETTER GHE -- "Gdot", 0x00120, // LATIN CAPITAL LETTER G WITH DOT ABOVE -- "gdot", 0x00121, // LATIN SMALL LETTER G WITH DOT ABOVE -- "ge", 0x02265, // GREATER-THAN OR EQUAL TO -- "gE", 0x02267, // GREATER-THAN OVER EQUAL TO -- "gel", 0x022DB, // GREATER-THAN EQUAL TO OR LESS-THAN -- "gEl", 0x02A8C, // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN -- "geq", 0x02265, // GREATER-THAN OR EQUAL TO -- "geqq", 0x02267, // GREATER-THAN OVER EQUAL TO -- "geqslant", 0x02A7E, // GREATER-THAN OR SLANTED EQUAL TO -- "ges", 0x02A7E, // GREATER-THAN OR SLANTED EQUAL TO -- "gescc", 0x02AA9, // GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL -- "gesdot", 0x02A80, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE -- "gesdoto", 0x02A82, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE -- "gesdotol", 0x02A84, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT --// "gesl", 0x022DB;0x0FE00, // GREATER-THAN slanted EQUAL TO OR LESS-THAN -- "gesles", 0x02A94, // GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL -- "Gfr", 0x1D50A, // MATHEMATICAL FRAKTUR CAPITAL G -- "gfr", 0x1D524, // MATHEMATICAL FRAKTUR SMALL G -- "gg", 0x0226B, // MUCH GREATER-THAN -- "Gg", 0x022D9, // VERY MUCH GREATER-THAN -- "ggg", 0x022D9, // VERY MUCH GREATER-THAN -- "Ggr", 0x00393, // GREEK CAPITAL LETTER GAMMA -- "ggr", 0x003B3, // GREEK SMALL LETTER GAMMA -- "gimel", 0x02137, // GIMEL SYMBOL -- "GJcy", 0x00403, // CYRILLIC CAPITAL LETTER GJE -- "gjcy", 0x00453, // CYRILLIC SMALL LETTER GJE -- "gl", 0x02277, // GREATER-THAN OR LESS-THAN -- "gla", 0x02AA5, // GREATER-THAN BESIDE LESS-THAN -- "glE", 0x02A92, // GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL -- "glj", 0x02AA4, // GREATER-THAN OVERLAPPING LESS-THAN -- "gnap", 0x02A8A, // GREATER-THAN AND NOT APPROXIMATE -- "gnapprox", 0x02A8A, // GREATER-THAN AND NOT APPROXIMATE -- "gnE", 0x02269, // GREATER-THAN BUT NOT EQUAL TO -- "gne", 0x02A88, // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO -- "gneq", 0x02A88, // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO -- "gneqq", 0x02269, // GREATER-THAN BUT NOT EQUAL TO -- "gnsim", 0x022E7, // GREATER-THAN BUT NOT EQUIVALENT TO -- "Gopf", 0x1D53E, // MATHEMATICAL DOUBLE-STRUCK CAPITAL G -- "gopf", 0x1D558, // MATHEMATICAL DOUBLE-STRUCK SMALL G -- "grave", 0x00060, // GRAVE ACCENT -- "GreaterEqual", 0x02265, // GREATER-THAN OR EQUAL TO -- "GreaterEqualLess", 0x022DB, // GREATER-THAN EQUAL TO OR LESS-THAN -- "GreaterFullEqual", 0x02267, // GREATER-THAN OVER EQUAL TO -- "GreaterGreater", 0x02AA2, // DOUBLE NESTED GREATER-THAN -- "GreaterLess", 0x02277, // GREATER-THAN OR LESS-THAN -- "GreaterSlantEqual", 0x02A7E, // GREATER-THAN OR SLANTED EQUAL TO -- "GreaterTilde", 0x02273, // GREATER-THAN OR EQUIVALENT TO -- "gscr", 0x0210A, // SCRIPT SMALL G -- "Gscr", 0x1D4A2, // MATHEMATICAL SCRIPT CAPITAL G -- "gsim", 0x02273, // GREATER-THAN OR EQUIVALENT TO -- "gsime", 0x02A8E, // GREATER-THAN ABOVE SIMILAR OR EQUAL -- "gsiml", 0x02A90, // GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN -- "gt", 0x0003E, // GREATER-THAN SIGN -- "GT", 0x0003E, // GREATER-THAN SIGN -- "Gt", 0x0226B, // MUCH GREATER-THAN -- "gtcc", 0x02AA7, // GREATER-THAN CLOSED BY CURVE -- "gtcir", 0x02A7A, // GREATER-THAN WITH CIRCLE INSIDE -- "gtdot", 0x022D7, // GREATER-THAN WITH DOT -- "gtlPar", 0x02995, // DOUBLE LEFT ARC GREATER-THAN BRACKET -- "gtquest", 0x02A7C, // GREATER-THAN WITH QUESTION MARK ABOVE -- "gtrapprox", 0x02A86, // GREATER-THAN OR APPROXIMATE -- "gtrarr", 0x02978, // GREATER-THAN ABOVE RIGHTWARDS ARROW -- "gtrdot", 0x022D7, // GREATER-THAN WITH DOT -- "gtreqless", 0x022DB, // GREATER-THAN EQUAL TO OR LESS-THAN -- "gtreqqless", 0x02A8C, // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN -- "gtrless", 0x02277, // GREATER-THAN OR LESS-THAN -- "gtrsim", 0x02273, // GREATER-THAN OR EQUIVALENT TO --// "gvertneqq", 0x02269;0x0FE00, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke --// "gvnE", 0x02269;0x0FE00, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke -- NULL, 0 -+ {"gacute", 0x001F5}, // LATIN SMALL LETTER G WITH ACUTE -+ {"Gamma", 0x00393}, // GREEK CAPITAL LETTER GAMMA -+ {"gamma", 0x003B3}, // GREEK SMALL LETTER GAMMA -+ {"Gammad", 0x003DC}, // GREEK LETTER DIGAMMA -+ {"gammad", 0x003DD}, // GREEK SMALL LETTER DIGAMMA -+ {"gap", 0x02A86}, // GREATER-THAN OR APPROXIMATE -+ {"Gbreve", 0x0011E}, // LATIN CAPITAL LETTER G WITH BREVE -+ {"gbreve", 0x0011F}, // LATIN SMALL LETTER G WITH BREVE -+ {"Gcedil", 0x00122}, // LATIN CAPITAL LETTER G WITH CEDILLA -+ {"Gcirc", 0x0011C}, // LATIN CAPITAL LETTER G WITH CIRCUMFLEX -+ {"gcirc", 0x0011D}, // LATIN SMALL LETTER G WITH CIRCUMFLEX -+ {"Gcy", 0x00413}, // CYRILLIC CAPITAL LETTER GHE -+ {"gcy", 0x00433}, // CYRILLIC SMALL LETTER GHE -+ {"Gdot", 0x00120}, // LATIN CAPITAL LETTER G WITH DOT ABOVE -+ {"gdot", 0x00121}, // LATIN SMALL LETTER G WITH DOT ABOVE -+ {"ge", 0x02265}, // GREATER-THAN OR EQUAL TO -+ {"gE", 0x02267}, // GREATER-THAN OVER EQUAL TO -+ {"gel", 0x022DB}, // GREATER-THAN EQUAL TO OR LESS-THAN -+ {"gEl", 0x02A8C}, // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN -+ {"geq", 0x02265}, // GREATER-THAN OR EQUAL TO -+ {"geqq", 0x02267}, // GREATER-THAN OVER EQUAL TO -+ {"geqslant", 0x02A7E}, // GREATER-THAN OR SLANTED EQUAL TO -+ {"ges", 0x02A7E}, // GREATER-THAN OR SLANTED EQUAL TO -+ {"gescc", 0x02AA9}, // GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL -+ {"gesdot", 0x02A80}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE -+ {"gesdoto", 0x02A82}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE -+ {"gesdotol", 0x02A84}, // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT -+// "gesl", 0x022DB;0x0FE00}, // GREATER-THAN slanted EQUAL TO OR LESS-THAN -+ {"gesles", 0x02A94}, // GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL -+ {"Gfr", 0x1D50A}, // MATHEMATICAL FRAKTUR CAPITAL G -+ {"gfr", 0x1D524}, // MATHEMATICAL FRAKTUR SMALL G -+ {"gg", 0x0226B}, // MUCH GREATER-THAN -+ {"Gg", 0x022D9}, // VERY MUCH GREATER-THAN -+ {"ggg", 0x022D9}, // VERY MUCH GREATER-THAN -+ {"Ggr", 0x00393}, // GREEK CAPITAL LETTER GAMMA -+ {"ggr", 0x003B3}, // GREEK SMALL LETTER GAMMA -+ {"gimel", 0x02137}, // GIMEL SYMBOL -+ {"GJcy", 0x00403}, // CYRILLIC CAPITAL LETTER GJE -+ {"gjcy", 0x00453}, // CYRILLIC SMALL LETTER GJE -+ {"gl", 0x02277}, // GREATER-THAN OR LESS-THAN -+ {"gla", 0x02AA5}, // GREATER-THAN BESIDE LESS-THAN -+ {"glE", 0x02A92}, // GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL -+ {"glj", 0x02AA4}, // GREATER-THAN OVERLAPPING LESS-THAN -+ {"gnap", 0x02A8A}, // GREATER-THAN AND NOT APPROXIMATE -+ {"gnapprox", 0x02A8A}, // GREATER-THAN AND NOT APPROXIMATE -+ {"gnE", 0x02269}, // GREATER-THAN BUT NOT EQUAL TO -+ {"gne", 0x02A88}, // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO -+ {"gneq", 0x02A88}, // GREATER-THAN AND SINGLE-LINE NOT EQUAL TO -+ {"gneqq", 0x02269}, // GREATER-THAN BUT NOT EQUAL TO -+ {"gnsim", 0x022E7}, // GREATER-THAN BUT NOT EQUIVALENT TO -+ {"Gopf", 0x1D53E}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL G -+ {"gopf", 0x1D558}, // MATHEMATICAL DOUBLE-STRUCK SMALL G -+ {"grave", 0x00060}, // GRAVE ACCENT -+ {"GreaterEqual", 0x02265}, // GREATER-THAN OR EQUAL TO -+ {"GreaterEqualLess", 0x022DB}, // GREATER-THAN EQUAL TO OR LESS-THAN -+ {"GreaterFullEqual", 0x02267}, // GREATER-THAN OVER EQUAL TO -+ {"GreaterGreater", 0x02AA2}, // DOUBLE NESTED GREATER-THAN -+ {"GreaterLess", 0x02277}, // GREATER-THAN OR LESS-THAN -+ {"GreaterSlantEqual", 0x02A7E}, // GREATER-THAN OR SLANTED EQUAL TO -+ {"GreaterTilde", 0x02273}, // GREATER-THAN OR EQUIVALENT TO -+ {"gscr", 0x0210A}, // SCRIPT SMALL G -+ {"Gscr", 0x1D4A2}, // MATHEMATICAL SCRIPT CAPITAL G -+ {"gsim", 0x02273}, // GREATER-THAN OR EQUIVALENT TO -+ {"gsime", 0x02A8E}, // GREATER-THAN ABOVE SIMILAR OR EQUAL -+ {"gsiml", 0x02A90}, // GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN -+ {"gt", 0x0003E}, // GREATER-THAN SIGN -+ {"GT", 0x0003E}, // GREATER-THAN SIGN -+ {"Gt", 0x0226B}, // MUCH GREATER-THAN -+ {"gtcc", 0x02AA7}, // GREATER-THAN CLOSED BY CURVE -+ {"gtcir", 0x02A7A}, // GREATER-THAN WITH CIRCLE INSIDE -+ {"gtdot", 0x022D7}, // GREATER-THAN WITH DOT -+ {"gtlPar", 0x02995}, // DOUBLE LEFT ARC GREATER-THAN BRACKET -+ {"gtquest", 0x02A7C}, // GREATER-THAN WITH QUESTION MARK ABOVE -+ {"gtrapprox", 0x02A86}, // GREATER-THAN OR APPROXIMATE -+ {"gtrarr", 0x02978}, // GREATER-THAN ABOVE RIGHTWARDS ARROW -+ {"gtrdot", 0x022D7}, // GREATER-THAN WITH DOT -+ {"gtreqless", 0x022DB}, // GREATER-THAN EQUAL TO OR LESS-THAN -+ {"gtreqqless", 0x02A8C}, // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN -+ {"gtrless", 0x02277}, // GREATER-THAN OR LESS-THAN -+ {"gtrsim", 0x02273}, // GREATER-THAN OR EQUIVALENT TO -+// "gvertneqq", 0x02269;0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke -+// "gvnE", 0x02269;0x0FE00}, // GREATER-THAN BUT NOT EQUAL TO - with vertical stroke -+ {NULL, 0} - }; - - static NameId namesH[]={ -- "Hacek", 0x002C7, // CARON -- "hairsp", 0x0200A, // HAIR SPACE -- "half", 0x000BD, // VULGAR FRACTION ONE HALF -- "hamilt", 0x0210B, // SCRIPT CAPITAL H -- "HARDcy", 0x0042A, // CYRILLIC CAPITAL LETTER HARD SIGN -- "hardcy", 0x0044A, // CYRILLIC SMALL LETTER HARD SIGN -- "harr", 0x02194, // LEFT RIGHT ARROW -- "hArr", 0x021D4, // LEFT RIGHT DOUBLE ARROW -- "harrcir", 0x02948, // LEFT RIGHT ARROW THROUGH SMALL CIRCLE -- "harrw", 0x021AD, // LEFT RIGHT WAVE ARROW -- "Hat", 0x0005E, // CIRCUMFLEX ACCENT -- "hbar", 0x0210F, // PLANCK CONSTANT OVER TWO PI -- "Hcirc", 0x00124, // LATIN CAPITAL LETTER H WITH CIRCUMFLEX -- "hcirc", 0x00125, // LATIN SMALL LETTER H WITH CIRCUMFLEX -- "hearts", 0x02665, // BLACK HEART SUIT -- "heartsuit", 0x02665, // BLACK HEART SUIT -- "hellip", 0x02026, // HORIZONTAL ELLIPSIS -- "hercon", 0x022B9, // HERMITIAN CONJUGATE MATRIX -- "Hfr", 0x0210C, // BLACK-LETTER CAPITAL H -- "hfr", 0x1D525, // MATHEMATICAL FRAKTUR SMALL H -- "HilbertSpace", 0x0210B, // SCRIPT CAPITAL H -- "hksearow", 0x02925, // SOUTH EAST ARROW WITH HOOK -- "hkswarow", 0x02926, // SOUTH WEST ARROW WITH HOOK -- "hoarr", 0x021FF, // LEFT RIGHT OPEN-HEADED ARROW -- "homtht", 0x0223B, // HOMOTHETIC -- "hookleftarrow", 0x021A9, // LEFTWARDS ARROW WITH HOOK -- "hookrightarrow", 0x021AA, // RIGHTWARDS ARROW WITH HOOK -- "Hopf", 0x0210D, // DOUBLE-STRUCK CAPITAL H -- "hopf", 0x1D559, // MATHEMATICAL DOUBLE-STRUCK SMALL H -- "horbar", 0x02015, // HORIZONTAL BAR -- "HorizontalLine", 0x02500, // BOX DRAWINGS LIGHT HORIZONTAL -- "Hscr", 0x0210B, // SCRIPT CAPITAL H -- "hscr", 0x1D4BD, // MATHEMATICAL SCRIPT SMALL H -- "hslash", 0x0210F, // PLANCK CONSTANT OVER TWO PI -- "Hstrok", 0x00126, // LATIN CAPITAL LETTER H WITH STROKE -- "hstrok", 0x00127, // LATIN SMALL LETTER H WITH STROKE -- "HumpDownHump", 0x0224E, // GEOMETRICALLY EQUIVALENT TO -- "HumpEqual", 0x0224F, // DIFFERENCE BETWEEN -- "hybull", 0x02043, // HYPHEN BULLET -- "hyphen", 0x02010, // HYPHEN -- NULL, 0 -+ {"Hacek", 0x002C7}, // CARON -+ {"hairsp", 0x0200A}, // HAIR SPACE -+ {"half", 0x000BD}, // VULGAR FRACTION ONE HALF -+ {"hamilt", 0x0210B}, // SCRIPT CAPITAL H -+ {"HARDcy", 0x0042A}, // CYRILLIC CAPITAL LETTER HARD SIGN -+ {"hardcy", 0x0044A}, // CYRILLIC SMALL LETTER HARD SIGN -+ {"harr", 0x02194}, // LEFT RIGHT ARROW -+ {"hArr", 0x021D4}, // LEFT RIGHT DOUBLE ARROW -+ {"harrcir", 0x02948}, // LEFT RIGHT ARROW THROUGH SMALL CIRCLE -+ {"harrw", 0x021AD}, // LEFT RIGHT WAVE ARROW -+ {"Hat", 0x0005E}, // CIRCUMFLEX ACCENT -+ {"hbar", 0x0210F}, // PLANCK CONSTANT OVER TWO PI -+ {"Hcirc", 0x00124}, // LATIN CAPITAL LETTER H WITH CIRCUMFLEX -+ {"hcirc", 0x00125}, // LATIN SMALL LETTER H WITH CIRCUMFLEX -+ {"hearts", 0x02665}, // BLACK HEART SUIT -+ {"heartsuit", 0x02665}, // BLACK HEART SUIT -+ {"hellip", 0x02026}, // HORIZONTAL ELLIPSIS -+ {"hercon", 0x022B9}, // HERMITIAN CONJUGATE MATRIX -+ {"Hfr", 0x0210C}, // BLACK-LETTER CAPITAL H -+ {"hfr", 0x1D525}, // MATHEMATICAL FRAKTUR SMALL H -+ {"HilbertSpace", 0x0210B}, // SCRIPT CAPITAL H -+ {"hksearow", 0x02925}, // SOUTH EAST ARROW WITH HOOK -+ {"hkswarow", 0x02926}, // SOUTH WEST ARROW WITH HOOK -+ {"hoarr", 0x021FF}, // LEFT RIGHT OPEN-HEADED ARROW -+ {"homtht", 0x0223B}, // HOMOTHETIC -+ {"hookleftarrow", 0x021A9}, // LEFTWARDS ARROW WITH HOOK -+ {"hookrightarrow", 0x021AA}, // RIGHTWARDS ARROW WITH HOOK -+ {"Hopf", 0x0210D}, // DOUBLE-STRUCK CAPITAL H -+ {"hopf", 0x1D559}, // MATHEMATICAL DOUBLE-STRUCK SMALL H -+ {"horbar", 0x02015}, // HORIZONTAL BAR -+ {"HorizontalLine", 0x02500}, // BOX DRAWINGS LIGHT HORIZONTAL -+ {"Hscr", 0x0210B}, // SCRIPT CAPITAL H -+ {"hscr", 0x1D4BD}, // MATHEMATICAL SCRIPT SMALL H -+ {"hslash", 0x0210F}, // PLANCK CONSTANT OVER TWO PI -+ {"Hstrok", 0x00126}, // LATIN CAPITAL LETTER H WITH STROKE -+ {"hstrok", 0x00127}, // LATIN SMALL LETTER H WITH STROKE -+ {"HumpDownHump", 0x0224E}, // GEOMETRICALLY EQUIVALENT TO -+ {"HumpEqual", 0x0224F}, // DIFFERENCE BETWEEN -+ {"hybull", 0x02043}, // HYPHEN BULLET -+ {"hyphen", 0x02010}, // HYPHEN -+ {NULL, 0} - }; - - static NameId namesI[]={ -- "Iacgr", 0x0038A, // GREEK CAPITAL LETTER IOTA WITH TONOS -- "iacgr", 0x003AF, // GREEK SMALL LETTER IOTA WITH TONOS -- "Iacute", 0x000CD, // LATIN CAPITAL LETTER I WITH ACUTE -- "iacute", 0x000ED, // LATIN SMALL LETTER I WITH ACUTE -- "ic", 0x02063, // INVISIBLE SEPARATOR -- "Icirc", 0x000CE, // LATIN CAPITAL LETTER I WITH CIRCUMFLEX -- "icirc", 0x000EE, // LATIN SMALL LETTER I WITH CIRCUMFLEX -- "Icy", 0x00418, // CYRILLIC CAPITAL LETTER I -- "icy", 0x00438, // CYRILLIC SMALL LETTER I -- "idiagr", 0x00390, // GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS -- "Idigr", 0x003AA, // GREEK CAPITAL LETTER IOTA WITH DIALYTIKA -- "idigr", 0x003CA, // GREEK SMALL LETTER IOTA WITH DIALYTIKA -- "Idot", 0x00130, // LATIN CAPITAL LETTER I WITH DOT ABOVE -- "IEcy", 0x00415, // CYRILLIC CAPITAL LETTER IE -- "iecy", 0x00435, // CYRILLIC SMALL LETTER IE -- "iexcl", 0x000A1, // INVERTED EXCLAMATION MARK -- "iff", 0x021D4, // LEFT RIGHT DOUBLE ARROW -- "Ifr", 0x02111, // BLACK-LETTER CAPITAL I -- "ifr", 0x1D526, // MATHEMATICAL FRAKTUR SMALL I -- "Igr", 0x00399, // GREEK CAPITAL LETTER IOTA -- "igr", 0x003B9, // GREEK SMALL LETTER IOTA -- "Igrave", 0x000CC, // LATIN CAPITAL LETTER I WITH GRAVE -- "igrave", 0x000EC, // LATIN SMALL LETTER I WITH GRAVE -- "ii", 0x02148, // DOUBLE-STRUCK ITALIC SMALL I -- "iiiint", 0x02A0C, // QUADRUPLE INTEGRAL OPERATOR -- "iiint", 0x0222D, // TRIPLE INTEGRAL -- "iinfin", 0x029DC, // INCOMPLETE INFINITY -- "iiota", 0x02129, // TURNED GREEK SMALL LETTER IOTA -- "IJlig", 0x00132, // LATIN CAPITAL LIGATURE IJ -- "ijlig", 0x00133, // LATIN SMALL LIGATURE IJ -- "Im", 0x02111, // BLACK-LETTER CAPITAL I -- "Imacr", 0x0012A, // LATIN CAPITAL LETTER I WITH MACRON -- "imacr", 0x0012B, // LATIN SMALL LETTER I WITH MACRON -- "image", 0x02111, // BLACK-LETTER CAPITAL I -- "ImaginaryI", 0x02148, // DOUBLE-STRUCK ITALIC SMALL I -- "imagline", 0x02110, // SCRIPT CAPITAL I -- "imagpart", 0x02111, // BLACK-LETTER CAPITAL I -- "imath", 0x00131, // LATIN SMALL LETTER DOTLESS I -- "imof", 0x022B7, // IMAGE OF -- "imped", 0x001B5, // LATIN CAPITAL LETTER Z WITH STROKE -- "Implies", 0x021D2, // RIGHTWARDS DOUBLE ARROW -- "in", 0x02208, // ELEMENT OF -- "incare", 0x02105, // CARE OF -- "infin", 0x0221E, // INFINITY -- "infintie", 0x029DD, // TIE OVER INFINITY -- "inodot", 0x00131, // LATIN SMALL LETTER DOTLESS I -- "int", 0x0222B, // INTEGRAL -- "Int", 0x0222C, // DOUBLE INTEGRAL -- "intcal", 0x022BA, // INTERCALATE -- "integers", 0x02124, // DOUBLE-STRUCK CAPITAL Z -- "Integral", 0x0222B, // INTEGRAL -- "intercal", 0x022BA, // INTERCALATE -- "Intersection", 0x022C2, // N-ARY INTERSECTION -- "intlarhk", 0x02A17, // INTEGRAL WITH LEFTWARDS ARROW WITH HOOK -- "intprod", 0x02A3C, // INTERIOR PRODUCT -- "InvisibleComma", 0x02063, // INVISIBLE SEPARATOR -- "InvisibleTimes", 0x02062, // INVISIBLE TIMES -- "IOcy", 0x00401, // CYRILLIC CAPITAL LETTER IO -- "iocy", 0x00451, // CYRILLIC SMALL LETTER IO -- "Iogon", 0x0012E, // LATIN CAPITAL LETTER I WITH OGONEK -- "iogon", 0x0012F, // LATIN SMALL LETTER I WITH OGONEK -- "Iopf", 0x1D540, // MATHEMATICAL DOUBLE-STRUCK CAPITAL I -- "iopf", 0x1D55A, // MATHEMATICAL DOUBLE-STRUCK SMALL I -- "Iota", 0x00399, // GREEK CAPITAL LETTER IOTA -- "iota", 0x003B9, // GREEK SMALL LETTER IOTA -- "iprod", 0x02A3C, // INTERIOR PRODUCT -- "iquest", 0x000BF, // INVERTED QUESTION MARK -- "Iscr", 0x02110, // SCRIPT CAPITAL I -- "iscr", 0x1D4BE, // MATHEMATICAL SCRIPT SMALL I -- "isin", 0x02208, // ELEMENT OF -- "isindot", 0x022F5, // ELEMENT OF WITH DOT ABOVE -- "isinE", 0x022F9, // ELEMENT OF WITH TWO HORIZONTAL STROKES -- "isins", 0x022F4, // SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -- "isinsv", 0x022F3, // ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -- "isinv", 0x02208, // ELEMENT OF -- "it", 0x02062, // INVISIBLE TIMES -- "Itilde", 0x00128, // LATIN CAPITAL LETTER I WITH TILDE -- "itilde", 0x00129, // LATIN SMALL LETTER I WITH TILDE -- "Iukcy", 0x00406, // CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I -- "iukcy", 0x00456, // CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -- "Iuml", 0x000CF, // LATIN CAPITAL LETTER I WITH DIAERESIS -- "iuml", 0x000EF, // LATIN SMALL LETTER I WITH DIAERESIS -- NULL, 0 -+ {"Iacgr", 0x0038A}, // GREEK CAPITAL LETTER IOTA WITH TONOS -+ {"iacgr", 0x003AF}, // GREEK SMALL LETTER IOTA WITH TONOS -+ {"Iacute", 0x000CD}, // LATIN CAPITAL LETTER I WITH ACUTE -+ {"iacute", 0x000ED}, // LATIN SMALL LETTER I WITH ACUTE -+ {"ic", 0x02063}, // INVISIBLE SEPARATOR -+ {"Icirc", 0x000CE}, // LATIN CAPITAL LETTER I WITH CIRCUMFLEX -+ {"icirc", 0x000EE}, // LATIN SMALL LETTER I WITH CIRCUMFLEX -+ {"Icy", 0x00418}, // CYRILLIC CAPITAL LETTER I -+ {"icy", 0x00438}, // CYRILLIC SMALL LETTER I -+ {"idiagr", 0x00390}, // GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS -+ {"Idigr", 0x003AA}, // GREEK CAPITAL LETTER IOTA WITH DIALYTIKA -+ {"idigr", 0x003CA}, // GREEK SMALL LETTER IOTA WITH DIALYTIKA -+ {"Idot", 0x00130}, // LATIN CAPITAL LETTER I WITH DOT ABOVE -+ {"IEcy", 0x00415}, // CYRILLIC CAPITAL LETTER IE -+ {"iecy", 0x00435}, // CYRILLIC SMALL LETTER IE -+ {"iexcl", 0x000A1}, // INVERTED EXCLAMATION MARK -+ {"iff", 0x021D4}, // LEFT RIGHT DOUBLE ARROW -+ {"Ifr", 0x02111}, // BLACK-LETTER CAPITAL I -+ {"ifr", 0x1D526}, // MATHEMATICAL FRAKTUR SMALL I -+ {"Igr", 0x00399}, // GREEK CAPITAL LETTER IOTA -+ {"igr", 0x003B9}, // GREEK SMALL LETTER IOTA -+ {"Igrave", 0x000CC}, // LATIN CAPITAL LETTER I WITH GRAVE -+ {"igrave", 0x000EC}, // LATIN SMALL LETTER I WITH GRAVE -+ {"ii", 0x02148}, // DOUBLE-STRUCK ITALIC SMALL I -+ {"iiiint", 0x02A0C}, // QUADRUPLE INTEGRAL OPERATOR -+ {"iiint", 0x0222D}, // TRIPLE INTEGRAL -+ {"iinfin", 0x029DC}, // INCOMPLETE INFINITY -+ {"iiota", 0x02129}, // TURNED GREEK SMALL LETTER IOTA -+ {"IJlig", 0x00132}, // LATIN CAPITAL LIGATURE IJ -+ {"ijlig", 0x00133}, // LATIN SMALL LIGATURE IJ -+ {"Im", 0x02111}, // BLACK-LETTER CAPITAL I -+ {"Imacr", 0x0012A}, // LATIN CAPITAL LETTER I WITH MACRON -+ {"imacr", 0x0012B}, // LATIN SMALL LETTER I WITH MACRON -+ {"image", 0x02111}, // BLACK-LETTER CAPITAL I -+ {"ImaginaryI", 0x02148}, // DOUBLE-STRUCK ITALIC SMALL I -+ {"imagline", 0x02110}, // SCRIPT CAPITAL I -+ {"imagpart", 0x02111}, // BLACK-LETTER CAPITAL I -+ {"imath", 0x00131}, // LATIN SMALL LETTER DOTLESS I -+ {"imof", 0x022B7}, // IMAGE OF -+ {"imped", 0x001B5}, // LATIN CAPITAL LETTER Z WITH STROKE -+ {"Implies", 0x021D2}, // RIGHTWARDS DOUBLE ARROW -+ {"in", 0x02208}, // ELEMENT OF -+ {"incare", 0x02105}, // CARE OF -+ {"infin", 0x0221E}, // INFINITY -+ {"infintie", 0x029DD}, // TIE OVER INFINITY -+ {"inodot", 0x00131}, // LATIN SMALL LETTER DOTLESS I -+ {"int", 0x0222B}, // INTEGRAL -+ {"Int", 0x0222C}, // DOUBLE INTEGRAL -+ {"intcal", 0x022BA}, // INTERCALATE -+ {"integers", 0x02124}, // DOUBLE-STRUCK CAPITAL Z -+ {"Integral", 0x0222B}, // INTEGRAL -+ {"intercal", 0x022BA}, // INTERCALATE -+ {"Intersection", 0x022C2}, // N-ARY INTERSECTION -+ {"intlarhk", 0x02A17}, // INTEGRAL WITH LEFTWARDS ARROW WITH HOOK -+ {"intprod", 0x02A3C}, // INTERIOR PRODUCT -+ {"InvisibleComma", 0x02063}, // INVISIBLE SEPARATOR -+ {"InvisibleTimes", 0x02062}, // INVISIBLE TIMES -+ {"IOcy", 0x00401}, // CYRILLIC CAPITAL LETTER IO -+ {"iocy", 0x00451}, // CYRILLIC SMALL LETTER IO -+ {"Iogon", 0x0012E}, // LATIN CAPITAL LETTER I WITH OGONEK -+ {"iogon", 0x0012F}, // LATIN SMALL LETTER I WITH OGONEK -+ {"Iopf", 0x1D540}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL I -+ {"iopf", 0x1D55A}, // MATHEMATICAL DOUBLE-STRUCK SMALL I -+ {"Iota", 0x00399}, // GREEK CAPITAL LETTER IOTA -+ {"iota", 0x003B9}, // GREEK SMALL LETTER IOTA -+ {"iprod", 0x02A3C}, // INTERIOR PRODUCT -+ {"iquest", 0x000BF}, // INVERTED QUESTION MARK -+ {"Iscr", 0x02110}, // SCRIPT CAPITAL I -+ {"iscr", 0x1D4BE}, // MATHEMATICAL SCRIPT SMALL I -+ {"isin", 0x02208}, // ELEMENT OF -+ {"isindot", 0x022F5}, // ELEMENT OF WITH DOT ABOVE -+ {"isinE", 0x022F9}, // ELEMENT OF WITH TWO HORIZONTAL STROKES -+ {"isins", 0x022F4}, // SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -+ {"isinsv", 0x022F3}, // ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -+ {"isinv", 0x02208}, // ELEMENT OF -+ {"it", 0x02062}, // INVISIBLE TIMES -+ {"Itilde", 0x00128}, // LATIN CAPITAL LETTER I WITH TILDE -+ {"itilde", 0x00129}, // LATIN SMALL LETTER I WITH TILDE -+ {"Iukcy", 0x00406}, // CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I -+ {"iukcy", 0x00456}, // CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -+ {"Iuml", 0x000CF}, // LATIN CAPITAL LETTER I WITH DIAERESIS -+ {"iuml", 0x000EF}, // LATIN SMALL LETTER I WITH DIAERESIS -+ {NULL, 0} - }; - - static NameId namesJ[]={ -- "Jcirc", 0x00134, // LATIN CAPITAL LETTER J WITH CIRCUMFLEX -- "jcirc", 0x00135, // LATIN SMALL LETTER J WITH CIRCUMFLEX -- "Jcy", 0x00419, // CYRILLIC CAPITAL LETTER SHORT I -- "jcy", 0x00439, // CYRILLIC SMALL LETTER SHORT I -- "Jfr", 0x1D50D, // MATHEMATICAL FRAKTUR CAPITAL J -- "jfr", 0x1D527, // MATHEMATICAL FRAKTUR SMALL J -- "jmath", 0x00237, // LATIN SMALL LETTER DOTLESS J -- "Jopf", 0x1D541, // MATHEMATICAL DOUBLE-STRUCK CAPITAL J -- "jopf", 0x1D55B, // MATHEMATICAL DOUBLE-STRUCK SMALL J -- "Jscr", 0x1D4A5, // MATHEMATICAL SCRIPT CAPITAL J -- "jscr", 0x1D4BF, // MATHEMATICAL SCRIPT SMALL J -- "Jsercy", 0x00408, // CYRILLIC CAPITAL LETTER JE -- "jsercy", 0x00458, // CYRILLIC SMALL LETTER JE -- "Jukcy", 0x00404, // CYRILLIC CAPITAL LETTER UKRAINIAN IE -- "jukcy", 0x00454, // CYRILLIC SMALL LETTER UKRAINIAN IE -- NULL, 0 -+ {"Jcirc", 0x00134}, // LATIN CAPITAL LETTER J WITH CIRCUMFLEX -+ {"jcirc", 0x00135}, // LATIN SMALL LETTER J WITH CIRCUMFLEX -+ {"Jcy", 0x00419}, // CYRILLIC CAPITAL LETTER SHORT I -+ {"jcy", 0x00439}, // CYRILLIC SMALL LETTER SHORT I -+ {"Jfr", 0x1D50D}, // MATHEMATICAL FRAKTUR CAPITAL J -+ {"jfr", 0x1D527}, // MATHEMATICAL FRAKTUR SMALL J -+ {"jmath", 0x00237}, // LATIN SMALL LETTER DOTLESS J -+ {"Jopf", 0x1D541}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL J -+ {"jopf", 0x1D55B}, // MATHEMATICAL DOUBLE-STRUCK SMALL J -+ {"Jscr", 0x1D4A5}, // MATHEMATICAL SCRIPT CAPITAL J -+ {"jscr", 0x1D4BF}, // MATHEMATICAL SCRIPT SMALL J -+ {"Jsercy", 0x00408}, // CYRILLIC CAPITAL LETTER JE -+ {"jsercy", 0x00458}, // CYRILLIC SMALL LETTER JE -+ {"Jukcy", 0x00404}, // CYRILLIC CAPITAL LETTER UKRAINIAN IE -+ {"jukcy", 0x00454}, // CYRILLIC SMALL LETTER UKRAINIAN IE -+ {NULL, 0} - }; - - static NameId namesK[]={ -- "Kappa", 0x0039A, // GREEK CAPITAL LETTER KAPPA -- "kappa", 0x003BA, // GREEK SMALL LETTER KAPPA -- "kappav", 0x003F0, // GREEK KAPPA SYMBOL -- "Kcedil", 0x00136, // LATIN CAPITAL LETTER K WITH CEDILLA -- "kcedil", 0x00137, // LATIN SMALL LETTER K WITH CEDILLA -- "Kcy", 0x0041A, // CYRILLIC CAPITAL LETTER KA -- "kcy", 0x0043A, // CYRILLIC SMALL LETTER KA -- "Kfr", 0x1D50E, // MATHEMATICAL FRAKTUR CAPITAL K -- "kfr", 0x1D528, // MATHEMATICAL FRAKTUR SMALL K -- "Kgr", 0x0039A, // GREEK CAPITAL LETTER KAPPA -- "kgr", 0x003BA, // GREEK SMALL LETTER KAPPA -- "kgreen", 0x00138, // LATIN SMALL LETTER KRA -- "KHcy", 0x00425, // CYRILLIC CAPITAL LETTER HA -- "khcy", 0x00445, // CYRILLIC SMALL LETTER HA -- "KHgr", 0x003A7, // GREEK CAPITAL LETTER CHI -- "khgr", 0x003C7, // GREEK SMALL LETTER CHI -- "KJcy", 0x0040C, // CYRILLIC CAPITAL LETTER KJE -- "kjcy", 0x0045C, // CYRILLIC SMALL LETTER KJE -- "Kopf", 0x1D542, // MATHEMATICAL DOUBLE-STRUCK CAPITAL K -- "kopf", 0x1D55C, // MATHEMATICAL DOUBLE-STRUCK SMALL K -- "Kscr", 0x1D4A6, // MATHEMATICAL SCRIPT CAPITAL K -- "kscr", 0x1D4C0, // MATHEMATICAL SCRIPT SMALL K -- NULL, 0 -+ {"Kappa", 0x0039A}, // GREEK CAPITAL LETTER KAPPA -+ {"kappa", 0x003BA}, // GREEK SMALL LETTER KAPPA -+ {"kappav", 0x003F0}, // GREEK KAPPA SYMBOL -+ {"Kcedil", 0x00136}, // LATIN CAPITAL LETTER K WITH CEDILLA -+ {"kcedil", 0x00137}, // LATIN SMALL LETTER K WITH CEDILLA -+ {"Kcy", 0x0041A}, // CYRILLIC CAPITAL LETTER KA -+ {"kcy", 0x0043A}, // CYRILLIC SMALL LETTER KA -+ {"Kfr", 0x1D50E}, // MATHEMATICAL FRAKTUR CAPITAL K -+ {"kfr", 0x1D528}, // MATHEMATICAL FRAKTUR SMALL K -+ {"Kgr", 0x0039A}, // GREEK CAPITAL LETTER KAPPA -+ {"kgr", 0x003BA}, // GREEK SMALL LETTER KAPPA -+ {"kgreen", 0x00138}, // LATIN SMALL LETTER KRA -+ {"KHcy", 0x00425}, // CYRILLIC CAPITAL LETTER HA -+ {"khcy", 0x00445}, // CYRILLIC SMALL LETTER HA -+ {"KHgr", 0x003A7}, // GREEK CAPITAL LETTER CHI -+ {"khgr", 0x003C7}, // GREEK SMALL LETTER CHI -+ {"KJcy", 0x0040C}, // CYRILLIC CAPITAL LETTER KJE -+ {"kjcy", 0x0045C}, // CYRILLIC SMALL LETTER KJE -+ {"Kopf", 0x1D542}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL K -+ {"kopf", 0x1D55C}, // MATHEMATICAL DOUBLE-STRUCK SMALL K -+ {"Kscr", 0x1D4A6}, // MATHEMATICAL SCRIPT CAPITAL K -+ {"kscr", 0x1D4C0}, // MATHEMATICAL SCRIPT SMALL K -+ {NULL, 0} - }; - - static NameId namesL[]={ -- "lAarr", 0x021DA, // LEFTWARDS TRIPLE ARROW -- "Lacute", 0x00139, // LATIN CAPITAL LETTER L WITH ACUTE -- "lacute", 0x0013A, // LATIN SMALL LETTER L WITH ACUTE -- "laemptyv", 0x029B4, // EMPTY SET WITH LEFT ARROW ABOVE -- "lagran", 0x02112, // SCRIPT CAPITAL L -- "Lambda", 0x0039B, // GREEK CAPITAL LETTER LAMDA -- "lambda", 0x003BB, // GREEK SMALL LETTER LAMDA -- "lang", 0x027E8, // MATHEMATICAL LEFT ANGLE BRACKET -- "Lang", 0x027EA, // MATHEMATICAL LEFT DOUBLE ANGLE BRACKET -- "langd", 0x02991, // LEFT ANGLE BRACKET WITH DOT -- "langle", 0x027E8, // MATHEMATICAL LEFT ANGLE BRACKET -- "lap", 0x02A85, // LESS-THAN OR APPROXIMATE -- "Laplacetrf", 0x02112, // SCRIPT CAPITAL L -- "laquo", 0x000AB, // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -- "larr", 0x02190, // LEFTWARDS ARROW -- "Larr", 0x0219E, // LEFTWARDS TWO HEADED ARROW -- "lArr", 0x021D0, // LEFTWARDS DOUBLE ARROW -- "larrb", 0x021E4, // LEFTWARDS ARROW TO BAR -- "larrbfs", 0x0291F, // LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND -- "larrfs", 0x0291D, // LEFTWARDS ARROW TO BLACK DIAMOND -- "larrhk", 0x021A9, // LEFTWARDS ARROW WITH HOOK -- "larrlp", 0x021AB, // LEFTWARDS ARROW WITH LOOP -- "larrpl", 0x02939, // LEFT-SIDE ARC ANTICLOCKWISE ARROW -- "larrsim", 0x02973, // LEFTWARDS ARROW ABOVE TILDE OPERATOR -- "larrtl", 0x021A2, // LEFTWARDS ARROW WITH TAIL -- "lat", 0x02AAB, // LARGER THAN -- "latail", 0x02919, // LEFTWARDS ARROW-TAIL -- "lAtail", 0x0291B, // LEFTWARDS DOUBLE ARROW-TAIL -- "late", 0x02AAD, // LARGER THAN OR EQUAL TO --// "lates", 0x02AAD;0x0FE00, // LARGER THAN OR slanted EQUAL -- "lbarr", 0x0290C, // LEFTWARDS DOUBLE DASH ARROW -- "lBarr", 0x0290E, // LEFTWARDS TRIPLE DASH ARROW -- "lbbrk", 0x02772, // LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT -- "lbrace", 0x0007B, // LEFT CURLY BRACKET -- "lbrack", 0x0005B, // LEFT SQUARE BRACKET -- "lbrke", 0x0298B, // LEFT SQUARE BRACKET WITH UNDERBAR -- "lbrksld", 0x0298F, // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER -- "lbrkslu", 0x0298D, // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER -- "Lcaron", 0x0013D, // LATIN CAPITAL LETTER L WITH CARON -- "lcaron", 0x0013E, // LATIN SMALL LETTER L WITH CARON -- "Lcedil", 0x0013B, // LATIN CAPITAL LETTER L WITH CEDILLA -- "lcedil", 0x0013C, // LATIN SMALL LETTER L WITH CEDILLA -- "lceil", 0x02308, // LEFT CEILING -- "lcub", 0x0007B, // LEFT CURLY BRACKET -- "Lcy", 0x0041B, // CYRILLIC CAPITAL LETTER EL -- "lcy", 0x0043B, // CYRILLIC SMALL LETTER EL -- "ldca", 0x02936, // ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS -- "ldquo", 0x0201C, // LEFT DOUBLE QUOTATION MARK -- "ldquor", 0x0201E, // DOUBLE LOW-9 QUOTATION MARK -- "ldrdhar", 0x02967, // LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN -- "ldrushar", 0x0294B, // LEFT BARB DOWN RIGHT BARB UP HARPOON -- "ldsh", 0x021B2, // DOWNWARDS ARROW WITH TIP LEFTWARDS -- "le", 0x02264, // LESS-THAN OR EQUAL TO -- "lE", 0x02266, // LESS-THAN OVER EQUAL TO -- "LeftAngleBracket", 0x027E8, // MATHEMATICAL LEFT ANGLE BRACKET -- "leftarrow", 0x02190, // LEFTWARDS ARROW -- "LeftArrow", 0x02190, // LEFTWARDS ARROW -- "Leftarrow", 0x021D0, // LEFTWARDS DOUBLE ARROW -- "LeftArrowBar", 0x021E4, // LEFTWARDS ARROW TO BAR -- "LeftArrowRightArrow", 0x021C6, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -- "leftarrowtail", 0x021A2, // LEFTWARDS ARROW WITH TAIL -- "LeftCeiling", 0x02308, // LEFT CEILING -- "LeftDoubleBracket", 0x027E6, // MATHEMATICAL LEFT WHITE SQUARE BRACKET -- "LeftDownTeeVector", 0x02961, // DOWNWARDS HARPOON WITH BARB LEFT FROM BAR -- "LeftDownVector", 0x021C3, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -- "LeftDownVectorBar", 0x02959, // DOWNWARDS HARPOON WITH BARB LEFT TO BAR -- "LeftFloor", 0x0230A, // LEFT FLOOR -- "leftharpoondown", 0x021BD, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -- "leftharpoonup", 0x021BC, // LEFTWARDS HARPOON WITH BARB UPWARDS -- "leftleftarrows", 0x021C7, // LEFTWARDS PAIRED ARROWS -- "leftrightarrow", 0x02194, // LEFT RIGHT ARROW -- "LeftRightArrow", 0x02194, // LEFT RIGHT ARROW -- "Leftrightarrow", 0x021D4, // LEFT RIGHT DOUBLE ARROW -- "leftrightarrows", 0x021C6, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -- "leftrightharpoons", 0x021CB, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -- "leftrightsquigarrow", 0x021AD, // LEFT RIGHT WAVE ARROW -- "LeftRightVector", 0x0294E, // LEFT BARB UP RIGHT BARB UP HARPOON -- "LeftTee", 0x022A3, // LEFT TACK -- "LeftTeeArrow", 0x021A4, // LEFTWARDS ARROW FROM BAR -- "LeftTeeVector", 0x0295A, // LEFTWARDS HARPOON WITH BARB UP FROM BAR -- "leftthreetimes", 0x022CB, // LEFT SEMIDIRECT PRODUCT -- "LeftTriangle", 0x022B2, // NORMAL SUBGROUP OF -- "LeftTriangleBar", 0x029CF, // LEFT TRIANGLE BESIDE VERTICAL BAR -- "LeftTriangleEqual", 0x022B4, // NORMAL SUBGROUP OF OR EQUAL TO -- "LeftUpDownVector", 0x02951, // UP BARB LEFT DOWN BARB LEFT HARPOON -- "LeftUpTeeVector", 0x02960, // UPWARDS HARPOON WITH BARB LEFT FROM BAR -- "LeftUpVector", 0x021BF, // UPWARDS HARPOON WITH BARB LEFTWARDS -- "LeftUpVectorBar", 0x02958, // UPWARDS HARPOON WITH BARB LEFT TO BAR -- "LeftVector", 0x021BC, // LEFTWARDS HARPOON WITH BARB UPWARDS -- "LeftVectorBar", 0x02952, // LEFTWARDS HARPOON WITH BARB UP TO BAR -- "leg", 0x022DA, // LESS-THAN EQUAL TO OR GREATER-THAN -- "lEg", 0x02A8B, // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN -- "leq", 0x02264, // LESS-THAN OR EQUAL TO -- "leqq", 0x02266, // LESS-THAN OVER EQUAL TO -- "leqslant", 0x02A7D, // LESS-THAN OR SLANTED EQUAL TO -- "les", 0x02A7D, // LESS-THAN OR SLANTED EQUAL TO -- "lescc", 0x02AA8, // LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL -- "lesdot", 0x02A7F, // LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE -- "lesdoto", 0x02A81, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE -- "lesdotor", 0x02A83, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT --// "lesg", 0x022DA;0x0FE00, // LESS-THAN slanted EQUAL TO OR GREATER-THAN -- "lesges", 0x02A93, // LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL -- "lessapprox", 0x02A85, // LESS-THAN OR APPROXIMATE -- "lessdot", 0x022D6, // LESS-THAN WITH DOT -- "lesseqgtr", 0x022DA, // LESS-THAN EQUAL TO OR GREATER-THAN -- "lesseqqgtr", 0x02A8B, // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN -- "LessEqualGreater", 0x022DA, // LESS-THAN EQUAL TO OR GREATER-THAN -- "LessFullEqual", 0x02266, // LESS-THAN OVER EQUAL TO -- "LessGreater", 0x02276, // LESS-THAN OR GREATER-THAN -- "lessgtr", 0x02276, // LESS-THAN OR GREATER-THAN -- "LessLess", 0x02AA1, // DOUBLE NESTED LESS-THAN -- "lesssim", 0x02272, // LESS-THAN OR EQUIVALENT TO -- "LessSlantEqual", 0x02A7D, // LESS-THAN OR SLANTED EQUAL TO -- "LessTilde", 0x02272, // LESS-THAN OR EQUIVALENT TO -- "lfisht", 0x0297C, // LEFT FISH TAIL -- "lfloor", 0x0230A, // LEFT FLOOR -- "Lfr", 0x1D50F, // MATHEMATICAL FRAKTUR CAPITAL L -- "lfr", 0x1D529, // MATHEMATICAL FRAKTUR SMALL L -- "lg", 0x02276, // LESS-THAN OR GREATER-THAN -- "lgE", 0x02A91, // LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL -- "Lgr", 0x0039B, // GREEK CAPITAL LETTER LAMDA -- "lgr", 0x003BB, // GREEK SMALL LETTER LAMDA -- "lHar", 0x02962, // LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN -- "lhard", 0x021BD, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -- "lharu", 0x021BC, // LEFTWARDS HARPOON WITH BARB UPWARDS -- "lharul", 0x0296A, // LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH -- "lhblk", 0x02584, // LOWER HALF BLOCK -- "LJcy", 0x00409, // CYRILLIC CAPITAL LETTER LJE -- "ljcy", 0x00459, // CYRILLIC SMALL LETTER LJE -- "ll", 0x0226A, // MUCH LESS-THAN -- "Ll", 0x022D8, // VERY MUCH LESS-THAN -- "llarr", 0x021C7, // LEFTWARDS PAIRED ARROWS -- "llcorner", 0x0231E, // BOTTOM LEFT CORNER -- "Lleftarrow", 0x021DA, // LEFTWARDS TRIPLE ARROW -- "llhard", 0x0296B, // LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH -- "lltri", 0x025FA, // LOWER LEFT TRIANGLE -- "Lmidot", 0x0013F, // LATIN CAPITAL LETTER L WITH MIDDLE DOT -- "lmidot", 0x00140, // LATIN SMALL LETTER L WITH MIDDLE DOT -- "lmoust", 0x023B0, // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION -- "lmoustache", 0x023B0, // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION -- "lnap", 0x02A89, // LESS-THAN AND NOT APPROXIMATE -- "lnapprox", 0x02A89, // LESS-THAN AND NOT APPROXIMATE -- "lnE", 0x02268, // LESS-THAN BUT NOT EQUAL TO -- "lne", 0x02A87, // LESS-THAN AND SINGLE-LINE NOT EQUAL TO -- "lneq", 0x02A87, // LESS-THAN AND SINGLE-LINE NOT EQUAL TO -- "lneqq", 0x02268, // LESS-THAN BUT NOT EQUAL TO -- "lnsim", 0x022E6, // LESS-THAN BUT NOT EQUIVALENT TO -- "loang", 0x027EC, // MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET -- "loarr", 0x021FD, // LEFTWARDS OPEN-HEADED ARROW -- "lobrk", 0x027E6, // MATHEMATICAL LEFT WHITE SQUARE BRACKET -- "longleftarrow", 0x027F5, // LONG LEFTWARDS ARROW -- "LongLeftArrow", 0x027F5, // LONG LEFTWARDS ARROW -- "Longleftarrow", 0x027F8, // LONG LEFTWARDS DOUBLE ARROW -- "longleftrightarrow", 0x027F7, // LONG LEFT RIGHT ARROW -- "LongLeftRightArrow", 0x027F7, // LONG LEFT RIGHT ARROW -- "Longleftrightarrow", 0x027FA, // LONG LEFT RIGHT DOUBLE ARROW -- "longmapsto", 0x027FC, // LONG RIGHTWARDS ARROW FROM BAR -- "longrightarrow", 0x027F6, // LONG RIGHTWARDS ARROW -- "LongRightArrow", 0x027F6, // LONG RIGHTWARDS ARROW -- "Longrightarrow", 0x027F9, // LONG RIGHTWARDS DOUBLE ARROW -- "looparrowleft", 0x021AB, // LEFTWARDS ARROW WITH LOOP -- "looparrowright", 0x021AC, // RIGHTWARDS ARROW WITH LOOP -- "lopar", 0x02985, // LEFT WHITE PARENTHESIS -- "Lopf", 0x1D543, // MATHEMATICAL DOUBLE-STRUCK CAPITAL L -- "lopf", 0x1D55D, // MATHEMATICAL DOUBLE-STRUCK SMALL L -- "loplus", 0x02A2D, // PLUS SIGN IN LEFT HALF CIRCLE -- "lotimes", 0x02A34, // MULTIPLICATION SIGN IN LEFT HALF CIRCLE -- "lowast", 0x02217, // ASTERISK OPERATOR -- "lowbar", 0x0005F, // LOW LINE -- "LowerLeftArrow", 0x02199, // SOUTH WEST ARROW -- "LowerRightArrow", 0x02198, // SOUTH EAST ARROW -- "loz", 0x025CA, // LOZENGE -- "lozenge", 0x025CA, // LOZENGE -- "lozf", 0x029EB, // BLACK LOZENGE -- "lpar", 0x00028, // LEFT PARENTHESIS -- "lparlt", 0x02993, // LEFT ARC LESS-THAN BRACKET -- "lrarr", 0x021C6, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -- "lrcorner", 0x0231F, // BOTTOM RIGHT CORNER -- "lrhar", 0x021CB, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -- "lrhard", 0x0296D, // RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH -- "lrm", 0x0200E, // LEFT-TO-RIGHT MARK -- "lrtri", 0x022BF, // RIGHT TRIANGLE -- "lsaquo", 0x02039, // SINGLE LEFT-POINTING ANGLE QUOTATION MARK -- "Lscr", 0x02112, // SCRIPT CAPITAL L -- "lscr", 0x1D4C1, // MATHEMATICAL SCRIPT SMALL L -- "lsh", 0x021B0, // UPWARDS ARROW WITH TIP LEFTWARDS -- "Lsh", 0x021B0, // UPWARDS ARROW WITH TIP LEFTWARDS -- "lsim", 0x02272, // LESS-THAN OR EQUIVALENT TO -- "lsime", 0x02A8D, // LESS-THAN ABOVE SIMILAR OR EQUAL -- "lsimg", 0x02A8F, // LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN -- "lsqb", 0x0005B, // LEFT SQUARE BRACKET -- "lsquo", 0x02018, // LEFT SINGLE QUOTATION MARK -- "lsquor", 0x0201A, // SINGLE LOW-9 QUOTATION MARK -- "Lstrok", 0x00141, // LATIN CAPITAL LETTER L WITH STROKE -- "lstrok", 0x00142, // LATIN SMALL LETTER L WITH STROKE -- "lt", 0x0003C, // LESS-THAN SIGN -- "LT", 0x0003C, // LESS-THAN SIGN -- "Lt", 0x0226A, // MUCH LESS-THAN -- "ltcc", 0x02AA6, // LESS-THAN CLOSED BY CURVE -- "ltcir", 0x02A79, // LESS-THAN WITH CIRCLE INSIDE -- "ltdot", 0x022D6, // LESS-THAN WITH DOT -- "lthree", 0x022CB, // LEFT SEMIDIRECT PRODUCT -- "ltimes", 0x022C9, // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT -- "ltlarr", 0x02976, // LESS-THAN ABOVE LEFTWARDS ARROW -- "ltquest", 0x02A7B, // LESS-THAN WITH QUESTION MARK ABOVE -- "ltri", 0x025C3, // WHITE LEFT-POINTING SMALL TRIANGLE -- "ltrie", 0x022B4, // NORMAL SUBGROUP OF OR EQUAL TO -- "ltrif", 0x025C2, // BLACK LEFT-POINTING SMALL TRIANGLE -- "ltrPar", 0x02996, // DOUBLE RIGHT ARC LESS-THAN BRACKET -- "lurdshar", 0x0294A, // LEFT BARB UP RIGHT BARB DOWN HARPOON -- "luruhar", 0x02966, // LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP --// "lvertneqq", 0x02268;0x0FE00, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke --// "lvnE", 0x02268;0x0FE00, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke -- NULL, 0 -+ {"lAarr", 0x021DA}, // LEFTWARDS TRIPLE ARROW -+ {"Lacute", 0x00139}, // LATIN CAPITAL LETTER L WITH ACUTE -+ {"lacute", 0x0013A}, // LATIN SMALL LETTER L WITH ACUTE -+ {"laemptyv", 0x029B4}, // EMPTY SET WITH LEFT ARROW ABOVE -+ {"lagran", 0x02112}, // SCRIPT CAPITAL L -+ {"Lambda", 0x0039B}, // GREEK CAPITAL LETTER LAMDA -+ {"lambda", 0x003BB}, // GREEK SMALL LETTER LAMDA -+ {"lang", 0x027E8}, // MATHEMATICAL LEFT ANGLE BRACKET -+ {"Lang", 0x027EA}, // MATHEMATICAL LEFT DOUBLE ANGLE BRACKET -+ {"langd", 0x02991}, // LEFT ANGLE BRACKET WITH DOT -+ {"langle", 0x027E8}, // MATHEMATICAL LEFT ANGLE BRACKET -+ {"lap", 0x02A85}, // LESS-THAN OR APPROXIMATE -+ {"Laplacetrf", 0x02112}, // SCRIPT CAPITAL L -+ {"laquo", 0x000AB}, // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -+ {"larr", 0x02190}, // LEFTWARDS ARROW -+ {"Larr", 0x0219E}, // LEFTWARDS TWO HEADED ARROW -+ {"lArr", 0x021D0}, // LEFTWARDS DOUBLE ARROW -+ {"larrb", 0x021E4}, // LEFTWARDS ARROW TO BAR -+ {"larrbfs", 0x0291F}, // LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND -+ {"larrfs", 0x0291D}, // LEFTWARDS ARROW TO BLACK DIAMOND -+ {"larrhk", 0x021A9}, // LEFTWARDS ARROW WITH HOOK -+ {"larrlp", 0x021AB}, // LEFTWARDS ARROW WITH LOOP -+ {"larrpl", 0x02939}, // LEFT-SIDE ARC ANTICLOCKWISE ARROW -+ {"larrsim", 0x02973}, // LEFTWARDS ARROW ABOVE TILDE OPERATOR -+ {"larrtl", 0x021A2}, // LEFTWARDS ARROW WITH TAIL -+ {"lat", 0x02AAB}, // LARGER THAN -+ {"latail", 0x02919}, // LEFTWARDS ARROW-TAIL -+ {"lAtail", 0x0291B}, // LEFTWARDS DOUBLE ARROW-TAIL -+ {"late", 0x02AAD}, // LARGER THAN OR EQUAL TO -+// "lates", 0x02AAD;0x0FE00}, // LARGER THAN OR slanted EQUAL -+ {"lbarr", 0x0290C}, // LEFTWARDS DOUBLE DASH ARROW -+ {"lBarr", 0x0290E}, // LEFTWARDS TRIPLE DASH ARROW -+ {"lbbrk", 0x02772}, // LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT -+ {"lbrace", 0x0007B}, // LEFT CURLY BRACKET -+ {"lbrack", 0x0005B}, // LEFT SQUARE BRACKET -+ {"lbrke", 0x0298B}, // LEFT SQUARE BRACKET WITH UNDERBAR -+ {"lbrksld", 0x0298F}, // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER -+ {"lbrkslu", 0x0298D}, // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER -+ {"Lcaron", 0x0013D}, // LATIN CAPITAL LETTER L WITH CARON -+ {"lcaron", 0x0013E}, // LATIN SMALL LETTER L WITH CARON -+ {"Lcedil", 0x0013B}, // LATIN CAPITAL LETTER L WITH CEDILLA -+ {"lcedil", 0x0013C}, // LATIN SMALL LETTER L WITH CEDILLA -+ {"lceil", 0x02308}, // LEFT CEILING -+ {"lcub", 0x0007B}, // LEFT CURLY BRACKET -+ {"Lcy", 0x0041B}, // CYRILLIC CAPITAL LETTER EL -+ {"lcy", 0x0043B}, // CYRILLIC SMALL LETTER EL -+ {"ldca", 0x02936}, // ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS -+ {"ldquo", 0x0201C}, // LEFT DOUBLE QUOTATION MARK -+ {"ldquor", 0x0201E}, // DOUBLE LOW-9 QUOTATION MARK -+ {"ldrdhar", 0x02967}, // LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN -+ {"ldrushar", 0x0294B}, // LEFT BARB DOWN RIGHT BARB UP HARPOON -+ {"ldsh", 0x021B2}, // DOWNWARDS ARROW WITH TIP LEFTWARDS -+ {"le", 0x02264}, // LESS-THAN OR EQUAL TO -+ {"lE", 0x02266}, // LESS-THAN OVER EQUAL TO -+ {"LeftAngleBracket", 0x027E8}, // MATHEMATICAL LEFT ANGLE BRACKET -+ {"leftarrow", 0x02190}, // LEFTWARDS ARROW -+ {"LeftArrow", 0x02190}, // LEFTWARDS ARROW -+ {"Leftarrow", 0x021D0}, // LEFTWARDS DOUBLE ARROW -+ {"LeftArrowBar", 0x021E4}, // LEFTWARDS ARROW TO BAR -+ {"LeftArrowRightArrow", 0x021C6}, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -+ {"leftarrowtail", 0x021A2}, // LEFTWARDS ARROW WITH TAIL -+ {"LeftCeiling", 0x02308}, // LEFT CEILING -+ {"LeftDoubleBracket", 0x027E6}, // MATHEMATICAL LEFT WHITE SQUARE BRACKET -+ {"LeftDownTeeVector", 0x02961}, // DOWNWARDS HARPOON WITH BARB LEFT FROM BAR -+ {"LeftDownVector", 0x021C3}, // DOWNWARDS HARPOON WITH BARB LEFTWARDS -+ {"LeftDownVectorBar", 0x02959}, // DOWNWARDS HARPOON WITH BARB LEFT TO BAR -+ {"LeftFloor", 0x0230A}, // LEFT FLOOR -+ {"leftharpoondown", 0x021BD}, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -+ {"leftharpoonup", 0x021BC}, // LEFTWARDS HARPOON WITH BARB UPWARDS -+ {"leftleftarrows", 0x021C7}, // LEFTWARDS PAIRED ARROWS -+ {"leftrightarrow", 0x02194}, // LEFT RIGHT ARROW -+ {"LeftRightArrow", 0x02194}, // LEFT RIGHT ARROW -+ {"Leftrightarrow", 0x021D4}, // LEFT RIGHT DOUBLE ARROW -+ {"leftrightarrows", 0x021C6}, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -+ {"leftrightharpoons", 0x021CB}, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -+ {"leftrightsquigarrow", 0x021AD}, // LEFT RIGHT WAVE ARROW -+ {"LeftRightVector", 0x0294E}, // LEFT BARB UP RIGHT BARB UP HARPOON -+ {"LeftTee", 0x022A3}, // LEFT TACK -+ {"LeftTeeArrow", 0x021A4}, // LEFTWARDS ARROW FROM BAR -+ {"LeftTeeVector", 0x0295A}, // LEFTWARDS HARPOON WITH BARB UP FROM BAR -+ {"leftthreetimes", 0x022CB}, // LEFT SEMIDIRECT PRODUCT -+ {"LeftTriangle", 0x022B2}, // NORMAL SUBGROUP OF -+ {"LeftTriangleBar", 0x029CF}, // LEFT TRIANGLE BESIDE VERTICAL BAR -+ {"LeftTriangleEqual", 0x022B4}, // NORMAL SUBGROUP OF OR EQUAL TO -+ {"LeftUpDownVector", 0x02951}, // UP BARB LEFT DOWN BARB LEFT HARPOON -+ {"LeftUpTeeVector", 0x02960}, // UPWARDS HARPOON WITH BARB LEFT FROM BAR -+ {"LeftUpVector", 0x021BF}, // UPWARDS HARPOON WITH BARB LEFTWARDS -+ {"LeftUpVectorBar", 0x02958}, // UPWARDS HARPOON WITH BARB LEFT TO BAR -+ {"LeftVector", 0x021BC}, // LEFTWARDS HARPOON WITH BARB UPWARDS -+ {"LeftVectorBar", 0x02952}, // LEFTWARDS HARPOON WITH BARB UP TO BAR -+ {"leg", 0x022DA}, // LESS-THAN EQUAL TO OR GREATER-THAN -+ {"lEg", 0x02A8B}, // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN -+ {"leq", 0x02264}, // LESS-THAN OR EQUAL TO -+ {"leqq", 0x02266}, // LESS-THAN OVER EQUAL TO -+ {"leqslant", 0x02A7D}, // LESS-THAN OR SLANTED EQUAL TO -+ {"les", 0x02A7D}, // LESS-THAN OR SLANTED EQUAL TO -+ {"lescc", 0x02AA8}, // LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL -+ {"lesdot", 0x02A7F}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE -+ {"lesdoto", 0x02A81}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE -+ {"lesdotor", 0x02A83}, // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT -+// "lesg", 0x022DA;0x0FE00}, // LESS-THAN slanted EQUAL TO OR GREATER-THAN -+ {"lesges", 0x02A93}, // LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL -+ {"lessapprox", 0x02A85}, // LESS-THAN OR APPROXIMATE -+ {"lessdot", 0x022D6}, // LESS-THAN WITH DOT -+ {"lesseqgtr", 0x022DA}, // LESS-THAN EQUAL TO OR GREATER-THAN -+ {"lesseqqgtr", 0x02A8B}, // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN -+ {"LessEqualGreater", 0x022DA}, // LESS-THAN EQUAL TO OR GREATER-THAN -+ {"LessFullEqual", 0x02266}, // LESS-THAN OVER EQUAL TO -+ {"LessGreater", 0x02276}, // LESS-THAN OR GREATER-THAN -+ {"lessgtr", 0x02276}, // LESS-THAN OR GREATER-THAN -+ {"LessLess", 0x02AA1}, // DOUBLE NESTED LESS-THAN -+ {"lesssim", 0x02272}, // LESS-THAN OR EQUIVALENT TO -+ {"LessSlantEqual", 0x02A7D}, // LESS-THAN OR SLANTED EQUAL TO -+ {"LessTilde", 0x02272}, // LESS-THAN OR EQUIVALENT TO -+ {"lfisht", 0x0297C}, // LEFT FISH TAIL -+ {"lfloor", 0x0230A}, // LEFT FLOOR -+ {"Lfr", 0x1D50F}, // MATHEMATICAL FRAKTUR CAPITAL L -+ {"lfr", 0x1D529}, // MATHEMATICAL FRAKTUR SMALL L -+ {"lg", 0x02276}, // LESS-THAN OR GREATER-THAN -+ {"lgE", 0x02A91}, // LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL -+ {"Lgr", 0x0039B}, // GREEK CAPITAL LETTER LAMDA -+ {"lgr", 0x003BB}, // GREEK SMALL LETTER LAMDA -+ {"lHar", 0x02962}, // LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN -+ {"lhard", 0x021BD}, // LEFTWARDS HARPOON WITH BARB DOWNWARDS -+ {"lharu", 0x021BC}, // LEFTWARDS HARPOON WITH BARB UPWARDS -+ {"lharul", 0x0296A}, // LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH -+ {"lhblk", 0x02584}, // LOWER HALF BLOCK -+ {"LJcy", 0x00409}, // CYRILLIC CAPITAL LETTER LJE -+ {"ljcy", 0x00459}, // CYRILLIC SMALL LETTER LJE -+ {"ll", 0x0226A}, // MUCH LESS-THAN -+ {"Ll", 0x022D8}, // VERY MUCH LESS-THAN -+ {"llarr", 0x021C7}, // LEFTWARDS PAIRED ARROWS -+ {"llcorner", 0x0231E}, // BOTTOM LEFT CORNER -+ {"Lleftarrow", 0x021DA}, // LEFTWARDS TRIPLE ARROW -+ {"llhard", 0x0296B}, // LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH -+ {"lltri", 0x025FA}, // LOWER LEFT TRIANGLE -+ {"Lmidot", 0x0013F}, // LATIN CAPITAL LETTER L WITH MIDDLE DOT -+ {"lmidot", 0x00140}, // LATIN SMALL LETTER L WITH MIDDLE DOT -+ {"lmoust", 0x023B0}, // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION -+ {"lmoustache", 0x023B0}, // UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION -+ {"lnap", 0x02A89}, // LESS-THAN AND NOT APPROXIMATE -+ {"lnapprox", 0x02A89}, // LESS-THAN AND NOT APPROXIMATE -+ {"lnE", 0x02268}, // LESS-THAN BUT NOT EQUAL TO -+ {"lne", 0x02A87}, // LESS-THAN AND SINGLE-LINE NOT EQUAL TO -+ {"lneq", 0x02A87}, // LESS-THAN AND SINGLE-LINE NOT EQUAL TO -+ {"lneqq", 0x02268}, // LESS-THAN BUT NOT EQUAL TO -+ {"lnsim", 0x022E6}, // LESS-THAN BUT NOT EQUIVALENT TO -+ {"loang", 0x027EC}, // MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET -+ {"loarr", 0x021FD}, // LEFTWARDS OPEN-HEADED ARROW -+ {"lobrk", 0x027E6}, // MATHEMATICAL LEFT WHITE SQUARE BRACKET -+ {"longleftarrow", 0x027F5}, // LONG LEFTWARDS ARROW -+ {"LongLeftArrow", 0x027F5}, // LONG LEFTWARDS ARROW -+ {"Longleftarrow", 0x027F8}, // LONG LEFTWARDS DOUBLE ARROW -+ {"longleftrightarrow", 0x027F7}, // LONG LEFT RIGHT ARROW -+ {"LongLeftRightArrow", 0x027F7}, // LONG LEFT RIGHT ARROW -+ {"Longleftrightarrow", 0x027FA}, // LONG LEFT RIGHT DOUBLE ARROW -+ {"longmapsto", 0x027FC}, // LONG RIGHTWARDS ARROW FROM BAR -+ {"longrightarrow", 0x027F6}, // LONG RIGHTWARDS ARROW -+ {"LongRightArrow", 0x027F6}, // LONG RIGHTWARDS ARROW -+ {"Longrightarrow", 0x027F9}, // LONG RIGHTWARDS DOUBLE ARROW -+ {"looparrowleft", 0x021AB}, // LEFTWARDS ARROW WITH LOOP -+ {"looparrowright", 0x021AC}, // RIGHTWARDS ARROW WITH LOOP -+ {"lopar", 0x02985}, // LEFT WHITE PARENTHESIS -+ {"Lopf", 0x1D543}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL L -+ {"lopf", 0x1D55D}, // MATHEMATICAL DOUBLE-STRUCK SMALL L -+ {"loplus", 0x02A2D}, // PLUS SIGN IN LEFT HALF CIRCLE -+ {"lotimes", 0x02A34}, // MULTIPLICATION SIGN IN LEFT HALF CIRCLE -+ {"lowast", 0x02217}, // ASTERISK OPERATOR -+ {"lowbar", 0x0005F}, // LOW LINE -+ {"LowerLeftArrow", 0x02199}, // SOUTH WEST ARROW -+ {"LowerRightArrow", 0x02198}, // SOUTH EAST ARROW -+ {"loz", 0x025CA}, // LOZENGE -+ {"lozenge", 0x025CA}, // LOZENGE -+ {"lozf", 0x029EB}, // BLACK LOZENGE -+ {"lpar", 0x00028}, // LEFT PARENTHESIS -+ {"lparlt", 0x02993}, // LEFT ARC LESS-THAN BRACKET -+ {"lrarr", 0x021C6}, // LEFTWARDS ARROW OVER RIGHTWARDS ARROW -+ {"lrcorner", 0x0231F}, // BOTTOM RIGHT CORNER -+ {"lrhar", 0x021CB}, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -+ {"lrhard", 0x0296D}, // RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH -+ {"lrm", 0x0200E}, // LEFT-TO-RIGHT MARK -+ {"lrtri", 0x022BF}, // RIGHT TRIANGLE -+ {"lsaquo", 0x02039}, // SINGLE LEFT-POINTING ANGLE QUOTATION MARK -+ {"Lscr", 0x02112}, // SCRIPT CAPITAL L -+ {"lscr", 0x1D4C1}, // MATHEMATICAL SCRIPT SMALL L -+ {"lsh", 0x021B0}, // UPWARDS ARROW WITH TIP LEFTWARDS -+ {"Lsh", 0x021B0}, // UPWARDS ARROW WITH TIP LEFTWARDS -+ {"lsim", 0x02272}, // LESS-THAN OR EQUIVALENT TO -+ {"lsime", 0x02A8D}, // LESS-THAN ABOVE SIMILAR OR EQUAL -+ {"lsimg", 0x02A8F}, // LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN -+ {"lsqb", 0x0005B}, // LEFT SQUARE BRACKET -+ {"lsquo", 0x02018}, // LEFT SINGLE QUOTATION MARK -+ {"lsquor", 0x0201A}, // SINGLE LOW-9 QUOTATION MARK -+ {"Lstrok", 0x00141}, // LATIN CAPITAL LETTER L WITH STROKE -+ {"lstrok", 0x00142}, // LATIN SMALL LETTER L WITH STROKE -+ {"lt", 0x0003C}, // LESS-THAN SIGN -+ {"LT", 0x0003C}, // LESS-THAN SIGN -+ {"Lt", 0x0226A}, // MUCH LESS-THAN -+ {"ltcc", 0x02AA6}, // LESS-THAN CLOSED BY CURVE -+ {"ltcir", 0x02A79}, // LESS-THAN WITH CIRCLE INSIDE -+ {"ltdot", 0x022D6}, // LESS-THAN WITH DOT -+ {"lthree", 0x022CB}, // LEFT SEMIDIRECT PRODUCT -+ {"ltimes", 0x022C9}, // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT -+ {"ltlarr", 0x02976}, // LESS-THAN ABOVE LEFTWARDS ARROW -+ {"ltquest", 0x02A7B}, // LESS-THAN WITH QUESTION MARK ABOVE -+ {"ltri", 0x025C3}, // WHITE LEFT-POINTING SMALL TRIANGLE -+ {"ltrie", 0x022B4}, // NORMAL SUBGROUP OF OR EQUAL TO -+ {"ltrif", 0x025C2}, // BLACK LEFT-POINTING SMALL TRIANGLE -+ {"ltrPar", 0x02996}, // DOUBLE RIGHT ARC LESS-THAN BRACKET -+ {"lurdshar", 0x0294A}, // LEFT BARB UP RIGHT BARB DOWN HARPOON -+ {"luruhar", 0x02966}, // LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP -+// "lvertneqq", 0x02268;0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke -+// "lvnE", 0x02268;0x0FE00}, // LESS-THAN BUT NOT EQUAL TO - with vertical stroke -+ {NULL, 0} - }; - - static NameId namesM[]={ -- "macr", 0x000AF, // MACRON -- "male", 0x02642, // MALE SIGN -- "malt", 0x02720, // MALTESE CROSS -- "maltese", 0x02720, // MALTESE CROSS -- "map", 0x021A6, // RIGHTWARDS ARROW FROM BAR -- "Map", 0x02905, // RIGHTWARDS TWO-HEADED ARROW FROM BAR -- "mapsto", 0x021A6, // RIGHTWARDS ARROW FROM BAR -- "mapstodown", 0x021A7, // DOWNWARDS ARROW FROM BAR -- "mapstoleft", 0x021A4, // LEFTWARDS ARROW FROM BAR -- "mapstoup", 0x021A5, // UPWARDS ARROW FROM BAR -- "marker", 0x025AE, // BLACK VERTICAL RECTANGLE -- "mcomma", 0x02A29, // MINUS SIGN WITH COMMA ABOVE -- "Mcy", 0x0041C, // CYRILLIC CAPITAL LETTER EM -- "mcy", 0x0043C, // CYRILLIC SMALL LETTER EM -- "mdash", 0x02014, // EM DASH -- "mDDot", 0x0223A, // GEOMETRIC PROPORTION -- "measuredangle", 0x02221, // MEASURED ANGLE -- "MediumSpace", 0x0205F, // MEDIUM MATHEMATICAL SPACE -- "Mellintrf", 0x02133, // SCRIPT CAPITAL M -- "Mfr", 0x1D510, // MATHEMATICAL FRAKTUR CAPITAL M -- "mfr", 0x1D52A, // MATHEMATICAL FRAKTUR SMALL M -- "Mgr", 0x0039C, // GREEK CAPITAL LETTER MU -- "mgr", 0x003BC, // GREEK SMALL LETTER MU -- "mho", 0x02127, // INVERTED OHM SIGN -- "micro", 0x000B5, // MICRO SIGN -- "mid", 0x02223, // DIVIDES -- "midast", 0x0002A, // ASTERISK -- "midcir", 0x02AF0, // VERTICAL LINE WITH CIRCLE BELOW -- "middot", 0x000B7, // MIDDLE DOT -- "minus", 0x02212, // MINUS SIGN -- "minusb", 0x0229F, // SQUARED MINUS -- "minusd", 0x02238, // DOT MINUS -- "minusdu", 0x02A2A, // MINUS SIGN WITH DOT BELOW -- "MinusPlus", 0x02213, // MINUS-OR-PLUS SIGN -- "mlcp", 0x02ADB, // TRANSVERSAL INTERSECTION -- "mldr", 0x02026, // HORIZONTAL ELLIPSIS -- "mnplus", 0x02213, // MINUS-OR-PLUS SIGN -- "models", 0x022A7, // MODELS -- "Mopf", 0x1D544, // MATHEMATICAL DOUBLE-STRUCK CAPITAL M -- "mopf", 0x1D55E, // MATHEMATICAL DOUBLE-STRUCK SMALL M -- "mp", 0x02213, // MINUS-OR-PLUS SIGN -- "Mscr", 0x02133, // SCRIPT CAPITAL M -- "mscr", 0x1D4C2, // MATHEMATICAL SCRIPT SMALL M -- "mstpos", 0x0223E, // INVERTED LAZY S -- "Mu", 0x0039C, // GREEK CAPITAL LETTER MU -- "mu", 0x003BC, // GREEK SMALL LETTER MU -- "multimap", 0x022B8, // MULTIMAP -- "mumap", 0x022B8, // MULTIMAP -- NULL, 0 -+ {"macr", 0x000AF}, // MACRON -+ {"male", 0x02642}, // MALE SIGN -+ {"malt", 0x02720}, // MALTESE CROSS -+ {"maltese", 0x02720}, // MALTESE CROSS -+ {"map", 0x021A6}, // RIGHTWARDS ARROW FROM BAR -+ {"Map", 0x02905}, // RIGHTWARDS TWO-HEADED ARROW FROM BAR -+ {"mapsto", 0x021A6}, // RIGHTWARDS ARROW FROM BAR -+ {"mapstodown", 0x021A7}, // DOWNWARDS ARROW FROM BAR -+ {"mapstoleft", 0x021A4}, // LEFTWARDS ARROW FROM BAR -+ {"mapstoup", 0x021A5}, // UPWARDS ARROW FROM BAR -+ {"marker", 0x025AE}, // BLACK VERTICAL RECTANGLE -+ {"mcomma", 0x02A29}, // MINUS SIGN WITH COMMA ABOVE -+ {"Mcy", 0x0041C}, // CYRILLIC CAPITAL LETTER EM -+ {"mcy", 0x0043C}, // CYRILLIC SMALL LETTER EM -+ {"mdash", 0x02014}, // EM DASH -+ {"mDDot", 0x0223A}, // GEOMETRIC PROPORTION -+ {"measuredangle", 0x02221}, // MEASURED ANGLE -+ {"MediumSpace", 0x0205F}, // MEDIUM MATHEMATICAL SPACE -+ {"Mellintrf", 0x02133}, // SCRIPT CAPITAL M -+ {"Mfr", 0x1D510}, // MATHEMATICAL FRAKTUR CAPITAL M -+ {"mfr", 0x1D52A}, // MATHEMATICAL FRAKTUR SMALL M -+ {"Mgr", 0x0039C}, // GREEK CAPITAL LETTER MU -+ {"mgr", 0x003BC}, // GREEK SMALL LETTER MU -+ {"mho", 0x02127}, // INVERTED OHM SIGN -+ {"micro", 0x000B5}, // MICRO SIGN -+ {"mid", 0x02223}, // DIVIDES -+ {"midast", 0x0002A}, // ASTERISK -+ {"midcir", 0x02AF0}, // VERTICAL LINE WITH CIRCLE BELOW -+ {"middot", 0x000B7}, // MIDDLE DOT -+ {"minus", 0x02212}, // MINUS SIGN -+ {"minusb", 0x0229F}, // SQUARED MINUS -+ {"minusd", 0x02238}, // DOT MINUS -+ {"minusdu", 0x02A2A}, // MINUS SIGN WITH DOT BELOW -+ {"MinusPlus", 0x02213}, // MINUS-OR-PLUS SIGN -+ {"mlcp", 0x02ADB}, // TRANSVERSAL INTERSECTION -+ {"mldr", 0x02026}, // HORIZONTAL ELLIPSIS -+ {"mnplus", 0x02213}, // MINUS-OR-PLUS SIGN -+ {"models", 0x022A7}, // MODELS -+ {"Mopf", 0x1D544}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL M -+ {"mopf", 0x1D55E}, // MATHEMATICAL DOUBLE-STRUCK SMALL M -+ {"mp", 0x02213}, // MINUS-OR-PLUS SIGN -+ {"Mscr", 0x02133}, // SCRIPT CAPITAL M -+ {"mscr", 0x1D4C2}, // MATHEMATICAL SCRIPT SMALL M -+ {"mstpos", 0x0223E}, // INVERTED LAZY S -+ {"Mu", 0x0039C}, // GREEK CAPITAL LETTER MU -+ {"mu", 0x003BC}, // GREEK SMALL LETTER MU -+ {"multimap", 0x022B8}, // MULTIMAP -+ {"mumap", 0x022B8}, // MULTIMAP -+ {NULL, 0} - }; - - static NameId namesN[]={ -- "nabla", 0x02207, // NABLA -- "Nacute", 0x00143, // LATIN CAPITAL LETTER N WITH ACUTE -- "nacute", 0x00144, // LATIN SMALL LETTER N WITH ACUTE --// "nang", 0x02220;0x020D2, // ANGLE with vertical line -- "nap", 0x02249, // NOT ALMOST EQUAL TO --// "napE", 0x02A70;0x00338, // APPROXIMATELY EQUAL OR EQUAL TO with slash --// "napid", 0x0224B;0x00338, // TRIPLE TILDE with slash -- "napos", 0x00149, // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE -- "napprox", 0x02249, // NOT ALMOST EQUAL TO -- "natur", 0x0266E, // MUSIC NATURAL SIGN -- "natural", 0x0266E, // MUSIC NATURAL SIGN -- "naturals", 0x02115, // DOUBLE-STRUCK CAPITAL N -- "nbsp", 0x000A0, // NO-BREAK SPACE --// "nbump", 0x0224E;0x00338, // GEOMETRICALLY EQUIVALENT TO with slash --// "nbumpe", 0x0224F;0x00338, // DIFFERENCE BETWEEN with slash -- "ncap", 0x02A43, // INTERSECTION WITH OVERBAR -- "Ncaron", 0x00147, // LATIN CAPITAL LETTER N WITH CARON -- "ncaron", 0x00148, // LATIN SMALL LETTER N WITH CARON -- "Ncedil", 0x00145, // LATIN CAPITAL LETTER N WITH CEDILLA -- "ncedil", 0x00146, // LATIN SMALL LETTER N WITH CEDILLA -- "ncong", 0x02247, // NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO --// "ncongdot", 0x02A6D;0x00338, // CONGRUENT WITH DOT ABOVE with slash -- "ncup", 0x02A42, // UNION WITH OVERBAR -- "Ncy", 0x0041D, // CYRILLIC CAPITAL LETTER EN -- "ncy", 0x0043D, // CYRILLIC SMALL LETTER EN -- "ndash", 0x02013, // EN DASH -- "ne", 0x02260, // NOT EQUAL TO -- "nearhk", 0x02924, // NORTH EAST ARROW WITH HOOK -- "nearr", 0x02197, // NORTH EAST ARROW -- "neArr", 0x021D7, // NORTH EAST DOUBLE ARROW -- "nearrow", 0x02197, // NORTH EAST ARROW --// "nedot", 0x02250;0x00338, // APPROACHES THE LIMIT with slash -- "NegativeMediumSpace", 0x0200B, // ZERO WIDTH SPACE -- "NegativeThickSpace", 0x0200B, // ZERO WIDTH SPACE -- "NegativeThinSpace", 0x0200B, // ZERO WIDTH SPACE -- "NegativeVeryThinSpace", 0x0200B, // ZERO WIDTH SPACE -- "nequiv", 0x02262, // NOT IDENTICAL TO -- "nesear", 0x02928, // NORTH EAST ARROW AND SOUTH EAST ARROW --// "nesim", 0x02242;0x00338, // MINUS TILDE with slash -- "NestedGreaterGreater", 0x0226B, // MUCH GREATER-THAN -- "NestedLessLess", 0x0226A, // MUCH LESS-THAN -- "NewLine", 0x0000A, // LINE FEED (LF) -- "nexist", 0x02204, // THERE DOES NOT EXIST -- "nexists", 0x02204, // THERE DOES NOT EXIST -- "Nfr", 0x1D511, // MATHEMATICAL FRAKTUR CAPITAL N -- "nfr", 0x1D52B, // MATHEMATICAL FRAKTUR SMALL N --// "ngE", 0x02267;0x00338, // GREATER-THAN OVER EQUAL TO with slash -- "nge", 0x02271, // NEITHER GREATER-THAN NOR EQUAL TO -- "ngeq", 0x02271, // NEITHER GREATER-THAN NOR EQUAL TO --// "ngeqq", 0x02267;0x00338, // GREATER-THAN OVER EQUAL TO with slash --// "ngeqslant", 0x02A7E;0x00338, // GREATER-THAN OR SLANTED EQUAL TO with slash --// "nges", 0x02A7E;0x00338, // GREATER-THAN OR SLANTED EQUAL TO with slash --// "nGg", 0x022D9;0x00338, // VERY MUCH GREATER-THAN with slash -- "Ngr", 0x0039D, // GREEK CAPITAL LETTER NU -- "ngr", 0x003BD, // GREEK SMALL LETTER NU -- "ngsim", 0x02275, // NEITHER GREATER-THAN NOR EQUIVALENT TO --// "nGt", 0x0226B;0x020D2, // MUCH GREATER THAN with vertical line -- "ngt", 0x0226F, // NOT GREATER-THAN -- "ngtr", 0x0226F, // NOT GREATER-THAN --// "nGtv", 0x0226B;0x00338, // MUCH GREATER THAN with slash -- "nharr", 0x021AE, // LEFT RIGHT ARROW WITH STROKE -- "nhArr", 0x021CE, // LEFT RIGHT DOUBLE ARROW WITH STROKE -- "nhpar", 0x02AF2, // PARALLEL WITH HORIZONTAL STROKE -- "ni", 0x0220B, // CONTAINS AS MEMBER -- "nis", 0x022FC, // SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -- "nisd", 0x022FA, // CONTAINS WITH LONG HORIZONTAL STROKE -- "niv", 0x0220B, // CONTAINS AS MEMBER -- "NJcy", 0x0040A, // CYRILLIC CAPITAL LETTER NJE -- "njcy", 0x0045A, // CYRILLIC SMALL LETTER NJE -- "nlarr", 0x0219A, // LEFTWARDS ARROW WITH STROKE -- "nlArr", 0x021CD, // LEFTWARDS DOUBLE ARROW WITH STROKE -- "nldr", 0x02025, // TWO DOT LEADER --// "nlE", 0x02266;0x00338, // LESS-THAN OVER EQUAL TO with slash -- "nle", 0x02270, // NEITHER LESS-THAN NOR EQUAL TO -- "nleftarrow", 0x0219A, // LEFTWARDS ARROW WITH STROKE -- "nLeftarrow", 0x021CD, // LEFTWARDS DOUBLE ARROW WITH STROKE -- "nleftrightarrow", 0x021AE, // LEFT RIGHT ARROW WITH STROKE -- "nLeftrightarrow", 0x021CE, // LEFT RIGHT DOUBLE ARROW WITH STROKE -- "nleq", 0x02270, // NEITHER LESS-THAN NOR EQUAL TO --// "nleqq", 0x02266;0x00338, // LESS-THAN OVER EQUAL TO with slash --// "nleqslant", 0x02A7D;0x00338, // LESS-THAN OR SLANTED EQUAL TO with slash --// "nles", 0x02A7D;0x00338, // LESS-THAN OR SLANTED EQUAL TO with slash -- "nless", 0x0226E, // NOT LESS-THAN --// "nLl", 0x022D8;0x00338, // VERY MUCH LESS-THAN with slash -- "nlsim", 0x02274, // NEITHER LESS-THAN NOR EQUIVALENT TO --// "nLt", 0x0226A;0x020D2, // MUCH LESS THAN with vertical line -- "nlt", 0x0226E, // NOT LESS-THAN -- "nltri", 0x022EA, // NOT NORMAL SUBGROUP OF -- "nltrie", 0x022EC, // NOT NORMAL SUBGROUP OF OR EQUAL TO --// "nLtv", 0x0226A;0x00338, // MUCH LESS THAN with slash -- "nmid", 0x02224, // DOES NOT DIVIDE -- "NoBreak", 0x02060, // WORD JOINER -- "NonBreakingSpace", 0x000A0, // NO-BREAK SPACE -- "Nopf", 0x02115, // DOUBLE-STRUCK CAPITAL N -- "nopf", 0x1D55F, // MATHEMATICAL DOUBLE-STRUCK SMALL N -- "not", 0x000AC, // NOT SIGN -- "Not", 0x02AEC, // DOUBLE STROKE NOT SIGN -- "NotCongruent", 0x02262, // NOT IDENTICAL TO -- "NotCupCap", 0x0226D, // NOT EQUIVALENT TO -- "NotDoubleVerticalBar", 0x02226, // NOT PARALLEL TO -- "NotElement", 0x02209, // NOT AN ELEMENT OF -- "NotEqual", 0x02260, // NOT EQUAL TO --// "NotEqualTilde", 0x02242;0x00338, // MINUS TILDE with slash -- "NotExists", 0x02204, // THERE DOES NOT EXIST -- "NotGreater", 0x0226F, // NOT GREATER-THAN -- "NotGreaterEqual", 0x02271, // NEITHER GREATER-THAN NOR EQUAL TO --// "NotGreaterFullEqual", 0x02267;0x00338, // GREATER-THAN OVER EQUAL TO with slash --// "NotGreaterGreater", 0x0226B;0x00338, // MUCH GREATER THAN with slash -- "NotGreaterLess", 0x02279, // NEITHER GREATER-THAN NOR LESS-THAN --// "NotGreaterSlantEqual", 0x02A7E;0x00338, // GREATER-THAN OR SLANTED EQUAL TO with slash -- "NotGreaterTilde", 0x02275, // NEITHER GREATER-THAN NOR EQUIVALENT TO --// "NotHumpDownHump", 0x0224E;0x00338, // GEOMETRICALLY EQUIVALENT TO with slash --// "NotHumpEqual", 0x0224F;0x00338, // DIFFERENCE BETWEEN with slash -- "notin", 0x02209, // NOT AN ELEMENT OF --// "notindot", 0x022F5;0x00338, // ELEMENT OF WITH DOT ABOVE with slash --// "notinE", 0x022F9;0x00338, // ELEMENT OF WITH TWO HORIZONTAL STROKES with slash -- "notinva", 0x02209, // NOT AN ELEMENT OF -- "notinvb", 0x022F7, // SMALL ELEMENT OF WITH OVERBAR -- "notinvc", 0x022F6, // ELEMENT OF WITH OVERBAR -- "NotLeftTriangle", 0x022EA, // NOT NORMAL SUBGROUP OF --// "NotLeftTriangleBar", 0x029CF;0x00338, // LEFT TRIANGLE BESIDE VERTICAL BAR with slash -- "NotLeftTriangleEqual", 0x022EC, // NOT NORMAL SUBGROUP OF OR EQUAL TO -- "NotLess", 0x0226E, // NOT LESS-THAN -- "NotLessEqual", 0x02270, // NEITHER LESS-THAN NOR EQUAL TO -- "NotLessGreater", 0x02278, // NEITHER LESS-THAN NOR GREATER-THAN --// "NotLessLess", 0x0226A;0x00338, // MUCH LESS THAN with slash --// "NotLessSlantEqual", 0x02A7D;0x00338, // LESS-THAN OR SLANTED EQUAL TO with slash -- "NotLessTilde", 0x02274, // NEITHER LESS-THAN NOR EQUIVALENT TO --// "NotNestedGreaterGreater", 0x02AA2;0x00338, // DOUBLE NESTED GREATER-THAN with slash --// "NotNestedLessLess", 0x02AA1;0x00338, // DOUBLE NESTED LESS-THAN with slash -- "notni", 0x0220C, // DOES NOT CONTAIN AS MEMBER -- "notniva", 0x0220C, // DOES NOT CONTAIN AS MEMBER -- "notnivb", 0x022FE, // SMALL CONTAINS WITH OVERBAR -- "notnivc", 0x022FD, // CONTAINS WITH OVERBAR -- "NotPrecedes", 0x02280, // DOES NOT PRECEDE --// "NotPrecedesEqual", 0x02AAF;0x00338, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -- "NotPrecedesSlantEqual", 0x022E0, // DOES NOT PRECEDE OR EQUAL -- "NotReverseElement", 0x0220C, // DOES NOT CONTAIN AS MEMBER -- "NotRightTriangle", 0x022EB, // DOES NOT CONTAIN AS NORMAL SUBGROUP --// "NotRightTriangleBar", 0x029D0;0x00338, // VERTICAL BAR BESIDE RIGHT TRIANGLE with slash -- "NotRightTriangleEqual", 0x022ED, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL --// "NotSquareSubset", 0x0228F;0x00338, // SQUARE IMAGE OF with slash -- "NotSquareSubsetEqual", 0x022E2, // NOT SQUARE IMAGE OF OR EQUAL TO --// "NotSquareSuperset", 0x02290;0x00338, // SQUARE ORIGINAL OF with slash -- "NotSquareSupersetEqual", 0x022E3, // NOT SQUARE ORIGINAL OF OR EQUAL TO --// "NotSubset", 0x02282;0x020D2, // SUBSET OF with vertical line -- "NotSubsetEqual", 0x02288, // NEITHER A SUBSET OF NOR EQUAL TO -- "NotSucceeds", 0x02281, // DOES NOT SUCCEED --// "NotSucceedsEqual", 0x02AB0;0x00338, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -- "NotSucceedsSlantEqual", 0x022E1, // DOES NOT SUCCEED OR EQUAL --// "NotSucceedsTilde", 0x0227F;0x00338, // SUCCEEDS OR EQUIVALENT TO with slash --// "NotSuperset", 0x02283;0x020D2, // SUPERSET OF with vertical line -- "NotSupersetEqual", 0x02289, // NEITHER A SUPERSET OF NOR EQUAL TO -- "NotTilde", 0x02241, // NOT TILDE -- "NotTildeEqual", 0x02244, // NOT ASYMPTOTICALLY EQUAL TO -- "NotTildeFullEqual", 0x02247, // NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO -- "NotTildeTilde", 0x02249, // NOT ALMOST EQUAL TO -- "NotVerticalBar", 0x02224, // DOES NOT DIVIDE -- "npar", 0x02226, // NOT PARALLEL TO -- "nparallel", 0x02226, // NOT PARALLEL TO --// "nparsl", 0x02AFD;0x020E5, // DOUBLE SOLIDUS OPERATOR with reverse slash --// "npart", 0x02202;0x00338, // PARTIAL DIFFERENTIAL with slash -- "npolint", 0x02A14, // LINE INTEGRATION NOT INCLUDING THE POLE -- "npr", 0x02280, // DOES NOT PRECEDE -- "nprcue", 0x022E0, // DOES NOT PRECEDE OR EQUAL --// "npre", 0x02AAF;0x00338, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -- "nprec", 0x02280, // DOES NOT PRECEDE --// "npreceq", 0x02AAF;0x00338, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -- "nrarr", 0x0219B, // RIGHTWARDS ARROW WITH STROKE -- "nrArr", 0x021CF, // RIGHTWARDS DOUBLE ARROW WITH STROKE --// "nrarrc", 0x02933;0x00338, // WAVE ARROW POINTING DIRECTLY RIGHT with slash --// "nrarrw", 0x0219D;0x00338, // RIGHTWARDS WAVE ARROW with slash -- "nrightarrow", 0x0219B, // RIGHTWARDS ARROW WITH STROKE -- "nRightarrow", 0x021CF, // RIGHTWARDS DOUBLE ARROW WITH STROKE -- "nrtri", 0x022EB, // DOES NOT CONTAIN AS NORMAL SUBGROUP -- "nrtrie", 0x022ED, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -- "nsc", 0x02281, // DOES NOT SUCCEED -- "nsccue", 0x022E1, // DOES NOT SUCCEED OR EQUAL --// "nsce", 0x02AB0;0x00338, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -- "Nscr", 0x1D4A9, // MATHEMATICAL SCRIPT CAPITAL N -- "nscr", 0x1D4C3, // MATHEMATICAL SCRIPT SMALL N -- "nshortmid", 0x02224, // DOES NOT DIVIDE -- "nshortparallel", 0x02226, // NOT PARALLEL TO -- "nsim", 0x02241, // NOT TILDE -- "nsime", 0x02244, // NOT ASYMPTOTICALLY EQUAL TO -- "nsimeq", 0x02244, // NOT ASYMPTOTICALLY EQUAL TO -- "nsmid", 0x02224, // DOES NOT DIVIDE -- "nspar", 0x02226, // NOT PARALLEL TO -- "nsqsube", 0x022E2, // NOT SQUARE IMAGE OF OR EQUAL TO -- "nsqsupe", 0x022E3, // NOT SQUARE ORIGINAL OF OR EQUAL TO -- "nsub", 0x02284, // NOT A SUBSET OF -- "nsube", 0x02288, // NEITHER A SUBSET OF NOR EQUAL TO --// "nsubE", 0x02AC5;0x00338, // SUBSET OF ABOVE EQUALS SIGN with slash --// "nsubset", 0x02282;0x020D2, // SUBSET OF with vertical line -- "nsubseteq", 0x02288, // NEITHER A SUBSET OF NOR EQUAL TO --// "nsubseteqq", 0x02AC5;0x00338, // SUBSET OF ABOVE EQUALS SIGN with slash -- "nsucc", 0x02281, // DOES NOT SUCCEED --// "nsucceq", 0x02AB0;0x00338, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -- "nsup", 0x02285, // NOT A SUPERSET OF -- "nsupe", 0x02289, // NEITHER A SUPERSET OF NOR EQUAL TO --// "nsupE", 0x02AC6;0x00338, // SUPERSET OF ABOVE EQUALS SIGN with slash --// "nsupset", 0x02283;0x020D2, // SUPERSET OF with vertical line -- "nsupseteq", 0x02289, // NEITHER A SUPERSET OF NOR EQUAL TO --// "nsupseteqq", 0x02AC6;0x00338, // SUPERSET OF ABOVE EQUALS SIGN with slash -- "ntgl", 0x02279, // NEITHER GREATER-THAN NOR LESS-THAN -- "Ntilde", 0x000D1, // LATIN CAPITAL LETTER N WITH TILDE -- "ntilde", 0x000F1, // LATIN SMALL LETTER N WITH TILDE -- "ntlg", 0x02278, // NEITHER LESS-THAN NOR GREATER-THAN -- "ntriangleleft", 0x022EA, // NOT NORMAL SUBGROUP OF -- "ntrianglelefteq", 0x022EC, // NOT NORMAL SUBGROUP OF OR EQUAL TO -- "ntriangleright", 0x022EB, // DOES NOT CONTAIN AS NORMAL SUBGROUP -- "ntrianglerighteq", 0x022ED, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -- "Nu", 0x0039D, // GREEK CAPITAL LETTER NU -- "nu", 0x003BD, // GREEK SMALL LETTER NU -- "num", 0x00023, // NUMBER SIGN -- "numero", 0x02116, // NUMERO SIGN -- "numsp", 0x02007, // FIGURE SPACE --// "nvap", 0x0224D;0x020D2, // EQUIVALENT TO with vertical line -- "nvdash", 0x022AC, // DOES NOT PROVE -- "nvDash", 0x022AD, // NOT TRUE -- "nVdash", 0x022AE, // DOES NOT FORCE -- "nVDash", 0x022AF, // NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE --// "nvge", 0x02265;0x020D2, // GREATER-THAN OR EQUAL TO with vertical line --// "nvgt", 0x0003E;0x020D2, // GREATER-THAN SIGN with vertical line -- "nvHarr", 0x02904, // LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE -- "nvinfin", 0x029DE, // INFINITY NEGATED WITH VERTICAL BAR -- "nvlArr", 0x02902, // LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE --// "nvle", 0x02264;0x020D2, // LESS-THAN OR EQUAL TO with vertical line --// "nvlt", 0x0003C;0x020D2, // LESS-THAN SIGN with vertical line --// "nvltrie", 0x022B4;0x020D2, // NORMAL SUBGROUP OF OR EQUAL TO with vertical line -- "nvrArr", 0x02903, // RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE --// "nvrtrie", 0x022B5;0x020D2, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO with vertical line --// "nvsim", 0x0223C;0x020D2, // TILDE OPERATOR with vertical line -- "nwarhk", 0x02923, // NORTH WEST ARROW WITH HOOK -- "nwarr", 0x02196, // NORTH WEST ARROW -- "nwArr", 0x021D6, // NORTH WEST DOUBLE ARROW -- "nwarrow", 0x02196, // NORTH WEST ARROW -- "nwnear", 0x02927, // NORTH WEST ARROW AND NORTH EAST ARROW -- NULL, 0 -+ {"nabla", 0x02207}, // NABLA -+ {"Nacute", 0x00143}, // LATIN CAPITAL LETTER N WITH ACUTE -+ {"nacute", 0x00144}, // LATIN SMALL LETTER N WITH ACUTE -+// "nang", 0x02220;0x020D2}, // ANGLE with vertical line -+ {"nap", 0x02249}, // NOT ALMOST EQUAL TO -+// "napE", 0x02A70;0x00338}, // APPROXIMATELY EQUAL OR EQUAL TO with slash -+// "napid", 0x0224B;0x00338}, // TRIPLE TILDE with slash -+ {"napos", 0x00149}, // LATIN SMALL LETTER N PRECEDED BY APOSTROPHE -+ {"napprox", 0x02249}, // NOT ALMOST EQUAL TO -+ {"natur", 0x0266E}, // MUSIC NATURAL SIGN -+ {"natural", 0x0266E}, // MUSIC NATURAL SIGN -+ {"naturals", 0x02115}, // DOUBLE-STRUCK CAPITAL N -+ {"nbsp", 0x000A0}, // NO-BREAK SPACE -+// "nbump", 0x0224E;0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash -+// "nbumpe", 0x0224F;0x00338}, // DIFFERENCE BETWEEN with slash -+ {"ncap", 0x02A43}, // INTERSECTION WITH OVERBAR -+ {"Ncaron", 0x00147}, // LATIN CAPITAL LETTER N WITH CARON -+ {"ncaron", 0x00148}, // LATIN SMALL LETTER N WITH CARON -+ {"Ncedil", 0x00145}, // LATIN CAPITAL LETTER N WITH CEDILLA -+ {"ncedil", 0x00146}, // LATIN SMALL LETTER N WITH CEDILLA -+ {"ncong", 0x02247}, // NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO -+// "ncongdot", 0x02A6D;0x00338}, // CONGRUENT WITH DOT ABOVE with slash -+ {"ncup", 0x02A42}, // UNION WITH OVERBAR -+ {"Ncy", 0x0041D}, // CYRILLIC CAPITAL LETTER EN -+ {"ncy", 0x0043D}, // CYRILLIC SMALL LETTER EN -+ {"ndash", 0x02013}, // EN DASH -+ {"ne", 0x02260}, // NOT EQUAL TO -+ {"nearhk", 0x02924}, // NORTH EAST ARROW WITH HOOK -+ {"nearr", 0x02197}, // NORTH EAST ARROW -+ {"neArr", 0x021D7}, // NORTH EAST DOUBLE ARROW -+ {"nearrow", 0x02197}, // NORTH EAST ARROW -+// "nedot", 0x02250;0x00338}, // APPROACHES THE LIMIT with slash -+ {"NegativeMediumSpace", 0x0200B}, // ZERO WIDTH SPACE -+ {"NegativeThickSpace", 0x0200B}, // ZERO WIDTH SPACE -+ {"NegativeThinSpace", 0x0200B}, // ZERO WIDTH SPACE -+ {"NegativeVeryThinSpace", 0x0200B}, // ZERO WIDTH SPACE -+ {"nequiv", 0x02262}, // NOT IDENTICAL TO -+ {"nesear", 0x02928}, // NORTH EAST ARROW AND SOUTH EAST ARROW -+// "nesim", 0x02242;0x00338}, // MINUS TILDE with slash -+ {"NestedGreaterGreater", 0x0226B}, // MUCH GREATER-THAN -+ {"NestedLessLess", 0x0226A}, // MUCH LESS-THAN -+ {"NewLine", 0x0000A}, // LINE FEED (LF) -+ {"nexist", 0x02204}, // THERE DOES NOT EXIST -+ {"nexists", 0x02204}, // THERE DOES NOT EXIST -+ {"Nfr", 0x1D511}, // MATHEMATICAL FRAKTUR CAPITAL N -+ {"nfr", 0x1D52B}, // MATHEMATICAL FRAKTUR SMALL N -+// "ngE", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash -+ {"nge", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO -+ {"ngeq", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO -+// "ngeqq", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash -+// "ngeqslant", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash -+// "nges", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash -+// "nGg", 0x022D9;0x00338}, // VERY MUCH GREATER-THAN with slash -+ {"Ngr", 0x0039D}, // GREEK CAPITAL LETTER NU -+ {"ngr", 0x003BD}, // GREEK SMALL LETTER NU -+ {"ngsim", 0x02275}, // NEITHER GREATER-THAN NOR EQUIVALENT TO -+// "nGt", 0x0226B;0x020D2}, // MUCH GREATER THAN with vertical line -+ {"ngt", 0x0226F}, // NOT GREATER-THAN -+ {"ngtr", 0x0226F}, // NOT GREATER-THAN -+// "nGtv", 0x0226B;0x00338}, // MUCH GREATER THAN with slash -+ {"nharr", 0x021AE}, // LEFT RIGHT ARROW WITH STROKE -+ {"nhArr", 0x021CE}, // LEFT RIGHT DOUBLE ARROW WITH STROKE -+ {"nhpar", 0x02AF2}, // PARALLEL WITH HORIZONTAL STROKE -+ {"ni", 0x0220B}, // CONTAINS AS MEMBER -+ {"nis", 0x022FC}, // SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -+ {"nisd", 0x022FA}, // CONTAINS WITH LONG HORIZONTAL STROKE -+ {"niv", 0x0220B}, // CONTAINS AS MEMBER -+ {"NJcy", 0x0040A}, // CYRILLIC CAPITAL LETTER NJE -+ {"njcy", 0x0045A}, // CYRILLIC SMALL LETTER NJE -+ {"nlarr", 0x0219A}, // LEFTWARDS ARROW WITH STROKE -+ {"nlArr", 0x021CD}, // LEFTWARDS DOUBLE ARROW WITH STROKE -+ {"nldr", 0x02025}, // TWO DOT LEADER -+// "nlE", 0x02266;0x00338}, // LESS-THAN OVER EQUAL TO with slash -+ {"nle", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO -+ {"nleftarrow", 0x0219A}, // LEFTWARDS ARROW WITH STROKE -+ {"nLeftarrow", 0x021CD}, // LEFTWARDS DOUBLE ARROW WITH STROKE -+ {"nleftrightarrow", 0x021AE}, // LEFT RIGHT ARROW WITH STROKE -+ {"nLeftrightarrow", 0x021CE}, // LEFT RIGHT DOUBLE ARROW WITH STROKE -+ {"nleq", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO -+// "nleqq", 0x02266;0x00338}, // LESS-THAN OVER EQUAL TO with slash -+// "nleqslant", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash -+// "nles", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash -+ {"nless", 0x0226E}, // NOT LESS-THAN -+// "nLl", 0x022D8;0x00338}, // VERY MUCH LESS-THAN with slash -+ {"nlsim", 0x02274}, // NEITHER LESS-THAN NOR EQUIVALENT TO -+// "nLt", 0x0226A;0x020D2}, // MUCH LESS THAN with vertical line -+ {"nlt", 0x0226E}, // NOT LESS-THAN -+ {"nltri", 0x022EA}, // NOT NORMAL SUBGROUP OF -+ {"nltrie", 0x022EC}, // NOT NORMAL SUBGROUP OF OR EQUAL TO -+// "nLtv", 0x0226A;0x00338}, // MUCH LESS THAN with slash -+ {"nmid", 0x02224}, // DOES NOT DIVIDE -+ {"NoBreak", 0x02060}, // WORD JOINER -+ {"NonBreakingSpace", 0x000A0}, // NO-BREAK SPACE -+ {"Nopf", 0x02115}, // DOUBLE-STRUCK CAPITAL N -+ {"nopf", 0x1D55F}, // MATHEMATICAL DOUBLE-STRUCK SMALL N -+ {"not", 0x000AC}, // NOT SIGN -+ {"Not", 0x02AEC}, // DOUBLE STROKE NOT SIGN -+ {"NotCongruent", 0x02262}, // NOT IDENTICAL TO -+ {"NotCupCap", 0x0226D}, // NOT EQUIVALENT TO -+ {"NotDoubleVerticalBar", 0x02226}, // NOT PARALLEL TO -+ {"NotElement", 0x02209}, // NOT AN ELEMENT OF -+ {"NotEqual", 0x02260}, // NOT EQUAL TO -+// "NotEqualTilde", 0x02242;0x00338}, // MINUS TILDE with slash -+ {"NotExists", 0x02204}, // THERE DOES NOT EXIST -+ {"NotGreater", 0x0226F}, // NOT GREATER-THAN -+ {"NotGreaterEqual", 0x02271}, // NEITHER GREATER-THAN NOR EQUAL TO -+// "NotGreaterFullEqual", 0x02267;0x00338}, // GREATER-THAN OVER EQUAL TO with slash -+// "NotGreaterGreater", 0x0226B;0x00338}, // MUCH GREATER THAN with slash -+ {"NotGreaterLess", 0x02279}, // NEITHER GREATER-THAN NOR LESS-THAN -+// "NotGreaterSlantEqual", 0x02A7E;0x00338}, // GREATER-THAN OR SLANTED EQUAL TO with slash -+ {"NotGreaterTilde", 0x02275}, // NEITHER GREATER-THAN NOR EQUIVALENT TO -+// "NotHumpDownHump", 0x0224E;0x00338}, // GEOMETRICALLY EQUIVALENT TO with slash -+// "NotHumpEqual", 0x0224F;0x00338}, // DIFFERENCE BETWEEN with slash -+ {"notin", 0x02209}, // NOT AN ELEMENT OF -+// "notindot", 0x022F5;0x00338}, // ELEMENT OF WITH DOT ABOVE with slash -+// "notinE", 0x022F9;0x00338}, // ELEMENT OF WITH TWO HORIZONTAL STROKES with slash -+ {"notinva", 0x02209}, // NOT AN ELEMENT OF -+ {"notinvb", 0x022F7}, // SMALL ELEMENT OF WITH OVERBAR -+ {"notinvc", 0x022F6}, // ELEMENT OF WITH OVERBAR -+ {"NotLeftTriangle", 0x022EA}, // NOT NORMAL SUBGROUP OF -+// "NotLeftTriangleBar", 0x029CF;0x00338}, // LEFT TRIANGLE BESIDE VERTICAL BAR with slash -+ {"NotLeftTriangleEqual", 0x022EC}, // NOT NORMAL SUBGROUP OF OR EQUAL TO -+ {"NotLess", 0x0226E}, // NOT LESS-THAN -+ {"NotLessEqual", 0x02270}, // NEITHER LESS-THAN NOR EQUAL TO -+ {"NotLessGreater", 0x02278}, // NEITHER LESS-THAN NOR GREATER-THAN -+// "NotLessLess", 0x0226A;0x00338}, // MUCH LESS THAN with slash -+// "NotLessSlantEqual", 0x02A7D;0x00338}, // LESS-THAN OR SLANTED EQUAL TO with slash -+ {"NotLessTilde", 0x02274}, // NEITHER LESS-THAN NOR EQUIVALENT TO -+// "NotNestedGreaterGreater", 0x02AA2;0x00338}, // DOUBLE NESTED GREATER-THAN with slash -+// "NotNestedLessLess", 0x02AA1;0x00338}, // DOUBLE NESTED LESS-THAN with slash -+ {"notni", 0x0220C}, // DOES NOT CONTAIN AS MEMBER -+ {"notniva", 0x0220C}, // DOES NOT CONTAIN AS MEMBER -+ {"notnivb", 0x022FE}, // SMALL CONTAINS WITH OVERBAR -+ {"notnivc", 0x022FD}, // CONTAINS WITH OVERBAR -+ {"NotPrecedes", 0x02280}, // DOES NOT PRECEDE -+// "NotPrecedesEqual", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"NotPrecedesSlantEqual", 0x022E0}, // DOES NOT PRECEDE OR EQUAL -+ {"NotReverseElement", 0x0220C}, // DOES NOT CONTAIN AS MEMBER -+ {"NotRightTriangle", 0x022EB}, // DOES NOT CONTAIN AS NORMAL SUBGROUP -+// "NotRightTriangleBar", 0x029D0;0x00338}, // VERTICAL BAR BESIDE RIGHT TRIANGLE with slash -+ {"NotRightTriangleEqual", 0x022ED}, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -+// "NotSquareSubset", 0x0228F;0x00338}, // SQUARE IMAGE OF with slash -+ {"NotSquareSubsetEqual", 0x022E2}, // NOT SQUARE IMAGE OF OR EQUAL TO -+// "NotSquareSuperset", 0x02290;0x00338}, // SQUARE ORIGINAL OF with slash -+ {"NotSquareSupersetEqual", 0x022E3}, // NOT SQUARE ORIGINAL OF OR EQUAL TO -+// "NotSubset", 0x02282;0x020D2}, // SUBSET OF with vertical line -+ {"NotSubsetEqual", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO -+ {"NotSucceeds", 0x02281}, // DOES NOT SUCCEED -+// "NotSucceedsEqual", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"NotSucceedsSlantEqual", 0x022E1}, // DOES NOT SUCCEED OR EQUAL -+// "NotSucceedsTilde", 0x0227F;0x00338}, // SUCCEEDS OR EQUIVALENT TO with slash -+// "NotSuperset", 0x02283;0x020D2}, // SUPERSET OF with vertical line -+ {"NotSupersetEqual", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO -+ {"NotTilde", 0x02241}, // NOT TILDE -+ {"NotTildeEqual", 0x02244}, // NOT ASYMPTOTICALLY EQUAL TO -+ {"NotTildeFullEqual", 0x02247}, // NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO -+ {"NotTildeTilde", 0x02249}, // NOT ALMOST EQUAL TO -+ {"NotVerticalBar", 0x02224}, // DOES NOT DIVIDE -+ {"npar", 0x02226}, // NOT PARALLEL TO -+ {"nparallel", 0x02226}, // NOT PARALLEL TO -+// "nparsl", 0x02AFD;0x020E5}, // DOUBLE SOLIDUS OPERATOR with reverse slash -+// "npart", 0x02202;0x00338}, // PARTIAL DIFFERENTIAL with slash -+ {"npolint", 0x02A14}, // LINE INTEGRATION NOT INCLUDING THE POLE -+ {"npr", 0x02280}, // DOES NOT PRECEDE -+ {"nprcue", 0x022E0}, // DOES NOT PRECEDE OR EQUAL -+// "npre", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"nprec", 0x02280}, // DOES NOT PRECEDE -+// "npreceq", 0x02AAF;0x00338}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"nrarr", 0x0219B}, // RIGHTWARDS ARROW WITH STROKE -+ {"nrArr", 0x021CF}, // RIGHTWARDS DOUBLE ARROW WITH STROKE -+// "nrarrc", 0x02933;0x00338}, // WAVE ARROW POINTING DIRECTLY RIGHT with slash -+// "nrarrw", 0x0219D;0x00338}, // RIGHTWARDS WAVE ARROW with slash -+ {"nrightarrow", 0x0219B}, // RIGHTWARDS ARROW WITH STROKE -+ {"nRightarrow", 0x021CF}, // RIGHTWARDS DOUBLE ARROW WITH STROKE -+ {"nrtri", 0x022EB}, // DOES NOT CONTAIN AS NORMAL SUBGROUP -+ {"nrtrie", 0x022ED}, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -+ {"nsc", 0x02281}, // DOES NOT SUCCEED -+ {"nsccue", 0x022E1}, // DOES NOT SUCCEED OR EQUAL -+// "nsce", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"Nscr", 0x1D4A9}, // MATHEMATICAL SCRIPT CAPITAL N -+ {"nscr", 0x1D4C3}, // MATHEMATICAL SCRIPT SMALL N -+ {"nshortmid", 0x02224}, // DOES NOT DIVIDE -+ {"nshortparallel", 0x02226}, // NOT PARALLEL TO -+ {"nsim", 0x02241}, // NOT TILDE -+ {"nsime", 0x02244}, // NOT ASYMPTOTICALLY EQUAL TO -+ {"nsimeq", 0x02244}, // NOT ASYMPTOTICALLY EQUAL TO -+ {"nsmid", 0x02224}, // DOES NOT DIVIDE -+ {"nspar", 0x02226}, // NOT PARALLEL TO -+ {"nsqsube", 0x022E2}, // NOT SQUARE IMAGE OF OR EQUAL TO -+ {"nsqsupe", 0x022E3}, // NOT SQUARE ORIGINAL OF OR EQUAL TO -+ {"nsub", 0x02284}, // NOT A SUBSET OF -+ {"nsube", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO -+// "nsubE", 0x02AC5;0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash -+// "nsubset", 0x02282;0x020D2}, // SUBSET OF with vertical line -+ {"nsubseteq", 0x02288}, // NEITHER A SUBSET OF NOR EQUAL TO -+// "nsubseteqq", 0x02AC5;0x00338}, // SUBSET OF ABOVE EQUALS SIGN with slash -+ {"nsucc", 0x02281}, // DOES NOT SUCCEED -+// "nsucceq", 0x02AB0;0x00338}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash -+ {"nsup", 0x02285}, // NOT A SUPERSET OF -+ {"nsupe", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO -+// "nsupE", 0x02AC6;0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash -+// "nsupset", 0x02283;0x020D2}, // SUPERSET OF with vertical line -+ {"nsupseteq", 0x02289}, // NEITHER A SUPERSET OF NOR EQUAL TO -+// "nsupseteqq", 0x02AC6;0x00338}, // SUPERSET OF ABOVE EQUALS SIGN with slash -+ {"ntgl", 0x02279}, // NEITHER GREATER-THAN NOR LESS-THAN -+ {"Ntilde", 0x000D1}, // LATIN CAPITAL LETTER N WITH TILDE -+ {"ntilde", 0x000F1}, // LATIN SMALL LETTER N WITH TILDE -+ {"ntlg", 0x02278}, // NEITHER LESS-THAN NOR GREATER-THAN -+ {"ntriangleleft", 0x022EA}, // NOT NORMAL SUBGROUP OF -+ {"ntrianglelefteq", 0x022EC}, // NOT NORMAL SUBGROUP OF OR EQUAL TO -+ {"ntriangleright", 0x022EB}, // DOES NOT CONTAIN AS NORMAL SUBGROUP -+ {"ntrianglerighteq", 0x022ED}, // DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL -+ {"Nu", 0x0039D}, // GREEK CAPITAL LETTER NU -+ {"nu", 0x003BD}, // GREEK SMALL LETTER NU -+ {"num", 0x00023}, // NUMBER SIGN -+ {"numero", 0x02116}, // NUMERO SIGN -+ {"numsp", 0x02007}, // FIGURE SPACE -+// "nvap", 0x0224D;0x020D2}, // EQUIVALENT TO with vertical line -+ {"nvdash", 0x022AC}, // DOES NOT PROVE -+ {"nvDash", 0x022AD}, // NOT TRUE -+ {"nVdash", 0x022AE}, // DOES NOT FORCE -+ {"nVDash", 0x022AF}, // NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE -+// "nvge", 0x02265;0x020D2}, // GREATER-THAN OR EQUAL TO with vertical line -+// "nvgt", 0x0003E;0x020D2}, // GREATER-THAN SIGN with vertical line -+ {"nvHarr", 0x02904}, // LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE -+ {"nvinfin", 0x029DE}, // INFINITY NEGATED WITH VERTICAL BAR -+ {"nvlArr", 0x02902}, // LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE -+// "nvle", 0x02264;0x020D2}, // LESS-THAN OR EQUAL TO with vertical line -+// "nvlt", 0x0003C;0x020D2}, // LESS-THAN SIGN with vertical line -+// "nvltrie", 0x022B4;0x020D2}, // NORMAL SUBGROUP OF OR EQUAL TO with vertical line -+ {"nvrArr", 0x02903}, // RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE -+// "nvrtrie", 0x022B5;0x020D2}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO with vertical line -+// "nvsim", 0x0223C;0x020D2}, // TILDE OPERATOR with vertical line -+ {"nwarhk", 0x02923}, // NORTH WEST ARROW WITH HOOK -+ {"nwarr", 0x02196}, // NORTH WEST ARROW -+ {"nwArr", 0x021D6}, // NORTH WEST DOUBLE ARROW -+ {"nwarrow", 0x02196}, // NORTH WEST ARROW -+ {"nwnear", 0x02927}, // NORTH WEST ARROW AND NORTH EAST ARROW -+ {NULL, 0} - }; - - static NameId namesO[]={ -- "Oacgr", 0x0038C, // GREEK CAPITAL LETTER OMICRON WITH TONOS -- "oacgr", 0x003CC, // GREEK SMALL LETTER OMICRON WITH TONOS -- "Oacute", 0x000D3, // LATIN CAPITAL LETTER O WITH ACUTE -- "oacute", 0x000F3, // LATIN SMALL LETTER O WITH ACUTE -- "oast", 0x0229B, // CIRCLED ASTERISK OPERATOR -- "ocir", 0x0229A, // CIRCLED RING OPERATOR -- "Ocirc", 0x000D4, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX -- "ocirc", 0x000F4, // LATIN SMALL LETTER O WITH CIRCUMFLEX -- "Ocy", 0x0041E, // CYRILLIC CAPITAL LETTER O -- "ocy", 0x0043E, // CYRILLIC SMALL LETTER O -- "odash", 0x0229D, // CIRCLED DASH -- "Odblac", 0x00150, // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -- "odblac", 0x00151, // LATIN SMALL LETTER O WITH DOUBLE ACUTE -- "odiv", 0x02A38, // CIRCLED DIVISION SIGN -- "odot", 0x02299, // CIRCLED DOT OPERATOR -- "odsold", 0x029BC, // CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN -- "OElig", 0x00152, // LATIN CAPITAL LIGATURE OE -- "oelig", 0x00153, // LATIN SMALL LIGATURE OE -- "ofcir", 0x029BF, // CIRCLED BULLET -- "Ofr", 0x1D512, // MATHEMATICAL FRAKTUR CAPITAL O -- "ofr", 0x1D52C, // MATHEMATICAL FRAKTUR SMALL O -- "ogon", 0x002DB, // OGONEK -- "Ogr", 0x0039F, // GREEK CAPITAL LETTER OMICRON -- "ogr", 0x003BF, // GREEK SMALL LETTER OMICRON -- "Ograve", 0x000D2, // LATIN CAPITAL LETTER O WITH GRAVE -- "ograve", 0x000F2, // LATIN SMALL LETTER O WITH GRAVE -- "ogt", 0x029C1, // CIRCLED GREATER-THAN -- "OHacgr", 0x0038F, // GREEK CAPITAL LETTER OMEGA WITH TONOS -- "ohacgr", 0x003CE, // GREEK SMALL LETTER OMEGA WITH TONOS -- "ohbar", 0x029B5, // CIRCLE WITH HORIZONTAL BAR -- "OHgr", 0x003A9, // GREEK CAPITAL LETTER OMEGA -- "ohgr", 0x003C9, // GREEK SMALL LETTER OMEGA -- "ohm", 0x003A9, // GREEK CAPITAL LETTER OMEGA -- "oint", 0x0222E, // CONTOUR INTEGRAL -- "olarr", 0x021BA, // ANTICLOCKWISE OPEN CIRCLE ARROW -- "olcir", 0x029BE, // CIRCLED WHITE BULLET -- "olcross", 0x029BB, // CIRCLE WITH SUPERIMPOSED X -- "oline", 0x0203E, // OVERLINE -- "olt", 0x029C0, // CIRCLED LESS-THAN -- "Omacr", 0x0014C, // LATIN CAPITAL LETTER O WITH MACRON -- "omacr", 0x0014D, // LATIN SMALL LETTER O WITH MACRON -- "Omega", 0x003A9, // GREEK CAPITAL LETTER OMEGA -- "omega", 0x003C9, // GREEK SMALL LETTER OMEGA -- "Omicron", 0x0039F, // GREEK CAPITAL LETTER OMICRON -- "omicron", 0x003BF, // GREEK SMALL LETTER OMICRON -- "omid", 0x029B6, // CIRCLED VERTICAL BAR -- "ominus", 0x02296, // CIRCLED MINUS -- "Oopf", 0x1D546, // MATHEMATICAL DOUBLE-STRUCK CAPITAL O -- "oopf", 0x1D560, // MATHEMATICAL DOUBLE-STRUCK SMALL O -- "opar", 0x029B7, // CIRCLED PARALLEL -- "OpenCurlyDoubleQuote", 0x0201C, // LEFT DOUBLE QUOTATION MARK -- "OpenCurlyQuote", 0x02018, // LEFT SINGLE QUOTATION MARK -- "operp", 0x029B9, // CIRCLED PERPENDICULAR -- "oplus", 0x02295, // CIRCLED PLUS -- "or", 0x02228, // LOGICAL OR -- "Or", 0x02A54, // DOUBLE LOGICAL OR -- "orarr", 0x021BB, // CLOCKWISE OPEN CIRCLE ARROW -- "ord", 0x02A5D, // LOGICAL OR WITH HORIZONTAL DASH -- "order", 0x02134, // SCRIPT SMALL O -- "orderof", 0x02134, // SCRIPT SMALL O -- "ordf", 0x000AA, // FEMININE ORDINAL INDICATOR -- "ordm", 0x000BA, // MASCULINE ORDINAL INDICATOR -- "origof", 0x022B6, // ORIGINAL OF -- "oror", 0x02A56, // TWO INTERSECTING LOGICAL OR -- "orslope", 0x02A57, // SLOPING LARGE OR -- "orv", 0x02A5B, // LOGICAL OR WITH MIDDLE STEM -- "oS", 0x024C8, // CIRCLED LATIN CAPITAL LETTER S -- "oscr", 0x02134, // SCRIPT SMALL O -- "Oscr", 0x1D4AA, // MATHEMATICAL SCRIPT CAPITAL O -- "Oslash", 0x000D8, // LATIN CAPITAL LETTER O WITH STROKE -- "oslash", 0x000F8, // LATIN SMALL LETTER O WITH STROKE -- "osol", 0x02298, // CIRCLED DIVISION SLASH -- "Otilde", 0x000D5, // LATIN CAPITAL LETTER O WITH TILDE -- "otilde", 0x000F5, // LATIN SMALL LETTER O WITH TILDE -- "otimes", 0x02297, // CIRCLED TIMES -- "Otimes", 0x02A37, // MULTIPLICATION SIGN IN DOUBLE CIRCLE -- "otimesas", 0x02A36, // CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT -- "Ouml", 0x000D6, // LATIN CAPITAL LETTER O WITH DIAERESIS -- "ouml", 0x000F6, // LATIN SMALL LETTER O WITH DIAERESIS -- "ovbar", 0x0233D, // APL FUNCTIONAL SYMBOL CIRCLE STILE -- "OverBar", 0x0203E, // OVERLINE -- "OverBrace", 0x023DE, // TOP CURLY BRACKET -- "OverBracket", 0x023B4, // TOP SQUARE BRACKET -- "OverParenthesis", 0x023DC, // TOP PARENTHESIS -- NULL, 0 -+ {"Oacgr", 0x0038C}, // GREEK CAPITAL LETTER OMICRON WITH TONOS -+ {"oacgr", 0x003CC}, // GREEK SMALL LETTER OMICRON WITH TONOS -+ {"Oacute", 0x000D3}, // LATIN CAPITAL LETTER O WITH ACUTE -+ {"oacute", 0x000F3}, // LATIN SMALL LETTER O WITH ACUTE -+ {"oast", 0x0229B}, // CIRCLED ASTERISK OPERATOR -+ {"ocir", 0x0229A}, // CIRCLED RING OPERATOR -+ {"Ocirc", 0x000D4}, // LATIN CAPITAL LETTER O WITH CIRCUMFLEX -+ {"ocirc", 0x000F4}, // LATIN SMALL LETTER O WITH CIRCUMFLEX -+ {"Ocy", 0x0041E}, // CYRILLIC CAPITAL LETTER O -+ {"ocy", 0x0043E}, // CYRILLIC SMALL LETTER O -+ {"odash", 0x0229D}, // CIRCLED DASH -+ {"Odblac", 0x00150}, // LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -+ {"odblac", 0x00151}, // LATIN SMALL LETTER O WITH DOUBLE ACUTE -+ {"odiv", 0x02A38}, // CIRCLED DIVISION SIGN -+ {"odot", 0x02299}, // CIRCLED DOT OPERATOR -+ {"odsold", 0x029BC}, // CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN -+ {"OElig", 0x00152}, // LATIN CAPITAL LIGATURE OE -+ {"oelig", 0x00153}, // LATIN SMALL LIGATURE OE -+ {"ofcir", 0x029BF}, // CIRCLED BULLET -+ {"Ofr", 0x1D512}, // MATHEMATICAL FRAKTUR CAPITAL O -+ {"ofr", 0x1D52C}, // MATHEMATICAL FRAKTUR SMALL O -+ {"ogon", 0x002DB}, // OGONEK -+ {"Ogr", 0x0039F}, // GREEK CAPITAL LETTER OMICRON -+ {"ogr", 0x003BF}, // GREEK SMALL LETTER OMICRON -+ {"Ograve", 0x000D2}, // LATIN CAPITAL LETTER O WITH GRAVE -+ {"ograve", 0x000F2}, // LATIN SMALL LETTER O WITH GRAVE -+ {"ogt", 0x029C1}, // CIRCLED GREATER-THAN -+ {"OHacgr", 0x0038F}, // GREEK CAPITAL LETTER OMEGA WITH TONOS -+ {"ohacgr", 0x003CE}, // GREEK SMALL LETTER OMEGA WITH TONOS -+ {"ohbar", 0x029B5}, // CIRCLE WITH HORIZONTAL BAR -+ {"OHgr", 0x003A9}, // GREEK CAPITAL LETTER OMEGA -+ {"ohgr", 0x003C9}, // GREEK SMALL LETTER OMEGA -+ {"ohm", 0x003A9}, // GREEK CAPITAL LETTER OMEGA -+ {"oint", 0x0222E}, // CONTOUR INTEGRAL -+ {"olarr", 0x021BA}, // ANTICLOCKWISE OPEN CIRCLE ARROW -+ {"olcir", 0x029BE}, // CIRCLED WHITE BULLET -+ {"olcross", 0x029BB}, // CIRCLE WITH SUPERIMPOSED X -+ {"oline", 0x0203E}, // OVERLINE -+ {"olt", 0x029C0}, // CIRCLED LESS-THAN -+ {"Omacr", 0x0014C}, // LATIN CAPITAL LETTER O WITH MACRON -+ {"omacr", 0x0014D}, // LATIN SMALL LETTER O WITH MACRON -+ {"Omega", 0x003A9}, // GREEK CAPITAL LETTER OMEGA -+ {"omega", 0x003C9}, // GREEK SMALL LETTER OMEGA -+ {"Omicron", 0x0039F}, // GREEK CAPITAL LETTER OMICRON -+ {"omicron", 0x003BF}, // GREEK SMALL LETTER OMICRON -+ {"omid", 0x029B6}, // CIRCLED VERTICAL BAR -+ {"ominus", 0x02296}, // CIRCLED MINUS -+ {"Oopf", 0x1D546}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL O -+ {"oopf", 0x1D560}, // MATHEMATICAL DOUBLE-STRUCK SMALL O -+ {"opar", 0x029B7}, // CIRCLED PARALLEL -+ {"OpenCurlyDoubleQuote", 0x0201C}, // LEFT DOUBLE QUOTATION MARK -+ {"OpenCurlyQuote", 0x02018}, // LEFT SINGLE QUOTATION MARK -+ {"operp", 0x029B9}, // CIRCLED PERPENDICULAR -+ {"oplus", 0x02295}, // CIRCLED PLUS -+ {"or", 0x02228}, // LOGICAL OR -+ {"Or", 0x02A54}, // DOUBLE LOGICAL OR -+ {"orarr", 0x021BB}, // CLOCKWISE OPEN CIRCLE ARROW -+ {"ord", 0x02A5D}, // LOGICAL OR WITH HORIZONTAL DASH -+ {"order", 0x02134}, // SCRIPT SMALL O -+ {"orderof", 0x02134}, // SCRIPT SMALL O -+ {"ordf", 0x000AA}, // FEMININE ORDINAL INDICATOR -+ {"ordm", 0x000BA}, // MASCULINE ORDINAL INDICATOR -+ {"origof", 0x022B6}, // ORIGINAL OF -+ {"oror", 0x02A56}, // TWO INTERSECTING LOGICAL OR -+ {"orslope", 0x02A57}, // SLOPING LARGE OR -+ {"orv", 0x02A5B}, // LOGICAL OR WITH MIDDLE STEM -+ {"oS", 0x024C8}, // CIRCLED LATIN CAPITAL LETTER S -+ {"oscr", 0x02134}, // SCRIPT SMALL O -+ {"Oscr", 0x1D4AA}, // MATHEMATICAL SCRIPT CAPITAL O -+ {"Oslash", 0x000D8}, // LATIN CAPITAL LETTER O WITH STROKE -+ {"oslash", 0x000F8}, // LATIN SMALL LETTER O WITH STROKE -+ {"osol", 0x02298}, // CIRCLED DIVISION SLASH -+ {"Otilde", 0x000D5}, // LATIN CAPITAL LETTER O WITH TILDE -+ {"otilde", 0x000F5}, // LATIN SMALL LETTER O WITH TILDE -+ {"otimes", 0x02297}, // CIRCLED TIMES -+ {"Otimes", 0x02A37}, // MULTIPLICATION SIGN IN DOUBLE CIRCLE -+ {"otimesas", 0x02A36}, // CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT -+ {"Ouml", 0x000D6}, // LATIN CAPITAL LETTER O WITH DIAERESIS -+ {"ouml", 0x000F6}, // LATIN SMALL LETTER O WITH DIAERESIS -+ {"ovbar", 0x0233D}, // APL FUNCTIONAL SYMBOL CIRCLE STILE -+ {"OverBar", 0x0203E}, // OVERLINE -+ {"OverBrace", 0x023DE}, // TOP CURLY BRACKET -+ {"OverBracket", 0x023B4}, // TOP SQUARE BRACKET -+ {"OverParenthesis", 0x023DC}, // TOP PARENTHESIS -+ {NULL, 0} - }; - - static NameId namesP[]={ -- "par", 0x02225, // PARALLEL TO -- "para", 0x000B6, // PILCROW SIGN -- "parallel", 0x02225, // PARALLEL TO -- "parsim", 0x02AF3, // PARALLEL WITH TILDE OPERATOR -- "parsl", 0x02AFD, // DOUBLE SOLIDUS OPERATOR -- "part", 0x02202, // PARTIAL DIFFERENTIAL -- "PartialD", 0x02202, // PARTIAL DIFFERENTIAL -- "Pcy", 0x0041F, // CYRILLIC CAPITAL LETTER PE -- "pcy", 0x0043F, // CYRILLIC SMALL LETTER PE -- "percnt", 0x00025, // PERCENT SIGN -- "period", 0x0002E, // FULL STOP -- "permil", 0x02030, // PER MILLE SIGN -- "perp", 0x022A5, // UP TACK -- "pertenk", 0x02031, // PER TEN THOUSAND SIGN -- "Pfr", 0x1D513, // MATHEMATICAL FRAKTUR CAPITAL P -- "pfr", 0x1D52D, // MATHEMATICAL FRAKTUR SMALL P -- "Pgr", 0x003A0, // GREEK CAPITAL LETTER PI -- "pgr", 0x003C0, // GREEK SMALL LETTER PI -- "PHgr", 0x003A6, // GREEK CAPITAL LETTER PHI -- "phgr", 0x003C6, // GREEK SMALL LETTER PHI -- "Phi", 0x003A6, // GREEK CAPITAL LETTER PHI -- "phi", 0x003C6, // GREEK SMALL LETTER PHI -- "phiv", 0x003D5, // GREEK PHI SYMBOL -- "phmmat", 0x02133, // SCRIPT CAPITAL M -- "phone", 0x0260E, // BLACK TELEPHONE -- "Pi", 0x003A0, // GREEK CAPITAL LETTER PI -- "pi", 0x003C0, // GREEK SMALL LETTER PI -- "pitchfork", 0x022D4, // PITCHFORK -- "piv", 0x003D6, // GREEK PI SYMBOL -- "planck", 0x0210F, // PLANCK CONSTANT OVER TWO PI -- "planckh", 0x0210E, // PLANCK CONSTANT -- "plankv", 0x0210F, // PLANCK CONSTANT OVER TWO PI -- "plus", 0x0002B, // PLUS SIGN -- "plusacir", 0x02A23, // PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE -- "plusb", 0x0229E, // SQUARED PLUS -- "pluscir", 0x02A22, // PLUS SIGN WITH SMALL CIRCLE ABOVE -- "plusdo", 0x02214, // DOT PLUS -- "plusdu", 0x02A25, // PLUS SIGN WITH DOT BELOW -- "pluse", 0x02A72, // PLUS SIGN ABOVE EQUALS SIGN -- "PlusMinus", 0x000B1, // PLUS-MINUS SIGN -- "plusmn", 0x000B1, // PLUS-MINUS SIGN -- "plussim", 0x02A26, // PLUS SIGN WITH TILDE BELOW -- "plustwo", 0x02A27, // PLUS SIGN WITH SUBSCRIPT TWO -- "pm", 0x000B1, // PLUS-MINUS SIGN -- "Poincareplane", 0x0210C, // BLACK-LETTER CAPITAL H -- "pointint", 0x02A15, // INTEGRAL AROUND A POINT OPERATOR -- "Popf", 0x02119, // DOUBLE-STRUCK CAPITAL P -- "popf", 0x1D561, // MATHEMATICAL DOUBLE-STRUCK SMALL P -- "pound", 0x000A3, // POUND SIGN -- "pr", 0x0227A, // PRECEDES -- "Pr", 0x02ABB, // DOUBLE PRECEDES -- "prap", 0x02AB7, // PRECEDES ABOVE ALMOST EQUAL TO -- "prcue", 0x0227C, // PRECEDES OR EQUAL TO -- "pre", 0x02AAF, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -- "prE", 0x02AB3, // PRECEDES ABOVE EQUALS SIGN -- "prec", 0x0227A, // PRECEDES -- "precapprox", 0x02AB7, // PRECEDES ABOVE ALMOST EQUAL TO -- "preccurlyeq", 0x0227C, // PRECEDES OR EQUAL TO -- "Precedes", 0x0227A, // PRECEDES -- "PrecedesEqual", 0x02AAF, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -- "PrecedesSlantEqual", 0x0227C, // PRECEDES OR EQUAL TO -- "PrecedesTilde", 0x0227E, // PRECEDES OR EQUIVALENT TO -- "preceq", 0x02AAF, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -- "precnapprox", 0x02AB9, // PRECEDES ABOVE NOT ALMOST EQUAL TO -- "precneqq", 0x02AB5, // PRECEDES ABOVE NOT EQUAL TO -- "precnsim", 0x022E8, // PRECEDES BUT NOT EQUIVALENT TO -- "precsim", 0x0227E, // PRECEDES OR EQUIVALENT TO -- "prime", 0x02032, // PRIME -- "Prime", 0x02033, // DOUBLE PRIME -- "primes", 0x02119, // DOUBLE-STRUCK CAPITAL P -- "prnap", 0x02AB9, // PRECEDES ABOVE NOT ALMOST EQUAL TO -- "prnE", 0x02AB5, // PRECEDES ABOVE NOT EQUAL TO -- "prnsim", 0x022E8, // PRECEDES BUT NOT EQUIVALENT TO -- "prod", 0x0220F, // N-ARY PRODUCT -- "Product", 0x0220F, // N-ARY PRODUCT -- "profalar", 0x0232E, // ALL AROUND-PROFILE -- "profline", 0x02312, // ARC -- "profsurf", 0x02313, // SEGMENT -- "prop", 0x0221D, // PROPORTIONAL TO -- "Proportion", 0x02237, // PROPORTION -- "Proportional", 0x0221D, // PROPORTIONAL TO -- "propto", 0x0221D, // PROPORTIONAL TO -- "prsim", 0x0227E, // PRECEDES OR EQUIVALENT TO -- "prurel", 0x022B0, // PRECEDES UNDER RELATION -- "Pscr", 0x1D4AB, // MATHEMATICAL SCRIPT CAPITAL P -- "pscr", 0x1D4C5, // MATHEMATICAL SCRIPT SMALL P -- "PSgr", 0x003A8, // GREEK CAPITAL LETTER PSI -- "psgr", 0x003C8, // GREEK SMALL LETTER PSI -- "Psi", 0x003A8, // GREEK CAPITAL LETTER PSI -- "psi", 0x003C8, // GREEK SMALL LETTER PSI -- "puncsp", 0x02008, // PUNCTUATION SPACE -- NULL, 0 -+ {"par", 0x02225}, // PARALLEL TO -+ {"para", 0x000B6}, // PILCROW SIGN -+ {"parallel", 0x02225}, // PARALLEL TO -+ {"parsim", 0x02AF3}, // PARALLEL WITH TILDE OPERATOR -+ {"parsl", 0x02AFD}, // DOUBLE SOLIDUS OPERATOR -+ {"part", 0x02202}, // PARTIAL DIFFERENTIAL -+ {"PartialD", 0x02202}, // PARTIAL DIFFERENTIAL -+ {"Pcy", 0x0041F}, // CYRILLIC CAPITAL LETTER PE -+ {"pcy", 0x0043F}, // CYRILLIC SMALL LETTER PE -+ {"percnt", 0x00025}, // PERCENT SIGN -+ {"period", 0x0002E}, // FULL STOP -+ {"permil", 0x02030}, // PER MILLE SIGN -+ {"perp", 0x022A5}, // UP TACK -+ {"pertenk", 0x02031}, // PER TEN THOUSAND SIGN -+ {"Pfr", 0x1D513}, // MATHEMATICAL FRAKTUR CAPITAL P -+ {"pfr", 0x1D52D}, // MATHEMATICAL FRAKTUR SMALL P -+ {"Pgr", 0x003A0}, // GREEK CAPITAL LETTER PI -+ {"pgr", 0x003C0}, // GREEK SMALL LETTER PI -+ {"PHgr", 0x003A6}, // GREEK CAPITAL LETTER PHI -+ {"phgr", 0x003C6}, // GREEK SMALL LETTER PHI -+ {"Phi", 0x003A6}, // GREEK CAPITAL LETTER PHI -+ {"phi", 0x003C6}, // GREEK SMALL LETTER PHI -+ {"phiv", 0x003D5}, // GREEK PHI SYMBOL -+ {"phmmat", 0x02133}, // SCRIPT CAPITAL M -+ {"phone", 0x0260E}, // BLACK TELEPHONE -+ {"Pi", 0x003A0}, // GREEK CAPITAL LETTER PI -+ {"pi", 0x003C0}, // GREEK SMALL LETTER PI -+ {"pitchfork", 0x022D4}, // PITCHFORK -+ {"piv", 0x003D6}, // GREEK PI SYMBOL -+ {"planck", 0x0210F}, // PLANCK CONSTANT OVER TWO PI -+ {"planckh", 0x0210E}, // PLANCK CONSTANT -+ {"plankv", 0x0210F}, // PLANCK CONSTANT OVER TWO PI -+ {"plus", 0x0002B}, // PLUS SIGN -+ {"plusacir", 0x02A23}, // PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE -+ {"plusb", 0x0229E}, // SQUARED PLUS -+ {"pluscir", 0x02A22}, // PLUS SIGN WITH SMALL CIRCLE ABOVE -+ {"plusdo", 0x02214}, // DOT PLUS -+ {"plusdu", 0x02A25}, // PLUS SIGN WITH DOT BELOW -+ {"pluse", 0x02A72}, // PLUS SIGN ABOVE EQUALS SIGN -+ {"PlusMinus", 0x000B1}, // PLUS-MINUS SIGN -+ {"plusmn", 0x000B1}, // PLUS-MINUS SIGN -+ {"plussim", 0x02A26}, // PLUS SIGN WITH TILDE BELOW -+ {"plustwo", 0x02A27}, // PLUS SIGN WITH SUBSCRIPT TWO -+ {"pm", 0x000B1}, // PLUS-MINUS SIGN -+ {"Poincareplane", 0x0210C}, // BLACK-LETTER CAPITAL H -+ {"pointint", 0x02A15}, // INTEGRAL AROUND A POINT OPERATOR -+ {"Popf", 0x02119}, // DOUBLE-STRUCK CAPITAL P -+ {"popf", 0x1D561}, // MATHEMATICAL DOUBLE-STRUCK SMALL P -+ {"pound", 0x000A3}, // POUND SIGN -+ {"pr", 0x0227A}, // PRECEDES -+ {"Pr", 0x02ABB}, // DOUBLE PRECEDES -+ {"prap", 0x02AB7}, // PRECEDES ABOVE ALMOST EQUAL TO -+ {"prcue", 0x0227C}, // PRECEDES OR EQUAL TO -+ {"pre", 0x02AAF}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -+ {"prE", 0x02AB3}, // PRECEDES ABOVE EQUALS SIGN -+ {"prec", 0x0227A}, // PRECEDES -+ {"precapprox", 0x02AB7}, // PRECEDES ABOVE ALMOST EQUAL TO -+ {"preccurlyeq", 0x0227C}, // PRECEDES OR EQUAL TO -+ {"Precedes", 0x0227A}, // PRECEDES -+ {"PrecedesEqual", 0x02AAF}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -+ {"PrecedesSlantEqual", 0x0227C}, // PRECEDES OR EQUAL TO -+ {"PrecedesTilde", 0x0227E}, // PRECEDES OR EQUIVALENT TO -+ {"preceq", 0x02AAF}, // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN -+ {"precnapprox", 0x02AB9}, // PRECEDES ABOVE NOT ALMOST EQUAL TO -+ {"precneqq", 0x02AB5}, // PRECEDES ABOVE NOT EQUAL TO -+ {"precnsim", 0x022E8}, // PRECEDES BUT NOT EQUIVALENT TO -+ {"precsim", 0x0227E}, // PRECEDES OR EQUIVALENT TO -+ {"prime", 0x02032}, // PRIME -+ {"Prime", 0x02033}, // DOUBLE PRIME -+ {"primes", 0x02119}, // DOUBLE-STRUCK CAPITAL P -+ {"prnap", 0x02AB9}, // PRECEDES ABOVE NOT ALMOST EQUAL TO -+ {"prnE", 0x02AB5}, // PRECEDES ABOVE NOT EQUAL TO -+ {"prnsim", 0x022E8}, // PRECEDES BUT NOT EQUIVALENT TO -+ {"prod", 0x0220F}, // N-ARY PRODUCT -+ {"Product", 0x0220F}, // N-ARY PRODUCT -+ {"profalar", 0x0232E}, // ALL AROUND-PROFILE -+ {"profline", 0x02312}, // ARC -+ {"profsurf", 0x02313}, // SEGMENT -+ {"prop", 0x0221D}, // PROPORTIONAL TO -+ {"Proportion", 0x02237}, // PROPORTION -+ {"Proportional", 0x0221D}, // PROPORTIONAL TO -+ {"propto", 0x0221D}, // PROPORTIONAL TO -+ {"prsim", 0x0227E}, // PRECEDES OR EQUIVALENT TO -+ {"prurel", 0x022B0}, // PRECEDES UNDER RELATION -+ {"Pscr", 0x1D4AB}, // MATHEMATICAL SCRIPT CAPITAL P -+ {"pscr", 0x1D4C5}, // MATHEMATICAL SCRIPT SMALL P -+ {"PSgr", 0x003A8}, // GREEK CAPITAL LETTER PSI -+ {"psgr", 0x003C8}, // GREEK SMALL LETTER PSI -+ {"Psi", 0x003A8}, // GREEK CAPITAL LETTER PSI -+ {"psi", 0x003C8}, // GREEK SMALL LETTER PSI -+ {"puncsp", 0x02008}, // PUNCTUATION SPACE -+ {NULL, 0} - }; - - static NameId namesQ[]={ -- "Qfr", 0x1D514, // MATHEMATICAL FRAKTUR CAPITAL Q -- "qfr", 0x1D52E, // MATHEMATICAL FRAKTUR SMALL Q -- "qint", 0x02A0C, // QUADRUPLE INTEGRAL OPERATOR -- "Qopf", 0x0211A, // DOUBLE-STRUCK CAPITAL Q -- "qopf", 0x1D562, // MATHEMATICAL DOUBLE-STRUCK SMALL Q -- "qprime", 0x02057, // QUADRUPLE PRIME -- "Qscr", 0x1D4AC, // MATHEMATICAL SCRIPT CAPITAL Q -- "qscr", 0x1D4C6, // MATHEMATICAL SCRIPT SMALL Q -- "quaternions", 0x0210D, // DOUBLE-STRUCK CAPITAL H -- "quatint", 0x02A16, // QUATERNION INTEGRAL OPERATOR -- "quest", 0x0003F, // QUESTION MARK -- "questeq", 0x0225F, // QUESTIONED EQUAL TO -- "quot", 0x00022, // QUOTATION MARK -- "QUOT", 0x00022, // QUOTATION MARK -- NULL, 0 -+ {"Qfr", 0x1D514}, // MATHEMATICAL FRAKTUR CAPITAL Q -+ {"qfr", 0x1D52E}, // MATHEMATICAL FRAKTUR SMALL Q -+ {"qint", 0x02A0C}, // QUADRUPLE INTEGRAL OPERATOR -+ {"Qopf", 0x0211A}, // DOUBLE-STRUCK CAPITAL Q -+ {"qopf", 0x1D562}, // MATHEMATICAL DOUBLE-STRUCK SMALL Q -+ {"qprime", 0x02057}, // QUADRUPLE PRIME -+ {"Qscr", 0x1D4AC}, // MATHEMATICAL SCRIPT CAPITAL Q -+ {"qscr", 0x1D4C6}, // MATHEMATICAL SCRIPT SMALL Q -+ {"quaternions", 0x0210D}, // DOUBLE-STRUCK CAPITAL H -+ {"quatint", 0x02A16}, // QUATERNION INTEGRAL OPERATOR -+ {"quest", 0x0003F}, // QUESTION MARK -+ {"questeq", 0x0225F}, // QUESTIONED EQUAL TO -+ {"quot", 0x00022}, // QUOTATION MARK -+ {"QUOT", 0x00022}, // QUOTATION MARK -+ {NULL, 0} - }; - - static NameId namesR[]={ -- "rAarr", 0x021DB, // RIGHTWARDS TRIPLE ARROW --// "race", 0x0223D;0x00331, // REVERSED TILDE with underline -- "Racute", 0x00154, // LATIN CAPITAL LETTER R WITH ACUTE -- "racute", 0x00155, // LATIN SMALL LETTER R WITH ACUTE -- "radic", 0x0221A, // SQUARE ROOT -- "raemptyv", 0x029B3, // EMPTY SET WITH RIGHT ARROW ABOVE -- "rang", 0x027E9, // MATHEMATICAL RIGHT ANGLE BRACKET -- "Rang", 0x027EB, // MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET -- "rangd", 0x02992, // RIGHT ANGLE BRACKET WITH DOT -- "range", 0x029A5, // REVERSED ANGLE WITH UNDERBAR -- "rangle", 0x027E9, // MATHEMATICAL RIGHT ANGLE BRACKET -- "raquo", 0x000BB, // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -- "rarr", 0x02192, // RIGHTWARDS ARROW -- "Rarr", 0x021A0, // RIGHTWARDS TWO HEADED ARROW -- "rArr", 0x021D2, // RIGHTWARDS DOUBLE ARROW -- "rarrap", 0x02975, // RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO -- "rarrb", 0x021E5, // RIGHTWARDS ARROW TO BAR -- "rarrbfs", 0x02920, // RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND -- "rarrc", 0x02933, // WAVE ARROW POINTING DIRECTLY RIGHT -- "rarrfs", 0x0291E, // RIGHTWARDS ARROW TO BLACK DIAMOND -- "rarrhk", 0x021AA, // RIGHTWARDS ARROW WITH HOOK -- "rarrlp", 0x021AC, // RIGHTWARDS ARROW WITH LOOP -- "rarrpl", 0x02945, // RIGHTWARDS ARROW WITH PLUS BELOW -- "rarrsim", 0x02974, // RIGHTWARDS ARROW ABOVE TILDE OPERATOR -- "rarrtl", 0x021A3, // RIGHTWARDS ARROW WITH TAIL -- "Rarrtl", 0x02916, // RIGHTWARDS TWO-HEADED ARROW WITH TAIL -- "rarrw", 0x0219D, // RIGHTWARDS WAVE ARROW -- "ratail", 0x0291A, // RIGHTWARDS ARROW-TAIL -- "rAtail", 0x0291C, // RIGHTWARDS DOUBLE ARROW-TAIL -- "ratio", 0x02236, // RATIO -- "rationals", 0x0211A, // DOUBLE-STRUCK CAPITAL Q -- "rbarr", 0x0290D, // RIGHTWARDS DOUBLE DASH ARROW -- "rBarr", 0x0290F, // RIGHTWARDS TRIPLE DASH ARROW -- "RBarr", 0x02910, // RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW -- "rbbrk", 0x02773, // LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT -- "rbrace", 0x0007D, // RIGHT CURLY BRACKET -- "rbrack", 0x0005D, // RIGHT SQUARE BRACKET -- "rbrke", 0x0298C, // RIGHT SQUARE BRACKET WITH UNDERBAR -- "rbrksld", 0x0298E, // RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER -- "rbrkslu", 0x02990, // RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER -- "Rcaron", 0x00158, // LATIN CAPITAL LETTER R WITH CARON -- "rcaron", 0x00159, // LATIN SMALL LETTER R WITH CARON -- "Rcedil", 0x00156, // LATIN CAPITAL LETTER R WITH CEDILLA -- "rcedil", 0x00157, // LATIN SMALL LETTER R WITH CEDILLA -- "rceil", 0x02309, // RIGHT CEILING -- "rcub", 0x0007D, // RIGHT CURLY BRACKET -- "Rcy", 0x00420, // CYRILLIC CAPITAL LETTER ER -- "rcy", 0x00440, // CYRILLIC SMALL LETTER ER -- "rdca", 0x02937, // ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS -- "rdldhar", 0x02969, // RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN -- "rdquo", 0x0201D, // RIGHT DOUBLE QUOTATION MARK -- "rdquor", 0x0201D, // RIGHT DOUBLE QUOTATION MARK -- "rdsh", 0x021B3, // DOWNWARDS ARROW WITH TIP RIGHTWARDS -- "Re", 0x0211C, // BLACK-LETTER CAPITAL R -- "real", 0x0211C, // BLACK-LETTER CAPITAL R -- "realine", 0x0211B, // SCRIPT CAPITAL R -- "realpart", 0x0211C, // BLACK-LETTER CAPITAL R -- "reals", 0x0211D, // DOUBLE-STRUCK CAPITAL R -- "rect", 0x025AD, // WHITE RECTANGLE -- "reg", 0x000AE, // REGISTERED SIGN -- "REG", 0x000AE, // REGISTERED SIGN -- "ReverseElement", 0x0220B, // CONTAINS AS MEMBER -- "ReverseEquilibrium", 0x021CB, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -- "ReverseUpEquilibrium", 0x0296F, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -- "rfisht", 0x0297D, // RIGHT FISH TAIL -- "rfloor", 0x0230B, // RIGHT FLOOR -- "Rfr", 0x0211C, // BLACK-LETTER CAPITAL R -- "rfr", 0x1D52F, // MATHEMATICAL FRAKTUR SMALL R -- "Rgr", 0x003A1, // GREEK CAPITAL LETTER RHO -- "rgr", 0x003C1, // GREEK SMALL LETTER RHO -- "rHar", 0x02964, // RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN -- "rhard", 0x021C1, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -- "rharu", 0x021C0, // RIGHTWARDS HARPOON WITH BARB UPWARDS -- "rharul", 0x0296C, // RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH -- "Rho", 0x003A1, // GREEK CAPITAL LETTER RHO -- "rho", 0x003C1, // GREEK SMALL LETTER RHO -- "rhov", 0x003F1, // GREEK RHO SYMBOL -- "RightAngleBracket", 0x027E9, // MATHEMATICAL RIGHT ANGLE BRACKET -- "rightarrow", 0x02192, // RIGHTWARDS ARROW -- "RightArrow", 0x02192, // RIGHTWARDS ARROW -- "Rightarrow", 0x021D2, // RIGHTWARDS DOUBLE ARROW -- "RightArrowBar", 0x021E5, // RIGHTWARDS ARROW TO BAR -- "RightArrowLeftArrow", 0x021C4, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -- "rightarrowtail", 0x021A3, // RIGHTWARDS ARROW WITH TAIL -- "RightCeiling", 0x02309, // RIGHT CEILING -- "RightDoubleBracket", 0x027E7, // MATHEMATICAL RIGHT WHITE SQUARE BRACKET -- "RightDownTeeVector", 0x0295D, // DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR -- "RightDownVector", 0x021C2, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -- "RightDownVectorBar", 0x02955, // DOWNWARDS HARPOON WITH BARB RIGHT TO BAR -- "RightFloor", 0x0230B, // RIGHT FLOOR -- "rightharpoondown", 0x021C1, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -- "rightharpoonup", 0x021C0, // RIGHTWARDS HARPOON WITH BARB UPWARDS -- "rightleftarrows", 0x021C4, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -- "rightleftharpoons", 0x021CC, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -- "rightrightarrows", 0x021C9, // RIGHTWARDS PAIRED ARROWS -- "rightsquigarrow", 0x0219D, // RIGHTWARDS WAVE ARROW -- "RightTee", 0x022A2, // RIGHT TACK -- "RightTeeArrow", 0x021A6, // RIGHTWARDS ARROW FROM BAR -- "RightTeeVector", 0x0295B, // RIGHTWARDS HARPOON WITH BARB UP FROM BAR -- "rightthreetimes", 0x022CC, // RIGHT SEMIDIRECT PRODUCT -- "RightTriangle", 0x022B3, // CONTAINS AS NORMAL SUBGROUP -- "RightTriangleBar", 0x029D0, // VERTICAL BAR BESIDE RIGHT TRIANGLE -- "RightTriangleEqual", 0x022B5, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -- "RightUpDownVector", 0x0294F, // UP BARB RIGHT DOWN BARB RIGHT HARPOON -- "RightUpTeeVector", 0x0295C, // UPWARDS HARPOON WITH BARB RIGHT FROM BAR -- "RightUpVector", 0x021BE, // UPWARDS HARPOON WITH BARB RIGHTWARDS -- "RightUpVectorBar", 0x02954, // UPWARDS HARPOON WITH BARB RIGHT TO BAR -- "RightVector", 0x021C0, // RIGHTWARDS HARPOON WITH BARB UPWARDS -- "RightVectorBar", 0x02953, // RIGHTWARDS HARPOON WITH BARB UP TO BAR -- "ring", 0x002DA, // RING ABOVE -- "risingdotseq", 0x02253, // IMAGE OF OR APPROXIMATELY EQUAL TO -- "rlarr", 0x021C4, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -- "rlhar", 0x021CC, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -- "rlm", 0x0200F, // RIGHT-TO-LEFT MARK -- "rmoust", 0x023B1, // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION -- "rmoustache", 0x023B1, // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION -- "rnmid", 0x02AEE, // DOES NOT DIVIDE WITH REVERSED NEGATION SLASH -- "roang", 0x027ED, // MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET -- "roarr", 0x021FE, // RIGHTWARDS OPEN-HEADED ARROW -- "robrk", 0x027E7, // MATHEMATICAL RIGHT WHITE SQUARE BRACKET -- "ropar", 0x02986, // RIGHT WHITE PARENTHESIS -- "Ropf", 0x0211D, // DOUBLE-STRUCK CAPITAL R -- "ropf", 0x1D563, // MATHEMATICAL DOUBLE-STRUCK SMALL R -- "roplus", 0x02A2E, // PLUS SIGN IN RIGHT HALF CIRCLE -- "rotimes", 0x02A35, // MULTIPLICATION SIGN IN RIGHT HALF CIRCLE -- "RoundImplies", 0x02970, // RIGHT DOUBLE ARROW WITH ROUNDED HEAD -- "rpar", 0x00029, // RIGHT PARENTHESIS -- "rpargt", 0x02994, // RIGHT ARC GREATER-THAN BRACKET -- "rppolint", 0x02A12, // LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE -- "rrarr", 0x021C9, // RIGHTWARDS PAIRED ARROWS -- "Rrightarrow", 0x021DB, // RIGHTWARDS TRIPLE ARROW -- "rsaquo", 0x0203A, // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -- "Rscr", 0x0211B, // SCRIPT CAPITAL R -- "rscr", 0x1D4C7, // MATHEMATICAL SCRIPT SMALL R -- "rsh", 0x021B1, // UPWARDS ARROW WITH TIP RIGHTWARDS -- "Rsh", 0x021B1, // UPWARDS ARROW WITH TIP RIGHTWARDS -- "rsqb", 0x0005D, // RIGHT SQUARE BRACKET -- "rsquo", 0x02019, // RIGHT SINGLE QUOTATION MARK -- "rsquor", 0x02019, // RIGHT SINGLE QUOTATION MARK -- "rthree", 0x022CC, // RIGHT SEMIDIRECT PRODUCT -- "rtimes", 0x022CA, // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT -- "rtri", 0x025B9, // WHITE RIGHT-POINTING SMALL TRIANGLE -- "rtrie", 0x022B5, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -- "rtrif", 0x025B8, // BLACK RIGHT-POINTING SMALL TRIANGLE -- "rtriltri", 0x029CE, // RIGHT TRIANGLE ABOVE LEFT TRIANGLE -- "RuleDelayed", 0x029F4, // RULE-DELAYED -- "ruluhar", 0x02968, // RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP -- "rx", 0x0211E, // PRESCRIPTION TAKE -- NULL, 0 -+ {"rAarr", 0x021DB}, // RIGHTWARDS TRIPLE ARROW -+// "race", 0x0223D;0x00331}, // REVERSED TILDE with underline -+ {"Racute", 0x00154}, // LATIN CAPITAL LETTER R WITH ACUTE -+ {"racute", 0x00155}, // LATIN SMALL LETTER R WITH ACUTE -+ {"radic", 0x0221A}, // SQUARE ROOT -+ {"raemptyv", 0x029B3}, // EMPTY SET WITH RIGHT ARROW ABOVE -+ {"rang", 0x027E9}, // MATHEMATICAL RIGHT ANGLE BRACKET -+ {"Rang", 0x027EB}, // MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET -+ {"rangd", 0x02992}, // RIGHT ANGLE BRACKET WITH DOT -+ {"range", 0x029A5}, // REVERSED ANGLE WITH UNDERBAR -+ {"rangle", 0x027E9}, // MATHEMATICAL RIGHT ANGLE BRACKET -+ {"raquo", 0x000BB}, // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -+ {"rarr", 0x02192}, // RIGHTWARDS ARROW -+ {"Rarr", 0x021A0}, // RIGHTWARDS TWO HEADED ARROW -+ {"rArr", 0x021D2}, // RIGHTWARDS DOUBLE ARROW -+ {"rarrap", 0x02975}, // RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO -+ {"rarrb", 0x021E5}, // RIGHTWARDS ARROW TO BAR -+ {"rarrbfs", 0x02920}, // RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND -+ {"rarrc", 0x02933}, // WAVE ARROW POINTING DIRECTLY RIGHT -+ {"rarrfs", 0x0291E}, // RIGHTWARDS ARROW TO BLACK DIAMOND -+ {"rarrhk", 0x021AA}, // RIGHTWARDS ARROW WITH HOOK -+ {"rarrlp", 0x021AC}, // RIGHTWARDS ARROW WITH LOOP -+ {"rarrpl", 0x02945}, // RIGHTWARDS ARROW WITH PLUS BELOW -+ {"rarrsim", 0x02974}, // RIGHTWARDS ARROW ABOVE TILDE OPERATOR -+ {"rarrtl", 0x021A3}, // RIGHTWARDS ARROW WITH TAIL -+ {"Rarrtl", 0x02916}, // RIGHTWARDS TWO-HEADED ARROW WITH TAIL -+ {"rarrw", 0x0219D}, // RIGHTWARDS WAVE ARROW -+ {"ratail", 0x0291A}, // RIGHTWARDS ARROW-TAIL -+ {"rAtail", 0x0291C}, // RIGHTWARDS DOUBLE ARROW-TAIL -+ {"ratio", 0x02236}, // RATIO -+ {"rationals", 0x0211A}, // DOUBLE-STRUCK CAPITAL Q -+ {"rbarr", 0x0290D}, // RIGHTWARDS DOUBLE DASH ARROW -+ {"rBarr", 0x0290F}, // RIGHTWARDS TRIPLE DASH ARROW -+ {"RBarr", 0x02910}, // RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW -+ {"rbbrk", 0x02773}, // LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT -+ {"rbrace", 0x0007D}, // RIGHT CURLY BRACKET -+ {"rbrack", 0x0005D}, // RIGHT SQUARE BRACKET -+ {"rbrke", 0x0298C}, // RIGHT SQUARE BRACKET WITH UNDERBAR -+ {"rbrksld", 0x0298E}, // RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER -+ {"rbrkslu", 0x02990}, // RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER -+ {"Rcaron", 0x00158}, // LATIN CAPITAL LETTER R WITH CARON -+ {"rcaron", 0x00159}, // LATIN SMALL LETTER R WITH CARON -+ {"Rcedil", 0x00156}, // LATIN CAPITAL LETTER R WITH CEDILLA -+ {"rcedil", 0x00157}, // LATIN SMALL LETTER R WITH CEDILLA -+ {"rceil", 0x02309}, // RIGHT CEILING -+ {"rcub", 0x0007D}, // RIGHT CURLY BRACKET -+ {"Rcy", 0x00420}, // CYRILLIC CAPITAL LETTER ER -+ {"rcy", 0x00440}, // CYRILLIC SMALL LETTER ER -+ {"rdca", 0x02937}, // ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS -+ {"rdldhar", 0x02969}, // RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN -+ {"rdquo", 0x0201D}, // RIGHT DOUBLE QUOTATION MARK -+ {"rdquor", 0x0201D}, // RIGHT DOUBLE QUOTATION MARK -+ {"rdsh", 0x021B3}, // DOWNWARDS ARROW WITH TIP RIGHTWARDS -+ {"Re", 0x0211C}, // BLACK-LETTER CAPITAL R -+ {"real", 0x0211C}, // BLACK-LETTER CAPITAL R -+ {"realine", 0x0211B}, // SCRIPT CAPITAL R -+ {"realpart", 0x0211C}, // BLACK-LETTER CAPITAL R -+ {"reals", 0x0211D}, // DOUBLE-STRUCK CAPITAL R -+ {"rect", 0x025AD}, // WHITE RECTANGLE -+ {"reg", 0x000AE}, // REGISTERED SIGN -+ {"REG", 0x000AE}, // REGISTERED SIGN -+ {"ReverseElement", 0x0220B}, // CONTAINS AS MEMBER -+ {"ReverseEquilibrium", 0x021CB}, // LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON -+ {"ReverseUpEquilibrium", 0x0296F}, // DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -+ {"rfisht", 0x0297D}, // RIGHT FISH TAIL -+ {"rfloor", 0x0230B}, // RIGHT FLOOR -+ {"Rfr", 0x0211C}, // BLACK-LETTER CAPITAL R -+ {"rfr", 0x1D52F}, // MATHEMATICAL FRAKTUR SMALL R -+ {"Rgr", 0x003A1}, // GREEK CAPITAL LETTER RHO -+ {"rgr", 0x003C1}, // GREEK SMALL LETTER RHO -+ {"rHar", 0x02964}, // RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN -+ {"rhard", 0x021C1}, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -+ {"rharu", 0x021C0}, // RIGHTWARDS HARPOON WITH BARB UPWARDS -+ {"rharul", 0x0296C}, // RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH -+ {"Rho", 0x003A1}, // GREEK CAPITAL LETTER RHO -+ {"rho", 0x003C1}, // GREEK SMALL LETTER RHO -+ {"rhov", 0x003F1}, // GREEK RHO SYMBOL -+ {"RightAngleBracket", 0x027E9}, // MATHEMATICAL RIGHT ANGLE BRACKET -+ {"rightarrow", 0x02192}, // RIGHTWARDS ARROW -+ {"RightArrow", 0x02192}, // RIGHTWARDS ARROW -+ {"Rightarrow", 0x021D2}, // RIGHTWARDS DOUBLE ARROW -+ {"RightArrowBar", 0x021E5}, // RIGHTWARDS ARROW TO BAR -+ {"RightArrowLeftArrow", 0x021C4}, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -+ {"rightarrowtail", 0x021A3}, // RIGHTWARDS ARROW WITH TAIL -+ {"RightCeiling", 0x02309}, // RIGHT CEILING -+ {"RightDoubleBracket", 0x027E7}, // MATHEMATICAL RIGHT WHITE SQUARE BRACKET -+ {"RightDownTeeVector", 0x0295D}, // DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR -+ {"RightDownVector", 0x021C2}, // DOWNWARDS HARPOON WITH BARB RIGHTWARDS -+ {"RightDownVectorBar", 0x02955}, // DOWNWARDS HARPOON WITH BARB RIGHT TO BAR -+ {"RightFloor", 0x0230B}, // RIGHT FLOOR -+ {"rightharpoondown", 0x021C1}, // RIGHTWARDS HARPOON WITH BARB DOWNWARDS -+ {"rightharpoonup", 0x021C0}, // RIGHTWARDS HARPOON WITH BARB UPWARDS -+ {"rightleftarrows", 0x021C4}, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -+ {"rightleftharpoons", 0x021CC}, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -+ {"rightrightarrows", 0x021C9}, // RIGHTWARDS PAIRED ARROWS -+ {"rightsquigarrow", 0x0219D}, // RIGHTWARDS WAVE ARROW -+ {"RightTee", 0x022A2}, // RIGHT TACK -+ {"RightTeeArrow", 0x021A6}, // RIGHTWARDS ARROW FROM BAR -+ {"RightTeeVector", 0x0295B}, // RIGHTWARDS HARPOON WITH BARB UP FROM BAR -+ {"rightthreetimes", 0x022CC}, // RIGHT SEMIDIRECT PRODUCT -+ {"RightTriangle", 0x022B3}, // CONTAINS AS NORMAL SUBGROUP -+ {"RightTriangleBar", 0x029D0}, // VERTICAL BAR BESIDE RIGHT TRIANGLE -+ {"RightTriangleEqual", 0x022B5}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -+ {"RightUpDownVector", 0x0294F}, // UP BARB RIGHT DOWN BARB RIGHT HARPOON -+ {"RightUpTeeVector", 0x0295C}, // UPWARDS HARPOON WITH BARB RIGHT FROM BAR -+ {"RightUpVector", 0x021BE}, // UPWARDS HARPOON WITH BARB RIGHTWARDS -+ {"RightUpVectorBar", 0x02954}, // UPWARDS HARPOON WITH BARB RIGHT TO BAR -+ {"RightVector", 0x021C0}, // RIGHTWARDS HARPOON WITH BARB UPWARDS -+ {"RightVectorBar", 0x02953}, // RIGHTWARDS HARPOON WITH BARB UP TO BAR -+ {"ring", 0x002DA}, // RING ABOVE -+ {"risingdotseq", 0x02253}, // IMAGE OF OR APPROXIMATELY EQUAL TO -+ {"rlarr", 0x021C4}, // RIGHTWARDS ARROW OVER LEFTWARDS ARROW -+ {"rlhar", 0x021CC}, // RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON -+ {"rlm", 0x0200F}, // RIGHT-TO-LEFT MARK -+ {"rmoust", 0x023B1}, // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION -+ {"rmoustache", 0x023B1}, // UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION -+ {"rnmid", 0x02AEE}, // DOES NOT DIVIDE WITH REVERSED NEGATION SLASH -+ {"roang", 0x027ED}, // MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET -+ {"roarr", 0x021FE}, // RIGHTWARDS OPEN-HEADED ARROW -+ {"robrk", 0x027E7}, // MATHEMATICAL RIGHT WHITE SQUARE BRACKET -+ {"ropar", 0x02986}, // RIGHT WHITE PARENTHESIS -+ {"Ropf", 0x0211D}, // DOUBLE-STRUCK CAPITAL R -+ {"ropf", 0x1D563}, // MATHEMATICAL DOUBLE-STRUCK SMALL R -+ {"roplus", 0x02A2E}, // PLUS SIGN IN RIGHT HALF CIRCLE -+ {"rotimes", 0x02A35}, // MULTIPLICATION SIGN IN RIGHT HALF CIRCLE -+ {"RoundImplies", 0x02970}, // RIGHT DOUBLE ARROW WITH ROUNDED HEAD -+ {"rpar", 0x00029}, // RIGHT PARENTHESIS -+ {"rpargt", 0x02994}, // RIGHT ARC GREATER-THAN BRACKET -+ {"rppolint", 0x02A12}, // LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE -+ {"rrarr", 0x021C9}, // RIGHTWARDS PAIRED ARROWS -+ {"Rrightarrow", 0x021DB}, // RIGHTWARDS TRIPLE ARROW -+ {"rsaquo", 0x0203A}, // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK -+ {"Rscr", 0x0211B}, // SCRIPT CAPITAL R -+ {"rscr", 0x1D4C7}, // MATHEMATICAL SCRIPT SMALL R -+ {"rsh", 0x021B1}, // UPWARDS ARROW WITH TIP RIGHTWARDS -+ {"Rsh", 0x021B1}, // UPWARDS ARROW WITH TIP RIGHTWARDS -+ {"rsqb", 0x0005D}, // RIGHT SQUARE BRACKET -+ {"rsquo", 0x02019}, // RIGHT SINGLE QUOTATION MARK -+ {"rsquor", 0x02019}, // RIGHT SINGLE QUOTATION MARK -+ {"rthree", 0x022CC}, // RIGHT SEMIDIRECT PRODUCT -+ {"rtimes", 0x022CA}, // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT -+ {"rtri", 0x025B9}, // WHITE RIGHT-POINTING SMALL TRIANGLE -+ {"rtrie", 0x022B5}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -+ {"rtrif", 0x025B8}, // BLACK RIGHT-POINTING SMALL TRIANGLE -+ {"rtriltri", 0x029CE}, // RIGHT TRIANGLE ABOVE LEFT TRIANGLE -+ {"RuleDelayed", 0x029F4}, // RULE-DELAYED -+ {"ruluhar", 0x02968}, // RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP -+ {"rx", 0x0211E}, // PRESCRIPTION TAKE -+ {NULL, 0} - }; - - static NameId namesS[]={ -- "Sacute", 0x0015A, // LATIN CAPITAL LETTER S WITH ACUTE -- "sacute", 0x0015B, // LATIN SMALL LETTER S WITH ACUTE -- "sbquo", 0x0201A, // SINGLE LOW-9 QUOTATION MARK -- "sc", 0x0227B, // SUCCEEDS -- "Sc", 0x02ABC, // DOUBLE SUCCEEDS -- "scap", 0x02AB8, // SUCCEEDS ABOVE ALMOST EQUAL TO -- "Scaron", 0x00160, // LATIN CAPITAL LETTER S WITH CARON -- "scaron", 0x00161, // LATIN SMALL LETTER S WITH CARON -- "sccue", 0x0227D, // SUCCEEDS OR EQUAL TO -- "sce", 0x02AB0, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -- "scE", 0x02AB4, // SUCCEEDS ABOVE EQUALS SIGN -- "Scedil", 0x0015E, // LATIN CAPITAL LETTER S WITH CEDILLA -- "scedil", 0x0015F, // LATIN SMALL LETTER S WITH CEDILLA -- "Scirc", 0x0015C, // LATIN CAPITAL LETTER S WITH CIRCUMFLEX -- "scirc", 0x0015D, // LATIN SMALL LETTER S WITH CIRCUMFLEX -- "scnap", 0x02ABA, // SUCCEEDS ABOVE NOT ALMOST EQUAL TO -- "scnE", 0x02AB6, // SUCCEEDS ABOVE NOT EQUAL TO -- "scnsim", 0x022E9, // SUCCEEDS BUT NOT EQUIVALENT TO -- "scpolint", 0x02A13, // LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE -- "scsim", 0x0227F, // SUCCEEDS OR EQUIVALENT TO -- "Scy", 0x00421, // CYRILLIC CAPITAL LETTER ES -- "scy", 0x00441, // CYRILLIC SMALL LETTER ES -- "sdot", 0x022C5, // DOT OPERATOR -- "sdotb", 0x022A1, // SQUARED DOT OPERATOR -- "sdote", 0x02A66, // EQUALS SIGN WITH DOT BELOW -- "searhk", 0x02925, // SOUTH EAST ARROW WITH HOOK -- "searr", 0x02198, // SOUTH EAST ARROW -- "seArr", 0x021D8, // SOUTH EAST DOUBLE ARROW -- "searrow", 0x02198, // SOUTH EAST ARROW -- "sect", 0x000A7, // SECTION SIGN -- "semi", 0x0003B, // SEMICOLON -- "seswar", 0x02929, // SOUTH EAST ARROW AND SOUTH WEST ARROW -- "setminus", 0x02216, // SET MINUS -- "setmn", 0x02216, // SET MINUS -- "sext", 0x02736, // SIX POINTED BLACK STAR -- "sfgr", 0x003C2, // GREEK SMALL LETTER FINAL SIGMA -- "Sfr", 0x1D516, // MATHEMATICAL FRAKTUR CAPITAL S -- "sfr", 0x1D530, // MATHEMATICAL FRAKTUR SMALL S -- "sfrown", 0x02322, // FROWN -- "Sgr", 0x003A3, // GREEK CAPITAL LETTER SIGMA -- "sgr", 0x003C3, // GREEK SMALL LETTER SIGMA -- "sharp", 0x0266F, // MUSIC SHARP SIGN -- "SHCHcy", 0x00429, // CYRILLIC CAPITAL LETTER SHCHA -- "shchcy", 0x00449, // CYRILLIC SMALL LETTER SHCHA -- "SHcy", 0x00428, // CYRILLIC CAPITAL LETTER SHA -- "shcy", 0x00448, // CYRILLIC SMALL LETTER SHA -- "ShortDownArrow", 0x02193, // DOWNWARDS ARROW -- "ShortLeftArrow", 0x02190, // LEFTWARDS ARROW -- "shortmid", 0x02223, // DIVIDES -- "shortparallel", 0x02225, // PARALLEL TO -- "ShortRightArrow", 0x02192, // RIGHTWARDS ARROW -- "ShortUpArrow", 0x02191, // UPWARDS ARROW -- "shy", 0x000AD, // SOFT HYPHEN -- "Sigma", 0x003A3, // GREEK CAPITAL LETTER SIGMA -- "sigma", 0x003C3, // GREEK SMALL LETTER SIGMA -- "sigmaf", 0x003C2, // GREEK SMALL LETTER FINAL SIGMA -- "sigmav", 0x003C2, // GREEK SMALL LETTER FINAL SIGMA -- "sim", 0x0223C, // TILDE OPERATOR -- "simdot", 0x02A6A, // TILDE OPERATOR WITH DOT ABOVE -- "sime", 0x02243, // ASYMPTOTICALLY EQUAL TO -- "simeq", 0x02243, // ASYMPTOTICALLY EQUAL TO -- "simg", 0x02A9E, // SIMILAR OR GREATER-THAN -- "simgE", 0x02AA0, // SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN -- "siml", 0x02A9D, // SIMILAR OR LESS-THAN -- "simlE", 0x02A9F, // SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN -- "simne", 0x02246, // APPROXIMATELY BUT NOT ACTUALLY EQUAL TO -- "simplus", 0x02A24, // PLUS SIGN WITH TILDE ABOVE -- "simrarr", 0x02972, // TILDE OPERATOR ABOVE RIGHTWARDS ARROW -- "slarr", 0x02190, // LEFTWARDS ARROW -- "SmallCircle", 0x02218, // RING OPERATOR -- "smallsetminus", 0x02216, // SET MINUS -- "smashp", 0x02A33, // SMASH PRODUCT -- "smeparsl", 0x029E4, // EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE -- "smid", 0x02223, // DIVIDES -- "smile", 0x02323, // SMILE -- "smt", 0x02AAA, // SMALLER THAN -- "smte", 0x02AAC, // SMALLER THAN OR EQUAL TO --// "smtes", 0x02AAC;0x0FE00, // SMALLER THAN OR slanted EQUAL -- "SOFTcy", 0x0042C, // CYRILLIC CAPITAL LETTER SOFT SIGN -- "softcy", 0x0044C, // CYRILLIC SMALL LETTER SOFT SIGN -- "sol", 0x0002F, // SOLIDUS -- "solb", 0x029C4, // SQUARED RISING DIAGONAL SLASH -- "solbar", 0x0233F, // APL FUNCTIONAL SYMBOL SLASH BAR -- "Sopf", 0x1D54A, // MATHEMATICAL DOUBLE-STRUCK CAPITAL S -- "sopf", 0x1D564, // MATHEMATICAL DOUBLE-STRUCK SMALL S -- "spades", 0x02660, // BLACK SPADE SUIT -- "spadesuit", 0x02660, // BLACK SPADE SUIT -- "spar", 0x02225, // PARALLEL TO -- "sqcap", 0x02293, // SQUARE CAP --// "sqcaps", 0x02293;0x0FE00, // SQUARE CAP with serifs -- "sqcup", 0x02294, // SQUARE CUP --// "sqcups", 0x02294;0x0FE00, // SQUARE CUP with serifs -- "Sqrt", 0x0221A, // SQUARE ROOT -- "sqsub", 0x0228F, // SQUARE IMAGE OF -- "sqsube", 0x02291, // SQUARE IMAGE OF OR EQUAL TO -- "sqsubset", 0x0228F, // SQUARE IMAGE OF -- "sqsubseteq", 0x02291, // SQUARE IMAGE OF OR EQUAL TO -- "sqsup", 0x02290, // SQUARE ORIGINAL OF -- "sqsupe", 0x02292, // SQUARE ORIGINAL OF OR EQUAL TO -- "sqsupset", 0x02290, // SQUARE ORIGINAL OF -- "sqsupseteq", 0x02292, // SQUARE ORIGINAL OF OR EQUAL TO -- "squ", 0x025A1, // WHITE SQUARE -- "square", 0x025A1, // WHITE SQUARE -- "Square", 0x025A1, // WHITE SQUARE -- "SquareIntersection", 0x02293, // SQUARE CAP -- "SquareSubset", 0x0228F, // SQUARE IMAGE OF -- "SquareSubsetEqual", 0x02291, // SQUARE IMAGE OF OR EQUAL TO -- "SquareSuperset", 0x02290, // SQUARE ORIGINAL OF -- "SquareSupersetEqual", 0x02292, // SQUARE ORIGINAL OF OR EQUAL TO -- "SquareUnion", 0x02294, // SQUARE CUP -- "squarf", 0x025AA, // BLACK SMALL SQUARE -- "squf", 0x025AA, // BLACK SMALL SQUARE -- "srarr", 0x02192, // RIGHTWARDS ARROW -- "Sscr", 0x1D4AE, // MATHEMATICAL SCRIPT CAPITAL S -- "sscr", 0x1D4C8, // MATHEMATICAL SCRIPT SMALL S -- "ssetmn", 0x02216, // SET MINUS -- "ssmile", 0x02323, // SMILE -- "sstarf", 0x022C6, // STAR OPERATOR -- "Star", 0x022C6, // STAR OPERATOR -- "star", 0x02606, // WHITE STAR -- "starf", 0x02605, // BLACK STAR -- "straightepsilon", 0x003F5, // GREEK LUNATE EPSILON SYMBOL -- "straightphi", 0x003D5, // GREEK PHI SYMBOL -- "strns", 0x000AF, // MACRON -- "sub", 0x02282, // SUBSET OF -- "Sub", 0x022D0, // DOUBLE SUBSET -- "subdot", 0x02ABD, // SUBSET WITH DOT -- "sube", 0x02286, // SUBSET OF OR EQUAL TO -- "subE", 0x02AC5, // SUBSET OF ABOVE EQUALS SIGN -- "subedot", 0x02AC3, // SUBSET OF OR EQUAL TO WITH DOT ABOVE -- "submult", 0x02AC1, // SUBSET WITH MULTIPLICATION SIGN BELOW -- "subne", 0x0228A, // SUBSET OF WITH NOT EQUAL TO -- "subnE", 0x02ACB, // SUBSET OF ABOVE NOT EQUAL TO -- "subplus", 0x02ABF, // SUBSET WITH PLUS SIGN BELOW -- "subrarr", 0x02979, // SUBSET ABOVE RIGHTWARDS ARROW -- "subset", 0x02282, // SUBSET OF -- "Subset", 0x022D0, // DOUBLE SUBSET -- "subseteq", 0x02286, // SUBSET OF OR EQUAL TO -- "subseteqq", 0x02AC5, // SUBSET OF ABOVE EQUALS SIGN -- "SubsetEqual", 0x02286, // SUBSET OF OR EQUAL TO -- "subsetneq", 0x0228A, // SUBSET OF WITH NOT EQUAL TO -- "subsetneqq", 0x02ACB, // SUBSET OF ABOVE NOT EQUAL TO -- "subsim", 0x02AC7, // SUBSET OF ABOVE TILDE OPERATOR -- "subsub", 0x02AD5, // SUBSET ABOVE SUBSET -- "subsup", 0x02AD3, // SUBSET ABOVE SUPERSET -- "succ", 0x0227B, // SUCCEEDS -- "succapprox", 0x02AB8, // SUCCEEDS ABOVE ALMOST EQUAL TO -- "succcurlyeq", 0x0227D, // SUCCEEDS OR EQUAL TO -- "Succeeds", 0x0227B, // SUCCEEDS -- "SucceedsEqual", 0x02AB0, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -- "SucceedsSlantEqual", 0x0227D, // SUCCEEDS OR EQUAL TO -- "SucceedsTilde", 0x0227F, // SUCCEEDS OR EQUIVALENT TO -- "succeq", 0x02AB0, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -- "succnapprox", 0x02ABA, // SUCCEEDS ABOVE NOT ALMOST EQUAL TO -- "succneqq", 0x02AB6, // SUCCEEDS ABOVE NOT EQUAL TO -- "succnsim", 0x022E9, // SUCCEEDS BUT NOT EQUIVALENT TO -- "succsim", 0x0227F, // SUCCEEDS OR EQUIVALENT TO -- "SuchThat", 0x0220B, // CONTAINS AS MEMBER -- "sum", 0x02211, // N-ARY SUMMATION -- "Sum", 0x02211, // N-ARY SUMMATION -- "sung", 0x0266A, // EIGHTH NOTE -- "sup", 0x02283, // SUPERSET OF -- "Sup", 0x022D1, // DOUBLE SUPERSET -- "sup1", 0x000B9, // SUPERSCRIPT ONE -- "sup2", 0x000B2, // SUPERSCRIPT TWO -- "sup3", 0x000B3, // SUPERSCRIPT THREE -- "supdot", 0x02ABE, // SUPERSET WITH DOT -- "supdsub", 0x02AD8, // SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET -- "supe", 0x02287, // SUPERSET OF OR EQUAL TO -- "supE", 0x02AC6, // SUPERSET OF ABOVE EQUALS SIGN -- "supedot", 0x02AC4, // SUPERSET OF OR EQUAL TO WITH DOT ABOVE -- "Superset", 0x02283, // SUPERSET OF -- "SupersetEqual", 0x02287, // SUPERSET OF OR EQUAL TO -- "suphsol", 0x027C9, // SUPERSET PRECEDING SOLIDUS -- "suphsub", 0x02AD7, // SUPERSET BESIDE SUBSET -- "suplarr", 0x0297B, // SUPERSET ABOVE LEFTWARDS ARROW -- "supmult", 0x02AC2, // SUPERSET WITH MULTIPLICATION SIGN BELOW -- "supne", 0x0228B, // SUPERSET OF WITH NOT EQUAL TO -- "supnE", 0x02ACC, // SUPERSET OF ABOVE NOT EQUAL TO -- "supplus", 0x02AC0, // SUPERSET WITH PLUS SIGN BELOW -- "supset", 0x02283, // SUPERSET OF -- "Supset", 0x022D1, // DOUBLE SUPERSET -- "supseteq", 0x02287, // SUPERSET OF OR EQUAL TO -- "supseteqq", 0x02AC6, // SUPERSET OF ABOVE EQUALS SIGN -- "supsetneq", 0x0228B, // SUPERSET OF WITH NOT EQUAL TO -- "supsetneqq", 0x02ACC, // SUPERSET OF ABOVE NOT EQUAL TO -- "supsim", 0x02AC8, // SUPERSET OF ABOVE TILDE OPERATOR -- "supsub", 0x02AD4, // SUPERSET ABOVE SUBSET -- "supsup", 0x02AD6, // SUPERSET ABOVE SUPERSET -- "swarhk", 0x02926, // SOUTH WEST ARROW WITH HOOK -- "swarr", 0x02199, // SOUTH WEST ARROW -- "swArr", 0x021D9, // SOUTH WEST DOUBLE ARROW -- "swarrow", 0x02199, // SOUTH WEST ARROW -- "swnwar", 0x0292A, // SOUTH WEST ARROW AND NORTH WEST ARROW -- "szlig", 0x000DF, // LATIN SMALL LETTER SHARP S -- NULL, 0 -+ {"Sacute", 0x0015A}, // LATIN CAPITAL LETTER S WITH ACUTE -+ {"sacute", 0x0015B}, // LATIN SMALL LETTER S WITH ACUTE -+ {"sbquo", 0x0201A}, // SINGLE LOW-9 QUOTATION MARK -+ {"sc", 0x0227B}, // SUCCEEDS -+ {"Sc", 0x02ABC}, // DOUBLE SUCCEEDS -+ {"scap", 0x02AB8}, // SUCCEEDS ABOVE ALMOST EQUAL TO -+ {"Scaron", 0x00160}, // LATIN CAPITAL LETTER S WITH CARON -+ {"scaron", 0x00161}, // LATIN SMALL LETTER S WITH CARON -+ {"sccue", 0x0227D}, // SUCCEEDS OR EQUAL TO -+ {"sce", 0x02AB0}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -+ {"scE", 0x02AB4}, // SUCCEEDS ABOVE EQUALS SIGN -+ {"Scedil", 0x0015E}, // LATIN CAPITAL LETTER S WITH CEDILLA -+ {"scedil", 0x0015F}, // LATIN SMALL LETTER S WITH CEDILLA -+ {"Scirc", 0x0015C}, // LATIN CAPITAL LETTER S WITH CIRCUMFLEX -+ {"scirc", 0x0015D}, // LATIN SMALL LETTER S WITH CIRCUMFLEX -+ {"scnap", 0x02ABA}, // SUCCEEDS ABOVE NOT ALMOST EQUAL TO -+ {"scnE", 0x02AB6}, // SUCCEEDS ABOVE NOT EQUAL TO -+ {"scnsim", 0x022E9}, // SUCCEEDS BUT NOT EQUIVALENT TO -+ {"scpolint", 0x02A13}, // LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE -+ {"scsim", 0x0227F}, // SUCCEEDS OR EQUIVALENT TO -+ {"Scy", 0x00421}, // CYRILLIC CAPITAL LETTER ES -+ {"scy", 0x00441}, // CYRILLIC SMALL LETTER ES -+ {"sdot", 0x022C5}, // DOT OPERATOR -+ {"sdotb", 0x022A1}, // SQUARED DOT OPERATOR -+ {"sdote", 0x02A66}, // EQUALS SIGN WITH DOT BELOW -+ {"searhk", 0x02925}, // SOUTH EAST ARROW WITH HOOK -+ {"searr", 0x02198}, // SOUTH EAST ARROW -+ {"seArr", 0x021D8}, // SOUTH EAST DOUBLE ARROW -+ {"searrow", 0x02198}, // SOUTH EAST ARROW -+ {"sect", 0x000A7}, // SECTION SIGN -+ {"semi", 0x0003B}, // SEMICOLON -+ {"seswar", 0x02929}, // SOUTH EAST ARROW AND SOUTH WEST ARROW -+ {"setminus", 0x02216}, // SET MINUS -+ {"setmn", 0x02216}, // SET MINUS -+ {"sext", 0x02736}, // SIX POINTED BLACK STAR -+ {"sfgr", 0x003C2}, // GREEK SMALL LETTER FINAL SIGMA -+ {"Sfr", 0x1D516}, // MATHEMATICAL FRAKTUR CAPITAL S -+ {"sfr", 0x1D530}, // MATHEMATICAL FRAKTUR SMALL S -+ {"sfrown", 0x02322}, // FROWN -+ {"Sgr", 0x003A3}, // GREEK CAPITAL LETTER SIGMA -+ {"sgr", 0x003C3}, // GREEK SMALL LETTER SIGMA -+ {"sharp", 0x0266F}, // MUSIC SHARP SIGN -+ {"SHCHcy", 0x00429}, // CYRILLIC CAPITAL LETTER SHCHA -+ {"shchcy", 0x00449}, // CYRILLIC SMALL LETTER SHCHA -+ {"SHcy", 0x00428}, // CYRILLIC CAPITAL LETTER SHA -+ {"shcy", 0x00448}, // CYRILLIC SMALL LETTER SHA -+ {"ShortDownArrow", 0x02193}, // DOWNWARDS ARROW -+ {"ShortLeftArrow", 0x02190}, // LEFTWARDS ARROW -+ {"shortmid", 0x02223}, // DIVIDES -+ {"shortparallel", 0x02225}, // PARALLEL TO -+ {"ShortRightArrow", 0x02192}, // RIGHTWARDS ARROW -+ {"ShortUpArrow", 0x02191}, // UPWARDS ARROW -+ {"shy", 0x000AD}, // SOFT HYPHEN -+ {"Sigma", 0x003A3}, // GREEK CAPITAL LETTER SIGMA -+ {"sigma", 0x003C3}, // GREEK SMALL LETTER SIGMA -+ {"sigmaf", 0x003C2}, // GREEK SMALL LETTER FINAL SIGMA -+ {"sigmav", 0x003C2}, // GREEK SMALL LETTER FINAL SIGMA -+ {"sim", 0x0223C}, // TILDE OPERATOR -+ {"simdot", 0x02A6A}, // TILDE OPERATOR WITH DOT ABOVE -+ {"sime", 0x02243}, // ASYMPTOTICALLY EQUAL TO -+ {"simeq", 0x02243}, // ASYMPTOTICALLY EQUAL TO -+ {"simg", 0x02A9E}, // SIMILAR OR GREATER-THAN -+ {"simgE", 0x02AA0}, // SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN -+ {"siml", 0x02A9D}, // SIMILAR OR LESS-THAN -+ {"simlE", 0x02A9F}, // SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN -+ {"simne", 0x02246}, // APPROXIMATELY BUT NOT ACTUALLY EQUAL TO -+ {"simplus", 0x02A24}, // PLUS SIGN WITH TILDE ABOVE -+ {"simrarr", 0x02972}, // TILDE OPERATOR ABOVE RIGHTWARDS ARROW -+ {"slarr", 0x02190}, // LEFTWARDS ARROW -+ {"SmallCircle", 0x02218}, // RING OPERATOR -+ {"smallsetminus", 0x02216}, // SET MINUS -+ {"smashp", 0x02A33}, // SMASH PRODUCT -+ {"smeparsl", 0x029E4}, // EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE -+ {"smid", 0x02223}, // DIVIDES -+ {"smile", 0x02323}, // SMILE -+ {"smt", 0x02AAA}, // SMALLER THAN -+ {"smte", 0x02AAC}, // SMALLER THAN OR EQUAL TO -+// "smtes", 0x02AAC;0x0FE00}, // SMALLER THAN OR slanted EQUAL -+ {"SOFTcy", 0x0042C}, // CYRILLIC CAPITAL LETTER SOFT SIGN -+ {"softcy", 0x0044C}, // CYRILLIC SMALL LETTER SOFT SIGN -+ {"sol", 0x0002F}, // SOLIDUS -+ {"solb", 0x029C4}, // SQUARED RISING DIAGONAL SLASH -+ {"solbar", 0x0233F}, // APL FUNCTIONAL SYMBOL SLASH BAR -+ {"Sopf", 0x1D54A}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL S -+ {"sopf", 0x1D564}, // MATHEMATICAL DOUBLE-STRUCK SMALL S -+ {"spades", 0x02660}, // BLACK SPADE SUIT -+ {"spadesuit", 0x02660}, // BLACK SPADE SUIT -+ {"spar", 0x02225}, // PARALLEL TO -+ {"sqcap", 0x02293}, // SQUARE CAP -+// "sqcaps", 0x02293;0x0FE00}, // SQUARE CAP with serifs -+ {"sqcup", 0x02294}, // SQUARE CUP -+// "sqcups", 0x02294;0x0FE00}, // SQUARE CUP with serifs -+ {"Sqrt", 0x0221A}, // SQUARE ROOT -+ {"sqsub", 0x0228F}, // SQUARE IMAGE OF -+ {"sqsube", 0x02291}, // SQUARE IMAGE OF OR EQUAL TO -+ {"sqsubset", 0x0228F}, // SQUARE IMAGE OF -+ {"sqsubseteq", 0x02291}, // SQUARE IMAGE OF OR EQUAL TO -+ {"sqsup", 0x02290}, // SQUARE ORIGINAL OF -+ {"sqsupe", 0x02292}, // SQUARE ORIGINAL OF OR EQUAL TO -+ {"sqsupset", 0x02290}, // SQUARE ORIGINAL OF -+ {"sqsupseteq", 0x02292}, // SQUARE ORIGINAL OF OR EQUAL TO -+ {"squ", 0x025A1}, // WHITE SQUARE -+ {"square", 0x025A1}, // WHITE SQUARE -+ {"Square", 0x025A1}, // WHITE SQUARE -+ {"SquareIntersection", 0x02293}, // SQUARE CAP -+ {"SquareSubset", 0x0228F}, // SQUARE IMAGE OF -+ {"SquareSubsetEqual", 0x02291}, // SQUARE IMAGE OF OR EQUAL TO -+ {"SquareSuperset", 0x02290}, // SQUARE ORIGINAL OF -+ {"SquareSupersetEqual", 0x02292}, // SQUARE ORIGINAL OF OR EQUAL TO -+ {"SquareUnion", 0x02294}, // SQUARE CUP -+ {"squarf", 0x025AA}, // BLACK SMALL SQUARE -+ {"squf", 0x025AA}, // BLACK SMALL SQUARE -+ {"srarr", 0x02192}, // RIGHTWARDS ARROW -+ {"Sscr", 0x1D4AE}, // MATHEMATICAL SCRIPT CAPITAL S -+ {"sscr", 0x1D4C8}, // MATHEMATICAL SCRIPT SMALL S -+ {"ssetmn", 0x02216}, // SET MINUS -+ {"ssmile", 0x02323}, // SMILE -+ {"sstarf", 0x022C6}, // STAR OPERATOR -+ {"Star", 0x022C6}, // STAR OPERATOR -+ {"star", 0x02606}, // WHITE STAR -+ {"starf", 0x02605}, // BLACK STAR -+ {"straightepsilon", 0x003F5}, // GREEK LUNATE EPSILON SYMBOL -+ {"straightphi", 0x003D5}, // GREEK PHI SYMBOL -+ {"strns", 0x000AF}, // MACRON -+ {"sub", 0x02282}, // SUBSET OF -+ {"Sub", 0x022D0}, // DOUBLE SUBSET -+ {"subdot", 0x02ABD}, // SUBSET WITH DOT -+ {"sube", 0x02286}, // SUBSET OF OR EQUAL TO -+ {"subE", 0x02AC5}, // SUBSET OF ABOVE EQUALS SIGN -+ {"subedot", 0x02AC3}, // SUBSET OF OR EQUAL TO WITH DOT ABOVE -+ {"submult", 0x02AC1}, // SUBSET WITH MULTIPLICATION SIGN BELOW -+ {"subne", 0x0228A}, // SUBSET OF WITH NOT EQUAL TO -+ {"subnE", 0x02ACB}, // SUBSET OF ABOVE NOT EQUAL TO -+ {"subplus", 0x02ABF}, // SUBSET WITH PLUS SIGN BELOW -+ {"subrarr", 0x02979}, // SUBSET ABOVE RIGHTWARDS ARROW -+ {"subset", 0x02282}, // SUBSET OF -+ {"Subset", 0x022D0}, // DOUBLE SUBSET -+ {"subseteq", 0x02286}, // SUBSET OF OR EQUAL TO -+ {"subseteqq", 0x02AC5}, // SUBSET OF ABOVE EQUALS SIGN -+ {"SubsetEqual", 0x02286}, // SUBSET OF OR EQUAL TO -+ {"subsetneq", 0x0228A}, // SUBSET OF WITH NOT EQUAL TO -+ {"subsetneqq", 0x02ACB}, // SUBSET OF ABOVE NOT EQUAL TO -+ {"subsim", 0x02AC7}, // SUBSET OF ABOVE TILDE OPERATOR -+ {"subsub", 0x02AD5}, // SUBSET ABOVE SUBSET -+ {"subsup", 0x02AD3}, // SUBSET ABOVE SUPERSET -+ {"succ", 0x0227B}, // SUCCEEDS -+ {"succapprox", 0x02AB8}, // SUCCEEDS ABOVE ALMOST EQUAL TO -+ {"succcurlyeq", 0x0227D}, // SUCCEEDS OR EQUAL TO -+ {"Succeeds", 0x0227B}, // SUCCEEDS -+ {"SucceedsEqual", 0x02AB0}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -+ {"SucceedsSlantEqual", 0x0227D}, // SUCCEEDS OR EQUAL TO -+ {"SucceedsTilde", 0x0227F}, // SUCCEEDS OR EQUIVALENT TO -+ {"succeq", 0x02AB0}, // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN -+ {"succnapprox", 0x02ABA}, // SUCCEEDS ABOVE NOT ALMOST EQUAL TO -+ {"succneqq", 0x02AB6}, // SUCCEEDS ABOVE NOT EQUAL TO -+ {"succnsim", 0x022E9}, // SUCCEEDS BUT NOT EQUIVALENT TO -+ {"succsim", 0x0227F}, // SUCCEEDS OR EQUIVALENT TO -+ {"SuchThat", 0x0220B}, // CONTAINS AS MEMBER -+ {"sum", 0x02211}, // N-ARY SUMMATION -+ {"Sum", 0x02211}, // N-ARY SUMMATION -+ {"sung", 0x0266A}, // EIGHTH NOTE -+ {"sup", 0x02283}, // SUPERSET OF -+ {"Sup", 0x022D1}, // DOUBLE SUPERSET -+ {"sup1", 0x000B9}, // SUPERSCRIPT ONE -+ {"sup2", 0x000B2}, // SUPERSCRIPT TWO -+ {"sup3", 0x000B3}, // SUPERSCRIPT THREE -+ {"supdot", 0x02ABE}, // SUPERSET WITH DOT -+ {"supdsub", 0x02AD8}, // SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET -+ {"supe", 0x02287}, // SUPERSET OF OR EQUAL TO -+ {"supE", 0x02AC6}, // SUPERSET OF ABOVE EQUALS SIGN -+ {"supedot", 0x02AC4}, // SUPERSET OF OR EQUAL TO WITH DOT ABOVE -+ {"Superset", 0x02283}, // SUPERSET OF -+ {"SupersetEqual", 0x02287}, // SUPERSET OF OR EQUAL TO -+ {"suphsol", 0x027C9}, // SUPERSET PRECEDING SOLIDUS -+ {"suphsub", 0x02AD7}, // SUPERSET BESIDE SUBSET -+ {"suplarr", 0x0297B}, // SUPERSET ABOVE LEFTWARDS ARROW -+ {"supmult", 0x02AC2}, // SUPERSET WITH MULTIPLICATION SIGN BELOW -+ {"supne", 0x0228B}, // SUPERSET OF WITH NOT EQUAL TO -+ {"supnE", 0x02ACC}, // SUPERSET OF ABOVE NOT EQUAL TO -+ {"supplus", 0x02AC0}, // SUPERSET WITH PLUS SIGN BELOW -+ {"supset", 0x02283}, // SUPERSET OF -+ {"Supset", 0x022D1}, // DOUBLE SUPERSET -+ {"supseteq", 0x02287}, // SUPERSET OF OR EQUAL TO -+ {"supseteqq", 0x02AC6}, // SUPERSET OF ABOVE EQUALS SIGN -+ {"supsetneq", 0x0228B}, // SUPERSET OF WITH NOT EQUAL TO -+ {"supsetneqq", 0x02ACC}, // SUPERSET OF ABOVE NOT EQUAL TO -+ {"supsim", 0x02AC8}, // SUPERSET OF ABOVE TILDE OPERATOR -+ {"supsub", 0x02AD4}, // SUPERSET ABOVE SUBSET -+ {"supsup", 0x02AD6}, // SUPERSET ABOVE SUPERSET -+ {"swarhk", 0x02926}, // SOUTH WEST ARROW WITH HOOK -+ {"swarr", 0x02199}, // SOUTH WEST ARROW -+ {"swArr", 0x021D9}, // SOUTH WEST DOUBLE ARROW -+ {"swarrow", 0x02199}, // SOUTH WEST ARROW -+ {"swnwar", 0x0292A}, // SOUTH WEST ARROW AND NORTH WEST ARROW -+ {"szlig", 0x000DF}, // LATIN SMALL LETTER SHARP S -+ {NULL, 0} - }; - - static NameId namesT[]={ -- "Tab", 0x00009, // CHARACTER TABULATION -- "target", 0x02316, // POSITION INDICATOR -- "Tau", 0x003A4, // GREEK CAPITAL LETTER TAU -- "tau", 0x003C4, // GREEK SMALL LETTER TAU -- "tbrk", 0x023B4, // TOP SQUARE BRACKET -- "Tcaron", 0x00164, // LATIN CAPITAL LETTER T WITH CARON -- "tcaron", 0x00165, // LATIN SMALL LETTER T WITH CARON -- "Tcedil", 0x00162, // LATIN CAPITAL LETTER T WITH CEDILLA -- "tcedil", 0x00163, // LATIN SMALL LETTER T WITH CEDILLA -- "Tcy", 0x00422, // CYRILLIC CAPITAL LETTER TE -- "tcy", 0x00442, // CYRILLIC SMALL LETTER TE -- "tdot", 0x020DB, // COMBINING THREE DOTS ABOVE -- "telrec", 0x02315, // TELEPHONE RECORDER -- "Tfr", 0x1D517, // MATHEMATICAL FRAKTUR CAPITAL T -- "tfr", 0x1D531, // MATHEMATICAL FRAKTUR SMALL T -- "Tgr", 0x003A4, // GREEK CAPITAL LETTER TAU -- "tgr", 0x003C4, // GREEK SMALL LETTER TAU -- "there4", 0x02234, // THEREFORE -- "therefore", 0x02234, // THEREFORE -- "Therefore", 0x02234, // THEREFORE -- "Theta", 0x00398, // GREEK CAPITAL LETTER THETA -- "theta", 0x003B8, // GREEK SMALL LETTER THETA -- "thetasym", 0x003D1, // GREEK THETA SYMBOL -- "thetav", 0x003D1, // GREEK THETA SYMBOL -- "THgr", 0x00398, // GREEK CAPITAL LETTER THETA -- "thgr", 0x003B8, // GREEK SMALL LETTER THETA -- "thickapprox", 0x02248, // ALMOST EQUAL TO -- "thicksim", 0x0223C, // TILDE OPERATOR --// "ThickSpace", 0x0205F;0x0200A, // space of width 5/18 em -- "thinsp", 0x02009, // THIN SPACE -- "ThinSpace", 0x02009, // THIN SPACE -- "thkap", 0x02248, // ALMOST EQUAL TO -- "thksim", 0x0223C, // TILDE OPERATOR -- "THORN", 0x000DE, // LATIN CAPITAL LETTER THORN -- "thorn", 0x000FE, // LATIN SMALL LETTER THORN -- "tilde", 0x002DC, // SMALL TILDE -- "Tilde", 0x0223C, // TILDE OPERATOR -- "TildeEqual", 0x02243, // ASYMPTOTICALLY EQUAL TO -- "TildeFullEqual", 0x02245, // APPROXIMATELY EQUAL TO -- "TildeTilde", 0x02248, // ALMOST EQUAL TO -- "times", 0x000D7, // MULTIPLICATION SIGN -- "timesb", 0x022A0, // SQUARED TIMES -- "timesbar", 0x02A31, // MULTIPLICATION SIGN WITH UNDERBAR -- "timesd", 0x02A30, // MULTIPLICATION SIGN WITH DOT ABOVE -- "tint", 0x0222D, // TRIPLE INTEGRAL -- "toea", 0x02928, // NORTH EAST ARROW AND SOUTH EAST ARROW -- "top", 0x022A4, // DOWN TACK -- "topbot", 0x02336, // APL FUNCTIONAL SYMBOL I-BEAM -- "topcir", 0x02AF1, // DOWN TACK WITH CIRCLE BELOW -- "Topf", 0x1D54B, // MATHEMATICAL DOUBLE-STRUCK CAPITAL T -- "topf", 0x1D565, // MATHEMATICAL DOUBLE-STRUCK SMALL T -- "topfork", 0x02ADA, // PITCHFORK WITH TEE TOP -- "tosa", 0x02929, // SOUTH EAST ARROW AND SOUTH WEST ARROW -- "tprime", 0x02034, // TRIPLE PRIME -- "trade", 0x02122, // TRADE MARK SIGN -- "TRADE", 0x02122, // TRADE MARK SIGN -- "triangle", 0x025B5, // WHITE UP-POINTING SMALL TRIANGLE -- "triangledown", 0x025BF, // WHITE DOWN-POINTING SMALL TRIANGLE -- "triangleleft", 0x025C3, // WHITE LEFT-POINTING SMALL TRIANGLE -- "trianglelefteq", 0x022B4, // NORMAL SUBGROUP OF OR EQUAL TO -- "triangleq", 0x0225C, // DELTA EQUAL TO -- "triangleright", 0x025B9, // WHITE RIGHT-POINTING SMALL TRIANGLE -- "trianglerighteq", 0x022B5, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -- "tridot", 0x025EC, // WHITE UP-POINTING TRIANGLE WITH DOT -- "trie", 0x0225C, // DELTA EQUAL TO -- "triminus", 0x02A3A, // MINUS SIGN IN TRIANGLE -- "TripleDot", 0x020DB, // COMBINING THREE DOTS ABOVE -- "triplus", 0x02A39, // PLUS SIGN IN TRIANGLE -- "trisb", 0x029CD, // TRIANGLE WITH SERIFS AT BOTTOM -- "tritime", 0x02A3B, // MULTIPLICATION SIGN IN TRIANGLE -- "trpezium", 0x023E2, // WHITE TRAPEZIUM -- "Tscr", 0x1D4AF, // MATHEMATICAL SCRIPT CAPITAL T -- "tscr", 0x1D4C9, // MATHEMATICAL SCRIPT SMALL T -- "TScy", 0x00426, // CYRILLIC CAPITAL LETTER TSE -- "tscy", 0x00446, // CYRILLIC SMALL LETTER TSE -- "TSHcy", 0x0040B, // CYRILLIC CAPITAL LETTER TSHE -- "tshcy", 0x0045B, // CYRILLIC SMALL LETTER TSHE -- "Tstrok", 0x00166, // LATIN CAPITAL LETTER T WITH STROKE -- "tstrok", 0x00167, // LATIN SMALL LETTER T WITH STROKE -- "twixt", 0x0226C, // BETWEEN -- "twoheadleftarrow", 0x0219E, // LEFTWARDS TWO HEADED ARROW -- "twoheadrightarrow", 0x021A0, // RIGHTWARDS TWO HEADED ARROW -- NULL, 0 -+ {"Tab", 0x00009}, // CHARACTER TABULATION -+ {"target", 0x02316}, // POSITION INDICATOR -+ {"Tau", 0x003A4}, // GREEK CAPITAL LETTER TAU -+ {"tau", 0x003C4}, // GREEK SMALL LETTER TAU -+ {"tbrk", 0x023B4}, // TOP SQUARE BRACKET -+ {"Tcaron", 0x00164}, // LATIN CAPITAL LETTER T WITH CARON -+ {"tcaron", 0x00165}, // LATIN SMALL LETTER T WITH CARON -+ {"Tcedil", 0x00162}, // LATIN CAPITAL LETTER T WITH CEDILLA -+ {"tcedil", 0x00163}, // LATIN SMALL LETTER T WITH CEDILLA -+ {"Tcy", 0x00422}, // CYRILLIC CAPITAL LETTER TE -+ {"tcy", 0x00442}, // CYRILLIC SMALL LETTER TE -+ {"tdot", 0x020DB}, // COMBINING THREE DOTS ABOVE -+ {"telrec", 0x02315}, // TELEPHONE RECORDER -+ {"Tfr", 0x1D517}, // MATHEMATICAL FRAKTUR CAPITAL T -+ {"tfr", 0x1D531}, // MATHEMATICAL FRAKTUR SMALL T -+ {"Tgr", 0x003A4}, // GREEK CAPITAL LETTER TAU -+ {"tgr", 0x003C4}, // GREEK SMALL LETTER TAU -+ {"there4", 0x02234}, // THEREFORE -+ {"therefore", 0x02234}, // THEREFORE -+ {"Therefore", 0x02234}, // THEREFORE -+ {"Theta", 0x00398}, // GREEK CAPITAL LETTER THETA -+ {"theta", 0x003B8}, // GREEK SMALL LETTER THETA -+ {"thetasym", 0x003D1}, // GREEK THETA SYMBOL -+ {"thetav", 0x003D1}, // GREEK THETA SYMBOL -+ {"THgr", 0x00398}, // GREEK CAPITAL LETTER THETA -+ {"thgr", 0x003B8}, // GREEK SMALL LETTER THETA -+ {"thickapprox", 0x02248}, // ALMOST EQUAL TO -+ {"thicksim", 0x0223C}, // TILDE OPERATOR -+// "ThickSpace", 0x0205F;0x0200A}, // space of width 5/18 em -+ {"thinsp", 0x02009}, // THIN SPACE -+ {"ThinSpace", 0x02009}, // THIN SPACE -+ {"thkap", 0x02248}, // ALMOST EQUAL TO -+ {"thksim", 0x0223C}, // TILDE OPERATOR -+ {"THORN", 0x000DE}, // LATIN CAPITAL LETTER THORN -+ {"thorn", 0x000FE}, // LATIN SMALL LETTER THORN -+ {"tilde", 0x002DC}, // SMALL TILDE -+ {"Tilde", 0x0223C}, // TILDE OPERATOR -+ {"TildeEqual", 0x02243}, // ASYMPTOTICALLY EQUAL TO -+ {"TildeFullEqual", 0x02245}, // APPROXIMATELY EQUAL TO -+ {"TildeTilde", 0x02248}, // ALMOST EQUAL TO -+ {"times", 0x000D7}, // MULTIPLICATION SIGN -+ {"timesb", 0x022A0}, // SQUARED TIMES -+ {"timesbar", 0x02A31}, // MULTIPLICATION SIGN WITH UNDERBAR -+ {"timesd", 0x02A30}, // MULTIPLICATION SIGN WITH DOT ABOVE -+ {"tint", 0x0222D}, // TRIPLE INTEGRAL -+ {"toea", 0x02928}, // NORTH EAST ARROW AND SOUTH EAST ARROW -+ {"top", 0x022A4}, // DOWN TACK -+ {"topbot", 0x02336}, // APL FUNCTIONAL SYMBOL I-BEAM -+ {"topcir", 0x02AF1}, // DOWN TACK WITH CIRCLE BELOW -+ {"Topf", 0x1D54B}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL T -+ {"topf", 0x1D565}, // MATHEMATICAL DOUBLE-STRUCK SMALL T -+ {"topfork", 0x02ADA}, // PITCHFORK WITH TEE TOP -+ {"tosa", 0x02929}, // SOUTH EAST ARROW AND SOUTH WEST ARROW -+ {"tprime", 0x02034}, // TRIPLE PRIME -+ {"trade", 0x02122}, // TRADE MARK SIGN -+ {"TRADE", 0x02122}, // TRADE MARK SIGN -+ {"triangle", 0x025B5}, // WHITE UP-POINTING SMALL TRIANGLE -+ {"triangledown", 0x025BF}, // WHITE DOWN-POINTING SMALL TRIANGLE -+ {"triangleleft", 0x025C3}, // WHITE LEFT-POINTING SMALL TRIANGLE -+ {"trianglelefteq", 0x022B4}, // NORMAL SUBGROUP OF OR EQUAL TO -+ {"triangleq", 0x0225C}, // DELTA EQUAL TO -+ {"triangleright", 0x025B9}, // WHITE RIGHT-POINTING SMALL TRIANGLE -+ {"trianglerighteq", 0x022B5}, // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO -+ {"tridot", 0x025EC}, // WHITE UP-POINTING TRIANGLE WITH DOT -+ {"trie", 0x0225C}, // DELTA EQUAL TO -+ {"triminus", 0x02A3A}, // MINUS SIGN IN TRIANGLE -+ {"TripleDot", 0x020DB}, // COMBINING THREE DOTS ABOVE -+ {"triplus", 0x02A39}, // PLUS SIGN IN TRIANGLE -+ {"trisb", 0x029CD}, // TRIANGLE WITH SERIFS AT BOTTOM -+ {"tritime", 0x02A3B}, // MULTIPLICATION SIGN IN TRIANGLE -+ {"trpezium", 0x023E2}, // WHITE TRAPEZIUM -+ {"Tscr", 0x1D4AF}, // MATHEMATICAL SCRIPT CAPITAL T -+ {"tscr", 0x1D4C9}, // MATHEMATICAL SCRIPT SMALL T -+ {"TScy", 0x00426}, // CYRILLIC CAPITAL LETTER TSE -+ {"tscy", 0x00446}, // CYRILLIC SMALL LETTER TSE -+ {"TSHcy", 0x0040B}, // CYRILLIC CAPITAL LETTER TSHE -+ {"tshcy", 0x0045B}, // CYRILLIC SMALL LETTER TSHE -+ {"Tstrok", 0x00166}, // LATIN CAPITAL LETTER T WITH STROKE -+ {"tstrok", 0x00167}, // LATIN SMALL LETTER T WITH STROKE -+ {"twixt", 0x0226C}, // BETWEEN -+ {"twoheadleftarrow", 0x0219E}, // LEFTWARDS TWO HEADED ARROW -+ {"twoheadrightarrow", 0x021A0}, // RIGHTWARDS TWO HEADED ARROW -+ {NULL, 0} - }; - - static NameId namesU[]={ -- "Uacgr", 0x0038E, // GREEK CAPITAL LETTER UPSILON WITH TONOS -- "uacgr", 0x003CD, // GREEK SMALL LETTER UPSILON WITH TONOS -- "Uacute", 0x000DA, // LATIN CAPITAL LETTER U WITH ACUTE -- "uacute", 0x000FA, // LATIN SMALL LETTER U WITH ACUTE -- "uarr", 0x02191, // UPWARDS ARROW -- "Uarr", 0x0219F, // UPWARDS TWO HEADED ARROW -- "uArr", 0x021D1, // UPWARDS DOUBLE ARROW -- "Uarrocir", 0x02949, // UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE -- "Ubrcy", 0x0040E, // CYRILLIC CAPITAL LETTER SHORT U -- "ubrcy", 0x0045E, // CYRILLIC SMALL LETTER SHORT U -- "Ubreve", 0x0016C, // LATIN CAPITAL LETTER U WITH BREVE -- "ubreve", 0x0016D, // LATIN SMALL LETTER U WITH BREVE -- "Ucirc", 0x000DB, // LATIN CAPITAL LETTER U WITH CIRCUMFLEX -- "ucirc", 0x000FB, // LATIN SMALL LETTER U WITH CIRCUMFLEX -- "Ucy", 0x00423, // CYRILLIC CAPITAL LETTER U -- "ucy", 0x00443, // CYRILLIC SMALL LETTER U -- "udarr", 0x021C5, // UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW -- "Udblac", 0x00170, // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -- "udblac", 0x00171, // LATIN SMALL LETTER U WITH DOUBLE ACUTE -- "udhar", 0x0296E, // UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -- "udiagr", 0x003B0, // GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS -- "Udigr", 0x003AB, // GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA -- "udigr", 0x003CB, // GREEK SMALL LETTER UPSILON WITH DIALYTIKA -- "ufisht", 0x0297E, // UP FISH TAIL -- "Ufr", 0x1D518, // MATHEMATICAL FRAKTUR CAPITAL U -- "ufr", 0x1D532, // MATHEMATICAL FRAKTUR SMALL U -- "Ugr", 0x003A5, // GREEK CAPITAL LETTER UPSILON -- "ugr", 0x003C5, // GREEK SMALL LETTER UPSILON -- "Ugrave", 0x000D9, // LATIN CAPITAL LETTER U WITH GRAVE -- "ugrave", 0x000F9, // LATIN SMALL LETTER U WITH GRAVE -- "uHar", 0x02963, // UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -- "uharl", 0x021BF, // UPWARDS HARPOON WITH BARB LEFTWARDS -- "uharr", 0x021BE, // UPWARDS HARPOON WITH BARB RIGHTWARDS -- "uhblk", 0x02580, // UPPER HALF BLOCK -- "ulcorn", 0x0231C, // TOP LEFT CORNER -- "ulcorner", 0x0231C, // TOP LEFT CORNER -- "ulcrop", 0x0230F, // TOP LEFT CROP -- "ultri", 0x025F8, // UPPER LEFT TRIANGLE -- "Umacr", 0x0016A, // LATIN CAPITAL LETTER U WITH MACRON -- "umacr", 0x0016B, // LATIN SMALL LETTER U WITH MACRON -- "uml", 0x000A8, // DIAERESIS -- "UnderBar", 0x0005F, // LOW LINE -- "UnderBrace", 0x023DF, // BOTTOM CURLY BRACKET -- "UnderBracket", 0x023B5, // BOTTOM SQUARE BRACKET -- "UnderParenthesis", 0x023DD, // BOTTOM PARENTHESIS -- "Union", 0x022C3, // N-ARY UNION -- "UnionPlus", 0x0228E, // MULTISET UNION -- "Uogon", 0x00172, // LATIN CAPITAL LETTER U WITH OGONEK -- "uogon", 0x00173, // LATIN SMALL LETTER U WITH OGONEK -- "Uopf", 0x1D54C, // MATHEMATICAL DOUBLE-STRUCK CAPITAL U -- "uopf", 0x1D566, // MATHEMATICAL DOUBLE-STRUCK SMALL U -- "uparrow", 0x02191, // UPWARDS ARROW -- "UpArrow", 0x02191, // UPWARDS ARROW -- "Uparrow", 0x021D1, // UPWARDS DOUBLE ARROW -- "UpArrowBar", 0x02912, // UPWARDS ARROW TO BAR -- "UpArrowDownArrow", 0x021C5, // UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW -- "updownarrow", 0x02195, // UP DOWN ARROW -- "UpDownArrow", 0x02195, // UP DOWN ARROW -- "Updownarrow", 0x021D5, // UP DOWN DOUBLE ARROW -- "UpEquilibrium", 0x0296E, // UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -- "upharpoonleft", 0x021BF, // UPWARDS HARPOON WITH BARB LEFTWARDS -- "upharpoonright", 0x021BE, // UPWARDS HARPOON WITH BARB RIGHTWARDS -- "uplus", 0x0228E, // MULTISET UNION -- "UpperLeftArrow", 0x02196, // NORTH WEST ARROW -- "UpperRightArrow", 0x02197, // NORTH EAST ARROW -- "upsi", 0x003C5, // GREEK SMALL LETTER UPSILON -- "Upsi", 0x003D2, // GREEK UPSILON WITH HOOK SYMBOL -- "upsih", 0x003D2, // GREEK UPSILON WITH HOOK SYMBOL -- "Upsilon", 0x003A5, // GREEK CAPITAL LETTER UPSILON -- "upsilon", 0x003C5, // GREEK SMALL LETTER UPSILON -- "UpTee", 0x022A5, // UP TACK -- "UpTeeArrow", 0x021A5, // UPWARDS ARROW FROM BAR -- "upuparrows", 0x021C8, // UPWARDS PAIRED ARROWS -- "urcorn", 0x0231D, // TOP RIGHT CORNER -- "urcorner", 0x0231D, // TOP RIGHT CORNER -- "urcrop", 0x0230E, // TOP RIGHT CROP -- "Uring", 0x0016E, // LATIN CAPITAL LETTER U WITH RING ABOVE -- "uring", 0x0016F, // LATIN SMALL LETTER U WITH RING ABOVE -- "urtri", 0x025F9, // UPPER RIGHT TRIANGLE -- "Uscr", 0x1D4B0, // MATHEMATICAL SCRIPT CAPITAL U -- "uscr", 0x1D4CA, // MATHEMATICAL SCRIPT SMALL U -- "utdot", 0x022F0, // UP RIGHT DIAGONAL ELLIPSIS -- "Utilde", 0x00168, // LATIN CAPITAL LETTER U WITH TILDE -- "utilde", 0x00169, // LATIN SMALL LETTER U WITH TILDE -- "utri", 0x025B5, // WHITE UP-POINTING SMALL TRIANGLE -- "utrif", 0x025B4, // BLACK UP-POINTING SMALL TRIANGLE -- "uuarr", 0x021C8, // UPWARDS PAIRED ARROWS -- "Uuml", 0x000DC, // LATIN CAPITAL LETTER U WITH DIAERESIS -- "uuml", 0x000FC, // LATIN SMALL LETTER U WITH DIAERESIS -- "uwangle", 0x029A7, // OBLIQUE ANGLE OPENING DOWN -- NULL, 0 -+ {"Uacgr", 0x0038E}, // GREEK CAPITAL LETTER UPSILON WITH TONOS -+ {"uacgr", 0x003CD}, // GREEK SMALL LETTER UPSILON WITH TONOS -+ {"Uacute", 0x000DA}, // LATIN CAPITAL LETTER U WITH ACUTE -+ {"uacute", 0x000FA}, // LATIN SMALL LETTER U WITH ACUTE -+ {"uarr", 0x02191}, // UPWARDS ARROW -+ {"Uarr", 0x0219F}, // UPWARDS TWO HEADED ARROW -+ {"uArr", 0x021D1}, // UPWARDS DOUBLE ARROW -+ {"Uarrocir", 0x02949}, // UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE -+ {"Ubrcy", 0x0040E}, // CYRILLIC CAPITAL LETTER SHORT U -+ {"ubrcy", 0x0045E}, // CYRILLIC SMALL LETTER SHORT U -+ {"Ubreve", 0x0016C}, // LATIN CAPITAL LETTER U WITH BREVE -+ {"ubreve", 0x0016D}, // LATIN SMALL LETTER U WITH BREVE -+ {"Ucirc", 0x000DB}, // LATIN CAPITAL LETTER U WITH CIRCUMFLEX -+ {"ucirc", 0x000FB}, // LATIN SMALL LETTER U WITH CIRCUMFLEX -+ {"Ucy", 0x00423}, // CYRILLIC CAPITAL LETTER U -+ {"ucy", 0x00443}, // CYRILLIC SMALL LETTER U -+ {"udarr", 0x021C5}, // UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW -+ {"Udblac", 0x00170}, // LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -+ {"udblac", 0x00171}, // LATIN SMALL LETTER U WITH DOUBLE ACUTE -+ {"udhar", 0x0296E}, // UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -+ {"udiagr", 0x003B0}, // GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS -+ {"Udigr", 0x003AB}, // GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA -+ {"udigr", 0x003CB}, // GREEK SMALL LETTER UPSILON WITH DIALYTIKA -+ {"ufisht", 0x0297E}, // UP FISH TAIL -+ {"Ufr", 0x1D518}, // MATHEMATICAL FRAKTUR CAPITAL U -+ {"ufr", 0x1D532}, // MATHEMATICAL FRAKTUR SMALL U -+ {"Ugr", 0x003A5}, // GREEK CAPITAL LETTER UPSILON -+ {"ugr", 0x003C5}, // GREEK SMALL LETTER UPSILON -+ {"Ugrave", 0x000D9}, // LATIN CAPITAL LETTER U WITH GRAVE -+ {"ugrave", 0x000F9}, // LATIN SMALL LETTER U WITH GRAVE -+ {"uHar", 0x02963}, // UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT -+ {"uharl", 0x021BF}, // UPWARDS HARPOON WITH BARB LEFTWARDS -+ {"uharr", 0x021BE}, // UPWARDS HARPOON WITH BARB RIGHTWARDS -+ {"uhblk", 0x02580}, // UPPER HALF BLOCK -+ {"ulcorn", 0x0231C}, // TOP LEFT CORNER -+ {"ulcorner", 0x0231C}, // TOP LEFT CORNER -+ {"ulcrop", 0x0230F}, // TOP LEFT CROP -+ {"ultri", 0x025F8}, // UPPER LEFT TRIANGLE -+ {"Umacr", 0x0016A}, // LATIN CAPITAL LETTER U WITH MACRON -+ {"umacr", 0x0016B}, // LATIN SMALL LETTER U WITH MACRON -+ {"uml", 0x000A8}, // DIAERESIS -+ {"UnderBar", 0x0005F}, // LOW LINE -+ {"UnderBrace", 0x023DF}, // BOTTOM CURLY BRACKET -+ {"UnderBracket", 0x023B5}, // BOTTOM SQUARE BRACKET -+ {"UnderParenthesis", 0x023DD}, // BOTTOM PARENTHESIS -+ {"Union", 0x022C3}, // N-ARY UNION -+ {"UnionPlus", 0x0228E}, // MULTISET UNION -+ {"Uogon", 0x00172}, // LATIN CAPITAL LETTER U WITH OGONEK -+ {"uogon", 0x00173}, // LATIN SMALL LETTER U WITH OGONEK -+ {"Uopf", 0x1D54C}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL U -+ {"uopf", 0x1D566}, // MATHEMATICAL DOUBLE-STRUCK SMALL U -+ {"uparrow", 0x02191}, // UPWARDS ARROW -+ {"UpArrow", 0x02191}, // UPWARDS ARROW -+ {"Uparrow", 0x021D1}, // UPWARDS DOUBLE ARROW -+ {"UpArrowBar", 0x02912}, // UPWARDS ARROW TO BAR -+ {"UpArrowDownArrow", 0x021C5}, // UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW -+ {"updownarrow", 0x02195}, // UP DOWN ARROW -+ {"UpDownArrow", 0x02195}, // UP DOWN ARROW -+ {"Updownarrow", 0x021D5}, // UP DOWN DOUBLE ARROW -+ {"UpEquilibrium", 0x0296E}, // UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT -+ {"upharpoonleft", 0x021BF}, // UPWARDS HARPOON WITH BARB LEFTWARDS -+ {"upharpoonright", 0x021BE}, // UPWARDS HARPOON WITH BARB RIGHTWARDS -+ {"uplus", 0x0228E}, // MULTISET UNION -+ {"UpperLeftArrow", 0x02196}, // NORTH WEST ARROW -+ {"UpperRightArrow", 0x02197}, // NORTH EAST ARROW -+ {"upsi", 0x003C5}, // GREEK SMALL LETTER UPSILON -+ {"Upsi", 0x003D2}, // GREEK UPSILON WITH HOOK SYMBOL -+ {"upsih", 0x003D2}, // GREEK UPSILON WITH HOOK SYMBOL -+ {"Upsilon", 0x003A5}, // GREEK CAPITAL LETTER UPSILON -+ {"upsilon", 0x003C5}, // GREEK SMALL LETTER UPSILON -+ {"UpTee", 0x022A5}, // UP TACK -+ {"UpTeeArrow", 0x021A5}, // UPWARDS ARROW FROM BAR -+ {"upuparrows", 0x021C8}, // UPWARDS PAIRED ARROWS -+ {"urcorn", 0x0231D}, // TOP RIGHT CORNER -+ {"urcorner", 0x0231D}, // TOP RIGHT CORNER -+ {"urcrop", 0x0230E}, // TOP RIGHT CROP -+ {"Uring", 0x0016E}, // LATIN CAPITAL LETTER U WITH RING ABOVE -+ {"uring", 0x0016F}, // LATIN SMALL LETTER U WITH RING ABOVE -+ {"urtri", 0x025F9}, // UPPER RIGHT TRIANGLE -+ {"Uscr", 0x1D4B0}, // MATHEMATICAL SCRIPT CAPITAL U -+ {"uscr", 0x1D4CA}, // MATHEMATICAL SCRIPT SMALL U -+ {"utdot", 0x022F0}, // UP RIGHT DIAGONAL ELLIPSIS -+ {"Utilde", 0x00168}, // LATIN CAPITAL LETTER U WITH TILDE -+ {"utilde", 0x00169}, // LATIN SMALL LETTER U WITH TILDE -+ {"utri", 0x025B5}, // WHITE UP-POINTING SMALL TRIANGLE -+ {"utrif", 0x025B4}, // BLACK UP-POINTING SMALL TRIANGLE -+ {"uuarr", 0x021C8}, // UPWARDS PAIRED ARROWS -+ {"Uuml", 0x000DC}, // LATIN CAPITAL LETTER U WITH DIAERESIS -+ {"uuml", 0x000FC}, // LATIN SMALL LETTER U WITH DIAERESIS -+ {"uwangle", 0x029A7}, // OBLIQUE ANGLE OPENING DOWN -+ {NULL, 0} - }; - - static NameId namesV[]={ -- "vangrt", 0x0299C, // RIGHT ANGLE VARIANT WITH SQUARE -- "varepsilon", 0x003F5, // GREEK LUNATE EPSILON SYMBOL -- "varkappa", 0x003F0, // GREEK KAPPA SYMBOL -- "varnothing", 0x02205, // EMPTY SET -- "varphi", 0x003D5, // GREEK PHI SYMBOL -- "varpi", 0x003D6, // GREEK PI SYMBOL -- "varpropto", 0x0221D, // PROPORTIONAL TO -- "varr", 0x02195, // UP DOWN ARROW -- "vArr", 0x021D5, // UP DOWN DOUBLE ARROW -- "varrho", 0x003F1, // GREEK RHO SYMBOL -- "varsigma", 0x003C2, // GREEK SMALL LETTER FINAL SIGMA --// "varsubsetneq", 0x0228A;0x0FE00, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --// "varsubsetneqq", 0x02ACB;0x0FE00, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --// "varsupsetneq", 0x0228B;0x0FE00, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --// "varsupsetneqq", 0x02ACC;0x0FE00, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -- "vartheta", 0x003D1, // GREEK THETA SYMBOL -- "vartriangleleft", 0x022B2, // NORMAL SUBGROUP OF -- "vartriangleright", 0x022B3, // CONTAINS AS NORMAL SUBGROUP -- "vBar", 0x02AE8, // SHORT UP TACK WITH UNDERBAR -- "Vbar", 0x02AEB, // DOUBLE UP TACK -- "vBarv", 0x02AE9, // SHORT UP TACK ABOVE SHORT DOWN TACK -- "Vcy", 0x00412, // CYRILLIC CAPITAL LETTER VE -- "vcy", 0x00432, // CYRILLIC SMALL LETTER VE -- "vdash", 0x022A2, // RIGHT TACK -- "vDash", 0x022A8, // TRUE -- "Vdash", 0x022A9, // FORCES -- "VDash", 0x022AB, // DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE -- "Vdashl", 0x02AE6, // LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL -- "vee", 0x02228, // LOGICAL OR -- "Vee", 0x022C1, // N-ARY LOGICAL OR -- "veebar", 0x022BB, // XOR -- "veeeq", 0x0225A, // EQUIANGULAR TO -- "vellip", 0x022EE, // VERTICAL ELLIPSIS -- "verbar", 0x0007C, // VERTICAL LINE -- "Verbar", 0x02016, // DOUBLE VERTICAL LINE -- "vert", 0x0007C, // VERTICAL LINE -- "Vert", 0x02016, // DOUBLE VERTICAL LINE -- "VerticalBar", 0x02223, // DIVIDES -- "VerticalLine", 0x0007C, // VERTICAL LINE -- "VerticalSeparator", 0x02758, // LIGHT VERTICAL BAR -- "VerticalTilde", 0x02240, // WREATH PRODUCT -- "VeryThinSpace", 0x0200A, // HAIR SPACE -- "Vfr", 0x1D519, // MATHEMATICAL FRAKTUR CAPITAL V -- "vfr", 0x1D533, // MATHEMATICAL FRAKTUR SMALL V -- "vltri", 0x022B2, // NORMAL SUBGROUP OF --// "vnsub", 0x02282;0x020D2, // SUBSET OF with vertical line --// "vnsup", 0x02283;0x020D2, // SUPERSET OF with vertical line -- "Vopf", 0x1D54D, // MATHEMATICAL DOUBLE-STRUCK CAPITAL V -- "vopf", 0x1D567, // MATHEMATICAL DOUBLE-STRUCK SMALL V -- "vprop", 0x0221D, // PROPORTIONAL TO -- "vrtri", 0x022B3, // CONTAINS AS NORMAL SUBGROUP -- "Vscr", 0x1D4B1, // MATHEMATICAL SCRIPT CAPITAL V -- "vscr", 0x1D4CB, // MATHEMATICAL SCRIPT SMALL V --// "vsubne", 0x0228A;0x0FE00, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --// "vsubnE", 0x02ACB;0x0FE00, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --// "vsupne", 0x0228B;0x0FE00, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --// "vsupnE", 0x02ACC;0x0FE00, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -- "Vvdash", 0x022AA, // TRIPLE VERTICAL BAR RIGHT TURNSTILE -- "vzigzag", 0x0299A, // VERTICAL ZIGZAG LINE -- NULL, 0 -+ {"vangrt", 0x0299C}, // RIGHT ANGLE VARIANT WITH SQUARE -+ {"varepsilon", 0x003F5}, // GREEK LUNATE EPSILON SYMBOL -+ {"varkappa", 0x003F0}, // GREEK KAPPA SYMBOL -+ {"varnothing", 0x02205}, // EMPTY SET -+ {"varphi", 0x003D5}, // GREEK PHI SYMBOL -+ {"varpi", 0x003D6}, // GREEK PI SYMBOL -+ {"varpropto", 0x0221D}, // PROPORTIONAL TO -+ {"varr", 0x02195}, // UP DOWN ARROW -+ {"vArr", 0x021D5}, // UP DOWN DOUBLE ARROW -+ {"varrho", 0x003F1}, // GREEK RHO SYMBOL -+ {"varsigma", 0x003C2}, // GREEK SMALL LETTER FINAL SIGMA -+// "varsubsetneq", 0x0228A;0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members -+// "varsubsetneqq", 0x02ACB;0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -+// "varsupsetneq", 0x0228B;0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members -+// "varsupsetneqq", 0x02ACC;0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -+ {"vartheta", 0x003D1}, // GREEK THETA SYMBOL -+ {"vartriangleleft", 0x022B2}, // NORMAL SUBGROUP OF -+ {"vartriangleright", 0x022B3}, // CONTAINS AS NORMAL SUBGROUP -+ {"vBar", 0x02AE8}, // SHORT UP TACK WITH UNDERBAR -+ {"Vbar", 0x02AEB}, // DOUBLE UP TACK -+ {"vBarv", 0x02AE9}, // SHORT UP TACK ABOVE SHORT DOWN TACK -+ {"Vcy", 0x00412}, // CYRILLIC CAPITAL LETTER VE -+ {"vcy", 0x00432}, // CYRILLIC SMALL LETTER VE -+ {"vdash", 0x022A2}, // RIGHT TACK -+ {"vDash", 0x022A8}, // TRUE -+ {"Vdash", 0x022A9}, // FORCES -+ {"VDash", 0x022AB}, // DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE -+ {"Vdashl", 0x02AE6}, // LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL -+ {"vee", 0x02228}, // LOGICAL OR -+ {"Vee", 0x022C1}, // N-ARY LOGICAL OR -+ {"veebar", 0x022BB}, // XOR -+ {"veeeq", 0x0225A}, // EQUIANGULAR TO -+ {"vellip", 0x022EE}, // VERTICAL ELLIPSIS -+ {"verbar", 0x0007C}, // VERTICAL LINE -+ {"Verbar", 0x02016}, // DOUBLE VERTICAL LINE -+ {"vert", 0x0007C}, // VERTICAL LINE -+ {"Vert", 0x02016}, // DOUBLE VERTICAL LINE -+ {"VerticalBar", 0x02223}, // DIVIDES -+ {"VerticalLine", 0x0007C}, // VERTICAL LINE -+ {"VerticalSeparator", 0x02758}, // LIGHT VERTICAL BAR -+ {"VerticalTilde", 0x02240}, // WREATH PRODUCT -+ {"VeryThinSpace", 0x0200A}, // HAIR SPACE -+ {"Vfr", 0x1D519}, // MATHEMATICAL FRAKTUR CAPITAL V -+ {"vfr", 0x1D533}, // MATHEMATICAL FRAKTUR SMALL V -+ {"vltri", 0x022B2}, // NORMAL SUBGROUP OF -+// "vnsub", 0x02282;0x020D2}, // SUBSET OF with vertical line -+// "vnsup", 0x02283;0x020D2}, // SUPERSET OF with vertical line -+ {"Vopf", 0x1D54D}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL V -+ {"vopf", 0x1D567}, // MATHEMATICAL DOUBLE-STRUCK SMALL V -+ {"vprop", 0x0221D}, // PROPORTIONAL TO -+ {"vrtri", 0x022B3}, // CONTAINS AS NORMAL SUBGROUP -+ {"Vscr", 0x1D4B1}, // MATHEMATICAL SCRIPT CAPITAL V -+ {"vscr", 0x1D4CB}, // MATHEMATICAL SCRIPT SMALL V -+// "vsubne", 0x0228A;0x0FE00}, // SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members -+// "vsubnE", 0x02ACB;0x0FE00}, // SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -+// "vsupne", 0x0228B;0x0FE00}, // SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members -+// "vsupnE", 0x02ACC;0x0FE00}, // SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members -+ {"Vvdash", 0x022AA}, // TRIPLE VERTICAL BAR RIGHT TURNSTILE -+ {"vzigzag", 0x0299A}, // VERTICAL ZIGZAG LINE -+ {NULL, 0} - }; - - static NameId namesW[]={ -- "Wcirc", 0x00174, // LATIN CAPITAL LETTER W WITH CIRCUMFLEX -- "wcirc", 0x00175, // LATIN SMALL LETTER W WITH CIRCUMFLEX -- "wedbar", 0x02A5F, // LOGICAL AND WITH UNDERBAR -- "wedge", 0x02227, // LOGICAL AND -- "Wedge", 0x022C0, // N-ARY LOGICAL AND -- "wedgeq", 0x02259, // ESTIMATES -- "weierp", 0x02118, // SCRIPT CAPITAL P -- "Wfr", 0x1D51A, // MATHEMATICAL FRAKTUR CAPITAL W -- "wfr", 0x1D534, // MATHEMATICAL FRAKTUR SMALL W -- "Wopf", 0x1D54E, // MATHEMATICAL DOUBLE-STRUCK CAPITAL W -- "wopf", 0x1D568, // MATHEMATICAL DOUBLE-STRUCK SMALL W -- "wp", 0x02118, // SCRIPT CAPITAL P -- "wr", 0x02240, // WREATH PRODUCT -- "wreath", 0x02240, // WREATH PRODUCT -- "Wscr", 0x1D4B2, // MATHEMATICAL SCRIPT CAPITAL W -- "wscr", 0x1D4CC, // MATHEMATICAL SCRIPT SMALL W -- NULL, 0 -+ {"Wcirc", 0x00174}, // LATIN CAPITAL LETTER W WITH CIRCUMFLEX -+ {"wcirc", 0x00175}, // LATIN SMALL LETTER W WITH CIRCUMFLEX -+ {"wedbar", 0x02A5F}, // LOGICAL AND WITH UNDERBAR -+ {"wedge", 0x02227}, // LOGICAL AND -+ {"Wedge", 0x022C0}, // N-ARY LOGICAL AND -+ {"wedgeq", 0x02259}, // ESTIMATES -+ {"weierp", 0x02118}, // SCRIPT CAPITAL P -+ {"Wfr", 0x1D51A}, // MATHEMATICAL FRAKTUR CAPITAL W -+ {"wfr", 0x1D534}, // MATHEMATICAL FRAKTUR SMALL W -+ {"Wopf", 0x1D54E}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL W -+ {"wopf", 0x1D568}, // MATHEMATICAL DOUBLE-STRUCK SMALL W -+ {"wp", 0x02118}, // SCRIPT CAPITAL P -+ {"wr", 0x02240}, // WREATH PRODUCT -+ {"wreath", 0x02240}, // WREATH PRODUCT -+ {"Wscr", 0x1D4B2}, // MATHEMATICAL SCRIPT CAPITAL W -+ {"wscr", 0x1D4CC}, // MATHEMATICAL SCRIPT SMALL W -+ {NULL, 0} - }; - - static NameId namesX[]={ -- "xcap", 0x022C2, // N-ARY INTERSECTION -- "xcirc", 0x025EF, // LARGE CIRCLE -- "xcup", 0x022C3, // N-ARY UNION -- "xdtri", 0x025BD, // WHITE DOWN-POINTING TRIANGLE -- "Xfr", 0x1D51B, // MATHEMATICAL FRAKTUR CAPITAL X -- "xfr", 0x1D535, // MATHEMATICAL FRAKTUR SMALL X -- "Xgr", 0x0039E, // GREEK CAPITAL LETTER XI -- "xgr", 0x003BE, // GREEK SMALL LETTER XI -- "xharr", 0x027F7, // LONG LEFT RIGHT ARROW -- "xhArr", 0x027FA, // LONG LEFT RIGHT DOUBLE ARROW -- "Xi", 0x0039E, // GREEK CAPITAL LETTER XI -- "xi", 0x003BE, // GREEK SMALL LETTER XI -- "xlarr", 0x027F5, // LONG LEFTWARDS ARROW -- "xlArr", 0x027F8, // LONG LEFTWARDS DOUBLE ARROW -- "xmap", 0x027FC, // LONG RIGHTWARDS ARROW FROM BAR -- "xnis", 0x022FB, // CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -- "xodot", 0x02A00, // N-ARY CIRCLED DOT OPERATOR -- "Xopf", 0x1D54F, // MATHEMATICAL DOUBLE-STRUCK CAPITAL X -- "xopf", 0x1D569, // MATHEMATICAL DOUBLE-STRUCK SMALL X -- "xoplus", 0x02A01, // N-ARY CIRCLED PLUS OPERATOR -- "xotime", 0x02A02, // N-ARY CIRCLED TIMES OPERATOR -- "xrarr", 0x027F6, // LONG RIGHTWARDS ARROW -- "xrArr", 0x027F9, // LONG RIGHTWARDS DOUBLE ARROW -- "Xscr", 0x1D4B3, // MATHEMATICAL SCRIPT CAPITAL X -- "xscr", 0x1D4CD, // MATHEMATICAL SCRIPT SMALL X -- "xsqcup", 0x02A06, // N-ARY SQUARE UNION OPERATOR -- "xuplus", 0x02A04, // N-ARY UNION OPERATOR WITH PLUS -- "xutri", 0x025B3, // WHITE UP-POINTING TRIANGLE -- "xvee", 0x022C1, // N-ARY LOGICAL OR -- "xwedge", 0x022C0, // N-ARY LOGICAL AND -- NULL, 0 -+ {"xcap", 0x022C2}, // N-ARY INTERSECTION -+ {"xcirc", 0x025EF}, // LARGE CIRCLE -+ {"xcup", 0x022C3}, // N-ARY UNION -+ {"xdtri", 0x025BD}, // WHITE DOWN-POINTING TRIANGLE -+ {"Xfr", 0x1D51B}, // MATHEMATICAL FRAKTUR CAPITAL X -+ {"xfr", 0x1D535}, // MATHEMATICAL FRAKTUR SMALL X -+ {"Xgr", 0x0039E}, // GREEK CAPITAL LETTER XI -+ {"xgr", 0x003BE}, // GREEK SMALL LETTER XI -+ {"xharr", 0x027F7}, // LONG LEFT RIGHT ARROW -+ {"xhArr", 0x027FA}, // LONG LEFT RIGHT DOUBLE ARROW -+ {"Xi", 0x0039E}, // GREEK CAPITAL LETTER XI -+ {"xi", 0x003BE}, // GREEK SMALL LETTER XI -+ {"xlarr", 0x027F5}, // LONG LEFTWARDS ARROW -+ {"xlArr", 0x027F8}, // LONG LEFTWARDS DOUBLE ARROW -+ {"xmap", 0x027FC}, // LONG RIGHTWARDS ARROW FROM BAR -+ {"xnis", 0x022FB}, // CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE -+ {"xodot", 0x02A00}, // N-ARY CIRCLED DOT OPERATOR -+ {"Xopf", 0x1D54F}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL X -+ {"xopf", 0x1D569}, // MATHEMATICAL DOUBLE-STRUCK SMALL X -+ {"xoplus", 0x02A01}, // N-ARY CIRCLED PLUS OPERATOR -+ {"xotime", 0x02A02}, // N-ARY CIRCLED TIMES OPERATOR -+ {"xrarr", 0x027F6}, // LONG RIGHTWARDS ARROW -+ {"xrArr", 0x027F9}, // LONG RIGHTWARDS DOUBLE ARROW -+ {"Xscr", 0x1D4B3}, // MATHEMATICAL SCRIPT CAPITAL X -+ {"xscr", 0x1D4CD}, // MATHEMATICAL SCRIPT SMALL X -+ {"xsqcup", 0x02A06}, // N-ARY SQUARE UNION OPERATOR -+ {"xuplus", 0x02A04}, // N-ARY UNION OPERATOR WITH PLUS -+ {"xutri", 0x025B3}, // WHITE UP-POINTING TRIANGLE -+ {"xvee", 0x022C1}, // N-ARY LOGICAL OR -+ {"xwedge", 0x022C0}, // N-ARY LOGICAL AND -+ {NULL, 0} - }; - - static NameId namesY[]={ -- "Yacute", 0x000DD, // LATIN CAPITAL LETTER Y WITH ACUTE -- "yacute", 0x000FD, // LATIN SMALL LETTER Y WITH ACUTE -- "YAcy", 0x0042F, // CYRILLIC CAPITAL LETTER YA -- "yacy", 0x0044F, // CYRILLIC SMALL LETTER YA -- "Ycirc", 0x00176, // LATIN CAPITAL LETTER Y WITH CIRCUMFLEX -- "ycirc", 0x00177, // LATIN SMALL LETTER Y WITH CIRCUMFLEX -- "Ycy", 0x0042B, // CYRILLIC CAPITAL LETTER YERU -- "ycy", 0x0044B, // CYRILLIC SMALL LETTER YERU -- "yen", 0x000A5, // YEN SIGN -- "Yfr", 0x1D51C, // MATHEMATICAL FRAKTUR CAPITAL Y -- "yfr", 0x1D536, // MATHEMATICAL FRAKTUR SMALL Y -- "YIcy", 0x00407, // CYRILLIC CAPITAL LETTER YI -- "yicy", 0x00457, // CYRILLIC SMALL LETTER YI -- "Yopf", 0x1D550, // MATHEMATICAL DOUBLE-STRUCK CAPITAL Y -- "yopf", 0x1D56A, // MATHEMATICAL DOUBLE-STRUCK SMALL Y -- "Yscr", 0x1D4B4, // MATHEMATICAL SCRIPT CAPITAL Y -- "yscr", 0x1D4CE, // MATHEMATICAL SCRIPT SMALL Y -- "YUcy", 0x0042E, // CYRILLIC CAPITAL LETTER YU -- "yucy", 0x0044E, // CYRILLIC SMALL LETTER YU -- "yuml", 0x000FF, // LATIN SMALL LETTER Y WITH DIAERESIS -- "Yuml", 0x00178, // LATIN CAPITAL LETTER Y WITH DIAERESIS -- NULL, 0 -+ {"Yacute", 0x000DD}, // LATIN CAPITAL LETTER Y WITH ACUTE -+ {"yacute", 0x000FD}, // LATIN SMALL LETTER Y WITH ACUTE -+ {"YAcy", 0x0042F}, // CYRILLIC CAPITAL LETTER YA -+ {"yacy", 0x0044F}, // CYRILLIC SMALL LETTER YA -+ {"Ycirc", 0x00176}, // LATIN CAPITAL LETTER Y WITH CIRCUMFLEX -+ {"ycirc", 0x00177}, // LATIN SMALL LETTER Y WITH CIRCUMFLEX -+ {"Ycy", 0x0042B}, // CYRILLIC CAPITAL LETTER YERU -+ {"ycy", 0x0044B}, // CYRILLIC SMALL LETTER YERU -+ {"yen", 0x000A5}, // YEN SIGN -+ {"Yfr", 0x1D51C}, // MATHEMATICAL FRAKTUR CAPITAL Y -+ {"yfr", 0x1D536}, // MATHEMATICAL FRAKTUR SMALL Y -+ {"YIcy", 0x00407}, // CYRILLIC CAPITAL LETTER YI -+ {"yicy", 0x00457}, // CYRILLIC SMALL LETTER YI -+ {"Yopf", 0x1D550}, // MATHEMATICAL DOUBLE-STRUCK CAPITAL Y -+ {"yopf", 0x1D56A}, // MATHEMATICAL DOUBLE-STRUCK SMALL Y -+ {"Yscr", 0x1D4B4}, // MATHEMATICAL SCRIPT CAPITAL Y -+ {"yscr", 0x1D4CE}, // MATHEMATICAL SCRIPT SMALL Y -+ {"YUcy", 0x0042E}, // CYRILLIC CAPITAL LETTER YU -+ {"yucy", 0x0044E}, // CYRILLIC SMALL LETTER YU -+ {"yuml", 0x000FF}, // LATIN SMALL LETTER Y WITH DIAERESIS -+ {"Yuml", 0x00178}, // LATIN CAPITAL LETTER Y WITH DIAERESIS -+ {NULL, 0} - }; - - static NameId namesZ[]={ -- "Zacute", 0x00179, // LATIN CAPITAL LETTER Z WITH ACUTE -- "zacute", 0x0017A, // LATIN SMALL LETTER Z WITH ACUTE -- "Zcaron", 0x0017D, // LATIN CAPITAL LETTER Z WITH CARON -- "zcaron", 0x0017E, // LATIN SMALL LETTER Z WITH CARON -- "Zcy", 0x00417, // CYRILLIC CAPITAL LETTER ZE -- "zcy", 0x00437, // CYRILLIC SMALL LETTER ZE -- "Zdot", 0x0017B, // LATIN CAPITAL LETTER Z WITH DOT ABOVE -- "zdot", 0x0017C, // LATIN SMALL LETTER Z WITH DOT ABOVE -- "zeetrf", 0x02128, // BLACK-LETTER CAPITAL Z -- "ZeroWidthSpace", 0x0200B, // ZERO WIDTH SPACE -- "Zeta", 0x00396, // GREEK CAPITAL LETTER ZETA -- "zeta", 0x003B6, // GREEK SMALL LETTER ZETA -- "Zfr", 0x02128, // BLACK-LETTER CAPITAL Z -- "zfr", 0x1D537, // MATHEMATICAL FRAKTUR SMALL Z -- "Zgr", 0x00396, // GREEK CAPITAL LETTER ZETA -- "zgr", 0x003B6, // GREEK SMALL LETTER ZETA -- "ZHcy", 0x00416, // CYRILLIC CAPITAL LETTER ZHE -- "zhcy", 0x00436, // CYRILLIC SMALL LETTER ZHE -- "zigrarr", 0x021DD, // RIGHTWARDS SQUIGGLE ARROW -- "Zopf", 0x02124, // DOUBLE-STRUCK CAPITAL Z -- "zopf", 0x1D56B, // MATHEMATICAL DOUBLE-STRUCK SMALL Z -- "Zscr", 0x1D4B5, // MATHEMATICAL SCRIPT CAPITAL Z -- "zscr", 0x1D4CF, // MATHEMATICAL SCRIPT SMALL Z -- "zwj", 0x0200D, // ZERO WIDTH JOINER -- "zwnj", 0x0200C, // ZERO WIDTH NON-JOINER -- NULL, 0 -+ {"Zacute", 0x00179}, // LATIN CAPITAL LETTER Z WITH ACUTE -+ {"zacute", 0x0017A}, // LATIN SMALL LETTER Z WITH ACUTE -+ {"Zcaron", 0x0017D}, // LATIN CAPITAL LETTER Z WITH CARON -+ {"zcaron", 0x0017E}, // LATIN SMALL LETTER Z WITH CARON -+ {"Zcy", 0x00417}, // CYRILLIC CAPITAL LETTER ZE -+ {"zcy", 0x00437}, // CYRILLIC SMALL LETTER ZE -+ {"Zdot", 0x0017B}, // LATIN CAPITAL LETTER Z WITH DOT ABOVE -+ {"zdot", 0x0017C}, // LATIN SMALL LETTER Z WITH DOT ABOVE -+ {"zeetrf", 0x02128}, // BLACK-LETTER CAPITAL Z -+ {"ZeroWidthSpace", 0x0200B}, // ZERO WIDTH SPACE -+ {"Zeta", 0x00396}, // GREEK CAPITAL LETTER ZETA -+ {"zeta", 0x003B6}, // GREEK SMALL LETTER ZETA -+ {"Zfr", 0x02128}, // BLACK-LETTER CAPITAL Z -+ {"zfr", 0x1D537}, // MATHEMATICAL FRAKTUR SMALL Z -+ {"Zgr", 0x00396}, // GREEK CAPITAL LETTER ZETA -+ {"zgr", 0x003B6}, // GREEK SMALL LETTER ZETA -+ {"ZHcy", 0x00416}, // CYRILLIC CAPITAL LETTER ZHE -+ {"zhcy", 0x00436}, // CYRILLIC SMALL LETTER ZHE -+ {"zigrarr", 0x021DD}, // RIGHTWARDS SQUIGGLE ARROW -+ {"Zopf", 0x02124}, // DOUBLE-STRUCK CAPITAL Z -+ {"zopf", 0x1D56B}, // MATHEMATICAL DOUBLE-STRUCK SMALL Z -+ {"Zscr", 0x1D4B5}, // MATHEMATICAL SCRIPT CAPITAL Z -+ {"zscr", 0x1D4CF}, // MATHEMATICAL SCRIPT SMALL Z -+ {"zwj", 0x0200D}, // ZERO WIDTH JOINER -+ {"zwnj", 0x0200C}, // ZERO WIDTH NON-JOINER -+ {NULL, 0} - }; - - // @todo@ order namesTable and names? by frequency -@@ -2372,7 +2374,7 @@ static NameId* namesTable[] = { - namesS, namesT, namesU, namesV, namesW, namesX, namesY, namesZ, NULL - }; - --int HtmlNamedEntity(unsigned char *p, size_t length) -+int HtmlNamedEntity(utf8_t *p, size_t length) - { - int tableIndex = tolower(*p) - 'a'; - if (tableIndex >= 0 && tableIndex < 26) ---- a/src/gcc/d/dfrontend/enum.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/enum.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - --// Copyright (c) 1999-2011 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -18,12 +18,14 @@ - #include "expression.h" - #include "module.h" - #include "declaration.h" -+#include "init.h" - - /********************************* EnumDeclaration ****************************/ - - EnumDeclaration::EnumDeclaration(Loc loc, Identifier *id, Type *memtype) - : ScopeDsymbol(id) - { -+ //printf("EnumDeclaration() %s\n", toChars()); - this->loc = loc; - type = new TypeEnum(this); - this->memtype = memtype; -@@ -31,9 +33,10 @@ EnumDeclaration::EnumDeclaration(Loc loc - minval = NULL; - defaultval = NULL; - sinit = NULL; -- isdeprecated = 0; -- isdone = 0; -- objFileDone = 0; -+ isdeprecated = false; -+ protection = PROTundefined; -+ parent = NULL; -+ added = false; - } - - Dsymbol *EnumDeclaration::syntaxCopy(Dsymbol *s) -@@ -50,64 +53,73 @@ Dsymbol *EnumDeclaration::syntaxCopy(Dsy - else - ed = new EnumDeclaration(loc, ident, t); - ScopeDsymbol::syntaxCopy(ed); -+ if (isAnonymous()) -+ { -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ em->ed = ed; -+ } -+ } - return ed; - } - - void EnumDeclaration::setScope(Scope *sc) - { -- if (isdone) -+ if (semanticRun > PASSinit) - return; - ScopeDsymbol::setScope(sc); - } - --void EnumDeclaration::semantic0(Scope *sc) -+int EnumDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) - { -- /* This function is a hack to get around a significant problem. -- * The members of anonymous enums, like: -- * enum { A, B, C } -- * don't get installed into the symbol table until after they are -- * semantically analyzed, yet they're supposed to go into the enclosing -- * scope's table. Hence, when forward referenced, they come out as -- * 'undefined'. The real fix is to add them in at addSymbol() time. -- * But to get code to compile, we'll just do this quick hack at the moment -- * to compile it if it doesn't depend on anything else. -- */ -- -- if (isdone || !scope) -- return; -- if (!isAnonymous() || memtype) -- return; -+#if 0 -+ printf("EnumDeclaration::addMember() %s\n", toChars()); - for (size_t i = 0; i < members->dim; i++) - { - EnumMember *em = (*members)[i]->isEnumMember(); -- if (em && (em->type || em->value)) -- return; -+ printf(" member %s\n", em->toChars()); - } -+#endif - -- // Can do it -- semantic(sc); -+ /* Anonymous enum members get added to enclosing scope. -+ */ -+ ScopeDsymbol *scopesym = isAnonymous() ? sd : this; -+ -+ if (!isAnonymous()) -+ { -+ ScopeDsymbol::addMember(sc, sd, memnum); -+ -+ if (!symtab) -+ symtab = new DsymbolTable(); -+ } -+ -+ if (members) -+ { -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ em->ed = this; -+ //printf("add %s to scope %s\n", em->toChars(), scopesym->toChars()); -+ em->addMember(sc, scopesym, 1); -+ } -+ } -+ added = true; -+ return 1; - } - -+ - void EnumDeclaration::semantic(Scope *sc) - { -- Type *t; -- Scope *sce; -- - //printf("EnumDeclaration::semantic(sd = %p, '%s') %s\n", sc->scopesym, sc->scopesym->toChars(), toChars()); -- //printf("EnumDeclaration::semantic() %s\n", toChars()); -- if (!members) // enum ident; -+ //printf("EnumDeclaration::semantic() %p %s\n", this, toChars()); -+ if (!members && !memtype) // enum ident; - return; - -- if (!memtype && !isAnonymous()) -- { // Set memtype if we can to reduce fwd reference errors -- memtype = Type::tint32; // case 1) enum ident { ... } -- } -+ if (semanticRun > PASSinit) -+ return; // semantic() already completed - -- if (symtab) // if already done -- { if (isdone || !scope) -- return; // semantic() already completed -- } -- else -+ if (!symtab) - symtab = new DsymbolTable(); - - Scope *scx = NULL; -@@ -120,7 +132,7 @@ void EnumDeclaration::semantic(Scope *sc - unsigned dprogress_save = Module::dprogress; - - if (sc->stc & STCdeprecated) -- isdeprecated = 1; -+ isdeprecated = true; - userAttributes = sc->userAttributes; - - parent = sc->parent; -@@ -131,8 +143,12 @@ void EnumDeclaration::semantic(Scope *sc - * 2. enum : memtype { ... } - * 3. enum ident { ... } - * 4. enum ident : memtype { ... } -+ * 5. enum ident : memtype; -+ * 6. enum ident; - */ - -+ type = type->semantic(loc, sc); -+ - if (memtype) - { - memtype = memtype->semantic(loc, sc); -@@ -151,183 +167,243 @@ void EnumDeclaration::semantic(Scope *sc - return; - } - } --#if 0 // Decided to abandon this restriction for D 2.0 -- if (!memtype->isintegral()) -- { error("base type must be of integral type, not %s", memtype->toChars()); -- memtype = Type::tint32; -+ if (memtype->ty == Tvoid) -+ { -+ error("base type must not be void"); -+ memtype = Type::terror; - } --#endif -+ if (memtype->ty == Terror) -+ { -+ errors = true; -+ if (members) -+ { -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ Dsymbol *s = (*members)[i]; -+ s->errors = true; // poison all the members -+ } -+ } -+ semanticRun = PASSsemanticdone; -+ return; -+ } -+ } -+ -+ semanticRun = PASSsemanticdone; -+ -+ if (!members) // enum ident : memtype; -+ return; -+ -+ if (members->dim == 0) -+ { -+ error("enum %s must have at least one member", toChars()); -+ errors = true; -+ return; - } - -- isdone = 1; - Module::dprogress++; - -- type = type->semantic(loc, sc); -+ Scope *sce; - if (isAnonymous()) - sce = sc; - else - { sce = sc->push(this); - sce->parent = this; - } -- if (members->dim == 0) -- error("enum %s must have at least one member", toChars()); -- int first = 1; -- Expression *elast = NULL; -+ sce = sce->startCTFE(); -+ sce->setNoFree(); // needed for getMaxMinValue() -+ -+ /* Each enum member gets the sce scope -+ */ - for (size_t i = 0; i < members->dim; i++) - { - EnumMember *em = (*members)[i]->isEnumMember(); -- Expression *e; -- Expression *emax = NULL; -- -- if (!em) -- /* The e->semantic(sce) can insert other symbols, such as -- * template instances and function literals. -- */ -- continue; -- -- //printf(" Enum member '%s'\n",em->toChars()); -- if (em->type) -- em->type = em->type->semantic(em->loc, sce); -- e = em->value; -- if (e) -- { -- assert(e->dyncast() == DYNCAST_EXPRESSION); -- e = e->semantic(sce); -- e = e->ctfeInterpret(); -- if (memtype) -- { -- e = e->implicitCastTo(sce, memtype); -- e = e->ctfeInterpret(); -- if (!isAnonymous()) -- e = e->castTo(sce, type); -- t = memtype; -- } -- else if (em->type) -- { -- e = e->implicitCastTo(sce, em->type); -- e = e->ctfeInterpret(); -- assert(isAnonymous()); -- t = e->type; -- } -- else -- t = e->type; -- } -- else if (first) -- { -- if (memtype) -- t = memtype; -- else if (em->type) -- t = em->type; -- else -- t = Type::tint32; -- e = new IntegerExp(em->loc, 0, Type::tint32); -- e = e->implicitCastTo(sce, t); -- e = e->ctfeInterpret(); -- if (!isAnonymous()) -- e = e->castTo(sce, type); -- } -- else -- { -- // Lazily evaluate enum.max -- if (!emax) -- { -- emax = t->getProperty(0, Id::max); -- emax = emax->semantic(sce); -- emax = emax->ctfeInterpret(); -- } -- -- // Set value to (elast + 1). -- // But first check that (elast != t.max) -- assert(elast); -- e = new EqualExp(TOKequal, em->loc, elast, emax); -- e = e->semantic(sce); -- e = e->ctfeInterpret(); -- if (e->toInteger()) -- error("overflow of enum value %s", elast->toChars()); -- -- // Now set e to (elast + 1) -- e = new AddExp(em->loc, elast, new IntegerExp(em->loc, 1, Type::tint32)); -- e = e->semantic(sce); -- e = e->castTo(sce, elast->type); -- e = e->ctfeInterpret(); -- -- if (t->isfloating()) -- { -- // Check that e != elast (not always true for floats) -- Expression *etest = new EqualExp(TOKequal, em->loc, e, elast); -- etest = etest->semantic(sce); -- etest = etest->ctfeInterpret(); -- if (etest->toInteger()) -- error("enum member %s has inexact value, due to loss of precision", em->toChars()); -- } -- } -- elast = e; -- em->value = e; -+ if (em) -+ em->scope = sce; -+ } - -- // Add to symbol table only after evaluating 'value' -+ if (!added) -+ { -+ /* addMember() is not called when the EnumDeclaration appears as a function statement, -+ * so we have to do what addMember() does and install the enum members in the right symbol -+ * table -+ */ -+ ScopeDsymbol *scopesym = NULL; - if (isAnonymous()) - { - /* Anonymous enum members get added to enclosing scope. - */ -- for (Scope *sct = sce; sct; sct = sct->enclosing) -+ for (Scope *sct = sce; 1; sct = sct->enclosing) - { -+ assert(sct); - if (sct->scopesym) - { -+ scopesym = sct->scopesym; - if (!sct->scopesym->symtab) - sct->scopesym->symtab = new DsymbolTable(); -- em->addMember(sce, sct->scopesym, 1); - break; - } - } - } - else -- em->addMember(sc, this, 1); -+ // Otherwise enum members are in the EnumDeclaration's symbol table -+ scopesym = this; - -- /* Compute .min, .max and .default values. -- * If enum doesn't have a name, we can never identify the enum type, -- * so there is no purpose for a .min, .max or .default -- */ -- if (!isAnonymous()) -+ for (size_t i = 0; i < members->dim; i++) - { -- if (first) -- { defaultval = e; -- minval = e; -- maxval = e; -- } -- else -- { Expression *ec; -- -- /* In order to work successfully with UDTs, -- * build expressions to do the comparisons, -- * and let the semantic analyzer and constant -- * folder give us the result. -- */ -- -- // Compute if(e < minval) -- ec = new CmpExp(TOKlt, em->loc, e, minval); -- ec = ec->semantic(sce); -- ec = ec->ctfeInterpret(); -- if (ec->toInteger()) -- minval = e; -- -- ec = new CmpExp(TOKgt, em->loc, e, maxval); -- ec = ec->semantic(sce); -- ec = ec->ctfeInterpret(); -- if (ec->toInteger()) -- maxval = e; -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ if (em) -+ { -+ em->ed = this; -+ em->addMember(sc, scopesym, 1); - } - } -- first = 0; -+ } -+ -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ if (em) -+ em->semantic(em->scope); - } - //printf("defaultval = %lld\n", defaultval); - - //if (defaultval) printf("defaultval: %s %s\n", defaultval->toChars(), defaultval->type->toChars()); -- if (sc != sce) -- sce->pop(); - //members->print(); - } - --int EnumDeclaration::oneMember(Dsymbol **ps, Identifier *ident) -+/****************************** -+ * Get the value of the .max/.min property as an Expression -+ * Input: -+ * id Id::max or Id::min -+ */ -+ -+Expression *EnumDeclaration::getMaxMinValue(Loc loc, Identifier *id) -+{ -+ //printf("EnumDeclaration::getMaxValue()\n"); -+ bool first = true; -+ -+ Expression **pval = (id == Id::max) ? &maxval : &minval; -+ -+ if (*pval) -+ return *pval; -+ -+ if (scope) -+ semantic(scope); -+ if (errors) -+ goto Lerrors; -+ if (semanticRun == PASSinit || !members) -+ { -+ error("is forward referenced looking for .%s", id->toChars()); -+ goto Lerrors; -+ } -+ if (!(memtype && memtype->isintegral())) -+ { -+ error(loc, "has no .%s property because base type %s is not an integral type", -+ id->toChars(), -+ memtype ? memtype->toChars() : ""); -+ goto Lerrors; -+ } -+ -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ if (!em) -+ continue; -+ if (em->errors) -+ goto Lerrors; -+ -+ Expression *e = em->value; -+ if (first) -+ { -+ *pval = e; -+ first = false; -+ } -+ else -+ { -+ /* In order to work successfully with UDTs, -+ * build expressions to do the comparisons, -+ * and let the semantic analyzer and constant -+ * folder give us the result. -+ */ -+ -+ /* Compute: -+ * if (e > maxval) -+ * maxval = e; -+ */ -+ Expression *ec = new CmpExp(id == Id::max ? TOKgt : TOKlt, em->loc, e, *pval); -+ ec = ec->semantic(em->scope); -+ ec = ec->ctfeInterpret(); -+ if (ec->toInteger()) -+ *pval = e; -+ } -+ } -+ return *pval; -+ -+Lerrors: -+ *pval = new ErrorExp(); -+ return *pval; -+} -+ -+Expression *EnumDeclaration::getDefaultValue(Loc loc) -+{ -+ //printf("EnumDeclaration::getDefaultValue() %p %s\n", this, toChars()); -+ if (defaultval) -+ return defaultval; -+ -+ if (scope) -+ semantic(scope); -+ if (errors) -+ goto Lerrors; -+ if (semanticRun == PASSinit || !members) -+ { -+ error(loc, "forward reference of %s.init", toChars()); -+ goto Lerrors; -+ } -+ -+ for (size_t i = 0; i < members->dim; i++) -+ { -+ EnumMember *em = (*members)[i]->isEnumMember(); -+ if (!em) -+ continue; -+ defaultval = em->value; -+ return defaultval; -+ } -+ -+Lerrors: -+ defaultval = new ErrorExp(); -+ return defaultval; -+} -+ -+Type *EnumDeclaration::getMemtype(Loc loc) -+{ -+ if (loc.linnum == 0) -+ loc = this->loc; -+ if (scope) -+ { /* Enum is forward referenced. We don't need to resolve the whole thing, -+ * just the base type -+ */ -+ if (memtype) -+ memtype = memtype->semantic(loc, scope); -+ else -+ { -+ if (!isAnonymous()) -+ memtype = Type::tint32; -+ } -+ } -+ if (!memtype) -+ { -+ if (!isAnonymous()) -+ memtype = Type::tint32; -+ else -+ { -+ error(loc, "is forward referenced looking for base type"); -+ return Type::terror; -+ } -+ } -+ return memtype; -+} -+ -+bool EnumDeclaration::oneMember(Dsymbol **ps, Identifier *ident) - { - if (isAnonymous()) - return Dsymbol::oneMembers(members, ps, ident); -@@ -380,11 +456,16 @@ const char *EnumDeclaration::kind() - return "enum"; - } - --int EnumDeclaration::isDeprecated() -+bool EnumDeclaration::isDeprecated() - { - return isdeprecated; - } - -+PROT EnumDeclaration::prot() -+{ -+ return protection; -+} -+ - Dsymbol *EnumDeclaration::search(Loc loc, Identifier *ident, int flags) - { - //printf("%s.EnumDeclaration::search('%s')\n", toChars(), ident->toChars()); -@@ -407,9 +488,11 @@ Dsymbol *EnumDeclaration::search(Loc loc - EnumMember::EnumMember(Loc loc, Identifier *id, Expression *value, Type *type) - : Dsymbol(id) - { -+ this->ed = NULL; - this->value = value; - this->type = type; - this->loc = loc; -+ this->vd = NULL; - } - - Dsymbol *EnumMember::syntaxCopy(Dsymbol *s) -@@ -452,4 +535,172 @@ const char *EnumMember::kind() - return "enum member"; - } - -+void EnumMember::semantic(Scope *sc) -+{ -+ //printf("EnumMember::semantic() %s\n", toChars()); -+ if (errors || semanticRun >= PASSsemanticdone) -+ return; -+ if (semanticRun == PASSsemantic) -+ { -+ error("circular reference to enum member"); -+ Lerrors: -+ errors = true; -+ semanticRun = PASSsemanticdone; -+ return; -+ } -+ assert(ed); -+ ed->semantic(sc); -+ if (ed->errors) -+ goto Lerrors; - -+ if (errors || semanticRun >= PASSsemanticdone) -+ return; -+ -+ semanticRun = PASSsemantic; -+ if (scope) -+ sc = scope; -+ -+ // The first enum member is special -+ bool first = (this == (*ed->members)[0]); -+ -+ if (type) -+ { -+ type = type->semantic(loc, sc); -+ assert(value); // "type id;" is not a valid enum member declaration -+ } -+ -+ if (value) -+ { -+ Expression *e = value; -+ assert(e->dyncast() == DYNCAST_EXPRESSION); -+ e = e->semantic(sc); -+ e = resolveProperties(sc, e); -+ e = e->ctfeInterpret(); -+ if (first && !ed->memtype && !ed->isAnonymous()) -+ { -+ ed->memtype = e->type; -+ if (ed->memtype->ty == Terror) -+ { -+ ed->errors = true; -+ goto Lerrors; -+ } -+ } -+ -+ if (ed->memtype && !type) -+ { -+ e = e->implicitCastTo(sc, ed->memtype); -+ e = e->ctfeInterpret(); -+ if (!ed->isAnonymous()) -+ e = e->castTo(sc, ed->type); -+ } -+ else if (type) -+ { -+ e = e->implicitCastTo(sc, type); -+ e = e->ctfeInterpret(); -+ assert(ed->isAnonymous()); -+ } -+ value = e; -+ } -+ else if (first) -+ { -+ Type *t; -+ if (ed->memtype) -+ t = ed->memtype; -+ else -+ { -+ t = Type::tint32; -+ if (!ed->isAnonymous()) -+ ed->memtype = t; -+ } -+ Expression *e = new IntegerExp(loc, 0, Type::tint32); -+ e = e->implicitCastTo(sc, t); -+ e = e->ctfeInterpret(); -+ if (!ed->isAnonymous()) -+ e = e->castTo(sc, ed->type); -+ value = e; -+ } -+ else -+ { -+ /* Find the previous enum member, -+ * and set this to be the previous value + 1 -+ */ -+ EnumMember *emprev = NULL; -+ for (size_t i = 0; i < ed->members->dim; i++) -+ { -+ EnumMember *em = (*ed->members)[i]->isEnumMember(); -+ if (em) -+ { -+ if (em == this) -+ break; -+ emprev = em; -+ } -+ } -+ assert(emprev); -+ if (emprev->semanticRun < PASSsemanticdone) // if forward reference -+ emprev->semantic(emprev->scope); // resolve it -+ if (emprev->errors) -+ goto Lerrors; -+ -+ Expression *eprev = emprev->value; -+ Type *tprev = eprev->type->equals(ed->type) ? ed->memtype : eprev->type; -+ -+ Expression *emax = tprev->getProperty(Loc(), Id::max, 0); -+ emax = emax->semantic(sc); -+ emax = emax->ctfeInterpret(); -+ -+ // Set value to (eprev + 1). -+ // But first check that (eprev != emax) -+ assert(eprev); -+ Expression *e = new EqualExp(TOKequal, loc, eprev, emax); -+ e = e->semantic(sc); -+ e = e->ctfeInterpret(); -+ if (e->toInteger()) -+ { -+ error("initialization with (%s.%s + 1) causes overflow for type '%s'", emprev->ed->toChars(), emprev->toChars(), ed->type->toBasetype()->toChars()); -+ goto Lerrors; -+ } -+ -+ // Now set e to (eprev + 1) -+ e = new AddExp(loc, eprev, new IntegerExp(loc, 1, Type::tint32)); -+ e = e->semantic(sc); -+ e = e->castTo(sc, eprev->type); -+ e = e->ctfeInterpret(); -+ -+ if (e->type->isfloating()) -+ { -+ // Check that e != eprev (not always true for floats) -+ Expression *etest = new EqualExp(TOKequal, loc, e, eprev); -+ etest = etest->semantic(sc); -+ etest = etest->ctfeInterpret(); -+ if (etest->toInteger()) -+ { -+ error("has inexact value, due to loss of precision"); -+ goto Lerrors; -+ } -+ } -+ value = e; -+ } -+ -+ semanticRun = PASSsemanticdone; -+} -+ -+Expression *EnumMember::getVarExp(Loc loc, Scope *sc) -+{ -+ semantic(sc); -+ if (errors) -+ return new ErrorExp(); -+ if (!vd) -+ { -+ assert(value); -+ vd = new VarDeclaration(loc, type, ident, new ExpInitializer(loc, value->copy())); -+ -+ vd->storage_class = STCmanifest; -+ vd->semantic(sc); -+ -+ vd->protection = ed->isAnonymous() ? ed->protection : PROTpublic; -+ vd->parent = ed->isAnonymous() ? ed->parent : ed; -+ vd->userAttributes = ed->isAnonymous() ? ed->userAttributes : NULL; -+ } -+ Expression *e = new VarExp(loc, vd); -+ return e->semantic(sc); -+} ---- a/src/gcc/d/dfrontend/enum.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/enum.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2008 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -18,45 +18,53 @@ - #include "root.h" - #include "dsymbol.h" - --struct Identifier; --struct Type; --struct Expression; -+class Identifier; -+class Type; -+class Expression; - struct HdrGenState; -+class VarDeclaration; - -- --struct EnumDeclaration : ScopeDsymbol --{ /* enum ident : memtype { ... } -+class EnumDeclaration : public ScopeDsymbol -+{ -+public: -+ /* The separate, and distinct, cases are: -+ * 1. enum { ... } -+ * 2. enum : memtype { ... } -+ * 3. enum id { ... } -+ * 4. enum id : memtype { ... } -+ * 5. enum id : memtype; -+ * 6. enum id; - */ - Type *type; // the TypeEnum - Type *memtype; // type of the members -- enum PROT protection; -+ PROT protection; - --#if DMDV1 -- dinteger_t maxval; -- dinteger_t minval; -- dinteger_t defaultval; // default initializer --#else -+private: - Expression *maxval; - Expression *minval; - Expression *defaultval; // default initializer --#endif -- int isdeprecated; -- int isdone; // 0: not done -- // 1: semantic() successfully completed -+ -+public: -+ bool isdeprecated; -+ bool added; - - EnumDeclaration(Loc loc, Identifier *id, Type *memtype); - Dsymbol *syntaxCopy(Dsymbol *s); -+ int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); - void setScope(Scope *sc); -- void semantic0(Scope *sc); - void semantic(Scope *sc); -- int oneMember(Dsymbol **ps, Identifier *ident = NULL); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Type *getType(); - const char *kind(); - #if DMDV2 - Dsymbol *search(Loc, Identifier *ident, int flags); - #endif -- int isDeprecated(); // is Dsymbol deprecated? -+ bool isDeprecated(); // is Dsymbol deprecated? -+ PROT prot(); -+ Expression *getMaxMinValue(Loc loc, Identifier *id); -+ Expression *getDefaultValue(Loc loc); -+ Type *getMemtype(Loc loc); - - void emitComment(Scope *sc); - void toJson(JsonOut *json); -@@ -64,7 +72,6 @@ struct EnumDeclaration : ScopeDsymbol - - EnumDeclaration *isEnumDeclaration() { return this; } - -- bool objFileDone; // if toObjFile was already called - void toObjFile(int multiobj); // compile to .obj file - void toDebug(); - int cvMember(unsigned char *p); -@@ -74,15 +81,26 @@ struct EnumDeclaration : ScopeDsymbol - }; - - --struct EnumMember : Dsymbol -+class EnumMember : public Dsymbol - { -+public: -+ /* Can take the following forms: -+ * 1. id -+ * 2. id = value -+ * 3. type id = value -+ */ - Expression *value; - Type *type; - -+ EnumDeclaration *ed; -+ VarDeclaration *vd; -+ - EnumMember(Loc loc, Identifier *id, Expression *value, Type *type); - Dsymbol *syntaxCopy(Dsymbol *s); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - const char *kind(); -+ void semantic(Scope *sc); -+ Expression *getVarExp(Loc loc, Scope *sc); - - void emitComment(Scope *sc); - void toJson(JsonOut *json); ---- a/src/gcc/d/dfrontend/expression.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/expression.c 2014-04-01 16:32:51.000000000 +0100 -@@ -18,10 +18,6 @@ - #include <complex.h> - #endif - --#if _WIN32 && __DMC__ --extern "C" char * __cdecl __locale_decpoint; --#endif -- - #include "rmem.h" - #include "port.h" - #include "root.h" -@@ -45,10 +41,11 @@ extern "C" char * __cdecl __locale_decpo - #include "hdrgen.h" - #include "parse.h" - #include "doc.h" -- -+#include "aav.h" - - Expression *createTypeInfoArray(Scope *sc, Expression *args[], size_t dim); - Expression *expandVar(int result, VarDeclaration *v); -+void functionToCBuffer2(TypeFunction *t, OutBuffer *buf, HdrGenState *hgs, int mod, const char *kind); - - #define LOGSEMANTIC 0 - -@@ -157,11 +154,12 @@ Expression *getRightThis(Loc loc, Scope - */ - - FuncDeclaration *hasThis(Scope *sc) --{ FuncDeclaration *fd; -- FuncDeclaration *fdthis; -- -+{ - //printf("hasThis()\n"); -- fdthis = sc->parent->isFuncDeclaration(); -+ Dsymbol *p = sc->parent; -+ while (p && p->isTemplateMixin()) -+ p = p->parent; -+ FuncDeclaration *fdthis = p ? p->isFuncDeclaration() : NULL; - //printf("fdthis = %p, '%s'\n", fdthis, fdthis ? fdthis->toChars() : ""); - - /* Special case for inside template constraint -@@ -174,7 +172,7 @@ FuncDeclaration *hasThis(Scope *sc) - } - - // Go upwards until we find the enclosing member function -- fd = fdthis; -+ FuncDeclaration *fd = fdthis; - while (1) - { - if (!fd) -@@ -210,113 +208,318 @@ Lno: - return NULL; // don't have 'this' available - } - -+bool isNeedThisScope(Scope *sc, Declaration *d) -+{ -+ if (sc->intypeof == 1) -+ return false; -+ -+ AggregateDeclaration *ad = d->isThis(); -+ if (!ad) -+ return false; -+ //printf("d = %s, ad = %s\n", d->toChars(), ad->toChars()); -+ -+ for (Dsymbol *s = sc->parent; s; s = s->toParent2()) -+ { -+ //printf("\ts = %s %s, toParent2() = %p\n", s->kind(), s->toChars(), s->toParent2()); -+ if (AggregateDeclaration *ad2 = s->isAggregateDeclaration()) -+ { -+ //printf("\t ad2 = %s\n", ad2->toChars()); -+ if (ad2 == ad) -+ return false; -+ else if (ad2->isNested()) -+ continue; -+ else -+ return true; -+ } -+ if (FuncDeclaration *f = s->isFuncDeclaration()) -+ { -+ if (f->isFuncLiteralDeclaration()) -+ continue; -+ if (f->isMember2()) -+ break; -+ if (TemplateDeclaration *td = f->parent->isTemplateDeclaration()) -+ { -+ if ((td->scope->stc & STCstatic) && td->isMember()) -+ break; // no valid 'this' -+ } -+ } -+ } -+ return true; -+} -+ -+Expression *checkRightThis(Scope *sc, Expression *e) -+{ -+ if (e->op == TOKvar && e->type->ty != Terror) -+ { -+ VarExp *ve = (VarExp *)e; -+ if (isNeedThisScope(sc, ve->var)) -+ { -+ //printf("checkRightThis sc->intypeof = %d, ad = %p, func = %p, fdthis = %p\n", -+ // sc->intypeof, sc->getStructClassScope(), func, fdthis); -+ e->error("need 'this' for '%s' of type '%s'", ve->var->toChars(), ve->var->type->toChars()); -+ e = new ErrorExp(); -+ } -+ } -+ return e; -+} -+ - - /*************************************** - * Pull out any properties. - */ - --Expression *resolveProperties(Scope *sc, Expression *e) -+Expression *resolvePropertiesX(Scope *sc, Expression *e1, Expression *e2 = NULL) - { -- //printf("resolveProperties(%s)\n", e->toChars()); -+ //printf("resolvePropertiesX, e1 = %s %s, e2 = %s\n", Token::toChars(e1->op), e1->toChars(), e2 ? e2->toChars() : NULL); -+ Loc loc = e1->loc; - -- TemplateDeclaration *td; -- Objects *targsi; -- Expression *ethis; -- if (e->op == TOKdotti) -- { -- DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e; -- td = dti->getTempdecl(sc); -- dti->ti->semanticTiargs(sc); -- targsi = dti->ti->tiargs; -- ethis = dti->e1; -- goto L1; -- } -- else if (e->op == TOKdottd) -- { -- DotTemplateExp *dte = (DotTemplateExp *)e; -- td = dte->td; -- targsi = NULL; -- ethis = dte->e1; -- goto L1; -- } -- else if (e->op == TOKimport) -+ OverloadSet *os; -+ Dsymbol *s; -+ Objects *tiargs; -+ Type *tthis; -+ if (e1->op == TOKdotexp) - { -- Dsymbol *s = ((ScopeExp *)e)->sds; -- td = s->isTemplateDeclaration(); -- if (td) -+ DotExp *de = (DotExp *)e1; -+ if (de->e2->op == TOKoverloadset) - { -- targsi = NULL; -- ethis = NULL; -- goto L1; -+ tiargs = NULL; -+ tthis = de->e1->type; -+ os = ((OverExp *)de->e2)->vars; -+ goto Los; - } - } -- else if (e->op == TOKtemplate) -+ else if (e1->op == TOKoverloadset) - { -- td = ((TemplateExp *)e)->td; -- targsi = NULL; -- ethis = NULL; -- L1: -- assert(td); -- unsigned errors = global.startGagging(); -- FuncDeclaration *fd = td->deduceFunctionTemplate(sc, e->loc, targsi, ethis, NULL, 1); -- if (global.endGagging(errors)) -- fd = NULL; // eat "is not a function template" error -- if (fd && fd->type) -- { assert(fd->type->ty == Tfunction); -- TypeFunction *tf = (TypeFunction *)fd->type; -- if (!tf->isproperty && global.params.enforcePropertySyntax) -- { error(e->loc, "not a property %s", e->toChars()); -+ tiargs = NULL; -+ tthis = NULL; -+ os = ((OverExp *)e1)->vars; -+ Los: -+ assert(os); -+ FuncDeclaration *fd = NULL; -+ if (e2) -+ { -+ e2 = e2->semantic(sc); -+ if (e2->op == TOKerror) - return new ErrorExp(); -+ e2 = resolveProperties(sc, e2); -+ -+ Expressions a; -+ a.push(e2); -+ -+ for (size_t i = 0; i < os->a.dim; i++) -+ { -+ Dsymbol *s = os->a[i]; -+ FuncDeclaration *f = resolveFuncCall(loc, sc, s, tiargs, tthis, &a, 1); -+ if (f) -+ { -+ fd = f; -+ assert(fd->type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ goto Leprop; -+ } -+ } -+ if (fd) -+ { -+ Expression *e = new CallExp(loc, e1, e2); -+ return e->semantic(sc); -+ } -+ } -+ { -+ for (size_t i = 0; i < os->a.dim; i++) -+ { -+ Dsymbol *s = os->a[i]; -+ FuncDeclaration *f = resolveFuncCall(loc, sc, s, tiargs, tthis, NULL, 1); -+ if (f) -+ { -+ fd = f; -+ assert(fd->type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (!tf->isref && e2) -+ goto Leproplvalue; -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ goto Leprop; -+ } -+ } -+ if (fd) -+ { -+ Expression *e = new CallExp(loc, e1); -+ if (e2) -+ e = new AssignExp(loc, e, e2); -+ return e->semantic(sc); - } -- e = new CallExp(e->loc, e); -- e = e->semantic(sc); - } -- goto return_expr; -+ if (e2) -+ goto Leprop; - } -- -- if (e->type && -- e->op != TOKtype) // function type is not a property -+ else if (e1->op == TOKdotti) -+ { -+ DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1; -+ if (!dti->findTempDecl(sc)) -+ goto Leprop; -+ if (!dti->ti->semanticTiargs(sc)) -+ goto Leprop; -+ tiargs = dti->ti->tiargs; -+ tthis = dti->e1->type; -+ if ((os = dti->ti->tempdecl->isOverloadSet()) != NULL) -+ goto Los; -+ if ((s = dti->ti->tempdecl) != NULL) -+ goto Lfd; -+ } -+ else if (e1->op == TOKdottd) -+ { -+ DotTemplateExp *dte = (DotTemplateExp *)e1; -+ s = dte->td; -+ tiargs = NULL; -+ tthis = dte->e1->type; -+ goto Lfd; -+ } -+ else if (e1->op == TOKimport) -+ { -+ s = ((ScopeExp *)e1)->sds; -+ if (s->isTemplateDeclaration()) -+ { -+ tiargs = NULL; -+ tthis = NULL; -+ goto Lfd; -+ } -+ TemplateInstance *ti = s->isTemplateInstance(); -+ if (ti && !ti->semanticRun && ti->tempdecl) -+ { -+ //assert(ti->needsTypeInference(sc)); -+ if (!ti->semanticTiargs(sc)) -+ { -+ ti->inst = ti; -+ ti->inst->errors = true; -+ goto Leprop; -+ } -+ tiargs = ti->tiargs; -+ tthis = NULL; -+ if ((os = ti->tempdecl->isOverloadSet()) != NULL) -+ goto Los; -+ if ((s = ti->tempdecl) != NULL) -+ goto Lfd; -+ } -+ } -+ else if (e1->op == TOKtemplate) - { -- Type *t = e->type->toBasetype(); -+ s = ((TemplateExp *)e1)->td; -+ tiargs = NULL; -+ tthis = NULL; -+ goto Lfd; -+ } -+ else if (e1->op == TOKdotvar && e1->type && e1->type->toBasetype()->ty == Tfunction) -+ { -+ DotVarExp *dve = (DotVarExp *)e1; -+ s = dve->var->isFuncDeclaration(); -+ tiargs = NULL; -+ tthis = dve->e1->type; -+ goto Lfd; -+ } -+ else if (e1->op == TOKvar && e1->type && e1->type->toBasetype()->ty == Tfunction) -+ { -+ s = ((VarExp *)e1)->var->isFuncDeclaration(); -+ tiargs = NULL; -+ tthis = NULL; -+ Lfd: -+ assert(s); -+ FuncDeclaration *fd; -+ if (e2) -+ { -+ e2 = e2->semantic(sc); -+ if (e2->op == TOKerror) -+ return new ErrorExp(); -+ e2 = resolveProperties(sc, e2); -+ -+ Expressions a; -+ a.push(e2); - -- if (t->ty == Tfunction || e->op == TOKoverloadset) -+ fd = resolveFuncCall(loc, sc, s, tiargs, tthis, &a, 1); -+ if (fd && fd->type) -+ { -+ assert(fd->type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ goto Leprop; -+ Expression *e = new CallExp(loc, e1, e2); -+ return e->semantic(sc); -+ } -+ } - { -- if (t->ty == Tfunction && !((TypeFunction *)t)->isproperty && -- global.params.enforcePropertySyntax) -+ fd = resolveFuncCall(loc, sc, s, tiargs, tthis, NULL, 1); -+ if (fd && fd->type) - { -- error(e->loc, "not a property %s", e->toChars()); -- return new ErrorExp(); -+ assert(fd->type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (!tf->isref && e2) -+ goto Leproplvalue; -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ goto Leprop; -+ Expression *e = new CallExp(loc, e1); -+ if (e2) -+ e = new AssignExp(loc, e, e2); -+ return e->semantic(sc); - } -- e = new CallExp(e->loc, e); -- e = e->semantic(sc); - } -+ if (FuncDeclaration *fd = s->isFuncDeclaration()) -+ { // Keep better diagnostic message for invalid property usage of functions -+ assert(fd->type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ error(loc, "not a property %s", e1->toChars()); -+ Expression *e = new CallExp(loc, e1, e2); -+ return e->semantic(sc); -+ } -+ if (e2) -+ goto Leprop; -+ } -+ if (e2) -+ return NULL; - -- /* Look for e being a lazy parameter; rewrite as delegate call -+ if (e1->type && -+ e1->op != TOKtype) // function type is not a property -+ { -+ /* Look for e1 being a lazy parameter; rewrite as delegate call - */ -- else if (e->op == TOKvar) -- { VarExp *ve = (VarExp *)e; -+ if (e1->op == TOKvar) -+ { -+ VarExp *ve = (VarExp *)e1; - - if (ve->var->storage_class & STClazy) - { -- e = new CallExp(e->loc, e); -- e = e->semantic(sc); -+ Expression *e = new CallExp(loc, e1); -+ return e->semantic(sc); - } - } -- -- else if (e->op == TOKdotexp) -+ else if (e1->op == TOKdotexp) - { -- e->error("expression has no value"); -+ e1->error("expression has no value"); - return new ErrorExp(); - } -- - } - --return_expr: -- if (!e->type) -+ if (!e1->type) - { -- error(e->loc, "cannot resolve type for %s", e->toChars()); -- e->type = new TypeError(); -+ error(loc, "cannot resolve type for %s", e1->toChars()); -+ e1 = new ErrorExp(); - } -+ return e1; -+ -+Leprop: -+ error(loc, "not a property %s", e1->toChars()); -+ return new ErrorExp(); -+ -+Leproplvalue: -+ error(loc, "%s is not an lvalue", e1->toChars()); -+ return new ErrorExp(); -+} -+ -+Expression *resolveProperties(Scope *sc, Expression *e) -+{ -+ //printf("resolveProperties(%s)\n", e->toChars()); -+ -+ e = resolvePropertiesX(sc, e); -+ e = checkRightThis(sc, e); - return e; - } - -@@ -342,18 +545,313 @@ void checkPropertyCall(Expression *e, Ex - tf = (TypeFunction *)ce->f->type; - } - } -- else if (ce->e1->type->ty == Tfunction) -- tf = (TypeFunction *)ce->e1->type; -- else if (ce->e1->type->ty == Tdelegate) -- tf = (TypeFunction *)ce->e1->type->nextOf(); -- else if (ce->e1->type->ty == Tpointer && ce->e1->type->nextOf()->ty == Tfunction) -- tf = (TypeFunction *)ce->e1->type->nextOf(); -- else -- assert(0); -- -- if (!tf->isproperty && global.params.enforcePropertySyntax) -- ce->e1->error("not a property %s", emsg->toChars()); -+ else if (ce->e1->type->ty == Tfunction) -+ tf = (TypeFunction *)ce->e1->type; -+ else if (ce->e1->type->ty == Tdelegate) -+ tf = (TypeFunction *)ce->e1->type->nextOf(); -+ else if (ce->e1->type->ty == Tpointer && ce->e1->type->nextOf()->ty == Tfunction) -+ tf = (TypeFunction *)ce->e1->type->nextOf(); -+ else -+ assert(0); -+ -+ if (!tf->isproperty && global.params.enforcePropertySyntax) -+ ce->e1->error("not a property %s", emsg->toChars()); -+ } -+} -+ -+/****************************** -+ * If e1 is a property function (template), resolve it. -+ */ -+ -+Expression *resolvePropertiesOnly(Scope *sc, Expression *e1) -+{ -+ OverloadSet *os; -+ FuncDeclaration *fd; -+ TemplateDeclaration *td; -+ -+ if (e1->op == TOKdotexp) -+ { -+ DotExp *de = (DotExp *)e1; -+ if (de->e2->op == TOKoverloadset) -+ { -+ os = ((OverExp *)de->e2)->vars; -+ goto Los; -+ } -+ } -+ else if (e1->op == TOKoverloadset) -+ { -+ os = ((OverExp *)e1)->vars; -+ Los: -+ assert(os); -+ for (size_t i = 0; i < os->a.dim; i++) -+ { -+ Dsymbol *s = os->a[i]; -+ fd = s->isFuncDeclaration(); -+ td = s->isTemplateDeclaration(); -+ if (fd) -+ { -+ if (((TypeFunction *)fd->type)->isproperty) -+ return resolveProperties(sc, e1); -+ } -+ else if (td && td->onemember && -+ (fd = td->onemember->isFuncDeclaration()) != NULL) -+ { -+ if (((TypeFunction *)fd->type)->isproperty || -+ (fd->storage_class2 & STCproperty) || -+ (td->scope->stc & STCproperty)) -+ { -+ return resolveProperties(sc, e1); -+ } -+ } -+ } -+ } -+ else if (e1->op == TOKdotti) -+ { -+ DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1; -+ if (dti->ti->tempdecl && (td = dti->ti->tempdecl->isTemplateDeclaration()) != NULL) -+ goto Ltd; -+ } -+ else if (e1->op == TOKdottd) -+ { -+ td = ((DotTemplateExp *)e1)->td; -+ goto Ltd; -+ } -+ else if (e1->op == TOKimport) -+ { -+ Dsymbol *s = ((ScopeExp *)e1)->sds; -+ td = s->isTemplateDeclaration(); -+ if (td) -+ goto Ltd; -+ TemplateInstance *ti = s->isTemplateInstance(); -+ if (ti && !ti->semanticRun && ti->tempdecl) -+ { -+ if ((td = ti->tempdecl->isTemplateDeclaration()) != NULL) -+ goto Ltd; -+ } -+ } -+ else if (e1->op == TOKtemplate) -+ { -+ td = ((TemplateExp *)e1)->td; -+ Ltd: -+ assert(td); -+ if (td->onemember && -+ (fd = td->onemember->isFuncDeclaration()) != NULL) -+ { -+ if (((TypeFunction *)fd->type)->isproperty || -+ (fd->storage_class2 & STCproperty) || -+ (td->scope->stc & STCproperty)) -+ { -+ return resolveProperties(sc, e1); -+ } -+ } -+ } -+ else if (e1->op == TOKdotvar && e1->type->ty == Tfunction) -+ { -+ DotVarExp *dve = (DotVarExp *)e1; -+ fd = dve->var->isFuncDeclaration(); -+ goto Lfd; -+ } -+ else if (e1->op == TOKvar && e1->type->ty == Tfunction) -+ { -+ fd = ((VarExp *)e1)->var->isFuncDeclaration(); -+ Lfd: -+ assert(fd); -+ if (((TypeFunction *)fd->type)->isproperty) -+ return resolveProperties(sc, e1); -+ } -+ return e1; -+} -+ -+ -+/****************************** -+ * Find symbol in accordance with the UFCS name look up rule -+ */ -+ -+Expression *searchUFCS(Scope *sc, UnaExp *ue, Identifier *ident) -+{ -+ Loc loc = ue->loc; -+ Dsymbol *s = NULL; -+ -+ for (Scope *scx = sc; scx; scx = scx->enclosing) -+ { -+ if (!scx->scopesym) -+ continue; -+ s = scx->scopesym->search(loc, ident, 0); -+ if (s) -+ { -+ // overload set contains only module scope symbols. -+ if (s->isOverloadSet()) -+ break; -+ // selective/renamed imports also be picked up -+ if (AliasDeclaration *ad = s->isAliasDeclaration()) -+ { -+ if (ad->import) -+ break; -+ } -+ // See only module scope symbols for UFCS target. -+ Dsymbol *p = s->toParent2(); -+ if (p && p->isModule()) -+ break; -+ } -+ s = NULL; -+ } -+ if (!s) -+ return ue->e1->type->Type::getProperty(loc, ident, 0); -+ -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (f) -+ { -+ TemplateDeclaration *td = getFuncTemplateDecl(f); -+ if (td) -+ { -+ if (td->overroot) -+ td = td->overroot; -+ s = td; -+ } -+ } -+ -+ if (ue->op == TOKdotti) -+ { -+ DotTemplateInstanceExp *dti = (DotTemplateInstanceExp *)ue; -+ TemplateInstance *ti = new TemplateInstance(loc, s->ident); -+ ti->tiargs = dti->ti->tiargs; // for better diagnostic message -+ if (!ti->updateTemplateDeclaration(sc, s)) -+ return new ErrorExp(); -+ return new ScopeExp(loc, ti); -+ } -+ else -+ { -+ return new DsymbolExp(loc, s, 1); -+ } -+} -+ -+/****************************** -+ * check e is exp.opDispatch!(tiargs) or not -+ * It's used to switch to UFCS the semantic analysis path -+ */ -+ -+bool isDotOpDispatch(Expression *e) -+{ -+ return e->op == TOKdotti && -+ ((DotTemplateInstanceExp *)e)->ti->name == Id::opDispatch; -+} -+ -+/****************************** -+ * Pull out callable entity with UFCS. -+ */ -+ -+Expression *resolveUFCS(Scope *sc, CallExp *ce) -+{ -+ Loc loc = ce->loc; -+ Expression *eleft; -+ Expression *e; -+ -+ if (ce->e1->op == TOKdot) -+ { -+ DotIdExp *die = (DotIdExp *)ce->e1; -+ Identifier *ident = die->ident; -+ -+ Expression *ex = die->semanticX(sc); -+ if (ex != die) -+ { -+ ce->e1 = ex; -+ return NULL; -+ } -+ eleft = die->e1; -+ -+ Type *t = eleft->type->toBasetype(); -+ if (t->ty == Tarray || t->ty == Tsarray || -+ t->ty == Tnull || (t->isTypeBasic() && t->ty != Tvoid)) -+ { -+ /* Built-in types and arrays have no callable properties, so do shortcut. -+ * It is necessary in: e.init() -+ */ -+ } -+ else if (t->ty == Taarray) -+ { -+ if (ident == Id::remove) -+ { -+ /* Transform: -+ * aa.remove(arg) into delete aa[arg] -+ */ -+ if (!ce->arguments || ce->arguments->dim != 1) -+ { -+ ce->error("expected key as argument to aa.remove()"); -+ return new ErrorExp(); -+ } -+ if (!eleft->type->isMutable()) -+ { -+ ce->error("cannot remove key from %s associative array %s", -+ MODtoChars(t->mod), eleft->toChars()); -+ return new ErrorExp(); -+ } -+ Expression *key = (*ce->arguments)[0]; -+ key = key->semantic(sc); -+ key = resolveProperties(sc, key); -+ -+ TypeAArray *taa = (TypeAArray *)t; -+ key = key->implicitCastTo(sc, taa->index); -+ -+ if (!key->rvalue()) -+ return new ErrorExp(); -+ -+ return new RemoveExp(loc, eleft, key); -+ } -+ else if (ident == Id::apply || ident == Id::applyReverse) -+ { -+ return NULL; -+ } -+ else -+ { -+ TypeAArray *taa = (TypeAArray *)t; -+ assert(taa->ty == Taarray); -+ StructDeclaration *sd = taa->getImpl(); -+ Dsymbol *s = sd->search(Loc(), ident, 2); -+ if (s) -+ return NULL; -+ } -+ } -+ else -+ { -+ if (Expression *ey = die->semanticY(sc, 1)) -+ { -+ ce->e1 = ey; -+ if (isDotOpDispatch(ey)) -+ { -+ unsigned errors = global.startGagging(); -+ e = ce->semantic(sc); -+ if (global.endGagging(errors)) -+ {} /* fall down to UFCS */ -+ else -+ return e; -+ } -+ else -+ return NULL; -+ } -+ } -+ e = searchUFCS(sc, die, ident); -+ } -+ else if (ce->e1->op == TOKdotti) -+ { -+ DotTemplateInstanceExp *dti = (DotTemplateInstanceExp *)ce->e1; -+ if (Expression *ey = dti->semanticY(sc, 1)) -+ { -+ ce->e1 = ey; -+ return NULL; -+ } -+ eleft = dti->e1; -+ e = searchUFCS(sc, dti, dti->ti->name); - } -+ else -+ return NULL; -+ -+ // Rewrite -+ ce->e1 = e; -+ if (!ce->arguments) -+ ce->arguments = new Expressions(); -+ ce->arguments->shift(eleft); -+ -+ return NULL; - } - - /****************************** -@@ -362,130 +860,76 @@ void checkPropertyCall(Expression *e, Ex - - Expression *resolveUFCSProperties(Scope *sc, Expression *e1, Expression *e2 = NULL) - { -- Expression *e = NULL; -- Expression *eleft; -- Identifier *ident; -- Objects* tiargs; - Loc loc = e1->loc; -+ Expression *eleft; -+ Expression *e; - - if (e1->op == TOKdot) - { - DotIdExp *die = (DotIdExp *)e1; -- eleft = die->e1; -- ident = die->ident; -- tiargs = NULL; -- goto L1; -+ eleft = die->e1; -+ e = searchUFCS(sc, die, die->ident); - } - else if (e1->op == TOKdotti) - { - DotTemplateInstanceExp *dti; - dti = (DotTemplateInstanceExp *)e1; -- eleft = dti->e1; -- ident = dti->ti->name; -- tiargs = dti->ti->tiargs; -- L1: -- /* .ident -- * .ident!tiargs -- */ -- e = new IdentifierExp(loc, Id::empty); -- if (tiargs) -- e = new DotTemplateInstanceExp(loc, e, ident, tiargs); -- else -- e = new DotIdExp(loc, e, ident); -+ eleft = dti->e1; -+ e = searchUFCS(sc, dti, dti->ti->name); -+ } -+ else -+ return NULL; - -- if (e2) -- { -- // run semantic without gagging -- e2 = e2->semantic(sc); -+ // Rewrite -+ if (e2) -+ { -+ // run semantic without gagging -+ e2 = e2->semantic(sc); - -- /* .f(e1) = e2 -- */ -- Expression *ex = e->syntaxCopy(); -- Expressions *a1 = new Expressions(); -- a1->setDim(1); -- (*a1)[0] = eleft; -- ex = new CallExp(loc, ex, a1); -- ex = ex->trySemantic(sc); -- -- /* .f(e1, e2) -- */ -- Expressions *a2 = new Expressions(); -- a2->setDim(2); -- (*a2)[0] = eleft; -- (*a2)[1] = e2; -- e = new CallExp(loc, e, a2); -- if (ex) -- { // if fallback setter exists, gag errors -- e = e->trySemantic(sc); -- if (!e) -- { checkPropertyCall(ex, e1); -- ex = new AssignExp(loc, ex, e2); -- return ex->semantic(sc); -- } -- } -- else -- { // strict setter prints errors if fails -- e = e->semantic(sc); -+ /* f(e1) = e2 -+ */ -+ Expression *ex = e->copy(); -+ Expressions *a1 = new Expressions(); -+ a1->setDim(1); -+ (*a1)[0] = eleft; -+ ex = new CallExp(loc, ex, a1); -+ ex = ex->trySemantic(sc); -+ -+ /* f(e1, e2) -+ */ -+ Expressions *a2 = new Expressions(); -+ a2->setDim(2); -+ (*a2)[0] = eleft; -+ (*a2)[1] = e2; -+ e = new CallExp(loc, e, a2); -+ if (ex) -+ { // if fallback setter exists, gag errors -+ e = e->trySemantic(sc); -+ if (!e) -+ { checkPropertyCall(ex, e1); -+ ex = new AssignExp(loc, ex, e2); -+ return ex->semantic(sc); - } -- checkPropertyCall(e, e1); -- return e; - } - else -- { -- /* .f(e1) -- */ -- Expressions *arguments = new Expressions(); -- arguments->setDim(1); -- (*arguments)[0] = eleft; -- e = new CallExp(loc, e, arguments); -+ { // strict setter prints errors if fails - e = e->semantic(sc); -- checkPropertyCall(e, e1); -- return e->semantic(sc); - } -+ checkPropertyCall(e, e1); -+ return e; - } -- return e; --} -- --/********************************* -- * Attempt to find a type property. If failed, attempt to find -- * UFCS property. If UFCS found, return expression. Otherwise -- * show type property error message. -- * Returns non-NULL only if UFCS property found. -- */ --Expression * resolveProperty(Scope *sc, Expression **e1, Expression *e2) --{ -- enum TOK op = (*e1)->op; -- UnaExp *una = (UnaExp *)(*e1); -- Type *t = una->e1->type; -- int olderrors = global.errors; -- una->e1 = una->e1->semantic(sc); -- if (global.errors == olderrors && una->e1->type) -+ else - { -- unsigned errors = global.startGagging(); -- // try property gagged -- if (op == TOKdotti) -- *e1 = ((DotTemplateInstanceExp *)una)->semantic(sc, 1); -- else if (op == TOKdot) -- *e1 = ((DotIdExp *)una)->semantic(sc, 1); -- -- if (global.endGagging(errors) || (*e1)->op == TOKerror) -- { -- (*e1)->op = op; -- errors = global.startGagging(); // try UFCS gagged -- Expression *e = resolveUFCSProperties(sc, una, e2); -- if (!global.endGagging(errors) && (*e1)->op != TOKerror) -- return e; // found UFCS -- -- // try property non-gagged -- una->type = t; // restore type -- if (op == TOKdotti) -- *e1 = ((DotTemplateInstanceExp *)una)->semantic(sc, 1); -- else if (op == TOKdot) -- *e1 = ((DotIdExp *)una)->semantic(sc, 1); -- } -+ /* f(e1) -+ */ -+ Expressions *arguments = new Expressions(); -+ arguments->setDim(1); -+ (*arguments)[0] = eleft; -+ e = new CallExp(loc, e, arguments); -+ e = e->semantic(sc); -+ checkPropertyCall(e, e1); -+ return e->semantic(sc); - } -- -- return NULL; - } - - /****************************** -@@ -560,12 +1004,13 @@ void expandTuples(Expressions *exps) - - // Inline expand all the tuples - while (arg->op == TOKtuple) -- { TupleExp *te = (TupleExp *)arg; -- -+ { -+ TupleExp *te = (TupleExp *)arg; - exps->remove(i); // remove arg - exps->insert(i, te->exps); // replace with tuple contents - if (i == exps->dim) - return; // empty tuple, no more arguments -+ (*exps)[i] = Expression::combine(te->e0, (*exps)[i]); - arg = (*exps)[i]; - } - } -@@ -578,26 +1023,28 @@ void expandTuples(Expressions *exps) - - TupleDeclaration *isAliasThisTuple(Expression *e) - { -- if (e->type) -+ if (!e->type) -+ return NULL; -+ -+ Type *t = e->type->toBasetype(); -+Lagain: -+ if (Dsymbol *s = t->toDsymbol(NULL)) - { -- Type *t = e->type->toBasetype(); -- AggregateDeclaration *ad; -- if (t->ty == Tstruct) -- { -- ad = ((TypeStruct *)t)->sym; -- goto L1; -- } -- else if (t->ty == Tclass) -+ AggregateDeclaration *ad = s->isAggregateDeclaration(); -+ if (ad) - { -- ad = ((TypeClass *)t)->sym; -- L1: -- Dsymbol *s = ad->aliasthis; -+ s = ad->aliasthis; - if (s && s->isVarDeclaration()) - { - TupleDeclaration *td = s->isVarDeclaration()->toAlias()->isTupleDeclaration(); - if (td && td->isexp) - return td; - } -+ if (Type *att = t->aliasthisOf()) -+ { -+ t = att; -+ goto Lagain; -+ } - } - } - return NULL; -@@ -683,24 +1130,28 @@ Expressions *arrayExpressionToCommonType - */ - //printf("arrayExpressionToCommonType()\n"); - IntegerExp integerexp(0); -- CondExp condexp(0, &integerexp, NULL, NULL); -+ CondExp condexp(Loc(), &integerexp, NULL, NULL); - - Type *t0 = NULL; - Expression *e0; - size_t j0; - for (size_t i = 0; i < exps->dim; i++) -- { Expression *e = (*exps)[i]; -- -+ { -+ Expression *e = (*exps)[i]; - e = resolveProperties(sc, e); - if (!e->type) -- { e->error("%s has no value", e->toChars()); -+ { -+ e->error("%s has no value", e->toChars()); - e = new ErrorExp(); - } - -- e = callCpCtor(e->loc, sc, e, 1); -+ if (Expression *ex = e->isTemp()) -+ e = ex; -+ e = e->isLvalue() ? callCpCtor(sc, e) : valueNoDtor(e); - - if (t0) -- { if (t0 != e->type) -+ { -+ if (t0 != e->type) - { - /* This applies ?: to merge the types. It's backwards; - * ?: should call this function to merge types. -@@ -718,7 +1169,8 @@ Expressions *arrayExpressionToCommonType - } - } - else -- { j0 = i; -+ { -+ j0 = i; - e0 = e; - t0 = e->type; - } -@@ -751,16 +1203,19 @@ TemplateDeclaration *getFuncTemplateDecl - { - FuncDeclaration *f = s->isFuncDeclaration(); - if (f && f->parent) -- { TemplateInstance *ti = f->parent->isTemplateInstance(); -- -+ { -+ TemplateInstance *ti = f->parent->isTemplateInstance(); -+ TemplateDeclaration *td; - if (ti && - !ti->isTemplateMixin() && - (ti->name == f->ident || - ti->toAlias()->ident == f->ident) - && -- ti->tempdecl && ti->tempdecl->onemember) -+ ti->tempdecl && -+ (td = ti->tempdecl->isTemplateDeclaration()) != NULL && -+ td->onemember) - { -- return ti->tempdecl; -+ return td; - } - } - return NULL; -@@ -782,6 +1237,9 @@ void preFunctionParameters(Loc loc, Scop - arg = resolveProperties(sc, arg); - (*exps)[i] = arg; - -+ if (arg->op == TOKtype) -+ arg->error("%s is not an expression", arg->toChars()); -+ - //arg->rvalue(); - } - } -@@ -792,7 +1250,7 @@ void preFunctionParameters(Loc loc, Scop - * the destructor on it. - */ - --void valueNoDtor(Expression *e) -+Expression *valueNoDtor(Expression *e) - { - if (e->op == TOKcall) - { -@@ -805,70 +1263,94 @@ void valueNoDtor(Expression *e) - */ - CallExp *ce = (CallExp *)e; - if (ce->e1->op == TOKdotvar) -- { DotVarExp *dve = (DotVarExp *)ce->e1; -+ { -+ DotVarExp *dve = (DotVarExp *)ce->e1; - if (dve->var->isCtorDeclaration()) -- { // It's a constructor call -+ { -+ // It's a constructor call - if (dve->e1->op == TOKcomma) -- { CommaExp *comma = (CommaExp *)dve->e1; -+ { -+ CommaExp *comma = (CommaExp *)dve->e1; - if (comma->e2->op == TOKvar) -- { VarExp *ve = (VarExp *)comma->e2; -+ { -+ VarExp *ve = (VarExp *)comma->e2; - VarDeclaration *ctmp = ve->var->isVarDeclaration(); - if (ctmp) -+ { - ctmp->noscope = 1; -+ assert(!ce->isLvalue()); -+ } - } - } - } - } - } -+ return e; - } - - /******************************************** -- * Determine if t is an array of structs that need a postblit. -+ * Determine if t is an array of structs that need a default construction. - */ - #if DMDV2 --int checkPostblit(Loc loc, Type *t) -+bool checkDefCtor(Loc loc, Type *t) - { -- t = t->toBasetype(); -- while (t->ty == Tsarray) -- t = t->nextOf()->toBasetype(); -+ t = t->baseElemOf(); - if (t->ty == Tstruct) -- { FuncDeclaration *fd = ((TypeStruct *)t)->sym->postblit; -- if (fd) -- { if (fd->storage_class & STCdisable) -- fd->toParent()->error(loc, "is not copyable because it is annotated with @disable"); -- return 1; -+ { -+ StructDeclaration *sd = ((TypeStruct *)t)->sym; -+ if (sd->noDefaultCtor) -+ { -+ sd->error(loc, "default construction is disabled"); -+ return true; - } - } -- return 0; -+ return false; - } - #endif - --/********************************************* -- * Call copy constructor for struct value argument. -+/******************************************** -+ * Determine if t is an array of structs that need a postblit. - */ - #if DMDV2 --Expression *callCpCtor(Loc loc, Scope *sc, Expression *e, int noscope) -+bool Expression::checkPostblit(Scope *sc, Type *t) - { -- if (e->op == TOKarrayliteral) -+ t = t->baseElemOf(); -+ if (t->ty == Tstruct) - { -- ArrayLiteralExp *ae = (ArrayLiteralExp *)e; -- for (size_t i = 0; i < ae->elements->dim; i++) -+ // Bugzilla 11395: Require TypeInfo generation for array concatenation -+ if (!t->vtinfo) -+ t->getTypeInfo(sc); -+ -+ StructDeclaration *sd = ((TypeStruct *)t)->sym; -+ if (sd->postblit) - { -- ae->elements->tdata()[i] = -- callCpCtor(loc, sc, ae->elements->tdata()[i], noscope); -+ if (sd->postblit->storage_class & STCdisable) -+ sd->error(loc, "is not copyable because it is annotated with @disable"); -+ else -+ { -+ checkPurity(sc, sd->postblit); -+ checkSafety(sc, sd->postblit); -+ } -+ return true; - } -- e = ae->semantic(sc); -- return e; - } -+ return false; -+} -+#endif - -- Type *tb = e->type->toBasetype(); -- Type *tv = tb; -- while (tv->ty == Tsarray) -- tv = tv->nextOf()->toBasetype(); -+/********************************************* -+ * Call copy constructor for struct value argument. -+ * Input: -+ * sc just used to specify the scope of created temporary variable -+ */ -+#if DMDV2 -+Expression *callCpCtor(Scope *sc, Expression *e) -+{ -+ Type *tv = e->type->baseElemOf(); - if (tv->ty == Tstruct) - { - StructDeclaration *sd = ((TypeStruct *)tv)->sym; -- if (sd->cpctor && e->isLvalue()) -+ if (sd->cpctor) - { - /* Create a variable tmp, and replace the argument e with: - * (tmp = e),tmp -@@ -877,12 +1359,15 @@ Expression *callCpCtor(Loc loc, Scope *s - * directly onto the stack. - */ - Identifier *idtmp = Lexer::uniqueId("__cpcttmp"); -- VarDeclaration *tmp = new VarDeclaration(loc, tb, idtmp, new ExpInitializer(0, e)); -+ VarDeclaration *tmp = new VarDeclaration(e->loc, e->type, idtmp, new ExpInitializer(e->loc, e)); - tmp->storage_class |= STCctfe; -- tmp->noscope = noscope; -- Expression *ae = new DeclarationExp(loc, tmp); -- e = new CommaExp(loc, ae, new VarExp(loc, tmp)); -- e = e->semantic(sc); -+ tmp->noscope = 1; -+ tmp->semantic(sc); -+ Expression *de = new DeclarationExp(e->loc, tmp); -+ Expression *ve = new VarExp(e->loc, tmp); -+ de->type = Type::tvoid; -+ ve->type = e->type; -+ e = Expression::combine(de, ve); - } - } - return e; -@@ -904,7 +1389,7 @@ Expression *callCpCtor(Loc loc, Scope *s - */ - - Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf, -- Expression *ethis, Expressions *arguments, FuncDeclaration *fd) -+ Type *tthis, Expressions *arguments, FuncDeclaration *fd) - { - //printf("functionParameters()\n"); - assert(arguments); -@@ -930,13 +1415,14 @@ Type *functionParameters(Loc loc, Scope - fd->functionSemantic3(); - } - } -+ bool isCtorCall = fd && fd->needThis() && fd->isCtorDeclaration(); - - size_t n = (nargs > nparams) ? nargs : nparams; // n = max(nargs, nparams) - - unsigned wildmatch = 0; -- if (ethis && tf->isWild()) -+ if (tthis && tf->isWild() && !isCtorCall) - { -- Type *t = ethis->type; -+ Type *t = tthis; - if (t->isWild()) - wildmatch |= MODwild; - else if (t->isConst()) -@@ -963,7 +1449,7 @@ Type *functionParameters(Loc loc, Scope - - if (!arg) - { -- if (!p->defaultArg || !fd) -+ if (!p->defaultArg) - { - if (tf->varargs == 2 && i + 1 == nparams) - goto L2; -@@ -973,19 +1459,12 @@ Type *functionParameters(Loc loc, Scope - arg = p->defaultArg; - arg = arg->inlineCopy(sc); - #if DMDV2 -- arg = arg->resolveLoc(loc, sc); // __FILE__ and __LINE__ -+ // __FILE__, __LINE__, __MODULE__, __FUNCTION__, and __PRETTY_FUNCTION__ -+ arg = arg->resolveLoc(loc, sc); - #endif - arguments->push(arg); - nargs++; - } -- else -- { -- Type *pt = p->type; -- if (tf->varargs == 2 && i + 1 == nparams && pt->nextOf()) -- pt = pt->nextOf(); -- arg = arg->inferType(pt); -- (*arguments)[i] = arg; -- } - - if (tf->varargs == 2 && i + 1 == nparams) - { -@@ -1009,35 +1488,28 @@ Type *functionParameters(Loc loc, Scope - case Tsarray: - case Tarray: - { // Create a static array variable v of type arg->type --#ifdef IN_GCC -- /* GCC 4.0 does not like zero length arrays used like -- this; pass a null array value instead. Could also -- just make a one-element array. */ -- if (nargs - i == 0) -- { -- arg = new NullExp(loc); -- break; -- } --#endif - Identifier *id = Lexer::uniqueId("__arrayArg"); - Type *t = new TypeSArray(((TypeArray *)tb)->next, new IntegerExp(nargs - i)); - t = t->semantic(loc, sc); -- bool isSafe = fd ? fd->isSafe() : tf->trust == TRUSTsafe; - VarDeclaration *v = new VarDeclaration(loc, t, id, -- (isSafe && sc->func) ? NULL : new VoidInitializer(loc)); -+ (sc->func && sc->func->isSafe()) ? NULL : new VoidInitializer(loc)); - v->storage_class |= STCctfe; - v->semantic(sc); - v->parent = sc->parent; - //sc->insert(v); - -- Expression *c = new DeclarationExp(0, v); -+ Expression *c = new DeclarationExp(Loc(), v); - c->type = v->type; - - for (size_t u = i; u < nargs; u++) -- { Expression *a = (*arguments)[u]; -+ { -+ Expression *a = (*arguments)[u]; - TypeArray *ta = (TypeArray *)tb; -+ a = a->inferType(ta->next); -+ (*arguments)[u] = a; - if (tret && !ta->next->equals(a->type)) -- { if (tret->toBasetype()->ty == Tvoid || -+ { -+ if (tret->toBasetype()->ty == Tvoid || - a->implicitConvTo(tret)) - { - a = a->toDelegate(sc, tret); -@@ -1097,7 +1569,8 @@ Type *functionParameters(Loc loc, Scope - break; - } - if (wildmatch) -- { /* Calculate wild matching modifier -+ { -+ /* Calculate wild matching modifier - */ - if (wildmatch & MODconst || wildmatch & (wildmatch - 1)) - wildmatch = MODconst; -@@ -1106,9 +1579,52 @@ Type *functionParameters(Loc loc, Scope - else if (wildmatch & MODwild) - wildmatch = MODwild; - else -- { assert(wildmatch & MODmutable); -+ { -+ assert(wildmatch & MODmutable); - wildmatch = MODmutable; - } -+ -+ if ((wildmatch == MODmutable || wildmatch == MODimmutable) && -+ tf->next->hasWild() && -+ (tf->isref || !tf->next->implicitConvTo(tf->next->immutableOf()))) -+ { -+ if (fd) -+ { -+ /* If the called function may return the reference to -+ * outer inout data, it should be rejected. -+ * -+ * void foo(ref inout(int) x) { -+ * ref inout(int) bar(inout(int)) { return x; } -+ * struct S { ref inout(int) bar() inout { return x; } } -+ * bar(int.init) = 1; // bad! -+ * S().bar() = 1; // bad! -+ * } -+ */ -+ FuncDeclaration *f; -+ if (AggregateDeclaration *ad = fd->isThis()) -+ { -+ f = ad->toParent2()->isFuncDeclaration(); -+ goto Linoutnest; -+ } -+ else if (fd->isNested()) -+ { -+ f = fd->toParent2()->isFuncDeclaration(); -+ Linoutnest: -+ for (; f; f = f->toParent2()->isFuncDeclaration()) -+ { -+ if (((TypeFunction *)f->type)->iswild) -+ goto Linouterr; -+ } -+ } -+ } -+ else if (tf->isWild()) -+ { -+ Linouterr: -+ const char *s = wildmatch == MODmutable ? "mutable" : MODtoChars(wildmatch); -+ error(loc, "modify inout to %s is not allowed inside inout function", s); -+ return Type::terror; -+ } -+ } - } - - assert(nargs >= nparams); -@@ -1128,7 +1644,7 @@ Type *functionParameters(Loc loc, Scope - arg = arg->implicitCastTo(sc, p->type->substWildTo(wildmatch)); - arg = arg->optimize(WANTvalue, p->storageClass & STCref); - } -- else if (p->type != arg->type) -+ else if (!p->type->equals(arg->type)) - { - //printf("arg->type = %s, p->type = %s\n", arg->type->toChars(), p->type->toChars()); - if (arg->op == TOKtype) -@@ -1150,6 +1666,8 @@ Type *functionParameters(Loc loc, Scope - Type *t = arg->type; - if (!t->isMutable() || !t->isAssignable()) // check blit assignable - arg->error("cannot modify struct %s with immutable members", arg->toChars()); -+ else -+ checkDefCtor(arg->loc, t); - arg = arg->toLvalue(sc, arg); - } - else if (p->storageClass & STClazy) -@@ -1158,30 +1676,9 @@ Type *functionParameters(Loc loc, Scope - } - else - { -- Type *tb = arg->type->toBasetype(); -- if (tb->ty == Tsarray) -- { -- // call copy constructor of each element -- arg = callCpCtor(loc, sc, arg, 1); -- } --#if DMDV2 -- else if (tb->ty == Tstruct) -- { -- if (arg->op == TOKcall && !arg->isLvalue()) -- { -- /* The struct value returned from the function is transferred -- * to the function, so the callee should not call the destructor -- * on it. -- */ -- valueNoDtor(arg); -- } -- else -- { /* Not transferring it, so call the copy constructor -- */ -- arg = callCpCtor(loc, sc, arg, 1); -- } -- } --#endif -+ if (Expression *e = arg->isTemp()) -+ arg = e; -+ arg = arg->isLvalue() ? callCpCtor(sc, arg) : valueNoDtor(arg); - } - - //printf("arg: %s\n", arg->toChars()); -@@ -1247,25 +1744,29 @@ Type *functionParameters(Loc loc, Scope - - // Do not allow types that need destructors - if (arg->type->needsDestruction()) -- { arg->error("cannot pass types that need destruction as variadic arguments"); -+ { -+ arg->error("cannot pass types that need destruction as variadic arguments"); - arg = new ErrorExp(); - } - -+#if 0 -+ arg = arg->isLvalue() ? callCpCtor(sc, arg) : valueNoDtor(arg); -+#else - // Convert static arrays to dynamic arrays - // BUG: I don't think this is right for D2 - Type *tb = arg->type->toBasetype(); - if (tb->ty == Tsarray) -- { TypeSArray *ts = (TypeSArray *)tb; -+ { -+ TypeSArray *ts = (TypeSArray *)tb; - Type *ta = ts->next->arrayOf(); - if (ts->size(arg->loc) == 0) - arg = new NullExp(arg->loc, ta); - else - arg = arg->castTo(sc, ta); - } --#if DMDV2 - if (tb->ty == Tstruct) - { -- arg = callCpCtor(loc, sc, arg, 1); -+ arg = callCpCtor(sc, arg); - } - #endif - -@@ -1298,7 +1799,29 @@ Type *functionParameters(Loc loc, Scope - } - - Type *tret = tf->next; -- if (wildmatch) -+ if (isCtorCall) -+ { -+ //printf("[%s] fd = %s %s, %d %d %d\n", loc.toChars(), fd->toChars(), fd->type->toChars(), -+ // wildmatch, tf->isWild(), fd->isolateReturn()); -+ if (!tthis) -+ { assert(sc->intypeof || global.errors); -+ tthis = fd->isThis()->type->addMod(fd->type->mod); -+ } -+ if (tf->isWild() && !fd->isolateReturn()) -+ { -+ if (wildmatch) -+ tret = tret->substWildTo(wildmatch); -+ if (!tret->implicitConvTo(tthis)) -+ { -+ const char* s1 = tret ->isNaked() ? " mutable" : tret ->modToChars(); -+ const char* s2 = tthis->isNaked() ? " mutable" : tthis->modToChars(); -+ ::error(loc, "inout constructor %s creates%s object, not%s", -+ fd->toPrettyChars(), s1, s2); -+ } -+ } -+ tret = tthis; -+ } -+ else if (wildmatch) - { /* Adjust function return type based on wildmatch - */ - //printf("wildmatch = x%x, tret = %s\n", wildmatch, tret->toChars()); -@@ -1312,7 +1835,7 @@ Type *functionParameters(Loc loc, Scope - * in ( ) if its precedence is less than pr. - */ - --void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, enum PREC pr) -+void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, PREC pr) - { - #ifdef DEBUG - if (precedence[e->op] == PREC_zero) -@@ -1336,6 +1859,33 @@ void expToCBuffer(OutBuffer *buf, HdrGen - e->toCBuffer(buf, hgs); - } - -+void sizeToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e) -+{ -+ if (e->type == Type::tsize_t) -+ { -+ Expression *ex = (e->op == TOKcast ? ((CastExp *)e)->e1 : e); -+ ex = ex->optimize(WANTvalue); -+ -+ dinteger_t uval = ex->op == TOKint64 ? ex->toInteger() : (dinteger_t)-1; -+ if ((sinteger_t)uval >= 0) -+ { -+ dinteger_t sizemax; -+ if (Target::ptrsize == 4) -+ sizemax = 0xFFFFFFFFUL; -+ else if (Target::ptrsize == 8) -+ sizemax = 0xFFFFFFFFFFFFFFFFULL; -+ else -+ assert(0); -+ if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFULL) -+ { -+ buf->printf("%llu", uval); -+ return; -+ } -+ } -+ } -+ expToCBuffer(buf, hgs, e, PREC_assign); -+} -+ - /************************************************** - * Write out argument list to buf. - */ -@@ -1361,14 +1911,14 @@ void argsToCBuffer(OutBuffer *buf, Expre - - void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs) - { -- if (arguments) -- { OutBuffer argbuf; -- -+ if (arguments && arguments->dim) -+ { -+ OutBuffer argbuf; - for (size_t i = 0; i < arguments->dim; i++) -- { Expression *e = (*arguments)[i]; -- -+ { -+ Expression *e = (*arguments)[i]; - if (i) -- buf->writeByte(','); -+ buf->writestring(", "); - argbuf.reset(); - e->type->toCBuffer2(&argbuf, hgs, 0); - buf->write(&argbuf); -@@ -1378,8 +1928,7 @@ void argExpTypesToCBuffer(OutBuffer *buf - - /******************************** Expression **************************/ - --Expression::Expression(Loc loc, enum TOK op, int size) -- : loc(loc) -+Expression::Expression(Loc loc, TOK op, int size) - { - //printf("Expression::Expression(op = %d) this = %p\n", op, this); - this->loc = loc; -@@ -1389,6 +1938,21 @@ Expression::Expression(Loc loc, enum TOK - type = NULL; - } - -+Expression *EXP_CANT_INTERPRET; -+Expression *EXP_CONTINUE_INTERPRET; -+Expression *EXP_BREAK_INTERPRET; -+Expression *EXP_GOTO_INTERPRET; -+Expression *EXP_VOID_INTERPRET; -+ -+void Expression::init() -+{ -+ EXP_CANT_INTERPRET = new ErrorExp(); -+ EXP_CONTINUE_INTERPRET = new ErrorExp(); -+ EXP_BREAK_INTERPRET = new ErrorExp(); -+ EXP_GOTO_INTERPRET = new ErrorExp(); -+ EXP_VOID_INTERPRET = new ErrorExp(); -+} -+ - Expression *Expression::syntaxCopy() - { - //printf("Expression::syntaxCopy()\n"); -@@ -1406,7 +1970,7 @@ Expression *Expression::copy() - if (!size) - { - #ifdef DEBUG -- fprintf(stdmsg, "No expression copy for: %s\n", toChars()); -+ fprintf(stderr, "No expression copy for: %s\n", toChars()); - printf("op = %d\n", op); - dump(0); - #endif -@@ -1414,7 +1978,7 @@ Expression *Expression::copy() - } - e = (Expression *)mem.malloc(size); - //printf("Expression::copy(op = %d) e = %p\n", op, e); -- return (Expression *)memcpy(e, this, size); -+ return (Expression *)memcpy((void*)e, (void*)this, size); - } - - /************************** -@@ -1454,8 +2018,8 @@ Expression *Expression::trySemantic(Scop - - void Expression::print() - { -- fprintf(stdmsg, "%s\n", toChars()); -- fflush(stdmsg); -+ fprintf(stderr, "%s\n", toChars()); -+ fflush(stderr); - } - - char *Expression::toChars() -@@ -1562,11 +2126,7 @@ real_t Expression::toImaginary() - complex_t Expression::toComplex() - { - error("Floating point constant expression expected instead of %s", toChars()); --#ifdef IN_GCC -- return complex_t(real_t(0)); // %% nicer --#else -- return 0.0; --#endif -+ return (complex_t)0.0; - } - - StringExp *Expression::toString() -@@ -1634,7 +2194,9 @@ Expression *Expression::modifiableLvalue - if (type->isMutable()) - { - if (!type->isAssignable()) -- error("cannot modify struct %s %s with immutable members", toChars(), type->toChars()); -+ { error("cannot modify struct %s %s with immutable members", toChars(), type->toChars()); -+ goto Lerror; -+ } - } - else - { -@@ -1653,9 +2215,13 @@ Expression *Expression::modifiableLvalue - { - error("cannot modify %s expression %s", MODtoChars(type->mod), toChars()); - } -+ goto Lerror; - } - } - return toLvalue(sc, e); -+ -+Lerror: -+ return new ErrorExp(); - } - - -@@ -1749,12 +2315,13 @@ void Expression::checkPurity(Scope *sc, - } - - // Find the closest pure parent of the called function -- if (getFuncTemplateDecl(f)) -- { // The closest pure parent of instantiated template function is -+ if (getFuncTemplateDecl(f) && !f->isNested() && -+ f->parent->isTemplateInstance()->enclosing == NULL) -+ { // The closest pure parent of instantiated non-nested template function is - // always itself. -- if (!f->isPure() && outerfunc->setImpure()) -+ if (!f->isPure() && outerfunc->setImpure() && !(sc->flags & SCOPEctfe)) - error("pure function '%s' cannot call impure function '%s'", -- outerfunc->toChars(), f->toChars()); -+ outerfunc->toPrettyChars(), f->toPrettyChars()); - return; - } - FuncDeclaration *calledparent = f; -@@ -1791,7 +2358,8 @@ void Expression::checkPurity(Scope *sc, - // If the caller has a pure parent, then either the called func must be pure, - // OR, they must have the same pure parent. - if (/*outerfunc->isPure() &&*/ // comment out because we deduce purity now -- !f->isPure() && calledparent != outerfunc) -+ !f->isPure() && calledparent != outerfunc && -+ !(sc->flags & SCOPEctfe)) - { - if (outerfunc->setImpure()) - error("pure function '%s' cannot call impure function '%s'", -@@ -1808,10 +2376,9 @@ void Expression::checkPurity(Scope *sc, - /******************************************* - * Accessing variable v. - * Check for purity and safety violations. -- * If ethis is not NULL, then ethis is the 'this' pointer as in ethis.v - */ - --void Expression::checkPurity(Scope *sc, VarDeclaration *v, Expression *ethis) -+void Expression::checkPurity(Scope *sc, VarDeclaration *v) - { - /* Look for purity and safety violations when accessing variable v - * from current function. -@@ -1822,7 +2389,7 @@ void Expression::checkPurity(Scope *sc, - v->ident != Id::ctfe && // magic variable never violates pure and safe - !v->isImmutable() && // always safe and pure to access immutables... - !(v->isConst() && !v->isRef() && (v->isDataseg() || v->isParameter()) && -- v->type->implicitConvTo(v->type->invariantOf())) && -+ v->type->implicitConvTo(v->type->immutableOf())) && - // or const global/parameter values which have no mutable indirections - !(v->storage_class & STCmanifest) // ...or manifest constants - ) -@@ -1839,7 +2406,8 @@ void Expression::checkPurity(Scope *sc, - FuncDeclaration *ff = s->isFuncDeclaration(); - if (!ff) - break; -- if (ff->setImpure() && !msg) -+ // Accessing implicit generated __gate is pure. -+ if (ff->setImpure() && !msg && strcmp(v->ident->toChars(), "__gate")) - { error("pure function '%s' cannot access mutable static data '%s'", - sc->func->toPrettyChars(), v->toChars()); - msg = TRUE; // only need the innermost message -@@ -1848,6 +2416,26 @@ void Expression::checkPurity(Scope *sc, - } - else - { -+ /* Bugzilla 10981: Special case for the contracts of pure virtual function. -+ * Rewrite: -+ * tret foo(int i) pure -+ * in { assert(i); } out { assert(i); } body { ... } -+ * -+ * as: -+ * tret foo(int i) pure { -+ * void __require() pure { assert(i); } // allow accessing to i -+ * void __ensure() pure { assert(i); } // allow accessing to i -+ * __require(); -+ * ... -+ * __ensure(); -+ * } -+ */ -+ if ((sc->func->ident == Id::require || sc->func->ident == Id::ensure) && -+ v->isParameter() && sc->func->parent == v->parent) -+ { -+ return; -+ } -+ - /* Given: - * void f() - * { int fx; -@@ -1892,6 +2480,7 @@ void Expression::checkPurity(Scope *sc, - void Expression::checkSafety(Scope *sc, FuncDeclaration *f) - { - if (sc->func && !sc->intypeof && -+ !(sc->flags & SCOPEctfe) && - !f->isSafe() && !f->isTrusted()) - { - if (sc->func->setUnsafe()) -@@ -1920,8 +2509,12 @@ Expression *Expression::checkToBoolean(S - assert(type); - #endif - -- // Structs can be converted to bool using opCast(bool)() -+ Expression *e = this; -+ Type *t = type; - Type *tb = type->toBasetype(); -+ Type *att = NULL; -+Lagain: -+ // Structs can be converted to bool using opCast(bool)() - if (tb->ty == Tstruct) - { AggregateDeclaration *ad = ((TypeStruct *)tb)->sym; - /* Don't really need to check for opCast first, but by doing so we -@@ -1930,26 +2523,29 @@ Expression *Expression::checkToBoolean(S - Dsymbol *fd = search_function(ad, Id::cast); - if (fd) - { -- Expression *e = new CastExp(loc, this, Type::tbool); -+ e = new CastExp(loc, e, Type::tbool); - e = e->semantic(sc); - return e; - } - - // Forward to aliasthis. -- if (ad->aliasthis) -+ if (ad->aliasthis && tb != att) - { -- Expression *e = resolveAliasThis(sc, this); -- e = e->checkToBoolean(sc); -- return e; -+ if (!att && tb->checkAliasThisRec()) -+ att = tb; -+ e = resolveAliasThis(sc, e); -+ t = e->type; -+ tb = e->type->toBasetype(); -+ goto Lagain; - } - } - -- if (!type->checkBoolean()) -- { if (type->toBasetype() != Type::terror) -- error("expression %s of type %s does not have a boolean value", toChars(), type->toChars()); -+ if (!t->checkBoolean()) -+ { if (tb != Type::terror) -+ error("expression %s of type %s does not have a boolean value", toChars(), t->toChars()); - return new ErrorExp(); - } -- return this; -+ return e; - } - - /**************************** -@@ -2015,7 +2611,7 @@ int Expression::isBit() - } - - /**************************************** -- * Resolve __LINE__ and __FILE__ to loc. -+ * Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__ to loc. - */ - - Expression *Expression::resolveLoc(Loc loc, Scope *sc) -@@ -2053,20 +2649,25 @@ Expression *Expression::isTemp() - { - //printf("isTemp() %s\n", toChars()); - if (op == TOKcomma) -- { CommaExp *ec = (CommaExp *)this; -+ { -+ CommaExp *ec = (CommaExp *)this; - if (ec->e1->op == TOKdeclaration && - ec->e2->op == TOKvar) -- { DeclarationExp *de = (DeclarationExp *)ec->e1; -+ { -+ DeclarationExp *de = (DeclarationExp *)ec->e1; - VarExp *ve = (VarExp *)ec->e2; -- if (ve->var == de->declaration && ve->var->storage_class & STCctfe) -- { VarDeclaration *v = ve->var->isVarDeclaration(); -+ if (de->declaration == ve->var && ve->var->storage_class & STCctfe) -+ { -+ VarDeclaration *v = ve->var->isVarDeclaration(); - if (v && v->init) - { - ExpInitializer *ei = v->init->isExpInitializer(); - if (ei) -- { Expression *e = ei->exp; -+ { -+ Expression *e = ei->exp; - if (e->op == TOKconstruct) -- { ConstructExp *ce = (ConstructExp *)e; -+ { -+ ConstructExp *ce = (ConstructExp *)e; - if (ce->e1->op == TOKvar && ((VarExp *)ce->e1)->var == ve->var) - e = ce->e2; - } -@@ -2108,21 +2709,26 @@ IntegerExp::IntegerExp(Loc loc, dinteger - } - - IntegerExp::IntegerExp(dinteger_t value) -- : Expression(0, TOKint64, sizeof(IntegerExp)) -+ : Expression(Loc(), TOKint64, sizeof(IntegerExp)) - { - this->type = Type::tint32; - this->value = value; - } - --int IntegerExp::equals(Object *o) --{ IntegerExp *ne; -- -- if (this == o || -- (((Expression *)o)->op == TOKint64 && -- ((ne = (IntegerExp *)o), type->toHeadMutable()->equals(ne->type->toHeadMutable())) && -- value == ne->value)) -- return 1; -- return 0; -+bool IntegerExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (((Expression *)o)->op == TOKint64) -+ { -+ IntegerExp *ne = (IntegerExp *)o; -+ if (type->toHeadMutable()->equals(ne->type->toHeadMutable()) && -+ value == ne->value) -+ { -+ return true; -+ } -+ } -+ return false; - } - - char *IntegerExp::toChars() -@@ -2209,7 +2815,7 @@ real_t IntegerExp::toImaginary() - - complex_t IntegerExp::toComplex() - { -- return toReal(); -+ return (complex_t)toReal(); - } - - int IntegerExp::isBool(int result) -@@ -2390,7 +2996,7 @@ void IntegerExp::toMangleBuffer(OutBuffe - */ - - ErrorExp::ErrorExp() -- : IntegerExp(0, 0, Type::terror) -+ : IntegerExp(Loc(), 0, Type::terror) - { - op = TOKerror; - } -@@ -2417,31 +3023,29 @@ RealExp::RealExp(Loc loc, real_t value, - - char *RealExp::toChars() - { -+ /** sizeof(value)*3 is because each byte of mantissa is max -+ of 256 (3 characters). The string will be "-M.MMMMe-4932". -+ (ie, 8 chars more than mantissa). Plus one for trailing \0. -+ Plus one for rounding. */ - char buffer[sizeof(value) * 3 + 8 + 1 + 1]; - - ld_sprint(buffer, 'g', value); -+ - if (type->isimaginary()) - strcat(buffer, "i"); -- assert(strlen(buffer) < sizeof(buffer)); -+ -+ assert(strlen(buffer) < sizeof(buffer) / sizeof(buffer[0])); - return mem.strdup(buffer); - } - - dinteger_t RealExp::toInteger() - { --#ifdef IN_GCC -- return (sinteger_t) toReal().toInt(); --#else - return (sinteger_t) toReal(); --#endif - } - - uinteger_t RealExp::toUInteger() - { --#ifdef IN_GCC -- return (uinteger_t) toReal().toInt(); --#else - return (uinteger_t) toReal(); --#endif - } - - real_t RealExp::toReal() -@@ -2471,29 +3075,24 @@ complex_t RealExp::toComplex() - - int RealEquals(real_t x1, real_t x2) - { --#ifndef IN_GCC - return (Port::isNan(x1) && Port::isNan(x2)) || -- /* In some cases, the REALPAD bytes get garbage in them, -- * so be sure and ignore them. -- */ -- memcmp(&x1, &x2, Target::realsize - Target::realpad) == 0; --#else -- return (Port::isNan(x1) && Port::isNan(x2)) || -- x1.isIdenticalTo(x2); --#endif -+ Port::fequal(x1, x2); - } - --int RealExp::equals(Object *o) --{ RealExp *ne; -- -- if (this == o || -- (((Expression *)o)->op == TOKfloat64 && -- ((ne = (RealExp *)o), type->toHeadMutable()->equals(ne->type->toHeadMutable())) && -- RealEquals(value, ne->value) -- ) -- ) -- return 1; -- return 0; -+bool RealExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (((Expression *)o)->op == TOKfloat64) -+ { -+ RealExp *ne = (RealExp *)o; -+ if (type->toHeadMutable()->equals(ne->type->toHeadMutable()) && -+ RealEquals(value, ne->value)) -+ { -+ return true; -+ } -+ } -+ return false; - } - - Expression *RealExp::semantic(Scope *sc) -@@ -2507,12 +3106,8 @@ Expression *RealExp::semantic(Scope *sc) - - int RealExp::isBool(int result) - { --#ifdef IN_GCC -- return result ? (! value.isZero()) : (value.isZero()); --#else - return result ? (value != 0) - : (value == 0); --#endif - } - - void floatToBuffer(OutBuffer *buf, Type *type, const real_t& value) -@@ -2525,35 +3120,14 @@ void floatToBuffer(OutBuffer *buf, Type - * "-1.18973e+4932\0".length == 17 - * "-0xf.fffffffffffffffp+16380\0".length == 28 - */ --#ifdef IN_GCC -- char buffer[48]; -- real_t parsed_value; -- -- value.format(buffer, sizeof(buffer)); -- parsed_value = real_t::parse(buffer, real_t::LongDouble); -- if (parsed_value.isIdenticalTo(value)) -- buf->writestring(buffer); -- else -- { -- value.formatHex(buffer, sizeof(buffer)); -- buf->writestring(buffer); -- } --#else - char buffer[32]; - ld_sprint(buffer, 'g', value); -- assert(strlen(buffer) < sizeof(buffer)); --#if _WIN32 && __DMC__ -- char *save = __locale_decpoint; -- __locale_decpoint = "."; -- real_t r = strtold(buffer, NULL); -- __locale_decpoint = save; --#else -- real_t r = strtold(buffer, NULL); --#endif -+ assert(strlen(buffer) < sizeof(buffer) / sizeof(buffer[0])); -+ -+ real_t r = Port::strtold(buffer, NULL); - if (r != value) // if exact duplication - ld_sprint(buffer, 'a', value); - buf->writestring(buffer); --#endif - - if (type) - { -@@ -2600,15 +3174,13 @@ void realToMangleBuffer(OutBuffer *buf, - - if (Port::isNan(value)) - buf->writestring("NAN"); // no -NAN bugs --#ifdef IN_GCC - else if (Port::isInfinity(value)) -- buf->writestring(value.isNegative() ? "NINF" : "INF"); --#endif -+ buf->writestring(value < 0 ? "NINF" : "INF"); - else - { -- char buffer[32]; -+ char buffer[36]; - int n = ld_sprint(buffer, 'A', value); -- assert(n > 0 && n < sizeof(buffer)); -+ assert(n > 0 && n < sizeof(buffer) / sizeof(buffer[0])); - for (int i = 0; i < n; i++) - { char c = buffer[i]; - -@@ -2654,32 +3226,25 @@ ComplexExp::ComplexExp(Loc loc, complex_ - char *ComplexExp::toChars() - { - char buffer[sizeof(value) * 3 + 8 + 1]; -+ - char buf1[sizeof(value) * 3 + 8 + 1]; - char buf2[sizeof(value) * 3 + 8 + 1]; - - ld_sprint(buf1, 'g', creall(value)); - ld_sprint(buf2, 'g', cimagl(value)); - sprintf(buffer, "(%s+%si)", buf1, buf2); -- assert(strlen(buffer) < sizeof(buffer)); -+ assert(strlen(buffer) < sizeof(buffer) / sizeof(buffer[0])); - return mem.strdup(buffer); - } - - dinteger_t ComplexExp::toInteger() - { --#ifdef IN_GCC -- return (sinteger_t) toReal().toInt(); --#else - return (sinteger_t) toReal(); --#endif - } - - uinteger_t ComplexExp::toUInteger() - { --#ifdef IN_GCC -- return (uinteger_t) toReal().toInt(); --#else - return (uinteger_t) toReal(); --#endif - } - - real_t ComplexExp::toReal() -@@ -2697,18 +3262,21 @@ complex_t ComplexExp::toComplex() - return value; - } - --int ComplexExp::equals(Object *o) --{ ComplexExp *ne; -- -- if (this == o || -- (((Expression *)o)->op == TOKcomplex80 && -- ((ne = (ComplexExp *)o), type->toHeadMutable()->equals(ne->type->toHeadMutable())) && -- RealEquals(creall(value), creall(ne->value)) && -- RealEquals(cimagl(value), cimagl(ne->value)) -- ) -- ) -- return 1; -- return 0; -+bool ComplexExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (((Expression *)o)->op == TOKcomplex80) -+ { -+ ComplexExp *ne = (ComplexExp *)o; -+ if (type->toHeadMutable()->equals(ne->type->toHeadMutable()) && -+ RealEquals(creall(value), creall(ne->value)) && -+ RealEquals(cimagl(value), cimagl(ne->value))) -+ { -+ return true; -+ } -+ } -+ return false; - } - - Expression *ComplexExp::semantic(Scope *sc) -@@ -2733,19 +3301,11 @@ void ComplexExp::toCBuffer(OutBuffer *bu - /* Print as: - * (re+imi) - */ --#ifdef IN_GCC -- char buf1[sizeof(value) * 3 + 8 + 1]; -- char buf2[sizeof(value) * 3 + 8 + 1]; -- creall(value).format(buf1, sizeof(buf1)); -- cimagl(value).format(buf2, sizeof(buf2)); -- buf->printf("(%s+%si)", buf1, buf2); --#else - buf->writeByte('('); - floatToBuffer(buf, type, creall(value)); - buf->writeByte('+'); - floatToBuffer(buf, type, cimagl(value)); - buf->writestring("i)"); --#endif - } - - void ComplexExp::toMangleBuffer(OutBuffer *buf) -@@ -2777,11 +3337,13 @@ Expression *IdentifierExp::semantic(Scop - s = sc->search(loc, ident, &scopesym); - if (s) - { Expression *e; -- WithScopeSymbol *withsym; -+ -+ if (s->errors) -+ return new ErrorExp(); - - /* See if the symbol was a member of an enclosing 'with' - */ -- withsym = scopesym->isWithScopeSymbol(); -+ WithScopeSymbol *withsym = scopesym->isWithScopeSymbol(); - if (withsym) - { - #if DMDV2 -@@ -2829,12 +3391,13 @@ Expression *IdentifierExp::semantic(Scop - */ - FuncDeclaration *f = s->isFuncDeclaration(); - if (f) -- { TemplateDeclaration *tempdecl = getFuncTemplateDecl(f); -- if (tempdecl) -+ { -+ TemplateDeclaration *td = getFuncTemplateDecl(f); -+ if (td) - { -- if (tempdecl->overroot) // if not start of overloaded list of TemplateDeclaration's -- tempdecl = tempdecl->overroot; // then get the start -- e = new TemplateExp(loc, tempdecl); -+ if (td->overroot) // if not start of overloaded list of TemplateDeclaration's -+ td = td->overroot; // then get the start -+ e = new TemplateExp(loc, td, f); - e = e->semantic(sc); - return e; - } -@@ -2914,7 +3477,7 @@ DollarExp::DollarExp(Loc loc) - - /******************************** DsymbolExp **************************/ - --DsymbolExp::DsymbolExp(Loc loc, Dsymbol *s, int hasOverloads) -+DsymbolExp::DsymbolExp(Loc loc, Dsymbol *s, bool hasOverloads) - : Expression(loc, TOKdsymbol, sizeof(DsymbolExp)) - { - this->s = s; -@@ -2942,8 +3505,6 @@ Lagain: - - //printf("DsymbolExp:: %p '%s' is a symbol\n", this, toChars()); - //printf("s = '%s', s->kind = '%s'\n", s->toChars(), s->kind()); -- if (type && !s->needThis()) -- return this; - if (!s->isFuncDeclaration()) // functions are checked after overloading - checkDeprecated(sc, s); - Dsymbol *olds = s; -@@ -2974,10 +3535,7 @@ Lagain: - em = s->isEnumMember(); - if (em) - { -- e = em->value; -- e->loc = loc; -- e = e->semantic(sc); -- return e; -+ return em->getVarExp(loc, sc); - } - v = s->isVarDeclaration(); - if (v) -@@ -2988,14 +3546,21 @@ Lagain: - v->semantic(v->scope); - type = v->type; - if (!v->type) -- { error("forward reference of %s %s", v->kind(), v->toChars()); -+ { error("forward reference of %s %s", s->kind(), s->toChars()); - return new ErrorExp(); - } - } - - if ((v->storage_class & STCmanifest) && v->init) - { -- e = v->init->toExpression(); -+ if (v->scope) -+ { -+ v->inuse++; -+ v->init = v->init->semantic(v->scope, v->type, INITinterpret); -+ v->scope = NULL; -+ v->inuse--; -+ } -+ e = v->init->toExpression(v->type); - if (!e) - { error("cannot make expression out of initializer for %s", v->toChars()); - return new ErrorExp(); -@@ -3024,11 +3589,6 @@ Lagain: - if (!f->functionSemantic()) - return new ErrorExp(); - -- if (f->isUnitTestDeclaration()) -- { -- error("cannot call unittest function %s", toChars()); -- return new ErrorExp(); -- } - if (!f->type->deco) - { - error("forward reference to %s", toChars()); -@@ -3041,7 +3601,7 @@ Lagain: - o = s->isOverloadSet(); - if (o) - { //printf("'%s' is an overload set\n", o->toChars()); -- return new OverExp(o); -+ return new OverExp(loc, o); - } - imp = s->isImport(); - if (imp) -@@ -3080,24 +3640,6 @@ Lagain: - TupleDeclaration *tup = s->isTupleDeclaration(); - if (tup) - { -- for (size_t i = 0; i < tup->objects->dim; i++) -- { -- Dsymbol *sa = getDsymbol((*tup->objects)[i]); -- if (sa && sa->needThis()) -- { -- if (hasThis(sc) --#if DMDV2 -- && !sa->isFuncDeclaration() --#endif -- ) -- { -- // Supply an implicit 'this', as in -- // this.ident -- (*tup->objects)[i] = new DotVarExp(loc, new ThisExp(loc), sa->isDeclaration()); -- } -- } -- } -- - e = new TupleExp(loc, tup); - e = e->semantic(sc); - return e; -@@ -3123,7 +3665,8 @@ Lagain: - Dsymbol *p = td->toParent2(); - FuncDeclaration *fdthis = hasThis(sc); - AggregateDeclaration *ad = p ? p->isAggregateDeclaration() : NULL; -- if (fdthis && ad && isAggregate(fdthis->vthis->type) == ad) -+ if (fdthis && ad && isAggregate(fdthis->vthis->type) == ad && -+ (td->scope->stc & STCstatic) == 0) - { - e = new DotTemplateExp(loc, new ThisExp(loc), td); - } -@@ -3182,7 +3725,7 @@ Expression *ThisExp::semantic(Scope *sc) - /* Special case for typeof(this) and typeof(super) since both - * should work even if they are not inside a non-static member function - */ -- if (!fd && sc->intypeof) -+ if (!fd && sc->intypeof == 1) - { - // Find enclosing struct or class - for (Dsymbol *s = sc->getStructClassScope(); 1; s = s->parent) -@@ -3278,7 +3821,7 @@ Expression *SuperExp::semantic(Scope *sc - /* Special case for typeof(this) and typeof(super) since both - * should work even if they are not inside a non-static member function - */ -- if (!fd && sc->intypeof) -+ if (!fd && sc->intypeof == 1) - { - // Find enclosing class - for (Dsymbol *s = sc->getStructClassScope(); 1; s = s->parent) -@@ -3356,15 +3899,15 @@ NullExp::NullExp(Loc loc, Type *type) - this->type = type; - } - --int NullExp::equals(Object *o) -+bool NullExp::equals(RootObject *o) - { - if (o && o->dyncast() == DYNCAST_EXPRESSION) -- { Expression *e = (Expression *)o; -- -+ { -+ Expression *e = (Expression *)o; - if (e->op == TOKnull) -- return TRUE; -+ return true; - } -- return FALSE; -+ return false; - } - - Expression *NullExp::semantic(Scope *sc) -@@ -3428,7 +3971,7 @@ StringExp::StringExp(Loc loc, void *stri - this->ownedByCtfe = false; - } - --StringExp::StringExp(Loc loc, void *string, size_t len, unsigned char postfix) -+StringExp::StringExp(Loc loc, void *string, size_t len, utf8_t postfix) - : Expression(loc, TOKstring, sizeof(StringExp)) - { - this->string = string; -@@ -3447,18 +3990,18 @@ Expression *StringExp::syntaxCopy() - } - #endif - --int StringExp::equals(Object *o) -+bool StringExp::equals(RootObject *o) - { - //printf("StringExp::equals('%s') %s\n", o->toChars(), toChars()); - if (o && o->dyncast() == DYNCAST_EXPRESSION) -- { Expression *e = (Expression *)o; -- -+ { -+ Expression *e = (Expression *)o; - if (e->op == TOKstring) - { - return compare(o) == 0; - } - } -- return FALSE; -+ return false; - } - - Expression *StringExp::semantic(Scope *sc) -@@ -3478,7 +4021,7 @@ Expression *StringExp::semantic(Scope *s - case 'd': - for (u = 0; u < len;) - { -- p = utf_decodeChar((unsigned char *)string, len, &u, &c); -+ p = utf_decodeChar((utf8_t *)string, len, &u, &c); - if (p) - { error("%s", p); - return new ErrorExp(); -@@ -3493,14 +4036,14 @@ Expression *StringExp::semantic(Scope *s - len = newlen; - sz = 4; - //type = new TypeSArray(Type::tdchar, new IntegerExp(loc, len, Type::tindex)); -- type = new TypeDArray(Type::tdchar->invariantOf()); -+ type = new TypeDArray(Type::tdchar->immutableOf()); - committed = 1; - break; - - case 'w': - for (u = 0; u < len;) - { -- p = utf_decodeChar((unsigned char *)string, len, &u, &c); -+ p = utf_decodeChar((utf8_t *)string, len, &u, &c); - if (p) - { error("%s", p); - return new ErrorExp(); -@@ -3517,7 +4060,7 @@ Expression *StringExp::semantic(Scope *s - len = newlen; - sz = 2; - //type = new TypeSArray(Type::twchar, new IntegerExp(loc, len, Type::tindex)); -- type = new TypeDArray(Type::twchar->invariantOf()); -+ type = new TypeDArray(Type::twchar->immutableOf()); - committed = 1; - break; - -@@ -3525,11 +4068,11 @@ Expression *StringExp::semantic(Scope *s - committed = 1; - default: - //type = new TypeSArray(Type::tchar, new IntegerExp(loc, len, Type::tindex)); -- type = new TypeDArray(Type::tchar->invariantOf()); -+ type = new TypeDArray(Type::tchar->immutableOf()); - break; - } - type = type->semantic(loc, sc); -- //type = type->invariantOf(); -+ //type = type->immutableOf(); - //printf("type = %s\n", type->toChars()); - } - return this; -@@ -3550,7 +4093,7 @@ size_t StringExp::length() - case 1: - for (size_t u = 0; u < len;) - { -- p = utf_decodeChar((unsigned char *)string, len, &u, &c); -+ p = utf_decodeChar((utf8_t *)string, len, &u, &c); - if (p) - { error("%s", p); - return 0; -@@ -3607,7 +4150,7 @@ StringExp *StringExp::toUTF8(Scope *sc) - return this; - } - --int StringExp::compare(Object *obj) -+int StringExp::compare(RootObject *obj) - { - //printf("StringExp::compare()\n"); - // Used to sort case statement expressions so we can do an efficient lookup -@@ -3674,13 +4217,14 @@ int StringExp::isLvalue() - /* string literal is rvalue in default, but - * conversion to reference of static array is only allowed. - */ -- return 0; -+ return (type && type->toBasetype()->ty == Tsarray); - } - - Expression *StringExp::toLvalue(Scope *sc, Expression *e) - { -- //printf("StringExp::toLvalue(%s)\n", toChars()); -- return this; -+ //printf("StringExp::toLvalue(%s) type = %s\n", toChars(), type ? type->toChars() : NULL); -+ return (type && type->toBasetype()->ty == Tsarray) -+ ? this : Expression::toLvalue(sc, e); - } - - Expression *StringExp::modifiableLvalue(Scope *sc, Expression *e) -@@ -3695,7 +4239,7 @@ unsigned StringExp::charAt(size_t i) - switch (sz) - { - case 1: -- value = ((unsigned char *)string)[i]; -+ value = ((utf8_t *)string)[i]; - break; - - case 2: -@@ -3754,7 +4298,7 @@ void StringExp::toMangleBuffer(OutBuffer - const char *p; - unsigned c; - size_t u; -- unsigned char *q; -+ utf8_t *q; - size_t qlen; - - /* Write string in UTF-8 format -@@ -3762,7 +4306,7 @@ void StringExp::toMangleBuffer(OutBuffer - switch (sz) - { case 1: - m = 'a'; -- q = (unsigned char *)string; -+ q = (utf8_t *)string; - qlen = len; - break; - case 2: -@@ -3798,12 +4342,12 @@ void StringExp::toMangleBuffer(OutBuffer - buf->writeByte(m); - buf->printf("%d_", (int)qlen); // nbytes <= 11 - -- for (unsigned char *p = buf->data + buf->offset, *pend = p + 2 * qlen; -+ for (utf8_t *p = buf->data + buf->offset, *pend = p + 2 * qlen; - p < pend; p += 2, ++q) - { -- unsigned char hi = *q >> 4 & 0xF; -+ utf8_t hi = *q >> 4 & 0xF; - p[0] = (hi < 10 ? hi + '0' : hi - 10 + 'a'); -- unsigned char lo = *q & 0xF; -+ utf8_t lo = *q & 0xF; - p[1] = (lo < 10 ? lo + '0' : lo - 10 + 'a'); - } - buf->offset += 2 * qlen; -@@ -3828,6 +4372,29 @@ ArrayLiteralExp::ArrayLiteralExp(Loc loc - this->ownedByCtfe = false; - } - -+bool ArrayLiteralExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (o && o->dyncast() == DYNCAST_EXPRESSION && -+ ((Expression *)o)->op == TOKarrayliteral) -+ { -+ ArrayLiteralExp *ae = (ArrayLiteralExp *)o; -+ if (elements->dim != ae->elements->dim) -+ return false; -+ for (size_t i = 0; i < elements->dim; i++) -+ { -+ Expression *e1 = (*elements)[i]; -+ Expression *e2 = (*ae->elements)[i]; -+ if (e1 != e2 && -+ (!e1 || !e2 || !e1->equals(e2))) -+ return false; -+ } -+ return true; -+ } -+ return false; -+} -+ - Expression *ArrayLiteralExp::syntaxCopy() - { - return new ArrayLiteralExp(loc, arraySyntaxCopy(elements)); -@@ -3877,23 +4444,31 @@ StringExp *ArrayLiteralExp::toString() - if (telem == Tchar || telem == Twchar || telem == Tdchar || - (telem == Tvoid && (!elements || elements->dim == 0))) - { -+ unsigned char sz = 1; -+ if (telem == Twchar) sz = 2; -+ else if (telem == Tdchar) sz = 4; -+ - OutBuffer buf; - if (elements) -+ { - for (int i = 0; i < elements->dim; ++i) - { - Expression *ch = (*elements)[i]; - if (ch->op != TOKint64) - return NULL; -- buf.writeUTF8(ch->toInteger()); -+ if (sz == 1) buf.writebyte(ch->toInteger()); -+ else if (sz == 2) buf.writeword(ch->toInteger()); -+ else buf.write4(ch->toInteger()); - } -- buf.writebyte(0); -- -- char prefix = 'c'; -- if (telem == Twchar) prefix = 'w'; -- else if (telem == Tdchar) prefix = 'd'; -+ } -+ char prefix; -+ if (sz == 1) { prefix = 'c'; buf.writebyte(0); } -+ else if (sz == 2) { prefix = 'w'; buf.writeword(0); } -+ else { prefix = 'd'; buf.write4(0); } - -- const size_t len = buf.offset - 1; -+ const size_t len = buf.offset / sz - 1; - StringExp *se = new StringExp(loc, buf.extractData(), len, prefix); -+ se->sz = sz; - se->type = type; - return se; - } -@@ -3985,7 +4560,7 @@ void AssocArrayLiteralExp::toCBuffer(Out - Expression *value = (*values)[i]; - - if (i) -- buf->writeByte(','); -+ buf->writestring(", "); - expToCBuffer(buf, hgs, key, PREC_assign); - buf->writeByte(':'); - expToCBuffer(buf, hgs, value, PREC_assign); -@@ -4023,18 +4598,46 @@ StructLiteralExp::StructLiteralExp(Loc l - this->soffset = 0; - this->fillHoles = 1; - this->ownedByCtfe = false; -- this->ctorinit = 0; -+ this->origin = this; -+ this->stageflags = 0; -+ this->inlinecopy = NULL; - //printf("StructLiteralExp::StructLiteralExp(%s)\n", toChars()); - } - -+bool StructLiteralExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (o && o->dyncast() == DYNCAST_EXPRESSION && -+ ((Expression *)o)->op == TOKstructliteral) -+ { -+ StructLiteralExp *se = (StructLiteralExp *)o; -+ if (sd != se->sd) -+ return false; -+ if (elements->dim != se->elements->dim) -+ return false; -+ for (size_t i = 0; i < elements->dim; i++) -+ { -+ Expression *e1 = (*elements)[i]; -+ Expression *e2 = (*se->elements)[i]; -+ if (e1 != e2 && -+ (!e1 || !e2 || !e1->equals(e2))) -+ return false; -+ } -+ return true; -+ } -+ return false; -+} -+ - Expression *StructLiteralExp::syntaxCopy() - { -- return new StructLiteralExp(loc, sd, arraySyntaxCopy(elements), stype); -+ StructLiteralExp *exp = new StructLiteralExp(loc, sd, arraySyntaxCopy(elements), stype); -+ exp->origin = this; -+ return exp; - } - - Expression *StructLiteralExp::semantic(Scope *sc) --{ Expression *e; -- -+{ - #if LOGSEMANTIC - printf("StructLiteralExp::semantic('%s')\n", toChars()); - #endif -@@ -4044,19 +4647,24 @@ Expression *StructLiteralExp::semantic(S - sd->size(loc); - if (sd->sizeok != SIZEOKdone) - return new ErrorExp(); -- size_t nfields = sd->fields.dim - sd->isnested; -+ size_t nfields = sd->fields.dim - sd->isNested(); - - elements = arrayExpressionSemantic(elements, sc); // run semantic() on each element - expandTuples(elements); - size_t offset = 0; - for (size_t i = 0; i < elements->dim; i++) -- { e = (*elements)[i]; -+ { -+ Expression *e = (*elements)[i]; - if (!e) - continue; - - e = resolveProperties(sc, e); - if (i >= nfields) - { -+ if (i == sd->fields.dim - 1 && sd->isNested() && e->op == TOKnull) -+ { // CTFE sometimes creates null as hidden pointer; we'll allow this. -+ continue; -+ } - #if 0 - for (size_t i = 0; i < sd->fields.dim; i++) - printf("[%d] = %s\n", i, sd->fields[i]->toChars()); -@@ -4064,11 +4672,10 @@ Expression *StructLiteralExp::semantic(S - error("more initializers than fields (%d) of %s", nfields, sd->toChars()); - return new ErrorExp(); - } -- Dsymbol *s = sd->fields[i]; -- VarDeclaration *v = s->isVarDeclaration(); -- assert(v); -+ VarDeclaration *v = sd->fields[i]; - if (v->offset < offset) -- { error("overlapping initialization for %s", v->toChars()); -+ { -+ error("overlapping initialization for %s", v->toChars()); - return new ErrorExp(); - } - offset = v->offset + v->type->size(); -@@ -4078,7 +4685,8 @@ Expression *StructLiteralExp::semantic(S - telem = telem->addMod(stype->mod); - Type *origType = telem; - while (!e->implicitConvTo(telem) && telem->toBasetype()->ty == Tsarray) -- { /* Static array initialization, as in: -+ { -+ /* Static array initialization, as in: - * T[3][5] = e; - */ - telem = telem->toBasetype()->nextOf(); -@@ -4091,55 +4699,22 @@ Expression *StructLiteralExp::semantic(S - if (e->op == TOKerror) - return e; - -- (*elements)[i] = e; -+ (*elements)[i] = e->isLvalue() ? callCpCtor(sc, e) : valueNoDtor(e); - } - - /* Fill out remainder of elements[] with default initializers for fields[] - */ -- for (size_t i = elements->dim; i < nfields; i++) -- { Dsymbol *s = sd->fields[i]; -- VarDeclaration *v = s->isVarDeclaration(); -- assert(v); -- assert(!v->isThisDeclaration()); -- -- if (v->offset < offset) -- { e = NULL; -- sd->hasUnions = 1; -- } -- else -- { -- if (v->init) -- { if (v->init->isVoidInitializer()) -- e = NULL; -- else -- { e = v->init->toExpression(); -- if (!e) -- { error("cannot make expression out of initializer for %s", v->toChars()); -- return new ErrorExp(); -- } -- else if (v->scope) -- { // Do deferred semantic analysis -- Initializer *i2 = v->init->syntaxCopy(); -- i2 = i2->semantic(v->scope, v->type, INITinterpret); -- e = i2->toExpression(); -- // remove v->scope (see bug 3426) -- // but not if gagged, for we might be called again. -- if (!global.gag) -- { v->scope = NULL; -- v->init = i2; // save result -- } -- } -- } -- } -- else if (v->type->needsNested() && ctorinit) -- e = v->type->defaultInit(loc); -- else -- e = v->type->defaultInitLiteral(loc); -- offset = v->offset + v->type->size(); -- } -- elements->push(e); -+ Expression *e = fill(false); -+ if (e->op == TOKerror) -+ { -+ /* An error in the initializer needs to be recorded as an error -+ * in the enclosing function or template, since the initializer -+ * will be part of the stuct declaration. -+ */ -+ global.increaseErrorCount(); -+ return e; - } -- -+ assert(e == this); - type = stype ? stype : sd->type; - - /* If struct requires a destructor, rewrite as: -@@ -4149,7 +4724,7 @@ Expression *StructLiteralExp::semantic(S - if (sd->dtor && sc->func) - { - Identifier *idtmp = Lexer::uniqueId("__sl"); -- VarDeclaration *tmp = new VarDeclaration(loc, type, idtmp, new ExpInitializer(0, this)); -+ VarDeclaration *tmp = new VarDeclaration(loc, type, idtmp, new ExpInitializer(Loc(), this)); - tmp->storage_class |= STCctfe; - Expression *ae = new DeclarationExp(loc, tmp); - Expression *e = new CommaExp(loc, ae, new VarExp(loc, tmp)); -@@ -4160,6 +4735,115 @@ Expression *StructLiteralExp::semantic(S - return this; - } - -+Expression *StructLiteralExp::fill(bool ctorinit) -+{ -+ assert(sd && sd->sizeok == SIZEOKdone); -+ size_t nfields = sd->fields.dim - sd->isNested(); -+ -+ size_t dim = elements->dim; -+ elements->setDim(nfields); -+ for (size_t i = dim; i < nfields; i++) -+ (*elements)[i] = NULL; -+ -+ // Fill in missing any elements with default initializers -+ for (size_t i = 0; i < nfields; i++) -+ { -+ if ((*elements)[i]) -+ continue; -+ VarDeclaration *vd = sd->fields[i]; -+ VarDeclaration *vx = vd; -+ if (vd->init && vd->init->isVoidInitializer()) -+ vx = NULL; -+ // Find overlapped fields with the hole [vd->offset .. vd->offset->size()]. -+ size_t fieldi = i; -+ for (size_t j = 0; j < nfields; j++) -+ { -+ if (i == j) -+ continue; -+ VarDeclaration *v2 = sd->fields[j]; -+ if (v2->init && v2->init->isVoidInitializer()) -+ continue; -+ -+ bool overlap = (vd->offset < v2->offset + v2->type->size() && -+ v2->offset < vd->offset + vd->type->size()); -+ if (!overlap) -+ continue; -+ -+ sd->hasUnions = 1; // note that directly unrelated... -+ -+ if ((*elements)[j]) -+ { -+ vx = NULL; -+ break; -+ } -+ -+#if 1 -+ /* Prefer first found non-void-initialized field -+ * union U { int a; int b = 2; } -+ * U u; // Error: overlapping initialization for field a and b -+ */ -+ if (!vx) -+ vx = v2, fieldi = j; -+ else if (v2->init) -+ { -+ error("overlapping initialization for field %s and %s", -+ v2->toChars(), vd->toChars()); -+ } -+#else // fix Bugzilla 1432 -+ /* Prefer explicitly initialized field -+ * union U { int a; int b = 2; } -+ * U u; // OK (u.b == 2) -+ */ -+ if (!vx || !vx->init && v2->init) -+ vx = v2, fieldi = j; -+ else if (vx != vd && -+ !(vx->offset < v2->offset + v2->type->size() && -+ v2->offset < vx->offset + vx->type->size())) -+ { -+ // Both vx and v2 fills vd, but vx and v2 does not overlap -+ } -+ else if (vx->init && v2->init) -+ { -+ error("overlapping default initialization for field %s and %s", -+ v2->toChars(), vd->toChars()); -+ } -+ else -+ assert(vx->init || !vx->init && !v2->init); -+#endif -+ } -+ if (vx) -+ { -+ Expression *e; -+ if (vx->init) -+ { -+ assert(!vx->init->isVoidInitializer()); -+ e = vx->getConstInitializer(false); -+ } -+ else -+ { -+ if ((vx->storage_class & STCnodefaultctor) && !ctorinit) -+ { -+ error("field %s.%s must be initialized because it has no default constructor", -+ sd->type->toChars(), vx->toChars()); -+ } -+ if (vx->type->needsNested() && ctorinit) -+ e = vx->type->defaultInit(loc); -+ else -+ e = vx->type->defaultInitLiteral(loc); -+ } -+ (*elements)[fieldi] = e; -+ } -+ } -+ -+ for (size_t i = 0; i < elements->dim; i++) -+ { -+ Expression *e = (*elements)[i]; -+ if (e && e->op == TOKerror) -+ return e; -+ } -+ return this; -+} -+ - /************************************** - * Gets expression at offset of type. - * Returns NULL if not found. -@@ -4252,7 +4936,21 @@ void StructLiteralExp::toCBuffer(OutBuff - { - buf->writestring(sd->toChars()); - buf->writeByte('('); -- argsToCBuffer(buf, elements, hgs); -+ -+ // CTFE can generate struct literals that contain an AddrExp pointing -+ // to themselves, need to avoid infinite recursion: -+ // struct S { this(int){ this.s = &this; } S* s; } -+ // const foo = new S(0); -+ if (stageflags & stageToCBuffer) -+ buf->writestring("<recursion>"); -+ else -+ { -+ int old = stageflags; -+ stageflags |= stageToCBuffer; -+ argsToCBuffer(buf, elements, hgs); -+ stageflags = old; -+ } -+ - buf->writeByte(')'); - } - -@@ -4278,7 +4976,7 @@ void StructLiteralExp::toMangleBuffer(Ou - * cast(foo).size - */ - --Expression *typeDotIdExp(Loc loc, Type *type, Identifier *ident) -+DotIdExp *typeDotIdExp(Loc loc, Type *type, Identifier *ident) - { - return new DotIdExp(loc, new TypeExp(loc, type), ident); - } -@@ -4363,16 +5061,49 @@ Expression *ScopeExp::syntaxCopy() - - Expression *ScopeExp::semantic(Scope *sc) - { -- TemplateInstance *ti; -- ScopeDsymbol *sds2; -- - #if LOGSEMANTIC - printf("+ScopeExp::semantic('%s')\n", toChars()); - #endif -+ //if (type == Type::tvoid) -+ // return this; -+ - Lagain: -- ti = sds->isTemplateInstance(); -- if (ti && !ti->errors) -+ TemplateInstance *ti = sds->isTemplateInstance(); -+ if (ti) - { -+ if (!ti->findTemplateDeclaration(sc) || -+ !ti->semanticTiargs(sc)) -+ { -+ ti->inst = ti; -+ ti->inst->errors = true; -+ return new ErrorExp(); -+ } -+ if (ti->needsTypeInference(sc)) -+ { -+ if (TemplateDeclaration *td = ti->tempdecl->isTemplateDeclaration()) -+ { -+ Dsymbol *p = td->toParent2(); -+ FuncDeclaration *fdthis = hasThis(sc); -+ AggregateDeclaration *ad = p ? p->isAggregateDeclaration() : NULL; -+ if (fdthis && ad && isAggregate(fdthis->vthis->type) == ad && -+ (td->scope->stc & STCstatic) == 0) -+ { -+ Expression *e = new DotTemplateInstanceExp(loc, new ThisExp(loc), ti->name, ti->tiargs); -+ return e->semantic(sc); -+ } -+ } -+ else if (OverloadSet *os = ti->tempdecl->isOverloadSet()) -+ { -+ FuncDeclaration *fdthis = hasThis(sc); -+ AggregateDeclaration *ad = os->parent->isAggregateDeclaration(); -+ if (fdthis && ad && isAggregate(fdthis->vthis->type) == ad) -+ { -+ Expression *e = new DotTemplateInstanceExp(loc, new ThisExp(loc), ti->name, ti->tiargs); -+ return e->semantic(sc); -+ } -+ } -+ return this; -+ } - unsigned olderrs = global.errors; - if (!ti->semanticRun) - ti->semantic(sc); -@@ -4381,9 +5112,10 @@ Lagain: - if (ti->inst->errors) - return new ErrorExp(); - Dsymbol *s = ti->inst->toAlias(); -- sds2 = s->isScopeDsymbol(); -+ ScopeDsymbol *sds2 = s->isScopeDsymbol(); - if (!sds2) -- { Expression *e; -+ { -+ Expression *e; - - //printf("s = %s, '%s'\n", s->kind(), s->toChars()); - if (ti->withsym) -@@ -4449,11 +5181,12 @@ void ScopeExp::toCBuffer(OutBuffer *buf, - - // Mainly just a placeholder - --TemplateExp::TemplateExp(Loc loc, TemplateDeclaration *td) -+TemplateExp::TemplateExp(Loc loc, TemplateDeclaration *td, FuncDeclaration *fd) - : Expression(loc, TOKtemplate, sizeof(TemplateExp)) - { - //printf("TemplateExp(): %s\n", td->toChars()); - this->td = td; -+ this->fd = fd; - } - - void TemplateExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4467,6 +5200,20 @@ int TemplateExp::rvalue() - return 0; - } - -+int TemplateExp::isLvalue() -+{ -+ return fd != NULL; -+} -+ -+Expression *TemplateExp::toLvalue(Scope *sc, Expression *e) -+{ -+ if (!fd) -+ return Expression::toLvalue(sc, e); -+ Expression *ex = new DsymbolExp(loc, fd, 1); -+ ex = ex->semantic(sc); -+ return ex; -+} -+ - /********************** NewExp **************************************/ - - /* thisexp.new(newargs) newtype(arguments) */ -@@ -4497,6 +5244,7 @@ Expression *NewExp::semantic(Scope *sc) - { - Type *tb; - ClassDeclaration *cdthis = NULL; -+ size_t nargs; - - #if LOGSEMANTIC - printf("NewExp::semantic() %s\n", toChars()); -@@ -4541,6 +5289,8 @@ Lagain: - arrayExpressionSemantic(arguments, sc); - preFunctionParameters(loc, sc, arguments); - -+ nargs = arguments ? arguments->dim : 0; -+ - if (thisexp && tb->ty != Tclass) - { error("e.new is only for allocating nested classes, not %s", tb->toChars()); - goto Lerr; -@@ -4561,13 +5311,13 @@ Lagain: - for (size_t i = 0; i < cd->vtbl.dim; i++) - { FuncDeclaration *fd = cd->vtbl[i]->isFuncDeclaration(); - if (fd && fd->isAbstract()) -- error("function %s is abstract", fd->toChars()); -+ errorSupplemental(loc, "function '%s' is not implemented", fd->toFullSignature()); - } - goto Lerr; - } - -- if (cd->noDefaultCtor && (!arguments || !arguments->dim)) -- { error("default construction is disabled for type %s", cd->toChars()); -+ if (cd->noDefaultCtor && !nargs && !cd->defaultCtor) -+ { error("default construction is disabled for type %s", cd->type->toChars()); - goto Lerr; - } - checkDeprecated(sc, cd); -@@ -4611,7 +5361,7 @@ Lagain: - goto Lerr; - } - } -- } -+ } - else if (thisexp) - { error("e.new is only for allocating nested classes"); - goto Lerr; -@@ -4641,10 +5391,14 @@ Lagain: - - FuncDeclaration *f = NULL; - if (cd->ctor) -- f = resolveFuncCall(sc, loc, cd->ctor, NULL, NULL, arguments, 0); -+ f = resolveFuncCall(loc, sc, cd->ctor, NULL, tb, arguments, 0); - if (f) - { - checkDeprecated(sc, f); -+#if DMDV2 -+ checkPurity(sc, f); -+ checkSafety(sc, f); -+#endif - member = f->isCtorDeclaration(); - assert(member); - -@@ -4655,14 +5409,13 @@ Lagain: - if (!arguments) - arguments = new Expressions(); - unsigned olderrors = global.errors; -- functionParameters(loc, sc, tf, NULL, arguments, f); -+ type = functionParameters(loc, sc, tf, type, arguments, f); - if (olderrors != global.errors) - return new ErrorExp(); -- type = type->addMod(tf->nextOf()->mod); - } - else - { -- if (arguments && arguments->dim) -+ if (nargs) - { error("no constructor for %s", cd->toChars()); - goto Lerr; - } -@@ -4676,7 +5429,9 @@ Lagain: - newargs = new Expressions(); - newargs->shift(e); - -- f = cd->aggNew->overloadResolve(loc, NULL, newargs); -+ f = resolveFuncCall(loc, sc, cd->aggNew, NULL, tb, newargs); -+ if (!f) -+ goto Lerr; - allocator = f->isNewDeclaration(); - assert(allocator); - -@@ -4685,7 +5440,6 @@ Lagain: - functionParameters(loc, sc, tf, NULL, newargs, f); - if (olderrors != global.errors) - return new ErrorExp(); -- - } - else - { -@@ -4701,8 +5455,8 @@ Lagain: - StructDeclaration *sd = ts->sym; - if (sd->scope) - sd->semantic(NULL); -- if (sd->noDefaultCtor && (!arguments || !arguments->dim)) -- { error("default construction is disabled for type %s", sd->toChars()); -+ if (sd->noDefaultCtor && !nargs) -+ { error("default construction is disabled for type %s", sd->type->toChars()); - goto Lerr; - } - -@@ -4714,7 +5468,9 @@ Lagain: - newargs = new Expressions(); - newargs->shift(e); - -- FuncDeclaration *f = sd->aggNew->overloadResolve(loc, NULL, newargs); -+ FuncDeclaration *f = resolveFuncCall(loc, sc, sd->aggNew, NULL, tb, newargs); -+ if (!f) -+ goto Lerr; - allocator = f->isNewDeclaration(); - assert(allocator); - -@@ -4733,27 +5489,30 @@ Lagain: - } - - FuncDeclaration *f = NULL; -- if (sd->ctor) -- f = resolveFuncCall(sc, loc, sd->ctor, NULL, NULL, arguments, 0); -+ if (sd->ctor && nargs) -+ f = resolveFuncCall(loc, sc, sd->ctor, NULL, tb, arguments, 0); - if (f) - { - checkDeprecated(sc, f); -+#if DMDV2 -+ checkPurity(sc, f); -+ checkSafety(sc, f); -+#endif - member = f->isCtorDeclaration(); - assert(member); - - sd->accessCheck(loc, sc, member); - - TypeFunction *tf = (TypeFunction *)f->type; -- type = tf->next; - - if (!arguments) - arguments = new Expressions(); - unsigned olderrors = global.errors; -- functionParameters(loc, sc, tf, NULL, arguments, f); -+ type = functionParameters(loc, sc, tf, type, arguments, f); - if (olderrors != global.errors) - return new ErrorExp(); - } -- else if (arguments && arguments->dim) -+ else if (nargs) - { - Type *tptr = type->pointerTo(); - -@@ -4782,9 +5541,16 @@ Lagain: - - type = type->pointerTo(); - } -- else if (tb->ty == Tarray && (arguments && arguments->dim)) -+ else if (tb->ty == Tarray && nargs) - { -- for (size_t i = 0; i < arguments->dim; i++) -+ Type *tn = tb->nextOf()->baseElemOf(); -+ Dsymbol *s = tn->toDsymbol(sc); -+ AggregateDeclaration *ad = s ? s->isAggregateDeclaration() : NULL; -+ if (ad && ad->noDefaultCtor) -+ { error("default construction is disabled for type %s", tb->nextOf()->toChars()); -+ goto Lerr; -+ } -+ for (size_t i = 0; i < nargs; i++) - { - if (tb->ty != Tarray) - { error("too many arguments for array"); -@@ -4805,7 +5571,7 @@ Lagain: - } - else if (tb->isscalar()) - { -- if (arguments && arguments->dim) -+ if (nargs) - { error("no constructor for %s", type->toChars()); - goto Lerr; - } -@@ -4881,7 +5647,11 @@ Expression *NewAnonClassExp::semantic(Sc - #endif - - Expression *d = new DeclarationExp(loc, cd); -+ sc = sc->startCTFE(); // just create new scope -+ sc->flags &= ~SCOPEctfe; // temporary stop CTFE - d = d->semantic(sc); -+ sc->flags |= SCOPEctfe; -+ sc = sc->endCTFE(); - - Expression *n = new NewExp(loc, thisexp, newargs, cd->type, arguments); - -@@ -4920,7 +5690,7 @@ void NewAnonClassExp::toCBuffer(OutBuffe - /********************** SymbolExp **************************************/ - - #if DMDV2 --SymbolExp::SymbolExp(Loc loc, enum TOK op, int size, Declaration *var, int hasOverloads) -+SymbolExp::SymbolExp(Loc loc, TOK op, int size, Declaration *var, bool hasOverloads) - : Expression(loc, op, size) - { - assert(var); -@@ -4931,7 +5701,7 @@ SymbolExp::SymbolExp(Loc loc, enum TOK o - - /********************** SymOffExp **************************************/ - --SymOffExp::SymOffExp(Loc loc, Declaration *var, unsigned offset, int hasOverloads) -+SymOffExp::SymOffExp(Loc loc, Declaration *var, unsigned offset, bool hasOverloads) - : SymbolExp(loc, TOKsymoff, sizeof(SymOffExp), var, hasOverloads) - { - this->offset = offset; -@@ -4983,13 +5753,15 @@ void SymOffExp::toCBuffer(OutBuffer *buf - { - if (offset) - buf->printf("(& %s+%u)", var->toChars(), offset); -+ else if (var->isTypeInfoDeclaration()) -+ buf->printf("%s", var->toChars()); - else - buf->printf("& %s", var->toChars()); - } - - /******************************** VarExp **************************/ - --VarExp::VarExp(Loc loc, Declaration *var, int hasOverloads) -+VarExp::VarExp(Loc loc, Declaration *var, bool hasOverloads) - : SymbolExp(loc, TOKvar, sizeof(VarExp), var, hasOverloads) - { - //printf("VarExp(this = %p, '%s', loc = %s)\n", this, var->toChars(), loc.toChars()); -@@ -4997,15 +5769,20 @@ VarExp::VarExp(Loc loc, Declaration *var - this->type = var->type; - } - --int VarExp::equals(Object *o) --{ VarExp *ne; -- -- if (this == o || -- (((Expression *)o)->op == TOKvar && -- ((ne = (VarExp *)o), type->toHeadMutable()->equals(ne->type->toHeadMutable())) && -- var == ne->var)) -- return 1; -- return 0; -+bool VarExp::equals(RootObject *o) -+{ -+ if (this == o) -+ return true; -+ if (((Expression *)o)->op == TOKvar) -+ { -+ VarExp *ne = (VarExp *)o; -+ if (type->toHeadMutable()->equals(ne->type->toHeadMutable()) && -+ var == ne->var) -+ { -+ return true; -+ } -+ } -+ return false; - } - - Expression *VarExp::semantic(Scope *sc) -@@ -5035,9 +5812,10 @@ Expression *VarExp::semantic(Scope *sc) - VarDeclaration *v = var->isVarDeclaration(); - if (v) - { -+ hasOverloads = 0; - v->checkNestedReference(sc, loc); - #if DMDV2 -- checkPurity(sc, v, NULL); -+ checkPurity(sc, v); - #endif - } - FuncDeclaration *f = var->isFuncDeclaration(); -@@ -5085,13 +5863,17 @@ void VarExp::checkEscapeRef() - - int VarExp::isLvalue() - { -- if (var->storage_class & (STClazy | STCtemp)) -+ if (var->storage_class & (STClazy | STCtemp | STCmanifest)) - return 0; - return 1; - } - - Expression *VarExp::toLvalue(Scope *sc, Expression *e) - { -+ if (var->storage_class & STCmanifest) -+ { error("manifest constant '%s' is not lvalue", var->toChars()); -+ return new ErrorExp(); -+ } - if (var->storage_class & STClazy) - { error("lazy variables cannot be lvalues"); - return new ErrorExp(); -@@ -5114,19 +5896,11 @@ int VarExp::checkModifiable(Scope *sc, i - Expression *VarExp::modifiableLvalue(Scope *sc, Expression *e) - { - //printf("VarExp::modifiableLvalue('%s')\n", var->toChars()); -- //if (type && type->toBasetype()->ty == Tsarray) -- //error("cannot change reference to static array '%s'", var->toChars()); -- --#if (BUG6652 == 1) -- VarDeclaration *v = var->isVarDeclaration(); -- if (v && (v->storage_class & STCbug6652) && v->type->isMutable()) -- warning("variable modified in foreach body requires ref storage class"); --#elif (BUG6652 == 2) -- VarDeclaration *v = var->isVarDeclaration(); -- if (v && (v->storage_class & STCbug6652) && v->type->isMutable()) -- deprecation("variable modified in foreach body requires ref storage class"); --#endif -- -+ if (var->storage_class & STCmanifest) -+ { -+ error("Cannot modify '%s'", toChars()); -+ return new ErrorExp(); -+ } - // See if this expression is a modifiable lvalue (i.e. not const) - return Expression::modifiableLvalue(sc, e); - } -@@ -5135,7 +5909,7 @@ Expression *VarExp::modifiableLvalue(Sco - /******************************** OverExp **************************/ - - #if DMDV2 --OverExp::OverExp(OverloadSet *s) -+OverExp::OverExp(Loc loc, OverloadSet *s) - : Expression(loc, TOKoverloadset, sizeof(OverExp)) - { - //printf("OverExp(this = %p, '%s')\n", this, var->toChars()); -@@ -5152,47 +5926,60 @@ Expression *OverExp::toLvalue(Scope *sc, - { - return this; - } -+ -+void OverExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -+{ -+ buf->writestring(vars->ident->toChars()); -+} -+ - #endif - - - /******************************** TupleExp **************************/ - --TupleExp::TupleExp(Loc loc, Expressions *exps) -+TupleExp::TupleExp(Loc loc, Expression *e0, Expressions *exps) - : Expression(loc, TOKtuple, sizeof(TupleExp)) - { - //printf("TupleExp(this = %p)\n", this); -+ this->e0 = e0; - this->exps = exps; -- this->type = NULL; - } - -+TupleExp::TupleExp(Loc loc, Expressions *exps) -+ : Expression(loc, TOKtuple, sizeof(TupleExp)) -+{ -+ //printf("TupleExp(this = %p)\n", this); -+ this->e0 = NULL; -+ this->exps = exps; -+} - - TupleExp::TupleExp(Loc loc, TupleDeclaration *tup) - : Expression(loc, TOKtuple, sizeof(TupleExp)) - { -- exps = new Expressions(); -- type = NULL; -+ this->e0 = NULL; -+ this->exps = new Expressions(); - -- exps->reserve(tup->objects->dim); -+ this->exps->reserve(tup->objects->dim); - for (size_t i = 0; i < tup->objects->dim; i++) -- { Object *o = (*tup->objects)[i]; -- if (o->dyncast() == DYNCAST_EXPRESSION) -+ { RootObject *o = (*tup->objects)[i]; -+ if (Dsymbol *s = getDsymbol(o)) - { -- Expression *e = (Expression *)o; -- if (e->op == TOKdsymbol) -- e = e->syntaxCopy(); -- exps->push(e); -+ /* If tuple element represents a symbol, translate to DsymbolExp -+ * to supply implicit 'this' if needed later. -+ */ -+ Expression *e = new DsymbolExp(loc, s); -+ this->exps->push(e); - } -- else if (o->dyncast() == DYNCAST_DSYMBOL) -+ else if (o->dyncast() == DYNCAST_EXPRESSION) - { -- Dsymbol *s = (Dsymbol *)o; -- Expression *e = new DsymbolExp(loc, s); -- exps->push(e); -+ Expression *e = (Expression *)o; -+ this->exps->push(e); - } - else if (o->dyncast() == DYNCAST_TYPE) - { - Type *t = (Type *)o; - Expression *e = new TypeExp(loc, t); -- exps->push(e); -+ this->exps->push(e); - } - else - { -@@ -5201,30 +5988,32 @@ TupleExp::TupleExp(Loc loc, TupleDeclara - } - } - --int TupleExp::equals(Object *o) -+bool TupleExp::equals(RootObject *o) - { - if (this == o) -- return 1; -+ return true; - if (((Expression *)o)->op == TOKtuple) - { - TupleExp *te = (TupleExp *)o; - if (exps->dim != te->exps->dim) -- return 0; -+ return false; -+ if (e0 && !e0->equals(te->e0) || !e0 && te->e0) -+ return false; - for (size_t i = 0; i < exps->dim; i++) -- { Expression *e1 = (*exps)[i]; -+ { -+ Expression *e1 = (*exps)[i]; - Expression *e2 = (*te->exps)[i]; -- - if (!e1->equals(e2)) -- return 0; -+ return false; - } -- return 1; -+ return true; - } -- return 0; -+ return false; - } - - Expression *TupleExp::syntaxCopy() - { -- return new TupleExp(loc, arraySyntaxCopy(exps)); -+ return new TupleExp(loc, e0 ? e0->syntaxCopy() : NULL, arraySyntaxCopy(exps)); - } - - Expression *TupleExp::semantic(Scope *sc) -@@ -5235,6 +6024,9 @@ Expression *TupleExp::semantic(Scope *sc - if (type) - return this; - -+ if (e0) -+ e0 = e0->semantic(sc); -+ - // Run semantic() on each argument - for (size_t i = 0; i < exps->dim; i++) - { Expression *e = (*exps)[i]; -@@ -5256,9 +6048,20 @@ Expression *TupleExp::semantic(Scope *sc - - void TupleExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { -- buf->writestring("tuple("); -- argsToCBuffer(buf, exps, hgs); -- buf->writeByte(')'); -+ if (e0) -+ { -+ buf->writeByte('('); -+ e0->toCBuffer(buf, hgs); -+ buf->writestring(", tuple("); -+ argsToCBuffer(buf, exps, hgs); -+ buf->writestring("))"); -+ } -+ else -+ { -+ buf->writestring("tuple("); -+ argsToCBuffer(buf, exps, hgs); -+ buf->writeByte(')'); -+ } - } - - -@@ -5280,10 +6083,57 @@ FuncExp::FuncExp(Loc loc, FuncLiteralDec - tok = fd->tok; // save original kind of function/delegate/(infer) - } - -+void FuncExp::genIdent(Scope *sc) -+{ -+ if (fd->ident == Id::empty) -+ { -+ const char *s; -+ if (fd->fes) s = "__foreachbody"; -+ else if (fd->tok == TOKreserved) s = "__lambda"; -+ else if (fd->tok == TOKdelegate) s = "__dgliteral"; -+ else s = "__funcliteral"; -+ -+ DsymbolTable *symtab; -+ if (FuncDeclaration *func = sc->parent->isFuncDeclaration()) -+ { -+ symtab = func->localsymtab; -+ if (symtab) -+ { -+ // Inside template constraint, symtab is not set yet. -+ goto L1; -+ } -+ } -+ else -+ { -+ symtab = sc->parent->isScopeDsymbol()->symtab; -+ L1: -+ assert(symtab); -+ int num = _aaLen(symtab->tab) + 1; -+ Identifier *id = Lexer::uniqueId(s, num); -+ fd->ident = id; -+ if (td) td->ident = id; -+ symtab->insert(td ? (Dsymbol *)td : (Dsymbol *)fd); -+ } -+ } -+} -+ - Expression *FuncExp::syntaxCopy() - { -- TemplateDeclaration *td2 = td ? (TemplateDeclaration *)td->syntaxCopy(NULL) : NULL; -- return new FuncExp(loc, (FuncLiteralDeclaration *)fd->syntaxCopy(NULL), td2); -+ TemplateDeclaration *td2; -+ FuncLiteralDeclaration *fd2; -+ if (td) -+ { -+ td2 = (TemplateDeclaration *)td->syntaxCopy(NULL); -+ assert(td2->members->dim == 1); -+ fd2 = (*td2->members)[0]->isFuncLiteralDeclaration(); -+ assert(fd2); -+ } -+ else -+ { -+ td2 = NULL; -+ fd2 = (FuncLiteralDeclaration *)fd->syntaxCopy(NULL); -+ } -+ return new FuncExp(loc, fd2, td2); - } - - Expression *FuncExp::semantic(Scope *sc) -@@ -5292,6 +6142,11 @@ Expression *FuncExp::semantic(Scope *sc) - printf("FuncExp::semantic(%s)\n", toChars()); - if (fd->treq) printf(" treq = %s\n", fd->treq->toChars()); - #endif -+ Expression *e = this; -+ -+ sc = sc->startCTFE(); // just create new scope -+ sc->flags &= ~SCOPEctfe; // temporary stop CTFE -+ - if (!type || type == Type::tvoid) - { - /* fd->treq might be incomplete type, -@@ -5302,6 +6157,8 @@ Expression *FuncExp::semantic(Scope *sc) - //if (fd->treq) - // fd->treq = fd->treq->semantic(loc, sc); - -+ genIdent(sc); -+ - // Set target of return type inference - if (fd->treq && !fd->type->nextOf()) - { TypeFunction *tfv = NULL; -@@ -5321,10 +6178,9 @@ Expression *FuncExp::semantic(Scope *sc) - td->semantic(sc); - type = Type::tvoid; // temporary type - -- if (!fd->treq) // defer type determination -- return this; -- -- return inferType(fd->treq); -+ if (fd->treq) // defer type determination -+ e = inferType(fd->treq); -+ goto Ldone; - } - - unsigned olderrors = global.errors; -@@ -5345,8 +6201,12 @@ Expression *FuncExp::semantic(Scope *sc) - } - - // need to infer return type -- if ((olderrors != global.errors) && fd->type && fd->type->ty == Tfunction && !fd->type->nextOf()) -- ((TypeFunction *)fd->type)->next = Type::terror; -+ if (olderrors != global.errors) -+ { -+ if (fd->type && fd->type->ty == Tfunction && !fd->type->nextOf()) -+ ((TypeFunction *)fd->type)->next = Type::terror; -+ return new ErrorExp(); -+ } - - // Type is a "delegate to" or "pointer to" the function literal - if ((fd->isNested() && fd->tok == TOKdelegate) || -@@ -5379,7 +6239,10 @@ Expression *FuncExp::semantic(Scope *sc) - } - fd->tookAddressOf++; - } -- return this; -+Ldone: -+ sc->flags |= SCOPEctfe; -+ sc = sc->endCTFE(); -+ return e; - } - - // used from CallExp::semantic() -@@ -5393,6 +6256,8 @@ Expression *FuncExp::semantic(Scope *sc, - return checkarg; - } - -+ genIdent(sc); -+ - assert(td->parameters && td->parameters->dim); - td->semantic(sc); - -@@ -5507,7 +6372,7 @@ Expression *DeclarationExp::semantic(Sco - return new ErrorExp(); - } - else if (sc->func) -- { VarDeclaration *v = s->isVarDeclaration(); -+ { - if ( (s->isFuncDeclaration() || s->isTypedefDeclaration() || - s->isAggregateDeclaration() || s->isEnumDeclaration() || - s->isInterfaceDeclaration()) && -@@ -5571,7 +6436,7 @@ void DeclarationExp::toCBuffer(OutBuffer - * typeid(int) - */ - --TypeidExp::TypeidExp(Loc loc, Object *o) -+TypeidExp::TypeidExp(Loc loc, RootObject *o) - : Expression(loc, TOKtypeid, sizeof(TypeidExp)) - { - this->obj = o; -@@ -5598,7 +6463,7 @@ Expression *TypeidExp::semantic(Scope *s - - if (ta) - { -- ta->resolve(loc, sc, &ea, &ta, &sa); -+ ta->resolve(loc, sc, &ea, &ta, &sa, true); - } - - if (ea) -@@ -5676,8 +6541,8 @@ void TraitsExp::toCBuffer(OutBuffer *buf - { - for (size_t i = 0; i < args->dim; i++) - { -- buf->writeByte(','); -- Object *oarg = (*args)[i]; -+ buf->writestring(", ");; -+ RootObject *oarg = (*args)[i]; - ObjectToCBuffer(buf, hgs, oarg); - } - } -@@ -5709,8 +6574,8 @@ void HaltExp::toCBuffer(OutBuffer *buf, - - /************************************************************/ - --IsExp::IsExp(Loc loc, Type *targ, Identifier *id, enum TOK tok, -- Type *tspec, enum TOK tok2, TemplateParameters *parameters) -+IsExp::IsExp(Loc loc, Type *targ, Identifier *id, TOK tok, -+ Type *tspec, TOK tok2, TemplateParameters *parameters) - : Expression(loc, TOKis, sizeof(IsExp)) - { - this->targ = targ; -@@ -5810,8 +6675,6 @@ Expression *IsExp::semantic(Scope *sc) - tded = targ; - break; - -- case TOKinvariant: -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); - case TOKimmutable: - if (!targ->isImmutable()) - goto Lno; -@@ -5839,6 +6702,8 @@ Expression *IsExp::semantic(Scope *sc) - { ClassDeclaration *cd = ((TypeClass *)targ)->sym; - Parameters *args = new Parameters; - args->reserve(cd->baseclasses->dim); -+ if (cd->scope && !cd->symtab) -+ cd->semantic(cd->scope); - for (size_t i = 0; i < cd->baseclasses->dim; i++) - { BaseClass *b = (*cd->baseclasses)[i]; - args->push(new Parameter(STCin, b->type, NULL, NULL)); -@@ -5924,21 +6789,51 @@ Expression *IsExp::semantic(Scope *sc) - } - goto Lyes; - } -- else if (id && tspec) -+ else if (tspec && !id && !(parameters && parameters->dim)) -+ { -+ /* Evaluate to TRUE if targ matches tspec -+ * is(targ == tspec) -+ * is(targ : tspec) -+ */ -+ tspec = tspec->semantic(loc, sc); -+ //printf("targ = %s, %s\n", targ->toChars(), targ->deco); -+ //printf("tspec = %s, %s\n", tspec->toChars(), tspec->deco); -+ if (tok == TOKcolon) -+ { if (targ->implicitConvTo(tspec)) -+ goto Lyes; -+ else -+ goto Lno; -+ } -+ else /* == */ -+ { if (targ->equals(tspec)) -+ goto Lyes; -+ else -+ goto Lno; -+ } -+ } -+ else if (tspec) - { - /* Evaluate to TRUE if targ matches tspec. - * If TRUE, declare id as an alias for the specialized type. -+ * is(targ == tspec, tpl) -+ * is(targ : tspec, tpl) -+ * is(targ id == tspec) -+ * is(targ id : tspec) -+ * is(targ id == tspec, tpl) -+ * is(targ id : tspec, tpl) - */ - -- assert(parameters && parameters->dim); -+ Identifier *tid = id ? id : Lexer::uniqueId("__isexp_id"); -+ TemplateParameter *tp = new TemplateTypeParameter(loc, tid, NULL, NULL); -+ parameters->insert(0, tp); - - Objects dedtypes; - dedtypes.setDim(parameters->dim); - dedtypes.zero(); - - MATCH m = targ->deduceType(sc, tspec, parameters, &dedtypes); --//printf("targ: %s\n", targ->toChars()); --//printf("tspec: %s\n", tspec->toChars()); -+ //printf("targ: %s\n", targ->toChars()); -+ //printf("tspec: %s\n", tspec->toChars()); - if (m == MATCHnomatch || - (m != MATCHexact && tok == TOKequal)) - { -@@ -5960,7 +6855,7 @@ Expression *IsExp::semantic(Scope *sc) - { TemplateParameter *tp = (*parameters)[i]; - Declaration *s = NULL; - -- m = tp->matchArg(sc, &tiargs, i, parameters, &dedtypes, &s); -+ m = tp->matchArg(loc, sc, &tiargs, i, parameters, &dedtypes, &s); - if (m == MATCHnomatch) - goto Lno; - s->semantic(sc); -@@ -5976,32 +6871,11 @@ Expression *IsExp::semantic(Scope *sc) - else if (id) - { - /* Declare id as an alias for type targ. Evaluate to TRUE -+ * is(targ id) - */ - tded = targ; - goto Lyes; - } -- else if (tspec) -- { -- /* Evaluate to TRUE if targ matches tspec -- * is(targ == tspec) -- * is(targ : tspec) -- */ -- tspec = tspec->semantic(loc, sc); -- //printf("targ = %s, %s\n", targ->toChars(), targ->deco); -- //printf("tspec = %s, %s\n", tspec->toChars(), tspec->deco); -- if (tok == TOKcolon) -- { if (targ->implicitConvTo(tspec)) -- goto Lyes; -- else -- goto Lno; -- } -- else /* == */ -- { if (targ->equals(tspec)) -- goto Lyes; -- else -- goto Lno; -- } -- } - - Lyes: - if (id) -@@ -6047,10 +6921,10 @@ void IsExp::toCBuffer(OutBuffer *buf, Hd - } - #if DMDV2 - if (parameters) -- { // First parameter is already output, so start with second -- for (size_t i = 1; i < parameters->dim; i++) -+ { -+ for (size_t i = 0; i < parameters->dim; i++) - { -- buf->writeByte(','); -+ buf->writestring(", "); - TemplateParameter *tp = (*parameters)[i]; - tp->toCBuffer(buf, hgs); - } -@@ -6062,10 +6936,11 @@ void IsExp::toCBuffer(OutBuffer *buf, Hd - - /************************************************************/ - --UnaExp::UnaExp(Loc loc, enum TOK op, int size, Expression *e1) -+UnaExp::UnaExp(Loc loc, TOK op, int size, Expression *e1) - : Expression(loc, op, size) - { - this->e1 = e1; -+ this->att1 = NULL; - } - - Expression *UnaExp::syntaxCopy() -@@ -6101,11 +6976,14 @@ void UnaExp::toCBuffer(OutBuffer *buf, H - - /************************************************************/ - --BinExp::BinExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2) -+BinExp::BinExp(Loc loc, TOK op, int size, Expression *e1, Expression *e2) - : Expression(loc, op, size) - { - this->e1 = e1; - this->e2 = e2; -+ -+ this->att1 = NULL; -+ this->att2 = NULL; - } - - Expression *BinExp::syntaxCopy() -@@ -6262,7 +7140,7 @@ void BinExp::toCBuffer(OutBuffer *buf, H - buf->writeByte(' '); - buf->writestring(Token::toChars(op)); - buf->writeByte(' '); -- expToCBuffer(buf, hgs, e2, (enum PREC)(precedence[op] + 1)); -+ expToCBuffer(buf, hgs, e2, (PREC)(precedence[op] + 1)); - } - - int BinExp::isunsigned() -@@ -6313,8 +7191,7 @@ Expression *BinAssignExp::semantic(Scope - e = e->semantic(sc); - return e; - } -- -- if (e1->op == TOKslice) -+ else if (e1->op == TOKslice) - { - // T[] op= ... - e = typeCombine(sc); -@@ -6324,8 +7201,9 @@ Expression *BinAssignExp::semantic(Scope - return arrayOp(sc); - } - -- e1 = e1->modifiableLvalue(sc, e1); - e1 = e1->semantic(sc); -+ e1 = e1->optimize(WANTvalue); -+ e1 = e1->modifiableLvalue(sc, e1); - type = e1->type; - checkScalar(); - -@@ -6380,7 +7258,8 @@ Expression *BinAssignExp::semantic(Scope - if (e1->op == TOKerror || e2->op == TOKerror) - return new ErrorExp(); - -- return checkComplexOpAssign(sc); -+ checkComplexOpAssign(sc); -+ return reorderSettingAAElem(sc); - } - - #if DMDV2 -@@ -6447,8 +7326,10 @@ Expression *CompileExp::semantic(Scope * - #if LOGSEMANTIC - printf("CompileExp::semantic('%s')\n", toChars()); - #endif -- UnaExp::semantic(sc); -+ sc = sc->startCTFE(); -+ e1 = e1->semantic(sc); - e1 = resolveProperties(sc, e1); -+ sc = sc->endCTFE(); - if (e1->op == TOKerror) - return e1; - if (!e1->type->isString()) -@@ -6463,11 +7344,14 @@ Expression *CompileExp::semantic(Scope * - return new ErrorExp(); - } - se = se->toUTF8(sc); -- Parser p(sc->module, (unsigned char *)se->string, se->len, 0); -- p.loc = loc; -+ Parser p(sc->module, (utf8_t *)se->string, se->len, 0); -+ p.scanloc = loc; - p.nextToken(); - //printf("p.loc.linnum = %d\n", p.loc.linnum); -+ unsigned errors = global.errors; - Expression *e = p.parseExpression(); -+ if (global.errors != errors) -+ return new ErrorExp(); - if (p.token.value != TOKeof) - { error("incomplete mixin expression (%s)", se->toChars()); - return new ErrorExp(); -@@ -6497,8 +7381,10 @@ Expression *FileExp::semantic(Scope *sc) - #if LOGSEMANTIC - printf("FileExp::semantic('%s')\n", toChars()); - #endif -- UnaExp::semantic(sc); -+ sc = sc->startCTFE(); -+ e1 = e1->semantic(sc); - e1 = resolveProperties(sc, e1); -+ sc = sc->endCTFE(); - e1 = e1->ctfeInterpret(); - if (e1->op != TOKstring) - { error("file name argument must be a string, not (%s)", e1->toChars()); -@@ -6525,7 +7411,23 @@ Expression *FileExp::semantic(Scope *sc) - } - - if (global.params.verbose) -- fprintf(stdmsg, "file %s\t(%s)\n", (char *)se->string, name); -+ fprintf(global.stdmsg, "file %s\t(%s)\n", (char *)se->string, name); -+ if (global.params.moduleDeps != NULL && global.params.moduleDepsFile == NULL) -+ { -+ OutBuffer *ob = global.params.moduleDeps; -+ Module* imod = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ -+ ob->writestring("depsFile "); -+ ob->writestring(imod->toPrettyChars()); -+ ob->writestring(" ("); -+ escapePath(ob, imod->srcfile->toChars()); -+ ob->writestring(") : "); -+ ob->writestring((char *) se->string); -+ ob->writestring(" ("); -+ escapePath(ob, name); -+ ob->writestring(")"); -+ ob->writenl(); -+ } - - { File f(name); - if (f.read()) -@@ -6606,7 +7508,7 @@ void AssertExp::toCBuffer(OutBuffer *buf - expToCBuffer(buf, hgs, e1, PREC_assign); - if (msg) - { -- buf->writeByte(','); -+ buf->writestring(", "); - expToCBuffer(buf, hgs, msg, PREC_assign); - } - buf->writeByte(')'); -@@ -6622,95 +7524,76 @@ DotIdExp::DotIdExp(Loc loc, Expression * - - Expression *DotIdExp::semantic(Scope *sc) - { -- // Indicate we need to resolve by UFCS. -- return semantic(sc, 0); --} -- --Expression *DotIdExp::semantic(Scope *sc, int flag) --{ Expression *e; -- Expression *eleft; -- Expression *eright; -- - #if LOGSEMANTIC - printf("DotIdExp::semantic(this = %p, '%s')\n", this, toChars()); - //printf("e1->op = %d, '%s'\n", e1->op, Token::toChars(e1->op)); - #endif -- --//{ static int z; fflush(stdout); if (++z == 10) *(char*)0=0; } -- -- /* Special case: rewrite this.id and super.id -- * to be classtype.id and baseclasstype.id -- * if we have no this pointer. -- */ -- if ((e1->op == TOKthis || e1->op == TOKsuper) && !hasThis(sc)) -- { ClassDeclaration *cd; -- StructDeclaration *sd; -- AggregateDeclaration *ad; -- -- ad = sc->getStructClassScope(); -- if (ad) -- { -- cd = ad->isClassDeclaration(); -- if (cd) -- { -- if (e1->op == TOKthis) -- { -- e = typeDotIdExp(loc, cd->type, ident); -- return e->semantic(sc); -- } -- else if (cd->baseClass && e1->op == TOKsuper) -- { -- e = typeDotIdExp(loc, cd->baseClass->type, ident); -- return e->semantic(sc); -- } -- } -- else -- { -- sd = ad->isStructDeclaration(); -- if (sd) -- { -- if (e1->op == TOKthis) -- { -- e = typeDotIdExp(loc, sd->type, ident); -- return e->semantic(sc); -- } -- } -- } -- } -+ Expression *e = semanticY(sc, 1); -+ if (e && isDotOpDispatch(e)) -+ { -+ unsigned errors = global.startGagging(); -+ e = resolvePropertiesX(sc, e); -+ if (global.endGagging(errors)) -+ e = NULL; /* fall down to UFCS */ -+ else -+ return e; - } -+ if (!e) // if failed to find the property -+ { -+ /* If ident is not a valid property, rewrite: -+ * e1.ident -+ * as: -+ * .ident(e1) -+ */ -+ e = resolveUFCSProperties(sc, this); -+ } -+ return e; -+} - --// Type *t1save = e1->type; -+// Run sematnic in e1 -+Expression *DotIdExp::semanticX(Scope *sc) -+{ -+ //printf("DotIdExp::semanticX(this = %p, '%s')\n", this, toChars()); -+ Expression *e; - - UnaExp::semantic(sc); -+ if (e1->op == TOKerror) -+ return e1; - - if (ident == Id::mangleof) - { // symbol.mangleof - Dsymbol *ds; - switch (e1->op) - { -- case TOKimport: ds = ((ScopeExp *)e1)->sds; goto L1; -- case TOKvar: ds = ((VarExp *)e1)->var; goto L1; -- case TOKdotvar: ds = ((DotVarExp *)e1)->var; goto L1; -- default: break; -- L1: -- char* s = ds->mangle(); -- e = new StringExp(loc, s, strlen(s), 'c'); -+ case TOKimport: -+ ds = ((ScopeExp *)e1)->sds; -+ goto L1; -+ case TOKvar: -+ ds = ((VarExp *)e1)->var; -+ goto L1; -+ case TOKdotvar: -+ ds = ((DotVarExp *)e1)->var; -+ goto L1; -+ case TOKoverloadset: -+ ds = ((OverExp *)e1)->vars; -+ L1: -+ { -+ const char* s = ds->mangle(); -+ e = new StringExp(loc, (void*)s, strlen(s), 'c'); - e = e->semantic(sc); - return e; -+ } -+ default: -+ break; - } - } - - if (e1->op == TOKdotexp) - { -- DotExp *de = (DotExp *)e1; -- eleft = de->e1; -- eright = de->e2; - } - else - { -- e1 = resolveProperties(sc, e1); -- eleft = NULL; -- eright = e1; -+ e1 = resolvePropertiesX(sc, e1); - } - #if DMDV2 - if (e1->op == TOKtuple && ident == Id::offsetof) -@@ -6725,7 +7608,8 @@ Expression *DotIdExp::semantic(Scope *sc - e = new DotIdExp(e->loc, e, Id::offsetof); - (*exps)[i] = e; - } -- e = new TupleExp(loc, exps); -+ // Don't evaluate te->e0 in runtime -+ e = new TupleExp(loc, /*te->e0*/NULL, exps); - e = e->semantic(sc); - return e; - } -@@ -6734,6 +7618,7 @@ Expression *DotIdExp::semantic(Scope *sc - if (e1->op == TOKtuple && ident == Id::length) - { - TupleExp *te = (TupleExp *)e1; -+ // Don't evaluate te->e0 in runtime - e = new IntegerExp(loc, te->exps->dim, Type::tsize_t); - return e; - } -@@ -6750,6 +7635,56 @@ Expression *DotIdExp::semantic(Scope *sc - return new ErrorExp(); - } - -+ return this; -+} -+ -+// Resolve e1.ident without seeing UFCS. -+// If flag == 1, stop "not a property" error and return NULL. -+Expression *DotIdExp::semanticY(Scope *sc, int flag) -+{ -+ //printf("DotIdExp::semanticY(this = %p, '%s')\n", this, toChars()); -+ -+//{ static int z; fflush(stdout); if (++z == 10) *(char*)0=0; } -+ -+ /* Special case: rewrite this.id and super.id -+ * to be classtype.id and baseclasstype.id -+ * if we have no this pointer. -+ */ -+ if ((e1->op == TOKthis || e1->op == TOKsuper) && !hasThis(sc)) -+ { -+ if (AggregateDeclaration *ad = sc->getStructClassScope()) -+ { -+ if (e1->op == TOKthis) -+ { -+ e1 = new TypeExp(e1->loc, ad->type); -+ } -+ else -+ { -+ ClassDeclaration *cd = ad->isClassDeclaration(); -+ if (cd && cd->baseClass) -+ e1 = new TypeExp(e1->loc, cd->baseClass->type); -+ } -+ } -+ } -+ -+ Expression *e = semanticX(sc); -+ if (e != this) -+ return e; -+ -+ Expression *eleft; -+ Expression *eright; -+ if (e1->op == TOKdotexp) -+ { -+ DotExp *de = (DotExp *)e1; -+ eleft = de->e1; -+ eright = de->e2; -+ } -+ else -+ { -+ eleft = NULL; -+ eright = e1; -+ } -+ - Type *t1b = e1->type->toBasetype(); - - if (eright->op == TOKimport) // also used for template alias's -@@ -6768,7 +7703,7 @@ Expression *DotIdExp::semantic(Scope *sc - * aliases to private symbols are public. - */ - if (Declaration *d = s->isDeclaration()) -- accessCheck(loc, sc, 0, d); -+ accessCheck(loc, sc, NULL, d); - - s = s->toAlias(); - checkDeprecated(sc, s); -@@ -6776,9 +7711,7 @@ Expression *DotIdExp::semantic(Scope *sc - EnumMember *em = s->isEnumMember(); - if (em) - { -- e = em->value; -- e = e->semantic(sc); -- return e; -+ return em->getVarExp(loc, sc); - } - - VarDeclaration *v = s->isVarDeclaration(); -@@ -6814,6 +7747,8 @@ Expression *DotIdExp::semantic(Scope *sc - if (f) - { - //printf("it's a function\n"); -+ if (!f->functionSemantic()) -+ return new ErrorExp(); - if (f->needThis()) - { - if (!eleft) -@@ -6835,7 +7770,7 @@ Expression *DotIdExp::semantic(Scope *sc - OverloadSet *o = s->isOverloadSet(); - if (o) - { //printf("'%s' is an overload set\n", o->toChars()); -- return new OverExp(o); -+ return new OverExp(loc, o); - } - #endif - -@@ -6860,7 +7795,7 @@ Expression *DotIdExp::semantic(Scope *sc - ScopeDsymbol *sds = s->isScopeDsymbol(); - if (sds) - { -- //printf("it's a ScopeDsymbol\n"); -+ //printf("it's a ScopeDsymbol %s\n", ident->toChars()); - e = new ScopeExp(loc, sds); - e = e->semantic(sc); - if (eleft) -@@ -6889,6 +7824,14 @@ Expression *DotIdExp::semantic(Scope *sc - e = e->semantic(sc); - return e; - } -+ if (ie->sds->isPackage() || -+ ie->sds->isImport() || -+ ie->sds->isModule()) -+ { -+ flag = 0; -+ } -+ if (flag) -+ return NULL; - s = ie->sds->search_correct(ident); - if (s) - error("undefined identifier '%s', did you mean '%s %s'?", -@@ -6906,68 +7849,19 @@ Expression *DotIdExp::semantic(Scope *sc - * as: - * (*p).ident - */ -+ if (flag && t1b->nextOf()->ty == Tvoid) -+ return NULL; - e = new PtrExp(loc, e1); -- e->type = ((TypePointer *)t1b)->next; -- return e->type->dotExp(sc, e, ident); -- } --#if DMDV2 -- else if (!flag) -- { /* If ident is not a valid property, rewrite: -- * e1.ident -- * as: -- * .ident(e1) -- */ -- if (e1->op == TOKtype || -- t1b->ty == Tvoid || -- (t1b->ty == Tarray || t1b->ty == Tsarray || t1b->ty == Taarray) && -- (ident == Id::sort || ident == Id::reverse || ident == Id::dup || ident == Id::idup)) -- { goto L2; -- } -- -- /* This would be much better if we added a "hasProperty" method to types, -- * i.e. the gagging is a bad way. -- */ -- -- if (t1b->ty == Taarray) -- { -- TypeAArray *taa = (TypeAArray *)t1b; -- if (!taa->impl && -- ident != Id::__sizeof && -- ident != Id::__xalignof && -- ident != Id::init && -- ident != Id::mangleof && -- ident != Id::stringof && -- ident != Id::offsetof) -- { -- // Find out about these errors when not gagged -- taa->getImpl(); -- } -- } -- -- Type *t1 = e1->type; -- unsigned errors = global.startGagging(); -- e = t1->dotExp(sc, e1, ident); -- if (global.endGagging(errors)) // if failed to find the property -- { -- e1->type = t1; // kludge to restore type -- errors = global.startGagging(); -- e = resolveUFCSProperties(sc, this); -- if (global.endGagging(errors)) -- { -- // both lookups failed, lookup property again for better error message -- e1->type = t1; // restore type -- e = t1->dotExp(sc, e1, ident); -- } -- } - e = e->semantic(sc); -- return e; -+ return e->type->dotExp(sc, e, ident, flag); - } --#endif - else - { -- L2: -- e = e1->type->dotExp(sc, e1, ident); -- e = e->semantic(sc); -+ if (e1->op == TOKtype || e1->op == TOKtemplate) -+ flag = 0; -+ e = e1->type->dotExp(sc, e1, ident, flag); -+ if (!flag || e) -+ e = e->semantic(sc); - return e; - } - } -@@ -7001,7 +7895,7 @@ void DotTemplateExp::toCBuffer(OutBuffer - - /************************************************************/ - --DotVarExp::DotVarExp(Loc loc, Expression *e, Declaration *v, int hasOverloads) -+DotVarExp::DotVarExp(Loc loc, Expression *e, Declaration *v, bool hasOverloads) - : UnaExp(loc, TOKdotvar, sizeof(DotVarExp), e) - { - //printf("DotVarExp()\n"); -@@ -7025,12 +7919,27 @@ Expression *DotVarExp::semantic(Scope *s - * with: - * tuple(e1.a, e1.b, e1.c) - */ -+ e1 = e1->semantic(sc); - Expressions *exps = new Expressions; -+ Expression *e0 = NULL; - Expression *ev = e1; -+ if (sc->func && e1->hasSideEffect()) -+ { -+ Identifier *id = Lexer::uniqueId("__tup"); -+ ExpInitializer *ei = new ExpInitializer(e1->loc, e1); -+ VarDeclaration *v = new VarDeclaration(e1->loc, NULL, id, ei); -+ v->storage_class |= STCctfe; -+ if (e1->isLvalue()) -+ v->storage_class |= STCref | STCforeach; -+ e0 = new DeclarationExp(e1->loc, v); -+ ev = new VarExp(e1->loc, v); -+ e0 = e0->semantic(sc); -+ ev = ev->semantic(sc); -+ } - - exps->reserve(tup->objects->dim); - for (size_t i = 0; i < tup->objects->dim; i++) -- { Object *o = (*tup->objects)[i]; -+ { RootObject *o = (*tup->objects)[i]; - Expression *e; - if (o->dyncast() == DYNCAST_EXPRESSION) - { -@@ -7038,20 +7947,7 @@ Expression *DotVarExp::semantic(Scope *s - if (e->op == TOKdsymbol) - { - Dsymbol *s = ((DsymbolExp *)e)->s; -- if (i == 0 && sc->func && tup->objects->dim > 1 && -- e1->hasSideEffect()) -- { -- Identifier *id = Lexer::uniqueId("__tup"); -- ExpInitializer *ei = new ExpInitializer(e1->loc, e1); -- VarDeclaration *v = new VarDeclaration(e1->loc, NULL, id, ei); -- v->storage_class |= STCctfe | STCref | STCforeach; -- -- ev = new VarExp(e->loc, v); -- e = new CommaExp(e1->loc, new DeclarationExp(e1->loc, v), ev); -- e = new DotVarExp(loc, e, s->isDeclaration()); -- } -- else -- e = new DotVarExp(loc, ev, s->isDeclaration()); -+ e = new DotVarExp(loc, ev, s->isDeclaration()); - } - } - else if (o->dyncast() == DYNCAST_DSYMBOL) -@@ -7069,7 +7965,7 @@ Expression *DotVarExp::semantic(Scope *s - } - exps->push(e); - } -- Expression *e = new TupleExp(loc, exps); -+ Expression *e = new TupleExp(loc, e0, exps); - e = e->semantic(sc); - return e; - } -@@ -7105,13 +8001,25 @@ Expression *DotVarExp::semantic(Scope *s - Dsymbol *vparent = var->toParent(); - AggregateDeclaration *ad = vparent ? vparent->isAggregateDeclaration() : NULL; - e1 = getRightThis(loc, sc, ad, e1, var); -- if (!sc->noaccesscheck) -- accessCheck(loc, sc, e1, var); -+ accessCheck(loc, sc, e1, var); - - VarDeclaration *v = var->isVarDeclaration(); -- Expression *e = expandVar(WANTvalue, v); -- if (e) -+ if (!PULL93 || v && (v->isDataseg() || (v->storage_class & STCmanifest))) -+ { -+ Expression *e = expandVar(WANTvalue, v); -+ if (e) -+ return e; -+ } -+ -+ if (v && v->isDataseg()) // fix bugzilla 8238 -+ { -+ // (e1, v) -+ accessCheck(loc, sc, e1, v); -+ VarExp *ve = new VarExp(loc, v); -+ Expression *e = new CommaExp(loc, e1, ve); -+ e = e->semantic(sc); - return e; -+ } - } - Dsymbol *s; - if (sc->func && !sc->intypeof && t1->hasPointers() && -@@ -7160,15 +8068,49 @@ int modifyFieldVar(Loc loc, Scope *sc, V - if (s) - fd = s->isFuncDeclaration(); - if (fd && -- ((fd->isCtorDeclaration() && var->storage_class & STCfield) || -- (fd->isStaticCtorDeclaration() && !(var->storage_class & STCfield))) && -+ ((fd->isCtorDeclaration() && var->isField()) || -+ (fd->isStaticCtorDeclaration() && !var->isField())) && - fd->toParent2() == var->toParent2() && - (!e1 || e1->op == TOKthis) - ) - { - var->ctorinit = 1; - //printf("setting ctorinit\n"); -- return TRUE; -+ int result = TRUE; -+ if (var->isField() && sc->fieldinit && !sc->intypeof) -+ { -+ assert(e1); -+ bool mustInit = (var->storage_class & STCnodefaultctor || -+ var->type->needsNested()); -+ -+ size_t dim = sc->fieldinit_dim; -+ AggregateDeclaration *ad = fd->isAggregateMember2(); -+ assert(ad); -+ size_t i; -+ for (i = 0; i < dim; i++) // same as findFieldIndexByName in ctfeexp.c ? -+ { -+ if (ad->fields[i] == var) -+ break; -+ } -+ assert(i < dim); -+ unsigned fi = sc->fieldinit[i]; -+ if (fi & CSXthis_ctor) -+ { -+ if (var->type->isMutable() && e1->type->isMutable()) -+ result = FALSE; -+ else -+ ::error(loc, "multiple field %s initialization", var->toChars()); -+ } -+ else if (sc->noctor || fi & CSXlabel) -+ { -+ if (!mustInit && var->type->isMutable() && e1->type->isMutable()) -+ result = FALSE; -+ else -+ ::error(loc, "field %s initializing not allowed in loops or after labels", var->toChars()); -+ } -+ sc->fieldinit[i] |= CSXthis_ctor; -+ } -+ return result; - } - else - { -@@ -7233,89 +8175,127 @@ Expression *DotTemplateInstanceExp::synt - return de; - } - --TemplateDeclaration *DotTemplateInstanceExp::getTempdecl(Scope *sc) -+bool DotTemplateInstanceExp::findTempDecl(Scope *sc) - { - #if LOGSEMANTIC -- printf("DotTemplateInstanceExp::getTempdecl('%s')\n", toChars()); -+ printf("DotTemplateInstanceExp::findTempDecl('%s')\n", toChars()); - #endif -- if (!ti->tempdecl) -+ if (ti->tempdecl) -+ return true; -+ -+ Expression *e = new DotIdExp(loc, e1, ti->name); -+ e = e->semantic(sc); -+ if (e->op == TOKdotexp) -+ e = ((DotExp *)e)->e2; -+ -+ Dsymbol *s = NULL; -+ switch (e->op) - { -- Expression *e = new DotIdExp(loc, e1, ti->name); -- e = e->semantic(sc); -- if (e->op == TOKdottd) -- { -- DotTemplateExp *dte = (DotTemplateExp *)e; -- ti->tempdecl = dte->td; -- } -- else if (e->op == TOKimport) -- { ScopeExp *se = (ScopeExp *)e; -- ti->tempdecl = se->sds->isTemplateDeclaration(); -- } -+ case TOKoverloadset: s = ((OverExp *)e)->vars; break; -+ case TOKdottd: s = ((DotTemplateExp *)e)->td; break; -+ case TOKimport: s = ((ScopeExp *)e)->sds; break; -+ case TOKdotvar: s = ((DotVarExp *)e)->var; break; -+ case TOKvar: s = ((VarExp *)e)->var; break; -+ default: return false; - } -- return ti->tempdecl; -+ return ti->updateTemplateDeclaration(sc, s); - } - - Expression *DotTemplateInstanceExp::semantic(Scope *sc) - { -+#if LOGSEMANTIC -+ printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); -+#endif -+ - // Indicate we need to resolve by UFCS. -- return semantic(sc, 0); -+ Expression *e = semanticY(sc, 1); -+ if (!e) -+ e = resolveUFCSProperties(sc, this); -+ return e; - } --Expression *DotTemplateInstanceExp::semantic(Scope *sc, int flag) -+ -+// Resolve e1.ident!tiargs without seeing UFCS. -+// If flag == 1, stop "not a property" error and return NULL. -+Expression *DotTemplateInstanceExp::semanticY(Scope *sc, int flag) - { - #if LOGSEMANTIC -- printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); -+ printf("DotTemplateInstanceExpY::semantic('%s')\n", toChars()); - #endif - -- UnaExp::semantic(sc); -- if (e1->op == TOKerror) -- return e1; -- -- Expression *e; - DotIdExp *die = new DotIdExp(loc, e1, ti->name); - -- if (flag || !e1->type || e1->op == TOKtype || -- (e1->op == TOKimport && ((ScopeExp *)e1)->sds->isModule())) -- { -- e = die->semantic(sc, 1); -- } -- else -+ Expression *e = die->semanticX(sc); -+ if (e == die) - { -+ e1 = die->e1; // take back -+ - Type *t1b = e1->type->toBasetype(); - if (t1b->ty == Tarray || t1b->ty == Tsarray || t1b->ty == Taarray || - t1b->ty == Tnull || (t1b->isTypeBasic() && t1b->ty != Tvoid)) - { -- /* No built-in type has templatized property, so can short cut. -+ /* No built-in type has templatized properties, so do shortcut. -+ * It is necessary in: 1024.max!"a < b" - */ -- return resolveUFCSProperties(sc, this); -+ if (flag) -+ return NULL; - } -- -- unsigned errors = global.startGagging(); -- e = die->semantic(sc, 1); -- Type *t = e1->type; -- if (global.endGagging(errors)) -+ e = die->semanticY(sc, flag); -+ if (flag && e && isDotOpDispatch(e)) - { -- errors = global.startGagging(); -- e = resolveUFCSProperties(sc, this); -- if (!global.endGagging(errors)) -- return e; -- -- // both lookups failed, lookup property again for better error message -- e->type = t; // restore type -- e = die->semantic(sc, 1); -+ /* opDispatch!tiargs would be a function template that needs IFTI, -+ * so it's not a template -+ */ -+ e = NULL; /* fall down to UFCS */ - } -+ if (flag && !e) -+ return NULL; - } -+ assert(e); - - L1: - if (e->op == TOKerror) - return e; -+ if (e->op == TOKdotvar) -+ { -+ DotVarExp *dve = (DotVarExp *)e; -+ FuncDeclaration *f = dve->var->isFuncDeclaration(); -+ if (f) -+ { -+ TemplateDeclaration *td = f->findTemplateDeclRoot(); -+ if (td) -+ { -+ e = new DotTemplateExp(dve->loc, dve->e1, td); -+ e = e->semantic(sc); -+ } -+ } -+ } -+ else if (e->op == TOKvar) -+ { -+ VarExp *ve = (VarExp *)e; -+ FuncDeclaration *f = ve->var->isFuncDeclaration(); -+ if (f) -+ { -+ TemplateDeclaration *td = f->findTemplateDeclRoot(); -+ if (td) -+ { -+ e = new ScopeExp(ve->loc, td); -+ e = e->semantic(sc); -+ } -+ } -+ } - if (e->op == TOKdottd) - { - if (ti->errors) - return new ErrorExp(); - DotTemplateExp *dte = (DotTemplateExp *)e; -- TemplateDeclaration *td = dte->td; - Expression *eleft = dte->e1; -- ti->tempdecl = td; -+ ti->tempdecl = dte->td; -+ if (!ti->semanticTiargs(sc)) -+ { -+ ti->inst = ti; -+ ti->inst->errors = true; -+ return new ErrorExp(); -+ } - if (ti->needsTypeInference(sc)) - { - e1 = eleft; // save result of semantic() -@@ -7327,7 +8307,7 @@ L1: - return new ErrorExp(); - Dsymbol *s = ti->inst->toAlias(); - Declaration *v = s->isDeclaration(); -- if (v) -+ if (v && (v->isFuncDeclaration() || v->isVarDeclaration())) - { - /* Fix for Bugzilla 4003 - * The problem is a class template member function v returning a reference to the same -@@ -7352,6 +8332,12 @@ L1: - e = e->semantic(sc); - return e; - } -+ if (eleft->op == TOKtype) -+ { -+ e = new DsymbolExp(loc, s); -+ e = e->semantic(sc); -+ return e; -+ } - e = new ScopeExp(loc, ti); - e = new DotExp(loc, eleft, e); - e = e->semantic(sc); -@@ -7371,9 +8357,39 @@ L1: - } - else if (e->op == TOKdotexp) - { DotExp *de = (DotExp *)e; -+ Expression *eleft = de->e1; - - if (de->e2->op == TOKoverloadset) - { -+ if (!findTempDecl(sc) || -+ !ti->semanticTiargs(sc)) -+ { -+ ti->inst = ti; -+ ti->inst->errors = true; -+ return new ErrorExp(); -+ } -+ if (ti->needsTypeInference(sc)) -+ { -+ e1 = eleft; -+ return this; -+ } -+ else -+ ti->semantic(sc); -+ if (!ti->inst) // if template failed to expand -+ return new ErrorExp(); -+ Dsymbol *s = ti->inst->toAlias(); -+ Declaration *v = s->isDeclaration(); -+ if (v) -+ { -+ if (v->type && !v->type->deco) -+ v->type = v->type->semantic(v->loc, sc); -+ e = new DotVarExp(loc, eleft, v); -+ e = e->semantic(sc); -+ return e; -+ } -+ e = new ScopeExp(loc, ti); -+ e = new DotExp(loc, eleft, e); -+ e = e->semantic(sc); - return e; - } - -@@ -7396,6 +8412,14 @@ L1: - goto Lerr; - goto L1; - } -+ else if (e->op == TOKoverloadset) -+ { -+ OverExp *oe = (OverExp *)e; -+ ti->tempdecl = oe->vars; -+ e = new ScopeExp(loc, ti); -+ e = e->semantic(sc); -+ return e; -+ } - Lerr: - error("%s isn't a template", e->toChars()); - return new ErrorExp(); -@@ -7410,7 +8434,7 @@ void DotTemplateInstanceExp::toCBuffer(O - - /************************************************************/ - --DelegateExp::DelegateExp(Loc loc, Expression *e, FuncDeclaration *f, int hasOverloads) -+DelegateExp::DelegateExp(Loc loc, Expression *e, FuncDeclaration *f, bool hasOverloads) - : UnaExp(loc, TOKdelegate, sizeof(DelegateExp), e) - { - this->func = f; -@@ -7517,136 +8541,13 @@ Expression *CallExp::syntaxCopy() - return new CallExp(loc, e1->syntaxCopy(), arraySyntaxCopy(arguments)); - } - -- --Expression *CallExp::resolveUFCS(Scope *sc) --{ -- Expression *e; -- Identifier *ident; -- Objects *tiargs; -- -- if (e1->op == TOKdot) -- { -- DotIdExp *die = (DotIdExp *)e1; -- e = (die->e1 = die->e1->semantic(sc)); -- ident = die->ident; -- tiargs = NULL; -- } -- else if (e1->op == TOKdotti) -- { -- DotTemplateInstanceExp *dti = (DotTemplateInstanceExp *)e1; -- e = (dti->e1 = dti->e1->semantic(sc)); -- ident = dti->ti->name; -- tiargs = dti->ti->tiargs; -- } -- else -- return NULL; -- -- if (e->op == TOKerror || !e->type) -- return NULL; -- -- if (e->op == TOKtype || e->op == TOKimport || e->op == TOKdotexp) -- return NULL; -- -- e = resolveProperties(sc, e); -- -- Type *t = e->type->toBasetype(); -- //printf("resolveUCSS %s, e = %s, %s, %s\n", -- // toChars(), Token::toChars(e->op), t->toChars(), e->toChars()); -- if (t->ty == Taarray) -- { -- if (tiargs) -- { -- goto Lshift; -- } -- else if (ident == Id::remove) -- { -- /* Transform: -- * aa.remove(arg) into delete aa[arg] -- */ -- if (!arguments || arguments->dim != 1) -- { error("expected key as argument to aa.remove()"); -- return new ErrorExp(); -- } -- if (!e->type->isMutable()) -- { error("cannot remove key from %s associative array %s", MODtoChars(e->type->mod), e->toChars()); -- return new ErrorExp(); -- } -- Expression *key = (*arguments)[0]; -- key = key->semantic(sc); -- key = resolveProperties(sc, key); -- -- TypeAArray *taa = (TypeAArray *)t; -- key = key->implicitCastTo(sc, taa->index); -- -- if (!key->rvalue()) -- return new ErrorExp(); -- -- return new RemoveExp(loc, e, key); -- } -- else if (ident == Id::apply || ident == Id::applyReverse) -- { -- return NULL; -- } -- else -- { TypeAArray *taa = (TypeAArray *)t; -- assert(taa->ty == Taarray); -- StructDeclaration *sd = taa->getImpl(); -- Dsymbol *s = sd->search(0, ident, 2); -- if (s) -- return NULL; -- goto Lshift; -- } -- } -- else if (t->ty == Tarray || t->ty == Tsarray || -- t->ty == Tnull || (t->isTypeBasic() && t->ty != Tvoid)) -- { -- /* In basic, built-in types don't have normal and templatized -- * member functions. So can short cut. -- */ --Lshift: -- if (!arguments) -- arguments = new Expressions(); -- arguments->shift(e); -- if (!tiargs) -- { -- /* Transform: -- * array.id(args) into .id(array,args) -- */ -- e1 = new DotIdExp(e1->loc, -- new IdentifierExp(e1->loc, Id::empty), -- ident); -- } -- else -- { -- /* Transform: -- * array.foo!(tiargs)(args) into .foo!(tiargs)(array,args) -- */ -- e1 = new DotTemplateInstanceExp(e1->loc, -- new IdentifierExp(e1->loc, Id::empty), -- ident, tiargs); -- } -- } -- else -- { -- DotIdExp *die = new DotIdExp(e->loc, e, ident); -- -- unsigned errors = global.startGagging(); -- Expression *ex = die->semantic(sc, 1); -- if (global.endGagging(errors)) -- { -- goto Lshift; -- } -- } -- return NULL; --} -- - Expression *CallExp::semantic(Scope *sc) - { - Type *t1; - int istemp; -- Objects *targsi = NULL; // initial list of template arguments -- TemplateInstance *tierror = NULL; -+ Objects *tiargs = NULL; // initial list of template arguments - Expression *ethis = NULL; -+ Type *tthis = NULL; - - #if LOGSEMANTIC - printf("CallExp::semantic() %s\n", toChars()); -@@ -7663,10 +8564,10 @@ Expression *CallExp::semantic(Scope *sc) - #endif - - if (e1->op == TOKcomma) -- { /* Rewrite (a,b)(args) as (a,(b(args))) -+ { -+ /* Rewrite (a,b)(args) as (a,(b(args))) - */ - CommaExp *ce = (CommaExp *)e1; -- - e1 = ce->e2; - e1->type = ce->type; - ce->e2 = this; -@@ -7675,15 +8576,15 @@ Expression *CallExp::semantic(Scope *sc) - } - - if (e1->op == TOKdelegate) -- { DelegateExp *de = (DelegateExp *)e1; -- -+ { -+ DelegateExp *de = (DelegateExp *)e1; - e1 = new DotVarExp(de->loc, de->e1, de->func); - return semantic(sc); - } - - if (e1->op == TOKfunction) -- { FuncExp *fe = (FuncExp *)e1; -- -+ { -+ FuncExp *fe = (FuncExp *)e1; - arguments = arrayExpressionSemantic(arguments, sc); - preFunctionParameters(loc, sc, arguments); - e1 = fe->semantic(sc, arguments); -@@ -7691,7 +8592,7 @@ Expression *CallExp::semantic(Scope *sc) - return e1; - } - -- Expression *e = resolveUFCS(sc); -+ Expression *e = resolveUFCS(sc, this); - if (e) - return e; - -@@ -7706,21 +8607,29 @@ Expression *CallExp::semantic(Scope *sc) - /* Attempt to instantiate ti. If that works, go with it. - * If not, go with partial explicit specialization. - */ -- unsigned olderrors = global.errors; -- ti->semanticTiargs(sc); -- if (olderrors != global.errors) -+ if (!ti->findTemplateDeclaration(sc) || -+ !ti->semanticTiargs(sc)) -+ { -+ ti->inst = ti; -+ ti->inst->errors = true; - return new ErrorExp(); -- if (ti->needsTypeInference(sc)) -+ } -+ if (ti->needsTypeInference(sc, 1)) - { - /* Go with partial explicit specialization - */ -- targsi = ti->tiargs; -- tierror = ti; // for error reporting -- e1 = new IdentifierExp(loc, ti->name); -+ tiargs = ti->tiargs; -+ assert(ti->tempdecl); -+ if (TemplateDeclaration *td = ti->tempdecl->isTemplateDeclaration()) -+ e1 = new TemplateExp(loc, td); -+ else -+ e1 = new OverExp(loc, ti->tempdecl->isOverloadSet()); - } - else - { - ti->semantic(sc); -+ if (ti->errors) -+ e1 = new ErrorExp(); - } - } - } -@@ -7737,18 +8646,23 @@ Ldotti: - /* Attempt to instantiate ti. If that works, go with it. - * If not, go with partial explicit specialization. - */ -- ti->semanticTiargs(sc); -- if (!ti->tempdecl) -+ if (!se->findTempDecl(sc) || -+ !ti->semanticTiargs(sc)) - { -- se->getTempdecl(sc); -+ ti->inst = ti; -+ ti->inst->errors = true; -+ return new ErrorExp(); - } -- if (ti->tempdecl && ti->needsTypeInference(sc)) -+ if (ti->needsTypeInference(sc, 1)) - { - /* Go with partial explicit specialization - */ -- targsi = ti->tiargs; -- tierror = ti; // for error reporting -- e1 = new DotIdExp(loc, se->e1, ti->name); -+ tiargs = ti->tiargs; -+ assert(ti->tempdecl); -+ if (TemplateDeclaration *td = ti->tempdecl->isTemplateDeclaration()) -+ e1 = new DotTemplateExp(loc, se->e1, td); -+ else -+ e1 = new DotExp(loc, se->e1, new OverExp(loc, ti->tempdecl->isOverloadSet())); - } - else - { -@@ -7828,6 +8742,7 @@ Lagain: - if (de->e2->op == TOKoverloadset) - { - ethis = de->e1; -+ tthis = de->e1->type; - e1 = de->e2; - } - -@@ -7849,23 +8764,30 @@ Lagain: - if (e1->type) - t1 = e1->type->toBasetype(); - -+ arguments = arrayExpressionSemantic(arguments, sc); -+ preFunctionParameters(loc, sc, arguments); -+ - // Check for call operator overload - if (t1) -- { AggregateDeclaration *ad; -- -+ { -+ AggregateDeclaration *ad; - if (t1->ty == Tstruct) - { - ad = ((TypeStruct *)t1)->sym; - #if DMDV2 - -- if (ad->sizeok == SIZEOKnone && !ad->ctor && -- ad->search(0, Id::ctor, 0)) -+ if (ad->sizeok == SIZEOKnone) - { -- // The constructor hasn't been found yet, see bug 8741 -- // This can happen if we are inferring type from -- // from VarDeclaration::semantic() in declaration.c -- error("cannot create a struct until its size is determined"); -- return new ErrorExp(); -+ if (ad->scope) -+ ad->semantic(ad->scope); -+ else if (!ad->ctor && ad->search(Loc(), Id::ctor, 0)) -+ { -+ // The constructor hasn't been found yet, see bug 8741 -+ // This can happen if we are inferring type from -+ // from VarDeclaration::semantic() in declaration.c -+ error("cannot create a struct until its size is determined"); -+ return new ErrorExp(); -+ } - } - - // First look for constructor -@@ -7877,26 +8799,32 @@ Lagain: - ExpInitializer *ei = NULL; - if (t1->needsNested()) - { -- Expressions *args = new Expressions(); -- StructLiteralExp *se = new StructLiteralExp(loc, (StructDeclaration *)ad, args); -- se->ctorinit = 1; -- ei = new ExpInitializer(loc, se); -+ StructLiteralExp *sle = new StructLiteralExp(loc, (StructDeclaration *)ad, NULL, e1->type); -+ Expression *e = sle->fill(true); -+ if (e->op == TOKerror) -+ return e; -+ sle->type = type; -+ ei = new ExpInitializer(loc, sle); - } -- - VarDeclaration *tmp = new VarDeclaration(loc, t1, idtmp, ei); - tmp->storage_class |= STCctfe; -- Expression *av = new DeclarationExp(loc, tmp); -- av = new CommaExp(loc, av, new VarExp(loc, tmp)); - -- Expression *e; -- CtorDeclaration *cf = ad->ctor->isCtorDeclaration(); -- if (cf) -- e = new DotVarExp(loc, av, cf, 1); -- else -- { TemplateDeclaration *td = ad->ctor->isTemplateDeclaration(); -- assert(td); -- e = new DotTemplateExp(loc, av, td); -+ Expression *e = new DeclarationExp(loc, tmp); -+ e = new CommaExp(loc, e, new VarExp(loc, tmp)); -+ if (CtorDeclaration *cf = ad->ctor->isCtorDeclaration()) -+ { -+ e = new DotVarExp(loc, e, cf, 1); -+ } -+ else if (TemplateDeclaration *td = ad->ctor->isTemplateDeclaration()) -+ { -+ e = new DotTemplateExp(loc, e, td); - } -+ else if (OverloadSet *os = ad->ctor->isOverloadSet()) -+ { -+ e = new DotExp(loc, e, new OverExp(loc, os)); -+ } -+ else -+ assert(0); - e = new CallExp(loc, e, arguments); - e = e->semantic(sc); - return e; -@@ -7908,8 +8836,10 @@ Lagain: - - if (e1->op != TOKtype) - { -- if (ad->aliasthis) -+ if (ad->aliasthis && e1->type != att1) - { -+ if (!att1 && e1->type->checkAliasThisRec()) -+ att1 = e1->type; - e1 = resolveAliasThis(sc, e1); - goto Lagain; - } -@@ -7936,9 +8866,6 @@ Lagain: - } - } - -- arguments = arrayExpressionSemantic(arguments, sc); -- preFunctionParameters(loc, sc, arguments); -- - // If there was an error processing any argument, or the call, - // return an error without trying to resolve the function call. - if (arguments && arguments->dim) -@@ -7954,10 +8881,10 @@ Lagain: - - // If there was an error processing any template argument, - // return an error without trying to resolve the template. -- if (targsi && targsi->dim) -+ if (tiargs && tiargs->dim) - { -- for (size_t k = 0; k < targsi->dim; k++) -- { Object *o = (*targsi)[k]; -+ for (size_t k = 0; k < tiargs->dim; k++) -+ { RootObject *o = (*tiargs)[k]; - if (isError(o)) - return new ErrorExp(); - } -@@ -7972,6 +8899,7 @@ Lagain: - UnaExp *ue = (UnaExp *)(e1); - - Expression *ue1 = ue->e1; -+ Expression *ue1old = ue1; // need for 'right this' check - VarDeclaration *v; - if (ue1->op == TOKvar && - (v = ((VarExp *)ue1)->var->isVarDeclaration()) != NULL && -@@ -7981,34 +8909,31 @@ Lagain: - ue1 = NULL; - } - -+ Dsymbol *s; - if (e1->op == TOKdotvar) -- { // Do overload resolution -+ { - dve = (DotVarExp *)(e1); -- -- f = dve->var->isFuncDeclaration(); -- assert(f); -- f = f->overloadResolve(loc, ue1, arguments); -- -- ad = f->toParent()->isAggregateDeclaration(); -+ s = dve->var; -+ tiargs = NULL; - } - else - { dte = (DotTemplateExp *)(e1); -- TemplateDeclaration *td = dte->td; -- assert(td); -- if (!arguments) -- // Should fix deduceFunctionTemplate() so it works on NULL argument -- arguments = new Expressions(); -- f = td->deduceFunctionTemplate(sc, loc, targsi, ue1, arguments); -- if (!f) -- return new ErrorExp(); -- ad = td->toParent()->isAggregateDeclaration(); -+ s = dte->td; - } -+ -+ // Do overload resolution -+ f = resolveFuncCall(loc, sc, s, tiargs, ue1 ? ue1->type : NULL, arguments); -+ if (!f) -+ return new ErrorExp(); -+ ad = f->toParent2()->isAggregateDeclaration(); -+ - if (f->needThis()) - { - ue->e1 = getRightThis(loc, sc, ad, ue->e1, f); - if (ue->e1->op == TOKerror) - return ue->e1; - ethis = ue->e1; -+ tthis = ue->e1->type; - } - - /* Cannot call public functions from inside invariant -@@ -8040,6 +8965,7 @@ Lagain: - } - else - { -+ checkRightThis(sc, ue1old); - if (e1->op == TOKdotvar) - { - dve->var = f; -@@ -8049,6 +8975,8 @@ Lagain: - { - e1 = new DotVarExp(loc, dte->e1, f); - e1 = e1->semantic(sc); -+ if (e1->op == TOKerror) -+ return new ErrorExp(); - ue = (UnaExp *)e1; - } - #if 0 -@@ -8102,7 +9030,8 @@ Lagain: - sc->callSuper |= CSXany_ctor | CSXsuper_ctor; - } - -- f = resolveFuncCall(sc, loc, cd->baseClass->ctor, NULL, NULL, arguments, 0); -+ tthis = cd->type->addMod(sc->func->type->mod); -+ f = resolveFuncCall(loc, sc, cd->baseClass->ctor, NULL, tthis, arguments, 0); - if (!f) - return new ErrorExp(); - accessCheck(loc, sc, NULL, f); -@@ -8142,7 +9071,8 @@ Lagain: - sc->callSuper |= CSXany_ctor | CSXthis_ctor; - } - -- f = resolveFuncCall(sc, loc, cd->ctor, NULL, NULL, arguments, 0); -+ tthis = cd->type->addMod(sc->func->type->mod); -+ f = resolveFuncCall(loc, sc, cd->ctor, NULL, tthis, arguments, 0); - if (!f) - return new ErrorExp(); - checkDeprecated(sc, f); -@@ -8169,16 +9099,9 @@ Lagain: - Dsymbol *s = NULL; - for (size_t i = 0; i < eo->vars->a.dim; i++) - { s = eo->vars->a[i]; -- FuncDeclaration *f2 = s->isFuncDeclaration(); -- if (f2) -- { -- f2 = f2->overloadResolve(loc, ethis, arguments, 1); -- } -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- assert(td); -- f2 = td->deduceFunctionTemplate(sc, loc, targsi, ethis, arguments, 1); -- } -+ if (tiargs && s->isFuncDeclaration()) -+ continue; -+ FuncDeclaration *f2 = resolveFuncCall(loc, sc, s, tiargs, tthis, arguments, 1); - if (f2) - { if (f) - /* Error if match in more than one overload set, -@@ -8210,6 +9133,7 @@ Lagain: - { - TypeFunction *tf; - const char *p; -+ f = NULL; - if (e1->op == TOKfunction) - { - // function literal that direct called is always inferred. -@@ -8217,11 +9141,10 @@ Lagain: - f = ((FuncExp *)e1)->fd; - tf = (TypeFunction *)f->type; - p = "function literal"; -- -- f->checkNestedReference(sc, loc); - } - else if (t1->ty == Tdelegate) -- { TypeDelegate *td = (TypeDelegate *)t1; -+ { -+ TypeDelegate *td = (TypeDelegate *)t1; - assert(td->next->ty == Tfunction); - tf = (TypeFunction *)(td->next); - p = "delegate"; -@@ -8234,12 +9157,9 @@ Lagain: - else if (e1->op == TOKtemplate) - { - TemplateExp *te = (TemplateExp *)e1; -- f = te->td->deduceFunctionTemplate(sc, loc, targsi, NULL, arguments); -+ f = resolveFuncCall(loc, sc, te->td, tiargs, NULL, arguments); - if (!f) -- { if (tierror) -- tierror->error("errors instantiating template"); // give better error message - return new ErrorExp(); -- } - if (f->needThis()) - { - if (hasThis(sc)) -@@ -8250,9 +9170,9 @@ Lagain: - e1 = new DotTemplateExp(loc, (new ThisExp(loc))->semantic(sc), te->td); - goto Lagain; - } -- else if (!sc->intypeof && !sc->getStructClassScope()) -+ else if (isNeedThisScope(sc, f)) - { -- error("need 'this' for %s type %s", f->toChars(), f->type->toChars()); -+ error("need 'this' for '%s' of type '%s'", f->toChars(), f->type->toChars()); - return new ErrorExp(); - } - } -@@ -8261,19 +9181,9 @@ Lagain: - goto Lagain; - } - else -- { error("function expected before (), not %s of type %s", e1->toChars(), e1->type->toChars()); -- return new ErrorExp(); -- } -- -- if (sc->func && !tf->purity && !(sc->flags & SCOPEdebug)) -- { -- if (sc->func->setImpure()) -- error("pure function '%s' cannot call impure %s '%s'", sc->func->toPrettyChars(), p, e1->toChars()); -- } -- if (sc->func && tf->trust <= TRUSTsystem) - { -- if (sc->func->setUnsafe()) -- error("safe function '%s' cannot call system %s '%s'", sc->func->toPrettyChars(), p, e1->toChars()); -+ error("function expected before (), not %s of type %s", e1->toChars(), e1->type->toChars()); -+ return new ErrorExp(); - } - - if (!tf->callMatch(NULL, arguments)) -@@ -8287,8 +9197,8 @@ Lagain: - - argExpTypesToCBuffer(&buf, arguments, &hgs); - buf.writeByte(')'); -- if (ethis) -- ethis->type->modToBuffer(&buf); -+ if (tthis) -+ tthis->modToBuffer(&buf); - } - else - buf.writeByte(')'); -@@ -8301,6 +9211,29 @@ Lagain: - return new ErrorExp(); - } - -+ // Purity and safety check should run after testing arguments matching -+ if (f) -+ { -+#if DMDV2 -+ checkPurity(sc, f); -+ checkSafety(sc, f); -+#endif -+ f->checkNestedReference(sc, loc); -+ } -+ else if (sc->func && !(sc->flags & SCOPEctfe)) -+ { -+ if (!tf->purity && !(sc->flags & SCOPEdebug) && sc->func->setImpure()) -+ { -+ error("pure function '%s' cannot call impure %s '%s'", sc->func->toPrettyChars(), p, e1->toChars()); -+ return new ErrorExp(); -+ } -+ if (tf->trust <= TRUSTsystem && sc->func->setUnsafe()) -+ { -+ error("safe function '%s' cannot call system %s '%s'", sc->func->toPrettyChars(), p, e1->toChars()); -+ return new ErrorExp(); -+ } -+ } -+ - if (t1->ty == Tpointer) - { - Expression *e = new PtrExp(loc, e1); -@@ -8316,11 +9249,13 @@ Lagain: - - f = ve->var->isFuncDeclaration(); - assert(f); -+ tiargs = NULL; - - if (ve->hasOverloads) -- f = f->overloadResolve(loc, NULL, arguments, 2); -+ f = resolveFuncCall(loc, sc, f, tiargs, NULL, arguments, 2); - else - { -+ f = f->toAliasFunc(); - TypeFunction *tf = (TypeFunction *)f->type; - if (!tf->callMatch(NULL, arguments)) - { -@@ -8343,6 +9278,8 @@ Lagain: - return new ErrorExp(); - } - } -+ if (!f) -+ return new ErrorExp(); - - if (f->needThis()) - { -@@ -8354,9 +9291,9 @@ Lagain: - e1 = new DotVarExp(loc, (new ThisExp(loc))->semantic(sc), ve->var); - goto Lagain; - } -- else if (!sc->intypeof && !sc->getStructClassScope()) -+ else if (isNeedThisScope(sc, f)) - { -- error("need 'this' for %s type %s", f->toChars(), f->type->toChars()); -+ error("need 'this' for '%s' of type '%s'", f->toChars(), f->type->toChars()); - return new ErrorExp(); - } - } -@@ -8370,10 +9307,13 @@ Lagain: - accessCheck(loc, sc, NULL, f); - - ethis = NULL; -+ tthis = NULL; - -- ve->var = f; --// ve->hasOverloads = 0; -- ve->type = f->type; -+ if (ve->hasOverloads) -+ { -+ e1 = new VarExp(ve->loc, f, 0); -+ e1->type = f->type; -+ } - t1 = f->type; - } - assert(t1->ty == Tfunction); -@@ -8382,7 +9322,7 @@ Lagain: - if (!arguments) - arguments = new Expressions(); - int olderrors = global.errors; -- type = functionParameters(loc, sc, tf, ethis, arguments, f); -+ type = functionParameters(loc, sc, tf, tthis, arguments, f); - if (olderrors != global.errors) - return new ErrorExp(); - -@@ -8405,6 +9345,13 @@ Lagain: - } - } - -+ // Handle the case of a direct lambda call -+ if (f && f->isFuncLiteralDeclaration() && -+ sc->func && !sc->intypeof) -+ { -+ f->tookAddressOf = 0; -+ } -+ - return this; - } - -@@ -8445,16 +9392,14 @@ Expression *CallExp::addDtorHook(Scope * - return this; - } - -- Type *tv = type->toBasetype(); -- while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- tv = tv->nextOf()->toBasetype(); -- } -+ Type *tv = type->baseElemOf(); - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (sd->dtor) -- { /* Type needs destruction, so declare a tmp -+ { -+ /* Type needs destruction, so declare a tmp - * which the back end will recognize and call dtor on - */ - Identifier *idtmp = Lexer::uniqueId("__tmpfordtor"); -@@ -8466,7 +9411,6 @@ Expression *CallExp::addDtorHook(Scope * - return e; - } - } --Lnone: - return this; - } - -@@ -8502,10 +9446,42 @@ Expression *AddrExp::semantic(Scope *sc) - if (!type) - { - UnaExp::semantic(sc); -- Expression *olde1 = e1; - if (e1->type == Type::terror) - return new ErrorExp(); - int wasCond = e1->op == TOKquestion; -+ if (e1->op == TOKdotti) -+ { -+ DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1; -+ TemplateInstance *ti = dti->ti; -+ if (!ti->semanticRun) -+ { -+ //assert(ti->needsTypeInference(sc)); -+ ti->semantic(sc); -+ if (!ti->inst) // if template failed to expand -+ return new ErrorExp; -+ Dsymbol *s = ti->inst->toAlias(); -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ assert(f); -+ e1 = new DotVarExp(e1->loc, dti->e1, f); -+ e1 = e1->semantic(sc); -+ } -+ } -+ else if (e1->op == TOKimport) -+ { -+ TemplateInstance *ti = ((ScopeExp *)e1)->sds->isTemplateInstance(); -+ if (ti && !ti->semanticRun) -+ { -+ //assert(ti->needsTypeInference(sc)); -+ ti->semantic(sc); -+ if (!ti->inst) // if template failed to expand -+ return new ErrorExp; -+ Dsymbol *s = ti->inst->toAlias(); -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ assert(f); -+ e1 = new VarExp(e1->loc, f); -+ e1 = e1->semantic(sc); -+ } -+ } - e1 = e1->toLvalue(sc, NULL); - if (e1->op == TOKerror) - return e1; -@@ -8541,9 +9517,9 @@ Expression *AddrExp::semantic(Scope *sc) - { - DotVarExp *dve = (DotVarExp *)e1; - FuncDeclaration *f = dve->var->isFuncDeclaration(); -- - if (f) - { -+ f = f->toAliasFunc(); // FIXME, should see overlods - Bugzilla 1983 - if (!dve->hasOverloads) - f->tookAddressOf++; - -@@ -8581,7 +9557,6 @@ Expression *AddrExp::semantic(Scope *sc) - } - - FuncDeclaration *f = ve->var->isFuncDeclaration(); -- - if (f) - { - if (!ve->hasOverloads || -@@ -8637,6 +9612,7 @@ Expression *AddrExp::semantic(Scope *sc) - ce->e2->type = NULL; - ce->e2 = ce->e2->semantic(sc); - } -+ - return optimize(WANTvalue); - } - return this; -@@ -8827,6 +9803,8 @@ Expression *NotExp::semantic(Scope *sc) - UnaExp::semantic(sc); - e1 = resolveProperties(sc, e1); - e1 = e1->checkToBoolean(sc); -+ if (e1->type == Type::terror) -+ return e1; - type = Type::tboolean; - } - return this; -@@ -8854,6 +9832,8 @@ Expression *BoolExp::semantic(Scope *sc) - UnaExp::semantic(sc); - e1 = resolveProperties(sc, e1); - e1 = e1->checkToBoolean(sc); -+ if (e1->type == Type::terror) -+ return e1; - type = Type::tboolean; - } - return this; -@@ -8928,7 +9908,7 @@ Expression *DeleteExp::semantic(Scope *s - - if (fd) - { Expression *e = ea ? new VarExp(loc, v) : e1; -- e = new DotVarExp(0, e, fd, 0); -+ e = new DotVarExp(Loc(), e, fd, 0); - eb = new CallExp(loc, e); - eb = eb->semantic(sc); - } -@@ -9026,10 +10006,10 @@ Expression *CastExp::semantic(Scope *sc) - if (type) - return this; - UnaExp::semantic(sc); -+ e1 = resolveProperties(sc, e1); -+ - if (e1->type) // if not a tuple - { -- e1 = resolveProperties(sc, e1); -- - if (!to) - { - /* Handle cast(const) and cast(immutable), etc. -@@ -9048,6 +10028,10 @@ Expression *CastExp::semantic(Scope *sc) - if (e1->type->ty == Terror) - return new ErrorExp(); - -+ // cast(void) is used to mark e1 as unused, so it is safe -+ if (to->ty == Tvoid) -+ goto Lsafe; -+ - if (!to->equals(e1->type)) - { - Expression *e = op_overload(sc); -@@ -9089,15 +10073,19 @@ Expression *CastExp::semantic(Scope *sc) - if (tob->ty == Tstruct || t1b->ty == Tstruct || - (tob->ty == Tsarray && t1b->ty == Tsarray)) - { -- size_t fromsize = t1b->size(loc); -- size_t tosize = tob->size(loc); -- if (fromsize != tosize) -+ if (t1b->ty == Tnull || tob->ty == Tnull || t1b->size(loc) != tob->size(loc)) - { - error("cannot cast from %s to %s", e1->type->toChars(), to->toChars()); - return new ErrorExp(); - } - } - -+ if ((t1b->ty == Tarray || t1b->ty == Tsarray) && tob->ty == Tclass) -+ { -+ error("cannot cast from %s to %s", e1->type->toChars(), to->toChars()); -+ return new ErrorExp(); -+ } -+ - // Look for casting to a vector type - if (tob->ty == Tvector && t1b->ty != Tvector) - { -@@ -9105,7 +10093,19 @@ Expression *CastExp::semantic(Scope *sc) - } - - if (tob->isintegral() && t1b->ty == Tarray) -- deprecation("casting %s to %s is deprecated", e1->type->toChars(), to->toChars()); -+ { -+ error("cannot cast %s to integral type %s", e1->toChars(), to->toChars()); -+ return new ErrorExp(); -+ } -+ -+ if (tob->ty == Tpointer && t1b->ty == Tdelegate) -+ deprecation("casting from %s to %s is deprecated", e1->type->toChars(), to->toChars()); -+ -+ if (t1b->ty == Tvoid && tob->ty != Tvoid && e1->op != TOKfunction) -+ { -+ error("cannot cast %s of type %s to %s", e1->toChars(), e1->type->toChars(), to->toChars()); -+ return new ErrorExp(); -+ } - } - else if (!to) - { error("cannot cast tuple"); -@@ -9164,7 +10164,10 @@ Expression *CastExp::semantic(Scope *sc) - { - Type* tobn = tob->nextOf()->toBasetype(); - Type* t1bn = t1b->nextOf()->toBasetype(); -- if (!tobn->hasPointers() && -+ // If the struct is opaque we don't know about the struct members and the cast becomes unsafe -+ bool sfwrd = tobn->ty == Tstruct && !((StructDeclaration *)((TypeStruct *)tobn)->sym)->members || -+ t1bn->ty == Tstruct && !((StructDeclaration *)((TypeStruct *)t1bn)->sym)->members; -+ if (!sfwrd && !tobn->hasPointers() && - tobn->ty != Tfunction && t1bn->ty != Tfunction && - tobn->size() <= t1bn->size() && - MODimplicitConv(t1bn->mod, tobn->mod)) -@@ -9179,6 +10182,16 @@ Expression *CastExp::semantic(Scope *sc) - } - - Lsafe: -+#if DMDV2 -+ /* Instantiate AA implementations during semantic analysis. -+ */ -+ Type *tfrom = e1->type->toBasetype(); -+ Type *t = to->toBasetype(); -+ if (tfrom->ty == Taarray) -+ ((TypeAArray *)tfrom)->getImpl(); -+ if (t->ty == Taarray) -+ ((TypeAArray *)t)->getImpl(); -+#endif - Expression *e = e1->castTo(sc, to); - return e; - } -@@ -9309,6 +10322,26 @@ Lagain: - e = new TypeExp(loc, e1->type->arrayOf()); - return e->semantic(sc); - } -+ if (!lwr && !upr) -+ { -+ if (e1->op == TOKarrayliteral) -+ { // Convert [a,b,c][] to [a,b,c] -+ Type *t1b = e1->type->toBasetype(); -+ Expression *e = e1; -+ if (t1b->ty == Tsarray) -+ { -+ e = e->copy(); -+ e->type = t1b->nextOf()->arrayOf(); -+ } -+ return e; -+ } -+ if (e1->op == TOKslice) -+ { // Convert e[][] to e[] -+ SliceExp *se = (SliceExp *)e1; -+ if (!se->lwr && !se->upr) -+ return se; -+ } -+ } - - e = this; - -@@ -9319,6 +10352,8 @@ Lagain: - { error("need upper and lower bound to slice pointer"); - return new ErrorExp(); - } -+ if (sc->func && !sc->intypeof && sc->func->setUnsafe()) -+ error("pointer slicing not allowed in safe functions"); - } - else if (t->ty == Tarray) - { -@@ -9339,20 +10374,24 @@ Lagain: - if (search_function(ad, Id::slice)) - { - // Rewrite as e1.slice(lwr, upr) -- SliceExp *se = resolveOpDollar(sc, this); -+ Expression *e0 = resolveOpDollar(sc, this); - Expressions *a = new Expressions(); -- assert(!se->lwr || se->upr); -- if (se->lwr) -- { a->push(se->lwr); -- a->push(se->upr); -+ assert(!lwr || upr); -+ if (lwr) -+ { -+ a->push(lwr); -+ a->push(upr); - } -- e = new DotIdExp(loc, se->e1, Id::slice); -+ e = new DotIdExp(loc, e1, Id::slice); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } -- if (ad->aliasthis) -+ if (ad->aliasthis && e1->type != att1) - { -+ if (!att1 && e1->type->checkAliasThisRec()) -+ att1 = e1->type; - e1 = resolveAliasThis(sc, e1); - goto Lagain; - } -@@ -9383,15 +10422,21 @@ Lagain: - } - - if (lwr) -- { lwr = lwr->semantic(sc2); -+ { -+ if (t->ty == Ttuple) sc2 = sc2->startCTFE(); -+ lwr = lwr->semantic(sc2); - lwr = resolveProperties(sc2, lwr); -+ if (t->ty == Ttuple) sc2 = sc2->endCTFE(); - lwr = lwr->implicitCastTo(sc2, Type::tsize_t); - if (lwr->type == Type::terror) - goto Lerr; - } - if (upr) -- { upr = upr->semantic(sc2); -+ { -+ if (t->ty == Ttuple) sc2 = sc2->startCTFE(); -+ upr = upr->semantic(sc2); - upr = resolveProperties(sc2, upr); -+ if (t->ty == Ttuple) sc2 = sc2->endCTFE(); - upr = upr->implicitCastTo(sc2, Type::tsize_t); - if (upr->type == Type::terror) - goto Lerr; -@@ -9434,13 +10479,7 @@ Lagain: - { Expression *e = (*te->exps)[j1 + i]; - (*exps)[i] = e; - } -- if (j1 > 0 && j1 != j2 && sc->func && (*te->exps)[0]->op == TOKdotvar) -- { -- Expression *einit = ((DotVarExp *)(*te->exps)[0])->e1->isTemp(); -- if (einit) -- ((DotVarExp *)(*exps)[0])->e1 = einit; -- } -- e = new TupleExp(loc, exps); -+ e = new TupleExp(loc, te->e0, exps); - } - else - { Parameters *args = new Parameters; -@@ -9492,16 +10531,6 @@ void SliceExp::checkEscapeRef() - e1->checkEscapeRef(); - } - --int SliceExp::isLvalue() --{ -- return 1; --} -- --Expression *SliceExp::toLvalue(Scope *sc, Expression *e) --{ -- return this; --} -- - int SliceExp::checkModifiable(Scope *sc, int flag) - { - //printf("SliceExp::checkModifiable %s\n", toChars()); -@@ -9514,6 +10543,21 @@ int SliceExp::checkModifiable(Scope *sc, - return 1; - } - -+int SliceExp::isLvalue() -+{ -+ /* slice expression is rvalue in default, but -+ * conversion to reference of static array is only allowed. -+ */ -+ return (type && type->toBasetype()->ty == Tsarray); -+} -+ -+Expression *SliceExp::toLvalue(Scope *sc, Expression *e) -+{ -+ //printf("SliceExp::toLvalue(%s) type = %s\n", toChars(), type ? type->toChars() : NULL); -+ return (type && type->toBasetype()->ty == Tsarray) -+ ? this : Expression::toLvalue(sc, e); -+} -+ - Expression *SliceExp::modifiableLvalue(Scope *sc, Expression *e) - { - error("slice expression %s is not a modifiable lvalue", toChars()); -@@ -9532,14 +10576,14 @@ void SliceExp::toCBuffer(OutBuffer *buf, - if (upr || lwr) - { - if (lwr) -- expToCBuffer(buf, hgs, lwr, PREC_assign); -+ sizeToCBuffer(buf, hgs, lwr); - else - buf->writeByte('0'); - buf->writestring(".."); - if (upr) -- expToCBuffer(buf, hgs, upr, PREC_assign); -+ sizeToCBuffer(buf, hgs, upr); - else -- buf->writestring("length"); // BUG: should be array.length -+ buf->writestring("$"); - } - buf->writeByte(']'); - } -@@ -9566,7 +10610,7 @@ Expression *ArrayLengthExp::semantic(Sco - return this; - } - --Expression *opAssignToOp(Loc loc, enum TOK op, Expression *e1, Expression *e2) -+Expression *opAssignToOp(Loc loc, TOK op, Expression *e1, Expression *e2) - { Expression *e; - - switch (op) -@@ -9815,6 +10859,7 @@ IndexExp::IndexExp(Loc loc, Expression * - //printf("IndexExp::IndexExp('%s')\n", toChars()); - lengthVar = NULL; - modifiable = 0; // assume it is an rvalue -+ skipboundscheck = 0; - } - - Expression *IndexExp::syntaxCopy() -@@ -9865,8 +10910,10 @@ Expression *IndexExp::semantic(Scope *sc - sc = sc->push(sym); - } - -+ if (t1->ty == Ttuple) sc = sc->startCTFE(); - e2 = e2->semantic(sc); - e2 = resolveProperties(sc, e2); -+ if (t1->ty == Ttuple) sc = sc->endCTFE(); - if (e2->type == Type::terror) - goto Lerr; - if (e2->type->ty == Ttuple && ((TupleExp *)e2)->exps->dim == 1) // bug 4444 fix -@@ -9879,10 +10926,12 @@ Expression *IndexExp::semantic(Scope *sc - { - case Tpointer: - e2 = e2->implicitCastTo(sc, Type::tsize_t); -+ if (e2->type == Type::terror) -+ goto Lerr; - e2 = e2->optimize(WANTvalue); - if (e2->op == TOKint64 && e2->toInteger() == 0) - ; -- else if (sc->func->setUnsafe()) -+ else if (sc->func && sc->func->setUnsafe()) - { - error("safe function '%s' cannot index pointer '%s'", - sc->func->toPrettyChars(), e1->toChars()); -@@ -9893,12 +10942,16 @@ Expression *IndexExp::semantic(Scope *sc - - case Tarray: - e2 = e2->implicitCastTo(sc, Type::tsize_t); -+ if (e2->type == Type::terror) -+ goto Lerr; - e->type = ((TypeNext *)t1)->next; - break; - - case Tsarray: - { - e2 = e2->implicitCastTo(sc, Type::tsize_t); -+ if (e2->type == Type::terror) -+ goto Lerr; - TypeSArray *tsa = (TypeSArray *)t1; - e->type = t1->nextOf(); - break; -@@ -9920,6 +10973,8 @@ Expression *IndexExp::semantic(Scope *sc - case Ttuple: - { - e2 = e2->implicitCastTo(sc, Type::tsize_t); -+ if (e2->type == Type::terror) -+ goto Lerr; - e2 = e2->ctfeInterpret(); - uinteger_t index = e2->toUInteger(); - size_t length; -@@ -9944,12 +10999,7 @@ Expression *IndexExp::semantic(Scope *sc - if (e1->op == TOKtuple) - { - e = (*te->exps)[(size_t)index]; -- if (sc->func && (*te->exps)[0]->op == TOKdotvar) -- { -- Expression *einit = ((DotVarExp *)(*te->exps)[0])->e1->isTemp(); -- if (einit) -- ((DotVarExp *)e)->e1 = einit; -- } -+ e = combine(te->e0, e); - } - else - e = new TypeExp(e1->loc, Parameter::getNth(tup->arguments, (size_t)index)->type); -@@ -9971,6 +11021,21 @@ Expression *IndexExp::semantic(Scope *sc - case Terror: - goto Lerr; - } -+ -+ if (t1->ty == Tsarray || t1->ty == Tarray) -+ { -+ Expression *el = new ArrayLengthExp(loc, e1); -+ el = el->semantic(sc); -+ el = el->optimize(WANTvalue); -+ if (el->op == TOKint64) -+ { -+ e2 = e2->optimize(WANTvalue); -+ dinteger_t length = el->toInteger(); -+ if (length) -+ skipboundscheck = IntRange(SignExtendedNumber(0), SignExtendedNumber(length)).contains(e2->getIntRange()); -+ } -+ } -+ - return e; - - Lerr: -@@ -10021,14 +11086,14 @@ void IndexExp::toCBuffer(OutBuffer *buf, - { - expToCBuffer(buf, hgs, e1, PREC_primary); - buf->writeByte('['); -- expToCBuffer(buf, hgs, e2, PREC_assign); -+ sizeToCBuffer(buf, hgs, e2); - buf->writeByte(']'); - } - - - /************************* PostExp ***********************************/ - --PostExp::PostExp(enum TOK op, Loc loc, Expression *e) -+PostExp::PostExp(TOK op, Loc loc, Expression *e) - : BinExp(loc, op, sizeof(PostExp), e, - new IntegerExp(loc, 1, Type::tint32)) - { -@@ -10037,6 +11102,9 @@ PostExp::PostExp(enum TOK op, Loc loc, E - Expression *PostExp::semantic(Scope *sc) - { Expression *e = this; - -+#if LOGSEMANTIC -+ printf("PostExp::semantic('%s')\n", toChars()); -+#endif - if (!type) - { - BinExp::semantic(sc); -@@ -10053,6 +11121,7 @@ Expression *PostExp::semantic(Scope *sc) - return new ErrorExp(); - } - -+ e1 = e1->optimize(WANTvalue); - if (e1->op != TOKarraylength) - e1 = e1->modifiableLvalue(sc, e1); - -@@ -10118,7 +11187,7 @@ void PostExp::toCBuffer(OutBuffer *buf, - - /************************* PreExp ***********************************/ - --PreExp::PreExp(enum TOK op, Loc loc, Expression *e) -+PreExp::PreExp(TOK op, Loc loc, Expression *e) - : UnaExp(loc, op, sizeof(PreExp), e) - { - } -@@ -10185,10 +11254,11 @@ Expression *AssignExp::semantic(Scope *s - { - ArrayExp *ae = (ArrayExp *)e1; - AggregateDeclaration *ad = NULL; -- Identifier *id = Id::index; - - ae->e1 = ae->e1->semantic(sc); - ae->e1 = resolveProperties(sc, ae->e1); -+ Expression *ae1old = ae->e1; -+ - Type *t1 = ae->e1->type->toBasetype(); - if (t1->ty == Tstruct) - { -@@ -10203,47 +11273,53 @@ Expression *AssignExp::semantic(Scope *s - if (search_function(ad, Id::indexass)) - { - // Deal with $ -- ae = resolveOpDollar(sc, ae); -+ Expression *e0 = resolveOpDollar(sc, ae); - Expressions *a = (Expressions *)ae->arguments->copy(); - a->insert(0, e2); - - Expression *e = new DotIdExp(loc, ae->e1, Id::indexass); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - } - - // No opIndexAssign found yet, but there might be an alias this to try. -- if (ad && ad->aliasthis) -- { Expression *e = resolveAliasThis(sc, ae->e1); -- Type *t = e->type->toBasetype(); -- -- if (t->ty == Tstruct) -+ if (ad && ad->aliasthis && t1 != att1) -+ { -+ if (!att1 && t1->checkAliasThisRec()) -+ att1 = t1; -+ ae->e1 = resolveAliasThis(sc, ae->e1); -+ t1 = ae->e1->type->toBasetype(); -+ if (t1->ty == Tstruct) - { -- ad = ((TypeStruct *)t)->sym; -+ ad = ((TypeStruct *)t1)->sym; - goto L1; - } -- else if (t->ty == Tclass) -+ else if (t1->ty == Tclass) - { -- ad = ((TypeClass *)t)->sym; -+ ad = ((TypeClass *)t1)->sym; - goto L1; - } - } -+ -+ ae->e1 = ae1old; // restore - } - /* Look for operator overloading of a[i..j]=value. - * Do it before semantic() otherwise the a[i..j] will have been - * converted to a.opSlice() already. - */ - if (e1->op == TOKslice) -- { Type *t1; -+ { - SliceExp *ae = (SliceExp *)e1; - AggregateDeclaration *ad = NULL; -- Identifier *id = Id::index; - - ae->e1 = ae->e1->semantic(sc); - ae->e1 = resolveProperties(sc, ae->e1); -- t1 = ae->e1->type->toBasetype(); -+ Expression *ae1old = ae->e1; -+ -+ Type *t1 = ae->e1->type->toBasetype(); - if (t1->ty == Tstruct) - { - ad = ((TypeStruct *)t1)->sym; -@@ -10256,37 +11332,43 @@ Expression *AssignExp::semantic(Scope *s - // Rewrite (a[i..j] = value) to (a.opSliceAssign(value, i, j)) - if (search_function(ad, Id::sliceass)) - { -- ae = resolveOpDollar(sc, ae); -+ Expression *e0 = resolveOpDollar(sc, ae); - Expressions *a = new Expressions(); - a->push(e2); - assert(!ae->lwr || ae->upr); - if (ae->lwr) -- { a->push(ae->lwr); -+ { -+ a->push(ae->lwr); - a->push(ae->upr); - } - Expression *e = new DotIdExp(loc, ae->e1, Id::sliceass); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - } - - // No opSliceAssign found yet, but there might be an alias this to try. -- if (ad && ad->aliasthis) -- { Expression *e = resolveAliasThis(sc, ae->e1); -- Type *t = e->type->toBasetype(); -- -- if (t->ty == Tstruct) -+ if (ad && ad->aliasthis && t1 != att1) -+ { -+ if (!att1 && t1->checkAliasThisRec()) -+ att1 = t1; -+ ae->e1 = resolveAliasThis(sc, ae->e1); -+ t1 = ae->e1->type->toBasetype(); -+ if (t1->ty == Tstruct) - { -- ad = ((TypeStruct *)t)->sym; -+ ad = ((TypeStruct *)t1)->sym; - goto L2; - } -- else if (t->ty == Tclass) -+ else if (t1->ty == Tclass) - { -- ad = ((TypeClass *)t)->sym; -+ ad = ((TypeClass *)t1)->sym; - goto L2; - } - } -+ -+ ae->e1 = ae1old; // restore - } - - /* With UFCS, e.f = value -@@ -10297,25 +11379,31 @@ Expression *AssignExp::semantic(Scope *s - */ - if (e1->op == TOKdotti) - { -- Expression *e = resolveProperty(sc, &e1, e2); -- if (e) return e; -+ DotTemplateInstanceExp *dti = (DotTemplateInstanceExp *)e1; -+ Expression *e = dti->semanticY(sc, 1); -+ if (!e) -+ return resolveUFCSProperties(sc, e1, e2); -+ e1 = e; - } - else if (e1->op == TOKdot) - { -- Expression *e = resolveProperty(sc, &e1, e2); -- if (e) return e; -- -- VarDeclaration * vd = NULL; -- if (e1->op == TOKvar) -- vd = ((VarExp *)e1)->var->isVarDeclaration(); -- -- if (vd && vd->needThis()) -+ DotIdExp *die = (DotIdExp *)e1; -+ Expression *e = die->semanticY(sc, 1); -+ if (e && isDotOpDispatch(e)) - { -- error("need 'this' to access member %s", e1->toChars()); -- return new ErrorExp(); -+ unsigned errors = global.startGagging(); -+ e = resolvePropertiesX(sc, e, e2); -+ if (global.endGagging(errors)) -+ e = NULL; /* fall down to UFCS */ -+ else -+ return e; - } -+ if (!e) -+ return resolveUFCSProperties(sc, e1, e2); -+ e1 = e; - } -- e1 = e1->semantic(sc); -+ else -+ e1 = e1->semantic(sc); - if (e1->op == TOKerror) - return new ErrorExp(); - -@@ -10325,113 +11413,10 @@ Expression *AssignExp::semantic(Scope *s - * or: - * f() = value - */ -- TemplateDeclaration *td; -- Objects *targsi; -- FuncDeclaration *fd; -- Expression *ethis; -- if (e1->op == TOKdotti) -- { -- DotTemplateInstanceExp* dti = (DotTemplateInstanceExp *)e1; -- td = dti->getTempdecl(sc); -- dti->ti->semanticTiargs(sc); -- targsi = dti->ti->tiargs; -- ethis = dti->e1; -- goto L3; -- } -- else if (e1->op == TOKdottd) -- { -- DotTemplateExp *dte = (DotTemplateExp *)e1; -- td = dte->td; -- targsi = NULL; -- ethis = dte->e1; -- goto L3; -- } -- else if (e1->op == TOKtemplate) -- { -- td = ((TemplateExp *)e1)->td; -- targsi = NULL; -- ethis = NULL; -- L3: -- { -- e2 = e2->semantic(sc); -- if (e2->op == TOKerror) -- return new ErrorExp(); -- e2 = resolveProperties(sc, e2); -- -- assert(td); -- Expressions a; -- a.push(e2); -- -- fd = td->deduceFunctionTemplate(sc, loc, targsi, ethis, &a, 1); -- if (fd && fd->type) -- goto Lsetter; -- -- fd = td->deduceFunctionTemplate(sc, loc, targsi, ethis, NULL, 1); -- if (fd && fd->type) -- goto Lgetter; -- } -- goto Leprop; -- } -- else if (e1->op == TOKdotvar && e1->type->toBasetype()->ty == Tfunction) -- { -- DotVarExp *dve = (DotVarExp *)e1; -- fd = dve->var->isFuncDeclaration(); -- ethis = dve->e1; -- goto L4; -- } -- else if (e1->op == TOKvar && e1->type->toBasetype()->ty == Tfunction) -- { -- fd = ((VarExp *)e1)->var->isFuncDeclaration(); -- ethis = NULL; -- L4: -- { -- e2 = e2->semantic(sc); -- if (e2->op == TOKerror) -- return new ErrorExp(); -- e2 = resolveProperties(sc, e2); -- -- assert(fd); -- FuncDeclaration *f = fd; -- Expressions a; -- a.push(e2); -- -- fd = f->overloadResolve(loc, ethis, &a, 1); -- if (fd && fd->type) -- goto Lsetter; -- -- fd = f->overloadResolve(loc, ethis, NULL, 1); -- if (fd && fd->type) -- goto Lgetter; -- -- goto Leprop; -- } -- -- Expression *e; -- TypeFunction *tf; -- -- Lsetter: -- assert(fd->type->ty == Tfunction); -- tf = (TypeFunction *)fd->type; -- if (!tf->isproperty && global.params.enforcePropertySyntax) -- goto Leprop; -- e = new CallExp(loc, e1, e2); -- return e->semantic(sc); -- -- Lgetter: -- assert(fd->type->ty == Tfunction); -- tf = (TypeFunction *)fd->type; -- if (!tf->isref) -- goto Leprop; -- if (!tf->isproperty && global.params.enforcePropertySyntax) -- goto Leprop; -- e = new CallExp(loc, e1); -- e = new AssignExp(loc, e, e2); -- return e->semantic(sc); -+ if (Expression *e = resolvePropertiesX(sc, e1, e2)) -+ return e; - -- Leprop: -- ::error(e1->loc, "not a property %s", e1->toChars()); -- return new ErrorExp(); -- } -+ e1 = checkRightThis(sc, e1); - - assert(e1->type); - Type *t1 = e1->type->toBasetype(); -@@ -10449,27 +11434,36 @@ Expression *AssignExp::semantic(Scope *s - */ - Ltupleassign: - if (e1->op == TOKtuple && e2->op == TOKtuple) -- { TupleExp *tup1 = (TupleExp *)e1; -+ { -+ TupleExp *tup1 = (TupleExp *)e1; - TupleExp *tup2 = (TupleExp *)e2; - size_t dim = tup1->exps->dim; -+ Expression *e = NULL; - if (dim != tup2->exps->dim) - { - error("mismatched tuple lengths, %d and %d", (int)dim, (int)tup2->exps->dim); - return new ErrorExp(); - } -+ if (dim == 0) -+ { -+ e = new IntegerExp(loc, 0, Type::tint32); -+ e = new CastExp(loc, e, Type::tvoid); // avoid "has no effect" error -+ e = combine(combine(tup1->e0, tup2->e0), e); -+ } - else -- { Expressions *exps = new Expressions; -+ { -+ Expressions *exps = new Expressions; - exps->setDim(dim); -- - for (size_t i = 0; i < dim; i++) -- { Expression *ex1 = (*tup1->exps)[i]; -+ { -+ Expression *ex1 = (*tup1->exps)[i]; - Expression *ex2 = (*tup2->exps)[i]; -- (*exps)[i] = new AssignExp(loc, ex1, ex2); -+ (*exps)[i] = new AssignExp(loc, ex1, ex2); - } -- Expression *e = new TupleExp(loc, exps); -- e = e->semantic(sc); -- return e; -+ e = new TupleExp(loc, combine(tup1->e0, tup2->e0), exps); - } -+ assert(e); -+ return e->semantic(sc); - } - - if (e1->op == TOKtuple) -@@ -10482,12 +11476,15 @@ Ltupleassign: - Identifier *id = Lexer::uniqueId("__tup"); - ExpInitializer *ei = new ExpInitializer(e2->loc, e2); - VarDeclaration *v = new VarDeclaration(e2->loc, NULL, id, ei); -- v->storage_class = STCctfe | STCref | STCforeach; -- Expression *ve = new VarExp(e2->loc, v); -- ve->type = e2->type; -+ v->storage_class = STCctfe; -+ if (e2->isLvalue()) -+ v->storage_class = STCref | STCforeach; -+ Expression *e0 = new DeclarationExp(e2->loc, v); -+ Expression *ev = new VarExp(e2->loc, v); -+ ev->type = e2->type; - - Expressions *iexps = new Expressions(); -- iexps->push(ve); -+ iexps->push(ev); - - for (size_t u = 0; u < iexps->dim ; u++) - { -@@ -10508,8 +11505,7 @@ Ltupleassign: - goto Lnomatch; - } - } -- (*iexps)[0] = new CommaExp(loc, new DeclarationExp(e2->loc, v), (*iexps)[0]); -- e2 = new TupleExp(e2->loc, iexps); -+ e2 = new TupleExp(e2->loc, e0, iexps); - e2 = e2->semantic(sc); - goto Ltupleassign; - -@@ -10518,10 +11514,17 @@ Ltupleassign: - } - } - -+ if (op == TOKassign && e1->checkModifiable(sc) == 2) -+ { -+ //printf("[%s] change to init - %s\n", loc.toChars(), toChars()); -+ op = TOKconstruct; -+ } -+ - // Determine if this is an initialization of a reference - int refinit = 0; - if (op == TOKconstruct && e1->op == TOKvar) -- { VarExp *ve = (VarExp *)e1; -+ { -+ VarExp *ve = (VarExp *)e1; - VarDeclaration *v = ve->var->isVarDeclaration(); - if (v->storage_class & (STCout | STCref)) - refinit = 1; -@@ -10535,88 +11538,238 @@ Ltupleassign: - StructDeclaration *sd = ((TypeStruct *)t1)->sym; - if (op == TOKassign) - { -- Expression *e = op_overload(sc); -- if (e && e1->op == TOKindex && -+ if (e1->op == TOKindex && - ((IndexExp *)e1)->e1->type->toBasetype()->ty == Taarray) - { -- // Deal with AAs (Bugzilla 2451) -- // Rewrite as: -- // e1 = (typeof(aa.value) tmp = void, tmp = e2, tmp); -- Type * aaValueType = ((TypeAArray *)((IndexExp*)e1)->e1->type->toBasetype())->next; -- Identifier *id = Lexer::uniqueId("__aatmp"); -- VarDeclaration *v = new VarDeclaration(loc, aaValueType, -- id, new VoidInitializer(0)); -- v->storage_class |= STCctfe; -- v->semantic(sc); -- v->parent = sc->parent; -+ /* -+ * Rewrite: -+ * aa[key] = e2; -+ * as: -+ * ref __aatmp = aa; -+ * ref __aakey = key; -+ * ref __aaval = e2; -+ * (__aakey in __aatmp -+ * ? __aatmp[__aakey].opAssign(__aaval) -+ * : ConstructExp(__aatmp[__aakey], __aaval)); -+ */ -+ IndexExp *ie = (IndexExp *)e1; -+ Type *t2 = e2->type->toBasetype(); -+ Expression *e0 = NULL; -+ -+ Expression *ea = ie->e1; -+ Expression *ek = ie->e2; -+ Expression *ev = e2; -+ if (ea->hasSideEffect()) -+ { -+ VarDeclaration *v = new VarDeclaration(loc, ie->e1->type, -+ Lexer::uniqueId("__aatmp"), new ExpInitializer(loc, ie->e1)); -+ v->storage_class |= STCctfe; -+ if (ea->isLvalue()) -+ v->storage_class |= STCforeach | STCref; -+ v->semantic(sc); -+ e0 = combine(e0, new DeclarationExp(loc, v)); -+ ea = new VarExp(loc, v); -+ } -+ if (ek->hasSideEffect()) -+ { -+ VarDeclaration *v = new VarDeclaration(loc, ie->e2->type, -+ Lexer::uniqueId("__aakey"), new ExpInitializer(loc, ie->e2)); -+ v->storage_class |= STCctfe; -+ if (ek->isLvalue()) -+ v->storage_class |= STCforeach | STCref; -+ v->semantic(sc); -+ e0 = combine(e0, new DeclarationExp(loc, v)); -+ ek = new VarExp(loc, v); -+ } -+ if (ev->hasSideEffect()) -+ { -+ VarDeclaration *v = new VarDeclaration(loc, e2->type, -+ Lexer::uniqueId("__aaval"), new ExpInitializer(loc, e2)); -+ v->storage_class |= STCctfe; -+ if (ev->isLvalue()) -+ v->storage_class |= STCforeach | STCref; -+ v->semantic(sc); -+ e0 = combine(e0, new DeclarationExp(loc, v)); -+ ev = new VarExp(loc, v); -+ } -+ if (e0) -+ e0 = e0->semantic(sc); - -- Expression *de = new DeclarationExp(loc, v); -- VarExp *ve = new VarExp(loc, v); -+ AssignExp *ae = (AssignExp *)copy(); -+ ae->e1 = new IndexExp(loc, ea, ek); -+ ae->e1 = ae->e1->semantic(sc); -+ ae->e1 = ae->e1->optimize(WANTvalue); -+ ae->e2 = ev; -+ //Expression *e = new CallExp(loc, new DotIdExp(loc, ex, Id::assign), ev); -+ Expression *e = ae->op_overload(sc); -+ if (!e) -+ goto Lx; - -- AssignExp *ae = new AssignExp(loc, ve, e2); -- e = ae->op_overload(sc); -- e2 = new CommaExp(loc, new CommaExp(loc, de, e), ve); -- e2 = e2->semantic(sc); -+ Expression *ey = NULL; -+ if (t2->ty == Tstruct && sd == t2->toDsymbol(sc)) -+ { -+ ey = ev; -+ goto Lctor; -+ } -+ else if (!ev->implicitConvTo(ie->type) && sd->ctor) -+ { -+ // Look for implicit constructor call -+ // Rewrite as S().ctor(e2) -+ ey = new StructLiteralExp(loc, sd, NULL); -+ ey = new DotIdExp(loc, ey, Id::ctor); -+ ey = new CallExp(loc, ey, ev); -+ ey = ey->trySemantic(sc); -+ if (ey) -+ { -+ Lctor: -+ Expression *ex; -+ ex = new IndexExp(loc, ea, ek); -+ ex = ex->semantic(sc); -+ ex = ex->optimize(WANTvalue); -+ ex = ex->modifiableLvalue(sc, ex); // allocate new slot -+ ey = new ConstructExp(loc, ex, ey); - -- e1 = e1->optimize(WANTvalue); -- e1 = e1->modifiableLvalue(sc, e1); -- e2 = e2->implicitCastTo(sc, e1->type); -- type = e1->type; -- assert(type); -- e = this; -+ e = new CastExp(e->loc, e, Type::tvoid); -+ ey = new CastExp(ey->loc, ey, Type::tvoid); -+ } -+ } -+ if (ey) -+ e = new CondExp(loc, new InExp(loc, ek, ea), e, ey); -+ -+ e = combine(e0, e); -+ e = e->semantic(sc); -+ return e; - } -+ -+ Expression *e = op_overload(sc); - if (e) - { - /* See if we need to set ctorinit, i.e. track - * assignments to fields. An assignment to a field counts even - * if done through an opAssign overload. - */ -- e1->checkModifiable(sc); - return e; - } - } - else if (op == TOKconstruct && !refinit) -- { Type *t2 = e2->type->toBasetype(); -- if (t2->ty == Tstruct && -- sd == ((TypeStruct *)t2)->sym && -- sd->cpctor) -- { /* We have a copy constructor for this -- */ -- if (e2->op == TOKquestion) -- { /* Write as: -- * a ? e1 = b : e1 = c; -+ { -+ Type *t2 = e2->type->toBasetype(); -+ if (t2->ty == Tstruct && sd == ((TypeStruct *)t2)->sym) -+ { -+ if (sd->ctor && // there are constructors -+ e2->op == TOKcall && -+ e2->type->implicitConvTo(t1)) -+ { -+ /* Look for form of constructor call which is: -+ * *__ctmp.ctor(arguments...) - */ -- CondExp *econd = (CondExp *)e2; -- AssignExp *ea1 = new AssignExp(econd->e1->loc, e1, econd->e1); -- ea1->op = op; -- AssignExp *ea2 = new AssignExp(econd->e1->loc, e1, econd->e2); -- ea2->op = op; -- Expression *e = new CondExp(loc, econd->econd, ea1, ea2); -- return e->semantic(sc); -+ CallExp *ce = (CallExp *)e2; -+ if (ce->e1->op == TOKdotvar) -+ { -+ DotVarExp *dve = (DotVarExp *)ce->e1; -+ if (dve->var->isCtorDeclaration()) -+ { -+ /* It's a constructor call, currently constructing -+ * a temporary __ctmp. -+ */ -+ /* Before calling the constructor, initialize -+ * variable with a bit copy of the default -+ * initializer -+ */ -+ -+ if (sd->zeroInit == 1) -+ { -+ e2 = new IntegerExp(loc, 0, Type::tint32); -+ } -+ else if (sd->isNested()) -+ { -+ e2 = t1->defaultInitLiteral(loc); -+ this->op = TOKblit; -+ } -+ else -+ { -+ e2 = t1->defaultInit(loc); -+ this->op = TOKblit; -+ } -+ type = e1->type; -+ -+ /* Replace __ctmp being constructed with e1. -+ * We need to copy constructor call expression, -+ * because it may be used in other place. -+ */ -+ DotVarExp *dvx = (DotVarExp *)dve->copy(); -+ dvx->e1 = e1; -+ CallExp *cx = (CallExp *)ce->copy(); -+ cx->e1 = dvx; -+ -+ Expression *e = new CommaExp(loc, this, cx); -+ e = e->semantic(sc); -+ return e; -+ } -+ } - } -- else if (e2->isLvalue()) -- { /* Write as: -- * e1.cpctor(e2); -+ if (sd->cpctor) -+ { -+ /* We have a copy constructor for this - */ -- if (!e2->type->implicitConvTo(e1->type)) -- error("conversion error from %s to %s", e2->type->toChars(), e1->type->toChars()); -+ if (e2->op == TOKquestion) -+ { -+ /* Write as: -+ * a ? e1 = b : e1 = c; -+ */ -+ CondExp *econd = (CondExp *)e2; -+ AssignExp *ea1 = new AssignExp(econd->e1->loc, e1, econd->e1); -+ ea1->op = op; -+ AssignExp *ea2 = new AssignExp(econd->e1->loc, e1, econd->e2); -+ ea2->op = op; -+ Expression *e = new CondExp(loc, econd->econd, ea1, ea2); -+ return e->semantic(sc); -+ } - -- Expression *e = new DotVarExp(loc, e1, sd->cpctor, 0); -- e = new CallExp(loc, e, e2); -- return e->semantic(sc); -+ if (e2->isLvalue()) -+ { -+ /* Write as: -+ * e1.cpctor(e2); -+ */ -+ if (!e2->type->implicitConvTo(e1->type)) -+ error("conversion error from %s to %s", e2->type->toChars(), e1->type->toChars()); -+ -+ Expression *e = new DotVarExp(loc, e1, sd->cpctor, 0); -+ e = new CallExp(loc, e, e2); -+ return e->semantic(sc); -+ } -+ else -+ { -+ /* The struct value returned from the function is transferred -+ * so should not call the destructor on it. -+ */ -+ e2 = valueNoDtor(e2); -+ } - } -- else if (e2->op == TOKcall) -+ } -+ else -+ { -+ if (!e2->implicitConvTo(t1)) - { -- /* The struct value returned from the function is transferred -- * so should not call the destructor on it. -- */ -- valueNoDtor(e2); -+ // Look for implicit constructor call -+ if (sd->ctor) -+ { -+ // Look for constructor first -+ // Rewrite as e1.ctor(arguments) -+ Expression *e; -+ e = new DotIdExp(loc, e1, Id::ctor); -+ e = new CallExp(loc, e, e2); -+ e = e->semantic(sc); -+ return e; -+ } - } - } - } -+ Lx: ; - } - else if (t1->ty == Tclass) -- { // Disallow assignment operator overloads for same type -+ { -+ // Disallow assignment operator overloads for same type - if (op == TOKassign && !e2->implicitConvTo(e1->type)) - { - Expression *e = op_overload(sc); -@@ -10641,11 +11794,32 @@ Ltupleassign: - else - { - // Convert e2 to e2[], unless e2-> e1[0] -- if (t2->ty == Tsarray && !t2->implicitConvTo(t1->nextOf())) -+ if (e2->op != TOKarrayliteral && t2->ty == Tsarray && !t2->implicitConvTo(t1->nextOf())) - { - e2 = new SliceExp(e2->loc, e2, NULL, NULL); - e2 = e2->semantic(sc); - } -+ else if (0 && global.params.warnings && !global.gag && op == TOKassign && -+ e2->op != TOKarrayliteral && e2->op != TOKstring && -+ !e2->implicitConvTo(t1)) -+ { // Disallow sa = da (Converted to sa[] = da[]) -+ // Disallow sa = e (Converted to sa[] = e) -+ const char* e1str = e1->toChars(); -+ const char* e2str = e2->toChars(); -+ if (e2->op == TOKslice || e2->implicitConvTo(t1->nextOf())) -+ warning("explicit element-wise assignment (%s)[] = %s is better than %s = %s", -+ e1str, e2str, e1str, e2str); -+ else -+ warning("explicit element-wise assignment (%s)[] = (%s)[] is better than %s = %s", -+ e1str, e2str, e1str, e2str); -+ -+ // Convert e2 to e2[] to avoid duplicated error message. -+ if (t2->ty == Tarray) -+ { -+ Expression *e = new SliceExp(e2->loc, e2, NULL, NULL); -+ e2 = e->semantic(sc); -+ } -+ } - - // Convert e1 to e1[] - Expression *e = new SliceExp(e1->loc, e1, NULL, NULL); -@@ -10660,12 +11834,17 @@ Ltupleassign: - ArrayLengthExp *ale = (ArrayLengthExp *)e1; - - ale->e1 = ale->e1->modifiableLvalue(sc, e1); -+ if (ale->e1->op == TOKerror) -+ return ale->e1; -+ -+ checkDefCtor(ale->loc, ale->e1->type->toBasetype()->nextOf()); - } - else if (e1->op == TOKslice) - { - Type *tn = e1->type->nextOf(); -- if (op == TOKassign && e1->checkModifiable(sc) == 1 && !tn->isMutable()) -- { error("slice %s is not mutable", e1->toChars()); -+ if (op == TOKassign && !tn->isMutable()) -+ { -+ error("slice %s is not mutable", e1->toChars()); - return new ErrorExp(); - } - } -@@ -10675,7 +11854,7 @@ Ltupleassign: - if (e1->op != TOKvar) - e1 = e1->optimize(WANTvalue); - -- if (op != TOKconstruct) -+ if (op == TOKassign) - e1 = e1->modifiableLvalue(sc, e1old); - } - -@@ -10696,6 +11875,8 @@ Ltupleassign: - { // memset - ismemset = 1; // make it easy for back end to tell what this is - e2 = e2->implicitCastTo(sc, t1->nextOf()); -+ if (op != TOKblit && e2->isLvalue()) -+ e2->checkPostblit(sc, t1->nextOf()); - } - else if (t1->ty == Tsarray) - { -@@ -10714,19 +11895,26 @@ Ltupleassign: - (t2->ty == Tarray || t2->ty == Tsarray) && - t2->nextOf()->implicitConvTo(t1->nextOf())) - { -- if (((SliceExp *)e1)->lwr == NULL) -+ SliceExp *se1 = (SliceExp *)e1; -+ Type *tx1 = se1->e1->type->toBasetype(); -+ if (se1->lwr == NULL && tx1->ty == Tsarray) - { -- Type *tx1 = ((SliceExp *)e1)->e1->type->toBasetype(); - Type *tx2 = t2; - if (e2->op == TOKslice && ((SliceExp *)e2)->lwr == NULL) - tx2 = ((SliceExp *)e2)->e1->type->toBasetype(); -- if (tx1->ty == Tsarray && tx2->ty == Tsarray) -+ uinteger_t dim1, dim2; -+ if (e2->op == TOKarrayliteral) -+ { -+ dim2 = ((ArrayLiteralExp *)e2)->elements->dim; -+ goto Lsa; -+ } -+ if (tx2->ty == Tsarray) - { // sa1[] = sa2[]; - // sa1[] = sa2; -- TypeSArray *tsa1 = (TypeSArray *)tx1; -- TypeSArray *tsa2 = (TypeSArray *)tx2; -- uinteger_t dim1 = tsa1->dim->toInteger(); -- uinteger_t dim2 = tsa2->dim->toInteger(); -+ // sa1[] = [ ... ]; -+ dim2 = ((TypeSArray *)tx2)->dim->toInteger(); -+ Lsa: -+ dim1 = ((TypeSArray *)tx1)->dim->toInteger(); - if (dim1 != dim2) - { - error("mismatched array lengths, %d and %d", (int)dim1, (int)dim2); -@@ -10739,15 +11927,60 @@ Ltupleassign: - e2->op == TOKcast && ((UnaExp *)e2)->e1->isLvalue() || - e2->op != TOKslice && e2->isLvalue())) - { -- checkPostblit(e2->loc, t2->nextOf()); -+ e2->checkPostblit(sc, t2->nextOf()); - } -- if (op == TOKconstruct) -+ if (0 && global.params.warnings && !global.gag && op == TOKassign && -+ e2->op != TOKslice && e2->op != TOKassign && -+ e2->op != TOKarrayliteral && e2->op != TOKstring && -+ !(e2->op == TOKadd || e2->op == TOKmin || -+ e2->op == TOKmul || e2->op == TOKdiv || -+ e2->op == TOKmod || e2->op == TOKxor || -+ e2->op == TOKand || e2->op == TOKor || -+ #if DMDV2 -+ e2->op == TOKpow || -+ #endif -+ e2->op == TOKtilde || e2->op == TOKneg)) -+ { -+ const char* e1str = e1->toChars(); -+ const char* e2str = e2->toChars(); -+ warning("explicit element-wise assignment %s = (%s)[] is better than %s = %s", -+ e1str, e2str, e1str, e2str); -+ } -+ -+ Type *t2n = t2->nextOf(); -+ Type *t1n = t1->nextOf(); -+ int offset; -+ if (t2n->immutableOf()->equals(t1n->immutableOf()) || -+ t1n->isBaseOf(t2n, &offset) && offset == 0) -+ { -+ /* Allow copy of distinct qualifier elements. -+ * eg. -+ * char[] dst; const(char)[] src; -+ * dst[] = src; -+ * -+ * class C {} class D : C {} -+ * C[2] ca; D[] da; -+ * ca[] = da; -+ */ - e2 = e2->castTo(sc, e1->type->constOf()); -+ } - else -- e2 = e2->implicitCastTo(sc, e1->type->constOf()); -+ e2 = e2->implicitCastTo(sc, e1->type); - } - else - { -+ if (0 && global.params.warnings && !global.gag && op == TOKassign && -+ t1->ty == Tarray && t2->ty == Tsarray && -+ e2->op != TOKslice && //e2->op != TOKarrayliteral && -+ t2->implicitConvTo(t1)) -+ { // Disallow ar[] = sa (Converted to ar[] = sa[]) -+ // Disallow da = sa (Converted to da = sa[]) -+ const char* e1str = e1->toChars(); -+ const char* e2str = e2->toChars(); -+ const char* atypestr = e1->op == TOKslice ? "element-wise" : "slice"; -+ warning("explicit %s assignment %s = (%s)[] is better than %s = %s", -+ atypestr, e1str, e2str, e1str, e2str); -+ } - e2 = e2->implicitCastTo(sc, e1->type); - } - if (e2->op == TOKerror) -@@ -10782,7 +12015,7 @@ Ltupleassign: - - type = e1->type; - assert(type); -- return this; -+ return op == TOKassign ? reorderSettingAAElem(sc) : this; - } - - Expression *AssignExp::checkToBoolean(Scope *sc) -@@ -10858,25 +12091,24 @@ Expression *CatAssignExp::semantic(Scope - (e2->implicitConvTo(e1->type) - #if DMDV2 - || (tb2->nextOf()->implicitConvTo(tb1next) && -- (tb2->nextOf()->size(0) == tb1next->size(0) || -+ (tb2->nextOf()->size(Loc()) == tb1next->size(Loc()) || - tb1next->ty == Tchar || tb1next->ty == Twchar || tb1next->ty == Tdchar)) - #endif - ) - ) - { // Append array -- checkPostblit(e1->loc, tb1next); -+ e1->checkPostblit(sc, tb1next); - e2 = e2->castTo(sc, e1->type); - type = e1->type; -- e = this; - } - else if ((tb1->ty == Tarray) && - e2->implicitConvTo(tb1next) - ) - { // Append element -- checkPostblit(e2->loc, tb2); -+ e2->checkPostblit(sc, tb2); - e2 = e2->castTo(sc, tb1next); -+ e2 = e2->isLvalue() ? callCpCtor(sc, e2) : valueNoDtor(e2); - type = e1->type; -- e = this; - } - else if (tb1->ty == Tarray && - (tb1next->ty == Tchar || tb1next->ty == Twchar) && -@@ -10886,7 +12118,6 @@ Expression *CatAssignExp::semantic(Scope - { // Append dchar to char[] or wchar[] - e2 = e2->castTo(sc, Type::tdchar); - type = e1->type; -- e = this; - - /* Do not allow appending wchar to char[] because if wchar happens - * to be a surrogate pair, nothing good can result. -@@ -10896,9 +12127,9 @@ Expression *CatAssignExp::semantic(Scope - { - if (tb1 != Type::terror && tb2 != Type::terror) - error("cannot append type %s to type %s", tb2->toChars(), tb1->toChars()); -- e = new ErrorExp(); -+ return new ErrorExp(); - } -- return e; -+ return reorderSettingAAElem(sc); - } - - /************************************************************/ -@@ -11005,6 +12236,9 @@ Expression *PowAssignExp::semantic(Scope - else - { - e1 = e1->modifiableLvalue(sc, e1); -+ -+ e = reorderSettingAAElem(sc); -+ if (e != this) return e; - } - - if ( (e1->type->isintegral() || e1->type->isfloating()) && -@@ -11059,6 +12293,19 @@ Expression *AddExp::semantic(Scope *sc) - Type *tb1 = e1->type->toBasetype(); - Type *tb2 = e2->type->toBasetype(); - -+ if (tb1->ty == Tdelegate || -+ tb1->ty == Tpointer && tb1->nextOf()->ty == Tfunction) -+ { -+ e = e1->checkArithmetic(); -+ } -+ if (tb2->ty == Tdelegate || -+ tb2->ty == Tpointer && tb2->nextOf()->ty == Tfunction) -+ { -+ e = e2->checkArithmetic(); -+ } -+ if (e) -+ return e; -+ - if ((tb1->ty == Tarray || tb1->ty == Tsarray) && - (tb2->ty == Tarray || tb2->ty == Tsarray) && - tb1->nextOf()->equals(tb2->nextOf()) -@@ -11068,8 +12315,10 @@ Expression *AddExp::semantic(Scope *sc) - e = this; - } - else if (tb1->ty == Tpointer && e2->type->isintegral() || -- tb2->ty == Tpointer && e1->type->isintegral()) -+ tb2->ty == Tpointer && e1->type->isintegral()) -+ { - e = scaleFactor(sc); -+ } - else if (tb1->ty == Tpointer && tb2->ty == Tpointer) - { - return incompatibleTypes(); -@@ -11135,9 +12384,23 @@ Expression *MinExp::semantic(Scope *sc) - if (e) - return e; - -- e = this; - Type *t1 = e1->type->toBasetype(); - Type *t2 = e2->type->toBasetype(); -+ -+ if (t1->ty == Tdelegate || -+ t1->ty == Tpointer && t1->nextOf()->ty == Tfunction) -+ { -+ e = e1->checkArithmetic(); -+ } -+ if (t2->ty == Tdelegate || -+ t2->ty == Tpointer && t2->nextOf()->ty == Tfunction) -+ { -+ e = e2->checkArithmetic(); -+ } -+ if (e) -+ return e; -+ -+ e = this; - if (t1->ty == Tpointer) - { - if (t2->ty == Tpointer) -@@ -11155,7 +12418,7 @@ Expression *MinExp::semantic(Scope *sc) - } - else - { -- e = new DivExp(loc, this, new IntegerExp(0, stride, Type::tptrdiff_t)); -+ e = new DivExp(loc, this, new IntegerExp(Loc(), stride, Type::tptrdiff_t)); - e->type = Type::tptrdiff_t; - } - return e; -@@ -11262,10 +12525,10 @@ Expression *CatExp::semantic(Scope *sc) - e2->implicitConvTo(tb1next) >= MATCHconvert && - tb2->ty != Tvoid) - { -- checkPostblit(e2->loc, tb2); -+ e2->checkPostblit(sc, tb2); - e2 = e2->implicitCastTo(sc, tb1next); - type = tb1next->arrayOf(); -- if (tb2->ty == Tarray) -+ if (tb2->ty == Tarray || tb2->ty == Tsarray) - { // Make e2 into [e2] - e2 = new ArrayLiteralExp(e2->loc, e2); - e2->type = type; -@@ -11276,10 +12539,10 @@ Expression *CatExp::semantic(Scope *sc) - e1->implicitConvTo(tb2next) >= MATCHconvert && - tb1->ty != Tvoid) - { -- checkPostblit(e1->loc, tb1); -+ e1->checkPostblit(sc, tb1); - e1 = e1->implicitCastTo(sc, tb2next); - type = tb2next->arrayOf(); -- if (tb1->ty == Tarray) -+ if (tb1->ty == Tarray || tb1->ty == Tsarray) - { // Make e1 into [e1] - e1 = new ArrayLiteralExp(e1->loc, e1); - e1->type = type; -@@ -11316,9 +12579,9 @@ Expression *CatExp::semantic(Scope *sc) - { - type = type->nextOf()->toHeadMutable()->arrayOf(); - } -- if (tb->nextOf()) -+ if (Type *tbn = tb->nextOf()) - { -- checkPostblit(loc, tb->nextOf()); -+ checkPostblit(sc, tbn); - } - #if 0 - e1->type->print(); -@@ -11569,104 +12832,91 @@ Expression *PowExp::semantic(Scope *sc) - } - } - -- if ( (e1->type->isintegral() || e1->type->isfloating()) && -- (e2->type->isintegral() || e2->type->isfloating())) -+ if ( !(e1->type->isintegral() || e1->type->isfloating()) || -+ !(e2->type->isintegral() || e2->type->isfloating())) - { -- // For built-in numeric types, there are several cases. -- // TODO: backend support, especially for e1 ^^ 2. -+ return incompatibleTypes(); -+ } - -- bool wantSqrt = false; -+ // For built-in numeric types, there are several cases. -+ // TODO: backend support, especially for e1 ^^ 2. - -- // First, attempt to fold the expression. -- e = optimize(WANTvalue); -- if (e->op != TOKpow) -- { -- e = e->semantic(sc); -- return e; -- } -+ bool wantSqrt = false; - -- // Determine if we're raising to an integer power. -- sinteger_t intpow = 0; -- if (e2->op == TOKint64 && ((sinteger_t)e2->toInteger() == 2 || (sinteger_t)e2->toInteger() == 3)) -- intpow = e2->toInteger(); -- else if (e2->op == TOKfloat64 && e2->toReal() == (real_t)(e2->toInteger())) -- intpow = e2->toInteger(); -- -- // Deal with x^^2, x^^3 immediately, since they are of practical importance. -- if (intpow == 2 || intpow == 3) -- { -- // Replace x^^2 with (tmp = x, tmp*tmp) -- // Replace x^^3 with (tmp = x, tmp*tmp*tmp) -- Identifier *idtmp = Lexer::uniqueId("__powtmp"); -- VarDeclaration *tmp = new VarDeclaration(loc, e1->type->toBasetype(), idtmp, new ExpInitializer(0, e1)); -- tmp->storage_class = STCctfe; -- Expression *ve = new VarExp(loc, tmp); -- Expression *ae = new DeclarationExp(loc, tmp); -- /* Note that we're reusing ve. This should be ok. -- */ -- Expression *me = new MulExp(loc, ve, ve); -- if (intpow == 3) -- me = new MulExp(loc, me, ve); -- e = new CommaExp(loc, ae, me); -- e = e->semantic(sc); -- return e; -- } -+ // First, attempt to fold the expression. -+ e = optimize(WANTvalue); -+ if (e->op != TOKpow) -+ { -+ e = e->semantic(sc); -+ return e; -+ } - -- static int importMathChecked = 0; -- static bool importMath = false; -- if (!importMathChecked) -- { -- importMathChecked = 1; -- for (size_t i = 0; i < Module::amodules.dim; i++) -- { Module *mi = Module::amodules[i]; -- //printf("\t[%d] %s\n", i, mi->toChars()); -- if (mi->ident == Id::math && -- mi->parent->ident == Id::std && -- !mi->parent->parent) -- { -- importMath = true; -- goto L1; -- } -- } --#ifndef IN_GCC -- error("must import std.math to use ^^ operator"); -- return new ErrorExp(); --#endif -+ // Determine if we're raising to an integer power. -+ sinteger_t intpow = 0; -+ if (e2->op == TOKint64 && ((sinteger_t)e2->toInteger() == 2 || (sinteger_t)e2->toInteger() == 3)) -+ intpow = e2->toInteger(); -+ else if (e2->op == TOKfloat64 && (e2->toReal() == (sinteger_t)(e2->toReal()))) -+ intpow = (sinteger_t)(e2->toReal()); -+ -+ // Deal with x^^2, x^^3 immediately, since they are of practical importance. -+ if (intpow == 2 || intpow == 3) -+ { -+ // Replace x^^2 with (tmp = x, tmp*tmp) -+ // Replace x^^3 with (tmp = x, tmp*tmp*tmp) -+ Identifier *idtmp = Lexer::uniqueId("__powtmp"); -+ VarDeclaration *tmp = new VarDeclaration(loc, e1->type->toBasetype(), idtmp, new ExpInitializer(Loc(), e1)); -+ tmp->storage_class = STCctfe; -+ Expression *ve = new VarExp(loc, tmp); -+ Expression *ae = new DeclarationExp(loc, tmp); -+ /* Note that we're reusing ve. This should be ok. -+ */ -+ Expression *me = new MulExp(loc, ve, ve); -+ if (intpow == 3) -+ me = new MulExp(loc, me, ve); -+ e = new CommaExp(loc, ae, me); -+ e = e->semantic(sc); -+ return e; -+ } - -- L1: ; -- } -- else -- { -- if (!importMath) -+ static int importMathChecked = 0; -+ static bool importMath = false; -+ if (!importMathChecked) -+ { -+ importMathChecked = 1; -+ for (size_t i = 0; i < Module::amodules.dim; i++) -+ { Module *mi = Module::amodules[i]; -+ //printf("\t[%d] %s\n", i, mi->toChars()); -+ if (mi->ident == Id::math && -+ mi->parent->ident == Id::std && -+ !mi->parent->parent) - { --#ifdef IN_GCC -- // GDC handles PowExp in backend. -- typeCombine(sc); -- e = this; -- return e; --#else -- error("must import std.math to use ^^ operator"); -- return new ErrorExp(); --#endif -+ importMath = true; -+ break; - } - } -- -- e = new IdentifierExp(loc, Id::empty); -- e = new DotIdExp(loc, e, Id::std); -- e = new DotIdExp(loc, e, Id::math); -- if (e2->op == TOKfloat64 && e2->toReal() == 0.5) -- { // Replace e1 ^^ 0.5 with .std.math.sqrt(x) -- e = new CallExp(loc, new DotIdExp(loc, e, Id::_sqrt), e1); -- } -- else -- { -- // Replace e1 ^^ e2 with .std.math.pow(e1, e2) -- e = new CallExp(loc, new DotIdExp(loc, e, Id::_pow), e1, e2); -- } -- e = e->semantic(sc); -+ } -+ if (!importMath) -+ { // Leave handling of PowExp to the backend, or throw -+ // an error gracefully if no backend support exists. -+ typeCombine(sc); -+ e = this; - return e; - } -- return incompatibleTypes(); -+ -+ e = new IdentifierExp(loc, Id::empty); -+ e = new DotIdExp(loc, e, Id::std); -+ e = new DotIdExp(loc, e, Id::math); -+ if (e2->op == TOKfloat64 && e2->toReal() == 0.5) -+ { // Replace e1 ^^ 0.5 with .std.math.sqrt(x) -+ e = new CallExp(loc, new DotIdExp(loc, e, Id::_sqrt), e1); -+ } -+ else -+ { -+ // Replace e1 ^^ e2 with .std.math.pow(e1, e2) -+ e = new CallExp(loc, new DotIdExp(loc, e, Id::_pow), e1, e2); -+ } -+ e = e->semantic(sc); -+ return e; - } - - /************************************************************/ -@@ -12054,7 +13304,7 @@ void RemoveExp::toCBuffer(OutBuffer *buf - - /************************************************************/ - --CmpExp::CmpExp(enum TOK op, Loc loc, Expression *e1, Expression *e2) -+CmpExp::CmpExp(TOK op, Loc loc, Expression *e1, Expression *e2) - : BinExp(loc, op, sizeof(CmpExp), e1, e2) - { - } -@@ -12103,9 +13353,6 @@ Expression *CmpExp::semantic(Scope *sc) - return new ErrorExp(); - } - -- Expression *eb1 = e1; -- Expression *eb2 = e2; -- - e = typeCombine(sc); - if (e->op == TOKerror) - return e; -@@ -12140,6 +13387,11 @@ Expression *CmpExp::semantic(Scope *sc) - error("compare not defined for complex operands"); - e = new ErrorExp(); - } -+ else if (t1->ty == Taarray || t2->ty == Taarray) -+ { -+ error("%s is not defined for associative arrays", Token::toChars(op)); -+ e = new ErrorExp(); -+ } - else if (t1->ty == Tvector) - return incompatibleTypes(); - else -@@ -12159,7 +13411,7 @@ int CmpExp::isBit() - - /************************************************************/ - --EqualExp::EqualExp(enum TOK op, Loc loc, Expression *e1, Expression *e2) -+EqualExp::EqualExp(TOK op, Loc loc, Expression *e1, Expression *e2) - : BinExp(loc, op, sizeof(EqualExp), e1, e2) - { - assert(op == TOKequal || op == TOKnotequal); -@@ -12189,7 +13441,7 @@ int needDirectEq(Type *t1, Type *t2) - if (t->ty != Tstruct) - return FALSE; - -- return ((TypeStruct *)t)->sym->xeq == StructDeclaration::xerreq; -+ return ((TypeStruct *)t)->sym->hasIdentityEquals; - } - - Expression *EqualExp::semantic(Scope *sc) -@@ -12201,16 +13453,20 @@ Expression *EqualExp::semantic(Scope *sc - - BinExp::semanticp(sc); - -+ if (e1->op == TOKtype || e2->op == TOKtype) -+ return incompatibleTypes(); -+ - /* Before checking for operator overloading, check to see if we're - * comparing the addresses of two statics. If so, we can just see - * if they are the same symbol. - */ - if (e1->op == TOKaddress && e2->op == TOKaddress) -- { AddrExp *ae1 = (AddrExp *)e1; -+ { -+ AddrExp *ae1 = (AddrExp *)e1; - AddrExp *ae2 = (AddrExp *)e2; -- - if (ae1->e1->op == TOKvar && ae2->e1->op == TOKvar) -- { VarExp *ve1 = (VarExp *)ae1->e1; -+ { -+ VarExp *ve1 = (VarExp *)ae1->e1; - VarExp *ve2 = (VarExp *)ae2->e1; - - if (ve1->var == ve2->var /*|| ve1->var->toSymbol() == ve2->var->toSymbol()*/) -@@ -12279,6 +13535,63 @@ Expression *EqualExp::semantic(Scope *sc - return new ErrorExp(); - } - -+ if (t1->ty == Tstruct && t2->ty == Tstruct) -+ { -+ StructDeclaration *sd = ((TypeStruct *)t1)->sym; -+ if (sd == ((TypeStruct *)t2)->sym) -+ { -+ if (sd->needOpEquals()) -+ { -+ this->e1 = new DotIdExp(loc, e1, Id::tupleof); -+ this->e2 = new DotIdExp(loc, e2, Id::tupleof); -+ e = this; -+ } -+ else -+ { -+ e = new IdentityExp(op == TOKequal ? TOKidentity : TOKnotidentity, loc, e1, e2); -+ } -+ e = e->semantic(sc); -+ return e; -+ } -+ } -+ -+ // check tuple equality before typeCombine -+ if (e1->op == TOKtuple && e2->op == TOKtuple) -+ { -+ TupleExp *tup1 = (TupleExp *)e1; -+ TupleExp *tup2 = (TupleExp *)e2; -+ size_t dim = tup1->exps->dim; -+ Expression *e = NULL; -+ if (dim != tup2->exps->dim) -+ { -+ error("mismatched tuple lengths, %d and %d", (int)dim, (int)tup2->exps->dim); -+ return new ErrorExp(); -+ } -+ if (dim == 0) -+ { -+ // zero-length tuple comparison should always return true or false. -+ e = new IntegerExp(loc, (op == TOKequal), Type::tboolean); -+ } -+ else -+ { -+ for (size_t i = 0; i < dim; i++) -+ { -+ Expression *ex1 = (*tup1->exps)[i]; -+ Expression *ex2 = (*tup2->exps)[i]; -+ Expression *eeq = new EqualExp(op, loc, ex1, ex2); -+ if (!e) -+ e = eeq; -+ else if (op == TOKequal) -+ e = new AndAndExp(loc, e, eeq); -+ else -+ e = new OrOrExp(loc, e, eeq); -+ } -+ } -+ assert(e); -+ e = combine(combine(tup1->e0, tup2->e0), e); -+ return e->semantic(sc); -+ } -+ - e = typeCombine(sc); - if (e->op == TOKerror) - return e; -@@ -12311,7 +13624,7 @@ int EqualExp::isBit() - - /************************************************************/ - --IdentityExp::IdentityExp(enum TOK op, Loc loc, Expression *e1, Expression *e2) -+IdentityExp::IdentityExp(TOK op, Loc loc, Expression *e1, Expression *e2) - : BinExp(loc, op, sizeof(IdentityExp), e1, e2) - { - } -@@ -12362,11 +13675,7 @@ Expression *CondExp::syntaxCopy() - - - Expression *CondExp::semantic(Scope *sc) --{ Type *t1; -- Type *t2; -- unsigned cs0; -- unsigned cs1; -- -+{ - #if LOGSEMANTIC - printf("CondExp::semantic('%s')\n", toChars()); - #endif -@@ -12378,19 +13687,32 @@ Expression *CondExp::semantic(Scope *sc) - econd = econd->checkToPointer(); - econd = econd->checkToBoolean(sc); - -- cs0 = sc->callSuper; -+ unsigned cs0 = sc->callSuper; -+ unsigned *fi0 = fi0 = sc->saveFieldInit(); - e1 = e1->semantic(sc); - e1 = resolveProperties(sc, e1); -- cs1 = sc->callSuper; -+ -+ unsigned cs1 = sc->callSuper; -+ unsigned *fi1 = sc->fieldinit; - sc->callSuper = cs0; -+ sc->fieldinit = fi0; - e2 = e2->semantic(sc); - e2 = resolveProperties(sc, e2); -+ - sc->mergeCallSuper(loc, cs1); -+ sc->mergeFieldInit(loc, fi1); -+ -+ if (econd->type == Type::terror) -+ return econd; -+ if (e1->type == Type::terror) -+ return e1; -+ if (e2->type == Type::terror) -+ return e2; - - - // If either operand is void, the result is void -- t1 = e1->type; -- t2 = e2->type; -+ Type *t1 = e1->type; -+ Type *t2 = e2->type; - if (t1->ty == Tvoid || t2->ty == Tvoid) - type = Type::tvoid; - else if (t1 == t2) -@@ -12420,6 +13742,7 @@ Expression *CondExp::semantic(Scope *sc) - e2 = e2->castTo(sc, type); - } - } -+ type = type->merge2(); - #if 0 - printf("res: %s\n", type->toChars()); - printf("e1 : %s\n", e1->type->toChars()); -@@ -12496,7 +13819,7 @@ void CondExp::toCBuffer(OutBuffer *buf, - - /****************************************************************/ - --DefaultInitExp::DefaultInitExp(Loc loc, enum TOK subop, int size) -+DefaultInitExp::DefaultInitExp(Loc loc, TOK subop, int size) - : Expression(loc, TOKdefault, size) - { - this->subop = subop; -@@ -12517,7 +13840,7 @@ FileInitExp::FileInitExp(Loc loc) - Expression *FileInitExp::semantic(Scope *sc) - { - //printf("FileInitExp::semantic()\n"); -- type = Type::tchar->invariantOf()->arrayOf(); -+ type = Type::tstring; - return this; - } - -@@ -12551,15 +13874,144 @@ Expression *LineInitExp::resolveLoc(Loc - return e; - } - -+/****************************************************************/ -+ -+ModuleInitExp::ModuleInitExp(Loc loc) -+ : DefaultInitExp(loc, TOKmodulestring, sizeof(ModuleInitExp)) -+{ -+} -+ -+Expression *ModuleInitExp::semantic(Scope *sc) -+{ -+ //printf("ModuleInitExp::semantic()\n"); -+ type = Type::tstring; -+ return this; -+} -+ -+Expression *ModuleInitExp::resolveLoc(Loc loc, Scope *sc) -+{ -+ const char *s; -+ if (sc->callsc) -+ s = sc->callsc->module->toPrettyChars(); -+ else -+ s = sc->module->toPrettyChars(); -+ Expression *e = new StringExp(loc, (char *)s); -+ e = e->semantic(sc); -+ e = e->castTo(sc, type); -+ return e; -+} -+ -+/****************************************************************/ -+ -+FuncInitExp::FuncInitExp(Loc loc) -+ : DefaultInitExp(loc, TOKfuncstring, sizeof(FuncInitExp)) -+{ -+} -+ -+Expression *FuncInitExp::semantic(Scope *sc) -+{ -+ //printf("FuncInitExp::semantic()\n"); -+ type = Type::tstring; -+ if (sc->func) return this->resolveLoc(Loc(), sc); -+ return this; -+} -+ -+Expression *FuncInitExp::resolveLoc(Loc loc, Scope *sc) -+{ -+ const char *s; -+ if (sc->callsc && sc->callsc->func) -+ s = sc->callsc->func->Dsymbol::toPrettyChars(); -+ else if (sc->func) -+ s = sc->func->Dsymbol::toPrettyChars(); -+ else -+ s = ""; -+ Expression *e = new StringExp(loc, (char *)s); -+ e = e->semantic(sc); -+ e = e->castTo(sc, type); -+ return e; -+} -+ -+/****************************************************************/ -+ -+PrettyFuncInitExp::PrettyFuncInitExp(Loc loc) -+ : DefaultInitExp(loc, TOKprettyfunc, sizeof(PrettyFuncInitExp)) -+{ -+} -+ -+Expression *PrettyFuncInitExp::semantic(Scope *sc) -+{ -+ //printf("PrettyFuncInitExp::semantic()\n"); -+ type = Type::tstring; -+ if (sc->func) return this->resolveLoc(Loc(), sc); -+ return this; -+} -+ -+Expression *PrettyFuncInitExp::resolveLoc(Loc loc, Scope *sc) -+{ -+ FuncDeclaration *fd; -+ if (sc->callsc && sc->callsc->func) -+ fd = sc->callsc->func; -+ else -+ fd = sc->func; -+ -+ const char *s; -+ if (fd) -+ { -+ const char *funcStr = fd->Dsymbol::toPrettyChars(); -+ HdrGenState hgs; -+ OutBuffer buf; -+ functionToCBuffer2((TypeFunction *)fd->type, &buf, &hgs, 0, funcStr); -+ buf.writebyte(0); -+ s = (const char *)buf.extractData(); -+ } -+ else -+ { -+ s = ""; -+ } -+ -+ Expression *e = new StringExp(loc, (char *)s); -+ e = e->semantic(sc); -+ e = e->castTo(sc, type); -+ return e; -+} -+ -+Expression *extractOpDollarSideEffect(Scope *sc, UnaExp *ue) -+{ -+ Expression *e0 = NULL; -+ if (ue->e1->hasSideEffect()) -+ { -+ /* Even if opDollar is needed, 'ue->e1' should be evaluate only once. So -+ * Rewrite: -+ * ue->e1.opIndex( ... use of $ ... ) -+ * ue->e1.opSlice( ... use of $ ... ) -+ * as: -+ * (ref __dop = ue->e1, __dop).opIndex( ... __dop.opDollar ...) -+ * (ref __dop = ue->e1, __dop).opSlice( ... __dop.opDollar ...) -+ */ -+ Identifier *id = Lexer::uniqueId("__dop"); -+ ExpInitializer *ei = new ExpInitializer(ue->loc, ue->e1); -+ VarDeclaration *v = new VarDeclaration(ue->loc, ue->e1->type, id, ei); -+ v->storage_class |= STCctfe -+ | (ue->e1->isLvalue() ? (STCforeach | STCref) : 0); -+ e0 = new DeclarationExp(ue->loc, v); -+ e0 = e0->semantic(sc); -+ ue->e1 = new VarExp(ue->loc, v); -+ ue->e1 = ue->e1->semantic(sc); -+ } -+ return e0; -+} -+ - /************************************** - * Runs semantic on ae->arguments. Declares temporary variables - * if '$' was used. - */ - --ArrayExp *resolveOpDollar(Scope *sc, ArrayExp *ae) -+Expression *resolveOpDollar(Scope *sc, ArrayExp *ae) - { - assert(!ae->lengthVar); - -+ Expression *e0 = extractOpDollarSideEffect(sc, ae); -+ - for (size_t i = 0; i < ae->arguments->dim; i++) - { - // Create scope for '$' variable for this dimension -@@ -12575,16 +14027,18 @@ ArrayExp *resolveOpDollar(Scope *sc, Arr - e = resolveProperties(sc, e); - if (!e->type) - ae->error("%s has no value", e->toChars()); -- if (ae->lengthVar) -- { // If $ was used, declare it now -+ if (ae->lengthVar && sc->func) -+ { -+ // If $ was used, declare it now - Expression *de = new DeclarationExp(ae->loc, ae->lengthVar); -- e = new CommaExp(0, de, e); -+ e = new CommaExp(Loc(), de, e); - e = e->semantic(sc); - } - (*ae->arguments)[i] = e; - sc = sc->pop(); - } -- return ae; -+ -+ return e0; - } - - /************************************** -@@ -12592,12 +14046,14 @@ ArrayExp *resolveOpDollar(Scope *sc, Arr - * if '$' was used. - */ - --SliceExp *resolveOpDollar(Scope *sc, SliceExp *se) -+Expression *resolveOpDollar(Scope *sc, SliceExp *se) - { - assert(!se->lengthVar); - assert(!se->lwr || se->upr); - -- if (!se->lwr) return se; -+ if (!se->lwr) return NULL; -+ -+ Expression *e0 = extractOpDollarSideEffect(sc, se); - - // create scope for '$' - ArrayScopeSymbol *sym = new ArrayScopeSymbol(sc, se); -@@ -12612,15 +14068,78 @@ SliceExp *resolveOpDollar(Scope *sc, Sli - e = resolveProperties(sc, e); - if (!e->type) - se->error("%s has no value", e->toChars()); -- i == 0 ? se->lwr : se->upr = e; -+ (i == 0 ? se->lwr : se->upr) = e; - } - -- if (se->lengthVar) -- { // If $ was used, declare it now -+ if (se->lengthVar && sc->func) -+ { -+ // If $ was used, declare it now - Expression *de = new DeclarationExp(se->loc, se->lengthVar); -- se->lwr = new CommaExp(0, de, se->lwr); -+ se->lwr = new CommaExp(Loc(), de, se->lwr); - se->lwr = se->lwr->semantic(sc); - } - sc = sc->pop(); -- return se; -+ -+ return e0; -+} -+ -+Expression *BinExp::reorderSettingAAElem(Scope *sc) -+{ -+ if (this->e1->op != TOKindex) -+ return this; -+ IndexExp *ie = (IndexExp *)e1; -+ Type *t1 = ie->e1->type->toBasetype(); -+ if (t1->ty != Taarray) -+ return this; -+ -+ /* Check recursive conversion */ -+ VarDeclaration *var; -+ bool isrefvar = (e2->op == TOKvar && -+ (var = ((VarExp *)e2)->var->isVarDeclaration()) != NULL && -+ (var->storage_class & STCref)); -+ if (isrefvar) -+ return this; -+ -+ /* Fix evaluation order of setting AA element. (Bugzilla 3825) -+ * Rewrite: -+ * aa[key] op= val; -+ * as: -+ * ref __aatmp = aa; -+ * ref __aakey = key; -+ * ref __aaval = val; -+ * __aatmp[__aakey] op= __aaval; // assignment -+ */ -+ Expression *ec = NULL; -+ if (ie->e1->hasSideEffect()) -+ { -+ Identifier *id = Lexer::uniqueId("__aatmp"); -+ VarDeclaration *vd = new VarDeclaration(ie->e1->loc, ie->e1->type, id, new ExpInitializer(ie->e1->loc, ie->e1)); -+ Expression *de = new DeclarationExp(ie->e1->loc, vd); -+ if (ie->e1->isLvalue()) -+ vd->storage_class |= STCref | STCforeach; -+ ec = de; -+ ie->e1 = new VarExp(ie->e1->loc, vd); -+ } -+ if (ie->e2->hasSideEffect()) -+ { -+ Identifier *id = Lexer::uniqueId("__aakey"); -+ VarDeclaration *vd = new VarDeclaration(ie->e2->loc, ie->e2->type, id, new ExpInitializer(ie->e2->loc, ie->e2)); -+ if (ie->e2->isLvalue()) -+ vd->storage_class |= STCref | STCforeach; -+ Expression *de = new DeclarationExp(ie->e2->loc, vd); -+ -+ ec = ec ? new CommaExp(loc, ec, de) : de; -+ ie->e2 = new VarExp(ie->e2->loc, vd); -+ } -+ { -+ Identifier *id = Lexer::uniqueId("__aaval"); -+ VarDeclaration *vd = new VarDeclaration(loc, this->e2->type, id, new ExpInitializer(this->e2->loc, this->e2)); -+ vd->storage_class |= STCref | STCforeach | (this->e2->isLvalue() ? 0 : STCtemp); -+ Expression *de = new DeclarationExp(this->e2->loc, vd); -+ -+ ec = ec ? new CommaExp(loc, ec, de) : de; -+ this->e2 = new VarExp(this->e2->loc, vd); -+ } -+ ec = new CommaExp(loc, ec, this); -+ return ec->semantic(sc); - } ---- a/src/gcc/d/dfrontend/expression.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/expression.h 2014-04-01 16:32:51.000000000 +0100 -@@ -17,48 +17,53 @@ - #include "arraytypes.h" - #include "intrange.h" - --struct Type; --struct TypeVector; -+class Type; -+class TypeVector; - struct Scope; --struct TupleDeclaration; --struct VarDeclaration; --struct FuncDeclaration; --struct FuncLiteralDeclaration; --struct Declaration; --struct CtorDeclaration; --struct NewDeclaration; --struct Dsymbol; --struct Import; --struct Module; --struct ScopeDsymbol; -+class TupleDeclaration; -+class VarDeclaration; -+class FuncDeclaration; -+class FuncLiteralDeclaration; -+class Declaration; -+class CtorDeclaration; -+class NewDeclaration; -+class Dsymbol; -+class Import; -+class Module; -+class ScopeDsymbol; - struct InlineCostState; - struct InlineDoState; - struct InlineScanState; --struct Expression; --struct Declaration; --struct AggregateDeclaration; --struct StructDeclaration; --struct TemplateInstance; --struct TemplateDeclaration; --struct ClassDeclaration; -+class Expression; -+class Declaration; -+class AggregateDeclaration; -+class StructDeclaration; -+class TemplateInstance; -+class TemplateDeclaration; -+class ClassDeclaration; - struct HdrGenState; --struct BinExp; -+class BinExp; - struct InterState; - struct Symbol; // back end symbol --struct OverloadSet; --struct Initializer; --struct StringExp; -+class OverloadSet; -+class Initializer; -+class StringExp; -+class ArrayExp; -+class SliceExp; - - enum TOK; - - // Back end - struct IRState; -- - #ifdef IN_GCC --typedef union tree_node elem; - typedef union tree_node dt_t; - #else - struct dt_t; -+#endif -+ -+#ifdef IN_GCC -+typedef union tree_node elem; -+#else - struct elem; - #endif - -@@ -67,6 +72,7 @@ void initPrecedence(); - typedef int (*apply_fp_t)(Expression *, void *); - - Expression *resolveProperties(Scope *sc, Expression *e); -+Expression *resolvePropertiesOnly(Scope *sc, Expression *e1); - void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d); - Expression *build_overload(Loc loc, Scope *sc, Expression *ethis, Expression *earg, Dsymbol *d); - Dsymbol *search_function(ScopeDsymbol *ad, Identifier *funcid); -@@ -79,17 +85,21 @@ FuncDeclaration *hasThis(Scope *sc); - Expression *fromConstInitializer(int result, Expression *e); - int arrayExpressionCanThrow(Expressions *exps, bool mustNotThrow); - TemplateDeclaration *getFuncTemplateDecl(Dsymbol *s); --void valueNoDtor(Expression *e); -+Expression *valueNoDtor(Expression *e); - int modifyFieldVar(Loc loc, Scope *sc, VarDeclaration *var, Expression *e1); - #if DMDV2 - Expression *resolveAliasThis(Scope *sc, Expression *e); --Expression *callCpCtor(Loc loc, Scope *sc, Expression *e, int noscope); --int checkPostblit(Loc loc, Type *t); -+Expression *callCpCtor(Scope *sc, Expression *e); - #endif --struct ArrayExp *resolveOpDollar(Scope *sc, struct ArrayExp *ae); --struct SliceExp *resolveOpDollar(Scope *sc, struct SliceExp *se); -+Expression *resolveOpDollar(Scope *sc, ArrayExp *ae); -+Expression *resolveOpDollar(Scope *sc, SliceExp *se); - Expressions *arrayExpressionSemantic(Expressions *exps, Scope *sc); - -+/* Run CTFE on the expression, but allow the expression to be a TypeExp -+ * or a tuple containing a TypeExp. (This is required by pragma(msg)). -+ */ -+Expression *ctfeInterpretForPragmaMsg(Expression *e); -+ - /* Interpreter: what form of return value expression is required? - */ - enum CtfeGoal -@@ -100,15 +110,22 @@ enum CtfeGoal - ctfeNeedNothing // The return value is not required - }; - --struct Expression : Object -+#define WANTflags 1 -+#define WANTvalue 2 -+// Same as WANTvalue, but also expand variables as far as possible -+#define WANTexpand 8 -+ -+class Expression : public RootObject - { -+public: - Loc loc; // file location -- enum TOK op; // handy to minimize use of dynamic_cast -+ TOK op; // handy to minimize use of dynamic_cast - Type *type; // !=NULL means that semantic() has been run - unsigned char size; // # of bytes in Expression so we can copy() it - unsigned char parens; // if this is a parenthesized expression - -- Expression(Loc loc, enum TOK op, int size); -+ Expression(Loc loc, TOK op, int size); -+ static void init(); - Expression *copy(); - virtual Expression *syntaxCopy(); - virtual int apply(apply_fp_t fp, void *param); -@@ -143,7 +160,7 @@ struct Expression : Object - virtual MATCH implicitConvTo(Type *t); - virtual IntRange getIntRange(); - virtual Expression *castTo(Scope *sc, Type *t); -- virtual Expression *inferType(Type *t, int flag = 0, TemplateParameters *tparams = NULL); -+ virtual Expression *inferType(Type *t, int flag = 0, Scope *sc = NULL, TemplateParameters *tparams = NULL); - virtual void checkEscape(); - virtual void checkEscapeRef(); - virtual Expression *resolveLoc(Loc loc, Scope *sc); -@@ -153,8 +170,9 @@ struct Expression : Object - Expression *checkArithmetic(); - void checkDeprecated(Scope *sc, Dsymbol *s); - void checkPurity(Scope *sc, FuncDeclaration *f); -- void checkPurity(Scope *sc, VarDeclaration *v, Expression *e1); -+ void checkPurity(Scope *sc, VarDeclaration *v); - void checkSafety(Scope *sc, FuncDeclaration *f); -+ bool checkPostblit(Scope *sc, Type *t); - virtual int checkModifiable(Scope *sc, int flag = 0); - virtual Expression *checkToBoolean(Scope *sc); - virtual Expression *addDtorHook(Scope *sc); -@@ -167,12 +185,6 @@ struct Expression : Object - Expression *toDelegate(Scope *sc, Type *t); - - virtual Expression *optimize(int result, bool keepLvalue = false); -- #define WANTflags 1 -- #define WANTvalue 2 -- // A compile-time result is required. Give an error if not possible -- #define WANTinterpret 4 -- // Same as WANTvalue, but also expand variables as far as possible -- #define WANTexpand 8 - - // Entry point for CTFE. - // A compile-time result is required. Give an error if not possible -@@ -210,13 +222,14 @@ struct Expression : Object - virtual dt_t **toDt(dt_t **pdt); - }; - --struct IntegerExp : Expression -+class IntegerExp : public Expression - { -+public: - dinteger_t value; - - IntegerExp(Loc loc, dinteger_t value, Type *type); - IntegerExp(dinteger_t value); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - char *toChars(); -@@ -236,22 +249,25 @@ struct IntegerExp : Expression - dt_t **toDt(dt_t **pdt); - }; - --struct ErrorExp : IntegerExp -+class ErrorExp : public IntegerExp - { -+public: - ErrorExp(); - - Expression *implicitCastTo(Scope *sc, Type *t); -+ MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Expression *toLvalue(Scope *sc, Expression *e); - }; - --struct RealExp : Expression -+class RealExp : public Expression - { -+public: - real_t value; - - RealExp(Loc loc, real_t value, Type *type); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - char *toChars(); -@@ -269,12 +285,13 @@ struct RealExp : Expression - dt_t **toDt(dt_t **pdt); - }; - --struct ComplexExp : Expression -+class ComplexExp : public Expression - { -+public: - complex_t value; - - ComplexExp(Loc loc, complex_t value, Type *type); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - char *toChars(); -@@ -288,18 +305,17 @@ struct ComplexExp : Expression - int isBool(int result); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void toMangleBuffer(OutBuffer *buf); -- OutBuffer hexp; - elem *toElem(IRState *irs); - dt_t **toDt(dt_t **pdt); - }; - --struct IdentifierExp : Expression -+class IdentifierExp : public Expression - { -+public: - Identifier *ident; - Declaration *var; - - IdentifierExp(Loc loc, Identifier *ident); -- IdentifierExp(Loc loc, Declaration *var); - Expression *semantic(Scope *sc); - char *toChars(); - void dump(int indent); -@@ -308,17 +324,19 @@ struct IdentifierExp : Expression - Expression *toLvalue(Scope *sc, Expression *e); - }; - --struct DollarExp : IdentifierExp -+class DollarExp : public IdentifierExp - { -+public: - DollarExp(Loc loc); - }; - --struct DsymbolExp : Expression -+class DsymbolExp : public Expression - { -+public: - Dsymbol *s; -- int hasOverloads; -+ bool hasOverloads; - -- DsymbolExp(Loc loc, Dsymbol *s, int hasOverloads = 0); -+ DsymbolExp(Loc loc, Dsymbol *s, bool hasOverloads = false); - Expression *semantic(Scope *sc); - char *toChars(); - void dump(int indent); -@@ -327,8 +345,9 @@ struct DsymbolExp : Expression - Expression *toLvalue(Scope *sc, Expression *e); - }; - --struct ThisExp : Expression -+class ThisExp : public Expression - { -+public: - Declaration *var; - - ThisExp(Loc loc); -@@ -347,8 +366,9 @@ struct ThisExp : Expression - elem *toElem(IRState *irs); - }; - --struct SuperExp : ThisExp -+class SuperExp : public ThisExp - { -+public: - SuperExp(Loc loc); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -357,12 +377,13 @@ struct SuperExp : ThisExp - //Expression *inlineScan(InlineScanState *iss); - }; - --struct NullExp : Expression -+class NullExp : public Expression - { -+public: - unsigned char committed; // !=0 if type is committed - - NullExp(Loc loc, Type *t = NULL); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - int isBool(int result); - int isConst(); -@@ -376,20 +397,21 @@ struct NullExp : Expression - dt_t **toDt(dt_t **pdt); - }; - --struct StringExp : Expression -+class StringExp : public Expression - { -+public: - void *string; // char, wchar, or dchar data - size_t len; // number of chars, wchars, or dchars - unsigned char sz; // 1: char, 2: wchar, 4: dchar - unsigned char committed; // !=0 if type is committed -- unsigned char postfix; // 'c', 'w', 'd' -+ utf8_t postfix; // 'c', 'w', 'd' - bool ownedByCtfe; // true = created in CTFE - - StringExp(Loc loc, char *s); - StringExp(Loc loc, void *s, size_t len); -- StringExp(Loc loc, void *s, size_t len, unsigned char postfix); -+ StringExp(Loc loc, void *s, size_t len, utf8_t postfix); - //Expression *syntaxCopy(); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - size_t length(); -@@ -398,7 +420,7 @@ struct StringExp : Expression - Expression *implicitCastTo(Scope *sc, Type *t); - MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); -- int compare(Object *obj); -+ int compare(RootObject *obj); - int isBool(int result); - int isLvalue(); - Expression *toLvalue(Scope *sc, Expression *e); -@@ -412,15 +434,25 @@ struct StringExp : Expression - - // Tuple - --struct TupleExp : Expression -+class TupleExp : public Expression - { -+public: -+ Expression *e0; // side-effect part -+ /* Tuple-field access may need to take out its side effect part. -+ * For example: -+ * foo().tupleof -+ * is rewritten as: -+ * (ref __tup = foo(); tuple(__tup.field0, __tup.field1, ...)) -+ * The declaration of temporary variable __tup will be stored in TupleExp::e0. -+ */ - Expressions *exps; - -+ TupleExp(Loc loc, Expression *e0, Expressions *exps); - TupleExp(Loc loc, Expressions *exps); - TupleExp(Loc loc, TupleDeclaration *tup); - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); -- int equals(Object *o); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void checkEscape(); -@@ -433,8 +465,9 @@ struct TupleExp : Expression - Expression *inlineScan(InlineScanState *iss); - }; - --struct ArrayLiteralExp : Expression -+class ArrayLiteralExp : public Expression - { -+public: - Expressions *elements; - bool ownedByCtfe; // true = created in CTFE - -@@ -443,6 +476,7 @@ struct ArrayLiteralExp : Expression - - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - int isBool(int result); - elem *toElem(IRState *irs); -@@ -453,15 +487,19 @@ struct ArrayLiteralExp : Expression - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); -- Expression *inferType(Type *t, int flag = 0, TemplateParameters *tparams = NULL); -+ Expression *inferType(Type *t, int flag = 0, Scope *sc = NULL, TemplateParameters *tparams = NULL); - dt_t **toDt(dt_t **pdt); - -+ void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -+ Expression *buildArrayLoop(Parameters *fparams); -+ - Expression *doInline(InlineDoState *ids); - Expression *inlineScan(InlineScanState *iss); - }; - --struct AssocArrayLiteralExp : Expression -+class AssocArrayLiteralExp : public Expression - { -+public: - Expressions *keys; - Expressions *values; - bool ownedByCtfe; // true = created in CTFE -@@ -479,14 +517,28 @@ struct AssocArrayLiteralExp : Expression - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); -- Expression *inferType(Type *t, int flag = 0, TemplateParameters *tparams = NULL); -+ Expression *inferType(Type *t, int flag = 0, Scope *sc = NULL, TemplateParameters *tparams = NULL); - - Expression *doInline(InlineDoState *ids); - Expression *inlineScan(InlineScanState *iss); - }; - --struct StructLiteralExp : Expression -+// scrubReturnValue is running -+#define stageScrub 0x1 -+// hasNonConstPointers is running -+#define stageSearchPointers 0x2 -+// optimize is running -+#define stageOptimize 0x4 -+// apply is running -+#define stageApply 0x8 -+//inlineScan is running -+#define stageInlineScan 0x10 -+// toCBuffer is running -+#define stageToCBuffer 0x20 -+ -+class StructLiteralExp : public Expression - { -+public: - StructDeclaration *sd; // which aggregate this is for - Expressions *elements; // parallels sd->fields[] with - // NULL entries for fields to skip -@@ -497,13 +549,24 @@ struct StructLiteralExp : Expression - size_t soffset; // offset from start of s - int fillHoles; // fill alignment 'holes' with zero - bool ownedByCtfe; // true = created in CTFE -- int ctorinit; - -- StructLiteralExp(Loc loc, StructDeclaration *sd, Expressions *elements, Type *stype = NULL); -+ StructLiteralExp *origin; // pointer to the origin instance of the expression. -+ // once a new expression is created, origin is set to 'this'. -+ // anytime when an expression copy is created, 'origin' pointer is set to -+ // 'origin' pointer value of the original expression. -+ -+ StructLiteralExp *inlinecopy; // those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer. -+ int stageflags; // anytime when recursive function is calling, 'stageflags' marks with bit flag of -+ // current stage and unmarks before return from this function. -+ // 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline' -+ // (with infinite recursion) of this expression. - -+ StructLiteralExp(Loc loc, StructDeclaration *sd, Expressions *elements, Type *stype = NULL); -+ bool equals(RootObject *o); - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); - Expression *semantic(Scope *sc); -+ Expression *fill(bool ctorinit); - Expression *getField(Type *type, unsigned offset); - int getFieldIndex(Type *type, unsigned offset); - elem *toElem(IRState *irs); -@@ -512,17 +575,21 @@ struct StructLiteralExp : Expression - Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - dt_t **toDt(dt_t **pdt); -+ Symbol *toSymbol(); - MATCH implicitConvTo(Type *t); -+ Expression *castTo(Scope *sc, Type *t); - - int inlineCost3(InlineCostState *ics); - Expression *doInline(InlineDoState *ids); - Expression *inlineScan(InlineScanState *iss); - }; - --Expression *typeDotIdExp(Loc loc, Type *type, Identifier *ident); -+class DotIdExp; -+DotIdExp *typeDotIdExp(Loc loc, Type *type, Identifier *ident); - --struct TypeExp : Expression -+class TypeExp : public Expression - { -+public: - TypeExp(Loc loc, Type *type); - Expression *syntaxCopy(); - Expression *semantic(Scope *sc); -@@ -532,8 +599,9 @@ struct TypeExp : Expression - elem *toElem(IRState *irs); - }; - --struct ScopeExp : Expression -+class ScopeExp : public Expression - { -+public: - ScopeDsymbol *sds; - - ScopeExp(Loc loc, ScopeDsymbol *sds); -@@ -543,17 +611,22 @@ struct ScopeExp : Expression - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct TemplateExp : Expression -+class TemplateExp : public Expression - { -+public: - TemplateDeclaration *td; -+ FuncDeclaration *fd; - -- TemplateExp(Loc loc, TemplateDeclaration *td); -+ TemplateExp(Loc loc, TemplateDeclaration *td, FuncDeclaration *fd = NULL); - int rvalue(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -+ int isLvalue(); -+ Expression *toLvalue(Scope *sc, Expression *e); - }; - --struct NewExp : Expression -+class NewExp : public Expression - { -+public: - /* thisexp.new(newargs) newtype(arguments) - */ - Expression *thisexp; // if !NULL, 'this' for class being allocated -@@ -581,8 +654,9 @@ struct NewExp : Expression - //Expression *inlineScan(InlineScanState *iss); - }; - --struct NewAnonClassExp : Expression -+class NewAnonClassExp : public Expression - { -+public: - /* thisexp.new(newargs) class baseclasses { } (arguments) - */ - Expression *thisexp; // if !NULL, 'this' for class being allocated -@@ -599,12 +673,13 @@ struct NewAnonClassExp : Expression - }; - - #if DMDV2 --struct SymbolExp : Expression -+class SymbolExp : public Expression - { -+public: - Declaration *var; -- int hasOverloads; -+ bool hasOverloads; - -- SymbolExp(Loc loc, enum TOK op, int size, Declaration *var, int hasOverloads); -+ SymbolExp(Loc loc, TOK op, int size, Declaration *var, bool hasOverloads); - - elem *toElem(IRState *irs); - }; -@@ -612,12 +687,14 @@ struct SymbolExp : Expression - - // Offset from symbol - --struct SymOffExp : SymbolExp -+class SymOffExp : public SymbolExp - { -+public: - unsigned offset; - -- SymOffExp(Loc loc, Declaration *var, unsigned offset, int hasOverloads = 0); -+ SymOffExp(Loc loc, Declaration *var, unsigned offset, bool hasOverloads = false); - Expression *semantic(Scope *sc); -+ Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void checkEscape(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -632,10 +709,11 @@ struct SymOffExp : SymbolExp - - // Variable - --struct VarExp : SymbolExp -+class VarExp : public SymbolExp - { -- VarExp(Loc loc, Declaration *var, int hasOverloads = 0); -- int equals(Object *o); -+public: -+ VarExp(Loc loc, Declaration *var, bool hasOverloads = false); -+ bool equals(RootObject *o); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -@@ -658,25 +736,29 @@ struct VarExp : SymbolExp - #if DMDV2 - // Overload Set - --struct OverExp : Expression -+class OverExp : public Expression - { -+public: - OverloadSet *vars; - -- OverExp(OverloadSet *s); -+ OverExp(Loc loc, OverloadSet *s); - int isLvalue(); - Expression *toLvalue(Scope *sc, Expression *e); -+ void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - #endif - - // Function/Delegate literal - --struct FuncExp : Expression -+class FuncExp : public Expression - { -+public: - FuncLiteralDeclaration *fd; - TemplateDeclaration *td; -- enum TOK tok; -+ TOK tok; - - FuncExp(Loc loc, FuncLiteralDeclaration *fd, TemplateDeclaration *td = NULL); -+ void genIdent(Scope *sc); - Expression *syntaxCopy(); - Expression *semantic(Scope *sc); - Expression *semantic(Scope *sc, Expressions *arguments); -@@ -684,7 +766,7 @@ struct FuncExp : Expression - Expression *implicitCastTo(Scope *sc, Type *t); - MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); -- Expression *inferType(Type *t, int flag = 0, TemplateParameters *tparams = NULL); -+ Expression *inferType(Type *t, int flag = 0, Scope *sc = NULL, TemplateParameters *tparams = NULL); - char *toChars(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - elem *toElem(IRState *irs); -@@ -697,8 +779,9 @@ struct FuncExp : Expression - - // Declaration of a symbol - --struct DeclarationExp : Expression -+class DeclarationExp : public Expression - { -+public: - Dsymbol *declaration; - - DeclarationExp(Loc loc, Dsymbol *declaration); -@@ -713,19 +796,21 @@ struct DeclarationExp : Expression - Expression *inlineScan(InlineScanState *iss); - }; - --struct TypeidExp : Expression -+class TypeidExp : public Expression - { -- Object *obj; -+public: -+ RootObject *obj; - -- TypeidExp(Loc loc, Object *obj); -+ TypeidExp(Loc loc, RootObject *obj); - Expression *syntaxCopy(); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - - #if DMDV2 --struct TraitsExp : Expression -+class TraitsExp : public Expression - { -+public: - Identifier *ident; - Objects *args; - -@@ -736,8 +821,9 @@ struct TraitsExp : Expression - }; - #endif - --struct HaltExp : Expression -+class HaltExp : public Expression - { -+public: - HaltExp(Loc loc); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -745,20 +831,21 @@ struct HaltExp : Expression - elem *toElem(IRState *irs); - }; - --struct IsExp : Expression -+class IsExp : public Expression - { -+public: - /* is(targ id tok tspec) - * is(targ id == tok2) - */ - Type *targ; - Identifier *id; // can be NULL -- enum TOK tok; // ':' or '==' -+ TOK tok; // ':' or '==' - Type *tspec; // can be NULL -- enum TOK tok2; // 'struct', 'union', 'typedef', etc. -+ TOK tok2; // 'struct', 'union', 'typedef', etc. - TemplateParameters *parameters; - -- IsExp(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec, -- enum TOK tok2, TemplateParameters *parameters); -+ IsExp(Loc loc, Type *targ, Identifier *id, TOK tok, Type *tspec, -+ TOK tok2, TemplateParameters *parameters); - Expression *syntaxCopy(); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -766,19 +853,20 @@ struct IsExp : Expression - - /****************************************************************/ - --struct UnaExp : Expression -+class UnaExp : public Expression - { -+public: - Expression *e1; -+ Type *att1; // Save alias this type to detect recursion - -- UnaExp(Loc loc, enum TOK op, int size, Expression *e1); -+ UnaExp(Loc loc, TOK op, int size, Expression *e1); - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Expression *optimize(int result, bool keepLvalue = false); - void dump(int indent); -- Expression *interpretCommon(InterState *istate, CtfeGoal goal, -- Expression *(*fp)(Type *, Expression *)); -+ Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - Expression *resolveLoc(Loc loc, Scope *sc); - - Expression *doInline(InlineDoState *ids); -@@ -787,12 +875,19 @@ struct UnaExp : Expression - virtual Expression *op_overload(Scope *sc); - }; - --struct BinExp : Expression -+typedef Expression *(*fp_t)(Type *, Expression *, Expression *); -+typedef int (*fp2_t)(Loc loc, TOK, Expression *, Expression *); -+ -+class BinExp : public Expression - { -+public: - Expression *e1; - Expression *e2; - -- BinExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2); -+ Type *att1; // Save alias this type to detect recursion -+ Type *att2; // Save alias this type to detect recursion -+ -+ BinExp(Loc loc, TOK op, int size, Expression *e1, Expression *e2); - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); - Expression *semantic(Scope *sc); -@@ -806,12 +901,10 @@ struct BinExp : Expression - Expression *incompatibleTypes(); - void dump(int indent); - -- Expression *interpretCommon(InterState *istate, CtfeGoal goal, -- Expression *(*fp)(Type *, Expression *, Expression *)); -- Expression *interpretCompareCommon(InterState *istate, CtfeGoal goal, -- int (*fp)(Loc, TOK, Expression *, Expression *)); -- Expression *interpretAssignCommon(InterState *istate, CtfeGoal goal, -- Expression *(*fp)(Type *, Expression *, Expression *), int post = 0); -+ Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -+ Expression *interpretCommon(InterState *istate, CtfeGoal goal, fp_t fp); -+ Expression *interpretCompareCommon(InterState *istate, CtfeGoal goal, fp2_t fp); -+ Expression *interpretAssignCommon(InterState *istate, CtfeGoal goal, fp_t fp, int post = 0); - Expression *interpretFourPointerRelation(InterState *istate, CtfeGoal goal); - virtual Expression *arrayOp(Scope *sc); - -@@ -820,13 +913,18 @@ struct BinExp : Expression - - Expression *op_overload(Scope *sc); - Expression *compare_overload(Scope *sc, Identifier *id); -+ Expression *reorderSettingAAElem(Scope *sc); -+ -+ void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -+ Expression *buildArrayLoop(Parameters *fparams); - - elem *toElemBin(IRState *irs, int op); - }; - --struct BinAssignExp : BinExp -+class BinAssignExp : public BinExp - { -- BinAssignExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2) -+public: -+ BinAssignExp(Loc loc, TOK op, int size, Expression *e1, Expression *e2) - : BinExp(loc, op, size, e1, e2) - { - } -@@ -834,8 +932,13 @@ struct BinAssignExp : BinExp - Expression *semantic(Scope *sc); - Expression *arrayOp(Scope *sc); - -+ Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -+ - Expression *op_overload(Scope *sc); - -+ void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -+ Expression *buildArrayLoop(Parameters *fparams); -+ - int isLvalue(); - Expression *toLvalue(Scope *sc, Expression *ex); - Expression *modifiableLvalue(Scope *sc, Expression *e); -@@ -843,22 +946,25 @@ struct BinAssignExp : BinExp - - /****************************************************************/ - --struct CompileExp : UnaExp -+class CompileExp : public UnaExp - { -+public: - CompileExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct FileExp : UnaExp -+class FileExp : public UnaExp - { -+public: - FileExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct AssertExp : UnaExp -+class AssertExp : public UnaExp - { -+public: - Expression *msg; - - AssertExp(Loc loc, Expression *e, Expression *msg = NULL); -@@ -874,31 +980,35 @@ struct AssertExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct DotIdExp : UnaExp -+class DotIdExp : public UnaExp - { -+public: - Identifier *ident; - - DotIdExp(Loc loc, Expression *e, Identifier *ident); - Expression *semantic(Scope *sc); -- Expression *semantic(Scope *sc, int flag); -+ Expression *semanticX(Scope *sc); -+ Expression *semanticY(Scope *sc, int flag); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void dump(int i); - }; - --struct DotTemplateExp : UnaExp -+class DotTemplateExp : public UnaExp - { -+public: - TemplateDeclaration *td; - - DotTemplateExp(Loc loc, Expression *e, TemplateDeclaration *td); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct DotVarExp : UnaExp -+class DotVarExp : public UnaExp - { -+public: - Declaration *var; -- int hasOverloads; -+ bool hasOverloads; - -- DotVarExp(Loc loc, Expression *e, Declaration *var, int hasOverloads = 0); -+ DotVarExp(Loc loc, Expression *e, Declaration *var, bool hasOverloads = false); - Expression *semantic(Scope *sc); - int checkModifiable(Scope *sc, int flag); - int isLvalue(); -@@ -911,25 +1021,27 @@ struct DotVarExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct DotTemplateInstanceExp : UnaExp -+class DotTemplateInstanceExp : public UnaExp - { -+public: - TemplateInstance *ti; - - DotTemplateInstanceExp(Loc loc, Expression *e, Identifier *name, Objects *tiargs); - Expression *syntaxCopy(); -- TemplateDeclaration *getTempdecl(Scope *sc); -+ bool findTempDecl(Scope *sc); - Expression *semantic(Scope *sc); -- Expression *semantic(Scope *sc, int flag); -+ Expression *semanticY(Scope *sc, int flag); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void dump(int indent); - }; - --struct DelegateExp : UnaExp -+class DelegateExp : public UnaExp - { -+public: - FuncDeclaration *func; -- int hasOverloads; -+ bool hasOverloads; - -- DelegateExp(Loc loc, Expression *e, FuncDeclaration *func, int hasOverloads = 0); -+ DelegateExp(Loc loc, Expression *e, FuncDeclaration *func, bool hasOverloads = false); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - MATCH implicitConvTo(Type *t); -@@ -941,8 +1053,9 @@ struct DelegateExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct DotTypeExp : UnaExp -+class DotTypeExp : public UnaExp - { -+public: - Dsymbol *sym; // symbol that represents a type - - DotTypeExp(Loc loc, Expression *e, Dsymbol *sym); -@@ -951,8 +1064,9 @@ struct DotTypeExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct CallExp : UnaExp -+class CallExp : public UnaExp - { -+public: - Expressions *arguments; // function arguments - FuncDeclaration *f; // symbol to call - -@@ -963,7 +1077,6 @@ struct CallExp : UnaExp - - Expression *syntaxCopy(); - int apply(apply_fp_t fp, void *param); -- Expression *resolveUFCS(Scope *sc); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -@@ -980,8 +1093,9 @@ struct CallExp : UnaExp - Expression *inlineScan(InlineScanState *iss); - }; - --struct AddrExp : UnaExp -+class AddrExp : public UnaExp - { -+public: - AddrExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - void checkEscape(); -@@ -990,10 +1104,12 @@ struct AddrExp : UnaExp - Expression *castTo(Scope *sc, Type *t); - Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -+ dt_t **toDt(dt_t **pdt); - }; - --struct PtrExp : UnaExp -+class PtrExp : public UnaExp - { -+public: - PtrExp(Loc loc, Expression *e); - PtrExp(Loc loc, Expression *e, Type *t); - Expression *semantic(Scope *sc); -@@ -1011,12 +1127,12 @@ struct PtrExp : UnaExp - Identifier *opId(); - }; - --struct NegExp : UnaExp -+class NegExp : public UnaExp - { -+public: - NegExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); -@@ -1027,8 +1143,9 @@ struct NegExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct UAddExp : UnaExp -+class UAddExp : public UnaExp - { -+public: - UAddExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - -@@ -1036,12 +1153,12 @@ struct UAddExp : UnaExp - Identifier *opId(); - }; - --struct ComExp : UnaExp -+class ComExp : public UnaExp - { -+public: - ComExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void buildArrayIdent(OutBuffer *buf, Expressions *arguments); - Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); -@@ -1052,28 +1169,29 @@ struct ComExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct NotExp : UnaExp -+class NotExp : public UnaExp - { -+public: - NotExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - int isBit(); - elem *toElem(IRState *irs); - }; - --struct BoolExp : UnaExp -+class BoolExp : public UnaExp - { -+public: - BoolExp(Loc loc, Expression *e, Type *type); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - int isBit(); - elem *toElem(IRState *irs); - }; - --struct DeleteExp : UnaExp -+class DeleteExp : public UnaExp - { -+public: - DeleteExp(Loc loc, Expression *e); - Expression *semantic(Scope *sc); - Expression *checkToBoolean(Scope *sc); -@@ -1081,8 +1199,9 @@ struct DeleteExp : UnaExp - elem *toElem(IRState *irs); - }; - --struct CastExp : UnaExp -+class CastExp : public UnaExp - { -+public: - // Possible to cast to one type while painting to another type - Type *to; // type to cast to - unsigned mod; // MODxxxxx -@@ -1104,10 +1223,12 @@ struct CastExp : UnaExp - // For operator overloading - Identifier *opId(); - Expression *op_overload(Scope *sc); -+ dt_t **toDt(dt_t **pdt); - }; - --struct VectorExp : UnaExp -+class VectorExp : public UnaExp - { -+public: - TypeVector *to; // the target vector type before semantic() - unsigned dim; // number of elements in the vector - -@@ -1119,8 +1240,9 @@ struct VectorExp : UnaExp - dt_t **toDt(dt_t **pdt); - }; - --struct SliceExp : UnaExp -+class SliceExp : public UnaExp - { -+public: - Expression *upr; // NULL if implicit 0 - Expression *lwr; // NULL if implicit [length - 1] - VarDeclaration *lengthVar; -@@ -1137,6 +1259,9 @@ struct SliceExp : UnaExp - Expression *modifiableLvalue(Scope *sc, Expression *e); - int isBool(int result); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -+ Type *toStaticArrayType(); -+ MATCH implicitConvTo(Type *t); -+ Expression *castTo(Scope *sc, Type *t); - Expression *optimize(int result, bool keepLvalue = false); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void dump(int indent); -@@ -1148,8 +1273,9 @@ struct SliceExp : UnaExp - Expression *inlineScan(InlineScanState *iss); - }; - --struct ArrayLengthExp : UnaExp -+class ArrayLengthExp : public UnaExp - { -+public: - ArrayLengthExp(Loc loc, Expression *e1); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -@@ -1162,8 +1288,9 @@ struct ArrayLengthExp : UnaExp - - // e1[a0,a1,a2,a3,...] - --struct ArrayExp : UnaExp -+class ArrayExp : public UnaExp - { -+public: - Expressions *arguments; // Array of Expression's - size_t currentDimension; // for opDollar - VarDeclaration *lengthVar; -@@ -1186,15 +1313,17 @@ struct ArrayExp : UnaExp - - /****************************************************************/ - --struct DotExp : BinExp -+class DotExp : public BinExp - { -+public: - DotExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct CommaExp : BinExp -+class CommaExp : public BinExp - { -+public: - CommaExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - void checkEscape(); -@@ -1213,10 +1342,12 @@ struct CommaExp : BinExp - elem *toElem(IRState *irs); - }; - --struct IndexExp : BinExp -+class IndexExp : public BinExp - { -+public: - VarDeclaration *lengthVar; - int modifiable; -+ bool skipboundscheck; - - IndexExp(Loc loc, Expression *e1, Expression *e2); - Expression *syntaxCopy(); -@@ -1235,9 +1366,10 @@ struct IndexExp : BinExp - - /* For both i++ and i-- - */ --struct PostExp : BinExp -+class PostExp : public BinExp - { -- PostExp(enum TOK op, Loc loc, Expression *e); -+public: -+ PostExp(TOK op, Loc loc, Expression *e); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -1247,15 +1379,18 @@ struct PostExp : BinExp - - /* For both ++i and --i - */ --struct PreExp : UnaExp -+class PreExp : public UnaExp - { -- PreExp(enum TOK op, Loc loc, Expression *e); -+public: -+ PreExp(TOK op, Loc loc, Expression *e); - Expression *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct AssignExp : BinExp --{ int ismemset; // !=0 if setting the contents of an array -+class AssignExp : public BinExp -+{ -+public: -+ int ismemset; // !=0 if setting the contents of an array - - AssignExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); -@@ -1267,19 +1402,18 @@ struct AssignExp : BinExp - elem *toElem(IRState *irs); - }; - --struct ConstructExp : AssignExp -+class ConstructExp : public AssignExp - { -+public: - ConstructExp(Loc loc, Expression *e1, Expression *e2); - }; - - #define ASSIGNEXP(op) \ --struct op##AssignExp : BinAssignExp \ -+class op##AssignExp : public BinAssignExp \ - { \ -+public: \ - op##AssignExp(Loc loc, Expression *e1, Expression *e2); \ - S(Expression *semantic(Scope *sc);) \ -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); \ -- X(void buildArrayIdent(OutBuffer *buf, Expressions *arguments);) \ -- X(Expression *buildArrayLoop(Parameters *fparams);) \ - \ - Identifier *opId(); /* For operator overloading */ \ - \ -@@ -1322,14 +1456,12 @@ ASSIGNEXP(Cat) - #undef X - #undef ASSIGNEXP - --struct AddExp : BinExp -+class AddExp : public BinExp - { -+public: - AddExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1340,14 +1472,12 @@ struct AddExp : BinExp - elem *toElem(IRState *irs); - }; - --struct MinExp : BinExp -+class MinExp : public BinExp - { -+public: - MinExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1357,8 +1487,9 @@ struct MinExp : BinExp - elem *toElem(IRState *irs); - }; - --struct CatExp : BinExp -+class CatExp : public BinExp - { -+public: - CatExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -@@ -1371,14 +1502,12 @@ struct CatExp : BinExp - elem *toElem(IRState *irs); - }; - --struct MulExp : BinExp -+class MulExp : public BinExp - { -+public: - MulExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1389,14 +1518,12 @@ struct MulExp : BinExp - elem *toElem(IRState *irs); - }; - --struct DivExp : BinExp -+class DivExp : public BinExp - { -+public: - DivExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1406,14 +1533,12 @@ struct DivExp : BinExp - elem *toElem(IRState *irs); - }; - --struct ModExp : BinExp -+class ModExp : public BinExp - { -+public: - ModExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1424,14 +1549,12 @@ struct ModExp : BinExp - }; - - #if DMDV2 --struct PowExp : BinExp -+class PowExp : public BinExp - { -+public: - PowExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - - // For operator overloading - Identifier *opId(); -@@ -1441,12 +1564,12 @@ struct PowExp : BinExp - }; - #endif - --struct ShlExp : BinExp -+class ShlExp : public BinExp - { -+public: - ShlExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - IntRange getIntRange(); - - // For operator overloading -@@ -1456,12 +1579,12 @@ struct ShlExp : BinExp - elem *toElem(IRState *irs); - }; - --struct ShrExp : BinExp -+class ShrExp : public BinExp - { -+public: - ShrExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - IntRange getIntRange(); - - // For operator overloading -@@ -1471,12 +1594,12 @@ struct ShrExp : BinExp - elem *toElem(IRState *irs); - }; - --struct UshrExp : BinExp -+class UshrExp : public BinExp - { -+public: - UshrExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - IntRange getIntRange(); - - // For operator overloading -@@ -1486,14 +1609,12 @@ struct UshrExp : BinExp - elem *toElem(IRState *irs); - }; - --struct AndExp : BinExp -+class AndExp : public BinExp - { -+public: - AndExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - IntRange getIntRange(); - - // For operator overloading -@@ -1504,14 +1625,12 @@ struct AndExp : BinExp - elem *toElem(IRState *irs); - }; - --struct OrExp : BinExp -+class OrExp : public BinExp - { -+public: - OrExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - MATCH implicitConvTo(Type *t); - IntRange getIntRange(); - -@@ -1523,14 +1642,12 @@ struct OrExp : BinExp - elem *toElem(IRState *irs); - }; - --struct XorExp : BinExp -+class XorExp : public BinExp - { -+public: - XorExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -- void buildArrayIdent(OutBuffer *buf, Expressions *arguments); -- Expression *buildArrayLoop(Parameters *fparams); - MATCH implicitConvTo(Type *t); - IntRange getIntRange(); - -@@ -1542,8 +1659,9 @@ struct XorExp : BinExp - elem *toElem(IRState *irs); - }; - --struct OrOrExp : BinExp -+class OrOrExp : public BinExp - { -+public: - OrOrExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *checkToBoolean(Scope *sc); -@@ -1553,8 +1671,9 @@ struct OrOrExp : BinExp - elem *toElem(IRState *irs); - }; - --struct AndAndExp : BinExp -+class AndAndExp : public BinExp - { -+public: - AndAndExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *checkToBoolean(Scope *sc); -@@ -1564,12 +1683,12 @@ struct AndAndExp : BinExp - elem *toElem(IRState *irs); - }; - --struct CmpExp : BinExp -+class CmpExp : public BinExp - { -- CmpExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); -+public: -+ CmpExp(TOK op, Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - int isBit(); - - // For operator overloading -@@ -1580,8 +1699,9 @@ struct CmpExp : BinExp - elem *toElem(IRState *irs); - }; - --struct InExp : BinExp -+class InExp : public BinExp - { -+public: - InExp(Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); -@@ -1594,8 +1714,9 @@ struct InExp : BinExp - elem *toElem(IRState *irs); - }; - --struct RemoveExp : BinExp -+class RemoveExp : public BinExp - { -+public: - RemoveExp(Loc loc, Expression *e1, Expression *e2); - Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -1604,12 +1725,12 @@ struct RemoveExp : BinExp - - // == and != - --struct EqualExp : BinExp -+class EqualExp : public BinExp - { -- EqualExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); -+public: -+ EqualExp(TOK op, Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - int isBit(); - - // For operator overloading -@@ -1622,20 +1743,21 @@ struct EqualExp : BinExp - - // is and !is - --struct IdentityExp : BinExp -+class IdentityExp : public BinExp - { -- IdentityExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); -+public: -+ IdentityExp(TOK op, Loc loc, Expression *e1, Expression *e2); - Expression *semantic(Scope *sc); - int isBit(); - Expression *optimize(int result, bool keepLvalue = false); -- Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue); - elem *toElem(IRState *irs); - }; - - /****************************************************************/ - --struct CondExp : BinExp -+class CondExp : public BinExp - { -+public: - Expression *econd; - - CondExp(Loc loc, Expression *econd, Expression *e1, Expression *e2); -@@ -1654,7 +1776,7 @@ struct CondExp : BinExp - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - MATCH implicitConvTo(Type *t); - Expression *castTo(Scope *sc, Type *t); -- Expression *inferType(Type *t, int flag = 0, TemplateParameters *tparams = NULL); -+ Expression *inferType(Type *t, int flag = 0, Scope *sc = NULL, TemplateParameters *tparams = NULL); - - Expression *doInline(InlineDoState *ids); - Expression *inlineScan(InlineScanState *iss); -@@ -1665,38 +1787,66 @@ struct CondExp : BinExp - #if DMDV2 - /****************************************************************/ - --struct DefaultInitExp : Expression -+class DefaultInitExp : public Expression - { -- enum TOK subop; // which of the derived classes this is -+public: -+ TOK subop; // which of the derived classes this is - -- DefaultInitExp(Loc loc, enum TOK subop, int size); -+ DefaultInitExp(Loc loc, TOK subop, int size); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct FileInitExp : DefaultInitExp -+class FileInitExp : public DefaultInitExp - { -+public: - FileInitExp(Loc loc); - Expression *semantic(Scope *sc); - Expression *resolveLoc(Loc loc, Scope *sc); - }; - --struct LineInitExp : DefaultInitExp -+class LineInitExp : public DefaultInitExp - { -+public: - LineInitExp(Loc loc); - Expression *semantic(Scope *sc); - Expression *resolveLoc(Loc loc, Scope *sc); - }; -+ -+class ModuleInitExp : public DefaultInitExp -+{ -+public: -+ ModuleInitExp(Loc loc); -+ Expression *semantic(Scope *sc); -+ Expression *resolveLoc(Loc loc, Scope *sc); -+}; -+ -+class FuncInitExp : public DefaultInitExp -+{ -+public: -+ FuncInitExp(Loc loc); -+ Expression *semantic(Scope *sc); -+ Expression *resolveLoc(Loc loc, Scope *sc); -+}; -+ -+class PrettyFuncInitExp : public DefaultInitExp -+{ -+public: -+ PrettyFuncInitExp(Loc loc); -+ Expression *semantic(Scope *sc); -+ Expression *resolveLoc(Loc loc, Scope *sc); -+}; -+ - #endif - - /****************************************************************/ - - /* Special values used by the interpreter - */ --#define EXP_CANT_INTERPRET ((Expression *)1) --#define EXP_CONTINUE_INTERPRET ((Expression *)2) --#define EXP_BREAK_INTERPRET ((Expression *)3) --#define EXP_GOTO_INTERPRET ((Expression *)4) --#define EXP_VOID_INTERPRET ((Expression *)5) -+extern Expression *EXP_CANT_INTERPRET; -+extern Expression *EXP_CONTINUE_INTERPRET; -+extern Expression *EXP_BREAK_INTERPRET; -+extern Expression *EXP_GOTO_INTERPRET; -+extern Expression *EXP_VOID_INTERPRET; - - Expression *expType(Type *type, Expression *e); - -@@ -1723,9 +1873,9 @@ Expression *Xor(Type *type, Expression * - Expression *Index(Type *type, Expression *e1, Expression *e2); - Expression *Cat(Type *type, Expression *e1, Expression *e2); - --Expression *Equal(enum TOK op, Type *type, Expression *e1, Expression *e2); --Expression *Cmp(enum TOK op, Type *type, Expression *e1, Expression *e2); --Expression *Identity(enum TOK op, Type *type, Expression *e1, Expression *e2); -+Expression *Equal(TOK op, Type *type, Expression *e1, Expression *e2); -+Expression *Cmp(TOK op, Type *type, Expression *e1, Expression *e2); -+Expression *Identity(TOK op, Type *type, Expression *e1, Expression *e2); - - Expression *Slice(Type *type, Expression *e1, Expression *lwr, Expression *upr); - ---- a/src/gcc/d/dfrontend/file.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/file.c 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,514 @@ -+ -+// Copyright (c) 1999-2012 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#include "file.h" -+ -+#if defined (__sun) -+#include <alloca.h> -+#endif -+ -+#if _MSC_VER ||__MINGW32__ -+#include <malloc.h> -+#include <string> -+#endif -+ -+#if _WIN32 -+#include <windows.h> -+#include <direct.h> -+#include <errno.h> -+#endif -+ -+#if POSIX -+#include <sys/types.h> -+#include <sys/stat.h> -+#include <fcntl.h> -+#include <errno.h> -+#include <unistd.h> -+#include <utime.h> -+#endif -+ -+#include "filename.h" -+#include "array.h" -+#include "port.h" -+#include "rmem.h" -+ -+/****************************** File ********************************/ -+ -+File::File(const FileName *n) -+{ -+ ref = 0; -+ buffer = NULL; -+ len = 0; -+ touchtime = NULL; -+ name = (FileName *)n; -+} -+ -+File::File(const char *n) -+{ -+ ref = 0; -+ buffer = NULL; -+ len = 0; -+ touchtime = NULL; -+ name = new FileName(n); -+} -+ -+File::~File() -+{ -+ if (buffer) -+ { -+ if (ref == 0) -+ mem.free(buffer); -+#if _WIN32 -+ if (ref == 2) -+ UnmapViewOfFile(buffer); -+#endif -+ } -+ if (touchtime) -+ mem.free(touchtime); -+} -+ -+/************************************* -+ */ -+ -+int File::read() -+{ -+ if (len) -+ return 0; // already read the file -+#if POSIX -+ off_t size; -+ ssize_t numread; -+ int fd; -+ struct stat buf; -+ int result = 0; -+ char *name; -+ -+ name = this->name->toChars(); -+ //printf("File::read('%s')\n",name); -+ fd = open(name, O_RDONLY); -+ if (fd == -1) -+ { -+ //printf("\topen error, errno = %d\n",errno); -+ goto err1; -+ } -+ -+ if (!ref) -+ ::free(buffer); -+ ref = 0; // we own the buffer now -+ -+ //printf("\tfile opened\n"); -+ if (fstat(fd, &buf)) -+ { -+ printf("\tfstat error, errno = %d\n",errno); -+ goto err2; -+ } -+ size = buf.st_size; -+ buffer = (utf8_t *) ::malloc(size + 2); -+ if (!buffer) -+ { -+ printf("\tmalloc error, errno = %d\n",errno); -+ goto err2; -+ } -+ -+ numread = ::read(fd, buffer, size); -+ if (numread != size) -+ { -+ printf("\tread error, errno = %d\n",errno); -+ goto err2; -+ } -+ -+ if (touchtime) -+ memcpy(touchtime, &buf, sizeof(buf)); -+ -+ if (close(fd) == -1) -+ { -+ printf("\tclose error, errno = %d\n",errno); -+ goto err; -+ } -+ -+ len = size; -+ -+ // Always store a wchar ^Z past end of buffer so scanner has a sentinel -+ buffer[size] = 0; // ^Z is obsolete, use 0 -+ buffer[size + 1] = 0; -+ return 0; -+ -+err2: -+ close(fd); -+err: -+ ::free(buffer); -+ buffer = NULL; -+ len = 0; -+ -+err1: -+ result = 1; -+ return result; -+#elif _WIN32 -+ DWORD size; -+ DWORD numread; -+ HANDLE h; -+ int result = 0; -+ char *name; -+ -+ name = this->name->toChars(); -+ h = CreateFileA(name,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING, -+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL); -+ if (h == INVALID_HANDLE_VALUE) -+ goto err1; -+ -+ if (!ref) -+ ::free(buffer); -+ ref = 0; -+ -+ size = GetFileSize(h,NULL); -+ buffer = (utf8_t *) ::malloc(size + 2); -+ if (!buffer) -+ goto err2; -+ -+ if (ReadFile(h,buffer,size,&numread,NULL) != TRUE) -+ goto err2; -+ -+ if (numread != size) -+ goto err2; -+ -+ if (touchtime) -+ { -+ if (!GetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime)) -+ goto err2; -+ } -+ -+ if (!CloseHandle(h)) -+ goto err; -+ -+ len = size; -+ -+ // Always store a wchar ^Z past end of buffer so scanner has a sentinel -+ buffer[size] = 0; // ^Z is obsolete, use 0 -+ buffer[size + 1] = 0; -+ return 0; -+ -+err2: -+ CloseHandle(h); -+err: -+ ::free(buffer); -+ buffer = NULL; -+ len = 0; -+ -+err1: -+ result = 1; -+ return result; -+#else -+ assert(0); -+#endif -+} -+ -+/***************************** -+ * Read a file with memory mapped file I/O. -+ */ -+ -+int File::mmread() -+{ -+#if POSIX -+ return read(); -+#elif _WIN32 -+ HANDLE hFile; -+ HANDLE hFileMap; -+ DWORD size; -+ char *name; -+ -+ name = this->name->toChars(); -+ hFile = CreateFile(name, GENERIC_READ, -+ FILE_SHARE_READ, NULL, -+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -+ if (hFile == INVALID_HANDLE_VALUE) -+ goto Lerr; -+ size = GetFileSize(hFile, NULL); -+ //printf(" file created, size %d\n", size); -+ -+ hFileMap = CreateFileMapping(hFile,NULL,PAGE_READONLY,0,size,NULL); -+ if (CloseHandle(hFile) != TRUE) -+ goto Lerr; -+ -+ if (hFileMap == NULL) -+ goto Lerr; -+ -+ //printf(" mapping created\n"); -+ -+ if (!ref) -+ mem.free(buffer); -+ ref = 2; -+ buffer = (utf8_t *)MapViewOfFileEx(hFileMap, FILE_MAP_READ,0,0,size,NULL); -+ if (CloseHandle(hFileMap) != TRUE) -+ goto Lerr; -+ if (buffer == NULL) // mapping view failed -+ goto Lerr; -+ -+ len = size; -+ //printf(" buffer = %p\n", buffer); -+ -+ return 0; -+ -+Lerr: -+ return GetLastError(); // failure -+#else -+ assert(0); -+#endif -+} -+ -+/********************************************* -+ * Write a file. -+ * Returns: -+ * 0 success -+ */ -+ -+int File::write() -+{ -+#if POSIX -+ int fd; -+ ssize_t numwritten; -+ char *name; -+ -+ name = this->name->toChars(); -+ fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644); -+ if (fd == -1) -+ goto err; -+ -+ numwritten = ::write(fd, buffer, len); -+ if (len != numwritten) -+ goto err2; -+ -+ if (close(fd) == -1) -+ goto err; -+ -+ if (touchtime) -+ { struct utimbuf ubuf; -+ -+ ubuf.actime = ((struct stat *)touchtime)->st_atime; -+ ubuf.modtime = ((struct stat *)touchtime)->st_mtime; -+ if (utime(name, &ubuf)) -+ goto err; -+ } -+ return 0; -+ -+err2: -+ close(fd); -+ ::remove(name); -+err: -+ return 1; -+#elif _WIN32 -+ HANDLE h; -+ DWORD numwritten; -+ char *name; -+ -+ name = this->name->toChars(); -+ h = CreateFileA(name,GENERIC_WRITE,0,NULL,CREATE_ALWAYS, -+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL); -+ if (h == INVALID_HANDLE_VALUE) -+ goto err; -+ -+ if (WriteFile(h,buffer,len,&numwritten,NULL) != TRUE) -+ goto err2; -+ -+ if (len != numwritten) -+ goto err2; -+ -+ if (touchtime) { -+ SetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime); -+ } -+ if (!CloseHandle(h)) -+ goto err; -+ return 0; -+ -+err2: -+ CloseHandle(h); -+ DeleteFileA(name); -+err: -+ return 1; -+#else -+ assert(0); -+#endif -+} -+ -+/********************************************* -+ * Append to a file. -+ * Returns: -+ * 0 success -+ */ -+ -+int File::append() -+{ -+#if POSIX -+ return 1; -+#elif _WIN32 -+ HANDLE h; -+ DWORD numwritten; -+ char *name; -+ -+ name = this->name->toChars(); -+ h = CreateFileA(name,GENERIC_WRITE,0,NULL,OPEN_ALWAYS, -+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL); -+ if (h == INVALID_HANDLE_VALUE) -+ goto err; -+ -+#if 1 -+ SetFilePointer(h, 0, NULL, FILE_END); -+#else // INVALID_SET_FILE_POINTER doesn't seem to have a definition -+ if (SetFilePointer(h, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) -+ goto err; -+#endif -+ -+ if (WriteFile(h,buffer,len,&numwritten,NULL) != TRUE) -+ goto err2; -+ -+ if (len != numwritten) -+ goto err2; -+ -+ if (touchtime) { -+ SetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime); -+ } -+ if (!CloseHandle(h)) -+ goto err; -+ return 0; -+ -+err2: -+ CloseHandle(h); -+err: -+ return 1; -+#else -+ assert(0); -+#endif -+} -+ -+/******************************************* -+ * Return !=0 if file exists. -+ * 0: file doesn't exist -+ * 1: normal file -+ * 2: directory -+ */ -+ -+int File::exists() -+{ -+#if POSIX -+ return 0; -+#elif _WIN32 -+ DWORD dw; -+ int result; -+ char *name; -+ -+ name = this->name->toChars(); -+ if (touchtime) -+ dw = ((WIN32_FIND_DATAA *)touchtime)->dwFileAttributes; -+ else -+ dw = GetFileAttributesA(name); -+ if (dw == -1L) -+ result = 0; -+ else if (dw & FILE_ATTRIBUTE_DIRECTORY) -+ result = 2; -+ else -+ result = 1; -+ return result; -+#else -+ assert(0); -+#endif -+} -+ -+void File::remove() -+{ -+#if POSIX -+ int dummy = ::remove(this->name->toChars()); -+#elif _WIN32 -+ DeleteFileA(this->name->toChars()); -+#else -+ assert(0); -+#endif -+} -+ -+Files *File::match(char *n) -+{ -+ return match(new FileName(n)); -+} -+ -+Files *File::match(FileName *n) -+{ -+#if POSIX -+ return NULL; -+#elif _WIN32 -+ HANDLE h; -+ WIN32_FIND_DATAA fileinfo; -+ -+ Files *a = new Files(); -+ const char *c = n->toChars(); -+ const char *name = n->name(); -+ h = FindFirstFileA(c,&fileinfo); -+ if (h != INVALID_HANDLE_VALUE) -+ { -+ do -+ { -+ // Glue path together with name -+ char *fn; -+ File *f; -+ -+ fn = (char *)mem.malloc(name - c + strlen(&fileinfo.cFileName[0]) + 1); -+ memcpy(fn, c, name - c); -+ strcpy(fn + (name - c), &fileinfo.cFileName[0]); -+ f = new File(fn); -+ f->touchtime = mem.malloc(sizeof(WIN32_FIND_DATAA)); -+ memcpy(f->touchtime, &fileinfo, sizeof(fileinfo)); -+ a->push(f); -+ } while (FindNextFileA(h,&fileinfo) != FALSE); -+ FindClose(h); -+ } -+ return a; -+#else -+ assert(0); -+#endif -+} -+ -+int File::compareTime(File *f) -+{ -+#if POSIX -+ return 0; -+#elif _WIN32 -+ if (!touchtime) -+ stat(); -+ if (!f->touchtime) -+ f->stat(); -+ return CompareFileTime(&((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime, &((WIN32_FIND_DATAA *)f->touchtime)->ftLastWriteTime); -+#else -+ assert(0); -+#endif -+} -+ -+void File::stat() -+{ -+#if POSIX -+ if (!touchtime) -+ { -+ touchtime = mem.calloc(1, sizeof(struct stat)); -+ } -+#elif _WIN32 -+ HANDLE h; -+ -+ if (!touchtime) -+ { -+ touchtime = mem.calloc(1, sizeof(WIN32_FIND_DATAA)); -+ } -+ h = FindFirstFileA(name->toChars(),(WIN32_FIND_DATAA *)touchtime); -+ if (h != INVALID_HANDLE_VALUE) -+ { -+ FindClose(h); -+ } -+#else -+ assert(0); -+#endif -+} -+ -+char *File::toChars() -+{ -+ return name->toChars(); -+} ---- a/src/gcc/d/dfrontend/file.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/file.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,103 @@ -+ -+// Copyright (c) 1999-2011 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef FILE_H -+#define FILE_H -+ -+#if __DMC__ -+#pragma once -+#endif -+ -+#include <stddef.h> -+ -+#include "array.h" -+ -+template <typename TYPE> struct Array; -+typedef Array<struct File> Files; -+ -+struct FileName; -+ -+struct File -+{ -+ int ref; // != 0 if this is a reference to someone else's buffer -+ unsigned char *buffer; // data for our file -+ size_t len; // amount of data in buffer[] -+ void *touchtime; // system time to use for file -+ -+ FileName *name; // name of our file -+ -+ File(const char *); -+ File(const FileName *); -+ ~File(); -+ -+ char *toChars(); -+ -+ /* Read file, return !=0 if error -+ */ -+ -+ int read(); -+ -+ /* Read file, return !=0 if error -+ */ -+ -+ int mmread(); -+ -+ /* Write file, return !=0 if error -+ */ -+ -+ int write(); -+ -+ /* Return !=0 if file exists. -+ * 0: file doesn't exist -+ * 1: normal file -+ * 2: directory -+ */ -+ -+ /* Append to file, return !=0 if error -+ */ -+ -+ int append(); -+ -+ /* Return !=0 if file exists. -+ * 0: file doesn't exist -+ * 1: normal file -+ * 2: directory -+ */ -+ -+ int exists(); -+ -+ /* Given wildcard filespec, return an array of -+ * matching File's. -+ */ -+ -+ static Files *match(char *); -+ static Files *match(FileName *); -+ -+ // Compare file times. -+ // Return <0 this < f -+ // =0 this == f -+ // >0 this > f -+ int compareTime(File *f); -+ -+ // Read system file statistics -+ void stat(); -+ -+ /* Set buffer -+ */ -+ -+ void setbuffer(void *buffer, size_t len) -+ { -+ this->buffer = (unsigned char *)buffer; -+ this->len = len; -+ } -+ -+ void remove(); // delete file -+}; -+ -+#endif ---- a/src/gcc/d/dfrontend/filename.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/filename.c 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,690 @@ -+ -+// Copyright (c) 1999-2012 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#include "filename.h" -+ -+#include <stdint.h> -+#include <ctype.h> -+ -+#include "outbuffer.h" -+#include "array.h" -+#include "file.h" -+#include "rmem.h" -+ -+#if defined (__sun) -+#include <alloca.h> -+#endif -+ -+#if _MSC_VER ||__MINGW32__ -+#include <malloc.h> -+#include <string> -+#endif -+ -+#if _WIN32 -+#include <windows.h> -+#include <direct.h> -+#include <errno.h> -+#endif -+ -+#if POSIX -+#include <sys/types.h> -+#include <sys/stat.h> -+#include <fcntl.h> -+#include <errno.h> -+#include <unistd.h> -+#include <utime.h> -+#endif -+ -+/****************************** FileName ********************************/ -+ -+FileName::FileName(const char *str) -+ : str(mem.strdup(str)) -+{ -+} -+ -+const char *FileName::combine(const char *path, const char *name) -+{ char *f; -+ size_t pathlen; -+ size_t namelen; -+ -+ if (!path || !*path) -+ return (char *)name; -+ pathlen = strlen(path); -+ namelen = strlen(name); -+ f = (char *)mem.malloc(pathlen + 1 + namelen + 1); -+ memcpy(f, path, pathlen); -+#if POSIX -+ if (path[pathlen - 1] != '/') -+ { f[pathlen] = '/'; -+ pathlen++; -+ } -+#elif _WIN32 -+ if (path[pathlen - 1] != '\\' && -+ path[pathlen - 1] != '/' && -+ path[pathlen - 1] != ':') -+ { f[pathlen] = '\\'; -+ pathlen++; -+ } -+#else -+ assert(0); -+#endif -+ memcpy(f + pathlen, name, namelen + 1); -+ return f; -+} -+ -+// Split a path into an Array of paths -+Strings *FileName::splitPath(const char *path) -+{ -+ char c = 0; // unnecessary initializer is for VC /W4 -+ const char *p; -+ OutBuffer buf; -+ Strings *array; -+ -+ array = new Strings(); -+ if (path) -+ { -+ p = path; -+ do -+ { char instring = 0; -+ -+ while (isspace((utf8_t)*p)) // skip leading whitespace -+ p++; -+ buf.reserve(strlen(p) + 1); // guess size of path -+ for (; ; p++) -+ { -+ c = *p; -+ switch (c) -+ { -+ case '"': -+ instring ^= 1; // toggle inside/outside of string -+ continue; -+ -+#if MACINTOSH -+ case ',': -+#endif -+#if _WIN32 -+ case ';': -+#endif -+#if POSIX -+ case ':': -+#endif -+ p++; -+ break; // note that ; cannot appear as part -+ // of a path, quotes won't protect it -+ -+ case 0x1A: // ^Z means end of file -+ case 0: -+ break; -+ -+ case '\r': -+ continue; // ignore carriage returns -+ -+#if POSIX -+ case '~': -+ buf.writestring(getenv("HOME")); -+ continue; -+#endif -+ -+#if 0 -+ case ' ': -+ case '\t': // tabs in filenames? -+ if (!instring) // if not in string -+ break; // treat as end of path -+#endif -+ default: -+ buf.writeByte(c); -+ continue; -+ } -+ break; -+ } -+ if (buf.offset) // if path is not empty -+ { -+ buf.writeByte(0); // to asciiz -+ array->push(buf.extractData()); -+ } -+ } while (c); -+ } -+ return array; -+} -+ -+int FileName::compare(RootObject *obj) -+{ -+ return compare(str, ((FileName *)obj)->str); -+} -+ -+int FileName::compare(const char *name1, const char *name2) -+{ -+#if _WIN32 -+ return stricmp(name1, name2); -+#else -+ return strcmp(name1, name2); -+#endif -+} -+ -+bool FileName::equals(RootObject *obj) -+{ -+ return compare(obj) == 0; -+} -+ -+int FileName::equals(const char *name1, const char *name2) -+{ -+ return compare(name1, name2) == 0; -+} -+ -+/************************************ -+ * Return !=0 if absolute path name. -+ */ -+ -+int FileName::absolute(const char *name) -+{ -+#if _WIN32 -+ return (*name == '\\') || -+ (*name == '/') || -+ (*name && name[1] == ':'); -+#elif POSIX -+ return (*name == '/'); -+#else -+ assert(0); -+#endif -+} -+ -+/******************************** -+ * Return filename extension (read-only). -+ * Points past '.' of extension. -+ * If there isn't one, return NULL. -+ */ -+ -+const char *FileName::ext(const char *str) -+{ -+ size_t len = strlen(str); -+ -+ const char *e = str + len; -+ for (;;) -+ { -+ switch (*e) -+ { case '.': -+ return e + 1; -+#if POSIX -+ case '/': -+ break; -+#endif -+#if _WIN32 -+ case '\\': -+ case ':': -+ case '/': -+ break; -+#endif -+ default: -+ if (e == str) -+ break; -+ e--; -+ continue; -+ } -+ return NULL; -+ } -+} -+ -+const char *FileName::ext() -+{ -+ return ext(str); -+} -+ -+/******************************** -+ * Return mem.malloc'd filename with extension removed. -+ */ -+ -+const char *FileName::removeExt(const char *str) -+{ -+ const char *e = ext(str); -+ if (e) -+ { size_t len = (e - str) - 1; -+ char *n = (char *)mem.malloc(len + 1); -+ memcpy(n, str, len); -+ n[len] = 0; -+ return n; -+ } -+ return mem.strdup(str); -+} -+ -+/******************************** -+ * Return filename name excluding path (read-only). -+ */ -+ -+const char *FileName::name(const char *str) -+{ -+ size_t len = strlen(str); -+ -+ const char *e = str + len; -+ for (;;) -+ { -+ switch (*e) -+ { -+#if POSIX -+ case '/': -+ return e + 1; -+#endif -+#if _WIN32 -+ case '/': -+ case '\\': -+ return e + 1; -+ case ':': -+ /* The ':' is a drive letter only if it is the second -+ * character or the last character, -+ * otherwise it is an ADS (Alternate Data Stream) separator. -+ * Consider ADS separators as part of the file name. -+ */ -+ if (e == str + 1 || e == str + len - 1) -+ return e + 1; -+#endif -+ default: -+ if (e == str) -+ break; -+ e--; -+ continue; -+ } -+ return e; -+ } -+} -+ -+const char *FileName::name() -+{ -+ return name(str); -+} -+ -+/************************************** -+ * Return path portion of str. -+ * Path will does not include trailing path separator. -+ */ -+ -+const char *FileName::path(const char *str) -+{ -+ const char *n = name(str); -+ size_t pathlen; -+ -+ if (n > str) -+ { -+#if POSIX -+ if (n[-1] == '/') -+ n--; -+#elif _WIN32 -+ if (n[-1] == '\\' || n[-1] == '/') -+ n--; -+#else -+ assert(0); -+#endif -+ } -+ pathlen = n - str; -+ char *path = (char *)mem.malloc(pathlen + 1); -+ memcpy(path, str, pathlen); -+ path[pathlen] = 0; -+ return path; -+} -+ -+/************************************** -+ * Replace filename portion of path. -+ */ -+ -+const char *FileName::replaceName(const char *path, const char *name) -+{ -+ size_t pathlen; -+ size_t namelen; -+ -+ if (absolute(name)) -+ return name; -+ -+ const char *n = FileName::name(path); -+ if (n == path) -+ return name; -+ pathlen = n - path; -+ namelen = strlen(name); -+ char *f = (char *)mem.malloc(pathlen + 1 + namelen + 1); -+ memcpy(f, path, pathlen); -+#if POSIX -+ if (path[pathlen - 1] != '/') -+ { f[pathlen] = '/'; -+ pathlen++; -+ } -+#elif _WIN32 -+ if (path[pathlen - 1] != '\\' && -+ path[pathlen - 1] != '/' && -+ path[pathlen - 1] != ':') -+ { f[pathlen] = '\\'; -+ pathlen++; -+ } -+#else -+ assert(0); -+#endif -+ memcpy(f + pathlen, name, namelen + 1); -+ return f; -+} -+ -+/*************************** -+ * Free returned value with FileName::free() -+ */ -+ -+const char *FileName::defaultExt(const char *name, const char *ext) -+{ -+ const char *e = FileName::ext(name); -+ if (e) // if already has an extension -+ return mem.strdup(name); -+ -+ size_t len = strlen(name); -+ size_t extlen = strlen(ext); -+ char *s = (char *)mem.malloc(len + 1 + extlen + 1); -+ memcpy(s,name,len); -+ s[len] = '.'; -+ memcpy(s + len + 1, ext, extlen + 1); -+ return s; -+} -+ -+/*************************** -+ * Free returned value with FileName::free() -+ */ -+ -+const char *FileName::forceExt(const char *name, const char *ext) -+{ -+ const char *e = FileName::ext(name); -+ if (e) // if already has an extension -+ { -+ size_t len = e - name; -+ size_t extlen = strlen(ext); -+ -+ char *s = (char *)mem.malloc(len + extlen + 1); -+ memcpy(s,name,len); -+ memcpy(s + len, ext, extlen + 1); -+ return s; -+ } -+ else -+ return defaultExt(name, ext); // doesn't have one -+} -+ -+/****************************** -+ * Return !=0 if extensions match. -+ */ -+ -+int FileName::equalsExt(const char *ext) -+{ -+ return equalsExt(str, ext); -+} -+ -+int FileName::equalsExt(const char *name, const char *ext) -+{ -+ const char *e = FileName::ext(name); -+ if (!e && !ext) -+ return 1; -+ if (!e || !ext) -+ return 0; -+ return FileName::compare(e, ext) == 0; -+} -+ -+/************************************* -+ * Search Path for file. -+ * Input: -+ * cwd if !=0, search current directory before searching path -+ */ -+ -+const char *FileName::searchPath(Strings *path, const char *name, int cwd) -+{ -+ if (absolute(name)) -+ { -+ return exists(name) ? name : NULL; -+ } -+ if (cwd) -+ { -+ if (exists(name)) -+ return name; -+ } -+ if (path) -+ { -+ -+ for (size_t i = 0; i < path->dim; i++) -+ { -+ const char *p = (*path)[i]; -+ const char *n = combine(p, name); -+ -+ if (exists(n)) -+ return n; -+ } -+ } -+ return NULL; -+} -+ -+ -+/************************************* -+ * Search Path for file in a safe manner. -+ * -+ * Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory -+ * ('Path Traversal') attacks. -+ * http://cwe.mitre.org/data/definitions/22.html -+ * More info: -+ * https://www.securecoding.cert.org/confluence/display/seccode/FIO02-C.+Canonicalize+path+names+originating+from+untrusted+sources -+ * Returns: -+ * NULL file not found -+ * !=NULL mem.malloc'd file name -+ */ -+ -+const char *FileName::safeSearchPath(Strings *path, const char *name) -+{ -+#if _WIN32 -+ /* Disallow % / \ : and .. in name characters -+ */ -+ for (const char *p = name; *p; p++) -+ { -+ char c = *p; -+ if (c == '\\' || c == '/' || c == ':' || c == '%' || -+ (c == '.' && p[1] == '.')) -+ { -+ return NULL; -+ } -+ } -+ -+ return FileName::searchPath(path, name, 0); -+#elif POSIX -+ /* Even with realpath(), we must check for // and disallow it -+ */ -+ for (const char *p = name; *p; p++) -+ { -+ char c = *p; -+ if (c == '/' && p[1] == '/') -+ { -+ return NULL; -+ } -+ } -+ -+ if (path) -+ { -+ /* Each path is converted to a cannonical name and then a check is done to see -+ * that the searched name is really a child one of the the paths searched. -+ */ -+ for (size_t i = 0; i < path->dim; i++) -+ { -+ const char *cname = NULL; -+ const char *cpath = canonicalName((*path)[i]); -+ //printf("FileName::safeSearchPath(): name=%s; path=%s; cpath=%s\n", -+ // name, (char *)path->data[i], cpath); -+ if (cpath == NULL) -+ goto cont; -+ cname = canonicalName(combine(cpath, name)); -+ //printf("FileName::safeSearchPath(): cname=%s\n", cname); -+ if (cname == NULL) -+ goto cont; -+ //printf("FileName::safeSearchPath(): exists=%i " -+ // "strncmp(cpath, cname, %i)=%i\n", exists(cname), -+ // strlen(cpath), strncmp(cpath, cname, strlen(cpath))); -+ // exists and name is *really* a "child" of path -+ if (exists(cname) && strncmp(cpath, cname, strlen(cpath)) == 0) -+ { -+ ::free((void *)cpath); -+ const char *p = mem.strdup(cname); -+ ::free((void *)cname); -+ return p; -+ } -+cont: -+ if (cpath) -+ ::free((void *)cpath); -+ if (cname) -+ ::free((void *)cname); -+ } -+ } -+ return NULL; -+#else -+ assert(0); -+#endif -+} -+ -+ -+int FileName::exists(const char *name) -+{ -+#if POSIX -+ struct stat st; -+ -+ if (stat(name, &st) < 0) -+ return 0; -+ if (S_ISDIR(st.st_mode)) -+ return 2; -+ return 1; -+#elif _WIN32 -+ DWORD dw; -+ int result; -+ -+ dw = GetFileAttributesA(name); -+ if (dw == -1L) -+ result = 0; -+ else if (dw & FILE_ATTRIBUTE_DIRECTORY) -+ result = 2; -+ else -+ result = 1; -+ return result; -+#else -+ assert(0); -+#endif -+} -+ -+int FileName::ensurePathExists(const char *path) -+{ -+ //printf("FileName::ensurePathExists(%s)\n", path ? path : ""); -+ if (path && *path) -+ { -+ if (!exists(path)) -+ { -+ const char *p = FileName::path(path); -+ if (*p) -+ { -+#if _WIN32 -+ size_t len = strlen(path); -+ if ((len > 2 && p[-1] == ':' && strcmp(path + 2, p) == 0) || -+ len == strlen(p)) -+ { mem.free((void *)p); -+ return 0; -+ } -+#endif -+ int r = ensurePathExists(p); -+ mem.free((void *)p); -+ if (r) -+ return r; -+ } -+#if _WIN32 -+ char sep = '\\'; -+#elif POSIX -+ char sep = '/'; -+#endif -+ if (path[strlen(path) - 1] != sep) -+ { -+ //printf("mkdir(%s)\n", path); -+#if _WIN32 -+ int r = _mkdir(path); -+#endif -+#if POSIX -+ int r = mkdir(path, 0777); -+#endif -+ if (r) -+ { -+ /* Don't error out if another instance of dmd just created -+ * this directory -+ */ -+ if (errno != EEXIST) -+ return 1; -+ } -+ } -+ } -+ } -+ return 0; -+} -+ -+/****************************************** -+ * Return canonical version of name in a malloc'd buffer. -+ * This code is high risk. -+ */ -+const char *FileName::canonicalName(const char *name) -+{ -+#if linux -+ // Lovely glibc extension to do it for us -+ return canonicalize_file_name(name); -+#elif POSIX -+ #if _POSIX_VERSION >= 200809L || defined (linux) -+ // NULL destination buffer is allowed and preferred -+ return realpath(name, NULL); -+ #else -+ char *cname = NULL; -+ #if PATH_MAX -+ /* PATH_MAX must be defined as a constant in <limits.h>, -+ * otherwise using it is unsafe due to TOCTOU -+ */ -+ size_t path_max = (size_t)PATH_MAX; -+ if (path_max > 0) -+ { -+ /* Need to add one to PATH_MAX because of realpath() buffer overflow bug: -+ * http://isec.pl/vulnerabilities/isec-0011-wu-ftpd.txt -+ */ -+ cname = (char *)malloc(path_max + 1); -+ if (cname == NULL) -+ return NULL; -+ } -+ #endif -+ return realpath(name, cname); -+ #endif -+#elif _WIN32 -+ /* Apparently, there is no good way to do this on Windows. -+ * GetFullPathName isn't it, but use it anyway. -+ */ -+ DWORD result = GetFullPathName(name, 0, NULL, NULL); -+ if (result) -+ { -+ char *buf = (char *)malloc(result); -+ result = GetFullPathName(name, result, buf, NULL); -+ if (result == 0) -+ { -+ ::free(buf); -+ return NULL; -+ } -+ return buf; -+ } -+ return NULL; -+#else -+ assert(0); -+ return NULL; -+#endif -+} -+ -+/******************************** -+ * Free memory allocated by FileName routines -+ */ -+void FileName::free(const char *str) -+{ -+ if (str) -+ { assert(str[0] != 0xAB); -+ memset((void *)str, 0xAB, strlen(str) + 1); // stomp -+ } -+ mem.free((void *)str); -+} -+ -+char *FileName::toChars() -+{ -+ return (char *)str; // toChars() should really be const -+} ---- a/src/gcc/d/dfrontend/filename.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/filename.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,59 @@ -+ -+// Copyright (c) 1999-2011 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef FILENAME_H -+#define FILENAME_H -+ -+#if __DMC__ -+#pragma once -+#endif -+ -+#include "array.h" -+ -+class RootObject; -+ -+template <typename TYPE> struct Array; -+typedef Array<char> Strings; -+ -+struct FileName -+{ -+ const char *str; -+ FileName(const char *str); -+ bool equals(RootObject *obj); -+ static int equals(const char *name1, const char *name2); -+ int compare(RootObject *obj); -+ static int compare(const char *name1, const char *name2); -+ static int absolute(const char *name); -+ static const char *ext(const char *); -+ const char *ext(); -+ static const char *removeExt(const char *str); -+ static const char *name(const char *); -+ const char *name(); -+ static const char *path(const char *); -+ static const char *replaceName(const char *path, const char *name); -+ -+ static const char *combine(const char *path, const char *name); -+ static Strings *splitPath(const char *path); -+ static const char *defaultExt(const char *name, const char *ext); -+ static const char *forceExt(const char *name, const char *ext); -+ static int equalsExt(const char *name, const char *ext); -+ -+ int equalsExt(const char *ext); -+ -+ static const char *searchPath(Strings *path, const char *name, int cwd); -+ static const char *safeSearchPath(Strings *path, const char *name); -+ static int exists(const char *name); -+ static int ensurePathExists(const char *path); -+ static const char *canonicalName(const char *name); -+ -+ static void free(const char *str); -+ char *toChars(); -+}; -+ -+#endif ---- a/src/gcc/d/dfrontend/func.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/func.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -25,6 +25,11 @@ - #include "template.h" - #include "hdrgen.h" - #include "target.h" -+#include "parse.h" -+#include "rmem.h" -+ -+void functionToCBuffer2(TypeFunction *t, OutBuffer *buf, HdrGenState *hgs, int mod, const char *kind); -+void genCmain(Scope *sc); - - /********************************* FuncDeclaration ****************************/ - -@@ -60,14 +65,16 @@ FuncDeclaration::FuncDeclaration(Loc loc - parameters = NULL; - labtab = NULL; - overnext = NULL; -+ overnext0 = NULL; - vtblIndex = -1; - hasReturnExp = 0; - naked = 0; - inlineStatusExp = ILSuninitialized; - inlineStatusStmt = ILSuninitialized; - inlineNest = 0; -+ ctfeCode = NULL; - isArrayOp = 0; -- semanticRun = PASSinit; -+ dArrayOp = NULL; - semantic3Errors = 0; - #if DMDV1 - nestedFrameRef = 0; -@@ -118,7 +125,6 @@ void FuncDeclaration::semantic(Scope *sc - StructDeclaration *sd; - ClassDeclaration *cd; - InterfaceDeclaration *id; -- Dsymbol *pd; - bool doesoverride; - - #if 0 -@@ -139,25 +145,17 @@ void FuncDeclaration::semantic(Scope *sc - return; - } - -+ if (semanticRun >= PASSsemanticdone) -+ return; -+ assert(semanticRun <= PASSsemantic); -+ semanticRun = PASSsemantic; -+ - parent = sc->parent; - Dsymbol *parent = toParent(); - -- if (semanticRun >= PASSsemanticdone) -- { -- if (!parent->isClassDeclaration()) -- { -- return; -- } -- // need to re-run semantic() in order to set the class's vtbl[] -- } -- else -- { -- assert(semanticRun <= PASSsemantic); -- semanticRun = PASSsemantic; -- } -- - if (scope) -- { sc = scope; -+ { -+ sc = scope; - scope = NULL; - } - -@@ -174,6 +172,9 @@ void FuncDeclaration::semantic(Scope *sc - if (StructDeclaration *sd = ad->isStructDeclaration()) - sd->makeNested(); - } -+ // Remove prefix storage classes silently. -+ if ((storage_class & STC_TYPECTOR) && !(ad || isNested())) -+ storage_class &= ~STC_TYPECTOR; - - //printf("function storage_class = x%llx, sc->stc = x%llx, %x\n", storage_class, sc->stc, Declaration::isFinal()); - -@@ -186,12 +187,34 @@ void FuncDeclaration::semantic(Scope *sc - userAttributes = sc->userAttributes; - - if (!originalType) -- originalType = type; -+ originalType = type->syntaxCopy(); - if (!type->deco) - { - sc = sc->push(); - sc->stc |= storage_class & STCdisable; // forward to function type - TypeFunction *tf = (TypeFunction *)type; -+#if 1 -+ /* If the parent is @safe, then this function defaults to safe -+ * too. -+ * If the parent's @safe-ty is inferred, then this function's @safe-ty needs -+ * to be inferred first. -+ */ -+ if (tf->trust == TRUSTdefault && -+ !(//isFuncLiteralDeclaration() || -+ parent->isTemplateInstance() || -+ ad && ad->parent && ad->parent->isTemplateInstance())) -+ { -+ for (Dsymbol *p = sc->func; p; p = p->toParent2()) -+ { FuncDeclaration *fd = p->isFuncDeclaration(); -+ if (fd) -+ { -+ if (fd->isSafeBypassingInference()) -+ tf->trust = TRUSTsafe; // default to @safe -+ break; -+ } -+ } -+ } -+#endif - if (tf->isref) sc->stc |= STCref; - if (tf->isnothrow) sc->stc |= STCnothrow; - if (tf->isproperty) sc->stc |= STCproperty; -@@ -201,10 +224,37 @@ void FuncDeclaration::semantic(Scope *sc - if (tf->trust == TRUSTtrusted) sc->stc |= STCtrusted; - - if (isCtorDeclaration()) -+ { - sc->flags |= SCOPEctor; - -+ Type *tret; -+ if (!ad || parent->isUnionDeclaration()) -+ { -+ error("constructors are only for class or struct definitions"); -+ tret = Type::tvoid; -+ } -+ else -+ { tret = ad->handle; -+ assert(tret); -+ tret = tret->addStorageClass(storage_class | sc->stc); -+ tret = tret->addMod(type->mod); -+ } -+ tf->next = tret; -+ -+ if (ad && ad->isStructDeclaration()) -+ sc->stc |= STCref; -+ } -+ - sc->linkage = linkage; - -+ if (!tf->isNaked() && !(isThis() || isNested())) -+ { -+ OutBuffer buf; -+ MODtoBuffer(&buf, tf->mod); -+ error("without 'this' cannot be %s", buf.toChars()); -+ tf->mod = 0; // remove qualifiers -+ } -+ - /* Apply const, immutable, wild and shared storage class - * to the function type. Do this before type semantic. - */ -@@ -270,38 +320,33 @@ void FuncDeclaration::semantic(Scope *sc - error("%s must be a function instead of %s", toChars(), type->toChars()); - return; - } -- f = (TypeFunction *)(type); -+ f = (TypeFunction *)type; - size_t nparams = Parameter::dim(f->parameters); - -- /* Purity and safety can be inferred for some functions by examining -- * the function body. -- */ -- if (fbody && -- (isFuncLiteralDeclaration() || parent->isTemplateInstance())) -- { -- if (f->purity == PUREimpure) // purity not specified -- flags |= FUNCFLAGpurityInprocess; -- -- if (f->trust == TRUSTdefault) -- flags |= FUNCFLAGsafetyInprocess; -- -- if (!f->isnothrow) -- flags |= FUNCFLAGnothrowInprocess; -- } -- - if (storage_class & STCscope) - error("functions cannot be scope"); - - if (isAbstract() && !isVirtual()) -- error("non-virtual functions cannot be abstract"); -+ { -+ const char *sfunc; -+ if (isStatic()) -+ sfunc = "static"; -+ else if (protection == PROTprivate || protection == PROTpackage) -+ sfunc = Pprotectionnames[protection]; -+ else -+ sfunc = "non-virtual"; -+ error("%s functions cannot be abstract", sfunc); -+ } - - if (isOverride() && !isVirtual()) -- error("cannot override a non-virtual function"); -- -- if ((f->isConst() || f->isImmutable()) && !isThis()) -- error("without 'this' cannot be const/immutable"); -+ { -+ if ((prot() == PROTprivate || prot() == PROTpackage) && isMember()) -+ error("%s method is not virtual and cannot override", Pprotectionnames[prot()]); -+ else -+ error("cannot override a non-virtual function"); -+ } - -- if (isAbstract() && isFinal()) -+ if (isAbstract() && isFinalFunc()) - error("cannot be both final and abstract"); - #if 0 - if (isAbstract() && fbody) -@@ -337,8 +382,8 @@ void FuncDeclaration::semantic(Scope *sc - error("special member functions not allowed for %ss", sd->kind()); - } - -- if (!sd->inv) -- sd->inv = isInvariantDeclaration(); -+ if (isInvariantDeclaration()) -+ sd->invs.push(this); - - if (!sd->aggNew) - sd->aggNew = isNewDeclaration(); -@@ -376,11 +421,8 @@ void FuncDeclaration::semantic(Scope *sc - - cd = parent->isClassDeclaration(); - if (cd) -- { size_t vi; -- CtorDeclaration *ctor; -- DtorDeclaration *dtor; -- InvariantDeclaration *inv; -- -+ { -+ size_t vi; - if (isCtorDeclaration()) - { - // ctor = (CtorDeclaration *)this; -@@ -389,35 +431,6 @@ void FuncDeclaration::semantic(Scope *sc - goto Ldone; - } - --#if 0 -- dtor = isDtorDeclaration(); -- if (dtor) -- { -- if (cd->dtor) -- error("multiple destructors for class %s", cd->toChars()); -- cd->dtor = dtor; -- } -- -- inv = isInvariantDeclaration(); -- if (inv) -- { -- cd->inv = inv; -- } -- -- if (isNewDeclaration()) -- { -- if (!cd->aggNew) -- cd->aggNew = (NewDeclaration *)(this); -- } -- -- if (isDelete()) -- { -- if (cd->aggDelete) -- error("multiple delete's for class %s", cd->toChars()); -- cd->aggDelete = (DeleteDeclaration *)(this); -- } --#endif -- - if (storage_class & STCabstract) - cd->isabstract = 1; - -@@ -431,6 +444,34 @@ void FuncDeclaration::semantic(Scope *sc - if (type->nextOf() == Type::terror) - goto Ldone; - -+ bool may_override = false; -+ for (size_t i = 0; i < cd->baseclasses->dim; i++) -+ { -+ BaseClass *b = (*cd->baseclasses)[i]; -+ ClassDeclaration *cbd = b->type->toBasetype()->isClassHandle(); -+ if (!cbd) -+ continue; -+ for (size_t j = 0; j < cbd->vtbl.dim; j++) -+ { -+ FuncDeclaration *f = cbd->vtbl[j]->isFuncDeclaration(); -+ if (!f || f->ident != ident) -+ continue; -+ if (cbd->parent && cbd->parent->isTemplateInstance()) -+ { -+ if (!f->functionSemantic()) -+ goto Ldone; -+ } -+ may_override = true; -+ } -+ } -+ if (may_override && type->nextOf() == NULL) -+ { -+ /* If same name function exists in base class but 'this' is auto return, -+ * cannot find index of base class's vtbl[] to override. -+ */ -+ error("return type inference is not supported if may override base class function"); -+ } -+ - /* Find index of existing function in base class's vtbl[] to override - * (the index will be the same as in cd's current vtbl[]) - */ -@@ -440,7 +481,7 @@ void FuncDeclaration::semantic(Scope *sc - doesoverride = FALSE; - switch (vi) - { -- case -1: -+ case (size_t)-1: - Lintro: - /* Didn't find one, so - * This is an 'introducing' function which gets a new -@@ -453,13 +494,16 @@ void FuncDeclaration::semantic(Scope *sc - if (s) - { - FuncDeclaration *f = s->isFuncDeclaration(); -- f = f->overloadExactMatch(type); -- if (f && f->isFinal() && f->prot() != PROTprivate) -- error("cannot override final function %s", f->toPrettyChars()); -+ if (f) -+ { -+ f = f->overloadExactMatch(type); -+ if (f && f->isFinalFunc() && f->prot() != PROTprivate) -+ error("cannot override final function %s", f->toPrettyChars()); -+ } - } - } - -- if (isFinal()) -+ if (isFinalFunc()) - { - // Don't check here, as it may override an interface function - //if (isOverride()) -@@ -477,7 +521,7 @@ void FuncDeclaration::semantic(Scope *sc - } - break; - -- case -2: // can't determine because of fwd refs -+ case (size_t)-2: // can't determine because of fwd refs - cd->sizeok = SIZEOKfwd; // can't finish due to forward reference - Module::dprogress = dprogress_save; - return; -@@ -487,6 +531,12 @@ void FuncDeclaration::semantic(Scope *sc - FuncDeclaration *fdc = cd->vtbl[vi]->isFuncDeclaration(); - // This function is covariant with fdv - -+ if (fdc == this) -+ { -+ doesoverride = TRUE; -+ break; -+ } -+ - if (fdc->toParent() == parent) - { - //printf("vi = %d,\tthis = %p %s %s @ [%s]\n\tfdc = %p %s %s @ [%s]\n\tfdv = %p %s %s @ [%s]\n", -@@ -500,7 +550,7 @@ void FuncDeclaration::semantic(Scope *sc - } - - // This function overrides fdv -- if (fdv->isFinal()) -+ if (fdv->isFinalFunc()) - error("cannot override final function %s", fdv->toPrettyChars()); - - doesoverride = TRUE; -@@ -566,10 +616,10 @@ void FuncDeclaration::semantic(Scope *sc - vi = findVtblIndex((Dsymbols *)&b->base->vtbl, b->base->vtbl.dim); - switch (vi) - { -- case -1: -+ case (size_t)-1: - break; - -- case -2: -+ case (size_t)-2: - cd->sizeok = SIZEOKfwd; // can't finish due to forward reference - Module::dprogress = dprogress_save; - return; -@@ -633,7 +683,7 @@ void FuncDeclaration::semantic(Scope *sc - } - } - -- if (!doesoverride && isOverride()) -+ if (!doesoverride && isOverride() && type->nextOf()) - { - Dsymbol *s = NULL; - for (size_t i = 0; i < cd->baseclasses->dim; i++) -@@ -665,7 +715,7 @@ void FuncDeclaration::semantic(Scope *sc - if (f) - { - f = f->overloadExactMatch(type); -- if (f && f->isFinal() && f->prot() != PROTprivate) -+ if (f && f->isFinalFunc() && f->prot() != PROTprivate) - error("cannot override final function %s.%s", b->base->toChars(), f->toPrettyChars()); - } - } -@@ -675,6 +725,10 @@ void FuncDeclaration::semantic(Scope *sc - else if (isOverride() && !parent->isTemplateInstance()) - error("override only applies to class member functions"); - -+ // Reflect this->type to f because it could be changed by findVtblIndex -+ assert(type->ty == Tfunction); -+ f = (TypeFunction *)type; -+ - /* Do not allow template instances to add virtual functions - * to a class. - */ -@@ -742,13 +796,17 @@ void FuncDeclaration::semantic(Scope *sc - * can call them. - */ - if (frequire) -- { /* in { ... } -+ { -+ /* in { ... } - * becomes: - * void __require() { ... } - * __require(); - */ - Loc loc = frequire->loc; - TypeFunction *tf = new TypeFunction(NULL, Type::tvoid, 0, LINKd); -+ tf->isnothrow = f->isnothrow; -+ tf->purity = f->purity; -+ tf->trust = f->trust; - FuncDeclaration *fd = new FuncDeclaration(loc, loc, - Id::require, STCundefined, tf); - fd->fbody = frequire; -@@ -763,9 +821,10 @@ void FuncDeclaration::semantic(Scope *sc - outId = Id::result; // provide a default - - if (fensure) -- { /* out (result) { ... } -+ { -+ /* out (result) { ... } - * becomes: -- * tret __ensure(ref tret result) { ... } -+ * void __ensure(ref tret result) { ... } - * __ensure(result); - */ - Loc loc = fensure->loc; -@@ -776,6 +835,9 @@ void FuncDeclaration::semantic(Scope *sc - arguments->push(a); - } - TypeFunction *tf = new TypeFunction(arguments, Type::tvoid, 0, LINKd); -+ tf->isnothrow = f->isnothrow; -+ tf->purity = f->purity; -+ tf->trust = f->trust; - FuncDeclaration *fd = new FuncDeclaration(loc, loc, - Id::ensure, STCundefined, tf); - fd->fbody = fensure; -@@ -791,6 +853,26 @@ void FuncDeclaration::semantic(Scope *sc - } - - Ldone: -+ /* Purity and safety can be inferred for some functions by examining -+ * the function body. -+ */ -+ if (fbody && -+ (isFuncLiteralDeclaration() || -+ parent->isTemplateInstance() || -+ ad && ad->parent && ad->parent->isTemplateInstance() && !isVirtualMethod())) -+ { -+ /* isVirtualMethod() needs setting correct foverrides -+ */ -+ if (f->purity == PUREimpure) // purity not specified -+ flags |= FUNCFLAGpurityInprocess; -+ -+ if (f->trust == TRUSTdefault) -+ flags |= FUNCFLAGsafetyInprocess; -+ -+ if (!f->isnothrow) -+ flags |= FUNCFLAGnothrowInprocess; -+ } -+ - Module::dprogress++; - semanticRun = PASSsemanticdone; - -@@ -799,6 +881,24 @@ Ldone: - */ - scope = new Scope(*sc); - scope->setNoFree(); -+ -+ static bool printedMain = false; // semantic might run more than once -+ if (global.params.verbose && !printedMain) -+ { -+ const char *type = isMain() ? "main" : isWinMain() ? "winmain" : isDllMain() ? "dllmain" : (const char *)NULL; -+ Module *mod = sc->module; -+ -+ if (type && mod) -+ { -+ printedMain = true; -+ const char *name = FileName::searchPath(global.path, mod->srcfile->toChars(), 1); -+ fprintf(global.stdmsg, "entry %-10s\t%s\n", type, name); -+ } -+ } -+ -+ if (fbody && isMain() && sc->module->isRoot()) -+ genCmain(sc); -+ - return; - } - -@@ -835,7 +935,7 @@ void FuncDeclaration::semantic3(Scope *s - - if (!type || type->ty != Tfunction) - return; -- f = (TypeFunction *)(type); -+ f = (TypeFunction *)type; - if (!inferRetType && f->next->ty == Terror) - return; - -@@ -875,7 +975,7 @@ void FuncDeclaration::semantic3(Scope *s - } - - frequire = mergeFrequire(frequire); -- fensure = mergeFensure(fensure); -+ fensure = mergeFensure(fensure, outId); - - if (fbody || frequire || fensure) - { -@@ -903,11 +1003,15 @@ void FuncDeclaration::semantic3(Scope *s - sc2->protection = PROTpublic; - sc2->explicitProtection = 0; - sc2->structalign = STRUCTALIGN_DEFAULT; -- sc2->flags = sc->flags & ~SCOPEcontract; -+ if (this->ident != Id::require && this->ident != Id::ensure) -+ sc2->flags = sc->flags & ~SCOPEcontract; - sc2->tf = NULL; - sc2->noctor = 0; - sc2->speculative = sc->speculative || isSpeculative() != NULL; - sc2->userAttributes = NULL; -+ if (sc2->intypeof == 1) sc2->intypeof = 2; -+ sc2->fieldinit = NULL; -+ sc2->fieldinit_dim = 0; - - // Declare 'this' - AggregateDeclaration *ad = isThis(); -@@ -950,15 +1054,15 @@ void FuncDeclaration::semantic3(Scope *s - - if (f->linkage == LINKd) - { // Declare _arguments[] -- v_arguments = new VarDeclaration(0, Type::typeinfotypelist->type, Id::_arguments_typeinfo, NULL); -+ v_arguments = new VarDeclaration(Loc(), Type::typeinfotypelist->type, Id::_arguments_typeinfo, NULL); - v_arguments->storage_class = STCparameter; - v_arguments->semantic(sc2); - sc2->insert(v_arguments); - v_arguments->parent = this; - - //t = Type::typeinfo->type->constOf()->arrayOf(); -- t = Type::typeinfo->type->arrayOf(); -- _arguments = new VarDeclaration(0, t, Id::_arguments, NULL); -+ t = Type::dtypeinfo->type->arrayOf(); -+ _arguments = new VarDeclaration(Loc(), t, Id::_arguments, NULL); - _arguments->semantic(sc2); - sc2->insert(_arguments); - _arguments->parent = this; -@@ -966,7 +1070,7 @@ void FuncDeclaration::semantic3(Scope *s - if (f->linkage == LINKd || (f->parameters && Parameter::dim(f->parameters))) - { // Declare _argptr - t = Type::tvalist; -- argptr = new VarDeclaration(0, t, Id::_argptr, NULL); -+ argptr = new VarDeclaration(Loc(), t, Id::_argptr, NULL); - argptr->semantic(sc2); - sc2->insert(argptr); - argptr->parent = this; -@@ -1015,8 +1119,6 @@ void FuncDeclaration::semantic3(Scope *s - arg->ident = id = Identifier::generateId("_param_", i); - } - Type *vtype = arg->type; -- //if (isPure()) -- //vtype = vtype->addMod(MODconst); - VarDeclaration *v = new VarDeclaration(loc, vtype, id, NULL); - //printf("declaring parameter %s of type %s\n", v->toChars(), v->type->toChars()); - v->storage_class |= STCparameter; -@@ -1050,7 +1152,7 @@ void FuncDeclaration::semantic3(Scope *s - for (size_t j = 0; j < dim; j++) - { Parameter *narg = Parameter::getNth(t->arguments, j); - assert(narg->ident); -- VarDeclaration *v = sc2->search(0, narg->ident, NULL)->isVarDeclaration(); -+ VarDeclaration *v = sc2->search(Loc(), narg->ident, NULL)->isVarDeclaration(); - assert(v); - Expression *e = new VarExp(v->loc, v); - (*exps)[j] = e; -@@ -1058,7 +1160,7 @@ void FuncDeclaration::semantic3(Scope *s - assert(arg->ident); - TupleDeclaration *v = new TupleDeclaration(loc, arg->ident, exps); - //printf("declaring tuple %s\n", v->toChars()); -- v->isexp = 1; -+ v->isexp = true; - if (!sc2->insert(v)) - error("parameter %s.%s is already defined", toChars(), v->toChars()); - localsymtab->insert(v); -@@ -1075,7 +1177,7 @@ void FuncDeclaration::semantic3(Scope *s - if (isDtorDeclaration()) - { - // Call invariant directly only if it exists -- InvariantDeclaration *inv = ad->inv; -+ FuncDeclaration *inv = ad->inv; - ClassDeclaration *cd = ad->isClassDeclaration(); - - while (!inv && cd) -@@ -1087,24 +1189,24 @@ void FuncDeclaration::semantic3(Scope *s - } - if (inv) - { -- e = new DsymbolExp(0, inv); -- e = new CallExp(0, e); -+ e = new DsymbolExp(Loc(), inv); -+ e = new CallExp(Loc(), e); - e = e->semantic(sc2); - } - } - else - { // Call invariant virtually -- Expression *v = new ThisExp(0); -+ Expression *v = new ThisExp(Loc()); - v->type = vthis->type; - if (ad->isStructDeclaration()) - v = v->addressOf(sc); -- Expression *se = new StringExp(0, (char *)"null this"); -+ Expression *se = new StringExp(Loc(), (char *)"null this"); - se = se->semantic(sc); - se->type = Type::tchar->arrayOf(); - e = new AssertExp(loc, v, se); - } - if (e) -- fpreinv = new ExpStatement(0, e); -+ fpreinv = new ExpStatement(Loc(), e); - } - - // Postcondition invariant -@@ -1115,7 +1217,7 @@ void FuncDeclaration::semantic3(Scope *s - if (isCtorDeclaration()) - { - // Call invariant directly only if it exists -- InvariantDeclaration *inv = ad->inv; -+ FuncDeclaration *inv = ad->inv; - ClassDeclaration *cd = ad->isClassDeclaration(); - - while (!inv && cd) -@@ -1127,21 +1229,21 @@ void FuncDeclaration::semantic3(Scope *s - } - if (inv) - { -- e = new DsymbolExp(0, inv); -- e = new CallExp(0, e); -+ e = new DsymbolExp(Loc(), inv); -+ e = new CallExp(Loc(), e); - e = e->semantic(sc2); - } - } - else - { // Call invariant virtually -- Expression *v = new ThisExp(0); -+ Expression *v = new ThisExp(Loc()); - v->type = vthis->type; - if (ad->isStructDeclaration()) - v = v->addressOf(sc); -- e = new AssertExp(0, v); -+ e = new AssertExp(Loc(), v); - } - if (e) -- fpostinv = new ExpStatement(0, e); -+ fpostinv = new ExpStatement(Loc(), e); - } - - if (fensure || addPostInvariant()) -@@ -1168,10 +1270,13 @@ void FuncDeclaration::semantic3(Scope *s - */ - if (ad && isCtorDeclaration()) - { -+ sc2->fieldinit = new unsigned[ad->fields.dim]; -+ sc2->fieldinit_dim = ad->fields.dim; - for (size_t i = 0; i < ad->fields.dim; i++) -- { VarDeclaration *v = ad->fields[i]; -- -+ { -+ VarDeclaration *v = ad->fields[i]; - v->ctorinit = 0; -+ sc2->fieldinit[i] = 0; - } - } - -@@ -1180,29 +1285,34 @@ void FuncDeclaration::semantic3(Scope *s - - fbody = fbody->semantic(sc2); - if (!fbody) -- fbody = new CompoundStatement(0, new Statements()); -+ fbody = new CompoundStatement(Loc(), new Statements()); - - if (inferRetType) -- { // If no return type inferred yet, then infer a void -+ { -+ // If no return type inferred yet, then infer a void - if (!type->nextOf()) - { - f->next = Type::tvoid; - //type = type->semantic(loc, sc); // Removed with 6902 - } -- else if (returns && f->next->ty != Tvoid) -+ } -+ if (returns && f->next->ty != Tvoid) -+ { -+ for (size_t i = 0; i < returns->dim; i++) - { -- for (size_t i = 0; i < returns->dim; i++) -- { Expression *exp = (*returns)[i]->exp; -- if (!f->next->invariantOf()->equals(exp->type->invariantOf())) -- { exp = exp->castTo(sc2, f->next); -- exp = exp->optimize(WANTvalue); -- (*returns)[i]->exp = exp; -- } -- //printf("[%d] %s %s\n", i, exp->type->toChars(), exp->toChars()); -+ Expression *exp = (*returns)[i]->exp; -+ if (!nrvo_can && !f->isref && exp->isLvalue()) -+ exp = callCpCtor(sc2, exp); -+ if (!tintro && !f->next->immutableOf()->equals(exp->type->immutableOf())) -+ { -+ exp = exp->castTo(sc2, f->next); -+ exp = exp->optimize(WANTvalue); - } -+ //printf("[%d] %s %s\n", i, exp->type->toChars(), exp->toChars()); -+ (*returns)[i]->exp = exp; - } -- assert(type == f); - } -+ assert(type == f); - - if (isStaticCtorDeclaration()) - { /* It's a static constructor. Ensure that all -@@ -1225,14 +1335,16 @@ void FuncDeclaration::semantic3(Scope *s - } - } - -- if (isCtorDeclaration() && ad) -+ if (fbody->isErrorStatement()) -+ ; -+ else if (isCtorDeclaration() && ad) - { - #if DMDV2 - // Check for errors related to 'nothrow'. - int nothrowErrors = global.errors; - int blockexit = fbody->blockExit(f->isnothrow); - if (f->isnothrow && (global.errors != nothrowErrors) ) -- error("'%s' is nothrow yet may throw", toChars()); -+ ::error(loc, "%s '%s' is nothrow yet may throw", kind(), toPrettyChars()); - if (flags & FUNCFLAGnothrowInprocess) - f->isnothrow = !(blockexit & BEthrow); - #endif -@@ -1261,8 +1373,20 @@ void FuncDeclaration::semantic3(Scope *s - else if (v->type->needsNested()) - error("field %s must be initialized in constructor, because it is nested struct", v->toChars()); - } -+ else -+ { -+ bool mustInit = (v->storage_class & STCnodefaultctor || -+ v->type->needsNested()); -+ if (mustInit && !(sc2->fieldinit[i] & CSXthis_ctor)) -+ { -+ error("field %s must be initialized but skipped", v->toChars()); -+ } -+ } - } - } -+ delete[] sc2->fieldinit; -+ sc2->fieldinit = NULL; -+ sc2->fieldinit_dim = 0; - - if (cd && - !(sc2->callSuper & CSXany_ctor) && -@@ -1271,19 +1395,18 @@ void FuncDeclaration::semantic3(Scope *s - sc2->callSuper = 0; - - // Insert implicit super() at start of fbody -- Expression *e1 = new SuperExp(0); -- Expression *e = new CallExp(0, e1); -- -- e = e->trySemantic(sc2); -- if (!e) -+ if (!resolveFuncCall(Loc(), sc2, cd->baseClass->ctor, NULL, NULL, NULL, 1)) - { -- const char* impGen = ((CtorDeclaration*)this)->isImplicit ? "implicitly generated " : ""; -- error("no match for implicit super() call in %sconstructor", impGen); -+ error("no match for implicit super() call in constructor"); - } - else - { -- Statement *s = new ExpStatement(0, e); -- fbody = new CompoundStatement(0, s, fbody); -+ Expression *e1 = new SuperExp(Loc()); -+ Expression *e = new CallExp(Loc(), e1); -+ e = e->semantic(sc2); -+ -+ Statement *s = new ExpStatement(Loc(), e); -+ fbody = new CompoundStatement(Loc(), s, fbody); - } - } - -@@ -1304,8 +1427,8 @@ void FuncDeclaration::semantic3(Scope *s - else if (fes) - { // For foreach(){} body, append a return 0; - Expression *e = new IntegerExp(0); -- Statement *s = new ReturnStatement(0, e); -- fbody = new CompoundStatement(0, fbody, s); -+ Statement *s = new ReturnStatement(Loc(), e); -+ fbody = new CompoundStatement(Loc(), fbody, s); - assert(!returnLabel); - } - else if (!hasReturnExp && type->nextOf()->ty != Tvoid) -@@ -1321,10 +1444,10 @@ void FuncDeclaration::semantic3(Scope *s - int nothrowErrors = global.errors; - int blockexit = fbody->blockExit(f->isnothrow); - if (f->isnothrow && (global.errors != nothrowErrors) ) -- error("'%s' is nothrow yet may throw", toChars()); -+ ::error(loc, "%s '%s' is nothrow yet may throw", kind(), toPrettyChars()); - if (flags & FUNCFLAGnothrowInprocess) - { -- if (type == f) f = f->copy(); -+ if (type == f) f = (TypeFunction *)f->copy(); - f->isnothrow = !(blockexit & BEthrow); - } - -@@ -1352,10 +1475,10 @@ void FuncDeclaration::semantic3(Scope *s - } - else - e = new HaltExp(endloc); -- e = new CommaExp(0, e, type->nextOf()->defaultInit()); -+ e = new CommaExp(Loc(), e, type->nextOf()->defaultInit()); - e = e->semantic(sc2); -- Statement *s = new ExpStatement(0, e); -- fbody = new CompoundStatement(0, fbody, s); -+ Statement *s = new ExpStatement(Loc(), e); -+ fbody = new CompoundStatement(Loc(), fbody, s); - } - } - } -@@ -1405,6 +1528,12 @@ void FuncDeclaration::semantic3(Scope *s - - // BUG: need to treat parameters as const - // BUG: need to disallow returns and throws -+ if (inferRetType && fdensure && ((TypeFunction *)fdensure->type)->parameters) -+ { -+ // Return type was unknown in the first semantic pass -+ Parameter *p = (*((TypeFunction *)fdensure->type)->parameters)[0]; -+ p->type = ((TypeFunction *)type)->nextOf(); -+ } - fens = fens->semantic(sc2); - - sc2 = sc2->pop(); -@@ -1428,7 +1557,7 @@ void FuncDeclaration::semantic3(Scope *s - assert(ie); - if (ie->exp->op == TOKconstruct) - ie->exp->op = TOKassign; // construction occured in parameter processing -- a->push(new ExpStatement(0, ie->exp)); -+ a->push(new ExpStatement(Loc(), ie->exp)); - } - } - } -@@ -1443,12 +1572,12 @@ void FuncDeclaration::semantic3(Scope *s - Type *t = argptr->type; - if (global.params.is64bit && !global.params.isWindows) - { // Initialize _argptr to point to v_argsave -- Expression *e1 = new VarExp(0, argptr); -- Expression *e = new SymOffExp(0, v_argsave, 6*8 + 8*16); -+ Expression *e1 = new VarExp(Loc(), argptr); -+ Expression *e = new SymOffExp(Loc(), v_argsave, 6*8 + 8*16); - e->type = argptr->type; -- e = new AssignExp(0, e1, e); -+ e = new AssignExp(Loc(), e1, e); - e = e->semantic(sc); -- a->push(new ExpStatement(0, e)); -+ a->push(new ExpStatement(Loc(), e)); - } - else - { // Initialize _argptr to point past non-variadic arg -@@ -1456,7 +1585,7 @@ void FuncDeclaration::semantic3(Scope *s - unsigned offset = 0; - Expression *e; - -- Expression *e1 = new VarExp(0, argptr); -+ Expression *e1 = new VarExp(Loc(), argptr); - // Find the last non-ref parameter - if (parameters && parameters->dim) - { -@@ -1481,16 +1610,16 @@ void FuncDeclaration::semantic3(Scope *s - p = v_arguments; // last parameter is _arguments[] - if (global.params.is64bit && global.params.isWindows) - { offset += Target::ptrsize; -- if (p->storage_class & STClazy) -+ if (p->storage_class & STClazy || p->type->size() > Target::ptrsize) - { - /* Necessary to offset the extra level of indirection the Win64 - * ABI demands - */ -- e = new SymOffExp(0,p,0); -+ e = new SymOffExp(Loc(),p,0); - e->type = Type::tvoidptr; -- e = new AddrExp(0, e); -+ e = new AddrExp(Loc(), e); - e->type = Type::tvoidptr; -- e = new AddExp(0, e, new IntegerExp(offset)); -+ e = new AddExp(Loc(), e, new IntegerExp(offset)); - e->type = Type::tvoidptr; - goto L1; - } -@@ -1501,13 +1630,13 @@ void FuncDeclaration::semantic3(Scope *s - else - offset += p->type->size(); - offset = (offset + Target::ptrsize - 1) & ~(Target::ptrsize - 1); // assume stack aligns on pointer size -- e = new SymOffExp(0, p, offset); -+ e = new SymOffExp(Loc(), p, offset); - e->type = Type::tvoidptr; - //e = e->semantic(sc); - L1: -- e = new AssignExp(0, e1, e); -+ e = new AssignExp(Loc(), e1, e); - e->type = t; -- a->push(new ExpStatement(0, e)); -+ a->push(new ExpStatement(Loc(), e)); - p->isargptr = TRUE; - } - #endif -@@ -1522,12 +1651,12 @@ void FuncDeclaration::semantic3(Scope *s - /* Advance to elements[] member of TypeInfo_Tuple with: - * _arguments = v_arguments.elements; - */ -- Expression *e = new VarExp(0, v_arguments); -- e = new DotIdExp(0, e, Id::elements); -- Expression *e1 = new VarExp(0, _arguments); -- e = new ConstructExp(0, e1, e); -+ Expression *e = new VarExp(Loc(), v_arguments); -+ e = new DotIdExp(Loc(), e, Id::elements); -+ Expression *e1 = new VarExp(Loc(), _arguments); -+ e = new ConstructExp(Loc(), e1, e); - e = e->semantic(sc2); -- a->push(new ExpStatement(0, e)); -+ a->push(new ExpStatement(Loc(), e)); - } - - // Merge contracts together with body into one compound statement -@@ -1537,7 +1666,7 @@ void FuncDeclaration::semantic3(Scope *s - if (!freq) - freq = fpreinv; - else if (fpreinv) -- freq = new CompoundStatement(0, freq, fpreinv); -+ freq = new CompoundStatement(Loc(), freq, fpreinv); - - a->push(freq); - } -@@ -1550,31 +1679,31 @@ void FuncDeclaration::semantic3(Scope *s - if (!fens) - fens = fpostinv; - else if (fpostinv) -- fens = new CompoundStatement(0, fpostinv, fens); -+ fens = new CompoundStatement(Loc(), fpostinv, fens); - -- LabelStatement *ls = new LabelStatement(0, Id::returnLabel, fens); -+ LabelStatement *ls = new LabelStatement(Loc(), Id::returnLabel, fens); - returnLabel->statement = ls; - a->push(returnLabel->statement); - - if (type->nextOf()->ty != Tvoid && vresult) - { - // Create: return vresult; -- Expression *e = new VarExp(0, vresult); -+ Expression *e = new VarExp(Loc(), vresult); - if (tintro) - { e = e->implicitCastTo(sc, tintro->nextOf()); - e = e->semantic(sc); - } -- ReturnStatement *s = new ReturnStatement(0, e); -+ ReturnStatement *s = new ReturnStatement(Loc(), e); - a->push(s); - } - } - if (isMain() && type->nextOf()->ty == Tvoid) - { // Add a return 0; statement -- Statement *s = new ReturnStatement(0, new IntegerExp(0)); -+ Statement *s = new ReturnStatement(Loc(), new IntegerExp(0)); - a->push(s); - } - -- fbody = new CompoundStatement(0, a); -+ fbody = new CompoundStatement(Loc(), a); - #if DMDV2 - /* Append destructor calls for parameters as finally blocks. - */ -@@ -1591,19 +1720,19 @@ void FuncDeclaration::semantic3(Scope *s - - Expression *e = v->edtor; - if (e) -- { Statement *s = new ExpStatement(0, e); -+ { Statement *s = new ExpStatement(Loc(), e); - s = s->semantic(sc2); - int nothrowErrors = global.errors; - bool isnothrow = f->isnothrow & !(flags & FUNCFLAGnothrowInprocess); - int blockexit = s->blockExit(isnothrow); - if (f->isnothrow && (global.errors != nothrowErrors) ) -- error("'%s' is nothrow yet may throw", toChars()); -+ ::error(loc, "%s '%s' is nothrow yet may throw", kind(), toPrettyChars()); - if (flags & FUNCFLAGnothrowInprocess && blockexit & BEthrow) - f->isnothrow = FALSE; - if (fbody->blockExit(f->isnothrow) == BEfallthru) -- fbody = new CompoundStatement(0, fbody, s); -+ fbody = new CompoundStatement(Loc(), fbody, s); - else -- fbody = new TryFinallyStatement(0, fbody, s); -+ fbody = new TryFinallyStatement(Loc(), fbody, s); - } - } - } -@@ -1621,7 +1750,7 @@ void FuncDeclaration::semantic3(Scope *s - { - if (!global.params.is64bit && - global.params.isWindows && -- !isStatic() && !fbody->usesEH()) -+ !isStatic() && !fbody->usesEH() && !global.params.trace) - { - /* The back end uses the "jmonitor" hack for syncing; - * no need to do the sync at this level. -@@ -1659,14 +1788,14 @@ void FuncDeclaration::semantic3(Scope *s - if (flags & FUNCFLAGpurityInprocess) - { - flags &= ~FUNCFLAGpurityInprocess; -- if (type == f) f = f->copy(); -+ if (type == f) f = (TypeFunction *)f->copy(); - f->purity = PUREfwdref; - } - - if (flags & FUNCFLAGsafetyInprocess) - { - flags &= ~FUNCFLAGsafetyInprocess; -- if (type == f) f = f->copy(); -+ if (type == f) f = (TypeFunction *)f->copy(); - f->trust = TRUSTsafe; - } - -@@ -1678,6 +1807,7 @@ void FuncDeclaration::semantic3(Scope *s - if (!f->deco) - { - sc = sc->push(); -+ sc->stc = 0; - sc->linkage = linkage; // Bugzilla 8496 - type = f->semantic(loc, sc); - sc = sc->pop(); -@@ -1705,7 +1835,10 @@ void FuncDeclaration::semantic3(Scope *s - - bool FuncDeclaration::functionSemantic() - { -- if (scope && !originalType) // semantic not yet run -+ if (!scope) -+ return true; -+ -+ if (!originalType) // semantic not yet run - { - TemplateInstance *spec = isSpeculative(); - unsigned olderrs = global.errors; -@@ -1721,10 +1854,26 @@ bool FuncDeclaration::functionSemantic() - } - - // if inferring return type, sematic3 needs to be run -- if (scope && (inferRetType && type && !type->nextOf() || -- getFuncTemplateDecl(this))) -- { -+ if (inferRetType && type && !type->nextOf()) - return functionSemantic3(); -+ -+ TemplateInstance *ti = parent->isTemplateInstance(); -+ if (ti && !ti->isTemplateMixin() && ti->name == ident) -+ return functionSemantic3(); -+ -+ AggregateDeclaration *ad = isThis(); -+ if (ad && ad->parent && ad->parent->isTemplateInstance() && !isVirtualMethod()) -+ { -+ if (ad->sizeok != SIZEOKdone) -+ { -+ /* Currently dmd cannot resolve forward references per methods, -+ * then setting SIZOKfwd is too conservative and would break existing code. -+ * So, just stop method attributes inference until ad->semantic() done. -+ */ -+ //ad->sizeok = SIZEOKfwd; -+ } -+ else -+ return functionSemantic3(); - } - - return true; -@@ -1791,8 +1940,6 @@ VarDeclaration *FuncDeclaration::declare - Type *thandle = ad->handle; - thandle = thandle->addMod(type->mod); - thandle = thandle->addStorageClass(storage_class); -- //if (isPure()) -- //thandle = thandle->addMod(MODconst); - v = new ThisDeclaration(loc, thandle); - //v = new ThisDeclaration(loc, isCtorDeclaration() ? ad->handle : thandle); - v->storage_class |= STCparameter; -@@ -1823,24 +1970,38 @@ VarDeclaration *FuncDeclaration::declare - return NULL; - } - --int FuncDeclaration::equals(Object *o) -+bool FuncDeclaration::equals(RootObject *o) - { - if (this == o) -- return TRUE; -+ return true; - - Dsymbol *s = isDsymbol(o); - if (s) - { -- FuncDeclaration *fd1 = this->toAliasFunc(); -+ FuncDeclaration *fd1 = this; - FuncDeclaration *fd2 = s->isFuncDeclaration(); -- if (fd2) -- { -- fd2 = fd2->toAliasFunc(); -- return fd1->toParent()->equals(fd2->toParent()) && -- fd1->ident->equals(fd2->ident) && fd1->type->equals(fd2->type); -+ if (!fd2) -+ return false; -+ -+ FuncAliasDeclaration *fa1 = fd1->isFuncAliasDeclaration(); -+ FuncAliasDeclaration *fa2 = fd2->isFuncAliasDeclaration(); -+ if (fa1 && fa2) -+ { -+ return fa1->toAliasFunc()->equals(fa2->toAliasFunc()) && -+ fa1->hasOverloads == fa2->hasOverloads; - } -+ -+ if (fa1 && (fd1 = fa1->toAliasFunc())->isUnique() && !fa1->hasOverloads) -+ fa1 = NULL; -+ if (fa2 && (fd2 = fa2->toAliasFunc())->isUnique() && !fa2->hasOverloads) -+ fa2 = NULL; -+ if ((fa1 != NULL) != (fa2 != NULL)) -+ return false; -+ -+ return fd1->toParent()->equals(fd2->toParent()) && -+ fd1->ident->equals(fd2->ident) && fd1->type->equals(fd2->type); - } -- return FALSE; -+ return false; - } - - void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -1909,7 +2070,7 @@ void FuncDeclaration::buildResultVar() - - assert(type->nextOf()); - assert(type->nextOf()->toBasetype()->ty != Tvoid); -- TypeFunction *tf = (TypeFunction *)(type); -+ TypeFunction *tf = (TypeFunction *)type; - - Loc loc = this->loc; - -@@ -2024,7 +2185,7 @@ Statement *FuncDeclaration::mergeFrequir - * 'out's are AND'd together, i.e. all of them need to pass. - */ - --Statement *FuncDeclaration::mergeFensure(Statement *sf) -+Statement *FuncDeclaration::mergeFensure(Statement *sf, Identifier *oid) - { - /* Same comments as for mergeFrequire(), except that we take care - * of generating a consistent reference to the 'result' local by -@@ -2051,7 +2212,7 @@ Statement *FuncDeclaration::mergeFensure - sc->pop(); - } - -- sf = fdv->mergeFensure(sf); -+ sf = fdv->mergeFensure(sf, oid); - if (fdv->fdensure) - { - //printf("fdv->fensure: %s\n", fdv->fensure->toChars()); -@@ -2059,22 +2220,21 @@ Statement *FuncDeclaration::mergeFensure - Expression *eresult = NULL; - if (outId) - { -- eresult = new IdentifierExp(loc, outId); -+ eresult = new IdentifierExp(loc, oid); - - Type *t1 = fdv->type->nextOf()->toBasetype(); - Type *t2 = this->type->nextOf()->toBasetype(); -- int offset; -- if (t1->isBaseOf(t2, &offset) && offset != 0) -+ if (t1->isBaseOf(t2, NULL)) - { - /* Making temporary reference variable is necessary -- * to match offset difference in covariant return. -- * See bugzilla 5204. -+ * in covariant return. -+ * See bugzilla 5204 and 10479. - */ -- ExpInitializer *ei = new ExpInitializer(0, eresult); -- VarDeclaration *v = new VarDeclaration(0, t1, Lexer::uniqueId("__covres"), ei); -- DeclarationExp *de = new DeclarationExp(0, v); -- VarExp *ve = new VarExp(0, v); -- eresult = new CommaExp(0, de, ve); -+ ExpInitializer *ei = new ExpInitializer(Loc(), eresult); -+ VarDeclaration *v = new VarDeclaration(Loc(), t1, Lexer::uniqueId("__covres"), ei); -+ DeclarationExp *de = new DeclarationExp(Loc(), v); -+ VarExp *ve = new VarExp(Loc(), v); -+ eresult = new CommaExp(Loc(), de, ve); - } - } - Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdensure, 0), eresult); -@@ -2082,7 +2242,7 @@ Statement *FuncDeclaration::mergeFensure - - if (sf) - { -- sf = new CompoundStatement(fensure->loc, s2, sf); -+ sf = new CompoundStatement(sf->loc, s2, sf); - } - else - sf = s2; -@@ -2187,41 +2347,43 @@ int FuncDeclaration::findVtblIndex(Dsymb - type = type->addStorageClass(mismatchstc); - bestvi = mismatchvi; - } -- else -- error("of type %s overrides but is not covariant with %s of type %s", -- type->toChars(), mismatch->toPrettyChars(), mismatch->type->toChars()); - } - return bestvi; - } - - /**************************************************** - * Overload this FuncDeclaration with the new one f. -- * Return !=0 if successful; i.e. no conflict. -+ * Return true if successful; i.e. no conflict. - */ - --int FuncDeclaration::overloadInsert(Dsymbol *s) -+bool FuncDeclaration::overloadInsert(Dsymbol *s) - { -- FuncDeclaration *f; -- AliasDeclaration *a; -- - //printf("FuncDeclaration::overloadInsert(s = %s) this = %s\n", s->toChars(), toChars()); -- a = s->isAliasDeclaration(); -- if (a) -+ AliasDeclaration *ad = s->isAliasDeclaration(); -+ if (ad) - { - if (overnext) -- return overnext->overloadInsert(a); -- if (!a->aliassym && a->type->ty != Tident && a->type->ty != Tinstance) -+ return overnext->overloadInsert(ad); -+ if (!ad->aliassym && ad->type->ty != Tident && ad->type->ty != Tinstance) - { -- //printf("\ta = '%s'\n", a->type->toChars()); -- return FALSE; -+ //printf("\tad = '%s'\n", ad->type->toChars()); -+ return false; - } -- overnext = a; -+ overnext = ad; - //printf("\ttrue: no conflict\n"); -+ return true; -+ } -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (td) -+ { -+ if (overnext) -+ return overnext->overloadInsert(td); -+ overnext = td; - return TRUE; - } -- f = s->isFuncDeclaration(); -- if (!f) -- return FALSE; -+ FuncDeclaration *fd = s->isFuncDeclaration(); -+ if (!fd) -+ return false; - - #if 0 - /* Disable this check because: -@@ -2231,11 +2393,11 @@ int FuncDeclaration::overloadInsert(Dsym - */ - if (type) - { printf("type = %s\n", type->toChars()); -- printf("f->type = %s\n", f->type->toChars()); -+ printf("fd->type = %s\n", fd->type->toChars()); - } -- if (type && f->type && // can be NULL for overloaded constructors -- f->type->covariant(type) && -- f->type->mod == type->mod && -+ if (type && fd->type && // can be NULL for overloaded constructors -+ fd->type->covariant(type) && -+ fd->type->mod == type->mod && - !isFuncAliasDeclaration()) - { - //printf("\tfalse: conflict %s\n", kind()); -@@ -2244,80 +2406,78 @@ int FuncDeclaration::overloadInsert(Dsym - #endif - - if (overnext) -- return overnext->overloadInsert(f); -- overnext = f; -+ { -+ td = overnext->isTemplateDeclaration(); -+ if (td) -+ fd->overloadInsert(td); -+ else -+ return overnext->overloadInsert(fd); -+ } -+ overnext = fd; - //printf("\ttrue: no conflict\n"); -- return TRUE; -+ return true; - } - --/******************************************** -- * Find function in overload list that exactly matches t. -- */ -- - /*************************************************** -- * Visit each overloaded function in turn, and call -- * (*fp)(param, f) on it. -- * Exit when no more, or (*fp)(param, f) returns 1. -+ * Visit each overloaded function/template in turn, and call -+ * (*fp)(param, s) on it. -+ * Exit when no more, or (*fp)(param, f) returns nonzero. - * Returns: -- * 0 continue -- * 1 done -+ * ==0 continue -+ * !=0 done - */ - --int overloadApply(FuncDeclaration *fstart, -- int (*fp)(void *, FuncDeclaration *), -- void *param) -+int overloadApply(Dsymbol *fstart, void *param, int (*fp)(void *, Dsymbol *)) - { -- FuncDeclaration *f; -- Declaration *d; -- Declaration *next; -- -+ Dsymbol *d; -+ Dsymbol *next; - for (d = fstart; d; d = next) -- { FuncAliasDeclaration *fa = d->isFuncAliasDeclaration(); -- -- if (fa) -+ { -+ if (FuncAliasDeclaration *fa = d->isFuncAliasDeclaration()) - { - if (fa->hasOverloads) - { -- if (overloadApply(fa->funcalias, fp, param)) -- return 1; -+ if (int r = overloadApply(fa->funcalias, param, fp)) -+ return r; - } - else - { -- f = fa->toAliasFunc(); -- if (!f) -- { d->error("is aliased to a function"); -+ FuncDeclaration *fd = fa->toAliasFunc(); -+ if (!fd) -+ { -+ d->error("is aliased to a function"); - break; - } -- if ((*fp)(param, f)) -- return 1; -+ if (int r = (*fp)(param, fd)) -+ return r; - } - next = fa->overnext; - } -+ else if (AliasDeclaration *ad = d->isAliasDeclaration()) -+ { -+ next = ad->toAlias(); -+ if (next == ad) -+ break; -+ if (next == fstart) -+ break; -+ } -+ else if (TemplateDeclaration *td = d->isTemplateDeclaration()) -+ { -+ if (int r = (*fp)(param, td)) -+ return r; -+ next = td->overnext; -+ } - else - { -- AliasDeclaration *a = d->isAliasDeclaration(); -- -- if (a) -- { -- Dsymbol *s = a->toAlias(); -- next = s->isDeclaration(); -- if (next == a) -- break; -- if (next == fstart) -- break; -- } -- else -+ FuncDeclaration *fd = d->isFuncDeclaration(); -+ if (!fd) - { -- f = d->isFuncDeclaration(); -- if (!f) -- { d->error("is aliased to a function"); -- break; // BUG: should print error message? -- } -- if ((*fp)(param, f)) -- return 1; -- -- next = f->overnext; -+ d->error("is aliased to a function"); -+ break; // BUG: should print error message? - } -+ if (int r = (*fp)(param, fd)) -+ return r; -+ next = fd->overnext; - } - } - return 0; -@@ -2328,23 +2488,31 @@ int overloadApply(FuncDeclaration *fstar - * otherwise return NULL. - */ - --static int fpunique(void *param, FuncDeclaration *f) --{ FuncDeclaration **pf = (FuncDeclaration **)param; -- -- if (*pf) -- { *pf = NULL; -- return 1; // ambiguous, done -- } -- else -- { *pf = f; -- return 0; -- } --} -- - FuncDeclaration *FuncDeclaration::isUnique() --{ FuncDeclaration *result = NULL; -+{ -+ struct ParamUnique -+ { -+ static int fp(void *param, Dsymbol *s) -+ { -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (!f) -+ return 0; -+ FuncDeclaration **pf = (FuncDeclaration **)param; - -- overloadApply(this, &fpunique, &result); -+ if (*pf) -+ { -+ *pf = NULL; -+ return 1; // ambiguous, done -+ } -+ else -+ { -+ *pf = f; -+ return 0; -+ } -+ } -+ }; -+ FuncDeclaration *result = NULL; -+ overloadApply(this, &result, &ParamUnique::fp); - return result; - } - -@@ -2352,179 +2520,62 @@ FuncDeclaration *FuncDeclaration::isUniq - * Find function in overload list that exactly matches t. - */ - --struct Param1 -+FuncDeclaration *FuncDeclaration::overloadExactMatch(Type *t) - { -+ struct ParamExact -+ { - Type *t; // type to match - FuncDeclaration *f; // return value --}; -- --int fp1(void *param, FuncDeclaration *f) --{ Param1 *p = (Param1 *)param; -- Type *t = p->t; - -- if (t->equals(f->type)) -- { p->f = f; -- return 1; -- } -+ static int fp(void *param, Dsymbol *s) -+ { -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (!f) -+ return 0; -+ ParamExact *p = (ParamExact *)param; -+ Type *t = p->t; - --#if DMDV2 -- /* Allow covariant matches, as long as the return type -- * is just a const conversion. -- * This allows things like pure functions to match with an impure function type. -- */ -- if (t->ty == Tfunction) -- { TypeFunction *tf = (TypeFunction *)f->type; -- if (tf->covariant(t) == 1 && -- tf->nextOf()->implicitConvTo(t->nextOf()) >= MATCHconst) -+ if (t->equals(f->type)) - { - p->f = f; - return 1; - } -- } --#endif -- return 0; --} - --FuncDeclaration *FuncDeclaration::overloadExactMatch(Type *t) --{ -- Param1 p; -+#if DMDV2 -+ /* Allow covariant matches, as long as the return type -+ * is just a const conversion. -+ * This allows things like pure functions to match with an impure function type. -+ */ -+ if (t->ty == Tfunction) -+ { TypeFunction *tf = (TypeFunction *)f->type; -+ if (tf->covariant(t) == 1 && -+ tf->nextOf()->implicitConvTo(t->nextOf()) >= MATCHconst) -+ { -+ p->f = f; -+ return 1; -+ } -+ } -+#endif -+ return 0; -+ } -+ }; -+ ParamExact p; - p.t = t; - p.f = NULL; -- overloadApply(this, &fp1, &p); -+ overloadApply(this, &p, &ParamExact::fp); - return p.f; - } - -- --/******************************************** -- * Decide which function matches the arguments best. -- * flags 1: do not issue error message on no match, just return NULL -- * 2: do not issue error on ambiguous matches and need explicit this -- */ -- --struct Param2 -+static void MODMatchToBuffer(OutBuffer *buf, unsigned char lhsMod, unsigned char rhsMod) - { -- Match *m; --#if DMDV2 -- Expression *ethis; -- int property; // 0: unintialized -- // 1: seen @property -- // 2: not @property --#endif -- Expressions *arguments; --}; -- --int fp2(void *param, FuncDeclaration *f) --{ Param2 *p = (Param2 *)param; -- Match *m = p->m; -- Expressions *arguments = p->arguments; -- MATCH match; -- -- if (f != m->lastf) // skip duplicates -- { -- m->anyf = f; -- TypeFunction *tf = (TypeFunction *)f->type; -- -- int property = (tf->isproperty) ? 1 : 2; -- if (p->property == 0) -- p->property = property; -- else if (p->property != property) -- error(f->loc, "cannot overload both property and non-property functions"); -- -- /* For constructors, don't worry about the right type of ethis. It's a problem -- * anyway, because the constructor attribute may not match the ethis attribute, -- * but we don't care because the attribute on the ethis doesn't matter until -- * after it's constructed. -- */ -- match = (MATCH) tf->callMatch(f->needThis() && !f->isCtorDeclaration() ? p->ethis : NULL, arguments); -- //printf("test1: match = %d\n", match); -- if (match != MATCHnomatch) -- { -- if (match > m->last) -- goto LfIsBetter; -+ bool bothMutable = ((lhsMod & rhsMod) == 0); -+ bool sharedMismatch = ((lhsMod ^ rhsMod) & MODshared); -+ bool sharedMismatchOnly = ((lhsMod ^ rhsMod) == MODshared); - -- if (match < m->last) -- goto LlastIsBetter; -- -- /* See if one of the matches overrides the other. -- */ -- if (m->lastf->overrides(f)) -- goto LlastIsBetter; -- else if (f->overrides(m->lastf)) -- goto LfIsBetter; -- --#if DMDV2 -- /* Try to disambiguate using template-style partial ordering rules. -- * In essence, if f() and g() are ambiguous, if f() can call g(), -- * but g() cannot call f(), then pick f(). -- * This is because f() is "more specialized." -- */ -- { -- MATCH c1 = f->leastAsSpecialized(m->lastf); -- MATCH c2 = m->lastf->leastAsSpecialized(f); -- //printf("c1 = %d, c2 = %d\n", c1, c2); -- if (c1 > c2) -- goto LfIsBetter; -- if (c1 < c2) -- goto LlastIsBetter; -- } -- -- /* If the two functions are the same function, like: -- * int foo(int); -- * int foo(int x) { ... } -- * then pick the one with the body. -- */ -- if (tf->equals(m->lastf->type) && -- f->storage_class == m->lastf->storage_class && -- f->parent == m->lastf->parent && -- f->protection == m->lastf->protection && -- f->linkage == m->lastf->linkage) -- { -- if (f->fbody && !m->lastf->fbody) -- goto LfIsBetter; -- else if (!f->fbody && m->lastf->fbody) -- goto LlastIsBetter; -- } --#endif -- Lambiguous: -- m->nextf = f; -- m->count++; -- return 0; -- -- LfIsBetter: -- m->last = match; -- m->lastf = f; -- m->count = 1; -- return 0; -- -- LlastIsBetter: -- return 0; -- } -- } -- return 0; --} -- -- --void overloadResolveX(Match *m, FuncDeclaration *fstart, -- Expression *ethis, Expressions *arguments) --{ -- Param2 p; -- p.m = m; -- p.ethis = ethis; -- p.property = 0; -- p.arguments = arguments; -- overloadApply(fstart, &fp2, &p); --} -- --static void MODMatchToBuffer(OutBuffer *buf, unsigned char lhsMod, unsigned char rhsMod) --{ -- bool bothMutable = ((lhsMod & rhsMod) == 0); -- bool sharedMismatch = ((lhsMod ^ rhsMod) & MODshared); -- bool sharedMismatchOnly = ((lhsMod ^ rhsMod) == MODshared); -- -- if (lhsMod & MODshared) -- buf->writestring("shared "); -- else if (sharedMismatch && !(lhsMod & MODimmutable)) -- buf->writestring("non-shared "); -+ if (lhsMod & MODshared) -+ buf->writestring("shared "); -+ else if (sharedMismatch && !(lhsMod & MODimmutable)) -+ buf->writestring("non-shared "); - - if (bothMutable && sharedMismatchOnly) - { } -@@ -2538,95 +2589,22 @@ static void MODMatchToBuffer(OutBuffer * - buf->writestring("mutable "); - } - --FuncDeclaration *FuncDeclaration::overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags) --{ -- TypeFunction *tf; -- Match m; -- --#if 0 --printf("FuncDeclaration::overloadResolve('%s')\n", toChars()); --if (arguments) --{ int i; -- -- for (i = 0; i < arguments->dim; i++) -- { Expression *arg; -- -- arg = (*arguments)[i]; -- assert(arg->type); -- printf("\t%s: ", arg->toChars()); -- arg->type->print(); -- } --} --#endif -- -- memset(&m, 0, sizeof(m)); -- m.last = MATCHnomatch; -- overloadResolveX(&m, this, ethis, arguments); -+/******************************************** -+ * find function template root in overload list -+ */ - -- if (m.count == 1) // exactly one match -+TemplateDeclaration *FuncDeclaration::findTemplateDeclRoot() -+{ -+ FuncDeclaration *f = this; -+ while (f && f->overnext) - { -- return m.lastf; -- } -- else -- { -- OutBuffer buf; -- -- buf.writeByte('('); -- if (arguments && arguments->dim) -- { -- HdrGenState hgs; -- argExpTypesToCBuffer(&buf, arguments, &hgs); -- } -- buf.writeByte(')'); -- if (ethis) -- ethis->type->modToBuffer(&buf); -- -- if (m.last == MATCHnomatch) -- { -- if (flags & 1) // if do not print error messages -- return NULL; // no match -- -- tf = (TypeFunction *)type; -- if (ethis && !MODimplicitConv(ethis->type->mod, tf->mod)) // modifier mismatch -- { -- OutBuffer thisBuf, funcBuf; -- MODMatchToBuffer(&thisBuf, ethis->type->mod, tf->mod); -- MODMatchToBuffer(&funcBuf, tf->mod, ethis->type->mod); -- ::error(loc, "%smethod %s is not callable using a %sobject", -- funcBuf.toChars(), this->toPrettyChars(), thisBuf.toChars()); -- } -- else -- { -- //printf("tf = %s, args = %s\n", tf->deco, (*arguments)[0]->type->deco); -- error(loc, "%s%s is not callable using argument types %s", -- Parameter::argsTypesToChars(tf->parameters, tf->varargs), -- tf->modToChars(), -- buf.toChars()); -- } -- -- return m.anyf; // as long as it's not a FuncAliasDeclaration -- } -- else -- { -- if ((flags & 2) && m.lastf->needThis() && !ethis) -- return m.lastf; --#if 1 -- TypeFunction *t1 = (TypeFunction *)m.lastf->type; -- TypeFunction *t2 = (TypeFunction *)m.nextf->type; -- -- error(loc, "called with argument types:\n\t(%s)\nmatches both:\n\t%s(%d): %s%s\nand:\n\t%s(%d): %s%s", -- buf.toChars(), -- m.lastf->loc.filename, m.lastf->loc.linnum, m.lastf->toPrettyChars(), Parameter::argsTypesToChars(t1->parameters, t1->varargs), -- m.nextf->loc.filename, m.nextf->loc.linnum, m.nextf->toPrettyChars(), Parameter::argsTypesToChars(t2->parameters, t2->varargs)); --#else -- error(loc, "overloads %s and %s both match argument list for %s", -- m.lastf->type->toChars(), -- m.nextf->type->toChars(), -- m.lastf->toChars()); --#endif -- return m.lastf; -- } -+ //printf("f->overnext = %p %s\n", f->overnext, f->overnext->toChars()); -+ TemplateDeclaration *td = f->overnext->isTemplateDeclaration(); -+ if (td) -+ return td; -+ f = f->overnext->isFuncDeclaration(); - } -+ return NULL; - } - - /************************************* -@@ -2637,7 +2615,6 @@ if (arguments) - * 0 g is more specialized than 'this' - */ - --#if DMDV2 - MATCH FuncDeclaration::leastAsSpecialized(FuncDeclaration *g) - { - #define LOG_LEASTAS 0 -@@ -2661,15 +2638,22 @@ MATCH FuncDeclaration::leastAsSpecialize - /* If both functions have a 'this' pointer, and the mods are not - * the same and g's is not const, then this is less specialized. - */ -- if (needThis() && g->needThis()) -+ if (needThis() && g->needThis() && tf->mod != tg->mod) - { -- if (tf->mod != tg->mod) -+ if (isCtorDeclaration()) - { -- if (MODimplicitConv(tf->mod, tg->mod)) -+ if (MODimplicitConv(tg->mod, tf->mod)) - match = MATCHconst; - else - return MATCHnomatch; - } -+ else -+ { -+ if (MODimplicitConv(tf->mod, tg->mod)) -+ match = MATCHconst; -+ else -+ return MATCHnomatch; -+ } - } - - /* Create a dummy array of arguments out of the parameters to f() -@@ -2682,11 +2666,11 @@ MATCH FuncDeclaration::leastAsSpecialize - Expression *e; - if (p->storageClass & (STCref | STCout)) - { -- e = new IdentifierExp(0, p->ident); -+ e = new IdentifierExp(Loc(), p->ident); - e->type = p->type; - } - else -- e = p->type->defaultInitLiteral(0); -+ e = p->type->defaultInitLiteral(Loc()); - args[u] = e; - } - -@@ -2714,34 +2698,172 @@ MATCH FuncDeclaration::leastAsSpecialize - /******************************************* - * Given a symbol that could be either a FuncDeclaration or - * a function template, resolve it to a function symbol. -- * sc instantiation scope - * loc instantiation location -- * targsi initial list of template arguments -- * ethis if !NULL, the 'this' pointer argument -+ * sc instantiation scope -+ * tiargs initial list of template arguments -+ * tthis if !NULL, the 'this' pointer argument - * fargs arguments to function - * flags 1: do not issue error message on no match, just return NULL -+ * 2: overloadResolve only - */ - --FuncDeclaration *resolveFuncCall(Scope *sc, Loc loc, Dsymbol *s, -+FuncDeclaration *resolveFuncCall(Loc loc, Scope *sc, Dsymbol *s, - Objects *tiargs, -- Expression *ethis, -- Expressions *arguments, -+ Type *tthis, -+ Expressions *fargs, - int flags) - { - if (!s) - return NULL; // no match -- FuncDeclaration *f = s->isFuncDeclaration(); -- if (f) -- f = f->overloadResolve(loc, ethis, arguments); -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- assert(td); -- f = td->deduceFunctionTemplate(sc, loc, tiargs, NULL, arguments, flags); -+ -+#if 0 -+ printf("resolveFuncCall('%s')\n", toChars()); -+ if (fargs) -+ { -+ for (size_t i = 0; i < fargs->dim; i++) -+ { -+ Expression *arg = (*fargs)[i]; -+ assert(arg->type); -+ printf("\t%s: ", arg->toChars()); -+ arg->type->print(); -+ } - } -- return f; --} - #endif - -+ if (tiargs && arrayObjectIsError(tiargs) || -+ fargs && arrayObjectIsError((Objects *)fargs)) -+ { -+ return NULL; -+ } -+ -+ Match m; -+ memset(&m, 0, sizeof(m)); -+ m.last = MATCHnomatch; -+ -+ functionResolve(&m, s, loc, sc, tiargs, tthis, fargs); -+ -+ if (m.count == 1) // exactly one match -+ { -+ assert(m.lastf); -+ if (!(flags & 1)) -+ m.lastf->functionSemantic(); -+ return m.lastf; -+ } -+ if (m.last != MATCHnomatch && (flags & 2) && !tthis && m.lastf->needThis()) -+ { -+ return m.lastf; -+ } -+ -+Lerror: -+ /* Failed to find a best match. -+ * Do nothing or print error. -+ */ -+ if (m.last == MATCHnomatch && (flags & 1)) -+ { // if do not print error messages -+ return NULL; // no match -+ } -+ -+ HdrGenState hgs; -+ -+ FuncDeclaration *fd = s->isFuncDeclaration(); -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (td && td->funcroot) -+ s = fd = td->funcroot; -+ -+ OutBuffer tiargsBuf; -+ size_t dim = tiargs ? tiargs->dim : 0; -+ for (size_t i = 0; i < dim; i++) -+ { -+ if (i) -+ tiargsBuf.writestring(", "); -+ RootObject *oarg = (*tiargs)[i]; -+ ObjectToCBuffer(&tiargsBuf, &hgs, oarg); -+ } -+ -+ OutBuffer fargsBuf; -+ fargsBuf.writeByte('('); -+ argExpTypesToCBuffer(&fargsBuf, fargs, &hgs); -+ fargsBuf.writeByte(')'); -+ if (tthis) -+ tthis->modToBuffer(&fargsBuf); -+ -+ assert(!m.lastf || m.nextf); -+ if (!m.lastf && !(flags & 1)) // no match -+ { -+ if (td) -+ { -+ if (!fd) // all of overloads are template -+ { -+ ::error(loc, "%s %s.%s does not match any function template declaration. Candidates are:", -+ td->kind(), td->parent->toPrettyChars(), td->ident->toChars()); -+ -+ // Display candidate template functions -+ int numToDisplay = 5; // sensible number to display -+ for (TemplateDeclaration *tdx = td; tdx; tdx = tdx->overnext) -+ { -+ ::errorSupplemental(tdx->loc, "%s", tdx->toPrettyChars()); -+ if (!global.params.verbose && --numToDisplay == 0) -+ { -+ // Too many overloads to sensibly display. -+ // Just show count of remaining overloads. -+ int remaining = 0; -+ for (; tdx; tdx = tdx->overnext) -+ ++remaining; -+ if (remaining > 0) -+ ::errorSupplemental(loc, "... (%d more, -v to show) ...", remaining); -+ break; -+ } -+ } -+ } -+ td->error(loc, "cannot deduce template function from argument types !(%s)%s", -+ tiargsBuf.toChars(), fargsBuf.toChars()); -+ } -+ else -+ { -+ assert(fd); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (tthis && !MODimplicitConv(tthis->mod, tf->mod)) // modifier mismatch -+ { -+ OutBuffer thisBuf, funcBuf; -+ MODMatchToBuffer(&thisBuf, tthis->mod, tf->mod); -+ MODMatchToBuffer(&funcBuf, tf->mod, tthis->mod); -+ ::error(loc, "%smethod %s is not callable using a %sobject", -+ funcBuf.toChars(), fd->toPrettyChars(), thisBuf.toChars()); -+ } -+ else -+ { -+ //printf("tf = %s, args = %s\n", tf->deco, (*fargs)[0]->type->deco); -+ fd->error(loc, "%s%s is not callable using argument types %s", -+ Parameter::argsTypesToChars(tf->parameters, tf->varargs), -+ tf->modToChars(), -+ fargsBuf.toChars()); -+ } -+ } -+ } -+ else if (m.nextf) -+ { -+ /* CAUTION: m.lastf and m.nextf might be incompletely instantiated functions -+ * (created by doHeaderInstantiation), so call toPrettyChars will segfault. -+ */ -+ assert(m.lastf); -+ TypeFunction *t1 = (TypeFunction *)m.lastf->type; -+ TypeFunction *t2 = (TypeFunction *)m.nextf->type; -+ TemplateInstance *lastti = m.lastf->parent->isTemplateInstance(); -+ TemplateInstance *nextti = m.nextf->parent->isTemplateInstance(); -+ Dsymbol *lasts = lastti ? (Dsymbol *)lastti->tempdecl : (Dsymbol *)m.lastf; -+ Dsymbol *nexts = nextti ? (Dsymbol *)nextti->tempdecl : (Dsymbol *)m.nextf; -+ const char *lastprms = lastti ? "" : Parameter::argsTypesToChars(t1->parameters, t1->varargs); -+ const char *nextprms = nextti ? "" : Parameter::argsTypesToChars(t2->parameters, t2->varargs); -+ ::error(loc, "%s.%s called with argument types %s matches both:\n" -+ "\t%s(%d): %s%s\nand:\n\t%s(%d): %s%s", -+ s->parent->toPrettyChars(), s->ident->toChars(), -+ fargsBuf.toChars(), -+ lasts->loc.filename, lasts->loc.linnum, lasts->toChars(), lastprms, -+ nexts->loc.filename, nexts->loc.linnum, nexts->toChars(), nextprms); -+ } -+ return NULL; -+} -+ - /******************************** - * Labels are in a separate scope, one per function. - */ -@@ -2828,7 +2950,8 @@ int FuncDeclaration::getLevel(Loc loc, S - //printf("\ts = %s, '%s'\n", s->kind(), s->toChars()); - FuncDeclaration *thisfd = s->isFuncDeclaration(); - if (thisfd) -- { if (!thisfd->isNested() && !thisfd->vthis && !sc->intypeof) -+ { -+ if (!thisfd->isNested() && !thisfd->vthis && !sc->intypeof) - goto Lerr; - } - else -@@ -2862,14 +2985,18 @@ int FuncDeclaration::getLevel(Loc loc, S - Lerr: - // Don't give error if in template constraint - if (!((sc->flags & SCOPEstaticif) && parent->isTemplateDeclaration())) -- error(loc, "cannot access frame of function %s", fd->toPrettyChars()); -+ { -+ // better diagnostics for static functions -+ ::error(loc, "%s%s %s cannot access frame of function %s", -+ isStatic() ? "static " : "", kind(), toPrettyChars(), fd->toPrettyChars()); -+ } - return 1; - } - - void FuncDeclaration::appendExp(Expression *e) - { Statement *s; - -- s = new ExpStatement(0, e); -+ s = new ExpStatement(Loc(), e); - appendState(s); - } - -@@ -2888,7 +3015,7 @@ void FuncDeclaration::appendState(Statem - cs->statements->push(s); - } - else -- fbody = new CompoundStatement(0, fbody, s); -+ fbody = new CompoundStatement(Loc(), fbody, s); - } - } - -@@ -2900,17 +3027,27 @@ const char *FuncDeclaration::toPrettyCha - return Dsymbol::toPrettyChars(); - } - --int FuncDeclaration::isMain() -+/** for diagnostics, e.g. 'int foo(int x, int y) pure' */ -+const char *FuncDeclaration::toFullSignature() -+{ -+ OutBuffer buf; -+ HdrGenState hgs; -+ functionToCBuffer2((TypeFunction *)type, &buf, &hgs, 0, toChars()); -+ buf.writeByte(0); -+ return buf.extractData(); -+} -+ -+bool FuncDeclaration::isMain() - { - return ident == Id::main && - linkage != LINKc && !isMember() && !isNested(); - } - --int FuncDeclaration::isWinMain() -+bool FuncDeclaration::isWinMain() - { - //printf("FuncDeclaration::isWinMain() %s\n", toChars()); - #if 0 -- int x = ident == Id::WinMain && -+ bool x = ident == Id::WinMain && - linkage != LINKc && !isMember(); - printf("%s\n", x ? "yes" : "no"); - return x; -@@ -2920,18 +3057,18 @@ int FuncDeclaration::isWinMain() - #endif - } - --int FuncDeclaration::isDllMain() -+bool FuncDeclaration::isDllMain() - { - return ident == Id::DllMain && - linkage != LINKc && !isMember(); - } - --int FuncDeclaration::isExport() -+bool FuncDeclaration::isExport() - { - return protection == PROTexport; - } - --int FuncDeclaration::isImportedSymbol() -+bool FuncDeclaration::isImportedSymbol() - { - //printf("isImportedSymbol()\n"); - //printf("protection = %d\n", protection); -@@ -2940,7 +3077,7 @@ int FuncDeclaration::isImportedSymbol() - - // Determine if function goes into virtual function pointer table - --int FuncDeclaration::isVirtual() -+bool FuncDeclaration::isVirtual() - { - if (toAliasFunc() != this) - return toAliasFunc()->isVirtual(); -@@ -2953,40 +3090,40 @@ int FuncDeclaration::isVirtual() - isMember() && - !(isStatic() || protection == PROTprivate || protection == PROTpackage) && - p->isClassDeclaration() && -- !(p->isInterfaceDeclaration() && isFinal())); -+ !(p->isInterfaceDeclaration() && isFinalFunc())); - #endif - return isMember() && - !(isStatic() || protection == PROTprivate || protection == PROTpackage) && - p->isClassDeclaration() && -- !(p->isInterfaceDeclaration() && isFinal()); -+ !(p->isInterfaceDeclaration() && isFinalFunc()); - } - - // Determine if a function is pedantically virtual - --int FuncDeclaration::isVirtualMethod() -+bool FuncDeclaration::isVirtualMethod() - { - if (toAliasFunc() != this) - return toAliasFunc()->isVirtualMethod(); - - //printf("FuncDeclaration::isVirtualMethod() %s\n", toChars()); - if (!isVirtual()) -- return 0; -+ return false; - // If it's a final method, and does not override anything, then it is not virtual -- if (isFinal() && foverrides.dim == 0) -+ if (isFinalFunc() && foverrides.dim == 0) - { -- return 0; -+ return false; - } -- return 1; -+ return true; - } - --int FuncDeclaration::isFinal() -+bool FuncDeclaration::isFinalFunc() - { - if (toAliasFunc() != this) -- return toAliasFunc()->isFinal(); -+ return toAliasFunc()->isFinalFunc(); - - ClassDeclaration *cd; - #if 0 -- printf("FuncDeclaration::isFinal(%s), %x\n", toChars(), Declaration::isFinal()); -+ printf("FuncDeclaration::isFinalFunc(%s), %x\n", toChars(), Declaration::isFinal()); - printf("%p %d %d %d\n", isMember(), isStatic(), Declaration::isFinal(), ((cd = toParent()->isClassDeclaration()) != NULL && cd->storage_class & STCfinal)); - printf("result is %d\n", - isMember() && -@@ -3005,27 +3142,22 @@ int FuncDeclaration::isFinal() - ((cd = toParent()->isClassDeclaration()) != NULL && cd->storage_class & STCfinal)); - } - --int FuncDeclaration::isAbstract() --{ -- return storage_class & STCabstract; --} -- --int FuncDeclaration::isCodeseg() -+bool FuncDeclaration::isCodeseg() - { -- return TRUE; // functions are always in the code segment -+ return true; // functions are always in the code segment - } - --int FuncDeclaration::isOverloadable() -+bool FuncDeclaration::isOverloadable() - { -- return 1; // functions can be overloaded -+ return true; // functions can be overloaded - } - --int FuncDeclaration::hasOverloads() -+bool FuncDeclaration::hasOverloads() - { - return overnext != NULL; - } - --enum PURE FuncDeclaration::isPure() -+PURE FuncDeclaration::isPure() - { - //printf("FuncDeclaration::isPure() '%s'\n", toChars()); - assert(type->ty == Tfunction); -@@ -3034,14 +3166,14 @@ enum PURE FuncDeclaration::isPure() - setImpure(); - if (tf->purity == PUREfwdref) - tf->purityLevel(); -- enum PURE purity = tf->purity; -+ PURE purity = tf->purity; - if (purity > PUREweak && isNested()) - purity = PUREweak; - if (purity > PUREweak && needThis()) - { // The attribute of the 'this' reference affects purity strength -- if (type->mod & (MODimmutable | MODwild)) -+ if (type->mod & MODimmutable) - ; -- else if (type->mod & MODconst && purity >= PUREconst) -+ else if (type->mod & (MODconst | MODwild) && purity >= PUREconst) - purity = PUREconst; - else - purity = PUREweak; -@@ -3052,12 +3184,10 @@ enum PURE FuncDeclaration::isPure() - return purity; - } - --enum PURE FuncDeclaration::isPureBypassingInference() -+PURE FuncDeclaration::isPureBypassingInference() - { - if (flags & FUNCFLAGpurityInprocess) - return PUREfwdref; -- else if (type->nextOf() == NULL) -- return PUREfwdref; - else - return isPure(); - } -@@ -3078,7 +3208,7 @@ bool FuncDeclaration::setImpure() - return FALSE; - } - --int FuncDeclaration::isSafe() -+bool FuncDeclaration::isSafe() - { - assert(type->ty == Tfunction); - if (flags & FUNCFLAGsafetyInprocess) -@@ -3094,7 +3224,7 @@ bool FuncDeclaration::isSafeBypassingInf - return isSafe(); - } - --int FuncDeclaration::isTrusted() -+bool FuncDeclaration::isTrusted() - { - assert(type->ty == Tfunction); - if (flags & FUNCFLAGsafetyInprocess) -@@ -3119,10 +3249,168 @@ bool FuncDeclaration::setUnsafe() - return FALSE; - } - -+/************************************** -+ * Returns an indirect type one step from t. -+ */ -+ -+Type *getIndirection(Type *t) -+{ -+ t = t->baseElemOf(); -+ if (t->ty == Tarray || t->ty == Tpointer) -+ return t->nextOf()->toBasetype(); -+ if (t->ty == Taarray || t->ty == Tclass) -+ return t; -+ if (t->ty == Tstruct) -+ return t->hasPointers() ? t : NULL; // TODO -+ -+ // should consider TypeDelegate? -+ return NULL; -+} -+ -+/************************************** -+ * Traverse this and t, and then check the indirections convertibility. -+ */ -+ -+int traverseIndirections(Type *ta, Type *tb, void *p = NULL, bool a2b = true) -+{ -+ if (a2b) // check ta appears in tb -+ { -+ //printf("\ttraverse(1) %s appears in %s\n", ta->toChars(), tb->toChars()); -+ if (ta->constConv(tb)) -+ return 1; -+ else if (ta->immutableOf()->equals(tb->immutableOf())) -+ return 0; -+ else if (tb->ty == Tvoid && MODimplicitConv(ta->mod, tb->mod)) -+ return 1; -+ } -+ else // check tb appears in ta -+ { -+ //printf("\ttraverse(2) %s appears in %s\n", tb->toChars(), ta->toChars()); -+ if (tb->constConv(ta)) -+ return 1; -+ else if (tb->immutableOf()->equals(ta->immutableOf())) -+ return 0; -+ else if (ta->ty == Tvoid && MODimplicitConv(tb->mod, ta->mod)) -+ return 1; -+ } -+ -+ // context date to detect circular look up -+ struct Ctxt -+ { -+ Ctxt *prev; -+ Type *type; -+ }; -+ Ctxt *ctxt = (Ctxt *)p; -+ -+ Type *tbb = tb->toBasetype(); -+ if (tbb != tb) -+ return traverseIndirections(ta, tbb, ctxt, a2b); -+ -+ tb = tb->baseElemOf(); -+ if (tb->ty == Tclass || tb->ty == Tstruct) -+ { -+ for (Ctxt *c = ctxt; c; c = c->prev) -+ if (tb == c->type) return 0; -+ Ctxt c; -+ c.prev = ctxt; -+ c.type = tb; -+ -+ AggregateDeclaration *sym = tb->toDsymbol(NULL)->isAggregateDeclaration(); -+ for (size_t i = 0; i < sym->fields.dim; i++) -+ { -+ VarDeclaration *v = sym->fields[i]; -+ Type *tprmi = v->type->addMod(tb->mod); -+ if (!(v->storage_class & STCref)) -+ tprmi = getIndirection(tprmi); -+ if (!tprmi) -+ continue; -+ -+ //printf("\ttb = %s, tprmi = %s\n", tb->toChars(), tprmi->toChars()); -+ if (traverseIndirections(ta, tprmi, &c, a2b)) -+ return 1; -+ } -+ } -+ else if (tb->ty == Tarray || tb->ty == Taarray || tb->ty == Tpointer) -+ { -+ Type *tind = tb->nextOf(); -+ if (traverseIndirections(ta, tind, ctxt, a2b)) -+ return 1; -+ } -+ else if (tb->hasPointers()) -+ { -+ // FIXME: function pointer/delegate types should be considered. -+ return 1; -+ } -+ if (a2b) -+ return traverseIndirections(tb, ta, ctxt, false); -+ -+ return 0; -+} -+ -+/******************************************** -+ * Returns true if the function return value has no indirection -+ * which comes from the parameters. -+ */ -+ -+bool FuncDeclaration::isolateReturn() -+{ -+ assert(type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)type; -+ assert(tf->next); -+ -+ Type *treti = tf->next; -+ treti = tf->isref ? treti : getIndirection(treti); -+ if (!treti) -+ return true; // target has no mutable indirection -+ return parametersIntersect(treti); -+} -+ -+/******************************************** -+ * Returns true if an object typed t can have indirections -+ * which come from the parameters. -+ */ -+ -+bool FuncDeclaration::parametersIntersect(Type *t) -+{ -+ assert(t); -+ if (!isPureBypassingInference() || isNested()) -+ return false; -+ -+ assert(type->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)type; -+ -+ //printf("parametersIntersect(%s) t = %s\n", tf->toChars(), t->toChars()); -+ -+ size_t dim = Parameter::dim(tf->parameters); -+ for (size_t i = 0; i < dim; i++) -+ { -+ Parameter *fparam = Parameter::getNth(tf->parameters, i); -+ if (!fparam->type) -+ continue; -+ Type *tprmi = (fparam->storageClass & (STClazy | STCout | STCref)) -+ ? fparam->type : getIndirection(fparam->type); -+ if (!tprmi) -+ continue; // there is no mutable indirection -+ -+ //printf("\t[%d] tprmi = %d %s\n", i, tprmi->ty, tprmi->toChars()); -+ if (traverseIndirections(tprmi, t)) -+ return false; -+ } -+ if (AggregateDeclaration *ad = isCtorDeclaration() ? NULL : isThis()) -+ { -+ Type *tthis = ad ? ad->getType()->addMod(tf->mod) : NULL; -+ //printf("\ttthis = %s\n", tthis->toChars()); -+ if (traverseIndirections(tthis, t)) -+ return false; -+ } -+ -+ return true; -+} -+ - // Determine if function needs - // a static frame pointer to its lexically enclosing function - --int FuncDeclaration::isNested() -+bool FuncDeclaration::isNested() - { - FuncDeclaration *f = toAliasFunc(); - //printf("\ttoParent2() = '%s'\n", f->toParent2()->toChars()); -@@ -3131,16 +3419,17 @@ int FuncDeclaration::isNested() - (f->toParent2()->isFuncDeclaration() != NULL); - } - --int FuncDeclaration::needThis() -+bool FuncDeclaration::needThis() - { - //printf("FuncDeclaration::needThis() '%s'\n", toChars()); - return toAliasFunc()->isThis() != NULL; - } - --int FuncDeclaration::addPreInvariant() -+bool FuncDeclaration::addPreInvariant() - { - AggregateDeclaration *ad = isThis(); -- return (ad && -+ ClassDeclaration *cd = ad ? ad->isClassDeclaration() : NULL; -+ return (ad && !(cd && cd->isCPPclass()) && - //ad->isClassDeclaration() && - global.params.useInvariants && - (protection == PROTprotected || protection == PROTpublic || protection == PROTexport) && -@@ -3148,10 +3437,11 @@ int FuncDeclaration::addPreInvariant() - ident != Id::cpctor); - } - --int FuncDeclaration::addPostInvariant() -+bool FuncDeclaration::addPostInvariant() - { - AggregateDeclaration *ad = isThis(); -- return (ad && -+ ClassDeclaration *cd = ad ? ad->isClassDeclaration() : NULL; -+ return (ad && !(cd && cd->isCPPclass()) && - ad->inv && - //ad->isClassDeclaration() && - global.params.useInvariants && -@@ -3164,12 +3454,12 @@ int FuncDeclaration::addPostInvariant() - * Generate a FuncDeclaration for a runtime library function. - */ - --FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, const char *name) -+FuncDeclaration *FuncDeclaration::genCfunc(Parameters *args, Type *treturn, const char *name) - { -- return genCfunc(treturn, Lexer::idPool(name)); -+ return genCfunc(args, treturn, Lexer::idPool(name)); - } - --FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, Identifier *id) -+FuncDeclaration *FuncDeclaration::genCfunc(Parameters *args, Type *treturn, Identifier *id) - { - FuncDeclaration *fd; - TypeFunction *tf; -@@ -3191,8 +3481,8 @@ FuncDeclaration *FuncDeclaration::genCfu - } - else - { -- tf = new TypeFunction(NULL, treturn, 0, LINKc); -- fd = new FuncDeclaration(0, 0, id, STCstatic, tf); -+ tf = new TypeFunction(args, treturn, 0, LINKc); -+ fd = new FuncDeclaration(Loc(), Loc(), id, STCstatic, tf); - fd->protection = PROTpublic; - fd->linkage = LINKc; - -@@ -3275,7 +3565,7 @@ void FuncDeclaration::checkNestedReferen - */ - void markAsNeedingClosure(Dsymbol *f, FuncDeclaration *outerFunc) - { -- for (Dsymbol *sx = f; sx != outerFunc; sx = sx->parent) -+ for (Dsymbol *sx = f; sx && sx != outerFunc; sx = sx->parent) - { - FuncDeclaration *fy = sx->isFuncDeclaration(); - if (fy && fy->closureVars.dim) -@@ -3323,7 +3613,7 @@ bool checkEscapingSiblings(FuncDeclarati - */ - - #if DMDV2 --int FuncDeclaration::needsClosure() -+bool FuncDeclaration::needsClosure() - { - /* Need a closure for all the closureVars[] if any of the - * closureVars[] are accessed by a -@@ -3411,11 +3701,11 @@ int FuncDeclaration::needsClosure() - } - } - -- return 0; -+ return false; - - Lyes: - //printf("\tneeds closure\n"); -- return 1; -+ return true; - } - #endif - -@@ -3424,14 +3714,14 @@ Lyes: - * nested within it. - */ - --int FuncDeclaration::hasNestedFrameRefs() -+bool FuncDeclaration::hasNestedFrameRefs() - { - #if DMDV2 - if (closureVars.dim) - #else - if (nestedFrameRef) - #endif -- return 1; -+ return true; - - /* If a virtual method has contracts, assume its variables are referenced - * by those contracts, even if they aren't. Because they might be referenced -@@ -3441,7 +3731,7 @@ int FuncDeclaration::hasNestedFrameRefs( - * context had better match, or Bugzilla 7337 will bite. - */ - if ((fdrequire || fdensure) && isVirtualMethod()) -- return 1; -+ return true; - - if (foverrides.dim && isVirtualMethod()) - { -@@ -3449,11 +3739,11 @@ int FuncDeclaration::hasNestedFrameRefs( - { - FuncDeclaration *fdv = foverrides[i]; - if (fdv->hasNestedFrameRefs()) -- return 1; -+ return true; - } - } - -- return 0; -+ return false; - } - - /********************************************* -@@ -3462,8 +3752,8 @@ int FuncDeclaration::hasNestedFrameRefs( - */ - - Parameters *FuncDeclaration::getParameters(int *pvarargs) --{ Parameters *fparameters; -- int fvarargs; -+{ Parameters *fparameters = NULL; -+ int fvarargs = 0; - - if (type) - { -@@ -3482,7 +3772,7 @@ Parameters *FuncDeclaration::getParamete - - // Used as a way to import a set of functions from another scope into this one. - --FuncAliasDeclaration::FuncAliasDeclaration(FuncDeclaration *funcalias, int hasOverloads) -+FuncAliasDeclaration::FuncAliasDeclaration(FuncDeclaration *funcalias, bool hasOverloads) - : FuncDeclaration(funcalias->loc, funcalias->endloc, funcalias->ident, - funcalias->storage_class, funcalias->type) - { -@@ -3498,7 +3788,7 @@ FuncAliasDeclaration::FuncAliasDeclarati - else - { // for internal use - assert(!funcalias->isFuncAliasDeclaration()); -- this->hasOverloads = 0; -+ this->hasOverloads = false; - } - userAttributes = funcalias->userAttributes; - } -@@ -3517,20 +3807,10 @@ FuncDeclaration *FuncAliasDeclaration::t - /****************************** FuncLiteralDeclaration ************************/ - - FuncLiteralDeclaration::FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, -- enum TOK tok, ForeachStatement *fes) -+ TOK tok, ForeachStatement *fes, Identifier *id) - : FuncDeclaration(loc, endloc, NULL, STCundefined, type) - { -- const char *id; -- -- if (fes) -- id = "__foreachbody"; -- else if (tok == TOKreserved) -- id = "__lambda"; -- else if (tok == TOKdelegate) -- id = "__dgliteral"; -- else -- id = "__funcliteral"; -- this->ident = Lexer::uniqueId(id); -+ this->ident = id ? id : Id::empty; - this->tok = tok; - this->fes = fes; - this->treq = NULL; -@@ -3545,23 +3825,21 @@ Dsymbol *FuncLiteralDeclaration::syntaxC - if (s) - f = (FuncLiteralDeclaration *)s; - else -- { f = new FuncLiteralDeclaration(loc, endloc, type->syntaxCopy(), tok, fes); -- f->ident = ident; // keep old identifier -- f->treq = treq; // don't need to copy -- } -+ f = new FuncLiteralDeclaration(loc, endloc, type->syntaxCopy(), tok, fes, ident); -+ f->treq = treq; // don't need to copy - FuncDeclaration::syntaxCopy(f); - return f; - } - --int FuncLiteralDeclaration::isNested() -+bool FuncLiteralDeclaration::isNested() - { - //printf("FuncLiteralDeclaration::isNested() '%s'\n", toChars()); - return (tok != TOKfunction); - } - --int FuncLiteralDeclaration::isVirtual() -+bool FuncLiteralDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - - const char *FuncLiteralDeclaration::kind() -@@ -3580,16 +3858,24 @@ void FuncLiteralDeclaration::toCBuffer(O - - TypeFunction *tf = (TypeFunction *)type; - // Don't print tf->mod, tf->trust, and tf->linkage -- if (tf->next) -+ if (!inferRetType && tf->next) - tf->next->toCBuffer2(buf, hgs, 0); - Parameter::argsToCBuffer(buf, hgs, tf->parameters, tf->varargs); - -- ReturnStatement *ret = !fbody->isCompoundStatement() ? -- fbody->isReturnStatement() : NULL; -- if (ret && ret->exp) -+ CompoundStatement *cs = fbody->isCompoundStatement(); -+ Statement *s1; -+ if (semanticRun >= PASSsemantic3done) -+ { -+ assert(cs); -+ s1 = (*cs->statements)[cs->statements->dim - 1]; -+ } -+ else -+ s1 = !cs ? fbody : NULL; -+ ReturnStatement *rs = s1 ? s1->isReturnStatement() : NULL; -+ if (rs && rs->exp) - { - buf->writestring(" => "); -- ret->exp->toCBuffer(buf, hgs); -+ rs->exp->toCBuffer(buf, hgs); - } - else - { -@@ -3606,7 +3892,6 @@ CtorDeclaration::CtorDeclaration(Loc loc - : FuncDeclaration(loc, endloc, Id::ctor, stc, type) - { - //printf("CtorDeclaration(loc = %s) %s\n", loc.toChars(), toChars()); -- this->isImplicit = false; - } - - Dsymbol *CtorDeclaration::syntaxCopy(Dsymbol *s) -@@ -3638,33 +3923,13 @@ void CtorDeclaration::semantic(Scope *sc - sc->stc &= ~STCstatic; // not a static constructor - sc->flags |= SCOPEctor; - -- parent = sc->parent; -- Dsymbol *parent = toParent2(); -- Type *tret; -- AggregateDeclaration *ad = parent->isAggregateDeclaration(); -- if (!ad || parent->isUnionDeclaration()) -- { -- error("constructors are only for class or struct definitions"); -- tret = Type::tvoid; -- } -- else -- { tret = ad->handle; -- assert(tret); -- tret = tret->addStorageClass(storage_class | sc->stc); -- tret = tret->addMod(type->mod); -- } -- tf->next = tret; -- if (!originalType) -- originalType = type->syntaxCopy(); -- type = type->semantic(loc, sc); -- -- if (ad && ad->isStructDeclaration()) -- ((TypeFunction *)type)->isref = 1; -- - FuncDeclaration::semantic(sc); - - sc->pop(); - -+ Dsymbol *parent = toParent2(); -+ AggregateDeclaration *ad = parent->isAggregateDeclaration(); -+ - /* See if it's the default constructor - * But, template constructor should not become a default constructor. - */ -@@ -3698,17 +3963,17 @@ char *CtorDeclaration::toChars() - return (char *)"this"; - } - --int CtorDeclaration::isVirtual() -+bool CtorDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - --int CtorDeclaration::addPreInvariant() -+bool CtorDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int CtorDeclaration::addPostInvariant() -+bool CtorDeclaration::addPostInvariant() - { - return (isThis() && vthis && global.params.useInvariants); - } -@@ -3761,24 +4026,24 @@ void PostBlitDeclaration::semantic(Scope - sc->pop(); - } - --int PostBlitDeclaration::overloadInsert(Dsymbol *s) -+bool PostBlitDeclaration::overloadInsert(Dsymbol *s) - { -- return FALSE; // cannot overload postblits -+ return false; // cannot overload postblits - } - --int PostBlitDeclaration::addPreInvariant() -+bool PostBlitDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int PostBlitDeclaration::addPostInvariant() -+bool PostBlitDeclaration::addPostInvariant() - { - return (isThis() && vthis && global.params.useInvariants); - } - --int PostBlitDeclaration::isVirtual() -+bool PostBlitDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - - void PostBlitDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -3795,15 +4060,15 @@ DtorDeclaration::DtorDeclaration(Loc loc - { - } - --DtorDeclaration::DtorDeclaration(Loc loc, Loc endloc, Identifier *id) -- : FuncDeclaration(loc, endloc, id, STCundefined, NULL) -+DtorDeclaration::DtorDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id) -+ : FuncDeclaration(loc, endloc, id, stc, NULL) - { - } - - Dsymbol *DtorDeclaration::syntaxCopy(Dsymbol *s) - { - assert(!s); -- DtorDeclaration *dd = new DtorDeclaration(loc, endloc, ident); -+ DtorDeclaration *dd = new DtorDeclaration(loc, endloc, storage_class, ident); - return FuncDeclaration::syntaxCopy(dd); - } - -@@ -3827,7 +4092,7 @@ void DtorDeclaration::semantic(Scope *sc - ad->dtors.push(this); - - if (!type) -- type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd); -+ type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd, storage_class); - - sc = sc->push(); - sc->stc &= ~STCstatic; // not a static destructor -@@ -3838,19 +4103,19 @@ void DtorDeclaration::semantic(Scope *sc - sc->pop(); - } - --int DtorDeclaration::overloadInsert(Dsymbol *s) -+bool DtorDeclaration::overloadInsert(Dsymbol *s) - { -- return FALSE; // cannot overload destructors -+ return false; // cannot overload destructors - } - --int DtorDeclaration::addPreInvariant() -+bool DtorDeclaration::addPreInvariant() - { - return (isThis() && vthis && global.params.useInvariants); - } - --int DtorDeclaration::addPostInvariant() -+bool DtorDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - const char *DtorDeclaration::kind() -@@ -3863,10 +4128,10 @@ char *DtorDeclaration::toChars() - return (char *)"~this"; - } - --int DtorDeclaration::isVirtual() -+bool DtorDeclaration::isVirtual() - { -- // FALSE so that dtor's don't get put into the vtbl[] -- return FALSE; -+ // false so that dtor's don't get put into the vtbl[] -+ return false; - } - - void DtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -3922,19 +4187,19 @@ void StaticCtorDeclaration::semantic(Sco - * during static construction. - */ - Identifier *id = Lexer::idPool("__gate"); -- VarDeclaration *v = new VarDeclaration(0, Type::tint32, id, NULL); -+ VarDeclaration *v = new VarDeclaration(Loc(), Type::tint32, id, NULL); - v->storage_class = isSharedStaticCtorDeclaration() ? STCstatic : STCtls; - Statements *sa = new Statements(); -- Statement *s = new ExpStatement(0, v); -+ Statement *s = new ExpStatement(Loc(), v); - sa->push(s); -- Expression *e = new IdentifierExp(0, id); -- e = new AddAssignExp(0, e, new IntegerExp(1)); -- e = new EqualExp(TOKnotequal, 0, e, new IntegerExp(1)); -- s = new IfStatement(0, NULL, e, new ReturnStatement(0, NULL), NULL); -+ Expression *e = new IdentifierExp(Loc(), id); -+ e = new AddAssignExp(Loc(), e, new IntegerExp(1)); -+ e = new EqualExp(TOKnotequal, Loc(), e, new IntegerExp(1)); -+ s = new IfStatement(Loc(), NULL, e, new ReturnStatement(Loc(), NULL), NULL); - sa->push(s); - if (fbody) - sa->push(fbody); -- fbody = new CompoundStatement(0, sa); -+ fbody = new CompoundStatement(Loc(), sa); - } - - FuncDeclaration::semantic(sc); -@@ -3954,9 +4219,9 @@ AggregateDeclaration *StaticCtorDeclarat - return NULL; - } - --int StaticCtorDeclaration::isVirtual() -+bool StaticCtorDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - - bool StaticCtorDeclaration::hasStaticCtorOrDtor() -@@ -3964,14 +4229,14 @@ bool StaticCtorDeclaration::hasStaticCto - return TRUE; - } - --int StaticCtorDeclaration::addPreInvariant() -+bool StaticCtorDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int StaticCtorDeclaration::addPostInvariant() -+bool StaticCtorDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void StaticCtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4008,16 +4273,16 @@ void SharedStaticCtorDeclaration::toCBuf - - /********************************* StaticDtorDeclaration ****************************/ - --StaticDtorDeclaration::StaticDtorDeclaration(Loc loc, Loc endloc) -+StaticDtorDeclaration::StaticDtorDeclaration(Loc loc, Loc endloc, StorageClass stc) - : FuncDeclaration(loc, endloc, -- Identifier::generateId("_staticDtor"), STCstatic, NULL) -+ Identifier::generateId("_staticDtor"), STCstatic | stc, NULL) - { - vgate = NULL; - } - --StaticDtorDeclaration::StaticDtorDeclaration(Loc loc, Loc endloc, const char *name) -+StaticDtorDeclaration::StaticDtorDeclaration(Loc loc, Loc endloc, const char *name, StorageClass stc) - : FuncDeclaration(loc, endloc, -- Identifier::generateId(name), STCstatic, NULL) -+ Identifier::generateId(name), STCstatic | stc, NULL) - { - vgate = NULL; - } -@@ -4025,7 +4290,7 @@ StaticDtorDeclaration::StaticDtorDeclara - Dsymbol *StaticDtorDeclaration::syntaxCopy(Dsymbol *s) - { - assert(!s); -- StaticDtorDeclaration *sdd = new StaticDtorDeclaration(loc, endloc); -+ StaticDtorDeclaration *sdd = new StaticDtorDeclaration(loc, endloc, storage_class); - return FuncDeclaration::syntaxCopy(sdd); - } - -@@ -4037,10 +4302,8 @@ void StaticDtorDeclaration::semantic(Sco - scope = NULL; - } - -- ClassDeclaration *cd = sc->scopesym->isClassDeclaration(); -- - if (!type) -- type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd); -+ type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd, storage_class); - - /* If the static ctor appears within a template instantiation, - * it could get called multiple times by the module constructors -@@ -4056,19 +4319,19 @@ void StaticDtorDeclaration::semantic(Sco - * during static destruction. - */ - Identifier *id = Lexer::idPool("__gate"); -- VarDeclaration *v = new VarDeclaration(0, Type::tint32, id, NULL); -+ VarDeclaration *v = new VarDeclaration(Loc(), Type::tint32, id, NULL); - v->storage_class = isSharedStaticDtorDeclaration() ? STCstatic : STCtls; - Statements *sa = new Statements(); -- Statement *s = new ExpStatement(0, v); -+ Statement *s = new ExpStatement(Loc(), v); - sa->push(s); -- Expression *e = new IdentifierExp(0, id); -- e = new AddAssignExp(0, e, new IntegerExp(-1)); -- e = new EqualExp(TOKnotequal, 0, e, new IntegerExp(0)); -- s = new IfStatement(0, NULL, e, new ReturnStatement(0, NULL), NULL); -+ Expression *e = new IdentifierExp(Loc(), id); -+ e = new AddAssignExp(Loc(), e, new IntegerExp(-1)); -+ e = new EqualExp(TOKnotequal, Loc(), e, new IntegerExp(0)); -+ s = new IfStatement(Loc(), NULL, e, new ReturnStatement(Loc(), NULL), NULL); - sa->push(s); - if (fbody) - sa->push(fbody); -- fbody = new CompoundStatement(0, sa); -+ fbody = new CompoundStatement(Loc(), sa); - vgate = v; - } - -@@ -4089,9 +4352,9 @@ AggregateDeclaration *StaticDtorDeclarat - return NULL; - } - --int StaticDtorDeclaration::isVirtual() -+bool StaticDtorDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - - bool StaticDtorDeclaration::hasStaticCtorOrDtor() -@@ -4099,14 +4362,14 @@ bool StaticDtorDeclaration::hasStaticCto - return TRUE; - } - --int StaticDtorDeclaration::addPreInvariant() -+bool StaticDtorDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int StaticDtorDeclaration::addPostInvariant() -+bool StaticDtorDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void StaticDtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4119,15 +4382,15 @@ void StaticDtorDeclaration::toCBuffer(Ou - - /********************************* SharedStaticDtorDeclaration ****************************/ - --SharedStaticDtorDeclaration::SharedStaticDtorDeclaration(Loc loc, Loc endloc) -- : StaticDtorDeclaration(loc, endloc, "_sharedStaticDtor") -+SharedStaticDtorDeclaration::SharedStaticDtorDeclaration(Loc loc, Loc endloc, StorageClass stc) -+ : StaticDtorDeclaration(loc, endloc, "_sharedStaticDtor", stc) - { - } - - Dsymbol *SharedStaticDtorDeclaration::syntaxCopy(Dsymbol *s) - { - assert(!s); -- SharedStaticDtorDeclaration *sdd = new SharedStaticDtorDeclaration(loc, endloc); -+ SharedStaticDtorDeclaration *sdd = new SharedStaticDtorDeclaration(loc, endloc, storage_class); - return FuncDeclaration::syntaxCopy(sdd); - } - -@@ -4143,8 +4406,10 @@ void SharedStaticDtorDeclaration::toCBuf - - /********************************* InvariantDeclaration ****************************/ - --InvariantDeclaration::InvariantDeclaration(Loc loc, Loc endloc) -- : FuncDeclaration(loc, endloc, Id::classInvariant, STCundefined, NULL) -+InvariantDeclaration::InvariantDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id) -+ : FuncDeclaration(loc, endloc, -+ id ? id : Identifier::generateId("__invariant"), -+ stc, NULL) - { - } - -@@ -4153,7 +4418,7 @@ Dsymbol *InvariantDeclaration::syntaxCop - InvariantDeclaration *id; - - assert(!s); -- id = new InvariantDeclaration(loc, endloc); -+ id = new InvariantDeclaration(loc, endloc, storage_class); - FuncDeclaration::syntaxCopy(id); - return id; - } -@@ -4173,13 +4438,12 @@ void InvariantDeclaration::semantic(Scop - error("invariants are only for struct/union/class definitions"); - return; - } -- else if (ad->inv && ad->inv != this && semanticRun < PASSsemantic) -+ if (ident != Id::classInvariant && semanticRun < PASSsemantic) - { -- error("more than one invariant for %s", ad->toChars()); -+ ad->invs.push(this); - } -- ad->inv = this; - if (!type) -- type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd); -+ type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd, storage_class); - - sc = sc->push(); - sc->stc &= ~STCstatic; // not a static invariant -@@ -4192,19 +4456,19 @@ void InvariantDeclaration::semantic(Scop - sc->pop(); - } - --int InvariantDeclaration::isVirtual() -+bool InvariantDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - --int InvariantDeclaration::addPreInvariant() -+bool InvariantDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int InvariantDeclaration::addPostInvariant() -+bool InvariantDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void InvariantDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4223,22 +4487,21 @@ void InvariantDeclaration::toCBuffer(Out - * instances per module. - */ - --#if __DMC__ || _MSC_VER --#define snprintf _snprintf --#endif - static Identifier *unitTestId(Loc loc) - { - char name[24]; -+#if __DMC__ || _MSC_VER -+ _snprintf(name, 24, "__unittestL%u_", loc.linnum); -+#else - snprintf(name, 24, "__unittestL%u_", loc.linnum); -+#endif - return Lexer::uniqueId(name); - } --#if __DMC__ || _MSC_VER --#undef snprintf --#endif - --UnitTestDeclaration::UnitTestDeclaration(Loc loc, Loc endloc) -+UnitTestDeclaration::UnitTestDeclaration(Loc loc, Loc endloc, char *codedoc) - : FuncDeclaration(loc, endloc, unitTestId(loc), STCundefined, NULL) - { -+ this->codedoc = codedoc; - } - - Dsymbol *UnitTestDeclaration::syntaxCopy(Dsymbol *s) -@@ -4246,13 +4509,15 @@ Dsymbol *UnitTestDeclaration::syntaxCopy - UnitTestDeclaration *utd; - - assert(!s); -- utd = new UnitTestDeclaration(loc, endloc); -+ utd = new UnitTestDeclaration(loc, endloc, codedoc); - return FuncDeclaration::syntaxCopy(utd); - } - - - void UnitTestDeclaration::semantic(Scope *sc) - { -+ protection = sc->protection; -+ - if (scope) - { sc = scope; - scope = NULL; -@@ -4263,8 +4528,6 @@ void UnitTestDeclaration::semantic(Scope - if (!type) - type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd); - Scope *sc2 = sc->push(); -- // It makes no sense for unit tests to be pure or nothrow. -- sc2->stc &= ~(STCnothrow | STCpure); - sc2->linkage = LINKd; - FuncDeclaration::semantic(sc2); - sc2->pop(); -@@ -4291,19 +4554,19 @@ AggregateDeclaration *UnitTestDeclaratio - return NULL; - } - --int UnitTestDeclaration::isVirtual() -+bool UnitTestDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - --int UnitTestDeclaration::addPreInvariant() -+bool UnitTestDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int UnitTestDeclaration::addPostInvariant() -+bool UnitTestDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void UnitTestDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4381,19 +4644,19 @@ const char *NewDeclaration::kind() - return "allocator"; - } - --int NewDeclaration::isVirtual() -+bool NewDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - --int NewDeclaration::addPreInvariant() -+bool NewDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int NewDeclaration::addPostInvariant() -+bool NewDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void NewDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -4469,24 +4732,24 @@ const char *DeleteDeclaration::kind() - return "deallocator"; - } - --int DeleteDeclaration::isDelete() -+bool DeleteDeclaration::isDelete() - { -- return TRUE; -+ return true; - } - --int DeleteDeclaration::isVirtual() -+bool DeleteDeclaration::isVirtual() - { -- return FALSE; -+ return false; - } - --int DeleteDeclaration::addPreInvariant() -+bool DeleteDeclaration::addPreInvariant() - { -- return FALSE; -+ return false; - } - --int DeleteDeclaration::addPostInvariant() -+bool DeleteDeclaration::addPostInvariant() - { -- return FALSE; -+ return false; - } - - void DeleteDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) ---- a/src/gcc/d/dfrontend/gpl.txt 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/gpl.txt 2014-04-01 16:32:51.000000000 +0100 -@@ -1,248 +1,248 @@ -- GNU GENERAL PUBLIC LICENSE
-- Version 1, February 1989
--
-- Copyright (C) 1989 Free Software Foundation, Inc.
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
-- Everyone is permitted to copy and distribute verbatim copies
-- of this license document, but changing it is not allowed.
--
-- Preamble
--
-- The license agreements of most software companies try to keep users
--at the mercy of those companies. By contrast, our General Public
--License is intended to guarantee your freedom to share and change free
--software--to make sure the software is free for all its users. The
--General Public License applies to the Free Software Foundation's
--software and to any other program whose authors commit to using it.
--You can use it for your programs, too.
--
-- When we speak of free software, we are referring to freedom, not
--price. Specifically, the General Public License is designed to make
--sure that you have the freedom to give away or sell copies of free
--software, that you receive source code or can get it if you want it,
--that you can change the software or use pieces of it in new free
--programs; and that you know you can do these things.
--
-- To protect your rights, we need to make restrictions that forbid
--anyone to deny you these rights or to ask you to surrender the rights.
--These restrictions translate to certain responsibilities for you if you
--distribute copies of the software, or if you modify it.
--
-- For example, if you distribute copies of a such a program, whether
--gratis or for a fee, you must give the recipients all the rights that
--you have. You must make sure that they, too, receive or can get the
--source code. And you must tell them their rights.
--
-- We protect your rights with two steps: (1) copyright the software, and
--(2) offer you this license which gives you legal permission to copy,
--distribute and/or modify the software.
--
-- Also, for each author's protection and ours, we want to make certain
--that everyone understands that there is no warranty for this free
--software. If the software is modified by someone else and passed on, we
--want its recipients to know that what they have is not the original, so
--that any problems introduced by others will not reflect on the original
--authors' reputations.
--
-- The precise terms and conditions for copying, distribution and
--modification follow.
--
-- GNU GENERAL PUBLIC LICENSE
-- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
--
-- 0. This License Agreement applies to any program or other work which
--contains a notice placed by the copyright holder saying it may be
--distributed under the terms of this General Public License. The
--"Program", below, refers to any such program or work, and a "work based
--on the Program" means either the Program or any work containing the
--Program or a portion of it, either verbatim or with modifications. Each
--licensee is addressed as "you".
--
-- 1. You may copy and distribute verbatim copies of the Program's source
--code as you receive it, in any medium, provided that you conspicuously and
--appropriately publish on each copy an appropriate copyright notice and
--disclaimer of warranty; keep intact all the notices that refer to this
--General Public License and to the absence of any warranty; and give any
--other recipients of the Program a copy of this General Public License
--along with the Program. You may charge a fee for the physical act of
--transferring a copy.
--
-- 2. You may modify your copy or copies of the Program or any portion of
--it, and copy and distribute such modifications under the terms of Paragraph
--1 above, provided that you also do the following:
--
-- a) cause the modified files to carry prominent notices stating that
-- you changed the files and the date of any change; and
--
-- b) cause the whole of any work that you distribute or publish, that
-- in whole or in part contains the Program or any part thereof, either
-- with or without modifications, to be licensed at no charge to all
-- third parties under the terms of this General Public License (except
-- that you may choose to grant warranty protection to some or all
-- third parties, at your option).
--
-- c) If the modified program normally reads commands interactively when
-- run, you must cause it, when started running for such interactive use
-- in the simplest and most usual way, to print or display an
-- announcement including an appropriate copyright notice and a notice
-- that there is no warranty (or else, saying that you provide a
-- warranty) and that users may redistribute the program under these
-- conditions, and telling the user how to view a copy of this General
-- Public License.
--
-- d) You may charge a fee for the physical act of transferring a
-- copy, and you may at your option offer warranty protection in
-- exchange for a fee.
--
--Mere aggregation of another independent work with the Program (or its
--derivative) on a volume of a storage or distribution medium does not bring
--the other work under the scope of these terms.
--
-- 3. You may copy and distribute the Program (or a portion or derivative of
--it, under Paragraph 2) in object code or executable form under the terms of
--Paragraphs 1 and 2 above provided that you also do one of the following:
--
-- a) accompany it with the complete corresponding machine-readable
-- source code, which must be distributed under the terms of
-- Paragraphs 1 and 2 above; or,
--
-- b) accompany it with a written offer, valid for at least three
-- years, to give any third party free (except for a nominal charge
-- for the cost of distribution) a complete machine-readable copy of the
-- corresponding source code, to be distributed under the terms of
-- Paragraphs 1 and 2 above; or,
--
-- c) accompany it with the information you received as to where the
-- corresponding source code may be obtained. (This alternative is
-- allowed only for noncommercial distribution and only if you
-- received the program in object code or executable form alone.)
--
--Source code for a work means the preferred form of the work for making
--modifications to it. For an executable file, complete source code means
--all the source code for all modules it contains; but, as a special
--exception, it need not include source code for modules which are standard
--libraries that accompany the operating system on which the executable
--file runs, or for standard header files or definitions files that
--accompany that operating system.
--
-- 4. You may not copy, modify, sublicense, distribute or transfer the
--Program except as expressly provided under this General Public License.
--Any attempt otherwise to copy, modify, sublicense, distribute or transfer
--the Program is void, and will automatically terminate your rights to use
--the Program under this License. However, parties who have received
--copies, or rights to use copies, from you under this General Public
--License will not have their licenses terminated so long as such parties
--remain in full compliance.
--
-- 5. By copying, distributing or modifying the Program (or any work based
--on the Program) you indicate your acceptance of this license to do so,
--and all its terms and conditions.
--
-- 6. Each time you redistribute the Program (or any work based on the
--Program), the recipient automatically receives a license from the original
--licensor to copy, distribute or modify the Program subject to these
--terms and conditions. You may not impose any further restrictions on the
--recipients' exercise of the rights granted herein.
--
-- 7. The Free Software Foundation may publish revised and/or new versions
--of the General Public License from time to time. Such new versions will
--be similar in spirit to the present version, but may differ in detail to
--address new problems or concerns.
--
--Each version is given a distinguishing version number. If the Program
--specifies a version number of the license which applies to it and "any
--later version", you have the option of following the terms and conditions
--either of that version or of any later version published by the Free
--Software Foundation. If the Program does not specify a version number of
--the license, you may choose any version ever published by the Free Software
--Foundation.
--
-- 8. If you wish to incorporate parts of the Program into other free
--programs whose distribution conditions are different, write to the author
--to ask for permission. For software which is copyrighted by the Free
--Software Foundation, write to the Free Software Foundation; we sometimes
--make exceptions for this. Our decision will be guided by the two goals
--of preserving the free status of all derivatives of our free software and
--of promoting the sharing and reuse of software generally.
--
-- NO WARRANTY
--
-- 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
--FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
--OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
--PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
--OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
--MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
--TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
--PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
--REPAIR OR CORRECTION.
--
-- 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
--WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
--REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
--INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
--OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
--TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
--YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
--PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
--POSSIBILITY OF SUCH DAMAGES.
--
-- END OF TERMS AND CONDITIONS
--
-- Appendix: How to Apply These Terms to Your New Programs
--
-- If you develop a new program, and you want it to be of the greatest
--possible use to humanity, the best way to achieve this is to make it
--free software which everyone can redistribute and change under these
--terms.
--
-- To do so, attach the following notices to the program. It is safest to
--attach them to the start of each source file to most effectively convey
--the exclusion of warranty; and each file should have at least the
--"copyright" line and a pointer to where the full notice is found.
--
-- <one line to give the program's name and a brief idea of what it does.>
-- Copyright (C) 19yy <name of author>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 1, or (at your option)
-- any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software Foundation,
-- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
--
--Also add information on how to contact you by electronic and paper mail.
--
--If the program is interactive, make it output a short notice like this
--when it starts in an interactive mode:
--
-- Gnomovision version 69, Copyright (C) 19xx name of author
-- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-- This is free software, and you are welcome to redistribute it
-- under certain conditions; type `show c' for details.
--
--The hypothetical commands `show w' and `show c' should show the
--appropriate parts of the General Public License. Of course, the
--commands you use may be called something other than `show w' and `show
--c'; they could even be mouse-clicks or menu items--whatever suits your
--program.
--
--You should also get your employer (if you work as a programmer) or your
--school, if any, to sign a "copyright disclaimer" for the program, if
--necessary. Here a sample; alter the names:
--
-- Yoyodyne, Inc., hereby disclaims all copyright interest in the
-- program `Gnomovision' (a program to direct compilers to make passes
-- at assemblers) written by James Hacker.
--
-- <signature of Ty Coon>, 1 April 1989
-- Ty Coon, President of Vice
--
--That's all there is to it!
-+ GNU GENERAL PUBLIC LICENSE -+ Version 1, February 1989 -+ -+ Copyright (C) 1989 Free Software Foundation, Inc. -+ 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+ Preamble -+ -+ The license agreements of most software companies try to keep users -+at the mercy of those companies. By contrast, our General Public -+License is intended to guarantee your freedom to share and change free -+software--to make sure the software is free for all its users. The -+General Public License applies to the Free Software Foundation's -+software and to any other program whose authors commit to using it. -+You can use it for your programs, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Specifically, the General Public License is designed to make -+sure that you have the freedom to give away or sell copies of free -+software, that you receive source code or can get it if you want it, -+that you can change the software or use pieces of it in new free -+programs; and that you know you can do these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+anyone to deny you these rights or to ask you to surrender the rights. -+These restrictions translate to certain responsibilities for you if you -+distribute copies of the software, or if you modify it. -+ -+ For example, if you distribute copies of a such a program, whether -+gratis or for a fee, you must give the recipients all the rights that -+you have. You must make sure that they, too, receive or can get the -+source code. And you must tell them their rights. -+ -+ We protect your rights with two steps: (1) copyright the software, and -+(2) offer you this license which gives you legal permission to copy, -+distribute and/or modify the software. -+ -+ Also, for each author's protection and ours, we want to make certain -+that everyone understands that there is no warranty for this free -+software. If the software is modified by someone else and passed on, we -+want its recipients to know that what they have is not the original, so -+that any problems introduced by others will not reflect on the original -+authors' reputations. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. -+ -+ GNU GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License Agreement applies to any program or other work which -+contains a notice placed by the copyright holder saying it may be -+distributed under the terms of this General Public License. The -+"Program", below, refers to any such program or work, and a "work based -+on the Program" means either the Program or any work containing the -+Program or a portion of it, either verbatim or with modifications. Each -+licensee is addressed as "you". -+ -+ 1. You may copy and distribute verbatim copies of the Program's source -+code as you receive it, in any medium, provided that you conspicuously and -+appropriately publish on each copy an appropriate copyright notice and -+disclaimer of warranty; keep intact all the notices that refer to this -+General Public License and to the absence of any warranty; and give any -+other recipients of the Program a copy of this General Public License -+along with the Program. You may charge a fee for the physical act of -+transferring a copy. -+ -+ 2. You may modify your copy or copies of the Program or any portion of -+it, and copy and distribute such modifications under the terms of Paragraph -+1 above, provided that you also do the following: -+ -+ a) cause the modified files to carry prominent notices stating that -+ you changed the files and the date of any change; and -+ -+ b) cause the whole of any work that you distribute or publish, that -+ in whole or in part contains the Program or any part thereof, either -+ with or without modifications, to be licensed at no charge to all -+ third parties under the terms of this General Public License (except -+ that you may choose to grant warranty protection to some or all -+ third parties, at your option). -+ -+ c) If the modified program normally reads commands interactively when -+ run, you must cause it, when started running for such interactive use -+ in the simplest and most usual way, to print or display an -+ announcement including an appropriate copyright notice and a notice -+ that there is no warranty (or else, saying that you provide a -+ warranty) and that users may redistribute the program under these -+ conditions, and telling the user how to view a copy of this General -+ Public License. -+ -+ d) You may charge a fee for the physical act of transferring a -+ copy, and you may at your option offer warranty protection in -+ exchange for a fee. -+ -+Mere aggregation of another independent work with the Program (or its -+derivative) on a volume of a storage or distribution medium does not bring -+the other work under the scope of these terms. -+ -+ 3. You may copy and distribute the Program (or a portion or derivative of -+it, under Paragraph 2) in object code or executable form under the terms of -+Paragraphs 1 and 2 above provided that you also do one of the following: -+ -+ a) accompany it with the complete corresponding machine-readable -+ source code, which must be distributed under the terms of -+ Paragraphs 1 and 2 above; or, -+ -+ b) accompany it with a written offer, valid for at least three -+ years, to give any third party free (except for a nominal charge -+ for the cost of distribution) a complete machine-readable copy of the -+ corresponding source code, to be distributed under the terms of -+ Paragraphs 1 and 2 above; or, -+ -+ c) accompany it with the information you received as to where the -+ corresponding source code may be obtained. (This alternative is -+ allowed only for noncommercial distribution and only if you -+ received the program in object code or executable form alone.) -+ -+Source code for a work means the preferred form of the work for making -+modifications to it. For an executable file, complete source code means -+all the source code for all modules it contains; but, as a special -+exception, it need not include source code for modules which are standard -+libraries that accompany the operating system on which the executable -+file runs, or for standard header files or definitions files that -+accompany that operating system. -+ -+ 4. You may not copy, modify, sublicense, distribute or transfer the -+Program except as expressly provided under this General Public License. -+Any attempt otherwise to copy, modify, sublicense, distribute or transfer -+the Program is void, and will automatically terminate your rights to use -+the Program under this License. However, parties who have received -+copies, or rights to use copies, from you under this General Public -+License will not have their licenses terminated so long as such parties -+remain in full compliance. -+ -+ 5. By copying, distributing or modifying the Program (or any work based -+on the Program) you indicate your acceptance of this license to do so, -+and all its terms and conditions. -+ -+ 6. Each time you redistribute the Program (or any work based on the -+Program), the recipient automatically receives a license from the original -+licensor to copy, distribute or modify the Program subject to these -+terms and conditions. You may not impose any further restrictions on the -+recipients' exercise of the rights granted herein. -+ -+ 7. The Free Software Foundation may publish revised and/or new versions -+of the General Public License from time to time. Such new versions will -+be similar in spirit to the present version, but may differ in detail to -+address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Program -+specifies a version number of the license which applies to it and "any -+later version", you have the option of following the terms and conditions -+either of that version or of any later version published by the Free -+Software Foundation. If the Program does not specify a version number of -+the license, you may choose any version ever published by the Free Software -+Foundation. -+ -+ 8. If you wish to incorporate parts of the Program into other free -+programs whose distribution conditions are different, write to the author -+to ask for permission. For software which is copyrighted by the Free -+Software Foundation, write to the Free Software Foundation; we sometimes -+make exceptions for this. Our decision will be guided by the two goals -+of preserving the free status of all derivatives of our free software and -+of promoting the sharing and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -+REPAIR OR CORRECTION. -+ -+ 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -+POSSIBILITY OF SUCH DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ -+ Appendix: How to Apply These Terms to Your New Programs -+ -+ If you develop a new program, and you want it to be of the greatest -+possible use to humanity, the best way to achieve this is to make it -+free software which everyone can redistribute and change under these -+terms. -+ -+ To do so, attach the following notices to the program. It is safest to -+attach them to the start of each source file to most effectively convey -+the exclusion of warranty; and each file should have at least the -+"copyright" line and a pointer to where the full notice is found. -+ -+ <one line to give the program's name and a brief idea of what it does.> -+ Copyright (C) 19yy <name of author> -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 1, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software Foundation, -+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+If the program is interactive, make it output a short notice like this -+when it starts in an interactive mode: -+ -+ Gnomovision version 69, Copyright (C) 19xx name of author -+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -+ This is free software, and you are welcome to redistribute it -+ under certain conditions; type `show c' for details. -+ -+The hypothetical commands `show w' and `show c' should show the -+appropriate parts of the General Public License. Of course, the -+commands you use may be called something other than `show w' and `show -+c'; they could even be mouse-clicks or menu items--whatever suits your -+program. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the program, if -+necessary. Here a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the -+ program `Gnomovision' (a program to direct compilers to make passes -+ at assemblers) written by James Hacker. -+ -+ <signature of Ty Coon>, 1 April 1989 -+ Ty Coon, President of Vice -+ -+That's all there is to it! ---- a/src/gcc/d/dfrontend/hdrgen.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/hdrgen.c 2014-04-01 16:32:51.000000000 +0100 -@@ -66,8 +66,8 @@ void Module::genhdrfile() - hdrfile->setbuffer(hdrbufr.data, hdrbufr.offset); - hdrbufr.data = NULL; - -- FileName::ensurePathToNameExists(hdrfile->toChars()); -- hdrfile->writev(); -+ ensurePathToNameExists(Loc(), hdrfile->toChars()); -+ writeFile(loc, hdrfile); - } - - ---- a/src/gcc/d/dfrontend/identifier.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/identifier.c 2014-04-01 16:32:51.000000000 +0100 -@@ -25,17 +25,12 @@ Identifier::Identifier(const char *strin - this->len = strlen(string); - } - --hash_t Identifier::hashCode() --{ -- return String::calcHash(string); --} -- --int Identifier::equals(Object *o) -+bool Identifier::equals(RootObject *o) - { - return this == o || memcmp(string,o->toChars(),len+1) == 0; - } - --int Identifier::compare(Object *o) -+int Identifier::compare(RootObject *o) - { - return memcmp(string, o->toChars(), len + 1); - } -@@ -51,7 +46,6 @@ const char *Identifier::toHChars2() - - if (this == Id::ctor) p = "this"; - else if (this == Id::dtor) p = "~this"; -- else if (this == Id::classInvariant) p = "invariant"; - else if (this == Id::unitTest) p = "unittest"; - else if (this == Id::dollar) p = "$"; - else if (this == Id::withSym) p = "with"; -@@ -65,6 +59,8 @@ const char *Identifier::toHChars2() - p = "static this"; - else if (memcmp(p, "_staticDtor", 11) == 0) - p = "static ~this"; -+ else if (memcmp(p, "__invariant", 11) == 0) -+ p = "invariant"; - } - } - -@@ -73,7 +69,7 @@ const char *Identifier::toHChars2() - - void Identifier::print() - { -- fprintf(stdmsg, "%s",string); -+ fprintf(stderr, "%s",string); - } - - int Identifier::dyncast() ---- a/src/gcc/d/dfrontend/identifier.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/identifier.h 2014-04-01 16:32:51.000000000 +0100 -@@ -17,19 +17,18 @@ - - #include "root.h" - --struct Identifier : Object -+class Identifier : public RootObject - { -+public: - int value; - const char *string; - size_t len; - - Identifier(const char *string, int value); -- int equals(Object *o); -- hash_t hashCode(); -- int compare(Object *o); -+ bool equals(RootObject *o); -+ int compare(RootObject *o); - void print(); - char *toChars(); -- char *toHChars(); - const char *toHChars2(); - int dyncast(); - ---- a/src/gcc/d/dfrontend/idgen.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/idgen.c 2014-04-01 16:32:51.000000000 +0100 -@@ -108,6 +108,9 @@ Msgtable msgtable[] = - - { "LINE", "__LINE__" }, - { "FILE", "__FILE__" }, -+ { "MODULE", "__MODULE__" }, -+ { "FUNCTION", "__FUNCTION__" }, -+ { "PRETTY_FUNCTION", "__PRETTY_FUNCTION__" }, - { "DATE", "__DATE__" }, - { "TIME", "__TIME__" }, - { "TIMESTAMP", "__TIMESTAMP__" }, -@@ -263,6 +266,7 @@ Msgtable msgtable[] = - { "lib" }, - { "msg" }, - { "startaddress" }, -+ { "mangle" }, - - // For special functions - { "tohash", "toHash" }, -@@ -275,6 +279,7 @@ Msgtable msgtable[] = - { "WinMain" }, - { "DllMain" }, - { "tls_get_addr", "___tls_get_addr" }, -+ { "entrypoint", "__entrypoint" }, - - // varargs implementation - { "va_argsave_t", "__va_argsave_t" }, -@@ -307,6 +312,7 @@ Msgtable msgtable[] = - { "isAssociativeArray" }, - { "isFinalClass" }, - { "isPOD" }, -+ { "isNested" }, - { "isFloating" }, - { "isIntegral" }, - { "isScalar" }, -@@ -335,6 +341,9 @@ Msgtable msgtable[] = - { "compiles" }, - { "parameters" }, - { "getAttributes" }, -+ { "getUnitTests" }, -+ { "isOverrideFunction" }, -+ { "getVirtualIndex" } - }; - - -@@ -356,7 +365,7 @@ int main() - #endif - fprintf(fp, "#ifndef DMD_ID_H\n"); - fprintf(fp, "#define DMD_ID_H 1\n"); -- fprintf(fp, "struct Identifier;\n"); -+ fprintf(fp, "class Identifier;\n"); - fprintf(fp, "struct Id\n"); - fprintf(fp, "{\n"); - ---- a/src/gcc/d/dfrontend/impcnvgen.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/impcnvgen.c 2014-04-01 16:32:51.000000000 +0100 -@@ -381,44 +381,64 @@ int main() - fprintf(fp,"unsigned char Type::impcnvResult[TMAX][TMAX] =\n{\n"); - for (i = 0; i < TMAX; i++) - { -+ if (i) -+ fprintf(fp, ","); -+ fprintf(fp, "{"); - for (j = 0; j < TMAX; j++) - { -- fprintf(fp, "%d,",impcnvResult[i][j]); -+ if (j) -+ fprintf(fp, ","); -+ fprintf(fp, "%d",impcnvResult[i][j]); - } -- fprintf(fp, "\n"); -+ fprintf(fp, "}\n"); - } - fprintf(fp,"};\n"); - - fprintf(fp,"unsigned char Type::impcnvType1[TMAX][TMAX] =\n{\n"); - for (i = 0; i < TMAX; i++) - { -+ if (i) -+ fprintf(fp, ","); -+ fprintf(fp, "{"); - for (j = 0; j < TMAX; j++) - { -- fprintf(fp, "%d,",impcnvType1[i][j]); -+ if (j) -+ fprintf(fp, ","); -+ fprintf(fp, "%d",impcnvType1[i][j]); - } -- fprintf(fp, "\n"); -+ fprintf(fp, "}\n"); - } - fprintf(fp,"};\n"); - - fprintf(fp,"unsigned char Type::impcnvType2[TMAX][TMAX] =\n{\n"); - for (i = 0; i < TMAX; i++) - { -+ if (i) -+ fprintf(fp, ","); -+ fprintf(fp, "{"); - for (j = 0; j < TMAX; j++) - { -- fprintf(fp, "%d,",impcnvType2[i][j]); -+ if (j) -+ fprintf(fp, ","); -+ fprintf(fp, "%d",impcnvType2[i][j]); - } -- fprintf(fp, "\n"); -+ fprintf(fp, "}\n"); - } - fprintf(fp,"};\n"); - - fprintf(fp,"unsigned char Type::impcnvWarn[TMAX][TMAX] =\n{\n"); - for (i = 0; i < TMAX; i++) - { -+ if (i) -+ fprintf(fp, ","); -+ fprintf(fp, "{"); - for (j = 0; j < TMAX; j++) - { -- fprintf(fp, "%d,",impcnvWarn[i][j]); -+ if (j) -+ fprintf(fp, ","); -+ fprintf(fp, "%d",impcnvWarn[i][j]); - } -- fprintf(fp, "\n"); -+ fprintf(fp, "}\n"); - } - fprintf(fp,"};\n"); - ---- a/src/gcc/d/dfrontend/import.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/import.c 2014-04-01 16:32:51.000000000 +0100 -@@ -30,6 +30,18 @@ Import::Import(Loc loc, Identifiers *pac - : Dsymbol(NULL) - { - assert(id); -+#if 0 -+ printf("Import::Import("); -+ if (packages && packages->dim) -+ { -+ for (size_t i = 0; i < packages->dim; i++) -+ { -+ Identifier *id = (*packages)[i]; -+ printf("%s.", id->toChars()); -+ } -+ } -+ printf("%s)\n", id->toChars()); -+#endif - this->loc = loc; - this->packages = packages; - this->id = id; -@@ -68,7 +80,7 @@ const char *Import::kind() - return isstatic ? (char *)"static import" : (char *)"import"; - } - --enum PROT Import::prot() -+PROT Import::prot() - { - return protection; - } -@@ -89,10 +101,11 @@ Dsymbol *Import::syntaxCopy(Dsymbol *s) - - void Import::load(Scope *sc) - { -- //printf("Import::load('%s')\n", toChars()); -+ //printf("Import::load('%s') %p\n", toPrettyChars(), this); - - // See if existing module - DsymbolTable *dst = Package::resolve(packages, NULL, &pkg); -+#if 0 - if (pkg && pkg->isModule()) - { - ::error(loc, "can only import from a module, not from a member of module %s. Did you mean `import %s : %s`?", -@@ -100,6 +113,7 @@ void Import::load(Scope *sc) - mod = pkg->isModule(); // Error recovery - treat as import of that module - return; - } -+#endif - Dsymbol *s = dst->lookup(id); - if (s) - { -@@ -107,7 +121,31 @@ void Import::load(Scope *sc) - mod = (Module *)s; - else - { -- if (pkg) -+ if (s->isAliasDeclaration()) -+ { -+ ::error(loc, "%s %s conflicts with %s", s->kind(), s->toPrettyChars(), id->toChars()); -+ } -+ else if (Package *p = s->isPackage()) -+ { -+ if (p->isPkgMod == PKGunknown) -+ { -+ mod = Module::load(loc, packages, id); -+ if (!mod) -+ p->isPkgMod = PKGpackage; -+ else -+ assert(p->isPkgMod == PKGmodule); -+ } -+ else if (p->isPkgMod == PKGmodule) -+ { -+ mod = p->mod; -+ } -+ if (p->isPkgMod != PKGmodule) -+ { -+ ::error(loc, "can only import from a module, not from package %s.%s", -+ p->toPrettyChars(), id->toChars()); -+ } -+ } -+ else if (pkg) - { - ::error(loc, "can only import from a module, not from package %s.%s", - pkg->toPrettyChars(), id->toChars()); -@@ -128,43 +166,23 @@ void Import::load(Scope *sc) - { - dst->insert(id, mod); // id may be different from mod->ident, - // if so then insert alias -- if (!mod->importedFrom) -- mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule; - } - } -+ if (mod && !mod->importedFrom) -+ mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule; - if (!pkg) - pkg = mod; - - //printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg); - } - --void escapePath(OutBuffer *buf, const char *fname) --{ -- while (1) -- { -- switch (*fname) -- { -- case 0: -- return; -- case '(': -- case ')': -- case '\\': -- buf->writebyte('\\'); -- default: -- buf->writebyte(*fname); -- break; -- } -- fname++; -- } --} -- - void Import::importAll(Scope *sc) - { - if (!mod) - { - load(sc); - if (mod) // if successfully loaded module -- { mod->importAll(0); -+ { mod->importAll(NULL); - - if (!isstatic && !aliasId && !names.dim) - { -@@ -178,7 +196,7 @@ void Import::importAll(Scope *sc) - - void Import::semantic(Scope *sc) - { -- //printf("Import::semantic('%s')\n", toChars()); -+ //printf("Import::semantic('%s')\n", toPrettyChars()); - - if (scope) - { sc = scope; -@@ -189,7 +207,7 @@ void Import::semantic(Scope *sc) - if (!mod) - { load(sc); - if (mod) -- mod->importAll(0); -+ mod->importAll(NULL); - } - - if (mod) -@@ -245,7 +263,6 @@ void Import::semantic(Scope *sc) - if (mod->search(loc, names[i], 0)) - { - ad->semantic(sc); -- ad->import = NULL; // forward reference resolved - } - else - { -@@ -261,7 +278,10 @@ void Import::semantic(Scope *sc) - - if (global.params.moduleDeps != NULL && - // object self-imports itself, so skip that (Bugzilla 7547) -- !(id == Id::object && sc->module->ident == Id::object)) -+ !(id == Id::object && sc->module->ident == Id::object) && -+ // don't list pseudo modules __entrypoint.d, __main.d (Bugzilla 11117, 11164) -+ sc->module->ident != Id::entrypoint && -+ strcmp(sc->module->ident->string, "__main") != 0) - { - /* The grammar of the file is: - * ImportDeclaration -@@ -277,10 +297,12 @@ void Import::semantic(Scope *sc) - */ - - OutBuffer *ob = global.params.moduleDeps; -- -- ob->writestring(sc->module->toPrettyChars()); -+ Module* imod = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ if (!global.params.moduleDepsFile) -+ ob->writestring("depsImport "); -+ ob->writestring(imod->toPrettyChars()); - ob->writestring(" ("); -- escapePath(ob, sc->module->srcfile->toChars()); -+ escapePath(ob, imod->srcfile->toChars()); - ob->writestring(") : "); - - // use protection instead of sc->protection because it couldn't be -@@ -404,7 +426,7 @@ Dsymbol *Import::search(Loc loc, Identif - return pkg->search(loc, ident, flags); - } - --int Import::overloadInsert(Dsymbol *s) -+bool Import::overloadInsert(Dsymbol *s) - { - /* Allow multiple imports with the same package base, but disallow - * alias collisions (Bugzilla 5412). -@@ -412,9 +434,9 @@ int Import::overloadInsert(Dsymbol *s) - assert(ident && ident == s->ident); - Import *imp; - if (!aliasId && (imp = s->isImport()) != NULL && !imp->aliasId) -- return TRUE; -+ return true; - else -- return FALSE; -+ return false; - } - - void Import::toCBuffer(OutBuffer *buf, HdrGenState *hgs) ---- a/src/gcc/d/dfrontend/import.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/import.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2007 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -18,37 +18,41 @@ - #include "dsymbol.h" - - --struct Identifier; -+class Identifier; - struct Scope; - struct OutBuffer; --struct Module; --struct Package; --struct AliasDeclaration; -+class Module; -+class Package; -+class AliasDeclaration; - struct HdrGenState; - --struct Import : Dsymbol -+class Import : public Dsymbol - { -+public: -+ /* static import aliasId = pkg1.pkg2.id : alias1 = name1, alias2 = name2; -+ */ -+ - Identifiers *packages; // array of Identifier's representing packages - Identifier *id; // module Identifier - Identifier *aliasId; - int isstatic; // !=0 if static import -- enum PROT protection; -+ PROT protection; - - // Pairs of alias=name to bind into current namespace - Identifiers names; - Identifiers aliases; - -- AliasDeclarations aliasdecls; // AliasDeclarations for names/aliases -- -- Module *mod; -- Package *pkg; // leftmost package/module -- - Import(Loc loc, Identifiers *packages, Identifier *id, Identifier *aliasId, - int isstatic); - void addAlias(Identifier *name, Identifier *alias); - -+ AliasDeclarations aliasdecls; // corresponding AliasDeclarations for alias=name pairs -+ -+ Module *mod; -+ Package *pkg; // leftmost package/module -+ - const char *kind(); -- enum PROT prot(); -+ PROT prot(); - Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees - void load(Scope *sc); - void importAll(Scope *sc); -@@ -57,7 +61,7 @@ struct Import : Dsymbol - Dsymbol *toAlias(); - int addMember(Scope *sc, ScopeDsymbol *s, int memnum); - Dsymbol *search(Loc loc, Identifier *ident, int flags); -- int overloadInsert(Dsymbol *s); -+ bool overloadInsert(Dsymbol *s); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - void toJson(JsonOut *json); - ---- a/src/gcc/d/dfrontend/init.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/init.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -65,15 +65,48 @@ Initializers *Initializer::arraySyntaxCo - } - - char *Initializer::toChars() --{ OutBuffer *buf; -+{ - HdrGenState hgs; - -- memset(&hgs, 0, sizeof(hgs)); -- buf = new OutBuffer(); -- toCBuffer(buf, &hgs); -- return buf->toChars(); -+ OutBuffer buf; -+ toCBuffer(&buf, &hgs); -+ buf.writebyte(0); -+ return buf.extractData(); -+} -+ -+/********************************** ErrorInitializer ***************************/ -+ -+ErrorInitializer::ErrorInitializer() -+ : Initializer(Loc()) -+{ -+} -+ -+ -+Initializer *ErrorInitializer::syntaxCopy() -+{ -+ return this; -+} -+ -+ -+Initializer *ErrorInitializer::semantic(Scope *sc, Type *t, NeedInterpret needInterpret) -+{ -+ //printf("ErrorInitializer::semantic(t = %p)\n", t); -+ return this; -+} -+ -+ -+Expression *ErrorInitializer::toExpression(Type *t) -+{ -+ return new ErrorExp(); -+} -+ -+ -+void ErrorInitializer::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -+{ -+ buf->writestring("__error__"); - } - -+ - /********************************** VoidInitializer ***************************/ - - VoidInitializer::VoidInitializer(Loc loc) -@@ -97,10 +130,9 @@ Initializer *VoidInitializer::semantic(S - } - - --Expression *VoidInitializer::toExpression() -+Expression *VoidInitializer::toExpression(Type *t) - { -- error(loc, "void initializer has no value"); -- return new IntegerExp(0); -+ return NULL; - } - - -@@ -115,7 +147,6 @@ void VoidInitializer::toCBuffer(OutBuffe - StructInitializer::StructInitializer(Loc loc) - : Initializer(loc) - { -- ad = NULL; - } - - Initializer *StructInitializer::syntaxCopy() -@@ -145,69 +176,48 @@ void StructInitializer::addInit(Identifi - - Initializer *StructInitializer::semantic(Scope *sc, Type *t, NeedInterpret needInterpret) - { -- int errors = 0; -- - //printf("StructInitializer::semantic(t = %s) %s\n", t->toChars(), toChars()); -- vars.setDim(field.dim); - t = t->toBasetype(); - if (t->ty == Tsarray && t->nextOf()->toBasetype()->ty == Tstruct) - t = t->nextOf()->toBasetype(); - if (t->ty == Tstruct) - { -- size_t fieldi = 0; -- -- TypeStruct *ts = (TypeStruct *)t; -- ad = ts->sym; -- if (ad->ctor) -+ StructDeclaration *sd = ((TypeStruct *)t)->sym; -+ if (sd->ctor) -+ { - error(loc, "%s %s has constructors, cannot use { initializers }, use %s( initializers ) instead", -- ad->kind(), ad->toChars(), ad->toChars()); -- StructDeclaration *sd = ad->isStructDeclaration(); -- assert(sd); -+ sd->kind(), sd->toChars(), sd->toChars()); -+ return new ErrorInitializer(); -+ } - sd->size(loc); - if (sd->sizeok != SIZEOKdone) -- { -- error(loc, "struct %s is forward referenced", sd->toChars()); -- errors = 1; -- goto Lerror; -- } -- size_t nfields = sd->fields.dim; -- if (sd->isnested) -- nfields--; -- for (size_t i = 0; i < field.dim; i++) -- { -- Identifier *id = field[i]; -- Initializer *val = value[i]; -- Dsymbol *s; -- VarDeclaration *v; -+ return new ErrorInitializer(); -+ size_t nfields = sd->fields.dim - sd->isNested(); - -- if (id == NULL) -- { -- if (fieldi >= nfields) -- { error(loc, "too many initializers for %s", ad->toChars()); -- errors = 1; -- field.remove(i); -- i--; -- continue; -- } -- else -- { -- s = ad->fields[fieldi]; -- } -- } -- else -+ //expandTuples for non-identity arguments? -+ -+ Expressions *elements = new Expressions(); -+ elements->setDim(nfields); -+ for (size_t i = 0; i < elements->dim; i++) -+ (*elements)[i] = NULL; -+ -+ // Run semantic for explicitly given initializers -+ // TODO: this part is slightly different from StructLiteralExp::semantic. -+ bool errors = false; -+ for (size_t fieldi = 0, i = 0; i < field.dim; i++) -+ { -+ if (Identifier *id = field[i]) - { -- //s = ad->symtab->lookup(id); -- s = ad->search(loc, id, 0); -+ Dsymbol *s = sd->search(loc, id, 0); - if (!s) - { -- s = ad->search_correct(id); -+ s = sd->search_correct(id); - if (s) - error(loc, "'%s' is not a member of '%s', did you mean '%s %s'?", -- id->toChars(), t->toChars(), s->kind(), s->toChars()); -+ id->toChars(), sd->toChars(), s->kind(), s->toChars()); - else -- error(loc, "'%s' is not a member of '%s'", id->toChars(), t->toChars()); -- errors = 1; -- continue; -+ error(loc, "'%s' is not a member of '%s'", id->toChars(), sd->toChars()); -+ return new ErrorInitializer(); - } - s = s->toAlias(); - -@@ -217,52 +227,82 @@ Initializer *StructInitializer::semantic - if (fieldi >= nfields) - { - error(loc, "%s.%s is not a per-instance initializable field", -- t->toChars(), s->toChars()); -- errors = 1; -- break; -+ sd->toChars(), s->toChars()); -+ return new ErrorInitializer(); - } -- if (s == ad->fields[fieldi]) -+ if (s == sd->fields[fieldi]) - break; - } - } -- if (s && (v = s->isVarDeclaration()) != NULL) -+ else if (fieldi >= nfields) - { -- val = val->semantic(sc, v->type->addMod(t->mod), needInterpret); -- value[i] = val; -- vars[i] = v; -+ error(loc, "too many initializers for %s", sd->toChars()); -+ return new ErrorInitializer(); - } -- else -- { error(loc, "%s is not a field of %s", id ? id->toChars() : s->toChars(), ad->toChars()); -- errors = 1; -+ -+ VarDeclaration *vd = sd->fields[fieldi]; -+ if ((*elements)[fieldi]) -+ { -+ error(loc, "duplicate initializer for field '%s'", vd->toChars()); -+ errors = true; -+ continue; - } -- fieldi++; -- } -+ for (size_t j = 0; j < nfields; j++) -+ { -+ VarDeclaration *v2 = sd->fields[j]; -+ bool overlap = (vd->offset < v2->offset + v2->type->size() && -+ v2->offset < vd->offset + vd->type->size()); -+ if (overlap && (*elements)[j]) -+ { -+ error(loc, "overlapping initialization for field %s and %s", -+ v2->toChars(), vd->toChars()); -+ errors = true; -+ continue; -+ } -+ } -+ -+ assert(sc); -+ Initializer *iz = value[i]; -+ iz = iz->semantic(sc, vd->type->addMod(t->mod), needInterpret); -+ Expression *ex = iz->toExpression(); -+ if (ex->op == TOKerror) -+ { -+ errors = true; -+ continue; -+ } -+ value[i] = iz; -+ (*elements)[fieldi] = ex; -+ ++fieldi; -+ } -+ if (errors) -+ return new ErrorInitializer(); -+ -+ StructLiteralExp *sle = new StructLiteralExp(loc, sd, elements, t); -+ Expression *e = sle->fill(false); -+ if (e->op == TOKerror) -+ return new ErrorInitializer(); -+ -+ e->type = t; -+ -+ ExpInitializer *ie = new ExpInitializer(loc, e); -+ return ie->semantic(sc, t, needInterpret); - } - else if (t->ty == Tdelegate && value.dim == 0) -- { /* Rewrite as empty delegate literal { } -+ { -+ /* Rewrite as empty delegate literal { } - */ - Parameters *arguments = new Parameters; - Type *tf = new TypeFunction(arguments, NULL, 0, LINKd); -- FuncLiteralDeclaration *fd = new FuncLiteralDeclaration(loc, 0, tf, TOKdelegate, NULL); -+ FuncLiteralDeclaration *fd = new FuncLiteralDeclaration(loc, Loc(), tf, TOKdelegate, NULL); - fd->fbody = new CompoundStatement(loc, new Statements()); - fd->endloc = loc; - Expression *e = new FuncExp(loc, fd); - ExpInitializer *ie = new ExpInitializer(loc, e); - return ie->semantic(sc, t, needInterpret); - } -- else -- { -- error(loc, "a struct is not a valid initializer for a %s", t->toChars()); -- errors = 1; -- } --Lerror: -- if (errors) -- { -- field.setDim(0); -- value.setDim(0); -- vars.setDim(0); -- } -- return this; -+ -+ error(loc, "a struct is not a valid initializer for a %s", t->toChars()); -+ return new ErrorInitializer(); - } - - /*************************************** -@@ -270,156 +310,12 @@ Lerror: - * a struct literal. In the future, the two should be the - * same thing. - */ --Expression *StructInitializer::toExpression() --{ Expression *e; -- size_t offset; -- -- //printf("StructInitializer::toExpression() %s\n", toChars()); -- if (!ad) // if fwd referenced -- return NULL; -- StructDeclaration *sd = ad->isStructDeclaration(); -- if (!sd) -- return NULL; -- -- Expressions *elements = new Expressions(); -- size_t nfields = ad->fields.dim; --#if DMDV2 -- if (sd->isnested) -- nfields--; --#endif -- elements->setDim(nfields); -- for (size_t i = 0; i < elements->dim; i++) -- { -- (*elements)[i] = NULL; -- } -- size_t fieldi = 0; -- for (size_t i = 0; i < value.dim; i++) -- { -- Identifier *id = field[i]; -- if (id) -- { -- Dsymbol * s = ad->search(loc, id, 0); -- if (!s) -- { -- error(loc, "'%s' is not a member of '%s'", id->toChars(), sd->toChars()); -- goto Lno; -- } -- s = s->toAlias(); -- -- // Find out which field index it is -- for (fieldi = 0; 1; fieldi++) -- { -- if (fieldi >= nfields) -- { -- s->error("is not a per-instance initializable field"); -- goto Lno; -- } -- if (s == ad->fields[fieldi]) -- break; -- } -- } -- else if (fieldi >= nfields) -- { error(loc, "too many initializers for '%s'", ad->toChars()); -- goto Lno; -- } -- Initializer *iz = value[i]; -- if (!iz) -- goto Lno; -- Expression *ex = iz->toExpression(); -- if (!ex) -- goto Lno; -- if ((*elements)[fieldi]) -- { error(loc, "duplicate initializer for field '%s'", -- ad->fields[fieldi]->toChars()); -- goto Lno; -- } -- (*elements)[fieldi] = ex; -- ++fieldi; -- } -- // Now, fill in any missing elements with default initializers. -- // We also need to validate any anonymous unions -- offset = 0; -- for (size_t i = 0; i < elements->dim; ) -- { -- VarDeclaration * vd = ad->fields[i]->isVarDeclaration(); -- -- //printf("test2 [%d] : %s %d %d\n", i, vd->toChars(), (int)offset, (int)vd->offset); -- if (vd->offset < offset) -- { -- // Only the first field of a union can have an initializer -- if ((*elements)[i]) -- goto Lno; -- } -- else -- { -- if (!(*elements)[i]) -- { // Default initialize -- if (vd->init) -- { -- if (vd->scope) -- { // Do deferred semantic analysis -- Initializer *i2 = vd->init->syntaxCopy(); -- i2 = i2->semantic(vd->scope, vd->type, INITinterpret); -- (*elements)[i] = i2->toExpression(); -- if (!global.gag) -- { vd->scope = NULL; -- vd->init = i2; // save result -- } -- } -- else -- (*elements)[i] = vd->init->toExpression(); -- } -- else -- (*elements)[i] = vd->type->defaultInit(); -- } -- } -- offset = vd->offset + vd->type->size(); -- i++; --#if 0 -- int unionSize = ad->numFieldsInUnion(i); -- if (unionSize == 1) -- { // Not a union -- default initialize if missing -- if (!(*elements)[i]) -- (*elements)[i] = vd->type->defaultInit(); -- } -- else -- { // anonymous union -- check for errors -- int found = -1; // index of the first field with an initializer -- for (size_t j = i; j < i + unionSize; ++j) -- { -- if (!(*elements)[j]) -- continue; -- if (found >= 0) -- { -- VarDeclaration * v1 = ((Dsymbol *)ad->fields.data[found])->isVarDeclaration(); -- VarDeclaration * v = ((Dsymbol *)ad->fields.data[j])->isVarDeclaration(); -- error(loc, "%s cannot have initializers for fields %s and %s in same union", -- ad->toChars(), -- v1->toChars(), v->toChars()); -- goto Lno; -- } -- found = j; -- } -- if (found == -1) -- { -- error(loc, "no initializer for union that contains field %s", -- vd->toChars()); -- goto Lno; -- } -- } -- i += unionSize; --#endif -- } -- e = new StructLiteralExp(loc, sd, elements); -- e->type = sd->type; -- return e; -- --Lno: -- delete elements; -+Expression *StructInitializer::toExpression(Type *t) -+{ -+ // cannot convert to an expression without target 'ad' - return NULL; - } - -- - void StructInitializer::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - //printf("StructInitializer::toCBuffer()\n"); -@@ -427,7 +323,7 @@ void StructInitializer::toCBuffer(OutBuf - for (size_t i = 0; i < field.dim; i++) - { - if (i > 0) -- buf->writebyte(','); -+ buf->writestring(", "); - Identifier *id = field[i]; - if (id) - { -@@ -485,6 +381,7 @@ Initializer *ArrayInitializer::semantic( - { - size_t length; - const unsigned amax = 0x80000000; -+ bool errors = false; - - //printf("ArrayInitializer::semantic(%s)\n", t->toChars()); - if (sem) // if semantic() already run -@@ -519,10 +416,15 @@ Initializer *ArrayInitializer::semantic( - { - Expression *idx = index[i]; - if (idx) -- { idx = idx->semantic(sc); -+ { -+ sc = sc->startCTFE(); -+ idx = idx->semantic(sc); -+ sc = sc->endCTFE(); - idx = idx->ctfeInterpret(); - index[i] = idx; - length = idx->toInteger(); -+ if (idx->op == TOKerror) -+ errors = true; - } - - Initializer *val = value[i]; -@@ -530,6 +432,8 @@ Initializer *ArrayInitializer::semantic( - if (ei && !idx) - ei->expandTuples = 1; - val = val->semantic(sc, t->nextOf(), needInterpret); -+ if (val->isErrorInitializer()) -+ errors = true; - - ei = val->isExpInitializer(); - // found a tuple, expand it -@@ -570,6 +474,8 @@ Initializer *ArrayInitializer::semantic( - goto Lerr; - } - } -+ if (errors) -+ goto Lerr; - - if ((uinteger_t) dim * t->nextOf()->size() >= amax) - { error(loc, "array dimension %u exceeds max of %u", (unsigned) dim, (unsigned)(amax / t->nextOf()->size())); -@@ -578,7 +484,7 @@ Initializer *ArrayInitializer::semantic( - return this; - - Lerr: -- return new ExpInitializer(loc, new ErrorExp()); -+ return new ErrorInitializer(); - } - - /******************************** -@@ -586,12 +492,12 @@ Lerr: - * Otherwise return NULL. - */ - --Expression *ArrayInitializer::toExpression() --{ Expressions *elements; -- -+Expression *ArrayInitializer::toExpression(Type *tx) -+{ - //printf("ArrayInitializer::toExpression(), dim = %d\n", dim); - //static int i; if (++i == 2) halt(); - -+ Expressions *elements; - size_t edim; - Type *t = NULL; - if (type) -@@ -606,6 +512,11 @@ Expression *ArrayInitializer::toExpressi - edim = ((TypeSArray *)t)->dim->toInteger(); - break; - -+ case Tvector: -+ t = ((TypeVector *)t)->basetype; -+ edim = ((TypeSArray *)t)->dim->toInteger(); -+ break; -+ - case Tpointer: - case Tarray: - edim = dim; -@@ -667,6 +578,12 @@ Expression *ArrayInitializer::toExpressi - } - } - -+ for (size_t i = 0; i < edim; i++) -+ { Expression *e = (*elements)[i]; -+ if (e->op == TOKerror) -+ return e; -+ } -+ - Expression *e = new ArrayLiteralExp(loc, elements); - e->type = type; - return e; -@@ -782,7 +699,7 @@ void ArrayInitializer::toCBuffer(OutBuff - for (size_t i = 0; i < index.dim; i++) - { - if (i > 0) -- buf->writebyte(','); -+ buf->writestring(", "); - Expression *ex = index[i]; - if (ex) - { -@@ -842,6 +759,27 @@ bool hasNonConstPointers(Expression *e) - return arrayHasNonConstPointers(ae->keys); - return false; - } -+ if(e->op == TOKaddress) -+ { -+ AddrExp *ae = (AddrExp *)e; -+ if (ae->e1->op == TOKstructliteral) -+ { -+ StructLiteralExp *se = (StructLiteralExp *)ae->e1; -+ if (!(se->stageflags & stageSearchPointers)) -+ { -+ int old = se->stageflags; -+ se->stageflags |= stageSearchPointers; -+ bool ret = arrayHasNonConstPointers(se->elements); -+ se->stageflags = old; -+ return ret; -+ } -+ else -+ { -+ return false; -+ } -+ } -+ return true; -+ } - if (e->type->ty== Tpointer && e->type->nextOf()->ty != Tfunction) - { - if (e->op == TOKsymoff) // address of a global is OK -@@ -870,8 +808,10 @@ bool arrayHasNonConstPointers(Expression - Initializer *ExpInitializer::semantic(Scope *sc, Type *t, NeedInterpret needInterpret) - { - //printf("ExpInitializer::semantic(%s), type = %s\n", exp->toChars(), t->toChars()); -+ if (needInterpret) sc = sc->startCTFE(); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); -+ if (needInterpret) sc = sc->endCTFE(); - if (exp->op == TOKerror) - return this; - -@@ -884,13 +824,16 @@ Initializer *ExpInitializer::semantic(Sc - return this; // Failed, suppress duplicate error messages - - if (exp->op == TOKtype) -+ { - exp->error("initializer must be an expression, not '%s'", exp->toChars()); -+ return new ErrorInitializer(); -+ } - - // Make sure all pointers are constants - if (needInterpret && hasNonConstPointers(exp)) - { - exp->error("cannot use non-constant CTFE pointer in an initializer '%s'", exp->toChars()); -- return this; -+ return new ErrorInitializer(); - } - - Type *tb = t->toBasetype(); -@@ -946,6 +889,9 @@ Initializer *ExpInitializer::semantic(Sc - exp->implicitConvTo(tb->nextOf()) - ) - { -+ /* If the variable is not actually used in compile time, array creation is -+ * redundant. So delay it until invocation of toExpression() or toDt(). -+ */ - t = tb->nextOf(); - } - -@@ -978,18 +924,33 @@ Type *ExpInitializer::inferType(Scope *s - - // Give error for overloaded function addresses - if (exp->op == TOKsymoff) -- { SymOffExp *se = (SymOffExp *)exp; -+ { -+ SymOffExp *se = (SymOffExp *)exp; - if (se->hasOverloads && !se->var->isFuncDeclaration()->isUnique()) -+ { - exp->error("cannot infer type from overloaded function symbol %s", exp->toChars()); -+ return Type::terror; -+ } - } -- -- // Give error for overloaded function addresses - if (exp->op == TOKdelegate) -- { DelegateExp *se = (DelegateExp *)exp; -+ { -+ DelegateExp *se = (DelegateExp *)exp; - if (se->hasOverloads && - se->func->isFuncDeclaration() && - !se->func->isFuncDeclaration()->isUnique()) -+ { - exp->error("cannot infer type from overloaded function symbol %s", exp->toChars()); -+ return Type::terror; -+ } -+ } -+ if (exp->op == TOKaddress) -+ { -+ AddrExp *ae = (AddrExp *)exp; -+ if (ae->e1->op == TOKoverloadset) -+ { -+ exp->error("cannot infer type from overloaded function symbol %s", exp->toChars()); -+ return Type::terror; -+ } - } - - Type *t = exp->type; -@@ -998,8 +959,24 @@ Type *ExpInitializer::inferType(Scope *s - return t; - } - --Expression *ExpInitializer::toExpression() -+Expression *ExpInitializer::toExpression(Type *t) - { -+ if (t) -+ { -+ Type *tb = t->toBasetype(); -+ if (tb->ty == Tsarray && exp->implicitConvTo(tb->nextOf())) -+ { -+ TypeSArray *tsa = (TypeSArray *)tb; -+ size_t d = tsa->dim->toInteger(); -+ Expressions *elements = new Expressions(); -+ elements->setDim(d); -+ for (size_t i = 0; i < d; i++) -+ (*elements)[i] = exp; -+ ArrayLiteralExp *ae = new ArrayLiteralExp(exp->loc, elements); -+ ae->type = t; -+ exp = ae; -+ } -+ } - return exp; - } - ---- a/src/gcc/d/dfrontend/init.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/init.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2007 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -16,28 +16,28 @@ - #include "mars.h" - #include "arraytypes.h" - --struct Identifier; --struct Expression; -+class Identifier; -+class Expression; - struct Scope; --struct Type; -- -+class Type; - #ifdef IN_GCC - typedef union tree_node dt_t; - #else - struct dt_t; - #endif -- --struct AggregateDeclaration; --struct VoidInitializer; --struct StructInitializer; --struct ArrayInitializer; --struct ExpInitializer; -+class AggregateDeclaration; -+class ErrorInitializer; -+class VoidInitializer; -+class StructInitializer; -+class ArrayInitializer; -+class ExpInitializer; - struct HdrGenState; - - enum NeedInterpret { INITnointerpret, INITinterpret }; - --struct Initializer : Object -+class Initializer : public RootObject - { -+public: - Loc loc; - - Initializer(Loc loc); -@@ -45,7 +45,7 @@ struct Initializer : Object - // needInterpret is INITinterpret if must be a manifest constant, 0 if not. - virtual Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); - virtual Type *inferType(Scope *sc); -- virtual Expression *toExpression() = 0; -+ virtual Expression *toExpression(Type *t = NULL) = 0; - virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0; - char *toChars(); - -@@ -53,20 +53,22 @@ struct Initializer : Object - - virtual dt_t *toDt(); - -- virtual VoidInitializer *isVoidInitializer() { return NULL; } -+ virtual ErrorInitializer *isErrorInitializer() { return NULL; } -+ virtual VoidInitializer *isVoidInitializer() { return NULL; } - virtual StructInitializer *isStructInitializer() { return NULL; } -- virtual ArrayInitializer *isArrayInitializer() { return NULL; } -- virtual ExpInitializer *isExpInitializer() { return NULL; } -+ virtual ArrayInitializer *isArrayInitializer() { return NULL; } -+ virtual ExpInitializer *isExpInitializer() { return NULL; } - }; - --struct VoidInitializer : Initializer -+class VoidInitializer : public Initializer - { -+public: - Type *type; // type that this will initialize to - - VoidInitializer(Loc loc); - Initializer *syntaxCopy(); - Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); -- Expression *toExpression(); -+ Expression *toExpression(Type *t = NULL); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - dt_t *toDt(); -@@ -74,19 +76,29 @@ struct VoidInitializer : Initializer - virtual VoidInitializer *isVoidInitializer() { return this; } - }; - --struct StructInitializer : Initializer -+class ErrorInitializer : public Initializer -+{ -+public: -+ ErrorInitializer(); -+ Initializer *syntaxCopy(); -+ Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); -+ Expression *toExpression(Type *t = NULL); -+ void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -+ -+ virtual ErrorInitializer *isErrorInitializer() { return this; } -+}; -+ -+class StructInitializer : public Initializer - { -+public: - Identifiers field; // of Identifier *'s - Initializers value; // parallel array of Initializer *'s - -- VarDeclarations vars; // parallel array of VarDeclaration *'s -- AggregateDeclaration *ad; // which aggregate this is for -- - StructInitializer(Loc loc); - Initializer *syntaxCopy(); - void addInit(Identifier *field, Initializer *value); - Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); -- Expression *toExpression(); -+ Expression *toExpression(Type *t = NULL); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - dt_t *toDt(); -@@ -94,8 +106,9 @@ struct StructInitializer : Initializer - StructInitializer *isStructInitializer() { return this; } - }; - --struct ArrayInitializer : Initializer -+class ArrayInitializer : public Initializer - { -+public: - Expressions index; // indices - Initializers value; // of Initializer *'s - size_t dim; // length of array being initialized -@@ -108,7 +121,7 @@ struct ArrayInitializer : Initializer - Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); - int isAssociativeArray(); - Type *inferType(Scope *sc); -- Expression *toExpression(); -+ Expression *toExpression(Type *t = NULL); - Expression *toAssocArrayLiteral(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -@@ -117,8 +130,9 @@ struct ArrayInitializer : Initializer - ArrayInitializer *isArrayInitializer() { return this; } - }; - --struct ExpInitializer : Initializer -+class ExpInitializer : public Initializer - { -+public: - Expression *exp; - int expandTuples; - -@@ -126,7 +140,7 @@ struct ExpInitializer : Initializer - Initializer *syntaxCopy(); - Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret); - Type *inferType(Scope *sc); -- Expression *toExpression(); -+ Expression *toExpression(Type *t = NULL); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - dt_t *toDt(); ---- a/src/gcc/d/dfrontend/inline.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/inline.c 2014-04-01 16:32:51.000000000 +0100 -@@ -213,7 +213,7 @@ int VarExp::inlineCost3(InlineCostState - if (tb->ty == Tstruct) - { - StructDeclaration *sd = ((TypeStruct *)tb)->sym; -- if (sd->isnested) -+ if (sd->isNested()) - /* An inner struct will be nested inside another function hierarchy than where - * we're inlining into, so don't inline it. - * At least not until we figure out how to 'move' the struct to be nested -@@ -246,7 +246,7 @@ int StructLiteralExp::inlineCost3(Inline - { - //printf("StructLiteralExp::inlineCost3() %s\n", toChars()); - #if DMDV2 -- if (sd->isnested) -+ if (sd->isNested()) - return COST_MAX; - #endif - return 1; -@@ -280,7 +280,7 @@ int DeclarationExp::inlineCost3(InlineCo - return COST_MAX; // finish DeclarationExp::doInline - #else - for (size_t i = 0; i < td->objects->dim; i++) -- { Object *o = (*td->objects)[i]; -+ { RootObject *o = (*td->objects)[i]; - if (o->dyncast() != DYNCAST_EXPRESSION) - return COST_MAX; - Expression *eo = (Expression *)o; -@@ -577,7 +577,7 @@ Expression *IfStatement::doInline(Inline - Expression *ReturnStatement::doInline(InlineDoState *ids) - { - //printf("ReturnStatement::doInline() '%s'\n", exp ? exp->toChars() : ""); -- return exp ? exp->doInline(ids) : 0; -+ return exp ? exp->doInline(ids) : NULL; - } - - #if DMDV2 -@@ -648,11 +648,69 @@ Expression *VarExp::doInline(InlineDoSta - } - } - if (ids->fd && var == ids->fd->vthis) -- { VarExp *ve = new VarExp(loc, ids->vthis); -+ { -+ VarExp *ve = new VarExp(loc, ids->vthis); - ve->type = type; - return ve; - } - -+ /* Inlining context pointer access for nested referenced variables. -+ * For example: -+ * auto fun() { -+ * int i = 40; -+ * auto foo() { -+ * int g = 2; -+ * struct Result { -+ * auto bar() { return i + g; } -+ * } -+ * return Result(); -+ * } -+ * return foo(); -+ * } -+ * auto t = fun(); -+ * 'i' and 'g' are nested referenced variables in Result.bar(), so: -+ * auto x = t.bar(); -+ * should be inlined to: -+ * auto x = *(t.vthis.vthis + i->voffset) + *(t.vthis + g->voffset) -+ */ -+ VarDeclaration *v = var->isVarDeclaration(); -+ if (v && v->nestedrefs.dim && ids->vthis) -+ { -+ Dsymbol *s = ids->fd; -+ FuncDeclaration *fdv = v->toParent()->isFuncDeclaration(); -+ assert(fdv); -+ Expression *ve = new VarExp(loc, ids->vthis); -+ ve->type = ids->vthis->type; -+ while (s != fdv) -+ { -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (AggregateDeclaration *ad = s->isThis()) -+ { -+ assert(ad->vthis); -+ ve = new DotVarExp(loc, ve, ad->vthis); -+ ve->type = ad->vthis->type; -+ s = ad->toParent2(); -+ } -+ else if (f && f->isNested()) -+ { -+ assert(f->vthis); -+ if (f->hasNestedFrameRefs()) -+ { -+ ve = new DotVarExp(loc, ve, f->vthis); -+ ve->type = f->vthis->type; -+ } -+ s = f->toParent2(); -+ } -+ else -+ assert(0); -+ assert(s); -+ } -+ ve = new DotVarExp(loc, ve, v); -+ ve->type = v->type; -+ //printf("\t==> ve = %s, type = %s\n", ve->toChars(), ve->type->toChars()); -+ return ve; -+ } -+ - return this; - } - -@@ -707,7 +765,7 @@ Expression *DeclarationExp::doInline(Inl - VarDeclaration *vto; - - vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); -- *vto = *vd; -+ memcpy((void*)vto, (void*)vd, sizeof(VarDeclaration)); - vto->parent = ids->parent; - vto->csym = NULL; - vto->isym = NULL; -@@ -801,7 +859,7 @@ Expression *IndexExp::doInline(InlineDoS - VarDeclaration *vto; - - vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); -- *vto = *vd; -+ memcpy((void*)vto, (void*)vd, sizeof(VarDeclaration)); - vto->parent = ids->parent; - vto->csym = NULL; - vto->isym = NULL; -@@ -838,7 +896,7 @@ Expression *SliceExp::doInline(InlineDoS - VarDeclaration *vto; - - vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); -- *vto = *vd; -+ memcpy((void*)vto, (void*)vd, sizeof(VarDeclaration)); - vto->parent = ids->parent; - vto->csym = NULL; - vto->isym = NULL; -@@ -869,6 +927,8 @@ Expression *TupleExp::doInline(InlineDoS - TupleExp *ce; - - ce = (TupleExp *)copy(); -+ if (e0) -+ ce->e0 = e0->doInline(ids); - ce->exps = arrayExpressiondoInline(exps, ids); - return ce; - } -@@ -897,10 +957,12 @@ Expression *AssocArrayLiteralExp::doInli - - Expression *StructLiteralExp::doInline(InlineDoState *ids) - { -+ if(inlinecopy) return inlinecopy; - StructLiteralExp *ce; -- - ce = (StructLiteralExp *)copy(); -+ inlinecopy = ce; - ce->elements = arrayExpressiondoInline(elements, ids); -+ inlinecopy = NULL; - return ce; - } - -@@ -1106,12 +1168,7 @@ Statement *ReturnStatement::inlineScan(I - { - //printf("ReturnStatement::inlineScan()\n"); - if (exp) -- { - exp = exp->inlineScan(iss); -- -- FuncDeclaration *func = iss->fd; -- TypeFunction *tf = (TypeFunction *)(func->type); -- } - return this; - } - -@@ -1203,6 +1260,7 @@ Expression *Expression::inlineScan(Inlin - - void scanVar(Dsymbol *s, InlineScanState *iss) - { -+ //printf("scanVar(%s %s)\n", s->kind(), s->toPrettyChars()); - VarDeclaration *vd = s->isVarDeclaration(); - if (vd) - { -@@ -1254,6 +1312,10 @@ void scanVar(Dsymbol *s, InlineScanState - } - } - } -+ else -+ { -+ s->inlineScan(); -+ } - } - - Expression *DeclarationExp::inlineScan(InlineScanState *iss) -@@ -1342,6 +1404,8 @@ Expression *TupleExp::inlineScan(InlineS - { Expression *e = this; - - //printf("TupleExp::inlineScan()\n"); -+ if (e0) -+ e0->inlineScan(iss); - arrayInlineScan(iss, exps); - - return e; -@@ -1373,8 +1437,11 @@ Expression *StructLiteralExp::inlineScan - { Expression *e = this; - - //printf("StructLiteralExp::inlineScan()\n"); -+ if(stageflags & stageInlineScan) return e; -+ int old = stageflags; -+ stageflags |= stageInlineScan; - arrayInlineScan(iss, elements); -- -+ stageflags = old; - return e; - } - -@@ -1406,7 +1473,7 @@ void FuncDeclaration::inlineScan() - InlineScanState iss; - - #if LOG -- printf("FuncDeclaration::inlineScan('%s')\n", toChars()); -+ printf("FuncDeclaration::inlineScan('%s')\n", toPrettyChars()); - #endif - memset(&iss, 0, sizeof(iss)); - iss.fd = this; -@@ -1426,7 +1493,7 @@ int FuncDeclaration::canInline(int hasth - #define CANINLINE_LOG 0 - - #if CANINLINE_LOG -- printf("FuncDeclaration::canInline(hasthis = %d, statementsToo = %d, '%s')\n", hasthis, statementsToo, toChars()); -+ printf("FuncDeclaration::canInline(hasthis = %d, statementsToo = %d, '%s')\n", hasthis, statementsToo, toPrettyChars()); - #endif - - if (needThis() && !hasthis) -@@ -1465,7 +1532,7 @@ int FuncDeclaration::canInline(int hasth - - if (type) - { assert(type->ty == Tfunction); -- TypeFunction *tf = (TypeFunction *)(type); -+ TypeFunction *tf = (TypeFunction *)type; - if (tf->varargs == 1) // no variadic parameter lists - goto Lno; - -@@ -1496,7 +1563,7 @@ int FuncDeclaration::canInline(int hasth - isSynchronized() || - isImportedSymbol() || - hasNestedFrameRefs() || // no nested references to this frame -- (isVirtual() && !isFinal()) -+ (isVirtual() && !isFinalFunc()) - )) - { - goto Lno; -@@ -1637,7 +1704,7 @@ Expression *FuncDeclaration::expandInlin - // Set up parameters - if (ethis) - { -- e = new DeclarationExp(0, ids.vthis); -+ e = new DeclarationExp(Loc(), ids.vthis); - e->type = Type::tvoid; - if (as) - as->push(new ExpStatement(e->loc, e)); -@@ -1677,11 +1744,11 @@ Expression *FuncDeclaration::expandInlin - ids.from.push(vfrom); - ids.to.push(vto); - -- de = new DeclarationExp(0, vto); -+ de = new DeclarationExp(Loc(), vto); - de->type = Type::tvoid; - - if (as) -- as->push(new ExpStatement(0, de)); -+ as->push(new ExpStatement(Loc(), de)); - else - e = Expression::combine(e, de); - } -@@ -1692,7 +1759,7 @@ Expression *FuncDeclaration::expandInlin - inlineNest++; - Statement *s = fbody->doInlineStatement(&ids); - as->push(s); -- *ps = new ScopeStatement(0, new CompoundStatement(0, as)); -+ *ps = new ScopeStatement(Loc(), new CompoundStatement(Loc(), as)); - inlineNest--; - } - else -@@ -1705,6 +1772,7 @@ Expression *FuncDeclaration::expandInlin - //eb->print(); - //eb->dump(0); - } -+ //printf("%s->expandInline = { %s }\n", toChars(), e->toChars()); - - /* There's a problem if what the function returns is used subsequently as an - * lvalue, as in a struct return that is then used as a 'this'. -@@ -1736,7 +1804,7 @@ Expression *FuncDeclaration::expandInlin - ei->exp = new ConstructExp(loc, ve, e); - ei->exp->type = ve->type; - -- DeclarationExp* de = new DeclarationExp(0, vd); -+ DeclarationExp* de = new DeclarationExp(Loc(), vd); - de->type = Type::tvoid; - - // Chain the two together: ---- a/src/gcc/d/dfrontend/interpret.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/interpret.c 2014-04-01 16:32:51.000000000 +0100 -@@ -37,6 +37,7 @@ - - #define LOG 0 - #define LOGASSIGN 0 -+#define LOGCOMPILE 0 - #define SHOWPERFORMANCE 0 - - // Maximum allowable recursive function calls in CTFE -@@ -57,28 +58,36 @@ private: - the stack might not be empty when CTFE begins. - - Ctfe Stack addresses are just 0-based integers, but we save -- them as 'void *' because ArrayBase can only do pointers. -+ them as 'void *' because Array can only do pointers. - */ - Expressions values; // values on the stack - VarDeclarations vars; // corresponding variables -- ArrayBase<void> savedId; // id of the previous state of that var -+ Array<void> savedId; // id of the previous state of that var -+ -+ Array<void> frames; // all previous frame pointers -+ Expressions savedThis; // all previous values of localThis - - /* Global constants get saved here after evaluation, so we never - * have to redo them. This saves a lot of time and memory. - */ - Expressions globalValues; // values of global constants -- size_t framepointer; // current frame pointer -- size_t maxStackPointer; // most stack we've ever used -+ -+ size_t framepointer; // current frame pointer -+ size_t maxStackPointer; // most stack we've ever used -+ Expression *localThis; // value of 'this', or NULL if none - public: - CtfeStack(); - - size_t stackPointer(); - -+ // The current value of 'this', or NULL if none -+ Expression *getThis(); -+ - // Largest number of stack positions we've used - size_t maxStackUsage(); -- // return the previous frame -- size_t startFrame(); -- void endFrame(size_t oldframe); -+ // Start a new stack frame, using the provided 'this'. -+ void startFrame(Expression *thisexp); -+ void endFrame(); - bool isInCurrentFrame(VarDeclaration *v); - Expression *getValue(VarDeclaration *v); - void setValue(VarDeclaration *v, Expression *e); -@@ -92,13 +101,11 @@ struct InterState - { - InterState *caller; // calling function's InterState - FuncDeclaration *fd; // function being interpreted -- size_t framepointer; // frame pointer of previous frame - Statement *start; // if !=NULL, start execution at this statement - Statement *gotoTarget; /* target of EXP_GOTO_INTERPRET result; also - * target of labelled EXP_BREAK_INTERPRET or - * EXP_CONTINUE_INTERPRET. (NULL if no label). - */ -- Expression *localThis; // value of 'this', or NULL if none - bool awaitingLvalueReturn; // Support for ref return values: - // Any return to this function should return an lvalue. - InterState(); -@@ -117,24 +124,34 @@ size_t CtfeStack::stackPointer() - return values.dim; - } - -+Expression *CtfeStack::getThis() -+{ -+ return localThis; -+} -+ - // Largest number of stack positions we've used - size_t CtfeStack::maxStackUsage() - { - return maxStackPointer; - } - --// return the previous frame --size_t CtfeStack::startFrame() -+void CtfeStack::startFrame(Expression *thisexp) - { - size_t oldframe = framepointer; -+ frames.push((void *)(size_t)(framepointer)); -+ savedThis.push(localThis); - framepointer = stackPointer(); -- return oldframe; -+ localThis = thisexp; - } - --void CtfeStack::endFrame(size_t oldframe) -+void CtfeStack::endFrame() - { -+ size_t oldframe = (size_t)(frames[frames.dim-1]); -+ localThis = savedThis[savedThis.dim-1]; - popAll(framepointer); - framepointer = oldframe; -+ frames.setDim(frames.dim - 1); -+ savedThis.setDim(savedThis.dim -1); - } - - bool CtfeStack::isInCurrentFrame(VarDeclaration *v) -@@ -244,13 +261,438 @@ void printCtfePerformanceStats() - } - - --Expression * resolveReferences(Expression *e, Expression *thisval); -+Expression * resolveReferences(Expression *e); - Expression *getVarExp(Loc loc, InterState *istate, Declaration *d, CtfeGoal goal); --VarDeclaration *findParentVar(Expression *e, Expression *thisval); -+VarDeclaration *findParentVar(Expression *e); - Expression *evaluateIfBuiltin(InterState *istate, Loc loc, - FuncDeclaration *fd, Expressions *arguments, Expression *pthis); - Expression *scrubReturnValue(Loc loc, Expression *e); - -+ -+ -+/************************************* -+ * CTFE-object code for a single function -+ * -+ * Currently only counts the number of local variables in the function -+ */ -+struct CompiledCtfeFunction -+{ -+ FuncDeclaration *func; // Function being compiled, NULL if global scope -+ int numVars; // Number of variables declared in this function -+ Loc callingloc; -+ -+ CompiledCtfeFunction(FuncDeclaration *f) -+ { -+ func = f; -+ numVars = 0; -+ } -+ -+ void onDeclaration(VarDeclaration *v) -+ { -+ //printf("%s CTFE declare %s\n", v->loc.toChars(), v->toChars()); -+ ++numVars; -+ } -+ static int walkAllVars(Expression *e, void *_this); -+ void onExpression(Expression *e) -+ { -+ e->apply(&walkAllVars, this); -+ } -+}; -+ -+int CompiledCtfeFunction::walkAllVars(Expression *e, void *_this) -+{ -+ CompiledCtfeFunction *ccf = (CompiledCtfeFunction *)_this; -+ if (e->op == TOKerror) -+ { -+ // Currently there's a front-end bug: silent errors -+ // can occur inside delegate literals inside is(typeof()). -+ // Suppress the check in this case. -+ if (global.gag && ccf->func) -+ return 1; -+ -+ e->error("CTFE internal error: ErrorExp in %s\n", ccf->func ? ccf->func->loc.toChars() : ccf->callingloc.toChars()); -+ assert(0); -+ } -+ if (e->op == TOKdeclaration) -+ { -+ DeclarationExp *decl = (DeclarationExp *)e; -+ VarDeclaration *v = decl->declaration->isVarDeclaration(); -+ if (!v) -+ return 0; -+ TupleDeclaration *td = v->toAlias()->isTupleDeclaration(); -+ if (td) -+ { -+ if (!td->objects) -+ return 0; -+ for(size_t i= 0; i < td->objects->dim; ++i) -+ { -+ RootObject *o = td->objects->tdata()[i]; -+ Expression *ex = isExpression(o); -+ DsymbolExp *s = (ex && ex->op == TOKdsymbol) ? (DsymbolExp *)ex : NULL; -+ assert(s); -+ VarDeclaration *v2 = s->s->isVarDeclaration(); -+ assert(v2); -+ if (!v2->isDataseg() || v2->isCTFE()) -+ ccf->onDeclaration(v2); -+ } -+ } -+ else if (!(v->isDataseg() || v->storage_class & STCmanifest) || v->isCTFE()) -+ ccf->onDeclaration(v); -+ Dsymbol *s = v->toAlias(); -+ if (s == v && !v->isStatic() && v->init) -+ { -+ ExpInitializer *ie = v->init->isExpInitializer(); -+ if (ie) -+ ccf->onExpression(ie->exp); -+ } -+ } -+ else if (e->op == TOKindex && ((IndexExp *)e)->lengthVar) -+ ccf->onDeclaration( ((IndexExp *)e)->lengthVar); -+ else if (e->op == TOKslice && ((SliceExp *)e)->lengthVar) -+ ccf->onDeclaration( ((SliceExp *)e)->lengthVar); -+ return 0; -+} -+ -+void Statement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s Statement::ctfeCompile %s\n", loc.toChars(), toChars()); -+#endif -+ assert(0); -+} -+ -+void ExpStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ExpStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (exp) -+ ccf->onExpression(exp); -+} -+ -+void CompoundStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s CompoundStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ for (size_t i = 0; i < statements->dim; i++) -+ { Statement *s = (*statements)[i]; -+ if (s) -+ s->ctfeCompile(ccf); -+ } -+} -+ -+void UnrolledLoopStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s UnrolledLoopStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ for (size_t i = 0; i < statements->dim; i++) -+ { Statement *s = (*statements)[i]; -+ if (s) -+ s->ctfeCompile(ccf); -+ } -+} -+ -+void IfStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s IfStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ -+ ccf->onExpression(condition); -+ if (ifbody) -+ ifbody->ctfeCompile(ccf); -+ if (elsebody) -+ elsebody->ctfeCompile(ccf); -+} -+ -+void ScopeStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ScopeStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (statement) -+ statement->ctfeCompile(ccf); -+} -+ -+void OnScopeStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s OnScopeStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // rewritten to try/catch/finally -+ assert(0); -+} -+ -+void DoStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s DoStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ ccf->onExpression(condition); -+ if (body) -+ body->ctfeCompile(ccf); -+} -+ -+void WhileStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s WhileStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // rewritten to ForStatement -+ assert(0); -+} -+ -+void ForStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ForStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ -+ if (init) -+ init->ctfeCompile(ccf); -+ if (condition) -+ ccf->onExpression(condition); -+ if (increment) -+ ccf->onExpression(increment); -+ if (body) -+ body->ctfeCompile(ccf); -+} -+ -+void ForeachStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ForeachStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // rewritten for ForStatement -+ assert(0); -+} -+ -+ -+void SwitchStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s SwitchStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ ccf->onExpression(condition); -+ // Note that the body contains the the Case and Default -+ // statements, so we only need to compile the expressions -+ for (size_t i = 0; i < cases->dim; i++) -+ { -+ ccf->onExpression((*cases)[i]->exp); -+ } -+ if (body) -+ body->ctfeCompile(ccf); -+} -+ -+void CaseStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s CaseStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (statement) -+ statement->ctfeCompile(ccf); -+} -+ -+void DefaultStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s DefaultStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (statement) -+ statement->ctfeCompile(ccf); -+} -+ -+void GotoDefaultStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s GotoDefaultStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void GotoCaseStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s GotoCaseStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void SwitchErrorStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s SwitchErrorStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void ReturnStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ReturnStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (exp) -+ ccf->onExpression(exp); -+} -+ -+void BreakStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s BreakStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void ContinueStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ContinueStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void WithStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s WithStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // If it is with(Enum) {...}, just execute the body. -+ if (exp->op == TOKimport || exp->op == TOKtype) -+ {} -+ else -+ { -+ ccf->onDeclaration(wthis); -+ ccf->onExpression(exp); -+ } -+ if (body) -+ body->ctfeCompile(ccf); -+} -+ -+void TryCatchStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s TryCatchStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (body) -+ body->ctfeCompile(ccf); -+ for (size_t i = 0; i < catches->dim; i++) -+ { -+#if DMDV1 -+ Catch *ca = (Catch *)catches->data[i]; -+#else -+ Catch *ca = catches->tdata()[i]; -+#endif -+ if (ca->var) -+ ccf->onDeclaration(ca->var); -+ if (ca->handler) -+ ca->handler->ctfeCompile(ccf); -+ } -+} -+ -+void TryFinallyStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s TryFinallyStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (body) -+ body->ctfeCompile(ccf); -+ if (finalbody) -+ finalbody->ctfeCompile(ccf); -+} -+ -+void ThrowStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ThrowStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ ccf->onExpression(exp); -+} -+ -+void GotoStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s GotoStatement::ctfeCompile\n", loc.toChars()); -+#endif -+} -+ -+void LabelStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s LabelStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ if (statement) -+ statement->ctfeCompile(ccf); -+} -+ -+#if DMDV2 -+void ImportStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ImportStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // Contains no variables or executable code -+} -+ -+void ForeachRangeStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s ForeachRangeStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // rewritten for ForStatement -+ assert(0); -+} -+ -+#endif -+ -+void AsmStatement::ctfeCompile(CompiledCtfeFunction *ccf) -+{ -+#if LOGCOMPILE -+ printf("%s AsmStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // we can't compile asm statements -+} -+ -+#ifdef IN_GCC -+// CTFE compile extended asm statement. -+ -+void -+ExtAsmStatement::ctfeCompile (CompiledCtfeFunction *) -+{ -+#if LOGCOMPILE -+ printf("%s ExtAsmStatement::ctfeCompile\n", loc.toChars()); -+#endif -+ // We can't compile extended asm statements. -+} -+#endif -+ -+/************************************* -+ * Compile this function for CTFE. -+ * At present, this merely allocates variables. -+ */ -+void FuncDeclaration::ctfeCompile() -+{ -+#if LOGCOMPILE -+ printf("\n%s FuncDeclaration::ctfeCompile %s\n", loc.toChars(), toChars()); -+#endif -+ assert(!ctfeCode); -+ assert(!semantic3Errors); -+ assert(semanticRun == PASSsemantic3done); -+ -+ ctfeCode = new CompiledCtfeFunction(this); -+ if (parameters) -+ { -+ Type *tb = type->toBasetype(); -+ assert(tb->ty == Tfunction); -+ TypeFunction *tf = (TypeFunction *)tb; -+ for (size_t i = 0; i < parameters->dim; i++) -+ { -+ Parameter *arg = Parameter::getNth(tf->parameters, i); -+ VarDeclaration *v = (*parameters)[i]; -+ ctfeCode->onDeclaration(v); -+ } -+ } -+ if (vresult) -+ ctfeCode->onDeclaration(vresult); -+ fbody->ctfeCompile(ctfeCode); -+} -+ - /************************************* - * - * Entry point for CTFE. -@@ -258,9 +700,75 @@ Expression *scrubReturnValue(Loc loc, Ex - */ - Expression *Expression::ctfeInterpret() - { -- return optimize(WANTvalue | WANTinterpret); -+ if (type == Type::terror) -+ return this; -+ -+ // This code is outside a function, but still needs to be compiled -+ // (there are compiler-generated temporary variables such as __dollar). -+ // However, this will only be run once and can then be discarded. -+ CompiledCtfeFunction ctfeCodeGlobal(NULL); -+ ctfeCodeGlobal.callingloc = loc; -+ ctfeCodeGlobal.onExpression(this); -+ -+ Expression *e = interpret(NULL); -+ if (e != EXP_CANT_INTERPRET) -+ e = scrubReturnValue(loc, e); -+ if (e == EXP_CANT_INTERPRET) -+ e = new ErrorExp(); -+ return e; -+} -+ -+/* Run CTFE on the expression, but allow the expression to be a TypeExp -+ * or a tuple containing a TypeExp. (This is required by pragma(msg)). -+ */ -+Expression *ctfeInterpretForPragmaMsg(Expression *e) -+{ -+ if (e->op == TOKerror || e->op == TOKtype) -+ return e; -+ -+ // It's also OK for it to be a function declaration (happens only with -+ // __traits(getOverloads)) -+ if (e->op == TOKvar && ((VarExp *)e)->var->isFuncDeclaration()) -+ { -+ return e; -+ } -+ -+ if (e->op != TOKtuple) -+ return e->ctfeInterpret(); -+ -+ // Tuples need to be treated seperately, since they are -+ // allowed to contain a TypeExp in this case. -+ -+ TupleExp *tup = (TupleExp *)e; -+ Expressions *expsx = NULL; -+ for (size_t i = 0; i < tup->exps->dim; ++i) -+ { -+ Expression *g = (*tup->exps)[i]; -+ Expression *h = g; -+ h = ctfeInterpretForPragmaMsg(g); -+ if (h != g) -+ { -+ if (!expsx) -+ { -+ expsx = new Expressions(); -+ expsx->setDim(tup->exps->dim); -+ for (size_t j = 0; j < tup->exps->dim; j++) -+ (*expsx)[j] = (*tup->exps)[j]; -+ } -+ (*expsx)[i] = h; -+ } -+ } -+ if (expsx) -+ { -+ TupleExp *te = new TupleExp(e->loc, expsx); -+ expandTuples(te->exps); -+ te->type = new TypeTuple(te->exps); -+ return te; -+ } -+ return e; - } - -+ - /************************************* - * Attempt to interpret a function given the arguments. - * Input: -@@ -287,10 +795,13 @@ Expression *FuncDeclaration::interpret(I - if (semanticRun < PASSsemantic3done) - return EXP_CANT_INTERPRET; - -+ // CTFE-compile the function -+ if (!ctfeCode) -+ ctfeCompile(); -+ - Type *tb = type->toBasetype(); - assert(tb->ty == Tfunction); - TypeFunction *tf = (TypeFunction *)tb; -- Type *tret = tf->next->toBasetype(); - if (tf->varargs && arguments && - ((parameters && arguments->dim != parameters->dim) || (!parameters && arguments->dim))) - { -@@ -303,15 +814,8 @@ Expression *FuncDeclaration::interpret(I - // Func literals report isNested() even if they are in global scope, - // so we need to check that the parent is a function. - if (isNested() && toParent2()->isFuncDeclaration() && !thisarg && istate) -- thisarg = istate->localThis; -+ thisarg = ctfeStack.getThis(); - -- InterState istatex; -- istatex.caller = istate; -- istatex.fd = this; -- istatex.localThis = thisarg; -- istatex.framepointer = ctfeStack.startFrame(); -- -- Expressions vsave; // place to save previous parameter values - size_t dim = 0; - if (needThis() && !thisarg) - { // error, no this. Prevent segfault. -@@ -324,16 +828,19 @@ Expression *FuncDeclaration::interpret(I - return EXP_CANT_INTERPRET; - } - static int evaluatingArgs = 0; -+ -+ // Place to hold all the arguments to the function while -+ // we are evaluating them. -+ Expressions eargs; -+ - if (arguments) - { - dim = arguments->dim; - assert(!dim || (parameters && (parameters->dim == dim))); -- vsave.setDim(dim); - - /* Evaluate all the arguments to the function, - * store the results in eargs[] - */ -- Expressions eargs; - eargs.setDim(dim); - for (size_t i = 0; i < dim; i++) - { Expression *earg = (*arguments)[i]; -@@ -391,6 +898,18 @@ Expression *FuncDeclaration::interpret(I - } - eargs[i] = earg; - } -+ } -+ -+ // Now that we've evaluated all the arguments, we can start the frame -+ // (this is the moment when the 'call' actually takes place). -+ -+ InterState istatex; -+ istatex.caller = istate; -+ istatex.fd = this; -+ ctfeStack.startFrame(thisarg); -+ -+ if (arguments) -+ { - - for (size_t i = 0; i < dim; i++) - { Expression *earg = eargs[i]; -@@ -475,7 +994,7 @@ Expression *FuncDeclaration::interpret(I - // Leave the function - --CtfeStatus::callDepth; - -- ctfeStack.endFrame(istatex.framepointer); -+ ctfeStack.endFrame(); - - // If fell off the end of a void function, return void - if (!e && type->toBasetype()->nextOf()->ty == Tvoid) -@@ -494,12 +1013,6 @@ Expression *FuncDeclaration::interpret(I - return EXP_CANT_INTERPRET; - } - -- // If we're about to leave CTFE, make sure we don't crash the -- // compiler by returning a CTFE-internal expression. -- if (!istate && !evaluatingArgs) -- { -- e = scrubReturnValue(loc, e); -- } - return e; - } - -@@ -682,8 +1195,11 @@ bool stopPointersEscaping(Loc loc, Expre - return true; - if ( isPointer(e->type) ) - { -- if (e->op == TOKvar && ((VarExp *)e)->var->isVarDeclaration() && -- ctfeStack.isInCurrentFrame( ((VarExp *)e)->var->isVarDeclaration() ) ) -+ Expression *x = e; -+ if (e->op == TOKaddress) -+ x = ((AddrExp *)e)->e1; -+ if (x->op == TOKvar && ((VarExp *)x)->var->isVarDeclaration() && -+ ctfeStack.isInCurrentFrame( ((VarExp *)x)->var->isVarDeclaration() ) ) - { error(loc, "returning a pointer to a local stack variable"); - return false; - } -@@ -714,7 +1230,7 @@ bool stopPointersEscapingFromArray(Loc l - { - for (size_t i = 0; i < elems->dim; i++) - { -- Expression *m = elems->tdata()[i]; -+ Expression *m = (*elems)[i]; - if (!m) - continue; - if (m) -@@ -735,8 +1251,16 @@ Expression *scrubReturnValue(Loc loc, Ex - { - if (e->op == TOKclassreference) - { -- error(loc, "%s class literals cannot be returned from CTFE", ((ClassReferenceExp*)e)->originalClass()->toChars()); -- return EXP_CANT_INTERPRET; -+ StructLiteralExp *se = ((ClassReferenceExp*)e)->value; -+ se->ownedByCtfe = false; -+ if (!(se->stageflags & stageScrub)) -+ { -+ int old = se->stageflags; -+ se->stageflags |= stageScrub; -+ if (!scrubArray(loc, se->elements, true)) -+ return EXP_CANT_INTERPRET; -+ se->stageflags = old; -+ } - } - if (e->op == TOKvoid) - { -@@ -751,8 +1275,14 @@ Expression *scrubReturnValue(Loc loc, Ex - { - StructLiteralExp *se = (StructLiteralExp *)e; - se->ownedByCtfe = false; -- if (!scrubArray(loc, se->elements, true)) -- return EXP_CANT_INTERPRET; -+ if (!(se->stageflags & stageScrub)) -+ { -+ int old = se->stageflags; -+ se->stageflags |= stageScrub; -+ if (!scrubArray(loc, se->elements, true)) -+ return EXP_CANT_INTERPRET; -+ se->stageflags = old; -+ } - } - if (e->op == TOKstring) - { -@@ -776,21 +1306,56 @@ Expression *scrubReturnValue(Loc loc, Ex - return e; - } - -+// Return true if every element is either void, -+// or is an array literal or struct literal of void elements. -+bool isEntirelyVoid(Expressions *elems) -+{ -+ for (size_t i = 0; i < elems->dim; i++) -+ { -+ Expression *m = (*elems)[i]; -+ // It can be NULL for performance reasons, -+ // see StructLiteralExp::interpret(). -+ if (!m) -+ continue; -+ -+ if (!(m->op == TOKvoid) && -+ !(m->op == TOKarrayliteral && isEntirelyVoid(((ArrayLiteralExp *)m)->elements)) && -+ !(m->op == TOKstructliteral && isEntirelyVoid(((StructLiteralExp *)m)->elements))) -+ { -+ return false; -+ } -+ } -+ return true; -+} -+ - // Scrub all members of an array. Return false if error - bool scrubArray(Loc loc, Expressions *elems, bool structlit) - { - for (size_t i = 0; i < elems->dim; i++) - { -- Expression *m = elems->tdata()[i]; -+ Expression *m = (*elems)[i]; -+ // It can be NULL for performance reasons, -+ // see StructLiteralExp::interpret(). - if (!m) - continue; -- if (m && m->op == TOKvoid && structlit) -- m = NULL; -- if (m) -+ -+ // A struct .init may contain void members. -+ // Static array members are a weird special case (bug 10994). -+ if (structlit && -+ ((m->op == TOKvoid) || -+ (m->op == TOKarrayliteral && m->type->ty == Tsarray && isEntirelyVoid(((ArrayLiteralExp *)m)->elements)) || -+ (m->op == TOKstructliteral && isEntirelyVoid(((StructLiteralExp *)m)->elements))) -+ ) -+ { -+ m = NULL; -+ } -+ else -+ { - m = scrubReturnValue(loc, m); -- if (m == EXP_CANT_INTERPRET) -- return false; -- elems->tdata()[i] = m; -+ if (m == EXP_CANT_INTERPRET) -+ return false; -+ } -+ (*elems)[i] = m; - } - return true; - } -@@ -835,21 +1400,19 @@ Expression *ReturnStatement::interpret(I - { e = exp->interpret(istate, ctfeNeedLvalue); - if (exceptionOrCantInterpret(e)) - return e; -- // Disallow returning pointers to stack-allocated variables (bug 7876) -- if (e->op == TOKvar && ((VarExp *)e)->var->isVarDeclaration() && -- ctfeStack.isInCurrentFrame( ((VarExp *)e)->var->isVarDeclaration() ) ) -- { error("returning a pointer to a local stack variable"); -- return EXP_CANT_INTERPRET; -- } - } - else - { - e = exp->interpret(istate); - if (exceptionOrCantInterpret(e)) - return e; -- if (!stopPointersEscaping(loc, e)) -- return EXP_CANT_INTERPRET; - } -+ -+ // Disallow returning pointers to stack-allocated variables (bug 7876) -+ -+ if (!stopPointersEscaping(loc, e)) -+ return EXP_CANT_INTERPRET; -+ - if (needToCopyLiteral(e)) - e = copyLiteral(e); - #if LOGASSIGN -@@ -866,13 +1429,19 @@ Expression *BreakStatement::interpret(In - #endif - START() - if (ident) -- { LabelDsymbol *label = istate->fd->searchLabel(ident); -+ { -+ LabelDsymbol *label = istate->fd->searchLabel(ident); - assert(label && label->statement); -- Statement *s = label->statement; -- if (s->isLabelStatement()) -- s = s->isLabelStatement()->statement; -- if (s->isScopeStatement()) -- s = s->isScopeStatement()->statement; -+ LabelStatement *ls = label->statement; -+ Statement *s; -+ if (ls->gotoTarget) -+ s = ls->gotoTarget; -+ else -+ { -+ s = ls->statement; -+ if (s->isScopeStatement()) -+ s = s->isScopeStatement()->statement; -+ } - istate->gotoTarget = s; - return EXP_BREAK_INTERPRET; - } -@@ -890,13 +1459,19 @@ Expression *ContinueStatement::interpret - #endif - START() - if (ident) -- { LabelDsymbol *label = istate->fd->searchLabel(ident); -+ { -+ LabelDsymbol *label = istate->fd->searchLabel(ident); - assert(label && label->statement); -- Statement *s = label->statement; -- if (s->isLabelStatement()) -- s = s->isLabelStatement()->statement; -- if (s->isScopeStatement()) -- s = s->isScopeStatement()->statement; -+ LabelStatement *ls = label->statement; -+ Statement *s; -+ if (ls->gotoTarget) -+ s = ls->gotoTarget; -+ else -+ { -+ s = ls->statement; -+ if (s->isScopeStatement()) -+ s = s->isScopeStatement()->statement; -+ } - istate->gotoTarget = s; - return EXP_CONTINUE_INTERPRET; - } -@@ -944,7 +1519,6 @@ Expression *DoStatement::interpret(Inter - if (istate->gotoTarget && istate->gotoTarget != this) - break; // continue at a higher level - -- Lcontinue: - istate->gotoTarget = NULL; - e = condition->interpret(istate); - if (exceptionOrCantInterpret(e)) -@@ -1206,7 +1780,7 @@ Expression *TryCatchStatement::interpret - #if DMDV1 - Catch *ca = (Catch *)catches->data[i]; - #else -- Catch *ca = catches->tdata()[i]; -+ Catch *ca = (*catches)[i]; - #endif - Type *catype = ca->type; - -@@ -1236,20 +1810,20 @@ ThrownExceptionExp *chainExceptions(Thro - #if DMDV2 - // Little sanity check to make sure it's really a Throwable - ClassReferenceExp *boss = oldest->thrown; -- assert(boss->value->elements->tdata()[4]->type->ty == Tclass); -+ assert((*boss->value->elements)[4]->type->ty == Tclass); - ClassReferenceExp *collateral = newest->thrown; - if (isAnErrorException(collateral->originalClass()) - && !isAnErrorException(boss->originalClass())) - { // The new exception bypass the existing chain -- assert(collateral->value->elements->tdata()[5]->type->ty == Tclass); -- collateral->value->elements->tdata()[5] = boss; -+ assert((*collateral->value->elements)[5]->type->ty == Tclass); -+ (*collateral->value->elements)[5] = boss; - return newest; - } -- while (boss->value->elements->tdata()[4]->op == TOKclassreference) -+ while ((*boss->value->elements)[4]->op == TOKclassreference) - { -- boss = (ClassReferenceExp *)(boss->value->elements->tdata()[4]); -+ boss = (ClassReferenceExp *)(*boss->value->elements)[4]; - } -- boss->value->elements->tdata()[4] = collateral; -+ (*boss->value->elements)[4] = collateral; - return oldest; - #else - // for D1, the newest exception just clobbers the older one -@@ -1335,6 +1909,18 @@ Expression *AsmStatement::interpret(Inte - return EXP_CANT_INTERPRET; - } - -+#ifdef IN_GCC -+Expression *ExtAsmStatement::interpret(InterState *istate) -+{ -+#if LOG -+ printf("%s ExtAsmStatement::interpret()\n", loc.toChars()); -+#endif -+ START() -+ error("extended asm statements cannot be interpreted at compile time"); -+ return EXP_CANT_INTERPRET; -+} -+#endif -+ - #if DMDV2 - Expression *ImportStatement::interpret(InterState *istate) - { -@@ -1361,12 +1947,11 @@ Expression *Expression::interpret(InterS - - Expression *ThisExp::interpret(InterState *istate, CtfeGoal goal) - { -- while (istate && !istate->localThis) -- istate = istate->caller; -- if (istate && istate->localThis && istate->localThis->op == TOKstructliteral) -- return istate->localThis; -- if (istate && istate->localThis) -- return istate->localThis->interpret(istate, goal); -+ Expression *localThis = ctfeStack.getThis(); -+ if (localThis && localThis->op == TOKstructliteral) -+ return localThis; -+ if (localThis) -+ return localThis->interpret(istate, goal); - error("value of 'this' is not known at compile time"); - return EXP_CANT_INTERPRET; - } -@@ -1407,11 +1992,11 @@ Expression *StringExp::interpret(InterSt - * In D2, we also disallow casts of read-only literals to mutable, - * though it isn't strictly necessary. - */ --#if DMDV2 -+#if 0 //DMDV2 - // Fixed-length char arrays always get duped later anyway. - if (type->ty == Tsarray) - return this; -- if (!(((TypeNext *)type)->next->mod & (MODconst | MODimmutable))) -+ if (!(((TypeNext *)type)->next->toBasetype()->mod & (MODconst | MODimmutable))) - { // It seems this happens only when there has been an explicit cast - error("cannot cast a read-only string literal to mutable in CTFE"); - return EXP_CANT_INTERPRET; -@@ -1437,12 +2022,35 @@ Expression *SymOffExp::interpret(InterSt - { - return this; - } -+ if (isTypeInfo_Class(type) && offset == 0) -+ { -+ return this; -+ } - if (type->ty != Tpointer) - { // Probably impossible - error("Cannot interpret %s at compile time", toChars()); - return EXP_CANT_INTERPRET; - } -- Type *pointee = ((TypePointer *)type)->next; -+ Type *pointee = ((TypePointer *)type)->next; -+ if ( var->isThreadlocal()) -+ { -+ error("cannot take address of thread-local variable %s at compile time", var->toChars()); -+ return EXP_CANT_INTERPRET; -+ } -+ // Check for taking an address of a shared variable. -+ // If the shared variable is an array, the offset might not be zero. -+ Type *fromType = NULL; -+ if (var->type->ty == Tarray || var->type->ty == Tsarray) -+ { -+ fromType = ((TypeArray *)(var->type))->next; -+ } -+ if ( var->isDataseg() && ( -+ (offset == 0 && isSafePointerCast(var->type, pointee)) || -+ (fromType && isSafePointerCast(fromType, pointee)) -+ )) -+ { -+ return this; -+ } - Expression *val = getVarExp(loc, istate, var, goal); - if (val == EXP_CANT_INTERPRET) - return val; -@@ -1472,7 +2080,6 @@ Expression *SymOffExp::interpret(InterSt - return EXP_CANT_INTERPRET; - } - -- TypeArray *tar = (TypeArray *)val->type; - dinteger_t sz = pointee->size(); - dinteger_t indx = offset/sz; - assert(sz * indx == offset); -@@ -1495,9 +2102,12 @@ Expression *SymOffExp::interpret(InterSt - } - else if ( offset == 0 && isSafePointerCast(var->type, pointee) ) - { -+ // Create a CTFE pointer &var - VarExp *ve = new VarExp(loc, var); -- ve->type = type; -- return ve; -+ ve->type = var->type; -+ AddrExp *re = new AddrExp(loc, ve); -+ re->type = type; -+ return re; - } - - error("Cannot convert &%s to %s at compile time", var->type->toChars(), type->toChars()); -@@ -1509,6 +2119,13 @@ Expression *AddrExp::interpret(InterStat - #if LOG - printf("%s AddrExp::interpret() %s\n", loc.toChars(), toChars()); - #endif -+ if (e1->op == TOKvar && ((VarExp *)e1)->var->isDataseg()) -+ { // Normally this is already done by optimize() -+ // Do it here in case optimize(0) wasn't run before CTFE -+ SymOffExp *se = new SymOffExp(loc, ((VarExp *)e1)->var, 0); -+ se->type = type; -+ return se; -+ } - // For reference types, we need to return an lvalue ref. - TY tb = e1->type->toBasetype()->ty; - bool needRef = (tb == Tarray || tb == Taarray || tb == Tclass); -@@ -1526,7 +2143,27 @@ Expression *DelegateExp::interpret(Inter - #if LOG - printf("%s DelegateExp::interpret() %s\n", loc.toChars(), toChars()); - #endif -- return this; -+ // TODO: Really we should create a CTFE-only delegate expression -+ // of a pointer and a funcptr. -+ -+ // If it is &nestedfunc, just return it -+ // TODO: We should save the context pointer -+ if (e1->op == TOKvar && ((VarExp *)e1)->var->isFuncDeclaration()) -+ return this; -+ -+ // If it has already been CTFE'd, just return it -+ if (e1->op == TOKstructliteral || e1->op == TOKclassreference) -+ return this; -+ -+ // Else change it into &structliteral.func or &classref.func -+ Expression *e = e1->interpret(istate, ctfeNeedLvalue); -+ -+ if (exceptionOrCantInterpret(e)) -+ return e; -+ -+ e = new DelegateExp(loc, e, func); -+ e->type = type; -+ return e; - } - - -@@ -1535,12 +2172,13 @@ Expression *DelegateExp::interpret(Inter - // ------------------------------------------------------------- - // The variable used in a dotvar, index, or slice expression, - // after 'out', 'ref', and 'this' have been removed. --Expression * resolveReferences(Expression *e, Expression *thisval) -+Expression * resolveReferences(Expression *e) - { - for(;;) - { - if (e->op == TOKthis) - { -+ Expression *thisval = ctfeStack.getThis(); - assert(thisval); - assert(e != thisval); - e = thisval; -@@ -1588,12 +2226,29 @@ Expression *getVarExp(Loc loc, InterStat - */ - if (v->ident == Id::ctfe) - return new IntegerExp(loc, 1, Type::tbool); -+ -+ if (!v->originalType && v->scope) // semantic() not yet run -+ { -+ v->semantic (v->scope); -+ if (v->type->ty == Terror) -+ return EXP_CANT_INTERPRET; -+ } -+ - if ((v->isConst() || v->isImmutable() || v->storage_class & STCmanifest) - && v->init && !v->hasValue() && !v->isCTFE()) - #else - if (v->isConst() && v->init && !v->isCTFE()) - #endif -- { e = v->init->toExpression(); -+ { -+ if(v->scope) -+ v->init = v->init->semantic(v->scope, v->type, INITinterpret); // might not be run on aggregate members -+ e = v->init->toExpression(v->type); -+ if (v->inuse) -+ { -+ error(loc, "circular initialization of %s", v->toChars()); -+ return EXP_CANT_INTERPRET; -+ } -+ - if (e && (e->op == TOKconstruct || e->op == TOKblit)) - { AssignExp *ae = (AssignExp *)e; - e = ae->e2; -@@ -1611,14 +2266,19 @@ Expression *getVarExp(Loc loc, InterStat - if (e && !e->type) - e->type = v->type; - if (e) -+ { -+ v->inuse++; - e = e->interpret(istate, ctfeNeedAnyValue); -+ v->inuse--; -+ } - if (e == EXP_CANT_INTERPRET && !global.gag && !CtfeStatus::stackTraceCallsToSuppress) - errorSupplemental(loc, "while evaluating %s.init", v->toChars()); - } - if (e && e != EXP_CANT_INTERPRET && e->op != TOKthrownexception) - { - e = copyLiteral(e); -- ctfeStack.saveGlobalConstant(v, e); -+ if (v->isDataseg() || (v->storage_class & STCmanifest )) -+ ctfeStack.saveGlobalConstant(v, e); - } - } - else if (v->isCTFE() && !v->hasValue()) -@@ -1690,16 +2350,14 @@ Expression *getVarExp(Loc loc, InterStat - } - else if (s) - { // Struct static initializers, for example -- if (s->dsym->toInitializer() == s->sym) -- { e = s->dsym->type->defaultInitLiteral(loc); -- e = e->semantic(NULL); -- if (e->op == TOKerror) -- e = EXP_CANT_INTERPRET; -- else // Convert NULL to VoidExp -- e = e->interpret(istate, goal); -- } -- else -- error(loc, "cannot interpret symbol %s at compile time", s->toChars()); -+ e = s->dsym->type->defaultInitLiteral(loc); -+ if (e->op == TOKerror) -+ error(loc, "CTFE failed because of previous errors in %s.init", s->toChars()); -+ e = e->semantic(NULL); -+ if (e->op == TOKerror) -+ e = EXP_CANT_INTERPRET; -+ else // Convert NULL to VoidExp -+ e = e->interpret(istate, goal); - } - else - error(loc, "cannot interpret declaration %s at compile time", d->toChars()); -@@ -1755,7 +2413,7 @@ Expression *DeclarationExp::interpret(In - return NULL; - for(size_t i= 0; i < td->objects->dim; ++i) - { -- Object * o = td->objects->tdata()[i]; -+ RootObject * o = (*td->objects)[i]; - Expression *ex = isExpression(o); - DsymbolExp *s = (ex && ex->op == TOKdsymbol) ? (DsymbolExp *)ex : NULL; - VarDeclaration *v2 = s ? s->s->isVarDeclaration() : NULL; -@@ -1763,8 +2421,9 @@ Expression *DeclarationExp::interpret(In - if (!v2->isDataseg() || v2->isCTFE()) - ctfeStack.push(v2); - } -+ return NULL; - } -- if (!v->isDataseg() || v->isCTFE()) -+ if (!(v->isDataseg() || v->storage_class & STCmanifest) || v->isCTFE()) - ctfeStack.push(v); - Dsymbol *s = v->toAlias(); - if (s == v && !v->isStatic() && v->init) -@@ -1815,9 +2474,15 @@ Expression *DeclarationExp::interpret(In - declaration->isTupleDeclaration()) - { // Check for static struct declarations, which aren't executable - AttribDeclaration *ad = declaration->isAttribDeclaration(); -- if (ad && ad->decl && ad->decl->dim == 1 -- && ad->decl->tdata()[0]->isAggregateDeclaration()) -- return NULL; // static struct declaration. Nothing to do. -+ if (ad && ad->decl && ad->decl->dim == 1) -+ { -+ Dsymbol *s = (*ad->decl)[0]; -+ if (s->isAggregateDeclaration() || -+ s->isTemplateDeclaration()) -+ { -+ return NULL; // static (template) struct declaration. Nothing to do. -+ } -+ } - - // These can be made to work, too lazy now - error("Declaration %s is not yet implemented in CTFE", toChars()); -@@ -1840,15 +2505,19 @@ Expression *TupleExp::interpret(InterSta - #endif - Expressions *expsx = NULL; - -+ if (e0) -+ { -+ if (e0->interpret(istate) == EXP_CANT_INTERPRET) -+ return EXP_CANT_INTERPRET; -+ } -+ - for (size_t i = 0; i < exps->dim; i++) - { Expression *e = (*exps)[i]; - Expression *ex; - - ex = e->interpret(istate); - if (exceptionOrCantInterpret(ex)) -- { delete expsx; - return ex; -- } - - // A tuple of assignments can contain void (Bug 5676). - if (goal == ctfeNeedNothing) -@@ -1901,9 +2570,7 @@ Expression *ArrayLiteralExp::interpret(I - if (e->op == TOKindex) // segfault bug 6250 - assert( ((IndexExp*)e)->e1 != this); - ex = e->interpret(istate); -- if (ex == EXP_CANT_INTERPRET) -- goto Lerror; -- if (ex->op == TOKthrownexception) -+ if (exceptionOrCantInterpret(ex)) - return ex; - - /* If any changes, do Copy On Write -@@ -1927,7 +2594,10 @@ Expression *ArrayLiteralExp::interpret(I - { - expandTuples(expsx); - if (expsx->dim != elements->dim) -- goto Lerror; -+ { -+ error("Internal Compiler Error: Invalid array literal"); -+ return EXP_CANT_INTERPRET; -+ } - ArrayLiteralExp *ae = new ArrayLiteralExp(loc, expsx); - ae->type = type; - return copyLiteral(ae); -@@ -1939,12 +2609,6 @@ Expression *ArrayLiteralExp::interpret(I - } - #endif - return copyLiteral(this); -- --Lerror: -- if (expsx) -- delete expsx; -- error("cannot interpret array literal"); -- return EXP_CANT_INTERPRET; - } - - Expression *AssocArrayLiteralExp::interpret(InterState *istate, CtfeGoal goal) -@@ -1957,30 +2621,26 @@ Expression *AssocArrayLiteralExp::interp - if (ownedByCtfe) // We've already interpreted all the elements - return copyLiteral(this); - for (size_t i = 0; i < keys->dim; i++) -- { Expression *ekey = keys->tdata()[i]; -- Expression *evalue = values->tdata()[i]; -+ { -+ Expression *ekey = (*keys)[i]; -+ Expression *evalue = (*values)[i]; - Expression *ex; - - ex = ekey->interpret(istate); -- if (ex == EXP_CANT_INTERPRET) -- goto Lerr; -- if (ex->op == TOKthrownexception) -+ if (exceptionOrCantInterpret(ex)) - return ex; - -- - /* If any changes, do Copy On Write - */ - if (ex != ekey) - { - if (keysx == keys) - keysx = (Expressions *)keys->copy(); -- keysx->tdata()[i] = ex; -+ (*keysx)[i] = ex; - } - - ex = evalue->interpret(istate); -- if (ex == EXP_CANT_INTERPRET) -- goto Lerr; -- if (ex->op == TOKthrownexception) -+ if (exceptionOrCantInterpret(ex)) - return ex; - - /* If any changes, do Copy On Write -@@ -1989,7 +2649,7 @@ Expression *AssocArrayLiteralExp::interp - { - if (valuesx == values) - valuesx = (Expressions *)values->copy(); -- valuesx->tdata()[i] = ex; -+ (*valuesx)[i] = ex; - } - } - if (keysx != keys) -@@ -1997,14 +2657,19 @@ Expression *AssocArrayLiteralExp::interp - if (valuesx != values) - expandTuples(valuesx); - if (keysx->dim != valuesx->dim) -- goto Lerr; -+ { -+ error("Internal Compiler Error: invalid AA"); -+ return EXP_CANT_INTERPRET; -+ } - - /* Remove duplicate keys - */ - for (size_t i = 1; i < keysx->dim; i++) -- { Expression *ekey = keysx->tdata()[i - 1]; -+ { -+ Expression *ekey = (*keysx)[i - 1]; - for (size_t j = i; j < keysx->dim; j++) -- { Expression *ekey2 = keysx->tdata()[j]; -+ { -+ Expression *ekey2 = (*keysx)[j]; - int eq = ctfeEqual(loc, TOKequal, ekey, ekey2); - if (eq) // if a match - { -@@ -2030,13 +2695,6 @@ Expression *AssocArrayLiteralExp::interp - return ae; - } - return this; -- --Lerr: -- if (keysx != keys) -- delete keysx; -- if (valuesx != values) -- delete values; -- return EXP_CANT_INTERPRET; - } - - Expression *StructLiteralExp::interpret(InterState *istate, CtfeGoal goal) -@@ -2045,50 +2703,70 @@ Expression *StructLiteralExp::interpret( - #if LOG - printf("%s StructLiteralExp::interpret() %s\n", loc.toChars(), toChars()); - #endif -- /* We don't know how to deal with overlapping fields -- */ -- if (sd->hasUnions) -- { error("Unions with overlapping fields are not yet supported in CTFE"); -- return EXP_CANT_INTERPRET; -- } - if (ownedByCtfe) - return copyLiteral(this); - -- if (elements) -- { -- for (size_t i = 0; i < elements->dim; i++) -- { Expression *e = (*elements)[i]; -- if (!e) -- continue; -- -- Expression *ex = e->interpret(istate); -- if (exceptionOrCantInterpret(ex)) -- { delete expsx; -- return ex; -- } -+ size_t elemdim = elements ? elements->dim : 0; - -- /* If any changes, do Copy On Write -+ for (size_t i = 0; i < sd->fields.dim; i++) -+ { Expression *e = NULL; -+ Expression *ex = NULL; -+ if (i >= elemdim) -+ { -+ /* If a nested struct has no initialized hidden pointer, -+ * set it to null to match the runtime behaviour. - */ -- if (ex != e) -+ if (i == sd->fields.dim - 1 && sd->isNested()) -+ { // Context field has not been filled -+ ex = new NullExp(loc); -+ ex->type = sd->fields[i]->type; -+ } -+ } -+ else -+ { -+ e = (*elements)[i]; -+ if (!e) - { -- if (!expsx) -- { expsx = new Expressions(); -- ++CtfeStatus::numArrayAllocs; -- expsx->setDim(elements->dim); -- for (size_t j = 0; j < elements->dim; j++) -- { -- (*expsx)[j] = (*elements)[j]; -- } -+ /* Ideally, we'd convert NULL members into void expressions. -+ * The problem is that the VoidExp will be removed when we -+ * leave CTFE, causing another memory allocation if we use this -+ * same struct literal again. -+ * -+ * ex = sd->fields[i]->type->voidInitLiteral(sd->fields[i]); -+ */ -+ ex = NULL; -+ } -+ else -+ { -+ ex = e->interpret(istate); -+ if (exceptionOrCantInterpret(ex)) -+ return ex; -+ } -+ } -+ -+ /* If any changes, do Copy On Write -+ */ -+ if (ex != e) -+ { -+ if (!expsx) -+ { expsx = new Expressions(); -+ ++CtfeStatus::numArrayAllocs; -+ expsx->setDim(sd->fields.dim); -+ for (size_t j = 0; j < elements->dim; j++) -+ { -+ (*expsx)[j] = (*elements)[j]; - } -- (*expsx)[i] = ex; - } -+ (*expsx)[i] = ex; - } - } -+ - if (elements && expsx) - { - expandTuples(expsx); -- if (expsx->dim != elements->dim) -- { delete expsx; -+ if (expsx->dim != sd->fields.dim) -+ { -+ error("Internal Compiler Error: invalid struct literal"); - return EXP_CANT_INTERPRET; - } - StructLiteralExp *se = new StructLiteralExp(loc, sd, expsx); -@@ -2183,10 +2861,19 @@ Expression *NewExp::interpret(InterState - Dsymbol *s = c->fields[i]; - VarDeclaration *v = s->isVarDeclaration(); - assert(v); -- Expression *m = v->init ? v->init->toExpression() : v->type->defaultInitLiteral(loc); -+ Expression *m; -+ if (v->init) -+ { -+ if (v->init->isVoidInitializer()) -+ m = v->type->voidInitLiteral(v); -+ else -+ m = v->getConstInitializer(true); -+ } -+ else -+ m = v->type->defaultInitLiteral(loc); - if (exceptionOrCantInterpret(m)) - return m; -- elems->tdata()[fieldsSoFar+i] = copyLiteral(m); -+ (*elems)[fieldsSoFar+i] = copyLiteral(m); - } - } - // Hack: we store a ClassDeclaration instead of a StructDeclaration. -@@ -2216,33 +2903,33 @@ Expression *NewExp::interpret(InterState - return EXP_CANT_INTERPRET; - } - --Expression *UnaExp::interpretCommon(InterState *istate, CtfeGoal goal, Expression *(*fp)(Type *, Expression *)) -+Expression *UnaExp::interpret(InterState *istate, CtfeGoal goal) - { Expression *e; - Expression *e1; - - #if LOG -- printf("%s UnaExp::interpretCommon() %s\n", loc.toChars(), toChars()); -+ printf("%s UnaExp::interpret() %s\n", loc.toChars(), toChars()); - #endif -+ if (op == TOKdottype) -+ { -+ error("Internal Compiler Error: CTFE DotType: %s", toChars()); -+ return EXP_CANT_INTERPRET; -+ } - e1 = this->e1->interpret(istate); - if (exceptionOrCantInterpret(e1)) - return e1; -- e = (*fp)(type, e1); -+ switch(op) -+ { -+ case TOKneg: e = Neg(type, e1); break; -+ case TOKtilde: e = Com(type, e1); break; -+ case TOKnot: e = Not(type, e1); break; -+ case TOKtobool: e = Bool(type, e1); break; -+ case TOKvector: e = this; break; // do nothing -+ default: assert(0); -+ } - return e; - } - --#define UNA_INTERPRET(op) \ --Expression *op##Exp::interpret(InterState *istate, CtfeGoal goal) \ --{ \ -- return interpretCommon(istate, goal, &op); \ --} -- --UNA_INTERPRET(Neg) --UNA_INTERPRET(Com) --UNA_INTERPRET(Not) --UNA_INTERPRET(Bool) -- -- --typedef Expression *(*fp_t)(Type *, Expression *, Expression *); - - Expression *BinExp::interpretCommon(InterState *istate, CtfeGoal goal, fp_t fp) - { Expression *e; -@@ -2291,62 +2978,49 @@ Expression *BinExp::interpretCommon(Inte - if (exceptionOrCantInterpret(e1)) - return e1; - if (e1->isConst() != 1) -- goto Lcant; -+ { -+ error("Internal Compiler Error: non-constant value %s", this->e1->toChars()); -+ return EXP_CANT_INTERPRET; -+ } - - e2 = this->e2->interpret(istate); - if (exceptionOrCantInterpret(e2)) - return e2; - if (e2->isConst() != 1) -- goto Lcant; -+ { -+ error("Internal Compiler Error: non-constant value %s", this->e2->toChars()); -+ return EXP_CANT_INTERPRET; -+ } - -+ if (op == TOKshr || op == TOKshl || op == TOKushr) -+ { -+ sinteger_t i2 = e2->toInteger(); -+ d_uns64 sz = e1->type->size() * 8; -+ if (i2 < 0 || i2 >= sz) -+ { error("shift by %lld is outside the range 0..%llu", i2, (ulonglong)sz - 1); -+ return EXP_CANT_INTERPRET; -+ } -+ } - e = (*fp)(type, e1, e2); - if (e == EXP_CANT_INTERPRET) - error("%s cannot be interpreted at compile time", toChars()); - return e; -- --Lcant: -- return EXP_CANT_INTERPRET; - } - --#define BIN_INTERPRET(op) \ --Expression *op##Exp::interpret(InterState *istate, CtfeGoal goal) \ --{ \ -- return interpretCommon(istate, goal, &op); \ --} -- --BIN_INTERPRET(Add) --BIN_INTERPRET(Min) --BIN_INTERPRET(Mul) --BIN_INTERPRET(Div) --BIN_INTERPRET(Mod) --BIN_INTERPRET(Shl) --BIN_INTERPRET(Shr) --BIN_INTERPRET(Ushr) --BIN_INTERPRET(And) --BIN_INTERPRET(Or) --BIN_INTERPRET(Xor) --#if DMDV2 --BIN_INTERPRET(Pow) --#endif -- -- --typedef int (*fp2_t)(Loc loc, enum TOK, Expression *, Expression *); -- -- - Expression *BinExp::interpretCompareCommon(InterState *istate, CtfeGoal goal, fp2_t fp) - { - Expression *e1; - Expression *e2; - - #if LOG -- printf("%s BinExp::interpretCommon2() %s\n", loc.toChars(), toChars()); -+ printf("%s BinExp::interpretCompareCommon() %s\n", loc.toChars(), toChars()); - #endif - if (this->e1->type->ty == Tpointer && this->e2->type->ty == Tpointer) - { -- e1 = this->e1->interpret(istate, ctfeNeedLvalue); -+ e1 = this->e1->interpret(istate); - if (exceptionOrCantInterpret(e1)) - return e1; -- e2 = this->e2->interpret(istate, ctfeNeedLvalue); -+ e2 = this->e2->interpret(istate); - if (exceptionOrCantInterpret(e2)) - return e2; - dinteger_t ofs1, ofs2; -@@ -2384,47 +3058,59 @@ Expression *BinExp::interpretCompareComm - return new IntegerExp(loc, cmp, type); - } - --#define BIN_INTERPRET2(op, opfunc) \ --Expression *op##Exp::interpret(InterState *istate, CtfeGoal goal) \ --{ \ -- return interpretCompareCommon(istate, goal, &opfunc); \ -+Expression *BinExp::interpret(InterState *istate, CtfeGoal goal) -+{ -+ switch(op) -+ { -+ case TOKadd: return interpretCommon(istate, goal, &Add); -+ case TOKmin: return interpretCommon(istate, goal, &Min); -+ case TOKmul: return interpretCommon(istate, goal, &Mul); -+ case TOKdiv: return interpretCommon(istate, goal, &Div); -+ case TOKmod: return interpretCommon(istate, goal, &Mod); -+ case TOKshl: return interpretCommon(istate, goal, &Shl); -+ case TOKshr: return interpretCommon(istate, goal, &Shr); -+ case TOKushr: return interpretCommon(istate, goal, &Ushr); -+ case TOKand: return interpretCommon(istate, goal, &And); -+ case TOKor: return interpretCommon(istate, goal, &Or); -+ case TOKxor: return interpretCommon(istate, goal, &Xor); -+#if DMDV2 -+ case TOKpow: return interpretCommon(istate, goal, &Pow); -+#endif -+ case TOKequal: -+ case TOKnotequal: -+ return interpretCompareCommon(istate, goal, &ctfeEqual); -+ case TOKidentity: -+ case TOKnotidentity: -+ return interpretCompareCommon(istate, goal, &ctfeIdentity); -+ case TOKlt: -+ case TOKle: -+ case TOKgt: -+ case TOKge: -+ case TOKleg: -+ case TOKlg: -+ case TOKunord: -+ case TOKue: -+ case TOKug: -+ case TOKuge: -+ case TOKul: -+ case TOKule: -+ return interpretCompareCommon(istate, goal, &ctfeCmp); -+ default: -+ assert(0); -+ return NULL; -+ } - } - --BIN_INTERPRET2(Equal, ctfeEqual) --BIN_INTERPRET2(Identity, ctfeIdentity) --BIN_INTERPRET2(Cmp, ctfeCmp) -- - /* Helper functions for BinExp::interpretAssignCommon - */ - --// Return true if e is derived from UnaryExp. --// Consider moving this function into Expression. --UnaExp *isUnaExp(Expression *e) --{ -- switch (e->op) -- { -- case TOKdotvar: -- case TOKindex: -- case TOKslice: -- case TOKcall: -- case TOKdot: -- case TOKdotti: -- case TOKdottype: -- case TOKcast: -- return (UnaExp *)e; -- default: -- break; -- } -- return NULL; --} -- - // Returns the variable which is eventually modified, or NULL if an rvalue. - // thisval is the current value of 'this'. --VarDeclaration * findParentVar(Expression *e, Expression *thisval) -+VarDeclaration * findParentVar(Expression *e) - { - for (;;) - { -- e = resolveReferences(e, thisval); -+ e = resolveReferences(e); - if (e->op == TOKvar) - break; - if (e->op == TOKindex) -@@ -2443,6 +3129,13 @@ VarDeclaration * findParentVar(Expressio - return v; - } - -+Expression *interpretAssignToSlice(InterState *istate, CtfeGoal goal, Loc loc, -+ SliceExp *sexp, Expression *newval, bool wantRef, bool isBlockAssignment, -+ BinExp *originalExpression); -+ -+bool interpretAssignToIndex(InterState *istate, Loc loc, -+ IndexExp *ie, Expression *newval, bool wantRef, -+ BinExp *originalExp); - - Expression *BinExp::interpretAssignCommon(InterState *istate, CtfeGoal goal, fp_t fp, int post) - { -@@ -2479,9 +3172,9 @@ Expression *BinExp::interpretAssignCommo - { - desttype = ((TypeArray *)desttype)->next; - #if DMDV2 -- if (srctype == desttype->castMod(0)) -+ if (srctype->equals(desttype->castMod(0))) - #else -- if (srctype == desttype) -+ if (srctype->equals(desttype)) - #endif - { - isBlockAssignment = true; -@@ -2501,7 +3194,7 @@ Expression *BinExp::interpretAssignCommo - bool wantRef = false; - bool wantLvalueRef = false; - -- if (!fp && this->e1->type->toBasetype() == this->e2->type->toBasetype() && -+ if (!fp && this->e1->type->toBasetype()->equals(this->e2->type->toBasetype()) && - (e1->type->toBasetype()->ty == Tarray || isAssocArray(e1->type) - || e1->type->toBasetype()->ty == Tclass) - // e = *x is never a reference, because *x is always a value -@@ -2519,7 +3212,7 @@ Expression *BinExp::interpretAssignCommo - * can be dealt with by making this a non-ref assign (y = x.dup). - * Otherwise it's a big mess. - */ -- VarDeclaration * targetVar = findParentVar(e2, istate->localThis); -+ VarDeclaration * targetVar = findParentVar(e2); - if (!(targetVar && targetVar->isConst())) - wantRef = true; - // slice assignment of static arrays is not reference assignment -@@ -2560,7 +3253,7 @@ Expression *BinExp::interpretAssignCommo - // First, deal with this = e; and call() = e; - if (e1->op == TOKthis) - { -- e1 = istate->localThis; -+ e1 = ctfeStack.getThis(); - } - if (e1->op == TOKcall) - { -@@ -2575,7 +3268,7 @@ Expression *BinExp::interpretAssignCommo - // f() = e2, when f returns an array, is always a slice assignment. - // Convert into arr[0..arr.length] = e2 - e1 = new SliceExp(loc, e1, -- new IntegerExp(0, 0, Type::tsize_t), -+ new IntegerExp(Loc(), 0, Type::tsize_t), - ArrayLength(Type::tsize_t, e1)); - e1->type = type; - } -@@ -2586,7 +3279,7 @@ Expression *BinExp::interpretAssignCommo - if (exceptionOrCantInterpret(e1)) - return e1; - if (!(e1->op == TOKvar || e1->op == TOKdotvar || e1->op == TOKindex -- || e1->op == TOKslice)) -+ || e1->op == TOKslice || e1->op == TOKstructliteral)) - { - error("cannot dereference invalid pointer %s", - this->e1->toChars()); -@@ -2595,7 +3288,7 @@ Expression *BinExp::interpretAssignCommo - } - - if (!(e1->op == TOKarraylength || e1->op == TOKvar || e1->op == TOKdotvar -- || e1->op == TOKindex || e1->op == TOKslice)) -+ || e1->op == TOKindex || e1->op == TOKslice || e1->op == TOKstructliteral)) - { - error("CTFE internal error: unsupported assignment %s", toChars()); - return EXP_CANT_INTERPRET; -@@ -2630,7 +3323,7 @@ Expression *BinExp::interpretAssignCommo - return oldval; - while (oldval->op == TOKvar) - { -- oldval = resolveReferences(oldval, istate->localThis); -+ oldval = resolveReferences(oldval); - oldval = oldval->interpret(istate); - if (exceptionOrCantInterpret(oldval)) - return oldval; -@@ -2699,7 +3392,7 @@ Expression *BinExp::interpretAssignCommo - { // Get the old array literal. - oldval = e1->interpret(istate); - while (oldval->op == TOKvar) -- { oldval = resolveReferences(oldval, istate->localThis); -+ { oldval = resolveReferences(oldval); - oldval = oldval->interpret(istate); - } - } -@@ -2751,14 +3444,14 @@ Expression *BinExp::interpretAssignCommo - // ------------------------------------------------- - // Make sure we're not trying to modify a global or static variable - // We do this by locating the ultimate parent variable which gets modified. -- VarDeclaration * ultimateVar = findParentVar(e1, istate->localThis); -+ VarDeclaration * ultimateVar = findParentVar(e1); - if (ultimateVar && ultimateVar->isDataseg() && !ultimateVar->isCTFE()) - { // Can't modify global or static data - error("%s cannot be modified at compile time", ultimateVar->toChars()); - return EXP_CANT_INTERPRET; - } - -- e1 = resolveReferences(e1, istate->localThis); -+ e1 = resolveReferences(e1); - - // Unless we have a simple var assignment, we're - // only modifying part of the variable. So we need to make sure -@@ -2819,7 +3512,7 @@ Expression *BinExp::interpretAssignCommo - ie = (IndexExp *)ie->e1; - ++depth; - } -- Expression *aggregate = resolveReferences(ie->e1, istate->localThis); -+ Expression *aggregate = resolveReferences(ie->e1); - Expression *oldagg = aggregate; - // Get the AA to be modified. (We do an LvalueRef interpret, unless it - // is a simple ref parameter -- in which case, we just want the value) -@@ -2907,18 +3600,17 @@ Expression *BinExp::interpretAssignCommo - // collapsed into a single assignment. - if (!wantRef && e1->op == TOKdotvar) - { -- // Strip of all of the leading dotvars, unless we started with a call -- // or a ref parameter -+ // Strip of all of the leading dotvars, unless it is a CTFE dotvar -+ // pointer or reference - // (in which case, we already have the lvalue). -- if (this->e1->op != TOKcall && !(this->e1->op==TOKvar -- && ((VarExp*)this->e1)->var->storage_class & (STCref | STCout))) -- e1 = e1->interpret(istate, isPointer(type)? ctfeNeedLvalueRef : ctfeNeedLvalue); -- if (exceptionOrCantInterpret(e1)) -- return e1; -- if (e1->op == TOKstructliteral && newval->op == TOKstructliteral) -- { -- assignInPlace(e1, newval); -- return returnValue; -+ DotVarExp *dve = (DotVarExp *)e1; -+ bool isCtfePointer = (dve->e1->op == TOKstructliteral) -+ && ((StructLiteralExp *)(dve->e1))->ownedByCtfe; -+ if (!isCtfePointer) -+ { -+ e1 = e1->interpret(istate, isPointer(type) ? ctfeNeedLvalueRef : ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(e1)) -+ return e1; - } - } - #if LOGASSIGN -@@ -2968,6 +3660,15 @@ Expression *BinExp::interpretAssignCommo - } - } - } -+ else if (e1->op == TOKstructliteral && newval->op == TOKstructliteral) -+ { -+ /* Assignment to complete struct of the form: -+ * e1 = newval -+ * (e1 was a ref parameter, or was created via TOKstar dereferencing). -+ */ -+ assignInPlace(e1, newval); -+ return returnValue; -+ } - else if (e1->op == TOKdotvar) - { - /* Assignment to member variable of the form: -@@ -3012,496 +3713,552 @@ Expression *BinExp::interpretAssignCommo - for(int i = unionStart; i < unionStart + unionSize; ++i) - { if (i == fieldi) - continue; -- Expression **el = &se->elements->tdata()[i]; -+ Expression **el = &(*se->elements)[i]; - if ((*el)->op != TOKvoid) - *el = (*el)->type->voidInitLiteral(member); - } - } - - if (newval->op == TOKstructliteral) -- assignInPlace(se->elements->tdata()[fieldi], newval); -+ assignInPlace((*se->elements)[fieldi], newval); - else -- se->elements->tdata()[fieldi] = newval; -+ (*se->elements)[fieldi] = newval; - return returnValue; - } - else if (e1->op == TOKindex) - { -- /* Assignment to array element of the form: -- * aggregate[i] = newval -- * aggregate is not AA (AAs were dealt with already). -- */ -- IndexExp *ie = (IndexExp *)e1; -- assert(ie->e1->type->toBasetype()->ty != Taarray); -- uinteger_t destarraylen = 0; -+ if ( !interpretAssignToIndex(istate, loc, (IndexExp *)e1, newval, -+ wantRef, this)) -+ return EXP_CANT_INTERPRET; -+ return returnValue; -+ } -+ else if (e1->op == TOKslice) -+ { -+ // Note that slice assignments don't support things like ++, so -+ // we don't need to remember 'returnValue'. -+ return interpretAssignToSlice(istate, goal, loc, (SliceExp *)e1, -+ newval, wantRef, isBlockAssignment, this); -+ } -+ else -+ { -+ error("%s cannot be evaluated at compile time", toChars()); -+ } -+ return returnValue; -+} -+ -+/************* -+ * Deal with assignments of the form -+ * aggregate[ie] = newval -+ * where aggregate and newval have already been interpreted -+ * -+ * Return true if OK, false if error occured -+ */ -+bool interpretAssignToIndex(InterState *istate, Loc loc, -+ IndexExp *ie, Expression *newval, bool wantRef, -+ BinExp *originalExp) -+{ -+ /* Assignment to array element of the form: -+ * aggregate[i] = newval -+ * aggregate is not AA (AAs were dealt with already). -+ */ -+ assert(ie->e1->type->toBasetype()->ty != Taarray); -+ uinteger_t destarraylen = 0; - -- // Set the $ variable, and find the array literal to modify -- if (ie->e1->type->toBasetype()->ty != Tpointer) -+ // Set the $ variable, and find the array literal to modify -+ if (ie->e1->type->toBasetype()->ty != Tpointer) -+ { -+ Expression *oldval = ie->e1->interpret(istate); -+ if (oldval->op == TOKnull) - { -- Expression *oldval = ie->e1->interpret(istate); -- if (oldval->op == TOKnull) -- { -- error("cannot index null array %s", ie->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- if (oldval->op != TOKarrayliteral && oldval->op != TOKstring -- && oldval->op != TOKslice) -- { -- error("cannot determine length of %s at compile time", -- ie->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- destarraylen = resolveArrayLength(oldval); -- if (ie->lengthVar) -- { -- IntegerExp *dollarExp = new IntegerExp(loc, destarraylen, Type::tsize_t); -- ctfeStack.push(ie->lengthVar); -- ie->lengthVar->setValue(dollarExp); -- } -+ originalExp->error("cannot index null array %s", ie->e1->toChars()); -+ return false; -+ } -+ if (oldval->op != TOKarrayliteral && oldval->op != TOKstring -+ && oldval->op != TOKslice) -+ { -+ originalExp->error("cannot determine length of %s at compile time", -+ ie->e1->toChars()); -+ return false; - } -- Expression *index = ie->e2->interpret(istate); -+ destarraylen = resolveArrayLength(oldval); - if (ie->lengthVar) -- ctfeStack.pop(ie->lengthVar); // $ is defined only inside [] -- if (exceptionOrCantInterpret(index)) -- return index; -+ { -+ IntegerExp *dollarExp = new IntegerExp(loc, destarraylen, Type::tsize_t); -+ ctfeStack.push(ie->lengthVar); -+ ie->lengthVar->setValue(dollarExp); -+ } -+ } -+ Expression *index = ie->e2->interpret(istate); -+ if (ie->lengthVar) -+ ctfeStack.pop(ie->lengthVar); // $ is defined only inside [] -+ if (exceptionOrCantInterpret(index)) -+ return false; - -- assert (index->op != TOKslice); // only happens with AA assignment -+ assert (index->op != TOKslice); // only happens with AA assignment - -- ArrayLiteralExp *existingAE = NULL; -- StringExp *existingSE = NULL; -+ ArrayLiteralExp *existingAE = NULL; -+ StringExp *existingSE = NULL; - -- Expression *aggregate = resolveReferences(ie->e1, istate->localThis); -+ Expression *aggregate = resolveReferences(ie->e1); - -- // Set the index to modify, and check that it is in range -- dinteger_t indexToModify = index->toInteger(); -- if (ie->e1->type->toBasetype()->ty == Tpointer) -+ // Set the index to modify, and check that it is in range -+ dinteger_t indexToModify = index->toInteger(); -+ if (ie->e1->type->toBasetype()->ty == Tpointer) -+ { -+ dinteger_t ofs; -+ aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(aggregate)) -+ return false; -+ if (aggregate->op == TOKnull) - { -- dinteger_t ofs; -- aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -- if (exceptionOrCantInterpret(aggregate)) -- return aggregate; -- if (aggregate->op == TOKnull) -- { -- error("cannot index through null pointer %s", ie->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- if (aggregate->op == TOKint64) -- { -- error("cannot index through invalid pointer %s of value %s", -- ie->e1->toChars(), aggregate->toChars()); -- return EXP_CANT_INTERPRET; -- } -- aggregate = getAggregateFromPointer(aggregate, &ofs); -- indexToModify += ofs; -- if (aggregate->op != TOKslice && aggregate->op != TOKstring && -- aggregate->op != TOKarrayliteral && aggregate->op != TOKassocarrayliteral) -- { -- if (indexToModify != 0) -- { -- error("pointer index [%lld] lies outside memory block [0..1]", indexToModify); -- return EXP_CANT_INTERPRET; -- } -- // It is equivalent to *aggregate = newval. -- // Aggregate could be varexp, a dotvar, ... -- // TODO: we could support this -- error("indexed assignment of non-array pointers is not yet supported at compile time; use *%s = %s instead", -- ie->e1->toChars(), e2->toChars()); -- return EXP_CANT_INTERPRET; -- } -- destarraylen = resolveArrayLength(aggregate); -+ originalExp->error("cannot index through null pointer %s", ie->e1->toChars()); -+ return false; - } -- if (indexToModify >= destarraylen) -+ if (aggregate->op == TOKint64) - { -- error("array index %lld is out of bounds [0..%lld]", indexToModify, -- destarraylen); -- return EXP_CANT_INTERPRET; -+ originalExp->error("cannot index through invalid pointer %s of value %s", -+ ie->e1->toChars(), aggregate->toChars()); -+ return false; - } -- -- /* The only possible indexable LValue aggregates are array literals, and -- * slices of array literals. -- */ -- if (aggregate->op == TOKindex || aggregate->op == TOKdotvar || -- aggregate->op == TOKslice || aggregate->op == TOKcall || -- aggregate->op == TOKstar) -+ aggregate = getAggregateFromPointer(aggregate, &ofs); -+ indexToModify += ofs; -+ if (aggregate->op != TOKslice && aggregate->op != TOKstring && -+ aggregate->op != TOKarrayliteral && aggregate->op != TOKassocarrayliteral) - { -- Expression *origagg = aggregate; -- aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -- if (exceptionOrCantInterpret(aggregate)) -- return aggregate; -- // The array could be an index of an AA. Resolve it if so. -- if (aggregate->op == TOKindex && -- ((IndexExp *)aggregate)->e1->op == TOKassocarrayliteral) -- { -- IndexExp *ix = (IndexExp *)aggregate; -- aggregate = findKeyInAA(loc, (AssocArrayLiteralExp *)ix->e1, ix->e2); -- if (!aggregate) -- { -- error("key %s not found in associative array %s", -- ix->e2->toChars(), ix->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- if (exceptionOrCantInterpret(aggregate)) -- return aggregate; -+ if (aggregate->op == TOKsymoff) -+ { -+ originalExp->error("mutable variable %s cannot be modified at compile time, even through a pointer", ((SymOffExp *)aggregate)->var->toChars()); -+ return false; -+ } -+ if (indexToModify != 0) -+ { -+ originalExp->error("pointer index [%lld] lies outside memory block [0..1]", indexToModify); -+ return false; - } -+ // It is equivalent to *aggregate = newval. -+ // Aggregate could be varexp, a dotvar, ... -+ // TODO: we could support this -+ originalExp->error("indexed assignment of non-array pointers is not yet supported at compile time; use *%s = %s instead", -+ ie->e1->toChars(), originalExp->e2->toChars()); -+ return false; - } -- if (aggregate->op == TOKvar) -- { -- VarExp *ve = (VarExp *)aggregate; -- VarDeclaration *v = ve->var->isVarDeclaration(); -- aggregate = v->getValue(); -- if (aggregate->op == TOKnull) -+ destarraylen = resolveArrayLength(aggregate); -+ } -+ if (indexToModify >= destarraylen) -+ { -+ originalExp->error("array index %lld is out of bounds [0..%lld]", indexToModify, -+ destarraylen); -+ return false; -+ } -+ -+ /* The only possible indexable LValue aggregates are array literals, and -+ * slices of array literals. -+ */ -+ if (aggregate->op == TOKindex || aggregate->op == TOKdotvar || -+ aggregate->op == TOKslice || aggregate->op == TOKcall || -+ aggregate->op == TOKstar || aggregate->op == TOKcast) -+ { -+ aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(aggregate)) -+ return false; -+ // The array could be an index of an AA. Resolve it if so. -+ if (aggregate->op == TOKindex && -+ ((IndexExp *)aggregate)->e1->op == TOKassocarrayliteral) -+ { -+ IndexExp *ix = (IndexExp *)aggregate; -+ aggregate = findKeyInAA(loc, (AssocArrayLiteralExp *)ix->e1, ix->e2); -+ if (!aggregate) - { -- // This would be a runtime segfault -- error("cannot index null array %s", v->toChars()); -- return EXP_CANT_INTERPRET; -+ originalExp->error("key %s not found in associative array %s", -+ ix->e2->toChars(), ix->e1->toChars()); -+ return false; - } -+ if (exceptionOrCantInterpret(aggregate)) -+ return false; - } -- if (aggregate->op == TOKslice) -- { -- SliceExp *sexp = (SliceExp *)aggregate; -- aggregate = sexp->e1; -- Expression *lwr = sexp->lwr->interpret(istate); -- indexToModify += lwr->toInteger(); -- } -- if (aggregate->op == TOKarrayliteral) -- existingAE = (ArrayLiteralExp *)aggregate; -- else if (aggregate->op == TOKstring) -- existingSE = (StringExp *)aggregate; -- else -+ } -+ if (aggregate->op == TOKvar) -+ { -+ VarExp *ve = (VarExp *)aggregate; -+ VarDeclaration *v = ve->var->isVarDeclaration(); -+ aggregate = v->getValue(); -+ if (aggregate->op == TOKnull) - { -- error("CTFE internal compiler error %s", aggregate->toChars()); -- return EXP_CANT_INTERPRET; -+ // This would be a runtime segfault -+ originalExp->error("cannot index null array %s", v->toChars()); -+ return false; - } -- if (!wantRef && newval->op == TOKslice) -+ } -+ if (aggregate->op == TOKslice) -+ { -+ SliceExp *sexp = (SliceExp *)aggregate; -+ aggregate = sexp->e1; -+ Expression *lwr = sexp->lwr->interpret(istate); -+ indexToModify += lwr->toInteger(); -+ } -+ if (aggregate->op == TOKarrayliteral) -+ existingAE = (ArrayLiteralExp *)aggregate; -+ else if (aggregate->op == TOKstring) -+ existingSE = (StringExp *)aggregate; -+ else -+ { -+ originalExp->error("CTFE internal compiler error %s", aggregate->toChars()); -+ return false; -+ } -+ if (!wantRef && newval->op == TOKslice) -+ { -+ newval = resolveSlice(newval); -+ if (newval == EXP_CANT_INTERPRET) - { -- newval = resolveSlice(newval); -- if (newval == EXP_CANT_INTERPRET) -- { -- error("Compiler error: CTFE index assign %s", toChars()); -- assert(0); -- } -- } -- if (wantRef && newval->op == TOKindex -- && ((IndexExp *)newval)->e1 == aggregate) -- { // It's a circular reference, resolve it now -- newval = newval->interpret(istate); -+ originalExp->error("Compiler error: CTFE index assign %s", originalExp->toChars()); -+ assert(0); - } -+ } -+ if (wantRef && newval->op == TOKindex -+ && ((IndexExp *)newval)->e1 == aggregate) -+ { // It's a circular reference, resolve it now -+ newval = newval->interpret(istate); -+ } - -- if (existingAE) -- { -- if (newval->op == TOKstructliteral) -- assignInPlace((Expression *)(existingAE->elements->tdata()[indexToModify]), newval); -- else -- existingAE->elements->tdata()[indexToModify] = newval; -- return returnValue; -- } -- if (existingSE) -+ if (existingAE) -+ { -+ if (newval->op == TOKstructliteral) -+ assignInPlace((*existingAE->elements)[indexToModify], newval); -+ else -+ (*existingAE->elements)[indexToModify] = newval; -+ return true; -+ } -+ if (existingSE) -+ { -+ utf8_t *s = (utf8_t *)existingSE->string; -+ if (!existingSE->ownedByCtfe) - { -- unsigned char *s = (unsigned char *)existingSE->string; -- if (!existingSE->ownedByCtfe) -- { -- error("cannot modify read-only string literal %s", ie->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- unsigned value = newval->toInteger(); -- switch (existingSE->sz) -- { -- case 1: s[indexToModify] = value; break; -- case 2: ((unsigned short *)s)[indexToModify] = value; break; -- case 4: ((unsigned *)s)[indexToModify] = value; break; -- default: -- assert(0); -- break; -- } -- return returnValue; -+ originalExp->error("cannot modify read-only string literal %s", ie->e1->toChars()); -+ return false; - } -- else -+ unsigned value = newval->toInteger(); -+ switch (existingSE->sz) - { -- error("Index assignment %s is not yet supported in CTFE ", toChars()); -- return EXP_CANT_INTERPRET; -+ case 1: s[indexToModify] = value; break; -+ case 2: ((unsigned short *)s)[indexToModify] = value; break; -+ case 4: ((unsigned *)s)[indexToModify] = value; break; -+ default: -+ assert(0); -+ break; - } -- return returnValue; -+ return true; - } -- else if (e1->op == TOKslice) -+ else - { -- // ------------------------------ -- // aggregate[] = newval -- // aggregate[low..upp] = newval -- // ------------------------------ -- SliceExp * sexp = (SliceExp *)e1; -- // Set the $ variable -- Expression *oldval = sexp->e1; -- bool assignmentToSlicedPointer = false; -- if (isPointer(oldval->type)) -- { // Slicing a pointer -- oldval = oldval->interpret(istate, ctfeNeedLvalue); -- if (exceptionOrCantInterpret(oldval)) -- return oldval; -- dinteger_t ofs; -- oldval = getAggregateFromPointer(oldval, &ofs); -- assignmentToSlicedPointer = true; -- } else -- oldval = oldval->interpret(istate); -+ originalExp->error("Index assignment %s is not yet supported in CTFE ", originalExp->toChars()); -+ return false; -+ } -+ return true; -+} - -- if (oldval->op != TOKarrayliteral && oldval->op != TOKstring -- && oldval->op != TOKslice && oldval->op != TOKnull) -+/************* -+ * Deal with assignments of the form -+ * dest[] = newval -+ * dest[low..upp] = newval -+ * where newval has already been interpreted -+ * -+ * This could be a slice assignment or a block assignment, and -+ * dest could be either an array literal, or a string. -+ * -+ * Returns EXP_CANT_INTERPRET on failure. If there are no errors, -+ * it returns aggregate[low..upp], except that as an optimisation, -+ * if goal == ctfeNeedNothing, it will return NULL -+ */ -+ -+Expression *interpretAssignToSlice(InterState *istate, CtfeGoal goal, Loc loc, -+ SliceExp *sexp, Expression *newval, bool wantRef, bool isBlockAssignment, -+ BinExp *originalExp) -+{ -+ Expression *e2 = originalExp->e2; -+ -+ // ------------------------------ -+ // aggregate[] = newval -+ // aggregate[low..upp] = newval -+ // ------------------------------ -+ // Set the $ variable -+ Expression *oldval = sexp->e1; -+ bool assignmentToSlicedPointer = false; -+ if (isPointer(oldval->type)) -+ { // Slicing a pointer -+ oldval = oldval->interpret(istate, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(oldval)) -+ return oldval; -+ dinteger_t ofs; -+ oldval = getAggregateFromPointer(oldval, &ofs); -+ assignmentToSlicedPointer = true; -+ } -+ else -+ oldval = oldval->interpret(istate); -+ -+ if (oldval->op != TOKarrayliteral && oldval->op != TOKstring -+ && oldval->op != TOKslice && oldval->op != TOKnull) -+ { -+ if (oldval->op == TOKsymoff) - { -- if (assignmentToSlicedPointer) -- { -- error("pointer %s cannot be sliced at compile time (it does not point to an array)", -- sexp->e1->toChars()); -- } -- else -- error("CTFE ICE: cannot resolve array length"); -+ originalExp->error("pointer %s cannot be sliced at compile time (it points to a static variable)", sexp->e1->toChars()); - return EXP_CANT_INTERPRET; - } -- uinteger_t dollar = resolveArrayLength(oldval); -- if (sexp->lengthVar) -+ if (assignmentToSlicedPointer) - { -- Expression *arraylen = new IntegerExp(loc, dollar, Type::tsize_t); -- ctfeStack.push(sexp->lengthVar); -- sexp->lengthVar->setValue(arraylen); -- } -- -- Expression *upper = NULL; -- Expression *lower = NULL; -- if (sexp->upr) -- upper = sexp->upr->interpret(istate); -- if (exceptionOrCantInterpret(upper)) -- { -- if (sexp->lengthVar) -- ctfeStack.pop(sexp->lengthVar); // $ is defined only in [L..U] -- return upper; -+ originalExp->error("pointer %s cannot be sliced at compile time (it does not point to an array)", -+ sexp->e1->toChars()); - } -- if (sexp->lwr) -- lower = sexp->lwr->interpret(istate); -+ else -+ originalExp->error("CTFE ICE: cannot resolve array length"); -+ return EXP_CANT_INTERPRET; -+ } -+ uinteger_t dollar = resolveArrayLength(oldval); -+ if (sexp->lengthVar) -+ { -+ Expression *arraylen = new IntegerExp(loc, dollar, Type::tsize_t); -+ ctfeStack.push(sexp->lengthVar); -+ sexp->lengthVar->setValue(arraylen); -+ } -+ -+ Expression *upper = NULL; -+ Expression *lower = NULL; -+ if (sexp->upr) -+ upper = sexp->upr->interpret(istate); -+ if (exceptionOrCantInterpret(upper)) -+ { - if (sexp->lengthVar) - ctfeStack.pop(sexp->lengthVar); // $ is defined only in [L..U] -- if (exceptionOrCantInterpret(lower)) -- return lower; -- -- size_t dim = dollar; -- size_t upperbound = upper ? upper->toInteger() : dim; -- int lowerbound = lower ? lower->toInteger() : 0; -+ return upper; -+ } -+ if (sexp->lwr) -+ lower = sexp->lwr->interpret(istate); -+ if (sexp->lengthVar) -+ ctfeStack.pop(sexp->lengthVar); // $ is defined only in [L..U] -+ if (exceptionOrCantInterpret(lower)) -+ return lower; -+ -+ size_t dim = dollar; -+ size_t upperbound = upper ? upper->toInteger() : dim; -+ int lowerbound = lower ? lower->toInteger() : 0; - -- if (!assignmentToSlicedPointer && (((int)lowerbound < 0) || (upperbound > dim))) -- { -- error("Array bounds [0..%d] exceeded in slice [%d..%d]", -- dim, lowerbound, upperbound); -- return EXP_CANT_INTERPRET; -- } -- if (upperbound == lowerbound) -- return newval; -+ if (!assignmentToSlicedPointer && (((int)lowerbound < 0) || (upperbound > dim))) -+ { -+ originalExp->error("Array bounds [0..%d] exceeded in slice [%d..%d]", -+ dim, lowerbound, upperbound); -+ return EXP_CANT_INTERPRET; -+ } -+ if (upperbound == lowerbound) -+ return newval; - -- Expression *aggregate = resolveReferences(((SliceExp *)e1)->e1, istate->localThis); -- dinteger_t firstIndex = lowerbound; -+ Expression *aggregate = resolveReferences(sexp->e1); -+ sinteger_t firstIndex = lowerbound; - -- ArrayLiteralExp *existingAE = NULL; -- StringExp *existingSE = NULL; -+ ArrayLiteralExp *existingAE = NULL; -+ StringExp *existingSE = NULL; - -- /* The only possible slicable LValue aggregates are array literals, -- * and slices of array literals. -- */ -+ /* The only possible slicable LValue aggregates are array literals, -+ * and slices of array literals. -+ */ - -- if (aggregate->op == TOKindex || aggregate->op == TOKdotvar || -- aggregate->op == TOKslice || -- aggregate->op == TOKstar || aggregate->op == TOKcall) -- { -- aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -- if (exceptionOrCantInterpret(aggregate)) -- return aggregate; -- // The array could be an index of an AA. Resolve it if so. -- if (aggregate->op == TOKindex && -- ((IndexExp *)aggregate)->e1->op == TOKassocarrayliteral) -- { -- IndexExp *ix = (IndexExp *)aggregate; -- aggregate = findKeyInAA(loc, (AssocArrayLiteralExp *)ix->e1, ix->e2); -- if (!aggregate) -- { -- error("key %s not found in associative array %s", -- ix->e2->toChars(), ix->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- if (exceptionOrCantInterpret(aggregate)) -- return aggregate; -- } -- } -- if (aggregate->op == TOKvar) -- { -- VarExp *ve = (VarExp *)(aggregate); -- VarDeclaration *v = ve->var->isVarDeclaration(); -- aggregate = v->getValue(); -- } -- if (aggregate->op == TOKslice) -- { // Slice of a slice --> change the bounds -- SliceExp *sexpold = (SliceExp *)aggregate; -- sinteger_t hi = upperbound + sexpold->lwr->toInteger(); -- firstIndex = lowerbound + sexpold->lwr->toInteger(); -- if (hi > sexpold->upr->toInteger()) -- { -- error("slice [%d..%d] exceeds array bounds [0..%lld]", -- lowerbound, upperbound, -- sexpold->upr->toInteger() - sexpold->lwr->toInteger()); -- return EXP_CANT_INTERPRET; -- } -- aggregate = sexpold->e1; -- } -- if ( isPointer(aggregate->type) ) -- { // Slicing a pointer --> change the bounds -- aggregate = sexp->e1->interpret(istate, ctfeNeedLvalue); -- dinteger_t ofs; -- aggregate = getAggregateFromPointer(aggregate, &ofs); -- if (aggregate->op == TOKnull) -- { -- error("cannot slice null pointer %s", sexp->e1->toChars()); -- return EXP_CANT_INTERPRET; -- } -- sinteger_t hi = upperbound + ofs; -- firstIndex = lowerbound + ofs; -- if (firstIndex < 0 || hi > dim) -+ if (aggregate->op == TOKindex || aggregate->op == TOKdotvar || -+ aggregate->op == TOKslice || aggregate->op == TOKcast || -+ aggregate->op == TOKstar || aggregate->op == TOKcall) -+ { -+ aggregate = aggregate->interpret(istate, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(aggregate)) -+ return aggregate; -+ // The array could be an index of an AA. Resolve it if so. -+ if (aggregate->op == TOKindex && -+ ((IndexExp *)aggregate)->e1->op == TOKassocarrayliteral) -+ { -+ IndexExp *ix = (IndexExp *)aggregate; -+ aggregate = findKeyInAA(loc, (AssocArrayLiteralExp *)ix->e1, ix->e2); -+ if (!aggregate) - { -- error("slice [lld..%lld] exceeds memory block bounds [0..%lld]", -- firstIndex, hi, dim); -+ originalExp->error("key %s not found in associative array %s", -+ ix->e2->toChars(), ix->e1->toChars()); - return EXP_CANT_INTERPRET; - } -+ if (exceptionOrCantInterpret(aggregate)) -+ return aggregate; - } -- if (aggregate->op == TOKarrayliteral) -- existingAE = (ArrayLiteralExp *)aggregate; -- else if (aggregate->op == TOKstring) -- existingSE = (StringExp *)aggregate; -- if (existingSE && !existingSE->ownedByCtfe) -- { error("cannot modify read-only string literal %s", sexp->e1->toChars()); -+ } -+ if (aggregate->op == TOKvar) -+ { -+ VarExp *ve = (VarExp *)(aggregate); -+ VarDeclaration *v = ve->var->isVarDeclaration(); -+ aggregate = v->getValue(); -+ } -+ if (aggregate->op == TOKslice) -+ { // Slice of a slice --> change the bounds -+ SliceExp *sexpold = (SliceExp *)aggregate; -+ sinteger_t hi = upperbound + sexpold->lwr->toInteger(); -+ firstIndex = lowerbound + sexpold->lwr->toInteger(); -+ if (hi > sexpold->upr->toInteger()) -+ { -+ originalExp->error("slice [%d..%d] exceeds array bounds [0..%lld]", -+ lowerbound, upperbound, -+ sexpold->upr->toInteger() - sexpold->lwr->toInteger()); - return EXP_CANT_INTERPRET; - } -- -- if (!wantRef && newval->op == TOKslice) -+ aggregate = sexpold->e1; -+ } -+ if ( isPointer(aggregate->type) ) -+ { // Slicing a pointer --> change the bounds -+ aggregate = sexp->e1->interpret(istate, ctfeNeedLvalue); -+ dinteger_t ofs; -+ aggregate = getAggregateFromPointer(aggregate, &ofs); -+ if (aggregate->op == TOKnull) - { -- newval = resolveSlice(newval); -- if (newval == EXP_CANT_INTERPRET) -- { -- error("Compiler error: CTFE slice %s", toChars()); -- assert(0); -- } -- } -- if (wantRef && newval->op == TOKindex -- && ((IndexExp *)newval)->e1 == aggregate) -- { // It's a circular reference, resolve it now -- newval = newval->interpret(istate); -+ originalExp->error("cannot slice null pointer %s", sexp->e1->toChars()); -+ return EXP_CANT_INTERPRET; - } -- -- // For slice assignment, we check that the lengths match. -- size_t srclen = 0; -- if (newval->op == TOKarrayliteral) -- srclen = ((ArrayLiteralExp *)newval)->elements->dim; -- else if (newval->op == TOKstring) -- srclen = ((StringExp *)newval)->len; -- if (!isBlockAssignment && srclen != (upperbound - lowerbound)) -+ sinteger_t hi = upperbound + ofs; -+ firstIndex = lowerbound + ofs; -+ if (firstIndex < 0 || hi > dim) - { -- error("Array length mismatch assigning [0..%d] to [%d..%d]", srclen, lowerbound, upperbound); -+ originalExp->error("slice [lld..%lld] exceeds memory block bounds [0..%lld]", -+ firstIndex, hi, dim); - return EXP_CANT_INTERPRET; - } -+ } -+ if (aggregate->op == TOKarrayliteral) -+ existingAE = (ArrayLiteralExp *)aggregate; -+ else if (aggregate->op == TOKstring) -+ existingSE = (StringExp *)aggregate; -+ if (existingSE && !existingSE->ownedByCtfe) -+ { originalExp->error("cannot modify read-only string literal %s", sexp->e1->toChars()); -+ return EXP_CANT_INTERPRET; -+ } - -- if (!isBlockAssignment && newval->op == TOKarrayliteral && existingAE) -+ if (!wantRef && newval->op == TOKslice) -+ { -+ Expression *orignewval = newval; -+ newval = resolveSlice(newval); -+ if (newval == EXP_CANT_INTERPRET) - { -- Expressions *oldelems = existingAE->elements; -- Expressions *newelems = ((ArrayLiteralExp *)newval)->elements; -- for (size_t j = 0; j < newelems->dim; j++) -- { -- oldelems->tdata()[j + firstIndex] = newelems->tdata()[j]; -- } -- return newval; -+ originalExp->error("Compiler error: CTFE slice %s", orignewval->toChars()); -+ assert(0); - } -- else if (newval->op == TOKstring && existingSE) -+ } -+ if (wantRef && newval->op == TOKindex -+ && ((IndexExp *)newval)->e1 == aggregate) -+ { // It's a circular reference, resolve it now -+ newval = newval->interpret(istate); -+ } -+ -+ // For slice assignment, we check that the lengths match. -+ size_t srclen = 0; -+ if (newval->op == TOKarrayliteral) -+ srclen = ((ArrayLiteralExp *)newval)->elements->dim; -+ else if (newval->op == TOKstring) -+ srclen = ((StringExp *)newval)->len; -+ if (!isBlockAssignment && srclen != (upperbound - lowerbound)) -+ { -+ originalExp->error("Array length mismatch assigning [0..%d] to [%d..%d]", srclen, lowerbound, upperbound); -+ return EXP_CANT_INTERPRET; -+ } -+ -+ if (!isBlockAssignment && newval->op == TOKarrayliteral && existingAE) -+ { -+ Expressions *oldelems = existingAE->elements; -+ Expressions *newelems = ((ArrayLiteralExp *)newval)->elements; -+ Type *elemtype = existingAE->type->nextOf(); -+ for (size_t j = 0; j < newelems->dim; j++) - { -- sliceAssignStringFromString((StringExp *)existingSE, (StringExp *)newval, firstIndex); -- return newval; -- } -- else if (newval->op == TOKstring && existingAE -- && existingAE->type->isString()) -- { /* Mixed slice: it was initialized as an array literal of chars. -- * Now a slice of it is being set with a string. -- */ -- sliceAssignArrayLiteralFromString(existingAE, (StringExp *)newval, firstIndex); -- return newval; -- } -- else if (newval->op == TOKarrayliteral && existingSE) -- { /* Mixed slice: it was initialized as a string literal. -- * Now a slice of it is being set with an array literal. -- */ -- sliceAssignStringFromArrayLiteral(existingSE, (ArrayLiteralExp *)newval, firstIndex); -- return newval; -+ (*oldelems)[j + firstIndex] = paintTypeOntoLiteral(elemtype, (*newelems)[j]); - } -- else if (existingSE) -- { // String literal block slice assign -- unsigned value = newval->toInteger(); -- unsigned char *s = (unsigned char *)existingSE->string; -- for (size_t j = 0; j < upperbound-lowerbound; j++) -+ return newval; -+ } -+ else if (newval->op == TOKstring && existingSE) -+ { -+ sliceAssignStringFromString((StringExp *)existingSE, (StringExp *)newval, firstIndex); -+ return newval; -+ } -+ else if (newval->op == TOKstring && existingAE -+ && existingAE->type->isString()) -+ { /* Mixed slice: it was initialized as an array literal of chars. -+ * Now a slice of it is being set with a string. -+ */ -+ sliceAssignArrayLiteralFromString(existingAE, (StringExp *)newval, firstIndex); -+ return newval; -+ } -+ else if (newval->op == TOKarrayliteral && existingSE) -+ { /* Mixed slice: it was initialized as a string literal. -+ * Now a slice of it is being set with an array literal. -+ */ -+ sliceAssignStringFromArrayLiteral(existingSE, (ArrayLiteralExp *)newval, firstIndex); -+ return newval; -+ } -+ else if (existingSE) -+ { // String literal block slice assign -+ unsigned value = newval->toInteger(); -+ utf8_t *s = (utf8_t *)existingSE->string; -+ for (size_t j = 0; j < upperbound-lowerbound; j++) -+ { -+ switch (existingSE->sz) - { -- switch (existingSE->sz) -- { -- case 1: s[j+firstIndex] = value; break; -- case 2: ((unsigned short *)s)[j+firstIndex] = value; break; -- case 4: ((unsigned *)s)[j+firstIndex] = value; break; -- default: -- assert(0); -- break; -- } -+ case 1: s[j+firstIndex] = value; break; -+ case 2: ((unsigned short *)s)[j+firstIndex] = value; break; -+ case 4: ((unsigned *)s)[j+firstIndex] = value; break; -+ default: -+ assert(0); -+ break; - } -- if (goal == ctfeNeedNothing) -- return NULL; // avoid creating an unused literal -- SliceExp *retslice = new SliceExp(loc, existingSE, -- new IntegerExp(loc, firstIndex, Type::tsize_t), -- new IntegerExp(loc, firstIndex + upperbound-lowerbound, Type::tsize_t)); -- retslice->type = this->type; -- return retslice->interpret(istate); -- } -- else if (existingAE) -- { -- /* Block assignment, initialization of static arrays -- * x[] = e -- * x may be a multidimensional static array. (Note that this -- * only happens with array literals, never with strings). -- */ -- Expressions * w = existingAE->elements; -- assert( existingAE->type->ty == Tsarray || -- existingAE->type->ty == Tarray); -+ } -+ if (goal == ctfeNeedNothing) -+ return NULL; // avoid creating an unused literal -+ SliceExp *retslice = new SliceExp(loc, existingSE, -+ new IntegerExp(loc, firstIndex, Type::tsize_t), -+ new IntegerExp(loc, firstIndex + upperbound-lowerbound, Type::tsize_t)); -+ retslice->type = originalExp->type; -+ return retslice->interpret(istate); -+ } -+ else if (existingAE) -+ { -+ /* Block assignment, initialization of static arrays -+ * x[] = e -+ * x may be a multidimensional static array. (Note that this -+ * only happens with array literals, never with strings). -+ */ -+ Expressions * w = existingAE->elements; -+ assert( existingAE->type->ty == Tsarray || -+ existingAE->type->ty == Tarray); - #if DMDV2 -- Type *desttype = ((TypeArray *)existingAE->type)->next->castMod(0); -- bool directblk = (e2->type->toBasetype()->castMod(0)) == desttype; -+ Type *desttype = ((TypeArray *)existingAE->type)->next->castMod(0); -+ bool directblk = (e2->type->toBasetype()->castMod(0))->equals(desttype); - #else -- Type *desttype = ((TypeArray *)existingAE->type)->next; -- bool directblk = (e2->type->toBasetype()) == desttype; -+ Type *desttype = ((TypeArray *)existingAE->type)->next; -+ bool directblk = (e2->type->toBasetype())->equals(desttype); - #endif -- bool cow = !(newval->op == TOKstructliteral || newval->op == TOKarrayliteral -- || newval->op == TOKstring); -- for (size_t j = 0; j < upperbound-lowerbound; j++) -- { -- if (!directblk) -- // Multidimensional array block assign -- recursiveBlockAssign((ArrayLiteralExp *)w->tdata()[j+firstIndex], newval, wantRef); -+ bool cow = !(newval->op == TOKstructliteral || newval->op == TOKarrayliteral -+ || newval->op == TOKstring); -+ for (size_t j = 0; j < upperbound-lowerbound; j++) -+ { -+ if (!directblk) -+ // Multidimensional array block assign -+ recursiveBlockAssign((ArrayLiteralExp *)(*w)[j+firstIndex], newval, wantRef); -+ else -+ { -+ if (wantRef || cow) -+ (*existingAE->elements)[j+firstIndex] = newval; - else -- { -- if (wantRef || cow) -- existingAE->elements->tdata()[j+firstIndex] = newval; -- else -- assignInPlace(existingAE->elements->tdata()[j+firstIndex], newval); -- } -+ assignInPlace((*existingAE->elements)[j+firstIndex], newval); - } -- if (goal == ctfeNeedNothing) -- return NULL; // avoid creating an unused literal -- SliceExp *retslice = new SliceExp(loc, existingAE, -- new IntegerExp(loc, firstIndex, Type::tsize_t), -- new IntegerExp(loc, firstIndex + upperbound-lowerbound, Type::tsize_t)); -- retslice->type = this->type; -- return retslice->interpret(istate); - } -- else -- error("Slice operation %s cannot be evaluated at compile time", toChars()); -+ if (goal == ctfeNeedNothing) -+ return NULL; // avoid creating an unused literal -+ SliceExp *retslice = new SliceExp(loc, existingAE, -+ new IntegerExp(loc, firstIndex, Type::tsize_t), -+ new IntegerExp(loc, firstIndex + upperbound-lowerbound, Type::tsize_t)); -+ retslice->type = originalExp->type; -+ return retslice->interpret(istate); - } - else - { -- error("%s cannot be evaluated at compile time", toChars()); -+ originalExp->error("Slice operation %s = %s cannot be evaluated at compile time", sexp->toChars(), newval->toChars()); -+ return EXP_CANT_INTERPRET; - } -- return returnValue; - } - - Expression *AssignExp::interpret(InterState *istate, CtfeGoal goal) -@@ -3509,29 +4266,30 @@ Expression *AssignExp::interpret(InterSt - return interpretAssignCommon(istate, goal, NULL); - } - --#define BIN_ASSIGN_INTERPRET_CTFE(op, ctfeOp) \ --Expression *op##AssignExp::interpret(InterState *istate, CtfeGoal goal) \ --{ \ -- return interpretAssignCommon(istate, goal, &ctfeOp); \ --} -- --#define BIN_ASSIGN_INTERPRET(op) BIN_ASSIGN_INTERPRET_CTFE(op, op) -- --BIN_ASSIGN_INTERPRET(Add) --BIN_ASSIGN_INTERPRET(Min) --BIN_ASSIGN_INTERPRET_CTFE(Cat, ctfeCat) --BIN_ASSIGN_INTERPRET(Mul) --BIN_ASSIGN_INTERPRET(Div) --BIN_ASSIGN_INTERPRET(Mod) --BIN_ASSIGN_INTERPRET(Shl) --BIN_ASSIGN_INTERPRET(Shr) --BIN_ASSIGN_INTERPRET(Ushr) --BIN_ASSIGN_INTERPRET(And) --BIN_ASSIGN_INTERPRET(Or) --BIN_ASSIGN_INTERPRET(Xor) -+Expression *BinAssignExp::interpret(InterState *istate, CtfeGoal goal) -+{ -+ switch(op) -+ { -+ case TOKaddass: return interpretAssignCommon(istate, goal, &Add); -+ case TOKminass: return interpretAssignCommon(istate, goal, &Min); -+ case TOKcatass: return interpretAssignCommon(istate, goal, &ctfeCat); -+ case TOKmulass: return interpretAssignCommon(istate, goal, &Mul); -+ case TOKdivass: return interpretAssignCommon(istate, goal, &Div); -+ case TOKmodass: return interpretAssignCommon(istate, goal, &Mod); -+ case TOKshlass: return interpretAssignCommon(istate, goal, &Shl); -+ case TOKshrass: return interpretAssignCommon(istate, goal, &Shr); -+ case TOKushrass: return interpretAssignCommon(istate, goal, &Ushr); -+ case TOKandass: return interpretAssignCommon(istate, goal, &And); -+ case TOKorass: return interpretAssignCommon(istate, goal, &Or); -+ case TOKxorass: return interpretAssignCommon(istate, goal, &Xor); - #if DMDV2 --BIN_ASSIGN_INTERPRET(Pow) -+ case TOKpowass: return interpretAssignCommon(istate, goal, &Pow); - #endif -+ default: -+ assert(0); -+ return NULL; -+ } -+} - - Expression *PostExp::interpret(InterState *istate, CtfeGoal goal) - { -@@ -3891,7 +4649,7 @@ Expression *CallExp::interpret(InterStat - Expression * pe = ((PtrExp*)ecall)->e1; - if (pe->op == TOKvar) { - VarDeclaration *vd = ((VarExp *)((PtrExp*)ecall)->e1)->var->isVarDeclaration(); -- if (vd && vd->getValue() && vd->getValue()->op == TOKsymoff) -+ if (vd && vd->hasValue() && vd->getValue()->op == TOKsymoff) - fd = ((SymOffExp *)vd->getValue())->var->isFuncDeclaration(); - else - { -@@ -3932,7 +4690,7 @@ Expression *CallExp::interpret(InterStat - else if (ecall->op == TOKvar) - { - VarDeclaration *vd = ((VarExp *)ecall)->var->isVarDeclaration(); -- if (vd && vd->getValue()) -+ if (vd && vd->hasValue()) - ecall = vd->getValue(); - else // Calling a function - fd = ((VarExp *)e1)->var->isFuncDeclaration(); -@@ -3953,7 +4711,7 @@ Expression *CallExp::interpret(InterStat - - TypeFunction *tf = fd ? (TypeFunction *)(fd->type) : NULL; - if (!tf) -- { // DAC: This should never happen, it's an internal compiler error. -+ { // This should never happen, it's an internal compiler error. - //printf("ecall=%s %d %d\n", ecall->toChars(), ecall->op, TOKcall); - if (ecall->op == TOKidentifier) - error("cannot evaluate %s at compile time. Circular reference?", toChars()); -@@ -3982,12 +4740,25 @@ Expression *CallExp::interpret(InterStat - { // Make a virtual function call. - Expression *thisval = pthis; - if (pthis->op == TOKvar) -- { assert(((VarExp*)thisval)->var->isVarDeclaration()); -- thisval = ((VarExp*)thisval)->var->isVarDeclaration()->getValue(); -+ { -+ VarDeclaration *vthis = ((VarExp*)thisval)->var->isVarDeclaration(); -+ assert(vthis); -+ thisval = getVarExp(loc, istate, vthis, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(thisval)) -+ return thisval; - // If it is a reference, resolve it - if (thisval->op != TOKnull && thisval->op != TOKclassreference) - thisval = pthis->interpret(istate); - } -+ else if (pthis->op == TOKsymoff) -+ { -+ VarDeclaration *vthis = ((SymOffExp*)thisval)->var->isVarDeclaration(); -+ assert(vthis); -+ thisval = getVarExp(loc, istate, vthis, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(thisval)) -+ return thisval; -+ } -+ - // Get the function from the vtable of the original class - ClassDeclaration *cd; - if (thisval && thisval->op == TOKnull) -@@ -4036,6 +4807,8 @@ Expression *CallExp::interpret(InterStat - } - return e; - } -+ if (fd->dArrayOp) -+ return fd->dArrayOp->interpret(istate, arguments, pthis); - if (!fd->fbody) - { - error("%s cannot be interpreted at compile time," -@@ -4070,7 +4843,7 @@ Expression *CommaExp::interpret(InterSta - InterState istateComma; - if (!istate && firstComma->e1->op == TOKdeclaration) - { -- ctfeStack.startFrame(); -+ ctfeStack.startFrame(NULL); - istate = &istateComma; - } - -@@ -4098,7 +4871,7 @@ Expression *CommaExp::interpret(InterSta - if (exceptionOrCantInterpret(newval)) - { - if (istate == &istateComma) -- ctfeStack.endFrame(0); -+ ctfeStack.endFrame(); - return newval; - } - if (newval != EXP_VOID_INTERPRET) -@@ -4120,7 +4893,7 @@ Expression *CommaExp::interpret(InterSta - } - // If we created a temporary stack frame, end it now. - if (istate == &istateComma) -- ctfeStack.endFrame(0); -+ ctfeStack.endFrame(); - return e; - } - -@@ -4132,7 +4905,7 @@ Expression *CondExp::interpret(InterStat - Expression *e; - if ( isPointer(econd->type) ) - { -- e = econd->interpret(istate, ctfeNeedLvalue); -+ e = econd->interpret(istate); - if (exceptionOrCantInterpret(e)) - return e; - if (e->op != TOKnull) -@@ -4211,22 +4984,40 @@ Expression *IndexExp::interpret(InterSta - { - dinteger_t len = ArrayLength(Type::tsize_t, agg)->toInteger(); - //Type *pointee = ((TypePointer *)agg->type)->next; -- if ((indx + ofs) < 0 || (indx+ofs) > len) -+ if ((sinteger_t)(indx + ofs) < 0 || (indx+ofs) > len) - { - error("pointer index [%lld] exceeds allocated memory block [0..%lld]", - indx+ofs, len); - return EXP_CANT_INTERPRET; - } -+ if (goal == ctfeNeedLvalueRef) -+ { -+ // if we need a reference, IndexExp shouldn't be interpreting -+ // the expression to a value, it should stay as a reference -+ Expression *e = new IndexExp(loc, agg, -+ ofs ? new IntegerExp(loc,indx + ofs, e2->type) : e2); -+ e->type = type; -+ return e; -+ } - return ctfeIndex(loc, type, agg, indx+ofs); - } - else - { // Pointer to a non-array variable -+ if (agg->op == TOKsymoff) -+ { -+ error("mutable variable %s cannot be read at compile time, even through a pointer", ((SymOffExp *)agg)->var->toChars()); -+ return EXP_CANT_INTERPRET; -+ } - if ((indx + ofs) != 0) - { - error("pointer index [%lld] lies outside memory block [0..1]", - indx+ofs); - return EXP_CANT_INTERPRET; - } -+ if (goal == ctfeNeedLvalueRef) -+ { -+ return paintTypeOntoLiteral(type, agg); -+ } - return agg->interpret(istate); - } - } -@@ -4239,7 +5030,7 @@ Expression *IndexExp::interpret(InterSta - - if (e1->op == TOKnull) - { -- if (goal == ctfeNeedLvalue && e1->type->ty == Taarray) -+ if (goal == ctfeNeedLvalue && e1->type->ty == Taarray && modifiable) - return paintTypeOntoLiteral(type, e1); - error("cannot index null array %s", this->e1->toChars()); - return EXP_CANT_INTERPRET; -@@ -4374,6 +5165,11 @@ Expression *SliceExp::interpret(InterSta - error("cannot slice null pointer %s", this->e1->toChars()); - return EXP_CANT_INTERPRET; - } -+ if (agg->op == TOKsymoff) -+ { -+ error("slicing pointers to static variables is not supported in CTFE"); -+ return EXP_CANT_INTERPRET; -+ } - if (agg->op != TOKarrayliteral && agg->op != TOKstring) - { - error("pointer %s cannot be sliced at compile time (it does not point to an array)", -@@ -4633,7 +5429,7 @@ Expression *CastExp::interpret(InterStat - e->type = type; - return e; - } -- if (e1->op == TOKindex && ((IndexExp *)e1)->e1->type != e1->type) -+ if (e1->op == TOKindex && !((IndexExp *)e1)->e1->type->equals(e1->type)) - { // type painting operation - IndexExp *ie = (IndexExp *)e1; - e = new IndexExp(e1->loc, ie->e1, ie->e2); -@@ -4647,7 +5443,7 @@ Expression *CastExp::interpret(InterStat - { ArrayLiteralExp *ale = (ArrayLiteralExp *)ie->e1; - uinteger_t indx = ie->e2->toInteger(); - if (indx < ale->elements->dim) -- xx = ale->elements->tdata()[indx]; -+ xx = (*ale->elements)[indx]; - } - if (xx && xx->op == TOKindex) - origType = ((IndexExp *)xx)->e1->type->nextOf(); -@@ -4667,7 +5463,7 @@ Expression *CastExp::interpret(InterStat - } - if (e1->op == TOKaddress) - { -- Type *origType = ((AddrExp *)e1)->type; -+ Type *origType = ((AddrExp *)e1)->e1->type; - if (isSafePointerCast(origType, pointee)) - { - e = new AddrExp(loc, ((AddrExp *)e1)->e1); -@@ -4675,17 +5471,21 @@ Expression *CastExp::interpret(InterStat - return e; - } - } -- if (e1->op == TOKvar) -+ if (e1->op == TOKvar || e1->op == TOKsymoff) - { // type painting operation -- Type *origType = ((VarExp *)e1)->var->type; -+ Type *origType = (e1->op == TOKvar) ? ((VarExp *)e1)->var->type : -+ ((SymOffExp *)e1)->var->type; - if (castBackFromVoid && !isSafePointerCast(origType, pointee)) - { - error("using void* to reinterpret cast from %s* to %s* is not supported in CTFE", - origType->toChars(), pointee->toChars()); - return EXP_CANT_INTERPRET; - } -- e = new VarExp(loc, ((VarExp *)e1)->var); -- e->type = type; -+ if (e1->op == TOKvar) -+ e = new VarExp(loc, ((VarExp *)e1)->var); -+ else -+ e = new SymOffExp(loc, ((SymOffExp *)e1)->var, ((SymOffExp *)e1)->offset); -+ e->type = to; - return e; - } - -@@ -4768,17 +5568,14 @@ Expression *AssertExp::interpret(InterSt - } - else - error("%s failed", toChars()); -- goto Lcant; -+ return EXP_CANT_INTERPRET; - } - else - { - error("%s is not a compile-time boolean expression", e1->toChars()); -- goto Lcant; -+ return EXP_CANT_INTERPRET; - } - return e1; -- --Lcant: -- return EXP_CANT_INTERPRET; - } - - Expression *PtrExp::interpret(InterState *istate, CtfeGoal goal) -@@ -4827,12 +5624,39 @@ Expression *PtrExp::interpret(InterState - #else // this is required for D1, where structs return *this instead of 'this'. - else if (e1->op == TOKthis) - { -- if(istate->localThis) -- return istate->localThis->interpret(istate); -+ if (ctfeStack.getThis()) -+ return ctfeStack.getThis()->interpret(istate); - } - #endif - else -- { // It's possible we have an array bounds error. We need to make sure it -+ { -+ // Check for .classinfo, which is lowered in the semantic pass into **(class). -+ if (e1->op == TOKstar && e1->type->ty == Tpointer && isTypeInfo_Class(e1->type->nextOf())) -+ { -+ e = (((PtrExp *)e1)->e1)->interpret(istate, ctfeNeedLvalue); -+ if (exceptionOrCantInterpret(e)) -+ return e; -+ if (e->op == TOKnull) -+ { -+ error("Null pointer dereference evaluating typeid. '%s' is null", ((PtrExp *)e1)->e1->toChars()); -+ return EXP_CANT_INTERPRET; -+ } -+ if (e->op != TOKclassreference) -+ { error("CTFE internal error determining classinfo"); -+ return EXP_CANT_INTERPRET; -+ } -+ ClassDeclaration *cd = ((ClassReferenceExp *)e)->originalClass(); -+ assert(cd); -+ -+ // Create the classinfo, if it doesn't yet exist. -+ // TODO: This belongs in semantic, CTFE should not have to do this. -+ if (!cd->vclassinfo) -+ cd->vclassinfo = new TypeInfoClassDeclaration(cd->type); -+ e = new SymOffExp(loc, cd->vclassinfo, 0); -+ e->type = type; -+ return e; -+ } -+ // It's possible we have an array bounds error. We need to make sure it - // errors with this line number, not the one where the pointer was set. - e = e1->interpret(istate, ctfeNeedLvalue); - if (exceptionOrCantInterpret(e)) -@@ -4840,10 +5664,13 @@ Expression *PtrExp::interpret(InterState - if (!(e->op == TOKvar || e->op == TOKdotvar || e->op == TOKindex - || e->op == TOKslice || e->op == TOKaddress)) - { -- error("dereference of invalid pointer '%s'", e->toChars()); -+ if (e->op == TOKsymoff) -+ error("cannot dereference pointer to static variable %s at compile time", ((SymOffExp *)e)->var->toChars()); -+ else -+ error("dereference of invalid pointer '%s'", e->toChars()); - return EXP_CANT_INTERPRET; - } -- if (goal != ctfeNeedLvalue) -+ if (goal != ctfeNeedLvalue && goal != ctfeNeedLvalueRef) - { - if (e->op == TOKindex && e->type->ty == Tpointer) - { -@@ -4902,8 +5729,26 @@ Expression *PtrExp::interpret(InterState - if (e->op == TOKaddress) - { - e = ((AddrExp*)e)->e1; -- if (e->op == TOKdotvar || e->op == TOKindex) -+ // We're changing *&e to e. -+ // We needed the AddrExp to deal with type painting expressions -+ // we couldn't otherwise express. Now that the type painting is -+ // undone, we must simplify them. This applies to references -+ // (which will be a DotVarExp or IndexExp) and to local structs -+ // (which will be a VarExp). -+ -+ // We sometimes use DotVarExp and IndexExp to represent pointers, -+ // so in that case, they shouldn't be simplified. -+ -+ bool isCtfePtr = (e->op == TOKdotvar || e->op == TOKindex) -+ && isPointer(e->type); -+ -+ // We also must not simplify if it is already a struct Literal -+ // or array literal, because it has already been interpreted. -+ if ( !isCtfePtr && e->op != TOKstructliteral && -+ e->op != TOKassocarrayliteral && e->op != TOKarrayliteral) -+ { - e = e->interpret(istate, goal); -+ } - } - else if (e->op == TOKvar) - { -@@ -4919,7 +5764,7 @@ Expression *PtrExp::interpret(InterState - error("dereference of null pointer '%s'", e1->toChars()); - return EXP_CANT_INTERPRET; - } -- e->type = type; -+ e = paintTypeOntoLiteral(type, e); - } - - #if LOG -@@ -4952,14 +5797,27 @@ Expression *DotVarExp::interpret(InterSt - ex = ((AddrExp *)ex)->e1; - VarDeclaration *v = var->isVarDeclaration(); - if (!v) -+ { - error("CTFE internal error: %s", toChars()); -+ return EXP_CANT_INTERPRET; -+ } - if (ex->op == TOKnull && ex->type->toBasetype()->ty == Tclass) - { error("class '%s' is null and cannot be dereferenced", e1->toChars()); - return EXP_CANT_INTERPRET; - } -+ if (ex->op == TOKnull) -+ { error("dereference of null pointer '%s'", e1->toChars()); -+ return EXP_CANT_INTERPRET; -+ } - if (ex->op == TOKstructliteral || ex->op == TOKclassreference) - { - StructLiteralExp *se = ex->op == TOKclassreference ? ((ClassReferenceExp *)ex)->value : (StructLiteralExp *)ex; -+ /* We don't know how to deal with overlapping fields -+ */ -+ if (se->sd->hasUnions) -+ { error("Unions with overlapping fields are not yet supported in CTFE"); -+ return EXP_CANT_INTERPRET; -+ } - // We can't use getField, because it makes a copy - int i = -1; - if (ex->op == TOKclassreference) -@@ -4971,7 +5829,7 @@ Expression *DotVarExp::interpret(InterSt - error("couldn't find field %s of type %s in %s", v->toChars(), type->toChars(), se->toChars()); - return EXP_CANT_INTERPRET; - } -- e = se->elements->tdata()[i]; -+ e = (*se->elements)[i]; - if (goal == ctfeNeedLvalue || goal == ctfeNeedLvalueRef) - { - // If it is an lvalue literal, return it... -@@ -4986,7 +5844,7 @@ Expression *DotVarExp::interpret(InterSt - * CastExp. - */ - if (goal == ctfeNeedLvalue && e->op == TOKindex && -- e->type == type && -+ e->type->equals(type) && - isPointer(type) ) - return e; - // ...Otherwise, just return the (simplified) dotvar expression -@@ -4996,8 +5854,8 @@ Expression *DotVarExp::interpret(InterSt - } - if (!e) - { -- error("couldn't find field %s in %s", v->toChars(), type->toChars()); -- e = EXP_CANT_INTERPRET; -+ error("Internal Compiler Error: Null field %s", v->toChars()); -+ return EXP_CANT_INTERPRET; - } - // If it is an rvalue literal, return it... - if (e->op == TOKstructliteral || e->op == TOKarrayliteral || -@@ -5006,8 +5864,7 @@ Expression *DotVarExp::interpret(InterSt - if (e->op == TOKvoid) - { - VoidInitExp *ve = (VoidInitExp *)e; -- error("cannot read uninitialized variable %s in ctfe", toChars()); -- ve->var->error("was uninitialized and used before set"); -+ error("cannot read uninitialized variable %s in CTFE", ve->var->toChars()); - return EXP_CANT_INTERPRET; - } - if ( isPointer(type) ) -@@ -5053,13 +5910,15 @@ Expression *RemoveExp::interpret(InterSt - Expressions *valuesx = aae->values; - size_t removed = 0; - for (size_t j = 0; j < valuesx->dim; ++j) -- { Expression *ekey = keysx->tdata()[j]; -+ { -+ Expression *ekey = (*keysx)[j]; - int eq = ctfeEqual(loc, TOKequal, ekey, index); - if (eq) - ++removed; - else if (removed != 0) -- { keysx->tdata()[j - removed] = ekey; -- valuesx->tdata()[j - removed] = valuesx->tdata()[j]; -+ { -+ (*keysx)[j - removed] = ekey; -+ (*valuesx)[j - removed] = (*valuesx)[j]; - } - } - valuesx->dim = valuesx->dim - removed; -@@ -5146,11 +6005,7 @@ Expression *interpret_aaApply(InterState - assert(fd && fd->fbody); - assert(fd->parameters); - int numParams = fd->parameters->dim; -- assert(numParams == 1 || numParams==2); -- -- Type *valueType = fd->parameters->tdata()[numParams-1]->type; -- Type *keyType = numParams == 2 ? fd->parameters->tdata()[0]->type -- : Type::tsize_t; -+ assert(numParams == 1 || numParams == 2); - - Parameter *valueArg = Parameter::getNth(((TypeFunction *)fd->type)->parameters, numParams - 1); - bool wantRefValue = 0 != (valueArg->storageClass & (STCout | STCref)); -@@ -5165,8 +6020,8 @@ Expression *interpret_aaApply(InterState - - for (size_t i = 0; i < ae->keys->dim; ++i) - { -- Expression *ekey = ae->keys->tdata()[i]; -- Expression *evalue = ae->values->tdata()[i]; -+ Expression *ekey = (*ae->keys)[i]; -+ Expression *evalue = (*ae->values)[i]; - if (wantRefValue) - { Type *t = evalue->type; - evalue = new IndexExp(deleg->loc, ae, ekey); -@@ -5217,8 +6072,8 @@ Expression *foreachApplyUtf(InterState * - assert(fd->parameters); - int numParams = fd->parameters->dim; - assert(numParams == 1 || numParams==2); -- Type *charType = fd->parameters->tdata()[numParams-1]->type; -- Type *indexType = numParams == 2 ? fd->parameters->tdata()[0]->type -+ Type *charType = (*fd->parameters)[numParams-1]->type; -+ Type *indexType = numParams == 2 ? (*fd->parameters)[0]->type - : Type::tsize_t; - uinteger_t len = resolveArrayLength(str); - if (len == 0) -@@ -5243,7 +6098,7 @@ Expression *foreachApplyUtf(InterState * - Expression *eresult; - - // Buffers for encoding; also used for decoding array literals -- unsigned char utf8buf[4]; -+ utf8_t utf8buf[4]; - unsigned short utf16buf[2]; - - size_t start = rvs ? len : 0; -@@ -5270,9 +6125,10 @@ Expression *foreachApplyUtf(InterState * - --indx; - buflen = 1; - while (indx > 0 && buflen < 4) -- { Expression * r = ale->elements->tdata()[indx]; -+ { -+ Expression * r = (*ale->elements)[indx]; - assert(r->op == TOKint64); -- unsigned char x = (unsigned char)(((IntegerExp *)r)->value); -+ utf8_t x = (utf8_t)(((IntegerExp *)r)->value); - if ( (x & 0xC0) != 0x80) - break; - ++buflen; -@@ -5282,9 +6138,9 @@ Expression *foreachApplyUtf(InterState * - buflen = (indx + 4 > len) ? len - indx : 4; - for (int i = 0; i < buflen; ++i) - { -- Expression * r = ale->elements->tdata()[indx + i]; -+ Expression * r = (*ale->elements)[indx + i]; - assert(r->op == TOKint64); -- utf8buf[i] = (unsigned char)(((IntegerExp *)r)->value); -+ utf8buf[i] = (utf8_t)(((IntegerExp *)r)->value); - } - n = 0; - errmsg = utf_decodeChar(&utf8buf[0], buflen, &n, &rawvalue); -@@ -5294,7 +6150,7 @@ Expression *foreachApplyUtf(InterState * - { // find the start of the string - --indx; - buflen = 1; -- Expression * r = ale->elements->tdata()[indx]; -+ Expression * r = (*ale->elements)[indx]; - assert(r->op == TOKint64); - unsigned short x = (unsigned short)(((IntegerExp *)r)->value); - if (indx > 0 && x >= 0xDC00 && x <= 0xDFFF) -@@ -5307,7 +6163,7 @@ Expression *foreachApplyUtf(InterState * - buflen = (indx + 2 > len) ? len - indx : 2; - for (int i=0; i < buflen; ++i) - { -- Expression * r = ale->elements->tdata()[indx + i]; -+ Expression * r = (*ale->elements)[indx + i]; - assert(r->op == TOKint64); - utf16buf[i] = (unsigned short)(((IntegerExp *)r)->value); - } -@@ -5319,7 +6175,7 @@ Expression *foreachApplyUtf(InterState * - if (rvs) - --indx; - -- Expression * r = ale->elements->tdata()[indx]; -+ Expression * r = (*ale->elements)[indx]; - assert(r->op == TOKint64); - rawvalue = ((IntegerExp *)r)->value; - n = 1; -@@ -5340,13 +6196,13 @@ Expression *foreachApplyUtf(InterState * - case 1: - if (rvs) - { // find the start of the string -- unsigned char *s = (unsigned char *)se->string; -+ utf8_t *s = (utf8_t *)se->string; - --indx; - while (indx > 0 && ((s[indx]&0xC0)==0x80)) - --indx; - saveindx = indx; - } -- errmsg = utf_decodeChar((unsigned char *)se->string, se->len, &indx, &rawvalue); -+ errmsg = utf_decodeChar((utf8_t *)se->string, se->len, &indx, &rawvalue); - if (rvs) - indx = saveindx; - break; -@@ -5462,7 +6318,7 @@ Expression *evaluateIfBuiltin(InterState - } - if (!pthis) - { -- enum BUILTIN b = fd->isBuiltin(); -+ BUILTIN b = fd->isBuiltin(); - if (b) - { Expressions args; - args.setDim(nargs); -@@ -5525,10 +6381,10 @@ Expression *evaluateIfBuiltin(InterState - assert(arguments->dim <= se->elements->dim); - for (int i = 0; i < arguments->dim; ++i) - { -- Expression *e = (*arguments)[i]->interpret(istate); -+ e = (*arguments)[i]->interpret(istate); - if (exceptionOrCantInterpret(e)) - return e; -- se->elements->tdata()[i] = e; -+ (*se->elements)[i] = e; - } - return EXP_VOID_INTERPRET; - } ---- a/src/gcc/d/dfrontend/intrange.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/intrange.h 2014-04-01 16:32:51.000000000 +0100 -@@ -12,9 +12,9 @@ - #ifndef DMD_SXNUM_H - #define DMD_SXNUM_H - --#include "port.h" // for uinteger_t --struct Type; --struct Expression; -+#include "mars.h" // for uinteger_t -+class Type; -+class Expression; - - /** - This class represents a "sign-extended number", i.e. a 65-bit number, which can ---- a/src/gcc/d/dfrontend/json.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/json.c 2014-04-01 16:32:51.000000000 +0100 -@@ -68,10 +68,9 @@ struct JsonOut - void property(const char *name, Type* type); - void property(const char *name, const char *deconame, Type* type); - void property(const char *name, Parameters* parameters); -- void property(const char *name, Expressions* expressions); -- void property(const char *name, enum TRUST trust); -- void property(const char *name, enum PURE purity); -- void property(const char *name, enum LINK linkage); -+ void property(const char *name, TRUST trust); -+ void property(const char *name, PURE purity); -+ void property(const char *name, LINK linkage); - }; - - -@@ -83,7 +82,7 @@ void json_generate(OutBuffer *buf, Modul - for (size_t i = 0; i < modules->dim; i++) - { Module *m = (*modules)[i]; - if (global.params.verbose) -- fprintf(stdmsg, "json gen %s\n", m->toChars()); -+ fprintf(global.stdmsg, "json gen %s\n", m->toChars()); - m->toJson(&json); - } - json.arrayEnd(); -@@ -129,7 +128,7 @@ void JsonOut::stringPart(const char *s) - { - for (; *s; s++) - { -- unsigned char c = (unsigned char) *s; -+ utf8_t c = (utf8_t) *s; - switch (c) - { - case '\n': -@@ -308,7 +307,7 @@ void JsonOut::propertyBool(const char *n - } - - --void JsonOut::property(const char *name, enum TRUST trust) -+void JsonOut::property(const char *name, TRUST trust) - { - switch (trust) - { -@@ -330,7 +329,7 @@ void JsonOut::property(const char *name, - } - } - --void JsonOut::property(const char *name, enum PURE purity) -+void JsonOut::property(const char *name, PURE purity) - { - switch (purity) - { -@@ -355,7 +354,7 @@ void JsonOut::property(const char *name, - } - } - --void JsonOut::property(const char *name, enum LINK linkage) -+void JsonOut::property(const char *name, LINK linkage) - { - switch (linkage) - { -@@ -396,7 +395,7 @@ void JsonOut::propertyStorageClass(const - { char tmp[20]; - const char *p = StorageClassDeclaration::stcToChars(tmp, stc); - assert(p); -- assert(strlen(p) < sizeof(tmp)); -+ assert(strlen(p) < sizeof(tmp) / sizeof(tmp[0])); - if (p[0] == '@') - { - indent(); -@@ -545,7 +544,7 @@ void TypeQualified::toJson(JsonOut *json - json->arrayStart(); - - for (size_t i = 0; i < idents.dim; i++) -- { Identifier *ident = idents[i]; -+ { RootObject *ident = idents[i]; - json->item(ident->toChars()); - } - -@@ -629,9 +628,11 @@ void Dsymbol::toJson(JsonOut *json) - - void Dsymbol::jsonProperties(JsonOut *json) - { -- json->property("name", toChars()); - if (!isTemplateDeclaration()) // TemplateDeclaration::kind() acts weird sometimes -+ { -+ json->property("name", toChars()); - json->property("kind", kind()); -+ } - - if (prot() != PROTpublic) - json->property("protection", Pprotectionnames[prot()]); -@@ -805,7 +806,6 @@ void ConditionalDeclaration::toJson(Json - - - void ClassInfoDeclaration::toJson(JsonOut *json) { } --void ModuleInfoDeclaration::toJson(JsonOut *json) { } - void TypeInfoDeclaration::toJson(JsonOut *json) { } - #if DMDV2 - void PostBlitDeclaration::toJson(JsonOut *json) { } -@@ -848,6 +848,16 @@ void Declaration::jsonProperties(JsonOut - } - } - -+void TemplateDeclaration::jsonProperties(JsonOut *json) -+{ -+ Dsymbol::jsonProperties(json); -+ -+ if (onemember && onemember->isCtorDeclaration()) -+ json->property("name", "this"); // __ctor -> this -+ else -+ json->property("name", ident->toChars()); // Foo(T) -> Foo -+} -+ - void TypedefDeclaration::toJson(JsonOut *json) - { - json->objectStart(); -@@ -960,9 +970,10 @@ void TemplateDeclaration::toJson(JsonOut - if (s->isTemplateThisParameter()) - json->property("kind", "this"); - else --#endif - json->property("kind", "type"); -- -+#else -+ json->property("kind", "type"); -+#endif - json->property("type", "deco", type->specType); - - json->property("default", "defaultDeco", type->defaultType); -@@ -1071,7 +1082,7 @@ void VarDeclaration::toJson(JsonOut *jso - if (init) - json->property("init", init->toChars()); - -- if (storage_class & STCfield) -+ if (isField()) - json->property("offset", offset); - - if (alignment && alignment != STRUCTALIGN_DEFAULT) ---- a/src/gcc/d/dfrontend/lexer.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/lexer.c 2014-04-01 16:32:51.000000000 +0100 -@@ -30,12 +30,7 @@ - #include "id.h" - #include "module.h" - --#if _WIN32 && __DMC__ --// from \dm\src\include\setlocal.h --extern "C" char * __cdecl __locale_decpoint; --#endif -- --extern int HtmlNamedEntity(unsigned char *p, size_t length); -+extern int HtmlNamedEntity(utf8_t *p, size_t length); - - #define LS 0x2028 // UTF line separator - #define PS 0x2029 // UTF paragraph separator -@@ -52,9 +47,9 @@ const int CMoctal = 0x1; - const int CMhex = 0x2; - const int CMidchar = 0x4; - --inline unsigned char isoctal (unsigned char c) { return cmtable[c] & CMoctal; } --inline unsigned char ishex (unsigned char c) { return cmtable[c] & CMhex; } --inline unsigned char isidchar(unsigned char c) { return cmtable[c] & CMidchar; } -+inline bool isoctal (utf8_t c) { return cmtable[c] & CMoctal; } -+inline bool ishex (utf8_t c) { return cmtable[c] & CMhex; } -+inline bool isidchar(utf8_t c) { return cmtable[c] & CMidchar; } - - static void cmtable_init() - { -@@ -90,7 +85,7 @@ void *Token::operator new(size_t size) - #ifdef DEBUG - void Token::print() - { -- fprintf(stdmsg, "%s\n", toChars()); -+ fprintf(stderr, "%s\n", toChars()); - } - #endif - -@@ -102,22 +97,14 @@ const char *Token::toChars() - switch (value) - { - case TOKint32v: --#ifdef IN_GCC -- sprintf(buffer,"%d",(d_int32)int64value); --#else - sprintf(buffer,"%d",int32value); --#endif - break; - - case TOKuns32v: - case TOKcharv: - case TOKwcharv: - case TOKdcharv: --#ifdef IN_GCC -- sprintf(buffer,"%uU",(d_uns32)uns64value); --#else - sprintf(buffer,"%uU",uns32value); --#endif - break; - - case TOKint64v: -@@ -128,20 +115,6 @@ const char *Token::toChars() - sprintf(buffer,"%lluUL",(ulonglong)uns64value); - break; - --#ifdef IN_GCC -- case TOKfloat32v: -- case TOKfloat64v: -- case TOKfloat80v: -- float80value.format(buffer, sizeof(buffer)); -- break; -- case TOKimaginary32v: -- case TOKimaginary64v: -- case TOKimaginary80v: -- float80value.format(buffer, sizeof(buffer)); -- // %% buffer -- strcat(buffer, "i"); -- break; --#else - case TOKfloat32v: - ld_sprint(buffer, 'g', float80value); - strcat(buffer, "f"); -@@ -170,7 +143,6 @@ const char *Token::toChars() - ld_sprint(buffer, 'g', float80value); - strcat(buffer, "Li"); - break; --#endif - - case TOKstring: - { OutBuffer buf; -@@ -179,7 +151,7 @@ const char *Token::toChars() - for (size_t i = 0; i < len; ) - { unsigned c; - -- utf_decodeChar((unsigned char *)ustring, len, &i, &c); -+ utf_decodeChar((utf8_t *)ustring, len, &i, &c); - switch (c) - { - case 0: -@@ -224,7 +196,7 @@ const char *Token::toChars() - return p; - } - --const char *Token::toChars(enum TOK value) -+const char *Token::toChars(TOK value) - { const char *p; - static char buffer[3 + 3 * sizeof(value) + 1]; - -@@ -243,10 +215,10 @@ StringTable Lexer::stringtable; - OutBuffer Lexer::stringbuffer; - - Lexer::Lexer(Module *mod, -- unsigned char *base, size_t begoffset, size_t endoffset, -+ utf8_t *base, size_t begoffset, size_t endoffset, - int doDocComment, int commentToken) -- : loc(mod, 1) - { -+ scanloc = Loc(mod, 1); - //printf("Lexer::Lexer(%p,%d)\n",base,length); - //printf("lexer.mod = %p, %p\n", mod, this->loc.mod); - memset(&token,0,sizeof(token)); -@@ -266,7 +238,7 @@ Lexer::Lexer(Module *mod, - { - p += 2; - while (1) -- { unsigned char c = *p; -+ { utf8_t c = *p; - switch (c) - { - case '\n': -@@ -294,7 +266,7 @@ Lexer::Lexer(Module *mod, - } - break; - } -- loc.linnum = 2; -+ scanloc.linnum = 2; - } - } - -@@ -303,7 +275,7 @@ void Lexer::error(const char *format, .. - { - va_list ap; - va_start(ap, format); -- ::verror(tokenLoc(), format, ap); -+ ::verror(token.loc, format, ap); - va_end(ap); - } - -@@ -319,16 +291,15 @@ void Lexer::deprecation(const char *form - { - va_list ap; - va_start(ap, format); -- ::vdeprecation(tokenLoc(), format, ap); -+ ::vdeprecation(token.loc, format, ap); - va_end(ap); - } - - TOK Lexer::nextToken() --{ Token *t; -- -+{ - if (token.next) - { -- t = token.next; -+ Token *t = token.next; - memcpy(&token,t,sizeof(Token)); - t->next = freelist; - freelist = t; -@@ -342,8 +313,8 @@ TOK Lexer::nextToken() - } - - Token *Lexer::peek(Token *ct) --{ Token *t; -- -+{ -+ Token *t; - if (ct->next) - t = ct->next; - else -@@ -448,7 +419,7 @@ int Lexer::isValidIdentifier(char *p) - while (p[idx]) - { dchar_t dc; - -- const char *q = utf_decodeChar((unsigned char *)p, len, &idx, &dc); -+ const char *q = utf_decodeChar((utf8_t *)p, len, &idx, &dc); - if (q) - goto Linvalid; - -@@ -467,7 +438,7 @@ Linvalid: - - void Lexer::scan(Token *t) - { -- unsigned lastLine = loc.linnum; -+ unsigned lastLine = scanloc.linnum; - unsigned linnum; - - t->blockComment = NULL; -@@ -476,6 +447,7 @@ void Lexer::scan(Token *t) - { - t->ptr = p; - //printf("p = %p, *p = '%c'\n",p,*p); -+ t->loc = scanloc; - switch (*p) - { - case 0: -@@ -493,12 +465,12 @@ void Lexer::scan(Token *t) - case '\r': - p++; - if (*p != '\n') // if CR stands by itself -- loc.linnum++; -+ scanloc.linnum++; - continue; // skip white space - - case '\n': - p++; -- loc.linnum++; -+ scanloc.linnum++; - continue; // skip white space - - case '0': case '1': case '2': case '3': case '4': -@@ -550,7 +522,7 @@ void Lexer::scan(Token *t) - #if ! TEXTUAL_ASSEMBLY_OUT - case '\\': // escaped string literal - { unsigned c; -- unsigned char *pstart = p; -+ utf8_t *pstart = p; - - stringbuffer.reset(); - do -@@ -573,7 +545,7 @@ void Lexer::scan(Token *t) - } while (*p == '\\'); - t->len = stringbuffer.offset; - stringbuffer.writeByte(0); -- t->ustring = (unsigned char *)mem.malloc(stringbuffer.offset); -+ t->ustring = (utf8_t *)mem.malloc(stringbuffer.offset); - memcpy(t->ustring, stringbuffer.data, stringbuffer.offset); - t->postfix = 0; - t->value = TOKstring; -@@ -602,7 +574,7 @@ void Lexer::scan(Token *t) - case 'Z': - case '_': - case_ident: -- { unsigned char c; -+ { utf8_t c; - - while (1) - { -@@ -610,7 +582,7 @@ void Lexer::scan(Token *t) - if (isidchar(c)) - continue; - else if (c & 0x80) -- { unsigned char *s = p; -+ { utf8_t *s = p; - unsigned u = decodeUTF(); - if (isUniAlpha(u)) - continue; -@@ -624,23 +596,24 @@ void Lexer::scan(Token *t) - Identifier *id = (Identifier *) sv->ptrvalue; - if (!id) - { id = new Identifier(sv->toDchars(),TOKidentifier); -- sv->ptrvalue = id; -+ sv->ptrvalue = (char *)id; - } - t->ident = id; -- t->value = (enum TOK) id->value; -+ t->value = (TOK) id->value; - anyToken = 1; - if (*t->ptr == '_') // if special identifier token - { -+ static bool initdone = false; - static char date[11+1]; - static char time[8+1]; - static char timestamp[24+1]; - -- if (!date[0]) // lazy evaluation -- { time_t t; -- char *p; -- -+ if (!initdone) // lazy evaluation -+ { -+ initdone = true; -+ time_t t; - ::time(&t); -- p = ctime(&t); -+ char *p = ctime(&t); - assert(p); - sprintf(date, "%.6s %.4s", p + 4, p + 20); - sprintf(time, "%.8s", p + 11); -@@ -650,38 +623,34 @@ void Lexer::scan(Token *t) - #if DMDV1 - if (mod && id == Id::FILE) - { -- t->ustring = (unsigned char *)(loc.filename ? loc.filename : mod->ident->toChars()); -+ t->ustring = (utf8_t *)(loc.filename ? loc.filename : mod->ident->toChars()); - goto Lstr; - } - else if (mod && id == Id::LINE) - { - t->value = TOKint64v; -- t->uns64value = loc.linnum; -+ t->uns64value = scanloc.linnum; - } - else - #endif - if (id == Id::DATE) - { -- t->ustring = (unsigned char *)date; -+ t->ustring = (utf8_t *)date; - goto Lstr; - } - else if (id == Id::TIME) - { -- t->ustring = (unsigned char *)time; -+ t->ustring = (utf8_t *)time; - goto Lstr; - } - else if (id == Id::VENDOR) - { --#ifdef IN_GCC -- t->ustring = (unsigned char *)"GDC"; --#else -- t->ustring = (unsigned char *)"Digital Mars D"; --#endif -+ t->ustring = (utf8_t *)global.compiler.vendor; - goto Lstr; - } - else if (id == Id::TIMESTAMP) - { -- t->ustring = (unsigned char *)timestamp; -+ t->ustring = (utf8_t *)timestamp; - Lstr: - t->value = TOKstring; - t->postfix = 0; -@@ -690,14 +659,19 @@ void Lexer::scan(Token *t) - else if (id == Id::VERSIONX) - { unsigned major = 0; - unsigned minor = 0; -+ bool point = false; - - for (const char *p = global.version + 1; 1; p++) - { - char c = *p; -- if (isdigit((unsigned char)c)) -+ if (isdigit((utf8_t)c)) - minor = minor * 10 + c - '0'; - else if (c == '.') -- { major = minor; -+ { -+ if (point) -+ break; // ignore everything after second '.' -+ point = true; -+ major = minor; - minor = 0; - } - else -@@ -731,31 +705,32 @@ void Lexer::scan(Token *t) - - case '*': - p++; -- linnum = loc.linnum; -+ linnum = scanloc.linnum; - while (1) - { - while (1) -- { unsigned char c = *p; -+ { utf8_t c = *p; - switch (c) - { - case '/': - break; - - case '\n': -- loc.linnum++; -+ scanloc.linnum++; - p++; - continue; - - case '\r': - p++; - if (*p != '\n') -- loc.linnum++; -+ scanloc.linnum++; - continue; - - case 0: - case 0x1A: - error("unterminated /* */ comment"); - p = end; -+ t->loc = scanloc; - t->value = TOKeof; - return; - -@@ -763,7 +738,7 @@ void Lexer::scan(Token *t) - if (c & 0x80) - { unsigned u = decodeUTF(); - if (u == PS || u == LS) -- loc.linnum++; -+ scanloc.linnum++; - } - p++; - continue; -@@ -776,6 +751,8 @@ void Lexer::scan(Token *t) - } - if (commentToken) - { -+ t->loc.filename = scanloc.filename; -+ t->loc.linnum = linnum; - t->value = TOKcomment; - return; - } -@@ -786,9 +763,9 @@ void Lexer::scan(Token *t) - continue; - - case '/': // do // style comments -- linnum = loc.linnum; -+ linnum = scanloc.linnum; - while (1) -- { unsigned char c = *++p; -+ { utf8_t c = *++p; - switch (c) - { - case '\n': -@@ -804,12 +781,15 @@ void Lexer::scan(Token *t) - if (commentToken) - { - p = end; -+ t->loc.filename = scanloc.filename; -+ t->loc.linnum = linnum; - t->value = TOKcomment; - return; - } - if (doDocComment && t->ptr[2] == '/') - getDocComment(t, lastLine == linnum); - p = end; -+ t->loc = scanloc; - t->value = TOKeof; - return; - -@@ -827,7 +807,9 @@ void Lexer::scan(Token *t) - if (commentToken) - { - p++; -- loc.linnum++; -+ scanloc.linnum++; -+ t->loc.filename = scanloc.filename; -+ t->loc.linnum = linnum; - t->value = TOKcomment; - return; - } -@@ -835,17 +817,17 @@ void Lexer::scan(Token *t) - getDocComment(t, lastLine == linnum); - - p++; -- loc.linnum++; -+ scanloc.linnum++; - continue; - - case '+': - { int nest; - -- linnum = loc.linnum; -+ linnum = scanloc.linnum; - p++; - nest = 1; - while (1) -- { unsigned char c = *p; -+ { utf8_t c = *p; - switch (c) - { - case '/': -@@ -870,11 +852,11 @@ void Lexer::scan(Token *t) - case '\r': - p++; - if (*p != '\n') -- loc.linnum++; -+ scanloc.linnum++; - continue; - - case '\n': -- loc.linnum++; -+ scanloc.linnum++; - p++; - continue; - -@@ -882,6 +864,7 @@ void Lexer::scan(Token *t) - case 0x1A: - error("unterminated /+ +/ comment"); - p = end; -+ t->loc = scanloc; - t->value = TOKeof; - return; - -@@ -889,7 +872,7 @@ void Lexer::scan(Token *t) - if (c & 0x80) - { unsigned u = decodeUTF(); - if (u == PS || u == LS) -- loc.linnum++; -+ scanloc.linnum++; - } - p++; - continue; -@@ -898,6 +881,8 @@ void Lexer::scan(Token *t) - } - if (commentToken) - { -+ t->loc.filename = scanloc.filename; -+ t->loc.linnum = linnum; - t->value = TOKcomment; - return; - } -@@ -907,6 +892,8 @@ void Lexer::scan(Token *t) - } - continue; - } -+ default: -+ break; - } - t->value = TOKdiv; - return; -@@ -1057,12 +1044,7 @@ void Lexer::scan(Token *t) - p++; - if (*p == '=') - { p++; -- if (*p == '=' && global.params.Dversion == 1) -- { p++; -- t->value = TOKnotidentity; // !== -- } -- else -- t->value = TOKnotequal; // != -+ t->value = TOKnotequal; // != - } - else if (*p == '<') - { p++; -@@ -1099,12 +1081,7 @@ void Lexer::scan(Token *t) - p++; - if (*p == '=') - { p++; -- if (*p == '=' && global.params.Dversion == 1) -- { p++; -- t->value = TOKidentity; // === -- } -- else -- t->value = TOKequal; // == -+ t->value = TOKequal; // == - } - #if DMDV2 - else if (*p == '>') -@@ -1212,7 +1189,7 @@ void Lexer::scan(Token *t) - - if (c == PS || c == LS) - { -- loc.linnum++; -+ scanloc.linnum++; - p++; - continue; - } -@@ -1303,7 +1280,7 @@ unsigned Lexer::escapeSequence() - break; - - case '&': // named character entity -- for (unsigned char *idstart = ++p; 1; p++) -+ for (utf8_t *idstart = ++p; 1; p++) - { - switch (*p) - { -@@ -1358,8 +1335,9 @@ unsigned Lexer::escapeSequence() - */ - - TOK Lexer::wysiwygStringConstant(Token *t, int tc) --{ unsigned c; -- Loc start = loc; -+{ -+ unsigned c; -+ Loc start = scanloc; - - p++; - stringbuffer.reset(); -@@ -1369,20 +1347,20 @@ TOK Lexer::wysiwygStringConstant(Token * - switch (c) - { - case '\n': -- loc.linnum++; -+ scanloc.linnum++; - break; - - case '\r': - if (*p == '\n') - continue; // ignore - c = '\n'; // treat EndOfLine as \n character -- loc.linnum++; -+ scanloc.linnum++; - break; - - case 0: - case 0x1A: - error("unterminated string constant starting at %s", start.toChars()); -- t->ustring = (unsigned char *)""; -+ t->ustring = (utf8_t *)""; - t->len = 0; - t->postfix = 0; - return TOKstring; -@@ -1393,7 +1371,7 @@ TOK Lexer::wysiwygStringConstant(Token * - { - t->len = stringbuffer.offset; - stringbuffer.writeByte(0); -- t->ustring = (unsigned char *)mem.malloc(stringbuffer.offset); -+ t->ustring = (utf8_t *)mem.malloc(stringbuffer.offset); - memcpy(t->ustring, stringbuffer.data, stringbuffer.offset); - stringPostfix(t); - return TOKstring; -@@ -1406,7 +1384,7 @@ TOK Lexer::wysiwygStringConstant(Token * - unsigned u = decodeUTF(); - p++; - if (u == PS || u == LS) -- loc.linnum++; -+ scanloc.linnum++; - stringbuffer.writeUTF8(u); - continue; - } -@@ -1422,8 +1400,9 @@ TOK Lexer::wysiwygStringConstant(Token * - */ - - TOK Lexer::hexStringConstant(Token *t) --{ unsigned c; -- Loc start = loc; -+{ -+ unsigned c; -+ Loc start = scanloc; - unsigned n = 0; - unsigned v; - -@@ -1445,13 +1424,13 @@ TOK Lexer::hexStringConstant(Token *t) - continue; // ignore - // Treat isolated '\r' as if it were a '\n' - case '\n': -- loc.linnum++; -+ scanloc.linnum++; - continue; - - case 0: - case 0x1A: - error("unterminated string constant starting at %s", start.toChars()); -- t->ustring = (unsigned char *)""; -+ t->ustring = (utf8_t *)""; - t->len = 0; - t->postfix = 0; - return TOKstring; -@@ -1463,7 +1442,7 @@ TOK Lexer::hexStringConstant(Token *t) - } - t->len = stringbuffer.offset; - stringbuffer.writeByte(0); -- t->ustring = (unsigned char *)mem.malloc(stringbuffer.offset); -+ t->ustring = (utf8_t *)mem.malloc(stringbuffer.offset); - memcpy(t->ustring, stringbuffer.data, stringbuffer.offset); - stringPostfix(t); - return TOKstring; -@@ -1480,7 +1459,7 @@ TOK Lexer::hexStringConstant(Token *t) - unsigned u = decodeUTF(); - p++; - if (u == PS || u == LS) -- loc.linnum++; -+ scanloc.linnum++; - else - error("non-hex character \\u%04x", u); - } -@@ -1513,8 +1492,9 @@ TOK Lexer::hexStringConstant(Token *t) - */ - - TOK Lexer::delimitedStringConstant(Token *t) --{ unsigned c; -- Loc start = loc; -+{ -+ unsigned c; -+ Loc start = scanloc; - unsigned delimleft = 0; - unsigned delimright = 0; - unsigned nest = 1; -@@ -1533,7 +1513,7 @@ TOK Lexer::delimitedStringConstant(Token - { - case '\n': - Lnextline: -- loc.linnum++; -+ scanloc.linnum++; - startline = 1; - if (blankrol) - { blankrol = 0; -@@ -1628,7 +1608,7 @@ TOK Lexer::delimitedStringConstant(Token - #endif - ) - { Token t; -- unsigned char *psave = p; -+ utf8_t *psave = p; - p--; - scan(&t); // read in possible heredoc identifier - //printf("endid = '%s'\n", t.ident->toChars()); -@@ -1651,14 +1631,14 @@ Ldone: - error("delimited string must end in %c\"", delimright); - t->len = stringbuffer.offset; - stringbuffer.writeByte(0); -- t->ustring = (unsigned char *)mem.malloc(stringbuffer.offset); -+ t->ustring = (utf8_t *)mem.malloc(stringbuffer.offset); - memcpy(t->ustring, stringbuffer.data, stringbuffer.offset); - stringPostfix(t); - return TOKstring; - - Lerror: - error("unterminated string constant starting at %s", start.toChars()); -- t->ustring = (unsigned char *)""; -+ t->ustring = (utf8_t *)""; - t->len = 0; - t->postfix = 0; - return TOKstring; -@@ -1676,8 +1656,8 @@ Lerror: - TOK Lexer::tokenStringConstant(Token *t) - { - unsigned nest = 1; -- Loc start = loc; -- unsigned char *pstart = ++p; -+ Loc start = scanloc; -+ utf8_t *pstart = ++p; - - while (1) - { Token tok; -@@ -1704,7 +1684,7 @@ TOK Lexer::tokenStringConstant(Token *t) - - Ldone: - t->len = p - 1 - pstart; -- t->ustring = (unsigned char *)mem.malloc(t->len + 1); -+ t->ustring = (utf8_t *)mem.malloc(t->len + 1); - memcpy(t->ustring, pstart, t->len); - t->ustring[t->len] = 0; - stringPostfix(t); -@@ -1712,7 +1692,7 @@ Ldone: - - Lerror: - error("unterminated token string constant starting at %s", start.toChars()); -- t->ustring = (unsigned char *)""; -+ t->ustring = (utf8_t *)""; - t->len = 0; - t->postfix = 0; - return TOKstring; -@@ -1725,8 +1705,9 @@ Lerror: - */ - - TOK Lexer::escapeStringConstant(Token *t, int wide) --{ unsigned c; -- Loc start = loc; -+{ -+ unsigned c; -+ Loc start = scanloc; - - p++; - stringbuffer.reset(); -@@ -1753,20 +1734,20 @@ TOK Lexer::escapeStringConstant(Token *t - break; - #endif - case '\n': -- loc.linnum++; -+ scanloc.linnum++; - break; - - case '\r': - if (*p == '\n') - continue; // ignore - c = '\n'; // treat EndOfLine as \n character -- loc.linnum++; -+ scanloc.linnum++; - break; - - case '"': - t->len = stringbuffer.offset; - stringbuffer.writeByte(0); -- t->ustring = (unsigned char *)mem.malloc(stringbuffer.offset); -+ t->ustring = (utf8_t *)mem.malloc(stringbuffer.offset); - memcpy(t->ustring, stringbuffer.data, stringbuffer.offset); - stringPostfix(t); - return TOKstring; -@@ -1775,7 +1756,7 @@ TOK Lexer::escapeStringConstant(Token *t - case 0x1A: - p--; - error("unterminated string constant starting at %s", start.toChars()); -- t->ustring = (unsigned char *)""; -+ t->ustring = (utf8_t *)""; - t->len = 0; - t->postfix = 0; - return TOKstring; -@@ -1787,7 +1768,7 @@ TOK Lexer::escapeStringConstant(Token *t - c = decodeUTF(); - if (c == LS || c == PS) - { c = '\n'; -- loc.linnum++; -+ scanloc.linnum++; - } - p++; - stringbuffer.writeUTF8(c); -@@ -1835,7 +1816,7 @@ TOK Lexer::charConstant(Token *t, int wi - #endif - case '\n': - L1: -- loc.linnum++; -+ scanloc.linnum++; - case '\r': - case 0: - case 0x1A: -@@ -1906,17 +1887,19 @@ TOK Lexer::number(Token *t) - enum STATE { STATE_initial, STATE_0, STATE_decimal, STATE_octal, STATE_octale, - STATE_hex, STATE_binary, STATE_hex0, STATE_binary0, - STATE_hexh, STATE_error }; -- enum STATE state; -+ STATE state; - - enum FLAGS -- { FLAGS_decimal = 1, // decimal -+ { -+ FLAGS_none = 0, -+ FLAGS_decimal = 1, // decimal - FLAGS_unsigned = 2, // u or U suffix - FLAGS_long = 4, // l or L suffix - }; -- enum FLAGS flags = FLAGS_decimal; -+ FLAGS flags = FLAGS_decimal; - - unsigned c; -- unsigned char *start; -+ utf8_t *start; - TOK result; - - //printf("Lexer::number()\n"); -@@ -2106,7 +2089,7 @@ done: - p += 2, r = 16; - else if (p[1] == 'b' || p[1] == 'B') - p += 2, r = 2; -- else if (isdigit((unsigned char)p[1])) -+ else if (isdigit((utf8_t)p[1])) - p += 1, r = 8; - } - -@@ -2141,9 +2124,9 @@ done: - } - - // Parse trailing 'u', 'U', 'l' or 'L' in any combination -- const unsigned char *psuffix = p; -+ const utf8_t *psuffix = p; - while (1) -- { unsigned char f; -+ { utf8_t f; - - switch (*p) - { case 'U': -@@ -2173,7 +2156,7 @@ done: - - switch (flags) - { -- case 0: -+ case FLAGS_none: - /* Octal or Hexadecimal constant. - * First that fits: int, uint, long, ulong - */ -@@ -2356,47 +2339,25 @@ done: - - stringbuffer.writeByte(0); - --#if _WIN32 && __DMC__ -- char *save = __locale_decpoint; -- __locale_decpoint = "."; --#endif --#ifdef IN_GCC -- t->float80value = real_t::parse((char *)stringbuffer.data, real_t::LongDouble); --#else -- t->float80value = strtold((char *)stringbuffer.data, NULL); --#endif -+ t->float80value = Port::strtold((char *)stringbuffer.data, NULL); - errno = 0; - switch (*p) - { - case 'F': - case 'f': --#ifdef IN_GCC -- real_t::parse((char *)stringbuffer.data, real_t::Float); --#else -- { // Only interested in errno return -- double d = strtof((char *)stringbuffer.data, NULL); -- // Assign to d to keep gcc warnings at bay, -- // but then CppCheck complains that d is never used. -- } --#endif -+ // Only interested in errno return -+ (void)Port::strtof((char *)stringbuffer.data, NULL); - result = TOKfloat32v; - p++; - break; - - default: --#ifdef IN_GCC -- real_t::parse((char *)stringbuffer.data, real_t::Double); --#else - /* Should do our own strtod(), since dmc and linux gcc - * accept 2.22507e-308, while apple gcc will only take - * 2.22508e-308. Not sure who is right. - */ -- { // Only interested in errno return -- double d = strtod((char *)stringbuffer.data, NULL); -- // Assign to d to keep gcc warnings at bay -- // but then CppCheck complains that d is never used. -- } --#endif -+ // Only interested in errno return -+ (void)Port::strtod((char *)stringbuffer.data, NULL); - result = TOKfloat64v; - break; - -@@ -2426,9 +2387,6 @@ done: - default: break; - } - } --#if _WIN32 && __DMC__ -- __locale_decpoint = save; --#endif - if (errno == ERANGE) - error("number is not representable"); - return result; -@@ -2437,6 +2395,7 @@ done: - /********************************************* - * parse: - * #line linnum [filespec] -+ * also allow __LINE__ for linnum, and __FILE__ for filespec - */ - - void Lexer::poundLine() -@@ -2444,7 +2403,7 @@ void Lexer::poundLine() - Token tok; - int linnum; - char *filespec = NULL; -- Loc loc = this->loc; -+ Loc loc = this->scanloc; - - scan(&tok); - if (tok.value == TOKint32v || tok.value == TOKint64v) -@@ -2452,6 +2411,10 @@ void Lexer::poundLine() - if (linnum != tok.uns64value - 1) - error("line number out of range"); - } -+ else if (tok.value == TOKline) -+ { -+ linnum = this->scanloc.linnum; -+ } - else - goto Lerr; - -@@ -2463,9 +2426,9 @@ void Lexer::poundLine() - case 0x1A: - case '\n': - Lnewline: -- this->loc.linnum = linnum; -+ this->scanloc.linnum = linnum; - if (filespec) -- this->loc.filename = filespec; -+ this->scanloc.filename = filespec; - return; - - case '\r': -@@ -2487,7 +2450,7 @@ void Lexer::poundLine() - if (mod && memcmp(p, "__FILE__", 8) == 0) - { - p += 8; -- filespec = mem.strdup(loc.filename ? loc.filename : mod->ident->toChars()); -+ filespec = mem.strdup(scanloc.filename ? scanloc.filename : mod->ident->toChars()); - continue; - } - goto Lerr; -@@ -2553,8 +2516,8 @@ Lerr: - unsigned Lexer::decodeUTF() - { - dchar_t u; -- unsigned char c; -- unsigned char *s = p; -+ utf8_t c; -+ utf8_t *s = p; - size_t len; - size_t idx; - const char *msg; -@@ -2590,13 +2553,13 @@ void Lexer::getDocComment(Token *t, unsi - { - /* ct tells us which kind of comment it is: '/', '*', or '+' - */ -- unsigned char ct = t->ptr[2]; -+ utf8_t ct = t->ptr[2]; - - /* Start of comment text skips over / * *, / + +, or / / / - */ -- unsigned char *q = t->ptr + 3; // start of comment text -+ utf8_t *q = t->ptr + 3; // start of comment text - -- unsigned char *qend = p; -+ utf8_t *qend = p; - if (ct == '*' || ct == '+') - qend -= 2; - -@@ -2627,7 +2590,7 @@ void Lexer::getDocComment(Token *t, unsi - - for (; q < qend; q++) - { -- unsigned char c = *q; -+ utf8_t c = *q; - - switch (c) - { -@@ -2689,15 +2652,15 @@ void Lexer::getDocComment(Token *t, unsi - - // It's a line comment if the start of the doc comment comes - // after other non-whitespace on the same line. -- unsigned char** dc = (lineComment && anyToken) -+ utf8_t** dc = (lineComment && anyToken) - ? &t->lineComment - : &t->blockComment; - - // Combine with previous doc comment, if any - if (*dc) -- *dc = combineComments(*dc, (unsigned char *)buf.data); -+ *dc = combineComments(*dc, (utf8_t *)buf.data); - else -- *dc = (unsigned char *)buf.extractData(); -+ *dc = (utf8_t *)buf.extractData(); - } - - /******************************************** -@@ -2705,11 +2668,11 @@ void Lexer::getDocComment(Token *t, unsi - * separated by a newline. - */ - --unsigned char *Lexer::combineComments(unsigned char *c1, unsigned char *c2) -+utf8_t *Lexer::combineComments(utf8_t *c1, utf8_t *c2) - { - //printf("Lexer::combineComments('%s', '%s')\n", c1, c2); - -- unsigned char *c = c2; -+ utf8_t *c = c2; - - if (c1) - { c = c1; -@@ -2717,7 +2680,7 @@ unsigned char *Lexer::combineComments(un - { size_t len1 = strlen((char *)c1); - size_t len2 = strlen((char *)c2); - -- c = (unsigned char *)mem.malloc(len1 + 1 + len2 + 1); -+ c = (utf8_t *)mem.malloc(len1 + 1 + len2 + 1); - memcpy(c, c1, len1); - if (len1 && c1[len1 - 1] != '\n') - { c[len1] = '\n'; -@@ -2730,38 +2693,6 @@ unsigned char *Lexer::combineComments(un - return c; - } - --/******************************************* -- * Search actual location of current token -- * even when infinite look-ahead was done. -- */ --Loc Lexer::tokenLoc() --{ -- Loc result = this->loc; -- Token* last = &token; -- while (last->next) -- last = last->next; -- -- unsigned char* start = token.ptr; -- unsigned char* stop = last->ptr; -- -- for (unsigned char* p = start; p < stop; ++p) -- { -- switch (*p) -- { -- case '\n': -- result.linnum--; -- break; -- case '\r': -- if (p[1] != '\n') -- result.linnum--; -- break; -- default: -- break; -- } -- } -- return result; --} -- - /******************************************** - * Create an identifier in the string table. - */ -@@ -2774,7 +2705,7 @@ Identifier *Lexer::idPool(const char *s) - if (!id) - { - id = new Identifier(sv->toDchars(), TOKidentifier); -- sv->ptrvalue = id; -+ sv->ptrvalue = (char *)id; - } - return id; - } -@@ -2787,7 +2718,7 @@ Identifier *Lexer::uniqueId(const char * - { char buffer[32]; - size_t slen = strlen(s); - -- assert(slen + sizeof(num) * 3 + 1 <= sizeof(buffer)); -+ assert(slen + sizeof(num) * 3 + 1 <= sizeof(buffer) / sizeof(buffer[0])); - sprintf(buffer, "%s%d", s, num); - return idPool(buffer); - } -@@ -2803,7 +2734,7 @@ Identifier *Lexer::uniqueId(const char * - - struct Keyword - { const char *name; -- enum TOK value; -+ TOK value; - }; - - static Keyword keywords[] = -@@ -2926,13 +2857,15 @@ static Keyword keywords[] = - #if DMDV2 - { "pure", TOKpure }, - { "nothrow", TOKnothrow }, -- { "__thread", TOKtls }, - { "__gshared", TOKgshared }, - { "__traits", TOKtraits }, - { "__vector", TOKvector }, - { "__overloadset", TOKoverloadset }, - { "__FILE__", TOKfile }, - { "__LINE__", TOKline }, -+ { "__MODULE__", TOKmodulestring }, -+ { "__FUNCTION__", TOKfuncstring }, -+ { "__PRETTY_FUNCTION__", TOKprettyfunc }, - { "shared", TOKshared }, - { "immutable", TOKimmutable }, - #endif -@@ -2952,10 +2885,7 @@ void Lexer::initKeywords() - { - size_t nkeywords = sizeof(keywords) / sizeof(keywords[0]); - -- stringtable.init(6151); -- -- if (global.params.Dversion == 1) -- nkeywords -= 2; -+ stringtable._init(6151); - - cmtable_init(); - -@@ -2963,9 +2893,9 @@ void Lexer::initKeywords() - { - //printf("keyword[%d] = '%s'\n",u, keywords[u].name); - const char *s = keywords[u].name; -- enum TOK v = keywords[u].value; -+ TOK v = keywords[u].value; - StringValue *sv = stringtable.insert(s, strlen(s)); -- sv->ptrvalue = (void *) new Identifier(sv->toDchars(),v); -+ sv->ptrvalue = (char *)new Identifier(sv->toDchars(),v); - - //printf("tochars[%d] = '%s'\n",v, s); - Token::tochars[v] = s; -@@ -3098,8 +3028,8 @@ void unittest_lexer() - - /* Not much here, just trying things out. - */ -- const unsigned char text[] = "int"; -- Lexer lex1(NULL, (unsigned char *)text, 0, sizeof(text), 0, 0); -+ const utf8_t text[] = "int"; -+ Lexer lex1(NULL, (utf8_t *)text, 0, sizeof(text), 0, 0); - TOK tok; - tok = lex1.nextToken(); - //printf("tok == %s, %d, %d\n", Token::toChars(tok), tok, TOKint32); ---- a/src/gcc/d/dfrontend/lexer.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/lexer.h 2014-04-01 16:32:51.000000000 +0100 -@@ -19,8 +19,8 @@ - #include "mars.h" - - struct StringTable; --struct Identifier; --struct Module; -+class Identifier; -+class Module; - - /* Tokens: - ( ) -@@ -69,6 +69,8 @@ enum TOK - TOKnewanonclass, TOKcomment, - TOKarrayliteral, TOKassocarrayliteral, - TOKstructliteral, -+ TOKclassreference, -+ TOKthrownexception, - - // Operators - TOKlt, TOKgt, -@@ -161,10 +163,12 @@ enum TOK - TOKoverloadset, - TOKpure, - TOKnothrow, -- TOKtls, - TOKgshared, - TOKline, - TOKfile, -+ TOKmodulestring, -+ TOKfuncstring, -+ TOKprettyfunc, - TOKshared, - TOKat, - TOKpow, -@@ -222,10 +226,11 @@ enum TOK - struct Token - { - Token *next; -- unsigned char *ptr; // pointer to first character of this token within buffer -- enum TOK value; -- unsigned char *blockComment; // doc comment string prior to this token -- unsigned char *lineComment; // doc comment for previous token -+ Loc loc; -+ utf8_t *ptr; // pointer to first character of this token within buffer -+ TOK value; -+ utf8_t *blockComment; // doc comment string prior to this token -+ utf8_t *lineComment; // doc comment for previous token - union - { - // Integers -@@ -235,45 +240,41 @@ struct Token - d_uns64 uns64value; - - // Floats --#ifdef IN_GCC -- // real_t float80value; // can't use this in a union! --#else - d_float80 float80value; --#endif - - struct -- { unsigned char *ustring; // UTF8 string -+ { utf8_t *ustring; // UTF8 string - unsigned len; - unsigned char postfix; // 'c', 'w', 'd' - }; - - Identifier *ident; - }; --#ifdef IN_GCC -- real_t float80value; // can't use this in a union! --#endif - - static const char *tochars[TOKMAX]; - static void *operator new(size_t sz); - - Token() : next(NULL) {} - int isKeyword(); -+#ifdef DEBUG - void print(); -+#endif - const char *toChars(); -- static const char *toChars(enum TOK); -+ static const char *toChars(TOK); - }; - --struct Lexer -+class Lexer - { -+public: - static StringTable stringtable; - static OutBuffer stringbuffer; - static Token *freelist; - -- Loc loc; // for error messages -+ Loc scanloc; // for error messages - -- unsigned char *base; // pointer to start of buffer -- unsigned char *end; // past end of buffer -- unsigned char *p; // current character -+ utf8_t *base; // pointer to start of buffer -+ utf8_t *end; // past end of buffer -+ utf8_t *p; // current character - Token token; - Module *mod; - int doDocComment; // collect doc comment information -@@ -281,7 +282,7 @@ struct Lexer - int commentToken; // !=0 means comments are TOKcomment's - - Lexer(Module *mod, -- unsigned char *base, size_t begoffset, size_t endoffset, -+ utf8_t *base, size_t begoffset, size_t endoffset, - int doDocComment, int commentToken); - - static void initKeywords(); -@@ -305,7 +306,6 @@ struct Lexer - TOK escapeStringConstant(Token *t, int wide); - TOK charConstant(Token *t, int wide); - void stringPostfix(Token *t); -- unsigned wchar(unsigned u); - TOK number(Token *t); - TOK inreal(Token *t); - void error(const char *format, ...); -@@ -316,9 +316,7 @@ struct Lexer - void getDocComment(Token *t, unsigned lineComment); - - static int isValidIdentifier(char *p); -- static unsigned char *combineComments(unsigned char *c1, unsigned char *c2); -- -- Loc tokenLoc(); -+ static utf8_t *combineComments(utf8_t *c1, utf8_t *c2); - }; - - #endif /* DMD_LEXER_H */ ---- a/src/gcc/d/dfrontend/macro.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/macro.c 2014-04-01 16:32:51.000000000 +0100 -@@ -21,16 +21,16 @@ - - #include "macro.h" - --int isIdStart(unsigned char *p); --int isIdTail(unsigned char *p); --int utfStride(unsigned char *p); -+int isIdStart(utf8_t *p); -+int isIdTail(utf8_t *p); -+int utfStride(utf8_t *p); - --unsigned char *memdup(unsigned char *p, size_t len) -+utf8_t *memdup(utf8_t *p, size_t len) - { -- return (unsigned char *)memcpy(mem.malloc(len), p, len); -+ return (utf8_t *)memcpy(mem.malloc(len), p, len); - } - --Macro::Macro(unsigned char *name, size_t namelen, unsigned char *text, size_t textlen) -+Macro::Macro(utf8_t *name, size_t namelen, utf8_t *text, size_t textlen) - { - next = NULL; - -@@ -51,7 +51,7 @@ Macro::Macro(unsigned char *name, size_t - } - - --Macro *Macro::search(unsigned char *name, size_t namelen) -+Macro *Macro::search(utf8_t *name, size_t namelen) - { Macro *table; - - //printf("Macro::search(%.*s)\n", namelen, name); -@@ -67,7 +67,7 @@ Macro *Macro::search(unsigned char *name - return table; - } - --Macro *Macro::define(Macro **ptable, unsigned char *name, size_t namelen, unsigned char *text, size_t textlen) -+Macro *Macro::define(Macro **ptable, utf8_t *name, size_t namelen, utf8_t *text, size_t textlen) - { - //printf("Macro::define('%.*s' = '%.*s')\n", namelen, name, textlen, text); - -@@ -98,7 +98,7 @@ Macro *Macro::define(Macro **ptable, uns - * -1: get 2nd through end - */ - --size_t extractArgN(unsigned char *p, size_t end, unsigned char **pmarg, size_t *pmarglen, int n) -+size_t extractArgN(utf8_t *p, size_t end, utf8_t **pmarg, size_t *pmarglen, int n) - { - /* Scan forward for matching right parenthesis. - * Nest parentheses. -@@ -130,7 +130,7 @@ size_t extractArgN(unsigned char *p, siz - *pmarg = p + v; - - for (; v < end; v++) -- { unsigned char c = p[v]; -+ { utf8_t c = p[v]; - - switch (c) - { -@@ -238,7 +238,7 @@ size_t extractArgN(unsigned char *p, siz - */ - - void Macro::expand(OutBuffer *buf, size_t start, size_t *pend, -- unsigned char *arg, size_t arglen) -+ utf8_t *arg, size_t arglen) - { - #if 0 - printf("Macro::expand(buf[%d..%d], arg = '%.*s')\n", start, *pend, arglen, arg); -@@ -259,7 +259,7 @@ void Macro::expand(OutBuffer *buf, size_ - arg = memdup(arg, arglen); - for (size_t u = start; u + 1 < end; ) - { -- unsigned char *p = buf->data; // buf->data is not loop invariant -+ utf8_t *p = buf->data; // buf->data is not loop invariant - - /* Look for $0, but not $$0, and replace it with arg. - */ -@@ -273,10 +273,10 @@ void Macro::expand(OutBuffer *buf, size_ - continue; - } - -- unsigned char c = p[u + 1]; -+ utf8_t c = p[u + 1]; - int n = (c == '+') ? -1 : c - '0'; - -- unsigned char *marg; -+ utf8_t *marg; - size_t marglen; - extractArgN(arg, arglen, &marg, &marglen, n); - if (marglen == 0) -@@ -327,7 +327,7 @@ void Macro::expand(OutBuffer *buf, size_ - */ - for (size_t u = start; u + 4 < end; ) - { -- unsigned char *p = buf->data; // buf->data is not loop invariant -+ utf8_t *p = buf->data; // buf->data is not loop invariant - - /* A valid start of macro expansion is $(c, where c is - * an id start character, and not $$(c. -@@ -335,10 +335,10 @@ void Macro::expand(OutBuffer *buf, size_ - if (p[u] == '$' && p[u + 1] == '(' && isIdStart(p+u+2)) - { - //printf("\tfound macro start '%c'\n", p[u + 2]); -- unsigned char *name = p + u + 2; -+ utf8_t *name = p + u + 2; - size_t namelen = 0; - -- unsigned char *marg; -+ utf8_t *marg; - size_t marglen; - - size_t v; -@@ -346,7 +346,7 @@ void Macro::expand(OutBuffer *buf, size_ - * beginning of macro argument (marg). - */ - for (v = u + 2; v < end; v+=utfStride(p+v)) -- { unsigned char c = p[v]; -+ { utf8_t c = p[v]; - - if (!isIdTail(p+v)) - { // We've gone past the end of the macro name. ---- a/src/gcc/d/dfrontend/macro.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/macro.h 2014-04-01 16:32:51.000000000 +0100 -@@ -24,22 +24,22 @@ struct Macro - private: - Macro *next; // next in list - -- unsigned char *name; // macro name -+ utf8_t *name; // macro name - size_t namelen; // length of macro name - -- unsigned char *text; // macro replacement text -+ utf8_t *text; // macro replacement text - size_t textlen; // length of replacement text - - int inuse; // macro is in use (don't expand) - -- Macro(unsigned char *name, size_t namelen, unsigned char *text, size_t textlen); -- Macro *search(unsigned char *name, size_t namelen); -+ Macro(utf8_t *name, size_t namelen, utf8_t *text, size_t textlen); -+ Macro *search(utf8_t *name, size_t namelen); - - public: -- static Macro *define(Macro **ptable, unsigned char *name, size_t namelen, unsigned char *text, size_t textlen); -+ static Macro *define(Macro **ptable, utf8_t *name, size_t namelen, utf8_t *text, size_t textlen); - - void expand(OutBuffer *buf, size_t start, size_t *pend, -- unsigned char *arg, size_t arglen); -+ utf8_t *arg, size_t arglen); - }; - - #endif ---- a/src/gcc/d/dfrontend/mangle.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/mangle.c 2014-04-01 16:32:51.000000000 +0100 -@@ -46,7 +46,7 @@ char *mangle(Declaration *sthis, bool is - do - { - //printf("mangle: s = %p, '%s', parent = %p\n", s, s->toChars(), s->parent); -- if (s->ident) -+ if (s->getIdent()) - { - FuncDeclaration *fd = s->isFuncDeclaration(); - if (s != sthis && fd) -@@ -79,6 +79,17 @@ L1: - buf.writeByte(Type::needThisPrefix()); - if (isv && fd && (fd->inferRetType || getFuncTemplateDecl(fd))) - { -+#if DDMD -+ TypeFunction *tfn = (TypeFunction *)sthis->type->copy(); -+ TypeFunction *tfo = (TypeFunction *)sthis->originalType; -+ tfn->purity = tfo->purity; -+ tfn->isnothrow = tfo->isnothrow; -+ tfn->isproperty = tfo->isproperty; -+ tfn->isref = fd->storage_class & STCauto ? false : tfo->isref; -+ tfn->trust = tfo->trust; -+ tfn->next = NULL; // do not mangle return type -+ tfn->toDecoBuffer(&buf, 0); -+#else - TypeFunction tfn = *(TypeFunction *)sthis->type; - TypeFunction *tfo = (TypeFunction *)sthis->originalType; - tfn.purity = tfo->purity; -@@ -88,6 +99,7 @@ L1: - tfn.trust = tfo->trust; - tfn.next = NULL; // do not mangle return type - tfn.toDecoBuffer(&buf, 0); -+#endif - } - else if (sthis->type->deco) - buf.writestring(sthis->type->deco); -@@ -105,7 +117,7 @@ L1: - return id; - } - --char *Declaration::mangle(bool isv) -+const char *Declaration::mangle(bool isv) - #if __DMC__ - __out(result) - { -@@ -150,7 +162,7 @@ char *Declaration::mangle(bool isv) - return ident->toChars(); - - default: -- fprintf(stdmsg, "'%s', linkage = %d\n", toChars(), linkage); -+ fprintf(stderr, "'%s', linkage = %d\n", toChars(), linkage); - assert(0); - } - } -@@ -164,7 +176,49 @@ char *Declaration::mangle(bool isv) - return p; - } - --char *FuncDeclaration::mangle(bool isv) -+/****************************************************************************** -+ * Normally FuncDeclaration and FuncAliasDeclaration have overloads. -+ * If and only if there is no overloads, mangle() could return -+ * exact mangled name. -+ * -+ * module test; -+ * void foo(long) {} // _D4test3fooFlZv -+ * void foo(string) {} // _D4test3fooFAyaZv -+ * -+ * // from FuncDeclaration::mangle(). -+ * pragma(msg, foo.mangleof); // prints unexact mangled name "4test3foo" -+ * // by calling Dsymbol::mangle() -+ * -+ * // from FuncAliasDeclaration::mangle() -+ * pragma(msg, __traits(getOverloads, test, "foo")[0].mangleof); // "_D4test3fooFlZv" -+ * pragma(msg, __traits(getOverloads, test, "foo")[1].mangleof); // "_D4test3fooFAyaZv" -+ * -+ * If a function has no overloads, .mangleof property still returns exact mangled name. -+ * -+ * void bar() {} -+ * pragma(msg, bar.mangleof); // still prints "_D4test3barFZv" -+ * // by calling FuncDeclaration::mangleExact(). -+ */ -+const char *FuncDeclaration::mangle(bool isv) -+{ -+ return isUnique() ? mangleExact(isv) : Dsymbol::mangle(isv); -+} -+// ditto -+const char *FuncAliasDeclaration::mangle(bool isv) -+{ -+ FuncDeclaration *f = toAliasFunc(); -+ FuncAliasDeclaration *fa = f->isFuncAliasDeclaration(); -+ if (!hasOverloads && !fa) -+ return f->mangleExact(isv); -+ if (fa) -+ return fa->mangle(isv); -+ return Dsymbol::mangle(isv); -+} -+ -+/****************************************************************************** -+ * Returns exact mangled name of function. -+ */ -+const char *FuncDeclaration::mangleExact(bool isv) - #if __DMC__ - __out(result) - { -@@ -173,6 +227,11 @@ char *FuncDeclaration::mangle(bool isv) - __body - #endif - { -+ assert(!isFuncAliasDeclaration()); -+ -+ if (mangleOverride) -+ return mangleOverride; -+ - if (isMain()) - return (char *)"_Dmain"; - -@@ -183,22 +242,36 @@ char *FuncDeclaration::mangle(bool isv) - return Declaration::mangle(isv); - } - -+const char *VarDeclaration::mangle(bool isv) -+#if __DMC__ -+ __out(result) -+ { -+ assert(strlen(result) > 0); -+ } -+ __body -+#endif -+ { -+ if (mangleOverride) -+ return mangleOverride; -+ -+ return Declaration::mangle(); -+ } - --char *TypedefDeclaration::mangle(bool isv) -+const char *TypedefDeclaration::mangle(bool isv) - { - //printf("TypedefDeclaration::mangle() '%s'\n", toChars()); - return Dsymbol::mangle(isv); - } - - --char *AggregateDeclaration::mangle(bool isv) -+const char *AggregateDeclaration::mangle(bool isv) - { - #if 1 - //printf("AggregateDeclaration::mangle() '%s'\n", toChars()); - if (Dsymbol *p = toParent2()) - { if (FuncDeclaration *fd = p->isFuncDeclaration()) - { // This might be the Voldemort Type -- char *id = Dsymbol::mangle(fd->inferRetType || getFuncTemplateDecl(fd)); -+ const char *id = Dsymbol::mangle(fd->inferRetType || getFuncTemplateDecl(fd)); - //printf("isv ad %s, %s\n", toChars(), id); - return id; - } -@@ -207,13 +280,13 @@ char *AggregateDeclaration::mangle(bool - return Dsymbol::mangle(isv); - } - --char *StructDeclaration::mangle(bool isv) -+const char *StructDeclaration::mangle(bool isv) - { - //printf("StructDeclaration::mangle() '%s'\n", toChars()); - return AggregateDeclaration::mangle(isv); - } - --char *ClassDeclaration::mangle(bool isv) -+const char *ClassDeclaration::mangle(bool isv) - { - Dsymbol *parentsave = parent; - -@@ -233,19 +306,19 @@ char *ClassDeclaration::mangle(bool isv) - ident == Id::TypeInfo_Typedef || - ident == Id::TypeInfo_Tuple || - this == object || -- this == classinfo || -+ this == Type::typeinfoclass || - this == Module::moduleinfo || - memcmp(ident->toChars(), "TypeInfo_", 9) == 0 - ) - parent = NULL; - -- char *id = AggregateDeclaration::mangle(isv); -+ const char *id = AggregateDeclaration::mangle(isv); - parent = parentsave; - return id; - } - - --char *TemplateInstance::mangle(bool isv) -+const char *TemplateInstance::mangle(bool isv) - { - OutBuffer buf; - -@@ -255,15 +328,16 @@ char *TemplateInstance::mangle(bool isv) - printf(" parent = %s %s", parent->kind(), parent->toChars()); - printf("\n"); - #endif -- char *id = ident ? ident->toChars() : toChars(); -+ getIdent(); -+ const char *id = ident ? ident->toChars() : toChars(); - if (!tempdecl) - error("is not defined"); - else - { -- Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; -+ Dsymbol *par = enclosing || isTemplateMixin() ? parent : tempdecl->parent; - if (par) - { -- char *p = par->mangle(); -+ const char *p = par->mangle(isv); - if (p[0] == '_' && p[1] == 'D') - p += 2; - buf.writestring(p); -@@ -278,7 +352,7 @@ char *TemplateInstance::mangle(bool isv) - - - --char *Dsymbol::mangle(bool isv) -+const char *Dsymbol::mangle(bool isv) - { - OutBuffer buf; - char *id; -@@ -292,7 +366,8 @@ char *Dsymbol::mangle(bool isv) - id = ident ? ident->toChars() : toChars(); - if (parent) - { -- char *p = parent->mangle(isv); -+ FuncDeclaration *f = parent->isFuncDeclaration(); -+ const char *p = f ? f->mangleExact(isv) : parent->mangle(isv); - if (p[0] == '_' && p[1] == 'D') - p += 2; - buf.writestring(p); ---- a/src/gcc/d/dfrontend/mars.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/mars.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,1744 +0,0 @@ -- --// Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars --// All Rights Reserved --// written by Walter Bright --// http://www.digitalmars.com --// https://github.com/D-Programming-Language/dmd/blob/master/src/mars.c --// License for redistribution is by either the Artistic License --// in artistic.txt, or the GNU General Public License in gnu.txt. --// See the included readme.txt for details. -- --#include <stdio.h> --#include <stdlib.h> --#include <ctype.h> --#include <assert.h> --#include <limits.h> --#include <string.h> -- --#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun --#include <errno.h> --#endif -- --#include "rmem.h" --#include "root.h" --#include "async.h" -- --#include "mars.h" --#include "module.h" --#include "mtype.h" --#include "id.h" --#include "cond.h" --#include "expression.h" --#include "lexer.h" --#ifndef IN_GCC --#include "lib.h" --#include "json.h" -- --#if WINDOWS_SEH --#include <windows.h> --long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep); --#endif --#endif -- -- --int response_expand(size_t *pargc, char ***pargv); --void browse(const char *url); --void getenv_setargv(const char *envvar, size_t *pargc, char** *pargv); -- --void obj_start(char *srcfile); --void obj_end(Library *library, File *objfile); -- --void printCtfePerformanceStats(); -- --static bool parse_arch(size_t argc, char** argv, bool is64bit); -- --Global global; -- --Global::Global() --{ -- mars_ext = "d"; -- sym_ext = "d"; -- hdr_ext = "di"; -- doc_ext = "html"; -- ddoc_ext = "ddoc"; -- json_ext = "json"; -- map_ext = "map"; -- --#ifndef IN_GCC --#if TARGET_WINDOS -- obj_ext = "obj"; --#elif TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- obj_ext = "o"; --#else --#error "fix this" --#endif --#else -- obj_ext = "o"; --#endif -- --#ifndef IN_GCC --#if TARGET_WINDOS -- lib_ext = "lib"; --#elif TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- lib_ext = "a"; --#else --#error "fix this" --#endif --#else -- lib_ext = "a"; --#endif -- --#ifndef IN_GCC --#if TARGET_WINDOS -- dll_ext = "dll"; --#elif TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- dll_ext = "so"; --#elif TARGET_OSX -- dll_ext = "dylib"; --#else --#error "fix this" --#endif --#else -- dll_ext = "so"; --#endif -- -- copyright = "Copyright (c) 1999-2012 by Digital Mars"; -- written = "written by Walter Bright"; -- version = "v" --#include "verstr.h" -- ; -- -- global.structalign = STRUCTALIGN_DEFAULT; -- -- memset(¶ms, 0, sizeof(Param)); --} -- --unsigned Global::startGagging() --{ -- ++gag; -- return gaggedErrors; --} -- --bool Global::endGagging(unsigned oldGagged) --{ -- bool anyErrs = (gaggedErrors != oldGagged); -- --gag; -- // Restore the original state of gagged errors; set total errors -- // to be original errors + new ungagged errors. -- errors -= (gaggedErrors - oldGagged); -- gaggedErrors = oldGagged; -- return anyErrs; --} -- --bool Global::isSpeculativeGagging() --{ -- return gag && gag == speculativeGag; --} -- -- --char *Loc::toChars() --{ -- OutBuffer buf; -- -- if (filename) -- { -- buf.printf("%s", filename); -- } -- -- if (linnum) --#ifndef IN_GCC -- buf.printf("(%d)", linnum); --#else -- buf.printf(":%u", linnum); --#endif -- buf.writeByte(0); -- return (char *)buf.extractData(); --} -- --Loc::Loc(Module *mod, unsigned linnum) --{ -- this->linnum = linnum; -- this->filename = mod ? mod->srcfile->toChars() : NULL; --} -- --bool Loc::equals(const Loc& loc) --{ -- return linnum == loc.linnum && FileName::equals(filename, loc.filename); --} -- --/************************************** -- * Print error message -- */ -- --void error(Loc loc, const char *format, ...) --{ -- va_list ap; -- va_start(ap, format); -- verror(loc, format, ap); -- va_end( ap ); --} -- --void error(const char *filename, unsigned linnum, const char *format, ...) --{ Loc loc; -- loc.filename = (char *)filename; -- loc.linnum = linnum; -- va_list ap; -- va_start(ap, format); -- verror(loc, format, ap); -- va_end( ap ); --} -- --void warning(Loc loc, const char *format, ...) --{ -- va_list ap; -- va_start(ap, format); -- vwarning(loc, format, ap); -- va_end( ap ); --} -- --/************************************** -- * Print supplementary message about the last error -- * Used for backtraces, etc -- */ --void errorSupplemental(Loc loc, const char *format, ...) --{ -- va_list ap; -- va_start(ap, format); -- verrorSupplemental(loc, format, ap); -- va_end( ap ); --} -- --void deprecation(Loc loc, const char *format, ...) --{ -- va_list ap; -- va_start(ap, format); -- vdeprecation(loc, format, ap); -- -- va_end( ap ); --} -- --// Just print, doesn't care about gagging --void verrorPrint(Loc loc, const char *header, const char *format, va_list ap, -- const char *p1, const char *p2) --{ -- char *p = loc.toChars(); -- -- if (*p) -- fprintf(stdmsg, "%s: ", p); -- mem.free(p); -- -- fputs(header, stdmsg); -- if (p1) -- fprintf(stdmsg, "%s ", p1); -- if (p2) -- fprintf(stdmsg, "%s ", p2); --#if _MSC_VER -- // MS doesn't recognize %zu format -- OutBuffer tmp; -- tmp.vprintf(format, ap); -- fprintf(stdmsg, "%s", tmp.toChars()); --#else -- vfprintf(stdmsg, format, ap); --#endif -- fprintf(stdmsg, "\n"); -- fflush(stdmsg); --} -- --// header is "Error: " by default (see mars.h) --void verror(Loc loc, const char *format, va_list ap, -- const char *p1, const char *p2, const char *header) --{ -- if (!global.gag) -- { -- verrorPrint(loc, header, format, ap, p1, p2); -- if (global.errors >= 20) // moderate blizzard of cascading messages -- fatal(); --//halt(); -- } -- else -- { -- global.gaggedErrors++; -- } -- global.errors++; --} -- --// Doesn't increase error count, doesn't print "Error:". --void verrorSupplemental(Loc loc, const char *format, va_list ap) --{ -- if (!global.gag) -- verrorPrint(loc, " ", format, ap); --} -- --void vwarning(Loc loc, const char *format, va_list ap) --{ -- if (global.params.warnings && !global.gag) -- { -- verrorPrint(loc, "Warning: ", format, ap); --//halt(); -- if (global.params.warnings == 1) -- global.warnings++; // warnings don't count if gagged -- } --} -- --void vdeprecation(Loc loc, const char *format, va_list ap, -- const char *p1, const char *p2) --{ -- static const char *header = "Deprecation: "; -- if (global.params.useDeprecated == 0) -- verror(loc, format, ap, p1, p2, header); -- else if (global.params.useDeprecated == 2 && !global.gag) -- verrorPrint(loc, header, format, ap, p1, p2); --} -- --/*************************************** -- * Call this after printing out fatal error messages to clean up and exit -- * the compiler. -- */ -- --void fatal() --{ --#if 0 -- halt(); --#endif -- exit(EXIT_FAILURE); --} -- --/************************************** -- * Try to stop forgetting to remove the breakpoints from -- * release builds. -- */ --void halt() --{ --#ifdef DEBUG -- *(volatile char*)0=0; --#endif --} -- --#ifndef IN_GCC -- --extern void backend_init(); --extern void backend_term(); -- --void usage() --{ --#if TARGET_LINUX -- const char fpic[] ="\ -- -fPIC generate position independent code\n\ --"; --#else -- const char fpic[] = ""; --#endif -- printf("DMD%d D Compiler %s\n%s %s\n", -- sizeof(size_t) * 8, -- global.version, global.copyright, global.written); -- printf("\ --Documentation: http://dlang.org/\n\ --Usage:\n\ -- dmd files.d ... { -switch }\n\ --\n\ -- files.d D source files\n\ -- @cmdfile read arguments from cmdfile\n\ -- -c do not link\n\ -- -cov do code coverage analysis\n\ -- -D generate documentation\n\ -- -Dddocdir write documentation file to docdir directory\n\ -- -Dffilename write documentation file to filename\n\ -- -d silently allow deprecated features\n\ -- -dw show use of deprecated features as warnings (default)\n\ -- -de show use of deprecated features as errors (halt compilation)\n\ -- -debug compile in debug code\n\ -- -debug=level compile in debug code <= level\n\ -- -debug=ident compile in debug code identified by ident\n\ -- -debuglib=name set symbolic debug library to name\n\ -- -defaultlib=name set default library to name\n\ -- -deps=filename write module dependencies to filename\n%s" --" -g add symbolic debug info\n\ -- -gc add symbolic debug info, pretend to be C\n\ -- -gs always emit stack frame\n\ -- -gx add stack stomp code\n\ -- -H generate 'header' file\n\ -- -Hddirectory write 'header' file to directory\n\ -- -Hffilename write 'header' file to filename\n\ -- --help print help\n\ -- -Ipath where to look for imports\n\ -- -ignore ignore unsupported pragmas\n\ -- -inline do function inlining\n\ -- -Jpath where to look for string imports\n\ -- -Llinkerflag pass linkerflag to link\n\ -- -lib generate library rather than object files\n" --#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS --" -m32 generate 32 bit code\n\ -- -m64 generate 64 bit code\n" --#endif --" -man open web browser on manual page\n\ -- -map generate linker .map file\n\ -- -noboundscheck turns off array bounds checking for all functions\n\ -- -O optimize\n\ -- -o- do not write object file\n\ -- -odobjdir write object & library files to directory objdir\n\ -- -offilename name output file to filename\n\ -- -op do not strip paths from source file\n\ -- -profile profile runtime performance of generated code\n\ -- -property enforce property syntax\n\ -- -quiet suppress unnecessary messages\n\ -- -release compile release version\n\ -- -run srcfile args... run resulting program, passing args\n" --#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS --" -shared generate shared library\n" --#endif --" -unittest compile in unit tests\n\ -- -v verbose\n\ -- -version=level compile in version code >= level\n\ -- -version=ident compile in version code identified by ident\n\ -- -vtls list all variables going into thread local storage\n\ -- -w warnings as errors (compilation will halt)\n\ -- -wi warnings as messages (compilation will continue)\n\ -- -X generate JSON file\n\ -- -Xffilename write JSON file to filename\n\ --", fpic); --} -- --extern signed char tyalignsize[]; -- --#if _WIN32 && __DMC__ --extern "C" --{ -- extern int _xi_a; -- extern int _end; --} --#endif -- --int tryMain(size_t argc, char *argv[]) --{ -- mem.init(); // initialize storage allocator -- mem.setStackBottom(&argv); --#if _WIN32 && __DMC__ -- mem.addroots((char *)&_xi_a, (char *)&_end); --#endif -- -- Strings files; -- Strings libmodules; -- char *p; -- Module *m; -- size_t argcstart = argc; -- int setdebuglib = 0; -- char noboundscheck = 0; -- int setdefaultlib = 0; -- const char *inifilename = NULL; -- --#ifdef DEBUG -- printf("DMD %s DEBUG\n", global.version); --#endif -- -- unittests(); -- -- // Check for malformed input -- if (argc < 1 || !argv) -- { -- Largs: -- error(0, "missing or null command line arguments"); -- fatal(); -- } -- for (size_t i = 0; i < argc; i++) -- { -- if (!argv[i]) -- goto Largs; -- } -- -- if (response_expand(&argc,&argv)) // expand response files -- error(0, "can't open response file"); -- -- files.reserve(argc - 1); -- -- // Set default values -- global.params.argv0 = argv[0]; -- global.params.link = 1; -- global.params.useAssert = 1; -- global.params.useInvariants = 1; -- global.params.useIn = 1; -- global.params.useOut = 1; -- global.params.useArrayBounds = 2; // default to all functions -- global.params.useSwitchError = 1; -- global.params.useInline = 0; -- global.params.obj = 1; -- global.params.Dversion = 2; -- global.params.quiet = 1; -- global.params.useDeprecated = 2; -- -- global.params.linkswitches = new Strings(); -- global.params.libfiles = new Strings(); -- global.params.objfiles = new Strings(); -- global.params.ddocfiles = new Strings(); -- -- // Default to -m32 for 32 bit dmd, -m64 for 64 bit dmd -- global.params.is64bit = (sizeof(size_t) == 8); -- --#if TARGET_WINDOS -- global.params.is64bit = 0; -- global.params.defaultlibname = "phobos"; --#elif TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- global.params.defaultlibname = "phobos2"; --#else --#error "fix this" --#endif -- -- // Predefine version identifiers -- VersionCondition::addPredefinedGlobalIdent("DigitalMars"); -- --#if TARGET_WINDOS -- VersionCondition::addPredefinedGlobalIdent("Windows"); -- global.params.isWindows = 1; --#elif TARGET_LINUX -- VersionCondition::addPredefinedGlobalIdent("Posix"); -- VersionCondition::addPredefinedGlobalIdent("linux"); -- global.params.isLinux = 1; --#elif TARGET_OSX -- VersionCondition::addPredefinedGlobalIdent("Posix"); -- VersionCondition::addPredefinedGlobalIdent("OSX"); -- global.params.isOSX = 1; -- -- // For legacy compatibility -- VersionCondition::addPredefinedGlobalIdent("darwin"); --#elif TARGET_FREEBSD -- VersionCondition::addPredefinedGlobalIdent("Posix"); -- VersionCondition::addPredefinedGlobalIdent("FreeBSD"); -- global.params.isFreeBSD = 1; --#elif TARGET_OPENBSD -- VersionCondition::addPredefinedGlobalIdent("Posix"); -- VersionCondition::addPredefinedGlobalIdent("OpenBSD"); -- global.params.isFreeBSD = 1; --#elif TARGET_SOLARIS -- VersionCondition::addPredefinedGlobalIdent("Posix"); -- VersionCondition::addPredefinedGlobalIdent("Solaris"); -- global.params.isSolaris = 1; --#else --#error "fix this" --#endif -- -- VersionCondition::addPredefinedGlobalIdent("LittleEndian"); -- //VersionCondition::addPredefinedGlobalIdent("D_Bits"); --#if DMDV2 -- VersionCondition::addPredefinedGlobalIdent("D_Version2"); --#endif -- VersionCondition::addPredefinedGlobalIdent("all"); -- --#if _WIN32 -- inifilename = inifile(argv[0], "sc.ini", "Environment"); --#elif linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun -- inifilename = inifile(argv[0], "dmd.conf", "Environment"); --#else --#error "fix this" --#endif -- -- size_t dflags_argc = 0; -- char** dflags_argv = NULL; -- getenv_setargv("DFLAGS", &dflags_argc, &dflags_argv); -- -- bool is64bit = global.params.is64bit; // use default -- is64bit = parse_arch(argc, argv, is64bit); -- is64bit = parse_arch(dflags_argc, dflags_argv, is64bit); -- global.params.is64bit = is64bit; -- -- inifile(argv[0], inifilename, is64bit ? "Environment64" : "Environment32"); -- -- getenv_setargv("DFLAGS", &argc, &argv); -- --#if 0 -- for (size_t i = 0; i < argc; i++) -- { -- printf("argv[%d] = '%s'\n", i, argv[i]); -- } --#endif -- -- for (size_t i = 1; i < argc; i++) -- { -- p = argv[i]; -- if (*p == '-') -- { -- if (strcmp(p + 1, "de") == 0) -- global.params.useDeprecated = 0; -- else if (strcmp(p + 1, "d") == 0) -- global.params.useDeprecated = 1; -- else if (strcmp(p + 1, "dw") == 0) -- global.params.useDeprecated = 2; -- else if (strcmp(p + 1, "c") == 0) -- global.params.link = 0; -- else if (strcmp(p + 1, "cov") == 0) -- global.params.cov = 1; --#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- else if (strcmp(p + 1, "shared") == 0 --#if TARGET_OSX -- // backwards compatibility with old switch -- || strcmp(p + 1, "dylib") == 0 --#endif -- ) -- global.params.dll = 1; -- else if (strcmp(p + 1, "fPIC") == 0) -- global.params.pic = 1; --#endif -- else if (strcmp(p + 1, "map") == 0) -- global.params.map = 1; -- else if (strcmp(p + 1, "multiobj") == 0) -- global.params.multiobj = 1; -- else if (strcmp(p + 1, "g") == 0) -- global.params.symdebug = 1; -- else if (strcmp(p + 1, "gc") == 0) -- global.params.symdebug = 2; -- else if (strcmp(p + 1, "gs") == 0) -- global.params.alwaysframe = 1; -- else if (strcmp(p + 1, "gx") == 0) -- global.params.stackstomp = true; -- else if (strcmp(p + 1, "gt") == 0) -- { error(0, "use -profile instead of -gt"); -- global.params.trace = 1; -- } -- else if (strcmp(p + 1, "m32") == 0) -- global.params.is64bit = 0; -- else if (strcmp(p + 1, "m64") == 0) -- global.params.is64bit = 1; -- else if (strcmp(p + 1, "profile") == 0) -- global.params.trace = 1; -- else if (strcmp(p + 1, "v") == 0) -- global.params.verbose = 1; --#if DMDV2 -- else if (strcmp(p + 1, "vtls") == 0) -- global.params.vtls = 1; --#endif -- else if (strcmp(p + 1, "v1") == 0) -- { --#if DMDV1 -- global.params.Dversion = 1; --#else -- error(0, "use DMD 1.0 series compilers for -v1 switch"); -- break; --#endif -- } -- else if (strcmp(p + 1, "w") == 0) -- global.params.warnings = 1; -- else if (strcmp(p + 1, "wi") == 0) -- global.params.warnings = 2; -- else if (strcmp(p + 1, "O") == 0) -- global.params.optimize = 1; -- else if (p[1] == 'o') -- { -- switch (p[2]) -- { -- case '-': -- global.params.obj = 0; -- break; -- -- case 'd': -- if (!p[3]) -- goto Lnoarg; -- global.params.objdir = p + 3; -- break; -- -- case 'f': -- if (!p[3]) -- goto Lnoarg; -- global.params.objname = p + 3; -- break; -- -- case 'p': -- if (p[3]) -- goto Lerror; -- global.params.preservePaths = 1; -- break; -- -- case 0: -- error(0, "-o no longer supported, use -of or -od"); -- break; -- -- default: -- goto Lerror; -- } -- } -- else if (p[1] == 'D') -- { global.params.doDocComments = 1; -- switch (p[2]) -- { -- case 'd': -- if (!p[3]) -- goto Lnoarg; -- global.params.docdir = p + 3; -- break; -- case 'f': -- if (!p[3]) -- goto Lnoarg; -- global.params.docname = p + 3; -- break; -- -- case 0: -- break; -- -- default: -- goto Lerror; -- } -- } -- else if (p[1] == 'H') -- { global.params.doHdrGeneration = 1; -- switch (p[2]) -- { -- case 'd': -- if (!p[3]) -- goto Lnoarg; -- global.params.hdrdir = p + 3; -- break; -- -- case 'f': -- if (!p[3]) -- goto Lnoarg; -- global.params.hdrname = p + 3; -- break; -- -- case 0: -- break; -- -- default: -- goto Lerror; -- } -- } -- else if (p[1] == 'X') -- { global.params.doXGeneration = 1; -- switch (p[2]) -- { -- case 'f': -- if (!p[3]) -- goto Lnoarg; -- global.params.xfilename = p + 3; -- break; -- -- case 0: -- break; -- -- default: -- goto Lerror; -- } -- } -- else if (strcmp(p + 1, "ignore") == 0) -- global.params.ignoreUnsupportedPragmas = 1; -- else if (strcmp(p + 1, "property") == 0) -- global.params.enforcePropertySyntax = 1; -- else if (strcmp(p + 1, "inline") == 0) -- global.params.useInline = 1; -- else if (strcmp(p + 1, "lib") == 0) -- global.params.lib = 1; -- else if (strcmp(p + 1, "nofloat") == 0) -- global.params.nofloat = 1; -- else if (strcmp(p + 1, "quiet") == 0) -- global.params.quiet = 1; -- else if (strcmp(p + 1, "release") == 0) -- global.params.release = 1; -- else if (strcmp(p + 1, "betterC") == 0) -- global.params.betterC = 1; --#if DMDV2 -- else if (strcmp(p + 1, "noboundscheck") == 0) -- noboundscheck = 1; --#endif -- else if (strcmp(p + 1, "unittest") == 0) -- global.params.useUnitTests = 1; -- else if (p[1] == 'I') -- { -- if (!global.params.imppath) -- global.params.imppath = new Strings(); -- global.params.imppath->push(p + 2); -- } -- else if (p[1] == 'J') -- { -- if (!global.params.fileImppath) -- global.params.fileImppath = new Strings(); -- global.params.fileImppath->push(p + 2); -- } -- else if (memcmp(p + 1, "debug", 5) == 0 && p[6] != 'l') -- { -- // Parse: -- // -debug -- // -debug=number -- // -debug=identifier -- if (p[6] == '=') -- { -- if (isdigit((unsigned char)p[7])) -- { long level; -- -- errno = 0; -- level = strtol(p + 7, &p, 10); -- if (*p || errno || level > INT_MAX) -- goto Lerror; -- DebugCondition::setGlobalLevel((int)level); -- } -- else if (Lexer::isValidIdentifier(p + 7)) -- DebugCondition::addGlobalIdent(p + 7); -- else -- goto Lerror; -- } -- else if (p[6]) -- goto Lerror; -- else -- global.params.debuglevel = 1; -- } -- else if (memcmp(p + 1, "version", 7) == 0) -- { -- // Parse: -- // -version=number -- // -version=identifier -- if (p[8] == '=') -- { -- if (isdigit((unsigned char)p[9])) -- { long level; -- -- errno = 0; -- level = strtol(p + 9, &p, 10); -- if (*p || errno || level > INT_MAX) -- goto Lerror; -- VersionCondition::setGlobalLevel((int)level); -- } -- else if (Lexer::isValidIdentifier(p + 9)) -- VersionCondition::addGlobalIdent(p + 9); -- else -- goto Lerror; -- } -- else -- goto Lerror; -- } -- else if (strcmp(p + 1, "-b") == 0) -- global.params.debugb = 1; -- else if (strcmp(p + 1, "-c") == 0) -- global.params.debugc = 1; -- else if (strcmp(p + 1, "-f") == 0) -- global.params.debugf = 1; -- else if (strcmp(p + 1, "-help") == 0) -- { usage(); -- exit(EXIT_SUCCESS); -- } -- else if (strcmp(p + 1, "-r") == 0) -- global.params.debugr = 1; -- else if (strcmp(p + 1, "-x") == 0) -- global.params.debugx = 1; -- else if (strcmp(p + 1, "-y") == 0) -- global.params.debugy = 1; -- else if (p[1] == 'L') -- { -- global.params.linkswitches->push(p + 2); -- } -- else if (memcmp(p + 1, "defaultlib=", 11) == 0) -- { -- setdefaultlib = 1; -- global.params.defaultlibname = p + 1 + 11; -- } -- else if (memcmp(p + 1, "debuglib=", 9) == 0) -- { -- setdebuglib = 1; -- global.params.debuglibname = p + 1 + 9; -- } -- else if (memcmp(p + 1, "deps=", 5) == 0) -- { -- global.params.moduleDepsFile = p + 1 + 5; -- if (!global.params.moduleDepsFile[0]) -- goto Lnoarg; -- global.params.moduleDeps = new OutBuffer; -- } -- else if (memcmp(p + 1, "man", 3) == 0) -- { --#if _WIN32 --#if DMDV1 -- browse("http://www.digitalmars.com/d/1.0/dmd-windows.html"); --#else -- browse("http://dlang.org/dmd-windows.html"); --#endif --#endif --#if linux --#if DMDV1 -- browse("http://www.digitalmars.com/d/1.0/dmd-linux.html"); --#else -- browse("http://dlang.org/dmd-linux.html"); --#endif --#endif --#if __APPLE__ --#if DMDV1 -- browse("http://www.digitalmars.com/d/1.0/dmd-osx.html"); --#else -- browse("http://dlang.org/dmd-osx.html"); --#endif --#endif --#if __FreeBSD__ --#if DMDV1 -- browse("http://www.digitalmars.com/d/1.0/dmd-freebsd.html"); --#else -- browse("http://dlang.org/dmd-freebsd.html"); --#endif --#endif --#if __OpenBSD__ --#if DMDV1 -- browse("http://www.digitalmars.com/d/1.0/dmd-openbsd.html"); --#else -- browse("http://dlang.org/dmd-openbsd.html"); --#endif --#endif -- exit(EXIT_SUCCESS); -- } -- else if (strcmp(p + 1, "run") == 0) -- { global.params.run = 1; -- global.params.runargs_length = ((i >= argcstart) ? argc : argcstart) - i - 1; -- if (global.params.runargs_length) -- { -- const char *ext = FileName::ext(argv[i + 1]); -- if (ext && FileName::equals(ext, "d") == 0 -- && FileName::equals(ext, "di") == 0) -- { -- error(0, "-run must be followed by a source file, not '%s'", argv[i + 1]); -- break; -- } -- -- files.push(argv[i + 1]); -- global.params.runargs = &argv[i + 2]; -- i += global.params.runargs_length; -- global.params.runargs_length--; -- } -- else -- { global.params.run = 0; -- goto Lnoarg; -- } -- } -- else -- { -- Lerror: -- error(0, "unrecognized switch '%s'", argv[i]); -- continue; -- -- Lnoarg: -- error(0, "argument expected for switch '%s'", argv[i]); -- continue; -- } -- } -- else -- { --#if TARGET_WINDOS -- const char *ext = FileName::ext(p); -- if (ext && FileName::compare(ext, "exe") == 0) -- { -- global.params.objname = p; -- continue; -- } --#endif -- files.push(p); -- } -- } -- -- if(global.params.is64bit != is64bit) -- error(0, "the architecture must not be changed in the %s section of %s", -- is64bit ? "Environment64" : "Environment32", inifilename); -- -- if (global.errors) -- { -- fatal(); -- } -- if (files.dim == 0) -- { usage(); -- return EXIT_FAILURE; -- } -- -- if (!setdebuglib) -- global.params.debuglibname = global.params.defaultlibname; -- --#if TARGET_OSX -- global.params.pic = 1; --#endif -- --#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS -- if (global.params.lib && global.params.dll) -- error(0, "cannot mix -lib and -shared"); --#endif -- -- if (global.params.release) -- { global.params.useInvariants = 0; -- global.params.useIn = 0; -- global.params.useOut = 0; -- global.params.useAssert = 0; -- global.params.useArrayBounds = 1; -- global.params.useSwitchError = 0; -- } -- if (noboundscheck) -- global.params.useArrayBounds = 0; -- -- if (global.params.run) -- global.params.quiet = 1; -- -- if (global.params.useUnitTests) -- global.params.useAssert = 1; -- -- if (!global.params.obj || global.params.lib) -- global.params.link = 0; -- -- if (global.params.link) -- { -- global.params.exefile = global.params.objname; -- global.params.oneobj = 1; -- if (global.params.objname) -- { -- /* Use this to name the one object file with the same -- * name as the exe file. -- */ -- global.params.objname = const_cast<char *>(FileName::forceExt(global.params.objname, global.obj_ext)); -- -- /* If output directory is given, use that path rather than -- * the exe file path. -- */ -- if (global.params.objdir) -- { const char *name = FileName::name(global.params.objname); -- global.params.objname = (char *)FileName::combine(global.params.objdir, name); -- } -- } -- } -- else if (global.params.lib) -- { -- global.params.libname = global.params.objname; -- global.params.objname = NULL; -- -- // Haven't investigated handling these options with multiobj -- if (!global.params.cov && !global.params.trace --#if 0 && TARGET_WINDOS -- /* multiobj causes class/struct debug info to be attached to init-data, -- * but this will not be linked into the executable, so this info is lost. -- * Bugzilla 4014 -- */ -- && !global.params.symdebug --#endif -- ) -- global.params.multiobj = 1; -- } -- else if (global.params.run) -- { -- error(0, "flags conflict with -run"); -- fatal(); -- } -- else -- { -- if (global.params.objname && files.dim > 1) -- { -- global.params.oneobj = 1; -- //error("multiple source files, but only one .obj name"); -- //fatal(); -- } -- } -- if (global.params.is64bit) -- { -- VersionCondition::addPredefinedGlobalIdent("D_InlineAsm_X86_64"); -- VersionCondition::addPredefinedGlobalIdent("X86_64"); -- VersionCondition::addPredefinedGlobalIdent("D_LP64"); -- VersionCondition::addPredefinedGlobalIdent("D_SIMD"); --#if TARGET_WINDOS -- VersionCondition::addPredefinedGlobalIdent("Win64"); -- if (!setdefaultlib) -- { global.params.defaultlibname = "phobos64"; -- if (!setdebuglib) -- global.params.debuglibname = global.params.defaultlibname; -- } --#endif -- } -- else -- { -- VersionCondition::addPredefinedGlobalIdent("D_InlineAsm"); -- VersionCondition::addPredefinedGlobalIdent("D_InlineAsm_X86"); -- VersionCondition::addPredefinedGlobalIdent("X86"); --#if TARGET_OSX -- VersionCondition::addPredefinedGlobalIdent("D_SIMD"); --#endif --#if TARGET_WINDOS -- VersionCondition::addPredefinedGlobalIdent("Win32"); --#endif -- } -- if (global.params.doDocComments) -- VersionCondition::addPredefinedGlobalIdent("D_Ddoc"); -- if (global.params.cov) -- VersionCondition::addPredefinedGlobalIdent("D_Coverage"); -- if (global.params.pic) -- VersionCondition::addPredefinedGlobalIdent("D_PIC"); --#if DMDV2 -- if (global.params.useUnitTests) -- VersionCondition::addPredefinedGlobalIdent("unittest"); -- if (global.params.useAssert) -- VersionCondition::addPredefinedGlobalIdent("assert"); -- if (noboundscheck) -- VersionCondition::addPredefinedGlobalIdent("D_NoBoundsChecks"); --#endif -- -- VersionCondition::addPredefinedGlobalIdent("D_HardFloat"); -- -- // Initialization -- Type::init(); -- Id::initialize(); -- Module::init(); -- initPrecedence(); -- -- if (global.params.verbose) -- { printf("binary %s\n", argv[0]); -- printf("version %s\n", global.version); -- printf("config %s\n", inifilename ? inifilename : "(none)"); -- } -- -- //printf("%d source files\n",files.dim); -- -- // Build import search path -- if (global.params.imppath) -- { -- for (size_t i = 0; i < global.params.imppath->dim; i++) -- { -- char *path = (*global.params.imppath)[i]; -- Strings *a = FileName::splitPath(path); -- -- if (a) -- { -- if (!global.path) -- global.path = new Strings(); -- global.path->append(a); -- } -- } -- } -- -- // Build string import search path -- if (global.params.fileImppath) -- { -- for (size_t i = 0; i < global.params.fileImppath->dim; i++) -- { -- char *path = (*global.params.fileImppath)[i]; -- Strings *a = FileName::splitPath(path); -- -- if (a) -- { -- if (!global.filePath) -- global.filePath = new Strings(); -- global.filePath->append(a); -- } -- } -- } -- -- // Create Modules -- Modules modules; -- modules.reserve(files.dim); -- int firstmodule = 1; -- for (size_t i = 0; i < files.dim; i++) -- { -- const char *ext; -- char *name; -- -- p = files[i]; -- --#if _WIN32 -- // Convert / to \ so linker will work -- for (size_t j = 0; p[j]; j++) -- { -- if (p[j] == '/') -- p[j] = '\\'; -- } --#endif -- -- p = (char *)FileName::name(p); // strip path -- ext = FileName::ext(p); -- if (ext) -- { /* Deduce what to do with a file based on its extension -- */ -- if (FileName::equals(ext, global.obj_ext)) -- { -- global.params.objfiles->push(files[i]); -- libmodules.push(files[i]); -- continue; -- } -- -- if (FileName::equals(ext, global.lib_ext)) -- { -- global.params.libfiles->push(files[i]); -- libmodules.push(files[i]); -- continue; -- } -- -- if (strcmp(ext, global.ddoc_ext) == 0) -- { -- global.params.ddocfiles->push(files[i]); -- continue; -- } -- -- if (FileName::equals(ext, global.json_ext)) -- { -- global.params.doXGeneration = 1; -- global.params.xfilename = files[i]; -- continue; -- } -- -- if (FileName::equals(ext, global.map_ext)) -- { -- global.params.mapfile = files[i]; -- continue; -- } -- --#if TARGET_WINDOS -- if (FileName::equals(ext, "res")) -- { -- global.params.resfile = files[i]; -- continue; -- } -- -- if (FileName::equals(ext, "def")) -- { -- global.params.deffile = files[i]; -- continue; -- } -- -- if (FileName::equals(ext, "exe")) -- { -- assert(0); // should have already been handled -- } --#endif -- -- /* Examine extension to see if it is a valid -- * D source file extension -- */ -- if (FileName::equals(ext, global.mars_ext) || -- FileName::equals(ext, global.hdr_ext) || -- FileName::equals(ext, "dd")) -- { -- ext--; // skip onto '.' -- assert(*ext == '.'); -- name = (char *)mem.malloc((ext - p) + 1); -- memcpy(name, p, ext - p); -- name[ext - p] = 0; // strip extension -- -- if (name[0] == 0 || -- strcmp(name, "..") == 0 || -- strcmp(name, ".") == 0) -- { -- Linvalid: -- error(0, "invalid file name '%s'", files[i]); -- fatal(); -- } -- } -- else -- { error(0, "unrecognized file extension %s", ext); -- fatal(); -- } -- } -- else -- { name = p; -- if (!*name) -- goto Linvalid; -- } -- -- /* At this point, name is the D source file name stripped of -- * its path and extension. -- */ -- -- Identifier *id = Lexer::idPool(name); -- m = new Module(files[i], id, global.params.doDocComments, global.params.doHdrGeneration); -- modules.push(m); -- -- if (firstmodule) -- { global.params.objfiles->push((char *)m->objfile->name->str); -- firstmodule = 0; -- } -- } -- -- // Read files --#define ASYNCREAD 1 --#if ASYNCREAD -- // Multi threaded -- AsyncRead *aw = AsyncRead::create(modules.dim); -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- aw->addFile(m->srcfile); -- } -- aw->start(); --#else -- // Single threaded -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- m->read(0); -- } --#endif -- -- // Parse files -- bool anydocfiles = false; -- size_t filecount = modules.dim; -- for (size_t filei = 0, modi = 0; filei < filecount; filei++, modi++) -- { -- m = modules[modi]; -- if (global.params.verbose) -- printf("parse %s\n", m->toChars()); -- if (!Module::rootModule) -- Module::rootModule = m; -- m->importedFrom = m; -- if (!global.params.oneobj || modi == 0 || m->isDocFile) -- m->deleteObjFile(); --#if ASYNCREAD -- if (aw->read(filei)) -- { -- error(0, "cannot read file %s", m->srcfile->name->toChars()); -- fatal(); -- } --#endif -- m->parse(); -- if (m->isDocFile) -- { -- anydocfiles = true; -- m->gendocfile(); -- -- // Remove m from list of modules -- modules.remove(modi); -- modi--; -- -- // Remove m's object file from list of object files -- for (size_t j = 0; j < global.params.objfiles->dim; j++) -- { -- if (m->objfile->name->str == (*global.params.objfiles)[j]) -- { -- global.params.objfiles->remove(j); -- break; -- } -- } -- -- if (global.params.objfiles->dim == 0) -- global.params.link = 0; -- } -- } --#if ASYNCREAD -- AsyncRead::dispose(aw); --#endif -- -- if (anydocfiles && modules.dim && -- (global.params.oneobj || global.params.objname)) -- { -- error(0, "conflicting Ddoc and obj generation options"); -- fatal(); -- } -- if (global.errors) -- fatal(); -- if (global.params.doHdrGeneration) -- { -- /* Generate 'header' import files. -- * Since 'header' import files must be independent of command -- * line switches and what else is imported, they are generated -- * before any semantic analysis. -- */ -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("import %s\n", m->toChars()); -- m->genhdrfile(); -- } -- } -- if (global.errors) -- fatal(); -- -- // load all unconditional imports for better symbol resolving -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("importall %s\n", m->toChars()); -- m->importAll(0); -- } -- if (global.errors) -- fatal(); -- -- backend_init(); -- -- // Do semantic analysis -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("semantic %s\n", m->toChars()); -- m->semantic(); -- } -- if (global.errors) -- fatal(); -- -- Module::dprogress = 1; -- Module::runDeferredSemantic(); -- -- // Do pass 2 semantic analysis -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("semantic2 %s\n", m->toChars()); -- m->semantic2(); -- } -- if (global.errors) -- fatal(); -- -- // Do pass 3 semantic analysis -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("semantic3 %s\n", m->toChars()); -- m->semantic3(); -- } -- if (global.errors) -- fatal(); -- -- if (global.params.useInline) -- { -- /* The problem with useArrayBounds and useAssert is that the -- * module being linked to may not have generated them, so if -- * we inline functions from those modules, the symbols for them will -- * not be found at link time. -- * We must do this BEFORE generating the .deps file! -- */ -- if (!global.params.useArrayBounds && !global.params.useAssert) -- { -- // Do pass 3 semantic analysis on all imported modules, -- // since otherwise functions in them cannot be inlined -- for (size_t i = 0; i < Module::amodules.dim; i++) -- { -- m = Module::amodules[i]; -- if (global.params.verbose) -- printf("semantic3 %s\n", m->toChars()); -- m->semantic3(); -- } -- if (global.errors) -- fatal(); -- } -- } -- -- if (global.params.moduleDeps != NULL) -- { -- assert(global.params.moduleDepsFile != NULL); -- -- File deps(global.params.moduleDepsFile); -- OutBuffer* ob = global.params.moduleDeps; -- deps.setbuffer((void*)ob->data, ob->offset); -- deps.writev(); -- } -- -- // Scan for functions to inline -- if (global.params.useInline) -- { -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("inline scan %s\n", m->toChars()); -- m->inlineScan(); -- } -- } -- -- // Do not attempt to generate output files if errors or warnings occurred -- if (global.errors || global.warnings) -- fatal(); -- -- printCtfePerformanceStats(); -- -- Library *library = NULL; -- if (global.params.lib) -- { -- library = Library::factory(); -- library->setFilename(global.params.objdir, global.params.libname); -- -- // Add input object and input library files to output library -- for (size_t i = 0; i < libmodules.dim; i++) -- { -- char *p = libmodules[i]; -- library->addObject(p, NULL, 0); -- } -- } -- -- // Generate output files -- -- if (global.params.doXGeneration) -- { -- OutBuffer buf; -- json_generate(&buf, &modules); -- -- // Write buf to file -- const char *name = global.params.xfilename; -- -- if (name && name[0] == '-' && name[1] == 0) -- { // Write to stdout; assume it succeeds -- int n = fwrite(buf.data, 1, buf.offset, stdout); -- assert(n == buf.offset); // keep gcc happy about return values -- } -- else -- { -- /* The filename generation code here should be harmonized with Module::setOutfile() -- */ -- -- const char *jsonfilename; -- -- if (name && *name) -- { -- jsonfilename = FileName::defaultExt(name, global.json_ext); -- } -- else -- { -- // Generate json file name from first obj name -- const char *n = (*global.params.objfiles)[0]; -- n = FileName::name(n); -- -- //if (!FileName::absolute(name)) -- //name = FileName::combine(dir, name); -- -- jsonfilename = FileName::forceExt(n, global.json_ext); -- } -- -- FileName::ensurePathToNameExists(jsonfilename); -- -- File *jsonfile = new File(jsonfilename); -- -- jsonfile->setbuffer(buf.data, buf.offset); -- jsonfile->ref = 1; -- jsonfile->writev(); -- } -- } -- -- if (global.params.oneobj) -- { -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("code %s\n", m->toChars()); -- if (i == 0) -- obj_start(m->srcfile->toChars()); -- m->genobjfile(0); -- if (!global.errors && global.params.doDocComments) -- m->gendocfile(); -- } -- if (!global.errors && modules.dim) -- { -- obj_end(library, modules[0]->objfile); -- } -- } -- else -- { -- for (size_t i = 0; i < modules.dim; i++) -- { -- m = modules[i]; -- if (global.params.verbose) -- printf("code %s\n", m->toChars()); -- if (global.params.obj) -- { obj_start(m->srcfile->toChars()); -- m->genobjfile(global.params.multiobj); -- obj_end(library, m->objfile); -- obj_write_deferred(library); -- } -- if (global.errors) -- { -- if (!global.params.lib) -- m->deleteObjFile(); -- } -- else -- { -- if (global.params.doDocComments) -- m->gendocfile(); -- } -- } -- } -- -- if (global.params.lib && !global.errors) -- library->write(); -- -- backend_term(); -- if (global.errors) -- fatal(); -- -- int status = EXIT_SUCCESS; -- if (!global.params.objfiles->dim) -- { -- if (global.params.link) -- error(0, "no object files to link"); -- } -- else -- { -- if (global.params.link) -- status = runLINK(); -- -- if (global.params.run) -- { -- if (!status) -- { -- status = runProgram(); -- -- /* Delete .obj files and .exe file -- */ -- for (size_t i = 0; i < modules.dim; i++) -- { -- Module *m = modules[i]; -- m->deleteObjFile(); -- if (global.params.oneobj) -- break; -- } -- deleteExeFile(); -- } -- } -- } -- -- return status; --} -- --int main(int argc, char *argv[]) --{ -- int status = -1; --#if WINDOWS_SEH -- __try -- { --#endif -- status = tryMain(argc, argv); --#if WINDOWS_SEH -- } -- __except (__ehfilter(GetExceptionInformation())) -- { -- printf("Stack overflow\n"); -- fatal(); -- } --#endif -- return status; --} -- -- --/*********************************** -- * Parse and append contents of environment variable envvar -- * to argc and argv[]. -- * The string is separated into arguments, processing \ and ". -- */ -- --void getenv_setargv(const char *envvar, size_t *pargc, char** *pargv) --{ -- char *p; -- -- int instring; -- int slash; -- char c; -- -- char *env = getenv(envvar); -- if (!env) -- return; -- -- env = mem.strdup(env); // create our own writable copy -- -- size_t argc = *pargc; -- Strings *argv = new Strings(); -- argv->setDim(argc); -- -- for (size_t i = 0; i < argc; i++) -- (*argv)[i] = (*pargv)[i]; -- -- size_t j = 1; // leave argv[0] alone -- while (1) -- { -- int wildcard = 1; // do wildcard expansion -- switch (*env) -- { -- case ' ': -- case '\t': -- env++; -- break; -- -- case 0: -- goto Ldone; -- -- case '"': -- wildcard = 0; -- default: -- argv->push(env); // append -- //argv->insert(j, env); // insert at position j -- j++; -- argc++; -- p = env; -- slash = 0; -- instring = 0; -- c = 0; -- -- while (1) -- { -- c = *env++; -- switch (c) -- { -- case '"': -- p -= (slash >> 1); -- if (slash & 1) -- { p--; -- goto Laddc; -- } -- instring ^= 1; -- slash = 0; -- continue; -- -- case ' ': -- case '\t': -- if (instring) -- goto Laddc; -- *p = 0; -- //if (wildcard) -- //wildcardexpand(); // not implemented -- break; -- -- case '\\': -- slash++; -- *p++ = c; -- continue; -- -- case 0: -- *p = 0; -- //if (wildcard) -- //wildcardexpand(); // not implemented -- goto Ldone; -- -- default: -- Laddc: -- slash = 0; -- *p++ = c; -- continue; -- } -- break; -- } -- } -- } -- --Ldone: -- *pargc = argc; -- *pargv = argv->tdata(); --} -- --/*********************************** -- * Parse command line arguments for -m32 or -m64 -- * to detect the desired architecture. -- */ -- --static bool parse_arch(size_t argc, char** argv, bool is64bit) --{ -- for (size_t i = 0; i < argc; ++i) -- { char* p = argv[i]; -- if (p[0] == '-') -- { -- if (strcmp(p + 1, "m32") == 0) -- is64bit = 0; -- else if (strcmp(p + 1, "m64") == 0) -- is64bit = 1; -- else if (strcmp(p + 1, "run") == 0) -- break; -- } -- } -- return is64bit; --} -- --#if WINDOWS_SEH -- --long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep) --{ -- //printf("%x\n", ep->ExceptionRecord->ExceptionCode); -- if (ep->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW) -- { --#if 1 //ndef DEBUG -- return EXCEPTION_EXECUTE_HANDLER; --#endif -- } -- return EXCEPTION_CONTINUE_SEARCH; --} -- --#endif -- --#endif ---- a/src/gcc/d/dfrontend/mars.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/mars.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -80,17 +80,11 @@ the target object file format: - #endif - void unittests(); - --#ifdef IN_GCC --/* Changes for the GDC compiler by David Friedman */ --#endif -- - #define DMDV1 0 - #define DMDV2 1 // Version 2.0 features - #define SNAN_DEFAULT_INIT DMDV2 // if floats are default initialized to signalling NaN - #define MODULEINFO_IS_STRUCT DMDV2 // if ModuleInfo is a struct rather than a class --#define BUG6652 2 // Making foreach range statement parameter non-ref in default -- // 1: Modifying iteratee in body is warned with -w switch -- // 2: Modifying iteratee in body is error without -d switch -+#define PULL93 0 // controversial pull #93 for bugzilla 3449 - - // Set if C++ mangling is done by the front end - #define CPP_MANGLE (IN_GCC || (DMDV2 && (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS))) -@@ -125,9 +119,9 @@ void unittests(); - struct OutBuffer; - - // Can't include arraytypes.h here, need to declare these directly. --template <typename TYPE> struct ArrayBase; --typedef ArrayBase<struct Identifier> Identifiers; --typedef ArrayBase<char> Strings; -+template <typename TYPE> struct Array; -+typedef Array<class Identifier> Identifiers; -+typedef Array<char> Strings; - - // Put command line switches in here - struct Param -@@ -142,11 +136,11 @@ struct Param - char quiet; // suppress non-error messages - char verbose; // verbose compile - char vtls; // identify thread local variables -+ char vfield; // identify non-mutable field variables - char symdebug; // insert debug symbolic information - bool alwaysframe; // always emit standard stack frame - bool optimize; // run optimizer - char map; // generate linker .map file -- char cpu; // target CPU - char is64bit; // generate 64 bit code - char isLP64; // generate code for LP64 - char isLinux; // generate code for linux -@@ -177,12 +171,14 @@ struct Param - // 1: warnings as errors - // 2: informational warnings (no errors) - bool pic; // generate position-independent-code for shared libs -- char cov; // generate code coverage data -+ bool cov; // generate code coverage data -+ unsigned char covPercent; // 0..100 code coverage percentage required - bool nofloat; // code should not pull in floating point support -- char Dversion; // D version number - char ignoreUnsupportedPragmas; // rather than error on them - char enforcePropertySyntax; - char betterC; // be a "better C" compiler; no dependency on D runtime -+ bool addMain; // add a default main() function -+ bool allInst; // generate code for all template instantiations - - char *argv0; // program name - Strings *imppath; // array of char*'s of where to look for import modules -@@ -246,10 +242,23 @@ struct Param - char *mapfile; - }; - -+struct Compiler -+{ -+ const char *vendor; // Compiler backend name -+}; -+ - typedef unsigned structalign_t; - #define STRUCTALIGN_DEFAULT ~0 // magic value means "match whatever the underlying C compiler does" - // other values are all powers of 2 - -+struct Ungag -+{ -+ unsigned oldgag; -+ -+ Ungag(unsigned old) : oldgag(old) {} -+ ~Ungag(); -+}; -+ - struct Global - { - const char *mars_ext; -@@ -264,16 +273,17 @@ struct Global - const char *map_ext; // for .map files - const char *copyright; - const char *written; -+ const char *main_d; // dummy filename for dummy main() - Strings *path; // Array of char*'s which form the import lookup path - Strings *filePath; // Array of char*'s which form the file import lookup path - -- structalign_t structalign; // default alignment for struct fields -- - const char *version; - -+ Compiler compiler; - Param params; - unsigned errors; // number of errors reported so far - unsigned warnings; // number of warnings reported so far -+ FILE *stdmsg; // where to send verbose messages - unsigned gag; // !=0 means gag reporting of errors & warnings - unsigned gaggedErrors; // number of errors reported while gagged - -@@ -291,16 +301,17 @@ struct Global - */ - bool endGagging(unsigned oldGagged); - -- Global(); -+ /* Increment the error count to record that an error -+ * has occured in the current context. An error message -+ * may or may not have been printed. -+ */ -+ void increaseErrorCount(); -+ -+ void init(); - }; - - extern Global global; - --/* Set if Windows Structured Exception Handling C extensions are supported. -- * Apparently, VC has dropped support for these? -- */ --#define WINDOWS_SEH _WIN32 -- - #include "longdouble.h" - - #ifdef __DMC__ -@@ -310,17 +321,36 @@ extern Global global; - #include "complex_t.h" - #endif - -+// Be careful not to care about sign when using dinteger_t -+//typedef uint64_t integer_t; -+typedef uint64_t dinteger_t; // use this instead of integer_t to -+ // avoid conflicts with system #include's -+ -+// Signed and unsigned variants -+typedef int64_t sinteger_t; -+typedef uint64_t uinteger_t; -+ -+typedef int8_t d_int8; -+typedef uint8_t d_uns8; -+typedef int16_t d_int16; -+typedef uint16_t d_uns16; -+typedef int32_t d_int32; -+typedef uint32_t d_uns32; -+typedef int64_t d_int64; -+typedef uint64_t d_uns64; -+ -+typedef float d_float32; -+typedef double d_float64; -+typedef longdouble d_float80; -+ -+typedef d_uns8 d_char; -+typedef d_uns16 d_wchar; -+typedef d_uns32 d_dchar; -+ - typedef longdouble real_t; - --// Modify OutBuffer::writewchar to write the correct size of wchar --#if _WIN32 --#define writewchar writeword --#else --// This needs a configuration test... --#define writewchar write4 --#endif - --struct Module; -+class Module; - - //typedef unsigned Loc; // file location - struct Loc -@@ -334,12 +364,6 @@ struct Loc - filename = NULL; - } - -- Loc(int x) -- { -- linnum = x; -- filename = NULL; -- } -- - Loc(Module *mod, unsigned linnum); - - char *toChars(); -@@ -414,23 +438,21 @@ void deleteExeFile(); - int runProgram(); - const char *inifile(const char *argv0, const char *inifile, const char* envsectionname); - void halt(); --void util_progress(); - --/*** Where to send error messages ***/ --#ifdef IN_GCC --#define stdmsg stderr --#else --#define stdmsg stderr --#endif -- --struct Dsymbol; -+class Dsymbol; - class Library; --struct File; -+class File; - void obj_start(char *srcfile); - void obj_end(Library *library, File *objfile); - void obj_append(Dsymbol *s); - void obj_write_deferred(Library *library); - -+void readFile(Loc loc, File *f); -+void writeFile(Loc loc, File *f); -+void ensurePathToNameExists(Loc loc, const char *name); -+ - const char *importHint(const char *s); -+/// Little helper function for writting out deps. -+void escapePath(OutBuffer *buf, const char *fname); - - #endif /* DMD_MARS_H */ ---- a/src/gcc/d/dfrontend/module.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/module.c 2014-04-01 16:32:51.000000000 +0100 -@@ -27,15 +27,18 @@ - #include "d-dmd-gcc.h" - #endif - --ClassDeclaration *Module::moduleinfo; -+AggregateDeclaration *Module::moduleinfo; - - Module *Module::rootModule; - DsymbolTable *Module::modules; - Modules Module::amodules; - - Dsymbols Module::deferred; // deferred Dsymbol's needing semantic() run on them -+Dsymbols Module::deferred3; - unsigned Module::dprogress; - -+const char *lookForSourceFile(const char *filename); -+ - void Module::init() - { - modules = new DsymbolTable(); -@@ -57,13 +60,7 @@ Module::Module(char *filename, Identifie - needmoduleinfo = 0; - selfimports = 0; - insearch = 0; -- searchCacheIdent = NULL; -- searchCacheSymbol = NULL; -- searchCacheFlags = 0; -- semanticstarted = 0; -- semanticRun = 0; - decldefs = NULL; -- vmoduleinfo = NULL; - massert = NULL; - munittest = NULL; - marray = NULL; -@@ -74,7 +71,6 @@ Module::Module(char *filename, Identifie - sshareddtor = NULL; - stest = NULL; - sfilename = NULL; -- root = 0; - importedFrom = NULL; - srcfile = NULL; - docfile = NULL; -@@ -218,55 +214,23 @@ Module *Module::load(Loc loc, Identifier - m = new Module(filename, ident, 0, 0); - m->loc = loc; - -- /* Search along global.path for .di file, then .d file. -+ /* Look for the source file - */ -- const char *result = NULL; -- const char *fdi = FileName::forceExt(filename, global.hdr_ext); -- const char *fd = FileName::forceExt(filename, global.mars_ext); -- const char *sdi = fdi; -- const char *sd = fd; -- -- if (FileName::exists(sdi)) -- result = sdi; -- else if (FileName::exists(sd)) -- result = sd; -- else if (FileName::absolute(filename)) -- ; -- else if (!global.path) -- ; -- else -- { -- for (size_t i = 0; i < global.path->dim; i++) -- { -- const char *p = (*global.path)[i]; -- const char *n = FileName::combine(p, sdi); -- if (FileName::exists(n)) -- { result = n; -- break; -- } -- FileName::free(n); -- n = FileName::combine(p, sd); -- if (FileName::exists(n)) -- { result = n; -- break; -- } -- FileName::free(n); -- } -- } -+ const char *result = lookForSourceFile(filename); - if (result) - m->srcfile = new File(result); - - if (global.params.verbose) - { -- fprintf(stdmsg, "import "); -+ fprintf(global.stdmsg, "import "); - if (packages) - { - for (size_t i = 0; i < packages->dim; i++) - { Identifier *pid = (*packages)[i]; -- fprintf(stdmsg, "%s.", pid->toChars()); -+ fprintf(global.stdmsg, "%s.", pid->toChars()); - } - } -- fprintf(stdmsg, "%s\t(%s)\n", ident->toChars(), m->srcfile->toChars()); -+ fprintf(global.stdmsg, "%s\t(%s)\n", ident->toChars(), m->srcfile->toChars()); - } - - if (!m->read(loc)) -@@ -293,7 +257,15 @@ bool Module::read(Loc loc) - } - else - { -- error(loc, "is in file '%s' which cannot be read", srcfile->toChars()); -+ // if module is not named 'package' but we're trying to read 'package.d', we're looking for a package module -+ bool isPackageMod = (strcmp(toChars(), "package") != 0) && -+ (strcmp(srcfile->name->name(), "package.d") == 0); -+ -+ if (isPackageMod) -+ ::error(loc, "importing package '%s' requires a 'package.d' file which cannot be found in '%s'", -+ toChars(), srcfile->toChars()); -+ else -+ error(loc, "is in file '%s' which cannot be read", srcfile->toChars()); - } - - if (!global.gag) -@@ -304,11 +276,11 @@ bool Module::read(Loc loc) - for (size_t i = 0; i < global.path->dim; i++) - { - char *p = (*global.path)[i]; -- fprintf(stdmsg, "import path[%llu] = %s\n", (ulonglong)i, p); -+ fprintf(stderr, "import path[%llu] = %s\n", (ulonglong)i, p); - } - } - else -- fprintf(stdmsg, "Specify path to file '%s' with -I switch\n", srcfile->toChars()); -+ fprintf(stderr, "Specify path to file '%s' with -I switch\n", srcfile->toChars()); - fatal(); - } - return false; -@@ -349,7 +321,7 @@ void Module::parse() - char *srcname = srcfile->name->toChars(); - //printf("Module::parse(srcname = '%s')\n", srcname); - -- unsigned char *buf = srcfile->buffer; -+ utf8_t *buf = srcfile->buffer; - size_t buflen = srcfile->len; - - if (buflen >= 2) -@@ -399,7 +371,7 @@ void Module::parse() - } - dbuf.writeByte(0); // add 0 as sentinel for scanner - buflen = dbuf.offset - 1; // don't include sentinel in count -- buf = (unsigned char *) dbuf.extractData(); -+ buf = (utf8_t *) dbuf.extractData(); - } - else - { // UTF-16LE (X86) -@@ -452,7 +424,7 @@ void Module::parse() - } - dbuf.writeByte(0); // add 0 as sentinel for scanner - buflen = dbuf.offset - 1; // don't include sentinel in count -- buf = (unsigned char *) dbuf.extractData(); -+ buf = (utf8_t *) dbuf.extractData(); - } - } - else if (buf[0] == 0xFE && buf[1] == 0xFF) -@@ -528,30 +500,43 @@ void Module::parse() - p.nextToken(); - members = p.parseModule(); - -- ::free(srcfile->buffer); -+ if (srcfile->ref == 0) -+ ::free(srcfile->buffer); - srcfile->buffer = NULL; - srcfile->len = 0; - - md = p.md; -- numlines = p.loc.linnum; -+ numlines = p.scanloc.linnum; - -+ /* The symbol table into which the module is to be inserted. -+ */ - DsymbolTable *dst; - - if (md) -- { this->ident = md->id; -+ { -+ /* A ModuleDeclaration, md, was provided. -+ * The ModuleDeclaration sets the packages this module appears in, and -+ * the name of this module. -+ */ -+ this->ident = md->id; - this->safe = md->safe; - Package *ppack = NULL; - dst = Package::resolve(md->packages, &this->parent, &ppack); -- if (ppack && ppack->isModule()) -+ assert(dst); -+ -+ Module *m = ppack ? ppack->isModule() : NULL; -+ if (m && strcmp(m->srcfile->name->name(), "package.d") != 0) - { -- error(loc, "package name '%s' in file %s conflicts with usage as a module name in file %s", -- ppack->toChars(), srcname, ppack->isModule()->srcfile->toChars()); -- dst = modules; -+ ::error(md->loc, "package name '%s' conflicts with usage as a module name in file %s", -+ ppack->toPrettyChars(), m->srcfile->toChars()); - } - } - else - { -- dst = modules; -+ /* The name of the module is set to the source file name. -+ * There are no packages. -+ */ -+ dst = modules; // and so this module goes into global module symbol table - - /* Check to see if module name is a valid identifier - */ -@@ -559,25 +544,71 @@ void Module::parse() - error("has non-identifier characters in filename, use module declaration instead"); - } - -- // Update global list of modules -- if (!dst->insert(this)) -+ // Insert module into the symbol table -+ Dsymbol *s = this; -+ bool isPackageMod = strcmp(srcfile->name->name(), "package.d") == 0; -+ if (isPackageMod) -+ { -+ /* If the source tree is as follows: -+ * pkg/ -+ * +- package.d -+ * +- common.d -+ * the 'pkg' will be incorporated to the internal package tree in two ways: -+ * import pkg; -+ * and: -+ * import pkg.common; -+ * -+ * If both are used in one compilation, 'pkg' as a module (== pkg/package.d) -+ * and a package name 'pkg' will conflict each other. -+ * -+ * To avoid the conflict: -+ * 1. If preceding package name insertion had occurred by Package::resolve, -+ * later package.d loading will change Package::isPkgMod to PKGmodule and set Package::mod. -+ * 2. Otherwise, 'package.d' wrapped by 'Package' is inserted to the internal tree in here. -+ */ -+ Package *p = new Package(ident); -+ p->parent = this->parent; -+ p->isPkgMod = PKGmodule; -+ p->mod = this; -+ p->symtab = new DsymbolTable(); -+ s = p; -+ } -+ if (!dst->insert(s)) - { -+ /* It conflicts with a name that is already in the symbol table. -+ * Figure out what went wrong, and issue error message. -+ */ - Dsymbol *prev = dst->lookup(ident); - assert(prev); -- Module *mprev = prev->isModule(); -- if (mprev) -- error(loc, "from file %s conflicts with another module %s from file %s", -- srcname, mprev->toChars(), mprev->srcfile->toChars()); -- else -+ if (Module *mprev = prev->isModule()) - { -- Package *pkg = prev->isPackage(); -- assert(pkg); -- error(pkg->loc, "from file %s conflicts with package name %s", -- srcname, pkg->toChars()); -+ if (strcmp(srcname, mprev->srcfile->toChars()) == 0) -+ error(loc, "from file %s must be imported as module '%s'", -+ srcname, toPrettyChars()); -+ else -+ error(loc, "from file %s conflicts with another module %s from file %s", -+ srcname, mprev->toChars(), mprev->srcfile->toChars()); - } -+ else if (Package *pkg = prev->isPackage()) -+ { -+ if (pkg->isPkgMod == PKGunknown && isPackageMod) -+ { -+ /* If the previous inserted Package is not yet determined as package.d, -+ * link it to the actual module. -+ */ -+ pkg->isPkgMod = PKGmodule; -+ pkg->mod = this; -+ } -+ else -+ error(pkg->loc, "from file %s conflicts with package name %s", -+ srcname, pkg->toChars()); -+ } -+ else -+ assert(global.errors); - } - else - { -+ // Add to global array of all modules - amodules.push(this); - } - } -@@ -608,7 +639,7 @@ void Module::importAll(Scope *prevsc) - // would fail inside object.d. - if (members->dim == 0 || ((*members)[0])->ident != Id::object) - { -- Import *im = new Import(0, NULL, Id::object, NULL, 0); -+ Import *im = new Import(Loc(), NULL, Id::object, NULL, 0); - members->shift(im); - } - -@@ -647,18 +678,18 @@ void Module::importAll(Scope *prevsc) - - void Module::semantic() - { -- if (semanticstarted) -+ if (semanticRun != PASSinit) - return; - - //printf("+Module::semantic(this = %p, '%s'): parent = %p\n", this, toChars(), parent); -- semanticstarted = 1; -+ semanticRun = PASSsemantic; - - // Note that modules get their own scope, from scratch. - // This is so regardless of where in the syntax a module - // gets imported, it is unaffected by context. - Scope *sc = scope; // see if already got one from importAll() - if (!sc) -- { printf("test2\n"); -+ { - Scope::createGlobal(this); // create root scope - } - -@@ -690,14 +721,6 @@ void Module::semantic() - } - #endif - -- // Do semantic() on members that don't depend on others -- for (size_t i = 0; i < members->dim; i++) -- { Dsymbol *s = (*members)[i]; -- -- //printf("\tModule('%s'): '%s'.semantic0()\n", toChars(), s->toChars()); -- s->semantic0(sc); -- } -- - // Pass 1 semantic routines: do public side of the definition - for (size_t i = 0; i < members->dim; i++) - { Dsymbol *s = (*members)[i]; -@@ -711,7 +734,7 @@ void Module::semantic() - { sc = sc->pop(); - sc->pop(); // 2 pops because Scope::createGlobal() created 2 - } -- semanticRun = semanticstarted; -+ semanticRun = PASSsemanticdone; - //printf("-Module::semantic(this = %p, '%s'): parent = %p\n", this, toChars(), parent); - } - -@@ -728,12 +751,9 @@ void Module::semantic2() - return; - } - //printf("Module::semantic2('%s'): parent = %p\n", toChars(), parent); -- if (semanticRun == 0) // semantic() not completed yet - could be recursive call -- return; -- if (semanticstarted >= 2) -+ if (semanticRun != PASSsemanticdone) // semantic() not completed yet - could be recursive call - return; -- assert(semanticstarted == 1); -- semanticstarted = 2; -+ semanticRun = PASSsemantic2; - - // Note that modules get their own scope, from scratch. - // This is so regardless of where in the syntax a module -@@ -751,17 +771,16 @@ void Module::semantic2() - - sc = sc->pop(); - sc->pop(); -- semanticRun = semanticstarted; -+ semanticRun = PASSsemantic2done; - //printf("-Module::semantic2('%s'): parent = %p\n", toChars(), parent); - } - - void Module::semantic3() - { - //printf("Module::semantic3('%s'): parent = %p\n", toChars(), parent); -- if (semanticstarted >= 3) -+ if (semanticRun != PASSsemantic2done) - return; -- assert(semanticstarted == 2); -- semanticstarted = 3; -+ semanticRun = PASSsemantic3; - - // Note that modules get their own scope, from scratch. - // This is so regardless of where in the syntax a module -@@ -780,15 +799,14 @@ void Module::semantic3() - - sc = sc->pop(); - sc->pop(); -- semanticRun = semanticstarted; -+ semanticRun = PASSsemantic3done; - } - - void Module::inlineScan() - { -- if (semanticstarted >= 4) -+ if (semanticRun != PASSsemantic3done) - return; -- assert(semanticstarted == 3); -- semanticstarted = 4; -+ semanticRun = PASSinline; - - // Note that modules get their own scope, from scratch. - // This is so regardless of where in the syntax a module -@@ -798,11 +816,11 @@ void Module::inlineScan() - for (size_t i = 0; i < members->dim; i++) - { Dsymbol *s = (*members)[i]; - //if (global.params.verbose) -- //printf("inline scan symbol %s\n", s->toChars()); -+ //fprintf(global.stdmsg, "inline scan symbol %s\n", s->toChars()); - - s->inlineScan(); - } -- semanticRun = semanticstarted; -+ semanticRun = PASSinlinedone; - } - - /**************************************************** -@@ -828,7 +846,7 @@ void Module::gensymfile() - symfile->setbuffer(buf.data, buf.offset); - buf.data = NULL; - -- symfile->writev(); -+ writeFile(loc, symfile); - } - - /********************************** -@@ -853,38 +871,15 @@ Dsymbol *Module::search(Loc loc, Identif - Dsymbol *s; - if (insearch) - s = NULL; -- else if (searchCacheIdent == ident && searchCacheFlags == flags) -- { -- s = searchCacheSymbol; -- //printf("%s Module::search('%s', flags = %d) insearch = %d searchCacheSymbol = %s\n", toChars(), ident->toChars(), flags, insearch, searchCacheSymbol ? searchCacheSymbol->toChars() : "null"); -- } - else - { - insearch = 1; - s = ScopeDsymbol::search(loc, ident, flags); - insearch = 0; -- -- searchCacheIdent = ident; -- searchCacheSymbol = s; -- searchCacheFlags = flags; - } - return s; - } - --Dsymbol *Module::symtabInsert(Dsymbol *s) --{ -- searchCacheIdent = 0; // symbol is inserted, so invalidate cache -- return Package::symtabInsert(s); --} -- --void Module::clearCache() --{ -- for (size_t i = 0; i < amodules.dim; i++) -- { Module *m = amodules[i]; -- m->searchCacheIdent = NULL; -- } --} -- - /******************************************* - * Can't run semantic on s now, try again later. - */ -@@ -959,6 +954,33 @@ void Module::runDeferredSemantic() - //printf("-Module::runDeferredSemantic(), len = %d\n", deferred.dim); - } - -+void Module::addDeferredSemantic3(Dsymbol *s) -+{ -+ // Don't add it if it is already there -+ for (size_t i = 0; i < deferred3.dim; i++) -+ { -+ Dsymbol *sd = deferred3[i]; -+ if (sd == s) -+ return; -+ } -+ deferred3.push(s); -+} -+ -+void Module::runDeferredSemantic3() -+{ -+ Dsymbols *a = &Module::deferred3; -+ for (size_t i = 0; i < a->dim; i++) -+ { -+ Dsymbol *s = (*a)[i]; -+ //printf("[%d] %s semantic3a\n", i, s->toPrettyChars()); -+ -+ s->semantic3(NULL); -+ -+ if (global.errors) -+ break; -+ } -+} -+ - /************************************ - * Recursively look at every module this module imports, - * return TRUE if it imports m. -@@ -1018,8 +1040,9 @@ int Module::selfImports() - - /* =========================== ModuleDeclaration ===================== */ - --ModuleDeclaration::ModuleDeclaration(Identifiers *packages, Identifier *id, bool safe) -+ModuleDeclaration::ModuleDeclaration(Loc loc, Identifiers *packages, Identifier *id, bool safe) - { -+ this->loc = loc; - this->packages = packages; - this->id = id; - this->safe = safe; -@@ -1048,6 +1071,8 @@ char *ModuleDeclaration::toChars() - Package::Package(Identifier *ident) - : ScopeDsymbol(ident) - { -+ this->isPkgMod = PKGunknown; -+ this->mod = NULL; - } - - -@@ -1056,6 +1081,15 @@ const char *Package::kind() - return "package"; - } - -+/**************************************************** -+ * Input: -+ * packages[] the pkg1.pkg2 of pkg1.pkg2.mod -+ * Returns: -+ * the symbol table that mod should be inserted into -+ * Output: -+ * *pparent the rightmost package, i.e. pkg2, or NULL if no packages -+ * *ppkg the leftmost package, i.e. pkg1, or NULL if no packages -+ */ - - DsymbolTable *Package::resolve(Identifiers *packages, Dsymbol **pparent, Package **ppkg) - { -@@ -1069,40 +1103,135 @@ DsymbolTable *Package::resolve(Identifie - if (packages) - { - for (size_t i = 0; i < packages->dim; i++) -- { Identifier *pid = (*packages)[i]; -- Dsymbol *p; -- -- p = dst->lookup(pid); -+ { -+ Identifier *pid = (*packages)[i]; -+ Package *pkg; -+ Dsymbol *p = dst->lookup(pid); - if (!p) - { -- p = new Package(pid); -- dst->insert(p); -- p->parent = parent; -- ((ScopeDsymbol *)p)->symtab = new DsymbolTable(); -+ pkg = new Package(pid); -+ dst->insert(pkg); -+ pkg->parent = parent; -+ pkg->symtab = new DsymbolTable(); - } - else - { -- assert(p->isPackage()); -+ pkg = p->isPackage(); -+ assert(pkg); - // It might already be a module, not a package, but that needs - // to be checked at a higher level, where a nice error message - // can be generated. - // dot net needs modules and packages with same name -+ -+ // But we still need a symbol table for it -+ if (!pkg->symtab) -+ pkg->symtab = new DsymbolTable(); - } -- parent = p; -- dst = ((Package *)p)->symtab; -+ parent = pkg; -+ dst = pkg->symtab; - if (ppkg && !*ppkg) -- *ppkg = (Package *)p; -- if (p->isModule()) -- { // Return the module so that a nice error message can be generated -+ *ppkg = pkg; -+ if (pkg->isModule()) -+ { -+ // Return the module so that a nice error message can be generated - if (ppkg) - *ppkg = (Package *)p; - break; - } - } -- if (pparent) -+ } -+ if (pparent) -+ *pparent = parent; -+ return dst; -+} -+ -+Dsymbol *Package::search(Loc loc, Identifier *ident, int flags) -+{ -+ if (!isModule() && mod) -+ { -+ // Prefer full package name. -+ Dsymbol *s = symtab ? symtab->lookup(ident) : NULL; -+ if (s) -+ return s; -+ //printf("[%s] through pkdmod: %s\n", loc.toChars(), toChars()); -+ return mod->search(loc, ident, flags); -+ } -+ -+ return ScopeDsymbol::search(loc, ident, flags); -+} -+ -+/* =========================== ===================== */ -+ -+/******************************************** -+ * Look for the source file if it's different from filename. -+ * Look for .di, .d, directory, and along global.path. -+ * Does not open the file. -+ * Input: -+ * filename as supplied by the user -+ * global.path -+ * Returns: -+ * NULL if it's not different from filename. -+ */ -+ -+const char *lookForSourceFile(const char *filename) -+{ -+ -+ /* Search along global.path for .di file, then .d file. -+ */ -+ -+ const char *sdi = FileName::forceExt(filename, global.hdr_ext); -+ if (FileName::exists(sdi) == 1) -+ return sdi; -+ -+ const char *sd = FileName::forceExt(filename, global.mars_ext); -+ if (FileName::exists(sd) == 1) -+ return sd; -+ -+ if (FileName::exists(filename) == 2) -+ { -+ /* The filename exists and it's a directory. -+ * Therefore, the result should be: filename/package.d -+ * iff filename/package.d is a file -+ */ -+ const char *n = FileName::combine(filename, "package.d"); -+ if (FileName::exists(n) == 1) -+ return n; -+ FileName::free(n); -+ } -+ -+ if (FileName::absolute(filename)) -+ return NULL; -+ -+ if (!global.path) -+ return NULL; -+ -+ for (size_t i = 0; i < global.path->dim; i++) -+ { -+ const char *p = (*global.path)[i]; -+ -+ const char *n = FileName::combine(p, sdi); -+ if (FileName::exists(n) == 1) -+ return n; -+ FileName::free(n); -+ -+ n = FileName::combine(p, sd); -+ if (FileName::exists(n) == 1) -+ return n; -+ FileName::free(n); -+ -+ const char *b = FileName::removeExt(filename); -+ n = FileName::combine(p, b); -+ FileName::free(b); -+ if (FileName::exists(n) == 2) - { -- *pparent = parent; -+ const char *n2 = FileName::combine(n, "package.d"); -+ if (FileName::exists(n2) == 1) -+ return n2; -+ FileName::free(n2); - } -+ FileName::free(n); - } -- return dst; -+ return NULL; - } -+ -+ ---- a/src/gcc/d/dfrontend/module.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/module.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -18,12 +18,11 @@ - #include "root.h" - #include "dsymbol.h" - --struct ModuleInfoDeclaration; --struct ClassDeclaration; -+class ClassDeclaration; - struct ModuleDeclaration; - struct Macro; - struct Escape; --struct VarDeclaration; -+class VarDeclaration; - class Library; - - // Back end -@@ -33,8 +32,19 @@ typedef union tree_node elem; - struct elem; - #endif - --struct Package : ScopeDsymbol -+enum PKG - { -+ PKGunknown, // not yet determined whether it's a package.d or not -+ PKGmodule, // already determined that's an actual package.d -+ PKGpackage, // already determined that's an actual package -+}; -+ -+class Package : public ScopeDsymbol -+{ -+public: -+ PKG isPkgMod; -+ Module *mod; // != NULL if isPkgMod == PKGmodule -+ - Package(Identifier *ident); - const char *kind(); - -@@ -42,19 +52,23 @@ struct Package : ScopeDsymbol - - Package *isPackage() { return this; } - -- virtual void semantic(Scope *sc) { (void)sc; } -+ virtual void semantic(Scope *) { } -+ Dsymbol *search(Loc loc, Identifier *ident, int flags); - }; - --struct Module : Package -+class Module : public Package - { -+public: - static Module *rootModule; - static DsymbolTable *modules; // symbol table of all modules - static Modules amodules; // array of all modules - static Dsymbols deferred; // deferred Dsymbol's needing semantic() run on them -+ static Dsymbols deferred3; // deferred Dsymbol's needing semantic3() run on them - static unsigned dprogress; // progress resolving the deferred list - static void init(); - -- static ClassDeclaration *moduleinfo; -+ static AggregateDeclaration *moduleinfo; -+ - - const char *arg; // original argument name - ModuleDeclaration *md; // if !NULL, the contents of the ModuleDeclaration declaration -@@ -72,15 +86,7 @@ struct Module : Package - int selfImports(); // returns !=0 if module imports itself - - int insearch; -- Identifier *searchCacheIdent; -- Dsymbol *searchCacheSymbol; // cached value of search -- int searchCacheFlags; // cached flags -- -- int semanticstarted; // has semantic() been started? -- int semanticRun; // has semantic() been done? -- int root; // != 0 if this is a 'root' module, -- // i.e. a module that will be taken all the -- // way to an object file -+ - Module *importedFrom; // module from command line we're imported from, - // i.e. a module that will be taken all the - // way to an object file -@@ -89,8 +95,6 @@ struct Module : Package - - Modules aimports; // all imported modules - -- ModuleInfoDeclaration *vmoduleinfo; -- - unsigned debuglevel; // debug level - Strings *debugids; // debug identifiers - Strings *debugidsNot; // forward referenced debug identifiers -@@ -101,7 +105,7 @@ struct Module : Package - - Macro *macrotable; // document comment macros - Escape *escapetable; // document comment escapes -- bool safe; // TRUE if module is marked as 'safe' -+ bool safe; // true if module is marked as 'safe' - - size_t nameoffset; // offset of module name from start of ModuleInfo - size_t namelen; // length of module name in characters -@@ -130,13 +134,17 @@ struct Module : Package - void gendocfile(); - int needModuleInfo(); - Dsymbol *search(Loc loc, Identifier *ident, int flags); -- Dsymbol *symtabInsert(Dsymbol *s); - void deleteObjFile(); -- void addDeferredSemantic(Dsymbol *s); -+ static void addDeferredSemantic(Dsymbol *s); - static void runDeferredSemantic(); -- static void clearCache(); -+ static void addDeferredSemantic3(Dsymbol *s); -+ static void runDeferredSemantic3(); - int imports(Module *m); - -+ bool isRoot() { return this->importedFrom == this; } -+ // true if the module source file is directly -+ // listed in command line. -+ - // Back end - - int doppelganger; // sub-module -@@ -162,7 +170,6 @@ struct Module : Package - Symbol *toModuleArray(); // get module array bounds function - - -- static Symbol *gencritsec(); - elem *toEfilename(); - - Symbol *toSymbol(); -@@ -174,11 +181,12 @@ struct Module : Package - - struct ModuleDeclaration - { -+ Loc loc; - Identifier *id; - Identifiers *packages; // array of Identifier's representing packages - bool safe; - -- ModuleDeclaration(Identifiers *packages, Identifier *id, bool safe); -+ ModuleDeclaration(Loc loc, Identifiers *packages, Identifier *id, bool safe); - - char *toChars(); - }; ---- a/src/gcc/d/dfrontend/mtype.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/mtype.c 2014-04-01 16:32:51.000000000 +0100 -@@ -41,19 +41,19 @@ - #include "template.h" - #include "id.h" - #include "enum.h" -+#include "module.h" - #include "import.h" - #include "aggregate.h" - #include "hdrgen.h" - - FuncDeclaration *hasThis(Scope *sc); --void ObjectNotFound(Identifier *id); -- -+void sizeToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e); - - #define LOGDOTEXP 0 // log ::dotExp() - #define LOGDEFAULTINIT 0 // log ::defaultInit() - --// Allow implicit conversion of T[] to T* --#define IMPLICIT_ARRAY_TO_PTR global.params.useDeprecated -+// Allow implicit conversion of T[] to T* --> Removed in 2.063 -+#define IMPLICIT_ARRAY_TO_PTR 0 - - int Tsize_t = Tuns32; - int Tptrdiff_t = Tint32; -@@ -62,7 +62,7 @@ int CLASSINFO_SIZE_64 = (0x98); - - /***************************** Type *****************************/ - --ClassDeclaration *Type::typeinfo; -+ClassDeclaration *Type::dtypeinfo; - ClassDeclaration *Type::typeinfoclass; - ClassDeclaration *Type::typeinfointerface; - ClassDeclaration *Type::typeinfostruct; -@@ -84,6 +84,44 @@ ClassDeclaration *Type::typeinfowild; - TemplateDeclaration *Type::associativearray; - TemplateDeclaration *Type::rtinfo; - -+Type *Type::tvoid; -+Type *Type::tint8; -+Type *Type::tuns8; -+Type *Type::tint16; -+Type *Type::tuns16; -+Type *Type::tint32; -+Type *Type::tuns32; -+Type *Type::tint64; -+Type *Type::tuns64; -+Type *Type::tint128; -+Type *Type::tuns128; -+Type *Type::tfloat32; -+Type *Type::tfloat64; -+Type *Type::tfloat80; -+ -+Type *Type::timaginary32; -+Type *Type::timaginary64; -+Type *Type::timaginary80; -+ -+Type *Type::tcomplex32; -+Type *Type::tcomplex64; -+Type *Type::tcomplex80; -+ -+Type *Type::tbool; -+Type *Type::tchar; -+Type *Type::twchar; -+Type *Type::tdchar; -+ -+Type *Type::tshiftcnt; -+Type *Type::tboolean; -+Type *Type::terror; -+Type *Type::tnull; -+ -+Type *Type::tsize_t; -+Type *Type::tptrdiff_t; -+Type *Type::thash_t; -+Type *Type::tindex; -+ - Type *Type::tvoidptr; - Type *Type::tstring; - Type *Type::tvalist; -@@ -119,28 +157,34 @@ const char *Type::kind() - return NULL; - } - -+Type *Type::copy() -+{ -+ Type *t = (Type *)mem.malloc(sizeTy[ty]); -+ memcpy((void*)t, (void*)this, sizeTy[ty]); -+ return t; -+} -+ - Type *Type::syntaxCopy() - { - print(); -- fprintf(stdmsg, "ty = %d\n", ty); -+ fprintf(stderr, "ty = %d\n", ty); - assert(0); - return this; - } - --int Type::equals(Object *o) --{ Type *t; -- -- t = (Type *)o; -+bool Type::equals(RootObject *o) -+{ -+ Type *t = (Type *)o; - //printf("Type::equals(%s, %s)\n", toChars(), t->toChars()); - if (this == o || - ((t && deco == t->deco) && // deco strings are unique - deco != NULL)) // and semantic() has been run - { - //printf("deco = '%s', t->deco = '%s'\n", deco, t->deco); -- return 1; -+ return true; - } - //if (deco && t && t->deco) printf("deco = '%s', t->deco = '%s'\n", deco, t->deco); -- return 0; -+ return false; - } - - char Type::needThisPrefix() -@@ -150,7 +194,7 @@ char Type::needThisPrefix() - - void Type::init() - { -- stringtable.init(1543); -+ stringtable._init(1543); - Lexer::initKeywords(); - - for (size_t i = 0; i < TMAX; i++) -@@ -229,7 +273,7 @@ void Type::init() - - for (size_t i = 0; i < TMAX; i++) - { if (!mangleChar[i]) -- fprintf(stdmsg, "ty = %llu\n", (ulonglong)i); -+ fprintf(stderr, "ty = %llu\n", (ulonglong)i); - assert(mangleChar[i]); - } - -@@ -250,11 +294,43 @@ void Type::init() - } - basic[Terror] = new TypeError(); - -+ tvoid = basic[Tvoid]; -+ tint8 = basic[Tint8]; -+ tuns8 = basic[Tuns8]; -+ tint16 = basic[Tint16]; -+ tuns16 = basic[Tuns16]; -+ tint32 = basic[Tint32]; -+ tuns32 = basic[Tuns32]; -+ tint64 = basic[Tint64]; -+ tuns64 = basic[Tuns64]; -+ tint128 = basic[Tint128]; -+ tuns128 = basic[Tuns128]; -+ tfloat32 = basic[Tfloat32]; -+ tfloat64 = basic[Tfloat64]; -+ tfloat80 = basic[Tfloat80]; -+ -+ timaginary32 = basic[Timaginary32]; -+ timaginary64 = basic[Timaginary64]; -+ timaginary80 = basic[Timaginary80]; -+ -+ tcomplex32 = basic[Tcomplex32]; -+ tcomplex64 = basic[Tcomplex64]; -+ tcomplex80 = basic[Tcomplex80]; -+ -+ tbool = basic[Tbool]; -+ tchar = basic[Tchar]; -+ twchar = basic[Twchar]; -+ tdchar = basic[Tdchar]; -+ -+ tshiftcnt = tint32; -+ tboolean = tbool; -+ terror = basic[Terror]; -+ tnull = basic[Tnull]; - tnull = new TypeNull(); - tnull->deco = tnull->merge()->deco; - - tvoidptr = tvoid->pointerTo(); -- tstring = tchar->invariantOf()->arrayOf(); -+ tstring = tchar->immutableOf()->arrayOf(); - tvalist = tvoid->pointerTo(); - - if (global.params.isLP64) -@@ -267,22 +343,27 @@ void Type::init() - Tsize_t = Tuns32; - Tptrdiff_t = Tint32; - } -+ -+ tsize_t = basic[Tsize_t]; -+ tptrdiff_t = basic[Tptrdiff_t]; -+ thash_t = tsize_t; -+ tindex = tsize_t; - } - - d_uns64 Type::size() - { -- return size(0); -+ return size(Loc()); - } - - d_uns64 Type::size(Loc loc) - { - error(loc, "no size for type %s", toChars()); -- return 1; -+ return SIZE_INVALID; - } - - unsigned Type::alignsize() - { -- return size(0); -+ return size(Loc()); - } - - Type *Type::semantic(Loc loc, Scope *sc) -@@ -301,7 +382,7 @@ Type *Type::trySemantic(Loc loc, Scope * - //printf("+trySemantic(%s) %d\n", toChars(), global.errors); - unsigned errors = global.startGagging(); - Type *t = semantic(loc, sc); -- if (global.endGagging(errors)) // if any errors happened -+ if (global.endGagging(errors) || t->ty == Terror) // if any errors happened - { - t = NULL; - } -@@ -310,6 +391,34 @@ Type *Type::trySemantic(Loc loc, Scope * - } - - /******************************** -+ * Return a copy of this type with all attributes null-initialized. -+ * Useful for creating a type with different modifiers. -+ */ -+ -+Type *Type::nullAttributes() -+{ -+ unsigned sz = sizeTy[ty]; -+ Type *t = (Type *)mem.malloc(sz); -+ memcpy((void*)t, (void*)this, sz); -+ // t->mod = NULL; // leave mod unchanged -+ t->deco = NULL; -+ t->arrayof = NULL; -+ t->pto = NULL; -+ t->rto = NULL; -+ t->cto = NULL; -+ t->ito = NULL; -+ t->sto = NULL; -+ t->scto = NULL; -+ t->wto = NULL; -+ t->swto = NULL; -+ t->vtinfo = NULL; -+ t->ctype = NULL; -+ if (t->ty == Tstruct) ((TypeStruct *)t)->att = RECfwdref; -+ if (t->ty == Tclass) ((TypeClass *)t)->att = RECfwdref; -+ return t; -+} -+ -+/******************************** - * Convert to 'const'. - */ - -@@ -333,9 +442,9 @@ Type *Type::constOf() - * Convert to 'immutable'. - */ - --Type *Type::invariantOf() -+Type *Type::immutableOf() - { -- //printf("Type::invariantOf() %p %s\n", this, toChars()); -+ //printf("Type::immutableOf() %p %s\n", this, toChars()); - if (isImmutable()) - { - return this; -@@ -459,21 +568,9 @@ Type *Type::unSharedOf() - - if (!t) - { -- unsigned sz = sizeTy[ty]; -- t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ t = this->nullAttributes(); - t->mod = mod & ~MODshared; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -+ t->ctype = ctype; - t = t->merge(); - - t->fixTo(this); -@@ -826,7 +923,7 @@ void Type::check() - } - - Type *tn = nextOf(); -- if (tn && ty != Tfunction && tn->ty != Tfunction) -+ if (tn && ty != Tfunction && tn->ty != Tfunction && ty != Tenum) - { // Verify transitivity - switch (mod) - { -@@ -867,161 +964,57 @@ void Type::check() - Type *Type::makeConst() - { - //printf("Type::makeConst() %p, %s\n", this, toChars()); -- if (cto) -- return cto; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (cto) return cto; -+ Type *t = this->nullAttributes(); - t->mod = MODconst; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - //printf("-Type::makeConst() %p, %s\n", t, toChars()); - return t; - } - - Type *Type::makeInvariant() - { -- if (ito) -- return ito; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (ito) return ito; -+ Type *t = this->nullAttributes(); - t->mod = MODimmutable; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - return t; - } - - Type *Type::makeShared() - { -- if (sto) -- return sto; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (sto) return sto; -+ Type *t = this->nullAttributes(); - t->mod = MODshared; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - return t; - } - - Type *Type::makeSharedConst() - { -- if (scto) -- return scto; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (scto) return scto; -+ Type *t = this->nullAttributes(); - t->mod = MODshared | MODconst; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - return t; - } - - Type *Type::makeWild() - { -- if (wto) -- return wto; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (wto) return wto; -+ Type *t = this->nullAttributes(); - t->mod = MODwild; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - return t; - } - - Type *Type::makeSharedWild() - { -- if (swto) -- return swto; -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -+ if (swto) return swto; -+ Type *t = this->nullAttributes(); - t->mod = MODshared | MODwild; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; - return t; - } - - Type *Type::makeMutable() - { -- unsigned sz = sizeTy[ty]; -- Type *t = (Type *)mem.malloc(sz); -- memcpy(t, this, sz); -- t->mod = mod & MODshared; -- t->deco = NULL; -- t->arrayof = NULL; -- t->pto = NULL; -- t->rto = NULL; -- t->cto = NULL; -- t->ito = NULL; -- t->sto = NULL; -- t->scto = NULL; -- t->wto = NULL; -- t->swto = NULL; -- t->vtinfo = NULL; -- t->ctype = NULL; -+ Type *t = this->nullAttributes(); -+ t->mod = mod & MODshared; - return t; - } - -@@ -1074,7 +1067,7 @@ Type *Type::castMod(unsigned mod) - break; - - case MODimmutable: -- t = invariantOf(); -+ t = immutableOf(); - break; - - case MODshared: -@@ -1126,7 +1119,7 @@ Type *Type::addMod(unsigned mod) - break; - - case MODimmutable: -- t = invariantOf(); -+ t = immutableOf(); - break; - - case MODshared: -@@ -1193,10 +1186,15 @@ Type *Type::pointerTo() - if (ty == Terror) - return this; - if (!pto) -- { Type *t; -- -- t = new TypePointer(this); -- pto = t->merge(); -+ { -+ Type *t = new TypePointer(this); -+ if (ty == Tfunction) -+ { -+ t->deco = t->merge()->deco; -+ pto = t; -+ } -+ else -+ pto = t->merge(); - } - return pto; - } -@@ -1252,9 +1250,7 @@ Type *Type::aliasthisOf() - } - else if (d->isFuncDeclaration()) - { -- FuncDeclaration *fd = (FuncDeclaration *)d; -- Expression *ethis = this->defaultInit(0); -- fd = fd->overloadResolve(0, ethis, NULL, 1); -+ FuncDeclaration *fd = resolveFuncCall(Loc(), NULL, d, NULL, this, NULL, 1); - if (fd && fd->functionSemantic()) - { - t = fd->type->nextOf(); -@@ -1274,8 +1270,7 @@ Type *Type::aliasthisOf() - TemplateDeclaration *td = ad->aliasthis->isTemplateDeclaration(); - if (td) - { assert(td->scope); -- Expression *ethis = defaultInit(0); -- FuncDeclaration *fd = td->deduceFunctionTemplate(td->scope, 0, NULL, ethis, NULL, 1); -+ FuncDeclaration *fd = resolveFuncCall(Loc(), NULL, td, NULL, this, NULL, 1); - if (fd && fd->functionSemantic()) - { - Type *t = fd->type->nextOf(); -@@ -1290,6 +1285,27 @@ Type *Type::aliasthisOf() - return NULL; - } - -+int Type::checkAliasThisRec() -+{ -+ Type *tb = toBasetype(); -+ AliasThisRec* pflag; -+ if (tb->ty == Tstruct) -+ pflag = &((TypeStruct *)tb)->att; -+ else if (tb->ty == Tclass) -+ pflag = &((TypeClass *)tb)->att; -+ else -+ return 0; -+ -+ AliasThisRec flag = (AliasThisRec)(*pflag & ~RECtracing); -+ if (flag == RECfwdref) -+ { -+ Type *att = aliasthisOf(); -+ flag = att && att->implicitConvTo(this) ? RECyes : RECno; -+ } -+ *pflag = (AliasThisRec)(flag | (*pflag & RECtracing)); -+ return flag == RECyes; -+} -+ - Dsymbol *Type::toDsymbol(Scope *sc) - { - return NULL; -@@ -1365,57 +1381,19 @@ int MODmerge(unsigned char mod1, unsigne - return mod1; - - //printf("MODmerge(1 = %x, 2 = %x)\n", modfrom, modto); -- #define X(m, n) (((m) << 4) | (n)) -- // cases are commutative -- #define Y(m, n) X(m, n): case X(n, m) -- switch (X(mod1, mod2)) -- { --#if 0 -- case X(0, 0): -- case X(MODconst, MODconst): -- case X(MODimmutable, MODimmutable): -- case X(MODshared, MODshared): -- case X(MODshared | MODconst, MODshared | MODconst): -- case X(MODwild, MODwild): -- case X(MODshared | MODwild, MODshared | MODwild): --#endif -- -- case Y(0, MODconst): -- case Y(0, MODimmutable): -- case Y(MODconst, MODimmutable): -- case Y(MODconst, MODwild): -- case Y(0, MODwild): -- case Y(MODimmutable, MODwild): -- return MODconst; -- -- case Y(0, MODshared): -- return MODshared; -+ unsigned char result = 0; - -- case Y(0, MODshared | MODconst): -- case Y(MODconst, MODshared): -- case Y(MODconst, MODshared | MODconst): -- case Y(MODimmutable, MODshared): -- case Y(MODimmutable, MODshared | MODconst): -- case Y(MODshared, MODshared | MODconst): -- case Y(0, MODshared | MODwild): -- case Y(MODconst, MODshared | MODwild): -- case Y(MODimmutable, MODshared | MODwild): -- case Y(MODshared, MODwild): -- case Y(MODshared, MODshared | MODwild): -- case Y(MODshared | MODconst, MODwild): -- case Y(MODshared | MODconst, MODshared | MODwild): -- return MODshared | MODconst; -- -- case Y(MODwild, MODshared | MODwild): -- return MODshared | MODwild; -- -- default: -- assert(0); -- } -- #undef Y -- #undef X -- assert(0); -- return 0; -+ // If either type is shared, the result will be shared -+ if ((mod1 | mod2) & MODshared) -+ result |= MODshared; -+ // If both types are wild, the result will be wild -+ // Otherwise if either type is const or immutable or wild -+ // the result will be const -+ if (mod1 & mod2 & MODwild) -+ result |= MODwild; -+ else if ((mod1 | mod2) & (MODconst | MODimmutable | MODwild)) -+ result |= MODconst; -+ return result; - } - - /********************************* -@@ -1491,6 +1469,7 @@ void MODtoBuffer(OutBuffer *buf, unsigne - char *MODtoChars(unsigned char mod) - { - OutBuffer buf; -+ buf.reserve(16); - MODtoBuffer(&buf, mod); - buf.writebyte(0); - return buf.extractData(); -@@ -1516,12 +1495,13 @@ void Type::toDecoBuffer(OutBuffer *buf, - */ - - char *Type::toChars() --{ OutBuffer *buf; -+{ OutBuffer buf; -+ buf.reserve(16); - HdrGenState hgs; - -- buf = new OutBuffer(); -- toCBuffer(buf, NULL, &hgs); -- return buf->toChars(); -+ toCBuffer(&buf, NULL, &hgs); -+ buf.writebyte(0); -+ return buf.extractData(); - } - - void Type::toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs) -@@ -1587,12 +1567,92 @@ void Type::modToBuffer(OutBuffer *buf) - char *Type::modToChars() - { - OutBuffer buf; -+ buf.reserve(16); - modToBuffer(&buf); - buf.writebyte(0); - return buf.extractData(); - } - - /************************************ -+ * Strip all parameter's idenfiers and their default arguments for merging types. -+ * If some of parameter types or return type are function pointer, delegate, or -+ * the types which contains either, then strip also from them. -+ */ -+ -+Type *stripDefaultArgs(Type *t) -+{ -+ struct N -+ { -+ static Parameters *stripParams(Parameters *arguments) -+ { -+ Parameters *args = arguments; -+ if (args && args->dim > 0) -+ { -+ for (size_t i = 0; i < args->dim; i++) -+ { -+ Parameter *a = (*args)[i]; -+ Type *ta = stripDefaultArgs(a->type); -+ if (ta != a->type || a->defaultArg || a->ident) -+ { -+ if (args == arguments) -+ { -+ args = new Parameters(); -+ args->setDim(arguments->dim); -+ for (size_t j = 0; j < args->dim; j++) -+ (*args)[j] = (*arguments)[j]; -+ } -+ (*args)[i] = new Parameter(a->storageClass, ta, NULL, NULL); -+ } -+ } -+ } -+ return args; -+ } -+ }; -+ -+ if (t == NULL) -+ return t; -+ -+ if (t->ty == Tfunction) -+ { -+ TypeFunction *tf = (TypeFunction *)t; -+ Type *tret = stripDefaultArgs(tf->next); -+ Parameters *args = N::stripParams(tf->parameters); -+ if (tret == tf->next && args == tf->parameters) -+ goto Lnot; -+ tf = (TypeFunction *)tf->copy(); -+ tf->parameters = args; -+ tf->next = tret; -+ //printf("strip %s\n <- %s\n", tf->toChars(), t->toChars()); -+ t = tf; -+ } -+ else if (t->ty == Ttuple) -+ { -+ TypeTuple *tt = (TypeTuple *)t; -+ Parameters *args = N::stripParams(tt->arguments); -+ if (args == tt->arguments) -+ goto Lnot; -+ t = new TypeTuple(args); -+ } -+ else if (t->ty == Tenum) -+ { -+ // TypeEnum::nextOf() may be != NULL, but it's not necessary here. -+ goto Lnot; -+ } -+ else -+ { -+ Type *tn = t->nextOf(); -+ Type *n = stripDefaultArgs(tn); -+ if (n == tn) -+ goto Lnot; -+ t = t->copy(); -+ ((TypeNext *)t)->next = n; -+ } -+ //printf("strip %s\n", t->toChars()); -+Lnot: -+ return t; -+} -+ -+/************************************ - */ - - Type *Type::merge() -@@ -1603,7 +1663,7 @@ Type *Type::merge() - if (ty == Tinstance) return this; - if (ty == Taarray && !((TypeAArray *)this)->index->merge()->deco) - return this; -- if (nextOf() && !nextOf()->deco) -+ if (ty != Tenum && nextOf() && !nextOf()->deco) - return this; - - //printf("merge(%s)\n", toChars()); -@@ -1612,12 +1672,12 @@ Type *Type::merge() - if (!deco) - { - OutBuffer buf; -- StringValue *sv; -+ buf.reserve(32); - - //if (next) - //next = next->merge(); - toDecoBuffer(&buf); -- sv = stringtable.update((char *)buf.data, buf.offset); -+ StringValue *sv = stringtable.update((char *)buf.data, buf.offset); - if (sv->ptrvalue) - { t = (Type *) sv->ptrvalue; - #ifdef DEBUG -@@ -1629,8 +1689,8 @@ Type *Type::merge() - } - else - { -- sv->ptrvalue = this; -- deco = (char *)sv->toDchars(); -+ sv->ptrvalue = (char *)(t = stripDefaultArgs(t)); -+ deco = t->deco = (char *)sv->toDchars(); - //printf("new value, deco = '%s' %p\n", t->deco, t->deco); - } - } -@@ -1800,7 +1860,7 @@ MATCH Type::implicitConvTo(Type *to) - //printf("Type::implicitConvTo(this=%p, to=%p)\n", this, to); - //printf("from: %s\n", toChars()); - //printf("to : %s\n", to->toChars()); -- if (this == to) -+ if (this->equals(to)) - return MATCHexact; - return MATCHnomatch; - } -@@ -1853,10 +1913,17 @@ Type *Type::substWildTo(unsigned mod) - //printf("+Type::substWildTo this = %s, mod = x%x\n", toChars(), mod); - Type *t; - -- if (nextOf()) -+ if (Type *tn = nextOf()) - { -- t = nextOf()->substWildTo(mod); -- if (t == nextOf()) -+ // substitution has no effect on function pointer type. -+ if (ty == Tpointer && tn->ty == Tfunction) -+ { -+ t = this; -+ goto L1; -+ } -+ -+ t = tn->substWildTo(mod); -+ if (t == tn) - t = this; - else - { -@@ -1871,6 +1938,10 @@ Type *Type::substWildTo(unsigned mod) - t = new TypeAArray(t, ((TypeAArray *)this)->index->syntaxCopy()); - ((TypeAArray *)t)->sc = ((TypeAArray *)this)->sc; // duplicate scope - } -+ else if (ty == Tdelegate) -+ { -+ t = new TypeDelegate(t); -+ } - else - assert(0); - -@@ -1880,12 +1951,13 @@ Type *Type::substWildTo(unsigned mod) - else - t = this; - -+L1: - if (isWild()) - { - if (mod & MODconst) - t = isShared() ? t->sharedConstOf() : t->constOf(); - else if (mod & MODimmutable) -- t = t->invariantOf(); -+ t = t->immutableOf(); - else if (mod & MODwild) - t = isShared() ? t->sharedWildOf() : t->wildOf(); - else -@@ -1896,6 +1968,47 @@ Type *Type::substWildTo(unsigned mod) - return t; - } - -+Type *TypeFunction::substWildTo(unsigned) -+{ -+ if (!iswild && !(mod & MODwild)) -+ return this; -+ -+ // Substitude inout qualifier of function type to mutable or immutable -+ // would break type system. Instead substitude inout to the most weak -+ // qualifer - const. -+ unsigned m = MODconst; -+ -+ assert(next); -+ Type *tret = next->substWildTo(m); -+ Parameters *params = parameters; -+ if (mod & MODwild) -+ params = parameters->copy(); -+ for (size_t i = 0; i < params->dim; i++) -+ { -+ Parameter *p = (*params)[i]; -+ Type *t = p->type->substWildTo(m); -+ if (t == p->type) -+ continue; -+ if (params == parameters) -+ params = parameters->copy(); -+ (*params)[i] = new Parameter(p->storageClass, t, NULL, NULL); -+ } -+ if (next == tret && params == parameters) -+ return this; -+ -+ // Similar to TypeFunction::syntaxCopy; -+ TypeFunction *t = new TypeFunction(params, tret, varargs, linkage); -+ t->mod = ((mod & MODwild) ? (mod & ~MODwild) | MODconst : mod); -+ t->isnothrow = isnothrow; -+ t->purity = purity; -+ t->isproperty = isproperty; -+ t->isref = isref; -+ t->iswild = false; // done -+ t->trust = trust; -+ t->fargs = fargs; -+ return t->merge(); -+} -+ - /************************** - * Return type with the top level of it being mutable. - */ -@@ -1906,7 +2019,12 @@ Type *Type::toHeadMutable() - return mutableOf(); - } - --Expression *Type::getProperty(Loc loc, Identifier *ident) -+/*************************************** -+ * Calculate built-in properties which just the type is necessary. -+ * -+ * If flag == 1, don't report "not a property" error and just return NULL. -+ */ -+Expression *Type::getProperty(Loc loc, Identifier *ident, int flag) - { Expression *e; - - #if LOGDOTEXP -@@ -1914,7 +2032,10 @@ Expression *Type::getProperty(Loc loc, I - #endif - if (ident == Id::__sizeof) - { -- e = new IntegerExp(loc, size(loc), Type::tsize_t); -+ d_uns64 sz = size(loc); -+ if (sz == SIZE_INVALID) -+ return new ErrorExp(); -+ e = new IntegerExp(loc, sz, Type::tsize_t); - } - else if (ident == Id::__xalignof) - { -@@ -1936,16 +2057,18 @@ Expression *Type::getProperty(Loc loc, I - } - } - else if (ident == Id::mangleof) -- { const char *s; -+ { - if (!deco) -- { s = toChars(); -- error(loc, "forward reference of type %s.mangleof", s); -+ { -+ error(loc, "forward reference of type %s.mangleof", toChars()); -+ e = new ErrorExp(); - } - else -- s = deco; -- e = new StringExp(loc, (char *)s, strlen(s), 'c'); -- Scope sc; -- e = e->semantic(&sc); -+ { -+ e = new StringExp(loc, (char *)deco, strlen(deco), 'c'); -+ Scope sc; -+ e = e->semantic(&sc); -+ } - } - else if (ident == Id::stringof) - { char *s = toChars(); -@@ -1953,6 +2076,10 @@ Expression *Type::getProperty(Loc loc, I - Scope sc; - e = e->semantic(&sc); - } -+ else if (flag && this != Type::terror) -+ { -+ return NULL; -+ } - else - { - Dsymbol *s = NULL; -@@ -1972,20 +2099,28 @@ Expression *Type::getProperty(Loc loc, I - return e; - } - --Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident) -+/*************************************** -+ * Access the members of the object e. This type is same as e->type. -+ * -+ * If flag == 1, don't report "not a property" error and just return NULL. -+ */ -+Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { VarDeclaration *v = NULL; - - #if LOGDOTEXP - printf("Type::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); - #endif -- if (e->op == TOKdotvar) -+ Expression *ex = e; -+ while (ex->op == TOKcomma) -+ ex = ((CommaExp *)ex)->e2; -+ if (ex->op == TOKdotvar) - { -- DotVarExp *dv = (DotVarExp *)e; -+ DotVarExp *dv = (DotVarExp *)ex; - v = dv->var->isVarDeclaration(); - } -- else if (e->op == TOKvar) -+ else if (ex->op == TOKvar) - { -- VarExp *ve = (VarExp *)e; -+ VarExp *ve = (VarExp *)ex; - v = ve->var->isVarDeclaration(); - } - if (v) -@@ -1998,7 +2133,7 @@ Expression *Type::dotExp(Scope *sc, Expr - else if (ident == Id::offsetof) - { - Loffset: -- if (v->storage_class & STCfield) -+ if (v->isField()) - { - e = new IntegerExp(e->loc, v->offset, Type::tsize_t); - return e; -@@ -2029,10 +2164,11 @@ Expression *Type::dotExp(Scope *sc, Expr - e = new StringExp(e->loc, s, strlen(s), 'c'); - } - else -- e = getProperty(e->loc, ident); -+ e = getProperty(e->loc, ident, flag); - - Lreturn: -- e = e->semantic(sc); -+ if (!flag || e) -+ e = e->semantic(sc); - return e; - } - -@@ -2048,8 +2184,10 @@ structalign_t Type::alignment() - /*************************************** - * Figures out what to do with an undefined member reference - * for classes and structs. -+ * -+ * If flag == 1, don't report "not a property" error and just return NULL. - */ --Expression *Type::noMember(Scope *sc, Expression *e, Identifier *ident) -+Expression *Type::noMember(Scope *sc, Expression *e, Identifier *ident, int flag) - { - assert(ty == Tstruct || ty == Tclass); - AggregateDeclaration *sym = toDsymbol(sc)->isAggregateDeclaration(); -@@ -2095,10 +2233,20 @@ Expression *Type::noMember(Scope *sc, Ex - tiargs->push(se); - DotTemplateInstanceExp *dti = new DotTemplateInstanceExp(e->loc, e, Id::opDispatch, tiargs); - dti->ti->tempdecl = td; -- return dti->semantic(sc, 1); -- } - -- /* See if we should forward to the alias this. -+ /* opDispatch, which doesn't need IFTI, may occur instantiate error. -+ * It should be gagged if flag != 0. -+ * e.g. -+ * tempalte opDispatch(name) if (isValid!name) { ... } -+ */ -+ unsigned errors = flag ? global.startGagging() : 0; -+ Expression *e = dti->semanticY(sc, 0); -+ if (flag && global.endGagging(errors)) -+ e = NULL; -+ return e; -+ } -+ -+ /* See if we should forward to the alias this. - */ - if (sym->aliasthis) - { /* Rewrite e.ident as: -@@ -2106,11 +2254,11 @@ Expression *Type::noMember(Scope *sc, Ex - */ - e = resolveAliasThis(sc, e); - DotIdExp *die = new DotIdExp(e->loc, e, ident); -- return die->semantic(sc, 1); -+ return die->semanticY(sc, flag); - } - } - -- return Type::dotExp(sc, e, ident); -+ return Type::dotExp(sc, e, ident, flag); - } - - void Type::error(Loc loc, const char *format, ...) -@@ -2133,6 +2281,7 @@ Identifier *Type::getTypeInfoIdent(int i - { - // _init_10TypeInfo_%s - OutBuffer buf; -+ buf.reserve(32); - - if (internal) - { buf.writeByte(mangleChar[ty]); -@@ -2151,7 +2300,7 @@ Identifier *Type::getTypeInfoIdent(int i - char *name = namelen <= sizeof(namebuf) ? namebuf : (char *)malloc(namelen); - assert(name); - -- sprintf(name, "_D%dTypeInfo_%s6__initZ", 9 + len, buf.data); -+ sprintf(name, "_D%lluTypeInfo_%s6__initZ", (unsigned long long) 9 + len, buf.data); - //printf("name = %s\n", name); - assert(strlen(name) < namelen); // don't overflow the buffer - -@@ -2171,7 +2320,7 @@ TypeBasic *Type::isTypeBasic() - } - - --void Type::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void Type::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - //printf("Type::resolve() %s, %d\n", toChars(), ty); - Type *t = semantic(loc, sc); -@@ -2234,6 +2383,18 @@ Type *Type::nextOf() - return NULL; - } - -+/************************************* -+ * If this is a type of static array, return its base element type. -+ */ -+ -+Type *Type::baseElemOf() -+{ -+ Type *t = toBasetype(); -+ while (t->ty == Tsarray) -+ t = ((TypeSArray *)t)->next->toBasetype(); -+ return t; -+} -+ - /**************************************** - * Return the mask that an integral type will - * fit into. -@@ -2279,9 +2440,9 @@ void TypeError::toCBuffer(OutBuffer *buf - buf->writestring("_error_"); - } - --d_uns64 TypeError::size(Loc loc) { return 1; } --Expression *TypeError::getProperty(Loc loc, Identifier *ident) { return new ErrorExp(); } --Expression *TypeError::dotExp(Scope *sc, Expression *e, Identifier *ident) { return new ErrorExp(); } -+d_uns64 TypeError::size(Loc loc) { return SIZE_INVALID; } -+Expression *TypeError::getProperty(Loc loc, Identifier *ident, int flag) { return new ErrorExp(); } -+Expression *TypeError::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) { return new ErrorExp(); } - Expression *TypeError::defaultInit(Loc loc) { return new ErrorExp(); } - Expression *TypeError::defaultInitLiteral(Loc loc) { return new ErrorExp(); } - -@@ -2366,7 +2527,7 @@ Type *TypeNext::makeInvariant() - if (ty != Tfunction && next->ty != Tfunction && - //(next->deco || next->ty == Tfunction) && - !next->isImmutable()) -- { t->next = next->invariantOf(); -+ { t->next = next->immutableOf(); - } - if (ty == Taarray) - { -@@ -2543,11 +2704,6 @@ void TypeNext::transitive() - - /* ============================= TypeBasic =========================== */ - --TypeBasic::TypeBasic(TY ty) -- : Type(ty) --{ const char *d; -- unsigned flags; -- - #define TFLAGSintegral 1 - #define TFLAGSfloating 2 - #define TFLAGSunsigned 4 -@@ -2556,6 +2712,11 @@ TypeBasic::TypeBasic(TY ty) - #define TFLAGScomplex 0x20 - #define TFLAGSvector 0x40 // valid for a SIMD vector type - -+TypeBasic::TypeBasic(TY ty) -+ : Type(ty) -+{ const char *d; -+ unsigned flags; -+ - flags = 0; - switch (ty) - { -@@ -2745,15 +2906,11 @@ unsigned TypeBasic::alignsize() - } - - --Expression *TypeBasic::getProperty(Loc loc, Identifier *ident) -+Expression *TypeBasic::getProperty(Loc loc, Identifier *ident, int flag) - { - Expression *e; - d_int64 ivalue; --#ifdef IN_GCC -- real_t fvalue; --#else - d_float80 fvalue; --#endif - - //printf("TypeBasic::getProperty('%s')\n", ident->toChars()); - if (ident == Id::max) -@@ -2781,7 +2938,7 @@ Expression *TypeBasic::getProperty(Loc l - case Tfloat64: fvalue = DBL_MAX; goto Lfvalue; - case Tcomplex80: - case Timaginary80: -- case Tfloat80: fvalue = LDBL_MAX; goto Lfvalue; -+ case Tfloat80: fvalue = Port::ldbl_max; goto Lfvalue; - } - } - else if (ident == Id::min) -@@ -2844,7 +3001,7 @@ Expression *TypeBasic::getProperty(Loc l - case Tfloat64: - case Tfloat80: - { -- fvalue = Port::nan; -+ fvalue = Port::ldbl_nan; - goto Lfvalue; - } - } -@@ -2862,7 +3019,7 @@ Expression *TypeBasic::getProperty(Loc l - case Tfloat32: - case Tfloat64: - case Tfloat80: -- fvalue = Port::infinity; -+ fvalue = Port::ldbl_infinity; - goto Lfvalue; - } - } -@@ -2972,7 +3129,7 @@ Expression *TypeBasic::getProperty(Loc l - } - } - -- return Type::getProperty(loc, ident); -+ return Type::getProperty(loc, ident, flag); - - Livalue: - e = new IntegerExp(loc, ivalue, this); -@@ -3005,7 +3162,7 @@ Lint: - return e; - } - --Expression *TypeBasic::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeBasic::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeBasic::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -3036,7 +3193,7 @@ Expression *TypeBasic::dotExp(Scope *sc, - break; - - default: -- e = Type::getProperty(e->loc, ident); -+ e = Type::getProperty(e->loc, ident, flag); - break; - } - } -@@ -3068,47 +3225,26 @@ Expression *TypeBasic::dotExp(Scope *sc, - break; - - default: -- e = Type::getProperty(e->loc, ident); -+ e = Type::getProperty(e->loc, ident, flag); - break; - } - } - else - { -- return Type::dotExp(sc, e, ident); -+ return Type::dotExp(sc, e, ident, flag); - } -- e = e->semantic(sc); -+ if (!flag || e) -+ e = e->semantic(sc); - return e; - } - - Expression *TypeBasic::defaultInit(Loc loc) --{ dinteger_t value = 0; -- --#if SNAN_DEFAULT_INIT --#ifndef IN_GCC -- /* -- * Use a payload which is different from the machine NaN, -- * so that uninitialised variables can be -- * detected even if exceptions are disabled. -- */ -- union -- { unsigned short us[8]; -- longdouble ld; -- } snan = {{ 0, 0, 0, 0xA000, 0x7FFF }}; -- /* -- * Although long doubles are 10 bytes long, some -- * C ABIs pad them out to 12 or even 16 bytes, so -- * leave enough space in the snan array. -- */ -- assert(Target::realsize <= sizeof(snan)); -- d_float80 fvalue = snan.ld; --#else -- real_t fvalue = Port::snan; --#endif --#endif -- -+{ - #if LOGDEFAULTINIT - printf("TypeBasic::defaultInit() '%s'\n", toChars()); - #endif -+ dinteger_t value = 0; -+ - switch (ty) - { - case Tchar: -@@ -3127,7 +3263,7 @@ Expression *TypeBasic::defaultInit(Loc l - case Tfloat64: - case Tfloat80: - #if SNAN_DEFAULT_INIT -- return new RealExp(loc, fvalue, this); -+ return new RealExp(loc, Port::snan, this); - #else - return getProperty(loc, Id::nan); - #endif -@@ -3138,8 +3274,8 @@ Expression *TypeBasic::defaultInit(Loc l - #if SNAN_DEFAULT_INIT - { // Can't use fvalue + I*fvalue (the im part becomes a quiet NaN). - complex_t cvalue; -- ((real_t *)&cvalue)[0] = fvalue; -- ((real_t *)&cvalue)[1] = fvalue; -+ ((real_t *)&cvalue)[0] = Port::snan; -+ ((real_t *)&cvalue)[1] = Port::snan; - return new ComplexExp(loc, cvalue, this); - } - #else -@@ -3170,8 +3306,9 @@ int TypeBasic::isZeroInit(Loc loc) - case Tcomplex64: - case Tcomplex80: - return 0; // no -+ default: -+ return 1; // yes - } -- return 1; // yes - } - - int TypeBasic::isintegral() -@@ -3255,8 +3392,8 @@ MATCH TypeBasic::implicitConvTo(Type *to - #if DMDV2 - // If converting from integral to integral - if (tob->flags & TFLAGSintegral) -- { d_uns64 sz = size(0); -- d_uns64 tosz = tob->size(0); -+ { d_uns64 sz = size(Loc()); -+ d_uns64 tosz = tob->size(Loc()); - - /* Can't convert to smaller size - */ -@@ -3320,7 +3457,7 @@ const char *TypeVector::kind() - - Type *TypeVector::syntaxCopy() - { -- return new TypeVector(0, basetype->syntaxCopy()); -+ return new TypeVector(Loc(), basetype->syntaxCopy()); - } - - Type *TypeVector::semantic(Loc loc, Scope *sc) -@@ -3335,16 +3472,6 @@ Type *TypeVector::semantic(Loc loc, Scop - return terror; - } - TypeSArray *t = (TypeSArray *)basetype; -- -- if (sc && sc->parameterSpecialization && t->dim->op == TOKvar && -- ((VarExp *)t->dim)->var->storage_class & STCtemplateparameter) -- { -- /* It could be a template parameter N which has no value yet: -- * template Foo(T : __vector(T[N]), size_t N); -- */ -- return this; -- } -- - d_uns64 sz = t->size(loc); - if (sz != 8 && sz != 16 && sz != 32) - { error(loc, "base type of __vector must be a 8, 16 or 32 byte static array, not %s", t->toChars()); -@@ -3409,12 +3536,12 @@ unsigned TypeVector::alignsize() - return (unsigned)basetype->size(); - } - --Expression *TypeVector::getProperty(Loc loc, Identifier *ident) -+Expression *TypeVector::getProperty(Loc loc, Identifier *ident, int flag) - { -- return basetype->getProperty(loc, ident); -+ return basetype->getProperty(loc, ident, flag); - } - --Expression *TypeVector::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeVector::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeVector::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -3424,7 +3551,7 @@ Expression *TypeVector::dotExp(Scope *sc - e = e->castTo(sc, basetype); - return e; - } -- return basetype->dotExp(sc, e->castTo(sc, basetype), ident); -+ return basetype->dotExp(sc, e->castTo(sc, basetype), ident, flag); - } - - Expression *TypeVector::defaultInit(Loc loc) -@@ -3432,6 +3559,11 @@ Expression *TypeVector::defaultInit(Loc - return basetype->defaultInit(loc); - } - -+Expression *TypeVector::defaultInitLiteral(Loc loc) -+{ -+ return basetype->defaultInitLiteral(loc); -+} -+ - int TypeVector::isZeroInit(Loc loc) - { - return basetype->isZeroInit(loc); -@@ -3468,6 +3600,11 @@ MATCH TypeVector::implicitConvTo(Type *t - return MATCHnomatch; - } - -+Type *TypeVector::reliesOnTident(TemplateParameters *tparams) -+{ -+ return basetype->reliesOnTident(tparams); -+} -+ - /***************************** TypeArray *****************************/ - - TypeArray::TypeArray(TY ty, Type *next) -@@ -3475,7 +3612,7 @@ TypeArray::TypeArray(TY ty, Type *next) - { - } - --Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - Type *n = this->next->toBasetype(); // uncover any typedef's - -@@ -3485,38 +3622,48 @@ Expression *TypeArray::dotExp(Scope *sc, - - if (!n->isMutable()) - if (ident == Id::sort || ident == Id::reverse) -- error(e->loc, "can only %s a mutable array", ident->toChars()); -+ { error(e->loc, "can only %s a mutable array", ident->toChars()); -+ goto Lerror; -+ } - - if (ident == Id::reverse && (n->ty == Tchar || n->ty == Twchar)) - { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- const char *nm; -- static const char *name[2] = { "_adReverseChar", "_adReverseWchar" }; -+ static const char *reverseName[2] = { "_adReverseChar", "_adReverseWchar" }; -+ static FuncDeclaration *reverseFd[2] = { NULL, NULL }; -+ -+ int i = n->ty == Twchar; -+ if (!reverseFd[i]) { -+ Parameters *args = new Parameters; -+ Type *next = n->ty == Twchar ? Type::twchar : Type::tchar; -+ Type *arrty = next->arrayOf(); -+ args->push(new Parameter(STCin, arrty, NULL, NULL)); -+ reverseFd[i] = FuncDeclaration::genCfunc(args, arrty, reverseName[i]); -+ } - -- nm = name[n->ty == Twchar]; -- fd = FuncDeclaration::genCfunc(Type::tindex, nm); -- ec = new VarExp(0, fd); -+ Expression *ec = new VarExp(Loc(), reverseFd[i]); - e = e->castTo(sc, n->arrayOf()); // convert to dynamic array -- arguments = new Expressions(); -+ Expressions *arguments = new Expressions(); - arguments->push(e); - e = new CallExp(e->loc, ec, arguments); - e->type = next->arrayOf(); - } - else if (ident == Id::sort && (n->ty == Tchar || n->ty == Twchar)) - { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- const char *nm; -- static const char *name[2] = { "_adSortChar", "_adSortWchar" }; -+ static const char *sortName[2] = { "_adSortChar", "_adSortWchar" }; -+ static FuncDeclaration *sortFd[2] = { NULL, NULL }; -+ -+ int i = n->ty == Twchar; -+ if (!sortFd[i]) { -+ Parameters *args = new Parameters; -+ Type *next = n->ty == Twchar ? Type::twchar : Type::tchar; -+ Type *arrty = next->arrayOf(); -+ args->push(new Parameter(STCin, arrty, NULL, NULL)); -+ sortFd[i] = FuncDeclaration::genCfunc(args, arrty, sortName[i]); -+ } - -- nm = name[n->ty == Twchar]; -- fd = FuncDeclaration::genCfunc(Type::tindex, nm); -- ec = new VarExp(0, fd); -+ Expression *ec = new VarExp(Loc(), sortFd[i]); - e = e->castTo(sc, n->arrayOf()); // convert to dynamic array -- arguments = new Expressions(); -+ Expressions *arguments = new Expressions(); - arguments->push(e); - e = new CallExp(e->loc, ec, arguments); - e->type = next->arrayOf(); -@@ -3532,29 +3679,53 @@ Expression *TypeArray::dotExp(Scope *sc, - Expression *olde = e; - assert(size); - dup = (ident == Id::dup || ident == Id::idup); -- fd = FuncDeclaration::genCfunc(Type::tindex, dup ? Id::adDup : Id::adReverse); -- ec = new VarExp(0, fd); -+ -+ if (dup) { -+ static FuncDeclaration *adDup_fd = NULL; -+ if (!adDup_fd) { -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, Type::dtypeinfo->type, NULL, NULL)); -+ args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); -+ adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup); -+ } -+ fd = adDup_fd; -+ } else { -+ static FuncDeclaration *adReverse_fd = NULL; -+ if (!adReverse_fd) { -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); -+ args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); -+ adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse); -+ } -+ fd = adReverse_fd; -+ } -+ -+ ec = new VarExp(Loc(), fd); - e = e->castTo(sc, n->arrayOf()); // convert to dynamic array - arguments = new Expressions(); - if (dup) - arguments->push(getTypeInfo(sc)); - arguments->push(e); - if (!dup) -- arguments->push(new IntegerExp(0, size, Type::tsize_t)); -+ arguments->push(new IntegerExp(Loc(), size, Type::tsize_t)); - e = new CallExp(e->loc, ec, arguments); - if (ident == Id::idup) -- { Type *einv = next->invariantOf(); -+ { Type *einv = next->immutableOf(); - if (next->implicitConvTo(einv) < MATCHconst) -- error(e->loc, "cannot implicitly convert element type %s to immutable in %s.idup", -+ { error(e->loc, "cannot implicitly convert element type %s to immutable in %s.idup", - next->toChars(), olde->toChars()); -+ goto Lerror; -+ } - e->type = einv->arrayOf(); - } - else if (ident == Id::dup) - { - Type *emut = next->mutableOf(); - if (next->implicitConvTo(emut) < MATCHconst) -- error(e->loc, "cannot implicitly convert element type %s to mutable in %s.dup", -+ { error(e->loc, "cannot implicitly convert element type %s to mutable in %s.dup", - next->toChars(), olde->toChars()); -+ goto Lerror; -+ } - e->type = emut->arrayOf(); - } - else -@@ -3562,12 +3733,17 @@ Expression *TypeArray::dotExp(Scope *sc, - } - else if (ident == Id::sort) - { -+ static FuncDeclaration *fd = NULL; - Expression *ec; -- FuncDeclaration *fd; - Expressions *arguments; - -- fd = FuncDeclaration::genCfunc(tint32->arrayOf(), "_adSort"); -- ec = new VarExp(0, fd); -+ if (!fd) { -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, Type::tvoid->arrayOf(), NULL, NULL)); -+ args->push(new Parameter(STCin, Type::dtypeinfo->type, NULL, NULL)); -+ fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort"); -+ } -+ ec = new VarExp(Loc(), fd); - e = e->castTo(sc, n->arrayOf()); // convert to dynamic array - arguments = new Expressions(); - arguments->push(e); -@@ -3579,10 +3755,14 @@ Expression *TypeArray::dotExp(Scope *sc, - } - else - { -- e = Type::dotExp(sc, e, ident); -+ e = Type::dotExp(sc, e, ident, flag); - } -- e = e->semantic(sc); -+ if (!flag || e) -+ e = e->semantic(sc); - return e; -+ -+Lerror: -+ return new ErrorExp(); - } - - -@@ -3627,8 +3807,8 @@ d_uns64 TypeSArray::size(Loc loc) - return sz; - - Loverflow: -- error(loc, "index %lld overflow for static array", sz); -- return 1; -+ error(loc, "index %lld overflow for static array", (long long)sz); -+ return SIZE_INVALID; - } - - unsigned TypeSArray::alignsize() -@@ -3643,16 +3823,24 @@ unsigned TypeSArray::alignsize() - Expression *semanticLength(Scope *sc, Type *t, Expression *exp) - { - if (t->ty == Ttuple) -- { ScopeDsymbol *sym = new ArrayScopeSymbol(sc, (TypeTuple *)t); -+ { -+ ScopeDsymbol *sym = new ArrayScopeSymbol(sc, (TypeTuple *)t); - sym->parent = sc->scopesym; - sc = sc->push(sym); - -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); -+ sc = sc->endCTFE(); - - sc->pop(); - } - else -+ { -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); -+ sc = sc->endCTFE(); -+ } -+ - return exp; - } - -@@ -3662,45 +3850,52 @@ Expression *semanticLength(Scope *sc, Tu - sym->parent = sc->scopesym; - sc = sc->push(sym); - -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); -+ sc = sc->endCTFE(); - - sc->pop(); - return exp; - } - --void TypeSArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeSArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - //printf("TypeSArray::resolve() %s\n", toChars()); -- next->resolve(loc, sc, pe, pt, ps); -+ next->resolve(loc, sc, pe, pt, ps, intypeid); - //printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt); - if (*pe) -- { // It's really an index expression -+ { -+ // It's really an index expression - Expressions *exps = new Expressions(); - exps->setDim(1); - (*exps)[0] = dim; -- Expression *e = new ArrayExp(loc, *pe, exps); -- *pe = e; -+ if (Dsymbol *s = getDsymbol(*pe)) -+ *pe = new DsymbolExp(loc, s, 1); -+ *pe = new ArrayExp(loc, *pe, exps); - } - else if (*ps) -- { Dsymbol *s = *ps; -+ { -+ Dsymbol *s = *ps; - TupleDeclaration *td = s->isTupleDeclaration(); - if (td) - { - ScopeDsymbol *sym = new ArrayScopeSymbol(sc, td); - sym->parent = sc->scopesym; - sc = sc->push(sym); -- -+ sc = sc->startCTFE(); - dim = dim->semantic(sc); -+ sc = sc->endCTFE(); -+ sc = sc->pop(); -+ - dim = dim->ctfeInterpret(); - uinteger_t d = dim->toUInteger(); - -- sc = sc->pop(); -- - if (d >= td->objects->dim) -- { error(loc, "tuple index %llu exceeds length %u", d, td->objects->dim); -+ { -+ error(loc, "tuple index %llu exceeds length %u", d, td->objects->dim); - goto Ldefault; - } -- Object *o = (*td->objects)[(size_t)d]; -+ RootObject *o = (*td->objects)[(size_t)d]; - if (o->dyncast() == DYNCAST_DSYMBOL) - { - *ps = (Dsymbol *)o; -@@ -3746,7 +3941,7 @@ void TypeSArray::resolve(Loc loc, Scope - else - { - Ldefault: -- Type::resolve(loc, sc, pe, pt, ps); -+ Type::resolve(loc, sc, pe, pt, ps, intypeid); - } - } - -@@ -3769,7 +3964,7 @@ Type *TypeSArray::semantic(Loc loc, Scop - { error(loc, "tuple index %llu exceeds %u", d, sd->objects->dim); - return Type::terror; - } -- Object *o = (*sd->objects)[(size_t)d]; -+ RootObject *o = (*sd->objects)[(size_t)d]; - if (o->dyncast() != DYNCAST_TYPE) - { error(loc, "%s is not a type", toChars()); - return Type::terror; -@@ -3778,7 +3973,7 @@ Type *TypeSArray::semantic(Loc loc, Scop - return t; - } - -- Type *tn = next->semantic(loc,sc); -+ Type *tn = next->semantic(loc, sc); - if (tn->ty == Terror) - return terror; - -@@ -3793,14 +3988,6 @@ Type *TypeSArray::semantic(Loc loc, Scop - goto Lerror; - - dim = dim->optimize(WANTvalue); -- if (sc && sc->parameterSpecialization && dim->op == TOKvar && -- ((VarExp *)dim)->var->storage_class & STCtemplateparameter) -- { -- /* It could be a template parameter N which has no value yet: -- * template Foo(T : T[N], size_t N); -- */ -- return this; -- } - dim = dim->ctfeInterpret(); - errors = global.errors; - dinteger_t d1 = dim->toInteger(); -@@ -3825,6 +4012,7 @@ Type *TypeSArray::semantic(Loc loc, Scop - tbn->ty == Tarray || - tbn->ty == Tsarray || - tbn->ty == Taarray || -+ (tbn->ty == Tstruct && (((TypeStruct *)tbn)->sym->sizeok == SIZEOKdone)) || - tbn->ty == Tclass) - { - /* Only do this for types that don't need to have semantic() -@@ -3859,18 +4047,12 @@ Type *TypeSArray::semantic(Loc loc, Scop - Parameter *arg = (*tt->arguments)[(size_t)d]; - return arg->type->addMod(this->mod); - } -- case Tstruct: -- { TypeStruct *ts = (TypeStruct *)tbn; -- if (0 && ts->sym->isnested) -- { error(loc, "cannot have static array of inner struct %s", ts->toChars()); -- goto Lerror; -- } -- break; -- } - case Tfunction: - case Tnone: - error(loc, "can't have array of %s", tbn->toChars()); - goto Lerror; -+ default: -+ break; - } - if (tbn->isscope()) - { error(loc, "cannot have array of scope %s", tbn->toChars()); -@@ -3890,6 +4072,19 @@ Lerror: - return Type::terror; - } - -+// Make corresponding static array type without semantic -+Type *TypeSArray::makeType(Loc loc, Type *tn, dinteger_t dim) -+{ -+ assert(tn->deco); -+ Type *t = new TypeSArray(tn, new IntegerExp(loc, dim, Type::tindex)); -+ -+ // according to TypeSArray::semantic() -+ t = t->addMod(tn->mod); -+ t = t->merge(); -+ -+ return t; -+} -+ - void TypeSArray::toDecoBuffer(OutBuffer *buf, int flag) - { - Type::toDecoBuffer(buf, flag); -@@ -3911,10 +4106,12 @@ void TypeSArray::toCBuffer2(OutBuffer *b - return; - } - next->toCBuffer2(buf, hgs, this->mod); -- buf->printf("[%s]", dim->toChars()); -+ buf->writeByte('['); -+ sizeToCBuffer(buf, hgs, dim); -+ buf->writeByte(']'); - } - --Expression *TypeSArray::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeSArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeSArray::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -3937,9 +4134,10 @@ Expression *TypeSArray::dotExp(Scope *sc - } - else - { -- e = TypeArray::dotExp(sc, e, ident); -+ e = TypeArray::dotExp(sc, e, ident, flag); - } -- e = e->semantic(sc); -+ if (!flag || e) -+ e = e->semantic(sc); - return e; - } - -@@ -4036,7 +4234,10 @@ Expression *TypeSArray::defaultInit(Loc - #if LOGDEFAULTINIT - printf("TypeSArray::defaultInit() '%s'\n", toChars()); - #endif -- return next->defaultInit(loc); -+ if (next->ty == Tvoid) -+ return tuns8->defaultInit(loc); -+ else -+ return next->defaultInit(loc); - } - - int TypeSArray::isZeroInit(Loc loc) -@@ -4064,12 +4265,16 @@ Expression *TypeSArray::defaultInitLiter - printf("TypeSArray::defaultInitLiteral() '%s'\n", toChars()); - #endif - size_t d = dim->toInteger(); -- Expression *elementinit = next->defaultInitLiteral(loc); -+ Expression *elementinit; -+ if (next->ty == Tvoid) -+ elementinit = tuns8->defaultInitLiteral(loc); -+ else -+ elementinit = next->defaultInitLiteral(loc); - Expressions *elements = new Expressions(); - elements->setDim(d); - for (size_t i = 0; i < d; i++) - (*elements)[i] = elementinit; -- ArrayLiteralExp *ae = new ArrayLiteralExp(0, elements); -+ ArrayLiteralExp *ae = new ArrayLiteralExp(Loc(), elements); - ae->type = this; - return ae; - } -@@ -4151,31 +4356,29 @@ Type *TypeDArray::semantic(Loc loc, Scop - error(loc, "can't have array of %s", tbn->toChars()); - case Terror: - return Type::terror; -- -- case Tstruct: -- { TypeStruct *ts = (TypeStruct *)tbn; -- if (0 && ts->sym->isnested) -- error(loc, "cannot have dynamic array of inner struct %s", ts->toChars()); -+ default: - break; -- } - } - if (tn->isscope()) -- error(loc, "cannot have array of scope %s", tn->toChars()); -- -+ { error(loc, "cannot have array of scope %s", tn->toChars()); -+ return Type::terror; -+ } - next = tn; - transitive(); - return merge(); - } - --void TypeDArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeDArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - //printf("TypeDArray::resolve() %s\n", toChars()); -- next->resolve(loc, sc, pe, pt, ps); -+ next->resolve(loc, sc, pe, pt, ps, intypeid); - //printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt); - if (*pe) -- { // It's really a slice expression -- Expression *e = new SliceExp(loc, *pe, NULL, NULL); -- *pe = e; -+ { -+ // It's really a slice expression -+ if (Dsymbol *s = getDsymbol(*pe)) -+ *pe = new DsymbolExp(loc, s, 1); -+ *pe = new SliceExp(loc, *pe, NULL, NULL); - } - else if (*ps) - { -@@ -4188,7 +4391,7 @@ void TypeDArray::resolve(Loc loc, Scope - else - { - Ldefault: -- Type::resolve(loc, sc, pe, pt, ps); -+ Type::resolve(loc, sc, pe, pt, ps, intypeid); - } - } - -@@ -4213,7 +4416,7 @@ void TypeDArray::toCBuffer2(OutBuffer *b - } - } - --Expression *TypeDArray::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeDArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeDArray::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -4238,7 +4441,7 @@ Expression *TypeDArray::dotExp(Scope *sc - } - else - { -- e = TypeArray::dotExp(sc, e, ident); -+ e = TypeArray::dotExp(sc, e, ident, flag); - } - return e; - } -@@ -4268,7 +4471,7 @@ MATCH TypeDArray::implicitConvTo(Type *t - return MATCHconvert; - } - -- return next->constConv(to) ? MATCHconvert : MATCHnomatch; -+ return next->constConv(tp->next) ? MATCHconvert : MATCHnomatch; - } - - if (to->ty == Tarray) -@@ -4334,7 +4537,7 @@ TypeAArray::TypeAArray(Type *t, Type *in - { - this->index = index; - this->impl = NULL; -- this->loc = 0; -+ this->loc = Loc(); - this->sc = NULL; - } - -@@ -4383,22 +4586,23 @@ Type *TypeAArray::semantic(Loc loc, Scop - - index->resolve(loc, sc, &e, &t, &s); - if (e) -- { // It was an expression - -+ { -+ // It was an expression - - // Rewrite as a static array -- TypeSArray *tsa; -- -- tsa = new TypeSArray(next, e); -- return tsa->semantic(loc,sc); -+ TypeSArray *tsa = new TypeSArray(next, e); -+ return tsa->semantic(loc, sc); - } - else if (t) -- index = t; -+ index = t->semantic(loc, sc); - else -- { index->error(loc, "index is not a type or an expression"); -+ { -+ index->error(loc, "index is not a type or an expression"); - return Type::terror; - } - } - else - index = index->semantic(loc,sc); -+ index = index->merge2(); - - if (index->nextOf() && !index->nextOf()->isImmutable()) - { -@@ -4425,7 +4629,7 @@ printf("index->ito->ito = x%x\n", index- - case Terror: - return Type::terror; - } -- next = next->semantic(loc,sc); -+ next = next->semantic(loc,sc)->merge2(); - transitive(); - - switch (next->toBasetype()->ty) -@@ -4458,7 +4662,7 @@ StructDeclaration *TypeAArray::getImpl() - next = terror; - - // Head off future failures -- StructDeclaration *s = new StructDeclaration(0, NULL); -+ StructDeclaration *s = new StructDeclaration(Loc(), NULL); - s->type = terror; - impl = s; - return impl; -@@ -4489,9 +4693,13 @@ StructDeclaration *TypeAArray::getImpl() - dti->semantic(sc); - TemplateInstance *ti = dti->ti; - #endif -- ti->semantic(sc); -- ti->semantic2(sc); -- ti->semantic3(sc); -+ // Instantiate on the root module of import dependency graph. -+ Scope *scx = sc->push(sc->module->importedFrom); -+ scx->instantiatingModule = sc->module->importedFrom; -+ ti->semantic(scx); -+ ti->semantic2(scx); -+ ti->semantic3(scx); -+ scx->pop(); - impl = ti->toAlias()->isStructDeclaration(); - #ifdef DEBUG - if (!impl) -@@ -4504,7 +4712,7 @@ StructDeclaration *TypeAArray::getImpl() - return impl; - } - --void TypeAArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeAArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - //printf("TypeAArray::resolve() %s\n", toChars()); - -@@ -4516,92 +4724,29 @@ void TypeAArray::resolve(Loc loc, Scope - Type *t; - Dsymbol *s; - -- index->resolve(loc, sc, &e, &t, &s); -+ index->resolve(loc, sc, &e, &t, &s, intypeid); - if (e) -- { // It was an expression - -+ { -+ // It was an expression - - // Rewrite as a static array -- - TypeSArray *tsa = new TypeSArray(next, e); -- return tsa->addMod(this->mod)->resolve(loc, sc, pe, pt, ps); -+ tsa->mod = this->mod; // just copy mod field so tsa's semantic is not yet done -+ return tsa->resolve(loc, sc, pe, pt, ps, intypeid); - } - else if (t) - index = t; - else - index->error(loc, "index is not a type or an expression"); - } -- Type::resolve(loc, sc, pe, pt, ps); -+ Type::resolve(loc, sc, pe, pt, ps, intypeid); - } - - --Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeAArray::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); - #endif --#if 0 -- if (ident == Id::length) -- { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- -- fd = FuncDeclaration::genCfunc(Type::tsize_t, Id::aaLen); -- ec = new VarExp(0, fd); -- arguments = new Expressions(); -- arguments->push(e); -- e = new CallExp(e->loc, ec, arguments); -- e->type = ((TypeFunction *)fd->type)->next; -- } -- else -- if (ident == Id::keys) -- { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- int size = index->size(e->loc); -- -- assert(size); -- fd = FuncDeclaration::genCfunc(Type::tindex, Id::aaKeys); -- ec = new VarExp(0, fd); -- arguments = new Expressions(); -- arguments->push(e); -- arguments->push(new IntegerExp(0, size, Type::tsize_t)); -- e = new CallExp(e->loc, ec, arguments); -- e->type = index->arrayOf(); -- } -- else if (ident == Id::values) -- { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- -- fd = FuncDeclaration::genCfunc(Type::tindex, Id::aaValues); -- ec = new VarExp(0, fd); -- arguments = new Expressions(); -- arguments->push(e); -- size_t keysize = index->size(e->loc); -- keysize = (keysize + Target::ptrsize - 1) & ~(Target::ptrsize - 1); -- arguments->push(new IntegerExp(0, keysize, Type::tsize_t)); -- arguments->push(new IntegerExp(0, next->size(e->loc), Type::tsize_t)); -- e = new CallExp(e->loc, ec, arguments); -- e->type = next->arrayOf(); -- } -- else if (ident == Id::rehash) -- { -- Expression *ec; -- FuncDeclaration *fd; -- Expressions *arguments; -- -- fd = FuncDeclaration::genCfunc(Type::tint64, Id::aaRehash); -- ec = new VarExp(0, fd); -- arguments = new Expressions(); -- arguments->push(e->addressOf(sc)); -- arguments->push(index->getInternalTypeInfo(sc)); -- e = new CallExp(e->loc, ec, arguments); -- e->type = this; -- } -- else --#endif - if (ident != Id::__sizeof && - ident != Id::__xalignof && - ident != Id::init && -@@ -4609,15 +4754,13 @@ Expression *TypeAArray::dotExp(Scope *sc - ident != Id::stringof && - ident != Id::offsetof) - { --//printf("test1: %s, %s\n", e->toChars(), e->type->toChars()); - Type *t = getImpl()->type; --//printf("test2: %s, %s\n", e->toChars(), e->type->toChars()); -+ e = e->copy(); - e->type = t; -- e = t->dotExp(sc, e, ident); --//printf("test3: %s, %s\n", e->toChars(), e->type->toChars()); -+ e = t->dotExp(sc, e, ident, flag); - } - else -- e = Type::dotExp(sc, e, ident); -+ e = Type::dotExp(sc, e, ident, flag); - return e; - } - -@@ -4779,6 +4922,8 @@ Type *TypePointer::semantic(Loc loc, Sco - error(loc, "can't have pointer to %s", n->toChars()); - case Terror: - return Type::terror; -+ default: -+ break; - } - if (n != next) - { -@@ -4789,7 +4934,7 @@ Type *TypePointer::semantic(Loc loc, Sco - { transitive(); - return merge(); - } --#if 1 -+#if 0 - return merge(); - #else - deco = merge()->deco; -@@ -4967,14 +5112,14 @@ void TypeReference::toCBuffer2(OutBuffer - buf->writeByte('&'); - } - --Expression *TypeReference::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeReference::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeReference::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); - #endif - - // References just forward things along -- return next->dotExp(sc, e, ident); -+ return next->dotExp(sc, e, ident, flag); - } - - Expression *TypeReference::defaultInit(Loc loc) -@@ -4993,7 +5138,7 @@ int TypeReference::isZeroInit(Loc loc) - - /***************************** TypeFunction *****************************/ - --TypeFunction::TypeFunction(Parameters *parameters, Type *treturn, int varargs, enum LINK linkage, StorageClass stc) -+TypeFunction::TypeFunction(Parameters *parameters, Type *treturn, int varargs, LINK linkage, StorageClass stc) - : TypeNext(Tfunction, treturn) - { - //if (!treturn) *(char*)0=0; -@@ -5034,13 +5179,6 @@ const char *TypeFunction::kind() - return "function"; - } - --TypeFunction *TypeFunction::copy() --{ -- TypeFunction *tf = (TypeFunction *)mem.malloc(sizeof(TypeFunction)); -- memcpy(tf, this, sizeof(TypeFunction)); -- return tf; --} -- - Type *TypeFunction::syntaxCopy() - { - Type *treturn = next ? next->syntaxCopy() : NULL; -@@ -5051,6 +5189,7 @@ Type *TypeFunction::syntaxCopy() - t->purity = purity; - t->isproperty = isproperty; - t->isref = isref; -+ t->iswild = iswild; - t->trust = trust; - t->fargs = fargs; - return t; -@@ -5110,12 +5249,7 @@ int Type::covariant(Type *t, StorageClas - - if (!arg1->type->equals(arg2->type)) - { --#if 0 // turn on this for contravariant argument types, see bugzilla 3075 -- // BUG: cannot convert ref to const to ref to immutable -- // We can add const, but not subtract it -- if (arg2->type->implicitConvTo(arg1->type) < MATCHconst) --#endif -- goto Ldistinct; -+ goto Ldistinct; - } - const StorageClass sc = STCref | STCin | STCout | STClazy; - if ((arg1->storageClass & sc) != (arg2->storageClass & sc)) -@@ -5161,13 +5295,9 @@ int Type::covariant(Type *t, StorageClas - - // If t1n is forward referenced: - ClassDeclaration *cd = ((TypeClass *)t1n)->sym; --// if (cd->scope) --// cd->semantic(NULL); --#if 0 -- if (!cd->baseClass && cd->baseclasses->dim && !cd->isInterfaceDeclaration()) --#else -+ if (cd->scope) -+ cd->semantic(NULL); - if (!cd->isBaseInfoComplete()) --#endif - { - return 3; // forward references - } -@@ -5180,7 +5310,8 @@ int Type::covariant(Type *t, StorageClas - } - else if (t1n->ty == t2n->ty && t1n->implicitConvTo(t2n)) - goto Lcovariant; -- else if (t1n->ty == Tnull && t1n->implicitConvTo(t2n)) -+ else if (t1n->ty == Tnull && t1n->implicitConvTo(t2n) && -+ t1n->size() == t2n->size()) - goto Lcovariant; - } - goto Lnotcovariant; -@@ -5193,11 +5324,15 @@ Lcovariant: - */ - if (!MODimplicitConv(t2->mod, t1->mod)) - { -+#if 0//stop attribute inference with const - // If adding 'const' will make it covariant - if (MODimplicitConv(t2->mod, MODmerge(t1->mod, MODconst))) - stc |= STCconst; - else - goto Lnotcovariant; -+#else -+ goto Ldistinct; -+#endif - } - - /* Can convert pure to impure, and nothrow to throw -@@ -5476,13 +5611,13 @@ Type *TypeFunction::semantic(Loc loc, Sc - * This can produce redundant copies if inferring return type, - * as semantic() will get called again on this. - */ -- TypeFunction *tf = copy(); -+ TypeFunction *tf = (TypeFunction *)copy(); - if (parameters) - { tf->parameters = (Parameters *)parameters->copy(); - for (size_t i = 0; i < parameters->dim; i++) - { Parameter *arg = (*parameters)[i]; - Parameter *cpy = (Parameter *)mem.malloc(sizeof(Parameter)); -- memcpy(cpy, arg, sizeof(Parameter)); -+ memcpy((void*)cpy, (void*)arg, sizeof(Parameter)); - (*tf->parameters)[i] = cpy; - } - } -@@ -5505,7 +5640,7 @@ Type *TypeFunction::semantic(Loc loc, Sc - tf->isproperty = TRUE; - - tf->linkage = sc->linkage; -- -+#if 0 - /* If the parent is @safe, then this function defaults to safe - * too. - * If the parent's @safe-ty is inferred, then this function's @safe-ty needs -@@ -5521,7 +5656,7 @@ Type *TypeFunction::semantic(Loc loc, Sc - break; - } - } -- -+#endif - bool wildreturn = FALSE; - if (tf->next) - { -@@ -5529,18 +5664,30 @@ Type *TypeFunction::semantic(Loc loc, Sc - sc->stc &= ~(STC_TYPECTOR | STC_FUNCATTR); - tf->next = tf->next->semantic(loc,sc); - sc = sc->pop(); -- if (tf->next->toBasetype()->ty == Tfunction) -- { error(loc, "functions cannot return a function"); -+ Type *tb = tf->next->toBasetype(); -+ if (tb->ty == Tfunction) -+ { -+ error(loc, "functions cannot return a function"); - tf->next = Type::terror; - } -- if (tf->next->toBasetype()->ty == Ttuple) -- { error(loc, "functions cannot return a tuple"); -+ else if (tb->ty == Ttuple) -+ { -+ error(loc, "functions cannot return a tuple"); - tf->next = Type::terror; - } -+ else if (tb->ty == Tstruct) -+ { -+ StructDeclaration *sd = ((TypeStruct *)tb)->sym; -+ if (sd->isforwardRef()) -+ { -+ error(loc, "cannot return opaque struct %s by value", tb->toChars()); -+ tf->next = Type::terror; -+ } -+ } -+ else if (tb->ty == Tvoid) -+ tf->isref = FALSE; // rewrite "ref void" as just "void" - if (tf->next->isscope() && !(sc->flags & SCOPEctor)) - error(loc, "functions cannot return scope %s", tf->next->toChars()); -- if (tf->next->toBasetype()->ty == Tvoid) -- tf->isref = FALSE; // rewrite "ref void" as just "void" - if (tf->next->hasWild() && - !(tf->next->ty == Tpointer && tf->next->nextOf()->ty == Tfunction || tf->next->ty == Tdelegate)) - wildreturn = TRUE; -@@ -5574,15 +5721,27 @@ Type *TypeFunction::semantic(Loc loc, Sc - - Type *t = fparam->type->toBasetype(); - -- if (fparam->storageClass & (STCout | STCref | STClazy)) -- { -- //if (t->ty == Tsarray) -- //error(loc, "cannot have out or ref parameter of type %s", t->toChars()); -- if (fparam->storageClass & STCout && fparam->type->mod & (STCconst | STCimmutable)) -- error(loc, "cannot have const or immutable out parameter of type %s", t->toChars()); -- } - if (!(fparam->storageClass & STClazy) && t->ty == Tvoid) - error(loc, "cannot have parameter of type %s", fparam->type->toChars()); -+ if (fparam->storageClass & (STCref | STClazy)) -+ { -+ } -+ else if (fparam->storageClass & STCout) -+ { -+ if (unsigned m = fparam->type->mod & (MODimmutable | MODconst | MODwild)) -+ error(loc, "cannot have %s out parameter of type %s", MODtoChars(m), t->toChars()); -+ else -+ { -+ Type *tv = t; -+ while (tv->ty == Tsarray) -+ tv = tv->nextOf()->toBasetype(); -+ if (tv->ty == Tstruct && ((TypeStruct *)tv)->sym->noDefaultCtor) -+ { -+ error(loc, "cannot have out parameter of type %s because the default construction is disbaled", -+ fparam->type->toChars()); -+ } -+ } -+ } - - if (t->hasWild() && - !(t->ty == Tpointer && t->nextOf()->ty == Tfunction || t->ty == Tdelegate)) -@@ -5658,7 +5817,10 @@ Type *TypeFunction::semantic(Loc loc, Sc - if (fparam->storageClass & STCauto) - { - if (fargs && i < fargs->dim) -- { Expression *farg = (*fargs)[i]; -+ { -+ Expression *farg = (*fargs)[i]; -+ if (Expression *e = farg->isTemp()) -+ farg = e; - if (farg->isLvalue()) - ; // ref parameter - else -@@ -5703,168 +5865,78 @@ Type *TypeFunction::semantic(Loc loc, Sc - } - - --Type *getIndirection(Type *t) --{ -- t = t->toBasetype(); -- -- if (t->ty == Tsarray) -- { while (t->ty == Tsarray) -- t = t->nextOf()->toBasetype(); -- } -- if (t->ty == Tarray || t->ty == Tpointer) -- return t->nextOf()->toBasetype(); -- if (t->ty == Taarray || t->ty == Tclass) -- return t; -- if (t->ty == Tstruct) -- return t->hasPointers() ? t : NULL; // TODO -- -- // should consider TypeDelegate? -- return NULL; --} -- - /******************************************** - * Do this lazily, as the parameter types might be forward referenced. - */ - void TypeFunction::purityLevel() - { -- //printf("purityLevel(%s)\n", toChars()); -- - TypeFunction *tf = this; -- if (tf->purity == PUREfwdref && tf->next) -+ if (tf->purity == PUREfwdref) - { /* Evaluate what kind of purity based on the modifiers for the parameters - */ -- enum PURE purity = PUREstrong; // assume strong until something weakens it -- size_t dim = Parameter::dim(tf->parameters); -- -- if (dim) -+ tf->purity = PUREstrong; // assume strong until something weakens it -+ if (tf->parameters) - { -- Type *tret = tf->next; -- assert(tret); -- Type *treti = tf->isref ? tret->toBasetype() : getIndirection(tret); -- if (treti && (treti->mod & MODimmutable)) -- treti = NULL; // indirection is immutable -- //printf(" tret = %s, treti = %s\n", tret->toChars(), treti ? treti->toChars() : "NULL"); -- -+ size_t dim = Parameter::dim(tf->parameters); - for (size_t i = 0; i < dim; i++) - { Parameter *fparam = Parameter::getNth(tf->parameters, i); - if (fparam->storageClass & STClazy) - { -- purity = PUREweak; -+ tf->purity = PUREweak; - break; - } - if (fparam->storageClass & STCout) - { -- purity = PUREweak; -+ tf->purity = PUREweak; - break; - } - if (!fparam->type) - continue; -- -- Type *tprm = fparam->type; -- Type *tprmi = fparam->storageClass & STCref ? tprm->toBasetype() : getIndirection(tprm); -- //printf(" [%d] tprm = %s, tprmi = %s\n", i, tprm->toChars(), tprmi ? tprmi->toChars() : "NULL"); -- -- if (!tprmi || (tprmi->mod & MODimmutable)) -- continue; // there is no mutable indirection -- if (tprmi->isMutable()) -- { purity = PUREweak; // indirection is mutable -- break; -+ if (fparam->storageClass & STCref) -+ { -+ if (!(fparam->type->mod & (MODconst | MODimmutable | MODwild))) -+ { tf->purity = PUREweak; -+ break; -+ } -+ if (fparam->type->mod & MODconst) -+ { tf->purity = PUREconst; -+ continue; -+ } - } -- if (!treti) -- continue; // mutable indirection is never returned -- -- if (purity < PUREstrong) -+ Type *t = fparam->type->toBasetype(); -+ if (!t->hasPointers()) - continue; -- -- // Determine the parameter is really PUREconst or not -- assert(tprmi->mod & (MODconst | MODwild)); -- if (tprmi->constConv(treti)) // simple case -- purity = PUREconst; -- else if (tprmi->invariantOf()->equals(treti->invariantOf())) -+ if (t->mod & MODimmutable) -+ continue; -+ /* The rest of this is too strict; fix later. -+ * For example, the only pointer members of a struct may be immutable, -+ * which would maintain strong purity. -+ */ -+ if (t->mod & (MODconst | MODwild)) -+ { tf->purity = PUREconst; - continue; -- else -- { -- /* The rest of this is little strict; fix later. -- * For example: -- * -- * struct S { immutable* p; } -- * pure S foo(const int* p); -- * -- * which would maintain strong purity. -- */ -- if (tprmi->hasPointers() || treti->hasPointers()) -- purity = PUREconst; - } -- -+ Type *tn = t->nextOf(); -+ if (tn) -+ { tn = tn->toBasetype(); -+ if (tn->ty == Tpointer || tn->ty == Tarray) -+ { /* Accept immutable(T)* and immutable(T)[] as being strongly pure -+ */ -+ if (tn->mod & MODimmutable) -+ continue; -+ if (tn->mod & (MODconst | MODwild)) -+ { tf->purity = PUREconst; -+ continue; -+ } -+ } -+ } - /* Should catch delegates and function pointers, and fold in their purity - */ -+ tf->purity = PUREweak; // err on the side of too strict -+ break; - } - } -- -- //printf(" --> purity: %d\n", purity); -- tf->purity = purity; -- } --} -- --/******************************************** -- * FIXME: This function is a workaround for fixing Bugzilla 9210. -- * In 2.061, TypeFunction::purityLevel() improved to make more functions -- * strong purity, but immutable conversion on return statemet had broken by that. -- * Because, it is essentially unrelated to PUREstrong. This function is -- * necessary to check the convertibility. -- */ --bool TypeFunction::hasMutableIndirectionParams() --{ -- TypeFunction *tf = this; -- size_t dim = Parameter::dim(tf->parameters); -- for (size_t i = 0; i < dim; i++) -- { -- Parameter *fparam = Parameter::getNth(tf->parameters, i); -- if (fparam->storageClass & STClazy) -- { -- return true; -- } -- if (fparam->storageClass & STCout) -- { -- return true; -- } -- if (!fparam->type) -- continue; -- if (fparam->storageClass & STCref) -- { -- if (!(fparam->type->mod & (MODconst | MODimmutable | MODwild))) -- return true; -- if (fparam->type->mod & MODconst) -- return true; -- } -- Type *t = fparam->type->toBasetype(); -- if (!t->hasPointers()) -- continue; -- if (t->mod & (MODimmutable | MODwild)) -- continue; -- /* The rest of this is too strict; fix later. -- * For example, the only pointer members of a struct may be immutable, -- * which would maintain strong purity. -- */ -- if (t->mod & MODconst) -- return true; -- Type *tn = t->nextOf(); -- if (tn) -- { tn = tn->toBasetype(); -- if (tn->ty == Tpointer || tn->ty == Tarray) -- { /* Accept immutable(T)* and immutable(T)[] as being strongly pure -- */ -- if (tn->mod & (MODimmutable | MODwild)) -- continue; -- if (tn->mod & MODconst) -- return true; -- } -- } -- /* Should catch delegates and function pointers, and fold in their purity -- */ -- return true; - } -- return false; - } - - -@@ -5877,14 +5949,14 @@ bool TypeFunction::hasMutableIndirection - * MATCHxxxx - */ - --MATCH TypeFunction::callMatch(Expression *ethis, Expressions *args, int flag) -+MATCH TypeFunction::callMatch(Type *tthis, Expressions *args, int flag) - { - //printf("TypeFunction::callMatch() %s\n", toChars()); - MATCH match = MATCHexact; // assume exact match - unsigned wildmatch = 0; - -- if (ethis) -- { Type *t = ethis->type; -+ if (tthis) -+ { Type *t = tthis; - if (t->toBasetype()->ty == Tpointer) - t = t->toBasetype()->nextOf(); // change struct* to struct - if (t->mod != mod) -@@ -5971,6 +6043,8 @@ MATCH TypeFunction::callMatch(Expression - { - Expression *arg = (*args)[u]; - assert(arg); -+ if (Expression *e = arg->isTemp()) -+ arg = e; - - if (arg->op == TOKfunction) - { -@@ -5999,24 +6073,37 @@ MATCH TypeFunction::callMatch(Expression - - // Non-lvalues do not match ref or out parameters - if (p->storageClass & STCref) -- { if (m && !arg->isLvalue()) -+ { -+ Type *targb = targ->toBasetype(); -+ Type *tprmb = tprm->toBasetype(); -+ //printf("%s\n", targb->toChars()); -+ //printf("%s\n", tprmb->toChars()); -+ -+ if (m && !arg->isLvalue()) - { -- Type *ta = targ->aliasthisOf(); -- if (arg->op == TOKstring && tprm->ty == Tsarray) -- { if (targ->ty != Tsarray) -- targ = new TypeSArray(targ->nextOf(), -- new IntegerExp(0, ((StringExp *)arg)->len, -- Type::tindex)); -+ if (arg->op == TOKstring && tprmb->ty == Tsarray) -+ { -+ if (targb->ty != Tsarray) -+ { -+ Type *tn = tprmb->nextOf()->castMod(targb->nextOf()->mod); -+ dinteger_t dim = ((StringExp *)arg)->len; -+ targb = TypeSArray::makeType(Loc(), tn, dim); -+ } -+ } -+ else if (arg->op == TOKslice && tprmb->ty == Tsarray) -+ { -+ // Allow conversion from T[lwr .. upr] to ref T[upr-lwr] -+ if (targb->ty != Tsarray) -+ { -+ Type *tn = targb->nextOf(); -+ dinteger_t dim = ((TypeSArray *)tprmb)->dim->toUInteger(); -+ targb = TypeSArray::makeType(Loc(), tn, dim); -+ } - } - else - goto Nomatch; - } - -- Type *targb = targ->toBasetype(); -- Type *tprmb = tprm->toBasetype(); -- //printf("%s\n", targb->toChars()); -- //printf("%s\n", tprmb->toChars()); -- - /* find most derived alias this type being matched. - */ - while (1) -@@ -6178,7 +6265,7 @@ bool TypeFunction::parameterEscapes(Para - if (!nextOf()) - return TRUE; - -- if (purity) -+ if (purity > PUREweak) - { /* With pure functions, we need only be concerned if p escapes - * via any return statement. - */ -@@ -6218,6 +6305,7 @@ Type *TypeFunction::addStorageClass(Stor - tf->isproperty = t->isproperty; - tf->isref = t->isref; - tf->trust = t->trust; -+ tf->iswild = t->iswild; - - if (stc & STCpure) - tf->purity = PUREfwdref; -@@ -6270,7 +6358,7 @@ Type *TypeDelegate::semantic(Loc loc, Sc - * be removed from next before the merge. - */ - --#if 1 -+#if 0 - return merge(); - #else - /* Don't return merge(), because arg identifiers and default args -@@ -6339,7 +6427,7 @@ int TypeDelegate::checkBoolean() - return TRUE; - } - --Expression *TypeDelegate::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeDelegate::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeDelegate::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -6349,12 +6437,12 @@ Expression *TypeDelegate::dotExp(Scope * - #ifndef IN_GCC - e->type = tvoidptr; - #else -- if (e->op == TOKdelegate || e->op == TOKcast) -- e = e->castTo(sc, tvoidptr); // Not an lvalue -+ if (!e->isLvalue()) -+ e = e->castTo(sc, tvoidptr); - else - { - e = e->addressOf(sc); -- e = e->castTo(sc, tvoidptr->pointerTo()); -+ e->type = tvoidptr; - e = new PtrExp(e->loc, e); - e->type = tvoidptr; - } -@@ -6366,7 +6454,7 @@ Expression *TypeDelegate::dotExp(Scope * - if (!e->isLvalue()) - { - Identifier *idtmp = Lexer::uniqueId("__dgtmp"); -- VarDeclaration *tmp = new VarDeclaration(e->loc, this, idtmp, new ExpInitializer(0, e)); -+ VarDeclaration *tmp = new VarDeclaration(e->loc, this, idtmp, new ExpInitializer(Loc(), e)); - tmp->storage_class |= STCctfe; - e = new DeclarationExp(e->loc, tmp); - e = new CommaExp(e->loc, e, new VarExp(e->loc, tmp)); -@@ -6382,7 +6470,7 @@ Expression *TypeDelegate::dotExp(Scope * - } - else - { -- e = Type::dotExp(sc, e, ident); -+ e = Type::dotExp(sc, e, ident, flag); - } - return e; - } -@@ -6408,13 +6496,13 @@ void TypeQualified::syntaxCopyHelper(Typ - idents.setDim(t->idents.dim); - for (size_t i = 0; i < idents.dim; i++) - { -- Identifier *id = t->idents[i]; -+ RootObject *id = t->idents[i]; - if (id->dyncast() == DYNCAST_DSYMBOL) - { - TemplateInstance *ti = (TemplateInstance *)id; - - ti = (TemplateInstance *)ti->syntaxCopy(NULL); -- id = (Identifier *)ti; -+ id = ti; - } - idents[i] = id; - } -@@ -6426,10 +6514,15 @@ void TypeQualified::addIdent(Identifier - idents.push(ident); - } - -+void TypeQualified::addInst(TemplateInstance *inst) -+{ -+ idents.push(inst); -+} -+ - void TypeQualified::toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs) - { - for (size_t i = 0; i < idents.dim; i++) -- { Identifier *id = idents[i]; -+ { RootObject *id = idents[i]; - - buf->writeByte('.'); - -@@ -6446,7 +6539,7 @@ void TypeQualified::toCBuffer2Helper(Out - d_uns64 TypeQualified::size(Loc loc) - { - error(this->loc, "size of type %s is not known", toChars()); -- return 1; -+ return SIZE_INVALID; - } - - /************************************* -@@ -6459,13 +6552,8 @@ d_uns64 TypeQualified::size(Loc loc) - - void TypeQualified::resolveHelper(Loc loc, Scope *sc, - Dsymbol *s, Dsymbol *scopesym, -- Expression **pe, Type **pt, Dsymbol **ps) -+ Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { -- VarDeclaration *v; -- EnumMember *em; -- Expression *e; -- TemplateInstance *ti; -- - #if 0 - printf("TypeQualified::resolveHelper(sc = %p, idents = '%s')\n", sc, toChars()); - if (scopesym) -@@ -6482,66 +6570,63 @@ void TypeQualified::resolveHelper(Loc lo - //printf("\t2: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind()); - for (size_t i = 0; i < idents.dim; i++) - { -- Identifier *id = idents[i]; -+ RootObject *id = idents[i]; -+ Type *t = s->getType(); // type symbol, type alias, or type tuple? - Dsymbol *sm = s->searchX(loc, sc, id); -- //printf("\t3: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind()); -- //printf("\tgetType = '%s'\n", s->getType()->toChars()); -+ //printf("\t3: s = %p %s %s, sm = %p\n", s, s->kind(), s->toChars(), sm); -+ if (intypeid && !t && sm && sm->needThis()) -+ goto L3; - if (!sm) -- { Type *t; -- -- v = s->isVarDeclaration(); -- ti = s->isTemplateInstance(); -- if (v && id == Id::length) -- { -- e = new VarExp(loc, v); -- t = e->type; -- if (!t) -- goto Lerror; -- goto L3; -- } -- else if ((v && (id == Id::stringof || id == Id::offsetof)) -- || (ti && (id == Id::stringof || id == Id::mangleof))) -+ { -+ if (!t) - { -- e = new DsymbolExp(loc, s, 0); -- do -+ if (s->isDeclaration()) // var, func, or tuple declaration? - { -- id = idents[i]; -- e = new DotIdExp(loc, e, id); -- } while (++i < idents.dim); -- e = e->semantic(sc); -- *pe = e; -- return; -- } -- -- t = s->getType(); -- if (!t && s->isDeclaration()) -- { t = s->isDeclaration()->type; -- if (!t && s->isTupleDeclaration()) -+ t = s->isDeclaration()->type; -+ if (!t && s->isTupleDeclaration()) // expression tuple? -+ goto L3; -+ } -+ else if (s->isTemplateInstance() || -+ s->isImport() || s->isPackage() || s->isModule()) - { -- e = new TupleExp(loc, s->isTupleDeclaration()); -- e = e->semantic(sc); -- t = e->type; -+ goto L3; - } - } - if (t) - { - sm = t->toDsymbol(sc); -- if (sm) -- { sm = sm->search(loc, id, 0); -+ if (sm && id->dyncast() == DYNCAST_IDENTIFIER) -+ { -+ sm = sm->search(loc, (Identifier *)id, 0); - if (sm) - goto L2; - } -- //e = t->getProperty(loc, id); -- e = new TypeExp(loc, t); -- e = t->dotExp(sc, e, id); -- i++; - L3: -+ Expression *e; -+ VarDeclaration *v = s->isVarDeclaration(); -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (intypeid || !v && !f) -+ e = new DsymbolExp(loc, s); -+ else -+ e = new VarExp(loc, s->isDeclaration()); -+ e = e->semantic(sc); - for (; i < idents.dim; i++) - { -- id = idents[i]; -+ RootObject *id = idents[i]; - //printf("e: '%s', id: '%s', type = %s\n", e->toChars(), id->toChars(), e->type->toChars()); -- e = new DotIdExp(e->loc, e, id); -- e = e->semantic(sc); -+ if (id->dyncast() == DYNCAST_IDENTIFIER) -+ { -+ DotIdExp *die = new DotIdExp(e->loc, e, (Identifier *)id); -+ e = die->semanticY(sc, 0); -+ } -+ else -+ { -+ assert(id->dyncast() == DYNCAST_DSYMBOL); -+ TemplateInstance *ti = ((Dsymbol *)id)->isTemplateInstance(); -+ assert(ti); -+ DotTemplateInstanceExp *dte = new DotTemplateInstanceExp(e->loc, e, ti->name, ti->tiargs); -+ e = dte->semanticY(sc, 0); -+ } - } - if (e->op == TOKtype) - *pt = e->type; -@@ -6550,14 +6635,14 @@ void TypeQualified::resolveHelper(Loc lo - } - else - { -- Lerror: - if (id->dyncast() == DYNCAST_DSYMBOL) - { // searchX already handles errors for template instances - assert(global.errors); - } - else - { -- sm = s->search_correct(id); -+ assert(id->dyncast() == DYNCAST_IDENTIFIER); -+ sm = s->search_correct((Identifier *)id); - if (sm) - error(loc, "identifier '%s' of '%s' is not defined, did you mean '%s %s'?", - id->toChars(), toChars(), sm->kind(), sm->toChars()); -@@ -6572,25 +6657,27 @@ void TypeQualified::resolveHelper(Loc lo - s = sm->toAlias(); - } - -- v = s->isVarDeclaration(); -- if (v) -+ if (VarDeclaration *v = s->isVarDeclaration()) - { -+ if (v && v->inuse && (!v->type || !v->type->deco)) // Bugzilla 9494 -+ { error(loc, "circular reference to '%s'", v->toPrettyChars()); -+ *pe = new ErrorExp(); -+ return; -+ } - *pe = new VarExp(loc, v); - return; - } - #if 0 -- fd = s->isFuncDeclaration(); -- if (fd) -+ if (FuncDeclaration *fd = s->isFuncDeclaration()) - { - *pe = new DsymbolExp(loc, fd, 1); - return; - } - #endif -- em = s->isEnumMember(); -- if (em) -+ if (EnumMember *em = s->isEnumMember()) - { - // It's not a type, it's an expression -- *pe = em->value->copy(); -+ *pe = em->getVarExp(loc, sc); - return; - } - -@@ -6599,10 +6686,7 @@ L1: - if (!t) - { - // If the symbol is an import, try looking inside the import -- Import *si; -- -- si = s->isImport(); -- if (si) -+ if (Import *si = s->isImport()) - { - s = si->search(loc, s->ident, 0); - if (s && s != si) -@@ -6614,6 +6698,7 @@ L1: - } - if (t->ty == Tinstance && t != this && !t->deco) - { error(loc, "forward reference to '%s'", t->toChars()); -+ *pt = Type::terror; - return; - } - -@@ -6633,6 +6718,7 @@ L1: - { - if (!scx) - { error(loc, "forward reference to '%s'", t->toChars()); -+ *pt = Type::terror; - return; - } - if (scx->scopesym == scopesym) -@@ -6718,7 +6804,7 @@ void TypeIdentifier::toCBuffer2(OutBuffe - * if type, *pt is set - */ - --void TypeIdentifier::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeIdentifier::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - Dsymbol *scopesym; - -@@ -6747,7 +6833,7 @@ void TypeIdentifier::resolve(Loc loc, Sc - } - - Dsymbol *s = sc->search(loc, ident, &scopesym); -- resolveHelper(loc, sc, s, scopesym, pe, pt, ps); -+ resolveHelper(loc, sc, s, scopesym, pe, pt, ps, intypeid); - if (*pt) - (*pt) = (*pt)->addMod(mod); - } -@@ -6770,7 +6856,7 @@ Dsymbol *TypeIdentifier::toDsymbol(Scope - { - for (size_t i = 0; i < idents.dim; i++) - { -- Identifier *id = idents[i]; -+ RootObject *id = idents[i]; - s = s->searchX(loc, sc, id); - if (!s) // failed to find a symbol - { //printf("\tdidn't find a symbol\n"); -@@ -6794,10 +6880,12 @@ Type *TypeIdentifier::semantic(Loc loc, - //printf("\tit's a type %d, %s, %s\n", t->ty, t->toChars(), t->deco); - - if (t->ty == Ttypedef) -- { TypeTypedef *tt = (TypeTypedef *)t; -- -+ { -+ TypeTypedef *tt = (TypeTypedef *)t; - if (tt->sym->sem == SemanticIn) -- error(loc, "circular reference of typedef %s", tt->toChars()); -+ { error(loc, "circular reference of typedef %s", tt->toChars()); -+ return terror; -+ } - } - t = t->addMod(mod); - } -@@ -6820,14 +6908,11 @@ Type *TypeIdentifier::reliesOnTident(Tem - { - if (tparams) - { -- if (idents.dim == 0) -+ for (size_t i = 0; i < tparams->dim; i++) - { -- for (size_t i = 0; i < tparams->dim; i++) -- { TemplateParameter *tp = (*tparams)[i]; -- -- if (tp->ident->equals(ident)) -- return this; -- } -+ TemplateParameter *tp = (*tparams)[i]; -+ if (tp->ident->equals(ident)) -+ return this; - } - return NULL; - } -@@ -6840,8 +6925,18 @@ Expression *TypeIdentifier::toExpression - Expression *e = new IdentifierExp(loc, ident); - for (size_t i = 0; i < idents.dim; i++) - { -- Identifier *id = idents[i]; -- e = new DotIdExp(loc, e, id); -+ RootObject *id = idents[i]; -+ if (id->dyncast() == DYNCAST_IDENTIFIER) -+ { -+ e = new DotIdExp(loc, e, (Identifier *)id); -+ } -+ else -+ { -+ assert(id->dyncast() == DYNCAST_DSYMBOL); -+ TemplateInstance *ti = ((Dsymbol *)id)->isTemplateInstance(); -+ assert(ti); -+ e = new DotTemplateInstanceExp(loc, e, ti->name, ti->tiargs); -+ } - } - - return e; -@@ -6882,7 +6977,7 @@ void TypeInstance::toCBuffer2(OutBuffer - toCBuffer2Helper(buf, hgs); - } - --void TypeInstance::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeInstance::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { - // Note close similarity to TypeIdentifier::resolve() - -@@ -6903,10 +6998,11 @@ void TypeInstance::resolve(Loc loc, Scop - //printf("TypeInstance::resolve(sc = %p, idents = '%s')\n", sc, id->toChars()); - s = tempinst; - if (s) -- { //printf("s = %s\n", s->toChars()); -+ { -+ //printf("s = %s\n", s->toChars()); - s->semantic(sc); - } -- resolveHelper(loc, sc, s, NULL, pe, pt, ps); -+ resolveHelper(loc, sc, s, NULL, pe, pt, ps, intypeid); - if (*pt) - *pt = (*pt)->addMod(mod); - //printf("pt = '%s'\n", (*pt)->toChars()); -@@ -6919,23 +7015,23 @@ Type *TypeInstance::semantic(Loc loc, Sc - Dsymbol *s; - - //printf("TypeInstance::semantic(%p, %s)\n", this, toChars()); -- -- if (sc->parameterSpecialization) - { -- unsigned errors = global.startGagging(); -+ unsigned errors = global.errors; - resolve(loc, sc, &e, &t, &s); -- -- if (global.endGagging(errors)) -- { -- return this; -- } -+ // if we had an error evaluating the symbol, suppress further errors -+ if (!t && errors != global.errors) -+ return terror; - } -- else -- resolve(loc, sc, &e, &t, &s); - - if (!t) - { -- error(loc, "%s is used as a type", toChars()); -+ if (!e && s && s->errors) -+ { // if there was an error evaluating the symbol, it might actually -+ // be a type. Avoid misleading error messages. -+ error(loc, "%s had previous errors", toChars()); -+ } -+ else -+ error(loc, "%s is used as a type", toChars()); - t = terror; - } - return t; -@@ -6948,18 +7044,7 @@ Dsymbol *TypeInstance::toDsymbol(Scope * - Dsymbol *s; - - //printf("TypeInstance::semantic(%s)\n", toChars()); -- -- if (sc->parameterSpecialization) -- { -- unsigned errors = global.startGagging(); -- -- resolve(loc, sc, &e, &t, &s); -- -- if (global.endGagging(errors)) -- return NULL; -- } -- else -- resolve(loc, sc, &e, &t, &s); -+ resolve(loc, sc, &e, &t, &s); - - return s; - } -@@ -6991,6 +7076,28 @@ Type *TypeInstance::reliesOnTident(Templ - } - } - -+Expression *TypeInstance::toExpression() -+{ -+ Expression *e = new ScopeExp(loc, tempinst); -+ for (size_t i = 0; i < idents.dim; i++) -+ { -+ RootObject *id = idents[i]; -+ if (id->dyncast() == DYNCAST_IDENTIFIER) -+ { -+ e = new DotIdExp(loc, e, (Identifier *)id); -+ } -+ else -+ { -+ assert(id->dyncast() == DYNCAST_DSYMBOL); -+ TemplateInstance *ti = ((Dsymbol *)id)->isTemplateInstance(); -+ assert(ti); -+ e = new DotTemplateInstanceExp(loc, e, ti->name, ti->tiargs); -+ } -+ } -+ -+ return e; -+} -+ - - /***************************** TypeTypeof *****************************/ - -@@ -7039,83 +7146,36 @@ void TypeTypeof::toCBuffer2(OutBuffer *b - toCBuffer2Helper(buf, hgs); - } - --Type *TypeTypeof::semantic(Loc loc, Scope *sc) -+void TypeTypeof::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { -- Type *t; -- -- //printf("TypeTypeof::semantic() %s\n", toChars()); -+ *pe = NULL; -+ *pt = NULL; -+ *ps = NULL; - -+ //printf("TypeTypeof::resolve(sc = %p, idents = '%s')\n", sc, toChars()); - //static int nest; if (++nest == 50) *(char*)0=0; - if (inuse) - { - inuse = 2; - error(loc, "circular typeof definition"); -- return Type::terror; -+ goto Lerr; - } - inuse++; - --#if 0 -- /* Special case for typeof(this) and typeof(super) since both -- * should work even if they are not inside a non-static member function -- */ -- if (exp->op == TOKthis || exp->op == TOKsuper) -- { -- // Find enclosing struct or class -- for (Dsymbol *s = sc->parent; 1; s = s->parent) -- { -- ClassDeclaration *cd; -- StructDeclaration *sd; -- -- if (!s) -- { -- error(loc, "%s is not in a struct or class scope", exp->toChars()); -- goto Lerr; -- } -- cd = s->isClassDeclaration(); -- if (cd) -- { -- if (exp->op == TOKsuper) -- { -- cd = cd->baseClass; -- if (!cd) -- { error(loc, "class %s has no 'super'", s->toChars()); -- goto Lerr; -- } -- } -- t = cd->type; -- break; -- } -- sd = s->isStructDeclaration(); -- if (sd) -- { -- if (exp->op == TOKsuper) -- { -- error(loc, "struct %s has no 'super'", sd->toChars()); -- goto Lerr; -- } -- t = sd->type->pointerTo(); -- break; -- } -- } -- } -- else --#endif -+ Type *t; - { - Scope *sc2 = sc->push(); -- sc2->intypeof++; -+ sc2->intypeof = 1; - sc2->speculative = true; - sc2->flags |= sc->flags & SCOPEstaticif; - unsigned oldspecgag = global.speculativeGag; - if (global.gag) - global.speculativeGag = global.gag; - exp = exp->semantic(sc2); -- global.speculativeGag = oldspecgag; -- - #if DMDV2 -- if (exp->type && exp->type->ty == Tfunction && -- ((TypeFunction *)exp->type)->isproperty) -- exp = resolveProperties(sc2, exp); -+ exp = resolvePropertiesOnly(sc2, exp); - #endif -+ global.speculativeGag = oldspecgag; - sc2->pop(); - if (exp->op == TOKtype) - { -@@ -7129,47 +7189,75 @@ Type *TypeTypeof::semantic(Loc loc, Scop - goto Lerr; - } - if (t->ty == Ttypeof) -- { error(loc, "forward reference to %s", toChars()); -+ { -+ error(loc, "forward reference to %s", toChars()); - goto Lerr; - } -- -- t = t->addMod(mod); -- -- /* typeof should reflect the true type, -- * not what 'auto' would have gotten us. -- */ -- //t = t->toHeadMutable(); - } -- if (idents.dim) -+ if (idents.dim == 0) -+ *pt = t; -+ else - { -- Dsymbol *s = t->toDsymbol(sc); -- for (size_t i = 0; i < idents.dim; i++) -- { -- if (!s) -- break; -- Identifier *id = idents[i]; -- s = s->searchX(loc, sc, id); -- } -- -- if (s) -+ if (Dsymbol *s = t->toDsymbol(sc)) -+ resolveHelper(loc, sc, s, NULL, pe, pt, ps, intypeid); -+ else - { -- t = s->getType(); -- if (!t) -- { error(loc, "%s is not a type", s->toChars()); -- goto Lerr; -+ Expression *e = new TypeExp(loc, t); -+ for (size_t i = 0; i < idents.dim; i++) -+ { -+ RootObject *id = idents[i]; -+ switch (id->dyncast()) -+ { -+ case DYNCAST_IDENTIFIER: -+ e = new DotIdExp(loc, e, (Identifier *)id); -+ break; -+ case DYNCAST_DSYMBOL: -+ { -+ TemplateInstance *ti = ((Dsymbol *)id)->isTemplateInstance(); -+ e = new DotExp(loc, e, new ScopeExp(loc, ti)); -+ break; -+ } -+ default: -+ assert(0); -+ } -+ } -+ e = e->semantic(sc); -+ if ((*ps = getDsymbol(e)) == NULL) -+ { -+ if (e->op == TOKtype) -+ *pt = e->type; -+ else -+ *pe = e; - } -- } -- else -- { error(loc, "cannot resolve .property for %s", toChars()); -- goto Lerr; - } - } -+ if (*pt) -+ (*pt) = (*pt)->addMod(mod); - inuse--; -- return t; -+ return; - - Lerr: -+ *pt = Type::terror; - inuse--; -- return terror; -+ return; -+} -+ -+Type *TypeTypeof::semantic(Loc loc, Scope *sc) -+{ -+ //printf("TypeTypeof::semantic() %s\n", toChars()); -+ -+ Expression *e; -+ Type *t; -+ Dsymbol *s; -+ resolve(loc, sc, &e, &t, &s); -+ if (s && (t = s->getType()) != NULL) -+ t = t->addMod(mod); -+ if (!t) -+ { -+ error(loc, "%s is used as a type", toChars()); -+ t = Type::terror; -+ } -+ return t; - } - - d_uns64 TypeTypeof::size(Loc loc) -@@ -7204,58 +7292,99 @@ Type *TypeReturn::syntaxCopy() - - Dsymbol *TypeReturn::toDsymbol(Scope *sc) - { -- Type *t = semantic(0, sc); -+ Type *t = semantic(Loc(), sc); - if (t == this) -- return NULL; -- return t->toDsymbol(sc); --} -- --Type *TypeReturn::semantic(Loc loc, Scope *sc) --{ -- Type *t; -- FuncDeclaration *func = sc->func; -- if (!func) -- { error(loc, "typeof(return) must be inside function"); -- goto Lerr; -- } -- if (func->fes) -- func = func->fes->func; -- -- t = func->type->nextOf(); -- if (!t) -- { -- error(loc, "cannot use typeof(return) inside function %s with inferred return type", sc->func->toChars()); -- goto Lerr; -- } -- t = t->addMod(mod); -+ return NULL; -+ return t->toDsymbol(sc); -+} -+ -+void TypeReturn::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) -+{ -+ *pe = NULL; -+ *pt = NULL; -+ *ps = NULL; - -- if (idents.dim) -+ //printf("TypeReturn::resolve(sc = %p, idents = '%s')\n", sc, toChars()); -+ Type *t; - { -- Dsymbol *s = t->toDsymbol(sc); -- for (size_t i = 0; i < idents.dim; i++) -+ FuncDeclaration *func = sc->func; -+ if (!func) - { -- if (!s) -- break; -- Identifier *id = idents[i]; -- s = s->searchX(loc, sc, id); -+ error(loc, "typeof(return) must be inside function"); -+ goto Lerr; - } -- if (s) -+ if (func->fes) -+ func = func->fes->func; -+ -+ t = func->type->nextOf(); -+ if (!t) - { -- t = s->getType(); -- if (!t) -- { error(loc, "%s is not a type", s->toChars()); -- goto Lerr; -- } -+ error(loc, "cannot use typeof(return) inside function %s with inferred return type", sc->func->toChars()); -+ goto Lerr; - } -+ } -+ if (idents.dim == 0) -+ *pt = t; -+ else -+ { -+ if (Dsymbol *s = t->toDsymbol(sc)) -+ resolveHelper(loc, sc, s, NULL, pe, pt, ps, intypeid); - else -- { error(loc, "cannot resolve .property for %s", toChars()); -- goto Lerr; -+ { -+ Expression *e = new TypeExp(loc, t); -+ for (size_t i = 0; i < idents.dim; i++) -+ { -+ RootObject *id = idents[i]; -+ switch (id->dyncast()) -+ { -+ case DYNCAST_IDENTIFIER: -+ e = new DotIdExp(loc, e, (Identifier *)id); -+ break; -+ case DYNCAST_DSYMBOL: -+ { -+ TemplateInstance *ti = ((Dsymbol *)id)->isTemplateInstance(); -+ e = new DotExp(loc, e, new ScopeExp(loc, ti)); -+ break; -+ } -+ default: -+ assert(0); -+ } -+ } -+ e = e->semantic(sc); -+ if ((*ps = getDsymbol(e)) == NULL) -+ { -+ if (e->op == TOKtype) -+ *pt = e->type; -+ else -+ *pe = e; -+ } - } - } -- return t; -+ if (*pt) -+ (*pt) = (*pt)->addMod(mod); -+ return; - - Lerr: -- return terror; -+ *pt = Type::terror; -+ return; -+} -+ -+Type *TypeReturn::semantic(Loc loc, Scope *sc) -+{ -+ //printf("TypeReturn::semantic() %s\n", toChars()); -+ -+ Expression *e; -+ Type *t; -+ Dsymbol *s; -+ resolve(loc, sc, &e, &t, &s); -+ if (s && (t = s->getType()) != NULL) -+ t = t->addMod(mod); -+ if (!t) -+ { -+ error(loc, "%s is used as a type", toChars()); -+ t = Type::terror; -+ } -+ return t; - } - - void TypeReturn::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) -@@ -7297,28 +7426,22 @@ Type *TypeEnum::syntaxCopy() - Type *TypeEnum::semantic(Loc loc, Scope *sc) - { - //printf("TypeEnum::semantic() %s\n", toChars()); -- //sym->semantic(sc); -+ if (deco) -+ return this; - return merge(); - } - - d_uns64 TypeEnum::size(Loc loc) - { -- if (!sym->memtype) -- { -- error(loc, "enum %s is forward referenced", sym->toChars()); -- return 4; -- } -- return sym->memtype->size(loc); -+ return sym->getMemtype(loc)->size(loc); - } - - unsigned TypeEnum::alignsize() - { -- if (!sym->memtype) -- { -- error(0, "enum %s is forward referenced", sym->toChars()); -+ Type *t = sym->getMemtype(Loc()); -+ if (t->ty == Terror) - return 4; -- } -- return sym->memtype->alignsize(); -+ return t->alignsize(); - } - - Dsymbol *TypeEnum::toDsymbol(Scope *sc) -@@ -7328,30 +7451,14 @@ Dsymbol *TypeEnum::toDsymbol(Scope *sc) - - Type *TypeEnum::toBasetype() - { -- if (sym->scope) -- { // Enum is forward referenced. We don't need to resolve the whole thing, -- // just the base type -- if (sym->memtype) -- { sym->memtype = sym->memtype->semantic(sym->loc, sym->scope); -- } -- else -- { if (!sym->isAnonymous()) -- sym->memtype = Type::tint32; -- } -- } -- if (!sym->memtype) -- { -- error(sym->loc, "enum %s is forward referenced", sym->toChars()); -- return tint32; -- } -- return sym->memtype->toBasetype(); -+ return sym->getMemtype(Loc())->toBasetype(); - } - - void TypeEnum::toDecoBuffer(OutBuffer *buf, int flag) - { - const char *name = sym->mangle(); - Type::toDecoBuffer(buf, flag); -- buf->printf("%s", name); -+ buf->writestring(name); - } - - void TypeEnum::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) -@@ -7363,7 +7470,7 @@ void TypeEnum::toCBuffer2(OutBuffer *buf - buf->writestring(sym->toChars()); - } - --Expression *TypeEnum::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeEnum::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeEnum::dotExp(e = '%s', ident = '%s') '%s'\n", e->toChars(), ident->toChars(), toChars()); -@@ -7378,30 +7485,20 @@ Expression *TypeEnum::dotExp(Scope *sc, - !sym->memtype - ) - { -- return getProperty(e->loc, ident); -+ return getProperty(e->loc, ident, flag); - } -- return sym->memtype->dotExp(sc, e, ident); -+ return sym->getMemtype(Loc())->dotExp(sc, e, ident, flag); - } - EnumMember *m = s->isEnumMember(); -- Expression *em = m->value->copy(); -- em->loc = e->loc; -- return em; -+ return m->getVarExp(e->loc, sc); - } - --Expression *TypeEnum::getProperty(Loc loc, Identifier *ident) -+Expression *TypeEnum::getProperty(Loc loc, Identifier *ident, int flag) - { Expression *e; - -- if (ident == Id::max) -- { -- if (!sym->maxval) -- goto Lfwd; -- e = sym->maxval; -- } -- else if (ident == Id::min) -- { -- if (!sym->minval) -- goto Lfwd; -- e = sym->minval; -+ if (ident == Id::max || ident == Id::min) -+ { -+ return sym->getMaxMinValue(loc, ident); - } - else if (ident == Id::init) - { -@@ -7415,17 +7512,13 @@ Expression *TypeEnum::getProperty(Loc lo - } - else if (ident == Id::mangleof) - { -- e = Type::getProperty(loc, ident); -+ e = Type::getProperty(loc, ident, flag); - } - else - { -- e = toBasetype()->getProperty(loc, ident); -+ e = toBasetype()->getProperty(loc, ident, flag); - } - return e; -- --Lfwd: -- error(loc, "forward reference of %s.%s", toChars(), ident->toChars()); -- return new ErrorExp(); - } - - int TypeEnum::isintegral() -@@ -7463,6 +7556,11 @@ int TypeEnum::isscalar() - return sym->memtype->isscalar(); - } - -+int TypeEnum::isString() -+{ -+ return sym->memtype->isString(); -+} -+ - int TypeEnum::isAssignable() - { - return sym->memtype->isAssignable(); -@@ -7513,30 +7611,15 @@ Expression *TypeEnum::defaultInit(Loc lo - printf("TypeEnum::defaultInit() '%s'\n", toChars()); - #endif - // Initialize to first member of enum -- //printf("%s\n", sym->defaultval->type->toChars()); -- if (!sym->defaultval) -- { -- error(loc, "forward reference of %s.init", toChars()); -- return new ErrorExp(); -- } -- Expression *e = sym->defaultval; -+ Expression *e = sym->getDefaultValue(loc); - e = e->copy(); -- e->type = this; -+ e->type = this; // to deal with const, immutable, etc., variants - return e; - } - - int TypeEnum::isZeroInit(Loc loc) - { -- if (!sym->defaultval && sym->scope) -- { // Enum is forward referenced. We need to resolve the whole thing. -- sym->semantic(NULL); -- } -- if (!sym->defaultval) -- { -- error(loc, "enum %s is forward referenced", sym->toChars()); -- return 0; -- } -- return sym->defaultval->isBool(FALSE); -+ return sym->getDefaultValue(loc)->isBool(FALSE); - } - - int TypeEnum::hasPointers() -@@ -7544,6 +7627,17 @@ int TypeEnum::hasPointers() - return toBasetype()->hasPointers(); - } - -+Type *TypeEnum::nextOf() -+{ -+ if (sym->semanticRun == PASSinit) -+ { -+ assert(sym->scope); -+ sym->semantic(sym->scope); -+ } -+ assert(sym->memtype); -+ return sym->memtype->nextOf(); -+} -+ - /***************************** TypeTypedef *****************************/ - - TypeTypedef::TypeTypedef(TypedefDeclaration *sym) -@@ -7572,7 +7666,7 @@ Type *TypeTypedef::semantic(Loc loc, Sco - //printf("TypeTypedef::semantic(%s), sem = %d\n", toChars(), sym->sem); - int errors = global.errors; - sym->semantic(sc); -- if (errors != global.errors) -+ if (errors != global.errors || sym->errors || sym->basetype->ty == Terror) - return terror; - return merge(); - } -@@ -7596,7 +7690,7 @@ void TypeTypedef::toDecoBuffer(OutBuffer - { - Type::toDecoBuffer(buf, flag); - const char *name = sym->mangle(); -- buf->printf("%s", name); -+ buf->writestring(name); - } - - void TypeTypedef::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) -@@ -7609,16 +7703,16 @@ void TypeTypedef::toCBuffer2(OutBuffer * - buf->writestring(sym->toChars()); - } - --Expression *TypeTypedef::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeTypedef::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeTypedef::dotExp(e = '%s', ident = '%s') '%s'\n", e->toChars(), ident->toChars(), toChars()); - #endif - if (ident == Id::init) - { -- return Type::dotExp(sc, e, ident); -+ return Type::dotExp(sc, e, ident, flag); - } -- return sym->basetype->dotExp(sc, e, ident); -+ return sym->basetype->dotExp(sc, e, ident, flag); - } - - structalign_t TypeTypedef::alignment() -@@ -7635,16 +7729,16 @@ structalign_t TypeTypedef::alignment() - return a; - } - --Expression *TypeTypedef::getProperty(Loc loc, Identifier *ident) -+Expression *TypeTypedef::getProperty(Loc loc, Identifier *ident, int flag) - { - #if LOGDOTEXP - printf("TypeTypedef::getProperty(ident = '%s') '%s'\n", ident->toChars(), toChars()); - #endif - if (ident == Id::init) - { -- return Type::getProperty(loc, ident); -+ return Type::getProperty(loc, ident, flag); - } -- return sym->basetype->getProperty(loc, ident); -+ return sym->basetype->getProperty(loc, ident, flag); - } - - int TypeTypedef::isintegral() -@@ -7788,7 +7882,13 @@ Expression *TypeTypedef::defaultInitLite - if (sym->init) - { - //sym->init->toExpression()->print(); -- return sym->init->toExpression(); -+ Expression *e = sym->init->toExpression(); -+ if (!e) -+ { -+ error(loc, "void initializer has no value"); -+ e = new ErrorExp(); -+ } -+ return e; - } - Type *bt = sym->basetype; - Expression *e = bt->defaultInitLiteral(loc); -@@ -7835,6 +7935,7 @@ TypeStruct::TypeStruct(StructDeclaration - : Type(Tstruct) - { - this->sym = sym; -+ this->att = RECfwdref; - } - - const char *TypeStruct::kind() -@@ -7879,7 +7980,7 @@ d_uns64 TypeStruct::size(Loc loc) - - unsigned TypeStruct::alignsize() - { -- sym->size(0); // give error for forward references -+ sym->size(Loc()); // give error for forward references - return sym->alignsize; - } - -@@ -7893,7 +7994,7 @@ void TypeStruct::toDecoBuffer(OutBuffer - const char *name = sym->mangle(); - //printf("TypeStruct::toDecoBuffer('%s') = '%s'\n", toChars(), name); - Type::toDecoBuffer(buf, flag); -- buf->printf("%s", name); -+ buf->writestring(name); - } - - void TypeStruct::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) -@@ -7909,12 +8010,11 @@ void TypeStruct::toCBuffer2(OutBuffer *b - buf->writestring(sym->toChars()); - } - --Expression *TypeStruct::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeStruct::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - VarDeclaration *v; - Dsymbol *s; - DotVarExp *de; -- Declaration *d; - - #if LOGDOTEXP - printf("TypeStruct::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars()); -@@ -7937,31 +8037,36 @@ Expression *TypeStruct::dotExp(Scope *sc - Expressions *exps = new Expressions; - exps->reserve(sym->fields.dim); - -- Expression *ev = e; -+ Expression *e0 = NULL; -+ Expression *ev = e->op == TOKtype ? NULL : e; -+ if (sc->func && ev && ev->hasSideEffect()) -+ { -+ Identifier *id = Lexer::uniqueId("__tup"); -+ ExpInitializer *ei = new ExpInitializer(e->loc, ev); -+ VarDeclaration *vd = new VarDeclaration(e->loc, NULL, id, ei); -+ vd->storage_class |= STCctfe | STCref | STCforeach; -+ -+ e0 = new DeclarationExp(e->loc, vd); -+ ev = new VarExp(e->loc, vd); -+ } - for (size_t i = 0; i < sym->fields.dim; i++) -- { VarDeclaration *v = sym->fields[i]; -- Expression *fe; -- if (i == 0 && sc->func && sym->fields.dim > 1 && -- e->hasSideEffect()) -- { -- Identifier *id = Lexer::uniqueId("__tup"); -- ExpInitializer *ei = new ExpInitializer(e->loc, e); -- VarDeclaration *vd = new VarDeclaration(e->loc, NULL, id, ei); -- vd->storage_class |= STCctfe | STCref | STCforeach; -- -- ev = new VarExp(e->loc, vd); -- fe = new CommaExp(e->loc, new DeclarationExp(e->loc, vd), ev); -- fe = new DotVarExp(e->loc, fe, v); -- } -+ { -+ VarDeclaration *v = sym->fields[i]; -+ Expression *ex; -+ if (ev) -+ ex = new DotVarExp(e->loc, ev, v); - else -- fe = new DotVarExp(ev->loc, ev, v); -- exps->push(fe); -+ { -+ ex = new VarExp(e->loc, v); -+ ex->type = ex->type->addMod(e->type->mod); -+ } -+ exps->push(ex); - } -- e = new TupleExp(e->loc, exps); -- sc = sc->push(); -- sc->noaccesscheck = 1; -- e = e->semantic(sc); -- sc->pop(); -+ e = new TupleExp(e->loc, e0, exps); -+ Scope *sc2 = sc->push(); -+ sc2->flags = sc->flags | SCOPEnoaccesscheck; -+ e = e->semantic(sc2); -+ sc2->pop(); - return e; - } - -@@ -7988,25 +8093,24 @@ L1: - { - sym->semantic(NULL); - s = sym->search(e->loc, ident, 0); -- if (!s) -- return noMember(sc, e, ident); - } -- else -- return noMember(sc, e, ident); -+ if (!s) -+ return noMember(sc, e, ident, flag); - } - if (!s->isFuncDeclaration()) // because of overloading - s->checkDeprecated(e->loc, sc); - s = s->toAlias(); - - v = s->isVarDeclaration(); -- if (v && !v->isDataseg()) -+ if (v && v->inuse && (!v->type || !v->type->deco)) // Bugzilla 9494 -+ { e->error("circular reference to '%s'", v->toPrettyChars()); -+ return new ErrorExp(); -+ } -+ if (v && !v->isDataseg() && (v->storage_class & STCmanifest)) - { -- Expression *ei = v->getConstInitializer(); -- if (ei) -- { e = ei->copy(); // need to copy it if it's a StringExp -- e = e->semantic(sc); -- return e; -- } -+ Expression *ve = new VarExp(e->loc, v); -+ ve = ve->semantic(sc); -+ return ve; - } - - if (s->getType()) -@@ -8017,8 +8121,7 @@ L1: - EnumMember *em = s->isEnumMember(); - if (em) - { -- assert(em->value); -- return em->value->copy(); -+ return em->getVarExp(e->loc, sc); - } - - TemplateMixin *tm = s->isTemplateMixin(); -@@ -8032,7 +8135,10 @@ L1: - TemplateDeclaration *td = s->isTemplateDeclaration(); - if (td) - { -- e = new DotTemplateExp(e->loc, e, td); -+ if (e->op == TOKtype) -+ e = new ScopeExp(e->loc, td); -+ else -+ e = new DotTemplateExp(e->loc, e, td); - e = e->semantic(sc); - return e; - } -@@ -8063,13 +8169,13 @@ L1: - OverloadSet *o = s->isOverloadSet(); - if (o) - { -- OverExp *oe = new OverExp(o); -+ OverExp *oe = new OverExp(e->loc, o); - if (e->op == TOKtype) - return oe; - return new DotExp(e->loc, e, oe); - } - -- d = s->isDeclaration(); -+ Declaration *d = s->isDeclaration(); - #ifdef DEBUG - if (!d) - printf("d = %s '%s'\n", s->kind(), s->toChars()); -@@ -8077,19 +8183,27 @@ L1: - assert(d); - - if (e->op == TOKtype) -- { FuncDeclaration *fd = sc->func; -- -- if (d->isTupleDeclaration()) -+ { -+ /* It's: -+ * Struct.d -+ */ -+ if (TupleDeclaration *tup = d->isTupleDeclaration()) - { -- e = new TupleExp(e->loc, d->isTupleDeclaration()); -+ e = new TupleExp(e->loc, tup); - e = e->semantic(sc); - return e; - } -- else if (d->needThis() && fd && fd->vthis) -+ if (d->needThis() && sc->intypeof != 1) - { -- e = new DotVarExp(e->loc, new ThisExp(e->loc), d); -- e = e->semantic(sc); -- return e; -+ /* Rewrite as: -+ * this.d -+ */ -+ if (hasThis(sc)) -+ { -+ e = new DotVarExp(e->loc, new ThisExp(e->loc), d); -+ e = e->semantic(sc); -+ return e; -+ } - } - accessCheck(e->loc, sc, e, d); - VarExp *ve = new VarExp(e->loc, d, 1); -@@ -8098,14 +8212,13 @@ L1: - return ve; - } - -- if (d->isDataseg()) -+ bool unreal = e->op == TOKvar && ((VarExp *)e)->var->isField(); -+ if (d->isDataseg() || unreal && d->isField()) - { - // (e, d) -- VarExp *ve; -- - accessCheck(e->loc, sc, e, d); -- ve = new VarExp(e->loc, d); -- e = new CommaExp(e->loc, e, ve); -+ Expression *ve = new VarExp(e->loc, d); -+ e = unreal ? ve : new CommaExp(e->loc, e, ve); - e = e->semantic(sc); - return e; - } -@@ -8135,7 +8248,7 @@ L1: - structalign_t TypeStruct::alignment() - { - if (sym->alignment == 0) -- sym->size(0); -+ sym->size(Loc()); - return sym->alignment; - } - -@@ -8144,8 +8257,7 @@ Expression *TypeStruct::defaultInit(Loc - #if LOGDEFAULTINIT - printf("TypeStruct::defaultInit() '%s'\n", toChars()); - #endif -- Symbol *s = sym->toInitializer(); -- Declaration *d = new SymbolDeclaration(sym->loc, s, sym); -+ Declaration *d = new SymbolDeclaration(sym->loc, sym); - assert(d); - d->type = this; - return new VarExp(sym->loc, d); -@@ -8163,25 +8275,27 @@ Expression *TypeStruct::defaultInitLiter - //if (sym->isNested()) - // return defaultInit(loc); - Expressions *structelems = new Expressions(); -- structelems->setDim(sym->fields.dim - sym->isnested); -+ structelems->setDim(sym->fields.dim - sym->isNested()); -+ unsigned offset = 0; - for (size_t j = 0; j < structelems->dim; j++) - { - VarDeclaration *vd = sym->fields[j]; -- Type *telem = vd->type->addMod(this->mod); - Expression *e; -- if (vd->init) -- { if (vd->init->isVoidInitializer()) -+ if (vd->offset < offset) -+ e = NULL; -+ else if (vd->init) -+ { -+ if (vd->init->isVoidInitializer()) - e = NULL; - else -- e = vd->init->toExpression(); -+ e = vd->getConstInitializer(false); - } - else - e = vd->type->defaultInitLiteral(loc); -- if (e && vd->scope) -- { -- e = e->semantic(vd->scope); -- e = e->implicitCastTo(vd->scope, telem); -- } -+ if (e && e->op == TOKerror) -+ return e; -+ if (e) -+ offset = vd->offset + vd->type->size(); - (*structelems)[j] = e; - } - StructLiteralExp *structinit = new StructLiteralExp(loc, (StructDeclaration *)sym, structelems); -@@ -8214,7 +8328,7 @@ int TypeStruct::needsDestruction() - - bool TypeStruct::needsNested() - { -- if (sym->isnested) -+ if (sym->isNested()) - return true; - - for (size_t i = 0; i < sym->fields.dim; i++) -@@ -8267,7 +8381,7 @@ int TypeStruct::hasPointers() - // Probably should cache this information in sym rather than recompute - StructDeclaration *s = sym; - -- sym->size(0); // give error for forward references -+ sym->size(Loc()); // give error for forward references - for (size_t i = 0; i < s->fields.dim; i++) - { - Dsymbol *sm = s->fields[i]; -@@ -8296,26 +8410,40 @@ MATCH TypeStruct::implicitConvTo(Type *t - } - - if (ty == to->ty && sym == ((TypeStruct *)to)->sym) -- { m = MATCHexact; // exact match -+ { -+ m = MATCHexact; // exact match - if (mod != to->mod) - { - m = MATCHconst; - if (MODimplicitConv(mod, to->mod)) - ; - else -- { /* Check all the fields. If they can all be converted, -+ { -+ /* Check all the fields. If they can all be converted, - * allow the conversion. - */ -+ unsigned offset; - for (size_t i = 0; i < sym->fields.dim; i++) -- { Dsymbol *s = sym->fields[i]; -- VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ { -+ VarDeclaration *v = sym->fields[i]; -+ if (i == 0) -+ ; -+ else if (v->offset == offset) -+ { -+ if (m) -+ continue; -+ } -+ else -+ { -+ if (!m) -+ return m; -+ } - - // 'from' type - Type *tvf = v->type->addMod(mod); - - // 'to' type -- Type *tv = v->type->castMod(to->mod); -+ Type *tv = v->type->addMod(to->mod); - - // field match - MATCH mf = tvf->implicitConvTo(tv); -@@ -8325,12 +8453,17 @@ MATCH TypeStruct::implicitConvTo(Type *t - return mf; - if (mf < m) // if field match is worse - m = mf; -+ offset = v->offset; - } - } - } - } -- else if (sym->aliasthis) -+ else if (sym->aliasthis && !(att & RECtracing)) -+ { -+ att = (AliasThisRec)(att | RECtracing); - m = aliasthisOf()->implicitConvTo(to); -+ att = (AliasThisRec)(att & ~RECtracing); -+ } - else - m = MATCHnomatch; // no match - return m; -@@ -8351,13 +8484,16 @@ unsigned TypeStruct::wildConvTo(Type *tp - if (ty == tprm->ty && sym == ((TypeStruct *)tprm)->sym) - return Type::wildConvTo(tprm); - -- if (sym->aliasthis) -- { Type *t = aliasthisOf(); -- assert(t); -- return t->wildConvTo(tprm); -+ unsigned mod = 0; -+ -+ if (sym->aliasthis && !(att & RECtracing)) -+ { -+ att = (AliasThisRec)(att | RECtracing); -+ mod = aliasthisOf()->wildConvTo(tprm); -+ att = (AliasThisRec)(att & ~RECtracing); - } - -- return 0; -+ return mod; - } - - Type *TypeStruct::toHeadMutable() -@@ -8372,6 +8508,7 @@ TypeClass::TypeClass(ClassDeclaration *s - : Type(Tclass) - { - this->sym = sym; -+ this->att = RECfwdref; - } - - const char *TypeClass::kind() -@@ -8415,7 +8552,7 @@ void TypeClass::toDecoBuffer(OutBuffer * - const char *name = sym->mangle(); - //printf("TypeClass::toDecoBuffer('%s' flag=%d mod=%x) = '%s'\n", toChars(), flag, mod, name); - Type::toDecoBuffer(buf, flag); -- buf->printf("%s", name); -+ buf->writestring(name); - } - - void TypeClass::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) -@@ -8427,7 +8564,7 @@ void TypeClass::toCBuffer2(OutBuffer *bu - buf->writestring(sym->toChars()); - } - --Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident) -+Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag) - { - VarDeclaration *v; - Dsymbol *s; -@@ -8469,34 +8606,39 @@ Expression *TypeClass::dotExp(Scope *sc, - Expressions *exps = new Expressions; - exps->reserve(sym->fields.dim); - -- Expression *ev = e; -+ Expression *e0 = NULL; -+ Expression *ev = e->op == TOKtype ? NULL : e; -+ if (sc->func && ev && ev->hasSideEffect()) -+ { -+ Identifier *id = Lexer::uniqueId("__tup"); -+ ExpInitializer *ei = new ExpInitializer(e->loc, ev); -+ VarDeclaration *vd = new VarDeclaration(e->loc, NULL, id, ei); -+ vd->storage_class |= STCctfe | STCref | STCforeach; -+ -+ e0 = new DeclarationExp(e->loc, vd); -+ ev = new VarExp(e->loc, vd); -+ } - for (size_t i = 0; i < sym->fields.dim; i++) -- { VarDeclaration *v = sym->fields[i]; -+ { -+ VarDeclaration *v = sym->fields[i]; - // Don't include hidden 'this' pointer - if (v->isThisDeclaration()) - continue; -- Expression *fe; -- if (i == 0 && sc->func && sym->fields.dim > 1 && -- e->hasSideEffect()) -- { -- Identifier *id = Lexer::uniqueId("__tup"); -- ExpInitializer *ei = new ExpInitializer(e->loc, e); -- VarDeclaration *vd = new VarDeclaration(e->loc, NULL, id, ei); -- vd->storage_class |= STCctfe | STCref | STCforeach; -- -- ev = new VarExp(e->loc, vd); -- fe = new CommaExp(e->loc, new DeclarationExp(e->loc, vd), ev); -- fe = new DotVarExp(e->loc, fe, v); -- } -+ Expression *ex; -+ if (ev) -+ ex = new DotVarExp(e->loc, ev, v); - else -- fe = new DotVarExp(e->loc, ev, v); -- exps->push(fe); -+ { -+ ex = new VarExp(e->loc, v); -+ ex->type = ex->type->addMod(e->type->mod); -+ } -+ exps->push(ex); - } -- e = new TupleExp(e->loc, exps); -- sc = sc->push(); -- sc->noaccesscheck = 1; -- e = e->semantic(sc); -- sc->pop(); -+ e = new TupleExp(e->loc, e0, exps); -+ Scope *sc2 = sc->push(); -+ sc2->flags = sc->flags | SCOPEnoaccesscheck; -+ e = e->semantic(sc2); -+ sc2->pop(); - return e; - } - -@@ -8505,34 +8647,27 @@ L1: - if (!s) - { - // See if it's 'this' class or a base class -- if (e->op != TOKtype) -+ if (sym->ident == ident) - { -- if (sym->ident == ident) -- { -- e = new DotTypeExp(0, e, sym); -- return e; -- } -- -- ClassDeclaration *cbase = sym->searchBase(e->loc, ident); -- if (cbase) -- { -- if (InterfaceDeclaration *ifbase = cbase->isInterfaceDeclaration()) -- { -- e = new CastExp(0, e, ifbase->type); -- return e; -- } -- else -- { -- e = new DotTypeExp(0, e, cbase); -- return e; -- } -- } -+ if (e->op == TOKtype) -+ return Type::getProperty(e->loc, ident, 0); -+ return new DotTypeExp(e->loc, e, sym); -+ } -+ if (ClassDeclaration *cbase = sym->searchBase(e->loc, ident)) -+ { -+ if (e->op == TOKtype) -+ return Type::getProperty(e->loc, ident, 0); -+ if (InterfaceDeclaration *ifbase = cbase->isInterfaceDeclaration()) -+ e = new CastExp(e->loc, e, ifbase->type); -+ else -+ e = new DotTypeExp(e->loc, e, cbase); -+ return e; - } - - if (ident == Id::classinfo) - { -- assert(ClassDeclaration::classinfo); -- Type *t = ClassDeclaration::classinfo->type; -+ assert(Type::typeinfoclass); -+ Type *t = Type::typeinfoclass->type; - if (e->op == TOKtype || e->op == TOKdottype) - { - /* For type.classinfo, we know the classinfo -@@ -8578,7 +8713,7 @@ L1: - { /* The pointer to the vtbl[] - * *cast(invariant(void*)**)e - */ -- e = e->castTo(sc, tvoidptr->invariantOf()->pointerTo()->pointerTo()); -+ e = e->castTo(sc, tvoidptr->immutableOf()->pointerTo()->pointerTo()); - e = new PtrExp(e->loc, e); - e = e->semantic(sc); - return e; -@@ -8606,21 +8741,23 @@ L1: - } - else - { -- return noMember(sc, e, ident); -+ return noMember(sc, e, ident, flag); - } - } - if (!s->isFuncDeclaration()) // because of overloading - s->checkDeprecated(e->loc, sc); - s = s->toAlias(); -- v = s->isVarDeclaration(); -- if (v && !v->isDataseg()) -- { Expression *ei = v->getConstInitializer(); - -- if (ei) -- { e = ei->copy(); // need to copy it if it's a StringExp -- e = e->semantic(sc); -- return e; -- } -+ v = s->isVarDeclaration(); -+ if (v && v->inuse && (!v->type || !v->type->deco)) // Bugzilla 9494 -+ { e->error("circular reference to '%s'", v->toPrettyChars()); -+ return new ErrorExp(); -+ } -+ if (v && !v->isDataseg() && (v->storage_class & STCmanifest)) -+ { -+ Expression *ve = new VarExp(e->loc, v); -+ ve = ve->semantic(sc); -+ return ve; - } - - if (s->getType()) -@@ -8631,8 +8768,7 @@ L1: - EnumMember *em = s->isEnumMember(); - if (em) - { -- assert(em->value); -- return em->value->copy(); -+ return em->getVarExp(e->loc, sc); - } - - TemplateMixin *tm = s->isTemplateMixin(); -@@ -8646,7 +8782,10 @@ L1: - TemplateDeclaration *td = s->isTemplateDeclaration(); - if (td) - { -- e = new DotTemplateExp(e->loc, e, td); -+ if (e->op == TOKtype) -+ e = new ScopeExp(e->loc, td); -+ else -+ e = new DotTemplateExp(e->loc, e, td); - e = e->semantic(sc); - return e; - } -@@ -8677,7 +8816,7 @@ L1: - OverloadSet *o = s->isOverloadSet(); - if (o) - { -- OverExp *oe = new OverExp(o); -+ OverExp *oe = new OverExp(e->loc, o); - if (e->op == TOKtype) - return oe; - return new DotExp(e->loc, e, oe); -@@ -8695,30 +8834,27 @@ L1: - /* It's: - * Class.d - */ -- if (d->isTupleDeclaration()) -- { -- e = new TupleExp(e->loc, d->isTupleDeclaration()); -- e = e->semantic(sc); -- return e; -- } - -- #if 1 // Workaround for Bugzilla 9213 -- FuncDeclaration *fd = sc->func; -- if (d->needThis() && d->isVarDeclaration() && fd && fd->vthis) -+ // If Class is in a failed template, return an error -+ TemplateInstance *tiparent = d->inTemplateInstance(); -+ if (tiparent && tiparent->errors) -+ return new ErrorExp(); -+ -+ if (TupleDeclaration *tup = d->isTupleDeclaration()) - { -- e = new DotVarExp(e->loc, new ThisExp(e->loc), d); -+ e = new TupleExp(e->loc, tup); - e = e->semantic(sc); - return e; - } -- #endif -- -- FuncDeclaration *fdthis = hasThis(sc); -- if (d->needThis() && fdthis) -+ if (d->needThis() && sc->intypeof != 1) - { -- if (d->isFuncDeclaration()) -+ /* Rewrite as: -+ * this.d -+ */ -+ if (hasThis(sc)) - { - // This is almost same as getRightThis() in expression.c -- Expression *e1 = new VarExp(e->loc, fdthis->vthis); -+ Expression *e1 = new ThisExp(e->loc); - e1 = e1->semantic(sc); - L2: - Type *t = e1->type->toBasetype(); -@@ -8773,16 +8909,8 @@ L1: - goto L2; - } - } -- else -- { -- /* Rewrite as: -- * this.d -- */ -- DotVarExp *de = new DotVarExp(e->loc, new ThisExp(e->loc), d); -- e = de->semantic(sc); -- return e; -- } - } -+ //printf("e = %s, d = %s\n", e->toChars(), d->toChars()); - accessCheck(e->loc, sc, e, d); - VarExp *ve = new VarExp(e->loc, d, 1); - if (d->isVarDeclaration() && d->needThis()) -@@ -8790,14 +8918,13 @@ L1: - return ve; - } - -- if (d->isDataseg()) -+ bool unreal = e->op == TOKvar && ((VarExp *)e)->var->isField(); -+ if (d->isDataseg() || unreal && d->isField()) - { - // (e, d) -- VarExp *ve; -- - accessCheck(e->loc, sc, e, d); -- ve = new VarExp(e->loc, d); -- e = new CommaExp(e->loc, e, ve); -+ Expression *ve = new VarExp(e->loc, d); -+ e = unreal ? ve : new CommaExp(e->loc, e, ve); - e = e->semantic(sc); - return e; - } -@@ -8849,22 +8976,21 @@ MATCH TypeClass::implicitConvTo(Type *to - { - if (cdto->scope) - cdto->semantic(NULL); -+ if (sym->scope) -+ sym->semantic(NULL); - if (cdto->isBaseOf(sym, NULL) && MODimplicitConv(mod, to->mod)) - { //printf("'to' is base\n"); - return MATCHconvert; - } - } - -- if (global.params.Dversion == 1) -- { -- // Allow conversion to (void *) -- if (to->ty == Tpointer && ((TypePointer *)to)->next->ty == Tvoid) -- return MATCHconvert; -- } -- - m = MATCHnomatch; -- if (sym->aliasthis) -+ if (sym->aliasthis && !(att & RECtracing)) -+ { -+ att = (AliasThisRec)(att | RECtracing); - m = aliasthisOf()->implicitConvTo(to); -+ att = (AliasThisRec)(att & ~RECtracing); -+ } - - return m; - } -@@ -8880,7 +9006,7 @@ MATCH TypeClass::constConv(Type *to) - /* Conversion derived to const(base) - */ - int offset = 0; -- if (to->isBaseOf(this, &offset) && offset == 0 && !to->isMutable()) -+ if (to->isBaseOf(this, &offset) && offset == 0 && !to->isMutable() && !to->isWild()) - return MATCHconvert; - - return MATCHnomatch; -@@ -8897,10 +9023,16 @@ unsigned TypeClass::wildConvTo(Type *tpr - if (cdprm && cdprm->isBaseOf(sym, NULL)) - return Type::wildConvTo(tprm); - -- if (sym->aliasthis) -- return aliasthisOf()->wildConvTo(tprm); -+ unsigned mod = 0; - -- return 0; -+ if (sym->aliasthis && !(att & RECtracing)) -+ { -+ att = (AliasThisRec)(att | RECtracing); -+ mod = aliasthisOf()->wildConvTo(tprm); -+ att = (AliasThisRec)(att & ~RECtracing); -+ } -+ -+ return mod; - } - - Type *TypeClass::toHeadMutable() -@@ -9025,31 +9157,28 @@ Type *TypeTuple::semantic(Loc loc, Scope - return this; - } - --int TypeTuple::equals(Object *o) --{ Type *t; -- -- t = (Type *)o; -+bool TypeTuple::equals(RootObject *o) -+{ -+ Type *t = (Type *)o; - //printf("TypeTuple::equals(%s, %s)\n", toChars(), t->toChars()); - if (this == t) -- { -- return 1; -- } -+ return true; - if (t->ty == Ttuple) -- { TypeTuple *tt = (TypeTuple *)t; -- -+ { -+ TypeTuple *tt = (TypeTuple *)t; - if (arguments->dim == tt->arguments->dim) - { - for (size_t i = 0; i < tt->arguments->dim; i++) -- { Parameter *arg1 = (*arguments)[i]; -+ { -+ Parameter *arg1 = (*arguments)[i]; - Parameter *arg2 = (*tt->arguments)[i]; -- - if (!arg1->type->equals(arg2->type)) -- return 0; -+ return false; - } -- return 1; -+ return true; - } - } -- return 0; -+ return false; - } - - Type *TypeTuple::reliesOnTident(TemplateParameters *tparams) -@@ -9095,12 +9224,13 @@ void TypeTuple::toDecoBuffer(OutBuffer * - //printf("TypeTuple::toDecoBuffer() this = %p, %s\n", this, toChars()); - Type::toDecoBuffer(buf, flag); - OutBuffer buf2; -+ buf2.reserve(32); - Parameter::argsToDecoBuffer(&buf2, arguments); - int len = (int)buf2.offset; - buf->printf("%d%.*s", len, len, (char *)buf2.extractData()); - } - --Expression *TypeTuple::getProperty(Loc loc, Identifier *ident) -+Expression *TypeTuple::getProperty(Loc loc, Identifier *ident, int flag) - { Expression *e; - - #if LOGDOTEXP -@@ -9114,6 +9244,10 @@ Expression *TypeTuple::getProperty(Loc l - { - e = defaultInitLiteral(loc); - } -+ else if (flag) -+ { -+ e = NULL; -+ } - else - { - error(loc, "no property '%s' for tuple '%s'", ident->toChars(), toChars()); -@@ -9200,17 +9334,19 @@ Type *TypeSlice::semantic(Loc loc, Scope - return t; - } - --void TypeSlice::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) -+void TypeSlice::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid) - { -- next->resolve(loc, sc, pe, pt, ps); -+ next->resolve(loc, sc, pe, pt, ps, intypeid); - if (*pe) -- { // It's really a slice expression -- Expression *e; -- e = new SliceExp(loc, *pe, lwr, upr); -- *pe = e; -+ { -+ // It's really a slice expression -+ if (Dsymbol *s = getDsymbol(*pe)) -+ *pe = new DsymbolExp(loc, s, 1); -+ *pe = new SliceExp(loc, *pe, lwr, upr); - } - else if (*ps) -- { Dsymbol *s = *ps; -+ { -+ Dsymbol *s = *ps; - TupleDeclaration *td = s->isTupleDeclaration(); - if (td) - { -@@ -9219,19 +9355,20 @@ void TypeSlice::resolve(Loc loc, Scope * - ScopeDsymbol *sym = new ArrayScopeSymbol(sc, td); - sym->parent = sc->scopesym; - sc = sc->push(sym); -- -+ sc = sc->startCTFE(); - lwr = lwr->semantic(sc); -- lwr = lwr->ctfeInterpret(); -- uinteger_t i1 = lwr->toUInteger(); -- - upr = upr->semantic(sc); -+ sc = sc->endCTFE(); -+ sc = sc->pop(); -+ -+ lwr = lwr->ctfeInterpret(); - upr = upr->ctfeInterpret(); -+ uinteger_t i1 = lwr->toUInteger(); - uinteger_t i2 = upr->toUInteger(); - -- sc = sc->pop(); -- - if (!(i1 <= i2 && i2 <= td->objects->dim)) -- { error(loc, "slice [%llu..%llu] is out of range of [0..%u]", i1, i2, td->objects->dim); -+ { -+ error(loc, "slice [%llu..%llu] is out of range of [0..%u]", i1, i2, td->objects->dim); - goto Ldefault; - } - -@@ -9260,7 +9397,7 @@ void TypeSlice::resolve(Loc loc, Scope * - else - { - Ldefault: -- Type::resolve(loc, sc, pe, pt, ps); -+ Type::resolve(loc, sc, pe, pt, ps, intypeid); - } - } - -@@ -9272,8 +9409,11 @@ void TypeSlice::toCBuffer2(OutBuffer *bu - } - next->toCBuffer2(buf, hgs, this->mod); - -- buf->printf("[%s .. ", lwr->toChars()); -- buf->printf("%s]", upr->toChars()); -+ buf->writeByte('['); -+ sizeToCBuffer(buf, hgs, lwr); -+ buf->writestring(" .. "); -+ sizeToCBuffer(buf, hgs, upr); -+ buf->writeByte(']'); - } - - /***************************** TypeNull *****************************/ -@@ -9333,10 +9473,7 @@ void TypeNull::toCBuffer(OutBuffer *buf, - } - - d_uns64 TypeNull::size(Loc loc) { return tvoidptr->size(loc); } --//Expression *TypeNull::getProperty(Loc loc, Identifier *ident) { return new ErrorExp(); } --//Expression *TypeNull::dotExp(Scope *sc, Expression *e, Identifier *ident) { return new ErrorExp(); } --Expression *TypeNull::defaultInit(Loc loc) { return new NullExp(0, Type::tnull); } --//Expression *TypeNull::defaultInitLiteral(Loc loc) { return new ErrorExp(); } -+Expression *TypeNull::defaultInit(Loc loc) { return new NullExp(Loc(), Type::tnull); } - - /***************************** Parameter *****************************/ - -@@ -9376,12 +9513,14 @@ Parameters *Parameter::arraySyntaxCopy(P - - char *Parameter::argsTypesToChars(Parameters *args, int varargs) - { -- OutBuffer *buf = new OutBuffer(); -+ OutBuffer buf; -+ buf.reserve(16); - - HdrGenState hgs; -- argsToCBuffer(buf, &hgs, args, varargs); -+ argsToCBuffer(&buf, &hgs, args, varargs); - -- return buf->toChars(); -+ buf.writebyte(0); -+ return buf.extractData(); - } - - void Parameter::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *arguments, int varargs) -@@ -9390,6 +9529,7 @@ void Parameter::argsToCBuffer(OutBuffer - if (arguments) - { - OutBuffer argbuf; -+ argbuf.reserve(32); - - size_t dim = Parameter::dim(arguments); - for (size_t i = 0; i < dim; i++) -@@ -9404,8 +9544,7 @@ void Parameter::argsToCBuffer(OutBuffer - if (arg->storageClass & STCout) - buf->writestring("out "); - else if (arg->storageClass & STCref) -- buf->writestring((global.params.Dversion == 1) -- ? "inout " : "ref "); -+ buf->writestring("ref "); - else if (arg->storageClass & STCin) - buf->writestring("in "); - else if (arg->storageClass & STClazy) ---- a/src/gcc/d/dfrontend/mtype.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/mtype.h 2014-04-01 16:32:51.000000000 +0100 -@@ -22,34 +22,33 @@ - #include "expression.h" - - struct Scope; --struct Identifier; --struct Expression; --struct StructDeclaration; --struct ClassDeclaration; --struct VarDeclaration; --struct EnumDeclaration; --struct TypedefDeclaration; --struct TypeInfoDeclaration; --struct Dsymbol; --struct TemplateInstance; -+class Identifier; -+class Expression; -+class StructDeclaration; -+class ClassDeclaration; -+class VarDeclaration; -+class EnumDeclaration; -+class TypedefDeclaration; -+class TypeInfoDeclaration; -+class Dsymbol; -+class TemplateInstance; - struct CppMangleState; --struct TemplateDeclaration; -+class TemplateDeclaration; - struct JsonOut; - enum LINK; - --struct TypeBasic; -+class TypeBasic; - struct HdrGenState; --struct Parameter; -+class Parameter; - - // Back end - #ifdef IN_GCC --typedef union tree_node TYPE; --typedef TYPE type; -+typedef union tree_node type; - #else - typedef struct TYPE type; - #endif - struct Symbol; --struct TypeTuple; -+class TypeTuple; - - enum ENUMTY - { -@@ -112,20 +111,22 @@ extern int Tsize_t; - extern int Tptrdiff_t; - - --struct Type : Object -+/* pick this order of numbers so switch statements work better -+ */ -+#define MODconst 1 // type is const -+#define MODimmutable 4 // type is immutable -+#define MODshared 2 // type is shared -+#define MODwild 8 // type is wild -+#define MODmutable 0x10 // type is mutable (only used in wildcard matching) -+ -+class Type : public RootObject - { -+public: - TY ty; - unsigned char mod; // modifiers MODxxxx -- /* pick this order of numbers so switch statements work better -- */ -- #define MODconst 1 // type is const -- #define MODimmutable 4 // type is immutable -- #define MODshared 2 // type is shared -- #define MODwild 8 // type is wild -- #define MODmutable 0x10 // type is mutable (only used in wildcard matching) - char *deco; - -- /* These are cached values that are lazily evaluated by constOf(), invariantOf(), etc. -+ /* These are cached values that are lazily evaluated by constOf(), immutableOf(), etc. - * They should not be referenced by anybody but mtype.c. - * They can be NULL if not lazily evaluated yet. - * Note that there is no "shared immutable", because that is just immutable -@@ -146,51 +147,49 @@ struct Type : Object - - type *ctype; // for back end - -- #define tvoid basic[Tvoid] -- #define tint8 basic[Tint8] -- #define tuns8 basic[Tuns8] -- #define tint16 basic[Tint16] -- #define tuns16 basic[Tuns16] -- #define tint32 basic[Tint32] -- #define tuns32 basic[Tuns32] -- #define tint64 basic[Tint64] -- #define tuns64 basic[Tuns64] -- #define tint128 basic[Tint128] -- #define tuns128 basic[Tuns128] -- #define tfloat32 basic[Tfloat32] -- #define tfloat64 basic[Tfloat64] -- #define tfloat80 basic[Tfloat80] -- -- #define timaginary32 basic[Timaginary32] -- #define timaginary64 basic[Timaginary64] -- #define timaginary80 basic[Timaginary80] -- -- #define tcomplex32 basic[Tcomplex32] -- #define tcomplex64 basic[Tcomplex64] -- #define tcomplex80 basic[Tcomplex80] -- -- #define tbool basic[Tbool] -- #define tchar basic[Tchar] -- #define twchar basic[Twchar] -- #define tdchar basic[Tdchar] -+ static Type *tvoid; -+ static Type *tint8; -+ static Type *tuns8; -+ static Type *tint16; -+ static Type *tuns16; -+ static Type *tint32; -+ static Type *tuns32; -+ static Type *tint64; -+ static Type *tuns64; -+ static Type *tint128; -+ static Type *tuns128; -+ static Type *tfloat32; -+ static Type *tfloat64; -+ static Type *tfloat80; -+ -+ static Type *timaginary32; -+ static Type *timaginary64; -+ static Type *timaginary80; -+ -+ static Type *tcomplex32; -+ static Type *tcomplex64; -+ static Type *tcomplex80; -+ -+ static Type *tbool; -+ static Type *tchar; -+ static Type *twchar; -+ static Type *tdchar; - - // Some special types -- #define tshiftcnt tint32 // right side of shift expression --// #define tboolean tint32 // result of boolean expression -- #define tboolean tbool // result of boolean expression -- #define tindex tsize_t // array/ptr index -+ static Type *tshiftcnt; -+ static Type *tboolean; - static Type *tvoidptr; // void* - static Type *tstring; // immutable(char)[] - static Type *tvalist; // va_list alias -- #define terror basic[Terror] // for error recovery -- -- #define tnull basic[Tnull] // for null type -+ static Type *terror; // for error recovery -+ static Type *tnull; // for null type - -- #define tsize_t basic[Tsize_t] // matches size_t alias -- #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias -- #define thash_t tsize_t // matches hash_t alias -+ static Type *tsize_t; // matches size_t alias -+ static Type *tptrdiff_t; // matches ptrdiff_t alias -+ static Type *thash_t; // matches hash_t alias -+ static Type *tindex; // array/ptr index - -- static ClassDeclaration *typeinfo; -+ static ClassDeclaration *dtypeinfo; - static ClassDeclaration *typeinfoclass; - static ClassDeclaration *typeinfointerface; - static ClassDeclaration *typeinfostruct; -@@ -228,13 +227,16 @@ struct Type : Object - - Type(TY ty); - virtual const char *kind(); -+ Type *copy(); - virtual Type *syntaxCopy(); -- int equals(Object *o); -+ bool equals(RootObject *o); - int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() - int covariant(Type *t, StorageClass *pstc = NULL); - char *toChars(); - static char needThisPrefix(); - static void init(); -+ -+ #define SIZE_INVALID (~(d_uns64)0) - d_uns64 size(); - virtual d_uns64 size(Loc loc); - virtual unsigned alignsize(); -@@ -248,7 +250,6 @@ struct Type : Object - void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); - void modToBuffer(OutBuffer *buf); - char *modToChars(); -- void toJsonProperty(JsonOut *json, const char *); - virtual void toJson(JsonOut *json); - #if CPP_MANGLE - virtual void toCppMangle(OutBuffer *buf, CppMangleState *cms); -@@ -273,8 +274,9 @@ struct Type : Object - int isWild() { return mod & MODwild; } - int isSharedWild() { return mod == (MODshared | MODwild); } - int isNaked() { return mod == 0; } -+ Type *nullAttributes(); - Type *constOf(); -- Type *invariantOf(); -+ Type *immutableOf(); - Type *mutableOf(); - Type *sharedOf(); - Type *sharedConstOf(); -@@ -291,6 +293,7 @@ struct Type : Object - Type *referenceTo(); - Type *arrayOf(); - Type *aliasthisOf(); -+ int checkAliasThisRec(); - virtual Type *makeConst(); - virtual Type *makeInvariant(); - virtual Type *makeShared(); -@@ -304,21 +307,21 @@ struct Type : Object - virtual MATCH implicitConvTo(Type *to); - virtual MATCH constConv(Type *to); - virtual unsigned wildConvTo(Type *tprm); -- Type *substWildTo(unsigned mod); -+ virtual Type *substWildTo(unsigned mod); - virtual Type *toHeadMutable(); - virtual ClassDeclaration *isClassHandle(); -- virtual Expression *getProperty(Loc loc, Identifier *ident); -- virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ virtual Expression *getProperty(Loc loc, Identifier *ident, int flag); -+ virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - virtual structalign_t alignment(); -- Expression *noMember(Scope *sc, Expression *e, Identifier *ident); -- virtual Expression *defaultInit(Loc loc = 0); -+ Expression *noMember(Scope *sc, Expression *e, Identifier *ident, int flag); -+ virtual Expression *defaultInit(Loc loc = Loc()); - virtual Expression *defaultInitLiteral(Loc loc); - virtual Expression *voidInitLiteral(VarDeclaration *var); -- virtual int isZeroInit(Loc loc = 0); // if initializer is 0 -+ virtual int isZeroInit(Loc loc = Loc()); // if initializer is 0 - virtual dt_t **toDt(dt_t **pdt); - Identifier *getTypeInfoIdent(int internal); - virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wildmatch = NULL); -- virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - Expression *getInternalTypeInfo(Scope *sc); - Expression *getTypeInfo(Scope *sc); - virtual TypeInfoDeclaration *getTypeInfoDeclaration(); -@@ -329,6 +332,7 @@ struct Type : Object - virtual int hasPointers(); - virtual TypeTuple *toArgTypes(); - virtual Type *nextOf(); -+ Type *baseElemOf(); - uinteger_t sizemask(); - virtual int needsDestruction(); - virtual bool needsNested(); -@@ -346,23 +350,25 @@ struct Type : Object - virtual TypeBasic *isTypeBasic(); - }; - --struct TypeError : Type -+class TypeError : public Type - { -+public: - TypeError(); - Type *syntaxCopy(); - - void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); - - d_uns64 size(Loc loc); -- Expression *getProperty(Loc loc, Identifier *ident); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - Expression *defaultInit(Loc loc); - Expression *defaultInitLiteral(Loc loc); - TypeTuple *toArgTypes(); - }; - --struct TypeNext : Type -+class TypeNext : public Type - { -+public: - Type *next; - - TypeNext(TY ty, Type *next); -@@ -383,8 +389,9 @@ struct TypeNext : Type - void transitive(); - }; - --struct TypeBasic : Type -+class TypeBasic : public Type - { -+public: - const char *dstring; - unsigned flags; - -@@ -393,8 +400,8 @@ struct TypeBasic : Type - Type *syntaxCopy(); - d_uns64 size(Loc loc); - unsigned alignsize(); -- Expression *getProperty(Loc loc, Identifier *ident); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - char *toChars(); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - #if CPP_MANGLE -@@ -417,8 +424,9 @@ struct TypeBasic : Type - TypeBasic *isTypeBasic(); - }; - --struct TypeVector : Type -+class TypeVector : public Type - { -+public: - Type *basetype; - - TypeVector(Loc loc, Type *basetype); -@@ -427,13 +435,14 @@ struct TypeVector : Type - Type *semantic(Loc loc, Scope *sc); - d_uns64 size(Loc loc); - unsigned alignsize(); -- Expression *getProperty(Loc loc, Identifier *ident); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - char *toChars(); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toDecoBuffer(OutBuffer *buf, int flag); - void toJson(JsonOut *json); - MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wildmatch = NULL); -+ Type *reliesOnTident(TemplateParameters *tparams); - #if CPP_MANGLE - void toCppMangle(OutBuffer *buf, CppMangleState *cms); - #endif -@@ -444,23 +453,27 @@ struct TypeVector : Type - int checkBoolean(); - MATCH implicitConvTo(Type *to); - Expression *defaultInit(Loc loc); -+ Expression *defaultInitLiteral(Loc loc); - TypeBasic *elementType(); - int isZeroInit(Loc loc); -+ dt_t **toDt(dt_t **pdt); - TypeInfoDeclaration *getTypeInfoDeclaration(); - TypeTuple *toArgTypes(); - - type *toCtype(); - }; - --struct TypeArray : TypeNext -+class TypeArray : public TypeNext - { -+public: - TypeArray(TY ty, Type *next); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - }; - - // Static array, one with a fixed dimension --struct TypeSArray : TypeArray -+class TypeSArray : public TypeArray - { -+public: - Expression *dim; - - TypeSArray(Type *t, Expression *dim); -@@ -469,11 +482,11 @@ struct TypeSArray : TypeArray - d_uns64 size(Loc loc); - unsigned alignsize(); - Type *semantic(Loc loc, Scope *sc); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - int isString(); - int isZeroInit(Loc loc); - structalign_t alignment(); -@@ -495,24 +508,27 @@ struct TypeSArray : TypeArray - void toCppMangle(OutBuffer *buf, CppMangleState *cms); - #endif - -+ static Type *makeType(Loc loc, Type *tn, dinteger_t dim); -+ - type *toCtype(); - type *toCParamtype(); - }; - - // Dynamic array, no dimension --struct TypeDArray : TypeArray -+class TypeDArray : public TypeArray - { -+public: - TypeDArray(Type *t); - const char *kind(); - Type *syntaxCopy(); - d_uns64 size(Loc loc); - unsigned alignsize(); - Type *semantic(Loc loc, Scope *sc); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - int isString(); - int isZeroInit(Loc loc); - int checkBoolean(); -@@ -530,8 +546,9 @@ struct TypeDArray : TypeArray - type *toCtype(); - }; - --struct TypeAArray : TypeArray -+class TypeAArray : public TypeArray - { -+public: - Type *index; // key type - Loc loc; - Scope *sc; -@@ -544,11 +561,11 @@ struct TypeAArray : TypeArray - d_uns64 size(Loc loc); - Type *semantic(Loc loc, Scope *sc); - StructDeclaration *getImpl(); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - Expression *defaultInit(Loc loc); - MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wildmatch = NULL); - int isZeroInit(Loc loc); -@@ -570,8 +587,9 @@ struct TypeAArray : TypeArray - type *toCtype(); - }; - --struct TypePointer : TypeNext -+class TypePointer : public TypeNext - { -+public: - TypePointer(Type *t); - const char *kind(); - Type *syntaxCopy(); -@@ -594,8 +612,9 @@ struct TypePointer : TypeNext - type *toCtype(); - }; - --struct TypeReference : TypeNext -+class TypeReference : public TypeNext - { -+public: - TypeReference(Type *t); - const char *kind(); - Type *syntaxCopy(); -@@ -603,7 +622,7 @@ struct TypeReference : TypeNext - d_uns64 size(Loc loc); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - Expression *defaultInit(Loc loc); - int isZeroInit(Loc loc); - #if CPP_MANGLE -@@ -634,8 +653,9 @@ enum PURE - PUREfwdref = 4, // it's pure, but not known which level yet - }; - --struct TypeFunction : TypeNext -+class TypeFunction : public TypeNext - { -+public: - // .next is the return type - - Parameters *parameters; // function parameters -@@ -644,21 +664,19 @@ struct TypeFunction : TypeNext - bool isnothrow; // true: nothrow - bool isproperty; // can be called without parentheses - bool isref; // true: returns a reference -- enum LINK linkage; // calling convention -- enum TRUST trust; // level of trust -- enum PURE purity; // PURExxxx -+ LINK linkage; // calling convention -+ TRUST trust; // level of trust -+ PURE purity; // PURExxxx - bool iswild; // is inout function - Expressions *fargs; // function arguments - - int inuse; - -- TypeFunction(Parameters *parameters, Type *treturn, int varargs, enum LINK linkage, StorageClass stc = 0); -+ TypeFunction(Parameters *parameters, Type *treturn, int varargs, LINK linkage, StorageClass stc = 0); - const char *kind(); -- TypeFunction *copy(); - Type *syntaxCopy(); - Type *semantic(Loc loc, Scope *sc); - void purityLevel(); -- bool hasMutableIndirectionParams(); - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); - void toCBufferWithAttributes(OutBuffer *buf, Identifier *ident, HdrGenState* hgs, TypeFunction *attrs, TemplateDeclaration *td); -@@ -675,17 +693,19 @@ struct TypeFunction : TypeNext - bool parameterEscapes(Parameter *p); - Type *addStorageClass(StorageClass stc); - -- MATCH callMatch(Expression *ethis, Expressions *toargs, int flag = 0); -+ Type *substWildTo(unsigned mod); -+ MATCH callMatch(Type *tthis, Expressions *toargs, int flag = 0); - type *toCtype(); -- enum RET retStyle(); -+ RET retStyle(); - - unsigned totym(); - - Expression *defaultInit(Loc loc); - }; - --struct TypeDelegate : TypeNext -+class TypeDelegate : public TypeNext - { -+public: - // .next is a TypeFunction - - TypeDelegate(Type *t); -@@ -701,7 +721,7 @@ struct TypeDelegate : TypeNext - int isZeroInit(Loc loc); - int checkBoolean(); - TypeInfoDeclaration *getTypeInfoDeclaration(); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - int hasPointers(); - TypeTuple *toArgTypes(); - #if CPP_MANGLE -@@ -711,23 +731,27 @@ struct TypeDelegate : TypeNext - type *toCtype(); - }; - --struct TypeQualified : Type -+class TypeQualified : public Type - { -+public: - Loc loc; -- Identifiers idents; // array of Identifier's representing ident.ident.ident etc. -+ Objects idents; // array of Identifier and TypeInstance, -+ // representing ident.ident!tiargs.ident. ... etc. - - TypeQualified(TY ty, Loc loc); - void syntaxCopyHelper(TypeQualified *t); - void addIdent(Identifier *ident); -+ void addInst(TemplateInstance *inst); - void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); - void toJson(JsonOut *json); - d_uns64 size(Loc loc); - void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, -- Expression **pe, Type **pt, Dsymbol **ps); -+ Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - }; - --struct TypeIdentifier : TypeQualified -+class TypeIdentifier : public TypeQualified - { -+public: - Identifier *ident; - Dsymbol *originalSymbol; // The symbol representing this identifier, before alias resolution - -@@ -738,7 +762,7 @@ struct TypeIdentifier : TypeQualified - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - Dsymbol *toDsymbol(Scope *sc); - Type *semantic(Loc loc, Scope *sc); - MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wildmatch = NULL); -@@ -748,8 +772,9 @@ struct TypeIdentifier : TypeQualified - - /* Similar to TypeIdentifier, but with a TemplateInstance as the root - */ --struct TypeInstance : TypeQualified -+class TypeInstance : public TypeQualified - { -+public: - TemplateInstance *tempinst; - - TypeInstance(Loc loc, TemplateInstance *tempinst); -@@ -759,15 +784,17 @@ struct TypeInstance : TypeQualified - //void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - Type *semantic(Loc loc, Scope *sc); - Dsymbol *toDsymbol(Scope *sc); - Type *reliesOnTident(TemplateParameters *tparams = NULL); - MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wildmatch = NULL); -+ Expression *toExpression(); - }; - --struct TypeTypeof : TypeQualified -+class TypeTypeof : public TypeQualified - { -+public: - Expression *exp; - int inuse; - -@@ -777,24 +804,39 @@ struct TypeTypeof : TypeQualified - Dsymbol *toDsymbol(Scope *sc); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - Type *semantic(Loc loc, Scope *sc); - d_uns64 size(Loc loc); - }; - --struct TypeReturn : TypeQualified -+class TypeReturn : public TypeQualified - { -+public: - TypeReturn(Loc loc); - const char *kind(); - Type *syntaxCopy(); - Dsymbol *toDsymbol(Scope *sc); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - Type *semantic(Loc loc, Scope *sc); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); - }; - --struct TypeStruct : Type -+// Whether alias this dependency is recursive or not. -+enum AliasThisRec -+{ -+ RECno = 0, // no alias this recursion -+ RECyes = 1, // alias this has recursive dependency -+ RECfwdref = 2, // not yet known -+ -+ RECtracing = 0x4, // mark in progress of implicitConvTo/wildConvTo -+}; -+ -+class TypeStruct : public Type - { -+public: - StructDeclaration *sym; -+ AliasThisRec att; - - TypeStruct(StructDeclaration *sym); - const char *kind(); -@@ -807,7 +849,7 @@ struct TypeStruct : Type - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - structalign_t alignment(); - Expression *defaultInit(Loc loc); - Expression *defaultInitLiteral(Loc loc); -@@ -833,8 +875,9 @@ struct TypeStruct : Type - type *toCtype(); - }; - --struct TypeEnum : Type -+class TypeEnum : public Type - { -+public: - EnumDeclaration *sym; - - TypeEnum(EnumDeclaration *sym); -@@ -848,8 +891,8 @@ struct TypeEnum : Type - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -- Expression *getProperty(Loc loc, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); - int isintegral(); - int isfloating(); - int isreal(); -@@ -858,6 +901,7 @@ struct TypeEnum : Type - int isscalar(); - int isunsigned(); - int checkBoolean(); -+ int isString(); - int isAssignable(); - int needsDestruction(); - bool needsNested(); -@@ -870,6 +914,7 @@ struct TypeEnum : Type - TypeInfoDeclaration *getTypeInfoDeclaration(); - int hasPointers(); - TypeTuple *toArgTypes(); -+ Type *nextOf(); - #if CPP_MANGLE - void toCppMangle(OutBuffer *buf, CppMangleState *cms); - #endif -@@ -877,8 +922,9 @@ struct TypeEnum : Type - type *toCtype(); - }; - --struct TypeTypedef : Type -+class TypeTypedef : public Type - { -+public: - TypedefDeclaration *sym; - - TypeTypedef(TypedefDeclaration *sym); -@@ -892,9 +938,9 @@ struct TypeTypedef : Type - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - structalign_t alignment(); -- Expression *getProperty(Loc loc, Identifier *ident); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); - int isintegral(); - int isfloating(); - int isreal(); -@@ -927,9 +973,11 @@ struct TypeTypedef : Type - type *toCParamtype(); - }; - --struct TypeClass : Type -+class TypeClass : public Type - { -+public: - ClassDeclaration *sym; -+ AliasThisRec att; - - TypeClass(ClassDeclaration *sym); - const char *kind(); -@@ -941,7 +989,7 @@ struct TypeClass : Type - void toDecoBuffer(OutBuffer *buf, int flag); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); -- Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); -+ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident, int flag); - ClassDeclaration *isClassHandle(); - int isBaseOf(Type *t, int *poffset); - MATCH implicitConvTo(Type *to); -@@ -966,8 +1014,9 @@ struct TypeClass : Type - Symbol *toSymbol(); - }; - --struct TypeTuple : Type -+class TypeTuple : public Type - { -+public: - Parameters *arguments; // types making up the tuple - - TypeTuple(Parameters *arguments); -@@ -978,18 +1027,19 @@ struct TypeTuple : Type - const char *kind(); - Type *syntaxCopy(); - Type *semantic(Loc loc, Scope *sc); -- int equals(Object *o); -+ bool equals(RootObject *o); - Type *reliesOnTident(TemplateParameters *tparams = NULL); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toDecoBuffer(OutBuffer *buf, int flag); - void toJson(JsonOut *json); -- Expression *getProperty(Loc loc, Identifier *ident); -+ Expression *getProperty(Loc loc, Identifier *ident, int flag); - Expression *defaultInit(Loc loc); - TypeInfoDeclaration *getTypeInfoDeclaration(); - }; - --struct TypeSlice : TypeNext -+class TypeSlice : public TypeNext - { -+public: - Expression *lwr; - Expression *upr; - -@@ -997,13 +1047,14 @@ struct TypeSlice : TypeNext - const char *kind(); - Type *syntaxCopy(); - Type *semantic(Loc loc, Scope *sc); -- void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); -+ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps, bool intypeid = false); - void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); - void toJson(JsonOut *json); - }; - --struct TypeNull : Type -+class TypeNull : public Type - { -+public: - TypeNull(); - const char *kind(); - -@@ -1016,18 +1067,16 @@ struct TypeNull : Type - void toJson(JsonOut *json); - - d_uns64 size(Loc loc); -- //Expression *getProperty(Loc loc, Identifier *ident); -- //Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); - Expression *defaultInit(Loc loc); -- //Expression *defaultInitLiteral(Loc loc); - }; - - /**************************************************************/ - - //enum InOut { None, In, Out, InOut, Lazy }; - --struct Parameter : Object -+class Parameter : public RootObject - { -+public: - //enum InOut inout; - StorageClass storageClass; - Type *type; -@@ -1039,10 +1088,11 @@ struct Parameter : Object - Type *isLazyArray(); - void toDecoBuffer(OutBuffer *buf); - int dyncast() { return DYNCAST_PARAMETER; } // kludge for template.isType() -- void toJson(JsonOut *json); - static Parameters *arraySyntaxCopy(Parameters *args); - static char *argsTypesToChars(Parameters *args, int varargs); -+#if CPP_MANGLE - static void argsCppMangle(OutBuffer *buf, CppMangleState *cms, Parameters *arguments, int varargs); -+#endif - static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *arguments, int varargs); - static void argsToDecoBuffer(OutBuffer *buf, Parameters *arguments); - static int isTPL(Parameters *arguments); ---- a/src/gcc/d/dfrontend/object.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/object.c 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,45 @@ -+ -+// Copyright (c) 1999-2012 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#include <stdio.h> -+ -+#include "object.h" -+#include "outbuffer.h" -+ -+/****************************** Object ********************************/ -+ -+bool RootObject::equals(RootObject *o) -+{ -+ return o == this; -+} -+ -+int RootObject::compare(RootObject *obj) -+{ -+ return this - obj; -+} -+ -+void RootObject::print() -+{ -+ printf("%s %p\n", toChars(), this); -+} -+ -+char *RootObject::toChars() -+{ -+ return (char *)"Object"; -+} -+ -+int RootObject::dyncast() -+{ -+ return 0; -+} -+ -+void RootObject::toBuffer(OutBuffer *b) -+{ -+ b->writestring("Object"); -+} ---- a/src/gcc/d/dfrontend/object.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/object.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,57 @@ -+ -+// Copyright (c) 1999-2011 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef OBJECT_H -+#define OBJECT_H -+ -+#define POSIX (linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun) -+ -+#if __DMC__ -+#pragma once -+#endif -+ -+#include <stddef.h> -+ -+typedef size_t hash_t; -+ -+struct OutBuffer; -+ -+/* -+ * Root of our class library. -+ */ -+class RootObject -+{ -+public: -+ RootObject() { } -+ virtual ~RootObject() { } -+ -+ virtual bool equals(RootObject *o); -+ -+ /** -+ * Return <0, ==0, or >0 if this is less than, equal to, or greater than obj. -+ * Useful for sorting Objects. -+ */ -+ virtual int compare(RootObject *obj); -+ -+ /** -+ * Pretty-print an Object. Useful for debugging the old-fashioned way. -+ */ -+ virtual void print(); -+ -+ virtual char *toChars(); -+ virtual void toBuffer(OutBuffer *buf); -+ -+ /** -+ * Used as a replacement for dynamic_cast. Returns a unique number -+ * defined by the library user. For Object, the return value is 0. -+ */ -+ virtual int dyncast(); -+}; -+ -+#endif ---- a/src/gcc/d/dfrontend/opover.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/opover.c 2014-04-01 16:32:51.000000000 +0100 -@@ -39,7 +39,6 @@ - static Dsymbol *inferApplyArgTypesX(Expression *ethis, FuncDeclaration *fstart, Parameters *arguments); - static void inferApplyArgTypesZ(TemplateDeclaration *tstart, Parameters *arguments); - static int inferApplyArgTypesY(TypeFunction *tf, Parameters *arguments, int flags = 0); --static void templateResolve(Match *m, TemplateDeclaration *td, Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *arguments); - - /******************************** Expression **************************/ - -@@ -182,7 +181,7 @@ AggregateDeclaration *isAggregate(Type * - /******************************************* - * Helper function to turn operator into template argument list - */ --Objects *opToArg(Scope *sc, enum TOK op) -+Objects *opToArg(Scope *sc, TOK op) - { - /* Remove the = from op= - */ -@@ -202,11 +201,11 @@ Objects *opToArg(Scope *sc, enum TOK op) - case TOKcatass: op = TOKcat; break; - case TOKpowass: op = TOKpow; break; - } -- Expression *e = new StringExp(0, (char *)Token::toChars(op)); -+ Expression *e = new StringExp(Loc(), (char *)Token::toChars(op)); - e = e->semantic(sc); -- Objects *targsi = new Objects(); -- targsi->push(e); -- return targsi; -+ Objects *tiargs = new Objects(); -+ tiargs->push(e); -+ return tiargs; - } - - /************************************ -@@ -236,27 +235,31 @@ Expression *UnaExp::op_overload(Scope *s - Dsymbol *fd = search_function(ad, Id::opIndexUnary); - if (fd) - { -- ae = resolveOpDollar(sc, ae); -- Objects *targsi = opToArg(sc, op); -- Expression *e = new DotTemplateInstanceExp(loc, ae->e1, fd->ident, targsi); -+ Expression *e0 = resolveOpDollar(sc, ae); -+ Objects *tiargs = opToArg(sc, op); -+ Expression *e = new DotTemplateInstanceExp(loc, ae->e1, fd->ident, tiargs); - e = new CallExp(loc, e, ae->arguments); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && ae->e1->type != att1) - { - /* Rewrite op(a[arguments]) as: - * op(a.aliasthis[arguments]) - */ - Expression *e1 = ae->copy(); - ((ArrayExp *)e1)->e1 = new DotIdExp(loc, ae->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ UnaExp *ue = (UnaExp *)copy(); -+ if (!ue->att1 && ae->e1->type->checkAliasThisRec()) -+ ue->att1 = ae->e1->type; -+ ue->e1 = e1; -+ if (Expression *e = ue->trySemantic(sc)) -+ return e; - } -+ att1 = NULL; - } - } - else if (e1->op == TOKslice) -@@ -274,33 +277,38 @@ Expression *UnaExp::op_overload(Scope *s - Dsymbol *fd = search_function(ad, Id::opSliceUnary); - if (fd) - { -- se = resolveOpDollar(sc, se); -+ Expression *e0 = resolveOpDollar(sc, se); - Expressions *a = new Expressions(); - assert(!se->lwr || se->upr); - if (se->lwr) -- { a->push(se->lwr); -+ { -+ a->push(se->lwr); - a->push(se->upr); - } -- Objects *targsi = opToArg(sc, op); -- Expression *e = new DotTemplateInstanceExp(loc, se->e1, fd->ident, targsi); -+ Objects *tiargs = opToArg(sc, op); -+ Expression *e = new DotTemplateInstanceExp(loc, se->e1, fd->ident, tiargs); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && se->e1->type != att1) - { - /* Rewrite op(a[lwr..upr]) as: - * op(a.aliasthis[lwr..upr]) - */ - Expression *e1 = se->copy(); - ((SliceExp *)e1)->e1 = new DotIdExp(loc, se->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ UnaExp *ue = (UnaExp *)copy(); -+ if (!ue->att1 && se->e1->type->checkAliasThisRec()) -+ ue->att1 = se->e1->type; -+ ue->e1 = e1; -+ if (Expression *e = ue->trySemantic(sc)) -+ return e; - } -+ att1 = NULL; - } - } - #endif -@@ -344,24 +352,26 @@ Expression *UnaExp::op_overload(Scope *s - fd = search_function(ad, Id::opUnary); - if (fd) - { -- Objects *targsi = opToArg(sc, op); -- Expression *e = new DotTemplateInstanceExp(loc, e1, fd->ident, targsi); -+ Objects *tiargs = opToArg(sc, op); -+ Expression *e = new DotTemplateInstanceExp(loc, e1, fd->ident, tiargs); - e = new CallExp(loc, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && this->e1->type != att1) - { - /* Rewrite op(e1) as: - * op(e1.aliasthis) - */ -+ //printf("att una %s e1 = %s\n", Token::toChars(op), this->e1->type->toChars()); - Expression *e1 = new DotIdExp(loc, this->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ UnaExp *ue = (UnaExp *)copy(); -+ if (!ue->att1 && this->e1->type->checkAliasThisRec()) -+ ue->att1 = this->e1->type; -+ ue->e1 = e1; -+ return ue->trySemantic(sc); - } - #endif - } -@@ -380,24 +390,27 @@ Expression *ArrayExp::op_overload(Scope - /* Rewrite op e1[arguments] as: - * e1.opIndex(arguments) - */ -- ArrayExp *ae = resolveOpDollar(sc, this); -- Expression *e = new DotIdExp(loc, ae->e1, fd->ident); -- e = new CallExp(loc, e, ae->arguments); -+ Expression *e0 = resolveOpDollar(sc, this); -+ Expression *e = new DotIdExp(loc, e1, fd->ident); -+ e = new CallExp(loc, e, arguments); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && this->e1->type != att1) - { - /* Rewrite op(e1) as: - * op(e1.aliasthis) - */ -+ //printf("att arr e1 = %s\n", this->e1->type->toChars()); - Expression *e1 = new DotIdExp(loc, this->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ UnaExp *ue = (UnaExp *)copy(); -+ if (!ue->att1 && this->e1->type->checkAliasThisRec()) -+ ue->att1 = this->e1->type; -+ ue->e1 = e1; -+ return ue->trySemantic(sc); - } - } - return NULL; -@@ -426,9 +439,9 @@ Expression *CastExp::op_overload(Scope * - return build_overload(loc, sc, e1, NULL, fd); - } - #endif -- Objects *targsi = new Objects(); -- targsi->push(to); -- Expression *e = new DotTemplateInstanceExp(loc, e1, fd->ident, targsi); -+ Objects *tiargs = new Objects(); -+ tiargs->push(to); -+ Expression *e = new DotTemplateInstanceExp(loc, e1, fd->ident, tiargs); - e = new CallExp(loc, e); - e = e->semantic(sc); - return e; -@@ -487,7 +500,7 @@ Expression *BinExp::op_overload(Scope *s - } - #endif - -- Objects *targsi = NULL; -+ Objects *tiargs = NULL; - #if DMDV2 - if (op == TOKplusplus || op == TOKminusminus) - { // Bug4099 fix -@@ -500,16 +513,28 @@ Expression *BinExp::op_overload(Scope *s - /* Try the new D2 scheme, opBinary and opBinaryRight - */ - if (ad1) -+ { - s = search_function(ad1, Id::opBinary); -+ if (s && !s->isTemplateDeclaration()) -+ { e1->error("%s.opBinary isn't a template", e1->toChars()); -+ return new ErrorExp(); -+ } -+ } - if (ad2) -+ { - s_r = search_function(ad2, Id::opBinaryRight); -+ if (s_r && !s_r->isTemplateDeclaration()) -+ { e2->error("%s.opBinaryRight isn't a template", e2->toChars()); -+ return new ErrorExp(); -+ } -+ } - -- // Set targsi, the template argument list, which will be the operator string -+ // Set tiargs, the template argument list, which will be the operator string - if (s || s_r) - { - id = Id::opBinary; - id_r = Id::opBinaryRight; -- targsi = opToArg(sc, op); -+ tiargs = opToArg(sc, op); - } - } - #endif -@@ -524,8 +549,10 @@ Expression *BinExp::op_overload(Scope *s - - args1.setDim(1); - args1[0] = e1; -+ expandTuples(&args1); - args2.setDim(1); - args2[0] = e2; -+ expandTuples(&args2); - argsset = 1; - - Match m; -@@ -533,32 +560,12 @@ Expression *BinExp::op_overload(Scope *s - m.last = MATCHnomatch; - - if (s) -- { -- FuncDeclaration *fd = s->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args2); -- } -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e1, &args2); -- } -- } -+ functionResolve(&m, s, loc, sc, tiargs, e1->type, &args2); - - FuncDeclaration *lastf = m.lastf; - - if (s_r) -- { -- FuncDeclaration *fd = s_r->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args1); -- } -- else -- { TemplateDeclaration *td = s_r->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e2, &args1); -- } -- } -+ functionResolve(&m, s_r, loc, sc, tiargs, e2->type, &args1); - - if (m.count > 1) - { -@@ -571,7 +578,7 @@ Expression *BinExp::op_overload(Scope *s - else if (m.last == MATCHnomatch) - { - m.lastf = m.anyf; -- if (targsi) -+ if (tiargs) - goto L1; - } - -@@ -593,7 +600,7 @@ Expression *BinExp::op_overload(Scope *s - - L1: - #if 1 // Retained for D1 compatibility -- if (isCommutative() && !targsi) -+ if (isCommutative() && !tiargs) - { - s = NULL; - s_r = NULL; -@@ -615,10 +622,13 @@ L1: - */ - - if (!argsset) -- { args1.setDim(1); -+ { -+ args1.setDim(1); - args1[0] = e1; -+ expandTuples(&args1); - args2.setDim(1); - args2[0] = e2; -+ expandTuples(&args2); - } - - Match m; -@@ -626,31 +636,12 @@ L1: - m.last = MATCHnomatch; - - if (s_r) -- { -- FuncDeclaration *fd = s_r->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args2); -- } -- else -- { TemplateDeclaration *td = s_r->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e1, &args2); -- } -- } -+ functionResolve(&m, s_r, loc, sc, tiargs, e1->type, &args2); -+ - FuncDeclaration *lastf = m.lastf; - - if (s) -- { -- FuncDeclaration *fd = s->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args1); -- } -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e2, &args1); -- } -- } -+ functionResolve(&m, s, loc, sc, tiargs, e2->type, &args1); - - if (m.count > 1) - { -@@ -709,11 +700,15 @@ L1: - /* Rewrite (e1 op e2) as: - * (e1.aliasthis op e2) - */ -+ if (att1 && this->e1->type == att1) -+ return NULL; -+ //printf("att bin e1 = %s\n", this->e1->type->toChars()); - Expression *e1 = new DotIdExp(loc, this->e1, ad1->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att1 && this->e1->type->checkAliasThisRec()) -+ be->att1 = this->e1->type; -+ be->e1 = e1; -+ return be->trySemantic(sc); - } - - // Try alias this on second operand -@@ -726,11 +721,15 @@ L1: - /* Rewrite (e1 op e2) as: - * (e1 op e2.aliasthis) - */ -+ if (att2 && this->e2->type == att2) -+ return NULL; -+ //printf("att bin e2 = %s\n", this->e2->type->toChars()); - Expression *e2 = new DotIdExp(loc, this->e2, ad2->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e2 = e2; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att2 && this->e2->type->checkAliasThisRec()) -+ be->att2 = this->e2->type; -+ be->e2 = e2; -+ return be->trySemantic(sc); - } - #endif - return NULL; -@@ -760,7 +759,7 @@ Expression *BinExp::compare_overload(Sco - s_r = NULL; - } - -- Objects *targsi = NULL; -+ Objects *tiargs = NULL; - - if (s || s_r) - { -@@ -775,8 +774,10 @@ Expression *BinExp::compare_overload(Sco - - args1.setDim(1); - args1[0] = e1; -+ expandTuples(&args1); - args2.setDim(1); - args2[0] = e2; -+ expandTuples(&args2); - - Match m; - memset(&m, 0, sizeof(m)); -@@ -789,33 +790,13 @@ Expression *BinExp::compare_overload(Sco - } - - if (s) -- { -- FuncDeclaration *fd = s->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args2); -- } -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e1, &args2); -- } -- } -+ functionResolve(&m, s, loc, sc, tiargs, e1->type, &args2); - - FuncDeclaration *lastf = m.lastf; - int count = m.count; - - if (s_r) -- { -- FuncDeclaration *fd = s_r->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args1); -- } -- else -- { TemplateDeclaration *td = s_r->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e2, &args1); -- } -- } -+ functionResolve(&m, s_r, loc, sc, tiargs, e2->type, &args1); - - if (m.count > 1) - { -@@ -882,11 +863,15 @@ Expression *BinExp::compare_overload(Sco - /* Rewrite (e1 op e2) as: - * (e1.aliasthis op e2) - */ -+ if (att1 && this->e1->type == att1) -+ return NULL; -+ //printf("att cmp_bin e1 = %s\n", this->e1->type->toChars()); - Expression *e1 = new DotIdExp(loc, this->e1, ad1->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att1 && this->e1->type->checkAliasThisRec()) -+ be->att1 = this->e1->type; -+ be->e1 = e1; -+ return be->trySemantic(sc); - } - - // Try alias this on second operand -@@ -895,11 +880,15 @@ Expression *BinExp::compare_overload(Sco - /* Rewrite (e1 op e2) as: - * (e1 op e2.aliasthis) - */ -+ if (att2 && this->e2->type == att2) -+ return NULL; -+ //printf("att cmp_bin e2 = %s\n", this->e2->type->toChars()); - Expression *e2 = new DotIdExp(loc, this->e2, ad2->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e2 = e2; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att2 && this->e2->type->checkAliasThisRec()) -+ be->att2 = this->e2->type; -+ be->e2 = e2; -+ return be->trySemantic(sc); - } - - return NULL; -@@ -915,7 +904,7 @@ Expression *EqualExp::op_overload(Scope - { ClassDeclaration *cd1 = t1->isClassHandle(); - ClassDeclaration *cd2 = t2->isClassHandle(); - -- if (!(cd1->isCPPinterface() || cd2->isCPPinterface())) -+ if (!(cd1->cpp || cd2->cpp)) - { - /* Rewrite as: - * .object.opEquals(e1, e2) -@@ -975,30 +964,34 @@ Expression *BinAssignExp::op_overload(Sc - Dsymbol *fd = search_function(ad, Id::opIndexOpAssign); - if (fd) - { -- ae = resolveOpDollar(sc, ae); -+ Expression *e0 = resolveOpDollar(sc, ae); - Expressions *a = (Expressions *)ae->arguments->copy(); - a->insert(0, e2); - -- Objects *targsi = opToArg(sc, op); -- Expression *e = new DotTemplateInstanceExp(loc, ae->e1, fd->ident, targsi); -+ Objects *tiargs = opToArg(sc, op); -+ Expression *e = new DotTemplateInstanceExp(loc, ae->e1, fd->ident, tiargs); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && ae->e1->type != att1) - { - /* Rewrite a[arguments] op= e2 as: - * a.aliasthis[arguments] op= e2 - */ - Expression *e1 = ae->copy(); - ((ArrayExp *)e1)->e1 = new DotIdExp(loc, ae->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att1 && ae->e1->type->checkAliasThisRec()) -+ be->att1 = ae->e1->type; -+ be->e1 = e1; -+ if (Expression *e = be->trySemantic(sc)) -+ return e; - } -+ att1 = NULL; - } - } - else if (e1->op == TOKslice) -@@ -1016,35 +1009,40 @@ Expression *BinAssignExp::op_overload(Sc - Dsymbol *fd = search_function(ad, Id::opSliceOpAssign); - if (fd) - { -- se = resolveOpDollar(sc, se); -+ Expression *e0 = resolveOpDollar(sc, se); - Expressions *a = new Expressions(); - a->push(e2); - assert(!se->lwr || se->upr); - if (se->lwr) -- { a->push(se->lwr); -+ { -+ a->push(se->lwr); - a->push(se->upr); - } - -- Objects *targsi = opToArg(sc, op); -- Expression *e = new DotTemplateInstanceExp(loc, se->e1, fd->ident, targsi); -+ Objects *tiargs = opToArg(sc, op); -+ Expression *e = new DotTemplateInstanceExp(loc, se->e1, fd->ident, tiargs); - e = new CallExp(loc, e, a); -+ e = combine(e0, e); - e = e->semantic(sc); - return e; - } - - // Didn't find it. Forward to aliasthis -- if (ad->aliasthis) -+ if (ad->aliasthis && se->e1->type != att1) - { - /* Rewrite a[lwr..upr] op= e2 as: - * a.aliasthis[lwr..upr] op= e2 - */ - Expression *e1 = se->copy(); - ((SliceExp *)e1)->e1 = new DotIdExp(loc, se->e1, ad->aliasthis->ident); -- Expression *e = copy(); -- ((UnaExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att1 && se->e1->type->checkAliasThisRec()) -+ be->att1 = se->e1->type; -+ be->e1 = e1; -+ if (Expression *e = be->trySemantic(sc)) -+ return e; - } -+ att1 = NULL; - } - } - #endif -@@ -1072,19 +1070,25 @@ Expression *BinAssignExp::op_overload(Sc - } - #endif - -- Objects *targsi = NULL; -+ Objects *tiargs = NULL; - #if DMDV2 - if (!s) - { /* Try the new D2 scheme, opOpAssign - */ - if (ad1) -+ { - s = search_function(ad1, Id::opOpAssign); -+ if (s && !s->isTemplateDeclaration()) -+ { error("%s.opOpAssign isn't a template", e1->toChars()); -+ return new ErrorExp(); -+ } -+ } - -- // Set targsi, the template argument list, which will be the operator string -+ // Set tiargs, the template argument list, which will be the operator string - if (s) - { - id = Id::opOpAssign; -- targsi = opToArg(sc, op); -+ tiargs = opToArg(sc, op); - } - } - #endif -@@ -1097,23 +1101,14 @@ Expression *BinAssignExp::op_overload(Sc - - args2.setDim(1); - args2[0] = e2; -+ expandTuples(&args2); - - Match m; - memset(&m, 0, sizeof(m)); - m.last = MATCHnomatch; - - if (s) -- { -- FuncDeclaration *fd = s->isFuncDeclaration(); -- if (fd) -- { -- overloadResolveX(&m, fd, NULL, &args2); -- } -- else -- { TemplateDeclaration *td = s->isTemplateDeclaration(); -- templateResolve(&m, td, sc, loc, targsi, e1, &args2); -- } -- } -+ functionResolve(&m, s, loc, sc, tiargs, e1->type, &args2); - - if (m.count > 1) - { -@@ -1126,7 +1121,7 @@ Expression *BinAssignExp::op_overload(Sc - else if (m.last == MATCHnomatch) - { - m.lastf = m.anyf; -- if (targsi) -+ if (tiargs) - goto L1; - } - -@@ -1143,11 +1138,15 @@ L1: - /* Rewrite (e1 op e2) as: - * (e1.aliasthis op e2) - */ -+ if (att1 && this->e1->type == att1) -+ return NULL; -+ //printf("att %s e1 = %s\n", Token::toChars(op), this->e1->type->toChars()); - Expression *e1 = new DotIdExp(loc, this->e1, ad1->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e1 = e1; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att1 && this->e1->type->checkAliasThisRec()) -+ be->att1 = this->e1->type; -+ be->e1 = e1; -+ return be->trySemantic(sc); - } - - // Try alias this on second operand -@@ -1157,11 +1156,15 @@ L1: - /* Rewrite (e1 op e2) as: - * (e1 op e2.aliasthis) - */ -+ if (att2 && this->e2->type == att2) -+ return NULL; -+ //printf("att %s e2 = %s\n", Token::toChars(op), this->e2->type->toChars()); - Expression *e2 = new DotIdExp(loc, this->e2, ad2->aliasthis->ident); -- Expression *e = copy(); -- ((BinExp *)e)->e2 = e2; -- e = e->trySemantic(sc); -- return e; -+ BinExp *be = (BinExp *)copy(); -+ if (!be->att2 && this->e2->type->checkAliasThisRec()) -+ be->att2 = this->e2->type; -+ be->e2 = e2; -+ return be->trySemantic(sc); - } - #endif - return NULL; -@@ -1201,7 +1204,7 @@ Dsymbol *search_function(ScopeDsymbol *a - FuncDeclaration *fd; - TemplateDeclaration *td; - -- s = ad->search(0, funcid, 0); -+ s = ad->search(Loc(), funcid, 0); - if (s) - { Dsymbol *s2; - -@@ -1228,6 +1231,8 @@ int ForeachStatement::inferAggregate(Sco - int sliced = 0; - #endif - Type *tab; -+ Type *att = NULL; -+ Expression *org_aggr = aggr; - AggregateDeclaration *ad; - - while (1) -@@ -1239,6 +1244,10 @@ int ForeachStatement::inferAggregate(Sco - goto Lerr; - - tab = aggr->type->toBasetype(); -+ if (att == tab) -+ { aggr = org_aggr; -+ goto Lerr; -+ } - switch (tab->ty) - { - case Tarray: -@@ -1277,13 +1286,15 @@ int ForeachStatement::inferAggregate(Sco - } - } - -- if (Dsymbol *shead = ad->search(0, idfront, 0)) -+ if (Dsymbol *shead = ad->search(Loc(), idfront, 0)) - { // range aggregate - break; - } - - if (ad->aliasthis) - { -+ if (!att && tab->checkAliasThisRec()) -+ att = tab; - aggr = new DotIdExp(aggr->loc, aggr, ad->aliasthis->ident); - continue; - } -@@ -1436,7 +1447,7 @@ int ForeachStatement::inferApplyArgTypes - /* Look for a front() or back() overload - */ - Identifier *id = (op == TOKforeach) ? Id::Ffront : Id::Fback; -- Dsymbol *s = ad->search(0, id, 0); -+ Dsymbol *s = ad->search(Loc(), id, 0); - FuncDeclaration *fd = s ? s->isFuncDeclaration() : NULL; - if (fd) - { -@@ -1474,47 +1485,51 @@ int ForeachStatement::inferApplyArgTypes - - static Dsymbol *inferApplyArgTypesX(Expression *ethis, FuncDeclaration *fstart, Parameters *arguments) - { -- struct Param3 -- { -- Parameters *arguments; -- int mod; -- MATCH match; -- FuncDeclaration *fd_best; -- FuncDeclaration *fd_ambig; -- -- static int fp(void *param, FuncDeclaration *f) -- { -- Param3 *p = (Param3 *)param; -- TypeFunction *tf = (TypeFunction *)f->type; -- MATCH m = MATCHexact; -- -- if (f->isThis()) -- { if (!MODimplicitConv(p->mod, tf->mod)) -- m = MATCHnomatch; -- else if (p->mod != tf->mod) -- m = MATCHconst; -- } -- if (!inferApplyArgTypesY(tf, p->arguments, 1)) -- m = MATCHnomatch; -+ struct ParamOpOver -+ { -+ Parameters *arguments; -+ int mod; -+ MATCH match; -+ FuncDeclaration *fd_best; -+ FuncDeclaration *fd_ambig; - -- if (m > p->match) -- { p->fd_best = f; -- p->fd_ambig = NULL; -- p->match = m; -- } -- else if (m == p->match) -- p->fd_ambig = f; -+ static int fp(void *param, Dsymbol *s) -+ { -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (!f) - return 0; -+ ParamOpOver *p = (ParamOpOver *)param; -+ TypeFunction *tf = (TypeFunction *)f->type; -+ MATCH m = MATCHexact; -+ -+ if (f->isThis()) -+ { -+ if (!MODimplicitConv(p->mod, tf->mod)) -+ m = MATCHnomatch; -+ else if (p->mod != tf->mod) -+ m = MATCHconst; - } -- }; -+ if (!inferApplyArgTypesY(tf, p->arguments, 1)) -+ m = MATCHnomatch; - -- Param3 p; -+ if (m > p->match) -+ { -+ p->fd_best = f; -+ p->fd_ambig = NULL; -+ p->match = m; -+ } -+ else if (m == p->match) -+ p->fd_ambig = f; -+ return 0; -+ } -+ }; -+ ParamOpOver p; - p.arguments = arguments; - p.mod = ethis->type->mod; - p.match = MATCHnomatch; - p.fd_best = NULL; - p.fd_ambig = NULL; -- overloadApply(fstart, &Param3::fp, &p); -+ overloadApply(fstart, &p, &ParamOpOver::fp); - if (p.fd_best) - { - inferApplyArgTypesY((TypeFunction *)p.fd_best->type, arguments); -@@ -1571,10 +1586,10 @@ static int inferApplyArgTypesY(TypeFunct - arg->type = arg->type->addStorageClass(arg->storageClass); - } - } -- Lmatch: -+Lmatch: - return 1; - -- Lnomatch: -+Lnomatch: - return 0; - } - -@@ -1610,28 +1625,3 @@ void inferApplyArgTypesZ(TemplateDeclara - } - } - #endif -- --/************************************** -- */ -- --static void templateResolve(Match *m, TemplateDeclaration *td, Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *arguments) --{ -- FuncDeclaration *fd; -- -- assert(td); -- fd = td->deduceFunctionTemplate(sc, loc, targsi, ethis, arguments, 1); -- if (!fd) -- return; -- m->anyf = fd; -- if (m->last >= MATCHexact) -- { -- m->nextf = fd; -- m->count++; -- } -- else -- { -- m->last = MATCHexact; -- m->lastf = fd; -- m->count = 1; -- } --} ---- a/src/gcc/d/dfrontend/optimize.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/optimize.c 2014-04-01 16:32:51.000000000 +0100 -@@ -23,7 +23,7 @@ - #include "declaration.h" - #include "aggregate.h" - #include "init.h" -- -+#include "enum.h" - - /************************************* - * If variable has a const initializer, -@@ -44,12 +44,10 @@ Expression *expandVar(int result, VarDec - { - if (!v->type) - { -- //error("ICE"); - return e; - } - Type *tb = v->type->toBasetype(); -- if (result & WANTinterpret || -- v->storage_class & STCmanifest || -+ if ( v->storage_class & STCmanifest || - v->type->toBasetype()->isscalar() || - ((result & WANTexpand) && (tb->ty != Tsarray && tb->ty != Tstruct)) - ) -@@ -58,25 +56,25 @@ Expression *expandVar(int result, VarDec - { - if (v->inuse) - { if (v->storage_class & STCmanifest) -+ { - v->error("recursive initialization of constant"); -+ goto Lerror; -+ } - goto L1; - } -- Expression *ei = v->init->toExpression(); -+ Expression *ei = v->getConstInitializer(); - if (!ei) - { if (v->storage_class & STCmanifest) -+ { - v->error("enum cannot be initialized with %s", v->init->toChars()); -+ goto Lerror; -+ } - goto L1; - } - if (ei->op == TOKconstruct || ei->op == TOKblit) - { AssignExp *ae = (AssignExp *)ei; - ei = ae->e2; -- if (result & WANTinterpret) -- { -- v->inuse++; -- ei = ei->optimize(result); -- v->inuse--; -- } -- else if (ei->isConst() != 1 && ei->op != TOKstring) -+ if (ei->isConst() != 1 && ei->op != TOKstring) - goto L1; - - if (ei->type == v->type) -@@ -84,24 +82,19 @@ Expression *expandVar(int result, VarDec - } - else if (ei->implicitConvTo(v->type) >= MATCHconst) - { // const var initialized with non-const expression -- ei = ei->implicitCastTo(0, v->type); -- ei = ei->semantic(0); -+ ei = ei->implicitCastTo(NULL, v->type); -+ ei = ei->semantic(NULL); - } - else - goto L1; - } -- if (v->scope) -+ else if (!(v->storage_class & STCmanifest) && -+ ei->isConst() != 1 && ei->op != TOKstring && -+ ei->op != TOKaddress) - { -- v->inuse++; -- e = ei->syntaxCopy(); -- e = e->semantic(v->scope); -- e = e->implicitCastTo(v->scope, v->type); -- // enabling this line causes test22 in test suite to fail -- //ei->type = e->type; -- v->scope = NULL; -- v->inuse--; -+ goto L1; - } -- else if (!ei->type) -+ if (!ei->type) - { - goto L1; - } -@@ -132,6 +125,9 @@ Expression *expandVar(int result, VarDec - L1: - //if (e) printf("\te = %p, %s, e->type = %d, %s\n", e, e->toChars(), e->type->ty, e->type->toChars()); - return e; -+ -+Lerror: -+ return new ErrorExp(); - } - - -@@ -163,15 +159,6 @@ Expression *fromConstInitializer(int res - else - { - e = e1; -- /* If we needed to interpret, generate an error. -- * Don't give an error if it's a template parameter -- */ -- if (v && (result & WANTinterpret) && -- !(v->storage_class & STCtemplateparameter)) -- { -- e1->error("variable %s cannot be read at compile time", v->toChars()); -- e->type = Type::terror; -- } - } - } - return e; -@@ -186,15 +173,23 @@ Expression *Expression::optimize(int res - - Expression *VarExp::optimize(int result, bool keepLvalue) - { -- return keepLvalue ? this : fromConstInitializer(result, this); -+ if (keepLvalue) -+ { -+ VarDeclaration *v = var->isVarDeclaration(); -+ if (v && !(v->storage_class & STCmanifest)) -+ return this; -+ } -+ return fromConstInitializer(result, this); - } - - Expression *TupleExp::optimize(int result, bool keepLvalue) - { -+ if (e0) -+ e0 = e0->optimize(WANTvalue); - for (size_t i = 0; i < exps->dim; i++) -- { Expression *e = (*exps)[i]; -- -- e = e->optimize(WANTvalue | (result & WANTinterpret)); -+ { -+ Expression *e = (*exps)[i]; -+ e = e->optimize(WANTvalue); - (*exps)[i] = e; - } - return this; -@@ -207,7 +202,7 @@ Expression *ArrayLiteralExp::optimize(in - for (size_t i = 0; i < elements->dim; i++) - { Expression *e = (*elements)[i]; - -- e = e->optimize(WANTvalue | (result & (WANTinterpret | WANTexpand))); -+ e = e->optimize(WANTvalue | (result & WANTexpand)); - (*elements)[i] = e; - } - } -@@ -220,11 +215,11 @@ Expression *AssocArrayLiteralExp::optimi - for (size_t i = 0; i < keys->dim; i++) - { Expression *e = (*keys)[i]; - -- e = e->optimize(WANTvalue | (result & (WANTinterpret | WANTexpand))); -+ e = e->optimize(WANTvalue | (result & WANTexpand)); - (*keys)[i] = e; - - e = (*values)[i]; -- e = e->optimize(WANTvalue | (result & (WANTinterpret | WANTexpand))); -+ e = e->optimize(WANTvalue | (result & WANTexpand)); - (*values)[i] = e; - } - return this; -@@ -232,16 +227,20 @@ Expression *AssocArrayLiteralExp::optimi - - Expression *StructLiteralExp::optimize(int result, bool keepLvalue) - { -+ if(stageflags & stageOptimize) return this; -+ int old = stageflags; -+ stageflags |= stageOptimize; - if (elements) - { - for (size_t i = 0; i < elements->dim; i++) - { Expression *e = (*elements)[i]; - if (!e) - continue; -- e = e->optimize(WANTvalue | (result & (WANTinterpret | WANTexpand))); -+ e = e->optimize(WANTvalue | (result & WANTexpand)); - (*elements)[i] = e; - } - } -+ stageflags = old; - return this; - } - -@@ -309,6 +308,12 @@ Expression *BoolExp::optimize(int result - return e; - } - -+Expression *SymOffExp::optimize(int result, bool keepLvalue) -+{ -+ assert(var); -+ return this; -+} -+ - Expression *AddrExp::optimize(int result, bool keepLvalue) - { Expression *e; - -@@ -325,13 +330,8 @@ Expression *AddrExp::optimize(int result - return e->optimize(result); - } - -- if (e1->op == TOKvar) -- { VarExp *ve = (VarExp *)e1; -- if (ve->var->storage_class & STCmanifest) -- e1 = e1->optimize(result); -- } -- else -- e1 = e1->optimize(result); -+ // Keep lvalue-ness -+ e1 = e1->optimize(result, true); - - // Convert &*ex to ex - if (e1->op == TOKstar) -@@ -363,7 +363,7 @@ Expression *AddrExp::optimize(int result - - if (ae->e2->op == TOKint64 && ae->e1->op == TOKvar) - { -- dinteger_t index = ae->e2->toInteger(); -+ sinteger_t index = ae->e2->toInteger(); - VarExp *ve = (VarExp *)ae->e1; - if (ve->type->ty == Tsarray - && !ve->var->isImportedSymbol()) -@@ -371,7 +371,10 @@ Expression *AddrExp::optimize(int result - TypeSArray *ts = (TypeSArray *)ve->type; - sinteger_t dim = ts->dim->toInteger(); - if (index < 0 || index >= dim) -+ { - error("array index %lld is out of bounds [0..%lld]", index, dim); -+ return new ErrorExp(); -+ } - e = new SymOffExp(loc, ve->var, index * ts->nextOf()->size()); - e->type = type; - return e; -@@ -480,10 +483,6 @@ Expression *NewExp::optimize(int result, - (*arguments)[i] = e; - } - } -- if (result & WANTinterpret) -- { -- error("cannot evaluate %s at compile time", toChars()); -- } - return this; - } - -@@ -502,12 +501,8 @@ Expression *CallExp::optimize(int result - size_t pdim = Parameter::dim(tf->parameters) - (tf->varargs == 2 ? 1 : 0); - for (size_t i = 0; i < arguments->dim; i++) - { -- bool keepLvalue = false; -- if (i < pdim) -- { -- Parameter *p = Parameter::getNth(tf->parameters, i); -- keepLvalue = ((p->storageClass & (STCref | STCout)) != 0); -- } -+ Parameter *p = Parameter::getNth(tf->parameters, i); -+ bool keepLvalue = (p ? (p->storageClass & (STCref | STCout)) != 0 : false); - Expression *e = (*arguments)[i]; - e = e->optimize(WANTvalue, keepLvalue); - (*arguments)[i] = e; -@@ -519,49 +514,19 @@ Expression *CallExp::optimize(int result - return this; - - #if 1 -- if (result & WANTinterpret) -- { -- Expression *eresult = interpret(NULL); -- if (eresult == EXP_CANT_INTERPRET) -- return e; -- if (eresult && eresult != EXP_VOID_INTERPRET) -- e = eresult; -- else -- error("cannot evaluate %s at compile time", toChars()); -- } - #else - if (e1->op == TOKvar) - { - FuncDeclaration *fd = ((VarExp *)e1)->var->isFuncDeclaration(); - if (fd) - { -- enum BUILTIN b = fd->isBuiltin(); -+ BUILTIN b = fd->isBuiltin(); - if (b) - { - e = eval_builtin(b, arguments); - if (!e) // failed - e = this; // evaluate at runtime - } -- else if (result & WANTinterpret) -- { -- Expression *eresult = fd->interpret(NULL, arguments); -- if (eresult && eresult != EXP_VOID_INTERPRET) -- e = eresult; -- else -- error("cannot evaluate %s at compile time", toChars()); -- } -- } -- } -- else if (e1->op == TOKdotvar && result & WANTinterpret) -- { DotVarExp *dve = (DotVarExp *)e1; -- FuncDeclaration *fd = dve->var->isFuncDeclaration(); -- if (fd) -- { -- Expression *eresult = fd->interpret(NULL, arguments, dve->e1); -- if (eresult && eresult != EXP_VOID_INTERPRET) -- e = eresult; -- else -- error("cannot evaluate %s at compile time", toChars()); - } - } - #endif -@@ -577,7 +542,7 @@ Expression *CastExp::optimize(int result - //printf("e1->type %s\n", e1->type->toChars()); - //printf("type = %p\n", type); - assert(type); -- enum TOK op1 = e1->op; -+ TOK op1 = e1->op; - #define X 0 - - Expression *e1old = e1; -@@ -596,7 +561,7 @@ Expression *CastExp::optimize(int result - - if ((e1->op == TOKstring || e1->op == TOKarrayliteral) && - (type->ty == Tpointer || type->ty == Tarray) && -- e1->type->nextOf()->size() == type->nextOf()->size() -+ e1->type->toBasetype()->nextOf()->size() == type->nextOf()->size() - ) - { - Expression *e = e1->castTo(NULL, type); -@@ -688,7 +653,7 @@ Expression *BinExp::optimize(int result, - d_uns64 sz = e1->type->size() * 8; - if (i2 < 0 || i2 >= sz) - { error("shift assign by %lld is outside the range 0..%llu", i2, (ulonglong)sz - 1); -- e2 = new IntegerExp(0); -+ return new ErrorExp(); - } - } - } -@@ -701,6 +666,10 @@ Expression *AddExp::optimize(int result, - //printf("AddExp::optimize(%s)\n", toChars()); - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() && e2->isConst()) - { - if (e1->op == TOKsymoff && e2->op == TOKsymoff) -@@ -717,6 +686,10 @@ Expression *MinExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() && e2->isConst()) - { - if (e2->op == TOKsymoff) -@@ -734,6 +707,10 @@ Expression *MulExp::optimize(int result, - //printf("MulExp::optimize(result = %d) %s\n", result, toChars()); - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - { - e = Mul(type, e1, e2); -@@ -749,6 +726,10 @@ Expression *DivExp::optimize(int result, - //printf("DivExp::optimize(%s)\n", toChars()); - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - { - e = Div(type, e1, e2); -@@ -763,6 +744,10 @@ Expression *ModExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - { - e = Mod(type, e1, e2); -@@ -777,13 +762,17 @@ Expression *shift_optimize(int result, B - - e->e1 = e->e1->optimize(result); - e->e2 = e->e2->optimize(result); -+ if (e->e1->op == TOKerror) -+ return e->e1; -+ if (e->e2->op == TOKerror) -+ return e->e2; - if (e->e2->isConst() == 1) - { - sinteger_t i2 = e->e2->toInteger(); - d_uns64 sz = e->e1->type->size() * 8; - if (i2 < 0 || i2 >= sz) - { e->error("shift by %lld is outside the range 0..%llu", i2, (ulonglong)sz - 1); -- e->e2 = new IntegerExp(0); -+ return new ErrorExp(); - } - if (e->e1->isConst() == 1) - ex = (*shift)(e->type, e->e1, e->e2); -@@ -794,19 +783,19 @@ Expression *shift_optimize(int result, B - Expression *ShlExp::optimize(int result, bool keepLvalue) - { - //printf("ShlExp::optimize(result = %d) %s\n", result, toChars()); -- return shift_optimize(result, this, Shl); -+ return shift_optimize(result, this, &Shl); - } - - Expression *ShrExp::optimize(int result, bool keepLvalue) - { - //printf("ShrExp::optimize(result = %d) %s\n", result, toChars()); -- return shift_optimize(result, this, Shr); -+ return shift_optimize(result, this, &Shr); - } - - Expression *UshrExp::optimize(int result, bool keepLvalue) - { - //printf("UshrExp::optimize(result = %d) %s\n", result, toChars()); -- return shift_optimize(result, this, Ushr); -+ return shift_optimize(result, this, &Ushr); - } - - Expression *AndExp::optimize(int result, bool keepLvalue) -@@ -814,6 +803,10 @@ Expression *AndExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - e = And(type, e1, e2); - else -@@ -826,6 +819,10 @@ Expression *OrExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - e = Or(type, e1, e2); - else -@@ -838,6 +835,10 @@ Expression *XorExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - if (e1->isConst() == 1 && e2->isConst() == 1) - e = Xor(type, e1, e2); - else -@@ -850,6 +851,10 @@ Expression *PowExp::optimize(int result, - - e1 = e1->optimize(result); - e2 = e2->optimize(result); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - - // Replace 1 ^^ x or 1.0^^x by (x, 1) - if ((e1->op == TOKint64 && e1->toInteger() == 1) || -@@ -896,7 +901,7 @@ Expression *PowExp::optimize(int result, - else - { - // If e2 *could* have been an integer, make it one. -- if (e2->op == TOKfloat64 && (e2->toReal() == (real_t)(sinteger_t)(e2->toInteger()))) -+ if (e2->op == TOKfloat64 && (e2->toReal() == (sinteger_t)(e2->toReal()))) - e2 = new IntegerExp(loc, e2->toInteger(), Type::tint64); - - if (e1->isConst() == 1 && e2->isConst() == 1) -@@ -907,6 +912,21 @@ Expression *PowExp::optimize(int result, - } - e = this; - } -+ -+ if (e1->op == TOKint64 && e1->toInteger() > 0 && -+ !((e1->toInteger() - 1) & e1->toInteger()) && // is power of two -+ e2->type->isintegral() && e2->type->isunsigned()) -+ { -+ dinteger_t i = e1->toInteger(); -+ dinteger_t mul = 1; -+ while ((i >>= 1) > 1) -+ mul++; -+ Expression *shift = new MulExp(loc, e2, new IntegerExp(loc, mul, e2->type)); -+ shift->type = Type::tshiftcnt; -+ e = new ShlExp(loc, new IntegerExp(loc, 1, e1->type), shift); -+ e->type = type; -+ } -+ - return e; - } - -@@ -920,15 +940,10 @@ Expression *CommaExp::optimize(int resul - // In particular, if the comma returns a temporary variable, it needs - // to be an lvalue (this is particularly important for struct constructors) - -- if (result & WANTinterpret) -- { // Interpreting comma needs special treatment, because it may -- // contain compiler-generated declarations. -- e = interpret(NULL); -- return (e == EXP_CANT_INTERPRET) ? this : e; -- } -- -- e1 = e1->optimize(result & WANTinterpret); -+ e1 = e1->optimize(0); - e2 = e2->optimize(result, keepLvalue); -+ if (e1->op == TOKerror) -+ return e1; - if (!e1 || e1->op == TOKint64 || e1->op == TOKfloat64 || !e1->hasSideEffect()) - { - e = e2; -@@ -945,9 +960,12 @@ Expression *ArrayLengthExp::optimize(int - { Expression *e; - - //printf("ArrayLengthExp::optimize(result = %d) %s\n", result, toChars()); -- e1 = e1->optimize(WANTvalue | WANTexpand | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTvalue | WANTexpand); -+ if (e1->op == TOKerror) -+ return e1; - e = this; -- if (e1->op == TOKstring || e1->op == TOKarrayliteral || e1->op == TOKassocarrayliteral) -+ if (e1->op == TOKstring || e1->op == TOKarrayliteral || e1->op == TOKassocarrayliteral || -+ e1->type->toBasetype()->ty == Tsarray) - { - e = ArrayLength(type, e1); - } -@@ -957,11 +975,15 @@ Expression *ArrayLengthExp::optimize(int - Expression *EqualExp::optimize(int result, bool keepLvalue) - { - //printf("EqualExp::optimize(result = %x) %s\n", result, toChars()); -- e1 = e1->optimize(WANTvalue | (result & WANTinterpret)); -- e2 = e2->optimize(WANTvalue | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTvalue); -+ e2 = e2->optimize(WANTvalue); - - Expression *e1 = fromConstInitializer(result, this->e1); - Expression *e2 = fromConstInitializer(result, this->e2); -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; - - Expression *e = Equal(op, type, e1, e2); - if (e == EXP_CANT_INTERPRET) -@@ -972,12 +994,19 @@ Expression *EqualExp::optimize(int resul - Expression *IdentityExp::optimize(int result, bool keepLvalue) - { - //printf("IdentityExp::optimize(result = %d) %s\n", result, toChars()); -- e1 = e1->optimize(WANTvalue | (result & WANTinterpret)); -- e2 = e2->optimize(WANTvalue | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTvalue); -+ e2 = e2->optimize(WANTvalue); -+ -+ if (e1->op == TOKerror) -+ return e1; -+ if (e2->op == TOKerror) -+ return e2; -+ - Expression *e = this; - - if ((this->e1->isConst() && this->e2->isConst()) || -- (this->e1->op == TOKnull && this->e2->op == TOKnull)) -+ (this->e1->op == TOKnull && this->e2->op == TOKnull) -+ ) - { - e = Identity(op, type, this->e1, this->e2); - if (e == EXP_CANT_INTERPRET) -@@ -1010,8 +1039,8 @@ void setLengthVarIfKnown(VarDeclaration - return; // we don't know the length yet - } - -- Expression *dollar = new IntegerExp(0, len, Type::tsize_t); -- lengthVar->init = new ExpInitializer(0, dollar); -+ Expression *dollar = new IntegerExp(Loc(), len, Type::tsize_t); -+ lengthVar->init = new ExpInitializer(Loc(), dollar); - lengthVar->storage_class |= STCstatic | STCconst; - } - -@@ -1020,25 +1049,16 @@ Expression *IndexExp::optimize(int resul - { Expression *e; - - //printf("IndexExp::optimize(result = %d) %s\n", result, toChars()); -- Expression *e1 = this->e1->optimize( -- WANTvalue | (result & (WANTinterpret| WANTexpand))); -- e1 = fromConstInitializer(result, e1); -- if (this->e1->op == TOKvar) -- { VarExp *ve = (VarExp *)this->e1; -- if (ve->var->storage_class & STCmanifest) -- { /* We generally don't want to have more than one copy of an -- * array literal, but if it's an enum we have to because the -- * enum isn't stored elsewhere. See Bugzilla 2559 -- */ -- this->e1 = e1; -- } -- } -+ e1 = e1->optimize(WANTvalue | (result & WANTexpand)); -+ -+ Expression *ex = fromConstInitializer(result, e1); -+ - // We might know $ now -- setLengthVarIfKnown(lengthVar, e1); -- e2 = e2->optimize(WANTvalue | (result & WANTinterpret)); -+ setLengthVarIfKnown(lengthVar, ex); -+ e2 = e2->optimize(WANTvalue); - if (keepLvalue) - return this; -- e = Index(type, e1, e2); -+ e = Index(type, ex, e2); - if (e == EXP_CANT_INTERPRET) - e = this; - return e; -@@ -1050,7 +1070,7 @@ Expression *SliceExp::optimize(int resul - - //printf("SliceExp::optimize(result = %d) %s\n", result, toChars()); - e = this; -- e1 = e1->optimize(WANTvalue | (result & (WANTinterpret|WANTexpand))); -+ e1 = e1->optimize(WANTvalue | (result & WANTexpand)); - if (!lwr) - { if (e1->op == TOKstring) - { // Convert slice of string literal into dynamic array -@@ -1063,8 +1083,8 @@ Expression *SliceExp::optimize(int resul - e1 = fromConstInitializer(result, e1); - // We might know $ now - setLengthVarIfKnown(lengthVar, e1); -- lwr = lwr->optimize(WANTvalue | (result & WANTinterpret)); -- upr = upr->optimize(WANTvalue | (result & WANTinterpret)); -+ lwr = lwr->optimize(WANTvalue); -+ upr = upr->optimize(WANTvalue); - e = Slice(type, e1, lwr, upr); - if (e == EXP_CANT_INTERPRET) - e = this; -@@ -1076,7 +1096,9 @@ Expression *AndAndExp::optimize(int resu - { Expression *e; - - //printf("AndAndExp::optimize(%d) %s\n", result, toChars()); -- e1 = e1->optimize(WANTflags | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTflags); -+ if (e1->op == TOKerror) -+ return e1; - e = this; - if (e1->isBool(FALSE)) - { -@@ -1090,9 +1112,12 @@ Expression *AndAndExp::optimize(int resu - } - else - { -- e2 = e2->optimize(WANTflags | (result & WANTinterpret)); -+ e2 = e2->optimize(WANTflags); - if (result && e2->type->toBasetype()->ty == Tvoid && !global.errors) -+ { - error("void has no value"); -+ return new ErrorExp(); -+ } - if (e1->isConst()) - { - if (e2->isConst()) -@@ -1115,7 +1140,9 @@ Expression *AndAndExp::optimize(int resu - Expression *OrOrExp::optimize(int result, bool keepLvalue) - { Expression *e; - -- e1 = e1->optimize(WANTflags | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTflags); -+ if (e1->op == TOKerror) -+ return e1; - e = this; - if (e1->isBool(TRUE)) - { // Replace with (e1, 1) -@@ -1125,9 +1152,12 @@ Expression *OrOrExp::optimize(int result - } - else - { -- e2 = e2->optimize(WANTflags | (result & WANTinterpret)); -+ e2 = e2->optimize(WANTflags); - if (result && e2->type->toBasetype()->ty == Tvoid && !global.errors) -+ { - error("void has no value"); -+ return new ErrorExp(); -+ } - if (e1->isConst()) - { - if (e2->isConst()) -@@ -1152,8 +1182,8 @@ Expression *CmpExp::optimize(int result, - { Expression *e; - - //printf("CmpExp::optimize() %s\n", toChars()); -- e1 = e1->optimize(WANTvalue | (result & WANTinterpret)); -- e2 = e2->optimize(WANTvalue | (result & WANTinterpret)); -+ e1 = e1->optimize(WANTvalue); -+ e2 = e2->optimize(WANTvalue); - - Expression *e1 = fromConstInitializer(result, this->e1); - Expression *e2 = fromConstInitializer(result, this->e2); -@@ -1180,7 +1210,7 @@ Expression *CatExp::optimize(int result, - Expression *CondExp::optimize(int result, bool keepLvalue) - { Expression *e; - -- econd = econd->optimize(WANTflags | (result & WANTinterpret)); -+ econd = econd->optimize(WANTflags); - if (econd->isBool(TRUE)) - e = e1->optimize(result, keepLvalue); - else if (econd->isBool(FALSE)) ---- a/src/gcc/d/dfrontend/outbuffer.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/outbuffer.c 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,412 @@ -+ -+// Copyright (c) 1999-2012 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#include <assert.h> -+#include <stdarg.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+ -+#include "outbuffer.h" -+#include "object.h" -+#include "rmem.h" -+ -+OutBuffer::OutBuffer() -+{ -+ data = NULL; -+ offset = 0; -+ size = 0; -+ -+ doindent = 0; -+ level = 0; -+ notlinehead = 0; -+} -+ -+OutBuffer::~OutBuffer() -+{ -+ mem.free(data); -+} -+ -+char *OutBuffer::extractData() -+{ -+ char *p; -+ -+ p = (char *)data; -+ data = NULL; -+ offset = 0; -+ size = 0; -+ return p; -+} -+ -+void OutBuffer::reserve(size_t nbytes) -+{ -+ //printf("OutBuffer::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes); -+ if (size - offset < nbytes) -+ { -+ size = (offset + nbytes) * 2; -+ size = (size + 15) & ~15; -+ data = (utf8_t *)mem.realloc(data, size); -+ } -+} -+ -+void OutBuffer::reset() -+{ -+ offset = 0; -+} -+ -+void OutBuffer::setsize(size_t size) -+{ -+ offset = size; -+} -+ -+void OutBuffer::write(const void *data, size_t nbytes) -+{ -+ if (doindent && !notlinehead) -+ { -+ if (level) -+ { -+ reserve(level); -+ for (size_t i=0; i<level; i++) -+ { -+ this->data[offset] = '\t'; -+ offset++; -+ } -+ } -+ notlinehead = 1; -+ } -+ reserve(nbytes); -+ memcpy(this->data + offset, data, nbytes); -+ offset += nbytes; -+} -+ -+void OutBuffer::writebstring(utf8_t *string) -+{ -+ write(string,*string + 1); -+} -+ -+void OutBuffer::writestring(const char *string) -+{ -+ write(string,strlen(string)); -+} -+ -+void OutBuffer::prependstring(const char *string) -+{ -+ size_t len = strlen(string); -+ reserve(len); -+ memmove(data + len, data, offset); -+ memcpy(data, string, len); -+ offset += len; -+} -+ -+void OutBuffer::writenl() -+{ -+#if _WIN32 -+ writeword(0x0A0D); // newline is CR,LF on Microsoft OS's -+#else -+ writeByte('\n'); -+#endif -+ if (doindent) -+ notlinehead = 0; -+} -+ -+void OutBuffer::writeByte(unsigned b) -+{ -+ if (doindent && !notlinehead -+ && b != '\n') -+ { -+ if (level) -+ { -+ reserve(level); -+ for (size_t i=0; i<level; i++) -+ { -+ this->data[offset] = '\t'; -+ offset++; -+ } -+ } -+ notlinehead = 1; -+ } -+ reserve(1); -+ this->data[offset] = (unsigned char)b; -+ offset++; -+} -+ -+void OutBuffer::writeUTF8(unsigned b) -+{ -+ reserve(6); -+ if (b <= 0x7F) -+ { -+ this->data[offset] = (unsigned char)b; -+ offset++; -+ } -+ else if (b <= 0x7FF) -+ { -+ this->data[offset + 0] = (unsigned char)((b >> 6) | 0xC0); -+ this->data[offset + 1] = (unsigned char)((b & 0x3F) | 0x80); -+ offset += 2; -+ } -+ else if (b <= 0xFFFF) -+ { -+ this->data[offset + 0] = (unsigned char)((b >> 12) | 0xE0); -+ this->data[offset + 1] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -+ this->data[offset + 2] = (unsigned char)((b & 0x3F) | 0x80); -+ offset += 3; -+ } -+ else if (b <= 0x1FFFFF) -+ { -+ this->data[offset + 0] = (unsigned char)((b >> 18) | 0xF0); -+ this->data[offset + 1] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -+ this->data[offset + 2] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -+ this->data[offset + 3] = (unsigned char)((b & 0x3F) | 0x80); -+ offset += 4; -+ } -+ else if (b <= 0x3FFFFFF) -+ { -+ this->data[offset + 0] = (unsigned char)((b >> 24) | 0xF8); -+ this->data[offset + 1] = (unsigned char)(((b >> 18) & 0x3F) | 0x80); -+ this->data[offset + 2] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -+ this->data[offset + 3] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -+ this->data[offset + 4] = (unsigned char)((b & 0x3F) | 0x80); -+ offset += 5; -+ } -+ else if (b <= 0x7FFFFFFF) -+ { -+ this->data[offset + 0] = (unsigned char)((b >> 30) | 0xFC); -+ this->data[offset + 1] = (unsigned char)(((b >> 24) & 0x3F) | 0x80); -+ this->data[offset + 2] = (unsigned char)(((b >> 18) & 0x3F) | 0x80); -+ this->data[offset + 3] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -+ this->data[offset + 4] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -+ this->data[offset + 5] = (unsigned char)((b & 0x3F) | 0x80); -+ offset += 6; -+ } -+ else -+ assert(0); -+} -+ -+void OutBuffer::prependbyte(unsigned b) -+{ -+ reserve(1); -+ memmove(data + 1, data, offset); -+ data[0] = (unsigned char)b; -+ offset++; -+} -+ -+void OutBuffer::writewchar(unsigned w) -+{ -+#if _WIN32 -+ writeword(w); -+#else -+ write4(w); -+#endif -+} -+ -+void OutBuffer::writeword(unsigned w) -+{ -+#if _WIN32 -+ unsigned newline = 0x0A0D; -+#else -+ unsigned newline = '\n'; -+#endif -+ if (doindent && !notlinehead -+ && w != newline) -+ { -+ if (level) -+ { -+ reserve(level); -+ for (size_t i=0; i<level; i++) -+ { -+ this->data[offset] = '\t'; -+ offset++; -+ } -+ } -+ notlinehead = 1; -+ } -+ reserve(2); -+ *(unsigned short *)(this->data + offset) = (unsigned short)w; -+ offset += 2; -+} -+ -+void OutBuffer::writeUTF16(unsigned w) -+{ -+ reserve(4); -+ if (w <= 0xFFFF) -+ { -+ *(unsigned short *)(this->data + offset) = (unsigned short)w; -+ offset += 2; -+ } -+ else if (w <= 0x10FFFF) -+ { -+ *(unsigned short *)(this->data + offset) = (unsigned short)((w >> 10) + 0xD7C0); -+ *(unsigned short *)(this->data + offset + 2) = (unsigned short)((w & 0x3FF) | 0xDC00); -+ offset += 4; -+ } -+ else -+ assert(0); -+} -+ -+void OutBuffer::write4(unsigned w) -+{ -+#if _WIN32 -+ bool notnewline = w != 0x000A000D; -+#else -+ bool notnewline = true; -+#endif -+ if (doindent && !notlinehead && notnewline) -+ { -+ if (level) -+ { -+ reserve(level); -+ for (size_t i=0; i<level; i++) -+ { -+ this->data[offset] = '\t'; -+ offset++; -+ } -+ } -+ notlinehead = 1; -+ } -+ reserve(4); -+ *(unsigned *)(this->data + offset) = w; -+ offset += 4; -+} -+ -+void OutBuffer::write(OutBuffer *buf) -+{ -+ if (buf) -+ { reserve(buf->offset); -+ memcpy(data + offset, buf->data, buf->offset); -+ offset += buf->offset; -+ } -+} -+ -+void OutBuffer::write(RootObject *obj) -+{ -+ if (obj) -+ { -+ writestring(obj->toChars()); -+ } -+} -+ -+void OutBuffer::fill0(size_t nbytes) -+{ -+ reserve(nbytes); -+ memset(data + offset,0,nbytes); -+ offset += nbytes; -+} -+ -+void OutBuffer::align(size_t size) -+{ -+ size_t nbytes = ((offset + size - 1) & ~(size - 1)) - offset; -+ fill0(nbytes); -+} -+ -+void OutBuffer::vprintf(const char *format, va_list args) -+{ -+ char buffer[128]; -+ char *p; -+ unsigned psize; -+ int count; -+ -+ p = buffer; -+ psize = sizeof(buffer); -+ for (;;) -+ { -+#if _WIN32 -+ count = _vsnprintf(p,psize,format,args); -+ if (count != -1) -+ break; -+ psize *= 2; -+#elif POSIX -+ va_list va; -+ va_copy(va, args); -+/* -+ The functions vprintf(), vfprintf(), vsprintf(), vsnprintf() -+ are equivalent to the functions printf(), fprintf(), sprintf(), -+ snprintf(), respectively, except that they are called with a -+ va_list instead of a variable number of arguments. These -+ functions do not call the va_end macro. Consequently, the value -+ of ap is undefined after the call. The application should call -+ va_end(ap) itself afterwards. -+ */ -+ count = vsnprintf(p,psize,format,va); -+ va_end(va); -+ if (count == -1) -+ psize *= 2; -+ else if (count >= psize) -+ psize = count + 1; -+ else -+ break; -+#else -+ assert(0); -+#endif -+ p = (char *) alloca(psize); // buffer too small, try again with larger size -+ } -+ write(p,count); -+} -+ -+void OutBuffer::printf(const char *format, ...) -+{ -+ va_list ap; -+ va_start(ap, format); -+ vprintf(format,ap); -+ va_end(ap); -+} -+ -+void OutBuffer::bracket(char left, char right) -+{ -+ reserve(2); -+ memmove(data + 1, data, offset); -+ data[0] = left; -+ data[offset + 1] = right; -+ offset += 2; -+} -+ -+/****************** -+ * Insert left at i, and right at j. -+ * Return index just past right. -+ */ -+ -+size_t OutBuffer::bracket(size_t i, const char *left, size_t j, const char *right) -+{ -+ size_t leftlen = strlen(left); -+ size_t rightlen = strlen(right); -+ reserve(leftlen + rightlen); -+ insert(i, left, leftlen); -+ insert(j + leftlen, right, rightlen); -+ return j + leftlen + rightlen; -+} -+ -+void OutBuffer::spread(size_t offset, size_t nbytes) -+{ -+ reserve(nbytes); -+ memmove(data + offset + nbytes, data + offset, -+ this->offset - offset); -+ this->offset += nbytes; -+} -+ -+/**************************************** -+ * Returns: offset + nbytes -+ */ -+ -+size_t OutBuffer::insert(size_t offset, const void *p, size_t nbytes) -+{ -+ spread(offset, nbytes); -+ memmove(data + offset, p, nbytes); -+ return offset + nbytes; -+} -+ -+void OutBuffer::remove(size_t offset, size_t nbytes) -+{ -+ memmove(data + offset, data + offset + nbytes, this->offset - (offset + nbytes)); -+ this->offset -= nbytes; -+} -+ -+char *OutBuffer::toChars() -+{ -+ writeByte(0); -+ return (char *)data; -+} ---- a/src/gcc/d/dfrontend/outbuffer.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/outbuffer.h 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,70 @@ -+ -+// Copyright (c) 1999-2011 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#ifndef OUTBUFFER_H -+#define OUTBUFFER_H -+ -+#include <stdlib.h> -+#include <stdarg.h> -+#include <string.h> -+#include <assert.h> -+#include "port.h" -+ -+#if __DMC__ -+#pragma once -+#endif -+ -+class RootObject; -+ -+struct OutBuffer -+{ -+ unsigned char *data; -+ size_t offset; -+ size_t size; -+ -+ int doindent; -+ int level; -+ int notlinehead; -+ -+ OutBuffer(); -+ ~OutBuffer(); -+ char *extractData(); -+ -+ void reserve(size_t nbytes); -+ void setsize(size_t size); -+ void reset(); -+ void write(const void *data, size_t nbytes); -+ void writebstring(utf8_t *string); -+ void writestring(const char *string); -+ void prependstring(const char *string); -+ void writenl(); // write newline -+ void writeByte(unsigned b); -+ void writebyte(unsigned b) { writeByte(b); } -+ void writeUTF8(unsigned b); -+ void prependbyte(unsigned b); -+ void writewchar(unsigned w); -+ void writeword(unsigned w); -+ void writeUTF16(unsigned w); -+ void write4(unsigned w); -+ void write(OutBuffer *buf); -+ void write(RootObject *obj); -+ void fill0(size_t nbytes); -+ void align(size_t size); -+ void vprintf(const char *format, va_list args); -+ void printf(const char *format, ...); -+ void bracket(char left, char right); -+ size_t bracket(size_t i, const char *left, size_t j, const char *right); -+ void spread(size_t offset, size_t nbytes); -+ size_t insert(size_t offset, const void *data, size_t nbytes); -+ void remove(size_t offset, size_t nbytes); -+ char *toChars(); -+ char *extractString(); -+}; -+ -+#endif ---- a/src/gcc/d/dfrontend/parse.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/parse.c 2014-04-01 16:32:51.000000000 +0100 -@@ -55,15 +55,15 @@ - // Support D1 inout - #define D1INOUT 0 - --Parser::Parser(Module *module, unsigned char *base, size_t length, int doDocComment) -+Parser::Parser(Module *module, utf8_t *base, size_t length, int doDocComment) - : Lexer(module, base, 0, length, doDocComment, 0) - { - //printf("Parser::Parser()\n"); - md = NULL; - linkage = LINKd; -- endloc = 0; -+ endloc = Loc(); - inBrackets = 0; -- lookingForElse = 0; -+ lookingForElse = Loc(); - //nextToken(); // start up the scanner - } - -@@ -74,7 +74,8 @@ Dsymbols *Parser::parseModule() - // ModuleDeclation leads off - if (token.value == TOKmodule) - { -- unsigned char *comment = token.blockComment; -+ Loc loc = token.loc; -+ utf8_t *comment = token.blockComment; - bool safe = FALSE; - - nextToken(); -@@ -120,7 +121,7 @@ Dsymbols *Parser::parseModule() - id = token.ident; - } - -- md = new ModuleDeclaration(a, id, safe); -+ md = new ModuleDeclaration(loc, a, id, safe); - - if (token.value != TOKsemicolon) - error("';' expected following module declaration instead of %s", token.toChars()); -@@ -131,7 +132,8 @@ Dsymbols *Parser::parseModule() - - decldefs = parseDeclDefs(0); - if (token.value != TOKeof) -- { error(loc, "unrecognized declaration"); -+ { -+ error(token.loc, "unrecognized declaration"); - goto Lerr; - } - return decldefs; -@@ -143,16 +145,19 @@ Lerr: - return new Dsymbols(); - } - --Dsymbols *Parser::parseDeclDefs(int once) -+Dsymbols *Parser::parseDeclDefs(int once, Dsymbol **pLastDecl) - { Dsymbol *s; - Dsymbols *decldefs; - Dsymbols *a; - Dsymbols *aelse; -- enum PROT prot; -+ PROT prot; - StorageClass stc; - StorageClass storageClass; - Condition *condition; -- unsigned char *comment; -+ utf8_t *comment; -+ Dsymbol *lastDecl = NULL; // used to link unittest to its previous declaration -+ if (!pLastDecl) -+ pLastDecl = &lastDecl; - - //printf("Parser::parseDeclDefs()\n"); - decldefs = new Dsymbols(); -@@ -192,7 +197,8 @@ Dsymbols *Parser::parseDeclDefs(int once - break; - - case TOKmixin: -- { Loc loc = this->loc; -+ { -+ Loc loc = token.loc; - switch (peekNext()) - { - case TOKlparen: -@@ -232,6 +238,7 @@ Dsymbols *Parser::parseDeclDefs(int once - case TOKinterface: - Ldeclaration: - a = parseDeclarations(STCundefined, NULL); -+ if (a->dim) *pLastDecl = (*a)[a->dim-1]; - decldefs->append(a); - continue; - -@@ -260,7 +267,7 @@ Dsymbols *Parser::parseDeclDefs(int once - } - else - { -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - stc = STCimmutable; - goto Lstc; - } -@@ -269,20 +276,7 @@ Dsymbols *Parser::parseDeclDefs(int once - - case TOKunittest: - s = parseUnitTest(); -- if (decldefs && decldefs->dim) -- { -- Dsymbol *ds = (*decldefs)[decldefs->dim-1]; -- AttribDeclaration *ad; -- while ((ad = ds->isAttribDeclaration()) != NULL) -- { -- if (ad->decl && ad->decl->dim) -- ds = (*ad->decl)[ad->decl->dim-1]; -- else -- break; -- } -- -- ds->unittest = (UnitTestDeclaration *)s; -- } -+ if (*pLastDecl) (*pLastDecl)->ddocUnittest = (UnitTestDeclaration *)s; - break; - - case TOKnew: -@@ -308,17 +302,23 @@ Dsymbols *Parser::parseDeclDefs(int once - else if (token.value == TOKassert) - s = parseStaticAssert(); - else if (token.value == TOKif) -- { condition = parseStaticIfCondition(); -- Loc lookingForElseSave = lookingForElse; -- lookingForElse = loc; -- a = parseBlock(); -- lookingForElse = lookingForElseSave; -+ { -+ condition = parseStaticIfCondition(); -+ if (token.value == TOKcolon) -+ a = parseBlock(pLastDecl); -+ else -+ { -+ Loc lookingForElseSave = lookingForElse; -+ lookingForElse = token.loc; -+ a = parseBlock(pLastDecl); -+ lookingForElse = lookingForElseSave; -+ } - aelse = NULL; - if (token.value == TOKelse) - { -- Loc elseloc = this->loc; -+ Loc elseloc = token.loc; - nextToken(); -- aelse = parseBlock(); -+ aelse = parseBlock(pLastDecl); - checkDanglingElse(elseloc); - } - s = new StaticIfDeclaration(condition, a, aelse); -@@ -381,7 +381,6 @@ Dsymbols *Parser::parseDeclDefs(int once - case TOKnothrow: stc = STCnothrow; goto Lstc; - case TOKpure: stc = STCpure; goto Lstc; - case TOKref: stc = STCref; goto Lstc; -- case TOKtls: stc = STCtls; goto Lstc; - case TOKgshared: stc = STCgshared; goto Lstc; - //case TOKmanifest: stc = STCmanifest; goto Lstc; - case TOKat: -@@ -390,7 +389,7 @@ Dsymbols *Parser::parseDeclDefs(int once - stc = parseAttribute(&exps); - if (stc) - goto Lstc; // it's a predefined attribute -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new UserAttributeDeclaration(exps, a); - break; - } -@@ -398,7 +397,7 @@ Dsymbols *Parser::parseDeclDefs(int once - - Lstc: - if (storageClass & stc) -- error("redundant storage class %s", Token::toChars(token.value)); -+ error("redundant storage class '%s'", Token::toChars(token.value)); - composeStorageClass(storageClass | stc); - nextToken(); - Lstc2: -@@ -428,7 +427,7 @@ Dsymbols *Parser::parseDeclDefs(int once - else - { - if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - stc = STCimmutable; - } - goto Lstc; -@@ -446,7 +445,6 @@ Dsymbols *Parser::parseDeclDefs(int once - case TOKnothrow: stc = STCnothrow; goto Lstc; - case TOKpure: stc = STCpure; goto Lstc; - case TOKref: stc = STCref; goto Lstc; -- case TOKtls: stc = STCtls; goto Lstc; - case TOKgshared: stc = STCgshared; goto Lstc; - //case TOKmanifest: stc = STCmanifest; goto Lstc; - case TOKat: -@@ -468,6 +466,7 @@ Dsymbols *Parser::parseDeclDefs(int once - peek(&token)->value == TOKassign) - { - a = parseAutoDeclarations(storageClass, comment); -+ if (a->dim) *pLastDecl = (*a)[a->dim-1]; - decldefs->append(a); - continue; - } -@@ -488,10 +487,11 @@ Dsymbols *Parser::parseDeclDefs(int once - ) - { - a = parseDeclarations(storageClass, comment); -+ if (a->dim) *pLastDecl = (*a)[a->dim-1]; - decldefs->append(a); - continue; - } -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new StorageClassDeclaration(storageClass, a); - break; - -@@ -506,16 +506,16 @@ Dsymbols *Parser::parseDeclDefs(int once - check(TOKlparen); - Expression *e = parseAssignExp(); - check(TOKrparen); -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new DeprecatedDeclaration(e, a); - break; - } - - case TOKlbracket: - { -- warning(loc, "use @(attributes) instead of [attributes]"); -+ warning(token.loc, "use @(attributes) instead of [attributes]"); - Expressions *exps = parseArguments(); -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new UserAttributeDeclaration(exps, a); - break; - } -@@ -526,9 +526,9 @@ Dsymbols *Parser::parseDeclDefs(int once - goto Lstc; - } - { -- enum LINK linksave = linkage; -+ LINK linksave = linkage; - linkage = parseLinkage(); -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new LinkDeclaration(linkage, a); - linkage = linksave; - break; -@@ -552,7 +552,7 @@ Dsymbols *Parser::parseDeclDefs(int once - break; - default: break; - } -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new ProtDeclaration(prot, a); - break; - -@@ -578,16 +578,17 @@ Dsymbols *Parser::parseDeclDefs(int once - check(TOKrparen); - } - else -- n = global.structalign; // default -+ n = STRUCTALIGN_DEFAULT; // default - -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new AlignDeclaration(n, a); - break; - } - - case TOKpragma: -- { Identifier *ident; -+ { - Expressions *args = NULL; -+ Loc loc = token.loc; - - nextToken(); - check(TOKlparen); -@@ -595,7 +596,7 @@ Dsymbols *Parser::parseDeclDefs(int once - { error("pragma(identifier) expected"); - goto Lerror; - } -- ident = token.ident; -+ Identifier *ident = token.ident; - nextToken(); - if (token.value == TOKcomma && peekNext() != TOKrparen) - args = parseArguments(); // pragma(identifier, args...) -@@ -605,7 +606,7 @@ Dsymbols *Parser::parseDeclDefs(int once - if (token.value == TOKsemicolon) - a = NULL; - else -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - s = new PragmaDeclaration(loc, ident, args, a); - break; - } -@@ -616,9 +617,9 @@ Dsymbols *Parser::parseDeclDefs(int once - { - nextToken(); - if (token.value == TOKidentifier) -- s = new DebugSymbol(loc, token.ident); -+ s = new DebugSymbol(token.loc, token.ident); - else if (token.value == TOKint32v || token.value == TOKint64v) -- s = new DebugSymbol(loc, (unsigned)token.uns64value); -+ s = new DebugSymbol(token.loc, (unsigned)token.uns64value); - else - { error("identifier or integer expected, not %s", token.toChars()); - s = NULL; -@@ -639,9 +640,9 @@ Dsymbols *Parser::parseDeclDefs(int once - { - nextToken(); - if (token.value == TOKidentifier) -- s = new VersionSymbol(loc, token.ident); -+ s = new VersionSymbol(token.loc, token.ident); - else if (token.value == TOKint32v || token.value == TOKint64v) -- s = new VersionSymbol(loc, (unsigned)token.uns64value); -+ s = new VersionSymbol(token.loc, (unsigned)token.uns64value); - else - { error("identifier or integer expected, not %s", token.toChars()); - s = NULL; -@@ -658,21 +659,21 @@ Dsymbols *Parser::parseDeclDefs(int once - Lcondition: - { - if (token.value == TOKcolon) -- a = parseBlock(); -+ a = parseBlock(pLastDecl); - else - { - Loc lookingForElseSave = lookingForElse; -- lookingForElse = loc; -- a = parseBlock(); -+ lookingForElse = token.loc; -+ a = parseBlock(pLastDecl); - lookingForElse = lookingForElseSave; - } - } - aelse = NULL; - if (token.value == TOKelse) - { -- Loc elseloc = this->loc; -+ Loc elseloc = token.loc; - nextToken(); -- aelse = parseBlock(); -+ aelse = parseBlock(pLastDecl); - checkDanglingElse(elseloc); - } - s = new ConditionalDeclaration(condition, a, aelse); -@@ -695,6 +696,8 @@ Dsymbols *Parser::parseDeclDefs(int once - if (s) - { decldefs->push(s); - addComment(s, comment); -+ if (!s->isAttribDeclaration()) -+ *pLastDecl = s; - } - } while (!once); - return decldefs; -@@ -755,7 +758,10 @@ StorageClass Parser::parseAttribute(Expr - { // Allow identifier, template instantiation, or function call - Expression *exp = parsePrimaryExp(); - if (token.value == TOKlparen) -+ { -+ Loc loc = token.loc; - exp = new CallExp(loc, exp, parseArguments()); -+ } - - udas = new Expressions(); - udas->push(exp); -@@ -798,7 +804,7 @@ StorageClass Parser::parsePostfix() - { - case TOKconst: stc |= STCconst; break; - case TOKinvariant: -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - case TOKimmutable: stc |= STCimmutable; break; - case TOKshared: stc |= STCshared; break; - case TOKwild: stc |= STCwild; break; -@@ -832,7 +838,7 @@ StorageClass Parser::parseTypeCtor() - { - case TOKconst: stc |= STCconst; break; - case TOKinvariant: -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - case TOKimmutable: stc |= STCimmutable; break; - case TOKshared: stc |= STCshared; break; - case TOKwild: stc |= STCwild; break; -@@ -848,7 +854,7 @@ StorageClass Parser::parseTypeCtor() - * Parse declarations after an align, protection, or extern decl. - */ - --Dsymbols *Parser::parseBlock() -+Dsymbols *Parser::parseBlock(Dsymbol **pLastDecl) - { - Dsymbols *a = NULL; - -@@ -867,10 +873,10 @@ Dsymbols *Parser::parseBlock() - case TOKlcurly: - { - Loc lookingForElseSave = lookingForElse; -- lookingForElse = 0; -+ lookingForElse = Loc(); - - nextToken(); -- a = parseDeclDefs(0); -+ a = parseDeclDefs(0, pLastDecl); - if (token.value != TOKrcurly) - { /* { */ - error("matching '}' expected, not %s", token.toChars()); -@@ -886,12 +892,12 @@ Dsymbols *Parser::parseBlock() - #if 0 - a = NULL; - #else -- a = parseDeclDefs(0); // grab declarations up to closing curly bracket -+ a = parseDeclDefs(0, pLastDecl); // grab declarations up to closing curly bracket - #endif - break; - - default: -- a = parseDeclDefs(1); -+ a = parseDeclDefs(1, pLastDecl); - break; - } - return a; -@@ -903,7 +909,7 @@ Dsymbols *Parser::parseBlock() - - StaticAssert *Parser::parseStaticAssert() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - Expression *exp; - Expression *msg = NULL; - -@@ -927,8 +933,9 @@ StaticAssert *Parser::parseStaticAssert( - - #if DMDV2 - TypeQualified *Parser::parseTypeof() --{ TypeQualified *t; -- Loc loc = this->loc; -+{ -+ TypeQualified *t; -+ Loc loc = token.loc; - - nextToken(); - check(TOKlparen); -@@ -938,7 +945,8 @@ TypeQualified *Parser::parseTypeof() - t = new TypeReturn(loc); - } - else -- { Expression *exp = parseExpression(); // typeof(expression) -+ { -+ Expression *exp = parseExpression(); // typeof(expression) - t = new TypeTypeof(loc, exp); - } - check(TOKrparen); -@@ -954,7 +962,7 @@ TypeQualified *Parser::parseTypeof() - #if DMDV2 - Type *Parser::parseVector() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - nextToken(); - check(TOKlparen); - Type *tb = parseType(); -@@ -968,9 +976,9 @@ Type *Parser::parseVector() - * The parser is on the 'extern' token. - */ - --enum LINK Parser::parseLinkage() -+LINK Parser::parseLinkage() - { -- enum LINK link = LINKdefault; -+ LINK link = LINKdefault; - nextToken(); - assert(token.value == TOKlparen); - nextToken(); -@@ -1089,9 +1097,10 @@ Condition *Parser::parseVersionCondition - */ - - Condition *Parser::parseStaticIfCondition() --{ Expression *exp; -+{ -+ Expression *exp; - Condition *condition; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - if (token.value == TOKlparen) -@@ -1101,7 +1110,8 @@ Condition *Parser::parseStaticIfConditio - check(TOKrparen); - } - else -- { error("(expression) expected following static if"); -+ { -+ error("(expression) expected following static if"); - exp = NULL; - } - condition = new StaticIfCondition(loc, exp); -@@ -1121,16 +1131,17 @@ Condition *Parser::parseStaticIfConditio - - Dsymbol *Parser::parseCtor() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); -- if (token.value == TOKlparen && peek(&token)->value == TOKthis) -- { // this(this) { ... } -+ if (token.value == TOKlparen && peekNext() == TOKthis && peekNext2() == TOKrparen) -+ { -+ // this(this) { ... } - nextToken(); - nextToken(); - check(TOKrparen); - StorageClass stc = parsePostfix(); -- PostBlitDeclaration *f = new PostBlitDeclaration(loc, 0, stc, Id::_postblit); -+ PostBlitDeclaration *f = new PostBlitDeclaration(loc, Loc(), stc, Id::_postblit); - parseContracts(f); - return f; - } -@@ -1141,7 +1152,8 @@ Dsymbol *Parser::parseCtor() - */ - TemplateParameters *tpl = NULL; - if (token.value == TOKlparen && peekPastParen(&token)->value == TOKlparen) -- { tpl = parseTemplateParameterList(); -+ { -+ tpl = parseTemplateParameterList(); - - int varargs; - Parameters *parameters = parseParameters(&varargs); -@@ -1152,7 +1164,7 @@ Dsymbol *Parser::parseCtor() - Type *tf = new TypeFunction(parameters, NULL, varargs, linkage, stc); // RetrunType -> auto - tf = tf->addSTC(stc); - -- CtorDeclaration *f = new CtorDeclaration(loc, 0, stc, tf); -+ CtorDeclaration *f = new CtorDeclaration(loc, Loc(), stc, tf); - parseContracts(f); - - // Wrap a template around it -@@ -1171,7 +1183,7 @@ Dsymbol *Parser::parseCtor() - Type *tf = new TypeFunction(parameters, NULL, varargs, linkage, stc); // RetrunType -> auto - tf = tf->addSTC(stc); - -- CtorDeclaration *f = new CtorDeclaration(loc, 0, stc, tf); -+ CtorDeclaration *f = new CtorDeclaration(loc, Loc(), stc, tf); - parseContracts(f); - return f; - } -@@ -1185,14 +1197,15 @@ Dsymbol *Parser::parseCtor() - DtorDeclaration *Parser::parseDtor() - { - DtorDeclaration *f; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - check(TOKthis); - check(TOKlparen); - check(TOKrparen); - -- f = new DtorDeclaration(loc, 0); -+ StorageClass stc = parsePostfix(); -+ f = new DtorDeclaration(loc, Loc(), stc, Id::dtor); - parseContracts(f); - return f; - } -@@ -1205,13 +1218,13 @@ DtorDeclaration *Parser::parseDtor() - - StaticCtorDeclaration *Parser::parseStaticCtor() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - check(TOKlparen); - check(TOKrparen); - -- StaticCtorDeclaration *f = new StaticCtorDeclaration(loc, 0); -+ StaticCtorDeclaration *f = new StaticCtorDeclaration(loc, Loc()); - parseContracts(f); - return f; - } -@@ -1224,7 +1237,7 @@ StaticCtorDeclaration *Parser::parseStat - - SharedStaticCtorDeclaration *Parser::parseSharedStaticCtor() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - nextToken(); -@@ -1232,7 +1245,7 @@ SharedStaticCtorDeclaration *Parser::par - check(TOKlparen); - check(TOKrparen); - -- SharedStaticCtorDeclaration *f = new SharedStaticCtorDeclaration(loc, 0); -+ SharedStaticCtorDeclaration *f = new SharedStaticCtorDeclaration(loc, Loc()); - parseContracts(f); - return f; - } -@@ -1245,14 +1258,17 @@ SharedStaticCtorDeclaration *Parser::par - - StaticDtorDeclaration *Parser::parseStaticDtor() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - check(TOKthis); - check(TOKlparen); - check(TOKrparen); -+ StorageClass stc = parsePostfix(); -+ if (stc & STCshared) -+ error("to create a 'shared' static destructor, move 'shared' in front of the declaration"); - -- StaticDtorDeclaration *f = new StaticDtorDeclaration(loc, 0); -+ StaticDtorDeclaration *f = new StaticDtorDeclaration(loc, Loc(), stc); - parseContracts(f); - return f; - } -@@ -1265,7 +1281,7 @@ StaticDtorDeclaration *Parser::parseStat - - SharedStaticDtorDeclaration *Parser::parseSharedStaticDtor() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - nextToken(); -@@ -1273,8 +1289,11 @@ SharedStaticDtorDeclaration *Parser::par - check(TOKthis); - check(TOKlparen); - check(TOKrparen); -+ StorageClass stc = parsePostfix(); -+ if (stc & STCshared) -+ error("static destructor is 'shared' already"); - -- SharedStaticDtorDeclaration *f = new SharedStaticDtorDeclaration(loc, 0); -+ SharedStaticDtorDeclaration *f = new SharedStaticDtorDeclaration(loc, Loc(), stc); - parseContracts(f); - return f; - } -@@ -1288,7 +1307,7 @@ SharedStaticDtorDeclaration *Parser::par - InvariantDeclaration *Parser::parseInvariant() - { - InvariantDeclaration *f; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - if (token.value == TOKlparen) // optional () -@@ -1297,7 +1316,7 @@ InvariantDeclaration *Parser::parseInvar - check(TOKrparen); - } - -- f = new InvariantDeclaration(loc, 0); -+ f = new InvariantDeclaration(loc, Loc(), STCundefined); - f->fbody = parseStatement(PScurly); - return f; - } -@@ -1312,13 +1331,36 @@ UnitTestDeclaration *Parser::parseUnitTe - { - UnitTestDeclaration *f; - Statement *body; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); -+ utf8_t *begPtr = token.ptr + 1; // skip '{' -+ utf8_t *endPtr = NULL; -+ body = parseStatement(PScurly, &endPtr); - -- body = parseStatement(PScurly); -+ /** Extract unittest body as a string. Must be done eagerly since memory -+ will be released by the lexer before doc gen. */ -+ char *docline = NULL; -+ if (global.params.doDocComments && endPtr > begPtr) -+ { -+ /* Remove trailing whitespaces */ -+ for (utf8_t *p = endPtr - 1; -+ begPtr <= p && (*p == ' ' || *p == '\n' || *p == '\t'); --p) -+ { -+ endPtr = p; -+ } - -- f = new UnitTestDeclaration(loc, this->loc); -+ size_t len = endPtr - begPtr; -+ if (len > 0) -+ { -+ docline = (char *)mem.malloc(len + 2); -+ memcpy(docline, begPtr, len); -+ docline[len ] = '\n'; // Terminate all lines by LF -+ docline[len+1] = '\0'; -+ } -+ } -+ -+ f = new UnitTestDeclaration(loc, token.loc, docline); - f->fbody = body; - return f; - } -@@ -1334,11 +1376,11 @@ NewDeclaration *Parser::parseNew() - NewDeclaration *f; - Parameters *arguments; - int varargs; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - arguments = parseParameters(&varargs); -- f = new NewDeclaration(loc, 0, arguments, varargs); -+ f = new NewDeclaration(loc, Loc(), arguments, varargs); - parseContracts(f); - return f; - } -@@ -1354,13 +1396,13 @@ DeleteDeclaration *Parser::parseDelete() - DeleteDeclaration *f; - Parameters *arguments; - int varargs; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - arguments = parseParameters(&varargs); - if (varargs) - error("... not allowed in delete function parameter list"); -- f = new DeleteDeclaration(loc, 0, arguments); -+ f = new DeleteDeclaration(loc, Loc(), arguments); - parseContracts(f); - return f; - } -@@ -1408,7 +1450,7 @@ Parameters *Parser::parseParameters(int - if (peek(&token)->value == TOKlparen) - goto Ldefault; - if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - stc = STCimmutable; - goto L2; - -@@ -1439,7 +1481,7 @@ Parameters *Parser::parseParameters(int - (storageClass & STCin && stc & (STCconst | STCscope)) || - (stc & STCin && storageClass & (STCconst | STCscope)) - ) -- error("redundant storage class %s", Token::toChars(token.value)); -+ error("redundant storage class '%s'", Token::toChars(token.value)); - storageClass |= stc; - composeStorageClass(storageClass); - continue; -@@ -1477,10 +1519,6 @@ Parameters *Parser::parseParameters(int - if (stc & (stc - 1) && // if stc is not a power of 2 - !(stc == (STCin | STCref))) - error("incompatible parameter storage classes"); -- if ((storageClass & (STCconst | STCout)) == (STCconst | STCout)) -- error("out cannot be const"); -- if ((storageClass & (STCimmutable | STCout)) == (STCimmutable | STCout)) -- error("out cannot be immutable"); - if ((storageClass & STCscope) && (storageClass & (STCref | STCout))) - error("scope cannot be ref or out"); - -@@ -1494,7 +1532,9 @@ Parameters *Parser::parseParameters(int - t->value == TOKrparen || - t->value == TOKdotdotdot))) - #endif -- { Identifier *id = Lexer::uniqueId("__T"); -+ { -+ Identifier *id = Lexer::uniqueId("__T"); -+ Loc loc = token.loc; - at = new TypeIdentifier(loc, id); - if (!*tpl) - *tpl = new TemplateParameters(); -@@ -1531,7 +1571,6 @@ Parameters *Parser::parseParameters(int - nextToken(); - break; - } -- L3: - a = new Parameter(storageClass, at, ai, ae); - arguments->push(a); - if (token.value == TOKcomma) -@@ -1557,15 +1596,17 @@ Parameters *Parser::parseParameters(int - */ - - EnumDeclaration *Parser::parseEnum() --{ EnumDeclaration *e; -+{ -+ EnumDeclaration *e; - Identifier *id; - Type *memtype; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - //printf("Parser::parseEnum()\n"); - nextToken(); - if (token.value == TOKidentifier) -- { id = token.ident; -+ { -+ id = token.ident; - nextToken(); - } - else -@@ -1588,7 +1629,7 @@ EnumDeclaration *Parser::parseEnum() - //printf("enum definition\n"); - e->members = new Dsymbols(); - nextToken(); -- unsigned char *comment = token.blockComment; -+ utf8_t *comment = token.blockComment; - while (token.value != TOKrcurly) - { - /* Can take the following forms: -@@ -1597,7 +1638,7 @@ EnumDeclaration *Parser::parseEnum() - * 3. type ident = value - */ - -- loc = this->loc; -+ loc = token.loc; - - Type *type = NULL; - Identifier *ident; -@@ -1660,15 +1701,16 @@ EnumDeclaration *Parser::parseEnum() - */ - - Dsymbol *Parser::parseAggregate() --{ AggregateDeclaration *a = NULL; -+{ -+ AggregateDeclaration *a = NULL; - int anon = 0; -- enum TOK tok; - Identifier *id; - TemplateParameters *tpl = NULL; - Expression *constraint = NULL; -+ Loc loc = token.loc; -+ TOK tok = token.value; - - //printf("Parser::parseAggregate()\n"); -- tok = token.value; - nextToken(); - if (token.value != TOKidentifier) - { id = NULL; -@@ -1686,9 +1728,9 @@ Dsymbol *Parser::parseAggregate() - } - } - -- Loc loc = this->loc; - switch (tok) -- { case TOKclass: -+ { -+ case TOKclass: - case TOKinterface: - { - if (!id) -@@ -1701,12 +1743,27 @@ Dsymbol *Parser::parseAggregate() - nextToken(); - baseclasses = parseBaseClasses(); - -+ if (tpl) -+ { -+ Expression *tempCons = parseConstraint(); -+ if (tempCons) -+ { -+ if (constraint) -+ error("members expected"); -+ else -+ constraint = tempCons; -+ } -+ } -+ - if (token.value != TOKlcurly) - error("members expected"); - } - - if (tok == TOKclass) -- a = new ClassDeclaration(loc, id, baseclasses); -+ { -+ bool inObject = md && !md->packages && md->id == Id::object; -+ a = new ClassDeclaration(loc, id, baseclasses, inObject); -+ } - else - a = new InterfaceDeclaration(loc, id, baseclasses); - break; -@@ -1745,7 +1802,7 @@ Dsymbol *Parser::parseAggregate() - { - /* Anonymous structs/unions are more like attributes. - */ -- return new AnonDeclaration(loc, anon - 1, decl); -+ return new AnonDeclaration(loc, anon == 2, decl); - } - else - a->members = decl; -@@ -1779,7 +1836,7 @@ BaseClasses *Parser::parseBaseClasses() - for (; 1; nextToken()) - { - bool prot = false; -- enum PROT protection = PROTpublic; -+ PROT protection = PROTpublic; - switch (token.value) - { - case TOKprivate: -@@ -1846,7 +1903,7 @@ TemplateDeclaration *Parser::parseTempla - TemplateParameters *tpl; - Dsymbols *decldefs; - Expression *constraint = NULL; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - if (token.value != TOKidentifier) -@@ -1902,10 +1959,12 @@ TemplateParameters *Parser::parseTemplat - - // Get array of TemplateParameters - if (flag || token.value != TOKrparen) -- { int isvariadic = 0; -- -+ { -+ int isvariadic = 0; - while (token.value != TOKrparen) -- { TemplateParameter *tp; -+ { -+ TemplateParameter *tp; -+ Loc loc; - Identifier *tp_ident = NULL; - Type *tp_spectype = NULL; - Type *tp_valtype = NULL; -@@ -1921,6 +1980,7 @@ TemplateParameters *Parser::parseTemplat - if (token.value == TOKalias) - { // AliasParameter - nextToken(); -+ loc = token.loc; // todo - Type *spectype = NULL; - if (isDeclaration(&token, 2, TOKreserved, NULL)) - { -@@ -1929,13 +1989,14 @@ TemplateParameters *Parser::parseTemplat - else - { - if (token.value != TOKidentifier) -- { error("identifier expected for template alias parameter"); -+ { -+ error("identifier expected for template alias parameter"); - goto Lerr; - } - tp_ident = token.ident; - nextToken(); - } -- Object *spec = NULL; -+ RootObject *spec = NULL; - if (token.value == TOKcolon) // : Type - { - nextToken(); -@@ -1944,7 +2005,7 @@ TemplateParameters *Parser::parseTemplat - else - spec = parseCondExp(); - } -- Object *def = NULL; -+ RootObject *def = NULL; - if (token.value == TOKassign) // = Type - { - nextToken(); -@@ -1953,15 +2014,18 @@ TemplateParameters *Parser::parseTemplat - else - def = parseCondExp(); - } -- tp = new TemplateAliasParameter(loc, tp_ident, spectype, spec, def); -+ tp = new TemplateAliasParameter(loc/*todo*/, tp_ident, spectype, spec, def); - } - else if (t->value == TOKcolon || t->value == TOKassign || - t->value == TOKcomma || t->value == TOKrparen) -- { // TypeParameter -+ { -+ // TypeParameter - if (token.value != TOKidentifier) -- { error("identifier expected for template type parameter"); -+ { -+ error("identifier expected for template type parameter"); - goto Lerr; - } -+ loc = token.loc; - tp_ident = token.ident; - nextToken(); - if (token.value == TOKcolon) // : Type -@@ -1977,10 +2041,12 @@ TemplateParameters *Parser::parseTemplat - tp = new TemplateTypeParameter(loc, tp_ident, tp_spectype, tp_defaulttype); - } - else if (token.value == TOKidentifier && t->value == TOKdotdotdot) -- { // ident... -+ { -+ // ident... - if (isvariadic) - error("variadic template parameter must be last"); - isvariadic = 1; -+ loc = token.loc; - tp_ident = token.ident; - nextToken(); - nextToken(); -@@ -1988,12 +2054,15 @@ TemplateParameters *Parser::parseTemplat - } - #if DMDV2 - else if (token.value == TOKthis) -- { // ThisParameter -+ { -+ // ThisParameter - nextToken(); - if (token.value != TOKidentifier) -- { error("identifier expected for template this parameter"); -+ { -+ error("identifier expected for template this parameter"); - goto Lerr; - } -+ loc = token.loc; - tp_ident = token.ident; - nextToken(); - if (token.value == TOKcolon) // : Type -@@ -2010,7 +2079,9 @@ TemplateParameters *Parser::parseTemplat - } - #endif - else -- { // ValueParameter -+ { -+ // ValueParameter -+ loc = token.loc; // todo - tp_valtype = parseType(&tp_ident); - if (!tp_ident) - { -@@ -2027,7 +2098,7 @@ TemplateParameters *Parser::parseTemplat - nextToken(); - tp_defaultvalue = parseDefaultInitExp(); - } -- tp = new TemplateValueParameter(loc, tp_ident, tp_valtype, tp_specvalue, tp_defaultvalue); -+ tp = new TemplateValueParameter(loc/*todo*/, tp_ident, tp_valtype, tp_specvalue, tp_defaultvalue); - } - tpl->push(tp); - if (token.value != TOKcomma) -@@ -2053,13 +2124,14 @@ Dsymbol *Parser::parseMixin() - { - TemplateMixin *tm; - Identifier *id; -- Type *tqual; - Objects *tiargs; -- Identifiers *idents; - - //printf("parseMixin()\n"); -- nextToken(); -- tqual = NULL; -+ Loc locMixin = token.loc; -+ nextToken(); // skip 'mixin' -+ -+ Loc loc = token.loc; -+ TypeQualified *tqual = NULL; - if (token.value == TOKdot) - { - id = Id::empty; -@@ -2071,11 +2143,6 @@ Dsymbol *Parser::parseMixin() - tqual = parseTypeof(); - check(TOKdot); - } -- else if (token.value == TOKvector) -- { -- tqual = parseVector(); -- check(TOKdot); -- } - if (token.value != TOKidentifier) - { - error("identifier expected, not %s", token.toChars()); -@@ -2086,7 +2153,6 @@ Dsymbol *Parser::parseMixin() - nextToken(); - } - -- idents = new Identifiers(); - while (1) - { - tiargs = NULL; -@@ -2099,26 +2165,37 @@ Dsymbol *Parser::parseMixin() - tiargs = parseTemplateArgument(); - } - -- if (token.value != TOKdot) -- break; -- -- if (tiargs) -- { TemplateInstance *tempinst = new TemplateInstance(loc, id); -+ if (tiargs && token.value == TOKdot) -+ { -+ TemplateInstance *tempinst = new TemplateInstance(loc, id); - tempinst->tiargs = tiargs; -- id = (Identifier *)tempinst; -+ if (!tqual) -+ tqual = new TypeInstance(loc, tempinst); -+ else -+ tqual->addInst(tempinst); - tiargs = NULL; - } -- idents->push(id); -+ else -+ { -+ if (!tqual) -+ tqual = new TypeIdentifier(loc, id); -+ else -+ tqual->addIdent(id); -+ } -+ -+ if (token.value != TOKdot) -+ break; - - nextToken(); - if (token.value != TOKidentifier) -- { error("identifier expected following '.' instead of '%s'", token.toChars()); -+ { -+ error("identifier expected following '.' instead of '%s'", token.toChars()); - break; - } -+ loc = token.loc; - id = token.ident; - nextToken(); - } -- idents->push(id); - - if (token.value == TOKidentifier) - { -@@ -2128,7 +2205,7 @@ Dsymbol *Parser::parseMixin() - else - id = NULL; - -- tm = new TemplateMixin(loc, id, tqual, idents, tiargs); -+ tm = new TemplateMixin(locMixin, id, tqual, tiargs); - if (token.value != TOKsemicolon) - error("';' expected after mixin"); - nextToken(); -@@ -2158,7 +2235,7 @@ Objects *Parser::parseTemplateArgumentLi - { - //printf("Parser::parseTemplateArgumentList2()\n"); - Objects *tiargs = new Objects(); -- enum TOK endtok = TOKrparen; -+ TOK endtok = TOKrparen; - nextToken(); - - // Get TemplateArgumentList -@@ -2198,7 +2275,7 @@ Objects *Parser::parseTemplateArgument() - switch (token.value) - { - case TOKidentifier: -- ta = new TypeIdentifier(loc, token.ident); -+ ta = new TypeIdentifier(token.loc, token.ident); - goto LabelX; - - case TOKvector: -@@ -2229,6 +2306,9 @@ Objects *Parser::parseTemplateArgument() - case TOKstring: - case TOKfile: - case TOKline: -+ case TOKmodulestring: -+ case TOKfuncstring: -+ case TOKprettyfunc: - case TOKthis: - { // Template argument is an expression - Expression *ea = parsePrimaryExp(); -@@ -2242,7 +2322,7 @@ Objects *Parser::parseTemplateArgument() - } - if (token.value == TOKnot) - { -- enum TOK tok = peekNext(); -+ TOK tok = peekNext(); - if (tok != TOKis && tok != TOKin) - error("multiple ! arguments are not allowed"); - } -@@ -2250,11 +2330,8 @@ Objects *Parser::parseTemplateArgument() - } - - Import *Parser::parseImport(Dsymbols *decldefs, int isstatic) --{ Import *s; -- Identifier *id; -+{ - Identifier *aliasid = NULL; -- Identifiers *a; -- Loc loc; - - //printf("Parser::parseImport()\n"); - do -@@ -2266,9 +2343,9 @@ Import *Parser::parseImport(Dsymbols *de - break; - } - -- loc = this->loc; -- a = NULL; -- id = token.ident; -+ Loc loc = token.loc; -+ Identifier *id = token.ident; -+ Identifiers *a = NULL; - nextToken(); - if (!aliasid && token.value == TOKassign) - { -@@ -2289,7 +2366,7 @@ Import *Parser::parseImport(Dsymbols *de - nextToken(); - } - -- s = new Import(loc, a, id, aliasid, isstatic); -+ Import *s = new Import(loc, a, id, aliasid, isstatic); - decldefs->push(s); - - /* Look for -@@ -2416,7 +2493,9 @@ Type *Parser::parseType(Identifier **pid - #endif - - Type *Parser::parseBasicType() --{ Type *t; -+{ -+ Type *t; -+ Loc loc; - Identifier *id; - TypeQualified *tid; - -@@ -2430,10 +2509,12 @@ Type *Parser::parseBasicType() - case TOKthis: - case TOKsuper: - case TOKidentifier: -+ loc = token.loc; - id = token.ident; - nextToken(); - if (token.value == TOKnot) -- { // ident!(template_arguments) -+ { -+ // ident!(template_arguments) - TemplateInstance *tempinst = new TemplateInstance(loc, id); - nextToken(); - if (token.value == TOKlparen) -@@ -2449,11 +2530,14 @@ Type *Parser::parseBasicType() - tid = new TypeIdentifier(loc, id); - Lident2: - while (token.value == TOKdot) -- { nextToken(); -+ { -+ nextToken(); - if (token.value != TOKidentifier) -- { error("identifier expected following '.' instead of '%s'", token.toChars()); -+ { -+ error("identifier expected following '.' instead of '%s'", token.toChars()); - break; - } -+ loc = token.loc; - id = token.ident; - nextToken(); - if (token.value == TOKnot) -@@ -2466,7 +2550,7 @@ Type *Parser::parseBasicType() - else - // ident!template_argument - tempinst->tiargs = parseTemplateArgument(); -- tid->addIdent((Identifier *)tempinst); -+ tid->addInst(tempinst); - } - else - tid->addIdent(id); -@@ -2476,6 +2560,7 @@ Type *Parser::parseBasicType() - - case TOKdot: - // Leading . as in .foo -+ loc = token.loc; - id = Id::empty; - goto Lident; - -@@ -2503,7 +2588,7 @@ Type *Parser::parseBasicType() - break; - - case TOKinvariant: -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - case TOKimmutable: - // invariant(type) - nextToken(); -@@ -2617,7 +2702,7 @@ Type *Parser::parseBasicType2(Type *t) - // t function(parameter list) nothrow pure - Parameters *arguments; - int varargs; -- enum TOK save = token.value; -+ TOK save = token.value; - - nextToken(); - arguments = parseParameters(&varargs); -@@ -2690,7 +2775,8 @@ Type *Parser::parseDeclarator(Type *t, I - * Improve error messages for the common bug of a missing return type - * by looking to see if (a) looks like a parameter list. - */ -- if (isParameters(&peekt)) { -+ if (isParameters(&peekt)) -+ { - error("function declaration without return type. " - "(Note that constructors are always named 'this')"); - } -@@ -2807,7 +2893,7 @@ Type *Parser::parseDeclarator(Type *t, I - * Return array of Declaration *'s. - */ - --Dsymbols *Parser::parseDeclarations(StorageClass storage_class, unsigned char *comment) -+Dsymbols *Parser::parseDeclarations(StorageClass storage_class, utf8_t *comment) - { - StorageClass stc; - int disable; -@@ -2816,10 +2902,10 @@ Dsymbols *Parser::parseDeclarations(Stor - Type *tfirst; - Identifier *ident; - Dsymbols *a; -- enum TOK tok = TOKreserved; -- enum LINK link = linkage; -+ TOK tok = TOKreserved; -+ LINK link = linkage; - unsigned structalign = 0; -- Loc loc = this->loc; -+ Loc loc = token.loc; - Expressions *udas = NULL; - - //printf("parseDeclarations() %s\n", token.toChars()); -@@ -2834,6 +2920,7 @@ Dsymbols *Parser::parseDeclarations(Stor - switch (token.value) - { - case TOKalias: -+ { - /* Look for: - * alias identifier this; - */ -@@ -2869,32 +2956,116 @@ Dsymbols *Parser::parseDeclarations(Stor - #endif - /* Look for: - * alias identifier = type; -+ * alias identifier(...) = type; - */ -- if (token.value == TOKidentifier && peekNext() == TOKassign) -+ Token *tk = &token; -+ if (tk->value == TOKidentifier && -+ ((tk = peek(tk))->value == TOKlparen -+ ? skipParens(tk, &tk) && (tk = peek(tk), 1) : 1) && -+ tk->value == TOKassign) - { - a = new Dsymbols(); - while (1) - { - ident = token.ident; - nextToken(); -+ TemplateParameters *tpl = NULL; -+ if (token.value == TOKlparen) -+ tpl = parseTemplateParameterList(); - check(TOKassign); - t = parseType(); -- Declaration *v = new AliasDeclaration(loc, ident, t); -- a->push(v); -+ Dsymbol *s = new AliasDeclaration(loc, ident, t); -+ if (tpl) -+ { -+ Dsymbols *a2 = new Dsymbols(); -+ a2->push(s); -+ TemplateDeclaration *tempdecl = -+ new TemplateDeclaration(loc, ident, tpl, NULL/*constraint*/, a2, 0); -+ s = tempdecl; -+ } -+ a->push(s); - switch (token.value) -- { case TOKsemicolon: -+ { -+ case TOKsemicolon: - nextToken(); -- addComment(v, comment); -+ addComment(s, comment); - break; - case TOKcomma: - nextToken(); -- addComment(v, comment); -+ addComment(s, comment); - if (token.value != TOKidentifier) -- { error("Identifier expected following comma, not %s", token.toChars()); -+ { -+ error("Identifier expected following comma, not %s", token.toChars()); - break; - } -- else if (peek(&token)->value != TOKassign) -- { error("= expected following identifier"); -+ if (peekNext() != TOKassign && peekNext() != TOKlparen) -+ { -+ error("= expected following identifier"); -+ nextToken(); -+ break; -+ } -+ continue; -+ default: -+ error("semicolon expected to close %s declaration", Token::toChars(tok)); -+ break; -+ } -+ break; -+ } -+ return a; -+ } -+ break; -+ } -+ case TOKenum: -+ { -+ /* Look for: -+ * enum identifier(...) = type; -+ */ -+ tok = token.value; -+ Token *tk = peek(&token); -+ if (tk->value == TOKidentifier && -+ (tk = peek(tk))->value == TOKlparen && skipParens(tk, &tk) && -+ (tk = peek(tk))->value == TOKassign) -+ { -+ nextToken(); -+ a = new Dsymbols(); -+ while (1) -+ { -+ ident = token.ident; -+ nextToken(); -+ TemplateParameters *tpl = NULL; -+ if (token.value == TOKlparen) -+ tpl = parseTemplateParameterList(); -+ check(TOKassign); -+ Initializer *init = parseInitializer(); -+ VarDeclaration *v = new VarDeclaration(loc, NULL, ident, init); -+ v->storage_class = STCmanifest; -+ Dsymbol *s = v; -+ if (tpl) -+ { -+ Dsymbols *a2 = new Dsymbols(); -+ a2->push(s); -+ TemplateDeclaration *tempdecl = -+ new TemplateDeclaration(loc, ident, tpl, NULL/*constraint*/, a2, 0); -+ s = tempdecl; -+ } -+ a->push(s); -+ switch (token.value) -+ { -+ case TOKsemicolon: -+ nextToken(); -+ addComment(s, comment); -+ break; -+ case TOKcomma: -+ nextToken(); -+ addComment(s, comment); -+ if (token.value != TOKidentifier) -+ { -+ error("Identifier expected following comma, not %s", token.toChars()); -+ break; -+ } -+ if (peekNext() != TOKassign && peekNext() != TOKlparen) -+ { -+ error("= expected following identifier"); - nextToken(); - break; - } -@@ -2907,8 +3078,8 @@ Dsymbols *Parser::parseDeclarations(Stor - } - return a; - } -- - break; -+ } - case TOKtypedef: - deprecation("use of typedef is deprecated; use alias instead"); - tok = token.value; -@@ -2933,7 +3104,7 @@ Dsymbols *Parser::parseDeclarations(Stor - if (peek(&token)->value == TOKlparen) - break; - if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - stc = STCimmutable; - goto L1; - -@@ -2961,7 +3132,6 @@ Dsymbols *Parser::parseDeclarations(Stor - case TOKnothrow: stc = STCnothrow; goto L1; - case TOKpure: stc = STCpure; goto L1; - case TOKref: stc = STCref; goto L1; -- case TOKtls: stc = STCtls; goto L1; - case TOKgshared: stc = STCgshared; goto L1; - case TOKenum: stc = STCmanifest; goto L1; - case TOKat: -@@ -3005,7 +3175,7 @@ Dsymbols *Parser::parseDeclarations(Stor - check(TOKrparen); - } - else -- structalign = global.structalign; // default -+ structalign = STRUCTALIGN_DEFAULT; // default - continue; - } - default: -@@ -3100,7 +3270,7 @@ L2: - - while (1) - { -- loc = this->loc; -+ loc = token.loc; - TemplateParameters *tpl = NULL; - - ident = NULL; -@@ -3111,11 +3281,13 @@ L2: - else if (t != tfirst) - error("multiple declarations must have the same type, not %s and %s", - tfirst->toChars(), t->toChars()); -- if (!ident) -+ bool isThis = (t->ty == Tident && ((TypeIdentifier *)t)->ident == Id::This); -+ if (!isThis && !ident) - error("no identifier for declarator %s", t->toChars()); - - if (tok == TOKtypedef || tok == TOKalias) -- { Declaration *v; -+ { -+ Declaration *v; - Initializer *init = NULL; - - /* Aliases can no longer have multiple declarators, storage classes, -@@ -3132,12 +3304,20 @@ L2: - init = parseInitializer(); - } - if (tok == TOKtypedef) -- { v = new TypedefDeclaration(loc, ident, t, init); -- deprecation("use of typedef is deprecated; use alias instead"); -+ { -+ v = new TypedefDeclaration(loc, ident, t, init); - } - else -- { if (init) -- error("alias cannot have initializer"); -+ { -+ if (init) -+ { -+ if (isThis) -+ error("Cannot use syntax 'alias this = %s', use 'alias %s this' instead", -+ init->toChars(), init->toChars()); -+ else -+ error("alias cannot have initializer"); -+ } -+ - v = new AliasDeclaration(loc, ident, t); - } - v->storage_class = storage_class; -@@ -3181,7 +3361,7 @@ L2: - //printf("%s funcdecl t = %s, storage_class = x%lx\n", loc.toChars(), t->toChars(), storage_class); - - FuncDeclaration *f = -- new FuncDeclaration(loc, 0, ident, storage_class | (disable ? STCdisable : 0), t); -+ new FuncDeclaration(loc, Loc(), ident, storage_class | (disable ? STCdisable : 0), t); - addComment(f, comment); - if (tpl) - constraint = parseConstraint(); -@@ -3269,12 +3449,13 @@ L2: - */ - - #if DMDV2 --Dsymbols *Parser::parseAutoDeclarations(StorageClass storageClass, unsigned char *comment) -+Dsymbols *Parser::parseAutoDeclarations(StorageClass storageClass, utf8_t *comment) - { - Dsymbols *a = new Dsymbols; - - while (1) - { -+ Loc loc = token.loc; - Identifier *ident = token.ident; - nextToken(); // skip over ident - assert(token.value == TOKassign); -@@ -3314,7 +3495,7 @@ Dsymbols *Parser::parseAutoDeclarations( - - void Parser::parseContracts(FuncDeclaration *f) - { -- enum LINK linksave = linkage; -+ LINK linksave = linkage; - - // The following is irrelevant, as it is overridden by sc->linkage in - // TypeFunction::semantic -@@ -3413,7 +3594,7 @@ Initializer *Parser::parseInitializer() - Identifier *id; - Initializer *value; - int comma; -- Loc loc = this->loc; -+ Loc loc = token.loc; - Token *t; - int braces; - int brackets; -@@ -3626,23 +3807,32 @@ Initializer *Parser::parseInitializer() - - /***************************************** - * Parses default argument initializer expression that is an assign expression, -- * with special handling for __FILE__ and __LINE__. -+ * with special handling for __FILE__, __LINE__, __MODULE__, __FUNCTION__, and __PRETTY_FUNCTION__. - */ - - #if DMDV2 - Expression *Parser::parseDefaultInitExp() - { - if (token.value == TOKfile || -- token.value == TOKline) -+ token.value == TOKline || -+ token.value == TOKmodulestring || -+ token.value == TOKfuncstring || -+ token.value == TOKprettyfunc) - { - Token *t = peek(&token); - if (t->value == TOKcomma || t->value == TOKrparen) -- { Expression *e; -- -+ { -+ Expression *e; - if (token.value == TOKfile) -- e = new FileInitExp(loc); -- else -- e = new LineInitExp(loc); -+ e = new FileInitExp(token.loc); -+ else if (token.value == TOKline) -+ e = new LineInitExp(token.loc); -+ else if (token.value == TOKmodulestring) -+ e = new ModuleInitExp(token.loc); -+ else if (token.value == TOKfuncstring) -+ e = new FuncInitExp(token.loc); -+ else if (token.value == TOKprettyfunc) -+ e = new PrettyFuncInitExp(token.loc); - nextToken(); - return e; - } -@@ -3672,13 +3862,14 @@ void Parser::checkDanglingElse(Loc elsel - * flags PSxxxx - */ - --Statement *Parser::parseStatement(int flags) --{ Statement *s; -+Statement *Parser::parseStatement(int flags, utf8_t** endPtr) -+{ -+ Statement *s; - Condition *condition; - Statement *ifbody; - Statement *elsebody; - bool isfinal; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - //printf("parseStatement()\n"); - -@@ -3753,6 +3944,9 @@ Statement *Parser::parseStatement(int fl - case TOKtraits: - case TOKfile: - case TOKline: -+ case TOKmodulestring: -+ case TOKfuncstring: -+ case TOKprettyfunc: - #endif - Lexp: - { -@@ -3818,7 +4012,6 @@ Statement *Parser::parseStatement(int fl - case TOKnothrow: - case TOKpure: - case TOKref: -- case TOKtls: - case TOKgshared: - case TOKat: - #endif -@@ -3906,7 +4099,7 @@ Statement *Parser::parseStatement(int fl - case TOKlcurly: - { - Loc lookingForElseSave = lookingForElse; -- lookingForElse = 0; -+ lookingForElse = Loc(); - - nextToken(); - //if (token.value == TOKsemicolon) -@@ -3916,7 +4109,8 @@ Statement *Parser::parseStatement(int fl - { - statements->push(parseStatement(PSsemi | PScurlyscope)); - } -- endloc = this->loc; -+ if (endPtr) *endPtr = token.ptr; -+ endloc = token.loc; - s = new CompoundStatement(loc, statements); - if (flags & (PSscope | PScurlyscope)) - s = new ScopeStatement(loc, s); -@@ -3956,7 +4150,7 @@ Statement *Parser::parseStatement(int fl - - nextToken(); - Loc lookingForElseSave = lookingForElse; -- lookingForElse = 0; -+ lookingForElse = Loc(); - body = parseStatement(PSscope); - lookingForElse = lookingForElseSave; - check(TOKwhile); -@@ -3987,7 +4181,7 @@ Statement *Parser::parseStatement(int fl - else - { - Loc lookingForElseSave = lookingForElse; -- lookingForElse = 0; -+ lookingForElse = Loc(); - init = parseStatement(0); - lookingForElse = lookingForElseSave; - } -@@ -4011,15 +4205,13 @@ Statement *Parser::parseStatement(int fl - } - body = parseStatement(PSscope); - s = new ForStatement(loc, init, condition, increment, body); -- if (init) -- s = new ScopeStatement(loc, s); - break; - } - - case TOKforeach: - case TOKforeach_reverse: - { -- enum TOK op = token.value; -+ TOK op = token.value; - - nextToken(); - check(TOKlparen); -@@ -4032,22 +4224,29 @@ Statement *Parser::parseStatement(int fl - Type *at; - - StorageClass storageClass = 0; -+ StorageClass stc = 0; - Lagain: -+ if (stc) -+ { -+ if (storageClass & stc) -+ error("redundant storage class '%s'", Token::toChars(token.value)); -+ storageClass |= stc; -+ composeStorageClass(storageClass); -+ nextToken(); -+ } - switch (token.value) - { - case TOKref: - #if D1INOUT - case TOKinout: - #endif -- storageClass |= STCref; -- nextToken(); -+ stc = STCref; - goto Lagain; - - case TOKconst: - if (peekNext() != TOKlparen) - { -- storageClass |= STCconst; -- nextToken(); -+ stc = STCconst; - goto Lagain; - } - break; -@@ -4055,26 +4254,23 @@ Statement *Parser::parseStatement(int fl - case TOKimmutable: - if (peekNext() != TOKlparen) - { -- storageClass |= STCimmutable; -+ stc = STCimmutable; - if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -- nextToken(); -+ error("use 'immutable' instead of 'invariant'"); - goto Lagain; - } - break; - case TOKshared: - if (peekNext() != TOKlparen) - { -- storageClass |= STCshared; -- nextToken(); -+ stc = STCshared; - goto Lagain; - } - break; - case TOKwild: - if (peekNext() != TOKlparen) - { -- storageClass |= STCwild; -- nextToken(); -+ stc = STCwild; - goto Lagain; - } - break; -@@ -4126,7 +4322,8 @@ Statement *Parser::parseStatement(int fl - } - - case TOKif: -- { Parameter *arg = NULL; -+ { -+ Parameter *arg = NULL; - Expression *condition; - Statement *ifbody; - Statement *elsebody; -@@ -4134,52 +4331,91 @@ Statement *Parser::parseStatement(int fl - nextToken(); - check(TOKlparen); - -- if (token.value == TOKauto) -+ StorageClass storageClass = 0; -+ StorageClass stc = 0; -+ LagainStc: -+ if (stc) - { -+ if (storageClass & stc) -+ error("redundant storage class '%s'", Token::toChars(token.value)); -+ storageClass |= stc; -+ composeStorageClass(storageClass); - nextToken(); -- if (token.value == TOKidentifier) -- { -- Token *t = peek(&token); -- if (t->value == TOKassign) -+ } -+ switch (token.value) -+ { -+ case TOKref: -+ stc = STCref; -+ goto LagainStc; -+ case TOKauto: -+ stc = STCauto; -+ goto LagainStc; -+ case TOKconst: -+ if (peekNext() != TOKlparen) - { -- arg = new Parameter(0, NULL, token.ident, NULL); -- nextToken(); -- nextToken(); -+ stc = STCconst; -+ goto LagainStc; - } -- else -- { error("= expected following auto identifier"); -- goto Lerror; -+ break; -+ case TOKinvariant: -+ case TOKimmutable: -+ if (peekNext() != TOKlparen) -+ { -+ stc = STCimmutable; -+ if (token.value == TOKinvariant) -+ error("use 'immutable' instead of 'invariant'"); -+ goto LagainStc; - } -- } -- else -- { error("identifier expected following auto"); -- goto Lerror; -- } -+ break; -+ case TOKshared: -+ if (peekNext() != TOKlparen) -+ { -+ stc = STCshared; -+ goto LagainStc; -+ } -+ break; -+ case TOKwild: -+ if (peekNext() != TOKlparen) -+ { -+ stc = STCwild; -+ goto LagainStc; -+ } -+ break; -+ default: -+ break; - } -- else if (isDeclaration(&token, 2, TOKassign, NULL)) -- { -- Type *at; -- Identifier *ai; - -- at = parseType(&ai); -+ if (storageClass != 0 && -+ token.value == TOKidentifier && -+ peek(&token)->value == TOKassign) -+ { -+ Identifier *ai = token.ident; -+ Type *at = NULL; // infer argument type -+ nextToken(); - check(TOKassign); -- arg = new Parameter(0, at, ai, NULL); -+ arg = new Parameter(storageClass, at, ai, NULL); - } -- - // Check for " ident;" -- else if (token.value == TOKidentifier) -+ else if (storageClass == 0 && -+ token.value == TOKidentifier && -+ peek(&token)->value == TOKsemicolon) - { -- Token *t = peek(&token); -- if (t->value == TOKsemicolon) -- { -- arg = new Parameter(0, NULL, token.ident, NULL); -- nextToken(); -- nextToken(); -- error("if (v; e) is deprecated, use if (auto v = e)"); -- } -+ arg = new Parameter(0, NULL, token.ident, NULL); -+ nextToken(); -+ nextToken(); -+ error("if (v; e) is deprecated, use if (auto v = e)"); -+ } -+ else if (isDeclaration(&token, 2, TOKassign, NULL)) -+ { -+ Identifier *ai; -+ Type *at = parseType(&ai); -+ check(TOKassign); -+ arg = new Parameter(storageClass, at, ai, NULL); - } - - condition = parseExpression(); -+ if (condition->op == TOKassign) -+ error("assignment cannot be used as a condition, perhaps == was meant?"); - check(TOKrparen); - { - Loc lookingForElseSave = lookingForElse; -@@ -4189,7 +4425,7 @@ Statement *Parser::parseStatement(int fl - } - if (token.value == TOKelse) - { -- Loc elseloc = this->loc; -+ Loc elseloc = token.loc; - nextToken(); - elsebody = parseStatement(PSscope); - checkDanglingElse(elseloc); -@@ -4251,7 +4487,7 @@ Statement *Parser::parseStatement(int fl - elsebody = NULL; - if (token.value == TOKelse) - { -- Loc elseloc = this->loc; -+ Loc elseloc = token.loc; - nextToken(); - elsebody = parseStatement(0 /*PSsemi*/); - checkDanglingElse(elseloc); -@@ -4509,7 +4745,7 @@ Statement *Parser::parseStatement(int fl - - nextToken(); - Loc lookingForElseSave = lookingForElse; -- lookingForElse = 0; -+ lookingForElse = Loc(); - body = parseStatement(PSscope); - lookingForElse = lookingForElseSave; - while (token.value == TOKcatch) -@@ -4518,7 +4754,7 @@ Statement *Parser::parseStatement(int fl - Catch *c; - Type *t; - Identifier *id; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - if (token.value == TOKlcurly || token.value != TOKlparen) -@@ -4604,7 +4840,7 @@ Statement *Parser::parseStatement(int fl - if (t->value == TOKcolon) - { // It's a label - label = token.ident; -- labelloc = this->loc; -+ labelloc = token.loc; - nextToken(); - nextToken(); - continue; -@@ -4635,8 +4871,9 @@ Statement *Parser::parseStatement(int fl - - s = NULL; - if (toklist || label) -- { // Create AsmStatement from list of tokens we've saved -- s = new AsmStatement(this->loc, toklist); -+ { -+ // Create AsmStatement from list of tokens we've saved -+ s = new AsmStatement(token.loc, toklist); - toklist = NULL; - ptoklist = &toklist; - if (label) -@@ -4693,8 +4930,10 @@ Statement *Parser::parseStatement(int fl - } - - case TOKtemplate: -- error("template definitions aren't allowed inside functions"); -- goto Lerror; -+ { Dsymbol *d = parseTemplateDeclaration(0); -+ s = new ExpStatement(loc, d); -+ break; -+ } - - default: - error("found '%s' instead of statement", token.toChars()); -@@ -4723,7 +4962,6 @@ Statement *Parser::parseExtAsm() - Expressions *constraints = NULL; - int outputargs = 0; - Expressions *clobbers = NULL; -- Dsymbols *labels = NULL; - bool isInputPhase = false; // Output operands first, then input. - - insn = parseExpression(); -@@ -4824,24 +5062,24 @@ Statement *Parser::parseExtAsm() - Ldone: - check(TOKsemicolon); - -- return new ExtAsmStatement(loc, insn, args, names, constraints, -- outputargs, clobbers, labels); -+ return new ExtAsmStatement(token.loc, insn, args, names, -+ constraints, outputargs, clobbers); - } - #endif - --void Parser::check(enum TOK value) -+void Parser::check(TOK value) - { -- check(loc, value); -+ check(token.loc, value); - } - --void Parser::check(Loc loc, enum TOK value) -+void Parser::check(Loc loc, TOK value) - { - if (token.value != value) - error(loc, "found '%s' when expecting '%s'", token.toChars(), Token::toChars(value)); - nextToken(); - } - --void Parser::check(enum TOK value, const char *string) -+void Parser::check(TOK value, const char *string) - { - if (token.value != value) - error("found '%s' when expecting '%s' following %s", -@@ -4849,10 +5087,10 @@ void Parser::check(enum TOK value, const - nextToken(); - } - --void Parser::checkParens(enum TOK value, Expression *e) -+void Parser::checkParens(TOK value, Expression *e) - { - if (precedence[e->op] == PREC_rel && !e->parens) -- error(loc, "%s must be parenthesized when next to operator %s", e->toChars(), Token::toChars(value)); -+ error(e->loc, "%s must be parenthesized when next to operator %s", e->toChars(), Token::toChars(value)); - } - - /************************************ -@@ -4865,10 +5103,11 @@ void Parser::checkParens(enum TOK value, - * if *pt is not NULL, it is set to the ending token, which would be endtok - */ - --int Parser::isDeclaration(Token *t, int needId, enum TOK endtok, Token **pt) -+int Parser::isDeclaration(Token *t, int needId, TOK endtok, Token **pt) - { - //printf("isDeclaration(needId = %d)\n", needId); - int haveId = 0; -+ int haveTpl = 0; - - #if DMDV2 - while (1) -@@ -4895,7 +5134,7 @@ int Parser::isDeclaration(Token *t, int - { - goto Lisnot; - } -- if (!isDeclarator(&t, &haveId, endtok)) -+ if (!isDeclarator(&t, &haveId, &haveTpl, endtok)) - goto Lisnot; - if ( needId == 1 || - (needId == 0 && !haveId) || -@@ -4920,7 +5159,6 @@ int Parser::isBasicType(Token **pt) - { - // This code parallels parseBasicType() - Token *t = *pt; -- int haveId = 0; - - switch (t->value) - { -@@ -4983,6 +5221,9 @@ int Parser::isBasicType(Token **pt) - case TOKstring: - case TOKfile: - case TOKline: -+ case TOKmodulestring: -+ case TOKfuncstring: -+ case TOKprettyfunc: - goto L2; - default: - goto Lfalse; -@@ -5036,7 +5277,7 @@ Lfalse: - return FALSE; - } - --int Parser::isDeclarator(Token **pt, int *haveId, enum TOK endtok) -+int Parser::isDeclarator(Token **pt, int *haveId, int *haveTpl, TOK endtok) - { // This code parallels parseDeclarator() - Token *t = *pt; - int parens; -@@ -5109,7 +5350,7 @@ int Parser::isDeclarator(Token **pt, int - } - - -- if (!isDeclarator(&t, haveId, TOKrparen)) -+ if (!isDeclarator(&t, haveId, NULL, TOKrparen)) - return FALSE; - t = peek(t); - parens = TRUE; -@@ -5157,6 +5398,13 @@ int Parser::isDeclarator(Token **pt, int - - case TOKlparen: - parens = FALSE; -+ if (Token *tk = peekPastParen(t)) -+ { if (tk->value == TOKlparen) -+ { if (!haveTpl) return FALSE; -+ *haveTpl = 1; -+ t = tk; -+ } -+ } - if (!isParameters(&t)) - return FALSE; - #if DMDV2 -@@ -5202,6 +5450,8 @@ int Parser::isDeclarator(Token **pt, int - return TRUE; - } - return FALSE; -+ case TOKif: -+ return haveTpl ? TRUE : FALSE; - - default: - return FALSE; -@@ -5280,7 +5530,7 @@ int Parser::isParameters(Token **pt) - L2: - int tmp = FALSE; - if (t->value != TOKdotdotdot && -- !isDeclarator(&t, &tmp, TOKreserved)) -+ !isDeclarator(&t, &tmp, NULL, TOKreserved)) - return FALSE; - if (t->value == TOKassign) - { t = peek(t); -@@ -5459,7 +5709,6 @@ int Parser::skipAttributes(Token *t, Tok - case TOKnothrow: - case TOKpure: - case TOKref: -- case TOKtls: - case TOKgshared: - //case TOKmanifest: - break; -@@ -5538,11 +5787,12 @@ int Parser::skipAttributes(Token *t, Tok - /********************************* Expression Parser ***************************/ - - Expression *Parser::parsePrimaryExp() --{ Expression *e; -+{ -+ Expression *e; - Type *t; - Identifier *id; -- enum TOK save; -- Loc loc = this->loc; -+ TOK save; -+ Loc loc = token.loc; - - //printf("parsePrimaryExp(): loc = %d\n", loc.linnum); - switch (token.value) -@@ -5660,6 +5910,24 @@ Expression *Parser::parsePrimaryExp() - e = new IntegerExp(loc, loc.linnum, Type::tint32); - nextToken(); - break; -+ -+ case TOKmodulestring: -+ { -+ const char *s = md ? md->toChars() : mod->toChars(); -+ e = new StringExp(loc, (char *)s, strlen(s), 0); -+ nextToken(); -+ break; -+ } -+ -+ case TOKfuncstring: -+ e = new FuncInitExp(loc); -+ nextToken(); -+ break; -+ -+ case TOKprettyfunc: -+ e = new PrettyFuncInitExp(loc); -+ nextToken(); -+ break; - #endif - - case TOKtrue: -@@ -5690,7 +5958,7 @@ Expression *Parser::parsePrimaryExp() - case TOKstring: - { - // cat adjacent strings -- unsigned char *s = token.ustring; -+ utf8_t *s = token.ustring; - size_t len = token.len; - unsigned char postfix = token.postfix; - while (1) -@@ -5707,9 +5975,9 @@ Expression *Parser::parsePrimaryExp() - size_t len1 = len; - size_t len2 = token.len; - len = len1 + len2; -- unsigned char *s2 = (unsigned char *)mem.malloc((len + 1) * sizeof(unsigned char)); -- memcpy(s2, s, len1 * sizeof(unsigned char)); -- memcpy(s2 + len1, token.ustring, (len2 + 1) * sizeof(unsigned char)); -+ utf8_t *s2 = (utf8_t *)mem.malloc((len + 1) * sizeof(utf8_t)); -+ memcpy(s2, s, len1 * sizeof(utf8_t)); -+ memcpy(s2 + len1, token.ustring, (len2 + 1) * sizeof(utf8_t)); - s = s2; - } - else -@@ -5748,7 +6016,7 @@ Expression *Parser::parsePrimaryExp() - { - nextToken(); - check(TOKlparen, "typeid"); -- Object *o; -+ RootObject *o; - if (isDeclaration(&token, 0, TOKreserved, NULL)) - { // argument is a type - o = parseType(); -@@ -5788,13 +6056,14 @@ Expression *Parser::parsePrimaryExp() - #endif - - case TOKis: -- { Type *targ; -+ { -+ Type *targ; - Identifier *ident = NULL; - Type *tspec = NULL; -- enum TOK tok = TOKreserved; -- enum TOK tok2 = TOKreserved; -+ TOK tok = TOKreserved; -+ TOK tok2 = TOKreserved; - TemplateParameters *tpl = NULL; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - if (token.value == TOKlparen) -@@ -5826,9 +6095,12 @@ Expression *Parser::parsePrimaryExp() - token.value == TOKdelegate || - token.value == TOKreturn)) - { -- if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); - tok2 = token.value; -+ if (token.value == TOKinvariant) -+ { -+ error("use 'immutable' instead of 'invariant'"); -+ tok2 = TOKimmutable; -+ } - nextToken(); - } - else -@@ -5836,7 +6108,7 @@ Expression *Parser::parsePrimaryExp() - tspec = parseType(); - } - } -- if (ident && tspec) -+ if (tspec) - { - if (token.value == TOKcomma) - tpl = parseTemplateParameterList(1); -@@ -5844,8 +6116,6 @@ Expression *Parser::parsePrimaryExp() - { tpl = new TemplateParameters(); - check(TOKrparen); - } -- TemplateParameter *tp = new TemplateTypeParameter(loc, ident, NULL, NULL); -- tpl->insert(0, tp); - } - else - check(TOKrparen); -@@ -5893,11 +6163,15 @@ Expression *Parser::parsePrimaryExp() - break; - } - -+ case TOKnew: -+ e = parseNewExp(NULL); -+ break; -+ - case TOKlparen: - { Token *tk = peekPastParen(&token); - if (skipAttributes(tk, &tk)) - { -- enum TOK past = tk->value; -+ TOK past = tk->value; - if (past == TOKgoesto) - { // (arguments) => expression - goto case_delegate; -@@ -5963,8 +6237,8 @@ Expression *Parser::parsePrimaryExp() - int varargs = 0; - Type *tret = NULL; - StorageClass stc = 0; -- enum TOK save = TOKreserved; -- Loc loc = this->loc; -+ TOK save = TOKreserved; -+ Loc loc = token.loc; - - switch (token.value) - { -@@ -5991,7 +6265,6 @@ Expression *Parser::parsePrimaryExp() - /* fall through to TOKlparen */ - - case TOKlparen: -- Lparen: - { // (parameters) => expression - // (parameters) { statements... } - parameters = parseParameters(&varargs, &tpl); -@@ -6025,15 +6298,15 @@ Expression *Parser::parsePrimaryExp() - if (!parameters) - parameters = new Parameters(); - TypeFunction *tf = new TypeFunction(parameters, tret, varargs, linkage, stc); -- FuncLiteralDeclaration *fd = new FuncLiteralDeclaration(loc, 0, tf, save, NULL); -+ FuncLiteralDeclaration *fd = new FuncLiteralDeclaration(loc, Loc(), tf, save, NULL); - - if (token.value == TOKgoesto) - { - check(TOKgoesto); -- Loc loc = this->loc; -+ Loc loc = token.loc; - Expression *ae = parseAssignExp(); - fd->fbody = new ReturnStatement(loc, ae); -- fd->endloc = this->loc; -+ fd->endloc = token.loc; - } - else - { -@@ -6070,7 +6343,7 @@ Expression *Parser::parsePostExp(Express - - while (1) - { -- loc = this->loc; -+ loc = token.loc; - switch (token.value) - { - case TOKdot: -@@ -6081,7 +6354,6 @@ Expression *Parser::parsePostExp(Express - nextToken(); - if (token.value == TOKnot && peekNext() != TOKis && peekNext() != TOKin) - { // identifier!(template-argument-list) -- TemplateInstance *tempinst = new TemplateInstance(loc, id); - Objects *tiargs; - nextToken(); - if (token.value == TOKlparen) -@@ -6174,8 +6446,9 @@ Expression *Parser::parsePostExp(Express - } - - Expression *Parser::parseUnaryExp() --{ Expression *e; -- Loc loc = this->loc; -+{ -+ Expression *e; -+ Loc loc = token.loc; - - switch (token.value) - { -@@ -6235,10 +6508,6 @@ Expression *Parser::parseUnaryExp() - e = new DeleteExp(loc, e); - break; - -- case TOKnew: -- e = parseNewExp(NULL); -- break; -- - case TOKcast: // cast(type) expression - { - nextToken(); -@@ -6260,7 +6529,7 @@ Expression *Parser::parseUnaryExp() - else if ((token.value == TOKimmutable || token.value == TOKinvariant) && peekNext() == TOKrparen) - { - if (token.value == TOKinvariant) -- deprecation("use of 'invariant' rather than 'immutable' is deprecated"); -+ error("use 'immutable' instead of 'invariant'"); - m = MODimmutable; - goto Lmod2; - } -@@ -6307,13 +6576,25 @@ Expression *Parser::parseUnaryExp() - case TOKshared: - case TOKconst: - case TOKinvariant: -- case TOKimmutable: // immutable(type)(arguments) -+ case TOKimmutable: // immutable(type)(arguments) / immutable(type).init - { - StorageClass stc = parseTypeCtor(); - Type *t = parseBasicType(); - t = t->addSTC(stc); - e = new TypeExp(loc, t); -- if (token.value != TOKlparen) -+ if (stc == 0 && token.value == TOKdot) -+ { -+ nextToken(); -+ if (token.value != TOKidentifier) -+ { error("Identifier expected following (type)."); -+ return NULL; -+ } -+ e = typeDotIdExp(loc, t, token.ident); -+ nextToken(); -+ e = parsePostExp(e); -+ break; -+ } -+ else if (token.value != TOKlparen) - { - error("(arguments) expected following %s", t->toChars()); - return e; -@@ -6378,6 +6659,9 @@ Expression *Parser::parseUnaryExp() - #if DMDV2 - case TOKfile: - case TOKline: -+ case TOKmodulestring: -+ case TOKfuncstring: -+ case TOKprettyfunc: - #endif - case BASIC_TYPES: // (type)int.size - { // (type) una_exp -@@ -6388,15 +6672,15 @@ Expression *Parser::parseUnaryExp() - check(TOKrparen); - - // if .identifier -+ // or .identifier!( ... ) - if (token.value == TOKdot) - { -- nextToken(); -- if (token.value != TOKidentifier) -- { error("Identifier expected following (type)."); -+ if (peekNext() != TOKidentifier && peekNext() != TOKnew) -+ { -+ error("identifier or new keyword expected following (...)."); - return NULL; - } -- e = typeDotIdExp(loc, t, token.ident); -- nextToken(); -+ e = new TypeExp(loc, t); - e = parsePostExp(e); - } - else -@@ -6407,6 +6691,8 @@ Expression *Parser::parseUnaryExp() - } - return e; - } -+ default: -+ break; - } - } - #endif -@@ -6433,9 +6719,10 @@ Expression *Parser::parseUnaryExp() - } - - Expression *Parser::parseMulExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseUnaryExp(); - while (1) -@@ -6455,9 +6742,10 @@ Expression *Parser::parseMulExp() - } - - Expression *Parser::parseAddExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseMulExp(); - while (1) -@@ -6477,9 +6765,10 @@ Expression *Parser::parseAddExp() - } - - Expression *Parser::parseShiftExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseAddExp(); - while (1) -@@ -6500,10 +6789,11 @@ Expression *Parser::parseShiftExp() - - #if DMDV1 - Expression *Parser::parseRelExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- enum TOK op; -- Loc loc = this->loc; -+ TOK op; -+ Loc loc = token.loc; - - e = parseShiftExp(); - while (1) -@@ -6557,14 +6847,15 @@ Expression *Parser::parseRelExp() - - #if DMDV1 - Expression *Parser::parseEqualExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; - Token *t; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseRelExp(); - while (1) -- { enum TOK value = token.value; -+ { TOK value = token.value; - - switch (value) - { -@@ -6612,13 +6903,14 @@ Expression *Parser::parseEqualExp() - #endif - - Expression *Parser::parseCmpExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; - Token *t; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseShiftExp(); -- enum TOK op = token.value; -+ TOK op = token.value; - - switch (op) - { -@@ -6688,7 +6980,7 @@ Expression *Parser::parseCmpExp() - - Expression *Parser::parseAndExp() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - Expression *e = parseCmpExp(); - while (token.value == TOKand) -@@ -6698,14 +6990,14 @@ Expression *Parser::parseAndExp() - Expression *e2 = parseCmpExp(); - checkParens(TOKand, e2); - e = new AndExp(loc,e,e2); -- loc = this->loc; -+ loc = token.loc; - } - return e; - } - - Expression *Parser::parseXorExp() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - Expression *e = parseAndExp(); - while (token.value == TOKxor) -@@ -6721,7 +7013,7 @@ Expression *Parser::parseXorExp() - - Expression *Parser::parseOrExp() - { -- Loc loc = this->loc; -+ Loc loc = token.loc; - - Expression *e = parseXorExp(); - while (token.value == TOKor) -@@ -6736,9 +7028,10 @@ Expression *Parser::parseOrExp() - } - - Expression *Parser::parseAndAndExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseOrExp(); - while (token.value == TOKandand) -@@ -6751,9 +7044,10 @@ Expression *Parser::parseAndAndExp() - } - - Expression *Parser::parseOrOrExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseAndAndExp(); - while (token.value == TOKoror) -@@ -6766,10 +7060,11 @@ Expression *Parser::parseOrOrExp() - } - - Expression *Parser::parseCondExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e1; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - e = parseOrOrExp(); - if (token.value == TOKquestion) -@@ -6784,14 +7079,15 @@ Expression *Parser::parseCondExp() - } - - Expression *Parser::parseAssignExp() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; - Loc loc; - - e = parseCondExp(); - while (1) - { -- loc = this->loc; -+ loc = token.loc; - switch (token.value) - { - #define X(tok,ector) \ -@@ -6822,9 +7118,10 @@ Expression *Parser::parseAssignExp() - } - - Expression *Parser::parseExpression() --{ Expression *e; -+{ -+ Expression *e; - Expression *e2; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - //printf("Parser::parseExpression() loc = %d\n", loc.linnum); - e = parseAssignExp(); -@@ -6833,7 +7130,7 @@ Expression *Parser::parseExpression() - nextToken(); - e2 = parseAssignExp(); - e = new CommaExp(loc, e, e2); -- loc = this->loc; -+ loc = token.loc; - } - return e; - } -@@ -6848,7 +7145,7 @@ Expressions *Parser::parseArguments() - { // function call - Expressions *arguments; - Expression *arg; -- enum TOK endtok; -+ TOK endtok; - - arguments = new Expressions(); - if (token.value == TOKlbracket) -@@ -6875,11 +7172,12 @@ Expressions *Parser::parseArguments() - */ - - Expression *Parser::parseNewExp(Expression *thisexp) --{ Type *t; -+{ -+ Type *t; - Expressions *newargs; - Expressions *arguments = NULL; - Expression *e; -- Loc loc = this->loc; -+ Loc loc = token.loc; - - nextToken(); - newargs = NULL; -@@ -6961,7 +7259,7 @@ Expression *Parser::parseNewExp(Expressi - /********************************************** - */ - --void Parser::addComment(Dsymbol *s, unsigned char *blockComment) -+void Parser::addComment(Dsymbol *s, utf8_t *blockComment) - { - s->addComment(combineComments(blockComment, token.lineComment)); - token.lineComment = NULL; -@@ -6972,7 +7270,7 @@ void Parser::addComment(Dsymbol *s, unsi - * Set operator precedence for each operator. - */ - --enum PREC precedence[TOKMAX]; -+PREC precedence[TOKMAX]; - - void initPrecedence() - { -@@ -6997,9 +7295,13 @@ void initPrecedence() - precedence[TOKstring] = PREC_primary; - precedence[TOKarrayliteral] = PREC_primary; - precedence[TOKassocarrayliteral] = PREC_primary; -+ precedence[TOKclassreference] = PREC_primary; - #if DMDV2 - precedence[TOKfile] = PREC_primary; - precedence[TOKline] = PREC_primary; -+ precedence[TOKmodulestring] = PREC_primary; -+ precedence[TOKfuncstring] = PREC_primary; -+ precedence[TOKprettyfunc] = PREC_primary; - #endif - precedence[TOKtypeid] = PREC_primary; - precedence[TOKis] = PREC_primary; ---- a/src/gcc/d/dfrontend/parse.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/parse.h 2014-04-01 16:32:51.000000000 +0100 -@@ -19,32 +19,32 @@ - #include "lexer.h" - #include "enum.h" - --struct Type; --struct TypeQualified; --struct Expression; --struct Declaration; --struct Statement; --struct Import; --struct Initializer; --struct FuncDeclaration; --struct CtorDeclaration; --struct PostBlitDeclaration; --struct DtorDeclaration; --struct StaticCtorDeclaration; --struct StaticDtorDeclaration; --struct SharedStaticCtorDeclaration; --struct SharedStaticDtorDeclaration; --struct ConditionalDeclaration; --struct InvariantDeclaration; --struct UnitTestDeclaration; --struct NewDeclaration; --struct DeleteDeclaration; --struct Condition; --struct Module; -+class Type; -+class TypeQualified; -+class Expression; -+class Declaration; -+class Statement; -+class Import; -+class Initializer; -+class FuncDeclaration; -+class CtorDeclaration; -+class PostBlitDeclaration; -+class DtorDeclaration; -+class StaticCtorDeclaration; -+class StaticDtorDeclaration; -+class SharedStaticCtorDeclaration; -+class SharedStaticDtorDeclaration; -+class ConditionalDeclaration; -+class InvariantDeclaration; -+class UnitTestDeclaration; -+class NewDeclaration; -+class DeleteDeclaration; -+class Condition; -+class Module; - struct ModuleDeclaration; --struct TemplateDeclaration; --struct TemplateInstance; --struct StaticAssert; -+class TemplateDeclaration; -+class TemplateInstance; -+class StaticAssert; - - /************************************ - * These control how parseStatement() works. -@@ -60,20 +60,21 @@ enum ParseStatementFlags - }; - - --struct Parser : Lexer -+class Parser : public Lexer - { -+public: - ModuleDeclaration *md; -- enum LINK linkage; -+ LINK linkage; - Loc endloc; // set to location of last right curly - int inBrackets; // inside [] of array index or slice - Loc lookingForElse; // location of lonely if looking for an else - -- Parser(Module *module, unsigned char *base, size_t length, int doDocComment); -+ Parser(Module *module, utf8_t *base, size_t length, int doDocComment); - - Dsymbols *parseModule(); -- Dsymbols *parseDeclDefs(int once); -- Dsymbols *parseAutoDeclarations(StorageClass storageClass, unsigned char *comment); -- Dsymbols *parseBlock(); -+ Dsymbols *parseDeclDefs(int once, Dsymbol **pLastDecl = NULL); -+ Dsymbols *parseAutoDeclarations(StorageClass storageClass, utf8_t *comment); -+ Dsymbols *parseBlock(Dsymbol **pLastDecl); - void composeStorageClass(StorageClass stc); - StorageClass parseAttribute(Expressions **pexps); - StorageClass parsePostfix(); -@@ -88,7 +89,7 @@ struct Parser : Lexer - StaticAssert *parseStaticAssert(); - TypeQualified *parseTypeof(); - Type *parseVector(); -- enum LINK parseLinkage(); -+ LINK parseLinkage(); - Condition *parseDebugCondition(); - Condition *parseVersionCondition(); - Condition *parseStaticIfCondition(); -@@ -111,22 +112,23 @@ struct Parser : Lexer - Type *parseBasicType(); - Type *parseBasicType2(Type *t); - Type *parseDeclarator(Type *t, Identifier **pident, TemplateParameters **tpl = NULL, StorageClass storage_class = 0, int* pdisable = NULL); -- Dsymbols *parseDeclarations(StorageClass storage_class, unsigned char *comment); -+ Dsymbols *parseDeclarations(StorageClass storage_class, utf8_t *comment); - void parseContracts(FuncDeclaration *f); - void checkDanglingElse(Loc elseloc); -- Statement *parseStatement(int flags); -+ /** endPtr used for documented unittests */ -+ Statement *parseStatement(int flags, utf8_t** endPtr = NULL); - #ifdef IN_GCC - Statement *parseExtAsm(); - #endif - Initializer *parseInitializer(); - Expression *parseDefaultInitExp(); -- void check(Loc loc, enum TOK value); -- void check(enum TOK value); -- void check(enum TOK value, const char *string); -- void checkParens(enum TOK value, Expression *e); -- int isDeclaration(Token *t, int needId, enum TOK endtok, Token **pt); -+ void check(Loc loc, TOK value); -+ void check(TOK value); -+ void check(TOK value, const char *string); -+ void checkParens(TOK value, Expression *e); -+ int isDeclaration(Token *t, int needId, TOK endtok, Token **pt); - int isBasicType(Token **pt); -- int isDeclarator(Token **pt, int *haveId, enum TOK endtok); -+ int isDeclarator(Token **pt, int *haveId, int *haveTpl, TOK endtok); - int isParameters(Token **pt); - int isExpression(Token **pt); - int skipParens(Token *t, Token **pt); -@@ -156,7 +158,7 @@ struct Parser : Lexer - - Expression *parseNewExp(Expression *thisexp); - -- void addComment(Dsymbol *s, unsigned char *blockComment); -+ void addComment(Dsymbol *s, utf8_t *blockComment); - }; - - // Operator precedence - greater values are higher precedence -@@ -182,7 +184,7 @@ enum PREC - PREC_primary, - }; - --extern enum PREC precedence[TOKMAX]; -+extern PREC precedence[TOKMAX]; - - void initPrecedence(); - ---- a/src/gcc/d/dfrontend/port.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/port.h 2014-04-01 16:32:51.000000000 +0100 -@@ -10,37 +10,13 @@ - // Portable wrapper around compiler/system specific things. - // The idea is to minimize #ifdef's in the app code. - -+#include <stdlib.h> // for alloca - #include <stdint.h> - - #include "longdouble.h" - --// Be careful not to care about sign when using dinteger_t --//typedef uint64_t integer_t; --typedef uint64_t dinteger_t; // use this instead of integer_t to -- // avoid conflicts with system #include's -- --// Signed and unsigned variants --typedef int64_t sinteger_t; --typedef uint64_t uinteger_t; -- --typedef int8_t d_int8; --typedef uint8_t d_uns8; --typedef int16_t d_int16; --typedef uint16_t d_uns16; --typedef int32_t d_int32; --typedef uint32_t d_uns32; --typedef int64_t d_int64; --typedef uint64_t d_uns64; -- --typedef float d_float32; --typedef double d_float64; --typedef longdouble d_float80; -- --typedef d_uns8 d_char; --typedef d_uns16 d_wchar; --typedef d_uns32 d_dchar; -- - #if _MSC_VER -+#include <alloca.h> - typedef __int64 longlong; - typedef unsigned __int64 ulonglong; - #else -@@ -48,11 +24,14 @@ typedef long long longlong; - typedef unsigned long long ulonglong; - #endif - -+typedef unsigned char utf8_t; -+ - struct Port - { -- static longdouble nan; -+ static longdouble ldbl_nan; - static longdouble snan; -- static longdouble infinity; -+ static longdouble ldbl_infinity; -+ static longdouble ldbl_max; - - static void init(); - -@@ -61,11 +40,16 @@ struct Port - static int isInfinity(longdouble); - - static longdouble fmodl(longdouble x, longdouble y); -+ static int fequal(longdouble x, longdouble y); - - static char *strupr(char *); - - static int memicmp(const char *s1, const char *s2, int n); - static int stricmp(const char *s1, const char *s2); -+ -+ static longdouble strtof(const char *p, char **endp); -+ static longdouble strtod(const char *p, char **endp); -+ static longdouble strtold(const char *p, char **endp); - }; - - #endif ---- a/src/gcc/d/dfrontend/readme.txt 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/readme.txt 2014-04-01 16:32:51.000000000 +0100 -@@ -1,15 +1,15 @@ - - The D Programming Language - Compiler Front End Source -- Copyright (c) 1999-2009, by Digital Mars -- http://www.digitalmars.com -+ Copyright (c) 1999-2013, by Digital Mars -+ http://www.digitalmars.com/ - All Rights Reserved - - - This is the source code to the front end Digital Mars D compiler. - It covers the lexical analysis, parsing, and semantic analysis - of the D Programming Language defined in the documents at --http://www.digitalmars.com/d/ -+http://dlang.org/ - - These sources are free, they are redistributable and modifiable - under the terms of the GNU General Public License as published by ---- a/src/gcc/d/dfrontend/rmem.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/rmem.c 2014-04-01 16:32:51.000000000 +0100 -@@ -11,15 +11,7 @@ - #include <stdlib.h> - #include <string.h> - --#ifdef IN_GCC --#include "rmem.h" --#else --#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4 --#include "../root/rmem.h" --#else - #include "rmem.h" --#endif --#endif - - /* This implementation of the storage allocator uses the standard C allocation package. - */ -@@ -30,6 +22,23 @@ void Mem::init() - { - } - -+#ifdef IN_GCC -+void *mem_malloc(size_t size) -+{ -+ return mem.malloc(size); -+} -+ -+void *mem_realloc(void *p, size_t size) -+{ -+ return mem.realloc(p, size); -+} -+ -+void mem_free(void *p) -+{ -+ mem.free(p); -+} -+#endif -+ - char *Mem::strdup(const char *s) - { - char *p; -@@ -146,6 +155,61 @@ void Mem::addroots(char* pStart, char* p - - /* =================================================== */ - -+#if 1 -+ -+/* Allocate, but never release -+ */ -+ -+// Allocate a little less than 64kB because the C runtime adds some overhead that -+// causes the actual memory block to be larger than 64kB otherwise. E.g. the dmc -+// runtime rounds the size up to 128kB, but the remaining space in the chunk is less -+// than 64kB, so it cannot be used by another chunk. -+#define CHUNK_SIZE (4096 * 16 - 64) -+ -+static size_t heapleft = 0; -+static void *heapp; -+ -+void * operator new(size_t m_size) -+{ -+ // 16 byte alignment is better (and sometimes needed) for doubles -+ m_size = (m_size + 15) & ~15; -+ -+ // The layout of the code is selected so the most common case is straight through -+ if (m_size <= heapleft) -+ { -+ L1: -+ heapleft -= m_size; -+ void *p = heapp; -+ heapp = (void *)((char *)heapp + m_size); -+ return p; -+ } -+ -+ if (m_size > CHUNK_SIZE) -+ { -+ void *p = malloc(m_size); -+ if (p) -+ return p; -+ printf("Error: out of memory\n"); -+ exit(EXIT_FAILURE); -+ return p; -+ } -+ -+ heapleft = CHUNK_SIZE; -+ heapp = malloc(CHUNK_SIZE); -+ if (!heapp) -+ { -+ printf("Error: out of memory\n"); -+ exit(EXIT_FAILURE); -+ } -+ goto L1; -+} -+ -+void operator delete(void *p) -+{ -+} -+ -+#else -+ - void * operator new(size_t m_size) - { - void *p = malloc(m_size); -@@ -161,4 +225,4 @@ void operator delete(void *p) - free(p); - } - -- -+#endif ---- a/src/gcc/d/dfrontend/root.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/root.c 1970-01-01 01:00:00.000000000 +0100 -@@ -1,1972 +0,0 @@ -- --// Copyright (c) 1999-2012 by Digital Mars --// All Rights Reserved --// written by Walter Bright --// http://www.digitalmars.com --// License for redistribution is by either the Artistic License --// in artistic.txt, or the GNU General Public License in gnu.txt. --// See the included readme.txt for details. -- --#define POSIX (linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun) -- --#include <stdio.h> --#include <stdlib.h> --#include <stdarg.h> --#include <limits.h> --#include <string.h> --#include <stdint.h> --#include <assert.h> --#include <ctype.h> -- --#if defined (__sun) --#include <alloca.h> --#endif -- --#if _MSC_VER ||__MINGW32__ --#include <malloc.h> --#include <string> --#endif -- --#if _WIN32 --#include <windows.h> --#include <direct.h> --#include <errno.h> --#endif -- --#if POSIX --#include <sys/types.h> --#include <sys/stat.h> --#include <fcntl.h> --#include <errno.h> --#include <unistd.h> --#include <utime.h> --#endif -- --#include "port.h" --#include "root.h" --#include "rmem.h" -- --#if 0 //__SC__ //def DEBUG --extern "C" void __cdecl _assert(void *e, void *f, unsigned line) --{ -- printf("Assert('%s','%s',%d)\n",e,f,line); -- fflush(stdout); -- *(char *)0 = 0; --} --#endif -- --#ifdef IN_GCC --#include "config.h" --#include "errors.h" --#else --/************************************** -- * Print error message and exit. -- */ -- --void error(const char *format, ...) --{ -- va_list ap; -- -- va_start(ap, format); -- fprintf(stderr, "Error: "); -- vfprintf(stderr, format, ap); -- va_end( ap ); -- printf("\n"); -- fflush(stderr); -- -- exit(EXIT_FAILURE); --} -- --/************************************** -- * Print warning message. -- */ -- --void warning(const char *format, ...) --{ -- va_list ap; -- -- va_start(ap, format); -- fprintf(stderr, "Warning: "); -- vfprintf(stderr, format, ap); -- va_end( ap ); -- printf("\n"); -- fflush(stderr); --} --#endif -- --/****************************** Object ********************************/ -- --int Object::equals(Object *o) --{ -- return o == this; --} -- --hash_t Object::hashCode() --{ -- return (hash_t) this; --} -- --int Object::compare(Object *obj) --{ -- return this - obj; --} -- --void Object::print() --{ -- fprintf(stderr, "%s %p\n", toChars(), this); --} -- --char *Object::toChars() --{ -- return (char *)"Object"; --} -- --int Object::dyncast() --{ -- return 0; --} -- --void Object::toBuffer(OutBuffer *b) --{ -- b->writestring("Object"); --} -- --void Object::mark() --{ --} -- --/****************************** String ********************************/ -- --String::String(const char *str) -- : str(mem.strdup(str)) --{ --} -- --String::~String() --{ -- mem.free((void *)str); --} -- --void String::mark() --{ -- mem.mark((void *)str); --} -- --hash_t String::calcHash(const char *str, size_t len) --{ -- hash_t hash = 0; -- -- for (;;) -- { -- switch (len) -- { -- case 0: -- return hash; -- -- case 1: -- hash *= 37; -- hash += *(uint8_t *)str; -- return hash; -- -- case 2: -- hash *= 37; -- hash += *(uint16_t *)str; -- return hash; -- -- case 3: -- hash *= 37; -- hash += (*(uint16_t *)str << 8) + -- ((uint8_t *)str)[2]; -- return hash; -- -- default: -- hash *= 37; -- hash += *(uint32_t *)str; -- str += 4; -- len -= 4; -- break; -- } -- } --} -- --hash_t String::calcHash(const char *str) --{ -- return calcHash(str, strlen(str)); --} -- --hash_t String::hashCode() --{ -- return calcHash(str, strlen(str)); --} -- --size_t String::len() --{ -- return strlen(str); --} -- --int String::equals(Object *obj) --{ -- return strcmp(str,((String *)obj)->str) == 0; --} -- --int String::compare(Object *obj) --{ -- return strcmp(str,((String *)obj)->str); --} -- --char *String::toChars() --{ -- return (char *)str; // toChars() should really be const --} -- --void String::print() --{ -- fprintf(stderr, "String '%s'\n",str); --} -- -- --/****************************** FileName ********************************/ -- --FileName::FileName(const char *str) -- : String(str) --{ --} -- --const char *FileName::combine(const char *path, const char *name) --{ char *f; -- size_t pathlen; -- size_t namelen; -- -- if (!path || !*path) -- return (char *)name; -- pathlen = strlen(path); -- namelen = strlen(name); -- f = (char *)mem.malloc(pathlen + 1 + namelen + 1); -- memcpy(f, path, pathlen); --#if POSIX -- if (path[pathlen - 1] != '/') -- { f[pathlen] = '/'; -- pathlen++; -- } --#elif _WIN32 -- if (path[pathlen - 1] != '\\' && -- path[pathlen - 1] != '/' && -- path[pathlen - 1] != ':') -- { f[pathlen] = '\\'; -- pathlen++; -- } --#else -- assert(0); --#endif -- memcpy(f + pathlen, name, namelen + 1); -- return f; --} -- --// Split a path into an Array of paths --Strings *FileName::splitPath(const char *path) --{ -- char c = 0; // unnecessary initializer is for VC /W4 -- const char *p; -- OutBuffer buf; -- Strings *array; -- -- array = new Strings(); -- if (path) -- { -- p = path; -- do -- { char instring = 0; -- -- while (isspace((unsigned char)*p)) // skip leading whitespace -- p++; -- buf.reserve(strlen(p) + 1); // guess size of path -- for (; ; p++) -- { -- c = *p; -- switch (c) -- { -- case '"': -- instring ^= 1; // toggle inside/outside of string -- continue; -- --#if MACINTOSH -- case ',': --#endif --#if _WIN32 -- case ';': --#endif --#if POSIX -- case ':': --#endif -- p++; -- break; // note that ; cannot appear as part -- // of a path, quotes won't protect it -- -- case 0x1A: // ^Z means end of file -- case 0: -- break; -- -- case '\r': -- continue; // ignore carriage returns -- --#if POSIX -- case '~': -- buf.writestring(getenv("HOME")); -- continue; --#endif -- --#if 0 -- case ' ': -- case '\t': // tabs in filenames? -- if (!instring) // if not in string -- break; // treat as end of path --#endif -- default: -- buf.writeByte(c); -- continue; -- } -- break; -- } -- if (buf.offset) // if path is not empty -- { -- buf.writeByte(0); // to asciiz -- array->push(buf.extractData()); -- } -- } while (c); -- } -- return array; --} -- --hash_t FileName::hashCode() --{ --#if _WIN32 -- // We need a different hashCode because it must be case-insensitive -- size_t len = strlen(str); -- hash_t hash = 0; -- unsigned char *s = (unsigned char *)str; -- -- for (;;) -- { -- switch (len) -- { -- case 0: -- return hash; -- -- case 1: -- hash *= 37; -- hash += *(uint8_t *)s | 0x20; -- return hash; -- -- case 2: -- hash *= 37; -- hash += *(uint16_t *)s | 0x2020; -- return hash; -- -- case 3: -- hash *= 37; -- hash += ((*(uint16_t *)s << 8) + -- ((uint8_t *)s)[2]) | 0x202020; -- break; -- -- default: -- hash *= 37; -- hash += *(uint32_t *)s | 0x20202020; -- s += 4; -- len -= 4; -- break; -- } -- } --#else -- // darwin HFS is case insensitive, though... -- return String::hashCode(); --#endif --} -- --int FileName::compare(Object *obj) --{ -- return compare(str, ((FileName *)obj)->str); --} -- --int FileName::compare(const char *name1, const char *name2) --{ --#if _WIN32 -- return stricmp(name1, name2); --#else -- return strcmp(name1, name2); --#endif --} -- --int FileName::equals(Object *obj) --{ -- return compare(obj) == 0; --} -- --int FileName::equals(const char *name1, const char *name2) --{ -- return compare(name1, name2) == 0; --} -- --/************************************ -- * Return !=0 if absolute path name. -- */ -- --int FileName::absolute(const char *name) --{ --#if _WIN32 -- return (*name == '\\') || -- (*name == '/') || -- (*name && name[1] == ':'); --#elif POSIX -- return (*name == '/'); --#else -- assert(0); --#endif --} -- --/******************************** -- * Return filename extension (read-only). -- * Points past '.' of extension. -- * If there isn't one, return NULL. -- */ -- --const char *FileName::ext(const char *str) --{ -- size_t len = strlen(str); -- -- const char *e = str + len; -- for (;;) -- { -- switch (*e) -- { case '.': -- return e + 1; --#if POSIX -- case '/': -- break; --#endif --#if _WIN32 -- case '\\': -- case ':': -- case '/': -- break; --#endif -- default: -- if (e == str) -- break; -- e--; -- continue; -- } -- return NULL; -- } --} -- --const char *FileName::ext() --{ -- return ext(str); --} -- --/******************************** -- * Return mem.malloc'd filename with extension removed. -- */ -- --const char *FileName::removeExt(const char *str) --{ -- const char *e = ext(str); -- if (e) -- { size_t len = (e - str) - 1; -- char *n = (char *)mem.malloc(len + 1); -- memcpy(n, str, len); -- n[len] = 0; -- return n; -- } -- return mem.strdup(str); --} -- --/******************************** -- * Return filename name excluding path (read-only). -- */ -- --const char *FileName::name(const char *str) --{ -- size_t len = strlen(str); -- -- const char *e = str + len; -- for (;;) -- { -- switch (*e) -- { --#if POSIX -- case '/': -- return e + 1; --#endif --#if _WIN32 -- case '/': -- case '\\': -- return e + 1; -- case ':': -- /* The ':' is a drive letter only if it is the second -- * character or the last character, -- * otherwise it is an ADS (Alternate Data Stream) separator. -- * Consider ADS separators as part of the file name. -- */ -- if (e == str + 1 || e == str + len - 1) -- return e + 1; --#endif -- default: -- if (e == str) -- break; -- e--; -- continue; -- } -- return e; -- } --} -- --const char *FileName::name() --{ -- return name(str); --} -- --/************************************** -- * Return path portion of str. -- * Path will does not include trailing path separator. -- */ -- --const char *FileName::path(const char *str) --{ -- const char *n = name(str); -- size_t pathlen; -- -- if (n > str) -- { --#if POSIX -- if (n[-1] == '/') -- n--; --#elif _WIN32 -- if (n[-1] == '\\' || n[-1] == '/') -- n--; --#else -- assert(0); --#endif -- } -- pathlen = n - str; -- char *path = (char *)mem.malloc(pathlen + 1); -- memcpy(path, str, pathlen); -- path[pathlen] = 0; -- return path; --} -- --/************************************** -- * Replace filename portion of path. -- */ -- --const char *FileName::replaceName(const char *path, const char *name) --{ -- size_t pathlen; -- size_t namelen; -- -- if (absolute(name)) -- return name; -- -- const char *n = FileName::name(path); -- if (n == path) -- return name; -- pathlen = n - path; -- namelen = strlen(name); -- char *f = (char *)mem.malloc(pathlen + 1 + namelen + 1); -- memcpy(f, path, pathlen); --#if POSIX -- if (path[pathlen - 1] != '/') -- { f[pathlen] = '/'; -- pathlen++; -- } --#elif _WIN32 -- if (path[pathlen - 1] != '\\' && -- path[pathlen - 1] != '/' && -- path[pathlen - 1] != ':') -- { f[pathlen] = '\\'; -- pathlen++; -- } --#else -- assert(0); --#endif -- memcpy(f + pathlen, name, namelen + 1); -- return f; --} -- --/*************************** -- * Free returned value with FileName::free() -- */ -- --const char *FileName::defaultExt(const char *name, const char *ext) --{ -- const char *e = FileName::ext(name); -- if (e) // if already has an extension -- return mem.strdup(name); -- -- size_t len = strlen(name); -- size_t extlen = strlen(ext); -- char *s = (char *)mem.malloc(len + 1 + extlen + 1); -- memcpy(s,name,len); -- s[len] = '.'; -- memcpy(s + len + 1, ext, extlen + 1); -- return s; --} -- --/*************************** -- * Free returned value with FileName::free() -- */ -- --const char *FileName::forceExt(const char *name, const char *ext) --{ -- const char *e = FileName::ext(name); -- if (e) // if already has an extension -- { -- size_t len = e - name; -- size_t extlen = strlen(ext); -- -- char *s = (char *)mem.malloc(len + extlen + 1); -- memcpy(s,name,len); -- memcpy(s + len, ext, extlen + 1); -- return s; -- } -- else -- return defaultExt(name, ext); // doesn't have one --} -- --/****************************** -- * Return !=0 if extensions match. -- */ -- --int FileName::equalsExt(const char *ext) --{ -- return equalsExt(str, ext); --} -- --int FileName::equalsExt(const char *name, const char *ext) --{ -- const char *e = FileName::ext(name); -- if (!e && !ext) -- return 1; -- if (!e || !ext) -- return 0; -- return FileName::compare(e, ext) == 0; --} -- --/************************************* -- * Copy file from this to to. -- */ -- --void FileName::CopyTo(FileName *to) --{ -- File file(this); -- --#if _WIN32 -- file.touchtime = mem.malloc(sizeof(WIN32_FIND_DATAA)); // keep same file time --#elif POSIX -- file.touchtime = mem.malloc(sizeof(struct stat)); // keep same file time --#else -- assert(0); --#endif -- file.readv(); -- file.name = to; -- file.writev(); --} -- --/************************************* -- * Search Path for file. -- * Input: -- * cwd if !=0, search current directory before searching path -- */ -- --const char *FileName::searchPath(Strings *path, const char *name, int cwd) --{ -- if (absolute(name)) -- { -- return exists(name) ? name : NULL; -- } -- if (cwd) -- { -- if (exists(name)) -- return name; -- } -- if (path) -- { -- -- for (size_t i = 0; i < path->dim; i++) -- { -- const char *p = path->tdata()[i]; -- const char *n = combine(p, name); -- -- if (exists(n)) -- return n; -- } -- } -- return NULL; --} -- -- --/************************************* -- * Search Path for file in a safe manner. -- * -- * Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory -- * ('Path Traversal') attacks. -- * http://cwe.mitre.org/data/definitions/22.html -- * More info: -- * https://www.securecoding.cert.org/confluence/display/seccode/FIO02-C.+Canonicalize+path+names+originating+from+untrusted+sources -- * Returns: -- * NULL file not found -- * !=NULL mem.malloc'd file name -- */ -- --const char *FileName::safeSearchPath(Strings *path, const char *name) --{ --#if _WIN32 -- /* Disallow % / \ : and .. in name characters -- */ -- for (const char *p = name; *p; p++) -- { -- char c = *p; -- if (c == '\\' || c == '/' || c == ':' || c == '%' || -- (c == '.' && p[1] == '.')) -- { -- return NULL; -- } -- } -- -- return FileName::searchPath(path, name, 0); --#elif POSIX -- /* Even with realpath(), we must check for // and disallow it -- */ -- for (const char *p = name; *p; p++) -- { -- char c = *p; -- if (c == '/' && p[1] == '/') -- { -- return NULL; -- } -- } -- -- if (path) -- { -- /* Each path is converted to a cannonical name and then a check is done to see -- * that the searched name is really a child one of the the paths searched. -- */ -- for (size_t i = 0; i < path->dim; i++) -- { -- const char *cname = NULL; -- const char *cpath = canonicalName(path->tdata()[i]); -- //printf("FileName::safeSearchPath(): name=%s; path=%s; cpath=%s\n", -- // name, (char *)path->data[i], cpath); -- if (cpath == NULL) -- goto cont; -- cname = canonicalName(combine(cpath, name)); -- //printf("FileName::safeSearchPath(): cname=%s\n", cname); -- if (cname == NULL) -- goto cont; -- //printf("FileName::safeSearchPath(): exists=%i " -- // "strncmp(cpath, cname, %i)=%i\n", exists(cname), -- // strlen(cpath), strncmp(cpath, cname, strlen(cpath))); -- // exists and name is *really* a "child" of path -- if (exists(cname) && strncmp(cpath, cname, strlen(cpath)) == 0) -- { -- ::free((void *)cpath); -- const char *p = mem.strdup(cname); -- ::free((void *)cname); -- return p; -- } --cont: -- if (cpath) -- ::free((void *)cpath); -- if (cname) -- ::free((void *)cname); -- } -- } -- return NULL; --#else -- assert(0); --#endif --} -- -- --int FileName::exists(const char *name) --{ --#if POSIX -- struct stat st; -- -- if (stat(name, &st) < 0) -- return 0; -- if (S_ISDIR(st.st_mode)) -- return 2; -- return 1; --#elif _WIN32 -- DWORD dw; -- int result; -- -- dw = GetFileAttributesA(name); -- if (dw == -1L) -- result = 0; -- else if (dw & FILE_ATTRIBUTE_DIRECTORY) -- result = 2; -- else -- result = 1; -- return result; --#else -- assert(0); --#endif --} -- --void FileName::ensurePathExists(const char *path) --{ -- //printf("FileName::ensurePathExists(%s)\n", path ? path : ""); -- if (path && *path) -- { -- if (!exists(path)) -- { -- const char *p = FileName::path(path); -- if (*p) -- { --#if _WIN32 -- size_t len = strlen(path); -- if (len > 2 && p[-1] == ':' && path + 2 == p) -- { mem.free((void *)p); -- return; -- } --#endif -- ensurePathExists(p); -- mem.free((void *)p); -- } --#if _WIN32 -- if (path[strlen(path) - 1] != '\\') --#endif --#if POSIX -- if (path[strlen(path) - 1] != '\\') --#endif -- { -- //printf("mkdir(%s)\n", path); --#if _WIN32 -- if (_mkdir(path)) --#endif --#if POSIX -- if (mkdir(path, 0777)) --#endif -- { -- /* Don't error out if another instance of dmd just created -- * this directory -- */ -- if (errno != EEXIST) -- error("cannot create directory %s", path); -- } -- } -- } -- } --} -- --void FileName::ensurePathToNameExists(const char *name) --{ -- const char *pt = path(name); -- if (*pt) -- ensurePathExists(pt); -- free(pt); --} -- -- --/****************************************** -- * Return canonical version of name in a malloc'd buffer. -- * This code is high risk. -- */ --const char *FileName::canonicalName(const char *name) --{ --#if linux -- // Lovely glibc extension to do it for us -- return canonicalize_file_name(name); --#elif POSIX -- #if _POSIX_VERSION >= 200809L || defined (linux) -- // NULL destination buffer is allowed and preferred -- return realpath(name, NULL); -- #else -- char *cname = NULL; -- #if PATH_MAX -- /* PATH_MAX must be defined as a constant in <limits.h>, -- * otherwise using it is unsafe due to TOCTOU -- */ -- size_t path_max = (size_t)PATH_MAX; -- if (path_max > 0) -- { -- /* Need to add one to PATH_MAX because of realpath() buffer overflow bug: -- * http://isec.pl/vulnerabilities/isec-0011-wu-ftpd.txt -- */ -- cname = (char *)malloc(path_max + 1); -- if (cname == NULL) -- return NULL; -- } -- #endif -- return realpath(name, cname); -- #endif --#elif _WIN32 -- /* Apparently, there is no good way to do this on Windows. -- * GetFullPathName isn't it, but use it anyway. -- */ -- DWORD result = GetFullPathName(name, 0, NULL, NULL); -- if (result) -- { -- char *buf = (char *)malloc(result); -- result = GetFullPathName(name, result, buf, NULL); -- if (result == 0) -- { -- ::free(buf); -- return NULL; -- } -- return buf; -- } -- return NULL; --#else -- assert(0); -- return NULL; --#endif --} -- --/******************************** -- * Free memory allocated by FileName routines -- */ --void FileName::free(const char *str) --{ -- if (str) -- { assert(str[0] != 0xAB); -- memset((void *)str, 0xAB, strlen(str) + 1); // stomp -- } -- mem.free((void *)str); --} -- -- --/****************************** File ********************************/ -- --File::File(const FileName *n) --{ -- ref = 0; -- buffer = NULL; -- len = 0; -- touchtime = NULL; -- name = (FileName *)n; --} -- --File::File(const char *n) --{ -- ref = 0; -- buffer = NULL; -- len = 0; -- touchtime = NULL; -- name = new FileName(n); --} -- --File::~File() --{ -- if (buffer) -- { -- if (ref == 0) -- mem.free(buffer); --#if _WIN32 -- else if (ref == 2) -- UnmapViewOfFile(buffer); --#endif -- } -- if (touchtime) -- mem.free(touchtime); --} -- --void File::mark() --{ -- mem.mark(buffer); -- mem.mark(touchtime); -- mem.mark(name); --} -- --/************************************* -- */ -- --int File::read() --{ --#if POSIX -- off_t size; -- ssize_t numread; -- int fd; -- struct stat buf; -- int result = 0; -- char *name; -- -- name = this->name->toChars(); -- //printf("File::read('%s')\n",name); -- fd = open(name, O_RDONLY); -- if (fd == -1) -- { -- //printf("\topen error, errno = %d\n",errno); -- goto err1; -- } -- -- if (!ref) -- ::free(buffer); -- ref = 0; // we own the buffer now -- -- //printf("\tfile opened\n"); -- if (fstat(fd, &buf)) -- { -- fprintf(stderr, "\tfstat error, errno = %d\n",errno); -- goto err2; -- } -- size = buf.st_size; -- buffer = (unsigned char *) ::malloc(size + 2); -- if (!buffer) -- { -- fprintf(stderr, "\tmalloc error, errno = %d\n",errno); -- goto err2; -- } -- -- numread = ::read(fd, buffer, size); -- if (numread != size) -- { -- fprintf(stderr, "\tread error, errno = %d\n",errno); -- goto err2; -- } -- -- if (touchtime) -- memcpy(touchtime, &buf, sizeof(buf)); -- -- if (close(fd) == -1) -- { -- fprintf(stderr, "\tclose error, errno = %d\n",errno); -- goto err; -- } -- -- len = size; -- -- // Always store a wchar ^Z past end of buffer so scanner has a sentinel -- buffer[size] = 0; // ^Z is obsolete, use 0 -- buffer[size + 1] = 0; -- return 0; -- --err2: -- close(fd); --err: -- ::free(buffer); -- buffer = NULL; -- len = 0; -- --err1: -- result = 1; -- return result; --#elif _WIN32 -- DWORD size; -- DWORD numread; -- HANDLE h; -- int result = 0; -- char *name; -- -- name = this->name->toChars(); -- h = CreateFileA(name,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING, -- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,0); -- if (h == INVALID_HANDLE_VALUE) -- goto err1; -- -- if (!ref) -- ::free(buffer); -- ref = 0; -- -- size = GetFileSize(h,NULL); -- buffer = (unsigned char *) ::malloc(size + 2); -- if (!buffer) -- goto err2; -- -- if (ReadFile(h,buffer,size,&numread,NULL) != TRUE) -- goto err2; -- -- if (numread != size) -- goto err2; -- -- if (touchtime) -- { -- if (!GetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime)) -- goto err2; -- } -- -- if (!CloseHandle(h)) -- goto err; -- -- len = size; -- -- // Always store a wchar ^Z past end of buffer so scanner has a sentinel -- buffer[size] = 0; // ^Z is obsolete, use 0 -- buffer[size + 1] = 0; -- return 0; -- --err2: -- CloseHandle(h); --err: -- ::free(buffer); -- buffer = NULL; -- len = 0; -- --err1: -- result = 1; -- return result; --#else -- assert(0); --#endif --} -- --/***************************** -- * Read a file with memory mapped file I/O. -- */ -- --int File::mmread() --{ --#if POSIX -- return read(); --#elif _WIN32 -- HANDLE hFile; -- HANDLE hFileMap; -- DWORD size; -- char *name; -- -- name = this->name->toChars(); -- hFile = CreateFile(name, GENERIC_READ, -- FILE_SHARE_READ, NULL, -- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); -- if (hFile == INVALID_HANDLE_VALUE) -- goto Lerr; -- size = GetFileSize(hFile, NULL); -- //printf(" file created, size %d\n", size); -- -- hFileMap = CreateFileMapping(hFile,NULL,PAGE_READONLY,0,size,NULL); -- if (CloseHandle(hFile) != TRUE) -- goto Lerr; -- -- if (hFileMap == NULL) -- goto Lerr; -- -- //printf(" mapping created\n"); -- -- if (!ref) -- mem.free(buffer); -- ref = 2; -- buffer = (unsigned char *)MapViewOfFileEx(hFileMap, FILE_MAP_READ,0,0,size,NULL); -- if (CloseHandle(hFileMap) != TRUE) -- goto Lerr; -- if (buffer == NULL) // mapping view failed -- goto Lerr; -- -- len = size; -- //printf(" buffer = %p\n", buffer); -- -- return 0; -- --Lerr: -- return GetLastError(); // failure --#else -- assert(0); --#endif --} -- --/********************************************* -- * Write a file. -- * Returns: -- * 0 success -- */ -- --int File::write() --{ --#if POSIX -- int fd; -- ssize_t numwritten; -- char *name; -- -- name = this->name->toChars(); -- fd = open(name, O_CREAT | O_WRONLY | O_TRUNC, 0644); -- if (fd == -1) -- goto err; -- -- numwritten = ::write(fd, buffer, len); -- if (len != numwritten) -- goto err2; -- -- if (close(fd) == -1) -- goto err; -- -- if (touchtime) -- { struct utimbuf ubuf; -- -- ubuf.actime = ((struct stat *)touchtime)->st_atime; -- ubuf.modtime = ((struct stat *)touchtime)->st_mtime; -- if (utime(name, &ubuf)) -- goto err; -- } -- return 0; -- --err2: -- close(fd); -- ::remove(name); --err: -- return 1; --#elif _WIN32 -- HANDLE h; -- DWORD numwritten; -- char *name; -- -- name = this->name->toChars(); -- h = CreateFileA(name,GENERIC_WRITE,0,NULL,CREATE_ALWAYS, -- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL); -- if (h == INVALID_HANDLE_VALUE) -- goto err; -- -- if (WriteFile(h,buffer,len,&numwritten,NULL) != TRUE) -- goto err2; -- -- if (len != numwritten) -- goto err2; -- -- if (touchtime) { -- SetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime); -- } -- if (!CloseHandle(h)) -- goto err; -- return 0; -- --err2: -- CloseHandle(h); -- DeleteFileA(name); --err: -- return 1; --#else -- assert(0); --#endif --} -- --/********************************************* -- * Append to a file. -- * Returns: -- * 0 success -- */ -- --int File::append() --{ --#if POSIX -- return 1; --#elif _WIN32 -- HANDLE h; -- DWORD numwritten; -- char *name; -- -- name = this->name->toChars(); -- h = CreateFileA(name,GENERIC_WRITE,0,NULL,OPEN_ALWAYS, -- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,NULL); -- if (h == INVALID_HANDLE_VALUE) -- goto err; -- --#if 1 -- SetFilePointer(h, 0, NULL, FILE_END); --#else // INVALID_SET_FILE_POINTER doesn't seem to have a definition -- if (SetFilePointer(h, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) -- goto err; --#endif -- -- if (WriteFile(h,buffer,len,&numwritten,NULL) != TRUE) -- goto err2; -- -- if (len != numwritten) -- goto err2; -- -- if (touchtime) { -- SetFileTime(h, NULL, NULL, &((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime); -- } -- if (!CloseHandle(h)) -- goto err; -- return 0; -- --err2: -- CloseHandle(h); --err: -- return 1; --#else -- assert(0); --#endif --} -- --/************************************** -- */ -- --void File::readv() --{ -- if (read()) -- error("Error reading file '%s'",name->toChars()); --} -- --/************************************** -- */ -- --void File::mmreadv() --{ -- if (mmread()) -- readv(); --} -- --void File::writev() --{ -- if (write()) -- error("Error writing file '%s'",name->toChars()); --} -- --void File::appendv() --{ -- if (write()) -- error("Error appending to file '%s'",name->toChars()); --} -- --/******************************************* -- * Return !=0 if file exists. -- * 0: file doesn't exist -- * 1: normal file -- * 2: directory -- */ -- --int File::exists() --{ --#if POSIX -- return 0; --#elif _WIN32 -- DWORD dw; -- int result; -- char *name; -- -- name = this->name->toChars(); -- if (touchtime) -- dw = ((WIN32_FIND_DATAA *)touchtime)->dwFileAttributes; -- else -- dw = GetFileAttributesA(name); -- if (dw == -1L) -- result = 0; -- else if (dw & FILE_ATTRIBUTE_DIRECTORY) -- result = 2; -- else -- result = 1; -- return result; --#else -- assert(0); --#endif --} -- --void File::remove() --{ --#if POSIX -- ::remove(this->name->toChars()); --#elif _WIN32 -- DeleteFileA(this->name->toChars()); --#else -- assert(0); --#endif --} -- --Files *File::match(char *n) --{ -- return match(new FileName(n)); --} -- --Files *File::match(FileName *n) --{ --#if POSIX -- return NULL; --#elif _WIN32 -- HANDLE h; -- WIN32_FIND_DATAA fileinfo; -- -- Files *a = new Files(); -- const char *c = n->toChars(); -- const char *name = n->name(); -- h = FindFirstFileA(c,&fileinfo); -- if (h != INVALID_HANDLE_VALUE) -- { -- do -- { -- // Glue path together with name -- char *fn; -- File *f; -- -- fn = (char *)mem.malloc(name - c + strlen(fileinfo.cFileName) + 1); -- memcpy(fn, c, name - c); -- strcpy(fn + (name - c), fileinfo.cFileName); -- f = new File(fn); -- f->touchtime = mem.malloc(sizeof(WIN32_FIND_DATAA)); -- memcpy(f->touchtime, &fileinfo, sizeof(fileinfo)); -- a->push(f); -- } while (FindNextFileA(h,&fileinfo) != FALSE); -- FindClose(h); -- } -- return a; --#else -- assert(0); --#endif --} -- --int File::compareTime(File *f) --{ --#if POSIX -- return 0; --#elif _WIN32 -- if (!touchtime) -- stat(); -- if (!f->touchtime) -- f->stat(); -- return CompareFileTime(&((WIN32_FIND_DATAA *)touchtime)->ftLastWriteTime, &((WIN32_FIND_DATAA *)f->touchtime)->ftLastWriteTime); --#else -- assert(0); --#endif --} -- --void File::stat() --{ --#if POSIX -- if (!touchtime) -- { -- touchtime = mem.calloc(1, sizeof(struct stat)); -- } --#elif _WIN32 -- HANDLE h; -- -- if (!touchtime) -- { -- touchtime = mem.calloc(1, sizeof(WIN32_FIND_DATAA)); -- } -- h = FindFirstFileA(name->toChars(),(WIN32_FIND_DATAA *)touchtime); -- if (h != INVALID_HANDLE_VALUE) -- { -- FindClose(h); -- } --#else -- assert(0); --#endif --} -- --void File::checkoffset(size_t offset, size_t nbytes) --{ -- if (offset > len || offset + nbytes > len) -- error("Corrupt file '%s': offset x%llx off end of file",toChars(),(ulonglong)offset); --} -- --char *File::toChars() --{ -- return name->toChars(); --} -- -- --/************************* OutBuffer *************************/ -- --OutBuffer::OutBuffer() --{ -- data = NULL; -- offset = 0; -- size = 0; -- -- doindent = 0; -- level = 0; -- linehead = 1; --} -- --OutBuffer::~OutBuffer() --{ -- mem.free(data); --} -- --char *OutBuffer::extractData() --{ -- char *p; -- -- p = (char *)data; -- data = NULL; -- offset = 0; -- size = 0; -- return p; --} -- --void OutBuffer::mark() --{ -- mem.mark(data); --} -- --void OutBuffer::reserve(size_t nbytes) --{ -- //printf("OutBuffer::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes); -- if (size - offset < nbytes) -- { -- size = (offset + nbytes) * 2; -- data = (unsigned char *)mem.realloc(data, size); -- } --} -- --void OutBuffer::reset() --{ -- offset = 0; --} -- --void OutBuffer::setsize(size_t size) --{ -- offset = size; --} -- --void OutBuffer::write(const void *data, size_t nbytes) --{ -- if (doindent && linehead) -- { -- if (level) -- { -- reserve(level); -- for (size_t i=0; i<level; i++) -- { -- this->data[offset] = '\t'; -- offset++; -- } -- } -- linehead = 0; -- } -- reserve(nbytes); -- memcpy(this->data + offset, data, nbytes); -- offset += nbytes; --} -- --void OutBuffer::writebstring(unsigned char *string) --{ -- write(string,*string + 1); --} -- --void OutBuffer::writestring(const char *string) --{ -- write(string,strlen(string)); --} -- --void OutBuffer::prependstring(const char *string) --{ -- size_t len = strlen(string); -- reserve(len); -- memmove(data + len, data, offset); -- memcpy(data, string, len); -- offset += len; --} -- --void OutBuffer::writenl() --{ --#if _WIN32 -- writeword(0x0A0D); // newline is CR,LF on Microsoft OS's --#else -- writeByte('\n'); --#endif -- if (doindent) -- linehead = 1; --} -- --void OutBuffer::writeByte(unsigned b) --{ -- if (doindent && linehead -- && b != '\n') -- { -- if (level) -- { -- reserve(level); -- for (size_t i=0; i<level; i++) -- { -- this->data[offset] = '\t'; -- offset++; -- } -- } -- linehead = 0; -- } -- reserve(1); -- this->data[offset] = (unsigned char)b; -- offset++; --} -- --void OutBuffer::writeUTF8(unsigned b) --{ -- reserve(6); -- if (b <= 0x7F) -- { -- this->data[offset] = (unsigned char)b; -- offset++; -- } -- else if (b <= 0x7FF) -- { -- this->data[offset + 0] = (unsigned char)((b >> 6) | 0xC0); -- this->data[offset + 1] = (unsigned char)((b & 0x3F) | 0x80); -- offset += 2; -- } -- else if (b <= 0xFFFF) -- { -- this->data[offset + 0] = (unsigned char)((b >> 12) | 0xE0); -- this->data[offset + 1] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -- this->data[offset + 2] = (unsigned char)((b & 0x3F) | 0x80); -- offset += 3; -- } -- else if (b <= 0x1FFFFF) -- { -- this->data[offset + 0] = (unsigned char)((b >> 18) | 0xF0); -- this->data[offset + 1] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -- this->data[offset + 2] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -- this->data[offset + 3] = (unsigned char)((b & 0x3F) | 0x80); -- offset += 4; -- } -- else if (b <= 0x3FFFFFF) -- { -- this->data[offset + 0] = (unsigned char)((b >> 24) | 0xF8); -- this->data[offset + 1] = (unsigned char)(((b >> 18) & 0x3F) | 0x80); -- this->data[offset + 2] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -- this->data[offset + 3] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -- this->data[offset + 4] = (unsigned char)((b & 0x3F) | 0x80); -- offset += 5; -- } -- else if (b <= 0x7FFFFFFF) -- { -- this->data[offset + 0] = (unsigned char)((b >> 30) | 0xFC); -- this->data[offset + 1] = (unsigned char)(((b >> 24) & 0x3F) | 0x80); -- this->data[offset + 2] = (unsigned char)(((b >> 18) & 0x3F) | 0x80); -- this->data[offset + 3] = (unsigned char)(((b >> 12) & 0x3F) | 0x80); -- this->data[offset + 4] = (unsigned char)(((b >> 6) & 0x3F) | 0x80); -- this->data[offset + 5] = (unsigned char)((b & 0x3F) | 0x80); -- offset += 6; -- } -- else -- assert(0); --} -- --void OutBuffer::prependbyte(unsigned b) --{ -- reserve(1); -- memmove(data + 1, data, offset); -- data[0] = (unsigned char)b; -- offset++; --} -- --void OutBuffer::writeword(unsigned w) --{ -- if (doindent && linehead --#if _WIN32 -- && w != 0x0A0D) --#else -- && w != '\n') --#endif -- { -- if (level) -- { -- reserve(level); -- for (size_t i=0; i<level; i++) -- { -- this->data[offset] = '\t'; -- offset++; -- } -- } -- linehead = 0; -- } -- reserve(2); -- *(unsigned short *)(this->data + offset) = (unsigned short)w; -- offset += 2; --} -- --void OutBuffer::writeUTF16(unsigned w) --{ -- reserve(4); -- if (w <= 0xFFFF) -- { -- *(unsigned short *)(this->data + offset) = (unsigned short)w; -- offset += 2; -- } -- else if (w <= 0x10FFFF) -- { -- *(unsigned short *)(this->data + offset) = (unsigned short)((w >> 10) + 0xD7C0); -- *(unsigned short *)(this->data + offset + 2) = (unsigned short)((w & 0x3FF) | 0xDC00); -- offset += 4; -- } -- else -- assert(0); --} -- --void OutBuffer::write4(unsigned w) --{ -- if (doindent && linehead --#if _WIN32 -- && w != 0x000A000D) --#else -- ) --#endif -- { -- if (level) -- { -- reserve(level); -- for (size_t i=0; i<level; i++) -- { -- this->data[offset] = '\t'; -- offset++; -- } -- } -- linehead = 0; -- } -- reserve(4); -- *(unsigned *)(this->data + offset) = w; -- offset += 4; --} -- --void OutBuffer::write(OutBuffer *buf) --{ -- if (buf) -- { reserve(buf->offset); -- memcpy(data + offset, buf->data, buf->offset); -- offset += buf->offset; -- } --} -- --void OutBuffer::write(Object *obj) --{ -- if (obj) -- { -- writestring(obj->toChars()); -- } --} -- --void OutBuffer::fill0(size_t nbytes) --{ -- reserve(nbytes); -- memset(data + offset,0,nbytes); -- offset += nbytes; --} -- --void OutBuffer::align(size_t size) --{ -- size_t nbytes = ((offset + size - 1) & ~(size - 1)) - offset; -- fill0(nbytes); --} -- -- --//////////////////////////////////////////////////////////////// --// The compiler shipped with Visual Studio 2005 (and possible --// other versions) does not support C99 printf format specfiers --// such as %z and %j --#if 0 && _MSC_VER --using std::string; --using std::wstring; -- --template<typename S> --inline void --search_and_replace(S& str, const S& what, const S& replacement) --{ -- assert(!what.empty()); -- size_t pos = str.find(what); -- while (pos != S::npos) -- { -- str.replace(pos, what.size(), replacement); -- pos = str.find(what, pos + replacement.size()); -- } --} --#define WORKAROUND_C99_SPECIFIERS_BUG(S,tmp,f) \ -- S tmp = f; \ -- search_and_replace(fmt, S("%z"), S("%l")); \ -- search_and_replace(fmt, S("%j"), S("%l")); \ -- f = tmp.c_str(); --#else --#define WORKAROUND_C99_SPECIFIERS_BUG(S,tmp,f) --#endif -- --void OutBuffer::vprintf(const char *format, va_list args) --{ -- char buffer[128]; -- char *p; -- unsigned psize; -- int count; -- -- WORKAROUND_C99_SPECIFIERS_BUG(string, fmt, format); -- -- p = buffer; -- psize = sizeof(buffer); -- for (;;) -- { --#if _WIN32 -- count = _vsnprintf(p,psize,format,args); -- if (count != -1) -- break; -- psize *= 2; --#elif POSIX -- va_list va; -- va_copy(va, args); --/* -- The functions vprintf(), vfprintf(), vsprintf(), vsnprintf() -- are equivalent to the functions printf(), fprintf(), sprintf(), -- snprintf(), respectively, except that they are called with a -- va_list instead of a variable number of arguments. These -- functions do not call the va_end macro. Consequently, the value -- of ap is undefined after the call. The application should call -- va_end(ap) itself afterwards. -- */ -- count = vsnprintf(p,psize,format,va); -- va_end(va); -- if (count == -1) -- psize *= 2; -- else if (count >= psize) -- psize = count + 1; -- else -- break; --#else -- assert(0); --#endif -- p = (char *) alloca(psize); // buffer too small, try again with larger size -- } -- write(p,count); --} -- --void OutBuffer::printf(const char *format, ...) --{ -- va_list ap; -- va_start(ap, format); -- vprintf(format,ap); -- va_end(ap); --} -- --void OutBuffer::bracket(char left, char right) --{ -- reserve(2); -- memmove(data + 1, data, offset); -- data[0] = left; -- data[offset + 1] = right; -- offset += 2; --} -- --/****************** -- * Insert left at i, and right at j. -- * Return index just past right. -- */ -- --size_t OutBuffer::bracket(size_t i, const char *left, size_t j, const char *right) --{ -- size_t leftlen = strlen(left); -- size_t rightlen = strlen(right); -- reserve(leftlen + rightlen); -- insert(i, left, leftlen); -- insert(j + leftlen, right, rightlen); -- return j + leftlen + rightlen; --} -- --void OutBuffer::spread(size_t offset, size_t nbytes) --{ -- reserve(nbytes); -- memmove(data + offset + nbytes, data + offset, -- this->offset - offset); -- this->offset += nbytes; --} -- --/**************************************** -- * Returns: offset + nbytes -- */ -- --size_t OutBuffer::insert(size_t offset, const void *p, size_t nbytes) --{ -- spread(offset, nbytes); -- memmove(data + offset, p, nbytes); -- return offset + nbytes; --} -- --void OutBuffer::remove(size_t offset, size_t nbytes) --{ -- memmove(data + offset, data + offset + nbytes, this->offset - (offset + nbytes)); -- this->offset -= nbytes; --} -- --char *OutBuffer::toChars() --{ -- writeByte(0); -- return (char *)data; --} -- --// TODO: Remove (only used by disabled GC) --/********************************* Bits ****************************/ -- --Bits::Bits() --{ -- data = NULL; -- bitdim = 0; -- allocdim = 0; --} -- --Bits::~Bits() --{ -- mem.free(data); --} -- --void Bits::mark() --{ -- mem.mark(data); --} -- --void Bits::resize(unsigned bitdim) --{ -- unsigned allocdim; -- unsigned mask; -- -- allocdim = (bitdim + 31) / 32; -- data = (unsigned *)mem.realloc(data, allocdim * sizeof(data[0])); -- if (this->allocdim < allocdim) -- memset(data + this->allocdim, 0, (allocdim - this->allocdim) * sizeof(data[0])); -- -- // Clear other bits in last word -- mask = (1 << (bitdim & 31)) - 1; -- if (mask) -- data[allocdim - 1] &= ~mask; -- -- this->bitdim = bitdim; -- this->allocdim = allocdim; --} -- --void Bits::set(unsigned bitnum) --{ -- data[bitnum / 32] |= 1 << (bitnum & 31); --} -- --void Bits::clear(unsigned bitnum) --{ -- data[bitnum / 32] &= ~(1 << (bitnum & 31)); --} -- --int Bits::test(unsigned bitnum) --{ -- return data[bitnum / 32] & (1 << (bitnum & 31)); --} -- --void Bits::set() --{ unsigned mask; -- -- memset(data, ~0, allocdim * sizeof(data[0])); -- -- // Clear other bits in last word -- mask = (1 << (bitdim & 31)) - 1; -- if (mask) -- data[allocdim - 1] &= mask; --} -- --void Bits::clear() --{ -- memset(data, 0, allocdim * sizeof(data[0])); --} -- --void Bits::copy(Bits *from) --{ -- assert(bitdim == from->bitdim); -- memcpy(data, from->data, allocdim * sizeof(data[0])); --} -- --Bits *Bits::clone() --{ -- Bits *b; -- -- b = new Bits(); -- b->resize(bitdim); -- b->copy(this); -- return b; --} -- --void Bits::sub(Bits *b) --{ -- unsigned u; -- -- for (u = 0; u < allocdim; u++) -- data[u] &= ~b->data[u]; --} ---- a/src/gcc/d/dfrontend/root.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/root.h 2014-04-01 16:32:51.000000000 +0100 -@@ -10,386 +10,14 @@ - #ifndef ROOT_H - #define ROOT_H - --#include <stdlib.h> --#include <stdarg.h> --#ifdef DEBUG --#include <assert.h> --#endif -- --#include "port.h" -- - #if __DMC__ - #pragma once - #endif - --typedef size_t hash_t; -- --/* -- * Root of our class library. -- */ -- --struct OutBuffer; -- --// Can't include arraytypes.h here, need to declare these directly. --template <typename TYPE> struct ArrayBase; --typedef ArrayBase<struct File> Files; --typedef ArrayBase<char> Strings; -- -- --struct Object --{ -- Object() { } -- virtual ~Object() { } -- -- virtual int equals(Object *o); -- -- /** -- * Returns a hash code, useful for things like building hash tables of Objects. -- */ -- virtual hash_t hashCode(); -- -- /** -- * Return <0, ==0, or >0 if this is less than, equal to, or greater than obj. -- * Useful for sorting Objects. -- */ -- virtual int compare(Object *obj); -- -- /** -- * Pretty-print an Object. Useful for debugging the old-fashioned way. -- */ -- virtual void print(); -- -- virtual char *toChars(); -- virtual void toBuffer(OutBuffer *buf); -- -- /** -- * Used as a replacement for dynamic_cast. Returns a unique number -- * defined by the library user. For Object, the return value is 0. -- */ -- virtual int dyncast(); -- -- /** -- * Marks pointers for garbage collector by calling mem.mark() for all pointers into heap. -- */ -- /*virtual*/ // not used, disable for now -- void mark(); --}; -- --struct String : Object --{ -- const char *str; // the string itself -- -- String(const char *str); -- ~String(); -- -- static hash_t calcHash(const char *str, size_t len); -- static hash_t calcHash(const char *str); -- hash_t hashCode(); -- size_t len(); -- int equals(Object *obj); -- int compare(Object *obj); -- char *toChars(); -- void print(); -- void mark(); --}; -- --struct FileName : String --{ -- FileName(const char *str); -- hash_t hashCode(); -- int equals(Object *obj); -- static int equals(const char *name1, const char *name2); -- int compare(Object *obj); -- static int compare(const char *name1, const char *name2); -- static int absolute(const char *name); -- static const char *ext(const char *); -- const char *ext(); -- static const char *removeExt(const char *str); -- static const char *name(const char *); -- const char *name(); -- static const char *path(const char *); -- static const char *replaceName(const char *path, const char *name); -- -- static const char *combine(const char *path, const char *name); -- static Strings *splitPath(const char *path); -- static const char *defaultExt(const char *name, const char *ext); -- static const char *forceExt(const char *name, const char *ext); -- static int equalsExt(const char *name, const char *ext); -- -- int equalsExt(const char *ext); -- -- void CopyTo(FileName *to); -- static const char *searchPath(Strings *path, const char *name, int cwd); -- static const char *safeSearchPath(Strings *path, const char *name); -- static int exists(const char *name); -- static void ensurePathExists(const char *path); -- static void ensurePathToNameExists(const char *name); -- static const char *canonicalName(const char *name); -- -- static void free(const char *str); --}; -- --struct File : Object --{ -- int ref; // != 0 if this is a reference to someone else's buffer -- unsigned char *buffer; // data for our file -- size_t len; // amount of data in buffer[] -- void *touchtime; // system time to use for file -- -- FileName *name; // name of our file -- -- File(const char *); -- File(const FileName *); -- ~File(); -- -- void mark(); -- -- char *toChars(); -- -- /* Read file, return !=0 if error -- */ -- -- int read(); -- -- /* Write file, either succeed or fail -- * with error message & exit. -- */ -- -- void readv(); -- -- /* Read file, return !=0 if error -- */ -- -- int mmread(); -- -- /* Write file, either succeed or fail -- * with error message & exit. -- */ -- -- void mmreadv(); -- -- /* Write file, return !=0 if error -- */ -- -- int write(); -- -- /* Write file, either succeed or fail -- * with error message & exit. -- */ -- -- void writev(); -- -- /* Return !=0 if file exists. -- * 0: file doesn't exist -- * 1: normal file -- * 2: directory -- */ -- -- /* Append to file, return !=0 if error -- */ -- -- int append(); -- -- /* Append to file, either succeed or fail -- * with error message & exit. -- */ -- -- void appendv(); -- -- /* Return !=0 if file exists. -- * 0: file doesn't exist -- * 1: normal file -- * 2: directory -- */ -- -- int exists(); -- -- /* Given wildcard filespec, return an array of -- * matching File's. -- */ -- -- static Files *match(char *); -- static Files *match(FileName *); -- -- // Compare file times. -- // Return <0 this < f -- // =0 this == f -- // >0 this > f -- int compareTime(File *f); -- -- // Read system file statistics -- void stat(); -- -- /* Set buffer -- */ -- -- void setbuffer(void *buffer, size_t len) -- { -- this->buffer = (unsigned char *)buffer; -- this->len = len; -- } -- -- void checkoffset(size_t offset, size_t nbytes); -- -- void remove(); // delete file --}; -- --struct OutBuffer : Object --{ -- unsigned char *data; -- size_t offset; -- size_t size; -- -- int doindent, level, linehead; -- -- OutBuffer(); -- ~OutBuffer(); -- char *extractData(); -- void mark(); -- -- void reserve(size_t nbytes); -- void setsize(size_t size); -- void reset(); -- void write(const void *data, size_t nbytes); -- void writebstring(unsigned char *string); -- void writestring(const char *string); -- void prependstring(const char *string); -- void writenl(); // write newline -- void writeByte(unsigned b); -- void writebyte(unsigned b) { writeByte(b); } -- void writeUTF8(unsigned b); -- void prependbyte(unsigned b); -- void writeword(unsigned w); -- void writeUTF16(unsigned w); -- void write4(unsigned w); -- void write(OutBuffer *buf); -- void write(Object *obj); -- void fill0(size_t nbytes); -- void align(size_t size); -- void vprintf(const char *format, va_list args); -- void printf(const char *format, ...); -- void bracket(char left, char right); -- size_t bracket(size_t i, const char *left, size_t j, const char *right); -- void spread(size_t offset, size_t nbytes); -- size_t insert(size_t offset, const void *data, size_t nbytes); -- void remove(size_t offset, size_t nbytes); -- char *toChars(); -- char *extractString(); --}; -- --struct Array --{ -- size_t dim; -- void **data; -- -- private: -- size_t allocdim; -- #define SMALLARRAYCAP 1 -- void *smallarray[SMALLARRAYCAP]; // inline storage for small arrays -- -- public: -- Array(); -- ~Array(); -- //Array(const Array&); -- void mark(); -- char *toChars(); -- -- void reserve(size_t nentries); -- void setDim(size_t newdim); -- void fixDim(); -- void push(void *ptr); -- void *pop(); -- void shift(void *ptr); -- void insert(size_t index, void *ptr); -- void insert(size_t index, Array *a); -- void append(Array *a); -- void remove(size_t i); -- void zero(); -- void *tos(); -- void sort(); -- Array *copy(); --}; -- --template <typename TYPE> --struct ArrayBase : Array --{ -- TYPE **tdata() -- { -- return (TYPE **)data; -- } -- -- TYPE*& operator[] (size_t index) -- { --#ifdef DEBUG -- assert(index < dim); --#endif -- return ((TYPE **)data)[index]; -- } -- -- void insert(size_t index, TYPE *v) -- { -- Array::insert(index, (void *)v); -- } -- -- void insert(size_t index, ArrayBase *a) -- { -- Array::insert(index, (Array *)a); -- } -- -- void append(ArrayBase *a) -- { -- Array::append((Array *)a); -- } -- -- void push(TYPE *a) -- { -- Array::push((void *)a); -- } -- -- ArrayBase *copy() -- { -- return (ArrayBase *)Array::copy(); -- } -- -- typedef int (*ArrayBase_apply_ft_t)(TYPE *, void *); -- int apply(ArrayBase_apply_ft_t fp, void *param) -- { -- for (size_t i = 0; i < dim; i++) -- { TYPE *e = (*this)[i]; -- -- if (e) -- { -- if (e->apply(fp, param)) -- return 1; -- } -- } -- return 0; -- } --}; -- --// TODO: Remove (only used by disabled GC) --struct Bits : Object --{ -- unsigned bitdim; -- unsigned allocdim; -- unsigned *data; -- -- Bits(); -- ~Bits(); -- void mark(); -- -- void resize(unsigned bitdim); -- -- void set(unsigned bitnum); -- void clear(unsigned bitnum); -- int test(unsigned bitnum); -- -- void set(); -- void clear(); -- void copy(Bits *from); -- Bits *clone(); -- -- void sub(Bits *b); --}; -+#include "object.h" -+#include "filename.h" -+#include "file.h" -+#include "outbuffer.h" -+#include "array.h" - - #endif ---- a/src/gcc/d/dfrontend/sapply.c 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/dfrontend/sapply.c 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,210 @@ -+ -+// Compiler implementation of the D programming language -+// Copyright (c) 1999-2013 by Digital Mars -+// All Rights Reserved -+// written by Walter Bright -+// http://www.digitalmars.com -+// License for redistribution is by either the Artistic License -+// in artistic.txt, or the GNU General Public License in gnu.txt. -+// See the included readme.txt for details. -+ -+#include <stdio.h> -+#include <assert.h> -+ -+#include "mars.h" -+#include "statement.h" -+ -+ -+/************************************** -+ * A Statement tree walker that will visit each Statement s in the tree, -+ * in depth-first evaluation order, and call fp(s,param) on it. -+ * fp() signals whether the walking continues with its return value: -+ * Returns: -+ * 0 continue -+ * 1 done -+ * It's a bit slower than using virtual functions, but more encapsulated and less brittle. -+ * Creating an iterator for this would be much more complex. -+ */ -+ -+typedef bool (*sapply_fp_t)(Statement *, void *); -+ -+bool Statement::apply(sapply_fp_t fp, void *param) -+{ -+ return (*fp)(this, param); -+} -+ -+/****************************** -+ * Perform apply() on an t if not null -+ */ -+#define scondApply(t, fp, param) (t ? t->apply(fp, param) : 0) -+ -+ -+ -+bool PeelStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return s->apply(fp, param) || -+ (*fp)(this, param); -+} -+ -+bool CompoundStatement::apply(sapply_fp_t fp, void *param) -+{ -+ for (size_t i = 0; i < statements->dim; i++) -+ { Statement *s = (*statements)[i]; -+ -+ bool r = scondApply(s, fp, param); -+ if (r) -+ return r; -+ } -+ return (*fp)(this, param); -+} -+ -+bool UnrolledLoopStatement::apply(sapply_fp_t fp, void *param) -+{ -+ for (size_t i = 0; i < statements->dim; i++) -+ { Statement *s = (*statements)[i]; -+ -+ bool r = scondApply(s, fp, param); -+ if (r) -+ return r; -+ } -+ return (*fp)(this, param); -+} -+ -+bool ScopeStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool WhileStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool DoStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool ForStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(init, fp, param) || -+ scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool ForeachStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+#if DMDV2 -+bool ForeachRangeStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+#endif -+ -+bool IfStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(ifbody, fp, param) || -+ scondApply(elsebody, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool ConditionalStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(ifbody, fp, param) || -+ scondApply(elsebody, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool PragmaStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool SwitchStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool CaseStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ -+#if DMDV2 -+bool CaseRangeStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+#endif -+ -+bool DefaultStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool SynchronizedStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool WithStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool TryCatchStatement::apply(sapply_fp_t fp, void *param) -+{ -+ bool r = scondApply(body, fp, param); -+ if (r) -+ return r; -+ -+ for (size_t i = 0; i < catches->dim; i++) -+ { Catch *c = (*catches)[i]; -+ -+ bool r = scondApply(c->handler, fp, param); -+ if (r) -+ return r; -+ } -+ return (*fp)(this, param); -+} -+ -+bool TryFinallyStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(body, fp, param) || -+ scondApply(finalbody, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool OnScopeStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool DebugStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ -+bool LabelStatement::apply(sapply_fp_t fp, void *param) -+{ -+ return scondApply(statement, fp, param) || -+ (*fp)(this, param); -+} -+ ---- a/src/gcc/d/dfrontend/scope.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/scope.c 2014-04-01 16:32:51.000000000 +0100 -@@ -12,6 +12,7 @@ - #include <string.h> // strlen() - - #include "root.h" -+#include "rmem.h" - #include "speller.h" - - #include "mars.h" -@@ -21,6 +22,7 @@ - #include "attrib.h" - #include "dsymbol.h" - #include "declaration.h" -+#include "statement.h" - #include "aggregate.h" - #include "module.h" - #include "id.h" -@@ -50,6 +52,7 @@ Scope::Scope() - - //printf("Scope::Scope() %p\n", this); - this->module = NULL; -+ this->instantiatingModule = NULL; - this->scopesym = NULL; - this->sd = NULL; - this->enclosing = NULL; -@@ -60,7 +63,8 @@ Scope::Scope() - this->sbreak = NULL; - this->scontinue = NULL; - this->fes = NULL; -- this->structalign = global.structalign; -+ this->callsc = NULL; -+ this->structalign = STRUCTALIGN_DEFAULT; - this->func = NULL; - this->slabel = NULL; - this->linkage = LINKd; -@@ -72,12 +76,11 @@ Scope::Scope() - this->inunion = 0; - this->nofree = 0; - this->noctor = 0; -- this->noaccesscheck = 0; -- this->mustsemantic = 0; - this->intypeof = 0; - this->speculative = 0; -- this->parameterSpecialization = 0; - this->callSuper = 0; -+ this->fieldinit = NULL; -+ this->fieldinit_dim = 0; - this->flags = 0; - this->lastdc = NULL; - this->lastoffset = 0; -@@ -90,6 +93,7 @@ Scope::Scope(Scope *enclosing) - //printf("Scope::Scope(enclosing = %p) %p\n", enclosing, this); - assert(!(enclosing->flags & SCOPEfree)); - this->module = enclosing->module; -+ this->instantiatingModule = enclosing->instantiatingModule; - this->func = enclosing->func; - this->parent = enclosing->parent; - this->scopesym = NULL; -@@ -100,6 +104,7 @@ Scope::Scope(Scope *enclosing) - this->sbreak = enclosing->sbreak; - this->scontinue = enclosing->scontinue; - this->fes = enclosing->fes; -+ this->callsc = enclosing->callsc; - this->structalign = enclosing->structalign; - this->enclosing = enclosing; - #ifdef DEBUG -@@ -121,13 +126,12 @@ Scope::Scope(Scope *enclosing) - this->inunion = enclosing->inunion; - this->nofree = 0; - this->noctor = enclosing->noctor; -- this->noaccesscheck = enclosing->noaccesscheck; -- this->mustsemantic = enclosing->mustsemantic; - this->intypeof = enclosing->intypeof; - this->speculative = enclosing->speculative; -- this->parameterSpecialization = enclosing->parameterSpecialization; - this->callSuper = enclosing->callSuper; -- this->flags = (enclosing->flags & (SCOPEcontract | SCOPEdebug)); -+ this->fieldinit = enclosing->saveFieldInit(); -+ this->fieldinit_dim = enclosing->fieldinit_dim; -+ this->flags = (enclosing->flags & (SCOPEcontract | SCOPEdebug | SCOPEctfe)); - this->lastdc = NULL; - this->lastoffset = 0; - this->docbuf = enclosing->docbuf; -@@ -179,7 +183,17 @@ Scope *Scope::pop() - Scope *enc = enclosing; - - if (enclosing) -+ { - enclosing->callSuper |= callSuper; -+ if (enclosing->fieldinit && fieldinit) -+ { -+ size_t dim = fieldinit_dim; -+ for (size_t i = 0; i < dim; i++) -+ enclosing->fieldinit[i] |= fieldinit[i]; -+ delete[] fieldinit; -+ fieldinit = NULL; -+ } -+ } - - if (!nofree) - { enclosing = freelist; -@@ -190,6 +204,19 @@ Scope *Scope::pop() - return enc; - } - -+Scope *Scope::startCTFE() -+{ -+ Scope *sc = this->push(); -+ sc->flags = this->flags | SCOPEctfe; -+ return sc; -+} -+ -+Scope *Scope::endCTFE() -+{ -+ assert(flags & SCOPEctfe); -+ return pop(); -+} -+ - void Scope::mergeCallSuper(Loc loc, unsigned cs) - { - // This does a primitive flow analysis to support the restrictions -@@ -243,6 +270,131 @@ void Scope::mergeCallSuper(Loc loc, unsi - } - } - -+unsigned *Scope::saveFieldInit() -+{ -+ unsigned *fi = NULL; -+ if (fieldinit) // copy -+ { -+ size_t dim = fieldinit_dim; -+ fi = new unsigned[dim]; -+ fi[0] = dim; -+ for (size_t i = 0; i < dim; i++) -+ fi[i] = fieldinit[i]; -+ } -+ return fi; -+} -+ -+bool mergeFieldInit(Loc loc, unsigned &fieldInit, unsigned fi, bool mustInit) -+{ -+ if (fi != fieldInit) -+ { -+ -+ // Have any branches returned? -+ bool aRet = (fi & CSXreturn) != 0; -+ bool bRet = (fieldInit & CSXreturn) != 0; -+ -+ bool ok; -+ -+ if (aRet) -+ { -+ ok = !mustInit || (fi & CSXthis_ctor); -+ fieldInit = fieldInit; -+ } -+ else if (bRet) -+ { -+ ok = !mustInit || (fieldInit & CSXthis_ctor); -+ fieldInit = fi; -+ } -+ else -+ { -+ ok = !mustInit || !((fieldInit ^ fi) & CSXthis_ctor); -+ fieldInit |= fi; -+ } -+ -+ return ok; -+ } -+#if 0 -+ // This does a primitive flow analysis to support the restrictions -+ // regarding when and how constructors can appear. -+ // It merges the results of two paths. -+ // The two paths are fieldInit and fi; the result is merged into fieldInit. -+ -+ if (fi != fieldInit) -+ { // Have ALL branches called a constructor? -+ int aAll = (fi & CSXthis_ctor) != 0; -+ int bAll = (fieldInit & CSXthis_ctor) != 0; -+ -+ // Have ANY branches called a constructor? -+ bool aAny = (fi & CSXany_ctor) != 0; -+ bool bAny = (fieldInit & CSXany_ctor) != 0; -+ -+ // Have any branches returned? -+ bool aRet = (fi & CSXreturn) != 0; -+ bool bRet = (fieldInit & CSXreturn) != 0; -+ -+ bool ok = true; -+ -+printf("L%d fieldInit = x%x, fi = x%x\n", __LINE__, fieldInit, fi); -+ -+ // If one has returned without a constructor call, there must be never -+ // have been ctor calls in the other. -+ if ( (aRet && !aAny && bAny) || -+ (bRet && !bAny && aAny)) -+ { ok = false; -+printf("L%d\n", __LINE__); -+ } -+ // If one branch has called a ctor and then exited, anything the -+ // other branch has done is OK (except returning without a -+ // ctor call, but we already checked that). -+ else if (aRet && aAll) -+ { -+ //fieldInit |= fi & (CSXany_ctor | CSXlabel); -+printf("L%d -> fieldInit = x%x\n", __LINE__, fieldInit); -+ } -+ else if (bRet && bAll) -+ { -+ fieldInit = fi;// | (fieldInit & (CSXany_ctor | CSXlabel)); -+printf("L%d -> fieldInit = x%x\n", __LINE__, fieldInit); -+ } -+ else -+ { // Both branches must have called ctors, or both not. -+ ok = (aAll == bAll); -+ // If one returned without a ctor, we must remember that -+ // (Don't bother if we've already found an error) -+ if (ok && aRet && !aAny) -+ fieldInit |= CSXreturn; -+ fieldInit |= fi & (CSXany_ctor | CSXlabel); -+printf("L%d ok = %d, fieldInit = x%x, fi = x%x\n", __LINE__, ok, fieldInit, fi); -+ } -+ return ok; -+ } -+#endif -+ return true; -+} -+ -+void Scope::mergeFieldInit(Loc loc, unsigned *fies) -+{ -+ if (fieldinit && fies) -+ { -+ FuncDeclaration *f = func; -+ if (fes) f = fes->func; -+ AggregateDeclaration *ad = f->isAggregateMember2(); -+ assert(ad); -+ -+ for (size_t i = 0; i < ad->fields.dim; i++) -+ { -+ VarDeclaration *v = ad->fields[i]; -+ bool mustInit = (v->storage_class & STCnodefaultctor || -+ v->type->needsNested()); -+ -+ if (!::mergeFieldInit(loc, fieldinit[i], fies[i], mustInit)) -+ { -+ ::error(loc, "one path skips field %s", ad->fields[i]->toChars()); -+ } -+ } -+ } -+} -+ - Dsymbol *Scope::search(Loc loc, Identifier *ident, Dsymbol **pscopesym) - { Dsymbol *s; - Scope *sc; -@@ -278,8 +430,7 @@ Dsymbol *Scope::search(Loc loc, Identifi - s = sc->scopesym->search(loc, ident, 0); - if (s) - { -- if (global.params.Dversion > 1 && -- ident == Id::length && -+ if (ident == Id::length && - sc->scopesym->isArrayScopeSymbol() && - sc->enclosing && - sc->enclosing->search(loc, ident, NULL)) -@@ -410,9 +561,8 @@ void *scope_search_fp(void *arg, const c - assert(id); - - Scope *sc = (Scope *)arg; -- Module::clearCache(); -- Dsymbol *s = sc->search(0, id, NULL); -- return s; -+ Dsymbol *s = sc->search(Loc(), id, NULL); -+ return (void*)s; - } - - Dsymbol *Scope::search_correct(Identifier *ident) ---- a/src/gcc/d/dfrontend/scope.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/scope.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -14,20 +14,20 @@ - #pragma once - #endif - --struct Dsymbol; --struct ScopeDsymbol; --struct Identifier; --struct Module; --struct Statement; --struct SwitchStatement; --struct TryFinallyStatement; --struct LabelStatement; --struct ForeachStatement; --struct ClassDeclaration; --struct AggregateDeclaration; --struct FuncDeclaration; -+class Dsymbol; -+class ScopeDsymbol; -+class Identifier; -+class Module; -+class Statement; -+class SwitchStatement; -+class TryFinallyStatement; -+class LabelStatement; -+class ForeachStatement; -+class ClassDeclaration; -+class AggregateDeclaration; -+class FuncDeclaration; - struct DocComment; --struct TemplateInstance; -+class TemplateInstance; - - #if __GNUC__ - // Requires a full definition for PROT and LINK -@@ -38,11 +38,34 @@ enum LINK; - enum PROT; - #endif - -+#define CSXthis_ctor 1 // called this() -+#define CSXsuper_ctor 2 // called super() -+#define CSXthis 4 // referenced this -+#define CSXsuper 8 // referenced super -+#define CSXlabel 0x10 // seen a label -+#define CSXreturn 0x20 // seen a return statement -+#define CSXany_ctor 0x40 // either this() or super() was called -+ -+#define SCOPEctor 0x0001 // constructor type -+#define SCOPEstaticif 0x0002 // inside static if -+#define SCOPEfree 0x0004 // is on free list -+#define SCOPEstaticassert 0x0008 // inside static assert -+#define SCOPEdebug 0x0010 // inside debug conditional -+ -+#define SCOPEinvariant 0x0020 // inside invariant code -+#define SCOPErequire 0x0040 // inside in contract code -+#define SCOPEensure 0x0060 // inside out contract code -+#define SCOPEcontract 0x0060 // [mask] we're inside contract code -+ -+#define SCOPEctfe 0x0080 // inside a ctfe-only expression -+#define SCOPEnoaccesscheck 0x0100 // don't do access checks -+ - struct Scope - { - Scope *enclosing; // enclosing Scope - - Module *module; // Root module -+ Module *instantiatingModule; // top level module that started a chain of template instantiations - ScopeDsymbol *scopesym; // current symbol - ScopeDsymbol *sd; // if in static if, and declaring new symbols, - // sd gets the addMember() -@@ -55,6 +78,7 @@ struct Scope - Statement *sbreak; // enclosing statement that supports "break" - Statement *scontinue; // enclosing statement that supports "continue" - ForeachStatement *fes; // if nested function for ForeachStatement, this is it -+ Scope *callsc; // used for __FUNCTION__, __PRETTY_FUNCTION__ and __MODULE__ - unsigned offset; // next offset to use in aggregate - // This really shouldn't be a part of Scope, because it requires - // semantic() to be done in the lexical field order. It should be -@@ -65,39 +89,21 @@ struct Scope - int noctor; // set if constructor calls aren't allowed - int intypeof; // in typeof(exp) - bool speculative; // in __traits(compiles) or typeof(exp) -- int parameterSpecialization; // if in template parameter specialization -- int noaccesscheck; // don't do access checks -- int mustsemantic; // cannot defer semantic() - - unsigned callSuper; // primitive flow analysis for constructors --#define CSXthis_ctor 1 // called this() --#define CSXsuper_ctor 2 // called super() --#define CSXthis 4 // referenced this --#define CSXsuper 8 // referenced super --#define CSXlabel 0x10 // seen a label --#define CSXreturn 0x20 // seen a return statement --#define CSXany_ctor 0x40 // either this() or super() was called -+ unsigned *fieldinit; -+ unsigned fieldinit_dim; - - structalign_t structalign; // alignment for struct members -- enum LINK linkage; // linkage for external functions -+ LINK linkage; // linkage for external functions - -- enum PROT protection; // protection for class members -+ PROT protection; // protection for class members - int explicitProtection; // set if in an explicit protection attribute - - StorageClass stc; // storage class - char *depmsg; // customized deprecation message - - unsigned flags; --#define SCOPEctor 1 // constructor type --#define SCOPEstaticif 2 // inside static if --#define SCOPEfree 4 // is on free list --#define SCOPEstaticassert 8 // inside static assert --#define SCOPEdebug 0x10 // inside debug conditional -- --#define SCOPEinvariant 0x20 // inside invariant code --#define SCOPErequire 0x40 // inside in contract code --#define SCOPEensure 0x60 // inside out contract code --#define SCOPEcontract 0x60 // [mask] we're inside contract code - - Expressions *userAttributes; // user defined attributes - -@@ -110,15 +116,20 @@ struct Scope - static Scope *createGlobal(Module *module); - - Scope(); -- Scope(Module *module); - Scope(Scope *enclosing); - - Scope *push(); - Scope *push(ScopeDsymbol *ss); - Scope *pop(); - -+ Scope *startCTFE(); -+ Scope *endCTFE(); -+ - void mergeCallSuper(Loc loc, unsigned cs); - -+ unsigned *saveFieldInit(); -+ void mergeFieldInit(Loc loc, unsigned *cses); -+ - Dsymbol *search(Loc loc, Identifier *ident, Dsymbol **pscopesym); - Dsymbol *search_correct(Identifier *ident); - Dsymbol *insert(Dsymbol *s); ---- a/src/gcc/d/dfrontend/statement.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/statement.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2011 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -52,6 +52,15 @@ Identifier *fixupLabelName(Scope *sc, Id - return ident; - } - -+LabelStatement *checkLabeledLoop(Scope *sc, Statement *statement) -+{ -+ if (sc->slabel && sc->slabel->statement == statement) -+ { -+ return sc->slabel; -+ } -+ return NULL; -+} -+ - /******************************** Statement ***************************/ - - Statement::Statement(Loc loc) -@@ -69,17 +78,18 @@ Statement *Statement::syntaxCopy() - - void Statement::print() - { -- fprintf(stdmsg, "%s\n", toChars()); -- fflush(stdmsg); -+ fprintf(stderr, "%s\n", toChars()); -+ fflush(stderr); - } - - char *Statement::toChars() --{ OutBuffer *buf; -+{ - HdrGenState hgs; - -- buf = new OutBuffer(); -- toCBuffer(buf, &hgs); -- return buf->toChars(); -+ OutBuffer buf; -+ toCBuffer(&buf, &hgs); -+ buf.writebyte(0); -+ return buf.extractData(); - } - - void Statement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -154,13 +164,78 @@ bool Statement::hasContinue() - return FALSE; - } - -+/* ============================================== */ - // TRUE if statement uses exception handling - - bool Statement::usesEH() - { -- return FALSE; -+ struct UsesEH -+ { -+ static bool lambdaUsesEH(Statement *s, void *param) -+ { -+ return s->usesEHimpl(); -+ } -+ }; -+ -+ UsesEH ueh; -+ return apply(&UsesEH::lambdaUsesEH, &ueh); -+} -+ -+bool Statement::usesEHimpl() { return false; } -+bool TryCatchStatement::usesEHimpl() { return true; } -+bool TryFinallyStatement::usesEHimpl() { return true; } -+bool OnScopeStatement::usesEHimpl() { return true; } -+bool SynchronizedStatement::usesEHimpl() { return true; } -+ -+/* ============================================== */ -+// TRUE if statement 'comes from' somewhere else, like a goto -+ -+bool Statement::comeFrom() -+{ -+ struct ComeFrom -+ { -+ static bool lambdaComeFrom(Statement *s, void *param) -+ { -+ return s->comeFromImpl(); -+ } -+ }; -+ -+ ComeFrom cf; -+ return apply(&ComeFrom::lambdaComeFrom, &cf); -+} -+ -+bool Statement::comeFromImpl() { return false; } -+bool CaseStatement::comeFromImpl() { return true; } -+bool DefaultStatement::comeFromImpl() { return true; } -+bool LabelStatement::comeFromImpl() { return true; } -+bool AsmStatement::comeFromImpl() { return true; } -+ -+/* ============================================== */ -+// Return true if statement has executable code. -+ -+bool Statement::hasCode() -+{ -+ struct HasCode -+ { -+ static bool lambdaHasCode(Statement *s, void *param) -+ { -+ return s->hasCodeImpl(); -+ } -+ }; -+ -+ HasCode hc; -+ return apply(&HasCode::lambdaHasCode, &hc); - } - -+bool Statement::hasCodeImpl() { return true; } -+bool ExpStatement::hasCodeImpl() { return exp != NULL; } -+bool CompoundStatement::hasCodeImpl() { return false; } -+bool ScopeStatement::hasCodeImpl() { return false; } -+bool ImportStatement::hasCodeImpl() { return false; } -+ -+ -+/* ============================================== */ -+ - /* Only valid after semantic analysis - * If 'mustNotThrow' is true, generate an error if it throws - */ -@@ -172,21 +247,6 @@ int Statement::blockExit(bool mustNotThr - return BEany; - } - --// TRUE if statement 'comes from' somewhere else, like a goto -- --int Statement::comeFrom() --{ -- //printf("Statement::comeFrom()\n"); -- return FALSE; --} -- --// Return TRUE if statement has no code in it --int Statement::isEmpty() --{ -- //printf("Statement::isEmpty()\n"); -- return FALSE; --} -- - Statement *Statement::last() - { - return this; -@@ -224,6 +284,28 @@ Statements *Statement::flatten(Scope *sc - } - - -+/******************************** ErrorStatement ***************************/ -+ -+ErrorStatement::ErrorStatement() -+ : Statement(Loc()) -+{ -+} -+ -+Statement *ErrorStatement::syntaxCopy() -+{ -+ return this; -+} -+ -+Statement *ErrorStatement::semantic(Scope *sc) -+{ -+ return this; -+} -+ -+int ErrorStatement::blockExit(bool mustNotThrow) -+{ -+ return BEany; -+} -+ - /******************************** PeelStatement ***************************/ - - PeelStatement::PeelStatement(Statement *s) -@@ -305,6 +387,8 @@ Statement *ExpStatement::semantic(Scope - exp = resolveProperties(sc, exp); - exp->discardValue(); - exp = exp->optimize(0); -+ if (exp->op == TOKerror) -+ return new ErrorStatement(); - } - return this; - } -@@ -328,11 +412,6 @@ int ExpStatement::blockExit(bool mustNot - return result; - } - --int ExpStatement::isEmpty() --{ -- return exp == NULL; --} -- - Statement *ExpStatement::scopeCode(Scope *sc, Statement **sentry, Statement **sexception, Statement **sfinally) - { - //printf("ExpStatement::scopeCode()\n"); -@@ -425,28 +504,38 @@ void CompileStatement::toCBuffer(OutBuff - Statements *CompileStatement::flatten(Scope *sc) - { - //printf("CompileStatement::flatten() %s\n", exp->toChars()); -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); -+ sc = sc->endCTFE(); - exp = exp->ctfeInterpret(); -- if (exp->op == TOKerror) -- return NULL; -- StringExp *se = exp->toString(); -- if (!se) -- { error("argument to mixin must be a string, not (%s)", exp->toChars()); -- return NULL; -- } -- se = se->toUTF8(sc); -- Parser p(sc->module, (unsigned char *)se->string, se->len, 0); -- p.loc = loc; -- p.nextToken(); - - Statements *a = new Statements(); -- while (p.token.value != TOKeof) -+ if (exp->op != TOKerror) - { -- Statement *s = p.parseStatement(PSsemi | PScurlyscope); -- if (s) // if no parsing errors -- a->push(s); -+ StringExp *se = exp->toString(); -+ if (!se) -+ error("argument to mixin must be a string, not (%s)", exp->toChars()); -+ else -+ { -+ se = se->toUTF8(sc); -+ Parser p(sc->module, (utf8_t *)se->string, se->len, 0); -+ p.scanloc = loc; -+ p.nextToken(); -+ -+ while (p.token.value != TOKeof) -+ { -+ unsigned errors = global.errors; -+ Statement *s = p.parseStatement(PSsemi | PScurlyscope); -+ if (!s || global.errors != errors) -+ goto Lerror; -+ a->push(s); -+ } -+ return a; -+ } - } -+Lerror: -+ a->push(new ErrorStatement()); - return a; - } - -@@ -569,26 +658,26 @@ Statement *CompoundStatement::semantic(S - { - a->push((*statements)[j]); - } -- Statement *body = new CompoundStatement(0, a); -- body = new ScopeStatement(0, body); -+ Statement *body = new CompoundStatement(Loc(), a); -+ body = new ScopeStatement(Loc(), body); - - Identifier *id = Lexer::uniqueId("__o"); - - Statement *handler = sexception; - if (sexception->blockExit(FALSE) & BEfallthru) -- { handler = new ThrowStatement(0, new IdentifierExp(0, id)); -+ { handler = new ThrowStatement(Loc(), new IdentifierExp(Loc(), id)); - ((ThrowStatement *)handler)->internalThrow = true; -- handler = new CompoundStatement(0, sexception, handler); -+ handler = new CompoundStatement(Loc(), sexception, handler); - } - - Catches *catches = new Catches(); -- Catch *ctch = new Catch(0, NULL, id, handler); -+ Catch *ctch = new Catch(Loc(), NULL, id, handler); - ctch->internalCatch = true; - catches->push(ctch); -- s = new TryCatchStatement(0, body, catches); -+ s = new TryCatchStatement(Loc(), body, catches); - - if (sfinally) -- s = new TryFinallyStatement(0, s, sfinally); -+ s = new TryFinallyStatement(Loc(), s, sfinally); - s = s->semantic(sc); - statements->setDim(i + 1); - statements->push(s); -@@ -613,8 +702,8 @@ Statement *CompoundStatement::semantic(S - { - a->push((*statements)[j]); - } -- Statement *body = new CompoundStatement(0, a); -- s = new TryFinallyStatement(0, body, sfinally); -+ Statement *body = new CompoundStatement(Loc(), a); -+ s = new TryFinallyStatement(Loc(), body, sfinally); - s = s->semantic(sc); - statements->setDim(i + 1); - statements->push(s); -@@ -622,9 +711,27 @@ Statement *CompoundStatement::semantic(S - } - } - } -+#ifdef IN_GCC -+ else -+ { -+ // Remove NULL statement from list. -+ statements->remove(i); -+ continue; -+ } -+#endif - } - i++; - } -+ for (size_t i = 0; i < statements->dim; ++i) -+ { -+ s = (*statements)[i]; -+ if (s) -+ { -+ Statement *se = s->isErrorStatement(); -+ if (se) -+ return se; -+ } -+ } - if (statements->dim == 1) - { - return (*statements)[0]; -@@ -678,16 +785,6 @@ void CompoundStatement::toCBuffer(OutBuf - } - } - --bool CompoundStatement::usesEH() --{ -- for (size_t i = 0; i < statements->dim; i++) -- { Statement *s = (*statements)[i]; -- if (s && s->usesEH()) -- return TRUE; -- } -- return FALSE; --} -- - int CompoundStatement::blockExit(bool mustNotThrow) - { - //printf("CompoundStatement::blockExit(%p) %d\n", this, statements->dim); -@@ -698,7 +795,7 @@ int CompoundStatement::blockExit(bool mu - if (s) - { - //printf("result = x%x\n", result); -- //printf("%s\n", s->toChars()); -+ //printf("s: %s\n", s->toChars()); - if (global.params.warnings && result & BEfallthru && slast) - { - slast = slast->last(); -@@ -708,9 +805,9 @@ int CompoundStatement::blockExit(bool mu - // Allow if last case/default was empty - CaseStatement *sc = slast->isCaseStatement(); - DefaultStatement *sd = slast->isDefaultStatement(); -- if (sc && sc->statement->isEmpty()) -+ if (sc && (!sc->statement->hasCode() || sc->statement->isCaseStatement())) - ; -- else if (sd && sd->statement->isEmpty()) -+ else if (sd && (!sd->statement->hasCode() || sd->statement->isCaseStatement())) - ; - else - s->error("switch case fallthrough - use 'goto %s;' if intended", -@@ -720,7 +817,7 @@ int CompoundStatement::blockExit(bool mu - - if (!(result & BEfallthru) && !s->comeFrom()) - { -- if (s->blockExit(mustNotThrow) != BEhalt && !s->isEmpty()) -+ if (s->blockExit(mustNotThrow) != BEhalt && s->hasCode()) - s->warning("statement is not reachable"); - } - else -@@ -734,31 +831,6 @@ int CompoundStatement::blockExit(bool mu - return result; - } - --int CompoundStatement::comeFrom() --{ int comefrom = FALSE; -- -- //printf("CompoundStatement::comeFrom()\n"); -- for (size_t i = 0; i < statements->dim; i++) -- { Statement *s = (*statements)[i]; -- -- if (!s) -- continue; -- -- comefrom |= s->comeFrom(); -- } -- return comefrom; --} -- --int CompoundStatement::isEmpty() --{ -- for (size_t i = 0; i < statements->dim; i++) -- { Statement *s = (*statements)[i]; -- if (s && !s->isEmpty()) -- return FALSE; -- } -- return TRUE; --} -- - - /******************************** CompoundDeclarationStatement ***************************/ - -@@ -804,7 +876,7 @@ void CompoundDeclarationStatement::toCBu - */ - if (anywritten) - { -- buf->writeByte(','); -+ buf->writestring(", "); - buf->writestring(v->ident->toChars()); - } - else -@@ -864,11 +936,10 @@ Statement *UnrolledLoopStatement::semant - { - //printf("UnrolledLoopStatement::semantic(this = %p, sc = %p)\n", this, sc); - -- sc->noctor++; - Scope *scd = sc->push(); - scd->sbreak = this; - scd->scontinue = this; -- -+ Statement *serror = NULL; - for (size_t i = 0; i < statements->dim; i++) - { - Statement *s = (*statements)[i]; -@@ -877,12 +948,14 @@ Statement *UnrolledLoopStatement::semant - //printf("[%d]: %s\n", i, s->toChars()); - s = s->semantic(scd); - (*statements)[i] = s; -+ -+ if (s && !serror) -+ serror = s->isErrorStatement(); - } - } - - scd->pop(); -- sc->noctor--; -- return this; -+ return serror ? serror : this; - } - - void UnrolledLoopStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -@@ -915,16 +988,6 @@ bool UnrolledLoopStatement::hasContinue( - return TRUE; - } - --bool UnrolledLoopStatement::usesEH() --{ -- for (size_t i = 0; i < statements->dim; i++) -- { Statement *s = (*statements)[i]; -- if (s && s->usesEH()) -- return TRUE; -- } -- return FALSE; --} -- - int UnrolledLoopStatement::blockExit(bool mustNotThrow) - { - int result = BEfallthru; -@@ -940,22 +1003,6 @@ int UnrolledLoopStatement::blockExit(boo - } - - --int UnrolledLoopStatement::comeFrom() --{ int comefrom = FALSE; -- -- //printf("UnrolledLoopStatement::comeFrom()\n"); -- for (size_t i = 0; i < statements->dim; i++) -- { Statement *s = (*statements)[i]; -- -- if (!s) -- continue; -- -- comefrom |= s->comeFrom(); -- } -- return comefrom; --} -- -- - /******************************** ScopeStatement ***************************/ - - ScopeStatement::ScopeStatement(Loc loc, Statement *s) -@@ -979,13 +1026,12 @@ Statement *ScopeStatement::semantic(Scop - - //printf("ScopeStatement::semantic(sc = %p)\n", sc); - if (statement) -- { Statements *a; -- -+ { - sym = new ScopeDsymbol(); - sym->parent = sc->scopesym; - sc = sc->push(sym); - -- a = statement->flatten(sc); -+ Statements *a = statement->flatten(sc); - if (a) - { - statement = new CompoundStatement(loc, a); -@@ -994,6 +1040,12 @@ Statement *ScopeStatement::semantic(Scop - statement = statement->semantic(sc); - if (statement) - { -+ if (statement->isErrorStatement()) -+ { -+ sc->pop(); -+ return statement; -+ } -+ - Statement *sentry; - Statement *sexception; - Statement *sfinally; -@@ -1025,11 +1077,6 @@ bool ScopeStatement::hasContinue() - return statement ? statement->hasContinue() : FALSE; - } - --bool ScopeStatement::usesEH() --{ -- return statement ? statement->usesEH() : FALSE; --} -- - int ScopeStatement::blockExit(bool mustNotThrow) - { - //printf("ScopeStatement::blockExit(%p)\n", statement); -@@ -1037,18 +1084,6 @@ int ScopeStatement::blockExit(bool mustN - } - - --int ScopeStatement::comeFrom() --{ -- //printf("ScopeStatement::comeFrom()\n"); -- return statement ? statement->comeFrom() : FALSE; --} -- --int ScopeStatement::isEmpty() --{ -- //printf("ScopeStatement::isEmpty() %d\n", statement ? statement->isEmpty() : TRUE); -- return statement ? statement->isEmpty() : TRUE; --} -- - void ScopeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writeByte('{'); -@@ -1099,12 +1134,6 @@ bool WhileStatement::hasContinue() - return TRUE; - } - --bool WhileStatement::usesEH() --{ -- assert(global.errors); -- return 0; --} -- - int WhileStatement::blockExit(bool mustNotThrow) - { - assert(global.errors); -@@ -1112,12 +1141,6 @@ int WhileStatement::blockExit(bool mustN - } - - --int WhileStatement::comeFrom() --{ -- assert(global.errors); -- return FALSE; --} -- - void WhileStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring("while ("); -@@ -1156,6 +1179,12 @@ Statement *DoStatement::semantic(Scope * - - condition = condition->checkToBoolean(sc); - -+ if (condition->op == TOKerror) -+ return new ErrorStatement(); -+ -+ if (body && body->isErrorStatement()) -+ return body; -+ - return this; - } - -@@ -1169,11 +1198,6 @@ bool DoStatement::hasContinue() - return TRUE; - } - --bool DoStatement::usesEH() --{ -- return body ? body->usesEH() : 0; --} -- - int DoStatement::blockExit(bool mustNotThrow) - { int result; - -@@ -1198,13 +1222,6 @@ int DoStatement::blockExit(bool mustNotT - } - - --int DoStatement::comeFrom() --{ -- if (body) -- return body->comeFrom(); -- return FALSE; --} -- - void DoStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring("do"); -@@ -1226,7 +1243,6 @@ ForStatement::ForStatement(Loc loc, Stat - this->condition = condition; - this->increment = increment; - this->body = body; -- this->nest = 0; - this->relatedLabeled = NULL; - } - -@@ -1245,144 +1261,44 @@ Statement *ForStatement::syntaxCopy() - return s; - } - --/* -- * Run semantic on init recursively. -- * Rewrite: -- * for (auto x=X(), y = Y(); ...; ...) {} -- * as: -- * try { -- * try { -- * for (auto x=X(), auto y=Y(); ...; ...) {} -- * } -- * finally { y.~this(); } -- * } -- * finally { x.~this(); } -- */ --Statement *ForStatement::semanticInit(Scope *sc) -+Statement *ForStatement::semantic(Scope *sc) - { -- assert(init); -- ++nest; -+ //printf("ForStatement::semantic %s\n", toChars()); - -- Loc locinit = init->loc; -- Statements *ainit = init->flatten(sc); -- if (!ainit) -- (ainit = new Statements())->push(init); -- init = NULL; -- -- Statement *statement = this; -- -- for (size_t i = 0; i < ainit->dim; i++) -- { Statement *s = (*ainit)[i]; -+ if (init) -+ { -+ /* Rewrite: -+ * for (auto v1 = i1, v2 = i2; condition; increment) { ... } -+ * to: -+ * { auto v1 = i1, v2 = i2; for (; condition; increment) { ... } } -+ * then lowered to: -+ * auto v1 = i1; -+ * try { -+ * auto v2 = i2; -+ * try { -+ * for (; condition; increment) { ... } -+ * } finally { v2.~this(); } -+ * } finally { v1.~this(); } -+ */ -+ Statements *ainit = new Statements(); -+ ainit->push(init), init = NULL; -+ ainit->push(this); -+ Statement *s = new CompoundStatement(loc, ainit); -+ s = new ScopeStatement(loc, s); - s = s->semantic(sc); -- (*ainit)[i] = s; -- if (s) -+ if (!s->isErrorStatement()) - { -- Statement *sentry; -- Statement *sexception; -- Statement *sfinally; -- -- (*ainit)[i] = s->scopeCode(sc, &sentry, &sexception, &sfinally); -- -- if (sentry) -- { sentry = sentry->semantic(sc); -- if (sentry) -- ainit->insert(i++, sentry); -- } -- if (sexception) -- sexception = sexception->semantic(sc); -- if (sexception) -- { // Re-initialize this->init -- if (i + 1 < ainit->dim) -- { -- Statements *a = new Statements(); -- for (size_t j = i + 1; j < ainit->dim; j++) -- a->push((*ainit)[j]); -- init = new CompoundStatement(0, a); -- } -- -- Identifier *id = Lexer::uniqueId("__o"); -- Statement *handler = sexception; -- if (sexception->blockExit(FALSE) & BEfallthru) -- { handler = new ThrowStatement(0, new IdentifierExp(0, id)); -- ((ThrowStatement *)handler)->internalThrow = true; -- handler = new CompoundStatement(0, sexception, handler); -- } -- Catches *catches = new Catches(); -- Catch *ctch = new Catch(0, NULL, id, handler); -- catches->push(ctch); -- s = new TryCatchStatement(0, this, catches); -- -- if (sfinally) -- s = new TryFinallyStatement(0, s, sfinally); -- //printf("ex {{{\n"); -- s = s->semantic(sc); -- //printf("}}}\n"); -- this->relatedLabeled = s; -- statement = s; -- -- if (init) -- { Statements *a = init->flatten(sc); -- if (!a) -- (a = new Statements())->push(init); -- for (size_t j = 0; j < i + 1; j++) -- a->insert(j, (*ainit)[j]); -- init = new CompoundStatement(locinit, a); -- } -- break; -- } -- else if (sfinally) -- { // Re-initialize this->init -- if (i + 1 < ainit->dim) -- { -- Statements *a = new Statements(); -- for (size_t j = i + 1; j < ainit->dim; j++) -- a->push((*ainit)[j]); -- init = new CompoundStatement(0, a); -- } -- -- s = new TryFinallyStatement(0, this, sfinally); -- //printf("fi {{{\n"); -- s = s->semantic(sc); -- //printf("}}} fi\n"); -- this->relatedLabeled = s; -- statement = s; -- -- if (init) -- { Statements *a = init->flatten(sc); -- if (!a) -- (a = new Statements())->push(init); -- for (size_t j = 0; j < i + 1; j++) -- a->insert(j, (*ainit)[j]); -- init = new CompoundStatement(locinit, a); -- } -- break; -- } -+ if (LabelStatement *ls = checkLabeledLoop(sc, this)) -+ ls->gotoTarget = this; -+ relatedLabeled = s; - } -+ return s; - } -- if (!init) -- { // whole init semantic is completely done. -- init = new CompoundStatement(locinit, ainit); -- } -- -- --nest; -- return statement; --} -- --Statement *ForStatement::semantic(Scope *sc) --{ -- if (!nest) -- { ScopeDsymbol *sym = new ScopeDsymbol(); -- sym->parent = sc->scopesym; -- sc = sc->push(sym); -- } -- else if (init) -- { // Process this->init recursively -- return semanticInit(sc); -- } -+ assert(init == NULL); - -- Statement *statement = this; -- if (init) -- statement = semanticInit(sc); -+ ScopeDsymbol *sym = new ScopeDsymbol(); -+ sym->parent = sc->scopesym; -+ sc = sc->push(sym); - - sc->noctor++; - if (condition) -@@ -1403,10 +1319,14 @@ Statement *ForStatement::semantic(Scope - body = body->semanticNoScope(sc); - sc->noctor--; - -- if (!nest) -- sc->pop(); -- //if (!nest) statement->print(); -- return statement; -+ sc->pop(); -+ -+ if (condition && condition->op == TOKerror || -+ increment && increment->op == TOKerror || -+ body && body->isErrorStatement()) -+ return new ErrorStatement(); -+ -+ return this; - } - - Statement *ForStatement::scopeCode(Scope *sc, Statement **sentry, Statement **sexception, Statement **sfinally) -@@ -1427,11 +1347,6 @@ bool ForStatement::hasContinue() - return TRUE; - } - --bool ForStatement::usesEH() --{ -- return (init && init->usesEH()) || body->usesEH(); --} -- - int ForStatement::blockExit(bool mustNotThrow) - { int result = BEfallthru; - -@@ -1462,17 +1377,6 @@ int ForStatement::blockExit(bool mustNot - } - - --int ForStatement::comeFrom() --{ -- //printf("ForStatement::comeFrom()\n"); -- if (body) -- { int result = body->comeFrom(); -- //printf("result = %d\n", result); -- return result; -- } -- return FALSE; --} -- - void ForStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring("for ("); -@@ -1506,7 +1410,7 @@ void ForStatement::toCBuffer(OutBuffer * - - /******************************** ForeachStatement ***************************/ - --ForeachStatement::ForeachStatement(Loc loc, enum TOK op, Parameters *arguments, -+ForeachStatement::ForeachStatement(Loc loc, TOK op, Parameters *arguments, - Expression *aggr, Statement *body) - : Statement(loc) - { -@@ -1552,7 +1456,8 @@ Statement *ForeachStatement::semantic(Sc - if (!inferAggregate(sc, sapply)) - { - error("invalid foreach aggregate %s", aggr->toChars()); -- return this; -+ Lerror: -+ return new ErrorStatement(); - } - - /* Check for inference errors -@@ -1561,7 +1466,7 @@ Statement *ForeachStatement::semantic(Sc - { - //printf("dim = %d, arguments->dim = %d\n", dim, arguments->dim); - error("cannot uniquely infer foreach argument types"); -- return this; -+ goto Lerror; - } - - Type *tab = aggr->type->toBasetype(); -@@ -1571,30 +1476,24 @@ Statement *ForeachStatement::semantic(Sc - if (dim < 1 || dim > 2) - { - error("only one (value) or two (key,value) arguments for tuple foreach"); -- return s; -+ goto Lerror; - } - - Type *argtype = (*arguments)[dim-1]->type; - if (argtype) -- argtype = argtype->semantic(loc, sc); -+ { argtype = argtype->semantic(loc, sc); -+ if (argtype->ty == Terror) -+ goto Lerror; -+ } - - TypeTuple *tuple = (TypeTuple *)tab; - Statements *statements = new Statements(); - //printf("aggr: op = %d, %s\n", aggr->op, aggr->toChars()); - size_t n; - TupleExp *te = NULL; -- Expression *prelude = NULL; - if (aggr->op == TOKtuple) // expression tuple - { te = (TupleExp *)aggr; - n = te->exps->dim; -- -- if (te->exps->dim > 0 && (*te->exps)[0]->op == TOKdotvar && -- ((DotVarExp *)(*te->exps)[0])->e1->isTemp()) -- { -- CommaExp *ce = (CommaExp *)((DotVarExp *)(*te->exps)[0])->e1; -- prelude = ce->e1; -- ((DotVarExp *)(*te->exps)[0])->e1 = ce->e2; -- } - } - else if (aggr->op == TOKtype) // type tuple - { -@@ -1616,7 +1515,9 @@ Statement *ForeachStatement::semantic(Sc - if (dim == 2) - { // Declare key - if (arg->storageClass & (STCout | STCref | STClazy)) -- error("no storage class for key %s", arg->ident->toChars()); -+ { error("no storage class for key %s", arg->ident->toChars()); -+ goto Lerror; -+ } - arg->type = arg->type->semantic(loc, sc); - TY keyty = arg->type->ty; - if (keyty != Tint32 && keyty != Tuns32) -@@ -1624,12 +1525,16 @@ Statement *ForeachStatement::semantic(Sc - if (global.params.is64bit) - { - if (keyty != Tint64 && keyty != Tuns64) -- error("foreach: key type must be int or uint, long or ulong, not %s", arg->type->toChars()); -+ { error("foreach: key type must be int or uint, long or ulong, not %s", arg->type->toChars()); -+ goto Lerror; -+ } - } - else -- error("foreach: key type must be int or uint, not %s", arg->type->toChars()); -+ { error("foreach: key type must be int or uint, not %s", arg->type->toChars()); -+ goto Lerror; -+ } - } -- Initializer *ie = new ExpInitializer(0, new IntegerExp(k)); -+ Initializer *ie = new ExpInitializer(Loc(), new IntegerExp(k)); - VarDeclaration *var = new VarDeclaration(loc, arg->type, arg->ident, ie); - var->storage_class |= STCmanifest; - DeclarationExp *de = new DeclarationExp(loc, var); -@@ -1639,7 +1544,10 @@ Statement *ForeachStatement::semantic(Sc - // Declare value - if (arg->storageClass & (STCout | STClazy) || - arg->storageClass & STCref && !te) -+ { - error("no storage class for value %s", arg->ident->toChars()); -+ goto Lerror; -+ } - Dsymbol *var; - if (te) - { Type *tb = e->type->toBasetype(); -@@ -1655,29 +1563,37 @@ Statement *ForeachStatement::semantic(Sc - { - var = new AliasDeclaration(loc, arg->ident, s); - if (arg->storageClass & STCref) -- error("symbol %s cannot be ref", s->toChars()); -- if (argtype && argtype->ty != Terror) -- error("cannot specify element type for symbol %s", s->toChars()); -+ { error("symbol %s cannot be ref", s->toChars()); -+ goto Lerror; -+ } -+ if (argtype) -+ { error("cannot specify element type for symbol %s", s->toChars()); -+ goto Lerror; -+ } - } - else if (e->op == TOKtype) - { - var = new AliasDeclaration(loc, arg->ident, e->type); -- if (argtype && argtype->ty != Terror) -- error("cannot specify element type for type %s", e->type->toChars()); -+ if (argtype) -+ { error("cannot specify element type for type %s", e->type->toChars()); -+ goto Lerror; -+ } - } - else - { - arg->type = e->type; -- if (argtype && argtype->ty != Terror) -+ if (argtype) - arg->type = argtype; -- Initializer *ie = new ExpInitializer(0, e); -+ Initializer *ie = new ExpInitializer(Loc(), e); - VarDeclaration *v = new VarDeclaration(loc, arg->type, arg->ident, ie); - if (arg->storageClass & STCref) - v->storage_class |= STCref | STCforeach; - if (e->isConst() || e->op == TOKstring || - e->op == TOKstructliteral || e->op == TOKarrayliteral) - { if (v->storage_class & STCref) -- error("constant value %s cannot be ref", ie->toChars()); -+ { error("constant value %s cannot be ref", ie->toChars()); -+ goto Lerror; -+ } - else - v->storage_class |= STCmanifest; - } -@@ -1687,8 +1603,10 @@ Statement *ForeachStatement::semantic(Sc - else - { - var = new AliasDeclaration(loc, arg->ident, t); -- if (argtype && argtype->ty != Terror) -- error("cannot specify element type for symbol %s", s->toChars()); -+ if (argtype) -+ { error("cannot specify element type for symbol %s", s->toChars()); -+ goto Lerror; -+ } - } - DeclarationExp *de = new DeclarationExp(loc, var); - st->push(new ExpStatement(loc, de)); -@@ -1700,9 +1618,11 @@ Statement *ForeachStatement::semantic(Sc - } - - s = new UnrolledLoopStatement(loc, statements); -- if (prelude) -+ if (LabelStatement *ls = checkLabeledLoop(sc, this)) -+ ls->gotoTarget = s; -+ if (te && te->e0) - s = new CompoundStatement(loc, -- new ExpStatement(prelude->loc, prelude), s); -+ new ExpStatement(te->e0->loc, te->e0), s); - s = s->semantic(sc); - return s; - } -@@ -1724,7 +1644,7 @@ Lagain: - if (dim < 1 || dim > 2) - { - error("only one or two arguments for array foreach"); -- break; -+ goto Lerror2; - } - - /* Look for special case of parsing char types out of char type -@@ -1732,10 +1652,9 @@ Lagain: - */ - tn = tab->nextOf()->toBasetype(); - if (tn->ty == Tchar || tn->ty == Twchar || tn->ty == Tdchar) -- { Parameter *arg; -- -+ { - int i = (dim == 1) ? 0 : 1; // index of value -- arg = (*arguments)[i]; -+ Parameter *arg = (*arguments)[i]; - arg->type = arg->type->semantic(loc, sc); - arg->type = arg->type->addStorageClass(arg->storageClass); - tnv = arg->type->toBasetype(); -@@ -1743,11 +1662,15 @@ Lagain: - (tnv->ty == Tchar || tnv->ty == Twchar || tnv->ty == Tdchar)) - { - if (arg->storageClass & STCref) -- error("foreach: value of UTF conversion cannot be ref"); -+ { error("foreach: value of UTF conversion cannot be ref"); -+ goto Lerror2; -+ } - if (dim == 2) - { arg = (*arguments)[0]; - if (arg->storageClass & STCref) -- error("foreach: key cannot be ref"); -+ { error("foreach: key cannot be ref"); -+ goto Lerror2; -+ } - } - goto Lapply; - } -@@ -1770,11 +1693,12 @@ Lagain: - key = var; - if (arg->storageClass & STCref) - { -- if (!var->type->invariantOf()->equals(arg->type->invariantOf()) || -+ if (!var->type->immutableOf()->equals(arg->type->immutableOf()) || - !MODimplicitConv(var->type->mod, arg->type->mod)) - { - error("key type mismatch, %s to ref %s", - var->type->toChars(), arg->type->toChars()); -+ goto Lerror2; - } - } - } -@@ -1797,11 +1721,12 @@ Lagain: - var->storage_class |= STCconst; - - Type *t = tab->nextOf(); -- if (!t->invariantOf()->equals(arg->type->invariantOf()) || -+ if (!t->immutableOf()->equals(arg->type->immutableOf()) || - !MODimplicitConv(t->mod, arg->type->mod)) - { - error("argument type mismatch, %s to ref %s", - t->toChars(), arg->type->toChars()); -+ goto Lerror2; - } - } - } -@@ -1836,7 +1761,7 @@ Lagain: - if (op == TOKforeach_reverse) - key->init = new ExpInitializer(loc, tmp_length); - else -- key->init = new ExpInitializer(loc, new IntegerExp(0)); -+ key->init = new ExpInitializer(loc, new IntegerExp(loc, 0, NULL)); - - Statements *cs = new Statements(); - cs->push(new ExpStatement(loc, tmp)); -@@ -1854,7 +1779,7 @@ Lagain: - Expression *increment = NULL; - if (op == TOKforeach) - // key += 1 -- increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(1)); -+ increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(loc, 1, NULL)); - - // T value = tmp[key]; - value->init = new ExpInitializer(loc, new IndexExp(loc, new VarExp(loc, tmp), new VarExp(loc, key))); -@@ -1871,17 +1796,15 @@ Lagain: - { - ExpInitializer *ie = new ExpInitializer(loc, new IdentifierExp(loc, key->ident)); - VarDeclaration *v = new VarDeclaration(loc, arg->type, arg->ident, ie); --#if (BUG6652 == 1 || BUG6652 == 2) -- v->storage_class |= STCforeach | STCref | (arg->storageClass & STCref ? 0 : STCbug6652); --#else - v->storage_class |= STCforeach | (arg->storageClass & STCref); --#endif - body = new CompoundStatement(loc, new ExpStatement(loc, v), body); - } - } - body = new CompoundStatement(loc, ds, body); - - s = new ForStatement(loc, forinit, cond, increment, body); -+ if (LabelStatement *ls = checkLabeledLoop(sc, this)) -+ ls->gotoTarget = s; - s = s->semantic(sc); - break; - } -@@ -1926,7 +1849,7 @@ Lagain: - if (dim < 1 || dim > 2) - { - error("only one or two arguments for associative array foreach"); -- break; -+ goto Lerror2; - } - - /* This only works if Key or Value is a static array. -@@ -1964,7 +1887,7 @@ Lagain: - { idfront = Id::Fback; - idpopFront = Id::FpopBack; - } -- Dsymbol *sfront = ad->search(0, idfront, 0); -+ Dsymbol *sfront = ad->search(Loc(), idfront, 0); - if (!sfront) - goto Lapply; - -@@ -2057,6 +1980,8 @@ Lagain: - makeargs, this->body); - - s = new ForStatement(loc, init, condition, increment, forbody); -+ if (LabelStatement *ls = checkLabeledLoop(sc, this)) -+ ls->gotoTarget = s; - #if 0 - printf("init: %s\n", init->toChars()); - printf("condition: %s\n", condition->toChars()); -@@ -2068,7 +1993,7 @@ Lagain: - - Lrangeerr: - error("cannot infer argument types"); -- break; -+ goto Lerror2; - } - #endif - case Tdelegate: -@@ -2082,8 +2007,6 @@ Lagain: - return this; - } - -- Type *tret = func->type->nextOf(); -- - TypeFunction *tfld = NULL; - if (sapply) - { FuncDeclaration *fdapply = sapply->isFuncDeclaration(); -@@ -2127,7 +2050,9 @@ Lagain: - id = arg->ident; // argument copy is not need. - if ((arg->storageClass & STCref) != stc) - { if (!stc) -- error("foreach: cannot make %s ref", arg->ident->toChars()); -+ { error("foreach: cannot make %s ref", arg->ident->toChars()); -+ goto Lerror2; -+ } - goto LcopyArg; - } - } -@@ -2142,9 +2067,9 @@ Lagain: - LcopyArg: - id = Lexer::uniqueId("__applyArg", (int)i); - -- Initializer *ie = new ExpInitializer(0, new IdentifierExp(0, id)); -- VarDeclaration *v = new VarDeclaration(0, arg->type, arg->ident, ie); -- s = new ExpStatement(0, v); -+ Initializer *ie = new ExpInitializer(Loc(), new IdentifierExp(Loc(), id)); -+ VarDeclaration *v = new VarDeclaration(Loc(), arg->type, arg->ident, ie); -+ s = new ExpStatement(Loc(), v); - body = new CompoundStatement(loc, s, body); - } - args->push(new Parameter(stc, arg->type, id, NULL)); -@@ -2152,7 +2077,7 @@ Lagain: - tfld = new TypeFunction(args, Type::tint32, 0, LINKd); - cases = new Statements(); - gotos = new CompoundStatements(); -- FuncLiteralDeclaration *fld = new FuncLiteralDeclaration(loc, 0, tfld, TOKdelegate, this); -+ FuncLiteralDeclaration *fld = new FuncLiteralDeclaration(loc, Loc(), tfld, TOKdelegate, this); - fld->fbody = body; - Expression *flde = new FuncExp(loc, fld); - flde = flde->semantic(sc); -@@ -2166,7 +2091,7 @@ Lagain: - if (!gs->label->statement) - { // 'Promote' it to this scope, and replace with a return - cases->push(gs); -- s = new ReturnStatement(0, new IntegerExp(cases->dim + 1)); -+ s = new ReturnStatement(Loc(), new IntegerExp(cases->dim + 1)); - (*cs->statements)[0] = s; - } - } -@@ -2178,38 +2103,61 @@ Lagain: - if (dim == 2) - { - if (arg->storageClass & STCref) -- error("foreach: index cannot be ref"); -+ { error("foreach: index cannot be ref"); -+ goto Lerror2; -+ } - if (!arg->type->equals(taa->index)) -- error("foreach: index must be type %s, not %s", taa->index->toChars(), arg->type->toChars()); -+ { error("foreach: index must be type %s, not %s", taa->index->toChars(), arg->type->toChars()); -+ goto Lerror2; -+ } - arg = (*arguments)[1]; - } - if (!arg->type->equals(taa->nextOf())) -- error("foreach: value must be type %s, not %s", taa->nextOf()->toChars(), arg->type->toChars()); -- -+ { error("foreach: value must be type %s, not %s", taa->nextOf()->toChars(), arg->type->toChars()); -+ goto Lerror2; -+ } - /* Call: - * _aaApply(aggr, keysize, flde) - */ -- FuncDeclaration *fdapply; -- if (dim == 2) -- fdapply = FuncDeclaration::genCfunc(Type::tindex, "_aaApply2"); -- else -- fdapply = FuncDeclaration::genCfunc(Type::tindex, "_aaApply"); -- ec = new VarExp(0, fdapply); -+ static const char *name[2] = { "_aaApply", "_aaApply2" }; -+ static FuncDeclaration *fdapply[2] = { NULL, NULL }; -+ static TypeDelegate *fldeTy[2] = { NULL, NULL }; -+ -+ unsigned char i = dim == 2; -+ if (!fdapply[i]) { -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); -+ args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL)); -+ Parameters* dgargs = new Parameters; -+ dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); -+ if (dim == 2) -+ dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); -+ fldeTy[i] = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd)); -+ args->push(new Parameter(STCin, fldeTy[i], NULL, NULL)); -+ fdapply[i] = FuncDeclaration::genCfunc(args, Type::tint32, name[i]); -+ } -+ -+ ec = new VarExp(Loc(), fdapply[i]); - Expressions *exps = new Expressions(); - exps->push(aggr); - size_t keysize = taa->index->size(); - keysize = (keysize + ((size_t)Target::ptrsize-1)) & ~((size_t)Target::ptrsize-1); -- exps->push(new IntegerExp(0, keysize, Type::tsize_t)); -+ // paint delegate argument to the type runtime expects -+ if (!fldeTy[i]->equals(flde->type)) { -+ flde = new CastExp(loc, flde, flde->type); -+ flde->type = fldeTy[i]; -+ } -+ exps->push(new IntegerExp(Loc(), keysize, Type::tsize_t)); - exps->push(flde); - e = new CallExp(loc, ec, exps); -- e->type = Type::tindex; // don't run semantic() on e -+ e->type = Type::tint32; // don't run semantic() on e - } - else if (tab->ty == Tarray || tab->ty == Tsarray) - { - /* Call: - * _aApply(aggr, flde) - */ -- static char fntab[9][3] = -+ static const char fntab[9][3] = - { "cc","cw","cd", - "wc","cc","wd", - "dc","dw","dd" -@@ -2233,17 +2181,33 @@ Lagain: - } - const char *r = (op == TOKforeach_reverse) ? "R" : ""; - int j = sprintf(fdname, "_aApply%s%.*s%llu", r, 2, fntab[flag], (ulonglong)dim); -- assert(j < sizeof(fdname)); -- FuncDeclaration *fdapply = FuncDeclaration::genCfunc(Type::tindex, fdname); -+ assert(j < sizeof(fdname) / sizeof(fdname[0])); - -- ec = new VarExp(0, fdapply); -+ FuncDeclaration *fdapply; -+ TypeDelegate *dgty; -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, tn->arrayOf(), NULL, NULL)); -+ Parameters* dgargs = new Parameters; -+ dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); -+ if (dim == 2) -+ dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL)); -+ dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd)); -+ args->push(new Parameter(STCin, dgty, NULL, NULL)); -+ fdapply = FuncDeclaration::genCfunc(args, Type::tint32, fdname); -+ -+ ec = new VarExp(Loc(), fdapply); - Expressions *exps = new Expressions(); - if (tab->ty == Tsarray) - aggr = aggr->castTo(sc, tn->arrayOf()); - exps->push(aggr); -+ // paint delegate argument to the type runtime expects -+ if (!dgty->equals(flde->type)) { -+ flde = new CastExp(loc, flde, flde->type); -+ flde->type = dgty; -+ } - exps->push(flde); - e = new CallExp(loc, ec, exps); -- e->type = Type::tindex; // don't run semantic() on e -+ e->type = Type::tint32; // don't run semantic() on e - } - else if (tab->ty == Tdelegate) - { -@@ -2260,7 +2224,9 @@ Lagain: - e = new CallExp(loc, aggr, exps); - e = e->semantic(sc); - if (e->type != Type::tint32) -- error("opApply() function for %s must return an int", tab->toChars()); -+ { error("opApply() function for %s must return an int", tab->toChars()); -+ goto Lerror2; -+ } - } - else - { -@@ -2290,7 +2256,9 @@ Lagain: - e = new CallExp(loc, ec, exps); - e = e->semantic(sc); - if (e->type != Type::tint32) -- error("opApply() function for %s must return an int", tab->toChars()); -+ { error("opApply() function for %s must return an int", tab->toChars()); -+ goto Lerror2; -+ } - } - - if (!cases->dim) -@@ -2302,15 +2270,15 @@ Lagain: - Statements *a = new Statements(); - - // default: break; takes care of cases 0 and 1 -- s = new BreakStatement(0, NULL); -- s = new DefaultStatement(0, s); -+ s = new BreakStatement(Loc(), NULL); -+ s = new DefaultStatement(Loc(), s); - a->push(s); - - // cases 2... - for (size_t i = 0; i < cases->dim; i++) - { - s = (*cases)[i]; -- s = new CaseStatement(0, new IntegerExp(i + 2), s); -+ s = new CaseStatement(Loc(), new IntegerExp(i + 2), s); - a->push(s); - } - -@@ -2321,13 +2289,13 @@ Lagain: - break; - } - case Terror: -- s = NULL; -+ Lerror2: -+ s = new ErrorStatement(); - break; - - default: - error("foreach: %s is not an aggregate type", aggr->type->toChars()); -- s = NULL; // error recovery -- break; -+ goto Lerror2; - } - sc->noctor--; - sc->pop(); -@@ -2359,11 +2327,6 @@ bool ForeachStatement::hasContinue() - return TRUE; - } - --bool ForeachStatement::usesEH() --{ -- return body->usesEH(); --} -- - int ForeachStatement::blockExit(bool mustNotThrow) - { int result = BEfallthru; - -@@ -2378,13 +2341,6 @@ int ForeachStatement::blockExit(bool mus - } - - --int ForeachStatement::comeFrom() --{ -- if (body) -- return body->comeFrom(); -- return FALSE; --} -- - void ForeachStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring(Token::toChars(op)); -@@ -2395,8 +2351,7 @@ void ForeachStatement::toCBuffer(OutBuff - if (i) - buf->writestring(", "); - if (a->storageClass & STCref) -- buf->writestring((global.params.Dversion == 1) -- ? (char*)"inout " : (char*)"ref "); -+ buf->writestring((char*)"ref "); - if (a->type) - a->type->toCBuffer(buf, a->ident, hgs); - else -@@ -2420,7 +2375,7 @@ void ForeachStatement::toCBuffer(OutBuff - - #if DMDV2 - --ForeachRangeStatement::ForeachRangeStatement(Loc loc, enum TOK op, Parameter *arg, -+ForeachRangeStatement::ForeachRangeStatement(Loc loc, TOK op, Parameter *arg, - Expression *lwr, Expression *upr, Statement *body) - : Statement(loc) - { -@@ -2446,15 +2401,14 @@ Statement *ForeachRangeStatement::syntax - Statement *ForeachRangeStatement::semantic(Scope *sc) - { - //printf("ForeachRangeStatement::semantic() %p\n", this); -- Statement *s = this; -- - lwr = lwr->semantic(sc); - lwr = resolveProperties(sc, lwr); - lwr = lwr->optimize(WANTvalue); - if (!lwr->type) - { - error("invalid range lower bound %s", lwr->toChars()); -- return this; -+ Lerror: -+ return new ErrorStatement(); - } - - upr = upr->semantic(sc); -@@ -2463,7 +2417,7 @@ Statement *ForeachRangeStatement::semant - if (!upr->type) - { - error("invalid range upper bound %s", upr->toChars()); -- return this; -+ goto Lerror; - } - - if (arg->type) -@@ -2483,19 +2437,24 @@ Statement *ForeachRangeStatement::semant - /* Just picking the first really isn't good enough. - */ - arg->type = lwr->type; -- arg->type = arg->type->addStorageClass(arg->storageClass); -+ } -+ else if (lwr->type == upr->type) -+ { -+ /* Same logic as CondExp ?lwr:upr -+ */ -+ arg->type = lwr->type; - } - else - { - AddExp ea(loc, lwr, upr); - Expression *e = ea.typeCombine(sc); - arg->type = ea.type; -- arg->type = arg->type->addStorageClass(arg->storageClass); - lwr = ea.e1; - upr = ea.e2; - } -+ arg->type = arg->type->addStorageClass(arg->storageClass); - } --#if 1 -+ - /* Convert to a for loop: - * foreach (key; lwr .. upr) => - * for (auto key = lwr, auto tmp = upr; key < tmp; ++key) -@@ -2561,16 +2520,12 @@ Statement *ForeachRangeStatement::semant - { - ie = new ExpInitializer(loc, new IdentifierExp(loc, key->ident)); - VarDeclaration *v = new VarDeclaration(loc, arg->type, arg->ident, ie); --#if (BUG6652 == 1 || BUG6652 == 2) -- v->storage_class |= STCforeach | STCref | (arg->storageClass & STCref ? 0 : STCbug6652); --#else - v->storage_class |= STCforeach | (arg->storageClass & STCref); --#endif - body = new CompoundStatement(loc, new ExpStatement(loc, v), body); - } - if (arg->storageClass & STCref) - { -- if (!key->type->invariantOf()->equals(arg->type->invariantOf()) || -+ if (!key->type->immutableOf()->equals(arg->type->immutableOf()) || - !MODimplicitConv(key->type->mod, arg->type->mod)) - { - error("argument type mismatch, %s to ref %s", -@@ -2578,34 +2533,10 @@ Statement *ForeachRangeStatement::semant - } - } - -- ForStatement *fs = new ForStatement(loc, forinit, cond, increment, body); -- s = fs->semantic(sc); -- return s; --#else -- if (!arg->type->isscalar()) -- error("%s is not a scalar type", arg->type->toChars()); -- -- sym = new ScopeDsymbol(); -- sym->parent = sc->scopesym; -- sc = sc->push(sym); -- -- sc->noctor++; -- -- key = new VarDeclaration(loc, arg->type, arg->ident, NULL); -- DeclarationExp *de = new DeclarationExp(loc, key); -- de->semantic(sc); -- -- if (key->storage_class) -- error("foreach range: key cannot have storage class"); -- -- sc->sbreak = this; -- sc->scontinue = this; -- body = body->semantic(sc); -- -- sc->noctor--; -- sc->pop(); -- return s; --#endif -+ ForStatement *s = new ForStatement(loc, forinit, cond, increment, body); -+ if (LabelStatement *ls = checkLabeledLoop(sc, this)) -+ ls->gotoTarget = s; -+ return s->semantic(sc); - } - - bool ForeachRangeStatement::hasBreak() -@@ -2618,12 +2549,6 @@ bool ForeachRangeStatement::hasContinue( - return TRUE; - } - --bool ForeachRangeStatement::usesEH() --{ -- assert(global.errors); -- return body->usesEH(); --} -- - int ForeachRangeStatement::blockExit(bool mustNotThrow) - { - assert(global.errors); -@@ -2631,12 +2556,6 @@ int ForeachRangeStatement::blockExit(boo - } - - --int ForeachRangeStatement::comeFrom() --{ -- assert(global.errors); -- return FALSE; --} -- - void ForeachRangeStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring(Token::toChars(op)); -@@ -2697,21 +2616,23 @@ Statement *IfStatement::semantic(Scope * - // Evaluate at runtime - unsigned cs0 = sc->callSuper; - unsigned cs1; -+ unsigned *fi0 = fi0 = sc->saveFieldInit(); -+ unsigned *fi1 = NULL; - -- Scope *scd; -+ ScopeDsymbol *sym = new ScopeDsymbol(); -+ sym->parent = sc->scopesym; -+ Scope *scd = sc->push(sym); - if (arg) - { /* Declare arg, which we will set to be the - * result of condition. - */ -- ScopeDsymbol *sym = new ScopeDsymbol(); -- sym->parent = sc->scopesym; -- scd = sc->push(sym); - - match = new VarDeclaration(loc, arg->type, arg->ident, new ExpInitializer(loc, condition)); - match->parent = sc->func; -+ match->storage_class |= arg->storageClass; - - DeclarationExp *de = new DeclarationExp(loc, match); -- VarExp *ve = new VarExp(0, match); -+ VarExp *ve = new VarExp(Loc(), match); - condition = new CommaExp(loc, de, ve); - condition = condition->semantic(scd); - -@@ -2728,7 +2649,6 @@ Statement *IfStatement::semantic(Scope * - condition = condition->semantic(sc); - condition = condition->addDtorHook(sc); - condition = resolveProperties(sc, condition); -- scd = sc->push(); - } - - // Convert to boolean after declaring arg so this works: -@@ -2744,19 +2664,23 @@ Statement *IfStatement::semantic(Scope * - scd->pop(); - - cs1 = sc->callSuper; -+ fi1 = sc->fieldinit; - sc->callSuper = cs0; -+ sc->fieldinit = fi0; - if (elsebody) - elsebody = elsebody->semanticScope(sc, NULL, NULL); - sc->mergeCallSuper(loc, cs1); -+ sc->mergeFieldInit(loc, fi1); - -+ if (condition->op == TOKerror || -+ (ifbody && ifbody->isErrorStatement()) || -+ (elsebody && elsebody->isErrorStatement())) -+ { -+ return new ErrorStatement(); -+ } - return this; - } - --bool IfStatement::usesEH() --{ -- return (ifbody && ifbody->usesEH()) || (elsebody && elsebody->usesEH()); --} -- - int IfStatement::blockExit(bool mustNotThrow) - { - //printf("IfStatement::blockExit(%p)\n", this); -@@ -2898,11 +2822,6 @@ Statements *ConditionalStatement::flatte - return a; - } - --bool ConditionalStatement::usesEH() --{ -- return (ifbody && ifbody->usesEH()) || (elsebody && elsebody->usesEH()); --} -- - int ConditionalStatement::blockExit(bool mustNotThrow) - { - int result = ifbody->blockExit(mustNotThrow); -@@ -2971,10 +2890,12 @@ Statement *PragmaStatement::semantic(Sco - { - Expression *e = (*args)[i]; - -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -- if (e->op != TOKerror && e->op != TOKtype) -- e = e->ctfeInterpret(); -+ sc = sc->endCTFE(); -+ // pragma(msg) is allowed to contain types as well as expressions -+ e = ctfeInterpretForPragmaMsg(e); - if (e->op == TOKerror) - { errorSupplemental(loc, "while evaluating pragma(msg, %s)", (*args)[i]->toChars()); - goto Lerror; -@@ -2982,12 +2903,12 @@ Statement *PragmaStatement::semantic(Sco - StringExp *se = e->toString(); - if (se) - { -- fprintf(stdmsg, "%.*s", (int)se->len, (char *)se->string); -+ fprintf(stderr, "%.*s", (int)se->len, (char *)se->string); - } - else -- fprintf(stdmsg, "%s", e->toChars()); -+ fprintf(stderr, "%s", e->toChars()); - } -- fprintf(stdmsg, "\n"); -+ fprintf(stderr, "\n"); - } - } - else if (ident == Id::lib) -@@ -3003,8 +2924,11 @@ Statement *PragmaStatement::semantic(Sco - { - Expression *e = (*args)[0]; - -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - e = e->ctfeInterpret(); - (*args)[0] = e; - StringExp *se = e->toString(); -@@ -3015,7 +2939,7 @@ Statement *PragmaStatement::semantic(Sco - char *name = (char *)mem.malloc(se->len + 1); - memcpy(name, se->string, se->len); - name[se->len] = 0; -- printf("library %s\n", name); -+ fprintf(global.stdmsg, "library %s\n", name); - mem.free(name); - } - } -@@ -3029,8 +2953,12 @@ Statement *PragmaStatement::semantic(Sco - else - { - Expression *e = (*args)[0]; -+ -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); -+ - e = e->ctfeInterpret(); - (*args)[0] = e; - Dsymbol *sa = getDsymbol(e); -@@ -3054,11 +2982,6 @@ Lerror: - return body; - } - --bool PragmaStatement::usesEH() --{ -- return body && body->usesEH(); --} -- - int PragmaStatement::blockExit(bool mustNotThrow) - { - int result = BEfallthru; -@@ -3179,8 +3102,9 @@ Statement *SwitchStatement::semantic(Sco - condition->type = condition->type->constOf(); - } - else -- { condition = condition->integralPromotions(sc); -- if (!condition->type->isintegral()) -+ { -+ condition = condition->integralPromotions(sc); -+ if (condition->op != TOKerror && !condition->type->isintegral()) - error("'%s' must be of integral or string type, it is a %s", condition->toChars(), condition->type->toChars()); - } - condition = condition->optimize(WANTvalue); -@@ -3249,8 +3173,11 @@ Statement *SwitchStatement::semantic(Sco - if (em) - { - for (size_t j = 0; j < cases->dim; j++) -- { CaseStatement *cs = (*cases)[j]; -- if (cs->exp->equals(em->value) || cs->exp->toInteger() == em->value->toInteger()) -+ { -+ CaseStatement *cs = (*cases)[j]; -+ if (cs->exp->equals(em->value) || -+ (!cs->exp->type->isString() && !em->value->type->isString() && -+ cs->exp->toInteger() == em->value->toInteger())) - goto L1; - } - error("enum member %s not represented in final switch", em->toChars()); -@@ -3267,7 +3194,7 @@ Statement *SwitchStatement::semantic(Sco - if (!sc->sw->sdefault && (!isFinal || needswitcherror || global.params.useAssert)) - { hasNoDefault = 1; - -- if (!isFinal) -+ if (!isFinal && !body->isErrorStatement()) - deprecation("non-final switch statement without a default is deprecated"); - - // Generate runtime error if the default is hit -@@ -3286,7 +3213,7 @@ Statement *SwitchStatement::semantic(Sco - sc->sw->sdefault = new DefaultStatement(loc, s); - a->push(body); - if (body->blockExit(FALSE) & BEfallthru) -- a->push(new BreakStatement(0, NULL)); -+ a->push(new BreakStatement(Loc(), NULL)); - a->push(sc->sw->sdefault); - cs = new CompoundStatement(loc, a); - body = cs; -@@ -3301,11 +3228,6 @@ bool SwitchStatement::hasBreak() - return TRUE; - } - --bool SwitchStatement::usesEH() --{ -- return body ? body->usesEH() : 0; --} -- - int SwitchStatement::blockExit(bool mustNotThrow) - { int result = BEnone; - if (condition->canThrow(mustNotThrow)) -@@ -3368,11 +3290,14 @@ Statement *CaseStatement::syntaxCopy() - } - - Statement *CaseStatement::semantic(Scope *sc) --{ SwitchStatement *sw = sc->sw; -+{ -+ SwitchStatement *sw = sc->sw; - - //printf("CaseStatement::semantic() %s\n", toChars()); -+ sc = sc->startCTFE(); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); -+ sc = sc->endCTFE(); - if (sw) - { - exp = exp->implicitCastTo(sc, sw->condition->type); -@@ -3438,7 +3363,7 @@ Statement *CaseStatement::semantic(Scope - return this; - } - --int CaseStatement::compare(Object *obj) -+int CaseStatement::compare(RootObject *obj) - { - // Sort cases so we can do an efficient lookup - CaseStatement *cs2 = (CaseStatement *)(obj); -@@ -3446,22 +3371,12 @@ int CaseStatement::compare(Object *obj) - return exp->compare(cs2->exp); - } - --bool CaseStatement::usesEH() --{ -- return statement->usesEH(); --} -- - int CaseStatement::blockExit(bool mustNotThrow) - { - return statement->blockExit(mustNotThrow); - } - - --int CaseStatement::comeFrom() --{ -- return TRUE; --} -- - void CaseStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring("case "); -@@ -3494,17 +3409,27 @@ Statement *CaseRangeStatement::syntaxCop - Statement *CaseRangeStatement::semantic(Scope *sc) - { SwitchStatement *sw = sc->sw; - -+ if (sw == NULL) -+ { -+ error("case range not in switch statement"); -+ return NULL; -+ } -+ - //printf("CaseRangeStatement::semantic() %s\n", toChars()); - if (sw->isFinal) - error("case ranges not allowed in final switch"); - -+ sc = sc->startCTFE(); - first = first->semantic(sc); - first = resolveProperties(sc, first); -+ sc = sc->endCTFE(); - first = first->implicitCastTo(sc, sw->condition->type); - first = first->ctfeInterpret(); - -+ sc = sc->startCTFE(); - last = last->semantic(sc); - last = resolveProperties(sc, last); -+ sc = sc->endCTFE(); - last = last->implicitCastTo(sc, sw->condition->type); - last = last->ctfeInterpret(); - -@@ -3606,22 +3531,12 @@ Statement *DefaultStatement::semantic(Sc - return this; - } - --bool DefaultStatement::usesEH() --{ -- return statement->usesEH(); --} -- - int DefaultStatement::blockExit(bool mustNotThrow) - { - return statement->blockExit(mustNotThrow); - } - - --int DefaultStatement::comeFrom() --{ -- return TRUE; --} -- - void DefaultStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring("default:"); -@@ -3764,7 +3679,12 @@ Statement *ReturnStatement::semantic(Sco - if (fd->fes) - fd = fd->fes->func; // fd is now function enclosing foreach - -- Type *tret = fd->type->nextOf(); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ assert(tf->ty == Tfunction); -+ bool isRefReturn = tf->isref && !(fd->storage_class & STCauto); -+ // Until 'ref' deduction finished, 'auto ref' is treated as a 'value return'. -+ -+ Type *tret = tf->next; - if (fd->tintro) - /* We'll be implicitly casting the return expression to tintro - */ -@@ -3791,7 +3711,7 @@ Statement *ReturnStatement::semantic(Sco - // return this; - if (exp && exp->op != TOKthis) - error("cannot return expression from constructor"); -- exp = new ThisExp(0); -+ exp = new ThisExp(Loc()); - exp->type = tret; - } - -@@ -3809,30 +3729,30 @@ Statement *ReturnStatement::semantic(Sco - exp = exp->inferType(fld->treq->nextOf()->nextOf()); - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); -- if (!((TypeFunction *)fd->type)->isref) -+ // Until 'ref' deduction finished, don't invoke constant folding -+ if (!tf->isref) - exp = exp->optimize(WANTvalue); - -+ if (Expression *e = exp->isTemp()) -+ exp = e; // don't need temporary - if (exp->op == TOKcall) -- valueNoDtor(exp); -- else -- { -- Expression *e = exp->isTemp(); -- if (e) -- exp = e; // don't need temporary -- } -+ exp = valueNoDtor(exp); - - if (fd->nrvo_can && exp->op == TOKvar) -- { VarExp *ve = (VarExp *)exp; -+ { -+ VarExp *ve = (VarExp *)exp; - VarDeclaration *v = ve->var->isVarDeclaration(); - -- if (((TypeFunction *)fd->type)->isref) -+ if (isRefReturn) - // Function returns a reference - fd->nrvo_can = 0; - else if (!v || v->isOut() || v->isRef()) - fd->nrvo_can = 0; - else if (fd->nrvo_var == NULL) -- { if (!v->isDataseg() && !v->isParameter() && v->toParent2() == fd) -- { //printf("Setting nrvo to %s\n", v->toChars()); -+ { -+ if (!v->isDataseg() && !v->isParameter() && v->toParent2() == fd) -+ { -+ //printf("Setting nrvo to %s\n", v->toChars()); - fd->nrvo_var = v; - } - else -@@ -3844,15 +3764,8 @@ Statement *ReturnStatement::semantic(Sco - else - fd->nrvo_can = 0; - -- if (!fd->nrvo_can && -- exp->isLvalue() && !((TypeFunction *)fd->type)->isref) -- { -- exp = callCpCtor(exp->loc, sc, exp, 1); -- } -- - if (fd->inferRetType) -- { TypeFunction *tf = (TypeFunction *)fd->type; -- assert(tf->ty == Tfunction); -+ { - Type *tfret = tf->nextOf(); - if (tfret) - { -@@ -3871,7 +3784,7 @@ Statement *ReturnStatement::semantic(Sco - tf->next = exp->type; - else if (m1 && !m2) - ; -- else -+ else if (exp->op != TOKerror) - error("mismatched function return type inference of %s and %s", - exp->type->toChars(), tfret->toChars()); - } -@@ -3898,21 +3811,26 @@ Statement *ReturnStatement::semantic(Sco - unsigned errors = global.startGagging(); - exp->checkEscapeRef(); - if (global.endGagging(errors)) -- tf->isref = FALSE; // return by value -+ tf->isref = false; // return by value - } - else -- tf->isref = FALSE; // return by value -+ tf->isref = false; // return by value - fd->storage_class &= ~STCauto; -+ -+ isRefReturn = tf->isref; // 'ref' deduction finished -+ if (!isRefReturn) -+ exp = exp->optimize(WANTvalue); - } - tf->next = exp->type; - //fd->type = tf->semantic(loc, sc); // Removed with 6902 - if (!fd->tintro) -- { tret = fd->type->nextOf(); -+ { -+ tret = tf->next; - tbret = tret->toBasetype(); - } - } - if (fd->returnLabel) -- eorg = exp; -+ eorg = exp->copy(); - - if (!fd->returns) - fd->returns = new ReturnStatements(); -@@ -3920,38 +3838,41 @@ Statement *ReturnStatement::semantic(Sco - } - else if (tbret->ty != Tvoid) - { -- assert(fd->type->ty == Tfunction); -- TypeFunction *tf = (TypeFunction *)fd->type; -- if (fd->isPureBypassingInference() != PUREimpure && -- !tf->hasMutableIndirectionParams() && -- !exp->type->implicitConvTo(tret) && -- exp->type->invariantOf()->implicitConvTo(tret)) -+ if (!exp->type->implicitConvTo(tret) && -+ fd->parametersIntersect(exp->type)) - { -- exp = exp->castTo(sc, exp->type->invariantOf()); -+ if (exp->type->immutableOf()->implicitConvTo(tret)) -+ exp = exp->castTo(sc, exp->type->immutableOf()); -+ else if (exp->type->wildOf()->implicitConvTo(tret)) -+ exp = exp->castTo(sc, exp->type->wildOf()); - } - if (fd->tintro) -- exp = exp->implicitCastTo(sc, fd->type->nextOf()); -+ exp = exp->implicitCastTo(sc, tf->next); - - // eorg isn't casted to tret (== fd->tintro->nextOf()) - if (fd->returnLabel) - eorg = exp->copy(); - exp = exp->implicitCastTo(sc, tret); - -- if (!((TypeFunction *)fd->type)->isref) -+ if (!isRefReturn) - exp = exp->optimize(WANTvalue); -+ -+ if (!fd->returns) -+ fd->returns = new ReturnStatements(); -+ fd->returns->push(this); - } - } - else if (fd->inferRetType) - { -- if (fd->type->nextOf()) -+ if (tf->next) - { -- if (fd->type->nextOf()->ty != Tvoid) -+ if (tf->next->ty != Tvoid) - error("mismatched function return type inference of void and %s", -- fd->type->nextOf()->toChars()); -+ tf->next->toChars()); - } - else - { -- ((TypeFunction *)fd->type)->next = Type::tvoid; -+ tf->next = Type::tvoid; - //fd->type = fd->type->semantic(loc, sc); // Remove with7321, same as 6902 - if (!fd->tintro) - { tret = Type::tvoid; -@@ -3977,16 +3898,16 @@ Statement *ReturnStatement::semantic(Sco - { - sc->fes->cases->push(this); - // Construct: return cases->dim+1; -- s = new ReturnStatement(0, new IntegerExp(sc->fes->cases->dim + 1)); -+ s = new ReturnStatement(Loc(), new IntegerExp(sc->fes->cases->dim + 1)); - } -- else if (fd->type->nextOf()->toBasetype() == Type::tvoid) -+ else if (tf->next->toBasetype() == Type::tvoid) - { -- s = new ReturnStatement(0, NULL); -+ s = new ReturnStatement(Loc(), NULL); - sc->fes->cases->push(s); - - // Construct: { exp; return cases->dim + 1; } - Statement *s1 = new ExpStatement(loc, exp); -- Statement *s2 = new ReturnStatement(0, new IntegerExp(sc->fes->cases->dim + 1)); -+ Statement *s2 = new ReturnStatement(Loc(), new IntegerExp(sc->fes->cases->dim + 1)); - s = new CompoundStatement(loc, s1, s2); - } - else -@@ -4000,7 +3921,7 @@ Statement *ReturnStatement::semantic(Sco - VarDeclaration *v = new VarDeclaration(loc, tret, fd->outId, NULL); - v->noscope = 1; - v->storage_class |= STCresult; -- if (((TypeFunction *)fd->type)->isref) -+ if (isRefReturn) - v->storage_class |= STCref | STCforeach; - v->semantic(sco); - if (!sco->insert(v)) -@@ -4009,14 +3930,14 @@ Statement *ReturnStatement::semantic(Sco - fd->vresult = v; - } - -- s = new ReturnStatement(0, new VarExp(0, fd->vresult)); -+ s = new ReturnStatement(Loc(), new VarExp(Loc(), fd->vresult)); - sc->fes->cases->push(s); - - // Construct: { vresult = exp; return cases->dim + 1; } -- exp = new ConstructExp(loc, new VarExp(0, fd->vresult), exp); -+ exp = new ConstructExp(loc, new VarExp(Loc(), fd->vresult), exp); - exp = exp->semantic(sc); - Statement *s1 = new ExpStatement(loc, exp); -- Statement *s2 = new ReturnStatement(0, new IntegerExp(sc->fes->cases->dim + 1)); -+ Statement *s2 = new ReturnStatement(Loc(), new IntegerExp(sc->fes->cases->dim + 1)); - s = new CompoundStatement(loc, s1, s2); - } - return s; -@@ -4024,7 +3945,7 @@ Statement *ReturnStatement::semantic(Sco - - if (exp) - { -- if (((TypeFunction *)fd->type)->isref && !fd->isCtorDeclaration()) -+ if (isRefReturn && !fd->isCtorDeclaration()) - { // Function returns a reference - exp = exp->toLvalue(sc, exp); - exp->checkEscapeRef(); -@@ -4039,7 +3960,7 @@ Statement *ReturnStatement::semantic(Sco - if (fd->returnLabel && tbret->ty != Tvoid) - { - fd->buildResultVar(); -- VarExp *v = new VarExp(0, fd->vresult); -+ VarExp *v = new VarExp(Loc(), fd->vresult); - - assert(eorg); - exp = new ConstructExp(loc, v, eorg); -@@ -4051,8 +3972,23 @@ Statement *ReturnStatement::semantic(Sco - if (sc->callSuper & CSXany_ctor && - !(sc->callSuper & (CSXthis_ctor | CSXsuper_ctor))) - error("return without calling constructor"); -- - sc->callSuper |= CSXreturn; -+ if (sc->fieldinit) -+ { -+ AggregateDeclaration *ad = fd->isAggregateMember2(); -+ assert(ad); -+ size_t dim = sc->fieldinit_dim; -+ for (size_t i = 0; i < dim; i++) -+ { -+ VarDeclaration *v = ad->fields[i]; -+ bool mustInit = (v->storage_class & STCnodefaultctor || -+ v->type->needsNested()); -+ if (mustInit && !(sc->fieldinit[i] & CSXthis_ctor)) -+ error("an earlier return statement skips field %s initialization", v->toChars()); -+ -+ sc->fieldinit[i] |= CSXreturn; -+ } -+ } - - // See if all returns are instead to be replaced with a goto returnLabel; - if (fd->returnLabel) -@@ -4064,7 +4000,7 @@ Statement *ReturnStatement::semantic(Sco - { /* Replace: return exp; - * with: exp; goto returnLabel; - */ -- Statement *s = new ExpStatement(0, exp); -+ Statement *s = new ExpStatement(Loc(), exp); - return new CompoundStatement(loc, s, gs); - } - return gs; -@@ -4072,19 +4008,20 @@ Statement *ReturnStatement::semantic(Sco - - if (exp && tbret->ty == Tvoid && !implicit0) - { -+ if (exp->type->ty != Tvoid) -+ { -+ error("cannot return non-void from void function"); -+ } -+ - /* Replace: - * return exp; - * with: -- * exp; return; -+ * cast(void)exp; return; - */ -- Statement *s = new ExpStatement(loc, exp); -+ Expression *ce = new CastExp(loc, exp, Type::tvoid); -+ Statement *s = new ExpStatement(loc, ce); - s = s->semantic(sc); - -- if (exp->type->ty != Tvoid) -- { -- error("cannot return non-void from void function"); -- } -- - exp = NULL; - return new CompoundStatement(loc, s, this); - } -@@ -4133,13 +4070,10 @@ Statement *BreakStatement::semantic(Scop - { - ident = fixupLabelName(sc, ident); - -- Scope *scx; - FuncDeclaration *thisfunc = sc->func; - -- for (scx = sc; scx; scx = scx->enclosing) -+ for (Scope *scx = sc; scx; scx = scx->enclosing) - { -- LabelStatement *ls; -- - if (scx->func != thisfunc) // if in enclosing function - { - if (sc->fes) // if this is the body of a foreach -@@ -4151,38 +4085,40 @@ Statement *BreakStatement::semantic(Scop - * Case numbers start with 2, not 0, as 0 is continue - * and 1 is break. - */ -- Statement *s; - sc->fes->cases->push(this); -- s = new ReturnStatement(0, new IntegerExp(sc->fes->cases->dim + 1)); -+ Statement *s = new ReturnStatement(Loc(), new IntegerExp(sc->fes->cases->dim + 1)); - return s; - } - break; // can't break to it - } - -- ls = scx->slabel; -+ LabelStatement *ls = scx->slabel; - if (ls && ls->ident == ident) - { - Statement *s = ls->statement; - - if (!s->hasBreak()) - error("label '%s' has no break", ident->toChars()); -- if (ls->tf != sc->tf) -+ else if (ls->tf != sc->tf) - error("cannot break out of finally block"); -- return this; -+ else -+ return this; -+ return new ErrorStatement(); - } - } - error("enclosing label '%s' for break not found", ident->toChars()); -+ return new ErrorStatement(); - } - else if (!sc->sbreak) - { - if (sc->fes) -- { Statement *s; -- -+ { - // Replace break; with return 1; -- s = new ReturnStatement(0, new IntegerExp(1)); -+ Statement *s = new ReturnStatement(Loc(), new IntegerExp(1)); - return s; - } - error("break is not inside a loop or switch"); -+ return new ErrorStatement(); - } - return this; - } -@@ -4243,7 +4179,7 @@ Statement *ContinueStatement::semantic(S - if (ls && ls->ident == ident && ls->statement == sc->fes) - { - // Replace continue ident; with return 0; -- return new ReturnStatement(0, new IntegerExp(0)); -+ return new ReturnStatement(Loc(), new IntegerExp(0)); - } - } - -@@ -4254,9 +4190,8 @@ Statement *ContinueStatement::semantic(S - * Case numbers start with 2, not 0, as 0 is continue - * and 1 is break. - */ -- Statement *s; - sc->fes->cases->push(this); -- s = new ReturnStatement(0, new IntegerExp(sc->fes->cases->dim + 1)); -+ Statement *s = new ReturnStatement(Loc(), new IntegerExp(sc->fes->cases->dim + 1)); - return s; - } - break; // can't continue to it -@@ -4269,20 +4204,22 @@ Statement *ContinueStatement::semantic(S - - if (!s->hasContinue()) - error("label '%s' has no continue", ident->toChars()); -- if (ls->tf != sc->tf) -+ else if (ls->tf != sc->tf) - error("cannot continue out of finally block"); -- return this; -+ else -+ return this; -+ return new ErrorStatement(); - } - } - error("enclosing label '%s' for continue not found", ident->toChars()); -+ return new ErrorStatement(); - } - else if (!sc->scontinue) - { - if (sc->fes) -- { Statement *s; -- -+ { - // Replace continue; with return 0; -- s = new ReturnStatement(0, new IntegerExp(0)); -+ Statement *s = new ReturnStatement(Loc(), new IntegerExp(0)); - return s; - } - error("continue is not inside a loop"); -@@ -4342,7 +4279,10 @@ Statement *SynchronizedStatement::semant - goto Lbody; - ClassDeclaration *cd = exp->type->isClassHandle(); - if (!cd) -+ { - error("can only synchronize on class objects, not '%s'", exp->type->toChars()); -+ return new ErrorStatement(); -+ } - else if (cd->isInterfaceDeclaration()) - { /* Cast the interface to an object, as the object has the monitor, - * not the interface. -@@ -4354,7 +4294,7 @@ Statement *SynchronizedStatement::semant - } - - Type *t = ClassDeclaration::object->type; -- t = t->semantic(0, sc)->toBasetype(); -+ t = t->semantic(Loc(), sc)->toBasetype(); - assert(t->ty == Tclass); - - exp = new CastExp(loc, exp, t); -@@ -4374,12 +4314,15 @@ Statement *SynchronizedStatement::semant - Statements *cs = new Statements(); - cs->push(new ExpStatement(loc, tmp)); - -- FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::monitorenter); -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, ClassDeclaration::object->type, NULL, NULL)); -+ -+ FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::monitorenter); - Expression *e = new CallExp(loc, new VarExp(loc, fdenter), new VarExp(loc, tmp)); - e->type = Type::tvoid; // do not run semantic on e - cs->push(new ExpStatement(loc, e)); - -- FuncDeclaration *fdexit = FuncDeclaration::genCfunc(Type::tvoid, Id::monitorexit); -+ FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::monitorexit); - e = new CallExp(loc, new VarExp(loc, fdexit), new VarExp(loc, tmp)); - e->type = Type::tvoid; // do not run semantic on e - Statement *s = new ExpStatement(loc, e); -@@ -4405,14 +4348,17 @@ Statement *SynchronizedStatement::semant - Statements *cs = new Statements(); - cs->push(new ExpStatement(loc, tmp)); - -- FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalenter); -+ Parameters* args = new Parameters; -+ args->push(new Parameter(STCin, t->pointerTo(), NULL, NULL)); -+ -+ FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalenter); - Expression *e = new DotIdExp(loc, new VarExp(loc, tmp), Id::ptr); - e = e->semantic(sc); - e = new CallExp(loc, new VarExp(loc, fdenter), e); - e->type = Type::tvoid; // do not run semantic on e - cs->push(new ExpStatement(loc, e)); - -- FuncDeclaration *fdexit = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalexit); -+ FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalexit); - e = new DotIdExp(loc, new VarExp(loc, tmp), Id::ptr); - e = e->semantic(sc); - e = new CallExp(loc, new VarExp(loc, fdexit), e); -@@ -4428,6 +4374,8 @@ Statement *SynchronizedStatement::semant - Lbody: - if (body) - body = body->semantic(sc); -+ if (body && body->isErrorStatement()) -+ return body; - return this; - } - -@@ -4441,11 +4389,6 @@ bool SynchronizedStatement::hasContinue( - return FALSE; //TRUE; - } - --bool SynchronizedStatement::usesEH() --{ -- return TRUE; --} -- - int SynchronizedStatement::blockExit(bool mustNotThrow) - { - return body ? body->blockExit(mustNotThrow) : BEfallthru; -@@ -4491,7 +4434,7 @@ Statement *WithStatement::semantic(Scope - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); - if (exp->op == TOKerror) -- return NULL; -+ return new ErrorStatement(); - if (exp->op == TOKimport) - { ScopeExp *es = (ScopeExp *)exp; - -@@ -4504,13 +4447,21 @@ Statement *WithStatement::semantic(Scope - sym = s ? s->isScopeDsymbol() : NULL; - if (!sym) - { error("with type %s has no members", es->toChars()); -- if (body) -- body = body->semantic(sc); -- return this; -+ return new ErrorStatement(); - } - } - else -- { Type *t = exp->type; -+ { -+ Type *t = exp->type; -+ t = t->toBasetype(); -+ -+ Expression *olde = exp; -+ if (t->ty == Tpointer) -+ { -+ exp = new PtrExp(loc, exp); -+ exp = exp->semantic(sc); -+ t = exp->type->toBasetype(); -+ } - - assert(t); - t = t->toBasetype(); -@@ -4537,19 +4488,25 @@ Statement *WithStatement::semantic(Scope - wthis = new VarDeclaration(loc, e->type, Id::withSym, init); - wthis->semantic(sc); - sym = new WithScopeSymbol(this); -+ // Need to set the scope to make use of resolveAliasThis -+ sym->setScope(sc); - sym->parent = sc->scopesym; - } - else -- { error("with expressions must be aggregate types, not '%s'", exp->type->toChars()); -- return NULL; -+ { -+ error("with expressions must be aggregate types or pointers to them, not '%s'", olde->type->toChars()); -+ return new ErrorStatement(); - } - } -- sc = sc->push(sym); - - if (body) -+ { -+ sc = sc->push(sym); - body = body->semantic(sc); -- -- sc->pop(); -+ sc->pop(); -+ if (body && body->isErrorStatement()) -+ return body; -+ } - - return this; - } -@@ -4564,11 +4521,6 @@ void WithStatement::toCBuffer(OutBuffer - body->toCBuffer(buf, hgs); - } - --bool WithStatement::usesEH() --{ -- return body ? body->usesEH() : 0; --} -- - int WithStatement::blockExit(bool mustNotThrow) - { - int result = BEnone; -@@ -4608,12 +4560,20 @@ Statement *TryCatchStatement::syntaxCopy - Statement *TryCatchStatement::semantic(Scope *sc) - { - body = body->semanticScope(sc, NULL /*this*/, NULL); -+#ifdef IN_GCC -+ assert(body); -+#endif - - /* Even if body is NULL, still do semantic analysis on catches - */ -+ bool catchErrors = false; - for (size_t i = 0; i < catches->dim; i++) - { Catch *c = (*catches)[i]; - c->semantic(sc); -+ if (c->type->ty == Terror) -+ { catchErrors = true; -+ continue; -+ } - - // Determine if current catch 'hides' any previous catches - for (size_t j = 0; j < i; j++) -@@ -4622,27 +4582,25 @@ Statement *TryCatchStatement::semantic(S - char *sj = cj->loc.toChars(); - - if (c->type->toBasetype()->implicitConvTo(cj->type->toBasetype())) -- error("catch at %s hides catch at %s", sj, si); -- } -- } -- --#ifdef IN_GCC -- if (!body || body->isEmpty()) -- { -- for (size_t i = 0; i < catches->dim; i++) -- { -- Catch *c = (*catches)[i]; -- if (!c->handler || !c->handler->comeFrom()) - { -- catches->remove(i); -- --i; -+ error("catch at %s hides catch at %s", sj, si); -+ catchErrors = true; - } - } -- if (catches->dim == 0) -- return NULL; - } --#else -- if (!body || body->isEmpty()) -+ if (catchErrors) -+ return new ErrorStatement(); -+ -+#ifndef IN_GCC -+ if (!body) -+ return NULL; -+#endif -+ -+ if (body->isErrorStatement()) -+ return body; -+ -+#ifndef IN_GCC -+ if (!body->hasCode()) - { - return NULL; - } -@@ -4668,8 +4626,13 @@ Statement *TryCatchStatement::semantic(S - } - } - -+#ifdef IN_GCC -+ if (catches->dim == 0) -+ return (body->hasCode()) ? body : NULL; -+#else - if (catches->dim == 0) - return body; -+#endif - - return this; - } -@@ -4679,11 +4642,6 @@ bool TryCatchStatement::hasBreak() - return FALSE; - } - --bool TryCatchStatement::usesEH() --{ -- return TRUE; --} -- - int TryCatchStatement::blockExit(bool mustNotThrow) - { - assert(body); -@@ -4701,7 +4659,11 @@ int TryCatchStatement::blockExit(bool mu - /* If we're catching Object, then there is no throwing - */ - Identifier *id = c->type->toBasetype()->isClassHandle()->ident; -- if (id == Id::Object || id == Id::Throwable || id == Id::Exception) -+ if (id == Id::Object || id == Id::Throwable) -+ { -+ result &= ~(BEthrow | BEerrthrow); -+ } -+ if (id == Id::Exception) - { - result &= ~BEthrow; - } -@@ -4752,9 +4714,6 @@ Catch *Catch::syntaxCopy() - - void Catch::semantic(Scope *sc) - { -- if (type && type->deco) -- return; -- - //printf("Catch::semantic(%s)\n", ident->toChars()); - - #ifndef IN_GCC -@@ -4775,7 +4734,7 @@ void Catch::semantic(Scope *sc) - sc = sc->push(sym); - - if (!type) -- type = new TypeIdentifier(0, Id::Throwable); -+ type = new TypeIdentifier(Loc(), Id::Throwable); - type = type->semantic(loc, sc); - ClassDeclaration *cd = type->toBasetype()->isClassHandle(); - if (!cd || ((cd != ClassDeclaration::throwable) && !ClassDeclaration::throwable->isBaseOf(cd, NULL))) -@@ -4798,7 +4757,7 @@ void Catch::semantic(Scope *sc) - else if (ident) - { - var = new VarDeclaration(loc, type, ident, NULL); -- var->parent = sc->parent; -+ var->semantic(sc); - sc->insert(var); - } - handler = handler->semantic(sc); -@@ -4899,11 +4858,6 @@ bool TryFinallyStatement::hasContinue() - return FALSE; //TRUE; - } - --bool TryFinallyStatement::usesEH() --{ -- return TRUE; --} -- - int TryFinallyStatement::blockExit(bool mustNotThrow) - { - int result = BEfallthru; -@@ -4955,11 +4909,6 @@ void OnScopeStatement::toCBuffer(OutBuff - statement->toCBuffer(buf, hgs); - } - --bool OnScopeStatement::usesEH() --{ -- return 1; --} -- - Statement *OnScopeStatement::scopeCode(Scope *sc, Statement **sentry, Statement **sexception, Statement **sfinally) - { - //printf("OnScopeStatement::scopeCode()\n"); -@@ -4986,17 +4935,17 @@ Statement *OnScopeStatement::scopeCode(S - */ - Identifier *id = Lexer::uniqueId("__os"); - -- ExpInitializer *ie = new ExpInitializer(loc, new IntegerExp(0, 0, Type::tbool)); -+ ExpInitializer *ie = new ExpInitializer(loc, new IntegerExp(Loc(), 0, Type::tbool)); - VarDeclaration *v = new VarDeclaration(loc, Type::tbool, id, ie); - *sentry = new ExpStatement(loc, v); - -- Expression *e = new IntegerExp(0, 1, Type::tbool); -- e = new AssignExp(0, new VarExp(0, v), e); -- *sexception = new ExpStatement(0, e); -- -- e = new VarExp(0, v); -- e = new NotExp(0, e); -- *sfinally = new IfStatement(0, NULL, e, statement, NULL); -+ Expression *e = new IntegerExp(Loc(), 1, Type::tbool); -+ e = new AssignExp(Loc(), new VarExp(Loc(), v), e); -+ *sexception = new ExpStatement(Loc(), e); -+ -+ e = new VarExp(Loc(), v); -+ e = new NotExp(Loc(), e); -+ *sfinally = new IfStatement(Loc(), NULL, e, statement, NULL); - - break; - } -@@ -5038,10 +4987,13 @@ Statement *ThrowStatement::semantic(Scop - exp = exp->semantic(sc); - exp = resolveProperties(sc, exp); - if (exp->op == TOKerror) -- return this; -+ return new ErrorStatement(); - ClassDeclaration *cd = exp->type->toBasetype()->isClassHandle(); - if (!cd || ((cd != ClassDeclaration::throwable) && !ClassDeclaration::throwable->isBaseOf(cd, NULL))) -+ { - error("can only throw class objects derived from Throwable, not type %s", exp->type->toChars()); -+ return new ErrorStatement(); -+ } - - return this; - } -@@ -5049,18 +5001,19 @@ Statement *ThrowStatement::semantic(Scop - int ThrowStatement::blockExit(bool mustNotThrow) - { - Type *t = exp->type->toBasetype(); -- if (mustNotThrow && t->ty != Terror) -- { -- ClassDeclaration *cd = t->isClassHandle(); -- assert(cd); -+ ClassDeclaration *cd = t->isClassHandle(); -+ assert(cd); - -- // Bugzilla 8675 -- // Throwing Errors is allowed even if mustNotThrow -- if (!internalThrow && -- cd != ClassDeclaration::errorException && -- !ClassDeclaration::errorException->isBaseOf(cd, NULL)) -- error("%s is thrown but not caught", exp->type->toChars()); -+ if (cd == ClassDeclaration::errorException || -+ ClassDeclaration::errorException->isBaseOf(cd, NULL)) -+ { -+ return BEerrthrow; - } -+ // Bugzilla 8675 -+ // Throwing Errors is allowed even if mustNotThrow -+ if (!internalThrow && mustNotThrow) -+ error("%s is thrown but not caught", exp->type->toChars()); -+ - return BEthrow; - } - -@@ -5165,7 +5118,10 @@ Statement *GotoStatement::semantic(Scope - return s; - } - if (label->statement && label->statement->tf != sc->tf) -+ { - error("cannot goto in or out of finally block"); -+ return new ErrorStatement(); -+ } - return this; - } - -@@ -5192,6 +5148,7 @@ LabelStatement::LabelStatement(Loc loc, - this->ident = ident; - this->statement = statement; - this->tf = NULL; -+ this->gotoTarget = NULL; - this->lblock = NULL; - this->fwdrefs = NULL; - } -@@ -5211,13 +5168,22 @@ Statement *LabelStatement::semantic(Scop - - ls = fd->searchLabel(ident); - if (ls->statement) -+ { - error("Label '%s' already defined", ls->toChars()); -+ return new ErrorStatement(); -+ } - else - ls->statement = this; - tf = sc->tf; - sc = sc->push(); - sc->scopesym = sc->enclosing->scopesym; - sc->callSuper |= CSXlabel; -+ if (sc->fieldinit) -+ { -+ size_t dim = sc->fieldinit_dim; -+ for (size_t i = 0; i < dim; i++) -+ sc->fieldinit[i] |= CSXlabel; -+ } - sc->slabel = this; - if (statement) - statement = statement->semanticNoScope(sc); -@@ -5249,11 +5215,6 @@ Statements *LabelStatement::flatten(Scop - } - - --bool LabelStatement::usesEH() --{ -- return statement ? statement->usesEH() : FALSE; --} -- - int LabelStatement::blockExit(bool mustNotThrow) - { - //printf("LabelStatement::blockExit(%p)\n", this); -@@ -5261,12 +5222,6 @@ int LabelStatement::blockExit(bool mustN - } - - --int LabelStatement::comeFrom() --{ -- //printf("LabelStatement::comeFrom()\n"); -- return TRUE; --} -- - void LabelStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - buf->writestring(ident->toChars()); -@@ -5310,12 +5265,6 @@ Statement *AsmStatement::syntaxCopy() - } - - -- --int AsmStatement::comeFrom() --{ -- return TRUE; --} -- - int AsmStatement::blockExit(bool mustNotThrow) - { - if (mustNotThrow) -@@ -5388,6 +5337,7 @@ Statement *ImportStatement::semantic(Sco - - TypeIdentifier *tname = new TypeIdentifier(s->loc, name); - AliasDeclaration *ad = new AliasDeclaration(s->loc, alias, tname); -+ ad->import = s; - - s->aliasdecls.push(ad); - } -@@ -5409,11 +5359,6 @@ int ImportStatement::blockExit(bool must - return BEfallthru; - } - --int ImportStatement::isEmpty() --{ -- return TRUE; --} -- - void ImportStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) - { - for (size_t i = 0; i < imports->dim; i++) ---- a/src/gcc/d/dfrontend/statement.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/statement.h 2014-04-01 16:32:51.000000000 +0100 -@@ -23,36 +23,40 @@ - - struct OutBuffer; - struct Scope; --struct Expression; --struct LabelDsymbol; --struct Identifier; --struct IfStatement; --struct ExpStatement; --struct DefaultStatement; --struct VarDeclaration; --struct Condition; --struct Module; -+class Expression; -+class LabelDsymbol; -+class Identifier; -+class IfStatement; -+class ExpStatement; -+class DefaultStatement; -+class VarDeclaration; -+class Condition; -+class Module; - struct Token; - struct InlineCostState; - struct InlineDoState; - struct InlineScanState; --struct ReturnStatement; --struct CompoundStatement; --struct Parameter; --struct StaticAssert; --struct AsmStatement; --struct GotoStatement; --struct ScopeStatement; --struct TryCatchStatement; --struct TryFinallyStatement; --struct CaseStatement; --struct DefaultStatement; --struct LabelStatement; -+class ErrorStatement; -+class ReturnStatement; -+class CompoundStatement; -+class Parameter; -+class StaticAssert; -+class AsmStatement; -+class GotoStatement; -+class ScopeStatement; -+class TryCatchStatement; -+class TryFinallyStatement; -+class CaseStatement; -+class DefaultStatement; -+class LabelStatement; - struct HdrGenState; - struct InterState; -+struct CompiledCtfeFunction; - - enum TOK; - -+typedef bool (*sapply_fp_t)(Statement *, void *); -+ - // Back end - struct IRState; - struct Blockx; -@@ -77,11 +81,13 @@ enum BE - BEhalt = 0x10, - BEbreak = 0x20, - BEcontinue = 0x40, -+ BEerrthrow = 0x80, - BEany = (BEfallthru | BEthrow | BEreturn | BEgoto | BEhalt), - }; - --struct Statement : Object -+class Statement : public RootObject - { -+public: - Loc loc; - - Statement(Loc loc); -@@ -94,20 +100,24 @@ struct Statement : Object - void warning(const char *format, ...); - void deprecation(const char *format, ...); - virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- virtual ScopeStatement *isScopeStatement() { return NULL; } - virtual Statement *semantic(Scope *sc); - Statement *semanticScope(Scope *sc, Statement *sbreak, Statement *scontinue); - Statement *semanticNoScope(Scope *sc); - virtual Statement *getRelatedLabeled() { return this; } - virtual bool hasBreak(); - virtual bool hasContinue(); -- virtual bool usesEH(); -+ bool usesEH(); -+ virtual bool usesEHimpl(); - virtual int blockExit(bool mustNotThrow); -- virtual int comeFrom(); -- virtual int isEmpty(); -+ bool comeFrom(); -+ virtual bool comeFromImpl(); -+ bool hasCode(); -+ virtual bool hasCodeImpl(); - virtual Statement *scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); - virtual Statements *flatten(Scope *sc); - virtual Expression *interpret(InterState *istate); -+ virtual bool apply(sapply_fp_t fp, void *param); -+ virtual void ctfeCompile(CompiledCtfeFunction *ccf); - virtual Statement *last(); - - virtual int inlineCost(InlineCostState *ics); -@@ -119,6 +129,8 @@ struct Statement : Object - virtual void toIR(IRState *irs); - - // Avoid dynamic_cast -+ virtual ErrorStatement *isErrorStatement() { return NULL; } -+ virtual ScopeStatement *isScopeStatement() { return NULL; } - virtual ExpStatement *isExpStatement() { return NULL; } - virtual CompoundStatement *isCompoundStatement() { return NULL; } - virtual ReturnStatement *isReturnStatement() { return NULL; } -@@ -128,16 +140,33 @@ struct Statement : Object - virtual LabelStatement *isLabelStatement() { return NULL; } - }; - --struct PeelStatement : Statement -+/** Any Statement that fails semantic() or has a component that is an ErrorExp or -+ * a TypeError should return an ErrorStatement from semantic(). -+ */ -+class ErrorStatement : public Statement - { -+public: -+ ErrorStatement(); -+ Statement *syntaxCopy(); -+ Statement *semantic(Scope *sc); -+ int blockExit(bool mustNotThrow); -+ -+ ErrorStatement *isErrorStatement() { return this; } -+}; -+ -+class PeelStatement : public Statement -+{ -+public: - Statement *s; - - PeelStatement(Statement *s); - Statement *semantic(Scope *sc); -+ bool apply(sapply_fp_t fp, void *param); - }; - --struct ExpStatement : Statement -+class ExpStatement : public Statement - { -+public: - Expression *exp; - - ExpStatement(Loc loc, Expression *exp); -@@ -146,8 +175,9 @@ struct ExpStatement : Statement - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - int blockExit(bool mustNotThrow); -- int isEmpty(); -+ bool hasCodeImpl(); - Statement *scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); - - int inlineCost(InlineCostState *ics); -@@ -160,8 +190,9 @@ struct ExpStatement : Statement - ExpStatement *isExpStatement() { return this; } - }; - --struct DtorExpStatement : ExpStatement -+class DtorExpStatement : public ExpStatement - { -+public: - /* Wraps an expression that is the destruction of 'var' - */ - -@@ -172,8 +203,9 @@ struct DtorExpStatement : ExpStatement - void toIR(IRState *irs); - }; - --struct CompileStatement : Statement -+class CompileStatement : public Statement - { -+public: - Expression *exp; - - CompileStatement(Loc loc, Expression *exp); -@@ -184,8 +216,9 @@ struct CompileStatement : Statement - int blockExit(bool mustNotThrow); - }; - --struct CompoundStatement : Statement -+class CompoundStatement : public Statement - { -+public: - Statements *statements; - - CompoundStatement(Loc loc, Statements *s); -@@ -194,13 +227,13 @@ struct CompoundStatement : Statement - Statement *syntaxCopy(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Statement *semantic(Scope *sc); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); -- int isEmpty(); -+ bool hasCodeImpl(); - Statements *flatten(Scope *sc); - ReturnStatement *isReturnStatement(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - Statement *last(); - - int inlineCost(InlineCostState *ics); -@@ -213,8 +246,9 @@ struct CompoundStatement : Statement - CompoundStatement *isCompoundStatement() { return this; } - }; - --struct CompoundDeclarationStatement : CompoundStatement -+class CompoundDeclarationStatement : public CompoundStatement - { -+public: - CompoundDeclarationStatement(Loc loc, Statements *s); - Statement *syntaxCopy(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -223,8 +257,9 @@ struct CompoundDeclarationStatement : Co - /* The purpose of this is so that continue will go to the next - * of the statements, and break will go to the end of the statements. - */ --struct UnrolledLoopStatement : Statement -+class UnrolledLoopStatement : public Statement - { -+public: - Statements *statements; - - UnrolledLoopStatement(Loc loc, Statements *statements); -@@ -232,10 +267,10 @@ struct UnrolledLoopStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - int inlineCost(InlineCostState *ics); -@@ -246,8 +281,9 @@ struct UnrolledLoopStatement : Statement - void toIR(IRState *irs); - }; - --struct ScopeStatement : Statement -+class ScopeStatement : public Statement - { -+public: - Statement *statement; - - ScopeStatement(Loc loc, Statement *s); -@@ -257,11 +293,11 @@ struct ScopeStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); -- int isEmpty(); -+ bool hasCodeImpl(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - int inlineCost(InlineCostState *ics); - Expression *doInline(InlineDoState *ids); -@@ -271,8 +307,9 @@ struct ScopeStatement : Statement - void toIR(IRState *irs); - }; - --struct WhileStatement : Statement -+class WhileStatement : public Statement - { -+public: - Expression *condition; - Statement *body; - -@@ -281,10 +318,10 @@ struct WhileStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -292,8 +329,9 @@ struct WhileStatement : Statement - void toIR(IRState *irs); - }; - --struct DoStatement : Statement -+class DoStatement : public Statement - { -+public: - Statement *body; - Expression *condition; - -@@ -302,10 +340,10 @@ struct DoStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -313,13 +351,13 @@ struct DoStatement : Statement - void toIR(IRState *irs); - }; - --struct ForStatement : Statement -+class ForStatement : public Statement - { -+public: - Statement *init; - Expression *condition; - Expression *increment; - Statement *body; -- int nest; - - // When wrapped in try/finally clauses, this points to the outermost one, - // which may have an associated label. Internal break/continue statements -@@ -328,16 +366,15 @@ struct ForStatement : Statement - - ForStatement(Loc loc, Statement *init, Expression *condition, Expression *increment, Statement *body); - Statement *syntaxCopy(); -- Statement *semanticInit(Scope *sc); - Statement *semantic(Scope *sc); - Statement *scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); - Statement *getRelatedLabeled() { return relatedLabeled ? relatedLabeled : this; } - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - int inlineCost(InlineCostState *ics); -@@ -347,9 +384,10 @@ struct ForStatement : Statement - void toIR(IRState *irs); - }; - --struct ForeachStatement : Statement -+class ForeachStatement : public Statement - { -- enum TOK op; // TOKforeach or TOKforeach_reverse -+public: -+ TOK op; // TOKforeach or TOKforeach_reverse - Parameters *arguments; // array of Parameter*'s - Expression *aggr; - Statement *body; -@@ -362,7 +400,7 @@ struct ForeachStatement : Statement - Statements *cases; // put breaks, continues, gotos and returns here - CompoundStatements *gotos; // forward referenced goto's go here - -- ForeachStatement(Loc loc, enum TOK op, Parameters *arguments, Expression *aggr, Statement *body); -+ ForeachStatement(Loc loc, TOK op, Parameters *arguments, Expression *aggr, Statement *body); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - bool checkForArgTypes(); -@@ -370,10 +408,10 @@ struct ForeachStatement : Statement - int inferApplyArgTypes(Scope *sc, Dsymbol *&sapply); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -382,9 +420,10 @@ struct ForeachStatement : Statement - }; - - #if DMDV2 --struct ForeachRangeStatement : Statement -+class ForeachRangeStatement : public Statement - { -- enum TOK op; // TOKforeach or TOKforeach_reverse -+public: -+ TOK op; // TOKforeach or TOKforeach_reverse - Parameter *arg; // loop index variable - Expression *lwr; - Expression *upr; -@@ -392,16 +431,16 @@ struct ForeachRangeStatement : Statement - - VarDeclaration *key; - -- ForeachRangeStatement(Loc loc, enum TOK op, Parameter *arg, -+ ForeachRangeStatement(Loc loc, TOK op, Parameter *arg, - Expression *lwr, Expression *upr, Statement *body); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -410,8 +449,9 @@ struct ForeachRangeStatement : Statement - }; - #endif - --struct IfStatement : Statement -+class IfStatement : public Statement - { -+public: - Parameter *arg; - Expression *condition; - Statement *ifbody; -@@ -423,8 +463,9 @@ struct IfStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- bool usesEH(); - int blockExit(bool mustNotThrow); - IfStatement *isIfStatement() { return this; } - -@@ -436,8 +477,9 @@ struct IfStatement : Statement - void toIR(IRState *irs); - }; - --struct ConditionalStatement : Statement -+class ConditionalStatement : public Statement - { -+public: - Condition *condition; - Statement *ifbody; - Statement *elsebody; -@@ -446,14 +488,15 @@ struct ConditionalStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Statements *flatten(Scope *sc); -- bool usesEH(); - int blockExit(bool mustNotThrow); -+ bool apply(sapply_fp_t fp, void *param); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct PragmaStatement : Statement -+class PragmaStatement : public Statement - { -+public: - Identifier *ident; - Expressions *args; // array of Expression's - Statement *body; -@@ -461,16 +504,17 @@ struct PragmaStatement : Statement - PragmaStatement(Loc loc, Identifier *ident, Expressions *args, Statement *body); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); -- bool usesEH(); - int blockExit(bool mustNotThrow); -+ bool apply(sapply_fp_t fp, void *param); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - void toIR(IRState *irs); - }; - --struct StaticAssertStatement : Statement -+class StaticAssertStatement : public Statement - { -+public: - StaticAssert *sa; - - StaticAssertStatement(StaticAssert *sa); -@@ -481,8 +525,9 @@ struct StaticAssertStatement : Statement - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct SwitchStatement : Statement -+class SwitchStatement : public Statement - { -+public: - Expression *condition; - Statement *body; - bool isFinal; -@@ -498,9 +543,10 @@ struct SwitchStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - bool hasBreak(); -- bool usesEH(); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -508,8 +554,9 @@ struct SwitchStatement : Statement - void toIR(IRState *irs); - }; - --struct CaseStatement : Statement -+class CaseStatement : public Statement - { -+public: - Expression *exp; - Statement *statement; - -@@ -519,11 +566,12 @@ struct CaseStatement : Statement - CaseStatement(Loc loc, Expression *exp, Statement *s); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); -- int compare(Object *obj); -- bool usesEH(); -+ int compare(RootObject *obj); - int blockExit(bool mustNotThrow); -- int comeFrom(); -+ bool comeFromImpl(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - CaseStatement *isCaseStatement() { return this; } - -@@ -534,8 +582,9 @@ struct CaseStatement : Statement - - #if DMDV2 - --struct CaseRangeStatement : Statement -+class CaseRangeStatement : public Statement - { -+public: - Expression *first; - Expression *last; - Statement *statement; -@@ -543,13 +592,15 @@ struct CaseRangeStatement : Statement - CaseRangeStatement(Loc loc, Expression *first, Expression *last, Statement *s); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); -+ bool apply(sapply_fp_t fp, void *param); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - - #endif - --struct DefaultStatement : Statement -+class DefaultStatement : public Statement - { -+public: - Statement *statement; - #ifdef IN_GCC - block *cblock; // back end: label for the block -@@ -558,10 +609,11 @@ struct DefaultStatement : Statement - DefaultStatement(Loc loc, Statement *s); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); -+ bool comeFromImpl(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - DefaultStatement *isDefaultStatement() { return this; } - -@@ -570,22 +622,25 @@ struct DefaultStatement : Statement - void toIR(IRState *irs); - }; - --struct GotoDefaultStatement : Statement -+class GotoDefaultStatement : public Statement - { -+public: - SwitchStatement *sw; - - GotoDefaultStatement(Loc loc); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - void toIR(IRState *irs); - }; - --struct GotoCaseStatement : Statement -+class GotoCaseStatement : public Statement - { -+public: - Expression *exp; // NULL, or which case to goto - CaseStatement *cs; // case statement it resolves to - -@@ -593,23 +648,27 @@ struct GotoCaseStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - void toIR(IRState *irs); - }; - --struct SwitchErrorStatement : Statement -+class SwitchErrorStatement : public Statement - { -+public: - SwitchErrorStatement(Loc loc); - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toIR(IRState *irs); - }; - --struct ReturnStatement : Statement -+class ReturnStatement : public Statement - { -+public: - Expression *exp; - bool implicit0; // this is an implicit "return 0;" - -@@ -619,6 +678,7 @@ struct ReturnStatement : Statement - Statement *semantic(Scope *sc); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - int inlineCost(InlineCostState *ics); - Expression *doInline(InlineDoState *ids); -@@ -630,36 +690,41 @@ struct ReturnStatement : Statement - ReturnStatement *isReturnStatement() { return this; } - }; - --struct BreakStatement : Statement -+class BreakStatement : public Statement - { -+public: - Identifier *ident; - - BreakStatement(Loc loc, Identifier *ident); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - void toIR(IRState *irs); - }; - --struct ContinueStatement : Statement -+class ContinueStatement : public Statement - { -+public: - Identifier *ident; - - ContinueStatement(Loc loc, Identifier *ident); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - void toIR(IRState *irs); - }; - --struct SynchronizedStatement : Statement -+class SynchronizedStatement : public Statement - { -+public: - Expression *exp; - Statement *body; - -@@ -668,8 +733,9 @@ struct SynchronizedStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); -+ bool usesEHimpl(); - int blockExit(bool mustNotThrow); -+ bool apply(sapply_fp_t fp, void *param); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -680,8 +746,9 @@ struct SynchronizedStatement : Statement - void toIR(IRState *irs); - }; - --struct WithStatement : Statement -+class WithStatement : public Statement - { -+public: - Expression *exp; - Statement *body; - VarDeclaration *wthis; -@@ -690,17 +757,19 @@ struct WithStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- bool usesEH(); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - Statement *inlineScan(InlineScanState *iss); - - void toIR(IRState *irs); - }; - --struct TryCatchStatement : Statement -+class TryCatchStatement : public Statement - { -+public: - Statement *body; - Catches *catches; - -@@ -708,9 +777,11 @@ struct TryCatchStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - bool hasBreak(); -- bool usesEH(); -+ bool usesEHimpl(); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - Statement *inlineScan(InlineScanState *iss); - -@@ -718,8 +789,9 @@ struct TryCatchStatement : Statement - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct Catch : Object -+class Catch : public RootObject - { -+public: - Loc loc; - Type *type; - Identifier *ident; -@@ -735,8 +807,9 @@ struct Catch : Object - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct TryFinallyStatement : Statement -+class TryFinallyStatement : public Statement - { -+public: - Statement *body; - Statement *finalbody; - -@@ -746,17 +819,20 @@ struct TryFinallyStatement : Statement - Statement *semantic(Scope *sc); - bool hasBreak(); - bool hasContinue(); -- bool usesEH(); -+ bool usesEHimpl(); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - Statement *inlineScan(InlineScanState *iss); - - void toIR(IRState *irs); - }; - --struct OnScopeStatement : Statement -+class OnScopeStatement : public Statement - { -+public: - TOK tok; - Statement *statement; - -@@ -765,15 +841,18 @@ struct OnScopeStatement : Statement - int blockExit(bool mustNotThrow); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - Statement *semantic(Scope *sc); -- bool usesEH(); -+ bool usesEHimpl(); - Statement *scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toIR(IRState *irs); - }; - --struct ThrowStatement : Statement -+class ThrowStatement : public Statement - { -+public: - Expression *exp; - bool internalThrow; // was generated by the compiler, - // wasn't present in source code -@@ -784,25 +863,29 @@ struct ThrowStatement : Statement - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - Statement *inlineScan(InlineScanState *iss); - - void toIR(IRState *irs); - }; - --struct DebugStatement : Statement -+class DebugStatement : public Statement - { -+public: - Statement *statement; - - DebugStatement(Loc loc, Statement *statement); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Statements *flatten(Scope *sc); -+ bool apply(sapply_fp_t fp, void *param); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct GotoStatement : Statement -+class GotoStatement : public Statement - { -+public: - Identifier *ident; - LabelDsymbol *label; - TryFinallyStatement *tf; -@@ -812,16 +895,19 @@ struct GotoStatement : Statement - Statement *semantic(Scope *sc); - int blockExit(bool mustNotThrow); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toIR(IRState *irs); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - }; - --struct LabelStatement : Statement -+class LabelStatement : public Statement - { -+public: - Identifier *ident; - Statement *statement; - TryFinallyStatement *tf; -+ Statement *gotoTarget; // interpret - block *lblock; // back end - - Blocks *fwdrefs; // forward references to this LabelStatement -@@ -830,10 +916,11 @@ struct LabelStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - Statements *flatten(Scope *sc); -- bool usesEH(); - int blockExit(bool mustNotThrow); -- int comeFrom(); -+ bool comeFromImpl(); - Expression *interpret(InterState *istate); -+ bool apply(sapply_fp_t fp, void *param); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - - Statement *inlineScan(InlineScanState *iss); -@@ -842,16 +929,18 @@ struct LabelStatement : Statement - void toIR(IRState *irs); - }; - --struct LabelDsymbol : Dsymbol -+class LabelDsymbol : public Dsymbol - { -+public: - LabelStatement *statement; - - LabelDsymbol(Identifier *ident); - LabelDsymbol *isLabel(); - }; - --struct AsmStatement : Statement -+class AsmStatement : public Statement - { -+public: - Token *tokens; - code *asmcode; - unsigned asmalign; // alignment of this statement -@@ -863,8 +952,9 @@ struct AsmStatement : Statement - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - int blockExit(bool mustNotThrow); -- int comeFrom(); -+ bool comeFromImpl(); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -@@ -875,16 +965,18 @@ struct AsmStatement : Statement - void toIR(IRState *irs); - }; - --struct ImportStatement : Statement -+class ImportStatement : public Statement - { -+public: - Dsymbols *imports; // Array of Import's - - ImportStatement(Loc loc, Dsymbols *imports); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - int blockExit(bool mustNotThrow); -- int isEmpty(); -+ bool hasCodeImpl(); - Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - -@@ -898,22 +990,25 @@ struct ImportStatement : Statement - #ifdef IN_GCC - - // Assembler instructions with D expression operands --struct ExtAsmStatement : Statement -+class ExtAsmStatement : public Statement - { -+public: - Expression *insn; - Expressions *args; - Identifiers *names; // of NULL or Identifier* - Expressions *constraints; // of StringExp* - unsigned outputargs; - Expressions *clobbers; // of StringExp* -- Dsymbols *labels; // of LabelDsymbol* - -- ExtAsmStatement(Loc loc, Expression *insn, Expressions *args, Identifiers *names, -- Expressions *constraints, int outputargs, Expressions *clobbers, Dsymbols *labels); -+ ExtAsmStatement(Loc loc, Expression *insn, Expressions *args, -+ Identifiers *names, Expressions *constraints, -+ int outputargs, Expressions *clobbers); - Statement *syntaxCopy(); - Statement *semantic(Scope *sc); - int blockExit(bool mustNotThrow); -- int comeFrom(); -+ bool comeFromImpl(); -+ Expression *interpret(InterState *istate); -+ void ctfeCompile(CompiledCtfeFunction *ccf); - - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - ---- a/src/gcc/d/dfrontend/staticassert.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/staticassert.c 2014-04-01 16:32:51.000000000 +0100 -@@ -55,9 +55,16 @@ void StaticAssert::semantic2(Scope *sc) - ScopeDsymbol *sd = new ScopeDsymbol(); - sc = sc->push(sd); - sc->flags |= SCOPEstaticassert; -+ -+ sc = sc->startCTFE(); - Expression *e = exp->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); - sc = sc->pop(); -+ -+ // Simplify expression, to make error messages nicer if CTFE fails -+ e = e->optimize(0); -+ - if (!e->type->checkBoolean()) - { - if (e->type->toBasetype() != Type::terror) -@@ -73,11 +80,14 @@ void StaticAssert::semantic2(Scope *sc) - else if (e->isBool(FALSE)) - { - if (msg) -- { HdrGenState hgs; -+ { -+ HdrGenState hgs; - OutBuffer buf; - -+ sc = sc->startCTFE(); - msg = msg->semantic(sc); - msg = resolveProperties(sc, msg); -+ sc = sc->endCTFE(); - msg = msg->ctfeInterpret(); - hgs.console = 1; - StringExp * s = msg->toString(); -@@ -101,11 +111,11 @@ void StaticAssert::semantic2(Scope *sc) - } - } - --int StaticAssert::oneMember(Dsymbol **ps, Identifier *ident) -+bool StaticAssert::oneMember(Dsymbol **ps, Identifier *ident) - { - //printf("StaticAssert::oneMember())\n"); - *ps = NULL; -- return TRUE; -+ return true; - } - - void StaticAssert::inlineScan() -@@ -128,7 +138,7 @@ void StaticAssert::toCBuffer(OutBuffer * - exp->toCBuffer(buf, hgs); - if (msg) - { -- buf->writeByte(','); -+ buf->writestring(", "); - msg->toCBuffer(buf, hgs); - } - buf->writestring(");"); ---- a/src/gcc/d/dfrontend/staticassert.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/staticassert.h 2014-04-01 16:32:51.000000000 +0100 -@@ -17,11 +17,12 @@ - - #include "dsymbol.h" - --struct Expression; -+class Expression; - struct HdrGenState; - --struct StaticAssert : Dsymbol -+class StaticAssert : public Dsymbol - { -+public: - Expression *exp; - Expression *msg; - -@@ -32,7 +33,7 @@ struct StaticAssert : Dsymbol - void semantic(Scope *sc); - void semantic2(Scope *sc); - void inlineScan(); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - void toObjFile(int multiobj); - const char *kind(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); ---- a/src/gcc/d/dfrontend/stringtable.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/stringtable.c 2014-04-01 16:32:51.000000000 +0100 -@@ -22,6 +22,13 @@ hash_t calcHash(const char *str, size_t - { - hash_t hash = 0; - -+ union -+ { -+ uint8_t scratchB[4]; -+ uint16_t scratchS[2]; -+ uint32_t scratchI; -+ }; -+ - while (1) - { - switch (len) -@@ -36,18 +43,26 @@ hash_t calcHash(const char *str, size_t - - case 2: - hash *= 37; -- hash += *(const uint16_t *)str; -+ scratchB[0] = str[0]; -+ scratchB[1] = str[1]; -+ hash += scratchS[0]; - return hash; - - case 3: - hash *= 37; -- hash += (*(const uint16_t *)str << 8) + -+ scratchB[0] = str[0]; -+ scratchB[1] = str[1]; -+ hash += (scratchS[0] << 8) + - ((const uint8_t *)str)[2]; - return hash; - - default: - hash *= 37; -- hash += *(const uint32_t *)str; -+ scratchB[0] = str[0]; -+ scratchB[1] = str[1]; -+ scratchB[2] = str[2]; -+ scratchB[3] = str[3]; -+ hash += scratchI; - str += 4; - len -= 4; - break; -@@ -62,7 +77,7 @@ void StringValue::ctor(const char *p, si - memcpy(this->lstring, p, length * sizeof(char)); - } - --void StringTable::init(size_t size) -+void StringTable::_init(size_t size) - { - table = (void **)mem.calloc(size, sizeof(void *)); - tabledim = size; ---- a/src/gcc/d/dfrontend/stringtable.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/stringtable.h 2014-04-01 16:32:51.000000000 +0100 -@@ -24,11 +24,7 @@ struct StringEntry; - // method because the only thing which should be creating these is StringTable. - struct StringValue - { -- union -- { -- void *ptrvalue; -- char *string; -- }; -+ void *ptrvalue; - private: - size_t length; - -@@ -57,7 +53,7 @@ private: - size_t tabledim; - - public: -- void init(size_t size = 37); -+ void _init(size_t size = 37); - ~StringTable(); - - StringValue *lookup(const char *s, size_t len); ---- a/src/gcc/d/dfrontend/struct.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/struct.c 2014-04-01 16:32:51.000000000 +0100 -@@ -22,6 +22,75 @@ - #include "template.h" - - FuncDeclaration *StructDeclaration::xerreq; // object.xopEquals -+FuncDeclaration *StructDeclaration::xerrcmp; // object.xopCmp -+ -+bool inNonRoot(Dsymbol *s) -+{ -+ if (!s || !s->parent) -+ return false; -+ s = s->parent; -+ for (; s; s = s->parent) -+ { -+ if (TemplateInstance *ti = s->isTemplateInstance()) -+ { -+ if (!ti->instantiatingModule || !ti->instantiatingModule->isRoot()) -+ return true; -+ return false; -+ } -+ else if (Module *m = s->isModule()) -+ { -+ if (!m->isRoot()) -+ return true; -+ break; -+ } -+ } -+ return false; -+} -+ -+/*************************************** -+ * Search toHash member function for TypeInfo_Struct. -+ * const hash_t toHash(); -+ */ -+FuncDeclaration *search_toHash(StructDeclaration *sd) -+{ -+ Dsymbol *s = search_function(sd, Id::tohash); -+ FuncDeclaration *fd = s ? s->isFuncDeclaration() : NULL; -+ if (fd) -+ { -+ static TypeFunction *tftohash; -+ if (!tftohash) -+ { -+ tftohash = new TypeFunction(NULL, Type::thash_t, 0, LINKd); -+ tftohash->mod = MODconst; -+ tftohash = (TypeFunction *)tftohash->merge(); -+ } -+ -+ fd = fd->overloadExactMatch(tftohash); -+ } -+ return fd; -+} -+ -+/*************************************** -+ * Search toString member function for TypeInfo_Struct. -+ * string toString(); -+ */ -+FuncDeclaration *search_toString(StructDeclaration *sd) -+{ -+ Dsymbol *s = search_function(sd, Id::tostring); -+ FuncDeclaration *fd = s ? s->isFuncDeclaration() : NULL; -+ if (fd) -+ { -+ static TypeFunction *tftostring; -+ if (!tftostring) -+ { -+ tftostring = new TypeFunction(NULL, Type::tstring, 0, LINKd); -+ tftostring = (TypeFunction *)tftostring->merge(); -+ } -+ -+ fd = fd->overloadExactMatch(tftostring); -+ } -+ return fd; -+} - - /********************************* AggregateDeclaration ****************************/ - -@@ -46,7 +115,7 @@ AggregateDeclaration::AggregateDeclarati - - stag = NULL; - sinit = NULL; -- isnested = false; -+ enclosing = NULL; - vthis = NULL; - - #if DMDV2 -@@ -59,7 +128,7 @@ AggregateDeclaration::AggregateDeclarati - getRTInfo = NULL; - } - --enum PROT AggregateDeclaration::prot() -+PROT AggregateDeclaration::prot() - { - return protection; - } -@@ -81,6 +150,7 @@ void AggregateDeclaration::semantic2(Sco - if (members) - { - sc = sc->push(this); -+ sc->parent = this; - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *s = (*members)[i]; -@@ -96,16 +166,24 @@ void AggregateDeclaration::semantic3(Sco - //printf("AggregateDeclaration::semantic3(%s)\n", toChars()); - if (members) - { -+ StructDeclaration *sd = isStructDeclaration(); -+ if (!sc) // from runDeferredSemantic3 for TypeInfo generation -+ goto Lxop; -+ - sc = sc->push(this); -+ sc->parent = this; - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *s = (*members)[i]; - s->semantic3(sc); - } -- sc->pop(); -+ sc = sc->pop(); - -- if (!getRTInfo) -- { // Evaluate: gcinfo!type -+ if (!getRTInfo && Type::rtinfo && -+ (!isDeprecated() || global.params.useDeprecated) && // don't do it for unused deprecated types -+ (type && type->ty != Terror)) // or error types -+ { -+ // Evaluate: RTinfo!type - Objects *tiargs = new Objects(); - tiargs->push(type); - TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs); -@@ -113,11 +191,56 @@ void AggregateDeclaration::semantic3(Sco - ti->semantic2(sc); - ti->semantic3(sc); - Dsymbol *s = ti->toAlias(); -- Expression *e = new DsymbolExp(0, s, 0); -- e = e->semantic(ti->tempdecl->scope); -+ Expression *e = new DsymbolExp(Loc(), s, 0); -+ -+ Scope *sc2 = ti->tempdecl->scope->startCTFE(); -+ sc2->instantiatingModule = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ e = e->semantic(sc2); -+ sc2->endCTFE(); -+ - e = e->ctfeInterpret(); - getRTInfo = e; - } -+ -+ if (sd) -+ { -+ Lxop: -+ if (sd->xeq && -+ sd->xeq->scope && -+ sd->xeq->semanticRun < PASSsemantic3done) -+ { -+ unsigned errors = global.startGagging(); -+ sd->xeq->semantic3(sd->xeq->scope); -+ if (global.endGagging(errors)) -+ sd->xeq = sd->xerreq; -+ } -+ -+ if (sd->xcmp && -+ sd->xcmp->scope && -+ sd->xcmp->semanticRun < PASSsemantic3done) -+ { -+ unsigned errors = global.startGagging(); -+ sd->xcmp->semantic3(sd->xcmp->scope); -+ if (global.endGagging(errors)) -+ sd->xcmp = sd->xerrcmp; -+ } -+ -+ FuncDeclaration *ftostr = search_toString(sd); -+ if (ftostr && -+ ftostr->scope && -+ ftostr->semanticRun < PASSsemantic3done) -+ { -+ ftostr->semantic3(ftostr->scope); -+ } -+ -+ FuncDeclaration *ftohash = search_toHash(sd); -+ if (ftohash && -+ ftohash->scope && -+ ftohash->semanticRun < PASSsemantic3done) -+ { -+ ftohash->semantic3(ftohash->scope); -+ } -+ } - } - } - -@@ -140,8 +263,6 @@ unsigned AggregateDeclaration::size(Loc - //printf("AggregateDeclaration::size() %s, scope = %p\n", toChars(), scope); - if (loc.linnum == 0) - loc = this->loc; -- if (!members) -- error(loc, "unknown size"); - if (sizeok != SIZEOKdone && scope) - semantic(NULL); - -@@ -166,7 +287,7 @@ unsigned AggregateDeclaration::size(Loc - v->semantic(NULL); - if (v->storage_class & (STCstatic | STCextern | STCtls | STCgshared | STCmanifest | STCctfe | STCtemplateparameter)) - return 0; -- if (v->storage_class & STCfield && v->sem >= SemanticDone) -+ if (v->isField() && v->sem >= SemanticDone) - return 0; - return 1; - } -@@ -185,8 +306,13 @@ unsigned AggregateDeclaration::size(Loc - L1: ; - } - -- if (sizeok != SIZEOKdone) -- { error(loc, "no size yet for forward reference"); -+ if (!members) -+ { -+ error(loc, "unknown size"); -+ } -+ else if (sizeok != SIZEOKdone) -+ { -+ error(loc, "no size yet for forward reference"); - //*(char*)0=0; - } - return structsize; -@@ -197,12 +323,12 @@ Type *AggregateDeclaration::getType() - return type; - } - --int AggregateDeclaration::isDeprecated() -+bool AggregateDeclaration::isDeprecated() - { - return isdeprecated; - } - --int AggregateDeclaration::isExport() -+bool AggregateDeclaration::isExport() - { - return protection == PROTexport; - } -@@ -220,11 +346,11 @@ void AggregateDeclaration::alignmember( - //printf("alignment = %d, size = %d, offset = %d\n",alignment,size,offset); - switch (alignment) - { -- case 1: -+ case (structalign_t) 1: - // No alignment - break; - -- case STRUCTALIGN_DEFAULT: -+ case (structalign_t) STRUCTALIGN_DEFAULT: - { /* Must match what the corresponding C compiler's default - * alignment behavior is. - */ -@@ -287,14 +413,68 @@ unsigned AggregateDeclaration::placeFiel - - - /**************************************** -- * Returns !=0 if there's an extra member which is the 'this' -+ * Returns true if there's an extra member which is the 'this' - * pointer to the enclosing context (enclosing aggregate or function) - */ - --int AggregateDeclaration::isNested() -+bool AggregateDeclaration::isNested() - { -- assert((isnested & ~1) == 0); -- return isnested; -+ return enclosing != NULL; -+} -+ -+void AggregateDeclaration::makeNested() -+{ -+ if (!enclosing && sizeok != SIZEOKdone && !isUnionDeclaration() && !isInterfaceDeclaration()) -+ { -+ // If nested struct, add in hidden 'this' pointer to outer scope -+ if (!(storage_class & STCstatic)) -+ { -+ Dsymbol *s = toParent2(); -+ if (s) -+ { -+ AggregateDeclaration *ad = s->isAggregateDeclaration(); -+ FuncDeclaration *fd = s->isFuncDeclaration(); -+ -+ if (fd) -+ { -+ enclosing = fd; -+ } -+ else if (isClassDeclaration() && ad && ad->isClassDeclaration()) -+ { -+ enclosing = ad; -+ } -+ else if (isStructDeclaration() && ad) -+ { -+ if (TemplateInstance *ti = ad->parent->isTemplateInstance()) -+ { -+ enclosing = ti->enclosing; -+ } -+ } -+ if (enclosing) -+ { -+ //printf("makeNested %s, enclosing = %s\n", toChars(), enclosing->toChars()); -+ Type *t; -+ if (ad) -+ t = ad->handle; -+ else if (fd) -+ { AggregateDeclaration *ad2 = fd->isMember2(); -+ if (ad2) -+ t = ad2->handle; -+ else -+ t = Type::tvoidptr; -+ } -+ else -+ assert(0); -+ if (t->ty == Tstruct) -+ t = Type::tvoidptr; // t should not be a ref type -+ assert(!vthis); -+ vthis = new ThisDeclaration(loc, t); -+ //vthis->storage_class |= STCref; -+ members->push(vthis); -+ } -+ } -+ } -+ } - } - - /**************************************** -@@ -349,6 +529,25 @@ int AggregateDeclaration::numFieldsInUni - return count; - } - -+/******************************************* -+ * Look for constructor declaration. -+ */ -+void AggregateDeclaration::searchCtor() -+{ -+ ctor = search(Loc(), Id::ctor, 0); -+ if (ctor) -+ { -+ if (!(ctor->isCtorDeclaration() || -+ ctor->isTemplateDeclaration() || -+ ctor->isOverloadSet())) -+ { -+ error("%s %s is not a constructor; identifiers starting with __ are reserved for the implementation", ctor->kind(), ctor->toChars()); -+ errors = true; -+ ctor = NULL; -+ } -+ } -+} -+ - /********************************* StructDeclaration ****************************/ - - StructDeclaration::StructDeclaration(Loc loc, Identifier *id) -@@ -362,6 +561,7 @@ StructDeclaration::StructDeclaration(Loc - postblit = NULL; - - xeq = NULL; -+ xcmp = NULL; - alignment = 0; - #endif - arg1type = NULL; -@@ -369,6 +569,19 @@ StructDeclaration::StructDeclaration(Loc - - // For forward references - type = new TypeStruct(this); -+ -+#if MODULEINFO_IS_STRUCT -+ #ifdef DMDV2 -+ if (id == Id::ModuleInfo && !Module::moduleinfo) -+ Module::moduleinfo = this; -+ #else -+ if (id == Id::ModuleInfo) -+ { if (Module::moduleinfo) -+ Module::moduleinfo->error("only object.d can define this reserved struct name"); -+ Module::moduleinfo = this; -+ } -+ #endif -+#endif - } - - Dsymbol *StructDeclaration::syntaxCopy(Dsymbol *s) -@@ -392,7 +605,7 @@ void StructDeclaration::semantic(Scope * - //static int count; if (++count == 20) halt(); - - assert(type); -- if (!members) // if forward reference -+ if (!members) // if opaque declaration - { - return; - } -@@ -409,14 +622,13 @@ void StructDeclaration::semantic(Scope * - - Scope *scx = NULL; - if (scope) -- { sc = scope; -+ { -+ sc = scope; - scx = scope; // save so we don't make redundant copies - scope = NULL; - } -- -- int errors = global.gaggedErrors; -- - unsigned dprogress_save = Module::dprogress; -+ int errors = global.errors; - - parent = sc->parent; - type = type->semantic(loc, sc); -@@ -456,15 +668,10 @@ void StructDeclaration::semantic(Scope * - * resolve individual members like enums. - */ - for (size_t i = 0; i < members->dim; i++) -- { Dsymbol *s = (*members)[i]; -- /* There are problems doing this in the general case because -- * Scope keeps track of things like 'offset' -- */ -- //if (s->isEnumDeclaration() || (s->isAggregateDeclaration() && s->ident)) -- { -- //printf("struct: setScope %s %s\n", s->kind(), s->toChars()); -- s->setScope(sc2); -- } -+ { -+ Dsymbol *s = (*members)[i]; -+ //printf("struct: setScope %s %s\n", s->kind(), s->toChars()); -+ s->setScope(sc2); - } - - for (size_t i = 0; i < members->dim; i++) -@@ -481,14 +688,10 @@ void StructDeclaration::semantic(Scope * - if (sizeok == SIZEOKnone && s->isAliasDeclaration()) - finalizeSize(sc2); - } -+ - // Ungag errors when not speculative -- unsigned oldgag = global.gag; -- if (global.isSpeculativeGagging() && !isSpeculative()) -- { -- global.gag = 0; -- } -+ Ungag ungag = ungagSpeculative(); - s->semantic(sc2); -- global.gag = oldgag; - } - finalizeSize(sc2); - -@@ -562,7 +765,7 @@ void StructDeclaration::semantic(Scope * - - arguments->push(arg); - tfeqptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); -- tfeqptr = (TypeFunction *)tfeqptr->semantic(0, sc); -+ tfeqptr = (TypeFunction *)tfeqptr->semantic(Loc(), sc); - } - - TypeFunction *tfeq; -@@ -572,7 +775,7 @@ void StructDeclaration::semantic(Scope * - - arguments->push(arg); - tfeq = new TypeFunction(arguments, Type::tint32, 0, LINKd); -- tfeq = (TypeFunction *)tfeq->semantic(0, sc); -+ tfeq = (TypeFunction *)tfeq->semantic(Loc(), sc); - } - - Identifier *id = Id::eq; -@@ -611,22 +814,31 @@ void StructDeclaration::semantic(Scope * - postblit = buildPostBlit(sc2); - cpctor = buildCpCtor(sc2); - -- hasIdentityAssign = (buildOpAssign(sc2) != NULL); -- hasIdentityEquals = (buildOpEquals(sc2) != NULL); -+ buildOpAssign(sc2); -+ buildOpEquals(sc2); - - xeq = buildXopEquals(sc2); -+ xcmp = buildXopCmp(sc2); -+ -+ /* Even if the struct is merely imported and its semantic3 is not run, -+ * the TypeInfo object would be speculatively stored in each object -+ * files. To set correct function pointer, run semantic3 for xeq and xcmp. -+ */ -+ //if ((xeq && xeq != xerreq || xcmp && xcmp != xerrcmp) && isImportedSym(this)) -+ // Module::addDeferredSemantic3(this); -+ /* Defer requesting semantic3 until TypeInfo generation is actually invoked. -+ * See Type::getTypeInfo(). -+ */ - #endif -+ inv = buildInv(sc2); - - sc2->pop(); - - /* Look for special member functions. - */ --#if DMDV2 -- ctor = search(0, Id::ctor, 0); --#endif -- inv = (InvariantDeclaration *)search(0, Id::classInvariant, 0); -- aggNew = (NewDeclaration *)search(0, Id::classNew, 0); -- aggDelete = (DeleteDeclaration *)search(0, Id::classDelete, 0); -+ searchCtor(); -+ aggNew = (NewDeclaration *)search(Loc(), Id::classNew, 0); -+ aggDelete = (DeleteDeclaration *)search(Loc(), Id::classDelete, 0); - - TypeTuple *tup = type->toArgTypes(); - size_t dim = tup->arguments->dim; -@@ -643,9 +855,10 @@ void StructDeclaration::semantic(Scope * - semantic3(sc); - } - -- if (global.gag && global.gaggedErrors != errors) -- { // The type is no good, yet the error messages were gagged. -+ if (global.errors != errors) -+ { // The type is no good. - type = Type::terror; -+ this->errors = true; - } - - if (deferred && !global.gag) -@@ -653,6 +866,13 @@ void StructDeclaration::semantic(Scope * - deferred->semantic2(sc); - deferred->semantic3(sc); - } -+ -+ if (type->ty == Tstruct && ((TypeStruct *)type)->sym != this) -+ { -+ error("failed semantic analysis"); -+ this->errors = true; -+ type = Type::terror; -+ } - } - - Dsymbol *StructDeclaration::search(Loc loc, Identifier *ident, int flags) -@@ -662,7 +882,7 @@ Dsymbol *StructDeclaration::search(Loc l - if (scope && !symtab) - semantic(scope); - -- if (!members || !symtab) -+ if (!members || !symtab) // opaque or semantic() is not yet called - { - error("is forward referenced when looking for '%s'", ident->toChars()); - return NULL; -@@ -705,45 +925,6 @@ void StructDeclaration::finalizeSize(Sco - sizeok = SIZEOKdone; - } - --void StructDeclaration::makeNested() --{ -- if (!isnested && sizeok != SIZEOKdone && !isUnionDeclaration()) -- { -- // If nested struct, add in hidden 'this' pointer to outer scope -- if (!(storage_class & STCstatic)) -- { Dsymbol *s = toParent2(); -- if (s) -- { -- AggregateDeclaration *ad = s->isAggregateDeclaration(); -- FuncDeclaration *fd = s->isFuncDeclaration(); -- -- TemplateInstance *ti; -- if (ad && (ti = ad->parent->isTemplateInstance()) != NULL && ti->isnested || fd) -- { isnested = true; -- Type *t; -- if (ad) -- t = ad->handle; -- else if (fd) -- { AggregateDeclaration *ad = fd->isMember2(); -- if (ad) -- t = ad->handle; -- else -- t = Type::tvoidptr; -- } -- else -- assert(0); -- if (t->ty == Tstruct) -- t = Type::tvoidptr; // t should not be a ref type -- assert(!vthis); -- vthis = new ThisDeclaration(loc, t); -- //vthis->storage_class |= STCref; -- members->push(vthis); -- } -- } -- } -- } --} -- - /*************************************** - * Return true if struct is POD (Plain Old Data). - * This is defined as: -@@ -758,7 +939,7 @@ void StructDeclaration::makeNested() - */ - bool StructDeclaration::isPOD() - { -- if (isnested || cpctor || postblit || ctor || dtor) -+ if (enclosing || cpctor || postblit || ctor || dtor) - return false; - - /* Recursively check any fields have a constructor. -@@ -768,16 +949,13 @@ bool StructDeclaration::isPOD() - { - Dsymbol *s = fields[i]; - VarDeclaration *v = s->isVarDeclaration(); -- assert(v && v->storage_class & STCfield); -+ assert(v && v->isField()); - if (v->storage_class & STCref) - continue; -- Type *tv = v->type->toBasetype(); -- while (tv->ty == Tsarray) -- { TypeSArray *ta = (TypeSArray *)tv; -- tv = tv->nextOf()->toBasetype(); -- } -+ Type *tv = v->type->baseElemOf(); - if (tv->ty == Tstruct) -- { TypeStruct *ts = (TypeStruct *)tv; -+ { -+ TypeStruct *ts = (TypeStruct *)tv; - StructDeclaration *sd = ts->sym; - if (!sd->isPOD()) - return false; ---- a/src/gcc/d/dfrontend/target.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/target.h 2014-04-01 16:32:51.000000000 +0100 -@@ -14,7 +14,7 @@ - // At present it is incomplete, but in future it should grow to contain - // most or all target machine and target O/S specific information. - --struct Type; -+class Type; - - struct Target - { -@@ -22,7 +22,7 @@ struct Target - static int realsize; // size a real consumes in memory - static int realpad; // 'padding' added to the CPU real size to bring it up to realsize - static int realalignsize; // alignment for reals -- -+ - static void init(); - static unsigned alignsize(Type* type); - static unsigned fieldalign(Type* type); ---- a/src/gcc/d/dfrontend/template.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/template.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -32,28 +32,23 @@ - #include "identifier.h" - #include "hdrgen.h" - #include "id.h" -- --#ifdef IN_GCC --#include "d-dmd-gcc.h" --#else --#if WINDOWS_SEH --#include <windows.h> --long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep); --#endif --#endif -+#include "attrib.h" - - #define LOG 0 - - #define IDX_NOTFOUND (0x12345678) // index is not found - - size_t templateParameterLookup(Type *tparam, TemplateParameters *parameters); -+int arrayObjectMatch(Objects *oa1, Objects *oa2); -+hash_t arrayObjectHash(Objects *oa1); -+int arrayCheckRecursiveExpansion(Objects *oa1, TemplateDeclaration *tempdecl, Scope *sc); - - /******************************************** - * These functions substitute for dynamic_cast. dynamic_cast does not work - * on earlier versions of gcc. - */ - --Expression *isExpression(Object *o) -+Expression *isExpression(RootObject *o) - { - //return dynamic_cast<Expression *>(o); - if (!o || o->dyncast() != DYNCAST_EXPRESSION) -@@ -61,7 +56,7 @@ Expression *isExpression(Object *o) - return (Expression *)o; - } - --Dsymbol *isDsymbol(Object *o) -+Dsymbol *isDsymbol(RootObject *o) - { - //return dynamic_cast<Dsymbol *>(o); - if (!o || o->dyncast() != DYNCAST_DSYMBOL) -@@ -69,7 +64,7 @@ Dsymbol *isDsymbol(Object *o) - return (Dsymbol *)o; - } - --Type *isType(Object *o) -+Type *isType(RootObject *o) - { - //return dynamic_cast<Type *>(o); - if (!o || o->dyncast() != DYNCAST_TYPE) -@@ -77,7 +72,7 @@ Type *isType(Object *o) - return (Type *)o; - } - --Tuple *isTuple(Object *o) -+Tuple *isTuple(RootObject *o) - { - //return dynamic_cast<Tuple *>(o); - if (!o || o->dyncast() != DYNCAST_TUPLE) -@@ -85,7 +80,7 @@ Tuple *isTuple(Object *o) - return (Tuple *)o; - } - --Parameter *isParameter(Object *o) -+Parameter *isParameter(RootObject *o) - { - //return dynamic_cast<Parameter *>(o); - if (!o || o->dyncast() != DYNCAST_PARAMETER) -@@ -96,7 +91,7 @@ Parameter *isParameter(Object *o) - /************************************** - * Is this Object an error? - */ --int isError(Object *o) -+int isError(RootObject *o) - { - Type *t = isType(o); - if (t) -@@ -107,6 +102,9 @@ int isError(Object *o) - Tuple *v = isTuple(o); - if (v) - return arrayObjectIsError(&v->objects); -+ Dsymbol *s = isDsymbol(o); -+ if (s->errors) -+ return 1; - return 0; - } - -@@ -117,7 +115,7 @@ int arrayObjectIsError(Objects *args) - { - for (size_t i = 0; i < args->dim; i++) - { -- Object *o = (*args)[i]; -+ RootObject *o = (*args)[i]; - if (isError(o)) - return 1; - } -@@ -128,7 +126,7 @@ int arrayObjectIsError(Objects *args) - * Try to get arg as a type. - */ - --Type *getType(Object *o) -+Type *getType(RootObject *o) - { - Type *t = isType(o); - if (!t) -@@ -139,7 +137,7 @@ Type *getType(Object *o) - return t; - } - --Dsymbol *getDsymbol(Object *oarg) -+Dsymbol *getDsymbol(RootObject *oarg) - { - //printf("getDsymbol()\n"); - //printf("e %p s %p t %p v %p\n", isExpression(oarg), isDsymbol(oarg), isType(oarg), isTuple(oarg)); -@@ -181,9 +179,8 @@ Expression *getValue(Expression *e) - { - VarDeclaration *v = ((VarExp *)e)->var->isVarDeclaration(); - if (v && v->storage_class & STCmanifest) -- { ExpInitializer *ei = v->init->isExpInitializer(); -- if (ei) -- e = ei->exp; -+ { -+ e = v->getConstInitializer(); - } - } - return e; -@@ -195,9 +192,8 @@ Expression *getValue(Dsymbol *&s) - { - VarDeclaration *v = s->isVarDeclaration(); - if (v && v->storage_class & STCmanifest) -- { ExpInitializer *ei = v->init->isExpInitializer(); -- if (ei) -- e = ei->exp, s = NULL; -+ { -+ e = v->getConstInitializer(); - } - } - return e; -@@ -208,7 +204,7 @@ Expression *getValue(Dsymbol *&s) - * Else, return 0. - */ - --int match(Object *o1, Object *o2, TemplateDeclaration *tempdecl, Scope *sc) -+int match(RootObject *o1, RootObject *o2) - { - Type *t1 = isType(o1); - Type *t2 = isType(o2); -@@ -232,25 +228,6 @@ int match(Object *o1, Object *o2, Templa - - if (t1) - { -- /* if t1 is an instance of ti, then give error -- * about recursive expansions. -- */ -- Dsymbol *s = t1->toDsymbol(sc); -- if (s && s->parent) -- { TemplateInstance *ti1 = s->parent->isTemplateInstance(); -- if (ti1 && ti1->tempdecl == tempdecl) -- { -- for (Scope *sc1 = sc; sc1; sc1 = sc1->enclosing) -- { -- if (sc1->scopesym == ti1) -- { -- tempdecl->error("recursive template expansion for template argument %s", t1->toChars()); -- return 1; // fake a match -- } -- } -- } -- } -- - //printf("t1 = %s\n", t1->toChars()); - //printf("t2 = %s\n", t2->toChars()); - if (!t2 || !t1->equals(t2)) -@@ -273,22 +250,26 @@ int match(Object *o1, Object *o2, Templa - } - else if (s1) - { -- if (!s2 || !s1->equals(s2) || s1->parent != s2->parent) -+ if (s2) -+ { -+ if (!s1->equals(s2)) -+ goto Lnomatch; -+ if (s1->parent != s2->parent && -+ !s1->isFuncDeclaration() && -+ !s2->isFuncDeclaration()) -+ { -+ goto Lnomatch; -+ } -+ } -+ else - goto Lnomatch; - } - else if (u1) - { - if (!u2) - goto Lnomatch; -- if (u1->objects.dim != u2->objects.dim) -+ if (!arrayObjectMatch(&u1->objects, &u2->objects)) - goto Lnomatch; -- for (size_t i = 0; i < u1->objects.dim; i++) -- { -- if (!match(u1->objects[i], -- u2->objects[i], -- tempdecl, sc)) -- goto Lnomatch; -- } - } - //printf("match\n"); - return 1; // match -@@ -302,16 +283,16 @@ Lnomatch: - /************************************ - * Match an array of them. - */ --int arrayObjectMatch(Objects *oa1, Objects *oa2, TemplateDeclaration *tempdecl, Scope *sc) -+int arrayObjectMatch(Objects *oa1, Objects *oa2) - { - if (oa1 == oa2) - return 1; - if (oa1->dim != oa2->dim) - return 0; - for (size_t j = 0; j < oa1->dim; j++) -- { Object *o1 = (*oa1)[j]; -- Object *o2 = (*oa2)[j]; -- if (!match(o1, o2, tempdecl, sc)) -+ { RootObject *o1 = (*oa1)[j]; -+ RootObject *o2 = (*oa2)[j]; -+ if (!match(o1, o2)) - { - return 0; - } -@@ -319,12 +300,105 @@ int arrayObjectMatch(Objects *oa1, Objec - return 1; - } - -+ -+/************************************ -+ * Return hash of Objects. -+ */ -+hash_t arrayObjectHash(Objects *oa1) -+{ -+ hash_t hash = 0; -+ for (size_t j = 0; j < oa1->dim; j++) -+ { /* Must follow the logic of match() -+ */ -+ RootObject *o1 = (*oa1)[j]; -+ if (Type *t1 = isType(o1)) -+ hash += (size_t)t1->deco; -+ else -+ { -+ Dsymbol *s1 = isDsymbol(o1); -+ Expression *e1 = s1 ? getValue(s1) : getValue(isExpression(o1)); -+ if (e1) -+ { -+ if (e1->op == TOKint64) -+ { -+ IntegerExp *ne = (IntegerExp *)e1; -+ hash += (size_t)ne->value; -+ } -+ } -+ else if (s1) -+ { -+ FuncAliasDeclaration *fa1 = s1->isFuncAliasDeclaration(); -+ if (fa1) -+ s1 = fa1->toAliasFunc(); -+ hash += (size_t)(void *)s1->getIdent() + (size_t)(void *)s1->parent; -+ } -+ else if (Tuple *u1 = isTuple(o1)) -+ hash += arrayObjectHash(&u1->objects); -+ } -+ } -+ return hash; -+} -+ -+ -+/****************************** -+ * Check template argument o1 to see if it is a recursive expansion of tempdecl in scope sc. -+ * If so, issue error and return 1. -+ */ -+ -+int checkRecursiveExpansion(RootObject *o1, TemplateDeclaration *tempdecl, Scope *sc) -+{ -+ if (Type *t1 = isType(o1)) -+ { -+ /* if t1 is an instance of ti, then give error -+ * about recursive expansions. -+ */ -+ Dsymbol *s = t1->toDsymbol(sc); -+ if (s && s->parent) -+ { -+ TemplateInstance *ti1 = s->parent->isTemplateInstance(); -+ if (ti1 && ti1->tempdecl == tempdecl) -+ { -+ for (Scope *sc1 = sc; sc1; sc1 = sc1->enclosing) -+ { -+ if (sc1->scopesym == ti1) -+ { -+ tempdecl->error("recursive template expansion for template argument %s", t1->toChars()); -+ return 1; -+ } -+ } -+ } -+ } -+ } -+ else if (Tuple *u1 = isTuple(o1)) -+ { -+ return arrayCheckRecursiveExpansion(&u1->objects, tempdecl, sc); -+ } -+ return 0; // no error -+} -+ -+ -+/************************************ -+ * Match an array of them. -+ */ -+int arrayCheckRecursiveExpansion(Objects *oa1, TemplateDeclaration *tempdecl, Scope *sc) -+{ -+ for (size_t j = 0; j < oa1->dim; j++) -+ { -+ RootObject *o1 = (*oa1)[j]; -+ if (checkRecursiveExpansion(o1, tempdecl, sc)) -+ return 1; -+ } -+ return 0; -+} -+ -+ -+ - /**************************************** - * This makes a 'pretty' version of the template arguments. - * It's analogous to genIdent() which makes a mangled version. - */ - --void ObjectToCBuffer(OutBuffer *buf, HdrGenState *hgs, Object *oarg) -+void ObjectToCBuffer(OutBuffer *buf, HdrGenState *hgs, RootObject *oarg) - { - //printf("ObjectToCBuffer()\n"); - Type *t = isType(oarg); -@@ -357,8 +431,8 @@ void ObjectToCBuffer(OutBuffer *buf, Hdr - for (size_t i = 0; i < args->dim; i++) - { - if (i) -- buf->writeByte(','); -- Object *o = (*args)[i]; -+ buf->writestring(", "); -+ RootObject *o = (*args)[i]; - ObjectToCBuffer(buf, hgs, o); - } - } -@@ -376,7 +450,7 @@ void ObjectToCBuffer(OutBuffer *buf, Hdr - } - - #if DMDV2 --Object *objectSyntaxCopy(Object *o) -+RootObject *objectSyntaxCopy(RootObject *o) - { - if (!o) - return NULL; -@@ -420,14 +494,17 @@ TemplateDeclaration::TemplateDeclaration - this->members = decldefs; - this->overnext = NULL; - this->overroot = NULL; -- this->semanticRun = PASSinit; -+ this->funcroot = NULL; - this->onemember = NULL; - this->literal = 0; - this->ismixin = ismixin; - this->previous = NULL; -+ this->protection = PROTundefined; -+ this->numinstances = 0; - - // Compute in advance for Ddoc's use -- if (members) -+ // Bugzilla 11153: ident could be NULL if parsing fails. -+ if (members && ident) - { - Dsymbol *s; - if (Dsymbol::oneMembers(members, &s, ident) && s) -@@ -470,7 +547,7 @@ void TemplateDeclaration::semantic(Scope - printf("sc->stc = %llx\n", sc->stc); - printf("sc->module = %s\n", sc->module->toChars()); - #endif -- if (semanticRun) -+ if (semanticRun != PASSinit) - return; // semantic() already run - semanticRun = PASSsemantic; - -@@ -525,7 +602,6 @@ void TemplateDeclaration::semantic(Scope - ScopeDsymbol *paramsym = new ScopeDsymbol(); - paramsym->parent = sc->parent; - Scope *paramscope = sc->push(paramsym); -- paramscope->parameterSpecialization = 1; - paramscope->stc = 0; - - if (!parent) -@@ -555,7 +631,7 @@ void TemplateDeclaration::semantic(Scope - { - TemplateParameter *tp = (*parameters)[i]; - -- tp->semantic(paramscope); -+ tp->semantic(paramscope, parameters); - if (i + 1 != parameters->dim && tp->isTemplateTupleParameter()) - { error("template tuple parameter must be last one"); - errors = true; -@@ -590,34 +666,42 @@ const char *TemplateDeclaration::kind() - - /********************************** - * Overload existing TemplateDeclaration 'this' with the new one 's'. -- * Return !=0 if successful; i.e. no conflict. -+ * Return true if successful; i.e. no conflict. - */ - --int TemplateDeclaration::overloadInsert(Dsymbol *s) -+bool TemplateDeclaration::overloadInsert(Dsymbol *s) - { -- TemplateDeclaration **pf; -- TemplateDeclaration *f; -- - #if LOG - printf("TemplateDeclaration::overloadInsert('%s')\n", s->toChars()); - #endif -- f = s->isTemplateDeclaration(); -- if (!f) -- return FALSE; -+ FuncDeclaration *fd = s->isFuncDeclaration(); -+ if (fd) -+ { -+ if (funcroot) -+ return funcroot->overloadInsert(fd); -+ funcroot = fd; -+ return funcroot->overloadInsert(this); -+ } -+ -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (!td) -+ return false; -+ - TemplateDeclaration *pthis = this; -- for (pf = &pthis; *pf; pf = &(*pf)->overnext) -+ TemplateDeclaration **ptd; -+ for (ptd = &pthis; *ptd; ptd = &(*ptd)->overnext) - { - #if 0 - // Conflict if TemplateParameter's match - // Will get caught anyway later with TemplateInstance, but - // should check it now. -- TemplateDeclaration *f2 = *pf; -+ TemplateDeclaration *f2 = *ptd; - -- if (f->parameters->dim != f2->parameters->dim) -+ if (td->parameters->dim != f2->parameters->dim) - goto Lcontinue; - -- for (size_t i = 0; i < f->parameters->dim; i++) -- { TemplateParameter *p1 = (*f->parameters)[i]; -+ for (size_t i = 0; i < td->parameters->dim; i++) -+ { TemplateParameter *p1 = (*td->parameters)[i]; - TemplateParameter *p2 = (*f2->parameters)[i]; - - if (!p1->overloadMatch(p2)) -@@ -627,19 +711,19 @@ int TemplateDeclaration::overloadInsert( - #if LOG - printf("\tfalse: conflict\n"); - #endif -- return FALSE; -+ return false; - - Lcontinue: - ; - #endif - } - -- f->overroot = this; -- *pf = f; -+ td->overroot = this; -+ *ptd = td; - #if LOG - printf("\ttrue: no conflict\n"); - #endif -- return TRUE; -+ return true; - } - - /**************************** -@@ -678,9 +762,6 @@ void TemplateDeclaration::makeParamNames - { - Parameter *fparam = Parameter::getNth(fparameters, i); - // Remove addMod same as func.d L1065 of FuncDeclaration::semantic3 -- //Type *vtype = fparam->type; -- //if (fd->type && fd->isPure()) -- // vtype = vtype->addMod(MODconst); - fparam->storageClass &= (STCin | STCout | STCref | STClazy | STCfinal | STC_TYPECTOR | STCnodtor); - fparam->storageClass |= STCparameter; - if (fvarargs == 2 && i + 1 == nfparams) -@@ -714,7 +795,7 @@ void TemplateDeclaration::makeParamNames - * Return match level. - */ - --MATCH TemplateDeclaration::matchWithInstance(TemplateInstance *ti, -+MATCH TemplateDeclaration::matchWithInstance(Scope *sc, TemplateInstance *ti, - Objects *dedtypes, Expressions *fargs, int flag) - { MATCH m; - size_t dedtypes_dim = dedtypes->dim; -@@ -752,16 +833,20 @@ MATCH TemplateDeclaration::matchWithInst - assert(dedtypes_dim >= ti->tiargs->dim || variadic); - - // Set up scope for parameters -- assert((size_t)scope > 0x10000); -+ assert(scope); - ScopeDsymbol *paramsym = new ScopeDsymbol(); - paramsym->parent = scope->parent; - Scope *paramscope = scope->push(paramsym); -+ Module *mi = ti->instantiatingModule ? ti->instantiatingModule : sc->instantiatingModule; -+ paramscope->instantiatingModule = mi; -+ paramscope->callsc = sc; - paramscope->stc = 0; - - // Attempt type deduction - m = MATCHexact; - for (size_t i = 0; i < dedtypes_dim; i++) -- { MATCH m2; -+ { -+ MATCH m2; - TemplateParameter *tp = (*parameters)[i]; - Declaration *sparam; - -@@ -773,7 +858,7 @@ MATCH TemplateDeclaration::matchWithInst - printf("\tparameter[%d] is %s : %s\n", i, tp->ident->toChars(), ttp->specType ? ttp->specType->toChars() : ""); - #endif - -- m2 = tp->matchArg(paramscope, ti->tiargs, i, parameters, dedtypes, &sparam); -+ m2 = tp->matchArg(ti->loc, paramscope, ti->tiargs, i, parameters, dedtypes, &sparam); - //printf("\tm2 = %d\n", m2); - - if (m2 == MATCHnomatch) -@@ -789,8 +874,9 @@ MATCH TemplateDeclaration::matchWithInst - - if (!flag) - sparam->semantic(paramscope); -- if (!paramscope->insert(sparam)) -- goto Lnomatch; -+ if (!paramscope->insert(sparam)) // TODO: This check can make more early -+ goto Lnomatch; // in TemplateDeclaration::semantic, and -+ // then we don't need to make sparam if flags == 0 - } - - if (!flag) -@@ -809,19 +895,48 @@ MATCH TemplateDeclaration::matchWithInst - - #if DMDV2 - if (m && constraint && !flag) -- { /* Check to see if constraint is satisfied. -+ { -+ /* Check to see if constraint is satisfied. - */ - makeParamNamesVisibleInConstraint(paramscope, fargs); - Expression *e = constraint->syntaxCopy(); -- Scope *sc = paramscope->push(); - - /* There's a chicken-and-egg problem here. We don't know yet if this template -- * instantiation will be a local one (isnested is set), and we won't know until -+ * instantiation will be a local one (enclosing is set), and we won't know until - * after selecting the correct template. Thus, function we're nesting inside - * is not on the sc scope chain, and this can cause errors in FuncDeclaration::getLevel(). - * Workaround the problem by setting a flag to relax the checking on frame errors. - */ -- sc->flags |= SCOPEstaticif; -+ -+ int nmatches = 0; -+ for (Previous *p = previous; p; p = p->prev) -+ { -+ if (arrayCheckRecursiveExpansion(p->dedargs, this, sc)) -+ goto Lnomatch; -+ -+ if (arrayObjectMatch(p->dedargs, dedtypes)) -+ { -+ //printf("recursive, no match p->sc=%p %p %s\n", p->sc, this, this->toChars()); -+ /* It must be a subscope of p->sc, other scope chains are not recursive -+ * instantiations. -+ */ -+ for (Scope *scx = sc; scx; scx = scx->enclosing) -+ { -+ if (scx == p->sc) -+ goto Lnomatch; -+ } -+ } -+ /* BUG: should also check for ref param differences -+ */ -+ } -+ -+ Previous pr; -+ pr.prev = previous; -+ pr.sc = paramscope; -+ pr.dedargs = dedtypes; -+ previous = ≺ // add this to threaded list -+ -+ int nerrors = global.errors; - - FuncDeclaration *fd = onemember && onemember->toAlias() ? - onemember->toAlias()->isFuncDeclaration() : NULL; -@@ -836,14 +951,22 @@ MATCH TemplateDeclaration::matchWithInst - fd->vthis = fd->declareThis(paramscope, ad); - } - -- e = e->semantic(sc); -- if (e->op == TOKerror) -- goto Lnomatch; -+ Scope *scx = paramscope->startCTFE(); -+ scx->flags |= SCOPEstaticif; -+ e = e->semantic(scx); -+ e = resolveProperties(scx, e); -+ scx = scx->endCTFE(); - - if (fd && fd->vthis) - fd->vthis = vthissave; - -- sc->pop(); -+ previous = pr.prev; // unlink from threaded list -+ -+ if (nerrors != global.errors) // if any errors from evaluating the constraint, no match -+ goto Lnomatch; -+ if (e->op == TOKerror) -+ goto Lnomatch; -+ - e = e->ctfeInterpret(); - if (e->isBool(TRUE)) - ; -@@ -866,7 +989,7 @@ MATCH TemplateDeclaration::matchWithInst - for (size_t i = 0; i < dedtypes_dim; i++) - { - TemplateParameter *tp = (*parameters)[i]; -- Object *oarg; -+ RootObject *oarg; - - printf(" [%d]", i); - -@@ -907,7 +1030,7 @@ Lret: - * 0 td2 is more specialized than this - */ - --MATCH TemplateDeclaration::leastAsSpecialized(TemplateDeclaration *td2, Expressions *fargs) -+MATCH TemplateDeclaration::leastAsSpecialized(Scope *sc, TemplateDeclaration *td2, Expressions *fargs) - { - /* This works by taking the template parameters to this template - * declaration and feeding them to td2 as if it were a template -@@ -916,7 +1039,7 @@ MATCH TemplateDeclaration::leastAsSpecia - * as td2. - */ - -- TemplateInstance ti(0, ident); // create dummy template instance -+ TemplateInstance ti(Loc(), ident); // create dummy template instance - Objects dedtypes; - - #define LOG_LEASTAS 0 -@@ -933,7 +1056,7 @@ MATCH TemplateDeclaration::leastAsSpecia - { - TemplateParameter *tp = (*parameters)[i]; - -- Object *p = (Object *)tp->dummyArg(); -+ RootObject *p = (RootObject *)tp->dummyArg(); - if (p) - (*ti.tiargs)[i] = p; - else -@@ -945,7 +1068,7 @@ MATCH TemplateDeclaration::leastAsSpecia - dedtypes.setDim(td2->parameters->dim); - - // Attempt a type deduction -- MATCH m = td2->matchWithInstance(&ti, &dedtypes, fargs, 1); -+ MATCH m = td2->matchWithInstance(sc, &ti, &dedtypes, fargs, 1); - if (m) - { - /* A non-variadic template is more specialized than a -@@ -971,8 +1094,9 @@ MATCH TemplateDeclaration::leastAsSpecia - * Match function arguments against a specific template function. - * Input: - * loc instantiation location -- * targsi Expression/Type initial list of template arguments -- * ethis 'this' argument if !NULL -+ * sc instantiation scope -+ * tiargs Expression/Type initial list of template arguments -+ * tthis 'this' argument if !NULL - * fargs arguments to function - * Output: - * dedargs Expression/Type deduced template arguments -@@ -982,18 +1106,18 @@ MATCH TemplateDeclaration::leastAsSpecia - * bit 4-7 Match template parameters by initial template arguments - */ - --MATCH TemplateDeclaration::deduceFunctionTemplateMatch(Scope *sc, Loc loc, Objects *targsi, -- Expression *ethis, Expressions *fargs, -+MATCH TemplateDeclaration::deduceFunctionTemplateMatch(FuncDeclaration *f, Loc loc, Scope *sc, Objects *tiargs, -+ Type *tthis, Expressions *fargs, - Objects *dedargs) - { - size_t nfparams; - size_t nfargs; -- size_t nargsi; // array size of targsi -+ size_t ntargs; // array size of tiargs - size_t fptupindex = IDX_NOTFOUND; - size_t tuple_dim = 0; - MATCH match = MATCHexact; -- MATCH matchTargsi = MATCHexact; -- FuncDeclaration *fd = onemember->toAlias()->isFuncDeclaration(); -+ MATCH matchTiargs = MATCHexact; -+ FuncDeclaration *fd = f; - Parameters *fparameters; // function parameter list - int fvarargs; // function varargs - Objects dedtypes; // for T:T*, the dedargs is the T*, dedtypes is the T -@@ -1004,17 +1128,17 @@ MATCH TemplateDeclaration::deduceFunctio - - #if 0 - printf("\nTemplateDeclaration::deduceFunctionTemplateMatch() %s\n", toChars()); -- for (size_t i = 0; i < fargs->dim; i++) -+ for (size_t i = 0; i < (fargs ? fargs->dim : 0); i++) - { Expression *e = (*fargs)[i]; - printf("\tfarg[%d] is %s, type is %s\n", i, e->toChars(), e->type->toChars()); - } - printf("fd = %s\n", fd->toChars()); - printf("fd->type = %s\n", fd->type->toChars()); -- if (ethis) -- printf("ethis->type = %s\n", ethis->type->toChars()); -+ if (tthis) -+ printf("tthis = %s\n", tthis->toChars()); - #endif - -- assert((size_t)scope > 0x10000); -+ assert(scope); - - dedargs->setDim(parameters->dim); - dedargs->zero(); -@@ -1029,31 +1153,38 @@ MATCH TemplateDeclaration::deduceFunctio - ScopeDsymbol *paramsym = new ScopeDsymbol(); - paramsym->parent = scope->parent; - Scope *paramscope = scope->push(paramsym); -+ -+ paramscope->instantiatingModule = sc->instantiatingModule; -+ Module *mi = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ if (!sc->instantiatingModule || sc->instantiatingModule->isRoot()) -+ paramscope->instantiatingModule = mi; -+ -+ paramscope->callsc = sc; - paramscope->stc = 0; - - TemplateTupleParameter *tp = isVariadic(); -- int tp_is_declared = 0; -+ bool tp_is_declared = false; - - #if 0 - for (size_t i = 0; i < dedargs->dim; i++) - { - printf("\tdedarg[%d] = ", i); -- Object *oarg = (*dedargs)[i]; -+ RootObject *oarg = (*dedargs)[i]; - if (oarg) printf("%s", oarg->toChars()); - printf("\n"); - } - #endif - - -- nargsi = 0; -- if (targsi) -+ ntargs = 0; -+ if (tiargs) - { // Set initial template arguments - -- nargsi = targsi->dim; -+ ntargs = tiargs->dim; - size_t n = parameters->dim; - if (tp) - n--; -- if (nargsi > n) -+ if (ntargs > n) - { if (!tp) - goto Lnomatch; - -@@ -1064,19 +1195,19 @@ MATCH TemplateDeclaration::deduceFunctio - assert(parameters->dim); - (*dedargs)[parameters->dim - 1] = t; - -- tuple_dim = nargsi - n; -+ tuple_dim = ntargs - n; - t->objects.setDim(tuple_dim); - for (size_t i = 0; i < tuple_dim; i++) - { -- t->objects[i] = (*targsi)[n + i]; -+ t->objects[i] = (*tiargs)[n + i]; - } - declareParameter(paramscope, tp, t); -- tp_is_declared = 1; -+ tp_is_declared = true; - } - else -- n = nargsi; -+ n = ntargs; - -- memcpy(dedargs->tdata(), targsi->tdata(), n * sizeof(*dedargs->tdata())); -+ memcpy(dedargs->tdata(), tiargs->tdata(), n * sizeof(*dedargs->tdata())); - - for (size_t i = 0; i < n; i++) - { assert(i < parameters->dim); -@@ -1084,18 +1215,18 @@ MATCH TemplateDeclaration::deduceFunctio - MATCH m; - Declaration *sparam = NULL; - -- m = tp->matchArg(paramscope, dedargs, i, parameters, &dedtypes, &sparam); -+ m = tp->matchArg(loc, paramscope, dedargs, i, parameters, &dedtypes, &sparam); - //printf("\tdeduceType m = %d\n", m); - if (m == MATCHnomatch) - goto Lnomatch; -- if (m < matchTargsi) -- matchTargsi = m; -+ if (m < matchTiargs) -+ matchTiargs = m; - - sparam->semantic(paramscope); - if (!paramscope->insert(sparam)) - goto Lnomatch; - } -- if (n < parameters->dim) -+ if (n < parameters->dim && !tp_is_declared) - { - inferparams = new TemplateParameters(); - inferparams->setDim(parameters->dim - n); -@@ -1105,12 +1236,13 @@ MATCH TemplateDeclaration::deduceFunctio - } - else - inferparams = NULL; -+ //printf("tiargs matchTiargs = %d\n", matchTiargs); - } - #if 0 - for (size_t i = 0; i < dedargs->dim; i++) - { - printf("\tdedarg[%d] = ", i); -- Object *oarg = (*dedargs)[i]; -+ RootObject *oarg = (*dedargs)[i]; - if (oarg) printf("%s", oarg->toChars()); - printf("\n"); - } -@@ -1123,23 +1255,25 @@ MATCH TemplateDeclaration::deduceFunctio - /* Check for match of function arguments with variadic template - * parameter, such as: - * -- * template Foo(T, A...) { void Foo(T t, A a); } -- * void main() { Foo(1,2,3); } -+ * void foo(T, A...)(T t, A a); -+ * void main() { foo(1,2,3); } - */ - if (tp) // if variadic - { -+ // TemplateTupleParameter always makes most lesser matching. -+ matchTiargs = MATCHconvert; -+ - if (nfparams == 0 && nfargs != 0) // if no function parameters - { -- if (tp_is_declared) -- goto L2; -- Tuple *t = new Tuple(); -- //printf("t = %p\n", t); -- (*dedargs)[parameters->dim - 1] = t; -- declareParameter(paramscope, tp, t); -- goto L2; -+ if (!tp_is_declared) -+ { -+ Tuple *t = new Tuple(); -+ //printf("t = %p\n", t); -+ (*dedargs)[parameters->dim - 1] = t; -+ declareParameter(paramscope, tp, t); -+ tp_is_declared = true; -+ } - } -- else if (nfargs < nfparams - 1) -- goto L1; - else - { - /* Figure out which of the function parameters matches -@@ -1159,22 +1293,127 @@ MATCH TemplateDeclaration::deduceFunctio - if (fvarargs) // variadic function doesn't - goto Lnomatch; // go with variadic template - -- if (tp_is_declared) -- goto L2; -+ goto L1; -+ } -+ fptupindex = IDX_NOTFOUND; -+ L1: -+ ; -+ } -+ } -+ -+#if DMDV2 -+ if (tthis) -+ { -+ bool hasttp = false; -+ -+ // Match 'tthis' to any TemplateThisParameter's -+ for (size_t i = 0; i < parameters->dim; i++) -+ { TemplateParameter *tp = (*parameters)[i]; -+ TemplateThisParameter *ttp = tp->isTemplateThisParameter(); -+ if (ttp) -+ { hasttp = true; -+ -+ Type *t = new TypeIdentifier(Loc(), ttp->ident); -+ MATCH m = tthis->deduceType(paramscope, t, parameters, &dedtypes); -+ if (!m) -+ goto Lnomatch; -+ if (m < match) -+ match = m; // pick worst match -+ } -+ } -+ -+ // Match attributes of tthis against attributes of fd -+ if (fd->type && !fd->isCtorDeclaration()) -+ { -+ unsigned mod = fd->type->mod; -+ StorageClass stc = scope->stc | fd->storage_class2; -+ // Propagate parent storage class (see bug 5504) -+ Dsymbol *p = parent; -+ while (p->isTemplateDeclaration() || p->isTemplateInstance()) -+ p = p->parent; -+ AggregateDeclaration *ad = p->isAggregateDeclaration(); -+ if (ad) -+ stc |= ad->storage_class; -+ -+ if (stc & (STCshared | STCsynchronized)) -+ mod |= MODshared; -+ if (stc & STCimmutable) -+ mod |= MODimmutable; -+ if (stc & STCconst) -+ mod |= MODconst; -+ if (stc & STCwild) -+ mod |= MODwild; -+ // Fix mod -+ if (mod & MODimmutable) -+ mod = MODimmutable; -+ if (mod & MODconst) -+ mod &= ~STCwild; -+ -+ unsigned thismod = tthis->mod; -+ if (hasttp) -+ mod = MODmerge(thismod, mod); -+ if (thismod != mod) -+ { -+ if (!MODmethodConv(thismod, mod)) -+ goto Lnomatch; -+ if (MATCHconst < match) -+ match = MATCHconst; -+ } -+ } -+ } -+#endif -+ -+ // Loop through the function parameters -+ { -+ //printf("%s nfargs=%d, nfparams=%d, tuple_dim = %d\n", toChars(), nfargs, nfparams, tuple_dim); -+ //printf("\ttp = %p, fptupindex = %d, found = %d, tp_is_declared = %d\n", tp, fptupindex, fptupindex != IDX_NOTFOUND, tp_is_declared); -+ size_t argi = 0; -+ for (size_t parami = 0; parami < nfparams; parami++) -+ { -+ Parameter *fparam = Parameter::getNth(fparameters, parami); - -- // Apply function parameter storage classes to parameter type -- tid = (TypeIdentifier *)tid->addStorageClass(fparam->storageClass); -+ // Apply function parameter storage classes to parameter types -+ Type *prmtype = fparam->type->addStorageClass(fparam->storageClass); - -+ /* See function parameters which wound up -+ * as part of a template tuple parameter. -+ */ -+ if (fptupindex != IDX_NOTFOUND && parami == fptupindex) -+ { -+ assert(prmtype->ty == Tident); -+ TypeIdentifier *tid = (TypeIdentifier *)prmtype; -+ if (!tp_is_declared) -+ { - /* The types of the function arguments - * now form the tuple argument. - */ - Tuple *t = new Tuple(); - (*dedargs)[parameters->dim - 1] = t; - -- tuple_dim = nfargs - (nfparams - 1); -+ /* Count function parameters following a tuple parameter. -+ * void foo(U, T...)(int y, T, U, int) {} // rem == 2 (U, int) -+ */ -+ size_t rem = 0; -+ for (size_t j = parami + 1; j < nfparams; j++) -+ { -+ Parameter *p = Parameter::getNth(fparameters, j); -+ if (!inferparams || !p->type->reliesOnTident(inferparams)) -+ { -+ Type *pt = p->type->syntaxCopy()->semantic(fd->loc, paramscope); -+ rem += pt->ty == Ttuple ? ((TypeTuple *)pt)->arguments->dim : 1; -+ } -+ else -+ { -+ ++rem; -+ } -+ } -+ -+ if (nfargs - argi < rem) -+ goto Lnomatch; -+ tuple_dim = nfargs - argi - rem; - t->objects.setDim(tuple_dim); - for (size_t i = 0; i < tuple_dim; i++) -- { Expression *farg = (*fargs)[fptupindex + i]; -+ { Expression *farg = (*fargs)[argi + i]; - - // Check invalid arguments to detect errors early. - if (farg->op == TOKerror || farg->type->ty == Terror) -@@ -1199,7 +1438,6 @@ MATCH TemplateDeclaration::deduceFunctio - case X(MODwild, MODimmutable): - case X(MODwild | MODshared, MODshared): - case X(MODwild | MODshared, MODconst | MODshared): -- - if (mod & MODwild) - wildmatch |= MODwild; - else if (mod == 0) -@@ -1224,14 +1462,13 @@ MATCH TemplateDeclaration::deduceFunctio - case X(0, MODconst | MODshared): - case X(0, MODwild): - case X(0, MODwild | MODshared): -- // foo(U:U) T => T -- // foo(U:U) const(T) => const(T) -- // foo(U:U) immutable(T) => immutable(T) -- // foo(U:U) shared(T) => shared(T) -- // foo(U:U) const(shared(T)) => const(shared(T)) -- // foo(U:U) wild(T) => wild(T) -- // foo(U:U) wild(shared(T)) => wild(shared(T)) -- -+ // foo(U:U) T => T -+ // foo(U:U) const(T) => const(T) -+ // foo(U:U) immutable(T) => immutable(T) -+ // foo(U:U) shared(T) => shared(T) -+ // foo(U:U) const(shared(T)) => const(shared(T)) -+ // foo(U:U) wild(T) => wild(T) -+ // foo(U:U) wild(shared(T)) => wild(shared(T)) - tt = farg->type; - m = MATCHexact; - break; -@@ -1242,13 +1479,12 @@ MATCH TemplateDeclaration::deduceFunctio - case X(MODconst | MODshared, MODconst | MODshared): - case X(MODwild, MODwild): - case X(MODwild | MODshared, MODwild | MODshared): -- // foo(U:const(U)) const(T) => T -- // foo(U:immutable(U)) immutable(T) => T -- // foo(U:shared(U)) shared(T) => T -- // foo(U:const(shared(U)) const(shared(T)) => T -- // foo(U:wild(U)) wild(T) => T -- // foo(U:wild(shared(U)) wild(shared(T)) => T -- -+ // foo(U:const(U)) const(T) => T -+ // foo(U:immutable(U)) immutable(T) => T -+ // foo(U:shared(U)) shared(T) => T -+ // foo(U:const(shared(U))) const(shared(T)) => T -+ // foo(U:wild(U)) wild(T) => T -+ // foo(U:wild(shared(U))) wild(shared(T)) => T - tt = farg->type->mutableOf()->unSharedOf(); - m = MATCHexact; - break; -@@ -1259,12 +1495,11 @@ MATCH TemplateDeclaration::deduceFunctio - case X(MODconst | MODshared, MODimmutable): - case X(MODconst, MODwild): - case X(MODconst, MODwild | MODshared): -- // foo(U:const(U)) T => T -- // foo(U:const(U)) immutable(T) => T -- // foo(U:const(U)) const(shared(T)) => shared(T) -- // foo(U:const(shared(U)) immutable(T) => T -- // foo(U:const(U)) wild(shared(T)) => shared(T) -- -+ // foo(U:const(U)) T => T -+ // foo(U:const(U)) immutable(T) => T -+ // foo(U:const(U)) const(shared(T)) => shared(T) -+ // foo(U:const(shared(U))) immutable(T) => T -+ // foo(U:const(U)) wild(shared(T)) => shared(T) - tt = farg->type->mutableOf(); - m = MATCHconst; - break; -@@ -1272,9 +1507,9 @@ MATCH TemplateDeclaration::deduceFunctio - case X(MODshared, MODconst | MODshared): - case X(MODconst | MODshared, MODshared): - case X(MODshared, MODwild | MODshared): -- // foo(U:shared(U)) const(shared(T)) => const(T) -- // foo(U:const(shared(U)) shared(T) => T -- // foo(U:shared(U)) wild(shared(T)) => wild(T) -+ // foo(U:shared(U)) const(shared(T)) => const(T) -+ // foo(U:const(shared(U))) shared(T) => T -+ // foo(U:shared(U)) wild(shared(T)) => wild(T) - tt = farg->type->unSharedOf(); - m = MATCHconst; - break; -@@ -1306,34 +1541,33 @@ MATCH TemplateDeclaration::deduceFunctio - case X(MODimmutable, MODwild | MODshared): - case X(MODconst | MODshared, MODwild | MODshared): - case X(MODwild, MODwild | MODshared): -- -- // foo(U:immutable(U)) T => nomatch -- // foo(U:immutable(U)) const(T) => nomatch -- // foo(U:immutable(U)) shared(T) => nomatch -- // foo(U:immutable(U)) const(shared(T)) => nomatch -- // foo(U:const(U)) shared(T) => nomatch -- // foo(U:shared(U)) T => nomatch -- // foo(U:shared(U)) const(T) => nomatch -- // foo(U:shared(U)) immutable(T) => nomatch -- // foo(U:const(shared(U)) T => nomatch -- // foo(U:const(shared(U)) const(T) => nomatch -- // foo(U:immutable(U)) wild(T) => nomatch -- // foo(U:shared(U)) wild(T) => nomatch -- // foo(U:const(shared(U)) wild(T) => nomatch -- // foo(U:wild(U)) T => nomatch -- // foo(U:wild(U)) const(T) => nomatch -- // foo(U:wild(U)) immutable(T) => nomatch -- // foo(U:wild(U)) shared(T) => nomatch -- // foo(U:wild(U)) const(shared(T)) => nomatch -- // foo(U:wild(shared(U)) T => nomatch -- // foo(U:wild(shared(U)) const(T) => nomatch -- // foo(U:wild(shared(U)) immutable(T) => nomatch -- // foo(U:wild(shared(U)) shared(T) => nomatch -- // foo(U:wild(shared(U)) const(shared(T)) => nomatch -- // foo(U:wild(shared(U)) wild(T) => nomatch -- // foo(U:immutable(U)) wild(shared(T)) => nomatch -- // foo(U:const(shared(U))) wild(shared(T)) => nomatch -- // foo(U:wild(U)) wild(shared(T)) => nomatch -+ // foo(U:immutable(U)) T => nomatch -+ // foo(U:immutable(U)) const(T) => nomatch -+ // foo(U:immutable(U)) shared(T) => nomatch -+ // foo(U:immutable(U)) const(shared(T)) => nomatch -+ // foo(U:const(U)) shared(T) => nomatch -+ // foo(U:shared(U)) T => nomatch -+ // foo(U:shared(U)) const(T) => nomatch -+ // foo(U:shared(U)) immutable(T) => nomatch -+ // foo(U:const(shared(U))) T => nomatch -+ // foo(U:const(shared(U))) const(T) => nomatch -+ // foo(U:immutable(U)) wild(T) => nomatch -+ // foo(U:shared(U)) wild(T) => nomatch -+ // foo(U:const(shared(U))) wild(T) => nomatch -+ // foo(U:wild(U)) T => nomatch -+ // foo(U:wild(U)) const(T) => nomatch -+ // foo(U:wild(U)) immutable(T) => nomatch -+ // foo(U:wild(U)) shared(T) => nomatch -+ // foo(U:wild(U)) const(shared(T)) => nomatch -+ // foo(U:wild(shared(U))) T => nomatch -+ // foo(U:wild(shared(U))) const(T) => nomatch -+ // foo(U:wild(shared(U))) immutable(T) => nomatch -+ // foo(U:wild(shared(U))) shared(T) => nomatch -+ // foo(U:wild(shared(U))) const(shared(T)) => nomatch -+ // foo(U:wild(shared(U))) wild(T) => nomatch -+ // foo(U:immutable(U)) wild(shared(T)) => nomatch -+ // foo(U:const(shared(U))) wild(shared(T)) => nomatch -+ // foo(U:wild(U)) wild(shared(T)) => nomatch - m = MATCHnomatch; - break; - -@@ -1360,104 +1594,45 @@ MATCH TemplateDeclaration::deduceFunctio - t->objects[i] = tt; - } - declareParameter(paramscope, tp, t); -- goto L2; - } -- fptupindex = IDX_NOTFOUND; -+ argi += tuple_dim; -+ continue; - } -- } - --L1: -- if (nfparams == nfargs) -- ; -- else if (nfargs > nfparams) -- { -- if (fvarargs == 0) -- goto Lnomatch; // too many args, no match -- match = MATCHconvert; // match ... with a conversion -- } -- --L2: --#if DMDV2 -- if (ethis) -- { -- // Match 'ethis' to any TemplateThisParameter's -- for (size_t i = 0; i < parameters->dim; i++) -- { TemplateParameter *tp = (*parameters)[i]; -- TemplateThisParameter *ttp = tp->isTemplateThisParameter(); -- if (ttp) -- { MATCH m; -- -- Type *t = new TypeIdentifier(0, ttp->ident); -- m = ethis->type->deduceType(paramscope, t, parameters, &dedtypes); -- if (!m) -- goto Lnomatch; -- if (m < match) -- match = m; // pick worst match -- } -- } -- -- // Match attributes of ethis against attributes of fd -- if (fd->type && !fd->isCtorDeclaration()) -- { -- Type *tthis = ethis->type; -- unsigned mod = fd->type->mod; -- StorageClass stc = scope->stc | fd->storage_class2; -- // Propagate parent storage class (see bug 5504) -- Dsymbol *p = parent; -- while (p->isTemplateDeclaration() || p->isTemplateInstance()) -- p = p->parent; -- AggregateDeclaration *ad = p->isAggregateDeclaration(); -- if (ad) -- stc |= ad->storage_class; -- -- if (stc & (STCshared | STCsynchronized)) -- mod |= MODshared; -- if (stc & STCimmutable) -- mod |= MODimmutable; -- if (stc & STCconst) -- mod |= MODconst; -- if (stc & STCwild) -- mod |= MODwild; -- // Fix mod -- if (mod & MODimmutable) -- mod = MODimmutable; -- if (mod & MODconst) -- mod &= ~STCwild; -- if (tthis->mod != mod) -- { -- if (!MODmethodConv(tthis->mod, mod)) -- goto Lnomatch; -- if (MATCHconst < match) -- match = MATCHconst; -+ // If parameter type doesn't depend on inferred template parameters, -+ // semantic it to get actual type. -+ if (!inferparams || !prmtype->reliesOnTident(inferparams)) -+ { -+ // should copy prmtype to avoid affecting semantic result -+ prmtype = prmtype->syntaxCopy()->semantic(fd->loc, paramscope); -+ -+ if (prmtype->ty == Ttuple) -+ { -+ TypeTuple *tt = (TypeTuple *)prmtype; -+ size_t tt_dim = tt->arguments->dim; -+ for (size_t j = 0; j < tt_dim; j++, ++argi) -+ { -+ Parameter *p = (*tt->arguments)[j]; -+ if (j == tt_dim - 1 && fvarargs == 2 && parami + 1 == nfparams && argi < nfargs) -+ { -+ prmtype = p->type; -+ goto Lvarargs; -+ } -+ if (argi >= nfargs) -+ { -+ if (p->defaultArg) -+ continue; -+ goto Lnomatch; -+ } -+ Expression *farg = (*fargs)[argi]; -+ if (!farg->implicitConvTo(p->type)) -+ goto Lnomatch; -+ } -+ continue; - } - } -- } --#endif -- -- // Loop through the function parameters -- for (size_t parami = 0; parami < nfparams; parami++) -- { -- /* Skip over function parameters which wound up -- * as part of a template tuple parameter. -- */ -- if (parami == fptupindex) -- continue; -- /* Set i = index into function arguments -- * Function parameters correspond to function arguments as follows. -- * Note that tuple_dim may be zero, and there may be default or -- * variadic arguments at the end. -- * arg [0..fptupindex] == param[0..fptupindex] -- * arg [fptupindex..fptupindex+tuple_dim] == param[fptupindex] -- * arg[fputupindex+dim.. ] == param[fptupindex+1.. ] -- */ -- size_t i = parami; -- if (fptupindex != IDX_NOTFOUND && parami > fptupindex) -- i += tuple_dim - 1; -- -- Parameter *fparam = Parameter::getNth(fparameters, parami); -- Type *prmtype = fparam->type; - -- if (i >= nfargs) // if not enough arguments -+ if (argi >= nfargs) // if not enough arguments - { - if (fparam->defaultArg) - { /* Default arguments do not participate in template argument -@@ -1468,7 +1643,7 @@ L2: - } - else - { -- Expression *farg = (*fargs)[i]; -+ Expression *farg = (*fargs)[argi]; - - // Check invalid arguments to detect errors early. - if (farg->op == TOKerror || farg->type->ty == Terror) -@@ -1481,28 +1656,31 @@ Lretry: - #endif - Type *argtype = farg->type; - -- // Apply function parameter storage classes to parameter types -- prmtype = prmtype->addStorageClass(fparam->storageClass); -- -- // If parameter type doesn't depend on inferred template parameters, -- // semantic it to get actual type. -- if (!inferparams || !prmtype->reliesOnTident(inferparams)) -- { -- // should copy prmtype to avoid affecting semantic result -- prmtype = prmtype->syntaxCopy()->semantic(fd->loc, paramscope); -- } -- - #if DMDV2 -- /* Allow string literals which are type [] to match with [dim] -+ /* Allow expressions that have CT-known boundaries and type [] to match with [dim] - */ -- if (farg->op == TOKstring) -- { StringExp *se = (StringExp *)farg; -- if (!se->committed && argtype->ty == Tarray && -- prmtype->toBasetype()->ty == Tsarray) -- { -- argtype = new TypeSArray(argtype->nextOf(), new IntegerExp(se->loc, se->len, Type::tindex)); -- argtype = argtype->semantic(se->loc, NULL); -- argtype = argtype->invariantOf(); -+ Type *taai; -+ if ( argtype->ty == Tarray && -+ (prmtype->ty == Tsarray || -+ prmtype->ty == Taarray && (taai = ((TypeAArray *)prmtype)->index)->ty == Tident && -+ ((TypeIdentifier *)taai)->idents.dim == 0)) -+ { -+ if (farg->op == TOKstring) -+ { -+ StringExp *se = (StringExp *)farg; -+ argtype = TypeSArray::makeType(se->loc, argtype->nextOf(), se->len); -+ } -+ else if (farg->op == TOKslice) -+ { -+ SliceExp *se = (SliceExp *)farg; -+ Type *tsa = se->toStaticArrayType(); -+ if (tsa) -+ argtype = tsa; -+ } -+ else if (farg->op == TOKarrayliteral) -+ { -+ ArrayLiteralExp *ae = (ArrayLiteralExp *)farg; -+ argtype = TypeSArray::makeType(ae->loc, argtype->nextOf(), ae->elements->dim); - } - } - -@@ -1511,7 +1689,7 @@ Lretry: - if (farg->op == TOKfunction) - { FuncExp *fe = (FuncExp *)farg; - Type *tp = prmtype; -- Expression *e = fe->inferType(tp, 1, parameters); -+ Expression *e = fe->inferType(tp, 1, paramscope, inferparams); - if (!e) - goto Lvarargs; - farg = e; -@@ -1532,7 +1710,7 @@ Lretry: - } - #endif - -- if (fvarargs == 2 && i + 1 == nfparams && i + 1 < nfargs) -+ if (fvarargs == 2 && parami + 1 == nfparams && argi + 1 < nfargs) - goto Lvarargs; - - unsigned wm = 0; -@@ -1590,9 +1768,17 @@ Lretry: - } - - if (m && (fparam->storageClass & (STCref | STCauto)) == STCref) -- { if (!farg->isLvalue()) -+ { -+ if (!farg->isLvalue()) - { -- goto Lnomatch; -+ if (farg->op == TOKstring && argtype->ty == Tsarray) -+ { -+ } -+ else if (farg->op == TOKslice && argtype->ty == Tsarray) -+ { // Allow conversion from T[lwr .. upr] to ref T[upr-lwr] -+ } -+ else -+ goto Lnomatch; - } - } - if (m && (fparam->storageClass & STCout)) -@@ -1606,6 +1792,7 @@ Lretry: - if (m) - { if (m < match) - match = m; // pick worst match -+ argi++; - continue; - } - } -@@ -1614,7 +1801,7 @@ Lretry: - /* The following code for variadic arguments closely - * matches TypeFunction::callMatch() - */ -- if (!(fvarargs == 2 && i + 1 == nfparams)) -+ if (!(fvarargs == 2 && parami + 1 == nfparams)) - goto Lnomatch; - - /* Check for match with function parameter T... -@@ -1629,12 +1816,12 @@ Lretry: - if (tb->ty == Tsarray) - { TypeSArray *tsa = (TypeSArray *)tb; - dinteger_t sz = tsa->dim->toInteger(); -- if (sz != nfargs - i) -+ if (sz != nfargs - argi) - goto Lnomatch; - } - else if (tb->ty == Taarray) - { TypeAArray *taa = (TypeAArray *)tb; -- Expression *dim = new IntegerExp(loc, nfargs - i, Type::tsize_t); -+ Expression *dim = new IntegerExp(loc, nfargs - argi, Type::tsize_t); - - size_t i = templateParameterLookup(taa->index, parameters); - if (i == IDX_NOTFOUND) -@@ -1644,7 +1831,7 @@ Lretry: - taa->index->resolve(loc, sc, &e, &t, &s); - if (!e) - goto Lnomatch; -- e = e->optimize(WANTvalue | WANTinterpret); -+ e = e->ctfeInterpret(); - e = e->implicitCastTo(sc, Type::tsize_t); - e = e->optimize(WANTvalue); - if (!dim->equals(e)) -@@ -1652,7 +1839,7 @@ Lretry: - } - else - { // This code matches code in TypeInstance::deduceType() -- TemplateParameter *tprm = parameters->tdata()[i]; -+ TemplateParameter *tprm = (*parameters)[i]; - TemplateValueParameter *tvp = tprm->isTemplateValueParameter(); - if (!tvp) - goto Lnomatch; -@@ -1664,7 +1851,7 @@ Lretry: - } - else - { -- Type *vt = tvp->valType->semantic(0, sc); -+ Type *vt = tvp->valType->semantic(Loc(), sc); - MATCH m = (MATCH)dim->implicitConvTo(vt); - if (!m) - goto Lnomatch; -@@ -1676,16 +1863,16 @@ Lretry: - } - case Tarray: - { TypeArray *ta = (TypeArray *)tb; -- for (; i < nfargs; i++) -+ for (; argi < nfargs; argi++) - { -- Expression *arg = (*fargs)[i]; -+ Expression *arg = (*fargs)[argi]; - assert(arg); - - if (arg->op == TOKfunction) - { FuncExp *fe = (FuncExp *)arg; - Type *tp = tb->nextOf(); - -- Expression *e = fe->inferType(tp, 1, parameters); -+ Expression *e = fe->inferType(tp, 1, paramscope, inferparams); - if (!e) - goto Lnomatch; - arg = e; -@@ -1730,19 +1917,24 @@ Lretry: - default: - goto Lnomatch; - } -+ ++argi; -+ } -+ //printf("-> argi = %d, nfargs = %d\n", argi, nfargs); -+ if (argi != nfargs && !fvarargs) -+ goto Lnomatch; - } - - Lmatch: - -- for (size_t i = nargsi; i < dedargs->dim; i++) -+ for (size_t i = ntargs; i < dedargs->dim; i++) - { - TemplateParameter *tparam = (*parameters)[i]; - //printf("tparam[%d] = %s\n", i, tparam->ident->toChars()); - /* For T:T*, the dedargs is the T*, dedtypes is the T - * But for function templates, we really need them to match - */ -- Object *oarg = (*dedargs)[i]; -- Object *oded = dedtypes[i]; -+ RootObject *oarg = (*dedargs)[i]; -+ RootObject *oded = dedtypes[i]; - //printf("1dedargs[%d] = %p, dedtypes[%d] = %p\n", i, oarg, i, oded); - //if (oarg) printf("oarg: %s\n", oarg->toChars()); - //if (oded) printf("oded: %s\n", oded->toChars()); -@@ -1750,21 +1942,25 @@ Lmatch: - { - if (oded) - { -- if (tparam->specialization()) -+ if (tparam->specialization() || !tparam->isTemplateTypeParameter()) - { /* The specialization can work as long as afterwards - * the oded == oarg - */ -- Declaration *sparam; - (*dedargs)[i] = oded; -- MATCH m2 = tparam->matchArg(paramscope, dedargs, i, parameters, &dedtypes, &sparam); -+ MATCH m2 = tparam->matchArg(loc, paramscope, dedargs, i, parameters, &dedtypes, NULL); - //printf("m2 = %d\n", m2); - if (!m2) - goto Lnomatch; -- if (m2 < match) -- match = m2; // pick worst match -+ if (m2 < matchTiargs) -+ matchTiargs = m2; // pick worst match - if (dedtypes[i] != oded) - error("specialization not allowed for deduced parameter %s", tparam->ident->toChars()); - } -+ else -+ { -+ if (MATCHconvert < matchTiargs) -+ matchTiargs = MATCHconvert; -+ } - } - else - { oded = tparam->defaultArg(loc, paramscope); -@@ -1772,9 +1968,9 @@ Lmatch: - { - if (tp && // if tuple parameter and - fptupindex == IDX_NOTFOUND && // tuple parameter was not in function parameter list and -- nargsi == dedargs->dim - 1) // we're one argument short (i.e. no tuple argument) -+ ntargs == dedargs->dim - 1) // we're one argument short (i.e. no tuple argument) - { // make tuple argument an empty tuple -- oded = (Object *)new Tuple(); -+ oded = (RootObject *)new Tuple(); - } - else - goto Lnomatch; -@@ -1787,12 +1983,12 @@ Lmatch: - - #if DMDV2 - if (constraint) -- { /* Check to see if constraint is satisfied. -+ { -+ /* Check to see if constraint is satisfied. - * Most of this code appears twice; this is a good candidate for refactoring. - */ - makeParamNamesVisibleInConstraint(paramscope, fargs); - Expression *e = constraint->syntaxCopy(); -- paramscope->flags |= SCOPEstaticif; - - /* Detect recursive attempts to instantiate this template declaration, - * Bugzilla 4072 -@@ -1803,7 +1999,10 @@ Lmatch: - int nmatches = 0; - for (Previous *p = previous; p; p = p->prev) - { -- if (arrayObjectMatch(p->dedargs, dedargs, this, sc)) -+ if (arrayCheckRecursiveExpansion(p->dedargs, this, sc)) -+ goto Lnomatch; -+ -+ if (arrayObjectMatch(p->dedargs, dedargs)) - { - //printf("recursive, no match p->sc=%p %p %s\n", p->sc, this, this->toChars()); - /* It must be a subscope of p->sc, other scope chains are not recursive -@@ -1827,8 +2026,7 @@ Lmatch: - - int nerrors = global.errors; - -- FuncDeclaration *fd = onemember && onemember->toAlias() ? -- onemember->toAlias()->isFuncDeclaration() : NULL; -+ FuncDeclaration *fd = f; - Dsymbol *s = parent; - while (s->isTemplateInstance() || s->isTemplateMixin()) - s = s->parent; -@@ -1840,7 +2038,11 @@ Lmatch: - fd->vthis = fd->declareThis(paramscope, ad); - } - -- e = e->semantic(paramscope); -+ Scope *scx = paramscope->startCTFE(); -+ scx->flags |= SCOPEstaticif; -+ e = e->semantic(scx); -+ e = resolveProperties(scx, e); -+ scx->endCTFE(); - - if (fd && fd->vthis) - fd->vthis = vthissave; -@@ -1873,7 +2075,7 @@ Lmatch: - - paramscope->pop(); - //printf("\tmatch %d\n", match); -- return (MATCH)(match | (matchTargsi<<4)); -+ return (MATCH)(match | (matchTiargs<<4)); - - Lnomatch: - paramscope->pop(); -@@ -1885,7 +2087,7 @@ Lnomatch: - * Declare template parameter tp with value o, and install it in the scope sc. - */ - --Object *TemplateDeclaration::declareParameter(Scope *sc, TemplateParameter *tp, Object *o) -+RootObject *TemplateDeclaration::declareParameter(Scope *sc, TemplateParameter *tp, RootObject *o) - { - //printf("TemplateDeclaration::declareParameter('%s', o = %p)\n", tp->ident->toChars(), o); - -@@ -1897,45 +2099,29 @@ Object *TemplateDeclaration::declarePara - Dsymbol *s; - VarDeclaration *v = NULL; - -- // See if tp->ident already exists with a matching definition -- Dsymbol *scopesym; -- s = sc->search(loc, tp->ident, &scopesym); -- if (s && scopesym == sc->scopesym) -- { -- TupleDeclaration *td = s->isTupleDeclaration(); -- if (va && td) -- { Tuple tup; -- tup.objects = *td->objects; -- if (match(va, &tup, this, sc)) -- { -- return o; -- } -- } -- } - if (ea && ea->op == TOKtype) - targ = ea->type; - else if (ea && ea->op == TOKimport) - sa = ((ScopeExp *)ea)->sds; - else if (ea && (ea->op == TOKthis || ea->op == TOKsuper)) - sa = ((ThisExp *)ea)->var; -+ else if (ea && ea->op == TOKfunction) -+ { -+ if (((FuncExp *)ea)->td) -+ sa = ((FuncExp *)ea)->td; -+ else -+ sa = ((FuncExp *)ea)->fd; -+ } - - if (targ) - { - //printf("type %s\n", targ->toChars()); -- s = new AliasDeclaration(0, tp->ident, targ); -+ s = new AliasDeclaration(Loc(), tp->ident, targ); - } - else if (sa) - { - //printf("Alias %s %s;\n", sa->ident->toChars(), tp->ident->toChars()); -- s = new AliasDeclaration(0, tp->ident, sa); -- } -- else if (ea && ea->op == TOKfunction) -- { -- if (((FuncExp *)ea)->td) -- sa = ((FuncExp *)ea)->td; -- else -- sa = ((FuncExp *)ea)->fd; -- s = new AliasDeclaration(0, tp->ident, sa); -+ s = new AliasDeclaration(Loc(), tp->ident, sa); - } - else if (ea) - { -@@ -1946,7 +2132,7 @@ Object *TemplateDeclaration::declarePara - Type *t = tvp ? tvp->valType : NULL; - - v = new VarDeclaration(loc, t, tp->ident, init); -- v->storage_class = STCmanifest; -+ v->storage_class = STCmanifest | STCtemplateparameter; - s = v; - } - else if (va) -@@ -1967,7 +2153,7 @@ Object *TemplateDeclaration::declarePara - /* So the caller's o gets updated with the result of semantic() being run on o - */ - if (v) -- return (Object *)v->init->toExpression(); -+ return (RootObject *)v->init->toExpression(); - return o; - } - -@@ -1993,310 +2179,468 @@ TemplateTupleParameter *TemplateDeclarat - * We can overload templates. - */ - --int TemplateDeclaration::isOverloadable() -+bool TemplateDeclaration::isOverloadable() - { -- return 1; -+ return true; - } - - /************************************************* - * Given function arguments, figure out which template function -- * to expand, and return that function. -- * If no match, give error message and return NULL. -+ * to expand, and return matching result. - * Input: -- * sc instantiation scope -+ * m matching result -+ * dstart the root of overloaded function templates - * loc instantiation location -- * targsi initial list of template arguments -- * ethis if !NULL, the 'this' pointer argument -+ * sc instantiation scope -+ * tiargs initial list of template arguments -+ * tthis if !NULL, the 'this' pointer argument - * fargs arguments to function -- * flags 1: do not issue error message on no match, just return NULL - */ - --FuncDeclaration *TemplateDeclaration::deduceFunctionTemplate(Scope *sc, Loc loc, -- Objects *targsi, Expression *ethis, Expressions *fargs, int flags) -+void functionResolve(Match *m, Dsymbol *dstart, Loc loc, Scope *sc, -+ Objects *tiargs, Type *tthis, Expressions *fargs) - { -- MATCH m_best = MATCHnomatch; -- MATCH m_best2 = MATCHnomatch; -- TemplateDeclaration *td_ambig = NULL; -- TemplateDeclaration *td_best = NULL; -- Objects *tdargs = new Objects(); -- TemplateInstance *ti; -- FuncDeclaration *fd_best; -- - #if 0 -- printf("TemplateDeclaration::deduceFunctionTemplate() %s\n", toChars()); -- printf(" targsi:\n"); -- if (targsi) -- { for (size_t i = 0; i < targsi->dim; i++) -- { Object *arg = (*targsi)[i]; -+ printf("functionResolve() dstart = %s\n", dstart->toChars()); -+ printf(" tiargs:\n"); -+ if (tiargs) -+ { for (size_t i = 0; i < tiargs->dim; i++) -+ { RootObject *arg = (*tiargs)[i]; - printf("\t%s\n", arg->toChars()); - } - } - printf(" fargs:\n"); -- for (size_t i = 0; i < fargs->dim; i++) -+ for (size_t i = 0; i < (fargs ? fargs->dim : 0); i++) - { Expression *arg = (*fargs)[i]; - printf("\t%s %s\n", arg->type->toChars(), arg->toChars()); - //printf("\tty = %d\n", arg->type->ty); - } -- printf("stc = %llx\n", scope->stc); -+ //printf("stc = %llx\n", dstart->scope->stc); -+ //printf("match:t/f = %d/%d\n", ta_last, m->last); - #endif - -- for (TemplateDeclaration *td = this; td; td = td->overnext) -+ struct ParamDeduce -+ { -+ // context -+ Loc loc; -+ Scope *sc; -+ Type *tthis; -+ Objects *tiargs; -+ Expressions *fargs; -+ // result -+ Match *m; -+ int property; // 0: unintialized -+ // 1: seen @property -+ // 2: not @property -+ size_t ov_index; -+ TemplateDeclaration *td_best; -+ MATCH ta_last; -+ Objects *tdargs; -+ Type *tthis_best; -+ -+ static int fp(void *param, Dsymbol *s) -+ { -+ if (FuncDeclaration *fd = s->isFuncDeclaration()) -+ return ((ParamDeduce *)param)->fp(fd); -+ if (TemplateDeclaration *td = s->isTemplateDeclaration()) -+ return ((ParamDeduce *)param)->fp(td); -+ return 0; -+ } -+ int fp(FuncDeclaration *fd) -+ { -+ // skip duplicates -+ if (fd == m->lastf) -+ return 0; -+ // explicitly specified tiargs never match to non template function -+ if (tiargs && tiargs->dim > 0) -+ return 0; -+ -+ //printf("fd = %s %s\n", fd->toChars(), fd->type->toChars()); -+ m->anyf = fd; -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ -+ int prop = (tf->isproperty) ? 1 : 2; -+ if (property == 0) -+ property = prop; -+ else if (property != prop) -+ error(fd->loc, "cannot overload both property and non-property functions"); -+ -+ /* For constructors, qualifier check will be opposite direction. -+ * Qualified constructor always makes qualified object, then will be checked -+ * that it is implicitly convertible to tthis. -+ */ -+ Type *tthis_fd = fd->needThis() ? tthis : NULL; -+ if (tthis_fd && fd->isCtorDeclaration()) -+ { -+ //printf("%s tf->mod = x%x tthis_fd->mod = x%x %d\n", tf->toChars(), -+ // tf->mod, tthis_fd->mod, fd->isolateReturn()); -+ if (MODimplicitConv(tf->mod, tthis_fd->mod) || -+ tf->isWild() && tf->isShared() == tthis_fd->isShared() || -+ fd->isolateReturn()/* && tf->isShared() == tthis_fd->isShared()*/) -+ { // Uniquely constructed object can ignore shared qualifier. -+ // TODO: Is this appropriate? -+ tthis_fd = NULL; -+ } -+ else -+ return 0; // MATCHnomatch -+ } -+ MATCH mfa = tf->callMatch(tthis_fd, fargs); -+ //printf("test1: mfa = %d\n", mfa); -+ if (mfa != MATCHnomatch) -+ { -+ if (mfa > m->last) goto LfIsBetter; -+ if (mfa < m->last) goto LlastIsBetter; -+ -+ /* See if one of the matches overrides the other. -+ */ -+ assert(m->lastf); -+ if (m->lastf->overrides(fd)) goto LlastIsBetter; -+ if (fd->overrides(m->lastf)) goto LfIsBetter; -+ -+ /* Try to disambiguate using template-style partial ordering rules. -+ * In essence, if f() and g() are ambiguous, if f() can call g(), -+ * but g() cannot call f(), then pick f(). -+ * This is because f() is "more specialized." -+ */ -+ { -+ MATCH c1 = fd->leastAsSpecialized(m->lastf); -+ MATCH c2 = m->lastf->leastAsSpecialized(fd); -+ //printf("c1 = %d, c2 = %d\n", c1, c2); -+ if (c1 > c2) goto LfIsBetter; -+ if (c1 < c2) goto LlastIsBetter; -+ } -+ -+ /* If the two functions are the same function, like: -+ * int foo(int); -+ * int foo(int x) { ... } -+ * then pick the one with the body. -+ */ -+ if (tf->equals(m->lastf->type) && -+ fd->storage_class == m->lastf->storage_class && -+ fd->parent == m->lastf->parent && -+ fd->protection == m->lastf->protection && -+ fd->linkage == m->lastf->linkage) -+ { -+ if ( fd->fbody && !m->lastf->fbody) goto LfIsBetter; -+ if (!fd->fbody && m->lastf->fbody) goto LlastIsBetter; -+ } -+ -+ Lambiguous: -+ m->nextf = fd; -+ m->count++; -+ return 0; -+ -+ LlastIsBetter: -+ return 0; -+ -+ LfIsBetter: -+ td_best = NULL; -+ ta_last = MATCHexact; -+ m->last = mfa; -+ m->lastf = fd; -+ tthis_best = tthis_fd; -+ ov_index = 0; -+ m->count = 1; -+ tdargs->setDim(0); -+ return 0; -+ } -+ return 0; -+ } -+ int fp(TemplateDeclaration *td) - { -- if (!td->semanticRun) -+ // skip duplicates -+ if (td == td_best) -+ return 0; -+ -+ if (!sc) -+ sc = td->scope; // workaround for Type::aliasthisOf -+ -+ if (td->semanticRun == PASSinit) -+ { -+ if (td->scope) -+ { -+ // Try to fix forward reference. Ungag errors while doing so. -+ Ungag ungag = td->ungagSpeculative(); -+ td->semantic(td->scope); -+ } -+ } -+ if (td->semanticRun == PASSinit) - { -- error("forward reference to template %s", td->toChars()); -+ ::error(loc, "forward reference to template %s", td->toChars()); - goto Lerror; - } -- if (!td->onemember || !td->onemember->toAlias()->isFuncDeclaration()) -+ FuncDeclaration *f; -+ f = td->onemember ? td->onemember/*->toAlias()*/->isFuncDeclaration() : NULL; -+ if (!f) - { -- if (!targsi) -- targsi = new Objects(); -- TemplateInstance *ti = new TemplateInstance(loc, td, targsi); -+ if (!tiargs) -+ tiargs = new Objects(); -+ TemplateInstance *ti = new TemplateInstance(loc, td, tiargs); - - Objects dedtypes; - dedtypes.setDim(td->parameters->dim); -- assert(td->semanticRun); -- MATCH m2 = td->matchWithInstance(ti, &dedtypes, fargs, 0); -- //printf("matchWithInstance = %d\n", m2); -- if (!m2 || m2 < m_best2) // no match or less match -- continue; -+ assert(td->semanticRun != PASSinit); -+ MATCH mta = td->matchWithInstance(sc, ti, &dedtypes, fargs, 0); -+ //printf("matchWithInstance = %d\n", mta); -+ if (!mta || mta < ta_last) // no match or less match -+ return 0; - - ti->semantic(sc, fargs); - if (!ti->inst) // if template failed to expand -- continue; -+ return 0; - - Dsymbol *s = ti->inst->toAlias(); -- FuncDeclaration *fd = s->isFuncDeclaration(); -- if (!fd) -- { -- td->error("is not a function template"); -+ if (!s->isFuncDeclaration() && !s->isTemplateDeclaration()) - goto Lerror; -- } -- fd = fd->overloadResolve(loc, ethis, fargs, flags); -+ FuncDeclaration *fd = resolveFuncCall(loc, sc, s, NULL, tthis, fargs, 1); - if (!fd) -- continue; -+ return 0; -+ -+ Type *tthis_fd = fd->needThis() && !fd->isCtorDeclaration() ? tthis : NULL; - - TypeFunction *tf = (TypeFunction *)fd->type; -- MATCH m = (MATCH) tf->callMatch(fd->needThis() && !fd->isCtorDeclaration() ? ethis : NULL, fargs); -- if (m < m_best) -- continue; -+ MATCH mfa = tf->callMatch(tthis_fd, fargs); -+ if (mfa < m->last) -+ return 0; - - // td is the new best match -- td_ambig = NULL; -- assert((size_t)td->scope > 0x10000); -+ assert(td->scope); - td_best = td; -- fd_best = fd; -- m_best = m; -- m_best2 = m2; -+ property = 0; // (backward compatibility) -+ ta_last = mta; -+ m->last = mfa; -+ m->lastf = fd; -+ tthis_best = tthis_fd; -+ ov_index = 0; -+ m->nextf = NULL; -+ m->count = 1; - tdargs->setDim(dedtypes.dim); - memcpy(tdargs->tdata(), dedtypes.tdata(), tdargs->dim * sizeof(void *)); -- continue; -+ return 0; - } - -- MATCH m, m2; -- Objects dedargs; -- FuncDeclaration *fd = NULL; -- -- m = td->deduceFunctionTemplateMatch(sc, loc, targsi, ethis, fargs, &dedargs); -- m2 = (MATCH)(m >> 4); -- m = (MATCH)(m & 0xF); -- //printf("deduceFunctionTemplateMatch = %d, m2 = %d\n", m, m2); -- if (!m) // if no match -- continue; -- -- if (m2 < m_best2) -- goto Ltd_best; -- if (m2 > m_best2) -- goto Ltd; -- -- if (m < m_best) -- goto Ltd_best; -- if (m > m_best) -- goto Ltd; -- -+ //printf("td = %s\n", td->toChars()); -+ for (size_t ovi = 0; f; f = f->overnext0, ovi++) - { -- // Disambiguate by picking the most specialized TemplateDeclaration -- MATCH c1 = td->leastAsSpecialized(td_best, fargs); -- MATCH c2 = td_best->leastAsSpecialized(td, fargs); -- //printf("1: c1 = %d, c2 = %d\n", c1, c2); -+ Objects dedtypes; -+ FuncDeclaration *fd = NULL; -+ int x = td->deduceFunctionTemplateMatch(f, loc, sc, tiargs, tthis, fargs, &dedtypes); -+ MATCH mta = (MATCH)(x >> 4); -+ MATCH mfa = (MATCH)(x & 0xF); -+ //printf("match:t/f = %d/%d\n", mta, mfa); -+ if (!mfa) // if no match -+ continue; - -- if (c1 > c2) -- goto Ltd; -- else if (c1 < c2) -- goto Ltd_best; -- } -+ Type *tthis_fd = NULL; -+ if (f->isCtorDeclaration()) -+ { -+ // Constructor call requires additional check. -+ // For that, do instantiate in early stage. -+ fd = td->doHeaderInstantiation(sc, &dedtypes, tthis, fargs); -+ if (!fd) -+ goto Lerror; -+ -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ tthis_fd = fd->needThis() ? tthis : NULL; -+ if (tthis_fd) -+ { -+ assert(tf->next); -+ if (MODimplicitConv(tf->mod, tthis_fd->mod) || -+ tf->isWild() && tf->isShared() == tthis_fd->isShared() || -+ fd->isolateReturn()) -+ { -+ tthis_fd = NULL; -+ } -+ else -+ continue; // MATCHnomatch -+ } -+ } - -- if (!fd_best) -- { -- fd_best = td_best->doHeaderInstantiation(sc, tdargs, fargs); -- if (!fd_best) -- goto Lerror; -- } -- { -- fd = td->doHeaderInstantiation(sc, &dedargs, fargs); -- if (!fd) -- goto Lerror; -- } -- assert(fd && fd_best); -+ if (mta < ta_last) goto Ltd_best; -+ if (mta > ta_last) goto Ltd; - -- { -- // Disambiguate by tf->callMatch -- TypeFunction *tf1 = (TypeFunction *)fd->type; -- TypeFunction *tf2 = (TypeFunction *)fd_best->type; -- MATCH c1 = (MATCH) tf1->callMatch(fd->needThis() && !fd->isCtorDeclaration() ? ethis : NULL, fargs); -- MATCH c2 = (MATCH) tf2->callMatch(fd_best->needThis() && !fd_best->isCtorDeclaration() ? ethis : NULL, fargs); -- //printf("2: c1 = %d, c2 = %d\n", c1, c2); -+ if (mfa < m->last) goto Ltd_best; -+ if (mfa > m->last) goto Ltd; - -- if (c1 > c2) -- goto Ltd; -- if (c1 < c2) -- goto Ltd_best; -- } -+ if (td_best) -+ { -+ // Disambiguate by picking the most specialized TemplateDeclaration -+ MATCH c1 = td->leastAsSpecialized(sc, td_best, fargs); -+ MATCH c2 = td_best->leastAsSpecialized(sc, td, fargs); -+ //printf("1: c1 = %d, c2 = %d\n", c1, c2); -+ if (c1 > c2) goto Ltd; -+ if (c1 < c2) goto Ltd_best; -+ } - -- { -- // Disambiguate by picking the most specialized FunctionDeclaration -- MATCH c1 = fd->leastAsSpecialized(fd_best); -- MATCH c2 = fd_best->leastAsSpecialized(fd); -- //printf("3: c1 = %d, c2 = %d\n", c1, c2); -+ if (!m->lastf) -+ { -+ assert(td_best); -+ m->lastf = td_best->doHeaderInstantiation(sc, tdargs, tthis, fargs); -+ if (!m->lastf) goto Lerror; -+ tthis_best = m->lastf->needThis() ? tthis : NULL; -+ } -+ if (!fd) -+ { -+ fd = td->doHeaderInstantiation(sc, &dedtypes, tthis, fargs); -+ if (!fd) goto Lerror; -+ tthis_fd = fd->needThis() ? tthis : NULL; -+ } -+ assert(fd && m->lastf); -+ -+ { -+ // Disambiguate by tf->callMatch -+ TypeFunction *tf1 = (TypeFunction *)fd->type; -+ TypeFunction *tf2 = (TypeFunction *)m->lastf->type; -+ MATCH c1 = tf1->callMatch(tthis_fd, fargs); -+ MATCH c2 = tf2->callMatch(tthis_best, fargs); -+ //printf("2: c1 = %d, c2 = %d\n", c1, c2); -+ if (c1 > c2) goto Ltd; -+ if (c1 < c2) goto Ltd_best; -+ } -+ { -+ // Disambiguate by picking the most specialized FunctionDeclaration -+ MATCH c1 = fd->leastAsSpecialized(m->lastf); -+ MATCH c2 = m->lastf->leastAsSpecialized(fd); -+ //printf("3: c1 = %d, c2 = %d\n", c1, c2); -+ if (c1 > c2) goto Ltd; -+ if (c1 < c2) goto Ltd_best; -+ } -+ -+ Lambig: // td_best and td are ambiguous -+ //printf("Lambig\n"); -+ m->nextf = fd; // Caution! m->nextf isn't complete instantiated fd, so must not call toPrettyChars() -+ m->count++; -+ continue; -+ -+ Ltd_best: // td_best is the best match so far -+ continue; - -- if (c1 > c2) -- goto Ltd; -- if (c1 < c2) -- goto Ltd_best; -+ Ltd: // td is the new best match -+ assert(td->scope); -+ td_best = td; -+ property = 0; // (backward compatibility) -+ ta_last = mta; -+ m->last = mfa; -+ m->lastf = fd; -+ tthis_best = tthis_fd; -+ ov_index = ovi; -+ m->nextf = NULL; -+ m->count = 1; -+ tdargs->setDim(dedtypes.dim); -+ memcpy(tdargs->tdata(), dedtypes.tdata(), tdargs->dim * sizeof(void *)); -+ continue; - } -+ return 0; - -- Lambig: // td_best and td are ambiguous -- td_ambig = td; -- continue; -+ Lerror: -+ m->lastf = NULL; -+ m->count = 0; -+ m->last = MATCHnomatch; -+ return 1; -+ } -+ }; -+ ParamDeduce p; -+ // context -+ p.loc = loc; -+ p.sc = sc; -+ p.tthis = tthis; -+ p.tiargs = tiargs; -+ p.fargs = fargs; -+ -+ // result -+ p.m = m; -+ p.property = 0; -+ p.ov_index = 0; -+ p.td_best = NULL; -+ p.ta_last = m->last ? MATCHexact : MATCHnomatch; -+ p.tdargs = new Objects(); -+ p.tthis_best = NULL; -+ -+ FuncDeclaration *fd = dstart->isFuncDeclaration(); -+ TemplateDeclaration *td = dstart->isTemplateDeclaration(); -+ if (td && td->funcroot) -+ dstart = td->funcroot; -+ overloadApply(dstart, &p, &ParamDeduce::fp); -+ -+ //printf("td_best = %p, m->lastf = %p, match:t/f = %d/%d\n", td_best, m->lastf, mta, mfa); -+ if (p.td_best) -+ { -+ // Matches to template function -+ if (!p.td_best->onemember || !p.td_best->onemember->toAlias()->isFuncDeclaration()) -+ return; // goto Lerror? - -- Ltd_best: // td_best is the best match so far -- td_ambig = NULL; -- continue; -+ /* The best match is td_best with arguments tdargs. -+ * Now instantiate the template. -+ */ -+ assert(p.td_best->scope); -+ if (!sc) sc = p.td_best->scope; // workaround for Type::aliasthisOf -+ TemplateInstance *ti; -+ ti = new TemplateInstance(loc, p.td_best, p.tdargs); -+ ti->semantic(sc, fargs); -+ m->lastf = ti->toAlias()->isFuncDeclaration(); -+ if (!m->lastf) -+ goto Lerror; - -- Ltd: // td is the new best match -- td_ambig = NULL; -- assert((size_t)td->scope > 0x10000); -- td_best = td; -- fd_best = fd; -- m_best = m; -- m_best2 = m2; -- tdargs->setDim(dedargs.dim); -- memcpy(tdargs->tdata(), dedargs.tdata(), tdargs->dim * sizeof(void *)); -- continue; -- } -- if (!td_best) -- { -- if (!(flags & 1)) -+ // look forward instantiated overload function -+ // Dsymbol::oneMembers is alredy called in TemplateInstance::semantic. -+ // it has filled overnext0d -+ while (p.ov_index--) - { -- ::error(loc, "%s %s.%s does not match any function template declaration. Candidates are:", -- kind(), parent->toPrettyChars(), ident->toChars()); -- -- // Display candidate template functions -- int numToDisplay = 5; // sensible number to display -- for (TemplateDeclaration *td = this; td; td = td->overnext) -- { -- ::errorSupplemental(td->loc, "%s", td->toPrettyChars()); -- if (!global.params.verbose && --numToDisplay == 0) -- { -- // Too many overloads to sensibly display. -- // Just show count of remaining overloads. -- int remaining = 0; -- for (; td; td = td->overnext) -- ++remaining; -- if (remaining > 0) -- ::errorSupplemental(loc, "... (%d more, -v to show) ...", remaining); -- break; -- } -- } -+ m->lastf = m->lastf->overnext0; -+ assert(m->lastf); - } -- goto Lerror; -- } -- if (td_ambig) -- { -- ::error(loc, "%s %s.%s matches more than one template declaration, %s(%d):%s and %s(%d):%s", -- kind(), parent->toPrettyChars(), ident->toChars(), -- td_best->loc.filename, td_best->loc.linnum, td_best->toChars(), -- td_ambig->loc.filename, td_ambig->loc.linnum, td_ambig->toChars()); -- } - -- if (!td_best->onemember || !td_best->onemember->toAlias()->isFuncDeclaration()) -- return fd_best; -+ p.tthis_best = m->lastf->needThis() && !m->lastf->isCtorDeclaration() ? tthis : NULL; - -- /* The best match is td_best with arguments tdargs. -- * Now instantiate the template. -- */ -- assert((size_t)td_best->scope > 0x10000); -- ti = new TemplateInstance(loc, td_best, tdargs); -- ti->semantic(sc, fargs); -- fd_best = ti->toAlias()->isFuncDeclaration(); -- if (!fd_best) -- goto Lerror; -+ TypeFunction *tf = (TypeFunction *)m->lastf->type; -+ assert(tf->ty == Tfunction); -+ if (!tf->callMatch(p.tthis_best, fargs)) -+ goto Lerror; - -- if (FuncLiteralDeclaration *fld = fd_best->isFuncLiteralDeclaration()) -- { -- // Inside template constraint, nested reference check doesn't work correctly. -- if (!(sc->flags & SCOPEstaticif) && fld->tok == TOKreserved) -- { // change to non-nested -- fld->tok = TOKfunction; -- fld->vthis = NULL; -+ if (FuncLiteralDeclaration *fld = m->lastf->isFuncLiteralDeclaration()) -+ { -+ if ((sc->flags & SCOPEstaticif) || sc->intypeof) -+ { -+ // Inside template constraint, or inside typeof, -+ // nested reference check doesn't work correctly. -+ } -+ else if (fld->tok == TOKreserved) -+ { -+ // change to non-nested -+ fld->tok = TOKfunction; -+ fld->vthis = NULL; -+ } - } -- } - -- /* As Bugzilla 3682 shows, a template instance can be matched while instantiating -- * that same template. Thus, the function type can be incomplete. Complete it. -- * -- * Bugzilla 9208: For auto function, completion should be deferred to the end of -- * its semantic3. Should not complete it in here. -- */ -- { TypeFunction *tf = (TypeFunction *)fd_best->type; -- assert(tf->ty == Tfunction); -- if (tf->next && !fd_best->inferRetType) -+ /* As Bugzilla 3682 shows, a template instance can be matched while instantiating -+ * that same template. Thus, the function type can be incomplete. Complete it. -+ * -+ * Bugzilla 9208: For auto function, completion should be deferred to the end of -+ * its semantic3. Should not complete it in here. -+ */ -+ if (tf->next && !m->lastf->inferRetType) - { -- fd_best->type = tf->semantic(loc, sc); -+ m->lastf->type = tf->semantic(loc, sc); - } - } -- -- fd_best->functionSemantic(); -- -- return fd_best; -- -- Lerror: --#if DMDV2 -- if (!(flags & 1)) --#endif -+ else if (m->lastf) - { -- HdrGenState hgs; -- -- OutBuffer bufa; -- Objects *args = targsi; -- if (args) -- { for (size_t i = 0; i < args->dim; i++) -- { -- if (i) -- bufa.writeByte(','); -- Object *oarg = (*args)[i]; -- ObjectToCBuffer(&bufa, &hgs, oarg); -- } -- } -- -- OutBuffer buf; -- argExpTypesToCBuffer(&buf, fargs, &hgs); -- if (this->overnext) -- ::error(this->loc, "%s %s.%s cannot deduce template function from argument types !(%s)(%s)", -- kind(), parent->toPrettyChars(), ident->toChars(), -- bufa.toChars(), buf.toChars()); -- else -- error(loc, "cannot deduce template function from argument types !(%s)(%s)", -- bufa.toChars(), buf.toChars()); -+ // Matches to non template function -+ } -+ else -+ { -+ Lerror: -+ m->lastf = NULL; -+ m->count = 0; -+ m->last = MATCHnomatch; - } -- return NULL; - } - - /************************************************* - * Limited function template instantiation for using fd->leastAsSpecialized() - */ - FuncDeclaration *TemplateDeclaration::doHeaderInstantiation(Scope *sc, -- Objects *tdargs, Expressions *fargs) -+ Objects *tdargs, Type *tthis, Expressions *fargs) - { - FuncDeclaration *fd = onemember->toAlias()->isFuncDeclaration(); - if (!fd) -@@ -2305,15 +2649,15 @@ FuncDeclaration *TemplateDeclaration::do - #if 0 - printf("doHeaderInstantiation this = %s\n", toChars()); - for (size_t i = 0; i < tdargs->dim; ++i) -- printf("\ttdargs[%d] = %s\n", i, ((Object *)tdargs->data[i])->toChars()); -+ printf("\ttdargs[%d] = %s\n", i, ((RootObject *)tdargs->data[i])->toChars()); - #endif - -- assert((size_t)scope > 0x10000); -+ assert(scope); - TemplateInstance *ti = new TemplateInstance(loc, this, tdargs); - ti->tinst = sc->tinst; - { -- ti->tdtypes.setDim(ti->tempdecl->parameters->dim); -- if (!ti->tempdecl->matchWithInstance(ti, &ti->tdtypes, fargs, 2)) -+ ti->tdtypes.setDim(parameters->dim); -+ if (!matchWithInstance(sc, ti, &ti->tdtypes, fargs, 2)) - return NULL; - } - -@@ -2321,20 +2665,37 @@ FuncDeclaration *TemplateDeclaration::do - - // function body and contracts are not need - //fd = fd->syntaxCopy(NULL)->isFuncDeclaration(); -- fd = new FuncDeclaration(fd->loc, fd->endloc, fd->ident, fd->storage_class, fd->type->syntaxCopy()); -+ if (fd->isCtorDeclaration()) -+ fd = new CtorDeclaration(fd->loc, fd->endloc, fd->storage_class, fd->type->syntaxCopy()); -+ else -+ fd = new FuncDeclaration(fd->loc, fd->endloc, fd->ident, fd->storage_class, fd->type->syntaxCopy()); - fd->parent = ti; - -- Scope *scope = this->scope; -+ Module *mi = sc->instantiatingModule ? sc->instantiatingModule : sc->module; - -+ Scope *scope = this->scope; - ti->argsym = new ScopeDsymbol(); - ti->argsym->parent = scope->parent; - scope = scope->push(ti->argsym); -+ scope->instantiatingModule = mi; -+ -+ bool hasttp = false; - - Scope *paramscope = scope->push(); - paramscope->stc = 0; - ti->declareParameters(paramscope); - paramscope->pop(); - -+ if (tthis) -+ { -+ // Match 'tthis' to any TemplateThisParameter's -+ for (size_t i = 0; i < parameters->dim; i++) -+ { TemplateParameter *tp = (*parameters)[i]; -+ TemplateThisParameter *ttp = tp->isTemplateThisParameter(); -+ if (ttp) -+ hasttp = true; -+ } -+ } - { - TypeFunction *tf = (TypeFunction *)fd->type; - if (tf && tf->ty == Tfunction) -@@ -2343,15 +2704,39 @@ FuncDeclaration *TemplateDeclaration::do - - Scope *sc2; - sc2 = scope->push(ti); -- sc2->parent = /*isnested ? sc->parent :*/ ti; -+ sc2->parent = /*enclosing ? sc->parent :*/ ti; - sc2->tinst = ti; - - { - Scope *sc = sc2; - sc = sc->push(); - -+ if (hasttp) -+ fd->type = fd->type->addMod(tthis->mod); -+ //printf("tthis = %s, fdtype = %s\n", tthis->toChars(), fd->type->toChars()); - if (fd->isCtorDeclaration()) -+ { - sc->flags |= SCOPEctor; -+ -+ Dsymbol *parent = toParent2(); -+ Type *tret; -+ AggregateDeclaration *ad = parent->isAggregateDeclaration(); -+ if (!ad || parent->isUnionDeclaration()) -+ { -+ tret = Type::tvoid; -+ } -+ else -+ { tret = ad->handle; -+ assert(tret); -+ tret = tret->addStorageClass(fd->storage_class | sc->stc); -+ tret = tret->addMod(fd->type->mod); -+ } -+ ((TypeFunction *)fd->type)->next = tret; -+ if (ad && ad->isStructDeclaration()) -+ ((TypeFunction *)fd->type)->isref = 1; -+ //printf("fd->type = %s\n", fd->type->toChars()); -+ } -+ fd->type = fd->type->addSTC(sc->stc); - fd->type = fd->type->semantic(fd->loc, sc); - sc = sc->pop(); - } -@@ -2460,6 +2845,117 @@ char *TemplateDeclaration::toChars() - return (char *)buf.extractData(); - } - -+PROT TemplateDeclaration::prot() -+{ -+ return protection; -+} -+ -+/**************************************************** -+ * Given a new instance tithis of this TemplateDeclaration, -+ * see if there already exists an instance. -+ * If so, return that existing instance. -+ */ -+ -+TemplateInstance *TemplateDeclaration::findExistingInstance(TemplateInstance *tithis, Expressions *fargs) -+{ -+ tithis->fargs = fargs; -+ hash_t hash = tithis->hashCode(); -+ -+ if (!buckets.dim) -+ { -+ buckets.setDim(7); -+ buckets.zero(); -+ } -+ size_t bi = hash % buckets.dim; -+ TemplateInstances *instances = buckets[bi]; -+ if (instances) -+ { -+ for (size_t i = 0; i < instances->dim; i++) -+ { -+ TemplateInstance *ti = (*instances)[i]; -+#if LOG -+ printf("\t%s: checking for match with instance %d (%p): '%s'\n", tithis->toChars(), i, ti, ti->toChars()); -+#endif -+ if (hash == ti->hash && -+ tithis->compare(ti) == 0) -+ { -+ //printf("hash = %p yes %d n = %d\n", hash, instances->dim, numinstances); -+ return ti; -+ } -+ } -+ } -+ //printf("hash = %p no\n", hash); -+ return NULL; // didn't find a match -+} -+ -+/******************************************** -+ * Add instance ti to TemplateDeclaration's table of instances. -+ * Return a handle we can use to later remove it if it fails instantiation. -+ */ -+ -+TemplateInstance *TemplateDeclaration::addInstance(TemplateInstance *ti) -+{ -+ /* See if we need to rehash -+ */ -+ if (numinstances > buckets.dim * 4) -+ { // rehash -+ //printf("rehash\n"); -+ size_t newdim = buckets.dim * 2 + 1; -+ TemplateInstances **newp = (TemplateInstances **)::calloc(newdim, sizeof(TemplateInstances *)); -+ assert(newp); -+ for (size_t bi = 0; bi < buckets.dim; ++bi) -+ { -+ TemplateInstances *instances = buckets[bi]; -+ if (instances) -+ { -+ for (size_t i = 0; i < instances->dim; i++) -+ { -+ TemplateInstance *ti1 = (*instances)[i]; -+ size_t newbi = ti1->hash % newdim; -+ TemplateInstances *newinstances = newp[newbi]; -+ if (!newinstances) -+ newp[newbi] = newinstances = new TemplateInstances(); -+ newinstances->push(ti1); -+ } -+ delete instances; -+ } -+ } -+ buckets.setDim(newdim); -+ memcpy(buckets.tdata(), newp, newdim * sizeof(TemplateInstance *)); -+ ::free(newp); -+ } -+ -+ // Insert ti into hash table -+ size_t bi = ti->hash % buckets.dim; -+ TemplateInstances *instances = buckets[bi]; -+ if (!instances) -+ buckets[bi] = instances = new TemplateInstances(); -+ instances->push(ti); -+ ++numinstances; -+ return ti; -+} -+ -+/******************************************* -+ * Remove TemplateInstance from table of instances. -+ * Input: -+ * handle returned by addInstance() -+ */ -+ -+void TemplateDeclaration::removeInstance(TemplateInstance *handle) -+{ -+ size_t bi = handle->hash % buckets.dim; -+ TemplateInstances *instances = buckets[bi]; -+ for (size_t i = 0; i < instances->dim; i++) -+ { -+ TemplateInstance *ti = (*instances)[i]; -+ if (handle == ti) -+ { instances->remove(i); -+ break; -+ } -+ } -+ --numinstances; -+} -+ - /* ======================== Type ============================================ */ - - /**** -@@ -2484,10 +2980,7 @@ size_t templateParameterLookup(Type *tpa - { - TypeIdentifier *tident = (TypeIdentifier *)tparam; - //printf("\ttident = '%s'\n", tident->toChars()); -- if (tident->idents.dim == 0) -- { -- return templateIdentifierLookup(tident->ident, parameters); -- } -+ return templateIdentifierLookup(tident->ident, parameters); - } - return IDX_NOTFOUND; - } -@@ -2549,6 +3042,63 @@ MATCH Type::deduceType(Scope *sc, Type * - - TemplateParameter *tp = (*parameters)[i]; - -+ TypeIdentifier *tident = (TypeIdentifier *)tparam; -+ if (tident->idents.dim > 0) -+ { -+ //printf("matching %s to %s\n", tparam->toChars(), toChars()); -+ Dsymbol *s = this->toDsymbol(sc); -+ for (size_t j = tident->idents.dim; j-- > 0; ) -+ { -+ RootObject *id = tident->idents[j]; -+ if (id->dyncast() == DYNCAST_IDENTIFIER) -+ { -+ if (!s || !s->parent) -+ goto Lnomatch; -+ Dsymbol *s2 = s->parent->searchX(Loc(), sc, id); -+ if (!s2) -+ goto Lnomatch; -+ s2 = s2->toAlias(); -+ //printf("[%d] s = %s %s, s2 = %s %s\n", j, s->kind(), s->toChars(), s2->kind(), s2->toChars()); -+ if (s != s2) -+ { -+ if (Type *t = s2->getType()) -+ { -+ if (s != t->toDsymbol(sc)) -+ goto Lnomatch; -+ } -+ else -+ goto Lnomatch; -+ } -+ s = s->parent; -+ } -+ else -+ goto Lnomatch; -+ } -+ //printf("[e] s = %s\n", s?s->toChars():"(null)"); -+ if (TemplateTypeParameter *ttp = tp->isTemplateTypeParameter()) -+ { -+ Type *tt = s->getType(); -+ if (!tt) -+ goto Lnomatch; -+ Type *at = (Type *)(*dedtypes)[i]; -+ if (!at || tt->equals(at)) -+ { -+ (*dedtypes)[i] = tt; -+ goto Lexact; -+ } -+ } -+ if (TemplateAliasParameter *tap = tp->isTemplateAliasParameter()) -+ { -+ Dsymbol *s2 = (Dsymbol *)(*dedtypes)[i]; -+ if (!s2 || s == s2) -+ { -+ (*dedtypes)[i] = s; -+ goto Lexact; -+ } -+ } -+ goto Lnomatch; -+ } -+ - // Found the corresponding parameter tp - if (!tp->isTemplateTypeParameter()) - goto Lnomatch; -@@ -2624,31 +3174,31 @@ MATCH Type::deduceType(Scope *sc, Type * - case X(0, MODconst | MODshared): - case X(0, MODwild): - case X(0, MODwild | MODshared): -- // foo(U:U) T => T -- // foo(U:U) const(T) => const(T) -- // foo(U:U) immutable(T) => immutable(T) -- // foo(U:U) shared(T) => shared(T) -- // foo(U:U) const(shared(T)) => const(shared(T)) -- // foo(U:U) wild(T) => wild(T) -- // foo(U:U) wild(shared(T)) => wild(shared(T)) -+ // foo(U:U) T => T -+ // foo(U:U) const(T) => const(T) -+ // foo(U:U) immutable(T) => immutable(T) -+ // foo(U:U) shared(T) => shared(T) -+ // foo(U:U) const(shared(T)) => const(shared(T)) -+ // foo(U:U) wild(T) => wild(T) -+ // foo(U:U) wild(shared(T)) => wild(shared(T)) - if (!at) - { (*dedtypes)[i] = tt; - goto Lexact; - } - break; - -- case X(MODconst, MODconst): -- case X(MODimmutable, MODimmutable): -- case X(MODshared, MODshared): -+ case X(MODconst, MODconst): -+ case X(MODimmutable, MODimmutable): -+ case X(MODshared, MODshared): - case X(MODconst | MODshared, MODconst | MODshared): -- case X(MODwild, MODwild): -- case X(MODwild | MODshared, MODwild | MODshared): -- // foo(U:const(U)) const(T) => T -- // foo(U:immutable(U)) immutable(T) => T -- // foo(U:shared(U)) shared(T) => T -- // foo(U:const(shared(U)) const(shared(T)) => T -- // foo(U:wild(U)) wild(T) => T -- // foo(U:wild(shared(U)) wild(shared(T)) => T -+ case X(MODwild, MODwild): -+ case X(MODwild | MODshared, MODwild | MODshared): -+ // foo(U:const(U)) const(T) => T -+ // foo(U:immutable(U)) immutable(T) => T -+ // foo(U:shared(U)) shared(T) => T -+ // foo(U:const(shared(U))) const(shared(T)) => T -+ // foo(U:wild(U)) wild(T) => T -+ // foo(U:wild(shared(U))) wild(shared(T)) => T - tt = mutableOf()->unSharedOf(); - if (!at) - { (*dedtypes)[i] = tt; -@@ -2656,17 +3206,17 @@ MATCH Type::deduceType(Scope *sc, Type * - } - break; - -- case X(MODconst, 0): -- case X(MODconst, MODimmutable): -- case X(MODconst, MODconst | MODshared): -+ case X(MODconst, 0): -+ case X(MODconst, MODimmutable): -+ case X(MODconst, MODconst | MODshared): - case X(MODconst | MODshared, MODimmutable): -- case X(MODconst, MODwild): -- case X(MODconst, MODwild | MODshared): -- // foo(U:const(U)) T => T -- // foo(U:const(U)) immutable(T) => T -- // foo(U:const(U)) const(shared(T)) => shared(T) -- // foo(U:const(shared(U)) immutable(T) => T -- // foo(U:const(U)) wild(shared(T)) => shared(T) -+ case X(MODconst, MODwild): -+ case X(MODconst, MODwild | MODshared): -+ // foo(U:const(U)) T => T -+ // foo(U:const(U)) immutable(T) => T -+ // foo(U:const(U)) const(shared(T)) => shared(T) -+ // foo(U:const(shared(U))) immutable(T) => T -+ // foo(U:const(U)) wild(shared(T)) => shared(T) - tt = mutableOf(); - if (!at) - { (*dedtypes)[i] = tt; -@@ -2674,12 +3224,12 @@ MATCH Type::deduceType(Scope *sc, Type * - } - break; - -- case X(MODshared, MODconst | MODshared): -+ case X(MODshared, MODconst | MODshared): - case X(MODconst | MODshared, MODshared): -- case X(MODshared, MODwild | MODshared): -- // foo(U:shared(U)) const(shared(T)) => const(T) -- // foo(U:const(shared(U)) shared(T) => T -- // foo(U:shared(U)) wild(shared(T)) => wild(T) -+ case X(MODshared, MODwild | MODshared): -+ // foo(U:shared(U)) const(shared(T)) => const(T) -+ // foo(U:const(shared(U))) shared(T) => T -+ // foo(U:shared(U)) wild(shared(T)) => wild(T) - tt = unSharedOf(); - if (!at) - { (*dedtypes)[i] = tt; -@@ -2688,7 +3238,7 @@ MATCH Type::deduceType(Scope *sc, Type * - break; - - case X(MODconst, MODshared): -- // foo(U:const(U)) shared(T) => shared(T) -+ // foo(U:const(U)) shared(T) => shared(T) - if (!at) - { (*dedtypes)[i] = tt; - goto Lconst; -@@ -2721,34 +3271,33 @@ MATCH Type::deduceType(Scope *sc, Type * - case X(MODimmutable, MODwild | MODshared): - case X(MODconst | MODshared, MODwild | MODshared): - case X(MODwild, MODwild | MODshared): -- -- // foo(U:immutable(U)) T => nomatch -- // foo(U:immutable(U)) const(T) => nomatch -- // foo(U:immutable(U)) shared(T) => nomatch -- // foo(U:immutable(U)) const(shared(T)) => nomatch -- // foo(U:const(U)) shared(T) => nomatch -- // foo(U:shared(U)) T => nomatch -- // foo(U:shared(U)) const(T) => nomatch -- // foo(U:shared(U)) immutable(T) => nomatch -- // foo(U:const(shared(U)) T => nomatch -- // foo(U:const(shared(U)) const(T) => nomatch -- // foo(U:immutable(U)) wild(T) => nomatch -- // foo(U:shared(U)) wild(T) => nomatch -- // foo(U:const(shared(U)) wild(T) => nomatch -- // foo(U:wild(U)) T => nomatch -- // foo(U:wild(U)) const(T) => nomatch -- // foo(U:wild(U)) immutable(T) => nomatch -- // foo(U:wild(U)) shared(T) => nomatch -- // foo(U:wild(U)) const(shared(T)) => nomatch -- // foo(U:wild(shared(U)) T => nomatch -- // foo(U:wild(shared(U)) const(T) => nomatch -- // foo(U:wild(shared(U)) immutable(T) => nomatch -- // foo(U:wild(shared(U)) shared(T) => nomatch -- // foo(U:wild(shared(U)) const(shared(T)) => nomatch -- // foo(U:wild(shared(U)) wild(T) => nomatch -- // foo(U:immutable(U)) wild(shared(T)) => nomatch -- // foo(U:const(shared(U))) wild(shared(T)) => nomatch -- // foo(U:wild(U)) wild(shared(T)) => nomatch -+ // foo(U:immutable(U)) T => nomatch -+ // foo(U:immutable(U)) const(T) => nomatch -+ // foo(U:immutable(U)) shared(T) => nomatch -+ // foo(U:immutable(U)) const(shared(T)) => nomatch -+ // foo(U:const(U)) shared(T) => nomatch -+ // foo(U:shared(U)) T => nomatch -+ // foo(U:shared(U)) const(T) => nomatch -+ // foo(U:shared(U)) immutable(T) => nomatch -+ // foo(U:const(shared(U))) T => nomatch -+ // foo(U:const(shared(U))) const(T) => nomatch -+ // foo(U:immutable(U)) wild(T) => nomatch -+ // foo(U:shared(U)) wild(T) => nomatch -+ // foo(U:const(shared(U))) wild(T) => nomatch -+ // foo(U:wild(U)) T => nomatch -+ // foo(U:wild(U)) const(T) => nomatch -+ // foo(U:wild(U)) immutable(T) => nomatch -+ // foo(U:wild(U)) shared(T) => nomatch -+ // foo(U:wild(U)) const(shared(T)) => nomatch -+ // foo(U:wild(shared(U))) T => nomatch -+ // foo(U:wild(shared(U))) const(T) => nomatch -+ // foo(U:wild(shared(U))) immutable(T) => nomatch -+ // foo(U:wild(shared(U))) shared(T) => nomatch -+ // foo(U:wild(shared(U))) const(shared(T)) => nomatch -+ // foo(U:wild(shared(U))) wild(T) => nomatch -+ // foo(U:immutable(U)) wild(shared(T)) => nomatch -+ // foo(U:const(shared(U))) wild(shared(T)) => nomatch -+ // foo(U:wild(U)) wild(shared(T)) => nomatch - //if (!at) - goto Lnomatch; - break; -@@ -2807,7 +3356,12 @@ MATCH Type::deduceType(Scope *sc, Type * - } - - if (nextOf()) -+ { -+ if (tparam->deco && !tparam->hasWild()) -+ return implicitConvTo(tparam); -+ - return nextOf()->deduceType(sc, tparam->nextOf(), parameters, dedtypes, wildmatch); -+ } - - Lexact: - return MATCHexact; -@@ -2899,24 +3453,9 @@ MATCH TypeSArray::deduceType(Scope *sc, - size_t i = templateIdentifierLookup(id, parameters); - if (i == IDX_NOTFOUND) - goto Lnomatch; -- TemplateParameter *tprm = (*parameters)[i]; -- TemplateValueParameter *tvp = tprm->isTemplateValueParameter(); -- if (!tvp) -+ TemplateParameter *tp = (*parameters)[i]; -+ if (!tp->matchArg(sc, dim, i, parameters, dedtypes, NULL)) - goto Lnomatch; -- Expression *e = (Expression *)(*dedtypes)[i]; -- if (e) -- { -- if (!dim->equals(e)) -- goto Lnomatch; -- } -- else -- { -- Type *vt = tvp->valType->semantic(0, sc); -- MATCH m = (MATCH)dim->implicitConvTo(vt); -- if (!m) -- goto Lnomatch; -- (*dedtypes)[i] = dim; -- } - return next->deduceType(sc, tparam->nextOf(), parameters, dedtypes, wildmatch); - } - } -@@ -3008,7 +3547,7 @@ MATCH TypeFunction::deduceType(Scope *sc - - /* See if existing tuple, and whether it matches or not - */ -- Object *o = (*dedtypes)[tupi]; -+ RootObject *o = (*dedtypes)[tupi]; - if (o) - { // Existing deduced argument must be a tuple, and must match - Tuple *t = isTuple(o); -@@ -3059,8 +3598,8 @@ MATCH TypeIdentifier::deduceType(Scope * - - for (size_t i = 0; i < idents.dim; i++) - { -- Identifier *id1 = idents[i]; -- Identifier *id2 = tp->idents[i]; -+ RootObject *id1 = idents[i]; -+ RootObject *id2 = tp->idents[i]; - - if (!id1->equals(id2)) - return MATCHnomatch; -@@ -3078,13 +3617,15 @@ MATCH TypeInstance::deduceType(Scope *sc - printf("\tthis = %d, ", ty); print(); - printf("\ttparam = %d, ", tparam->ty); tparam->print(); - #endif -+ TemplateDeclaration *tempdecl = tempinst->tempdecl->isTemplateDeclaration(); -+ assert(tempdecl); - - // Extra check - if (tparam && tparam->ty == Tinstance) - { - TypeInstance *tp = (TypeInstance *)tparam; - -- //printf("tempinst->tempdecl = %p\n", tempinst->tempdecl); -+ //printf("tempinst->tempdecl = %p\n", tempdecl); - //printf("tp->tempinst->tempdecl = %p\n", tp->tempinst->tempdecl); - if (!tp->tempinst->tempdecl) - { //printf("tp->tempinst->name = '%s'\n", tp->tempinst->name->toChars()); -@@ -3098,11 +3639,11 @@ MATCH TypeInstance::deduceType(Scope *sc - { /* Didn't find it as a parameter identifier. Try looking - * it up and seeing if is an alias. See Bugzilla 1454 - */ -- TypeIdentifier *tid = new TypeIdentifier(0, tp->tempinst->name); -+ TypeIdentifier *tid = new TypeIdentifier(Loc(), tp->tempinst->name); - Type *t; - Expression *e; - Dsymbol *s; -- tid->resolve(0, sc, &e, &t, &s); -+ tid->resolve(Loc(), sc, &e, &t, &s); - if (t) - { - s = t->toDsymbol(sc); -@@ -3115,32 +3656,17 @@ MATCH TypeInstance::deduceType(Scope *sc - { - s = s->toAlias(); - TemplateDeclaration *td = s->isTemplateDeclaration(); -- if (td && td == tempinst->tempdecl) -+ if (td && td == tempdecl) - goto L2; - } - goto Lnomatch; - } - TemplateParameter *tpx = (*parameters)[i]; -- // This logic duplicates tpx->matchArg() -- TemplateAliasParameter *ta = tpx->isTemplateAliasParameter(); -- if (!ta) -- goto Lnomatch; -- Object *sa = tempinst->tempdecl; -- if (!sa) -+ if (!tpx->matchArg(sc, tempdecl, i, parameters, dedtypes, NULL)) - goto Lnomatch; -- if (ta->specAlias && sa != ta->specAlias) -- goto Lnomatch; -- if ((*dedtypes)[i]) -- { // Must match already deduced symbol -- Object *s = (*dedtypes)[i]; -- -- if (s != sa) -- goto Lnomatch; -- } -- (*dedtypes)[i] = sa; - } - } -- else if (tempinst->tempdecl != tp->tempinst->tempdecl) -+ else if (tempdecl != tp->tempinst->tempdecl) - goto Lnomatch; - - L2: -@@ -3148,7 +3674,7 @@ MATCH TypeInstance::deduceType(Scope *sc - for (size_t i = 0; 1; i++) - { - //printf("\ttest: tempinst->tiargs[%d]\n", i); -- Object *o1 = NULL; -+ RootObject *o1 = NULL; - if (i < tempinst->tiargs->dim) - o1 = (*tempinst->tiargs)[i]; - else if (i < tempinst->tdtypes.dim && i < tp->tempinst->tiargs->dim) -@@ -3160,7 +3686,7 @@ MATCH TypeInstance::deduceType(Scope *sc - if (i >= tp->tempinst->tiargs->dim) - goto Lnomatch; - -- Object *o2 = (*tp->tempinst->tiargs)[i]; -+ RootObject *o2 = (*tp->tempinst->tiargs)[i]; - Type *t2 = isType(o2); - - size_t j; -@@ -3181,12 +3707,12 @@ MATCH TypeInstance::deduceType(Scope *sc - /* Create tuple from remaining args - */ - Tuple *vt = new Tuple(); -- size_t vtdim = (tempinst->tempdecl->isVariadic() -+ size_t vtdim = (tempdecl->isVariadic() - ? tempinst->tiargs->dim : tempinst->tdtypes.dim) - i; - vt->objects.setDim(vtdim); - for (size_t k = 0; k < vtdim; k++) - { -- Object *o; -+ RootObject *o; - if (k < tempinst->tiargs->dim) - o = (*tempinst->tiargs)[i + k]; - else // Pick up default arg -@@ -3197,7 +3723,9 @@ MATCH TypeInstance::deduceType(Scope *sc - Tuple *v = (Tuple *)(*dedtypes)[j]; - if (v) - { -- if (!match(v, vt, tempinst->tempdecl, sc)) -+ if (checkRecursiveExpansion(v, tempdecl, sc)) -+ goto Lnomatch; -+ if (!match(v, vt)) - goto Lnomatch; - } - else -@@ -3234,19 +3762,29 @@ MATCH TypeInstance::deduceType(Scope *sc - { - Le: - e1 = e1->ctfeInterpret(); -+ -+ /* If it is one of the template parameters for this template, -+ * we should not attempt to interpret it. It already has a value. -+ */ -+ if (e2->op == TOKvar && -+ (((VarExp *)e2)->var->storage_class & STCtemplateparameter)) -+ { -+ /* -+ * (T:Number!(e2), int e2) -+ */ -+ j = templateIdentifierLookup(((VarExp *)e2)->var->ident, parameters); -+ if (j != IDX_NOTFOUND) -+ goto L1; -+ // The template parameter was not from this template -+ // (it may be from a parent template, for example) -+ } -+ - e2 = e2->ctfeInterpret(); - - //printf("e1 = %s, type = %s %d\n", e1->toChars(), e1->type->toChars(), e1->type->ty); - //printf("e2 = %s, type = %s %d\n", e2->toChars(), e2->type->toChars(), e2->type->ty); - if (!e1->equals(e2)) -- { if (e2->op == TOKvar) -- { -- /* -- * (T:Number!(e2), int e2) -- */ -- j = templateIdentifierLookup(((VarExp *)e2)->var->ident, parameters); -- goto L1; -- } -+ { - if (!e2->implicitConvTo(e1->type)) - goto Lnomatch; - -@@ -3268,35 +3806,7 @@ MATCH TypeInstance::deduceType(Scope *sc - goto Lnomatch; - } - TemplateParameter *tp = (*parameters)[j]; -- // BUG: use tp->matchArg() instead of the following -- TemplateValueParameter *tv = tp->isTemplateValueParameter(); -- TemplateAliasParameter *ta = tp->isTemplateAliasParameter(); -- if (tv) -- { -- Expression *e = (Expression *)(*dedtypes)[j]; -- if (e) -- { -- if (!e1->equals(e)) -- goto Lnomatch; -- } -- else -- { Type *vt = tv->valType->semantic(0, sc); -- MATCH m = (MATCH)e1->implicitConvTo(vt); -- if (!m) -- goto Lnomatch; -- (*dedtypes)[j] = e1; -- } -- } -- else if (ta) -- { -- if (ta->specType) -- { -- if (!e1->type->equals(ta->specType)) -- goto Lnomatch; -- } -- (*dedtypes)[j] = e1; -- } -- else -+ if (!tp->matchArg(sc, e1, j, parameters, dedtypes, NULL)) - goto Lnomatch; - } - else if (s1 && s2) -@@ -3316,20 +3826,8 @@ MATCH TypeInstance::deduceType(Scope *sc - goto Lnomatch; - } - TemplateParameter *tp = (*parameters)[j]; -- // BUG: use tp->matchArg() instead of the following -- TemplateAliasParameter *ta = tp->isTemplateAliasParameter(); -- if (!ta) -+ if (!tp->matchArg(sc, s1, j, parameters, dedtypes, NULL)) - goto Lnomatch; -- Dsymbol *s = (Dsymbol *)(*dedtypes)[j]; -- if (s) -- { -- if (!s1->equals(s)) -- goto Lnomatch; -- } -- else -- { -- (*dedtypes)[j] = s1; -- } - } - else - goto Lnomatch; -@@ -3358,7 +3856,7 @@ MATCH TypeStruct::deduceType(Scope *sc, - { - if (ti && ti->toAlias() == sym) - { -- TypeInstance *t = new TypeInstance(0, ti); -+ TypeInstance *t = new TypeInstance(Loc(), ti); - return t->deduceType(sc, tparam, parameters, dedtypes, wildmatch); - } - -@@ -3367,8 +3865,8 @@ MATCH TypeStruct::deduceType(Scope *sc, - */ - TypeInstance *tpi = (TypeInstance *)tparam; - if (tpi->idents.dim) -- { Identifier *id = tpi->idents[tpi->idents.dim - 1]; -- if (id->dyncast() == DYNCAST_IDENTIFIER && sym->ident->equals(id)) -+ { RootObject *id = tpi->idents[tpi->idents.dim - 1]; -+ if (id->dyncast() == DYNCAST_IDENTIFIER && sym->ident->equals((Identifier *)id)) - { - Type *tparent = sym->parent->getType(); - if (tparent) -@@ -3405,6 +3903,12 @@ MATCH TypeEnum::deduceType(Scope *sc, Ty - if (sym != tp->sym) - return MATCHnomatch; - } -+ Type *tb = toBasetype(); -+ if (tb->ty == tparam->ty || -+ tb->ty == Tsarray && tparam->ty == Taarray) -+ { -+ return tb->deduceType(sc, tparam, parameters, dedtypes, wildmatch); -+ } - return Type::deduceType(sc, tparam, parameters, dedtypes, wildmatch); - } - -@@ -3451,7 +3955,7 @@ void deduceBaseClassParameters(BaseClass - tmpdedtypes->setDim(dedtypes->dim); - memcpy(tmpdedtypes->tdata(), dedtypes->tdata(), dedtypes->dim * sizeof(void *)); - -- TypeInstance *t = new TypeInstance(0, parti); -+ TypeInstance *t = new TypeInstance(Loc(), parti); - MATCH m = t->deduceType(sc, tparam, parameters, tmpdedtypes); - if (m != MATCHnomatch) - { -@@ -3492,7 +3996,7 @@ MATCH TypeClass::deduceType(Scope *sc, T - { - if (ti && ti->toAlias() == sym) - { -- TypeInstance *t = new TypeInstance(0, ti); -+ TypeInstance *t = new TypeInstance(Loc(), ti); - MATCH m = t->deduceType(sc, tparam, parameters, dedtypes, wildmatch); - // Even if the match fails, there is still a chance it could match - // a base class. -@@ -3505,8 +4009,8 @@ MATCH TypeClass::deduceType(Scope *sc, T - */ - TypeInstance *tpi = (TypeInstance *)tparam; - if (tpi->idents.dim) -- { Identifier *id = tpi->idents[tpi->idents.dim - 1]; -- if (id->dyncast() == DYNCAST_IDENTIFIER && sym->ident->equals(id)) -+ { RootObject *id = tpi->idents[tpi->idents.dim - 1]; -+ if (id->dyncast() == DYNCAST_IDENTIFIER && sym->ident->equals((Identifier *)id)) - { - Type *tparent = sym->parent->getType(); - if (tparent) -@@ -3610,6 +4114,45 @@ TemplateThisParameter *TemplateParamete - } - #endif - -+/******************************************* -+ * Match to a particular TemplateParameter. -+ * Input: -+ * i i'th argument -+ * tiargs[] actual arguments to template instance -+ * parameters[] template parameters -+ * dedtypes[] deduced arguments to template instance -+ * *psparam set to symbol declared and initialized to dedtypes[i] -+ */ -+ -+MATCH TemplateParameter::matchArg(Loc loc, Scope *sc, Objects *tiargs, -+ size_t i, TemplateParameters *parameters, Objects *dedtypes, -+ Declaration **psparam) -+{ -+ RootObject *oarg; -+ -+ if (i < tiargs->dim) -+ oarg = (*tiargs)[i]; -+ else -+ { -+ // Get default argument instead -+ oarg = defaultArg(loc, sc); -+ if (!oarg) -+ { -+ assert(i < dedtypes->dim); -+ // It might have already been deduced -+ oarg = (*dedtypes)[i]; -+ if (!oarg) -+ goto Lnomatch; -+ } -+ } -+ return matchArg(sc, oarg, i, parameters, dedtypes, psparam); -+ -+Lnomatch: -+ if (psparam) -+ *psparam = NULL; -+ return MATCHnomatch; -+} -+ - /* ======================== TemplateTypeParameter =========================== */ - - // type-parameter -@@ -3649,10 +4192,10 @@ void TemplateTypeParameter::declareParam - error(loc, "parameter '%s' multiply defined", ident->toChars()); - } - --void TemplateTypeParameter::semantic(Scope *sc) -+void TemplateTypeParameter::semantic(Scope *sc, TemplateParameters *parameters) - { - //printf("TemplateTypeParameter::semantic('%s')\n", ident->toChars()); -- if (specType) -+ if (specType && !specType->reliesOnTident(parameters)) - { - specType = specType->semantic(loc, sc); - } -@@ -3691,42 +4234,13 @@ Lnomatch: - return 0; - } - --/******************************************* -- * Match to a particular TemplateParameter. -- * Input: -- * i i'th argument -- * tiargs[] actual arguments to template instance -- * parameters[] template parameters -- * dedtypes[] deduced arguments to template instance -- * *psparam set to symbol declared and initialized to dedtypes[i] -- */ -- --MATCH TemplateTypeParameter::matchArg(Scope *sc, Objects *tiargs, -+MATCH TemplateTypeParameter::matchArg(Scope *sc, RootObject *oarg, - size_t i, TemplateParameters *parameters, Objects *dedtypes, - Declaration **psparam) - { - //printf("TemplateTypeParameter::matchArg()\n"); -- Object *oarg; - MATCH m = MATCHexact; -- Type *ta; -- -- if (i < tiargs->dim) -- oarg = (*tiargs)[i]; -- else -- { // Get default argument instead -- oarg = defaultArg(loc, sc); -- if (!oarg) -- { assert(i < dedtypes->dim); -- // It might have already been deduced -- oarg = (*dedtypes)[i]; -- if (!oarg) -- { -- goto Lnomatch; -- } -- } -- } -- -- ta = isType(oarg); -+ Type *ta = isType(oarg); - if (!ta) - { - //printf("%s %p %p %p\n", oarg->toChars(), isExpression(oarg), isDsymbol(oarg), isTuple(oarg)); -@@ -3770,18 +4284,20 @@ MATCH TemplateTypeParameter::matchArg(Sc - } - (*dedtypes)[i] = ta; - -- *psparam = new AliasDeclaration(loc, ident, ta); -+ if (psparam) -+ *psparam = new AliasDeclaration(loc, ident, ta); - //printf("\tm = %d\n", m); - return m; - - Lnomatch: -- *psparam = NULL; -+ if (psparam) -+ *psparam = NULL; - //printf("\tm = %d\n", MATCHnomatch); - return MATCHnomatch; - } - - --void TemplateTypeParameter::print(Object *oarg, Object *oded) -+void TemplateTypeParameter::print(RootObject *oarg, RootObject *oded) - { - printf(" %s\n", ident->toChars()); - -@@ -3830,13 +4346,13 @@ void *TemplateTypeParameter::dummyArg() - } - - --Object *TemplateTypeParameter::specialization() -+RootObject *TemplateTypeParameter::specialization() - { - return specType; - } - - --Object *TemplateTypeParameter::defaultArg(Loc loc, Scope *sc) -+RootObject *TemplateTypeParameter::defaultArg(Loc loc, Scope *sc) - { - Type *t; - -@@ -3890,7 +4406,7 @@ void TemplateThisParameter::toCBuffer(Ou - Dsymbol *TemplateAliasParameter::sdummy = NULL; - - TemplateAliasParameter::TemplateAliasParameter(Loc loc, Identifier *ident, -- Type *specType, Object *specAlias, Object *defaultAlias) -+ Type *specType, RootObject *specAlias, RootObject *defaultAlias) - : TemplateParameter(loc, ident) - { - this->ident = ident; -@@ -3922,13 +4438,13 @@ void TemplateAliasParameter::declarePara - error(loc, "parameter '%s' multiply defined", ident->toChars()); - } - --Object *aliasParameterSemantic(Loc loc, Scope *sc, Object *o) -+RootObject *aliasParameterSemantic(Loc loc, Scope *sc, RootObject *o, TemplateParameters *parameters) - { - if (o) - { - Expression *ea = isExpression(o); - Type *ta = isType(o); -- if (ta) -+ if (ta && (!parameters || !ta->reliesOnTident(parameters))) - { Dsymbol *s = ta->toDsymbol(sc); - if (s) - o = s; -@@ -3937,20 +4453,22 @@ Object *aliasParameterSemantic(Loc loc, - } - else if (ea) - { -+ sc = sc->startCTFE(); - ea = ea->semantic(sc); -+ sc = sc->endCTFE(); - o = ea->ctfeInterpret(); - } - } - return o; - } - --void TemplateAliasParameter::semantic(Scope *sc) -+void TemplateAliasParameter::semantic(Scope *sc, TemplateParameters *parameters) - { -- if (specType) -+ if (specType && !specType->reliesOnTident(parameters)) - { - specType = specType->semantic(loc, sc); - } -- specAlias = aliasParameterSemantic(loc, sc, specAlias); -+ specAlias = aliasParameterSemantic(loc, sc, specAlias, parameters); - #if 0 // Don't do semantic() until instantiation - if (defaultAlias) - defaultAlias = defaultAlias->semantic(loc, sc); -@@ -3985,7 +4503,7 @@ Lnomatch: - * } // because Sym template cannot - * void main() { S s; s.foo(); } // access to the valid 'this' symbol. - */ --bool isPseudoDsymbol(Object *o) -+bool isPseudoDsymbol(RootObject *o) - { - Dsymbol *s = isDsymbol(o); - Expression *e = isExpression(o); -@@ -4012,33 +4530,13 @@ bool isPseudoDsymbol(Object *o) - return false; - } - --MATCH TemplateAliasParameter::matchArg(Scope *sc, Objects *tiargs, -+MATCH TemplateAliasParameter::matchArg(Scope *sc, RootObject *oarg, - size_t i, TemplateParameters *parameters, Objects *dedtypes, - Declaration **psparam) - { -- Object *sa; -- Object *oarg; -- Expression *ea; -- Dsymbol *s; -- - //printf("TemplateAliasParameter::matchArg()\n"); -- -- if (i < tiargs->dim) -- oarg = (*tiargs)[i]; -- else -- { // Get default argument instead -- oarg = defaultArg(loc, sc); -- if (!oarg) -- { assert(i < dedtypes->dim); -- // It might have already been deduced -- oarg = (*dedtypes)[i]; -- if (!oarg) -- goto Lnomatch; -- } -- } -- -- sa = getDsymbol(oarg); -- ea = isExpression(oarg); -+ RootObject *sa = getDsymbol(oarg); -+ Expression *ea = isExpression(oarg); - if (ea && (ea->op == TOKthis || ea->op == TOKsuper)) - sa = ((ThisExp *)ea)->var; - else if (ea && ea->op == TOKimport) -@@ -4080,7 +4578,7 @@ MATCH TemplateAliasParameter::matchArg(S - Type *ta = isType(specAlias); - if (!ti || !ta) - goto Lnomatch; -- Type *t = new TypeInstance(0, ti); -+ Type *t = new TypeInstance(Loc(), ti); - MATCH m = t->deduceType(sc, ta, parameters, dedtypes); - if (m == MATCHnomatch) - goto Lnomatch; -@@ -4088,37 +4586,42 @@ MATCH TemplateAliasParameter::matchArg(S - } - else if ((*dedtypes)[i]) - { // Must match already deduced symbol -- Object *si = (*dedtypes)[i]; -+ RootObject *si = (*dedtypes)[i]; - - if (!sa || si != sa) - goto Lnomatch; - } - (*dedtypes)[i] = sa; - -- s = isDsymbol(sa); -- if (s) -- *psparam = new AliasDeclaration(loc, ident, s); -- else -+ if (psparam) - { -- assert(ea); -+ if (Dsymbol *s = isDsymbol(sa)) -+ { -+ *psparam = new AliasDeclaration(loc, ident, s); -+ } -+ else -+ { -+ assert(ea); - -- // Declare manifest constant -- Initializer *init = new ExpInitializer(loc, ea); -- VarDeclaration *v = new VarDeclaration(loc, NULL, ident, init); -- v->storage_class = STCmanifest; -- v->semantic(sc); -- *psparam = v; -+ // Declare manifest constant -+ Initializer *init = new ExpInitializer(loc, ea); -+ VarDeclaration *v = new VarDeclaration(loc, NULL, ident, init); -+ v->storage_class = STCmanifest; -+ v->semantic(sc); -+ *psparam = v; -+ } - } - return MATCHexact; - - Lnomatch: -- *psparam = NULL; -+ if (psparam) -+ *psparam = NULL; - //printf("\tm = %d\n", MATCHnomatch); - return MATCHnomatch; - } - - --void TemplateAliasParameter::print(Object *oarg, Object *oded) -+void TemplateAliasParameter::print(RootObject *oarg, RootObject *oded) - { - printf(" %s\n", ident->toChars()); - -@@ -4151,7 +4654,7 @@ void TemplateAliasParameter::toCBuffer(O - - - void *TemplateAliasParameter::dummyArg() --{ Object *s; -+{ RootObject *s; - - s = specAlias; - if (!s) -@@ -4164,15 +4667,15 @@ void *TemplateAliasParameter::dummyArg() - } - - --Object *TemplateAliasParameter::specialization() -+RootObject *TemplateAliasParameter::specialization() - { - return specAlias; - } - - --Object *TemplateAliasParameter::defaultArg(Loc loc, Scope *sc) -+RootObject *TemplateAliasParameter::defaultArg(Loc loc, Scope *sc) - { -- Object *da = defaultAlias; -+ RootObject *da = defaultAlias; - Type *ta = isType(defaultAlias); - if (ta) - { -@@ -4183,7 +4686,7 @@ Object *TemplateAliasParameter::defaultA - } - } - -- Object *o = aliasParameterSemantic(loc, sc, da); -+ RootObject *o = aliasParameterSemantic(loc, sc, da, NULL); - return o; - } - -@@ -4229,7 +4732,7 @@ void TemplateValueParameter::declarePara - sparam = v; - } - --void TemplateValueParameter::semantic(Scope *sc) -+void TemplateValueParameter::semantic(Scope *sc, TemplateParameters *parameters) - { - bool wasSame = (sparam->type == valType); - sparam->semantic(sc); -@@ -4251,9 +4754,11 @@ void TemplateValueParameter::semantic(Sc - - #if 0 // defer semantic analysis to arg match - if (specValue) -- { Expression *e = specValue; -- -+ { -+ Expression *e = specValue; -+ sc = sc->startCTFE(); - e = e->semantic(sc); -+ sc = sc->endCTFE(); - e = e->implicitCastTo(sc, valType); - e = e->ctfeInterpret(); - if (e->op == TOKint64 || e->op == TOKfloat64 || -@@ -4263,9 +4768,11 @@ void TemplateValueParameter::semantic(Sc - } - - if (defaultValue) -- { Expression *e = defaultValue; -- -+ { -+ Expression *e = defaultValue; -+ sc = sc->startCTFE(); - e = e->semantic(sc); -+ sc = sc->endCTFE(); - e = e->implicitCastTo(sc, valType); - e = e->ctfeInterpret(); - if (e->op == TOKint64) -@@ -4297,34 +4804,15 @@ Lnomatch: - return 0; - } - -- --MATCH TemplateValueParameter::matchArg(Scope *sc, -- Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, -+MATCH TemplateValueParameter::matchArg(Scope *sc, RootObject *oarg, -+ size_t i, TemplateParameters *parameters, Objects *dedtypes, - Declaration **psparam) - { - //printf("TemplateValueParameter::matchArg()\n"); - -- Initializer *init; -- Declaration *sparam; - MATCH m = MATCHexact; -- Expression *ei; -- Object *oarg; -- -- if (i < tiargs->dim) -- oarg = (*tiargs)[i]; -- else -- { // Get default argument instead -- oarg = defaultArg(loc, sc); -- if (!oarg) -- { assert(i < dedtypes->dim); -- // It might have already been deduced -- oarg = (*dedtypes)[i]; -- if (!oarg) -- goto Lnomatch; -- } -- } - -- ei = isExpression(oarg); -+ Expression *ei = isExpression(oarg); - Type *vt; - - if (!ei && oarg) -@@ -4337,6 +4825,11 @@ MATCH TemplateValueParameter::matchArg(S - ei = ei->semantic(sc); - if (!f->needThis()) - ei = resolveProperties(sc, ei); -+ /* If it was really a property, it will become a CallExp. -+ * If it stayed as a var, it cannot be interpreted. -+ */ -+ if (ei->op == TOKvar) -+ goto Lnomatch; - ei = ei->ctfeInterpret(); - } - else -@@ -4349,7 +4842,7 @@ MATCH TemplateValueParameter::matchArg(S - } - - //printf("\tvalType: %s, ty = %d\n", valType->toChars(), valType->ty); -- vt = valType->semantic(0, sc); -+ vt = valType->semantic(loc, sc); - //printf("ei: %s, ei->type: %s\n", ei->toChars(), ei->type->toChars()); - //printf("vt = %s\n", vt->toChars()); - -@@ -4359,6 +4852,11 @@ MATCH TemplateValueParameter::matchArg(S - //printf("m: %d\n", m); - if (!m) - goto Lnomatch; -+ if (m != MATCHexact) -+ { -+ ei = ei->implicitCastTo(sc, vt); -+ ei = ei->ctfeInterpret(); -+ } - } - - if (specValue) -@@ -4368,13 +4866,17 @@ MATCH TemplateValueParameter::matchArg(S - - Expression *e = specValue; - -+ sc = sc->startCTFE(); - e = e->semantic(sc); - e = resolveProperties(sc, e); -+ sc = sc->endCTFE(); - e = e->implicitCastTo(sc, vt); - e = e->ctfeInterpret(); - - ei = ei->syntaxCopy(); -+ sc = sc->startCTFE(); - ei = ei->semantic(sc); -+ sc = sc->endCTFE(); - ei = ei->implicitCastTo(sc, vt); - ei = ei->ctfeInterpret(); - //printf("\tei: %s, %s\n", ei->toChars(), ei->type->toChars()); -@@ -4391,28 +4893,27 @@ MATCH TemplateValueParameter::matchArg(S - if (!ei || !ei->equals(e)) - goto Lnomatch; - } -- else if (m != MATCHexact) -- { -- ei = ei->implicitCastTo(sc, vt); -- ei = ei->ctfeInterpret(); -- } - } - (*dedtypes)[i] = ei; - -- init = new ExpInitializer(loc, ei); -- sparam = new VarDeclaration(loc, vt, ident, init); -- sparam->storage_class = STCmanifest; -- *psparam = sparam; -+ if (psparam) -+ { -+ Initializer *init = new ExpInitializer(loc, ei); -+ Declaration *sparam = new VarDeclaration(loc, vt, ident, init); -+ sparam->storage_class = STCmanifest; -+ *psparam = sparam; -+ } - return m; - - Lnomatch: - //printf("\tno match\n"); -- *psparam = NULL; -+ if (psparam) -+ *psparam = NULL; - return MATCHnomatch; - } - - --void TemplateValueParameter::print(Object *oarg, Object *oded) -+void TemplateValueParameter::print(RootObject *oarg, RootObject *oded) - { - printf(" %s\n", ident->toChars()); - -@@ -4456,13 +4957,13 @@ void *TemplateValueParameter::dummyArg() - } - - --Object *TemplateValueParameter::specialization() -+RootObject *TemplateValueParameter::specialization() - { - return specValue; - } - - --Object *TemplateValueParameter::defaultArg(Loc loc, Scope *sc) -+RootObject *TemplateValueParameter::defaultArg(Loc loc, Scope *sc) - { - Expression *e = defaultValue; - if (e) -@@ -4506,7 +5007,7 @@ void TemplateTupleParameter::declarePara - error(loc, "parameter '%s' multiply defined", ident->toChars()); - } - --void TemplateTupleParameter::semantic(Scope *sc) -+void TemplateTupleParameter::semantic(Scope *sc, TemplateParameters *parameters) - { - } - -@@ -4522,12 +5023,10 @@ int TemplateTupleParameter::overloadMatc - return 0; - } - --MATCH TemplateTupleParameter::matchArg(Scope *sc, Objects *tiargs, -+MATCH TemplateTupleParameter::matchArg(Loc loc, Scope *sc, Objects *tiargs, - size_t i, TemplateParameters *parameters, Objects *dedtypes, - Declaration **psparam) - { -- //printf("TemplateTupleParameter::matchArg()\n"); -- - /* The rest of the actual arguments (tiargs[]) form the match - * for the variadic parameter. - */ -@@ -4551,13 +5050,26 @@ MATCH TemplateTupleParameter::matchArg(S - ovar->objects[j] = (*tiargs)[i + j]; - } - } -- *psparam = new TupleDeclaration(loc, ident, &ovar->objects); -+ return matchArg(sc, ovar, i, parameters, dedtypes, psparam); -+} -+ -+MATCH TemplateTupleParameter::matchArg(Scope *sc, RootObject *oarg, -+ size_t i, TemplateParameters *parameters, Objects *dedtypes, -+ Declaration **psparam) -+{ -+ //printf("TemplateTupleParameter::matchArg()\n"); -+ Tuple *ovar = isTuple(oarg); -+ if (!ovar) -+ return MATCHnomatch; - (*dedtypes)[i] = ovar; -+ -+ if (psparam) -+ *psparam = new TupleDeclaration(loc, ident, &ovar->objects); - return MATCHexact; - } - - --void TemplateTupleParameter::print(Object *oarg, Object *oded) -+void TemplateTupleParameter::print(RootObject *oarg, RootObject *oded) - { - printf(" %s... [", ident->toChars()); - Tuple *v = isTuple(oded); -@@ -4569,7 +5081,7 @@ void TemplateTupleParameter::print(Objec - if (i) - printf(", "); - -- Object *o = v->objects[i]; -+ RootObject *o = v->objects[i]; - - Dsymbol *sa = isDsymbol(o); - if (sa) -@@ -4602,13 +5114,13 @@ void *TemplateTupleParameter::dummyArg() - } - - --Object *TemplateTupleParameter::specialization() -+RootObject *TemplateTupleParameter::specialization() - { - return NULL; - } - - --Object *TemplateTupleParameter::defaultArg(Loc loc, Scope *sc) -+RootObject *TemplateTupleParameter::defaultArg(Loc loc, Scope *sc) - { - return NULL; - } -@@ -4625,20 +5137,19 @@ TemplateInstance::TemplateInstance(Loc l - this->name = ident; - this->tiargs = NULL; - this->tempdecl = NULL; -+ this->instantiatingModule = NULL; - this->inst = NULL; - this->tinst = NULL; - this->argsym = NULL; - this->aliasdecl = NULL; -- this->semanticRun = PASSinit; -- this->semantictiargsdone = 0; -+ this->semantictiargsdone = false; - this->withsym = NULL; - this->nest = 0; --#ifdef IN_GCC -- this->objFileModule = NULL; --#endif -- this->havetempdecl = 0; -- this->isnested = NULL; -- this->speculative = 0; -+ this->havetempdecl = false; -+ this->enclosing = NULL; -+ this->speculative = false; -+ this->hash = 0; -+ this->fargs = NULL; - } - - /***************** -@@ -4656,22 +5167,21 @@ TemplateInstance::TemplateInstance(Loc l - this->name = td->ident; - this->tiargs = tiargs; - this->tempdecl = td; -+ this->instantiatingModule = NULL; - this->inst = NULL; - this->tinst = NULL; - this->argsym = NULL; - this->aliasdecl = NULL; -- this->semanticRun = PASSinit; -- this->semantictiargsdone = 1; -+ this->semantictiargsdone = true; - this->withsym = NULL; - this->nest = 0; --#ifdef IN_GCC -- this->objFileModule = NULL; --#endif -- this->havetempdecl = 1; -- this->isnested = NULL; -- this->speculative = 0; -+ this->havetempdecl = true; -+ this->enclosing = NULL; -+ this->speculative = false; -+ this->hash = 0; -+ this->fargs = NULL; - -- assert((size_t)tempdecl->scope > 0x10000); -+ assert(tempdecl->scope); - } - - -@@ -4700,8 +5210,9 @@ Dsymbol *TemplateInstance::syntaxCopy(Ds - - ti->tiargs = arraySyntaxCopy(tiargs); - -- if (inst) -- tempdecl->ScopeDsymbol::syntaxCopy(ti); -+ TemplateDeclaration *td; -+ if (inst && tempdecl && (td = tempdecl->isTemplateDeclaration()) != NULL) -+ td->ScopeDsymbol::syntaxCopy(ti); - else - ScopeDsymbol::syntaxCopy(ti); - return ti; -@@ -4723,12 +5234,12 @@ void TemplateInstance::expandMembers(Sco - { - Dsymbol *s = (*members)[i]; - //printf("\t[%d] semantic on '%s' %p kind %s in '%s'\n", i, s->toChars(), s, s->kind(), this->toChars()); -- //printf("test: isnested = %d, sc2->parent = %s\n", isnested, sc2->parent->toChars()); --// if (isnested) -+ //printf("test: enclosing = %d, sc2->parent = %s\n", enclosing, sc2->parent->toChars()); -+// if (enclosing) - // s->parent = sc->parent; -- //printf("test3: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars()); -+ //printf("test3: enclosing = %d, s->parent = %s\n", enclosing, s->parent->toChars()); - s->semantic(sc2); -- //printf("test4: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars()); -+ //printf("test4: enclosing = %d, s->parent = %s\n", enclosing, s->parent->toChars()); - sc2->module->runDeferredSemantic(); - } - } -@@ -4745,27 +5256,7 @@ void TemplateInstance::tryExpandMembers( - fatal(); - } - --#ifndef IN_GCC --#if WINDOWS_SEH -- if(nest == 1) -- { -- // do not catch at every nesting level, because generating the output error might cause more stack -- // errors in the __except block otherwise -- __try -- { -- expandMembers(sc2); -- } -- __except (__ehfilter(GetExceptionInformation())) -- { -- global.gag = 0; // ensure error message gets printed -- error("recursive expansion"); -- fatal(); -- } -- } -- else --#endif --#endif -- expandMembers(sc2); -+ expandMembers(sc2); - nest--; - } - -@@ -4779,27 +5270,7 @@ void TemplateInstance::trySemantic3(Scop - error("recursive expansion"); - fatal(); - } --#ifndef IN_GCC --#if WINDOWS_SEH -- if(nest == 1) -- { -- // do not catch at every nesting level, because generating the output error might cause more stack -- // errors in the __except block otherwise -- __try -- { -- semantic3(sc2); -- } -- __except (__ehfilter(GetExceptionInformation())) -- { -- global.gag = 0; // ensure error message gets printed -- error("recursive expansion"); -- fatal(); -- } -- } -- else --#endif --#endif -- semantic3(sc2); -+ semantic3(sc2); - - --nest; - } -@@ -4807,6 +5278,28 @@ void TemplateInstance::trySemantic3(Scop - void TemplateInstance::semantic(Scope *sc, Expressions *fargs) - { - //printf("TemplateInstance::semantic('%s', this=%p, gag = %d, sc = %p)\n", toChars(), this, global.gag, sc); -+#if 0 -+ for (Dsymbol *s = this; s; s = s->parent) -+ { -+ printf("\t%s\n", s->toChars()); -+ } -+ printf("Scope\n"); -+ for (Scope *scx = sc; scx; scx = scx->enclosing) -+ { -+ printf("\t%s parent %s instantiatingModule %p\n", scx->module ? scx->module->toChars() : "null", scx->parent ? scx->parent->toChars() : "null", scx->instantiatingModule); -+ } -+#endif -+ -+ Module *mi = sc->instantiatingModule ? sc->instantiatingModule : sc->module; -+ -+ /* If a TemplateInstance is ever instantiated by non-root modules, -+ * we do not have to generate code for it, -+ * because it will be generated when the non-root module is compiled. -+ */ -+ if (!instantiatingModule || instantiatingModule->isRoot()) -+ instantiatingModule = mi; -+ //printf("mi = %s\n", mi->toChars()); -+ - #if LOG - printf("\n+TemplateInstance::semantic('%s', this=%p)\n", toChars(), this); - #endif -@@ -4835,52 +5328,20 @@ void TemplateInstance::semantic(Scope *s - #if LOG - printf("\tdo semantic\n"); - #endif -- if (havetempdecl) -- { -- assert((size_t)tempdecl->scope > 0x10000); -- // Deduce tdtypes -- tdtypes.setDim(tempdecl->parameters->dim); -- if (!tempdecl->matchWithInstance(this, &tdtypes, fargs, 2)) -- { -- error("incompatible arguments for template instantiation"); -- inst = this; -- return; -- } -- } -- else -- { -- /* Find template declaration first. -- */ -- tempdecl = findTemplateDeclaration(sc); -- if (!tempdecl) -- { if (!sc->parameterSpecialization) -- inst = this; -- //printf("error return %p, %d\n", tempdecl, global.errors); -- return; // error recovery -- } -- -- /* Run semantic on each argument, place results in tiargs[] -- * (if we have tempdecl, then tiargs is already evaluated) -- */ -- semanticTiargs(sc); -- if (arrayObjectIsError(tiargs)) -- { if (!sc->parameterSpecialization) -- inst = this; -- //printf("error return %p, %d\n", tempdecl, global.errors); -- if (inst) -- inst->errors = true; -- return; // error recovery -- } -- -- unsigned errs = global.errors; -- tempdecl = findBestMatch(sc, fargs); -- if (!tempdecl || (errs != global.errors)) -- { if (!sc->parameterSpecialization) -- inst = this; -- //printf("error return %p, %d\n", tempdecl, global.errors); -- return; // error recovery -- } -+ /* Find template declaration first, -+ * then run semantic on each argument (place results in tiargs[]), -+ * last find most specialized template from overload list/set. -+ */ -+ if (!findTemplateDeclaration(sc) || -+ !semanticTiargs(sc) || -+ !findBestMatch(sc, fargs)) -+ { -+ inst = this; -+ inst->errors = true; -+ return; // error recovery - } -+ TemplateDeclaration *tempdecl = this->tempdecl->isTemplateDeclaration(); -+ assert(tempdecl); - - // If tempdecl is a mixin, disallow it - if (tempdecl->ismixin) -@@ -4888,88 +5349,47 @@ void TemplateInstance::semantic(Scope *s - - hasNestedArgs(tiargs); - -+ arrayCheckRecursiveExpansion(&tdtypes, tempdecl, sc); -+ - /* See if there is an existing TemplateInstantiation that already - * implements the typeargs. If so, just refer to that one instead. - */ -- -- for (size_t i = 0; i < tempdecl->instances.dim; i++) - { -- TemplateInstance *ti = tempdecl->instances[i]; --#if LOG -- printf("\t%s: checking for match with instance %d (%p): '%s'\n", toChars(), i, ti, ti->toChars()); --#endif -- assert(tdtypes.dim == ti->tdtypes.dim); -- -- // Nesting must match -- if (isnested != ti->isnested) -+ TemplateInstance *ti = tempdecl->findExistingInstance(this, fargs); -+ if (ti) - { -- //printf("test2 isnested %s ti->isnested %s\n", isnested ? isnested->toChars() : "", ti->isnested ? ti->isnested->toChars() : ""); -- continue; -- } -- //printf("parent = %s, ti->parent = %s\n", tempdecl->parent->toPrettyChars(), ti->parent->toPrettyChars()); -- -- if (!arrayObjectMatch(&tdtypes, &ti->tdtypes, tempdecl, sc)) -- goto L1; -+ // It's a match -+ inst = ti; -+ parent = ti->parent; - -- /* Template functions may have different instantiations based on -- * "auto ref" parameters. -- */ -- if (fargs) -- { -- FuncDeclaration *fd = ti->toAlias()->isFuncDeclaration(); -- if (fd) -+ // If both this and the previous instantiation were speculative, -+ // use the number of errors that happened last time. -+ if (inst->speculative && global.gag) - { -- Parameters *fparameters = fd->getParameters(NULL); -- size_t nfparams = Parameter::dim(fparameters); // Num function parameters -- for (size_t j = 0; j < nfparams && j < fargs->dim; j++) -- { Parameter *fparam = Parameter::getNth(fparameters, j); -- Expression *farg = (*fargs)[j]; -- if (fparam->storageClass & STCauto) // if "auto ref" -- { -- if (farg->isLvalue()) -- { if (!(fparam->storageClass & STCref)) -- goto L1; // auto ref's don't match -- } -- else -- { if (fparam->storageClass & STCref) -- goto L1; // auto ref's don't match -- } -- } -- } -+ global.errors += inst->errors; -+ global.gaggedErrors += inst->errors; - } -- } -- -- // It's a match -- inst = ti; -- parent = ti->parent; -- -- // If both this and the previous instantiation were speculative, -- // use the number of errors that happened last time. -- if (inst->speculative && global.gag) -- { -- global.errors += inst->errors; -- global.gaggedErrors += inst->errors; -- } - -- // If the first instantiation was speculative, but this is not: -- if (inst->speculative && !global.gag) -- { -- // If the first instantiation had failed, re-run semantic, -- // so that error messages are shown. -- if (inst->errors) -- goto L1; -- // It had succeeded, mark it is a non-speculative instantiation, -- // and reuse it. -- inst->speculative = 0; -- } -+ // If the first instantiation was speculative, but this is not: -+ if (inst->speculative && !global.gag) -+ { -+ // If the first instantiation had failed, re-run semantic, -+ // so that error messages are shown. -+ if (inst->errors) -+ goto L1; -+ // It had succeeded, mark it is a non-speculative instantiation, -+ // and reuse it. -+ inst->speculative = 0; -+ } - - #if LOG -- printf("\tit's a match with instance %p, %d\n", inst, inst->semanticRun); -+ printf("\tit's a match with instance %p, %d\n", inst, inst->semanticRun); - #endif -- return; -- -- L1: -- ; -+ if (!inst->instantiatingModule || inst->instantiatingModule->isRoot()) -+ inst->instantiatingModule = mi; -+ return; -+ } -+ L1: ; - } - - /* So, we need to implement 'this' instance. -@@ -4984,29 +5404,21 @@ void TemplateInstance::semantic(Scope *s - if (global.gag && sc->speculative) - speculative = 1; - -- size_t tempdecl_instance_idx = tempdecl->instances.dim; -- tempdecl->instances.push(this); -- parent = tempdecl->parent; -- //printf("parent = '%s'\n", parent->kind()); -- -- ident = genIdent(tiargs); // need an identifier for name mangling purposes. -+ TemplateInstance *tempdecl_instance_idx = tempdecl->addInstance(this); - --#if 1 -- if (isnested) -- parent = isnested; --#endif -+ parent = enclosing ? enclosing : tempdecl->parent; - //printf("parent = '%s'\n", parent->kind()); - -+ //getIdent(); -+ - // Add 'this' to the enclosing scope's members[] so the semantic routines - // will get called on the instance members. Store the place we added it to - // in target_symbol_list(_idx) so we can remove it later if we encounter - // an error. - #if 1 -- int dosemantic3 = 0; - Dsymbols *target_symbol_list = NULL; - size_t target_symbol_list_idx; - -- if (!sc->parameterSpecialization) - { Dsymbols *a; - - Scope *scx = sc; -@@ -5016,22 +5428,9 @@ void TemplateInstance::semantic(Scope *s - break; - #endif - --#ifdef IN_GCC -- /* For -femit-templates, templates are always emitted. -- Problem: This picks up templates that aren't even -- needed in the current module. */ -- if (d_gcc_force_templates() && scx && scx->scopesym) -- { -- //fprintf(stderr, "\t0: adding to %s %s\n", sc->scopesym->kind(), sc->scopesym->toChars()); -- objFileModule = d_gcc_get_output_module(); -- a = objFileModule->members; -- } -- else --#endif -- - //if (scx && scx->scopesym) printf("3: scx is %s %s\n", scx->scopesym->kind(), scx->scopesym->toChars()); -- if (scx && scx->scopesym && -- scx->scopesym->members && !scx->scopesym->isTemplateMixin() -+ if (scx && scx->scopesym && scx->scopesym->members && -+ !scx->scopesym->isTemplateMixin() - #if 0 // removed because it bloated compile times - /* The problem is if A imports B, and B imports A, and both A - * and B instantiate the same template, does the compilation of A -@@ -5043,45 +5442,43 @@ void TemplateInstance::semantic(Scope *s - #endif - ) - { -+ /* A module can have explicit template instance and its alias -+ * in module scope (e,g, `alias Base64Impl!('+', '/') Base64;`). -+ * When the module is just imported, compiler can assume that -+ * its instantiated code would be contained in the separately compiled -+ * obj/lib file (e.g. phobos.lib). So we can omit their semantic3 running. -+ */ -+ //if (scx->scopesym->isModule()) -+ // printf("module level instance %s\n", toChars()); -+ - //printf("\t1: adding to %s %s\n", scx->scopesym->kind(), scx->scopesym->toChars()); - a = scx->scopesym->members; --#ifdef IN_GCC -- Dsymbol * p = scx->scopesym; -- while (p) -- { -- TemplateInstance *i = p->isTemplateInstance(); -- Module *m = p->isModule(); -- if (i != NULL) -- { -- if (i->objFileModule) -- { -- objFileModule = i->objFileModule; -- break; -- } -- } -- else if (m != NULL) -- { -- objFileModule = m; // %% importedFrom ? -- break; -- } -- p = p->parent; -- } -- //fprintf(stderr, "\t1: adding %s to module %s via %s %s\n", tempdecl->toChars(), -- // objFileModule ? objFileModule->toChars() : "", sc->scopesym->kind(), sc->scopesym->toChars()); --#endif - } - else - { -- Module *m = (isnested ? sc : tempdecl->scope)->module->importedFrom; -- //printf("\t2: adding to module %s instead of module %s\n", m->toChars(), sc->module->toChars()); -- a = m->members; -- if (m->semanticRun >= 3) -+ Dsymbol *s = enclosing ? enclosing : tempdecl->parent; -+ for (; s; s = s->toParent2()) - { -- dosemantic3 = 1; -+ if (s->isModule()) -+ break; - } --#ifdef IN_GCC -- objFileModule = m; --#endif -+ assert(s); -+ Module *m = (Module *)s; -+ if (!m->isRoot()) -+ { -+ //if (tinst && tinst->objFileModule) -+ // m = tinst->objFileModule; -+ //else -+ m = m->importedFrom; -+ } -+ //printf("\t2: adding to module %s instead of module %s\n", m->toChars(), sc->module->toChars()); -+ a = m->members; -+ -+ /* Defer semantic3 running in order to avoid mutual forward reference. -+ * See test/runnable/test10736.d -+ */ -+ if (m->semanticRun >= PASSsemantic3done) -+ Module::addDeferredSemantic3(this); - } - for (size_t i = 0; 1; i++) - { -@@ -5099,11 +5496,45 @@ void TemplateInstance::semantic(Scope *s - #endif - - // Copy the syntax trees from the TemplateDeclaration -- members = Dsymbol::arraySyntaxCopy(tempdecl->members); -+ if (members && speculative) -+ {} // Don't copy again so they were previously created. -+ else -+ members = Dsymbol::arraySyntaxCopy(tempdecl->members); -+ -+ // todo for TemplateThisParameter -+ for (size_t i = 0; i < tempdecl->parameters->dim; i++) -+ { -+ if ((*tempdecl->parameters)[i]->isTemplateThisParameter() == NULL) -+ continue; -+ Type *t = isType((*tiargs)[i]); -+ assert(t); -+ -+ StorageClass stc = 0; -+ if (t->mod & MODimmutable) -+ stc |= STCimmutable; -+ else -+ { -+ if (t->mod & MODconst) -+ stc |= STCconst; -+ else if (t->mod & MODwild) -+ stc |= STCwild; -+ -+ if (t->mod & MODshared) -+ stc |= STCshared; -+ } -+ if (stc != 0) -+ { -+ //printf("t = %s, stc = x%llx\n", t->toChars(), stc); -+ Dsymbols *s = new Dsymbols(); -+ s->push(new StorageClassDeclaration(stc, members)); -+ members = s; -+ } -+ break; -+ } - - // Create our own scope for the template parameters - Scope *scope = tempdecl->scope; -- if (!tempdecl->semanticRun) -+ if (tempdecl->semanticRun == PASSinit) - { - error("template instantiation %s forward references template declaration %s", toChars(), tempdecl->toChars()); - return; -@@ -5115,6 +5546,7 @@ void TemplateInstance::semantic(Scope *s - argsym = new ScopeDsymbol(); - argsym->parent = scope->parent; - scope = scope->push(argsym); -+ scope->instantiatingModule = mi; - // scope->stc = 0; - - // Declare each template parameter as an alias for the argument type -@@ -5179,8 +5611,8 @@ void TemplateInstance::semantic(Scope *s - #endif - Scope *sc2; - sc2 = scope->push(this); -- //printf("isnested = %d, sc->parent = %s\n", isnested, sc->parent->toChars()); -- sc2->parent = /*isnested ? sc->parent :*/ this; -+ //printf("enclosing = %d, sc->parent = %s\n", enclosing, sc->parent->toChars()); -+ sc2->parent = /*enclosing ? sc->parent :*/ this; - sc2->tinst = this; - sc2->speculative = speculative; - -@@ -5194,8 +5626,8 @@ void TemplateInstance::semantic(Scope *s - */ - bool found_deferred_ad = false; - for (size_t i = 0; i < Module::deferred.dim; i++) -- { Dsymbol *sd = Module::deferred[i]; -- -+ { -+ Dsymbol *sd = Module::deferred[i]; - AggregateDeclaration *ad = sd->isAggregateDeclaration(); - if (ad && ad->parent && ad->parent->isTemplateInstance()) - { -@@ -5209,7 +5641,7 @@ void TemplateInstance::semantic(Scope *s - } - } - } -- if (found_deferred_ad) -+ if (found_deferred_ad || Module::deferred.dim) - goto Laftersemantic; - - /* ConditionalDeclaration may introduce eponymous declaration, -@@ -5238,14 +5670,15 @@ void TemplateInstance::semantic(Scope *s - * for initializers inside a function. - */ - // if (sc->parent->isFuncDeclaration()) -- -+ { - /* BUG 782: this has problems if the classes this depends on - * are forward referenced. Find a way to defer semantic() - * on this template. - */ - semantic2(sc2); -+ } - -- if (sc->func || dosemantic3) -+ if (sc->func) - { - trySemantic3(sc2); - } -@@ -5262,14 +5695,14 @@ void TemplateInstance::semantic(Scope *s - if (tinst) - { tinst->printInstantiationTrace(); - } -- errors = 1; -+ errors = true; - if (global.gag) - { - // Errors are gagged, so remove the template instance from the - // instance/symbol lists we added it to and reset our state to - // finish clean and so we can try to instantiate it again later - // (see bugzilla 4302 and 6602). -- tempdecl->instances.remove(tempdecl_instance_idx); -+ tempdecl->removeInstance(tempdecl_instance_idx); - if (target_symbol_list) - { - // Because we added 'this' in the last position above, we -@@ -5288,89 +5721,351 @@ void TemplateInstance::semantic(Scope *s - } - - --void TemplateInstance::semanticTiargs(Scope *sc) --{ -- //printf("+TemplateInstance::semanticTiargs() %s\n", toChars()); -- if (semantictiargsdone) -- return; -- semantictiargsdone = 1; -- semanticTiargs(loc, sc, tiargs, 0); --} -- --/********************************** -- * Input: -- * flags 1: replace const variables with their initializers -- * 2: don't devolve Parameter to Type -+/********************************************** -+ * Find template declaration corresponding to template instance. - */ - --void TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int flags) -+bool TemplateInstance::findTemplateDeclaration(Scope *sc) - { -- // Run semantic on each argument, place results in tiargs[] -- //printf("+TemplateInstance::semanticTiargs()\n"); -- if (!tiargs) -- return; -- for (size_t j = 0; j < tiargs->dim; j++) -+ if (havetempdecl) -+ return true; -+ -+ //printf("TemplateInstance::findTemplateDeclaration() %s\n", toChars()); -+ if (!tempdecl) - { -- Object *o = (*tiargs)[j]; -- Type *ta = isType(o); -- Expression *ea = isExpression(o); -- Dsymbol *sa = isDsymbol(o); -+ /* Given: -+ * foo!( ... ) -+ * figure out which TemplateDeclaration foo refers to. -+ */ -+ Identifier *id = name; -+ Dsymbol *scopesym; -+ Dsymbol *s = sc->search(loc, id, &scopesym); -+ if (!s) -+ { -+ s = sc->search_correct(id); -+ if (s) -+ error("template '%s' is not defined, did you mean %s?", id->toChars(), s->toChars()); -+ else -+ error("template '%s' is not defined", id->toChars()); -+ return false; -+ } - -- //printf("1: (*tiargs)[%d] = %p, s=%p, v=%p, ea=%p, ta=%p\n", j, o, isDsymbol(o), isTuple(o), ea, ta); -- if (ta) -+#if LOG -+ printf("It's an instance of '%s' kind '%s'\n", s->toChars(), s->kind()); -+ if (s->parent) -+ printf("s->parent = '%s'\n", s->parent->toChars()); -+#endif -+ withsym = scopesym->isWithScopeSymbol(); -+ -+ /* We might have found an alias within a template when -+ * we really want the template. -+ */ -+ TemplateInstance *ti; -+ if (s->parent && -+ (ti = s->parent->isTemplateInstance()) != NULL) - { -- //printf("type %s\n", ta->toChars()); -- // It might really be an Expression or an Alias -- ta->resolve(loc, sc, &ea, &ta, &sa); -- if (ea) goto Lexpr; -- if (sa) goto Ldsym; -- if (ta == NULL) -+ if (ti->tempdecl && ti->tempdecl->ident == id) - { -- assert(global.errors); -- ta = Type::terror; -+ /* This is so that one can refer to the enclosing -+ * template, even if it has the same name as a member -+ * of the template, if it has a !(arguments) -+ */ -+ TemplateDeclaration *td = ti->tempdecl->isTemplateDeclaration(); -+ assert(td); -+ if (td->overroot) // if not start of overloaded list of TemplateDeclaration's -+ td = td->overroot; // then get the start -+ s = td; - } -+ } - -- Ltype: -- if (ta->ty == Ttuple) -- { // Expand tuple -- TypeTuple *tt = (TypeTuple *)ta; -- size_t dim = tt->arguments->dim; -- tiargs->remove(j); -- if (dim) -- { tiargs->reserve(dim); -- for (size_t i = 0; i < dim; i++) -- { Parameter *arg = (*tt->arguments)[i]; -- if (flags & 2 && arg->ident) -- tiargs->insert(j + i, arg); -- else -- tiargs->insert(j + i, arg->type); -- } -- } -- j--; -- continue; -- } -- (*tiargs)[j] = ta; -+ if (!updateTemplateDeclaration(sc, s)) -+ { -+ return false; - } -- else if (ea) -+ } -+ assert(tempdecl); -+ -+ struct ParamFwdTi -+ { -+ static int fp(void *param, Dsymbol *s) -+ { -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (!td) -+ return 0; -+ -+ TemplateInstance *ti = (TemplateInstance *)param; -+ if (td->semanticRun == PASSinit) - { -- Lexpr: -- //printf("+[%d] ea = %s %s\n", j, Token::toChars(ea->op), ea->toChars()); -- ea = ea->semantic(sc); -- if (flags & 1) // only used by __traits, must not interpret the args -- ea = ea->optimize(WANTvalue); -- else if (ea->op == TOKvar) -- { /* This test is to skip substituting a const var with -- * its initializer. The problem is the initializer won't -- * match with an 'alias' parameter. Instead, do the -- * const substitution in TemplateValueParameter::matchArg(). -- */ -+ if (td->scope) -+ { -+ // Try to fix forward reference. Ungag errors while doing so. -+ Ungag ungag = td->ungagSpeculative(); -+ td->semantic(td->scope); - } -- else if (ea->op != TOKtuple && -- ea->op != TOKimport && ea->op != TOKtype && -- ea->op != TOKfunction && ea->op != TOKerror && -- ea->op != TOKthis && ea->op != TOKsuper) -+ if (td->semanticRun == PASSinit) - { -- int olderrs = global.errors; -+ ti->error("%s forward references template declaration %s", ti->toChars(), td->toChars()); -+ return 1; -+ } -+ } -+ return 0; -+ } -+ }; -+ // Look for forward references -+ OverloadSet *tovers = tempdecl->isOverloadSet(); -+ size_t overs_dim = tovers ? tovers->a.dim : 1; -+ for (size_t oi = 0; oi < overs_dim; oi++) -+ { -+ if (overloadApply(tovers ? tovers->a[oi] : tempdecl, (void *)this, &ParamFwdTi::fp)) -+ return false; -+ } -+ return true; -+} -+ -+/********************************************** -+ * Confirm s is a valid template, then store it. -+ */ -+ -+bool TemplateInstance::updateTemplateDeclaration(Scope *sc, Dsymbol *s) -+{ -+ if (s) -+ { -+ Identifier *id = name; -+ s = s->toAlias(); -+ -+ /* If an OverloadSet, look for a unique member that is a template declaration -+ */ -+ OverloadSet *os = s->isOverloadSet(); -+ if (os) -+ { -+ s = NULL; -+ for (size_t i = 0; i < os->a.dim; i++) -+ { -+ Dsymbol *s2 = os->a[i]; -+ if (FuncDeclaration *f = s2->isFuncDeclaration()) -+ s2 = f->findTemplateDeclRoot(); -+ else -+ s2 = s2->isTemplateDeclaration(); -+ if (s2) -+ { -+ if (s) -+ { -+ tempdecl = os; -+ return true; -+ } -+ s = s2; -+ } -+ } -+ if (!s) -+ { -+ error("template '%s' is not defined", id->toChars()); -+ return false; -+ } -+ } -+ -+ /* It should be a TemplateDeclaration, not some other symbol -+ */ -+ if (FuncDeclaration *f = s->isFuncDeclaration()) -+ tempdecl = f->findTemplateDeclRoot(); -+ else -+ tempdecl = s->isTemplateDeclaration(); -+ if (!tempdecl) -+ { -+ if (!s->parent && global.errors) -+ return false; -+ if (!s->parent && s->getType()) -+ { -+ Dsymbol *s2 = s->getType()->toDsymbol(sc); -+ if (!s2) -+ { -+ error("%s is not a template declaration, it is a %s", id->toChars(), s->kind()); -+ return false; -+ } -+ s = s2; -+ } -+#ifdef DEBUG -+ //if (!s->parent) printf("s = %s %s\n", s->kind(), s->toChars()); -+#endif -+ //assert(s->parent); -+ TemplateInstance *ti = s->parent ? s->parent->isTemplateInstance() : NULL; -+ if (ti && -+ (ti->name == s->ident || -+ ti->toAlias()->ident == s->ident) -+ && -+ ti->tempdecl) -+ { -+ /* This is so that one can refer to the enclosing -+ * template, even if it has the same name as a member -+ * of the template, if it has a !(arguments) -+ */ -+ TemplateDeclaration *td = ti->tempdecl->isTemplateDeclaration(); -+ assert(td); -+ if (td->overroot) // if not start of overloaded list of TemplateDeclaration's -+ td = td->overroot; // then get the start -+ tempdecl = td; -+ } -+ else -+ { -+ error("%s is not a template declaration, it is a %s", id->toChars(), s->kind()); -+ return false; -+ } -+ } -+ } -+ return (tempdecl != NULL); -+} -+ -+bool TemplateInstance::semanticTiargs(Scope *sc) -+{ -+ //printf("+TemplateInstance::semanticTiargs() %s\n", toChars()); -+ if (semantictiargsdone) -+ return true; -+ semantictiargsdone = 1; -+ semanticTiargs(loc, sc, tiargs, 0); -+ return arrayObjectIsError(tiargs) == 0; -+} -+ -+/********************************** -+ * Return true if e could be valid only as a template value parameter. -+ * Return false if it might be an alias or tuple. -+ * (Note that even in this case, it could still turn out to be a value). -+ */ -+bool definitelyValueParameter(Expression *e) -+{ -+ // None of these can be value parameters -+ if (e->op == TOKtuple || e->op == TOKimport || -+ e->op == TOKtype || e->op == TOKdottype || -+ e->op == TOKtemplate || e->op == TOKdottd || -+ e->op == TOKfunction || e->op == TOKerror || -+ e->op == TOKthis || e->op == TOKsuper) -+ return false; -+ -+ if (e->op != TOKdotvar) -+ return true; -+ -+ /* Template instantiations involving a DotVar expression are difficult. -+ * In most cases, they should be treated as a value parameter, and interpreted. -+ * But they might also just be a fully qualified name, which should be treated -+ * as an alias. -+ */ -+ -+ // x.y.f cannot be a value -+ FuncDeclaration *f = ((DotVarExp *)e)->var->isFuncDeclaration(); -+ if (f) -+ return false; -+ -+ while (e->op == TOKdotvar) -+ { -+ e = ((DotVarExp *)e)->e1; -+ } -+ // this.x.y and super.x.y couldn't possibly be valid values. -+ if (e->op == TOKthis || e->op == TOKsuper) -+ return false; -+ -+ // e.type.x could be an alias -+ if (e->op == TOKdottype) -+ return false; -+ -+ // var.x.y is the only other possible form of alias -+ if (e->op != TOKvar) -+ return true; -+ -+ VarDeclaration *v = ((VarExp *)e)->var->isVarDeclaration(); -+ -+ // func.x.y is not an alias -+ if (!v) -+ return true; -+ -+ // TODO: Should we force CTFE if it is a global constant? -+ -+ return false; -+} -+ -+/********************************** -+ * Input: -+ * flags 1: replace const variables with their initializers -+ * 2: don't devolve Parameter to Type -+ */ -+ -+void TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int flags) -+{ -+ // Run semantic on each argument, place results in tiargs[] -+ //printf("+TemplateInstance::semanticTiargs()\n"); -+ if (!tiargs) -+ return; -+ for (size_t j = 0; j < tiargs->dim; j++) -+ { -+ RootObject *o = (*tiargs)[j]; -+ Type *ta = isType(o); -+ Expression *ea = isExpression(o); -+ Dsymbol *sa = isDsymbol(o); -+ -+ //printf("1: (*tiargs)[%d] = %p, s=%p, v=%p, ea=%p, ta=%p\n", j, o, isDsymbol(o), isTuple(o), ea, ta); -+ if (ta) -+ { -+ //printf("type %s\n", ta->toChars()); -+ // It might really be an Expression or an Alias -+ ta->resolve(loc, sc, &ea, &ta, &sa); -+ if (ea) goto Lexpr; -+ if (sa) goto Ldsym; -+ if (ta == NULL) -+ { -+ assert(global.errors); -+ ta = Type::terror; -+ } -+ -+ Ltype: -+ if (ta->ty == Ttuple) -+ { // Expand tuple -+ TypeTuple *tt = (TypeTuple *)ta; -+ size_t dim = tt->arguments->dim; -+ tiargs->remove(j); -+ if (dim) -+ { tiargs->reserve(dim); -+ for (size_t i = 0; i < dim; i++) -+ { Parameter *arg = (*tt->arguments)[i]; -+ if (flags & 2 && arg->ident) -+ tiargs->insert(j + i, arg); -+ else -+ tiargs->insert(j + i, arg->type); -+ } -+ } -+ j--; -+ continue; -+ } -+ (*tiargs)[j] = ta->merge2(); -+ } -+ else if (ea) -+ { -+ Lexpr: -+ //printf("+[%d] ea = %s %s\n", j, Token::toChars(ea->op), ea->toChars()); -+ if (!(flags & 1)) sc = sc->startCTFE(); -+ ea = ea->semantic(sc); -+ if (!(flags & 1)) sc = sc->endCTFE(); -+ if (flags & 1) // only used by __traits, must not interpret the args -+ { -+ VarDeclaration *v; -+ if (ea->op == TOKvar && (v = ((VarExp *)ea)->var->isVarDeclaration()) != NULL && -+ !(v->storage_class & STCtemplateparameter)) -+ { -+ if (v->sem < SemanticDone) -+ v->semantic(sc); -+ // skip optimization for variable symbols -+ } -+ else -+ { -+ ea = ea->optimize(WANTvalue); -+ } -+ } -+ else if (ea->op == TOKvar) -+ { /* This test is to skip substituting a const var with -+ * its initializer. The problem is the initializer won't -+ * match with an 'alias' parameter. Instead, do the -+ * const substitution in TemplateValueParameter::matchArg(). -+ */ -+ } -+ else if (definitelyValueParameter(ea)) -+ { -+ int olderrs = global.errors; - ea = ea->ctfeInterpret(); - if (global.errors != olderrs) - ea = new ErrorExp(); -@@ -5417,8 +6112,8 @@ void TemplateInstance::semanticTiargs(Lo - else if (fe->td) - { /* If template argument is a template lambda, - * get template declaration itself. */ -- sa = fe->td; -- goto Ldsym; -+ //sa = fe->td; -+ //goto Ldsym; - } - } - if (ea->op == TOKdotvar) -@@ -5453,13 +6148,26 @@ void TemplateInstance::semanticTiargs(Lo - j--; - continue; - } -+ if (FuncAliasDeclaration *fa = sa->isFuncAliasDeclaration()) -+ { -+ FuncDeclaration *f = fa->toAliasFunc(); -+ if (!fa->hasOverloads && f->isUnique()) -+ { -+ // Strip FuncAlias only when the aliased function -+ // does not have any overloads. -+ sa = f; -+ } -+ } - (*tiargs)[j] = sa; - - TemplateDeclaration *td = sa->isTemplateDeclaration(); -- if (td && !td->semanticRun && td->literal) -+ if (td && td->semanticRun == PASSinit && td->literal) - { - td->semantic(sc); - } -+ FuncDeclaration *fd = sa->isFuncDeclaration(); -+ if (fd) -+ fd->functionSemantic(); - } - else if (isParameter(o)) - { -@@ -5474,7 +6182,7 @@ void TemplateInstance::semanticTiargs(Lo - printf("-TemplateInstance::semanticTiargs()\n"); - for (size_t j = 0; j < tiargs->dim; j++) - { -- Object *o = (*tiargs)[j]; -+ RootObject *o = (*tiargs)[j]; - Type *ta = isType(o); - Expression *ea = isExpression(o); - Dsymbol *sa = isDsymbol(o); -@@ -5485,288 +6193,330 @@ void TemplateInstance::semanticTiargs(Lo - #endif - } - --/********************************************** -- * Find template declaration corresponding to template instance. -- */ -- --TemplateDeclaration *TemplateInstance::findTemplateDeclaration(Scope *sc) -+bool TemplateInstance::findBestMatch(Scope *sc, Expressions *fargs) - { -- //printf("TemplateInstance::findTemplateDeclaration() %s\n", toChars()); -- if (!tempdecl) -+ if (havetempdecl) - { -- /* Given: -- * foo!( ... ) -- * figure out which TemplateDeclaration foo refers to. -- */ -- Dsymbol *s; -- Dsymbol *scopesym; -- Identifier *id; -- -- id = name; -- s = sc->search(loc, id, &scopesym); -- if (!s) -- { -- s = sc->search_correct(id); -- if (s) -- error("template '%s' is not defined, did you mean %s?", id->toChars(), s->toChars()); -- else -- error("template '%s' is not defined", id->toChars()); -- return NULL; -- } -- -- /* If an OverloadSet, look for a unique member that is a template declaration -- */ -- OverloadSet *os = s->isOverloadSet(); -- if (os) -- { s = NULL; -- for (size_t i = 0; i < os->a.dim; i++) -- { Dsymbol *s2 = os->a[i]; -- if (s2->isTemplateDeclaration()) -- { -- if (s) -- error("ambiguous template declaration %s and %s", s->toPrettyChars(), s2->toPrettyChars()); -- s = s2; -- } -- } -- if (!s) -- { error("template '%s' is not defined", id->toChars()); -- return NULL; -- } -- } -- --#if LOG -- printf("It's an instance of '%s' kind '%s'\n", s->toChars(), s->kind()); -- if (s->parent) -- printf("s->parent = '%s'\n", s->parent->toChars()); --#endif -- withsym = scopesym->isWithScopeSymbol(); -- -- /* We might have found an alias within a template when -- * we really want the template. -- */ -- TemplateInstance *ti; -- if (s->parent && -- (ti = s->parent->isTemplateInstance()) != NULL) -- { -- if (ti->tempdecl && ti->tempdecl->ident == id) -- { -- /* This is so that one can refer to the enclosing -- * template, even if it has the same name as a member -- * of the template, if it has a !(arguments) -- */ -- tempdecl = ti->tempdecl; -- if (tempdecl->overroot) // if not start of overloaded list of TemplateDeclaration's -- tempdecl = tempdecl->overroot; // then get the start -- s = tempdecl; -- } -- } -- -- s = s->toAlias(); -- -- /* It should be a TemplateDeclaration, not some other symbol -- */ -- tempdecl = s->isTemplateDeclaration(); -- if (!tempdecl) -+ TemplateDeclaration *tempdecl = this->tempdecl->isTemplateDeclaration(); -+ assert(tempdecl); -+ assert(tempdecl->scope); -+ // Deduce tdtypes -+ tdtypes.setDim(tempdecl->parameters->dim); -+ if (!tempdecl->matchWithInstance(sc, this, &tdtypes, fargs, 2)) - { -- if (!s->parent && global.errors) -- return NULL; -- if (!s->parent && s->getType()) -- { Dsymbol *s2 = s->getType()->toDsymbol(sc); -- if (!s2) -- { -- error("%s is not a template declaration, it is a %s", id->toChars(), s->kind()); -- return NULL; -- } -- s = s2; -- } --#ifdef DEBUG -- //if (!s->parent) printf("s = %s %s\n", s->kind(), s->toChars()); --#endif -- //assert(s->parent); -- TemplateInstance *ti = s->parent ? s->parent->isTemplateInstance() : NULL; -- if (ti && -- (ti->name == id || -- ti->toAlias()->ident == id) -- && -- ti->tempdecl) -- { -- /* This is so that one can refer to the enclosing -- * template, even if it has the same name as a member -- * of the template, if it has a !(arguments) -- */ -- tempdecl = ti->tempdecl; -- if (tempdecl->overroot) // if not start of overloaded list of TemplateDeclaration's -- tempdecl = tempdecl->overroot; // then get the start -- } -- else -- { -- error("%s is not a template declaration, it is a %s", id->toChars(), s->kind()); -- return NULL; -- } -+ error("incompatible arguments for template instantiation"); -+ return false; - } -+ return true; - } -- else -- assert(tempdecl->isTemplateDeclaration()); -- return tempdecl; --} -- --TemplateDeclaration *TemplateInstance::findBestMatch(Scope *sc, Expressions *fargs) --{ -- /* Since there can be multiple TemplateDeclaration's with the same -- * name, look for the best match. -- */ -- TemplateDeclaration *td_ambig = NULL; -- TemplateDeclaration *td_best = NULL; -- MATCH m_best = MATCHnomatch; -- Objects dedtypes; - - #if LOG - printf("TemplateInstance::findBestMatch()\n"); - #endif -- // First look for forward references -- for (TemplateDeclaration *td = tempdecl; td; td = td->overnext) -- { -- if (!td->semanticRun) -- { -- if (td->scope) -- { // Try to fix forward reference. Ungag errors while doing so. -- int oldgag = global.gag; -- if (global.isSpeculativeGagging() && !td->isSpeculative()) -- global.gag = 0; -+ unsigned errs = global.errors; - -- td->semantic(td->scope); -+ struct ParamBest -+ { -+ // context -+ Scope *sc; -+ TemplateInstance *ti; -+ Objects dedtypes; -+ // result -+ TemplateDeclaration *td_best; -+ TemplateDeclaration *td_ambig; -+ MATCH m_best; - -- global.gag = oldgag; -- } -- if (!td->semanticRun) -- { -- error("%s forward references template declaration %s", toChars(), td->toChars()); -- return NULL; -- } -- } -+ static int fp(void *param, Dsymbol *s) -+ { -+ return ((ParamBest *)param)->fp(s); - } -- -- for (TemplateDeclaration *td = tempdecl; td; td = td->overnext) -+ int fp(Dsymbol *s) - { -- MATCH m; -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (!td) -+ return 0; -+ -+ if (td == td_best) // skip duplicates -+ return 0; - --//if (tiargs->dim) printf("2: tiargs->dim = %d, data[0] = %p\n", tiargs->dim, (*tiargs)[0]); -+ //printf("td = %s\n", td->toPrettyChars()); - - // If more arguments than parameters, - // then this is no match. -- if (td->parameters->dim < tiargs->dim) -+ if (td->parameters->dim < ti->tiargs->dim) - { - if (!td->isVariadic()) -- continue; -+ return 0; - } - - dedtypes.setDim(td->parameters->dim); - dedtypes.zero(); -- assert(td->semanticRun); -- m = td->matchWithInstance(this, &dedtypes, fargs, 0); -+ assert(td->semanticRun != PASSinit); -+ MATCH m = td->matchWithInstance(sc, ti, &dedtypes, ti->fargs, 0); - //printf("matchWithInstance = %d\n", m); - if (!m) // no match at all -- continue; -+ return 0; - -- if (m < m_best) -- goto Ltd_best; -- if (m > m_best) -- goto Ltd; -+ if (m < m_best) goto Ltd_best; -+ if (m > m_best) goto Ltd; - - { - // Disambiguate by picking the most specialized TemplateDeclaration -- MATCH c1 = td->leastAsSpecialized(td_best, fargs); -- MATCH c2 = td_best->leastAsSpecialized(td, fargs); -+ MATCH c1 = td->leastAsSpecialized(sc, td_best, ti->fargs); -+ MATCH c2 = td_best->leastAsSpecialized(sc, td, ti->fargs); - //printf("c1 = %d, c2 = %d\n", c1, c2); -- -- if (c1 > c2) -- goto Ltd; -- else if (c1 < c2) -- goto Ltd_best; -- else -- goto Lambig; -+ if (c1 > c2) goto Ltd; -+ if (c1 < c2) goto Ltd_best; - } - - Lambig: // td_best and td are ambiguous - td_ambig = td; -- continue; -+ return 0; - - Ltd_best: // td_best is the best match so far - td_ambig = NULL; -- continue; -+ return 0; - - Ltd: // td is the new best match - td_ambig = NULL; - td_best = td; - m_best = m; -- tdtypes.setDim(dedtypes.dim); -- memcpy(tdtypes.tdata(), dedtypes.tdata(), tdtypes.dim * sizeof(void *)); -- continue; -+ ti->tdtypes.setDim(dedtypes.dim); -+ memcpy(ti->tdtypes.tdata(), dedtypes.tdata(), ti->tdtypes.dim * sizeof(void *)); -+ return 0; - } -+ }; -+ ParamBest p; -+ // context -+ p.ti = this; -+ p.sc = sc; -+ -+ /* Since there can be multiple TemplateDeclaration's with the same -+ * name, look for the best match. -+ */ -+ TemplateDeclaration *td_last = NULL; - -- if (!td_best) -+ OverloadSet *tovers = tempdecl->isOverloadSet(); -+ size_t overs_dim = tovers ? tovers->a.dim : 1; -+ for (size_t oi = 0; oi < overs_dim; oi++) - { -- if (tempdecl && !tempdecl->overnext) -+ // result -+ p.td_best = NULL; -+ p.td_ambig = NULL; -+ p.m_best = MATCHnomatch; -+ overloadApply(tovers ? tovers->a[oi] : tempdecl, &p, &ParamBest::fp); -+ -+ if (p.td_ambig) -+ { -+ ::error(loc, "%s %s.%s matches more than one template declaration:\n\t%s(%d):%s\nand\n\t%s(%d):%s", -+ p.td_best->kind(), p.td_best->parent->toPrettyChars(), p.td_best->ident->toChars(), -+ p.td_best->loc.filename, p.td_best->loc.linnum, p.td_best->toChars(), -+ p.td_ambig->loc.filename, p.td_ambig->loc.linnum, p.td_ambig->toChars()); -+ return false; -+ } -+ if (p.td_best) -+ { -+ if (!td_last) -+ td_last = p.td_best; -+ else if (td_last != p.td_best) -+ { -+ ScopeDsymbol::multiplyDefined(loc, td_last, p.td_best); -+ return false; -+ } -+ } -+ } -+ -+ if (!td_last) -+ { -+ TemplateDeclaration *tdecl = tempdecl->isTemplateDeclaration(); -+ -+ if (errs != global.errors) -+ errorSupplemental(loc, "while looking for match for %s", toChars()); -+ else if (tovers) -+ error("does not match template overload set %s", tovers->toChars()); -+ else if (tdecl && !tdecl->overnext) - // Only one template, so we can give better error message -- error("%s does not match template declaration %s", toChars(), tempdecl->toChars()); -+ error("does not match template declaration %s", tdecl->toChars()); - else - ::error(loc, "%s %s.%s does not match any template declaration", -- tempdecl->kind(), tempdecl->parent->toPrettyChars(), tempdecl->ident->toChars()); -- return NULL; -+ tdecl->kind(), tdecl->parent->toPrettyChars(), tdecl->ident->toChars()); -+ return false; - } -- if (td_ambig) -+ -+ /* The best match is td_last -+ */ -+ tempdecl = td_last; -+ -+#if LOG -+ printf("\tIt's a match with template declaration '%s'\n", tempdecl->toChars()); -+#endif -+ return (errs == global.errors); -+} -+ -+/***************************************************** -+ * Determine if template instance is really a template function, -+ * and that template function needs to infer types from the function -+ * arguments. -+ * -+ * Like findBestMatch, iterate possible template candidates, -+ * but just looks only the necessity of type inference. -+ */ -+ -+bool TemplateInstance::needsTypeInference(Scope *sc, int flag) -+{ -+ //printf("TemplateInstance::needsTypeInference() %s\n", toChars()); -+ -+ struct ParamNeedsInf -+ { -+ // context -+ Scope *sc; -+ TemplateInstance *ti; -+ int flag; -+ // result -+ Objects dedtypes; -+ size_t count; -+ -+ static int fp(void *param, Dsymbol *s) - { -- ::error(loc, "%s %s.%s matches more than one template declaration, %s(%d):%s and %s(%d):%s", -- td_best->kind(), td_best->parent->toPrettyChars(), td_best->ident->toChars(), -- td_best->loc.filename, td_best->loc.linnum, td_best->toChars(), -- td_ambig->loc.filename, td_ambig->loc.linnum, td_ambig->toChars()); -+ return ((ParamNeedsInf *)param)->fp(s); - } -+ int fp(Dsymbol *s) -+ { -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (!td) -+ { -+ Lcontinue: -+ return 0; -+ } - -- /* The best match is td_best -- */ -- tempdecl = td_best; -+ /* If any of the overloaded template declarations need inference, -+ * then return true -+ */ -+ FuncDeclaration *fd; -+ if (!td->onemember) -+ return 0; -+ if (TemplateDeclaration *td2 = td->onemember->isTemplateDeclaration()) -+ { -+ if (!td2->onemember || !td2->onemember->isFuncDeclaration()) -+ return 0; -+ if (ti->tiargs->dim > td->parameters->dim && !td->isVariadic()) -+ return 0; -+ return 1; -+ } -+ if ((fd = td->onemember->isFuncDeclaration()) == NULL || -+ fd->type->ty != Tfunction) -+ { -+ return 0; -+ } - --#if 0 -- /* Cast any value arguments to be same type as value parameter -- */ -- for (size_t i = 0; i < tiargs->dim; i++) -- { Object *o = (*tiargs)[i]; -- Expression *ea = isExpression(o); // value argument -- TemplateParameter *tp = (*tempdecl->parameters)[i]; -- assert(tp); -- TemplateValueParameter *tvp = tp->isTemplateValueParameter(); -- if (tvp) -+ for (size_t i = 0; i < td->parameters->dim; i++) - { -- assert(ea); -- ea = ea->castTo(tvp->valType); -- ea = ea->ctfeInterpret(); -- (*tiargs)[i] = (Object *)ea; -+ if ((*td->parameters)[i]->isTemplateThisParameter()) -+ return 1; - } -- } --#endif - --#if LOG -- printf("\tIt's a match with template declaration '%s'\n", tempdecl->toChars()); --#endif -- return tempdecl; -+ /* Determine if the instance arguments, tiargs, are all that is necessary -+ * to instantiate the template. -+ */ -+ //printf("tp = %p, td->parameters->dim = %d, tiargs->dim = %d\n", tp, td->parameters->dim, ti->tiargs->dim); -+ TypeFunction *tf = (TypeFunction *)fd->type; -+ if (size_t dim = Parameter::dim(tf->parameters)) -+ { -+ TemplateParameter *tp = td->isVariadic(); -+ if (tp && td->parameters->dim > 1) -+ return 1; -+ -+ if (ti->tiargs->dim < td->parameters->dim) -+ { -+ // Can remain tiargs be filled by default arguments? -+ for (size_t i = ti->tiargs->dim; i < td->parameters->dim; i++) -+ { -+ tp = (*td->parameters)[i]; -+ if (TemplateTypeParameter *ttp = tp->isTemplateTypeParameter()) -+ { -+ if (!ttp->defaultType) -+ return 1; -+ } -+ else if (TemplateAliasParameter *tap = tp->isTemplateAliasParameter()) -+ { -+ if (!tap->defaultAlias) -+ return 1; -+ } -+ else if (TemplateValueParameter *tvp = tp->isTemplateValueParameter()) -+ { -+ if (!tvp->defaultValue) -+ return 1; -+ } -+ } -+ } -+ -+ for (size_t i = 0; i < dim; i++) -+ { -+ // 'auto ref' needs inference. -+ if (Parameter::getNth(tf->parameters, i)->storageClass & STCauto) -+ return 1; -+ } -+ } -+ -+ if (!flag) -+ { -+ /* Calculate the need for overload resolution. -+ * When only one template can match with tiargs, inference is not necessary. -+ */ -+ dedtypes.setDim(td->parameters->dim); -+ dedtypes.zero(); -+ assert(td->semanticRun != PASSinit); -+ MATCH m = td->matchWithInstance(sc, ti, &dedtypes, NULL, 0); -+ if (m == MATCHnomatch) -+ return 0; -+ } -+ -+ /* If there is more than one function template which matches, we may -+ * need type inference (see Bugzilla 4430) -+ */ -+ if (++count > 1) -+ return 1; -+ -+ return 0; -+ } -+ }; -+ ParamNeedsInf p; -+ // context -+ p.ti = this; -+ p.sc = sc; -+ p.flag = flag; -+ // result -+ p.count = 0; -+ -+ OverloadSet *tovers = tempdecl->isOverloadSet(); -+ size_t overs_dim = tovers ? tovers->a.dim : 1; -+ for (size_t oi = 0; oi < overs_dim; oi++) -+ { -+ if (int r = overloadApply(tovers ? tovers->a[oi] : tempdecl, &p, &ParamNeedsInf::fp)) -+ return true; -+ } -+ //printf("false\n"); -+ return false; - } - - - /***************************************** - * Determines if a TemplateInstance will need a nested - * generation of the TemplateDeclaration. -- * Sets isnested property if so, and returns != 0; -+ * Sets enclosing property if so, and returns != 0; - */ - --int TemplateInstance::hasNestedArgs(Objects *args) --{ int nested = 0; -+bool TemplateInstance::hasNestedArgs(Objects *args) -+{ -+ int nested = 0; - //printf("TemplateInstance::hasNestedArgs('%s')\n", tempdecl->ident->toChars()); - - /* A nested instance happens when an argument references a local - * symbol that is on the stack. - */ - for (size_t i = 0; i < args->dim; i++) -- { Object *o = (*args)[i]; -+ { -+ RootObject *o = (*args)[i]; - Expression *ea = isExpression(o); - Dsymbol *sa = isDsymbol(o); - Tuple *va = isTuple(o); -@@ -5808,14 +6558,35 @@ int TemplateInstance::hasNestedArgs(Obje - sa = ((FuncExp *)ea)->fd; - goto Lsa; - } -+ // Emulate Expression::toMangleBuffer call that had exist in TemplateInstance::genIdent. -+ if (ea->op != TOKint64 && // IntegerExp -+ ea->op != TOKfloat64 && // RealExp -+ ea->op != TOKcomplex80 && // CompexExp -+ ea->op != TOKnull && // NullExp -+ ea->op != TOKstring && // StringExp -+ ea->op != TOKarrayliteral && // ArrayLiteralExp -+ ea->op != TOKassocarrayliteral && // AssocArrayLiteralExp -+ ea->op != TOKstructliteral) // StructLiteralExp -+ { -+ ea->error("expression %s is not a valid template value argument", ea->toChars()); -+ } - } - else if (sa) - { - Lsa: -+ sa = sa->toAlias(); - TemplateDeclaration *td = sa->isTemplateDeclaration(); -+ if (td) -+ { -+ TemplateInstance *ti = sa->toParent()->isTemplateInstance(); -+ if (ti && ti->enclosing) -+ sa = ti; -+ } -+ TemplateInstance *ti = sa->isTemplateInstance(); - AggregateDeclaration *ad = sa->isAggregateDeclaration(); - Declaration *d = sa->isDeclaration(); - if ((td && td->literal) || -+ (ti && ti->enclosing) || - #if FIXBUG8863 - (ad && ad->isNested()) || - #endif -@@ -5829,31 +6600,32 @@ int TemplateInstance::hasNestedArgs(Obje - { - // if module level template - if (tempdecl->toParent()->isModule()) -- { Dsymbol *dparent = sa->toParent(); -- if (!isnested) -- isnested = dparent; -- else if (isnested != dparent) -+ { -+ Dsymbol *dparent = sa->toParent2(); -+ if (!enclosing) -+ enclosing = dparent; -+ else if (enclosing != dparent) - { - /* Select the more deeply nested of the two. - * Error if one is not nested inside the other. - */ -- for (Dsymbol *p = isnested; p; p = p->parent) -+ for (Dsymbol *p = enclosing; p; p = p->parent) - { - if (p == dparent) -- goto L1; // isnested is most nested -+ goto L1; // enclosing is most nested - } - for (Dsymbol *p = dparent; p; p = p->parent) - { -- if (p == isnested) -- { isnested = dparent; -+ if (p == enclosing) -+ { enclosing = dparent; - goto L1; // dparent is most nested - } - } - error("%s is nested in both %s and %s", -- toChars(), isnested->toChars(), dparent->toChars()); -+ toChars(), enclosing->toChars(), dparent->toChars()); - } - L1: -- //printf("\tnested inside %s\n", isnested->toChars()); -+ //printf("\tnested inside %s\n", enclosing->toChars()); - nested |= 1; - } - else -@@ -5866,7 +6638,7 @@ int TemplateInstance::hasNestedArgs(Obje - } - } - //printf("-TemplateInstance::hasNestedArgs('%s') = %d\n", tempdecl->ident->toChars(), nested); -- return nested; -+ return nested != 0; - } - - /**************************************** -@@ -5876,13 +6648,16 @@ int TemplateInstance::hasNestedArgs(Obje - */ - - Identifier *TemplateInstance::genIdent(Objects *args) --{ OutBuffer buf; -+{ -+ assert(tempdecl); - - //printf("TemplateInstance::genIdent('%s')\n", tempdecl->ident->toChars()); -+ OutBuffer buf; - char *id = tempdecl->ident->toChars(); - buf.printf("__T%llu%s", (ulonglong)strlen(id), id); - for (size_t i = 0; i < args->dim; i++) -- { Object *o = (*args)[i]; -+ { -+ RootObject *o = (*args)[i]; - Type *ta = isType(o); - Expression *ea = isExpression(o); - Dsymbol *sa = isDsymbol(o); -@@ -5955,15 +6730,10 @@ Identifier *TemplateInstance::genIdent(O - { - Lsa: - buf.writeByte('S'); -+ sa = sa->toAlias(); - Declaration *d = sa->isDeclaration(); -- Lsa2: - if (d && (!d->type || !d->type->deco)) - { -- FuncAliasDeclaration *fad = d->isFuncAliasDeclaration(); -- if (fad) -- { d = fad->toAliasFunc(); -- goto Lsa2; -- } - error("forward reference of %s %s", d->kind(), d->toChars()); - continue; - } -@@ -6005,6 +6775,17 @@ Identifier *TemplateInstance::genIdent(O - return Lexer::idPool(id); - } - -+/************************************* -+ * Lazily generate identifier for template instance. -+ * This is because 75% of the ident's are never needed. -+ */ -+ -+Identifier *TemplateInstance::getIdent() -+{ -+ if (!ident && inst) -+ ident = genIdent(tiargs); // need an identifier for name mangling purposes. -+ return ident; -+} - - /**************************************************** - * Declare parameters of template instance, initialize them with the -@@ -6013,90 +6794,21 @@ Identifier *TemplateInstance::genIdent(O - - void TemplateInstance::declareParameters(Scope *sc) - { -+ TemplateDeclaration *tempdecl = this->tempdecl->isTemplateDeclaration(); -+ assert(tempdecl); -+ - //printf("TemplateInstance::declareParameters()\n"); - for (size_t i = 0; i < tdtypes.dim; i++) - { - TemplateParameter *tp = (*tempdecl->parameters)[i]; -- //Object *o = (*tiargs)[i]; -- Object *o = tdtypes[i]; // initializer for tp -+ //RootObject *o = (*tiargs)[i]; -+ RootObject *o = tdtypes[i]; // initializer for tp - - //printf("\ttdtypes[%d] = %p\n", i, o); - tempdecl->declareParameter(sc, tp, o); - } - } - --/***************************************************** -- * Determine if template instance is really a template function, -- * and that template function needs to infer types from the function -- * arguments. -- */ -- --int TemplateInstance::needsTypeInference(Scope *sc) --{ -- //printf("TemplateInstance::needsTypeInference() %s\n", toChars()); -- if (!tempdecl) -- tempdecl = findTemplateDeclaration(sc); -- int multipleMatches = FALSE; -- for (TemplateDeclaration *td = tempdecl; td; td = td->overnext) -- { -- /* If any of the overloaded template declarations need inference, -- * then return TRUE -- */ -- FuncDeclaration *fd; -- if (!td->onemember || -- (fd = td->onemember/*->toAlias()*/->isFuncDeclaration()) == NULL || -- fd->type->ty != Tfunction) -- { -- /* Not a template function, therefore type inference is not possible. -- */ -- //printf("false\n"); -- return FALSE; -- } -- -- for (size_t i = 0; i < td->parameters->dim; i++) -- if ((*td->parameters)[i]->isTemplateThisParameter()) -- return TRUE; -- -- /* Determine if the instance arguments, tiargs, are all that is necessary -- * to instantiate the template. -- */ -- //printf("tp = %p, td->parameters->dim = %d, tiargs->dim = %d\n", tp, td->parameters->dim, tiargs->dim); -- TypeFunction *fdtype = (TypeFunction *)fd->type; -- if (Parameter::dim(fdtype->parameters)) -- { -- TemplateParameter *tp = td->isVariadic(); -- if (tp && td->parameters->dim > 1) -- return TRUE; -- -- if (tiargs->dim < td->parameters->dim) -- { // Can remain tiargs be filled by default arguments? -- for (size_t i = tiargs->dim; i < td->parameters->dim; i++) -- { tp = (*td->parameters)[i]; -- if (TemplateTypeParameter *ttp = tp->isTemplateTypeParameter()) -- { if (!ttp->defaultType) -- return TRUE; -- } -- else if (TemplateAliasParameter *tap = tp->isTemplateAliasParameter()) -- { if (!tap->defaultAlias) -- return TRUE; -- } -- else if (TemplateValueParameter *tvp = tp->isTemplateValueParameter()) -- { if (!tvp->defaultValue) -- return TRUE; -- } -- } -- } -- } -- /* If there is more than one function template which matches, we may -- * need type inference (see Bugzilla 4430) -- */ -- if (td != tempdecl) -- multipleMatches = TRUE; -- } -- //printf("false\n"); -- return multipleMatches; --} -- - void TemplateInstance::semantic2(Scope *sc) - { - if (semanticRun >= PASSsemantic2) -@@ -6110,6 +6822,7 @@ void TemplateInstance::semantic2(Scope * - sc = tempdecl->scope; - assert(sc); - sc = sc->push(argsym); -+ sc->instantiatingModule = instantiatingModule; - sc = sc->push(this); - sc->tinst = this; - for (size_t i = 0; i < members->dim; i++) -@@ -6141,17 +6854,19 @@ void TemplateInstance::semantic3(Scope * - { - sc = tempdecl->scope; - sc = sc->push(argsym); -+ sc->instantiatingModule = instantiatingModule; - sc = sc->push(this); - sc->tinst = this; -- int oldgag = global.gag; -+ int needGagging = (speculative && !global.gag); - int olderrors = global.errors; -+ int oldGaggedErrors; - /* If this is a speculative instantiation, gag errors. - * Future optimisation: If the results are actually needed, errors - * would already be gagged, so we don't really need to run semantic - * on the members. - */ -- if (speculative && !oldgag) -- olderrors = global.startGagging(); -+ if (needGagging) -+ oldGaggedErrors = global.startGagging(); - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *s = (*members)[i]; -@@ -6159,10 +6874,10 @@ void TemplateInstance::semantic3(Scope * - if (speculative && global.errors != olderrors) - break; - } -- if (speculative && !oldgag) -+ if (needGagging) - { // If errors occurred, this instantiation failed -- errors += global.errors - olderrors; -- global.endGagging(olderrors); -+ if (global.endGagging(oldGaggedErrors)) -+ errors = true; - } - sc = sc->pop(); - sc->pop(); -@@ -6265,23 +6980,57 @@ void TemplateInstance::toCBuffer(OutBuff - { - Identifier *id = name; - buf->writestring(id->toChars()); -- buf->writestring("!("); -+ toCBufferTiargs(buf, hgs); -+} -+ -+void TemplateInstance::toCBufferTiargs(OutBuffer *buf, HdrGenState *hgs) -+{ -+ buf->writeByte('!'); - if (nest) -- buf->writestring("..."); -+ buf->writestring("(...)"); -+ else if (!tiargs) -+ buf->writestring("()"); - else - { -+ if (tiargs->dim == 1) -+ { -+ RootObject *oarg = (*tiargs)[0]; -+ if (Type *t = isType(oarg)) -+ { -+ if (t->equals(Type::tstring) || -+ t->mod == 0 && -+ (t->isTypeBasic() || -+ t->ty == Tident && ((TypeIdentifier *)t)->idents.dim == 0)) -+ { -+ buf->writestring(t->toChars()); -+ return; -+ } -+ } -+ else if (Expression *e = isExpression(oarg)) -+ { -+ if (e->op == TOKint64 || // IntegerExp(10, true, false, 'c') -+ e->op == TOKfloat64 || // RealExp(3.14, 1.4i) -+ e->op == TOKnull || // NullExp -+ e->op == TOKstring || // StringExp -+ e->op == TOKthis) -+ { -+ buf->writestring(e->toChars()); -+ return; -+ } -+ } -+ } -+ buf->writeByte('('); - nest++; -- Objects *args = tiargs; -- for (size_t i = 0; i < args->dim; i++) -+ for (size_t i = 0; i < tiargs->dim; i++) - { - if (i) - buf->writestring(", "); -- Object *oarg = (*args)[i]; -+ RootObject *oarg = (*tiargs)[i]; - ObjectToCBuffer(buf, hgs, oarg); - } - nest--; -+ buf->writeByte(')'); - } -- buf->writeByte(')'); - } - - -@@ -6305,8 +7054,9 @@ Dsymbol *TemplateInstance::toAlias() - // inst = NULL; // trigger fwd ref error - } - if (!inst) -- { error("cannot resolve forward reference"); -- errors = 1; -+ { -+ error("cannot resolve forward reference"); -+ errors = true; - return this; - } - } -@@ -6332,10 +7082,10 @@ const char *TemplateInstance::kind() - return "template instance"; - } - --int TemplateInstance::oneMember(Dsymbol **ps, Identifier *ident) -+bool TemplateInstance::oneMember(Dsymbol **ps, Identifier *ident) - { - *ps = NULL; -- return TRUE; -+ return true; - } - - char *TemplateInstance::toChars() -@@ -6350,42 +7100,170 @@ char *TemplateInstance::toChars() - return s; - } - -+int TemplateInstance::compare(RootObject *o) -+{ -+ TemplateInstance *ti = (TemplateInstance *)o; -+ -+ //printf("this = %p, ti = %p\n", this, ti); -+ assert(tdtypes.dim == ti->tdtypes.dim); -+ -+ // Nesting must match -+ if (enclosing != ti->enclosing) -+ { -+ //printf("test2 enclosing %s ti->enclosing %s\n", enclosing ? enclosing->toChars() : "", ti->enclosing ? ti->enclosing->toChars() : ""); -+ goto Lnotequals; -+ } -+ //printf("parent = %s, ti->parent = %s\n", parent->toPrettyChars(), ti->parent->toPrettyChars()); -+ -+ if (!arrayObjectMatch(&tdtypes, &ti->tdtypes)) -+ goto Lnotequals; -+ -+ /* Template functions may have different instantiations based on -+ * "auto ref" parameters. -+ */ -+ if (fargs) -+ { -+ FuncDeclaration *fd = ti->toAlias()->isFuncDeclaration(); -+ if (fd) -+ { -+ Parameters *fparameters = fd->getParameters(NULL); -+ size_t nfparams = Parameter::dim(fparameters); // Num function parameters -+ for (size_t j = 0; j < nfparams && j < fargs->dim; j++) -+ { -+ Parameter *fparam = Parameter::getNth(fparameters, j); -+ Expression *farg = (*fargs)[j]; -+ if (Expression *e = farg->isTemp()) -+ farg = e; -+ if (fparam->storageClass & STCauto) // if "auto ref" -+ { -+ if (farg->isLvalue()) -+ { -+ if (!(fparam->storageClass & STCref)) -+ goto Lnotequals; // auto ref's don't match -+ } -+ else -+ { -+ if (fparam->storageClass & STCref) -+ goto Lnotequals; // auto ref's don't match -+ } -+ } -+ } -+ } -+ } -+ return 0; -+ -+ Lnotequals: -+ return 1; -+} -+ -+hash_t TemplateInstance::hashCode() -+{ -+ if (!hash) -+ { -+ hash = (size_t)(void *)enclosing; -+ hash += arrayObjectHash(&tdtypes); -+ } -+ return hash; -+} -+ -+ -+ - /* ======================== TemplateMixin ================================ */ - --TemplateMixin::TemplateMixin(Loc loc, Identifier *ident, Type *tqual, -- Identifiers *idents, Objects *tiargs) -- : TemplateInstance(loc, (*idents)[idents->dim - 1]) -+TemplateMixin::TemplateMixin(Loc loc, Identifier *ident, TypeQualified *tqual, Objects *tiargs) -+ : TemplateInstance(loc, tqual->idents.dim ? (Identifier *)tqual->idents[tqual->idents.dim - 1] -+ : ((TypeIdentifier *)tqual)->ident) - { - //printf("TemplateMixin(ident = '%s')\n", ident ? ident->toChars() : ""); - this->ident = ident; - this->tqual = tqual; -- this->idents = idents; - this->tiargs = tiargs ? tiargs : new Objects(); - } - - Dsymbol *TemplateMixin::syntaxCopy(Dsymbol *s) --{ TemplateMixin *tm; -+{ -+ TemplateMixin *tm = new TemplateMixin(loc, ident, -+ (TypeQualified *)tqual->syntaxCopy(), tiargs); -+ TemplateInstance::syntaxCopy(tm); -+ return tm; -+} - -- Identifiers *ids = new Identifiers(); -- ids->setDim(idents->dim); -- for (size_t i = 0; i < idents->dim; i++) -- { // Matches TypeQualified::syntaxCopyHelper() -- Identifier *id = (*idents)[i]; -- if (id->dyncast() == DYNCAST_DSYMBOL) -+bool TemplateMixin::findTemplateDeclaration(Scope *sc) -+{ -+ // Follow qualifications to find the TemplateDeclaration -+ if (!tempdecl) -+ { -+ Expression *e; -+ Type *t; -+ Dsymbol *s; -+ tqual->resolve(loc, sc, &e, &t, &s); -+ if (!s) - { -- TemplateInstance *ti = (TemplateInstance *)id; -+ error("is not defined"); -+ return false; -+ } -+ s = s->toAlias(); -+ tempdecl = s->isTemplateDeclaration(); -+ OverloadSet *os = s->isOverloadSet(); - -- ti = (TemplateInstance *)ti->syntaxCopy(NULL); -- id = (Identifier *)ti; -+ /* If an OverloadSet, look for a unique member that is a template declaration -+ */ -+ if (os) -+ { -+ Dsymbol *s = NULL; -+ for (size_t i = 0; i < os->a.dim; i++) -+ { -+ Dsymbol *s2 = os->a[i]->isTemplateDeclaration(); -+ if (s2) -+ { -+ if (s) -+ { -+ tempdecl = os; -+ break; -+ } -+ s = s2; -+ } -+ } -+ } -+ if (!tempdecl) -+ { -+ error("%s isn't a template", s->toChars()); -+ return false; - } -- (*ids)[i] = id; - } -+ assert(tempdecl); - -- tm = new TemplateMixin(loc, ident, -- (Type *)(tqual ? tqual->syntaxCopy() : NULL), -- ids, tiargs); -- TemplateInstance::syntaxCopy(tm); -- return tm; -+ struct ParamFwdResTm -+ { -+ static int fp(void *param, Dsymbol *s) -+ { -+ TemplateDeclaration *td = s->isTemplateDeclaration(); -+ if (!td) -+ return 0; -+ -+ TemplateMixin *tm = (TemplateMixin *)param; -+ if (td->semanticRun == PASSinit) -+ { -+ if (td->scope) -+ td->semantic(td->scope); -+ else -+ { -+ tm->semanticRun = PASSinit; -+ return 1; -+ } -+ } -+ return 0; -+ } -+ }; -+ // Look for forward references -+ OverloadSet *tovers = tempdecl->isOverloadSet(); -+ size_t overs_dim = tovers ? tovers->a.dim : 1; -+ for (size_t oi = 0; oi < overs_dim; oi++) -+ { -+ if (overloadApply(tovers ? tovers->a[oi] : tempdecl, (void *)this, &ParamFwdResTm::fp)) -+ return false; -+ } -+ return true; - } - - void TemplateMixin::semantic(Scope *sc) -@@ -6394,7 +7272,7 @@ void TemplateMixin::semantic(Scope *sc) - printf("+TemplateMixin::semantic('%s', this=%p)\n", toChars(), this); - fflush(stdout); - #endif -- if (semanticRun) -+ if (semanticRun != PASSinit) - { - // This for when a class/struct contains mixin members, and - // is done over because of forward references -@@ -6412,81 +7290,29 @@ void TemplateMixin::semantic(Scope *sc) - return; - } - } -- if (!semanticRun) -+ if (semanticRun == PASSinit) - semanticRun = PASSsemantic; - #if LOG - printf("\tdo semantic\n"); - #endif --#ifndef IN_GCC -- util_progress(); --#endif - - Scope *scx = NULL; - if (scope) -- { sc = scope; -+ { -+ sc = scope; - scx = scope; // save so we don't make redundant copies - scope = NULL; - } - -- // Follow qualifications to find the TemplateDeclaration -- if (!tempdecl) -- { Dsymbol *s; -- size_t i; -- Identifier *id; -- -- if (tqual) -- { s = tqual->toDsymbol(sc); -- i = 0; -- } -- else -- { -- i = 1; -- id = (*idents)[0]; -- switch (id->dyncast()) -- { -- case DYNCAST_IDENTIFIER: -- s = sc->search(loc, id, NULL); -- break; -- -- case DYNCAST_DSYMBOL: -- { -- TemplateInstance *ti = (TemplateInstance *)id; -- ti->semantic(sc); -- s = ti; -- break; -- } -- default: -- assert(0); -- } -- } -- -- for (; i < idents->dim; i++) -- { -- if (!s) -- break; -- id = (*idents)[i]; -- s = s->searchX(loc, sc, id); -- } -- if (!s) -- { -- error("is not defined"); -- inst = this; -- return; -- } -- tempdecl = s->toAlias()->isTemplateDeclaration(); -- if (!tempdecl) -- { -- error("%s isn't a template", s->toChars()); -- inst = this; -- return; -- } -- } - -- // Look for forward reference -- assert(tempdecl); -- for (TemplateDeclaration *td = tempdecl; td; td = td->overnext) -+ /* Run semantic on each argument, place results in tiargs[], -+ * then find best match template with tiargs -+ */ -+ if (!findTemplateDeclaration(sc) || -+ !semanticTiargs(sc) || -+ !findBestMatch(sc, NULL)) - { -- if (!td->semanticRun) -+ if (semanticRun == PASSinit) // forward reference had occured - { - /* Cannot handle forward references if mixin is a struct member, - * because addField must happen during struct's semantic, not -@@ -6494,7 +7320,6 @@ void TemplateMixin::semantic(Scope *sc) - * runDeferred will re-run mixin's semantic outside of the struct's - * semantic. - */ -- semanticRun = PASSinit; - AggregateDeclaration *ad = toParent()->isAggregateDeclaration(); - if (ad) - ad->sizeok = SIZEOKfwd; -@@ -6508,18 +7333,13 @@ void TemplateMixin::semantic(Scope *sc) - } - return; - } -- } -- -- // Run semantic on each argument, place results in tiargs[] -- semanticTiargs(sc); -- if (errors || arrayObjectIsError(tiargs)) -- return; - -- tempdecl = findBestMatch(sc, NULL); -- if (!tempdecl) -- { inst = this; -+ inst = this; -+ inst->errors = true; - return; // error recovery - } -+ TemplateDeclaration *tempdecl = this->tempdecl->isTemplateDeclaration(); -+ assert(tempdecl); - - if (!ident) - ident = genIdent(tiargs); -@@ -6542,11 +7362,12 @@ void TemplateMixin::semantic(Scope *sc) - continue; - - for (size_t i = 0; i < tiargs->dim; i++) -- { Object *o = (*tiargs)[i]; -+ { -+ RootObject *o = (*tiargs)[i]; - Type *ta = isType(o); - Expression *ea = isExpression(o); - Dsymbol *sa = isDsymbol(o); -- Object *tmo = (*tm->tiargs)[i]; -+ RootObject *tmo = (*tm->tiargs)[i]; - if (ta) - { - Type *tmta = isType(tmo); -@@ -6556,7 +7377,8 @@ void TemplateMixin::semantic(Scope *sc) - goto Lcontinue; - } - else if (ea) -- { Expression *tme = isExpression(tmo); -+ { -+ Expression *tme = isExpression(tmo); - if (!tme || !ea->equals(tme)) - goto Lcontinue; - } -@@ -6577,7 +7399,10 @@ void TemplateMixin::semantic(Scope *sc) - } - - // Copy the syntax trees from the TemplateDeclaration -- members = Dsymbol::arraySyntaxCopy(tempdecl->members); -+ if (scx && members) -+ {} // Don't copy again so they were previously created. -+ else -+ members = Dsymbol::arraySyntaxCopy(tempdecl->members); - if (!members) - return; - -@@ -6610,9 +7435,9 @@ void TemplateMixin::semantic(Scope *sc) - - // Add members to enclosing scope, as well as this scope - for (size_t i = 0; i < members->dim; i++) -- { Dsymbol *s = (*members)[i]; -+ { -+ Dsymbol *s = (*members)[i]; - s->addMember(argscope, this, i); -- //sc->insert(s); - //printf("sc->parent = %p, sc->scopesym = %p\n", sc->parent, sc->scopesym); - //printf("s->parent = %s\n", s->parent->toChars()); - } -@@ -6676,16 +7501,10 @@ void TemplateMixin::semantic(Scope *sc) - return; - } - -- /* The problem is when to parse the initializer for a variable. -- * Perhaps VarDeclaration::semantic() should do it like it does -- * for initializers inside a function. -- */ --// if (sc->parent->isFuncDeclaration()) -- -- semantic2(sc2); -- -- if (sc->func) -+ AggregateDeclaration *ad = toParent()->isAggregateDeclaration(); -+ if (sc->func && !ad) - { -+ semantic2(sc2); - semantic3(sc2); - } - -@@ -6696,13 +7515,9 @@ void TemplateMixin::semantic(Scope *sc) - } - - sc2->pop(); -- - argscope->pop(); -+ scy->pop(); - --// if (!isAnonymous()) -- { -- scy->pop(); -- } - #if LOG - printf("-TemplateMixin::semantic('%s', this=%p)\n", toChars(), this); - #endif -@@ -6748,6 +7563,7 @@ void TemplateMixin::semantic3(Scope *sc) - if (members) - { - sc = sc->push(argsym); -+ sc->instantiatingModule = instantiatingModule; - sc = sc->push(this); - for (size_t i = 0; i < members->dim; i++) - { -@@ -6769,7 +7585,7 @@ const char *TemplateMixin::kind() - return "mixin"; - } - --int TemplateMixin::oneMember(Dsymbol **ps, Identifier *ident) -+bool TemplateMixin::oneMember(Dsymbol **ps, Identifier *ident) - { - return Dsymbol::oneMember(ps, ident); - } -@@ -6790,21 +7606,23 @@ int TemplateMixin::apply(Dsymbol_apply_f - return 0; - } - --int TemplateMixin::hasPointers() -+bool TemplateMixin::hasPointers() - { - //printf("TemplateMixin::hasPointers() %s\n", toChars()); - - if (members) -+ { - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *s = (*members)[i]; - //printf(" s = %s %s\n", s->kind(), s->toChars()); - if (s->hasPointers()) - { -- return 1; -+ return true; - } - } -- return 0; -+ } -+ return false; - } - - void TemplateMixin::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion) -@@ -6838,43 +7656,9 @@ void TemplateMixin::toCBuffer(OutBuffer - { - buf->writestring("mixin "); - -- for (size_t i = 0; i < idents->dim; i++) -- { Identifier *id = (*idents)[i]; -+ tqual->toCBuffer(buf, NULL, hgs); -+ toCBufferTiargs(buf, hgs); - -- if (i) -- buf->writeByte('.'); -- buf->writestring(id->toChars()); -- } -- buf->writestring("!("); -- if (tiargs) -- { -- for (size_t i = 0; i < tiargs->dim; i++) -- { if (i) -- buf->writebyte(','); -- Object *oarg = (*tiargs)[i]; -- Type *t = isType(oarg); -- Expression *e = isExpression(oarg); -- Dsymbol *s = isDsymbol(oarg); -- if (t) -- t->toCBuffer(buf, NULL, hgs); -- else if (e) -- e->toCBuffer(buf, hgs); -- else if (s) -- { -- char *p = s->ident ? s->ident->toChars() : s->toChars(); -- buf->writestring(p); -- } -- else if (!oarg) -- { -- buf->writestring("NULL"); -- } -- else -- { -- assert(0); -- } -- } -- } -- buf->writebyte(')'); - if (ident) - { - buf->writebyte(' '); -@@ -6884,3 +7668,4 @@ void TemplateMixin::toCBuffer(OutBuffer - buf->writenl(); - } - -+ ---- a/src/gcc/d/dfrontend/template.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/template.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - - // Compiler implementation of the D programming language --// Copyright (c) 1999-2012 by Digital Mars -+// Copyright (c) 1999-2013 by Digital Mars - // All Rights Reserved - // written by Walter Bright - // http://www.digitalmars.com -@@ -21,51 +21,56 @@ - - - struct OutBuffer; --struct Identifier; --struct TemplateInstance; --struct TemplateParameter; --struct TemplateTypeParameter; --struct TemplateThisParameter; --struct TemplateValueParameter; --struct TemplateAliasParameter; --struct TemplateTupleParameter; --struct Type; --struct TypeTypeof; -+class Identifier; -+class TemplateInstance; -+class TemplateParameter; -+class TemplateTypeParameter; -+class TemplateThisParameter; -+class TemplateValueParameter; -+class TemplateAliasParameter; -+class TemplateTupleParameter; -+class Type; -+class TypeQualified; -+class TypeTypeof; - struct Scope; --struct Expression; --struct AliasDeclaration; --struct FuncDeclaration; -+class Expression; -+class AliasDeclaration; -+class FuncDeclaration; - struct HdrGenState; --struct Parameter; -+class Parameter; - enum MATCH; - enum PASS; - --struct Tuple : Object -+class Tuple : public RootObject - { -+public: - Objects objects; - - int dyncast() { return DYNCAST_TUPLE; } // kludge for template.isType() - }; - - --struct TemplateDeclaration : ScopeDsymbol -+class TemplateDeclaration : public ScopeDsymbol - { -+public: - TemplateParameters *parameters; // array of TemplateParameter's - - TemplateParameters *origParameters; // originals for Ddoc - Expression *constraint; -- TemplateInstances instances; // array of TemplateInstance's -+ -+ // Hash table to look up TemplateInstance's of this TemplateDeclaration -+ Array<TemplateInstances> buckets; -+ size_t numinstances; // number of instances in the hash table - - TemplateDeclaration *overnext; // next overloaded TemplateDeclaration - TemplateDeclaration *overroot; // first in overnext list -- -- enum PASS semanticRun; // 1 semantic() run -+ FuncDeclaration *funcroot; // first function in unified overload list - - Dsymbol *onemember; // if !=NULL then one member of this template - - int literal; // this template declaration is a literal - int ismixin; // template declaration is only to be used as a mixin -- enum PROT protection; -+ PROT protection; - - struct Previous - { Previous *prev; -@@ -78,7 +83,7 @@ struct TemplateDeclaration : ScopeDsymbo - Expression *constraint, Dsymbols *decldefs, int ismixin); - Dsymbol *syntaxCopy(Dsymbol *); - void semantic(Scope *sc); -- int overloadInsert(Dsymbol *s); -+ bool overloadInsert(Dsymbol *s); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); - bool hasStaticCtorOrDtor(); - const char *kind(); -@@ -86,26 +91,31 @@ struct TemplateDeclaration : ScopeDsymbo - - void emitComment(Scope *sc); - void toJson(JsonOut *json); -+ virtual void jsonProperties(JsonOut *json); -+ PROT prot(); - // void toDocBuffer(OutBuffer *buf); - -- MATCH matchWithInstance(TemplateInstance *ti, Objects *atypes, Expressions *fargs, int flag); -- MATCH leastAsSpecialized(TemplateDeclaration *td2, Expressions *fargs); -+ MATCH matchWithInstance(Scope *sc, TemplateInstance *ti, Objects *atypes, Expressions *fargs, int flag); -+ MATCH leastAsSpecialized(Scope *sc, TemplateDeclaration *td2, Expressions *fargs); - -- MATCH deduceFunctionTemplateMatch(Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, Objects *dedargs); -- FuncDeclaration *deduceFunctionTemplate(Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, int flags = 0); -- Object *declareParameter(Scope *sc, TemplateParameter *tp, Object *o); -- FuncDeclaration *doHeaderInstantiation(Scope *sc, Objects *tdargs, Expressions *fargs); -+ MATCH deduceFunctionTemplateMatch(FuncDeclaration *f, Loc loc, Scope *sc, Objects *tiargs, Type *tthis, Expressions *fargs, Objects *dedargs); -+ RootObject *declareParameter(Scope *sc, TemplateParameter *tp, RootObject *o); -+ FuncDeclaration *doHeaderInstantiation(Scope *sc, Objects *tdargs, Type *tthis, Expressions *fargs); -+ TemplateInstance *findExistingInstance(TemplateInstance *tithis, Expressions *fargs); -+ TemplateInstance *addInstance(TemplateInstance *ti); -+ void removeInstance(TemplateInstance *handle); - - TemplateDeclaration *isTemplateDeclaration() { return this; } - - TemplateTupleParameter *isVariadic(); -- int isOverloadable(); -+ bool isOverloadable(); - - void makeParamNamesVisibleInConstraint(Scope *paramscope, Expressions *fargs); - }; - --struct TemplateParameter -+class TemplateParameter - { -+public: - /* For type-parameter: - * template Foo(ident) // specType is set to NULL - * template Foo(ident : specType) -@@ -135,11 +145,11 @@ struct TemplateParameter - - virtual TemplateParameter *syntaxCopy() = 0; - virtual void declareParameter(Scope *sc) = 0; -- virtual void semantic(Scope *) = 0; -- virtual void print(Object *oarg, Object *oded) = 0; -+ virtual void semantic(Scope *sc, TemplateParameters *parameters) = 0; -+ virtual void print(RootObject *oarg, RootObject *oded) = 0; - virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0; -- virtual Object *specialization() = 0; -- virtual Object *defaultArg(Loc loc, Scope *sc) = 0; -+ virtual RootObject *specialization() = 0; -+ virtual RootObject *defaultArg(Loc loc, Scope *sc) = 0; - - /* If TemplateParameter's match as far as overloading goes. - */ -@@ -147,15 +157,17 @@ struct TemplateParameter - - /* Match actual argument against parameter. - */ -- virtual MATCH matchArg(Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam) = 0; -+ virtual MATCH matchArg(Loc loc, Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ virtual MATCH matchArg(Scope *sc, RootObject *oarg, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam) = 0; - - /* Create dummy argument based on parameter. - */ - virtual void *dummyArg() = 0; - }; - --struct TemplateTypeParameter : TemplateParameter -+class TemplateTypeParameter : public TemplateParameter - { -+public: - /* Syntax: - * ident : specType = defaultType - */ -@@ -169,19 +181,20 @@ struct TemplateTypeParameter : TemplateP - TemplateTypeParameter *isTemplateTypeParameter(); - TemplateParameter *syntaxCopy(); - void declareParameter(Scope *sc); -- void semantic(Scope *); -- void print(Object *oarg, Object *oded); -+ void semantic(Scope *sc, TemplateParameters *parameters); -+ void print(RootObject *oarg, RootObject *oded); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- Object *specialization(); -- Object *defaultArg(Loc loc, Scope *sc); -+ RootObject *specialization(); -+ RootObject *defaultArg(Loc loc, Scope *sc); - int overloadMatch(TemplateParameter *); -- MATCH matchArg(Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ MATCH matchArg(Scope *sc, RootObject *oarg, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); - void *dummyArg(); - }; - - #if DMDV2 --struct TemplateThisParameter : TemplateTypeParameter -+class TemplateThisParameter : public TemplateTypeParameter - { -+public: - /* Syntax: - * this ident : specType = defaultType - */ -@@ -194,8 +207,9 @@ struct TemplateThisParameter : TemplateT - }; - #endif - --struct TemplateValueParameter : TemplateParameter -+class TemplateValueParameter : public TemplateParameter - { -+public: - /* Syntax: - * valType ident : specValue = defaultValue - */ -@@ -211,45 +225,47 @@ struct TemplateValueParameter : Template - TemplateValueParameter *isTemplateValueParameter(); - TemplateParameter *syntaxCopy(); - void declareParameter(Scope *sc); -- void semantic(Scope *); -- void print(Object *oarg, Object *oded); -+ void semantic(Scope *sc, TemplateParameters *parameters); -+ void print(RootObject *oarg, RootObject *oded); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- Object *specialization(); -- Object *defaultArg(Loc loc, Scope *sc); -+ RootObject *specialization(); -+ RootObject *defaultArg(Loc loc, Scope *sc); - int overloadMatch(TemplateParameter *); -- MATCH matchArg(Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ MATCH matchArg(Scope *sc, RootObject *oarg, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); - void *dummyArg(); - }; - --struct TemplateAliasParameter : TemplateParameter -+class TemplateAliasParameter : public TemplateParameter - { -+public: - /* Syntax: - * specType ident : specAlias = defaultAlias - */ - - Type *specType; -- Object *specAlias; -- Object *defaultAlias; -+ RootObject *specAlias; -+ RootObject *defaultAlias; - - static Dsymbol *sdummy; - -- TemplateAliasParameter(Loc loc, Identifier *ident, Type *specType, Object *specAlias, Object *defaultAlias); -+ TemplateAliasParameter(Loc loc, Identifier *ident, Type *specType, RootObject *specAlias, RootObject *defaultAlias); - - TemplateAliasParameter *isTemplateAliasParameter(); - TemplateParameter *syntaxCopy(); - void declareParameter(Scope *sc); -- void semantic(Scope *); -- void print(Object *oarg, Object *oded); -+ void semantic(Scope *sc, TemplateParameters *parameters); -+ void print(RootObject *oarg, RootObject *oded); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- Object *specialization(); -- Object *defaultArg(Loc loc, Scope *sc); -+ RootObject *specialization(); -+ RootObject *defaultArg(Loc loc, Scope *sc); - int overloadMatch(TemplateParameter *); -- MATCH matchArg(Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ MATCH matchArg(Scope *sc, RootObject *oarg, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); - void *dummyArg(); - }; - --struct TemplateTupleParameter : TemplateParameter -+class TemplateTupleParameter : public TemplateParameter - { -+public: - /* Syntax: - * ident ... - */ -@@ -259,25 +275,26 @@ struct TemplateTupleParameter : Template - TemplateTupleParameter *isTemplateTupleParameter(); - TemplateParameter *syntaxCopy(); - void declareParameter(Scope *sc); -- void semantic(Scope *); -- void print(Object *oarg, Object *oded); -+ void semantic(Scope *sc, TemplateParameters *parameters); -+ void print(RootObject *oarg, RootObject *oded); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -- Object *specialization(); -- Object *defaultArg(Loc loc, Scope *sc); -+ RootObject *specialization(); -+ RootObject *defaultArg(Loc loc, Scope *sc); - int overloadMatch(TemplateParameter *); -- MATCH matchArg(Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ MATCH matchArg(Loc loc, Scope *sc, Objects *tiargs, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); -+ MATCH matchArg(Scope *sc, RootObject *oarg, size_t i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam); - void *dummyArg(); - }; - --struct TemplateInstance : ScopeDsymbol -+class TemplateInstance : public ScopeDsymbol - { -+public: - /* Given: - * foo!(args) => - * name = foo - * tiargs = args - */ - Identifier *name; -- //Identifiers idents; - Objects *tiargs; // Array of Types/Expressions of template - // instance arguments [int*, char, 10*10] - -@@ -285,25 +302,21 @@ struct TemplateInstance : ScopeDsymbol - // to TemplateDeclaration.parameters - // [int, char, 100] - -- TemplateDeclaration *tempdecl; // referenced by foo.bar.abc -+ Dsymbol *tempdecl; // referenced by foo.bar.abc - TemplateInstance *inst; // refer to existing instance - TemplateInstance *tinst; // enclosing template instance - ScopeDsymbol *argsym; // argument symbol table - AliasDeclaration *aliasdecl; // !=NULL if instance is an alias for its - // sole member - WithScopeSymbol *withsym; // if a member of a with statement -- enum PASS semanticRun; // has semantic() been done? -- int semantictiargsdone; // has semanticTiargs() been done? -- int nest; // for recursion detection -- int havetempdecl; // 1 if used second constructor -- Dsymbol *isnested; // if referencing local symbols, this is the context -- int speculative; // 1 if only instantiated with errors gagged --#ifdef IN_GCC -- /* On some targets, it is necessary to know whether a symbol -- will be emitted in the output or not before the symbol -- is used. This can be different from getModule(). */ -- Module * objFileModule; --#endif -+ int nest; // for recursion detection -+ bool semantictiargsdone; // has semanticTiargs() been done? -+ bool havetempdecl; // if used second constructor -+ bool speculative; // if only instantiated with errors gagged -+ Dsymbol *enclosing; // if referencing local symbols, this is the context -+ hash_t hash; // cached result of hashCode() -+ Expressions *fargs; // for function template, these are the function arguments -+ Module *instantiatingModule; // the top module that instantiated this instance - - TemplateInstance(Loc loc, Identifier *temp_id); - TemplateInstance(Loc loc, TemplateDeclaration *tempdecl, Objects *tiargs); -@@ -315,23 +328,28 @@ struct TemplateInstance : ScopeDsymbol - void semantic3(Scope *sc); - void inlineScan(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -+ void toCBufferTiargs(OutBuffer *buf, HdrGenState *hgs); - Dsymbol *toAlias(); // resolve real symbol - const char *kind(); -- int oneMember(Dsymbol **ps, Identifier *ident); -- int needsTypeInference(Scope *sc); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - char *toChars(); -- char *mangle(bool isv = false); -+ const char *mangle(bool isv = false); - void printInstantiationTrace(); -+ Identifier *getIdent(); -+ int compare(RootObject *o); -+ hash_t hashCode(); - - void toObjFile(int multiobj); // compile to .obj file - - // Internal -+ bool findTemplateDeclaration(Scope *sc); -+ bool updateTemplateDeclaration(Scope *sc, Dsymbol *s); - static void semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int flags); -- void semanticTiargs(Scope *sc); -- TemplateDeclaration *findTemplateDeclaration(Scope *sc); -- TemplateDeclaration *findBestMatch(Scope *sc, Expressions *fargs); -+ bool semanticTiargs(Scope *sc); -+ bool findBestMatch(Scope *sc, Expressions *fargs); -+ bool needsTypeInference(Scope *sc, int flag = 0); -+ bool hasNestedArgs(Objects *tiargs); - void declareParameters(Scope *sc); -- int hasNestedArgs(Objects *tiargs); - Identifier *genIdent(Objects *args); - void expandMembers(Scope *sc); - void tryExpandMembers(Scope *sc); -@@ -341,21 +359,21 @@ struct TemplateInstance : ScopeDsymbol - AliasDeclaration *isAliasDeclaration(); - }; - --struct TemplateMixin : TemplateInstance -+class TemplateMixin : public TemplateInstance - { -- Identifiers *idents; -- Type *tqual; -+public: -+ TypeQualified *tqual; - -- TemplateMixin(Loc loc, Identifier *ident, Type *tqual, Identifiers *idents, Objects *tiargs); -+ TemplateMixin(Loc loc, Identifier *ident, TypeQualified *tqual, Objects *tiargs); - Dsymbol *syntaxCopy(Dsymbol *s); - void semantic(Scope *sc); - void semantic2(Scope *sc); - void semantic3(Scope *sc); - void inlineScan(); - const char *kind(); -- int oneMember(Dsymbol **ps, Identifier *ident); -+ bool oneMember(Dsymbol **ps, Identifier *ident); - int apply(Dsymbol_apply_ft_t fp, void *param); -- int hasPointers(); -+ bool hasPointers(); - void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); - char *toChars(); - void toCBuffer(OutBuffer *buf, HdrGenState *hgs); -@@ -363,20 +381,22 @@ struct TemplateMixin : TemplateInstance - - void toObjFile(int multiobj); // compile to .obj file - -+ bool findTemplateDeclaration(Scope *sc); -+ - TemplateMixin *isTemplateMixin() { return this; } - }; - --Expression *isExpression(Object *o); --Dsymbol *isDsymbol(Object *o); --Type *isType(Object *o); --Tuple *isTuple(Object *o); --Parameter *isParameter(Object *o); -+Expression *isExpression(RootObject *o); -+Dsymbol *isDsymbol(RootObject *o); -+Type *isType(RootObject *o); -+Tuple *isTuple(RootObject *o); -+Parameter *isParameter(RootObject *o); - int arrayObjectIsError(Objects *args); --int isError(Object *o); --Type *getType(Object *o); --Dsymbol *getDsymbol(Object *o); -+int isError(RootObject *o); -+Type *getType(RootObject *o); -+Dsymbol *getDsymbol(RootObject *o); - --void ObjectToCBuffer(OutBuffer *buf, HdrGenState *hgs, Object *oarg); --Object *objectSyntaxCopy(Object *o); -+void ObjectToCBuffer(OutBuffer *buf, HdrGenState *hgs, RootObject *oarg); -+RootObject *objectSyntaxCopy(RootObject *o); - - #endif /* DMD_TEMPLATE_H */ ---- a/src/gcc/d/dfrontend/traits.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/traits.c 2014-04-01 16:32:51.000000000 +0100 -@@ -15,6 +15,7 @@ - #include <math.h> - - #include "rmem.h" -+#include "aav.h" - - //#include "port.h" - #include "mtype.h" -@@ -51,9 +52,13 @@ struct Ptrait - Identifier *ident; // which trait we're looking for - }; - --static int fptraits(void *param, FuncDeclaration *f) --{ Ptrait *p = (Ptrait *)param; -+static int fptraits(void *param, Dsymbol *s) -+{ -+ FuncDeclaration *f = s->isFuncDeclaration(); -+ if (!f) -+ return 0; - -+ Ptrait *p = (Ptrait *)param; - if (p->ident == Id::getVirtualFunctions && !f->isVirtual()) - return 0; - -@@ -61,14 +66,62 @@ static int fptraits(void *param, FuncDec - return 0; - - Expression *e; -+ FuncAliasDeclaration* alias = new FuncAliasDeclaration(f, 0); -+ alias->protection = f->protection; - if (p->e1) -- e = new DotVarExp(0, p->e1, new FuncAliasDeclaration(f, 0)); -+ e = new DotVarExp(Loc(), p->e1, alias); - else -- e = new DsymbolExp(0, new FuncAliasDeclaration(f, 0)); -+ e = new DsymbolExp(Loc(), alias); - p->exps->push(e); - return 0; - } - -+/** -+ * Collects all unit test functions from the given array of symbols. -+ * -+ * This is a helper function used by the implementation of __traits(getUnitTests). -+ * -+ * Input: -+ * symbols array of symbols to collect the functions from -+ * uniqueUnitTests an associative array (should actually be a set) to -+ * keep track of already collected functions. We're -+ * using an AA here to avoid doing a linear search of unitTests -+ * -+ * Output: -+ * unitTests array of DsymbolExp's of the collected unit test functions -+ * uniqueUnitTests updated with symbols from unitTests[ ] -+ */ -+static void collectUnitTests(Dsymbols *symbols, AA *uniqueUnitTests, Expressions *unitTests) -+{ -+ for (size_t i = 0; i < symbols->dim; i++) -+ { -+ Dsymbol *symbol = (*symbols)[i]; -+ UnitTestDeclaration *unitTest = symbol->isUnitTestDeclaration(); -+ if (unitTest) -+ { -+ if (!_aaGetRvalue(uniqueUnitTests, unitTest)) -+ { -+ FuncAliasDeclaration* alias = new FuncAliasDeclaration(unitTest, 0); -+ alias->protection = unitTest->protection; -+ Expression* e = new DsymbolExp(Loc(), alias); -+ unitTests->push(e); -+ bool* value = (bool*) _aaGet(&uniqueUnitTests, unitTest); -+ *value = true; -+ } -+ } -+ else -+ { -+ AttribDeclaration *attrDecl = symbol->isAttribDeclaration(); -+ -+ if (attrDecl) -+ { -+ Dsymbols *decl = attrDecl->include(NULL, NULL); -+ collectUnitTests(decl, uniqueUnitTests, unitTests); -+ } -+ } -+ } -+} -+ - /************************ TraitsExp ************************************/ - - Expression *TraitsExp::semantic(Scope *sc) -@@ -77,7 +130,7 @@ Expression *TraitsExp::semantic(Scope *s - printf("TraitsExp::semantic() %s\n", toChars()); - #endif - if (ident != Id::compiles && ident != Id::isSame && -- ident != Id::identifier) -+ ident != Id::identifier && ident != Id::getProtection) - { - TemplateInstance::semanticTiargs(loc, sc, args, 1); - } -@@ -150,7 +203,7 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Type *t = isType(o); - StructDeclaration *sd; - if (!t) -@@ -168,6 +221,34 @@ Expression *TraitsExp::semantic(Scope *s - } - goto Ltrue; - } -+ else if (ident == Id::isNested) -+ { -+ if (dim != 1) -+ goto Ldimerror; -+ RootObject *o = (*args)[0]; -+ Dsymbol *s = getDsymbol(o); -+ AggregateDeclaration *a; -+ FuncDeclaration *f; -+ -+ if (!s) { } -+ else if ((a = s->isAggregateDeclaration()) != NULL) -+ { -+ if (a->isNested()) -+ goto Ltrue; -+ else -+ goto Lfalse; -+ } -+ else if ((f = s->isFuncDeclaration()) != NULL) -+ { -+ if (f->isNested()) -+ goto Ltrue; -+ else -+ goto Lfalse; -+ } -+ -+ error("aggregate or function expected instead of '%s'", o->toChars()); -+ goto Lfalse; -+ } - else if (ident == Id::isAbstractFunction) - { - FuncDeclaration *f; -@@ -186,7 +267,7 @@ Expression *TraitsExp::semantic(Scope *s - else if (ident == Id::isFinalFunction) - { - FuncDeclaration *f; -- ISDSYMBOL((f = s->isFuncDeclaration()) != NULL && f->isFinal()) -+ ISDSYMBOL((f = s->isFuncDeclaration()) != NULL && f->isFinalFunc()) - } - #if DMDV2 - else if (ident == Id::isStaticFunction) -@@ -217,7 +298,7 @@ Expression *TraitsExp::semantic(Scope *s - - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Parameter *po = isParameter(o); - Identifier *id; - if (po) -@@ -241,7 +322,13 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ -+ Scope *sc2 = sc->push(); -+ sc2->flags = sc->flags | SCOPEnoaccesscheck; -+ TemplateInstance::semanticTiargs(loc, sc2, args, 1); -+ sc2->pop(); -+ -+ RootObject *o = (*args)[0]; - Dsymbol *s = getDsymbol(o); - if (!s) - { -@@ -249,11 +336,13 @@ Expression *TraitsExp::semantic(Scope *s - error("argument %s has no protection", o->toChars()); - goto Lfalse; - } -- -+ if (s->scope) -+ s->semantic(s->scope); - PROT protection = s->prot(); - - const char *protName = Pprotectionnames[protection]; - -+ assert(protName); - StringExp *se = new StringExp(loc, (char *) protName); - return se->semantic(sc); - } -@@ -261,7 +350,7 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Dsymbol *s = getDsymbol(o); - if (s) - { -@@ -286,7 +375,7 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 2) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Expression *e = isExpression((*args)[1]); - if (!e) - { error("expression expected as second argument of __traits %s", ident->toChars()); -@@ -305,17 +394,17 @@ Expression *TraitsExp::semantic(Scope *s - } - Identifier *id = Lexer::idPool((char *)se->string); - -- Type *t = isType(o); -- e = isExpression(o); -- Dsymbol *s = isDsymbol(o); -- if (t) -- e = typeDotIdExp(loc, t, id); -- else if (e) -- e = new DotIdExp(loc, e, id); -- else if (s) -- { e = new DsymbolExp(loc, s); -+ /* Prefer dsymbol, because it might need some runtime contexts. -+ */ -+ Dsymbol *sym = getDsymbol(o); -+ if (sym) -+ { e = new DsymbolExp(loc, sym); - e = new DotIdExp(loc, e, id); - } -+ else if (Type *t = isType(o)) -+ e = typeDotIdExp(loc, t, id); -+ else if (Expression *ex = isExpression(o)) -+ e = new DotIdExp(loc, ex, id); - else - { error("invalid first argument"); - goto Lfalse; -@@ -323,21 +412,16 @@ Expression *TraitsExp::semantic(Scope *s - - if (ident == Id::hasMember) - { -- if (t) -+ if (sym) - { -- Dsymbol *sym = t->toDsymbol(sc); -- if (sym) -- { -- Dsymbol *sm = sym->search(loc, id, 0); -- if (sm) -- goto Ltrue; -- } -+ Dsymbol *sm = sym->search(loc, id, 0); -+ if (sm) -+ goto Ltrue; - } - - /* Take any errors as meaning it wasn't found - */ - Scope *sc2 = sc->push(); -- //sc2->inHasMember++; - e = e->trySemantic(sc2); - sc2->pop(); - if (!e) -@@ -384,7 +468,7 @@ Expression *TraitsExp::semantic(Scope *s - p.exps = exps; - p.e1 = e; - p.ident = ident; -- overloadApply(f, fptraits, &p); -+ overloadApply(f, &p, &fptraits); - - TupleExp *tup = new TupleExp(loc, exps); - return tup->semantic(sc); -@@ -396,7 +480,7 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Dsymbol *s = getDsymbol(o); - ClassDeclaration *cd; - if (!s || (cd = s->isClassDeclaration()) == NULL) -@@ -410,10 +494,16 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Dsymbol *s = getDsymbol(o); - if (!s) - { -+ #if 0 -+ Expression *e = isExpression(o); -+ Type *t = isType(o); -+ if (e) printf("e = %s %s\n", Token::toChars(e->op), e->toChars()); -+ if (t) printf("t = %d %s\n", t->ty, t->toChars()); -+ #endif - error("first argument is not a symbol"); - goto Lfalse; - } -@@ -427,7 +517,7 @@ Expression *TraitsExp::semantic(Scope *s - { - if (dim != 1) - goto Ldimerror; -- Object *o = (*args)[0]; -+ RootObject *o = (*args)[0]; - Dsymbol *s = getDsymbol(o); - ScopeDsymbol *sd; - if (!s) -@@ -435,7 +525,12 @@ Expression *TraitsExp::semantic(Scope *s - error("argument has no members"); - goto Lfalse; - } -- if ((sd = s->isScopeDsymbol()) == NULL) -+ Import *import; -+ if ((import = s->isImport()) != NULL) -+ { // Bugzilla 9692 -+ sd = import->mod; -+ } -+ else if ((sd = s->isScopeDsymbol()) == NULL) - { - error("%s %s has no members", s->kind(), s->toChars()); - goto Lfalse; -@@ -451,6 +546,14 @@ Expression *TraitsExp::semantic(Scope *s - //printf("\t[%i] %s %s\n", i, sm->kind(), sm->toChars()); - if (sm->ident) - { -+ if (sm->ident != Id::ctor && // backword compatibility -+ sm->ident != Id::dtor && // backword compatibility -+ sm->ident != Id::_postblit && // backword compatibility -+ memcmp(sm->ident->string, "__", 2) == 0) -+ { -+ return 0; -+ } -+ - //printf("\t%s\n", sm->ident->toChars()); - Identifiers *idents = (Identifiers *)ctx; - -@@ -468,6 +571,14 @@ Expression *TraitsExp::semantic(Scope *s - - idents->push(sm->ident); - } -+ else -+ { -+ EnumDeclaration *ed = sm->isEnumDeclaration(); -+ if (ed) -+ { -+ ScopeDsymbol::foreach(NULL, ed->members, &PushIdentsDg::dg, (Identifiers *)ctx); -+ } -+ } - return 0; - } - }; -@@ -525,37 +636,42 @@ Expression *TraitsExp::semantic(Scope *s - goto Lfalse; - - for (size_t i = 0; i < dim; i++) -- { Object *o = (*args)[i]; -- Expression *e; -- -+ { - unsigned errors = global.startGagging(); - unsigned oldspec = global.speculativeGag; - global.speculativeGag = global.gag; -- bool scSpec = sc->speculative; -+ sc = sc->push(); - sc->speculative = true; -+ sc->flags = sc->enclosing->flags & ~SCOPEctfe; // inherit without CTFEing -+ bool err = false; - -+ RootObject *o = (*args)[i]; - Type *t = isType(o); -- if (t) -- { Dsymbol *s; -+ Expression *e = t ? t->toExpression() : isExpression(o); -+ if (!e && t) -+ { -+ Dsymbol *s; - t->resolve(loc, sc, &e, &t, &s); - if (t) -+ { - t->semantic(loc, sc); -- else if (e) -- { e = e->semantic(sc); -- e = e->optimize(WANTvalue); -+ if (t->ty == Terror) -+ err = true; - } -+ else if (s && s->errors) -+ err = true; - } -- else -- { e = isExpression(o); -- if (e) -- { e = e->semantic(sc); -- e = e->optimize(WANTvalue); -- } -+ if (e) -+ { -+ e = e->semantic(sc); -+ e = e->optimize(WANTvalue); -+ if (e->op == TOKerror) -+ err = true; - } - -- sc->speculative = scSpec; -+ sc = sc->pop(); - global.speculativeGag = oldspec; -- if (global.endGagging(errors)) -+ if (global.endGagging(errors) || err) - { - goto Lfalse; - } -@@ -568,8 +684,8 @@ Expression *TraitsExp::semantic(Scope *s - if (dim != 2) - goto Ldimerror; - TemplateInstance::semanticTiargs(loc, sc, args, 0); -- Object *o1 = (*args)[0]; -- Object *o2 = (*args)[1]; -+ RootObject *o1 = (*args)[0]; -+ RootObject *o2 = (*args)[1]; - Dsymbol *s1 = getDsymbol(o1); - Dsymbol *s2 = getDsymbol(o2); - -@@ -615,6 +731,64 @@ Expression *TraitsExp::semantic(Scope *s - else - goto Lfalse; - } -+ else if (ident == Id::getUnitTests) -+ { -+ if (dim != 1) -+ goto Ldimerror; -+ RootObject *o = (*args)[0]; -+ Dsymbol *s = getDsymbol(o); -+ if (!s) -+ { -+ error("argument %s to __traits(getUnitTests) must be a module or aggregate", o->toChars()); -+ goto Lfalse; -+ } -+ -+ Import *imp = s->isImport(); -+ if (imp) // Bugzilla 10990 -+ s = imp->mod; -+ -+ ScopeDsymbol* scope = s->isScopeDsymbol(); -+ -+ if (!scope) -+ { -+ error("argument %s to __traits(getUnitTests) must be a module or aggregate, not a %s", s->toChars(), s->kind()); -+ goto Lfalse; -+ } -+ -+ Expressions* unitTests = new Expressions(); -+ Dsymbols* symbols = scope->members; -+ -+ if (global.params.useUnitTests && symbols) -+ { -+ // Should actually be a set -+ AA* uniqueUnitTests = NULL; -+ collectUnitTests(symbols, uniqueUnitTests, unitTests); -+ } -+ -+ TupleExp *tup = new TupleExp(loc, unitTests); -+ return tup->semantic(sc); -+ } -+ else if (ident == Id::isOverrideFunction) -+ { -+ FuncDeclaration *f; -+ ISDSYMBOL((f = s->isFuncDeclaration()) != NULL && f->isOverride()) -+ } -+ else if(ident == Id::getVirtualIndex) -+ { -+ if (dim != 1) -+ goto Ldimerror; -+ RootObject *o = (*args)[0]; -+ Dsymbol *s = getDsymbol(o); -+ FuncDeclaration *fd; -+ if (!s || (fd = s->isFuncDeclaration()) == NULL) -+ { -+ error("first argument to __traits(getVirtualIndex) must be a function"); -+ goto Lfalse; -+ } -+ fd = fd->toAliasFunc(); // Neccessary to support multiple overloads. -+ ptrdiff_t result = fd->isVirtual() ? fd->vtblIndex : -1; -+ return new IntegerExp(loc, fd->vtblIndex, Type::tptrdiff_t); -+ } - else - { error("unrecognized trait %s", ident->toChars()); - goto Lfalse; -@@ -623,7 +797,7 @@ Expression *TraitsExp::semantic(Scope *s - return NULL; - - Ldimerror: -- error("wrong number of arguments %d", dim); -+ error("wrong number of arguments %d", (int)dim); - goto Lfalse; - - -@@ -634,5 +808,4 @@ Ltrue: - return new IntegerExp(loc, 1, Type::tbool); - } - -- - #endif ---- a/src/gcc/d/dfrontend/utf.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/utf.c 2014-04-01 16:32:51.000000000 +0100 -@@ -19,9 +19,6 @@ - - #include "utf.h" - --namespace --{ -- - /* The following encodings are valid, except for the 5 and 6 byte - * combinations: - * 0xxxxxxx -@@ -51,11 +48,6 @@ const unsigned UTF8_STRIDE[256] = - 4,4,4,4,4,4,4,4,5,5,5,5,6,6,0xFF,0xFF, - }; - --} // namespace -- --namespace Unicode --{ -- - // UTF-8 decoding errors - char const UTF8_DECODE_OUTSIDE_CODE_SPACE[] = "Outside Unicode code space"; - char const UTF8_DECODE_TRUNCATED_SEQUENCE[] = "Truncated UTF-8 sequence"; -@@ -69,10 +61,6 @@ char const UTF16_DECODE_INVALID_SURROGAT - char const UTF16_DECODE_UNPAIRED_SURROGATE[]= "Unpaired surrogate"; - char const UTF16_DECODE_INVALID_CODE_POINT[]= "Invalid code point decoded"; - --} // namespace Unicode -- --using namespace Unicode; -- - /// The Unicode code space is the range of code points [0x000000,0x10FFFF] - /// except the UTF-16 surrogate pairs in the range [0xD800,0xDFFF] - /// and non-characters (which end in 0xFFFE or 0xFFFF). ---- a/src/gcc/d/dfrontend/utf.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/utf.h 2014-04-01 16:32:51.000000000 +0100 -@@ -20,9 +20,6 @@ typedef unsigned short utf16_t; - typedef unsigned int utf32_t; - typedef utf32_t dchar_t; - --namespace Unicode --{ -- - static utf16_t const ALPHA_TABLE[][2] = - { - { 0x00AA, 0x00AA }, { 0x00B5, 0x00B5 }, { 0x00B7, 0x00B7 }, { 0x00BA, 0x00BA }, -@@ -102,8 +99,6 @@ extern char const UTF16_DECODE_INVALID_S - extern char const UTF16_DECODE_UNPAIRED_SURROGATE[]; - extern char const UTF16_DECODE_INVALID_CODE_POINT[]; - --} // namespace Unicode -- - /// \return true if \a c is a valid, non-private UTF-32 code point - bool utf_isValidDchar(dchar_t c); - ---- a/src/gcc/d/dfrontend/version.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/version.c 2014-04-01 16:32:51.000000000 +0100 -@@ -57,11 +57,17 @@ int DebugSymbol::addMember(Scope *sc, Sc - if (ident) - { - if (!m) -+ { - error("declaration must be at module level"); -+ errors = true; -+ } - else - { - if (findCondition(m->debugidsNot, ident)) -+ { - error("defined after use"); -+ errors = true; -+ } - if (!m->debugids) - m->debugids = new Strings(); - m->debugids->push(ident->toChars()); -@@ -70,7 +76,10 @@ int DebugSymbol::addMember(Scope *sc, Sc - else - { - if (!m) -+ { - error("level declaration must be at module level"); -+ errors = true; -+ } - else - m->debuglevel = level; - } -@@ -138,11 +147,17 @@ int VersionSymbol::addMember(Scope *sc, - { - VersionCondition::checkPredefined(loc, ident->toChars()); - if (!m) -+ { - error("declaration must be at module level"); -+ errors = true; -+ } - else - { - if (findCondition(m->versionidsNot, ident)) -+ { - error("defined after use"); -+ errors = true; -+ } - if (!m->versionids) - m->versionids = new Strings(); - m->versionids->push(ident->toChars()); -@@ -151,7 +166,10 @@ int VersionSymbol::addMember(Scope *sc, - else - { - if (!m) -+ { - error("level declaration must be at module level"); -+ errors = true; -+ } - else - m->versionlevel = level; - } ---- a/src/gcc/d/dfrontend/version.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/dfrontend/version.h 2014-04-01 16:32:51.000000000 +0100 -@@ -20,8 +20,9 @@ - struct OutBuffer; - struct HdrGenState; - --struct DebugSymbol : Dsymbol -+class DebugSymbol : public Dsymbol - { -+public: - unsigned level; - - DebugSymbol(Loc loc, Identifier *ident); -@@ -34,8 +35,9 @@ struct DebugSymbol : Dsymbol - const char *kind(); - }; - --struct VersionSymbol : Dsymbol -+class VersionSymbol : public Dsymbol - { -+public: - unsigned level; - - VersionSymbol(Loc loc, Identifier *ident); ---- a/src/gcc/d/d-glue.cc 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/d-glue.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,373 @@ -+// d-glue.cc -- D frontend for GCC. -+// Copyright (C) 2013 Free Software Foundation, Inc. -+ -+// GCC is free software; you can redistribute it and/or modify it under -+// the terms of the GNU General Public License as published by the Free -+// Software Foundation; either version 3, or (at your option) any later -+// version. -+ -+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+// WARRANTY; without even the implied warranty of MERCHANTABILITY or -+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+// for more details. -+ -+// You should have received a copy of the GNU General Public License -+// along with GCC; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+#include "d-system.h" -+#include "d-objfile.h" -+ -+#include "mars.h" -+#include "module.h" -+ -+Global global; -+ -+void -+Global::init (void) -+{ -+ this->mars_ext = "d"; -+ this->sym_ext = "d"; -+ this->hdr_ext = "di"; -+ this->doc_ext = "html"; -+ this->ddoc_ext = "ddoc"; -+ this->json_ext = "json"; -+ this->map_ext = "map"; -+ -+ this->obj_ext = "o"; -+ this->lib_ext = "a"; -+ this->dll_ext = "so"; -+ -+ this->version = "v" -+#include "verstr.h" -+ ; -+ -+ this->compiler.vendor = "GNU D"; -+ this->stdmsg = stdout; -+ this->main_d = "__main.d"; -+ -+ memset (&this->params, 0, sizeof (Param)); -+} -+ -+unsigned -+Global::startGagging (void) -+{ -+ this->gag++; -+ return this->gaggedErrors; -+} -+ -+bool -+Global::endGagging (unsigned oldGagged) -+{ -+ bool anyErrs = (this->gaggedErrors != oldGagged); -+ this->gag--; -+ -+ // Restore the original state of gagged errors; set total errors -+ // to be original errors + new ungagged errors. -+ this->errors -= (this->gaggedErrors - oldGagged); -+ this->gaggedErrors = oldGagged; -+ -+ return anyErrs; -+} -+ -+bool -+Global::isSpeculativeGagging (void) -+{ -+ if (!this->gag) -+ return false; -+ -+ if (this->gag != this->speculativeGag) -+ return false; -+ -+ return true; -+} -+ -+void -+Global::increaseErrorCount (void) -+{ -+ if (gag) -+ this->gaggedErrors++; -+ -+ this->errors++; -+} -+ -+Ungag -+Dsymbol::ungagSpeculative (void) -+{ -+ unsigned oldgag = global.gag; -+ -+ if (global.isSpeculativeGagging() && !isSpeculative()) -+ global.gag = 0; -+ -+ return Ungag (oldgag); -+} -+ -+Ungag::~Ungag (void) -+{ -+ global.gag = this->oldgag; -+} -+ -+ -+char * -+Loc::toChars (void) -+{ -+ OutBuffer buf; -+ -+ if (this->filename) -+ buf.printf ("%s", this->filename); -+ -+ if (this->linnum) -+ buf.printf (":%u", this->linnum); -+ -+ buf.writeByte (0); -+ -+ return (char *)buf.extractData(); -+} -+ -+Loc::Loc (Module *mod, unsigned linnum) -+{ -+ this->linnum = linnum; -+ this->filename = mod ? mod->srcfile->toChars() : NULL; -+} -+ -+bool -+Loc::equals (const Loc& loc) -+{ -+ if (this->linnum != loc.linnum) -+ return false; -+ -+ if (!FileName::equals (this->filename, loc.filename)) -+ return false; -+ -+ return true; -+} -+ -+ -+// Print a hard error message. -+ -+void -+error (Loc loc, const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ verror (loc, format, ap); -+ va_end (ap); -+} -+ -+void -+error (const char *filename, unsigned linnum, const char *format, ...) -+{ -+ Loc loc; -+ va_list ap; -+ -+ loc.filename = CONST_CAST (char *, filename); -+ loc.linnum = linnum; -+ -+ va_start (ap, format); -+ verror (loc, format, ap); -+ va_end (ap); -+} -+ -+void -+verror (Loc loc, const char *format, va_list ap, -+ const char *p1, const char *p2, const char *) -+{ -+ if (!global.gag) -+ { -+ location_t location = get_linemap (loc); -+ char *msg; -+ -+ // Build string and emit. -+ if (p2) -+ format = concat (p2, " ", format, NULL); -+ -+ if (p1) -+ format = concat (p1, " ", format, NULL); -+ -+ if (vasprintf (&msg, format, ap) >= 0 && msg != NULL) -+ error_at (location, "%s", msg); -+ -+ // Moderate blizzard of cascading messages -+ if (global.errors >= 20) -+ fatal(); -+ } -+ else -+ global.gaggedErrors++; -+ -+ global.errors++; -+} -+ -+// Print supplementary message about the last error. -+// Doesn't increase error count. -+ -+void -+errorSupplemental (Loc loc, const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ verrorSupplemental (loc, format, ap); -+ va_end (ap); -+} -+ -+void -+verrorSupplemental (Loc loc, const char *format, va_list ap) -+{ -+ if (!global.gag) -+ { -+ location_t location = get_linemap (loc); -+ char *msg; -+ -+ if (vasprintf (&msg, format, ap) >= 0 && msg != NULL) -+ inform (location, "%s", msg); -+ } -+} -+ -+// Print a warning message. -+ -+void -+warning (Loc loc, const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ vwarning (loc, format, ap); -+ va_end (ap); -+} -+ -+void -+vwarning (Loc loc, const char *format, va_list ap) -+{ -+ if (global.params.warnings && !global.gag) -+ { -+ location_t location = get_linemap (loc); -+ char *msg; -+ -+ if (vasprintf (&msg, format, ap) >= 0 && msg != NULL) -+ warning_at (location, 0, "%s", msg); -+ -+ // Warnings don't count if gagged. -+ if (global.params.warnings == 1) -+ global.warnings++; -+ } -+} -+ -+// Print a deprecation message. -+ -+void -+deprecation (Loc loc, const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ vdeprecation (loc, format, ap); -+ va_end (ap); -+} -+ -+void -+vdeprecation (Loc loc, const char *format, va_list ap, -+ const char *p1, const char *p2) -+{ -+ if (global.params.useDeprecated == 0) -+ verror (loc, format, ap, p1, p2); -+ else if (global.params.useDeprecated == 2 && !global.gag) -+ { -+ location_t location = get_linemap (loc); -+ char *msg; -+ -+ // Build string and emit. -+ if (p2) -+ format = concat (p2, " ", format, NULL); -+ -+ if (p1) -+ format = concat (p1, " ", format, NULL); -+ -+ if (vasprintf (&msg, format, ap) >= 0 && msg != NULL) -+ warning_at (location, OPT_Wdeprecated, "%s", msg); -+ } -+} -+ -+// Call this after printing out fatal error messages to clean up and exit -+// the compiler. -+ -+void -+fatal (void) -+{ -+ exit (FATAL_EXIT_CODE); -+} -+ -+ -+void -+escapePath (OutBuffer *buf, const char *fname) -+{ -+ while (1) -+ { -+ switch (*fname) -+ { -+ case 0: -+ return; -+ -+ case '(': -+ case ')': -+ case '\\': -+ buf->writebyte('\\'); -+ -+ default: -+ buf->writebyte(*fname); -+ break; -+ } -+ fname++; -+ } -+} -+ -+void -+readFile (Loc loc, File *f) -+{ -+ if (f->read()) -+ { -+ error (loc, "Error reading file '%s'", f->name->toChars()); -+ fatal(); -+ } -+} -+ -+void -+writeFile (Loc loc, File *f) -+{ -+ if (f->write()) -+ { -+ error (loc, "Error writing file '%s'", f->name->toChars()); -+ fatal(); -+ } -+} -+ -+void -+ensurePathToNameExists (Loc loc, const char *name) -+{ -+ const char *pt = FileName::path (name); -+ if (*pt) -+ { -+ if (FileName::ensurePathExists(pt)) -+ { -+ error (loc, "cannot create directory %s", pt); -+ fatal(); -+ } -+ } -+} -+ -+// Binary search for P in TAB between the range 0 to HIGH. -+ -+int binary(const char *p , const char **tab, int high) -+{ -+ int low = 0; -+ do -+ { -+ int pos = (low + high) / 2; -+ int cmp = strcmp(p, tab[pos]); -+ if (! cmp) -+ return pos; -+ else if (cmp < 0) -+ high = pos; -+ else -+ low = pos + 1; -+ } while (low != high); -+ -+ return -1; -+} -+ ---- a/src/gcc/d/d-gt.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-gt.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* d-gt.c -- D frontend for GCC. -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free ---- a/src/gcc/d/d-incpath.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-incpath.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-incpath.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -145,8 +145,8 @@ add_import_path (Strings *paths) - - for (size_t i = 0; i < paths->dim; i++) - { -- String p = (*paths)[i]; -- char *target_dir = make_absolute (p.toChars()); -+ char *path = (*paths)[i]; -+ char *target_dir = make_absolute (path); - - if (!FileName::exists (target_dir)) - { -@@ -171,8 +171,8 @@ add_fileimp_path (Strings *paths) - - for (size_t i = 0; i < paths->dim; i++) - { -- String p = (*paths)[i]; -- char *target_dir = make_absolute (p.toChars()); -+ char *path = (*paths)[i]; -+ char *target_dir = make_absolute (path); - - if (!FileName::exists (target_dir)) - { ---- a/src/gcc/d/d-ir.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-ir.cc 1970-01-01 01:00:00.000000000 +0100 -@@ -1,549 +0,0 @@ --// d-ir.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- --// GCC is free software; you can redistribute it and/or modify it under --// the terms of the GNU General Public License as published by the Free --// Software Foundation; either version 3, or (at your option) any later --// version. -- --// GCC is distributed in the hope that it will be useful, but WITHOUT ANY --// WARRANTY; without even the implied warranty of MERCHANTABILITY or --// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --// for more details. -- --#include "d-system.h" -- --#include "id.h" --#include "enum.h" --#include "module.h" --#include "init.h" --#include "d-lang.h" --#include "d-codegen.h" -- -- --void --Statement::toIR (IRState *) --{ -- ::error ("Statement::toIR: don't know what to do (%s)", toChars()); -- gcc_unreachable(); --} -- --void --LabelStatement::toIR (IRState *irs) --{ -- FuncDeclaration *func = irs->func; -- LabelDsymbol *label = irs->isReturnLabel (ident) ? func->returnLabel : func->searchLabel (ident); -- tree t_label = irs->getLabelTree (label); -- -- if (t_label != NULL_TREE) -- { -- irs->pushLabel (label); -- irs->doLabel (t_label); -- if (irs->isReturnLabel (ident) && func->fensure) -- func->fensure->toIR (irs); -- else if (statement) -- statement->toIR (irs); -- if (fwdrefs) -- { -- irs->checkPreviousGoto (fwdrefs); -- delete fwdrefs; -- fwdrefs = NULL; -- } -- } -- // else, there was an error --} -- --void --GotoStatement::toIR (IRState *irs) --{ -- tree t_label; -- -- object_file->setLoc (loc); /* This makes the 'undefined label' error show up on the correct line... -- The extra doLineNote in doJump shouldn't cause a problem. */ -- if (!label->statement) -- error ("label %s is undefined", label->toChars()); -- else if (tf != label->statement->tf) -- error ("cannot goto forward out of or into finally block"); -- else -- irs->checkGoto (this, label); -- -- t_label = irs->getLabelTree (label); -- if (t_label != NULL_TREE) -- irs->doJump (this, t_label); -- // else, there was an error --} -- --void --GotoCaseStatement::toIR (IRState *irs) --{ -- // assumes cblocks have been set in SwitchStatement::toIR -- irs->doJump (this, cs->cblock); --} -- --void --GotoDefaultStatement::toIR (IRState *irs) --{ -- // assumes cblocks have been set in SwitchStatement::toIR -- irs->doJump (this, sw->sdefault->cblock); --} -- --void --SwitchErrorStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->addExp (d_assert_call (loc, LIBCALL_SWITCH_ERROR)); --} -- --void --ThrowStatement::toIR (IRState *irs) --{ -- ClassDeclaration *class_decl = exp->type->toBasetype()->isClassHandle(); -- // Front end already checks for isClassHandle -- InterfaceDeclaration *intfc_decl = class_decl->isInterfaceDeclaration(); -- tree arg = exp->toElemDtor (irs); -- -- if (!flag_exceptions) -- { -- static int warned = 0; -- if (!warned) -- { -- error ("exception handling disabled, use -fexceptions to enable"); -- warned = 1; -- } -- } -- -- if (intfc_decl) -- { -- if (!intfc_decl->isCOMclass()) -- arg = convert_expr (arg, exp->type, build_object_type()); -- else -- error ("cannot throw COM interfaces"); -- } -- irs->doLineNote (loc); -- irs->addExp (build_libcall (LIBCALL_THROW, 1, &arg)); --} -- --void --TryFinallyStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->startTry (this); -- if (body) -- body->toIR (irs); -- -- irs->startFinally(); -- if (finalbody) -- finalbody->toIR (irs); -- -- irs->endFinally(); --} -- --void --TryCatchStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->startTry (this); -- if (body) -- body->toIR (irs); -- -- irs->startCatches(); -- if (catches) -- { -- for (size_t i = 0; i < catches->dim; i++) -- { -- Catch *a_catch = (*catches)[i]; -- -- irs->startCatch (a_catch->type->toCtype()); -- irs->doLineNote (a_catch->loc); -- irs->startScope(); -- -- if (a_catch->var) -- { -- tree exc_obj = convert_expr (build_exception_object(), -- build_object_type(), a_catch->type); -- tree catch_var = a_catch->var->toSymbol()->Stree; -- // need to override initializer... -- // set DECL_INITIAL now and emitLocalVar will know not to change it -- DECL_INITIAL (catch_var) = exc_obj; -- irs->emitLocalVar (a_catch->var); -- } -- -- if (a_catch->handler) -- a_catch->handler->toIR (irs); -- irs->endScope(); -- irs->endCatch(); -- } -- } -- irs->endCatches(); --} -- --void --OnScopeStatement::toIR (IRState *) --{ --} -- --void --WithStatement::toIR (IRState *irs) --{ -- irs->startScope(); -- if (wthis) -- irs->emitLocalVar (wthis); -- -- if (body) -- body->toIR (irs); -- -- irs->endScope(); --} -- --void --SynchronizedStatement::toIR (IRState *) --{ -- ::error ("SynchronizedStatement::toIR: we shouldn't emit this (%s)", toChars()); -- gcc_unreachable(); --} -- --void --ContinueStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->continueLoop (ident); --} -- --void --BreakStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->exitLoop (ident); --} -- --void --ReturnStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- -- if (exp == NULL || exp->type->toBasetype()->ty == Tvoid) -- { -- // Return has no value. -- irs->doReturn (NULL_TREE); -- return; -- } -- -- FuncDeclaration *func = irs->func; -- TypeFunction *tf = (TypeFunction *) func->type; -- Type *ret_type = func->tintro ? func->tintro->nextOf() : tf->nextOf(); -- -- if (func->isMain() && ret_type->toBasetype()->ty == Tvoid) -- ret_type = Type::tint32; -- -- tree result_decl = DECL_RESULT (irs->func->toSymbol()->Stree); -- -- if (func->nrvo_can && func->nrvo_var) -- { -- // Just refer to the RESULT_DECL; this is a nop, but differs from using -- // NULL_TREE in that it indicates that we care about the value of the RESULT_DECL. -- irs->doReturn (result_decl); -- } -- else -- { -- tree result_value = convert_expr (exp->toElemDtor (irs), exp->type, ret_type); -- // %% convert for init -- if we were returning a reference, -- // would want to take the address... -- if (tf->isref) -- result_value = build_address (result_value); -- -- tree result_assign = build2 (INIT_EXPR, TREE_TYPE (result_decl), -- result_decl, result_value); -- -- irs->doReturn (result_assign); -- } --} -- --void --DefaultStatement::toIR (IRState *irs) --{ -- irs->checkSwitchCase (this, 1); -- irs->doCase (NULL_TREE, cblock); -- if (statement) -- statement->toIR (irs); --} -- --void --CaseStatement::toIR (IRState *irs) --{ -- tree case_value; -- -- if (exp->type->isscalar()) -- case_value = exp->toElem (irs); -- else -- case_value = build_integer_cst (index, Type::tint32->toCtype()); -- -- irs->checkSwitchCase (this); -- irs->doCase (case_value, cblock); -- if (statement) -- statement->toIR (irs); --} -- --void --SwitchStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- -- tree cond_tree = condition->toElemDtor (irs); -- Type *cond_type = condition->type->toBasetype(); -- -- if (condition->type->isString()) -- { -- Type *elem_type = cond_type->nextOf()->toBasetype(); -- LibCall libcall; -- switch (elem_type->ty) -- { -- case Tchar: -- libcall = LIBCALL_SWITCH_STRING; -- break; -- -- case Twchar: -- libcall = LIBCALL_SWITCH_USTRING; -- break; -- -- case Tdchar: -- libcall = LIBCALL_SWITCH_DSTRING; -- break; -- -- default: -- ::error ("switch statement value must be an array of some character type, not %s", -- elem_type->toChars()); -- gcc_unreachable(); -- } -- -- // Apparently the backend is supposed to sort and set the indexes -- // on the case array, have to change them to be useable. -- cases->sort(); -- -- tree args[2]; -- Symbol *s = new Symbol(); -- dt_t **pdt = &s->Sdt; -- -- for (size_t i = 0; i < cases->dim; i++) -- { -- CaseStatement *cs = (*cases)[i]; -- cs->index = i; -- -- if (cs->exp->op != TOKstring) -- error("case '%s' is not a string", cs->exp->toChars()); -- else -- pdt = cs->exp->toDt (pdt); -- } -- -- s->Sreadonly = true; -- d_finish_symbol (s); -- -- args[0] = d_array_value (cond_type->arrayOf()->toCtype(), -- size_int (cases->dim), -- build_address (s->Stree)); -- args[1] = cond_tree; -- -- cond_tree = build_libcall (libcall, 2, args); -- } -- else if (!cond_type->isscalar()) -- { -- ::error ("cannot handle switch condition of type %s", cond_type->toChars()); -- gcc_unreachable(); -- } -- -- if (cases) -- { -- // Build LABEL_DECLs now so they can be refered to by goto case -- for (size_t i = 0; i < cases->dim; i++) -- { -- CaseStatement *case_stmt = (*cases)[i]; -- case_stmt->cblock = d_build_label (case_stmt->loc, NULL); -- } -- if (sdefault) -- sdefault->cblock = d_build_label (sdefault->loc, NULL); -- } -- cond_tree = fold (cond_tree); -- -- if (hasVars) -- { -- // Write cases as a series of if-then-else blocks. -- for (size_t i = 0; i < cases->dim; i++) -- { -- CaseStatement *case_stmt = (*cases)[i]; -- tree case_cond = build2 (EQ_EXPR, cond_type->toCtype(), cond_tree, -- case_stmt->exp->toElemDtor (irs)); -- irs->startCond (this, case_cond); -- irs->doJump (NULL, case_stmt->cblock); -- irs->endCond(); -- } -- if (sdefault) -- irs->doJump (NULL, sdefault->cblock); -- } -- -- // Emit body. -- irs->startCase (this, cond_tree, hasVars); -- if (body) -- body->toIR (irs); -- irs->endCase(); --} -- -- --void --IfStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->startScope(); -- irs->startCond (this, convert_for_condition (condition->toElemDtor (irs), -- condition->type)); -- if (ifbody) -- ifbody->toIR (irs); -- -- if (elsebody) -- { -- irs->startElse(); -- elsebody->toIR (irs); -- } -- irs->endCond(); -- irs->endScope(); --} -- --void --ForeachStatement::toIR (IRState *) --{ -- ::error ("ForeachStatement::toIR: we shouldn't emit this (%s)", toChars()); -- gcc_unreachable(); --} -- --void --ForeachRangeStatement::toIR (IRState *) --{ -- ::error ("ForeachRangeStatement::toIR: we shouldn't emit this (%s)", toChars()); -- gcc_unreachable(); --} -- --void --ForStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- if (init) -- init->toIR (irs); -- irs->startLoop (this); -- if (condition) -- { -- irs->doLineNote (condition->loc); -- irs->exitIfFalse (convert_for_condition (condition->toElemDtor (irs), -- condition->type)); -- } -- if (body) -- body->toIR (irs); -- irs->continueHere(); -- if (increment) -- { -- // force side effects? -- irs->doLineNote (increment->loc); -- irs->addExp (increment->toElemDtor (irs)); -- } -- irs->endLoop(); --} -- --void --DoStatement::toIR (IRState *irs) --{ -- irs->doLineNote (loc); -- irs->startLoop (this); -- if (body) -- body->toIR (irs); -- irs->continueHere(); -- irs->doLineNote (condition->loc); -- irs->exitIfFalse (convert_for_condition (condition->toElemDtor (irs), -- condition->type)); -- irs->endLoop(); --} -- --void --WhileStatement::toIR (IRState *) --{ -- ::error ("WhileStatement::toIR: we shouldn't emit this (%s)", toChars()); -- gcc_unreachable(); --} -- --void --ScopeStatement::toIR (IRState *irs) --{ -- if (statement) -- { -- irs->startScope(); -- statement->toIR (irs); -- irs->endScope(); -- } --} -- --void --CompoundStatement::toIR (IRState *irs) --{ -- if (!statements) -- return; -- -- for (size_t i = 0; i < statements->dim; i++) -- { -- Statement *statement = (*statements)[i]; -- if (statement) -- statement->toIR (irs); -- } --} -- --void --UnrolledLoopStatement::toIR (IRState *irs) --{ -- if (!statements) -- return; -- -- irs->startLoop (this); -- irs->continueHere(); -- for (size_t i = 0; i < statements->dim; i++) -- { -- Statement *statement = (*statements)[i]; -- if (statement) -- { -- irs->setContinueLabel (d_build_label (loc, NULL)); -- statement->toIR (irs); -- irs->continueHere(); -- } -- } -- irs->exitLoop (NULL); -- irs->endLoop(); --} -- --void --ExpStatement::toIR (IRState *irs) --{ -- if (exp) -- { -- irs->doLineNote (loc); -- tree exp_tree = exp->toElemDtor (irs); -- irs->addExp (exp_tree); -- } --} -- --void --DtorExpStatement::toIR (IRState *irs) --{ -- FuncDeclaration *fd = irs->func; -- -- /* Do not call destructor if var is returned as the -- nrvo variable. */ -- bool noDtor = (fd->nrvo_can && fd->nrvo_var == var); -- -- if (!noDtor) -- ExpStatement::toIR (irs); --} -- --void --PragmaStatement::toIR (IRState *) --{ --} -- --void --ImportStatement::toIR (IRState *) --{ --} -- ---- a/src/gcc/d/d-irstate.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-irstate.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-irstate.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -22,20 +22,33 @@ - - #include "init.h" - --IRBase::IRBase (void) -+IRState::IRState (void) - { - this->parent = NULL; - this->func = NULL; -- this->varsInScope = NULL; - this->mod = NULL; - this->sthis = NULL_TREE; -+ this->varsInScope = vNULL; -+ this->statementList_ = vNULL; -+ this->scopes_ = vNULL; -+ this->loops_ = vNULL; -+ this->labels_ = vNULL; -+} -+ -+IRState::~IRState (void) -+{ -+ this->varsInScope.release(); -+ this->statementList_.release(); -+ this->scopes_.release(); -+ this->loops_.release(); -+ this->labels_.release(); - } - - IRState * --IRBase::startFunction (FuncDeclaration *decl) -+IRState::startFunction (FuncDeclaration *decl) - { - IRState *new_irs = new IRState(); -- new_irs->parent = cirstate; -+ new_irs->parent = current_irstate; - new_irs->func = decl; - - for (Dsymbol *p = decl->parent; p; p = p->parent) -@@ -47,45 +60,45 @@ IRBase::startFunction (FuncDeclaration * - } - } - -- cirstate = (IRState *) new_irs; -- ModuleInfo & mi = *object_file->moduleInfo; -+ current_irstate = (IRState *) new_irs; -+ ModuleInfo *mi = current_module_info; - - if (decl->isSharedStaticCtorDeclaration()) -- mi.sharedctors.push (decl); -+ mi->sharedctors.safe_push (decl); - else if (decl->isStaticCtorDeclaration()) -- mi.ctors.push (decl); -+ mi->ctors.safe_push (decl); - else if (decl->isSharedStaticDtorDeclaration()) - { - VarDeclaration *vgate; - if ((vgate = decl->isSharedStaticDtorDeclaration()->vgate)) -- mi.sharedctorgates.push (vgate); -- mi.shareddtors.push (decl); -+ mi->sharedctorgates.safe_push (vgate); -+ mi->shareddtors.safe_push (decl); - } - else if (decl->isStaticDtorDeclaration()) - { - VarDeclaration *vgate; - if ((vgate = decl->isStaticDtorDeclaration()->vgate)) -- mi.ctorgates.push (vgate); -- mi.dtors.push (decl); -+ mi->ctorgates.safe_push (vgate); -+ mi->dtors.safe_push (decl); - } - else if (decl->isUnitTestDeclaration()) -- mi.unitTests.push (decl); -+ mi->unitTests.safe_push (decl); - - return new_irs; - } - - void --IRBase::endFunction (void) -+IRState::endFunction (void) - { -- gcc_assert (this->scopes.dim == 0); -- cirstate = (IRState *) this->parent; -+ gcc_assert (this->scopes_.is_empty()); -+ current_irstate = (IRState *) this->parent; - } - - - // Emit statement E into function body. - - void --IRBase::addExp (tree e) -+IRState::addExp (tree e) - { - /* Need to check that this is actually an expression; it - could be an integer constant (statement with no effect.) -@@ -104,24 +117,24 @@ IRBase::addExp (tree e) - if (EXPR_P (e) && !EXPR_HAS_LOCATION (e)) - SET_EXPR_LOCATION (e, input_location); - -- tree stmt_list = (tree) this->statementList.pop(); -+ tree stmt_list = this->statementList_.pop(); - append_to_statement_list_force (e, &stmt_list); -- this->statementList.push (stmt_list); -+ this->statementList_.safe_push (stmt_list); - } - - - void --IRBase::pushStatementList (void) -+IRState::pushStatementList (void) - { - tree t = alloc_stmt_list(); -- this->statementList.push (t); -+ this->statementList_.safe_push (t); - d_keep (t); - } - - tree --IRBase::popStatementList (void) -+IRState::popStatementList (void) - { -- tree t = (tree) this->statementList.pop(); -+ tree t = this->statementList_.pop(); - - /* If the statement list is completely empty, just return it. This is - just as good small as build_empty_stmt, with the advantage that -@@ -147,7 +160,7 @@ IRBase::popStatementList (void) - - - tree --IRBase::getLabelTree (LabelDsymbol *label) -+IRState::getLabelTree (LabelDsymbol *label) - { - if (!label->statement) - return NULL_TREE; -@@ -162,13 +175,13 @@ IRBase::getLabelTree (LabelDsymbol *labe - } - - Label * --IRBase::getLabelBlock (LabelDsymbol *label, Statement *from) -+IRState::getLabelBlock (LabelDsymbol *label, Statement *from) - { - Label *l = new Label(); - -- for (int i = this->loops.dim - 1; i >= 0; i--) -+ for (int i = this->loops_.length() - 1; i >= 0; i--) - { -- Flow *flow = this->loops[i]; -+ Flow *flow = this->loops_[i]; - - if (flow->kind != level_block - && flow->kind != level_switch) -@@ -188,167 +201,168 @@ IRBase::getLabelBlock (LabelDsymbol *lab - - - Flow * --IRBase::getLoopForLabel (Identifier *ident, bool want_continue) -+IRState::getLoopForLabel (Identifier *ident, bool want_continue) - { - if (ident) - { -- LabelStatement *lbl_stmt = this->func->searchLabel (ident)->statement; -- gcc_assert (lbl_stmt != 0); -- Statement *stmt = lbl_stmt->statement; -- ScopeStatement *scope_stmt = stmt->isScopeStatement(); -- -- if (scope_stmt) -- stmt = scope_stmt->statement; -+ LabelStatement *lstmt = this->func->searchLabel (ident)->statement; -+ gcc_assert (lstmt != NULL); -+ // The break label for a loop may actually be some levels up; -+ // eg: on a try/finally wrapping a loop. -+ Statement *stmt = lstmt->statement->getRelatedLabeled(); - -- for (int i = this->loops.dim - 1; i >= 0; i--) -+ for (int i = this->loops_.length() - 1; i >= 0; i--) - { -- Flow *flow = this->loops[i]; -+ Flow *flow = this->loops_[i]; - -- if (flow->statement == stmt) -+ if (flow->statement->getRelatedLabeled() == stmt) - { - if (want_continue) -- gcc_assert (stmt->hasContinue()); -+ gcc_assert (flow->statement->hasContinue()); - return flow; - } - } -- gcc_unreachable(); - } - else - { -- for (int i = this->loops.dim - 1; i >= 0; i--) -+ for (int i = this->loops_.length() - 1; i >= 0; i--) - { -- Flow *flow = this->loops[i]; -+ Flow *flow = this->loops_[i]; - - if ((!want_continue && flow->statement->hasBreak()) - || flow->statement->hasContinue()) - return flow; - } -- gcc_unreachable(); - } -+ -+ return NULL; - } - - - Flow * --IRBase::beginFlow (Statement *stmt) -+IRState::beginFlow (Statement *stmt) - { - Flow *flow = new Flow (stmt); -- this->loops.push (flow); -- pushStatementList(); -+ this->loops_.safe_push (flow); -+ this->pushStatementList(); - return flow; - } - - void --IRBase::endFlow (void) -+IRState::endFlow (void) - { -- Flow *flow; -+ gcc_assert (!this->loops_.is_empty()); - -- gcc_assert (this->loops.dim); -+ Flow *flow = this->loops_.pop(); - -- flow = (Flow *) this->loops.pop(); - if (flow->exitLabel) -- doLabel (flow->exitLabel); -- //%% delete flow; -+ this->doLabel (flow->exitLabel); - } - - void --IRBase::doLabel (tree t_label) -+IRState::doLabel (tree label) - { - /* Don't write out label unless it is marked as used by the frontend. - This makes auto-vectorization possible in conditional loops. - The only excemption to this is in LabelStatement::toIR, in which - all computed labels are marked regardless. */ -- if (TREE_USED (t_label)) -- addExp (build1 (LABEL_EXPR, void_type_node, t_label)); -+ if (TREE_USED (label)) -+ this->addExp (build1 (LABEL_EXPR, void_type_node, label)); - } - - - void --IRBase::startScope (void) -+IRState::startScope (void) - { - unsigned *p_count = new unsigned; - *p_count = 0; -- this->scopes.push (p_count); -- startBindings(); -+ -+ this->scopes_.safe_push (p_count); -+ this->startBindings(); - } - - void --IRBase::endScope (void) -+IRState::endScope (void) - { -- unsigned *p_count = currentScope(); -+ unsigned *p_count = this->currentScope(); - while (*p_count) -- endBindings(); -+ this->endBindings(); - -- this->scopes.pop(); -+ this->scopes_.pop(); - } - - - void --IRBase::startBindings (void) -+IRState::startBindings (void) - { -- pushlevel (0); -- tree block = make_node (BLOCK); -- set_block (block); -+ tree block; - -- pushStatementList(); -+ push_binding_level(); -+ block = make_node (BLOCK); -+ current_binding_level->this_block = block; - -- ++(*currentScope()); -+ this->pushStatementList(); -+ -+ ++(*this->currentScope()); - } - - void --IRBase::endBindings (void) -+IRState::endBindings (void) - { -- tree block = poplevel (1,0,0); -+ tree block = pop_binding_level (1, 0); -+ TREE_USED (block) = 1; - -- tree t_body = popStatementList(); -- addExp (build3 (BIND_EXPR, void_type_node, -- BLOCK_VARS (block), t_body, block)); -+ tree body = this->popStatementList(); -+ this->addExp (build3 (BIND_EXPR, void_type_node, -+ BLOCK_VARS (block), body, block)); - -- // Because we used set_block, the popped level/block is not automatically recorded -- insert_block (block); -+ // The popped level/block is not automatically recorded -+ current_binding_level->blocks = block_chainon (current_binding_level->blocks, block); - -- --(*currentScope()); -- gcc_assert (*(int *) currentScope() >= 0); -+ --(*this->currentScope()); -+ gcc_assert (*(int *) this->currentScope() >= 0); - } - - - // Routines for building statement lists around if/else conditions. --// STMT contains the statement to be executed if T_COND is true. -+// STMT contains the statement to be executed if COND is true. - - void --IRBase::startCond (Statement *stmt, tree t_cond) -+IRState::startCond (Statement *stmt, tree cond) - { -- Flow *f = beginFlow (stmt); -- f->condition = t_cond; -+ Flow *flow = this->beginFlow (stmt); -+ flow->condition = cond; - } - - // Start a new statement list for the false condition branch. - - void --IRBase::startElse (void) -+IRState::startElse (void) - { -- currentFlow()->trueBranch = popStatementList(); -- pushStatementList(); -+ Flow *flow = this->currentFlow(); -+ flow->trueBranch = this->popStatementList(); -+ this->pushStatementList(); - } - - // Wrap up our constructed if condition into a COND_EXPR. - - void --IRBase::endCond (void) -+IRState::endCond (void) - { -- Flow *f = currentFlow(); -- tree t_brnch = popStatementList(); -- tree t_false_brnch = NULL_TREE; -+ Flow *flow = this->currentFlow(); -+ tree branch = this->popStatementList(); -+ tree false_branch = NULL_TREE; - -- if (f->trueBranch == NULL_TREE) -- f->trueBranch = t_brnch; -+ if (flow->trueBranch == NULL_TREE) -+ flow->trueBranch = branch; - else -- t_false_brnch = t_brnch; -+ false_branch = branch; - -- object_file->doLineNote (f->statement->loc); -- tree t_stmt = build3 (COND_EXPR, void_type_node, -- f->condition, f->trueBranch, t_false_brnch); -- endFlow(); -- addExp (t_stmt); -+ this->doLineNote (flow->statement->loc); -+ tree stmt = build3 (COND_EXPR, void_type_node, -+ flow->condition, flow->trueBranch, false_branch); -+ this->endFlow(); -+ this->addExp (stmt); - } - - -@@ -356,240 +370,307 @@ IRBase::endCond (void) - // STMT is the body of the loop. - - void --IRBase::startLoop (Statement *stmt) -+IRState::startLoop (Statement *stmt) - { -- Flow *f = beginFlow (stmt); -+ Flow *flow = this->beginFlow (stmt); - // should be end for 'do' loop -- f->continueLabel = d_build_label (stmt ? stmt->loc : 0, NULL); -+ flow->continueLabel = d_build_label (stmt ? stmt->loc : Loc(), NULL); - } - - // Emit continue label for loop. - - void --IRBase::continueHere (void) -+IRState::continueHere (void) - { -- doLabel (currentFlow()->continueLabel); -+ Flow *flow = this->currentFlow(); -+ this->doLabel (flow->continueLabel); - } - - // Set LBL as the continue label for the current loop. - // Used in unrolled loop statements. - - void --IRBase::setContinueLabel (tree lbl) -+IRState::setContinueLabel (tree label) - { -- currentFlow()->continueLabel = lbl; -+ Flow *flow = this->currentFlow(); -+ flow->continueLabel = label; - } - - // Emit exit loop condition. - - void --IRBase::exitIfFalse (tree t_cond) -+IRState::exitIfFalse (tree cond) - { -- addExp (build1 (EXIT_EXPR, void_type_node, -- build1 (TRUTH_NOT_EXPR, TREE_TYPE (t_cond), t_cond))); -+ this->addExp (build1 (EXIT_EXPR, void_type_node, -+ build1 (TRUTH_NOT_EXPR, TREE_TYPE (cond), cond))); - } - - // Emit a goto to the continue label IDENT of a loop. - - void --IRBase::continueLoop (Identifier *ident) -+IRState::continueLoop (Identifier *ident) - { -- doJump (NULL, getLoopForLabel (ident, true)->continueLabel); -+ Flow *flow = this->getLoopForLabel (ident, true); -+ gcc_assert (flow); -+ this->doJump (NULL, flow->continueLabel); - } - - // Emit a goto to the exit label IDENT of a loop. - - void --IRBase::exitLoop (Identifier *ident) -+IRState::exitLoop (Identifier *ident) - { -- Flow *flow = getLoopForLabel (ident); -+ Flow *flow = this->getLoopForLabel (ident); -+ gcc_assert (flow); -+ - if (!flow->exitLabel) - flow->exitLabel = d_build_label (flow->statement->loc, NULL); -- doJump (NULL, flow->exitLabel); -+ -+ this->doJump (NULL, flow->exitLabel); - } - - // Wrap up constructed loop body in a LOOP_EXPR. - - void --IRBase::endLoop (void) -+IRState::endLoop (void) - { - // says must contain an EXIT_EXPR -- what about while (1)..goto;? something other thand LOOP_EXPR? -- tree t_body = popStatementList(); -- tree t_loop = build1 (LOOP_EXPR, void_type_node, t_body); -- addExp (t_loop); -- endFlow(); -+ tree body = this->popStatementList(); -+ tree loop = build1 (LOOP_EXPR, void_type_node, body); -+ this->addExp (loop); -+ this->endFlow(); - } - - -+// Create a tree node to set multiple elements to a single value -+ -+tree -+IRState::doArraySet(tree ptr, tree value, tree count) -+{ -+ tree t; -+ -+ pushStatementList(); -+ startBindings(); -+ -+ // Build temporary locals for count and ptr, and maybe value. -+ t = build_local_temp (size_type_node); -+ DECL_INITIAL (t) = count; -+ count = t; -+ expand_decl (count); -+ -+ t = build_local_temp (TREE_TYPE (ptr)); -+ DECL_INITIAL (t) = ptr; -+ ptr = t; -+ expand_decl (ptr); -+ -+ if (d_has_side_effects (value)) -+ { -+ t = build_local_temp (TREE_TYPE (value)); -+ DECL_INITIAL (t) = value; -+ value = t; -+ expand_decl (value); -+ } -+ -+ // Build loop to initialise { .length=count, .ptr=ptr } with value. -+ // -+ // while (count != 0) -+ // { -+ // *ptr = value; -+ // ptr += (*ptr).sizeof; -+ // count -= 1; -+ // } -+ tree pesize = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ptr))); -+ tree count_zero = d_convert (TREE_TYPE (count), integer_zero_node); -+ tree count_one = d_convert (TREE_TYPE (count), integer_one_node); -+ -+ startLoop (NULL); -+ continueHere(); -+ exitIfFalse (build_boolop (NE_EXPR, count, count_zero)); -+ -+ addExp (vmodify_expr (build_deref (ptr), value)); -+ addExp (vmodify_expr (ptr, build_offset (ptr, pesize))); -+ addExp (build2 (POSTDECREMENT_EXPR, TREE_TYPE (count), count, count_one)); -+ -+ endLoop(); -+ endBindings(); -+ -+ return popStatementList(); -+} -+ - // Routines for building statement lists around switches. STMT is the body --// of the switch statement, T_COND is the condition to the switch. If HAS_VARS -+// of the switch statement, COND is the condition to the switch. If HAS_VARS - // is true, then the switch statement has been converted to an if-then-else. - - void --IRBase::startCase (Statement *stmt, tree t_cond, int has_vars) -+IRState::startCase (Statement *stmt, tree cond, int has_vars) - { -- Flow *f = beginFlow (stmt); -- f->condition = t_cond; -- f->kind = level_switch; -+ Flow *flow = this->beginFlow (stmt); -+ flow->condition = cond; -+ flow->kind = level_switch; - if (has_vars) - { - // %% dummy value so the tree is not NULL -- f->hasVars = integer_one_node; -+ flow->hasVars = integer_one_node; - } - } - --// Emit a case statement for T_VALUE. -+// Emit a case statement for VALUE. - - void --IRBase::doCase (tree t_value, tree t_label) -+IRState::doCase (tree value, tree label) - { -- if (currentFlow()->hasVars) -- { -- // SwitchStatement has already taken care of label jumps. -- doLabel (t_label); -- } -+ // SwitchStatement has already taken care of label jumps. -+ if (this->currentFlow()->hasVars) -+ this->doLabel (label); - else - { -- tree t_case = build_case_label (t_value, NULL_TREE, t_label); -- addExp (t_case); -+ tree case_label = build_case_label (value, NULL_TREE, label); -+ this->addExp (case_label); - } - } - - // Wrap up constructed body into a SWITCH_EXPR. - - void --IRBase::endCase (void) -+IRState::endCase (void) - { -- Flow *f = currentFlow(); -- tree t_body = popStatementList(); -- tree t_condtype = TREE_TYPE (f->condition); -- if (f->hasVars) -- { -- // %% switch was converted to if-then-else expression -- addExp (t_body); -- } -+ Flow *flow = this->currentFlow(); -+ tree body = this->popStatementList(); -+ tree condtype = TREE_TYPE (flow->condition); -+ -+ // Switch was converted to if-then-else expression -+ if (flow->hasVars) -+ this->addExp (body); - else - { -- tree t_stmt = build3 (SWITCH_EXPR, t_condtype, f->condition, -- t_body, NULL_TREE); -- addExp (t_stmt); -+ tree stmt = build3 (SWITCH_EXPR, condtype, -+ flow->condition, body, NULL_TREE); -+ this->addExp (stmt); - } -- endFlow(); -+ -+ this->endFlow(); - } - - // Routines for building statement lists around try/catch/finally. - // Start a try statement, STMT is the body of the try expression. - - void --IRBase::startTry (Statement *stmt) -+IRState::startTry (Statement *stmt) - { -- beginFlow (stmt); -- currentFlow()->kind = level_try; -+ Flow *flow = this->beginFlow (stmt); -+ flow->kind = level_try; - } - - // Pops the try body and starts a new statement list for all catches. - - void --IRBase::startCatches (void) -+IRState::startCatches (void) - { -- currentFlow()->tryBody = popStatementList(); -- currentFlow()->kind = level_catch; -- pushStatementList(); -+ Flow *flow = this->currentFlow(); -+ flow->tryBody = this->popStatementList(); -+ flow->kind = level_catch; -+ this->pushStatementList(); - } - --// Start a new catch expression for exception type T_TYPE. -+// Start a new catch expression for exception type TYPE. - - void --IRBase::startCatch (tree t_type) -+IRState::startCatch (tree type) - { -- currentFlow()->catchType = t_type; -- pushStatementList(); -+ this->currentFlow()->catchType = type; -+ this->pushStatementList(); - } - - // Wrap up catch expression into a CATCH_EXPR. - - void --IRBase::endCatch (void) -+IRState::endCatch (void) - { -- tree t_body = popStatementList(); -+ tree body = this->popStatementList(); - // % Wrong loc... can set pass statement to startCatch, set -- // The loc on t_type and then use it here... -- addExp (build2 (CATCH_EXPR, void_type_node, -- currentFlow()->catchType, t_body)); -+ // The loc on type and then use it here... -+ this->addExp (build2 (CATCH_EXPR, void_type_node, -+ this->currentFlow()->catchType, body)); - } - - // Wrap up try/catch into a TRY_CATCH_EXPR. - - void --IRBase::endCatches (void) -+IRState::endCatches (void) - { -- tree t_catches = popStatementList(); -- object_file->doLineNote (currentFlow()->statement->loc); -- addExp (build2 (TRY_CATCH_EXPR, void_type_node, -- currentFlow()->tryBody, t_catches)); -- endFlow(); -+ Flow *flow = this->currentFlow(); -+ tree catches = this->popStatementList(); -+ -+ this->doLineNote (flow->statement->loc); -+ this->addExp (build2 (TRY_CATCH_EXPR, void_type_node, -+ flow->tryBody, catches)); -+ this->endFlow(); - } - - // Start a new finally expression. - - void --IRBase::startFinally (void) -+IRState::startFinally (void) - { -- currentFlow()->tryBody = popStatementList(); -- currentFlow()->kind = level_finally; -- pushStatementList(); -+ Flow *flow = this->currentFlow(); -+ flow->tryBody = this->popStatementList(); -+ flow->kind = level_finally; -+ this->pushStatementList(); - } - - // Wrap-up try/finally into a TRY_FINALLY_EXPR. - - void --IRBase::endFinally (void) -+IRState::endFinally (void) - { -- tree t_finally = popStatementList(); -- object_file->doLineNote (currentFlow()->statement->loc); -- addExp (build2 (TRY_FINALLY_EXPR, void_type_node, -- currentFlow()->tryBody, t_finally)); -- endFlow(); -+ Flow *flow = this->currentFlow(); -+ tree finally = this->popStatementList(); -+ -+ this->doLineNote (flow->statement->loc); -+ this->addExp (build2 (TRY_FINALLY_EXPR, void_type_node, -+ flow->tryBody, finally)); -+ this->endFlow(); - } - --// Emit a return expression of value T_VALUE. -+// Emit a return expression of value VALUE. - - void --IRBase::doReturn (tree t_value) -+IRState::doReturn (tree value) - { -- addExp (build1 (RETURN_EXPR, void_type_node, t_value)); -+ this->addExp (build1 (RETURN_EXPR, void_type_node, value)); - } - --// Emit goto expression to T_LABEL. -+// Emit goto expression to LABEL. - - void --IRBase::doJump (Statement *stmt, tree t_label) -+IRState::doJump (Statement *stmt, tree label) - { - if (stmt) -- object_file->doLineNote (stmt->loc); -- addExp (build1 (GOTO_EXPR, void_type_node, t_label)); -- TREE_USED (t_label) = 1; -+ this->doLineNote (stmt->loc); -+ -+ this->addExp (build1 (GOTO_EXPR, void_type_node, label)); -+ TREE_USED (label) = 1; - } - - // Routines for checking goto statements don't jump to invalid locations. - // In particular, it is illegal for a goto to be used to skip initializations. --// Saves the block label L is declared in for analysis later. -+// Saves the block LABEL is declared in for analysis later. - - void --IRBase::pushLabel (LabelDsymbol *l) -+IRState::pushLabel (LabelDsymbol *label) - { -- this->labels.push (getLabelBlock (l)); -+ Label *lblock = this->getLabelBlock (label); -+ this->labels_.safe_push (lblock); - } - - // Error if STMT is in it's own try statement separate from other - // cases in the switch statement. - - void --IRBase::checkSwitchCase (Statement *stmt, int default_flag) -+IRState::checkSwitchCase (Statement *stmt, int default_flag) - { -- Flow *flow = currentFlow(); -+ Flow *flow = this->currentFlow(); - -- gcc_assert (flow); - if (flow->kind != level_switch && flow->kind != level_block) - { - stmt->error ("%s cannot be in different try block level from switch", -@@ -601,18 +682,18 @@ IRBase::checkSwitchCase (Statement *stmt - // catch block. STMT is required to error on the correct line. - - void --IRBase::checkGoto (Statement *stmt, LabelDsymbol *label) -+IRState::checkGoto (Statement *stmt, LabelDsymbol *label) - { - Statement *curBlock = NULL; -- unsigned curLevel = this->loops.dim; -+ unsigned curLevel = this->loops_.length(); - int found = 0; - - if (curLevel) -- curBlock = currentFlow()->statement; -+ curBlock = this->currentFlow()->statement; - -- for (size_t i = 0; i < this->labels.dim; i++) -+ for (size_t i = 0; i < this->labels_.length(); i++) - { -- Label *linfo = this->labels[i]; -+ Label *linfo = this->labels_[i]; - gcc_assert (linfo); - - if (label == linfo->label) -@@ -635,9 +716,12 @@ IRBase::checkGoto (Statement *stmt, Labe - // Push forward referenced gotos. - if (!found) - { -+ Label *lblock = this->getLabelBlock (label, stmt); -+ - if (!label->statement->fwdrefs) - label->statement->fwdrefs = new Blocks(); -- label->statement->fwdrefs->push (getLabelBlock (label, stmt)); -+ -+ label->statement->fwdrefs->push (lblock); - } - } - -@@ -645,21 +729,21 @@ IRBase::checkGoto (Statement *stmt, Labe - // if goto is jumping into a try or catch block. - - void --IRBase::checkPreviousGoto (Array *refs) -+IRState::checkPreviousGoto (Blocks *refs) - { - Statement *stmt; // Our forward reference. - - for (size_t i = 0; i < refs->dim; i++) - { -- Label *ref = (Label *) refs->data[i]; -+ Label *ref = (*refs)[i]; - int found = 0; - - gcc_assert (ref && ref->from); - stmt = ref->from; - -- for (size_t i = 0; i < this->labels.dim; i++) -+ for (size_t i = 0; i < this->labels_.length(); i++) - { -- Label *linfo = this->labels[i]; -+ Label *linfo = this->labels_[i]; - gcc_assert (linfo); - - if (ref->label == linfo->label) ---- a/src/gcc/d/d-irstate.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-irstate.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-irstate.h -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -88,27 +88,25 @@ struct Flow - }; - - --typedef ArrayBase<Label> Labels; --typedef ArrayBase<struct Flow> Flows; -- -- -- --// IRBase contains the core functionality of IRState. The actual IRState class --// extends this with lots of code generation utilities. -+// IRState contains the core functionality of code generation utilities. - // - // Currently, each function gets its own IRState when emitting code. There is --// also a global IRState. -+// also a global IRState current_irstate. - // - // Most toElem calls don't actually need the IRState because they create GCC - // expression trees rather than emit instructions. - -+// Functions without a verb create trees -+// Functions with 'do' affect the current instruction stream (or output assembler code). -+// functions with other names are for attribute manipulate, etc. - --struct IRBase : Object -+struct IRState - { - public: -- IRBase *parent; -+ IRState *parent; - -- IRBase (void); -+ IRState (void); -+ ~IRState (void); - - // ** Functions - FuncDeclaration *func; -@@ -121,29 +119,23 @@ struct IRBase : Object - void endFunction (void); - - // Variables that are in scope that will need destruction later. -- VarDeclarations *varsInScope; -+ vec<VarDeclaration *> varsInScope; - - // ** Statement Lists -- Array statementList; // of tree -- - void addExp (tree e); - void pushStatementList (void); - tree popStatementList (void); - - // ** Labels -- Labels labels; -- - // It is only valid to call this while the function in which the label is defined - // is being compiled. -- tree getLabelTree (LabelDsymbol *label); -+ tree getLabelTree (LabelDsymbol *label); - Label *getLabelBlock (LabelDsymbol *label, Statement *from = NULL); - - bool isReturnLabel (Identifier *ident) - { return this->func->returnLabel ? ident == this->func->returnLabel->ident : 0; } - - // ** Loops (and case statements) -- Flows loops; -- - // These routines don't generate code. They are for tracking labeled loops. - Flow *getLoopForLabel (Identifier *ident, bool want_continue = false); - Flow *beginFlow (Statement *stmt); -@@ -152,15 +144,15 @@ struct IRBase : Object - - Flow *currentFlow (void) - { -- gcc_assert (this->loops.dim); -- return (Flow *) this->loops.tos(); -+ gcc_assert (!this->loops_.is_empty()); -+ return this->loops_.last(); - } - - void doLabel (tree t_label); - - // ** "Binding contours" - -- /* Definitions for IRBase scope code: -+ /* Definitions for IRState scope code: - "Scope": A container for binding contours. Each user-declared - function has a toplevel scope. Every ScopeStatement creates - a new scope. (And for now, until the emitLocalVar crash is -@@ -171,14 +163,13 @@ struct IRBase : Object - where the variable is declared and ends at it's containing scope. - */ - -- Array scopes; // of unsigned * - void startScope (void); - void endScope (void); - - unsigned *currentScope (void) - { -- gcc_assert (this->scopes.dim); -- return (unsigned *) this->scopes.tos(); -+ gcc_assert (!this->scopes_.is_empty()); -+ return this->scopes_.last(); - } - - void startBindings (void); -@@ -186,7 +177,7 @@ struct IRBase : Object - - // Update current source file location to LOC. - void doLineNote (const Loc& loc) -- { ObjectFile::doLineNote (loc); } -+ { set_input_location (loc); } - - // ** Instruction stream manipulation - -@@ -204,11 +195,14 @@ struct IRBase : Object - void continueLoop (Identifier *ident); - void exitLoop (Identifier *ident); - -+ // ** Array initialiser loop expression. -+ tree doArraySet (tree ptr, tree value, tree count); -+ - // ** Goto/Label statement evaluation - void doJump (Statement *stmt, tree t_label); - void pushLabel (LabelDsymbol *l); - void checkGoto (Statement *stmt, LabelDsymbol *label); -- void checkPreviousGoto (Array *refs); -+ void checkPreviousGoto (Blocks *refs); - - // ** Switch statements. - void startCase (Statement *stmt, tree t_cond, int has_vars = 0); -@@ -227,6 +221,12 @@ struct IRBase : Object - - // ** Return statement. - void doReturn (tree t_value); -+ -+ protected: -+ vec<tree> statementList_; -+ vec<unsigned *> scopes_; -+ vec<Flow *> loops_; -+ vec<Label *> labels_; - }; - - ---- a/src/gcc/d/d-lang.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-lang.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-lang.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -34,8 +34,8 @@ - #include "id.h" - #include "json.h" - #include "module.h" -+#include "scope.h" - #include "root.h" --#include "async.h" - #include "dfrontend/target.h" - - static tree d_handle_noinline_attribute (tree *, tree, tree, int, bool *); -@@ -46,7 +46,7 @@ static tree d_handle_target_attribute (t - - static char lang_name[6] = "GNU D"; - --const struct attribute_spec d_attribute_table[] = -+const attribute_spec d_attribute_table[] = - { - { "noinline", 0, 0, true, false, false, - d_handle_noinline_attribute, false }, -@@ -73,12 +73,14 @@ const struct attribute_spec d_attribute_ - #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE - #undef LANG_HOOKS_ATTRIBUTE_TABLE - #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE -+#undef LANG_HOOKS_GET_ALIAS_SET - #undef LANG_HOOKS_TYPES_COMPATIBLE_P - #undef LANG_HOOKS_BUILTIN_FUNCTION - #undef LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE - #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE - #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL - #undef LANG_HOOKS_GIMPLIFY_EXPR -+#undef LANG_HOOKS_CLASSIFY_RECORD - #undef LANG_HOOKS_EH_PERSONALITY - #undef LANG_HOOKS_EH_RUNTIME_TYPE - -@@ -95,17 +97,26 @@ const struct attribute_spec d_attribute_ - #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE d_builtins_attribute_table - #define LANG_HOOKS_ATTRIBUTE_TABLE d_attribute_table - #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE d_format_attribute_table -+#define LANG_HOOKS_GET_ALIAS_SET d_get_alias_set - #define LANG_HOOKS_TYPES_COMPATIBLE_P d_types_compatible_p - #define LANG_HOOKS_BUILTIN_FUNCTION d_builtin_function - #define LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE d_builtin_function - #define LANG_HOOKS_REGISTER_BUILTIN_TYPE d_register_builtin_type - #define LANG_HOOKS_FINISH_INCOMPLETE_DECL d_finish_incomplete_decl - #define LANG_HOOKS_GIMPLIFY_EXPR d_gimplify_expr -+#define LANG_HOOKS_CLASSIFY_RECORD d_classify_record - #define LANG_HOOKS_EH_PERSONALITY d_eh_personality - #define LANG_HOOKS_EH_RUNTIME_TYPE d_build_eh_type_type - - /* Lang Hooks for decls */ -+#undef LANG_HOOKS_PUSHDECL -+#undef LANG_HOOKS_GETDECLS -+#undef LANG_HOOKS_GLOBAL_BINDINGS_P - #undef LANG_HOOKS_WRITE_GLOBALS -+ -+#define LANG_HOOKS_PUSHDECL d_pushdecl -+#define LANG_HOOKS_GETDECLS d_getdecls -+#define LANG_HOOKS_GLOBAL_BINDINGS_P d_global_bindings_p - #define LANG_HOOKS_WRITE_GLOBALS d_write_global_declarations - - /* Lang Hooks for types */ -@@ -120,14 +131,25 @@ const struct attribute_spec d_attribute_ - - static const char *fonly_arg; - -+/* List of modules being compiled. */ -+Modules output_modules; -+ -+static Module *output_module = NULL; -+ -+static Module *entrypoint = NULL; -+ - /* Zero disables all standard directories for headers. */ - static bool std_inc = true; - - /* Common initialization before calling option handlers. */ - static void --d_init_options (unsigned int, struct cl_decoded_option *decoded_options) -+d_init_options (unsigned int, cl_decoded_option *decoded_options) - { - // Set default values -+ global.init(); -+ -+ global.compiler.vendor = lang_name; -+ - global.params.argv0 = xstrdup (decoded_options[0].arg); - global.params.link = 1; - global.params.useAssert = 1; -@@ -139,10 +161,10 @@ d_init_options (unsigned int, struct cl_ - global.params.useInline = 0; - global.params.warnings = 0; - global.params.obj = 1; -- global.params.Dversion = 2; - global.params.quiet = 1; - global.params.useDeprecated = 2; - global.params.betterC = 0; -+ global.params.allInst = 0; - - global.params.linkswitches = new Strings(); - global.params.libfiles = new Strings(); -@@ -153,12 +175,12 @@ d_init_options (unsigned int, struct cl_ - global.params.fileImppath = new Strings(); - - // extra D-specific options -- ObjectFile::emitTemplates = TEnormal; -+ flag_emit_templates = TEnormal; - } - - /* Initialize options structure OPTS. */ - static void --d_init_options_struct (struct gcc_options *opts) -+d_init_options_struct (gcc_options *opts) - { - // GCC options - opts->x_flag_exceptions = 1; -@@ -175,9 +197,6 @@ d_init_options_struct (struct gcc_option - - // Honour left to right code evaluation. - opts->x_flag_evaluation_order = 1; -- -- // Default to using strict aliasing. -- opts->x_flag_strict_aliasing = 1; - } - - static void -@@ -226,6 +245,7 @@ d_init (void) - Type::init(); - Id::initialize(); - Module::init(); -+ Expression::init(); - initPrecedence(); - - d_backend_init(); -@@ -341,9 +361,9 @@ static bool - d_handle_option (size_t scode, const char *arg, int value, - int kind ATTRIBUTE_UNUSED, - location_t loc ATTRIBUTE_UNUSED, -- const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) -+ const cl_option_handlers *handlers ATTRIBUTE_UNUSED) - { -- enum opt_code code = (enum opt_code) scode; -+ opt_code code = (opt_code) scode; - bool result = true; - int level; - -@@ -377,6 +397,10 @@ d_handle_option (size_t scode, const cha - } - break; - -+ case OPT_fdeps: -+ global.params.moduleDeps = new OutBuffer; -+ break; -+ - case OPT_fdeps_: - global.params.moduleDepsFile = xstrdup (arg); - if (!global.params.moduleDepsFile[0]) -@@ -411,7 +435,8 @@ d_handle_option (size_t scode, const cha - break; - - case OPT_femit_templates: -- ObjectFile::emitTemplates = value ? TEprivate : TEnone; -+ flag_emit_templates = value ? TEallinst : TEnone; -+ global.params.allInst = value; - break; - - case OPT_femit_moduleinfo: -@@ -444,6 +469,10 @@ d_handle_option (size_t scode, const cha - global.params.useInvariants = value; - break; - -+ case OPT_fmake_deps: -+ global.params.makeDeps = new OutBuffer; -+ break; -+ - case OPT_fmake_deps_: - global.params.makeDeps = new OutBuffer; - global.params.makeDepsStyle = 1; -@@ -452,6 +481,10 @@ d_handle_option (size_t scode, const cha - error ("bad argument for -fmake-deps"); - break; - -+ case OPT_fmake_mdeps: -+ global.params.makeDeps = new OutBuffer; -+ break; -+ - case OPT_fmake_mdeps_: - global.params.makeDeps = new OutBuffer; - global.params.makeDepsStyle = 2; -@@ -581,50 +614,45 @@ d_post_options (const char ** fn) - if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; - -+ if (global.params.useUnitTests) -+ global.params.useAssert = 1; -+ -+ global.params.symdebug = write_symbols != NO_DEBUG; -+ //global.params.useInline = flag_inline_functions; -+ global.params.obj = !flag_syntax_only; -+ // Has no effect yet. -+ global.params.pic = flag_pic != 0; -+ - return false; - } - --/* wrapup_global_declaration needs to be called or functions will not -- be emitted. */ --static Array globalDeclarations; -+// Array of all global declarations to pass back to the middle-end. -+vec<tree, va_gc> *global_declarations; - - void - d_add_global_declaration (tree decl) - { -- globalDeclarations.push (decl); -+ vec_safe_push (global_declarations, decl); - } - -+// Write out globals. - static void - d_write_global_declarations (void) - { -- tree *vec = (tree *) globalDeclarations.data; -- -- /* Complete all generated thunks. */ -- cgraph_process_same_body_aliases(); -- -- /* Process all file scopes in this compilation, and the external_scope, -- through wrapup_global_declarations. */ -- wrapup_global_declarations (vec, globalDeclarations.dim); -- -- /* We're done parsing; proceed to optimize and emit assembly. */ -- if (!global.errors && !errorcount) -- finalize_compilation_unit(); -- -- /* Now, issue warnings about static, but not defined, functions. */ -- check_global_declarations (vec, globalDeclarations.dim); -- -- /* After cgraph has had a chance to emit everything that's going to -- be emitted, output debug information for globals. */ -- emit_debug_global_declarations (vec, globalDeclarations.dim); -+ if (vec_safe_length (global_declarations) != 0) -+ { -+ d_finish_compilation (global_declarations->address(), -+ global_declarations->length()); -+ } - } - - --/* Gimplification of expression trees. */ -+// Gimplification of D specific expression trees. - int - d_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, - gimple_seq *post_p ATTRIBUTE_UNUSED) - { -- enum tree_code code = TREE_CODE (*expr_p); -+ tree_code code = TREE_CODE (*expr_p); - switch (code) - { - case INIT_EXPR: -@@ -635,7 +663,7 @@ d_gimplify_expr (tree *expr_p, gimple_se - tree op0 = TREE_OPERAND (*expr_p, 0); - tree op1 = TREE_OPERAND (*expr_p, 1); - -- if (!error_mark_p (op0) && !error_mark_p (op1) -+ if (!error_operand_p (op0) && !error_operand_p (op1) - && (AGGREGATE_TYPE_P (TREE_TYPE (op0)) - || AGGREGATE_TYPE_P (TREE_TYPE (op1))) - && !useless_type_conversion_p (TREE_TYPE (op1), TREE_TYPE (op0))) -@@ -670,8 +698,6 @@ d_gimplify_expr (tree *expr_p, gimple_se - } - - --static Module *output_module = NULL; -- - Module * - d_gcc_get_output_module (void) - { -@@ -679,18 +705,37 @@ d_gcc_get_output_module (void) - } - - static void --nametype (tree type, const char *name) -+d_nametype (Type *t) - { -- tree ident = get_identifier (name); -- tree decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, ident, type); -+ tree type = t->toCtype(); -+ tree ident = get_identifier (t->toChars()); -+ tree decl = build_decl (BUILTINS_LOCATION, TYPE_DECL, ident, type); - TYPE_NAME (type) = decl; - rest_of_decl_compilation (decl, 1, 0); - } - --static void --nametype (Type *t) -+// Generate C main() in response to seeing D main(). -+// This used to be in libdruntime, but contained a reference to _Dmain which -+// didn't work when druntime was made into a shared library and was linked -+// to a program, such as a C++ program, that didn't have a _Dmain. -+ -+void -+genCmain (Scope *sc) - { -- nametype (t->toCtype(), t->toChars()); -+ if (entrypoint) -+ return; -+ -+ // The D code to be generated is provided by __entrypoint.di -+ Module *m = Module::load (Loc(), NULL, Id::entrypoint); -+ m->importedFrom = sc->module; -+ m->importAll (NULL); -+ m->semantic(); -+ m->semantic2(); -+ m->semantic3(); -+ -+ // We are emitting this straight to object file. -+ output_modules.push (m); -+ entrypoint = m; - } - - static void -@@ -702,7 +747,7 @@ deps_write (Module *m) - - // Write out object name. - fn = m->objfile->name; -- size = fn->len(); -+ size = strlen (fn->str); - ob->writestring (fn->str); - column = size; - -@@ -711,7 +756,7 @@ deps_write (Module *m) - - // First dependency is source file for module. - fn = m->srcfile->name; -- size = fn->len(); -+ size = strlen (fn->str); - ob->writestring (fn->str); - column += size; - -@@ -731,23 +776,25 @@ deps_write (Module *m) - - if (md && md->packages) - { -- if (strcmp ((md->packages->tdata()[0])->string, "core") == 0) -+ if (strcmp ((*md->packages)[0]->string, "core") == 0) - continue; -- if (strcmp ((md->packages->tdata()[0])->string, "std") == 0) -+ if (strcmp ((*md->packages)[0]->string, "std") == 0) - continue; -- if (strcmp ((md->packages->tdata()[0])->string, "gcc") == 0) -+ if (strcmp ((*md->packages)[0]->string, "gcc") == 0) - continue; - } -- else if (md && md->id) -+ else if (md && md->id && md->packages == NULL) - { -- if (strcmp (md->id->string, "object") == 0 && md->packages == NULL) -+ if (strcmp (md->id->string, "object") == 0) -+ continue; -+ if (strcmp (md->id->string, "__entrypoint") == 0) - continue; - } - } - - // All checks done, write out file path/name. - fn = mi->srcfile->name; -- size = fn->len(); -+ size = strlen (fn->str); - column += size; - if (column > colmax) - { -@@ -761,28 +808,8 @@ deps_write (Module *m) - } - ob->writestring (fn->str); - } -- ob->writestring ("\n"); --} - -- --// Binary search for P in TAB between the range 0 to HIGH. -- --int binary(const char *p , const char **tab, int high) --{ -- int low = 0; -- do -- { -- int pos = (low + high) / 2; -- int cmp = strcmp(p, tab[pos]); -- if (! cmp) -- return pos; -- else if (cmp < 0) -- high = pos; -- else -- low = pos + 1; -- } while (low != high); -- -- return -1; -+ ob->writenl(); - } - - void -@@ -790,36 +817,29 @@ d_parse_file (void) - { - if (global.params.verbose) - { -- fprintf (stdmsg, "binary %s\n", global.params.argv0); -- fprintf (stdmsg, "version %s\n", global.version); -+ fprintf (global.stdmsg, "binary %s\n", global.params.argv0); -+ fprintf (global.stdmsg, "version %s\n", global.version); - } - -- if (global.params.useUnitTests) -- global.params.useAssert = 1; -- -- global.params.symdebug = write_symbols != NO_DEBUG; -- //global.params.useInline = flag_inline_functions; -- global.params.obj = !flag_syntax_only; -- global.params.pic = flag_pic != 0; // Has no effect yet. -- -- // better to use input_location.xxx ? -- (*debug_hooks->start_source_file) (input_line, main_input_filename); -+ // Start the main input file, if the debug writer wants it. -+ if (debug_hooks->start_end_main_source_file) -+ (*debug_hooks->start_source_file) (0, main_input_filename); - - for (TY ty = (TY) 0; ty < TMAX; ty = (TY) (ty + 1)) - { - if (Type::basic[ty] && ty != Terror) -- nametype (Type::basic[ty]); -+ d_nametype (Type::basic[ty]); - } - -+ current_irstate = new IRState(); -+ - // Create Modules - Modules modules; - modules.reserve (num_in_fnames); -- AsyncRead *aw = NULL; -- Module *m = NULL; - - if (!main_input_filename || !main_input_filename[0]) - { -- ::error ("input file name required; cannot use stdin"); -+ error ("input file name required; cannot use stdin"); - goto had_errors; - } - -@@ -828,14 +848,14 @@ d_parse_file (void) - /* In this mode, the first file name is supposed to be - a duplicate of one of the input file. */ - if (strcmp (fonly_arg, main_input_filename)) -- ::error ("-fonly= argument is different from main input file name"); -+ error ("-fonly= argument is different from main input file name"); - if (strcmp (fonly_arg, in_fnames[0])) -- ::error ("-fonly= argument is different from first input file name"); -+ error ("-fonly= argument is different from first input file name"); - } - - for (size_t i = 0; i < num_in_fnames; i++) - { -- //fprintf (stderr, "fn %d = %s\n", i, in_fnames[i]); -+ //fprintf (global.stdmsg, "fn %d = %s\n", i, in_fnames[i]); - char *fname = xstrdup (in_fnames[i]); - - // Strip path -@@ -858,7 +878,7 @@ d_parse_file (void) - || strcmp (name, ".") == 0) - { - Linvalid: -- ::error ("invalid file name '%s'", fname); -+ error ("invalid file name '%s'", fname); - goto had_errors; - } - } -@@ -872,7 +892,8 @@ d_parse_file (void) - // At this point, name is the D source file name stripped of - // its path and extension. - Identifier *id = Lexer::idPool (name); -- m = new Module (fname, id, global.params.doDocComments, global.params.doHdrGeneration); -+ Module *m = new Module (fname, id, global.params.doDocComments, -+ global.params.doHdrGeneration); - modules.push (m); - - if (!strcmp (in_fnames[i], main_input_filename)) -@@ -891,30 +912,27 @@ d_parse_file (void) - gcc_assert (output_module); - - // Read files -- aw = AsyncRead::create (modules.dim); - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -- aw->addFile (m->srcfile); -+ Module *m = modules[i]; -+ m->read (Loc()); - } -- aw->start(); - - // Parse files - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; -+ - if (global.params.verbose) -- fprintf (stdmsg, "parse %s\n", m->toChars()); -+ fprintf (global.stdmsg, "parse %s\n", m->toChars()); -+ - if (!Module::rootModule) - Module::rootModule = m; -+ - m->importedFrom = m; -- if (aw->read (i)) -- { -- error ("cannot read file %s", m->srcfile->name->toChars()); -- goto had_errors; -- } - m->parse(); - d_gcc_magic_module (m); -+ - if (m->isDocFile) - { - m->gendocfile(); -@@ -923,7 +941,6 @@ d_parse_file (void) - i--; - } - } -- AsyncRead::dispose (aw); - - if (global.errors) - goto had_errors; -@@ -937,11 +954,13 @@ d_parse_file (void) - */ - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; - if (fonly_arg && m != output_module) - continue; -+ - if (global.params.verbose) -- fprintf (stdmsg, "import %s\n", m->toChars()); -+ fprintf (global.stdmsg, "import %s\n", m->toChars()); -+ - m->genhdrfile(); - } - } -@@ -949,13 +968,15 @@ d_parse_file (void) - if (global.errors) - goto had_errors; - -- // load all unconditional imports for better symbol resolving -+ // Load all unconditional imports for better symbol resolving - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; -+ - if (global.params.verbose) -- fprintf (stdmsg, "importall %s\n", m->toChars()); -- m->importAll (0); -+ fprintf (global.stdmsg, "importall %s\n", m->toChars()); -+ -+ m->importAll (NULL); - } - - if (global.errors) -@@ -964,9 +985,11 @@ d_parse_file (void) - // Do semantic analysis - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; -+ - if (global.params.verbose) -- fprintf (stdmsg, "semantic %s\n", m->toChars()); -+ fprintf (global.stdmsg, "semantic %s\n", m->toChars()); -+ - m->semantic(); - } - -@@ -979,9 +1002,11 @@ d_parse_file (void) - // Do pass 2 semantic analysis - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; -+ - if (global.params.verbose) -- fprintf (stdmsg, "semantic2 %s\n", m->toChars()); -+ fprintf (global.stdmsg, "semantic2 %s\n", m->toChars()); -+ - m->semantic2(); - } - -@@ -991,56 +1016,60 @@ d_parse_file (void) - // Do pass 3 semantic analysis - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; -+ - if (global.params.verbose) -- fprintf (stdmsg, "semantic3 %s\n", m->toChars()); -+ fprintf (global.stdmsg, "semantic3 %s\n", m->toChars()); -+ - m->semantic3(); - } - -+ Module::runDeferredSemantic3(); -+ - if (global.errors) - goto had_errors; - -- if (global.params.moduleDeps != NULL) -+ if (global.params.moduleDeps) - { -- gcc_assert (global.params.moduleDepsFile != NULL); -- -- File deps (global.params.moduleDepsFile); - OutBuffer *ob = global.params.moduleDeps; -- deps.setbuffer ((void *) ob->data, ob->offset); -- deps.writev(); -+ -+ if (global.params.moduleDepsFile) -+ { -+ File deps (global.params.moduleDepsFile); -+ deps.setbuffer ((void *) ob->data, ob->offset); -+ writeFile(Loc(), &deps); -+ } -+ else -+ fprintf (global.stdmsg, "%.*s", (int) ob->offset, (char *) ob->data); - } - -- if (global.params.makeDeps != NULL) -+ if (global.params.makeDeps) - { - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; - deps_write (m); - } - -- - OutBuffer *ob = global.params.makeDeps; -- if (global.params.makeDepsFile == NULL) -- printf ("%s", (char *) ob->data); -- else -+ if (global.params.makeDepsFile) - { - File deps (global.params.makeDepsFile); - deps.setbuffer ((void *) ob->data, ob->offset); -- deps.writev(); -+ writeFile(Loc(), &deps); - } -+ else -+ fprintf (global.stdmsg, "%.*s", (int) ob->offset, (char *) ob->data); - } - - // Do not attempt to generate output files if errors or warnings occurred - if (global.errors || global.warnings) - goto had_errors; - -- object_file = new ObjectFile(); - if (fonly_arg) -- object_file->modules.push (output_module); -+ output_modules.push (output_module); - else -- object_file->modules.append (&modules); -- -- cirstate = new IRState(); -+ output_modules.append (&modules); - - // Generate output files - if (global.params.doXGeneration) -@@ -1053,12 +1082,13 @@ d_parse_file (void) - - if (name && name[0] == '-' && name[1] == 0) - { -- size_t n = fwrite (buf.data, 1, buf.offset, stdmsg); -+ size_t n = fwrite (buf.data, 1, buf.offset, global.stdmsg); - gcc_assert (n == buf.offset); - } - else - { - const char *jsonfilename; -+ File *jsonfile; - - if (name && *name) - jsonfilename = FileName::defaultExt(name, global.json_ext); -@@ -1070,24 +1100,31 @@ d_parse_file (void) - jsonfilename = FileName::forceExt(n, global.json_ext); - } - -- FileName::ensurePathToNameExists(jsonfilename); -- File *jsonfile = new File(jsonfilename); -- -+ ensurePathToNameExists(Loc(), jsonfilename); -+ jsonfile = new File(jsonfilename); - jsonfile->setbuffer(buf.data, buf.offset); - jsonfile->ref = 1; -- jsonfile->writev(); -+ writeFile(Loc(), jsonfile); - } - } - - for (size_t i = 0; i < modules.dim; i++) - { -- m = modules[i]; -+ Module *m = modules[i]; - if (fonly_arg && m != output_module) - continue; -+ - if (global.params.verbose) -- fprintf (stdmsg, "code %s\n", m->toChars()); -+ fprintf (global.stdmsg, "code %s\n", m->toChars()); -+ - if (!flag_syntax_only) -- m->genobjfile (false); -+ { -+ if (entrypoint && m == entrypoint->importedFrom) -+ entrypoint->genobjfile (false); -+ -+ m->genobjfile (false); -+ } -+ - if (!global.errors && !errorcount) - { - if (global.params.doDocComments) -@@ -1095,20 +1132,22 @@ d_parse_file (void) - } - } - -- // better to use input_location.xxx ? -- (*debug_hooks->end_source_file) (input_line); -+ // And end the main input file, if the debug writer wants it. -+ if (debug_hooks->start_end_main_source_file) -+ (*debug_hooks->end_source_file) (0); -+ - had_errors: - // Add D frontend error count to GCC error count to to exit with error status - errorcount += (global.errors + global.warnings); - -- object_file->finish(); -- output_module = NULL; -- -+ d_finish_module(); - d_backend_term(); -+ -+ output_module = NULL; - } - - static tree --d_type_for_mode (enum machine_mode mode, int unsignedp) -+d_type_for_mode (machine_mode mode, int unsignedp) - { - // taken from c-common.c - if (mode == TYPE_MODE (integer_type_node)) -@@ -1160,7 +1199,7 @@ d_type_for_mode (enum machine_mode mode, - - if (COMPLEX_MODE_P (mode)) - { -- enum machine_mode inner_mode; -+ machine_mode inner_mode; - tree inner_type; - - if (mode == TYPE_MODE (complex_float_type_node)) -@@ -1180,7 +1219,7 @@ d_type_for_mode (enum machine_mode mode, - } - else if (VECTOR_MODE_P (mode)) - { -- enum machine_mode inner_mode = (machine_mode) GET_MODE_INNER (mode); -+ machine_mode inner_mode = (machine_mode) GET_MODE_INNER (mode); - tree inner_type = d_type_for_mode (inner_mode, unsignedp); - if (inner_type != NULL_TREE) - return build_vector_type_for_mode (inner_type, mode); -@@ -1344,7 +1383,6 @@ d_type_promotes_to (tree type) - struct binding_level *current_binding_level; - struct binding_level *global_binding_level; - -- - static binding_level * - alloc_binding_level (void) - { -@@ -1356,7 +1394,7 @@ alloc_binding_level (void) - otherwise support the backend. */ - - void --pushlevel (int) -+push_binding_level (void) - { - binding_level *new_level = alloc_binding_level(); - new_level->level_chain = current_binding_level; -@@ -1364,15 +1402,13 @@ pushlevel (int) - } - - tree --poplevel (int keep, int reverse, int routinebody) -+pop_binding_level (int keep, int routinebody) - { - binding_level *level = current_binding_level; - tree block, decls; - - current_binding_level = level->level_chain; - decls = level->names; -- if (reverse) -- decls = nreverse (decls); - - if (level->this_block) - block = level->this_block; -@@ -1385,9 +1421,6 @@ poplevel (int keep, int reverse, int rou - { - BLOCK_VARS (block) = routinebody ? NULL_TREE : decls; - BLOCK_SUBBLOCKS (block) = level->blocks; -- // %% need this for when insert_block is called by backend... or make -- // insert_block do it's work elsewere -- // %% pascal does: in each subblock, record that this is the superiod.. - } - /* In each subblock, record that this is its superior. */ - for (tree t = level->blocks; t; t = BLOCK_CHAIN (t)) -@@ -1402,8 +1435,6 @@ poplevel (int keep, int reverse, int rou - // call and not and earlier set_block, insert it into the parent's - // list of blocks. Blocks created with set_block have to be - // inserted with insert_block. -- // -- // For D, currently always using set_block/insert_block - if (!level->this_block) - current_binding_level->blocks = chainon (current_binding_level->blocks, block); - } -@@ -1443,47 +1474,37 @@ poplevel (int keep, int reverse, int rou - // This is called by the backend before parsing. Need to make this do - // something or lang_hooks.clear_binding_stack (lhd_clear_binding_stack) - // loops forever. --bool --global_bindings_p (void) --{ -- return current_binding_level == global_binding_level || !global_binding_level; --} - --void --init_global_binding_level (void) -+static bool -+d_global_bindings_p (void) - { -- current_binding_level = global_binding_level = alloc_binding_level(); --} -- -+ if (current_binding_level == global_binding_level) -+ return true; - --void --insert_block (tree block) --{ -- TREE_USED (block) = 1; -- current_binding_level->blocks = block_chainon (current_binding_level->blocks, block); -+ return !global_binding_level; - } - - void --set_block (tree block) -+init_global_binding_level (void) - { -- current_binding_level->this_block = block; -+ global_binding_level = alloc_binding_level(); -+ current_binding_level = global_binding_level; - } - - tree --pushdecl (tree decl) -+d_pushdecl (tree decl) - { -- // %% Pascal: if not a local external routine decl doesn't consitite nesting -- -- // %% probably should be cur_irs->getDeclContext() -- // %% should only be for variables OR, should also use TRANSLATION_UNIT for toplevel.. -+ // Should only be for variables OR, should also use TRANSLATION_UNIT for toplevel... -+ // current_function_decl could be NULL_TREE (top level)... - if (DECL_CONTEXT (decl) == NULL_TREE) -- DECL_CONTEXT (decl) = current_function_decl; // could be NULL_TREE (top level) .. hmm. // hm.m. -+ DECL_CONTEXT (decl) = current_function_decl; - -- /* Put decls on list in reverse order. We will reverse them later if necessary. */ -+ // Put decls on list in reverse order. We will reverse them later if necessary. - TREE_CHAIN (decl) = current_binding_level->names; - current_binding_level->names = decl; - if (!TREE_CHAIN (decl)) - current_binding_level->names_end = decl; -+ - return decl; - } - -@@ -1495,17 +1516,43 @@ set_decl_binding_chain (tree decl_chain) - } - - --// Supports dbx and stabs --tree --getdecls (void) -+// Return the list of declarations of the current level. -+// Supports dbx and stabs. -+ -+static tree -+d_getdecls (void) - { - if (current_binding_level) - return current_binding_level->names; -- else -+ - return NULL_TREE; - } - - -+// Get the alias set corresponding to a type or expression. -+// Return -1 if we don't do anything special. -+ -+static alias_set_type -+d_get_alias_set (tree t) -+{ -+ // Permit type-punning when accessing a union, provided the access -+ // is directly through the union. -+ for (tree u = t; handled_component_p (u); u = TREE_OPERAND (u, 0)) -+ { -+ if (TREE_CODE (u) == COMPONENT_REF -+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE) -+ return 0; -+ } -+ -+ // That's all the expressions we handle. -+ if (!TYPE_P (t)) -+ return get_alias_set (TREE_TYPE (t)); -+ -+ // For now in D, assume everything aliases everything else, -+ // until we define some solid rules. -+ return 0; -+} -+ - static int - d_types_compatible_p (tree t1, tree t2) - { -@@ -1547,10 +1594,33 @@ d_finish_incomplete_decl (tree decl) - } - - -+// Return the true debug type for TYPE. -+ -+static classify_record -+d_classify_record (tree type) -+{ -+ Type *dtype = build_dtype (type); -+ -+ if (dtype && dtype->ty == Tclass) -+ { -+ TypeClass *tclass = (TypeClass *) dtype; -+ -+ // extern(C++) interfaces get emitted as classes. -+ if (tclass->sym->isInterfaceDeclaration() -+ && !tclass->sym->isCPPinterface()) -+ return RECORD_IS_INTERFACE; -+ -+ return RECORD_IS_CLASS; -+ } -+ -+ return RECORD_IS_STRUCT; -+} -+ -+ - struct lang_type * - build_d_type_lang_specific (Type *t) - { -- unsigned sz = sizeof (struct lang_type); -+ unsigned sz = sizeof (lang_type); - struct lang_type *lt = ggc_alloc_cleared_lang_type (sz); - lt->d_type = t; - return lt; -@@ -1559,14 +1629,14 @@ build_d_type_lang_specific (Type *t) - struct lang_decl * - build_d_decl_lang_specific (Declaration *d) - { -- unsigned sz = sizeof (struct lang_decl); -+ unsigned sz = sizeof (lang_decl); - struct lang_decl *ld = ggc_alloc_cleared_lang_decl (sz); - ld->d_decl = d; - return ld; - } - - --// This preserves tree we create from the garbage collector. -+// This preserves trees we create from the garbage collector. - tree d_keep_list = NULL_TREE; - - void -@@ -1592,11 +1662,16 @@ d_eh_personality (void) - static tree - d_build_eh_type_type (tree type) - { -- TypeClass *d_type = (TypeClass *) build_dtype (type); -- gcc_assert (d_type); -- d_type = (TypeClass *) d_type->toBasetype(); -- gcc_assert (d_type->ty == Tclass); -- return build_address (d_type->sym->toSymbol()->Stree); -+ Type *dtype = build_dtype (type); -+ Symbol *sym; -+ -+ if (dtype) -+ dtype = dtype->toBasetype(); -+ -+ gcc_assert (dtype && dtype->ty == Tclass); -+ sym = ((TypeClass *) dtype)->sym->toSymbol(); -+ -+ return convert (ptr_type_node, build_address (sym->Stree)); - } - - void ---- a/src/gcc/d/d-lang.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-lang.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* d-lang.h -- D frontend for GCC. -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free -@@ -34,16 +34,16 @@ struct GTY(()) language_function - - /* The D front end types have not been integrated into the GCC garbage - collection system. Handle this by using the "skip" attribute. */ --struct Declaration; --typedef struct Declaration *DeclarationGTYP; -+class Declaration; -+typedef Declaration *DeclarationGTYP; - struct GTY(()) lang_decl - { - DeclarationGTYP GTY((skip)) d_decl; - }; - - /* The lang_type field is not set for every GCC type. */ --struct Type; --typedef struct Type *TypeGTYP; -+class Type; -+typedef Type *TypeGTYP; - struct GTY((variable_size)) lang_type - { - TypeGTYP GTY((skip)) d_type; -@@ -58,7 +58,7 @@ lang_tree_node - { - union tree_node GTY((tag ("0"), - desc ("tree_node_structure (&%h)"))) generic; -- struct lang_identifier GTY((tag ("1"))) identifier; -+ lang_identifier GTY((tag ("1"))) identifier; - }; - - extern GTY(()) tree d_eh_personality_decl; -@@ -104,11 +104,11 @@ struct GTY(()) binding_level - tree this_block; - - /* The binding level this one is contained in. */ -- struct binding_level *level_chain; -+ binding_level *level_chain; - }; - --extern GTY(()) struct binding_level *current_binding_level; --extern GTY(()) struct binding_level *global_binding_level; -+extern GTY(()) binding_level *current_binding_level; -+extern GTY(()) binding_level *global_binding_level; - - enum d_tree_index - { -@@ -166,7 +166,7 @@ extern GTY(()) tree d_global_trees[DTI_M - tree d_truthvalue_conversion (tree); - void d_add_global_declaration (tree); - --struct Module; -+class Module; - Module *d_gcc_get_output_module (void); - - struct lang_type *build_d_type_lang_specific (Type *t); -@@ -182,9 +182,9 @@ extern void add_import_paths (bool stdin - extern void add_phobos_versyms (void); - - /* In d-lang.cc */ --extern tree pushdecl (tree); --extern void pushlevel (int); --extern tree poplevel (int, int, int); -+extern tree d_pushdecl (tree); -+extern void push_binding_level (void); -+extern tree pop_binding_level (int, int); - - extern void init_global_binding_level (void); - extern void set_decl_binding_chain (tree decl_chain); -@@ -197,35 +197,32 @@ extern void d_init_exceptions (void); - extern void d_keep (tree t); - extern void d_free (tree t); - --extern bool global_bindings_p (void); --extern void insert_block (tree); - extern void set_block (tree); --extern tree getdecls (void); - - - /* In d-builtins.c */ --extern const struct attribute_spec d_builtins_attribute_table[]; --extern const struct attribute_spec d_attribute_table[]; --extern const struct attribute_spec d_format_attribute_table[]; -+extern const attribute_spec d_builtins_attribute_table[]; -+extern const attribute_spec d_attribute_table[]; -+extern const attribute_spec d_format_attribute_table[]; - tree d_builtin_function (tree); - void d_init_builtins (void); - void d_register_builtin_type (tree, const char *); - void d_backend_init (void); - void d_backend_term (void); - --void d_bi_builtin_func (tree); --void d_bi_builtin_type (tree); -- - bool is_intrinsic_module_p (Module *); - bool is_math_module_p (Module *); - --struct Dsymbol; -+class Dsymbol; - bool is_builtin_va_arg_p (Dsymbol *, bool); - bool is_builtin_va_start_p (Dsymbol *); - - /* protect from garbage collection */ - extern GTY(()) tree d_keep_list; - -+// Array of all global declarations to pass back to the middle-end. -+extern GTY(()) vec<tree, va_gc> *global_declarations; -+ - #include "d-dmd-gcc.h" - - #endif ---- a/src/gcc/d/d-longdouble.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-longdouble.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-longdouble.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -27,7 +27,7 @@ - - // Return backend machine_mode for frontend mode MODE. - --static enum machine_mode -+static machine_mode - machineMode (longdouble::Mode mode) - { - switch (mode) -@@ -55,14 +55,14 @@ real_properties real_limits[longdouble:: - void - longdouble::init (void) - { -- gcc_assert (sizeof (longdouble) >= sizeof (REAL_VALUE_TYPE)); -+ gcc_assert (sizeof (longdouble) >= sizeof (real_value)); - - for (int i = (int) Float; i < (int) NumModes; i++) - { - real_properties& p = real_limits[i]; - -- enum machine_mode mode = machineMode ((Mode) i); -- const struct real_format& rf = *REAL_MODE_FORMAT (mode); -+ machine_mode mode = machineMode ((Mode) i); -+ const real_format& rf = *REAL_MODE_FORMAT (mode); - char buf[128]; - - /* .max: -@@ -109,143 +109,199 @@ longdouble::init (void) - } - } - --// Return a longdouble value from string STR of type MODE. -+// Return the hidden real_value from the longdouble type. - --longdouble --longdouble::parse (const char *str, Mode mode) --{ -- longdouble r; -- real_from_string3 (&r.rv(), str, machineMode (mode)); -- return r; --} -- --// Return the hidden REAL_VALUE_TYPE from the longdouble type. -- --const REAL_VALUE_TYPE & -+const real_value & - longdouble::rv (void) const - { -- const REAL_VALUE_TYPE *r = (const REAL_VALUE_TYPE *) &this->frv_; -- return *r; -+ return *(const real_value *) this; - } - --REAL_VALUE_TYPE & -+real_value & - longdouble::rv (void) - { -- REAL_VALUE_TYPE *r = (REAL_VALUE_TYPE *) &this->frv_; -- return *r; -+ return *(real_value *) this; - } - --// Construct a new longdouble from longdouble value R. -+// Return conversion of signed integer value D to longdouble. -+// Conversion is done at precision mode of TYPE. - --longdouble::longdouble (const longdouble& r) -+longdouble -+longdouble::from_shwi (Type *type, int64_t d) - { -- rv() = r.rv(); -+ double_int cst = double_int::from_shwi (d); -+ REAL_VALUE_FROM_INT (rv(), cst.low, cst.high, TYPE_MODE (type->toCtype())); -+ return *this; - } - --// Construct a new longdouble from REAL_VALUE_TYPE RV. -+// Return conversion of unsigned integer value D to longdouble. -+// Conversion is done at precision mode of TYPE. - --longdouble::longdouble (const REAL_VALUE_TYPE& rv) -+longdouble -+longdouble::from_uhwi (Type *type, uint64_t d) - { -- real_convert (&this->rv(), TYPE_MODE (long_double_type_node), &rv); -+ double_int cst = double_int::from_uhwi (d); -+ REAL_VALUE_FROM_UNSIGNED_INT (rv(), cst.low, cst.high, TYPE_MODE (type->toCtype())); -+ return *this; - } - --// Construct a new longdouble from int V. -+// Return conversion of longdouble value to int64_t. -+// Conversion is done at precision mode of TYPE. - --longdouble::longdouble (int v) -+int64_t -+longdouble::to_shwi (Type *type) const - { -- REAL_VALUE_FROM_INT (rv(), v, (v < 0) ? -1 : 0, TYPE_MODE (double_type_node)); -+ double_int cst; -+ -+ if (REAL_VALUE_ISNAN (rv())) -+ { -+ cst.low = 0; -+ cst.high = 0; -+ } -+ else -+ { -+ tree t = fold_build1 (FIX_TRUNC_EXPR, type->toCtype(), -+ build_float_cst (*this, Type::tfloat64)); -+ cst = TREE_INT_CST (t); -+ } -+ -+ return cst_to_hwi (cst); - } - --// Construct a new longdouble from uint64_t V. -+// Same as longdouble::to_shwi, but returns a uint64_t. - --longdouble::longdouble (uint64_t v) -+uint64_t -+longdouble::to_uhwi (Type *type) const - { -- REAL_VALUE_FROM_UNSIGNED_INT (rv(), v, 0, TYPE_MODE (long_double_type_node)); -+ return (uint64_t) to_shwi (type); - } - --// Construct a new longdouble from int64_t V. -+// Helper functions which set longdouble to value D. -+ -+void -+longdouble::set (real_value& r) -+{ -+ real_convert (&rv(), TYPE_MODE (long_double_type_node), &r); -+} - --longdouble::longdouble (int64_t v) -+longdouble::operator -+real_value& (void) - { -- REAL_VALUE_FROM_INT (rv(), v, (v < 0) ? -1 : 0, TYPE_MODE (long_double_type_node)); -+ return rv(); - } - --// Construct a new longdouble from double D. -+// Conversion routines between longdouble and host float types. - --longdouble::longdouble (double d) -+void -+longdouble::set (float d) - { -- char buf[48]; -+ char buf[32]; -+ snprintf(buf, sizeof (buf), "%f", d); -+ real_from_string3 (&rv(), buf, TYPE_MODE (double_type_node)); -+} -+ -+void -+longdouble::set (double d) -+{ -+ char buf[32]; - snprintf(buf, sizeof (buf), "%lf", d); - real_from_string3 (&rv(), buf, TYPE_MODE (long_double_type_node)); - } - --// Overload assignment operator for longdouble types. -+// These functions should never be called. - --longdouble & --longdouble::operator= (const longdouble& r) -+longdouble::operator -+float (void) - { -- rv() = r.rv(); -- return *this; -+ gcc_unreachable(); - } - --longdouble & --longdouble::operator= (int v) -+longdouble::operator -+double (void) - { -- REAL_VALUE_FROM_UNSIGNED_INT (rv(), v, (v < 0) ? -1 : 0, TYPE_MODE (double_type_node)); -- return *this; -+ gcc_unreachable(); - } - --// Overload numeric operators for longdouble types. -+// For conversion between boolean, only need to check if is zero. - --longdouble --longdouble::operator+ (const longdouble& r) -+void -+longdouble::set (bool d) - { -- REAL_VALUE_TYPE x; -- REAL_ARITHMETIC (x, PLUS_EXPR, rv(), r.rv()); -- return longdouble (x); -+ rv() = (d == false) ? dconst0 : dconst1; -+} -+ -+longdouble::operator -+bool (void) -+{ -+ return rv().cl != rvc_zero; - } - -+// Conversion routines between longdouble and integer types. -+ -+void longdouble::set (int8_t d) { from_shwi (Type::tfloat32, d); } -+void longdouble::set (int16_t d) { from_shwi (Type::tfloat32, d); } -+void longdouble::set (int32_t d) { from_shwi (Type::tfloat64, d); } -+void longdouble::set (int64_t d) { from_shwi (Type::tfloat80, d); } -+ -+longdouble::operator int8_t (void) { return to_shwi (Type::tint8); } -+longdouble::operator int16_t (void) { return to_shwi (Type::tint16); } -+longdouble::operator int32_t (void) { return to_shwi (Type::tint32); } -+longdouble::operator int64_t (void) { return to_shwi (Type::tint64); } -+ -+void longdouble::set (uint8_t d) { from_uhwi (Type::tfloat32, d); } -+void longdouble::set (uint16_t d) { from_uhwi (Type::tfloat32, d); } -+void longdouble::set (uint32_t d) { from_uhwi (Type::tfloat64, d); } -+void longdouble::set (uint64_t d) { from_uhwi (Type::tfloat80, d); } -+ -+longdouble::operator uint8_t (void) { return to_uhwi (Type::tuns8); } -+longdouble::operator uint16_t (void) { return to_uhwi (Type::tuns16); } -+longdouble::operator uint32_t (void) { return to_uhwi (Type::tuns32); } -+longdouble::operator uint64_t (void) { return to_uhwi (Type::tuns64); } -+ -+// Overload numeric operators for longdouble types. -+ - longdouble --longdouble::operator- (const longdouble& r) -+longdouble::operator + (const longdouble& r) - { -- REAL_VALUE_TYPE x; -- REAL_ARITHMETIC (x, MINUS_EXPR, rv(), r.rv()); -- return longdouble (x); -+ real_value x; -+ REAL_ARITHMETIC (x, PLUS_EXPR, rv(), r.rv()); -+ return ldouble (x); - } - - longdouble --longdouble::operator- (void) -+longdouble::operator - (const longdouble& r) - { -- REAL_VALUE_TYPE x = real_value_negate (&rv()); -- return longdouble (x); -+ real_value x; -+ REAL_ARITHMETIC (x, MINUS_EXPR, rv(), r.rv()); -+ return ldouble (x); - } - - longdouble --longdouble::operator* (const longdouble& r) -+longdouble::operator * (const longdouble& r) - { -- REAL_VALUE_TYPE x; -+ real_value x; - REAL_ARITHMETIC (x, MULT_EXPR, rv(), r.rv()); -- return longdouble (x); -+ return ldouble (x); - } - - longdouble --longdouble::operator/ (const longdouble& r) -+longdouble::operator / (const longdouble& r) - { -- REAL_VALUE_TYPE x; -+ real_value x; - REAL_ARITHMETIC (x, RDIV_EXPR, rv(), r.rv()); -- return longdouble (x); -+ return ldouble (x); - } - - longdouble --longdouble::operator% (const longdouble& r) -+longdouble::operator % (const longdouble& r) - { -- REAL_VALUE_TYPE q, x; -+ real_value q, x; - - if (r.rv().cl == rvc_zero || REAL_VALUE_ISINF (rv())) - { -- REAL_VALUE_TYPE rvt; -+ real_value rvt; - real_nan (&rvt, "", 1, TYPE_MODE (long_double_type_node)); -- return longdouble (rvt); -+ return ldouble (rvt); - } - - if (rv().cl == rvc_zero) -@@ -260,110 +316,54 @@ longdouble::operator% (const longdouble& - REAL_ARITHMETIC (q, MULT_EXPR, q, r.rv()); - REAL_ARITHMETIC (x, MINUS_EXPR, rv(), q); - -- return longdouble (x); -+ return ldouble (x); -+} -+ -+longdouble -+longdouble::operator - (void) -+{ -+ real_value x = real_value_negate (&rv()); -+ return ldouble (x); - } - - // Overload equality operators for longdouble types. - - bool --longdouble::operator< (const longdouble& r) -+longdouble::operator < (const longdouble& r) - { - return real_compare (LT_EXPR, &rv(), &r.rv()); - } - - bool --longdouble::operator> (const longdouble& r) -+longdouble::operator > (const longdouble& r) - { - return real_compare (GT_EXPR, &rv(), &r.rv()); - } - - bool --longdouble::operator<= (const longdouble& r) -+longdouble::operator <= (const longdouble& r) - { - return real_compare (LE_EXPR, &rv(), &r.rv()); - } - - bool --longdouble::operator>= (const longdouble& r) -+longdouble::operator >= (const longdouble& r) - { - return real_compare (GE_EXPR, &rv(), &r.rv()); - } - - bool --longdouble::operator== (const longdouble& r) -+longdouble::operator == (const longdouble& r) - { - return real_compare (EQ_EXPR, &rv(), &r.rv()); - } - - bool --longdouble::operator!= (const longdouble& r) -+longdouble::operator != (const longdouble& r) - { - return real_compare (NE_EXPR, &rv(), &r.rv()); - } - --// Return conversion of longdouble value to uint64_t. -- --uint64_t --longdouble::toInt (void) const --{ -- HOST_WIDE_INT low, high; -- REAL_VALUE_TYPE r; -- -- r = rv(); -- if (REAL_VALUE_ISNAN (r)) -- low = high = 0; -- else -- REAL_VALUE_TO_INT (&low, &high, r); -- -- return cst_to_hwi (double_int::from_pair (high, low)); --} -- --// Return conversion of longdouble value to uint64_t. --// Value is converted from real type RT to int type IT. -- --uint64_t --longdouble::toInt (Type *rt, Type *it) const --{ -- tree t; -- double_int cst; -- REAL_VALUE_TYPE r = rv(); -- -- if (REAL_VALUE_ISNAN (r)) -- cst.low = cst.high = 0; -- else -- { -- t = fold_build1 (FIX_TRUNC_EXPR, it->toCtype(), -- build_float_cst (r, rt->toBasetype())); -- // can't use tree_low_cst as it asserts !TREE_OVERFLOW -- cst = TREE_INT_CST (t); -- } -- return cst_to_hwi (cst); --} -- --// Returns TRUE if longdouble value is zero. -- --bool --longdouble::isZero (void) --{ -- return rv().cl == rvc_zero; --} -- --// Returns TRUE if longdouble value is negative. -- --bool --longdouble::isNegative (void) --{ -- return REAL_VALUE_NEGATIVE (rv()); --} -- --// Returns TRUE if longdouble value is identical to R. -- --bool --longdouble::isIdenticalTo (const longdouble& r) const --{ -- return REAL_VALUES_IDENTICAL (rv(), r.rv()); --} -- - // Format longdouble value into decimal string BUF of size BUF_SIZE. - - int -@@ -390,6 +390,6 @@ longdouble::dump (void) - { - char buf[128]; - format (buf, sizeof (buf)); -- fprintf (stderr, "%s\n", buf); -+ fprintf (global.stdmsg, "%s\n", buf); - } - ---- a/src/gcc/d/d-objfile.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-objfile.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-objfile.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -16,25 +16,56 @@ - // <http://www.gnu.org/licenses/>. - - #include "d-system.h" -+#include "debug.h" -+ - #include "d-lang.h" - #include "d-codegen.h" - - #include "attrib.h" - #include "enum.h" - #include "id.h" -+#include "import.h" - #include "init.h" - #include "module.h" - #include "template.h" - #include "dfrontend/target.h" - - --ModuleInfo *ObjectFile::moduleInfo; --Modules ObjectFile::modules; --unsigned ObjectFile::moduleSearchIndex; --DeferredThunks ObjectFile::deferredThunks; --FuncDeclarations ObjectFile::staticCtorList; --FuncDeclarations ObjectFile::staticDtorList; --TemplateEmission ObjectFile::emitTemplates; -+// Module info. Assuming only one module per run of the compiler. -+ModuleInfo *current_module_info; -+ -+// static constructors (not D static constructors) -+static vec<FuncDeclaration *> static_ctor_list; -+static vec<FuncDeclaration *> static_dtor_list; -+ -+static FuncDeclaration *build_call_function (const char *, vec<FuncDeclaration *>, bool); -+static Symbol *build_ctor_function (const char *, vec<FuncDeclaration *>, vec<VarDeclaration *>); -+static Symbol *build_dtor_function (const char *, vec<FuncDeclaration *>); -+static Symbol *build_unittest_function (const char *, vec<FuncDeclaration *>); -+ -+ModuleInfo::ModuleInfo (void) -+{ -+ this->classes = vNULL; -+ this->ctors = vNULL; -+ this->dtors = vNULL; -+ this->ctorgates = vNULL; -+ this->sharedctors = vNULL; -+ this->shareddtors = vNULL; -+ this->sharedctorgates = vNULL; -+ this->unitTests = vNULL; -+} -+ -+ModuleInfo::~ModuleInfo (void) -+{ -+ this->classes.release(); -+ this->ctors.release(); -+ this->dtors.release(); -+ this->ctorgates.release(); -+ this->sharedctors.release(); -+ this->shareddtors.release(); -+ this->sharedctorgates.release(); -+ this->unitTests.release(); -+} - - // Construct a new Symbol. - -@@ -52,23 +83,86 @@ Symbol::Symbol (void) - this->SframeField = NULL_TREE; - this->SnamedResult = NULL_TREE; - -- this->outputStage = NotStarted; - this->frameInfo = NULL; -+ this->thunks = vNULL; - } - -+Symbol::~Symbol (void) -+{ -+ this->thunks.release(); -+} - - void - Dsymbol::toObjFile (int) - { -- TupleDeclaration *td = this->isTupleDeclaration(); -+ // Emit the imported symbol to debug. -+ Import *imp = this->isImport(); - -- if (!td) -- return; -+ if (imp != NULL) -+ { -+ // Implements import declarations by telling the debug backend we are -+ // importing the NAMESPACE_DECL of the module or IMPORTED_DECL of the -+ // declaration into the current lexical scope CONTEXT. NAME is set if -+ // this is a renamed import. -+ -+ if (imp->isstatic) -+ return; -+ -+ IRState *irs = current_irstate; -+ Module *mod = current_module_decl; -+ tree context; -+ -+ // Get the context of this import, this should never be null. -+ if (irs->func != NULL) -+ context = irs->func->toSymbol()->Stree; -+ else -+ context = mod->toImport()->Stree; -+ -+ if (imp->ident == NULL) -+ { -+ // Importing declaration list. -+ for (size_t i = 0; i < imp->names.dim; i++) -+ { -+ AliasDeclaration *aliasdecl = imp->aliasdecls[i]; -+ Dsymbol *dsym = aliasdecl->toAlias(); -+ Identifier *alias = imp->aliases[i]; -+ -+ // Skip over importing of aliases and templates. -+ if (dsym == aliasdecl || !dsym->isDeclaration()) -+ continue; -+ -+ tree decl = dsym->toImport()->Stree; -+ set_decl_location (decl, imp); -+ -+ tree name = (alias != NULL) -+ ? get_identifier (alias->string) : NULL_TREE; -+ -+ (*debug_hooks->imported_module_or_decl) (decl, name, context, false); -+ } -+ } -+ else -+ { -+ // Importing the entire module. -+ tree decl = imp->mod->toImport()->Stree; -+ set_input_location (imp); -+ -+ tree name = (imp->aliasId != NULL) -+ ? name = get_identifier (imp->aliasId->string) : NULL_TREE; -+ -+ (*debug_hooks->imported_module_or_decl) (decl, name, context, false); -+ } -+ -+ return; -+ } - - // Emit local variables for tuples. -+ TupleDeclaration *td = this->isTupleDeclaration(); -+ if (td == NULL) -+ return; -+ - for (size_t i = 0; i < td->objects->dim; i++) - { -- Object *o = (*td->objects)[i]; -+ RootObject *o = (*td->objects)[i]; - if ((o->dyncast() == DYNCAST_EXPRESSION) && ((Expression *) o)->op == TOKdsymbol) - { - Declaration *d = ((DsymbolExp *) o)->s->isDeclaration(); -@@ -142,6 +236,13 @@ StructDeclaration::toObjFile (int) - // be put in separate object files. - member->toObjFile (0); - } -+ -+ // Put out xopEquals and xopCmp -+ if (xeq && xeq != xerreq) -+ xeq->toObjFile (0); -+ -+ if (xcmp && xcmp != xerrcmp) -+ xcmp->toObjFile (0); - } - - void -@@ -181,13 +282,13 @@ ClassDeclaration::toObjFile (int) - - // must be ClassInfo.size - size_t offset = CLASSINFO_SIZE; -- if (classinfo->structsize != offset) -+ if (Type::typeinfoclass->structsize != offset) - { - error ("mismatch between compiler and object.d or object.di found. Check installation and import paths."); - gcc_unreachable(); - } - -- /* Put out the ClassInfo. -+ /* Put out the ClassInfo. - * The layout is: - * void **vptr; - * monitor_t monitor; -@@ -198,7 +299,7 @@ ClassDeclaration::toObjFile (int) - * Object *base; // base class - * void *destructor; - * void *invariant; // class invariant -- * uint flags; -+ * ClassFlags flags; - * void *deallocator; - * OffsetTypeInfo[] offTi; - * void *defaultConstructor; -@@ -206,10 +307,10 @@ ClassDeclaration::toObjFile (int) - */ - tree dt = NULL_TREE; - -- build_vptr_monitor (&dt, classinfo); -+ build_vptr_monitor (&dt, Type::typeinfoclass); - - // initializer[] -- gcc_assert (structsize >= 8); -+ gcc_assert (structsize >= 8 || (cpp && structsize >= 4)); - dt_cons (&dt, d_array_value (Type::tint8->arrayOf()->toCtype(), - size_int (structsize), - build_address (sinit->Stree))); -@@ -255,24 +356,37 @@ ClassDeclaration::toObjFile (int) - dt_cons (&dt, d_null_pointer); - - // flags -- size_t flags = (4 | isCOMclass() | 16 | 32); -+ ClassFlags::Type flags = ClassFlags::hasOffTi; -+ -+ if (isCOMclass()) -+ flags |= ClassFlags::isCOMclass; -+ -+ if (isCPPclass()) -+ flags |= ClassFlags::isCPPclass; -+ -+ flags |= ClassFlags::hasGetMembers; -+ flags |= ClassFlags::hasTypeInfo; -+ - if (ctor) -- flags |= 8; -+ flags |= ClassFlags::hasCtor; -+ - if (isabstract) -- flags |= 64; -+ flags |= ClassFlags::isAbstract; -+ - for (ClassDeclaration *cd = this; cd; cd = cd->baseClass) - { -- if (cd->members) -+ if (!cd->members) -+ continue; -+ -+ for (size_t i = 0; i < cd->members->dim; i++) - { -- for (size_t i = 0; i < cd->members->dim; i++) -- { -- Dsymbol *sm = (*cd->members)[i]; -- if (sm->hasPointers()) -- goto Lhaspointers; -- } -+ Dsymbol *sm = (*cd->members)[i]; -+ if (sm->hasPointers()) -+ goto Lhaspointers; - } - } -- flags |= 2; -+ -+ flags |= ClassFlags::noPointers; - - Lhaspointers: - dt_cons (&dt, size_int (flags)); -@@ -299,7 +413,7 @@ Lhaspointers: - else - { - // If class has no pointers. -- if (flags & 2) -+ if (flags & ClassFlags::noPointers) - dt_cons (&dt, size_int (0)); - else - dt_cons (&dt, size_int (1)); -@@ -309,7 +423,7 @@ Lhaspointers: - * The layout is: - * TypeInfo_Class typeinfo; - * void*[] vtbl; -- * ptrdiff_t offset; -+ * size_t offset; - */ - offset += vtblInterfaces->dim * (4 * Target::ptrsize); - for (size_t i = 0; i < vtblInterfaces->dim; i++) -@@ -399,9 +513,10 @@ Lhaspointers: - dt = NULL_TREE; - - // first entry is ClassInfo reference -- dt_cons (&dt, build_address (csym->Stree)); -+ if (vtblOffset()) -+ dt_cons (&dt, build_address (csym->Stree)); - -- for (size_t i = 1; i < vtbl.dim; i++) -+ for (size_t i = vtblOffset(); i < vtbl.dim; i++) - { - FuncDeclaration *fd = vtbl[i]->isFuncDeclaration(); - -@@ -413,7 +528,7 @@ Lhaspointers: - if (!isFuncHidden (fd)) - goto Lcontinue; - -- // If fd overlaps with any function in the vtbl[], then -+ // If fd overlaps with any function in the vtbl[], then - // issue 'hidden' error. - for (size_t j = 1; j < vtbl.dim; j++) - { -@@ -517,7 +632,7 @@ InterfaceDeclaration::toObjFile (int) - type->getTypeInfo (NULL); - type->vtinfo->toObjFile (0); - -- /* Put out the ClassInfo. -+ /* Put out the ClassInfo. - * The layout is: - * void **vptr; - * monitor_t monitor; -@@ -536,7 +651,7 @@ InterfaceDeclaration::toObjFile (int) - */ - tree dt = NULL_TREE; - -- build_vptr_monitor (&dt, classinfo); -+ build_vptr_monitor (&dt, Type::typeinfoclass); - - // initializer[] - dt_cons (&dt, d_array_value (Type::tint8->arrayOf()->toCtype(), -@@ -554,7 +669,7 @@ InterfaceDeclaration::toObjFile (int) - { - // must be ClassInfo.size - size_t offset = CLASSINFO_SIZE; -- if (classinfo->structsize != offset) -+ if (Type::typeinfoclass->structsize != offset) - { - error ("mismatch between compiler and object.d or object.di found. Check installation and import paths."); - gcc_unreachable(); -@@ -574,7 +689,13 @@ InterfaceDeclaration::toObjFile (int) - dt_cons (&dt, d_null_pointer); - - // flags -- dt_cons (&dt, size_int (4 | isCOMinterface() | 32)); -+ ClassFlags::Type flags = ClassFlags::hasOffTi; -+ flags |= ClassFlags::hasTypeInfo; -+ -+ if (isCOMinterface()) -+ flags |= ClassFlags::isCOMclass; -+ -+ dt_cons (&dt, size_int (flags)); - - // deallocator* - dt_cons (&dt, d_null_pointer); -@@ -583,15 +704,20 @@ InterfaceDeclaration::toObjFile (int) - dt_cons (&dt, d_array_value (Type::tuns8->arrayOf()->toCtype(), - size_int (0), d_null_pointer)); - -- // defaultConstructor*, xgetRTInfo* -+ // defaultConstructor* - dt_cons (&dt, d_null_pointer); -- dt_cons (&dt, size_int (0x12345678)); -+ -+ // xgetRTInfo* -+ if (getRTInfo) -+ getRTInfo->toDt (&dt); -+ else -+ dt_cons (&dt, size_int (0)); - - /* Put out (*vtblInterfaces)[]. Must immediately follow csym. - * The layout is: - * TypeInfo_Class typeinfo; - * void*[] vtbl; -- * ptrdiff_t offset; -+ * size_t offset; - */ - for (size_t i = 0; i < vtblInterfaces->dim; i++) - { -@@ -616,10 +742,10 @@ InterfaceDeclaration::toObjFile (int) - void - EnumDeclaration::toObjFile (int) - { -- if (objFileDone) -+ if (semanticRun >= PASSobj) - return; - -- if (type->ty == Terror) -+ if (errors || type->ty == Terror) - { - error ("had semantic errors when compiling"); - return; -@@ -632,10 +758,10 @@ EnumDeclaration::toObjFile (int) - toDebug(); - - // Generate TypeInfo -- type->getTypeInfo(NULL); -+ type->getTypeInfo (NULL); - - TypeEnum *tc = (TypeEnum *) type; -- if (tc->sym->defaultval && !type->isZeroInit()) -+ if (tc->sym->members && !type->isZeroInit()) - { - // Generate static initialiser - toInitializer(); -@@ -643,7 +769,7 @@ EnumDeclaration::toObjFile (int) - d_finish_symbol (sinit); - } - -- objFileDone = true; -+ semanticRun = PASSobj; - } - - void -@@ -661,11 +787,27 @@ VarDeclaration::toObjFile (int) - return; - } - -- // Do not store variables we cannot take the address of -+ // Do not store variables we cannot take the address of, -+ // but keep the values for purposes of debugging. - if (!canTakeAddressOf()) -- return; -+ { -+ // CONST_DECL was initially intended for enumerals and may -+ // be used for scalars in general but not for aggregates. -+ if (!type->isscalar()) -+ return; - -- if (isDataseg() && !(storage_class & STCextern)) -+ tree decl = toSymbol()->Stree; -+ gcc_assert (init && !init->isVoidInitializer()); -+ -+ Expression *ie = init->toExpression(); -+ tree sinit = NULL_TREE; -+ ie->toDt (&sinit); -+ DECL_INITIAL (decl) = dtvector_to_tree (sinit); -+ -+ d_pushdecl (decl); -+ rest_of_decl_compilation (decl, 1, 0); -+ } -+ else if (isDataseg() && !(storage_class & STCextern)) - { - Symbol *s = toSymbol(); - size_t sz = type->size(); -@@ -699,7 +841,28 @@ VarDeclaration::toObjFile (int) - // local variables of a function. Otherwise, it would be - // enough to make a check for isVarDeclaration() in - // DeclarationExp::toElem. -- cirstate->emitLocalVar (this); -+ if (!isDataseg() && !isMember()) -+ { -+ IRState *irs = current_irstate; -+ build_local_var (this, toParent2()->isFuncDeclaration()); -+ -+ if (init) -+ { -+ if (!init->isVoidInitializer()) -+ { -+ ExpInitializer *vinit = init->isExpInitializer(); -+ Expression *ie = vinit->toExpression(); -+ tree exp = ie->toElem (irs); -+ irs->addExp (exp); -+ } -+ else if (size (loc) != 0) -+ { -+ // Zero-length arrays do not have an initializer. -+ warning (OPT_Wuninitialized, "uninitialized variable '%s'", -+ ident ? ident->string : "(no name)"); -+ } -+ } -+ } - } - } - -@@ -716,7 +879,7 @@ TypedefDeclaration::toObjFile (int) - toDebug(); - - // Generate TypeInfo -- type->getTypeInfo(NULL); -+ type->getTypeInfo (NULL); - - TypeTypedef *tc = (TypeTypedef *) type; - if (tc->sym->init && !type->isZeroInit()) -@@ -767,6 +930,9 @@ Module::genmoduleinfo() - ClassDeclarations aclasses; - FuncDeclaration *sgetmembers; - -+ if (Module::moduleinfo == NULL) -+ ObjectNotFound (Id::ModuleInfo); -+ - for (size_t i = 0; i < members->dim; i++) - { - Dsymbol *member = (*members)[i]; -@@ -783,7 +949,7 @@ Module::genmoduleinfo() - - sgetmembers = findGetMembers(); - -- size_t flags = MInew; -+ size_t flags = 0; - if (sctor) - flags |= MItlsctor; - if (sdtor) -@@ -802,10 +968,11 @@ Module::genmoduleinfo() - flags |= MIimportedModules; - if (aclasses.dim) - flags |= MIlocalClasses; -- - if (!needmoduleinfo) - flags |= MIstandalone; - -+ flags |= MIname; -+ - /* Put out: - * uint flags; - * uint index; -@@ -823,7 +990,7 @@ Module::genmoduleinfo() - * void function() unitTest; - * ModuleInfo*[] importedModules; - * TypeInfo_Class[] localClasses; -- * string name; -+ * char[N] name; - */ - if (flags & MItlsctor) - dt_cons (&dt, build_address (sctor->Stree)); -@@ -867,8 +1034,15 @@ Module::genmoduleinfo() - } - } - -- // Put out module name as a 0-terminated string, to save bytes -- dt_cons (&dt, d_array_string (toPrettyChars())); -+ if (flags & MIname) -+ { -+ // Put out module name as a 0-terminated C-string, to save bytes -+ const char *name = toPrettyChars(); -+ size_t namelen = strlen (name) + 1; -+ tree strtree = build_string (namelen, name); -+ TREE_TYPE (strtree) = d_array_type (Type::tchar, namelen); -+ dt_cons (&dt, strtree); -+ } - - csym->Sdt = dt; - d_finish_symbol (csym); -@@ -876,6 +1050,109 @@ Module::genmoduleinfo() - build_moduleinfo (msym); - } - -+// Returns TRUE if we want to compile the instantiated template TI. -+ -+static bool -+output_template_p (TemplateInstance *ti) -+{ -+ // Only templates are handled here. -+ if (ti == NULL) -+ return true; -+ -+ if (!global.params.useUnitTests -+ && !global.params.allInst -+ && !global.params.debuglevel -+ && ti->instantiatingModule -+ && !ti->instantiatingModule->isRoot()) -+ { -+ Module *mi = ti->instantiatingModule; -+ bool importsRoot = false; -+ -+ // If mi imports any root modules, we still need to generate the code. -+ for (size_t i = 0; i < Module::amodules.dim; ++i) -+ { -+ Module *m = Module::amodules[i]; -+ m->insearch = 0; -+ } -+ -+ for (size_t i = 0; i < Module::amodules.dim; ++i) -+ { -+ Module *m = Module::amodules[i]; -+ if (m->isRoot() && mi->imports(m)) -+ { -+ importsRoot = true; -+ break; -+ } -+ } -+ -+ for (size_t i = 0; i < Module::amodules.dim; ++i) -+ { -+ Module *m = Module::amodules[i]; -+ m->insearch = 0; -+ } -+ -+ if (!importsRoot) -+ return false; -+ } -+ -+ return true; -+} -+ -+// Returns true if we want to compile the declaration DSYM. -+ -+static bool -+output_declaration_p (Declaration *dsym) -+{ -+ // If errors occurred compiling it. -+ if (dsym->type->ty == Tfunction && ((TypeFunction *) dsym->type)->next->ty == Terror) -+ return false; -+ -+ FuncDeclaration *fd = dsym->isFuncDeclaration(); -+ -+ if (fd != NULL) -+ { -+ // If have already started emitting, continue doing so. -+ if (fd->semanticRun >= PASSobj) -+ return true; -+ -+ if (fd->isNested()) -+ { -+ // Typically, an error occurred whilst compiling -+ if (fd->fbody && !fd->vthis) -+ { -+ gcc_assert (global.errors); -+ return false; -+ } -+ } -+ -+ // Nested functions may not have its toObjFile called before the outer -+ // function is finished. GCC requires that nested functions be finished -+ // first so we need to arrange for toObjFile to be called earlier. -+ // If the parent never gets emitted, then neither will fd. -+ Dsymbol *outer = fd->toParent2(); -+ if (outer && outer->isFuncDeclaration()) -+ { -+ FuncDeclaration *fouter = (FuncDeclaration *) outer; -+ -+ if (fouter->semanticRun < PASSobj) -+ { -+ fouter->deferred.push (fd); -+ return false; -+ } -+ } -+ -+ // Skip generating code if this part of a TemplateInstance that is instantiated -+ // only by non-root modules (i.e. modules not listed on the command line). -+ if (! output_template_p (fd->inTemplateInstance())) -+ return false; -+ -+ } -+ -+ if (flag_emit_templates == TEnone) -+ return !D_DECL_IS_TEMPLATE (dsym->toSymbol()->Stree); -+ -+ return true; -+} - - // Finish up a function declaration and compile it all the way - // down to assembler language output. -@@ -886,16 +1163,14 @@ FuncDeclaration::toObjFile (int) - if (!global.params.useUnitTests && isUnitTestDeclaration()) - return; - -- if (!object_file->shouldEmit (this)) -+ // Already generated the function. -+ if (semanticRun >= PASSobj) - return; - -- Symbol *sym = toSymbol(); -- if (sym->outputStage) -+ if (!output_declaration_p (this)) - return; - -- sym->outputStage = InProgress; -- -- tree fndecl = sym->Stree; -+ tree fndecl = toSymbol()->Stree; - - if (!fbody) - { -@@ -909,10 +1184,16 @@ FuncDeclaration::toObjFile (int) - return; - } - -+ if (global.errors) -+ return; -+ -+ // Start generating code for this function. -+ gcc_assert(semanticRun == PASSsemantic3done); -+ - if (global.params.verbose) -- fprintf (stdmsg, "function %s\n", this->toPrettyChars()); -+ fprintf (global.stdmsg, "function %s\n", this->toPrettyChars()); - -- IRState *irs = cirstate->startFunction (this); -+ IRState *irs = current_irstate->startFunction (this); - // Default chain value is 'null' unless parent found. - irs->sthis = d_null_pointer; - -@@ -923,26 +1204,14 @@ FuncDeclaration::toObjFile (int) - tree return_type = TREE_TYPE (TREE_TYPE (fndecl)); - tree result_decl = build_decl (UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, return_type); - -- object_file->setDeclLoc (result_decl, this); -+ set_decl_location (result_decl, this); - DECL_RESULT (fndecl) = result_decl; - DECL_CONTEXT (result_decl) = fndecl; - DECL_ARTIFICIAL (result_decl) = 1; - DECL_IGNORED_P (result_decl) = 1; - - allocate_struct_function (fndecl, false); -- object_file->setCfunEndLoc (endloc); -- -- // Add method to record for debug information. -- if (isThis()) -- { -- AggregateDeclaration *ad = isThis(); -- tree rec = ad->type->toCtype(); -- -- if (ad->isClassDeclaration()) -- rec = TREE_TYPE (rec); -- -- object_file->addAggMethod (rec, this); -- } -+ set_function_end_locus (endloc); - - tree parm_decl = NULL_TREE; - tree param_list = NULL_TREE; -@@ -950,23 +1219,24 @@ FuncDeclaration::toObjFile (int) - // Special arguments... - - // 'this' parameter -+ // For nested functions, D still generates a vthis, but it -+ // should not be referenced in any expression. - if (vthis) - { - parm_decl = vthis->toSymbol()->Stree; -- // For nested functions, D still generates a vthis, but it -- // should not be referenced in any expression. -- if (!isThis() && isNested()) -- DECL_ARTIFICIAL (parm_decl) = 1; -- irs->sthis = parm_decl; -- object_file->setDeclLoc (parm_decl, vthis); -+ DECL_ARTIFICIAL (parm_decl) = 1; -+ TREE_READONLY (parm_decl) = 1; -+ -+ set_decl_location (parm_decl, vthis); - param_list = chainon (param_list, parm_decl); -+ irs->sthis = parm_decl; - } - - // _arguments parameter. - if (v_arguments) - { - parm_decl = v_arguments->toSymbol()->Stree; -- object_file->setDeclLoc (parm_decl, v_arguments); -+ set_decl_location (parm_decl, v_arguments); - param_list = chainon (param_list, parm_decl); - } - -@@ -977,17 +1247,15 @@ FuncDeclaration::toObjFile (int) - { - VarDeclaration *param = (*parameters)[i]; - parm_decl = param->toSymbol()->Stree; -- object_file->setDeclLoc (parm_decl, (Dsymbol *) param); -+ set_decl_location (parm_decl, (Dsymbol *) param); - // chain them in the correct order - param_list = chainon (param_list, parm_decl); - } -- DECL_ARGUMENTS (fndecl) = param_list; -- for (tree t = param_list; t; t = DECL_CHAIN (t)) -- DECL_CONTEXT (t) = fndecl; - -+ DECL_ARGUMENTS (fndecl) = param_list; - rest_of_decl_compilation (fndecl, 1, 0); - DECL_INITIAL (fndecl) = error_mark_node; -- pushlevel (0); -+ push_binding_level(); - - irs->pushStatementList(); - irs->startScope(); -@@ -1017,15 +1285,19 @@ FuncDeclaration::toObjFile (int) - } - - // May change irs->sthis. -- irs->buildChain (this); -+ this->buildClosure (irs); - - if (vresult) -- irs->emitLocalVar (vresult, true); -+ build_local_var (vresult, this); - - if (v_argptr) - irs->pushStatementList(); -+ - if (v_arguments_var) -- irs->emitLocalVar (v_arguments_var); -+ { -+ gcc_assert (v_arguments_var->init->isVoidInitializer()); -+ build_local_var (v_arguments_var, this); -+ } - - /* The fabled D named return value optimisation. - Implemented by overriding all the RETURN_EXPRs and replacing all -@@ -1051,12 +1323,11 @@ FuncDeclaration::toObjFile (int) - if (v_argptr) - { - tree body = irs->popStatementList(); -- tree var = irs->var (v_argptr); -+ tree var = get_decl_tree (v_argptr, this); - var = build_address (var); - - tree init_exp = d_build_call_nary (builtin_decl_explicit (BUILT_IN_VA_START), 2, var, parm_decl); -- v_argptr->init = NULL; // VoidInitializer? -- irs->emitLocalVar (v_argptr, true); -+ build_local_var (v_argptr, this); - irs->addExp (init_exp); - - tree cleanup = d_build_call_nary (builtin_decl_explicit (BUILT_IN_VA_END), 1, var); -@@ -1089,7 +1360,7 @@ FuncDeclaration::toObjFile (int) - append_to_statement_list_force (ret, &body); - } - -- tree block = poplevel (1, 0, 1); -+ tree block = pop_binding_level (1, 1); - DECL_INITIAL (fndecl) = block; - BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; - -@@ -1129,10 +1400,10 @@ FuncDeclaration::toObjFile (int) - } - } - -- sym->outputStage = Finished; -- - if (!errorcount && !global.errors) -- object_file->outputFunction (this); -+ d_finish_function (this); -+ -+ semanticRun = PASSobj; - - // Process all deferred nested functions. - for (size_t i = 0; i < this->deferred.dim; ++i) -@@ -1154,62 +1425,78 @@ FuncDeclaration::toObjFile (int) - // closure here, is inserted into the linked list of stack - // frames instead of the usual stack frame. - -+// If a closure is not required, but FUNC still needs a frame to lower -+// nested refs, then instead build custom static chain decl on stack. -+ - void - FuncDeclaration::buildClosure (IRState *irs) - { - FuncFrameInfo *ffi = get_frameinfo (this); -- gcc_assert (ffi->is_closure); - - if (!ffi->creates_frame) - return; - -- tree closure_rec_type = build_frame_type (this); -- gcc_assert(COMPLETE_TYPE_P (closure_rec_type)); -+ tree type = build_frame_type (this); -+ gcc_assert(COMPLETE_TYPE_P (type)); -+ -+ tree decl, decl_ref; -+ -+ if (ffi->is_closure) -+ { -+ decl = build_local_temp (build_pointer_type (type)); -+ DECL_NAME (decl) = get_identifier ("__closptr"); -+ decl_ref = build_deref (decl); -+ -+ // Allocate memory for closure. -+ tree arg = convert (Type::tsize_t->toCtype(), -+ TYPE_SIZE_UNIT (type)); -+ tree init = build_libcall (LIBCALL_ALLOCMEMORY, 1, &arg); -+ -+ DECL_INITIAL (decl) = build_nop (TREE_TYPE (decl), init); -+ } -+ else -+ { -+ decl = build_local_temp (type); -+ DECL_NAME (decl) = get_identifier ("__frame"); -+ decl_ref = decl; -+ } - -- tree closure_ptr = build_local_var (build_pointer_type (closure_rec_type)); -- DECL_NAME (closure_ptr) = get_identifier ("__closptr"); -- DECL_IGNORED_P (closure_ptr) = 0; -- -- tree arg = convert (Type::tsize_t->toCtype(), -- TYPE_SIZE_UNIT (closure_rec_type)); -- -- DECL_INITIAL (closure_ptr) = -- build_nop (TREE_TYPE (closure_ptr), -- build_libcall (LIBCALL_ALLOCMEMORY, 1, &arg)); -- irs->expandDecl (closure_ptr); -- -- // Set the first entry to the parent closure, if any -- tree chain_field = component_ref (build_deref (closure_ptr), -- TYPE_FIELDS (closure_rec_type)); -+ DECL_IGNORED_P (decl) = 0; -+ expand_decl (decl); -+ -+ // Set the first entry to the parent closure/frame, if any. -+ tree chain_field = component_ref (decl_ref, TYPE_FIELDS (type)); - tree chain_expr = vmodify_expr (chain_field, irs->sthis); - irs->addExp (chain_expr); - -- // Copy parameters that are referenced nonlocally -+ // Copy parameters that are referenced nonlocally. - for (size_t i = 0; i < closureVars.dim; i++) - { - VarDeclaration *v = closureVars[i]; -+ - if (!v->isParameter()) - continue; - - Symbol *vsym = v->toSymbol(); - -- tree closure_field = component_ref (build_deref (closure_ptr), vsym->SframeField); -- tree closure_expr = vmodify_expr (closure_field, vsym->Stree); -- irs->addExp (closure_expr); -+ tree field = component_ref (decl_ref, vsym->SframeField); -+ tree expr = vmodify_expr (field, vsym->Stree); -+ irs->addExp (expr); - } - -- irs->sthis = closure_ptr; -+ if (!ffi->is_closure) -+ decl = build_address (decl); -+ -+ irs->sthis = decl; - } - - void - Module::genobjfile (int) - { -- /* Normally would create an ObjFile here, but gcc is limited to one obj file -- per pass and there may be more than one module per obj file. */ -- gcc_assert (object_file); -- -- object_file->beginModule (this); -- object_file->setupStaticStorage (this, toSymbol()->Stree); -+ // Normally would create an ObjFile here, but gcc is limited to one object -+ // file per pass and there may be more than one module per object file. -+ current_module_info = new ModuleInfo; -+ current_module_decl = this; - - if (members) - { -@@ -1222,96 +1509,85 @@ Module::genobjfile (int) - - // Default behaviour is to always generate module info because of templates. - // Can be switched off for not compiling against runtime library. -- if (!global.params.betterC) -+ if (!global.params.betterC && ident != Id::entrypoint) - { -- ModuleInfo& mi = *object_file->moduleInfo; -- if (mi.ctors.dim || mi.ctorgates.dim) -- sctor = object_file->doCtorFunction ("*__modctor", &mi.ctors, &mi.ctorgates)->toSymbol(); -- if (mi.dtors.dim) -- sdtor = object_file->doDtorFunction ("*__moddtor", &mi.dtors)->toSymbol(); -- if (mi.sharedctors.dim || mi.sharedctorgates.dim) -- ssharedctor = object_file->doCtorFunction ("*__modsharedctor", -- &mi.sharedctors, &mi.sharedctorgates)->toSymbol(); -- if (mi.shareddtors.dim) -- sshareddtor = object_file->doDtorFunction ("*__modshareddtor", &mi.shareddtors)->toSymbol(); -- if (mi.unitTests.dim) -- stest = object_file->doUnittestFunction ("*__modtest", &mi.unitTests)->toSymbol(); -+ ModuleInfo *mi = current_module_info; - -- genmoduleinfo(); -- } -+ if (!mi->ctors.is_empty() || !mi->ctorgates.is_empty()) -+ sctor = build_ctor_function ("*__modctor", mi->ctors, mi->ctorgates); - -- object_file->endModule(); --} -+ if (!mi->dtors.is_empty()) -+ sdtor = build_dtor_function ("*__moddtor", mi->dtors); - -+ if (!mi->sharedctors.is_empty() || !mi->sharedctorgates.is_empty()) -+ ssharedctor = build_ctor_function ("*__modsharedctor", mi->sharedctors, mi->sharedctorgates); - --void --ObjectFile::beginModule (Module *m) --{ -- moduleInfo = new ModuleInfo; -- cmodule = m; --} -+ if (!mi->shareddtors.is_empty()) -+ sshareddtor = build_dtor_function ("*__modshareddtor", mi->shareddtors); - --void --ObjectFile::endModule (void) --{ -- for (size_t i = 0; i < deferredThunks.dim; i++) -- { -- DeferredThunk *t = deferredThunks[i]; -- outputThunk (t->decl, t->target, t->offset); -+ if (!mi->unitTests.is_empty()) -+ stest = build_unittest_function ("*__modtest", mi->unitTests); -+ -+ genmoduleinfo(); - } -- deferredThunks.setDim (0); -- moduleInfo = NULL; -- cmodule = NULL; -+ -+ // Finish off any thunks deferred during compilation. -+ write_deferred_thunks(); -+ -+ current_module_info = NULL; -+ current_module_decl = NULL; - } - -+// Support for multiple modules per object file. -+// Returns TRUE if module M is being compiled. -+ - bool --ObjectFile::hasModule (Module *m) -+output_module_p (Module *m) - { -- if (!m || !modules.dim) -+ static unsigned search_index = 0; -+ -+ if (!m || !output_modules.dim) - return false; - -- if (modules[moduleSearchIndex] == m) -+ if (output_modules[search_index] == m) - return true; -- for (size_t i = 0; i < modules.dim; i++) -+ -+ for (size_t i = 0; i < output_modules.dim; i++) - { -- if (modules[i] == m) -- { -- moduleSearchIndex = i; -- return true; -- } -+ if (output_modules[i] == m) -+ { -+ search_index = i; -+ return true; -+ } - } -+ - return false; - } - - void --ObjectFile::finish (void) -+d_finish_module (void) - { - /* If the target does not directly support static constructors, -- staticCtorList contains a list of all static constructors defined -+ static_ctor_list contains a list of all static constructors defined - so far. This routine will create a function to call all of those - and is picked up by collect2. */ -- if (staticCtorList.dim) -+ const char *ident; -+ -+ if (!static_ctor_list.is_empty()) - { -- doFunctionToCallFunctions (IDENTIFIER_POINTER (get_file_function_name ("I")), -- &staticCtorList, true); -+ ident = IDENTIFIER_POINTER (get_file_function_name ("I")); -+ build_call_function (ident, static_ctor_list, true); - } -- if (staticDtorList.dim) -+ -+ if (!static_dtor_list.is_empty()) - { -- doFunctionToCallFunctions (IDENTIFIER_POINTER (get_file_function_name ("D")), -- &staticDtorList, true); -+ ident = IDENTIFIER_POINTER (get_file_function_name ("D")); -+ build_call_function (ident, static_dtor_list, true); - } - } - --void --ObjectFile::doLineNote (const Loc& loc) --{ -- if (loc.filename) -- setLoc (loc); -- // else do nothing --} -- --static location_t --cvtLocToloc_t (const Loc loc) -+location_t -+get_linemap (const Loc loc) - { - location_t gcc_location; - -@@ -1323,73 +1599,100 @@ cvtLocToloc_t (const Loc loc) - return gcc_location; - } - -+// Update input_location to LOC. -+ - void --ObjectFile::setLoc (const Loc& loc) -+set_input_location (const Loc& loc) - { - if (loc.filename) -+ input_location = get_linemap (loc); -+} -+ -+// Some D Declarations don't have the loc set, this searches DECL's parents -+// until a valid loc is found. -+ -+void -+set_input_location (Dsymbol *decl) -+{ -+ Dsymbol *dsym = decl; -+ while (dsym) - { -- input_location = cvtLocToloc_t (loc); -+ if (dsym->loc.filename) -+ { -+ set_input_location (dsym->loc); -+ return; -+ } -+ dsym = dsym->toParent(); - } -- // else do nothing -+ -+ // Fallback; backend sometimes crashes if not set -+ Module *mod = decl->getModule(); -+ Loc loc; -+ -+ if (mod && mod->srcfile && mod->srcfile->name) -+ loc.filename = mod->srcfile->name->str; -+ else -+ // Empty string can mess up debug info -+ loc.filename = "<no_file>"; -+ -+ loc.linnum = 1; -+ set_input_location (loc); - } - -+// Like set_input_location, but sets the location on decl T. -+ - void --ObjectFile::setDeclLoc (tree t, const Loc& loc) -+set_decl_location (tree t, const Loc& loc) - { -- // DWARF2 will often crash if the DECL_SOURCE_FILE is not set. It's -- // easier the error here. -+ // DWARF2 will often crash if the DECL_SOURCE_FILE is not set. -+ // It's easier the error here. - gcc_assert (loc.filename); -- DECL_SOURCE_LOCATION (t) = cvtLocToloc_t (loc); -+ DECL_SOURCE_LOCATION (t) = get_linemap (loc); - } - - void --ObjectFile::setDeclLoc (tree t, Dsymbol *decl) -+set_decl_location (tree t, Dsymbol *decl) - { - Dsymbol *dsym = decl; - while (dsym) - { - if (dsym->loc.filename) - { -- setDeclLoc (t, dsym->loc); -+ set_decl_location (t, dsym->loc); - return; - } - dsym = dsym->toParent(); - } - -- // fallback; backend sometimes crashes if not set -- -- Loc l; -+ // Fallback; backend sometimes crashes if not set -+ Module *mod = decl->getModule(); -+ Loc loc; - -- Module *m = decl->getModule(); -- if (m && m->srcfile && m->srcfile->name) -- l.filename = m->srcfile->name->str; -+ if (mod && mod->srcfile && mod->srcfile->name) -+ loc.filename = mod->srcfile->name->str; - else -- l.filename = "<no_file>"; // Emptry string can mess up debug info -+ // Empty string can mess up debug info -+ loc.filename = "<no_file>"; - -- l.linnum = 1; -- setDeclLoc (t, l); -+ loc.linnum = 1; -+ set_decl_location (t, loc); - } - - void --ObjectFile::setCfunEndLoc (const Loc& loc) -+set_function_end_locus (const Loc& loc) - { -- tree fn_decl = cfun->decl; - if (loc.filename) -- cfun->function_end_locus = cvtLocToloc_t (loc); -+ cfun->function_end_locus = get_linemap (loc); - else -- cfun->function_end_locus = DECL_SOURCE_LOCATION (fn_decl); -+ cfun->function_end_locus = DECL_SOURCE_LOCATION (cfun->decl); - } - - void --ObjectFile::giveDeclUniqueName (tree decl, const char *prefix) -+get_unique_name (tree decl, const char *prefix) - { -- /* It would be nice to be able to use TRANSLATION_UNIT_DECL -- so lhd_set_decl_assembler_name would do this automatically. -- Unforntuately, the non-NULL decl context confuses dwarf2out. -- -- Maybe this is fixed in later versions of GCC. -- */ - const char *name; -+ char *label; -+ - if (prefix) - name = prefix; - else if (DECL_NAME (decl)) -@@ -1397,7 +1700,6 @@ ObjectFile::giveDeclUniqueName (tree dec - else - name = "___s"; - -- char *label; - ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); - -@@ -1405,7 +1707,7 @@ ObjectFile::giveDeclUniqueName (tree dec - DECL_NAME (decl) = DECL_ASSEMBLER_NAME (decl); - } - --/* Return the COMDAT group into which DECL should be placed. */ -+// Return the COMDAT group into which DECL should be placed. - - static tree - d_comdat_group (tree decl) -@@ -1417,346 +1719,327 @@ d_comdat_group (tree decl) - return DECL_ASSEMBLER_NAME (decl); - } - -+// Set DECL up to have the closest approximation of "initialized common" -+// linkage available. - - void --ObjectFile::makeDeclOneOnly (tree decl_tree) -+d_comdat_linkage (tree decl) - { -- if (!D_DECL_IS_TEMPLATE (decl_tree) || emitTemplates != TEprivate) -- { -- // Weak definitions have to be public. -- if (!TREE_PUBLIC (decl_tree)) -- return; -- } -+ // Weak definitions have to be public. -+ if (!TREE_PUBLIC (decl)) -+ return; - -- /* First method: Use one-only. If user has specified -femit-templates, -- honor that even if the target supports one-only. */ -- if (!D_DECL_IS_TEMPLATE (decl_tree) || emitTemplates != TEprivate) -- { -- // Necessary to allow DECL_ONE_ONLY or DECL_WEAK functions to be inlined -- if (TREE_CODE (decl_tree) == FUNCTION_DECL) -- DECL_DECLARED_INLINE_P (decl_tree) = 1; -+ // Necessary to allow DECL_ONE_ONLY or DECL_WEAK functions to be inlined -+ if (TREE_CODE (decl) == FUNCTION_DECL) -+ DECL_DECLARED_INLINE_P (decl) = 1; - -- // The following makes assumptions about the behavior of make_decl_one_only. -- if (SUPPORTS_ONE_ONLY) -- { -- make_decl_one_only (decl_tree, d_comdat_group (decl_tree)); -- return; -- } -- else if (SUPPORTS_WEAK) -- { -- tree decl_init = DECL_INITIAL (decl_tree); -- DECL_INITIAL (decl_tree) = integer_zero_node; -- make_decl_one_only (decl_tree, d_comdat_group (decl_tree)); -- DECL_INITIAL (decl_tree) = decl_init; -- return; -- } -- } -- /* Second method: Make a private copy. For RTTI, we can always make -- a private copy. For templates, only do this if the user specified -- -femit-templates. */ -- else if (emitTemplates == TEprivate) -+ // The following makes assumptions about the behavior of make_decl_one_only. -+ if (SUPPORTS_ONE_ONLY) -+ make_decl_one_only (decl, d_comdat_group (decl)); -+ else if (SUPPORTS_WEAK) - { -- TREE_PRIVATE (decl_tree) = 1; -- TREE_PUBLIC (decl_tree) = 0; -+ tree decl_init = DECL_INITIAL (decl); -+ DECL_INITIAL (decl) = integer_zero_node; -+ make_decl_one_only (decl, d_comdat_group (decl)); -+ DECL_INITIAL (decl) = decl_init; - } -+ else if (TREE_CODE (decl) == FUNCTION_DECL -+ || ((TREE_CODE (decl) == VAR_DECL) && DECL_ARTIFICIAL (decl))) -+ // We can just emit function and compiler-generated variables -+ // statically; having multiple copies is (for the most part) only -+ // a waste of space. -+ TREE_PUBLIC (decl) = 0; -+ else if (DECL_INITIAL (decl) == NULL_TREE -+ || DECL_INITIAL (decl) == error_mark_node) -+ // Fallback, cannot have multiple copies. -+ DECL_COMMON (decl) = 1; - -- /* Fallback, cannot have multiple copies. */ -- if (DECL_INITIAL (decl_tree) == NULL_TREE -- || DECL_INITIAL (decl_tree) == error_mark_node) -- DECL_COMMON (decl_tree) = 1; -+ DECL_COMDAT (decl) = 1; - } - -+// Set a DECL's STATIC and EXTERN based on the decl's storage class -+// and if it is to be emitted in this module. -+ - void --ObjectFile::setupSymbolStorage (Dsymbol *dsym, tree decl_tree, bool force_static_public) -+setup_symbol_storage (Dsymbol *dsym, tree decl, bool public_p) - { -- Declaration *real_decl = dsym->isDeclaration(); -- FuncDeclaration *func_decl = real_decl ? real_decl->isFuncDeclaration() : 0; -+ Declaration *rd = dsym->isDeclaration(); - -- if (force_static_public -- || (TREE_CODE (decl_tree) == VAR_DECL && (real_decl && real_decl->isDataseg())) -- || (TREE_CODE (decl_tree) == FUNCTION_DECL)) -+ if (public_p -+ || (TREE_CODE (decl) == VAR_DECL && (rd && rd->isDataseg())) -+ || (TREE_CODE (decl) == FUNCTION_DECL)) - { -- bool has_module = false; -- bool is_template = false; -+ bool local_p = output_module_p (dsym->getModule()); - Dsymbol *sym = dsym->toParent(); -- Module *ti_obj_file_mod; - - while (sym) - { - TemplateInstance *ti = sym->isTemplateInstance(); - if (ti) - { -- ti_obj_file_mod = ti->objFileModule; -- is_template = true; -+ D_DECL_ONE_ONLY (decl) = 1; -+ D_DECL_IS_TEMPLATE (decl) = 1; -+ local_p = flag_emit_templates != TEnone -+ && output_module_p (ti->instantiatingModule); - break; - } - sym = sym->toParent(); - } - -- if (is_template) -+ VarDeclaration *vd = rd ? rd->isVarDeclaration() : NULL; -+ if (vd != NULL) - { -- D_DECL_ONE_ONLY (decl_tree) = 1; -- D_DECL_IS_TEMPLATE (decl_tree) = 1; -- has_module = hasModule (ti_obj_file_mod) && emitTemplates != TEnone; -+ if (vd->storage_class & STCextern) -+ local_p = false; -+ // Tell backend this is a thread local decl. -+ if (vd->isDataseg() && vd->isThreadlocal()) -+ DECL_TLS_MODEL (decl) = decl_default_tls_model (decl); - } -- else -- has_module = hasModule (dsym->getModule()); - -- if (real_decl) -- { -- if (real_decl->isVarDeclaration() -- && real_decl->storage_class & STCextern) -- has_module = false; -- } -+ if (rd && rd->storage_class & STCcomdat) -+ D_DECL_ONE_ONLY (decl) = 1; - -- if (has_module) -+ if (local_p) - { -- DECL_EXTERNAL (decl_tree) = 0; -- TREE_STATIC (decl_tree) = 1; -- -- if (real_decl && real_decl->storage_class & STCcomdat) -- D_DECL_ONE_ONLY (decl_tree) = 1; -+ DECL_EXTERNAL (decl) = 0; -+ TREE_STATIC (decl) = 1; - } - else - { -- DECL_EXTERNAL (decl_tree) = 1; -- TREE_STATIC (decl_tree) = 0; -+ DECL_EXTERNAL (decl) = 1; -+ TREE_STATIC (decl) = 0; - } - - // Do this by default, but allow private templates to override -- if (!func_decl || !func_decl->isNested() || force_static_public) -- TREE_PUBLIC (decl_tree) = 1; -+ FuncDeclaration *fd = rd ? rd->isFuncDeclaration() : NULL; -+ if (public_p || !fd || !fd->isNested()) -+ TREE_PUBLIC (decl) = 1; - -- if (D_DECL_ONE_ONLY (decl_tree)) -- makeDeclOneOnly (decl_tree); -+ if (D_DECL_ONE_ONLY (decl)) -+ d_comdat_linkage (decl); - } - else - { -- TREE_STATIC (decl_tree) = 0; -- DECL_EXTERNAL (decl_tree) = 0; -- TREE_PUBLIC (decl_tree) = 0; -+ TREE_STATIC (decl) = 0; -+ DECL_EXTERNAL (decl) = 0; -+ TREE_PUBLIC (decl) = 0; - } - -- if (real_decl && real_decl->userAttributes) -- decl_attributes (&decl_tree, build_attributes (real_decl->userAttributes), 0); -- else if (DECL_ATTRIBUTES (decl_tree) != NULL) -- decl_attributes (&decl_tree, DECL_ATTRIBUTES (decl_tree), 0); --} -- --void --ObjectFile::setupStaticStorage (Dsymbol *dsym, tree decl_tree) --{ -- setupSymbolStorage (dsym, decl_tree, true); -+ if (rd && rd->userAttributes) -+ decl_attributes (&decl, build_attributes (rd->userAttributes), 0); -+ else if (DECL_ATTRIBUTES (decl) != NULL) -+ decl_attributes (&decl, DECL_ATTRIBUTES (decl), 0); - } - -+// Mark DECL, which is a VAR_DECL or FUNCTION_DECL as a symbol that -+// must be emitted in this, output module. - --void --ObjectFile::outputStaticSymbol (Symbol *s) -+static void -+mark_needed (tree decl) - { -- tree t = s->Stree; -- gcc_assert (t); -+ TREE_USED (decl) = 1; - -- if (s->prettyIdent) -- DECL_NAME (t) = get_identifier (s->prettyIdent); -- if (s->Salignment > 0) -+ if (TREE_CODE (decl) == FUNCTION_DECL) - { -- DECL_ALIGN (t) = s->Salignment * BITS_PER_UNIT; -- DECL_USER_ALIGN (t) = 1; -+ struct cgraph_node *node = cgraph_get_create_node (decl); -+ node->symbol.force_output = true; - } -- -- d_add_global_declaration (t); -- -- // %% Hack -- // Defer output of tls symbols to ensure that -- // _tlsstart gets emitted first. -- if (!DECL_THREAD_LOCAL_P (t)) -- rest_of_decl_compilation (t, 1, 0); -- else -+ else if (TREE_CODE (decl) == VAR_DECL) - { -- tree sinit = DECL_INITIAL (t); -- DECL_INITIAL (t) = NULL_TREE; -- -- DECL_DEFER_OUTPUT (t) = 1; -- rest_of_decl_compilation (t, 1, 0); -- DECL_INITIAL (t) = sinit; -+ struct varpool_node *node = varpool_node_for_decl (decl); -+ node->symbol.force_output = true; - } - } - -+// Finish up a symbol declaration and compile it all the way to -+// the assembler language output. -+ - void --ObjectFile::outputFunction (FuncDeclaration *f) -+d_finish_symbol (Symbol *sym) - { -- Symbol *s = f->toSymbol(); -- tree t = s->Stree; -+ if (!sym->Stree) -+ { -+ gcc_assert (!sym->Sident); - -- gcc_assert (TREE_CODE (t) == FUNCTION_DECL); -+ tree init = dtvector_to_tree (sym->Sdt); -+ tree var = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, TREE_TYPE (init)); -+ get_unique_name (var); - -- // Write out _tlsstart/_tlsend. -- if (f->isMain() || f->isWinMain() || f->isDllMain()) -- build_tlssections(); -+ DECL_INITIAL (var) = init; -+ TREE_STATIC (var) = 1; -+ TREE_PUBLIC (var) = 0; -+ TREE_USED (var) = 1; -+ DECL_IGNORED_P (var) = 1; -+ DECL_ARTIFICIAL (var) = 1; - -- if (s->prettyIdent) -- DECL_NAME (t) = get_identifier (s->prettyIdent); -+ sym->Stree = var; -+ } - -- d_add_global_declaration (t); -+ tree decl = sym->Stree; - -- if (!targetm.have_ctors_dtors) -+ if (sym->Sdt) - { -- if (DECL_STATIC_CONSTRUCTOR (t)) -- staticCtorList.push (f); -- if (DECL_STATIC_DESTRUCTOR (t)) -- staticDtorList.push (f); -+ if (DECL_INITIAL (decl) == NULL_TREE) -+ { -+ tree sinit = dtvector_to_tree (sym->Sdt); -+ if (TREE_TYPE (decl) == d_unknown_type_node) -+ { -+ TREE_TYPE (decl) = TREE_TYPE (sinit); -+ TYPE_NAME (TREE_TYPE (decl)) = get_identifier (sym->Sident); -+ } -+ -+ DECL_INITIAL (decl) = sinit; -+ } -+ gcc_assert (COMPLETE_TYPE_P (TREE_TYPE (decl))); - } - -- if (!needs_static_chain (f)) -+ gcc_assert (!error_operand_p (decl)); -+ -+ if (DECL_INITIAL (decl) != NULL_TREE) - { -- bool context = decl_function_context (t) != NULL; -- cgraph_finalize_function (t, context); -+ TREE_STATIC (decl) = 1; -+ DECL_EXTERNAL (decl) = 0; - } --} - --/* Multiple copies of the same template instantiations can -- be passed to the backend from the frontend leaving -- assembler errors left in their wrath. -+ /* If the symbol was marked as readonly in the frontend, set TREE_READONLY. */ -+ if (sym->Sreadonly) -+ TREE_READONLY (decl) = 1; - -- One such example: -- class c (int i = -1) {} -- c!() aa = new c!()(); -+ // We are sending this symbol to object file. -+ gcc_assert (!DECL_EXTERNAL (decl)); -+ relayout_decl (decl); - -- So put these symbols - as generated by toSymbol, -- toInitializer, toVtblSymbol - on COMDAT. -- */ --static StringTable *symtab = NULL; -+#ifdef ENABLE_TREE_CHECKING -+ if (DECL_INITIAL (decl) != NULL_TREE) -+ { -+ // Initialiser must never be bigger than symbol size. -+ dinteger_t tsize = int_size_in_bytes (TREE_TYPE (decl)); -+ dinteger_t dtsize = int_size_in_bytes (TREE_TYPE (DECL_INITIAL (decl))); - --bool --ObjectFile::shouldEmit (Declaration *d_sym) --{ -- // If errors occurred compiling it. -- if (d_sym->type->ty == Tfunction && ((TypeFunction *) d_sym->type)->next->ty == Terror) -- return false; -+ if (tsize < dtsize) -+ internal_error ("Mismatch between declaration '%s' size (%wd) and it's initializer size (%wd).", -+ sym->prettyIdent ? sym->prettyIdent : sym->Sident, tsize, dtsize); -+ } -+#endif - -- FuncDeclaration *fd = d_sym->isFuncDeclaration(); -- if (fd && fd->isNested()) -+ // User declared alignment. -+ if (sym->Salignment > 0) - { -- // Typically, an error occurred whilst compiling -- if (fd->fbody && !fd->vthis) -- { -- gcc_assert (global.errors); -- return false; -- } -+ DECL_ALIGN (decl) = sym->Salignment * BITS_PER_UNIT; -+ DECL_USER_ALIGN (decl) = 1; - } - -- // Defer emitting nested functions whose parent isn't started yet. -- // If the parent never gets emitted, then neither will fd. -- Dsymbol *outer = fd->toParent2(); -- if (outer && outer->isFuncDeclaration()) -+ d_add_global_declaration (decl); -+ -+ // %% FIXME: DECL_COMMON so the symbol goes in .tcommon -+ if (DECL_THREAD_LOCAL_P (decl) -+ && DECL_ASSEMBLER_NAME (decl) == get_identifier ("_tlsend")) - { -- Symbol *osym = outer->toSymbol(); -- if (osym->outputStage != Finished) -- { -- ((FuncDeclaration *) outer)->deferred.push (fd); -- return false; -- } -+ DECL_INITIAL (decl) = NULL_TREE; -+ DECL_COMMON (decl) = 1; - } - -- return shouldEmit (d_sym->toSymbol()); -+ rest_of_decl_compilation (decl, 1, 0); - } - --bool --ObjectFile::shouldEmit (Symbol *sym) -+void -+d_finish_function (FuncDeclaration *fd) - { -- gcc_assert (sym); -+ Symbol *s = fd->toSymbol(); -+ tree decl = s->Stree; - -- // If have already started emitting, continue doing so. -- if (sym->outputStage) -- return true; -+ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); - -- if (D_DECL_ONE_ONLY (sym->Stree)) -+ if (DECL_SAVED_TREE (decl) != NULL_TREE) - { -- tree id = DECL_ASSEMBLER_NAME (sym->Stree); -- const char *ident = IDENTIFIER_POINTER (id); -- size_t len = IDENTIFIER_LENGTH (id); -- -- gcc_assert (ident != NULL); -- -- if (!symtab) -- { -- symtab = new StringTable; -- symtab->init(); -- } -- -- if (!symtab->insert (ident, len)) -- /* Don't emit, assembler name already in symtab. */ -- return false; -+ TREE_STATIC (decl) = 1; -+ DECL_EXTERNAL (decl) = 0; - } - -- // Not emitting templates, so return true all others. -- if (emitTemplates == TEnone) -- return !D_DECL_IS_TEMPLATE (sym->Stree); -+ d_add_global_declaration (decl); - -- return true; --} -- --void --ObjectFile::addAggMethod (tree rec_type, FuncDeclaration *fd) --{ -- if (write_symbols != NO_DEBUG) -+ if (!targetm.have_ctors_dtors) - { -- tree methods = TYPE_METHODS (rec_type); -- tree t = fd->toSymbol()->Stree; -- TYPE_METHODS (rec_type) = chainon (methods, t); -+ if (DECL_STATIC_CONSTRUCTOR (decl)) -+ static_ctor_list.safe_push (fd); -+ if (DECL_STATIC_DESTRUCTOR (decl)) -+ static_dtor_list.safe_push (fd); - } --} - --void --ObjectFile::initTypeDecl (tree t, Dsymbol *d_sym) --{ -- gcc_assert (!POINTER_TYPE_P (t)); -- if (!TYPE_STUB_DECL (t)) -+ if (!needs_static_chain (fd)) - { -- const char *name = d_sym->ident ? d_sym->ident->string : "fix"; -- tree decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (name), t); -- DECL_CONTEXT (decl) = d_decl_context (d_sym); -- setDeclLoc (decl, d_sym); -- initTypeDecl (t, decl); -+ bool context = decl_function_context (decl) != NULL; -+ cgraph_finalize_function (decl, context); - } - } - -+// Wrapup all global declarations and start the final compilation. - - void --ObjectFile::declareType (tree t, Type *d_type) -+d_finish_compilation (tree *vec, int len) - { -- // Note: It is not safe to call d_type->toCtype(). -- Loc l; -- tree decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (d_type->toChars()), t); -- l.filename = "<internal>"; -- l.linnum = 1; -- setDeclLoc (decl, l); -+ // Complete all generated thunks. -+ cgraph_process_same_body_aliases(); - -- initTypeDecl (t, decl); -- declareType (decl); --} -+ StringTable *symtab = new StringTable; -+ symtab->_init(); - --void --ObjectFile::declareType (tree t, Dsymbol *d_sym) --{ -- initTypeDecl (t, d_sym); -- declareType (TYPE_NAME (t)); -+ // Process all file scopes in this compilation, and the external_scope, -+ // through wrapup_global_declarations. -+ for (int i = 0; i < len; i++) -+ { -+ tree decl = vec[i]; -+ -+ // Determine if a global var/function is needed. -+ int needed = wrapup_global_declarations (&decl, 1); -+ -+ if ((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)) -+ || TREE_CODE (decl) == FUNCTION_DECL) -+ { -+ // Don't emit, assembler name already in symtab. -+ tree name = DECL_ASSEMBLER_NAME (decl); -+ if (!symtab->insert (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name))) -+ needed = 0; -+ else -+ needed = 1; -+ } -+ -+ if (needed) -+ mark_needed (decl); -+ } -+ -+ // We're done parsing; proceed to optimize and emit assembly. -+ if (!global.errors && !errorcount) -+ finalize_compilation_unit(); -+ -+ // Now, issue warnings about static, but not defined, functions. -+ check_global_declarations (vec, len); -+ -+ // After cgraph has had a chance to emit everything that's going to -+ // be emitted, output debug information for globals. -+ emit_debug_global_declarations (vec, len); - } - -+// Build TYPE_DECL for the declaration DSYM. - - void --ObjectFile::initTypeDecl (tree t, tree decl) -+build_type_decl (tree t, Dsymbol *dsym) - { - if (TYPE_STUB_DECL (t)) - return; - - gcc_assert (!POINTER_TYPE_P (t)); - -+ tree decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, -+ get_identifier (dsym->ident->string), t); -+ -+ DECL_CONTEXT (decl) = d_decl_context (dsym); -+ set_decl_location (decl, dsym); -+ - TYPE_CONTEXT (t) = DECL_CONTEXT (decl); - TYPE_NAME (t) = decl; - -- if (TREE_CODE (t) == ENUMERAL_TYPE -- || TREE_CODE (t) == RECORD_TYPE -+ if (TREE_CODE (t) == ENUMERAL_TYPE || TREE_CODE (t) == RECORD_TYPE - || TREE_CODE (t) == UNION_TYPE) - { - /* Not sure if there is a need for separate TYPE_DECLs in -@@ -1764,30 +2047,41 @@ ObjectFile::initTypeDecl (tree t, tree d - TYPE_STUB_DECL (t) = decl; - DECL_ARTIFICIAL (decl) = 1; - } -+ -+ bool toplevel = !DECL_CONTEXT (TYPE_NAME (t)); -+ rest_of_decl_compilation (TYPE_NAME (t), toplevel, 0); - } - --void --ObjectFile::declareType (tree decl) -+// Can't output thunks while a function is being compiled. -+ -+struct DeferredThunk - { -- bool top_level = !DECL_CONTEXT (decl); -+ tree decl; -+ tree target; -+ int offset; -+}; - -- rest_of_decl_compilation (decl, top_level, 0); --} -+static vec<DeferredThunk *> deferred_thunks; - --tree --ObjectFile::stripVarDecl (tree value) --{ -- if (TREE_CODE (value) != VAR_DECL) -- return value; -+// Process all deferred thunks in list DEFERRED_THUNKS. - -- if (DECL_INITIAL (value)) -- return DECL_INITIAL (value); -+void -+write_deferred_thunks (void) -+{ -+ for (size_t i = 0; i < deferred_thunks.length(); i++) -+ { -+ DeferredThunk *t = deferred_thunks[i]; -+ finish_thunk (t->decl, t->target, t->offset); -+ } - -- gcc_unreachable (); -+ deferred_thunks.truncate (0); - } - -+// Emit the definition of a D vtable thunk. If a function -+// is still being compiled, defer emitting. -+ - void --ObjectFile::doThunk (tree thunk_decl, tree target_decl, int offset) -+use_thunk (tree thunk_decl, tree target_decl, int offset) - { - if (current_function_decl) - { -@@ -1795,10 +2089,10 @@ ObjectFile::doThunk (tree thunk_decl, tr - t->decl = thunk_decl; - t->target = target_decl; - t->offset = offset; -- deferredThunks.push (t); -+ deferred_thunks.safe_push (t); - } - else -- outputThunk (thunk_decl, target_decl, offset); -+ finish_thunk (thunk_decl, target_decl, offset); - } - - /* Thunk code is based on g++ */ -@@ -1813,7 +2107,7 @@ make_alias_for_thunk (tree function) - tree alias; - char buf[256]; - -- // For gdc: Thunks may reference extern functions which cannot be aliased. -+ // Thunks may reference extern functions which cannot be aliased. - if (DECL_EXTERNAL (function)) - return function; - -@@ -1823,7 +2117,7 @@ make_alias_for_thunk (tree function) - alias = build_decl (DECL_SOURCE_LOCATION (function), FUNCTION_DECL, - get_identifier (buf), TREE_TYPE (function)); - DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function); -- DECL_CONTEXT (alias) = NULL; -+ DECL_CONTEXT (alias) = NULL_TREE; - TREE_READONLY (alias) = TREE_READONLY (function); - TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function); - TREE_PUBLIC (alias) = 0; -@@ -1838,11 +2132,10 @@ make_alias_for_thunk (tree function) - TREE_ADDRESSABLE (alias) = 1; - TREE_USED (alias) = 1; - SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias)); -- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1; - - if (!flag_syntax_only) - { -- struct cgraph_node *aliasn; -+ cgraph_node *aliasn; - aliasn = cgraph_same_body_alias (cgraph_get_create_node (function), - alias, function); - DECL_ASSEMBLER_NAME (function); -@@ -1852,9 +2145,9 @@ make_alias_for_thunk (tree function) - } - - void --ObjectFile::outputThunk (tree thunk_decl, tree target_decl, int offset) -+finish_thunk (tree thunk_decl, tree target_decl, int offset) - { -- /* Settings used to output D thunks. */ -+ /* Setup how D thunks are outputted. */ - int fixed_offset = -offset; - bool this_adjusting = true; - int virtual_value = 0; -@@ -1902,43 +2195,17 @@ ObjectFile::outputThunk (tree thunk_decl - DECL_ARGUMENTS (thunk_decl) = nreverse (t); - TREE_ASM_WRITTEN (thunk_decl) = 1; - -- if (!DECL_EXTERNAL (target_decl)) -- { -- struct cgraph_node *funcn, *thunk_node; -+ cgraph_node *funcn, *thunk_node; - -- funcn = cgraph_get_create_node (target_decl); -- gcc_assert (funcn); -- thunk_node = cgraph_add_thunk (funcn, thunk_decl, thunk_decl, -- this_adjusting, fixed_offset, -- virtual_value, 0, alias); -- -- if (DECL_ONE_ONLY (target_decl)) -- symtab_add_to_same_comdat_group ((symtab_node) thunk_node, -- (symtab_node) funcn); -- } -- else -- { -- /* Backend will not emit thunks to external symbols unless the function is -- being emitted in this compilation unit. So make generated thunks weakref -- symbols for the methods they interface with. */ -- tree id = DECL_ASSEMBLER_NAME (target_decl); -- tree attrs; -- -- id = build_string (IDENTIFIER_LENGTH (id), IDENTIFIER_POINTER (id)); -- id = tree_cons (NULL_TREE, id, NULL_TREE); -- -- attrs = tree_cons (get_identifier ("alias"), id, NULL_TREE); -- attrs = tree_cons (get_identifier ("weakref"), NULL_TREE, attrs); -- -- DECL_INITIAL (thunk_decl) = NULL_TREE; -- DECL_EXTERNAL (thunk_decl) = 1; -- TREE_ASM_WRITTEN (thunk_decl) = 0; -- TREE_PRIVATE (thunk_decl) = 1; -- TREE_PUBLIC (thunk_decl) = 0; -- -- decl_attributes (&thunk_decl, attrs, 0); -- rest_of_decl_compilation (thunk_decl, 1, 0); -- } -+ funcn = cgraph_get_create_node (target_decl); -+ gcc_assert (funcn); -+ thunk_node = cgraph_add_thunk (funcn, thunk_decl, thunk_decl, -+ this_adjusting, fixed_offset, -+ virtual_value, 0, alias); -+ -+ if (DECL_ONE_ONLY (target_decl)) -+ symtab_add_to_same_comdat_group ((symtab_node) thunk_node, -+ (symtab_node) funcn); - - if (!targetm.asm_out.can_output_mi_thunk (thunk_decl, fixed_offset, - virtual_value, alias)) -@@ -1948,224 +2215,156 @@ ObjectFile::outputThunk (tree thunk_decl - } - } - --FuncDeclaration * --ObjectFile::doSimpleFunction (const char *name, tree expr, bool static_ctor) -+// Build and emit a function named NAME, whose function body is in EXPR. -+ -+static FuncDeclaration * -+build_simple_function (const char *name, tree expr, bool static_ctor) - { -- if (!cmodule) -- cmodule = d_gcc_get_output_module(); -+ Module *mod = current_module_decl; -+ -+ if (!mod) -+ mod = d_gcc_get_output_module(); - - if (name[0] == '*') - { -- Symbol *s = cmodule->toSymbolX (name + 1, 0, 0, "FZv"); -+ Symbol *s = mod->toSymbolX (name + 1, 0, 0, "FZv"); - name = s->Sident; - } - - TypeFunction *func_type = new TypeFunction (0, Type::tvoid, 0, LINKc); -- FuncDeclaration *func = new FuncDeclaration (cmodule->loc, cmodule->loc, -+ FuncDeclaration *func = new FuncDeclaration (mod->loc, mod->loc, - Lexer::idPool (name), STCstatic, func_type); -- func->loc = Loc (cmodule, 1); -+ func->loc = Loc (mod, 1); - func->linkage = func_type->linkage; -- func->parent = cmodule; -+ func->parent = mod; - func->protection = PROTprivate; -+ func->semanticRun = PASSsemantic3done; - - tree func_decl = func->toSymbol()->Stree; -+ - if (static_ctor) -- DECL_STATIC_CONSTRUCTOR (func_decl) = 1; // apparently, the back end doesn't do anything with this -+ DECL_STATIC_CONSTRUCTOR (func_decl) = 1; - - // D static ctors, dtors, unittests, and the ModuleInfo chain function -- // are always private (see ObjectFile::setupSymbolStorage, default case) -+ // are always private (see setup_symbol_storage, default case) - TREE_PUBLIC (func_decl) = 0; - TREE_USED (func_decl) = 1; - -- // %% maybe remove the identifier -- WrappedExp *body = new WrappedExp (cmodule->loc, TOKcomma, expr, Type::tvoid); -- func->fbody = new ExpStatement (cmodule->loc, body); -+ // %% Maybe remove the identifier -+ WrappedExp *body = new WrappedExp (mod->loc, TOKcomma, expr, Type::tvoid); -+ func->fbody = new ExpStatement (mod->loc, body); - func->toObjFile (0); - - return func; - } - --/* force: If true, create a new function even there is only one function in the -- list. -- */ --FuncDeclaration * --ObjectFile::doFunctionToCallFunctions (const char *name, FuncDeclarations *functions, bool force_and_public) -+// Build and emit a function identified by NAME that calls (in order) -+// the list of functions in FUNCTIONS. If FORCE_P, create a new function -+// even if there is only one function to call in the list. -+ -+static FuncDeclaration * -+build_call_function (const char *name, vec<FuncDeclaration *> functions, bool force_p) - { - tree expr_list = NULL_TREE; - - // If there is only one function, just return that -- if (functions->dim == 1 && !force_and_public) -- { -- return (*functions)[0]; -- } -- else -- { -- // %% shouldn't front end build these? -- for (size_t i = 0; i < functions->dim; i++) -- { -- tree fndecl = ((*functions)[i])->toSymbol()->Stree; -- tree call_expr = d_build_call (void_type_node, build_address (fndecl), NULL_TREE); -- expr_list = maybe_vcompound_expr (expr_list, call_expr); -- } -+ if (functions.length() == 1 && !force_p) -+ return functions[0]; -+ -+ Module *mod = current_module_decl; -+ if (!mod) -+ mod = d_gcc_get_output_module(); -+ set_input_location (Loc (mod, 1)); -+ -+ // Shouldn't front end build these? -+ for (size_t i = 0; i < functions.length(); i++) -+ { -+ tree fndecl = (functions[i])->toSymbol()->Stree; -+ tree call_expr = d_build_call_list (void_type_node, build_address (fndecl), NULL_TREE); -+ expr_list = maybe_vcompound_expr (expr_list, call_expr); - } -+ - if (expr_list) -- return doSimpleFunction (name, expr_list, false); -+ return build_simple_function (name, expr_list, false); - - return NULL; - } - - --/* Same as doFunctionToCallFunctions, but includes a gate to -- protect static ctors in templates getting called multiple times. -- */ --FuncDeclaration * --ObjectFile::doCtorFunction (const char *name, FuncDeclarations *functions, VarDeclarations *gates) -+// Same as build_call_function, but includes a gate to -+// protect static ctors in templates getting called multiple times. -+ -+static Symbol * -+build_ctor_function (const char *name, vec<FuncDeclaration *> functions, vec<VarDeclaration *> gates) - { - tree expr_list = NULL_TREE; - - // If there is only one function, just return that -- if (functions->dim == 1 && !gates->dim) -+ if (functions.length() == 1 && gates.is_empty()) -+ return (functions[0])->toSymbol(); -+ -+ // Increment gates first. -+ for (size_t i = 0; i < gates.length(); i++) - { -- return (*functions)[0]; -+ tree var_decl = (gates[i])->toSymbol()->Stree; -+ tree value = build2 (PLUS_EXPR, TREE_TYPE (var_decl), var_decl, integer_one_node); -+ tree var_expr = vmodify_expr (var_decl, value); -+ expr_list = maybe_vcompound_expr (expr_list, var_expr); - } -- else -- { -- // Increment gates first. -- for (size_t i = 0; i < gates->dim; i++) -- { -- VarDeclaration *var = (*gates)[i]; -- tree var_decl = var->toSymbol()->Stree; -- tree value = build2 (PLUS_EXPR, TREE_TYPE (var_decl), var_decl, integer_one_node); -- tree var_expr = vmodify_expr (var_decl, value); -- expr_list = maybe_vcompound_expr (expr_list, var_expr); -- } -- // Call Ctor Functions -- for (size_t i = 0; i < functions->dim; i++) -- { -- tree fndecl = ((*functions)[i])->toSymbol()->Stree; -- tree call_expr = d_build_call (void_type_node, build_address (fndecl), NULL_TREE); -- expr_list = maybe_vcompound_expr (expr_list, call_expr); -- } -- } -- if (expr_list) -- return doSimpleFunction (name, expr_list, false); -- -- return NULL; --} -- --/* Same as doFunctionToCallFunctions, but calls all functions in -- the reverse order that the constructors were called in. -- */ --FuncDeclaration * --ObjectFile::doDtorFunction (const char *name, FuncDeclarations *functions) --{ -- tree expr_list = NULL_TREE; - -- // If there is only one function, just return that -- if (functions->dim == 1) -+ // Call Ctor Functions -+ for (size_t i = 0; i < functions.length(); i++) - { -- return (*functions)[0]; -+ tree fndecl = (functions[i])->toSymbol()->Stree; -+ tree call_expr = d_build_call_list (void_type_node, build_address (fndecl), NULL_TREE); -+ expr_list = maybe_vcompound_expr (expr_list, call_expr); - } -- else -+ -+ if (expr_list) - { -- for (int i = functions->dim - 1; i >= 0; i--) -- { -- tree fndecl = ((*functions)[i])->toSymbol()->Stree; -- tree call_expr = d_build_call (void_type_node, build_address (fndecl), NULL_TREE); -- expr_list = maybe_vcompound_expr (expr_list, call_expr); -- } -+ FuncDeclaration *fd = build_simple_function (name, expr_list, false); -+ return fd->toSymbol(); - } -- if (expr_list) -- return doSimpleFunction (name, expr_list, false); - - return NULL; - } - --/* Currently just calls doFunctionToCallFunctions --*/ --FuncDeclaration * --ObjectFile::doUnittestFunction (const char *name, FuncDeclarations *functions) --{ -- return doFunctionToCallFunctions (name, functions); --} -- --// Finish up a symbol declaration and compile it all the way to --// the assembler language output. -+// Same as build_call_function, but calls all functions in -+// the reverse order that the constructors were called in. - --void --d_finish_symbol (Symbol *sym) -+static Symbol * -+build_dtor_function (const char *name, vec<FuncDeclaration *> functions) - { -- if (!sym->Stree) -- { -- gcc_assert (!sym->Sident); -- -- tree init = dtvector_to_tree (sym->Sdt); -- tree var = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, TREE_TYPE (init)); -- object_file->giveDeclUniqueName (var); -- -- DECL_INITIAL (var) = init; -- TREE_STATIC (var) = 1; -- TREE_USED (var) = 1; -- TREE_PRIVATE (var) = 1; -- DECL_IGNORED_P (var) = 1; -- DECL_ARTIFICIAL (var) = 1; -- -- sym->Stree = var; -- } -+ tree expr_list = NULL_TREE; - -- tree t = sym->Stree; -+ // If there is only one function, just return that -+ if (functions.length() == 1) -+ return (functions[0])->toSymbol(); - -- if (sym->Sdt) -+ for (int i = functions.length() - 1; i >= 0; i--) - { -- if (DECL_INITIAL (t) == NULL_TREE) -- { -- tree sinit = dtvector_to_tree (sym->Sdt); -- if (TREE_TYPE (t) == d_unknown_type_node) -- { -- TREE_TYPE (t) = TREE_TYPE (sinit); -- TYPE_NAME (TREE_TYPE (t)) = get_identifier (sym->Sident); -- } -- -- DECL_INITIAL (t) = sinit; -- } -- gcc_assert (COMPLETE_TYPE_P (TREE_TYPE (t))); -+ tree fndecl = (functions[i])->toSymbol()->Stree; -+ tree call_expr = d_build_call_list (void_type_node, build_address (fndecl), NULL_TREE); -+ expr_list = maybe_vcompound_expr (expr_list, call_expr); - } - -- gcc_assert (!error_mark_p (t)); -- -- if (DECL_INITIAL (t) != NULL_TREE) -+ if (expr_list) - { -- TREE_STATIC (t) = 1; -- DECL_EXTERNAL (t) = 0; -+ FuncDeclaration *fd = build_simple_function (name, expr_list, false); -+ return fd->toSymbol(); - } - -- /* If the symbol was marked as readonly in the frontend, set TREE_READONLY. */ -- if (sym->Sreadonly) -- TREE_READONLY (t) = 1; -- -- DECL_CONTEXT (t) = decl_function_context (t); -- -- if (!object_file->shouldEmit (sym)) -- return; -- -- // This was for typeinfo decls ... shouldn't happen now. -- // %% Oops, this was supposed to be static. -- gcc_assert (!DECL_EXTERNAL (t)); -- relayout_decl (t); -+ return NULL; -+} - --#ifdef ENABLE_TREE_CHECKING -- if (DECL_INITIAL (t) != NULL_TREE) -- { -- // Initialiser must never be bigger than symbol size. -- dinteger_t tsize = int_size_in_bytes (TREE_TYPE (t)); -- dinteger_t dtsize = int_size_in_bytes (TREE_TYPE (DECL_INITIAL (t))); -- if (tsize != dtsize) -- internal_error ("Mismatch between declaration '%s' size (%wd) and it's initializer size (%wd).", -- sym->prettyIdent ? sym->prettyIdent : sym->Sident, tsize, dtsize); -- } --#endif -+// Same as build_call_function, but returns the Symbol to -+// the function generated. - -- object_file->outputStaticSymbol (sym); -+static Symbol * -+build_unittest_function (const char *name, vec<FuncDeclaration *> functions) -+{ -+ FuncDeclaration *fd = build_call_function (name, functions, false); -+ return fd->toSymbol(); - } - - // Generate our module reference and append to _Dmodule_ref. -@@ -2183,7 +2382,7 @@ build_moduleinfo (Symbol *sym) - // struct ModuleReference in moduleinit.d - Type *type = build_object_type(); - tree tmodref = build_two_field_type (ptr_type_node, type->toCtype(), -- NULL, "next", "mod"); -+ NULL, "next", "mod"); - tree nextfield = TYPE_FIELDS (tmodref); - tree modfield = TREE_CHAIN (nextfield); - -@@ -2198,12 +2397,13 @@ build_moduleinfo (Symbol *sym) - // private ModuleReference modref = { next: null, mod: _ModuleInfo_xxx }; - tree modref = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, tmodref); - d_keep (modref); -- object_file->giveDeclUniqueName (modref, "__mod_ref"); -- object_file->setDeclLoc (modref, cmodule); -+ -+ get_unique_name (modref, "__mod_ref"); -+ set_decl_location (modref, current_module_decl); - - DECL_ARTIFICIAL (modref) = 1; - DECL_IGNORED_P (modref) = 1; -- TREE_PRIVATE (modref) = 1; -+ TREE_PUBLIC (modref) = 0; - TREE_STATIC (modref) = 1; - - vec<constructor_elt, va_gc> *ce = NULL; -@@ -2223,40 +2423,6 @@ build_moduleinfo (Symbol *sym) - tree m1 = vmodify_expr (component_ref (modref, nextfield), dmodule_ref); - tree m2 = vmodify_expr (dmodule_ref, build_address (modref)); - -- object_file->doSimpleFunction ("*__modinit", vcompound_expr (m1, m2), true); --} -- --// Put out symbols that define the beginning and end --// of the thread local storage sections. -- --void --build_tlssections (void) --{ -- // Generate: -- // __thread size_t _tlsstart = 3; -- // __thread size_t _tlsend; -- tree tlsstart, tlsend; -- -- tlsstart = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier ("_tlsstart"), size_type_node); -- TREE_PUBLIC (tlsstart) = 1; -- TREE_STATIC (tlsstart) = 1; -- DECL_ARTIFICIAL (tlsstart) = 1; -- // DECL_INITIAL so the symbol goes in .tdata -- DECL_INITIAL (tlsstart) = build_int_cst (size_type_node, 3); -- DECL_TLS_MODEL (tlsstart) = decl_default_tls_model (tlsstart); -- object_file->setDeclLoc (tlsstart, cmodule); -- rest_of_decl_compilation (tlsstart, 1, 0); -- -- tlsend = build_decl (UNKNOWN_LOCATION, VAR_DECL, -- get_identifier ("_tlsend"), size_type_node); -- TREE_PUBLIC (tlsend) = 1; -- TREE_STATIC (tlsend) = 1; -- DECL_ARTIFICIAL (tlsend) = 1; -- // DECL_COMMON so the symbol goes in .tcommon -- DECL_COMMON (tlsend) = 1; -- DECL_TLS_MODEL (tlsend) = decl_default_tls_model (tlsend); -- object_file->setDeclLoc (tlsend, cmodule); -- rest_of_decl_compilation (tlsend, 1, 0); -+ build_simple_function ("*__modinit", vcompound_expr (m1, m2), true); - } - ---- a/src/gcc/d/d-objfile.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-objfile.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-objfile.h -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -27,8 +27,8 @@ - // These must match the values in object_.d - enum ModuleInfoFlags - { -- MIstandalone = 4, -- MItlsctor = 8, -+ MIstandalone = 0x4, -+ MItlsctor = 0x8, - MItlsdtor = 0x10, - MIctor = 0x20, - MIdtor = 0x40, -@@ -37,23 +37,17 @@ enum ModuleInfoFlags - MIunitTest = 0x200, - MIimportedModules = 0x400, - MIlocalClasses = 0x800, -- MInew = 0x80000000 --}; -- --enum OutputStage --{ -- NotStarted, -- InProgress, -- Finished -+ MIname = 0x1000, - }; - - struct FuncFrameInfo; --typedef ArrayBase<struct Thunk> Thunks; --typedef union tree_node dt_t; -+struct Thunk; -+typedef tree_node dt_t; - --struct Symbol : Object -+struct Symbol - { - Symbol (void); -+ ~Symbol (void); - - const char *Sident; - const char *prettyIdent; -@@ -65,7 +59,7 @@ struct Symbol : Object - // Our GNU backend tree for the symbol. - tree Stree; - -- // The DECL_CONTEXT to use for child declarations. -+ // The real DECL_CONTEXT of the symbol, if the context of Stree differs. - tree ScontextDecl; - - // FIELD_DECL in frame struct that this variable is allocated in. -@@ -75,8 +69,7 @@ struct Symbol : Object - tree SnamedResult; - - // For FuncDeclarations: -- Thunks thunks; -- OutputStage outputStage; -+ vec<Thunk *> thunks; - FuncFrameInfo *frameInfo; - }; - -@@ -97,127 +90,60 @@ extern dt_t **build_vptr_monitor (dt_t * - extern tree dtvector_to_tree (dt_t *dt); - - extern void build_moduleinfo (Symbol *sym); --extern void build_tlssections (void); --extern void d_finish_symbol (Symbol *sym); - - - struct ModuleInfo - { -- ClassDeclarations classes; -- FuncDeclarations ctors; -- FuncDeclarations dtors; -- VarDeclarations ctorgates; -- -- FuncDeclarations sharedctors; -- FuncDeclarations shareddtors; -- VarDeclarations sharedctorgates; -+ ModuleInfo (void); -+ ~ModuleInfo (void); -+ -+ vec<ClassDeclaration *> classes; -+ vec<FuncDeclaration *> ctors; -+ vec<FuncDeclaration *> dtors; -+ vec<VarDeclaration *> ctorgates; - -- FuncDeclarations unitTests; -+ vec<FuncDeclaration *> sharedctors; -+ vec<FuncDeclaration *> shareddtors; -+ vec<VarDeclaration *> sharedctorgates; -+ -+ vec<FuncDeclaration *> unitTests; - }; - -+extern ModuleInfo *current_module_info; -+ - enum TemplateEmission - { - TEnone, - TEnormal, -- TEprivate -+ TEallinst, - }; - --struct DeferredThunk --{ -- tree decl; -- tree target; -- int offset; --}; -- --typedef ArrayBase<DeferredThunk> DeferredThunks; -- -- --/* Nearly everything is static for effeciency since there is -- only one object per run of the backend */ --struct ObjectFile --{ -- public: -- ObjectFile (void) { }; -- -- static void beginModule (Module *m); -- static void endModule (void); -- -- static void finish (void); -- -- static void doLineNote (const Loc& loc); -- static void setLoc (const Loc& loc); -- -- // ** Declaration maninpulation -- static void setDeclLoc (tree t, const Loc& loc); -- -- // Some D Declarations don't have the loc set, this searches decl's parents -- // until a valid loc is found. -- static void setDeclLoc (tree t, Dsymbol *decl); -- static void setCfunEndLoc (const Loc& loc); -- static void giveDeclUniqueName (tree decl, const char *prefix = NULL); -+extern location_t get_linemap (const Loc loc); -+extern void set_input_location (const Loc& loc); -+extern void set_input_location (Dsymbol *decl); - -- // Set a DECL's STATIC and EXTERN based on the decl's storage class -- // and if it is to be emitted in this module. -- static void setupSymbolStorage (Dsymbol *decl, tree decl_tree, bool force_static_public = false); -+extern void set_decl_location (tree t, const Loc& loc); -+extern void set_decl_location (tree t, Dsymbol *decl); -+extern void set_function_end_locus (const Loc& loc); - -- // Definitely in static data, but not neccessarily this module. -- // Assumed to be public data. -- static void setupStaticStorage (Dsymbol *dsym, tree decl_tree); -- static void makeDeclOneOnly (tree decl_tree); -+extern void get_unique_name (tree decl, const char *prefix = NULL); - -- static void outputStaticSymbol (Symbol *s); -- static void outputFunction (FuncDeclaration *f); -+extern void setup_symbol_storage (Dsymbol *dsym, tree decl, bool is_public); -+extern void d_comdat_linkage (tree decl); - -- static void addAggMethod (tree rec_type, FuncDeclaration *fd); -- -- static void initTypeDecl (tree t, Dsymbol *d_sym); -- -- static void declareType (tree t, Type *d_type); -- static void declareType (tree t, Dsymbol *d_sym); -- -- // Hack for systems without linkonce support -- static bool shouldEmit (Declaration *d_sym); -- static bool shouldEmit (Symbol *sym); -- -- static void doThunk (tree thunk_decl, tree target_decl, int offset); -- -- // Can't use VAR_DECLs for the DECL_INITIAL of static varibles or in CONSTRUCTORSs -- static tree stripVarDecl (tree value); -- -- static FuncDeclaration *doSimpleFunction (const char *name, tree expr, bool static_ctor); -- static FuncDeclaration *doFunctionToCallFunctions (const char *name, FuncDeclarations *functions, bool force_and_public = false); -- static FuncDeclaration *doCtorFunction (const char *name, FuncDeclarations *functions, VarDeclarations *gates); -- static FuncDeclaration *doDtorFunction (const char *name, FuncDeclarations *functions); -- static FuncDeclaration *doUnittestFunction (const char *name, FuncDeclarations *functions); -- -- // ** Module info. Assuming only one module per run of the compiler. -- -- static ModuleInfo *moduleInfo; // of ModuleInfo * -- -- // ** static constructors (not D static constructors) -- static FuncDeclarations staticCtorList; // usually only one. -- static FuncDeclarations staticDtorList; // only if __attribute__(destructor) is used. -- -- /* support for multiple modules per object file */ -- static bool hasModule (Module *m); -- static Modules modules; -- -- // Template emission behaviour. -- static TemplateEmission emitTemplates; -- -- protected: -- static void outputThunk (tree thunk_decl, tree target_decl, int offset); -- -- static void initTypeDecl (tree t, tree decl); -- static void declareType (tree decl); -- -- // Can't output thunks while a function is being compiled. -- static DeferredThunks deferredThunks; -- -- private: -- static unsigned moduleSearchIndex; -- --}; -+extern void d_finish_symbol (Symbol *sym); -+extern void d_finish_function (FuncDeclaration *f); -+extern void d_finish_module (void); -+extern void d_finish_compilation (tree *vec, int len); -+ -+extern void build_type_decl (tree t, Dsymbol *dsym); -+ -+extern Modules output_modules; -+extern bool output_module_p (Module *mod); -+ -+extern void write_deferred_thunks (void); -+extern void use_thunk (tree thunk_decl, tree target_decl, int offset); -+extern void finish_thunk (tree thunk_decl, tree target_decl, int offset); - - #endif - ---- a/src/gcc/d/d-port.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-port.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-port.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -19,16 +19,23 @@ - - #include "port.h" - --longdouble Port::nan; -+longdouble Port::ldbl_nan; - longdouble Port::snan; --longdouble Port::infinity; -+longdouble Port::ldbl_infinity; -+longdouble Port::ldbl_max; - - void - Port::init (void) - { -- real_nan (&nan.rv(), "", 1, TYPE_MODE (long_double_type_node)); -- real_nan (&snan.rv(), "", 0, TYPE_MODE (long_double_type_node)); -- real_inf (&infinity.rv()); -+ char buf[128]; -+ machine_mode mode = TYPE_MODE (long_double_type_node); -+ -+ real_nan (&ldbl_nan.rv(), "", 1, mode); -+ real_nan (&snan.rv(), "", 0, mode); -+ real_inf (&ldbl_infinity.rv()); -+ -+ get_max_float (REAL_MODE_FORMAT (mode), buf, sizeof (buf)); -+ real_from_string (&ldbl_max.rv(), buf); - } - - // Returns TRUE if longdouble value R is NaN. -@@ -62,6 +69,15 @@ Port::fmodl (longdouble x, longdouble y) - return x % y; - } - -+// Returns TRUE if longdouble value X is identical to Y. -+ -+int -+Port::fequal (longdouble x, longdouble y) -+{ -+ return (Port::isNan(x) && Port::isNan(y)) -+ || REAL_VALUES_IDENTICAL (x.rv(), y.rv()); -+} -+ - char * - Port::strupr (char *s) - { -@@ -124,3 +140,43 @@ Port::stricmp (const char *s1, const cha - return result; - } - -+// Return a longdouble value from string BUFFER rounded to float mode. -+ -+longdouble -+Port::strtof (const char *buffer, char **) -+{ -+ longdouble r; -+ real_from_string3 (&r.rv(), buffer, TYPE_MODE (float_type_node)); -+ -+ // Front-end checks errno to see if the value is representable. -+ if (r == ldbl_infinity) -+ errno = ERANGE; -+ -+ return r; -+} -+ -+// Return a longdouble value from string BUFFER rounded to double mode. -+ -+longdouble -+Port::strtod (const char *buffer, char **) -+{ -+ longdouble r; -+ real_from_string3 (&r.rv(), buffer, TYPE_MODE (double_type_node)); -+ -+ // Front-end checks errno to see if the value is representable. -+ if (r == ldbl_infinity) -+ errno = ERANGE; -+ -+ return r; -+} -+ -+// Return a longdouble value from string BUFFER rounded to long double mode. -+ -+longdouble -+Port::strtold (const char *buffer, char **) -+{ -+ longdouble r; -+ real_from_string3 (&r.rv(), buffer, TYPE_MODE (long_double_type_node)); -+ return r; -+} -+ ---- a/src/gcc/d/d-spec.c 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-spec.c 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* d-spec.c -- D frontend for GCC. -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free -@@ -26,18 +26,18 @@ - #include "gcc.h" - #include "opts.h" - --/* This bit is set if we saw a `-xfoo' language specification. */ --#define LANGSPEC (1<<1) -+/* This bit is set if the arguments is a D source file. */ -+#define DSOURCE (1<<1) - /* This bit is set if they did `-lm' or `-lmath'. */ - #define MATHLIB (1<<2) - /* This bit is set if they did `-lpthread'. */ - #define WITHTHREAD (1<<3) --/* This bit is set if they did `-lrt'. */ --#define TIMERLIB (1<<4) --/* This bit is set if they did `-lc'. */ -+ /* This bit is set if they did `-lrt'. */ -+#define TIMELIB (1<<4) -+/* this bit is set if they did `-lstdc++'. */ -+#define WITHLIBCXX (1<<5) -+/* this bit is set if they did `-lc'. */ - #define WITHLIBC (1<<6) --/* This bit is set if the arguments is a D source file. */ --#define D_SOURCE_FILE (1<<7) - /* This bit is set when the argument should not be passed to gcc or the backend */ - #define SKIPOPT (1<<8) - -@@ -48,6 +48,21 @@ - #define MATH_LIBRARY_PROFILE MATH_LIBRARY - #endif - -+#ifndef THREAD_LIBRARY -+#define THREAD_LIBRARY "pthread" -+#endif -+ -+#ifndef TIME_LIBRARY -+#define TIME_LIBRARY "rt" -+#endif -+ -+#ifndef LIBSTDCXX -+#define LIBSTDCXX "stdc++" -+#endif -+#ifndef LIBSTDCXX_PROFILE -+#define LIBSTDCXX_PROFILE LIBSTDCXX -+#endif -+ - #ifndef LIBPHOBOS - #define LIBPHOBOS "gphobos" - #endif -@@ -55,15 +70,9 @@ - #define LIBPHOBOS_PROFILE LIBPHOBOS - #endif - --/* mingw and cygwin don't have pthread. %% TODO: check darwin. */ --#if TARGET_WINDOS || TARGET_OSX || TARGET_ANDROID_D --#define USE_PTHREADS 0 --#else --#define USE_PTHREADS 1 --#endif - - void --lang_specific_driver (struct cl_decoded_option **in_decoded_options, -+lang_specific_driver (cl_decoded_option **in_decoded_options, - unsigned int *in_decoded_options_count, - int *in_added_libraries) - { -@@ -92,44 +101,50 @@ lang_specific_driver (struct cl_decoded_ - int added = 0; - - /* The new argument list will be contained in this. */ -- struct cl_decoded_option *new_decoded_options; -+ cl_decoded_option *new_decoded_options; - - /* "-lm" or "-lmath" if it appears on the command line. */ -- const struct cl_decoded_option *saw_math = 0; -+ const cl_decoded_option *saw_math = 0; - - /* "-lpthread" if it appears on the command line. */ -- const struct cl_decoded_option *saw_thread = 0; -+ const cl_decoded_option *saw_thread = 0; - - /* "-lrt" if it appears on the command line. */ -- const struct cl_decoded_option *saw_librt = 0; -+ const cl_decoded_option *saw_time = 0; - - /* "-lc" if it appears on the command line. */ -- const struct cl_decoded_option *saw_libc = 0; -+ const cl_decoded_option *saw_libc = 0; -+ -+ /* "-lstdc++" if it appears on the command line. */ -+ const cl_decoded_option *saw_libcxx = 0; - - /* An array used to flag each argument that needs a bit set for -- LANGSPEC, MATHLIB, WITHTHREAD, or WITHLIBC. */ -+ DSOURCE, MATHLIB, WITHTHREAD, WITHLIBC or WITHLIBCXX. */ - int *args; - -- /* Whether we need the thread library. */ -- int need_thread = 0; -+ /* Whether we need the C++ STD library. */ -+ int need_stdcxx = 0; - - /* By default, we throw on the math library if we have one. */ - int need_math = (MATH_LIBRARY[0] != '\0'); - -+ /* Whether we need the thread library. */ -+ int need_thread = (THREAD_LIBRARY[0] != '\0'); -+ -+ /* By default, we throw on the time library if we have one. */ -+ int need_time = (TIME_LIBRARY[0] != '\0'); -+ - /* True if we saw -static. */ - int static_link = 0; - - /* True if we should add -shared-libgcc to the command-line. */ - int shared_libgcc = 1; - -- /* True if libphobos should be linked statically. */ -- int static_phobos = 1; -- - /* The total number of arguments with the new stuff. */ - int argc; - - /* The argument list. */ -- struct cl_decoded_option *decoded_options; -+ cl_decoded_option *decoded_options; - - /* What default library to use instead of phobos */ - const char *defaultlib = NULL; -@@ -206,17 +221,28 @@ lang_specific_driver (struct cl_decoded_ - break; - - case OPT_l: -- if (strcmp (arg, "m") == 0 -- || strcmp (arg, "math") == 0 -- || strcmp (arg, MATH_LIBRARY) == 0) -+ if ((strcmp (arg, LIBSTDCXX) == 0) -+ || (strcmp (arg, LIBSTDCXX_PROFILE) == 0)) -+ { -+ args[i] |= WITHLIBCXX; -+ need_stdcxx = 0; -+ } -+ else if ((strcmp (arg, MATH_LIBRARY) == 0) -+ || (strcmp (arg, MATH_LIBRARY_PROFILE) == 0)) - { - args[i] |= MATHLIB; - need_math = 0; - } -- else if (strcmp (arg, "pthread") == 0) -- args[i] |= WITHTHREAD; -- else if (strcmp (arg, "rt") == 0) -- args[i] |= TIMERLIB; -+ else if (strcmp (arg, THREAD_LIBRARY) == 0) -+ { -+ args[i] |= WITHTHREAD; -+ need_thread = 0; -+ } -+ else if (strcmp (arg, TIME_LIBRARY) == 0) -+ { -+ args[i] |= TIMELIB; -+ need_time = 0; -+ } - else if (strcmp (arg, "c") == 0) - args[i] |= WITHLIBC; - else -@@ -233,7 +259,8 @@ lang_specific_driver (struct cl_decoded_ - saw_debug_flag = 1; - - case OPT_x: -- if (library == 0 && (strcmp (arg, "d") == 0)) -+ if (library == 0 -+ && (strcmp (arg, "d") == 0)) - library = 1; - break; - -@@ -290,17 +317,34 @@ lang_specific_driver (struct cl_decoded_ - { - int len; - -- if (library == 0) -- library = 1; -+ if (arg[0] == '\0' || arg[1] == '\0') -+ continue; - - len = strlen (arg); -- if (len > 2 && strcmp (arg + len - 2, ".d") == 0) -+ /* Record that this is a D source file. */ -+ if (len <= 2 || strcmp (arg + len - 2, ".d") == 0) - { - if (first_d_file == NULL) - first_d_file = arg; -- args[i] |= D_SOURCE_FILE; -+ -+ args[i] |= DSOURCE; -+ } -+ -+ /* If we don't know that this is a interface file, we might -+ need to be link against libphobos library. */ -+ if (library == 0) -+ { -+ if (len <= 3 || strcmp (arg + len - 3, ".di") != 0) -+ library = 1; - } - -+ /* If this is a C++ source file, we'll need to link -+ against libstdc++ library. */ -+ if ((len <= 3 || strcmp (arg + len - 3, ".cc") == 0) -+ || (len <= 4 || strcmp (arg + len - 4, ".cpp") == 0) -+ || (len <= 4 || strcmp (arg + len - 4, ".c++") == 0)) -+ need_stdcxx = 1; -+ - break; - } - } -@@ -324,7 +368,7 @@ lang_specific_driver (struct cl_decoded_ - library: -lgphobos. The -pthread argument is added by - setting need_thread. */ - num_args = argc + added + need_math + shared_libgcc + (library > 0) * 4 + 2; -- new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args); -+ new_decoded_options = XNEWVEC (cl_decoded_option, num_args); - - i = 0; - j = 0; -@@ -357,10 +401,10 @@ lang_specific_driver (struct cl_decoded_ - saw_thread = &decoded_options[i]; - } - -- if (!saw_librt && (args[i] & TIMERLIB) && library > 0) -+ if (!saw_time && (args[i] & TIMELIB) && library > 0) - { - --j; -- saw_librt = &decoded_options[i]; -+ saw_time = &decoded_options[i]; - } - - if (!saw_libc && (args[i] & WITHLIBC) && library > 0) -@@ -369,7 +413,13 @@ lang_specific_driver (struct cl_decoded_ - saw_libc = &decoded_options[i]; - } - -- if (args[i] & D_SOURCE_FILE) -+ if (!saw_libcxx && (args[i] & WITHLIBCXX) && library > 0) -+ { -+ --j; -+ saw_libcxx = &decoded_options[i]; -+ } -+ -+ if (args[i] & DSOURCE) - { - if (only_source_option) - --j; -@@ -439,25 +489,30 @@ lang_specific_driver (struct cl_decoded_ - j++; - } - #endif -- --#if USE_PTHREADS -- /* When linking libphobos statically we also need to link with the -- pthread library. */ -- if (library > 1 || static_link || static_phobos) -- need_thread = 1; --#endif - } - else if (saw_debug_flag && debuglib) - { -- generate_option (OPT_l, debuglib, 1, CL_DRIVER, &new_decoded_options[j]); -+ generate_option (OPT_l, debuglib, 1, CL_DRIVER, -+ &new_decoded_options[j++]); - added_libraries++; -- j++; - } - else if (defaultlib) - { -- generate_option (OPT_l, defaultlib, 1, CL_DRIVER, &new_decoded_options[j]); -+ generate_option (OPT_l, defaultlib, 1, CL_DRIVER, -+ &new_decoded_options[j++]); -+ added_libraries++; -+ } -+ -+ if (saw_libcxx) -+ new_decoded_options[j++] = *saw_libcxx; -+ else if (library > 0 && need_stdcxx) -+ { -+ generate_option (OPT_l, -+ (saw_profile_flag -+ ? LIBSTDCXX_PROFILE -+ : LIBSTDCXX), -+ 1, CL_DRIVER, &new_decoded_options[j++]); - added_libraries++; -- j++; - } - - if (saw_math) -@@ -468,33 +523,27 @@ lang_specific_driver (struct cl_decoded_ - (saw_profile_flag - ? MATH_LIBRARY_PROFILE - : MATH_LIBRARY), -- 1, CL_DRIVER, &new_decoded_options[j]); -+ 1, CL_DRIVER, &new_decoded_options[j++]); - added_libraries++; -- j++; - } - - if (saw_thread) - new_decoded_options[j++] = *saw_thread; - else if (library > 0 && need_thread) - { -- generate_option (OPT_l, "pthread", 1, CL_DRIVER, -- &new_decoded_options[j]); -+ generate_option (OPT_l, THREAD_LIBRARY, 1, CL_DRIVER, -+ &new_decoded_options[j++]); - added_libraries++; -- j++; - } - -- if (saw_librt) -- new_decoded_options[j++] = *saw_librt; --#if TARGET_LINUX && !TARGET_ANDROID_D -- /* Only link if linking statically and target platform supports. */ -- else if (library > 1 || static_link || static_phobos) -+ if (saw_time) -+ new_decoded_options[j++] = *saw_time; -+ else if (library > 0 && need_time) - { -- generate_option (OPT_l, "rt", 1, CL_DRIVER, -- &new_decoded_options[j]); -+ generate_option (OPT_l, TIME_LIBRARY, 1, CL_DRIVER, -+ &new_decoded_options[j++]); - added_libraries++; -- j++; - } --#endif - - if (saw_libc) - new_decoded_options[j++] = *saw_libc; -@@ -502,8 +551,7 @@ lang_specific_driver (struct cl_decoded_ - if (shared_libgcc && !static_link) - { - generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER, -- &new_decoded_options[j]); -- j++; -+ &new_decoded_options[j++]); - } - - *in_decoded_options_count = j; -@@ -512,16 +560,13 @@ lang_specific_driver (struct cl_decoded_ - } - - /* Called before linking. Returns 0 on success and -1 on failure. */ -+ - int lang_specific_pre_link (void) /* Not used for D. */ - { - return 0; - } - - /* Number of extra output files that lang_specific_pre_link may generate. */ -+ - int lang_specific_extra_outfiles = 0; /* Not used for D. */ - --/* Table of language-specific spec functions. */ --const struct spec_function lang_specific_spec_functions[] = --{ -- { 0, 0 } /* Not used for D. */ --}; ---- a/src/gcc/d/d-system.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-system.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-system.h -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -46,6 +46,9 @@ - - #include "cgraph.h" - #include "tree-iterator.h" -+#include "tree-ssa-alias.h" -+#include "internal-fn.h" -+#include "is-a.h" - #include "gimple.h" - #include "vec.h" - ---- a/src/gcc/d/d-target.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-target.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -110,7 +110,10 @@ Target::critsecsize (void) - else if (global.params.isLinux) - { - // sizeof(pthread_mutex_t) for Linux. -- return global.params.isLP64 ? 40 : 24; -+ if (global.params.is64bit) -+ return global.params.isLP64 ? 40 : 32; -+ else -+ return global.params.isLP64 ? 40 : 24; - } - else if (global.params.isFreeBSD) - { ---- a/src/gcc/d/d-todt.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-todt.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-todt.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -23,9 +23,14 @@ - #include "id.h" - #include "init.h" - #include "scope.h" -+#include "ctfe.h" -+ - #include "dfrontend/target.h" - --typedef ArrayBase<dt_t> Dts; -+typedef Array<dt_t> Dts; -+ -+extern FuncDeclaration *search_toHash(StructDeclaration *sd); -+extern FuncDeclaration *search_toString(StructDeclaration *sd); - - - // Append VAL to constructor PDT. Create a new constructor -@@ -111,7 +116,7 @@ dt_container2 (dt_t *dt) - } - } - else -- dt = build_constructor (d_unknown_type_node, NULL); -+ dt = build_constructor (aggtype, NULL); - - TYPE_FIELDS (aggtype) = fields; - TYPE_SIZE (aggtype) = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT)); -@@ -186,7 +191,10 @@ build_vptr_monitor (dt_t **pdt, ClassDec - gcc_assert (cd != NULL); - Symbol *s = cd->toVtblSymbol(); - dt_cons (pdt, build_address (s->Stree)); -- dt_cons (pdt, size_int (0)); -+ -+ if (!cd->cpp) -+ dt_cons (pdt, size_int (0)); -+ - return pdt; - } - -@@ -214,128 +222,8 @@ VoidInitializer::toDt (void) - dt_t * - StructInitializer::toDt (void) - { -- Dts dts; -- dts.setDim (ad->fields.dim); -- dts.zero(); -- -- for (size_t i = 0; i < vars.dim; i++) -- { -- VarDeclaration *v = vars[i]; -- Initializer *val = value[i]; -- -- for (size_t j = 0; true; j++) -- { -- gcc_assert (j < dts.dim); -- -- if (ad->fields[j] == v) -- { -- if (dts[j]) -- error (loc, "field %s of %s already initialized", v->toChars(), ad->toChars()); -- dts[j] = val->toDt(); -- break; -- } -- } -- } -- -- size_t offset = 0; -- tree sdt = NULL_TREE; -- -- for (size_t i = 0; i < dts.dim; i++) -- { -- VarDeclaration *v = ad->fields[i]; -- tree fdt = dts[i]; -- -- if (fdt == NULL_TREE) -- { -- // An instance specific initialiser was not provided. -- // Look to see if there's a default initialiser from the -- // struct definition -- if (v->init) -- { -- if (!v->init->isVoidInitializer()) -- fdt = v->init->toDt(); -- } -- else if (v->offset >= offset) -- { -- size_t offset2 = v->offset + v->type->size(); -- -- // Make sure this field does not overlap any explicitly -- // initialized field. -- for (size_t j = i + 1; true; j++) -- { -- // Didn't find any overlap. -- if (j == dts.dim) -- { -- v->type->toDt (&fdt); -- break; -- } -- -- VarDeclaration *v2 = ad->fields[j]; -- -- // Overlap. -- if (v2->offset < offset2 && dts[j]) -- break; -- } -- } -- } -- -- if (fdt != NULL_TREE) -- { -- if (v->offset < offset) -- error (loc, "duplicate union initialization for %s", v->toChars()); -- else -- { -- size_t sz = int_size_in_bytes (TREE_TYPE (CONSTRUCTOR_ELT (fdt, 0)->value)); -- size_t vsz = v->type->size(); -- size_t voffset = v->offset; -- size_t dim = 1; -- -- if (sz > vsz) -- { -- gcc_assert (v->type->ty == Tsarray && vsz == 0); -- error (loc, "zero length array %s has non-zero length initializer", v->toChars()); -- } -- -- for (Type *vt = v->type->toBasetype(); -- vt->ty == Tsarray; vt = vt->nextOf()->toBasetype()) -- { -- TypeSArray *tsa = (TypeSArray *) vt; -- dim *= tsa->dim->toInteger(); -- } -- -- gcc_assert (sz == vsz || sz * dim <= vsz); -- -- for (size_t i = 0; i < dim; i++) -- { -- if (offset < voffset) -- dt_zeropad (&sdt, voffset - offset); -- -- if (fdt == NULL_TREE) -- { -- if (v->init) -- fdt = v->init->toDt(); -- else -- v->type->toDt (&fdt); -- } -- -- dt_chainon (&sdt, fdt); -- fdt = NULL_TREE; -- -- offset = voffset + sz; -- voffset += vsz / dim; -- if (sz == vsz) -- break; -- } -- } -- } -- } -- -- if (offset < ad->structsize) -- dt_zeropad (&sdt, ad->structsize - offset); -- -- tree cdt = NULL_TREE; -- dt_container (&cdt, ad->type, sdt); -- return cdt; -+ ::error ("StructInitializer::toDt: we shouldn't emit this (%s)", toChars()); -+ gcc_unreachable(); - } - - dt_t * -@@ -363,7 +251,7 @@ ArrayInitializer::toDt (void) - tree dt = val->toDt(); - - if (dts[length]) -- error(loc, "duplicate initializations for index %d", length); -+ error (loc, "duplicate initializations for index %d", length); - dts[length] = dt; - length++; - } -@@ -509,112 +397,56 @@ ArrayLiteralExp::toDt (dt_t **pdt) - dt_t ** - StructLiteralExp::toDt (dt_t **pdt) - { -- // For elements[], construct a corresponding array dts[] the elements -- // of which are the initializers. -- // Nulls in elements[] become nulls in dts[]. -- Dts dts; -- dts.setDim (sd->fields.dim); -- dts.zero(); -+ tree sdt = NULL_TREE; -+ size_t offset = 0; - -- gcc_assert (elements->dim <= sd->fields.dim); -+ gcc_assert (sd->fields.dim - sd->isNested() <= elements->dim); - - for (size_t i = 0; i < elements->dim; i++) - { - Expression *e = (*elements)[i]; - if (!e) - continue; -- tree dt = NULL_TREE; -- e->toDt (&dt); -- dts[i] = dt; -- } - -- size_t offset = 0; -- tree sdt = NULL_TREE; -+ VarDeclaration *vd = NULL; -+ size_t k = 0; - -- for (size_t i = 0; i < dts.dim; i++) -- { -- VarDeclaration *v = sd->fields[i]; -- tree fdt = dts[i]; -- -- if (fdt == NULL_TREE) -+ for (size_t j = i; j < elements->dim; j++) - { -- // An instance specific initialiser was not provided. -- // If there is no overlap with any explicit initialiser in dts[], -- // supply a default initialiser. -- if (v->offset >= offset) -- { -- size_t offset2 = v->offset + v->type->size(); -- -- for (size_t j = i + 1; 1; j++) -- { -- // Didn't find any overlap -- if (j == dts.dim) -- { -- // Set fdt to be the default initialiser -- if (v->init) -- fdt = v->init->toDt(); -- else -- v->type->toDt (&fdt); -- break; -- } -- -- VarDeclaration *v2 = sd->fields[j]; -+ VarDeclaration *vd2 = sd->fields[j]; -+ if (vd2->offset < offset || (*elements)[j] == NULL) -+ continue; - -- // Overlap -- if (v2->offset < offset2 && dts[j]) -- break; -- } -+ // Find the nearest field -+ if (!vd) -+ { -+ vd = vd2; -+ k = j; -+ } -+ else if (vd2->offset < vd->offset) -+ { -+ // Each elements should have no overlapping -+ gcc_assert (!(vd->offset < vd2->offset + vd2->type->size() -+ && vd2->offset < vd->offset + vd->type->size())); -+ vd = vd2; -+ k = j; - } - } - -- if (fdt != NULL_TREE) -+ if (vd != NULL) - { -- if (v->offset < offset) -- error ("duplicate union initialization for %s", v->toChars()); -- else -- { -- size_t sz = int_size_in_bytes (TREE_TYPE (CONSTRUCTOR_ELT (fdt, 0)->value)); -- size_t vsz = v->type->size(); -- size_t voffset = v->offset; -- size_t dim = 1; -+ if (offset < vd->offset) -+ dt_zeropad (&sdt, vd->offset - offset); - -- if (sz > vsz) -- { -- gcc_assert (v->type->ty == Tsarray && vsz == 0); -- error ("zero length array %s has non-zero length initializer", v->toChars()); -- } -- -- for (Type *vt = v->type->toBasetype(); -- vt->ty == Tsarray; vt = vt->nextOf()->toBasetype()) -- { -- TypeSArray *tsa = (TypeSArray *) vt; -- dim *= tsa->dim->toInteger(); -- } -- -- gcc_assert (sz == vsz || sz * dim <= vsz); -- -- for (size_t i = 0; i < dim; i++) -- { -- if (offset < voffset) -- dt_zeropad (&sdt, voffset - offset); -- -- if (fdt == NULL_TREE) -- { -- if (v->init) -- fdt = v->init->toDt(); -- else -- v->type->toDt (&fdt); -- } -+ e = (*elements)[k]; - -- dt_chainon (&sdt, fdt); -- fdt = NULL_TREE; -+ Type *tb = vd->type->toBasetype(); -+ if (tb->ty == Tsarray) -+ ((TypeSArray *)tb)->toDtElem (&sdt, e); -+ else -+ e->toDt (&sdt); - -- offset = voffset + sz; -- voffset += vsz / dim; -- if (sz == vsz) -- break; -- } -- } -+ offset = vd->offset + vd->type->size(); - } - } - -@@ -713,6 +545,250 @@ VectorExp::toDt (dt_t **pdt) - return pdt; - } - -+dt_t ** -+CastExp::toDt (dt_t **pdt) -+{ -+ if (e1->type->ty == Tclass && type->ty == Tclass) -+ { -+ TypeClass *tc = (TypeClass *) type; -+ if (tc->sym->isInterfaceDeclaration()) -+ { -+ // Casting from class to interface. -+ gcc_assert (e1->op == TOKclassreference); -+ -+ ClassReferenceExp *exp = (ClassReferenceExp *) e1; -+ ClassDeclaration *from = exp->originalClass(); -+ InterfaceDeclaration *to = (InterfaceDeclaration *) tc->sym; -+ int off = 0; -+ int isbase = to->isBaseOf (from, &off); -+ gcc_assert (isbase); -+ -+ return exp->toDtI (pdt, off); -+ } -+ else -+ { -+ // Casting from class to class. -+ return e1->toDt (pdt); -+ } -+ } -+ -+ return UnaExp::toDt (pdt); -+} -+ -+dt_t ** -+AddrExp::toDt (dt_t **pdt) -+{ -+ if (e1->op == TOKstructliteral) -+ { -+ StructLiteralExp *sl = (StructLiteralExp *) e1; -+ tree dt = build_address (sl->toSymbol()->Stree); -+ return dt_cons (pdt, dt); -+ } -+ -+ return UnaExp::toDt (pdt); -+} -+ -+dt_t ** -+ClassReferenceExp::toDt (dt_t **pdt) -+{ -+ InterfaceDeclaration *to = ((TypeClass *) type)->sym->isInterfaceDeclaration(); -+ -+ if (to != NULL) -+ { -+ // Static typeof this literal is an interface. -+ // We must add offset to symbol. -+ ClassDeclaration *from = originalClass(); -+ int off = 0; -+ int isbase = to->isBaseOf (from, &off); -+ gcc_assert (isbase); -+ -+ return toDtI (pdt, off); -+ } -+ -+ return toDtI (pdt, 0); -+} -+ -+dt_t ** -+ClassReferenceExp::toDtI (dt_t **pdt, int off) -+{ -+ tree dt = build_address (toSymbol()->Stree); -+ -+ if (off != 0) -+ dt = build_offset (dt, size_int (off)); -+ -+ return dt_cons (pdt, dt); -+} -+ -+dt_t ** -+ClassReferenceExp::toInstanceDt (dt_t **pdt) -+{ -+ ClassDeclaration *cd = originalClass(); -+ Dts dts; -+ dts.setDim (value->elements->dim); -+ dts.zero(); -+ -+ for (size_t i = 0; i < value->elements->dim; i++) -+ { -+ Expression *e = (*value->elements)[i]; -+ if (!e) -+ continue; -+ tree dt = NULL_TREE; -+ e->toDt (&dt); -+ dts[i] = dt; -+ } -+ -+ /* Put out: -+ * void **vptr; -+ * monitor_t monitor; -+ */ -+ build_vptr_monitor (pdt, cd); -+ -+ // Put out rest of class fields. -+ return toDt2 (pdt, cd, &dts); -+} -+ -+// Generates the data for the static initializer of class variable. -+// DTS is an array of dt fields, which values have been evaluated in compile time. -+// CD - is a ClassDeclaration, for which initializing data is being built -+// this function, being alike to ClassDeclaration::toDt2, recursively builds the dt for all base classes. -+ -+dt_t ** -+ClassReferenceExp::toDt2 (dt_t **pdt, ClassDeclaration *cd, Dts *dts) -+{ -+ // Note equivalence of this implementation to class's -+ size_t offset; -+ -+ if (cd->baseClass) -+ { -+ toDt2 (pdt, cd->baseClass, dts); -+ offset = cd->baseClass->structsize; -+ } -+ else -+ offset = Target::ptrsize * 2; -+ -+ for (size_t i = 0; i < cd->fields.dim; i++) -+ { -+ VarDeclaration *v = cd->fields[i]; -+ int index = findFieldIndexByName (v); -+ gcc_assert (index != -1); -+ -+ tree fdt = (*dts)[index]; -+ -+ if (fdt == NULL_TREE) -+ { -+ tree dt = NULL_TREE; -+ Initializer *init = v->init; -+ -+ if (init) -+ { -+ ExpInitializer *ei = init->isExpInitializer(); -+ Type *tb = v->type->toBasetype(); -+ if (!init->isVoidInitializer()) -+ { -+ if (ei && tb->ty == Tsarray) -+ ((TypeSArray *) tb)->toDtElem (&dt, ei->exp); -+ else -+ dt = init->toDt(); -+ } -+ } -+ else if (v->offset >= offset) -+ v->type->toDt (&dt); -+ -+ if (dt != NULL_TREE) -+ { -+ if (v->offset < offset) -+ error ("duplicated union initialization for %s", v->toChars()); -+ else -+ { -+ if (offset < v->offset) -+ dt_zeropad (pdt, v->offset - offset); -+ dt_chainon (pdt, dt); -+ offset = v->offset + v->type->size(); -+ } -+ } -+ } -+ -+ if (fdt != NULL_TREE) -+ { -+ if (v->offset < offset) -+ error ("duplicate union initialization for %s", v->toChars()); -+ else -+ { -+ size_t sz = int_size_in_bytes (TREE_TYPE (CONSTRUCTOR_ELT (fdt, 0)->value)); -+ size_t vsz = v->type->size(); -+ size_t voffset = v->offset; -+ size_t dim = 1; -+ -+ if (sz > vsz) -+ { -+ gcc_assert (v->type->ty == Tsarray && vsz == 0); -+ error ("zero length array %s has non-zero length initializer", v->toChars()); -+ } -+ -+ for (Type *vt = v->type->toBasetype(); -+ vt->ty == Tsarray; vt = vt->nextOf()->toBasetype()) -+ { -+ TypeSArray *tsa = (TypeSArray *) vt; -+ dim *= tsa->dim->toInteger(); -+ } -+ -+ gcc_assert (sz == vsz || sz * dim <= vsz); -+ -+ for (size_t i = 0; i < dim; i++) -+ { -+ if (offset < voffset) -+ dt_zeropad (pdt, voffset - offset); -+ -+ if (fdt == NULL_TREE) -+ { -+ if (v->init) -+ fdt = v->init->toDt(); -+ else -+ v->type->toDt (&fdt); -+ } -+ -+ dt_chainon (pdt, fdt); -+ fdt = NULL_TREE; -+ -+ offset = voffset + sz; -+ voffset += vsz / dim; -+ if (sz == vsz) -+ break; -+ } -+ } -+ } -+ } -+ -+ // Interface vptr initializations -+ cd->toSymbol(); -+ -+ for (size_t i = 0; i < cd->vtblInterfaces->dim; i++) -+ { -+ BaseClass *b = (*cd->vtblInterfaces)[i]; -+ -+ for (ClassDeclaration *cd2 = originalClass(); 1; cd2 = cd2->baseClass) -+ { -+ gcc_assert (cd2); -+ unsigned csymoffset = cd2->baseVtblOffset (b); -+ if (csymoffset != (unsigned) ~0) -+ { -+ tree dt = build_address (cd2->toSymbol()->Stree); -+ if (offset < (size_t) b->offset) -+ dt_zeropad (pdt, b->offset - offset); -+ dt_cons (pdt, build_offset (dt, size_int (csymoffset))); -+ break; -+ } -+ } -+ -+ offset = b->offset + Target::ptrsize; -+ } -+ -+ if (offset < cd->structsize) -+ dt_zeropad (pdt, cd->structsize - offset); -+ -+ return pdt; -+} -+ - /* ================================================================ */ - - // Generate the data for the static initialiser. -@@ -810,60 +886,14 @@ ClassDeclaration::toDt2 (dt_t **pdt, Cla - void - StructDeclaration::toDt (dt_t **pdt) - { -- size_t offset = 0; -- tree sdt = NULL_TREE; -+ StructLiteralExp *sle = new StructLiteralExp (loc, this, NULL); -+ Expression *e = sle->fill (true); - -- // Note equivalence of this loop to class's -- for (size_t i = 0; i < fields.dim; i++) -+ if (e == sle) - { -- size_t vsize; -- VarDeclaration *v = fields[i]; -- tree dt = NULL_TREE; -- -- if (v->storage_class & STCref) -- { -- vsize = Target::ptrsize; -- if (v->offset >= offset) -- dt_zeropad (&dt, vsize); -- } -- else -- { -- vsize = v->type->size(); -- Initializer *init = v->init; -- if (init) -- { -- ExpInitializer *ei = init->isExpInitializer(); -- Type *tb = v->type->toBasetype(); -- if (!init->isVoidInitializer()) -- { -- if (ei && tb->ty == Tsarray) -- ((TypeSArray *) tb)->toDtElem (&dt, ei->exp); -- else -- dt = init->toDt(); -- } -- } -- else if (v->offset >= offset) -- v->type->toDt (&dt); -- } -- -- if (dt != NULL_TREE) -- { -- if (v->offset < offset) -- error("overlapping initialization for struct %s.%s", toChars(), v->toChars()); -- else -- { -- if (offset < v->offset) -- dt_zeropad (&sdt, v->offset - offset); -- dt_chainon (&sdt, dt); -- offset = v->offset + vsize; -- } -- } -+ sle->type = type; -+ sle->toDt (pdt); - } -- -- if (offset < structsize) -- dt_zeropad (&sdt, structsize - offset); -- -- dt_container (pdt, type, sdt); - } - - /* ================================================================ */ -@@ -878,6 +908,13 @@ Type::toDt (dt_t **pdt) - } - - dt_t ** -+TypeVector::toDt (dt_t **pdt) -+{ -+ gcc_assert (basetype->ty == Tsarray); -+ return ((TypeSArray *) basetype)->toDtElem (pdt, NULL); -+} -+ -+dt_t ** - TypeSArray::toDt (dt_t **pdt) - { - return toDtElem (pdt, NULL); -@@ -890,9 +927,11 @@ TypeSArray::toDtElem (dt_t **pdt, Expres - - if (len) - { -+ tree dt = NULL_TREE; - Type *tnext = next; - Type *tbn = tnext->toBasetype(); -- tree dt = NULL_TREE; -+ if (tbn->ty == Tvector) -+ tbn = ((TypeVector *) tbn)->basetype; - - if (e && (e->op == TOKstring || e->op == TOKarrayliteral)) - { -@@ -974,13 +1013,13 @@ verify_structsize (ClassDeclaration *typ - void - TypeInfoDeclaration::toDt (dt_t **pdt) - { -- verify_structsize (Type::typeinfo, 2 * Target::ptrsize); -+ verify_structsize (Type::dtypeinfo, 2 * Target::ptrsize); - - /* Put out: - * void **vptr; - * monitor_t monitor; - */ -- build_vptr_monitor (pdt, Type::typeinfo); -+ build_vptr_monitor (pdt, Type::dtypeinfo); - } - - void -@@ -1131,7 +1170,7 @@ TypeInfoEnumDeclaration::toDt (dt_t **pd - // TypeInfo for enum members. - if (sd->memtype) - { -- sd->memtype->getTypeInfo(NULL); -+ sd->memtype->getTypeInfo (NULL); - dt_cons (pdt, build_address (sd->memtype->vtinfo->toSymbol()->Stree)); - } - else -@@ -1142,7 +1181,7 @@ TypeInfoEnumDeclaration::toDt (dt_t **pd - - // Default initialiser for enum. - tree tarray = Type::tvoid->arrayOf()->toCtype(); -- if (!sd->defaultval || tinfo->isZeroInit()) -+ if (!sd->members || tinfo->isZeroInit()) - { - // zero initialiser, or the same as the base type. - dt_cons (pdt, d_array_value (tarray, size_int (0), d_null_pointer)); -@@ -1167,7 +1206,7 @@ TypeInfoPointerDeclaration::toDt (dt_t * - gcc_assert (tinfo->ty == Tpointer); - - TypePointer *tc = (TypePointer *) tinfo; -- tc->next->getTypeInfo(NULL); -+ tc->next->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_Pointer - build_vptr_monitor (pdt, Type::typeinfopointer); -@@ -1189,7 +1228,7 @@ TypeInfoArrayDeclaration::toDt (dt_t **p - gcc_assert (tinfo->ty == Tarray); - - TypeDArray *tc = (TypeDArray *) tinfo; -- tc->next->getTypeInfo(NULL); -+ tc->next->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_Array - build_vptr_monitor (pdt, Type::typeinfoarray); -@@ -1212,7 +1251,7 @@ TypeInfoStaticArrayDeclaration::toDt (dt - gcc_assert (tinfo->ty == Tsarray); - - TypeSArray *tc = (TypeSArray *) tinfo; -- tc->next->getTypeInfo(NULL); -+ tc->next->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_StaticArray - build_vptr_monitor (pdt, Type::typeinfostaticarray); -@@ -1237,7 +1276,7 @@ TypeInfoVectorDeclaration::toDt (dt_t ** - gcc_assert (tinfo->ty == Tvector); - - TypeVector *tc = (TypeVector *) tinfo; -- tc->basetype->getTypeInfo(NULL); -+ tc->basetype->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_Vector - build_vptr_monitor (pdt, Type::typeinfovector); -@@ -1261,9 +1300,9 @@ TypeInfoAssociativeArrayDeclaration::toD - gcc_assert (tinfo->ty == Taarray); - - TypeAArray *tc = (TypeAArray *) tinfo; -- tc->next->getTypeInfo(NULL); -- tc->index->getTypeInfo(NULL); -- tc->getImpl()->type->getTypeInfo(NULL); -+ tc->next->getTypeInfo (NULL); -+ tc->index->getTypeInfo (NULL); -+ tc->getImpl()->type->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_AssociativeArray - build_vptr_monitor (pdt, Type::typeinfoassociativearray); -@@ -1293,7 +1332,7 @@ TypeInfoFunctionDeclaration::toDt (dt_t - gcc_assert (tinfo->deco); - - TypeFunction *tc = (TypeFunction *) tinfo; -- tc->next->getTypeInfo(NULL); -+ tc->next->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_Function - build_vptr_monitor (pdt, Type::typeinfofunction); -@@ -1320,7 +1359,7 @@ TypeInfoDelegateDeclaration::toDt (dt_t - gcc_assert (tinfo->deco); - - TypeDelegate *tc = (TypeDelegate *) tinfo; -- tc->next->nextOf()->getTypeInfo(NULL); -+ tc->next->nextOf()->getTypeInfo (NULL); - - // vtbl and monitor for TypeInfo_Delegate - build_vptr_monitor (pdt, Type::typeinfodelegate); -@@ -1349,7 +1388,7 @@ TypeInfoStructDeclaration::toDt (dt_t ** - * bool function(in void*, in void*) xopEquals; - * int function(in void*, in void*) xopCmp; - * string function(const(void)*) xtoString; -- * uint m_flags; -+ * StructFlags m_flags; - * xdtor; - * xpostblit; - * uint m_align; -@@ -1366,6 +1405,9 @@ TypeInfoStructDeclaration::toDt (dt_t ** - // vtbl and monitor for TypeInfo_Struct - build_vptr_monitor (pdt, Type::typeinfostruct); - -+ if (!sd->members) -+ return; -+ - // Name of the struct declaration. - dt_cons (pdt, d_array_string (sd->toPrettyChars())); - -@@ -1377,32 +1419,16 @@ TypeInfoStructDeclaration::toDt (dt_t ** - dt_cons (pdt, build_address (sd->toInitializer()->Stree)); - - // hash_t function(in void*) xtoHash; -- Dsymbol *s = search_function(sd, Id::tohash); -- FuncDeclaration *fdx = s ? s->isFuncDeclaration() : NULL; -+ FuncDeclaration *fdx = search_toHash(sd); - if (fdx) - { -- static TypeFunction *tftohash; -- if (!tftohash) -- { -- Scope sc; -- // const hash_t toHash(); -- tftohash = new TypeFunction (NULL, Type::thash_t, 0, LINKd); -- tftohash->mod = MODconst; -- tftohash = (TypeFunction *) tftohash->semantic (0, &sc); -- } -+ TypeFunction *tf = (TypeFunction *) fdx->type; -+ gcc_assert(tf->ty == Tfunction); - -- FuncDeclaration *fd = fdx->overloadExactMatch(tftohash); -- if (fd) -- { -- dt_cons (pdt, build_address (fd->toSymbol()->Stree)); -- TypeFunction *tf = (TypeFunction *) fd->type; -- gcc_assert(tf->ty == Tfunction); -+ dt_cons (pdt, build_address (fdx->toSymbol()->Stree)); - -- if (!tf->isnothrow || tf->trust == TRUSTsystem) -- warning(fd->loc, "toHash() must be declared as extern (D) size_t toHash() const nothrow @safe, not %s", tf->toChars()); -- } -- else -- dt_cons (pdt, d_null_pointer); -+ if (!tf->isnothrow || tf->trust == TRUSTsystem) -+ warning (fdx->loc, "toHash() must be declared as extern (D) size_t toHash() const nothrow @safe, not %s", tf->toChars()); - } - else - dt_cons (pdt, d_null_pointer); -@@ -1414,57 +1440,26 @@ TypeInfoStructDeclaration::toDt (dt_t ** - dt_cons (pdt, d_null_pointer); - - // int function(in void*, in void*) xopCmp; -- s = search_function(sd, Id::cmp); -- fdx = s ? s->isFuncDeclaration() : NULL; -- if (fdx) -- { -- Scope sc; -- -- // const int opCmp(ref const KeyType s); -- Parameters *arguments = new Parameters; -- -- // arg type is ref const T -- Parameter *arg = new Parameter(STCref, tc->constOf(), NULL, NULL); -- arguments->push(arg); -- -- TypeFunction *tfcmpptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); -- tfcmpptr->mod = MODconst; -- tfcmpptr = (TypeFunction *) tfcmpptr->semantic(0, &sc); -- -- FuncDeclaration *fd = fdx->overloadExactMatch(tfcmpptr); -- if (fd) -- dt_cons (pdt, build_address (fd->toSymbol()->Stree)); -- else -- dt_cons (pdt, d_null_pointer); -- } -+ if (sd->xcmp) -+ dt_cons (pdt, build_address (sd->xcmp->toSymbol()->Stree)); - else - dt_cons (pdt, d_null_pointer); - - // string function(const(void)*) xtoString; -- s = search_function(sd, Id::tostring); -- fdx = s ? s->isFuncDeclaration() : NULL; -+ fdx = search_toString(sd); - if (fdx) -- { -- static TypeFunction *tftostring; -- if (!tftostring) -- { -- Scope sc; -- // string toString() -- tftostring = new TypeFunction (NULL, Type::tchar->invariantOf()->arrayOf(), 0, LINKd); -- tftostring = (TypeFunction *) tftostring->semantic (0, &sc); -- } -- -- FuncDeclaration *fd = fdx->overloadExactMatch(tftostring); -- if (fd) -- dt_cons (pdt, build_address (fd->toSymbol()->Stree)); -- else -- dt_cons (pdt, d_null_pointer); -- } -+ dt_cons (pdt, build_address (fdx->toSymbol()->Stree)); - else - dt_cons (pdt, d_null_pointer); - - // uint m_flags; -- dt_cons (pdt, size_int (tc->hasPointers())); -+ // StructFlags::Type m_flags; -+ StructFlags::Type m_flags = 0; -+ -+ if (tc->hasPointers()) -+ m_flags |= StructFlags::hasPointers; -+ -+ dt_cons (pdt, size_int (m_flags)); - - // xdtor - if (sd->dtor) -@@ -1508,7 +1503,7 @@ TypeInfoStructDeclaration::toDt (dt_t ** - else - { - // If struct has pointers. -- if (tc->hasPointers()) -+ if (m_flags & StructFlags::hasPointers) - dt_cons (pdt, size_int (1)); - else - dt_cons (pdt, size_int (0)); ---- a/src/gcc/d/d-toir.cc 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/d/d-toir.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,569 @@ -+// d-ir.cc -- D frontend for GCC. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. -+ -+// GCC is free software; you can redistribute it and/or modify it under -+// the terms of the GNU General Public License as published by the Free -+// Software Foundation; either version 3, or (at your option) any later -+// version. -+ -+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+// WARRANTY; without even the implied warranty of MERCHANTABILITY or -+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+// for more details. -+ -+#include "d-system.h" -+ -+#include "id.h" -+#include "enum.h" -+#include "module.h" -+#include "init.h" -+#include "d-lang.h" -+#include "d-codegen.h" -+ -+ -+void -+Statement::toIR (IRState *) -+{ -+ ::error ("Statement::toIR: don't know what to do (%s)", toChars()); -+ gcc_unreachable(); -+} -+ -+void -+LabelStatement::toIR (IRState *irs) -+{ -+ FuncDeclaration *func = irs->func; -+ LabelDsymbol *label = irs->isReturnLabel (ident) ? func->returnLabel : func->searchLabel (ident); -+ tree t_label = irs->getLabelTree (label); -+ -+ if (t_label != NULL_TREE) -+ { -+ irs->pushLabel (label); -+ irs->doLabel (t_label); -+ if (irs->isReturnLabel (ident) && func->fensure) -+ func->fensure->toIR (irs); -+ else if (statement) -+ statement->toIR (irs); -+ if (fwdrefs) -+ { -+ irs->checkPreviousGoto (fwdrefs); -+ delete fwdrefs; -+ fwdrefs = NULL; -+ } -+ } -+ // else, there was an error -+} -+ -+void -+GotoStatement::toIR (IRState *irs) -+{ -+ tree t_label; -+ -+ /* This makes the 'undefined label' error show up on the correct line... -+ The extra doLineNote in doJump shouldn't cause a problem. */ -+ irs->doLineNote (loc); -+ -+ if (!label->statement) -+ error ("label %s is undefined", label->toChars()); -+ else if (tf != label->statement->tf) -+ error ("cannot goto forward out of or into finally block"); -+ else -+ irs->checkGoto (this, label); -+ -+ t_label = irs->getLabelTree (label); -+ -+ if (t_label != NULL_TREE) -+ irs->doJump (this, t_label); -+ // else, there was an error -+} -+ -+void -+GotoCaseStatement::toIR (IRState *irs) -+{ -+ // assumes cblocks have been set in SwitchStatement::toIR -+ irs->doJump (this, cs->cblock); -+} -+ -+void -+GotoDefaultStatement::toIR (IRState *irs) -+{ -+ // assumes cblocks have been set in SwitchStatement::toIR -+ irs->doJump (this, sw->sdefault->cblock); -+} -+ -+void -+SwitchErrorStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->addExp (d_assert_call (loc, LIBCALL_SWITCH_ERROR)); -+} -+ -+void -+ThrowStatement::toIR (IRState *irs) -+{ -+ ClassDeclaration *class_decl = exp->type->toBasetype()->isClassHandle(); -+ // Front end already checks for isClassHandle -+ InterfaceDeclaration *intfc_decl = class_decl->isInterfaceDeclaration(); -+ tree arg = exp->toElemDtor (irs); -+ -+ if (!flag_exceptions) -+ { -+ static int warned = 0; -+ if (!warned) -+ { -+ error ("exception handling disabled, use -fexceptions to enable"); -+ warned = 1; -+ } -+ } -+ -+ if (intfc_decl) -+ { -+ if (!intfc_decl->isCOMclass()) -+ arg = convert_expr (arg, exp->type, build_object_type()); -+ else -+ error ("cannot throw COM interfaces"); -+ } -+ irs->doLineNote (loc); -+ irs->addExp (build_libcall (LIBCALL_THROW, 1, &arg)); -+} -+ -+void -+TryFinallyStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->startTry (this); -+ if (body) -+ body->toIR (irs); -+ -+ irs->startFinally(); -+ if (finalbody) -+ finalbody->toIR (irs); -+ -+ irs->endFinally(); -+} -+ -+void -+TryCatchStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->startTry (this); -+ if (body) -+ body->toIR (irs); -+ -+ irs->startCatches(); -+ if (catches) -+ { -+ for (size_t i = 0; i < catches->dim; i++) -+ { -+ Catch *vcatch = (*catches)[i]; -+ -+ irs->startCatch (vcatch->type->toCtype()); -+ irs->doLineNote (vcatch->loc); -+ irs->startScope(); -+ -+ if (vcatch->var) -+ { -+ tree exc_obj = convert_expr (build_exception_object(), -+ build_object_type(), vcatch->type); -+ tree catch_var = vcatch->var->toSymbol()->Stree; -+ tree init = build_vinit (catch_var, exc_obj); -+ -+ build_local_var (vcatch->var, irs->func); -+ irs->addExp (init); -+ } -+ -+ if (vcatch->handler) -+ vcatch->handler->toIR (irs); -+ irs->endScope(); -+ irs->endCatch(); -+ } -+ } -+ irs->endCatches(); -+} -+ -+void -+OnScopeStatement::toIR (IRState *) -+{ -+} -+ -+void -+WithStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->startScope(); -+ if (wthis) -+ { -+ ExpInitializer *ie = wthis->init->isExpInitializer(); -+ gcc_assert (ie); -+ -+ build_local_var (wthis, irs->func); -+ tree init = ie->exp->toElemDtor (irs); -+ irs->addExp (init); -+ } -+ -+ if (body) -+ body->toIR (irs); -+ -+ irs->endScope(); -+} -+ -+void -+SynchronizedStatement::toIR (IRState *) -+{ -+ ::error ("SynchronizedStatement::toIR: we shouldn't emit this (%s)", toChars()); -+ gcc_unreachable(); -+} -+ -+void -+ContinueStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->continueLoop (ident); -+} -+ -+void -+BreakStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->exitLoop (ident); -+} -+ -+void -+ReturnStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ -+ if (exp == NULL || exp->type->toBasetype()->ty == Tvoid) -+ { -+ // Return has no value. -+ irs->doReturn (NULL_TREE); -+ return; -+ } -+ -+ FuncDeclaration *func = irs->func; -+ TypeFunction *tf = (TypeFunction *) func->type; -+ Type *ret_type = func->tintro ? func->tintro->nextOf() : tf->nextOf(); -+ -+ if (func->isMain() && ret_type->toBasetype()->ty == Tvoid) -+ ret_type = Type::tint32; -+ -+ tree result_decl = DECL_RESULT (irs->func->toSymbol()->Stree); -+ -+ if (func->nrvo_can && func->nrvo_var) -+ { -+ // Just refer to the RESULT_DECL; this is a nop, but differs from using -+ // NULL_TREE in that it indicates that we care about the value of the RESULT_DECL. -+ irs->doReturn (result_decl); -+ } -+ else -+ { -+ tree result_value = convert_expr (exp->toElemDtor (irs), exp->type, ret_type); -+ // %% convert for init -- if we were returning a reference, -+ // would want to take the address... -+ if (tf->isref) -+ result_value = build_address (result_value); -+ -+ tree result_assign = build2 (INIT_EXPR, TREE_TYPE (result_decl), -+ result_decl, result_value); -+ -+ irs->doReturn (result_assign); -+ } -+} -+ -+void -+DefaultStatement::toIR (IRState *irs) -+{ -+ irs->checkSwitchCase (this, 1); -+ irs->doCase (NULL_TREE, cblock); -+ if (statement) -+ statement->toIR (irs); -+} -+ -+void -+CaseStatement::toIR (IRState *irs) -+{ -+ tree case_value; -+ -+ if (exp->type->isscalar()) -+ case_value = exp->toElem (irs); -+ else -+ case_value = build_integer_cst (index, Type::tint32->toCtype()); -+ -+ irs->checkSwitchCase (this); -+ irs->doCase (case_value, cblock); -+ if (statement) -+ statement->toIR (irs); -+} -+ -+void -+SwitchStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ -+ tree cond_tree = condition->toElemDtor (irs); -+ Type *cond_type = condition->type->toBasetype(); -+ -+ if (condition->type->isString()) -+ { -+ Type *elem_type = cond_type->nextOf()->toBasetype(); -+ LibCall libcall; -+ switch (elem_type->ty) -+ { -+ case Tchar: -+ libcall = LIBCALL_SWITCH_STRING; -+ break; -+ -+ case Twchar: -+ libcall = LIBCALL_SWITCH_USTRING; -+ break; -+ -+ case Tdchar: -+ libcall = LIBCALL_SWITCH_DSTRING; -+ break; -+ -+ default: -+ ::error ("switch statement value must be an array of some character type, not %s", -+ elem_type->toChars()); -+ gcc_unreachable(); -+ } -+ -+ // Apparently the backend is supposed to sort and set the indexes -+ // on the case array, have to change them to be useable. -+ cases->sort(); -+ -+ tree args[2]; -+ Symbol *s = new Symbol(); -+ dt_t **pdt = &s->Sdt; -+ -+ for (size_t i = 0; i < cases->dim; i++) -+ { -+ CaseStatement *cs = (*cases)[i]; -+ cs->index = i; -+ -+ if (cs->exp->op != TOKstring) -+ error("case '%s' is not a string", cs->exp->toChars()); -+ else -+ pdt = cs->exp->toDt (pdt); -+ } -+ -+ s->Sreadonly = true; -+ d_finish_symbol (s); -+ -+ args[0] = d_array_value (cond_type->arrayOf()->toCtype(), -+ size_int (cases->dim), -+ build_address (s->Stree)); -+ args[1] = cond_tree; -+ -+ cond_tree = build_libcall (libcall, 2, args); -+ } -+ else if (!cond_type->isscalar()) -+ { -+ ::error ("cannot handle switch condition of type %s", cond_type->toChars()); -+ gcc_unreachable(); -+ } -+ -+ if (cases) -+ { -+ // Build LABEL_DECLs now so they can be refered to by goto case -+ for (size_t i = 0; i < cases->dim; i++) -+ { -+ CaseStatement *case_stmt = (*cases)[i]; -+ case_stmt->cblock = d_build_label (case_stmt->loc, NULL); -+ } -+ if (sdefault) -+ sdefault->cblock = d_build_label (sdefault->loc, NULL); -+ } -+ cond_tree = fold (cond_tree); -+ -+ if (hasVars) -+ { -+ // Write cases as a series of if-then-else blocks. -+ for (size_t i = 0; i < cases->dim; i++) -+ { -+ CaseStatement *case_stmt = (*cases)[i]; -+ tree case_cond = build2 (EQ_EXPR, cond_type->toCtype(), cond_tree, -+ case_stmt->exp->toElemDtor (irs)); -+ irs->startCond (this, case_cond); -+ irs->doJump (NULL, case_stmt->cblock); -+ irs->endCond(); -+ } -+ if (sdefault) -+ irs->doJump (NULL, sdefault->cblock); -+ } -+ -+ // Emit body. -+ irs->startCase (this, cond_tree, hasVars); -+ if (body) -+ body->toIR (irs); -+ irs->endCase(); -+} -+ -+ -+void -+IfStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->startScope(); -+ irs->startCond (this, convert_for_condition (condition->toElemDtor (irs), -+ condition->type)); -+ if (ifbody) -+ ifbody->toIR (irs); -+ -+ if (elsebody) -+ { -+ irs->startElse(); -+ elsebody->toIR (irs); -+ } -+ irs->endCond(); -+ irs->endScope(); -+} -+ -+void -+ForeachStatement::toIR (IRState *) -+{ -+ ::error ("ForeachStatement::toIR: we shouldn't emit this (%s)", toChars()); -+ gcc_unreachable(); -+} -+ -+void -+ForeachRangeStatement::toIR (IRState *) -+{ -+ ::error ("ForeachRangeStatement::toIR: we shouldn't emit this (%s)", toChars()); -+ gcc_unreachable(); -+} -+ -+void -+ForStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ if (init) -+ init->toIR (irs); -+ irs->startLoop (this); -+ if (condition) -+ { -+ irs->doLineNote (condition->loc); -+ irs->exitIfFalse (convert_for_condition (condition->toElemDtor (irs), -+ condition->type)); -+ } -+ if (body) -+ body->toIR (irs); -+ irs->continueHere(); -+ if (increment) -+ { -+ // force side effects? -+ irs->doLineNote (increment->loc); -+ irs->addExp (increment->toElemDtor (irs)); -+ } -+ irs->endLoop(); -+} -+ -+void -+DoStatement::toIR (IRState *irs) -+{ -+ irs->doLineNote (loc); -+ irs->startLoop (this); -+ if (body) -+ body->toIR (irs); -+ irs->continueHere(); -+ irs->doLineNote (condition->loc); -+ irs->exitIfFalse (convert_for_condition (condition->toElemDtor (irs), -+ condition->type)); -+ irs->endLoop(); -+} -+ -+void -+WhileStatement::toIR (IRState *) -+{ -+ ::error ("WhileStatement::toIR: we shouldn't emit this (%s)", toChars()); -+ gcc_unreachable(); -+} -+ -+void -+ScopeStatement::toIR (IRState *irs) -+{ -+ if (statement) -+ { -+ irs->startScope(); -+ statement->toIR (irs); -+ irs->endScope(); -+ } -+} -+ -+void -+CompoundStatement::toIR (IRState *irs) -+{ -+ if (!statements) -+ return; -+ -+ for (size_t i = 0; i < statements->dim; i++) -+ { -+ Statement *statement = (*statements)[i]; -+ if (statement) -+ statement->toIR (irs); -+ } -+} -+ -+void -+UnrolledLoopStatement::toIR (IRState *irs) -+{ -+ if (!statements) -+ return; -+ -+ irs->startLoop (this); -+ irs->continueHere(); -+ for (size_t i = 0; i < statements->dim; i++) -+ { -+ Statement *statement = (*statements)[i]; -+ if (statement) -+ { -+ irs->setContinueLabel (d_build_label (loc, NULL)); -+ statement->toIR (irs); -+ irs->continueHere(); -+ } -+ } -+ irs->exitLoop (NULL); -+ irs->endLoop(); -+} -+ -+void -+ExpStatement::toIR (IRState *irs) -+{ -+ if (exp) -+ { -+ irs->doLineNote (loc); -+ tree exp_tree = exp->toElemDtor (irs); -+ irs->addExp (exp_tree); -+ } -+} -+ -+void -+DtorExpStatement::toIR (IRState *irs) -+{ -+ FuncDeclaration *fd = irs->func; -+ -+ /* Do not call destructor if var is returned as the -+ nrvo variable. */ -+ bool noDtor = (fd->nrvo_can && fd->nrvo_var == var); -+ -+ if (!noDtor) -+ ExpStatement::toIR (irs); -+} -+ -+void -+PragmaStatement::toIR (IRState *) -+{ -+} -+ -+void -+ImportStatement::toIR (IRState *) -+{ -+ if (!imports) -+ return; -+ -+ for (size_t i = 0; i < imports->dim; i++) -+ { -+ Dsymbol *dsym = (*imports)[i]; -+ if (dsym) -+ dsym->toObjFile (0); -+ } -+} -+ ---- a/src/gcc/d/d-tree.def 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-tree.def 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by ---- a/src/gcc/d/d-typinf.cc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/d-typinf.cc 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // d-typinf.cc -- D frontend for GCC. --// Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -23,6 +23,10 @@ - #include "declaration.h" - #include "aggregate.h" - -+extern bool inNonRoot(Dsymbol *s); -+extern FuncDeclaration *search_toHash(StructDeclaration *sd); -+extern FuncDeclaration *search_toString(StructDeclaration *sd); -+ - - /******************************************* - * Get a canonicalized form of the TypeInfo for use with the internal -@@ -68,7 +72,7 @@ Type::getInternalTypeInfo (Scope *sc) - tid = new TypeInfoDeclaration (t, 1); - internalTI[t->ty] = tid; - } -- e = new VarExp (0, tid); -+ e = new VarExp (Loc(), tid); - e = e->addressOf (sc); - // do this so we don't get redundant dereference - e->type = tid->type; -@@ -88,9 +92,9 @@ Type::getInternalTypeInfo (Scope *sc) - Expression * - Type::getTypeInfo (Scope *sc) - { -- if (!Type::typeinfo) -+ if (!Type::dtypeinfo) - { -- error (0, "TypeInfo not found. object.d may be incorrectly installed or corrupt, compile with -v switch"); -+ error (Loc(), "TypeInfo not found. object.d may be incorrectly installed or corrupt"); - fatal(); - } - -@@ -109,6 +113,7 @@ Type::getTypeInfo (Scope *sc) - t->vtinfo = new TypeInfoWildDeclaration (t); - else - t->vtinfo = t->getTypeInfoDeclaration(); -+ - gcc_assert (t->vtinfo); - vtinfo = t->vtinfo; - -@@ -122,6 +127,17 @@ Type::getTypeInfo (Scope *sc) - // Find module that will go all the way to an object file - Module *m = sc->module->importedFrom; - m->members->push (t->vtinfo); -+ -+ if (ty == Tstruct) -+ { -+ StructDeclaration *sd = ((TypeStruct *) this)->sym; -+ -+ if (((sd->xeq && sd->xeq != sd->xerreq) -+ || (sd->xcmp && sd->xcmp != sd->xerrcmp) -+ || search_toHash (sd) || search_toString (sd)) -+ && inNonRoot (sd)) -+ Module::addDeferredSemantic3 (sd); -+ } - } - else - t->vtinfo->toObjFile (0); -@@ -131,7 +147,7 @@ Type::getTypeInfo (Scope *sc) - if (!vtinfo) - vtinfo = t->vtinfo; - -- Expression *e = new VarExp (0, t->vtinfo); -+ Expression *e = new VarExp (Loc(), t->vtinfo); - e = e->addressOf (sc); - // do this so we don't get redundant dereference - e->type = t->vtinfo->type; -@@ -240,9 +256,11 @@ TypeBasic::builtinTypeInfo (void) - int - TypeDArray::builtinTypeInfo (void) - { -- return !mod && ((next->isTypeBasic() != NULL && !next->mod) -- // strings are so common, make them builtin -- || (next->ty == Tchar && next->mod == MODimmutable)); -+ // Strings are so common, make them builtin. -+ return !mod -+ && ((next->isTypeBasic() != NULL && !next->mod) -+ || (next->ty == Tchar && next->mod == MODimmutable) -+ || (next->ty == Tchar && next->mod == MODconst)); - } - - int ---- a/src/gcc/d/lang.opt 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/lang.opt 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - ; GDC -- D front-end for GCC --; Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+; Copyright (C) 2011-2013 Free Software Foundation, Inc. - ; - ; This program is free software; you can redistribute it and/or modify - ; it under the terms of the GNU General Public License as published by -@@ -15,9 +15,15 @@ - ; along with GCC; see the file COPYING3. If not see - ; <http://www.gnu.org/licenses/>. - -+; Please try to keep this file in ASCII collating order. -+ - Language - D - -+Variable -+int flag_emit_templates -+ -+ - debuglib= - Driver Joined - Debug library to use instead of phobos -@@ -47,6 +53,10 @@ fdebug= - D Joined RejectNegative - -fdebug,-fdebug=<level>,-fdebug=<ident> Compile in debug code, code <= level, or code identified by ident - -+fdeps -+D -+Print information about module dependencies -+ - fdeps= - D Joined RejectNegative - -fdeps=<filename> Write module dependencies to filename -@@ -77,7 +87,7 @@ List all variables going into thread loc - - femit-templates - D ---femit-templates Emit templates code and data even if the linker cannot merge multiple copies -+Generate code for all template instantiations - - fignore-unknown-pragmas - D -@@ -102,9 +112,17 @@ finvariants - D - Generate runtime code for invariant()'s - -+fmake-deps -+D -+Print information about module makefile dependencies -+ - fmake-deps= - D Joined RejectNegative ---fmake-deps=<file> Write dependency output to the given file -+-fmake-deps=<file> Write makefile dependency output to the given file -+ -+fmake-mdeps -+D -+Like -fmake-deps but ignore system modules - - fmake-mdeps= - D Joined RejectNegative -@@ -130,10 +148,6 @@ frelease - D - Compile release version - --fsplit-dynamic-arrays --D Var(flag_split_darrays) --Split dynamic arrays into length and pointer when passing to functions -- - funittest - D - Compile in unittest code ---- a/src/gcc/d/lang-specs.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/lang-specs.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /* lang-specs.h -- D frontend for GCC. -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ Copyright (C) 2011-2013 Free Software Foundation, Inc. - - GCC is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free ---- a/src/gcc/d/longdouble.h 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/longdouble.h 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // longdouble.h -- D frontend for GCC. --// Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc. -+// Copyright (C) 2011-2013 Free Software Foundation, Inc. - - // GCC is free software; you can redistribute it and/or modify it under - // the terms of the GNU General Public License as published by the Free -@@ -19,15 +19,11 @@ - #define GCC_D_LONGDOUBLE_H - - struct real_value; --struct Type; -+class Type; - - struct longdouble - { - public: -- // Including gcc/real.h presents too many problems, so -- // just statically allocate enough space for REAL_VALUE_TYPE. --#define REAL_T_SIZE (16 + sizeof (long))/sizeof (long) + 1 -- - enum Mode - { - Float, -@@ -36,78 +32,136 @@ struct longdouble - NumModes - }; - -- struct fake_t -- { -- int c; -- int s; -- int e; -- long m[REAL_T_SIZE]; -- }; -- - static void init (void); -- static longdouble parse (const char *str, Mode mode); -- -- // This constructor prevent the use of the longdouble in a union -- longdouble (void) { } -- longdouble (const longdouble& r); - - const real_value& rv (void) const; - real_value& rv (void); -- longdouble (const real_value& rv); -- longdouble (int v); -- longdouble (uint64_t v); -- longdouble (int64_t v); -- longdouble (double d); -- -- longdouble& operator= (const longdouble& r); -- longdouble& operator= (int v); -- longdouble operator+ (const longdouble& r); -- longdouble operator- (const longdouble& r); -- longdouble operator- (void); -- longdouble operator* (const longdouble& r); -- longdouble operator/ (const longdouble& r); -- longdouble operator% (const longdouble& r); -- -- bool operator< (const longdouble& r); -- bool operator> (const longdouble& r); -- bool operator<= (const longdouble& r); -- bool operator>= (const longdouble& r); -- bool operator== (const longdouble& r); -- bool operator!= (const longdouble& r); -- -- uint64_t toInt (void) const; -- uint64_t toInt (Type *rt, Type *it) const; -- bool isZero (void); -- bool isNegative (void); -- bool isIdenticalTo (const longdouble& r) const; -+ -+ // No constructor to be able to use this class in a union. -+ template<typename T> longdouble& operator = (T x) -+ { set (x); return *this;} -+ -+ // We need to list all basic types to avoid ambiguities -+ void set (float d); -+ void set (double d); -+ void set (real_value& rv); -+ -+ void set (int8_t d); -+ void set (int16_t d); -+ void set (int32_t d); -+ void set (int64_t d); -+ -+ void set (uint8_t d); -+ void set (uint16_t d); -+ void set (uint32_t d); -+ void set (uint64_t d); -+ -+ void set (bool d); -+ -+ // Rvalue operators. -+ operator float (void); -+ operator double (void); -+ operator real_value& (void); -+ -+ operator int8_t (void); -+ operator int16_t (void); -+ operator int32_t (void); -+ operator int64_t (void); -+ -+ operator uint8_t (void); -+ operator uint16_t (void); -+ operator uint32_t (void); -+ operator uint64_t (void); -+ -+ operator bool (void); -+ -+ // Arithmetic operators. -+ longdouble operator + (const longdouble& r); -+ longdouble operator - (const longdouble& r); -+ longdouble operator * (const longdouble& r); -+ longdouble operator / (const longdouble& r); -+ longdouble operator % (const longdouble& r); -+ -+ longdouble operator - (void); -+ -+ // Comparison operators. -+ bool operator < (const longdouble& r); -+ bool operator <= (const longdouble& r); -+ bool operator > (const longdouble& r); -+ bool operator >= (const longdouble& r); -+ bool operator == (const longdouble& r); -+ bool operator != (const longdouble& r); -+ - int format (char *buf, unsigned buf_size) const; - int formatHex (char *buf, unsigned buf_size) const; -+ - // for debugging: - void dump (void); - - private: -- // prevent this from being used -- longdouble& operator= (float) -- { return *this; } -+ longdouble from_shwi (Type *type, int64_t d); -+ longdouble from_uhwi (Type *type, uint64_t d); -+ int64_t to_shwi (Type *type) const; -+ uint64_t to_uhwi (Type *type) const; - -- longdouble& operator= (double) -- { return *this; } -+ // Including gcc/real.h presents too many problems, so -+ // just statically allocate enough space for REAL_VALUE_TYPE. -+#define REALSZ (16 + sizeof (long))/sizeof (long) + 1 - -- fake_t frv_; -+ int exp[3]; -+ long sig[REALSZ]; - }; - -+// "volatile" is not required. -+typedef longdouble volatile_longdouble; - --template<typename T> longdouble ldouble(T x) -+// Use ldouble() to explicitely create a longdouble value. -+template<typename T> -+inline longdouble -+ldouble (T x) - { -- return (longdouble) x; -+ longdouble d; -+ d.set (x); -+ return d; - } - --inline int ld_sprint (char* str, int fmt, longdouble x) -+template<typename T> inline longdouble operator + (longdouble ld, T x) { return ld + ldouble (x); } -+template<typename T> inline longdouble operator - (longdouble ld, T x) { return ld - ldouble (x); } -+template<typename T> inline longdouble operator * (longdouble ld, T x) { return ld * ldouble (x); } -+template<typename T> inline longdouble operator / (longdouble ld, T x) { return ld / ldouble (x); } -+ -+template<typename T> inline longdouble operator + (T x, longdouble ld) { return ldouble (x) + ld; } -+template<typename T> inline longdouble operator - (T x, longdouble ld) { return ldouble (x) - ld; } -+template<typename T> inline longdouble operator * (T x, longdouble ld) { return ldouble (x) * ld; } -+template<typename T> inline longdouble operator / (T x, longdouble ld) { return ldouble (x) / ld; } -+ -+template<typename T> inline longdouble& operator += (longdouble& ld, T x) { return ld = ld + x; } -+template<typename T> inline longdouble& operator -= (longdouble& ld, T x) { return ld = ld - x; } -+template<typename T> inline longdouble& operator *= (longdouble& ld, T x) { return ld = ld * x; } -+template<typename T> inline longdouble& operator /= (longdouble& ld, T x) { return ld = ld / x; } -+ -+template<typename T> inline bool operator < (longdouble ld, T x) { return ld < ldouble (x); } -+template<typename T> inline bool operator <= (longdouble ld, T x) { return ld <= ldouble (x); } -+template<typename T> inline bool operator > (longdouble ld, T x) { return ld > ldouble (x); } -+template<typename T> inline bool operator >= (longdouble ld, T x) { return ld >= ldouble (x); } -+template<typename T> inline bool operator == (longdouble ld, T x) { return ld == ldouble (x); } -+template<typename T> inline bool operator != (longdouble ld, T x) { return ld != ldouble (x); } -+ -+template<typename T> inline bool operator < (T x, longdouble ld) { return ldouble (x) < ld; } -+template<typename T> inline bool operator <= (T x, longdouble ld) { return ldouble (x) <= ld; } -+template<typename T> inline bool operator > (T x, longdouble ld) { return ldouble (x) > ld; } -+template<typename T> inline bool operator >= (T x, longdouble ld) { return ldouble (x) >= ld; } -+template<typename T> inline bool operator == (T x, longdouble ld) { return ldouble (x) == ld; } -+template<typename T> inline bool operator != (T x, longdouble ld) { return ldouble (x) != ld; } -+ -+ -+inline size_t -+ld_sprint (char* str, int fmt, longdouble x) - { -- if(fmt == 'a' || fmt == 'A') -- return x.formatHex(str, 32); -+ if (fmt == 'a' || fmt == 'A') -+ return x.formatHex (str, 32); - -- return x.format(str, 32); -+ return x.format (str, 32); - } - - ---- a/src/gcc/d/Make-lang.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/Make-lang.in 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - # -*- mode: makefile -*- - - # GDC -- D front-end for GCC --# Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+# Copyright (C) 2011-2013 Free Software Foundation, Inc. - # - # This program is free software; you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -32,29 +32,29 @@ else - endif - - --# Common headers between D1 and D2 -+# Common headers between D frontend and glue - D_DMD_H := \ -- d/dfrontend/aav.h d/dfrontend/aggregate.h d/dfrontend/aliasthis.h \ -- d/dfrontend/arraytypes.h d/dfrontend/async.h d/dfrontend/attrib.h \ -- d/dfrontend/cond.h d/dfrontend/ctfe.h d/dfrontend/declaration.h \ -- d/dfrontend/doc.h d/dfrontend/dsymbol.h d/dfrontend/enum.h \ -- d/dfrontend/expression.h d/dfrontend/hdrgen.h \ -- d/dfrontend/identifier.h d/dfrontend/import.h \ -- d/dfrontend/init.h d/dfrontend/intrange.h d/dfrontend/json.h \ -- d/dfrontend/lexer.h d/dfrontend/macro.h \ -+ d/dfrontend/aav.h d/dfrontend/array.h d/dfrontend/aggregate.h \ -+ d/dfrontend/aliasthis.h d/dfrontend/arraytypes.h d/dfrontend/attrib.h \ -+ d/dfrontend/complex_t.h d/dfrontend/cond.h d/dfrontend/ctfe.h \ -+ d/dfrontend/declaration.h d/dfrontend/doc.h d/dfrontend/dsymbol.h \ -+ d/dfrontend/enum.h d/dfrontend/expression.h d/dfrontend/file.h \ -+ d/dfrontend/filename.h d/dfrontend/hdrgen.h d/dfrontend/identifier.h \ -+ d/dfrontend/import.h d/dfrontend/init.h d/dfrontend/intrange.h \ -+ d/dfrontend/json.h d/dfrontend/lexer.h d/dfrontend/macro.h \ - d/dfrontend/mars.h d/dfrontend/module.h d/dfrontend/mtype.h \ -- d/dfrontend/parse.h d/dfrontend/port.h d/dfrontend/rmem.h \ -- d/dfrontend/root.h d/dfrontend/scope.h d/dfrontend/speller.h \ -- d/dfrontend/statement.h d/dfrontend/staticassert.h \ -- d/dfrontend/stringtable.h d/dfrontend/target.h d/dfrontend/template.h \ -- d/dfrontend/utf.h d/dfrontend/version.h \ -- d/d-dmd-gcc.h d/complex_t.h d/longdouble.h \ -- d/id.h d/verstr.h -+ d/dfrontend/object.h d/dfrontend/outbuffer.h d/dfrontend/parse.h \ -+ d/dfrontend/port.h d/dfrontend/rmem.h d/dfrontend/root.h \ -+ d/dfrontend/scope.h d/dfrontend/speller.h d/dfrontend/statement.h \ -+ d/dfrontend/staticassert.h d/dfrontend/stringtable.h \ -+ d/dfrontend/target.h d/dfrontend/template.h d/dfrontend/utf.h \ -+ d/dfrontend/version.h \ -+ d/d-dmd-gcc.h d/longdouble.h d/id.h d/verstr.h - - D_TREE_H = $(TREE_H) d/d-tree.def d/d-lang.h d/d-codegen.h \ -- d/d-objfile.h d/d-irstate.h d/d-dmd-gcc.h d/d-system.h \ -- d/longdouble.h \ -- coretypes.h function.h $(VARRAY_H) \ -+ d/d-objfile.h d/d-irstate.h d/d-dmd-gcc.h d/d-system.h \ -+ d/longdouble.h \ -+ coretypes.h function.h $(VARRAY_H) \ - $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \ - $(GGC_H) \ - $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h \ -@@ -104,33 +104,36 @@ gdc-cross$(exeext): gdc$(exeext) - cp gdc$(exeext) gdc-cross$(exeext) - - --# Common sources between D1 and D2 -+# D Frontend sources - D_DMD_OBJS := \ -- d/aav.dmd.o d/access.dmd.o d/aliasthis.dmd.o d/array.dmd.o \ -- d/arrayop.dmd.o d/async.dmd.o d/attrib.dmd.o d/cast.dmd.o d/class.dmd.o \ -- d/clone.dmd.o d/cond.dmd.o d/constfold.dmd.o d/ctfeexpr.dmd.o \ -- d/declaration.dmd.o d/delegatize.dmd.o d/doc.dmd.o d/dsymbol.dmd.o \ -- d/dump.dmd.o d/entity.dmd.o d/enum.dmd.o d/expression.dmd.o d/func.dmd.o \ -- d/hdrgen.dmd.o d/identifier.dmd.o \ -- d/imphint.dmd.o d/import.dmd.o d/init.dmd.o d/inline.dmd.o \ -- d/interpret.dmd.o d/json.dmd.o d/lexer.dmd.o \ -- d/macro.dmd.o d/mangle.dmd.o d/mars.dmd.o d/mtype.dmd.o d/module.dmd.o \ -- d/opover.dmd.o d/optimize.dmd.o d/parse.dmd.o d/rmem.dmd.o d/root.dmd.o \ -- d/scope.dmd.o d/speller.dmd.o d/statement.dmd.o d/staticassert.dmd.o \ -- d/stringtable.dmd.o d/struct.dmd.o d/template.dmd.o d/utf.dmd.o \ -- d/argtypes.dmd.o d/builtin.dmd.o d/traits.dmd.o d/intrange.dmd.o \ -- d/cppmangle.dmd.o d/apply.dmd.o d/canthrow.dmd.o d/sideeffect.dmd.o \ -- d/unittests.dmd.o d/version.dmd.o -+ d/argtypes.dmd.o d/aav.dmd.o d/access.dmd.o d/aliasthis.dmd.o \ -+ d/apply.dmd.o d/arrayop.dmd.o d/attrib.dmd.o \ -+ d/builtin.dmd.o d/canthrow.dmd.o d/cast.dmd.o d/class.dmd.o \ -+ d/clone.dmd.o d/cond.dmd.o d/constfold.dmd.o d/cppmangle.dmd.o \ -+ d/ctfeexpr.dmd.o d/declaration.dmd.o d/delegatize.dmd.o d/doc.dmd.o \ -+ d/dsymbol.dmd.o d/dump.dmd.o d/entity.dmd.o d/enum.dmd.o \ -+ d/expression.dmd.o d/file.dmd.o d/filename.dmd.o d/func.dmd.o \ -+ d/hdrgen.dmd.o d/identifier.dmd.o d/imphint.dmd.o d/import.dmd.o \ -+ d/init.dmd.o d/inline.dmd.o d/interpret.dmd.o d/intrange.dmd.o \ -+ d/json.dmd.o d/lexer.dmd.o d/macro.dmd.o d/mangle.dmd.o \ -+ d/mtype.dmd.o d/module.dmd.o d/object.dmd.o d/opover.dmd.o \ -+ d/optimize.dmd.o d/outbuffer.dmd.o d/parse.dmd.o d/rmem.dmd.o \ -+ d/sapply.dmd.o d/scope.dmd.o d/sideeffect.dmd.o \ -+ d/speller.dmd.o d/statement.dmd.o d/staticassert.dmd.o \ -+ d/stringtable.dmd.o d/struct.dmd.o d/template.dmd.o d/traits.dmd.o \ -+ d/unittests.dmd.o d/utf.dmd.o d/version.dmd.o - - D_GENERATED_SRCS = d/id.c d/id.h d/impcnvtab.c - D_GENERATED_OBJS = d/id.gen.o d/impcnvtab.gen.o -+ -+# D Glue sources - D_GLUE_OBJS = d/d-lang.glue.o d/d-decls.glue.o d/d-codegen.glue.o \ - d/d-objfile.glue.o d/d-irstate.glue.o \ - d/d-convert.glue.o d/d-todt.glue.o d/d-longdouble.glue.o \ - d/d-gt.cglue.o d/d-builtins.cglue.o d/d-asmstmt.glue.o \ - d/d-incpath.glue.o d/d-ctype.glue.o d/d-elem.glue.o \ -- d/d-ir.glue.o d/d-typinf.glue.o d/d-port.glue.o \ -- d/d-target.glue.o -+ d/d-toir.glue.o d/d-typinf.glue.o d/d-port.glue.o \ -+ d/d-target.glue.o d/d-glue.glue.o - - # ALL_D_COMPILER_FLAGS causes issues -- c++ <complex.h> instead of C <complex.h> - # Not all DMD sources depend on d-dmd-gcc.h -@@ -168,9 +171,7 @@ d/verstr.h: d/VERSION - cat $^ > $@ - - d/d-confdefs.h: d/Make-lang.in -- #echo "#define D_PHOBOS_DIR \""$(gcc_d_include_dir)"\"" > $@ -- #echo "#define D_PHOBOS_TARGET_DIR \""$(gcc_d_target_include_dir)"\"" >> $@ -- $(srcdir)/d/target-ver-syms.sh $(target) >> $@ -+ $(srcdir)/d/target-ver-syms.sh $(target) > $@ - - d/d-incpath.glue.o: d/d-incpath.cc $(D_TREE_H) d/d-confdefs.h - $(COMPILER) $(ALL_D_COMPILER_FLAGS) $(PHOBOS_DIRS) -DGCC_SAFE_DMD=1 -o $@ -c $< -@@ -184,7 +185,7 @@ d/d-codegen.glue.o: d/d-codegen.cc $(D_T - d/d-decls.glue.o: d/d-decls.cc $(D_TREE_H) - d/d-ctype.glue.o: d/d-ctype.cc $(D_TREE_H) - d/d-elem.glue.o: d/d-elem.cc $(D_TREE_H) --d/d-ir.glue.o: d/d-ir.cc $(D_TREE_H) -+d/d-toir.glue.o: d/d-toir.cc $(D_TREE_H) - d/d-convert.glue.o: d/d-convert.cc $(D_TREE_H) - d/d-todt.glue.o: d/d-todt.cc $(D_TREE_H) - d/d-typinf.glue.o: d/d-typinf.cc $(D_TREE_H) ---- a/src/gcc/d/patches/patch-gcc-4.8.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-gcc-4.8.x 2014-04-01 16:32:51.000000000 +0100 -@@ -2,9 +2,9 @@ This implements D language support in th - relevant documentation about the GDC front end. - --- - ----- gcc/config/rs6000/rs6000.c 2013-02-08 19:36:04.000000000 +0000 --+++ gcc/config/rs6000/rs6000.c 2013-03-20 16:26:18.566235720 +0000 --@@ -21578,7 +21578,8 @@ rs6000_output_function_epilogue (FILE *f -+--- gcc/config/rs6000/rs6000.c 2014-04-01 16:31:04.663249606 +0200 -++++ gcc/config/rs6000/rs6000.c 2014-04-01 16:32:01.263248109 +0200 -+@@ -21584,7 +21584,8 @@ - either, so for now use 0. */ - if (! strcmp (language_string, "GNU C") - || ! strcmp (language_string, "GNU GIMPLE") -@@ -14,8 +14,8 @@ relevant documentation about the GDC fro - i = 0; - else if (! strcmp (language_string, "GNU F77") - || ! strcmp (language_string, "GNU Fortran")) ----- gcc/doc/frontends.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/frontends.texi 2013-03-20 16:26:18.574235721 +0000 -+--- gcc/doc/frontends.texi 2014-04-01 16:31:04.799916268 +0200 -++++ gcc/doc/frontends.texi 2014-04-01 16:32:01.263248109 +0200 - @@ -9,6 +9,7 @@ - @cindex GNU Compiler Collection - @cindex GNU C Compiler -@@ -33,9 +33,9 @@ relevant documentation about the GDC fro - - The abbreviation @dfn{GCC} has multiple meanings in common use. The - current official meaning is ``GNU Compiler Collection'', which refers ----- gcc/doc/install.texi 2013-02-05 09:26:06.000000000 +0000 --+++ gcc/doc/install.texi 2013-03-20 16:26:18.586235720 +0000 --@@ -1350,12 +1350,12 @@ their runtime libraries should be built. -+--- gcc/doc/install.texi 2014-04-01 16:31:04.799916268 +0200 -++++ gcc/doc/install.texi 2014-04-01 16:32:01.263248109 +0200 -+@@ -1350,12 +1350,12 @@ - grep language= */config-lang.in - @end smallexample - Currently, you can use any of the following: -@@ -50,9 +50,9 @@ relevant documentation about the GDC fro - - @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{} - Specify that a particular subset of compilers and their runtime ----- gcc/doc/invoke.texi 2013-03-14 09:13:36.000000000 +0000 --+++ gcc/doc/invoke.texi 2013-03-20 16:26:18.610235722 +0000 --@@ -1164,6 +1164,15 @@ called @dfn{specs}. -+--- gcc/doc/invoke.texi 2014-04-01 16:31:04.799916268 +0200 -++++ gcc/doc/invoke.texi 2014-04-01 16:32:01.266581442 +0200 -+@@ -1163,6 +1163,15 @@ - Ada source code file containing a library unit body (a subprogram or - package body). Such files are also called @dfn{bodies}. - -@@ -68,7 +68,7 @@ relevant documentation about the GDC fro - @c GCC also knows about some suffixes for languages not yet included: - @c Pascal: - @c @var{file}.p --@@ -1199,6 +1208,7 @@ objective-c objective-c-header objecti -+@@ -1198,6 +1207,7 @@ - objective-c++ objective-c++-header objective-c++-cpp-output - assembler assembler-with-cpp - ada -@@ -76,9 +76,9 @@ relevant documentation about the GDC fro - f77 f77-cpp-input f95 f95-cpp-input - go - java ----- gcc/doc/sourcebuild.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/sourcebuild.texi 2013-03-20 16:26:18.614235722 +0000 --@@ -113,6 +113,9 @@ The Objective-C and Objective-C++ runtim -+--- gcc/doc/sourcebuild.texi 2014-04-01 16:31:04.799916268 +0200 -++++ gcc/doc/sourcebuild.texi 2014-04-01 16:32:01.266581442 +0200 -+@@ -113,6 +113,9 @@ - @item libquadmath - The runtime support library for quad-precision math operations. - -@@ -88,11 +88,11 @@ relevant documentation about the GDC fro - @item libssp - The Stack protector runtime library. - ----- gcc/doc/standards.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/standards.texi 2013-03-20 16:26:18.662235721 +0000 --@@ -288,6 +288,16 @@ a specific version. In general GCC trac -- closely, and any given release will support the language as of the -- date that the release was frozen. -+--- gcc/doc/standards.texi 2014-04-01 16:31:04.799916268 +0200 -++++ gcc/doc/standards.texi 2014-04-01 16:32:01.266581442 +0200 -+@@ -283,6 +283,16 @@ -+ As of the GCC 4.7.1 release, GCC supports the Go 1 language standard, -+ described at @uref{http://golang.org/doc/go1.html}. - - +@section D language - + -@@ -107,9 +107,25 @@ relevant documentation about the GDC fro - @section References for other languages - - @xref{Top, GNAT Reference Manual, About This Guide, gnat_rm, ----- gcc/dwarf2out.c 2013-03-05 23:08:45.000000000 +0000 --+++ gcc/dwarf2out.c 2013-03-20 16:26:18.690235723 +0000 --@@ -18907,6 +18907,8 @@ gen_compile_unit_die (const char *filena -+--- gcc/dwarf2out.c 2014-04-01 16:31:04.689916271 +0200 -++++ gcc/dwarf2out.c 2014-04-01 16:38:25.286571288 +0200 -+@@ -4557,6 +4557,15 @@ -+ return lang == DW_LANG_Ada95 || lang == DW_LANG_Ada83; -+ } -+ -++/* Return TRUE if the language is D. */ -++ -++static inline bool -++is_dlang (void) -++{ -++ unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language); -++ return lang == DW_LANG_D; -++} -++ -+ /* Remove the specified attribute if present. */ -+ -+ static void -+@@ -18909,6 +18918,8 @@ - language = DW_LANG_C89; - if (strcmp (language_string, "GNU C++") == 0) - language = DW_LANG_C_plus_plus; -@@ -118,9 +134,45 @@ relevant documentation about the GDC fro - else if (strcmp (language_string, "GNU F77") == 0) - language = DW_LANG_Fortran77; - else if (strcmp (language_string, "GNU Pascal") == 0) ----- gcc/gcc.c 2013-03-06 06:32:03.000000000 +0000 --+++ gcc/gcc.c 2013-03-20 16:26:18.706235722 +0000 --@@ -1002,6 +1002,7 @@ static const struct compiler default_com -+@@ -19831,7 +19842,7 @@ -+ -+ if (ns_context != context_die) -+ { -+- if (is_fortran ()) -++ if (is_fortran () || is_dlang ()) -+ return ns_context; -+ if (DECL_P (thing)) -+ gen_decl_die (thing, NULL, ns_context); -+@@ -19854,7 +19865,7 @@ -+ { -+ /* Output a real namespace or module. */ -+ context_die = setup_namespace_context (decl, comp_unit_die ()); -+- namespace_die = new_die (is_fortran () -++ namespace_die = new_die (is_fortran () || is_dlang () -+ ? DW_TAG_module : DW_TAG_namespace, -+ context_die, decl); -+ /* For Fortran modules defined in different CU don't add src coords. */ -+@@ -19911,7 +19922,7 @@ -+ break; -+ -+ case CONST_DECL: -+- if (!is_fortran () && !is_ada ()) -++ if (!is_fortran () && !is_ada () && !is_dlang ()) -+ { -+ /* The individual enumerators of an enum type get output when we output -+ the Dwarf representation of the relevant enum type itself. */ -+@@ -20334,7 +20345,7 @@ -+ case CONST_DECL: -+ if (debug_info_level <= DINFO_LEVEL_TERSE) -+ return; -+- if (!is_fortran () && !is_ada ()) -++ if (!is_fortran () && !is_ada () && !is_dlang ()) -+ return; -+ if (TREE_STATIC (decl) && decl_function_context (decl)) -+ context_die = lookup_decl_die (DECL_CONTEXT (decl)); -+--- gcc/gcc.c 2014-04-01 16:31:04.676582939 +0200 -++++ gcc/gcc.c 2014-04-01 16:32:01.273248109 +0200 -+@@ -1003,6 +1003,7 @@ - {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0}, - {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0}, - {".go", "#Go", 0, 1, 0}, ---- a/src/gcc/d/patches/patch-gcc-4.9.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-gcc-4.9.x 2014-04-01 16:32:51.000000000 +0100 -@@ -2,9 +2,9 @@ This implements D language support in th - relevant documentation about the GDC front end. - --- - ----- gcc/config/rs6000/rs6000.c 2013-02-08 19:36:04.000000000 +0000 --+++ gcc/config/rs6000/rs6000.c 2013-03-20 16:26:18.566235720 +0000 --@@ -21578,7 +21578,8 @@ rs6000_output_function_epilogue (FILE *f -+--- gcc/config/rs6000/rs6000.c -++++ gcc/config/rs6000/rs6000.c -+@@ -24406,7 +24406,8 @@ rs6000_output_function_epilogue (FILE *file, - either, so for now use 0. */ - if (! strcmp (language_string, "GNU C") - || ! strcmp (language_string, "GNU GIMPLE") -@@ -14,8 +14,8 @@ relevant documentation about the GDC fro - i = 0; - else if (! strcmp (language_string, "GNU F77") - || ! strcmp (language_string, "GNU Fortran")) ----- gcc/doc/frontends.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/frontends.texi 2013-03-20 16:26:18.574235721 +0000 -+--- gcc/doc/frontends.texi -++++ gcc/doc/frontends.texi - @@ -9,6 +9,7 @@ - @cindex GNU Compiler Collection - @cindex GNU C Compiler -@@ -33,9 +33,9 @@ relevant documentation about the GDC fro - - The abbreviation @dfn{GCC} has multiple meanings in common use. The - current official meaning is ``GNU Compiler Collection'', which refers ----- gcc/doc/install.texi 2013-02-05 09:26:06.000000000 +0000 --+++ gcc/doc/install.texi 2013-03-20 16:26:18.586235720 +0000 --@@ -1350,12 +1350,12 @@ their runtime libraries should be built. -+--- gcc/doc/install.texi -++++ gcc/doc/install.texi -+@@ -1418,12 +1418,12 @@ their runtime libraries should be built. For a list of valid values for - grep language= */config-lang.in - @end smallexample - Currently, you can use any of the following: -@@ -50,9 +50,9 @@ relevant documentation about the GDC fro - - @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{} - Specify that a particular subset of compilers and their runtime ----- gcc/doc/invoke.texi 2013-03-14 09:13:36.000000000 +0000 --+++ gcc/doc/invoke.texi 2013-03-20 16:26:18.610235722 +0000 --@@ -1164,6 +1164,15 @@ called @dfn{specs}. -+--- gcc/doc/invoke.texi -++++ gcc/doc/invoke.texi -+@@ -1229,6 +1229,15 @@ called @dfn{specs}. - Ada source code file containing a library unit body (a subprogram or - package body). Such files are also called @dfn{bodies}. - -@@ -68,7 +68,7 @@ relevant documentation about the GDC fro - @c GCC also knows about some suffixes for languages not yet included: - @c Pascal: - @c @var{file}.p --@@ -1199,6 +1208,7 @@ objective-c objective-c-header objecti -+@@ -1264,6 +1273,7 @@ objective-c objective-c-header objective-c-cpp-output - objective-c++ objective-c++-header objective-c++-cpp-output - assembler assembler-with-cpp - ada -@@ -76,9 +76,9 @@ relevant documentation about the GDC fro - f77 f77-cpp-input f95 f95-cpp-input - go - java ----- gcc/doc/sourcebuild.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/sourcebuild.texi 2013-03-20 16:26:18.614235722 +0000 --@@ -113,6 +113,9 @@ The Objective-C and Objective-C++ runtim -+--- gcc/doc/sourcebuild.texi -++++ gcc/doc/sourcebuild.texi -+@@ -109,6 +109,9 @@ The Objective-C and Objective-C++ runtime library. - @item libquadmath - The runtime support library for quad-precision math operations. - -@@ -88,11 +88,11 @@ relevant documentation about the GDC fro - @item libssp - The Stack protector runtime library. - ----- gcc/doc/standards.texi 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/doc/standards.texi 2013-03-20 16:26:18.662235721 +0000 --@@ -288,6 +288,16 @@ a specific version. In general GCC trac -- closely, and any given release will support the language as of the -- date that the release was frozen. -+--- gcc/doc/standards.texi -++++ gcc/doc/standards.texi -+@@ -282,6 +282,16 @@ available online, see @uref{http://gcc.gnu.org/readings.html} -+ As of the GCC 4.7.1 release, GCC supports the Go 1 language standard, -+ described at @uref{http://golang.org/doc/go1.html}. - - +@section D language - + -@@ -107,9 +107,25 @@ relevant documentation about the GDC fro - @section References for other languages - - @xref{Top, GNAT Reference Manual, About This Guide, gnat_rm, ----- gcc/dwarf2out.c 2013-03-05 23:08:45.000000000 +0000 --+++ gcc/dwarf2out.c 2013-03-20 16:26:18.690235723 +0000 --@@ -18907,6 +18907,8 @@ gen_compile_unit_die (const char *filena -+--- gcc/dwarf2out.c -++++ gcc/dwarf2out.c -+@@ -4616,6 +4616,15 @@ is_ada (void) -+ return lang == DW_LANG_Ada95 || lang == DW_LANG_Ada83; -+ } -+ -++/* Return TRUE if the language is D. */ -++static inline bool -++is_dlang (void) -++{ -++ unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language); -++ -++ return lang == DW_LANG_D; -++} -++ -+ /* Remove the specified attribute if present. */ -+ -+ static void -+@@ -19285,6 +19294,8 @@ gen_compile_unit_die (const char *filename) - language = DW_LANG_C89; - if (strcmp (language_string, "GNU C++") == 0) - language = DW_LANG_C_plus_plus; -@@ -118,9 +134,45 @@ relevant documentation about the GDC fro - else if (strcmp (language_string, "GNU F77") == 0) - language = DW_LANG_Fortran77; - else if (strcmp (language_string, "GNU Pascal") == 0) ----- gcc/gcc.c 2013-03-06 06:32:03.000000000 +0000 --+++ gcc/gcc.c 2013-03-20 16:26:18.706235722 +0000 --@@ -1002,6 +1002,7 @@ static const struct compiler default_com -+@@ -20226,7 +20237,7 @@ declare_in_namespace (tree thing, dw_die_ref context_die) -+ -+ if (ns_context != context_die) -+ { -+- if (is_fortran ()) -++ if (is_fortran () || is_dlang ()) -+ return ns_context; -+ if (DECL_P (thing)) -+ gen_decl_die (thing, NULL, ns_context); -+@@ -20249,7 +20260,7 @@ gen_namespace_die (tree decl, dw_die_ref context_die) -+ { -+ /* Output a real namespace or module. */ -+ context_die = setup_namespace_context (decl, comp_unit_die ()); -+- namespace_die = new_die (is_fortran () -++ namespace_die = new_die (is_fortran () || is_dlang () -+ ? DW_TAG_module : DW_TAG_namespace, -+ context_die, decl); -+ /* For Fortran modules defined in different CU don't add src coords. */ -+@@ -20306,7 +20317,7 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die) -+ break; -+ -+ case CONST_DECL: -+- if (!is_fortran () && !is_ada ()) -++ if (!is_fortran () && !is_ada () && !is_dlang ()) -+ { -+ /* The individual enumerators of an enum type get output when we output -+ the Dwarf representation of the relevant enum type itself. */ -+@@ -20776,7 +20787,7 @@ dwarf2out_decl (tree decl) -+ case CONST_DECL: -+ if (debug_info_level <= DINFO_LEVEL_TERSE) -+ return; -+- if (!is_fortran () && !is_ada ()) -++ if (!is_fortran () && !is_ada () && !is_dlang ()) -+ return; -+ if (TREE_STATIC (decl) && decl_function_context (decl)) -+ context_die = lookup_decl_die (DECL_CONTEXT (decl)); -+--- gcc/gcc.c -++++ gcc/gcc.c -+@@ -1021,6 +1021,7 @@ static const struct compiler default_compilers[] = - {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0}, - {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0}, - {".go", "#Go", 0, 1, 0}, ---- a/src/gcc/d/patches/patch-toplev-4.9.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-toplev-4.9.x 2014-04-01 16:32:51.000000000 +0100 -@@ -1,9 +1,9 @@ - This implements building of libphobos library in GCC. - --- - ----- gcc/configure 2013-02-15 17:45:54.000000000 +0000 --+++ gcc/configure 2013-03-20 16:26:18.442235719 +0000 --@@ -2781,7 +2781,8 @@ target_libraries="target-libgcc \ -+--- a/configure -++++ b/configure -+@@ -2785,7 +2785,8 @@ target_libraries="target-libgcc \ - ${libgcj} \ - target-libobjc \ - target-libada \ -@@ -13,9 +13,9 @@ This implements building of libphobos li - - # these tools are built using the target libraries, and are intended to - # run only in the target environment ----- gcc/configure.ac 2013-02-15 17:45:54.000000000 +0000 --+++ gcc/configure.ac 2013-03-20 16:26:18.462235720 +0000 --@@ -168,7 +168,8 @@ target_libraries="target-libgcc \ -+--- a/configure.ac -++++ b/configure.ac -+@@ -169,7 +169,8 @@ target_libraries="target-libgcc \ - ${libgcj} \ - target-libobjc \ - target-libada \ -@@ -25,9 +25,9 @@ This implements building of libphobos li - - # these tools are built using the target libraries, and are intended to - # run only in the target environment ----- gcc/Makefile.def 2013-01-14 16:15:21.000000000 +0000 --+++ gcc/Makefile.def 2013-03-20 16:26:18.466235720 +0000 --@@ -131,6 +131,7 @@ target_modules = { module= libquadmath; -+--- a/Makefile.def -++++ b/Makefile.def -+@@ -135,6 +135,7 @@ target_modules = { module= libquadmath; }; - target_modules = { module= libgfortran; }; - target_modules = { module= libobjc; }; - target_modules = { module= libgo; }; -@@ -35,7 +35,7 @@ This implements building of libphobos li - target_modules = { module= libtermcap; no_check=true; - missing=mostlyclean; - missing=clean; --@@ -505,6 +506,8 @@ dependencies = { module=configure-target -+@@ -510,6 +511,8 @@ dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; }; - dependencies = { module=all-target-libgo; on=all-target-libbacktrace; }; - dependencies = { module=all-target-libgo; on=all-target-libffi; }; - dependencies = { module=all-target-libgo; on=all-target-libatomic; }; -@@ -44,7 +44,7 @@ This implements building of libphobos li - dependencies = { module=configure-target-libjava; on=configure-target-zlib; }; - dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; }; - dependencies = { module=configure-target-libjava; on=configure-target-libffi; }; --@@ -560,6 +563,8 @@ languages = { language=objc; gcc-check-t -+@@ -569,6 +572,8 @@ languages = { language=objc; gcc-check-target=check-objc; - languages = { language=obj-c++; gcc-check-target=check-obj-c++; }; - languages = { language=go; gcc-check-target=check-go; - lib-check-target=check-target-libgo; }; -@@ -53,9 +53,9 @@ This implements building of libphobos li - - // Toplevel bootstrap - bootstrap_stage = { id=1 ; }; ----- gcc/Makefile.in 2013-01-14 16:15:21.000000000 +0000 --+++ gcc/Makefile.in 2013-03-20 16:26:18.514235720 +0000 --@@ -933,6 +933,7 @@ configure-target: \ -+--- a/Makefile.in -++++ b/Makefile.in -+@@ -940,6 +940,7 @@ configure-target: \ - maybe-configure-target-libgfortran \ - maybe-configure-target-libobjc \ - maybe-configure-target-libgo \ -@@ -63,7 +63,7 @@ This implements building of libphobos li - maybe-configure-target-libtermcap \ - maybe-configure-target-winsup \ - maybe-configure-target-libgloss \ --@@ -1086,6 +1087,7 @@ all-target: maybe-all-target-libquadmath -+@@ -1096,6 +1097,7 @@ all-target: maybe-all-target-libquadmath - all-target: maybe-all-target-libgfortran - all-target: maybe-all-target-libobjc - all-target: maybe-all-target-libgo -@@ -71,7 +71,7 @@ This implements building of libphobos li - all-target: maybe-all-target-libtermcap - all-target: maybe-all-target-winsup - all-target: maybe-all-target-libgloss --@@ -1175,6 +1177,7 @@ info-target: maybe-info-target-libquadma -+@@ -1186,6 +1188,7 @@ info-target: maybe-info-target-libquadmath - info-target: maybe-info-target-libgfortran - info-target: maybe-info-target-libobjc - info-target: maybe-info-target-libgo -@@ -79,7 +79,7 @@ This implements building of libphobos li - info-target: maybe-info-target-libtermcap - info-target: maybe-info-target-winsup - info-target: maybe-info-target-libgloss --@@ -1257,6 +1260,7 @@ dvi-target: maybe-dvi-target-libquadmath -+@@ -1269,6 +1272,7 @@ dvi-target: maybe-dvi-target-libquadmath - dvi-target: maybe-dvi-target-libgfortran - dvi-target: maybe-dvi-target-libobjc - dvi-target: maybe-dvi-target-libgo -@@ -87,7 +87,7 @@ This implements building of libphobos li - dvi-target: maybe-dvi-target-libtermcap - dvi-target: maybe-dvi-target-winsup - dvi-target: maybe-dvi-target-libgloss --@@ -1339,6 +1343,7 @@ pdf-target: maybe-pdf-target-libquadmath -+@@ -1352,6 +1356,7 @@ pdf-target: maybe-pdf-target-libquadmath - pdf-target: maybe-pdf-target-libgfortran - pdf-target: maybe-pdf-target-libobjc - pdf-target: maybe-pdf-target-libgo -@@ -95,7 +95,7 @@ This implements building of libphobos li - pdf-target: maybe-pdf-target-libtermcap - pdf-target: maybe-pdf-target-winsup - pdf-target: maybe-pdf-target-libgloss --@@ -1421,6 +1426,7 @@ html-target: maybe-html-target-libquadma -+@@ -1435,6 +1440,7 @@ html-target: maybe-html-target-libquadmath - html-target: maybe-html-target-libgfortran - html-target: maybe-html-target-libobjc - html-target: maybe-html-target-libgo -@@ -103,7 +103,7 @@ This implements building of libphobos li - html-target: maybe-html-target-libtermcap - html-target: maybe-html-target-winsup - html-target: maybe-html-target-libgloss --@@ -1503,6 +1509,7 @@ TAGS-target: maybe-TAGS-target-libquadma -+@@ -1518,6 +1524,7 @@ TAGS-target: maybe-TAGS-target-libquadmath - TAGS-target: maybe-TAGS-target-libgfortran - TAGS-target: maybe-TAGS-target-libobjc - TAGS-target: maybe-TAGS-target-libgo -@@ -111,7 +111,7 @@ This implements building of libphobos li - TAGS-target: maybe-TAGS-target-libtermcap - TAGS-target: maybe-TAGS-target-winsup - TAGS-target: maybe-TAGS-target-libgloss --@@ -1585,6 +1592,7 @@ install-info-target: maybe-install-info- -+@@ -1601,6 +1608,7 @@ install-info-target: maybe-install-info-target-libquadmath - install-info-target: maybe-install-info-target-libgfortran - install-info-target: maybe-install-info-target-libobjc - install-info-target: maybe-install-info-target-libgo -@@ -119,7 +119,7 @@ This implements building of libphobos li - install-info-target: maybe-install-info-target-libtermcap - install-info-target: maybe-install-info-target-winsup - install-info-target: maybe-install-info-target-libgloss --@@ -1667,6 +1675,7 @@ install-pdf-target: maybe-install-pdf-ta -+@@ -1684,6 +1692,7 @@ install-pdf-target: maybe-install-pdf-target-libquadmath - install-pdf-target: maybe-install-pdf-target-libgfortran - install-pdf-target: maybe-install-pdf-target-libobjc - install-pdf-target: maybe-install-pdf-target-libgo -@@ -127,7 +127,7 @@ This implements building of libphobos li - install-pdf-target: maybe-install-pdf-target-libtermcap - install-pdf-target: maybe-install-pdf-target-winsup - install-pdf-target: maybe-install-pdf-target-libgloss --@@ -1749,6 +1758,7 @@ install-html-target: maybe-install-html- -+@@ -1767,6 +1776,7 @@ install-html-target: maybe-install-html-target-libquadmath - install-html-target: maybe-install-html-target-libgfortran - install-html-target: maybe-install-html-target-libobjc - install-html-target: maybe-install-html-target-libgo -@@ -135,7 +135,7 @@ This implements building of libphobos li - install-html-target: maybe-install-html-target-libtermcap - install-html-target: maybe-install-html-target-winsup - install-html-target: maybe-install-html-target-libgloss --@@ -1831,6 +1841,7 @@ installcheck-target: maybe-installcheck- -+@@ -1850,6 +1860,7 @@ installcheck-target: maybe-installcheck-target-libquadmath - installcheck-target: maybe-installcheck-target-libgfortran - installcheck-target: maybe-installcheck-target-libobjc - installcheck-target: maybe-installcheck-target-libgo -@@ -143,7 +143,7 @@ This implements building of libphobos li - installcheck-target: maybe-installcheck-target-libtermcap - installcheck-target: maybe-installcheck-target-winsup - installcheck-target: maybe-installcheck-target-libgloss --@@ -1913,6 +1924,7 @@ mostlyclean-target: maybe-mostlyclean-ta -+@@ -1933,6 +1944,7 @@ mostlyclean-target: maybe-mostlyclean-target-libquadmath - mostlyclean-target: maybe-mostlyclean-target-libgfortran - mostlyclean-target: maybe-mostlyclean-target-libobjc - mostlyclean-target: maybe-mostlyclean-target-libgo -@@ -151,7 +151,7 @@ This implements building of libphobos li - mostlyclean-target: maybe-mostlyclean-target-libtermcap - mostlyclean-target: maybe-mostlyclean-target-winsup - mostlyclean-target: maybe-mostlyclean-target-libgloss --@@ -1995,6 +2007,7 @@ clean-target: maybe-clean-target-libquad -+@@ -2016,6 +2028,7 @@ clean-target: maybe-clean-target-libquadmath - clean-target: maybe-clean-target-libgfortran - clean-target: maybe-clean-target-libobjc - clean-target: maybe-clean-target-libgo -@@ -159,7 +159,7 @@ This implements building of libphobos li - clean-target: maybe-clean-target-libtermcap - clean-target: maybe-clean-target-winsup - clean-target: maybe-clean-target-libgloss --@@ -2077,6 +2090,7 @@ distclean-target: maybe-distclean-target -+@@ -2099,6 +2112,7 @@ distclean-target: maybe-distclean-target-libquadmath - distclean-target: maybe-distclean-target-libgfortran - distclean-target: maybe-distclean-target-libobjc - distclean-target: maybe-distclean-target-libgo -@@ -167,7 +167,7 @@ This implements building of libphobos li - distclean-target: maybe-distclean-target-libtermcap - distclean-target: maybe-distclean-target-winsup - distclean-target: maybe-distclean-target-libgloss --@@ -2159,6 +2173,7 @@ maintainer-clean-target: maybe-maintaine -+@@ -2182,6 +2196,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libquadmath - maintainer-clean-target: maybe-maintainer-clean-target-libgfortran - maintainer-clean-target: maybe-maintainer-clean-target-libobjc - maintainer-clean-target: maybe-maintainer-clean-target-libgo -@@ -175,7 +175,7 @@ This implements building of libphobos li - maintainer-clean-target: maybe-maintainer-clean-target-libtermcap - maintainer-clean-target: maybe-maintainer-clean-target-winsup - maintainer-clean-target: maybe-maintainer-clean-target-libgloss --@@ -2296,6 +2311,7 @@ check-target: \ -+@@ -2320,6 +2335,7 @@ check-target: \ - maybe-check-target-libgfortran \ - maybe-check-target-libobjc \ - maybe-check-target-libgo \ -@@ -183,7 +183,7 @@ This implements building of libphobos li - maybe-check-target-libtermcap \ - maybe-check-target-winsup \ - maybe-check-target-libgloss \ --@@ -2451,6 +2467,7 @@ install-target: \ -+@@ -2476,6 +2492,7 @@ install-target: \ - maybe-install-target-libgfortran \ - maybe-install-target-libobjc \ - maybe-install-target-libgo \ -@@ -191,7 +191,7 @@ This implements building of libphobos li - maybe-install-target-libtermcap \ - maybe-install-target-winsup \ - maybe-install-target-libgloss \ --@@ -2553,6 +2570,7 @@ install-strip-target: \ -+@@ -2579,6 +2596,7 @@ install-strip-target: \ - maybe-install-strip-target-libgfortran \ - maybe-install-strip-target-libobjc \ - maybe-install-strip-target-libgo \ -@@ -199,7 +199,7 @@ This implements building of libphobos li - maybe-install-strip-target-libtermcap \ - maybe-install-strip-target-winsup \ - maybe-install-strip-target-libgloss \ --@@ -37320,6 +37338,463 @@ maintainer-clean-target-libgo: -+@@ -38320,6 +38338,463 @@ maintainer-clean-target-libgo: - - - -@@ -663,7 +663,7 @@ This implements building of libphobos li - .PHONY: configure-target-libtermcap maybe-configure-target-libtermcap - maybe-configure-target-libtermcap: - @if gcc-bootstrap --@@ -43354,6 +43829,14 @@ check-gcc-go: -+@@ -44337,6 +44812,14 @@ check-gcc-go: - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-go); - check-go: check-gcc-go check-target-libgo - -@@ -678,7 +678,7 @@ This implements building of libphobos li - - # The gcc part of install-no-fixedincludes, which relies on an intimate - # knowledge of how a number of gcc internal targets (inter)operate. Delegate. --@@ -45407,6 +45890,7 @@ configure-target-libquadmath: stage_last -+@@ -46396,6 +46879,7 @@ configure-target-libquadmath: stage_last - configure-target-libgfortran: stage_last - configure-target-libobjc: stage_last - configure-target-libgo: stage_last -@@ -686,7 +686,7 @@ This implements building of libphobos li - configure-target-libtermcap: stage_last - configure-target-winsup: stage_last - configure-target-libgloss: stage_last --@@ -45438,6 +45922,7 @@ configure-target-libquadmath: maybe-all- -+@@ -46428,6 +46912,7 @@ configure-target-libquadmath: maybe-all-gcc - configure-target-libgfortran: maybe-all-gcc - configure-target-libobjc: maybe-all-gcc - configure-target-libgo: maybe-all-gcc -@@ -694,7 +694,7 @@ This implements building of libphobos li - configure-target-libtermcap: maybe-all-gcc - configure-target-winsup: maybe-all-gcc - configure-target-libgloss: maybe-all-gcc --@@ -46180,6 +46665,8 @@ configure-target-libgo: maybe-all-target -+@@ -47170,6 +47655,8 @@ configure-target-libgo: maybe-all-target-libstdc++-v3 - all-target-libgo: maybe-all-target-libbacktrace - all-target-libgo: maybe-all-target-libffi - all-target-libgo: maybe-all-target-libatomic -@@ -703,7 +703,7 @@ This implements building of libphobos li - configure-target-libjava: maybe-configure-target-zlib - configure-target-libjava: maybe-configure-target-boehm-gc - configure-target-libjava: maybe-configure-target-libffi --@@ -46266,6 +46753,7 @@ configure-target-libquadmath: maybe-all- -+@@ -47275,6 +47762,7 @@ configure-target-libquadmath: maybe-all-target-libgcc - configure-target-libgfortran: maybe-all-target-libgcc - configure-target-libobjc: maybe-all-target-libgcc - configure-target-libgo: maybe-all-target-libgcc -@@ -711,7 +711,7 @@ This implements building of libphobos li - configure-target-libtermcap: maybe-all-target-libgcc - configure-target-winsup: maybe-all-target-libgcc - configure-target-libgloss: maybe-all-target-libgcc --@@ -46301,6 +46789,8 @@ configure-target-libobjc: maybe-all-targ -+@@ -47313,6 +47801,8 @@ configure-target-libobjc: maybe-all-target-newlib maybe-all-target-libgloss - - configure-target-libgo: maybe-all-target-newlib maybe-all-target-libgloss - ---- a/src/gcc/d/patches/patch-versym-cpu-4.9.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-versym-cpu-4.9.x 2014-04-01 16:32:51.000000000 +0100 -@@ -42,10 +42,10 @@ for all supported architectures. And the - ** SPARC_SoftFloat - --- - ----- gcc/config/aarch64/aarch64.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/aarch64/aarch64.h 2013-03-20 16:26:18.726235723 +0000 --@@ -51,6 +51,14 @@ -- \ -+--- gcc/config/aarch64/aarch64.h -++++ gcc/config/aarch64/aarch64.h -+@@ -56,6 +56,14 @@ -+ } \ - } while (0) - - +/* Target CPU builtins for D. */ -@@ -59,9 +59,9 @@ for all supported architectures. And the - - - /* Target machine storage layout. */ ----- gcc/config/alpha/alpha.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/alpha/alpha.h 2013-03-20 16:26:18.734235722 +0000 --@@ -72,6 +72,23 @@ along with GCC; see the file COPYING3. -+--- gcc/config/alpha/alpha.h -++++ gcc/config/alpha/alpha.h -+@@ -72,6 +72,23 @@ along with GCC; see the file COPYING3. If not see - SUBTARGET_LANGUAGE_CPP_BUILTINS(); \ - } while (0) - -@@ -85,8 +85,8 @@ for all supported architectures. And the - #ifndef SUBTARGET_LANGUAGE_CPP_BUILTINS - #define SUBTARGET_LANGUAGE_CPP_BUILTINS() \ - do \ ----- gcc/config/arm/arm.h 2013-01-15 16:17:28.000000000 +0000 --+++ gcc/config/arm/arm.h 2013-03-20 16:26:18.746235724 +0000 -+--- gcc/config/arm/arm.h -++++ gcc/config/arm/arm.h - @@ -158,6 +158,31 @@ extern char arm_arch_name[]; - builtin_define ("__ARM_ARCH_EXT_IDIV__"); \ - } while (0) -@@ -119,9 +119,9 @@ for all supported architectures. And the - #include "config/arm/arm-opts.h" - - enum target_cpus ----- gcc/config/i386/i386.h 2013-01-28 20:42:55.000000000 +0000 --+++ gcc/config/i386/i386.h 2013-03-20 16:26:18.754235724 +0000 --@@ -588,6 +588,24 @@ extern const char *host_detect_local_cpu -+--- gcc/config/i386/i386.h -++++ gcc/config/i386/i386.h -+@@ -604,6 +604,24 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); - /* Target CPU builtins. */ - #define TARGET_CPU_CPP_BUILTINS() ix86_target_macros () - -@@ -146,8 +146,8 @@ for all supported architectures. And the - /* Target Pragmas. */ - #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas () - ----- gcc/config/ia64/ia64.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/ia64/ia64.h 2013-03-20 16:26:18.766235724 +0000 -+--- gcc/config/ia64/ia64.h -++++ gcc/config/ia64/ia64.h - @@ -40,6 +40,13 @@ do { \ - builtin_define("__BIG_ENDIAN__"); \ - } while (0) -@@ -162,9 +162,9 @@ for all supported architectures. And the - #ifndef SUBTARGET_EXTRA_SPECS - #define SUBTARGET_EXTRA_SPECS - #endif ----- gcc/config/mips/mips.h 2013-02-25 13:53:16.000000000 +0000 --+++ gcc/config/mips/mips.h 2013-03-20 16:26:18.778235723 +0000 --@@ -551,6 +551,54 @@ struct mips_cpu_info { -+--- gcc/config/mips/mips.h -++++ gcc/config/mips/mips.h -+@@ -574,6 +574,54 @@ struct mips_cpu_info { - } \ - while (0) - -@@ -219,8 +219,8 @@ for all supported architectures. And the - /* Default target_flags if no switches are specified */ - - #ifndef TARGET_DEFAULT ----- gcc/config/pa/pa.h 2013-02-03 19:52:37.000000000 +0000 --+++ gcc/config/pa/pa.h 2013-03-20 16:26:18.870235724 +0000 -+--- gcc/config/pa/pa.h -++++ gcc/config/pa/pa.h - @@ -185,6 +185,20 @@ do { \ - builtin_define("_PA_RISC1_0"); \ - } while (0) -@@ -242,9 +242,9 @@ for all supported architectures. And the - /* An old set of OS defines for various BSD-like systems. */ - #define TARGET_OS_CPP_BUILTINS() \ - do \ ----- gcc/config/rs6000/rs6000.h 2013-02-09 09:30:45.000000000 +0000 --+++ gcc/config/rs6000/rs6000.h 2013-03-20 16:26:19.058235728 +0000 --@@ -613,6 +613,28 @@ extern unsigned char rs6000_recip_bits[] -+--- gcc/config/rs6000/rs6000.h -++++ gcc/config/rs6000/rs6000.h -+@@ -685,6 +685,28 @@ extern unsigned char rs6000_recip_bits[]; - #define TARGET_CPU_CPP_BUILTINS() \ - rs6000_cpu_cpp_builtins (pfile) - -@@ -273,10 +273,10 @@ for all supported architectures. And the - /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order - we're compiling for. Some configurations may need to override it. */ - #define RS6000_CPU_CPP_ENDIAN_BUILTINS() \ ----- gcc/config/s390/s390.h 2013-03-05 12:02:06.000000000 +0000 --+++ gcc/config/s390/s390.h 2013-03-20 16:26:19.094235727 +0000 --@@ -108,6 +108,22 @@ enum processor_flags -- } \ -+--- gcc/config/s390/s390.h -++++ gcc/config/s390/s390.h -+@@ -114,6 +114,22 @@ enum processor_flags -+ } \ - while (0) - - +/* Target CPU builtins for D. */ -@@ -296,11 +296,11 @@ for all supported architectures. And the - + while (0) - + - #ifdef DEFAULT_TARGET_64BIT -- #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP) -+ #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP | MASK_OPT_HTM) - #else ----- gcc/config/sh/sh.h 2013-03-13 18:09:10.000000000 +0000 --+++ gcc/config/sh/sh.h 2013-03-20 16:26:19.102235728 +0000 --@@ -31,6 +31,22 @@ extern int code_for_indirect_jump_scratc -+--- gcc/config/sh/sh.h -++++ gcc/config/sh/sh.h -+@@ -31,6 +31,22 @@ extern int code_for_indirect_jump_scratch; - - #define TARGET_CPU_CPP_BUILTINS() sh_cpu_cpp_builtins (pfile) - -@@ -323,9 +323,9 @@ for all supported architectures. And the - /* Value should be nonzero if functions must have frame pointers. - Zero means the frame pointer need not be set up (and parms may be accessed - via the stack pointer) in functions that seem suitable. */ ----- gcc/config/sparc/sparc.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/sparc/sparc.h 2013-03-20 16:26:19.110235727 +0000 --@@ -27,6 +27,31 @@ along with GCC; see the file COPYING3. -+--- gcc/config/sparc/sparc.h -++++ gcc/config/sparc/sparc.h -+@@ -27,6 +27,31 @@ along with GCC; see the file COPYING3. If not see - - #define TARGET_CPU_CPP_BUILTINS() sparc_target_macros () - ---- a/src/gcc/d/patches/patch-versym-os-4.8.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-versym-os-4.8.x 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,4 @@ --This implements the following official versions: -+This patch implements the following official versions: - * Windows - ** Win32 - ** Win64 -@@ -12,7 +12,6 @@ This implements the following official v - * Solaris - * Posix - * AIX --* SysV4 - * Hurd - * Android - -@@ -20,8 +19,8 @@ These gdc specific versions are also imp - * GNU_MinGW64 (for mingw-w64) - * GNU_OpenSolaris (for opensolaris) - * GNU_GLibc (implemented for linux & bsd & opensolaris) --* GNU_UCLibc (implemented for linux) --* GNU_Bionic (implemented for linux) -+* GNU_UCLibc (implemented for linux) (not on rs6000, alpha) -+* GNU_Bionic (implemented for linux) (not on rs6000, alpha) - - These official OS versions are not implemented: - * DragonFlyBSD -@@ -29,10 +28,30 @@ These official OS versions are not imple - * Haiku - * SkyOS - * SysV3 -+* SysV4 - --- - ----- gcc/config/arm/linux-eabi.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/arm/linux-eabi.h 2013-03-20 16:26:19.134235729 +0000 -+--- gcc/config/alpha/linux.h 2013-07-04 20:28:59.559658493 +0200 -++++ gcc/config/alpha/linux.h 2013-07-04 20:04:56.000000000 +0200 -+@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3. -+ builtin_define ("_GNU_SOURCE"); \ -+ } while (0) -+ -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do { \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ } while (0) -++ -+ #undef LIB_SPEC -+ #define LIB_SPEC \ -+ "%{pthread:-lpthread} \ -+--- gcc/config/arm/linux-eabi.h 2013-07-04 20:28:59.559658493 +0200 -++++ gcc/config/arm/linux-eabi.h 2013-07-04 18:30:31.000000000 +0200 - @@ -30,6 +30,15 @@ - } \ - while (false) -@@ -49,8 +68,8 @@ These official OS versions are not imple - /* We default to a soft-float ABI so that binaries can run on all - target hardware. If you override this to use the hard-float ABI then - change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */ ----- gcc/config/darwin.h 2013-02-11 23:30:10.000000000 +0000 --+++ gcc/config/darwin.h 2013-03-20 16:26:19.162235729 +0000 -+--- gcc/config/darwin.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/darwin.h 2013-07-04 18:30:31.000000000 +0200 - @@ -921,4 +921,10 @@ extern void darwin_driver_init (unsigned - providing an osx-version-min of this unless overridden by the User. */ - #define DEF_MIN_OSX_VERSION "10.4" -@@ -62,8 +81,8 @@ These official OS versions are not imple - + } while (0) - + - #endif /* CONFIG_DARWIN_H */ ----- gcc/config/freebsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/freebsd.h 2013-03-20 16:26:19.178235729 +0000 -+--- gcc/config/freebsd.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/freebsd.h 2013-07-04 18:30:31.000000000 +0200 - @@ -32,6 +32,13 @@ along with GCC; see the file COPYING3. - #undef TARGET_OS_CPP_BUILTINS - #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS() -@@ -78,8 +97,8 @@ These official OS versions are not imple - #undef CPP_SPEC - #define CPP_SPEC FBSD_CPP_SPEC - ----- gcc/config/gnu.h 2013-02-06 23:12:03.000000000 +0000 --+++ gcc/config/gnu.h 2013-03-20 16:26:19.182235728 +0000 -+--- gcc/config/gnu.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/gnu.h 2013-07-04 18:30:34.000000000 +0200 - @@ -39,3 +39,11 @@ along with GCC. If not, see <http://www - builtin_assert ("system=unix"); \ - builtin_assert ("system=posix"); \ -@@ -92,8 +111,8 @@ These official OS versions are not imple - + builtin_define ("Hurd"); \ - + builtin_define ("Posix"); \ - + } while (0) ----- gcc/config/i386/cygwin.h 2013-03-13 15:17:54.000000000 +0000 --+++ gcc/config/i386/cygwin.h 2013-03-20 16:26:19.190235729 +0000 -+--- gcc/config/i386/cygwin.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/i386/cygwin.h 2013-07-04 18:30:34.000000000 +0200 - @@ -20,6 +20,13 @@ along with GCC; see the file COPYING3. - - #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */ -@@ -108,8 +127,8 @@ These official OS versions are not imple - #undef CPP_SPEC - #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ - -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \ ----- gcc/config/i386/linux-common.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/linux-common.h 2013-03-20 16:26:19.202235730 +0000 -+--- gcc/config/i386/linux-common.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/i386/linux-common.h 2013-07-04 18:30:34.000000000 +0200 - @@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -126,8 +145,8 @@ These official OS versions are not imple - #undef CC1_SPEC - #define CC1_SPEC \ - LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ ----- gcc/config/i386/mingw32.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/mingw32.h 2013-03-20 16:26:19.206235730 +0000 -+--- gcc/config/i386/mingw32.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/i386/mingw32.h 2013-07-04 18:30:35.000000000 +0200 - @@ -53,6 +53,18 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -147,8 +166,8 @@ These official OS versions are not imple - #ifndef TARGET_USE_PTHREAD_BY_DEFAULT - #define SPEC_PTHREAD1 "pthread" - #define SPEC_PTHREAD2 "!no-pthread" ----- gcc/config/i386/mingw-w64.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/mingw-w64.h 2013-03-20 16:26:19.206235730 +0000 -+--- gcc/config/i386/mingw-w64.h 2013-07-04 20:28:59.560658513 +0200 -++++ gcc/config/i386/mingw-w64.h 2013-07-04 18:30:35.000000000 +0200 - @@ -84,3 +84,10 @@ along with GCC; see the file COPYING3. - %{static:-Bstatic} %{!static:-Bdynamic} \ - %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ -@@ -160,34 +179,8 @@ These official OS versions are not imple - + TARGET_GENERIC_MINGW_OS_D_BUILTINS(); \ - + builtin_define ("GNU_MinGW64"); \ - + } while (0) ----- gcc/config/i386/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/sysv4.h 2013-03-20 16:26:19.210235730 +0000 --@@ -70,3 +70,10 @@ along with GCC; see the file COPYING3. -- "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \ -- : "=d"(BASE)) -- #endif --+ --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) ----- gcc/config/ia64/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/ia64/sysv4.h 2013-03-20 16:26:19.210235730 +0000 --@@ -142,3 +142,10 @@ do { \ -- -- #define SDATA_SECTION_ASM_OP "\t.sdata" -- #define SBSS_SECTION_ASM_OP "\t.sbss" --+ --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) ----- gcc/config/kfreebsd-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/kfreebsd-gnu.h 2013-03-20 16:26:19.210235730 +0000 -+--- gcc/config/kfreebsd-gnu.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/kfreebsd-gnu.h 2013-07-04 18:30:36.000000000 +0200 - @@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -203,8 +196,8 @@ These official OS versions are not imple - #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32 - #define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64 ----- gcc/config/knetbsd-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/knetbsd-gnu.h 2013-03-20 16:26:19.218235730 +0000 -+--- gcc/config/knetbsd-gnu.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/knetbsd-gnu.h 2013-07-04 18:30:36.000000000 +0200 - @@ -30,6 +30,16 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -222,8 +215,8 @@ These official OS versions are not imple - - #undef GNU_USER_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1" ----- gcc/config/kopensolaris-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/kopensolaris-gnu.h 2013-03-20 16:26:19.218235730 +0000 -+--- gcc/config/kopensolaris-gnu.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/kopensolaris-gnu.h 2013-07-04 18:30:36.000000000 +0200 - @@ -30,5 +30,15 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -240,8 +233,8 @@ These official OS versions are not imple - + - #undef GNU_USER_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1" ----- gcc/config/linux-android.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/linux-android.h 2013-03-20 16:26:19.218235730 +0000 -+--- gcc/config/linux-android.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/linux-android.h 2013-07-04 18:30:36.000000000 +0200 - @@ -25,6 +25,12 @@ - builtin_define ("__ANDROID__"); \ - } while (0) -@@ -255,8 +248,8 @@ These official OS versions are not imple - #if ANDROID_DEFAULT - # define NOANDROID "mno-android" - #else ----- gcc/config/linux.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/linux.h 2013-03-20 16:26:19.226235729 +0000 -+--- gcc/config/linux.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/linux.h 2013-07-04 18:30:36.000000000 +0200 - @@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTI - builtin_assert ("system=posix"); \ - } while (0) -@@ -278,8 +271,8 @@ These official OS versions are not imple - /* Determine which dynamic linker to use depending on whether GLIBC or - uClibc or Bionic is the default C library and whether - -muclibc or -mglibc or -mbionic has been passed to change the default. */ ----- gcc/config/mips/linux-common.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/mips/linux-common.h 2013-03-20 16:26:19.230235729 +0000 -+--- gcc/config/mips/linux-common.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/mips/linux-common.h 2013-07-04 18:30:36.000000000 +0200 - @@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. - ANDROID_TARGET_OS_CPP_BUILTINS(); \ - } while (0) -@@ -296,8 +289,8 @@ These official OS versions are not imple - #undef LINK_SPEC - #define LINK_SPEC \ - LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ ----- gcc/config/netbsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/netbsd.h 2013-03-20 16:26:19.230235729 +0000 -+--- gcc/config/netbsd.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/netbsd.h 2013-07-04 18:30:36.000000000 +0200 - @@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -313,8 +306,8 @@ These official OS versions are not imple - /* CPP_SPEC parts common to all NetBSD targets. */ - #define NETBSD_CPP_SPEC \ - "%{posix:-D_POSIX_SOURCE} \ ----- gcc/config/openbsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/openbsd.h 2013-03-20 16:26:19.230235729 +0000 -+--- gcc/config/openbsd.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/openbsd.h 2013-07-04 18:30:36.000000000 +0200 - @@ -84,6 +84,14 @@ along with GCC; see the file COPYING3. - } \ - while (0) -@@ -330,8 +323,8 @@ These official OS versions are not imple - /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets. */ - #define OPENBSD_OS_CPP_BUILTINS_ELF() \ - do \ ----- gcc/config/rs6000/aix.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/rs6000/aix.h 2013-03-20 16:26:19.230235729 +0000 -+--- gcc/config/rs6000/aix.h 2013-07-04 20:28:59.561658533 +0200 -++++ gcc/config/rs6000/aix.h 2013-07-04 18:30:36.000000000 +0200 - @@ -110,6 +110,13 @@ - } \ - while (0) -@@ -346,32 +339,43 @@ These official OS versions are not imple - /* Define appropriate architecture macros for preprocessor depending on - target switches. */ - ----- gcc/config/rs6000/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/rs6000/sysv4.h 2013-03-20 16:26:19.238235730 +0000 --@@ -523,6 +523,13 @@ extern int fixuplabelno; -+--- gcc/config/rs6000/linux64.h 2013-07-04 20:28:59.562658553 +0200 -++++ gcc/config/rs6000/linux64.h 2013-07-04 20:11:16.000000000 +0200 -+@@ -333,6 +333,17 @@ extern int dot_symbols; -+ } \ - while (0) -- #endif - --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do \ -++ { \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ } \ -++ while (0) - + -- #undef ASM_SPEC -- #define ASM_SPEC "%(asm_cpu) \ -- %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ ----- gcc/config/sparc/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/sparc/sysv4.h 2013-03-20 16:26:19.242235729 +0000 --@@ -117,3 +117,10 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == -+ #undef CPP_OS_DEFAULT_SPEC -+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" -+ -+--- gcc/config/rs6000/linux.h 2013-07-04 20:28:59.562658553 +0200 -++++ gcc/config/rs6000/linux.h 2013-07-04 20:12:15.000000000 +0200 -+@@ -52,6 +52,17 @@ -+ } \ -+ while (0) - -- #undef MCOUNT_FUNCTION -- #define MCOUNT_FUNCTION "*_mcount" -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do \ -++ { \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ } \ -++ while (0) - + --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) -+ #undef CPP_OS_DEFAULT_SPEC -+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" -+ ---- a/src/gcc/d/patches/patch-versym-os-4.9.x 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/patches/patch-versym-os-4.9.x 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,4 @@ --This implements the following official versions: -+This patch implements the following official versions: - * Windows - ** Win32 - ** Win64 -@@ -12,7 +12,6 @@ This implements the following official v - * Solaris - * Posix - * AIX --* SysV4 - * Hurd - * Android - -@@ -20,8 +19,8 @@ These gdc specific versions are also imp - * GNU_MinGW64 (for mingw-w64) - * GNU_OpenSolaris (for opensolaris) - * GNU_GLibc (implemented for linux & bsd & opensolaris) --* GNU_UCLibc (implemented for linux) --* GNU_Bionic (implemented for linux) -+* GNU_UCLibc (implemented for linux) (not on rs6000, alpha) -+* GNU_Bionic (implemented for linux) (not on rs6000, alpha) - - These official OS versions are not implemented: - * DragonFlyBSD -@@ -29,10 +28,30 @@ These official OS versions are not imple - * Haiku - * SkyOS - * SysV3 -+* SysV4 - --- - ----- gcc/config/arm/linux-eabi.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/arm/linux-eabi.h 2013-03-20 16:26:19.134235729 +0000 -+--- gcc/config/alpha/linux.h -++++ gcc/config/alpha/linux.h -+@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3. If not see -+ builtin_define ("_GNU_SOURCE"); \ -+ } while (0) -+ -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do { \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ } while (0) -++ -+ #undef LIB_SPEC -+ #define LIB_SPEC \ -+ "%{pthread:-lpthread} \ -+--- gcc/config/arm/linux-eabi.h -++++ gcc/config/arm/linux-eabi.h - @@ -30,6 +30,15 @@ - } \ - while (false) -@@ -49,9 +68,9 @@ These official OS versions are not imple - /* We default to a soft-float ABI so that binaries can run on all - target hardware. If you override this to use the hard-float ABI then - change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well. */ ----- gcc/config/darwin.h 2013-02-11 23:30:10.000000000 +0000 --+++ gcc/config/darwin.h 2013-03-20 16:26:19.162235729 +0000 --@@ -921,4 +921,10 @@ extern void darwin_driver_init (unsigned -+--- gcc/config/darwin.h -++++ gcc/config/darwin.h -+@@ -918,4 +918,10 @@ extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **); - providing an osx-version-min of this unless overridden by the User. */ - #define DEF_MIN_OSX_VERSION "10.4" - -@@ -62,9 +81,9 @@ These official OS versions are not imple - + } while (0) - + - #endif /* CONFIG_DARWIN_H */ ----- gcc/config/freebsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/freebsd.h 2013-03-20 16:26:19.178235729 +0000 --@@ -32,6 +32,13 @@ along with GCC; see the file COPYING3. -+--- gcc/config/freebsd.h -++++ gcc/config/freebsd.h -+@@ -32,6 +32,13 @@ along with GCC; see the file COPYING3. If not see - #undef TARGET_OS_CPP_BUILTINS - #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS() - -@@ -78,9 +97,9 @@ These official OS versions are not imple - #undef CPP_SPEC - #define CPP_SPEC FBSD_CPP_SPEC - ----- gcc/config/gnu.h 2013-02-06 23:12:03.000000000 +0000 --+++ gcc/config/gnu.h 2013-03-20 16:26:19.182235728 +0000 --@@ -39,3 +39,11 @@ along with GCC. If not, see <http://www -+--- gcc/config/gnu.h -++++ gcc/config/gnu.h -+@@ -39,3 +39,11 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>. - builtin_assert ("system=unix"); \ - builtin_assert ("system=posix"); \ - } while (0) -@@ -92,11 +111,11 @@ These official OS versions are not imple - + builtin_define ("Hurd"); \ - + builtin_define ("Posix"); \ - + } while (0) ----- gcc/config/i386/cygwin.h 2013-03-13 15:17:54.000000000 +0000 --+++ gcc/config/i386/cygwin.h 2013-03-20 16:26:19.190235729 +0000 --@@ -20,6 +20,13 @@ along with GCC; see the file COPYING3. -- -- #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */ -+--- gcc/config/i386/cygwin.h -++++ gcc/config/i386/cygwin.h -+@@ -29,6 +29,13 @@ along with GCC; see the file COPYING3. If not see -+ } \ -+ while (0) - - +#define TARGET_OS_D_BUILTINS() \ - + do { \ -@@ -107,10 +126,10 @@ These official OS versions are not imple - + - #undef CPP_SPEC - #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ -- -D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix \ ----- gcc/config/i386/linux-common.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/linux-common.h 2013-03-20 16:26:19.202235730 +0000 --@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. -+ %{!ansi:-Dunix} \ -+--- gcc/config/i386/linux-common.h -++++ gcc/config/i386/linux-common.h -+@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -126,9 +145,22 @@ These official OS versions are not imple - #undef CC1_SPEC - #define CC1_SPEC \ - LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ ----- gcc/config/i386/mingw32.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/mingw32.h 2013-03-20 16:26:19.206235730 +0000 --@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3. -+--- gcc/config/i386/mingw-w64.h -++++ gcc/config/i386/mingw-w64.h -+@@ -84,3 +84,10 @@ along with GCC; see the file COPYING3. If not see -+ %{static:-Bstatic} %{!static:-Bdynamic} \ -+ %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ -+ %(shared_libgcc_undefs)" -++ -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do { \ -++ TARGET_GENERIC_MINGW_OS_D_BUILTINS(); \ -++ builtin_define ("GNU_MinGW64"); \ -++ } while (0) -+--- gcc/config/i386/mingw32.h -++++ gcc/config/i386/mingw32.h -+@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -147,48 +179,9 @@ These official OS versions are not imple - #ifndef TARGET_USE_PTHREAD_BY_DEFAULT - #define SPEC_PTHREAD1 "pthread" - #define SPEC_PTHREAD2 "!no-pthread" ----- gcc/config/i386/mingw-w64.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/mingw-w64.h 2013-03-20 16:26:19.206235730 +0000 --@@ -84,3 +84,10 @@ along with GCC; see the file COPYING3. -- %{static:-Bstatic} %{!static:-Bdynamic} \ -- %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ -- %(shared_libgcc_undefs)" --+ --+#undef TARGET_OS_D_BUILTINS --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ TARGET_GENERIC_MINGW_OS_D_BUILTINS(); \ --+ builtin_define ("GNU_MinGW64"); \ --+ } while (0) ----- gcc/config/i386/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/i386/sysv4.h 2013-03-20 16:26:19.210235730 +0000 --@@ -70,3 +70,10 @@ along with GCC; see the file COPYING3. -- "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \ -- : "=d"(BASE)) -- #endif --+ --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) ----- gcc/config/ia64/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/ia64/sysv4.h 2013-03-20 16:26:19.210235730 +0000 --@@ -142,3 +142,10 @@ do { \ -- -- #define SDATA_SECTION_ASM_OP "\t.sdata" -- #define SBSS_SECTION_ASM_OP "\t.sbss" --+ --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) ----- gcc/config/kfreebsd-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/kfreebsd-gnu.h 2013-03-20 16:26:19.210235730 +0000 --@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. -+--- gcc/config/kfreebsd-gnu.h -++++ gcc/config/kfreebsd-gnu.h -+@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -203,9 +196,9 @@ These official OS versions are not imple - #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER32 GLIBC_DYNAMIC_LINKER32 - #define GNU_USER_DYNAMIC_LINKER64 GLIBC_DYNAMIC_LINKER64 ----- gcc/config/knetbsd-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/knetbsd-gnu.h 2013-03-20 16:26:19.218235730 +0000 --@@ -30,6 +30,16 @@ along with GCC; see the file COPYING3. -+--- gcc/config/knetbsd-gnu.h -++++ gcc/config/knetbsd-gnu.h -+@@ -30,6 +30,16 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -222,9 +215,9 @@ These official OS versions are not imple - - #undef GNU_USER_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1" ----- gcc/config/kopensolaris-gnu.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/kopensolaris-gnu.h 2013-03-20 16:26:19.218235730 +0000 --@@ -30,5 +30,15 @@ along with GCC; see the file COPYING3. -+--- gcc/config/kopensolaris-gnu.h -++++ gcc/config/kopensolaris-gnu.h -+@@ -30,5 +30,15 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -240,8 +233,8 @@ These official OS versions are not imple - + - #undef GNU_USER_DYNAMIC_LINKER - #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so.1" ----- gcc/config/linux-android.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/linux-android.h 2013-03-20 16:26:19.218235730 +0000 -+--- gcc/config/linux-android.h -++++ gcc/config/linux-android.h - @@ -25,6 +25,12 @@ - builtin_define ("__ANDROID__"); \ - } while (0) -@@ -255,9 +248,9 @@ These official OS versions are not imple - #if ANDROID_DEFAULT - # define NOANDROID "mno-android" - #else ----- gcc/config/linux.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/linux.h 2013-03-20 16:26:19.226235729 +0000 --@@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTI -+--- gcc/config/linux.h -++++ gcc/config/linux.h -+@@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - builtin_assert ("system=posix"); \ - } while (0) - -@@ -278,9 +271,9 @@ These official OS versions are not imple - /* Determine which dynamic linker to use depending on whether GLIBC or - uClibc or Bionic is the default C library and whether - -muclibc or -mglibc or -mbionic has been passed to change the default. */ ----- gcc/config/mips/linux-common.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/mips/linux-common.h 2013-03-20 16:26:19.230235729 +0000 --@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. -+--- gcc/config/mips/linux-common.h -++++ gcc/config/mips/linux-common.h -+@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. If not see - ANDROID_TARGET_OS_CPP_BUILTINS(); \ - } while (0) - -@@ -296,9 +289,9 @@ These official OS versions are not imple - #undef LINK_SPEC - #define LINK_SPEC \ - LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ ----- gcc/config/netbsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/netbsd.h 2013-03-20 16:26:19.230235729 +0000 --@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. -+--- gcc/config/netbsd.h -++++ gcc/config/netbsd.h -+@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -313,9 +306,9 @@ These official OS versions are not imple - /* CPP_SPEC parts common to all NetBSD targets. */ - #define NETBSD_CPP_SPEC \ - "%{posix:-D_POSIX_SOURCE} \ ----- gcc/config/openbsd.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/openbsd.h 2013-03-20 16:26:19.230235729 +0000 --@@ -84,6 +84,14 @@ along with GCC; see the file COPYING3. -+--- gcc/config/openbsd.h -++++ gcc/config/openbsd.h -+@@ -84,6 +84,14 @@ along with GCC; see the file COPYING3. If not see - } \ - while (0) - -@@ -330,9 +323,9 @@ These official OS versions are not imple - /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets. */ - #define OPENBSD_OS_CPP_BUILTINS_ELF() \ - do \ ----- gcc/config/rs6000/aix.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/rs6000/aix.h 2013-03-20 16:26:19.230235729 +0000 --@@ -110,6 +110,13 @@ -+--- gcc/config/rs6000/aix.h -++++ gcc/config/rs6000/aix.h -+@@ -115,6 +115,13 @@ - } \ - while (0) - -@@ -346,32 +339,43 @@ These official OS versions are not imple - /* Define appropriate architecture macros for preprocessor depending on - target switches. */ - ----- gcc/config/rs6000/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/rs6000/sysv4.h 2013-03-20 16:26:19.238235730 +0000 --@@ -523,6 +523,13 @@ extern int fixuplabelno; -+--- gcc/config/rs6000/linux.h -++++ gcc/config/rs6000/linux.h -+@@ -53,6 +53,17 @@ -+ } \ - while (0) -- #endif - --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do \ -++ { \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ } \ -++ while (0) - + -- #undef ASM_SPEC -- #define ASM_SPEC "%(asm_cpu) \ -- %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ ----- gcc/config/sparc/sysv4.h 2013-01-10 20:38:27.000000000 +0000 --+++ gcc/config/sparc/sysv4.h 2013-03-20 16:26:19.242235729 +0000 --@@ -117,3 +117,10 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == -+ #undef CPP_OS_DEFAULT_SPEC -+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" -+ -+--- gcc/config/rs6000/linux64.h -++++ gcc/config/rs6000/linux64.h -+@@ -340,6 +340,17 @@ extern int dot_symbols; -+ } \ -+ while (0) - -- #undef MCOUNT_FUNCTION -- #define MCOUNT_FUNCTION "*_mcount" -++#undef TARGET_OS_D_BUILTINS -++#define TARGET_OS_D_BUILTINS() \ -++ do \ -++ { \ -++ builtin_define ("linux"); \ -++ builtin_define ("Posix"); \ -++ if (OPTION_GLIBC) \ -++ builtin_define ("GNU_GLibc"); \ -++ } \ -++ while (0) - + --+#define TARGET_OS_D_BUILTINS() \ --+ do { \ --+ \ --+ builtin_define ("SysV4"); \ --+ builtin_define ("Posix"); \ --+ } while (0) -+ #undef CPP_OS_DEFAULT_SPEC -+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" -+ ---- a/src/gcc/d/target-ver-syms.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/target-ver-syms.sh 2014-04-01 16:32:51.000000000 +0100 -@@ -61,13 +61,37 @@ esac - - # In DMD, this is usually defined in the target's Makefile. - case "$d_os_versym" in --darwin) echo "#define TARGET_OSX 1" ;; --FreeBSD) echo "#define TARGET_FREEBSD 1" ;; --linux) echo "#define TARGET_LINUX 1" ;; --OpenBSD) echo "#define TARGET_OPENBSD 1" ;; --Solaris) echo "#define TARGET_SOLARIS 1" ;; --Win32) echo "#define TARGET_WINDOS 1" ;; --Win64) echo "#define TARGET_WINDOS 1" ;; --Android) echo "#define TARGET_ANDROID_D 1"; -- echo "#define TARGET_LINUX 1"; ;; -+darwin) -+ echo "#define TARGET_OSX 1" -+ echo "#define THREAD_LIBRARY \"\"" -+ echo "#define TIME_LIBRARY \"\"" -+ ;; -+FreeBSD) -+ echo "#define TARGET_FREEBSD 1" -+ ;; -+linux) -+ echo "#define TARGET_LINUX 1" -+ ;; -+OpenBSD) -+ echo "#define TARGET_OPENBSD 1" -+ ;; -+Solaris) -+ echo "#define TARGET_SOLARIS 1" -+ ;; -+Win32) -+ echo "#define TARGET_WINDOS 1" -+ echo "#define THREAD_LIBRARY \"\"" -+ echo "#define TIME_LIBRARY \"\"" -+ ;; -+Win64) -+ echo "#define TARGET_WINDOS 1" -+ echo "#define THREAD_LIBRARY \"\"" -+ echo "#define TIME_LIBRARY \"\"" -+ ;; -+Android) -+ echo "#define TARGET_ANDROID_D 1" -+ echo "#define TARGET_LINUX 1" -+ echo "#define THREAD_LIBRARY \"\"" -+ echo "#define TIME_LIBRARY \"\"" -+ ;; - esac ---- a/src/gcc/d/VERSION 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/d/VERSION 2014-04-01 16:32:51.000000000 +0100 -@@ -1 +1 @@ --"2.062" -+"2.064.2" ---- a/src/gcc/testsuite/gdc.test/compilable/compile1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/compile1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -218,9 +218,9 @@ static assert(!is(typeof(A!(int)))); - **************************************************/ - void bug6720() { } - --//static assert(!is(typeof( --//cast(bool)bug6720() --//))); -+static assert(!is(typeof( -+cast(bool)bug6720() -+))); - - /************************************************** - 1099 -@@ -397,3 +397,24 @@ void test9348() - assert(F!0 !is null); - assert(F!0 !in [new Object():1]); - } -+ -+ -+/***************************************************/ -+// 9987 -+ -+static if (is(object.ModuleInfo == struct)) -+{ -+ struct ModuleInfo {} -+ -+ static assert(!is(object.ModuleInfo == ModuleInfo)); -+ static assert(object.ModuleInfo.sizeof != ModuleInfo.sizeof); -+} -+static if (is(object.ModuleInfo == class)) -+{ -+ class ModuleInfo {} -+ -+ static assert(!is(object.ModuleInfo == ModuleInfo)); -+ static assert(__traits(classInstanceSize, object.ModuleInfo) != -+ __traits(classInstanceSize, ModuleInfo)); -+} -+ ---- a/src/gcc/testsuite/gdc.test/compilable/cppmangle.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/cppmangle.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,268 @@ -+ -+// Test C++ name mangling. -+// See Bugs 4059, 5148, 7024, 10058 -+ -+version(linux): -+ -+import std.c.stdio; -+ -+extern (C++) -+ int foob(int i, int j, int k); -+ -+class C -+{ -+ extern (C++) int bar(int i, int j, int k) -+ { -+ printf("this = %p\n", this); -+ printf("i = %d\n", i); -+ printf("j = %d\n", j); -+ printf("k = %d\n", k); -+ return 1; -+ } -+} -+ -+ -+extern (C++) -+ int foo(int i, int j, int k) -+{ -+ printf("i = %d\n", i); -+ printf("j = %d\n", j); -+ printf("k = %d\n", k); -+ assert(i == 1); -+ assert(j == 2); -+ assert(k == 3); -+ return 1; -+} -+ -+void test1() -+{ -+ foo(1, 2, 3); -+ -+ auto i = foob(1, 2, 3); -+ assert(i == 7); -+ -+ C c = new C(); -+ c.bar(4, 5, 6); -+} -+ -+static assert(foo.mangleof == "_Z3fooiii"); -+static assert(foob.mangleof == "_Z4foobiii"); -+static assert(C.bar.mangleof == "_ZN1C3barEiii"); -+ -+/****************************************/ -+ -+extern (C++) interface D -+{ -+ int bar(int i, int j, int k); -+} -+ -+extern (C++) D getD(); -+ -+void test2() -+{ -+ D d = getD(); -+ int i = d.bar(9,10,11); -+ assert(i == 8); -+} -+ -+static assert (getD.mangleof == "_Z4getDv"); -+static assert (D.bar.mangleof == "_ZN1D3barEiii"); -+ -+/****************************************/ -+ -+extern (C++) int callE(E); -+ -+extern (C++) interface E -+{ -+ int bar(int i, int j, int k); -+} -+ -+class F : E -+{ -+ extern (C++) int bar(int i, int j, int k) -+ { -+ printf("F.bar: i = %d\n", i); -+ printf("F.bar: j = %d\n", j); -+ printf("F.bar: k = %d\n", k); -+ assert(i == 11); -+ assert(j == 12); -+ assert(k == 13); -+ return 8; -+ } -+} -+ -+void test3() -+{ -+ F f = new F(); -+ int i = callE(f); -+ assert(i == 8); -+} -+ -+static assert (callE.mangleof == "_Z5callEP1E"); -+static assert (E.bar.mangleof == "_ZN1E3barEiii"); -+static assert (F.bar.mangleof == "_ZN1F3barEiii"); -+ -+/****************************************/ -+ -+extern (C++) void foo4(char* p); -+ -+void test4() -+{ -+ foo4(null); -+} -+ -+static assert(foo4.mangleof == "_Z4foo4Pc"); -+ -+/****************************************/ -+ -+extern(C++) -+{ -+ struct foo5 { int i; int j; void* p; } -+ -+ interface bar5{ -+ foo5 getFoo(int i); -+ } -+ -+ bar5 newBar(); -+} -+ -+void test5() -+{ -+ bar5 b = newBar(); -+ foo5 f = b.getFoo(4); -+ printf("f.p = %p, b = %p\n", f.p, cast(void*)b); -+ assert(f.p == cast(void*)b); -+} -+ -+static assert(bar5.getFoo.mangleof == "_ZN4bar56getFooEi"); -+static assert (newBar.mangleof == "_Z6newBarv"); -+ -+/****************************************/ -+ -+extern(C++) -+{ -+ struct S6 -+ { -+ int i; -+ double d; -+ } -+ S6 foo6(); -+} -+ -+extern (C) int foosize6(); -+ -+void test6() -+{ -+ S6 f = foo6(); -+ printf("%d %d\n", foosize6(), S6.sizeof); -+ assert(foosize6() == S6.sizeof); -+ assert(f.i == 42); -+ printf("f.d = %g\n", f.d); -+ assert(f.d == 2.5); -+} -+ -+static assert (foo6.mangleof == "_Z4foo6v"); -+ -+/****************************************/ -+ -+extern (C) int foo7(); -+ -+struct S -+{ -+ int i; -+ long l; -+} -+ -+void test7() -+{ -+ printf("%d %d\n", foo7(), S.sizeof); -+ assert(foo7() == S.sizeof); -+} -+ -+/****************************************/ -+ -+extern (C++) void foo8(const char *); -+ -+void test8() -+{ -+ char c; -+ foo8(&c); -+} -+ -+static assert(foo8.mangleof == "_Z4foo8PKc"); -+ -+/****************************************/ -+// 4059 -+ -+struct elem9 { } -+ -+extern(C++) void foobar9(elem9*, elem9*); -+ -+void test9() -+{ -+ elem9 *a; -+ foobar9(a, a); -+} -+ -+static assert(foobar9.mangleof == "_Z7foobar9P5elem9S0_"); -+ -+/****************************************/ -+// 5148 -+ -+extern (C++) -+{ -+ void foo10(const char*, const char*); -+ void foo10(const int, const int); -+ void foo10(const char, const char); -+ -+ struct MyStructType { } -+ void foo10(const MyStructType s, const MyStructType t); -+ -+ enum MyEnumType { onemember } -+ void foo10(const MyEnumType s, const MyEnumType t); -+} -+ -+void test10() -+{ -+ char* p; -+ foo10(p, p); -+ foo10(1,2); -+ foo10('c','d'); -+ MyStructType s; -+ foo10(s,s); -+ MyEnumType e; -+ foo10(e,e); -+} -+ -+/**************************************/ -+// 10058 -+ -+extern (C++) -+{ -+ void test10058a(void*) { } -+ void test10058b(void function(void*)) { } -+ void test10058c(void* function(void*)) { } -+ void test10058d(void function(void*), void*) { } -+ void test10058e(void* function(void*), void*) { } -+ void test10058f(void* function(void*), void* function(void*)) { } -+ void test10058g(void function(void*), void*, void*) { } -+ void test10058h(void* function(void*), void*, void*) { } -+ void test10058i(void* function(void*), void* function(void*), void*) { } -+ void test10058j(void* function(void*), void* function(void*), void* function(void*)) { } -+ void test10058k(void* function(void*), void* function(const (void)*)) { } -+ void test10058l(void* function(void*), void* function(const (void)*), const(void)* function(void*)) { } -+} -+ -+static assert(test10058a.mangleof == "_Z10test10058aPv"); -+static assert(test10058b.mangleof == "_Z10test10058bPFvPvE"); -+static assert(test10058c.mangleof == "_Z10test10058cPFPvS_E"); -+static assert(test10058d.mangleof == "_Z10test10058dPFvPvES_"); -+static assert(test10058e.mangleof == "_Z10test10058ePFPvS_ES_"); -+static assert(test10058f.mangleof == "_Z10test10058fPFPvS_ES1_"); -+static assert(test10058g.mangleof == "_Z10test10058gPFvPvES_S_"); -+static assert(test10058h.mangleof == "_Z10test10058hPFPvS_ES_S_"); -+static assert(test10058i.mangleof == "_Z10test10058iPFPvS_ES1_S_"); -+static assert(test10058j.mangleof == "_Z10test10058jPFPvS_ES1_S1_"); -+static assert(test10058k.mangleof == "_Z10test10058kPFPvS_EPFS_PKvE"); -+static assert(test10058l.mangleof == "_Z10test10058lPFPvS_EPFS_PKvEPFS3_S_E"); -+ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10236b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10236b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,69 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o- -+ -+/* -+TEST_OUTPUT: -+--- -+compilable/ddoc10236b.d(43): Warning: Ddoc: parameter count mismatch -+compilable/ddoc10236b.d(55): Warning: Ddoc: function declaration has no parameter 'y' -+compilable/ddoc10236b.d(67): Warning: Ddoc: function declaration has no parameter 'y' -+compilable/ddoc10236b.d(67): Warning: Ddoc: parameter count mismatch -+--- -+*/ -+ -+/*********************************** -+ * foo_good does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_good(int x)(int y) -+{ -+} -+ -+/*********************************** -+ * foo_good2 does this. -+ * Params: -+ * y = is for that -+ */ -+ -+void foo_good2(int x)(int y) -+{ -+} -+ -+/*********************************** -+ * foo_count_mismatch does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ */ -+ -+void foo_count_mismatch(int x)(int y) // Warning: Ddoc: parameter count mismatch -+{ -+} -+ -+/*********************************** -+ * foo_no_param_y does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_no_param_y(int x)(int z) // Warning: Ddoc: function declaration has no parameter 'y' -+{ -+} -+ -+/*********************************** -+ * foo_count_mismatch_no_param_y does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_count_mismatch_no_param_y(int x)() -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10236.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10236.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,59 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o- -+ -+/* -+TEST_OUTPUT: -+--- -+compilable/ddoc10236.d(33): Warning: Ddoc: parameter count mismatch -+compilable/ddoc10236.d(45): Warning: Ddoc: function declaration has no parameter 'y' -+compilable/ddoc10236.d(57): Warning: Ddoc: function declaration has no parameter 'y' -+compilable/ddoc10236.d(57): Warning: Ddoc: parameter count mismatch -+--- -+*/ -+ -+/*********************************** -+ * foo_good does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_good(int x, int y) -+{ -+} -+ -+/*********************************** -+ * foo_count_mismatch does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ */ -+ -+void foo_count_mismatch(int x, int y) // Warning: Ddoc: parameter count mismatch -+{ -+} -+ -+/*********************************** -+ * foo_no_param_y does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_no_param_y(int x, int z) // Warning: Ddoc: function declaration has no parameter 'y' -+{ -+} -+ -+/*********************************** -+ * foo_count_mismatch_no_param_y does this. -+ * Params: -+ * x = is for this -+ * and not for that -+ * y = is for that -+ */ -+ -+void foo_count_mismatch_no_param_y(int x) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10325.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10325.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,17 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10325 -+ -+module ddoc10325; -+ -+/** */ -+template templ(T...) -+ if (someConstraint!T) -+{ -+} -+ -+/** */ -+void foo(T)(T t) -+ if (someConstraint!T) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10334.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10334.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,29 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10334 -+ -+module ddoc10334; -+ -+template Foo10334(T) if (Bar10334!()) {} /// -+template Foo10334(T) if (Bar10334!100) {} /// -+template Foo10334(T) if (Bar10334!3.14) {} /// -+template Foo10334(T) if (Bar10334!"str") {} /// -+template Foo10334(T) if (Bar10334!1.4i) {} /// -+template Foo10334(T) if (Bar10334!null) {} /// -+template Foo10334(T) if (Bar10334!true) {} /// -+template Foo10334(T) if (Bar10334!false) {} /// -+template Foo10334(T) if (Bar10334!'A') {} /// -+template Foo10334(T) if (Bar10334!int) {} /// -+template Foo10334(T) if (Bar10334!string) {} /// -+template Foo10334(T) if (Bar10334!([1,2,3])) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!())) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!T)) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!100)) {} /// -+template Foo10334(T) if (Bar10334!(.foo)) {} /// -+template Foo10334(T) if (Bar10334!(const int)) {} /// -+template Foo10334(T) if (Bar10334!(shared T)) {} /// -+ -+template Test10334(T...) {} /// -+mixin Test10334!int a; /// -+mixin Test10334!(int,long) b; /// -+mixin Test10334!"str" c; /// ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10367.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10367.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,28 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10367 -+// REQUIRED_ARGS: -m32 -+// EXTRA_SOURCES: extra-files/ddoc10367.ddoc -+ -+module ddoc10367; -+ -+/// A -+enum A -+{ -+ a = 1, /// a -+ b = 2 /// b -+} -+ -+/// B -+enum B : long -+{ -+ a = 1, /// a -+ b = 2 /// b -+} -+ -+/// C -+enum C : string -+{ -+ a = "a", /// a -+ b = "b" /// b -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10869.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10869.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,27 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10869 -+ -+module ddoc10869; -+ -+/// -+class C -+{ -+ const -+ { -+ /// -+ void c1Foo() const { } -+ -+ /// -+ void i1Foo() immutable { } -+ } -+ -+ immutable -+ { -+ /// -+ void c2Foo() const { } -+ -+ /// -+ void i2Foo() immutable { } -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10870.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10870.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10870 -+ -+/// -+interface I -+{ -+ /// -+ void f(); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc10.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc10.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 10 - - // 294 ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc11.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc11.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 11 - - /// The various floating point exceptions ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc12.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc12.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 12 - - int ruhred; /// This documents correctly. ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc13.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc13.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 13 - - /// struct doc ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc14.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc14.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 14 - - ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,10 +1,10 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 1 - // REQUIRED_ARGS: -d - - /** This module is for ABC -- * Copyright: Copyright © $(YEAR) -+ * Copyright: Copyright © - */ - - module abc; -@@ -22,7 +22,7 @@ typedef int mytypedefint; - * #include <stdio.h> - * void main() - * { -- * printf("hello\n"); -+ * printf("hello\n"); - * } - * ----- - * Copyright: 1998 ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc2273.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc2273.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 2273 - // REQUIRED_ARGS: -m32 - ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc2630.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc2630.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,138 +0,0 @@ --// PERMUTE_ARGS: --// REQUIRED_ARGS: -D -w -o- -c -Ddtest_results/compilable -o- --// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 2630 -- --module ddoc2630; -- --//~ /// foo function - 1 example --int foo(int a, int b) { return a + b; } -- --/// --unittest --{ -- assert(foo(1, 1) == 2); --} -- --/// bar function - 1 example --bool bar() { return true; } -- --/// --unittest --{ -- // documented -- assert(bar()); --} -- --/// no code --unittest --{ --} -- --/// doo function - no examples --void doo() { } -- --/// --private unittest --{ -- // undocumented -- doo(); --} -- --unittest --{ -- // undocumented -- doo(); --} -- --/** --add function - 3 examples -- --Example: -- ------ --assert(add(1, 1) == 2); ------ --*/ --int add(int a, int b) { return a + b; } -- --/// --unittest --{ -- // documented -- assert(add(3, 3) == 6); -- assert(add(4, 4) == 8); --} -- --unittest --{ -- // undocumented -- assert(add(2, 2) + add(2, 2) == 8); --} -- --/// --unittest --{ -- // documented -- assert(add(5, 5) == 10); -- assert(add(6, 6) == 12); --} -- --/// class Foo --immutable pure nothrow class Foo --{ -- int x; -- -- /// -- unittest -- { -- // another foo example -- Foo foo = new Foo; -- } --} -- --/// --unittest --{ -- Foo foo = new Foo; --} -- --pure --{ -- const -- { -- immutable -- { -- /// some class -- class SomeClass {} -- } -- } --} -- --/// --unittest --{ -- SomeClass sc = new SomeClass; --} -- --/// Outer --class Outer --{ -- /// Inner -- static class Inner -- { -- } -- -- /// -- unittest -- { -- Inner inner = new Inner; -- } --} -- --/// --unittest --{ -- Outer outer = new Outer; --} -- --void main() { } ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 2 - - /** ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc3.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc3.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - // EXTRA_SOURCES: extra-files/ddoc3.ddoc - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 3 - - /** ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc4162.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc4162.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 4162 - - /// ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc4899.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc4899.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -w -o- -+ -+/* -+TEST_OUTPUT: -+--- -+compilable/ddoc4899.d(16): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN) instead for unpaired left parentheses. -+compilable/ddoc4899.d(16): Warning: Ddoc: Stray ')'. This may cause incorrect Ddoc output. Use $(RPAREN) instead for unpaired right parentheses. -+--- -+*/ -+ -+/++ -+ (See accompanying file LICENSE_1_0.txt or copy at -+ http://www.boost.org/LICENSE_1_0.txt) -++/ -+module d; -+ -+void main() -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc4.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc4.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 4 - - /** ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc5446a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc5446a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - module ddoc5446a; - - /** */ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc5446b.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc5446b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - module ddoc5446b; - - /** */ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc5446.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc5446.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 5446 - module ddoc5446; - import ddoc5446a; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc5.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc5.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 5 - - /** ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc6491.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc6491.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 6491 - - module ddoc6491; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc6.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc6.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 6 - - /** ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc7656.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc7656.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7656 -+ -+module ddoc7656; -+ -+/** -+-------- -+int x; // This is a $ comment (and here is some -+int y; // more information about that comment) -+-------- -+*/ -+void main() { } -+ -+ -+/** -+(Regression check) -+ -+Example: -+---- -+assert(add(1, 1) == 2); -+---- -+*/ -+int add(int a, int b) { return a + b; } ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc7715.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc7715.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7715 -+ -+module ddoc7656; -+ -+/** -+$1 $2 -+--- -+string s = "$1$2 $ $4"; -+--- -+*/ -+void foo(){} -+ -+/// -+void test(string a = ")") {} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc7795.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc7795.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7795 - - module ddoc7795; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc7.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc7.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 7 - - //----------------------------------------------- ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc8271.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc8271.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8271 - - module ddoc8271; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc8739.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc8739.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8739 - - module ddoc8739; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc8.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc8.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 8 - - /** foo */ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9037.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9037.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9037 - - module ddoc9037; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9155.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9155.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,80 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9155 -+ -+module ddoc9155; -+ -+/++ -+ + Note: -+ + test document note -+ + 2nd line -+ + Example: -+ + --- -+ + import std.stdio; //& -+ + writeln("Hello world!"); -+ + if (test) { -+ + writefln("D programming language"); -+ + } -+ + -+ + algorithm; -+ + -+ + xxx; //comment -+ + yyy; -+ + /* test -+ + * comment -+ + */ -+ + -+ + // Create MIME Base64 with CRLF, per line 76. -+ +File f = File("./text.txt", "r"); -+ +uint line = 0; -+ + // The ElementType of data is not aggregation type -+ +foreach (encoded; Base64.encoder(data)) -+ + --- -+ +/ -+ -+/** -+ -------------------------------------------------------- -+ wstring ws; -+ transcode("hello world",ws); -+ // transcode from UTF-8 to UTF-16 -+ -------------------------------------------------------- -+ */ -+ -+/** -+ * Example: -+ * --- -+ * import std.stdio; //& -+ * writeln("Hello world!"); -+ * if (test) { -+ * writefln("D programming language"); -+ * } -+ * -+ * algorithm; -+ * -+ * xxx; //comment -+ * yyy; -+ * /+ test -+ * + comment -+ * +/ -+ * --- -+ */ -+ -+/** -+---- -+#!/usr/bin/env rdmd -+// Computes average line length for standard input. -+import std.stdio; -+---- -+*/ -+/** -+ --- -+ writefln(q"EOS -+ This -+ is a multi-line -+ heredoc string -+ EOS" -+ ); -+ --- -+*/ -+ -+void foo(){} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9305.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9305.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9305 - - module ddoc9305; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9369.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9369.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,18 @@ -+// PERMUTE_ARGS: -+// EXTRA_SOURCES: /extra-files/ddoc9369.ddoc -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9369 -+ -+/** -+Sample: -+--- -+a=1; -+writeln(&a); -+! -+? -+--- -+*/ -+void foo() { } -+ -+ -+ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9475.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9475.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,29 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9475 -+ -+module ddoc9475; -+ -+/// foo -+void foo() { } -+ -+/// -+unittest -+{ -+ // comment 1 -+ foreach (i; 0 .. 10) -+ { -+ // comment 2 -+ documentedFunction(); -+ } -+} -+ -+/// bar -+void bar() { } -+ -+/// -+unittest -+{ -+ // bar comment -+} -+ ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9676a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9676a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// PERMUTE_ARGS: -+// EXTRA_SOURCES: /extra-files/ddoc9676a.ddoc -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9676a -+ -+module ddoc9676a; -+ -+/// -+deprecated void foo() {} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9676b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9676b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9676b -+ -+module ddoc9676b; -+ -+/// -+deprecated void foo() {} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9727.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9727.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9727 -+module ddoc9727; -+ -+/** The function foo. */ -+void foo(int x); -+ -+/** */ -+unittest -+{ -+ foo(1); -+} -+ -+/** foo can be used like this: */ -+unittest -+{ -+ foo(2); -+} -+ -+/** foo can also be used like this: */ -+unittest -+{ -+ foo(3); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9789.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9789.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9789 -+ -+module ddoc9789; -+ -+/// -+struct S {} -+ -+/// -+alias A = S; ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9903.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9903.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,35 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9903 -+ -+/// sss -+struct S9903X {} -+/// Ditto -+struct S9903Y {} -+ -+/// ccc -+class C9903X {} -+/// Ditto -+class C9903Y {} -+ -+/// uuu -+union U9903X {} -+/// Ditto -+union U9903Y {} -+ -+/// iii -+interface I9903X {} -+/// Ditto -+interface I9903Y {} -+ -+/// eee -+enum E9903X { a } -+/// Ditto -+enum E9903Y { a } -+ -+/// -+enum { -+ a9903, /// ea -+ b9903, /// Ditto -+ c9903, /// ec -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ddoc9.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddoc9.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -D -Ddtest_results/compilable -o- -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- - // POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9 - - // 273 ---- a/src/gcc/testsuite/gdc.test/compilable/ddocunittest.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddocunittest.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,293 @@ -+// PERMUTE_ARGS: -unittest -+// REQUIRED_ARGS: -D -w -o- -c -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh unittest -+ -+module ddocunittest; -+ -+/* Insert test-cases for documented unittests feature here. */ -+ -+/// foo function - 1 example -+int foo(int a, int b) { return a + b; } -+ -+/// -+unittest -+{ -+ assert(foo(1, 1) == 2); -+} -+ -+/// bar function - 1 example -+bool bar() { return true; } -+ -+/// -+unittest -+{ -+ // documented -+ assert(bar()); -+} -+ -+/// placeholder -+unittest -+{ -+} -+ -+/// doo function - no examples -+void doo() { } -+ -+/// -+private unittest -+{ -+ // undocumented -+ doo(); -+} -+ -+unittest -+{ -+ // undocumented -+ doo(); -+} -+ -+/** -+add function - 3 examples -+ -+Examples: -+ -+---- -+assert(add(1, 1) == 2); -+---- -+*/ -+int add(int a, int b) { return a + b; } -+ -+/// -+unittest -+{ -+ // documented -+ assert(add(3, 3) == 6); -+ assert(add(4, 4) == 8); -+} -+ -+unittest -+{ -+ // undocumented -+ assert(add(2, 2) + add(2, 2) == 8); -+} -+ -+/// -+unittest -+{ -+ // documented -+ assert(add(5, 5) == 10); -+ assert(add(6, 6) == 12); -+} -+ -+/// class Foo -+immutable pure nothrow class Foo -+{ -+ int x; -+ -+ /// -+ unittest -+ { -+ // another foo example -+ Foo foo = new Foo; -+ } -+} -+ -+/// -+unittest -+{ -+ Foo foo = new Foo; -+} -+ -+pure -+{ -+ const -+ { -+ immutable -+ { -+ /// some class - 1 example -+ class SomeClass {} -+ } -+ } -+} -+ -+/// -+unittest -+{ -+ SomeClass sc = new SomeClass; -+} -+ -+/// Outer - 1 example -+class Outer -+{ -+ /// Inner -+ static class Inner -+ { -+ } -+ -+ /// -+ unittest -+ { -+ Inner inner = new Inner; -+ } -+} -+ -+/// -+unittest -+{ -+ Outer outer = new Outer; -+} -+ -+/** foobar - no examples */ -+void foobar() -+{ -+} -+ -+unittest -+{ -+ foobar(); -+} -+ -+/** -+func - 4 examples -+Examples: -+--- -+foo(1); -+--- -+ -+Examples: -+--- -+foo(2); -+--- -+*/ -+void foo(int x) { } -+ -+/// -+unittest -+{ -+ foo(2); -+} -+ -+/// -+unittest -+{ -+ foo(4); -+} -+ -+// ------------------------------------ -+// 9474 -+ -+/// -+void foo9474() { } -+ -+version(none) -+unittest { } -+ -+/// Example -+unittest { foo9474(); } -+ -+/// doc -+void bar9474() { } -+ -+version(none) -+unittest { } -+ -+/// Example -+unittest { bar9474(); } -+ -+/// -+struct S9474 -+{ -+} -+/// -+unittest { S9474 s; } -+ -+/// -+auto autovar9474 = 1; -+/// -+unittest { int v = autovar9474; } -+ -+/// -+auto autofun9474() { return 1; } -+/// -+ unittest { int n = autofun9474(); } -+ -+/// -+template Template9474() -+{ -+ /// Shouldn't link following unittest to here -+ void foo() {} -+} -+/// -+unittest { alias Template9474!() T; } -+ -+// ------------------------------------ -+// 9713 -+ -+/// -+void fooNoDescription() {} -+/// -+unittest { fooNoDescription(); } -+/// -+unittest { if (true) {fooNoDescription(); } /* comment */ } -+ -+// ------------------------------------ -+ -+/// test for bugzilla 9757 -+void foo9757() {} -+/// ditto -+void bar9757() {} -+/// ditto -+void baz9757() {} -+/// -+unittest { foo9757(); bar9757(); } -+/// -+unittest { bar9757(); foo9757(); } -+ -+/// with template functions -+auto redBlackTree(E)(E[] elems...) -+{ -+ return 1; -+} -+/// ditto -+auto redBlackTree(bool allowDuplicates, E)(E[] elems...) -+{ -+ return 2; -+} -+/// ditto -+auto redBlackTree(alias less, E)(E[] elems...) -+{ -+ return 3; -+} -+/// -+unittest -+{ -+ auto rbt1 = redBlackTree(0, 1, 5, 7); -+ auto rbt2 = redBlackTree!string("hello", "world"); -+ auto rbt3 = redBlackTree!true(0, 1, 5, 7, 5); -+ auto rbt4 = redBlackTree!"a > b"(0, 1, 5, 7); -+} -+ -+// ------------------------------------ -+// Issue 9758 -+ -+/// test -+void foo(){} -+ -+/// -+unittest { } -+ -+// ------------------------------------ -+// Issue 10519 -+ -+/// -+bool balancedParens10519(string, char, char) { return true; } -+/// -+unittest -+{ -+ auto s = "1 + (2 * (3 + 1 / 2)"; -+ assert(!balancedParens10519(s, '(', ')')); -+} -+ -+// ------------------------------------ -+ -+void main() { } ---- a/src/gcc/testsuite/gdc.test/compilable/ddocYear.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ddocYear.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o- -+// POST_SCRIPT: compilable/extra-files/ddocYear-postscript.sh -+ -+/// $(YEAR) -+int year; ---- a/src/gcc/testsuite/gdc.test/compilable/depsOutput9948.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/depsOutput9948.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -deps=${RESULTS_DIR}/compilable/depsOutput9948.deps -+// POST_SCRIPT: compilable/extra-files/depsOutput.sh -+// EXTRA_SOURCES: /extra-files/depsOutput9948a.d -+ -+module depsOutput9948; -+import depsOutput9948a; -+ -+void main() -+{ -+ templateFunc!("import std.string;")(); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/diag10768.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/diag10768.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,42 @@ -+// PERMUTE_ARGS: -+/* -+TEST_OUTPUT: -+--- -+compilable/diag10768.d(36): Deprecation: overriding base class function without using override attribute is deprecated (diag10768.Foo.frop overrides diag10768.Frop.frop) -+--- -+*/ -+ -+struct CirBuff(T) -+{ -+ import std.traits: isArray; -+ CirBuff!T opAssign(R)(R) if (isArray!R) -+ {} -+ -+ T[] toArray() -+ { -+ T[] ret; // = new T[this.length]; -+ return ret; -+ } -+ alias toArray this; -+} -+ -+class Bar(T=int) -+{ -+ CirBuff!T _bar; -+} -+ -+class Once -+{ -+ Bar!Foo _foobar; -+} -+ -+class Foo : Frop -+{ -+ // override -+ public int frop() { return 1; } -+} -+ -+class Frop -+{ -+ public int frop() { return 0; } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10367.ddoc 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10367.ddoc 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+DDOC_ENUM_BASETYPE = $(RED $0) ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc10.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,132 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc10</title> -- </head><body> -- <h1>ddoc10</h1> --<br><br> --<dl><dt><big><a name="Foo"></a>struct <u>Foo</u>(T); --<br><a name="Foo"></a>struct <u>Foo</u>(T, U); --</big></dt> --<dd>The foo<br><br> -- --</dd> --<dt><big><a name="func1"></a>int <u>func1</u>(T)(T <i>x</i>); --</big></dt> --<dd>This basic case doesn't work very well. The template signature is -- documented twice, but the function signature (argument names and return -- type) is not documented at all. This comment is also repeated twice. <br><br> -- --</dd> --<dt><big><a name="func2"></a>int <u>func2</u>(T, U)(T <i>x</i>, U <i>y</i>); --<br><a name="func2"></a>int <u>func2</u>(T)(T <i>x</i>); --</big></dt> --<dd>This comment is also repeated twice, and the second function signature is -- not very well documented. <br><br> -- --</dd> --<dt><big><a name="func3"></a>int <u>func3</u>(T, U)(T <i>x</i>, U <i>y</i>); --<br><a name="func3"></a>int <u>func3</u>(T, U = int, V : long)(T <i>x</i>); --</big></dt> --<dd>This used to work adequately and documented both <u>func3</u> templates -- simultaneously. Now, it documents the first template twice and -- no longer documents the function argument and return types.<br><br> -- --</dd> --<dt><big><a name="map"></a>void <u>map</u>(char <i>rs</i>); --<br><a name="map"></a>void <u>map</u>(int <i>rs</i>); --</big></dt> --<dd>blah<br><br> -- --</dd> --<dt><big><a name="map2"></a>void <u>map2</u>()(char <i>rs</i>); --<br><a name="map2"></a>void <u>map2</u>()(int <i>rs</i>); --</big></dt> --<dd>blah<br><br> -- --</dd> --<dt><big><a name="map3"></a>void <u>map3</u>(char <i>rs</i>); --</big></dt> --<dd>blah http://www.map3.com <u>map3</u><br><br> -- --</dd> --<dt><big><a name="map4"></a>void <u>map4</u>(string s)(char <i>rs</i>); --</big></dt> --<dd>blah http://www.map.com map<br><br> -- --</dd> --<dt><big><a name="map5"></a>template <u>map5</u>(string s)</big></dt> --<dd>blah http://www.map.com map<br><br> -- --</dd> --<dt><big><a name="bar6"></a>struct <u>bar6</u>; --</big></dt> --<dd>blah <br><br> -- --</dd> --<dt><big><a name="Foo7"></a>struct <u>Foo7</u>(T); --</big></dt> --<dd>template bodies <br><br> -- --<dl><dt><big><a name="bar"></a>void <u>bar</u>(); --</big></dt> --<dd>Attempt two: Inside. --Attempt one: Doc outside static if.<br><br> -- --</dd> --<dt><big><a name="abc"></a>void <u>abc</u>(); --</big></dt> --<dd>the <u>abc</u> function should be static <br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="Foo8"></a>abstract class <u>Foo8</u>; --</big></dt> --<dd>show abstract <br><br> -- --</dd> --<dt><big><a name="bug4878"></a>void <u>bug4878</u>(string <i>a</i> = ")"); --</big></dt> --<dd><i>a</i> stray ) mustn't foul the macros<br><br> -- --</dd> --<dt><big><a name="S"></a>struct <u>S</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="S.this"></a>const pure nothrow this(long <i>ticks</i>); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="S.foo"></a>const pure nothrow void <u>foo</u>(long <i>ticks</i>); --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --<dt><big><a name="f10"></a>float <u>f10</u>(float <i>a</i>, float <i>b</i>); --</big></dt> --<dd>Produces something in (<i>a</i>;<i>b</i>] <br><br> -- --</dd> --<dt><big><a name="h10"></a>float <u>h10</u>(float <i>a</i>, float <i>b</i>); --</big></dt> --<dd>Produces something in [<i>a</i>;<i>b</i>) <br><br> -- --</dd> --<dt><big><a name="bug6090"></a>void <u>bug6090</u>(string f = "$(B b)", char g = ')')(string <i>h</i> = "$(", string <i>i</i> = "$)"); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="T"></a>struct <u>T</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="T.this"></a> this(A...)(A <i>args</i>); --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc11.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc11.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,91 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc11</title> -- </head><body> -- <h1>ddoc11</h1> --<br><br> --<dl><dt><big><a name="FE_INVALID"></a><u>FE_INVALID</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_DENORMAL"></a><u>FE_DENORMAL</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_DIVBYZERO"></a><u>FE_DIVBYZERO</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_OVERFLOW"></a><u>FE_OVERFLOW</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_UNDERFLOW"></a><u>FE_UNDERFLOW</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_INEXACT"></a><u>FE_INEXACT</u></big></dt> --<dd><br><br> --</dd> --<dt><big><a name="FE_ALL_EXCEPT"></a><u>FE_ALL_EXCEPT</u></big></dt> --<dd>Mask of all the exceptions<br><br> -- --</dd> --<dt><big><a name="bar"></a>myint <u>bar</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="foo"></a>myint <u>foo</u>(myint <i>x</i> = (int).max); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Foo"></a>class <u>Foo</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="Foo.this"></a> this(string <i>s</i>); --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --<dt><big><a name="div_t"></a>struct <u>div_t</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="ldiv_t"></a>struct <u>ldiv_t</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="lldiv_t"></a>struct <u>lldiv_t</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="div"></a>div_t <u>div</u>(int, int); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="ldiv"></a>ldiv_t <u>ldiv</u>(int, int); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="lldiv"></a>lldiv_t <u>lldiv</u>(long, long); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="calloc"></a>void* <u>calloc</u>(size_t, size_t); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="malloc"></a>void* <u>malloc</u>(size_t); --</big></dt> --<dd>dittx<br><br> -- --</dd> --<dt><big><a name="test1"></a>void <u>test1</u>(); --</big></dt> --<dd><b>Example:</b><br> --<pre class="d_code"><font color=blue>private</font>: -- <font color=blue>int</font> i = 0; --</pre> --<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc12.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc12.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,36 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc12</title> -- </head><body> -- <h1>ddoc12</h1> --<br><br> --<dl><dt><big><a name="ruhred"></a>int <u>ruhred</u>; --</big></dt> --<dd>This documents correctly.<br><br> -- --</dd> --<dt><big><a name="rühred"></a>int <u>rühred</u>; --</big></dt> --<dd>This should too<br><br> -- --</dd> --<dt><big><a name="foo"></a>int <u>foo</u>(int <i>ü</i>, int <i>ş</i>, int <i>ğ</i>); --</big></dt> --<dd><b>BUG:</b><br> --The parameters are not listed under Params in the generated output -- --<br><br> --<b>Params:</b><br> --<table><tr><td>int <i>ü</i></td> --<td>first</td></tr> --<tr><td>int <i>ş</i></td> --<td>second</td></tr> --<tr><td>int <i>ğ</i></td> --<td>third</td></tr> --</table><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc13.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc13.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,50 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc13</title> -- </head><body> -- <h1>ddoc13</h1> --<br><br> --<dl><dt><big><a name="Bug4107"></a>struct <u>Bug4107</u>(T); --</big></dt> --<dd>struct doc<br><br> -- --<dl><dt><big><a name="foo"></a>void <u>foo</u>(U)(U <i>u</i>); --</big></dt> --<dd>templated function doc<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="Bug4107b"></a>struct <u>Bug4107b</u>(T); --</big></dt> --<dd>alpha<br><br> -- --<dl><dt><big><a name="B"></a>struct <u>B</u>(U); --</big></dt> --<dd>beta<br><br> -- --<dl><dt><big><a name="C"></a>struct <u>C</u>(V); --</big></dt> --<dd>gamma<br><br> -- --<dl><dt><big><a name="D"></a>struct <u>D</u>(W); --</big></dt> --<dd>delta<br><br> -- --<dl><dt><big><a name="e"></a>B!(W) <u>e</u>(X)(C!(V) <i>c</i>, X[] <i>x</i>...); --</big></dt> --<dd>epsilon<br><br> -- --</dd> --</dl> --</dd> --</dl> --</dd> --</dl> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc14.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc14.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,157 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc14</title> -- </head><body> -- <h1>ddoc14</h1> --<br><br> --<dl><dt><big><a name="Structure"></a>struct <u>Structure</u>; --</big></dt> --<dd>-1<br><br> -- --<dl><dt><big><a name="Structure.variable"></a>P <u>variable</u>; --</big></dt> --<dd>0<br><br> -- --</dd> --<dt><big><a name="Structure.mNone"></a>V <u>mNone</u>(lazy P <i>p</i>); --</big></dt> --<dd>1<br><br> -- --</dd> --<dt><big><a name="Structure.mPrefix"></a>pure nothrow V <u>mPrefix</u>(lazy P <i>p</i>); --</big></dt> --<dd>2<br><br> -- --</dd> --<dt><big><a name="Structure.mSuffix"></a>pure nothrow V <u>mSuffix</u>(lazy P <i>p</i>); --</big></dt> --<dd>3<br><br> -- --</dd> --<dt><big><a name="Structure.mSuffixTemplate"></a>pure nothrow V <u>mSuffixTemplate</u>(T)(lazy P <i>p</i>, T[] <i>t</i>...); --</big></dt> --<dd>5<br><br> -- --</dd> --<dt><big><a name="Structure.mScoped"></a>pure nothrow V <u>mScoped</u>(lazy P <i>p</i>); --</big></dt> --<dd>6<br><br> -- --</dd> --<dt><big><a name="Structure.mAutoPrefix"></a>pure nothrow auto <u>mAutoPrefix</u>(ref P <i>p</i>); --</big></dt> --<dd>7<br><br> -- --</dd> --<dt><big><a name="Structure.mAutoTemplateSuffix"></a>pure nothrow auto <u>mAutoTemplateSuffix</u>(alias T)(ref T <i>t</i>); --</big></dt> --<dd>9<br><br> -- --</dd> --<dt><big><a name="Structure.mColon"></a>pure nothrow V <u>mColon</u>(lazy P <i>p</i>); --</big></dt> --<dd>10<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="Class"></a>class <u>Class</u>; --</big></dt> --<dd>-1<br><br> -- --<dl><dt><big><a name="Class.variable"></a>P <u>variable</u>; --</big></dt> --<dd>0<br><br> -- --</dd> --<dt><big><a name="Class.mNone"></a>V <u>mNone</u>(lazy P <i>p</i>); --</big></dt> --<dd>1<br><br> -- --</dd> --<dt><big><a name="Class.mPrefix"></a>pure nothrow V <u>mPrefix</u>(lazy P <i>p</i>); --</big></dt> --<dd>2<br><br> -- --</dd> --<dt><big><a name="Class.mSuffix"></a>pure nothrow V <u>mSuffix</u>(lazy P <i>p</i>); --</big></dt> --<dd>3<br><br> -- --</dd> --<dt><big><a name="Class.mSuffixTemplate"></a>pure nothrow V <u>mSuffixTemplate</u>(T)(lazy P <i>p</i>, T[] <i>t</i>...); --</big></dt> --<dd>5<br><br> -- --</dd> --<dt><big><a name="Class.mScoped"></a>pure nothrow V <u>mScoped</u>(lazy P <i>p</i>); --</big></dt> --<dd>6<br><br> -- --</dd> --<dt><big><a name="Class.mAutoPrefix"></a>pure nothrow auto <u>mAutoPrefix</u>(ref P <i>p</i>); --</big></dt> --<dd>7<br><br> -- --</dd> --<dt><big><a name="Class.mAutoTemplateSuffix"></a>pure nothrow auto <u>mAutoTemplateSuffix</u>(alias T)(ref T <i>t</i>); --</big></dt> --<dd>9<br><br> -- --</dd> --<dt><big><a name="Class.mColon"></a>pure nothrow V <u>mColon</u>(lazy P <i>p</i>); --</big></dt> --<dd>10<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="variable"></a>P <u>variable</u>; --</big></dt> --<dd>0<br><br> -- --</dd> --<dt><big><a name="mNone"></a>V <u>mNone</u>(lazy P <i>p</i>); --</big></dt> --<dd>1<br><br> -- --</dd> --<dt><big><a name="mPrefix"></a>pure nothrow V <u>mPrefix</u>(lazy P <i>p</i>); --</big></dt> --<dd>2<br><br> -- --</dd> --<dt><big><a name="mSuffix"></a>pure nothrow V <u>mSuffix</u>(lazy P <i>p</i>); --</big></dt> --<dd>3<br><br> -- --</dd> --<dt><big><a name="mSuffixTemplate"></a>pure nothrow V <u>mSuffixTemplate</u>(T)(lazy P <i>p</i>, T[] <i>t</i>...); --</big></dt> --<dd>5<br><br> -- --</dd> --<dt><big><a name="mScoped"></a>pure nothrow V <u>mScoped</u>(lazy P <i>p</i>); --</big></dt> --<dd>6<br><br> -- --</dd> --<dt><big><a name="mAutoPrefix"></a>pure nothrow auto <u>mAutoPrefix</u>(ref P <i>p</i>); --</big></dt> --<dd>7<br><br> -- --</dd> --<dt><big><a name="mAutoTemplateSuffix"></a>pure nothrow auto <u>mAutoTemplateSuffix</u>(alias T)(ref T <i>t</i>); --</big></dt> --<dd>9<br><br> -- --</dd> --<dt><big><a name="mColon"></a>pure nothrow V <u>mColon</u>(lazy P <i>p</i>); --</big></dt> --<dd>10<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc1.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc1.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,115 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>abc</title> -- </head><body> -- <h1>abc</h1> --This module is for ABC --<br><br> -- --<dl><dt><big><a name="myint"></a>alias int <u>myint</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="f"></a>myint <u>f</u>; --</big></dt> --<dd>windy -- city --<br><br> --paragraph 2 about of F --<pre class="d_code"> #include <stdio.h> -- <font color=blue>void</font> main() -- { -- printf(<font color=red>"hello\n"</font>); -- } --</pre> --<br><br> --<b>Copyright:</b><br> --1998<br><br> -- --</dd> --<dt><big><a name="E"></a>enum <u>E</u>; --</big></dt> --<dd>comment1<br><br> -- --</dd> --<dt><big><a name="g"></a>int <u>g</u>; --</big></dt> --<dd>comment2<br><br> -- --</dd> --<dt><big><a name="LS"></a>wchar <u>LS</u>; --</big></dt> --<dd>UTF line separator<br><br> -- --</dd> --<dt><big><a name="PS"></a>wchar <u>PS</u>; --<br><a name="_XX"></a>wchar <u>_XX</u>; --<br><a name="YY"></a>wchar <u>YY</u>; --</big></dt> --<dd>UTF paragraph separator<br><br> -- --</dd> --<dt><big><a name="foo"></a>int <u>foo</u>(char <i>c</i>, int <i>argulid</i>, char <i>u</i>); --</big></dt> --<dd>Function <u>foo</u> takes argument <i>c</i> and adds it to <i>argulid</i>. --<br><br> --Then it munges <i>argulid</i>, <i>u</i> <u>underline</u>. <!-- c, argulid, b --> --<br><br> --<b>Params:</b><br> --<table><tr><td>char <i>c</i></td> --<td>the character which adds <i>c</i> to <i>argulid</i></td></tr> --<tr><td>int <i>argulid</i></td> --<td>the argument</td></tr> --<tr><td>char <i>u</i></td> --<td>the other argument</td></tr> --</table><br> -- --</dd> --<dt><big><a name="barr"></a>int <u>barr</u>(); --</big></dt> --<dd>doc for <u>barr</u>()<br><br> -- --</dd> --<dt><big><a name="Bar"></a>class <u>Bar</u>; --</big></dt> --<dd>The Class <u>Bar</u> <br><br> -- --<dl><dt><big><a name="Bar.x"></a>int <u>x</u>; --</big></dt> --<dd>member X<br><br> -- --</dd> --<dt><big><a name="Bar.y"></a>int <u>y</u>; --</big></dt> --<dd>member Y<br><br> -- --</dd> --<dt><big><a name="Bar.z"></a>protected int <u>z</u>; --</big></dt> --<dd>member Z<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="Easy"></a>enum <u>Easy</u>; --</big></dt> --<dd>The Enum <u>Easy</u> <br><br> -- --<dl><dt><big><a name="Easy.red"></a><u>red</u></big></dt> --<dd>the Red<br><br> -- --</dd> --<dt><big><a name="Easy.blue"></a><u>blue</u></big></dt> --<dd>the Blue<br><br> -- --</dd> --<dt><big><a name="Easy.green"></a><u>green</u></big></dt> --<dd>the Green<br><br> -- --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. Copyright © 2013</small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2273.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2273.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,37 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc2273</title> -- </head><body> -- <h1>ddoc2273</h1> --<br><br> --<dl><dt><big><a name="B"></a>interface <u>B</u>: ddoc2273.C, ddoc2273.D; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Foo"></a>class <u>Foo</u>: ddoc2273.A, ddoc2273.B; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="min"></a>MinType!(T1, T2, T) <u>min</u>(T1, T2, T...)(T1 <i>a</i>, T2 <i>b</i>, T <i>xs</i>); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="max"></a>Templ!([1, 2, 3]) <u>max</u>(T...)(); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Base64Impl"></a>template <u>Base64Impl</u>(char Map62th, char Map63th, char Padding)</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="sqlite3_config"></a>int <u>sqlite3_config</u>(int, ...); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="IndexOf"></a>alias staticIndexOf(T, TList...) <u>IndexOf</u>; --</big></dt> --<dd><br><br> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2630.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2630.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,60 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc2630</title> -- </head><body> -- <h1>ddoc2630</h1> --<br><br> --<dl><dt><big><a name="bar"></a>bool <u>bar</u>(); --</big></dt> --<dd><u>bar</u> function - 1 example<br><br> --<b>Example:</b><pre class="d_code"><font color=blue>assert</font>(<u>bar</u>()); --</pre><br><br> --</dd> --<dt><big><a name="doo"></a>void <u>doo</u>(); --</big></dt> --<dd><u>doo</u> function - no examples<br><br> -- --</dd> --<dt><big><a name="add"></a>int <u>add</u>(int <i>a</i>, int <i>b</i>); --</big></dt> --<dd><u>add</u> function - 3 examples --<br><br> --<b>Example:</b><br> --<pre class="d_code"><font color=blue>assert</font>(<u>add</u>(1, 1) == 2); --</pre> --<br><br> --<b>Example:</b><pre class="d_code"><font color=blue>assert</font>(<u>add</u>(3, 3) == 6); --<font color=blue>assert</font>(<u>add</u>(4, 4) == 8); --</pre><pre class="d_code"><font color=blue>assert</font>(<u>add</u>(5, 5) == 10); --<font color=blue>assert</font>(<u>add</u>(6, 6) == 12); --</pre><br><br> --</dd> --<dt><big><a name="Foo"></a>class <u>Foo</u>; --</big></dt> --<dd>class <u>Foo</u><br><br> --<b>Example:</b><pre class="d_code"><u>Foo</u> foo = <font color=blue>new</font> <u>Foo</u>; --</pre><br><br> --</dd> --<dt><big><a name="SomeClass"></a>class <u>SomeClass</u>; --</big></dt> --<dd>some class<br><br> --<b>Example:</b><pre class="d_code"><u>SomeClass</u> sc = <font color=blue>new</font> <u>SomeClass</u>; --</pre><br><br> --</dd> --<dt><big><a name="Outer"></a>class <u>Outer</u>; --</big></dt> --<dd><u>Outer</u><br><br> --<b>Example:</b><pre class="d_code"><u>Outer</u> outer = <font color=blue>new</font> <u>Outer</u>; --</pre><br><br> --<dl><dt><big><a name="Outer.Inner"></a>class <u>Inner</u>; --</big></dt> --<dd><u>Inner</u><br><br> --<b>Example:</b><pre class="d_code"><u>Inner</u> inner = <font color=blue>new</font> <u>Inner</u>; --</pre><br><br> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc2.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,51 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>std.test</title> -- </head><body> -- <h1>std.test</h1> --Summary --<br><br> --Description1 --<br><br> -- -- Description2 --<br><br> -- -- Description3 -- --<br><br> --<b>See Also:</b><br> --Things to see also. --<br><br> -- -- And more things.<br><br> -- --<dl><dt><big><a name="StreamException"></a>class <u>StreamException</u>: object.Exception; --</big></dt> --<dd>A base class for stream exceptions.<br><br> -- --<dl><dt><big><a name="StreamException.this"></a> this(string <i>msg</i>, int <i>foo</i>); --</big></dt> --<dd>Construct a StreamException with given error message <i>msg</i>. --<br><br> --<b>Params:</b><br> --<table><tr><td>string <i>msg</i></td> --<td>the <font color=red>red</font> <font color=blue>blue</font> <font color=green>green</font> <font color=yellow>yellow</font>.</td></tr> --<tr><td>int <i>foo</i></td> --<td>next parameter which is a much longer -- message spanning multiple -- lines.</td></tr> --</table><br> -- --</dd> --<dt><big><a name="StreamException.stars"></a>int <u>stars</u>; --</big></dt> --<dd><u>stars</u> <br><br> -- --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc3.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc3.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,71 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>std.test</title> -- </head><body> -- <h1>std.test</h1> --Summary --<br><br> --Description1 --<br><br> -- -- Description2 --<br><br> -- -- Description3 -- --<br><br> --<b>See Also:</b><br> --Things to see also. --<br><br> -- -- And more things <br> -- 'arg1, arg2, arg3' : arg1, arg2, arg3. <br> -- 'arg2, arg3' : arg2, arg3. <br> -- 'arg1' : arg1. <br> -- 'arg2' : arg2. <br> -- 'arg3' : arg3. <br> -- --<br><br> -- -- Things to see also world. --<br><br> -- -- <table><tr><td>1</td> <td>2</td> <td>3</td> </tr> -- <tr><td>4</td> <td>5</td> <td>6</td> </tr> -- </table> --<br><br> -- -- <pre class="d_code"> <b>pragma</b>( <i>name</i> ); -- <b>pragma</b>( <i>name</i> , <i>option</i> [ <i>option</i> ] ); -- <u>(</u> -- </pre><br><br> -- --<dl><dt><big><a name="StreamException"></a>class <u>StreamException</u>: object.Exception; --</big></dt> --<dd>A base class for stream exceptions.<br><br> -- --<dl><dt><big><a name="StreamException.this"></a> this(string <i>msg</i>, int <i>foo</i>); --</big></dt> --<dd>Construct a StreamException with given error message <i>msg</i>. --<br><br> --<b>Params:</b><br> --<table><tr><td>string <i>msg</i></td> --<td>the <font color=red>red</font> <font color=blue>blue</font> <font color=green>green</font> <font color=yellow>yellow</font>.</td></tr> --<tr><td>int <i>foo</i></td> --<td>next parameter which is a much longer -- message spanning multiple -- lines.</td></tr> --</table><br> -- --</dd> --<dt><big><a name="StreamException.stars"></a>int <u>stars</u>; --</big></dt> --<dd><u>stars</u> <br><br> -- --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc4162.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc4162.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,23 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc4162</title> -- </head><body> -- <h1>ddoc4162</h1> --<br><br> --<dl><dt><big><a name="A"></a>abstract interface <u>A</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="A.staticHello"></a>static void <u>staticHello</u>(); --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="A.hello"></a>final void <u>hello</u>(); --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc4.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc4.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,9 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc4</title> -- </head><body> -- <h1>ddoc4</h1> --<br><br> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc5446.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc5446.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,84 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc5446</title> -- </head><body> -- <h1>ddoc5446</h1> --<br><br> --<dl><dt><big><a name="This_Foo"></a>alias ddoc5446a.A_Foo <u>This_Foo</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="This_Foo_Alias"></a>alias ddoc5446a.A_Foo <u>This_Foo_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="This_Int"></a>alias int <u>This_Int</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="This_Enum"></a>alias ddoc5446a.A_Enum <u>This_Enum</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="A_Enum_New"></a>deprecated alias ddoc5446b.<u>A_Enum_New</u> <u>A_Enum_New</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar"></a>struct <u>Bar</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="Bar.Bar_A_Foo"></a>alias ddoc5446a.A_Foo <u>Bar_A_Foo</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Bar_A_Foo_Alias"></a>alias ddoc5446a.A_Foo <u>Bar_A_Foo_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Bar_A_Int"></a>alias int <u>Bar_A_Int</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Bar_This_Foo"></a>alias ddoc5446a.A_Foo <u>Bar_This_Foo</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Bar_This_Foo_Alias"></a>alias ddoc5446a.A_Foo <u>Bar_This_Foo_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Bar_This_Int"></a>alias int <u>Bar_This_Int</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Nested_Alias"></a>alias Nested <u>Nested_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Fake_Nested"></a>alias .Nested <u>Fake_Nested</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Nested"></a>struct <u>Nested</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="Bar.Nested.Bar_Nested_Bar_Alias"></a>alias Bar <u>Bar_Nested_Bar_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Nested.Bar_Alias"></a>alias .Bar <u>Bar_Alias</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="Bar.Nested.Bar"></a>struct <u>Bar</u>; --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc5.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc5.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,28 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>test</title> -- </head><body> -- <h1>test</h1> --Test module --<br><br> -- --<dl><dt><big><a name="TestMembers"></a>class <u>TestMembers</u>(TemplateArg); --</big></dt> --<dd>class to test DDOC on members<br><br> -- --<dl><dt><big><a name="PublicStaticMethod"></a>void <u>PublicStaticMethod</u>(int <i>idx</i>); --</big></dt> --<dd>a static method --<br><br> --<b>Params:</b><br> --<table><tr><td>int <i>idx</i></td> --<td>index</td></tr> --</table><br> -- --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc6491.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc6491.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,15 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc6491</title> -- </head><body> -- <h1>ddoc6491</h1> --<br><br> --<dl><dt><big><a name="bug6491a"></a>void <u>bug6491a</u>(int <i>a</i> = ddoc6491.c6491, string <i>b</i> = core.cpuid.vendor); --</big></dt> --<dd>test<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc6.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc6.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,14 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc6</title> -- </head><body> -- <h1>ddoc6</h1> --<br><br> --<dl><dt><big><a name="MyStruct"></a>struct <u>MyStruct</u>(T); --</big></dt> --<dd><br><br> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc7795.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc7795.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,19 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc7795</title> -- </head><body> -- <h1>ddoc7795</h1> --<br><br> --<dl><dt><big><a name="DateTime"></a>struct <u>DateTime</u>; --</big></dt> --<dd><br><br> --<dl><dt><big><a name="DateTime.this"></a> this(TimeValue <i>t</i> = TimeValue(0, 0)); --</big></dt> --<dd><br><br> --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc7.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc7.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,101 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc7</title> -- </head><body> -- <h1>ddoc7</h1> --<br><br> --<dl><dt><big><a name="E1"></a>enum <u>E1</u>; --</big></dt> --<dd>my enum<br><br> -- --<dl><dt><big><a name="E1.A"></a><u>A</u></big></dt> --<dd>element a<br><br> -- --</dd> --<dt><big><a name="E1.B"></a><u>B</u></big></dt> --<dd>element b<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="E2"></a>enum <u>E2</u>; --</big></dt> --<dd>my enum<br><br> -- --<dl><dt><big><a name="E2.A"></a><u>A</u></big></dt> --<dd>element a<br><br> -- --</dd> --<dt><big><a name="E2.B"></a><u>B</u></big></dt> --<dd>element b<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="E3"></a>enum <u>E3</u>; --</big></dt> --<dd>my enum<br><br> -- --<dl><dt><big><a name="E3.A"></a><u>A</u></big></dt> --<dd>element a<br><br> -- --</dd> --<dt><big><a name="E3.B"></a><u>B</u></big></dt> --<dd>element b<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="E4"></a>enum <u>E4</u>; --</big></dt> --<dd>my enum<br><br> -- --<dl><dt><big><a name="E4.A"></a><u>A</u></big></dt> --<dd>element a<br><br> -- --</dd> --<dt><big><a name="E4.B"></a><u>B</u></big></dt> --<dd>element b<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="E5"></a>enum <u>E5</u>; --</big></dt> --<dd>my enum<br><br> -- --<dl><dt><big><a name="E5.A"></a><u>A</u></big></dt> --<dd>element a<br><br> -- --</dd> --<dt><big><a name="E5.B"></a><u>B</u></big></dt> --<dd>element b<br><br> -- --</dd> --</dl> --</dd> --<dt><big><a name="foo"></a>void <u>foo</u>(); --</big></dt> --<dd>Some doc<br><br> -- --</dd> --<dt><big><a name="bar"></a>alias foo <u>bar</u>; --</big></dt> --<dd>More doc<br><br> -- --</dd> --<dt><big><a name="C"></a>abstract class <u>C</u>; --</big></dt> --<dd>asdf<br><br> -- --<dl><dt><big><a name="C.foo"></a>abstract void <u>foo</u>(); --</big></dt> --<dd>Some doc<br><br> -- --</dd> --</dl> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8271.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8271.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,16 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc8271</title> -- </head><body> -- <h1>ddoc8271</h1> --<br><br> --<dl><dt><big><a name="ddoc8271"></a>void <u>ddoc8271</u>(); --</big></dt> --<dd>Macro --<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8739.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8739.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,26 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc8739</title> -- </head><body> -- <h1>ddoc8739</h1> --<br><br> --<dl><dt><big><a name="dg"></a>void delegate(int a) <u>dg</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="dg2"></a>void delegate(int b) <u>dg2</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="dg3"></a>void delegate(int c)[] <u>dg3</u>; --</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="dg4"></a>void delegate(int d)* <u>dg4</u>; --</big></dt> --<dd><br><br> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc8.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,15 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc8</title> -- </head><body> -- <h1>ddoc8</h1> --<br><br> --<dl><dt><big><a name="Foo"></a>class <u>Foo</u>(T): Bar; --</big></dt> --<dd>foo <br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9037.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9037.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,20 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc9037</title> -- </head><body> -- <h1>ddoc9037</h1> --<br><br> --<dl><dt><big><a name="test9037"></a>void <u>test9037</u>(); --</big></dt> --<dd><b>Example:</b><br> --<pre class="d_code">D d = d; --</pre> --<pre class="d_code">D d = d; --</pre> --<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9305.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9305.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,66 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc9305</title> -- </head><body> -- <h1>ddoc9305</h1> --<br><br> --<dl><dt><big><a name="foo"></a>void <u>foo</u>(alias p = (a) => a)(); --</big></dt> --<dd><u>foo</u>()<br><br> -- --</dd> --<dt><big><a name="X"></a>template <u>X</u>(alias pred = (x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = (x) --{ --int y; --return y; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = (int x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = (int x) --{ --int y; --return y; --} --)</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="X"></a>template <u>X</u>(alias pred = function (x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = function (x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = function (int x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = function (int x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = function int(x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = function int(x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = function int(int x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = function int(int x) --{ --return x + 1; --} --)</big></dt> --<dd><br><br> --</dd> --<dt><big><a name="X"></a>template <u>X</u>(alias pred = delegate (x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = delegate (x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = delegate (int x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = delegate (int x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = delegate int(x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = delegate int(x) --{ --return x + 1; --} --)<br><a name="X"></a>template <u>X</u>(alias pred = delegate int(int x) => x)<br><a name="X"></a>template <u>X</u>(alias pred = delegate int(int x) --{ --return x + 1; --} --)</big></dt> --<dd><br><br> --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9369.ddoc 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9369.ddoc 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+ESCAPES = /&/AddressOf!/ -+ /!/Exclamation/ -+ /?/QuestionMark/ ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9676a.ddoc 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9676a.ddoc 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+DEPRECATED = <del>$0</del> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9764.dd 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9764.dd 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+Ddoc -+ -+Check ddoc9764 document. -+---- -+// Check ddoc9764 comment. -+ddoc9764(); -+---- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9.html 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddoc9.html 1970-01-01 01:00:00.000000000 +0100 -@@ -1,34 +0,0 @@ --<html><head> -- <META http-equiv="content-type" content="text/html; charset=utf-8"> -- <title>ddoc9</title> -- </head><body> -- <h1>ddoc9</h1> --<br><br> --<dl><dt><big><a name="Template"></a>template <u>Template</u>(T)</big></dt> --<dd><u>Template</u> Documentation (OK)<br><br> -- --</dd> --<dt><big><a name="Function"></a>void <u>Function</u>(T)(T <i>x</i>); --</big></dt> --<dd><u>Function</u> Documentation (Not included at all by DDoc)<br><br> -- --</dd> --<dt><big><a name="Class"></a>class <u>Class</u>(T); --</big></dt> --<dd><u>Class</u> Documentation (OK)<br><br> -- --</dd> --<dt><big><a name="Struct"></a>struct <u>Struct</u>(T); --</big></dt> --<dd><u>Struct</u> Documentation<br><br> -- --</dd> --<dt><big><a name="Union"></a>union <u>Union</u>(T); --</big></dt> --<dd><u>Union</u> Documentation<br><br> -- --</dd> --</dl> -- -- <hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small> -- </body></html> ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/ddocAny-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/ddocAny-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --GREP_OPTIONS= grep -v "Generated by Ddoc from" ${RESULTS_DIR}/compilable/ddoc$1.html > ${RESULTS_DIR}/compilable/ddoc$1.html.2 --diff --strip-trailing-cr compilable/extra-files/ddoc$1.html ${RESULTS_DIR}/compilable/ddoc$1.html.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/ddoc$1.html{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/depsOutput9948a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/depsOutput9948a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module depsOutput9948a; -+ -+void templateFunc(string myImport)() -+{ -+ mixin(myImport); -+} -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/header.di 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/header.di 2014-04-01 16:32:51.000000000 +0100 -@@ -3,10 +3,31 @@ import core.vararg; - import std.stdio; - pragma (lib, "test"); - pragma (msg, "Hello World"); -+static assert(true, "message"); - typedef double mydbl = 10; - int main(); -+struct S -+{ -+ int m; -+ int n; -+} - template Foo(T, int V) - { -+ void foo(...) -+ { -+ static if (is(Object _ : X!TL, alias X, TL...)) -+ { -+ } -+ -+ auto x = __traits(hasMember, Object, "noMember"); -+ auto y = is(Object : X!TL, alias X, TL...); -+ assert(!x && !y, "message"); -+ S s = {1, 2}; -+ auto a = [1, 2, 3]; -+ auto aa = [1:1, 2:2, 3:3]; -+ int n, m; -+ } -+ - int bar(double d, int x) - { - if (d) -@@ -23,13 +44,11 @@ template Foo(T, int V) - d = d + 1; - } - } -+ for (int i = 0; -+ i < 10; i++) - { -- for (int i = 0; -- i < 10; i++) - { -- { -- d = i ? d + 1 : 5; -- } -+ d = i ? d + 1 : 5; - } - } - char[] s; -@@ -122,6 +141,12 @@ interface iFoo - class xFoo : iFoo - { - } -+interface iFoo2 -+{ -+} -+class xFoo2 : iFoo, iFoo2 -+{ -+} - class Foo3 - { - this(int a, ...); -@@ -165,17 +190,17 @@ class Test - template A(T) - { - } -- alias A!(uint) getHUint; -- alias A!(int) getHInt; -- alias A!(float) getHFloat; -- alias A!(ulong) getHUlong; -- alias A!(long) getHLong; -- alias A!(double) getHDouble; -- alias A!(byte) getHByte; -- alias A!(ubyte) getHUbyte; -- alias A!(short) getHShort; -- alias A!(ushort) getHUShort; -- alias A!(real) getHReal; -+ alias A!uint getHUint; -+ alias A!int getHInt; -+ alias A!float getHFloat; -+ alias A!ulong getHUlong; -+ alias A!long getHLong; -+ alias A!double getHDouble; -+ alias A!byte getHByte; -+ alias A!ubyte getHUbyte; -+ alias A!short getHShort; -+ alias A!ushort getHUShort; -+ alias A!real getHReal; - } - template templ(T) - { -@@ -185,7 +210,7 @@ template templ(T) - } - - } --static char[] charArray = ['"','\'']; -+static char[] charArray = ['"', '\'']; - - class Point - { -@@ -196,7 +221,7 @@ template Foo2(bool bar) - { - void test() - { -- static if(bar) -+ static if (bar) - { - int i; - } -@@ -204,7 +229,7 @@ template Foo2(bool bar) - { - } - -- static if(!bar) -+ static if (!bar) - { - } - else -@@ -221,9 +246,13 @@ template Foo4() - } - - } -+template Foo4x(T...) -+{ -+} - class Baz4 - { - mixin Foo4!() foo; -+ mixin Foo4x!(int, "str") foox; - alias foo.bar baz; - } - template test(T) -@@ -263,11 +292,9 @@ template V10(T) - { - void func() - { -+ for (int i, j = 4; i < 3; i++) - { -- for (int i,j = 4; i < 3; i++) - { -- { -- } - } - } - } -@@ -326,3 +353,74 @@ template foo6591() - } - - } -+version (unittest) -+{ -+ nothrow pure {} -+ nothrow pure {} -+ public {} -+ extern (C) {} -+ align{} -+} -+template Foo10334(T) if (Bar10334!()) -+{ -+} -+template Foo10334(T) if (Bar10334!100) -+{ -+} -+template Foo10334(T) if (Bar10334!3.14) -+{ -+} -+template Foo10334(T) if (Bar10334!"str") -+{ -+} -+template Foo10334(T) if (Bar10334!1.4i) -+{ -+} -+template Foo10334(T) if (Bar10334!null) -+{ -+} -+template Foo10334(T) if (Bar10334!true) -+{ -+} -+template Foo10334(T) if (Bar10334!false) -+{ -+} -+template Foo10334(T) if (Bar10334!'A') -+{ -+} -+template Foo10334(T) if (Bar10334!int) -+{ -+} -+template Foo10334(T) if (Bar10334!string) -+{ -+} -+template Foo10334(T) if (Bar10334!this) -+{ -+} -+template Foo10334(T) if (Bar10334!([1, 2, 3])) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!())) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!T)) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!100)) -+{ -+} -+template Foo10334(T) if (Bar10334!(.foo)) -+{ -+} -+template Foo10334(T) if (Bar10334!(const(int))) -+{ -+} -+template Foo10334(T) if (Bar10334!(shared(T))) -+{ -+} -+template Test10334(T...) -+{ -+} -+mixin Test10334!int a; -+mixin Test10334!(int, long) b; -+mixin Test10334!"str" c; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/header-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/header-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "D import file generated from" ${RESULTS_DIR}/compilable/header.di > ${RESULTS_DIR}/compilable/header.di.2 --diff --strip-trailing-cr compilable/extra-files/header.di ${RESULTS_DIR}/compilable/header.di.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/header.di{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/inlineheader.di 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/inlineheader.di 2014-04-01 16:32:51.000000000 +0100 -@@ -3,6 +3,7 @@ import core.vararg; - import std.stdio; - pragma (lib, "test"); - pragma (msg, "Hello World"); -+static assert(true, "message"); - typedef double mydbl = 10; - int main() - in -@@ -24,8 +25,28 @@ body - return 0; - } - -+struct S -+{ -+ int m; -+ int n; -+} - template Foo(T, int V) - { -+ void foo(...) -+ { -+ static if (is(Object _ : X!TL, alias X, TL...)) -+ { -+ } -+ -+ auto x = __traits(hasMember, Object, "noMember"); -+ auto y = is(Object : X!TL, alias X, TL...); -+ assert(!x && !y, "message"); -+ S s = {1, 2}; -+ auto a = [1, 2, 3]; -+ auto aa = [1:1, 2:2, 3:3]; -+ int n, m; -+ } -+ - int bar(double d, int x) - { - if (d) -@@ -42,13 +63,11 @@ template Foo(T, int V) - d = d + 1; - } - } -+ for (int i = 0; -+ i < 10; i++) - { -- for (int i = 0; -- i < 10; i++) - { -- { -- d = i ? d + 1 : 5; -- } -+ d = i ? d + 1 : 5; - } - } - char[] s; -@@ -159,6 +178,12 @@ interface iFoo - class xFoo : iFoo - { - } -+interface iFoo2 -+{ -+} -+class xFoo2 : iFoo, iFoo2 -+{ -+} - class Foo3 - { - this(int a, ...) -@@ -301,17 +326,17 @@ class Test - template A(T) - { - } -- alias A!(uint) getHUint; -- alias A!(int) getHInt; -- alias A!(float) getHFloat; -- alias A!(ulong) getHUlong; -- alias A!(long) getHLong; -- alias A!(double) getHDouble; -- alias A!(byte) getHByte; -- alias A!(ubyte) getHUbyte; -- alias A!(short) getHShort; -- alias A!(ushort) getHUShort; -- alias A!(real) getHReal; -+ alias A!uint getHUint; -+ alias A!int getHInt; -+ alias A!float getHFloat; -+ alias A!ulong getHUlong; -+ alias A!long getHLong; -+ alias A!double getHDouble; -+ alias A!byte getHByte; -+ alias A!ubyte getHUbyte; -+ alias A!short getHShort; -+ alias A!ushort getHUShort; -+ alias A!real getHReal; - } - template templ(T) - { -@@ -321,7 +346,7 @@ template templ(T) - } - - } --static char[] charArray = ['"','\'']; -+static char[] charArray = ['"', '\'']; - - class Point - { -@@ -332,7 +357,7 @@ template Foo2(bool bar) - { - void test() - { -- static if(bar) -+ static if (bar) - { - int i; - } -@@ -340,7 +365,7 @@ template Foo2(bool bar) - { - } - -- static if(!bar) -+ static if (!bar) - { - } - else -@@ -357,9 +382,13 @@ template Foo4() - } - - } -+template Foo4x(T...) -+{ -+} - class Baz4 - { - mixin Foo4!() foo; -+ mixin Foo4x!(int, "str") foox; - alias foo.bar baz; - } - template test(T) -@@ -407,11 +436,9 @@ template V10(T) - { - void func() - { -+ for (int i, j = 4; i < 3; i++) - { -- for (int i,j = 4; i < 3; i++) - { -- { -- } - } - } - } -@@ -488,3 +515,66 @@ template foo6591() - } - - } -+template Foo10334(T) if (Bar10334!()) -+{ -+} -+template Foo10334(T) if (Bar10334!100) -+{ -+} -+template Foo10334(T) if (Bar10334!3.14) -+{ -+} -+template Foo10334(T) if (Bar10334!"str") -+{ -+} -+template Foo10334(T) if (Bar10334!1.4i) -+{ -+} -+template Foo10334(T) if (Bar10334!null) -+{ -+} -+template Foo10334(T) if (Bar10334!true) -+{ -+} -+template Foo10334(T) if (Bar10334!false) -+{ -+} -+template Foo10334(T) if (Bar10334!'A') -+{ -+} -+template Foo10334(T) if (Bar10334!int) -+{ -+} -+template Foo10334(T) if (Bar10334!string) -+{ -+} -+template Foo10334(T) if (Bar10334!this) -+{ -+} -+template Foo10334(T) if (Bar10334!([1, 2, 3])) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!())) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!T)) -+{ -+} -+template Foo10334(T) if (Bar10334!(Baz10334!100)) -+{ -+} -+template Foo10334(T) if (Bar10334!(.foo)) -+{ -+} -+template Foo10334(T) if (Bar10334!(const(int))) -+{ -+} -+template Foo10334(T) if (Bar10334!(shared(T))) -+{ -+} -+template Test10334(T...) -+{ -+} -+mixin Test10334!int a; -+mixin Test10334!(int, long) b; -+mixin Test10334!"str" c; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/inlineheader-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/inlineheader-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "D import file generated from" ${RESULTS_DIR}/compilable/inlineheader.di > ${RESULTS_DIR}/compilable/inlineheader.di.2 --diff --strip-trailing-cr compilable/extra-files/inlineheader.di ${RESULTS_DIR}/compilable/inlineheader.di.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/inlineheader.di{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/inlinexheader-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/inlinexheader-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "D import file generated from" ${RESULTS_DIR}/compilable/inlinexheader.di > ${RESULTS_DIR}/compilable/inlinexheader.di.2 --diff --strip-trailing-cr compilable/extra-files/inlinexheader.di ${RESULTS_DIR}/compilable/inlinexheader.di.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/inlinexheader.di{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/json.out 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/json.out 2014-04-01 16:32:51.000000000 +0100 -@@ -38,8 +38,8 @@ - }, - { - "kind" : "template", -- "name" : "Foo(T)", - "line" : 16, -+ "name" : "Foo", - "parameters" : [ - { - "name" : "T", -@@ -64,8 +64,8 @@ - }, - { - "kind" : "template", -- "name" : "Bar(int T)", - "line" : 17, -+ "name" : "Bar", - "parameters" : [ - { - "name" : "T", -@@ -92,8 +92,8 @@ - }, - { - "kind" : "template", -- "name" : "Baz(T...)", - "line" : 18, -+ "name" : "Baz", - "parameters" : [ - { - "name" : "T", -@@ -118,8 +118,8 @@ - }, - { - "kind" : "template", -- "name" : "P(alias T)", - "line" : 20, -+ "name" : "P", - "parameters" : [ - { - "name" : "T", -@@ -142,6 +142,7 @@ - "kind" : "constructor", - "line" : 23, - "deco" : "FZC4json4Bar2", -+ "originalType" : "()", - "endline" : 23 - }, - { -@@ -205,6 +206,7 @@ - "kind" : "constructor", - "line" : 33, - "deco" : "FiZC4json4Bar3", -+ "originalType" : "(int i)", - "parameters" : [ - { - "name" : "i", -@@ -343,6 +345,117 @@ - "kind" : "import", - "line" : 80, - "protection" : "private" -+ }, -+ { -+ "name" : "S", -+ "kind" : "struct", -+ "line" : 82, -+ "members" : [ -+ { -+ "kind" : "template", -+ "line" : 85, -+ "name" : "this", -+ "parameters" : [ -+ { -+ "name" : "T", -+ "kind" : "type" -+ } -+ ], -+ "members" : [ -+ { -+ "name" : "this", -+ "kind" : "constructor", -+ "line" : 85, -+ "type" : "(T t)", -+ "parameters" : [ -+ { -+ "name" : "t", -+ "type" : "T" -+ } -+ ], -+ "endline" : 85 -+ } -+ ] -+ } -+ ] -+ }, -+ { -+ "kind" : "template", -+ "protection" : "private", -+ "line" : 89, -+ "name" : "S1_9755", -+ "parameters" : [ -+ { -+ "name" : "T", -+ "kind" : "type" -+ } -+ ], -+ "members" : [ -+ { -+ "name" : "S1_9755", -+ "kind" : "struct", -+ "line" : 89, -+ "members" : [] -+ } -+ ] -+ }, -+ { -+ "kind" : "template", -+ "protection" : "package", -+ "line" : 90, -+ "name" : "S2_9755", -+ "parameters" : [ -+ { -+ "name" : "T", -+ "kind" : "type" -+ } -+ ], -+ "members" : [ -+ { -+ "name" : "S2_9755", -+ "kind" : "struct", -+ "line" : 90, -+ "members" : [] -+ } -+ ] -+ }, -+ { -+ "name" : "C_9755", -+ "kind" : "class", -+ "line" : 92, -+ "members" : [ -+ { -+ "kind" : "template", -+ "protection" : "protected", -+ "line" : 94, -+ "name" : "CI_9755", -+ "parameters" : [ -+ { -+ "name" : "T", -+ "kind" : "type" -+ } -+ ], -+ "members" : [ -+ { -+ "name" : "CI_9755", -+ "kind" : "class", -+ "line" : 94, -+ "members" : [] -+ } -+ ] -+ } -+ ] -+ }, -+ { -+ "name" : "c_10011", -+ "kind" : "variable", -+ "line" : 98, -+ "storageClass" : [ -+ "const" -+ ], -+ "deco" : "xC6Object", -+ "originalType" : "Object", -+ "init" : "Object()" - } - ] - } ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/json-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/json-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "\"file\" : " ${RESULTS_DIR}/compilable/json.out | grep -v "\"offset\" : " > ${RESULTS_DIR}/compilable/json.out.2 --diff --strip-trailing-cr compilable/extra-files/json.out ${RESULTS_DIR}/compilable/json.out.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/json.out{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/common.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/common.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module pkgDIP37.datetime.common; -+ -+void def(); ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37/datetime/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module pkgDIP37.datetime; -+public import pkgDIP37.datetime.common; -+//alias std.datetime.common.def def; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/liba.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/liba.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module pkgDIP37_10302.liba; -+void foo() {} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/libb.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/libb.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+module pkgDIP37_10302.libb; -+import pkgDIP37_10302.liba; -+void bar() -+{ -+ foo(); -+ -+ // should be error, but unfortunately this works by bug 314 now. -+ //lib.foo(); -+ -+ pkgDIP37_10302.liba.foo(); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10302/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module pkgDIP37_10302; -+public import pkgDIP37_10302.liba; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mbar.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mbar.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module pkgDIP37_10354.mbar; -+void bar(T)() {} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mfoo.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/mfoo.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module pkgDIP37_10354.mfoo; -+void foo(T)() {} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10354/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module pkgDIP37_10354; -+public import pkgDIP37_10354.mfoo; -+public import pkgDIP37_10354.mbar; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/mod.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/mod.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+module pkgDIP37_10421.algo.mod; -+import pkgDIP37_10421.algo; // foo -+import pkgDIP37_10421.except; // baz -+void test() -+{ -+ foo(); // should be accessible -+ baz(); // should be accessible -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/algo/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+module pkgDIP37_10421.algo; -+public import pkgDIP37_10421.algo.mod; -+package -+{ -+ void foo() {} -+ void bar() { foo(); } // should be accessible -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/except.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/pkgDIP37_10421/except.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module pkgDIP37_10421.except; -+ -+package void baz() {} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+module a; -+import tmpl; -+TypeInfo fun() { return typeid(Tmpl!int()); } -+ ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+module b; -+import tmpl; -+TypeInfo fun() { return typeid(Tmpl!long()); } -+ ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/main.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/main.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+import a, b; -+void main() { -+ auto t1 = a.fun(); -+ auto t2 = b.fun(); -+ assert(t1 != t2); -+} -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/tmpl.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test6461/tmpl.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+module tmpl; -+struct Tmpl(T) { -+ T a; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test7754-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test7754-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "D import file generated from" ${RESULTS_DIR}/compilable/test7754.di > ${RESULTS_DIR}/compilable/test7754.di.2 --diff --strip-trailing-cr compilable/extra-files/test7754.di ${RESULTS_DIR}/compilable/test7754.di.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/test7754.di{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680dllmain.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680dllmain.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+import core.sys.windows.windows; -+extern (Windows) -+BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) -+{ -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680main.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680main.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+void main() { } ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680winmain.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/test9680winmain.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+import core.sys.windows.windows; -+extern(Windows) -+int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) -+{ -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/xheader.di 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/xheader.di 2014-04-01 16:32:51.000000000 +0100 -@@ -38,3 +38,4 @@ template C4(T) - T x; - } - } -+auto flit = 3 / 2.00000; ---- a/src/gcc/testsuite/gdc.test/compilable/extra-files/xheader-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/extra-files/xheader-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ --#!/usr/bin/env bash -- --grep -v "D import file generated from" ${RESULTS_DIR}/compilable/xheader.di > ${RESULTS_DIR}/compilable/xheader.di.2 --diff --strip-trailing-cr compilable/extra-files/xheader.di ${RESULTS_DIR}/compilable/xheader.di.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/compilable/xheader.di{,.2} -- ---- a/src/gcc/testsuite/gdc.test/compilable/fwdref10101.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/fwdref10101.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+// PERMUTE_ARGS: -+ -+int front(int); -+ -+mixin template reflectRange() -+{ -+ static if ( is( typeof(this.front) ) ) -+ { -+ int x; -+ } -+} -+ -+struct S(R) -+{ -+ R r_; -+ -+ typeof(r_.front) front() @property { return r_.front; } -+ -+ mixin reflectRange; -+} -+ -+void main() -+{ -+ S!(int) s; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/fwdref8609.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/fwdref8609.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+struct Tuple(T) { -+ T arg; -+} -+ -+struct Foo1 -+{ -+ Bar1 b; -+} -+struct Bar1 -+{ -+ int x; -+ Tuple!(Foo1) spam() { return Tuple!(Foo1)(); } -+} -+ -+struct Foo2 -+{ -+ Bar2 b; -+} -+struct Bar2 -+{ -+ int x; -+ Tuple!(Foo2[1]) spam() { return Tuple!(Foo2[1])(); } -+} -+ -+void main() {} ---- a/src/gcc/testsuite/gdc.test/compilable/fwdref8698a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/fwdref8698a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+interface IRoot {} -+ -+interface IClass : IRoot { } -+ -+struct Struct { } -+ -+class Class : IClass { alias Struct Value; } -+ -+void test(Class.Value) { } -+ -+//interface IRoot {} ---- a/src/gcc/testsuite/gdc.test/compilable/fwdref8698b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/fwdref8698b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+//interface IRoot {} -+ -+interface IClass : IRoot { } -+ -+struct Struct { } -+ -+class Class : IClass { alias Struct Value; } -+ -+void test(Class.Value) { } -+ -+interface IRoot {} ---- a/src/gcc/testsuite/gdc.test/compilable/gdc.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/gdc.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+import gcc.attribute; -+ -+/* Test all gdc supported attributes. */ -+ -+@attribute("forceinline") -+void forceinline() -+{ -+} -+ -+@attribute("noinline") -+void noinline() -+{ -+} -+ -+@attribute("flatten") -+void flatten() -+{ -+} -+ ---- a/src/gcc/testsuite/gdc.test/compilable/header.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/header.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: -dw --// REQUIRED_ARGS: -H -Hdtest_results/compilable -+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable - // POST_SCRIPT: compilable/extra-files/header-postscript.sh - // REQUIRED_ARGS: -d - -@@ -11,6 +11,8 @@ import std.stdio; - pragma(lib, "test"); - pragma(msg, "Hello World"); - -+static assert(true, "message"); -+ - typedef double mydbl = 10; - - int main() -@@ -33,9 +35,25 @@ body - return 0; - } - -+struct S { int m, n; } - - template Foo(T, int V) - { -+ void foo(...) -+ { -+ static if (is(Object _ : X!TL, alias X, TL...)) {} // Bugzilla 10044 -+ -+ auto x = __traits(hasMember, Object, "noMember"); -+ auto y = is(Object : X!TL, alias X, TL...); -+ assert(!x && !y, "message"); -+ -+ S s = { 1,2 }; -+ auto a = [1, 2, 3]; -+ auto aa = [1:1, 2:2, 3:3]; -+ -+ int n,m; -+ } -+ - int bar(double d, int x) - { - if (d) -@@ -148,6 +166,8 @@ static ~this() - interface iFoo{} - class xFoo: iFoo{} - -+interface iFoo2{} -+class xFoo2: iFoo, iFoo2{} - - class Foo3 - { -@@ -253,9 +273,12 @@ template Foo4() - } - } - -+template Foo4x( T... ) {} -+ - class Baz4 - { - mixin Foo4 foo; -+ mixin Foo4x!(int, "str") foox; - - alias foo.bar baz; - } -@@ -349,3 +372,42 @@ void foo6591()() - { - import std.stdio : writeln, F = File; - } -+ -+ -+// 8081 -+version(unittest) { -+ pure nothrow unittest {} -+ pure nothrow unittest {} -+ -+ public unittest {} -+ extern(C) unittest {} -+ align unittest {} -+} -+ -+ -+// 10334 -+ -+template Foo10334(T) if (Bar10334!()) {} /// -+template Foo10334(T) if (Bar10334!100) {} /// -+template Foo10334(T) if (Bar10334!3.14) {} /// -+template Foo10334(T) if (Bar10334!"str") {} /// -+template Foo10334(T) if (Bar10334!1.4i) {} /// -+template Foo10334(T) if (Bar10334!null) {} /// -+template Foo10334(T) if (Bar10334!true) {} /// -+template Foo10334(T) if (Bar10334!false) {} /// -+template Foo10334(T) if (Bar10334!'A') {} /// -+template Foo10334(T) if (Bar10334!int) {} /// -+template Foo10334(T) if (Bar10334!string) {} /// -+template Foo10334(T) if (Bar10334!this) {} /// -+template Foo10334(T) if (Bar10334!([1,2,3])) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!())) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!T)) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!100)) {} /// -+template Foo10334(T) if (Bar10334!(.foo)) {} /// -+template Foo10334(T) if (Bar10334!(const int)) {} /// -+template Foo10334(T) if (Bar10334!(shared T)) {} /// -+ -+template Test10334(T...) {} /// -+mixin Test10334!int a; /// -+mixin Test10334!(int,long) b; /// -+mixin Test10334!"str" c; /// ---- a/src/gcc/testsuite/gdc.test/compilable/ice10040.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice10040.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+struct MsgProc1 { mixin MsgMixin; } -+struct MsgProc2 { mixin MsgMixin; } -+ -+struct MsgHeader {} -+ -+template MsgMixin() -+{ -+ mixin(mixinMembers!(MsgHeader.init)); -+} -+ -+string mixinMembers(T ...)() -+{ -+ struct Op {} -+ return null; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ice10431a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice10431a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+mixin ADT!(); -+ -+struct Tuple(TL...) { TL expand; } -+ -+template Seq(T...) { alias T Seq; } -+ -+template ADT() -+{ -+ mixin(q{ -+ struct ListI -+ { -+ private -+ { -+ size_t tag; -+ union { Seq!(Tuple!()*, Tuple!(int,ListI,)*,) data; } -+ } -+ } -+ }); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ice10431b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice10431b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+struct X(alias Y) -+{ -+} -+ -+struct A -+{ -+ int[] data; -+} -+ -+alias X!(A([])) X1; -+alias X!(A([])) X2; ---- a/src/gcc/testsuite/gdc.test/compilable/ice10486.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice10486.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,5 @@ -+void main() -+{ -+ typeof(null) null_; -+ int[1] sarr = null_; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ice11054.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice11054.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+import imports.ice11054a; -+ -+static assert(!__traits(compiles, tuple())); -+ -+E[] appender(A : E, E)() -+{ -+ return E; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/ice9663.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/ice9663.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+// REQUIRED_ARGS: -wi -+ -+void main() -+{ -+ int[1] a; -+ int[] b = [1]; -+ -+ a = 1; -+ -+ b[] = a; -+ -+ b = a; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/ice11054a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/ice11054a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+template Tuple() -+{ -+ string injectNamedFields() -+ { -+ formatNthX(); -+ return ""; -+ } -+} -+Tuple!T tuple(T...)() -+{ -+} -+ -+void formatNthX(A...)(A) -+{ -+ static gencode(size_t count)() -+ { -+ result ~= ""; // comment out this line will remove the ICE -+ return ""; -+ } -+ mixin(gencode!(A.length)()); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test10375a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test10375a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module imports.test10375a; -+ -+private template Pack(T...) -+{ -+ alias T tuple; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test10752.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test10752.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module imports.test10752; -+private int priv; ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test11225b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test11225b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.test11225b; -+import test11225a; -+ -+interface J : I {} // remove this line to make it work -+ -+static assert(is(typeof({ import imports.test11225c; }))); // OK -+pragma(msg, B!().result); // just instantiates the template -+ -+template B() -+{ -+ static assert(is(typeof({ import imports.test11225c; }))); // FAILS -+ enum result = "WORKS"; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test11225c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test11225c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module imports.test11225c; -+// empty ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test9672a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test9672a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+module imports.test9672a; // interpret -+ -+import test9672; // node -+ -+class Type -+{ -+ mixin ForwardCtor!(); -+} -+ -+//BasicType only created for standard types associated with tokens -+class BasicType : Type -+{ -+ static Type createType() -+ { -+ return null; -+ } -+} -+ -+class ValueT(T) -+{ -+ Type getType() -+ { -+ return BasicType.createType(); -+ } -+} -+class CharValue : ValueT!char -+{ -+ string toStr() -+ { -+ return null; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test9692b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test9692b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module imports.test9692b; -+int j; ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test9919a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test9919a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module imports.test9919a; -+ -+import imports.test9919c; ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test9919b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test9919b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+module imports.test9919b; -+ -+class Event -+{ -+ mixin genToString; // @BUG@ -+} -+ -+class MouseEvent : Event -+{ -+ enum Action { A, B } -+} -+ -+mixin template genToString() -+{ -+ override string toString() -+ { -+ return ""; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/imports/test9919c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/imports/test9919c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,5 @@ -+module imports.test9919c; -+ -+import test9919; -+ -+MouseEvent.Action action; ---- a/src/gcc/testsuite/gdc.test/compilable/inlineheader.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/inlineheader.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -H -Hdtest_results/compilable -inline -+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable -inline - // POST_SCRIPT: compilable/extra-files/inlineheader-postscript.sh - // REQUIRED_ARGS: -d - -@@ -11,6 +11,8 @@ import std.stdio; - pragma(lib, "test"); - pragma(msg, "Hello World"); - -+static assert(true, "message"); -+ - typedef double mydbl = 10; - - int main() -@@ -33,9 +35,25 @@ body - return 0; - } - -+struct S { int m, n; } - - template Foo(T, int V) - { -+ void foo(...) -+ { -+ static if (is(Object _ : X!TL, alias X, TL...)) {} // Bugzilla 10044 -+ -+ auto x = __traits(hasMember, Object, "noMember"); -+ auto y = is(Object : X!TL, alias X, TL...); -+ assert(!x && !y, "message"); -+ -+ S s = { 1,2 }; -+ auto a = [1, 2, 3]; -+ auto aa = [1:1, 2:2, 3:3]; -+ -+ int n,m; -+ } -+ - int bar(double d, int x) - { - if (d) -@@ -148,6 +166,8 @@ static ~this() - interface iFoo{} - class xFoo: iFoo{} - -+interface iFoo2{} -+class xFoo2: iFoo, iFoo2{} - - class Foo3 - { -@@ -253,9 +273,12 @@ template Foo4() - } - } - -+template Foo4x( T... ) {} -+ - class Baz4 - { - mixin Foo4 foo; -+ mixin Foo4x!(int, "str") foox; - - alias foo.bar baz; - } -@@ -349,3 +372,31 @@ void foo6591()() - { - import std.stdio : writeln, F = File; - } -+ -+ -+// 10334 -+ -+template Foo10334(T) if (Bar10334!()) {} /// -+template Foo10334(T) if (Bar10334!100) {} /// -+template Foo10334(T) if (Bar10334!3.14) {} /// -+template Foo10334(T) if (Bar10334!"str") {} /// -+template Foo10334(T) if (Bar10334!1.4i) {} /// -+template Foo10334(T) if (Bar10334!null) {} /// -+template Foo10334(T) if (Bar10334!true) {} /// -+template Foo10334(T) if (Bar10334!false) {} /// -+template Foo10334(T) if (Bar10334!'A') {} /// -+template Foo10334(T) if (Bar10334!int) {} /// -+template Foo10334(T) if (Bar10334!string) {} /// -+template Foo10334(T) if (Bar10334!this) {} /// -+template Foo10334(T) if (Bar10334!([1,2,3])) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!())) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!T)) {} /// -+template Foo10334(T) if (Bar10334!(Baz10334!100)) {} /// -+template Foo10334(T) if (Bar10334!(.foo)) {} /// -+template Foo10334(T) if (Bar10334!(const int)) {} /// -+template Foo10334(T) if (Bar10334!(shared T)) {} /// -+ -+template Test10334(T...) {} /// -+mixin Test10334!int a; /// -+mixin Test10334!(int,long) b; /// -+mixin Test10334!"str" c; /// ---- a/src/gcc/testsuite/gdc.test/compilable/inlinexheader.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/inlinexheader.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -H -Hdtest_results/compilable -inline -+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable -inline - // POST_SCRIPT: compilable/extra-files/inlinexheader-postscript.sh - - // for D 2.0 only ---- a/src/gcc/testsuite/gdc.test/compilable/interpret3.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/interpret3.d 2014-04-01 16:32:51.000000000 +0100 -@@ -304,6 +304,135 @@ bool bug4837() - static assert(bug4837()); - - /************************************************** -+ 10252 shift out of range -+**************************************************/ -+int lshr10252(int shift) -+{ -+ int a = 5; -+ return a << shift; -+} -+ -+int rshr10252(int shift) -+{ -+ int a = 5; -+ return a >> shift; -+} -+ -+int ushr10252(int shift) -+{ -+ int a = 5; -+ return a >>> shift; -+} -+ -+static assert(is(typeof(compiles!(lshr10252(4))))); -+static assert(!is(typeof(compiles!(lshr10252(60))))); -+static assert(is(typeof(compiles!(rshr10252(4))))); -+static assert(!is(typeof(compiles!(rshr10252(80))))); -+static assert(is(typeof(compiles!(ushr10252(2))))); -+static assert(!is(typeof(compiles!(ushr10252(60))))); -+ -+/************************************************** -+ 1982 CTFE null problems -+**************************************************/ -+ -+enum a1982 = [1, 2, 3]; -+static assert (a1982 !is null); -+ -+string foo1982() { return null; } -+static assert (foo1982() is null); -+static assert (!foo1982().length); -+ -+static assert (null is null); -+ -+/************************************************** -+ 7988 CTFE return values should be allowed in compile-time expressions -+**************************************************/ -+ -+class X7988 { int y; this() { y = 2; }} -+static assert( (new X7988).y == 2); -+ -+/************************************************** -+ 8253 ICE: calling of member function of non-CTFE class variable -+**************************************************/ -+ -+class Bug8253 { -+ bool j(){ -+ return true; -+ } -+} -+Bug8253 m8253; -+static assert(!is(typeof(compiles!(m8253.j())))); -+ -+/************************************************** -+ 8285 Issue with slice returned from CTFE function -+**************************************************/ -+ -+string foo8285() { -+ string s = "ab"; -+ return s[0 .. $]; -+} -+ -+template T8285b(string s) { } -+ -+template T8285a() { -+ enum s = foo8285(); -+ alias T8285b!(s) t2; -+} -+ -+int bar8285() { -+ alias T8285a!() t1; -+ return 0; -+} -+ -+int baz8285(int x) { -+ return 0; -+} -+ -+static assert(baz8285(bar8285()) == 0); -+ -+// test case 2 -+ -+string xbar8285() { -+ string s = "ab"; -+ return s[0..$]; -+} -+ -+template xT8285a() { -+ enum xT8285a = xbar8285()[0..$]; -+} -+ -+string xbaz8285() { -+ return xT8285a!(); -+} -+ -+string xfoo8285(string s) { -+ return s; -+} -+ -+static assert(xfoo8285(xbaz8285()) == "ab"); -+ -+/************************************************** -+ 'this' parameter bug revealed during refactoring -+**************************************************/ -+int thisbug1(int x) { return x; } -+ -+struct ThisBug1 -+{ -+ int m = 1; -+ int wut() { -+ return thisbug1(m); -+ } -+} -+ -+int thisbug2() -+{ -+ ThisBug1 spec; -+ return spec.wut(); -+} -+ -+static assert(thisbug2()); -+ -+/************************************************** - 6972 ICE with cast()cast()assign - **************************************************/ - -@@ -838,6 +967,13 @@ bool bug7185() { - - static assert(bug7185()); - -+bool bug9908() -+{ -+ static const int[3] sa = 1; -+ return sa == [1,1,1]; -+} -+static assert(bug9908()); -+ - /******************************************* - 6934 - *******************************************/ -@@ -1066,6 +1202,40 @@ int wconcat(wstring replace) - static assert(wconcat("X"w)); - - /******************************************* -+ 10397 string concat -+*******************************************/ -+ -+static assert(!is(typeof(compiles!("abc" ~ undefined)))); -+static assert(!is(typeof(compiles!(otherundefined ~ "abc")))); -+ -+/******************************************* -+ 9634 struct concat -+*******************************************/ -+ -+struct Bug9634 -+{ -+ int raw; -+} -+ -+bool bug9634() -+{ -+ Bug9634[] jr = [Bug9634(42)]; -+ -+ Bug9634[] ir = null ~ jr; -+ Bug9634[] kr = jr ~ null; -+ Bug9634[] mr = jr ~ jr; -+ -+ jr[0].raw = 6; -+ assert(ir[0].raw == 42); -+ assert(kr[0].raw == 42); -+ assert(jr[0].raw == 6); -+ assert(&mr[0] != &mr[1]); -+ return true; -+} -+ -+static assert(bug9634()); -+ -+/******************************************* - Bug 4001: A Space Oddity - *******************************************/ - -@@ -1108,7 +1278,8 @@ struct Zadok - int bfg() - { - z[0] = 56; -- fog(z[]) = [56, 6, 8]; -+ auto zs = z[]; -+ fog(zs) = [56, 6, 8]; - assert(z[1] == 6); - assert(z[0] == 56); - return z[2]; -@@ -1245,7 +1416,7 @@ static assert(!is(typeof(compiles!(zfs(2 - static assert(!is(typeof(compiles!(zfs(3))))); - static assert(!is(typeof(compiles!(zfs(4))))); - static assert(is(typeof(compiles!(zfs(1))))); --static assert(!is(typeof(compiles!(zfs(5))))); -+static assert(is(typeof(compiles!(zfs(5))))); - - /************************************************** - .dup must protect string literals -@@ -1448,6 +1619,35 @@ bool bug6001h() { - static assert(bug6001h()); - - /************************************************** -+ 10243 wrong code *&arr as ref parameter -+ 10551 wrong code (&arr)[0] as ref parameter -+**************************************************/ -+ -+void bug10243(ref int n) -+{ n = 3; } -+ -+void bug10551(int *p) -+{ -+ bug10243(p[0]); -+} -+ -+bool test10243() -+{ -+ int[1] arr; -+ bug10243(*arr.ptr); -+ assert(arr[0] == 3); -+ int [1] arr2; -+ bug10551(arr2.ptr); -+ assert(arr2[0] == 3); -+ int v; -+ bug10551(&v); -+ assert(v == 3); -+ return true; -+} -+ -+static assert(test10243()); -+ -+/************************************************** - Bug 4910 - **************************************************/ - -@@ -2022,6 +2222,35 @@ bool nullptrcmp() - static assert(nullptrcmp()); - - /************************************************** -+ 10840 null pointer in dotvar -+**************************************************/ -+ -+struct Data10840 -+{ -+ bool xxx; -+} -+ -+struct Bug10840 -+{ -+ Data10840* _data; -+} -+ -+bool bug10840(int n) -+{ -+ Bug10840 stack; -+ if (n == 1) -+ { // detect deref through null pointer -+ return stack._data.xxx; -+ } -+ // Wrong-code for ?: -+ return stack._data ? false : true; -+} -+ -+static assert(bug10840(0)); -+static assert(!is(typeof(Compileable!(bug10840(1))))); -+ -+ -+/************************************************** - 8216 ptr inside a pointer range - **************************************************/ - -@@ -2323,6 +2552,110 @@ bool bug7216() { - static assert(bug7216()); - - /************************************************** -+ 10858 Wrong code with array of pointers -+**************************************************/ -+ -+bool bug10858() -+{ -+ int *[4] x; -+ x[0] = null; -+ assert(x[0] == null); -+ return true; -+} -+static assert(bug10858()); -+ -+/************************************************** -+ 9745 Allow pointers to static variables -+**************************************************/ -+ -+shared int x9745; -+shared int[5] y9745; -+ -+shared (int) * bug9745(int m) -+{ -+ auto k = &x9745; -+ auto j = &x9745; -+ auto p = &y9745[0]; -+ auto q = &y9745[3]; -+ assert (j - k == 0); -+ assert( j == k ); -+ assert( q - p == 3); -+ --q; -+ int a = 0; -+ assert(p + 2 == q); -+ if (m==7) -+ { -+ auto z1 = y9745[0..2]; // slice global pointer -+ } -+ if (m==8) -+ p[1] = 7; // modify through a pointer -+ if (m==9) -+ a = p[1]; // read from a pointer -+ if (m == 0) -+ return & x9745; -+ return &y9745[1]; -+} -+ -+int test9745(int m) -+{ -+ bug9745(m); -+ // type painting -+ shared int * w = bug9745(0); -+ return 1; -+} -+ -+shared int * w9745a = bug9745(0); -+shared int * w9745b = bug9745(1); -+static assert( is(typeof(compiles!(test9745(6))))); -+static assert(!is(typeof(compiles!(test9745(7))))); -+static assert(!is(typeof(compiles!(test9745(8))))); -+static assert(!is(typeof(compiles!(test9745(9))))); -+ -+// pointers cast from an absolute address -+// (mostly applies to fake pointers, eg Windows HANDLES) -+bool test9745b() -+{ -+ void *b6 = cast(void *)0xFEFEFEFE; -+ void *b7 = cast(void *)0xFEFEFEFF; -+ assert(b6 is b6); -+ assert(b7 != b6); -+ return true; -+} -+static assert(test9745b()); -+ -+/************************************************** -+ 9364 ICE with pointer to local struct -+**************************************************/ -+ -+struct S9364 -+{ -+ int i; -+} -+ -+bool bug9364() -+{ -+ S9364 s; -+ auto k = (&s).i; -+ return 1; -+} -+ -+static assert(bug9364()); -+ -+/************************************************** -+ 10251 Pointers to const globals -+**************************************************/ -+ -+static const int glob10251 = 7; -+ -+const (int) * bug10251() -+{ -+ return &glob10251; -+} -+ -+static a10251 = &glob10251; // OK -+static b10251 = bug10251(); -+ -+/************************************************** - 4065 [CTFE] AA "in" operator doesn't work - **************************************************/ - -@@ -3330,6 +3663,38 @@ static assert(!is(typeof(compiles!(badpo - static assert(!is(typeof(compiles!(badpointer(8))))); - - /************************************************** -+ 10211 Allow casts S**->D**, when S*->D* is OK -+**************************************************/ -+ -+int bug10211() -+{ -+ int m = 7; -+ int *x = &m; -+ int **y = &x; -+ assert(**y == 7); -+ uint *p = cast(uint *)x; -+ uint **q = cast(uint **)y; -+ return 1; -+} -+ -+static assert(bug10211()); -+ -+/************************************************** -+ 10568 CTFE rejects function pointer safety casts -+**************************************************/ -+ -+@safe void safetyDance() {} -+ -+int isItSafeToDance() -+{ -+ void function() @trusted yourfriends = &safetyDance; -+ void function() @safe nofriendsOfMine = yourfriends; -+ return 1; -+} -+ -+static assert(isItSafeToDance()); -+ -+/************************************************** - 9170 Allow reinterpret casts float<->int - **************************************************/ - int f9170(float x) { -@@ -3464,6 +3829,27 @@ static assert(!is(typeof(compiles!(bug77 - static assert(!is(typeof(compiles!(bug7780(2))))); - - /************************************************** -+ 10275 cast struct literals to immutable -+**************************************************/ -+ -+struct Bug10275 -+{ -+ uint[] ivals; -+} -+ -+Bug10275 bug10275() { -+ return Bug10275([1,2,3]); -+} -+ -+int test10275() -+{ -+ immutable(Bug10275) xxx = cast(immutable(Bug10275))bug10275(); -+ return 1; -+} -+ -+static assert(test10275()); -+ -+/************************************************** - 6851 passing pointer by argument - **************************************************/ - -@@ -3554,7 +3940,7 @@ struct S6816 { - enum s6816 = S6816().foo(); - - /************************************************** -- 7277 ICE -+ 7277 ICE nestedstruct.init.tupleof - **************************************************/ - - struct Foo7277 -@@ -3576,6 +3962,24 @@ struct Foo7277 - static assert(Foo7277().func() == 17); - - /************************************************** -+ 10217 ICE. CTFE version of 9315 -+**************************************************/ -+ -+bool bug10217() -+{ -+ struct S -+ { -+ int i; -+ void bar() {} -+ } -+ auto yyy = S.init.tupleof[$-1]; -+ assert(!yyy); -+ return 1; -+} -+ -+static assert(bug10217()); -+ -+/************************************************** - 8276 ICE - **************************************************/ - -@@ -3676,13 +4080,13 @@ static assert(classtest1(1)); - static assert(classtest1(2)); - static assert(classtest1(7)); // bug 7154 - --// can't return classes literals outside CTFE -+// can't initialize enum with not null class - SomeClass classtest2(int n) - { - return n==5 ? (new SomeClass) : null; - } --static assert(is(typeof( (){ enum xx = classtest2(2);}() ))); --static assert(!is(typeof( (){ enum xx = classtest2(5);}() ))); -+static assert(is(typeof( (){ enum const(SomeClass) xx = classtest2(2);}() ))); -+static assert(!is(typeof( (){ enum const(SomeClass) xx = classtest2(5);}() ))); - - class RecursiveClass - { -@@ -3705,6 +4109,27 @@ int classtest3() - static assert(classtest3()); - - /************************************************** -+ 7147 typeid() -+**************************************************/ -+ -+static assert({ -+ TypeInfo xxx = typeid(Object); -+ TypeInfo yyy = typeid(new Error("xxx")); -+ return true; -+ }()); -+ -+int bug7147(int n) -+{ -+ Error err = n ? new Error("xxx") : null; -+ TypeInfo qqq = typeid(err); -+ return 1; -+} -+ -+// Must not segfault if class is null -+static assert(!is(typeof(compiles!(bug7147(0))))); -+static assert( is(typeof(compiles!(bug7147(1))))); -+ -+/************************************************** - 6885 wrong code with new array - **************************************************/ - -@@ -3743,6 +4168,24 @@ int bug6886() - - static assert(bug6886()); - -+/************************************************** -+ 10198 Multidimensional struct block initializer -+**************************************************/ -+ -+struct Block10198 { -+ int val[3][4]; -+} -+ -+int bug10198() -+{ -+ Block10198 pp = Block10198(67); -+ assert(pp.val[2][3] == 67); -+ assert(pp.val[1][3] == 67); -+ return 1; -+} -+static assert(bug10198()); -+ -+ - /**************************************************** - * Exception chaining tests from xtest46.d - ****************************************************/ -@@ -4198,6 +4641,15 @@ static assert({ - }()); - - /************************************************** -+ 10499 static template struct declaration -+**************************************************/ -+ -+static assert({ -+ static struct Result() {} -+ return true; -+}()); -+ -+/************************************************** - 6522 opAssign + foreach ref - **************************************************/ - -@@ -4385,6 +4837,29 @@ int bug7940() { - static assert(bug7940()); - - /************************************************** -+ 10298 wrong code for struct array literal init -+**************************************************/ -+ -+struct Bug10298 { -+ int m; -+} -+ -+int bug10298() -+{ -+ Bug10298[1] y = [Bug10298(78)]; -+ y[0].m = 6; -+ assert(y[0].m == 6); -+ -+ // Root cause -+ Bug10298[1] x; -+ x[] = [cast(const Bug10298)(Bug10298(78))]; -+ assert(x[0].m == 78); -+ return 1; -+} -+ -+static assert(bug10298()); -+ -+/************************************************** - 7266 dotvar ref parameters - **************************************************/ - -@@ -4416,6 +4891,46 @@ void out7266(out int b) - static assert( bug7266()); - - /************************************************** -+ 9982 dotvar assign through pointer -+**************************************************/ -+ -+struct Bug9982 { -+ int a; -+} -+ -+int test9982() -+{ -+ Bug9982 x; -+ int *q = &x.a; -+ *q = 99; -+ assert(x.a == 99); -+ return 1; -+} -+ -+static assert(test9982()); -+ -+// 9982, rejects-valid case -+ -+struct SS9982 -+{ -+ Bug9982 s2; -+ this(Bug9982 s1) -+ { -+ s2.a = 6; -+ emplace9982(&s2, s1); -+ assert(s2.a == 3); -+ } -+} -+ -+void emplace9982(Bug9982* chunk, Bug9982 arg) -+{ -+ *chunk = arg; -+} -+ -+enum s9982 = Bug9982(3); -+enum p9982 = SS9982(s9982); -+ -+/************************************************** - 7143 'is' for classes - **************************************************/ - -@@ -4559,6 +5074,83 @@ void bug7419() { - } - - /************************************************** -+ 9445 ice -+**************************************************/ -+ -+template c9445(T...) { } -+ -+void ice9445(void delegate() expr, void function() f2) -+{ -+ static assert(!is(typeof(c9445!(f2())))); -+ static assert(!is(typeof(c9445!(expr())))); -+} -+ -+/************************************************** -+ 10452 delegate == -+**************************************************/ -+ -+struct S10452 { -+ bool func() { return true; } -+} -+ -+struct Outer10452 { -+ S10452 inner; -+} -+ -+class C10452 { -+ bool func() { return true; } -+} -+ -+bool delegate() ref10452(ref S10452 s) -+{ -+ return &s.func; -+} -+ -+bool test10452() -+{ -+ bool delegate() bar = () { return true; }; -+ -+ assert(bar !is null); -+ assert(bar is bar); -+ -+ S10452 bag; -+ S10452[6] bad; -+ Outer10452 outer; -+ C10452 tag = new C10452; -+ -+ auto rat = &outer.inner.func; -+ assert(rat == rat); -+ auto tat = &tag.func; -+ assert(tat == tat); -+ -+ auto bat = &outer.inner.func; -+ auto mat = &bad[2].func; -+ assert(mat is mat); -+ assert(rat == bat); -+ -+ auto zat = &bag.func; -+ auto cat = &bag.func; -+ assert(zat == zat); -+ assert(zat == cat); -+ -+ auto drat = ref10452(bag); -+ assert(cat == drat); -+ assert(drat == drat); -+ drat = ref10452(bad[2]); -+ assert( drat == mat); -+ assert(tat != rat); -+ assert(zat != rat); -+ assert(rat != cat); -+ assert(zat != bar); -+ assert(tat != cat); -+ cat = bar; -+ assert(cat == bar); -+ return true; -+} -+static assert(test10452()); -+ -+ -+/************************************************** - 7162 and 4711 - **************************************************/ - -@@ -4698,6 +5290,21 @@ enum int bug7197 = 7; - static assert(bar7197!(bug7197)); - - /************************************************** -+ Enum string compare -+**************************************************/ -+ -+enum EScmp : string { a = "aaa" } -+ -+bool testEScmp() -+{ -+ EScmp x = EScmp.a; -+ assert( x < "abc" ); -+ return true; -+} -+ -+static assert(testEScmp()); -+ -+/************************************************** - 7667 - **************************************************/ - -@@ -4798,6 +5405,23 @@ int bug9113(T)() - - static assert( !is( typeof( compiles!(bug9113!(int)())) ) ); - -+/************************************************** -+ Creation of unions -+**************************************************/ -+ -+union UnionTest1 -+{ -+ int x; -+ float y; -+} -+ -+int uniontest1() -+{ -+ UnionTest1 u = UnionTest1(1); -+ return 1; -+} -+ -+static assert(uniontest1()); - - /************************************************** - 6438 void -@@ -4839,6 +5463,40 @@ static assert(!is(typeof(compiles!(bug64 - static assert(!is(typeof(compiles!(bug6438(3))))); - - /************************************************** -+ 10994 void static array members -+**************************************************/ -+ -+struct Bug10994 -+{ -+ ubyte[2] buf = void; -+} -+ -+static bug10994 = Bug10994.init; -+ -+/************************************************** -+ 10937 struct inside union -+**************************************************/ -+ -+struct S10937 { -+ union { -+ ubyte[1] a; -+ struct { -+ ubyte b; -+ } -+ } -+ -+ this(ubyte B) { -+ if (B > 6) -+ this.b = B; -+ else -+ this.a[0] = B; -+ } -+} -+ -+enum test10937 = S10937(7); -+enum west10937 = S10937(2); -+ -+/************************************************** - 7732 - **************************************************/ - -@@ -4946,19 +5604,82 @@ bool bug7987() - t.p = &q[1]; - assert(s!=t); - s.p = &q[1]; -- assert(s == t); -+ /*assert(s == t);*/ assert(s.p == t.p); - s.c = c1; - t.c = c2; -- assert(s != t); -+ /*assert(s != t);*/ assert(s.c !is t.c); - assert(s !is t); - s.c = c2; -- assert(s == t); -+ /*assert(s == t);*/ assert(s.p == t.p && s.c is t.c); - assert(s is t); - return true; - } - - static assert(bug7987()); - -+/************************************************** -+ 10579 typeinfo.func() must not segfault -+**************************************************/ -+ -+static assert(!is(typeof(compiles!(typeid(int).toString.length)))); -+ -+class Bug10579 { -+ int foo() { return 1; } -+} -+Bug10579 uninitialized10579; -+ -+static assert(!is(typeof(compiles!(uninitialized10579.foo())))); -+ -+/************************************************** -+ 10804 mixin ArrayLiteralExp typed string -+**************************************************/ -+ -+void test10804() -+{ -+ String identity(String)(String a) { return a; } -+ -+ string cfun() -+ { -+ char[] s; -+ s.length = 8 + 2 + (2) + 1 + 2; -+ s[] = "identity(`Ω`c)"c[]; -+ return cast(string)s; // Return ArrayLiteralExp as the CTFE result -+ } -+ { -+ enum a1 = "identity(`Ω`c)"c; -+ enum a2 = cfun(); -+ static assert(cast(ubyte[])mixin(a1) == [0xCE, 0xA9]); -+ static assert(cast(ubyte[])mixin(a2) == [0xCE, 0xA9]); // should pass -+ } -+ -+ wstring wfun() -+ { -+ wchar[] s; -+ s.length = 8 + 2 + (2) + 1 + 2; -+ s[] = "identity(`\U0002083A`w)"w[]; -+ return cast(wstring)s; // Return ArrayLiteralExp as the CTFE result -+ } -+ { -+ enum a1 = "identity(`\U0002083A`w)"w; -+ enum a2 = wfun(); -+ static assert(cast(ushort[])mixin(a1) == [0xD842, 0xDC3A]); -+ static assert(cast(ushort[])mixin(a2) == [0xD842, 0xDC3A]); -+ } -+ -+ dstring dfun() -+ { -+ dchar[] s; -+ s.length = 8 + 2 + (1) + 1 + 2; -+ s[] = "identity(`\U00101000`d)"d[]; -+ return cast(dstring)s; // Return ArrayLiteralExp as the CTFE result -+ } -+ { -+ enum a1 = "identity(`\U00101000`d)"d; -+ enum a2 = dfun(); -+ static assert(cast(uint[])mixin(a1) == [0x00101000]); -+ static assert(cast(uint[])mixin(a2) == [0x00101000]); -+ } -+} - - /******************************************************/ - -@@ -5019,4 +5740,76 @@ label: - } - static assert(bug8865()); - -+/******************************************************/ -+ -+ -+struct Test75 -+{ -+ this(int) pure {} -+} -+ -+static assert(__traits(compiles, {static shared Test75* t75 = new shared(Test75)(0); return t75;})); -+static assert(__traits(compiles, {static shared(Test75)* t75 = new shared(Test75)(0); return t75;})); -+static assert(__traits(compiles, {static __gshared Test75* t75 = new Test75(0); return t75;})); -+static assert(__traits(compiles, {static const Test75* t75 = new const(Test75)(0); return t75;})); -+static assert(__traits(compiles, {static immutable Test75* t75 = new immutable(Test75)(0); return t75;})); -+static assert(!__traits(compiles, {static Test75* t75 = new Test75(0); return t75;})); -+ -+//static assert(!__traits(compiles, {enum t75 = new shared(Test75)(0); return t75;})); -+//static assert(!__traits(compiles, {enum t75 = new Test75(0); return t75;})); -+//static assert(!__traits(compiles, {enum shared(Test75)* t75 = new shared(Test75)(0); return t75;})); -+//static assert(!__traits(compiles, {enum Test75* t75 = new Test75(0); return t75;})); -+ -+//static assert(__traits(compiles, {enum t75 = new const(Test75)(0); return t75;})); -+//static assert(__traits(compiles, {enum t75 = new immutable(Test75)(0); return t75;})); -+//static assert(__traits(compiles, {enum const(Test75)* t75 = new const(Test75)(0); return t75;})); -+//static assert(__traits(compiles, {enum immutable(Test75)* t75 = new immutable(Test75)(0); return t75;})); -+ -+/******************************************************/ -+ -+class Test76 -+{ -+ this(int) pure {} -+} -+ -+//static assert(!__traits(compiles, {enum t76 = new shared(Test76)(0); return t76;})); -+//static assert(!__traits(compiles, {enum t76 = new Test76(0); return t76;})); -+//static assert(!__traits(compiles, {enum shared(Test76) t76 = new shared(Test76)(0); return t76;})); -+//static assert(!__traits(compiles, {enum Test76 t76 = new Test76(0); return t76;})); -+ -+//static assert(__traits(compiles, {enum t76 = new const(Test76)(0); return t76;})); -+//static assert(__traits(compiles, {enum t76 = new immutable(Test76)(0); return t76;})); -+//static assert(__traits(compiles, {enum const(Test76) t76 = new const(Test76)(0); return t76;})); -+//static assert(__traits(compiles, {enum immutable(Test76) t76 = new immutable(Test76)(0); return t76;})); -+ -+ -+/******************************************************/ -+static assert(__traits(compiles, {static shared Test76 t76 = new shared(Test76)(0); return t76;})); -+static assert(__traits(compiles, {static shared(Test76) t76 = new shared(Test76)(0); return t76;})); -+static assert(__traits(compiles, {static __gshared Test76 t76 = new Test76(0); return t76;})); -+static assert(__traits(compiles, {static const Test76 t76 = new const(Test76)(0); return t76;})); -+static assert(__traits(compiles, {static immutable Test76 t76 = new immutable Test76(0); return t76;})); -+static assert(!__traits(compiles, {static Test76 t76 = new Test76(0); return t76;})); -+ -+/***** Bug 5678 *********************************/ -+ -+struct Bug5678 -+{ -+ this(int) {} -+} -+ -+static assert(!__traits(compiles, {enum const(Bug5678)* b5678 = new const(Bug5678)(0); return b5678;})); -+ -+/************************************************** -+ 10782 run semantic2 for class field -+**************************************************/ -+ -+enum e10782 = 0; -+class C10782 { int x = e10782; } -+string f10782() -+{ -+ auto c = new C10782(); -+ return ""; -+} -+mixin(f10782()); - ---- a/src/gcc/testsuite/gdc.test/compilable/json.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/json.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -o- -X -Xftest_results/compilable/json.out -+// REQUIRED_ARGS: -o- -X -Xf${RESULTS_DIR}/compilable/json.out - // POST_SCRIPT: compilable/extra-files/json-postscript.sh - // EXTRA_SOURCES: imports/jsonimport1.d imports/jsonimport2.d imports/jsonimport3.d imports/jsonimport4.d - -@@ -79,3 +79,21 @@ import imports.jsonimport1 : target1, ta - import imports.jsonimport2 : alias1 = target1, alias2 = target2; - import imports.jsonimport3 : alias3 = target1, alias4 = target2, target3; - import imports.jsonimport4; -+ -+struct S -+{ -+ /** Issue 9480 - Template name should be stripped of parameters */ -+ this(T)(T t) { } -+} -+ -+/** Issue 9755 - Protection not emitted properly for Templates. */ -+private struct S1_9755(T) { } -+package struct S2_9755(T) { } -+ -+class C_9755 -+{ -+ protected static class CI_9755(T) { } -+} -+ -+/** Issue 10011 - init property is wrong for object initializer. */ -+const Object c_10011 = new Object(); ---- a/src/gcc/testsuite/gdc.test/compilable/parse9232.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/parse9232.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,17 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+struct Foo -+{ -+ void bar(T)() {} -+ void baz() {} -+} -+ -+void main() -+{ -+ Foo foo; -+ (foo).bar!int(); // Error: found '!' when expecting ';' following statement -+ ((foo)).bar!int(); // OK -+ foo.bar!int(); // OK -+ (foo).baz(); // OK -+} ---- a/src/gcc/testsuite/gdc.test/compilable/parse9401.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/parse9401.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+struct S1 { -+ ~this() nothrow pure @safe { } -+} -+ -+struct S2 { -+ @safe ~this() pure nothrow { } -+} -+ -+void main() nothrow pure @safe { -+ S1 s1; -+ S2 s2; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/parse9649.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/parse9649.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+class Outer { -+ class Inner { -+ } -+} -+Outer outer; -+ -+void main() { -+ (outer).new Inner(); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/parse9679.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/parse9679.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+void test9679(inout int = 0) -+{ -+ if ( auto n = 1) { static assert(is(typeof(n) == int)); } -+ if ( const n = 1) { static assert(is(typeof(n) == const int)); } -+ if ( immutable n = 1) { static assert(is(typeof(n) == immutable int)); } -+ if (shared n = 1) { static assert(is(typeof(n) == shared int)); } -+ if (shared const n = 1) { static assert(is(typeof(n) == shared const int)); } -+ if ( inout n = 1) { static assert(is(typeof(n) == inout int)); } -+ if (shared inout n = 1) { static assert(is(typeof(n) == shared inout int)); } -+ -+ if ( const int n = 1) { static assert(is(typeof(n) == const int)); } -+ if ( immutable int n = 1) { static assert(is(typeof(n) == immutable int)); } -+ if (shared int n = 1) { static assert(is(typeof(n) == shared int)); } -+ if (shared const int n = 1) { static assert(is(typeof(n) == shared const int)); } -+ if ( inout int n = 1) { static assert(is(typeof(n) == inout int)); } -+ if (shared inout int n = 1) { static assert(is(typeof(n) == shared inout int)); } -+ -+ if ( const(int) n = 1) { static assert(is(typeof(n) == const int)); } -+ if ( immutable(int) n = 1) { static assert(is(typeof(n) == immutable int)); } -+ if (shared (int) n = 1) { static assert(is(typeof(n) == shared int)); } -+ if (shared const(int) n = 1) { static assert(is(typeof(n) == shared const int)); } -+ if ( inout(int) n = 1) { static assert(is(typeof(n) == inout int)); } -+ if (shared inout(int) n = 1) { static assert(is(typeof(n) == shared inout int)); } -+ -+ if (immutable(int)[] n = [1]) { static assert(is(typeof(n) == immutable(int)[])); } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/parse9901.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/parse9901.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+template isGood(T) -+{ -+ enum isGood = true; -+} -+void main() -+{ -+ string foo(R)(R data) if (isGood!R) -+ { -+ return ""; -+ } -+ foo(1); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/sw_transition_field.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/sw_transition_field.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,29 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -transition=field -+/* -+TEST_OUTPUT: -+--- -+--- -+*/ -+/* -+--- -+compilable/sw_transition_field.d(15): sw_transition_field.S1.ix is immutable field -+compilable/sw_transition_field.d(16): sw_transition_field.S1.cx is const field -+compilable/sw_transition_field.d(21): sw_transition_field.S2!(immutable(int)).S2.f is immutable field -+compilable/sw_transition_field.d(21): sw_transition_field.S2!(const(int)).S2.f is const field -+--- -+*/ -+ -+struct S1 -+{ -+ immutable int ix = 1; -+ const int cx = 2; -+} -+ -+struct S2(F) -+{ -+ F f = F.init; -+} -+ -+alias S2!(immutable int) S2I; -+alias S2!( const int) S2C; ---- a/src/gcc/testsuite/gdc.test/compilable/sw_transition_tls.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/sw_transition_tls.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -transition=tls -+/* -+TEST_OUTPUT: -+--- -+compilable/sw_transition_tls.d(11): x is thread local -+compilable/sw_transition_tls.d(15): y is thread local -+--- -+*/ -+ -+int x; -+ -+struct S -+{ -+ static int y; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10056.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10056.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,66 @@ -+void main() -+{ -+ alias Zoo = Foo10056!(false, false, 1); -+} -+ -+struct Foo10056(bool S, bool L, size_t N) -+{ -+ string bar() -+ { -+ Appender10056!(string) w; -+ char[] buf; put10056(w, buf); -+ return ""; -+ } -+ -+ public bool opEquals(T)(T other) //const -+ //If you add const, also fails to compile with 2.062. -+ { -+ alias Foo10056!(typeof(this), T, "CMP") P; -+ return false; -+ } -+} -+ -+template Foo10056(T, U, string OP) -+{ -+ static if (T.ISEMPTY && U.ISEMPTY) -+ enum bool S = false; -+ else -+ enum bool S = false; -+ -+ alias Foo10056 = Foo10056!(false, false, 0); -+} -+ -+/**********************************************/ -+ -+void put10056(R, E)(ref R r, E e) -+{ -+ static if (is(typeof(r.put(e)))) -+ { -+ r.put(e); -+ } -+ else -+ { -+ static assert(false, "Cannot put a "~E.stringof~" into a "~R.stringof); -+ } -+} -+ -+struct Appender10056(A : T[], T) -+{ -+ private template canPutItem(U) -+ { -+ enum bool canPutItem = is(U : T); -+ } -+ private template canPutRange(R) -+ { -+ enum bool canPutRange = is(typeof(Appender10056.init.put(R.init[0]))); -+ } -+ -+ void put(U)(U item) if (canPutItem!U) -+ { -+ char[T.sizeof == 1 ? 4 : 2] encoded; -+ put(encoded[]); -+ } -+ void put(R)(R items) if (canPutRange!R) -+ { -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10066.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10066.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,66 @@ -+void main() -+{ -+ alias Zoo = Foo!(1); -+} -+ -+struct Foo(size_t N) -+{ -+ string bar() -+ { -+ Appender!(string) w; -+ char[] buf; put(w, buf); -+ return ""; -+ } -+ -+ public bool opEquals(T)(T other) const -+ // Add const, different from bug 10056 -+ { -+ alias Foo!(typeof(this), T, "CMP") P; -+ return false; -+ } -+} -+ -+template Foo(T, U, string OP) -+{ -+ static if (T.ISEMPTY && U.ISEMPTY) -+ enum bool S = false; -+ else -+ enum bool S = false; -+ -+ alias Foo = Foo!(0); -+} -+ -+/**********************************************/ -+ -+void put(R, E)(ref R r, E e) -+{ -+ static if (is(typeof(r.put(e)))) -+ { -+ r.put(e); -+ } -+ else -+ { -+ static assert(false, "Cannot put a "~E.stringof~" into a "~R.stringof); -+ } -+} -+ -+struct Appender(A : T[], T) -+{ -+ private template canPutItem(U) -+ { -+ enum bool canPutItem = is(U : T); -+ } -+ private template canPutRange(R) -+ { -+ enum bool canPutRange = is(typeof(Appender.init.put(R.init[0]))); -+ } -+ -+ void put(U)(U item) if (canPutItem!U) -+ { -+ char[T.sizeof == 1 ? 4 : 2] encoded; -+ put(encoded[]); -+ } -+ void put(R)(R items) if (canPutRange!R) -+ { -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10073.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10073.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+struct Arr(T) -+{ -+ T[] dArr; -+ alias dArr this; -+ bool opEquals(Arr!T d) -+ { -+ foreach (idx, it; d) -+ { -+ if (this[idx] != it) -+ { -+ return false; -+ } -+ } -+ return true; -+ } -+} -+ -+class Bar -+{ -+ Arr!Foo fooQ; -+} -+ -+class Foo {} // NG -+ ---- a/src/gcc/testsuite/gdc.test/compilable/test10150.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10150.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,36 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+void foo() {} -+alias F = typeof(foo); -+ -+class C -+{ -+ const static void fc() {} -+ immutable static void fi() {} -+ inout static void fw() {} -+ shared static void fs() {} -+ shared const static void fsc() {} -+ shared inout static void fsw() {} -+ -+ static assert(is(typeof(fc) == F)); -+ static assert(is(typeof(fi) == F)); -+ static assert(is(typeof(fw) == F)); -+ static assert(is(typeof(fs) == F)); -+ static assert(is(typeof(fsc) == F)); -+ static assert(is(typeof(fsw) == F)); -+} -+ -+const { void fc() {} } -+immutable { void fi() {} } -+inout { void fw() {} } -+shared { void fs() {} } -+shared const { void fsc() {} } -+shared inout { void fsw() {} } -+ -+static assert(is(typeof(fc) == F)); -+static assert(is(typeof(fi) == F)); -+static assert(is(typeof(fw) == F)); -+static assert(is(typeof(fs) == F)); -+static assert(is(typeof(fsc) == F)); -+static assert(is(typeof(fsw) == F)); ---- a/src/gcc/testsuite/gdc.test/compilable/test10186.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10186.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,27 @@ -+struct S { -+ @disable this(); -+ -+ this(int i) { -+ } -+} -+ -+class C { -+ this() { -+ s = S(1); -+ } -+ -+ S s; -+} -+ -+class CR -+{ -+ S s; -+ -+ this() { -+ s = S(1); -+ } -+} -+ -+void main() { -+ auto c = new C; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10375.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10375.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+// REQUIRED_ARGS: -o- -+ -+import imports.test10375a; -+ -+void packIt(Pack)(Pack p){ } //3 -+ -+void main() -+{ -+ alias p = packIt!(int); -+ p(2); // OK <- NG -+ packIt(2); // OK <- NG -+ packIt!(int)(2); // OK <- NG -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10695.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10695.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// PERMUTE_ARGS: -+module a; -+ -+void main() -+{ -+ mixin("string mod1 = __MODULE__;"); -+ mixin("enum mod2 = __MODULE__;"); -+ static assert(mod2 == "a"); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10726.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10726.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,53 @@ -+// PERMUTE_ARGS: -+ -+public struct CirBuff(T) -+{ -+ private T[] data; -+ private size_t head = 0; -+ private size_t size = 0; -+ public size_t length() const { return size; } -+ -+ public bool opEquals(CirBuff!T d) @trusted -+ { -+ if (length != d.length) -+ return false; -+ for (size_t i=0; i!=size; ++i) -+ { -+ if (this.data[(this.head+i) % this.data.length] != -+ d.data[(d.head + i) % d.data.length]) -+ { -+ return false; -+ } -+ } -+ return true; -+ } -+} -+ -+class Once -+{ -+ Foo!Bar _bar; -+} -+ -+class Bar -+{ -+ static Once _once; -+ mixin(sync!(Once, "_once")); -+} -+ -+class Foo(T = int) -+{ -+ CirBuff!T _buff; -+} -+ -+template sync(T, string U = "this", size_t ITER = 0) -+{ -+ static if (ITER == __traits(derivedMembers, T).length) -+ enum sync = ""; -+ else -+ { -+ enum string mem = __traits(derivedMembers, T)[ITER]; -+ enum string sync = -+ "static if(! __traits(isVirtualMethod, " ~ U ~ "." ~ mem ~ ")) { }" -+ ~ sync!(T, U, ITER+1); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10752.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10752.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+import imports.test10752; -+void main() -+{ -+ static assert(!__traits(compiles, priv)); -+ static assert(!__traits(compiles, priv)); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10992b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10992b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -unittest -+ -+version(none) -+{} -+else -+{ -+ unittest { } -+ unittest { } -+ unittest { } -+} -+ -+void main() -+{ -+ static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 3); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10992.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10992.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -unittest -+ -+unittest { } -+unittest { } -+unittest { } -+ -+void main() -+{ -+ static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 3); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test10993.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test10993.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,33 @@ -+module test10993; -+ -+auto foo(T)(T a) -+{ -+ static immutable typeof(a) q; -+// pragma(msg, "foo: " ~ typeof(q).mangleof); -+ return q; -+} -+ -+struct test(alias fn) -+{ -+ bool ini = true; -+ void* p; -+} -+ -+auto fun() -+{ -+ auto x = foo!()(test!(a=>a)()); -+// pragma(msg, "fun: " ~ typeof(x).mangleof); -+ -+ return x; -+} -+ -+void main() -+{ -+ const x = fun(); -+ enum mangle_x = typeof(x).mangleof; -+// pragma(msg, "x : " ~ mangle_x); -+ auto y = cast()x; -+ enum mangle_y = typeof(y).mangleof; -+// pragma(msg, "y : " ~ mangle_y); -+ static assert (mangle_y == mangle_x[1..$]); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test11225a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test11225a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+//EXTRA_FILES: imports/test11225b.d imports/test11225c.d -+/* -+TEST_OUTPUT: -+--- -+WORKS -+--- -+*/ -+ -+import imports.test11225b; -+interface I {} ---- a/src/gcc/testsuite/gdc.test/compilable/test11237.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test11237.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+// PERMUTE_ARGS: -+// POST_SCRIPT: compilable/extra-files/test11237.sh -+ -+struct Buffer { ubyte[64 * 1024] buffer; } ---- a/src/gcc/testsuite/gdc.test/compilable/test1878a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test1878a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+void main() -+{ -+ ubyte from, to; -+ foreach(i; from..to) -+ { -+ static assert(is(typeof(i) == ubyte)); -+ } -+ foreach(i; 'a'..'l') -+ { -+ static assert(is(typeof(i) == char)); -+ } -+ foreach(i; 'א' .. 'ת') -+ { -+ static assert(is(typeof(i) == wchar)); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test3673.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test3673.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,48 @@ -+class Base {} -+ -+class Foo(T) -+ if (is(T == int)) : Base { } -+ -+class Bar(T) : Base -+ if (is(T == bool)) -+{ } -+ -+interface OutputRange(T...) -+ if (T.length == 1) -+{ -+ void put(T[0] value); -+} -+ -+interface OutputRange(T...) : OutputRange!(T[0]), OutputRange!(T[1 .. $]) -+ if (T.length > 1) -+{ -+} -+ -+alias OutputRange!(int, float) OR; -+ -+class COR : OR -+{ -+ void put(int) { } -+ void put(float) { } -+} -+ -+class A {}; -+class B(T) : A if (true) {} -+class C(T) if (false) : A {} -+ -+alias Foo!int FooInt; -+alias Bar!bool BarBool; -+ -+static assert(!__traits(compiles, Foo!bool)); -+static assert(!__traits(compiles, Bar!int)); -+ -+void main() -+{ -+ auto fi = new FooInt; -+ auto bb = new BarBool; -+ auto cor = new COR; -+ -+ auto a = new A(); -+ auto b = new B!int(); -+ static assert(!__traits(compiles, new C!int())); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test3775.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test3775.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// 3775 -+ -+struct Bug3775 { -+ static int byLine()() { return 1; } -+} -+ -+static assert(cast(int)Bug3775.byLine == 1); -+ -+ ---- a/src/gcc/testsuite/gdc.test/compilable/test6089.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test6089.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+// PERMUTE_ARGS: -+void main() -+{ -+ extern int[1][1] foo; -+} -+ ---- a/src/gcc/testsuite/gdc.test/compilable/test6395.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test6395.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // REQUIRED_ARGS: -c compilable/b6395 -Icompilable/extra-files --// EXTRA_SOURCES: extra-files/c6395.d -+// EXTRA_FILES: extra-files/c6395.d - - // 6395 - ---- a/src/gcc/testsuite/gdc.test/compilable/test6552.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test6552.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+// REQUIRED_ARGS: -w -+ -+void main() -+{ -+ int i; -+ switch (i) -+ { -+ case 1, 2: -+ case 3, 4: break; -+ default: break; -+ } -+ -+ char ch; -+ switch (ch) -+ { -+ case 'U', 'u': -+ case 'L', 'l': -+ default: -+ } -+ -+ switch (i) -+ { -+ default: case 1: -+ case 3,4: -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test7030.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test7030.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4,6 +4,7 @@ extern(C++) - { - void foo(int) const; - void bar(int); -+ static __gshared int boo; - } - } - -@@ -11,9 +12,11 @@ version (OSX) - { - static assert(S.foo.mangleof == "__ZNK1S3fooEi"); - static assert(S.bar.mangleof == "__ZN1S3barEi"); -+ static assert(S.boo.mangleof == "__ZN1S3booE"); - } - else version (Posix) - { - static assert(S.foo.mangleof == "_ZNK1S3fooEi"); - static assert(S.bar.mangleof == "_ZN1S3barEi"); -+ static assert(S.boo.mangleof == "_ZN1S3booE"); - } ---- a/src/gcc/testsuite/gdc.test/compilable/test7190.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test7190.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,6 @@ - // PERMUTE_ARGS: - // REQUIRED_ARGS: -c -Icompilable/extra-files --// EXTRA_FILES: extra-files/example7190/controllers/HomeController.d extra-files/example7190/models/HomeModel.d --// EXTRA_FILES: extra-files/serenity7190/core/Controller.d extra-files/serenity7190/core/Model.d -+// EXTRA_FILES: extra-files/example7190/controllers/HomeController.d extra-files/example7190/models/HomeModel.d extra-files/serenity7190/core/Controller.d extra-files/serenity7190/core/Model.d - - import example7190.controllers.HomeController; - import example7190.models.HomeModel; ---- a/src/gcc/testsuite/gdc.test/compilable/test7524.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test7524.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+// 7524 -+ -+#line __LINE__ "y.d" ---- a/src/gcc/testsuite/gdc.test/compilable/test7569.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test7569.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+template Tuple(T...) -+{ -+ alias T Tuple; -+} -+ -+void main() -+{ -+ Tuple!(int, int) tup1 = void; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test7754.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test7754.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,4 @@ --// REQUIRED_ARGS: -H -Hdtest_results/compilable -+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable - // POST_SCRIPT: compilable/extra-files/test7754-postscript.sh - // PERMUTE_ARGS: -d -dw - ---- a/src/gcc/testsuite/gdc.test/compilable/test8041.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test8041.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+// PERMUTE_ARGS: -+ -+struct Foo { } -+ -+void main() -+{ -+ static Foo sf; // ok -+ __gshared Foo gf; // was: Error: non-constant expression gf = 0 -+ __gshared int[1][1] arr; // dup: Issue 6089 -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test8509.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test8509.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+module test8509; -+enum E : string { a = "hello", b = "world" } -+struct S { E opCat(S s) { return E.a; } E opCat(string s) { return E.a; } } -+ -+void main() -+{ -+ E e3 = S() ~ S(); -+ E e4 = S() ~ "a"; -+ assert(e3 == E.a); -+ assert(e4 == E.a); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test8717.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test8717.d 2014-04-01 16:32:51.000000000 +0100 -@@ -11,7 +11,7 @@ private: - } - - static assert(SPR.e == 1); --static assert(SPR.ii == 1); -+//static assert(SPR.ii == 1); - static assert(SPR.sii == 1); - static assert(SPR.sf() == 1); - static assert(SPR.init.e == 1); -@@ -21,7 +21,7 @@ static assert(SPR.sf() == 1); - static assert(SPR.init.f() == 1); - - static if(SPR.e != 1) { static assert(0); } --static if(SPR.ii != 1) { static assert(0); } -+//static if(SPR.ii != 1) { static assert(0); } - static if(SPR.sii != 1) { static assert(0); } - static if(SPR.sf() != 1) { static assert(0); } - static if(SPR.init.e != 1) { static assert(0); } -@@ -41,7 +41,7 @@ protected: - } - - static assert(SPT.e == 1); --static assert(SPT.ii == 1); -+//static assert(SPT.ii == 1); - static assert(SPT.sii == 1); - static assert(SPT.sf() == 1); - static assert(SPT.init.e == 1); -@@ -51,7 +51,7 @@ static assert(SPT.sf() == 1); - static assert(SPT.init.f() == 1); - - static if(SPT.e != 1) { static assert(0); } --static if(SPT.ii != 1) { static assert(0); } -+//static if(SPT.ii != 1) { static assert(0); } - static if(SPT.sii != 1) { static assert(0); } - static if(SPT.sf() != 1) { static assert(0); } - static if(SPT.init.e != 1) { static assert(0); } ---- a/src/gcc/testsuite/gdc.test/compilable/test8898.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test8898.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+// REQUIRED_ARGS: -w -+// PERMUTE_ARGS: -+ -+static if (true): -+ -+version (Foo) -+{ -+} -+else -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test8959.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test8959.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,55 @@ -+/* -+TEST_OUTPUT: -+--- -+U1 = int -+U2 = int -+V1 = long, K1 = string -+V2 = long, K2 = string -+TL1 = (int, string) -+TL2 = (int, string) -+U3 = int -+U4 = int -+V3 = long, K3 = string -+V4 = long, K4 = string -+TL3 = (int, string) -+TL4 = (int, string) -+--- -+*/ -+ -+static if (is(int* == U1*, U1)) { pragma(msg, "U1 = ", U1); } -+static if (is(int* : U2*, U2)) { pragma(msg, "U2 = ", U2); } -+static assert(is(int* == U*, U)); -+static assert(is(int* : U*, U)); -+ -+alias AA = long[string]; -+static if (is(AA == V1[K1], V1, K1)) { pragma(msg, "V1 = ", V1, ", K1 = ", K1); } -+static if (is(AA : V2[K2], V2, K2)) { pragma(msg, "V2 = ", V2, ", K2 = ", K2); } -+static assert(is(AA == V[K], V, K)); -+static assert(is(AA : V[K], V, K)); -+ -+class B(TL...) {} -+class C(TL...) : B!TL {} -+alias X = C!(int, string); -+ -+static if (is(X == C!TL1, TL1...)) { pragma(msg, "TL1 = ", TL1); } -+static if (is(X : B!TL2, TL2...)) { pragma(msg, "TL2 = ", TL2); } -+static assert(is(X == C!TL, TL...)); -+static assert(is(X : B!TL, TL...)); -+ -+void test8959() -+{ -+ static if (is(int* == U3*, U3)) { pragma(msg, "U3 = ", U3); } -+ static if (is(int* : U4*, U4)) { pragma(msg, "U4 = ", U4); } -+ static assert(is(int* == U*, U)); -+ static assert(is(int* : U*, U)); -+ -+ static if (is(AA == V3[K3], V3, K3)) { pragma(msg, "V3 = ", V3, ", K3 = ", K3); } -+ static if (is(AA : V4[K4], V4, K4)) { pragma(msg, "V4 = ", V4, ", K4 = ", K4); } -+ static assert(is(AA == V[K], V, K)); -+ static assert(is(AA : V[K], V, K)); -+ -+ static if (is(X == C!TL3, TL3...)) { pragma(msg, "TL3 = ", TL3); } -+ static if (is(X : B!TL4, TL4...)) { pragma(msg, "TL4 = ", TL4); } -+ static assert(is(X == C!TL, TL...)); -+ static assert(is(X : B!TL, TL...)); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test9057.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9057.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,6 @@ - // PERMUTE_ARGS: - // REQUIRED_ARGS: -c -Icompilable/extra-files --// EXTRA_SOURCES: extra-files/imp9057.d extra-files/imp9057_2.d -+// EXTRA_FILES: extra-files/imp9057.d extra-files/imp9057_2.d - - struct Bug9057(T) - { ---- a/src/gcc/testsuite/gdc.test/compilable/test9526.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9526.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+template forward(args...) -+{ -+ @property fwd()() { return args[0]; } -+ static assert(__traits(compiles, { auto ex = fwd; })); -+ alias fwd forward; -+} -+ -+void initializeClassInstance(C, Args...)(C chunk, auto ref Args args) -+{ -+ chunk.__ctor(forward!args); -+} -+ -+void main() -+{ -+ static int si = 0; -+ static class C { this(int) { ++si; } } -+ void[__traits(classInstanceSize, C)] buff = void; -+ auto c = cast(C) buff.ptr; -+ initializeClassInstance(c, 0); -+ assert(si); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test9554.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9554.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,22 @@ -+// REQUIRED_ARGS: -o- -+ -+module pkg.test9554; -+alias mod = pkg.test9554; -+ -+template Test(alias name) { enum Test = name; } -+void fun() {} -+ -+static assert(fun.stringof == Test!(fun.stringof)); -+static assert(fun.stringof == "fun()"); -+static assert(fun.mangleof == Test!(fun.mangleof)); -+static assert(fun.mangleof == "_D3pkg8test95543funFZv"); -+ -+static assert(mod.stringof == Test!(mod.stringof)); -+static assert(mod.stringof == "module test9554"); -+static assert(mod.mangleof == Test!(mod.mangleof)); -+static assert(mod.mangleof == "3pkg8test9554"); -+ -+static assert(pkg.stringof == Test!(pkg.stringof)); -+static assert(pkg.stringof == "package pkg"); -+static assert(pkg.mangleof == Test!(pkg.mangleof)); -+static assert(pkg.mangleof == "3pkg"); ---- a/src/gcc/testsuite/gdc.test/compilable/test9565.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9565.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,86 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+template TypeTuple(T...) { alias TypeTuple = T; } -+ -+bool startsWith(string s, string m) { return s[0 .. m.length] == m; } -+ -+void main() -+{ -+ enum string castPrefix = "cast(" ~ size_t.stringof ~ ")"; -+ -+ // TypeSArray -+ static assert((int[10]).stringof == "int[10]", T.stringof); -+ -+ int[] arr; -+ -+ // IndexExp -+ { -+ // index == IntegerExp -+ static assert((arr[ 4 ]).stringof == "arr[4]"); -+ static assert((arr[ 4U ]).stringof == "arr[4]"); -+ static assert((arr[ 4L ]).stringof == "arr[4]"); -+ static assert((arr[ 4LU]).stringof == "arr[4]"); -+ -+ // index == UAddExp -+ static assert((arr[+4 ]).stringof == "arr[4]"); -+ static assert((arr[+4U ]).stringof == "arr[4]"); -+ static assert((arr[+4L ]).stringof == "arr[4]"); -+ static assert((arr[+4LU]).stringof == "arr[4]"); -+ -+ // index == NegExp -+ static assert((arr[-4 ]).stringof == "arr[" ~ castPrefix ~ "-4]"); -+ static assert((arr[-4U ]).stringof == "arr[4294967292]"); -+ static assert((arr[int.min] ).stringof == "arr[" ~ castPrefix ~ "-2147483648]"); -+ static if (is(size_t == ulong)) -+ { -+ static assert((arr[-4L ]).stringof == "arr[" ~ castPrefix ~ "-4L]"); -+ static assert((arr[-4LU]).stringof == "arr[-4LU]"); -+ -+ // IntegerLiteral needs suffix if the value is greater than long.max -+ static assert((arr[long.max + 0]).stringof == "arr[9223372036854775807]"); -+ static assert((arr[long.max + 1]).stringof == "arr[" ~ castPrefix ~ "(9223372036854775807L + 1L)]"); -+ } -+ -+ foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)) -+ { -+ enum Int p4 = +4; -+ enum string result1 = (arr[p4]).stringof; -+ static assert(result1 == "arr[4]"); -+ -+ enum string result2 = (arr[cast(Int)+4]).stringof; -+ static assert(result2 == "arr[4]"); -+ } -+ foreach (Int; TypeTuple!(byte, short, int, long)) -+ { -+ // keep "cast(Type)" in the string representation -+ -+ enum Int m4 = -4; -+ static if (is(typeof({ size_t x = m4; }))) -+ { -+ enum string result1 = (arr[m4]).stringof; -+ static assert(result1.startsWith("arr[" ~ castPrefix)); -+ } -+ else -+ static assert(!__traits(compiles, arr[m4])); -+ -+ enum string result2 = (arr[cast(Int)-4]).stringof; -+ static assert(result2.startsWith("arr[" ~ castPrefix)); -+ } -+ } -+ -+ // SliceExp -+ { -+ // lwr,upr == IntegerExp -+ static assert((arr[4 .. 8 ]).stringof == "arr[4..8]"); -+ static assert((arr[4U .. 8U ]).stringof == "arr[4..8]"); -+ static assert((arr[4L .. 8L ]).stringof == "arr[4..8]"); -+ static assert((arr[4LU .. 8LU]).stringof == "arr[4..8]"); -+ -+ // lwr,upr == UAddExp -+ static assert((arr[+4 .. +8 ]).stringof == "arr[4..8]"); -+ static assert((arr[+4U .. +8U ]).stringof == "arr[4..8]"); -+ static assert((arr[+4L .. +8L ]).stringof == "arr[4..8]"); -+ static assert((arr[+4LU .. +8LU]).stringof == "arr[4..8]"); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test9613.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9613.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+// PREMUTE_ARGS: -+struct S9613 -+{ -+ int f( -+ const(byte) a = const(byte).init, -+ immutable(byte) b = immutable(byte).init, -+ shared(byte) c = shared(byte).init, -+ inout(byte) d = inout(byte).init, -+ ) inout -+ { -+ assert(a == byte.init); -+ assert(b == byte.init); -+ assert(c == byte.init); -+ assert(d == byte.init); -+ static assert(const(byte).init == byte.init); -+ static assert(immutable(byte).init == byte.init); -+ static assert(shared(byte).init == byte.init); -+ static assert(inout(byte).init == byte.init); -+ return 0; -+ } -+} -+ -+void main() -+{ -+ static assert(const(byte).init == byte.init); -+ static assert(immutable(byte).init == byte.init); -+ static assert(shared(byte).init == byte.init); -+ static assert(const(byte).init.sizeof == byte.sizeof); -+ static assert(const(byte[2]).init[0] == byte.init); -+ enum s = S9613(); -+ enum v = s.f(); -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test9672.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9672.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+module test9672; // node -+ -+import imports.test9672a; // interpret -+ -+mixin template ForwardCtor() -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/test9692a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9692a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module test9692a; -+int j; ---- a/src/gcc/testsuite/gdc.test/compilable/test9692.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9692.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+module test9692; -+ -+import test9692a; -+import imports.test9692b; -+ -+enum x = [__traits(allMembers, imports.test9692b)]; // ok -+enum y = [__traits(allMembers, test9692a)]; // ng: should work ---- a/src/gcc/testsuite/gdc.test/compilable/test9818.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9818.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,76 @@ -+/************************************/ -+// 9818 -+ -+/* -+TEST_OUTPUT: -+--- -+sa1: [1, 1, 1] -+ea1: [1, 1, 1] -+sa2: [1, 1, 1] -+ea2: [1, 1, 1] -+eas: [1, 1, 1] -+eac: [1, 1, 1] -+sa3: [1, 1, 1] -+ea3: [1, 1, 1] -+sa4: [1, 1, 1] -+ea4: [1, 1, 1] -+--- -+*/ -+ -+static const int[3] sa1 = 1; -+pragma(msg, "sa1: ", sa1); // doesn't work -+static assert(sa1 == [1, 1, 1]); // doesn't work -+ -+enum int[3] ea1 = 1; -+pragma(msg, "ea1: ", ea1); // prints "1" - bad -+static assert(ea1 == [1, 1, 1]); // doesn't work -+ -+struct X -+{ -+ static const int[3] sa2 = 1; -+ pragma(msg, "sa2: ", sa1); // doesn't work -+ static assert(sa2 == [1, 1, 1]); // doesn't work -+ -+ enum int[3] ea2 = 1; -+ pragma(msg, "ea2: ", ea2); // prints "1" - bad -+ static assert(ea2 == [1, 1, 1]); // doesn't work -+} -+ -+struct S -+{ -+ enum int[3] eas = 1; -+} -+pragma(msg, "eas: ", S.eas); -+static assert(S.eas == [1, 1, 1]); -+class C -+{ -+ enum int[3] eac = 1; -+} -+pragma(msg, "eac: ", C.eac); -+static assert(C.eac == [1, 1, 1]); -+ -+void test() -+{ -+ static const int[3] sa3 = 1; -+ pragma(msg, "sa3: ", sa3); // doesn't work -+ static assert(sa3 == [1, 1, 1]); // doesn't work -+ -+ enum int[3] ea3 = 1; -+ pragma(msg, "ea3: ", ea3); // prints "1" - bad -+ static assert(ea3 == [1, 1, 1]); // doesn't work -+ -+ struct Y -+ { -+ static const int[3] sa4 = 1; -+ pragma(msg, "sa4: ", sa4); // doesn't work -+ static assert(sa4 == [1, 1, 1]); // doesn't work -+ -+ enum int[3] ea4 = 1; -+ pragma(msg, "ea4: ", ea4); // prints "1" - bad -+ static assert(ea4 == [1, 1, 1]); // doesn't work -+ } -+} -+ -+/************************************/ -+ -+void main() {} ---- a/src/gcc/testsuite/gdc.test/compilable/test9919.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/test9919.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// REQUIRED_ARGS: -o- -+ -+module test9919; -+ -+public -+{ -+ import imports.test9919a; -+ import imports.test9919b; -+} ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP37_10302.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -Icompilable/extra-files -+// EXTRA_SOURCES: extra-files/pkgDIP37_10302/liba.d extra-files/pkgDIP37_10302/libb.d -+// EXTRA_FILES: extra-files/pkgDIP37_10302/package.d -+ -+module test; -+import pkgDIP37_10302; -+void main() {} ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP37_10354.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -o- -Icompilable/extra-files -+// EXTRA_FILES: extra-files/pkgDIP37_10354/mbar.d extra-files/pkgDIP37_10354/mfoo.d extra-files/pkgDIP37_10354/package.d -+ -+module testDIP37_10354; -+import pkgDIP37_10354.mfoo; -+void main() -+{ -+ import pkgDIP37_10354; -+ foo!string(); // OK -+ bar!string(); // OK <- ICE -+} ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP37_10421.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -Icompilable/extra-files -+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/algo/package.d -+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/algo/mod.d -+// EXTRA_SOURCES: extra-files/pkgDIP37_10421/except.d -+ -+module testDIP37_10421; -+import pkgDIP37_10421.algo; -+void main() {} ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP37a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP37a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -Icompilable/extra-files -+// EXTRA_SOURCES: extra-files/pkgDIP37/datetime/package.d -+// EXTRA_SOURCES: extra-files/pkgDIP37/datetime/common.d -+ -+void main() -+{ -+} ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP37.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP37.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,37 @@ -+// PERMUTE_ARGS: -+// REQUIRED_ARGS: -c -Icompilable/extra-files -+// EXTRA_FILES: extra-files/pkgDIP37/datetime/common.d extra-files/pkgDIP37/datetime/package.d -+ -+void test1() -+{ -+ import pkgDIP37.datetime; -+ def(); -+ pkgDIP37.datetime.def(); -+ pkgDIP37.datetime.common.def(); -+} -+ -+void test3() -+{ -+ import pkgDIP37.datetime.common; -+ def(); -+ pkgDIP37.datetime.def(); -+ pkgDIP37.datetime.common.def(); -+} -+ -+void test4() -+{ -+ import pkgDIP37.datetime : def; -+ def(); -+ static assert(!__traits(compiles, pkgDIP37.datetime.def())); -+ static assert(!__traits(compiles, pkgDIP37.datetime.common.def())); -+} -+ -+ -+void test7() -+{ -+ static import pkgDIP37.datetime; -+ static assert(!__traits(compiles, def())); -+ pkgDIP37.datetime.def(); -+ pkgDIP37.datetime.common.def(); -+} -+ ---- a/src/gcc/testsuite/gdc.test/compilable/testDIP42.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testDIP42.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,33 @@ -+// REQUIRED_ARGS: -o- -+// PERMUTE_ARGS: -+ -+// enum ident(tpl) = Initializer; -+ -+enum isIntegral(T) = is(T == int) || is(T == long); -+static assert( isIntegral!int); -+static assert( isIntegral!long); -+static assert(!isIntegral!double); -+static assert(!isIntegral!(int[])); -+ -+version(none) -+{ -+enum -+ allSatisfy(alias pred, TL...) = -+ TL.length == 0 || (pred!(TL[0]) && allSatisfy!(pred, TL[1..$])), -+ anySatisfy(alias pred, TL...) = -+ TL.length != 0 && (pred!(TL[0]) || anySatisfy!(pred, TL[1..$])) || false; -+static assert( allSatisfy!(isIntegral, int, long)); -+static assert(!allSatisfy!(isIntegral, int, double)); -+static assert( anySatisfy!(isIntegral, int, double)); -+static assert(!anySatisfy!(isIntegral, int[], double)); -+} -+ -+// alias ident(tpl) = Type; -+ -+alias TypeTuple(TL...) = TL; -+static assert(is(TypeTuple!(int, long)[0] == int)); -+static assert(is(TypeTuple!(int, long)[1] == long)); -+ -+alias Id(T) = T, Id(alias A) = A; -+static assert(is(Id!int == int)); -+static assert(__traits(isSame, Id!TypeTuple, TypeTuple)); ---- a/src/gcc/testsuite/gdc.test/compilable/testInference.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testInference.d 2014-04-01 16:32:51.000000000 +0100 -@@ -107,7 +107,7 @@ void test7017a() pure - static assert(!__traits(compiles, map7017!((){})())); // should pass, but fails - static assert(!__traits(compiles, map7017!q{ 1 }())); // pass, OK - static assert(!__traits(compiles, map7017!foo7017())); // pass, OK -- static assert(!__traits(compiles, map7017!bar7017())); // should pass, but fails -+ static assert( __traits(compiles, map7017!bar7017())); - } - - /***************************************************/ -@@ -253,6 +253,128 @@ void test5933() - } - - /***************************************************/ -+// 10002 -+ -+void impure10002() {} -+void remove10002(alias pred, bool impure = false, Range)(Range range) -+{ -+ pred(range[0]); -+ static if (impure) impure10002(); -+} -+class Node10002 -+{ -+ Node10002 parent; -+ Node10002[] children; -+ -+ void foo() pure -+ { -+ parent.children.remove10002!(n => n is parent)(); -+ remove10002!(n => n is parent)(parent.children); -+ static assert(!__traits(compiles, parent.children.remove10002x!(n => n is parent, true)())); -+ static assert(!__traits(compiles, remove10002x!(n => n is parent, true)(parent.children))); -+ -+ Node10002 p; -+ p.children.remove10002!(n => n is p)(); -+ remove10002!(n => n is p)(p.children); -+ static assert(!__traits(compiles, p.children.remove10002x!(n => n is p, true)())); -+ static assert(!__traits(compiles, remove10002x!(n => n is p, true)(p.children))); -+ } -+} -+ -+/***************************************************/ -+// 10148 -+ -+void fa10148() {} // fa is @system -+ -+auto fb10148(T)() -+{ -+ struct A(S) -+ { -+ // [4] Parent function fb is already inferred to @safe, then -+ // fc is forcely marked @safe on default until 2.052. -+ // But fc should keep attribute inference ability -+ // by overriding the inherited @safe-ty from its parent. -+ void fc(T2)() -+ { -+ // [5] During semantic3 process, fc is not @safe on default. -+ static assert(is(typeof(&fc) == void delegate())); -+ fa10148(); -+ } -+ // [1] this is now inferred to @safe by implementing issue 7511 -+ this(S a) {} -+ } -+ -+ // [2] A!int(0) is now calling @safe function, then fb!T also be inferred to @safe -+ return A!int(0); -+} -+ -+void test10148() -+{ -+ fb10148!int.fc!int; // [0] instantiate fb -+ // [3] instantiate fc -+ -+ // [6] Afer semantic3 done, fc!int is deduced to @system. -+ static assert(is(typeof(&fb10148!int.fc!int) == void delegate() @system)); -+} -+ -+/***************************************************/ -+// 10289 -+ -+void test10289() -+{ -+ void foo(E)() -+ { -+ throw new E(""); -+ } -+ void bar(E1, E2)() -+ { -+ throw new E1(""); -+ throw new E2(""); -+ } -+ void baz(E1, E2)(bool cond) -+ { -+ if (cond) -+ throw new E1(""); -+ else -+ throw new E2(""); -+ } -+ -+ import core.exception; -+ static class MyException : Exception -+ { -+ this(string) @safe pure nothrow { super(""); } -+ } -+ -+ static assert( __traits(compiles, () nothrow { foo!Error(); })); -+ static assert( __traits(compiles, () nothrow { foo!AssertError(); })); -+ -+ static assert(!__traits(compiles, () nothrow { foo!Exception(); })); -+ static assert(!__traits(compiles, () nothrow { foo!MyException(); })); -+ -+ static assert( __traits(compiles, () nothrow { bar!(Error, Exception)(); })); -+ static assert(!__traits(compiles, () nothrow { bar!(Exception, Error)(); })); -+ -+ static assert(!__traits(compiles, () nothrow { baz!(Error, Exception)(); })); -+ static assert(!__traits(compiles, () nothrow { baz!(Exception, Error)(); })); -+} -+ -+/***************************************************/ -+// 10296 -+ -+void foo10296()() -+{ -+ int[3] a; -+ -+ void bar()() { a[1] = 2; } -+ bar(); -+ pragma(msg, typeof(bar!())); // nothrow @safe void() -+} -+pure void test10296() -+{ -+ foo10296(); -+} -+ -+/***************************************************/ - - // Add more tests regarding inferences later. - ---- a/src/gcc/testsuite/gdc.test/compilable/testVRP.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/testVRP.d 2014-04-01 16:32:51.000000000 +0100 -@@ -219,3 +219,88 @@ void bug1977_comment20() { - int b = a % 1000; - } - -+/******************************************/ -+// 9617 -+ -+void test9617() -+{ -+ void f1(int) {} -+ void f2(short) {} -+ void f3(byte) {} -+ -+ // Why these calls are accepted? -+ static assert(!__traits(compiles, f1(ulong.max))); -+ static assert(!__traits(compiles, f2(ulong.max))); -+ static assert(!__traits(compiles, f3(ulong.max))); -+ -+ // But, if argument is not constant value, compilation fails. -+ ulong x; -+ static assert(!__traits(compiles, f1(x))); // is not callable using argument types (ulong) -+ static assert(!__traits(compiles, f2(x))); // is not callable using argument types (ulong) -+ static assert(!__traits(compiles, f3(x))); // is not callable using argument types (ulong) -+ -+ void f4(uint) {} -+ void f5(ushort) {} -+ void f6(ubyte) {} -+ -+ // If parameter type is unsigned, it is collectly rejected -+ static assert(!__traits(compiles, f4(ulong.max))); // is not callable using argument types (ulong) -+ static assert(!__traits(compiles, f5(ulong.max))); // is not callable using argument types (ulong) -+ static assert(!__traits(compiles, f6(ulong.max))); // is not callable using argument types (ulong) -+} -+ -+//import std.typetuple; -+template TypeTuple(T...) { alias TypeTuple = T; } -+template staticIota(size_t end) -+{ -+ static if (0 < end) -+ alias staticIota = TypeTuple!(staticIota!(end - 1), end - 1); -+ else -+ alias staticIota = TypeTuple!(); -+} -+void test9617a() -+{ -+ alias Repr = TypeTuple!( -+ byte, "127", // T and literal representation of T.max -+ ubyte, "255", -+ short, "32767", -+ ushort, "65535", -+ int, "2147483647", -+ uint, "4294967295", -+ long, "9223372036854775807", -+ ulong, "18446744073709551615" // "" or "L" -> "signed integral overflow" -+ ); -+ alias Indices = staticIota!(Repr.length / 2); -+ -+ foreach (t; Indices) -+ { -+ alias T = Repr[t * 2]; -+ void func(T)(T) {} -+ alias func!T f; -+ -+ foreach (r; Indices) -+ { -+ alias S = Repr[r * 2]; -+ S src = S.max; -+ -+ enum x = Repr[r * 2 + 1]; -+ foreach (repr; TypeTuple!(S.stringof~".max", x~"", x~"U", x~"L", x~"LU")) -+ { -+ static if (S.sizeof != T.sizeof) -+ static if (is(typeof(mixin(repr)) R)) -+ { -+ // "Compilable" test should be equal, even if -+ // the given argument is either constant or runtime variable. -+ enum ct = __traits(compiles, f( mixin(repr) )); -+ enum rt = __traits(compiles, f( src )); -+ -+ static assert(ct == rt); -+ //import std.string; -+ //enum msg = format("%6s.max to %-6s variable/constant = %d/%d, constant_repr = (%s) %s", -+ // S.stringof, T.stringof, rt, ct, R.stringof, repr); -+ //static if (ct != rt) pragma(msg, msg); -+ } -+ } -+ } -+ } -+} ---- a/src/gcc/testsuite/gdc.test/compilable/xheader.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/compilable/xheader.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - // PERMUTE_ARGS: --// REQUIRED_ARGS: -H -Hdtest_results/compilable -+// REQUIRED_ARGS: -H -Hd${RESULTS_DIR}/compilable - // POST_SCRIPT: compilable/extra-files/xheader-postscript.sh - - // for D 2.0 only -@@ -40,3 +40,6 @@ class C4(T) - { - T x; - } -+ -+ -+auto flit = 3 / 2.0; ---- a/src/gcc/testsuite/gdc.test/d_do_test.exp 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/d_do_test.exp 2014-04-01 16:32:51.000000000 +0100 -@@ -22,30 +22,40 @@ load_lib gdc-dg.exp - proc gdc-convert-args { args } { - set out "" - -- if [regexp -- "-c" $args] { -+ if [regexp -- {-c} $args] { - lappend out "-c" - } -- if [regexp -- "-d" $args] { -- lappend out "-Wno-deprecated" -+ if [regexp -- {-d} $args] { -+ if [regexp -- {-de} $args] { -+ lappend out "-Wdeprecated" -+ lappend out "-Werror" -+ } else { -+ lappend out "-Wno-deprecated" -+ } - } -- if [regexp -- "-de" $args] { -- lappend out "-Wdeprecated" -- lappend out "-Werror" -+ if [regexp -- {-g} $args] { -+ lappend out "-g" - } -- if [regexp -- "-inline" $args] { -+ if [regexp -- {-inline} $args] { - lappend out "-finline-functions" - } -- if [regexp -- "-property" $args] { -+ if [regexp -- {-property} $args] { - lappend out "-fproperty" - } -- if [regexp -- "-unittest" $args] { -+ if [regexp -- {-unittest} $args] { - lappend out "-funittest" - } -- if [regexp -- "-w" $args] { -- lappend out "-Wall" -- lappend out "-Werror" -+ if [regexp -- {-w} $args] { -+ if [regexp -- {-wi} $args] { -+ lappend out "-Wall" -+ lappend out "-Wno-error" -+ } else { -+ lappend out "-Wall" -+ lappend out "-Werror" -+ } - } - -+ - set i 0 - while { [regexp -start $i -indices -- {-I([\w/-]+)} $args i j] } { - set i [lindex $j 0] -@@ -146,7 +156,7 @@ proc dmd2dg { base test } { - set out_line $copy_line - - # PERMUTE_ARGS. Must be handled separately -- if [regexp -- {//\s*PERMUTE_ARGS\s*:\s*(.*)} $copy_line m m0] { -+ if [regexp -- {PERMUTE_ARGS\s*:\s*(.*)} $copy_line m m0] { - set PERMUTE_ARGS [gdc-convert-args $m0] - continue - } -@@ -165,7 +175,7 @@ proc dmd2dg { base test } { - # Can be handled with dg directives. - - # Handle EXECUTE_ARGS option. -- if [regexp -- {//\s*EXECUTE_ARGS\s*:\s*(.*)} $copy_line m m0] { -+ if [regexp -- {EXECUTE_ARGS\s*:\s*(.*)} $copy_line m m0] { - foreach arg $m0 { - lappend EXECUTE_ARGS $arg - } -@@ -173,7 +183,17 @@ proc dmd2dg { base test } { - } - - # Handle EXTRA_SOURCES option -- if [regexp -- {//\s*EXTRA_SOURCES\s*:\s*(.*)} $copy_line m m0] { -+ if [regexp -- {EXTRA_SOURCES\s*:\s*(.*)} $copy_line m m0] { -+ # Iterate imports and convert -+ foreach import $m0 { -+ # print "Import: $base $type/$import" -+ gdc-copy-extra $base "$type/$import" -+ } -+ set out_line "// { dg-additional-sources \"$m0\" }" -+ } -+ -+ # Handle EXTRA_CPP_SOURCES option -+ if [regexp -- {EXTRA_CPP_SOURCES\s*:\s*(.*)} $copy_line m m0] { - # Iterate imports and convert - foreach import $m0 { - # print "Import: $base $type/$import" -@@ -183,7 +203,7 @@ proc dmd2dg { base test } { - } - - # Handle EXTRA_FILES option -- if [regexp -- {//\s*EXTRA_FILES\s*:\s*(.*)} $copy_line m m0] { -+ if [regexp -- {EXTRA_FILES\s*:\s*(.*)} $copy_line m m0] { - # Iterate imports and convert - foreach import $m0 { - # print "Import: $base $type/$import" -@@ -193,7 +213,7 @@ proc dmd2dg { base test } { - } - - # REQUIRED_ARGS. -- if [regexp -- {//\s*REQUIRED_ARGS\s*:\s*(.*)} $copy_line m m0] { -+ if [regexp -- {REQUIRED_ARGS\s*:\s*(.*)} $copy_line m m0] { - set out_line "// { dg-additional-options \"[gdc-convert-args $m0]\" }" - } - puts $fdout $out_line -@@ -298,7 +318,7 @@ proc gdc-do-test { } { - } - - # Cleanup -- file delete $filename -+ #file delete $filename - } - - # All done. ---- a/src/gcc/testsuite/gdc.test/fail_compilation/aacmp10381.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/aacmp10381.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/aacmp10381.d(12): Error: > is not defined for associative arrays -+--- -+*/ -+ -+bool test10381() -+{ -+ int[int] aa1 = [0: 1]; -+ int[int] aa2 = [0: 1]; -+ return aa1 > aa2; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/bug8891.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/bug8891.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/bug8891.d(21): Error: need 'this' for opCall type S(int n) -+fail_compilation/bug8891.d(21): Error: need 'this' for 'opCall' of type 'S(int n)' - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/circ10280.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/circ10280.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/circ10280.d(11): Error: circular initialization of q10280 -+fail_compilation/circ10280.d(10): called from here: foo10280() -+--- -+*/ -+// 10280 -+ -+const int q10280 = foo10280(); -+int foo10280() { return q10280; } -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/class1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/class1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,10 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/class1.d(11): Error: class class1.C identity assignment operator overload is illegal -+--- -+*/ -+ - class C - { - // Non-templated identity opAssign ---- a/src/gcc/testsuite/gdc.test/fail_compilation/class2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/class2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,10 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/class2.d(11): Error: class class2.C identity assignment operator overload is illegal -+--- -+*/ -+ - class C - { - // Templated identity opAssign ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ctfe10989.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ctfe10989.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ctfe10989.d(11): Error: Uncaught CTFE exception object.Exception("abc"c) -+fail_compilation/ctfe10989.d(14): called from here: throwing() -+fail_compilation/ctfe10989.d(14): while evaluating: static assert(throwing()) -+--- -+*/ -+int throwing() -+{ -+ throw new Exception(['a','b','c']); -+ return 0; -+} -+static assert(throwing()); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ctfe10995.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ctfe10995.d(19): Error: cannot read uninitialized variable a in CTFE -+fail_compilation/ctfe10995.d(25): Error: cannot read uninitialized variable a in CTFE -+--- -+*/ -+struct T -+{ -+ short a = void; -+} -+ -+T foo() -+{ -+ auto t = T.init; -+ return t; -+} -+ -+enum i = foo().a; -+ -+struct T2 -+{ -+ short a = void; -+} -+enum i2 = T2.init.a; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/depmsg.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/depmsg.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ --// REQUIRED_ARGS: -de - /* -+REQUIRED_ARGS: -de - TEST_OUTPUT: - --- - fail_compilation/depmsg.d(20): Deprecation: struct depmsg.main.Inner.A is deprecated - With message! ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10089.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10089.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,18 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10089.d(15): Error: undefined identifier 'chunks' -+fail_compilation/diag10089.d(17): Error: no property 'chunks' for type 'void' -+--- -+*/ -+ -+import imports.diag10089a, imports.diag10089b; -+ -+template Foo() {} -+ -+void main() -+{ -+ imports.chunks("abcdef", 2); -+ -+ Foo.chunks("abcdef", 2); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10099.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10099.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10099.d(15): Error: variable diag10099.main.s default construction is disabled for type S -+--- -+*/ -+ -+struct S -+{ -+ @disable this(); -+} -+ -+void main() -+{ -+ S s; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10141.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10141.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10141.d(9): Error: module imports.diag10141a import 'unexisting_symbol' not found -+--- -+*/ -+ -+import imports.diag10141a; -+import imports.diag10141a : unexisting_symbol; -+ -+Tuple!(int) fun() -+{ -+ return Tuple!(int).init; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10319.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10319.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,27 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10319.d(25): Error: pure function 'D main' cannot call impure function 'diag10319.foo' -+fail_compilation/diag10319.d(25): Error: safe function 'D main' cannot call system function 'diag10319.foo' -+fail_compilation/diag10319.d(26): Error: pure function 'D main' cannot call impure function 'diag10319.bar!int.bar' -+fail_compilation/diag10319.d(26): Error: safe function 'D main' cannot call system function 'diag10319.bar!int.bar' -+fail_compilation/diag10319.d(25): Error: 'diag10319.foo' is not nothrow -+fail_compilation/diag10319.d(26): Error: 'diag10319.bar!int.bar' is not nothrow -+fail_compilation/diag10319.d(23): Error: function 'D main' is nothrow yet may throw -+--- -+*/ -+ -+void foo() {} -+ -+void bar(T)() -+{ -+ static int g; g = 10; // impure -+ int x; auto p = &x; // system -+ throw new Exception(""); // may throw -+} -+ -+@safe pure nothrow void main() // L23 -+{ -+ foo(); // L25 -+ bar!int(); // L26 -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10327.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10327.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+import imports.test10327; // package.d missing ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10359.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10359.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10359.d(10): Error: pointer slicing not allowed in safe functions -+--- -+*/ -+ -+void foo(int* p) @safe -+{ -+ auto a = p[0 .. 10]; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10405.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10405.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10405.d(10): Error: cannot return non-void from void function -+--- -+*/ -+ -+void main() -+{ -+ return 10; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10415.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10415.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,38 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10415.d(34): Error: c.x is not an lvalue -+fail_compilation/diag10415.d(37): Error: d.x is not an lvalue -+--- -+*/ -+ -+class C -+{ -+ @property int x() const -+ { -+ return 0; -+ } -+ -+ @property void x(int) -+ { -+ } -+} -+ -+template AddProp() { @property int x() { return 1; } } -+template AddFunc() { void x(int, int) {} } -+ -+class D -+{ -+ // overloadset -+ mixin AddProp; -+ mixin AddFunc; -+} -+ -+void main() -+{ -+ const c = new C(); -+ c.x = 1; -+ -+ auto d = new D(); -+ d.x = 1; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10688.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10688.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10688.d(12): Error: function diag10688.Bar.foo private method is not virtual and cannot override -+fail_compilation/diag10688.d(14): Error: function diag10688.Bar.bar package method is not virtual and cannot override -+--- -+*/ -+ -+class Bar -+{ -+private: -+ override void foo() { } -+package: -+ override void bar() { } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10783.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10783.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,18 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10783.d(14): Error: no property 'type' for type 'Event' -+fail_compilation/diag10783.d(14): Error: undefined identifier En -+--- -+*/ -+ -+struct Event { } -+ -+void main() -+{ -+ Event event; -+ switch (event.type) with (En) -+ { -+ default: -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10792.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10792.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10792.d(2): Error: semicolon expected to close enum declaration -+--- -+*/ -+ -+#line 1 -+enum isPred(T) = asdf ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10862.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10862.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,17 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10862.d(13): Error: assignment cannot be used as a condition, perhaps == was meant? -+fail_compilation/diag10862.d(14): Error: assignment cannot be used as a condition, perhaps == was meant? -+fail_compilation/diag10862.d(15): Error: assignment cannot be used as a condition, perhaps == was meant? -+--- -+*/ -+ -+void main() -+{ -+ int a, b; -+ if ((a = b) = 0) { } -+ if ((a = b) = (a = b)) { } -+ if (a + b = a * b) { } -+ semanticError; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag10984.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag10984.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag10984.d(11): Error: static function diag10984.f.n cannot access frame of function diag10984.f -+--- -+*/ -+ -+void f() -+{ -+ int x; -+ static void n() { x++; } -+} -+ -+void main() -+{ -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag11088.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag11088.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,18 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag11088.d(11): Error: enum member diag11088.E.B initialization with (E.A + 1) causes overflow for type 'int' -+fail_compilation/diag11088.d(17): Error: enum member diag11088.E1.B initialization with (E1.A + 1) causes overflow for type 'short' -+--- -+*/ -+enum E -+{ -+ A = int.max, -+ B -+} -+ -+enum E1 : short -+{ -+ A = short.max, -+ B -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag11132.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag11132.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,23 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag11132.d(22): Error: overlapping initialization for field a and b -+--- -+*/ -+ -+struct S -+{ -+ int x; -+ union -+ { -+ int a; -+ int b; -+ } -+ -+ int z; -+} -+ -+void main() -+{ -+ S s = { 1, 2, 3 }; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag2452.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag2452.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag2452.d(14): Error: class diag2452.C interface function I.f(float p) isn't implemented -+fail_compilation/diag2452.d(14): Error: class diag2452.C interface function 'void f(float p)' is not implemented - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag3673.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag3673.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag3673.d(9): Error: members expected -+--- -+*/ -+ -+class A {} -+class B(T) if(false) : A if (true) { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag4285.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag4285.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,12 +0,0 @@ --/* --TEST_OUTPUT: ----- --fail_compilation/diag4285.d(2): Error: template definitions aren't allowed inside functions --fail_compilation/diag4285.d(3): Error: unrecognized declaration ----- --*/ -- --#line 1 --void main() { -- template Foo() {} --} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag4479.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag4479.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+// EXTRA_SOURCES: imports/fail4479.d -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag4479.d(10): Error: module imports.fail4479mod from file fail_compilation/imports/fail4479.d must be imported as module 'imports.fail4479mod' -+--- -+*/ -+ -+module diag4479; -+import imports.fail4479; -+void main() { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag4528.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag4528.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag4528.d(14): Error: function diag4528.Foo.pva private functions cannot be abstract -+fail_compilation/diag4528.d(15): Error: function diag4528.Foo.pka package functions cannot be abstract -+fail_compilation/diag4528.d(16): Error: function diag4528.Foo.pvsa static functions cannot be abstract -+fail_compilation/diag4528.d(17): Error: function diag4528.Foo.pksa static functions cannot be abstract -+fail_compilation/diag4528.d(18): Error: function diag4528.Foo.pbsa static functions cannot be abstract -+--- -+*/ -+ -+class Foo -+{ -+ private abstract void pva(); -+ package abstract void pka(); -+ private static abstract void pvsa(); -+ package static abstract void pksa(); -+ public static abstract void pbsa(); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag5450.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag5450.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag5450.d(18): Error: class diag5450.C Cannot implicitly generate a default ctor when base class diag5450.B is missing a default ctor -+--- -+*/ -+ -+class A -+{ -+ this() { } -+} -+ -+class B : A -+{ -+ this(int f) {} -+} -+ -+class C : B -+{ -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag6373.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag6373.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ --// REQUIRED_ARGS: -de - /* -+REQUIRED_ARGS: -de - TEST_OUTPUT: - --- - fail_compilation/diag6373.d(7): Deprecation: class diag6373.Bar use of diag6373.Foo.method(double x) hidden by Bar is deprecated. Use 'alias Foo.method method;' to introduce base class overload set. ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag6539.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag6539.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,23 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag6539.d(21): Error: overloadset diag6539.Rectangle is used as a type -+--- -+*/ -+ -+mixin template foo() -+{ -+ struct Rectangle(T) {} -+} -+ -+mixin template bar() -+{ -+ bool Rectangle(bool, int, int, int, int) {} -+} -+ -+mixin foo; -+mixin bar; -+ -+void test(Rectangle rect) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag6717.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag6717.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag6717.d(12): Error: end of instruction expected, not 'h' -+--- -+*/ -+ -+void main() -+{ -+ asm -+ { -+ mov AX, 12h ; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag7050c.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag7050c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag7050c.d(7): Error: safe function 'diag7050c.B.~this' cannot call system function 'diag7050c.A.~this' -+fail_compilation/diag7050c.d(6): Error: safe function 'diag7050c.B.~this' cannot call system function 'diag7050c.A.~this' - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag7420.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag7420.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,16 +2,16 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag7420.d(3): Error: variable x cannot be read at compile time -+fail_compilation/diag7420.d(3): Error: static variable x cannot be read at compile time - fail_compilation/diag7420.d(3): while evaluating: static assert(x < 4) --fail_compilation/diag7420.d(4): Error: variable y cannot be read at compile time -+fail_compilation/diag7420.d(4): Error: static variable y cannot be read at compile time - fail_compilation/diag7420.d(4): while evaluating: static assert(y == "abc") --fail_compilation/diag7420.d(5): Error: variable y cannot be read at compile time -+fail_compilation/diag7420.d(5): Error: static variable y cannot be read at compile time - fail_compilation/diag7420.d(5): while evaluating: static assert(cast(ubyte[])y != null) --fail_compilation/diag7420.d(6): Error: variable y cannot be read at compile time --fail_compilation/diag7420.d(6): while evaluating: static assert(cast(int)y[0u] == 1) --fail_compilation/diag7420.d(7): Error: variable y cannot be read at compile time --fail_compilation/diag7420.d(7): while evaluating: static assert(y[0u..1u].length == 1u) -+fail_compilation/diag7420.d(6): Error: static variable y cannot be read at compile time -+fail_compilation/diag7420.d(6): while evaluating: static assert(cast(int)y[0] == 1) -+fail_compilation/diag7420.d(7): Error: static variable y cannot be read at compile time -+fail_compilation/diag7420.d(7): while evaluating: static assert(y[0..1].length == 1u) - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8178.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8178.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag8178.d(5): Error: Cannot modify '""' -+fail_compilation/diag8178.d(5): Error: Cannot modify 's' - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8318.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8318.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,39 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag8318.d(13): Error: function diag8318.Bar8318.foo return type inference is not supported if may override base class function -+--- -+*/ -+class Foo8318 -+{ -+ auto foo() { return "Foo.foo"; } -+} -+class Bar8318 : Foo8318 -+{ -+ override auto foo() { return "Bar.foo"; } -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag8318.d(24): Error: function diag8318.C10021.makeI return type inference is not supported if may override base class function -+--- -+*/ -+interface I10021 { I10021 makeI(); } -+class D10021 : I10021 { D10021 makeI() { return this; } } -+class C10021 : I10021 { auto makeI() { return this; } } -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag8318.d(38): Error: function diag8318.Bar10195.baz return type inference is not supported if may override base class function -+--- -+*/ -+interface Foo10195 -+{ -+ int baz(); -+} -+class Bar10195 : Foo10195 -+{ -+ override auto baz() { return 1; } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8354.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8354.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,15 +0,0 @@ --/* --TEST_OUTPUT: ----- --fail_compilation/diag8354.d(3): Error: must import std.math to use ^^ operator --fail_compilation/diag8354.d(5): Error: must import std.math to use ^^ operator ----- --*/ -- --#line 1 --void main() { -- int x1 = 10; -- auto y1 = x1 ^^ 5; -- double x2 = 10.5; -- auto y2 = x2 ^^ 5; --} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8629.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8629.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,7 +2,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag8629.d(9): Error: no property 'gunc' for type 'S' -+fail_compilation/diag8629.d(9): Error: not a property s.gunc - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8697.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8697.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag8697.d(12): Error: no property 'Invalid' for type 'diag8697.Base' -+fail_compilation/diag8697.d(12): Error: Base.Invalid is used as a type -+--- -+*/ -+ -+interface InterBase : InterRoot { } -+class Base : InterBase { } -+ -+void test(Base.Invalid) { } -+ -+interface InterRoot { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8770.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8770.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,19 +0,0 @@ --/* --TEST_OUTPUT: ----- --fail_compilation/diag8770.d(3): Error: cannot modify immutable expression 1 --fail_compilation/diag8770.d(6): Error: constant this.f is not an lvalue ----- --*/ -- --#line 1 --class Foo --{ -- immutable f = 1; -- this() -- { -- this.f = 1; -- } --} -- --void main() {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8825.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8825.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag8825.d(13): Error: undefined identifier foo -+--- -+*/ -+ -+template t(alias a){ -+ alias int t; -+} -+ -+void main(){ -+ t!(foo // line 13 -+ -+ -+ -+ -+ -+ ) i; // line 19 -+ return; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8892.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8892.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,8 +1,7 @@ --// REQUIRED_ARGS: -m32 - /* - TEST_OUTPUT: - --- --fail_compilation/diag8892.d(15): Error: cannot implicitly convert expression (['A']) of type char[] to char[2u] -+fail_compilation/diag8892.d(14): Error: cannot implicitly convert expression (['A']) of type char[] to char[2] - --- - */ - struct Foo ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag8928.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag8928.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,8 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag8928.d(7): Error: constructor diag8928.Y.this no match for implicit super() call in constructor --fail_compilation/diag8928.d(10): Error: constructor diag8928.Z.this no match for implicit super() call in implicitly generated constructor -+fail_compilation/diag8928.d(10): Error: class diag8928.Z Cannot implicitly generate a default ctor when base class diag8928.X is missing a default ctor - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9004.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9004.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,10 +1,9 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag9004.d(4): Error: undefined identifier FooT.T - fail_compilation/diag9004.d(8): Error: template diag9004.bar does not match any function template declaration. Candidates are: - fail_compilation/diag9004.d(4): diag9004.bar(FooT)(FooT foo, FooT.T x) --fail_compilation/diag9004.d(8): Error: template diag9004.bar(FooT)(FooT foo, FooT.T x) cannot deduce template function from argument types !()(Foo!(int),int) -+fail_compilation/diag9004.d(8): Error: template diag9004.bar(FooT)(FooT foo, FooT.T x) cannot deduce template function from argument types !()(Foo!int, int) - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9210a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9210a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4,6 +4,7 @@ - /* - TEST_OUTPUT: - --- -+fail_compilation/imports/diag9210stdcomplex.d(13): Error: template instance Complex!real does not match template declaration Complex(T) if (isFloatingPoint!T) - fail_compilation/imports/diag9210b.d(6): Error: undefined identifier A, did you mean interface B? - --- - */ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9241.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9241.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+// REQUIRED_ARGS: -property -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9241.d(18): Error: not a property s.splitLines -+fail_compilation/diag9241.d(18): Error: cannot implicitly convert expression (splitLines(s)) of type string[] to string -+--- -+*/ -+ -+S[] splitLines(S)(S s) -+{ -+ return null; -+} -+ -+void main() -+{ -+ string s; -+ s = s.splitLines; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9247.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9247.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9247.d(11): Error: cannot return opaque struct S by value -+fail_compilation/diag9247.d(12): Error: cannot return opaque struct S by value -+--- -+*/ -+ -+struct S; -+ -+S foo(); -+S function() bar; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9312.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9312.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/diag9312.d(10): Error: with expressions must be aggregate types, not 'int' -+fail_compilation/diag9312.d(10): Error: with expressions must be aggregate types or pointers to them, not 'int' - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9357.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9357.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9357.d(14): Error: cannot implicitly convert expression (1.00000) of type double to int -+fail_compilation/diag9357.d(15): Error: cannot implicitly convert expression (10.0000) of type double to int -+fail_compilation/diag9357.d(16): Error: cannot implicitly convert expression (11.0000) of type double to int -+fail_compilation/diag9357.d(17): Error: cannot implicitly convert expression (99.0000) of type double to int -+fail_compilation/diag9357.d(18): Error: cannot implicitly convert expression (1.04858e+06) of type real to int -+fail_compilation/diag9357.d(19): Error: cannot implicitly convert expression (1.04858e+06) of type real to int -+--- -+*/ -+void main() -+{ -+ { int x = 1.0; } -+ { int x = 10.0; } -+ { int x = 11.0; } -+ { int x = 99.0; } -+ { int x = 1048575.0L; } -+ { int x = 1048576.0L; } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9420.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9420.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,8 +1,7 @@ - /* - TEST_OUTPUT - --- --fail_compilation/diag9420.d(21): Error: function diag9420.S.t3!().tx () is not callable using argument types (int) --fail_compilation/diag9420.d(21): Error: expected 0 arguments, not 1 for non-variadic function type pure nothrow @safe void() -+fail_compilation/diag9420.d(20): Error: function diag9420.S.t3!().tx () is not callable using argument types (int) - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9451.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9451.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,27 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9451.d(26): Error: cannot create instance of abstract class C2 -+fail_compilation/diag9451.d(26): function 'void f1()' is not implemented -+fail_compilation/diag9451.d(26): function 'void f2(int)' is not implemented -+fail_compilation/diag9451.d(26): function 'void f2(float) const' is not implemented -+fail_compilation/diag9451.d(26): function 'int f2(float) pure' is not implemented -+--- -+*/ -+ -+class C1 -+{ -+ abstract void f1(); -+ abstract void f2(int); -+ abstract void f2(float) const; -+ abstract int f2(float) pure; -+} -+ -+class C2 : C1 -+{ -+} -+ -+void main() -+{ -+ auto c2 = new C2; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9479.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9479.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9479.d(10): Error: undefined identifier something_undefined -+--- -+*/ -+ -+int delegate() bug9479() -+{ -+ return { return something_undefined; }; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9574.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9574.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9574.d(12): Error: Cannot use syntax 'alias this = x', use 'alias x this' instead -+fail_compilation/diag9574.d(18): Error: Cannot use syntax 'alias this = x', use 'alias x this' instead -+--- -+*/ -+ -+struct S -+{ -+ int x; -+ alias this = x; -+} -+ -+class C -+{ -+ int x; -+ alias this = x; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9635.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9635.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+// REQUIRED_ARGS: -m32 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9635.d(17): Error: need 'this' for 'i' of type 'int' -+fail_compilation/diag9635.d(18): Error: need 'this' for 'foo' of type 'pure nothrow @safe void()' -+--- -+*/ -+ -+struct Foo -+{ -+ int i; -+ void foo()() { } -+ -+ static void bar() -+ { -+ i = 4; -+ foo(); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9679.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9679.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9679.d(11): Error: variable diag9679.main.n only parameters or foreach declarations can be ref -+fail_compilation/diag9679.d(12): Error: variable diag9679.main.n storage class 'auto' has no effect if type is not inferred, did you mean 'scope'? -+--- -+*/ -+ -+void main() -+{ -+ if (ref n = 1) {} -+ if (auto int n = 1) {} -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9880.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9880.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9880.d(9): Error: template instance foo!string does not match template declaration foo(T)(int) if (is(T == int)) -+--- -+*/ -+ -+void foo(T)(int) if (is(T == int)) {} -+void main() { alias f = foo!string; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/diag9961.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/diag9961.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/diag9961.d(11): Error: cannot implicitly convert expression ("") of type string to int -+fail_compilation/diag9961.d(14): Error: template instance diag9961.foo!int error instantiating -+fail_compilation/diag9961.d(11): Error: cannot implicitly convert expression ("") of type string to int -+fail_compilation/diag9961.d(15): Error: template instance diag9961.foo!char error instantiating -+--- -+*/ -+ -+void foo(T)(T) { int x = ""; } -+void main() -+{ -+ 100.foo(); -+ 'a'.foo; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/enum9921.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/enum9921.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/enum9921.d(1): Error: enum enum9921.X base type must not be void -+fail_compilation/enum9921.d(3): Error: enum enum9921.Z base type must not be void -+--- -+*/ -+ -+#line 1 -+enum X : void; -+ -+enum Z : void { Y }; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10082.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10082.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10082.d(24): Error: cannot infer type from overloaded function symbol &foo -+--- -+*/ -+ -+mixin template T() -+{ -+ int foo() -+ { -+ return 0; -+ } -+} -+ -+class A -+{ -+ mixin T; -+ mixin T; -+} -+ -+void main() -+{ -+ auto x = &A.foo; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10102.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10102.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,52 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10102.d(48): Error: variable fail10102.main.m default construction is disabled for type NotNull!(int*) -+fail_compilation/fail10102.d(49): Error: variable fail10102.main.a default construction is disabled for type NotNull!(int*)[3] -+fail_compilation/fail10102.d(50): Error: default construction is disabled for type NotNull!(int*) -+fail_compilation/fail10102.d(51): Error: field S.m must be initialized because it has no default constructor -+--- -+*/ -+ -+struct NotNull(T) -+{ -+ T p; -+ -+ alias p this; -+ -+ this(T p) -+ { -+ assert(p != null, "pointer is null"); -+ this.p = p; -+ } -+ -+ @disable this(); -+ -+ NotNull opAssign(T p) -+ { -+ assert(p != null, "assigning null to NotNull"); -+ this.p = p; -+ return this; -+ } -+} -+ -+void main() -+{ -+ struct S -+ { -+ NotNull!(int *) m; -+ // should fail: an explicit constructor must be required for S -+ } -+ -+ int i; -+ NotNull!(int*) n = &i; -+ *n = 3; -+ assert(i == 3); -+ n = &i; -+ n += 1; -+ -+ NotNull!(int*) m; // should fail -+ NotNull!(int*)[3] a; // should fail -+ auto b = new NotNull!(int*)[3]; // should fail -+ S s = S(); // should fail -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10115.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10115.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,51 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10115.d(38): Error: cannot have out parameter of type S because the default construction is disbaled -+fail_compilation/fail10115.d(38): Error: cannot have out parameter of type E because the default construction is disbaled -+fail_compilation/fail10115.d(38): Error: cannot have out parameter of type U because the default construction is disbaled -+fail_compilation/fail10115.d(43): Error: struct fail10115.S default construction is disabled -+fail_compilation/fail10115.d(44): Error: struct fail10115.S default construction is disabled -+fail_compilation/fail10115.d(45): Error: union fail10115.U default construction is disabled -+fail_compilation/fail10115.d(48): Error: struct fail10115.S default construction is disabled -+fail_compilation/fail10115.d(49): Error: struct fail10115.S default construction is disabled -+fail_compilation/fail10115.d(50): Error: union fail10115.U default construction is disabled -+--- -+*/ -+ -+struct S -+{ -+ int a; -+ @disable this(); -+ this(int) { a = 1; } -+ ~this() { assert(a !is 0); } -+} -+ -+enum E : S -+{ -+ A = S.init -+} -+ -+union U -+{ -+ S s; -+ this(this) { assert (s.a !is 0); } -+ ~this() { assert (s.a !is 0); } -+} -+ -+void main() -+{ -+ void foo(out S s, out E e, out U u) { } -+ -+ S[] a; -+ E[] e; -+ U[] u; -+ a.length = 5; // compiles -> NG -+ e.length = 5; // compiles -> NG -+ u.length = 5; // compiles -> NG -+ -+ S[1] x = (S[1]).init; -+ foo(a[0], // compiles -> NG -+ e[0], // compiles -> NG -+ u[0]); // compiles -> NG -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10254.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10254.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10254.d(18): Error: pure function 'fail10254.foo' cannot call impure function 'fail10254.C.this' -+fail_compilation/fail10254.d(18): Error: safe function 'fail10254.foo' cannot call system function 'fail10254.C.this' -+fail_compilation/fail10254.d(19): Error: pure function 'fail10254.foo' cannot call impure function 'fail10254.S.this' -+fail_compilation/fail10254.d(19): Error: safe function 'fail10254.foo' cannot call system function 'fail10254.S.this' -+--- -+*/ -+ -+int a; -+ -+class C { this() { a = 2; } } -+struct S { this(int) { a = 2; } } -+ -+void foo() pure @safe -+{ -+ auto c = new C; // This line should be a compilation error. -+ auto s = new S(1); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10277.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10277.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,30 @@ -+module fail10227; -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/fail10277.d(3): Error: class TypeInfo only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(4): Error: class TypeInfo_Class only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(5): Error: class TypeInfo_Interface only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(6): Error: class TypeInfo_Struct only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(7): Error: class TypeInfo_Typedef only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(8): Error: class TypeInfo_Pointer only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(9): Error: class TypeInfo_Array only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(10): Error: class TypeInfo_AssociativeArray only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(11): Error: class TypeInfo_Enum only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(12): Error: class TypeInfo_Function only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(13): Error: class TypeInfo_Delegate only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(14): Error: class TypeInfo_Tuple only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(15): Error: class TypeInfo_Const only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(16): Error: class TypeInfo_Invariant only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(17): Error: class TypeInfo_Shared only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(18): Error: class TypeInfo_Inout only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(19): Error: class TypeInfo_Vector only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(20): Error: class Object only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(21): Error: class Throwable only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(22): Error: class Exception only object.d can define this reserved class name -+fail_compilation/imports/fail10277.d(23): Error: class Error only object.d can define this reserved class name -+--- -+*/ -+ -+import imports.fail10277; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10299.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10299.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10299.d(11): Error: foo!string is not an lvalue -+--- -+*/ -+ -+template foo(T) -+{ -+} -+auto fp = &foo!string; // ICE ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10346.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10346.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,17 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10346.d(12): Error: undefined identifier T -+fail_compilation/fail10346.d(16): Error: template fail10346.bar does not match any function template declaration. Candidates are: -+fail_compilation/fail10346.d(12): fail10346.bar(T x, T)(Foo!T) -+fail_compilation/fail10346.d(16): Error: template fail10346.bar(T x, T)(Foo!T) cannot deduce template function from argument types !(10)(Foo!int) -+--- -+*/ -+ -+struct Foo(T) {} -+void bar(T x, T)(Foo!T) {} -+void main() -+{ -+ Foo!int spam; -+ bar!10(spam); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10481.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10481.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10481.d(11): Error: undefined identifier T1, did you mean alias T0? -+fail_compilation/fail10481.d(15): Error: cannot resolve type for get!(A) -+--- -+*/ -+ -+struct A {} -+ -+void get(T0 = T1.Req, Params...)(Params , T1) {} -+ -+void main() -+{ -+ auto xxx = get!A; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10534.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10534.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,41 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10534.d(28): Error: 'a' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(28): Error: 'b' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(29): Error: 'a' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(29): Error: 'b' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(30): Error: 'a' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(30): Error: 'b' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(31): Error: 'a' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(31): Error: 'b' is not of arithmetic type, it is a int delegate() -+fail_compilation/fail10534.d(36): Error: 'a' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(36): Error: 'b' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(37): Error: 'a' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(37): Error: 'b' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(38): Error: 'a' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(38): Error: 'b' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(39): Error: 'a' is not of arithmetic type, it is a int function() -+fail_compilation/fail10534.d(39): Error: 'b' is not of arithmetic type, it is a int function() -+--- -+*/ -+ -+void main() -+{ -+ { -+ int delegate() a = ()=>5; -+ int delegate() b = ()=>5; -+ auto c1 = a + b; // passes (and will crash if c1() called) -+ auto c2 = a - b; // passes (and will crash if c2() called) -+ auto c3 = a / b; // a & b not of arithmetic type -+ auto c4 = a * b; // a & b not of arithmetic type -+ } -+ { -+ int function() a = ()=>5; -+ int function() b = ()=>5; -+ auto c1 = a + b; -+ auto c2 = a - b; -+ auto c3 = a / b; -+ auto c4 = a * b; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10630.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10630.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10630.d(12): Error: cannot have out parameter of type S because the default construction is disbaled -+--- -+*/ -+ -+struct S -+{ -+ @disable this(); -+} -+void foo(out S) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10666.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10666.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,22 @@ -+// REQUIRED_ARGS: -c -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10666.d(16): Error: variable fail10666.foo10666.s1 has scoped destruction, cannot build closure -+--- -+*/ -+ -+ -+struct S10666 -+{ -+ int val; -+ ~this() {} -+} -+ -+void foo10666(S10666 s1) -+{ -+ auto f1 = (){ return () => s1.val; }(); // NG -+ -+ S10666 s2; -+ auto f2 = (){ return () => s2.val; }(); // (should be NG) -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10947.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10947.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,31 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10947.d(21): Error: cannot have immutable out parameter of type immutable(S) -+fail_compilation/fail10947.d(22): Error: cannot have immutable out parameter of type immutable(S) -+fail_compilation/fail10947.d(23): Error: cannot have immutable out parameter of type immutable(S) -+fail_compilation/fail10947.d(25): Error: cannot have const out parameter of type const(S) -+fail_compilation/fail10947.d(26): Error: cannot have const out parameter of type const(S) -+fail_compilation/fail10947.d(27): Error: cannot have const out parameter of type const(S) -+fail_compilation/fail10947.d(29): Error: cannot have inout out parameter of type inout(S) -+fail_compilation/fail10947.d(30): Error: cannot have inout out parameter of type inout(S) -+fail_compilation/fail10947.d(31): Error: cannot have inout out parameter of type inout(S) -+--- -+*/ -+ -+struct S {} -+alias SI = immutable S; -+alias SC = const S; -+alias SW = inout S; -+ -+void fooi1(out SI) {} -+void fooi2(out immutable(S)) {} -+void fooi3(out immutable S) {} -+ -+void fooc1(out SC) {} -+void fooc2(out const(S)) {} -+void fooc3(out const S) {} -+ -+void foow1(out SW) {} -+void foow2(out inout(S)) {} -+void foow3(out inout S) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10964.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10964.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,36 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10964.d(28): Error: 'fail10964.S.__cpctor' is not nothrow -+fail_compilation/fail10964.d(29): Error: 'fail10964.S.__postblit' is not nothrow -+fail_compilation/fail10964.d(30): Error: 'fail10964.S.__postblit' is not nothrow -+fail_compilation/fail10964.d(33): Error: 'fail10964.S.__cpctor' is not nothrow -+fail_compilation/fail10964.d(34): Error: 'fail10964.S.__postblit' is not nothrow -+fail_compilation/fail10964.d(35): Error: 'fail10964.S.__postblit' is not nothrow -+fail_compilation/fail10964.d(22): Error: function 'fail10964.foo' is nothrow yet may throw -+--- -+*/ -+ -+struct S -+{ -+ this(this) -+ { -+ throw new Exception("BOOM!"); -+ } -+} -+ -+void foo() nothrow -+{ -+ S ss; -+ S[1] sa; -+ -+ // TOKassign -+ ss = ss; -+ sa = ss; -+ sa = sa; -+ -+ // TOKconstruct -+ S ss2 = ss; -+ S[1] sa2 = ss; -+ S[1] sa3 = sa; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10968.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10968.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,74 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10968.d(33): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__cpctor' -+fail_compilation/fail10968.d(33): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__cpctor' -+fail_compilation/fail10968.d(34): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(34): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(35): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(35): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(38): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__cpctor' -+fail_compilation/fail10968.d(38): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__cpctor' -+fail_compilation/fail10968.d(39): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(39): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(40): Error: pure function 'fail10968.bar' cannot call impure function 'fail10968.SA.__postblit' -+fail_compilation/fail10968.d(40): Error: safe function 'fail10968.bar' cannot call system function 'fail10968.SA.__postblit' -+--- -+*/ -+ -+struct SA -+{ -+ this(this) -+ { -+ throw new Exception("BOOM!"); -+ } -+} -+ -+void bar() pure @safe -+{ -+ SA ss; -+ SA[1] sa; -+ -+ // TOKassign -+ ss = ss; -+ sa = ss; -+ sa = sa; -+ -+ // TOKconstruct -+ SA ss2 = ss; -+ SA[1] sa2 = ss; -+ SA[1] sa3 = sa; -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10968.d(66): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+fail_compilation/fail10968.d(67): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+fail_compilation/fail10968.d(68): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+fail_compilation/fail10968.d(71): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+fail_compilation/fail10968.d(72): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+fail_compilation/fail10968.d(73): Error: struct fail10968.SD is not copyable because it is annotated with @disable -+--- -+*/ -+ -+struct SD -+{ -+ this(this) @disable; -+} -+ -+void baz() -+{ -+ SD ss; -+ SD[1] sa; -+ -+ // TOKassign -+ ss = ss; -+ sa = ss; -+ sa = sa; -+ -+ // TOKconstruct -+ SD ss2 = ss; -+ SD[1] sa2 = ss; -+ SD[1] sa3 = sa; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10980.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10980.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,44 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10980.d(22): Error: variable fail10980.s1b of type struct immutable(S1) uses this(this), which is not allowed in static initialization -+fail_compilation/fail10980.d(28): Error: variable fail10980.s1d of type struct immutable(S1) uses this(this), which is not allowed in static initialization -+fail_compilation/fail10980.d(27): Error: static variable s1x cannot be read at compile time -+fail_compilation/fail10980.d(28): called from here: bar1() -+fail_compilation/fail10980.d(38): Error: variable fail10980.s2b of type struct immutable(S2) uses this(this), which is not allowed in static initialization -+fail_compilation/fail10980.d(44): Error: variable fail10980.s2d of type struct immutable(S2) uses this(this), which is not allowed in static initialization -+fail_compilation/fail10980.d(43): Error: static variable s2x cannot be read at compile time -+fail_compilation/fail10980.d(44): called from here: bar2() -+--- -+*/ -+ -+struct S1 -+{ -+ this(int) immutable {} -+ this(this) {} -+} -+alias immutable(S1) IS1; -+static immutable S1 s1a = IS1(1); // OK -+static immutable S1 s1b = s1a; // NG -+ -+S1 foo1() { S1 s1x; S1 s1y = s1x; return s1y; } -+static immutable S1 s1c = foo1(); // OK -+ -+ref S1 bar1() { static S1 s1x; return s1x; } -+static immutable S1 s1d = bar1(); // NG -+ -+ -+struct S2 -+{ -+ int val; -+ this(this) {} -+} -+alias immutable(S2) IS2; -+static immutable S2 s2a = IS2(1); // OK -+static immutable S2 s2b = s2a; // NG -+ -+S2 foo2() { S2 s2x; S2 s2y = s2x; return s2y; } -+static immutable S2 s2c = foo2(); // OK -+ -+ref S2 bar2() { static S2 s2x; return s2x; } -+static immutable S2 s2d = bar2(); // NG ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail10981.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail10981.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,34 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail10981.d(17): Error: pure nested function '__require' cannot access mutable data 'i' -+fail_compilation/fail10981.d(18): Error: pure nested function '__ensure' cannot access mutable data 'i' -+fail_compilation/fail10981.d(27): Error: pure nested function '__require' cannot access mutable data 'i' -+fail_compilation/fail10981.d(28): Error: pure nested function '__ensure' cannot access mutable data 'i' -+--- -+*/ -+ -+void foo(int i) -+in -+{ -+ class X1 -+ { -+ void in_nested() pure -+ in { assert(i); } // NG -+ out { assert(i); } // NG -+ body {} -+ } -+} -+out -+{ -+ class X2 -+ { -+ void out_nested() pure -+ in { assert(i); } // NG -+ out { assert(i); } // NG -+ body {} -+ } -+} -+body -+{ -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail11125.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail11125.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail11125.d(24): Error: template fail11125.filter does not match any function template declaration. Candidates are: -+fail_compilation/fail11125.d(15): fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool)) -+fail_compilation/fail11125.d(24): Error: template fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool)) cannot deduce template function from argument types !(function (int a) => a + 1)(int[]) -+fail_compilation/fail11125.d(25): Error: template fail11125.filter does not match any function template declaration. Candidates are: -+fail_compilation/fail11125.d(15): fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool)) -+fail_compilation/fail11125.d(25): Error: template fail11125.filter(alias predfun) if (is(ReturnType!predfun == bool)) cannot deduce template function from argument types !(function (int a) => a + 1)(int[]) -+--- -+*/ -+ -+template ReturnType(alias fun) { alias int ReturnType; } -+ -+template filter(alias predfun) -+ if (is(ReturnType!predfun == bool)) -+{ -+ static assert(is(ReturnType!predfun == bool)); -+ auto filter(Range)(Range r) { } -+} -+ -+void main() -+{ -+ filter!((int a) => a + 1)([1]); // fails in constraint -+ [1].filter!((int a) => a + 1); // fails internally in static assert! -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail11151.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail11151.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,36 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail11151.d(30): Error: overlapping initialization for field a and y -+--- -+*/ -+ -+//extern(C) int printf(const char*, ...); -+ -+union U -+{ -+ struct -+ { -+ align(1) long a; -+ align(1) int b; -+ } -+ struct -+ { -+ align(1) int x; -+ align(1) long y; -+ } -+} -+void main() -+{ -+ static assert(U.a.offsetof == 0); -+ static assert(U.b.offsetof == 8); -+ static assert(U.x.offsetof == 0); -+ static assert(U.y.offsetof == 4); -+ -+ U u = {a:1, y:2}; // overlapped initializing U.a and U.y -+ -+ //printf("u.a = %lld\n", u.a); // 8589934593 , Wrong! -+ //printf("u.b = %d\n", u.b); // 0 -+ //printf("u.x = %d\n", u.x); // 1 -+ //printf("u.y = %lld\n", u.y); // 2 -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail11163.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail11163.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail11163.d(12): Error: cannot implicitly convert expression (foo()) of type int[] to immutable(int[]) -+fail_compilation/fail11163.d(13): while evaluating pragma(msg, a) -+--- -+*/ -+int[] foo() { -+ return [1]; -+} -+void main() { -+ immutable a = foo(); -+ pragma(msg, a); -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail11426.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail11426.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail11426.d(15): Error: cannot implicitly convert expression (udarr) of type uint[] to int[] -+fail_compilation/fail11426.d(16): Error: cannot implicitly convert expression (usarr[]) of type uint[] to int[] -+fail_compilation/fail11426.d(18): Error: cannot implicitly convert expression (udarr) of type uint[] to int[] -+fail_compilation/fail11426.d(19): Error: cannot implicitly convert expression (usarr) of type uint[1] to int[] -+--- -+*/ -+void main() -+{ -+ uint[] udarr; -+ uint[1] usarr; -+ -+ int[1] arr1; arr1 = udarr; // Error, OK -+ int[1] arr2; arr2 = usarr; // Error, OK -+ -+ int[1] arr3 = udarr; // accepted, BAD! -+ int[1] arr4 = usarr; // accepted, BAD! -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail160.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail160.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,19 +1,26 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail160.d(22): Error: typeid(fail160.Foo).vtbl is not yet implemented at compile time -+--- -+*/ -+ - interface Foo - { -- void work(); -+ void work(); - } - template Wrapper(B, alias Func, int func) - { -- alias typeof(&Func) FuncPtr; -+ alias typeof(&Func) FuncPtr; - -- private static FuncPtr get_funcptr() { return func; } -+ private static FuncPtr get_funcptr() { return func; } - } - - - int main(char[][] args) - { -- auto x = new Wrapper!(Foo, Foo.work, cast(int)(Foo.classinfo.vtbl[0]))(); -+ auto x = new Wrapper!(Foo, Foo.work, cast(int)(Foo.classinfo.vtbl[0]))(); - -- return 0; -+ return 0; - } - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail1900.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail1900.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,66 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail1900.d(26): Error: template fail1900.Mix1a!().Foo matches more than one template declaration: -+ fail_compilation/fail1900.d(13):Foo(ubyte x) -+and -+ fail_compilation/fail1900.d(14):Foo(byte x) -+--- -+*/ -+ -+template Mix1a() -+{ -+ template Foo(ubyte x) {} -+ template Foo(byte x) {} -+} -+template Mix1b() -+{ -+ template Foo(int x) {} -+} -+ -+mixin Mix1a; -+mixin Mix1b; -+ -+void test1900a() -+{ -+ alias x = Foo!1; -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail1900.d(41): Error: imports.fail1900b.Bar(short n) at fail_compilation/imports/fail1900b.d(2) conflicts with imports.fail1900a.Bar(int n) at fail_compilation/imports/fail1900a.d(2) -+--- -+*/ -+ -+import imports.fail1900a; -+import imports.fail1900b; -+ -+void test1900b() -+{ -+ enum x = Bar!1; -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail1900.d(65): Error: fail1900.Mix2b!().Baz(int x) at fail_compilation/fail1900.d(57) conflicts with fail1900.Mix2a!().Baz(byte x) at fail_compilation/fail1900.d(53) -+--- -+*/ -+ -+template Mix2a() -+{ -+ template Baz(byte x) {} -+} -+template Mix2b() -+{ -+ template Baz(int x) {} -+} -+ -+mixin Mix2a; -+mixin Mix2b; -+ -+void test1900c() -+{ -+ alias x = Baz!1; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail235.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail235.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,8 @@ - /* --Error: expression & D10TypeInfo_a6__initZ is not a valid template value argument -- --a.d(7): template instance a.Tuple!(& D10TypeInfo_a6__initZ) error instantiating -+TEST_OUTPUT: -+--- -+fail_compilation/fail235.d(12): Error: expression typeid(char) is not a valid template value argument -+--- - */ - template Tuple(TPL...) - { -@@ -9,3 +10,15 @@ template Tuple(TPL...) - } - - auto K = Tuple!(typeid(char)); -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail235.d(24): Error: expression typeid(char) is not a valid template value argument -+--- -+*/ -+template Alias(alias A) -+{ -+ alias A Alias; -+} -+auto A = Alias!(typeid(char)); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail243.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail243.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,12 +1,23 @@ - // REQUIRED_ARGS: -de -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail243.d(23): Deprecation: class fail243.DepClass is deprecated -+fail_compilation/fail243.d(24): Deprecation: struct fail243.DepStruct is deprecated -+fail_compilation/fail243.d(25): Deprecation: union fail243.DepUnion is deprecated -+fail_compilation/fail243.d(26): Deprecation: enum fail243.DepEnum is deprecated -+fail_compilation/fail243.d(27): Deprecation: alias fail243.DepAlias is deprecated -+--- -+*/ - --deprecated { -+deprecated -+{ - class DepClass {} - struct DepStruct {} - union DepUnion {} - enum DepEnum { A } - alias int DepAlias; -- typedef int DepTypedef; -+ //typedef int DepTypedef; - } - - void func(DepClass obj) {} -@@ -14,5 +25,4 @@ void func(DepStruct obj) {} - void func(DepUnion obj) {} - void func(DepEnum obj) {} - void func(DepAlias obj) {} --void func(DepTypedef obj) {} -- -+//void func(DepTypedef obj) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail243t.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail243t.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+// REQUIRED_ARGS: -de -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail243t.d(16): Deprecation: use of typedef is deprecated; use alias instead -+--- -+*/ -+ -+deprecated -+{ -+ //class DepClass {} -+ //struct DepStruct {} -+ //union DepUnion {} -+ //enum DepEnum { A } -+ //alias int DepAlias; -+ typedef int DepTypedef; -+} -+ -+//void func(DepClass obj) {} -+//void func(DepStruct obj) {} -+//void func(DepUnion obj) {} -+//void func(DepEnum obj) {} -+//void func(DepAlias obj) {} -+void func(DepTypedef obj) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail2962.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail2962.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,41 @@ -+// EXTRA_SOURCES: imports/fail2962a.d -+ -+// comment 6 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail2962.d(14): Error: variable y cannot be read at compile time -+fail_compilation/fail2962.d(14): while looking for match for baz6!(int, y) -+fail_compilation/fail2962.d(22): Error: template instance fail2962.bar6!int error instantiating -+--- -+*/ -+T bar6(T)(T y) -+{ -+ return baz6!(T, y)(); -+} -+T baz6(T, T z)() -+{ -+ return z * z; -+} -+void test6() -+{ -+ assert(bar6(4) != 0); -+} -+ -+// comment 4 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail2962.d(36): Error: variable x cannot be read at compile time -+fail_compilation/fail2962.d(36): while looking for match for baz4!(int, x) -+fail_compilation/imports/fail2962a.d(6): Error: template instance fail2962.bar4!int error instantiating -+--- -+*/ -+T bar4(T)(T x) -+{ -+ return baz4!(T, x)(); -+} -+T baz4(T, T x)() -+{ -+ return x; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail340.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail340.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,11 +1,18 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail340.d(17): Error: variable fail340.w of type struct const(CopyTest) uses this(this), which is not allowed in static initialization -+--- -+*/ - --struct CopyTest { -- double x; -- this(double a) { x = a * 10.0;} -- this(this) { x+=2.0;} -+struct CopyTest -+{ -+ double x; -+ this(double a) { x = a * 10.0;} -+ this(this) { x += 2.0; } - } - - const CopyTest z = CopyTest(5.3); - - const CopyTest w = z; --static assert(w.x==55.0); -+static assert(w.x == 55.0); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail341.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail341.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,11 +1,15 @@ -- --import std.c.stdio; -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail341.d(26): Error: struct fail341.S is not copyable because it is annotated with @disable -+fail_compilation/fail341.d(27): Error: function fail341.foo is not callable because it is annotated with @disable -+--- -+*/ - - struct T - { -- @nocall this(this) -+ @disable this(this) - { -- printf("postblit\n"); - } - } - -@@ -14,7 +18,7 @@ struct S - T t; - } - --@nocall void foo() { } -+@disable void foo() { } - - void main() - { ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail345.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail345.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,9 +0,0 @@ --// 3775 -- --struct Bug3775 { -- static int byLine()() { return 1; } --} -- --static assert( cast(int) Bug3775.byLine); -- -- ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail349.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail349.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,10 @@ --// Error: bug6109throwing is not nothrow --// Error: function fail349.bug6109noThrow 'bug6109noThrow' is nothrow yet may throw -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail349.d(13): Error: 'fail349.bug6109throwing' is not nothrow -+fail_compilation/fail349.d(12): Error: function 'fail349.bug6109noThrow' is nothrow yet may throw -+--- -+*/ - - int bug6109throwing() { - throw new Exception("throws"); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail3673a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+class A {} -+class B : A if(false) { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail3673b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+class A {} -+class B : if(false) A { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail3703.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail3703.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,14 +3,25 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/fail3703.d(15): Error: mismatched array lengths, 2 and 1 -+fail_compilation/fail3703.d(18): Error: mismatched array lengths, 2 and 1 -+fail_compilation/fail3703.d(20): Error: mismatched array lengths, 2 and 1 -+fail_compilation/fail3703.d(22): Error: mismatched array lengths, 3 and 2 -+fail_compilation/fail3703.d(23): Error: mismatched array lengths, 2 and 3 -+fail_compilation/fail3703.d(25): Error: mismatched array lengths, 3 and 2 -+fail_compilation/fail3703.d(26): Error: mismatched array lengths, 2 and 3 - --- - */ - - void main() - { - int[1] a = [1]; -- int[2] b; -+ int[2] b = a; // should make compile error - - b = a; // should make compile error -+ -+ int[3] sa3 = [1,2][]; -+ int[2] sa2 = sa3[][]; -+ -+ sa3 = [1,2][]; -+ sa2 = sa3[][]; - } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail3866.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail3866.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,10 +0,0 @@ -- --void main() { -- -- auto foo = (int a = 1) { return a;}; -- auto bar = (int a) { return a;}; -- -- foo(); -- bar(); --} -- ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail4611.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail4611.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail4611.d(15): Error: index 1000000000 overflow for static array -+--- -+*/ -+ -+struct Vec -+{ -+ int x; -+} -+ -+void main() -+{ -+ Vec[1000_000_000] a; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6107.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6107.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6107.d(8): Error: struct fail6107.Foo variable __ctor is not a constructor; identifiers starting with __ are reserved for the implementation -+fail_compilation/fail6107.d(11): Error: class fail6107.Bar variable __ctor is not a constructor; identifiers starting with __ are reserved for the implementation -+--- -+*/ -+struct Foo { -+ enum __ctor = 4; -+} -+class Bar { -+ int __ctor = 4; -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail61.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail61.d 2014-04-01 16:32:51.000000000 +0100 -@@ -12,7 +12,7 @@ class A - { - class B : A - { -- const int C = 5; -+ static const int C = 5; - } - } - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6451.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6451.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,8 @@ - --version(GNU) {static assert(0);} -+version(GNU) -+{ -+ static assert(0); -+} - version(Win64) - { - static assert(0); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6453.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6453.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6453.d(13): Error: struct fail6453.S6453x mixing invariants with shared/synchronized differene is not supported -+fail_compilation/fail6453.d(18): Error: class fail6453.C6453y mixing invariants with shared/synchronized differene is not supported -+fail_compilation/fail6453.d(23): Error: class fail6453.C6453z mixing invariants with shared/synchronized differene is not supported -+--- -+*/ -+ -+struct S6453x -+{ -+ invariant() {} -+ shared invariant() {} -+} -+class C6453y -+{ -+ invariant() {} -+ synchronized invariant() {} -+} -+class C6453z -+{ -+ shared invariant() {} -+ synchronized invariant() {} -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6572.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6572.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,18 @@ - // REQUIRED_ARGS: -de -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6572.d(9): Deprecation: use of typedef is deprecated; use alias instead -+--- -+*/ - - typedef int y; -+ -+// 11424 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6572.d(18): Deprecation: use of typedef is deprecated; use alias instead -+--- -+*/ -+typedef struct S { } -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6652a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6652a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,25 +1,24 @@ --// REQUIRED_ARGS: -de --// PERMUTE_ARGS: -w -+// PERMUTE_ARGS: -w -dw -de -d -+ - /******************************************/ - // 6652 - - /* - TEST_OUTPUT: - --- --fail_compilation/fail6652a.d(19): Deprecation: variable modified in foreach body requires ref storage class --fail_compilation/fail6652a.d(24): Error: cannot modify const expression i -+fail_compilation/fail6652a.d(18): Error: cannot modify const expression i -+fail_compilation/fail6652a.d(23): Error: cannot modify const expression i - --- - */ - - void main() - { -- size_t[] res; -- foreach (i; 0..2) -+ foreach (const i; 0..2) - { -- res ~= ++i; -+ ++i; - } - -- foreach (const i; 0..2) -+ foreach (ref const i; 0..2) - { - ++i; - } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6652b.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6652b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,25 +1,24 @@ --// REQUIRED_ARGS: -de --// PERMUTE_ARGS: -w -+// PERMUTE_ARGS: -w -dw -de -d -+ - /******************************************/ - // 6652 - - /* - TEST_OUTPUT: - --- --fail_compilation/fail6652b.d(19): Deprecation: variable modified in foreach body requires ref storage class --fail_compilation/fail6652b.d(24): Error: cannot modify const expression i -+fail_compilation/fail6652b.d(18): Error: cannot modify const expression i -+fail_compilation/fail6652b.d(23): Error: cannot modify const expression i - --- - */ - - void main() - { -- size_t[] res; -- foreach (i, e; [1,2,3,4,5]) -+ foreach (const i, e; [1,2,3,4,5]) - { -- res ~= ++i; -+ ++i; - } - -- foreach (const i, e; [1,2,3,4,5]) -+ foreach (ref const i, e; [1,2,3,4,5]) - { - ++i; - } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail6795.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail6795.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,34 @@ -+// 6795 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6795.d(12): Error: constant 0 is not an lvalue -+fail_compilation/fail6795.d(13): Error: constant 0 is not an lvalue -+--- -+*/ -+ -+void main() { -+ enum int[] array = [0]; -+ array[0]++; -+ array[0] += 3; -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail6795.d(31): Error: constant 0 is not an lvalue -+fail_compilation/fail6795.d(32): Error: constant 0 is not an lvalue -+fail_compilation/fail6795.d(33): Error: constant 0 is not an lvalue -+--- -+*/ -+ -+void test_wrong_line_num() -+{ -+ enum int[] da = [0]; -+ enum int[1] sa = [0]; -+ enum int[int] aa = [0:0]; -+ -+ da[0] += 3; -+ sa[0] += 3; -+ aa[0] += 3; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail7077.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail7077.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+ -+void main() -+{ -+ if(0) mixin("auto x = 2;"); -+ assert(x == 2); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail7524a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+ -+// 7524 -+ -+#line 47 __DATE__ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail7524b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+// 7524 -+ -+#line 47 __VERSION__ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail7848.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail7848.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,18 @@ -+// REQUIRED_ARGS: -unittest -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail7848.d(17): Error: pure function 'fail7848.__unittestL15_1' cannot call impure function 'fail7848.func' -+fail_compilation/fail7848.d(17): Error: safe function 'fail7848.__unittestL15_1' cannot call system function 'fail7848.func' -+fail_compilation/fail7848.d(17): Error: 'fail7848.func' is not nothrow -+fail_compilation/fail7848.d(15): Error: function 'fail7848.__unittestL15_1' is nothrow yet may throw -+--- -+*/ -+ -+void func() {} -+ -+@safe pure nothrow unittest -+{ -+ func(); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail7862.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail7862.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,13 @@ -+/* -+TEST_OUTPUT: -+--- -+A: false -+A: false -+fail_compilation/fail7862.d(26): Error: template instance nonExistent!() template 'nonExistent' is not defined -+fail_compilation/fail7862.d(25): Error: template instance fail7862.B!(A) error instantiating -+--- -+*/ -+ - // 7862 - - template B(T) { -@@ -10,7 +20,8 @@ template B(T) { - } - - struct A { -- pragma(msg, "A: ", __traits(compiles, B!A)); -+ pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false")); -+ pragma(msg, "A: " ~ (__traits(compiles, B!A) ? "true" : "false")); - B!A c; - static if (nonExistent!()) {} - } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail8179.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail8179.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail8179.d(10): Error: cannot cast null to int[2] -+--- -+*/ -+void main() -+{ -+ int[2] a; -+ a = cast(int[2])null; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9199.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9199.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,40 @@ -+// REQUIRED_ARGS: -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9199.d(13): Error: function fail9199.fc without 'this' cannot be const -+fail_compilation/fail9199.d(14): Error: function fail9199.fi without 'this' cannot be immutable -+fail_compilation/fail9199.d(15): Error: function fail9199.fw without 'this' cannot be inout -+fail_compilation/fail9199.d(16): Error: function fail9199.fs without 'this' cannot be shared -+fail_compilation/fail9199.d(17): Error: function fail9199.fsc without 'this' cannot be shared const -+fail_compilation/fail9199.d(18): Error: function fail9199.fsw without 'this' cannot be shared inout -+--- -+*/ -+void fc() const {} -+void fi() immutable {} -+void fw() inout {} -+void fs() shared {} -+void fsc() shared const {} -+void fsw() shared inout {} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9199.d(33): Error: function fail9199.C.fc without 'this' cannot be const -+fail_compilation/fail9199.d(34): Error: function fail9199.C.fi without 'this' cannot be immutable -+fail_compilation/fail9199.d(35): Error: function fail9199.C.fw without 'this' cannot be inout -+fail_compilation/fail9199.d(36): Error: function fail9199.C.fs without 'this' cannot be shared -+fail_compilation/fail9199.d(37): Error: function fail9199.C.fsc without 'this' cannot be shared const -+fail_compilation/fail9199.d(38): Error: function fail9199.C.fsw without 'this' cannot be shared inout -+--- -+*/ -+class C -+{ -+ static void fc() const {} -+ static void fi() immutable {} -+ static void fw() inout {} -+ static void fs() shared {} -+ static void fsc() shared const {} -+ static void fsw() shared inout {} -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail91.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail91.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,13 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail91.d(12): Error: struct fail91.S unknown size -+--- -+*/ -+ - struct S; - - void main() - { -- S* s = new S(); -+ S* s = new S(); - } -- ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9346.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9346.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,28 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9346.d(26): Error: struct fail9346.S is not copyable because it is annotated with @disable -+fail_compilation/fail9346.d(27): Error: struct fail9346.S is not copyable because it is annotated with @disable -+--- -+*/ -+ -+struct S -+{ -+ @disable this(this); -+} -+struct SS1 -+{ -+ S s; -+} -+struct SS2 -+{ -+ S s; -+ this(this){} -+} -+ -+void main() -+{ -+ S s; -+ SS1 ss1 = SS1(s); -+ SS2 ss2 = SS2(s); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9413.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9413.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,85 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9413.d(45): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(32): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(33): Error: variable fail9413.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9413.d(38): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(39): Error: variable fail9413.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9413.d(40): Error: variable fail9413.foo.bar.s cannot modify result 's' in contract -+fail_compilation/fail9413.d(50): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(73): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(74): Error: variable fail9413.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9413.d(58): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(59): Error: variable fail9413.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9413.d(60): Error: variable fail9413.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9413.d(65): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(66): Error: variable fail9413.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9413.d(67): Error: variable fail9413.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9413.d(68): Error: variable fail9413.foo.baz.s cannot modify result 's' in contract -+fail_compilation/fail9413.d(79): Error: variable fail9413.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9413.d(80): Error: variable fail9413.foo.r cannot modify result 'r' in contract -+--- -+*/ -+ -+int foo(int x) -+in -+{ -+ int a; -+ int bar(int y) -+ in -+ { -+ x = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+} -+out(r) -+{ -+ int a; -+ int baz(int y) -+ in -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ r = 10; // err -+} -+body -+{ -+ return 1; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9414a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9414a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,88 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9414a.d(47): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(34): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(35): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414a.d(40): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(41): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414a.d(42): Error: variable fail9414a.C.foo.__require.bar.s cannot modify result 's' in contract -+fail_compilation/fail9414a.d(52): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(75): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(76): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414a.d(60): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(61): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414a.d(62): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414a.d(67): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(68): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414a.d(69): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414a.d(70): Error: variable fail9414a.C.foo.__ensure.baz.s cannot modify result 's' in contract -+fail_compilation/fail9414a.d(81): Error: variable fail9414a.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414a.d(82): Error: variable fail9414a.C.foo.__ensure.r cannot modify result 'r' in contract -+--- -+*/ -+ -+class C -+{ -+ int foo(int x) -+ in -+ { -+ int a; -+ int bar(int y) -+ in -+ { -+ x = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ } -+ out(r) -+ { -+ int a; -+ int baz(int y) -+ in -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ r = 10; // err -+ } -+ body -+ { -+ return 1; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9414b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9414b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,88 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9414b.d(47): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(34): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(35): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414b.d(40): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(41): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414b.d(42): Error: variable fail9414b.C.foo.__require.bar.s cannot modify result 's' in contract -+fail_compilation/fail9414b.d(52): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(75): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(76): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414b.d(60): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(61): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414b.d(62): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414b.d(67): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(68): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract -+fail_compilation/fail9414b.d(69): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414b.d(70): Error: variable fail9414b.C.foo.__ensure.baz.s cannot modify result 's' in contract -+fail_compilation/fail9414b.d(81): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414b.d(82): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract -+--- -+*/ -+ -+class C -+{ -+ final int foo(int x) -+ in -+ { -+ int a; -+ int bar(int y) -+ in -+ { -+ x = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ } -+ out(r) -+ { -+ int a; -+ int baz(int y) -+ in -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ r = 10; // err -+ } -+ body -+ { -+ return 1; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9414c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9414c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,88 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9414c.d(47): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(34): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(35): Error: variable fail9414c.C.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414c.d(40): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(41): Error: variable fail9414c.C.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414c.d(42): Error: variable fail9414c.C.foo.bar.s cannot modify result 's' in contract -+fail_compilation/fail9414c.d(52): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(75): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(76): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414c.d(60): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(61): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414c.d(62): Error: variable fail9414c.C.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414c.d(67): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(68): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414c.d(69): Error: variable fail9414c.C.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414c.d(70): Error: variable fail9414c.C.foo.baz.s cannot modify result 's' in contract -+fail_compilation/fail9414c.d(81): Error: variable fail9414c.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414c.d(82): Error: variable fail9414c.C.foo.r cannot modify result 'r' in contract -+--- -+*/ -+ -+class C -+{ -+ private int foo(int x) -+ in -+ { -+ int a; -+ int bar(int y) -+ in -+ { -+ x = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ } -+ out(r) -+ { -+ int a; -+ int baz(int y) -+ in -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ r = 10; // err -+ } -+ body -+ { -+ return 1; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9414d.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9414d.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,88 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9414d.d(47): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(34): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(35): Error: variable fail9414d.C.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414d.d(40): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(41): Error: variable fail9414d.C.foo.bar.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414d.d(42): Error: variable fail9414d.C.foo.bar.s cannot modify result 's' in contract -+fail_compilation/fail9414d.d(52): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(75): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(76): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414d.d(60): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(61): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414d.d(62): Error: variable fail9414d.C.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414d.d(67): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(68): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract -+fail_compilation/fail9414d.d(69): Error: variable fail9414d.C.foo.baz.y cannot modify parameter 'y' in contract -+fail_compilation/fail9414d.d(70): Error: variable fail9414d.C.foo.baz.s cannot modify result 's' in contract -+fail_compilation/fail9414d.d(81): Error: variable fail9414d.C.foo.x cannot modify parameter 'x' in contract -+fail_compilation/fail9414d.d(82): Error: variable fail9414d.C.foo.r cannot modify result 'r' in contract -+--- -+*/ -+ -+class C -+{ -+ static int foo(int x) -+ in -+ { -+ int a; -+ int bar(int y) -+ in -+ { -+ x = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ } -+ out(r) -+ { -+ int a; -+ int baz(int y) -+ in -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ a = 1; // OK -+ } -+ out(s) -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 10; // err -+ s = 10; // err -+ a = 1; // OK -+ } -+ body -+ { -+ x = 10; // err -+ r = 10; // err -+ y = 1; // OK -+ a = 1; // OK -+ return 2; -+ } -+ x = 10; // err -+ r = 10; // err -+ } -+ body -+ { -+ return 1; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9613.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9613.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+// PREMUTE_ARGS: -+ -+void main() -+{ -+ auto x = const byte.init; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9665a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9665a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,159 @@ -+// REQUIRED_ARGS: -+// PERMUTE_ARGS: -+ -+/***************************************************/ -+// immutable field -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665a.d(106): Error: multiple field v initialization -+fail_compilation/fail9665a.d(116): Error: multiple field v initialization -+fail_compilation/fail9665a.d(121): Error: multiple field v initialization -+fail_compilation/fail9665a.d(126): Error: multiple field v initialization -+fail_compilation/fail9665a.d(136): Error: multiple field v initialization -+fail_compilation/fail9665a.d(141): Error: multiple field v initialization -+fail_compilation/fail9665a.d(146): Error: multiple field v initialization -+--- -++/ -+#line 100 -+struct S1A -+{ -+ immutable int v; -+ this(int) -+ { -+ v = 1; -+ v = 2; // multiple initialization -+ } -+} -+ -+struct S1B -+{ -+ immutable int v; -+ this(int) -+ { -+ if (true) v = 1; else v = 2; -+ v = 3; // multiple initialization -+ } -+ this(long) -+ { -+ if (true) v = 1; -+ v = 3; // multiple initialization -+ } -+ this(string) -+ { -+ if (true) {} else v = 2; -+ v = 3; // multiple initialization -+ } -+} -+ -+struct S1C -+{ -+ immutable int v; -+ this(int) -+ { -+ true ? (v = 1) : (v = 2); -+ v = 3; // multiple initialization -+ } -+ this(long) -+ { -+ auto x = true ? (v = 1) : 2; -+ v = 3; // multiple initialization -+ } -+ this(string) -+ { -+ auto x = true ? 1 : (v = 2); -+ v = 3; // multiple initialization -+ } -+} -+ -+/***************************************************/ -+// with control flow -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665a.d(206): Error: field v initializing not allowed in loops or after labels -+fail_compilation/fail9665a.d(211): Error: field v initializing not allowed in loops or after labels -+fail_compilation/fail9665a.d(216): Error: multiple field v initialization -+fail_compilation/fail9665a.d(221): Error: multiple field v initialization -+fail_compilation/fail9665a.d(226): Error: multiple field v initialization -+--- -++/ -+#line 200 -+struct S2 -+{ -+ immutable int v; -+ this(int) -+ { -+ L: -+ v = 1; // after labels -+ } -+ this(long) -+ { -+ foreach (i; 0..1) -+ v = 1; // in loops -+ } -+ this(string) -+ { -+ v = 1; // initialization -+ L: v = 2; // assignment after labels -+ } -+ this(wstring) -+ { -+ v = 1; // initialization -+ foreach (i; 0..1) v = 2; // assignment in loops -+ } -+ this(dstring) -+ { -+ v = 1; return; -+ v = 2; // multiple initialization -+ } -+} -+ -+/***************************************************/ -+// with immutable constructor -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665a.d(307): Error: multiple field v initialization -+fail_compilation/fail9665a.d(311): Error: multiple field w initialization -+--- -++/ -+#line 300 -+struct S3 -+{ -+ int v; -+ int w; -+ this(int) immutable -+ { -+ v = 1; -+ v = 2; // multiplie initialization -+ -+ if (true) -+ w = 1; -+ w = 2; // multiplie initialization -+ } -+} -+ -+/***************************************************/ -+// in __traits(compiles) -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665a.d(406): Error: multiple field v initialization -+--- -++/ -+#line 400 -+struct S4 -+{ -+ immutable int v; -+ this(int) -+ { -+ static assert(__traits(compiles, v = 1)); -+ v = 1; // multiplie initialization -+ } -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9665b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9665b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,79 @@ -+/***************************************************/ -+// with disable this() struct -+ -+struct X -+{ -+ @disable this(); -+ -+ this(int) {} -+} -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665b.d(110): Error: one path skips field x2 -+fail_compilation/fail9665b.d(111): Error: one path skips field x3 -+fail_compilation/fail9665b.d(113): Error: one path skips field x5 -+fail_compilation/fail9665b.d(114): Error: one path skips field x6 -+fail_compilation/fail9665b.d(108): Error: constructor fail9665b.S1.this field x1 must be initialized in constructor -+fail_compilation/fail9665b.d(108): Error: constructor fail9665b.S1.this field x4 must be initialized in constructor -+--- -++/ -+#line 100 -+struct S1 -+{ -+ X x1; -+ X x2; -+ X x3; -+ X[2] x4; -+ X[2] x5; -+ X[2] x6; -+ this(int) -+ { -+ if (true) x2 = X(1); -+ auto n = true ? (x3 = X(1), 1) : 2; -+ -+ if (true) x5 = X(1); -+ auto m = true ? (x6 = X(1), 1) : 2; -+ } -+} -+ -+/***************************************************/ -+// with nested struct -+ -+/+ -+TEST_OUTPUT: -+--- -+fail_compilation/fail9665b.d(210): Error: one path skips field x2 -+fail_compilation/fail9665b.d(211): Error: one path skips field x3 -+fail_compilation/fail9665b.d(213): Error: one path skips field x5 -+fail_compilation/fail9665b.d(214): Error: one path skips field x6 -+fail_compilation/fail9665b.d(208): Error: constructor fail9665b.S2!(X).S2.this field x1 must be initialized in constructor, because it is nested struct -+fail_compilation/fail9665b.d(208): Error: constructor fail9665b.S2!(X).S2.this field x4 must be initialized in constructor, because it is nested struct -+fail_compilation/fail9665b.d(221): Error: template instance fail9665b.S2!(X) error instantiating -+--- -++/ -+#line 200 -+struct S2(X) -+{ -+ X x1; -+ X x2; -+ X x3; -+ X[2] x4; -+ X[2] x5; -+ X[2] x6; -+ this(int) -+ { -+ if (true) x2 = X(1); -+ auto x = true ? (x3 = X(1), 1) : 2; -+ -+ if (true) x5 = X(1); -+ auto m = true ? (x6 = X(1), 1) : 2; -+ } -+} -+void test2() -+{ -+ struct X { this(int) {} } -+ static assert(X.tupleof.length == 1); -+ S2!(X) s; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9710.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9710.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9710.d(9): Error: static variable e cannot be read at compile time -+--- -+*/ -+ -+int* e; -+enum v = e[1]; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9735.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9735.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+REQUIRED_ARGS: -de -+TEST_OUTPUT: -+--- -+fail_compilation/fail9735.d(10): Deprecation: casting from void delegate() to void* is deprecated -+--- -+*/ -+ -+void* dg2ptr(void delegate() dg) { -+ return cast(void*) dg; -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9773.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9773.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9773.d(7): Error: "" is not an lvalue -+--- -+*/ -+void f(ref string a = "") -+{ -+ a = "crash and burn"; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9790.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9790.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9790.d(13): Error: undefined identifier _Unused_ -+fail_compilation/fail9790.d(20): Error: template instance fail9790.foo!() error instantiating -+fail_compilation/fail9790.d(18): Error: undefined identifier _Unused_ -+fail_compilation/fail9790.d(21): Error: template instance fail9790.bar!() error instantiating -+--- -+*/ -+ -+template foo() -+{ -+ enum bool _foo = _Unused_._unused_; -+ enum bool foo = _foo; -+} -+template bar() -+{ -+ enum bool bar = _Unused_._unused_; -+} -+alias Foo = foo!(); -+alias Bar = bar!(); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9892.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9892.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+// 9892 -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9892.d(11): Error: enum member fail9892.a circular reference to enum member -+--- -+*/ -+ -+enum -+{ -+ a = b, //Segfault! -+ b -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9904.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9904.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9904.d(22): Error: cannot cast from typeof(null) to S1 -+fail_compilation/fail9904.d(23): Error: cannot cast from typeof(null) to S2 -+--- -+*/ -+ -+struct S1 -+{ -+ size_t m; -+} -+ -+struct S2 -+{ -+ size_t m; -+ byte b; -+} -+ -+void main() -+{ -+ auto s1 = cast(S1)null; -+ auto s2 = cast(S2)null; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/fail9936.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/fail9936.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,31 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/fail9936.d(25): Error: S().opBinary isn't a template -+fail_compilation/fail9936.d(26): Error: S().opBinaryRight isn't a template -+fail_compilation/fail9936.d(27): Error: S().opOpAssign isn't a template -+fail_compilation/fail9936.d(29): Error: S().opIndexUnary isn't a template -+fail_compilation/fail9936.d(30): Error: S().opUnary isn't a template -+--- -+*/ -+struct S -+{ -+ auto opBinary(S s) { return 1; } -+ auto opBinaryRight(int n) { return 1; } -+ auto opOpAssign(S s) { return 1; } -+ -+ auto opIndexUnary(S s) { return 1; } -+ auto opUnary(S s) { return 1; } -+} -+void main() -+{ -+ static assert(!is(typeof( S() + S() ))); -+ static assert(!is(typeof( 100 + S() ))); -+ static assert(!is(typeof( S() += S() ))); -+ S() + S(); -+ 100 + S(); -+ S() += S(); -+ -+ +S()[0]; -+ +S(); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/failsafea.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/failsafea.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+ -+void systemfunc() @system {} -+ -+@safe -+void callingsystem() -+{ -+ systemfunc(); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/failsafeb.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+ -+void function() @system sysfuncptr; -+ -+@safe -+void callingsystem() -+{ -+ sysfuncptr(); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/failsafec.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/failsafec.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+ -+void delegate() @system sysdelegate; -+ -+@safe -+void callingsystem() -+{ -+ sysdelegate(); -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,11 +1,13 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269a.d(12): Error: undefined identifier B -+--- -+*/ - - static if(is(typeof(A4269.sizeof))) {} -- - class A4269 - { - void foo(B b); - } -- -- -- -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269b.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,10 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269b.d(10): Error: undefined identifier Y, did you mean variable y? -+--- -+*/ - - static if(is(typeof(X2.init))) {} - struct X2 { Y y; } -- -- -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269c.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,10 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269c.d(10): Error: undefined identifier T3, did you mean function X3? -+--- -+*/ - - static if(is(typeof(X3.init))) {} - void X3(T3) { } -- -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269d.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269d.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,10 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269d.d(10): Error: undefined identifier Y4, did you mean function X4? -+--- -+*/ - - static if(is(typeof(X4.init))) {} - Y4 X4() { return typeof(return).init; } -- -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269e.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269e.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,10 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269e.d(10): Error: undefined identifier Y8, did you mean class X8? -+--- -+*/ - - static if(is(typeof(X8.init))) {} --class X8 : Y8 {} -\ No newline at end of file -+class X8 : Y8 {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269f.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269f.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,11 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269f.d(11): Error: undefined identifier Y9, did you mean interface X9? -+fail_compilation/gag4269f.d(11): Error: variable gag4269f.X9.y field not allowed in interface -+--- -+*/ - - static if(is(typeof(X9.init))) {} --interface X9 { Y9 y; } -\ No newline at end of file -+interface X9 { Y9 y; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/gag4269g.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/gag4269g.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,4 +1,10 @@ - // REQUIRED_ARGS: -c -o- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/gag4269g.d(10): Error: undefined identifier Y13, did you mean template X13(Y13 y)? -+--- -+*/ - - static if(is(typeof(X13!(0).init))) {} - template X13(Y13 y) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10016.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10016.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,48 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10016.d(33): Error: undefined identifier unknownIdentifier -+fail_compilation/ice10016.d(47): Error: template instance ice10016.RefCounted!(S) error instantiating -+--- -+*/ -+ -+struct RefCounted(T) -+{ -+ struct RefCountedStore -+ { -+ struct Impl -+ { -+ T _payload; -+ } -+ Impl* _store; -+ } -+ RefCountedStore _refCounted; -+ -+ void opAssign(typeof(this)) { } -+ void opAssign(T) { } -+ -+ @property refCountedPayload() -+ { -+ return _refCounted._store._payload; -+ } -+ alias refCountedPayload this; -+} -+ -+struct S -+{ -+ int i = unknownIdentifier; -+} -+ -+class C {} -+ -+class N -+{ -+ this(C) {} -+ C c() { return null; } -+} -+ -+class D : N -+{ -+ this() { super(c); } -+ RefCounted!S _s; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10076.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10076.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,28 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10076.d(21): Error: template instance getMembersAndAttributesWhere!() template 'getMembersAndAttributesWhere' is not defined -+fail_compilation/ice10076.d(26): Error: template instance ice10076.getValidaterAttrs!string error instantiating -+fail_compilation/ice10076.d(16): instantiated from here: validate!string -+fail_compilation/ice10076.d(26): Error: forward reference to 'getMembersAndAttributesWhere!().Elements' -+fail_compilation/ice10076.d(26): Error: forward reference to 'getMembersAndAttributesWhere!().Elements' -+fail_compilation/ice10076.d(16): Error: template instance ice10076.validate!string error instantiating -+--- -+*/ -+ -+void main() -+{ -+ string s; -+ validate(s); -+} -+ -+template getValidaterAttrs(T) -+{ -+ alias getMembersAndAttributesWhere!().Elements getValidaterAttrs; -+} -+ -+void validate(T)(T) -+{ -+ alias getValidaterAttrs!T memberAttrs; -+ auto x = memberAttrs.length; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10212.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10212.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10212.d(12): Error: mismatched function return type inference of int function() pure nothrow @safe and int -+--- -+*/ -+ -+int delegate() foo() -+{ -+ // returns "int function() pure nothrow @safe function() pure nothrow @safe" -+ // and it mismatches to "int delegate()" -+ return () => { -+ return 1; -+ }; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10273.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10273.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// 10273 - ICE in CTFE -+ -+struct Bug10273 { -+ int val = 3.45; -+} -+int bug10273() -+{ -+ Bug10273 p; -+ return 1; -+} -+ -+static assert(bug10273()); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10283.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10283.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+// 10283 -+ -+S10283 blah(S10283 xxx) { return xxx; } -+S10283 repy = blah(S10283()); -+ -+struct S10283 -+{ -+ string source = 7; -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10341.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10341.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10341.d(10): Error: case range not in switch statement -+--- -+*/ -+ -+void main() -+{ -+ case 1: .. case 2: -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10382.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10382.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10382.d(14): Error: can only catch class objects derived from Throwable, not 'int' -+--- -+*/ -+ -+void main () -+{ -+ try -+ { -+ int b = 3; -+ } -+ catch (int a) { } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10419.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10419.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10419.d(12): Error: arr().length is not an lvalue -+--- -+*/ -+ -+int[] arr() { return []; } -+ -+void main() -+{ -+ arr().length = 1; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10599.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10599.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// 10599 ICE(interpret.c) -+ -+struct Bug { -+ int val = 3.45; -+} -+int bug10599() -+{ -+ Bug p = Bug(); -+ return 1; -+} -+ -+static assert(bug10599()); -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10600.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10600.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10600.d(30): Error: template instance to!(int, double) does not match template declaration to(T) -+--- -+*/ -+ -+import imports.ice10600a; -+import imports.ice10600b; -+ -+template Tuple(Specs...) -+{ -+ struct Tuple -+ { -+ string toString() -+ { -+ Appender!string w; // issue! -+ return ""; -+ } -+ } -+} -+Tuple!T tuple(T...)(T args) -+{ -+ return typeof(return)(); -+} -+ -+void main() -+{ -+ auto a = to!int(""); -+ auto b = to!(int, double)(""); -+ tuple(1); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10610.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10610.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+// 10610 CTFE ice -+ -+class Bug10610(T) -+{ -+ int baz() immutable { -+ return 1; -+ } -+ static immutable(Bug10610!T) min = new Bug10610!T(); -+} -+ -+void ice10610() -+{ -+ alias T10610 = Bug10610!(int); -+ static assert (T10610.min.baz()); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10616.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10616.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10616.d(9): Error: no property 'B' for type 'ice10616.A' -+fail_compilation/ice10616.d(9): Error: A.B is used as a type -+--- -+*/ -+ -+class A : A.B -+{ -+ interface B {} -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10624.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10624.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,51 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10624.d(38): Error: need member function opCmp() for struct Tuple!(Msg) to compare -+fail_compilation/ice10624.d(48): Error: template instance ice10624.Variant.handler!(Tuple!(Msg)) error instantiating -+fail_compilation/ice10624.d(22): instantiated from here: opAssign!(Tuple!(Msg)) -+fail_compilation/ice10624.d(22): Error: template instance ice10624.Variant.opAssign!(Tuple!(Msg)) error instantiating -+--- -+*/ -+ -+struct Msg {} -+ -+struct Tuple(Specs...) -+{ -+ Specs expand; -+ alias expand this; -+} -+ -+void main() -+{ -+ Variant data; -+ data = Tuple!Msg(); -+ -+} -+struct Variant -+{ -+ ptrdiff_t function() fptr = &handler!(void); -+ -+ static ptrdiff_t handler(A : void)() -+ { -+ return 0; -+ } -+ static ptrdiff_t handler(A)() -+ { -+ A* zis; -+ A* rhsPA; -+ { -+ return *zis < *rhsPA ? -1 : 1; -+ // Tupple!(Msg) < Tupple!(Msg) -+ // Tupple!(Msg).expand < Tupple!(Msg).expand -+ // -> should be error -+ } -+ return 0; -+ } -+ -+ Variant opAssign(T)(T rhs) -+ { -+ fptr = &handler!(T); -+ return this; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10651.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10651.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10651.d(11): Error: can only throw class objects derived from Throwable, not type int* -+--- -+*/ -+ -+void main() -+{ -+ alias T = int; -+ throw new T(); // ICE -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10713.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10713.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10713.d(10): Error: no property 'nonExistingField' for type 'S' -+--- -+*/ -+ -+struct S -+{ -+ void f(typeof(this.nonExistingField) a) {} -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10727a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10727a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// REQUIRED_ARGS: -c -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/foo10727a.d(34): Error: undefined identifier Frop -+fail_compilation/imports/foo10727a.d(26): Error: template instance foo10727a.CirBuff!(Foo) error instantiating -+fail_compilation/imports/foo10727a.d(31): instantiated from here: Bar!(Foo) -+fail_compilation/imports/foo10727a.d(31): Error: template instance foo10727a.Bar!(Foo) error instantiating -+--- -+*/ -+ -+import imports.foo10727a; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10727b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10727b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+// REQUIRED_ARGS: -c -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/foo10727b.d(25): Error: undefined identifier Frop -+fail_compilation/imports/foo10727b.d(17): Error: template instance foo10727b.CirBuff!(Foo) error instantiating -+fail_compilation/imports/foo10727b.d(22): instantiated from here: Bar!(Foo) -+fail_compilation/imports/foo10727b.d(22): Error: template instance foo10727b.Bar!(Foo) error instantiating -+--- -+*/ -+ -+import imports.foo10727b; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice10949.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice10949.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice10949.d(9): Error: array index 3 is out of bounds [5, 5][0 .. 2] -+fail_compilation/ice10949.d(9): Error: array index 17 is out of bounds [2, 3][0 .. 2] -+--- -+*/ -+int global; -+static assert((((((([5,5][3] + global - global)*global/global%global)>>global) &global|global)^global) == 9, [2,3][17]) || ([3,3,3][9] is 4) && ([[1,2,3]][4]).length); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11086.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11086.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice11086.d(11): Error: template instance foo!A template 'foo' is not defined -+fail_compilation/ice11086.d(11): Error: foo!A had previous errors -+--- -+*/ -+ -+struct A -+{ -+ foo!(A) l1,l2; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11136.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11136.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+// EXTRA_SOURCES: imports/bar11136.d -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/bar11136.d(1): Error: package name 'ice11136' conflicts with usage as a module name in file fail_compilation/ice11136.d -+--- -+*/ -+ -+module ice11136; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11153.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11153.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice11153.d(11): Error: function declaration without return type. (Note that constructors are always named 'this') -+fail_compilation/ice11153.d(11): Error: no identifier for declarator foo() -+--- -+*/ -+ -+struct S -+{ -+ foo(T)() {} -+ // Parser creates a TemplateDeclaration object with ident == NULL -+} -+ -+void main() {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11300.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11300.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+EXTRA_FILES: imports/ice11300a.d -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/ice11300a.d(3): Error: cannot resolve type for value -+--- -+*/ -+module ice11300; -+import imports.ice11300a; -+enum value = 42; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11472.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11472.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice11472.d(13): Error: template instance fun2!fun fun2 is not a template declaration, it is a function -+fail_compilation/ice11472.d(18): Error: template instance ice11472.fun1!(fun3) error instantiating -+--- -+*/ -+ -+void fun3() {} -+void fun2(string a) {} -+void fun1(alias fun=fun3)() -+{ -+ "a".fun2!fun; -+} -+ -+void main() -+{ -+ fun1; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11513a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11513a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+EXTRA_FILES: imports/ice11513x.d -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/ice11513x.d(1): Error: package name 'ice11513a' conflicts with usage as a module name in file fail_compilation/ice11513a.d -+--- -+*/ -+ -+module ice11513a; -+ -+import imports.ice11513x; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice11513b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice11513b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+EXTRA_FILES: imports/ice11513y.d -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/imports/ice11513y.d(1): Error: package name 'ice11513b' conflicts with usage as a module name in file fail_compilation/ice11513b.d -+--- -+*/ -+ -+module ice11513b; -+ -+import imports.ice11513y; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice4094.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice4094.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice4094.d(11): Error: circular reference to 'ice4094.Zug!0.Zug.bahn' -+fail_compilation/ice4094.d(19): Error: template instance ice4094.Zug!0 error instantiating -+--- -+*/ -+ -+struct Zug(int Z) -+{ -+ const bahn = Bug4094!(0).hof.bahn; -+} -+ -+struct Bug4094(int Q) -+{ -+ Zug!(0) hof; -+} -+ -+const a = Zug!(0).bahn; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice6538.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice6538.d 2014-04-01 16:32:51.000000000 +0100 -@@ -12,7 +12,7 @@ TEST_OUTPUT: - fail_compilation/ice6538.d(18): Error: cannot take a not yet instantiated symbol 'sizes' inside template constraint - fail_compilation/ice6538.d(23): Error: template ice6538.foo does not match any function template declaration. Candidates are: - fail_compilation/ice6538.d(18): ice6538.foo(I...)(I sizes) if (allSatisfy!(isIntegral, sizes)) --fail_compilation/ice6538.d(23): Error: template ice6538.foo(I...)(I sizes) if (allSatisfy!(isIntegral, sizes)) cannot deduce template function from argument types !()(int,int) -+fail_compilation/ice6538.d(23): Error: template ice6538.foo(I...)(I sizes) if (allSatisfy!(isIntegral, sizes)) cannot deduce template function from argument types !()(int, int) - --- - */ - void foo(I...)(I sizes) -@@ -30,7 +30,7 @@ fail_compilation/ice6538.d(36): Error: c - fail_compilation/ice6538.d(36): Error: cannot take a not yet instantiated symbol 't2' inside template constraint - fail_compilation/ice6538.d(41): Error: template ice6538.bar does not match any function template declaration. Candidates are: - fail_compilation/ice6538.d(36): ice6538.bar(T1, T2)(T1 t1, T2 t2) if (allSatisfy!(isIntegral, t1, t2)) --fail_compilation/ice6538.d(41): Error: template ice6538.bar(T1, T2)(T1 t1, T2 t2) if (allSatisfy!(isIntegral, t1, t2)) cannot deduce template function from argument types !()(int,int) -+fail_compilation/ice6538.d(41): Error: template ice6538.bar(T1, T2)(T1 t1, T2 t2) if (allSatisfy!(isIntegral, t1, t2)) cannot deduce template function from argument types !()(int, int) - --- - */ - void bar(T1, T2)(T1 t1, T2 t2) -@@ -54,8 +54,8 @@ TEST_OUTPUT: - --- - fail_compilation/ice6538.d(63): Error: cannot take a not yet instantiated symbol 'this' inside template constraint - fail_compilation/ice6538.d(69): Error: template ice6538.S.foo does not match any function template declaration. Candidates are: --fail_compilation/ice6538.d(63): ice6538.S.foo()() if (Sym!(this)) --fail_compilation/ice6538.d(69): Error: template ice6538.S.foo()() if (Sym!(this)) cannot deduce template function from argument types !()() -+fail_compilation/ice6538.d(63): ice6538.S.foo()() if (Sym!this) -+fail_compilation/ice6538.d(69): Error: template ice6538.S.foo()() if (Sym!this) cannot deduce template function from argument types !()() - --- - */ - struct S ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice7782.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice7782.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,5 @@ -+EXTRA_FILES: imports/ice7782range.d imports/ice7782algorithm.d -+import imports.ice7782algorithm; -+import imports.ice7782range. imports.ice7782math; -+ -+void main() {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice8795b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice8795b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice8795b.d(7): Error: anonymous classes not allowed -+--- -+*/ -+mixin("interface;"); ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice8795.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice8795.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice8795.d(13): Error: found 'EOF' when expecting '(' -+fail_compilation/ice8795.d(13): Error: expression expected, not 'EOF' -+fail_compilation/ice8795.d(13): Error: found 'EOF' when expecting ')' -+fail_compilation/ice8795.d(13): Error: found 'EOF' instead of statement -+fail_compilation/ice8795.d(14): Error: anonymous classes not allowed -+--- -+*/ -+void main() -+{ -+ mixin("switch"); -+ mixin("interface;"); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9494.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9494.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,20 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9494.d(10): Error: circular reference to 'ice9494.test' -+fail_compilation/ice9494.d(14): Error: circular reference to 'ice9494.Foo.test' -+fail_compilation/ice9494.d(19): Error: circular reference to 'ice9494.Bar.test' -+--- -+*/ -+ -+int[test] test; // stack overflow -+ -+class Foo -+{ -+ int[this.test] test; // stack overflow -+} -+ -+struct Bar -+{ -+ int[this.test] test; // stack overflow -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9540.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9540.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,37 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types () -+fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating -+--- -+*/ -+ -+template Tuple(E...) { alias E Tuple; } -+alias Tuple!(int) Args; -+ -+void main() { -+ (new A).test (); -+} -+ -+void test1 (int delegate (int) f) { f (-2); } -+ -+class A -+{ -+ int f (int a) { -+ return a; -+ } -+ -+ void test () { -+ test1 (&AddFront!(this, f)); -+ } -+} -+ -+template AddFront (alias ctx, alias fun) { -+ auto AddFront(Args args) { -+ auto dg (Args dgArgs) { -+ return fun (dgArgs); -+ } -+ dg.ptr = ctx; -+ return dg(args); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9545.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9545.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+// REQUIRED_ARGS: -o- -+/* -+TEST_OUTPUT: -+---- -+fail_compilation/ice9545.d(13): Error: expression has no value -+---- -+*/ -+ -+struct S { template T(X) { alias T = X; } } -+ -+void main() -+{ -+ auto x1 = S.init.T!int; // ICE -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9759.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9759.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9759.d(24): Error: mutable method ice9759.Json.opAssign is not callable using a const object -+--- -+*/ -+ -+struct Json -+{ -+ union -+ { -+ Json[] m_array; -+ Json[string] m_object; -+ } -+ -+ void opAssign(Json v) -+ { -+ } -+} -+ -+void bug() -+{ -+ const(Json) r; -+ r = r.init; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9806.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9806.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,52 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9806.d(12): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(17): Error: template instance ice9806.S1!() error instantiating -+fail_compilation/ice9806.d(13): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(19): Error: template instance ice9806.C1!() error instantiating -+fail_compilation/ice9806.d(14): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(21): Error: template instance ice9806.I1!() error instantiating -+--- -+*/ -+struct S1() { enum x = undefined_expr; } -+class C1() { enum x = undefined_expr; } -+class I1() { enum x = undefined_expr; } -+void test1() { -+ static assert(!is(typeof(S1!().x))); -+ auto sx = S1!().x; -+ static assert(!is(typeof(C1!().x))); -+ auto cx = C1!().x; -+ static assert(!is(typeof(I1!().x))); -+ auto ix = I1!().x; -+} -+ -+// -------- -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9806.d(39): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(42): Error: CTFE failed because of previous errors in foo2 -+fail_compilation/ice9806.d(47): Error: template instance ice9806.S2!() error instantiating -+fail_compilation/ice9806.d(40): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(43): Error: CTFE failed because of previous errors in bar2 -+fail_compilation/ice9806.d(49): Error: template instance ice9806.C2!() error instantiating -+fail_compilation/ice9806.d(41): Error: undefined identifier undefined_expr -+fail_compilation/ice9806.d(44): Error: CTFE failed because of previous errors in baz2 -+fail_compilation/ice9806.d(51): Error: template instance ice9806.I2!() error instantiating -+--- -+*/ -+int foo2()() { return undefined_expr; } -+int bar2()() { return undefined_expr; } -+int baz2()() { return undefined_expr; } -+struct S2() { enum x = foo2(); } -+class C2() { enum x = bar2(); } -+class I2() { enum x = baz2(); } -+void test2() { -+ static assert(!is(typeof(S2!().x))); -+ auto sx = S2!().x; -+ static assert(!is(typeof(C2!().x))); -+ auto cx = C2!().x; -+ static assert(!is(typeof(I2!().x))); -+ auto ix = I2!().x; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/ice9865.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/ice9865.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/ice9865.d(9): Error: struct ice9865.Foo no size yet for forward reference -+fail_compilation/ice9865.d(8): Error: alias ice9865.Baz cannot resolve -+--- -+*/ -+import imports.ice9865b : Baz; -+struct Foo { Baz f; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/bar11136.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/bar11136.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+module ice11136.bar11136; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+module imports.diag10089a; -+ -+struct chunks -+{ -+ this(size_t size) -+ { -+ } -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10089b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,5 @@ -+module imports.diag10089b; -+ -+void chunks(Source)(Source source, size_t chunkSize) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+module imports.diag10141a; -+ -+import imports.diag10141b; -+ -+string format() -+{ -+ auto w = Appender!string(); -+ char[] digits = ['0']; -+ put(w, digits); -+ return null; -+} -+ -+template Tuple(Specs...) -+{ -+ struct Tuple -+ { -+ Specs expand; -+ -+ enum x = format(); // in injectNameFields() -+ } -+} -+ -+private template Identity(alias T) -+{ -+ alias T Identity; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/diag10141b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,55 @@ -+module imports.diag10141b; -+ -+template isSomeChar(T) { -+ enum isSomeChar = -+ is(immutable T == immutable char) || -+ is(immutable T == immutable wchar) || -+ is(immutable T == immutable dchar); -+} -+ -+struct Appender(A : T[], T) -+{ -+ private template canPutItem(U) -+ { -+ enum bool canPutItem = -+ //isImplicitlyConvertible!(U, T) || -+ isSomeChar!T && isSomeChar!U; -+ } -+ private template canPutRange(Range) -+ { -+ enum bool canPutRange = -+ //isInputRange!Range && -+ is(typeof(Appender.init.put("a"d[0]))); -+ } -+ -+ /** -+ * Appends one item to the managed array. -+ */ -+ void put(U)(U item) if (canPutItem!U) -+ { -+ char[T.sizeof == 1 ? 4 : 2] encoded; -+ auto len = 1; -+ put(encoded[0 .. len]); // ! -+ } -+ -+ /** -+ * Appends an entire range to the managed array. -+ */ -+ void put(Range)(Range items) if (canPutRange!Range) -+ { -+ } -+} -+ -+void put(R, E)(ref R r, E e) -+{ -+ static if (is(typeof(r.put(e)))) -+ { -+ r.put(e); -+ } -+ else -+ { -+ static assert(false, -+ "Cannot put a "~E.stringof~" into a "~R.stringof); -+ } -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail10277.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail10277.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,23 @@ -+module imports.fail10277; -+ -+class TypeInfo { } -+class TypeInfo_Class { } -+class TypeInfo_Interface { } -+class TypeInfo_Struct { } -+class TypeInfo_Typedef { } -+class TypeInfo_Pointer { } -+class TypeInfo_Array { } -+class TypeInfo_AssociativeArray { } -+class TypeInfo_Enum { } -+class TypeInfo_Function { } -+class TypeInfo_Delegate { } -+class TypeInfo_Tuple { } -+class TypeInfo_Const { } -+class TypeInfo_Invariant { } -+class TypeInfo_Shared { } -+class TypeInfo_Inout { } -+class TypeInfo_Vector { } -+class Object { } -+class Throwable { } -+class Exception { } -+class Error { } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module imports.fail1900a; -+template Bar(int n) { enum Bar = n; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail1900b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+module imports.fail1900b; -+template Bar(short n) { enum Bar = n; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail2962a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail2962a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+import fail2962; -+ -+// comment 4 -+int foo4() -+{ -+ return bar4(0); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail4479.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/fail4479.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+module imports.fail4479mod; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,34 @@ -+struct CirBuff(T) -+{ -+ import std.traits : isArray; -+ CirBuff!T opAssign(R)(R) if (isArray!R) -+ {} -+ -+ struct Range(U, S) -+ { -+ Range!(U, S) save() { return U; } -+ } -+ -+ T[] toArray() -+ { -+ T[] ret = new T[this.length]; -+ return ret; -+ } -+ -+ alias toArray this; -+ -+ Range!(T, T) range() {} -+ -+} -+ -+class Bar(T = int) -+{ -+ CirBuff!T _bar; -+} -+ -+class Once -+{ -+ Bar!Foo _foobar; -+} -+ -+class Foo : Frop {} // Frop is not defined ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/foo10727b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+struct CirBuff(T) -+{ -+ import std.traits : isArray; -+ CirBuff!T opAssign(R)(R) if (isArray!R) -+ {} -+ -+ T[] toArray() -+ { -+ T[] ret = new T[this.length]; -+ return ret; -+ } -+ alias toArray this; -+} -+ -+class Bar(T = int) -+{ -+ CirBuff!T _bar; -+} -+ -+class Once -+{ -+ Bar!Foo _foobar; -+} -+ -+class Foo : Frop {} // Frop is not defined ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+module imports.ice10600a; -+ -+struct Appender(A : T[], T) -+{ -+ this(T[]) {} -+} -+ -+Appender!(E[]) appender(A : E[], E)() -+{ -+ return Appender!(E[])(null); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice10600b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,36 @@ -+module imports.ice10600b; -+ -+import imports.ice10600a; -+ -+template to(T) -+{ -+ T to(A...)(A args) -+ { -+ return toImpl!T(args); -+ } -+} -+ -+ -+T toImpl(T, S)(S value) -+if (is(S : T)) -+{ -+ return value; -+} -+ -+ -+T toImpl(T, S)(S value) -+if (!is(S : T) && -+ is(T == string)) -+{ -+ auto w = appender!T(); -+ //Appender!T w; -+ return null; -+} -+ -+T toImpl(T, S)(S value) -+if ( is(S == string) && -+ !is(T == string) && is(typeof(to!string(value[0]))) -+ ) -+{ -+ return T.init; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11300a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11300a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module imports.ice11300a; -+static import ice11300; -+enum value = ice11300.value; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513x.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513x.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+module ice11513a.imports; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513y.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice11513y.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+module ice11513b.imports.ice11513y; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782algorithm.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782algorithm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module imports.ice7782algorithm; -+ -+import imports.ice7782range; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782range.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice7782range.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module imports.ice7782range; -+ -+import imports.ice7782algorithm; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice9865b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/ice9865b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2 @@ -+import ice9865; -+class Bar { Foo foo; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/imports/test10327/empty.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/imports/test10327/empty.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1 @@ -+module empty; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/mangle1.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/mangle1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/mangle1.d(8): Error: pragma mangle can only apply to a single declaration -+--- -+*/ -+ -+pragma(mangle, "_stuff_") __gshared { int x, y; } ---- a/src/gcc/testsuite/gdc.test/fail_compilation/mangle2.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/mangle2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,42 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/mangle2.d(20): Error: pragma mangle char 0x20 not allowed in mangled name -+fail_compilation/mangle2.d(21): Error: pragma mangle char 0x20 not allowed in mangled name -+fail_compilation/mangle2.d(24): Error: pragma mangle char 0x0a not allowed in mangled name -+fail_compilation/mangle2.d(25): Error: pragma mangle char 0x0a not allowed in mangled name -+fail_compilation/mangle2.d(28): Error: pragma mangle char 0x07 not allowed in mangled name -+fail_compilation/mangle2.d(29): Error: pragma mangle char 0x07 not allowed in mangled name -+fail_compilation/mangle2.d(32): Error: pragma mangle char 0x01 not allowed in mangled name -+fail_compilation/mangle2.d(33): Error: pragma mangle char 0x01 not allowed in mangled name -+fail_compilation/mangle2.d(36): Error: pragma mangle char 0x00 not allowed in mangled name -+fail_compilation/mangle2.d(37): Error: pragma mangle char 0x00 not allowed in mangled name -+fail_compilation/mangle2.d(40): Error: pragma mangle Outside Unicode code space -+fail_compilation/mangle2.d(41): Error: pragma mangle Outside Unicode code space -+--- -+*/ -+ -+//spaces -+__gshared pragma(mangle, "test 9") ubyte test9_1; -+__gshared extern pragma(mangle, "test 9") ubyte test9_1_e; -+ -+//\n chars -+__gshared pragma(mangle, "test\n9") ubyte test9_2; -+__gshared extern pragma(mangle, "test\n9") ubyte test9_2_e; -+ -+//\a chars -+__gshared pragma(mangle, "test\a9") ubyte test9_3; -+__gshared extern pragma(mangle, "test\a9") ubyte test9_3_e; -+ -+//\x01 chars -+__gshared pragma(mangle, "test\x019") ubyte test9_4; -+__gshared extern pragma(mangle, "test\x019") ubyte test9_4_e; -+ -+//\0 chars -+__gshared pragma(mangle, "test\09") ubyte test9_5; -+__gshared extern pragma(mangle, "test\09") ubyte test9_5_e; -+ -+//\xff chars -+__gshared pragma(mangle, "test\xff9") ubyte test9_6; -+__gshared extern pragma(mangle, "test\xff9") ubyte test9_6_e; -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/parseStc.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/parseStc.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,37 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/parseStc.d(10): Error: if (v; e) is deprecated, use if (auto v = e) -+fail_compilation/parseStc.d(11): Error: redundant storage class 'const' -+--- -+*/ -+void test1() -+{ -+ if (x; 1) {} -+ if (const const auto x = 1) {} -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/parseStc.d(24): Error: redundant storage class 'const' -+fail_compilation/parseStc.d(25): Error: redundant storage class 'const' -+fail_compilation/parseStc.d(26): Error: conflicting storage class immutable -+--- -+*/ -+void test2() -+{ -+ const const x = 1; -+ foreach (const const x; [1,2,3]) {} -+ foreach (const immutable x; [1,2,3]) {} -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/parseStc.d(36): Error: redundant storage class 'const' -+fail_compilation/parseStc.d(37): Error: redundant storage class 'const' -+--- -+*/ -+struct S3 { const const test3() {} } -+void test4(const const int x) {} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/pragmamsg7568.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/pragmamsg7568.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,12 +0,0 @@ --// REQUIRED_ARGS: -c -o- -- --class C7568 {} --struct S7568 { C7568 c; } --auto test7568a() { return [new C7568]; } --auto test7568b() { return S7568(new C7568); } -- --pragma(msg, test7568a()); --pragma(msg, test7568b()); -- -- -- -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/fail_compilation/test64.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/test64.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,10 @@ -+/* -+TEST_OUTPUT: -+--- -+Error: module imports from file fail_compilation/imports/test64a.d conflicts with package name imports -+--- -+*/ -+ - // PERMUTE_ARGS: - - import std.stdio; ---- a/src/gcc/testsuite/gdc.test/fail_compilation/test8509.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/test8509.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,8 @@ -+module test8509; -+enum E : string { a = "hello", b = "world" } -+ -+void main() -+{ -+ E e1 = E.a ~ " world"; -+ E e2 = "hello " ~ E.b; -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/test8556.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/test8556.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,10 +1,8 @@ - /* - TEST_OUTPUT: - --- --fail_compilation/test8556.d(44): Error: template test8556.grabExactly matches more than one template declaration, fail_compilation/test8556.d(30):grabExactly(R)(R range) if (!isSliceable!(R)) and fail_compilation/test8556.d(31):grabExactly(R)(R range) if (isSliceable!(R)) --fail_compilation/test8556.d(19): Error: template instance test8556.isSliceable!(Circle!(uint[])) error instantiating --fail_compilation/test8556.d(24): Error: Grab!(Circle!(uint[])) is used as a type --fail_compilation/test8556.d(55): Error: template instance test8556.grab!(Circle!(uint[])) error instantiating -+fail_compilation/test8556.d(22): Error: template instance Grab!(Circle!(uint[])) does not match template declaration Grab(Range) if (!isSliceable!Range) -+fail_compilation/test8556.d(53): Error: template instance test8556.grab!(Circle!(uint[])) error instantiating - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/test8793.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/test8793.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,8 +2,8 @@ - TEST_OUTPUT: - --- - fail_compilation/test8793.d(13): Error: cannot implicitly convert expression (__lambda2) of type bool delegate(const(int) x) @system to bool delegate(const(int)) pure --fail_compilation/test8793.d(14): Error: cannot implicitly convert expression (__lambda4) of type bool delegate(const(int) x) @system to bool delegate(const(int)) pure --fail_compilation/test8793.d(16): Error: cannot implicitly convert expression (__lambda6) of type bool delegate(const(int) x) nothrow @safe to bool delegate(const(int)) pure -+fail_compilation/test8793.d(14): Error: cannot implicitly convert expression (__lambda2) of type bool delegate(const(int) x) @system to bool delegate(const(int)) pure -+fail_compilation/test8793.d(16): Error: cannot implicitly convert expression (__lambda2) of type bool delegate(const(int) x) nothrow @safe to bool delegate(const(int)) pure - --- - */ - ---- a/src/gcc/testsuite/gdc.test/fail_compilation/test9230.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/test9230.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,29 +0,0 @@ --/* --TEST_OUTPUT: ----- --fail_compilation/test9230.d(12): Error: cannot implicitly convert expression (s) of type const(char[]) to string --fail_compilation/test9230.d(18): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) --fail_compilation/test9230.d(23): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) --fail_compilation/test9230.d(28): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) ----- --*/ -- --string foo(in char[] s) pure { -- return s; // --} -- --/*pure*/ immutable(int[]) x1() --{ -- int[] a = new int[](10); -- return a; --} --/*pure */immutable(int[]) x2(int len) --{ -- int[] a = new int[](len); -- return a; --} --/*pure */immutable(int[]) x3(immutable(int[]) org) --{ -- int[] a = new int[](org.length); -- return a; --} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/testInference.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/testInference.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,135 @@ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/testInference.d(24): Error: cannot implicitly convert expression (this.a) of type inout(A8998) to immutable(A8998) -+--- -+*/ -+ -+class A8998 -+{ -+ int i; -+} -+class C8998 -+{ -+ A8998 a; -+ -+ this() -+ { -+ a = new A8998(); -+ } -+ -+ // WRONG: Returns immutable(A8998) -+ immutable(A8998) get() inout pure -+ { -+ return a; // should be error -+ } -+} -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/testInference.d(39): Error: cannot implicitly convert expression (s) of type const(char[]) to string -+fail_compilation/testInference.d(44): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) -+fail_compilation/testInference.d(49): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) -+fail_compilation/testInference.d(54): Error: cannot implicitly convert expression (a) of type int[] to immutable(int[]) -+--- -+*/ -+string foo(in char[] s) pure -+{ -+ return s; // -+} -+immutable(int[]) x1() /*pure*/ -+{ -+ int[] a = new int[](10); -+ return a; // -+} -+immutable(int[]) x2(int len) /*pure*/ -+{ -+ int[] a = new int[](len); -+ return a; -+} -+immutable(int[]) x3(immutable(int[]) org) /*pure*/ -+{ -+ int[] a = new int[](org.length); -+ return a; // -+} -+ -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/testInference.d(94): Error: cannot implicitly convert expression (c) of type testInference.C1 to immutable(C1) -+fail_compilation/testInference.d(95): Error: cannot implicitly convert expression (c) of type testInference.C1 to immutable(C1) -+fail_compilation/testInference.d(96): Error: cannot implicitly convert expression (c) of type testInference.C3 to immutable(C3) -+fail_compilation/testInference.d(97): Error: cannot implicitly convert expression (c) of type testInference.C3 to immutable(C3) -+fail_compilation/testInference.d(100): Error: undefined identifier X1, did you mean function x1? -+fail_compilation/testInference.d(106): Error: cannot implicitly convert expression (s) of type S1 to immutable(S1) -+fail_compilation/testInference.d(109): Error: cannot implicitly convert expression (a) of type int*[] to immutable(int*[]) -+fail_compilation/testInference.d(110): Error: cannot implicitly convert expression (a) of type const(int)*[] to immutable(int*[]) -+fail_compilation/testInference.d(114): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2) -+fail_compilation/testInference.d(115): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2) -+fail_compilation/testInference.d(116): Error: cannot implicitly convert expression (s) of type S2 to immutable(S2) -+fail_compilation/testInference.d(118): Error: cannot implicitly convert expression (a) of type const(int)*[] to immutable(int*[]) -+--- -+*/ -+immutable(Object) get(inout int*) pure -+{ -+ auto o = new Object; -+ return o; // should be ok -+} -+immutable(Object) get(immutable Object) pure -+{ -+ auto o = new Object; -+ return o; // should be ok -+} -+inout(Object) get(inout Object) pure -+{ -+ auto o = new Object; -+ return o; // should be ok (, but cannot in current conservative rule) -+} -+ -+class C1 { C2 c2; } -+class C2 { C3 c3; } -+class C3 { C1 c1; } -+immutable(C1) recursive1(C3 pc) pure { auto c = new C1(); return c; } // should be error, because pc.c1 == C1 -+immutable(C1) recursive2(C2 pc) pure { auto c = new C1(); return c; } // should be error, because pc.c3.c1 == C1 -+immutable(C3) recursive3(C1 pc) pure { auto c = new C3(); return c; } // should be error, c.c1 may be pc -+immutable(C3) recursive4(C2 pc) pure { auto c = new C3(); return c; } // should be error, c.c1.c2 may be pc -+immutable(C1) recursive5(shared C2 pc) pure { auto c = new C1(); return c; } -+immutable(C1) recursive6(immutable C2 pc) pure { auto c = new C1(); return c; } -+immutable(C1) recursiveE(immutable C2 pc) pure { auto c = new X1(); return c; } -+ -+class C4 { C4[] arr; } -+immutable(C4)[] recursive7(int[] arr) pure { auto a = new C4[](1); return a; } -+ -+struct S1 { int* ptr; } -+immutable(S1) foo1a( int*[] prm) pure { S1 s; return s; } // NG -+immutable(S1) foo1b( const int*[] prm) pure { S1 s; return s; } // OK -+immutable(S1) foo1c(immutable int*[] prm) pure { S1 s; return s; } // OK -+immutable(int*[]) bar1a( S1 prm) pure { int *[] a; return a; } // NG -+immutable(int*[]) bar1b( S1 prm) pure { const(int)*[] a; return a; } // NG -+immutable(int*[]) bar1c( S1 prm) pure { immutable(int)*[] a; return a; } // OK -+ -+struct S2 { const(int)* ptr; } -+immutable(S2) foo2a( int*[] prm) pure { S2 s; return s; } // OK -+immutable(S2) foo2b( const int*[] prm) pure { S2 s; return s; } // NG -+immutable(S2) foo2c(immutable int*[] prm) pure { S2 s; return s; } // NG -+immutable(int*[]) bar2a( S2 prm) pure { int *[] a; return a; } // OK -+immutable(int*[]) bar2b( S2 prm) pure { const(int)*[] a; return a; } // NG -+immutable(int*[]) bar2c( S2 prm) pure { immutable(int)*[] a; return a; } // OK -+ -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/testInference.d(134): Error: cannot implicitly convert expression (f10063(cast(inout(void*))p)) of type inout(void)* to immutable(void)* -+--- -+*/ -+inout(void)* f10063(inout void* p) pure -+{ -+ return p; -+} -+immutable(void)* g10063(inout int* p) pure -+{ -+ return f10063(p); -+} ---- a/src/gcc/testsuite/gdc.test/fail_compilation/testpull1810.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/testpull1810.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+// REQUIRED_ARGS: -c -w -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/testpull1810.d(19): Warning: statement is not reachable -+--- -+*/ -+ -+uint foo(uint i) -+{ -+ try -+ { -+ ++i; -+ return 3; -+ } -+ catch (Exception e) -+ { -+ } -+ return 4; -+} -+ ---- a/src/gcc/testsuite/gdc.test/fail_compilation/warn7444.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/fail_compilation/warn7444.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,83 @@ -+// REQUIRED_ARGS: -w -+// PERMUTE_ARGS: -+ -+/* -+TEST_OUTPUT: -+--- -+fail_compilation/warn7444.d(23): Error: cannot implicitly convert expression (e) of type int to int[] -+--- -+*/ -+ -+void test7444() -+{ -+ int[2] sa; -+ int[] da; -+ int e; -+ -+ { -+ // X: Changed accepts-invalid to rejects-invalid by this issue -+ // a: slice assginment -+ // b: element-wise assignment -+ sa = e; // X -+ sa[] = e; // b -+ da = e; -+ da[] = e; // b -+ -+ // lhs is static array -+ sa = sa; // b == identity assign -+ sa = sa[]; // X -+ sa[] = sa; // X -+ sa[] = sa[]; // b -+ -+ sa = da; // X -+ sa = da[]; // X -+ sa[] = da; // X -+ sa[] = da[]; // b -+ -+ // lhs is dynamic array -+ da = sa; // X -+ da = sa[]; // a -+ da[] = sa; // X -+ da[] = sa[]; // b -+ -+ da = da; // a == identity assign -+ da = da[]; // a -+ da[] = da; // X -+ da[] = da[]; // b -+ } -+} -+ -+/* -+TEST_OUTPUT: -+--- -+No warning -+--- -+*/ -+ -+void test10214() -+{ -+ bool[1] arr; -+ arr = 0; -+ pragma(msg, "No warning"); -+} -+ -+/* -+TEST_OUTPUT: -+--- -+No warning -+--- -+*/ -+ -+struct S11228 -+{ -+ int[2] ii; -+ alias ii this; -+} -+void test11228() -+{ -+ S11228 s; -+ int[2] ii; -+ ii = s.ii; // OK -+ ii = s; // OK <- Warning -+ pragma(msg, "No warning"); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/aliasthis.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/aliasthis.d 2014-04-01 16:32:51.000000000 +0100 -@@ -127,6 +127,68 @@ void test5() - } - - /**********************************************/ -+// 4617 -+ -+struct S4617 -+{ -+ struct F -+ { -+ int square(int n) { return n*n; } -+ real square(real n) { return n*n; } -+ } -+ F forward; -+ -+ alias forward this; -+ -+ alias forward.square sqr; // okay -+ -+ int field; -+ void mfunc(); -+ template Templ(){} -+ void tfunc()(){} -+} -+ -+template Id4617(alias k) { alias k Id4617; } -+ -+void test4617a() -+{ -+ alias Id4617!(S4617.square) test1; //NG -+ alias Id4617!(S4617.forward.square) test2; //OK -+ -+ alias Id4617!(S4617.sqr) test3; //okay -+ -+ static assert(__traits(isSame, S4617.square, S4617.forward.square)); -+} -+ -+void test4617b() -+{ -+ static struct Sub(T) -+ { -+ T value; -+ @property ref inout(T) payload() inout { return value; } -+ alias payload this; -+ } -+ -+ alias Id4617!(S4617.field) S_field; -+ alias Id4617!(S4617.mfunc) S_mfunc; -+ alias Id4617!(S4617.Templ) S_Templ; -+ alias Id4617!(S4617.tfunc) S_tfunc; -+ -+ alias Sub!S4617 T4617; -+ alias Id4617!(T4617.field) R_field; -+ alias Id4617!(T4617.mfunc) R_mfunc; -+ alias Id4617!(T4617.Templ) R_Templ; -+ alias Id4617!(T4617.tfunc) R_tfunc; -+ static assert(__traits(isSame, R_field, S_field)); -+ static assert(__traits(isSame, R_mfunc, S_mfunc)); -+ static assert(__traits(isSame, R_Templ, S_Templ)); -+ static assert(__traits(isSame, R_tfunc, S_tfunc)); -+ -+ alias Id4617!(T4617.square) R_sqr; -+ static assert(__traits(isSame, R_sqr, S4617.forward.square)); -+} -+ -+/**********************************************/ - // 4773 - - void test4773() -@@ -186,6 +248,163 @@ void test6() { - } - - /**********************************************/ -+// recursive alias this detection -+ -+class C0 {} -+ -+class C1 { C2 c; alias c this; } -+class C2 { C1 c; alias c this; } -+ -+class C3 { C2 c; alias c this; } -+ -+struct S0 {} -+ -+struct S1 { S2* ps; @property ref get(){return *ps;} alias get this; } -+struct S2 { S1* ps; @property ref get(){return *ps;} alias get this; } -+ -+struct S3 { S2* ps; @property ref get(){return *ps;} alias get this; } -+ -+struct S4 { S5* ps; @property ref get(){return *ps;} alias get this; } -+struct S5 { S4* ps; @property ref get(){return *ps;} alias get this; } -+ -+struct S6 { S5* ps; @property ref get(){return *ps;} alias get this; } -+ -+void test7() -+{ -+ // Able to check a type is implicitly convertible within a finite time. -+ static assert(!is(C1 : C0)); -+ static assert( is(C2 : C1)); -+ static assert( is(C1 : C2)); -+ static assert(!is(C3 : C0)); -+ static assert( is(C3 : C1)); -+ static assert( is(C3 : C2)); -+ -+ static assert(!is(S1 : S0)); -+ static assert( is(S2 : S1)); -+ static assert( is(S1 : S2)); -+ static assert(!is(S3 : S0)); -+ static assert( is(S3 : S1)); -+ static assert( is(S3 : S2)); -+ -+ C0 c0; C1 c1; C3 c3; -+ S0 s0; S1 s1; S3 s3; S4 s4; S6 s6; -+ -+ // Allow merging types that contains alias this recursion. -+ static assert( __traits(compiles, c0 is c1)); // typeMerge(c || c) e2->implicitConvTo(t1); -+ static assert( __traits(compiles, c0 is c3)); // typeMerge(c || c) e2->implicitConvTo(t1); -+ static assert( __traits(compiles, c1 is c0)); // typeMerge(c || c) e1->implicitConvTo(t2); -+ static assert( __traits(compiles, c3 is c0)); // typeMerge(c || c) e1->implicitConvTo(t2); -+ static assert(!__traits(compiles, s1 is c0)); // typeMerge(c || c) e1 -+ static assert(!__traits(compiles, s3 is c0)); // typeMerge(c || c) e1 -+ static assert(!__traits(compiles, c0 is s1)); // typeMerge(c || c) e2 -+ static assert(!__traits(compiles, c0 is s3)); // typeMerge(c || c) e2 -+ -+ static assert(!__traits(compiles, s1 is s0)); // typeMerge(s && s) e1 -+ static assert(!__traits(compiles, s3 is s0)); // typeMerge(s && s) e1 -+ static assert(!__traits(compiles, s0 is s1)); // typeMerge(s && s) e2 -+ static assert(!__traits(compiles, s0 is s3)); // typeMerge(s && s) e2 -+ static assert(!__traits(compiles, s1 is s4)); // typeMerge(s && s) e1 + e2 -+ static assert(!__traits(compiles, s3 is s6)); // typeMerge(s && s) e1 + e2 -+ -+ static assert(!__traits(compiles, s1 is 10)); // typeMerge(s || s) e1 -+ static assert(!__traits(compiles, s3 is 10)); // typeMerge(s || s) e1 -+ static assert(!__traits(compiles, 10 is s1)); // typeMerge(s || s) e2 -+ static assert(!__traits(compiles, 10 is s3)); // typeMerge(s || s) e2 -+ -+ // SliceExp::semantic -+ static assert(!__traits(compiles, c1[])); -+ static assert(!__traits(compiles, c3[])); -+ static assert(!__traits(compiles, s1[])); -+ static assert(!__traits(compiles, s3[])); -+ -+ // CallExp::semantic -+// static assert(!__traits(compiles, c1())); -+// static assert(!__traits(compiles, c3())); -+ static assert(!__traits(compiles, s1())); -+ static assert(!__traits(compiles, s3())); -+ -+ // AssignExp::semantic -+ static assert(!__traits(compiles, { c1[1] = 0; })); -+ static assert(!__traits(compiles, { c3[1] = 0; })); -+ static assert(!__traits(compiles, { s1[1] = 0; })); -+ static assert(!__traits(compiles, { s3[1] = 0; })); -+ static assert(!__traits(compiles, { c1[ ] = 0; })); -+ static assert(!__traits(compiles, { c3[ ] = 0; })); -+ static assert(!__traits(compiles, { s1[ ] = 0; })); -+ static assert(!__traits(compiles, { s3[ ] = 0; })); -+ -+ // UnaExp::op_overload -+ static assert(!__traits(compiles, +c1[1])); -+ static assert(!__traits(compiles, +c3[1])); -+ static assert(!__traits(compiles, +s1[1])); -+ static assert(!__traits(compiles, +s3[1])); -+ static assert(!__traits(compiles, +c1[ ])); -+ static assert(!__traits(compiles, +c3[ ])); -+ static assert(!__traits(compiles, +s1[ ])); -+ static assert(!__traits(compiles, +s3[ ])); -+ static assert(!__traits(compiles, +c1)); -+ static assert(!__traits(compiles, +c3)); -+ static assert(!__traits(compiles, +s1)); -+ static assert(!__traits(compiles, +s3)); -+ -+ // ArrayExp::op_overload -+ static assert(!__traits(compiles, c1[1])); -+ static assert(!__traits(compiles, c3[1])); -+ static assert(!__traits(compiles, s1[1])); -+ static assert(!__traits(compiles, s3[1])); -+ -+ // BinExp::op_overload -+ static assert(!__traits(compiles, c1 + 10)); // e1 -+ static assert(!__traits(compiles, c3 + 10)); // e1 -+ static assert(!__traits(compiles, 10 + c1)); // e2 -+ static assert(!__traits(compiles, 10 + c3)); // e2 -+ static assert(!__traits(compiles, s1 + 10)); // e1 -+ static assert(!__traits(compiles, s3 + 10)); // e1 -+ static assert(!__traits(compiles, 10 + s1)); // e2 -+ static assert(!__traits(compiles, 10 + s3)); // e2 -+ -+ // BinExp::compare_overload -+ static assert(!__traits(compiles, c1 < 10)); // (Object.opCmp(int) is invalid) -+ static assert(!__traits(compiles, c3 < 10)); // (Object.opCmp(int) is invalid) -+ static assert(!__traits(compiles, 10 < c1)); // (Object.opCmp(int) is invalid) -+ static assert(!__traits(compiles, 10 < c3)); // (Object.opCmp(int) is invalid) -+ static assert(!__traits(compiles, s1 < 10)); // e1 -+ static assert(!__traits(compiles, s3 < 10)); // e1 -+ static assert(!__traits(compiles, 10 < s1)); // e2 -+ static assert(!__traits(compiles, 10 < s3)); // e2 -+ -+ // BinAssignExp::op_overload -+ static assert(!__traits(compiles, c1[1] += 1)); -+ static assert(!__traits(compiles, c3[1] += 1)); -+ static assert(!__traits(compiles, s1[1] += 1)); -+ static assert(!__traits(compiles, s3[1] += 1)); -+ static assert(!__traits(compiles, c1[ ] += 1)); -+ static assert(!__traits(compiles, c3[ ] += 1)); -+ static assert(!__traits(compiles, s1[ ] += 1)); -+ static assert(!__traits(compiles, s3[ ] += 1)); -+ static assert(!__traits(compiles, c1 += c0)); // e1 -+ static assert(!__traits(compiles, c3 += c0)); // e1 -+ static assert(!__traits(compiles, s1 += s0)); // e1 -+ static assert(!__traits(compiles, s3 += s0)); // e1 -+ static assert(!__traits(compiles, c0 += c1)); // e2 -+ static assert(!__traits(compiles, c0 += c3)); // e2 -+ static assert(!__traits(compiles, s0 += s1)); // e2 -+ static assert(!__traits(compiles, s0 += s3)); // e2 -+ static assert(!__traits(compiles, c1 += s1)); // e1 + e2 -+ static assert(!__traits(compiles, c3 += s3)); // e1 + e2 -+ -+ // ForeachStatement::inferAggregate -+ static assert(!__traits(compiles, { foreach (e; s1){} })); -+ static assert(!__traits(compiles, { foreach (e; s3){} })); -+ static assert(!__traits(compiles, { foreach (e; c1){} })); -+ static assert(!__traits(compiles, { foreach (e; c3){} })); -+ -+ // Expression::checkToBoolean -+ static assert(!__traits(compiles, { if (s1){} })); -+ static assert(!__traits(compiles, { if (s3){} })); -+} -+ -+/***************************************************/ - // 2781 - - struct Tuple2781a(T...) { -@@ -436,6 +655,50 @@ void test6508() - assert(y == 20); - } - -+void test6508x() -+{ -+ static int ctor, cpctor, dtor; -+ -+ static struct Tuple(T...) -+ { -+ T field; -+ alias field this; -+ -+ this(int) { ++ctor; printf("ctor\n"); } -+ this(this) { ++cpctor; printf("cpctor\n"); } -+ ~this() { ++dtor; printf("dtor\n"); } -+ } -+ -+ { -+ alias Tup = Tuple!(int, string); -+ auto tup = Tup(1); -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ auto getVal() { return tup; } -+ ref getRef(ref Tup s = tup) { return s; } -+ -+ { -+ auto n1 = tup[0]; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ auto n2 = getRef()[0]; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ auto n3 = getVal()[0]; -+ assert(ctor==1 && cpctor==1 && dtor==1); -+ } -+ -+ // bug in DotVarExp::semantic -+ { -+ typeof(tup.field) vars; -+ vars = getVal(); -+ assert(ctor==1 && cpctor==2 && dtor==2); -+ } -+ } -+ assert(ctor==1 && cpctor==2 && dtor==3); -+ assert(ctor + cpctor == dtor); -+} -+ - /***********************************/ - // 6369 - -@@ -610,8 +873,65 @@ void test6366() - } - } - -+/***************************************************/ -+// 6711 -+ -+void test6711() -+{ -+ struct A { int i; } -+ struct B { A a; alias a this; } -+ struct C { B b; alias b this; } -+ -+ B b; -+ with (b) -+ { -+ i = 42; -+ } -+ assert(b.i == 42); -+ -+ C c; -+ with (c) -+ { -+ i = 42; -+ } -+ assert(c.i == 42); -+ -+ struct Foo -+ { -+ string[string] strs; -+ alias strs this; -+ } -+ -+ struct Bar -+ { -+ Foo f; -+ alias f this; -+ } -+ -+ void test(T)() -+ { -+ T f; -+ f = ["first" : "a", "second" : "b"]; -+ with (f) -+ { -+ assert(length == 2); -+ rehash; -+ auto vs = values; -+ assert(vs == ["a", "b"] || vs == ["b", "a"]); -+ auto ks = keys; -+ assert(ks == ["first", "second"] || ks == ["second", "first"]); -+ foreach (k; byKey) { } -+ foreach (v; byValue) { } -+ assert(get("a", "default") == "default"); -+ } -+ } -+ -+ test!Foo; -+ test!Bar; -+} -+ - /**********************************************/ --// Bugzill 6759 -+// 6759 - - struct Range - { -@@ -874,8 +1194,8 @@ void test8169() - } - - static assert(ValueImpl.getValue() == 42); // #0, OK -- static assert(ValueUser.getValue() == 42); // #1, NG -- static assert( ValueUser.m_valueImpl .getValue() == 42); // #2, NG -+ static assert(ValueUser.getValue() == 42); // #1, NG -> OK -+ static assert( ValueUser.m_valueImpl .getValue() == 42); // #2, NG -> OK - static assert(typeof(ValueUser.m_valueImpl).getValue() == 42); // #3, OK - } - -@@ -904,6 +1224,292 @@ struct S9177 - pragma(msg, is(S9177 : int)); - - /***************************************************/ -+// 9858 -+ -+struct S9858() -+{ -+ @property int get() const -+ { -+ return 42; -+ } -+ alias get this; -+ void opAssign(int) {} -+} -+void test9858() -+{ -+ const S9858!() s; -+ int i = s; -+} -+ -+/***************************************************/ -+// 9873 -+ -+void test9873() -+{ -+ struct Tup(T...) { T field; alias field this; } -+ -+ auto seq1 = Seq!(1, "hi"); -+ assert(Seq!(1, "hi") == Seq!(1, "hi")); -+ assert(seq1 == Seq!(1, "hi")); -+ assert(Seq!(1, "hi") == seq1); -+ assert(seq1 == seq1); -+ -+ auto seq2 = Seq!(2, "hi"); -+ assert(Seq!(1, "hi") != Seq!(2, "hi")); -+ assert(seq2 != Seq!(1, "hi")); -+ assert(Seq!(1, "hi") != seq2); -+ assert(seq2 != seq1); -+ -+ auto tup1 = Tup!(int, string)(1, "hi"); -+ assert(Seq!(1, "hi") == tup1); -+ assert(seq1 == tup1); -+ assert(tup1 == Seq!(1, "hi")); -+ assert(tup1 == seq1); -+ -+ auto tup2 = Tup!(int, string)(2, "hi"); -+ assert(Seq!(1, "hi") != tup2); -+ assert(seq1 != tup2); -+ assert(tup2 != Seq!(1, "hi")); -+ assert(tup2 != seq1); -+ -+ static assert(!__traits(compiles, seq1 == Seq!(1, "hi", [1,2]))); -+ static assert(!__traits(compiles, tup1 == Seq!(1, "hi", [1,2]))); -+} -+ -+/***************************************************/ -+// 10178 -+ -+void test10178() -+{ -+ struct S { static int count; } -+ S s; -+ assert((s.tupleof == s.tupleof) == true); -+ assert((s.tupleof != s.tupleof) == false); -+ -+ S getS() -+ { -+ S s; -+ ++S.count; -+ return s; -+ } -+ assert(getS().tupleof == getS().tupleof); -+ assert(S.count == 2); -+} -+ -+/***************************************************/ -+// 10179 -+ -+void test10179() -+{ -+ struct S { static int count; } -+ S s; -+ static assert(s.tupleof.length == 0); -+ s.tupleof = s.tupleof; // error -> OK -+ -+ S getS() -+ { -+ S s; -+ ++S.count; -+ return s; -+ } -+ getS().tupleof = getS().tupleof; -+ assert(S.count == 2); -+} -+ -+/***************************************************/ -+// 9890 -+ -+void test9890() -+{ -+ struct RefCounted(T) -+ { -+ T _payload; -+ -+ ref T refCountedPayload() -+ { -+ return _payload; -+ } -+ -+ alias refCountedPayload this; -+ } -+ -+ struct S(int x_) -+ { -+ alias x_ x; -+ } -+ -+ alias RefCounted!(S!1) Rs; -+ static assert(Rs.x == 1); -+} -+ -+/***************************************************/ -+// 10004 -+ -+void test10004() -+{ -+ static int count = 0; -+ -+ static S make(S)() -+ { -+ ++count; // necessary to make this function impure -+ S s; -+ return s; -+ } -+ -+ struct SX(T...) { -+ T field; alias field this; -+ } -+ alias S = SX!(int, long); -+ assert(make!S.field == make!S.field); -+ assert(count == 2); -+} -+ -+/***************************************************/ -+// 10180 -+ -+template TypeTuple10180(TL...) { alias TypeTuple10180 = TL; } -+ -+template Identity10180(alias T) { alias Identity10180 = T; } -+ -+struct Tuple10180(Specs...) -+{ -+ static if (is(Specs)) -+ { -+ alias Types = Specs; -+ Types expand; -+ alias expand this; -+ } -+ else -+ { -+ alias Types = TypeTuple10180!(Specs[0]); -+ Types expand; -+ mixin("alias Identity10180!(expand[0]) "~Specs[1]~";"); -+ -+ @property -+ ref Tuple10180!(Specs[0]) _Tuple_super() -+ { -+ return *cast(typeof(return)*) (&expand[0]); -+ } -+ alias _Tuple_super this; -+ } -+} -+ -+void test10180() -+{ -+ Tuple10180!(int, "a") x; -+ auto o1 = x.a.offsetof; // OK -+ auto o2 = x[0].offsetof; // NG: no property 'offsetof' for type 'int' -+ auto o3 = x._Tuple_super[0].offsetof; // same as above -+ assert(o2 == o3); -+} -+ -+/***************************************************/ -+// 10456 -+ -+void test10456() -+{ -+ S10456 s1, s2; -+ auto x = s1 == s2; -+} -+ -+struct S10456 -+{ -+ enum E { e }; -+ alias E this; -+ int[] x; -+} -+ -+/***************************************************/ -+// 11261 -+ -+template Tuple11261(Specs...) -+{ -+ struct Tuple11261 -+ { -+ static if (Specs.length != 4) // anonymous field version -+ { -+ alias Specs Types; -+ Types expand; -+ alias expand this; -+ } -+ else -+ { -+ alias Seq!(Specs[0], Specs[2]) Types; -+ Types expand; -+ ref inout(Tuple11261!Types) _Tuple_super() inout @trusted -+ { -+ return *cast(typeof(return)*) &(expand[0]); -+ } -+ // This is mostly to make t[n] work. -+ alias _Tuple_super this; -+ } -+ -+ this()(Types values) -+ { -+ expand[] = values[]; -+ } -+ } -+} -+ -+interface InputRange11261(E) -+{ -+ @property bool empty(); -+ @property E front(); -+ void popFront(); -+ -+ int opApply(int delegate(E)); -+ int opApply(int delegate(size_t, E)); -+ -+} -+template InputRangeObject11261(R) -+{ -+ alias typeof(R.init.front()) E; -+ -+ class InputRangeObject11261 : InputRange11261!E -+ { -+ private R _range; -+ -+ this(R range) { this._range = range; } -+ -+ @property bool empty() { return _range.empty; } -+ @property E front() { return _range.front; } -+ void popFront() { _range.popFront(); } -+ -+ int opApply(int delegate(E) dg) { return 0; } -+ int opApply(int delegate(size_t, E) dg) { return 0; } -+ } -+} -+ -+// ------ -+ -+class Container11261 -+{ -+ alias Tuple11261!(string, "key", string, "value") Key; -+ -+ InputRange11261!Key opSlice() -+ { -+ Range r; -+ return new InputRangeObject11261!Range(r); -+ } -+ private struct Range -+ { -+ enum empty = false; -+ auto popFront() {} -+ auto front() { return Key("myKey", "myValue"); } -+ } -+} -+ -+void test11261() -+{ -+ auto container = new Container11261(); -+ foreach (k, v; container) // map the tuple of container[].front to (k, v) -+ { -+ static assert(is(typeof(k) == string) && is(typeof(v) == string)); -+ break; -+ } -+} -+ -+/***************************************************/ - - int main() - { -@@ -912,9 +1518,12 @@ int main() - test3(); - test4(); - test5(); -+ test4617a(); -+ test4617b(); - test4773(); - test5188(); - test6(); -+ test7(); - test2781(); - test6546(); - test6736(); -@@ -922,12 +1531,14 @@ int main() - test2777b(); - test5679(); - test6508(); -+ test6508x(); - test6369a(); - test6369b(); - test6369c(); - test6369d(); - test6434(); - test6366(); -+ test6711(); - test6759(); - test6832(); - test6928(); -@@ -939,6 +1550,14 @@ int main() - test7992(); - test8169(); - test9174(); -+ test9858(); -+ test9873(); -+ test10178(); -+ test10179(); -+ test9890(); -+ test10004(); -+ test10180(); -+ test10456(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/arrayop.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/arrayop.d 2014-04-01 16:32:51.000000000 +0100 -@@ -12,160 +12,160 @@ template Floating(T) - - T[] A() - { -- printf("A\n"); -- abc ~= "A"; -- return a; -+ printf("A\n"); -+ abc ~= "A"; -+ return a; - } - - T[] B() - { -- printf("B\n"); -- abc ~= "B"; -- return b; -+ printf("B\n"); -+ abc ~= "B"; -+ return b; - } - - T[] C() - { -- printf("C\n"); -- abc ~= "C"; -- return c; -+ printf("C\n"); -+ abc ~= "C"; -+ return c; - } - - T D() - { -- printf("D\n"); -- abc ~= "D"; -- return 4; -+ printf("D\n"); -+ abc ~= "D"; -+ return 4; - } - - - void testx() - { -- a = [11, 22, 33]; -- b = [1, 2, 3]; -- c = [4, 5, 6]; -- -- abc = null; -- A()[] = B()[] + C()[]; -- assert(abc == "BCA"); -- assert(a[0] == 5); -- assert(a[1] == 7); -- assert(a[2] == 9); -- -- abc = null; -- A()[] = B()[] + 4; -- assert(abc == "BA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- abc = null; -- A()[] = 4 + B()[]; -- assert(abc == "BA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- abc = null; -- A()[] = D() + B()[]; -- assert(abc == "DBA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- a = [11, 22, 33]; -- abc = null; -- A()[] += B()[]; -- assert(abc == "BA"); -- assert(a[0] == 12); -- assert(a[1] == 24); -- assert(a[2] == 36); -- -- a = [11, 22, 33]; -- A()[] += 4; -- assert(a[0] == 15); -- assert(a[1] == 26); -- assert(a[2] == 37); -- -- a = [11, 22, 33]; -- A()[] -= 4; -- assert(a[0] == 7); -- assert(a[1] == 18); -- assert(a[2] == 29); -- -- a = [11, 22, 33]; -- A()[] *= 4; -- assert(a[0] == 44); -- assert(a[1] == 88); -- assert(a[2] == 132); -- -- a = [4, 8, 32]; -- A()[] /= 4; -- assert(a[0] == 1); -- assert(a[1] == 2); -- assert(a[2] == 8); -- -- a = [4, 8, 33]; -- A()[] %= 4; -- assert(a[0] == 0); -- assert(a[1] == 0); -- assert(a[2] == 1); -- -- a = [11, 22, 33]; -- abc = null; -- A()[] += 4 + B()[]; -- assert(abc == "BA"); -- assert(a[0] == 16); -- assert(a[1] == 28); -- assert(a[2] == 40); -- -- abc = null; -- A()[] = B()[] - C()[]; -- assert(abc == "BCA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == -3); -- assert(a[1] == -3); -- assert(a[2] == -3); -- -- abc = null; -- A()[] = -B()[] - C()[]; -- assert(abc == "BCA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == -5); -- assert(a[1] == -7); -- assert(a[2] == -9); -- -- abc = null; -- A()[] = B()[] + C()[] * 4; -- assert(abc == "BCA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == 17); -- assert(a[1] == 22); -- assert(a[2] == 27); -- -- abc = null; -- A()[] = B()[] + C()[] * B()[]; -- assert(abc == "BCBA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == 5); -- assert(a[1] == 12); -- assert(a[2] == 21); -- -- abc = null; -- A()[] = B()[] + C()[] / 2; -- assert(abc == "BCA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == 3); -- assert(a[1] == 4.5); -- assert(a[2] == 6); -- -- abc = null; -- A()[] = B()[] + C()[] % 2; -- assert(abc == "BCA"); -- printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -- assert(a[0] == 1); -- assert(a[1] == 3); -- assert(a[2] == 3); -+ a = [11, 22, 33]; -+ b = [1, 2, 3]; -+ c = [4, 5, 6]; -+ -+ abc = null; -+ A()[] = B()[] + C()[]; -+ assert(abc == "BCA"); -+ assert(a[0] == 5); -+ assert(a[1] == 7); -+ assert(a[2] == 9); -+ -+ abc = null; -+ A()[] = B()[] + 4; -+ assert(abc == "BA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ abc = null; -+ A()[] = 4 + B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ abc = null; -+ A()[] = D() + B()[]; -+ assert(abc == "DBA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ a = [11, 22, 33]; -+ abc = null; -+ A()[] += B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 12); -+ assert(a[1] == 24); -+ assert(a[2] == 36); -+ -+ a = [11, 22, 33]; -+ A()[] += 4; -+ assert(a[0] == 15); -+ assert(a[1] == 26); -+ assert(a[2] == 37); -+ -+ a = [11, 22, 33]; -+ A()[] -= 4; -+ assert(a[0] == 7); -+ assert(a[1] == 18); -+ assert(a[2] == 29); -+ -+ a = [11, 22, 33]; -+ A()[] *= 4; -+ assert(a[0] == 44); -+ assert(a[1] == 88); -+ assert(a[2] == 132); -+ -+ a = [4, 8, 32]; -+ A()[] /= 4; -+ assert(a[0] == 1); -+ assert(a[1] == 2); -+ assert(a[2] == 8); -+ -+ a = [4, 8, 33]; -+ A()[] %= 4; -+ assert(a[0] == 0); -+ assert(a[1] == 0); -+ assert(a[2] == 1); -+ -+ a = [11, 22, 33]; -+ abc = null; -+ A()[] += 4 + B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 16); -+ assert(a[1] == 28); -+ assert(a[2] == 40); -+ -+ abc = null; -+ A()[] = B()[] - C()[]; -+ assert(abc == "BCA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == -3); -+ assert(a[1] == -3); -+ assert(a[2] == -3); -+ -+ abc = null; -+ A()[] = -B()[] - C()[]; -+ assert(abc == "BCA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == -5); -+ assert(a[1] == -7); -+ assert(a[2] == -9); -+ -+ abc = null; -+ A()[] = B()[] + C()[] * 4; -+ assert(abc == "BCA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == 17); -+ assert(a[1] == 22); -+ assert(a[2] == 27); -+ -+ abc = null; -+ A()[] = B()[] + C()[] * B()[]; -+ assert(abc == "BCBA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == 5); -+ assert(a[1] == 12); -+ assert(a[2] == 21); -+ -+ abc = null; -+ A()[] = B()[] + C()[] / 2; -+ assert(abc == "BCA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == 3); -+ assert(a[1] == 4.5); -+ assert(a[2] == 6); -+ -+ abc = null; -+ A()[] = B()[] + C()[] % 2; -+ assert(abc == "BCA"); -+ printf("%Lg, %Lg, %Lg\n", cast(real)a[0], cast(real)a[1], cast(real)a[2]); -+ assert(a[0] == 1); -+ assert(a[1] == 3); -+ assert(a[2] == 3); - } - } - -@@ -190,206 +190,206 @@ template Integral(T) - - T[] A() - { -- printf("A\n"); -- abc ~= "A"; -- return a; -+ printf("A\n"); -+ abc ~= "A"; -+ return a; - } - - T[] B() - { -- printf("B\n"); -- abc ~= "B"; -- return b; -+ printf("B\n"); -+ abc ~= "B"; -+ return b; - } - - T[] C() - { -- printf("C\n"); -- abc ~= "C"; -- return c; -+ printf("C\n"); -+ abc ~= "C"; -+ return c; - } - - T D() - { -- printf("D\n"); -- abc ~= "D"; -- return 4; -+ printf("D\n"); -+ abc ~= "D"; -+ return 4; - } - - - void testx() - { -- a = [11, 22, 33]; -- b = [1, 2, 3]; -- c = [4, 5, 6]; -- -- abc = null; -- A()[] = B()[] + C()[]; -- assert(abc == "BCA"); -- assert(a[0] == 5); -- assert(a[1] == 7); -- assert(a[2] == 9); -- -- abc = null; -- A()[] = B()[] + 4; -- assert(abc == "BA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- abc = null; -- A()[] = 4 + B()[]; -- assert(abc == "BA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- abc = null; -- A()[] = D() + B()[]; -- assert(abc == "DBA"); -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- a = [11, 22, 33]; -- abc = null; -- A()[] += B()[]; -- assert(abc == "BA"); -- assert(a[0] == 12); -- assert(a[1] == 24); -- assert(a[2] == 36); -- -- a = [11, 22, 33]; -- A()[] += 4; -- assert(a[0] == 15); -- assert(a[1] == 26); -- assert(a[2] == 37); -- -- a = [11, 22, 33]; -- A()[] -= 4; -- assert(a[0] == 7); -- assert(a[1] == 18); -- assert(a[2] == 29); -- -- a = [11, 22, 27]; -- A()[] *= 4; -- assert(a[0] == 44); -- assert(a[1] == 88); -- assert(a[2] == 108); -- -- a = [11, 22, 33]; -- A()[] /= 4; -- assert(a[0] == 2); -- assert(a[1] == 5); -- assert(a[2] == 8); -- -- a = [11, 22, 33]; -- A()[] %= 4; -- assert(a[0] == 3); -- assert(a[1] == 2); -- assert(a[2] == 1); -- -- a = [1, 2, 7]; -- A()[] &= 4; -- assert(a[0] == 0); -- assert(a[1] == 0); -- assert(a[2] == 4); -- -- a = [1, 2, 7]; -- A()[] |= 4; -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 7); -- -- a = [1, 2, 7]; -- A()[] ^= 4; -- assert(a[0] == 5); -- assert(a[1] == 6); -- assert(a[2] == 3); -- -- a = [11, 22, 33]; -- abc = null; -- A()[] += 4 + B()[]; -- assert(abc == "BA"); -- assert(a[0] == 16); -- assert(a[1] == 28); -- assert(a[2] == 40); -- -- abc = null; -- A()[] = B()[] - C()[]; -- assert(abc == "BCA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == -3); -- assert(a[1] == -3); -- assert(a[2] == -3); -- -- abc = null; -- A()[] = -B()[] - C()[]; -- assert(abc == "BCA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == -5); -- assert(a[1] == -7); -- assert(a[2] == -9); -- -- abc = null; -- A()[] = B()[] + C()[] * 4; -- assert(abc == "BCA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == 17); -- assert(a[1] == 22); -- assert(a[2] == 27); -- -- abc = null; -- A()[] = B()[] + C()[] * B()[]; -- assert(abc == "BCBA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == 5); -- assert(a[1] == 12); -- assert(a[2] == 21); -- -- abc = null; -- A()[] = B()[] + C()[] / 2; -- assert(abc == "BCA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == 3); -- assert(a[1] == 4); -- assert(a[2] == 6); -- -- abc = null; -- A()[] = B()[] + C()[] % 2; -- assert(abc == "BCA"); -- printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -- assert(a[0] == 1); -- assert(a[1] == 3); -- assert(a[2] == 3); -- -- abc = null; -- A()[] = ~B()[]; -- assert(abc == "BA"); -- assert(a[0] == ~cast(T)1); -- assert(a[1] == ~cast(T)2); -- assert(a[2] == ~cast(T)3); -- -- abc = null; -- A()[] = B()[] & 2; -- assert(abc == "BA"); -- assert(a[0] == 0); -- assert(a[1] == 2); -- assert(a[2] == 2); -- -- abc = null; -- A()[] = B()[] | 2; -- assert(abc == "BA"); -- assert(a[0] == 3); -- assert(a[1] == 2); -- assert(a[2] == 3); -- -- abc = null; -- A()[] = B()[] ^ 2; -- assert(abc == "BA"); -- assert(a[0] == 3); -- assert(a[1] == 0); -- assert(a[2] == 1); -+ a = [11, 22, 33]; -+ b = [1, 2, 3]; -+ c = [4, 5, 6]; -+ -+ abc = null; -+ A()[] = B()[] + C()[]; -+ assert(abc == "BCA"); -+ assert(a[0] == 5); -+ assert(a[1] == 7); -+ assert(a[2] == 9); -+ -+ abc = null; -+ A()[] = B()[] + 4; -+ assert(abc == "BA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ abc = null; -+ A()[] = 4 + B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ abc = null; -+ A()[] = D() + B()[]; -+ assert(abc == "DBA"); -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ a = [11, 22, 33]; -+ abc = null; -+ A()[] += B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 12); -+ assert(a[1] == 24); -+ assert(a[2] == 36); -+ -+ a = [11, 22, 33]; -+ A()[] += 4; -+ assert(a[0] == 15); -+ assert(a[1] == 26); -+ assert(a[2] == 37); -+ -+ a = [11, 22, 33]; -+ A()[] -= 4; -+ assert(a[0] == 7); -+ assert(a[1] == 18); -+ assert(a[2] == 29); -+ -+ a = [11, 22, 27]; -+ A()[] *= 4; -+ assert(a[0] == 44); -+ assert(a[1] == 88); -+ assert(a[2] == 108); -+ -+ a = [11, 22, 33]; -+ A()[] /= 4; -+ assert(a[0] == 2); -+ assert(a[1] == 5); -+ assert(a[2] == 8); -+ -+ a = [11, 22, 33]; -+ A()[] %= 4; -+ assert(a[0] == 3); -+ assert(a[1] == 2); -+ assert(a[2] == 1); -+ -+ a = [1, 2, 7]; -+ A()[] &= 4; -+ assert(a[0] == 0); -+ assert(a[1] == 0); -+ assert(a[2] == 4); -+ -+ a = [1, 2, 7]; -+ A()[] |= 4; -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 7); -+ -+ a = [1, 2, 7]; -+ A()[] ^= 4; -+ assert(a[0] == 5); -+ assert(a[1] == 6); -+ assert(a[2] == 3); -+ -+ a = [11, 22, 33]; -+ abc = null; -+ A()[] += 4 + B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == 16); -+ assert(a[1] == 28); -+ assert(a[2] == 40); -+ -+ abc = null; -+ A()[] = B()[] - C()[]; -+ assert(abc == "BCA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == -3); -+ assert(a[1] == -3); -+ assert(a[2] == -3); -+ -+ abc = null; -+ A()[] = -B()[] - C()[]; -+ assert(abc == "BCA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == -5); -+ assert(a[1] == -7); -+ assert(a[2] == -9); -+ -+ abc = null; -+ A()[] = B()[] + C()[] * 4; -+ assert(abc == "BCA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == 17); -+ assert(a[1] == 22); -+ assert(a[2] == 27); -+ -+ abc = null; -+ A()[] = B()[] + C()[] * B()[]; -+ assert(abc == "BCBA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == 5); -+ assert(a[1] == 12); -+ assert(a[2] == 21); -+ -+ abc = null; -+ A()[] = B()[] + C()[] / 2; -+ assert(abc == "BCA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == 3); -+ assert(a[1] == 4); -+ assert(a[2] == 6); -+ -+ abc = null; -+ A()[] = B()[] + C()[] % 2; -+ assert(abc == "BCA"); -+ printf("%lld, %lld, %lld\n", cast(long)a[0], cast(long)a[1], cast(long)a[2]); -+ assert(a[0] == 1); -+ assert(a[1] == 3); -+ assert(a[2] == 3); -+ -+ abc = null; -+ A()[] = ~B()[]; -+ assert(abc == "BA"); -+ assert(a[0] == ~cast(T)1); -+ assert(a[1] == ~cast(T)2); -+ assert(a[2] == ~cast(T)3); -+ -+ abc = null; -+ A()[] = B()[] & 2; -+ assert(abc == "BA"); -+ assert(a[0] == 0); -+ assert(a[1] == 2); -+ assert(a[2] == 2); -+ -+ abc = null; -+ A()[] = B()[] | 2; -+ assert(abc == "BA"); -+ assert(a[0] == 3); -+ assert(a[1] == 2); -+ assert(a[2] == 3); -+ -+ abc = null; -+ A()[] = B()[] ^ 2; -+ assert(abc == "BA"); -+ assert(a[0] == 3); -+ assert(a[1] == 0); -+ assert(a[2] == 1); - } - } - -@@ -549,16 +549,182 @@ void test8390() { - } - - /************************************************************************/ -+// 8651 -+ -+void test8651() -+{ -+ void test(T)() @safe pure nothrow -+ { -+ T[3] a = [11, 22, 33]; -+ T[3] b = [1, 2, 3]; -+ T[3] c = [4, 5, 6]; -+ T d = 4; -+ -+ // Arithmetic array ops -+ { -+ a[] = b[] + c[]; -+ a[] = b[] + 4; -+ a[] = 4 + b[]; -+ a[] = d + b[]; -+ a[] += b[]; -+ a[] += 4; -+ a[] -= 4; -+ a[] *= 4; -+ a[] /= 4; -+ a[] %= 4; -+ a[] += 4 + b[]; -+ a[] = b[] - c[]; -+ a[] = -b[] - c[]; -+ a[] = b[] + c[] * 4; -+ a[] = b[] + c[] * b[]; -+ a[] = b[] + c[] / 2; -+ a[] = b[] + c[] % 2; -+ } -+ // Bitwise array ops -+ static if (is(typeof(T.init & T.init))) -+ { -+ a[] &= 4; -+ a[] |= 4; -+ a[] ^= 4; -+ a[] = ~b[]; -+ a[] = b[] & 2; -+ a[] = b[] | 2; -+ a[] = b[] ^ 2; -+ } -+ } -+ -+ test!float(); -+ test!double(); -+ test!real(); -+ -+ test!byte(); -+ test!short(); -+ test!int(); -+ test!long(); -+} -+ -+/************************************************************************/ -+// 9656 -+ -+void test9656() -+{ -+ static class C {} -+ static struct S -+ { -+ immutable int[] narr1; -+ immutable int[] narr2; -+ immutable C[] carr1; -+ immutable C[] carr2; -+ this(int n) { -+ narr1 = new int[](3); // OK, expected -+ narr2 = [1,2,3].dup; // NG -> OK -+ carr1 = [new C].dup; // NG -> OK -+ -+ C c = new C; -+ static assert(!__traits(compiles, carr2 = [c])); -+ } -+ } -+ -+ { -+ int[] ma = [1,2,3]; -+ immutable ia = ma.dup; -+ } -+ -+ -+ { -+ static struct V { int val; } -+ V[] ma = [V(1), V(2)]; -+ immutable ia = ma.dup; -+ } -+ -+ { -+ static struct R { int* ptr; } -+ R[] ma = [R(new int), R(null)]; -+ static assert(!__traits(compiles, { immutable ia = rarr.dup; })); -+ } -+ -+ { -+ C[] ma = [new C(), new C()]; -+ static assert(!__traits(compiles, { immutable ia = carr.dup; })); -+ } -+} -+ -+/************************************************************************/ -+// 10433 -+ -+void test10433() -+{ -+ void foo(T)(in int[] v1, in T v2) -+ { -+ int[2] r; -+ r[] = v1[] + v2[]; -+ } -+ -+ immutable int[] v = [10, 20]; -+ foo(v, v); -+} -+ -+/************************************************************************/ -+// 10684 -+ -+void test10684a() -+{ -+ int[] a = [0, 0]; -+ a[] += [10, 20][]; -+} -+ -+void test10684b() -+{ -+ int[] a = [1, 2, 3]; -+ int[] b = [4, 5, 6]; -+ -+ // Allow array literal as the operand of array oeration -+ a[] += [1, 2, 3]; -+ assert(a == [2, 4, 6]); -+ -+ a[] *= b[] + [1, 1, 1]; -+ assert(a == [2*(4+1), 4*(5+1), 6*(6+1)]); -+ -+ a[] = [9, 8, 7] - [1, 2, 3]; -+ assert(a == [8, 6, 4]); -+ -+ a[] = [2, 4, 6] / 2; -+ assert(a == [1,2,3]); -+ -+ // Disallow: [1,2,3] is not an lvalue -+ static assert(!__traits(compiles, { [1,2,3] = a[] * 2; })); -+ static assert(!__traits(compiles, { [1,2,3] += a[] * b[]; })); -+} -+ -+/************************************************************************/ - - int main() - { -- test1(); -- test2(); -+ version(X86) -+ { -+ test1(); -+ test2(); -+ } -+ else version(X86_64) -+ { -+ test1(); -+ test2(); -+ } -+ else -+ { -+ pragma(msg, "arrayop.d:test1 Test skipped because arrayop evaluation" -+ " order is ill-defined. See GDC issue #8"); -+ } - test3(); - test4(); - test5(); - test6(); - test8390(); -+ test8651(); -+ test9656(); -+ test10433(); -+ test10684a(); -+ test10684b(); - - printf("Success\n"); - return 0; -@@ -570,7 +736,7 @@ version (none) - extern (C) T[] _arraySliceSliceAddSliceAssignd(T[] a, T[] c, T[] b) - { - foreach (i; 0 .. a.length) -- a[i] = b[i] + c[i]; -+ a[i] = b[i] + c[i]; - return a; - } - } ---- a/src/gcc/testsuite/gdc.test/runnable/assignable.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/assignable.d 2014-04-01 16:32:51.000000000 +0100 -@@ -245,81 +245,81 @@ struct CtorTest6174(Data) - // As long as you don't try to rewrite values beyond the indirections, - // an assignment will always be succeeded inside constructor. - -- static assert( __traits(compiles, { data = a; })); // OK -+ static assert( is(typeof( data = a ))); // OK - static if (is(Data == struct)) - { -- static assert( __traits(compiles, { data.x = 1; })); // OK -- static assert( __traits(compiles, { data.y = 2; })); // OK -+ static assert( is(typeof( data.x = 1 ))); // OK -+ static assert( is(typeof( data.y = 2 ))); // OK - } -- static assert(!__traits(compiles, { *pdata = a; })); // NG -- static assert( __traits(compiles, { *&data = a; })); // OK -+ static assert(!is(typeof( *pdata = a ))); // NG -+ static assert( is(typeof( *&data = a ))); // OK - -- static assert( __traits(compiles, { sa1 = [a,a]; })); // OK -- static assert( __traits(compiles, { sa1[0] = a; })); // OK -- static assert( __traits(compiles, { sa1[] = a; })); // OK -- static assert( __traits(compiles, { sa1[][] = a; })); // OK -- -- static assert( __traits(compiles, { sa2 = [[a,a]]; })); // OK -- static assert( __traits(compiles, { sa2[0][0] = a; })); // OK -- static assert( __traits(compiles, { sa2[][0][] = a; })); // OK -- static assert( __traits(compiles, { sa2[0][][0] = a; })); // OK -- -- static assert( __traits(compiles, { sa3 = [[a],[]]; })); // OK -- static assert( __traits(compiles, { sa3[0] = [a,a]; })); // OK -- static assert(!__traits(compiles, { sa3[0][0] = a; })); // NG -- static assert( __traits(compiles, { sa3[] = [a]; })); // OK -- static assert( __traits(compiles, { sa3[][0] = [a]; })); // OK -- static assert(!__traits(compiles, { sa3[][0][0] = a; })); // NG -- -- static assert( __traits(compiles, { da1 = [a,a]; })); // OK -- static assert(!__traits(compiles, { da1[0] = a; })); // NG -- static assert(!__traits(compiles, { da1[] = a; })); // NG -- -- static assert( __traits(compiles, { da2 = [[a,a]]; })); // OK -- static assert(!__traits(compiles, { da2[0][0] = a; })); // NG -- static assert(!__traits(compiles, { da2[] = [a,a]; })); // NG -- static assert(!__traits(compiles, { da2[][0] = a; })); // NG -- static assert(!__traits(compiles, { da2[0][] = a; })); // NG -+ static assert( is(typeof( sa1 = [a,a] ))); // OK -+ static assert( is(typeof( sa1[0] = a ))); // OK -+ static assert( is(typeof( sa1[] = a ))); // OK -+ static assert( is(typeof( sa1[][] = a ))); // OK -+ -+ static assert( is(typeof( sa2 = [[a,a]] ))); // OK -+ static assert( is(typeof( sa2[0][0] = a ))); // OK -+ static assert( is(typeof( sa2[][0][] = a ))); // OK -+ static assert( is(typeof( sa2[0][][0] = a ))); // OK -+ -+ static assert( is(typeof( sa3 = [[a],[]] ))); // OK -+ static assert( is(typeof( sa3[0] = [a,a] ))); // OK -+ static assert(!is(typeof( sa3[0][0] = a ))); // NG -+ static assert( is(typeof( sa3[] = [a] ))); // OK -+ static assert( is(typeof( sa3[][0] = [a] ))); // OK -+ static assert(!is(typeof( sa3[][0][0] = a ))); // NG -+ -+ static assert( is(typeof( da1 = [a,a] ))); // OK -+ static assert(!is(typeof( da1[0] = a ))); // NG -+ static assert(!is(typeof( da1[] = a ))); // NG -+ -+ static assert( is(typeof( da2 = [[a,a]] ))); // OK -+ static assert(!is(typeof( da2[0][0] = a ))); // NG -+ static assert(!is(typeof( da2[] = [a,a] ))); // NG -+ static assert(!is(typeof( da2[][0] = a ))); // NG -+ static assert(!is(typeof( da2[0][] = a ))); // NG - } - void func(Data a) - { - auto pdata = &data; - -- static assert(!__traits(compiles, { data = a; })); // NG -+ static assert(!is(typeof( data = a ))); // NG - static if (is(Data == struct)) - { -- static assert(!__traits(compiles, { data.x = 1; })); // NG -- static assert(!__traits(compiles, { data.y = 2; })); // NG -+ static assert(!is(typeof( data.x = 1 ))); // NG -+ static assert(!is(typeof( data.y = 2 ))); // NG - } -- static assert(!__traits(compiles, { *pdata = a; })); // NG -- static assert(!__traits(compiles, { *&data = a; })); // NG -+ static assert(!is(typeof( *pdata = a ))); // NG -+ static assert(!is(typeof( *&data = a ))); // NG - -- static assert(!__traits(compiles, { sa1 = [a,a]; })); // NG -- static assert(!__traits(compiles, { sa1[0] = a; })); // NG -- static assert(!__traits(compiles, { sa1[] = a; })); // NG -- static assert(!__traits(compiles, { sa1[][] = a; })); // NG -- -- static assert(!__traits(compiles, { sa2 = [[a,a]]; })); // NG -- static assert(!__traits(compiles, { sa2[0][0] = a; })); // NG -- static assert(!__traits(compiles, { sa2[][0][] = a; })); // NG -- static assert(!__traits(compiles, { sa2[0][][0] = a; })); // NG -- -- static assert(!__traits(compiles, { sa3 = [[a],[]]; })); // NG -- static assert(!__traits(compiles, { sa3[0] = [a,a]; })); // NG -- static assert(!__traits(compiles, { sa3[0][0] = a; })); // NG -- static assert(!__traits(compiles, { sa3[] = [a]; })); // NG -- static assert(!__traits(compiles, { sa3[][0] = [a]; })); // NG -- static assert(!__traits(compiles, { sa3[][0][0] = a; })); // NG -- -- static assert(!__traits(compiles, { da1 = [a,a]; })); // NG -- static assert(!__traits(compiles, { da1[0] = a; })); // NG -- static assert(!__traits(compiles, { da1[] = a; })); // NG -- -- static assert(!__traits(compiles, { da2 = [[a,a]]; })); // NG -- static assert(!__traits(compiles, { da2[0][0] = a; })); // NG -- static assert(!__traits(compiles, { da2[] = [a,a]; })); // NG -- static assert(!__traits(compiles, { da2[][0] = a; })); // NG -- static assert(!__traits(compiles, { da2[0][] = a; })); // NG -+ static assert(!is(typeof( sa1 = [a,a] ))); // NG -+ static assert(!is(typeof( sa1[0] = a ))); // NG -+ static assert(!is(typeof( sa1[] = a ))); // NG -+ static assert(!is(typeof( sa1[][] = a ))); // NG -+ -+ static assert(!is(typeof( sa2 = [[a,a]] ))); // NG -+ static assert(!is(typeof( sa2[0][0] = a ))); // NG -+ static assert(!is(typeof( sa2[][0][] = a ))); // NG -+ static assert(!is(typeof( sa2[0][][0] = a ))); // NG -+ -+ static assert(!is(typeof( sa3 = [[a],[]] ))); // NG -+ static assert(!is(typeof( sa3[0] = [a,a] ))); // NG -+ static assert(!is(typeof( sa3[0][0] = a ))); // NG -+ static assert(!is(typeof( sa3[] = [a] ))); // NG -+ static assert(!is(typeof( sa3[][0] = [a] ))); // NG -+ static assert(!is(typeof( sa3[][0][0] = a ))); // NG -+ -+ static assert(!is(typeof( da1 = [a,a] ))); // NG -+ static assert(!is(typeof( da1[0] = a ))); // NG -+ static assert(!is(typeof( da1[] = a ))); // NG -+ -+ static assert(!is(typeof( da2 = [[a,a]] ))); // NG -+ static assert(!is(typeof( da2[0][0] = a ))); // NG -+ static assert(!is(typeof( da2[] = [a,a] ))); // NG -+ static assert(!is(typeof( da2[][0] = a ))); // NG -+ static assert(!is(typeof( da2[0][] = a ))); // NG - } - } - -@@ -334,11 +334,12 @@ struct Foo6174 - { - const char cc; - const char[1] array; -+ const char[1] arr; - this(char c) - { - cc = c; // OK - array = [c]; // line 12, Err -- array[0] = c; // line 12, Err -+ arr[0] = c; // line 12, Err - } - } - void test6174a() -@@ -391,16 +392,16 @@ void test6174b() - { - // If F has an identity `opAssign`,it is used even for initializing. - // Otherwise, initializing will always succeed, by bypassing const qualifier. -- static assert(__traits(compiles, f = F()) == ( -+ static assert(is(typeof( f = F() )) == ( - F.assignKind == none || - F.assignKind == unrelated || -- F.assignKind == mutable && !fieldConst || -+ F.assignKind == mutable || - F.assignKind == constant)); - -- static assert(__traits(compiles, w = 1000) == true); -- static assert(__traits(compiles, f.x = 1000) == true); -- static assert(__traits(compiles, f.y = 1000) == true); -- static assert(__traits(compiles, z = 1000) == true); -+ static assert(is(typeof( w = 1000 )) == true); -+ static assert(is(typeof( f.x = 1000 )) == true); -+ static assert(is(typeof( f.y = 1000 )) == true); -+ static assert(is(typeof( z = 1000 )) == true); - } - void func() - { -@@ -614,8 +615,7 @@ void test6216d() - S s; - const(S) cs; - s = s; -- static assert(!__traits(compiles, s = cs)); -- // copying cx, const(S) to S is not possible -+ s = cs; - //assert(cnt == 4); - static assert(!__traits(compiles, cs = cs)); - // built-in opAssin is only allowed with mutable object -@@ -770,6 +770,11 @@ class D9258 - alias n this; - void opAssign(int n, int y = 0) {} - } -+class E9258 : A9258 -+{ -+ void set(A9258 a) {} -+ alias set opAssign; -+} - - /***************************************************/ - // 9416 -@@ -793,6 +798,38 @@ void test9416() - } - - /***************************************************/ -+// 9658 -+ -+struct S9658 -+{ -+ private bool _isNull = true; -+ this(int v) const -+ { -+ _isNull = false; // cannot modify const expression this._isNull -+ } -+} -+ -+/***************************************************/ -+// 11187 -+ -+void test11187() -+{ -+ static struct X -+ { -+ int[] arr; -+ } -+ static struct S -+ { -+ const(X) cx; -+ } -+ static assert(is(typeof((const S).init.cx.arr) == const(int[]))); -+ static assert(is(typeof(( S).init.cx.arr) == const(int[]))); -+ const S sc; -+ S sm = sc; -+ static assert(is(const S : S)); -+} -+ -+/***************************************************/ - - int main() - { -@@ -814,6 +851,7 @@ int main() - test6336(); - test9154(); - test9416(); -+ test11187(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/builtin.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/builtin.d 2014-04-01 16:32:51.000000000 +0100 -@@ -11,13 +11,13 @@ void test1() - auto f = 6.8L; - writefln("%a", sin(f)); - assert(sin(f) == sin(6.8)); -- static assert(sin(6.8) == 0x1.f9f8d9aea10fdf1cp-2); -+ static assert(approxEqual(sin(6.8), 0x1.f9f8d9aea10fdf1cp-2)); - - writefln("%a", cos(6.8)); - f = 6.8L; - writefln("%a", cos(f)); - assert(cos(f) == cos(6.8)); -- static assert(cos(6.8) == 0x1.bd21aaf88dcfa13ap-1); -+ static assert(approxEqual(cos(6.8), 0x1.bd21aaf88dcfa13ap-1)); - - writefln("%a", tan(6.8)); - f = 6.8L; -@@ -26,7 +26,7 @@ void test1() - { } - else - assert(tan(f) == tan(6.8)); -- static assert(tan(6.8) == 0x1.22fd752af75cd08cp-1); -+ static assert(approxEqual(tan(6.8), 0x1.22fd752af75cd08cp-1)); - } - - /*******************************************/ ---- a/src/gcc/testsuite/gdc.test/runnable/casting.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/casting.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,68 @@ - extern(C) int printf(const char*, ...); - -+template Seq(T...) { alias T Seq; } -+ -+/***************************************************/ -+// 7504 -+ -+void test7504() pure nothrow @safe -+{ -+ auto n = null; -+ char[] k = n; -+ assert(k.ptr == null); -+ assert(k.length == 0); -+ -+ double[] l; -+ l = n; -+ assert(l.ptr == null); -+ assert(l.length == 0); -+ -+ immutable(int[]) m = n; -+ assert(m.ptr == null); -+ assert(m.length == 0); -+ -+ const(float)[] o; -+ o = n; -+ assert(o.ptr == null); -+ assert(o.length == 0); -+ -+ auto c = create7504(null, null); -+ assert(c.k.ptr == null); -+ assert(c.k.length == 0); -+ assert(c.l.ptr == null); -+ assert(c.l.length == 0); -+} -+ -+class C7504 -+{ -+ int[] k; -+ string l; -+} -+ -+C7504 create7504(T...)(T input) -+{ -+ auto obj = new C7504; -+ obj.tupleof = input; -+ return obj; -+} -+ -+/***************************************************/ -+// 8119 -+ -+struct S8119; -+ -+void test8119() -+{ -+ void* v; -+ auto sp1 = cast(S8119*)v; -+ -+ int* i; -+ auto sp2 = cast(S8119*)i; -+ -+ S8119* s; -+ auto ip = cast(int*)s; -+} -+ - /***************************************************/ - // 8645 - -@@ -16,10 +79,127 @@ void test8645() - } - - /***************************************************/ -+// 10497 -+ -+struct S10497; -+ -+void test10497(S10497** s) -+{ -+ void* ptr; -+ *s = cast(S10497*)ptr; -+} -+ -+/***************************************************/ -+// 10646 -+ -+void test10646() -+{ -+ class C { } -+ -+ C[] csd; -+ C[2] css; -+ -+ static assert(!__traits(compiles, { auto c1 = cast(C)csd; })); -+ static assert(!__traits(compiles, { auto c2 = cast(C)css; })); -+} -+ -+/***************************************************/ -+// 10793 -+ -+struct RealFoo10793 -+{ -+ int i; -+} -+ -+struct Foo10793; -+ -+void test10793() -+{ -+ auto rf = RealFoo10793(10); -+ void* prf = cast(void*)&rf; -+ Foo10793* f = cast(Foo10793*)prf; -+} -+ -+/***************************************************/ -+// 10834 -+ -+void test10834() -+{ -+ struct S { int i; } -+ S s; -+ cast(void)s; -+ -+ class C { int i; } -+ C c; -+ cast(void)c; -+ -+ enum E { a, b } -+ E e; -+ cast(void)e; -+ -+ int[] ia; -+ cast(void)ia; -+} -+ -+/***************************************************/ -+// 10842 -+ -+template Test10842(F, T) -+{ -+ bool res; -+ F from() -+ { -+ res = true; -+ return F.init; -+ } -+ T to() -+ { -+ // The cast operand had incorrectly been eliminated -+ return cast(T)from(); -+ } -+ bool test() -+ { -+ res = false; -+ to(); -+ return res; -+ } -+} -+ -+void test10842() -+{ -+ foreach (From; Seq!(bool, byte, ubyte, short, ushort, int, uint, long, ulong, float, double, real)) -+ { -+ foreach (To; Seq!(ifloat, idouble, ireal)) -+ { -+ if (!Test10842!(From, To).test()) -+ assert(0); -+ } -+ } -+ -+ foreach (From; Seq!(ifloat, idouble, ireal)) -+ { -+ foreach (To; Seq!(/*bool*, */byte, ubyte, short, ushort, int, uint, long, ulong, float, double, real)) -+ { -+ if (!Test10842!(From, To).test()) -+ assert(0); -+ } -+ } -+ -+ if (!Test10842!(typeof(null), string).test()) // 10842 -+ assert(0); -+} -+ -+/***************************************************/ - - int main() - { -+ test7504(); -+ test8119(); - test8645(); -+ test10646(); -+ test10793(); -+ test10834(); -+ test10842(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/closure.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/closure.d 2014-04-01 16:32:51.000000000 +0100 -@@ -19,7 +19,7 @@ dg_t foo() - - int bar() - { -- return x + 3; -+ return x + 3; - } - - return &bar; -@@ -39,14 +39,14 @@ dg_t foo2() - { - dg_t abc() - { -- int x = 7; -+ int x = 7; - -- int bar() -- { -- return x + 3; -- } -+ int bar() -+ { -+ return x + 3; -+ } - -- return &bar; -+ return &bar; - } - - return abc(); -@@ -66,12 +66,12 @@ dg_t foo3() - { - dg_t abc(int x) - { -- int bar() -- { -- return x + 3; -- } -+ int bar() -+ { -+ return x + 3; -+ } - -- return &bar; -+ return &bar; - } - - return abc(7); -@@ -88,18 +88,19 @@ void test3() - /************************************/ - - dg_t foo4() --{ S s; -+{ -+ S s; - - s = S(4,5,6,7); - - dg_t abc(S t) - { -- int bar() -- { -- return t.d + 3; -- } -+ int bar() -+ { -+ return t.d + 3; -+ } - -- return &bar; -+ return &bar; - } - - return abc(s); -@@ -116,16 +117,18 @@ void test4() - /************************************/ - - void test5() --{ int x = 7; -+{ -+ int x = 7; - - dg_t abc(ref int y) - { -- int bar() -- { y += 4; -- return y + 3; -- } -+ int bar() -+ { -+ y += 4; -+ return y + 3; -+ } - -- return &bar; -+ return &bar; - } - - dg_t dg = abc(x); -@@ -144,16 +147,18 @@ void test5() - /************************************/ - - void test6() --{ int x = 7; -+{ -+ int x = 7; - - dg_t abc(out int y) - { -- int bar() -- { y += 4; -- return y + 3; -- } -+ int bar() -+ { -+ y += 4; -+ return y + 3; -+ } - -- return &bar; -+ return &bar; - } - - dg_t dg = abc(x); -@@ -173,16 +178,18 @@ void test6() - /************************************/ - - void test7() --{ int[3] a = [10,11,12]; -+{ -+ int[3] a = [10,11,12]; - - dg_t abc(int[3] y) - { -- int bar() -- { y[2] += 4; -- return y[2] + 3; -- } -+ int bar() -+ { -+ y[2] += 4; -+ return y[2] + 3; -+ } - -- return &bar; -+ return &bar; - } - - dg_t dg = abc(a); -@@ -197,16 +204,18 @@ void test7() - /************************************/ - - void test8() --{ S s = S(7,8,9,10); -+{ -+ S s = S(7,8,9,10); - - dg_t abc(ref S t) - { -- int bar() -- { t.d += 4; -- return t.c + 3; -- } -+ int bar() -+ { -+ t.d += 4; -+ return t.c + 3; -+ } - -- return &bar; -+ return &bar; - } - - dg_t dg = abc(s); -@@ -221,16 +230,18 @@ void test8() - /************************************/ - - S foo9(out dg_t dg) --{ S s1 = S(7,8,9,10); -+{ -+ S s1 = S(7,8,9,10); - - dg_t abc() - { -- int bar() -- { s1.d += 4; -- return s1.c + 3; -- } -+ int bar() -+ { -+ s1.d += 4; -+ return s1.c + 3; -+ } - -- return &bar; -+ return &bar; - } - - dg = abc(); -@@ -238,7 +249,8 @@ S foo9(out dg_t dg) - } - - void test9() --{ dg_t dg; -+{ -+ dg_t dg; - - S s = foo9(dg); - fill(); -@@ -258,18 +270,18 @@ dg_t foo10() - { - dg_t abc() - { -- int x = 7; -+ int x = 7; - -- int bar() -- { -- int def() -- { -- return x + 3; -- } -- return def(); -- } -+ int bar() -+ { -+ int def() -+ { -+ return x + 3; -+ } -+ return def(); -+ } - -- return &bar; -+ return &bar; - } - - return abc(); -@@ -292,10 +304,10 @@ dg_t foo11() - - class T - { -- int bar() -- { -- return x + 3; -- } -+ int bar() -+ { -+ return x + 3; -+ } - } - - T t = new T; -@@ -319,15 +331,15 @@ dg_t foo12() - - class T - { -- int bar() -- { -- return x + 3; -- } -- -- int xyz() -- { -- return bar(); -- } -+ int bar() -+ { -+ return x + 3; -+ } -+ -+ int xyz() -+ { -+ return bar(); -+ } - } - - T t = new T; -@@ -351,15 +363,15 @@ dg_t foo13() - - class T - { -- int xyz() -- { -- int bar() -- { -- return x + 3; -- } -+ int xyz() -+ { -+ int bar() -+ { -+ return x + 3; -+ } - -- return bar(); -- } -+ return bar(); -+ } - } - - T t = new T; -@@ -382,16 +394,17 @@ dg_t foo14() - { - class T - { -- int xyz() -- { int x = 7; -+ int xyz() -+ { -+ int x = 7; -+ -+ int bar() -+ { -+ return x + 3; -+ } - -- int bar() -- { -- return x + 3; -- } -- -- return bar(); -- } -+ return bar(); -+ } - } - - T t = new T; -@@ -412,17 +425,18 @@ void test14() - dg_t foo15() - { - class T -- { int x = 7; -+ { -+ int x = 7; - -- int xyz() -- { -- int bar() -- { -- return x + 3; -- } -+ int xyz() -+ { -+ int bar() -+ { -+ return x + 3; -+ } - -- return bar(); -- } -+ return bar(); -+ } - } - - T t = new T; -@@ -441,20 +455,23 @@ void test15() - /************************************/ - - dg_t foo16() --{ int a = 5; -+{ -+ int a = 5; - - class T -- { int x = 7; -+ { -+ int x = 7; - -- int xyz() -- { int y = 8; -- int bar() -- { -- return a + x + y + 3; -- } -+ int xyz() -+ { -+ int y = 8; -+ int bar() -+ { -+ return a + x + y + 3; -+ } - -- return bar(); -- } -+ return bar(); -+ } - } - - T t = new T; -@@ -473,21 +490,24 @@ void test16() - /************************************/ - - dg_t foo17() --{ int a = 5; -+{ -+ int a = 5; - - class T -- { int x = 7; -- -- dg_t xyz() -- { int y = 8; -+ { -+ int x = 7; - -- int bar() -- { -- return a + x + y + 3; -- } -+ dg_t xyz() -+ { -+ int y = 8; -+ -+ int bar() -+ { -+ return a + x + y + 3; -+ } - -- return &bar; -- } -+ return &bar; -+ } - } - - T t = new T; -@@ -508,7 +528,8 @@ void test17() - dg_t dg18; - - void bar18() --{ int a = 7; -+{ -+ int a = 7; - int foo() { return a + 3; } - - dg18 = &foo; -@@ -537,15 +558,15 @@ struct S19 - { - static S19 call(int v) - { -- S19 result; -+ S19 result; - -- result.v = v; -- void nest() -- { -- result.v += 1; -- } -- abc19(&nest); -- return result; -+ result.v = v; -+ void nest() -+ { -+ result.v += 1; -+ } -+ abc19(&nest); -+ return result; - } - int a; - int v; -@@ -554,8 +575,8 @@ struct S19 - - int foo19() - { -- auto s = S19.call(5); -- return s.v; -+ auto s = S19.call(5); -+ return s.v; - } - - void test19() -@@ -578,8 +599,8 @@ void test20() - foreach (j; 0 .. 10) - { - printf("%d\n", j); -- assert(j == x); -- x++; -+ assert(j == x); -+ x++; - enforce20(j); - } - } -@@ -597,16 +618,16 @@ void f21() - - class X - { -- // both 'private' and 'final' to make non-virtual -- private final void actual() -- { -- g_output = i; -- } -- -- void go() -- { -- actual(); -- } -+ // both 'private' and 'final' to make non-virtual -+ private final void actual() -+ { -+ g_output = i; -+ } -+ -+ void go() -+ { -+ actual(); -+ } - } - - dg21 = & (new X).go; -@@ -632,30 +653,30 @@ class A22 - - void am() - { -- int j; /* Making f access this variable causes f's chain to be am's -- frame. Otherwise, f's chain would be the A instance. */ -- void f() -- { -- int k = j; -- -- void g() -- { -- class B -- { -- void bm() -- { -- gi22 = x; /* No checkedNestedReference for A.am.this, -- so it is never placed in a closure. */ -- } -- } -+ int j; /* Making f access this variable causes f's chain to be am's -+ frame. Otherwise, f's chain would be the A instance. */ -+ void f() -+ { -+ int k = j; -+ -+ void g() -+ { -+ class B -+ { -+ void bm() -+ { -+ gi22 = x; /* No checkedNestedReference for A.am.this, -+ so it is never placed in a closure. */ -+ } -+ } - -- (new B).bm(); -- } -+ (new B).bm(); -+ } - -- dg22 = &g; -- } -+ dg22 = &g; -+ } - -- f(); -+ f(); - } - } - -@@ -667,49 +688,72 @@ void test22() - assert(gi22 == 42); - } - -+/************************************/ - // 1841 - - int delegate() foo1841() - { -- int stack; -- int heap = 3; -+ int stack; -+ int heap = 3; - -- int nested_func() -- { -- ++heap; -- return heap; -- } -- return delegate int() { return nested_func(); }; -+ int nested_func() -+ { -+ ++heap; -+ return heap; -+ } -+ return delegate int() { return nested_func(); }; - } - - int delegate() foo1841b() - { -- int stack; -- int heap = 7; -+ int stack; -+ int heap = 7; - -- int nested_func() -- { -- ++heap; -- return heap; -- } -- int more_nested() { return nested_func(); } -- return delegate int() { return more_nested(); }; -+ int nested_func() -+ { -+ ++heap; -+ return heap; -+ } -+ int more_nested() { return nested_func(); } -+ return delegate int() { return more_nested(); }; - } - - void bug1841() - { -- auto z = foo1841(); -- auto p = foo1841(); -- assert(z() == 4); -- p(); -- assert(z() == 5); -- z = foo1841b(); -- p = foo1841b(); -- assert(z() == 8); -- p(); -- assert(z() == 9); -+ auto z = foo1841(); -+ auto p = foo1841(); -+ assert(z() == 4); -+ p(); -+ assert(z() == 5); -+ z = foo1841b(); -+ p = foo1841b(); -+ assert(z() == 8); -+ p(); -+ assert(z() == 9); - } - -+/************************************/ -+// 5911 -+ -+void writeln5911(const(char)[] str) {} -+ -+void logout5911(lazy const(char)[] msg) { writeln5911(msg); } -+ -+void test5911() -+{ -+ string str = "hello world"; -+ logout5911((){ return str; }()); // closure 1 -+ -+ try -+ { -+ throw new Exception("exception!!"); -+ } -+ catch (Exception e) -+ { -+ assert(e !is null); -+ logout5911(e.toString()); // closure2 SEGV : e is null. -+ } -+} - - /************************************/ - -@@ -738,6 +782,7 @@ int main() - test21(); - test22(); - bug1841(); -+ test5911(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/complex.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/complex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,6 +2,7 @@ - - import std.stdio; - import std.math; -+import core.stdc.stdio; - - /***************************************/ - -@@ -308,6 +309,59 @@ void test7591() - - /***************************************/ - -+void foo8966(cfloat x) -+{ -+ assert(x.re == 3.0f); -+} -+ -+__gshared cfloat[] a8966; -+ -+void test8966() -+{ -+ a8966 = new cfloat[2]; -+ a8966[0] = 3.0f + 1.0fi; -+ foo8966(a8966[0]); -+} -+ -+/***************************************/ -+ -+void formatTest2(cfloat s, double re, double im) -+{ -+ assert(s.re == re); -+ assert(s.im == im); -+} -+ -+cfloat getcf() -+{ -+ return 2 + 1i; -+} -+ -+void test10677() -+{ -+ formatTest2( getcf(), 2, 1 ); -+} -+ -+/***************************************/ -+ -+void test7806() -+{ -+ for (idouble i = -2i; i <= 2i; i += .125i) -+ for (double r = -2; r <= 2; r += .0625) -+ { -+ cdouble c = r + i; -+ printf("%g %gi\n", c.re, c.im); -+ } -+} -+ -+/***************************************/ -+ -+void test7976() { -+ creal[] a = new creal[2]; -+ auto b = a[0] = a[1]; -+} -+ -+/***************************************/ -+ - int main(char[][] args) - { - -@@ -329,6 +383,10 @@ int main(char[][] args) - test7594(); - test7593(); - test7591(); -+ test8966(); -+ test10677(); -+ test7806(); -+ test7976(); - - printf("Success!\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/constfold.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/constfold.d 2014-04-01 16:32:51.000000000 +0100 -@@ -641,6 +641,20 @@ void test9058() - } - - /************************************/ -+// 11159 -+void test11159() -+{ -+ import std.math : pow; -+ enum ulong -+ e_2_pow_64 = 2uL^^64, -+ e_10_pow_19 = 10uL^^19, -+ e_10_pow_20 = 10uL^^20; -+ assert(e_2_pow_64 == pow(2uL, 64)); -+ assert(e_10_pow_19 == pow(10uL, 19)); -+ assert(e_10_pow_20 == pow(10uL, 20)); -+} -+ -+/************************************/ - - int main() - { -@@ -651,6 +665,7 @@ int main() - test8400(); - test8939(); - test9058(); -+ test11159(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/cppa.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/cppa.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,232 @@ -+// PERMUTE_ARGS: -+// EXTRA_CPP_SOURCES: extra-files/cppb.cpp -+ -+import std.c.stdio; -+ -+extern (C++) -+ int foob(int i, int j, int k); -+ -+class C -+{ -+ extern (C++) int bar(int i, int j, int k) -+ { -+ printf("this = %p\n", this); -+ printf("i = %d\n", i); -+ printf("j = %d\n", j); -+ printf("k = %d\n", k); -+ return 1; -+ } -+} -+ -+ -+extern (C++) -+ int foo(int i, int j, int k) -+{ -+ printf("i = %d\n", i); -+ printf("j = %d\n", j); -+ printf("k = %d\n", k); -+ assert(i == 1); -+ assert(j == 2); -+ assert(k == 3); -+ return 1; -+} -+ -+void test1() -+{ -+ foo(1, 2, 3); -+ -+ auto i = foob(1, 2, 3); -+ assert(i == 7); -+ -+ C c = new C(); -+ c.bar(4, 5, 6); -+} -+ -+/****************************************/ -+ -+extern (C++) interface D -+{ -+ int bar(int i, int j, int k); -+} -+ -+extern (C++) D getD(); -+ -+void test2() -+{ -+ D d = getD(); -+ int i = d.bar(9,10,11); -+ assert(i == 8); -+} -+ -+/****************************************/ -+ -+extern (C++) int callE(E); -+ -+extern (C++) interface E -+{ -+ int bar(int i, int j, int k); -+} -+ -+class F : E -+{ -+ extern (C++) int bar(int i, int j, int k) -+ { -+ printf("F.bar: i = %d\n", i); -+ printf("F.bar: j = %d\n", j); -+ printf("F.bar: k = %d\n", k); -+ assert(i == 11); -+ assert(j == 12); -+ assert(k == 13); -+ return 8; -+ } -+} -+ -+void test3() -+{ -+ F f = new F(); -+ int i = callE(f); -+ assert(i == 8); -+} -+ -+/****************************************/ -+ -+extern (C++) void foo4(char* p); -+ -+void test4() -+{ -+ foo4(null); -+} -+ -+/****************************************/ -+ -+extern(C++) -+{ -+ struct foo5 { int i; int j; void* p; } -+ -+ interface bar5{ -+ foo5 getFoo(int i); -+ } -+ -+ bar5 newBar(); -+} -+ -+void test5() -+{ -+ bar5 b = newBar(); -+ foo5 f = b.getFoo(4); -+ printf("f.p = %p, b = %p\n", f.p, cast(void*)b); -+ assert(f.p == cast(void*)b); -+} -+ -+ -+/****************************************/ -+ -+extern(C++) -+{ -+ struct S6 -+ { -+ int i; -+ double d; -+ } -+ S6 foo6(); -+} -+ -+extern (C) int foosize6(); -+ -+void test6() -+{ -+ S6 f = foo6(); -+ printf("%d %d\n", foosize6(), S6.sizeof); -+ assert(foosize6() == S6.sizeof); -+version (X86) -+{ -+ assert(f.i == 42); -+ printf("f.d = %g\n", f.d); -+ assert(f.d == 2.5); -+} -+} -+ -+/****************************************/ -+ -+extern (C) int foo7(); -+ -+struct S -+{ -+ int i; -+ long l; -+} -+ -+void test7() -+{ -+ printf("%d %d\n", foo7(), S.sizeof); -+ assert(foo7() == S.sizeof); -+} -+ -+/****************************************/ -+ -+extern (C++) void foo8(const char *); -+ -+void test8() -+{ -+ char c; -+ foo8(&c); -+} -+ -+/****************************************/ -+// 4059 -+ -+struct elem9 { } -+ -+extern(C++) void foobar9(elem9*, elem9*); -+ -+void test9() -+{ -+ elem9 *a; -+ foobar9(a, a); -+} -+ -+/****************************************/ -+// 5148 -+ -+extern (C++) -+{ -+ void foo10(const char*, const char*); -+ void foo10(const int, const int); -+ void foo10(const char, const char); -+ -+ struct MyStructType { } -+ void foo10(const MyStructType s, const MyStructType t); -+ -+ enum MyEnumType { onemember } -+ void foo10(const MyEnumType s, const MyEnumType t); -+} -+ -+void test10() -+{ -+ char* p; -+ foo10(p, p); -+ foo10(1,2); -+ foo10('c','d'); -+ MyStructType s; -+ foo10(s,s); -+ MyEnumType e; -+ foo10(e,e); -+} -+ -+/****************************************/ -+ -+void main() -+{ -+ test1(); -+ test2(); -+ test3(); -+ test4(); -+ test5(); -+ test6(); -+ test7(); -+ test8(); -+ test9(); -+ test10(); -+ -+ printf("Success\n"); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/cppmangle1.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/cppmangle1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+// PERMUTE_ARGS: -+// EXTRA_CPP_SOURCES: extra-files/cppmangle1.cpp -+ -+extern(C++): -+ -+int test0(int); -+ -+void main() -+{ -+ assert(test0(42)==42); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/declaration.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/declaration.d 2014-04-01 16:32:51.000000000 +0100 -@@ -199,6 +199,67 @@ void test8942() - } - - /***************************************************/ -+// 10144 -+ -+final class TNFA10144(char_t) -+{ -+ enum Act { don } -+ const Act[] action_lookup1 = [ Act.don, ]; -+} -+alias X10144 = TNFA10144!char; -+ -+class C10144 -+{ -+ enum Act { don } -+ synchronized { enum x1 = [Act.don]; } -+ override { enum x2 = [Act.don]; } -+ abstract { enum x3 = [Act.don]; } -+ final { enum x4 = [Act.don]; } -+ synchronized { static s1 = [Act.don]; } -+ override { static s2 = [Act.don]; } -+ abstract { static s3 = [Act.don]; } -+ final { static s4 = [Act.don]; } -+ synchronized { __gshared gs1 = [Act.don]; } -+ override { __gshared gs2 = [Act.don]; } -+ abstract { __gshared gs3 = [Act.don]; } -+ final { __gshared gs4 = [Act.don]; } -+} -+ -+/***************************************************/ -+ -+// 10142 -+ -+class File10142 -+{ -+ enum Access : ubyte { Read = 0x01 } -+ enum Open : ubyte { Exists = 0 } -+ enum Share : ubyte { None = 0 } -+ enum Cache : ubyte { None = 0x00 } -+ -+ struct Style -+ { -+ Access access; -+ Open open; -+ Share share; -+ Cache cache; -+ } -+ enum Style ReadExisting = { Access.Read, Open.Exists }; -+ -+ this (const(char[]) path, Style style = ReadExisting) -+ { -+ assert(style.access == Access.Read); -+ assert(style.open == Open .Exists); -+ assert(style.share == Share .None); -+ assert(style.cache == Cache .None); -+ } -+} -+ -+void test10142() -+{ -+ auto f = new File10142("dummy"); -+} -+ -+/***************************************************/ - - int main() - { -@@ -210,6 +271,7 @@ int main() - test8147(); - test8410(); - test8942(); -+ test10142(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/deprecate1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/deprecate1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -479,14 +479,17 @@ void opover2_test2() - // http://www.digitalmars.com/d/archives/10750.html - // test12.d, test7(). ICE(constfold.c) - -+version(none) // This contains an incredibly nasty cast -+{ - template base7( T ) - { - void errfunc() { throw new Exception("no init"); } -- typedef T safeptr = cast(T)&errfunc; -+ typedef T safeptr = cast(T)&errfunc; // Nasty cast - } - - alias int function(int) mfp; - alias base7!(mfp) I_V_fp; -+} - - typedef bool antibool = 1; - antibool[8] z21 = [ cast(antibool) 0, ]; -@@ -1253,26 +1256,6 @@ void test18() - } - - /******************************************/ --// 6652 -- --void test6652() --{ -- size_t[] res1; -- foreach (i; 0..2) -- { -- res1 ~= ++i; -- } -- assert(res1 == [1]); -- -- size_t[] res2; -- foreach (i, e; [0,1]) -- { -- res2 ~= ++i; -- } -- assert(res2 == [1]); --} -- --/******************************************/ - - int main() - { -@@ -1332,7 +1315,6 @@ int main() - test6289(); - test4237(); - test18(); -- test6652(); - - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/depsprot.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/depsprot.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,40 +0,0 @@ --#!/usr/bin/env bash -- --name=`basename $0 .sh` --dir=${RESULTS_DIR}/runnable --dmddir=${RESULTS_DIR}${SEP}runnable --output_file=${dir}/${name}.sh.out --deps_file="${dmddir}${SEP}${name}.deps" -- --die() --{ -- cat ${output_file} -- echo "---- deps file ----" -- cat ${deps_file} -- echo -- echo "$@" -- rm -f ${output_file} ${deps_file} -- exit 1 --} -- --rm -f ${output_file} -- --$DMD -m${MODEL} -deps=${deps_file} -Irunnable/imports -o- runnable/extra-files/${name}.d >> ${output_file} --test $? -ne 0 && -- die "Error compiling" -- --grep "^${name}.*${name}_default" ${deps_file} | grep -q private || -- die "Default import protection in dependency file should be 'private'" -- --grep "^${name}.*${name}_public" ${deps_file} | grep -q public || -- die "Public import protection in dependency file should be 'public'" -- --grep "^${name}.*${name}_private" ${deps_file} | grep -q private|| -- die "Private import protection in dependency file should be 'private'" -- --echo "Dependencies file:" >> ${output_file} --cat ${deps_file} >> ${output_file} --echo >> ${output_file} -- --rm ${deps_file} -- ---- a/src/gcc/testsuite/gdc.test/runnable/eh2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/eh2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4,7 +4,7 @@ extern(C) int printf(const char*, ...); - - class Abc : Throwable - { -- this() -+ this() pure - { - super(""); - } -@@ -13,20 +13,20 @@ class Abc : Throwable - - synchronized void test() - { -- printf("test 1\n"); -- x |= 1; -- foo(); -- printf("test 2\n"); -- x |= 2; -+ printf("test 1\n"); -+ x |= 1; -+ foo(); -+ printf("test 2\n"); -+ x |= 2; - } - - shared void foo() - { -- printf("foo 1\n"); -- x |= 4; -- throw this; -- printf("foo 2\n"); -- x |= 8; -+ printf("foo 1\n"); -+ x |= 4; -+ throw this; -+ printf("foo 2\n"); -+ x |= 8; - } - } - -@@ -41,21 +41,22 @@ struct RefCounted - - struct S - { -- RefCounted _data; -+ RefCounted _data; - -- int get() @property -- { -- throw new Exception(""); -- } -+ int get() @property -+ { -+ throw new Exception(""); -+ } - } - - void b9438() - { -- try { -+ try -+ { - S s; - S().get; -- } -- catch (Exception e){ } -+ } -+ catch (Exception e){ } - } - - int main() -@@ -67,16 +68,16 @@ int main() - - try - { -- Abc.x |= 0x20; -- a.test(); -- Abc.x |= 0x40; -+ Abc.x |= 0x20; -+ a.test(); -+ Abc.x |= 0x40; - } - catch (shared(Abc) b) - { -- Abc.x |= 0x80; -- printf("Caught %p, x = x%x\n", b, Abc.x); -- assert(a is b); -- assert(Abc.x == 0xB5); -+ Abc.x |= 0x80; -+ printf("Caught %p, x = x%x\n", b, Abc.x); -+ assert(a is b); -+ assert(Abc.x == 0xB5); - } - printf("Success!\n"); - b9438(); ---- a/src/gcc/testsuite/gdc.test/runnable/eh.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/eh.d 2014-04-01 16:32:51.000000000 +0100 -@@ -23,29 +23,29 @@ void foo(int x) - L6: - try - { -- printf("try 1\n"); -- y += 4; -- if (y == 5) -- goto L6; -- y += 3; -+ printf("try 1\n"); -+ y += 4; -+ if (y == 5) -+ goto L6; -+ y += 3; - } - finally - { -- y += 5; -- printf("finally 1\n"); -+ y += 5; -+ printf("finally 1\n"); - } - try - { -- printf("try 2\n"); -- y = 1; -- if (y == 4) -- goto L6; -- y++; -+ printf("try 2\n"); -+ y = 1; -+ if (y == 4) -+ goto L6; -+ y++; - } - catch (Abc c) - { -- printf("catch 2\n"); -- y = 2 + c.i; -+ printf("catch 2\n"); -+ y = 2 + c.i; - } - y++; - printf("done\n"); -@@ -58,13 +58,13 @@ class IntException : Exception - { - this(int i) - { -- m_i = i; -+ m_i = i; - super(""); - } - - int getValue() - { -- return m_i; -+ return m_i; - } - - int m_i; -@@ -73,35 +73,35 @@ class IntException : Exception - - void test2() - { -- int cIterations = 10; -+ int cIterations = 10; - -- int i; -- long total_x = 0; -- long total_nox = 0; -+ int i; -+ long total_x = 0; -+ long total_nox = 0; - - for(int WARMUPS = 2; WARMUPS-- > 0; ) - { -- for(total_x = 0, i = 0; i < cIterations; ++i) -- { -- total_nox += fn2_nox(); -- } -+ for(total_x = 0, i = 0; i < cIterations; ++i) -+ { -+ total_nox += fn2_nox(); -+ } - printf("foo\n"); - -- for(total_nox = 0, i = 0; i < cIterations; ++i) -- { -+ for(total_nox = 0, i = 0; i < cIterations; ++i) -+ { - printf("i = %d\n", i); -- try -- { -- int z = 1; -- -- throw new IntException(z); -- } -- catch(IntException x) -- { -+ try -+ { -+ int z = 1; -+ -+ throw new IntException(z); -+ } -+ catch(IntException x) -+ { - printf("catch, i = %d\n", i); -- total_x += x.getValue(); -- } -- } -+ total_x += x.getValue(); -+ } -+ } - } - - printf("iterations %d totals: %ld, %ld\n", cIterations, total_x, total_nox); -@@ -123,22 +123,22 @@ void test3() - } - finally - { -- printf("a\n"); -- assert(x == 0); -- x++; -+ printf("a\n"); -+ assert(x == 0); -+ x++; - } - printf("--\n"); - assert(x == 1); - try - { -- printf("tb\n"); -- assert(x == 1); -+ printf("tb\n"); -+ assert(x == 1); - } - finally - { -- printf("b\n"); -- assert(x == 1); -- x++; -+ printf("b\n"); -+ assert(x == 1); -+ x++; - } - assert(x == 2); - } -@@ -147,123 +147,123 @@ void test3() - - class Tester - { -- this(void delegate() dg_) { dg = dg_; } -- void delegate() dg; -- void stuff() { dg(); } -+ this(void delegate() dg_) { dg = dg_; } -+ void delegate() dg; -+ void stuff() { dg(); } - } - - void test4() - { -- printf("Starting test\n"); -+ printf("Starting test\n"); - -- int a = 0; -- int b = 0; -- int c = 0; -- int d = 0; -- -- try -- { -- a++; -- throw new Exception("test1"); -- a++; -- } -- catch(Exception e) -- { -- auto es = e.toString(); -+ int a = 0; -+ int b = 0; -+ int c = 0; -+ int d = 0; -+ -+ try -+ { -+ a++; -+ throw new Exception("test1"); -+ a++; -+ } -+ catch(Exception e) -+ { -+ auto es = e.toString(); - printf("%.*s\n", es.length, es.ptr); -- b++; -- } -- finally -- { -- c++; -- } -- -- printf("initial test.\n"); -- -- assert(a == 1); -- assert(b == 1); -- assert(c == 1); -- -- printf("pass\n"); -- -- Tester t = new Tester( -- delegate void() -- { -- try -- { -- a++; -- throw new Exception("test2"); -- a++; -- } -- catch(Exception e) -- { -- b++; -- throw e; -- b++; -- } -- }); -- -- try -- { -- c++; -- t.stuff(); -- c++; -- } -- catch(Exception e) -- { -- d++; -- string es = e.toString; -- printf("%.*s\n", es.length, es.ptr); -- } -- -- assert(a == 2); -- assert(b == 2); -- assert(c == 2); -- assert(d == 1); -- -- -- int q0 = 0; -- int q1 = 0; -- int q2 = 0; -- int q3 = 0; -- -- Tester t2 = new Tester( -- delegate void() -- { -- try -- { -- q0++; -- throw new Exception("test3"); -- q0++; -- } -- catch(Exception e) -- { -- printf("Never called.\n"); -- q1++; -- throw e; -- q1++; -- } -- }); -- -- try -- { -- q2++; -- t2.stuff(); -- q2++; -- } -- catch(Exception e) -- { -- q3++; -+ b++; -+ } -+ finally -+ { -+ c++; -+ } -+ -+ printf("initial test.\n"); -+ -+ assert(a == 1); -+ assert(b == 1); -+ assert(c == 1); -+ -+ printf("pass\n"); -+ -+ Tester t = new Tester( -+ delegate void() -+ { -+ try -+ { -+ a++; -+ throw new Exception("test2"); -+ a++; -+ } -+ catch(Exception e) -+ { -+ b++; -+ throw e; -+ b++; -+ } -+ }); -+ -+ try -+ { -+ c++; -+ t.stuff(); -+ c++; -+ } -+ catch(Exception e) -+ { -+ d++; -+ string es = e.toString; -+ printf("%.*s\n", es.length, es.ptr); -+ } -+ -+ assert(a == 2); -+ assert(b == 2); -+ assert(c == 2); -+ assert(d == 1); -+ -+ -+ int q0 = 0; -+ int q1 = 0; -+ int q2 = 0; -+ int q3 = 0; -+ -+ Tester t2 = new Tester( -+ delegate void() -+ { -+ try -+ { -+ q0++; -+ throw new Exception("test3"); -+ q0++; -+ } -+ catch(Exception e) -+ { -+ printf("Never called.\n"); -+ q1++; -+ throw e; -+ q1++; -+ } -+ }); -+ -+ try -+ { -+ q2++; -+ t2.stuff(); -+ q2++; -+ } -+ catch(Exception e) -+ { -+ q3++; - string es = e.toString; -- printf("%.*s\n", es.length, es.ptr); -- } -+ printf("%.*s\n", es.length, es.ptr); -+ } - -- assert(q0 == 1); -- assert(q1 == 1); -- assert(q2 == 1); -- assert(q3 == 1); -+ assert(q0 == 1); -+ assert(q1 == 1); -+ assert(q2 == 1); -+ assert(q3 == 1); - -- printf("Passed!\n"); -+ printf("Passed!\n"); - } - - /****************************************************/ -@@ -274,47 +274,48 @@ void test5() - int i = 3; - while(i--) - { -- try -- { -- printf("i: %d\n", i); -- result ~= 't'; -- if (i == 1) -- continue; -- } -- finally -- { -- printf("finally\n"); -- result ~= cast(char)('a' + i); -- } -+ try -+ { -+ printf("i: %d\n", i); -+ result ~= 't'; -+ if (i == 1) -+ continue; -+ } -+ finally -+ { -+ printf("finally\n"); -+ result ~= cast(char)('a' + i); -+ } - } - printf("--- %.*s", result.length, result.ptr); - if (result != "tctbta") -- assert(0); -+ assert(0); - } - - /****************************************************/ - - void test6() --{ char[] result; -+{ -+ char[] result; - - while (true) - { - try - { - printf("one\n"); -- result ~= 'a'; -+ result ~= 'a'; - break; - } - finally - { - printf("two\n"); -- result ~= 'b'; -+ result ~= 'b'; - } - } - printf("three\n"); - result ~= 'c'; - if (result != "abc") -- assert(0); -+ assert(0); - } - - /****************************************************/ -@@ -323,29 +324,29 @@ string a7; - - void doScan(int i) - { -- a7 ~= "a"; -- try -- { -+ a7 ~= "a"; - try - { -- a7 ~= "b"; -- return; -+ try -+ { -+ a7 ~= "b"; -+ return; -+ } -+ finally -+ { -+ a7 ~= "c"; -+ } - } - finally - { -- a7 ~= "c"; -+ a7 ~= "d"; - } -- } -- finally -- { -- a7 ~= "d"; -- } - } - - void test7() - { -- doScan(0); -- assert(a7 == "abcd"); -+ doScan(0); -+ assert(a7 == "abcd"); - } - - -@@ -356,7 +357,7 @@ int result1513; - - void bug1513a() - { -- throw new Exception("d"); -+ throw new Exception("d"); - } - - void bug1513b() -@@ -371,11 +372,10 @@ void bug1513b() - { - result1513 |=4; - throw new Exception("f"); -- - } - } - catch(Exception e) -- { -+ { - assert(e.msg == "d"); - assert(e.next.msg == "f"); - assert(!e.next.next); -@@ -395,7 +395,7 @@ void bug1513c() - result1513 |= 1; - throw new Exception("b"); - } -- } -+ } - finally - { - bug1513b(); -@@ -408,8 +408,8 @@ void bug1513() - { - result1513 = 0; - try -- { -- bug1513c(); -+ { -+ bug1513c(); - } - catch(Exception e) - { -@@ -459,7 +459,7 @@ void doublecollide() - assert(e.next.next.msg == "x"); - assert(e.next.next.next.msg == "y"); - assert(!e.next.next.next.next); -- } -+ } - } - - void collidetwo() -@@ -489,7 +489,7 @@ void collideMixed() - try - { - try -- { -+ { - throw new Exception("e"); - } - finally -@@ -497,7 +497,7 @@ void collideMixed() - throw new Error("t"); - } - } -- catch(Exception f) -+ catch(Exception f) - { // Doesn't catch, because Error is chained to it. - works += 2; - } -@@ -558,7 +558,91 @@ void multicollide() - assert(e.next.next.msg == "x"); - assert(e.next.next.next.msg == "y"); - assert(!e.next.next.next.next); -- } -+ } -+} -+ -+/****************************************************/ -+ -+void use9568(char [] x, char [] y) {} -+ -+int bug9568() -+{ -+ try -+ return 7; -+ finally -+ use9568(null,null); -+} -+ -+void test9568() -+{ -+ assert( bug9568() == 7 ); -+} -+ -+/****************************************************/ -+ -+uint foo9(uint i) -+{ -+ try -+ { -+ ++i; -+ return 3; -+ } -+ catch (Exception e) -+ { -+ debug printf("Exception happened\n"); -+ } -+ return 4; -+} -+ -+void test9() -+{ -+ assert(foo9(7) == 3); -+} -+ -+/****************************************************/ -+// 10964 -+ -+void test10964() -+{ -+ static struct S -+ { -+ this(this) -+ { -+ throw new Exception("BOOM!"); -+ } -+ } -+ -+ S ss; -+ S[1] sa; -+ int result; -+ -+ result = 0; -+ try -+ { -+ ss = ss; -+ } -+ catch (Exception e) result = 1; -+ catch (Error e) result = 2; -+ catch (Throwable e) result = 3; -+ assert(result == 1); -+ -+ try -+ { -+ sa = ss; -+ } -+ catch (Exception e) result = 1; -+ catch (Error e) result = 2; -+ catch (Throwable e) result = 3; -+ assert(result == 1); -+ -+ try -+ { -+ sa = sa; -+ } -+ catch (Exception e) result = 1; -+ catch (Error e) result = 2; -+ catch (Throwable e) result = 3; -+ assert(result == 1); - } - - /****************************************************/ -@@ -573,11 +657,16 @@ int main() - test5(); - test6(); - test7(); -- -+ - //bug1513(); // BUG: EH chaining unimplemented. - //doublecollide(); // BUG: EH chaining unimplemented. - //collideMixed(); // BUG: EH chaining unimplemented. - //multicollide(); // BUG: EH chaining unimplemented. -+ test9568(); -+ -+ //test8(); // BUG: !INVALID TEST! -+ test9(); -+ test10964(); - - printf("finish\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/cppb.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/cppb.cpp 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,158 @@ -+ -+#include <stdio.h> -+#include <assert.h> -+ -+/**************************************/ -+ -+int foo(int i, int j, int k); -+ -+int foob(int i, int j, int k) -+{ -+ printf("i = %d\n", i); -+ printf("j = %d\n", j); -+ printf("k = %d\n", k); -+ assert(i == 1); -+ assert(j == 2); -+ assert(k == 3); -+ -+ foo(i, j, k); -+ -+ return 7; -+} -+ -+/**************************************/ -+ -+class D *dthis; -+ -+class D -+{ -+ public: -+ virtual int bar(int i, int j, int k) -+ { -+ printf("this = %p\n", this); -+ assert(this == dthis); -+ printf("D.bar: i = %d\n", i); -+ printf("D.bar: j = %d\n", j); -+ printf("D.bar: k = %d\n", k); -+ assert(i == 9); -+ assert(j == 10); -+ assert(k == 11); -+ return 8; -+ } -+}; -+ -+ -+D* getD() -+{ -+ D *d = new D(); -+ dthis = d; -+ return d; -+} -+ -+/**************************************/ -+ -+class E -+{ -+ public: -+ virtual int bar(int i, int j, int k); -+}; -+ -+ -+int callE(E *e) -+{ -+ return e->bar(11,12,13); -+} -+ -+/**************************************/ -+ -+void foo4(char *p) -+{ -+} -+ -+/**************************************/ -+ -+struct foo5 { int i; int j; void *p; }; -+ -+class bar5 -+{ -+public: -+ virtual foo5 getFoo(int i){ -+ printf("This = %p\n", this); -+ foo5 f; -+ f.i = 1; -+ f.j = 2 + i; -+ f.p = (void*)this; -+ return f; -+ } -+}; -+ -+bar5* newBar() -+{ -+ bar5* b = new bar5(); -+ printf("bar = %p\n", b); -+ return b; -+} -+ -+ -+/**************************************/ -+ -+typedef struct -+{ -+ int i; -+ double d; -+} S6; -+ -+S6 foo6(void) -+{ -+ S6 s; -+ s.i = 42; -+ s.d = 2.5; -+ return s; -+} -+ -+extern "C" { int foosize6() -+{ -+ return sizeof(S6); -+} -+} -+ -+/**************************************/ -+ -+typedef struct -+{ -+ int i; -+ long long d; -+} S7; -+ -+extern "C" { int foo7() -+{ -+ return sizeof(S7); -+} -+} -+ -+/**************************************/ -+ -+void foo8(const char *p) -+{ -+} -+ -+/**************************************/ -+// 4059 -+ -+struct elem9 { }; -+void foobar9(elem9*, elem9*) { } -+ -+/**************************************/ -+// 5148 -+ -+void foo10(const char*, const char*) { } -+void foo10(const int, const int) { } -+void foo10(const char, const char) { } -+ -+struct MyStructType { }; -+void foo10(const MyStructType s, const MyStructType t) { } -+ -+enum MyEnumType { onemember }; -+void foo10(const MyEnumType s, const MyEnumType t) { } -+ -+ ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/cppmangle1.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/cppmangle1.cpp 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+int test0(int x) -+{ -+ return x; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/hello-profile.d.trace.def 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/hello-profile.d.trace.def 1970-01-01 01:00:00.000000000 +0100 -@@ -1,3 +0,0 @@ -- --FUNCTIONS -- _D5hello8showargsFAAaZv ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/hello-profile-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/hello-profile-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,18 +0,0 @@ --#!/usr/bin/env bash -- --# strip out Dmain since it's symbol differs between windows and non-windows --grep -v Dmain ${RESULTS_DIR}/runnable/hello-profile.d.trace.def > ${RESULTS_DIR}/runnable/hello-profile.d.trace.def2 -- --diff --strip-trailing-cr runnable/extra-files/hello-profile.d.trace.def ${RESULTS_DIR}/runnable/hello-profile.d.trace.def2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --tracelog=${RESULTS_DIR}/runnable/hello-profile.d.trace.log --if [ ! -f ${tracelog} ]; then -- echo "missing file: ${tracelog}" -- exit 1 --fi -- --rm ${RESULTS_DIR}/runnable/hello-profile.d.trace.{def,def2,log} -- ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/bar.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/bar.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module lib10386.foo.bar; -+ -+void foo(int x) -+{ -+ assert(x == 1); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/lib10386/foo/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+module lib10386.foo; -+ -+public import lib10386.foo.bar; ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/statictor-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/statictor-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,13 +0,0 @@ --#!/usr/bin/env bash -- --# trim off the first line which contains the path of the file which differs between windows and non-windows --# also trim off compiler debug message --grep -v "runnable\|DEBUG" $1 > ${RESULTS_DIR}/runnable/statictor.d.out.2 -- --diff --strip-trailing-cr runnable/extra-files/statictor.d.out ${RESULTS_DIR}/runnable/statictor.d.out.2 --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${RESULTS_DIR}/runnable/statictor.d.out.2 -- ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/test10386.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/test10386.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+module test10386; -+ -+// import lib.foo.bar; // ok -+import lib10386.foo; // linker failure -+ -+void main() -+{ -+ static assert(foo.mangleof == "_D8lib103863foo3bar3fooFiZv"); -+ foo(1); -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/test10567a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/test10567a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,52 @@ -+struct BigInt1 -+{ -+ int[] dara; -+ -+ bool opEquals(const ref BigInt1 rhs) const // -> stored in TypeInfo_Struct.xopEquals -+ { -+ return true; -+ } -+ bool opEquals(T)(T rhs) const -+ { -+ return false; -+ } -+ -+ int opCmp(const ref BigInt1 rhs) const // stored in TypeInfo_Struct.xopCmp -+ { -+ return 0; -+ } -+ int opCmp(T)(T rhs) const -+ { -+ return 1; -+ } -+} -+ -+struct BigInt2 -+{ -+ int[] dara; -+ -+ bool opEquals(const ref BigInt2 rhs) const // stored in TypeInfo_Struct.xopEquals -+ { -+ return true; -+ } -+ -+ int opCmp(const ref BigInt2 rhs) const // stored in TypeInfo_Struct.xopCmp -+ { -+ return 0; -+ } -+} -+ -+struct BigInt3 -+{ -+ int[] dara; -+ -+ bool opEquals(T)(T rhs) const // stored in TypeInfo_Struct.xopEquals -+ { -+ return true; -+ } -+ -+ int opCmp(T)(T rhs) const // stored in TypeInfo_Struct.xopCmp -+ { -+ return 0; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/test10567.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/test10567.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+import test10567a; -+ -+template TypeTuple(TL...) { alias TL TypeTuple; } -+ -+void main() -+{ -+ foreach (BigInt; TypeTuple!(BigInt1, BigInt2, BigInt3)) -+ { -+ auto i = BigInt([100]); -+ auto j = BigInt([100]); -+ -+ assert(typeid(BigInt).equals(&i, &j) == true); -+ assert(typeid(BigInt).compare(&i, &j) == 0); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/extra-files/testzip-postscript.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/extra-files/testzip-postscript.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,14 +0,0 @@ --#!/usr/bin/env bash -- --testzipfile=${RESULTS_DIR}/runnable/testzip-out.zip -- --if [ ! -f ${testzipfile} ]; then -- exit 1; --fi -- --unzip -l ${testzipfile} --if [ $? -ne 0 ]; then -- exit 1; --fi -- --rm ${testzipfile} ---- a/src/gcc/testsuite/gdc.test/runnable/foreach5.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/foreach5.d 2014-04-01 16:32:51.000000000 +0100 -@@ -432,6 +432,129 @@ void test7814() - } - - /***************************************/ -+// 10049 -+ -+struct ByLine10049 -+{ -+ bool empty() { return true; } -+ string front() { return null; } -+ void popFront() {} -+ -+ ~this() {} // necessary -+} -+ -+void test10049() -+{ -+ ByLine10049 r; -+ foreach (line; r) -+ { -+ doNext: -+ {} -+ } -+} -+ -+/******************************************/ -+// 6652 -+ -+void test6652() -+{ -+ size_t sum; -+ foreach (i; 0 .. 10) -+ sum += i++; // 0123456789 -+ assert(sum == 45); -+ -+ sum = 0; -+ foreach (ref i; 0 .. 10) -+ sum += i++; // 02468 -+ assert(sum == 20); -+ -+ sum = 0; -+ foreach_reverse (i; 0 .. 10) -+ sum += i--; // 9876543210 -+ assert(sum == 45); -+ -+ sum = 0; -+ foreach_reverse (ref i; 0 .. 10) -+ sum += i--; // 97531 -+ assert(sum == 25); -+ -+ enum ary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; -+ sum = 0; -+ foreach (i, v; ary) -+ { -+ assert(i == v); -+ sum += i++; // 0123456789 -+ } -+ assert(sum == 45); -+ -+ sum = 0; -+ foreach (ref i, v; ary) -+ { -+ assert(i == v); -+ sum += i++; // 02468 -+ } -+ assert(sum == 20); -+ -+ sum = 0; -+ foreach_reverse (i, v; ary) -+ { -+ assert(i == v); -+ sum += i--; // 9876543210 -+ } -+ assert(sum == 45); -+ -+ sum = 0; -+ foreach_reverse (ref i, v; ary) -+ { -+ assert(i == v); -+ sum += i--; // 97531 -+ } -+ assert(sum == 25); -+ -+ static struct Iter -+ { -+ ~this() -+ { -+ ++_dtorCount; -+ } -+ -+ bool opCmp(ref const Iter rhs) -+ { -+ return _pos == rhs._pos; -+ } -+ -+ void opUnary(string op)() if(op == "++" || op == "--") -+ { -+ mixin(op ~ q{_pos;}); -+ } -+ -+ size_t _pos; -+ static size_t _dtorCount; -+ } -+ -+ Iter._dtorCount = sum = 0; -+ foreach (v; Iter(0) .. Iter(10)) -+ sum += v._pos++; // 0123456789 -+ assert(sum == 45 && Iter._dtorCount == 12); -+ -+ Iter._dtorCount = sum = 0; -+ foreach (ref v; Iter(0) .. Iter(10)) -+ sum += v._pos++; // 02468 -+ assert(sum == 20 && Iter._dtorCount == 2); -+ -+ // additional dtor calls due to unnecessary postdecrements -+ Iter._dtorCount = sum = 0; -+ foreach_reverse (v; Iter(0) .. Iter(10)) -+ sum += v._pos--; // 9876543210 -+ assert(sum == 45 && Iter._dtorCount >= 12); -+ -+ Iter._dtorCount = sum = 0; -+ foreach_reverse (ref v; Iter(0) .. Iter(10)) -+ sum += v._pos--; // 97531 -+ assert(sum == 25 && Iter._dtorCount >= 2); -+} -+ -+/***************************************/ - // 8595 - - struct OpApply8595 -@@ -452,6 +575,164 @@ string test8595() - } - - /***************************************/ -+// 9068 -+ -+struct Foo9068 -+{ -+ static int[] destroyed; -+ int x; -+ ~this() { destroyed ~= x; } -+} -+ -+struct SimpleCounter9068 -+{ -+ static int destroyedCount; -+ const(int) limit = 5; -+ int counter; -+ ~this() { destroyedCount++; } -+ -+ // Range primitives. -+ @property bool empty() const { return counter >= limit; } -+ @property int front() { return counter; } -+ void popFront() { counter++; } -+} -+ -+// ICE when trying to break outer loop from inside switch statement -+void test9068() -+{ -+ //---------------------------------------- -+ // There was never a bug in this case (no range). -+ int sum; -+loop_simple: -+ foreach (i; [10, 20]) { -+ sum += i; -+ break loop_simple; -+ } -+ assert(sum == 10); -+ -+ //---------------------------------------- -+ // There was a bug with loops over ranges. -+ int last = -1; -+X: foreach (i; SimpleCounter9068()) { -+ switch(i) { -+ case 3: break X; -+ default: last = i; -+ } -+ } -+ assert(last == 2); -+ assert(SimpleCounter9068.destroyedCount == 1); -+ -+ //---------------------------------------- -+ // Simpler case: the compiler error had nothing to do with the switch. -+ last = -1; -+loop_with_range: -+ foreach (i; SimpleCounter9068()) { -+ last = i; -+ break loop_with_range; -+ } -+ assert(last == 0); -+ assert(SimpleCounter9068.destroyedCount == 2); -+ -+ //---------------------------------------- -+ // Test with destructors: the loop is implicitly wrapped into two -+ // try/finally clauses. -+loop_with_dtors: -+ for (auto x = Foo9068(4), y = Foo9068(5); x.x != 10; ++x.x) { -+ if (x.x == 8) -+ break loop_with_dtors; -+ } -+ assert(Foo9068.destroyed == [5, 8]); -+ Foo9068.destroyed.clear(); -+ -+ //---------------------------------------- -+ // Same with an unlabelled break. -+ for (auto x = Foo9068(4), y = Foo9068(5); x.x != 10; ++x.x) { -+ if (x.x == 7) -+ break; -+ } -+ assert(Foo9068.destroyed == [5, 7]); -+ Foo9068.destroyed.clear(); -+} -+ -+/***************************************/ -+// 10475 -+ -+void test10475a() -+{ -+ struct DirIterator -+ { -+ int _store = 42; -+ ~this() { assert(0); } -+ } -+ -+ DirIterator dirEntries() -+ { -+ throw new Exception(""); -+ } -+ -+ try -+ { -+ for (DirIterator c = dirEntries(); true; ) {} -+ assert(0); -+ } -+ catch (Exception e) -+ { -+ assert(e.next is null); -+ } -+} -+ -+void test10475b() -+{ -+ uint g; -+ struct S -+ { -+ uint flag; -+ ~this() { g |= flag; } -+ } -+ -+ S thrown() -+ { -+ throw new Exception(""); -+ } -+ -+ g = 0x0; -+ try -+ { -+ for (auto x = S(0x1), y = S(0x2), z = thrown(); true; ) {} -+ assert(0); -+ } -+ catch (Exception e) -+ { -+ assert(e.next is null); -+ } -+ assert(g == 0x3); -+ -+ g = 0x0; -+ try -+ { -+ for (auto x = S(0x1), y = thrown(), z = S(0x2); true; ) {} -+ assert(0); -+ } -+ catch (Exception e) -+ { -+ assert(e.next is null); -+ } -+ assert(g == 0x1); -+ -+ g = 0x0; -+ try -+ { -+ for (auto x = thrown(), y = S(0x1), z = S(0x2); true; ) {} -+ assert(0); -+ } -+ catch (Exception e) -+ { -+ assert(e.next is null); -+ } -+ assert(g == 0x0); -+} -+ -+/***************************************/ - - int main() - { -@@ -470,6 +751,10 @@ int main() - test6659b(); - test6659c(); - test7814(); -+ test6652(); -+ test9068(); -+ test10475a(); -+ test10475b(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/funclit.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/funclit.d 2014-04-01 16:32:51.000000000 +0100 -@@ -717,6 +717,200 @@ void test9153() - } - - /***************************************************/ -+// 9393 -+ -+template ifThrown9393a(E) -+{ -+ void ifThrown9393a(T)(scope T delegate(E) errHandler) -+ { -+ } -+} -+void ifThrown9393b(E, T)(scope T delegate(E) errHandler) -+{ -+} -+ -+void foo9393(T)(void delegate(T) dg){ dg(T.init); } -+void foo9393()(void delegate(int) dg){ foo9393!int(dg); } -+ -+void test9393() -+{ -+ ifThrown9393a!Exception(e => 10); -+ ifThrown9393b!Exception(e => 10); -+ -+ foo9393((x){ assert(x == int.init); }); -+} -+ -+/***************************************************/ -+// 9415 -+ -+void test9415() -+{ -+ int z; -+ typeof((int a){return z;}) dg; -+ dg = (int a){return z;}; -+} -+ -+/***************************************************/ -+// 9628 -+ -+template TypeTuple9628(TL...) { alias TypeTuple9628 = TL; } -+void map9628(alias func)() { func(0); } -+ -+void test9628() -+{ -+ auto items = [[10, 20], [30]]; -+ size_t[] res; -+ -+ res = null; -+ foreach (_; 0 .. 2) -+ { -+ foreach (sub; items) -+ { -+ map9628!(( i){ res ~= sub.length; }); -+ map9628!((size_t i){ res ~= sub.length; }); -+ } -+ } -+ assert(res == [2,2,1,1, 2,2,1,1]); -+ -+ res = null; -+ foreach (_; TypeTuple9628!(0, 1)) -+ { -+ foreach (sub; items) -+ { -+ map9628!(( i){ res ~= sub.length; }); -+ map9628!((size_t i){ res ~= sub.length; }); -+ } -+ } -+ assert(res == [2,2,1,1, 2,2,1,1]); -+} -+ -+/***************************************************/ -+// 9928 -+ -+void test9928() -+{ -+ void* smth = (int x) { return x; }; -+} -+ -+/***************************************************/ -+// 10288 -+ -+T foo10288(T)(T x) -+{ -+ void lambda() @trusted nothrow { x += 10; } -+ lambda(); -+ return x; -+} -+ -+T bar10288(T)(T x) -+{ -+ () @trusted { x += 10; } (); -+ return x; -+} -+ -+T baz10288(T)(T arg) -+{ -+ static int g = 10; -+ () @trusted { x += g; } (); -+ return x; -+} -+ -+void test10288() @safe pure nothrow -+{ -+ assert(foo10288(10) == 20); // OK -+ assert(bar10288(10) == 20); // OK <- NG -+ static assert(!__traits(compiles, baz10288(10))); -+} -+ -+/***************************************************/ -+// 10666 -+ -+struct S10666 -+{ -+ int val; -+ ~this() {} -+} -+ -+void foo10666(S10666 s1) -+{ -+ S10666 s2; -+ -+ /* Even if closureVars(s1 and s2) are accessed by directly called lambdas, -+ * they won't escape the scope of this function. -+ */ -+ auto x1 = (){ return s1.val; }(); // OK -+ auto x2 = (){ return s2.val; }(); // OK -+} -+ -+/***************************************************/ -+// 11081 -+ -+T ifThrown11081(E : Throwable, T)(T delegate(E) errorHandler) -+{ -+ return errorHandler(); -+} -+ -+void test11081() -+{ -+ static if (__traits(compiles, ifThrown11081!Exception(e => 0))) -+ { -+ } -+ static if (__traits(compiles, ifThrown11081!Exception(e => 0))) -+ { -+ } -+} -+ -+/***************************************************/ -+// 11220 -+ -+int parsePrimaryExp11220(int x) -+{ -+ parseAmbig11220!( (parsed){ x += 1; } )(); -+ return 1; -+} -+ -+typeof(handler(1)) parseAmbig11220(alias handler)() -+{ -+ return handler(parsePrimaryExp11220(1)); -+} -+ -+/***************************************************/ -+// 11230 -+ -+template map11230(fun...) -+{ -+ auto map11230(Range)(Range r) -+ { -+ return MapResult11230!(fun, Range)(r); -+ } -+} -+ -+struct MapResult11230(alias fun, R) -+{ -+ R _input; -+ this(R input) { _input = input; } -+} -+ -+class A11230 { A11230[] as; } -+class B11230 { A11230[] as; } -+class C11230 : A11230 {} -+ -+C11230 visit11230(A11230 a) -+{ -+ a.as.map11230!(a => visit11230); -+ return null; -+} -+C11230 visit11230(B11230 b) -+{ -+ b.as.map11230!(a => visit11230); -+ return null; -+} -+C11230 visit11230() -+{ -+ return null; -+} -+ -+/***************************************************/ - - int main() - { -@@ -758,6 +952,11 @@ int main() - test8496(); - test8575(); - test9153(); -+ test9393(); -+ test9415(); -+ test9628(); -+ test9928(); -+ test10288(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/functype.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/functype.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,293 @@ -+extern(C) int printf(const char*, ...); -+ -+/***************************************************/ -+ -+void testfp() -+{ -+ static int func1(int n = 1) { return n; } -+ static int func2(int n ) { return n; } -+ static assert(typeof(func1).stringof == "int(int n = 1)"); -+ static assert(typeof(func2).stringof == "int(int n)"); -+ static assert( is(typeof(func1()))); // OK -+ static assert(!is(typeof(func2()))); // NG -+ -+ alias typeof(func1) Func1; -+ alias typeof(func2) Func2; -+ static assert(is(Func1 == Func2)); -+ static assert(Func1.stringof == "int(int n = 1)"); -+ static assert(Func2.stringof == "int(int n)"); -+ -+ auto fp1 = &func1; -+ auto fp2 = &func2; -+ static assert(typeof(fp1).stringof == "int function(int n = 1)"); -+ static assert(typeof(fp2).stringof == "int function(int n)"); -+ static assert( is(typeof(fp1()))); // OK -+ static assert(!is(typeof(fp2()))); // NG -+ -+ alias typeof(fp1) Fp1; -+ alias typeof(fp2) Fp2; -+ static assert(is(Fp1 == Fp2)); -+ static assert(Fp1.stringof == "int function(int n = 1)"); -+ static assert(Fp2.stringof == "int function(int n)"); -+ -+ typeof(fp1) fp3 = fp1; -+ typeof(fp2) fp4 = fp2; -+ static assert(is(typeof(fp3) == typeof(fp4))); -+ static assert(typeof(fp3).stringof == "int function(int n = 1)"); -+ static assert(typeof(fp4).stringof == "int function(int n)"); -+ static assert( is(typeof(fp3()))); // OK -+ static assert(!is(typeof(fp4()))); // NG -+ -+ alias typeof(fp3) Fp3; -+ alias typeof(fp4) Fp4; -+ static assert(is(Fp3 == Fp4)); -+ static assert(Fp3.stringof == "int function(int n = 1)"); -+ static assert(Fp4.stringof == "int function(int n)"); -+ -+ auto fplit1 = function(int n = 1) { return n; }; -+ auto fplit2 = function(int n ) { return n; }; -+ static assert( is(typeof(fplit1()))); // OK -+ static assert(!is(typeof(fplit2()))); // NG -+} -+ -+void testdg() -+{ -+ int nest1(int n = 1) { return n; } -+ int nest2(int n ) { return n; } -+ static assert(typeof(nest1).stringof == "int(int n = 1)"); -+ static assert(typeof(nest2).stringof == "int(int n)"); -+ static assert( is(typeof(nest1()))); // OK -+ static assert(!is(typeof(nest2()))); // NG -+ -+ alias typeof(nest1) Nest1; -+ alias typeof(nest2) Nest2; -+ static assert(is(Nest1 == Nest2)); -+ static assert(Nest1.stringof == "int(int n = 1)"); -+ static assert(Nest2.stringof == "int(int n)"); -+ -+ auto dg1 = &nest1; -+ auto dg2 = &nest2; -+ static assert(typeof(dg1).stringof == "int delegate(int n = 1)"); -+ static assert(typeof(dg2).stringof == "int delegate(int n)"); -+ static assert( is(typeof(dg1()))); // OK -+ static assert(!is(typeof(dg2()))); // NG -+ -+ alias typeof(dg1) Dg1; -+ alias typeof(dg2) Dg2; -+ static assert(is(Dg1 == Dg2)); -+ static assert(Dg1.stringof == "int delegate(int n = 1)"); -+ static assert(Dg2.stringof == "int delegate(int n)"); -+ -+ typeof(dg1) dg3 = dg1; -+ typeof(dg2) dg4 = dg2; -+ static assert(typeof(dg3).stringof == "int delegate(int n = 1)"); -+ static assert(typeof(dg4).stringof == "int delegate(int n)"); -+ static assert( is(typeof(dg3()))); // OK -+ static assert(!is(typeof(dg4()))); // NG -+ -+ alias typeof(dg3) Dg3; -+ alias typeof(dg4) Dg4; -+ static assert(is(Dg3 == Dg4)); -+ static assert(Dg3.stringof == "int delegate(int n = 1)"); -+ static assert(Dg4.stringof == "int delegate(int n)"); -+ -+ auto dglit1 = delegate(int n = 1) { return n; }; -+ auto dglit2 = delegate(int n ) { return n; }; -+ static assert( is(typeof(dglit1()))); // OK -+ static assert(!is(typeof(dglit2()))); // NG -+} -+ -+void testda() -+{ -+ // Unsupported cases with current implementation. -+ -+ int function(int n = 1)[] fpda = [n => n + 1, n => n+2]; -+ assert(fpda[0](1) == 2); -+ assert(fpda[1](1) == 3); -+ static assert(!is(typeof(fpda[0]() == 1))); // cannot call with using defArgs -+ static assert(!is(typeof(fpda[1]() == 2))); // cannot call with using defArgs -+ static assert(typeof(fpda).stringof == "int function(int)[]"); -+ static assert(typeof(fpda).stringof != "int funciton(int n = 1)[]"); -+ -+ int delegate(int n = 1)[] dgda = [n => n + 1, n => n+2]; -+ assert(dgda[0](1) == 2); -+ assert(dgda[1](1) == 3); -+ static assert(!is(typeof(dgda[0]() == 1))); // cannot call with using defArgs -+ static assert(!is(typeof(dgda[1]() == 2))); // cannot call with using defArgs -+ static assert(typeof(dgda).stringof == "int delegate(int)[]"); -+ static assert(typeof(fpda).stringof != "int delegate(int n = 1)[]"); -+} -+ -+template StringOf(T) -+{ -+ // template type parameter cannot have redundant informations -+ enum StringOf = T.stringof; -+} -+ -+void testti() -+{ -+ int[] test(int[] a = []) { return a; } -+ static assert(typeof(test).stringof == "int[](int[] a = [])"); -+ static assert(StringOf!(typeof(test)) == "int[](int[])"); -+ -+ float function(float x = 0F) fp = x => x; -+ static assert(typeof(fp).stringof == "float function(float x = " ~ (0F).stringof ~ "F)"); -+ static assert(StringOf!(typeof(fp)) == "float function(float)"); -+ -+ double delegate(double x = 0.0) dg = x => x; -+ static assert(typeof(dg).stringof == "double delegate(double x = " ~ (0.0).stringof ~ ")"); -+ static assert(StringOf!(typeof(dg)) == "double delegate(double)"); -+ -+ template F(T) {} -+ auto fp1 = (int a = 1) {}; -+ auto fp2 = (int b = 2) {}; -+ static assert(typeof(fp1).stringof != typeof(fp2).stringof); -+ alias F1 = F!(typeof(fp1)); -+ alias F2 = F!(typeof(fp2)); -+ static assert(__traits(isSame, F1, F2)); -+ static assert(F1.mangleof == F2.mangleof); -+} -+ -+void testxx() -+{ -+ // The corner cases which I had introduced in forum discussion -+ -+ // f will inherit default args from its initializer, if it's declared with 'auto' -+ auto f1 = (int n = 10){ return 10; }; -+ assert(f1() == 10); -+ -+ // what is the actual default arg of f? -+ int function(int n = 10) f2 = (int n = 20){ return n; }; -+ int function(int n ) f3 = (int n = 30){ return n; }; -+ int function(int n = 40) f4 = (int n ){ return n; }; -+ assert(f2() == 10); -+ static assert(!is(typeof(f3()))); -+ assert(f4() == 40); -+ -+ // conditional expression and the type of its result -+ auto f5 = true ? (int n = 10){ return n; } -+ : (int n = 20){ return n; } ; -+ auto f6 = true ? (int n = 10, string s = "hello"){ return n; } -+ : (int n = 10, string s = "world"){ return n; } ; -+ static assert(!is(typeof(f5()))); // cannot call -+ static assert(!is(typeof(f6()))); // cannot call -+ -+ int function(int n = 10) f7; // default arg of the first parameter is 10 -+ f7 = (int n = 20){ return n; }; // function literal's default arg will be ignored -+ assert(f7() == 10); -+ -+ // returning function pointer/delegate type can have default args -+ int delegate(int n = 10) foo(int x) { return n => n + x; } -+ auto f = foo(1); -+ assert(f() == 11); -+} -+ -+/***************************************************/ -+// 3646 -+ -+int bar3646(int x = 10) { printf("bar %d\n", x); return x; } -+int bam3646(int y) { printf("bam %d\n", y); return y; } -+ -+int qux3646() { printf("quux\n"); return 20; } -+int qux3646(int i) { printf("quux %d\n", i); return 30; } -+ -+void foo3646a(Fn)(Fn fn) -+{ -+ fn(); -+} -+ -+void foo3646b(alias fn)(int res1, int res2) -+{ -+ assert(fn() == res1); -+ assert(fn(42) == res2); -+} -+ -+void test3646() -+{ -+ static assert(!is(typeof(foo3646(&bar3646)))); -+ static assert(!is(typeof(foo3646(&bam3646)))); -+ static assert(typeof(&bar3646).stringof == "int function(int x = 10)"); -+ static assert(typeof(&bam3646).stringof == "int function(int y)"); -+ -+ foo3646b!bar3646(10, 42); -+ static assert(!is(typeof(foo3646b!bam3646(0, 0)))); -+ foo3646b!qux3646(20, 30); -+} -+ -+/***************************************************/ -+// 3866 -+ -+void test3866() -+{ -+ -+ auto foo = (int a = 1) { return a; }; -+ auto bar = (int a) { return a; }; -+ -+ assert(foo() == 1); -+ static assert(!is(typeof(bar()))); -+ assert(foo(2) == 2); -+ assert(bar(3) == 3); -+} -+ -+/***************************************************/ -+// 8579 -+ -+void test8579() -+{ -+ static void func1(int i, double j = 1.0) {} -+ static void func2(int x, double y) {} -+ auto fn1 = &func1; -+ auto fn2 = &func2; -+ static assert(is(typeof(fn1) == typeof(fn2))); -+ assert( typeid(fn1) is typeid(fn2) ); -+ static assert(typeof(fn1).stringof == "void function(int i, double j = " ~ (1.0).stringof ~ ")"); -+ static assert(typeof(fn2).stringof == "void function(int x, double y)"); -+ -+ static int func3(int x, double y) { return 0; } -+ static int func4(int i, double j = 1.0) { return 0; } -+ auto fn3 = &func3; -+ auto fn4 = &func4; -+ static assert(is(typeof(fn3) == typeof(fn4))); -+ assert( typeid(fn3) is typeid(fn4) ); -+ static assert(typeof(fn3).stringof == "int function(int x, double y)"); -+ static assert(typeof(fn4).stringof == "int function(int i, double j = " ~ (1.0).stringof ~ ")"); -+} -+ -+/***************************************************/ -+// 10734 -+ -+// There's no platform independent export symbol, so -+// test just only in Win32. -+version(Win32) -+{ -+ -+extern(Windows) -+{ -+ export uint DefWindowProcA(void*, uint, uint, ptrdiff_t); -+ alias uint function (void*, uint, uint, ptrdiff_t) WNDPROC; -+} -+ -+void test10734() -+{ -+ WNDPROC lpfnWndProc = &DefWindowProcA; -+} -+ -+} -+ -+/***************************************************/ -+ -+int main() -+{ -+ testfp(); -+ testdg(); -+ testda(); -+ testti(); -+ testxx(); -+ test3646(); -+ test3866(); -+ test8579(); -+ -+ printf("Success\n"); -+ return 0; -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/hospital.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/hospital.d 2014-04-01 16:32:51.000000000 +0100 -@@ -32,9 +32,9 @@ int main(string[] args) - - if (n == 1000) - { -- assert(t.patients == 102515); -- assert(t.hospitalTime == 33730654); -- assert(t.hospitalVisits == 106371); -+ assert(t.patients == 102515); -+ assert(t.hospitalTime == 33730654); -+ assert(t.hospitalVisits == 106371); - } - return 0; - } -@@ -67,7 +67,7 @@ public: - } - - private: -- const int LEVELS = 5, DISTRICTS = 4; -+ enum int LEVELS = 5, DISTRICTS = 4; - HealthcareRegion[] districts; - Hospital localHospital; - -@@ -115,9 +115,9 @@ package: - TriagePatients(); - - if(genRandom(1.0) > 0.7) -- { Patient p = new Patient(); -- NewArrival(p); -- } -+ { Patient p = new Patient(); -+ NewArrival(p); -+ } - } - - Patient[] RegionalTransferPatients() -@@ -162,7 +162,7 @@ private: - if(!p.remainingTime) - { - availableStaff++; -- treatment = treatment[0..i] ~ treatment[i+1..$]; -+ treatment = treatment[0..i] ~ treatment[i+1..$]; - discharged.Plus(p); - } - } -@@ -197,7 +197,7 @@ private: - } - - void TriagePatients() -- { -+ { - for(ptrdiff_t i = triage.length-1; i >= 0; i--) - { - Patient p = triage[i]; ---- a/src/gcc/testsuite/gdc.test/runnable/iasm64.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/iasm64.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3946,6 +3946,9 @@ void test53() - 0x49, 0x8D, 0x44, 0x05, 0x12, // lea RAX,012h[RAX][R13] - 0x49, 0x8D, 0x84, 0x05, 0x34, 0x12, 0x00, 0x00, // lea RAX,01234h[RAX][R13] - 0x49, 0x8D, 0x84, 0x05, 0x78, 0x56, 0x34, 0x12, // lea RAX,012345678h[RAX][R13] -+ -+ 0x48, 0x8D, 0x04, 0x24, // lea RAX,[RSP] -+ 0x49, 0x8D, 0x04, 0x24, // lea RAX,[R12] - ]; - - asm -@@ -4008,6 +4011,9 @@ void test53() - lea RAX, [R13+RAX+0x1234]; - lea RAX, [R13+RAX+0x1234_5678]; - -+ lea RAX, [RSP]; -+ lea RAX, [R12]; -+ - L1: pop RAX ; - mov p[RBP],RAX ; - } -@@ -6393,6 +6399,70 @@ L1: pop RAX; - assert(p[data.length] == 0x58); // pop RAX - } - -+/* ======================= SHA ========================== */ -+ -+void test62() -+{ -+ ubyte* p; -+ byte m8; -+ short m16; -+ int m32; -+ M64 m64; -+ M128 m128; -+ static ubyte data[] = -+ [ -+0x0F, 0x3A, 0xCC, 0xD1, 0x01, // sha1rnds4 XMM2, XMM1, 1; -+0x0F, 0x3A, 0xCC, 0x10, 0x01, // sha1rnds4 XMM2, [RAX], 1; -+0x0F, 0x38, 0xC8, 0xD1, // sha1nexte XMM2, XMM1; -+0x0F, 0x38, 0xC8, 0x10, // sha1nexte XMM2, [RAX]; -+0x0F, 0x38, 0xC9, 0xD1, // sha1msg1 XMM2, XMM1; -+0x0F, 0x38, 0xC9, 0x10, // sha1msg1 XMM2, [RAX]; -+0x0F, 0x38, 0xCA, 0xD1, // sha1msg2 XMM2, XMM1; -+0x0F, 0x38, 0xCA, 0x10, // sha1msg2 XMM2, [RAX]; -+0x0F, 0x38, 0xCB, 0xD1, // sha256rnds2 XMM2, XMM1; -+0x0F, 0x38, 0xCB, 0x10, // sha256rnds2 XMM2, [RAX]; -+0x0F, 0x38, 0xCC, 0xD1, // sha256msg1 XMM2, XMM1; -+0x0F, 0x38, 0xCC, 0x10, // sha256msg1 XMM2, [RAX]; -+0x0F, 0x38, 0xCD, 0xD1, // sha256msg2 XMM2, XMM1; -+0x0F, 0x38, 0xCD, 0x10, // sha256msg2 XMM2, [RAX]; -+ ]; -+ -+ asm -+ { -+ call L1; -+ -+ sha1rnds4 XMM2, XMM1, 1; -+ sha1rnds4 XMM2, [RAX], 1; -+ -+ sha1nexte XMM2, XMM1; -+ sha1nexte XMM2, [RAX]; -+ -+ sha1msg1 XMM2, XMM1; -+ sha1msg1 XMM2, [RAX]; -+ -+ sha1msg2 XMM2, XMM1; -+ sha1msg2 XMM2, [RAX]; -+ -+ sha256rnds2 XMM2, XMM1; -+ sha256rnds2 XMM2, [RAX]; -+ -+ sha256msg1 XMM2, XMM1; -+ sha256msg1 XMM2, [RAX]; -+ -+ sha256msg2 XMM2, XMM1; -+ sha256msg2 XMM2, [RAX]; -+ -+L1: pop RAX; -+ mov p[RBP],RAX; -+ } -+ -+ foreach (ref i, b; data) -+ { -+ //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b); -+ assert(p[i] == b); -+ } -+} -+ - - void test2941() - { -@@ -6419,6 +6489,43 @@ L1: - } - } - -+ -+void test9866() -+{ -+ ubyte* p; -+ static ubyte data[] = -+ [ -+ 0x48, 0x0f, 0xbe, 0xc0, // movsx RAX, AL -+ 0x48, 0x0f, 0xbe, 0x00, // movsx RAX, byte ptr [RAX] -+ 0x48, 0x0f, 0xbf, 0xc0, // movsx RAX, AX -+ 0x48, 0x0f, 0xbf, 0x00, // movsx RAX, word ptr [RAX] -+ 0x48, 0x63, 0xc0, // movsxd RAX, EAX -+ 0x48, 0x63, 0x00, // movsxd RAX, dword ptr [RAX] -+ ]; -+ -+ asm -+ { -+ call L1; -+ -+ movsx RAX, AL; -+ movsx RAX, byte ptr [RAX]; -+ movsx RAX, AX; -+ movsx RAX, word ptr [RAX]; -+ movsxd RAX, EAX; -+ movsxd RAX, dword ptr [RAX]; -+ -+L1: pop RAX; -+ mov p[RBP],RAX; -+ } -+ -+ foreach (ref i, b; data) -+ { -+ // printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b); -+ assert(p[i] == b); -+ } -+ assert(p[data.length] == 0x58); // pop RAX -+} -+ - /****************************************************/ - - void testxadd() -@@ -6454,6 +6561,44 @@ L1: pop RAX; - - /****************************************************/ - -+void test9965() -+{ -+ ubyte* p; -+ static ubyte data[] = -+ [ -+ 0xB7, 0x01, // mov BH,1 -+ 0x40, 0xB6, 0x01, // mov SIL,1 -+ 0x40, 0xB7, 0x01, // mov DIL,1 -+ 0x40, 0xB5, 0x01, // mov BPL,1 -+ 0x40, 0xB4, 0x01, // mov SPL,1 -+ 0x41, 0xB0, 0x01, // mov R8B,1 -+ ]; -+ -+ asm -+ { -+ call L1; -+ -+ mov BH, 1; -+ mov SIL, 1; -+ mov DIL, 1; -+ mov BPL, 1; -+ mov SPL, 1; -+ mov R8B, 1; -+ -+L1: pop RAX; -+ mov p[RBP],RAX; -+ } -+ -+ foreach (ref i, b; data) -+ { -+ // printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b); -+ assert(p[i] == b); -+ } -+ assert(p[data.length] == 0x58); // pop RAX -+} -+ -+/****************************************************/ -+ - int main() - { - printf("Testing iasm64.d\n"); -@@ -6518,8 +6663,11 @@ int main() - test59(); - test60(); - test61(); -+ test62(); - test2941(); -+ test9866(); - testxadd(); -+ test9965(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/iasm.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/iasm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4648,6 +4648,138 @@ L1: pop EAX; - } - } - -+/* ======================= SHA ========================== */ -+ -+void test60() -+{ -+ ubyte* p; -+ byte m8; -+ short m16; -+ int m32; -+ M64 m64; -+ M128 m128; -+ static ubyte data[] = -+ [ -+0x0F, 0x3A, 0xCC, 0xD1, 0x01, // sha1rnds4 XMM2, XMM1, 1; -+0x0F, 0x3A, 0xCC, 0x10, 0x01, // sha1rnds4 XMM2, [RAX], 1; -+0x0F, 0x38, 0xC8, 0xD1, // sha1nexte XMM2, XMM1; -+0x0F, 0x38, 0xC8, 0x10, // sha1nexte XMM2, [RAX]; -+0x0F, 0x38, 0xC9, 0xD1, // sha1msg1 XMM2, XMM1; -+0x0F, 0x38, 0xC9, 0x10, // sha1msg1 XMM2, [RAX]; -+0x0F, 0x38, 0xCA, 0xD1, // sha1msg2 XMM2, XMM1; -+0x0F, 0x38, 0xCA, 0x10, // sha1msg2 XMM2, [RAX]; -+0x0F, 0x38, 0xCB, 0xD1, // sha256rnds2 XMM2, XMM1; -+0x0F, 0x38, 0xCB, 0x10, // sha256rnds2 XMM2, [RAX]; -+0x0F, 0x38, 0xCC, 0xD1, // sha256msg1 XMM2, XMM1; -+0x0F, 0x38, 0xCC, 0x10, // sha256msg1 XMM2, [RAX]; -+0x0F, 0x38, 0xCD, 0xD1, // sha256msg2 XMM2, XMM1; -+0x0F, 0x38, 0xCD, 0x10, // sha256msg2 XMM2, [RAX]; -+ ]; -+ -+ asm -+ { -+ call L1; -+ -+ sha1rnds4 XMM2, XMM1, 1; -+ sha1rnds4 XMM2, [EAX], 1; -+ -+ sha1nexte XMM2, XMM1; -+ sha1nexte XMM2, [EAX]; -+ -+ sha1msg1 XMM2, XMM1; -+ sha1msg1 XMM2, [EAX]; -+ -+ sha1msg2 XMM2, XMM1; -+ sha1msg2 XMM2, [EAX]; -+ -+ sha256rnds2 XMM2, XMM1; -+ sha256rnds2 XMM2, [EAX]; -+ -+ sha256msg1 XMM2, XMM1; -+ sha256msg1 XMM2, [EAX]; -+ -+ sha256msg2 XMM2, XMM1; -+ sha256msg2 XMM2, [EAX]; -+ -+L1: pop EAX; -+ mov p[EBP],EAX; -+ } -+ -+ foreach (ref i, b; data) -+ { -+ //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b); -+ assert(p[i] == b); -+ } -+} -+ -+void test9866() -+{ -+ ubyte* p; -+ static ubyte data[] = -+ [ -+ 0x66, 0x0f, 0xbe, 0xc0, // movsx AX, AL; -+ 0x66, 0x0f, 0xbe, 0x00, // movsx AX, byte ptr [EAX]; -+ 0x0f, 0xbe, 0xc0, // movsx EAX, AL; -+ 0x0f, 0xbe, 0x00, // movsx EAX, byte ptr [EAX]; -+ 0x66, 0x0f, 0xbf, 0xc0, // movsx AX, AX; -+ 0x66, 0x0f, 0xbf, 0x00, // movsx AX, word ptr [EAX]; -+ 0x0f, 0xbf, 0xc0, // movsx EAX, AX; -+ 0x0f, 0xbf, 0x00, // movsx EAX, word ptr [EAX]; -+ -+ 0x66, 0x0f, 0xb6, 0xc0, // movzx AX, AL; -+ 0x66, 0x0f, 0xb6, 0x00, // movzx AX, byte ptr [EAX]; -+ 0x0f, 0xb6, 0xc0, // movzx EAX, AL; -+ 0x0f, 0xb6, 0x00, // movzx EAX, byte ptr [EAX]; -+ 0x66, 0x0f, 0xb7, 0xc0, // movzx AX, AX; -+ 0x66, 0x0f, 0xb7, 0x00, // movzx AX, word ptr [EAX]; -+ 0x0f, 0xb7, 0xc0, // movzx EAX, AX; -+ 0x0f, 0xb7, 0x00, // movzx EAX, word ptr [EAX]; -+ ]; -+ -+ asm -+ { -+ call L1; -+ -+ movsx AX, AL; -+ movsx AX, byte ptr [EAX]; -+ movsx EAX, AL; -+ movsx EAX, byte ptr [EAX]; -+ movsx AX, AX; -+ movsx AX, word ptr [EAX]; -+ movsx EAX, AX; -+ movsx EAX, word ptr [EAX]; -+ -+ movzx AX, AL; -+ movzx AX, byte ptr [EAX]; -+ movzx EAX, AL; -+ movzx EAX, byte ptr [EAX]; -+ movzx AX, AX; -+ movzx AX, word ptr [EAX]; -+ movzx EAX, AX; -+ movzx EAX, word ptr [EAX]; -+ -+L1: pop EAX; -+ mov p[EBP],EAX; -+ } -+ -+ foreach (ref i, b; data) -+ { -+ // printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b); -+ assert(p[i] == b); -+ } -+ assert(p[data.length] == 0x58); // pop EAX -+} -+ -+/****************************************************/ -+ -+void test5012() -+{ -+ void bar() {} -+ asm { -+ mov EAX, bar; -+ } -+} -+ - /****************************************************/ - - int main() -@@ -4717,6 +4849,8 @@ int main() - test57(); - test58(); - test59(); -+ test60(); -+ test9866(); - } - printf("Success\n"); - return 0; -@@ -4727,4 +4861,3 @@ else - { - int main() { return 0; } - } -- ---- a/src/gcc/testsuite/gdc.test/runnable/ice10086a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/ice10086a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+// EXTRA_SOURCES: imports/ice10086x.d imports/ice10086y.d -+ -+import imports.ice10086x; -+import imports.ice10086y; -+ -+void main() { test(); } ---- a/src/gcc/testsuite/gdc.test/runnable/ice10086b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/ice10086b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+// EXTRA_SOURCES: imports/ice10086y.d imports/ice10086x.d -+ -+import imports.ice10086y; -+import imports.ice10086x; -+ -+void main() { test(); } ---- a/src/gcc/testsuite/gdc.test/runnable/ice10857.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/ice10857.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,3 @@ -+// EXTRA_SOURCES: imports/ice10857b.d -+ -+import imports.ice10857a; ---- a/src/gcc/testsuite/gdc.test/runnable/ice4481.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/ice4481.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+// EXTRA_SOURCES: imports/ice4481a.d imports/ice4481b.d -+ -+import imports.ice4481a; -+import imports.ice4481b; -+ -+void main() -+{ -+ auto f = new Font(); -+ assert(f.textHeight("str")); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/a9546.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/a9546.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+module imports.a9546; -+ -+struct S -+{ -+ private int privA; -+ protected int protA; -+ package int packA; -+ -+ private void privF() {} -+ protected void protF() {} -+ package void packF() {} -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/bug10425.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/bug10425.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+module imports.bug10425; -+ -+struct A() -+{ -+ int opCmp(const ref A p) const -+ { -+ return 0; -+ } -+ -+ string toString() -+ { -+ return ""; -+ } -+} -+ -+struct B() -+{ -+ void foo() -+ { -+ auto a = new A!(); -+ } -+} -+ -+struct C -+{ -+ alias A!() a_t; -+ -+ this(B!() b) -+ { -+ -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice10086x.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice10086x.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,34 @@ -+module imports.ice10086x; -+ -+import imports.ice10086y; -+ -+struct S1 -+{ -+ int a1 = 123; -+} -+ -+@safe auto f1(S1 r) -+{ -+ return r; -+} -+ -+@safe auto f2a()(S1 r) -+{ -+ return bind!(f1, r); -+} -+ -+@safe auto f2b(S1 r) -+{ -+ return bind!(f1, r); -+} -+ -+void test() -+{ -+ S1 s1; -+ -+ auto za = bind!(f2a, s1)(); -+ assert(za.a1 == 123); -+ -+ auto zb = bind!(f2b, s1)(); -+ assert(zb.a1 == 123); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice10086y.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice10086y.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+module imports.ice10086y; -+ -+auto bind(alias f, bindValues...)() -+{ -+ auto bind(Types...)(Types values) -+ { -+ return f(bindValues, values); -+ } -+ return bind(); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice10857a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice10857a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+module imports.ice10857a; -+ -+template filter(alias pred) -+{ -+ auto filter(Range)(Range rs) -+ { -+ return FilterResult!(pred, Range)(rs); -+ } -+} -+ -+private struct FilterResult(alias pred, R) -+{ -+ R _input; -+ -+ void popFront() -+ { -+ assert(pred(_input[0]) == 123); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice10857b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice10857b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+module imports.ice10857b; -+ -+import imports.ice10857a; -+import imports.ice10857b; -+ -+void foo(int outer) -+{ -+ int[] infos = [1]; -+ auto f1 = filter!(s => outer)(infos); // NG: error is triggered here -+ f1.popFront(); -+ auto f2 = filter!((int s)=>outer)(infos); // OK -+ f2.popFront(); -+} -+void main() { foo(123); } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice4481a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice4481a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+module imports.ice4481a; -+ -+template reduce(alias pred) -+{ -+ auto reduce(R)(R range) -+ { -+ return pred(range[0]); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ice4481b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ice4481b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,14 @@ -+module imports.ice4481b; -+ -+import imports.ice4481a; -+ -+class Font -+{ -+public: -+ int charHeight(dchar c) { return c == 's'; } -+ int textHeight(in string text) -+ { -+ auto maxHeight = (dchar ch) { return charHeight(ch); }; -+ return reduce!(maxHeight)(text); -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/inline2a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/inline2a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,23 +1,23 @@ - /******************************************************************************* - - @file Primes.d -- -+ - Copyright (C) 2004 Kris Bell -- -+ - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for damages - of any kind arising from the use of this software. -- -- Permission is hereby granted to anyone to use this software for any -- purpose, including commercial applications, and to alter it and/or -+ -+ Permission is hereby granted to anyone to use this software for any -+ purpose, including commercial applications, and to alter it and/or - redistribute it freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must -- not claim that you wrote the original software. If you use this -- software in a product, an acknowledgment within documentation of -+ -+ 1. The origin of this software must not be misrepresented; you must -+ not claim that you wrote the original software. If you use this -+ software in a product, an acknowledgment within documentation of - said product would be appreciated but is not required. - -- 2. Altered source versions must be plainly marked as such, and must -+ 2. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 3. This notice may not be removed or altered from any distribution -@@ -26,8 +26,8 @@ - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -- -- @version Initial version, April 2004 -+ -+ @version Initial version, April 2004 - @author Kris - - -@@ -39,7 +39,7 @@ module imports.inline2a; - class Primes - { - private -- static const short primes[] = -+ static const short primes[] = - [ - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, - 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, -@@ -149,14 +149,14 @@ class Primes - - *********************************************************************/ - -- private static int bsearch (in short[] array, short match) -+ private static ptrdiff_t bsearch (in short[] array, short match) - { -- int l, u, m; -- -+ ptrdiff_t l, u, m; -+ - l = -1; -- u = cast(int)array.length; -+ u = array.length; - -- while (l+1 != u) -+ while (l+1 != u) - { - m = (l + u) / 2; - if (array[m] < match) -@@ -173,7 +173,7 @@ class Primes - /********************************************************************** - - return a prime number between 2 and 7919 (inclusive) that -- is equal to or larger than the given 'target' number. -+ is equal to or larger than the given 'target' number. - - **********************************************************************/ - ---- a/src/gcc/testsuite/gdc.test/runnable/imports/link11127a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/link11127a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,21 @@ -+module imports.link11127a; -+ -+struct Cycle(Range) -+{ -+ alias Range R; -+ -+ R _original; -+ size_t _index; -+ -+ this(R input, size_t index = 0) {} -+} -+ -+Cycle!R cycle(R)(R input) -+{ -+ return Cycle!R(input); -+} -+ -+Cycle!R cycle(R)(R input, size_t index = 0) -+{ -+ return Cycle!R(input, index); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/m8668a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/m8668a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module imports.m8668a; -+ -+void split8668(T)(T k) -+ if(is(T : string)) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/m8668b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/m8668b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module imports.m8668b; -+ -+void split8668(T)(T k) -+ if(is(T : int)) -+{ -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/m8668c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/m8668c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+//drop in another one to pull split from m2 -+module imports.m8668c; -+ -+public import imports.m8668b: split8668; ---- a/src/gcc/testsuite/gdc.test/runnable/imports/mangle1.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/mangle1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+//UTF-8 chars -+__gshared pragma(mangle, "test_эльфийские_письмена_9") ubyte test9_1; -+ -+void setTest91() -+{ -+ test9_1 = 42; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ovs1528a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ovs1528a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+module imports.ovs1528a; -+ -+auto func1528() { return 1; } -+auto func1528(T)(T) if (is(T : real)) { return 2; } -+ -+auto bunc1528(T)(T) if (is(T : real)) { return 2; } -+auto bunc1528() { return 1; } -+ -+auto vunc1528(int) { return 1; } -+auto wunc1528(T)(T[]) { return 2; } -+ -+auto opUnary1528(string op : "+")(int) { return 1; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ovs1528b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ovs1528b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,12 @@ -+module imports.ovs1528b; -+ -+auto func1528(string) { return 3; } -+auto func1528(T)(T[]) { return 4; } -+ -+auto bunc1528(T)(T[]) { return 4; } -+auto bunc1528(string) { return 3; } -+ -+auto vunc1528(T)(T[]) { return 2; } -+auto wunc1528(int) { return 1; } -+ -+auto opUnary1528(string op : "-")(int) { return 2; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/std11069array.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/std11069array.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,16 @@ -+module imports.std11069array; -+ -+@property bool empty(T)(in T[] a) @safe pure nothrow -+{ -+ return !a.length; -+} -+ -+void popFront(T)(ref T[] a) @safe pure nothrow -+{ -+ a = a[1 .. $]; -+} -+ -+@property ref T front(T)(T[] a) @safe pure nothrow -+{ -+ return a[0]; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/std11069container.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/std11069container.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+module imports.std11069container; -+ -+import imports.std11069range, imports.std11069typecons; -+ -+struct BinaryHeap(Store) -+if (isInputRange!Store) -+//if (isRandomAccessRange!Store) -+{ -+ // The payload includes the support store and the effective length -+ private RefCounted!(Tuple!(Store)) _payload; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/std11069range.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/std11069range.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+module imports.std11069range; -+ -+public import imports.std11069array; -+ -+template isInputRange(R) -+{ -+ enum bool isInputRange = is(typeof( -+ (inout int = 0) -+ { -+ R r = void; // can define a range object -+ if (r.empty) {} // can test for empty -+ r.popFront(); // can invoke popFront() -+ auto h = r.front; // can get the front of the range -+ })); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/std11069typecons.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/std11069typecons.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,34 @@ -+module imports.std11069typecons; -+ -+import imports.std11069array; -+ -+template Tuple(Specs...) -+{ -+ struct Tuple -+ { -+ Specs expand; -+ -+ string toString() -+ { -+ expand[0].empty; -+ expand[0].front; -+ expand[0].popFront(); -+ -+ return null; -+ } -+ } -+} -+ -+ -+struct RefCounted(T) -+{ -+ T payload; -+ -+ ~this() -+ { -+ //.destroy(_refCounted._store._payload); -+ //auto init = typeid(payload).init(); -+ payload.toString(); // refer Tuple.toString symbol? -+ } -+ -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs1.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,53 @@ -+module imports.template_ovs1; -+ -+/***************************************************/ -+// 1900 - template overload set -+ -+auto foo1900a(int num) { return 1; } -+auto foo1900b(T)(T arg) if (is(T : const(char)[])) { return 2; } -+ -+auto bar1900a(T)(T arg) if (is(T : double)) { return 1; } -+auto bar1900b(T)(T arg) if (is(T : const(char)[])) { return 2; } -+ -+auto baz1900(T)(T arg) if (is(T : double)) { return 1; } -+auto baz1900(T)(T arg) if (is(T : int[int])) { return 2; } -+ -+auto bad1900(string op)() if (op == "++") { return 1; } -+ -+mixin template Mix1900_A() -+{ -+ auto mixfooa() { return 1; } -+ auto mixfoob(T)(T) { return 2; } -+ -+ mixin Mix1900_SubA; -+} -+ -+mixin template Mix1900_SubA() -+{ -+ auto mixsubfooa() { return 1; } -+ auto mixsubfoob(T)(T) { return 2; } -+} -+ -+auto merge1900(T)(int) -+{ -+ return 1; -+} -+ -+/***************************************************/ -+// 1900 -+ -+class AClass1900 {} -+template Traits1900(T : AClass1900) { enum name = "AClass"; } -+ -+ -+void Value1900a() {} -+template Value1900a(T) if (is(T == double)) { enum Value1900a = 1; } -+ -+template Value1900b(T) if (is(T == double)) { enum Value1900b = 1; } -+void Value1900b() {} -+ -+/***************************************************/ -+// 8352 -+ -+Range remove8352a(alias pred, Range)(Range range) { return range; } -+void remove8352b(in char[] name) {} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs2.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,53 @@ -+module imports.template_ovs2; -+ -+/***************************************************/ -+// 1900 - template overload set -+ -+auto foo1900a(T)(T arg) if (is(T : const(char)[])) { return 2; } -+auto foo1900b(int num) { return 1; } -+ -+auto bar1900a(T)(T arg) if (is(T : const(char)[])) { return 2; } -+auto bar1900b(T)(T arg) if (is(T : double)) { return 1; } -+ -+auto baz1900(T)(T arg) if (is(T : Object)) { return 3; } -+auto baz1900(T)(T arg) if (is(T : const(char)[])) { return 4; } -+ -+auto bad1900(string op)() if (op == "++") { return 2; } -+ -+mixin template Mix1900_B() -+{ -+ auto mixfooa(T)(T) { return 2; } -+ auto mixfoob() { return 1; } -+ -+ mixin Mix1900_SubB; -+} -+ -+mixin template Mix1900_SubB() -+{ -+ auto mixsubfooa(T)(T) { return 2; } -+ auto mixsubfoob() { return 1; } -+} -+ -+auto merge1900(T)(string) -+{ -+ return 2; -+} -+ -+/***************************************************/ -+// 1900 -+ -+class BClass1900 {} -+template Traits1900(T : BClass1900) { enum name = "BClass"; } -+string func1900(BClass1900 b) { return "BClass"; } -+ -+void Value1900a() {} -+template Value1900a(T) if (is(T == string)) { enum Value1900a = 2; } -+ -+template Value1900b(T) if (is(T == string)) { enum Value1900b = 2; } -+void Value1900b() {} -+ -+/***************************************************/ -+// 8352 -+ -+void remove8352a(in char[] name) {} -+Range remove8352b(alias pred, Range)(Range range) { return range; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs3.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/template_ovs3.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,36 @@ -+module imports.template_ovs3; -+ -+/***************************************************/ -+// 1900 - template overload set -+ -+import imports.template_ovs1; -+import imports.template_ovs2; -+ -+struct S1900 -+{ -+ alias .foo1900a foo1900a; -+ alias .foo1900b foo1900b; -+ -+ alias .bar1900a bar1900a; -+ alias .bar1900b bar1900b; -+ -+ alias .baz1900 baz1900; -+ -+ alias .bad1900 bad1900; -+ -+ // This is a kind of Issue 1528, cannot make overload contains both templates and functions -+ //void funcF() {} -+ //void funcT(T)(T) {} -+ //alias funcF funca; // make overload with alias declaration -+ //alias funcT funca; -+ //alias funcT funcb; // make overload with alias declaration -+ //alias funcF funcb; -+ -+ mixin Mix1900_A a; -+ mixin Mix1900_B b; -+} -+ -+/***************************************************/ -+// 1900 -+ -+struct Traits1900(T) if (!is(T == class)) { enum name = "any"; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10441b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10441b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,9 @@ -+ -+public import test10441c; -+ -+auto foo()() -+ if (boo(1)) -+{ -+ return 1; -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10441c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10441c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+ -+auto boo(T)(T t) -+{ -+ return 1; -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10573a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10573a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.test10573a; -+ -+abstract class base {} -+class mysql : base {} -+ -+class handler -+{ -+ private mysql[int] mysql_servers; -+ public void foo() -+ { -+ base[int] hServers = cast(base[int])mysql_servers; -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10736a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10736a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+module imports.test10736a; -+ -+version(A) import std.range; -+else import imports.test10736c; ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10736b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10736b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.test10736b; -+ -+version(A) import std.range; -+else import imports.test10736c; -+ -+void main() -+{ -+ int[] arr = [0, 1, 2, 3]; -+ auto x = chunks(arr, 4); // error -+ -+ import core.stdc.stdio; -+ printf("success\n"); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test10736c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test10736c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+module imports.test10736c; -+ -+struct Chunks(Source) -+{ -+ this(Source source, size_t chunkSize) -+ { -+ _source = source; -+ _chunkSize = chunkSize; -+ } -+ -+ typeof(this) opSlice(size_t, size_t) -+ { -+ return chunks(_source, _chunkSize); -+ } -+ -+private: -+ Source _source; -+ size_t _chunkSize; -+} -+ -+Chunks!Source chunks(Source)(Source source, size_t chunkSize) -+{ -+ return typeof(return)(source, chunkSize); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test11039b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test11039b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,7 @@ -+ -+module imports.test11039b; -+ -+import test11039; -+ -+static anotherGlobalField = SomeStruct!string("Hello Again!"); -+ ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test39a.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test39a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -6,7 +6,7 @@ class Test (T) - { - final void show (in T[] msg) - { -- printf ("%.*s\n", msg); -+ printf ("%.*s\n", msg.length, msg.ptr); - } - } - ---- a/src/gcc/testsuite/gdc.test/runnable/imports/test8997a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/test8997a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module imports.test8997a; -+ -+class A -+{ -+ A[string] foobar; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/testkwd_file.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/testkwd_file.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,37 @@ -+module imports.testkwd; -+ -+/****************************************/ -+ -+version(Windows) enum sep = "\\"; else enum sep = "/"; -+ -+enum thatFile = "runnable"~sep~"imports"~sep~"testkwd_file.d"; -+enum thatMod = "imports.testkwd"; -+//enum thatLine; -+enum thatFunc = "imports.testkwd.getCalleeFunc"; -+enum thatFunc2 = `string imports.testkwd.getCalleeFunc2(int x = 1, string s = "hello")`; -+ -+string getCalleeFile() { return __FILE__; } -+ulong getCalleeLine() { return __LINE__; } enum thatLine = 14; -+string getCalleeMod() { return __MODULE__; } -+string getCalleeFunc() { return __FUNCTION__; } -+string getCalleeFunc2(int x = 1, string s = "hello") { return __PRETTY_FUNCTION__; } -+ -+/****************************************/ -+ -+string getFuncArgFile (string name = __FILE__ ) { return name; } -+ulong getFuncArgLine (ulong lnum = __LINE__ ) { return lnum; } -+string getFuncArgMod (string name = __MODULE__ ) { return name; } -+string getFuncArgFunc (string name = __FUNCTION__ ) { return name; } -+string getFuncArgFunc2(string name = __PRETTY_FUNCTION__) { return name; } -+ -+string getFuncTiargFile (string name = __FILE__ )() { return name; } -+ulong getFuncTiargLine (ulong lnum = __LINE__ )() { return lnum; } -+string getFuncTiargMod (string name = __MODULE__ )() { return name; } -+string getFuncTiargFunc (string name = __FUNCTION__ )() { return name; } -+string getFuncTiargFunc2(string name = __PRETTY_FUNCTION__)() { return name; } -+ -+template getInstTiargFile (string name = __FILE__ ) { enum getInstTiargFile = name; } -+template getInstTiargLine (ulong lnum = __LINE__ ) { enum getInstTiargLine = lnum; } -+template getInstTiargMod (string name = __MODULE__ ) { enum getInstTiargMod = name; } -+template getInstTiargFunc (string name = __FUNCTION__ ) { enum getInstTiargFunc = name; } -+template getInstTiargFunc2(string name = __PRETTY_FUNCTION__) { enum getInstTiargFunc2 = name; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/tlsa.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/tlsa.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4,7 +4,7 @@ import std.c.stdio; - - int foo()() - { -- static __thread int z = 7; -+ static int z = 7; - return ++z; - } - -@@ -13,9 +13,9 @@ int foo()() - - int abc4(T)(T t) - { -- static __thread T qqq; // TLS comdef -- static T rrr; // comdef -- static __thread T sss = 8; // TLS comdat -+ static T qqq; // TLS comdef -+ static T rrr; // comdef -+ static T sss = 8; // TLS comdat - static T ttt = 9; // comdat - printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt); - qqq += 2; ---- a/src/gcc/testsuite/gdc.test/runnable/imports/traits_getUnitTests_import.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/traits_getUnitTests_import.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+module imports.traits_getUnitTests_import; -+ -+unittest -+{ -+ assert(1); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.ufcs5a; -+ -+auto f5a1(int) { return 1; } -+auto f5a2(string) { return 2; } -+auto f5a3(double) { return 3; } -+alias f5a4 = f5a1, f5a4 = f5a2; -+alias f5a5 = f5a3, f5a5 = f5a4; -+ -+@property p5a1(int) { return 1; } @property p5a1(int, int) { return 1; } -+@property p5a2(string) { return 2; } @property p5a2(string, int) { return 2; } -+@property p5a3(double) { return 3; } @property p5a3(double, int) { return 3; } -+alias p5a4 = p5a1, p5a4 = p5a2; alias p5a4 = p5a1, p5a4 = p5a2; -+alias p5a5 = p5a3, p5a5 = p5a4; alias p5a5 = p5a3, p5a5 = p5a4; ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5b.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5b.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+module imports.ufcs5b; -+ -+auto f5b1(int) { return 1; } -+auto f5b2(string) { return 2; } -+auto f5b3(double) { return 3; } -+alias f5b4 = f5b1, f5b4 = f5b2; -+alias f5b5 = f5b3, f5b5 = f5b4; -+ -+@property p5b1(int) { return 1; } @property p5b1(int, int) { return 1; } -+@property p5b2(string) { return 2; } @property p5b2(string, int) { return 2; } -+@property p5b3(double) { return 3; } @property p5b3(double, int) { return 3; } -+alias p5b4 = p5b1, p5b4 = p5b2; alias p5b4 = p5b1, p5b4 = p5b2; -+alias p5b5 = p5b3, p5b5 = p5b4; alias p5b5 = p5b3, p5b5 = p5b4; -+ -+/***************************************/ -+ -+auto f5ov(int) { return 1; } -+@property p5ov(int) { return 1; } -+@property p5ov(int, int) { return 1; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5c.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5c.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+module imports.ufcs5c; -+ -+auto f5c1(int) { return 1; } -+auto f5c2(string) { return 2; } -+auto f5c3(double) { return 3; } -+alias f5c4 = f5c1, f5c4 = f5c2; -+alias f5c5 = f5c3, f5c5 = f5c4; -+ -+@property p5c1(int) { return 1; } @property p5c1(int, int) { return 1; } -+@property p5c2(string) { return 2; } @property p5c2(string, int) { return 2; } -+@property p5c3(double) { return 3; } @property p5c3(double, int) { return 3; } -+alias p5c4 = p5c1, p5c4 = p5c2; alias p5c4 = p5c1, p5c4 = p5c2; -+alias p5c5 = p5c3, p5c5 = p5c4; alias p5c5 = p5c3, p5c5 = p5c4; -+ -+/***************************************/ -+ -+auto f5ov(string) { return 2; } -+@property p5ov(string) { return 2; } -+@property p5ov(string, int) { return 2; } ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5d.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5d.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.ufcs5d; -+ -+auto f5d1(int) { return 1; } -+auto f5d2(string) { return 2; } -+auto f5d3(double) { return 3; } -+alias f5d4 = f5d1, f5d4 = f5d2; -+alias f5d5 = f5d3, f5d5 = f5d4; -+ -+@property p5d1(int) { return 1; } @property p5d1(int, int) { return 1; } -+@property p5d2(string) { return 2; } @property p5d2(string, int) { return 2; } -+@property p5d3(double) { return 3; } @property p5d3(double, int) { return 3; } -+alias p5d4 = p5d1, p5d4 = p5d2; alias p5d4 = p5d1, p5d4 = p5d2; -+alias p5d5 = p5d3, p5d5 = p5d4; alias p5d5 = p5d3, p5d5 = p5d4; ---- a/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5e.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/imports/ufcs5e.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+module imports.ufcs5e; -+ -+auto f5e1(int) { return 1; } -+auto f5e2(string) { return 2; } -+auto f5e3(double) { return 3; } -+alias f5e4 = f5e1, f5e4 = f5e2; -+alias f5e5 = f5e3, f5e5 = f5e4; -+ -+@property p5e1(int) { return 1; } @property p5e1(int, int) { return 1; } -+@property p5e2(string) { return 2; } @property p5e2(string, int) { return 2; } -+@property p5e3(double) { return 3; } @property p5e3(double, int) { return 3; } -+alias p5e4 = p5e1, p5e4 = p5e2; alias p5e4 = p5e1, p5e4 = p5e2; -+alias p5e5 = p5e3, p5e5 = p5e4; alias p5e5 = p5e3, p5e5 = p5e4; ---- a/src/gcc/testsuite/gdc.test/runnable/inline.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/inline.d 2014-04-01 16:32:51.000000000 +0100 -@@ -55,8 +55,8 @@ void test2() - - struct Foo3 - { -- int bar() { return y + 3; } -- int y = 4; -+ int bar() { return y + 3; } -+ int y = 4; - } - - void test3() -@@ -108,13 +108,13 @@ struct Struct - { - real foo() - { -- return 0; -+ return 0; - } - - void bar(out Struct Q) - { -- if (foo() < 0) -- Q = this; -+ if (foo() < 0) -+ Q = this; - } - } - -@@ -161,6 +161,92 @@ void test8() { - } - - /************************************/ -+// 4841 -+ -+auto fun4841a() -+{ -+ int i = 42; -+ struct Result -+ { -+ this(int u) {} -+ auto bar() -+ { -+ // refer context of fun4841a -+ return i; -+ } -+ } -+ return Result(); -+} -+void test4841a() -+{ -+ auto t = fun4841a(); -+ auto x = t.bar(); -+ assert(x == 42); -+} -+ -+auto fun4841b() -+{ -+ int i = 40; -+ auto foo() // hasNestedFrameRefs() == false -+ { -+ // -+ struct Result -+ { -+ this(int u) {} -+ auto bar() -+ { -+ // refer context of fun4841b -+ return i + 2; -+ } -+ } -+ return Result(); -+ } -+ return foo(); -+} -+void test4841b() -+{ -+ auto t = fun4841b(); -+ assert(cast(void*)t.tupleof[$-1] !is null); // Result to fun4841b -+ auto x = t.bar(); -+ assert(x == 42); -+} -+ -+auto fun4841c() -+{ -+ int i = 40; -+ auto foo() // hasNestedFrameRefs() == true -+ { -+ int g = 2; -+ struct Result -+ { -+ this(int u) {} -+ auto bar() -+ { -+ // refer context of fun4841c and foo -+ return i + g; -+ } -+ } -+ return Result(); -+ } -+ return foo(); -+} -+void test4841c() -+{ -+ auto t = fun4841c(); -+ assert( cast(void*)t.tupleof[$-1] !is null); // Result to foo -+ assert(*cast(void**)t.tupleof[$-1] !is null); // foo to fun4841c -+ auto x = t.bar(); -+ assert(x == 42); -+} -+ -+void test4841() -+{ -+ test4841a(); -+ test4841b(); -+ test4841c(); -+} -+ -+/************************************/ - // 7261 - - struct AbstractTask -@@ -184,6 +270,28 @@ struct Task - } - - /************************************/ -+// 11223 -+ -+struct Tuple11223(T...) -+{ -+ T values; -+ -+ void opAssign(Tuple11223 rhs) -+ { -+ if (0) -+ values = rhs.values; -+ else -+ assert(1); -+ } -+} -+ -+void test11223() -+{ -+ Tuple11223!string tmp; -+ tmp = Tuple11223!string(); -+} -+ -+/************************************/ - - int main() - { -@@ -195,6 +303,8 @@ int main() - test6(); - test7(); - test8(); -+ test4841(); -+ test11223(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/interface2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/interface2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -962,6 +962,55 @@ interface I7950a {} // ok - interface I7950b : I7950a, TypeTuple7950!() {} // fail - - /*******************************************************/ -+// 10007 -+ -+struct A10007 {} -+ -+interface IFoo10007 -+{ -+ void bar(ref const A10007); -+} -+ -+class Foo10007 : IFoo10007 -+{ -+ void bar(ref const A10007 a) {} -+ void bar( const A10007 a) { return this.bar(a); } -+} -+ -+/*******************************************************/ -+// 10744 -+ -+interface A10744 -+{ -+ int x(); -+ Foo10744 foo(); -+} -+ -+class B10744 : A10744 -+{ -+ int x() { return 0; } -+ Bar10744 foo() { return null; } -+} -+ -+class Foo10744 { } -+class Bar10744 : Foo10744 { } -+ -+interface C10744 -+{ -+ int x(); -+ Baz10744 foo(); -+} -+ -+class D10744 : C10744 -+{ -+ int x() { return 0; } -+ Qux10744 foo() { return null; } -+} -+ -+interface Baz10744 { } -+interface Qux10744 : Baz10744 { } -+ -+/*******************************************************/ - - int main() - { ---- a/src/gcc/testsuite/gdc.test/runnable/interpret2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/interpret2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -17,7 +17,7 @@ int foo1() - { int x; - - foreach (i; 0 .. 10) -- x += i; -+ x += i; - return x; - } - -@@ -25,8 +25,8 @@ int bar1() - { int x; - - foreach_reverse (i; 0 .. 10) -- { x <<= 1; -- x += i; -+ { x <<= 1; -+ x += i; - } - return x; - } -@@ -133,17 +133,6 @@ struct CompileTimeCheck1880(Property1880 - Property1880 junkprop1880; - static assert(!is(CompileTimeCheck1880!(junkprop1880))); - --/***** Bug 5678 *********************************/ -- --struct Bug5678 { -- this(int) {} --} --static assert(!is(typeof( --() { enum Bug5678* f = new Bug5678(0); return f; } --))); -- --/************************************************/ -- - int main() - { - test1(); ---- a/src/gcc/testsuite/gdc.test/runnable/interpret.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/interpret.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2802,7 +2802,330 @@ void test8818() - assert(test()); - } - -+/************************************************/ - -+struct Test104Node -+{ -+ int val; -+ Test104Node* next; -+} -+ -+Test104Node* CreateList(int[] arr) -+{ -+ if(!arr.length) return null; -+ Test104Node* ret = new Test104Node; -+ ret.val = arr[0]; -+ ret.next = CreateList(arr[1..$]); -+ return ret; -+} -+ -+const(Test104Node)* root = CreateList([1, 2, 3, 4, 5]); -+ -+void test104() -+{ -+ assert(root.val == 1); -+ assert(root.next.val == 2); -+ assert(root.next.next.val == 3); -+ assert(root.next.next.next.val == 4); -+ assert(root.next.next.next.next.val == 5); -+} -+ -+/************************************************/ -+ -+interface ITest105a -+{ -+ string test105a() const; -+} -+ -+class Test105a: ITest105a -+{ -+ char a; -+ int b; -+ char c = 'C'; -+ int d = 42; -+ string test105a() const {return "test105a";} -+} -+ -+interface ITest105b -+{ -+ string test105b() const; -+} -+ -+class Test105b: Test105a, ITest105b -+{ -+ char e; -+ int f; -+ this(char _e, int _f, char _a, int _b) pure -+ { -+ e = _e; -+ f = _f; -+ a = _a; -+ b = _b; -+ } -+ string test105b() const {return "test105b";} -+} -+ -+const Test105b t105b = new Test105b('E', 88, 'A', 99); -+const Test105a t105a = new Test105b('E', 88, 'A', 99); -+const ITest105b t105ib = new Test105b('E', 88, 'A', 99); -+const ITest105a t105ia = new Test105b('E', 88, 'A', 99); -+__gshared Test105b t105gs = new Test105b('E', 88, 'A', 99); -+shared Test105b t105bs = new shared(Test105b)('E', 88, 'A', 99); -+immutable Test105b t105bi = new immutable(Test105b)('E', 88, 'A', 99); -+void test105() -+{ -+ assert(t105b.a == 'A'); -+ assert(t105b.b == 99); -+ assert(t105b.c == 'C'); -+ assert(t105b.d == 42); -+ assert(t105b.e == 'E'); -+ assert(t105b.f == 88); -+ assert(t105b.test105a() == "test105a"); -+ assert(t105b.test105b() == "test105b"); -+ -+ assert(t105a.a == 'A'); -+ assert(t105a.b == 99); -+ assert(t105a.c == 'C'); -+ assert(t105a.d == 42); -+ assert(t105a.test105a() == "test105a"); -+ -+ assert(t105ia.test105a() == "test105a"); -+ assert(t105ib.test105b() == "test105b"); -+ -+ assert(t105a.classinfo is Test105b.classinfo); -+ //t105b.d = -1; -+ //assert(t105b.d == -1); -+ //assert(t105a.d == 42); -+ -+ assert(t105gs.a == 'A'); -+ assert(t105gs.b == 99); -+ assert(t105gs.c == 'C'); -+ assert(t105gs.d == 42); -+ assert(t105gs.e == 'E'); -+ assert(t105gs.f == 88); -+ assert(t105gs.test105a() == "test105a"); -+ assert(t105gs.test105b() == "test105b"); -+ -+ assert(t105bs.a == 'A'); -+ assert(t105bs.b == 99); -+ assert(t105bs.c == 'C'); -+ assert(t105bs.d == 42); -+ assert(t105bs.e == 'E'); -+ assert(t105bs.f == 88); -+ -+ assert(t105bi.a == 'A'); -+ assert(t105bi.b == 99); -+ assert(t105bi.c == 'C'); -+ assert(t105bi.d == 42); -+ assert(t105bi.e == 'E'); -+ assert(t105bi.f == 88); -+ assert(t105bi.test105a() == "test105a"); -+ assert(t105bi.test105b() == "test105b"); -+ -+} -+ -+int bug9938() -+{ -+ assert(t105ia.test105a() == "test105a"); -+ return 1; -+} -+ -+static assert(t105ia.test105a() == "test105a"); -+static assert(bug9938()); -+ -+ -+/************************************************/ -+ -+struct Test106 -+{ -+ Test106* f; -+ Test106* s; -+} -+ -+Test106* ctfe106() -+{ -+ auto s = new Test106; -+ auto s2 = new Test106; -+ s.f = s2; -+ s.s = s2; -+ assert(s.f is s.s); -+ return s; -+} -+ -+const(Test106)* t106 = ctfe106(); -+ -+void test106() -+{ -+ assert(t106.f is t106.s); -+} -+ -+/************************************************/ -+ -+class Test107 -+{ -+ Test107 a; -+ Test107 b; -+ -+ this() -+ { -+ } -+ -+ this(int) -+ { -+ a = new Test107(); -+ b = a; -+ assert(a is b); -+ } -+} -+ -+const Test107 t107 = new Test107(1); -+ -+void test107() -+{ -+ assert(t107.a is t107.b); -+} -+ -+/************************************************/ -+ -+/* -+interface Getter -+{ -+ int getNum() const; -+} -+ -+class Test108:Getter -+{ -+ int f; -+ this(int v) inout -+ { -+ f = v; -+ } -+ -+ int getNum() const -+ { -+ return f; -+ } -+} -+ -+enum const(Test108) t108 = new Test108(38); -+ -+void test108() -+{ -+ const Test108 obj = t108; -+ assert(obj.classinfo is Test108.classinfo); -+ assert(obj.f == 38); -+ -+ const Getter iobj = t108; -+ assert(iobj.getNum() == 38); -+ assert((cast(Object)iobj).classinfo is Test108.classinfo); -+ assert(t108 is t108); -+} -+*/ -+ -+/***** Bug 5678 *********************************/ -+ -+/* -+struct Bug5678 -+{ -+ this(int) {} -+} -+ -+enum const(Bug5678)* b5678 = new const(Bug5678)(0); -+ -+void test5678() -+{ -+ assert(b5678 is b5678); -+}*/ -+ -+/************************************************/ -+ -+class Test109C { this(){ this.c = this; } Test109C c; } -+const t109c = new Test109C(); -+ -+struct Test109S { this(int){ this.s = &this; } Test109S* s; } -+const t109s = new Test109S(0); -+pragma(msg, t109s); // Make sure there is no infinite recursion. -+ -+void test109() -+{ -+ assert(t109c.c is t109c); -+ assert(t109s.s is t109s); -+} -+ -+/************************************************/ -+ -+struct Test110f { int f1; Test110s f2;} -+struct Test110s { this(int, int, int){} } -+auto test110 = [Test110f(1, Test110s(1, 2, 3))]; -+ -+/************************************************/ -+ -+interface IBug9954 -+{ -+ string foo() const; -+} -+ -+class Bug9954: IBug9954 -+{ -+ string foo() const {return "hello";} -+} -+ -+IBug9954 makeIBug9954() -+{ -+ return new Bug9954; -+} -+ -+const IBug9954 b9954 = makeIBug9954(); -+ -+void test9954() -+{ -+ assert(b9954.foo() == "hello"); -+} -+ -+/************************************************/ -+struct S10669 { uint x; } -+ -+static const S10669 iid0_10669 = S10669(0); -+ -+class C10669 -+{ -+ static const S10669 iid1_10669 = S10669(1); -+}; -+ -+const S10669 IID0_10669 = iid0_10669; -+const S10669 IID1_10669 = C10669.iid1_10669; -+ -+/************************************************/ -+ -+TypeInfo getTi() -+{ -+ return typeid(int); -+} -+ -+auto t112 = getTi(); -+ -+void test112() -+{ -+ assert(t112.toString() == "int"); -+} -+ -+/************************************************/ -+// 10687 -+ -+enum Foo10687 : uint { A, B, C, D, E } -+immutable uint[5][] m10687 = [[0, 1, 2, 3, 4]]; -+ -+void test10687() -+{ -+ static immutable uint[5] a1 = [0, 1, 2, 3, 4]; -+ auto a2 = cast(immutable(Foo10687[5]))a1; -+ static a3 = cast(immutable(Foo10687[5]))a1; -+ -+ auto foos1 = cast(immutable(Foo10687[5][]))m10687; -+ static foos2 = cast(immutable(Foo10687[5][]))m10687; -+} -+ -+/************************************************/ - int main() - { - test1(); -@@ -2908,9 +3231,16 @@ int main() - test101(); - test102(); - test103(); -+ test104(); -+ test105(); -+ test106(); -+ test107(); -+ //test108(); -+ test109(); -+ test112(); - test6504(); - test8818(); -- -+ test9954(); - writefln("Success"); - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/link10425.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/link10425.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,22 @@ -+// COMPILE_SEPARATELY -+// EXTRA_SOURCES: imports/bug10425.d -+ -+import imports.bug10425; -+ -+void main() -+{ -+ auto ti = typeid(A!()); -+ /* Today, taking TypeInfo object address by using `typeid` always generates -+ * the TypeInfo object on comdat section (done by TypeInfoDeclaration::toObjFile), -+ * even if the associated struct belongs *non-root modules*. -+ * -+ * And, from 2.062, issue 7511 is implemented. -+ * The attribute inference for member functions in instantiated struct may modify -+ * their actual mangled names. Then TypeInfo object compiled in this module would -+ * use wrong symbol names, to link non-template opEquals/opCmp/toHash/toString -+ * member functions. -+ * -+ * To fix the issue, we should run semantic3 to calculate the correct symbol names -+ * of the specific member functions. -+ */ -+} ---- a/src/gcc/testsuite/gdc.test/runnable/link11069a.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/link11069a.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,13 @@ -+// REQUIRED_ARGS: -noboundscheck -+// <-- To remove necessity of _D7imports13std11069array7__arrayZ -+ -+class Bar -+{ -+ import imports.std11069container; -+ -+ BinaryHeap!(Foo[]) Heap; -+ -+ struct Foo {} -+} -+ -+void main() {} ---- a/src/gcc/testsuite/gdc.test/runnable/link11127.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/link11127.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,6 @@ -+import imports.link11127a; -+ -+void main() -+{ -+ cycle([1, 2]); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/mangle.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/mangle.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,57 @@ -+// PERMUTE_ARGS: -+// EXTRA_SOURCES: imports/mangle1.d -+ -+import mangle1; -+ -+pragma(mangle, "_test1_") int test1; -+ -+static assert(test1.mangleof == "_test1_"); -+ -+__gshared pragma(mangle, "_test2_") ubyte test2; -+ -+static assert(test2.mangleof == "_test2_"); -+ -+pragma(mangle, "_test3_") void test3() -+{ -+} -+ -+static assert(test3.mangleof == "_test3_"); -+ -+pragma(mangle, "_test6_") __gshared char test6; -+ -+static assert(test6.mangleof == "_test6_"); -+ -+pragma(mangle, "_test7_") @system -+{ -+ void test7() -+ { -+ } -+} -+ -+static assert(test7.mangleof == "_test7_"); -+ -+template getModuleInfo(alias mod) -+{ -+ pragma(mangle, "_D"~mod.mangleof~"12__ModuleInfoZ") static __gshared extern ModuleInfo mi; -+ enum getModuleInfo = &mi; -+} -+ -+void test8() -+{ -+ assert(getModuleInfo!(object).name == "object"); -+} -+ -+//UTF-8 chars -+__gshared extern pragma(mangle, "test_эльфийские_письмена_9") ubyte test9_1_e; -+ -+void test9() -+{ -+ setTest91(); -+ assert(test9_1_e == 42); -+} -+ -+void main() -+{ -+ test8(); -+ test9(); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/mars1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/mars1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -259,7 +259,752 @@ void testulldiv() - } - } - --/////////////////////// -+//////////////////////////////////////////////////////////////////////// -+ -+ -+uint udiv10(uint x) -+{ -+ return x / 10; -+} -+ -+uint udiv14(uint x) -+{ -+ return x / 14; -+} -+ -+uint udiv14007(uint x) -+{ -+ return x / 14007; -+} -+ -+uint umod10(uint x) -+{ -+ return x % 10; -+} -+ -+uint umod14(uint x) -+{ -+ return x % 14; -+} -+ -+uint umod14007(uint x) -+{ -+ return x % 14007; -+} -+ -+uint uremquo10(uint x) -+{ -+ return (x / 10) | (x % 10); -+} -+ -+uint uremquo14(uint x) -+{ -+ return (x / 14) | (x % 14); -+} -+ -+uint uremquo14007(uint x) -+{ -+ return (x / 14007) | (x % 14007); -+} -+ -+ -+ -+ulong uldiv10(ulong x) -+{ -+ return x / 10; -+} -+ -+ulong uldiv14(ulong x) -+{ -+ return x / 14; -+} -+ -+ulong uldiv14007(ulong x) -+{ -+ return x / 14007; -+} -+ -+ulong ulmod10(ulong x) -+{ -+ return x % 10; -+} -+ -+ulong ulmod14(ulong x) -+{ -+ return x % 14; -+} -+ -+ulong ulmod14007(ulong x) -+{ -+ return x % 14007; -+} -+ -+ulong ulremquo10(ulong x) -+{ -+ return (x / 10) | (x % 10); -+} -+ -+ulong ulremquo14(ulong x) -+{ -+ return (x / 14) | (x % 14); -+} -+ -+ulong ulremquo14007(ulong x) -+{ -+ return (x / 14007) | (x % 14007); -+} -+ -+ -+void testfastudiv() -+{ -+ { -+ static uint x10 = 10; -+ static uint x14 = 14; -+ static uint x14007 = 14007; -+ -+ uint u = 10000; -+ uint r; -+ r = udiv10(u); assert(r == u/x10); -+ r = udiv14(u); assert(r == u/x14); -+ r = udiv14007(u); assert(r == u/x14007); -+ r = umod10(u); assert(r == u%x10); -+ r = umod14(u); assert(r == u%x14); -+ r = umod14007(u); assert(r == u%x14007); -+ r = uremquo10(u); assert(r == ((u/10)|(u%x10))); -+ r = uremquo14(u); assert(r == ((u/14)|(u%x14))); -+ r = uremquo14007(u); assert(r == ((u/14007)|(u%x14007))); -+ } -+ { -+ static ulong y10 = 10; -+ static ulong y14 = 14; -+ static ulong y14007 = 14007; -+ -+ ulong u = 10000; -+ ulong r; -+ r = uldiv10(u); assert(r == u/y10); -+ r = uldiv14(u); assert(r == u/y14); -+ r = uldiv14007(u); assert(r == u/y14007); -+ r = ulmod10(u); assert(r == u%y10); -+ r = ulmod14(u); assert(r == u%y14); -+ r = ulmod14007(u); assert(r == u%y14007); -+ r = ulremquo10(u); assert(r == ((u/10)|(u%y10))); -+ r = ulremquo14(u); assert(r == ((u/14)|(u%y14))); -+ r = ulremquo14007(u); assert(r == ((u/14007)|(u%y14007))); -+ } -+} -+ -+ -+//////////////////////////////////////////////////////////////////////// -+ -+ -+int div10(int x) -+{ -+ return x / 10; -+} -+ -+int div14(int x) -+{ -+ return x / 14; -+} -+ -+int div14007(int x) -+{ -+ return x / 14007; -+} -+ -+int mod10(int x) -+{ -+ return x % 10; -+} -+ -+int mod14(int x) -+{ -+ return x % 14; -+} -+ -+int mod14007(int x) -+{ -+ return x % 14007; -+} -+ -+int remquo10(int x) -+{ -+ return (x / 10) | (x % 10); -+} -+ -+int remquo14(int x) -+{ -+ return (x / 14) | (x % 14); -+} -+ -+int remquo14007(int x) -+{ -+ return (x / 14007) | (x % 14007); -+} -+ -+//////////////////// -+ -+int mdiv10(int x) -+{ -+ return x / -10; -+} -+ -+int mdiv14(int x) -+{ -+ return x / -14; -+} -+ -+int mdiv14007(int x) -+{ -+ return x / -14007; -+} -+ -+int mmod10(int x) -+{ -+ return x % -10; -+} -+ -+int mmod14(int x) -+{ -+ return x % -14; -+} -+ -+int mmod14007(int x) -+{ -+ return x % -14007; -+} -+ -+int mremquo10(int x) -+{ -+ return (x / -10) | (x % -10); -+} -+ -+int mremquo14(int x) -+{ -+ return (x / -14) | (x % -14); -+} -+ -+int mremquo14007(int x) -+{ -+ return (x / -14007) | (x % -14007); -+} -+ -+//////////////////// -+ -+ -+long ldiv10(long x) -+{ -+ return x / 10; -+} -+ -+long ldiv14(long x) -+{ -+ return x / 14; -+} -+ -+long ldiv14007(long x) -+{ -+ return x / 14007; -+} -+ -+long lmod10(long x) -+{ -+ return x % 10; -+} -+ -+long lmod14(long x) -+{ -+ return x % 14; -+} -+ -+long lmod14007(long x) -+{ -+ return x % 14007; -+} -+ -+long lremquo10(long x) -+{ -+ return (x / 10) | (x % 10); -+} -+ -+long lremquo14(long x) -+{ -+ return (x / 14) | (x % 14); -+} -+ -+long lremquo14007(long x) -+{ -+ return (x / 14007) | (x % 14007); -+} -+ -+ -+//////////////////// -+ -+ -+long mldiv10(long x) -+{ -+ return x / -10; -+} -+ -+long mldiv14(long x) -+{ -+ return x / -14; -+} -+ -+long mldiv14007(long x) -+{ -+ return x / -14007; -+} -+ -+long mlmod10(long x) -+{ -+ return x % -10; -+} -+ -+long mlmod14(long x) -+{ -+ return x % -14; -+} -+ -+long mlmod14007(long x) -+{ -+ return x % -14007; -+} -+ -+long mlremquo10(long x) -+{ -+ return (x / -10) | (x % -10); -+} -+ -+long mlremquo14(long x) -+{ -+ return (x / -14) | (x % -14); -+} -+ -+long mlremquo14007(long x) -+{ -+ return (x / -14007) | (x % -14007); -+} -+ -+ -+ -+void testfastdiv() -+{ -+ { -+ static int x10 = 10; -+ static int x14 = 14; -+ static int x14007 = 14007; -+ -+ int u = 10000; -+ int r; -+ r = div10(u); assert(r == u/x10); -+ r = div14(u); assert(r == u/x14); -+ r = div14007(u); assert(r == u/x14007); -+ r = mod10(u); assert(r == u%x10); -+ r = mod14(u); assert(r == u%x14); -+ r = mod14007(u); assert(r == u%x14007); -+ r = remquo10(u); assert(r == ((u/x10)|(u%x10))); -+ r = remquo14(u); assert(r == ((u/x14)|(u%x14))); -+ r = remquo14007(u); assert(r == ((u/x14007)|(u%x14007))); -+ } -+ { -+ static int t10 = -10; -+ static int t14 = -14; -+ static int t14007 = -14007; -+ -+ int u = 10000; -+ int r; -+ r = mdiv10(u); assert(r == u/t10); -+ r = mdiv14(u); assert(r == u/t14); -+ r = mdiv14007(u); assert(r == u/t14007); -+ r = mmod10(u); assert(r == u%t10); -+ r = mmod14(u); assert(r == u%t14); -+ r = mmod14007(u); assert(r == u%t14007); -+ r = mremquo10(u); assert(r == ((u/t10)|(u%t10))); -+ r = mremquo14(u); assert(r == ((u/t14)|(u%t14))); -+ r = mremquo14007(u); assert(r == ((u/t14007)|(u%t14007))); -+ } -+ { -+ static long y10 = 10; -+ static long y14 = 14; -+ static long y14007 = 14007; -+ -+ long u = 10000; -+ long r; -+ r = ldiv10(u); assert(r == u/y10); -+ r = ldiv14(u); assert(r == u/y14); -+ r = ldiv14007(u); assert(r == u/y14007); -+ r = lmod10(u); assert(r == u%y10); -+ r = lmod14(u); assert(r == u%y14); -+ r = lmod14007(u); assert(r == u%y14007); -+ r = lremquo10(u); assert(r == ((u/y10)|(u%y10))); -+ r = lremquo14(u); assert(r == ((u/y14)|(u%y14))); -+ r = lremquo14007(u); assert(r == ((u/y14007)|(u%y14007))); -+ } -+ { -+ static long z10 = -10; -+ static long z14 = -14; -+ static long z14007 = -14007; -+ -+ long u = 10000; -+ long r; -+ r = mldiv10(u); assert(r == u/z10); -+ r = mldiv14(u); assert(r == u/z14); -+ r = mldiv14007(u); assert(r == u/z14007); -+ r = mlmod10(u); assert(r == u%z10); -+ r = mlmod14(u); assert(r == u%z14); -+ r = mlmod14007(u); assert(r == u%z14007); -+ r = mlremquo10(u); assert(r == ((u/z10)|(u%z10))); -+ r = mlremquo14(u); assert(r == ((u/z14)|(u%z14))); -+ r = mlremquo14007(u); assert(r == ((u/z14007)|(u%z14007))); -+ } -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+ -+T docond1(T)(T l, ubyte thresh, ubyte val) { -+ l += (thresh < val); -+ return l; -+} -+ -+T docond2(T)(T l, ubyte thresh, ubyte val) { -+ l -= (thresh >= val); -+ return l; -+} -+ -+T docond3(T)(T l, ubyte thresh, ubyte val) { -+ l += (thresh >= val); -+ return l; -+} -+ -+T docond4(T)(T l, ubyte thresh, ubyte val) { -+ l -= (thresh < val); -+ return l; -+} -+ -+void testdocond() -+{ -+ assert(docond1!ubyte(10,3,5) == 11); -+ assert(docond1!ushort(10,3,5) == 11); -+ assert(docond1!uint(10,3,5) == 11); -+ assert(docond1!ulong(10,3,5) == 11); -+ -+ assert(docond2!ubyte(10,3,5) == 10); -+ assert(docond2!ushort(10,3,5) == 10); -+ assert(docond2!uint(10,3,5) == 10); -+ assert(docond2!ulong(10,3,5) == 10); -+ -+ assert(docond3!ubyte(10,3,5) == 10); -+ assert(docond3!ushort(10,3,5) == 10); -+ assert(docond3!uint(10,3,5) == 10); -+ assert(docond3!ulong(10,3,5) == 10); -+ -+ assert(docond4!ubyte(10,3,5) == 9); -+ assert(docond4!ushort(10,3,5) == 9); -+ assert(docond4!uint(10,3,5) == 9); -+ assert(docond4!ulong(10,3,5) == 9); -+ -+ -+ assert(docond1!ubyte(10,5,3) == 10); -+ assert(docond1!ushort(10,5,3) == 10); -+ assert(docond1!uint(10,5,3) == 10); -+ assert(docond1!ulong(10,5,3) == 10); -+ -+ assert(docond2!ubyte(10,5,3) == 9); -+ assert(docond2!ushort(10,5,3) == 9); -+ assert(docond2!uint(10,5,3) == 9); -+ assert(docond2!ulong(10,5,3) == 9); -+ -+ assert(docond3!ubyte(10,5,3) == 11); -+ assert(docond3!ushort(10,5,3) == 11); -+ assert(docond3!uint(10,5,3) == 11); -+ assert(docond3!ulong(10,5,3) == 11); -+ -+ assert(docond4!ubyte(10,5,3) == 10); -+ assert(docond4!ushort(10,5,3) == 10); -+ assert(docond4!uint(10,5,3) == 10); -+ assert(docond4!ulong(10,5,3) == 10); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+uint neg(uint i) -+{ -+ return ~i + 1; -+} -+ -+uint com(uint i) -+{ -+ return -i - 1; -+} -+ -+float com(float i) -+{ -+ return -i - 1; -+} -+ -+uint com2(uint i) -+{ -+ return -(i + 1); -+} -+ -+void testnegcom() -+{ -+ assert(neg(3) == -3); -+ assert(com(3) == -4); -+ assert(com(3.0f) == -4.0f); -+ assert(com2(3) == -4); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+int oror1(char c) -+{ -+ return ((((((((((cast(int) c <= 32 || cast(int) c == 46) || cast(int) c == 44) -+ || cast(int) c == 58) || cast(int) c == 59) || cast(int) c == 60) -+ || cast(int) c == 62) || cast(int) c == 34) || cast(int) c == 92) -+ || cast(int) c == 39) != 0); -+} -+ -+int oror2(char c) -+{ -+ return ((((((((((c <= 32 || c == 46) || c == 44) -+ || c == 58) || c == 59) || c == 60) -+ || c == 62) || c == 34) || c == 92) -+ || c == 39) != 0); -+} -+ -+void testoror() -+{ -+ assert(oror1(0) == 1); -+ assert(oror1(32) == 1); -+ assert(oror1(46) == 1); -+ assert(oror1(44) == 1); -+ assert(oror1(58) == 1); -+ assert(oror1(59) == 1); -+ assert(oror1(60) == 1); -+ assert(oror1(62) == 1); -+ assert(oror1(34) == 1); -+ assert(oror1(92) == 1); -+ assert(oror1(39) == 1); -+ assert(oror1(33) == 0); -+ assert(oror1(61) == 0); -+ assert(oror1(93) == 0); -+ assert(oror1(255) == 0); -+ -+ assert(oror2(0) == 1); -+ assert(oror2(32) == 1); -+ assert(oror2(46) == 1); -+ assert(oror2(44) == 1); -+ assert(oror2(58) == 1); -+ assert(oror2(59) == 1); -+ assert(oror2(60) == 1); -+ assert(oror2(62) == 1); -+ assert(oror2(34) == 1); -+ assert(oror2(92) == 1); -+ assert(oror2(39) == 1); -+ assert(oror2(33) == 0); -+ assert(oror2(61) == 0); -+ assert(oror2(93) == 0); -+ assert(oror2(255) == 0); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+bool bt1(int p, int a, int b) -+{ -+ return p && ((1 << b) & a); -+} -+ -+bool bt2(int p, long a, long b) -+{ -+ return p && ((1L << b) & a); -+} -+ -+void testbt() -+{ -+ assert(bt1(1,7,2) == 1); -+ assert(bt1(1,7,3) == 0); -+ -+ assert(bt2(1,0x7_0000_0000,2+32) == 1); -+ assert(bt2(1,0x7_0000_0000,3+32) == 0); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+int andand1(int c) -+{ -+ return (c > 32 && c != 46 && c != 44 -+ && c != 58 && c != 59 -+ && c != 60 && c != 62 -+ && c != 34 && c != 92 -+ && c != 39) != 0; -+} -+ -+bool andand2(long c) -+{ -+ return (c > 32 && c != 46 && c != 44 -+ && c != 58 && c != 59 -+ && c != 60 && c != 62 -+ && c != 34 && c != 92 -+ && c != 39) != 0; -+} -+ -+int foox3() { return 1; } -+ -+int andand3(uint op) -+{ -+ if (foox3() && -+ op != 7 && -+ op != 3 && -+ op != 18 && -+ op != 30 && -+ foox3()) -+ return 3; -+ return 4; -+} -+ -+ -+void testandand() -+{ -+ assert(andand1(0) == 0); -+ assert(andand1(32) == 0); -+ assert(andand1(46) == 0); -+ assert(andand1(44) == 0); -+ assert(andand1(58) == 0); -+ assert(andand1(59) == 0); -+ assert(andand1(60) == 0); -+ assert(andand1(62) == 0); -+ assert(andand1(34) == 0); -+ assert(andand1(92) == 0); -+ assert(andand1(39) == 0); -+ assert(andand1(33) == 1); -+ assert(andand1(61) == 1); -+ assert(andand1(93) == 1); -+ assert(andand1(255) == 1); -+ -+ assert(andand2(0) == false); -+ assert(andand2(32) == false); -+ assert(andand2(46) == false); -+ assert(andand2(44) == false); -+ assert(andand2(58) == false); -+ assert(andand2(59) == false); -+ assert(andand2(60) == false); -+ assert(andand2(62) == false); -+ assert(andand2(34) == false); -+ assert(andand2(92) == false); -+ assert(andand2(39) == false); -+ assert(andand2(33) == true); -+ assert(andand2(61) == true); -+ assert(andand2(93) == true); -+ assert(andand2(255) == true); -+ -+ assert(andand3(6) == 3); -+ assert(andand3(30) == 4); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+uint or1(ubyte x) -+{ -+ return x | (x<<8) | (x<<16) | (x<<24) | (x * 3); -+} -+ -+void testor_combine() -+{ -+ printf("%x\n", or1(1)); -+ assert(or1(5) == 5 * (0x1010101 | 3)); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+ -+int shrshl(int i) { -+ return ((i+1)>>1)<<1; -+} -+ -+void testshrshl() -+{ -+ assert(shrshl(6) == 6); -+ assert(shrshl(7) == 8); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+struct S1 -+{ -+ cdouble val; -+} -+ -+void formatTest(S1 s, double re, double im) -+{ -+ assert(s.val.re == re); -+ assert(s.val.im == im); -+} -+ -+void test10639() -+{ -+ S1 s = S1(3+2.25i); -+ formatTest(s, 3, 2.25); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+bool bt10715(in uint[] ary, size_t bitnum) -+{ -+ return !!(ary[bitnum >> 5] & 1 << (bitnum & 31)); // uses bt -+} -+ -+bool neg_bt10715(in uint[] ary, size_t bitnum) -+{ -+ return !(ary[bitnum >> 5] & 1 << (bitnum & 31)); // does not use bt -+} -+ -+void test10715() -+{ -+ static uint[2] a1 = [0x1001_1100, 0x0220_0012]; -+ -+ if ( bt10715(a1,30)) assert(0); -+ if (!bt10715(a1,8)) assert(0); -+ if ( bt10715(a1,30+32)) assert(0); -+ if (!bt10715(a1,1+32)) assert(0); -+ -+ if (!neg_bt10715(a1,30)) assert(0); -+ if ( neg_bt10715(a1,8)) assert(0); -+ if (!neg_bt10715(a1,30+32)) assert(0); -+ if ( neg_bt10715(a1,1+32)) assert(0); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+int foo10678(char[5] txt) -+{ -+ return txt[0] + txt[1] + txt[4]; -+} -+ -+void test10678() -+{ -+ char[5] hello = void; -+ hello[0] = 8; -+ hello[1] = 9; -+ hello[4] = 10; -+ int i = foo10678(hello); -+ assert(i == 27); -+} -+ -+//////////////////////////////////////////////////////////////////////// -+ -+void bug7565( double x) { assert(x == 3); } -+ -+void test7565() -+{ -+ double y = 3; -+ bug7565( y++ ); -+ assert(y == 4); -+} -+ -+//////////////////////////////////////////////////////////////////////// - - int main() - { -@@ -273,6 +1018,19 @@ int main() - testarrayinit(); - testU(); - testulldiv(); -+ testfastudiv(); -+ testfastdiv(); -+ testdocond(); -+ testnegcom(); -+ testoror(); -+ testbt(); -+ testandand(); -+ testor_combine(); -+ testshrshl(); -+ test10639(); -+ test10715(); -+ test10678(); -+ test7565(); - printf("Success\n"); - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/mixin1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/mixin1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1155,6 +1155,22 @@ class B8032b : A8032b - override void f() { } - } - -+/*********************************************/ -+// 9417 -+ -+mixin template Foo9417() -+{ -+ void foo() {} -+} -+ -+void test9417() -+{ -+ struct B -+ { -+ mixin Foo9417; -+ } -+} -+ - /*******************************************/ - - int main() -@@ -1203,6 +1219,7 @@ int main() - test2245(); - test2740(); - test42(); -+ test9417(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/mixin2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/mixin2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -180,6 +180,122 @@ class Derived7560 : Base7560 - } - - /*********************************************/ -+// 10577 -+ -+enum sync10577; -+ -+public template get_sync10577(size_t I, A...) -+{ -+ static if (I == A.length) enum bool get_sync10577 = false; -+ else static if (is(A[I] == sync10577)) enum bool get_sync10577 = true; -+ else enum bool get_sync10577 = get_sync!10577(I+1, A); -+} -+ -+template add_sync10577(T, size_t ITER=0) -+{ -+ static if (ITER == (__traits(derivedMembers, T).length)) -+ { -+ enum string add_sync10577 = ""; -+ } -+ else -+ { -+ enum string mem = __traits(derivedMembers, T)[ITER]; -+ enum string add_sync10577 = -+ "static if (! __traits(isVirtualMethod, " ~ mem ~ ")) {" ~ -+ "mixin(add_sync10577!(get_sync10577!(0, __traits(getAttributes, " -+ ~ mem ~ ")), \"" ~ mem ~ "\"));} " ~ add_sync10577!(T, ITER+1); -+ } -+} -+ -+template add_sync10577(bool A, string M) -+{ -+ static if (A) -+ { -+ enum string add_sync10577 = " auto " ~ M[1..$] ~ -+ "() { synchronized(this) return " ~ M ~ "; }"; -+ } -+ else -+ { -+ enum string add_sync10577 = ""; -+ } -+} -+ -+class base10577 -+{ -+ public void foo() {} -+} -+ -+class derived10577 : base10577 -+{ -+ mixin(add_sync10577!(derived10577)); -+ @sync10577 private bool _bar; -+ -+ public override void foo() {} -+} -+ -+/*********************************************/ -+// 10583 -+ -+enum sync10583; -+ -+public template get_sync10583(size_t I, A...) -+{ -+ static if (I == A.length) -+ enum bool get_sync10583 = false; -+ else static if (is(A[I] == sync10583)) -+ enum bool get_sync10583 = true; -+ else -+ enum bool get_sync10583 = get_sync10583!(I+1, A); -+} -+ -+template add_sync10583(T, size_t ITER = 0) -+{ -+ static if (ITER == (__traits(derivedMembers, T).length)) -+ { -+ enum string add_sync10583 = ""; -+ } -+ else -+ { -+ enum string mem = __traits(derivedMembers, T)[ITER]; -+ enum string add_sync10583 = -+ "mixin(add_sync10583!(get_sync10583!(0, __traits(getAttributes, " -+ ~ mem ~ ")), __traits(getProtection, " -+ ~ mem ~ "), \"" ~ mem ~ "\"));\n" ~ add_sync10583!(T, ITER+1); -+ } -+} -+ -+template add_sync10583(bool A, string P, string M) -+{ -+ static if (A) -+ { -+ enum string add_sync10583 = " auto " ~ M[1..$] ~ -+ "() { synchronized(this) return " ~ M ~ "; }"; -+ } -+ else -+ enum string add_sync10583 = ""; -+} -+ -+class derived10583 -+{ -+ mixin(add_sync10583!(derived10583)); -+ @sync10583 private bool _bar; -+ void frop() {} -+} -+ -+/*********************************************/ -+ -+string rep(string s, int n) -+{ -+ return n > 1 ? s ~ rep(s, n-1) : s; -+} -+ -+void test7156() -+{ -+ int i; -+ mixin(rep("++i;", 200)); -+} -+ -+/*********************************************/ - - void main() - { -@@ -193,6 +309,7 @@ void main() - test8(); - test9(); - test10(); -+ test7156(); - - writeln("Success"); - } ---- a/src/gcc/testsuite/gdc.test/runnable/nested.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/nested.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2443,6 +2443,29 @@ void test9244() - } - - /*******************************************/ -+// 10495 -+ -+struct X10495 -+{ -+ @disable this(); -+} -+ -+struct Y10495(alias f) -+{ -+ void g() {} -+} -+ -+class C10495 -+{ -+ X10495 s = X10495.init; -+ -+ void h() -+ { -+ Y10495!(a => a) st; -+ } -+} -+ -+/*******************************************/ - - int main() - { ---- a/src/gcc/testsuite/gdc.test/runnable/nulltype.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/nulltype.d 2014-04-01 16:32:51.000000000 +0100 -@@ -116,6 +116,33 @@ void test8221() - assert(a.foo() is null); - } - -+/***************************************************/ -+// 8589 -+ -+void test8589() -+{ -+ static typeof(null) retnull() { return null; } -+ -+ void test(bool result, T)() -+ { -+ void f(T function() dg) { assert(!dg()); } -+ -+ static assert((T.sizeof == typeof(null).sizeof) == result); -+ static assert(is(typeof( f(&retnull) )) == result); -+ static assert(is(typeof( f(()=>null) )) == result); -+ static if (result) -+ { -+ f(&retnull); -+ f(()=>null); -+ } -+ } -+ test!(true, int*)(); -+ test!(true, Object)(); -+ test!(true, int[int])(); -+ test!(false, int[])(); -+ test!(false, void delegate())(); -+} -+ - /**********************************************/ - // 9385 - -@@ -134,6 +161,7 @@ int main() - test2(); - test7278(); - test8221(); -+ test8589(); - test9385(); - - printf("Success\n"); ---- a/src/gcc/testsuite/gdc.test/runnable/opover2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/opover2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -564,7 +564,7 @@ void test13() - assert(opeq == 4); - - // built-in opEquals == const bool opEquals(const S rhs); -- assert(!s.opEquals(s)); -+ assert(s != s); - assert(opeq == 5); - - // xopEquals -@@ -607,6 +607,10 @@ void test15() - const bool opEquals(T)(const(T) rhs) - if (!is(T == typeof(this))) - { return false; } -+ -+ @disable const bool opEquals(T)(const(T) rhs) -+ if (is(T == typeof(this))) -+ { return false; } - } - - S makeS(){ return S(); } -@@ -665,6 +669,160 @@ void test17() - } - - /**************************************/ -+// 3789 -+ -+bool test3789() -+{ -+ static struct Float -+ { -+ double x; -+ } -+ Float f; -+ assert(f.x != f.x); // NaN != NaN -+ assert(f != f); -+ -+ static struct Array -+ { -+ int[] x; -+ } -+ Array a1 = Array([1,2,3].dup); -+ Array a2 = Array([1,2,3].dup); -+ if (!__ctfe) -+ { // Currently doesn't work this in CTFE - may or may not a bug. -+ assert(a1.x !is a2.x); -+ } -+ assert(a1.x == a2.x); -+ assert(a1 == a2); -+ -+ static struct AA -+ { -+ int[int] x; -+ } -+ AA aa1 = AA([1:1,2:2,3:3]); -+ AA aa2 = AA([1:1,2:2,3:3]); -+ if (!__ctfe) -+ { // Currently doesn't work this in CTFE - may or may not a bug. -+ assert(aa1.x !is aa2.x); -+ } -+ if (!__ctfe) -+ { // This is definitely a bug. Should work in CTFE. -+ assert(aa1.x == aa2.x); -+ assert(aa1 == aa2); -+ } -+ -+ if (!__ctfe) -+ { // Currently union operation is not supported in CTFE. -+ union U1 -+ { -+ double x; -+ } -+ static struct UnionA -+ { -+ int[] a; -+ U1 u; -+ } -+ auto ua1 = UnionA([1,2,3]); -+ auto ua2 = UnionA([1,2,3]); -+ assert(ua1.u.x is ua2.u.x); -+ assert(ua1.u.x != ua2.u.x); -+ assert(ua1 == ua2); -+ ua1.u.x = 1.0; -+ ua2.u.x = 1.0; -+ assert(ua1.u.x is ua2.u.x); -+ assert(ua1.u.x == ua2.u.x); -+ assert(ua1 == ua2); -+ ua1.u.x = double.nan; -+ assert(ua1.u.x !is ua2.u.x); -+ assert(ua1.u.x != ua2.u.x); -+ assert(ua1 != ua2); -+ -+ union U2 -+ { -+ int[] a; -+ } -+ static struct UnionB -+ { -+ double x; -+ U2 u; -+ } -+ auto ub1 = UnionB(1.0); -+ auto ub2 = UnionB(1.0); -+ assert(ub1 == ub2); -+ ub1.u.a = [1,2,3].dup; -+ ub2.u.a = [1,2,3].dup; -+ assert(ub1.u.a !is ub2.u.a); -+ assert(ub1.u.a == ub2.u.a); -+ assert(ub1 != ub2); -+ ub2.u.a = ub1.u.a; -+ assert(ub1.u.a is ub2.u.a); -+ assert(ub1.u.a == ub2.u.a); -+ assert(ub1 == ub2); -+ } -+ -+ if (!__ctfe) -+ { // This is definitely a bug. Should work in CTFE. -+ static struct Class -+ { -+ Object x; -+ } -+ static class X -+ { -+ override bool opEquals(Object o){ return true; } -+ } -+ -+ Class c1a = Class(new Object()); -+ Class c2a = Class(new Object()); -+ assert(c1a.x !is c2a.x); -+ assert(c1a.x != c2a.x); -+ assert(c1a != c2a); // Pass, Object.opEquals works like bitwise compare -+ -+ Class c1b = Class(new X()); -+ Class c2b = Class(new X()); -+ assert(c1b.x !is c2b.x); -+ assert(c1b.x == c2b.x); -+ assert(c1b == c2b); // Fails, should pass -+ } -+ return true; -+} -+static assert(test3789()); -+ -+/**************************************/ -+// 10037 -+ -+struct S10037 -+{ -+ bool opEquals(ref const S10037) { assert(0); } -+} -+ -+struct T10037 -+{ -+ S10037 s; -+ // Compiler should not generate 'opEquals' here implicitly: -+} -+ -+struct Sub10037(TL...) -+{ -+ TL data; -+ int value; -+ alias value this; -+} -+ -+void test10037() -+{ -+ S10037 s; -+ T10037 t; -+ static assert( __traits(hasMember, S10037, "opEquals")); -+ static assert(!__traits(hasMember, T10037, "opEquals")); -+ assert(thrown!Error(s == s)); -+ assert(thrown!Error(t == t)); -+ -+ Sub10037!(S10037) lhs; -+ Sub10037!(S10037) rhs; -+ static assert(!__traits(hasMember, Sub10037!(S10037), "opEquals")); -+ assert(lhs == rhs); // lowered to: lhs.value == rhs.value -+} -+ -+/**************************************/ - // 7641 - - mixin template Proxy7641(alias a) -@@ -977,6 +1135,366 @@ void test9496() - } - - /**************************************/ -+// 9689 -+ -+struct B9689(T) -+{ -+ T val; -+ @disable this(this); -+ -+ bool opEquals(this X, B)(auto ref B b) -+ { -+ //pragma(msg, "+", X, ", B = ", B, ", ref = ", __traits(isRef, b)); -+ return this.val == b.val; -+ //pragma(msg, "-", X, ", B = ", B, ", ref = ", __traits(isRef, b)); -+ } -+} -+ -+struct S9689 -+{ -+ B9689!int num; -+} -+ -+void test9689() -+{ -+ B9689!S9689 b; -+} -+ -+/**************************************/ -+// 9694 -+ -+struct S9694 -+{ -+ bool opEquals(ref S9694 rhs) -+ { -+ assert(0); -+ } -+} -+struct T9694 -+{ -+ S9694 s; -+} -+void test9694() -+{ -+ T9694 t; -+ assert(thrown!Error(typeid(T9694).equals(&t, &t))); -+} -+ -+/**************************************/ -+// 10064 -+ -+void test10064() -+{ -+ static struct S -+ { -+ int x = 3; -+ -+ @disable this(); -+ -+ this(int) -+ { x = 7; } -+ -+ int opSlice(size_t, size_t) -+ { return 0; } -+ -+ @property size_t opDollar() -+ { -+ assert(x == 7 || x == 3); // fails -+ assert(x == 7); -+ return 0; -+ } -+ } -+ auto x = S(0)[0 .. $]; -+} -+ -+/**************************************/ -+// 10394 -+ -+void test10394() -+{ -+ alias Seq!(int, int) Pair; -+ Pair pair; -+ -+ struct S1 -+ { -+ int opBinary(string op)(Pair) { return 1; } -+ bool opEquals(Pair) { return true; } -+ int opOpAssign(string op)(Pair) { return 1; } -+ } -+ S1 s1; -+ assert((s1 + pair) == 1); -+ assert((s1 == pair) == true); -+ assert((s1 *= pair) == 1); -+ -+ struct S2 -+ { -+ int opBinaryRight(string op)(Pair lhs) { return 1; } -+ int opCmp(Pair) { return -1; } -+ } -+ S2 s2; -+ assert((pair in s2) == 1); -+ assert(s2 < pair); -+} -+ -+/**************************************/ -+// 10597 -+ -+struct R10597 -+{ -+ void opIndex(int) {} -+ void opSlice(int, int) {} -+ int opDollar(); -+} -+R10597 r; -+ -+struct S10597 -+{ -+ static assert(is(typeof(r[0]))); //ok -+ static assert(is(typeof(r[$]))); //fails -+ -+ static assert(is(typeof(r[0..0]))); //ok -+ static assert(is(typeof(r[$..$]))); //fails -+ -+ void foo() -+ { -+ static assert(is(typeof(r[0]))); //ok -+ static assert(is(typeof(r[$]))); //ok -+ -+ static assert(is(typeof(r[0..0]))); //ok -+ static assert(is(typeof(r[$..$]))); //ok -+ } -+} -+ -+static assert(is(typeof(r[0]))); //ok -+static assert(is(typeof(r[$]))); //fails -+ -+static assert(is(typeof(r[0..0]))); //ok -+static assert(is(typeof(r[$..$]))); //fails -+ -+void test10597() -+{ -+ static assert(is(typeof(r[0]))); //ok -+ static assert(is(typeof(r[$]))); //ok -+ -+ static assert(is(typeof(r[0..0]))); //ok -+ static assert(is(typeof(r[$..$]))); //ok -+} -+ -+/**************************************/ -+// 10567 -+ -+// doesn't require thunk -+struct S10567x1n { int value; int opCmp(ref const S10567x1n rhs) const { return 0; } } -+ -+// requires thunk -+struct S10567y1n { int value; int opCmp(const S10567y1n rhs) const { return 0; } } -+struct S10567y1t { int value; int opCmp(S)(const S rhs) const { return 0; } } -+ -+// doesn't support const comparison -+struct S10567z1n { int value; int opCmp(const S10567z1n rhs) { return 0; } } -+struct S10567z1t { int value; int opCmp(S)(const S rhs) { return 0; } } -+ -+/+ -+struct S10567x2n { S10567x1n s; this(int n) { s = typeof(s)(n); } alias s this; } -+ -+struct S10567y2n { S10567y1n s; this(int n) { s = typeof(s)(n); } alias s this; } -+struct S10567y2t { S10567y1t s; this(int n) { s = typeof(s)(n); } alias s this; } -+ -+struct S10567z2n { S10567z1n s; this(int n) { s = typeof(s)(n); } alias s this; } -+struct S10567z2t { S10567z1t s; this(int n) { s = typeof(s)(n); } alias s this; } -+ -+struct S10567d1 -+{ -+ int value; -+ int opDispatch(string name, S)(const S rhs) const if (name == "opCmp") -+ { assert(0); } -+} -+struct S10567d2 -+{ -+ int value; -+ template opDispatch(string name) if (name == "opCmp") -+ { -+ int opDispatch(const S rhs) const -+ { assert(0); } -+ } -+} -+ -+// recursive alias this + opCmp searching -+struct S10567r1 -+{ -+ static S10567r2 t; -+ ref S10567r2 payload() { return t; } -+ alias payload this; -+ -+ int opCmp(const S10567r1 s) const { return 0; } -+} -+struct S10567r2 -+{ -+ static S10567r1 s; -+ ref S10567r1 payload() { return s; } -+ alias payload this; -+} -++/ -+ -+void test10567() -+{ -+ foreach (S; Seq!(S10567x1n/+, S10567x2n+/)) -+ { -+ S sx = S(1); -+ S sy = S(2); -+ assert(!(sx < sy) && !(sx > sy)); -+ assert(sx.opCmp(sy) == 0); -+ -+ assert(typeid(S).compare(&sx, &sy) == 0); -+ static if (is(S == S10567x1n)) -+ assert(cast(void*)typeid(S).xopCmp == cast(void*)&S.opCmp, S.stringof); -+ } -+ -+ foreach (S; Seq!(S10567y1n, S10567y1t/+, S10567y2n, S10567y2t+/)) -+ { -+ S sx = S(1); -+ S sy = S(2); -+ assert(!(sx < sy) && !(sx > sy)); -+ assert(sx.opCmp(sy) == 0); -+ -+ assert(typeid(S).compare(&sx, &sy) == 0); -+ } -+ -+ foreach (S; Seq!(S10567z1n, S10567z1t/+, S10567z2n, S10567z2t+/)) -+ { -+ S sx = S(1); -+ S sy = S(2); -+ assert(!(sx < sy) && !(sx > sy)); -+ assert(sx.opCmp(sy) == 0); -+ -+ try -+ { -+ auto x = typeid(S).compare(&sx, &sy); -+ assert(0); -+ } -+ catch (Error e) { assert(e.msg[$-15 .. $] == "not implemented"); } -+ } -+/+ -+ foreach (S; Seq!(S10567d1, S10567d2)) -+ { -+ int[S] aa; -+ aa[S(1)] = 10; aa[S(1)] = 1; -+ aa[S(2)] = 20; aa[S(2)] = 2; -+ assert(aa.length == 2); -+ foreach (k, v; aa) -+ assert(k.value == v); -+ -+ S sx = S(1); -+ S sy = S(2); -+ -+ // Don't invoke opDispatch!"opCmp" -+ assert(typeid(S).compare(&sx, &sy) != 0); -+ } -++/ -+} -+ -+/**************************************/ -+// 11062 -+ -+struct S11062ia -+{ -+ struct S1 -+ { -+ void opIndexAssign(int val, int key) {} -+ } -+ struct S2 -+ { -+ S1 headers; -+ } -+ -+ private S2 m_obj; -+ @property S2 get() { return m_obj; } -+ alias get this; -+} -+ -+struct S11062sa -+{ -+ struct S1 -+ { -+ void opSliceAssign(int val, int lwr, int upr) {} -+ } -+ struct S2 -+ { -+ S1 headers; -+ } -+ -+ private S2 m_obj; -+ @property S2 get() { return m_obj; } -+ alias get this; -+} -+ -+void test11062() -+{ -+ auto sia = S11062ia(); -+ sia.headers[1] = 1; // bug -+ -+ auto ssa = S11062sa(); -+ ssa.headers[1..2] = 1; // bug -+} -+ -+/**************************************/ -+// 11311 -+ -+void test11311() -+{ -+ static int ctor, cpctor, dtor; -+ -+ static struct S -+ { -+ this(int) { ++ctor; } -+ this(this) { ++cpctor; } -+ ~this() { ++dtor; } -+ } -+ static struct Arr -+ { -+ S data; -+ ref S opIndex(int) { return data; } -+ ref S opSlice(int, int) { return data; } -+ } -+ -+ { -+ Arr a = Arr(S(1)); -+ assert(ctor == 1); -+ assert(cpctor == 0); -+ assert(dtor == 0); -+ -+ auto getA1() { return a; } -+ //getA1().opIndex(1); // OK -+ getA1()[1]; // NG -+ -+ assert(ctor == 1); -+ assert(cpctor == 1); // getA() returns a copy of a -+ assert(dtor == 1); // temporary returned by getA() should be destroyed -+ } -+ assert(dtor == 2); -+ assert(ctor + cpctor == dtor); -+ -+ ctor = cpctor = dtor = 0; -+ -+ { -+ Arr a = Arr(S(1)); -+ assert(ctor == 1); -+ assert(cpctor == 0); -+ assert(dtor == 0); -+ -+ auto getA2() { return a; } -+ //getA2().opSlice(1, 2); // OK -+ getA2()[1..2]; // NG -+ -+ assert(ctor == 1); -+ assert(cpctor == 1); // getA() returns a copy of a -+ assert(dtor == 1); // temporary returned by getA() should be destroyed -+ } -+ assert(dtor == 2); -+ assert(ctor + cpctor == dtor); -+} -+ -+/**************************************/ - - int main() - { -@@ -998,12 +1516,21 @@ int main() - test15(); - test16(); - test17(); -+ test3789(); -+ test10037(); - test7641(); - test8434(); - test18(); - test19(); - test9453(); - test9496(); -+ test9689(); -+ test9694(); -+ test10064(); -+ test10394(); -+ test10567(); -+ test11062(); -+ test11311(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/overload.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/overload.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,8 @@ -+// EXTRA_SOURCES: imports/ovs1528a.d imports/ovs1528b.d imports/template_ovs1.d imports/template_ovs2.d imports/template_ovs3.d -+ -+import imports.template_ovs1; -+import imports.template_ovs2; -+import imports.template_ovs3; - - extern(C) int printf(const char* fmt, ...); - -@@ -6,6 +11,354 @@ template Id( T){ alias T Id; } - template Id(alias A){ alias A Id; } - - /***************************************************/ -+// 1528 -+ -+int foo1528(long){ return 1; } -+int foo1528(int[]){ return 2; } -+int foo1528(T)(T) if ( is(T:real)) { return 3; } -+int foo1528(T)(T) if (!is(T:real)) { return 4; } -+int bar1528(T)(T) if (!is(T:real)) { return 4; } -+int bar1528(T)(T) if ( is(T:real)) { return 3; } -+int bar1528(int[]){ return 2; } -+int bar1528(long){ return 1; } -+ -+@property auto getfoo1528 () { return 1; } -+@property auto getfoo1528(T)() { return 2; } -+@property auto getbar1528(T)() { return 2; } -+@property auto getbar1528 () { return 1; } -+ -+@property auto setfoo1528 (int) { return 1; } -+@property auto setfoo1528(T)(int) { return 2; } -+@property auto setbar1528(T)(int) { return 2; } -+@property auto setbar1528 (int) { return 1; } -+ -+struct S1528 -+{ -+ int foo(long){ return 1; } -+ int foo(int[]){ return 2; } -+ int foo(T)(T) if ( is(T:real)) { return 3; } -+ int foo(T)(T) if (!is(T:real)) { return 4; } -+ int bar(T)(T) if (!is(T:real)) { return 4; } -+ int bar(T)(T) if ( is(T:real)) { return 3; } -+ int bar(int[]){ return 2; } -+ int bar(long){ return 1; } -+ -+ @property auto getfoo () { return 1; } -+ @property auto getfoo(T)() { return 2; } -+ @property auto getbar(T)() { return 2; } -+ @property auto getbar () { return 1; } -+ -+ @property auto setfoo (int) { return 1; } -+ @property auto setfoo(T)(int) { return 2; } -+ @property auto setbar(T)(int) { return 2; } -+ @property auto setbar (int) { return 1; } -+ -+ @property auto propboo () { return 1; } -+ @property auto propboo(T)(T) { return 2; } -+ @property auto propbaz(T)(T) { return 2; } -+ @property auto propbaz () { return 1; } -+} -+ -+auto ufoo1528 (S1528) { return 1; } -+auto ufoo1528(T)(S1528) { return 2; } -+auto ubar1528(T)(S1528) { return 2; } -+auto ubar1528 (S1528) { return 1; } -+ -+@property auto ugetfoo1528 (S1528) { return 1; } -+@property auto ugetfoo1528(T)(S1528) { return 2; } -+@property auto ugetbar1528(T)(S1528) { return 2; } -+@property auto ugetbar1528 (S1528) { return 1; } -+ -+@property auto usetfoo1528 (S1528, int) { return 1; } -+@property auto usetfoo1528(T)(S1528, int) { return 2; } -+@property auto usetbar1528(T)(S1528, int) { return 2; } -+@property auto usetbar1528 (S1528, int) { return 1; } -+ -+@property auto upropboo1528 (S1528) { return 1; } -+@property auto upropboo1528(T)(S1528, T) { return 2; } -+@property auto upropbaz1528(T)(S1528, T) { return 2; } -+@property auto upropbaz1528 (S1528) { return 1; } -+ -+void test1528a() -+{ -+ // global -+ assert(foo1528(100) == 1); -+ assert(foo1528(10L) == 1); -+ assert(foo1528([1]) == 2); -+ assert(foo1528(1.0) == 3); -+ assert(foo1528("a") == 4); -+ assert(bar1528(100) == 1); -+ assert(bar1528(10L) == 1); -+ assert(bar1528([1]) == 2); -+ assert(bar1528(1.0) == 3); -+ assert(bar1528("a") == 4); -+ -+ assert(getfoo1528 == 1); -+ assert(getfoo1528!string == 2); -+ assert(getbar1528 == 1); -+ assert(getbar1528!string == 2); -+ -+ assert((setfoo1528 = 1) == 1); -+ assert((setfoo1528!string = 1) == 2); -+ assert((setbar1528 = 1) == 1); -+ assert((setbar1528!string = 1) == 2); -+ -+ S1528 s; -+ -+ // member -+ assert(s.foo(100) == 1); -+ assert(s.foo(10L) == 1); -+ assert(s.foo([1]) == 2); -+ assert(s.foo(1.0) == 3); -+ assert(s.foo("a") == 4); -+ assert(s.bar(100) == 1); -+ assert(s.bar(10L) == 1); -+ assert(s.bar([1]) == 2); -+ assert(s.bar(1.0) == 3); -+ assert(s.bar("a") == 4); -+ -+ assert(s.getfoo == 1); -+ assert(s.getfoo!string == 2); -+ assert(s.getbar == 1); -+ assert(s.getbar!string == 2); -+ -+ assert((s.setfoo = 1) == 1); -+ assert((s.setfoo!string = 1) == 2); -+ assert((s.setbar = 1) == 1); -+ assert((s.setbar!string = 1) == 2); -+ -+ assert((s.propboo = 1) == 2); -+ assert( s.propboo == 1); -+ assert((s.propbaz = 1) == 2); -+ assert( s.propbaz == 1); -+ -+ // UFCS -+ assert(s.ufoo1528 () == 1); -+ assert(s.ufoo1528!string() == 2); -+ assert(s.ubar1528 () == 1); -+ assert(s.ubar1528!string() == 2); -+ -+ assert(s.ugetfoo1528 == 1); -+ assert(s.ugetfoo1528!string == 2); -+ assert(s.ugetbar1528 == 1); -+ assert(s.ugetbar1528!string == 2); -+ -+ assert((s.usetfoo1528 = 1) == 1); -+ assert((s.usetfoo1528!string = 1) == 2); -+ assert((s.usetbar1528 = 1) == 1); -+ assert((s.usetbar1528!string = 1) == 2); -+ -+ assert((s.upropboo1528 = 1) == 2); -+ assert( s.upropboo1528 == 1); -+ assert((s.upropbaz1528 = 1) == 2); -+ assert( s.upropbaz1528 == 1); -+ -+ // overload set -+ import imports.ovs1528a, imports.ovs1528b; -+ assert(func1528() == 1); -+ assert(func1528(1.0) == 2); -+ assert(func1528("a") == 3); -+ assert(func1528([1.0]) == 4); -+ assert(bunc1528() == 1); -+ assert(bunc1528(1.0) == 2); -+ assert(bunc1528("a") == 3); -+ assert(bunc1528([1.0]) == 4); -+ -+ assert(vunc1528(100) == 1); -+ assert(vunc1528("a") == 2); -+ assert(wunc1528(100) == 1); -+ assert(wunc1528("a") == 2); -+ -+ //assert(opUnary1528!"+"(10) == 1); -+ //assert(opUnary1528!"-"(10) == 2); -+} -+ -+// ---- -+ -+int doo1528a(int a, double=10) { return 1; } -+int doo1528a(int a, string="") { return 2; } -+ -+int doo1528b(int a) { return 1; } -+int doo1528b(T:int)(T b) { return 2; } -+ -+int doo1528c(T:int)(T b, double=10) { return 2; } -+int doo1528c(T:int)(T b, string="") { return 2; } -+ -+int doo1528d(int a) { return 1; } -+int doo1528d(T)(T b) { return 2; } -+ -+void test1528b() -+{ -+ // MatchLevel by tiargs / by fargs -+ static assert(!__traits(compiles, doo1528a(1))); -+ // 1: MATCHexact / MATCHexact -+ // 2: MATCHexact / MATCHexact -+ static assert(!__traits(compiles, doo1528a(1L))); -+ // 1: MATCHexact / MATCHconvert -+ // 2: MATCHexact / MATCHconvert -+ -+ static assert(!__traits(compiles, doo1528b(1))); -+ // 1: MATCHexact / MATCHexact -+ // 2: MATCHexact / MATCHexact -+ assert(doo1528b(1L) == 1); -+ // 1: MATCHexact / MATCHconvert -+ // 2: MATCHnomatch / - -+ -+ static assert(!__traits(compiles, doo1528c(1))); -+ // 1: MATCHexact / MATCHexact -+ // 2: MATCHexact / MATCHexact -+ static assert(!__traits(compiles, doo1528c(1L))); -+ // 1: MATCHnomatch / - -+ // 2: MATCHnomatch / - -+ -+ assert(doo1528d(1) == 1); -+ // 1: MATCHexact / MATCHexact -+ // 2: MATCHconvert / MATCHexact -+ assert(doo1528d(1L) == 1); -+ // 1: MATCHexact / MATCHconvert -+ // 2: MATCHconvert / MATCHexact -+ // -> not sure, may be ambiguous...? -+} -+ -+// ---- -+ -+char[num*2] toHexString1528(int order, size_t num)(in ubyte[num] digest) { return typeof(return).init; } -+ string toHexString1528(int order)(in ubyte[] digest) { assert(0); } -+ -+char[8] test1528c() -+{ -+ ubyte[4] foo() { return typeof(return).init; } -+ return toHexString1528!10(foo); -+} -+ -+// ---- -+ -+int f1528d1(int a, double=10) { return 1; } -+int f1528d1(int a, string="") { return 2; } -+ -+int f1528d2(T:int)(T b, double=10) { return 1; } -+int f1528d2(T:int)(T b, string="") { return 2; } -+ -+// vs deduced parameter -+int f1528d3(int a) { return 1; } -+int f1528d3(T)(T b) { return 2; } -+ -+// vs specialized parameter -+int f1528d4(int a) { return 1; } -+int f1528d4(T:int)(T b) { return 2; } -+ -+// vs deduced parameter + template constraint (1) -+int f1528d5(int a) { return 1; } -+int f1528d5(T)(T b) if (is(T == int)) { return 2; } -+ -+// vs deduced parameter + template constraint (2) -+int f1528d6(int a) { return 1; } -+int f1528d6(T)(T b) if (is(T : int)) { return 2; } -+ -+// vs nallowing conversion -+int f1528d7(ubyte a) { return 1; } -+int f1528d7(T)(T b) if (is(T : int)) { return 2; } -+ -+int f1528d10(int, int) { return 1; } -+int f1528d10(T)(T, int) { return 2; } -+ -+void test1528d() -+{ -+ static assert(!__traits(compiles, f1528d1(1))); // ambiguous -+ static assert(!__traits(compiles, f1528d1(1L))); // ambiguous -+ -+ static assert(!__traits(compiles, f1528d2(1))); // ambiguous -+ static assert(!__traits(compiles, f1528d2(1L))); // no match -+ -+ assert(f1528d3(1) == 1); -+ assert(f1528d3(1L) == 1); // '1L' matches int -+ short short_val = 42; -+ assert(f1528d3(cast(short) 42) == 1); -+ assert(f1528d3(short_val) == 1); -+ -+ static assert(!__traits(compiles, f1528d4(1))); -+ assert(f1528d4(1L) == 1); -+ -+ assert(f1528d5(1) == 1); -+ assert(f1528d5(1L) == 1); -+ -+ assert(f1528d6(1) == 1); -+ assert(f1528d6(1L) == 1); -+ static assert(!__traits(compiles, f1528d6(ulong.max))); // no match -+ // needs to fix bug 9617 -+ ulong ulval = 1; -+ static assert(!__traits(compiles, f1528d6(ulval))); // no match -+ -+ assert(f1528d7(200u) == 1); // '200u' matches ubyte -+ assert(f1528d7(400u) == 2); -+ uint uival = 400; // TDPL-like range knowledge lost here. -+ assert(f1528d7(uival) == 2); -+ uival = 200; // Ditto. -+ assert(f1528d7(uival) == 2); -+ -+ -+ assert(f1528d10( 1, 9) == 1); -+ assert(f1528d10( 1U, 9) == 1); -+ assert(f1528d10( 1L, 9) == 1); -+ assert(f1528d10( 1LU, 9) == 1); -+ assert(f1528d10( long.max, 9) == 2); -+ assert(f1528d10(ulong.max, 9) == 2); -+ assert(f1528d10( 1, 9L) == 1); -+ assert(f1528d10( 1U, 9L) == 1); -+ assert(f1528d10( 1L, 9L) == 1); -+ assert(f1528d10( 1LU, 9L) == 1); -+ assert(f1528d10( long.max, 9L) == 2); -+ assert(f1528d10(ulong.max, 9L) == 2); -+} -+ -+/***************************************************/ -+// 1680 -+ -+struct S1680 -+{ -+ ulong _y; -+ -+ ulong blah1() { return _y; } -+ static S1680 blah1(ulong n) { return S1680(n); } -+ -+ static S1680 blah2(ulong n) { return S1680(n); } -+ static S1680 blah2(char[] n) { return S1680(n.length); } -+} -+ -+class C1680 -+{ -+ ulong _y; -+ this(ulong n){} -+ -+ ulong blah1() { return _y; } -+ static C1680 blah1(ulong n) { return new C1680(n); } -+ -+ static C1680 blah2(ulong n) { return new C1680(n); } -+ static C1680 blah2(char[] n) { return new C1680(n.length); } -+} -+ -+void test1680() -+{ -+ // OK -+ S1680 s = S1680.blah1(5); -+ void fs() -+ { -+ S1680 s1 = S1680.blah2(5); // OK -+ S1680 s2 = S1680.blah2("hello".dup); // OK -+ S1680 s3 = S1680.blah1(5); -+ // Error: 'this' is only allowed in non-static member functions, not f -+ } -+ -+ C1680 c = C1680.blah1(5); -+ void fc() -+ { -+ C1680 c1 = C1680.blah2(5); -+ C1680 c2 = C1680.blah2("hello".dup); -+ C1680 c3 = C1680.blah1(5); -+ } -+} -+ -+/***************************************************/ - // 7418 - - int foo7418(uint a) { return 1; } -@@ -80,6 +433,18 @@ void test7552() - } - - /***************************************************/ -+// 8668 -+ -+import imports.m8668a; -+import imports.m8668c; //replace with m8668b to make it work -+ -+void test8668() -+{ -+ split8668("abc"); -+ split8668(123); -+} -+ -+/***************************************************/ - // 8943 - - void test8943() -@@ -108,13 +473,446 @@ void test9410() - } - - /***************************************************/ -+// 10171 -+ -+struct B10171(T) { static int x; } -+ -+void test10171() -+{ -+ auto mp = &B10171!(B10171!int).x; -+} -+ -+/***************************************************/ -+// 1900 - template overload set -+ -+void test1900a() -+{ -+ // function vs function template with IFTI call -+ assert(foo1900a(100) == 1); -+ assert(foo1900a("s") == 2); -+ assert(foo1900b(100) == 1); -+ assert(foo1900b("s") == 2); -+ // function template call with explicit template arguments -+ assert(foo1900a!string("s") == 2); -+ assert(foo1900b!string("s") == 2); -+ -+ // function template overloaded set call with IFTI -+ assert(bar1900a(100) == 1); -+ assert(bar1900a("s") == 2); -+ assert(bar1900b(100) == 1); -+ assert(bar1900b("s") == 2); -+ // function template overloaded set call with explicit template arguments -+ assert(bar1900a!double(100) == 1); -+ assert(bar1900a!string("s") == 2); -+ assert(bar1900b!double(100) == 1); -+ assert(bar1900b!string("s") == 2); -+ -+ // function template overloaded set call with IFTI -+ assert(baz1900(1234567890) == 1); -+ assert(baz1900([1:1, 2:2]) == 2); -+ assert(baz1900(new Object) == 3); -+ assert(baz1900("deadbeaf") == 4); -+ // function template overloaded set call with explicit template arguments -+ assert(baz1900!(double)(14142135) == 1); -+ assert(baz1900!(int[int])([12:34]) == 2); -+ assert(baz1900!(Object)(new Object) == 3); -+ assert(baz1900!(string)("cafe babe") == 4); -+ -+ static assert(!__traits(compiles, bad1900!"++"())); -+} -+ -+void test1900b() -+{ -+ S1900 s; -+ -+ // function vs function template with IFTI call -+ assert(s.foo1900a(100) == 1); -+ assert(s.foo1900a("s") == 2); -+ assert(s.foo1900b(100) == 1); -+ assert(s.foo1900b("s") == 2); -+ // function template call with explicit template arguments -+ assert(s.foo1900a!string("s") == 2); -+ assert(s.foo1900b!string("s") == 2); -+ -+ // function template overloaded set call with IFTI -+ assert(s.bar1900a(100) == 1); -+ assert(s.bar1900a("s") == 2); -+ assert(s.bar1900b(100) == 1); -+ assert(s.bar1900b("s") == 2); -+ // function template overloaded set call with explicit template arguments -+ assert(s.bar1900a!double(100) == 1); -+ assert(s.bar1900a!string("s") == 2); -+ assert(s.bar1900b!double(100) == 1); -+ assert(s.bar1900b!string("s") == 2); -+ -+ // function template overloaded set call with IFTI -+ assert(s.baz1900(1234567890) == 1); -+ assert(s.baz1900([1:1, 2:2]) == 2); -+ assert(s.baz1900(new Object) == 3); -+ assert(s.baz1900("deadbeaf") == 4); -+ // function template overloaded set call with explicit template arguments -+ assert(s.baz1900!(double)(14142135) == 1); -+ assert(s.baz1900!(int[int])([12:34]) == 2); -+ assert(s.baz1900!(Object)(new Object) == 3); -+ assert(s.baz1900!(string)("cafe babe") == 4); -+ -+ static assert(!__traits(compiles, s.bad1900!"++"())); -+} -+ -+void test1900c() -+{ -+ S1900 s; -+ -+ // This is a kind of Issue 1528 - [tdpl] overloading template and non-template functions -+ //s.funca(); -+ //s.funca(10); -+ //s.funcb(); -+ //s.funcb(10); -+ -+ // Call function template overload set through mixin member lookup -+ assert(s.mixfooa() == 1); -+ assert(s.mixfooa(10) == 2); -+ assert(s.mixfoob() == 1); -+ assert(s.mixfoob(10) == 2); -+ -+ // Call function template overload set through mixin^2 member lookup -+ assert(s.mixsubfooa() == 1); -+ assert(s.mixsubfooa(10) == 2); -+ assert(s.mixsubfoob() == 1); -+ assert(s.mixsubfoob(10) == 2); -+ -+ // Using mixin identifier can limit overload set -+ assert(s.a.mixfooa() == 1); static assert(!__traits(compiles, s.a.mixfooa(10))); -+ assert(s.b.mixfooa(10) == 2); static assert(!__traits(compiles, s.b.mixfooa())); -+ assert(s.b.mixfoob() == 1); static assert(!__traits(compiles, s.b.mixfoob(10))); -+ assert(s.a.mixfoob(10) == 2); static assert(!__traits(compiles, s.a.mixfoob())); -+} -+ -+version(none) // yet not implemented -+{ -+alias merge1900 = imports.template_ovs1.merge1900; -+alias merge1900 = imports.template_ovs2.merge1900; -+ -+void test1900d() -+{ -+ assert( merge1900!double(100) == 1); -+ assert(.merge1900!double(100) == 1); -+} -+} -+else -+{ -+void test1900d() {} // dummy -+} -+ -+mixin template Foo1900e(T) -+{ -+ void foo(U : T)() { v++;} -+} -+void test1900e() -+{ -+ struct S -+ { -+ int v; -+ mixin Foo1900e!double; -+ mixin Foo1900e!string; -+ void test() -+ { -+ foo!(int); // ScopeExp(ti->tempovers != NULL) -+ foo!(typeof(null)); // ScopeExp(ti->tempovers != NULL) -+ } -+ } -+ -+ S s; -+ assert(s.v == 0); -+ s.test(); -+ assert(s.v == 2); -+} -+ -+/***************************************************/ -+// 1900 -+ -+void test1900() -+{ -+ AClass1900 a; -+ BClass1900 b; -+ -+ static assert(Traits1900!(AClass1900).name == "AClass"); -+ static assert(Traits1900!(BClass1900).name == "BClass"); -+ static assert(Traits1900!(int).name == "any"); -+ -+ Traits1900!(long) obj; -+ -+ static assert(Value1900a!double == 1); -+ static assert(Value1900b!double == 1); -+ static assert(Value1900a!string == 2); -+ static assert(Value1900b!string == 2); -+} -+ -+version(none) // yet not implemented -+{ -+alias imports.template_ovs1.Traits1900 Traits1900X; -+alias imports.template_ovs2.Traits1900 Traits1900X; -+alias imports.template_ovs3.Traits1900 Traits1900X; -+static assert(Traits1900X!(AClass1900).name == "AClass"); -+static assert(Traits1900X!(BClass1900).name == "BClass"); -+static assert(Traits1900X!(int).name == "any"); -+ -+// Traits1900Y is exact same as imports.template_ovs1.Traits1900. -+alias imports.template_ovs1.Traits1900 Traits1900Y1; -+alias imports.template_ovs1.Traits1900 Traits1900Y2; -+alias Traits1900Y1 Traits1900Y; -+alias Traits1900Y2 Traits1900Y; -+static assert(Traits1900Y!(AClass1900).name == "AClass"); -+static assert(!__traits(compiles, Traits1900Y!(BClass1900))); -+static assert(!__traits(compiles, Traits1900Y!(int))); -+} -+ -+template Foo1900(T) -+{ -+ template Bar1900(U : T) -+ { -+ } -+} -+mixin Foo1900!(int) A; -+mixin Foo1900!(char) B; -+alias Bar1900!(int) bar; //error -+ -+/***************************************************/ -+// 7780 -+ -+mixin template A7780() -+{ -+ template C(int n : 0) { int C = 0; } -+} -+mixin template B7780() -+{ -+ template C(int n : 1) { int C = 1; } -+} -+ -+class Foo7780 -+{ -+ mixin A7780!(); -+ mixin B7780!(); -+} -+ -+void test7780() -+{ -+ assert(Foo7780.C!0 == 0); -+} -+ -+/***************************************************/ -+// 8352 -+ -+void test8352() -+{ -+ [1, 2].remove8352a!(x => x == 2)(); -+ [1, 2].remove8352b!(x => x == 2)(); -+ remove8352a("deleteme"); -+ remove8352b("deleteme"); -+} -+ -+/***************************************************/ -+// 8441 -+ -+mixin template T8441a(string i) -+{ -+ auto j(string s = "a", U)(U u1, U u2) -+ { -+ return 0; -+ } -+ auto j(int i,string s = "a", W)(W u1, W u2) -+ { -+ return i; -+ } -+ -+ mixin(" -+ class F" ~ i ~ " -+ { -+ auto j(string s = \"a\", U)(U u1, U u2) -+ { -+ return this.outer.t" ~ i ~ ".j!(s, U)(u1, u2); -+ } -+ auto j(int i, string s = \"a\", W)(W u1, W u2) -+ { -+ return this.outer.t" ~ i ~ ".j!(i, s, W)(u1, u2); // <- dmd is giving error for j!(...).j's type -+ } -+ } -+ auto f" ~ i ~ "() -+ { -+ return new F" ~ i ~ "(); -+ } -+ "); -+} -+class X8441a -+{ -+ mixin T8441a!("1") t0; -+ alias t0 t1; -+} -+void test8441a() -+{ -+ auto x = new X8441a(); -+ x.f1().j!(3,"a")(2.2, 3.3); -+} -+ -+// ---- -+ -+mixin template T8441b() -+{ -+ void k()() {} -+ -+ void j()() {} -+ void j(int i)() {} -+} -+class X8441b -+{ -+ mixin T8441b t0; -+} -+void test8441b() -+{ -+ auto x = new X8441b(); -+ x.k!()(); // Fine -+ x.j!()(); // Fine -+ x.t0.k!()(); // Fine -+ x.t0.j!()(); // Derp -+} -+ -+// ---- -+ -+mixin template Signal8441c(Args...) -+{ -+ bool call = false; -+ final void connect(string method, ClassType)(ClassType obj) -+ if (is(ClassType == class) && __traits(compiles, { void delegate(Args) dg = mixin("&obj."~method); })) -+ { -+ call = true; -+ } -+} -+void test8441c() -+{ -+ class Observer -+ { -+ void watchInt(string str, int i) {} -+ } -+ class Bar -+ { -+ mixin Signal8441c!(string, int) s1; -+ mixin Signal8441c!(string, int) s2; -+ mixin Signal8441c!(string, long) s3; -+ } -+ auto a = new Bar; -+ auto o1 = new Observer; -+ -+ a.s1.connect!"watchInt"(o1); -+ -+ assert( a.s1.call); -+ assert(!a.s2.call); -+ assert(!a.s3.call); -+} -+ -+/***************************************************/ -+// 9235 -+ -+template FlowEvaluator9235() -+{ -+ // if control flow -+ bool execute(Command cmd)() -+ if (cmd == Command.Jump || -+ cmd == Command.Fork) -+ { -+ return false; -+ } -+} -+template MatchEvaluator9235() -+{ -+ // if operation -+ bool execute(Command cmd)() -+ if (cmd == Command.Char || -+ cmd == Command.Any || -+ cmd == Command.End) -+ { -+ return true; -+ } -+} -+void test9235a() -+{ -+ enum Command -+ { -+ Char, Any, Fork, Jump, End -+ } -+ struct Machine -+ { -+ mixin FlowEvaluator9235; -+ mixin MatchEvaluator9235; -+ -+ bool exec_flow() -+ { -+ return execute!(Command.Jump)(); -+ } -+ bool exec_match() -+ { -+ return execute!(Command.Any)(); -+ } -+ } -+ -+ Machine m; -+ assert(!m.exec_flow()); -+ assert( m.exec_match()); -+} -+ -+// ---- -+ -+version(none) // yet not implemented -+{ -+mixin template mixA9235() -+{ -+ int foo(string s)() if (s == "a") { return 1; } -+} -+mixin template mixB9235() -+{ -+ int foo(string s)() if (s == "b") { return 2; } -+} -+struct Foo9235 -+{ -+ mixin mixA9235 A; -+ mixin mixB9235 B; -+ alias A.foo foo; -+ alias B.foo foo; -+} -+void test9235b() -+{ -+ Foo9235 f; -+ assert(f.foo!"a"() == 1); -+ assert(f.foo!"b"() == 2); -+} -+} -+ -+/***************************************************/ - - int main() - { -+ test1528a(); -+ test1528b(); -+ test1528c(); -+ test1528d(); -+ test1680(); - test7418(); - test7552(); -+ test8668(); - test8943(); - test9410(); -+ test10171(); -+ test1900a(); -+ test1900b(); -+ test1900c(); -+ test1900d(); -+ test1900e(); -+ test7780(); -+ test8352(); -+ test8441a(); -+ test8441b(); -+ test8441c(); -+ test9235a(); -+ //test9235b(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/property2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/property2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -313,6 +313,151 @@ void test7275() - } - - /*****************************************/ -+// 7538 -+ -+void test7538() -+{ -+ struct P -+ { -+ @property long pr() { return 1; } -+ @property void pr(int) {} -+ -+ @property long a1()() { return 1; } -+ @property void a1()(int) {} -+ template a2() { @property long a2() { return 1; } } -+ template a2() { @property void a2(int) {} } -+ template a3() { long a3() @property { return 1; } } -+ template a3() { void a3(int) @property {} } -+ -+ static -+ { -+ @property long b1()() { return 1; } -+ @property void b1()(int) {} -+ template b2() { @property long b2() { return 1; } } -+ template b2() { @property void b2(int) {} } -+ template b3() { long b3() @property { return 1; } } -+ template b3() { void b3(int) @property {} } -+ } -+ -+ @property long c1(T)() { return 1; } -+ @property long c1(T)(int) { return 1; } -+ template c2(T) { @property long c2() { return 1; } } -+ template c2(T) { @property void c2(int) {} } -+ template c3(T) { long c3() @property { return 1; } } -+ template c3(T) { void c3(int) @property {} } -+ -+ static -+ { -+ @property long d1(T)() { return 1; } -+ @property void d1(T)(int) {} -+ template d2(T) { @property long d2() { return 1; } } -+ template d2(T) { @property void d2(int) {} } -+ template d3(T) { long d3() @property { return 1; } } -+ template d3(T) { void d3(int) @property {} } -+ } -+ -+ void test() -+ { -+ // TOKvar -+ static assert(is(typeof(pr) == long)); -+ -+ // TOKtemplate -+ static assert(is(typeof(b1) == long)); -+ static assert(is(typeof(b2) == long)); -+ static assert(is(typeof(b3) == long)); -+ -+ // TOKimport -+ static assert(is(typeof(d1!int) == long)); -+ static assert(is(typeof(d2!int) == long)); -+ static assert(is(typeof(d3!int) == long)); -+ } -+ } -+ P p; -+ { -+ // TOKdotvar -+ static assert(is(typeof(p.pr) == long)); -+ -+ // TOKdottd -+ static assert(is(typeof(p.a1) == long)); -+ static assert(is(typeof(p.a2) == long)); -+ static assert(is(typeof(p.a3) == long)); -+ -+ // TOKimport -+ static assert(is(typeof(P.b1) == long)); -+ static assert(is(typeof(P.b2) == long)); -+ static assert(is(typeof(P.b3) == long)); -+ -+ // TOKdotti; -+ static assert(is(typeof(p.c1!int) == long)); -+ static assert(is(typeof(p.c2!int) == long)); -+ static assert(is(typeof(p.c3!int) == long)); -+ } -+ -+ struct F -+ { -+ long fn() { return 1; } -+ void fn(int) {} -+ -+ long a1()() { return 1; } -+ void a1()(int) {} -+ template a2() { long a2() { return 1; } } -+ template a2() { void a2(int) {} } -+ -+ static -+ { -+ long b1()() { return 1; } -+ void b1()(int) {} -+ template b2() { long b2() { return 1; } } -+ template b2() { void b2(int) {} } -+ } -+ -+ long c1(T)() { return 1; } -+ long c1(T)(int) { return 1; } -+ template c2(T) { long c2() { return 1; } } -+ template c2(T) { void c2(int) {} } -+ -+ static -+ { -+ long d1(T)() { return 1; } -+ void d1(T)(int) {} -+ template d2(T) { long d2() { return 1; } } -+ template d2(T) { void d2(int) {} } -+ } -+ -+ void test() -+ { -+ // TOKvar -+ static assert( is(typeof(fn) == function)); -+ -+ // TOKtemplate -+ static assert(!is(typeof(b1) == long)); -+ static assert(!is(typeof(b2) == long)); -+ -+ // TOKimport -+ static assert(!is(typeof(d1!int) == long)); -+ static assert(!is(typeof(d2!int) == long)); -+ } -+ } -+ F f; -+ { -+ // TOKdotvar -+ static assert(is( typeof(f.fn) == function)); -+ -+ // TOKdottd -+ static assert(!is(typeof(f.a1) == long)); -+ static assert(!is(typeof(f.a2) == long)); -+ -+ // TOKimport -+ static assert(!is(typeof(F.b1) == long)); -+ static assert(!is(typeof(F.b2) == long)); -+ -+ // TOKdotti; -+ static assert(!is(typeof(f.c1!int) == long)); -+ static assert(!is(typeof(f.c2!int) == long)); -+ } -+} -+ -+/*****************************************/ - // 8251 - - struct S8251 -@@ -368,6 +513,84 @@ struct Foo9234(alias F) {} - struct Foo9234(string thunk) {} - - /*****************************************/ -+// 10103 -+ -+mixin template Getter10103() -+{ -+ @property auto foo() { return v; } -+ @property auto bar()() { return v; } -+ @property auto baz(T)() { return v; } -+ -+ static @property auto goo() { return 1; } -+} -+ -+mixin template Setter10103() -+{ -+ @property void foo(int x) { v = x; } -+ @property void bar()(int x) { v = x; } -+ @property void baz(T)(int x) { v = x; } -+ -+ static @property void goo(int x) {} -+} -+ -+struct Foo10103 -+{ -+ int v; -+ mixin Getter10103!(); -+ mixin Setter10103!(); -+} -+ -+void test10103() -+{ -+ auto f = Foo10103(4); -+ -+ f.foo; -+ f.foo = 3; -+ -+ f.bar; -+ f.bar = 3; -+ -+ f.baz!int; -+ f.baz!int = 3; -+ -+ Foo10103.goo = 3; -+} -+ -+/*****************************************/ -+// 10197 -+ -+template OriginalType10197(T) -+{ -+ static if (is(T U == enum)) -+ alias OriginalType10197 = U; -+ else -+ static assert(0); -+} -+ -+void test10197() -+{ -+ enum E : int { F = -20 } -+ struct S -+ { -+ int val; -+ @trusted @property T as(T)() -+ if (is(T == int) && !is(T == enum)) -+ { -+ return cast(T)(val); -+ } -+ @trusted @property T as(T)() -+ if (is(T == enum)) -+ { -+ return cast(T)as!(OriginalType10197!T); -+ } -+ } -+ -+ S val = S(-20); -+ assert(val.as!int == -20); -+ assert(val.as!E == E.F); -+} -+ -+/*****************************************/ - - int main() - { -@@ -378,7 +601,10 @@ int main() - test7174(); - test7274(); - test7275(); -+ test7538(); - test8251(); -+ test10103(); -+ test10197(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/sctor.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/sctor.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,215 @@ -+// REQUIRED_ARGS: -+// PERMUTE_ARGS: -w -d -de -dw -+ -+extern(C) int printf(const char*, ...); -+ -+/***************************************************/ -+// mutable field -+ -+struct S1A -+{ -+ int v; -+ this(int) -+ { -+ v = 1; -+ v = 2; // multiple initialization -+ } -+} -+ -+struct S1B -+{ -+ int v; -+ this(int) -+ { -+ if (true) v = 1; else v = 2; -+ v = 3; // multiple initialization -+ } -+ this(long) -+ { -+ if (true) v = 1; -+ v = 3; // multiple initialization -+ } -+ this(string) -+ { -+ if (true) {} else v = 2; -+ v = 3; // multiple initialization -+ } -+} -+ -+struct S1C -+{ -+ int v; -+ this(int) -+ { -+ true ? (v = 1) : (v = 2); -+ v = 3; // multiple initialization -+ } -+ this(long) -+ { -+ auto x = true ? (v = 1) : 2; -+ v = 3; // multiple initialization -+ } -+ this(string) -+ { -+ auto x = true ? 1 : (v = 2); -+ v = 3; // multiple initialization -+ } -+} -+ -+/***************************************************/ -+// with control flow -+ -+struct S2 -+{ -+ immutable int v; -+ immutable int w; -+ int x; -+ this(int) -+ { -+ if (true) v = 1; -+ else v = 2; -+ -+ true ? (w = 1) : (w = 2); -+ -+ x = 1; // initialization -+ L: x = 2; // assignment after labels -+ } -+ this(long n) -+ { -+ if (n > 0) -+ return; -+ v = 1; // skipped initialization -+ -+ // w skipped initialization -+ -+ x = 1; // initialization -+ foreach (i; 0..1) x = 2; // assignment in loops -+ } -+} -+ -+/***************************************************/ -+// with immutable constructor -+ -+struct S3 -+{ -+ int v; -+ int w; -+ this(int) immutable -+ { -+ if (true) v = 1; -+ else v = 2; -+ -+ true ? (w = 1) : (w = 2); -+ } -+} -+ -+/***************************************************/ -+// in typeof -+ -+struct S4 -+{ -+ immutable int v; -+ this(int) -+ { -+ static assert(is(typeof(v = 1))); -+ v = 1; -+ } -+} -+ -+/***************************************************/ -+// 9665 -+ -+struct X9665 -+{ -+ static uint count; -+ ulong payload; -+ this(int n) { payload = n; count += 1; } -+ this(string s) immutable { payload = s.length; count += 10; } -+ void opAssign(X9665 x) { payload = 100; count += 100; } -+} -+ -+struct S9665 -+{ -+ X9665 mval; -+ immutable X9665 ival; -+ this(int n) -+ { -+ X9665.count = 0; -+ mval = X9665(n); // 1st, initializing -+ ival = immutable X9665("hi"); // 1st, initializing -+ mval = X9665(1); // 2nd, assignment -+ static assert(!__traits(compiles, ival = immutable X9665(1))); // 2nd, assignment -+ //printf("X9665.count = %d\n", X9665.count); -+ assert(X9665.count == 112); -+ } -+ this(int[]) -+ { -+ X9665.count = 0; -+ mval = 1; // 1st, initializing (implicit constructor call) -+ ival = "hoo"; // ditto -+ assert(X9665.count == 11); -+ } -+} -+ -+void test9665() -+{ -+ S9665 s1 = S9665(1); -+ assert(s1.mval.payload == 100); -+ assert(s1.ival.payload == 2); -+ -+ S9665 s2 = S9665([]); -+ assert(s2.mval.payload == 1); -+ assert(s2.ival.payload == 3); -+} -+ -+/***************************************************/ -+// 11246 -+ -+struct Foo11246 -+{ -+ static int ctor = 0; -+ static int dtor = 0; -+ this(int i) -+ { -+ ++ctor; -+ } -+ -+ ~this() -+ { -+ ++dtor; -+ } -+} -+ -+struct Bar11246 -+{ -+ Foo11246 foo; -+ -+ this(int) -+ { -+ foo = Foo11246(5); -+ assert(Foo11246.ctor == 1); -+ assert(Foo11246.dtor == 0); -+ } -+} -+ -+void test11246() -+{ -+ { -+ auto bar = Bar11246(1); -+ assert(Foo11246.ctor == 1); -+ assert(Foo11246.dtor == 0); -+ } -+ assert(Foo11246.ctor == 1); -+ assert(Foo11246.dtor == 1); -+} -+ -+/***************************************************/ -+ -+int main() -+{ -+ test9665(); -+ test11246(); -+ -+ printf("Success\n"); -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/sdtor.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/sdtor.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,18 +3,20 @@ import core.vararg; - - extern (C) int printf(const(char*) fmt, ...); - -+template TypeTuple(T...) { alias TypeTuple = T; } -+ -+/**********************************/ -+ - int sdtor; - --struct S -+struct S1 - { - ~this() { printf("~S()\n"); sdtor++; } - } - --/**********************************/ -- - void test1() - { -- S* s = new S(); -+ S1* s = new S1(); - delete s; - assert(sdtor == 1); - } -@@ -1089,11 +1091,11 @@ struct S41 { - - void test41() - { -- auto s = new S41(3); -+ auto s = new immutable S41(3); - //writeln(typeid(typeof(s))); - static assert(is(typeof(s) == immutable(S41)*)); - -- auto t = S41(3); -+ auto t = immutable S41(3); - //writeln(typeid(typeof(t))); - static assert(is(typeof(t) == immutable(S41))); - } -@@ -1107,9 +1109,9 @@ class C42 { - - void test42() - { -- auto c = new C42(3); -+ static assert(!__traits(compiles, new C42(3))); - //writeln(typeid(typeof(c))); -- static assert(is(typeof(c) == immutable(C42))); -+ //static assert(is(typeof(c) == immutable(C42))); - - auto d = new immutable(C42)(3); - //writeln(typeid(typeof(d))); -@@ -1128,7 +1130,7 @@ void test43() - { - int i; - assert(!__traits(compiles, immutable(S43)(3, &i))); -- immutable int j = 4; -+ immutable int j = 4; - auto s = immutable(S43)(3, &j); - //writeln(typeid(typeof(s))); - static assert(is(typeof(s) == immutable(S43))); -@@ -1146,7 +1148,7 @@ void test44() - { - int i; - assert(!__traits(compiles, immutable(S44)(3, &i))); -- immutable int j = 4; -+ immutable int j = 4; - auto s = immutable(S44)(3, &j); - //writeln(typeid(typeof(s))); - static assert(is(typeof(s) == immutable(S44))); -@@ -2375,7 +2377,7 @@ struct Foo9320 { - real x; - - this(real x) { -- this.x = x; -+ this.x = x; - } - - Foo9320 opBinary(string op)(Foo9320 other) { -@@ -2388,6 +2390,707 @@ Foo9320 test9320(Foo9320 a, Foo9320 b, F - } - - /**********************************/ -+// 9386 -+ -+struct Test9386 -+{ -+ string name; -+ static string op; -+ -+ this(string name) -+ { -+ this.name = name; -+ printf("Created %.*s...\n", name.length, name.ptr); -+ op ~= "a"; -+ } -+ -+ this(this) -+ { -+ printf("Copied %.*s...\n", name.length, name.ptr); -+ op ~= "b"; -+ } -+ -+ ~this() -+ { -+ printf("Deleted %.*s\n", name.length, name.ptr); -+ op ~= "c"; -+ } -+} -+ -+void test9386() -+{ -+ { -+ Test9386.op = null; -+ -+ Test9386[] tests = -+ [ Test9386("one"), -+ Test9386("two"), -+ Test9386("three"), -+ Test9386("four") ]; -+ -+ assert(Test9386.op == "aaaa"); -+ Test9386.op = null; -+ -+ printf("----\n"); -+ foreach (Test9386 test; tests) -+ { -+ printf("\tForeach %.*s\n", test.name.length, test.name.ptr); -+ Test9386.op ~= "x"; -+ } -+ -+ assert(Test9386.op == "bxcbxcbxcbxc"); -+ Test9386.op = null; -+ -+ printf("----\n"); -+ foreach (ref Test9386 test; tests) -+ { -+ printf("\tForeach %.*s\n", test.name.length, test.name.ptr); -+ Test9386.op ~= "x"; -+ } -+ assert(Test9386.op == "xxxx"); -+ } -+ printf("====\n"); -+ { -+ Test9386.op = null; -+ -+ Test9386[Test9386] tests = -+ [ Test9386("1") : Test9386("one"), -+ Test9386("2") : Test9386("two"), -+ Test9386("3") : Test9386("three"), -+ Test9386("4") : Test9386("four") ]; -+ -+ assert(Test9386.op == "aaaaaaaa"); -+ Test9386.op = null; -+ -+ printf("----\n"); -+ foreach (Test9386 k, Test9386 v; tests) -+ { -+ printf("\tForeach %.*s : %.*s\n", k.name.length, k.name.ptr, -+ v.name.length, v.name.ptr); -+ Test9386.op ~= "x"; -+ } -+ -+ assert(Test9386.op == "bbxccbbxccbbxccbbxcc"); -+ Test9386.op = null; -+ -+ printf("----\n"); -+ foreach (Test9386 k, ref Test9386 v; tests) -+ { -+ printf("\tForeach %.*s : %.*s\n", k.name.length, k.name.ptr, -+ v.name.length, v.name.ptr); -+ Test9386.op ~= "x"; -+ } -+ assert(Test9386.op == "bxcbxcbxcbxc"); -+ } -+} -+ -+/**********************************/ -+// 9441 -+ -+auto x9441 = X9441(0.123); -+ -+struct X9441 -+{ -+ int a; -+ this(double x) { a = cast(int)(x * 100); } -+} -+ -+void test9441() -+{ -+ assert(x9441.a == 12); -+} -+ -+/**********************************/ -+ -+struct Payload -+{ -+ size_t _capacity; //Comment me -+ int[] _pay; //Comment me -+ -+ size_t insertBack(Data d) -+ { -+ immutable newLen = _pay.length + 3; -+ _pay.length = newLen; -+ _pay = _pay[0 .. newLen]; //Comment me -+ return 3; -+ } -+} -+ -+struct Impl -+{ -+ Payload _payload; -+ size_t _count; -+} -+ -+struct Data -+{ -+ Impl* _store; -+ -+ this(int i) -+ { -+ _store = new Impl; -+ _store._payload = Payload.init; -+ } -+ -+ ~this() -+ { -+ printf("%d\n", _store._count); -+ --_store._count; -+ } -+} -+ -+ -+void test9720() -+{ -+ auto a = Data(1); -+ auto b = Data(1); -+ a._store._payload.insertBack(b); //Fails -+} -+ -+/**********************************/ -+// 9899 -+ -+struct S9899 -+{ -+ @safe pure nothrow ~this() {} -+} -+ -+struct MemberS9899 -+{ -+ S9899 s; -+} -+ -+void test9899() @safe pure nothrow -+{ -+ MemberS9899 s; // 11 -+} -+ -+/**********************************/ -+// 9907 -+ -+void test9907() -+{ -+ static struct SX(bool hasCtor, bool hasDtor) -+ { -+ int i; -+ static size_t assign; -+ static size_t dtor; -+ -+ static if (hasCtor) -+ { -+ this(int i) { this.i = i; } -+ } -+ -+ void opAssign(SX rhs) -+ { -+ printf("%08X(%d) from Rvalue %08X(%d)\n", &this.i, this.i, &rhs.i, rhs.i); -+ ++assign; -+ } -+ -+ void opAssign(ref SX rhs) -+ { -+ printf("%08X(%d) from Lvalue %08X(%d)\n", &this.i, this.i, &rhs.i, rhs.i); -+ assert(0); -+ } -+ -+ static if (hasDtor) -+ { -+ ~this() -+ { -+ printf("destroying %08X(%d)\n", &this.i, this.i); -+ ++dtor; -+ } -+ } -+ } -+ -+ S test(S)(int i) -+ { -+ return S(i); -+ } -+ -+ foreach (hasCtor; TypeTuple!(false, true)) -+ foreach (hasDtor; TypeTuple!(false, true)) -+ { -+ alias S = SX!(hasCtor, hasDtor); -+ alias test!S foo; -+ -+ printf("----\n"); -+ auto s = S(1); -+ -+ // Assignment from two kinds of rvalues -+ assert(S.assign == 0); -+ s = foo(2); -+ static if (hasDtor) assert(S.dtor == 1); -+ assert(S.assign == 1); -+ s = S(3); -+ assert(S.assign == 2); -+ static if (hasDtor) assert(S.dtor == 2); -+ } -+ printf("----\n"); -+} -+ -+/**********************************/ -+// 9985 -+ -+struct S9985 -+{ -+ ubyte* b; -+ ubyte buf[128]; -+ this(this) { assert(0); } -+ -+ static void* ptr; -+} -+auto ref makeS9985() -+{ -+ S9985 s; -+ s.b = s.buf.ptr; -+ S9985.ptr = &s; -+ return s; -+} -+void test9985() -+{ -+ S9985 s = makeS9985(); -+ assert(S9985.ptr == &s); // NRVO -+ -+ static const int n = 1; -+ static auto ref retN() -+ { -+ return n; -+ } -+ auto p = &(retN()); // OK -+ assert(p == &n); -+ alias ref const(int) F1(); -+ static assert(is(typeof(retN) == F1)); -+ -+ enum const(int) x = 1; -+ static auto ref retX() -+ { -+ return x; -+ } -+ static assert(!__traits(compiles, { auto q = &(retX()); })); -+ alias const(int) F2(); -+ static assert(is(typeof(retX) == F2)); -+} -+ -+/**********************************/ -+// 9994 -+ -+void test9994() -+{ -+ static struct S -+ { -+ static int dtor; -+ ~this() { ++dtor; } -+ } -+ -+ S s; -+ static assert( __traits(compiles, s.opAssign(s))); -+ static assert(!__traits(compiles, s.__postblit())); -+ -+ assert(S.dtor == 0); -+ s = s; -+ assert(S.dtor == 1); -+} -+ -+/**********************************/ -+// 10053 -+ -+struct S10053A -+{ -+ pure ~this() {} -+} -+ -+struct S10053B -+{ -+ S10053A sa; -+ ~this() {} -+} -+ -+/**********************************/ -+// 10055 -+ -+void test10055a() -+{ -+ static struct SX { pure nothrow @safe ~this() {} } -+ static struct SY { pure nothrow @safe ~this() {} } -+ static struct SZ { @disable ~this() {} } -+ -+ // function to check merge result of the dtor attributes -+ static void check(S)() { S s; } -+ -+ static struct S1 { } -+ static struct S2 { ~this() {} } -+ static struct SA { SX sx; SY sy; } -+ static struct SB { SX sx; SY sy; pure nothrow @safe ~this() {} } -+ static struct SC { SX sx; SY sy; nothrow @safe ~this() {} } -+ static struct SD { SX sx; SY sy; pure @safe ~this() {} } -+ static struct SE { SX sx; SY sy; pure nothrow ~this() {} } -+ static struct SF { SX sx; SY sy; @safe ~this() {} } -+ static struct SG { SX sx; SY sy; nothrow ~this() {} } -+ static struct SH { SX sx; SY sy; pure ~this() {} } -+ static struct SI { SX sx; SY sy; ~this() {} } -+ static assert(is( typeof(&check!S1) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!S2) == void function() )); -+ static assert(is( typeof(&check!SA) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!SB) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!SC) == void function() nothrow @safe )); -+ static assert(is( typeof(&check!SD) == void function() pure @safe )); -+ static assert(is( typeof(&check!SE) == void function() pure nothrow )); -+ static assert(is( typeof(&check!SF) == void function() @safe )); -+ static assert(is( typeof(&check!SG) == void function() nothrow )); -+ static assert(is( typeof(&check!SH) == void function() pure )); -+ static assert(is( typeof(&check!SI) == void function() )); -+ -+ static struct S1x { SZ sz; } -+ static struct S2x { ~this() {} SZ sz; } -+ static struct SAx { SX sx; SY sy; SZ sz; } -+ static struct SBx { SX sx; SY sy; pure nothrow @safe ~this() {} SZ sz; } -+ static struct SCx { SX sx; SY sy; nothrow @safe ~this() {} SZ sz; } -+ static struct SDx { SX sx; SY sy; pure @safe ~this() {} SZ sz; } -+ static struct SEx { SX sx; SY sy; pure nothrow ~this() {} SZ sz; } -+ static struct SFx { SX sx; SY sy; @safe ~this() {} SZ sz; } -+ static struct SGx { SX sx; SY sy; nothrow ~this() {} SZ sz; } -+ static struct SHx { SX sx; SY sy; pure ~this() {} SZ sz; } -+ static struct SIx { SX sx; SY sy; ~this() {} SZ sz; } -+ foreach (Sx; TypeTuple!(S1x, S2x, SAx, SBx, SCx, SDx, SEx, SFx, SGx, SHx, SIx)) -+ { -+ static assert(!__traits(compiles, &check!Sx)); -+ } -+} -+ -+void test10055b() -+{ -+ static struct SX { pure nothrow @safe this(this) {} } -+ static struct SY { pure nothrow @safe this(this) {} } -+ static struct SZ { @disable this(this) {} } -+ -+ // function to check merge result of the postblit attributes -+ static void check(S)() { S s; S s2 = s; } -+ -+ static struct S1 { } -+ static struct S2 { this(this) {} } -+ static struct SA { SX sx; SY sy; } -+ static struct SB { SX sx; SY sy; pure nothrow @safe this(this) {} } -+ static struct SC { SX sx; SY sy; nothrow @safe this(this) {} } -+ static struct SD { SX sx; SY sy; pure @safe this(this) {} } -+ static struct SE { SX sx; SY sy; pure nothrow this(this) {} } -+ static struct SF { SX sx; SY sy; @safe this(this) {} } -+ static struct SG { SX sx; SY sy; nothrow this(this) {} } -+ static struct SH { SX sx; SY sy; pure this(this) {} } -+ static struct SI { SX sx; SY sy; this(this) {} } -+ static assert(is( typeof(&check!S1) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!S2) == void function() )); -+ static assert(is( typeof(&check!SA) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!SB) == void function() pure nothrow @safe )); -+ static assert(is( typeof(&check!SC) == void function() nothrow @safe )); -+ static assert(is( typeof(&check!SD) == void function() pure @safe )); -+ static assert(is( typeof(&check!SE) == void function() pure nothrow )); -+ static assert(is( typeof(&check!SF) == void function() @safe )); -+ static assert(is( typeof(&check!SG) == void function() nothrow )); -+ static assert(is( typeof(&check!SH) == void function() pure )); -+ static assert(is( typeof(&check!SI) == void function() )); -+ -+ static struct S1x { SZ sz; } -+ static struct S2x { this(this) {} SZ sz; } -+ static struct SAx { SX sx; SY sy; SZ sz; } -+ static struct SBx { SX sx; SY sy; pure nothrow @safe this(this) {} SZ sz; } -+ static struct SCx { SX sx; SY sy; nothrow @safe this(this) {} SZ sz; } -+ static struct SDx { SX sx; SY sy; pure @safe this(this) {} SZ sz; } -+ static struct SEx { SX sx; SY sy; pure nothrow this(this) {} SZ sz; } -+ static struct SFx { SX sx; SY sy; @safe this(this) {} SZ sz; } -+ static struct SGx { SX sx; SY sy; nothrow this(this) {} SZ sz; } -+ static struct SHx { SX sx; SY sy; pure this(this) {} SZ sz; } -+ static struct SIx { SX sx; SY sy; this(this) {} SZ sz; } -+ foreach (Sx; TypeTuple!(S1x, S2x, SAx, SBx, SCx, SDx, SEx, SFx, SGx, SHx, SIx)) -+ { -+ static assert(!__traits(compiles, &check!Sx)); -+ } -+} -+ -+/**********************************/ -+// 10160 -+ -+struct S10160 { this(this) {} } -+ -+struct X10160a { S10160 s; const int x; } -+struct X10160b { S10160 s; const int x = 1; } -+ -+void test10160() -+{ -+ X10160a xa; -+ X10160b xb; -+} -+ -+/**********************************/ -+// 10094 -+ -+void test10094() -+{ -+ static void* p; -+ const string[4] i2s = () -+ { -+ string[4] tmp; -+ p = &tmp[0]; -+ for (int i = 0; i < 4; ++i) -+ { -+ char[1] buf = [cast(char)('0' + i)]; -+ string str = buf.idup; -+ tmp[i] = str; -+ } -+ return tmp; // NRVO should work -+ }(); -+ assert(p == cast(void*)&i2s[0]); -+ assert(i2s == ["0", "1", "2", "3"]); -+} -+ -+/**********************************/ -+// 10079 -+ -+// dtor || postblit -+struct S10079a -+{ -+ this(this) pure nothrow @safe {} -+} -+struct S10079b -+{ -+ ~this() pure nothrow @safe {} -+} -+struct S10079c -+{ -+ this(this) pure nothrow @safe {} -+ ~this() pure nothrow @safe {} -+} -+struct S10079d -+{ -+ this(this) {} -+} -+struct S10079e -+{ -+ this(this) {} -+ ~this() pure nothrow @safe {} -+} -+ -+// memberwise -+struct S10079f -+{ -+ S10079a a; -+ S10079b b; -+ S10079c c; -+ S10079d d; -+ S10079e e; -+} -+ -+void check10079(S)(ref S s) pure nothrow @safe { s = S(); } -+ -+// Assignment is pure, nothrow, and @safe in all cases. -+static assert(__traits(compiles, &check10079!S10079a)); -+static assert(__traits(compiles, &check10079!S10079b)); -+static assert(__traits(compiles, &check10079!S10079c)); -+static assert(__traits(compiles, &check10079!S10079d)); -+static assert(__traits(compiles, &check10079!S10079e)); -+static assert(__traits(compiles, &check10079!S10079f)); -+ -+/**********************************/ -+// 10244 -+ -+void test10244() -+{ -+ static struct Foo -+ { -+ string _str; -+ long _num; -+ -+ template DeclareConstructor(string fieldName) -+ { -+ enum code = -+ `this(typeof(_` ~ fieldName ~ `) value)` ~ -+ `{ this._` ~ fieldName ~ ` = value; }`; -+ mixin(code); -+ } -+ -+ mixin DeclareConstructor!"str"; -+ mixin DeclareConstructor!"num"; -+ } -+ -+ Foo value1 = Foo("D"); -+ Foo value2 = Foo(128); -+ assert(value1._str == "D"); -+ assert(value2._num == 128); -+} -+ -+/**********************************/ -+// 10694 -+ -+struct Foo10694 { ~this() { } } -+ -+void test10694() pure -+{ -+ static Foo10694 i1; -+ __gshared Foo10694 i2; -+ void foo() pure -+ { -+ static Foo10694 j1; -+ __gshared Foo10694 j2; -+ } -+} -+ -+/**********************************/ -+// 10787 -+ -+int global10787; -+ -+static ~this() nothrow pure @safe -+{ -+ int* p; -+ static assert(!__traits(compiles, ++p)); -+ static assert(!__traits(compiles, ++global10787)); -+} -+ -+shared static ~this() nothrow pure @safe -+{ -+ int* p; -+ static assert(!__traits(compiles, ++p)); -+ static assert(!__traits(compiles, ++global10787)); -+} -+ -+/**********************************/ -+// 10789 -+ -+struct S10789 -+{ -+ static int count; -+ int value; -+ -+ this(int) { value = ++count; } -+ ~this() { --count; } -+ this(this) { value = ++count; assert(value == 3); } -+} -+ -+S10789 fun10789a(bool isCondExp)(bool cond) -+{ -+ S10789 s1 = S10789(42), s2 = S10789(24); -+ assert(S10789.count == 2); -+ static if (isCondExp) -+ { -+ return cond ? s1 : s2; -+ } -+ else -+ { -+ if (cond) -+ return s1; -+ else -+ return s2; -+ } -+} -+ -+auto fun10789b(bool isCondExp)(bool cond) -+{ -+ S10789 s1 = S10789(42), s2 = S10789(24); -+ assert(S10789.count == 2); -+ static if (isCondExp) -+ { -+ return cond ? s1 : s2; -+ } -+ else -+ { -+ if (cond) -+ return s1; -+ else -+ return s2; -+ } -+} -+ -+void test10789() -+{ -+ foreach (fun; TypeTuple!(fun10789a, fun10789b)) -+ foreach (isCondExp; TypeTuple!(false, true)) -+ { -+ { -+ S10789 s = fun!isCondExp(true); -+ assert(S10789.count == 1); -+ assert(s.value == 3); -+ } -+ assert(S10789.count == 0); -+ { -+ S10789 s = fun!isCondExp(false); -+ assert(S10789.count == 1); -+ assert(s.value == 3); -+ } -+ assert(S10789.count == 0); -+ } -+} -+ -+/**********************************/ -+// 11134 -+ -+void test11134() -+{ -+ void test(S)() -+ { -+ S s; -+ S[2] sa; -+ S[2][] dsa = [[S(), S()]]; -+ dsa.reserve(dsa.length + 2); // avoid postblit calls by GC -+ -+ S.count = 0; -+ dsa ~= sa; -+ assert(S.count == 2); -+ -+ S.count = 0; -+ dsa ~= [s, s]; -+ assert(S.count == 2); -+ } -+ -+ static struct SS -+ { -+ static int count; -+ this(this) { ++count; } -+ } -+ test!SS(); -+ -+ struct NS -+ { -+ static int count; -+ this(this) { ++count; } -+ } -+ test!NS(); -+} -+ -+/**********************************/ -+// 11197 -+ -+struct S11197a -+{ -+ this(bool) {} -+ this(this) {} -+} -+ -+struct S11197b -+{ -+ //this(bool) {} -+ this(this) {} -+} -+ -+void test11197() -+{ -+ S11197a[][string] aa1; -+ aa1["test"] ~= S11197a.init; -+ -+ S11197b[][string] aa2; -+ aa2["test"] ~= S11197b.init; -+} -+ -+/**********************************/ -+ -+struct S7474 { -+ float x; -+ ~this() {} -+} -+ -+void fun7474(T...)() { T x; } -+void test7474() { fun7474!S7474(); } -+ -+/**********************************/ - - int main() - { -@@ -2470,6 +3173,20 @@ int main() - test7579b(); - test8335(); - test8356(); -+ test9386(); -+ test9441(); -+ test9720(); -+ test9899(); -+ test9907(); -+ //test9985(); // BUG: NRVO unimplemented. -+ test9994(); -+ //test10094(); // BUG: NRVO unimplemented. -+ test10244(); -+ test10694(); -+ test10789(); -+ test11134(); -+ test11197(); -+ test7474(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/statictor.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/statictor.d 2014-04-01 16:32:51.000000000 +0100 -@@ -28,6 +28,14 @@ class Bar - static ~this() {printf("Bar static dtor\n");} - } - -+// 7533 -+struct Foo7533(int n) -+{ -+ pure static this() { } -+} -+ -+alias Foo7533!5 Bar7533; -+ - void main() - { - } ---- a/src/gcc/testsuite/gdc.test/runnable/structlit.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/structlit.d 2014-04-01 16:32:51.000000000 +0100 -@@ -345,6 +345,304 @@ void test14() - - /********************************************/ - -+void check15(T, ubyte results, A...)(A args) -+{ -+ // m c i s sc -+ enum m = (results & 0b_1_0_0_0_0) != 0; -+ enum c = (results & 0b_0_1_0_0_0) != 0; -+ enum i = (results & 0b_0_0_1_0_0) != 0; -+ enum s = (results & 0b_0_0_0_1_0) != 0; -+ enum sc = (results & 0b_0_0_0_0_1) != 0; -+ -+ // allocation on stack -+ static assert((is(typeof( T(args) ) U) && is(U == T )) == m); -+ static assert((is(typeof( const T(args) ) U) && is(U == const(T) )) == c); -+ static assert((is(typeof( immutable T(args) ) U) && is(U == immutable(T) )) == i); -+ static assert((is(typeof( shared T(args) ) U) && is(U == shared(T) )) == s); -+ static assert((is(typeof( shared const T(args) ) U) && is(U == shared(const T) )) == sc); -+ -+ // allocation on heap -+ static assert((is(typeof( new T(args) ) U) && is(U == T *)) == m); -+ static assert((is(typeof( new const T(args) ) U) && is(U == const(T)*)) == c); -+ static assert((is(typeof( new immutable T(args) ) U) && is(U == immutable(T)*)) == i); -+ static assert((is(typeof( new shared T(args) ) U) && is(U == shared(T)*)) == s); -+ static assert((is(typeof( new shared const T(args) ) U) && is(U == shared(const T)*)) == sc); -+} -+void test15a() -+{ -+ static struct Foo1 { this(int v) {} int value; } -+ static struct Boo1 { this(int v) const {} int[] value; } -+ static struct Bar1 { this(int[] v) {} int[] value; } -+ static struct Baz1 { this(const int[] v) pure {} int[] value; } // unique ctor -+ static struct Coo1 { this(int[] v) immutable {} int[] value; } -+ static struct Car1 { this(int[] v) immutable {} immutable(int)[] value; } -+ check15!(Foo1, 0b_1_1_0_0_0)(1); -+ check15!(Boo1, 0b_0_1_0_0_0)(1); -+ check15!(Bar1, 0b_1_1_0_0_0)(null); -+ check15!(Baz1, 0b_1_1_1_1_1)(null); -+ check15!(Coo1, 0b_0_1_1_0_1)(null); -+ check15!(Car1, 0b_0_1_1_0_1)(null); -+ // m c i s sc -+ -+ // Template constructor should work as same as non-template ones -+ static struct Foo2 { this()(int v) {} int value; } -+ static struct Boo2 { this()(int v) const {} int[] value; } -+ static struct Bar2 { this()(int[] v) {} int[] value; } // has mutable indieection -+ static struct Baz2 { this()(const int[] v) pure {} int[] value; } // unique ctor -+ static struct Coo2 { this()(int[] v) immutable {} int[] value; } -+ static struct Car2 { this()(int[] v) immutable {} immutable(int)[] value; } -+ check15!(Foo2, 0b_1_1_0_0_0)(1); -+ check15!(Boo2, 0b_0_1_0_0_0)(1); -+ check15!(Bar2, 0b_1_1_0_0_0)(null); -+ check15!(Baz2, 0b_1_1_1_1_1)(null); -+ check15!(Coo2, 0b_0_1_1_0_1)(null); -+ check15!(Car2, 0b_0_1_1_0_1)(null); -+ // m c i s sc -+ -+ // Except Bar!().__ctor, their constructors are inferred to pure, then they become unique ctors. -+ static struct Foo3() { this(int v) {} int value; } -+ static struct Boo3() { this(int v) const {} int[] value; } -+ static struct Bar3() { this(int[] v) {} int[] value; } // has mutable indieection -+ static struct Baz3() { this(const int[] v) pure {} int[] value; } // unique ctor -+ static struct Coo3() { this(int[] v) immutable {} int[] value; } -+ static struct Car3() { this(int[] v) immutable {} immutable(int)[] value; } -+ check15!(Foo3!(), 0b_1_1_1_1_1)(1); -+ check15!(Boo3!(), 0b_1_1_1_1_1)(1); -+ check15!(Bar3!(), 0b_1_1_0_0_0)(null); -+ check15!(Baz3!(), 0b_1_1_1_1_1)(null); -+ check15!(Coo3!(), 0b_1_1_1_1_1)(null); -+ check15!(Car3!(), 0b_1_1_1_1_1)(null); -+ // m c i s sc -+} -+ -+// inout constructor works as like unique constructor in many cases -+void test15b() -+{ -+ static struct Nullable1 -+ { -+ private int[] _value; -+ private bool _isNull = true; -+ this(inout int[] v) inout //pure -+ { -+ _value = v; -+ //static int g; auto x = g; // impure access -+ _isNull = false; -+ } -+ } -+ static assert( __traits(compiles, Nullable1([1,2,3]))); -+ static assert(!__traits(compiles, Nullable1([1,2,3].idup))); -+ static assert(!__traits(compiles, immutable Nullable1([1,2,3]))); -+ static assert( __traits(compiles, immutable Nullable1([1,2,3].idup))); -+ static assert(!__traits(compiles, shared Nullable1([1,2,3]))); -+ static assert(!__traits(compiles, shared Nullable1([1,2,3].idup))); -+ -+ static struct Nullable2(T) -+ { -+ private T _value; -+ private bool _isNull = true; -+ this(inout T v) inout //pure -+ { -+ _value = v; -+ //static int g; auto x = g; // impure access -+ _isNull = false; -+ } -+ } -+ static assert( __traits(compiles, Nullable2!(int[])([1,2,3]))); -+ static assert(!__traits(compiles, Nullable2!(int[])([1,2,3].idup))); -+ static assert(!__traits(compiles, immutable Nullable2!(int[])([1,2,3]))); -+ static assert( __traits(compiles, immutable Nullable2!(int[])([1,2,3].idup))); -+ static assert(!__traits(compiles, shared Nullable2!(int[])([1,2,3]))); -+ static assert(!__traits(compiles, shared Nullable2!(int[])([1,2,3].idup))); -+ -+ // ctor is inout pure, but cannot create unique object. -+ struct S -+ { -+ int[] marr; -+ const int[] carr; -+ immutable int[] iarr; -+ this(int[] m, const int[] c, immutable int[] i) inout pure -+ { -+ static assert(!__traits(compiles, marr = m)); -+ carr = c; -+ iarr = i; -+ } -+ } -+ static assert(!__traits(compiles, { int[] ma; immutable int[] ia; auto m = S(ma, ma, ia); })); -+ static assert( __traits(compiles, { int[] ma; immutable int[] ia; auto c = const S(ma, ma, ia); })); -+ static assert(!__traits(compiles, { int[] ma; immutable int[] ia; auto i = immutable S(ma, ma, ia); })); -+} -+ -+// TemplateThisParameter with constructor should work -+void test15c() -+{ -+ static class C -+ { -+ this(this This)() -+ { -+ static assert(is(This == immutable C)); -+ } -+ -+ this(T = void, this This)(int) -+ { -+ static assert(is(This == immutable C)); -+ } -+ } -+ auto c1 = new immutable C; -+ auto c2 = new immutable C(1); -+} -+ -+void test15d() // Bugzilla 9974 -+{ -+ class CM { this() {} } -+ auto cm = new CM(); -+ -+ const class CC { this() {} } -+ const cc = new const CC(); -+ -+ immutable class CI { this() {} } -+ immutable ci = new immutable CI(); -+ -+ shared class CS { this() {} } -+ shared cs = new shared CS(); -+ -+ shared const class CSC { this() {} } -+ shared const csc = new shared const CSC(); -+ -+ -+ struct SM { this(int) {} } -+ auto sm = new SM(1); -+ -+ const struct SC { this(int) {} } -+ const sc = new const SC(1); -+ -+ immutable struct SI { this(int) {} } -+ immutable si = new immutable SI(1); -+ -+ shared struct SS { this(int) {} } -+ shared ss = new shared SS(1); -+ -+ shared const struct SSC { this(int) {} } -+ shared const ssc = new shared const SSC(1); -+} -+ -+void test15e() // Bugzilla 10005 -+{ -+ // struct literal -+ static struct S -+ { -+ int[] a; -+ } -+ int[] marr = [1,2,3]; -+ static assert( __traits(compiles, { S m = S(marr); })); -+ static assert( __traits(compiles, { const S c = S(marr); })); -+ static assert(!__traits(compiles, { immutable S i = S(marr); })); -+ immutable int[] iarr = [1,2,3]; -+ static assert(!__traits(compiles, { S m = immutable S(iarr); })); -+ static assert( __traits(compiles, { const S c = immutable S(iarr); })); -+ static assert( __traits(compiles, { immutable S i = immutable S(iarr); })); -+ -+ // mutable constructor -+ static struct MS -+ { -+ int[] a; -+ this(int n) { a = new int[](n); } -+ } -+ static assert( __traits(compiles, { MS m = MS(3); })); -+ static assert( __traits(compiles, { const MS c = MS(3); })); -+ static assert(!__traits(compiles, { immutable MS i = MS(3); })); -+ static assert(!__traits(compiles, { MS m = immutable MS(3); })); -+ static assert(!__traits(compiles, { const MS c = immutable MS(3); })); -+ static assert(!__traits(compiles, { immutable MS i = immutable MS(3); })); -+ -+ // immutable constructor -+ static struct IS -+ { -+ int[] a; -+ this(int n) immutable { a = new int[](n); } -+ } -+ static assert(!__traits(compiles, { IS m = IS(3); })); -+ static assert(!__traits(compiles, { const IS c = IS(3); })); -+ static assert(!__traits(compiles, { immutable IS i = IS(3); })); -+ static assert(!__traits(compiles, { IS m = immutable IS(3); })); -+ static assert( __traits(compiles, { const IS c = immutable IS(3); })); -+ static assert( __traits(compiles, { immutable IS i = immutable IS(3); })); -+} -+ -+struct Foo9984 -+{ -+ int[] p; -+ // Prefix storage class and tempalte constructor -+ inout this()(inout int[] a) { p = a; } -+ auto foo() inout { return inout(Foo9984)(p); } -+} -+ -+void test9993a() -+{ -+ static class A -+ { -+ int x; -+ this() { x = 13; } -+ this() immutable { x = 42; } -+ } -+ A ma = new A; assert(ma.x == 13); -+ immutable A ia = new immutable A; assert(ia.x == 42); -+ static assert(!__traits(compiles, { immutable A ia = new A; })); -+ -+ static class B -+ { -+ int x; -+ this() { x = 13; } -+ this() const { x = 42; } -+ } -+ const B mb = new B; assert(mb.x == 13); -+ const B cb = new const B; assert(cb.x == 42); -+ static assert(!__traits(compiles, { immutable B ib = new B; })); -+ -+ static class C -+ { -+ int x; -+ this() const { x = 13; } -+ this() immutable { x = 42; } -+ } -+ const C cc = new const C; assert(cc.x == 13); -+ immutable C ic = new immutable C; assert(ic.x == 42); -+ static assert(!__traits(compiles, { C mc = new C; })); -+} -+void test9993b() -+{ -+ static class A -+ { -+ int x; -+ this()() { x = 13; } -+ this()() immutable { x = 42; } -+ } -+ A ma = new A; assert(ma.x == 13); -+ immutable A ia = new immutable A; assert(ia.x == 42); -+ static assert(!__traits(compiles, { immutable A ia = new A; })); -+ -+ static class B -+ { -+ int x; -+ this()() { x = 13; } -+ this()() const { x = 42; } -+ } -+ const B mb = new B; assert(mb.x == 13); -+ const B cb = new const B; assert(cb.x == 42); -+ static assert(!__traits(compiles, { immutable B ib = new B; })); -+ -+ static class C -+ { -+ int x; -+ this()() const { x = 13; } -+ this()() immutable { x = 42; } -+ } -+ const C cc = new const C; assert(cc.x == 13); -+ immutable C ic = new immutable C; assert(ic.x == 42); -+ static assert(!__traits(compiles, { C mc = new C; })); -+} -+ -+/********************************************/ -+ - struct Bug1914a - { - const char[10] i = [1,0,0,0,0,0,0,0,0,0]; -@@ -480,6 +778,23 @@ void test5889() - } - - /********************************************/ -+// 4147 -+ -+struct S4247 -+{ -+ int n = 1024; -+ this(int x) { n = x; } -+} -+void test4247() -+{ -+ auto p1 = S4247(); -+ assert(p1.n == 1024); -+ -+ auto p2 = S4247(1); -+ assert(p2.n == 1); -+} -+ -+/********************************************/ - // 6937 - - void test6937() -@@ -536,6 +851,102 @@ void test6937() - } - - /********************************************/ -+// 7727 -+ -+union U7727A1 { int i; double d; } -+union U7727A2 { int i = 123; double d; } -+//union U7727A3 { int i; double d = 2.5; } -+ -+union U7727B1 { double d; int i; } -+union U7727B2 { double d = 2.5; int i; } -+//union U7727B3 { double d; int i = 123; } -+ -+void test7727() -+{ -+ import core.stdc.math : isnan; -+ -+ { U7727A1 u; assert(u.i == 0); } -+ { U7727A1 u = { i: 1024 }; assert(u.i == 1024); } -+ { U7727A1 u = { d: 1.225 }; assert(u.d == 1.225); } -+ static assert(!__traits(compiles, -+ { U7727A1 u = { i: 1024, d: 1.225 }; } -+ )); -+ -+ { U7727A2 u; assert(u.i == 123); } -+ { U7727A2 u = { i: 1024 }; assert(u.i == 1024); } -+ { U7727A2 u = { d: 1.225 }; assert(u.d == 1.225); } -+ static assert(!__traits(compiles, -+ { U7727A2 u = { i: 1024, d: 1.225 }; } -+ )); -+ -+// Blocked by issue 1432 -+// { U7727A3 u; assert(u.d == 2.5); } -+// { U7727A3 u = { i: 1024 }; assert(u.i == 1024); } -+// { U7727A3 u = { d: 1.225 }; assert(u.d == 1.225); } -+// static assert(!__traits(compiles, -+// { U7727A3 u = { i: 1024, d: 1.225 }; } -+// )); -+ -+ { U7727B1 u; assert(isnan(u.d)); } -+ { U7727B1 u = { i: 1024 }; assert(u.i == 1024); } -+ { U7727B1 u = { d: 1.225 }; assert(u.d == 1.225); } -+ static assert(!__traits(compiles, -+ { U7727B1 u = { i: 1024, d: 1.225 }; } -+ )); -+ -+ { U7727B2 u; assert(u.d == 2.5); } -+ { U7727B2 u = { i: 1024 }; assert(u.i == 1024); } -+ { U7727B2 u = { d: 1.225 }; assert(u.d == 1.225); } -+ static assert(!__traits(compiles, -+ { U7727B2 u = { i: 1024, d: 1.225 }; } -+ )); -+ -+// Blocked by issue 1432 -+// { U7727B3 u; assert(u.i == 123); } -+// { U7727B3 u = { i: 1024 }; assert(u.i == 1024); } -+// { U7727B3 u = { d: 1.225 }; assert(u.d == 1.225); } -+// static assert(!__traits(compiles, -+// { U7727B3 u = { i: 1024, d: 1.225 }; } -+// )); -+ -+ -+ test7727a(); -+ test7727b(); -+} -+ -+// -------- -+ -+struct Foo7727a -+{ -+ ushort bar2; -+} -+struct Foo7727b -+{ -+ union -+ { -+ ubyte[2] bar1; -+ ushort bar2; -+ } -+} -+ -+void test7727a() -+{ -+ immutable Foo7727a foo1 = { bar2: 100 }; // OK -+ immutable Foo7727b foo2 = { bar2: 100 }; // OK <-- error -+} -+ -+// -------- -+ -+struct S7727 { int i; double d; } -+union U7727 { int i; double d; } -+ -+void test7727b() -+{ -+ S7727 s = { d: 5 }; // OK -+ U7727 u = { d: 5 }; // OK <-- Error: is not a static and cannot have static initializer -+} -+ -+/********************************************/ - // 7929 - - void test7929() -@@ -569,6 +980,44 @@ void test7021() - } - - /********************************************/ -+// 8763 -+ -+void test8763() -+{ -+ struct S -+ { -+ this(int) {} -+ } -+ -+ void foo(T, Args...)(Args args) -+ { -+ T t = T(args); -+ // Error: constructor main.S.this (int) is not callable using argument types () -+ } -+ -+ S t = S(); // OK, initialize to S.init -+ foo!S(); -+} -+ -+/********************************************/ -+// 8902 -+ -+union U8902 { int a, b; } -+ -+enum U8902 u8902a = U8902.init; // No errors -+U8902 u8902b; // No errors -+U8902 u8902c = U8902.init; // Error: duplicate union initialization for b -+ -+void test8902() -+{ -+ U8902 u8902d = U8902.init; // No errors -+ immutable U8902 u8902e = U8902.init; // No errors -+ immutable static U8902 u8902f = U8902.init; // Error: duplicate union... -+ static U8902 u8902g = u8902e; // Error: duplicate union... -+ static U8902 u8902h = U8902.init; // Error: duplicate union... -+} -+ -+/********************************************/ - // 9116 - - void test9116() -@@ -628,6 +1077,137 @@ void test9566() - } - - /********************************************/ -+// 9775 -+ -+enum Month9775 : ubyte { jan = 1, } -+struct Date9775 -+{ -+ this(int year, int month, int day) pure -+ { -+ _year = cast(short)year; -+ _month = cast(Month9775)month; -+ _day = cast(ubyte)day; -+ } -+ short _year = 1; -+ Month9775 _month = Month9775.jan; -+ ubyte _day = 1; -+} -+ -+const Date9775 date9775c1 = Date9775(2012, 12, 21); -+const date9775c2 = Date9775(2012, 12, 21); -+enum Date9775 date9775e1 = Date9775(2012, 12, 21); -+enum date9775e2 = Date9775(2012, 12, 21); -+ -+/********************************************/ -+// 11105 -+ -+struct S11105 -+{ -+ int[2][1] a21; -+} -+ -+void test11105() -+{ -+ S11105 s = S11105([1, 2]); -+} -+ -+/********************************************/ -+// 11147 -+ -+struct V11147 -+{ -+ union -+ { -+ struct -+ { -+ float x = 0; -+ float y = 0; -+ float z = 0; -+ } -+ struct -+ { -+ float r; -+ float g; -+ float b; -+ } -+ } -+} -+ -+void test11147() -+{ -+ auto v = V11147.init; -+ assert(v.x == 0f); -+ assert(v.y == 0f); -+ assert(v.z == 0f); -+ assert(v.r == 0f); -+ assert(v.g == 0f); -+ assert(v.b == 0f); -+} -+ -+/********************************************/ -+// 11256 -+ -+struct S11256 { @disable this(); } -+ -+struct Z11256a(Ranges...) -+{ -+ Ranges ranges; -+ this(Ranges rs) { ranges = rs; } -+} -+struct Z11256b(Ranges...) -+{ -+ Ranges ranges = Ranges.init; // Internal error: e2ir.c 5321 -+ this(Ranges rs) { ranges = rs; } -+} -+struct Z11256c(Ranges...) -+{ -+ Ranges ranges = void; // todt.c(475) v->type->ty == Tsarray && vsz == 0 -+ this(Ranges rs) { ranges = rs; } -+} -+ -+struct F11256(alias pred) -+{ -+ this(int[] = null) { } -+} -+ -+Z!Ranges z11256(alias Z, Ranges...)(Ranges ranges) -+{ -+ return Z!Ranges(ranges); -+} -+ -+void test11256() -+{ -+ z11256!Z11256a(S11256.init, F11256!(gv => true)()); -+ z11256!Z11256b(S11256.init, F11256!(gv => true)()); -+ z11256!Z11256c(S11256.init, F11256!(gv => true)()); -+} -+ -+/********************************************/ -+// 11269 -+ -+struct Atom -+{ -+ union -+ { -+ int i; -+ struct -+ { -+ ulong first, rest; -+ } -+ struct -+ { -+ uint a, b; -+ } -+ } -+} -+ -+void test11269() -+{ -+ Atom a1; -+ Atom a2 = {i:1, rest:10, b:2}; -+} -+ -+/********************************************/ - - int main() - { -@@ -645,15 +1225,29 @@ int main() - test12(); - test13(); - test14(); -+ test15a(); -+ test15b(); -+ test15c(); -+ test15d(); -+ test15e(); -+ test9993a(); -+ test9993b(); - test3198and1914(); - test5885(); - test5889(); -+ test4247(); - test6937(); -+ test7727(); - test7929(); - test7021(); -+ test8763(); -+ test8902(); - test9116(); - test9293(); - test9566(); -+ test11105(); -+ test11147(); -+ test11256(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/template1.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/template1.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1456,6 +1456,8 @@ void test60() - assert(thing1.sizeof == 16); - else version (X86_64) - assert(thing1.sizeof == 16); -+ else version(ARM) -+ assert(thing1.sizeof == 16); - else - assert(thing1.sizeof == 12); - assert(thing2.sizeof == 8); ---- a/src/gcc/testsuite/gdc.test/runnable/template9.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/template9.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,7 +2,7 @@ - - module breaker; - --import std.c.stdio; -+import core.stdc.stdio, core.vararg; - - /**********************************/ - -@@ -266,6 +266,22 @@ void test5893() - } - - /**********************************/ -+// 5988 -+ -+template Templ5988(alias T) -+{ -+ alias T!int Templ5988; -+} -+ -+class C5988a(T) { Templ5988!C5988a foo; } -+//Templ5988!C5988a foo5988a; // Commented version -+void test5988a() { C5988a!int a; } // Was error, now works -+ -+class C5988b(T) { Templ5988!C5988b foo; } -+Templ5988!C5988b foo5988b; // Uncomment version -+void test5988b() { C5988b!int a; } // Works -+ -+/**********************************/ - // 6404 - - // receive only rvalue -@@ -332,7 +348,7 @@ void test2246(){ - /**********************************/ - // 2296 - --void foo2296(uint D)(int[D] i...){} -+void foo2296(size_t D)(int[D] i...){} - void test2296() - { - foo2296(1, 2, 3); -@@ -392,16 +408,38 @@ static assert(is(typeof(bug4953(3)))); - /**********************************/ - // 5886 & 5393 - --struct K5886 { -- void get1(this T)() const { -+mixin template Foo5886(T) -+{ -+ void foo(U : T, this X)() const { static assert(is(X == const K5886)); } -+} -+ -+struct K5886 -+{ -+ void get1(this T)() const -+ { - pragma(msg, T); - } -- void get2(int N=4, this T)() const { -+ void get2(int N=4, this T)() const -+ { - pragma(msg, N, " ; ", T); - } -+ -+ mixin Foo5886!double; -+ mixin Foo5886!string; -+ -+ void test() const -+ { -+ get1; // OK -+ get2; // OK -+ get2!8; // NG -+ -+ foo!(int); -+ foo!(typeof(null)); -+ } - } - --void test5886() { -+void test5886() -+{ - K5886 km; - const(K5886) kc; - immutable(K5886) ki; -@@ -461,6 +499,30 @@ void test5896() - } - - /**********************************/ -+// 6312 -+ -+void h6312() {} -+ -+class Bla6312 -+{ -+ mixin wrap6312!h6312; -+} -+ -+mixin template wrap6312(alias f) -+{ -+ void blub(alias g = f)() -+ { -+ g(); -+ } -+} -+ -+void test6312() -+{ -+ Bla6312 b = new Bla6312(); -+ b.blub(); -+} -+ -+/**********************************/ - // 6825 - - void test6825() -@@ -1143,6 +1205,25 @@ void test7563() - } - - /**********************************/ -+// 7572 -+ -+class F7572 -+{ -+ Tr fn7572(Tr, T...)(T t) { return 1; } -+} -+Tr Fn7572(Tr, T...)(T t) { return 2; } -+ -+void test7572() -+{ -+ F7572 f = new F7572(); -+ int delegate() dg = &f.fn7572!int; -+ assert(dg() == 1); -+ -+ int function() fn = &Fn7572!int; -+ assert(fn() == 2); -+} -+ -+/**********************************/ - // 7580 - - struct S7580(T) -@@ -1218,7 +1299,7 @@ template T7643(A...){ alias A T7643; } - - alias T7643!(long, "x", string, "y") Specs7643; - --alias T7643!( Specs7643[] ) U7643; // Error: tuple A is used as a type -+alias T7643!( Specs7643[] ) U7643; // Error: tuple A is used as a type - - /**********************************/ - // 7671 -@@ -1313,6 +1394,7 @@ struct Bar7755 - - /**********************************/ - -+ U[] id11a(U)( U[] ); - inout(U)[] id11a(U)( inout(U)[] ); - inout(U[]) id11a(U)( inout(U[]) ); - inout(shared(U[])) id11a(U)( inout(shared(U[])) ); -@@ -1547,6 +1629,105 @@ void test8129() - } - - /**********************************/ -+// 8238 -+ -+void test8238() -+{ -+ static struct S { template t(){ int t; } } -+ -+ S s1, s2; -+ assert(cast(void*)&s1 != cast(void*)&s2 ); -+ assert(cast(void*)&s1 != cast(void*)&s1.t!()); -+ assert(cast(void*)&s2 != cast(void*)&s2.t!()); -+ assert(cast(void*)&s1.t!() == cast(void*)&s2.t!()); -+ s1.t!() = 256; -+ assert(s2.t!() == 256); -+} -+ -+/**********************************/ -+// 8669 -+ -+struct X8669 -+{ -+ void mfoo(this T)() -+ { -+ static assert(is(typeof(this) == T)); -+ } -+ void cfoo(this T)() const -+ { -+ static assert(is(typeof(this) == const(T))); -+ } -+ void sfoo(this T)() shared -+ { -+ static assert(is(typeof(this) == shared(T))); -+ } -+ void scfoo(this T)() shared const -+ { -+ static assert(is(typeof(this) == shared(const(T)))); -+ } -+ void ifoo(this T)() immutable -+ { -+ static assert(is(typeof(this) == immutable(T))); -+ } -+} -+ -+void test8669() -+{ -+ X8669 mx; -+ const X8669 cx; -+ immutable X8669 ix; -+ shared X8669 sx; -+ shared const X8669 scx; -+ -+ mx.mfoo(); -+ cx.mfoo(); -+ ix.mfoo(); -+ sx.mfoo(); -+ scx.mfoo(); -+ -+ mx.cfoo(); -+ cx.cfoo(); -+ ix.cfoo(); -+ sx.cfoo(); -+ scx.cfoo(); -+ -+ static assert(!is(typeof( mx.sfoo() ))); -+ static assert(!is(typeof( cx.sfoo() ))); -+ ix.sfoo(); -+ sx.sfoo(); -+ scx.sfoo(); -+ -+ static assert(!is(typeof( mx.scfoo() ))); -+ static assert(!is(typeof( cx.scfoo() ))); -+ ix.scfoo(); -+ sx.scfoo(); -+ scx.scfoo(); -+ -+ static assert(!is(typeof( mx.ifoo() ))); -+ static assert(!is(typeof( cx.ifoo() ))); -+ ix.ifoo(); -+ static assert(!is(typeof( sx.ifoo() ))); -+ static assert(!is(typeof( scx.ifoo() ))); -+} -+ -+/**********************************/ -+// 8833 -+ -+template TypeTuple8833(T...) { alias TypeTuple = T; } -+ -+void func8833(alias arg)() { } -+ -+void test8833() -+{ -+ int x, y; -+ -+ alias TypeTuple8833!( -+ func8833!(x), -+ func8833!(y), -+ ) Map; -+} -+ -+/**********************************/ - // 8976 - - void f8976(ref int) { } -@@ -1620,6 +1801,51 @@ static assert(!__traits(compiles, Inst90 - static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert fails - - /**********************************/ -+// 9022 -+ -+class C9022 -+{ -+ struct X {} -+ -+ alias B = X; -+} -+class D9022 -+{ -+ struct X {} -+} -+ -+void test9022() -+{ -+ auto c = new C9022(); -+ auto d = new D9022(); -+ auto cx = C9022.X(); -+ auto dx = D9022.X(); -+ -+ void foo1(T)(T, T.X) { static assert(is(T == C9022)); } -+ void foo2(T)(T.X, T) { static assert(is(T == C9022)); } -+ foo1(c, cx); -+ foo2(cx, c); -+ -+ void hoo1(T)(T, T.B) { static assert(is(T == C9022)); } -+ void hoo2(T)(T.B, T) { static assert(is(T == C9022)); } -+ hoo1(c, cx); -+ hoo1(c, cx); -+ -+ void bar1(alias A)(A.C9022, A.D9022) { static assert(A.stringof == "module breaker"); } -+ void bar2(alias A)(A.D9022, A.C9022) { static assert(A.stringof == "module breaker"); } -+ bar1(c, d); -+ bar2(d, c); -+ -+ void var1(alias A)(A.C9022, A.D9022.X) { static assert(A.stringof == "module breaker"); } -+ void var2(alias A)(A.D9022.X, A.C9022) { static assert(A.stringof == "module breaker"); } -+ var1(c, dx); -+ var2(dx, c); -+ -+ void baz(T)(T.X t, T.X u) { } -+ static assert(!__traits(compiles, baz(cx, dx))); -+} -+ -+/**********************************/ - // 9026 - - mixin template node9026() -@@ -1939,6 +2165,708 @@ void test9361() - } - - /**********************************/ -+// 9536 -+ -+struct S9536 -+{ -+ static A foo(A)(A a) -+ { -+ return a * 2; -+ } -+ int bar() const -+ { -+ return foo(42); -+ } -+} -+ -+void test9536() -+{ -+ S9536 s; -+ assert(s.bar() == 84); -+} -+ -+/**********************************/ -+// 9578 -+ -+template t9578(alias f) { void tf()() { f(); } } -+ -+void g9578a(alias f)() { f(); } // Error -> OK -+void g9578b(alias ti)() { ti.tf(); } // Error -> OK -+ -+void test9578() -+{ -+ int i = 0; -+ int m() { return i; } -+ -+ g9578a!(t9578!m.tf)(); -+ g9578b!(t9578!m)(); -+} -+ -+/**********************************/ -+// 9596 -+ -+int foo9596a(K, V)(inout( V [K])) { return 1; } -+int foo9596a(K, V)(inout(shared(V) [K])) { return 2; } -+ -+int foo9596b(K, V)(inout( V [K])) { return 1; } -+int foo9596b(K, V)(inout( const(V) [K])) { return 3; } -+ -+int foo9596c(K, V)(inout(shared(V) [K])) { return 2; } -+int foo9596c(K, V)(inout( const(V) [K])) { return 3; } -+ -+int foo9596d(K, V)(inout( V [K])) { return 1; } -+int foo9596d(K, V)(inout(shared(V) [K])) { return 2; } -+int foo9596d(K, V)(inout( const(V) [K])) { return 3; } -+ -+int foo9596e(K, V)(inout(shared(V) [K])) { return 2; } -+int foo9596e(K, V)(inout( V [K])) { return 1; } -+int foo9596e(K, V)(inout( const(V) [K])) { return 3; } -+ -+void test9596() -+{ -+ shared(int)[int] aa; -+ static assert(!__traits(compiles, foo9596a(aa))); -+ -+ assert(foo9596b(aa) == 1); -+ assert(foo9596c(aa) == 2); -+ -+ static assert(!__traits(compiles, foo9596d(aa))); -+ static assert(!__traits(compiles, foo9596e(aa))); -+} -+ -+/******************************************/ -+// 9806 -+ -+struct S9806a(alias x) -+{ -+ alias S9806a!0 N; -+} -+enum expr9806a = 0 * 0; -+alias S9806a!expr9806a T9806a; -+ -+// -------- -+ -+struct S9806b(alias x) -+{ -+ template Next() -+ { -+ enum expr = x + 1; -+ alias S9806b!expr Next; -+ } -+} -+alias S9806b!1 One9806b; -+alias S9806b!0.Next!() OneAgain9806b; -+ -+// -------- -+ -+struct S9806c(x...) -+{ -+ template Next() -+ { -+ enum expr = x[0] + 1; -+ alias S9806c!expr Next; -+ } -+} -+alias S9806c!1 One9806c; -+alias S9806c!0.Next!() OneAgain9806c; -+ -+/******************************************/ -+// 9837 -+ -+void test9837() -+{ -+ enum DA : int[] { a = [1,2,3] } -+ DA da; -+ int[] bda = da; -+ static assert(is(DA : int[])); -+ void fda1(int[] a) {} -+ void fda2(T)(T[] a) {} -+ fda1(da); -+ fda2(da); -+ -+ enum SA : int[3] { a = [1,2,3] } -+ SA sa; -+ int[3] bsa = sa; -+ static assert(is(SA : int[3])); -+ void fsa1(int[3] a) {} -+ void fsa2(T)(T[3] a) {} -+ void fsa3(size_t d)(int[d] a) {} -+ void fsa4(T, size_t d)(T[d] a) {} -+ fsa1(sa); -+ fsa2(sa); -+ fsa3(sa); -+ fsa4(sa); -+ -+ enum AA : int[int] { a = null } -+ AA aa; -+ int[int] baa = aa; -+ static assert(is(AA : int[int])); -+ void faa1(int[int] a) {} -+ void faa2(V)(V[int] a) {} -+ void faa3(K)(int[K] a) {} -+ void faa4(K, V)(V[K] a) {} -+ faa1(aa); -+ faa2(aa); -+ faa3(aa); -+ faa4(aa); -+} -+ -+/******************************************/ -+// 9874 -+ -+bool foo9874() { return true; } -+void bar9874(T)(T) if (foo9874()) {} // OK -+void baz9874(T)(T) if (foo9874) {} // error -+ -+void test9874() -+{ -+ foo9874; // OK -+ bar9874(0); -+ baz9874(0); -+} -+ -+/******************************************/ -+ -+void test9885() -+{ -+ void foo(int[1][]) {} -+ void boo()(int[1][]){} -+ struct X(T...) { static void xoo(T){} } -+ struct Y(T...) { static void yoo()(T){} } -+ struct Z(T...) { static void zoo(U...)(T, U){} } -+ -+ struct V(T...) { static void voo()(T, ...){} } -+ struct W(T...) { static void woo()(T...){} } -+ -+ struct R(T...) { static void roo(U...)(int, U, T){} } -+ -+ // OK -+ foo([[10]]); -+ boo([[10]]); -+ -+ // OK -+ X!(int[1][]).xoo([[10]]); -+ -+ // NG! -+ Y!().yoo(); -+ Y!(int).yoo(1); -+ Y!(int, int[]).yoo(1, [10]); -+ static assert(!__traits(compiles, Y!().yoo(1))); -+ static assert(!__traits(compiles, Y!(int).yoo("a"))); -+ static assert(!__traits(compiles, Y!().yoo!(int)())); -+ -+ // NG! -+ Z!().zoo(); -+ Z!().zoo([1], [1:1]); -+ Z!(int, string).zoo(1, "a"); -+ Z!(int, string).zoo(1, "a", [1], [1:1]); -+ Z!().zoo!()(); -+ static assert(!__traits(compiles, Z!().zoo!()(1))); // (none) <- 1 -+ static assert(!__traits(compiles, Z!(int).zoo!()())); // int <- (none) -+ static assert(!__traits(compiles, Z!(int).zoo!()(""))); // int <- "" -+ static assert(!__traits(compiles, Z!().zoo!(int)())); // int <- (none) -+ static assert(!__traits(compiles, Z!().zoo!(int)(""))); // int <- "" -+ -+ V!().voo(1,2,3); -+ V!(int).voo(1,2,3); -+ V!(int, long).voo(1,2,3); -+ static assert(!__traits(compiles, V!(int).voo())); // int <- (none) -+ static assert(!__traits(compiles, V!(int, long).voo(1))); // long <- (none) -+ static assert(!__traits(compiles, V!(int, string).voo(1,2,3))); // string <- 2 -+ -+ W!().woo(); -+ //W!().woo(1, 2, 3); // Access Violation -+ { // this behavior is consistent with: -+ //alias TL = TypeTuple!(); -+ //void foo(TL...) {} -+ //foo(1, 2, 3); // Access Violation -+ //pragma(msg, typeof(foo)); // void(...) -> D-style variadic function? -+ } -+ W!(int,int[]).woo(1,2,3); -+ W!(int,int[2]).woo(1,2,3); -+ static assert(!__traits(compiles, W!(int,int,int).woo(1,2,3))); // int... <- 2 -+ static assert(!__traits(compiles, W!(int,int).woo(1,2))); // int... <- 2 -+ static assert(!__traits(compiles, W!(int,int[2]).woo(1,2))); // int[2]... <- 2 -+ -+ R!().roo(1, "", []); -+ R!(int).roo(1, "", [], 1); -+ R!(int, string).roo(1, "", [], 1, ""); -+ R!(int, string).roo(1, 2, ""); -+ static assert(!__traits(compiles, R!(int).roo(1, "", []))); // int <- [] -+ static assert(!__traits(compiles, R!(int, int).roo(1, "", []))); // int <- [] -+ static assert(!__traits(compiles, R!(int, string).roo(1, 2, 3))); // string <- 3 -+ -+ // test case -+ struct Tuple(T...) { this()(T values) {} } -+ alias T = Tuple!(int[1][]); -+ auto t = T([[10]]); -+} -+ -+/******************************************/ -+// 9971 -+ -+void goo9971()() -+{ -+ auto g = &goo9971; -+} -+ -+struct S9971 -+{ -+ void goo()() -+ { -+ auto g = &goo; -+ static assert(is(typeof(g) == delegate)); -+ } -+} -+ -+void test9971() -+{ -+ goo9971!()(); -+ -+ S9971.init.goo!()(); -+} -+ -+/******************************************/ -+// 9977 -+ -+void test9977() -+{ -+ struct S1(T) { T value; } -+ auto func1(T)(T value) { return value; } -+ static assert(is(S1!int == struct)); -+ assert(func1(10) == 10); -+ -+ template S2(T) { struct S2 { T value; } } -+ template func2(T) { auto func2(T value) { return value; } } -+ static assert(is(S2!int == struct)); -+ assert(func2(10) == 10); -+ -+ template X(T) { alias X = T[3]; } -+ static assert(is(X!int == int[3])); -+ -+ int a; -+ template Y(T) { alias Y = T[typeof(a)]; } -+ static assert(is(Y!double == double[int])); -+ -+ int v = 10; -+ template Z() { alias Z = v; } -+ assert(v == 10); -+ Z!() = 20; -+ assert(v == 20); -+} -+ -+/******************************************/ -+// 9990 -+ -+auto initS9990() { return "hi"; } -+ -+class C9990(alias init) {} -+ -+alias SC9990 = C9990!(initS9990); -+ -+/******************************************/ -+// 10067 -+ -+struct assumeSize10067(alias F) {} -+ -+template useItemAt10067(size_t idx, T) -+{ -+ void impl(){ } -+ -+ alias useItemAt10067 = assumeSize10067!(impl); -+} -+ -+useItemAt10067!(0, char) mapS10067; -+ -+/******************************************/ -+// 4072 -+ -+void bug4072(T)(T x) -+ if (is(typeof(bug4072(x)))) -+{} -+ -+static assert(!is(typeof(bug4072(7)))); -+ -+/******************************************/ -+// 10074 -+ -+template foo10074(F) -+{ -+ enum foo10074 = false; -+} -+bool foo10074(F)(F f) -+ if (foo10074!F) -+{ -+ return false; -+} -+ -+static assert(!is(typeof(foo10074(1)))); -+ -+/******************************************/ -+// 10083 -+ -+// [a-c] IFTI can find syntactic eponymous member -+template foo10083a(T) -+{ -+ int foo10083a(double) { return 1; } -+ int foo10083a(T) { return 2; } -+} -+template foo10083b(T) -+{ -+ int foo10083b(T) { return 1; } -+ int foo10083b(T, T) { return 2; } -+} -+template foo10083c1(T) -+{ -+ int foo10083c1(T) { return 1; } -+ static if (true) { int x; } -+} -+template foo10083c2(T) -+{ -+ int foo10083c2(T) { return 1; } -+ static if (true) { int x; } else { int y; } -+} -+ -+// [d-f] IFTI cannot find syntactic eponymous member -+template foo10083d1(T) -+{ -+ static if (true) -+ { -+ int foo10083d1(T) { return 1; } -+ } -+ else -+ { -+ } -+} -+template foo10083d2(T) -+{ -+ static if (true) -+ { -+ } -+ else -+ { -+ int foo10083d2(T) { return 1; } -+ } -+} -+template foo10083e(T) -+{ -+ static if (true) -+ { -+ int foo10083e(double arg) { return 1; } -+ } -+ int foo10083e(T arg) { return 2; } -+} -+template foo10083f(T) -+{ -+ static if (true) -+ { -+ int foo10083f(T) { return 1; } -+ } -+ else -+ { -+ int foo10083f(T) { return 2; } -+ } -+} -+ -+void test10083() -+{ -+ assert(foo10083a(1) == 2); -+ assert(foo10083a!int(1) == 2); -+ assert(foo10083a!int(1.0) == 1); -+ version (Win64) {} // workaround -+ else -+ { -+ static assert(!__traits(compiles, foo10083a!double(1))); -+ static assert(!__traits(compiles, foo10083a!double(1.0))); -+ } -+ static assert(!__traits(compiles, foo10083a!real(1))); -+ assert(foo10083a!real(1.0) == 1); -+ assert(foo10083a!real(1.0L) == 2); -+ -+ assert(foo10083b(2) == 1); -+ assert(foo10083b(3, 4) == 2); -+ static assert(!__traits(compiles, foo10083b(2, ""))); -+ -+ assert(foo10083c1(1) == 1); -+ assert(foo10083c2(1) == 1); -+ -+ static assert(!__traits(compiles, foo10083d1(2))); -+ static assert(!__traits(compiles, foo10083d2(2))); -+ static assert(!__traits(compiles, foo10083e(3))); -+ static assert(!__traits(compiles, foo10083f(3))); -+} -+ -+/******************************************/ -+// 10134 -+ -+template ReturnType10134(alias func) -+{ -+ static if (is(typeof(func) R == return)) -+ alias R ReturnType10134; -+ else -+ static assert(0); -+} -+ -+struct Result10134(T) {} -+ -+template getResultType10134(alias func) -+{ -+ static if(is(ReturnType10134!(func.exec) _ == Result10134!(T), T)) -+ { -+ alias getResultType10134 = T; -+ } -+} -+ -+template f10134(alias func) -+{ -+ Result10134!(getResultType10134!(func)) exec(int i) -+ { -+ return typeof(return)(); -+ } -+} -+ -+template a10134() -+{ -+ Result10134!(double) exec(int i) -+ { -+ return b10134!().exec(i); -+ } -+} -+ -+template b10134() -+{ -+ Result10134!(double) exec(int i) -+ { -+ return f10134!(a10134!()).exec(i); -+ } -+} -+ -+pragma(msg, getResultType10134!(a10134!())); -+ -+/******************************************/ -+// 10249 -+ -+template Seq10249(T...) { alias Seq10249 = T; } -+ -+mixin template Func10249(T) -+{ -+ void func10249(T) {} -+} -+mixin Func10249!long; -+mixin Func10249!string; -+ -+void f10249(long) {} -+ -+class C10249 -+{ -+ mixin Func10249!long; -+ mixin Func10249!string; -+ static assert(Seq10249!(.func10249)[0].mangleof == "7breaker9func10249"); // <- 9func10249 -+ static assert(Seq10249!( func10249)[0].mangleof == "7breaker6C102499func10249"); // <- 9func10249 -+ -+static: // necessary to make overloaded symbols accessible via __traits(getOverloads, C10249) -+ void foo(long) {} -+ void foo(string) {} -+ static assert(Seq10249!(foo)[0].mangleof == "7breaker6C102493foo"); // <- _D7breaker6C102493fooFlZv -+ static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[0].mangleof == "_D7breaker6C102493fooFlZv"); // <- -+ static assert(Seq10249!(__traits(getOverloads, C10249, "foo"))[1].mangleof == "_D7breaker6C102493fooFAyaZv"); // <- -+ -+ void g(string) {} -+ alias bar = .f10249; -+ alias bar = g; -+ static assert(Seq10249!(bar)[0].mangleof == "7breaker6C102496f10249"); // <- _D7breaker1fFlZv (todo!) -+ static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[0].mangleof == "_D7breaker6f10249FlZv"); // <- -+ static assert(Seq10249!(__traits(getOverloads, C10249, "bar"))[1].mangleof == "_D7breaker6C102491gFAyaZv"); // <- -+} -+ -+/******************************************/ -+// 10498 -+ -+template triggerIssue10498a() -+{ -+ enum triggerIssue10498a = __traits(compiles, { T10498a; }); -+} -+ -+template PackedGenericTuple10498a(Args...) -+{ -+ alias Args Tuple; -+ enum e = triggerIssue10498a!(); -+} -+ -+struct S10498a { } -+ -+template T10498a() -+{ -+ alias PackedGenericTuple10498a!S10498a T10498a; -+} -+ -+void test10498a() -+{ -+ alias T10498a!() t; -+ static assert(is(t.Tuple[0])); // Fails -> OK -+} -+ -+// -------- -+ -+template triggerIssue10498b(A...) -+{ -+ enum triggerIssue10498b = __traits(compiles, { auto a = A[0]; }); -+} -+ -+template PackedGenericTuple10498b(Args...) -+{ -+ alias Args Tuple; -+ enum e = triggerIssue10498b!Args; -+} -+ -+template T10498b() -+{ -+ struct S {} // The fact `S` is in `T` causes the problem -+ alias PackedGenericTuple10498b!S T10498b; -+} -+ -+void test10498b() -+{ -+ alias T10498b!() t; -+ static assert(is(t.Tuple[0])); -+} -+ -+/******************************************/ -+// 10537 -+ -+struct Iota10537 -+{ -+ int s,e,i; -+ mixin Yield10537!q{ ; }; -+} -+ -+auto skipStrings10537(T)(T source) -+{ -+ return ""; -+} -+ -+mixin template Yield10537(dstring code) -+{ -+ alias X = typeof({ enum x = rewriteCode10537(code); }()); -+} -+ -+dstring rewriteCode10537(dstring code) -+{ -+ skipStrings10537(code); // IFTI causes forward reference -+ return ""; -+} -+ -+/******************************************/ -+// 10558 -+ -+template Template10558() {} -+ -+struct Struct10558(alias T){} -+ -+alias bar10558 = foo10558!(Template10558!()); -+ -+template foo10558(alias T) -+{ -+ alias foobar = Struct10558!T; -+ -+ void fun() -+ { -+ alias a = foo10558!T; -+ } -+} -+ -+/******************************************/ -+// 10592 -+ -+void test10592() -+{ -+ struct A(E) -+ { -+ int put()(const(E)[] data) -+ { -+ return 1; -+ } -+ -+ int put()(const(dchar)[] data) if (!is(E == dchar)) -+ { -+ return 2; -+ } -+ -+ int put(C)(const(C)[] data) if (!is(C == dchar) && !is(E == C)) -+ { -+ return 3; -+ } -+ } -+ -+ A!char x; -+ assert(x.put("abcde"c) == 1); // OK: hit 1 -+ assert(x.put("abcde"w) == 3); // NG: this should hit 3 -+ assert(x.put("abcde"d) == 2); // OK: hit 2 -+} -+ -+/******************************************/ -+// 11242 -+ -+inout(T[]) fromString11242(T)(inout(char[]) s, T[] dst) -+{ -+ return s; -+} -+ -+void test11242() -+{ -+ char[] a; -+ fromString11242(a, a); -+} -+ -+/******************************************/ -+// 10811 -+ -+void foo10811a(R1, R2)(R1, R2) {} -+template foo10811a(alias pred) { void foo10811a(R1, R2)(R1, R2) {} } -+ -+template foo10811b(alias pred) { void foo10811b(R1, R2)(R1, R2) {} } -+void foo10811b(R1, R2)(R1, R2) {} -+ -+void test10811() -+{ -+ foo10811a(1, 2); -+ foo10811a!(a => a)(1, 2); -+ -+ foo10811b(1, 2); -+ foo10811b!(a => a)(1, 2); -+} -+ -+/******************************************/ -+// 10969 -+ -+template A10969(T, U...) { alias A10969 = T; } -+void foo10969(T, U...)(A10969!(T, U) a) {} -+ -+template B10969(T, U) { alias B10969 = T; } -+void bar10969(T, U...)(B10969!(T, U[0]) a) {} -+ -+void test10969() -+{ -+ foo10969!(int, float)(3); -+ bar10969!(int, float)(3); -+} -+ -+/******************************************/ -+// 11271 -+ -+struct SmartPtr11271(T) -+{ -+ ~this() {} -+ void opAssign(U)(auto ref U rh) {} -+} -+ -+void test11271() -+{ -+ SmartPtr11271!Object a; -+ a = SmartPtr11271!Object(); -+} -+ -+/******************************************/ - - int main() - { -@@ -1985,6 +2913,7 @@ int main() - test7359(); - test7416(); - test7563(); -+ test7572(); - test7580(); - test7585(); - test7671(); -@@ -2001,8 +2930,12 @@ int main() - test13(); - test14(); - test8129(); -+ test8238(); -+ test8669(); -+ test8833(); - test8976(); - test8940(); -+ test9022(); - test9026(); - test9038(); - test9076(); -@@ -2011,6 +2944,20 @@ int main() - test9124b(); - test9143(); - test9266(); -+ test9536(); -+ test9578(); -+ test9596(); -+ test9837(); -+ test9874(); -+ test9885(); -+ test9971(); -+ test9977(); -+ test10083(); -+ test10592(); -+ test11242(); -+ test10811(); -+ test10969(); -+ test11271(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/test10441.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test10441.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,10 @@ -+// EXTRA_SOURCES: imports/test10441b.d imports/test10441c.d -+ -+import test10441b; -+ -+void main() -+{ -+ boo(1); -+ foo(); -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/test10573.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test10573.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+// EXTRA_SOURCES: imports/test10573a.d -+ -+import imports.test10573a; -+void main(string[] args) {} ---- a/src/gcc/testsuite/gdc.test/runnable/test10736.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test10736.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,4 @@ -+// EXTRA_SOURCES: imports/test10736a.d imports/test10736b.d -+ -+import imports.test10736a; -+import imports.test10736b; ---- a/src/gcc/testsuite/gdc.test/runnable/test10942.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test10942.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+// REQUIRED_ARGS: -g -+ -+import std.string; -+ -+string getEnum(size_t count) -+{ -+ string en; -+ en ~= "enum KeyCode\n { \n"; -+ -+ foreach (i; 0 .. count) -+ { -+ en ~= format(" memb_%s = %s,\n", i+1, i+1); -+ } -+ -+ en ~= "} "; -+ return en; -+} -+ -+// Linker warning: Warning 161: Unknown CV version, ignored -+// mixin(getEnum(1024)); -+ -+// ICE -+mixin(getEnum(1087)); -+ -+void main() { } -+ ---- a/src/gcc/testsuite/gdc.test/runnable/test11039.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test11039.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,22 @@ -+// COMPILE_SEPARATELY -+// EXTRA_SOURCES: imports/test11039b.d -+ -+import imports.test11039b; -+ -+struct SomeStruct(T) -+{ -+ T field; -+ T getInnerField() -+ { -+ return field; -+ } -+} -+ -+static globalField = SomeStruct!string("Hello!"); -+ -+void main() -+{ -+ globalField.getInnerField(); -+ anotherGlobalField.getInnerField(); -+} -+ ---- a/src/gcc/testsuite/gdc.test/runnable/test12.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test12.d 2014-04-01 16:32:51.000000000 +0100 -@@ -280,17 +280,17 @@ void test11() - - struct Array12 - { -- char len; -- void* p; --} --Array12 f12(string a) --{ -- return *cast(Array12*) &a[0..23]; //Internal error: ..\ztc\cgcs.c 350 -+ char len; -+ void* p; - } -+//Array12 f12(string a) -+//{ -+// return *cast(Array12*) &a[0..23]; //Internal error: ..\ztc\cgcs.c 350 -+//} - - Array12 g12(string a) - { -- return *cast(Array12*) &a; //works -+ return *cast(Array12*) &a; //works - } - - void test12() -@@ -298,8 +298,8 @@ void test12() - string a = "12345678901234567890123"; - Array12 b; - -- b = f12(a); -- printf("b.len = %x\n", b.len); -+ //b = f12(a); -+ //printf("b.len = %x\n", b.len); - b = g12(a); - printf("b.len = %x\n", b.len); - } -@@ -781,7 +781,7 @@ void test36() - printf("%d\n", a.d); - - version(D_LP64) -- assert(a.classinfo.init.length == 36); -+ assert(a.classinfo.init.length == 40); - else - assert(a.classinfo.init.length == 28); - assert(a.s == 1); ---- a/src/gcc/testsuite/gdc.test/runnable/test19.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test19.d 2014-04-01 16:32:51.000000000 +0100 -@@ -8,12 +8,12 @@ extern(C) int printf(const char*, ...); - - class Foo - { -- int foo(int x) { return x + 3; } -+ int foo(int x) { return x + 3; } - } - - class Bar : Foo - { -- override int foo(int y) { return y + 4; } -+ override int foo(int y) { return y + 4; } - } - - void test1() -@@ -31,7 +31,7 @@ class Foo2 - { - int foo(int x) - { -- return x + 3; -+ return x + 3; - } - } - -@@ -39,8 +39,8 @@ class Bar2 : Foo2 - { - override int foo(int y) - { -- assert(Foo2.foo(2) == 5); -- return y + 4; -+ assert(Foo2.foo(2) == 5); -+ return y + 4; - } - } - -@@ -66,13 +66,14 @@ void test3() - debug(10) assert(0); - - debug(1) -- { int d1 = 3; -+ { -+ int d1 = 3; - -- printf("debug(1) { }\n"); -+ printf("debug(1) { }\n"); - } - debug(2) - { -- printf("debug(2): d1 = %d\n", d1); -+ printf("debug(2): d1 = %d\n", d1); - } - } - -@@ -120,8 +121,8 @@ void test5() - - int[] test6_1(int[] a) - { -- a.length = 6; -- return a; -+ a.length = 6; -+ return a; - } - - void test6() -@@ -148,7 +149,7 @@ class OutBuffer7 - - void write(const(char) *p, uint nbytes) - { -- data[offset .. offset + nbytes] = (cast(char *)p)[0 .. nbytes]; -+ data[offset .. offset + nbytes] = (cast(char *)p)[0 .. nbytes]; - } - } - -@@ -163,22 +164,23 @@ void test7() - printf("ob.data.length = %d\n", ob.data.length); - assert(ob.data.length == 10); - for (i = 0; i < 10; i++) -- assert(ob.data[i] == char.init); -+ assert(ob.data[i] == char.init); - - printf("test7.1()\n"); - ob.data[] = '-'; - printf("test7.2()\n"); - printf("ob.data[] = '%.*s'\n", ob.data.length, ob.data.ptr); - for (i = 0; i < 10; i++) -- assert(ob.data[i] == '-'); -+ assert(ob.data[i] == '-'); - - ob.offset = 3; - ob.write("foo", 3); - printf("ob.data.length = %d\n", ob.data.length); - printf("ob.data[] = '%.*s'\n", ob.data.length, ob.data.ptr); - for (i = 0; i < 10; i++) -- { if (i < 3 || i >= 6) -- assert(ob.data[i] == '-'); -+ { -+ if (i < 3 || i >= 6) -+ assert(ob.data[i] == '-'); - } - assert(ob.data[3] == 'f'); - assert(ob.data[4] == 'o'); -@@ -268,9 +270,9 @@ char[] tolower13(ref char[] s) - - for (i = 0; i < s.length; i++) - { -- char c = s[i]; -- if ('A' <= c && c <= 'Z') -- s[i] = cast(char)(c + (cast(char)'a' - 'A')); -+ char c = s[i]; -+ if ('A' <= c && c <= 'Z') -+ s[i] = cast(char)(c + (cast(char)'a' - 'A')); - } - return s; - } -@@ -307,7 +309,7 @@ class bools15 - bool a = true, b = true, c = true; - void dump() - { -- printf("%d %d %d\n", a, b, c); -+ printf("%d %d %d\n", a, b, c); - } - } - -@@ -389,15 +391,26 @@ bool tested20; - - struct S20 - { -- unittest{ -- assert(!tested20); -- tested20 = true; -- } -+ unittest -+ { -+ assert(!tested20); -+ tested20 = true; -+ } - } - - void test20() - { -- assert(tested20); -+ assert(tested20); -+} -+ -+/* ================================ */ -+// 7848 -+ -+@safe pure nothrow void func7848() {} -+ -+@safe pure nothrow unittest -+{ -+ func7848(); - } - - /* ================================ */ -@@ -422,6 +435,22 @@ void test8128() - - /* ================================ */ - -+class C8635{ -+ int x; -+ this(int x) -+ { -+ this.x = x; -+ } -+} -+void test8635() -+{ -+ assert(new C8635(2).x==2); -+ assert(new C8635(3).x==3); -+} -+ -+/* ================================ */ -+ -+ - int main() - { - test1(); -@@ -445,7 +474,7 @@ int main() - test19(); - test20(); - test8128(); -- -+ test8635(); - printf("Success\n"); - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/test22.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test22.d 2014-04-01 16:32:51.000000000 +0100 -@@ -549,9 +549,13 @@ string toString26(cdouble z) - void test26() - { - static cdouble[] A = [1+0i, 0+1i, 1+1i]; -+ string s; - - foreach( cdouble z; A ) -- printf("%.*s ",toString26(z)); -+ { -+ s = toString26(z); -+ printf("%.*s ", s.length, s.ptr); -+ } - printf("\n"); - - for(int ii=0; ii<A.length; ii++ ) -@@ -562,7 +566,10 @@ void test26() - assert(A[2] == 2); - - foreach( cdouble z; A ) -- printf("%.*s ",toString26(z)); -+ { -+ s = toString26(z); -+ printf("%.*s ", s.length, s.ptr); -+ } - printf("\n"); - } - ---- a/src/gcc/testsuite/gdc.test/runnable/test23.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test23.d 2014-04-01 16:32:51.000000000 +0100 -@@ -364,8 +364,13 @@ void test17() - { - /*const*/ float f = 1.2f; - float g = void; -- -- version(GNU) -+ -+ -+ version(D_SoftFloat) -+ { -+ g = f; -+ } -+ else version(GNU) - { - version(X86) asm - { -@@ -375,6 +380,10 @@ void test17() - { - "flds %1; fstps %0;" : "=m" (g) : "m" (f) : ; - } -+ else version(ARM) asm -+ { -+ "vldr d0, %1; vstr d0, %0;" : "=m" (g) : "m" (f), : "d0"; -+ } - else static assert(false, "ASM code not implemented for this architecture"); - } - else -@@ -1352,28 +1361,8 @@ void test64() - - void test65() - { -- int i; -- char[1] c = ['0']; -- i = c[0]; // ok -- i = *cast(int*)c; // ok -- assert((i & 0xFF) == 0x30); -- -- i = *cast(int*)['0']; // compiler seg-fault -- assert((i & 0xFF) == 0x30); -- -- if (0) -- i = *cast(int*)cast(char[0])[]; // compiler seg-fault -- i = *cast(int*)cast(char[1])['0']; // compiler seg-fault -- i = *cast(int*)cast(char[1])"0"; // ok -- --// i = *cast(int*)cast(char[3])['0']; // ok --// i = *cast(int*)cast(char[3])['0', '0']; // ok -- i = *cast(int*)cast(char[3])['0', '0', '0']; // compiler seg-fault -- --// i = *cast(int*)cast(char[4])['0', '0', '0']; // ok -- i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault -- -- i = *cast(int*)cast(char[])['0','0','0']; // ok -+ // Bugzilla Issue 407. -+ int i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault - printf("i = %x\n", i); - } - ---- a/src/gcc/testsuite/gdc.test/runnable/test2.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test2.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,34 +0,0 @@ --#!/usr/bin/env bash -- --dir=${RESULTS_DIR}/runnable --dmddir=${RESULTS_DIR}${SEP}runnable --output_file=${dir}/test2.sh.out -- --rm -f ${output_file} -- --a[0]='' --a[1]='-debug' --a[2]='-debug=1' --a[3]='-debug=2 -debug=bar' -- --for x in "${a[@]}"; do -- echo "executing with args: $x" >> ${output_file} -- -- $DMD -m${MODEL} $x -unittest -od${dmddir} -of${dmddir}${SEP}test2${EXE} runnable/extra-files/test2.d >> ${output_file} -- if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 -- fi -- -- ./${dir}/test2 >> ${output_file} -- if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 -- fi -- -- rm ${dir}/{test2${OBJ},test2${EXE}} -- -- echo >> ${output_file} --done ---- a/src/gcc/testsuite/gdc.test/runnable/test3449.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test3449.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,92 @@ -+version (PULL93) -+{ -+template TypeTuple(T...) { alias TypeTuple = T; } -+ -+// If module variable has no explicit initializer, -+// constant folding is not allowed for that. -+int mg1; -+const int cg1; -+immutable int ig1; -+static this() -+{ -+ mg1 = 10; -+ cg1 = 10; -+ ig1 = 10; -+} -+static assert(!__traits(compiles, { static assert(mg1 == 0); })); -+static assert(!__traits(compiles, { static assert(cg1 == 0); })); -+static assert(!__traits(compiles, { static assert(ig1 == 0); })); -+ -+// But, if module variable has explicit initializer and -+// non-mutable type, constant folding is allowed for that.. -+int mg2 = 1; -+const int cg2 = 1; -+immutable int ig2 = 1; -+static this() -+{ -+ mg2 = 11; -+ static assert(!__traits(compiles, cg2 = 11)); // not allowed for constant folding -+ static assert(!__traits(compiles, ig2 = 11)); // not allowed for constant folding -+} -+static assert(!__traits(compiles, { static assert(mg2 == 1); })); -+ static assert(cg2 == 1); // possible -+ static assert(ig2 == 1); // possible -+ -+// For aggregate fields, compiler behavior will be changed. -+void main() -+{ -+ static struct S(T) -+ { -+ T field1; // doesn't have explicit initializer -+ T field2 = 1; // has explicit initializer -+ -+ this(int n) -+ { -+ field1 = n; // allowed -+ field2 = n; // NEW! re-assigning during construction is allowed for any qualified fields. -+ } -+ } -+ -+ foreach (T; TypeTuple!(int, const int, immutable int)) -+ { -+ alias S!T ST; -+ -+ auto s1 = ST(); // default construction -+ assert(s1.field1 == 0); // == T.init -+ assert(s1.field2 == 1); // == specified initializer -+ -+ // Getting address for non-mutable field is allowed. -+ T* s1p1 = &s1.field1; -+ T* s1p2 = &s1.field2; -+ assert(*s1p1 == 0); -+ assert(*s1p2 == 1); -+ static if (is(T == int)) -+ { // If T is mutable, -+ // modification through indirection is allowed -+ *s1p1 = 100, *s1p2 = 101; -+ assert(*s1p1 == 100); -+ assert(*s1p2 == 101); -+ } -+ else -+ { // If T is not mutable, modification is not allowed -+ static assert(!__traits(compiles, *s1p1 = 100)); -+ static assert(!__traits(compiles, *s1p2 = 100)); -+ } -+ -+ // Access to non-static non-mutable field is -+ // now correctly rejected by "need this" error. -+ static assert(!__traits(compiles, ST.field1 == 1)); -+ static assert(!__traits(compiles, ST.field2 == 0)); -+ -+ // So, re-assignment of non-mutable fields -+ // during construction is enough acceptable. -+ auto s2 = ST(10); -+ assert(s2.field1 == 10); -+ assert(s2.field2 == 10); -+ } -+} -+} -+else -+{ -+ void main() { } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/test34.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test34.d 2014-04-01 16:32:51.000000000 +0100 -@@ -717,7 +717,11 @@ void foo35() - { - "int $3;" : : : ; - } -- else static assert(false, "ASM code not implemented for this architecture"); -+ else -+ { -+ import gcc.builtins; -+ __builtin_trap(); -+ } - } - else - asm { int 3; } ---- a/src/gcc/testsuite/gdc.test/runnable/test35.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test35.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,38 +0,0 @@ --#!/usr/bin/env bash -- --dir=${RESULTS_DIR}/runnable --dmddir=${RESULTS_DIR}${SEP}runnable --output_file=${dir}/test35.sh.out -- --rm -f ${output_file} -- --$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/extra-files/test35.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --$DMD -m${MODEL} -od${dmddir} -c -release runnable/imports/test35a.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --$DMD -m${MODEL} -of${dmddir}${SEP}test35${EXE} ${dir}/test35${OBJ} ${dir}/test35a${OBJ} >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --./${dir}/test35 >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --rm ${dir}/{test35${OBJ},test35a${OBJ},test35${EXE}} -- ---- a/src/gcc/testsuite/gdc.test/runnable/test36.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test36.d 2014-04-01 16:32:51.000000000 +0100 -@@ -38,6 +38,10 @@ extern (Windows): - { - "mov %%ESP,%0" : "=r" esp : : ; - } -+ else version(ARM) asm -+ { -+ "str sp,%0" : "=m" esp : : ; -+ } - else static assert(false, "ASM code not implemented for this architecture"); - } - else asm -@@ -66,6 +70,10 @@ int main() - { - "mov %%ESP,%0" : "=r" esp : : ; - } -+ else version(ARM) asm -+ { -+ "str sp,%0" : "=m" esp : : ; -+ } - else static assert(false, "ASM code not implemented for this architecture"); - } - else asm -@@ -85,6 +93,10 @@ int main() - { - "mov %%ESP,%0" : "=r" esp : : ; - } -+ else version(ARM) asm -+ { -+ "str sp,%0" : "=m" esp : : ; -+ } - else static assert(false, "ASM code not implemented for this architecture"); - } - else asm ---- a/src/gcc/testsuite/gdc.test/runnable/test39.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test39.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,51 +0,0 @@ --#!/usr/bin/env bash -- --dir=${RESULTS_DIR}/runnable --dmddir=${RESULTS_DIR}${SEP}runnable --output_file=${dir}/test39.sh.out -- --rm -f ${output_file} -- --$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/extra-files/test39.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --$DMD -m${MODEL} -Irunnable -od${dmddir} -c runnable/imports/test39a.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --if [ ${OS} == "win32" -o ${OS} == "win64" ]; then -- lib -c ${dmddir}${SEP}test39a.lib ${dmddir}${SEP}test39a.obj >> ${output_file} 2>&1 -- LIBEXT=.lib --else -- ar -r ${dir}/test39a.a ${dir}/test39a.o >> ${output_file} 2>&1 -- LIBEXT=.a --fi --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --$DMD -m${MODEL} -of${dmddir}${SEP}test39${EXE} ${dir}/test39${OBJ} ${dir}/test39a${LIBEXT} >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --./${dir}/test39 >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --rm ${dir}/{test39${OBJ},test39a${OBJ},test39a${LIBEXT},test39${EXE}} -- ---- a/src/gcc/testsuite/gdc.test/runnable/test42.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test42.d 2014-04-01 16:32:51.000000000 +0100 -@@ -611,7 +611,7 @@ void test40() - - /***************************************************/ - --struct S41 -+align(16) struct S41 - { - int[4] a; - } -@@ -722,8 +722,8 @@ void test49() - { - version(GNU) - { -- assert((25.5).stringof ~ (3.01).stringof == "2.55e+13.01e+0"); -- assert(25.5.stringof ~ 3.01.stringof == "2.55e+13.01e+0"); -+ assert((25.5).stringof ~ (3.0625).stringof == "2.55e+13.0625e+0"); -+ assert(25.5.stringof ~ 3.0625.stringof == "2.55e+13.0625e+0"); - } - else - { -@@ -1660,6 +1660,7 @@ void test100() - printf("d = %llx, ulong.max = %llx\n", d, ulong.max); - assert(d == ulong.max); - } -+ static if(real.mant_dig == 64) - { - real r = ulong.max - 1; - printf("r = %Lg, ulong.max = %llu\n", r, ulong.max); -@@ -1667,6 +1668,11 @@ void test100() - printf("d = %llx, ulong.max = %llx\n", d, ulong.max); - assert(d == ulong.max - 1); - } -+ else static if(real.mant_dig == 53) -+ { //can't store ulong.max-1 in double -+ } -+ else -+ static assert(false, "Test not implemented for this platform"); - } - - /***************************************************/ -@@ -1717,6 +1723,46 @@ else version(X86_64) - pragma(msg, "Not ported to x86-64 compatible varargs, yet."); - void test103() {} - } -+else version(GNU) -+{ -+int x103; -+ -+void external(int a, ...) -+{ -+ va_list ap; -+ va_start(ap, a); -+ auto ext = va_arg!int(ap); -+ printf("external: %d\n", ext); -+ x103 = ext; -+ va_end(ap); -+} -+ -+class C103 -+{ -+ void method () -+ { -+ void internal (int a, ...) -+ { -+ va_list ap; -+ va_start(ap, a); -+ auto internal = va_arg!int(ap); -+ printf("internal: %d\n", internal); -+ x103 = internal; -+ va_end(ap); -+ } -+ -+ internal (0, 43); -+ assert(x103 == 43); -+ } -+} -+ -+void test103() -+{ -+ external(0, 42); -+ assert(x103 == 42); -+ (new C103).method (); -+} -+} - else - static assert(false, "Unknown platform"); - -@@ -2402,7 +2448,11 @@ void crash(int x) - { - "int $3;" : : :; - } -- else static assert(false, "ASM code not implemented for this architecture"); -+ else -+ { -+ import gcc.builtins; -+ __builtin_trap(); -+ } - } - else - { -@@ -2699,6 +2749,7 @@ enum FwdEnum : int - } - - /***************************************************/ -+// 3740 - - abstract class Address { - abstract int nameLen(); -@@ -2714,7 +2765,8 @@ class Class171 : Address { - - void test171 () - { -- Class171 xxx = new Class171; -+ Class171 xxx = new Class171; -+ assert(typeid(Class171).vtbl.length - typeid(Object).vtbl.length == 1); - } - - /***************************************************/ -@@ -3238,18 +3290,16 @@ int bug2931() - int bug2931_2() - { - Outer2931 v; -+ Bug2931 w = Bug2931(68); - assert(v.move==3); - for (int i = 0; i < 4; i++) -- { for (int j = 0; j < 3; j++) -+ { -+ for (int j = 0; j < 3; j++) - { -- printf("[%d][%d] = %d\n", j, i, v.p.val[j][i]); -- if (i == 0 && j == 0) -- assert(v.p.val[j][i] == 67); -- else -- assert(v.p.val[j][i] == 0); -+ assert(w.val[j][i] == 68); -+ assert(v.p.val[j][i] == 67); - } - } -- printf("v.zoom = %d\n", v.zoom); - assert(v.scale == 4); - return v.zoom; - } -@@ -4167,6 +4217,10 @@ int bug3809() - { - "nop;" : : :; - } -+ else version(ARM) asm -+ { -+ "nop;" : : :; -+ } - else static assert(false, "ASM code not implemented for this architecture"); - } - else -@@ -4182,36 +4236,27 @@ void bug3809b() { - /***************************************************/ - // - --version (X86_64) -+void bug6184() - { -- void bug6184() -+ bool cmp(ref int[3] a, ref int[3] b) - { -- bool cmp(ref int[3] a, ref int[3] b) -- { -- return a is b; -- } -- -- static struct Ary -- { -- int[3] ary; -- } -- -- auto a = new Ary; -- auto b = new Ary; -- assert(!cmp(a.ary, b.ary)); -- b = a; -- assert(cmp(a.ary, b.ary)); -- -- // change high bit of ary address -- *(cast(size_t*)&b) ^= (1UL << 32); -- assert(!cmp(a.ary, b.ary)); -+ return a is b; - } --} --else --{ -- void bug6184() -+ -+ static struct Ary - { -+ int[3] ary; - } -+ -+ auto a = new Ary; -+ auto b = new Ary; -+ assert(!cmp(a.ary, b.ary)); -+ b = a; -+ assert(cmp(a.ary, b.ary)); -+ -+ // change high bit of ary address -+ *(cast(size_t*)&b) ^= (1UL << (size_t.sizeof * 4)); -+ assert(!cmp(a.ary, b.ary)); - } - - /***************************************************/ -@@ -4262,19 +4307,22 @@ void test6270() - - /***************************************************/ - --void test236() -+void testrolror(int shift) - { -- uint a; -- int shift; -- a = 7; -- shift = 1; -- int r; -+ uint a = 7; -+ uint r; - r = (a >> shift) | (a << (int.sizeof * 8 - shift)); - assert(r == 0x8000_0003); -- r = (a << shift) | (a >> (int.sizeof * 8 - shift)); -- assert(a == 7); -+ r = (r << shift) | (r >> (int.sizeof * 8 - shift)); -+ assert(r == 7); -+} -+ -+void test236() -+{ -+ testrolror(1); - } - -+ - /***************************************************/ - // 4460 - -@@ -4747,49 +4795,6 @@ void test7422() { - - /***************************************************/ - --void test7504() pure nothrow @safe --{ -- auto n = null; -- char[] k = n; -- assert(k.ptr == null); -- assert(k.length == 0); -- -- double[] l; -- l = n; -- assert(l.ptr == null); -- assert(l.length == 0); -- -- immutable(int[]) m = n; -- assert(m.ptr == null); -- assert(m.length == 0); -- -- const(float)[] o; -- o = n; -- assert(o.ptr == null); -- assert(o.length == 0); -- -- auto c = create7504(null, null); -- assert(c.k.ptr == null); -- assert(c.k.length == 0); -- assert(c.l.ptr == null); -- assert(c.l.length == 0); --} -- --class C7504 --{ -- int[] k; -- string l; --} -- --C7504 create7504(T...)(T input) --{ -- auto obj = new C7504; -- obj.tupleof = input; -- return obj; --} -- --/***************************************************/ -- - struct S7502 - { - int[0x1000] arr; -@@ -4990,7 +4995,7 @@ mixin template mix7974() - - struct Foo7974 - { -- immutable Foo7974 fa = Foo7974(0); -+ static immutable Foo7974 fa = Foo7974(0); - - this(uint x) - { -@@ -5321,6 +5326,18 @@ void bar8870(S8870 t1, S8870 t2, bool so - - /***************************************************/ - -+int foo9781(int[1] x) -+{ -+ return x[0] * x[0]; -+} -+ -+void test9781() -+{ -+ foo9781([7]); -+} -+ -+/***************************************************/ -+ - struct S247 { size_t length; size_t ptr; } - - S247 foo247() -@@ -5461,6 +5478,23 @@ void test9248() - } - - /***************************************************/ -+// 9739 -+ -+class Foo9739 -+{ -+ int val = 1; -+ this(int arg = 2) { val = arg; } -+} -+ -+class Bar9739 : Foo9739 { } -+ -+void test9739() -+{ -+ Bar9739 bar = new Bar9739; -+ assert(bar.val == 2); -+} -+ -+/***************************************************/ - // 6057 - void test6057() - { -@@ -5484,7 +5518,12 @@ void testdbl_to_ulong() - real adjust = 1.0L/real.epsilon; - u = d2ulong(adjust); - //writefln("%s %s", adjust, u); -- assert(u == 9223372036854775808UL); -+ static if(real.mant_dig == 64) -+ assert(u == 9223372036854775808UL); -+ else static if(real.mant_dig == 53) -+ assert(u == 4503599627370496UL); -+ else -+ static assert(false, "Test not implemented for this architecture"); - - auto v = d2ulong(adjust * 1.1); - //writefln("%s %s %s", adjust, v, u + u/10); -@@ -5526,7 +5565,12 @@ void testreal_to_ulong() - real adjust = 1.0L/real.epsilon; - u = r2ulong(adjust); - //writefln("%s %s", adjust, u); -- assert(u == 9223372036854775808UL); -+ static if(real.mant_dig == 64) -+ assert(u == 9223372036854775808UL); -+ else static if(real.mant_dig == 53) -+ assert(u == 4503599627370496UL); -+ else -+ static assert(false, "Test not implemented for this architecture"); - - auto v = r2ulong(adjust * 1.1); - writefln("%s %s %s", adjust, v, u + u/10); -@@ -5625,22 +5669,22 @@ void test250() - { - static uint[2] a1 = [0x1001_1100, 0x0220_0012]; - -- if ( bt32(a1,30)) assert(0); -- if (!bt32(a1,8)) assert(0); -- if ( bt32(a1,30+32)) assert(0); -- if (!bt32(a1,1+32)) assert(0); -+ if ( bt32(a1.ptr,30)) assert(0); -+ if (!bt32(a1.ptr,8)) assert(0); -+ if ( bt32(a1.ptr,30+32)) assert(0); -+ if (!bt32(a1.ptr,1+32)) assert(0); - - static ulong[2] a2 = [0x1001_1100_12345678, 0x0220_0012_12345678]; - -- if ( bt64a(a2,30+32)) assert(0); -- if (!bt64a(a2,8+32)) assert(0); -- if ( bt64a(a2,30+32+64)) assert(0); -- if (!bt64a(a2,1+32+64)) assert(0); -- -- if ( bt64b(a2,30+32)) assert(0); -- if (!bt64b(a2,8+32)) assert(0); -- if ( bt64b(a2,30+32+64)) assert(0); -- if (!bt64b(a2,1+32+64)) assert(0); -+ if ( bt64a(a2.ptr,30+32)) assert(0); -+ if (!bt64a(a2.ptr,8+32)) assert(0); -+ if ( bt64a(a2.ptr,30+32+64)) assert(0); -+ if (!bt64a(a2.ptr,1+32+64)) assert(0); -+ -+ if ( bt64b(a2.ptr,30+32)) assert(0); -+ if (!bt64b(a2.ptr,8+32)) assert(0); -+ if ( bt64b(a2.ptr,30+32+64)) assert(0); -+ if (!bt64b(a2.ptr,1+32+64)) assert(0); - } - - /***************************************************/ -@@ -5710,6 +5754,170 @@ void test6962() - - /***************************************************/ - -+int[1] foo4414() { -+ return [7]; -+} -+ -+ubyte[4] bytes4414() -+{ -+ ubyte[4] x; -+ x[0] = 7; -+ x[1] = 8; -+ x[2] = 9; -+ x[3] = 10; -+ return x; -+} -+ -+void test4414() { -+ { -+ int x = foo4414()[0]; -+ assert(x == 7); -+ } -+ { -+ auto x = bytes4414()[0..4]; -+ if (x[0] != 7 || x[1] != 8 || x[2] != 9 || x[3] != 10) -+ assert(0); -+ } -+} -+ -+/***************************************************/ -+ -+void test9844() { -+ int a = -1; -+ long b = -1; -+ assert(a == -1); -+ assert(b == -1L); -+} -+ -+/***************************************************/ -+// 10628 -+ -+abstract class B10628 -+{ -+ static if (! __traits(isVirtualMethod, foo)) -+ { -+ } -+ -+ private bool _bar; -+ public void foo(); -+} -+ -+class D10628 : B10628 -+{ -+ public override void foo() {} -+} -+ -+void test10628() -+{ -+ assert(typeid(D10628).vtbl.length - typeid(Object).vtbl.length == 1); -+} -+ -+/***************************************************/ -+// 11265 -+ -+struct S11265 -+{ -+ class InnerClass -+ { -+ S11265 s; -+ -+ bool empty() -+ { -+ return true; -+ } -+ } -+} -+ -+void test11265() -+{ -+ S11265.InnerClass trav = new S11265.InnerClass(); -+ trav.empty(); -+} -+ -+/***************************************************/ -+ -+struct TimeOfDay -+{ -+ void roll(int value) -+ { -+ value %= 60; -+ auto newVal = _seconds + value; -+ -+ if(newVal < 0) -+ newVal += 60; -+ else if(newVal >= 60) -+ newVal -= 60; -+ -+ _seconds = cast(ubyte)newVal; -+ } -+ -+ ubyte _seconds; -+} -+ -+ -+void test10633() -+{ -+ TimeOfDay tod = TimeOfDay(0); -+ tod.roll(-1); -+ assert(tod._seconds == 59); -+} -+ -+/***************************************************/ -+ -+import std.stdio; -+ -+void _assertEq (ubyte lhs, short rhs, string msg, string file, size_t line) -+{ -+ immutable result = lhs == rhs; -+ -+ if(!result) -+ { -+ string op = "=="; -+ if(msg.length > 0) -+ writefln(`_assertEq failed: [%s] is not [%s].`, lhs, rhs); -+ else -+ writefln(`_assertEq failed: [%s] is not [%s]: %s`, lhs, rhs, msg); -+ } -+ -+ assert(result); -+} -+ -+struct Date -+{ -+ short year; -+ ubyte month; -+ ubyte day; -+} -+ -+struct MonthDay -+{ -+ ubyte month; -+ short day; -+} -+ -+void test10642() -+{ -+ static void test(Date date, int day, MonthDay expected, size_t line = __LINE__) -+ { -+ _assertEq(date.day, expected.day, "", __FILE__, line); -+ } -+ -+ test(Date(1999, 1, 1), 1, MonthDay(1,1)); -+} -+ -+ -+/***************************************************/ -+ -+void test7436() -+{ -+ ubyte a = 10; -+ float f = 6; -+ ubyte b = a += f; -+ assert(b == 16); -+} -+ -+/***************************************************/ -+ - int main() - { - test1(); -@@ -5955,7 +6163,6 @@ int main() - test6504(); - test7422(); - test7424(); -- test7504(); - test7502(); - test4820(); - test4820_2(); -@@ -5976,12 +6183,14 @@ int main() - test8840(); - test8889(); - test8870(); -+ test9781(); - test247(); - test8340(); - test8376(); - test8796(); - test9171(); - test9248(); -+ test9739(); - testdbl_to_ulong(); - testdbl_to_uint(); - testreal_to_ulong(); -@@ -5991,6 +6200,13 @@ int main() - test6057(); - test251(); - test6962(); -+ test4414(); -+ test9844(); -+ test10628(); -+ test11265(); -+ test10633(); -+ test10642(); -+ test7436(); - - writefln("Success"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/test44.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test44.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,38 +0,0 @@ --#!/usr/bin/env bash -- --dir=${RESULTS_DIR}/runnable --dmddir=${RESULTS_DIR}${SEP}runnable --output_file=${dir}/test44.sh.out -- --rm -f ${output_file} -- --$DMD -m${MODEL} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_1${EXE} runnable/extra-files/test44.d runnable/imports/test44a.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --./${dir}/test44_1 >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --$DMD -m${MODEL} -Irunnable -od${dmddir} -of${dmddir}${SEP}test44_2${EXE} runnable/imports/test44a.d runnable/extra-files/test44.d >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --./${dir}/test44_2 >> ${output_file} --if [ $? -ne 0 ]; then -- cat ${output_file} -- rm -f ${output_file} -- exit 1 --fi -- --rm ${dir}/{test44_1${OBJ},test44_1${EXE},test44_2${OBJ},test44_2${EXE}} -- ---- a/src/gcc/testsuite/gdc.test/runnable/test4.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test4.d 2014-04-01 16:32:51.000000000 +0100 -@@ -244,6 +244,16 @@ else version (X86_64) - assert(TRECT6.BottomRight.offsetof == 16); - assert(TRECT6.foo2.offsetof == 24); - } -+else version(ARM) -+{ -+ assert(TRECT6.Left.offsetof == 8); -+ assert(TRECT6.Top.offsetof == 12); -+ assert(TRECT6.Right.offsetof == 16); -+ assert(TRECT6.Bottom.offsetof == 20); -+ assert(TRECT6.TopLeft.offsetof == 8); -+ assert(TRECT6.BottomRight.offsetof == 16); -+ assert(TRECT6.foo2.offsetof == 24); -+} - else - { - assert(TRECT6.Left.offsetof == 4); ---- a/src/gcc/testsuite/gdc.test/runnable/test5943.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test5943.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,77 @@ -+// test that the import of std.math is not needed -+ -+__gshared uint x0 = 0; -+__gshared uint x1 = 1; -+__gshared uint x2 = 2; -+__gshared uint x3 = 3; -+__gshared uint x4 = 4; -+__gshared uint x5 = 5; -+__gshared uint x6 = 6; -+__gshared uint x7 = 7; -+__gshared uint x10 = 10; -+__gshared uint x15 = 15; -+__gshared uint x31 = 31; -+__gshared uint x32 = 32; -+ -+void main() -+{ -+ assert(2 ^^ x0 == 1); -+ assert(2 ^^ x1 == 2); -+ assert(2 ^^ x31 == 0x80000000); -+ assert(4 ^^ x0 == 1); -+ assert(4 ^^ x1 == 4); -+ assert(4 ^^ x15 == 0x40000000); -+ assert(8 ^^ x0 == 1); -+ assert(8 ^^ x1 == 8); -+ assert(8 ^^ x10 == 0x40000000); -+ assert(16 ^^ x0 == 1); -+ assert(16 ^^ x1 == 16); -+ assert(16 ^^ x7 == 0x10000000); -+ assert(32 ^^ x0 == 1); -+ assert(32 ^^ x1 == 32); -+ assert(32 ^^ x6 == 0x40000000); -+ assert(64 ^^ x0 == 1); -+ assert(64 ^^ x1 == 64); -+ assert(64 ^^ x5 == 0x40000000); -+ assert(128 ^^ x0 == 1); -+ assert(128 ^^ x1 == 128); -+ assert(128 ^^ x4 == 0x10000000); -+ assert(256 ^^ x0 == 1); -+ assert(256 ^^ x1 == 256); -+ assert(256 ^^ x3 == 0x1000000); -+ assert(512 ^^ x0 == 1); -+ assert(512 ^^ x1 == 512); -+ assert(512 ^^ x3 == 0x8000000); -+ assert(1024 ^^ x0 == 1); -+ assert(1024 ^^ x1 == 1024); -+ assert(1024 ^^ x3 == 0x40000000); -+ assert(2048 ^^ x0 == 1); -+ assert(2048 ^^ x1 == 2048); -+ assert(2048 ^^ x2 == 0x400000); -+ assert(4096 ^^ x0 == 1); -+ assert(4096 ^^ x1 == 4096); -+ assert(4096 ^^ x2 == 0x1000000); -+ assert(8192 ^^ x0 == 1); -+ assert(8192 ^^ x1 == 8192); -+ assert(8192 ^^ x2 == 0x4000000); -+ assert(16384 ^^ x0 == 1); -+ assert(16384 ^^ x1 == 16384); -+ assert(16384 ^^ x2 == 0x10000000); -+ assert(32768 ^^ x0 == 1); -+ assert(32768 ^^ x1 == 32768); -+ assert(32768 ^^ x2 == 0x40000000); -+ assert(65536 ^^ x0 == 1); -+ assert(65536 ^^ x1 == 65536); -+ assert(131072 ^^ x0 == 1); -+ assert(131072 ^^ x1 == 131072); -+ assert(262144 ^^ x0 == 1); -+ assert(262144 ^^ x1 == 262144); -+ assert(524288 ^^ x0 == 1); -+ assert(524288 ^^ x1 == 524288); -+ assert(1048576 ^^ x0 == 1); -+ assert(1048576 ^^ x1 == 1048576); -+ assert(2097152 ^^ x0 == 1); -+ assert(2097152 ^^ x1 == 2097152); -+ assert(4194304 ^^ x0 == 1); -+ assert(4194304 ^^ x1 == 4194304); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/test7511.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test7511.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,309 @@ -+extern(C) int printf(const char*, ...); -+ -+/**********************************/ -+// 7511 -+ -+struct S7511(T) -+{ -+ // this is a pure function for T==int -+ T foo(T x) -+ { -+ return 2 * x; -+ } -+} -+ -+void test7511a() pure -+{ -+ S7511!int s; -+ s.foo(2); // error -> OK -+} -+ -+/**********************************/ -+// certain case - wrapper range -+ -+//import std.range; -+@property bool empty(T)(in T[] a) { return !a.length; } -+@property ref T front(T)(T[] a) { return a[0]; } -+void popFront(T)(ref T[] a) { a = a[1 .. $]; } -+ -+struct S(T) -+{ -+ int foo() -+ { -+ auto t = T(); -+ return t.bar(); -+ } -+} -+ -+struct Wrap(R) -+{ -+ R original; -+ this(T : R)(T t) { original = t; } -+ this(A...)(A args) { original = R(args); } -+ @property auto empty() { return original.empty; } -+ @property auto front() { return original.front; } -+ void popFront() { original.popFront(); } -+} -+ -+void test7511b() pure @safe -+{ -+ static struct Iota -+ { -+ size_t curr; -+ size_t max; -+ @property bool empty() pure @safe { return curr == max; } -+ @property size_t front() pure @safe { return curr; } -+ void popFront() pure @safe { ++curr; } -+ } -+ { -+ auto a = Iota(0, 3); -+ size_t i = 0; -+ foreach (e; a) { assert(e == i++); } // OK -+ } -+ { -+ auto a = Wrap!(int[])([0,1,2]); -+ size_t i = 0; -+ foreach (e; a) { assert(e == i++); } // errors! -+ } -+ { -+ auto a = Wrap!Iota(0, 3); -+ size_t i = 0; -+ foreach (e; a) { assert(e == i++); } // errors! -+ } -+} -+ -+/**********************************/ -+// with attribute inheritance -+ -+struct X -+{ -+ static int bar() pure nothrow @safe -+ { -+ return 1; -+ } -+} -+ -+class Class(T) -+{ -+ int foo() -+ { // inferred to pure nothrow @safe -+ return T.bar(); -+ } -+} -+ -+alias Class!X C; -+ -+class D : C -+{ -+ override int foo() -+ { // inherits attributes from Class!X.foo -+ return 2; -+ } -+} -+ -+void test7511c() pure nothrow @safe -+{ -+// Disabled for Bigzilla 9952 -+/+ -+ assert((new C()).foo() == 1); -+ assert((new D()).foo() == 2); -+ static assert(typeof(&C.init.foo).stringof == "int delegate() pure nothrow @safe"); -+ static assert(typeof(&D.init.foo).stringof == "int delegate() pure nothrow @safe"); -++/ -+} -+ -+/**********************************/ -+// curiously recurring template pattern (CRTP) -+ -+class BX(T, bool mutual) -+{ -+ int foo() -+ { -+ static if (mutual) -+ return (cast(T)this).foo(); -+ else -+ return 0; -+ } -+} -+ -+class D1 : BX!(D1, true) -+{ -+ alias typeof(super) B; -+ int val; -+ this(int n) { val = n; } -+ override int foo() { return val; } -+} -+class D2 : BX!(D2, false) -+{ -+ alias typeof(super) B; -+ int val; -+ this(int n) { val = n; } -+ override int foo() { return val; } -+} -+class D3 : BX!(D3, true) -+{ -+ alias typeof(super) B; -+ int val; -+ this(int n) { val = n; } -+ override int foo() pure nothrow { return val; } -+} -+class D4 : BX!(D4, false) -+{ -+ alias typeof(super) B; -+ int val; -+ this(int n) { val = n; } -+ override int foo() pure nothrow { return val; } -+} -+ -+void test7511d() -+{ -+// Disabled for Bigzilla 9952 -+/+ -+ // mutual dependent and attribute inference impure, un-@safe, and may throw is default. -+ auto d1 = new D1(10); -+ static assert(is(typeof(&d1.B.foo) == int function())); -+ static assert(is(typeof(&d1.foo) == int delegate())); -+ assert(d1.foo() == 10); -+ -+ // no mutual dependent. -+ auto d2 = new D2(10); -+ static assert(is(typeof(&d2.B.foo) == int function() pure nothrow @safe)); -+ static assert(is(typeof(&d2 .foo) == int delegate() pure nothrow @safe)); -+ assert(d2.foo() == 10); -+ -+ // mutual dependent with explicit attribute specification. -+ auto d3 = new D3(10); -+ static assert(is(typeof(&d3.B.foo) == int function() pure nothrow)); -+ static assert(is(typeof(&d3 .foo) == int delegate() pure nothrow)); -+ assert(d3.foo() == 10); -+ -+ // no mutual dependent with explicit attribute specification. -+ auto d4 = new D4(10); -+ static assert(is(typeof(&d4.B.foo) == int function() pure nothrow @safe)); -+ static assert(is(typeof(&d4 .foo) == int delegate() pure nothrow @safe)); -+ assert(d4.foo() == 10); -++/ -+} -+ -+/**********************************/ -+// 9952 -+ -+@system void writeln9952(int) {} // impure throwable -+ -+class C9952(T) -+{ -+ T foo() -+ { -+ return 2; -+ } -+} -+ -+class D9952 : C9952!int -+{ -+ override int foo() -+ { -+ writeln9952(super.foo()); -+ return 3; -+ } -+} -+ -+void test9952() -+{ -+ static assert(typeof(&C9952!int.init.foo).stringof == "int delegate()"); -+ static assert(typeof(&D9952 .init.foo).stringof == "int delegate()"); -+} -+ -+/**********************************/ -+// 10373 -+ -+template isMutable10373(T) -+{ -+ enum isMutable10373 = !is(T == const) && !is(T == immutable) && !is(T == inout); -+} -+ -+struct Test10373a(T, int N = 0) -+{ -+ static if (N == 0) T[ ] mBuffer; -+ else T[N] mBuffer; -+ -+ static if (is(T == class)) -+ {} -+ else -+ { -+ T* at_(size_t n) { return &mBuffer[n]; } -+ -+ static if (is(typeof(*at_(0) = T.init))) -+ { -+ T opIndexAssign(T v, size_t i) -+ { -+ return (*at_(i) = v); -+ } -+ } -+ } -+} -+struct Test10373b(T, int N = 0) -+{ -+ static if (is(T == class)) -+ {} -+ else -+ { -+ T* at_(size_t n) { return &mBuffer[n]; } -+ -+ static if (is(typeof(*at_(0) = T.init))) -+ { -+ T opIndexAssign(T v, size_t i) -+ { -+ return (*at_(i) = v); -+ } -+ } -+ } -+ -+ static if (N == 0) T[ ] mBuffer; -+ else T[N] mBuffer; -+} -+struct Test10373c(T, int N = 0) -+{ -+ static if (is(T == class)) -+ {} -+ else -+ { -+ T* at_(size_t n) { return &mBuffer[n]; } -+ -+ static if (isMutable10373!T) -+ { -+ T opIndexAssign(T v, size_t i) -+ { -+ return (*at_(i) = v); -+ } -+ } -+ } -+ -+ static if (N == 0) T[ ] mBuffer; -+ else T[N] mBuffer; -+} -+ -+void test10373() -+{ -+ static assert(is(Test10373a!(int, 2))); -+ static assert(is(Test10373b!(int, 2))); -+ static assert(is(Test10373c!(int, 2))); -+ -+ Test10373a!(int, 2) testa; // dmd2.062:OK dmd2.063:OK -+ Test10373b!(int, 2) testb; // dmd2.062:OK dmd2.063:NG -+ Test10373c!(int, 2) testc; // dmd2.062:OK dmd2.063:OK -+} -+ -+/**********************************/ -+ -+int main() -+{ -+ test7511a(); -+ test7511b(); -+ test7511c(); -+ test7511d(); -+ test9952(); -+ test10373(); -+ -+ printf("Success\n"); -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/test8997.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test8997.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+// COMPILE_SEPARATELY -+// EXTRA_SOURCES: imports/test8997a.d -+ -+module test8997; -+ -+import imports.test8997a; -+ -+void main() -+{ -+ auto a = new A(); -+ -+ foreach(key; a.foobar.byKey()) -+ { -+ } -+} ---- a/src/gcc/testsuite/gdc.test/runnable/test9068.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test9068.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,82 +0,0 @@ --// PERMUTE_ARGS: -- --struct Foo { -- static int[] destroyed; -- int x; -- ~this() { destroyed ~= x; } --} -- -- --struct SimpleCounter { -- static int destroyedCount; -- const(int) limit = 5; -- int counter; -- ~this() { destroyedCount++; } -- -- // Range primitives. -- @property bool empty() const { return counter >= limit; } -- @property int front() { return counter; } -- void popFront() { counter++; } --} -- -- --// ICE when trying to break outer loop from inside switch statement --void Bug9068() { -- -- //---------------------------------------- -- // There was never a bug in this case (no range). -- int sum; --loop_simple: -- foreach (i; [10, 20]) { -- sum += i; -- break loop_simple; -- } -- assert(sum == 10); -- -- //---------------------------------------- -- // There was a bug with loops over ranges. -- int last = -1; --X: foreach (i; SimpleCounter()) { -- switch(i) { -- case 3: break X; -- default: last = i; -- } -- } -- assert(last == 2); -- assert(SimpleCounter.destroyedCount == 1); -- -- //---------------------------------------- -- // Simpler case: the compiler error had nothing to do with the switch. -- last = -1; --loop_with_range: -- foreach (i; SimpleCounter()) { -- last = i; -- break loop_with_range; -- } -- assert(last == 0); -- assert(SimpleCounter.destroyedCount == 2); -- -- //---------------------------------------- -- // Test with destructors: the loop is implicitly wrapped into two -- // try/finally clauses. --loop_with_dtors: -- for (auto x = Foo(4), y = Foo(5); x.x != 10; ++x.x) { -- if (x.x == 8) -- break loop_with_dtors; -- } -- assert(Foo.destroyed == [5, 8]); -- Foo.destroyed.clear(); -- -- //---------------------------------------- -- // Same with an unlabelled break. -- for (auto x = Foo(4), y = Foo(5); x.x != 10; ++x.x) { -- if (x.x == 7) -- break; -- } -- assert(Foo.destroyed == [5, 7]); -- Foo.destroyed.clear(); --} -- --void main() { -- Bug9068(); --} ---- a/src/gcc/testsuite/gdc.test/runnable/test9377.sh 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test9377.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,17 +0,0 @@ --#!/usr/bin/env bash -- --src=runnable${SEP}extra-files --dir=${RESULTS_DIR}${SEP}runnable -- --if [ $OS == "win32" -o $OS == "win64" ]; then -- LIBEXT=.lib --else -- LIBEXT=.a --fi --libname=${dir}${SEP}lib9377${LIBEXT} -- --$DMD -m${MODEL} -I${src} -of${libname} -c ${src}${SEP}mul9377a.d ${src}${SEP}mul9377b.d -lib --$DMD -m${MODEL} -I${src} -of${dir}${SEP}mul9377 ${src}${SEP}multi9377.d ${libname} -- --rm ${dir}/{lib9377${LIBEXT},mul9377${OBJ},mul9377${EXE}} -- ---- a/src/gcc/testsuite/gdc.test/runnable/test9495.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/test9495.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,31 @@ -+// PERMUTE_ARGS: -+ -+import core.vararg; -+ -+int func1(int a, ...) -+{ -+ auto result = va_arg!int(_argptr); -+ return result; -+} -+ -+void test9495a() -+{ -+ assert(func1(5, 12345678) == 12345678); -+} -+ -+int func2(const(char)[] a, ...) -+{ -+ auto result = va_arg!int(_argptr); -+ return result; -+} -+ -+void test9495b() -+{ -+ assert(func2("5", 12345678) == 12345678); -+} -+ -+void main(string[] args) -+{ -+ test9495a(); -+ test9495b(); -+} -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/runnable/testaa2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testaa2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -106,12 +106,185 @@ void test4523() - } - - /************************************************/ -+// 3825 -+ -+import std.math; // necessary for ^^= -+void test3825() -+{ -+ // Check for RangeError is thrown -+ bool thrown(T)(lazy T cond) -+ { -+ import core.exception; -+ bool f = false; -+ try { -+ cond(); -+ } catch (RangeError e) { f = true; } -+ return f; -+ } -+ -+ int[int] aax; -+ int[][int] aay; -+ -+ aax = null, aay = null; -+ assert(thrown(aax[0])); -+ assert(thrown(aax[0] = aax[0])); // rhs throws -+ assert(thrown(aax[0] += aax[0])); // rhs throws -+ assert(thrown(aax[0] ^^= aax[0])); // rhs throws -+ assert(thrown(aay[0] ~= aay[0])); // rhs throws -+ aax = null; aax[0] = 1; assert(aax[0] == 1); // setting aax[0] is OK -+ aax = null; aax[0] += 1; assert(aax[0] == +1); // setting aax[0] to 0 and modify it is OK -+ aax = null; aax[0] ^^= 1; assert(aax[0] == 0); // setting aax[0] to 0 and modify it is OK -+ aay = null; aay[0] ~= []; assert(aay[0] == []); // setting aay[0] to 0 and modify it is OK -+ aax = null; ++aax[0]; assert(aax[0] == +1); // setting aax[0] to 0 and modify it is OK -+ aax = null; --aax[0]; assert(aax[0] == -1); // setting aax[0] to 0 and modify it is OK -+ -+ aax = [0:0], aay = [0:null]; -+ assert(thrown(aax[aax[1]] = 1)); // accessing aax[1] in key part throws -+ assert(thrown(aax[aax[1]] += 1)); // accessing aax[1] in key part throws -+ assert(thrown(aax[aax[1]] ^^= 1)); // accessing aax[1] in key part throws -+ assert(thrown(aay[aax[1]] ~= [])); // accessing aax[1] in key part throws -+ -+ //assert(thrown(aax[( aax[1], 0)] = 0)); -+ /* accessing aax[1] in key part, why doesn't throw? -+ * Because, in aax[(aax[1], 0)], aax[1] is in lhs of comma expression, and is treated -+ * it has no side effect. Then optimizer eliminate it completely, and -+ * whole expression succeed to run in runtime. */ -+ int n = 0; -+ assert(thrown(aax[(n=aax[1], 0)] = 0)); // accessing aax[1] in key part, throws OK -+ -+ // This works as expected. -+ int[int][int] aaa; -+ aaa[0][0] = 0; assert(aaa[0][0] == 0); // setting aaa[0][0] is OK -+ -+ // real test cases -+ void bug3825() -+ { -+ string[] words = ["how", "are", "you", "are"]; -+ -+ int[string] aa1; -+ foreach (w; words) -+ aa1[w] = ((w in aa1) ? (aa1[w] + 1) : 2); -+ //writeln(aa1); // Prints: [how:1,you:1,are:2] -+ -+ int[string] aa2; -+ foreach (w; words) -+ if (w in aa2) -+ aa2[w]++; -+ else -+ aa2[w] = 2; -+ //writeln(aa2); // Prints: [how:2,you:2,are:3] -+ -+ assert(aa1 == aa2); -+ assert(aa1 == ["how":2, "you":2, "are":3]); -+ assert(aa2 == ["how":2, "you":2, "are":3]); -+ } -+ void bug5021() -+ { -+ int func() -+ { -+ throw new Exception("It's an exception."); -+ } -+ -+ int[string] arr; -+ try -+ { -+ arr["hello"] = func(); -+ } -+ catch(Exception e) -+ { -+ } -+ assert(arr.length == 0); -+ } -+ void bug7914() -+ { -+ size_t[ubyte] aa; -+ aa[0] = aa.length; -+ assert(aa[0] == 0); -+ } -+ void bug8070() -+ { -+ Object[string] arr; -+ -+ class A -+ { -+ this() -+ { -+ // at this point: -+ assert("x" !in arr); -+ } -+ } -+ -+ arr["x"] = new A(); -+ } -+ bug3825(); -+ bug5021(); -+ bug7914(); -+ bug8070(); -+} -+ -+void test3825x() -+{ -+ static int ctor, cpctor, dtor; -+ -+ static struct S -+ { -+ this(int) { ++ctor; } -+ this(this) { ++cpctor; } -+ ~this() { ++dtor; } -+ } -+ -+ { -+ auto value = S(1); -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ ref getRef(ref S s = value) { return s; } -+ auto getVal() { return value; } -+ int[S] aa; -+ -+ aa[value] = 10; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ aa[getRef()] += 1; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ aa[getVal()] += 1; -+ assert(ctor==1 && cpctor==1 && dtor==1); -+ } -+ assert(ctor==1 && cpctor==1 && dtor==2); -+ assert(ctor + cpctor == dtor); -+} -+ -+/************************************************/ -+// 10106 -+ -+struct GcPolicy10106 {} -+ -+struct Uint24Array10106(SP = GcPolicy10106) -+{ -+ this(this) {} -+} -+ -+struct InversionList10106(SP = GcPolicy10106) -+{ -+ Uint24Array10106!SP data; -+} -+ -+alias InversionList10106!GcPolicy10106 CodepointSet10106; -+ -+struct PropertyTable10106 -+{ -+ CodepointSet10106[string] table; -+} -+ -+/************************************************/ - - int main() - { - testaa(); - test1899(); - test4523(); -+ test3825(); -+ test3825x(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/testaa.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testaa.d 2014-04-01 16:32:51.000000000 +0100 -@@ -249,8 +249,8 @@ void test11() - printf("Key.hash = %d\n", Key.hash); - assert(Key.hash == 1); - printf("Key.cmp = %d\n", Key.cmp); -- assert(Key.cmp == 1); --// assert(Key.equals == 1); -+ printf("Key.equals = %d\n", Key.equals); -+ assert(Key.cmp == 1 && !Key.equals || !Key.cmp && Key.equals == 1); - } - - -@@ -786,13 +786,334 @@ void test4826c() - - struct ICE5131 - { -+ this(int n) {} - ICE5131 opAssign(int x) { return this; } - } - - void test5131() - { - ICE5131[string] a; -- a["ICE?"] = 1; -+ a["ICE?"] = 1; // call ctor -+ a["ICE?"] = 1; // call opAssign -+} -+ -+/************************************************/ -+// 6178 -+ -+bool test6178a() -+{ -+ // AA value setting through identity opAssign -+ -+ int assign = 0; -+ struct S -+ { -+ int value = 10; -+ -+ void opAssign(S rhs) -+ { -+ ++assign; -+ assert(value == 10); -+ } -+ } -+ -+ int count = 0; -+ int makeKey() { return ++count; } -+ -+ S[int] aa; -+ assert(aa.length == 0); -+ -+ aa[makeKey()] = S(); -+ assert(assign == 0); -+ assert(aa.length == 1 && 1 in aa); -+ -+ aa[1] = S(); -+ assert(assign == 1); -+ assert(aa.length == 1 && 1 in aa); -+ -+ return true; -+} -+ -+bool test6178b() -+{ -+ // AA value setting through implicit ctor call + non-identity opAssign -+ -+ int ctor = 0; -+ int assign = 0; -+ struct S -+ { -+ int value = 10; -+ -+ @disable this(); -+ -+ this(int n) -+ { -+ ++ctor; -+ assert(value == 10); -+ value = 20; -+ } -+ void opAssign(int rhs) -+ { -+ ++assign; -+ assert(value == 20); -+ assert(rhs == 30); -+ value = rhs; -+ } -+ } -+ -+ int count = 0; -+ int makeKey() { return ++count; } -+ -+ S[int] aa; -+ assert(aa.length == 0); -+ -+ aa[makeKey()] = 20; -+ assert(assign == 0 && ctor == 1 && count == 1); -+ assert(aa.length == 1 && (1 in aa)); -+ -+ aa[1] = 30; -+ assert(assign == 1 && ctor == 1); -+ assert(aa.length == 1 && 1 in aa); -+ -+ return true; -+} -+ -+bool test6178c() -+{ -+ // AA value setting through non-identity opAssign -+ -+ struct S -+ { -+ //this(int) {} -+ // not possible to perform implicit ctor call -+ void opAssign(int) {} -+ } -+ -+ S[int] aa; -+ assert(aa.length == 0); -+ -+ if (!__ctfe) -+ { -+ // currently CTFE does not support throwing RangeError -+ import core.exception : RangeError; -+ try { aa[1] = 1; assert(0); } catch (RangeError) {} -+ -+ // The above line is exactly same as: -+ try { aa[1].opAssign(1); assert(0); } catch (RangeError) {} -+ } -+ assert(aa.length == 0); -+ -+ aa[1] = S(); -+ aa[1] = 1; -+ assert(aa.length == 1); -+ -+ return true; -+} -+ -+bool test6178d() -+{ -+ // AA value setting through implicit ctor call + alias this -+ -+ int ctor; -+ struct S -+ { -+ this(int n) { ++ctor; value = n; } -+ -+ int value; -+ alias value this; -+ } -+ -+ S[int] aa; -+ assert(ctor == 0); -+ assert(aa.length == 0); -+ -+ aa[1] = 0; // implicit ctor call + blit assign -+ assert(aa[1].value == 0 && ctor == 1); -+ assert(aa.length == 1); -+ -+ aa[1] = 1; // set through alias this -+ assert(aa[1].value == 1 && ctor == 1); -+ assert(aa.length == 1); -+ -+ return true; -+} -+ -+bool test6178e() -+{ -+ // AA value setting through alias this -+ -+ struct S -+ { -+ int value; -+ alias value this; -+ } -+ -+ S[int] aa; -+ assert(aa.length == 0); -+ -+ if (!__ctfe) -+ { -+ // currently CTFE does not support throwing RangeError -+ import core.exception : RangeError; -+ try { aa[1] = 1; assert(0); } catch (RangeError) {} -+ -+ // The above line is exactly same as: -+ try { aa[1].value = 1; assert(0); } catch (RangeError) {} -+ } -+ assert(aa.length == 0); -+ -+ aa[1] = S(0); // construct + blit assign -+ assert(aa[1].value == 0 && aa.length == 1); -+ -+ aa[1] = 1; // set through alias this -+ assert(aa[1].value == 1 && aa.length == 1); -+ -+ return true; -+} -+ -+void test6178() -+{ -+ static assert(test6178a()); // ctfe check -+ test6178a(); // runtime test -+ -+ static assert(test6178b()); -+ test6178b(); -+ -+ static assert(test6178c()); -+ test6178c(); -+ -+ static assert(test6178d()); -+ test6178d(); -+ -+ static assert(test6178e()); -+ test6178e(); -+} -+ -+void test6178x() -+{ -+ static int ctor, cpctor, dtor; -+ -+ static struct S -+ { -+ this(int) { ++ctor; printf("ctor\n"); } -+ this(this) { ++cpctor; printf("cpctor\n"); } -+ ~this() { ++dtor; printf("dtor\n"); } -+ } -+ static struct X -+ { -+ this(int) {} -+ void opAssign(int) {} -+ } -+ -+ X[S] aa1; -+ S[int] aa2; -+ -+ { -+ auto value = S(1); -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ ref getRef(ref S s = value) { return s; } -+ auto getVal() { return value; } -+ -+ aa1[value] = 10; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ aa1[getRef()] = 20; -+ assert(ctor==1 && cpctor==0 && dtor==0); -+ -+ aa1[getVal()] = 20; -+ assert(ctor==1 && cpctor==1 && dtor==1); -+ -+ aa2[1] = value; -+ assert(ctor==1 && cpctor==2 && dtor==1); -+ -+ aa2[2] = getRef(); -+ assert(ctor==1 && cpctor==3 && dtor==1); -+ } -+ assert(ctor==1 && cpctor==3 && dtor==2); -+ assert(ctor + cpctor - aa2.length == dtor); -+} -+ -+/************************************************/ -+// 10595 -+ -+struct S10595 -+{ -+ bool b = true; -+ -+ bool test() -+ { -+ if (!b) // note: must be a check, not 'return b;' -+ return false; -+ -+ return true; -+ } -+} -+ -+struct Wrap10595 -+{ -+ int i; -+ alias i this; -+ S10595 s; -+} -+ -+void test10595() -+{ -+ { -+ Wrap10595[int] wrap; -+ -+ wrap[0] = Wrap10595(); -+ wrap[0].i = 0; -+ -+ assert(wrap[0].s.test()); // ok -+ } -+ -+ { -+ Wrap10595[int] wrap; -+ -+ wrap[0] = Wrap10595(); -+ wrap[0] = 0; // note: using 'alias this' to assign -+ -+ assert(wrap[0].s.test()); // failure -+ } -+} -+ -+/************************************************/ -+// 10970 -+ -+struct RefCounted10970(T) //if (!is(T == class)) -+{ -+ struct RefCountedStore -+ { -+ } -+ RefCountedStore _refCounted; -+ -+ this(this) {} -+ -+ ~this() {} -+} -+ -+struct Array10970(T) if (!is(T : const(bool))) -+{ -+ struct Payload -+ { -+ } -+ RefCounted10970!Payload _data; -+} -+ -+class C10970 -+{ -+ this(string name) -+ { -+ m[name] = Arr(); -+ } -+ -+ alias Array10970!C10970 Arr; -+ Arr[string] m; -+} -+ -+void test10970() -+{ -+ C10970 c = new C10970("test"); - } - - /************************************************/ -@@ -860,6 +1181,37 @@ int[N6655] bar6655; - - /************************************************/ - -+struct ChunkLoc {} -+ -+ChunkLoc Get() -+{ -+ return ChunkLoc(); -+} -+ -+void test6799() -+{ -+ int[ChunkLoc] aa; -+ aa.remove(Get()); -+} -+ -+/************************************************/ -+// 11359 -+ -+void test11359() -+{ -+ class Bar {} -+ static Bar[string] aa; -+ static ref fun() { return aa; } -+ -+ string key = "test"; -+ -+ fun[key] = new Bar; -+ assert(aa.length == 1); -+ Bar bar = fun[key]; -+} -+ -+/************************************************/ -+ - int main() - { - printf("before test 1\n"); test1(); -@@ -896,10 +1248,16 @@ int main() - - test4826c(); - test5131(); -+ test6178(); -+ test6178x(); -+ test10595(); -+ test10970(); - test6433(); - test6612(); - test7365(); - test5520(); -+ test6799(); -+ test11359(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/testabi.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testabi.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,927 @@ -+// PERMUTE_ARGS: -release -gc -+ -+version(Windows) {} -+else version(X86_64) -+{ -+ /* uncomment to enable tests! */ -+ //version = Run_X86_64_Tests; -+} -+ -+extern (C) int printf(const char*, ...); -+ -+template tuple(A...) { alias A tuple; } -+ -+alias byte B; -+alias short S; -+alias int I; -+alias long L; -+alias float F; -+alias double D; -+alias real R; -+ -+// Single Type -+ -+struct b { B a; } -+struct bb { B a,b; } -+struct bbb { B a,b,c; } -+struct bbbb { B a,b,c,d; } -+struct bbbbb { B a,b,c,d, e; } -+struct b6 { B a,b,c,d, e,f; } -+struct b7 { B a,b,c,d, e,f,g; } -+struct b8 { B a,b,c,d, e,f,g,h; } -+struct b9 { B a,b,c,d, e,f,g,h, i; } -+struct b10 { B a,b,c,d, e,f,g,h, i,j; } -+struct b11 { B a,b,c,d, e,f,g,h, i,j,k; } -+struct b12 { B a,b,c,d, e,f,g,h, i,j,k,l; } -+struct b13 { B a,b,c,d, e,f,g,h, i,j,k,l, m; } -+struct b14 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n; } -+struct b15 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o; } -+struct b16 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p; } -+struct b17 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q; } -+struct b18 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r; } -+struct b19 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r,s; } -+struct b20 { B a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p, q,r,s,t;} -+ -+struct s { S a; } -+struct ss { S a,b; } -+struct sss { S a,b,c; } -+struct ssss { S a,b,c,d; } -+struct sssss { S a,b,c,d, e; } -+struct s6 { S a,b,c,d, e,f; } -+struct s7 { S a,b,c,d, e,f,g; } -+struct s8 { S a,b,c,d, e,f,g,h; } -+struct s9 { S a,b,c,d, e,f,g,h, i; } -+struct s10 { S a,b,c,d, e,f,g,h, i,j;} -+ -+struct i { I a; } struct l { L a; } -+struct ii { I a,b; } struct ll { L a,b; } -+struct iii { I a,b,c; } struct lll { L a,b,c; } -+struct iiii { I a,b,c,d; } struct llll { L a,b,c,d; } -+struct iiiii { I a,b,c,d,e; } struct lllll { L a,b,c,d,e; } -+ -+struct f { F a; } struct d { D a; } -+struct ff { F a,b; } struct dd { D a,b; } -+struct fff { F a,b,c; } struct ddd { D a,b,c; } -+struct ffff { F a,b,c,d; } struct dddd { D a,b,c,d; } -+struct fffff { F a,b,c,d,e; } struct ddddd { D a,b,c,d,e; } -+ -+// Mixed Size -+ -+struct js { I a; S b; } -+struct iss { I a; S b,c; } -+struct si { S a; I b; } -+struct ssi { S a,b; I c; } -+struct sis { S a; I b; S c; } -+ -+struct ls { L a; S b; } -+struct lss { L a; S b,c; } -+struct sl { S a; L b; } -+struct ssl { S a,b; L c; } -+struct sls { S a; L b; S c; } -+ -+struct li { L a; I b; } -+struct lii { L a; I b,c; } -+struct il { I a; L b; } -+struct iil { I a,b; L c; } -+struct ili { I a; L b; I c; } -+ -+struct df { D a; F b; } -+struct dff { D a; F b,c; } -+struct fd { F a; D b; } -+struct ffd { F a,b; D c; } -+struct fdf { F a; D b; F c; } -+ -+// Mixed Types -+ -+struct fi { F a; I b; } -+struct fii { F a; I b,c; } -+struct jf { I a; F b; } -+struct iif { I a,b; F c; } -+struct ifi { I a; F b; I c; } -+ -+struct ffi { F a,b; I c; } -+struct ffii { F a,b; I c,d; } -+struct iff { I a; F b,c; } -+struct iiff { I a,b; F c,d; } -+struct ifif { I a; F b; I c; F d;} -+ -+struct di { D a; I b; } -+struct dii { D a; I b,c; } -+struct id { I a; D b; } -+struct iid { I a,b; D c; } -+struct idi { I a; D b; I c; } -+ -+// Real ( long double ) -+ -+struct r { R a; } -+struct rr { R a,b; } -+struct rb { R a; B b; } -+struct rf { R a; F b; } -+struct fr { F a; R b; } -+ -+ // Int Registers only -+alias tuple!( b,bb,bbb,bbbb,bbbbb, -+ b6, b7, b8, b9, b10, -+ b11,b12,b13,b14,b15, -+ b16,b17,b18,b19,b20, -+ s,ss,sss,ssss,sssss, -+ s6, s7, s8, s9, s10, -+ i,ii,iii,iiii,iiiii, -+ l,ll,lll,llll,lllll, -+ // -+ js,iss,si,ssi, sis, -+ ls,lss,sl,ssl, sls, -+ li,lii,il,iil, ili, -+ fi,fii,jf,iif, ifi, -+ ffi,ffii,iff,iiff,ifif, // INT_END -+ -+ // SSE registers only -+ f,ff,fff,ffff,fffff, -+ d,dd,ddd,dddd,ddddd, -+ // -+ df,dff,fd,ffd, fdf, // SSE_END -+ -+ // Int and SSE -+ di, dii,id, iid, idi, // MIX_END -+ // --- -+ ) ALL_T; -+ -+enum INT_END = 65; -+enum SSE_END = 80; -+enum MIX_END = ALL_T.length; -+ -+ // x87 -+alias tuple!( r,rr,rb,rf,fr, -+ // --- -+ ) R_T; -+//"r","rr","rb","rf","fr", -+ -+ -+string[] ALL_S=[ -+ "b","bb","bbb","bbbb","bbbbb", -+ "b6", "b7", "b8", "b9", "b10", -+ "b11","b12","b13","b14","b15", -+ "b16","b17","b18","b19","b20", -+ "s","ss","sss","ssss","sssss", -+ "s6","s7","s8","s9" , "s10", -+ "i","ii","iii","iiii","iiiii", -+ "l","ll","lll","llll","lllll", -+ // --- -+ "js","iss","si","ssi", "sis", -+ "ls","lss","sl","ssl", "sls", -+ "li","lii","il","iil", "ili", -+ "fi","fii","jf","iif", "ifi", -+ "ffi","ffii","iff","iiff","ifif", -+ // --- -+ "f","ff","fff","ffff","fffff", -+ "d","dd","ddd","dddd","ddddd", -+ "df","dff","fd","ffd", "dfd", -+ // --- -+ "di","dii","id","iid","idi", -+ ]; -+ -+/* *********************************************************************** -+ All -+ ************************************************************************/ -+// test1 Struct passing and return -+ -+int[MIX_END] results_1; -+ -+T test1_out(T)( ) -+{ -+ T t; -+ foreach( i, ref e; t.tupleof ) e = i+1; -+ return t; -+} -+T test1_inout(T)( T t) -+{ -+ foreach( i, ref e; t.tupleof ) e += 10; -+ return t; -+} -+ -+void test1_call_out(T)( int n ) -+{ -+ T t1; -+ foreach( i, ref e; t1.tupleof ) e = i+1; -+ T t2 = test1_out!(T)(); -+ -+ if( t1 == t2 ) results_1[n] |= 1; -+} -+void test1_call_inout(T)( int n ) -+{ -+ T t1; -+ foreach( i, ref e; t1.tupleof ) e = i+1; -+ T t2 = test1_inout!(T)( t1 ); -+ foreach( i, ref e; t1.tupleof ) e += 10; -+ -+ if( t1 == t2 ) results_1[n] |= 2; -+} -+ -+void D_test1( ) -+{ -+ // Run Tests -+ foreach( n, T; ALL_T ) -+ { -+ test1_call_out!(T)(n); -+ test1_call_inout!(T)(n); -+ } -+ -+ bool pass = true; -+ foreach( i, r; results_1 ) -+ { -+ if( ~r & 1 ) -+ { -+ pass = false; -+ printf( "Test1 out %.*s \tFail\n", ALL_S[i].length, ALL_S[i].ptr ); -+ } -+ if( ~r & 2 ) -+ { -+ pass = false; -+ printf( "Test1 inout %.*s \tFail\n", ALL_S[i].length, ALL_S[i].ptr ); -+ } -+ } -+ assert( pass ); -+ -+ results_1[0..5] = 0; -+ foreach( n, T; R_T ) -+ { -+ test1_call_out!(T)(n); -+ test1_call_inout!(T)(n); -+ } -+} -+ -+/************************************************************************/ -+// based on runnable/test23.d : test44() -+// Return Struct into an Array -+ -+struct S1 -+{ int i,j; -+ -+ static S1 foo(int x) -+ { S1 s; -+ s.i = x; -+ return s; -+} } -+struct S2 -+{ int i,j,k; -+ -+ static S2 foo(int x) -+ { S2 s; -+ s.i = x; -+ return s; -+} } -+struct S3 -+{ float i,j; -+ -+ static S3 foo(int x) -+ { S3 s; -+ s.i = x; -+ return s; -+} } -+struct S4 -+{ float i,j,k; -+ -+ static S4 foo(int x) -+ { S4 s; -+ s.i = x; -+ return s; -+} } -+struct S5 -+{ float i,j; -+ int k; -+ -+ static S5 foo(float x) -+ { S5 s; -+ s.i = x; -+ return s; -+} } -+ -+void D_test2() -+{ -+ S1[] s1; -+ S2[] s2; -+ S3[] s3; -+ S4[] s4; -+ S5[] s5; -+ -+ s1 = s1 ~ S1.foo(6); s1 = s1 ~ S1.foo(1); -+ s2 = s2 ~ S2.foo(6); s2 = s2 ~ S2.foo(1); -+ s3 = s3 ~ S3.foo(6); s3 = s3 ~ S3.foo(1); -+ s4 = s4 ~ S4.foo(6); s4 = s4 ~ S4.foo(1); -+ s5 = s5 ~ S5.foo(6); s5 = s5 ~ S5.foo(1); -+ -+ assert( s1.length == 2 ); -+ assert( s1[0].i == 6 ); -+ assert( s1[1].i == 1 ); -+ -+ assert( s2.length == 2 ); -+ assert( s2[0].i == 6 ); -+ assert( s2[1].i == 1 ); -+ -+/+ // These Fail on Mainline DMD64 ( Should pass! ) -+ assert( s3.length == 2 ); -+ assert( s3[0].i == 6 ); -+ assert( s3[1].i == 1 ); -+ -+ assert( s4.length == 2 ); -+ assert( s4[0].i == 6 ); -+ assert( s4[1].i == 1 ); -++/ -+ assert( s5.length == 2 ); -+ assert( s5[0].i == 6 ); -+ assert( s5[1].i == 1 ); -+ -+} -+ -+/* *********************************************************************** -+ X86_64 -+ ************************************************************************/ -+ -+version(Run_X86_64_Tests) -+{ -+ -+ -+struct TEST -+{ -+ immutable int num; -+ immutable string desc; -+ bool[MIX_END] result; -+} -+ -+/** -+ * 0 = Should Fail -+ * 1 = Should Pass -+ */ -+immutable int[MIX_END] expected = -+ [ -+ 1,1,1,1,1, // b -+ 1,1,1,1,1, // b6 -+ 1,1,1,1,1, // b11 -+ 1,0,0,0,0, // b16 -+ -+ 1,1,1,1,1, // s -+ 1,1,1,0,0, // s6 -+ 1,1,1,1,0, // i -+ 1,1,0,0,0, // l -+ 1,1,1,1,1, // si mix -+ 1,1,1,1,0, // sl -+ 1,1,1,1,0, // il -+ 1,1,1,1,1, // int and float -+ 1,1,1,1,1, // int and float -+ -+ // SSE regs only -+ 1,1,1,1,0, // f -+ 1,1,0,0,0, // d -+ 1,1,1,1,0, // float and double -+ -+ // SSE + INT regs -+ 1,1,1,1,0, // int and double -+ ]; -+ -+ -+/** -+ * Describes value expected in registers -+ * -+ * null means do not test -+ * ( because value is passed on the stack ). -+ */ -+ -+immutable long[][] RegValue = -+ [ -+/* 0 b */ [ 0x0000000000000001, ], -+/* 1 bb */ [ 0x0000000000000201, ], -+/* 2 bbb */ [ 0x0000000000030201, ], -+/* 3 bbbb */ [ 0x0000000004030201, ], -+/* 4 bbbbb */ [ 0x0000000504030201, ], -+/* 5 b6 */ [ 0x0000060504030201, ], -+/* 6 b7 */ [ 0x0007060504030201, ], -+/* 7 b8 */ [ 0x0807060504030201, ], -+/* 8 b9 */ [ 0x0807060504030201, 0x0000000000000009 ], -+/* 9 b10 */ [ 0x0807060504030201, 0x0000000000000a09 ], -+/* 10 b11 */ [ 0x0807060504030201, 0x00000000000b0a09 ], -+/* 11 b12 */ [ 0x0807060504030201, 0x000000000c0b0a09 ], -+/* 12 b13 */ [ 0x0807060504030201, 0x0000000d0c0b0a09 ], -+/* 13 b14 */ [ 0x0807060504030201, 0x00000e0d0c0b0a09 ], -+/* 14 b15 */ [ 0x0807060504030201, 0x000f0e0d0c0b0a09 ], -+/* 15 b16 */ [ 0x0807060504030201, 0x100f0e0d0c0b0a09 ], -+/* 16 b17 */ null, -+/* 17 b18 */ null, -+/* 18 b19 */ null, -+/* 19 b20 */ null, -+/* 20 s */ [ 0x0000000000000001, ], -+/* 21 ss */ [ 0x0000000000020001, ], -+/* 22 sss */ [ 0x0000000300020001, ], -+/* 23 ssss */ [ 0x0004000300020001, ], -+/* 24 sssss */ [ 0x0004000300020001, 0x0000000000000005 ], -+/* 25 s6 */ [ 0x0004000300020001, 0x0000000000060005 ], -+/* 26 s7 */ [ 0x0004000300020001, 0x0000000700060005 ], -+/* 27 s8 */ [ 0x0004000300020001, 0x0008000700060005 ], -+/* 28 s9 */ null, -+/* 29 s10 */ null, -+/* 30 i */ [ 0x0000000000000001, ], -+/* 31 ii */ [ 0x0000000200000001, ], -+/* 32 iii */ [ 0x0000000200000001, 0x0000000000000003 ], -+/* 33 iiii */ [ 0x0000000200000001, 0x0000000400000003 ], -+/* 34 iiiii */ null, -+/* 35 l */ [ 0x0000000000000001, ], -+/* 36 ll */ [ 0x0000000000000001, 0x0000000000000002 ], -+/* 37 lll */ null, -+/* 38 llll */ null, -+/* 39 lllll */ null, -+ -+/* 40 js */ [ 0x0000000200000001, ], -+/* 41 iss */ [ 0x0003000200000001, ], -+/* 42 si */ [ 0x0000000200000001, ], -+/* 43 ssi */ [ 0x0000000300020001, ], -+/* 44 sis */ [ 0x0000000200000001, 0x0000000000000003 ], -+/* 45 ls */ [ 0x0000000000000001, 0x0000000000000002 ], -+/* 46 lss */ [ 0x0000000000000001, 0x0000000000030002 ], -+/* 47 sl */ [ 0x0000000000000001, 0x0000000000000002 ], -+/* 48 ssl */ [ 0x0000000000020001, 0x0000000000000003 ], -+/* 49 sls */ null, -+/* 50 li */ [ 0x0000000000000001, 0x0000000000000002 ], -+/* 51 lii */ [ 0x0000000000000001, 0x0000000300000002 ], -+/* 52 il */ [ 0x0000000000000001, 0x0000000000000002 ], -+/* 53 iil */ [ 0x0000000200000001, 0x0000000000000003 ], -+/* 54 ili */ null, -+ -+/* 55 fi */ [ 0x000000023f800000, ], -+/* 56 fii */ [ 0x000000023f800000, 0x0000000000000003 ], -+/* 57 jf */ [ 0x4000000000000001, ], -+/* 58 iif */ [ 0x0000000200000001, 0x0000000040400000 ], -+/* 59 ifi */ [ 0x4000000000000001, 0x0000000000000003 ], -+ -+/* 60 ffi */ [ 0x0000000000000003, 0x400000003f800000 ], -+/* 61 ffii */ [ 0x0000000400000003, 0x400000003f800000 ], -+/* 62 iff */ [ 0x4000000000000001, 0x0000000040400000 ], -+/* 63 iiff */ [ 0x0000000200000001, 0x4080000040400000 ], -+/* 64 ifif */ [ 0x4000000000000001, 0x4080000000000003 ], -+ -+/* 65 f */ [ 0x000000003f800000, ], -+/* 66 ff */ [ 0x400000003f800000, ], -+/* 67 fff */ [ 0x400000003f800000, 0x0000000040400000 ], -+/* 68 ffff */ [ 0x400000003f800000, 0x4080000040400000 ], -+/* 69 fffff */ null, -+/* 70 d */ [ 0x3ff0000000000000, ], -+/* 71 dd */ [ 0x3ff0000000000000, 0x4000000000000000 ], -+/* 72 ddd */ null, -+/* 73 dddd */ null, -+/* 74 ddddd */ null, -+ -+/* 75 df */ [ 0x3ff0000000000000, 0x0000000040000000 ], -+/* 76 dff */ [ 0x3ff0000000000000, 0x4040000040000000 ], -+/* 77 fd */ [ 0x000000003f800000, 0x4000000000000000 ], -+/* 78 ffd */ [ 0x400000003f800000, 0x4008000000000000 ], -+/* 79 fdf */ null, -+ -+/* 80 di */ [ 0x3ff0000000000000, 0x0000000000000002 ], -+/* 81 dii */ [ 0x3ff0000000000000, 0x0000000300000002 ], -+/* 82 id */ [ 0x4000000000000000, 0x0000000000000001 ], -+/* 83 iid */ [ 0x4008000000000000, 0x0000000200000001 ], -+/* 84 idi */ null, -+ ]; -+ -+/* Have to do it this way for OSX: Issue 7354 */ -+__gshared long[2] dump; -+ -+/** -+ * Generate Register capture -+ */ -+string gen_reg_capture( int n, string registers )( ) -+{ -+ if( RegValue[n] == null ) return "return;"; -+ -+ string[] REG = mixin(registers); // ["RDI","RSI"]; -+ -+ // Which type of compare -+ static if(n < INT_END) -+ enum MODE = 1; // Int -+ else static if(n < SSE_END) -+ enum MODE = 2; // Float -+ else enum MODE = 3; // Mix -+ -+ /* Begin */ -+ -+ string code = "asm {\n"; -+ -+ final switch( MODE ) -+ { -+ case 1: code ~= "mov [dump], "~REG[0]~";\n"; -+ REG = REG[1..$]; -+ break; -+ case 2: -+ case 3: code ~= "movq [dump], XMM0;\n"; -+ } -+ -+ if( RegValue[n].length == 2 ) -+ final switch( MODE ) -+ { -+ case 1: -+ case 3: code ~= "mov [dump+8], "~REG[0]~";\n"; -+ break; -+ case 2: code ~= "movq [dump+8], XMM1;\n"; -+ } else { -+ code ~= "xor R8, R8;\n"; -+ code ~= "mov [dump+8], R8;\n"; -+ } -+ -+ return code ~ "}\n"; -+} -+ -+/** -+ * Check the results -+ */ -+bool check( TEST data ) -+{ -+ bool pass = true; -+ foreach( i, e; expected ) -+ { -+ if( data.result[i] != (e & 1) ) -+ { -+ printf( "Test%d %s \tFail\n", data.num, ALL_S[i].ptr); -+ pass = false; -+ } -+ } -+ return pass; -+} -+ -+/************************************************************************/ -+ -+// test1 Return Struct in Registers -+// ( if RDI == 12 we have no hidden pointer ) -+ -+TEST data1 = { 1, "RDI hidden pointer" }; -+ -+T test1_asm( T, int n )( int i ) -+{ -+ asm { -+ -+ cmp EDI, 12; -+ je L1; -+ -+ leave; ret; -+ } -+L1: -+ data1.result[n] = true; -+} -+ -+void test1() -+{ -+ printf("\nRunning iasm Test 1 ( %s )\n", data1.desc.ptr); -+ -+ foreach( int n, T; ALL_T ) -+ test1_asm!(T,n)(12); -+ -+ check( data1 ); -+} -+ -+/************************************************************************/ -+// test2 Pass Struct in Registers -+// ( if RDI == 0 we have no stack pointer ) -+ -+TEST data2 = { 2, "RDI struct pointer" }; -+ -+T test2_asm( T, int n )( T t ) -+{ -+ asm { -+ -+ mov [dump], RDI; -+ mov [dump+8], RSP; -+ cmp EDI, 0; // TODO test RDI is a ptr to stack ? ? -+ je L1; -+ -+ leave; ret; -+ } -+L1: -+ data2.result[n] = true; -+} -+T test2f_asm( T, int n )( T t, int x ) -+{ -+ asm { -+ -+ cmp EDI, 12; -+ je L1; -+ -+ leave; ret; -+ } -+L1: -+ data2.result[n] = true; -+} -+ -+void test2() -+{ -+ printf("\nRunning iasm Test 2 ( %s )\n", data2.desc.ptr); -+ -+ // Integer -+ foreach( int n, T; ALL_T ) { -+ T t = { 0 }; -+ test2_asm!(T,n)( t ); -+ } -+ -+ // float alternative test -+ foreach( int n, T; ALL_T[INT_END..SSE_END] ) -+ { -+ enum n2 = n + INT_END; -+ data2.result[n2] = false; -+ test2f_asm!(T,n2)( T.init, 12 ); -+ } -+ -+ check( data2 ); -+} -+ -+/************************************************************************/ -+// test3 -+ -+TEST data3 = { 3, "Check Return Register value" }; -+ -+void test3_run( T, int n )( ) -+{ -+ test3_ret!T(); -+ mixin( gen_reg_capture!(n,`["RAX","RDX"]`)() ); -+ -+ //dbg!(T,n)( ); -+ -+ enum len = RegValue[n].length; -+ if( dump[0..len] == RegValue[n] ) -+ data3.result[n] = true; -+} -+ -+T test3_ret( T )( ) -+{ -+ T t; -+ foreach( i, ref e; t.tupleof ) e = i+1; -+ return t; -+} -+ -+void test3() -+{ -+ printf("\nRunning iasm Test 3 ( %s )\n", data3.desc.ptr); -+ -+ foreach( int n, T; ALL_T ) -+ test3_run!(T,n)( ); -+ -+ check( data3 ); -+} -+ -+/************************************************************************/ -+// test4 -+ -+TEST data4 = { 4, "Check Input Register value" }; -+ -+void test4_run( T, int n )( T t ) -+{ -+ mixin( gen_reg_capture!(n,`["RDI","RSI"]`)() ); -+ -+ //dbg!(T,n)( ); -+ -+ enum len = RegValue[n].length; -+ if( dump[0..len] == RegValue[n] ) -+ data4.result[n] = true; -+} -+ -+void dbg( T, int n )( ) -+{ -+ import std.stdio; -+ writefln( "D %s\t[ %16x, %16x ]", T.stringof, dump[0], dump[1], ); -+ writef( "C %s\t[ %16x", T.stringof, RegValue[n][0] ); -+ if( RegValue[n].length == 2 ) -+ writef( ", %16x", RegValue[n][1] ); -+ writefln( " ]" ); -+} -+void test4() -+{ -+ printf("\nRunning iasm Test 4 ( %s )\n", data4.desc.ptr); -+ -+ foreach( int n, T; ALL_T ) -+ { -+ T t; -+ foreach( i, ref e; t.tupleof ) e = i+1; -+ test4_run!(T,n)( t ); -+ } -+ check( data4 ); -+} -+ -+ -+} // end version(Run_X86_64_Tests) -+ -+/************************************************************************/ -+ -+ -+void main() -+{ -+ D_test1(); -+ D_test2(); -+ -+ version(Run_X86_64_Tests) -+ { -+ test1(); -+ test2(); -+ test3(); -+ test4(); -+ } -+} -+ -+/+ -+/** -+ * C code to generate the table RegValue -+ */ -+string c_generate_returns() -+{ -+ string value = " 1, 2, 3, 4, 5, 6, 7, 8, 9,10," -+ "11,12,13,14,15,16,17,18,19,20,"; -+ -+ string code = "#include \"cgen.h\"\n"; -+ -+ // Generate return functions -+ foreach( int n, T; ALL_T ) -+ { -+ auto Ts = T.stringof; -+ auto len = T.tupleof.length; -+ -+ code ~= "struct "~Ts~" func_ret_"~Ts~"(void) { \n"; -+ code ~= "struct "~Ts~" x = { "; -+ code ~= value[0..len*3] ~ " };\n"; -+ code ~= "return x;\n}\n"; -+ } -+ return code; -+} -+string c_generate_pass() -+{ -+ string value = " 1, 2, 3, 4, 5, 6, 7, 8, 9,10," -+ "11,12,13,14,15,16,17,18,19,20,"; -+ -+ string code; -+ -+ // Generate return functions -+ foreach( int n, T; ALL_T ) -+ { -+ auto Ts = T.stringof; -+ auto len = T.tupleof.length; -+ -+ code ~= "void func_pass_"~Ts~"( struct "~Ts~" x ) {\n"; -+ //////////////// -+ // Which type of compare -+ static if(n < INT_END) -+ enum MODE = 1; // Int -+ else static if(n < SSE_END) -+ enum MODE = 2; // Float -+ else enum MODE = 3; // Mix -+ -+ auto nn = n.stringof; -+ -+ /* Begin */ -+ -+ code ~= "asm(\n"; -+ final switch( MODE ) -+ { -+ case 1: -+ code ~= `"movq %rdi, reg\n" "movq %rsi, reg+8\n"`; -+ break; -+ case 2: -+ code ~= `"movq %xmm0, reg\n" "movq %xmm1, reg+8\n"`; -+ break; -+ case 3: -+ code ~= `"movq %xmm0, reg\n" "movq %rdi, reg+8\n"`; -+ } -+ code ~= "\n);\n"; -+ code ~= "}\n"; -+ -+ //////////////// -+ code ~= "void func_call_"~Ts~"( void ) {\n"; -+ code ~= "struct "~Ts~" x = { "; -+ code ~= value[0..len*3] ~ " };\n"; -+ code ~= "func_pass_"~Ts~"( x );\n}\n"; -+ } -+ return code; -+} -+string c_generate_main() -+{ -+ string code = "void main() {\n"; -+ -+ foreach( int n, T; ALL_T ) -+ { -+ // Which type of compare -+ static if(n < INT_END) -+ enum MODE = 1; // Int -+ else static if(n < SSE_END) -+ enum MODE = 2; // Float -+ else enum MODE = 3; // Mix -+ -+ auto nn = n.stringof; -+ auto Ts = T.stringof; -+ -+ /* Begin */ -+ -+ code ~= `printf("/* %3d `~Ts~`\t*/ ", `~nn~`);`"\n"; -+ if( !(expected[n] & 1) ) -+ { -+ code ~= `printf("null,\n");`"\n"; -+ continue; -+ } -+ code ~= "asm(\n"; -+ code ~= `"call func_ret_`~Ts~`\n"`"\n"; -+ final switch( MODE ) -+ { -+ case 1: -+ code ~= `"movq %rax, reg\n" "movq %rdx, reg+8\n"`; -+ break; -+ case 2: -+ code ~= `"movq %xmm0, reg\n" "movq %xmm1, reg+8\n"`; -+ break; -+ case 3: -+ code ~= `"movq %xmm0, reg\n" "movq %rax, reg+8\n"`; -+ } -+ code ~= "\n);\n"; -+ -+ code ~= `printf("[ 0x%016lx", reg.r1 );`"\n"; -+ -+ if( T.sizeof > 8 || MODE == 3 ) -+ code ~= `printf(", 0x%016lx ],\n", reg.r2 );`"\n"; -+ else code ~= `printf(", %015c ],\n", ' ' );`"\n"; -+ } -+ -+ foreach( int n, T; ALL_T ) -+ { -+ // Which type of compare -+ static if(n < INT_END) -+ enum MODE = 1; // Int -+ else static if(n < SSE_END) -+ enum MODE = 2; // Float -+ else enum MODE = 3; // Mix -+ -+ auto nn = n.stringof; -+ auto Ts = T.stringof; -+ -+ /* Begin */ -+ -+ code ~= `printf("/* %3d `~Ts~`\t*/ ", `~nn~`);`"\n"; -+ if( !(expected[n] & 1) ) -+ { -+ code ~= `printf("null,\n");`"\n"; -+ continue; -+ } -+ code ~= "func_call_"~Ts~"();\n"; -+ -+ code ~= `printf("[ 0x%016lx", reg.r1 );`"\n"; -+ -+ if( T.sizeof > 8 || MODE == 3 ) -+ code ~= `printf(", 0x%016lx ],\n", reg.r2 );`"\n"; -+ else code ~= `printf(", %015c ],\n", ' ' );`"\n"; -+ } -+ -+ -+ return code ~ "}"; -+} -+pragma(msg, c_generate_returns() ); -+pragma(msg, c_generate_pass() ); -+pragma(msg, c_generate_main() ); -+// +/ -+ -+/+ -+/** -+ * Generate Functions that pass/return each Struct type -+ * -+ * ( Easier to look at objdump this way ) -+ */ -+string d_generate_functions( ) -+{ -+ string code = "extern(C) {"; -+ -+ // pass -+ foreach( s; ALL_T ) -+ { -+ string ss = s.stringof; -+ -+ code ~= "void func_in_"~ss~"( "~ss~" t ) { t.a = 12; }\n"; -+ } -+ // return -+ foreach( s; ALL_T[0..10] ) -+ { -+ string ss = s.stringof; -+ -+ code ~= ` -+ auto func_out_`~ss~`() -+ { -+ `~ss~` t; -+ foreach( i, ref e; t.tupleof ) e = i+1; -+ return t; -+ }`; -+ } -+ // pass & return -+ foreach( s; ALL_T[0..10] ) -+ { -+ string ss = s.stringof; -+ -+ code ~= ` -+ auto func_inout_`~ss~`( `~ss~` t ) -+ { -+ foreach( i, ref e; t.tupleof ) e += 10; -+ return t; -+ }`; -+ } -+ return code ~ "\n} // extern(C)\n"; -+} -+//pragma( msg, d_generate_functions() ); -+mixin( d_generate_functions() ); -+// +/ -+ ---- a/src/gcc/testsuite/gdc.test/runnable/testbounds2.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testbounds2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,259 @@ -+// REQUIRED_ARGS: -+ -+// Test compile time boundaries checking -+ -+extern(C) int printf(const char*, ...); -+ -+template TypeTuple(T...) { alias T TypeTuple; } -+ -+/******************************************/ -+// 3652 -+ -+void test3652() -+{ -+ int foo(int[4] x) -+ { -+ return x[0] + x[1] * x[2] - x[3]; -+ } -+ -+ int[] xs = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; -+ -+ // simple case -+ foo(xs[0 .. 4]); -+ -+ version(none) -+ { -+ // Need deformation of formula and detection of base point -+ int x = 0; -+ int y = 0; -+ foreach (i; 0 .. 4) -+ { -+ x += foo(xs[i .. i + 4]); -+ y += foo(xs[(i*4+10)/2 .. (i*8>>1)/2+9]); -+ // lwr = (i*4 + 10)/2 = i*4/2 + 10/2 = (i*2+5) -+ // upr = (i*8>>1)/2 + 5 = (i*4/2) + 5 = i*2 + 9 = (i*2+5) + 4 -+ } -+ assert(x == (0,1,2,3) + (1,2,3, 4) + (2, 3, 4, 5) + ( 3, 4, 5, 6)); -+ assert(y == (5,6,7,8) + (7,8,9,10) + (9,10,11,12) + (11,12,13,14)); -+ } -+} -+ -+void test3652a() @safe -+{ -+ string str = "aaaabbbbccccdddd"; -+ //printf("str.ptr = %p\n", str.ptr); -+ -+ void foo(ref const(char)[16] buf) -+ { -+ //printf("buf.ptr = %p\n", buf.ptr); -+ assert(buf.ptr is str.ptr); -+ } -+ -+ // can check length at runtime -+ assert(str.length == 16); -+ -+ // compiler can check the length of string literal, so -+ // conversion from immutable(char)[] to ref const(char)[16] is allowed; -+ static assert(__traits(compiles, foo("aaaabbbbccccdddd"))); -+ -+ // OK, correctly rejected by the compiler. -+ static assert(!__traits(compiles, foo(str[]))); -+ -+ // Ugly, furthermore does not work in safe code! -+ //foo(*cast(const(char)[16]*)(str[0..16].ptr)); -+ -+ // New: compiler can check the length of slice, but currently it is not allowed. -+ enum size_t m = 0; -+ size_t calc(){ return 0; } -+ foo(str[0 .. 16]); -+ foo(str[m .. 16]); -+ //foo(str[calc() .. 16]); // with CTFE -+ -+ // If boundaries cannot be calculated in compile time, it's rejected. -+ size_t n; -+ size_t calc2(){ return n; } -+ static assert(!__traits(compiles, foo(str[n .. 16]))); -+ static assert(!__traits(compiles, foo(str[calc2() .. 16]))); -+ -+ void hoo1(size_t dim)(char[dim]) { static assert(dim == 2); } -+ void hoo2(char[2]) {} -+ void hoo3(size_t dim)(ref char[dim]) {} -+ void hoo4(ref char[2]) {} -+ hoo1(str[0 .. 2]); -+ hoo2(str[0 .. 2]); -+ static assert(!__traits(compiles, hoo3(str[0 .. 2]))); -+ static assert(!__traits(compiles, hoo4(str[0 .. 2]))); -+} -+void test3652b() @safe -+{ -+ int[] da = [1,2,3,4,5]; -+ -+ void bar(int[3] sa1, ref int[3] sa2) -+ { -+ assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr); -+ assert(sa2 == [1,2,3] && sa2.ptr is da.ptr); -+ } -+ bar(da[0..3], da[0..3]); -+ static assert(!__traits(compiles, bar(da[0..4], da[0..4]))); -+ -+ void baz1(T)(T[3] sa1, ref T[3] sa2) -+ { -+ assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr); -+ assert(sa2 == [1,2,3] && sa2.ptr is da.ptr); -+ } -+ void baz2(T, size_t dim)(T[dim] sa1, ref T[dim] sa2, size_t result) -+ { -+ assert(dim == result); -+ static if (dim == 3) -+ { -+ assert(sa1 == [1,2,3] && sa1.ptr !is da.ptr); -+ assert(sa2 == [1,2,3] && sa2.ptr is da.ptr); -+ } -+ else -+ { -+ assert(sa1 == [1,2,3,4] && sa1.ptr !is da.ptr); -+ assert(sa2 == [1,2,3,4] && sa2.ptr is da.ptr); -+ } -+ } -+ baz1(da[0..3], da[0..3]); -+ static assert(!__traits(compiles, baz1(da[0..4], da[0..4]))); -+ baz2(da[0..3], da[0..3], 3); -+ baz2(da[0..4], da[0..4], 4); -+ -+ void hoo1(size_t dim)(int[dim]) { static assert(dim == 2); } -+ void hoo2(int[2]) {} -+ void hoo3(size_t dim)(ref int[dim]) {} -+ void hoo4(ref int[2]) {} -+ hoo1(da.idup[0 .. 2]); -+ hoo2(da.idup[0 .. 2]); -+ static assert(!__traits(compiles, hoo3(da.idup[0 .. 2]))); -+ static assert(!__traits(compiles, hoo4(da.idup[0 .. 2]))); -+} -+ -+/**********************************/ -+// 9654 -+ -+auto foo9654a(ref char[8] str) { return str; } -+auto foo9654b(ref const char[8] str) { return str; } -+auto foo9654c(ref immutable char[8] str) { return str; } -+static assert(!is(typeof(foo9654a("testinfo")))); -+static assert( is(typeof(foo9654b("testinfo")) == const char[8])); -+static assert( is(typeof(foo9654c("testinfo")) == immutable char[8])); -+ -+auto bar9654a(T)(ref T[8] str) { return str; static assert(is(T == immutable char)); } -+auto bar9654b(T)(ref const T[8] str) { return str; static assert(is(T == char)); } -+auto bar9654c(T)(ref immutable T[8] str) { return str; static assert(is(T == char)); } -+static assert( is(typeof(bar9654a("testinfo")) == immutable char[8])); -+static assert( is(typeof(bar9654b("testinfo")) == const char[8])); -+static assert( is(typeof(bar9654c("testinfo")) == immutable char[8])); -+ -+auto baz9654a(T, size_t dim)(ref T[dim] str) { return str; static assert(is(T == immutable char)); } -+auto baz9654b(T, size_t dim)(ref const T[dim] str) { return str; static assert(is(T == char)); } -+auto baz9654c(T, size_t dim)(ref immutable T[dim] str) { return str; static assert(is(T == char)); } -+static assert( is(typeof(baz9654a("testinfo")) == immutable char[8])); -+static assert( is(typeof(baz9654b("testinfo")) == const char[8])); -+static assert( is(typeof(baz9654c("testinfo")) == immutable char[8])); -+ -+/******************************************/ -+// 9712 -+ -+auto func9712(T)(T[2] arg) { return arg; } -+static assert(is(typeof(func9712([1,2])) == int[2])); -+ -+auto deduceLength9712(T,size_t n)(T[n] a) { return a; } -+static assert(is(typeof(deduceLength9712([1,2,3])) == int[3])); -+ -+/******************************************/ -+// 9743 -+ -+void test9743() -+{ -+ // +-Char -+ // |+-Immutable or Const or Mutable -+ // ||+-Value or Ref -+ // |||+-Function or +-Template -+ void fCIVF( immutable char[4]) {} void fCIVT()( immutable char[4]) {} -+ void fCCVF( const char[4]) {} void fCCVT()( const char[4]) {} -+ void fCMVF( char[4]) {} void fCMVT()( char[4]) {} -+ void fCIRF(ref immutable char[4]) {} void fCIRT()(ref immutable char[4]) {} -+ void fCCRF(ref const char[4]) {} void fCCRT()(ref const char[4]) {} -+ void fCMRF(ref char[4]) {} void fCMRT()(ref char[4]) {} -+ alias fcOK = TypeTuple!(fCIVF, fCIVT, fCCVF, fCCVT, fCMVF, fCMVT, fCIRF, fCIRT, fCCRF, fCCRT); -+ foreach (f; fcOK) f("1234" ) ; -+ foreach (f; fcOK) f("1234"c) ; -+ foreach (f; fcOK) static assert(!__traits(compiles, f("1234"w) )); -+ foreach (f; fcOK) static assert(!__traits(compiles, f("1234"d) )); -+ alias fcNG = TypeTuple!(fCMRF, fCMRT); // cannot hold immutable data by mutable ref -+ foreach (f; fcNG) static assert(!__traits(compiles, f("1234" ) )); -+ foreach (f; fcNG) static assert(!__traits(compiles, f("1234"c) )); -+ foreach (f; fcNG) static assert(!__traits(compiles, f("1234"w) )); -+ foreach (f; fcNG) static assert(!__traits(compiles, f("1234"d) )); -+ -+ // +-Wchar -+ void fWIVF( immutable wchar[4]) {} void fWIVT()( immutable wchar[4]) {} -+ void fWCVF( const wchar[4]) {} void fWCVT()( const wchar[4]) {} -+ void fWMVF( wchar[4]) {} void fWMVT()( wchar[4]) {} -+ void fWIRF(ref immutable wchar[4]) {} void fWIRT()(ref immutable wchar[4]) {} -+ void fWCRF(ref const wchar[4]) {} void fWCRT()(ref const wchar[4]) {} -+ void fWMRF(ref wchar[4]) {} void fWMRT()(ref wchar[4]) {} -+ alias fwOK = TypeTuple!(fWIVF, fWIVT, fWCVF, fWCVT, fWMVF, fWMVT, fWIRF, fWIRT, fWCRF, fWCRT); -+ foreach (f; fwOK) f("1234" ) ; -+ foreach (f; fwOK) static assert(!__traits(compiles, f("1234"c) )); -+ foreach (f; fwOK) f("1234"w) ; -+ foreach (f; fwOK) static assert(!__traits(compiles, f("1234"d) )); -+ alias fwNG = TypeTuple!(fWMRF, fWMRT); // cannot hold immutable data by mutable ref -+ foreach (f; fwNG) static assert(!__traits(compiles, f("1234" ) )); -+ foreach (f; fwNG) static assert(!__traits(compiles, f("1234"c) )); -+ foreach (f; fwNG) static assert(!__traits(compiles, f("1234"w) )); -+ foreach (f; fwNG) static assert(!__traits(compiles, f("1234"d) )); -+ -+ // +-Dchar -+ void fDIVF( immutable dchar[4]) {} void fDIVT()( immutable dchar[4]) {} -+ void fDCVF( const dchar[4]) {} void fDCVT()( const dchar[4]) {} -+ void fDMVF( dchar[4]) {} void fDMVT()( dchar[4]) {} -+ void fDIRF(ref immutable dchar[4]) {} void fDIRT()(ref immutable dchar[4]) {} -+ void fDCRF(ref const dchar[4]) {} void fDCRT()(ref const dchar[4]) {} -+ void fDMRF(ref dchar[4]) {} void fDMRT()(ref dchar[4]) {} -+ alias fdOK = TypeTuple!(fDIVF, fDIVT, fDCVF, fDCVT, fDMVF, fDMVT, fDIRF, fDIRT, fDCRF, fDCRT); -+ foreach (f; fdOK) f("1234" ) ; -+ foreach (f; fdOK) static assert(!__traits(compiles, f("1234"c) )); -+ foreach (f; fdOK) static assert(!__traits(compiles, f("1234"w) )); -+ foreach (f; fdOK) f("1234"d) ; -+ alias fdNG = TypeTuple!(fDMRF, fDMRT); // cannot hold immutable data by mutable ref -+ foreach (f; fdNG) static assert(!__traits(compiles, f("1234" ) )); -+ foreach (f; fdNG) static assert(!__traits(compiles, f("1234"c) )); -+ foreach (f; fdNG) static assert(!__traits(compiles, f("1234"w) )); -+ foreach (f; fdNG) static assert(!__traits(compiles, f("1234"d) )); -+} -+ -+/******************************************/ -+// 9747 -+ -+void foo9747A(T)(T[4]) {} -+void foo9747C(size_t dim)(char[dim]) {} -+void foo9747W(size_t dim)(wchar[dim]) {} -+void foo9747D(size_t dim)(dchar[dim]) {} -+ -+void test9747() -+{ -+ foo9747A("abcd"c); -+ foo9747A("abcd"w); -+ foo9747A("abcd"d); -+ foo9747C("abcd"c); -+ foo9747W("abcd"w); -+ foo9747D("abcd"d); -+} -+ -+/******************************************/ -+ -+int main() -+{ -+ test3652(); -+ test3652a(); -+ test3652b(); -+ test9743(); -+ test9747(); -+ -+ printf("Success\n"); -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/testbounds.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testbounds.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,8 +1,11 @@ --// PERMUTE_ARGS: -+// REQUIRED_ARGS: - - // Test array bounds checking - - import core.exception; -+extern(C) int printf(const char*, ...); -+ -+/******************************************/ - - const int foos[10] = [1,2,3,4,5,6,7,8,9,10]; - const int food[] = [21,22,23,24,25,26,27,28,29,30]; -@@ -45,7 +48,7 @@ const(int)[] slicep(int lwr, int upr) - return foop[lwr .. upr]; - } - --int main() -+void test1() - { - int i; - -@@ -61,22 +64,22 @@ int main() - x = 10; - try - { -- i = tests(0); -+ i = tests(0); - } - catch (RangeError a) - { -- i = 73; -+ i = 73; - } - assert(i == 73); - - x = -1; - try - { -- i = testd(0); -+ i = testd(0); - } - catch (RangeError a) - { -- i = 37; -+ i = 37; - } - assert(i == 37); - -@@ -96,45 +99,45 @@ int main() - - try - { -- i = 7; -- r = slices(5,3); -+ i = 7; -+ r = slices(5,3); - } - catch (RangeError a) - { -- i = 53; -+ i = 53; - } - assert(i == 53); - - try - { -- i = 7; -- r = slices(5,11); -+ i = 7; -+ r = slices(5,11); - } - catch (RangeError a) - { -- i = 53; -+ i = 53; - } - assert(i == 53); - - try - { -- i = 7; -- r = sliced(5,11); -+ i = 7; -+ r = sliced(5,11); - } - catch (RangeError a) - { -- i = 53; -+ i = 53; - } - assert(i == 53); - - try - { -- i = 7; -- r = slicep(5,3); -+ i = 7; -+ r = slicep(5,3); - } - catch (RangeError a) - { -- i = 53; -+ i = 53; - } - assert(i == 53); - -@@ -171,7 +174,14 @@ int main() - assert(r.length == 1); - assert(x == 3); - assert(r[0] == foop[1]); -+} - -+/******************************************/ -+ -+int main() -+{ -+ test1(); - -+ printf("Success\n"); - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/testconst.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testconst.d 2014-04-01 16:32:51.000000000 +0100 -@@ -533,8 +533,16 @@ struct S40 - - void test40() - { -+ version (PULL93) -+ { -+ assert(S40.sizeof == 8); -+ assert(S40.init.b == 3); -+ } -+ else -+ { - assert(S40.sizeof == 4); - assert(S40.b == 3); -+ } - } - - /************************************/ -@@ -566,7 +574,14 @@ class C42 - { - int a = ctfe() - 2; - const int b; -+ version (PULL93) -+ { -+ enum int c = ctfe(); -+ } -+ else -+ { - const int c = ctfe(); -+ } - static const int d; - static const int e = ctfe() + 2; - -@@ -584,7 +599,14 @@ class C42 - void test42() - { - printf("%d\n", C42.classinfo.init.length); -+ version (PULL93) -+ { -+ assert(C42.classinfo.init.length == 12 + (void*).sizeof + (void*).sizeof); -+ } -+ else -+ { - assert(C42.classinfo.init.length == 8 + (void*).sizeof + (void*).sizeof); -+ } - C42 c = new C42; - assert(c.a == 1); - assert(c.b == 2); -@@ -595,8 +617,11 @@ void test42() - const(int)*p; - p = &c.b; - assert(*p == 2); --// p = &c.c; --// assert(*p == 3); -+ version (PULL93) -+ { -+ p = &c.c; -+ assert(*p == 3); -+ } - p = &c.d; - assert(*p == 4); - p = &c.e; -@@ -2116,7 +2141,7 @@ void test5493() - class C - { - int x; -- this(int i) { x = i; } -+ this(int i) immutable { x = i; } - } - C[] cs; - immutable C ci = new immutable(C)(6); -@@ -2744,6 +2769,57 @@ void test8212() - } - - /************************************/ -+// 8366 -+ -+class B8366 -+{ -+ bool foo(in Object o) const { return true; } -+} -+ -+class C8366a : B8366 -+{ -+ bool foo(in Object o) { return true; } -+ override -+ bool foo(in Object o) const { return false; } -+ bool foo(in Object o) immutable { return true; } -+ bool foo(in Object o) shared { return true; } -+ bool foo(in Object o) shared const { return true; } -+} -+ -+class C8366b : B8366 -+{ -+ bool foo(in Object o) { return false; } -+ alias super.foo foo; -+ bool foo(in Object o) immutable { return false; } -+ bool foo(in Object o) shared { return false; } -+ bool foo(in Object o) shared const { return false; } -+} -+ -+void test8366() -+{ -+ { -+ C8366a mca = new C8366a(); -+ const C8366a cca = new C8366a(); -+ B8366 mb = mca; -+ const B8366 cb = cca; -+ assert(mca.foo(null) == true); -+ assert(cca.foo(null) == false); -+ assert(mb .foo(null) == false); -+ assert(cb .foo(null) == false); -+ } -+ { -+ C8366b mcb = new C8366b(); -+ const C8366b ccb = new C8366b(); -+ B8366 mb = mcb; -+ const B8366 cb = ccb; -+ assert(mcb.foo(null) == false); -+ assert(ccb.foo(null) == true); -+ assert(mb .foo(null) == true); -+ assert(cb .foo(null) == true); -+ } -+} -+ -+/************************************/ - // 8408 - - template hasMutableIndirection8408(T) -@@ -2834,6 +2910,16 @@ void test8688() - } - - /************************************/ -+// 10946 (regression by fixing bug 8688, from 2.061) -+ -+enum xlen10946 = 4; -+alias immutable(char)[xlen10946] e3; -+alias immutable(char[xlen10946]) e4; // NG -> OK -+immutable vlen10946 = 4; -+alias immutable(char)[vlen10946] i3; -+alias immutable(char[vlen10946]) i4; // NG -> OK -+ -+/************************************/ - // 9046 - - void test9046() -@@ -2884,6 +2970,272 @@ void test9090() - } - - /************************************/ -+// 9461 -+ -+void test9461() -+{ -+ class A {} -+ class B : A {} -+ -+ void conv(S, T)(ref S x) { T y = x; } -+ -+ // should be NG -+ static assert(!__traits(compiles, conv!(inout(B)[], inout(A)[]))); -+ static assert(!__traits(compiles, conv!(int[inout(B)], int[inout(A)]))); -+ static assert(!__traits(compiles, conv!(inout(B)[int], inout(A)[int]))); -+ static assert(!__traits(compiles, conv!(inout(B)*, inout(A)*))); -+ static assert(!__traits(compiles, conv!(inout(B)[1], inout(A)[]))); -+ -+ // should be OK -+ static assert( __traits(compiles, conv!(inout(B), inout(A)))); -+} -+ -+/************************************/ -+ -+struct S9209 { int x; } -+ -+void bar9209(const S9209*) {} -+ -+void test9209() { -+ const f = new S9209(1); -+ bar9209(f); -+} -+ -+/************************************/ -+// 10758 -+ -+struct X10758 -+{ -+static: -+ inout(int) screwUpVal(ref inout(int) wx) { return wx; } -+ ref inout(int) screwUpRef(ref inout(int) wx) { return wx; } -+ inout(int)* screwUpPtr(ref inout(int) wx) { return &wx; } -+ inout(int)[] screwUpArr(ref inout(int) wx) { return (&wx)[0 .. 1]; } -+} -+ -+struct S10758 -+{ -+ int x; -+ inout(int) screwUpVal(ref inout(int) _) inout { return x; } -+ ref inout(int) screwUpRef(ref inout(int) _) inout { return x; } -+ inout(int)* screwUpPtr(ref inout(int) _) inout { return &x; } -+ inout(int)[] screwUpArr(ref inout(int) _) inout { return (&x)[0 .. 1]; } -+} -+ -+void test10758(ref inout(int) wx, inout(int)* wp, inout(int)[] wa, inout(S10758) ws) -+{ -+ inout(int) screwUpVal(inout(int) _) { return wx; } -+ ref inout(int) screwUpRef(inout(int) _) { return wx; } -+ inout(int)* screwUpPtr(inout(int) _) { return &wx; } -+ inout(int)[] screwUpArr(inout(int) _) { return (&wx)[0 .. 1]; } -+ -+ struct NS -+ { -+ inout(int) screwUpVal() inout { return wx; } -+ ref inout(int) screwUpRef() inout { return wx; } -+ inout(int)* screwUpPtr() inout { return &wx; } -+ inout(int)[] screwUpArr() inout { return (&wx)[0 .. 1]; } -+ } -+ -+ int mx = 1; -+ const(int) cx = 1; -+ immutable(int) ix = 1; -+ -+ // nested inout function may return an inout reference of the context, -+ // so substitude inout to mutable or immutable should be disallowed. -+ { -+ // value return does not leak any inout reference, so safe. -+ screwUpVal(mx); -+ screwUpVal(ix); -+ screwUpVal(wx); -+ screwUpVal(cx); -+ -+ static assert(!__traits(compiles, screwUpRef(mx))); -+ static assert(!__traits(compiles, screwUpRef(ix))); -+ screwUpRef(wx); -+ screwUpRef(cx); -+ -+ static assert(!__traits(compiles, screwUpPtr(mx))); -+ static assert(!__traits(compiles, screwUpPtr(ix))); -+ screwUpPtr(wx); -+ screwUpPtr(cx); -+ -+ static assert(!__traits(compiles, screwUpArr(mx))); -+ static assert(!__traits(compiles, screwUpArr(ix))); -+ screwUpArr(cx); -+ screwUpArr(wx); -+ } -+ -+ // inout method of the nested struct may return an inout reference of the context, -+ { -+ ( NS()).screwUpVal(); -+ (immutable NS()).screwUpVal(); -+ ( inout NS()).screwUpVal(); -+ ( const NS()).screwUpVal(); -+ -+ static assert(!__traits(compiles, ( NS()).screwUpRef())); -+ static assert(!__traits(compiles, (immutable NS()).screwUpRef())); -+ (inout NS()).screwUpRef(); -+ (const NS()).screwUpRef(); -+ -+ static assert(!__traits(compiles, ( NS()).screwUpPtr())); -+ static assert(!__traits(compiles, (immutable NS()).screwUpPtr())); -+ (inout NS()).screwUpPtr(); -+ (const NS()).screwUpPtr(); -+ -+ static assert(!__traits(compiles, ( NS()).screwUpArr())); -+ static assert(!__traits(compiles, (immutable NS()).screwUpArr())); -+ (inout NS()).screwUpArr(); -+ (const NS()).screwUpArr(); -+ } -+ -+ // function pointer holds no context, so there's no screw up. -+ { -+ auto fp_screwUpVal = &X10758.screwUpVal; -+ fp_screwUpVal(mx); -+ fp_screwUpVal(ix); -+ fp_screwUpVal(wx); -+ fp_screwUpVal(cx); -+ -+ auto fp_screwUpRef = &X10758.screwUpRef; -+ fp_screwUpRef(mx); -+ fp_screwUpRef(ix); -+ fp_screwUpRef(wx); -+ fp_screwUpRef(cx); -+ -+ auto fp_screwUpPtr = &X10758.screwUpVal; -+ fp_screwUpPtr(mx); -+ fp_screwUpPtr(ix); -+ fp_screwUpPtr(wx); -+ fp_screwUpPtr(cx); -+ -+ auto fp_screwUpArr = &X10758.screwUpVal; -+ fp_screwUpArr(mx); -+ fp_screwUpArr(ix); -+ fp_screwUpArr(wx); -+ fp_screwUpArr(cx); -+ } -+ -+ // inout delegate behaves same as nested functions. -+ { -+ auto dg_screwUpVal = &ws.screwUpVal; -+ dg_screwUpVal(mx); -+ dg_screwUpVal(ix); -+ dg_screwUpVal(wx); -+ dg_screwUpVal(cx); -+ -+ auto dg_screwUpRef = &ws.screwUpRef; -+ static assert(!__traits(compiles, dg_screwUpRef(mx))); -+ static assert(!__traits(compiles, dg_screwUpRef(ix))); -+ dg_screwUpRef(wx); -+ dg_screwUpRef(cx); -+ -+ auto dg_screwUpPtr = &ws.screwUpPtr; -+ static assert(!__traits(compiles, dg_screwUpPtr(mx))); -+ static assert(!__traits(compiles, dg_screwUpPtr(ix))); -+ dg_screwUpPtr(wx); -+ dg_screwUpPtr(cx); -+ -+ auto dg_screwUpArr = &ws.screwUpArr; -+ static assert(!__traits(compiles, dg_screwUpArr(mx))); -+ static assert(!__traits(compiles, dg_screwUpArr(ix))); -+ dg_screwUpArr(cx); -+ dg_screwUpArr(wx); -+ } -+} -+ -+/************************************/ -+// 10761 -+ -+inout(int)* function(inout(int)*) fptr10761(inout(int)*) -+{ -+ static inout(int)* screwUp(inout(int)* x) { return x; } -+ auto fp = &screwUp; -+ static assert(is(typeof(fp) == inout(int)* function(inout(int)*))); -+ return fp; -+} -+ -+inout(int)* delegate(inout(int)*) nest10761(inout(int)* x) -+{ -+ inout(int)* screwUp(inout(int)* _) { return x; } -+ auto dg = &screwUp; -+ static assert(is(typeof(dg) == inout(int)* delegate(inout(int)*))); -+ return dg; -+} -+ -+struct S10761 -+{ -+ int x; -+ inout(int)* screwUp() inout { return &x; } -+} -+ -+inout(int)* delegate() inout memfn10761(inout(int)* x) -+{ -+ auto s = new inout S10761(1); -+ auto dg = &s.screwUp; -+ static assert(is(typeof(dg) == inout(int)* delegate() inout)); -+ return dg; -+} -+ -+void test10761() -+{ -+ int mx = 1; -+ const(int) cx = 1; -+ immutable(int) ix = 1; -+ -+ // inout substitution has no effect on function pointer type -+ { -+ auto fp_m = fptr10761(&mx); -+ auto fp_c = fptr10761(&cx); -+ auto fp_i = fptr10761(&ix); -+ alias FP = inout(int)* function(inout(int)*); -+ static assert(is(typeof(fp_m) == FP)); -+ static assert(is(typeof(fp_c) == FP)); -+ static assert(is(typeof(fp_i) == FP)); -+ } -+ -+ // inout substitution on delegate type should always -+ // modify inout to const. -+ { -+ auto dg_m = nest10761(&mx); -+ auto dg_c = nest10761(&cx); -+ auto dg_i = nest10761(&ix); -+ alias DG = const(int)* delegate(const(int)*); -+ static assert(is(typeof(dg_m) == DG)); -+ static assert(is(typeof(dg_c) == DG)); -+ static assert(is(typeof(dg_i) == DG)); -+ } -+ -+ // same as above -+ { -+ auto dg_m = memfn10761(&mx); -+ auto dg_c = memfn10761(&cx); -+ auto dg_i = memfn10761(&ix); -+ alias DG = const(int)* delegate() const; -+ static assert(is(typeof(dg_m) == DG)); -+ static assert(is(typeof(dg_c) == DG)); -+ static assert(is(typeof(dg_i) == DG)); -+ } -+} -+ -+/************************************/ -+// 11257 -+ -+struct R11257 -+{ -+ union -+ { -+ const(Object) original; -+ Object stripped; -+ } -+} -+void test11257() -+{ -+ const(R11257) cr; -+ R11257 mr = cr; // Error: cannot implicitly convert expression (cr) of type const(R) to R -+} -+ -+/************************************/ - - int main() - { -@@ -3001,10 +3353,13 @@ int main() - test8099(); - test8201(); - test8212(); -+ test8366(); - test8408(); - test8688(); - test9046(); - test9090(); -+ test9461(); -+ test9209(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/testcontracts.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testcontracts.d 2014-04-01 16:32:51.000000000 +0100 -@@ -382,6 +382,112 @@ class D7699 : P7699 - } - - /*******************************************/ -+// 7883 -+ -+// Segmentation fault -+class AA7883 -+{ -+ int foo() -+ out (r1) { } -+ body { return 1; } -+} -+ -+class BA7883 : AA7883 -+{ -+ override int foo() -+ out (r2) { } -+ body { return 1; } -+} -+ -+class CA7883 : BA7883 -+{ -+ override int foo() -+ body { return 1; } -+} -+ -+// Error: undefined identifier r2, did you mean variable r3? -+class AB7883 -+{ -+ int foo() -+ out (r1) { } -+ body { return 1; } -+} -+ -+class BB7883 : AB7883 -+{ -+ override int foo() -+ out (r2) { } -+ body { return 1; } -+ -+} -+ -+class CB7883 : BB7883 -+{ -+ override int foo() -+ out (r3) { } -+ body { return 1; } -+} -+ -+// Error: undefined identifier r3, did you mean variable r4? -+class AC7883 -+{ -+ int foo() -+ out (r1) { } -+ body { return 1; } -+} -+ -+class BC7883 : AC7883 -+{ -+ override int foo() -+ out (r2) { } -+ body { return 1; } -+} -+ -+class CC7883 : BC7883 -+{ -+ override int foo() -+ out (r3) { } -+ body { return 1; } -+} -+ -+class DC7883 : CC7883 -+{ -+ override int foo() -+ out (r4) { } -+ body { return 1; } -+} -+ -+/*******************************************/ -+// 7892 -+ -+struct S7892 -+{ -+ @disable this(); -+ this(int x) {} -+} -+ -+S7892 f7892() -+out (result) {} // case 1 -+body -+{ -+ return S7892(1); -+} -+ -+interface I7892 -+{ -+ S7892 f(); -+} -+class C7892 -+{ -+ invariant() {} // case 2 -+ -+ S7892 f() -+ { -+ return S7892(1); -+ } -+} -+ -+/*******************************************/ - // 8066 - - struct CLCommandQueue -@@ -472,6 +578,62 @@ void test8093() - } - - /*******************************************/ -+// 10479 -+ -+class B10479 -+{ -+ B10479 foo() -+ out { } body { return null; } -+} -+ -+class D10479 : B10479 -+{ -+ override D10479 foo() { return null; } -+} -+ -+/*******************************************/ -+// 10596 -+ -+class Foo10596 -+{ -+ auto bar() -+ out (result) { } -+ body { return 0; } -+} -+ -+/*******************************************/ -+// 10721 -+ -+class Foo10721 -+{ -+ this() -+ out { } -+ body { } -+ -+ ~this() -+ out { } -+ body { } -+} -+ -+struct Bar10721 -+{ -+ this(this) -+ out { } -+ body { } -+} -+ -+/*******************************************/ -+// 10981 -+ -+class C10981 -+{ -+ void foo(int i) pure -+ in { assert(i); } -+ out { assert(i); } -+ body {} -+} -+ -+/*******************************************/ - - int main() - { ---- a/src/gcc/testsuite/gdc.test/runnable/testdt.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testdt.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,7 @@ - // PERMUTE_ARGS: - -+struct S { uint[0x100000] arr; } // Bugzilla 11233 -+ - static int bigarray[100][100]; - - int main(char[][] args) ---- a/src/gcc/testsuite/gdc.test/runnable/testenum.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testenum.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,12 +22,13 @@ void test1() - - void test2() - { -- enum E{ -- a=-1 -- } -+ enum E -+ { -+ a=-1 -+ } - -- assert(E.min==-1); -- assert(E.max==-1); -+ assert(E.min == -1); -+ assert(E.max == -1); - } - - -@@ -35,59 +36,63 @@ void test2() - - void test3() - { -- enum E{ -- a=1, -- b=-1, -- c=3, -- d=2 -- } -+ enum E -+ { -+ a = 1, -+ b = -1, -+ c = 3, -+ d = 2 -+ } - -- assert(E.min==-1); -- assert(E.max==3); -+ assert(E.min == -1); -+ assert(E.max == 3); - } - - /**********************************************/ - - void test4() - { -- enum E{ -- a=-1, -- b=-1, -- c=-3, -- d=-3 -- } -+ enum E -+ { -+ a = -1, -+ b = -1, -+ c = -3, -+ d = -3 -+ } - -- assert(E.min==-3); -- assert(E.max==-1); -+ assert(E.min==-3); -+ assert(E.max==-1); - } - - /**********************************************/ - - enum Enum5 - { -- A = 3, -- B = 10, -- E = -5, -+ A = 3, -+ B = 10, -+ E = -5, - } - - void test5() - { -- assert(Enum5.init==Enum5.A); -- assert(Enum5.init==3); -- Enum5 e; -- assert(e==Enum5.A); -- assert(e==3); -+ assert(Enum5.init == Enum5.A); -+ assert(Enum5.init == 3); -+ Enum5 e; -+ assert(e == Enum5.A); -+ assert(e == 3); - } - - /***********************************/ - --enum E6 : byte { -- NORMAL_VALUE = 0, -- REFERRING_VALUE = NORMAL_VALUE + 1, -- OTHER_NORMAL_VALUE = 2 -+enum E6 : byte -+{ -+ NORMAL_VALUE = 0, -+ REFERRING_VALUE = NORMAL_VALUE + 1, -+ OTHER_NORMAL_VALUE = 2 - } - --void foo6(E6 e) { -+void foo6(E6 e) -+{ - } - - void test6() -@@ -95,8 +100,316 @@ void test6() - foo6(E6.NORMAL_VALUE); - foo6(E6.REFERRING_VALUE); - foo6(E6.OTHER_NORMAL_VALUE); --} -+} -+ -+/**********************************************/ -+// 2407 -+ -+int i2407; -+ -+void add2407() { ++i2407; } -+void sub2407() { --i2407; } -+ -+enum EF2407f : void function() -+{ -+ a = &add2407, -+ s = &sub2407, -+} -+ -+enum EF2407s -+{ -+ a = &add2407, -+ s = &sub2407, -+} -+ -+enum -+{ -+ a2407 = &add2407, -+ s2407 = &sub2407, -+} -+ -+enum : void function() -+{ -+ at2407 = &add2407, -+ st2407 = &sub2407, -+} -+ -+enum EEF2407 : EF2407s -+{ -+ a = EF2407s.a, -+ s = EF2407s.s, -+} - -+void test2407() -+{ -+ alias i2407 i; -+ -+ EF2407f.a(); -+ assert(i == 1); -+ EF2407f.s(); -+ assert(i == 0); -+ -+ EF2407s.a(); -+ assert(i == 1); -+ EF2407s.s(); -+ assert(i == 0); -+ -+ a2407(); -+ assert(i == 1); -+ s2407(); -+ assert(i == 0); -+ -+ at2407(); -+ assert(i == 1); -+ st2407(); -+ assert(i == 0); -+ -+ EEF2407.a(); -+ assert(i == 1); -+ EEF2407.s(); -+ assert(i == 0); -+ -+ EEF2407.init(); -+ assert(i == 1); -+ -+ struct S { int i; } -+ enum ES : S -+ { -+ a = S(1), -+ b = S(3), -+ c = S(2), -+ } -+ static assert(ES.init == S(1)); -+ static assert(!__traits(compiles, ES.min)); -+ static assert(!__traits(compiles, ES.max)); -+ -+ enum EES : ES -+ { -+ a = ES.a, -+ b = ES.b, -+ c = ES.c, -+ } -+ static assert(EES.init == ES.init); -+ static assert(EES.init == S(1)); -+ static assert(!__traits(compiles, EES.min)); -+ static assert(!__traits(compiles, EES.max)); -+ -+ ES es = ES.c; -+ assert(es.i == 2); -+ es = ES.b; -+ assert(es.i == 3); -+ -+ class C { this(int i) { this.i = i; } int i; } -+ enum EC : C -+ { -+ a = new C(42), -+ b = null, -+ c = new C(1), -+ d = new C(33), -+ } -+ static assert(EC.init.i == (new C(42)).i); -+ static assert(!__traits(compiles, EC.min)); -+ static assert(!__traits(compiles, EC.max)); -+ -+ EC ec = EC.d; -+ assert(ec.i == 33); -+ ec = EC.b; -+ assert(ec is null); -+} -+ -+/**********************************************/ -+// 3096 -+ -+void test3096() -+{ -+ template Tuple(T...) { alias Tuple = T; } -+ -+ template Base(E) -+ { -+ static if(is(E B == enum)) -+ alias Base = B; -+ } -+ -+ template GetEnum(T) -+ { -+ enum GetEnum { v = T.init } -+ } -+ -+ struct S { } -+ class C { } -+ -+ foreach (Type; Tuple!(char, wchar, dchar, byte, ubyte, -+ short, ushort, int, uint, long, -+ ulong, float, double, real, S, C)) -+ { -+ static assert(is(Base!(GetEnum!Type) == Type)); -+ } -+} -+ -+/**********************************************/ -+// 7719 -+ -+enum foo7719 = bar7719; -+enum { bar7719 = 1 } -+ -+/**********************************************/ -+// 9845 -+ -+enum { A9845 = B9845 } -+enum { B9845 = 1 } -+ -+/**********************************************/ -+// 9846 -+ -+const int A9846 = B9846; -+enum { B9846 = 1 } -+ -+/**********************************************/ -+// 10105 -+ -+enum E10105 : char[1] { a = "a" } -+ -+/**********************************************/ -+// 10113 -+ -+enum E10113 : string -+{ -+ a = "a", -+ b = "b", -+ abc = "abc" -+} -+ -+void test10113() -+{ -+ E10113 v = E10113.b; -+ bool check = false; -+ -+ final switch (v) { -+ case E10113.a: assert(false); -+ case E10113.b: check = true; break; -+ case E10113.abc: assert(false); -+ } -+ -+ assert(check); -+} -+ -+/**********************************************/ -+// 10503 -+ -+@property int octal10503(string num)() -+{ -+ return num.length; -+} -+ -+enum -+{ -+ A10503 = octal10503!"2000000", -+ B10503 = octal10503!"4000", -+} -+ -+/**********************************************/ -+// 10505 -+ -+enum -+{ -+ a10505 = true, -+ b10505 = 10.0f, -+ c10505 = false, -+ d10505 = 10, -+ e10505 = null -+} -+ -+static assert(is(typeof(a10505) == bool)); -+static assert(is(typeof(b10505) == float)); -+static assert(is(typeof(c10505) == bool)); -+static assert(is(typeof(d10505) == int)); -+static assert(is(typeof(e10505) == typeof(null))); -+ -+/**********************************************/ -+// 10561 -+ -+void test10561() -+{ -+ template Tuple(T...) { alias Tuple = T; } -+ -+ foreach (Type; Tuple!(char, wchar, dchar, byte, ubyte, -+ short, ushort, int, uint, long, -+ ulong, float, double, real)) -+ { -+ enum : Type { v = 0, w = 0, x, y = x } -+ static assert(is(typeof(v) == Type)); -+ static assert(is(typeof(w) == Type)); -+ static assert(is(typeof(x) == Type)); -+ static assert(is(typeof(y) == Type)); -+ } -+ -+ class B { } -+ class D : B { } -+ enum : B { a = new D, b = new B, c = null } -+ static assert(is(typeof(a) == B)); -+ static assert(is(typeof(b) == B)); -+ static assert(is(typeof(c) == B)); -+ -+ struct S { this(int) { } } -+ enum : S { d = S(1), e = S(2) } -+ static assert(is(typeof(d) == S)); -+ static assert(is(typeof(e) == S)); -+ -+ enum : float[] { f = [], g = [1.0, 2.0], h = [1.0f] } -+ static assert(is(typeof(f) == float[])); -+ static assert(is(typeof(g) == float[])); -+ static assert(is(typeof(h) == float[])); -+} -+ -+/**********************************************/ -+// 10612 -+ -+int[E10612] ie10612; -+E10612[int] ei10612; -+E10612[E10612] ee10612; -+ -+enum E10612 { a } -+ -+/**********************************************/ -+// 10788 -+ -+enum v10788 = e10788; -+enum : int { e10788 } -+ -+/**********************************************/ -+ -+class C7 -+{ -+ enum Policy -+ { -+ PREFER_READERS, -+ PREFER_WRITERS -+ } -+ -+ void foo1( Policy policy = Policy.PREFER_READERS ) { } -+ void foo2( Policy policy = Policy.PREFER_WRITERS ) { } -+} -+ -+/**********************************************/ -+ -+void test8() -+{ -+ enum E -+ { -+ A = B, -+ E = D + 7, -+ B = 3, -+ C, -+ D, -+ } -+ -+ assert(E.A == 3); -+ assert(E.B == 3); -+ assert(E.C == 4); -+ assert(E.D == 5); -+ assert(E.E == 12); -+ assert(E.max == 12); -+} - - /**********************************************/ - -@@ -108,9 +421,11 @@ int main() - test4(); - test5(); - test6(); -+ test2407(); -+ test10113(); -+ test10561(); -+ test8(); - - printf("Success\n"); - return 0; - } -- -- ---- a/src/gcc/testsuite/gdc.test/runnable/testinvariant.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testinvariant.d 2014-04-01 16:32:51.000000000 +0100 -@@ -8,11 +8,11 @@ class Foo : Object - - invariant() - { -- printf("in invariant %p\n", this); -+ printf("in invariant %p\n", this); - } - } - --int main() -+int testinvariant() - { - printf("hello\n"); - Foo f = new Foo(); -@@ -24,3 +24,92 @@ int main() - printf("world\n"); - return 0; - } -+ -+/***************************************************/ -+// 6453 -+ -+void test6453() -+{ -+ static class C -+ { -+ static uint called; -+ invariant() { called += 1; } -+ invariant() { called += 4; } -+ invariant() { called += 16; } -+ -+ void publicMember() { assert(called == 21); } -+ } -+ -+ static struct S -+ { -+ static uint called; -+ invariant() { called += 1; } -+ invariant() { called += 4; } -+ invariant() { called += 16; } -+ -+ void publicMember() { assert(called == 21); } -+ } -+ -+ auto c = new C(); -+ C.called = 0; -+ c.publicMember(); -+ assert(C.called == 42); -+ -+ auto s = new S(); -+ S.called = 0; -+ s.publicMember(); -+ assert(S.called == 42); -+ -+ // Defined symbols in one invariant cannot be seen from others. -+ static struct S6453 -+ { -+ invariant() -+ { -+ struct S {} -+ int x; -+ static assert(!__traits(compiles, y)); -+ static assert(!__traits(compiles, z)); -+ } -+ invariant() -+ { -+ struct S {} -+ int y; -+ static assert(!__traits(compiles, x)); -+ static assert(!__traits(compiles, z)); -+ } -+ invariant() -+ { -+ struct S {} -+ int z; -+ static assert(!__traits(compiles, x)); -+ static assert(!__traits(compiles, y)); -+ } -+ } -+ -+ static struct S6453a -+ { -+ pure invariant() {} -+ nothrow invariant() {} -+ @safe invariant() {} -+ } -+ static struct S6453b -+ { -+ pure shared invariant() {} -+ nothrow shared invariant() {} -+ @safe shared invariant() {} -+ } -+ static class C6453c -+ { -+ pure synchronized invariant() {} -+ nothrow synchronized invariant() {} -+ @safe synchronized invariant() {} -+ } -+} -+ -+/***************************************************/ -+ -+void main() -+{ -+ testinvariant(); -+ test6453(); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/testkeyword.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testkeyword.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,152 @@ -+// PERMUTE_ARGS: -+// EXTRA_SOURCES: imports/testkwd_file.d -+module testkeyword; -+import imports.testkwd; -+ -+/****************************************/ -+// calee test -+ -+static assert(getCalleeFile() == thatFile); -+static assert(getCalleeLine() == thatLine); -+static assert(getCalleeMod() == thatMod); -+static assert(getCalleeFunc() == thatFunc); -+static assert(getCalleeFunc2() == thatFunc2); -+ -+void testCallee() -+{ -+ static assert(getCalleeFile() == thatFile); -+ static assert(getCalleeLine() == thatLine); -+ static assert(getCalleeMod() == thatMod); -+ static assert(getCalleeFunc() == thatFunc); -+ static assert(getCalleeFunc2() == thatFunc2); -+} -+ -+/****************************************/ -+// caller test -+ -+version(Windows) enum sep = "\\"; else enum sep = "/"; -+ -+enum thisFile = "runnable"~sep~"testkeyword.d"; -+enum thisMod = "testkeyword"; -+ -+static assert(getFuncArgFile() == thisFile); -+static assert(getFuncArgLine() == 33); -+static assert(getFuncArgMod() == thisMod); -+static assert(getFuncArgFunc() == ""); -+static assert(getFuncArgFunc2() == ""); -+ -+static assert(getFuncTiargFile() == thisFile); -+static assert(getFuncTiargLine() == 39); -+static assert(getFuncTiargMod() == thisMod); -+static assert(getFuncTiargFunc() == ""); -+static assert(getFuncTiargFunc2() == ""); -+ -+static assert(getInstTiargFile!() == thisFile); -+static assert(getInstTiargLine!() == 45); -+static assert(getInstTiargMod!() == thisMod); -+static assert(getInstTiargFunc!() == ""); -+static assert(getInstTiargFunc2!() == ""); -+ -+void main(string[] args) nothrow -+{ -+ enum thisFunc = "testkeyword.main"; -+ enum thisFunc2 = "void testkeyword.main(string[] args) nothrow"; -+ -+ static assert(getFuncArgFile() == thisFile); -+ static assert(getFuncArgLine() == 56); -+ static assert(getFuncArgMod() == thisMod); -+ static assert(getFuncArgFunc() == thisFunc); -+ static assert(getFuncArgFunc2() == thisFunc2); -+ -+ static assert(getFuncTiargFile() == thisFile); -+ static assert(getFuncTiargLine() == 62); -+ static assert(getFuncTiargMod() == thisMod); -+ static assert(getFuncTiargFunc() == thisFunc); -+ static assert(getFuncTiargFunc2() == thisFunc2); -+ -+ static assert(getInstTiargFile!() == thisFile); -+ static assert(getInstTiargLine!() == 68); -+ static assert(getInstTiargMod!() == thisMod); -+ static assert(getInstTiargFunc!() == thisFunc); -+ static assert(getInstTiargFunc2!() == thisFunc2); -+ -+ void nested(int x, float y) nothrow -+ { -+ enum thisFunc = "testkeyword.main.nested"; -+ enum thisFunc2 = "void testkeyword.main.nested(int x, float y) nothrow"; -+ -+ static assert(getFuncArgFile() == thisFile); -+ static assert(getFuncArgLine() == 79); -+ static assert(getFuncArgMod() == thisMod); -+ static assert(getFuncArgFunc() == thisFunc); -+ static assert(getFuncArgFunc2() == thisFunc2); -+ -+ static assert(getFuncTiargFile() == thisFile); -+ static assert(getFuncTiargLine() == 85); -+ static assert(getFuncTiargMod() == thisMod); -+ static assert(getFuncTiargFunc() == thisFunc); -+ static assert(getFuncTiargFunc2() == thisFunc2); -+ -+ static assert(getInstTiargFile!() == thisFile); -+ static assert(getInstTiargLine!() == 91); -+ static assert(getInstTiargMod!() == thisMod); -+ static assert(getInstTiargFunc!() == thisFunc); -+ static assert(getInstTiargFunc2!() == thisFunc2); -+ } -+ nested(1, 1.0); -+ -+ auto funcLiteral = (int x, int y) -+ { -+ enum thisFunc = "testkeyword.main.__lambda3"; -+ enum thisFunc2 = "testkeyword.main.__lambda3(int x, int y)"; -+ -+ static assert(getFuncArgFile() == thisFile); -+ static assert(getFuncArgLine() == 104); -+ static assert(getFuncArgMod() == thisMod); -+ static assert(getFuncArgFunc() == thisFunc); -+ static assert(getFuncArgFunc2() == thisFunc2); -+ -+ static assert(getFuncTiargFile() == thisFile); -+ static assert(getFuncTiargLine() == 110); -+ static assert(getFuncTiargMod() == thisMod); -+ static assert(getFuncTiargFunc() == thisFunc); -+ static assert(getFuncTiargFunc2() == thisFunc2); -+ -+ static assert(getInstTiargFile!() == thisFile); -+ static assert(getInstTiargLine!() == 116); -+ static assert(getInstTiargMod!() == thisMod); -+ static assert(getInstTiargFunc!() == thisFunc); -+ static assert(getInstTiargFunc2!() == thisFunc2); -+ }; -+ funcLiteral(1, 2); -+ -+ static struct S -+ { -+ void func(string cs, T1, alias T2, T...)(int x) const -+ { -+ enum thisFunc = `testkeyword.main.S.func!("foo", int, symbol, int[], float[]).func`; -+ enum thisFunc2 = `void testkeyword.main.S.func!("foo", int, symbol, int[], float[]).func(int x) const`; -+ -+ static assert(getFuncArgFile() == thisFile); -+ static assert(getFuncArgLine() == 131); -+ static assert(getFuncArgMod() == thisMod); -+ static assert(getFuncArgFunc() == thisFunc); -+ static assert(getFuncArgFunc2() == thisFunc2); -+ -+ static assert(getFuncTiargFile() == thisFile); -+ static assert(getFuncTiargLine() == 137); -+ static assert(getFuncTiargMod() == thisMod); -+ static assert(getFuncTiargFunc() == thisFunc); -+ static assert(getFuncTiargFunc2() == thisFunc2); -+ -+ static assert(getInstTiargFile!() == thisFile); -+ static assert(getInstTiargLine!() == 143); -+ static assert(getInstTiargMod!() == thisMod); -+ static assert(getInstTiargFunc!() == thisFunc); -+ static assert(getInstTiargFunc2!() == thisFunc2); -+ } -+ } -+ static int symbol; -+ S s; -+ s.func!("foo", int, symbol, int[], float[])(1); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/testpic.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testpic.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,30 @@ -+// PERMUTE_ARGS: -fPIC -O -+ -+extern (C) int printf(const char*, ...); -+ -+/***************************************************/ -+ -+align(16) struct S41 -+{ -+ int[4] a; -+} -+ -+shared int x41; -+shared S41 s41; -+ -+void test11310() -+{ -+ printf("&x = %p\n", &x41); -+ printf("&s = %p\n", &s41); -+ assert((cast(int)&s41 & 0xF) == 0); -+} -+ -+/***************************************************/ -+ -+int main() -+{ -+ test11310(); -+ -+ printf("Success\n"); -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/testprofile.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testprofile.d 2014-04-01 16:32:51.000000000 +0100 -@@ -40,6 +40,29 @@ void test5689() - - // ------------------ - -+class Foo10617 -+{ -+ void foo() nothrow pure @safe -+ in { } -+ out { } -+ body { } -+} -+ -+// ------------------ -+ -+class C10953 -+{ -+ void func() nothrow pure @safe -+ in {} out {} body {} -+} -+class D10953 : C10953 -+{ -+ override void func() // inherits attributes of Foo.func -+ in {} out {} body {} -+} -+ -+// ------------------ -+ - void main() - { - test1(); ---- a/src/gcc/testsuite/gdc.test/runnable/testrightthis.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testrightthis.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,548 @@ -+// runnable/traits.d 9091,8972,8971,7027 -+// runnable/test4.d test6() -+ -+extern(C) int printf(const char*, ...); -+ -+template TypeTuple(TL...) { alias TypeTuple = TL; } -+ -+/********************************************************/ -+ -+mixin("struct S1 {"~aggrDecl1~"}"); -+mixin("class C1 {"~aggrDecl1~"}"); -+enum aggrDecl1 = -+q{ -+ alias Type = typeof(this); -+ -+ int x = 2; -+ -+ void foo() -+ { -+ static assert( is(typeof(Type.x.offsetof))); -+ static assert( is(typeof(Type.x.mangleof))); -+ static assert( is(typeof(Type.x.sizeof ))); -+ static assert( is(typeof(Type.x.alignof ))); -+ static assert( is(typeof({ auto n = Type.x.offsetof; }))); -+ static assert( is(typeof({ auto n = Type.x.mangleof; }))); -+ static assert( is(typeof({ auto n = Type.x.sizeof; }))); -+ static assert( is(typeof({ auto n = Type.x.alignof; }))); -+ static assert( is(typeof(Type.x))); -+ static assert( is(typeof({ auto n = Type.x; }))); -+ static assert( __traits(compiles, Type.x)); -+ static assert( __traits(compiles, { auto n = Type.x; })); -+ -+ static assert( is(typeof(x.offsetof))); -+ static assert( is(typeof(x.mangleof))); -+ static assert( is(typeof(x.sizeof ))); -+ static assert( is(typeof(x.alignof ))); -+ static assert( is(typeof({ auto n = x.offsetof; }))); -+ static assert( is(typeof({ auto n = x.mangleof; }))); -+ static assert( is(typeof({ auto n = x.sizeof; }))); -+ static assert( is(typeof({ auto n = x.alignof; }))); -+ static assert( is(typeof(x))); -+ static assert( is(typeof({ auto n = x; }))); -+ static assert( __traits(compiles, x)); -+ static assert( __traits(compiles, { auto n = x; })); -+ -+ with (this) -+ { -+ static assert( is(typeof(x.offsetof))); -+ static assert( is(typeof(x.mangleof))); -+ static assert( is(typeof(x.sizeof ))); -+ static assert( is(typeof(x.alignof ))); -+ static assert( is(typeof({ auto n = x.offsetof; }))); -+ static assert( is(typeof({ auto n = x.mangleof; }))); -+ static assert( is(typeof({ auto n = x.sizeof; }))); -+ static assert( is(typeof({ auto n = x.alignof; }))); -+ static assert( is(typeof(x))); -+ static assert( is(typeof({ auto n = x; }))); -+ static assert( __traits(compiles, x)); -+ static assert( __traits(compiles, { auto n = x; })); -+ } -+ } -+ -+ static void bar() -+ { -+ static assert( is(typeof(Type.x.offsetof))); -+ static assert( is(typeof(Type.x.mangleof))); -+ static assert( is(typeof(Type.x.sizeof ))); -+ static assert( is(typeof(Type.x.alignof ))); -+ static assert( is(typeof({ auto n = Type.x.offsetof; }))); -+ static assert( is(typeof({ auto n = Type.x.mangleof; }))); -+ static assert( is(typeof({ auto n = Type.x.sizeof; }))); -+ static assert( is(typeof({ auto n = Type.x.alignof; }))); -+ static assert( is(typeof(Type.x))); -+ static assert(!is(typeof({ auto n = Type.x; }))); -+ static assert( __traits(compiles, Type.x)); -+ static assert(!__traits(compiles, { auto n = Type.x; })); -+ -+ static assert( is(typeof(x.offsetof))); -+ static assert( is(typeof(x.mangleof))); -+ static assert( is(typeof(x.sizeof ))); -+ static assert( is(typeof(x.alignof ))); -+ static assert( is(typeof({ auto n = x.offsetof; }))); -+ static assert( is(typeof({ auto n = x.mangleof; }))); -+ static assert( is(typeof({ auto n = x.sizeof; }))); -+ static assert( is(typeof({ auto n = x.alignof; }))); -+ static assert( is(typeof(x))); -+ static assert(!is(typeof({ auto n = x; }))); -+ static assert( __traits(compiles, x)); -+ static assert(!__traits(compiles, { auto n = x; })); -+ -+ Type t; -+ with (t) -+ { -+ static assert( is(typeof(x.offsetof))); -+ static assert( is(typeof(x.mangleof))); -+ static assert( is(typeof(x.sizeof ))); -+ static assert( is(typeof(x.alignof ))); -+ static assert( is(typeof({ auto n = x.offsetof; }))); -+ static assert( is(typeof({ auto n = x.mangleof; }))); -+ static assert( is(typeof({ auto n = x.sizeof; }))); -+ static assert( is(typeof({ auto n = x.alignof; }))); -+ static assert( is(typeof(x))); -+ static assert( is(typeof({ auto n = x; }))); -+ static assert( __traits(compiles, x)); -+ static assert( __traits(compiles, { auto n = x; })); -+ } -+ } -+}; -+void test1() -+{ -+ foreach (Type; TypeTuple!(S1, C1)) -+ { -+ static assert( is(typeof(Type.x.offsetof))); -+ static assert( is(typeof(Type.x.mangleof))); -+ static assert( is(typeof(Type.x.sizeof ))); -+ static assert( is(typeof(Type.x.alignof ))); -+ static assert( is(typeof({ auto n = Type.x.offsetof; }))); -+ static assert( is(typeof({ auto n = Type.x.mangleof; }))); -+ static assert( is(typeof({ auto n = Type.x.sizeof; }))); -+ static assert( is(typeof({ auto n = Type.x.alignof; }))); -+ static assert( is(typeof(Type.x))); -+ static assert(!is(typeof({ auto n = Type.x; }))); -+ static assert( __traits(compiles, Type.x)); -+ static assert(!__traits(compiles, { auto n = Type.x; })); -+ -+ Type t; -+ static assert( is(typeof(t.x.offsetof))); -+ static assert( is(typeof(t.x.mangleof))); -+ static assert( is(typeof(t.x.sizeof ))); -+ static assert( is(typeof(t.x.alignof ))); -+ static assert( is(typeof({ auto n = t.x.offsetof; }))); -+ static assert( is(typeof({ auto n = t.x.mangleof; }))); -+ static assert( is(typeof({ auto n = t.x.sizeof; }))); -+ static assert( is(typeof({ auto n = t.x.alignof; }))); -+ static assert( is(typeof(t.x))); -+ static assert( is(typeof({ auto n = t.x; }))); -+ static assert( __traits(compiles, t.x)); -+ static assert( __traits(compiles, { auto n = t.x; })); -+ -+ with (t) -+ { -+ static assert( is(typeof(x.offsetof))); -+ static assert( is(typeof(x.mangleof))); -+ static assert( is(typeof(x.sizeof ))); -+ static assert( is(typeof(x.alignof ))); -+ static assert( is(typeof({ auto n = x.offsetof; }))); -+ static assert( is(typeof({ auto n = x.mangleof; }))); -+ static assert( is(typeof({ auto n = x.sizeof; }))); -+ static assert( is(typeof({ auto n = x.alignof; }))); -+ static assert( is(typeof(x))); -+ static assert( is(typeof({ auto n = x; }))); -+ static assert( __traits(compiles, x)); -+ static assert( __traits(compiles, { auto n = x; })); -+ } -+ } -+} -+ -+/********************************************************/ -+ -+void test2() -+{ -+ struct S -+ { -+ int val; -+ int[] arr; -+ int[int] aar; -+ -+ void foo() {} -+ void boo()() {} -+ -+ static void test() -+ { -+ static assert(!__traits(compiles, S.foo())); -+ static assert(!__traits(compiles, S.boo())); -+ static assert(!__traits(compiles, foo())); -+ static assert(!__traits(compiles, boo())); -+ } -+ } -+ int v; -+ int[] a; -+ void f(int n) {} -+ -+ static assert( __traits(compiles, S.val)); // 'S.val' is treated just a symbol -+ static assert(!__traits(compiles, { int n = S.val; })); -+ static assert(!__traits(compiles, f(S.val))); -+ -+ static assert(!__traits(compiles, v = S.val) && !__traits(compiles, S.val = v)); -+ -+ static assert(!__traits(compiles, 1 + S.val) && !__traits(compiles, S.val + 1)); -+ static assert(!__traits(compiles, 1 - S.val) && !__traits(compiles, S.val - 1)); -+ static assert(!__traits(compiles, 1 * S.val) && !__traits(compiles, S.val * 1)); -+ static assert(!__traits(compiles, 1 / S.val) && !__traits(compiles, S.val / 1)); -+ static assert(!__traits(compiles, 1 % S.val) && !__traits(compiles, S.val % 1)); -+ static assert(!__traits(compiles, 1 ~ S.arr) && !__traits(compiles, S.arr ~ 1)); -+ -+ static assert(!__traits(compiles, 1 & S.val) && !__traits(compiles, S.val & 1)); -+ static assert(!__traits(compiles, 1 | S.val) && !__traits(compiles, S.val | 1)); -+ static assert(!__traits(compiles, 1 ^ S.val) && !__traits(compiles, S.val ^ 1)); -+ static assert(!__traits(compiles, 1 ~ S.val) && !__traits(compiles, S.val ~ 1)); -+ -+ static assert(!__traits(compiles, 1 ^^ S.val) && !__traits(compiles, S.val ^^ 1)); -+ static assert(!__traits(compiles, 1 << S.val) && !__traits(compiles, S.val << 1)); -+ static assert(!__traits(compiles, 1 >> S.val) && !__traits(compiles, S.val >> 1)); -+ static assert(!__traits(compiles, 1 >>>S.val) && !__traits(compiles, S.val >>>1)); -+ static assert(!__traits(compiles, 1 && S.val) && !__traits(compiles, S.val && 1)); -+ static assert(!__traits(compiles, 1 || S.val) && !__traits(compiles, S.val || 1)); -+ static assert(!__traits(compiles, 1 in S.aar) && !__traits(compiles, S.val || [1:1])); -+ -+ static assert(!__traits(compiles, 1 <= S.val) && !__traits(compiles, S.val <= 1)); -+ static assert(!__traits(compiles, 1 == S.val) && !__traits(compiles, S.val == 1)); -+ static assert(!__traits(compiles, 1 is S.val) && !__traits(compiles, S.val is 1)); -+ -+ static assert(!__traits(compiles, 1? 1:S.val) && !__traits(compiles, 1? S.val:1)); -+ static assert(!__traits(compiles, (1, S.val)) && !__traits(compiles, (S.val, 1))); -+ -+ static assert(!__traits(compiles, &S.val)); -+ static assert(!__traits(compiles, S.arr[0]) && !__traits(compiles, [1,2][S.val])); -+ static assert(!__traits(compiles, S.val++) && !__traits(compiles, S.val--)); -+ static assert(!__traits(compiles, ++S.val) && !__traits(compiles, --S.val)); -+ -+ static assert(!__traits(compiles, v += S.val) && !__traits(compiles, S.val += 1)); -+ static assert(!__traits(compiles, v -= S.val) && !__traits(compiles, S.val -= 1)); -+ static assert(!__traits(compiles, v *= S.val) && !__traits(compiles, S.val *= 1)); -+ static assert(!__traits(compiles, v /= S.val) && !__traits(compiles, S.val /= 1)); -+ static assert(!__traits(compiles, v %= S.val) && !__traits(compiles, S.val %= 1)); -+ static assert(!__traits(compiles, v &= S.val) && !__traits(compiles, S.val &= 1)); -+ static assert(!__traits(compiles, v |= S.val) && !__traits(compiles, S.val |= 1)); -+ static assert(!__traits(compiles, v ^= S.val) && !__traits(compiles, S.val ^= 1)); -+ static assert(!__traits(compiles, a ~= S.val) && !__traits(compiles, S.arr ~= 1)); -+ -+ static assert(!__traits(compiles, v ^^= S.val) && !__traits(compiles, S.val ^^= 1)); -+ static assert(!__traits(compiles, v <<= S.val) && !__traits(compiles, S.val <<= 1)); -+ static assert(!__traits(compiles, v >>= S.val) && !__traits(compiles, S.val >>= 1)); -+ static assert(!__traits(compiles, v >>>=S.val) && !__traits(compiles, S.val >>>=1)); -+ -+ static assert(!__traits(compiles, { auto x = 1 + S.val; }) && !__traits(compiles, { auto x = S.val + 1; })); -+ static assert(!__traits(compiles, { auto x = 1 - S.val; }) && !__traits(compiles, { auto x = S.val - 1; })); -+ static assert(!__traits(compiles, { auto x = S.arr ~ 1; }) && !__traits(compiles, { auto x = 1 ~ S.arr; })); -+ -+ static assert(!__traits(compiles, S.foo())); -+ static assert(!__traits(compiles, S.boo())); -+ S.test(); -+ alias foo = S.foo; -+ alias boo = S.boo; -+ static assert(!__traits(compiles, foo())); -+ static assert(!__traits(compiles, boo())); -+ -+// static assert(S.val); -+ -+ struct SW { int a; } -+ class CW { int a; } -+ static assert(!__traits(compiles, { with (SW) { int n = a; } })); -+ static assert(!__traits(compiles, { with (CW) { int n = a; } })); -+} -+ -+/********************************************************/ -+ -+struct S3 -+{ -+ struct T3 { int val; void foo() {} } -+ T3 member; -+ alias member this; -+ -+ static void test() -+ { -+ static assert(!__traits(compiles, S3.val = 1 )); -+ static assert(!__traits(compiles, { S3.val = 1; })); -+ static assert(!__traits(compiles, T3.val = 1 )); -+ static assert(!__traits(compiles, { T3.val = 1; })); -+ static assert(!__traits(compiles, __traits(getMember, S3, "val") = 1 )); -+ static assert(!__traits(compiles, { __traits(getMember, S3, "val") = 1; })); -+ static assert(!__traits(compiles, __traits(getMember, T3, "val") = 1 )); -+ static assert(!__traits(compiles, { __traits(getMember, T3, "val") = 1; })); -+ -+ static assert(!__traits(compiles, S3.foo() )); -+ static assert(!__traits(compiles, { S3.foo(); })); -+ static assert(!__traits(compiles, T3.foo() )); -+ static assert(!__traits(compiles, { T3.foo(); })); -+ static assert(!__traits(compiles, __traits(getMember, S3, "foo")() )); -+ static assert(!__traits(compiles, { __traits(getMember, S3, "foo")(); })); -+ static assert(!__traits(compiles, __traits(getMember, T3, "foo")() )); -+ static assert(!__traits(compiles, { __traits(getMember, T3, "foo")(); })); -+ static assert(!__traits(compiles, __traits(getOverloads, S3, "foo")[0]() )); -+ static assert(!__traits(compiles, { __traits(getOverloads, S3, "foo")[0](); })); -+ static assert(!__traits(compiles, __traits(getOverloads, T3, "foo")[0]() )); -+ static assert(!__traits(compiles, { __traits(getOverloads, T3, "foo")[0](); })); -+ } -+} -+ -+void test3() -+{ -+} -+ -+/********************************************************/ -+ -+void test4() -+{ -+ static struct R -+ { -+ void opIndex(int) {} -+ void opSlice() {} -+ void opSlice(int, int) {} -+ int opDollar() { return 1; } -+ alias length = opDollar; -+ } -+ -+ R val; -+ static struct S -+ { -+ R val; -+ void foo() -+ { -+ static assert(__traits(compiles, val[1])); // TypeSArray -+ static assert(__traits(compiles, val[])); // TypeDArray -+ static assert(__traits(compiles, val[0..val.length])); // TypeSlice -+ } -+ } -+} -+ -+/********************************************************/ -+ -+template Test5(string name, bool result) -+{ -+ mixin(`static assert(__traits(compiles, `~name~`.add!"months"(1)) == result);`); -+} -+ -+static struct Begin5 -+{ -+ void add(string s)(int n) {} -+} -+ -+struct IntervalX5(TP) -+{ -+ Begin5 begin; -+ -+ static assert(__traits(compiles, begin.add!"months"(1)) == true); -+ mixin Test5!("begin", true); -+ -+ void foo() -+ { -+ static assert(__traits(compiles, begin.add!"months"(1)) == true); -+ mixin Test5!("begin", true); -+ } -+ static test() -+ { -+ static assert(__traits(compiles, begin.add!"months"(1)) == false); -+ mixin Test5!("begin", false); -+ } -+} -+ -+alias IX5 = IntervalX5!int; -+alias beginX5 = IX5.begin; -+static assert(__traits(compiles, beginX5.add!"months"(1)) == false); -+mixin Test5!("beginG5", false); -+ -+void test5() -+{ -+ static struct IntervalY5(TP) -+ { -+ Begin5 begin; -+ -+ static assert(__traits(compiles, begin.add!"months"(1)) == true); -+ mixin Test5!("begin", true); -+ -+ void foo() -+ { -+ static assert(__traits(compiles, begin.add!"months"(1)) == true); -+ mixin Test5!("begin", true); -+ } -+ static test() -+ { -+ static assert(__traits(compiles, begin.add!"months"(1)) == false); -+ mixin Test5!("begin", false); -+ } -+ } -+ -+ alias IX = IntervalX5!int; -+ alias beginX = IX.begin; -+ static assert(__traits(compiles, beginX.add!"months"(1)) == false); -+ mixin Test5!("beginX", false); -+ -+ alias IY = IntervalY5!int; -+ alias beginY = IY.begin; -+ static assert(__traits(compiles, beginY.add!"months"(1)) == false); -+ mixin Test5!("beginY", false); -+} -+ -+/********************************************************/ -+ -+void test6() -+{ -+ static struct Foo -+ { -+ static struct Bar -+ { -+ static int get() { return 0; } -+ static int val; -+ void set() { assert(0); } -+ int num; -+ } -+ static class Baz -+ { -+ static int get() { return 0; } -+ static int val; -+ void set() { assert(0); } -+ int num; -+ } -+ Bar bar; -+ Baz baz; -+ } -+ -+ // allowed cases that do 'use' Foo.bar without this -+ assert(Foo.bar.get() == 0); // Foo.bar.get() -+ assert(Foo.baz.get() == 0); // Foo.bar.get() -+ static assert(!__traits(compiles, Foo.bar.set())); -+ static assert(!__traits(compiles, Foo.baz.set())); -+ -+ assert(Foo.bar.val == 0); // Foo.bar.val -+ assert(Foo.baz.val == 0); // Foo.baz.val -+ static assert(!__traits(compiles, Foo.bar.num = 1)); -+ static assert(!__traits(compiles, Foo.baz.num = 1)); -+} -+ -+/********************************************************/ -+ -+struct Tuple7(T...) -+{ -+ T field; -+ -+ enum check1 = is(typeof(field[0] = 1)); -+ enum check2 = is(typeof({ field[0] = 1; })); -+ -+ this(U, size_t n)(U[n] values) -+ if (is(typeof({ foreach (i, _; T) field[0] = values[0]; }))) -+ {} -+} -+ -+void test7() -+{ -+ alias Tuple7!(int, int) Tup7; -+ static assert(Tup7.check1); -+ static assert(Tup7.check2); -+ int[2] ints = [ 1, 2 ]; -+ Tup7 t = ints; -+ -+ struct S7 -+ { -+ int value; -+ -+ enum check1 = is(typeof(value = 1)); -+ enum check2 = is(typeof({ value = 1; })); -+ -+ void foo()(int v) -+ if (is(typeof({ -+ value = v; // valid -+ }))) {} -+ -+ static void bar()(int v) -+ if (is(typeof({ -+ value = v; // always invalid -+ }))) {} -+ } -+ static assert(S7.check1); -+ static assert(S7.check2); -+ S7 s; -+ s.foo(1); -+ static assert(!__traits(compiles, S7.bar(1))); -+} -+ -+/********************************************************/ -+// 9619 -+ -+struct Foo9619 { int x; } -+void test9619() -+{ -+ void bar() -+ { -+ typeof(Foo9619.x) y; -+ } -+} -+ -+/********************************************************/ -+// 9633 -+ -+class Foo9633 -+{ -+ void baz() {} -+ void bar() -+ { -+ // CallExp::e1->op == TOKvar -+ static assert(!compilesWithoutThis9633!baz); -+ } -+ void vaz()() -+ { -+ static class C -+ { -+ // CallExp::e1->op == TOKtemplate -+ static assert(!__traits(compiles, vaz())); -+ } -+ } -+} -+ -+template compilesWithoutThis9633(alias F) -+{ -+ enum bool compilesWithoutThis9633 = __traits(compiles, F()); -+} -+ -+void test9633() -+{ -+ auto foo = new Foo9633; -+ foo.bar(); -+ foo.vaz(); -+} -+ -+/********************************************************/ -+// 11245 -+ -+struct Vec11245 -+{ -+ float[2] f; -+} -+ -+class Bar11245 -+{ -+ void func() -+ { -+ pragma(msg, "===="); -+ float[Vec11245.f.length] newVal; -+ } -+} -+ -+/********************************************************/ -+ -+int main() -+{ -+ test1(); -+ test2(); -+ test3(); -+ test4(); -+ test5(); -+ test6(); -+ test7(); -+ test9619(); -+ test9633(); -+ -+ printf("Success\n"); -+ return 0; -+} ---- a/src/gcc/testsuite/gdc.test/runnable/testsafe.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testsafe.d 2014-04-01 16:32:51.000000000 +0100 -@@ -170,18 +170,6 @@ void safeunions() - - - --void systemfunc() @system {} --void function() @system sysfuncptr; --void delegate() @system sysdelegate; -- --@safe --void callingsystem() --{ -- static assert(!__traits(compiles, systemfunc())); -- static assert(!__traits(compiles, sysfuncptr())); -- static assert(!__traits(compiles, sysdelegate())); --} -- - @safe - void safeexception() - { -@@ -213,11 +201,13 @@ void inlineasm() - static assert(!__traits(compiles, { asm { "nop;" :::; } }() )); - else version(X86_64) - static assert(!__traits(compiles, { asm { "nop;" :::; } }() )); -+ else version(ARM) -+ static assert(!__traits(compiles, { asm { "nop;" :::; } }() )); - else static assert(false, "ASM code not implemented for this architecture"); - } - else - static assert(!__traits(compiles, { asm { int 3; } }() )); --} -+} - - @safe - void multablecast() ---- a/src/gcc/testsuite/gdc.test/runnable/testscope.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testscope.d 2014-04-01 16:32:51.000000000 +0100 -@@ -241,6 +241,25 @@ void test7435() { - - /********************************************/ - -+void test7049() @safe -+{ -+ int count = 0; -+ @safe void foo() -+ { -+ scope (failure) { count++; } -+ scope (failure) { count++; } -+ throw new Exception("failed"); -+ } -+ -+ try { -+ foo(); -+ } catch(Exception e) { -+ } -+ assert(count == 2); -+} -+ -+/********************************************/ -+ - void main() - { - test1(); -@@ -254,6 +273,7 @@ void main() - test9(); - test10(); - test7435(); -+ test7049(); - - printf("Success\n"); - } ---- a/src/gcc/testsuite/gdc.test/runnable/testswitch.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testswitch.d 2014-04-01 16:32:51.000000000 +0100 -@@ -515,6 +515,114 @@ void test9263() - - /*****************************************/ - -+int bar21(int i) -+{ -+ switch (i) -+ { -+// case 1: return 11; -+ case 2: return 12; -+ case 3: return 13; -+ case 4: return 14; -+ case 5: return 15; -+ case 6: return 16; -+ case 7: return 17; -+ case 8: return 18; -+ case 9: return 19; -+ case 10: return 20; -+ default: break; -+ } -+ -+ switch (i) -+ { -+ case 11: return 21; -+ case 12: return 22; -+ case 13: return 23; -+ case 14: return 24; -+ case 15: return 25; -+ case 16: return 26; -+ case 17: return 27; -+ case 18: return 28; -+ case 19: return 29; -+ case 20: return 30; -+ default: return 31; -+ } -+} -+ -+void test21() -+{ -+// int j = bar(12); -+// printf("j = %d\n", j); -+ -+ for (int i = 2; i < 21; i++) -+ { -+ int j = bar21(i); -+ //printf("j = %d\n", j); -+ assert(j == i + 10); -+ } -+} -+ -+/*****************************************/ -+ -+int bar22(int i) -+{ -+ switch (i) -+ { -+ case 1: return i + 1; -+ case 10: return i + 2; -+ case 20: return i + 3; -+ case 50: return i + 4; -+ case 1000: return i + 5; -+ default: return 28; -+ } -+} -+ -+void test22() -+{ -+ assert(bar22(1) == 2); -+ assert(bar22(10) == 12); -+ assert(bar22(20) == 23); -+ assert(bar22(50) == 54); -+ assert(bar22(1000) == 1005); -+ assert(bar22(0) == 28); -+ assert(bar22(5) == 28); -+ assert(bar22(15) == 28); -+ assert(bar22(25) == 28); -+ assert(bar22(58) == 28); -+ assert(bar22(2000) == 28); -+} -+ -+/*****************************************/ -+ -+long bar23(long i) -+{ -+ switch (i) -+ { -+ case 1: return i + 1; -+ case 0x10_0000_0000L: return i + 2; -+ case 0x20_0070_0000L: return i + 3; -+ case 0x50_0000_0000L: return i + 4; -+ case 0x1000_0000_8000L: return i + 5; -+ default: return 28; -+ } -+} -+ -+void test23() -+{ -+ assert(bar23(1) == 2); -+ assert(bar23(0x10_0000_0000L) == 0x10_0000_0000L + 2); -+ assert(bar23(0x20_0070_0000L) == 0x20_0070_0000L + 3); -+ assert(bar23(0x50_0000_0000L) == 0x50_0000_0000L + 4); -+ assert(bar23(0x1000_0000_8000L) == 0x1000_0000_8000L + 5); -+ assert(bar23(0) == 28); -+ assert(bar23(58) == 28); -+ assert(bar23(0x10_0000_0000L+1) == 28); -+ assert(bar23(0x20_0070_0000L+5) == 28); -+ assert(bar23(0x50_0000_0000L+25) == 28); -+ assert(bar23(0x1000_0000_8000L+1) == 28); -+} -+ -+/*****************************************/ -+ - int main() - { - test1(); -@@ -538,6 +646,9 @@ int main() - test20(); - test7358(); - test9263(); -+ test21(); -+ test22(); -+ test23(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/testthread.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testthread.d 2014-04-01 16:32:51.000000000 +0100 -@@ -7,8 +7,8 @@ version (Win32) - { - extern (C) - { -- extern __thread int _tlsstart; -- extern __thread int _tlsend; -+ extern int _tlsstart; -+ extern int _tlsend; - } - } - ---- a/src/gcc/testsuite/gdc.test/runnable/testtypeid.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/testtypeid.d 2014-04-01 16:32:51.000000000 +0100 -@@ -482,6 +482,47 @@ void test9442() - } - - /******************************************************/ -+// 10451 -+ -+struct Foo10451; -+ -+struct Bar10451 -+{ -+ Foo10451*[] foos; -+} -+ -+void test10451() -+{ -+ Foo10451*[] foos = []; -+ foos ~= null; -+ foos = new Foo10451*[2]; -+} -+ -+/******************************************************/ -+// 11010 -+ -+struct S11010 { S11010* p; } -+ -+class C11010 { C11010 p; } -+class D11010 : C11010 {} -+ -+void test11010() -+{ -+ TypeInfo ti; -+ -+ S11010 s; -+ ti = typeid(s.p); -+ assert(cast(TypeInfo_Pointer)ti !is null); -+ assert(ti.toString() == "testtypeid.S11010*"); -+ -+ C11010 c = new C11010(); -+ c.p = new D11010(); -+ ti = typeid(c.p); -+ assert(cast(TypeInfo_Class)ti !is null); -+ assert(ti.toString() == "testtypeid.D11010"); -+} -+ -+/******************************************************/ - - int main() - { -@@ -521,6 +562,8 @@ int main() - test36(); - test37(); - test9442(); -+ test10451(); -+ test11010(); - - return 0; - } ---- a/src/gcc/testsuite/gdc.test/runnable/tls.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/tls.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,7 +3,7 @@ - import std.c.stdio; - import imports.tlsa; - --__thread int x = 3; -+int x = 3; - - void bar() - { -@@ -28,10 +28,10 @@ void test1() - - /************************************/ - --__thread long fooa; --__thread long foob; --__thread int bara = 0x12345678; --__thread int barb = 0x9ABCDEFF; -+long fooa; -+long foob; -+int bara = 0x12345678; -+int barb = 0x9ABCDEFF; - - void test2() - { -@@ -50,9 +50,9 @@ void test2() - - int abc3(T)(T t) - { -- static __thread T qqq; -+ static T qqq; - static T rrr; -- static __thread T sss = 8; -+ static T sss = 8; - static T ttt = 9; - printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt); - assert(sss == 8); ---- a/src/gcc/testsuite/gdc.test/runnable/tls_dup.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/tls_dup.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,5 @@ - // NOTE: this is a dup of runnable/tls.d strictly to test the same code compiled - // separately rather than together like the original is. -- - // COMPILE_SEPARATELY - // EXTRA_SOURCES: imports/tlsa.d - // PERMUTE_ARGS: -@@ -8,7 +7,7 @@ - import std.c.stdio; - import imports.tlsa; - --__thread int x = 3; -+int x = 3; - - void bar() - { -@@ -33,10 +32,10 @@ void test1() - - /************************************/ - --__thread long fooa; --__thread long foob; --__thread int bara = 0x12345678; --__thread int barb = 0x9ABCDEFF; -+long fooa; -+long foob; -+int bara = 0x12345678; -+int barb = 0x9ABCDEFF; - - void test2() - { -@@ -55,9 +54,9 @@ void test2() - - int abc3(T)(T t) - { -- static __thread T qqq; -+ static T qqq; - static T rrr; -- static __thread T sss = 8; -+ static T sss = 8; - static T ttt = 9; - printf("qqq = %d, rrr = %d, sss = %d, ttt = %d\n", qqq, rrr, sss, ttt); - assert(sss == 8); ---- a/src/gcc/testsuite/gdc.test/runnable/traits.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/traits.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,5 @@ -+// PERMUTE_ARGS: -+module traits; - - import std.stdio; - -@@ -614,6 +616,60 @@ void test23() - - /********************************************************/ - -+struct Test24 -+{ -+ public void test24(int){} -+ private void test24(int, int){} -+} -+ -+static assert(__traits(getProtection, __traits(getOverloads, Test24, "test24")[1]) == "private"); -+ -+/********************************************************/ -+// 1369 -+ -+void test1369() -+{ -+ class C1 -+ { -+ static int count; -+ void func() { count++; } -+ } -+ -+ // variable symbol -+ C1 c1 = new C1; -+ __traits(getMember, c1, "func")(); // TypeIdentifier -> VarExp -+ __traits(getMember, mixin("c1"), "func")(); // Expression -> VarExp -+ assert(C1.count == 2); -+ -+ // nested function symbol -+ @property C1 get() { return c1; } -+ __traits(getMember, get, "func")(); -+ __traits(getMember, mixin("get"), "func")(); -+ assert(C1.count == 4); -+ -+ class C2 -+ { -+ C1 c1; -+ this() { c1 = new C1; } -+ void test() -+ { -+ // variable symbol (this.outer.c1) -+ __traits(getMember, c1, "func")(); // TypeIdentifier -> VarExp -> DotVarExp -+ __traits(getMember, mixin("c1"), "func")(); // Expression -> VarExp -> DotVarExp -+ assert(C1.count == 6); -+ -+ // nested function symbol (this.outer.get) -+ __traits(getMember, get, "func")(); -+ __traits(getMember, mixin("get"), "func")(); -+ assert(C1.count == 8); -+ } -+ } -+ C2 c2 = new C2; -+ c2.test(); -+} -+ -+/********************************************************/ -+ - template Foo2234(){ int x; } - - struct S2234a{ mixin Foo2234; } -@@ -625,6 +681,20 @@ static assert([__traits(allMembers, S223 - static assert([__traits(allMembers, S2234c)] == ["foo"]); - - /********************************************************/ -+// 5878 -+ -+template J5878(A) -+{ -+ static if (is(A P == super)) -+ alias P J5878; -+} -+ -+alias J5878!(A5878) Z5878; -+ -+class X5878 {} -+class A5878 : X5878 {} -+ -+/********************************************************/ - - mixin template Members6674() - { -@@ -869,6 +939,57 @@ void getProtection() - } - - /********************************************************/ -+// 9546 -+ -+void test9546() -+{ -+ import imports.a9546; -+ -+ S s; -+ static assert(__traits(getProtection, s.privA) == "private"); -+ static assert(__traits(getProtection, s.protA) == "protected"); -+ static assert(__traits(getProtection, s.packA) == "package"); -+ static assert(__traits(getProtection, S.privA) == "private"); -+ static assert(__traits(getProtection, S.protA) == "protected"); -+ static assert(__traits(getProtection, S.packA) == "package"); -+ -+ static assert(__traits(getProtection, mixin("s.privA")) == "private"); -+ static assert(__traits(getProtection, mixin("s.protA")) == "protected"); -+ static assert(__traits(getProtection, mixin("s.packA")) == "package"); -+ static assert(__traits(getProtection, mixin("S.privA")) == "private"); -+ static assert(__traits(getProtection, mixin("S.protA")) == "protected"); -+ static assert(__traits(getProtection, mixin("S.packA")) == "package"); -+ -+ static assert(__traits(getProtection, __traits(getMember, s, "privA")) == "private"); -+ static assert(__traits(getProtection, __traits(getMember, s, "protA")) == "protected"); -+ static assert(__traits(getProtection, __traits(getMember, s, "packA")) == "package"); -+ static assert(__traits(getProtection, __traits(getMember, S, "privA")) == "private"); -+ static assert(__traits(getProtection, __traits(getMember, S, "protA")) == "protected"); -+ static assert(__traits(getProtection, __traits(getMember, S, "packA")) == "package"); -+ -+ static assert(__traits(getProtection, s.privF) == "private"); -+ static assert(__traits(getProtection, s.protF) == "protected"); -+ static assert(__traits(getProtection, s.packF) == "package"); -+ static assert(__traits(getProtection, S.privF) == "private"); -+ static assert(__traits(getProtection, S.protF) == "protected"); -+ static assert(__traits(getProtection, S.packF) == "package"); -+ -+ static assert(__traits(getProtection, mixin("s.privF")) == "private"); -+ static assert(__traits(getProtection, mixin("s.protF")) == "protected"); -+ static assert(__traits(getProtection, mixin("s.packF")) == "package"); -+ static assert(__traits(getProtection, mixin("S.privF")) == "private"); -+ static assert(__traits(getProtection, mixin("S.protF")) == "protected"); -+ static assert(__traits(getProtection, mixin("S.packF")) == "package"); -+ -+ static assert(__traits(getProtection, __traits(getMember, s, "privF")) == "private"); -+ static assert(__traits(getProtection, __traits(getMember, s, "protF")) == "protected"); -+ static assert(__traits(getProtection, __traits(getMember, s, "packF")) == "package"); -+ static assert(__traits(getProtection, __traits(getMember, S, "privF")) == "private"); -+ static assert(__traits(getProtection, __traits(getMember, S, "protF")) == "protected"); -+ static assert(__traits(getProtection, __traits(getMember, S, "packF")) == "package"); -+} -+ -+/********************************************************/ - // 9091 - - template isVariable9091(X...) if (X.length == 1) -@@ -877,19 +998,64 @@ template isVariable9091(X...) if (X.leng - } - class C9091 - { -- void func() -+ int x; // some class members -+ void func(int n){ this.x = n; } -+ -+ void test() - { -- enum is_x = isVariable9091!(__traits(getMember, C9091, "x")); -+ alias T = C9091; -+ enum is_x = isVariable9091!(__traits(getMember, T, "x")); -+ -+ foreach (i, m; __traits(allMembers, T)) -+ { -+ enum x = isVariable9091!(__traits(getMember, T, m)); -+ static if (i == 0) // x -+ { -+ __traits(getMember, T, m) = 10; -+ assert(this.x == 10); -+ } -+ static if (i == 1) // func -+ { -+ __traits(getMember, T, m)(20); -+ assert(this.x == 20); -+ } -+ } - } -- int x; // some class members - } - struct S9091 - { -- void func() -+ int x; // some struct members -+ void func(int n){ this.x = n; } -+ -+ void test() - { -- enum is_x = isVariable9091!(__traits(getMember, S9091, "x")); -+ alias T = S9091; -+ enum is_x = isVariable9091!(__traits(getMember, T, "x")); -+ -+ foreach (i, m; __traits(allMembers, T)) -+ { -+ enum x = isVariable9091!(__traits(getMember, T, m)); -+ static if (i == 0) // x -+ { -+ __traits(getMember, T, m) = 10; -+ assert(this.x == 10); -+ } -+ static if (i == 1) // func -+ { -+ __traits(getMember, T, m)(20); -+ assert(this.x == 20); -+ } -+ } - } -- int x; // some struct members -+} -+ -+void test9091() -+{ -+ auto c = new C9091(); -+ c.test(); -+ -+ auto s = S9091(); -+ s.test(); - } - - /********************************************************/ -@@ -979,6 +1145,167 @@ void test7408() - static assert(!__traits(compiles, T7408!().offsetof)); - } - -+/*************************************************************/ -+// 9552 -+ -+class C9552 -+{ -+ int f() { return 10; } -+ int f(int n) { return n * 2; } -+} -+ -+void test9552() -+{ -+ auto c = new C9552; -+ auto dg1 = &(__traits(getOverloads, c, "f")[0]); // DMD crashes -+ assert(dg1() == 10); -+ auto dg2 = &(__traits(getOverloads, c, "f")[1]); -+ assert(dg2(10) == 20); -+} -+ -+/*************************************************************/ -+ -+void test9136() -+{ -+ int x; -+ struct S1 { void f() { x++; } } -+ struct U1 { void f() { x++; } } -+ static struct S2 { } -+ static struct S3 { S1 s; } -+ static struct U2 { } -+ void f1() { x++; } -+ static void f2() { } -+ -+ static assert(__traits(isNested, S1)); -+ static assert(__traits(isNested, U1)); -+ static assert(!__traits(isNested, S2)); -+ static assert(!__traits(isNested, S3)); -+ static assert(!__traits(isNested, U2)); -+ static assert(!__traits(compiles, __traits(isNested, int) )); -+ static assert(!__traits(compiles, __traits(isNested, f1, f2) )); -+ static assert(__traits(isNested, f1)); -+ static assert(!__traits(isNested, f2)); -+ -+ static class A { static class SC { } class NC { } } -+ static assert(!__traits(isNested, A)); -+ static assert(!__traits(isNested, A.SC)); -+ static assert(__traits(isNested, A.NC)); -+} -+ -+/********************************************************/ -+// 9939 -+ -+struct Test9939 -+{ -+ int f; -+ enum /*Anonymous enum*/ -+ { -+ A, -+ B -+ } -+ enum NamedEnum -+ { -+ C, -+ D -+ } -+} -+ -+static assert([__traits(allMembers, Test9939)] == ["f", "A", "B", "NamedEnum"]); -+ -+/********************************************************/ -+// 10043 -+ -+void test10043() -+{ -+ struct X {} -+ X d1; -+ static assert(!__traits(compiles, d1.structuralCast!Refleshable)); -+} -+ -+/********************************************************/ -+// 10096 -+ -+struct S10096X -+{ -+ string str; -+ -+ invariant() {} -+ invariant() {} -+ unittest {} -+ -+ this(int) {} -+ this(this) {} -+ ~this() {} -+} -+static assert( -+ [__traits(allMembers, S10096X)] == -+ ["str", "__ctor", "__postblit", "__dtor", "opAssign"]); -+ -+// -------- -+ -+string foo10096(alias var, T = typeof(var))() -+{ -+ foreach (idx, member; __traits(allMembers, T)) -+ { -+ auto x = var.tupleof[idx]; -+ } -+ -+ return ""; -+} -+ -+string foo10096(T)(T var) -+{ -+ return ""; -+} -+ -+struct S10096 -+{ -+ int i; -+ string s; -+} -+ -+void test10096() -+{ -+ S10096 s = S10096(1, ""); -+ auto x = foo10096!s; -+} -+ -+/********************************************************/ -+ -+unittest { } -+ -+struct GetUnitTests -+{ -+ unittest { } -+} -+ -+void test_getUnitTests () -+{ -+ // Always returns empty tuple if the -unittest flag isn't used -+ static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 0); -+ static assert(__traits(getUnitTests, GetUnitTests).length == 0); -+} -+ -+/********************************************************/ -+ -+class TestIsOverrideFunctionBase -+{ -+ void bar () {} -+} -+ -+class TestIsOverrideFunctionPass : TestIsOverrideFunctionBase -+{ -+ override void bar () {} -+} -+ -+void test_isOverrideFunction () -+{ -+ assert(__traits(isOverrideFunction, TestIsOverrideFunctionPass.bar) == true); -+ assert(__traits(isOverrideFunction, TestIsOverrideFunctionBase.bar) == false); -+} -+ -+/********************************************************/ -+ - int main() - { - test1(); -@@ -1005,10 +1332,17 @@ int main() - test21(); - test22(); - test23(); -+ test1369(); - test7608(); - test7858(); -+ test9091(); - test5978(); - test7408(); -+ test9552(); -+ test9136(); -+ test10096(); -+ test_getUnitTests(); -+ test_isOverrideFunction(); - - writeln("Success"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/traits_getUnitTests.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/traits_getUnitTests.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,72 @@ -+// REQUIRED_ARGS: -unittest -+// EXTRA_SOURCES: imports/traits_getUnitTests_import.d -+module traits_getUnitTests; -+ -+import imports.traits_getUnitTests_import; -+ -+template Tuple (T...) -+{ -+ alias Tuple = T; -+} -+ -+int i; -+ -+unittest -+{ -+ i++; -+} -+ -+void test_getUnitTestsFromModule () -+{ -+ static assert(__traits(getUnitTests, mixin(__MODULE__)).length == 1); -+} -+ -+struct SGetUnitTestsFromAggregate -+{ -+ unittest {} -+} -+ -+class CGetUnitTestsFromAggregate -+{ -+ unittest {} -+} -+ -+void test_getUnitTestsFromAggregate () -+{ -+ static assert(__traits(getUnitTests, SGetUnitTestsFromAggregate).length == 1); -+ static assert(__traits(getUnitTests, CGetUnitTestsFromAggregate).length == 1); -+} -+ -+void test_callUnitTestFunction () -+{ -+ __traits(getUnitTests, mixin(__MODULE__))[0](); -+ assert(i == 2); // 2, because the standard unit test runner -+ // will call the unit test function as well -+} -+ -+struct GetUnitTestsWithUDA -+{ -+ @("asd") unittest {} -+} -+ -+void test_getUnitTestsWithUDA () -+{ -+ alias tests = Tuple!(__traits(getUnitTests, GetUnitTestsWithUDA)); -+ static assert(tests.length == 1); -+ static assert(__traits(getAttributes, tests[0]).length == 1); -+} -+ -+void test_getUnitTestsFromImport () -+{ -+ static assert(__traits(getUnitTests, imports.traits_getUnitTests_import).length == 1); -+ static assert(__traits(getUnitTests, mixin("imports.traits_getUnitTests_import")).length == 1); -+} -+ -+void main () -+{ -+ test_getUnitTestsFromModule(); -+ test_getUnitTestsFromAggregate(); -+ test_callUnitTestFunction(); -+ test_getUnitTestsWithUDA(); -+ test_getUnitTestsFromImport(); -+} ---- a/src/gcc/testsuite/gdc.test/runnable/traits_getVirtualIndex.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/traits_getVirtualIndex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,100 @@ -+module traits_getVirtualIndex; -+ -+class VirtualIndexBase -+{ -+ protected int _foo; -+ -+ int doubler() -+ { -+ return foo * 2; -+ } -+ -+ @property int foo() const -+ { -+ return _foo; -+ } -+ -+ @property void foo(int val) -+ { -+ _foo = val; -+ } -+ -+ final void finalFunc() -+ { -+ -+ } -+} -+ -+class VirtualIndexDerived : VirtualIndexBase -+{ -+ @property override int foo() const -+ { -+ return super.foo; -+ } -+ -+ @property override void foo(int val) -+ { -+ super.foo = val; -+ } -+ -+ @property @safe int foo() pure nothrow -+ { -+ return _foo * 2; -+ } -+ -+ final void otherFinalFunc() -+ { -+ -+ } -+} -+ -+final class VirtualIndexFinal : VirtualIndexDerived -+{ -+ @property final override int foo() const -+ { -+ return super.foo; -+ } -+ -+ @property final override void foo(int val) -+ { -+ super.foo = val; -+ } -+ -+ @property @safe final override int foo() pure nothrow -+ { -+ return super.foo; -+ } -+} -+ -+private @property ptrdiff_t getIndex(T, string m, size_t index = 0)() -+{ -+ return __traits(getVirtualIndex, __traits(getOverloads, T, m)[index]); -+} -+ -+void main() -+{ -+ ptrdiff_t doublerIndex = getIndex!(VirtualIndexBase, "doubler"); -+ assert(doublerIndex > 0); -+ ptrdiff_t firstIndex = getIndex!(VirtualIndexBase, "foo", 0); -+ ptrdiff_t secondIndex = getIndex!(VirtualIndexBase, "foo", 1); -+ assert(firstIndex > 0 && secondIndex > 0); -+ // Virtual index is in definition order. -+ assert(secondIndex == firstIndex + 1); -+ assert(firstIndex == doublerIndex + 1); -+ ptrdiff_t finalIndex = getIndex!(VirtualIndexBase, "finalFunc"); -+ assert(finalIndex == -1); -+ assert(getIndex!(VirtualIndexDerived, "doubler") == doublerIndex); -+ assert(getIndex!(VirtualIndexDerived, "foo", 0) == firstIndex); -+ assert(getIndex!(VirtualIndexDerived, "foo", 1) == secondIndex); -+ assert(getIndex!(VirtualIndexDerived, "finalFunc") == finalIndex); -+ assert(getIndex!(VirtualIndexDerived, "otherFinalFunc") == -1); -+ ptrdiff_t newOverloadIndex = getIndex!(VirtualIndexDerived, "foo", 2); -+ assert(newOverloadIndex == secondIndex + 1); -+ foreach(i, overload; __traits(getOverloads, VirtualIndexFinal, "foo")) -+ { -+ // It should still return the initial virtual index even if overridden to be final. -+ ptrdiff_t finalOverrideIndex = getIndex!(VirtualIndexFinal, __traits(identifier, overload), i); -+ ptrdiff_t originalIndex = getIndex!(VirtualIndexDerived, __traits(identifier, overload), i); -+ assert(finalOverrideIndex == originalIndex); -+ } -+} -\ No newline at end of file ---- a/src/gcc/testsuite/gdc.test/runnable/uda.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/uda.d 2014-04-01 16:32:51.000000000 +0100 -@@ -139,7 +139,7 @@ void test7() - - if (!is(Test7 == typeof(tp[0]))) - assert(0); -- -+ - assert(tp[0] == Test7(3, "foo")); - } - -@@ -262,6 +262,94 @@ void test9178() - } - - /************************************************/ -+// 9741 -+ -+struct Bug9741 -+{ -+ pragma(msg, __traits(getAttributes, enum_field)); -+ alias Tuple!(__traits(getAttributes, enum_field)) Tenum_field; -+ private @(10) enum enum_field = 42; -+ -+ static assert(Tenum_field[0] == 10); -+ static assert(__traits(getAttributes, enum_field)[0] == 10); -+ static assert(__traits(getProtection, enum_field) == "private"); -+ static assert(__traits(isSame, __traits(parent, enum_field), Bug9741)); -+ static assert(__traits(isSame, enum_field, enum_field)); -+ -+ pragma(msg, __traits(getAttributes, anon_enum_member)); -+ alias Tuple!(__traits(getAttributes, anon_enum_member)) Tanon_enum_member; -+ private @(20) enum {anon_enum_member} -+ -+ static assert(Tanon_enum_member[0] == 20); -+ static assert(__traits(getAttributes, anon_enum_member)[0] == 20); -+ static assert(__traits(getProtection, anon_enum_member) == "private"); -+ static assert(__traits(isSame, __traits(parent, anon_enum_member), Bug9741)); -+ static assert(__traits(isSame, anon_enum_member, anon_enum_member)); -+ -+ pragma(msg, __traits(getAttributes, Foo.enum_member)); -+ alias Tuple!(__traits(getAttributes, Foo.enum_member)) Tfoo_enum_member; -+ private @(30) enum Foo {enum_member} -+ static assert(Tfoo_enum_member.length == 0); //Foo has attributes, not Foo.enum_member -+ static assert(__traits(getAttributes, Foo.enum_member).length == 0); -+ static assert(__traits(getProtection, Foo.enum_member) == "public"); -+ static assert(__traits(isSame, __traits(parent, Foo.enum_member), Foo)); -+ static assert(__traits(isSame, Foo.enum_member, Foo.enum_member)); -+ -+ pragma(msg, __traits(getAttributes, anon_enum_member_2)); -+ alias Tuple!(__traits(getAttributes, anon_enum_member_2)) Tanon_enum_member_2; -+ private @(40) enum {long anon_enum_member_2 = 2L} -+ -+ static assert(Tanon_enum_member_2[0] == 40); -+ static assert(__traits(getAttributes, anon_enum_member_2)[0] == 40); -+ static assert(__traits(getProtection, anon_enum_member_2) == "private"); -+ static assert(__traits(isSame, __traits(parent, anon_enum_member_2), Bug9741)); -+ static assert(__traits(isSame, anon_enum_member_2, anon_enum_member_2)); -+ -+ template Bug(alias X, bool is_exp) -+ { -+ static assert(is_exp == !__traits(compiles, __traits(parent, X))); -+ static assert(is_exp == !__traits(compiles, __traits(getAttributes, X))); -+ static assert(is_exp == !__traits(compiles, __traits(getProtection, X))); -+ enum Bug = 0; -+ } -+ enum en = 0; -+ enum dummy1 = Bug!(5, true); -+ enum dummy2 = Bug!(en, false); -+} -+ -+/************************************************/ -+// 10208 -+ -+@( 10) enum int x10208_01 = 100; -+@( 20) int x10208_02; -+@( 30) const int x10208_03; -+@( 40) immutable int x10208_04; -+@( 50) int x10208_05 = 500; -+@( 60) const int x10208_06 = 600; -+@( 70) immutable int x10208_07 = 700; -+@( 80) __gshared enum int x10208_08 = 800; -+@( 90) __gshared int x10208_09; -+@(100) __gshared const int x10208_10; -+@(110) __gshared immutable int x10208_11; -+@(120) __gshared int x10208_12 = 1200; -+@(130) __gshared const int x10208_13 = 1300; -+@(140) __gshared immutable int x10208_14 = 1400; -+static assert(__traits(getAttributes, x10208_01)[0] == 10); // OK -+static assert(__traits(getAttributes, x10208_02)[0] == 20); // OK -+static assert(__traits(getAttributes, x10208_03)[0] == 30); // OK -+static assert(__traits(getAttributes, x10208_04)[0] == 40); // OK -+static assert(__traits(getAttributes, x10208_05)[0] == 50); // OK -+static assert(__traits(getAttributes, x10208_06)[0] == 60); // Error -> OK -+static assert(__traits(getAttributes, x10208_07)[0] == 70); // Error -> OK -+static assert(__traits(getAttributes, x10208_08)[0] == 80); // OK -+static assert(__traits(getAttributes, x10208_09)[0] == 90); // OK -+static assert(__traits(getAttributes, x10208_10)[0] == 100); // OK -+static assert(__traits(getAttributes, x10208_11)[0] == 110); // OK -+static assert(__traits(getAttributes, x10208_12)[0] == 120); // OK -+static assert(__traits(getAttributes, x10208_13)[0] == 130); // Error -> OK -+static assert(__traits(getAttributes, x10208_14)[0] == 140); // Error -> OK -+ -+/************************************************/ - - int main() - { ---- a/src/gcc/testsuite/gdc.test/runnable/ufcs.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/ufcs.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,3 +1,5 @@ -+// EXTRA_SOURCES: imports/ufcs5a.d imports/ufcs5b.d imports/ufcs5c.d imports/ufcs5d.d imports/ufcs5e.d -+ - module ufcs; - - extern (C) int printf(const char*, ...); -@@ -161,6 +163,266 @@ void test3() - } - - /*******************************************/ -+ -+template Signal4() -+{ -+ void connect(){} -+} -+struct S4 -+{ -+ mixin Signal4!() s; -+} -+void test4() -+{ -+ S4 s; -+ s.s.connect(); // s.s is TOKdotexp, so never match UFCS -+} -+ -+/*******************************************/ -+ -+auto f5_1(int) { return 1; } -+auto f5_2(string) { return 2; } -+auto f5_3(double) { return 3; } -+alias f5_4 = f5_1, f5_4 = f5_2; -+alias f5_5 = f5_3, f5_5 = f5_4; -+ -+@property p5_1(int) { return 1; } @property p5_1(int, int) { return 1; } -+@property p5_2(string) { return 2; } @property p5_2(string, int) { return 2; } -+@property p5_3(double) { return 3; } @property p5_3(double, int) { return 3; } -+alias p5_4 = p5_1, p5_4 = p5_2; alias p5_4 = p5_1, p5_4 = p5_2; -+alias p5_5 = p5_3, p5_5 = p5_4; alias p5_5 = p5_3, p5_5 = p5_4; -+ -+// import overload set 'f5ov' and 'p5ov' -+import imports.ufcs5b, imports.ufcs5c; -+ -+void test5() -+{ -+ { -+ // f5_1 .. f5_5 are symbols which declared in module scope -+ assert(100.f5_1() == 1); -+ assert("s".f5_2() == 2); -+ assert(1.4.f5_3() == 3); -+ assert(100.f5_4() == 1); -+ assert("s".f5_4() == 2); -+ assert(100.f5_5() == 1); -+ assert("s".f5_5() == 2); -+ assert(1.4.f5_5() == 3); -+ // overload set -+ assert(100.f5ov() == 1); -+ assert("s".f5ov() == 2); -+ // UFCS does not see function local alias -+ alias func5 = f5_1; -+ static assert(!__traits(compiles, { 1.func5(); })); -+ -+ // property getter/setter -+ assert(100.p5_1 == 1); assert((100.p5_1 = 1) == 1); -+ assert("s".p5_2 == 2); assert(("s".p5_2 = 1) == 2); -+ assert(1.4.p5_3 == 3); assert((1.4.p5_3 = 1) == 3); -+ assert(100.p5_4 == 1); assert((100.p5_4 = 1) == 1); -+ assert("s".p5_4 == 2); assert(("s".p5_4 = 1) == 2); -+ assert(100.p5_5 == 1); assert((100.p5_5 = 1) == 1); -+ assert("s".p5_5 == 2); assert(("s".p5_5 = 1) == 2); -+ assert(1.4.p5_5 == 3); assert((1.4.p5_5 = 1) == 3); -+ // overload set ); assert( -+ assert(100.p5ov == 1); assert((100.p5ov = 1) == 1); -+ assert("s".p5ov == 2); assert(("s".p5ov = 1) == 2); -+ // local alias -+ alias prop5 = p5_1; -+ static assert(!__traits(compiles, { 1.prop5; })); -+ static assert(!__traits(compiles, { 1.prop5 = 1; })); -+ } -+ -+ { -+ // f5a1 .. f5a5 are symbols which declared in module scope -+ import imports.ufcs5a; -+ // overload set 'f5ov' and 'p5ov' -+ import imports.ufcs5b, imports.ufcs5c; -+ -+ assert(100.f5a1() == 1); -+ assert("s".f5a2() == 2); -+ assert(1.4.f5a3() == 3); -+ assert(100.f5a4() == 1); -+ assert("s".f5a4() == 2); -+ assert(100.f5a5() == 1); -+ assert("s".f5a5() == 2); -+ assert(1.4.f5a5() == 3); -+ assert(100.f5ov() == 1); -+ assert("s".f5ov() == 2); -+ -+ assert(100.p5a1 == 1); assert((100.p5a1 = 1) == 1); -+ assert("s".p5a2 == 2); assert(("s".p5a2 = 1) == 2); -+ assert(1.4.p5a3 == 3); assert((1.4.p5a3 = 1) == 3); -+ assert(100.p5a4 == 1); assert((100.p5a4 = 1) == 1); -+ assert("s".p5a4 == 2); assert(("s".p5a4 = 1) == 2); -+ assert(100.p5a5 == 1); assert((100.p5a5 = 1) == 1); -+ assert("s".p5a5 == 2); assert(("s".p5a5 = 1) == 2); -+ assert(1.4.p5a5 == 3); assert((1.4.p5a5 = 1) == 3); -+ assert(100.p5ov == 1); assert((100.p5ov = 1) == 1); -+ assert("s".p5ov == 2); assert(("s".p5ov = 1) == 2); -+ } -+ -+ { -+ // selective imports also work as expected -+ import imports.ufcs5a : f5a1, f5a2; -+ import imports.ufcs5a : p5a1, p5a2; -+ -+ assert(100.f5a1() == 1); -+ assert("s".f5a2() == 2); -+ static assert(!__traits(compiles, { 1.4.f5a3(); })); -+ static assert(!__traits(compiles, { 100.f5a4(); })); -+ static assert(!__traits(compiles, { "s".f5a4(); })); -+ static assert(!__traits(compiles, { 100.f5a5(); })); -+ static assert(!__traits(compiles, { "s".f5a5(); })); -+ static assert(!__traits(compiles, { 1.4.f5a5(); })); -+ -+ assert(100.p5a1 == 1); assert((100.p5a1 = 1) == 1); -+ assert("s".p5a2 == 2); assert(("s".p5a2 = 1) == 2); -+ static assert(!__traits(compiles, { 1.4.p5a3; }) && !__traits(compiles, { 1.4.p5a3 = 1; })); -+ static assert(!__traits(compiles, { 100.p5a4; }) && !__traits(compiles, { 100.p5a4 = 1; })); -+ static assert(!__traits(compiles, { "s".p5a4; }) && !__traits(compiles, { "s".p5a4 = 1; })); -+ static assert(!__traits(compiles, { 100.p5a5; }) && !__traits(compiles, { 100.p5a5 = 1; })); -+ static assert(!__traits(compiles, { "s".p5a5; }) && !__traits(compiles, { "s".p5a5 = 1; })); -+ static assert(!__traits(compiles, { 1.4.p5a5; }) && !__traits(compiles, { 1.4.p5a5 = 1; })); -+ } -+ -+ { -+ // renamed imports also work as expected -+ import imports.ufcs5a : f5x1 = f5a1, f5x2 = f5a2; -+ import imports.ufcs5a : p5x1 = p5a1, p5x2 = p5a2; -+ -+ assert(100.f5x1() == 1); -+ assert("s".f5x2() == 2); -+ static assert(!__traits(compiles, { 100.f5a1(); })); -+ static assert(!__traits(compiles, { "s".f5a2(); })); -+ static assert(!__traits(compiles, { 1.4.f5a3(); })); -+ static assert(!__traits(compiles, { 100.f5a4(); })); -+ static assert(!__traits(compiles, { "s".f5a4(); })); -+ static assert(!__traits(compiles, { 100.f5a5(); })); -+ static assert(!__traits(compiles, { "s".f5a5(); })); -+ static assert(!__traits(compiles, { 1.4.f5a5(); })); -+ -+ assert(100.p5x1 == 1); assert((100.p5x1 = 1) == 1); -+ assert("s".p5x2 == 2); assert(("s".p5x2 = 1) == 2); -+ static assert(!__traits(compiles, { 100.p5a1; }) && !__traits(compiles, { 100.p5a1 = 1; })); -+ static assert(!__traits(compiles, { "s".p5a2; }) && !__traits(compiles, { "s".p5a2 = 1; })); -+ static assert(!__traits(compiles, { 1.4.p5a3; }) && !__traits(compiles, { 1.4.p5a3 = 1; })); -+ static assert(!__traits(compiles, { 100.p5a4; }) && !__traits(compiles, { 100.p5a4 = 1; })); -+ static assert(!__traits(compiles, { "s".p5a4; }) && !__traits(compiles, { "s".p5a4 = 1; })); -+ static assert(!__traits(compiles, { 100.p5a5; }) && !__traits(compiles, { 100.p5a5 = 1; })); -+ static assert(!__traits(compiles, { "s".p5a5; }) && !__traits(compiles, { "s".p5a5 = 1; })); -+ static assert(!__traits(compiles, { 1.4.p5a5; }) && !__traits(compiles, { 1.4.p5a5 = 1; })); -+ } -+ -+ { -+ auto c5 = new C5(); -+ foreach (name; __traits(allMembers, C5)) -+ { -+ static if (name.length >= 4 && name[0..4] == "test") -+ { -+ mixin("c5."~name~"();"); // call test function -+ } -+ } -+ } -+} -+ -+class B5 -+{ -+ int g5bm(int) { return 0; } -+ static int g5bs(int) { return 0; } -+ -+} -+class C5 : B5 -+{ -+ // normal import works. -+ import imports.ufcs5a; -+ void test1() -+ { -+ assert(100.f5a1() == 1); -+ assert("s".f5a2() == 2); -+ assert(1.4.f5a3() == 3); -+ assert(100.f5a4() == 1); -+ assert("s".f5a4() == 2); -+ assert(100.f5a5() == 1); -+ assert("s".f5a5() == 2); -+ assert(1.4.f5a5() == 3); -+ -+ assert(100.p5a1 == 1); assert((100.p5a1 = 1) == 1); -+ assert("s".p5a2 == 2); assert(("s".p5a2 = 1) == 2); -+ assert(1.4.p5a3 == 3); assert((1.4.p5a3 = 1) == 3); -+ assert(100.p5a4 == 1); assert((100.p5a4 = 1) == 1); -+ assert("s".p5a4 == 2); assert(("s".p5a4 = 1) == 2); -+ assert(100.p5a5 == 1); assert((100.p5a5 = 1) == 1); -+ assert("s".p5a5 == 2); assert(("s".p5a5 = 1) == 2); -+ assert(1.4.p5a5 == 3); assert((1.4.p5a5 = 1) == 3); -+ } -+ -+ // selective imports also work as expected -+ import imports.ufcs5d : f5d1, f5d2; -+ import imports.ufcs5d : p5d1, p5d2; -+ void test2() -+ { -+ assert(100.f5d1() == 1); -+ assert("s".f5d2() == 2); -+ static assert(!__traits(compiles, { 1.4.f5d3(); })); -+ static assert(!__traits(compiles, { 100.f5d4(); })); -+ static assert(!__traits(compiles, { "s".f5d4(); })); -+ static assert(!__traits(compiles, { 100.f5d5(); })); -+ static assert(!__traits(compiles, { "s".f5d5(); })); -+ static assert(!__traits(compiles, { 1.4.f5d5(); })); -+ -+ assert(100.p5d1 == 1); assert((100.p5d1 = 1) == 1); -+ assert("s".p5d2 == 2); assert(("s".p5d2 = 1) == 2); -+ static assert(!__traits(compiles, { 1.4.p5d3; }) && !__traits(compiles, { 1.4.p5d3 = 1; })); -+ static assert(!__traits(compiles, { 100.p5d4; }) && !__traits(compiles, { 100.p5d4 = 1; })); -+ static assert(!__traits(compiles, { "s".p5d4; }) && !__traits(compiles, { "s".p5d4 = 1; })); -+ static assert(!__traits(compiles, { 100.p5d5; }) && !__traits(compiles, { 100.p5d5 = 1; })); -+ static assert(!__traits(compiles, { "s".p5d5; }) && !__traits(compiles, { "s".p5d5 = 1; })); -+ static assert(!__traits(compiles, { 1.4.p5d5; }) && !__traits(compiles, { 1.4.p5d5 = 1; })); -+ } -+ -+ // renamed imports also work as expected -+ import imports.ufcs5e : f5y1 = f5e1, f5y2 = f5e2; -+ import imports.ufcs5e : p5y1 = p5e1, p5y2 = p5e2; -+ void test3() -+ { -+ assert(100.f5y1() == 1); -+ assert("s".f5y2() == 2); -+ static assert(!__traits(compiles, { 100.f5e1(); })); -+ static assert(!__traits(compiles, { "s".f5e2(); })); -+ static assert(!__traits(compiles, { 1.4.f5e3(); })); -+ static assert(!__traits(compiles, { 100.f5e4(); })); -+ static assert(!__traits(compiles, { "s".f5e4(); })); -+ static assert(!__traits(compiles, { 100.f5e5(); })); -+ static assert(!__traits(compiles, { "s".f5e5(); })); -+ static assert(!__traits(compiles, { 1.4.f5e5(); })); -+ -+ assert(100.p5y1 == 1); assert((100.p5y1 = 1) == 1); -+ assert("s".p5y2 == 2); assert(("s".p5y2 = 1) == 2); -+ static assert(!__traits(compiles, { 100.p5e1; }) && !__traits(compiles, { (100.p5e1 = 1); })); -+ static assert(!__traits(compiles, { "s".p5e2; }) && !__traits(compiles, { ("s".p5e2 = 1); })); -+ static assert(!__traits(compiles, { 1.4.p5e3; }) && !__traits(compiles, { (1.4.p5e3 = 1); })); -+ static assert(!__traits(compiles, { 100.p5e4; }) && !__traits(compiles, { (100.p5e4 = 1); })); -+ static assert(!__traits(compiles, { "s".p5e4; }) && !__traits(compiles, { ("s".p5e4 = 1); })); -+ static assert(!__traits(compiles, { 100.p5e5; }) && !__traits(compiles, { (100.p5e5 = 1); })); -+ static assert(!__traits(compiles, { "s".p5e5; }) && !__traits(compiles, { ("s".p5e5 = 1); })); -+ static assert(!__traits(compiles, { 1.4.p5e5; }) && !__traits(compiles, { (1.4.p5e5 = 1); })); -+ } -+ -+ int g5cm(int) { return 0; } -+ static int g5cs(int) { return 0; } -+ void test4() -+ { -+ // UFCS does not see aggregate members -+ static assert(!__traits(compiles, { 1.g5cm(); })); -+ static assert(!__traits(compiles, { 1.g5cs(); })); -+ -+ // Even if it is in base class -+ static assert(!__traits(compiles, { 1.g5bm(); })); -+ static assert(!__traits(compiles, { 1.g5bs(); })); -+ } -+} -+ -+/*******************************************/ - // 662 - - import std.stdio,std.string, std.conv; -@@ -227,6 +489,28 @@ void test3382() - } - - /*******************************************/ -+// 6185 -+ -+void test6185() -+{ -+ import std.algorithm; -+ -+ auto r1 = [1,2,3].map!"a*2"; -+ assert(equal(r1, [2,4,6])); -+ -+ auto r2 = r1.map!"a+2"(); -+ assert(equal(r2, [4,6,8])); -+} -+ -+/*******************************************/ -+// 6070 -+ -+enum test6070a = ["test"].foo6070(); -+enum test6070b = foo6070(["test"]); -+ -+string foo6070(string[] s) { return ""; } -+ -+/*******************************************/ - // 7670 - - struct A7670 -@@ -304,6 +588,19 @@ void test8180() - } - - /*******************************************/ -+// 8245 -+ -+ string toStr8245(immutable(char)* p) { return null; } -+@property string asStr8245(immutable(char)* p) { return null; } -+ -+void test8245() -+{ -+ immutable(char)* p = "foobar".ptr; -+ p.toStr8245(); -+ p.asStr8245; // Error: no property 'asStr' for type 'immutable(char)' -+} -+ -+/*******************************************/ - // 8252 - - bool f(int x) { return !x; } -@@ -338,34 +635,163 @@ void test8503() - } - - /*******************************************/ -+// 9014 - --template Signal4() -+@property ref int foo9014(int[] a) - { -- void connect(){} -+ return a[0]; - } --struct S4 -+void test9014() - { -- mixin Signal4!() s; -+ int[] bar; -+ static assert(!__traits(compiles, { -+ bar.foo9014 = missing.foo9014; -+ })); - } --void test4() -+ -+/*******************************************/ -+// 9590 -+ -+auto func9590(E)(lazy E expr) { } -+ -+int f9590a() { assert(0); } -+void f9590b() { assert(0); } -+ -+void test9590() - { -- S4 s; -- s.s.connect(); // s.s is TOKdotexp, so never match UFCS -+ func9590(f9590a()); // ok, no exceptions (lazy) -+ f9590a().func9590; // ok, no exceptions (lazy) -+ -+ func9590(f9590b()); // ok, no exceptions (lazy) -+ f9590b().func9590; // L12: NG - } - - /*******************************************/ --// 9014 -+// 9946 - --@property ref int foo9014(int[] a) -+size_t count9946(alias x)(int[] haystack) - { -- return a[0]; -+ return 0; - } --void test9014() -+void test9946() - { -- int[] bar; -- static assert(!__traits(compiles, { -- bar.foo9014 = missing.foo9014; -- })); -+ int[] data; -+ auto n1 = count9946!5(data); // OK -+ auto n2 = data.count9946!5; // OK -+ auto a1 = new int[count9946!5(data)]; // OK -+ auto a2 = new int[data.count9946!5]; // Error -+} -+ -+/*******************************************/ -+// 10618 -+ -+template Temp10618(T) -+{ -+ size_t len = 1; -+} -+void test10618() -+{ -+ auto arr = new int[Temp10618!int.len]; -+ assert(arr.length == 1); -+} -+ -+/*******************************************/ -+// 10003 -+ -+void foo10003(void *p) {} -+void test10003() -+{ -+ void* p; -+ p.foo10003(); -+} -+ -+/*******************************************/ -+// 10041 -+ -+auto writeln10041(T...)(T args) { return typeof(args[0]).stringof; } -+ -+void test10041() -+{ -+ auto aa = [1: 2]; -+ assert(aa.writeln10041 == "int[int]"); -+ assert(writeln10041(aa) == "int[int]"); -+} -+ -+/*******************************************/ -+// 10047 -+ -+struct Typedef10047(T) -+{ -+ template opDispatch(string name) -+ { -+ static assert(0); -+ } -+} -+ -+struct A10047 {} -+int foo10047(Typedef10047!A10047 a) { return 10; } -+ -+void test10047() -+{ -+ Typedef10047!A10047 a; -+ assert(a.foo10047() == 10); -+} -+ -+/*******************************************/ -+// 10166 -+ -+auto foo10166() -+{ -+ 0.bar10166!({})(0); -+} -+ -+void bar10166(alias handler, T)(T t, int i) -+{ -+ t.bar10166!buzz10166(i); -+} -+ -+void buzz10166() {} -+ -+/*******************************************/ -+// 10526 -+ -+struct S10526 -+{ -+ int opDispatch(string s, A...)(A args) -+ if (s[0..3] == "foo") -+ { -+ return 1; -+ } -+} -+int bar10526(X)(X) { return 2; } -+int baz10526(T, X)(X) { return 3; } -+ -+void test10526() -+{ -+ S10526 s; -+ -+ // with parenthesis -+ assert(s.foo10526() == 1); -+ assert(s.bar10526() == 2); -+ assert(s.baz10526!string() == 3); -+ -+ // without parenthesis -+ assert(s.foo10526 == 1); -+ assert(s.bar10526 == 2); -+ assert(s.baz10526!string == 3); -+} -+ -+/********************************************************/ -+// 10609 -+ -+int foo10609(int x) { return x; } -+ -+void test10609() -+{ -+ int x = 1; -+ static assert(__traits(compiles, foo10609(x))); -+ static assert(__traits(compiles, 1.foo10609 )); -+ static assert(__traits(compiles, x.foo10609 )); - } - - /*******************************************/ -@@ -375,18 +801,28 @@ int main() - test1(); - test2(); - test3(); -+ test4(); -+ test5(); - test682(); - test3382(); -+ test6185(); - test7670(); - test7703(); - test7773(); - test7943(); - test8180(); -+ test8245(); - test8252(); - test8453(); - test8503(); -- test4(); - test9014(); -+ test9590(); -+ test9946(); -+ test10618(); -+ test10003(); -+ test10041(); -+ test10047(); -+ test10526(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/variadic.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/variadic.d 2014-04-01 16:32:51.000000000 +0100 -@@ -64,24 +64,24 @@ template Foo3(T, A...) - { - int Foo3(T t, A a) - { -- printf("A.length = %d\n", A.length); -- assert(A.length == 2); -- printf("a.length = %d\n", a.length); -- assert(a.length == 2); -- printf("%d %d %d\n", t, a); -- bar3(a); -- assert([a] == [2, 3]); -- assert([cast(double)a] == [2.0, 3.0]); -- assert(a[0] == 2); -- assert(a[1] == 3); -- assert(a[$ - 2] == 2); -- assert(a[$ - 1] == 3); -- static if (1 || a[6]) -- assert(1); -- assert([a[]] == [2, 3]); -- assert([a[0 .. $]] == [2, 3]); -- assert([a[0 .. $ - 1]] == [2]); -- return 3; -+ printf("A.length = %d\n", A.length); -+ assert(A.length == 2); -+ printf("a.length = %d\n", a.length); -+ assert(a.length == 2); -+ printf("%d %d %d\n", t, a); -+ bar3(a); -+ assert([a] == [2, 3]); -+ assert([cast(double)a] == [2.0, 3.0]); -+ assert(a[0] == 2); -+ assert(a[1] == 3); -+ assert(a[$ - 2] == 2); -+ assert(a[$ - 1] == 3); -+ static if (1 || a[6]) -+ assert(1); -+ assert([a[]] == [2, 3]); -+ assert([a[0 .. $]] == [2, 3]); -+ assert([a[0 .. $ - 1]] == [2]); -+ return 3; - } - } - -@@ -102,16 +102,16 @@ void foo4(A...)() - aa = null; - foreach (a; A) - { -- printf("%d\n", a); -- aa ~= a; -+ printf("%d\n", a); -+ aa ~= a; - } - assert(aa == [7,4,9]); - - aa = null; - foreach (int a; A) - { -- printf("%d\n", a); -- aa ~= a; -+ printf("%d\n", a); -+ aa ~= a; - } - assert(aa == [7,4,9]); - -@@ -119,9 +119,9 @@ void foo4(A...)() - aa = null; - foreach (int i, a; A) - { -- printf("[%d]: %d\n", i, a); -- ai ~= i; -- aa ~= a; -+ printf("[%d]: %d\n", i, a); -+ ai ~= i; -+ aa ~= a; - } - assert(ai == [0,1,2]); - assert(aa == [7,4,9]); -@@ -130,9 +130,9 @@ void foo4(A...)() - aa = null; - foreach_reverse (uint i, a; A) - { -- printf("[%d]: %d\n", i, a); -- ai ~= i; -- aa ~= a; -+ printf("[%d]: %d\n", i, a); -+ ai ~= i; -+ aa ~= a; - } - assert(ai == [2,1,0]); - assert(aa == [9,4,7]); -@@ -141,9 +141,9 @@ void foo4(A...)() - aa = null; - foreach_reverse (i, a; A) - { -- printf("[%d]: %d\n", i, a); -- ai ~= i; -- aa ~= a; -+ printf("[%d]: %d\n", i, a); -+ ai ~= i; -+ aa ~= a; - } - assert(ai == [2,1,0]); - assert(aa == [9,4,7]); -@@ -152,12 +152,12 @@ void foo4(A...)() - aa = null; - foreach (int i, a; A) - { -- printf("[%d]: %d\n", i, a); -- ai ~= i; -- aa ~= a; -- if (i == 1) -- break; -- continue; -+ printf("[%d]: %d\n", i, a); -+ ai ~= i; -+ aa ~= a; -+ if (i == 1) -+ break; -+ continue; - } - assert(ai == [0,1]); - assert(aa == [7,4]); -@@ -173,7 +173,7 @@ void test4() - void print5(A...)(A a) - { - foreach(b; a) -- writeln(b); -+ writeln(b); - } - - void test5() -@@ -187,7 +187,7 @@ void test5() - void print6(A...)(A a) - { - foreach(b; a) -- writeln(b); -+ writeln(b); - } - - void test6() -@@ -251,9 +251,9 @@ void print10(A...)(A a) - { - static if (a.length) - { -- writeln(a[0]); -- static if (a.length > 1) -- print10(a[1 .. $]); -+ writeln(a[0]); -+ static if (a.length > 1) -+ print10(a[1 .. $]); - } - } - -@@ -268,7 +268,7 @@ void test10() - void print11(A...)(A a) - { - foreach(b; A) -- writeln(typeid(b)); -+ writeln(typeid(b)); - } - - void test11() -@@ -449,11 +449,11 @@ void test23() - void returnAndArgs(T, U...) (T delegate(U) dg) - { - static if (U.length == 0) -- assert(dg() == 0); -+ assert(dg() == 0); - else static if (U.length == 1) -- assert(dg(false) == 1); -+ assert(dg(false) == 1); - else -- assert(dg(false, 63L) == 2); -+ assert(dg(false, 63L) == 2); - } - - void test24() -@@ -523,11 +523,11 @@ void test26() - writeln(typeid(typeof(t2))); - version (D_Version2) - { -- assert(std.string.format("%s", typeid(typeof(t2))) == "(int,int,immutable(char)[],immutable(char)[])"); -+ assert(std.string.format("%s", typeid(typeof(t2))) == "(int,int,immutable(char)[],immutable(char)[])"); - } - else - { -- assert(std.string.format("%s", typeid(typeof(t2))) == "(int,int,char[2],char[3])"); -+ assert(std.string.format("%s", typeid(typeof(t2))) == "(int,int,char[2],char[3])"); - } - } - -@@ -538,7 +538,7 @@ void test27() - - int bar(int x, long z) - { -- return x + y; -+ return x + y; - } - - auto dg = &bar; -@@ -558,14 +558,14 @@ void test28() - - foreach (int i, T; TL) - { -- writeln(typeid(T)); -- switch (i) -- { -- case 0: assert(is(T == int)); break; -- case 1: assert(is(T == long)); break; -- case 2: assert(is(T == double)); break; -- default: assert(0); -- } -+ writeln(typeid(T)); -+ switch (i) -+ { -+ case 0: assert(is(T == int)); break; -+ case 1: assert(is(T == long)); break; -+ case 2: assert(is(T == double)); break; -+ default:assert(0); -+ } - } - } - -@@ -577,19 +577,19 @@ void test29() - - struct Foo - { -- static TL tl; -+ static TL tl; - -- void bar() -- { -- writeln(tl); -- assert(std.string.format("%s%s%s", tl) == "00nan"); -- -- tl[0] = 3; -- tl[1] = 5; -- tl[2] = 6.8; -- writeln(tl); -- assert(std.string.format("%s%s%s", tl) == "356.8"); -- } -+ void bar() -+ { -+ writeln(tl); -+ assert(std.string.format("%s%s%s", tl) == "00nan"); -+ -+ tl[0] = 3; -+ tl[1] = 5; -+ tl[2] = 6.8; -+ writeln(tl); -+ assert(std.string.format("%s%s%s", tl) == "356.8"); -+ } - } - - Foo foo; -@@ -604,19 +604,19 @@ void test30() - - struct Foo - { -- TL tl; -+ TL tl; - -- void bar() -- { -- writeln(tl); -- assert(std.string.format("%s%s%s", tl) == "00nan"); -- -- tl[0] = 3; -- tl[1] = 5; -- tl[2] = 6.8; -- writeln(tl); -- assert(std.string.format("%s%s%s", tl) == "356.8"); -- } -+ void bar() -+ { -+ writeln(tl); -+ assert(std.string.format("%s%s%s", tl) == "00nan"); -+ -+ tl[0] = 3; -+ tl[1] = 5; -+ tl[2] = 6.8; -+ writeln(tl); -+ assert(std.string.format("%s%s%s", tl) == "356.8"); -+ } - } - - Foo foo; -@@ -631,7 +631,7 @@ void test31() - - struct Foo - { -- TL tl; -+ TL tl; - } - - Foo foo; -@@ -841,44 +841,44 @@ import std.stdio; - template Format(A...) - { - static if (A.length == 0) -- const string Format = ""; -+ const string Format = ""; - else static if (is(typeof(A[0]) : string)) -- const string Format = FormatString!(A[0], A[1..$]); -- //const string Format = FormatString!(A[0]); -+ const string Format = FormatString!(A[0], A[1..$]); -+ //const string Format = FormatString!(A[0]); - else -- const string Format = ToString!(A[0]) ~ Format!(A[1..$]); -+ const string Format = ToString!(A[0]) ~ Format!(A[1..$]); - } - - template FormatString(string F, A...) - { - static if (F.length == 0) -- const string FormatString = Format!(A); -+ const string FormatString = Format!(A); - else static if (F.length == 1) -- const string FormatString = F[0] ~ Format!(A); -+ const string FormatString = F[0] ~ Format!(A); - else static if (F[0..2] == "%s") -- const string FormatString = ToString!(A[0]) ~ FormatString!(F[2..$],A[1..$]); -+ const string FormatString = ToString!(A[0]) ~ FormatString!(F[2..$],A[1..$]); - else static if (F[0..2] == "%%") -- const string FormatString = "%" ~ FormatString!(F[2..$],A); -+ const string FormatString = "%" ~ FormatString!(F[2..$],A); - else static if (F[0] == '%') -- static assert(0, "unrecognized format %" ~ F[1]); -+ static assert(0, "unrecognized format %" ~ F[1]); - else -- const string FormatString = F[0] ~ FormatString!(F[1..$],A); -+ const string FormatString = F[0] ~ FormatString!(F[1..$],A); - } - - template ToString(ulong U) - { - static if (U < 10) -- const string ToString = "" ~ cast(char)(U + '0'); -+ const string ToString = "" ~ cast(char)(U + '0'); - else -- const string ToString = ToString!(U / 10) ~ ToString!(U % 10); -+ const string ToString = ToString!(U / 10) ~ ToString!(U % 10); - } - - template ToString(long I) - { - static if (I < 0) -- const string ToString = "-" ~ ToString!(cast(ulong)(-I)); -+ const string ToString = "-" ~ ToString!(cast(ulong)(-I)); - else -- const string ToString = ToString!(cast(uint)I); -+ const string ToString = ToString!(cast(uint)I); - } - - template ToString(uint U) -@@ -939,8 +939,8 @@ template LIT(char c) - { - int LIT(int i) - { -- printf("LIT!(%c)(%d)\n", c, i); -- return i + 1; -+ printf("LIT!(%c)(%d)\n", c, i); -+ return i + 1; - } - } - -@@ -948,11 +948,11 @@ int SEQ(pred...)(int i) - { - static if (pred.length == 2) - { -- return pred[0](1) + pred[1](2); -+ return pred[0](1) + pred[1](2); - } - else - { -- return SEQ!(SEQ!(pred[0], pred[1]), pred[2..$])(i); -+ return SEQ!(SEQ!(pred[0], pred[1]), pred[2..$])(i); - } - } - -@@ -1044,7 +1044,7 @@ void test47() - - template Tuple48(E...) - { -- alias E Tuple48; -+ alias E Tuple48; - } - - void VarArg48(T...)(T args) -@@ -1053,9 +1053,9 @@ void VarArg48(T...)(T args) - - void test48() - { -- VarArg48( ); -- VarArg48( Tuple48!(1,2,3) ); -- VarArg48( Tuple48!() ); -+ VarArg48( ); -+ VarArg48( Tuple48!(1,2,3) ); -+ VarArg48( Tuple48!() ); - } - - /***************************************/ -@@ -1210,8 +1210,8 @@ private template implicitlyConverts(U, V - } - - T to56(T, S)(S s) -- if (!implicitlyConverts!(S, T) /*&& isSomeString!(T) -- && isSomeString!(S)*/) -+ if (!implicitlyConverts!(S, T) /*&& isSomeString!(T) -+ && isSomeString!(S)*/) - { - return T.init; - } -@@ -1267,9 +1267,9 @@ template Reduce(fun...) - Tuple59!(double, double) - reduce(Range)(Range r) - { -- typeof(Tuple59!(double,double).field)[0] y; -- typeof(typeof(return).field)[0] x; -- Tuple59!(double, double) s; -+ typeof(Tuple59!(double,double).field)[0] y; -+ typeof(typeof(return).field)[0] x; -+ Tuple59!(double, double) s; - return s; - } - } -@@ -1279,14 +1279,14 @@ void test59() - double[] a = [ 3.0, 4, 7, 11, 3, 2, 5 ]; - static double sum(double a, double b) {return a + b;} - auto r = reduce!((a, b) { return a + b; }, -- (a, b) { return a + b; })(a); -+ (a, b) { return a + b; })(a); - } - - /***************************************/ - - template tuple60(T...) - { -- alias T tuple60; -+ alias T tuple60; - } - - template Foo60(S : void delegate(tuple60!(int))) {} -@@ -1315,9 +1315,9 @@ void test61() - - void test62() - { -- auto t = [ std.typecons.tuple(1, 2), -- std.typecons.tuple(4, 1), -- std.typecons.tuple(5, 100) ]; -+ auto t = [ std.typecons.tuple(1, 2), -+ std.typecons.tuple(4, 1), -+ std.typecons.tuple(5, 100) ]; - } - - /***************************************/ -@@ -1515,6 +1515,74 @@ void test7263() - } - - /***************************************/ -+// 9017 -+ -+template X9017(Args...) -+{ -+ static if(__traits(compiles, { enum e = Args; })) -+ enum e = Args; -+} -+alias X9017!0 x9017; -+static assert(x9017.e[0] == 0); -+ -+void test9017() -+{ -+ enum tup1 = TypeTuple!(11, 22); -+ enum tup2 = TypeTuple!("one", "two"); -+ static assert(tup1 == TypeTuple!(11, 22)); -+ static assert(tup2 == TypeTuple!("one", "two")); -+ static assert(tup1[0] == 11 && tup1[1] == 22); -+ static assert(tup2[0] == "one" && tup2[1] == "two"); -+ -+ shared const tup3 = TypeTuple!(10, 3.14); -+ immutable tup4 = TypeTuple!("a", [1,2]); -+ static assert(is(typeof(tup3[0]) == shared const int)); -+ static assert(is(typeof(tup3[1]) == shared const double)); -+ static assert(is(typeof(tup4[0]) == immutable string)); -+ static assert(is(typeof(tup4[1]) == immutable int[])); -+} -+ -+/***************************************/ -+// 10279 -+ -+void foo10279(int[][] strs...) @trusted { } -+void bar10279() @safe { foo10279(); } -+ -+/***************************************/ -+// 10414 -+ -+void foo10414(void delegate()[] ...) { } -+ -+void bar10414() { } -+ -+void test10414() -+{ -+ foo10414 -+ ( -+ { bar10414(); }, -+ { bar10414(); }, -+ ); -+} -+ -+/***************************************/ -+// 10722 -+ -+struct S10722 -+{ -+ int x; -+} -+ -+template GetSomething10722(S...) -+{ -+ alias GetSomething = int; -+} -+ -+void test10722() -+{ -+ alias X10722 = GetSomething10722!(S10722.tupleof[0]); -+} -+ -+/***************************************/ - - int main() - { -@@ -1590,6 +1658,8 @@ int main() - test6530(); - test7233(); - test7263(); -+ test9017(); -+ test10414(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/xtest46.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/xtest46.d 2014-04-01 16:32:51.000000000 +0100 -@@ -890,6 +890,14 @@ void test45() - - /***************************************************/ - -+void text10682() -+{ -+ ulong x = 1; -+ ulong y = 2 ^^ x; -+} -+ -+/***************************************************/ -+ - struct Test46 - { - int foo; -@@ -1873,6 +1881,20 @@ void test93() - - /***************************************************/ - -+ -+extern(C++) class C1687 -+{ -+ void func() {} -+} -+ -+void test1687() -+{ -+ auto c = new C1687(); -+ assert(c.__vptr[0] == (&c.func).funcptr); -+} -+ -+/***************************************************/ -+ - struct Foo94 - { - int x, y; -@@ -2144,14 +2166,6 @@ void test107() - - /***************************************************/ - --void bug4072(T)(T x) -- if (is(typeof(bug4072(x)))) --{} -- --static assert(!is(typeof(bug4072(7)))); -- --/***************************************************/ -- - class A109 {} - - void test109() -@@ -2167,14 +2181,15 @@ void test109() - - template Boo(T) {} - struct Foo110(T, alias V = Boo!T) --{ pragma(msg, V.stringof); -- const s = V.stringof; -+{ -+ pragma(msg, V.stringof); -+ static const s = V.stringof; - } - alias Foo110!double B110; - alias Foo110!int A110; - --static assert(B110.s == "Boo!(double)"); --static assert(A110.s == "Boo!(int)"); -+static assert(B110.s == "Boo!double"); -+static assert(A110.s == "Boo!int"); - - /***************************************************/ - -@@ -2191,6 +2206,29 @@ void test111() - } - - /***************************************************/ -+// 658 -+ -+void test658() -+{ -+ struct S { int i; } -+ class C { int i; } -+ -+ S s; -+ S* sp = &s; -+ with (sp) i = 42; -+ assert(s.i == 42); -+ with (&s) i = 43; -+ assert(s.i == 43); -+ -+ C c = new C; -+ C* cp = &c; -+ with (cp) i = 42; -+ assert(c.i == 42); -+ with (&c) i = 43; -+ assert(c.i == 43); -+} -+ -+/***************************************************/ - - void test3069() - { -@@ -2439,6 +2477,8 @@ struct Bar124 { - void test124() { - Foo124[string] stuff; - stuff["foo"] = Foo124.init; -+ assert(stuff["foo"].z == 3); -+ stuff["foo"] = Foo124.init; - assert(stuff["foo"].z == 2); - - Bar124[string] stuff2; -@@ -2492,6 +2532,14 @@ void test796() - - /***************************************************/ - -+void test7077() -+{ -+ if(0) mixin("auto x = 2;"); -+ auto x = 1; -+} -+ -+/***************************************************/ -+ - struct Tuple127(S...) - { - S expand; -@@ -2608,6 +2656,69 @@ void test129() - } - - /***************************************************/ -+// 6169 -+ -+auto ctfefunc6169() { return ";"; } -+enum ctfefptr6169 = &ctfefunc6169; -+int ctfefunc6169a() { return 1; } -+template x6169(string c) { alias int x6169; } -+template TT6169(T...) { alias T TT6169; } -+@property ctfeprop6169() { return "g"; } -+ -+void test6169() pure @safe -+{ -+ enum a = ctfefunc6169(); -+ static b = ctfefunc6169(); -+ x6169!(ctfefunc6169()) tt; -+ mixin(ctfefunc6169()); -+ static if(ctfefunc6169()) {} -+ pragma(msg, ctfefunc6169()); -+ enum xx -+ { -+ k = 0, -+ j = ctfefunc6169a() -+ } -+ auto g = mixin('"' ~ ctfefunc6169() ~ '"'); -+ //auto h = import("testx.d" ~ false ? ctfefunc() : ""); -+ alias TT6169!(int, int)[ctfefunc6169a()..ctfefunc6169a()] i; -+ alias TT6169!(int, int)[ctfefunc6169a()] j; -+ int[ctfefunc6169a()+1] k; -+ alias int[ctfefunc6169a()] l; -+ switch(1) -+ { -+ //case ctfefunc6169a(): // Can't do this because of case variables -+ case ctfefunc6169a()+1: -+ .. -+ case ctfefunc6169a()+2: -+ default: -+ break; -+ } -+ static assert(ctfefunc6169a()); -+ void fun(int i : ctfefunc6169a() = ctfefunc6169a(), alias j)() if (ctfefunc6169a()) {} -+ fun!(ctfefunc6169a(), ctfefunc6169())(); -+ enum z = ctfefptr6169(); -+ -+ auto p = mixin(ctfeprop6169); -+} -+ -+/***************************************************/ -+// 10506 -+ -+void impureFunc10506() {} -+string join10506(RoR)(RoR ror) -+{ -+ impureFunc10506(); -+ return ror[0] ~ ror[1]; -+} -+ -+void test10506() pure -+{ -+ void foobar() {} -+ -+ mixin(["foo", "bar"].join10506()~";"); -+} -+ -+/***************************************************/ - - const shared class C5107 - { -@@ -3028,7 +3139,7 @@ void test141() - struct S142 - { - int v; -- this(int n) { v = n; } -+ this(int n) pure { v = n; } - const bool opCast(T:bool)() { return true; } - } - -@@ -3278,6 +3389,71 @@ void cantthrow() nothrow - } - - /***************************************************/ -+// 2356 -+ -+void test2356() -+{ -+ int[3] x = [1,2,3]; -+ printf("x[] = [%d %d %d]\n", x[0], x[1], x[2]); -+ assert(x[0] == 1 && x[1] == 2 && x[2] == 3); -+ -+ struct S -+ { -+ static int pblit; -+ int n; -+ this(this) { ++pblit; printf("postblit: %d\n", n); } -+ } -+ S s2 = S(2); -+ S[3] s = [S(1), s2, S(3)]; -+ assert(s[0].n == 1 && s[1].n == 2 && s[2].n == 3); -+ printf("s[].n = [%d %d %d]\n", s[0].n, s[1].n, s[2].n); -+ assert(S.pblit == 1); -+ -+ ubyte[1024] v; -+ v = typeof(v).init; -+ printf("v[] = [%d %d %d, ..., %d]\n", v[0], v[1], v[2], v[$-1]); -+ foreach (ref a; v) assert(a == 0); -+ -+ int n = 5; -+ int[3] y = [n, n, n]; -+ printf("y[] = [%d %d %d]\n", y[0], y[1], y[2]); -+ assert(y[0] == 5 && y[1] == 5 && y[2] == 5); -+ -+ S[3] z = [s2, s2, s2]; -+ assert(z[0].n == 2 && z[1].n == 2 && z[2].n == 2); -+ printf("z[].n = [%d %d %d]\n", z[0].n, z[1].n, z[2].n); -+ assert(S.pblit == 1 + 3); -+ -+ int[0] nsa0 = []; -+ void[0] vsa0 = []; -+ -+ void foo(T)(T){} -+ foo(vsa0); -+ -+ ref int[0] bar() { static int[1] sa; return *cast(int[0]*)&sa; } -+ bar() = []; -+} -+ -+/***************************************************/ -+// 11238 -+ -+void test11238() -+{ -+ int[2] m; -+ m[0] = 4,m[1] = 6; -+ //printf("%d,%d\n", m[0], m[1]); -+ assert(m[0] == 4 && m[1] == 6); -+ -+ m = [m[1], m[0]]; // swap -+ assert(m[0] == 6 && m[1] == 4); -+ //printf("%d,%d\n", m[0], m[1]); -+ -+ m = [m[1], m[0]]; // swap -+ //printf("%d,%d\n", m[0], m[1]); -+ assert(m[0] == 4 && m[1] == 6); -+} -+ -+/***************************************************/ - - class A2540 - { -@@ -3475,6 +3651,26 @@ void test154() { - } - - /***************************************************/ -+ -+void test6545() -+{ -+ static int[] func() -+ { -+ auto a = [1, 2, 3]; -+ auto b = [2, 3, 4]; -+ auto c = [3, 4, 5]; -+ -+ a[] = b[] + c[]; -+ -+ return a; -+ } -+ -+ auto a = func(); -+ enum b = func(); -+ assert(a == b); -+} -+ -+/***************************************************/ - // 3147 - - -@@ -3494,6 +3690,29 @@ void test155() - } - - /***************************************************/ -+// 2486 -+ -+void test2486() -+{ -+ void foo(ref int[] arr) {} -+ -+ int[] arr = [1,2,3]; -+ foo(arr); //OK -+ static assert(!__traits(compiles, foo(arr[1..2]))); // should be NG -+ -+ struct S -+ { -+ int[] a; -+ auto ref opSlice(){ return a[]; } // line 4 -+ } -+ S s; -+ s[]; -+ // opSlice should return rvalue -+ static assert(is(typeof(&S.opSlice) == int[] function())); -+ static assert(!__traits(compiles, foo(s[]))); // should be NG -+} -+ -+/***************************************************/ - // 2521 - - immutable int val = 23; -@@ -3560,6 +3779,14 @@ void test156() - - /***************************************************/ - -+void test10724() -+{ -+ const(char)* s = "abc"[0..$-1]; -+ assert(s[2] == '\0'); -+} -+ -+/***************************************************/ -+ - void test6708(const ref int y) - { - immutable int x; -@@ -4116,6 +4343,62 @@ void test6473() - } - - /***************************************************/ -+ -+void test6578() -+{ -+ static struct Foo -+ { -+ this(int x) pure {} -+ } -+ auto f1 = new const(Foo)(1); -+ auto f2 = new immutable(Foo)(1); -+ auto f3 = new shared(Foo)(1); -+ auto f4 = const(Foo)(1); -+ auto f5 = immutable(Foo)(1); -+ auto f6 = shared(Foo)(1); -+ static assert(is(typeof(f1) == const(Foo)*)); -+ static assert(is(typeof(f2) == immutable(Foo)*)); -+ static assert(is(typeof(f3) == shared(Foo)*)); -+ static assert(is(typeof(f4) == const(Foo))); -+ static assert(is(typeof(f5) == immutable(Foo))); -+ static assert(is(typeof(f6) == shared(Foo))); -+ -+ static struct Bar -+ { -+ this(int x) const pure {} -+ } -+ auto g1 = new const(Bar)(1); -+ auto g2 = new immutable(Bar)(1); -+ auto g3 = new shared(Bar)(1); -+ auto g4 = const(Bar)(1); -+ auto g5 = immutable(Bar)(1); -+ auto g6 = shared(Bar)(1); -+ static assert(is(typeof(g1) == const(Bar)*)); -+ static assert(is(typeof(g2) == immutable(Bar)*)); -+ static assert(is(typeof(g3) == shared(Bar)*)); -+ static assert(is(typeof(g4) == const(Bar))); -+ static assert(is(typeof(g5) == immutable(Bar))); -+ static assert(is(typeof(g6) == shared(Bar))); -+ -+ static struct Baz -+ { -+ this()(int x) const pure {} -+ } -+ auto h1 = new const(Baz)(1); -+ auto h2 = new immutable(Baz)(1); -+ auto h3 = new shared(const(Baz))(1); -+ auto h4 = const(Baz)(1); -+ auto h5 = immutable(Baz)(1); -+ auto h6 = shared(const(Baz))(1); -+ static assert(is(typeof(h1) == const(Baz)*)); -+ static assert(is(typeof(h2) == immutable(Baz)*)); -+ static assert(is(typeof(h3) == shared(const(Baz))*)); -+ static assert(is(typeof(h4) == const(Baz))); -+ static assert(is(typeof(h5) == immutable(Baz))); -+ static assert(is(typeof(h6) == shared(const(Baz)))); -+} -+ -+/***************************************************/ - // 6630 - - void test6630() -@@ -4172,6 +4455,25 @@ template Hoge6691() - alias Hoge6691!() H6691; - - /***************************************************/ -+ -+void test10626() -+{ -+ double[2] v, x; -+ struct Y { double u; } -+ double z; -+ Y y; -+ double[2] r = v[] * x[0]; -+ //double[2] s = v[] * z++; -+ //double[2] t = v[] * z--; -+ double[2] a = v[] * ++z; -+ double[2] b = v[] * --z; -+ double[2] c = v[] * y.u; -+ double[2] d = v[] * (x[] = 3, x[0]); -+ double[2] e = v[] * (v[] ~ z)[0]; -+} -+ -+ -+/***************************************************/ - // 2953 - - template Tuple2953(T...) -@@ -4264,10 +4566,10 @@ void test4647() - assert(app.run() == 1); // This would call Timer.run() if the two calls - // above were commented out - assert(app.funCalls == 5); -- -+ - assert(app.TimedApp.fun() == 2); - assert(app.funCalls == 6); -- -+ - //Test direct access to SubTimedApp interfaces - auto app2 = new SubTimedApp(); - assert((cast(Application)app2).run() == 2); -@@ -4276,7 +4578,7 @@ void test4647() - assert(app2.Timer.run() == 1); - assert(app2.funCalls == 0); - assert(app2.subFunCalls == 4); -- -+ - assert(app2.fun() == 1); - assert(app2.SubTimedApp.fun() == 1); - assert(app2.funCalls == 0); -@@ -4979,9 +5281,11 @@ void test7150() - /***************************************************/ - // 7159 - -+alias void delegate() Void7159; -+ - class HomeController7159 { -- void* foo() { -- return cast(void*)&HomeController7159.displayDefault; -+ Void7159 foo() { -+ return cast(Void7159)&HomeController7159.displayDefault; - } - auto displayDefault() { - return 1; -@@ -5086,11 +5390,16 @@ class A158 - class B158 : A158 - { - override void foo1() { } -- override void foo2() { } -+ override void foo2() const { } - override void foo3() { } - override void foo4() { } - } - -+/***************************************************/ -+// 9231 -+ -+class B9231 { void foo() inout pure {} } -+class D9231 : B9231 { override void foo() inout {} } - - /***************************************************/ - // 3282 -@@ -5463,6 +5772,12 @@ void test8064() - } - - /***************************************************/ -+// 8220 -+ -+void foo8220(int){} -+static assert(!__traits(compiles, foo8220(typeof(0)))); // fail -+ -+/***************************************************/ - - void func8105(in ref int x) { } - -@@ -5658,6 +5973,61 @@ void test8108() - } - - /***************************************************/ -+// 8360 -+ -+struct Foo8360 -+{ -+ int value = 0; -+ int check = 1337; -+ -+ this(int value) -+ { -+ assert(0); -+ this.value = value; -+ } -+ -+ ~this() -+ { -+ assert(0); -+ assert(check == 1337); -+ } -+ -+ string str() -+ { -+ assert(0); -+ return "Foo"; -+ } -+} -+ -+Foo8360 makeFoo8360() -+{ -+ assert(0); -+ return Foo8360(2); -+} -+ -+void test8360() -+{ -+ size_t length = 0; -+ -+ // The message part 'makeFoo().str()' should not be evaluated at all. -+ assert(length < 5, makeFoo8360().str()); -+} -+ -+/***************************************************/ -+// 8361 -+ -+struct Foo8361 -+{ -+ string bar = "hello"; -+ ~this() {} -+} -+ -+void test8361() -+{ -+ assert(true, Foo8361().bar); -+} -+ -+/***************************************************/ - // 6141 + 8526 - - void test6141() -@@ -5731,6 +6101,32 @@ void test161() - } - - /***************************************************/ -+// 8819 -+ -+void test8819() -+{ -+ void[0] sa0 = (void[0]).init; -+ assert(sa0.ptr is null); -+ -+ void[1] sa1 = (void[1]).init; -+ assert((cast(ubyte*)sa1.ptr)[0] == 0); -+ -+ void[4] sa4 = [cast(ubyte)1,cast(ubyte)2,cast(ubyte)3,cast(ubyte)4]; -+ assert((cast(ubyte*)sa4.ptr)[0] == 1); -+ assert((cast(ubyte*)sa4.ptr)[1] == 2); -+ assert((cast(ubyte*)sa4.ptr)[2] == 3); -+ assert((cast(ubyte*)sa4.ptr)[3] == 4); -+ -+ auto sa22 = (void[2][2]).init; -+ static assert(sa22.sizeof == ubyte.sizeof * 2 * 2); -+ ubyte[4]* psa22 = cast(ubyte[4]*)sa22.ptr; -+ assert((*psa22)[0] == 0); -+ assert((*psa22)[1] == 0); -+ assert((*psa22)[2] == 0); -+ assert((*psa22)[3] == 0); -+} -+ -+/***************************************************/ - // 8897 - - class C8897 -@@ -5752,6 +6148,26 @@ void test8917() - } - - /***************************************************/ -+// 8945 -+ -+struct S8945 // or `class`, or `union` -+{ -+ struct S0(T) { int i; } -+ struct S1(T) { this(int){} } -+} -+ -+void test8945() -+{ -+ auto cs0a = const S8945.S0!int(); // ok -+ auto cs0b = const S8945.S0!int(1); // ok -+ auto cs1 = const S8945.S1!int(1); // ok -+ -+ auto s0a = S8945.S0!int(); // Error: struct S0 does not overload () -+ auto s0b = S8945.S0!int(1); // Error: struct S0 does not overload () -+ auto s1 = S8945.S1!int(1); // Error: struct S1 does not overload () -+} -+ -+/***************************************************/ - - struct S162 - { -@@ -5854,6 +6270,441 @@ struct X164() - - - /***************************************************/ -+// 9428 -+ -+void test9428() -+{ -+ int[2][] items = [[1, 2]]; -+ int[2] x = [3, 4]; -+ -+ auto r1 = items ~ [x]; -+ assert(r1.length == 2); -+ assert(r1[0][0] == 1); -+ assert(r1[0][1] == 2); -+ assert(r1[1][0] == 3); -+ assert(r1[1][1] == 4); -+ -+ auto r2 = items ~ x; -+ assert(r2.length == 2); -+ assert(r2[0][0] == 1); -+ assert(r2[0][1] == 2); -+ assert(r2[1][0] == 3); -+ assert(r2[1][1] == 4); -+ -+ auto r3 = [x] ~ items; -+ assert(r3.length == 2); -+ assert(r3[0][0] == 3); -+ assert(r3[0][1] == 4); -+ assert(r3[1][0] == 1); -+ assert(r3[1][1] == 2); -+ -+ auto r4 = x ~ items; -+ assert(r4.length == 2); -+ assert(r4[0][0] == 3); -+ assert(r4[0][1] == 4); -+ assert(r4[1][0] == 1); -+ assert(r4[1][1] == 2); -+} -+ -+/***************************************************/ -+// 9477 -+ -+template Tuple9477(T...) { alias T Tuple9477; } -+template Select9477(bool b, T, U) { static if (b) alias T Select9477; else alias U Select9477; } -+ -+void test9477() -+{ -+ static bool isEq (T1, T2)(T1 s1, T2 s2) { return s1 == s2; } -+ static bool isNeq(T1, T2)(T1 s1, T2 s2) { return s1 != s2; } -+ -+ // Must be outside the loop due to http://d.puremagic.com/issues/show_bug.cgi?id=9748 -+ int order; -+ // Must be outside the loop due to http://d.puremagic.com/issues/show_bug.cgi?id=9756 -+ auto checkOrder(bool dyn, uint expected)() -+ { -+ assert(order==expected); -+ order++; -+ // Use temporary ("v") to work around http://d.puremagic.com/issues/show_bug.cgi?id=9402 -+ auto v = cast(Select9477!(dyn, string, char[1]))"a"; -+ return v; -+ } -+ -+ foreach (b1; Tuple9477!(false, true)) -+ foreach (b2; Tuple9477!(false, true)) -+ { -+ version (D_PIC) {} else // Work around http://d.puremagic.com/issues/show_bug.cgi?id=9754 -+ { -+ assert( isEq (cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[0]))"" )); -+ assert(!isNeq(cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[0]))"" )); -+ -+ assert(!isEq (cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[1]))"a" )); -+ assert( isNeq(cast(Select9477!(b1, string, char[0]))"" , cast(Select9477!(b2, string, char[1]))"a" )); -+ } -+ -+ assert( isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"a" )); -+ assert(!isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"a" )); -+ -+ assert(!isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"b" )); -+ assert( isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[1]))"b" )); -+ -+ assert(!isEq (cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[2]))"aa")); -+ assert( isNeq(cast(Select9477!(b1, string, char[1]))"a", cast(Select9477!(b2, string, char[2]))"aa")); -+ -+ // Note: order of evaluation was not followed before this patch -+ // (thus, the test below will fail without the patch). -+ // Although the specification mentions that as implementation-defined behavior, -+ // I understand that this isn't by design, but rather an inconvenient aspect of DMD -+ // that has been moved to the specification. -+ order = 0; -+ bool result = checkOrder!(b1, 0)() == checkOrder!(b2, 1)(); -+ assert(result); -+ assert(order == 2); -+ } -+ -+ ubyte[64] a1, a2; -+ foreach (T; Tuple9477!(void, ubyte, ushort, uint, ulong, char, wchar, dchar, float, double)) -+ { -+ auto s1 = cast(T[])(a1[]); -+ auto s2 = cast(T[])(a2[]); -+ assert(s1 == s2); -+ a2[$-1]++; -+ assert(s1 != s2); -+ assert(s1[0..$-1]==s2[0..$-1]); -+ a2[$-1]--; -+ } -+} -+ -+/***************************************************/ -+// 9504 -+ -+struct Bar9504 -+{ -+ template Abc(T) -+ { -+ T y; -+ } -+ -+ enum size_t num = 123; -+ -+ class Def {} -+} -+ -+template GetSym9504(alias sym) { static assert(__traits(isSame, sym, Bar9504.Abc)); } -+template GetExp9504(size_t n) { static assert(n == Bar9504.num); } -+template GetTyp9504(T) { static assert(is(T == Bar9504.Def)); } -+ -+alias GetSym9504!(typeof(Bar9504.init).Abc) X9504; // NG -+alias GetExp9504!(typeof(Bar9504.init).num) Y9504; // NG -+alias GetTyp9504!(typeof(Bar9504.init).Def) Z9504; -+ -+Bar9504 test9504() -+{ -+ alias GetSym9504!(typeof(return).Abc) V9504; // NG -+ alias GetExp9504!(typeof(return).num) W9504; // NG -+ alias GetTyp9504!(typeof(return).Def) X9504; -+ return Bar9504(); -+} -+ -+/***************************************************/ -+// 9538 -+ -+void test9538() -+{ -+ void*[1] x; -+ auto ti = typeid(x.ptr); -+} -+ -+/***************************************************/ -+// 9539 -+ -+void test9539() -+{ -+ void f(int** ptr) -+ { -+ assert(**ptr == 10); -+ } -+ int* p = new int; -+ *p = 10; -+ int*[1] x = [p]; -+ f(&x[0]); -+ -+ int*[] arr = [null]; -+ static assert(!__traits(compiles, p = arr)); // bad! -+} -+ -+/***************************************************/ -+// 9700 -+ -+mixin template Proxy9700(alias a) -+{ -+ auto ref opOpAssign(string op, V)(V v) { return a += v; } // NG -+ //auto ref opOpAssign(string op, V)(V v) { a += v; } // OK -+} -+struct MyInt9700 -+{ -+ int value; -+ invariant() { assert(value >= 0); } -+ mixin Proxy9700!value; -+} -+void test9700() -+{ -+ MyInt9700 a = { 2 }; -+ a *= 3; // object.Error: Access Violation -+} -+ -+/***************************************************/ -+// 9834 -+ -+struct Event9834 -+{ -+ void delegate() dg; -+ void set(void delegate() h) pure { dg = h; } // AV occurs -+ void call() { dg(); } -+} -+void test9834() -+{ -+ Event9834 ev; -+ auto a = new class -+ { -+ Object o; -+ this() -+ { -+ o = new Object; -+ ev.set((){ o.toString(); }); -+ } -+ }; -+ ev.call(); -+} -+ -+/***************************************************/ -+// 9859 -+ -+void test9859(inout int[] arr) -+{ -+ auto dg1 = { foreach (i, e; arr) { } }; -+ dg1(); -+ -+ void foo() { auto v = arr; auto w = arr[0]; } -+ void bar(inout int i) { auto v = arr[i]; } -+ -+ auto dg2 = -+ { -+ auto dg = -+ { -+ void foo(T)() -+ { -+ auto dg = -+ { -+ auto dg = -+ { -+ auto v = arr; -+ }; -+ }; -+ } -+ foo!int; -+ }; -+ }; -+ -+ void qux(T)() -+ { -+ auto v = arr; -+ auto dg1 = { auto v = arr; }; -+ auto dg2 = -+ { -+ auto dg = -+ { -+ auto v = arr; -+ }; -+ }; -+ } -+ qux!int; -+} -+ -+/***************************************************/ -+// 9912 -+ -+template TypeTuple9912(Stuff...) -+{ -+ alias Stuff TypeTuple9912; -+} -+ -+struct S9912 -+{ -+ int i; -+ alias TypeTuple9912!i t; -+ -+ void testA() { -+ auto x = t; -+ } -+ -+ void testB() { -+ auto x = t; -+ } -+} -+ -+/***************************************************/ -+// 9883 -+ -+struct S9883 -+{ -+ @property size_t p9883(T)() { return 0; } -+} -+ -+@property size_t p9883(T)() { return 0; } -+ -+void test9883() -+{ -+ S9883 s; -+ auto n1 = p9883!int; // OK -+ auto n2 = s.p9883!int; // OK -+ auto a1 = new int[p9883!int]; // Error: need size of rightmost array, not type p!(int) -+ auto a2 = new int[s.p9883!int]; // Error: no property 'p!(int)' for type 'S' -+} -+ -+ -+/***************************************************/ -+// 10091 -+ -+struct S10091 -+{ -+ enum e = "a"; -+} -+ -+void test10091() -+{ -+ auto arr = cast(ubyte[1]) S10091.e; -+} -+ -+/***************************************************/ -+// 9130 -+ -+class S9130 { void bar() { } } -+ -+import core.stdc.stdio : printf; -+ -+struct Function -+{ -+ int[] ai = [1,2,3]; -+} -+ -+@property void meta(alias m)() -+{ -+ static Function md; -+ printf("length = %d\n", md.ai.length); -+ printf("ptr = %p\n", md.ai.ptr); -+ md.ai[0] = 0; -+} -+ -+void test9130() -+{ -+ meta!(__traits(getOverloads, S9130, "bar")[0]); -+ meta!(S9130.bar); -+} -+ -+/***************************************************/ -+// 10390 -+ -+class C10390 { this() { this.c = this; } C10390 c; } -+const c10390 = new C10390(); -+pragma(msg, c10390); -+ -+/***************************************************/ -+// 10542 -+ -+class B10542 -+{ -+ this() nothrow pure @safe { } -+} -+ -+class D10542 : B10542 -+{ -+} -+ -+void test10542() nothrow pure @safe -+{ -+ new D10542; -+} -+ -+/***************************************************/ -+// 10539 -+ -+void test10539() -+{ -+ int[2][2] a; -+ int* p1 = a.ptr.ptr; // OK <- error -+ int* p2 = (*a.ptr).ptr; // OK -+ assert(p1 is p2); -+} -+ -+/***************************************************/ -+ -+struct TimeOfDay -+{ -+ ubyte h, m, s; -+} -+ -+__gshared byte glob; -+ -+struct DateTime -+{ -+ this(ubyte _d, ubyte _m, ubyte _y, TimeOfDay _tod = TimeOfDay.init) -+ { -+ d = _d; -+ m = _m; -+ y = _y; -+ tod = _tod; -+ } -+ TimeOfDay tod; -+ ubyte d, m, y; -+} -+ -+ -+void test10634() -+{ -+ glob = 123; -+ DateTime date1 = DateTime(0, 0, 0); -+ DateTime date2; -+ assert(date1 == date2); -+} -+ -+/***************************************************/ -+ -+immutable(char)[4] bar7254(int i) { -+ if (i) -+ { -+ immutable(char)[4] r; return r; -+ } -+ else -+ return "1234"; -+} -+ -+void test7254() -+{ -+ assert(bar7254(0) == "1234"); -+} -+ -+/***************************************************/ -+ -+struct S11075() { int x = undefined_expr; } -+ -+class C11075() { int x = undefined_expr; } -+ -+interface I11075() { enum int x = undefined_expr; } -+ -+void test11075() -+{ -+ static assert(!is(typeof(S11075!().x))); -+ static assert(!is(typeof(S11075!().x))); -+ -+ static assert(!is(typeof(C11075!().x))); -+ static assert(!is(typeof(C11075!().x))); -+ -+ static assert(!is(typeof(I11075!().x))); -+ static assert(!is(typeof(I11075!().x))); -+} -+ -+ -+/***************************************************/ - - int main() - { -@@ -5949,6 +6800,7 @@ int main() - test8442(); - test86(); - test87(); -+ test2486(); - test5554(); - test88(); - test7545(); -@@ -5984,11 +6836,12 @@ int main() - test116(); - test117(); - test3822(); -+ test6545(); - test118(); - test5081(); - - test120(); -- -+ test10724(); - test122(); - test123(); - test124(); -@@ -6024,6 +6877,8 @@ int main() - test6685(); - test148(); - test149(); -+ test2356(); -+ test11238(); - test2540(); - test150(); - test151(); -@@ -6032,6 +6887,7 @@ int main() - test154(); - test155(); - test156(); -+ test658(); - test4258(); - test4539(); - test4596(); -@@ -6046,6 +6902,7 @@ int main() - test5046(); - test1471(); - test6335(); -+ test1687(); - test6228(); - test2774(); - test3733(); -@@ -6104,11 +6961,27 @@ int main() - test160(); - test8665(); - test8108(); -+ test8360(); - test6141(); - test8526(); - test161(); -+ test8819(); - test8917(); -+ test8945(); - test163(); -+ test9428(); -+ test9477(); -+ test9538(); -+ test9700(); -+ test9834(); -+ test9883(); -+ test10091(); -+ test9130(); -+ test10542(); -+ test10539(); -+ test10634(); -+ test7254(); -+ test11075(); - - printf("Success\n"); - return 0; ---- a/src/gcc/testsuite/gdc.test/runnable/xtest55.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/gdc.test/runnable/xtest55.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,7 +2,7 @@ - - import core.memory, std.stdio; - --__thread Stuff* stuff1; -+Stuff* stuff1; - - struct Stuff { - uint num; ---- a/src/gcc/testsuite/lib/gdc.exp 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/gcc/testsuite/lib/gdc.exp 2014-04-01 16:32:51.000000000 +0100 -@@ -19,6 +19,7 @@ - # - load_lib prune.exp - load_lib gcc-defs.exp -+load_lib timeout.exp - load_lib target-libpath.exp - - # -@@ -230,6 +231,7 @@ proc gdc_target_compile { source dest ty - lappend options "ldflags=${wrap_flags}" - } - -+ lappend options "timeout=[timeout_value]" - lappend options "compiler=$GDC_UNDER_TEST" - - set options [concat "$ALWAYS_DFLAGS" $options] ---- a/src/libphobos/acinclude.m4 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/acinclude.m4 2014-04-01 16:32:51.000000000 +0100 -@@ -1,67 +1,34 @@ --dnl Unix-specific configuration --AC_DEFUN([DPHOBOS_CONFIGURE_UNIX],[ -- --AC_CHECK_HEADERS(pthread.h,:, -- [AC_MSG_ERROR([can't find pthread.h. Pthreads is the only supported thread library.])]) -- --AC_MSG_CHECKING([for recursive mutex name]) --AC_TRY_COMPILE([#include <pthread.h>],[ --pthread_mutexattr_t attr; --pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);], -- [AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE,1,[Determines how to declared recursive mutexes]) -- AC_MSG_RESULT([PTHREAD_MUTEX_RECURSIVE])], -- [AC_MSG_RESULT([PTHREAD_MUTEX_RECURSIVE_NP])]) -- --AC_CHECK_TYPES([pthread_barrier_t, pthread_barrierattr_t, -- pthread_rwlock_t, pthread_rwlockattr_t, -- pthread_spinlock_t],,,[#include <pthread.h>]) -- --AC_CHECK_TYPES([clockid_t],,,[#include <pthread.h>]) -- --AC_SEARCH_LIBS(sem_init, pthread rt posix4) -- --AC_CHECK_HEADERS(semaphore.h) --AC_CHECK_FUNC(sem_init) --AC_CHECK_FUNC(semaphore_create) --AC_CHECK_FUNC(pthread_cond_wait) -- --if test -z "$d_sem_impl"; then -- # Probably need to test what actually works. sem_init is defined -- # on AIX and Darwin but does not actually work. -- # For now, test for Mach semaphores first so it overrides Posix. AIX -- # is a special case. -- if test "$ac_cv_func_semaphore_create" = "yes"; then -- d_sem_impl="mach" -- elif test "$ac_cv_func_sem_init" = "yes" && \ -- test "$ac_cv_header_semaphore_h" = "yes" && \ -- test -z "$d_is_aix"; then -- d_sem_impl="posix" -- elif test "$ac_cv_func_pthread_cond_wait" = "yes"; then -- d_sem_impl="pthreads" -- fi --fi -- --dnl TODO: change this to using pthreads? if so, define usepthreads --dnl and configure semaphore -- --case "$d_sem_impl" in -- posix) DCFG_SEMAPHORE_IMPL="GNU_Semaphore_POSIX" ;; -- mach) DCFG_SEMAPHORE_IMPL="GNU_Semaphore_Mach" -- d_module_mach=1 ;; -- pthreads) DCFG_SEMAPHORE_IMPL="GNU_Sempahore_Pthreads" ;; -- skyos) DCFG_SEMAPHORE_IMPL="GNU_Sempahore_Pthreads" -- D_EXTRA_OBJS="$D_EXTRA_OBJS std/c/skyos/compat.o" -- ;; -- *) AC_MSG_ERROR([No usable semaphore implementation]) ;; --esac -- --AC_DEFINE(PHOBOS_USE_PTHREADS,1,[Define if using pthreads]) -+dnl Copyright (C) 2013 Free Software Foundation, Inc. -+dnl This file is free software, distributed under the terms of the GNU -+dnl General Public License. As a special exception to the GNU General -+dnl Public License, this file may be distributed as part of a program -+dnl that contains a configuration script generated by Autoconf, under -+dnl the same distribution terms as the rest of that program. - -+dnl Unix-specific configuration - -+AC_DEFUN([DPHOBOS_CONFIGURE_UNIX],[ - # Add "linux" module for compatibility even if not Linux - D_EXTRA_OBJS="std/c/linux/linux.o $D_EXTRA_OBJS" - DCFG_UNIX="Unix" - DCFG_POSIX="Posix" -+]) - -+dnl usage: DRUNTIME_CONFIGURE_THREADS([thread_model]) -+ -+AC_DEFUN([DRUNTIME_CONFIGURE_THREADS], -+[ -+case $1 in -+ aix) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ lynx) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ posix) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ single) DCFG_THREAD_MODEL="GNU_Thread_Single" ;; -+ win32) DCFG_THREAD_MODEL="GNU_Thread_Win32" ;; -+ # TODO: These targets need porting. -+ dce|mipssde|rtems|tpf|vxworks) -+ DCFG_THREAD_MODEL="GNU_Thread_Single" ;; -+ *) as_fn_error "Thread implementation '$1' not recognised" "$LINENO" 5 ;; -+esac -+AC_SUBST(DCFG_THREAD_MODEL) - ]) - ---- a/src/libphobos/aclocal.m4 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/aclocal.m4 2014-04-01 16:32:51.000000000 +0100 -@@ -14,8 +14,8 @@ - - m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl --m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, --[m4_warning([this file was generated for autoconf 2.69. -+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],, -+[m4_warning([this file was generated for autoconf 2.64. - You have another version of autoconf. It may work, but is not guaranteed to. - If you have problems, you may need to regenerate the build system entirely. - To do so, use the procedure documented by the package, typically `autoreconf'.])]) ---- a/src/libphobos/config.h.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/config.h.in 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,4 @@ --/* config.h.in. Generated from configure.in by autoheader. */ -- --/* Define to 1 if the system has the type `clockid_t'. */ --#undef HAVE_CLOCKID_T -+/* config.h.in. Generated from configure.ac by autoheader. */ - - /* Define to 1 if you have the <inttypes.h> header file. */ - #undef HAVE_INTTYPES_H -@@ -15,30 +12,6 @@ - /* Define to 1 if you have the <memory.h> header file. */ - #undef HAVE_MEMORY_H - --/* Define to 1 if the system has the type `pthread_barrierattr_t'. */ --#undef HAVE_PTHREAD_BARRIERATTR_T -- --/* Define to 1 if the system has the type `pthread_barrier_t'. */ --#undef HAVE_PTHREAD_BARRIER_T -- --/* Define to 1 if you have the <pthread.h> header file. */ --#undef HAVE_PTHREAD_H -- --/* Determines how to declared recursive mutexes */ --#undef HAVE_PTHREAD_MUTEX_RECURSIVE -- --/* Define to 1 if the system has the type `pthread_rwlockattr_t'. */ --#undef HAVE_PTHREAD_RWLOCKATTR_T -- --/* Define to 1 if the system has the type `pthread_rwlock_t'. */ --#undef HAVE_PTHREAD_RWLOCK_T -- --/* Define to 1 if the system has the type `pthread_spinlock_t'. */ --#undef HAVE_PTHREAD_SPINLOCK_T -- --/* Define to 1 if you have the <semaphore.h> header file. */ --#undef HAVE_SEMAPHORE_H -- - /* Define to 1 if you have the `snprintf' function. */ - #undef HAVE_SNPRINTF - -@@ -102,9 +75,6 @@ - /* Define to the version of this package. */ - #undef PACKAGE_VERSION - --/* Define if using pthreads */ --#undef PHOBOS_USE_PTHREADS -- - /* Define to 1 if you have the ANSI C header files. */ - #undef STDC_HEADERS - ---- a/src/libphobos/configure 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/configure 2014-04-01 16:32:51.000000000 +0100 -@@ -1,10 +1,10 @@ - #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. --# Generated by GNU Autoconf 2.69 for libphobos version-unused. --# --# --# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -+# Generated by GNU Autoconf 2.64 for libphobos version-unused. - # -+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -+# Foundation, Inc. - # - # This configure script is free software; the Free Software Foundation - # gives unlimited permission to copy, distribute and modify it. -@@ -87,7 +87,6 @@ fi - IFS=" "" $as_nl" - - # Find who we are. Look in the path if we contain no directory separator. --as_myself= - case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -@@ -132,31 +131,6 @@ export LANGUAGE - # CDPATH. - (unset CDPATH) >/dev/null 2>&1 && unset CDPATH - --# Use a proper internal environment variable to ensure we don't fall -- # into an infinite loop, continuously re-executing ourselves. -- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then -- _as_can_reexec=no; export _as_can_reexec; -- # We cannot yet assume a decent shell, so we have to provide a --# neutralization value for shells without unset; and this also --# works around shells that cannot unset nonexistent variables. --# Preserve -v and -x to the replacement shell. --BASH_ENV=/dev/null --ENV=/dev/null --(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV --case $- in # (((( -- *v*x* | *x*v* ) as_opts=-vx ;; -- *v* ) as_opts=-v ;; -- *x* ) as_opts=-x ;; -- * ) as_opts= ;; --esac --exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} --# Admittedly, this is quite paranoid, since all the known shells bail --# out after a failed `exec'. --$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 --as_fn_exit 255 -- fi -- # We don't want this to propagate to other subprocesses. -- { _as_can_reexec=; unset _as_can_reexec;} - if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh -@@ -190,8 +164,7 @@ if ( set x; as_fn_ret_success y && test - else - exitcode=1; echo positional parameters were not saved. - fi --test x\$exitcode = x0 || exit 1 --test -x / || exit 1" -+test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && -@@ -236,25 +209,14 @@ IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : -- export CONFIG_SHELL -- # We cannot yet assume a decent shell, so we have to provide a --# neutralization value for shells without unset; and this also --# works around shells that cannot unset nonexistent variables. --# Preserve -v and -x to the replacement shell. --BASH_ENV=/dev/null --ENV=/dev/null --(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV --case $- in # (((( -- *v*x* | *x*v* ) as_opts=-vx ;; -- *v* ) as_opts=-v ;; -- *x* ) as_opts=-x ;; -- * ) as_opts= ;; --esac --exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} --# Admittedly, this is quite paranoid, since all the known shells bail --# out after a failed `exec'. --$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 --exit 255 -+ # We cannot yet assume a decent shell, so we have to provide a -+ # neutralization value for shells without unset; and this also -+ # works around shells that cannot unset nonexistent variables. -+ BASH_ENV=/dev/null -+ ENV=/dev/null -+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -+ export CONFIG_SHELL -+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} - fi - - if test x$as_have_required = xno; then : -@@ -352,18 +314,10 @@ $as_echo X"$as_dir" | - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" -- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" -+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - - } # as_fn_mkdir_p -- --# as_fn_executable_p FILE --# ----------------------- --# Test if FILE is an executable regular file. --as_fn_executable_p () --{ -- test -f "$1" && test -x "$1" --} # as_fn_executable_p - # as_fn_append VAR VALUE - # ---------------------- - # Append the text in VALUE to the end of the definition contained in VAR. Take -@@ -400,19 +354,19 @@ else - fi # as_fn_arith - - --# as_fn_error STATUS ERROR [LINENO LOG_FD] --# ---------------------------------------- -+# as_fn_error ERROR [LINENO LOG_FD] -+# --------------------------------- - # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are - # provided, also output the error to LOG_FD, referencing LINENO. Then exit the --# script with STATUS, using 1 if that was 0. -+# script with status $?, using 1 if that was 0. - as_fn_error () - { -- as_status=$1; test $as_status -eq 0 && as_status=1 -- if test "$4"; then -- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack -- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 -+ as_status=$?; test $as_status -eq 0 && as_status=1 -+ if test "$3"; then -+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack -+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi -- $as_echo "$as_me: error: $2" >&2 -+ $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status - } # as_fn_error - -@@ -485,10 +439,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - -- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have -- # already done that, so ensure we don't try to do so again and fall -- # in an infinite loop. This has already happened in practice. -- _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). -@@ -523,16 +473,16 @@ if (echo >conf$$.file) 2>/dev/null; then - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. -- # In both cases, we have to default to `cp -pR'. -+ # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - fi - else -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - fi - rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file - rmdir conf$$.dir 2>/dev/null -@@ -544,8 +494,28 @@ else - as_mkdir_p=false - fi - --as_test_x='test -x' --as_executable_p=as_fn_executable_p -+if test -x / >/dev/null 2>&1; then -+ as_test_x='test -x' -+else -+ if ls -dL / >/dev/null 2>&1; then -+ as_ls_L_option=L -+ else -+ as_ls_L_option= -+ fi -+ as_test_x=' -+ eval sh -c '\'' -+ if test -d "$1"; then -+ test -d "$1/."; -+ else -+ case $1 in #( -+ -*)set "./$1";; -+ esac; -+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( -+ ???[sx]*):;;*)false;;esac;fi -+ '\'' sh -+ ' -+fi -+as_executable_p=$as_test_x - - # Sed expression to map a string onto a valid CPP name. - as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" -@@ -554,11 +524,10 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P - as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - --test -n "$DJDIR" || exec 7<&0 </dev/null --exec 6>&1 -+exec 7<&0 </dev/null 6>&1 - - # Name of the host. --# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, - # so uname gets run too. - ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -@@ -634,11 +603,18 @@ DCFG_POSIX - DCFG_UNIX - DCFG_GETPWNAM_R - DCFG_MMAP --DCFG_SEMAPHORE_IMPL - DCFG_CBRIDGE_STDIO - DCFG_ARM_EABI_UNWINDER - DRUNTIME_OBJS - D_EXTRA_OBJS -+DCFG_THREAD_MODEL -+BACKTRACE_SUPPORTS_THREADS -+BACKTRACE_USES_MALLOC -+BACKTRACE_SUPPORTED -+LIBBACKTRACE_LIB -+BACKTRACE_SUPPORTED_FALSE -+BACKTRACE_SUPPORTED_TRUE -+HAVE_DLADDR - EGREP - GREP - CPP -@@ -746,6 +722,7 @@ enable_druntime_gc - with_system_zlib - enable_phobos_config_dir - with_cross_host -+enable_libbacktrace - ' - ac_precious_vars='build_alias - host_alias -@@ -812,9 +789,8 @@ do - fi - - case $ac_option in -- *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; -- *=) ac_optarg= ;; -- *) ac_optarg=yes ;; -+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; -+ *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. -@@ -859,7 +835,7 @@ do - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && -- as_fn_error $? "invalid feature name: $ac_useropt" -+ as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in -@@ -885,7 +861,7 @@ do - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && -- as_fn_error $? "invalid feature name: $ac_useropt" -+ as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in -@@ -1089,7 +1065,7 @@ do - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && -- as_fn_error $? "invalid package name: $ac_useropt" -+ as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in -@@ -1105,7 +1081,7 @@ do - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && -- as_fn_error $? "invalid package name: $ac_useropt" -+ as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in -@@ -1135,8 +1111,8 @@ do - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - -- -*) as_fn_error $? "unrecognized option: \`$ac_option' --Try \`$0 --help' for more information" -+ -*) as_fn_error "unrecognized option: \`$ac_option' -+Try \`$0 --help' for more information." - ;; - - *=*) -@@ -1144,7 +1120,7 @@ Try \`$0 --help' for more information" - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) -- as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; -+ as_fn_error "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; -@@ -1154,7 +1130,7 @@ Try \`$0 --help' for more information" - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 -- : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" -+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -@@ -1162,13 +1138,13 @@ done - - if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` -- as_fn_error $? "missing argument to $ac_option" -+ as_fn_error "missing argument to $ac_option" - fi - - if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; -- fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; -+ fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac - fi -@@ -1191,7 +1167,7 @@ do - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac -- as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -+ as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" - done - - # There might be people who depend on the old broken behavior: `$host' -@@ -1205,6 +1181,8 @@ target=$target_alias - if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe -+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. -+ If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -@@ -1219,9 +1197,9 @@ test "$silent" = yes && exec 6>/dev/null - ac_pwd=`pwd` && test -n "$ac_pwd" && - ac_ls_di=`ls -di .` && - ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || -- as_fn_error $? "working directory cannot be determined" -+ as_fn_error "working directory cannot be determined" - test "X$ac_ls_di" = "X$ac_pwd_ls_di" || -- as_fn_error $? "pwd does not report name of working directory" -+ as_fn_error "pwd does not report name of working directory" - - - # Find the source files, if location was not specified. -@@ -1260,11 +1238,11 @@ else - fi - if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." -- as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -+ as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" - fi - ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" - ac_abs_confdir=`( -- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" -+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" - pwd)` - # When building in place, set srcdir=. - if test "$ac_abs_confdir" = "$ac_pwd"; then -@@ -1304,7 +1282,7 @@ Configuration: - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit -- -q, --quiet, --silent do not print \`checking ...' messages -+ -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files -@@ -1378,6 +1356,7 @@ Optional Features: - --enable-druntime-gc enable D runtime garbage collector (default: yes) - --enable-phobos-config-dir=<dir> - use source file fragments in <dir> -+ --disable-libbacktrace Do not use libbacktrace for backtraces - - Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] -@@ -1391,7 +1370,7 @@ Some influential environment variables: - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - LIBS libraries to pass to the linker, e.g. -l<library> -- CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if -+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if - you have headers in a nonstandard directory <include dir> - CXX C++ compiler command - CXXFLAGS C++ compiler flags -@@ -1464,9 +1443,9 @@ test -n "$ac_init_help" && exit $ac_stat - if $ac_init_version; then - cat <<\_ACEOF - libphobos configure version-unused --generated by GNU Autoconf 2.69 -+generated by GNU Autoconf 2.64 - --Copyright (C) 2012 Free Software Foundation, Inc. -+Copyright (C) 2009 Free Software Foundation, Inc. - This configure script is free software; the Free Software Foundation - gives unlimited permission to copy, distribute and modify it. - _ACEOF -@@ -1510,8 +1489,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 - fi -- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -- as_fn_set_status $ac_retval -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -+ return $ac_retval - - } # ac_fn_c_try_compile - -@@ -1548,8 +1527,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 - fi -- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -- as_fn_set_status $ac_retval -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -+ return $ac_retval - - } # ac_fn_cxx_try_compile - -@@ -1574,7 +1553,7 @@ $as_echo "$ac_try_echo"; } >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; } > conftest.i && { -+ test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : -@@ -1585,8 +1564,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 - fi -- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -- as_fn_set_status $ac_retval -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -+ return $ac_retval - - } # ac_fn_c_try_cpp - -@@ -1598,10 +1577,10 @@ fi - ac_fn_c_check_header_mongrel () - { - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack -- if eval \${$3+:} false; then : -+ 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 eval \${$3+:} false; then : -+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - fi - eval ac_res=\$$3 -@@ -1637,7 +1616,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : - else - ac_header_preproc=no - fi --rm -f conftest.err conftest.i conftest.$ac_ext -+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; } - -@@ -1664,7 +1643,7 @@ $as_echo "$as_me: WARNING: $2: proceedin - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 - $as_echo_n "checking for $2... " >&6; } --if eval \${$3+:} false; then : -+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - else - eval "$3=\$ac_header_compiler" -@@ -1673,7 +1652,7 @@ 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; ${as_lineno_stack:+:} unset as_lineno -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - - } # ac_fn_c_check_header_mongrel - -@@ -1714,8 +1693,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=$ac_status - fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo -- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -- as_fn_set_status $ac_retval -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -+ return $ac_retval - - } # ac_fn_c_try_run - -@@ -1728,7 +1707,7 @@ 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 eval \${$3+:} false; then : -+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -1746,7 +1725,7 @@ 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; ${as_lineno_stack:+:} unset as_lineno -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - - } # ac_fn_c_check_header_compile - -@@ -1777,7 +1756,7 @@ $as_echo "$ac_try_echo"; } >&5 - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || -- test -x conftest$ac_exeext -+ $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 - else -@@ -1791,8 +1770,8 @@ fi - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo -- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -- as_fn_set_status $ac_retval -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -+ return $ac_retval - - } # ac_fn_c_try_link - -@@ -1804,7 +1783,7 @@ ac_fn_c_check_func () - 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 eval \${$3+:} false; then : -+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -1859,69 +1838,15 @@ 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; ${as_lineno_stack:+:} unset as_lineno -+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - - } # ac_fn_c_check_func -- --# ac_fn_c_check_type LINENO TYPE VAR INCLUDES --# ------------------------------------------- --# Tests whether TYPE exists after having included INCLUDES, setting cache --# variable VAR accordingly. --ac_fn_c_check_type () --{ -- 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 eval \${$3+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- eval "$3=no" -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --$4 --int --main () --{ --if (sizeof ($2)) -- return 0; -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --$4 --int --main () --{ --if (sizeof (($2))) -- return 0; -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- --else -- eval "$3=yes" --fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext --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; ${as_lineno_stack:+:} unset as_lineno -- --} # ac_fn_c_check_type - cat >config.log <<_ACEOF - This file contains any messages produced by compilers while - running configure, to aid debugging if configure makes a mistake. - - It was created by libphobos $as_me version-unused, which was --generated by GNU Autoconf 2.69. Invocation command line was -+generated by GNU Autoconf 2.64. Invocation command line was - - $ $0 $@ - -@@ -2031,9 +1956,11 @@ trap 'exit_status=$? - { - echo - -- $as_echo "## ---------------- ## -+ cat <<\_ASBOX -+## ---------------- ## - ## Cache variables. ## --## ---------------- ##" -+## ---------------- ## -+_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, - ( -@@ -2067,9 +1994,11 @@ $as_echo "$as_me: WARNING: cache variabl - ) - echo - -- $as_echo "## ----------------- ## -+ cat <<\_ASBOX -+## ----------------- ## - ## Output variables. ## --## ----------------- ##" -+## ----------------- ## -+_ASBOX - echo - for ac_var in $ac_subst_vars - do -@@ -2082,9 +2011,11 @@ $as_echo "$as_me: WARNING: cache variabl - echo - - if test -n "$ac_subst_files"; then -- $as_echo "## ------------------- ## -+ cat <<\_ASBOX -+## ------------------- ## - ## File substitutions. ## --## ------------------- ##" -+## ------------------- ## -+_ASBOX - echo - for ac_var in $ac_subst_files - do -@@ -2098,9 +2029,11 @@ $as_echo "$as_me: WARNING: cache variabl - fi - - if test -s confdefs.h; then -- $as_echo "## ----------- ## -+ cat <<\_ASBOX -+## ----------- ## - ## confdefs.h. ## --## ----------- ##" -+## ----------- ## -+_ASBOX - echo - cat confdefs.h - echo -@@ -2155,12 +2088,7 @@ _ACEOF - ac_site_file1=NONE - ac_site_file2=NONE - if test -n "$CONFIG_SITE"; then -- # We do not want a PATH search for config.site. -- case $CONFIG_SITE in #(( -- -*) ac_site_file1=./$CONFIG_SITE;; -- */*) ac_site_file1=$CONFIG_SITE;; -- *) ac_site_file1=./$CONFIG_SITE;; -- esac -+ ac_site_file1=$CONFIG_SITE - elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -@@ -2171,22 +2099,18 @@ fi - for ac_site_file in "$ac_site_file1" "$ac_site_file2" - do - test "x$ac_site_file" = xNONE && continue -- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then -+ if test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 - $as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 -- . "$ac_site_file" \ -- || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "failed to load site script $ac_site_file --See \`config.log' for more details" "$LINENO" 5; } -+ . "$ac_site_file" - fi - done - - if test -r "$cache_file"; then -- # Some versions of bash will fail to source /dev/null (special files -- # actually), so we avoid doing that. DJGPP emulates it as a regular file. -- if test /dev/null != "$cache_file" && test -f "$cache_file"; then -+ # Some versions of bash will fail to source /dev/null (special -+ # files actually), so we avoid doing that. -+ if test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 - $as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in -@@ -2255,7 +2179,7 @@ if $ac_cache_corrupted; then - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 - $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} -- as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -+ as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 - fi - ## -------------------- ## - ## Main body of script. ## -@@ -2276,22 +2200,16 @@ ac_config_headers="$ac_config_headers co - - ac_aux_dir= - for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do -- if test -f "$ac_dir/install-sh"; then -- ac_aux_dir=$ac_dir -- ac_install_sh="$ac_aux_dir/install-sh -c" -- break -- elif test -f "$ac_dir/install.sh"; then -- ac_aux_dir=$ac_dir -- ac_install_sh="$ac_aux_dir/install.sh -c" -- break -- elif test -f "$ac_dir/shtool"; then -- ac_aux_dir=$ac_dir -- ac_install_sh="$ac_aux_dir/shtool install -c" -- break -- fi -+ for ac_t in install-sh install.sh shtool; do -+ if test -f "$ac_dir/$ac_t"; then -+ ac_aux_dir=$ac_dir -+ ac_install_sh="$ac_aux_dir/$ac_t -c" -+ break 2 -+ fi -+ done - done - if test -z "$ac_aux_dir"; then -- as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -+ as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 - fi - - # These three variables are undocumented and unsupported, -@@ -2305,27 +2223,27 @@ ac_configure="$SHELL $ac_aux_dir/configu - - # Make sure we can run config.sub. - $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || -- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 -+ as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 - $as_echo_n "checking build system type... " >&6; } --if ${ac_cv_build+:} false; then : -+if test "${ac_cv_build+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_build_alias=$build_alias - test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` - test "x$ac_build_alias" = x && -- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -+ as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 - ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || -- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 -+ as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 - $as_echo "$ac_cv_build" >&6; } - case $ac_cv_build in - *-*-*) ;; --*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; - esac - build=$ac_cv_build - ac_save_IFS=$IFS; IFS='-' -@@ -2343,14 +2261,14 @@ case $build_os in *\ *) build_os=`echo " - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 - $as_echo_n "checking host system type... " >&6; } --if ${ac_cv_host+:} false; then : -+if test "${ac_cv_host+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build - else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || -- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -+ as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 - fi - - fi -@@ -2358,7 +2276,7 @@ fi - $as_echo "$ac_cv_host" >&6; } - case $ac_cv_host in - *-*-*) ;; --*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; - esac - host=$ac_cv_host - ac_save_IFS=$IFS; IFS='-' -@@ -2376,14 +2294,14 @@ case $host_os in *\ *) host_os=`echo "$h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 - $as_echo_n "checking target system type... " >&6; } --if ${ac_cv_target+:} false; then : -+if test "${ac_cv_target+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host - else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || -- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -+ as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 - fi - - fi -@@ -2391,7 +2309,7 @@ fi - $as_echo "$ac_cv_target" >&6; } - case $ac_cv_target in - *-*-*) ;; --*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; - esac - target=$ac_cv_target - ac_save_IFS=$IFS; IFS='-' -@@ -2436,7 +2354,7 @@ am__api_version='1.11' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 - $as_echo_n "checking for a BSD-compatible install... " >&6; } - if test -z "$INSTALL"; then --if ${ac_cv_path_install+:} false; then : -+if test "${ac_cv_path_install+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -@@ -2456,7 +2374,7 @@ case $as_dir/ in #(( - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. -@@ -2523,11 +2441,11 @@ am_lf=' - ' - case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) -- as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -+ as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; - esac - case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) -- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -+ as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; - esac - - # Do `set' in a subshell so we don't clobber the current shell's -@@ -2549,7 +2467,7 @@ if ( - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". -- as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -+ as_fn_error "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - -@@ -2559,7 +2477,7 @@ then - # Ok. - : - else -- as_fn_error $? "newly created file is older than distributed files! -+ as_fn_error "newly created file is older than distributed files! - Check your system clock" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -@@ -2613,7 +2531,7 @@ if test "$cross_compiling" != no; then - set dummy ${ac_tool_prefix}strip; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_STRIP+:} false; then : -+if test "${ac_cv_prog_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$STRIP"; then -@@ -2625,7 +2543,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -2653,7 +2571,7 @@ if test -z "$ac_cv_prog_STRIP"; then - set dummy strip; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_ac_ct_STRIP+:} false; then : -+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$ac_ct_STRIP"; then -@@ -2665,7 +2583,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -2706,7 +2624,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 - $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } - if test -z "$MKDIR_P"; then -- if ${ac_cv_path_mkdir+:} false; then : -+ if test "${ac_cv_path_mkdir+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -@@ -2716,7 +2634,7 @@ do - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do -- as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue -+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ -@@ -2731,7 +2649,6 @@ IFS=$as_save_IFS - - fi - -- test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else -@@ -2739,6 +2656,7 @@ fi - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. -+ test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi - fi -@@ -2757,7 +2675,7 @@ do - set dummy $ac_prog; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_AWK+:} false; then : -+if test "${ac_cv_prog_AWK+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$AWK"; then -@@ -2769,7 +2687,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -2797,7 +2715,7 @@ done - $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } - set x ${MAKE-make} - ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` --if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : -+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - else - cat >conftest.make <<\_ACEOF -@@ -2805,7 +2723,7 @@ SHELL = /bin/sh - all: - @echo '@@@%%%=$(MAKE)=@@@%%%' - _ACEOF --# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -+# GNU make sometimes prints "make[1]: Entering...", which would confuse us. - case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; -@@ -2839,7 +2757,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`" - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then -- as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 -+ as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi - fi - -@@ -2904,7 +2822,7 @@ if test "${enable_multilib+set}" = set; - enableval=$enable_multilib; case "$enableval" in - yes) multilib=yes ;; - no) multilib=no ;; -- *) as_fn_error $? "bad value $enableval for multilib option" "$LINENO" 5 ;; -+ *) as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;; - esac - else - multilib=yes -@@ -2997,7 +2915,7 @@ if test -n "$ac_tool_prefix"; then - set dummy ${ac_tool_prefix}gcc; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_CC+:} false; then : -+if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$CC"; then -@@ -3009,7 +2927,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3037,7 +2955,7 @@ if test -z "$ac_cv_prog_CC"; then - set dummy gcc; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_ac_ct_CC+:} false; then : -+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$ac_ct_CC"; then -@@ -3049,7 +2967,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3090,7 +3008,7 @@ if test -z "$CC"; then - set dummy ${ac_tool_prefix}cc; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_CC+:} false; then : -+if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$CC"; then -@@ -3102,7 +3020,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3130,7 +3048,7 @@ if test -z "$CC"; then - set dummy cc; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_CC+:} false; then : -+if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$CC"; then -@@ -3143,7 +3061,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue -@@ -3189,7 +3107,7 @@ if test -z "$CC"; then - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_CC+:} false; then : -+if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$CC"; then -@@ -3201,7 +3119,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3233,7 +3151,7 @@ do - set dummy $ac_prog; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_ac_ct_CC+:} false; then : -+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$ac_ct_CC"; then -@@ -3245,7 +3163,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3287,8 +3205,8 @@ fi - - test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "no acceptable C compiler found in \$PATH --See \`config.log' for more details" "$LINENO" 5; } -+as_fn_error "no acceptable C compiler found in \$PATH -+See \`config.log' for more details." "$LINENO" 5; } - - # Provide some information about the compiler. - $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -@@ -3309,30 +3227,32 @@ $as_echo "$ac_try_echo"; } >&5 - ... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 -+ rm -f conftest.er1 conftest.err - fi -- rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - done - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ -- -+#include <stdio.h> - int - main () - { -+FILE *f = fopen ("conftest.out", "w"); -+ return ferror (f) || fclose (f) != 0; - - ; - return 0; - } - _ACEOF - ac_clean_files_save=$ac_clean_files --ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" - # Try to create an executable without -o first, disregard a.out. - # It will help us diagnose broken compilers, and finding out an intuition - # of exeext. --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 --$as_echo_n "checking whether the C compiler works... " >&6; } -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -+$as_echo_n "checking for C compiler default output file name... " >&6; } - ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - - # The possible output files: -@@ -3394,28 +3314,62 @@ test "$ac_cv_exeext" = no && ac_cv_exeex - else - ac_file='' - fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -+$as_echo "$ac_file" >&6; } - if test -z "$ac_file"; then : -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } --$as_echo "$as_me: failed program was:" >&5 -+ $as_echo "$as_me: failed program was:" >&5 - sed 's/^/| /' conftest.$ac_ext >&5 - - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error 77 "C compiler cannot create executables --See \`config.log' for more details" "$LINENO" 5; } --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --$as_echo "yes" >&6; } -+{ as_fn_set_status 77 -+as_fn_error "C compiler cannot create executables -+See \`config.log' for more details." "$LINENO" 5; }; } - fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 --$as_echo_n "checking for C compiler default output file name... " >&6; } --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 --$as_echo "$ac_file" >&6; } - ac_exeext=$ac_cv_exeext - --rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -+# Check that the compiler produces executables we can run. If not, either -+# the compiler is broken, or we cross compile. -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -+$as_echo_n "checking whether the C compiler works... " >&6; } -+# If not cross compiling, check that we can run a simple program. -+if test "$cross_compiling" != yes; then -+ if { ac_try='./$ac_file' -+ { { 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 -+ cross_compiling=no -+ else -+ if test "$cross_compiling" = maybe; then -+ cross_compiling=yes -+ else -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -+as_fn_error "cannot run C compiled programs. -+If you meant to cross compile, use \`--host'. -+See \`config.log' for more details." "$LINENO" 5; } -+ fi -+ fi -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -+$as_echo "yes" >&6; } -+ -+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out - ac_clean_files=$ac_clean_files_save -+# Check that the compiler produces executables we can run. If not, either -+# the compiler is broken, or we cross compile. -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -+$as_echo_n "checking whether we are cross compiling... " >&6; } -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -+$as_echo "$cross_compiling" >&6; } -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 - $as_echo_n "checking for suffix of executables... " >&6; } - if { { ac_try="$ac_link" -@@ -3445,78 +3399,19 @@ done - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "cannot compute suffix of executables: cannot compile and link --See \`config.log' for more details" "$LINENO" 5; } -+as_fn_error "cannot compute suffix of executables: cannot compile and link -+See \`config.log' for more details." "$LINENO" 5; } - fi --rm -f conftest conftest$ac_cv_exeext -+rm -f conftest$ac_cv_exeext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 - $as_echo "$ac_cv_exeext" >&6; } - - rm -f conftest.$ac_ext - EXEEXT=$ac_cv_exeext - ac_exeext=$EXEEXT --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include <stdio.h> --int --main () --{ --FILE *f = fopen ("conftest.out", "w"); -- return ferror (f) || fclose (f) != 0; -- -- ; -- return 0; --} --_ACEOF --ac_clean_files="$ac_clean_files conftest.out" --# Check that the compiler produces executables we can run. If not, either --# the compiler is broken, or we cross compile. --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 --$as_echo_n "checking whether we are cross compiling... " >&6; } --if test "$cross_compiling" != yes; then -- { { ac_try="$ac_link" --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_link") 2>&5 -- ac_status=$? -- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -- test $ac_status = 0; } -- if { ac_try='./conftest$ac_cv_exeext' -- { { 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 -- cross_compiling=no -- else -- if test "$cross_compiling" = maybe; then -- cross_compiling=yes -- else -- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "cannot run C compiled programs. --If you meant to cross compile, use \`--host'. --See \`config.log' for more details" "$LINENO" 5; } -- fi -- fi --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 --$as_echo "$cross_compiling" >&6; } -- --rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out --ac_clean_files=$ac_clean_files_save - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 - $as_echo_n "checking for suffix of object files... " >&6; } --if ${ac_cv_objext+:} false; then : -+if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -3556,8 +3451,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 - - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "cannot compute suffix of object files: cannot compile --See \`config.log' for more details" "$LINENO" 5; } -+as_fn_error "cannot compute suffix of object files: cannot compile -+See \`config.log' for more details." "$LINENO" 5; } - fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext - fi -@@ -3567,7 +3462,7 @@ OBJEXT=$ac_cv_objext - ac_objext=$OBJEXT - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 - $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } --if ${ac_cv_c_compiler_gnu+:} false; then : -+if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -3604,7 +3499,7 @@ ac_test_CFLAGS=${CFLAGS+set} - ac_save_CFLAGS=$CFLAGS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 - $as_echo_n "checking whether $CC accepts -g... " >&6; } --if ${ac_cv_prog_cc_g+:} false; then : -+if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_save_c_werror_flag=$ac_c_werror_flag -@@ -3682,7 +3577,7 @@ else - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 - $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } --if ${ac_cv_prog_cc_c89+:} false; then : -+if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_cv_prog_cc_c89=no -@@ -3691,7 +3586,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ - /* end confdefs.h. */ - #include <stdarg.h> - #include <stdio.h> --struct stat; -+#include <sys/types.h> -+#include <sys/stat.h> - /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ - struct buf { int x; }; - FILE * (*rcsopen) (struct buf *, struct stat *, int); -@@ -3792,7 +3688,7 @@ if test -z "$CXX"; then - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${glibcxx_cv_prog_CXX+:} false; then : -+if test "${glibcxx_cv_prog_CXX+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$CXX"; then -@@ -3804,7 +3700,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - glibcxx_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3836,7 +3732,7 @@ do - set dummy $ac_prog; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_ac_ct_CXX+:} false; then : -+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$ac_ct_CXX"; then -@@ -3848,7 +3744,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -3906,15 +3802,15 @@ $as_echo "$ac_try_echo"; } >&5 - ... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 -+ rm -f conftest.er1 conftest.err - fi -- rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 - $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } --if ${ac_cv_cxx_compiler_gnu+:} false; then : -+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -3951,7 +3847,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} - ac_save_CXXFLAGS=$CXXFLAGS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 - $as_echo_n "checking whether $CXX accepts -g... " >&6; } --if ${ac_cv_prog_cxx_g+:} false; then : -+if test "${ac_cv_prog_cxx_g+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag -@@ -4049,7 +3945,7 @@ else - set dummy ${ac_tool_prefix}ranlib; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_RANLIB+:} false; then : -+if test "${ac_cv_prog_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$RANLIB"; then -@@ -4061,7 +3957,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -4089,7 +3985,7 @@ if test -z "$ac_cv_prog_RANLIB"; then - set dummy ranlib; ac_word=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 - $as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : -+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -n "$ac_ct_RANLIB"; then -@@ -4101,7 +3997,7 @@ do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 -@@ -4142,7 +4038,7 @@ fi - $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } - set x ${MAKE-make} - ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` --if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : -+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 - else - cat >conftest.make <<\_ACEOF -@@ -4150,7 +4046,7 @@ SHELL = /bin/sh - all: - @echo '@@@%%%=$(MAKE)=@@@%%%' - _ACEOF --# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -+# GNU make sometimes prints "make[1]: Entering...", which would confuse us. - case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; -@@ -4206,7 +4102,7 @@ fi - # Check whether --enable-phobos-config-dir was given. - if test "${enable_phobos_config_dir+set}" = set; then : - enableval=$enable_phobos_config_dir; if test -z "${enableval}"; then -- as_fn_error $? "must specify a value for --enable-phobos-config-dir" "$LINENO" 5 -+ as_fn_error "must specify a value for --enable-phobos-config-dir" "$LINENO" 5 - fi - else - : -@@ -4221,11 +4117,6 @@ fi - - d_target_os=`echo $target_os | sed 's/^\(A-Za-z_+\)/\1/'` - --# SkyOS uses i386-skyos-pe --case "$target" in --*-skyos*-pe*) d_target_os=skyos ;; --esac -- - GDC=$CC - GDC=`echo $CC | sed s/xgcc/gdc/` - -@@ -4241,7 +4132,7 @@ $as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 - $as_echo "no" >&6; } -- as_fn_error $? "can't compile D sources!" "$LINENO" 5 -+ as_fn_error "can't compile D sources!" "$LINENO" 5 - fi - - -@@ -4279,7 +4170,7 @@ while test "$d_count" != 'xxx'; do - done - - if test ! -f "$BUILD_LIBIBERTY"; then -- as_fn_error $? "cannot find libiberty.a for build" "$LINENO" 5 -+ as_fn_error "cannot find libiberty.a for build" "$LINENO" 5 - fi - - #used in druntime, so srcdir is 'libphobos/libdruntime' -@@ -4294,7 +4185,32 @@ BUILD_LIBIBERTY="../$BUILD_LIBIBERTY" - # include dir .. need to support --enable-version-specific.. but - # will have to modify gcc/configure.ac .. - # For now, basic workaround for cross compilers .. --if test "${host}" != "${build}"; then -+# To really mirror the check in Make-lang.in we need to access the -+# host/target of the compiler. The libphobos 'host' and 'target' variables -+# are always equal (and are the same as the compilers target) -+d_count="" -+d_pkgvars_prefix=../.. -+while test "$d_count" != 'xxx'; do -+ d_pkgvars=$d_pkgvars_prefix/gcc/d/pkgvars -+ if test -f $d_pkgvars; then -+ break -+ fi -+ -+ d_pkgvars_prefix=../$d_pkgvars_prefix -+ d_count="x$d_count" -+done -+ -+if test -f "${d_pkgvars}"; then -+ gdc_host=`grep "host=" "${d_pkgvars}" | sed -e 's|host=||'` -+ gdc_target=`grep "target=" "${d_pkgvars}" | sed -e 's|target=||'` -+else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find pkgvars file to determine compiler host/target" >&5 -+$as_echo "$as_me: WARNING: Cannot find pkgvars file to determine compiler host/target" >&2;} -+ gdc_host=${build} -+ gdc_target=${host} -+fi -+ -+if test "${gdc_host}" != "${gdc_target}"; then - gdc_include_dir='${libdir}/gcc/${host_alias}'/${d_gcc_ver}/include/d - else - gdc_include_dir='${prefix}'/include/d/${d_gcc_ver} -@@ -4338,7 +4254,7 @@ if test -n "$CPP" && test -d "$CPP"; the - CPP= - fi - if test -z "$CPP"; then -- if ${ac_cv_prog_CPP+:} false; then : -+ if test "${ac_cv_prog_CPP+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - # Double quotes because CPP needs to be expanded -@@ -4368,7 +4284,7 @@ else - # Broken: fails on valid input. - continue - fi --rm -f conftest.err conftest.i 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. -@@ -4384,11 +4300,11 @@ else - ac_preproc_ok=: - break - fi --rm -f conftest.err conftest.i conftest.$ac_ext -+rm -f conftest.err conftest.$ac_ext - - done - # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. --rm -f conftest.i conftest.err conftest.$ac_ext -+rm -f conftest.err conftest.$ac_ext - if $ac_preproc_ok; then : - break - fi -@@ -4427,7 +4343,7 @@ else - # Broken: fails on valid input. - continue - fi --rm -f conftest.err conftest.i 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. -@@ -4443,18 +4359,18 @@ else - ac_preproc_ok=: - break - fi --rm -f conftest.err conftest.i conftest.$ac_ext -+rm -f conftest.err conftest.$ac_ext - - done - # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. --rm -f conftest.i conftest.err conftest.$ac_ext -+rm -f conftest.err conftest.$ac_ext - if $ac_preproc_ok; then : - - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 - $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "C preprocessor \"$CPP\" fails sanity check --See \`config.log' for more details" "$LINENO" 5; } -+as_fn_error "C preprocessor \"$CPP\" fails sanity check -+See \`config.log' for more details." "$LINENO" 5; } - fi - - ac_ext=c -@@ -4466,7 +4382,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $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 ${ac_cv_path_GREP+:} false; then : -+if test "${ac_cv_path_GREP+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - if test -z "$GREP"; then -@@ -4480,7 +4396,7 @@ do - 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" -- as_fn_executable_p "$ac_path_GREP" || continue -+ { 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 -@@ -4515,7 +4431,7 @@ esac - 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 -+ as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi - else - ac_cv_path_GREP=$GREP -@@ -4529,7 +4445,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 - $as_echo_n "checking for egrep... " >&6; } --if ${ac_cv_path_EGREP+:} false; then : -+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 -@@ -4546,7 +4462,7 @@ do - 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" -- as_fn_executable_p "$ac_path_EGREP" || continue -+ { 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 -@@ -4581,7 +4497,7 @@ esac - 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 -+ 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 -@@ -4596,7 +4512,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } - - { $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 ${ac_cv_header_stdc+:} false; then : -+if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -@@ -4713,7 +4629,8 @@ 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 - " --if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : -+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 -@@ -4724,13 +4641,160 @@ done - - - ac_fn_c_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" --if test "x$ac_cv_header_stdio_h" = xyes; then : -+if test "x$ac_cv_header_stdio_h" = x""yes; then : - : - else -- as_fn_error $? "cannot find stdio.h." "$LINENO" 5 -+ as_fn_error "cannot find stdio.h." "$LINENO" 5 -+fi -+ -+ -+ -+ -+HAVE_DLADDR=false -+ac_fn_c_check_func "$LINENO" "dladdr" "ac_cv_func_dladdr" -+if test "x$ac_cv_func_dladdr" = x""yes; then : -+ HAVE_DLADDR=true -+fi -+ -+ -+ -+BACKTRACE_SUPPORTED=false -+BACKTRACE_USES_MALLOC=false -+BACKTRACE_SUPPORTS_THREADS=false -+LIBBACKTRACE_LIB="" -+ -+CPPFLAGS+=" -I../libbacktrace " -+ -+# Check whether --enable-libbacktrace was given. -+if test "${enable_libbacktrace+set}" = set; then : -+ enableval=$enable_libbacktrace; check_libbacktrace_h="$enableval" -+else -+ check_libbacktrace_h="yes" -+fi -+ -+ -+if test $check_libbacktrace_h = yes ; then -+ ac_fn_c_check_header_mongrel "$LINENO" "backtrace-supported.h" "ac_cv_header_backtrace_supported_h" "$ac_includes_default" -+if test "x$ac_cv_header_backtrace_supported_h" = x""yes; then : -+ have_libbacktrace_h=true -+else -+ have_libbacktrace_h=false - fi - - -+else -+ have_libbacktrace_h=false -+fi -+ -+if $have_libbacktrace_h; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking libbacktrace: BACKTRACE_SUPPORTED" >&5 -+$as_echo_n "checking libbacktrace: BACKTRACE_SUPPORTED... " >&6; } -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_SUPPORTED -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "FOUND_LIBBACKTRACE_RESULT_GDC" >/dev/null 2>&1; then : -+ BACKTRACE_SUPPORTED=true -+else -+ BACKTRACE_SUPPORTED=false -+fi -+rm -f conftest* -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BACKTRACE_SUPPORTED" >&5 -+$as_echo "$BACKTRACE_SUPPORTED" >&6; } -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking libbacktrace: BACKTRACE_USES_MALLOC" >&5 -+$as_echo_n "checking libbacktrace: BACKTRACE_USES_MALLOC... " >&6; } -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_USES_MALLOC -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "FOUND_LIBBACKTRACE_RESULT_GDC" >/dev/null 2>&1; then : -+ BACKTRACE_USES_MALLOC=true -+else -+ BACKTRACE_USES_MALLOC=false -+fi -+rm -f conftest* -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BACKTRACE_USES_MALLOC" >&5 -+$as_echo "$BACKTRACE_USES_MALLOC" >&6; } -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking libbacktrace: BACKTRACE_SUPPORTS_THREADS" >&5 -+$as_echo_n "checking libbacktrace: BACKTRACE_SUPPORTS_THREADS... " >&6; } -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_SUPPORTS_THREADS -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "FOUND_LIBBACKTRACE_RESULT_GDC" >/dev/null 2>&1; then : -+ BACKTRACE_SUPPORTS_THREADS=true -+else -+ BACKTRACE_SUPPORTS_THREADS=false -+fi -+rm -f conftest* -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BACKTRACE_SUPPORTS_THREADS" >&5 -+$as_echo "$BACKTRACE_SUPPORTS_THREADS" >&6; } -+fi -+ -+ if $BACKTRACE_SUPPORTED; then -+ BACKTRACE_SUPPORTED_TRUE= -+ BACKTRACE_SUPPORTED_FALSE='#' -+else -+ BACKTRACE_SUPPORTED_TRUE='#' -+ BACKTRACE_SUPPORTED_FALSE= -+fi -+ -+ -+if $BACKTRACE_SUPPORTED; then -+ LIBBACKTRACE_LIB="../../libbacktrace/.libs/libbacktrace.a" -+else -+ LIBBACKTRACE_LIB="" -+fi -+ -+ -+ -+ -+ -+ -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread model used by GDC" >&5 -+$as_echo_n "checking for thread model used by GDC... " >&6; } -+d_thread_model=`$GDC -v 2>&1 | sed -n 's/^Thread model: //p'` -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $d_thread_model" >&5 -+$as_echo "$d_thread_model" >&6; } -+ -+# Map from thread model to thread interface. -+ -+case $d_thread_model in -+ aix) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ lynx) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ posix) DCFG_THREAD_MODEL="GNU_Thread_Posix" ;; -+ single) DCFG_THREAD_MODEL="GNU_Thread_Single" ;; -+ win32) DCFG_THREAD_MODEL="GNU_Thread_Win32" ;; -+ # TODO: These targets need porting. -+ dce|mipssde|rtems|tpf|vxworks) -+ DCFG_THREAD_MODEL="GNU_Thread_Single" ;; -+ *) as_fn_error "Thread implementation '$d_thread_model' not recognised" "$LINENO" 5 ;; -+esac -+ -+ - - # TODO... - -@@ -4743,7 +4807,7 @@ if test "$with_newlib" = no; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5 - $as_echo_n "checking for cos in -lm... " >&6; } --if ${ac_cv_lib_m_cos+:} false; then : -+if test "${ac_cv_lib_m_cos+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS -@@ -4777,7 +4841,7 @@ LIBS=$ac_check_lib_save_LIBS - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5 - $as_echo "$ac_cv_lib_m_cos" >&6; } --if test "x$ac_cv_lib_m_cos" = xyes; then : -+if test "x$ac_cv_lib_m_cos" = x""yes; then : - cat >>confdefs.h <<_ACEOF - #define HAVE_LIBM 1 - _ACEOF -@@ -4790,7 +4854,7 @@ fi - case "$d_target_os" in - aix*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrtf in -lC" >&5 - $as_echo_n "checking for sqrtf in -lC... " >&6; } --if ${ac_cv_lib_C_sqrtf+:} false; then : -+if test "${ac_cv_lib_C_sqrtf+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS -@@ -4824,7 +4888,7 @@ LIBS=$ac_check_lib_save_LIBS - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_C_sqrtf" >&5 - $as_echo "$ac_cv_lib_C_sqrtf" >&6; } --if test "x$ac_cv_lib_C_sqrtf" = xyes; then : -+if test "x$ac_cv_lib_C_sqrtf" = x""yes; then : - cat >>confdefs.h <<_ACEOF - #define HAVE_LIBC 1 - _ACEOF -@@ -4841,7 +4905,7 @@ case "$target_os" in - powerpc*) - # Libc without nldbl not supported... - ac_fn_c_check_func "$LINENO" "__nldbl_printf" "ac_cv_func___nldbl_printf" --if test "x$ac_cv_func___nldbl_printf" = xyes; then : -+if test "x$ac_cv_func___nldbl_printf" = x""yes; then : - d_have_nldbl_funcs=1 - else - : -@@ -4939,13 +5003,14 @@ for ac_func in snprintf _snprintf - do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` - ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" --if eval test \"x\$"$as_ac_var"\" = x"yes"; then : -+eval as_val=\$$as_ac_var -+ if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF - #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 - _ACEOF - break - else -- as_fn_error $? "No variant of snprintf." "$LINENO" 5 -+ as_fn_error "No variant of snprintf." "$LINENO" 5 - fi - done - -@@ -4953,13 +5018,14 @@ for ac_func in vsnprintf _vsnprintf - do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` - ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" --if eval test \"x\$"$as_ac_var"\" = x"yes"; then : -+eval as_val=\$$as_ac_var -+ if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF - #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 - _ACEOF - break - else -- as_fn_error $? "No variant of vsnprintf." "$LINENO" 5 -+ as_fn_error "No variant of vsnprintf." "$LINENO" 5 - fi - done - -@@ -4988,16 +5054,25 @@ if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 - $as_echo "no" >&6; } - DCFG_ARM_EABI_UNWINDER="" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind_generic.o" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind/generic.o" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 - $as_echo "yes" >&6; } - DCFG_ARM_EABI_UNWINDER="GNU_ARM_EABI_Unwinder" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind_arm.o" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind/arm.o" - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -+case "$d_thread_model" in -+ posix) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/posix.o" -+ ;; -+ win32) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/win32.o" -+ ;; -+ *) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/single.o" -+ ;; -+esac -+ - case "$d_target_os" in - aix*|*bsd*|cygwin*|darwin*|gnu*|linux*|skyos*|*solaris*|sysv*) d_have_unix=1 ;; - esac -@@ -5012,8 +5087,8 @@ fi - case "$d_target_os" in - aix*) d_is_aix=1 - ;; -- darwin*) d_module_mach=1 -- d_sem_impl="mach" -+ darwin*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_OSX_OBJS)" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)" - ;; - freebsd*|k*bsd*-gnu) - DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -@@ -5022,7 +5097,6 @@ case "$d_target_os" in - ;; - linux*) #D_EXTRA_OBJS="$D_EXTRA_OBJS std/c/linux/linux.o" - D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)" -- d_sem_impl="posix" - ;; - cygwin*) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" - DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -@@ -5035,10 +5109,6 @@ case "$d_target_os" in - #DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" - DCFG_UNIX=Windows - ;; -- skyos*) d_sem_impl="skyos" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- ;; - *) if test "$enable_unix" != "yes"; then - DCFG_UNIX=NoSystem - fi -@@ -5047,256 +5117,22 @@ case "$d_target_os" in - ;; - esac - --if test -n "$d_module_mach"; then -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_OSX_OBJS)" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)" --fi -- - if test "$enable_unix" = "yes"; then - DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)" - DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_POSIX_OBJS)" - D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OS_OBJS)" - -- --for ac_header in pthread.h --do : -- ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" --if test "x$ac_cv_header_pthread_h" = xyes; then : -- cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_H 1 --_ACEOF -- : --else -- as_fn_error $? "can't find pthread.h. Pthreads is the only supported thread library." "$LINENO" 5 --fi -- --done -- -- --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recursive mutex name" >&5 --$as_echo_n "checking for recursive mutex name... " >&6; } --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ --#include <pthread.h> --int --main () --{ -- --pthread_mutexattr_t attr; --pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -- --$as_echo "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h -- -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: PTHREAD_MUTEX_RECURSIVE" >&5 --$as_echo "PTHREAD_MUTEX_RECURSIVE" >&6; } --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: PTHREAD_MUTEX_RECURSIVE_NP" >&5 --$as_echo "PTHREAD_MUTEX_RECURSIVE_NP" >&6; } --fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -- --ac_fn_c_check_type "$LINENO" "pthread_barrier_t" "ac_cv_type_pthread_barrier_t" "#include <pthread.h> --" --if test "x$ac_cv_type_pthread_barrier_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_BARRIER_T 1 --_ACEOF -- -- --fi --ac_fn_c_check_type "$LINENO" "pthread_barrierattr_t" "ac_cv_type_pthread_barrierattr_t" "#include <pthread.h> --" --if test "x$ac_cv_type_pthread_barrierattr_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_BARRIERATTR_T 1 --_ACEOF -- -- --fi --ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include <pthread.h> --" --if test "x$ac_cv_type_pthread_rwlock_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_RWLOCK_T 1 --_ACEOF -- -- --fi --ac_fn_c_check_type "$LINENO" "pthread_rwlockattr_t" "ac_cv_type_pthread_rwlockattr_t" "#include <pthread.h> --" --if test "x$ac_cv_type_pthread_rwlockattr_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_RWLOCKATTR_T 1 --_ACEOF -- -- --fi --ac_fn_c_check_type "$LINENO" "pthread_spinlock_t" "ac_cv_type_pthread_spinlock_t" "#include <pthread.h> --" --if test "x$ac_cv_type_pthread_spinlock_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_PTHREAD_SPINLOCK_T 1 --_ACEOF -- -- --fi -- -- --ac_fn_c_check_type "$LINENO" "clockid_t" "ac_cv_type_clockid_t" "#include <pthread.h> --" --if test "x$ac_cv_type_clockid_t" = xyes; then : -- --cat >>confdefs.h <<_ACEOF --#define HAVE_CLOCKID_T 1 --_ACEOF -- -- --fi -- -- --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 --$as_echo_n "checking for library containing sem_init... " >&6; } --if ${ac_cv_search_sem_init+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_func_search_save_LIBS=$LIBS --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --/* Override any GCC internal prototype to avoid an error. -- Use char because int might match the return type of a GCC -- builtin and then its argument prototype would still apply. */ --#ifdef __cplusplus --extern "C" --#endif --char sem_init (); --int --main () --{ --return sem_init (); -- ; -- return 0; --} --_ACEOF --for ac_lib in '' pthread rt posix4; do -- if test -z "$ac_lib"; then -- ac_res="none required" -- else -- ac_res=-l$ac_lib -- LIBS="-l$ac_lib $ac_func_search_save_LIBS" -- fi -- if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_search_sem_init=$ac_res --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext -- if ${ac_cv_search_sem_init+:} false; then : -- break --fi --done --if ${ac_cv_search_sem_init+:} false; then : -- --else -- ac_cv_search_sem_init=no --fi --rm conftest.$ac_ext --LIBS=$ac_func_search_save_LIBS --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sem_init" >&5 --$as_echo "$ac_cv_search_sem_init" >&6; } --ac_res=$ac_cv_search_sem_init --if test "$ac_res" != no; then : -- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -- --fi -- -- --for ac_header in semaphore.h --do : -- ac_fn_c_check_header_mongrel "$LINENO" "semaphore.h" "ac_cv_header_semaphore_h" "$ac_includes_default" --if test "x$ac_cv_header_semaphore_h" = xyes; then : -- cat >>confdefs.h <<_ACEOF --#define HAVE_SEMAPHORE_H 1 --_ACEOF -- --fi -- --done -- --ac_fn_c_check_func "$LINENO" "sem_init" "ac_cv_func_sem_init" --if test "x$ac_cv_func_sem_init" = xyes; then : -- --fi -- --ac_fn_c_check_func "$LINENO" "semaphore_create" "ac_cv_func_semaphore_create" --if test "x$ac_cv_func_semaphore_create" = xyes; then : -- --fi -- --ac_fn_c_check_func "$LINENO" "pthread_cond_wait" "ac_cv_func_pthread_cond_wait" --if test "x$ac_cv_func_pthread_cond_wait" = xyes; then : -- --fi -- -- --if test -z "$d_sem_impl"; then -- # Probably need to test what actually works. sem_init is defined -- # on AIX and Darwin but does not actually work. -- # For now, test for Mach semaphores first so it overrides Posix. AIX -- # is a special case. -- if test "$ac_cv_func_semaphore_create" = "yes"; then -- d_sem_impl="mach" -- elif test "$ac_cv_func_sem_init" = "yes" && \ -- test "$ac_cv_header_semaphore_h" = "yes" && \ -- test -z "$d_is_aix"; then -- d_sem_impl="posix" -- elif test "$ac_cv_func_pthread_cond_wait" = "yes"; then -- d_sem_impl="pthreads" -- fi --fi -- -- --case "$d_sem_impl" in -- posix) DCFG_SEMAPHORE_IMPL="GNU_Semaphore_POSIX" ;; -- mach) DCFG_SEMAPHORE_IMPL="GNU_Semaphore_Mach" -- d_module_mach=1 ;; -- pthreads) DCFG_SEMAPHORE_IMPL="GNU_Sempahore_Pthreads" ;; -- skyos) DCFG_SEMAPHORE_IMPL="GNU_Sempahore_Pthreads" -- D_EXTRA_OBJS="$D_EXTRA_OBJS std/c/skyos/compat.o" -- ;; -- *) as_fn_error $? "No usable semaphore implementation" "$LINENO" 5 ;; --esac -- -- --$as_echo "#define PHOBOS_USE_PTHREADS 1" >>confdefs.h -- -- -- - # Add "linux" module for compatibility even if not Linux - D_EXTRA_OBJS="std/c/linux/linux.o $D_EXTRA_OBJS" - DCFG_UNIX="Unix" - DCFG_POSIX="Posix" - -- - fi - - - - - -- -- -- - if test -z "$DFLAGS"; then - DFLAGS="-Wall -g -frelease -O2" - fi -@@ -5325,7 +5161,7 @@ done - D_GC_MODULES= - - if test "$enable_druntime_gc" = "yes"; then -- D_GC_MODULES="gc/gc.o gc/gcalloc.o gc/gcbits.o gc/gcstats.o gc/gcx.o" -+ D_GC_MODULES="gc/bits.o gc/gc.o gc/os.o gc/proxy.o gc/stats.o" - else - D_GC_MODULES="gcstub/gc.o" - fi -@@ -5337,7 +5173,7 @@ ZLIB_OBJS= - if test "$system_zlib" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 - $as_echo_n "checking for deflate in -lz... " >&6; } --if ${ac_cv_lib_z_deflate+:} false; then : -+if test "${ac_cv_lib_z_deflate+set}" = set; then : - $as_echo_n "(cached) " >&6 - else - ac_check_lib_save_LIBS=$LIBS -@@ -5371,7 +5207,7 @@ LIBS=$ac_check_lib_save_LIBS - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5 - $as_echo "$ac_cv_lib_z_deflate" >&6; } --if test "x$ac_cv_lib_z_deflate" = xyes; then : -+if test "x$ac_cv_lib_z_deflate" = x""yes; then : - ZLIB_OBJS= - else - ZLIB_OBJS="\$(Z_OBJS)" -@@ -5395,7 +5231,7 @@ ac_config_files="$ac_config_files src/Ma - - - #TODO: Should be possible to get rid of libdruntime/phobos-ver-syms --ac_config_files="$ac_config_files Makefile src/phobos-ver-syms libdruntime/phobos-ver-syms" -+ac_config_files="$ac_config_files Makefile src/phobos-ver-syms libdruntime/phobos-ver-syms libdruntime/gcc/libbacktrace.d" - - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure -@@ -5461,21 +5297,10 @@ $as_echo "$as_me: WARNING: cache variabl - :end' >>confcache - if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then -- if test "x$cache_file" != "x/dev/null"; then -+ test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 - $as_echo "$as_me: updating cache $cache_file" >&6;} -- if test ! -f "$cache_file" || test -h "$cache_file"; then -- cat confcache >"$cache_file" -- else -- case $cache_file in #( -- */* | ?:*) -- mv -f confcache "$cache_file"$$ && -- mv -f "$cache_file"$$ "$cache_file" ;; #( -- *) -- mv -f confcache "$cache_file" ;; -- esac -- fi -- fi -+ cat confcache >$cache_file - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 - $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} -@@ -5491,7 +5316,6 @@ DEFS=-DHAVE_CONFIG_H - - ac_libobjs= - ac_ltlibobjs= --U= - for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' -@@ -5514,8 +5338,12 @@ else - am__EXEEXT_FALSE= - fi - -+if test -z "${BACKTRACE_SUPPORTED_TRUE}" && test -z "${BACKTRACE_SUPPORTED_FALSE}"; then -+ as_fn_error "conditional \"BACKTRACE_SUPPORTED\" was never defined. -+Usually this means the macro was only invoked conditionally." "$LINENO" 5 -+fi - --: "${CONFIG_STATUS=./config.status}" -+: ${CONFIG_STATUS=./config.status} - ac_write_fail=0 - ac_clean_files_save=$ac_clean_files - ac_clean_files="$ac_clean_files $CONFIG_STATUS" -@@ -5616,7 +5444,6 @@ fi - IFS=" "" $as_nl" - - # Find who we are. Look in the path if we contain no directory separator. --as_myself= - case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -@@ -5662,19 +5489,19 @@ export LANGUAGE - (unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - --# as_fn_error STATUS ERROR [LINENO LOG_FD] --# ---------------------------------------- -+# as_fn_error ERROR [LINENO LOG_FD] -+# --------------------------------- - # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are - # provided, also output the error to LOG_FD, referencing LINENO. Then exit the --# script with STATUS, using 1 if that was 0. -+# script with status $?, using 1 if that was 0. - as_fn_error () - { -- as_status=$1; test $as_status -eq 0 && as_status=1 -- if test "$4"; then -- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack -- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 -+ as_status=$?; test $as_status -eq 0 && as_status=1 -+ if test "$3"; then -+ as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack -+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi -- $as_echo "$as_me: error: $2" >&2 -+ $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status - } # as_fn_error - -@@ -5812,16 +5639,16 @@ if (echo >conf$$.file) 2>/dev/null; then - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. -- # In both cases, we have to default to `cp -pR'. -+ # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - fi - else -- as_ln_s='cp -pR' -+ as_ln_s='cp -p' - fi - rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file - rmdir conf$$.dir 2>/dev/null -@@ -5870,7 +5697,7 @@ $as_echo X"$as_dir" | - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" -- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" -+ } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - - } # as_fn_mkdir_p -@@ -5881,16 +5708,28 @@ else - as_mkdir_p=false - fi - -- --# as_fn_executable_p FILE --# ----------------------- --# Test if FILE is an executable regular file. --as_fn_executable_p () --{ -- test -f "$1" && test -x "$1" --} # as_fn_executable_p --as_test_x='test -x' --as_executable_p=as_fn_executable_p -+if test -x / >/dev/null 2>&1; then -+ as_test_x='test -x' -+else -+ if ls -dL / >/dev/null 2>&1; then -+ as_ls_L_option=L -+ else -+ as_ls_L_option= -+ fi -+ as_test_x=' -+ eval sh -c '\'' -+ if test -d "$1"; then -+ test -d "$1/."; -+ else -+ case $1 in #( -+ -*)set "./$1";; -+ esac; -+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( -+ ???[sx]*):;;*)false;;esac;fi -+ '\'' sh -+ ' -+fi -+as_executable_p=$as_test_x - - # Sed expression to map a string onto a valid CPP name. - as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" -@@ -5912,7 +5751,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri - # values after options handling. - ac_log=" - This file was extended by libphobos $as_me version-unused, which was --generated by GNU Autoconf 2.69. Invocation command line was -+generated by GNU Autoconf 2.64. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS -@@ -5952,7 +5791,6 @@ Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit -- --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files -@@ -5975,13 +5813,12 @@ Report bugs to the package provider." - - _ACEOF - cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 --ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" - ac_cs_version="\\ - libphobos config.status version-unused --configured by $0, generated by GNU Autoconf 2.69, -- with options \\"\$ac_cs_config\\" -+configured by $0, generated by GNU Autoconf 2.64, -+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - --Copyright (C) 2012 Free Software Foundation, Inc. -+Copyright (C) 2009 Free Software Foundation, Inc. - This config.status script is free software; the Free Software Foundation - gives unlimited permission to copy, distribute and modify it." - -@@ -5999,16 +5836,11 @@ ac_need_defaults=: - while test $# != 0 - do - case $1 in -- --*=?*) -+ --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; -- --*=) -- ac_option=`expr "X$1" : 'X\([^=]*\)='` -- ac_optarg= -- ac_shift=: -- ;; - *) - ac_option=$1 - ac_optarg=$2 -@@ -6022,15 +5854,12 @@ do - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; -- --config | --confi | --conf | --con | --co | --c ) -- $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; -- '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; -@@ -6043,7 +5872,7 @@ do - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header -- as_fn_error $? "ambiguous option: \`$1' -+ as_fn_error "ambiguous option: \`$1' - Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; -@@ -6052,7 +5881,7 @@ Try \`$0 --help' for more information."; - ac_cs_silent=: ;; - - # This is an error. -- -*) as_fn_error $? "unrecognized option: \`$1' -+ -*) as_fn_error "unrecognized option: \`$1' - Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" -@@ -6072,7 +5901,7 @@ fi - _ACEOF - cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - if \$ac_cs_recheck; then -- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' -@@ -6123,8 +5952,9 @@ do - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/phobos-ver-syms") CONFIG_FILES="$CONFIG_FILES src/phobos-ver-syms" ;; - "libdruntime/phobos-ver-syms") CONFIG_FILES="$CONFIG_FILES libdruntime/phobos-ver-syms" ;; -+ "libdruntime/gcc/libbacktrace.d") CONFIG_FILES="$CONFIG_FILES libdruntime/gcc/libbacktrace.d" ;; - -- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; -+ *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac - done - -@@ -6147,10 +5977,9 @@ fi - # after its creation but before its name has been assigned to `$tmp'. - $debug || - { -- tmp= ac_tmp= -+ tmp= - trap 'exit_status=$? -- : "${ac_tmp:=$tmp}" -- { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status - ' 0 - trap 'as_fn_exit 1' 1 2 13 15 - } -@@ -6158,13 +5987,12 @@ $debug || - - { - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && -- test -d "$tmp" -+ test -n "$tmp" && test -d "$tmp" - } || - { - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") --} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 --ac_tmp=$tmp -+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - - # Set up the scripts for CONFIG_FILES section. - # No need to generate them if there are no CONFIG_FILES. -@@ -6181,12 +6009,12 @@ if test "x$ac_cr" = x; then - fi - ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` - if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then -- ac_cs_awk_cr='\\r' -+ ac_cs_awk_cr='\r' - else - ac_cs_awk_cr=$ac_cr - fi - --echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -+echo 'BEGIN {' >"$tmp/subs1.awk" && - _ACEOF - - -@@ -6195,18 +6023,18 @@ _ACEOF - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" - } >conf$$subs.sh || -- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 --ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` - ac_delim='%!_!# ' - for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || -- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then -- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -+ as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -@@ -6214,7 +6042,7 @@ done - rm -f conf$$subs.sh - - cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 --cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -+cat >>"\$tmp/subs1.awk" <<\\_ACAWK && - _ACEOF - sed -n ' - h -@@ -6228,7 +6056,7 @@ s/'"$ac_delim"'$// - t delim - :nl - h --s/\(.\{148\}\)..*/\1/ -+s/\(.\{148\}\).*/\1/ - t more1 - s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ - p -@@ -6242,7 +6070,7 @@ s/.\{148\}// - t nl - :delim - h --s/\(.\{148\}\)..*/\1/ -+s/\(.\{148\}\).*/\1/ - t more2 - s/["\\]/\\&/g; s/^/"/; s/$/"/ - p -@@ -6262,7 +6090,7 @@ t delim - rm -f conf$$subs.awk - cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - _ACAWK --cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && -+cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -@@ -6294,29 +6122,21 @@ if sed "s/$ac_cr//" < /dev/null > /dev/n - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" - else - cat --fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ -- || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ -+ || as_fn_error "could not setup config files machinery" "$LINENO" 5 - _ACEOF - --# VPATH may cause trouble with some makes, so we remove sole $(srcdir), --# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -+# VPATH may cause trouble with some makes, so we remove $(srcdir), -+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and - # trailing colons and then remove the whole line if VPATH becomes empty - # (actually we leave an empty line to preserve line numbers). - if test "x$srcdir" = x.; then -- ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ --h --s/// --s/^/:/ --s/[ ]*$/:/ --s/:\$(srcdir):/:/g --s/:\${srcdir}:/:/g --s/:@srcdir@:/:/g --s/^:*// -+ ac_vpsub='/^[ ]*VPATH[ ]*=/{ -+s/:*\$(srcdir):*/:/ -+s/:*\${srcdir}:*/:/ -+s/:*@srcdir@:*/:/ -+s/^\([^=]*=[ ]*\):*/\1/ - s/:*$// --x --s/\(=[ ]*\).*/\1/ --G --s/\n// - s/^[^=]*=[ ]*$// - }' - fi -@@ -6328,7 +6148,7 @@ fi # test -n "$CONFIG_FILES" - # No need to generate them if there are no CONFIG_HEADERS. - # This happens for instance with `./config.status Makefile'. - if test -n "$CONFIG_HEADERS"; then --cat >"$ac_tmp/defines.awk" <<\_ACAWK || -+cat >"$tmp/defines.awk" <<\_ACAWK || - BEGIN { - _ACEOF - -@@ -6340,11 +6160,11 @@ _ACEOF - # handling of long lines. - ac_delim='%!_!# ' - for ac_last_try in false false :; do -- ac_tt=`sed -n "/$ac_delim/p" confdefs.h` -- if test -z "$ac_tt"; then -+ ac_t=`sed -n "/$ac_delim/p" confdefs.h` -+ if test -z "$ac_t"; then - break - elif $ac_last_try; then -- as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 -+ as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -@@ -6429,7 +6249,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ - _ACAWK - _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -- as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -+ as_fn_error "could not setup config headers machinery" "$LINENO" 5 - fi # test -n "$CONFIG_HEADERS" - - -@@ -6442,7 +6262,7 @@ do - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; -- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; -+ :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac -@@ -6461,7 +6281,7 @@ do - for ac_f - do - case $ac_f in -- -) ac_f="$ac_tmp/stdin";; -+ -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. -@@ -6470,7 +6290,7 @@ do - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || -- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; -+ as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" -@@ -6496,8 +6316,8 @@ $as_echo "$as_me: creating $ac_file" >&6 - esac - - case $ac_tag in -- *:-:* | *:-) cat >"$ac_tmp/stdin" \ -- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; -+ *:-:* | *:-) cat >"$tmp/stdin" \ -+ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac -@@ -6633,24 +6453,23 @@ s&@INSTALL@&$ac_INSTALL&;t t - s&@MKDIR_P@&$ac_MKDIR_P&;t t - $ac_datarootdir_hack - " --eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ -- >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 -+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ -+ || as_fn_error "could not create $ac_file" "$LINENO" 5 - - test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && -- { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && -- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ -- "$ac_tmp/out"`; test -z "$ac_out"; } && -+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && -+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' --which seems to be undefined. Please make sure it is defined" >&5 -+which seems to be undefined. Please make sure it is defined." >&5 - $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' --which seems to be undefined. Please make sure it is defined" >&2;} -+which seems to be undefined. Please make sure it is defined." >&2;} - -- rm -f "$ac_tmp/stdin" -+ rm -f "$tmp/stdin" - case $ac_file in -- -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; -- *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; -+ -) cat "$tmp/out" && rm -f "$tmp/out";; -+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ -- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 -+ || as_fn_error "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # -@@ -6659,21 +6478,21 @@ which seems to be undefined. Please mak - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ -- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" -- } >"$ac_tmp/config.h" \ -- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 -- if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then -+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" -+ } >"$tmp/config.h" \ -+ || as_fn_error "could not create $ac_file" "$LINENO" 5 -+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 - $as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" -- mv "$ac_tmp/config.h" "$ac_file" \ -- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 -+ mv "$tmp/config.h" "$ac_file" \ -+ || as_fn_error "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ -- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ -- || as_fn_error $? "could not create -" "$LINENO" 5 -+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ -+ || as_fn_error "could not create -" "$LINENO" 5 - fi - # Compute "$ac_file"'s index in $config_headers. - _am_arg="$ac_file" -@@ -6758,7 +6577,7 @@ _ACEOF - ac_clean_files=$ac_clean_files_save - - test $ac_write_fail = 0 || -- as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 -+ as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - - # configure is writing to config.log, and then calls config.status. -@@ -6779,7 +6598,7 @@ if test "$no_create" != yes; then - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. -- $ac_cs_success || as_fn_exit 1 -+ $ac_cs_success || as_fn_exit $? - fi - if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 ---- a/src/libphobos/configure.ac 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/configure.ac 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,559 @@ -+# GDC -- D front-end for GCC -+# Copyright (C) 2004 David Friedman -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+# Process this file with autoreconf to produce a configure script. -+ -+AC_PREREQ(2.64) -+AC_INIT(libphobos, version-unused) -+AC_CONFIG_SRCDIR(std/algorithm.d) -+AC_CONFIG_SRCDIR(libdruntime/gcc/builtins.d) -+AC_CONFIG_SRCDIR(libdruntime/gcc/attribute.d) -+AC_CONFIG_HEADERS(config.h) -+ -+AC_CANONICAL_SYSTEM -+target_alias=${target_alias-$target} -+AC_SUBST(target_alias) -+ -+AM_INIT_AUTOMAKE([1.9.3 foreign no-dependencies]) -+AH_TEMPLATE(PACKAGE, [Name of package]) -+AH_TEMPLATE(VERSION, [Version number of package]) -+ -+AM_ENABLE_MULTILIB(, ..) -+ -+# libphobos is usually a symlink to gcc/d/phobos, so libphobos/.. -+# is not the toplevel GCC directory. gcc/d may also be a symlink. -+# Find the correct top-level directory by removing "/libphobos" -+# from $srcdir. -+dnl NOTE: This assumes that AM_ENABLE_MULTILIB uses $multi_basedir -+if test ! -r "$multi_basedir/config-ml.in"; then -+ better_dir=`echo "$srcdir" | sed -e 's|/libphobos||'` -+ if test -r "$better_dir/config-ml.in"; then -+ multi_basedir=$better_dir -+ fi -+fi -+ -+if test "$build" != "$host"; then -+ # We are being configured with some form of cross compiler. -+ #GLIBCXX_IS_NATIVE=false -+ GCC_NO_EXECUTABLES -+ d_cross_comp=yes -+else -+ d_cross_comp= -+fi -+ -+dnl Copied from libstdc++-v3/acinclude.m4. Indeed, multilib will not work -+dnl correctly without this. -+# We're almost certainly being configured before anything else which uses -+# C++, so all of our AC_PROG_* discoveries will be cached. It's vital that -+# we not cache the value of CXX that we "discover" here, because it's set -+# to something unique for us and libjava. Other target libraries need to -+# find CXX for themselves. We yank the rug out from under the normal AC_* -+# process by sneakily renaming the cache variable. This also lets us debug -+# the value of "our" CXX in postmortems. -+# -+# We must also force CXX to /not/ be a precious variable, otherwise the -+# wrong (non-multilib-adjusted) value will be used in multilibs. This -+# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side -+# effect, CXXFLAGS is no longer automagically subst'd, so we have to do -+# that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS. -+# -+# -fno-builtin must be present here so that a non-conflicting form of -+# std::exit can be guessed by AC_PROG_CXX, and used in later tests. -+ -+m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX]) -+m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS]) -+m4_define([_AC_ARG_VAR_PRECIOUS],[]) -+save_CXXFLAGS="$CXXFLAGS" -+CXXFLAGS="$CXXFLAGS -fno-builtin" -+# --- Extra hack for Phobos --- -+# AC_PROG_CC, if not "cross-compiling", tries to run a simple C program. -+# However, a given multilib variant may not be executable on the current -+# system. Example: Building for x86_64 on IA-32. This is technically -+# cross-compiling, but we don't want cross-compiling directory layouts -+# and we still need link tests. Solution is to make autoconf think it -+# is cross compiling only when it tests the compilers. -+d_save_cross_compiling=$cross_compiling -+cross_compiling=yes -+AC_PROG_CC -+AC_PROG_CXX -+cross_compiling=$d_save_cross_compiling -+CXXFLAGS="$save_CXXFLAGS" -+#m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) -+AC_SUBST(CFLAGS) -+AC_SUBST(CXXFLAGS) -+dnl -- End of copy from libstdc++-v3/acinclude.m4 -+ -+dnl These should be inherited in the recursive make, but ensure they are -+dnl defined: -+test "$AR" || AR=ar -+AC_SUBST(AR) -+if test "$RANLIB"; then : -+ AC_SUBST(RANLIB) -+else -+ AC_PROG_RANLIB -+fi -+AC_PROG_INSTALL -+AC_PROG_MAKE_SET -+dnl AC_PROG_LIBTOOL -+ -+AC_ARG_ENABLE(thread-lib, -+ AC_HELP_STRING([--enable-thread-lib=<arg>], -+ [specify linker option for the system thread library (default: autodetect)]), -+ [d_thread_lib=$enableval],[d_thread_lib=""]) -+ -+AC_ARG_ENABLE(unix, -+ AC_HELP_STRING([--enable-unix], -+ [enables Unix runtime (default: yes, for Unix targets)]), -+ :,[enable_unix=auto]) -+ -+dnl switch between gc and gcstub -+AC_ARG_ENABLE(druntime-gc, -+ AC_HELP_STRING([--enable-druntime-gc], -+ [enable D runtime garbage collector (default: yes)]), -+ :,[enable_druntime_gc=yes]) -+ -+dnl switch between system zlib and gcc's zlib -+AC_ARG_WITH(system-zlib, -+ AS_HELP_STRING([--with-system-zlib], -+ [use installed libz (default: no)]), -+ :,[system_zlib=no]) -+ -+AC_ARG_ENABLE(phobos-config-dir, -+ AC_HELP_STRING([--enable-phobos-config-dir=<dir>], -+ [use source file fragments in <dir>]), -+[if test -z "${enableval}"; then -+ AC_MSG_ERROR([must specify a value for --enable-phobos-config-dir]) -+fi], -+:) -+ -+if test ${multilib} = yes; then -+ multilib_arg="--enable-multilib" -+else -+ multilib_arg= -+fi -+ -+d_target_os=`echo $target_os | sed 's/^\([A-Za-z_]+\)/\1/'` -+ -+GDC=$CC -+GDC=`echo $CC | sed s/xgcc/gdc/` -+ -+AC_MSG_CHECKING([If $GDC can compile D sources]) -+echo "int function(int) test;" > actest.d -+$GDC -c -x d -I "$srcdir/libdruntime" actest.d -+r=$? -+rm -f actest.[do] -+if test $r -eq 0; then -+ AC_MSG_RESULT([yes]) -+else -+ AC_MSG_RESULT([no]) -+ AC_MSG_ERROR([can't compile D sources!]) -+ dnl fix vi syntax highlight bug. ' -+fi -+ -+AC_SUBST(GDC) -+ -+AC_MSG_CHECKING([D GCC version]) -+d_gcc_ver=`$GDC -dumpversion` -+AC_MSG_RESULT($d_gcc_ver) -+ -+# Need to export this variables for multilib -+export CC_FOR_BUILD -+export CFLAGS_FOR_BUILD -+AC_SUBST(CC_FOR_BUILD) -+AC_SUBST(CFLAGS_FOR_BUILD) -+ -+# Find build libiberty which is needed by x3 -+# Should not have to go up too many directories -+ -+d_libiberty_dir=../.. -+while test "$d_count" != 'xxx'; do -+ BUILD_LIBIBERTY=$d_libiberty_dir/build-${build_alias}/libiberty/libiberty.a -+ if test -f $BUILD_LIBIBERTY; then -+ break -+ fi -+ # GCC 3.x does not use the 'build-' dir, so we have so search -+ # for plain 'libiberty' with some kind of check it is not a target dir -+ BUILD_LIBIBERTY=$d_libiberty_dir/libiberty/libiberty.a -+ if test -f $BUILD_LIBIBERTY && test -d $d_libiberty_dir/gcc; then -+ break -+ fi -+ -+ d_libiberty_dir=../$d_libiberty_dir -+ d_count="x$d_count" -+done -+ -+if test ! -f "$BUILD_LIBIBERTY"; then -+ AC_MSG_ERROR([cannot find libiberty.a for build]) -+fi -+ -+#used in druntime, so srcdir is 'libphobos/libdruntime' -+LIBIBERTY_H_PATH='$(srcdir)/../../include' -+BUILD_LIBIBERTY="../$BUILD_LIBIBERTY" -+ -+AC_SUBST(BUILD_LIBIBERTY) -+AC_SUBST(LIBIBERTY_H_PATH) -+ -+ -+dnl Eventually need to include everything from libstdc++-v3/acinclude.m4 -+dnl (# Default case for install directory for include files.) and on -+ -+# include dir .. need to support --enable-version-specific.. but -+# will have to modify gcc/configure.ac .. -+# For now, basic workaround for cross compilers .. -+# To really mirror the check in Make-lang.in we need to access the -+# host/target of the compiler. The libphobos 'host' and 'target' variables -+# are always equal (and are the same as the compilers target) -+d_count="" -+d_pkgvars_prefix=../.. -+while test "$d_count" != 'xxx'; do -+ d_pkgvars=$d_pkgvars_prefix/gcc/d/pkgvars -+ if test -f $d_pkgvars; then -+ break -+ fi -+ -+ d_pkgvars_prefix=../$d_pkgvars_prefix -+ d_count="x$d_count" -+done -+ -+if test -f "${d_pkgvars}"; then -+ gdc_host=`grep "host=" "${d_pkgvars}" | sed -e 's|host=||'` -+ gdc_target=`grep "target=" "${d_pkgvars}" | sed -e 's|target=||'` -+else -+ AC_MSG_WARN([Cannot find pkgvars file to determine compiler host/target]) -+ gdc_host=${build} -+ gdc_target=${host} -+fi -+ -+if test "${gdc_host}" != "${gdc_target}"; then -+ gdc_include_dir='${libdir}/gcc/${host_alias}'/${d_gcc_ver}/include/d -+else -+ gdc_include_dir='${prefix}'/include/d/${d_gcc_ver} -+fi -+AC_SUBST(gdc_include_dir) -+AC_ARG_WITH([cross-host], -+ AC_HELP_STRING([--with-cross-host=HOST], -+ [configuring with a cross compiler])) -+if test -n "$with_cross_host" && -+ test x"$with_cross_host" != x"no"; then -+ phobos_toolexecdir='${exec_prefix}/${host_alias}' -+ phobos_toolexeclibdir='${toolexecdir}/lib' -+else -+ phobos_toolexecdir='${libdir}/gcc/${host_alias}' -+ phobos_toolexeclibdir='${libdir}' -+fi -+# The norm would be to use $GDC -print-multi-os-directory, but -+# that would require modifying config-ml.in -+multi_os_directory=`$CC -print-multi-os-directory` -+case $multi_os_directory in -+ .) ;; # Avoid trailing /. -+ *) phobos_toolexeclibdir=$phobos_toolexeclibdir/$multi_os_directory ;; -+esac -+AC_SUBST(phobos_toolexecdir) -+AC_SUBST(phobos_toolexeclibdir) -+ -+dnl Checks for header files. -+# Sanity check for the cross-compilation case: -+AC_CHECK_HEADER(stdio.h,:, -+ [AC_MSG_ERROR([cannot find stdio.h.])]) -+ -+ -+HAVE_DLADDR=false -+AC_CHECK_FUNC(dladdr, HAVE_DLADDR=true) -+AC_SUBST(HAVE_DLADDR) -+ -+BACKTRACE_SUPPORTED=false -+BACKTRACE_USES_MALLOC=false -+BACKTRACE_SUPPORTS_THREADS=false -+LIBBACKTRACE_LIB="" -+ -+CPPFLAGS+=" -I../libbacktrace " -+ -+AC_ARG_ENABLE(libbacktrace, -+ [ --disable-libbacktrace Do not use libbacktrace for backtraces], -+ check_libbacktrace_h="$enableval", check_libbacktrace_h="yes") -+ -+if test $check_libbacktrace_h = yes ; then -+ AC_CHECK_HEADER(backtrace-supported.h, have_libbacktrace_h=true, -+ have_libbacktrace_h=false) -+else -+ have_libbacktrace_h=false -+fi -+ -+if $have_libbacktrace_h; then -+ AC_MSG_CHECKING([libbacktrace: BACKTRACE_SUPPORTED]) -+ AC_EGREP_CPP(FOUND_LIBBACKTRACE_RESULT_GDC, -+ [ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_SUPPORTED -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ ], BACKTRACE_SUPPORTED=true, BACKTRACE_SUPPORTED=false) -+ AC_MSG_RESULT($BACKTRACE_SUPPORTED) -+ -+ AC_MSG_CHECKING([libbacktrace: BACKTRACE_USES_MALLOC]) -+ AC_EGREP_CPP(FOUND_LIBBACKTRACE_RESULT_GDC, -+ [ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_USES_MALLOC -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ ], BACKTRACE_USES_MALLOC=true, BACKTRACE_USES_MALLOC=false) -+ AC_MSG_RESULT($BACKTRACE_USES_MALLOC) -+ -+ AC_MSG_CHECKING([libbacktrace: BACKTRACE_SUPPORTS_THREADS]) -+ AC_EGREP_CPP(FOUND_LIBBACKTRACE_RESULT_GDC, -+ [ -+ #include <backtrace-supported.h> -+ #if BACKTRACE_SUPPORTS_THREADS -+ FOUND_LIBBACKTRACE_RESULT_GDC -+ #endif -+ ], BACKTRACE_SUPPORTS_THREADS=true, BACKTRACE_SUPPORTS_THREADS=false) -+ AC_MSG_RESULT($BACKTRACE_SUPPORTS_THREADS) -+fi -+ -+AM_CONDITIONAL([BACKTRACE_SUPPORTED], [$BACKTRACE_SUPPORTED]) -+ -+if $BACKTRACE_SUPPORTED; then -+ LIBBACKTRACE_LIB="../../libbacktrace/.libs/libbacktrace.a" -+else -+ LIBBACKTRACE_LIB="" -+fi -+ -+AC_SUBST(LIBBACKTRACE_LIB) -+AC_SUBST(BACKTRACE_SUPPORTED) -+AC_SUBST(BACKTRACE_USES_MALLOC) -+AC_SUBST(BACKTRACE_SUPPORTS_THREADS) -+ -+AC_MSG_CHECKING([for thread model used by GDC]) -+d_thread_model=`$GDC -v 2>&1 | sed -n 's/^Thread model: //p'` -+AC_MSG_RESULT([$d_thread_model]) -+ -+# Map from thread model to thread interface. -+DRUNTIME_CONFIGURE_THREADS([$d_thread_model]) -+ -+dnl AC_HEADER_STDC -+# TODO... -+ -+D_EXTRA_OBJS= -+AC_SUBST(D_EXTRA_OBJS) -+DRUNTIME_OBJS= -+AC_SUBST(DRUNTIME_OBJS) -+ -+if test "$with_newlib" = no; then -+ -+AC_CHECK_LIB(m,cos) -+ -+case "$d_target_os" in -+ aix*) AC_CHECK_LIB(C,sqrtf) ;; -+esac -+ -+case "$target_os" in -+ linux*|k*bsd*-gnu) -+ case "$target_cpu" in -+ powerpc*) -+ # Libc without nldbl not supported... -+ AC_CHECK_FUNC(__nldbl_printf,d_have_nldbl_funcs=1,:) -+ if test "$d_have_nldbl_funcs" = 1; then -+ : -+ fi -+ ;; -+ esac -+esac -+ -+save_CFLAGS=$CFLAGS -+dnl Check for BSD(?) specific fields in struct tm -+dnl Maybe test fields separately -+AC_MSG_CHECKING([for tm_gmtoff]) -+AC_TRY_COMPILE([#include <time.h>],[ -+struct tm t; -+t.tm_gmtoff = t.tm_gmtoff; -+t.tm_zone = t.tm_zone;], -+ [AC_MSG_RESULT([yes]) -+ AC_DEFINE(HAVE_TM_GMTOFF_AND_ZONE,1,[Extra fields in struct tm])], -+ [AC_MSG_RESULT([no])]) -+ -+dnl The '* 42' is to ensure a type error occurs if timezone is not a -+dnl number. Simple assignment will not do this. -+AC_MSG_CHECKING([for timezone]) -+AC_TRY_COMPILE([#include <time.h>],[ -+time_t t = timezone * 42;], -+ [AC_MSG_RESULT([yes]) -+ AC_DEFINE(HAVE_TIMEZONE,1,[Global timezone variable])], -+ [AC_MSG_RESULT([no])]) -+ -+AC_MSG_CHECKING([for _timezone]) -+AC_TRY_COMPILE([#include <time.h>],[ -+time_t t = _timezone * 42;], -+ [AC_MSG_RESULT([yes]) -+ AC_DEFINE(HAVE__TIMEZONE,1,[Another global timezone variable])], -+ [AC_MSG_RESULT([no])]) -+ -+AC_CHECK_FUNCS(snprintf _snprintf,break,[AC_MSG_ERROR([No variant of snprintf.])]) -+AC_CHECK_FUNCS(vsnprintf _vsnprintf,break,[AC_MSG_ERROR([No variant of vsnprintf.])]) -+ -+# end of 'if $with_newlib...' -+fi -+ -+AC_MSG_CHECKING([for ARM unwinder]) -+AC_TRY_COMPILE([#include <unwind.h>],[ -+#if __ARM_EABI_UNWINDER__ -+#error Yes, it is. -+#endif -+], -+ [AC_MSG_RESULT([no]) -+ DCFG_ARM_EABI_UNWINDER="" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind/generic.o"], -+ [AC_MSG_RESULT([yes]) -+ DCFG_ARM_EABI_UNWINDER="GNU_ARM_EABI_Unwinder" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind/arm.o"]) -+AC_SUBST(DCFG_ARM_EABI_UNWINDER) -+ -+case "$d_thread_model" in -+ posix) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/posix.o" -+ ;; -+ win32) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/win32.o" -+ ;; -+ *) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/gthreads/single.o" -+ ;; -+esac -+ -+case "$d_target_os" in -+ aix*|*bsd*|cygwin*|darwin*|gnu*|linux*|skyos*|*solaris*|sysv*) d_have_unix=1 ;; -+esac -+ -+DCFG_CBRIDGE_STDIO= -+AC_SUBST(DCFG_CBRIDGE_STDIO) -+ -+if test -n "$d_have_unix" && test "$enable_unix" = auto ; then -+ enable_unix=yes -+fi -+ -+case "$d_target_os" in -+ aix*) d_is_aix=1 -+ ;; -+ darwin*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_OSX_OBJS)" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)" -+ ;; -+ freebsd*|k*bsd*-gnu) -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(FREEBSD_OBJS)" -+ DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -+ ;; -+ linux*) #D_EXTRA_OBJS="$D_EXTRA_OBJS std/c/linux/linux.o" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)" -+ ;; -+ cygwin*) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -+ DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -+ ;; -+ mingw*) #DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_WINDOWS_OBJS)" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(WINDOWS_OBJS)" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OS_OBJS)" -+ #DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -+ DCFG_UNIX=Windows -+ ;; -+ *) if test "$enable_unix" != "yes"; then -+ DCFG_UNIX=NoSystem -+ fi -+ DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -+ DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -+ ;; -+esac -+ -+if test "$enable_unix" = "yes"; then -+ DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)" -+ DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_POSIX_OBJS)" -+ D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OS_OBJS)" -+ DPHOBOS_CONFIGURE_UNIX -+fi -+dnl can these be moved to acinclude.m4? -+AC_SUBST(DCFG_MMAP) -+AC_SUBST(DCFG_GETPWNAM_R) -+AC_SUBST(DCFG_UNIX) -+AC_SUBST(DCFG_POSIX) -+ -+if test -z "$DFLAGS"; then -+ DFLAGS="-Wall -g -frelease -O2" -+fi -+AC_SUBST(DFLAGS) -+ -+if test -z "$DFLAGSX"; then -+ DFLAGSX="-Wall -g -fno-release -funittest" -+fi -+AC_SUBST(DFLAGSX) -+ -+dnl TODO: change this to using pthreads? if so, define usepthreads -+dnl and configure semaphore -+ -+ -+# phobose_use_pthreads was here... -+ -+d_subdirs=`( cd $srcdir && find . -type d ) | sed -e 's/^.\///'` -+d_subdirs="$d_subdirs gcc" -+for i in $d_subdirs; do -+ mkdir -p $i; -+done -+ -+AC_SUBST(srcdir) -+ -+ -+# Garbage collection configuration -+ -+D_GC_MODULES= -+ -+if test "$enable_druntime_gc" = "yes"; then -+ D_GC_MODULES="gc/bits.o gc/gc.o gc/os.o gc/proxy.o gc/stats.o" -+else -+ D_GC_MODULES="gcstub/gc.o" -+fi -+ -+AC_SUBST(D_GC_MODULES) -+ -+ -+ZLIB_OBJS= -+if test "$system_zlib" = yes; then -+ AC_CHECK_LIB(z, deflate, ZLIB_OBJS=, ZLIB_OBJS="\$(Z_OBJS)") -+else -+ ZLIB_OBJS="\$(Z_OBJS)" -+fi -+AC_SUBST(ZLIB_OBJS) -+ -+# Copied from libstdc++-v3/configure.ac -+# Multilibs need MULTISUBDIR defined correctly in certain makefiles so -+# that multilib installs will end up installed in the correct place. -+# The testsuite needs it for multilib-aware ABI baseline files. -+# To work around this not being passed down from config-ml.in -> -+# srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually -+# append it here. Only modify Makefiles that have just been created. -+# -+# Also, get rid of this simulated-VPATH thing that automake does. -+AC_CONFIG_FILES(AC_FOREACH([DIR], src libdruntime, [DIR/Makefile ]), -+ [cat > vpsed$$ << \_EOF -+s!`test -f '$<' || echo '$(srcdir)/'`!! -+_EOF -+ sed -f vpsed$$ $ac_file > tmp$$ -+ mv tmp$$ $ac_file -+ rm vpsed$$ -+ echo 'MULTISUBDIR =' >> $ac_file -+ ml_norecursion=yes -+ . ${multi_basedir}/config-ml.in -+ AS_UNSET([ml_norecursion]) -+]) -+ -+#TODO: Should be possible to get rid of libdruntime/phobos-ver-syms -+AC_OUTPUT([Makefile src/phobos-ver-syms libdruntime/phobos-ver-syms libdruntime/gcc/libbacktrace.d]) ---- a/src/libphobos/configure.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/configure.in 1970-01-01 01:00:00.000000000 +0100 -@@ -1,469 +0,0 @@ --# GDC -- D front-end for GCC --# Copyright (C) 2004 David Friedman --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --dnl Parts taken from libobjc configure.in -- --AC_PREREQ(2.64) --AC_INIT(libphobos, version-unused) --AC_CONFIG_SRCDIR(std/algorithm.d) --AC_CONFIG_SRCDIR(libdruntime/gcc/builtins.d) --AC_CONFIG_SRCDIR(libdruntime/gcc/attribute.d) --AC_CONFIG_HEADERS(config.h) -- --AC_CANONICAL_SYSTEM --target_alias=${target_alias-$target} --AC_SUBST(target_alias) -- --AM_INIT_AUTOMAKE([1.9.3 foreign no-dependencies]) --AH_TEMPLATE(PACKAGE, [Name of package]) --AH_TEMPLATE(VERSION, [Version number of package]) -- --AM_ENABLE_MULTILIB(, ..) -- --# libphobos is usually a symlink to gcc/d/phobos, so libphobos/.. --# is not the toplevel GCC directory. gcc/d may also be a symlink. --# Find the correct top-level directory by removing "/libphobos" --# from $srcdir. --dnl NOTE: This assumes that AM_ENABLE_MULTILIB uses $multi_basedir --if test ! -r "$multi_basedir/config-ml.in"; then -- better_dir=`echo "$srcdir" | sed -e 's|/libphobos||'` -- if test -r "$better_dir/config-ml.in"; then -- multi_basedir=$better_dir -- fi --fi -- --if test "$build" != "$host"; then -- # We are being configured with some form of cross compiler. -- #GLIBCXX_IS_NATIVE=false -- GCC_NO_EXECUTABLES -- d_cross_comp=yes --else -- d_cross_comp= --fi -- --dnl Copied from libstdc++-v3/acinclude.m4. Indeed, multilib will not work --dnl correctly without this. --# We're almost certainly being configured before anything else which uses --# C++, so all of our AC_PROG_* discoveries will be cached. It's vital that --# we not cache the value of CXX that we "discover" here, because it's set --# to something unique for us and libjava. Other target libraries need to --# find CXX for themselves. We yank the rug out from under the normal AC_* --# process by sneakily renaming the cache variable. This also lets us debug --# the value of "our" CXX in postmortems. --# --# We must also force CXX to /not/ be a precious variable, otherwise the --# wrong (non-multilib-adjusted) value will be used in multilibs. This --# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side --# effect, CXXFLAGS is no longer automagically subst'd, so we have to do --# that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS. --# --# -fno-builtin must be present here so that a non-conflicting form of --# std::exit can be guessed by AC_PROG_CXX, and used in later tests. -- --m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX]) --m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS]) --m4_define([_AC_ARG_VAR_PRECIOUS],[]) --save_CXXFLAGS="$CXXFLAGS" --CXXFLAGS="$CXXFLAGS -fno-builtin" --# --- Extra hack for Phobos --- --# AC_PROG_CC, if not "cross-compiling", tries to run a simple C program. --# However, a given multilib variant may not be executable on the current --# system. Example: Building for x86_64 on IA-32. This is technically --# cross-compiling, but we don't want cross-compiling directory layouts --# and we still need link tests. Solution is to make autoconf think it --# is cross compiling only when it tests the compilers. --d_save_cross_compiling=$cross_compiling --cross_compiling=yes --AC_PROG_CC --AC_PROG_CXX --cross_compiling=$d_save_cross_compiling --CXXFLAGS="$save_CXXFLAGS" --#m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) --AC_SUBST(CFLAGS) --AC_SUBST(CXXFLAGS) --dnl -- End of copy from libstdc++-v3/acinclude.m4 -- --dnl These should be inherited in the recursive make, but ensure they are --dnl defined: --test "$AR" || AR=ar --AC_SUBST(AR) --if test "$RANLIB"; then : -- AC_SUBST(RANLIB) --else -- AC_PROG_RANLIB --fi --AC_PROG_INSTALL --AC_PROG_MAKE_SET --dnl AC_PROG_LIBTOOL -- --AC_ARG_ENABLE(thread-lib, -- AC_HELP_STRING([--enable-thread-lib=<arg>], -- [specify linker option for the system thread library (default: autodetect)]), -- [d_thread_lib=$enableval],[d_thread_lib=""]) -- --AC_ARG_ENABLE(unix, -- AC_HELP_STRING([--enable-unix], -- [enables Unix runtime (default: yes, for Unix targets)]), -- :,[enable_unix=auto]) -- --dnl switch between gc and gcstub --AC_ARG_ENABLE(druntime-gc, -- AC_HELP_STRING([--enable-druntime-gc], -- [enable D runtime garbage collector (default: yes)]), -- :,[enable_druntime_gc=yes]) -- --dnl switch between system zlib and gcc's zlib --AC_ARG_WITH(system-zlib, -- AS_HELP_STRING([--with-system-zlib], -- [use installed libz (default: no)]), -- :,[system_zlib=no]) -- --AC_ARG_ENABLE(phobos-config-dir, -- AC_HELP_STRING([--enable-phobos-config-dir=<dir>], -- [use source file fragments in <dir>]), --[if test -z "${enableval}"; then -- AC_MSG_ERROR([must specify a value for --enable-phobos-config-dir]) --fi], --:) -- --if test ${multilib} = yes; then -- multilib_arg="--enable-multilib" --else -- multilib_arg= --fi -- --d_target_os=`echo $target_os | sed 's/^\([A-Za-z_]+\)/\1/'` -- --# SkyOS uses i386-skyos-pe --case "$target" in --*-skyos*-pe*) d_target_os=skyos ;; --esac -- --GDC=$CC --GDC=`echo $CC | sed s/xgcc/gdc/` -- --AC_MSG_CHECKING([If $GDC can compile D sources]) --echo "int function(int) test;" > actest.d --$GDC -c -x d -I "$srcdir/libdruntime" actest.d --r=$? --rm -f actest.[do] --if test $r -eq 0; then -- AC_MSG_RESULT([yes]) --else -- AC_MSG_RESULT([no]) -- AC_MSG_ERROR([can't compile D sources!]) -- dnl fix vi syntax highlight bug. ' --fi -- --AC_SUBST(GDC) -- --AC_MSG_CHECKING([D GCC version]) --d_gcc_ver=`$GDC -dumpversion` --AC_MSG_RESULT($d_gcc_ver) -- --# Need to export this variables for multilib --export CC_FOR_BUILD --export CFLAGS_FOR_BUILD --AC_SUBST(CC_FOR_BUILD) --AC_SUBST(CFLAGS_FOR_BUILD) -- --# Find build libiberty which is needed by x3 --# Should not have to go up too many directories -- --d_libiberty_dir=../.. --while test "$d_count" != 'xxx'; do -- BUILD_LIBIBERTY=$d_libiberty_dir/build-${build_alias}/libiberty/libiberty.a -- if test -f $BUILD_LIBIBERTY; then -- break -- fi -- # GCC 3.x does not use the 'build-' dir, so we have so search -- # for plain 'libiberty' with some kind of check it is not a target dir -- BUILD_LIBIBERTY=$d_libiberty_dir/libiberty/libiberty.a -- if test -f $BUILD_LIBIBERTY && test -d $d_libiberty_dir/gcc; then -- break -- fi -- -- d_libiberty_dir=../$d_libiberty_dir -- d_count="x$d_count" --done -- --if test ! -f "$BUILD_LIBIBERTY"; then -- AC_MSG_ERROR([cannot find libiberty.a for build]) --fi -- --#used in druntime, so srcdir is 'libphobos/libdruntime' --LIBIBERTY_H_PATH='$(srcdir)/../../include' --BUILD_LIBIBERTY="../$BUILD_LIBIBERTY" -- --AC_SUBST(BUILD_LIBIBERTY) --AC_SUBST(LIBIBERTY_H_PATH) -- -- --dnl Eventually need to include everything from libstdc++-v3/acinclude.m4 --dnl (# Default case for install directory for include files.) and on -- --# include dir .. need to support --enable-version-specific.. but --# will have to modify gcc/configure.ac .. --# For now, basic workaround for cross compilers .. --if test "${host}" != "${build}"; then -- gdc_include_dir='${libdir}/gcc/${host_alias}'/${d_gcc_ver}/include/d --else -- gdc_include_dir='${prefix}'/include/d/${d_gcc_ver} --fi --AC_SUBST(gdc_include_dir) --AC_ARG_WITH([cross-host], -- AC_HELP_STRING([--with-cross-host=HOST], -- [configuring with a cross compiler])) --if test -n "$with_cross_host" && -- test x"$with_cross_host" != x"no"; then -- phobos_toolexecdir='${exec_prefix}/${host_alias}' -- phobos_toolexeclibdir='${toolexecdir}/lib' --else -- phobos_toolexecdir='${libdir}/gcc/${host_alias}' -- phobos_toolexeclibdir='${libdir}' --fi --# The norm would be to use $GDC -print-multi-os-directory, but --# that would require modifying config-ml.in --multi_os_directory=`$CC -print-multi-os-directory` --case $multi_os_directory in -- .) ;; # Avoid trailing /. -- *) phobos_toolexeclibdir=$phobos_toolexeclibdir/$multi_os_directory ;; --esac --AC_SUBST(phobos_toolexecdir) --AC_SUBST(phobos_toolexeclibdir) -- --dnl Checks for header files. --# Sanity check for the cross-compilation case: --AC_CHECK_HEADER(stdio.h,:, -- [AC_MSG_ERROR([cannot find stdio.h.])]) -- --dnl AC_HEADER_STDC --# TODO... -- --D_EXTRA_OBJS= --AC_SUBST(D_EXTRA_OBJS) --DRUNTIME_OBJS= --AC_SUBST(DRUNTIME_OBJS) -- --if test "$with_newlib" = no; then -- --AC_CHECK_LIB(m,cos) -- --case "$d_target_os" in -- aix*) AC_CHECK_LIB(C,sqrtf) ;; --esac -- --case "$target_os" in -- linux*|k*bsd*-gnu) -- case "$target_cpu" in -- powerpc*) -- # Libc without nldbl not supported... -- AC_CHECK_FUNC(__nldbl_printf,d_have_nldbl_funcs=1,:) -- if test "$d_have_nldbl_funcs" = 1; then -- : -- fi -- ;; -- esac --esac -- --save_CFLAGS=$CFLAGS --dnl Check for BSD(?) specific fields in struct tm --dnl Maybe test fields separately --AC_MSG_CHECKING([for tm_gmtoff]) --AC_TRY_COMPILE([#include <time.h>],[ --struct tm t; --t.tm_gmtoff = t.tm_gmtoff; --t.tm_zone = t.tm_zone;], -- [AC_MSG_RESULT([yes]) -- AC_DEFINE(HAVE_TM_GMTOFF_AND_ZONE,1,[Extra fields in struct tm])], -- [AC_MSG_RESULT([no])]) -- --dnl The '* 42' is to ensure a type error occurs if timezone is not a --dnl number. Simple assignment will not do this. --AC_MSG_CHECKING([for timezone]) --AC_TRY_COMPILE([#include <time.h>],[ --time_t t = timezone * 42;], -- [AC_MSG_RESULT([yes]) -- AC_DEFINE(HAVE_TIMEZONE,1,[Global timezone variable])], -- [AC_MSG_RESULT([no])]) -- --AC_MSG_CHECKING([for _timezone]) --AC_TRY_COMPILE([#include <time.h>],[ --time_t t = _timezone * 42;], -- [AC_MSG_RESULT([yes]) -- AC_DEFINE(HAVE__TIMEZONE,1,[Another global timezone variable])], -- [AC_MSG_RESULT([no])]) -- --AC_CHECK_FUNCS(snprintf _snprintf,break,[AC_MSG_ERROR([No variant of snprintf.])]) --AC_CHECK_FUNCS(vsnprintf _vsnprintf,break,[AC_MSG_ERROR([No variant of vsnprintf.])]) -- --# end of 'if $with_newlib...' --fi -- --AC_MSG_CHECKING([for ARM unwinder]) --AC_TRY_COMPILE([#include <unwind.h>],[ --#if __ARM_EABI_UNWINDER__ --#error Yes, it is. --#endif --], -- [AC_MSG_RESULT([no]) -- DCFG_ARM_EABI_UNWINDER="" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind_generic.o"], -- [AC_MSG_RESULT([yes]) -- DCFG_ARM_EABI_UNWINDER="GNU_ARM_EABI_Unwinder" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/unwind_arm.o"]) --AC_SUBST(DCFG_ARM_EABI_UNWINDER) -- --case "$d_target_os" in -- aix*|*bsd*|cygwin*|darwin*|gnu*|linux*|skyos*|*solaris*|sysv*) d_have_unix=1 ;; --esac -- --DCFG_CBRIDGE_STDIO= --AC_SUBST(DCFG_CBRIDGE_STDIO) -- --if test -n "$d_have_unix" && test "$enable_unix" = auto ; then -- enable_unix=yes --fi -- --case "$d_target_os" in -- aix*) d_is_aix=1 -- ;; -- darwin*) d_module_mach=1 -- d_sem_impl="mach" -- ;; -- freebsd*|k*bsd*-gnu) -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(FREEBSD_OBJS)" -- DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- ;; -- linux*) #D_EXTRA_OBJS="$D_EXTRA_OBJS std/c/linux/linux.o" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)" -- d_sem_impl="posix" -- ;; -- cygwin*) DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- ;; -- mingw*) #DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)" -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_WINDOWS_OBJS)" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(WINDOWS_OBJS)" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OS_OBJS)" -- #DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- DCFG_UNIX=Windows -- ;; -- skyos*) d_sem_impl="skyos" -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- ;; -- *) if test "$enable_unix" != "yes"; then -- DCFG_UNIX=NoSystem -- fi -- DRUNTIME_OBJS="$DRUNTIME_OBJS gcc/cbridge_stdio.o" -- DCFG_CBRIDGE_STDIO="GNU_CBridge_Stdio" -- ;; --esac -- --if test -n "$d_module_mach"; then -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_OSX_OBJS)" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)" --fi -- --if test "$enable_unix" = "yes"; then -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)" -- DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_POSIX_OBJS)" -- D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OS_OBJS)" -- DPHOBOS_CONFIGURE_UNIX --fi --dnl can these be moved to acinclude.m4? --AC_SUBST(DCFG_SEMAPHORE_IMPL) --AC_SUBST(DCFG_MMAP) --AC_SUBST(DCFG_GETPWNAM_R) -- -- --AC_SUBST(DCFG_UNIX) --AC_SUBST(DCFG_POSIX) -- --if test -z "$DFLAGS"; then -- DFLAGS="-Wall -g -frelease -O2" --fi --AC_SUBST(DFLAGS) -- --if test -z "$DFLAGSX"; then -- DFLAGSX="-Wall -g -fno-release -funittest" --fi --AC_SUBST(DFLAGSX) -- --dnl TODO: change this to using pthreads? if so, define usepthreads --dnl and configure semaphore -- -- --# phobose_use_pthreads was here... -- --d_subdirs=`( cd $srcdir && find . -type d ) | sed -e 's/^.\///'` --d_subdirs="$d_subdirs gcc" --for i in $d_subdirs; do -- mkdir -p $i; --done -- --AC_SUBST(srcdir) -- -- --# Garbage collection configuration -- --D_GC_MODULES= -- --if test "$enable_druntime_gc" = "yes"; then -- D_GC_MODULES="gc/gc.o gc/gcalloc.o gc/gcbits.o gc/gcstats.o gc/gcx.o" --else -- D_GC_MODULES="gcstub/gc.o" --fi -- --AC_SUBST(D_GC_MODULES) -- -- --ZLIB_OBJS= --if test "$system_zlib" = yes; then -- AC_CHECK_LIB(z, deflate, ZLIB_OBJS=, ZLIB_OBJS="\$(Z_OBJS)") --else -- ZLIB_OBJS="\$(Z_OBJS)" --fi --AC_SUBST(ZLIB_OBJS) -- --# Copied from libstdc++-v3/configure.ac --# Multilibs need MULTISUBDIR defined correctly in certain makefiles so --# that multilib installs will end up installed in the correct place. --# The testsuite needs it for multilib-aware ABI baseline files. --# To work around this not being passed down from config-ml.in -> --# srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually --# append it here. Only modify Makefiles that have just been created. --# --# Also, get rid of this simulated-VPATH thing that automake does. --AC_CONFIG_FILES(AC_FOREACH([DIR], src libdruntime, [DIR/Makefile ]), -- [cat > vpsed$$ << \_EOF --s!`test -f '$<' || echo '$(srcdir)/'`!! --_EOF -- sed -f vpsed$$ $ac_file > tmp$$ -- mv tmp$$ $ac_file -- rm vpsed$$ -- echo 'MULTISUBDIR =' >> $ac_file -- ml_norecursion=yes -- . ${multi_basedir}/config-ml.in -- AS_UNSET([ml_norecursion]) --]) -- --#TODO: Should be possible to get rid of libdruntime/phobos-ver-syms --AC_OUTPUT([Makefile src/phobos-ver-syms libdruntime/phobos-ver-syms]) ---- a/src/libphobos/libdruntime/core/atomic.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/atomic.d 2014-04-01 16:32:51.000000000 +0100 -@@ -21,13 +21,13 @@ version( D_InlineAsm_X86 ) - version = AsmX86_32; - enum has64BitCAS = true; - } --version( D_InlineAsm_X86_64 ) -+else version( D_InlineAsm_X86_64 ) - { - version = AsmX86; - version = AsmX86_64; - enum has64BitCAS = true; - } --version( GNU ) -+else - { - enum has64BitCAS = false; - } ---- a/src/libphobos/libdruntime/core/bitop.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/bitop.d 2014-04-01 16:32:51.000000000 +0100 -@@ -76,9 +76,7 @@ unittest - * (No longer an intrisic - the compiler recognizes the patterns - * in the body.) - */ --@system --{ --int bt(in size_t* p, size_t bitnum) pure -+int bt(in size_t* p, size_t bitnum) pure @system - { - static if (size_t.sizeof == 8) - return ((p[bitnum >> 6] & (1L << (bitnum & 63)))) != 0; -@@ -87,38 +85,36 @@ int bt(in size_t* p, size_t bitnum) pure - else - static assert(0); - } -- --unittest -+/// -+@system pure unittest - { - size_t array[2]; - - array[0] = 2; - array[1] = 0x100; - -- - assert(bt(array.ptr, 1)); - assert(array[0] == 2); - assert(array[1] == 0x100); - } --} - - /** - * Tests and complements the bit. - */ --int btc(size_t* p, size_t bitnum) pure; -+int btc(size_t* p, size_t bitnum) pure @system; - - - /** - * Tests and resets (sets to 0) the bit. - */ --int btr(size_t* p, size_t bitnum) pure; -+int btr(size_t* p, size_t bitnum) pure @system; - - - /** - * Tests and sets the bit. - * Params: - * p = a non-NULL pointer to an array of size_ts. -- * index = a bit number, starting with bit 0 of p[0], -+ * bitnum = a bit number, starting with bit 0 of p[0], - * and progressing. It addresses bits like the expression: - --- - p[index / (size_t.sizeof*8)] & (1 << (index & ((size_t.sizeof*8) - 1))) -@@ -126,46 +122,11 @@ p[index / (size_t.sizeof*8)] & (1 << (in - * Returns: - * A non-zero value if the bit was set, and a zero - * if it was clear. -- * -- * Example: -- * --- --import std.stdio; --import core.bitop; -- --int main() --{ -- size_t array[2]; -- -- array[0] = 2; -- array[1] = 0x100; -- -- assert(btc(array, 35) == 0); -- assert(array[0] == 2); -- assert(array[1] == 0x108); -- -- assert(btc(array, 35)); -- assert(array[0] == 2); -- assert(array[1] == 0x100); -- -- assert(bts(array, 35) == 0); -- assert(array[0] == 2); -- assert(array[1] == 0x108); -- -- assert(btr(array, 35)); -- assert(array[0] == 2); -- assert(array[1] == 0x100); -- -- assert(bt(array, 1)); -- assert(array[0] == 2); -- assert(array[1] == 0x100); -- -- return 0; --} -- * --- - */ --int bts(size_t* p, size_t bitnum) pure; -+int bts(size_t* p, size_t bitnum) pure @system; - --unittest -+/// -+@system pure unittest - { - size_t array[2]; - ---- a/src/libphobos/libdruntime/core/cpuid.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/cpuid.d 2014-04-01 16:32:51.000000000 +0100 -@@ -175,6 +175,10 @@ public: - bool hle() {return (extfeatures & HLE_BIT) != 0;} - /// Is RTM (restricted transactional memory) supported - bool rtm() {return (extfeatures & RTM_BIT) != 0;} -+ /// Is rdseed supported -+ bool hasRdseed() {return (extfeatures&RDSEED_BIT)!=0;} -+ /// Is SHA supported -+ bool hasSha() {return (extfeatures&SHA_BIT)!=0;} - /// Is AMD 3DNOW supported? - bool amd3dnow() {return (amdfeatures&AMD_3DNOW_BIT)!=0;} - /// Is AMD 3DNOW Ext supported? -@@ -322,15 +326,17 @@ private: - // Feature flags for cpuid.{EAX = 7, ECX = 0}.EBX. - enum : uint - { -- FSGSBASE_BIT = 1 << 1, -- BMI1_BIT = 1 << 4, -- HLE_BIT = 1 << 5, -- AVX2_BIT = 1 << 6, -- SMEP_BIT = 1 << 8, -- BMI2_BIT = 1 << 9, -- ERMS_BIT = 1 << 10, -- INVPCID_BIT = 1 << 11, -- RTM_BIT = 1 << 12, -+ FSGSBASE_BIT = 1 << 0, -+ BMI1_BIT = 1 << 3, -+ HLE_BIT = 1 << 4, -+ AVX2_BIT = 1 << 5, -+ SMEP_BIT = 1 << 7, -+ BMI2_BIT = 1 << 8, -+ ERMS_BIT = 1 << 9, -+ INVPCID_BIT = 1 << 10, -+ RTM_BIT = 1 << 11, -+ RDSEED_BIT = 1 << 18, -+ SHA_BIT = 1 << 29, - } - // feature flags XFEATURES_ENABLED_MASK - enum : ulong -@@ -541,7 +547,7 @@ void getAMDcacheinfo() - mov d6, EDX; // L3 cache info - } - -- immutable ubyte [] assocmap = [ 0, 1, 2, 0, 4, 0, 8, 0, 16, 0, 32, 48, 64, 96, 128, 0xFF ]; -+ static immutable ubyte [] assocmap = [ 0, 1, 2, 0, 4, 0, 8, 0, 16, 0, 32, 48, 64, 96, 128, 0xFF ]; - datacache[1].size = (c6>>16) & 0xFFFF; - datacache[1].associativity = assocmap[(c6>>12)&0xF]; - datacache[1].lineSize = c6 & 0xFF; ---- a/src/libphobos/libdruntime/core/demangle.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/demangle.d 2014-04-01 16:32:51.000000000 +0100 -@@ -71,7 +71,7 @@ private struct Demangle - - static class ParseException : Exception - { -- this( string msg ) -+ @safe pure nothrow this( string msg ) - { - super( msg ); - } -@@ -80,7 +80,7 @@ private struct Demangle - - static class OverflowException : Exception - { -- this( string msg ) -+ @safe pure nothrow this( string msg ) - { - super( msg ); - } -@@ -113,7 +113,8 @@ private struct Demangle - static bool isAlpha( char val ) - { - return ('a' <= val && 'z' >= val) || -- ('A' <= val && 'Z' >= val); -+ ('A' <= val && 'Z' >= val) || -+ (0x80 & val); // treat all unicode as alphabetic - } - - -@@ -856,13 +857,8 @@ private struct Demangle - Y // variadic T t...) style - Z // not variadic - */ -- enum IsDelegate { no, yes } -- char[] parseTypeFunction( char[] name = null, IsDelegate isdg = IsDelegate.no ) -+ void parseCallConvention() - { -- debug(trace) printf( "parseTypeFunction+\n" ); -- debug(trace) scope(success) printf( "parseTypeFunction-\n" ); -- auto beg = len; -- - // CallConvention - switch( tok() ) - { -@@ -888,7 +884,10 @@ private struct Demangle - default: - error(); - } -+ } - -+ void parseFuncAttr() -+ { - // FuncAttrs - breakFuncAttrs: - while( 'N' == tok() ) -@@ -931,32 +930,10 @@ private struct Demangle - error(); - } - } -+ } - -- beg = len; -- put( "(" ); -- scope(success) -- { -- put( ")" ); -- auto t = len; -- parseType(); -- put( " " ); -- if( name.length ) -- { -- if( !contains( dst[0 .. len], name ) ) -- put( name ); -- else if( shift( name ).ptr != name.ptr ) -- { -- beg -= name.length; -- t -= name.length; -- } -- } -- else if( IsDelegate.yes == isdg ) -- put( "delegate" ); -- else -- put( "function" ); -- shift( dst[beg .. t] ); -- } -- -+ void parseFuncArguments() -+ { - // Arguments - for( size_t n = 0; true; n++ ) - { -@@ -966,14 +943,14 @@ private struct Demangle - case 'X': // ArgClose (variadic T t...) style) - next(); - put( "..." ); -- return dst[beg .. len]; -+ return; - case 'Y': // ArgClose (variadic T t,...) style) - next(); - put( ", ..." ); -- return dst[beg .. len]; -+ return; - case 'Z': // ArgClose (not variadic) - next(); -- return dst[beg .. len]; -+ return; - default: - break; - } -@@ -1009,6 +986,55 @@ private struct Demangle - } - } - -+ enum IsDelegate { no, yes } -+ // returns the argument list with the left parenthesis, but not the right -+ char[] parseTypeFunction( char[] name = null, IsDelegate isdg = IsDelegate.no ) -+ { -+ debug(trace) printf( "parseTypeFunction+\n" ); -+ debug(trace) scope(success) printf( "parseTypeFunction-\n" ); -+ auto beg = len; -+ -+ parseCallConvention(); -+ parseFuncAttr(); -+ -+ beg = len; -+ put( "(" ); -+ scope(success) -+ { -+ put( ")" ); -+ auto t = len; -+ parseType(); -+ put( " " ); -+ if( name.length ) -+ { -+ if( !contains( dst[0 .. len], name ) ) -+ put( name ); -+ else if( shift( name ).ptr != name.ptr ) -+ { -+ beg -= name.length; -+ t -= name.length; -+ } -+ } -+ else if( IsDelegate.yes == isdg ) -+ put( "delegate" ); -+ else -+ put( "function" ); -+ shift( dst[beg .. t] ); -+ } -+ parseFuncArguments(); -+ return dst[beg..len]; -+ } -+ -+ static bool isCallConvention( char ch ) -+ { -+ switch( ch ) -+ { -+ case 'F', 'U', 'V', 'W', 'R': -+ return true; -+ default: -+ return false; -+ } -+ } - - /* - Value: -@@ -1211,7 +1237,8 @@ private struct Demangle - if( num >= 0x20 && num < 0x7F ) - { - put( "'" ); -- put( __ctfe ? [cast(char)num] : (cast(char*) &num)[0 .. 1] ); -+ char[1] tmp = cast(char)num; -+ put( tmp[] ); - put( "'" ); - return; - } -@@ -1397,6 +1424,36 @@ private struct Demangle - if( n++ ) - put( "." ); - parseSymbolName(); -+ -+ if( isCallConvention( tok() ) ) -+ { -+ // try to demangle a function, in case we are pointing to some function local -+ auto prevpos = pos; -+ auto prevlen = len; -+ -+ // we don't want calling convention and attributes in the qualified name -+ parseCallConvention(); -+ parseFuncAttr(); -+ len = prevlen; -+ -+ put( "(" ); -+ parseFuncArguments(); -+ put( ")" ); -+ if( !isDigit( tok() ) ) // voldemort types don't have a return type on the function -+ { -+ auto funclen = len; -+ parseType(); -+ -+ if( !isDigit( tok() ) ) -+ { -+ // not part of a qualified name, so back up -+ pos = prevpos; -+ len = prevlen; -+ } -+ else -+ len = funclen; // remove return type from qualified name -+ } -+ } - } while( isDigit( tok() ) ); - return dst[beg .. len]; - } -@@ -1430,14 +1487,14 @@ private struct Demangle - } - - -- char[] opCall() -+ char[] doDemangle(alias FUNC)() - { - while( true ) - { - try - { - debug(info) printf( "demangle(%.*s)\n", cast(int) buf.length, buf.ptr ); -- parseMangledName(); -+ FUNC(); - return dst[0 .. len]; - } - catch( OverflowException e ) -@@ -1465,6 +1522,16 @@ private struct Demangle - } - } - } -+ -+ char[] demangleName() -+ { -+ return doDemangle!parseMangledName(); -+ } -+ -+ char[] demangleType() -+ { -+ return doDemangle!parseType(); -+ } - } - - -@@ -1484,7 +1551,214 @@ char[] demangle( const(char)[] buf, char - { - //return Demangle(buf, dst)(); - auto d = Demangle(buf, dst); -- return d(); -+ return d.demangleName(); -+} -+ -+ -+/** -+ * Demangles a D mangled type. -+ * -+ * Params: -+ * buf = The string to demangle. -+ * dst = An optional destination buffer. -+ * -+ * Returns: -+ * The demangled type name or the original string if the name is not a -+ * mangled D type. -+*/ -+char[] demangleType( const(char)[] buf, char[] dst = null ) -+{ -+ auto d = Demangle(buf, dst); -+ return d.demangleType(); -+} -+ -+ -+/** -+ * Mangles a D symbol. -+ * -+ * Params: -+ * T = The type of the symbol. -+ * fqn = The fully qualified name of the symbol. -+ * dst = An optional destination buffer. -+ * -+ * Returns: -+ * The mangled name for a symbols of type T and the given fully -+ * qualified name. -+ */ -+char[] mangle(T)(const(char)[] fqn, char[] dst = null) @safe pure nothrow -+{ -+ static size_t numToString(char[] dst, size_t val) @safe pure nothrow -+ { -+ char[20] buf = void; -+ size_t i = buf.length; -+ do -+ { -+ buf[--i] = cast(char)(val % 10 + '0'); -+ } while (val /= 10); -+ immutable len = buf.length - i; -+ if (dst.length >= len) -+ dst[0 .. len] = buf[i .. $]; -+ return len; -+ } -+ -+ static struct DotSplitter -+ { -+ @safe pure nothrow: -+ const(char)[] s; -+ -+ @property bool empty() const { return !s.length; } -+ -+ @property const(char)[] front() const -+ { -+ immutable i = indexOfDot(); -+ return i == -1 ? s[0 .. $] : s[0 .. i]; -+ } -+ -+ void popFront() -+ { -+ immutable i = indexOfDot(); -+ s = i == -1 ? s[$ .. $] : s[i+1 .. $]; -+ } -+ -+ private ptrdiff_t indexOfDot() const -+ { -+ foreach (i, c; s) if (c == '.') return i; -+ return -1; -+ } -+ } -+ -+ size_t len = "_D".length; -+ foreach (comp; DotSplitter(fqn)) -+ len += numToString(null, comp.length) + comp.length; -+ len += T.mangleof.length; -+ if (dst.length < len) dst.length = len; -+ -+ size_t i = "_D".length; -+ dst[0 .. i] = "_D"; -+ foreach (comp; DotSplitter(fqn)) -+ { -+ i += numToString(dst[i .. $], comp.length); -+ dst[i .. i + comp.length] = comp[]; -+ i += comp.length; -+ } -+ dst[i .. i + T.mangleof.length] = T.mangleof[]; -+ i += T.mangleof.length; -+ return dst[0 .. i]; -+} -+ -+ -+/// -+unittest -+{ -+ assert(mangle!int("a.b") == "_D1a1bi"); -+ assert(mangle!(char[])("test.foo") == "_D4test3fooAa"); -+ assert(mangle!(int function(int))("a.b") == "_D1a1bPFiZi"); -+} -+ -+unittest -+{ -+ static assert(mangle!int("a.b") == "_D1a1bi"); -+ -+ auto buf = new char[](10); -+ buf = mangle!int("a.b", buf); -+ assert(buf == "_D1a1bi"); -+ buf = mangle!(char[])("test.foo", buf); -+ assert(buf == "_D4test3fooAa"); -+ buf = mangle!(real delegate(int))("modµ.dg"); -+ assert(buf == "_D5modµ2dgDFiZe", buf); -+} -+ -+ -+/** -+ * Mangles a D function. -+ * -+ * Params: -+ * T = function pointer type. -+ * fqn = The fully qualified name of the symbol. -+ * dst = An optional destination buffer. -+ * -+ * Returns: -+ * The mangled name for a function with function pointer type T and -+ * the given fully qualified name. -+ */ -+char[] mangleFunc(T:FT*, FT)(const(char)[] fqn, char[] dst = null) @safe pure nothrow if (is(FT == function)) -+{ -+ static if (isExternD!FT) -+ { -+ return mangle!FT(fqn, dst); -+ } -+ else static if (hasPlainMangling!FT) -+ { -+ dst.length = fqn.length; -+ dst[] = fqn[]; -+ return dst; -+ } -+ else static if (isExternCPP!FT) -+ { -+ static assert(0, "Can't mangle extern(C++) functions."); -+ } -+ else -+ { -+ static assert(0, "Can't mangle function with unknown linkage ("~FT.stringof~")."); -+ } -+} -+ -+ -+/// -+unittest -+{ -+ assert(mangleFunc!(int function(int))("a.b") == "_D1a1bFiZi"); -+ assert(mangleFunc!(int function(Object))("object.Object.opEquals") == "_D6object6Object8opEqualsFC6ObjectZi"); -+} -+ -+unittest -+{ -+ int function(lazy int[], ...) fp; -+ assert(mangle!(typeof(fp))("demangle.test") == "_D8demangle4testPFLAiYi"); -+ assert(mangle!(typeof(*fp))("demangle.test") == "_D8demangle4testFLAiYi"); -+} -+ -+private template isExternD(FT) if (is(FT == function)) -+{ -+ enum isExternD = FT.mangleof[0] == 'F'; -+} -+ -+private template isExternCPP(FT) if (is(FT == function)) -+{ -+ enum isExternCPP = FT.mangleof[0] == 'R'; -+} -+ -+private template hasPlainMangling(FT) if (is(FT == function)) -+{ -+ enum c = FT.mangleof[0]; -+ // C || Pascal || Windows -+ enum hasPlainMangling = c == 'U' || c == 'V' || c == 'W'; -+} -+ -+unittest -+{ -+ static extern(D) void fooD(); -+ static extern(C) void fooC(); -+ static extern(Pascal) void fooP(); -+ static extern(Windows) void fooW(); -+ static extern(C++) void fooCPP(); -+ -+ bool check(FT)(bool isD, bool isCPP, bool isPlain) -+ { -+ return isExternD!FT == isD && isExternCPP!FT == isCPP && -+ hasPlainMangling!FT == isPlain; -+ } -+ static assert(check!(typeof(fooD))(true, false, false)); -+ static assert(check!(typeof(fooC))(false, false, true)); -+ static assert(check!(typeof(fooP))(false, false, true)); -+ static assert(check!(typeof(fooW))(false, false, true)); -+ static assert(check!(typeof(fooCPP))(false, true, false)); -+ -+ static assert(__traits(compiles, mangleFunc!(typeof(&fooD))(""))); -+ static assert(__traits(compiles, mangleFunc!(typeof(&fooC))(""))); -+ static assert(__traits(compiles, mangleFunc!(typeof(&fooP))(""))); -+ static assert(__traits(compiles, mangleFunc!(typeof(&fooW))(""))); -+ static assert(!__traits(compiles, mangleFunc!(typeof(&fooCPP))(""))); - } - - -@@ -1510,9 +1784,9 @@ version(unittest) - ["_D6plugin8generateFiiZAya", "immutable(char)[] plugin.generate(int, int)"], - ["_D6plugin8generateFiiZAxa", "const(char)[] plugin.generate(int, int)"], - ["_D6plugin8generateFiiZAOa", "shared(char)[] plugin.generate(int, int)"], -- ["_D8demangle3fnAFZv3fnBMFZv", "void demangle.fnA().void fnB()"], -- ["_D8demangle4mainFZv1S3fnCFZv", "void demangle.main().void S.fnC()"], -- ["_D8demangle4mainFZv1S3fnDMFZv", "void demangle.main().void S.fnD()"], -+ ["_D8demangle3fnAFZv3fnBMFZv", "void demangle.fnA().fnB()"], -+ ["_D8demangle4mainFZv1S3fnCFZv", "void demangle.main().S.fnC()"], -+ ["_D8demangle4mainFZv1S3fnDMFZv", "void demangle.main().S.fnD()"], - ["_D8demangle20__T2fnVAiA4i1i2i3i4Z2fnFZv", "void demangle.fn!([1, 2, 3, 4]).fn()"], - ["_D8demangle10__T2fnVi1Z2fnFZv", "void demangle.fn!(1).fn()"], - ["_D8demangle26__T2fnVS8demangle1SS2i1i2Z2fnFZv", "void demangle.fn!(demangle.S(1, 2)).fn()"], -@@ -1521,7 +1795,12 @@ version(unittest) - ["_D8demangle13__T2fnVeeINFZ2fnFZv", "void demangle.fn!(real.infinity).fn()"], - ["_D8demangle21__T2fnVHiiA2i1i2i3i4Z2fnFZv", "void demangle.fn!([1:2, 3:4]).fn()"], - ["_D8demangle2fnFNgiZNgi", "inout(int) demangle.fn(inout(int))"], -- ["_D8demangle29__T2fnVa97Va9Va0Vu257Vw65537Z2fnFZv", "void demangle.fn!('a', '\\t', \\x00, '\\u0101', '\\U00010001').fn()"] -+ ["_D8demangle29__T2fnVa97Va9Va0Vu257Vw65537Z2fnFZv", "void demangle.fn!('a', '\\t', \\x00, '\\u0101', '\\U00010001').fn()"], -+ ["_D2gc11gctemplates56__T8mkBitmapTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ8mkBitmapFNbNfPmmZv", -+ "nothrow @safe void gc.gctemplates.mkBitmap!(std.range.iota!(int, int).iota(int, int).Result).mkBitmap(ulong*, ulong)"], -+ ["_D8serenity9persister6Sqlite70__T15SqlitePersisterTS8serenity9persister6Sqlite11__unittest6FZv4TestZ15SqlitePersister12__T7opIndexZ7opIndexMFmZS8serenity9persister6Sqlite11__unittest6FZv4Test", -+ "serenity.persister.Sqlite.__unittest6().Test serenity.persister.Sqlite.SqlitePersister!(serenity.persister.Sqlite.__unittest6().Test).SqlitePersister.opIndex!().opIndex(ulong)"], -+ ["_D8bug100274mainFZv5localMFZi","int bug10027.main().local()"], - ]; - - template staticIota(int x) ---- a/src/libphobos/libdruntime/core/exception.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/exception.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,39 +2,24 @@ - * The exception module defines all system-level exceptions and provides a - * mechanism to alter system-level error handling. - * -- * Copyright: Copyright Sean Kelly 2005 - 2011. -- * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) -+ * Copyright: Copyright Sean Kelly 2005 - 2013. -+ * License: Distributed under the -+ * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). -+ * (See accompanying file LICENSE) - * Authors: Sean Kelly and Jonathan M Davis - * Source: $(DRUNTIMESRC core/_exception.d) - */ -- --/* Copyright Sean Kelly 2005 - 2011. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ - module core.exception; - - import core.stdc.stdio; - --private --{ -- alias void function( string file, size_t line, string msg ) errorHandlerType; -- -- // NOTE: One assert handler is used for all threads. Thread-local -- // behavior should occur within the handler itself. This delegate -- // is __gshared for now based on the assumption that it will only -- // set by the main thread during program initialization. -- __gshared errorHandlerType assertHandler = null; --} -- - - /** - * Thrown on a range error. - */ - class RangeError : Error - { -- this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( "Range violation", file, line, next ); - } -@@ -65,17 +50,17 @@ unittest - */ - class AssertError : Error - { -- this( string file, size_t line ) -+ @safe pure nothrow this( string file, size_t line ) - { - this(cast(Throwable)null, file, line); - } - -- this( Throwable next, string file = __FILE__, size_t line = __LINE__ ) -+ @safe pure nothrow this( Throwable next, string file = __FILE__, size_t line = __LINE__ ) - { - this( "Assertion failure", file, line, next); - } - -- this( string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this( string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( msg, file, line, next ); - } -@@ -140,12 +125,12 @@ class FinalizeError : Error - { - ClassInfo info; - -- this( ClassInfo ci, Throwable next, string file = __FILE__, size_t line = __LINE__ ) -+ @safe pure nothrow this( ClassInfo ci, Throwable next, string file = __FILE__, size_t line = __LINE__ ) - { - this(ci, file, line, next); - } - -- this( ClassInfo ci, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this( ClassInfo ci, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( "Finalization error", file, line, next ); - info = ci; -@@ -205,7 +190,7 @@ unittest - */ - class HiddenFuncError : Error - { -- this( ClassInfo ci ) -+ @safe pure nothrow this( ClassInfo ci ) - { - super( "Hidden method called for " ~ ci.name ); - } -@@ -229,7 +214,7 @@ unittest - */ - class OutOfMemoryError : Error - { -- this(string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this(string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( "Memory allocation failed", file, line, next ); - } -@@ -270,7 +255,7 @@ unittest - */ - class InvalidMemoryOperationError : Error - { -- this(string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this(string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( "Invalid memory operation", file, line, next ); - } -@@ -306,7 +291,7 @@ unittest - */ - class SwitchError : Error - { -- this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ @safe pure nothrow this( string file = __FILE__, size_t line = __LINE__, Throwable next = null ) - { - super( "No appropriate switch clause found", file, line, next ); - } -@@ -339,7 +324,7 @@ class UnicodeException : Exception - { - size_t idx; - -- this( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) -+ this( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__, Throwable next = null ) @safe pure nothrow - { - super( msg, file, line, next ); - this.idx = idx; -@@ -373,13 +358,39 @@ unittest - /////////////////////////////////////////////////////////////////////////////// - - -+// NOTE: One assert handler is used for all threads. Thread-local -+// behavior should occur within the handler itself. This delegate -+// is __gshared for now based on the assumption that it will only -+// set by the main thread during program initialization. -+private __gshared AssertHandler _assertHandler = null; -+ -+ -+/** -+Gets/sets assert hander. null means the default handler is used. -+*/ -+alias AssertHandler = void function(string file, size_t line, string msg) nothrow; -+ -+/// ditto -+@property AssertHandler assertHandler() @trusted nothrow -+{ -+ return _assertHandler; -+} -+ -+/// ditto -+@property void assertHandler(AssertHandler handler) @trusted nothrow -+{ -+ _assertHandler = handler; -+} -+ - /** - * Overrides the default assert hander with a user-supplied version. -+ * $(RED Deprecated. -+ * Please use $(LREF assertHandler) instead.) - * - * Params: - * h = The new assert handler. Set to null to use the default handler. - */ --void setAssertHandler( errorHandlerType h ) -+deprecated void setAssertHandler( AssertHandler h ) @trusted nothrow - { - assertHandler = h; - } -@@ -398,11 +409,11 @@ void setAssertHandler( errorHandlerType - * file = The name of the file that signaled this error. - * line = The line number on which this error occurred. - */ --extern (C) void onAssertError( string file = __FILE__, size_t line = __LINE__ ) -+extern (C) void onAssertError( string file = __FILE__, size_t line = __LINE__ ) nothrow - { -- if( assertHandler is null ) -+ if( _assertHandler is null ) - throw new AssertError( file, line ); -- assertHandler( file, line, null); -+ _assertHandler( file, line, null); - } - - -@@ -415,11 +426,11 @@ extern (C) void onAssertError( string fi - * line = The line number on which this error occurred. - * msg = An error message supplied by the user. - */ --extern (C) void onAssertErrorMsg( string file, size_t line, string msg ) -+extern (C) void onAssertErrorMsg( string file, size_t line, string msg ) nothrow - { -- if( assertHandler is null ) -+ if( _assertHandler is null ) - throw new AssertError( msg, file, line ); -- assertHandler( file, line, msg ); -+ _assertHandler( file, line, msg ); - } - - -@@ -433,7 +444,7 @@ extern (C) void onAssertErrorMsg( string - * line = The line number on which this error occurred. - * msg = An error message supplied by the user. - */ --extern (C) void onUnittestErrorMsg( string file, size_t line, string msg ) -+extern (C) void onUnittestErrorMsg( string file, size_t line, string msg ) nothrow - { - onAssertErrorMsg( file, line, msg ); - } -@@ -454,7 +465,7 @@ extern (C) void onUnittestErrorMsg( stri - * Throws: - * RangeError. - */ --extern (C) void onRangeError( string file = __FILE__, size_t line = __LINE__ ) -+extern (C) void onRangeError( string file = __FILE__, size_t line = __LINE__ ) @safe pure nothrow - { - throw new RangeError( file, line, null ); - } -@@ -464,12 +475,15 @@ extern (C) void onRangeError( string fil - * A callback for finalize errors in D. A FinalizeError will be thrown. - * - * Params: -+ * info = The ClassInfo instance for the object that failed finalization. - * e = The exception thrown during finalization. -+ * file = The name of the file that signaled this error. -+ * line = The line number on which this error occurred. - * - * Throws: - * FinalizeError. - */ --extern (C) void onFinalizeError( ClassInfo info, Exception e, string file = __FILE__, size_t line = __LINE__ ) -+extern (C) void onFinalizeError( ClassInfo info, Exception e, string file = __FILE__, size_t line = __LINE__ ) @safe pure nothrow - { - throw new FinalizeError( info, file, line, e ); - } -@@ -482,7 +496,7 @@ extern (C) void onFinalizeError( ClassIn - * Throws: - * HiddenFuncError. - */ --extern (C) void onHiddenFuncError( Object o ) -+extern (C) void onHiddenFuncError( Object o ) @safe pure nothrow - { - throw new HiddenFuncError( o.classinfo ); - } -@@ -495,7 +509,7 @@ extern (C) void onHiddenFuncError( Objec - * Throws: - * OutOfMemoryError. - */ --extern (C) void onOutOfMemoryError() -+extern (C) void onOutOfMemoryError() @trusted pure nothrow - { - // NOTE: Since an out of memory condition exists, no allocation must occur - // while generating this object. -@@ -510,7 +524,7 @@ extern (C) void onOutOfMemoryError() - * Throws: - * InvalidMemoryOperationError. - */ --extern (C) void onInvalidMemoryOperationError() -+extern (C) void onInvalidMemoryOperationError() @trusted pure nothrow - { - // The same restriction applies as for onOutOfMemoryError. The GC is in an - // undefined state, thus no allocation must occur while generating this object. -@@ -529,7 +543,7 @@ extern (C) void onInvalidMemoryOperation - * Throws: - * SwitchError. - */ --extern (C) void onSwitchError( string file = __FILE__, size_t line = __LINE__ ) -+extern (C) void onSwitchError( string file = __FILE__, size_t line = __LINE__ ) @safe pure nothrow - { - throw new SwitchError( file, line, null ); - } -@@ -541,11 +555,125 @@ extern (C) void onSwitchError( string fi - * Params: - * msg = Information about the error. - * idx = String index where this error was detected. -+ * file = The name of the file that signaled this error. -+ * line = The line number on which this error occurred. - * - * Throws: - * UnicodeException. - */ --extern (C) void onUnicodeError( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__ ) -+extern (C) void onUnicodeError( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__ ) @safe pure - { - throw new UnicodeException( msg, idx, file, line ); - } -+ -+/*********************************** -+ * These functions must be defined for any D program linked -+ * against this library. -+ */ -+/+ -+extern (C) void onAssertError(string file, size_t line); -+extern (C) void onAssertErrorMsg(string file, size_t line, string msg); -+extern (C) void onUnittestErrorMsg(string file, size_t line, string msg); -+extern (C) void onRangeError(string file, size_t line); -+extern (C) void onHiddenFuncError(Object o); -+extern (C) void onSwitchError(string file, size_t line); -++/ -+ -+/*********************************** -+ * Function calls to these are generated by the compiler and inserted into -+ * the object code. -+ */ -+ -+extern (C) -+{ -+ // Use ModuleInfo to get file name for "m" versions -+ -+ /* One of these three is called upon an assert() fail. -+ */ -+ void _d_assertm(ModuleInfo* m, uint line) -+ { -+ onAssertError(m.name, line); -+ } -+ -+ void _d_assert_msg(string msg, string file, uint line) -+ { -+ onAssertErrorMsg(file, line, msg); -+ } -+ -+ void _d_assert(string file, uint line) -+ { -+ onAssertError(file, line); -+ } -+ -+ /* One of these three is called upon an assert() fail inside of a unittest block -+ */ -+ void _d_unittestm(ModuleInfo* m, uint line) -+ { -+ _d_unittest(m.name, line); -+ } -+ -+ void _d_unittest_msg(string msg, string file, uint line) -+ { -+ onUnittestErrorMsg(file, line, msg); -+ } -+ -+ void _d_unittest(string file, uint line) -+ { -+ _d_unittest_msg("unittest failure", file, line); -+ } -+ -+ /* Called when an array index is out of bounds -+ */ -+ void _d_array_boundsm(ModuleInfo* m, uint line) -+ { -+ onRangeError(m.name, line); -+ } -+ -+ void _d_array_bounds(string file, uint line) -+ { -+ onRangeError(file, line); -+ } -+ -+ /* Called when a switch statement has no DefaultStatement, yet none of the cases match -+ */ -+ void _d_switch_errorm(ModuleInfo* m, uint line) -+ { -+ onSwitchError(m.name, line); -+ } -+ -+ void _d_switch_error(string file, uint line) -+ { -+ onSwitchError(file, line); -+ } -+ -+ version (GNU) -+ { -+ void _d_hidden_func(Object o) -+ { -+ onHiddenFuncError(o); -+ } -+ } -+ else -+ { -+ void _d_hidden_func() -+ { -+ Object o; -+ version(D_InlineAsm_X86) -+ asm -+ { -+ mov o, EAX; -+ } -+ else version(D_InlineAsm_X86_64) -+ asm -+ { -+ mov o, RDI; -+ } -+ else -+ static assert(0, "unknown os"); -+ -+ onHiddenFuncError(o); -+ } -+ } -+} -+ -+ ---- a/src/libphobos/libdruntime/core/memory.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/memory.d 2014-04-01 16:32:51.000000000 +0100 -@@ -189,7 +189,28 @@ struct GC - FINALIZE = 0b0000_0001, /// Finalize the data in this block on collect. - NO_SCAN = 0b0000_0010, /// Do not scan through this block on collect. - NO_MOVE = 0b0000_0100, /// Do not move this memory block on collect. -- APPENDABLE = 0b0000_1000, /// This block contains the info to allow appending. -+ /** -+ This block contains the info to allow appending. -+ -+ This can be used to manually allocate arrays. Initial slice size is 0. -+ -+ Note: The slice's useable size will not match the block size. Use -+ $(LREF capacity) to retrieve actual useable capacity. -+ -+ Example: -+ ---- -+ // Allocate the underlying array. -+ int* pToArray = cast(int*)GC.malloc(10 * int.sizeof, GC.BlkAttr.NO_SCAN | GC.BlkAttr.APPENDABLE); -+ // Bind a slice. Check the slice has capacity information. -+ int[] slice = pToArray[0 .. 0]; -+ assert(capacity(slice) > 0); -+ // Appending to the slice will not relocate it. -+ slice.length = 5; -+ slice ~= 1; -+ assert(slice.ptr == p); -+ ---- -+ */ -+ APPENDABLE = 0b0000_1000, - - /** - This block is guaranteed to have a pointer to its base while it is -@@ -407,22 +428,58 @@ struct GC - /** - * Requests that the managed memory block referenced by p be extended in - * place by at least mx bytes, with a desired extension of sz bytes. If an -- * extension of the required size is not possible, if p references memory -- * not originally allocated by this garbage collector, or if p points to -- * the interior of a memory block, no action will be taken. -+ * extension of the required size is not possible or if p references memory -+ * not originally allocated by this garbage collector, no action will be -+ * taken. - * - * Params: -+ * p = A pointer to the root of a valid memory block or to null. - * mx = The minimum extension size in bytes. -- * sz = The desired extension size in bytes. -+ * sz = The desired extension size in bytes. - * - * Returns: - * The size in bytes of the extended memory block referenced by p or zero - * if no extension occurred. -+ * -+ * Note: -+ * Extend may also be used to extend slices (or memory blocks with -+ * $(LREF APPENDABLE) info). However, use the return value only -+ * as an indicator of success. $(LREF capacity) should be used to -+ * retrieve actual useable slice capacity. - */ - static size_t extend( void* p, size_t mx, size_t sz ) pure nothrow - { - return gc_extend( p, mx, sz ); - } -+ /// Standard extending -+ unittest -+ { -+ size_t size = 1000; -+ int* p = cast(int*)GC.malloc(size * int.sizeof, GC.BlkAttr.NO_SCAN); -+ -+ //Try to extend the allocated data by 1000 elements, preferred 2000. -+ size_t u = GC.extend(p, 1000 * int.sizeof, 2000 * int.sizeof); -+ if (u != 0) -+ size = u / int.sizeof; -+ } -+ /// slice extending -+ unittest -+ { -+ int[] slice = new int[](1000); -+ int* p = slice.ptr; -+ -+ //Check we have access to capacity before attempting the extend -+ if (slice.capacity) -+ { -+ //Try to extend slice by 1000 elements, preferred 2000. -+ size_t u = GC.extend(p, 1000 * int.sizeof, 2000 * int.sizeof); -+ if (u != 0) -+ { -+ slice.length = slice.capacity; -+ assert(slice.length >= 2000); -+ } -+ } -+ } - - - /** -@@ -511,6 +568,16 @@ struct GC - return gc_sizeOf( p ); - } - -+ // verify that the reallocation doesn't leave the size cache in a wrong state -+ unittest -+ { -+ auto data = cast(int*)realloc(null, 4096); -+ size_t size = GC.sizeOf(data); -+ assert(size >= 4096); -+ data = cast(int*)GC.realloc(data, 4100); -+ size = GC.sizeOf(data); -+ assert(size >= 4100); -+ } - - /** - * Returns aggregate information about the memory block containing p. If p ---- a/src/libphobos/libdruntime/core/runtime.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/runtime.d 2014-04-01 16:32:51.000000000 +0100 -@@ -14,37 +14,20 @@ - */ - module core.runtime; - --/* -- * Configuration stuff for backtraces -- * Versions: -- * HaveDLADDR = the extern(C) dladdr function is available -- * GenericBacktrace = Use GCC unwinding for backtraces -- * -- * TODO: HaveDLADDR should be set by the configure script -- */ -+version (Windows) import core.stdc.wchar_ : wchar_t; - --version(Android) --{ -- version = HaveDLADDR; -- version = GenericBacktrace; --} --else version(Windows) --{ -- version = WindowsBacktrace; --} --else version(linux) --{ -- //assume GLIBC backtrace function exists, not always correct! -- version = GlibcBacktrace; --} --else version(OSX) --{ -- version = OSXBacktrace; --} --else version(GNU) --{ -- version = GenericBacktrace; --} -+ -+/// C interface for Runtime.loadLibrary -+extern (C) void* rt_loadLibrary(const char* name); -+/// ditto -+version (Windows) extern (C) void* rt_loadLibraryW(const wchar_t* name); -+/// C interface for Runtime.unloadLibrary, returns 1/0 instead of bool -+extern (C) int rt_unloadLibrary(void* ptr); -+ -+/// C interface for Runtime.initialize, returns 1/0 instead of bool -+extern(C) int rt_init(); -+/// C interface for Runtime.terminate, returns 1/0 instead of bool -+extern(C) int rt_term(); - - private - { -@@ -59,72 +42,24 @@ private - extern (C) TraceHandler rt_getTraceHandler(); - - alias void delegate( Throwable ) ExceptionHandler; -- extern (C) bool rt_init( ExceptionHandler dg = null ); -- extern (C) bool rt_term( ExceptionHandler dg = null ); -- -- extern (C) void* rt_loadLibrary( in char[] name ); -- extern (C) bool rt_unloadLibrary( void* ptr ); - - extern (C) void* thread_stackBottom(); - - extern (C) string[] rt_args(); - extern (C) CArgs rt_cArgs(); - -- version(HaveDLADDR) -- { -- extern(C) -- { -- int dladdr(void *addr, Dl_info *info); -- struct Dl_info -- { -- const (char*) dli_fname; /* Pathname of shared object that -- contains address */ -- void* dli_fbase; /* Address at which shared object -- is loaded */ -- const (char*) dli_sname; /* Name of nearest symbol with address -- lower than addr */ -- void* dli_saddr; /* Exact address of symbol named -- in dli_sname */ -- } -- } -- } -- -- version(GenericBacktrace) -- { -- import gcc.unwind; -- import core.demangle; -- import core.stdc.stdio : snprintf, printf; -- import core.stdc.string : strlen; -- -- version(Posix) -- import core.sys.posix.signal; // segv handler -- } -- else version(GlibcBacktrace) -- { -- import core.demangle; -- import core.stdc.stdlib : free; -- import core.stdc.string : strlen, memchr; -- extern (C) int backtrace(void**, int); -- extern (C) char** backtrace_symbols(void**, int); -- extern (C) void backtrace_symbols_fd(void**, int, int); -- -- version(Posix) -- import core.sys.posix.signal; // segv handler -- } -- else version(OSXBacktrace) -- { -- import core.demangle; -- import core.stdc.stdlib : free; -- import core.stdc.string : strlen; -- extern (C) int backtrace(void**, int); -- extern (C) char** backtrace_symbols(void**, int); -- extern (C) void backtrace_symbols_fd(void**, int, int); -- import core.sys.posix.signal; // segv handler -- } -- else version(WindowsBacktrace) -- { -+ // backtrace -+ version(GNU) -+ import gcc.backtrace; -+ -+ version( linux ) -+ import core.sys.linux.execinfo; -+ else version( OSX ) -+ import core.sys.osx.execinfo; -+ else version( FreeBSD ) -+ import core.sys.freebsd.execinfo; -+ else version( Windows ) - import core.sys.windows.stacktrace; -- } - - // For runModuleUnitTests error reporting. - version( Windows ) -@@ -172,18 +107,21 @@ struct Runtime - * Initializes the runtime. This call is to be used in instances where the - * standard program initialization process is not executed. This is most - * often in shared libraries or in libraries linked to a C program. -- * -- * Params: -- * dg = A delegate which will receive any exception thrown during the -- * initialization process or null if such exceptions should be -- * discarded. -+ * If the runtime was already successfully initialized this returns true. -+ * Each call to initialize must be paired by a call to $(LREF, terminate). - * - * Returns: -- * true if initialization succeeds and false if initialization fails. -+ * true if initialization succeeded or false if initialization failed. - */ -- static bool initialize( ExceptionHandler dg = null ) -+ static bool initialize() - { -- return rt_init( dg ); -+ return !!rt_init(); -+ } -+ -+ deprecated("Please use the overload of Runtime.initialize that takes no argument.") -+ static bool initialize(ExceptionHandler dg = null) -+ { -+ return !!rt_init(); - } - - -@@ -191,18 +129,20 @@ struct Runtime - * Terminates the runtime. This call is to be used in instances where the - * standard program termination process will not be not executed. This is - * most often in shared libraries or in libraries linked to a C program. -- * -- * Params: -- * dg = A delegate which will receive any exception thrown during the -- * termination process or null if such exceptions should be -- * discarded. -+ * If the runtime was not successfully initialized the function returns false. - * - * Returns: -- * true if termination succeeds and false if termination fails. -+ * true if termination succeeded or false if termination failed. - */ -- static bool terminate( ExceptionHandler dg = null ) -+ static bool terminate() -+ { -+ return !!rt_term(); -+ } -+ -+ deprecated("Please use the overload of Runtime.terminate that takes no argument.") -+ static bool terminate(ExceptionHandler dg = null) - { -- return rt_term( dg ); -+ return !!rt_term(); - } - - -@@ -218,11 +158,25 @@ struct Runtime - } - - /** -- * Returns the unprocessed C arguments supplied when the process was -- * started. Use this when you need to supply argc and argv to C libraries. -+ * Returns the unprocessed C arguments supplied when the process was started. -+ * Use this when you need to supply argc and argv to C libraries. - * - * Returns: - * A $(LREF CArgs) struct with the arguments supplied when this process was started. -+ * -+ * Example: -+ * --- -+ * import core.runtime; -+ * -+ * // A C library function requiring char** arguments -+ * extern(C) void initLibFoo(int argc, char** argv); -+ * -+ * void main() -+ * { -+ * auto args = Runtime.cArgs; -+ * initLibFoo(args.argc, args.argv); -+ * } -+ * --- - */ - static @property CArgs cArgs() - { -@@ -240,9 +194,47 @@ struct Runtime - * Returns: - * A reference to the library or null on error. - */ -- static void* loadLibrary( in char[] name ) -+ static void* loadLibrary()(in char[] name) - { -- return rt_loadLibrary( name ); -+ import core.stdc.stdlib : free, malloc; -+ version (Windows) -+ { -+ import core.sys.windows.windows; -+ -+ if (name.length == 0) return null; -+ // Load a DLL at runtime -+ auto len = MultiByteToWideChar( -+ CP_UTF8, 0, name.ptr, cast(int)name.length, null, 0); -+ if (len == 0) -+ return null; -+ -+ auto buf = cast(wchar_t*)malloc((len+1) * wchar_t.sizeof); -+ if (buf is null) return null; -+ scope (exit) free(buf); -+ -+ len = MultiByteToWideChar( -+ CP_UTF8, 0, name.ptr, cast(int)name.length, buf, len); -+ if (len == 0) -+ return null; -+ -+ buf[len] = '\0'; -+ -+ return rt_loadLibraryW(buf); -+ } -+ else version (Posix) -+ { -+ /* Need a 0-terminated C string for the dll name -+ */ -+ immutable len = name.length; -+ auto buf = cast(char*)malloc(len + 1); -+ if (!buf) return null; -+ scope (exit) free(buf); -+ -+ buf[0 .. len] = name[]; -+ buf[len] = 0; -+ -+ return rt_loadLibrary(buf); -+ } - } - - -@@ -254,9 +246,9 @@ struct Runtime - * Params: - * p = A reference to the library to unload. - */ -- static bool unloadLibrary( void* p ) -+ static bool unloadLibrary()(void* p) - { -- return rt_unloadLibrary( p ); -+ return !!rt_unloadLibrary(p); - } - - -@@ -366,7 +358,49 @@ private: - */ - extern (C) bool runModuleUnitTests() - { -- static if( __traits( compiles, backtrace ) ) -+ static if( __traits( compiles, new LibBacktrace(0) ) ) -+ { -+ import core.sys.posix.signal; // segv handler -+ -+ static extern (C) void unittestSegvHandler( int signum, siginfo_t* info, void* ptr ) -+ { -+ import core.stdc.stdio; -+ fprintf(stderr, "Segmentation fault while running unittests:\n"); -+ fprintf(stderr, "----------------\n"); -+ -+ enum alignment = LibBacktrace.MaxAlignment; -+ enum classSize = __traits(classInstanceSize, LibBacktrace); -+ -+ byte[classSize + alignment] bt_store = void; -+ byte* alignedAddress = cast(byte*)((cast(size_t)(bt_store.ptr + alignment - 1)) -+ & ~(alignment - 1)); -+ -+ (alignedAddress[0 .. classSize]) = typeid(LibBacktrace).init[]; -+ auto bt = cast(LibBacktrace)(alignedAddress); -+ // First frame is LibBacktrace ctor. Second is signal handler, but include that for now -+ bt.__ctor(1); -+ -+ foreach(size_t i, const(char[]) msg; bt) -+ fprintf(stderr, "%s\n", msg.ptr ? msg.ptr : "???"); -+ } -+ -+ sigaction_t action = void; -+ sigaction_t oldseg = void; -+ sigaction_t oldbus = void; -+ -+ (cast(byte*) &action)[0 .. action.sizeof] = 0; -+ sigfillset( &action.sa_mask ); // block other signals -+ action.sa_flags = SA_SIGINFO | SA_RESETHAND; -+ action.sa_sigaction = &unittestSegvHandler; -+ sigaction( SIGSEGV, &action, &oldseg ); -+ sigaction( SIGBUS, &action, &oldbus ); -+ scope( exit ) -+ { -+ sigaction( SIGSEGV, &oldseg, null ); -+ sigaction( SIGBUS, &oldbus, null ); -+ } -+ } -+ else static if( __traits( compiles, backtrace ) ) - { - import core.sys.posix.signal; // segv handler - -@@ -458,7 +492,23 @@ import core.stdc.stdio; - Throwable.TraceInfo defaultTraceHandler( void* ptr = null ) - { - //printf("runtime.defaultTraceHandler()\n"); -- static if( __traits( compiles, backtrace ) ) //GlibcBacktrace || OSXBacktrace -+ static if( __traits( compiles, new LibBacktrace(0) ) ) -+ { -+ version(Posix) -+ { -+ static enum FIRSTFRAME = 4; -+ } -+ else version (Win64) -+ { -+ static enum FIRSTFRAME = 4; -+ } -+ else -+ { -+ static enum FIRSTFRAME = 0; -+ } -+ return new LibBacktrace(FIRSTFRAME); -+ } -+ else static if( __traits( compiles, backtrace ) ) - { - import core.demangle; - import core.stdc.stdlib : free; -@@ -470,9 +520,6 @@ Throwable.TraceInfo defaultTraceHandler( - { - static enum MAXFRAMES = 128; - void*[MAXFRAMES] callstack; -- version( GNU ) -- numframes = backtrace( callstack.ptr, MAXFRAMES ); -- else - numframes = 0; //backtrace( callstack, MAXFRAMES ); - if (numframes < 2) // backtrace() failed, do it ourselves - { -@@ -662,232 +709,37 @@ Throwable.TraceInfo defaultTraceHandler( - - return new DefaultTraceInfo; - } -- else static if( __traits( compiles, new StackTrace ) ) // WindowsBacktrace -+ else static if( __traits( compiles, new StackTrace(0, null) ) ) - { - version (Win64) - { -- /* Disabled for the moment, because DbgHelp's stack walking code -- * does not work with dmd's stack frame. -- */ -- return null; -+ static enum FIRSTFRAME = 4; - } - else - { -- auto s = new StackTrace; -- return s; -+ static enum FIRSTFRAME = 0; - } -+ auto s = new StackTrace(FIRSTFRAME, cast(CONTEXT*)ptr); -+ return s; - } -- else version(GenericBacktrace) -+ else static if( __traits( compiles, new GDCBacktrace(0) ) ) - { -- class DefaultTraceInfo : Throwable.TraceInfo -+ version(Posix) - { -- this() -- { -- callstack = gdcBacktrace(); -- framelist = gdcBacktraceSymbols(callstack); -- } -- -- override int opApply( scope int delegate(ref char[]) dg ) -- { -- return opApply( (ref size_t, ref char[] buf) -- { -- return dg( buf ); -- } ); -- } -- -- override int opApply( scope int delegate(ref size_t, ref char[]) dg ) -- { -- version( Posix ) -- { -- // NOTE: The first 5 frames with the current implementation are -- // inside core.runtime and the object code, so eliminate -- // these for readability. The alternative would be to -- // exclude the first N frames that are in a list of -- // mangled function names. -- static enum FIRSTFRAME = 5; -- } -- else -- { -- // NOTE: On Windows, the number of frames to exclude is based on -- // whether the exception is user or system-generated, so -- // it may be necessary to exclude a list of function names -- // instead. -- static enum FIRSTFRAME = 0; -- } -- int ret = 0; -- -- for( int i = FIRSTFRAME; i < framelist.entries; ++i ) -- { -- auto pos = cast(size_t)(i - FIRSTFRAME); -- auto buf = formatLine(framelist.symbols[i]); -- ret = dg( pos, buf ); -- if( ret ) -- break; -- } -- return ret; -- } -- -- override string toString() -- { -- string buf; -- foreach( i, line; this ) -- buf ~= i ? "\n" ~ line : line; -- return buf; -- } -- -- private: -- btSymbolData framelist; -- gdcBacktraceData callstack; -- -- private: -- char[4096] fixbuf; -- -- /*Do not put \n at end of line!*/ -- char[] formatLine(backtraceSymbol sym) -- { -- int ret; -- -- if(sym.fileName) -- { -- if(sym.name) -- { -- ret = snprintf(fixbuf.ptr, fixbuf.sizeof, -- "%s(", sym.fileName); -- if(ret >= fixbuf.sizeof) -- return fixbuf[]; -- -- auto demangled = demangle(sym.name[0 .. strlen(sym.name)], -- fixbuf[ret .. $]); -- -- ret += demangled.length; -- if(ret >= fixbuf.sizeof) -- return fixbuf[]; -- -- ret += snprintf(fixbuf.ptr + ret, fixbuf.sizeof - ret, -- "+%#x) [%p]", sym.offset, sym.address); -- } -- else -- { -- ret = snprintf(fixbuf.ptr, fixbuf.sizeof, -- "%s() [%p]", sym.fileName, sym.address); -- } -- } -- else -- { -- if(sym.name) -- { -- fixbuf[0] = '('; -- ret = 1; -- -- auto demangled = demangle(sym.name[0 .. strlen(sym.name)], -- fixbuf[ret .. $]); -- -- ret += demangled.length; -- if(ret >= fixbuf.sizeof) -- return fixbuf[]; -- -- ret += snprintf(fixbuf.ptr + ret, fixbuf.sizeof - ret, -- "+%#x) [%p]", sym.offset, sym.address); -- } -- else -- { -- ret = snprintf(fixbuf.ptr, fixbuf.sizeof, "() [%p]", -- sym.address); -- } -- } -- -- if(ret >= fixbuf.sizeof) -- return fixbuf[]; -- else -- return fixbuf[0 .. ret]; -- } -+ static enum FIRSTFRAME = 5; - } -- -- return new DefaultTraceInfo; -+ else version (Win64) -+ { -+ static enum FIRSTFRAME = 4; -+ } -+ else -+ { -+ static enum FIRSTFRAME = 0; -+ } -+ return new GDCBacktrace(FIRSTFRAME); - } - else - { - return null; - } - } -- --version(GenericBacktrace) --{ -- static enum MAXFRAMES = 128; -- -- struct gdcBacktraceData -- { -- void*[MAXFRAMES] callstack; -- int numframes = 0; -- } -- -- struct backtraceSymbol -- { -- const(char)* name, fileName; -- size_t offset; -- void* address; -- } -- -- struct btSymbolData -- { -- size_t entries; -- backtraceSymbol[MAXFRAMES] symbols; -- } -- -- static extern (C) _Unwind_Reason_Code unwindCB(_Unwind_Context *ctx, void *d) -- { -- gdcBacktraceData* bt = cast(gdcBacktraceData*)d; -- if(bt.numframes >= MAXFRAMES) -- return _URC_NO_REASON; -- -- bt.callstack[bt.numframes] = cast(void*)_Unwind_GetIP(ctx); -- bt.numframes++; -- return _URC_NO_REASON; -- } -- -- gdcBacktraceData gdcBacktrace() -- { -- gdcBacktraceData stackframe; -- _Unwind_Backtrace(&unwindCB, &stackframe); -- return stackframe; -- } -- -- btSymbolData gdcBacktraceSymbols(gdcBacktraceData data) -- { -- btSymbolData symData; -- -- for(auto i = 0; i < data.numframes; i++) -- { -- version(HaveDLADDR) -- { -- Dl_info funcInfo; -- -- if(data.callstack[i] !is null && dladdr(data.callstack[i], &funcInfo) != 0) -- { -- symData.symbols[symData.entries].name = funcInfo.dli_sname; -- symData.symbols[symData.entries].fileName = funcInfo.dli_fname; -- -- if(funcInfo.dli_saddr is null) -- symData.symbols[symData.entries].offset = 0; -- else -- symData.symbols[symData.entries].offset = data.callstack[i] - funcInfo.dli_saddr; -- -- symData.symbols[symData.entries].address = data.callstack[i]; -- symData.entries++; -- } -- else -- { -- symData.symbols[symData.entries].address = data.callstack[i]; -- symData.entries++; -- } -- } -- else -- { -- symData.symbols[symData.entries].address = data.callstack[i]; -- symData.entries++; -- } -- } -- -- return symData; -- } --} ---- a/src/libphobos/libdruntime/core/simd.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/simd.d 2014-04-01 16:32:51.000000000 +0100 -@@ -436,7 +436,7 @@ version ( D_SIMD ) - * op1 op= op2 - * Returns: - * op2 -- * These cannot be market as pure, as semantic() doesn't check them. -+ * These cannot be marked as pure, as semantic() doesn't check them. - */ - @safe void16 __simd_sto(XMM opcode, void16 op1, void16 op2); - @safe void16 __simd_sto(XMM opcode, double op1, void16 op2); /// ---- a/src/libphobos/libdruntime/core/stdc/complex.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/complex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -21,90 +21,90 @@ nothrow: - alias creal complex; - alias ireal imaginary; - --pure cdouble cacos(cdouble z); --pure cfloat cacosf(cfloat z); --pure creal cacosl(creal z); -- --pure cdouble casin(cdouble z); --pure cfloat casinf(cfloat z); --pure creal casinl(creal z); -- --pure cdouble catan(cdouble z); --pure cfloat catanf(cfloat z); --pure creal catanl(creal z); -- --pure cdouble ccos(cdouble z); --pure cfloat ccosf(cfloat z); --pure creal ccosl(creal z); -- --pure cdouble csin(cdouble z); --pure cfloat csinf(cfloat z); --pure creal csinl(creal z); -- --pure cdouble ctan(cdouble z); --pure cfloat ctanf(cfloat z); --pure creal ctanl(creal z); -- --pure cdouble cacosh(cdouble z); --pure cfloat cacoshf(cfloat z); --pure creal cacoshl(creal z); -- --pure cdouble casinh(cdouble z); --pure cfloat casinhf(cfloat z); --pure creal casinhl(creal z); -- --pure cdouble catanh(cdouble z); --pure cfloat catanhf(cfloat z); --pure creal catanhl(creal z); -- --pure cdouble ccosh(cdouble z); --pure cfloat ccoshf(cfloat z); --pure creal ccoshl(creal z); -- --pure cdouble csinh(cdouble z); --pure cfloat csinhf(cfloat z); --pure creal csinhl(creal z); -- --pure cdouble ctanh(cdouble z); --pure cfloat ctanhf(cfloat z); --pure creal ctanhl(creal z); -- --pure cdouble cexp(cdouble z); --pure cfloat cexpf(cfloat z); --pure creal cexpl(creal z); -- --pure cdouble clog(cdouble z); --pure cfloat clogf(cfloat z); --pure creal clogl(creal z); -- --pure double cabs(cdouble z); --pure float cabsf(cfloat z); --pure real cabsl(creal z); -- --pure cdouble cpow(cdouble x, cdouble y); --pure cfloat cpowf(cfloat x, cfloat y); --pure creal cpowl(creal x, creal y); -- --pure cdouble csqrt(cdouble z); --pure cfloat csqrtf(cfloat z); --pure creal csqrtl(creal z); -- --pure double carg(cdouble z); --pure float cargf(cfloat z); --pure real cargl(creal z); -- --pure double cimag(cdouble z); --pure float cimagf(cfloat z); --pure real cimagl(creal z); -- --pure cdouble conj(cdouble z); --pure cfloat conjf(cfloat z); --pure creal conjl(creal z); -- --pure cdouble cproj(cdouble z); --pure cfloat cprojf(cfloat z); --pure creal cprojl(creal z); -- --//pure double creal(cdouble z); --pure float crealf(cfloat z); --pure real creall(creal z); -+cdouble cacos(cdouble z); -+cfloat cacosf(cfloat z); -+creal cacosl(creal z); -+ -+cdouble casin(cdouble z); -+cfloat casinf(cfloat z); -+creal casinl(creal z); -+ -+cdouble catan(cdouble z); -+cfloat catanf(cfloat z); -+creal catanl(creal z); -+ -+cdouble ccos(cdouble z); -+cfloat ccosf(cfloat z); -+creal ccosl(creal z); -+ -+cdouble csin(cdouble z); -+cfloat csinf(cfloat z); -+creal csinl(creal z); -+ -+cdouble ctan(cdouble z); -+cfloat ctanf(cfloat z); -+creal ctanl(creal z); -+ -+cdouble cacosh(cdouble z); -+cfloat cacoshf(cfloat z); -+creal cacoshl(creal z); -+ -+cdouble casinh(cdouble z); -+cfloat casinhf(cfloat z); -+creal casinhl(creal z); -+ -+cdouble catanh(cdouble z); -+cfloat catanhf(cfloat z); -+creal catanhl(creal z); -+ -+cdouble ccosh(cdouble z); -+cfloat ccoshf(cfloat z); -+creal ccoshl(creal z); -+ -+cdouble csinh(cdouble z); -+cfloat csinhf(cfloat z); -+creal csinhl(creal z); -+ -+cdouble ctanh(cdouble z); -+cfloat ctanhf(cfloat z); -+creal ctanhl(creal z); -+ -+cdouble cexp(cdouble z); -+cfloat cexpf(cfloat z); -+creal cexpl(creal z); -+ -+cdouble clog(cdouble z); -+cfloat clogf(cfloat z); -+creal clogl(creal z); -+ -+ double cabs(cdouble z); -+ float cabsf(cfloat z); -+ real cabsl(creal z); -+ -+cdouble cpow(cdouble x, cdouble y); -+cfloat cpowf(cfloat x, cfloat y); -+creal cpowl(creal x, creal y); -+ -+cdouble csqrt(cdouble z); -+cfloat csqrtf(cfloat z); -+creal csqrtl(creal z); -+ -+ double carg(cdouble z); -+ float cargf(cfloat z); -+ real cargl(creal z); -+ -+ double cimag(cdouble z); -+ float cimagf(cfloat z); -+ real cimagl(creal z); -+ -+cdouble conj(cdouble z); -+cfloat conjf(cfloat z); -+creal conjl(creal z); -+ -+cdouble cproj(cdouble z); -+cfloat cprojf(cfloat z); -+creal cprojl(creal z); -+ -+// double creal(cdouble z); -+ float crealf(cfloat z); -+ real creall(creal z); ---- a/src/libphobos/libdruntime/core/stdc/fenv.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/fenv.d 2014-04-01 16:32:51.000000000 +0100 -@@ -106,7 +106,7 @@ enum - - version( Windows ) - { -- private extern fenv_t _FE_DFL_ENV; -+ private extern __gshared fenv_t _FE_DFL_ENV; - fenv_t* FE_DFL_ENV = &_FE_DFL_ENV; - } - else version( linux ) -@@ -115,7 +115,7 @@ else version( linux ) - } - else version( OSX ) - { -- private extern fenv_t _FE_DFL_ENV; -+ private extern __gshared fenv_t _FE_DFL_ENV; - fenv_t* FE_DFL_ENV = &_FE_DFL_ENV; - } - else version( FreeBSD ) ---- a/src/libphobos/libdruntime/core/stdc/math.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/math.d 2014-04-01 16:32:51.000000000 +0100 -@@ -309,6 +309,77 @@ else version( linux ) - } - } - } -+else version( MinGW ) -+{ -+ enum -+ { -+ FP_NAN = 0x0100, -+ FP_NORMAL = 0x0400, -+ FP_INFINITE = FP_NAN | FP_NORMAL, -+ FP_ZERO = 0x0400, -+ FP_SUBNORMAL = FP_NORMAL | FP_ZERO -+ } -+ -+ int __fpclassifyf(float x); -+ int __fpclassify(double x); -+ int __fpclassifyl(real x); -+ -+ int __isnanf(float x); -+ int __isnan(double x); -+ int __isnanl(real x); -+ -+ int __signbitf(float x); -+ int __signbit(double x); -+ int __signbitl(real x); -+ -+ extern (D) -+ { -+ //int fpclassify(real-floating x); -+ int fpclassify(float x) { return __fpclassifyf(x); } -+ int fpclassify(double x) { return __fpclassify(x); } -+ int fpclassify(real x) -+ { -+ return (real.sizeof == double.sizeof) -+ ? __fpclassify(x) -+ : __fpclassifyl(x); -+ } -+ -+ //int isfinite(real-floating x); -+ int isfinite(float x) { return (fpclassify(x) & FP_NORMAL) == 0; } -+ int isfinite(double x) { return (fpclassify(x) & FP_NORMAL) == 0; } -+ int isfinite(real x) { return (fpclassify(x) & FP_NORMAL) == 0; } -+ -+ //int isinf(real-floating x); -+ int isinf(float x) { return fpclassify(x) == FP_INFINITE; } -+ int isinf(double x) { return fpclassify(x) == FP_INFINITE; } -+ int isinf(real x) { return fpclassify(x) == FP_INFINITE; } -+ -+ //int isnan(real-floating x); -+ int isnan(float x) { return __isnanf(x); } -+ int isnan(double x) { return __isnan(x); } -+ int isnan(real x) -+ { -+ return (real.sizeof == double.sizeof) -+ ? __isnan(x) -+ : __isnanl(x); -+ } -+ -+ //int isnormal(real-floating x); -+ int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } -+ int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } -+ int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } -+ -+ //int signbit(real-floating x); -+ int signbit(float x) { return __signbitf(x); } -+ int signbit(double x) { return __signbit(x); } -+ int signbit(real x) -+ { -+ return (real.sizeof == double.sizeof) -+ ? __signbit(x) -+ : __signbitl(x); -+ } -+ } -+} - else version( OSX ) - { - enum -@@ -520,505 +591,505 @@ version( FreeBSD ) - { - version (none) // < 8-CURRENT - { -- pure real acosl(real x) { return acos(x); } -- pure real asinl(real x) { return asin(x); } -- pure real atanl(real x) { return atan(x); } -- pure real atan2l(real y, real x) { return atan2(y, x); } -- pure real cosl(real x) { return cos(x); } -- pure real sinl(real x) { return sin(x); } -- pure real tanl(real x) { return tan(x); } -- pure real exp2l(real x) { return exp2(x); } -- real frexpl(real value, int* exp) { return frexp(value, exp); } -- pure int ilogbl(real x) { return ilogb(x); } -- pure real ldexpl(real x, int exp) { return ldexp(x, exp); } -- pure real logbl(real x) { return logb(x); } -- //pure real modfl(real value, real *iptr); // nontrivial conversion -- pure real scalbnl(real x, int n) { return scalbn(x, n); } -- pure real scalblnl(real x, c_long n) { return scalbln(x, n); } -- pure real fabsl(real x) { return fabs(x); } -- pure real hypotl(real x, real y) { return hypot(x, y); } -- pure real sqrtl(real x) { return sqrt(x); } -- pure real ceill(real x) { return ceil(x); } -- pure real floorl(real x) { return floor(x); } -- pure real nearbyintl(real x) { return nearbyint(x); } -- pure real rintl(real x) { return rint(x); } -- pure c_long lrintl(real x) { return lrint(x); } -- pure real roundl(real x) { return round(x); } -- pure c_long lroundl(real x) { return lround(x); } -- pure long llroundl(real x) { return llround(x); } -- pure real truncl(real x) { return trunc(x); } -- pure real fmodl(real x, real y) { return fmod(x, y); } -- pure real remainderl(real x, real y) { return remainder(x, y); } -- real remquol(real x, real y, int* quo) { return remquo(x, y, quo); } -- pure real copysignl(real x, real y) { return copysign(x, y); } --// pure double nan(char* tagp); --// pure float nanf(char* tagp); --// pure real nanl(char* tagp); -- pure real nextafterl(real x, real y) { return nextafter(x, y); } -- pure real nexttowardl(real x, real y) { return nexttoward(x, y); } -- pure real fdiml(real x, real y) { return fdim(x, y); } -- pure real fmaxl(real x, real y) { return fmax(x, y); } -- pure real fminl(real x, real y) { return fmin(x, y); } -- pure real fmal(real x, real y, real z) { return fma(x, y, z); } -+ real acosl(real x) { return acos(x); } -+ real asinl(real x) { return asin(x); } -+ real atanl(real x) { return atan(x); } -+ real atan2l(real y, real x) { return atan2(y, x); } -+ real cosl(real x) { return cos(x); } -+ real sinl(real x) { return sin(x); } -+ real tanl(real x) { return tan(x); } -+ real exp2l(real x) { return exp2(x); } -+ real frexpl(real value, int* exp) { return frexp(value, exp); } -+ int ilogbl(real x) { return ilogb(x); } -+ real ldexpl(real x, int exp) { return ldexp(x, exp); } -+ real logbl(real x) { return logb(x); } -+ //real modfl(real value, real *iptr); // nontrivial conversion -+ real scalbnl(real x, int n) { return scalbn(x, n); } -+ real scalblnl(real x, c_long n) { return scalbln(x, n); } -+ real fabsl(real x) { return fabs(x); } -+ real hypotl(real x, real y) { return hypot(x, y); } -+ real sqrtl(real x) { return sqrt(x); } -+ real ceill(real x) { return ceil(x); } -+ real floorl(real x) { return floor(x); } -+ real nearbyintl(real x) { return nearbyint(x); } -+ real rintl(real x) { return rint(x); } -+ c_long lrintl(real x) { return lrint(x); } -+ real roundl(real x) { return round(x); } -+ c_long lroundl(real x) { return lround(x); } -+ long llroundl(real x) { return llround(x); } -+ real truncl(real x) { return trunc(x); } -+ real fmodl(real x, real y) { return fmod(x, y); } -+ real remainderl(real x, real y) { return remainder(x, y); } -+ real remquol(real x, real y, int* quo) { return remquo(x, y, quo); } -+ real copysignl(real x, real y) { return copysign(x, y); } -+// double nan(char* tagp); -+// float nanf(char* tagp); -+// real nanl(char* tagp); -+ real nextafterl(real x, real y) { return nextafter(x, y); } -+ real nexttowardl(real x, real y) { return nexttoward(x, y); } -+ real fdiml(real x, real y) { return fdim(x, y); } -+ real fmaxl(real x, real y) { return fmax(x, y); } -+ real fminl(real x, real y) { return fmin(x, y); } -+ real fmal(real x, real y, real z) { return fma(x, y, z); } - } - else - { -- pure real acosl(real x); -- pure real asinl(real x); -- pure real atanl(real x); -- pure real atan2l(real y, real x); -- pure real cosl(real x); -- pure real sinl(real x); -- pure real tanl(real x); -- pure real exp2l(real x); -- real frexpl(real value, int* exp); -- pure int ilogbl(real x); -- pure real ldexpl(real x, int exp); -- pure real logbl(real x); -- pure real modfl(real value, real *iptr); -- pure real scalbnl(real x, int n); -- pure real scalblnl(real x, c_long n); -- pure real fabsl(real x); -- pure real hypotl(real x, real y); -- pure real sqrtl(real x); -- pure real ceill(real x); -- pure real floorl(real x); -- pure real nearbyintl(real x); -- pure real rintl(real x); -- pure c_long lrintl(real x); -- pure real roundl(real x); -- pure c_long lroundl(real x); -- pure long llroundl(real x); -- pure real truncl(real x); -- pure real fmodl(real x, real y); -- pure real remainderl(real x, real y); -- real remquol(real x, real y, int* quo); -- pure real copysignl(real x, real y); -- pure double nan(char* tagp); -- pure float nanf(char* tagp); -- pure real nanl(char* tagp); -- pure real nextafterl(real x, real y); -- pure real nexttowardl(real x, real y); -- pure real fdiml(real x, real y); -- pure real fmaxl(real x, real y); -- pure real fminl(real x, real y); -- pure real fmal(real x, real y, real z); -+ real acosl(real x); -+ real asinl(real x); -+ real atanl(real x); -+ real atan2l(real y, real x); -+ real cosl(real x); -+ real sinl(real x); -+ real tanl(real x); -+ real exp2l(real x); -+ real frexpl(real value, int* exp); -+ int ilogbl(real x); -+ real ldexpl(real x, int exp); -+ real logbl(real x); -+ real modfl(real value, real *iptr); -+ real scalbnl(real x, int n); -+ real scalblnl(real x, c_long n); -+ real fabsl(real x); -+ real hypotl(real x, real y); -+ real sqrtl(real x); -+ real ceill(real x); -+ real floorl(real x); -+ real nearbyintl(real x); -+ real rintl(real x); -+ c_long lrintl(real x); -+ real roundl(real x); -+ c_long lroundl(real x); -+ long llroundl(real x); -+ real truncl(real x); -+ real fmodl(real x, real y); -+ real remainderl(real x, real y); -+ real remquol(real x, real y, int* quo); -+ real copysignl(real x, real y); -+ double nan(char* tagp); -+ float nanf(char* tagp); -+ real nanl(char* tagp); -+ real nextafterl(real x, real y); -+ real nexttowardl(real x, real y); -+ real fdiml(real x, real y); -+ real fmaxl(real x, real y); -+ real fminl(real x, real y); -+ real fmal(real x, real y, real z); - } -- pure double acos(double x); -- pure float acosf(float x); -+ double acos(double x); -+ float acosf(float x); - -- pure double asin(double x); -- pure float asinf(float x); -+ double asin(double x); -+ float asinf(float x); - -- pure double atan(double x); -- pure float atanf(float x); -+ double atan(double x); -+ float atanf(float x); - -- pure double atan2(double y, double x); -- pure float atan2f(float y, float x); -+ double atan2(double y, double x); -+ float atan2f(float y, float x); - -- pure double cos(double x); -- pure float cosf(float x); -+ double cos(double x); -+ float cosf(float x); - -- pure double sin(double x); -- pure float sinf(float x); -+ double sin(double x); -+ float sinf(float x); - -- pure double tan(double x); -- pure float tanf(float x); -+ double tan(double x); -+ float tanf(float x); - -- pure double acosh(double x); -- pure float acoshf(float x); -- pure real acoshl(real x) { return acosh(x); } -+ double acosh(double x); -+ float acoshf(float x); -+ real acoshl(real x) { return acosh(x); } - -- pure double asinh(double x); -- pure float asinhf(float x); -- pure real asinhl(real x) { return asinh(x); } -+ double asinh(double x); -+ float asinhf(float x); -+ real asinhl(real x) { return asinh(x); } - -- pure double atanh(double x); -- pure float atanhf(float x); -- pure real atanhl(real x) { return atanh(x); } -+ double atanh(double x); -+ float atanhf(float x); -+ real atanhl(real x) { return atanh(x); } - -- pure double cosh(double x); -- pure float coshf(float x); -- pure real coshl(real x) { return cosh(x); } -+ double cosh(double x); -+ float coshf(float x); -+ real coshl(real x) { return cosh(x); } - -- pure double sinh(double x); -- pure float sinhf(float x); -- pure real sinhl(real x) { return sinh(x); } -+ double sinh(double x); -+ float sinhf(float x); -+ real sinhl(real x) { return sinh(x); } - -- pure double tanh(double x); -- pure float tanhf(float x); -- pure real tanhl(real x) { return tanh(x); } -+ double tanh(double x); -+ float tanhf(float x); -+ real tanhl(real x) { return tanh(x); } - -- pure double exp(double x); -- pure float expf(float x); -- pure real expl(real x) { return exp(x); } -+ double exp(double x); -+ float expf(float x); -+ real expl(real x) { return exp(x); } - -- pure double exp2(double x); -- pure float exp2f(float x); -+ double exp2(double x); -+ float exp2f(float x); - -- pure double expm1(double x); -- pure float expm1f(float x); -- pure real expm1l(real x) { return expm1(x); } -+ double expm1(double x); -+ float expm1f(float x); -+ real expm1l(real x) { return expm1(x); } - -- double frexp(double value, int* exp); -- float frexpf(float value, int* exp); -+ double frexp(double value, int* exp); -+ float frexpf(float value, int* exp); - -- pure int ilogb(double x); -- pure int ilogbf(float x); -+ int ilogb(double x); -+ int ilogbf(float x); - -- pure double ldexp(double x, int exp); -- pure float ldexpf(float x, int exp); -+ double ldexp(double x, int exp); -+ float ldexpf(float x, int exp); - -- pure double log(double x); -- pure float logf(float x); -- pure real logl(real x) { return log(x); } -+ double log(double x); -+ float logf(float x); -+ real logl(real x) { return log(x); } - -- pure double log10(double x); -- pure float log10f(float x); -- pure real log10l(real x) { return log10(x); } -+ double log10(double x); -+ float log10f(float x); -+ real log10l(real x) { return log10(x); } - -- pure double log1p(double x); -- pure float log1pf(float x); -- pure real log1pl(real x) { return log1p(x); } -+ double log1p(double x); -+ float log1pf(float x); -+ real log1pl(real x) { return log1p(x); } - - private enum real ONE_LN2 = 1 / 0x1.62e42fefa39ef358p-1L; -- pure double log2(double x) { return log(x) * ONE_LN2; } -- pure float log2f(float x) { return logf(x) * ONE_LN2; } -- pure real log2l(real x) { return logl(x) * ONE_LN2; } -+ double log2(double x) { return log(x) * ONE_LN2; } -+ float log2f(float x) { return logf(x) * ONE_LN2; } -+ real log2l(real x) { return logl(x) * ONE_LN2; } - -- pure double logb(double x); -- pure float logbf(float x); -+ double logb(double x); -+ float logbf(float x); - -- pure double modf(double value, double* iptr); -- pure float modff(float value, float* iptr); -+ double modf(double value, double* iptr); -+ float modff(float value, float* iptr); - -- pure double scalbn(double x, int n); -- pure float scalbnf(float x, int n); -+ double scalbn(double x, int n); -+ float scalbnf(float x, int n); - -- double scalbln(double x, c_long n); -- float scalblnf(float x, c_long n); -+ double scalbln(double x, c_long n); -+ float scalblnf(float x, c_long n); - -- pure double cbrt(double x); -- pure float cbrtf(float x); -- pure real cbrtl(real x) { return cbrt(x); } -+ double cbrt(double x); -+ float cbrtf(float x); -+ real cbrtl(real x) { return cbrt(x); } - -- pure double fabs(double x); -- pure float fabsf(float x); -+ double fabs(double x); -+ float fabsf(float x); - -- pure double hypot(double x, double y); -- pure float hypotf(float x, float y); -+ double hypot(double x, double y); -+ float hypotf(float x, float y); - -- pure double pow(double x, double y); -- pure float powf(float x, float y); -- pure real powl(real x, real y) { return pow(x, y); } -+ double pow(double x, double y); -+ float powf(float x, float y); -+ real powl(real x, real y) { return pow(x, y); } - -- pure double sqrt(double x); -- pure float sqrtf(float x); -+ double sqrt(double x); -+ float sqrtf(float x); - -- pure double erf(double x); -- pure float erff(float x); -- pure real erfl(real x) { return erf(x); } -+ double erf(double x); -+ float erff(float x); -+ real erfl(real x) { return erf(x); } - -- pure double erfc(double x); -- pure float erfcf(float x); -- pure real erfcl(real x) { return erfc(x); } -+ double erfc(double x); -+ float erfcf(float x); -+ real erfcl(real x) { return erfc(x); } - -- double lgamma(double x); -- float lgammaf(float x); -- real lgammal(real x) { return lgamma(x); } -+ double lgamma(double x); -+ float lgammaf(float x); -+ real lgammal(real x) { return lgamma(x); } - -- pure double tgamma(double x); -- pure float tgammaf(float x); -- pure real tgammal(real x) { return tgamma(x); } -+ double tgamma(double x); -+ float tgammaf(float x); -+ real tgammal(real x) { return tgamma(x); } - -- pure double ceil(double x); -- pure float ceilf(float x); -+ double ceil(double x); -+ float ceilf(float x); - -- pure double floor(double x); -- pure float floorf(float x); -+ double floor(double x); -+ float floorf(float x); - -- pure double nearbyint(double x); -- pure float nearbyintf(float x); -+ double nearbyint(double x); -+ float nearbyintf(float x); - -- pure double rint(double x); -- pure float rintf(float x); -+ double rint(double x); -+ float rintf(float x); - -- pure c_long lrint(double x); -- pure c_long lrintf(float x); -+ c_long lrint(double x); -+ c_long lrintf(float x); - -- pure long llrint(double x); -- pure long llrintf(float x); -- pure long llrintl(real x) { return llrint(x); } -+ long llrint(double x); -+ long llrintf(float x); -+ long llrintl(real x) { return llrint(x); } - -- pure double round(double x); -- pure float roundf(float x); -+ double round(double x); -+ float roundf(float x); - -- pure c_long lround(double x); -- pure c_long lroundf(float x); -+ c_long lround(double x); -+ c_long lroundf(float x); - -- pure long llround(double x); -- pure long llroundf(float x); -+ long llround(double x); -+ long llroundf(float x); - -- pure double trunc(double x); -- pure float truncf(float x); -+ double trunc(double x); -+ float truncf(float x); - -- pure double fmod(double x, double y); -- pure float fmodf(float x, float y); -+ double fmod(double x, double y); -+ float fmodf(float x, float y); - -- pure double remainder(double x, double y); -- pure float remainderf(float x, float y); -+ double remainder(double x, double y); -+ float remainderf(float x, float y); - -- double remquo(double x, double y, int* quo); -- float remquof(float x, float y, int* quo); -+ double remquo(double x, double y, int* quo); -+ float remquof(float x, float y, int* quo); - -- pure double copysign(double x, double y); -- pure float copysignf(float x, float y); -+ double copysign(double x, double y); -+ float copysignf(float x, float y); - -- pure double nextafter(double x, double y); -- pure float nextafterf(float x, float y); -+ double nextafter(double x, double y); -+ float nextafterf(float x, float y); - -- pure double nexttoward(double x, real y); -- pure float nexttowardf(float x, real y); -+ double nexttoward(double x, real y); -+ float nexttowardf(float x, real y); - -- pure double fdim(double x, double y); -- pure float fdimf(float x, float y); -+ double fdim(double x, double y); -+ float fdimf(float x, float y); - -- pure double fmax(double x, double y); -- pure float fmaxf(float x, float y); -+ double fmax(double x, double y); -+ float fmaxf(float x, float y); - -- pure double fmin(double x, double y); -- pure float fminf(float x, float y); -+ double fmin(double x, double y); -+ float fminf(float x, float y); - -- pure double fma(double x, double y, double z); -- pure float fmaf(float x, float y, float z); -+ double fma(double x, double y, double z); -+ float fmaf(float x, float y, float z); - } - else - { -- pure double acos(double x); -- pure float acosf(float x); -- pure real acosl(real x); -- -- pure double asin(double x); -- pure float asinf(float x); -- pure real asinl(real x); -- -- pure double atan(double x); -- pure float atanf(float x); -- pure real atanl(real x); -- -- pure double atan2(double y, double x); -- pure float atan2f(float y, float x); -- pure real atan2l(real y, real x); -- -- pure double cos(double x); -- pure float cosf(float x); -- pure real cosl(real x); -- -- pure double sin(double x); -- pure float sinf(float x); -- pure real sinl(real x); -- -- pure double tan(double x); -- pure float tanf(float x); -- pure real tanl(real x); -- -- pure double acosh(double x); -- pure float acoshf(float x); -- pure real acoshl(real x); -- -- pure double asinh(double x); -- pure float asinhf(float x); -- pure real asinhl(real x); -- -- pure double atanh(double x); -- pure float atanhf(float x); -- pure real atanhl(real x); -- -- pure double cosh(double x); -- pure float coshf(float x); -- pure real coshl(real x); -- -- pure double sinh(double x); -- pure float sinhf(float x); -- pure real sinhl(real x); -- -- pure double tanh(double x); -- pure float tanhf(float x); -- pure real tanhl(real x); -- -- pure double exp(double x); -- pure float expf(float x); -- pure real expl(real x); -- -- pure double exp2(double x); -- pure float exp2f(float x); -- pure real exp2l(real x); -- -- pure double expm1(double x); -- pure float expm1f(float x); -- pure real expm1l(real x); -- -- double frexp(double value, int* exp); -- float frexpf(float value, int* exp); -- real frexpl(real value, int* exp); -- -- pure int ilogb(double x); -- pure int ilogbf(float x); -- pure int ilogbl(real x); -- -- pure double ldexp(double x, int exp); -- pure float ldexpf(float x, int exp); -- pure real ldexpl(real x, int exp); -- -- pure double log(double x); -- pure float logf(float x); -- pure real logl(real x); -- -- pure double log10(double x); -- pure float log10f(float x); -- pure real log10l(real x); -- -- pure double log1p(double x); -- pure float log1pf(float x); -- pure real log1pl(real x); -- -- pure double log2(double x); -- pure float log2f(float x); -- pure real log2l(real x); -- -- pure double logb(double x); -- pure float logbf(float x); -- pure real logbl(real x); -- -- pure double modf(double value, double* iptr); -- pure float modff(float value, float* iptr); -- pure real modfl(real value, real *iptr); -- -- pure double scalbn(double x, int n); -- pure float scalbnf(float x, int n); -- pure real scalbnl(real x, int n); -- -- pure double scalbln(double x, c_long n); -- pure float scalblnf(float x, c_long n); -- pure real scalblnl(real x, c_long n); -- -- pure double cbrt(double x); -- pure float cbrtf(float x); -- pure real cbrtl(real x); -- -- pure double fabs(double x); -- pure float fabsf(float x); -- pure real fabsl(real x); -- -- pure double hypot(double x, double y); -- pure float hypotf(float x, float y); -- pure real hypotl(real x, real y); -- -- pure double pow(double x, double y); -- pure float powf(float x, float y); -- pure real powl(real x, real y); -- -- pure double sqrt(double x); -- pure float sqrtf(float x); -- pure real sqrtl(real x); -- -- pure double erf(double x); -- pure float erff(float x); -- pure real erfl(real x); -- -- pure double erfc(double x); -- pure float erfcf(float x); -- pure real erfcl(real x); -- -- double lgamma(double x); -- float lgammaf(float x); -- real lgammal(real x); -- -- pure double tgamma(double x); -- pure float tgammaf(float x); -- pure real tgammal(real x); -- -- pure double ceil(double x); -- pure float ceilf(float x); -- pure real ceill(real x); -- -- pure double floor(double x); -- pure float floorf(float x); -- pure real floorl(real x); -- -- pure double nearbyint(double x); -- pure float nearbyintf(float x); -- pure real nearbyintl(real x); -- -- pure double rint(double x); -- pure float rintf(float x); -- pure real rintl(real x); -- -- pure c_long lrint(double x); -- pure c_long lrintf(float x); -- pure c_long lrintl(real x); -- -- pure long llrint(double x); -- pure long llrintf(float x); -- pure long llrintl(real x); -- -- pure double round(double x); -- pure float roundf(float x); -- pure real roundl(real x); -- -- pure c_long lround(double x); -- pure c_long lroundf(float x); -- pure c_long lroundl(real x); -- -- pure long llround(double x); -- pure long llroundf(float x); -- pure long llroundl(real x); -- -- pure double trunc(double x); -- pure float truncf(float x); -- pure real truncl(real x); -- -- pure double fmod(double x, double y); -- pure float fmodf(float x, float y); -- pure real fmodl(real x, real y); -- -- pure double remainder(double x, double y); -- pure float remainderf(float x, float y); -- pure real remainderl(real x, real y); -- -- double remquo(double x, double y, int* quo); -- float remquof(float x, float y, int* quo); -- real remquol(real x, real y, int* quo); -- -- pure double copysign(double x, double y); -- pure float copysignf(float x, float y); -- pure real copysignl(real x, real y); -- -- pure double nan(char* tagp); -- pure float nanf(char* tagp); -- pure real nanl(char* tagp); -- -- pure double nextafter(double x, double y); -- pure float nextafterf(float x, float y); -- pure real nextafterl(real x, real y); -- -- pure double nexttoward(double x, real y); -- pure float nexttowardf(float x, real y); -- pure real nexttowardl(real x, real y); -- -- pure double fdim(double x, double y); -- pure float fdimf(float x, float y); -- pure real fdiml(real x, real y); -- -- pure double fmax(double x, double y); -- pure float fmaxf(float x, float y); -- pure real fmaxl(real x, real y); -- -- pure double fmin(double x, double y); -- pure float fminf(float x, float y); -- pure real fminl(real x, real y); -- -- pure double fma(double x, double y, double z); -- pure float fmaf(float x, float y, float z); -- pure real fmal(real x, real y, real z); -+ double acos(double x); -+ float acosf(float x); -+ real acosl(real x); -+ -+ double asin(double x); -+ float asinf(float x); -+ real asinl(real x); -+ -+ double atan(double x); -+ float atanf(float x); -+ real atanl(real x); -+ -+ double atan2(double y, double x); -+ float atan2f(float y, float x); -+ real atan2l(real y, real x); -+ -+ double cos(double x); -+ float cosf(float x); -+ real cosl(real x); -+ -+ double sin(double x); -+ float sinf(float x); -+ real sinl(real x); -+ -+ double tan(double x); -+ float tanf(float x); -+ real tanl(real x); -+ -+ double acosh(double x); -+ float acoshf(float x); -+ real acoshl(real x); -+ -+ double asinh(double x); -+ float asinhf(float x); -+ real asinhl(real x); -+ -+ double atanh(double x); -+ float atanhf(float x); -+ real atanhl(real x); -+ -+ double cosh(double x); -+ float coshf(float x); -+ real coshl(real x); -+ -+ double sinh(double x); -+ float sinhf(float x); -+ real sinhl(real x); -+ -+ double tanh(double x); -+ float tanhf(float x); -+ real tanhl(real x); -+ -+ double exp(double x); -+ float expf(float x); -+ real expl(real x); -+ -+ double exp2(double x); -+ float exp2f(float x); -+ real exp2l(real x); -+ -+ double expm1(double x); -+ float expm1f(float x); -+ real expm1l(real x); -+ -+ double frexp(double value, int* exp); -+ float frexpf(float value, int* exp); -+ real frexpl(real value, int* exp); -+ -+ int ilogb(double x); -+ int ilogbf(float x); -+ int ilogbl(real x); -+ -+ double ldexp(double x, int exp); -+ float ldexpf(float x, int exp); -+ real ldexpl(real x, int exp); -+ -+ double log(double x); -+ float logf(float x); -+ real logl(real x); -+ -+ double log10(double x); -+ float log10f(float x); -+ real log10l(real x); -+ -+ double log1p(double x); -+ float log1pf(float x); -+ real log1pl(real x); -+ -+ double log2(double x); -+ float log2f(float x); -+ real log2l(real x); -+ -+ double logb(double x); -+ float logbf(float x); -+ real logbl(real x); -+ -+ double modf(double value, double* iptr); -+ float modff(float value, float* iptr); -+ real modfl(real value, real *iptr); -+ -+ double scalbn(double x, int n); -+ float scalbnf(float x, int n); -+ real scalbnl(real x, int n); -+ -+ double scalbln(double x, c_long n); -+ float scalblnf(float x, c_long n); -+ real scalblnl(real x, c_long n); -+ -+ double cbrt(double x); -+ float cbrtf(float x); -+ real cbrtl(real x); -+ -+ double fabs(double x); -+ float fabsf(float x); -+ real fabsl(real x); -+ -+ double hypot(double x, double y); -+ float hypotf(float x, float y); -+ real hypotl(real x, real y); -+ -+ double pow(double x, double y); -+ float powf(float x, float y); -+ real powl(real x, real y); -+ -+ double sqrt(double x); -+ float sqrtf(float x); -+ real sqrtl(real x); -+ -+ double erf(double x); -+ float erff(float x); -+ real erfl(real x); -+ -+ double erfc(double x); -+ float erfcf(float x); -+ real erfcl(real x); -+ -+ double lgamma(double x); -+ float lgammaf(float x); -+ real lgammal(real x); -+ -+ double tgamma(double x); -+ float tgammaf(float x); -+ real tgammal(real x); -+ -+ double ceil(double x); -+ float ceilf(float x); -+ real ceill(real x); -+ -+ double floor(double x); -+ float floorf(float x); -+ real floorl(real x); -+ -+ double nearbyint(double x); -+ float nearbyintf(float x); -+ real nearbyintl(real x); -+ -+ double rint(double x); -+ float rintf(float x); -+ real rintl(real x); -+ -+ c_long lrint(double x); -+ c_long lrintf(float x); -+ c_long lrintl(real x); -+ -+ long llrint(double x); -+ long llrintf(float x); -+ long llrintl(real x); -+ -+ double round(double x); -+ float roundf(float x); -+ real roundl(real x); -+ -+ c_long lround(double x); -+ c_long lroundf(float x); -+ c_long lroundl(real x); -+ -+ long llround(double x); -+ long llroundf(float x); -+ long llroundl(real x); -+ -+ double trunc(double x); -+ float truncf(float x); -+ real truncl(real x); -+ -+ double fmod(double x, double y); -+ float fmodf(float x, float y); -+ real fmodl(real x, real y); -+ -+ double remainder(double x, double y); -+ float remainderf(float x, float y); -+ real remainderl(real x, real y); -+ -+ double remquo(double x, double y, int* quo); -+ float remquof(float x, float y, int* quo); -+ real remquol(real x, real y, int* quo); -+ -+ double copysign(double x, double y); -+ float copysignf(float x, float y); -+ real copysignl(real x, real y); -+ -+ double nan(char* tagp); -+ float nanf(char* tagp); -+ real nanl(char* tagp); -+ -+ double nextafter(double x, double y); -+ float nextafterf(float x, float y); -+ real nextafterl(real x, real y); -+ -+ double nexttoward(double x, real y); -+ float nexttowardf(float x, real y); -+ real nexttowardl(real x, real y); -+ -+ double fdim(double x, double y); -+ float fdimf(float x, float y); -+ real fdiml(real x, real y); -+ -+ double fmax(double x, double y); -+ float fmaxf(float x, float y); -+ real fmaxl(real x, real y); -+ -+ double fmin(double x, double y); -+ float fminf(float x, float y); -+ real fminl(real x, real y); -+ -+ double fma(double x, double y, double z); -+ float fmaf(float x, float y, float z); -+ real fmal(real x, real y, real z); - } ---- a/src/libphobos/libdruntime/core/stdc/stdint.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/stdint.d 2014-04-01 16:32:51.000000000 +0100 -@@ -25,68 +25,64 @@ private import core.stdc.stddef; // for - private import core.stdc.signal; // for sig_atomic_t - private import core.stdc.wchar_; // for wint_t - --private --{ -- template typify(T) -- { -- T typify( T val ) { return val; } -- } --} -+ -+// Can't be `private` because of @@@BUG11173@@@. -+T _typify(T)(T val) @safe pure nothrow { return val; } - - extern (C): - @trusted: // Types and constants only. - nothrow: - --alias byte int8_t; --alias short int16_t; --alias int int32_t; --alias long int64_t; --//alias cent int128_t; -- --alias ubyte uint8_t; --alias ushort uint16_t; --alias uint uint32_t; --alias ulong uint64_t; --//alias ucent uint128_t; -- --alias byte int_least8_t; --alias short int_least16_t; --alias int int_least32_t; --alias long int_least64_t; -- --alias ubyte uint_least8_t; --alias ushort uint_least16_t; --alias uint uint_least32_t; --alias ulong uint_least64_t; -- --alias byte int_fast8_t; --alias int int_fast16_t; --alias int int_fast32_t; --alias long int_fast64_t; -- --alias ubyte uint_fast8_t; --alias uint uint_fast16_t; --alias uint uint_fast32_t; --alias ulong uint_fast64_t; -+alias int8_t = byte ; -+alias int16_t = short; -+alias int32_t = int ; -+alias int64_t = long ; -+//alias int128_t = cent; -+ -+alias uint8_t = ubyte ; -+alias uint16_t = ushort; -+alias uint32_t = uint ; -+alias uint64_t = ulong ; -+//alias uint128_t = ucent; -+ -+alias int_least8_t = byte ; -+alias int_least16_t = short; -+alias int_least32_t = int ; -+alias int_least64_t = long ; -+ -+alias uint_least8_t = ubyte ; -+alias uint_least16_t = ushort; -+alias uint_least32_t = uint ; -+alias uint_least64_t = ulong ; -+ -+alias int_fast8_t = byte; -+alias int_fast16_t = int ; -+alias int_fast32_t = int ; -+alias int_fast64_t = long; -+ -+alias uint_fast8_t = ubyte; -+alias uint_fast16_t = uint ; -+alias uint_fast32_t = uint ; -+alias uint_fast64_t = ulong; - - version( GNU ) - { -- alias __builtin_pointer_int intptr_t; -- alias __builtin_pointer_uint uintptr_t; -+ alias intptr_t = __builtin_pointer_int; -+ alias uintptr_t = __builtin_pointer_uint; - } - else version( D_LP64 ) - { -- alias long intptr_t; -- alias ulong uintptr_t; -+ alias intptr_t = long ; -+ alias uintptr_t = ulong; - } - else - { -- alias int intptr_t; -- alias uint uintptr_t; -+ alias intptr_t = int ; -+ alias uintptr_t = uint; - } - --alias long intmax_t; --alias ulong uintmax_t; -+alias intmax_t = long ; -+alias uintmax_t = ulong; - - enum int8_t INT8_MIN = int8_t.min; - enum int8_t INT8_MAX = int8_t.max; -@@ -155,15 +151,15 @@ enum wchar_t WCHAR_MAX = wchar_t.max; - enum wint_t WINT_MIN = wint_t.min; - enum wint_t WINT_MAX = wint_t.max; - --alias typify!(int8_t) INT8_C; --alias typify!(int16_t) INT16_C; --alias typify!(int32_t) INT32_C; --alias typify!(int64_t) INT64_C; -- --alias typify!(uint8_t) UINT8_C; --alias typify!(uint16_t) UINT16_C; --alias typify!(uint32_t) UINT32_C; --alias typify!(uint64_t) UINT64_C; -+alias INT8_C = _typify!int8_t ; -+alias INT16_C = _typify!int16_t; -+alias INT32_C = _typify!int32_t; -+alias INT64_C = _typify!int64_t; -+ -+alias UINT8_C = _typify!uint8_t ; -+alias UINT16_C = _typify!uint16_t; -+alias UINT32_C = _typify!uint32_t; -+alias UINT64_C = _typify!uint64_t; - --alias typify!(intmax_t) INTMAX_C; --alias typify!(uintmax_t) UINTMAX_C; -+alias INTMAX_C = _typify!intmax_t ; -+alias UINTMAX_C = _typify!uintmax_t; ---- a/src/libphobos/libdruntime/core/stdc/stdio.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/stdio.d 2014-04-01 16:32:51.000000000 +0100 -@@ -187,7 +187,9 @@ else version( Win64 ) - } - else version( linux ) - { -- align(1) struct _iobuf -+ alias _iobuf = _IO_FILE; -+ -+ align(1) struct _IO_FILE - { - int _flags; - char* _read_ptr; -@@ -337,36 +339,36 @@ version( Win32 ) - _IOAPP = 0x200, // non-standard - } - -- version( MinGW ) -+ version( MinGW ) -+ { -+ private extern - { -- private extern -- { -- __gshared export FILE[5] _iob; -- } -- -- __gshared FILE* stdin; -- __gshared FILE* stdout; -- __gshared FILE* stderr; -- -- shared static this() -- { -- stdin = &_iob[0]; -- stdout = &_iob[1]; -- stderr = &_iob[2]; -- } -- } -- else -- { -- extern shared void function() _fcloseallp; -- -- private extern shared FILE[_NFILE] _iob; -- -- shared stdin = &_iob[0]; -- shared stdout = &_iob[1]; -- shared stderr = &_iob[2]; -- shared stdaux = &_iob[3]; -- shared stdprn = &_iob[4]; -+ __gshared export FILE[5] _iob; - } -+ -+ __gshared FILE* stdin; -+ __gshared FILE* stdout; -+ __gshared FILE* stderr; -+ -+ shared static this() -+ { -+ stdin = &_iob[0]; -+ stdout = &_iob[1]; -+ stderr = &_iob[2]; -+ } -+ } -+ else -+ { -+ extern shared void function() _fcloseallp; -+ -+ private extern shared FILE[_NFILE] _iob; -+ -+ shared stdin = &_iob[0]; -+ shared stdout = &_iob[1]; -+ shared stderr = &_iob[2]; -+ shared stdaux = &_iob[3]; -+ shared stdprn = &_iob[4]; -+ } - } - else version( Win64 ) - { -@@ -508,18 +510,61 @@ FILE* freopen(in char* filename, in char - void setbuf(FILE* stream, char* buf); - int setvbuf(FILE* stream, char* buf, int mode, size_t size); - --int fprintf(FILE* stream, in char* format, ...); --int fscanf(FILE* stream, in char* format, ...); --int sprintf(char* s, in char* format, ...); --int sscanf(in char* s, in char* format, ...); --int vfprintf(FILE* stream, in char* format, va_list arg); --int vfscanf(FILE* stream, in char* format, va_list arg); --int vsprintf(char* s, in char* format, va_list arg); --int vsscanf(in char* s, in char* format, va_list arg); --int vprintf(in char* format, va_list arg); --int vscanf(in char* format, va_list arg); --int printf(in char* format, ...); --int scanf(in char* format, ...); -+version (MinGW) -+{ -+ // Prefer the MinGW versions over the MSVC ones, as the latter don't handle -+ // reals at all. -+ int __mingw_fprintf(FILE* stream, in char* format, ...); -+ alias __mingw_fprintf fprintf; -+ -+ int __mingw_fscanf(FILE* stream, in char* format, ...); -+ alias __mingw_fscanf fscanf; -+ -+ int __mingw_sprintf(char* s, in char* format, ...); -+ alias __mingw_sprintf sprintf; -+ -+ int __mingw_sscanf(in char* s, in char* format, ...); -+ alias __mingw_sscanf sscanf; -+ -+ int __mingw_vfprintf(FILE* stream, in char* format, va_list arg); -+ alias __mingw_vfprintf vfprintf; -+ -+ int __mingw_vfscanf(FILE* stream, in char* format, va_list arg); -+ alias __mingw_vfscanf vfscanf; -+ -+ int __mingw_vsprintf(char* s, in char* format, va_list arg); -+ alias __mingw_vsprintf vsprintf; -+ -+ int __mingw_vsscanf(in char* s, in char* format, va_list arg); -+ alias __mingw_vsscanf vsscanf; -+ -+ int __mingw_vprintf(in char* format, va_list arg); -+ alias __mingw_vprintf vprintf; -+ -+ int __mingw_vscanf(in char* format, va_list arg); -+ alias __mingw_vscanf vscanf; -+ -+ int __mingw_printf(in char* format, ...); -+ alias __mingw_printf printf; -+ -+ int __mingw_scanf(in char* format, ...); -+ alias __mingw_scanf scanf; -+} -+else -+{ -+ int fprintf(FILE* stream, in char* format, ...); -+ int fscanf(FILE* stream, in char* format, ...); -+ int sprintf(char* s, in char* format, ...); -+ int sscanf(in char* s, in char* format, ...); -+ int vfprintf(FILE* stream, in char* format, va_list arg); -+ int vfscanf(FILE* stream, in char* format, va_list arg); -+ int vsprintf(char* s, in char* format, va_list arg); -+ int vsscanf(in char* s, in char* format, va_list arg); -+ int vprintf(in char* format, va_list arg); -+ int vscanf(in char* format, va_list arg); -+ int printf(in char* format, ...); -+ int scanf(in char* format, ...); -+} - - // No usafe pointer manipulation. - @trusted -@@ -557,7 +602,25 @@ size_t fwrite(in void* ptr, size_t size, - c_long ftell(FILE* stream); - } - --version( Win32 ) -+version( MinGW ) -+{ -+ // No unsafe pointer manipulation. -+ extern (D) @trusted -+ { -+ void rewind(FILE* stream) { fseek(stream,0L,SEEK_SET); stream._flag&=~_IOERR; } -+ pure void clearerr(FILE* stream) { stream._flag &= ~(_IOERR|_IOEOF); } -+ pure int feof(FILE* stream) { return stream._flag&_IOEOF; } -+ pure int ferror(FILE* stream) { return stream._flag&_IOERR; } -+ } -+ int __mingw_snprintf(char* s, size_t n, in char* fmt, ...); -+ alias __mingw_snprintf _snprintf; -+ alias __mingw_snprintf snprintf; -+ -+ int __mingw_vsnprintf(char* s, size_t n, in char* format, va_list arg); -+ alias __mingw_vsnprintf _vsnprintf; -+ alias __mingw_vsnprintf vsnprintf; -+} -+else version( Win32 ) - { - // No unsafe pointer manipulation. - extern (D) @trusted -@@ -590,6 +653,9 @@ else version( Win64 ) - int _vsnprintf(char* s, size_t n, in char* format, va_list arg); - alias _vsnprintf vsnprintf; - -+ uint _set_output_format(uint format); -+ enum _TWO_DIGIT_EXPONENT = 1; -+ - int _filbuf(FILE *fp); - int _flsbuf(int c, FILE *fp); - ---- a/src/libphobos/libdruntime/core/stdc/stdlib.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/stdlib.d 2014-04-01 16:32:51.000000000 +0100 -@@ -67,6 +67,11 @@ version (Win64) - return strtod(nptr, endptr); - } - } -+else version (MinGW) -+{ -+ real __mingw_strtold(in char* nptr, char** endptr); -+ alias __mingw_strtold strtold; -+} - else - { - real strtold(in char* nptr, char** endptr); -@@ -124,7 +129,7 @@ version( DigitalMars ) - } - else version( GNU ) - { -- void* alloca(size_t size); // compiler intrinsic. -+ void* alloca(size_t size); // compiler intrinsic - } - - version (Win64) -@@ -135,3 +140,4 @@ version (Win64) - long _strtoi64(in char *,char **,int); - long _wcstoi64(in wchar *,wchar **,int); - } -+ ---- a/src/libphobos/libdruntime/core/stdc/string.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/string.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,14 +22,14 @@ nothrow: - - pure void* memchr(in void* s, int c, size_t n); - pure int memcmp(in void* s1, in void* s2, size_t n); --void* memcpy(void* s1, in void* s2, size_t n); --void* memmove(void* s1, in void* s2, size_t n); --void* memset(void* s, int c, size_t n); -+pure void* memcpy(void* s1, in void* s2, size_t n); -+pure void* memmove(void* s1, in void* s2, size_t n); -+pure void* memset(void* s, int c, size_t n); - --char* strcpy(char* s1, in char* s2); --char* strncpy(char* s1, in char* s2, size_t n); --char* strcat(char* s1, in char* s2); --char* strncat(char* s1, in char* s2, size_t n); -+pure char* strcpy(char* s1, in char* s2); -+pure char* strncpy(char* s1, in char* s2, size_t n); -+pure char* strcat(char* s1, in char* s2); -+pure char* strncat(char* s1, in char* s2, size_t n); - pure int strcmp(in char* s1, in char* s2); - int strcoll(in char* s1, in char* s2); - pure int strncmp(in char* s1, in char* s2, size_t n); ---- a/src/libphobos/libdruntime/core/stdc/tgmath.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/tgmath.d 2014-04-01 16:32:51.000000000 +0100 -@@ -168,13 +168,13 @@ version( FreeBSD ) - alias core.stdc.math.log1pf log1p; - alias core.stdc.math.log1pl log1p; - -- alias core.stdc.math.log2 log1p; -- alias core.stdc.math.log2f log1p; -- alias core.stdc.math.log2l log1p; -- -- alias core.stdc.math.logb log1p; -- alias core.stdc.math.logbf log1p; -- alias core.stdc.math.logbl log1p; -+ alias core.stdc.math.log2 log2; -+ alias core.stdc.math.log2f log2; -+ alias core.stdc.math.log2l log2; -+ -+ alias core.stdc.math.logb logb; -+ alias core.stdc.math.logbf logb; -+ alias core.stdc.math.logbl logb; - - alias core.stdc.math.modf modf; - alias core.stdc.math.modff modf; -@@ -486,13 +486,13 @@ else - alias core.stdc.math.log1pf log1p; - alias core.stdc.math.log1pl log1p; - -- alias core.stdc.math.log2 log1p; -- alias core.stdc.math.log2f log1p; -- alias core.stdc.math.log2l log1p; -- -- alias core.stdc.math.logb log1p; -- alias core.stdc.math.logbf log1p; -- alias core.stdc.math.logbl log1p; -+ alias core.stdc.math.log2 log2; -+ alias core.stdc.math.log2f log2; -+ alias core.stdc.math.log2l log2; -+ -+ alias core.stdc.math.logb logb; -+ alias core.stdc.math.logbf logb; -+ alias core.stdc.math.logbl logb; - - alias core.stdc.math.modf modf; - alias core.stdc.math.modff modf; ---- a/src/libphobos/libdruntime/core/stdc/time.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/stdc/time.d 2014-04-01 16:32:51.000000000 +0100 -@@ -55,8 +55,15 @@ else - } - } - --alias c_long time_t; --alias c_long clock_t; -+version ( Posix ) -+{ -+ public import core.sys.posix.sys.types : time_t, clock_t; -+} -+else -+{ -+ alias c_long time_t; -+ alias c_long clock_t; -+} - - version( Windows ) - { ---- a/src/libphobos/libdruntime/core/sync/condition.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sync/condition.d 2014-04-01 16:32:51.000000000 +0100 -@@ -211,39 +211,6 @@ class Condition - - - /** -- * $(RED Deprecated. It will be removed in December 2012. Please use the -- * version which takes a $(D Duration) instead.) -- * -- * Suspends the calling thread until a notification occurs or until the -- * supplied time period has elapsed. -- * -- * Params: -- * period = The time to wait, in 100 nanosecond intervals. This value may -- * be adjusted to equal the maximum wait period supported by the -- * target platform if it is too large. -- * -- * In: -- * period must be non-negative. -- * -- * Throws: -- * SyncException on error. -- * -- * Returns: -- * true if notified before the timeout and false if not. -- */ -- deprecated("Please use the overload of wait which takes a Duration.") -- bool wait( long period ) -- in -- { -- assert( period >= 0 ); -- } -- body -- { -- return wait( dur!"hnsecs"( period ) ); -- } -- -- -- /** - * Notifies one waiter. - * - * Throws: -@@ -597,8 +564,8 @@ version( unittest ) - waiting = true; - // we never want to miss the notification (30s) - alertedOne = condReady.wait( dur!"seconds"(30) ); -- // but we don't want to wait long for the timeout (1s) -- alertedTwo = condReady.wait( dur!"seconds"(1) ); -+ // but we don't want to wait long for the timeout (10ms) -+ alertedTwo = condReady.wait( dur!"msecs"(10) ); - } - } - ---- a/src/libphobos/libdruntime/core/sync/exception.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sync/exception.d 2014-04-01 16:32:51.000000000 +0100 -@@ -20,12 +20,12 @@ module core.sync.exception; - */ - class SyncException : Exception - { -- this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - super(msg, file, line, next); - } - -- this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) -+ @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) - { - super(msg, file, line, next); - } ---- a/src/libphobos/libdruntime/core/sync/rwmutex.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sync/rwmutex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -399,117 +399,138 @@ private: - //////////////////////////////////////////////////////////////////////////////// - - --version( unittest ) -+unittest - { -- static if( !is( typeof( Thread ) ) ) -- private import core.thread; -+ import core.atomic, core.thread, core.sync.semaphore; - -- -- void testRead( ReadWriteMutex.Policy policy ) -+ static void runTest(ReadWriteMutex.Policy policy) - { -- auto mutex = new ReadWriteMutex( policy ); -- auto synInfo = new Object; -- int numThreads = 10; -- int numReaders = 0; -- int maxReaders = 0; -+ scope mutex = new ReadWriteMutex(policy); -+ scope rdSemA = new Semaphore, rdSemB = new Semaphore, -+ wrSemA = new Semaphore, wrSemB = new Semaphore; -+ shared size_t numReaders, numWriters; - - void readerFn() - { -- synchronized( mutex.reader ) -+ synchronized (mutex.reader) - { -- synchronized( synInfo ) -- { -- if( ++numReaders > maxReaders ) -- maxReaders = numReaders; -- } -- Thread.sleep( dur!"msecs"(1) ); -- synchronized( synInfo ) -- { -- --numReaders; -- } -+ atomicOp!"+="(numReaders, 1); -+ rdSemA.notify(); -+ rdSemB.wait(); -+ atomicOp!"-="(numReaders, 1); - } - } - -- auto group = new ThreadGroup; -- -- for( int i = 0; i < numThreads; ++i ) -- { -- group.create( &readerFn ); -- } -- group.joinAll(); -- assert( numReaders < 1 && maxReaders > 1 ); -- } -- -- -- void testReadWrite( ReadWriteMutex.Policy policy ) -- { -- auto mutex = new ReadWriteMutex( policy ); -- auto synInfo = new Object; -- int numThreads = 10; -- int numReaders = 0; -- int numWriters = 0; -- int maxReaders = 0; -- int maxWriters = 0; -- int numTries = 20; -- -- void readerFn() -+ void writerFn() - { -- for( int i = 0; i < numTries; ++i ) -+ synchronized (mutex.writer) - { -- synchronized( mutex.reader ) -- { -- synchronized( synInfo ) -- { -- if( ++numReaders > maxReaders ) -- maxReaders = numReaders; -- } -- Thread.sleep( dur!"msecs"(1) ); -- synchronized( synInfo ) -- { -- --numReaders; -- } -- } -+ atomicOp!"+="(numWriters, 1); -+ wrSemA.notify(); -+ wrSemB.wait(); -+ atomicOp!"-="(numWriters, 1); - } - } - -- void writerFn() -+ void waitQueued(size_t queuedReaders, size_t queuedWriters) - { -- for( int i = 0; i < numTries; ++i ) -+ for (;;) - { -- synchronized( mutex.writer ) -+ synchronized (mutex.m_commonMutex) - { -- synchronized( synInfo ) -- { -- if( ++numWriters > maxWriters ) -- maxWriters = numWriters; -- } -- Thread.sleep( dur!"msecs"(1) ); -- synchronized( synInfo ) -- { -- --numWriters; -- } -+ if (mutex.m_numQueuedReaders == queuedReaders && -+ mutex.m_numQueuedWriters == queuedWriters) -+ break; - } -+ Thread.yield(); - } - } - -- auto group = new ThreadGroup; -+ scope group = new ThreadGroup; - -- for( int i = 0; i < numThreads; ++i ) -- { -- group.create( &readerFn ); -- group.create( &writerFn ); -- } -+ // 2 simultaneous readers -+ group.create(&readerFn); group.create(&readerFn); -+ rdSemA.wait(); rdSemA.wait(); -+ assert(numReaders == 2); -+ rdSemB.notify(); rdSemB.notify(); - group.joinAll(); -- assert( numReaders < 1 && maxReaders > 1 && -- numWriters < 1 && maxWriters < 2 ); -- } -+ assert(numReaders == 0); -+ foreach (t; group) group.remove(t); - -+ // 1 writer at a time -+ group.create(&writerFn); group.create(&writerFn); -+ wrSemA.wait(); -+ assert(!wrSemA.tryWait()); -+ assert(numWriters == 1); -+ wrSemB.notify(); -+ wrSemA.wait(); -+ assert(numWriters == 1); -+ wrSemB.notify(); -+ group.joinAll(); -+ assert(numWriters == 0); -+ foreach (t; group) group.remove(t); - -- unittest -- { -- testRead( ReadWriteMutex.Policy.PREFER_READERS ); -- testRead( ReadWriteMutex.Policy.PREFER_WRITERS ); -- testReadWrite( ReadWriteMutex.Policy.PREFER_READERS ); -- testReadWrite( ReadWriteMutex.Policy.PREFER_WRITERS ); -+ // reader and writer are mutually exclusive -+ group.create(&readerFn); -+ rdSemA.wait(); -+ group.create(&writerFn); -+ waitQueued(0, 1); -+ assert(!wrSemA.tryWait()); -+ assert(numReaders == 1 && numWriters == 0); -+ rdSemB.notify(); -+ wrSemA.wait(); -+ assert(numReaders == 0 && numWriters == 1); -+ wrSemB.notify(); -+ group.joinAll(); -+ assert(numReaders == 0 && numWriters == 0); -+ foreach (t; group) group.remove(t); -+ -+ // writer and reader are mutually exclusive -+ group.create(&writerFn); -+ wrSemA.wait(); -+ group.create(&readerFn); -+ waitQueued(1, 0); -+ assert(!rdSemA.tryWait()); -+ assert(numReaders == 0 && numWriters == 1); -+ wrSemB.notify(); -+ rdSemA.wait(); -+ assert(numReaders == 1 && numWriters == 0); -+ rdSemB.notify(); -+ group.joinAll(); -+ assert(numReaders == 0 && numWriters == 0); -+ foreach (t; group) group.remove(t); -+ -+ // policy determines whether queued reader or writers progress first -+ group.create(&writerFn); -+ wrSemA.wait(); -+ group.create(&readerFn); -+ group.create(&writerFn); -+ waitQueued(1, 1); -+ assert(numReaders == 0 && numWriters == 1); -+ wrSemB.notify(); -+ -+ if (policy == ReadWriteMutex.Policy.PREFER_READERS) -+ { -+ rdSemA.wait(); -+ assert(numReaders == 1 && numWriters == 0); -+ rdSemB.notify(); -+ wrSemA.wait(); -+ assert(numReaders == 0 && numWriters == 1); -+ wrSemB.notify(); -+ } -+ else if (policy == ReadWriteMutex.Policy.PREFER_WRITERS) -+ { -+ wrSemA.wait(); -+ assert(numReaders == 0 && numWriters == 1); -+ wrSemB.notify(); -+ rdSemA.wait(); -+ assert(numReaders == 1 && numWriters == 0); -+ rdSemB.notify(); -+ } -+ group.joinAll(); -+ assert(numReaders == 0 && numWriters == 0); -+ foreach (t; group) group.remove(t); - } -+ runTest(ReadWriteMutex.Policy.PREFER_READERS); -+ runTest(ReadWriteMutex.Policy.PREFER_WRITERS); - } ---- a/src/libphobos/libdruntime/core/sync/semaphore.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sync/semaphore.d 2014-04-01 16:32:51.000000000 +0100 -@@ -171,7 +171,7 @@ class Semaphore - * period = The time to wait. - * - * In: -- * val must be non-negative. -+ * period must be non-negative. - * - * Throws: - * SyncException on error. -@@ -179,10 +179,10 @@ class Semaphore - * Returns: - * true if notified before the timeout and false if not. - */ -- bool wait( Duration val ) -+ bool wait( Duration period ) - in - { -- assert( !val.isNegative ); -+ assert( !period.isNegative ); - } - body - { -@@ -190,7 +190,7 @@ class Semaphore - { - auto maxWaitMillis = dur!("msecs")( uint.max - 1 ); - -- while( val > maxWaitMillis ) -+ while( period > maxWaitMillis ) - { - auto rc = WaitForSingleObject( m_hndl, cast(uint) - maxWaitMillis.total!"msecs" ); -@@ -199,13 +199,13 @@ class Semaphore - case WAIT_OBJECT_0: - return true; - case WAIT_TIMEOUT: -- val -= maxWaitMillis; -+ period -= maxWaitMillis; - continue; - default: - throw new SyncException( "Unable to wait for semaphore" ); - } - } -- switch( WaitForSingleObject( m_hndl, cast(uint) val.total!"msecs" ) ) -+ switch( WaitForSingleObject( m_hndl, cast(uint) period.total!"msecs" ) ) - { - case WAIT_OBJECT_0: - return true; -@@ -220,15 +220,15 @@ class Semaphore - mach_timespec_t t = void; - (cast(byte*) &t)[0 .. t.sizeof] = 0; - -- if( val.total!"seconds" > t.tv_sec.max ) -+ if( period.total!"seconds" > t.tv_sec.max ) - { - t.tv_sec = t.tv_sec.max; -- t.tv_nsec = cast(typeof(t.tv_nsec)) val.fracSec.nsecs; -+ t.tv_nsec = cast(typeof(t.tv_nsec)) period.fracSec.nsecs; - } - else - { -- t.tv_sec = cast(typeof(t.tv_sec)) val.total!"seconds"; -- t.tv_nsec = cast(typeof(t.tv_nsec)) val.fracSec.nsecs; -+ t.tv_sec = cast(typeof(t.tv_sec)) period.total!"seconds"; -+ t.tv_nsec = cast(typeof(t.tv_nsec)) period.fracSec.nsecs; - } - while( true ) - { -@@ -244,7 +244,7 @@ class Semaphore - else version( Posix ) - { - timespec t = void; -- mktspec( t, val ); -+ mktspec( t, period ); - - while( true ) - { -@@ -260,41 +260,6 @@ class Semaphore - - - /** -- * $(RED Deprecated. It will be removed in December 2012. Please use the -- * version which takes a $(D Duration) instead.) -- * -- * Suspends the calling thread until the current count moves above zero or -- * until the supplied time period has elapsed. If the count moves above -- * zero in this interval, then atomically decrement the count by one and -- * return true. Otherwise, return false. -- * -- * Params: -- * period = The time to wait, in 100 nanosecond intervals. This value may -- * be adjusted to equal to the maximum wait period supported by -- * the target platform if it is too large. -- * -- * In: -- * period must be non-negative. -- * -- * Throws: -- * SyncException on error. -- * -- * Returns: -- * true if notified before the timeout and false if not. -- */ -- deprecated("Please use the overload of wait which takes a Duration.") -- bool wait( long period ) -- in -- { -- assert( period >= 0 ); -- } -- body -- { -- return wait( dur!("hnsecs")( period ) ); -- } -- -- -- /** - * Atomically increment the current count by one. This will notify one - * waiter, if there are any in the queue. - * -@@ -389,158 +354,89 @@ private: - - version( unittest ) - { -- private import core.thread; -- -+ import core.thread, core.atomic; - - void testWait() - { -- auto semaphore = new Semaphore; -- int numToProduce = 10; -- bool allProduced = false; -- auto synProduced = new Object; -- int numConsumed = 0; -- auto synConsumed = new Object; -- int numConsumers = 10; -- int numComplete = 0; -- auto synComplete = new Object; -+ auto semaphore = new Semaphore; -+ shared bool stopConsumption = false; -+ immutable numToProduce = 20; -+ immutable numConsumers = 10; -+ shared size_t numConsumed; -+ shared size_t numComplete; - - void consumer() - { -- while( true ) -+ while (true) - { - semaphore.wait(); - -- synchronized( synProduced ) -- { -- if( allProduced ) -- break; -- } -- -- synchronized( synConsumed ) -- { -- ++numConsumed; -- } -- } -- -- synchronized( synComplete ) -- { -- ++numComplete; -+ if (atomicLoad(stopConsumption)) -+ break; -+ atomicOp!"+="(numConsumed, 1); - } -+ atomicOp!"+="(numComplete, 1); - } - - void producer() - { -- assert( !semaphore.tryWait() ); -+ assert(!semaphore.tryWait()); - -- for( int i = 0; i < numToProduce; ++i ) -- { -+ foreach (_; 0 .. numToProduce) - semaphore.notify(); -- Thread.yield(); -- } -- Thread.sleep( dur!"seconds"(1) ); -- synchronized( synProduced ) -- { -- allProduced = true; -- } - -- for( int i = 0; i < numConsumers; ++i ) -- { -- semaphore.notify(); -+ // wait until all items are consumed -+ while (atomicLoad(numConsumed) != numToProduce) - Thread.yield(); -- } - -- version (FreeBSD) enum factor = 500_000; -- else enum factor = 10_000; -- -- for( int i = numConsumers * factor; i > 0; --i ) -- { -- synchronized( synComplete ) -- { -- if( numComplete == numConsumers ) -- break; -- } -- Thread.yield(); -- } -+ // mark consumption as finished -+ atomicStore(stopConsumption, true); - -- { -- bool cond; -- synchronized( synComplete ) -- { -- cond = numComplete == numConsumers; -- } -- assert(cond); -- } -+ // wake all consumers -+ foreach (_; 0 .. numConsumers) -+ semaphore.notify(); - -- { -- bool cond; -- synchronized( synConsumed ) -- { -- cond = numConsumed == numToProduce; -- } -- assert(cond); -- } -+ // wait until all consumers completed -+ while (atomicLoad(numComplete) != numConsumers) -+ Thread.yield(); - -- assert( !semaphore.tryWait() ); -+ assert(!semaphore.tryWait()); - semaphore.notify(); -- assert( semaphore.tryWait() ); -- assert( !semaphore.tryWait() ); -+ assert(semaphore.tryWait()); -+ assert(!semaphore.tryWait()); - } - - auto group = new ThreadGroup; - - for( int i = 0; i < numConsumers; ++i ) -- group.create( &consumer ); -- group.create( &producer ); -+ group.create(&consumer); -+ group.create(&producer); - group.joinAll(); - } - - - void testWaitTimeout() - { -- auto synReady = new Object; -- auto semReady = new Semaphore; -- bool alertedOne = true; -- bool alertedTwo = true; -- int numReady = 0; -+ auto sem = new Semaphore; -+ shared bool semReady; -+ bool alertedOne, alertedTwo; - - void waiter() - { -- synchronized( synReady ) -- { -- numReady++; -- } -- while( true ) -- { -- synchronized( synReady ) -- { -- if( numReady > 1 ) -- break; -- } -+ while (!atomicLoad(semReady)) - Thread.yield(); -- } -- alertedOne = semReady.wait( dur!"msecs"(100) ); -- alertedTwo = semReady.wait( dur!"msecs"(100) ); -+ alertedOne = sem.wait(dur!"msecs"(1)); -+ alertedTwo = sem.wait(dur!"msecs"(1)); -+ assert(alertedOne && !alertedTwo); - } - -- auto thread = new Thread( &waiter ); -+ auto thread = new Thread(&waiter); - thread.start(); - -- while( true ) -- { -- synchronized( synReady ) -- { -- if( numReady ) -- { -- numReady++; -- break; -- } -- } -- Thread.yield(); -- } -- Thread.yield(); -- semReady.notify(); -+ sem.notify(); -+ atomicStore(semReady, true); - thread.join(); -- assert( numReady == 2 && alertedOne && !alertedTwo ); -+ assert(alertedOne && !alertedTwo); - } - - ---- a/src/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,187 @@ -+/** -+ * D header file for FreeBSD. -+ * -+ * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/elf32.h?view=markup, sys/elf32.h) -+ */ -+module core.sys.freebsd.sys.elf32; -+ -+version (FreeBSD): -+extern (C): -+pure: -+nothrow: -+ -+import core.stdc.stdint; -+public import core.sys.freebsd.sys.elf_common; -+ -+alias uint16_t Elf32_Half; -+alias uint32_t Elf32_Word; -+alias int32_t Elf32_Sword; -+alias uint64_t Elf32_Lword; -+alias uint32_t Elf32_Addr; -+alias uint32_t Elf32_Off; -+alias Elf32_Word Elf32_Hashelt; -+alias Elf32_Word Elf32_Size; -+alias Elf32_Sword Elf32_Ssize; -+ -+struct Elf32_Ehdr -+{ -+ char e_ident[EI_NIDENT]; -+ Elf32_Half e_type; -+ Elf32_Half e_machine; -+ Elf32_Word e_version; -+ Elf32_Addr e_entry; -+ Elf32_Off e_phoff; -+ Elf32_Off e_shoff; -+ Elf32_Word e_flags; -+ Elf32_Half e_ehsize; -+ Elf32_Half e_phentsize; -+ Elf32_Half e_phnum; -+ Elf32_Half e_shentsize; -+ Elf32_Half e_shnum; -+ Elf32_Half e_shstrndx; -+} -+ -+struct Elf32_Shdr -+{ -+ Elf32_Word sh_name; -+ Elf32_Word sh_type; -+ Elf32_Word sh_flags; -+ Elf32_Addr sh_addr; -+ Elf32_Off sh_offset; -+ Elf32_Word sh_size; -+ Elf32_Word sh_link; -+ Elf32_Word sh_info; -+ Elf32_Word sh_addralign; -+ Elf32_Word sh_entsize; -+} -+ -+struct Elf32_Phdr -+{ -+ Elf32_Word p_type; -+ Elf32_Off p_offset; -+ Elf32_Addr p_vaddr; -+ Elf32_Addr p_paddr; -+ Elf32_Word p_filesz; -+ Elf32_Word p_memsz; -+ Elf32_Word p_flags; -+ Elf32_Word p_align; -+} -+ -+struct Elf32_Dyn -+{ -+ Elf32_Sword d_tag; -+ union _d_un -+ { -+ Elf32_Word d_val; -+ Elf32_Addr d_ptr; -+ } _d_un d_un; -+} -+ -+struct Elf32_Rel -+{ -+ Elf32_Addr r_offset; -+ Elf32_Word r_info; -+} -+ -+struct Elf32_Rela -+{ -+ Elf32_Addr r_offset; -+ Elf32_Word r_info; -+ Elf32_Sword r_addend; -+} -+ -+extern (D) -+{ -+ auto ELF32_R_SYM(V)(V val) { return val >> 8; } -+ auto ELF32_R_TYPE(V)(V val) { return val & 0xff; } -+ auto ELF32_R_INFO(S, T)(S sym, T type) { return (sym << 8) + (type & 0xff); } -+} -+ -+alias Elf_Note Elf32_Nhdr; -+ -+struct Elf32_Move -+{ -+ Elf32_Lword m_value; -+ Elf32_Word m_info; -+ Elf32_Word m_poffset; -+ Elf32_Half m_repeat; -+ Elf32_Half m_stride; -+} -+ -+extern (D) -+{ -+ auto ELF32_M_SYM(I)(I info) { return info >> 8; } -+ auto ELF32_M_SIZE(I)(I info) { return cast(ubyte)info; } -+ auto ELF32_M_INFO(S, SZ)(S sym, SZ size) { return (sym << 8) + cast(ubye)size; } -+} -+ -+struct Elf32_Cap -+{ -+ Elf32_Word c_tag; -+ union _c_un -+ { -+ Elf32_Word c_val; -+ Elf32_Addr c_ptr; -+ } _c_un c_un; -+} -+ -+struct Elf32_Sym -+{ -+ Elf32_Word st_name; -+ Elf32_Addr st_value; -+ Elf32_Word st_size; -+ ubyte st_info; -+ ubyte st_other; -+ Elf32_Half st_shndx; -+} -+ -+extern (D) -+{ -+ auto ELF32_ST_BIND(T)(T val) { return cast(ubyte)val >> 4; } -+ auto ELF32_ST_TYPE(T)(T val) { return val & 0xf; } -+ auto ELF32_ST_INFO(B, T)(B bind, T type) { return (bind << 4) + (type & 0xf); } -+ auto ELF32_ST_VISIBILITY(O)(O o) { return o & 0x03; } -+} -+ -+struct Elf32_Verdef -+{ -+ Elf32_Half vd_version; -+ Elf32_Half vd_flags; -+ Elf32_Half vd_ndx; -+ Elf32_Half vd_cnt; -+ Elf32_Word vd_hash; -+ Elf32_Word vd_aux; -+ Elf32_Word vd_next; -+} -+ -+struct Elf32_Verdaux -+{ -+ Elf32_Word vda_name; -+ Elf32_Word vda_next; -+} -+ -+struct Elf32_Verneed -+{ -+ Elf32_Half vn_version; -+ Elf32_Half vn_cnt; -+ Elf32_Word vn_file; -+ Elf32_Word vn_aux; -+ Elf32_Word vn_next; -+} -+ -+struct Elf32_Vernaux -+{ -+ Elf32_Word vna_hash; -+ Elf32_Half vna_flags; -+ Elf32_Half vna_other; -+ Elf32_Word vna_name; -+ Elf32_Word vna_next; -+} -+ -+alias Elf32_Half Elf32_Versym; -+ -+struct Elf32_Syminfo -+{ -+ Elf32_Half si_boundto; -+ Elf32_Half si_flags; -+} ---- a/src/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,193 @@ -+/** -+ * D header file for FreeBSD. -+ * -+ * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/elf64.h?view=markup, sys/elf64.h) -+ */ -+module core.sys.freebsd.sys.elf64; -+ -+version (FreeBSD): -+extern (C): -+pure: -+nothrow: -+ -+import core.stdc.stdint; -+public import core.sys.freebsd.sys.elf_common; -+ -+alias uint16_t Elf64_Half; -+alias uint32_t Elf64_Word; -+alias int32_t Elf64_Sword; -+alias uint64_t Elf64_Lword; -+alias uint64_t Elf64_Xword; -+alias int64_t Elf64_Sxword; -+alias uint64_t Elf64_Addr; -+alias uint64_t Elf64_Off; -+alias Elf64_Word Elf64_Hashelt; -+alias Elf64_Xword Elf64_Size; -+alias Elf64_Sxword Elf64_Ssize; -+ -+struct Elf64_Ehdr -+{ -+ char e_ident[EI_NIDENT]; -+ Elf64_Half e_type; -+ Elf64_Half e_machine; -+ Elf64_Word e_version; -+ Elf64_Addr e_entry; -+ Elf64_Off e_phoff; -+ Elf64_Off e_shoff; -+ Elf64_Word e_flags; -+ Elf64_Half e_ehsize; -+ Elf64_Half e_phentsize; -+ Elf64_Half e_phnum; -+ Elf64_Half e_shentsize; -+ Elf64_Half e_shnum; -+ Elf64_Half e_shstrndx; -+} -+ -+struct Elf64_Shdr -+{ -+ Elf64_Word sh_name; -+ Elf64_Word sh_type; -+ Elf64_Xword sh_flags; -+ Elf64_Addr sh_addr; -+ Elf64_Off sh_offset; -+ Elf64_Xword sh_size; -+ Elf64_Word sh_link; -+ Elf64_Word sh_info; -+ Elf64_Xword sh_addralign; -+ Elf64_Xword sh_entsize; -+} -+ -+struct Elf64_Phdr -+{ -+ Elf64_Word p_type; -+ Elf64_Word p_flags; -+ Elf64_Off p_offset; -+ Elf64_Addr p_vaddr; -+ Elf64_Addr p_paddr; -+ Elf64_Xword p_filesz; -+ Elf64_Xword p_memsz; -+ Elf64_Xword p_align; -+} -+ -+struct Elf64_Dyn -+{ -+ Elf64_Sxword d_tag; -+ union _d_un -+ { -+ Elf64_Xword d_val; -+ Elf64_Addr d_ptr; -+ } _d_un d_un; -+} -+ -+struct Elf64_Rel -+{ -+ Elf64_Addr r_offset; -+ Elf64_Xword r_info; -+} -+ -+struct Elf64_Rela -+{ -+ Elf64_Addr r_offset; -+ Elf64_Xword r_info; -+ Elf64_Sxword r_addend; -+} -+ -+extern (D) -+{ -+ auto ELF64_R_SYM(I)(I i) { return i >> 32; } -+ auto ELF64_R_TYPE(I)(I i) { return i & 0xffffffff; } -+ auto ELF64_R_INFO(S, T)(S sym, T type) { return (sym << 32) + (type & 0xffffffff); } -+ -+ auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; } -+ auto ELF64_R_TYPE_ID(I)(I i) { return (cast(Elf64_Xword) i << 56 ) >> 56; } -+ auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; } -+} -+ -+alias Elf_Note Elf64_Nhdr; -+ -+struct Elf64_Move -+{ -+ Elf64_Lword m_value; -+ Elf64_Xword m_info; -+ Elf64_Xword m_poffset; -+ Elf64_Half m_repeat; -+ Elf64_Half m_stride; -+} -+ -+extern (D) -+{ -+ auto ELF64_M_SYM(I)(I info) { return info >> 8; } -+ auto ELF64_M_SIZE(I)(I info) { return cast(ubyte)info; } -+ auto ELF64_M_INFO(S, SZ)(S sym, SZ size) { return (sym << 8) + cast(ubye)size; } -+} -+ -+struct Elf64_Cap -+{ -+ Elf64_Xword c_tag; -+ union _c_un -+ { -+ Elf64_Xword c_val; -+ Elf64_Addr c_ptr; -+ } _c_un c_un; -+} -+ -+struct Elf64_Sym -+{ -+ Elf64_Word st_name; -+ ubyte st_info; -+ ubyte st_other; -+ Elf64_Half st_shndx; -+ Elf64_Addr st_value; -+ Elf64_Xword st_size; -+} -+ -+extern (D) -+{ -+ auto ELF64_ST_BIND(T)(T val) { return cast(ubyte)val >> 4; } -+ auto ELF64_ST_TYPE(T)(T val) { return val & 0xf; } -+ auto ELF64_ST_INFO(B, T)(B bind, T type) { return (bind << 4) + (type & 0xf); } -+ auto ELF64_ST_VISIBILITY(O)(O o) { return o & 0x03; } -+} -+ -+struct Elf64_Verdef -+{ -+ Elf64_Half vd_version; -+ Elf64_Half vd_flags; -+ Elf64_Half vd_ndx; -+ Elf64_Half vd_cnt; -+ Elf64_Word vd_hash; -+ Elf64_Word vd_aux; -+ Elf64_Word vd_next; -+} -+ -+struct Elf64_Verdaux -+{ -+ Elf64_Word vda_name; -+ Elf64_Word vda_next; -+} -+ -+struct Elf64_Verneed -+{ -+ Elf64_Half vn_version; -+ Elf64_Half vn_cnt; -+ Elf64_Word vn_file; -+ Elf64_Word vn_aux; -+ Elf64_Word vn_next; -+} -+ -+struct Elf64_Vernaux -+{ -+ Elf64_Word vna_hash; -+ Elf64_Half vna_flags; -+ Elf64_Half vna_other; -+ Elf64_Word vna_name; -+ Elf64_Word vna_next; -+} -+ -+alias Elf64_Half Elf64_Versym; -+ -+struct Elf64_Syminfo -+{ -+ Elf64_Half si_boundto; -+ Elf64_Half si_flags; -+} ---- a/src/libphobos/libdruntime/core/sys/freebsd/sys/elf_common.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/freebsd/sys/elf_common.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,853 @@ -+/** -+ * D header file for FreeBSD. -+ * -+ * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/elf_common.h?view=markup, sys/elf_common.h) -+ */ -+module core.sys.freebsd.sys.elf_common; -+ -+version (FreeBSD): -+extern (C): -+pure: -+nothrow: -+ -+import core.stdc.stdint; -+ -+struct Elf_Note -+{ -+ uint32_t n_namesz; -+ uint32_t n_descsz; -+ uint32_t n_type; -+} -+ -+struct Elf_GNU_Hash_Header -+{ -+ uint32_t gh_nbuckets; -+ uint32_t gh_symndx; -+ uint32_t gh_maskwords; -+ uint32_t gh_shift2; -+} -+ -+enum EI_MAG0 = 0; -+enum EI_MAG1 = 1; -+enum EI_MAG2 = 2; -+enum EI_MAG3 = 3; -+enum EI_CLASS = 4; -+enum EI_DATA = 5; -+enum EI_VERSION = 6; -+enum EI_OSABI = 7; -+enum EI_ABIVERSION = 8; -+enum OLD_EI_BRAND = 8; -+enum EI_PAD = 9; -+enum EI_NIDENT = 16; -+ -+enum ELFMAG0 = 0x7f; -+enum ELFMAG1 = 'E'; -+enum ELFMAG2 = 'L'; -+enum ELFMAG3 = 'F'; -+enum ELFMAG = "\177ELF"; -+enum SELFMAG = 4; -+ -+enum EV_NONE = 0; -+enum EV_CURRENT = 1; -+ -+enum ELFCLASSNONE = 0; -+enum ELFCLASS32 = 1; -+enum ELFCLASS64 = 2; -+ -+enum ELFDATANONE = 0; -+enum ELFDATA2LSB = 1; -+enum ELFDATA2MSB = 2; -+ -+enum ELFOSABI_NONE = 0; -+enum ELFOSABI_SYSV = 0; -+enum ELFOSABI_HPUX = 1; -+enum ELFOSABI_NETBSD = 2; -+enum ELFOSABI_LINUX = 3; -+enum ELFOSABI_HURD = 4; -+enum ELFOSABI_86OPEN = 5; -+enum ELFOSABI_SOLARIS = 6; -+enum ELFOSABI_AIX = 7; -+enum ELFOSABI_MONTEREY = 7; -+enum ELFOSABI_IRIX = 8; -+enum ELFOSABI_FREEBSD = 9; -+enum ELFOSABI_TRU64 = 10; -+enum ELFOSABI_MODESTO = 11; -+enum ELFOSABI_OPENBSD = 12; -+enum ELFOSABI_OPENVMS = 13; -+enum ELFOSABI_NSK = 14; -+enum ELFOSABI_AROS = 15; -+enum ELFOSABI_ARM = 97; -+enum ELFOSABI_STANDALONE = 255; -+ -+extern (D) -+{ -+ auto IS_ELF(T)(T ehdr) { return ehdr.e_ident[EI_MAG0] == ELFMAG0 && -+ ehdr.e_ident[EI_MAG1] == ELFMAG1 && -+ ehdr.e_ident[EI_MAG2] == ELFMAG2 && -+ ehdr.e_ident[EI_MAG3] == ELFMAG3; } -+} -+ -+enum ET_NONE = 0; -+enum ET_REL = 1; -+enum ET_EXEC = 2; -+enum ET_DYN = 3; -+enum ET_CORE = 4; -+enum ET_LOOS = 0xfe00; -+enum ET_HIOS = 0xfeff; -+enum ET_LOPROC = 0xff00; -+enum ET_HIPROC = 0xffff; -+ -+enum EM_NONE = 0; -+enum EM_M32 = 1; -+enum EM_SPARC = 2; -+enum EM_386 = 3; -+enum EM_68K = 4; -+enum EM_88K = 5; -+enum EM_860 = 7; -+enum EM_MIPS = 8; -+enum EM_S370 = 9; -+enum EM_MIPS_RS3_LE = 10; -+enum EM_PARISC = 15; -+enum EM_VPP500 = 17; -+enum EM_SPARC32PLUS = 18; -+enum EM_960 = 19; -+enum EM_PPC = 20; -+enum EM_PPC64 = 21; -+enum EM_S390 = 22; -+enum EM_V800 = 36; -+enum EM_FR20 = 37; -+enum EM_RH32 = 38; -+enum EM_RCE = 39; -+enum EM_ARM = 40; -+enum EM_SH = 42; -+enum EM_SPARCV9 = 43; -+enum EM_TRICORE = 44; -+enum EM_ARC = 45; -+enum EM_H8_300 = 46; -+enum EM_H8_300H = 47; -+enum EM_H8S = 48; -+enum EM_H8_500 = 49; -+enum EM_IA_64 = 50; -+enum EM_MIPS_X = 51; -+enum EM_COLDFIRE = 52; -+enum EM_68HC12 = 53; -+enum EM_MMA = 54; -+enum EM_PCP = 55; -+enum EM_NCPU = 56; -+enum EM_NDR1 = 57; -+enum EM_STARCORE = 58; -+enum EM_ME16 = 59; -+enum EM_ST100 = 60; -+enum EM_TINYJ = 61; -+enum EM_X86_64 = 62; -+enum EM_AMD64 = 62; -+enum EM_PDSP = 63; -+enum EM_FX66 = 66; -+enum EM_ST9PLUS = 67; -+enum EM_ST7 = 68; -+enum EM_68HC16 = 69; -+enum EM_68HC11 = 70; -+enum EM_68HC08 = 71; -+enum EM_68HC05 = 72; -+enum EM_SVX = 73; -+enum EM_ST19 = 74; -+enum EM_VAX = 75; -+enum EM_CRIS = 76; -+enum EM_JAVELIN = 77; -+enum EM_FIREPATH = 78; -+enum EM_ZSP = 79; -+enum EM_MMIX = 80; -+enum EM_HUANY = 81; -+enum EM_PRISM = 82; -+enum EM_AVR = 83; -+enum EM_FR30 = 84; -+enum EM_D10V = 85; -+enum EM_D30V = 86; -+enum EM_V850 = 87; -+enum EM_M32R = 88; -+enum EM_MN10300 = 89; -+enum EM_MN10200 = 90; -+enum EM_PJ = 91; -+enum EM_OPENRISC = 92; -+enum EM_ARC_A5 = 93; -+enum EM_XTENSA = 94; -+enum EM_VIDEOCORE = 95; -+enum EM_TMM_GPP = 96; -+enum EM_NS32K = 97; -+enum EM_TPC = 98; -+enum EM_SNP1K = 99; -+enum EM_ST200 = 100; -+enum EM_IP2K = 101; -+enum EM_MAX = 102; -+enum EM_CR = 103; -+enum EM_F2MC16 = 104; -+enum EM_MSP430 = 105; -+enum EM_BLACKFIN = 106; -+enum EM_SE_C33 = 107; -+enum EM_SEP = 108; -+enum EM_ARCA = 109; -+enum EM_UNICORE = 110; -+ -+enum EM_486 = 6; -+enum EM_MIPS_RS4_BE = 10; -+enum EM_ALPHA_STD = 41; -+enum EM_ALPHA = 0x9026; -+ -+enum SHN_UNDEF = 0; -+enum SHN_LORESERVE = 0xff00; -+enum SHN_LOPROC = 0xff00; -+enum SHN_HIPROC = 0xff1f; -+enum SHN_LOOS = 0xff20; -+enum SHN_HIOS = 0xff3f; -+enum SHN_ABS = 0xfff1; -+enum SHN_COMMON = 0xfff2; -+enum SHN_XINDEX = 0xffff; -+enum SHN_HIRESERVE = 0xffff; -+ -+enum SHT_NULL = 0; -+enum SHT_PROGBITS = 1; -+enum SHT_SYMTAB = 2; -+enum SHT_STRTAB = 3; -+enum SHT_RELA = 4; -+enum SHT_HASH = 5; -+enum SHT_DYNAMIC = 6; -+enum SHT_NOTE = 7; -+enum SHT_NOBITS = 8; -+enum SHT_REL = 9; -+enum SHT_SHLIB = 10; -+enum SHT_DYNSYM = 11; -+enum SHT_INIT_ARRAY = 14; -+enum SHT_FINI_ARRAY = 15; -+enum SHT_PREINIT_ARRAY = 16; -+enum SHT_GROUP = 17; -+enum SHT_SYMTAB_SHNDX = 18; -+enum SHT_LOOS = 0x60000000; -+enum SHT_LOSUNW = 0x6ffffff4; -+enum SHT_SUNW_dof = 0x6ffffff4; -+enum SHT_SUNW_cap = 0x6ffffff5; -+enum SHT_SUNW_SIGNATURE = 0x6ffffff6; -+enum SHT_GNU_HASH = 0x6ffffff6; -+enum SHT_SUNW_ANNOTATE = 0x6ffffff7; -+enum SHT_SUNW_DEBUGSTR = 0x6ffffff8; -+enum SHT_SUNW_DEBUG = 0x6ffffff9; -+enum SHT_SUNW_move = 0x6ffffffa; -+enum SHT_SUNW_COMDAT = 0x6ffffffb; -+enum SHT_SUNW_syminfo = 0x6ffffffc; -+enum SHT_SUNW_verdef = 0x6ffffffd; -+enum SHT_GNU_verdef = 0x6ffffffd; -+enum SHT_SUNW_verneed = 0x6ffffffe; -+enum SHT_GNU_verneed = 0x6ffffffe; -+enum SHT_SUNW_versym = 0x6fffffff; -+enum SHT_GNU_versym = 0x6fffffff; -+enum SHT_HISUNW = 0x6fffffff; -+enum SHT_HIOS = 0x6fffffff; -+enum SHT_LOPROC = 0x70000000; -+enum SHT_AMD64_UNWIND = 0x70000001; -+enum SHT_ARM_EXIDX = 0x70000001; -+enum SHT_ARM_PREEMPTMAP = 0x70000002; -+enum SHT_ARM_ATTRIBUTES = 0x70000003; -+enum SHT_ARM_DEBUGOVERLAY = 0x70000004; -+enum SHT_ARM_OVERLAYSECTION = 0x70000005; -+enum SHT_MIPS_REGINFO = 0x70000006; -+enum SHT_MIPS_OPTIONS = 0x7000000d; -+enum SHT_MIPS_DWARF = 0x7000001e; -+enum SHT_HIPROC = 0x7fffffff; -+enum SHT_LOUSER = 0x80000000; -+enum SHT_HIUSER = 0x8fffffff; -+ -+enum SHF_WRITE = (1 << 0); -+enum SHF_ALLOC = (1 << 1); -+enum SHF_EXECINSTR = (1 << 2); -+enum SHF_MERGE = (1 << 4); -+enum SHF_STRINGS = (1 << 5); -+enum SHF_INFO_LINK = (1 << 6); -+enum SHF_LINK_ORDER = (1 << 7); -+enum SHF_OS_NONCONFORMING = (1 << 8); -+enum SHF_GROUP = (1 << 9); -+enum SHF_TLS = (1 << 10); -+enum SHF_MASKOS = 0x0ff00000; -+enum SHF_MASKPROC = 0xf0000000; -+ -+enum PT_NULL = 0; -+enum PT_LOAD = 1; -+enum PT_DYNAMIC = 2; -+enum PT_INTERP = 3; -+enum PT_NOTE = 4; -+enum PT_SHLIB = 5; -+enum PT_PHDR = 6; -+enum PT_TLS = 7; -+enum PT_LOOS = 0x60000000; -+enum PT_SUNW_UNWIND = 0x6464e550; -+enum PT_GNU_EH_FRAME = 0x6474e550; -+enum PT_GNU_STACK = 0x6474e551; -+enum PT_GNU_RELRO = 0x6474e552; -+enum PT_LOSUNW = 0x6ffffffa; -+enum PT_SUNWBSS = 0x6ffffffa; -+enum PT_SUNWSTACK = 0x6ffffffb; -+enum PT_SUNWDTRACE = 0x6ffffffc; -+enum PT_SUNWCAP = 0x6ffffffd; -+enum PT_HISUNW = 0x6fffffff; -+enum PT_HIOS = 0x6fffffff; -+enum PT_LOPROC = 0x70000000; -+enum PT_HIPROC = 0x7fffffff; -+ -+enum PF_X = (1 << 0); -+enum PF_W = (1 << 1); -+enum PF_R = (1 << 2); -+enum PF_MASKOS = 0x0ff00000; -+enum PF_MASKPROC = 0xf0000000; -+ -+enum PN_XNUM = 0xffff; -+ -+enum DT_NULL = 0; -+enum DT_NEEDED = 1; -+enum DT_PLTRELSZ = 2; -+enum DT_PLTGOT = 3; -+enum DT_HASH = 4; -+enum DT_STRTAB = 5; -+enum DT_SYMTAB = 6; -+enum DT_RELA = 7; -+enum DT_RELASZ = 8; -+enum DT_RELAENT = 9; -+enum DT_STRSZ = 10; -+enum DT_SYMENT = 11; -+enum DT_INIT = 12; -+enum DT_FINI = 13; -+enum DT_SONAME = 14; -+enum DT_RPATH = 15; -+enum DT_SYMBOLIC = 16; -+enum DT_REL = 17; -+enum DT_RELSZ = 18; -+enum DT_RELENT = 19; -+enum DT_PLTREL = 20; -+enum DT_DEBUG = 21; -+enum DT_TEXTREL = 22; -+enum DT_JMPREL = 23; -+enum DT_BIND_NOW = 24; -+enum DT_INIT_ARRAY = 25; -+enum DT_FINI_ARRAY = 26; -+enum DT_INIT_ARRAYSZ = 27; -+enum DT_FINI_ARRAYSZ = 28; -+enum DT_RUNPATH = 29; -+enum DT_FLAGS = 30; -+enum DT_ENCODING = 32; -+enum DT_PREINIT_ARRAY = 32; -+enum DT_PREINIT_ARRAYSZ = 33; -+enum DT_MAXPOSTAGS = 34; -+enum DT_LOOS = 0x6000000d; -+enum DT_SUNW_AUXILIARY = 0x6000000d; -+enum DT_SUNW_RTLDINF = 0x6000000e; -+enum DT_SUNW_FILTER = 0x6000000f; -+enum DT_SUNW_CAP = 0x60000010; -+enum DT_HIOS = 0x6ffff000; -+enum DT_VALRNGLO = 0x6ffffd00; -+enum DT_CHECKSUM = 0x6ffffdf8; -+enum DT_PLTPADSZ = 0x6ffffdf9; -+enum DT_MOVEENT = 0x6ffffdfa; -+enum DT_MOVESZ = 0x6ffffdfb; -+enum DT_FEATURE_1 = 0x6ffffdfc; -+enum DT_POSFLAG_1 = 0x6ffffdfd; -+enum DT_SYMINSZ = 0x6ffffdfe; -+enum DT_SYMINENT = 0x6ffffdff; -+enum DT_VALRNGHI = 0x6ffffdff; -+enum DT_ADDRRNGLO = 0x6ffffe00; -+enum DT_GNU_HASH = 0x6ffffef5; -+enum DT_CONFIG = 0x6ffffefa; -+enum DT_DEPAUDIT = 0x6ffffefb; -+enum DT_AUDIT = 0x6ffffefc; -+enum DT_PLTPAD = 0x6ffffefd; -+enum DT_MOVETAB = 0x6ffffefe; -+enum DT_SYMINFO = 0x6ffffeff; -+enum DT_ADDRRNGHI = 0x6ffffeff; -+enum DT_VERSYM = 0x6ffffff0; -+enum DT_RELACOUNT = 0x6ffffff9; -+enum DT_RELCOUNT = 0x6ffffffa; -+enum DT_FLAGS_1 = 0x6ffffffb; -+enum DT_VERDEF = 0x6ffffffc; -+enum DT_VERDEFNUM = 0x6ffffffd; -+enum DT_VERNEED = 0x6ffffffe; -+enum DT_VERNEEDNUM = 0x6fffffff; -+enum DT_LOPROC = 0x70000000; -+enum DT_DEPRECATED_SPARC_REGISTER = 0x7000001; -+enum DT_AUXILIARY = 0x7ffffffd; -+enum DT_USED = 0x7ffffffe; -+enum DT_FILTER = 0x7fffffff; -+enum DT_HIPROC = 0x7fffffff; -+ -+enum DF_ORIGIN = 0x00000001; -+enum DF_SYMBOLIC = 0x00000002; -+enum DF_TEXTREL = 0x00000004; -+enum DF_BIND_NOW = 0x00000008; -+enum DF_STATIC_TLS = 0x00000010; -+ -+enum DF_1_BIND_NOW = 0x00000001; -+enum DF_1_GLOBAL = 0x00000002; -+enum DF_1_NODELETE = 0x00000008; -+enum DF_1_LOADFLTR = 0x00000010; -+enum DF_1_NOOPEN = 0x00000040; -+enum DF_1_NODEFLIB = 0x00000800; -+ -+enum NT_PRSTATUS = 1; -+enum NT_FPREGSET = 2; -+enum NT_PRPSINFO = 3; -+enum NT_THRMISC = 7; -+enum NT_PROCSTAT_PROC = 8; -+enum NT_PROCSTAT_FILES = 9; -+enum NT_PROCSTAT_VMMAP = 10; -+enum NT_PROCSTAT_GROUPS = 11; -+enum NT_PROCSTAT_UMASK = 12; -+enum NT_PROCSTAT_RLIMIT = 13; -+enum NT_PROCSTAT_OSREL = 14; -+enum NT_PROCSTAT_PSSTRINGS = 15; -+enum NT_PROCSTAT_AUXV = 16; -+ -+enum STB_LOCAL = 0; -+enum STB_GLOBAL = 1; -+enum STB_WEAK = 2; -+enum STB_NUM = 3; -+enum STB_LOOS = 10; -+enum STB_HIOS = 12; -+enum STB_LOPROC = 13; -+enum STB_HIPROC = 15; -+ -+enum STT_NOTYPE = 0; -+enum STT_OBJECT = 1; -+enum STT_FUNC = 2; -+enum STT_SECTION = 3; -+enum STT_FILE = 4; -+enum STT_COMMON = 5; -+enum STT_TLS = 6; -+enum STT_NUM = 7; -+enum STT_LOOS = 10; -+enum STT_GNU_IFUNC = 10; -+enum STT_HIOS = 12; -+enum STT_LOPROC = 13; -+enum STT_HIPROC = 15; -+ -+enum STV_DEFAULT = 0; -+enum STV_INTERNAL = 1; -+enum STV_HIDDEN = 2; -+enum STV_PROTECTED = 3; -+enum STV_EXPORTED = 4; -+enum STV_SINGLETON = 5; -+enum STV_ELIMINATE = 6; -+ -+enum STN_UNDEF = 0; -+ -+enum VER_DEF_CURRENT = 1; -+alias VER_NDX VER_DEF_IDX; -+ -+enum VER_FLG_BASE = 0x1; -+enum VER_FLG_WEAK = 0x2; -+ -+enum VER_NEED_CURRENT = 1; -+enum VER_NEED_WEAK = 32768; -+enum VER_NEED_HIDDEN = VER_NDX_HIDDEN; -+alias VER_NDX VER_NEED_IDX; -+ -+enum VER_NDX_LOCAL = 0; -+enum VER_NDX_GLOBAL = 1; -+enum VER_NDX_GIVEN = 2; -+ -+enum VER_NDX_HIDDEN = 32768; -+extern (D) -+{ -+ auto VER_NDX(V)(V v) { return v & ~(1u << 15); } -+} -+ -+enum CA_SUNW_NULL = 0; -+enum CA_SUNW_HW_1 = 1; -+enum CA_SUNW_SF_1 = 2; -+ -+enum SYMINFO_FLG_DIRECT = 0x0001; -+enum SYMINFO_FLG_PASSTHRU = 0x0002; -+enum SYMINFO_FLG_COPY = 0x0004; -+enum SYMINFO_FLG_LAZYLOAD = 0x0008; -+enum SYMINFO_FLG_DIRECTBIND = 0x0010; -+enum SYMINFO_FLG_NOEXTDIRECT = 0x0020; -+enum SYMINFO_FLG_FILTER = 0x0002; -+enum SYMINFO_FLG_AUXILIARY = 0x0040; -+ -+enum SYMINFO_BT_SELF = 0xffff; -+enum SYMINFO_BT_PARENT = 0xfffe; -+enum SYMINFO_BT_NONE = 0xfffd; -+enum SYMINFO_BT_EXTERN = 0xfffc; -+enum SYMINFO_BT_LOWRESERVE = 0xff00; -+ -+enum SYMINFO_NONE = 0; -+enum SYMINFO_CURRENT = 1; -+enum SYMINFO_NUM = 2; -+ -+enum R_386_NONE = 0; -+enum R_386_32 = 1; -+enum R_386_PC32 = 2; -+enum R_386_GOT32 = 3; -+enum R_386_PLT32 = 4; -+enum R_386_COPY = 5; -+enum R_386_GLOB_DAT = 6; -+enum R_386_JMP_SLOT = 7; -+enum R_386_RELATIVE = 8; -+enum R_386_GOTOFF = 9; -+enum R_386_GOTPC = 10; -+enum R_386_TLS_TPOFF = 14; -+enum R_386_TLS_IE = 15; -+enum R_386_TLS_GOTIE = 16; -+enum R_386_TLS_LE = 17; -+enum R_386_TLS_GD = 18; -+enum R_386_TLS_LDM = 19; -+enum R_386_TLS_GD_32 = 24; -+enum R_386_TLS_GD_PUSH = 25; -+enum R_386_TLS_GD_CALL = 26; -+enum R_386_TLS_GD_POP = 27; -+enum R_386_TLS_LDM_32 = 28; -+enum R_386_TLS_LDM_PUSH = 29; -+enum R_386_TLS_LDM_CALL = 30; -+enum R_386_TLS_LDM_POP = 31; -+enum R_386_TLS_LDO_32 = 32; -+enum R_386_TLS_IE_32 = 33; -+enum R_386_TLS_LE_32 = 34; -+enum R_386_TLS_DTPMOD32 = 35; -+enum R_386_TLS_DTPOFF32 = 36; -+enum R_386_TLS_TPOFF32 = 37; -+enum R_386_IRELATIVE = 42; -+ -+enum R_ARM_NONE = 0; -+enum R_ARM_PC24 = 1; -+enum R_ARM_ABS32 = 2; -+enum R_ARM_REL32 = 3; -+enum R_ARM_PC13 = 4; -+enum R_ARM_ABS16 = 5; -+enum R_ARM_ABS12 = 6; -+enum R_ARM_THM_ABS5 = 7; -+enum R_ARM_ABS8 = 8; -+enum R_ARM_SBREL32 = 9; -+enum R_ARM_THM_PC22 = 10; -+enum R_ARM_THM_PC8 = 11; -+enum R_ARM_AMP_VCALL9 = 12; -+enum R_ARM_SWI24 = 13; -+enum R_ARM_THM_SWI8 = 14; -+enum R_ARM_XPC25 = 15; -+enum R_ARM_THM_XPC22 = 16; -+enum R_ARM_TLS_DTPMOD32 = 17; -+enum R_ARM_TLS_DTPOFF32 = 18; -+enum R_ARM_TLS_TPOFF32 = 19; -+enum R_ARM_COPY = 20; -+enum R_ARM_GLOB_DAT = 21; -+enum R_ARM_JUMP_SLOT = 22; -+enum R_ARM_RELATIVE = 23; -+enum R_ARM_GOTOFF = 24; -+enum R_ARM_GOTPC = 25; -+enum R_ARM_GOT32 = 26; -+enum R_ARM_PLT32 = 27; -+enum R_ARM_GNU_VTENTRY = 100; -+enum R_ARM_GNU_VTINHERIT = 101; -+enum R_ARM_RSBREL32 = 250; -+enum R_ARM_THM_RPC22 = 251; -+enum R_ARM_RREL32 = 252; -+enum R_ARM_RABS32 = 253; -+enum R_ARM_RPC24 = 254; -+enum R_ARM_RBASE = 255; -+ -+enum R_IA_64_NONE = 0; -+enum R_IA_64_IMM14 = 0x21; -+enum R_IA_64_IMM22 = 0x22; -+enum R_IA_64_IMM64 = 0x23; -+enum R_IA_64_DIR32MSB = 0x24; -+enum R_IA_64_DIR32LSB = 0x25; -+enum R_IA_64_DIR64MSB = 0x26; -+enum R_IA_64_DIR64LSB = 0x27; -+enum R_IA_64_GPREL22 = 0x2a; -+enum R_IA_64_GPREL64I = 0x2b; -+enum R_IA_64_GPREL32MSB = 0x2c; -+enum R_IA_64_GPREL32LSB = 0x2d; -+enum R_IA_64_GPREL64MSB = 0x2e; -+enum R_IA_64_GPREL64LSB = 0x2f; -+enum R_IA_64_LTOFF22 = 0x32; -+enum R_IA_64_LTOFF64I = 0x33; -+enum R_IA_64_PLTOFF22 = 0x3a; -+enum R_IA_64_PLTOFF64I = 0x3b; -+enum R_IA_64_PLTOFF64MSB = 0x3e; -+enum R_IA_64_PLTOFF64LSB = 0x3f; -+enum R_IA_64_FPTR64I = 0x43; -+enum R_IA_64_FPTR32MSB = 0x44; -+enum R_IA_64_FPTR32LSB = 0x45; -+enum R_IA_64_FPTR64MSB = 0x46; -+enum R_IA_64_FPTR64LSB = 0x47; -+enum R_IA_64_PCREL60B = 0x48; -+enum R_IA_64_PCREL21B = 0x49; -+enum R_IA_64_PCREL21M = 0x4a; -+enum R_IA_64_PCREL21F = 0x4b; -+enum R_IA_64_PCREL32MSB = 0x4c; -+enum R_IA_64_PCREL32LSB = 0x4d; -+enum R_IA_64_PCREL64MSB = 0x4e; -+enum R_IA_64_PCREL64LSB = 0x4f; -+enum R_IA_64_LTOFF_FPTR22 = 0x52; -+enum R_IA_64_LTOFF_FPTR64I = 0x53; -+enum R_IA_64_LTOFF_FPTR32MSB = 0x54; -+enum R_IA_64_LTOFF_FPTR32LSB = 0x55; -+enum R_IA_64_LTOFF_FPTR64MSB = 0x56; -+enum R_IA_64_LTOFF_FPTR64LSB = 0x57; -+enum R_IA_64_SEGREL32MSB = 0x5c; -+enum R_IA_64_SEGREL32LSB = 0x5d; -+enum R_IA_64_SEGREL64MSB = 0x5e; -+enum R_IA_64_SEGREL64LSB = 0x5f; -+enum R_IA_64_SECREL32MSB = 0x64; -+enum R_IA_64_SECREL32LSB = 0x65; -+enum R_IA_64_SECREL64MSB = 0x66; -+enum R_IA_64_SECREL64LSB = 0x67; -+enum R_IA_64_REL32MSB = 0x6c; -+enum R_IA_64_REL32LSB = 0x6d; -+enum R_IA_64_REL64MSB = 0x6e; -+enum R_IA_64_REL64LSB = 0x6f; -+enum R_IA_64_LTV32MSB = 0x74; -+enum R_IA_64_LTV32LSB = 0x75; -+enum R_IA_64_LTV64MSB = 0x76; -+enum R_IA_64_LTV64LSB = 0x77; -+enum R_IA_64_PCREL21BI = 0x79; -+enum R_IA_64_PCREL22 = 0x7a; -+enum R_IA_64_PCREL64I = 0x7b; -+enum R_IA_64_IPLTMSB = 0x80; -+enum R_IA_64_IPLTLSB = 0x81; -+enum R_IA_64_SUB = 0x85; -+enum R_IA_64_LTOFF22X = 0x86; -+enum R_IA_64_LDXMOV = 0x87; -+enum R_IA_64_TPREL14 = 0x91; -+enum R_IA_64_TPREL22 = 0x92; -+enum R_IA_64_TPREL64I = 0x93; -+enum R_IA_64_TPREL64MSB = 0x96; -+enum R_IA_64_TPREL64LSB = 0x97; -+enum R_IA_64_LTOFF_TPREL22 = 0x9a; -+enum R_IA_64_DTPMOD64MSB = 0xa6; -+enum R_IA_64_DTPMOD64LSB = 0xa7; -+enum R_IA_64_LTOFF_DTPMOD22 = 0xaa; -+enum R_IA_64_DTPREL14 = 0xb1; -+enum R_IA_64_DTPREL22 = 0xb2; -+enum R_IA_64_DTPREL64I = 0xb3; -+enum R_IA_64_DTPREL32MSB = 0xb4; -+enum R_IA_64_DTPREL32LSB = 0xb5; -+enum R_IA_64_DTPREL64MSB = 0xb6; -+enum R_IA_64_DTPREL64LSB = 0xb7; -+enum R_IA_64_LTOFF_DTPREL22 = 0xba; -+ -+enum R_MIPS_NONE = 0; -+enum R_MIPS_16 = 1; -+enum R_MIPS_32 = 2; -+enum R_MIPS_REL32 = 3; -+enum R_MIPS_26 = 4; -+enum R_MIPS_HI16 = 5; -+enum R_MIPS_LO16 = 6; -+enum R_MIPS_GPREL16 = 7; -+enum R_MIPS_LITERAL = 8; -+enum R_MIPS_GOT16 = 9; -+enum R_MIPS_PC16 = 10; -+enum R_MIPS_CALL16 = 11; -+enum R_MIPS_GPREL32 = 12; -+enum R_MIPS_GOTHI16 = 21; -+enum R_MIPS_GOTLO16 = 22; -+enum R_MIPS_CALLHI16 = 30; -+enum R_MIPS_CALLLO16 = 31; -+ -+enum R_PPC_NONE = 0; -+enum R_PPC_ADDR32 = 1; -+enum R_PPC_ADDR24 = 2; -+enum R_PPC_ADDR16 = 3; -+enum R_PPC_ADDR16_LO = 4; -+enum R_PPC_ADDR16_HI = 5; -+enum R_PPC_ADDR16_HA = 6; -+enum R_PPC_ADDR14 = 7; -+enum R_PPC_ADDR14_BRTAKEN = 8; -+enum R_PPC_ADDR14_BRNTAKEN = 9; -+enum R_PPC_REL24 = 10; -+enum R_PPC_REL14 = 11; -+enum R_PPC_REL14_BRTAKEN = 12; -+enum R_PPC_REL14_BRNTAKEN = 13; -+enum R_PPC_GOT16 = 14; -+enum R_PPC_GOT16_LO = 15; -+enum R_PPC_GOT16_HI = 16; -+enum R_PPC_GOT16_HA = 17; -+enum R_PPC_PLTREL24 = 18; -+enum R_PPC_COPY = 19; -+enum R_PPC_GLOB_DAT = 20; -+enum R_PPC_JMP_SLOT = 21; -+enum R_PPC_RELATIVE = 22; -+enum R_PPC_LOCAL24PC = 23; -+enum R_PPC_UADDR32 = 24; -+enum R_PPC_UADDR16 = 25; -+enum R_PPC_REL32 = 26; -+enum R_PPC_PLT32 = 27; -+enum R_PPC_PLTREL32 = 28; -+enum R_PPC_PLT16_LO = 29; -+enum R_PPC_PLT16_HI = 30; -+enum R_PPC_PLT16_HA = 31; -+enum R_PPC_SDAREL16 = 32; -+enum R_PPC_SECTOFF = 33; -+enum R_PPC_SECTOFF_LO = 34; -+enum R_PPC_SECTOFF_HI = 35; -+enum R_PPC_SECTOFF_HA = 36; -+ -+enum R_PPC64_ADDR64 = 38; -+enum R_PPC64_ADDR16_HIGHER = 39; -+enum R_PPC64_ADDR16_HIGHERA = 40; -+enum R_PPC64_ADDR16_HIGHEST = 41; -+enum R_PPC64_ADDR16_HIGHESTA = 42; -+enum R_PPC64_UADDR64 = 43; -+enum R_PPC64_REL64 = 44; -+enum R_PPC64_PLT64 = 45; -+enum R_PPC64_PLTREL64 = 46; -+enum R_PPC64_TOC16 = 47; -+enum R_PPC64_TOC16_LO = 48; -+enum R_PPC64_TOC16_HI = 49; -+enum R_PPC64_TOC16_HA = 50; -+enum R_PPC64_TOC = 51; -+enum R_PPC64_DTPMOD64 = 68; -+enum R_PPC64_TPREL64 = 73; -+enum R_PPC64_DTPREL64 = 78; -+ -+enum R_PPC_TLS = 67; -+enum R_PPC_DTPMOD32 = 68; -+enum R_PPC_TPREL16 = 69; -+enum R_PPC_TPREL16_LO = 70; -+enum R_PPC_TPREL16_HI = 71; -+enum R_PPC_TPREL16_HA = 72; -+enum R_PPC_TPREL32 = 73; -+enum R_PPC_DTPREL16 = 74; -+enum R_PPC_DTPREL16_LO = 75; -+enum R_PPC_DTPREL16_HI = 76; -+enum R_PPC_DTPREL16_HA = 77; -+enum R_PPC_DTPREL32 = 78; -+enum R_PPC_GOT_TLSGD16 = 79; -+enum R_PPC_GOT_TLSGD16_LO = 80; -+enum R_PPC_GOT_TLSGD16_HI = 81; -+enum R_PPC_GOT_TLSGD16_HA = 82; -+enum R_PPC_GOT_TLSLD16 = 83; -+enum R_PPC_GOT_TLSLD16_LO = 84; -+enum R_PPC_GOT_TLSLD16_HI = 85; -+enum R_PPC_GOT_TLSLD16_HA = 86; -+enum R_PPC_GOT_TPREL16 = 87; -+enum R_PPC_GOT_TPREL16_LO = 88; -+enum R_PPC_GOT_TPREL16_HI = 89; -+enum R_PPC_GOT_TPREL16_HA = 90; -+ -+enum R_PPC_EMB_NADDR32 = 101; -+enum R_PPC_EMB_NADDR16 = 102; -+enum R_PPC_EMB_NADDR16_LO = 103; -+enum R_PPC_EMB_NADDR16_HI = 104; -+enum R_PPC_EMB_NADDR16_HA = 105; -+enum R_PPC_EMB_SDAI16 = 106; -+enum R_PPC_EMB_SDA2I16 = 107; -+enum R_PPC_EMB_SDA2REL = 108; -+enum R_PPC_EMB_SDA21 = 109; -+enum R_PPC_EMB_MRKREF = 110; -+enum R_PPC_EMB_RELSEC16 = 111; -+enum R_PPC_EMB_RELST_LO = 112; -+enum R_PPC_EMB_RELST_HI = 113; -+enum R_PPC_EMB_RELST_HA = 114; -+enum R_PPC_EMB_BIT_FLD = 115; -+enum R_PPC_EMB_RELSDA = 116; -+ -+enum R_SPARC_NONE = 0; -+enum R_SPARC_8 = 1; -+enum R_SPARC_16 = 2; -+enum R_SPARC_32 = 3; -+enum R_SPARC_DISP8 = 4; -+enum R_SPARC_DISP16 = 5; -+enum R_SPARC_DISP32 = 6; -+enum R_SPARC_WDISP30 = 7; -+enum R_SPARC_WDISP22 = 8; -+enum R_SPARC_HI22 = 9; -+enum R_SPARC_22 = 10; -+enum R_SPARC_13 = 11; -+enum R_SPARC_LO10 = 12; -+enum R_SPARC_GOT10 = 13; -+enum R_SPARC_GOT13 = 14; -+enum R_SPARC_GOT22 = 15; -+enum R_SPARC_PC10 = 16; -+enum R_SPARC_PC22 = 17; -+enum R_SPARC_WPLT30 = 18; -+enum R_SPARC_COPY = 19; -+enum R_SPARC_GLOB_DAT = 20; -+enum R_SPARC_JMP_SLOT = 21; -+enum R_SPARC_RELATIVE = 22; -+enum R_SPARC_UA32 = 23; -+enum R_SPARC_PLT32 = 24; -+enum R_SPARC_HIPLT22 = 25; -+enum R_SPARC_LOPLT10 = 26; -+enum R_SPARC_PCPLT32 = 27; -+enum R_SPARC_PCPLT22 = 28; -+enum R_SPARC_PCPLT10 = 29; -+enum R_SPARC_10 = 30; -+enum R_SPARC_11 = 31; -+enum R_SPARC_64 = 32; -+enum R_SPARC_OLO10 = 33; -+enum R_SPARC_HH22 = 34; -+enum R_SPARC_HM10 = 35; -+enum R_SPARC_LM22 = 36; -+enum R_SPARC_PC_HH22 = 37; -+enum R_SPARC_PC_HM10 = 38; -+enum R_SPARC_PC_LM22 = 39; -+enum R_SPARC_WDISP16 = 40; -+enum R_SPARC_WDISP19 = 41; -+enum R_SPARC_GLOB_JMP = 42; -+enum R_SPARC_7 = 43; -+enum R_SPARC_5 = 44; -+enum R_SPARC_6 = 45; -+enum R_SPARC_DISP64 = 46; -+enum R_SPARC_PLT64 = 47; -+enum R_SPARC_HIX22 = 48; -+enum R_SPARC_LOX10 = 49; -+enum R_SPARC_H44 = 50; -+enum R_SPARC_M44 = 51; -+enum R_SPARC_L44 = 52; -+enum R_SPARC_REGISTER = 53; -+enum R_SPARC_UA64 = 54; -+enum R_SPARC_UA16 = 55; -+enum R_SPARC_TLS_GD_HI22 = 56; -+enum R_SPARC_TLS_GD_LO10 = 57; -+enum R_SPARC_TLS_GD_ADD = 58; -+enum R_SPARC_TLS_GD_CALL = 59; -+enum R_SPARC_TLS_LDM_HI22 = 60; -+enum R_SPARC_TLS_LDM_LO10 = 61; -+enum R_SPARC_TLS_LDM_ADD = 62; -+enum R_SPARC_TLS_LDM_CALL = 63; -+enum R_SPARC_TLS_LDO_HIX22 = 64; -+enum R_SPARC_TLS_LDO_LOX10 = 65; -+enum R_SPARC_TLS_LDO_ADD = 66; -+enum R_SPARC_TLS_IE_HI22 = 67; -+enum R_SPARC_TLS_IE_LO10 = 68; -+enum R_SPARC_TLS_IE_LD = 69; -+enum R_SPARC_TLS_IE_LDX = 70; -+enum R_SPARC_TLS_IE_ADD = 71; -+enum R_SPARC_TLS_LE_HIX22 = 72; -+enum R_SPARC_TLS_LE_LOX10 = 73; -+enum R_SPARC_TLS_DTPMOD32 = 74; -+enum R_SPARC_TLS_DTPMOD64 = 75; -+enum R_SPARC_TLS_DTPOFF32 = 76; -+enum R_SPARC_TLS_DTPOFF64 = 77; -+enum R_SPARC_TLS_TPOFF32 = 78; -+enum R_SPARC_TLS_TPOFF64 = 79; -+ -+enum R_X86_64_NONE = 0; -+enum R_X86_64_64 = 1; -+enum R_X86_64_PC32 = 2; -+enum R_X86_64_GOT32 = 3; -+enum R_X86_64_PLT32 = 4; -+enum R_X86_64_COPY = 5; -+enum R_X86_64_GLOB_DAT = 6; -+enum R_X86_64_JMP_SLOT = 7; -+enum R_X86_64_RELATIVE = 8; -+enum R_X86_64_GOTPCREL = 9; -+enum R_X86_64_32 = 10; -+enum R_X86_64_32S = 11; -+enum R_X86_64_16 = 12; -+enum R_X86_64_PC16 = 13; -+enum R_X86_64_8 = 14; -+enum R_X86_64_PC8 = 15; -+enum R_X86_64_DTPMOD64 = 16; -+enum R_X86_64_DTPOFF64 = 17; -+enum R_X86_64_TPOFF64 = 18; -+enum R_X86_64_TLSGD = 19; -+enum R_X86_64_TLSLD = 20; -+enum R_X86_64_DTPOFF32 = 21; -+enum R_X86_64_GOTTPOFF = 22; -+enum R_X86_64_TPOFF32 = 23; -+enum R_X86_64_IRELATIVE = 37; ---- a/src/libphobos/libdruntime/core/sys/freebsd/sys/elf.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/freebsd/sys/elf.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,11 @@ -+/** -+ * D header file for FreeBSD. -+ * -+ * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/elf.h?view=markup, sys/elf.h) -+ */ -+module core.sys.freebsd.sys.elf; -+ -+version (FreeBSD): -+ -+public import core.sys.freebsd.sys.elf32; -+public import core.sys.freebsd.sys.elf64; ---- a/src/libphobos/libdruntime/core/sys/freebsd/sys/link_elf.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/freebsd/sys/link_elf.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,77 @@ -+/** -+ * D header file for FreeBSD. -+ * -+ * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/link_elf.h?view=markup, sys/link_elf.h) -+ */ -+module core.sys.freebsd.sys.link_elf; -+ -+version (FreeBSD): -+extern (C): -+nothrow: -+ -+import core.stdc.stdint : uint64_t; -+import core.sys.freebsd.sys.elf; -+ -+version(D_LP64) -+ enum __ELF_NATIVE_CLASS = 64; -+else -+ enum __ELF_NATIVE_CLASS = 32; -+ -+template ElfW(string type) -+{ -+ mixin("alias Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~" ElfW;"); -+} -+ -+enum LA_SER_ORIG = 0x01; -+enum LA_SER_LIBPATH = 0x02; -+enum LA_SER_RUNPATH = 0x04; -+enum LA_SER_CONFIG = 0x08; -+enum LA_SER_DEFAULT = 0x40; -+enum LA_SER_SECURE = 0x80; -+ -+struct link_map -+{ -+ char* l_addr; -+ -+ version (MIPS32) -+ char* l_offs; -+ version (MIPS64) -+ char* l_offs; -+ -+ char* l_name; -+ void* l_ld; -+ link_map* l_next, l_prev; -+} -+alias link_map Link_map; -+ -+enum -+{ -+ RT_CONSISTENT, -+ RT_ADD, -+ RT_DELETE, -+} -+ -+struct r_debug -+{ -+ int r_version; -+ link_map* r_map; -+ void function(r_debug*, link_map*) r_brk; -+}; -+ -+struct dl_phdr_info -+{ -+ ElfW!"Addr" dlpi_addr; -+ char* dlpi_name; -+ ElfW!"Phdr"* dlpi_phdr; -+ ElfW!"Half" dlpi_phnum; -+ uint64_t dlpi_adds; -+ uint64_t dlpi_subs; -+ size_t dlpi_tls_modid; -+ void* dlpi_tls_data; -+}; -+ -+ -+private alias extern(C) int function(dl_phdr_info*, size_t, void*) __dl_iterate_hdr_callback; -+extern int dl_iterate_phdr(__dl_iterate_hdr_callback, void*); -+extern int _rtld_addr_phdr(const void*, dl_phdr_info*); -+extern int _rtld_get_stack_prot(); ---- a/src/libphobos/libdruntime/core/sys/linux/config.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/config.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,25 @@ -+/** -+ * D header file for GNU/Linux -+ * -+ * Authors: Martin Nowak -+ */ -+module core.sys.linux.config; -+ -+version (linux): -+ -+public import core.sys.posix.config; -+ -+// man 7 feature_test_macros -+// http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html -+enum _GNU_SOURCE = true; -+// deduced <features.h> -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=include/features.h -+enum _BSD_SOURCE = true; -+enum _SVID_SOURCE = true; -+enum _ATFILE_SOURCE = true; -+ -+enum __USE_MISC = _BSD_SOURCE || _SVID_SOURCE; -+enum __USE_BSD = _BSD_SOURCE; -+enum __USE_SVID = _SVID_SOURCE; -+enum __USE_ATFILE = _ATFILE_SOURCE; -+enum __USE_GNU = _GNU_SOURCE; ---- a/src/libphobos/libdruntime/core/sys/linux/dlfcn.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/dlfcn.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,258 @@ -+/** -+ * D header file for GNU/Linux -+ * -+ * $(LINK2 http://sourceware.org/git/?p=glibc.git;a=blob;f=dlfcn/dlfcn.h, glibc dlfcn/dlfcn.h) -+ */ -+module core.sys.linux.dlfcn; -+ -+version (linux): -+extern (C): -+nothrow: -+ -+public import core.sys.posix.dlfcn; -+import core.sys.linux.config; -+ -+// <bits/dlfcn.h> -+version (X86) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x00001; // POSIX -+ // enum RTLD_NOW = 0x00002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (X86_64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x00001; // POSIX -+ // enum RTLD_NOW = 0x00002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (MIPS32) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h -+ // enum RTLD_LAZY = 0x0001; // POSIX -+ // enum RTLD_NOW = 0x0002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00008; -+ enum RTLD_DEEPBIND = 0x00010; -+ -+ // enum RTLD_GLOBAL = 0x0004; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (PPC) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x0001; // POSIX -+ // enum RTLD_NOW = 0x0002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (PPC64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x0001; // POSIX -+ // enum RTLD_NOW = 0x0002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (ARM) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x0001; // POSIX -+ // enum RTLD_NOW = 0x0002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else version (AArch64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h -+ // enum RTLD_LAZY = 0x0001; // POSIX -+ // enum RTLD_NOW = 0x0002; // POSIX -+ enum RTLD_BINDING_MASK = 0x3; -+ enum RTLD_NOLOAD = 0x00004; -+ enum RTLD_DEEPBIND = 0x00008; -+ -+ // enum RTLD_GLOBAL = 0x00100; // POSIX -+ // enum RTLD_LOCAL = 0; // POSIX -+ enum RTLD_NODELETE = 0x01000; -+ -+ static if (__USE_GNU) -+ { -+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args) -+ { -+ _dl_mcount_wrapper_check(cast(void*)fctp); -+ return fctp(args); -+ } -+ -+ void _dl_mcount_wrapper_check(void* __selfpc); -+ } -+} -+else -+ static assert(0, "unimplemented"); -+ -+// <bits/dlfcn.h> -+ -+static if (__USE_GNU) -+{ -+ enum RTLD_NEXT = cast(void *)-1L; -+ enum RTLD_DEFAULT = cast(void *)0; -+ alias c_long Lmid_t; -+ enum LM_ID_BASE = 0; -+ enum LM_ID_NEWLM = -1; -+} -+ -+// void* dlopen(in char* __file, int __mode); // POSIX -+// int dlclose(void* __handle); // POSIX -+// void* dlsym(void* __handle, in char* __name); // POSIX -+ -+static if (__USE_GNU) -+{ -+ void* dlmopen(Lmid_t __nsid, in char* __file, int __mode); -+ void* dlvsym(void* __handle, in char* __name, in char* __version); -+} -+ -+// char* dlerror(); // POSIX -+ -+static if (__USE_GNU) -+{ -+ struct Dl_info -+ { -+ const(char)* dli_fname; -+ void* dli_fbase; -+ const(char)* dli_sname; -+ void* dli_saddr; -+ } -+ -+ int dladdr(void* __address, Dl_info* __info); -+ int dladdr1(void* __address, Dl_info* __info, void** __extra_info, int __flags); -+ -+ enum -+ { -+ RTLD_DL_SYMENT = 1, -+ RTLD_DL_LINKMAP = 2, -+ } -+ -+ int dlinfo(void* __handle, int __request, void* __arg); -+ -+ enum -+ { -+ RTLD_DI_LMID = 1, -+ RTLD_DI_LINKMAP = 2, -+ RTLD_DI_CONFIGADDR = 3, -+ RTLD_DI_SERINFO = 4, -+ RTLD_DI_SERINFOSIZE = 5, -+ RTLD_DI_ORIGIN = 6, -+ RTLD_DI_PROFILENAME = 7, -+ RTLD_DI_PROFILEOUT = 8, -+ RTLD_DI_TLS_MODID = 9, -+ RTLD_DI_TLS_DATA = 10, -+ RTLD_DI_MAX = 10, -+ } -+ -+ struct Dl_serpath -+ { -+ char* dls_name; -+ uint dls_flags; -+ } -+ -+ struct Dl_serinfo -+ { -+ size_t dls_size; -+ uint dls_cnt; -+ Dl_serpath[1] dls_serpath; -+ } -+} ---- a/src/libphobos/libdruntime/core/sys/linux/epoll.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/epoll.d 2014-04-01 16:32:51.000000000 +0100 -@@ -8,7 +8,7 @@ - */ - module core.sys.linux.epoll; - --version (Linux): -+version (linux): - - extern (C): - @system: ---- a/src/libphobos/libdruntime/core/sys/linux/errno.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/errno.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,19 @@ -+/** -+ * D header file for GNU/Linux -+ * -+ * $(LINK2 http://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/errno.h, glibc stdlib/errno.h) -+ */ -+module core.sys.linux.errno; -+ -+version (linux): -+extern (C): -+nothrow: -+ -+public import core.stdc.errno; -+import core.sys.linux.config; -+ -+static if (__USE_GNU) -+{ -+ extern __gshared char* program_invocation_name, program_invocation_short_name; -+ alias error_t = int; -+} ---- a/src/libphobos/libdruntime/core/sys/linux/link.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/link.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,164 @@ -+/** -+ * D header file for GNU/Linux -+ * -+ * $(LINK2 http://sourceware.org/git/?p=glibc.git;a=blob;f=elf/link.h, glibc elf/link.h) -+ */ -+module core.sys.linux.link; -+ -+version (linux): -+extern (C): -+nothrow: -+ -+import core.stdc.stdint : uintptr_t, uint32_t; -+import core.sys.linux.config : __WORDSIZE; -+import core.sys.linux.dlfcn : Lmid_t; -+import core.sys.linux.elf; -+ -+// <bits/elfclass.h> -+version (X86) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (X86_64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (MIPS32) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (PPC) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (PPC64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (ARM) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else version (AArch64) -+{ -+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h -+ alias __WORDSIZE __ELF_NATIVE_CLASS; -+ alias uint32_t Elf_Symndx; -+} -+else -+ static assert(0, "unimplemented"); -+// <bits/elfclass.h> -+ -+template ElfW(string type) -+{ -+ mixin("alias Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~" ElfW;"); -+} -+ -+enum -+{ -+ RT_CONSISTENT, -+ RT_ADD, -+ RT_DELETE, -+} -+ -+struct r_debug -+{ -+ int r_version; -+ link_map* r_map; -+ ElfW!"Addr" r_brk; -+ typeof(RT_CONSISTENT) r_state; -+ ElfW!"Addr" r_ldbase; -+} -+ -+extern r_debug _r_debug; -+extern ElfW!"Dyn"* _DYNAMIC; -+ -+struct link_map -+{ -+ ElfW!"Addr" l_addr; -+ char* l_name; -+ ElfW!"Dyn"* l_ld; -+ link_map* l_next, l_prev; -+} -+ -+enum -+{ -+ LA_ACT_CONSISTENT, -+ LA_ACT_ADD, -+ LA_ACT_DELETE, -+} -+ -+enum -+{ -+ LA_SER_ORIG = 0x01, -+ LA_SER_LIBPATH = 0x02, -+ LA_SER_RUNPATH = 0x04, -+ LA_SER_CONFIG = 0x08, -+ LA_SER_DEFAULT = 0x40, -+ LA_SER_SECURE = 0x80, -+} -+ -+ -+enum -+{ -+ LA_FLG_BINDTO = 0x01, -+ LA_FLG_BINDFROM = 0x02, -+} -+ -+ -+enum -+{ -+ LA_SYMB_NOPLTENTER = 0x01, -+ LA_SYMB_NOPLTEXIT = 0x02, -+ LA_SYMB_STRUCTCALL = 0x04, -+ LA_SYMB_DLSYM = 0x08, -+ LA_SYMB_ALTVALUE = 0x10, -+} -+ -+struct dl_phdr_info -+{ -+ ElfW!"Addr" dlpi_addr; -+ const(char)* dlpi_name; -+ const(ElfW!"Phdr")* dlpi_phdr; -+ ElfW!"Half" dlpi_phnum; -+ -+ // check the SIZE argument of the dl_iterate_phdr callback whether -+ // the following members are available -+ ulong dlpi_adds; -+ ulong dlpi_subs; -+ -+ size_t dlpi_tls_modid; -+ void *dlpi_tls_data; -+} -+ -+private alias extern(C) int function(dl_phdr_info*, size_t, void *) __Callback; -+extern int dl_iterate_phdr(__Callback __callback, void*__data); -+ -+ -+// ld.so auditing interfaces prototypes have to be defined by the auditing DSO. -+extern uint la_version(uint __version); -+extern void la_activity(uintptr_t *__cookie, uint __flag); -+extern char* la_objsearch(const(char)* __name, uintptr_t* __cookie, -+ uint __flag); -+extern uint la_objopen(link_map* __map, Lmid_t __lmid, -+ uintptr_t* __cookie); -+extern void la_preinit(uintptr_t* __cookie); -+extern uintptr_t la_symbind32(Elf32_Sym* __sym, uint __ndx, -+ uintptr_t* __refcook, uintptr_t* __defcook, -+ uint *__flags, const(char)* __symname); -+extern uintptr_t la_symbind64(Elf64_Sym* __sym, uint __ndx, -+ uintptr_t* __refcook, uintptr_t* __defcook, -+ uint* __flags, const(char)* __symname); -+extern uint la_objclose(uintptr_t *__cookie); ---- a/src/libphobos/libdruntime/core/sys/linux/sys/inotify.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/sys/inotify.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,56 @@ -+/** -+ * D header file for GNU/Linux. -+ * -+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) -+ * Authors: Gary Willoughby -+ */ -+module core.sys.linux.sys.inotify; -+ -+version (linux): -+extern (C): -+@system: -+nothrow: -+ -+struct inotify_event -+{ -+ int wd; -+ uint mask; -+ uint cookie; -+ uint len; -+ char[0] name; -+} -+ -+enum: uint -+{ -+ IN_ACCESS = 0x00000000, -+ IN_MODIFY = 0x00000002, -+ IN_ATTRIB = 0x00000004, -+ IN_CLOSE_WRITE = 0x00000008, -+ IN_CLOSE_NOWRITE = 0x00000010, -+ IN_OPEN = 0x00000020, -+ IN_MOVED_FROM = 0x00000040, -+ IN_MOVED_TO = 0x00000080, -+ IN_CREATE = 0x00000100, -+ IN_DELETE = 0x00000200, -+ IN_DELETE_SELF = 0x00000400, -+ IN_MOVE_SELF = 0x00000800, -+ IN_UMOUNT = 0x00002000, -+ IN_Q_OVERFLOW = 0x00004000, -+ IN_IGNORED = 0x00008000, -+ IN_CLOSE = 0x00000018, -+ IN_MOVE = 0x000000C0, -+ IN_ONLYDIR = 0x01000000, -+ IN_DONT_FOLLOW = 0x02000000, -+ IN_EXCL_UNLINK = 0x04000000, -+ IN_MASK_ADD = 0x20000000, -+ IN_ISDIR = 0x40000000, -+ IN_ONESHOT = 0x80000000, -+ IN_ALL_EVENTS = 0x80000FFF, -+ IN_CLOEXEC = 0x02000000, -+ IN_NONBLOCK = 0x00004000, -+} -+ -+int inotify_init(); -+int inotify_init1(int flags); -+int inotify_add_watch(int fd, const(char)* name, uint mask); -+int inotify_rm_watch(int fd, uint wd); ---- a/src/libphobos/libdruntime/core/sys/linux/sys/mman.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/linux/sys/mman.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,736 @@ -+/** -+ * D header file for GNU/Linux -+ * -+ * Authors: Martin Nowak -+ */ -+module core.sys.linux.sys.mman; -+ -+version (linux): -+extern (C): -+nothrow: -+ -+public import core.sys.posix.sys.mman; -+import core.sys.linux.config; -+ -+// <bits/mman.h> -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h -+version (PPC) -+{ -+ enum PROT_SAO = 0x10; -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x00080, -+ MAP_NORESERVE = 0x00040, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 0x2000, -+ // MCL_FUTURE = 0x4000, -+ // } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h -+else version (PPC64) -+{ -+ enum PROT_SAO = 0x10; -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x00080, -+ MAP_NORESERVE = 0x00040, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 0x2000, -+ // MCL_FUTURE = 0x4000, -+ // } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h -+else version (S390) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h -+else version (S390X) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h -+else version (SH) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x0100, -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x2000, -+ MAP_NORESERVE = 0x4000, -+ MAP_POPULATE = 0x8000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h -+else version (SH64) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x0100, -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x2000, -+ MAP_NORESERVE = 0x4000, -+ MAP_POPULATE = 0x8000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h -+else version (SPARC) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x0200, -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x0100, -+ MAP_NORESERVE = 0x0040, -+ _MAP_NEW = 0x80000000, -+ MAP_POPULATE = 0x8000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 0x2000, -+ // MCL_FUTURE = 0x4000, -+ // } -+ -+ static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS; -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h -+else version (SPARC64) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x0200, -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x0100, -+ MAP_NORESERVE = 0x0040, -+ _MAP_NEW = 0x80000000, -+ MAP_POPULATE = 0x8000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 0x2000, -+ // MCL_FUTURE = 0x4000, -+ // } -+ -+ static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS; -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h -+else version (X86) -+{ -+ static if (__USE_MISC) enum MAP_32BIT = 0x40; -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h -+else version (X86_64) -+{ -+ static if (__USE_MISC) enum MAP_32BIT = 0x40; -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/aarch64/bits/mman.h -+else version (AARCH64) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h -+else version (Alpha) -+{ -+ enum -+ { -+ PROT_READ = 0x1, -+ PROT_WRITE = 0x2, -+ PROT_EXEC = 0x4, -+ PROT_NONE = 0x0, -+ PROT_GROWSDOWN = 0x01000000, -+ PROT_GROWSUP = 0x02000000, -+ } -+ -+ enum MAP_SHARED = 0x01; -+ enum MAP_PRIVATE = 0x02; -+ static if (__USE_MISC) -+ enum MAP_TYPE = 0x0f; -+ -+ enum MAP_FIXED = 0x10; -+ static if (__USE_MISC) enum -+ { -+ MAP_FILE = 0, -+ MAP_ANONYMOUS = 0x10, -+ MAP_ANON = MAP_ANONYMOUS, -+ MAP_HUGE_SHIFT = 26, -+ MAP_HUGE_MASK = 0x3f, -+ } -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x01000, -+ MAP_DENYWRITE = 0x02000, -+ MAP_EXECUTABLE = 0x04000, -+ MAP_LOCKED = 0x08000, -+ MAP_NORESERVE = 0x10000, -+ MAP_POPULATE = 0x20000, -+ MAP_NONBLOCK = 0x40000, -+ MAP_STACK = 0x80000, -+ MAP_HUGETLB = 0x100000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MS_ASYNC = 1, -+ // MS_SYNC = 2, -+ // MS_INVALIDATE = 4, -+ // } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 8192, -+ // MCL_FUTURE = 16384, -+ // } -+ -+ static if (__USE_GNU) enum -+ { -+ MREMAP_MAYMOVE = 1, -+ MREMAP_FIXED = 2, -+ } -+ -+ static if (__USE_BSD) enum -+ { -+ MADV_NORMAL = 0, -+ MADV_RANDOM = 1, -+ MADV_SEQUENTIAL = 2, -+ MADV_WILLNEED = 3, -+ MADV_DONTNEED = 6, -+ MADV_REMOVE = 9, -+ MADV_DONTFORK = 10, -+ MADV_DOFORK = 11, -+ MADV_MERGEABLE = 12, -+ MADV_UNMERGEABLE = 13, -+ MADV_HUGEPAGE = 14, -+ MADV_NOHUGEPAGE = 15, -+ MADV_DONTDUMP = 16, -+ MADV_DODUMP = 17, -+ MADV_HWPOISON = 100, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // static if (__USE_XOPEN2K) enum -+ // { -+ // POSIX_MADV_NORMAL = 0, -+ // POSIX_MADV_RANDOM = 1, -+ // POSIX_MADV_SEQUENTIAL = 2, -+ // POSIX_MADV_WILLNEED = 3, -+ // POSIX_MADV_DONTNEED = 6, -+ // } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/arm/bits/mman.h -+else version (ARM) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h -+else version (HPPA) -+{ -+ enum -+ { -+ PROT_READ = 0x1, -+ PROT_WRITE = 0x2, -+ PROT_EXEC = 0x4, -+ PROT_NONE = 0x0, -+ PROT_GROWSDOWN = 0x01000000, -+ PROT_GROWSUP = 0x02000000, -+ } -+ -+ enum MAP_SHARED = 0x01; -+ enum MAP_PRIVATE = 0x02; -+ static if (__USE_MISC) -+ enum MAP_TYPE = 0x0f; -+ -+ enum MAP_FIXED = 0x04; -+ static if (__USE_MISC) enum -+ { -+ MAP_FILE = 0, -+ MAP_ANONYMOUS = 0x10, -+ MAP_ANON = MAP_ANONYMOUS, -+ MAP_VARIABLE = 0, -+ MAP_HUGE_SHIFT = 26, -+ MAP_HUGE_MASK = 0x3f, -+ } -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x2000, -+ MAP_NORESERVE = 0x4000, -+ MAP_GROWSDOWN = 0x8000, -+ MAP_POPULATE = 0x10000, -+ MAP_NONBLOCK = 0x20000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MS_ASYNC = 1, -+ // MS_SYNC = 2, -+ // MS_INVALIDATE = 4, -+ // } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 1, -+ // MCL_FUTURE = 2, -+ // } -+ -+ static if (__USE_GNU) enum -+ { -+ MREMAP_MAYMOVE = 1, -+ MREMAP_FIXED = 2, -+ } -+ -+ static if (__USE_BSD) enum -+ { -+ MADV_NORMAL = 0, -+ MADV_RANDOM = 1, -+ MADV_SEQUENTIAL = 2, -+ MADV_WILLNEED = 3, -+ MADV_DONTNEED = 4, -+ MADV_SPACEAVAIL = 5, -+ MADV_VPS_PURGE = 6, -+ MADV_VPS_INHERIT = 7, -+ MADV_REMOVE = 9, -+ MADV_DONTFORK = 10, -+ MADV_DOFORK = 11, -+ MADV_MERGEABLE = 65, -+ MADV_UNMERGEABLE = 66, -+ } -+ -+ enum -+ { -+ MADV_4K_PAGES = 12, -+ MADV_16K_PAGES = 14, -+ MADV_64K_PAGES = 16, -+ MADV_256K_PAGES = 18, -+ MADV_1M_PAGES = 20, -+ MADV_4M_PAGES = 22, -+ MADV_16M_PAGES = 24, -+ MADV_64M_PAGES = 26, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // static if (__USE_XOPEN2K) enum -+ // { -+ // POSIX_MADV_NORMAL = 0, -+ // POSIX_MADV_RANDOM = 1, -+ // POSIX_MADV_SEQUENTIAL = 2, -+ // POSIX_MADV_WILLNEED = 3, -+ // POSIX_MADV_DONTNEED = 4, -+ // } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/hppa/bits/mman.h -+else version (HPPA64) -+{ -+ enum -+ { -+ PROT_READ = 0x1, -+ PROT_WRITE = 0x2, -+ PROT_EXEC = 0x4, -+ PROT_NONE = 0x0, -+ PROT_GROWSDOWN = 0x01000000, -+ PROT_GROWSUP = 0x02000000, -+ } -+ -+ enum MAP_SHARED = 0x01; -+ enum MAP_PRIVATE = 0x02; -+ static if (__USE_MISC) -+ enum MAP_TYPE = 0x0f; -+ -+ enum MAP_FIXED = 0x04; -+ static if (__USE_MISC) enum -+ { -+ MAP_FILE = 0, -+ MAP_ANONYMOUS = 0x10, -+ MAP_ANON = MAP_ANONYMOUS, -+ MAP_VARIABLE = 0, -+ MAP_HUGE_SHIFT = 26, -+ MAP_HUGE_MASK = 0x3f, -+ } -+ -+ static if (__USE_MISC) enum -+ { -+ MAP_DENYWRITE = 0x0800, -+ MAP_EXECUTABLE = 0x1000, -+ MAP_LOCKED = 0x2000, -+ MAP_NORESERVE = 0x4000, -+ MAP_GROWSDOWN = 0x8000, -+ MAP_POPULATE = 0x10000, -+ MAP_NONBLOCK = 0x20000, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MS_ASYNC = 1, -+ // MS_SYNC = 2, -+ // MS_INVALIDATE = 4, -+ // } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MCL_CURRENT = 1, -+ // MCL_FUTURE = 2, -+ // } -+ -+ static if (__USE_GNU) enum -+ { -+ MREMAP_MAYMOVE = 1, -+ MREMAP_FIXED = 2, -+ } -+ -+ static if (__USE_BSD) enum -+ { -+ MADV_NORMAL = 0, -+ MADV_RANDOM = 1, -+ MADV_SEQUENTIAL = 2, -+ MADV_WILLNEED = 3, -+ MADV_DONTNEED = 4, -+ MADV_SPACEAVAIL = 5, -+ MADV_VPS_PURGE = 6, -+ MADV_VPS_INHERIT = 7, -+ MADV_REMOVE = 9, -+ MADV_DONTFORK = 10, -+ MADV_DOFORK = 11, -+ MADV_MERGEABLE = 65, -+ MADV_UNMERGEABLE = 66, -+ } -+ -+ enum -+ { -+ MADV_4K_PAGES = 12, -+ MADV_16K_PAGES = 14, -+ MADV_64K_PAGES = 16, -+ MADV_256K_PAGES = 18, -+ MADV_1M_PAGES = 20, -+ MADV_4M_PAGES = 22, -+ MADV_16M_PAGES = 24, -+ MADV_64M_PAGES = 26, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // static if (__USE_XOPEN2K) enum -+ // { -+ // POSIX_MADV_NORMAL = 0, -+ // POSIX_MADV_RANDOM = 1, -+ // POSIX_MADV_SEQUENTIAL = 2, -+ // POSIX_MADV_WILLNEED = 3, -+ // POSIX_MADV_DONTNEED = 4, -+ // } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/ia64/bits/mman.h -+else version (IA64) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_GROWSUP = 0x00200, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/m68k/bits/mman.h -+else version (M68K) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_GROWSDOWN = 0x00100, -+ MAP_DENYWRITE = 0x00800, -+ MAP_EXECUTABLE = 0x01000, -+ MAP_LOCKED = 0x02000, -+ MAP_NORESERVE = 0x04000, -+ MAP_POPULATE = 0x08000, -+ MAP_NONBLOCK = 0x10000, -+ MAP_STACK = 0x20000, -+ MAP_HUGETLB = 0x40000, -+ } -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/mips/bits/mman.h -+else version (MIPS32) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_NORESERVE = 0x0400, -+ MAP_GROWSDOWN = 0x1000, -+ MAP_DENYWRITE = 0x2000, -+ MAP_EXECUTABLE = 0x4000, -+ MAP_LOCKED = 0x8000, -+ MAP_POPULATE = 0x10000, -+ MAP_NONBLOCK = 0x20000, -+ MAP_STACK = 0x40000, -+ MAP_HUGETLB = 0x80000, -+ } -+ -+ private enum __MAP_ANONYMOUS = 0x0800; -+ -+ static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS; -+} -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/unix/sysv/linux/mips/bits/mman.h -+else version (MIPS64) -+{ -+ static if (__USE_MISC) enum -+ { -+ MAP_NORESERVE = 0x0400, -+ MAP_GROWSDOWN = 0x1000, -+ MAP_DENYWRITE = 0x2000, -+ MAP_EXECUTABLE = 0x4000, -+ MAP_LOCKED = 0x8000, -+ MAP_POPULATE = 0x10000, -+ MAP_NONBLOCK = 0x20000, -+ MAP_STACK = 0x40000, -+ MAP_HUGETLB = 0x80000, -+ } -+ -+ private enum __MAP_ANONYMOUS = 0x0800; -+ -+ static if (__USE_MISC) enum MAP_RENAME MAP_ANONYMOUS; -+} -+else -+{ -+ static assert(0, "unimplemented"); -+} -+ -+ -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/mman-linux.h -+version (Alpha) -+{ -+} -+else version (HPPA) -+{ -+} -+else version (HPPA64) -+{ -+} -+else -+{ -+ // in core.sys.posix.sys.mman -+ // enum PROT_READ = 0x1; -+ // enum PROT_WRITE = 0x2; -+ // enum PROT_EXEC = 0x4; -+ // enum PROT_NONE = 0x0; -+ -+ enum PROT_GROWSDOWN = 0x01000000; -+ enum PROT_GROWSUP = 0x02000000; -+ -+ enum MAP_SHARED = 0x01; -+ enum MAP_PRIVATE = 0x02; -+ static if (__USE_MISC) -+ enum MAP_TYPE = 0x0f; -+ -+ enum MAP_FIXED = 0x10; -+ static if (!is(typeof(__MAP_ANONYMOUS))) -+ private enum __MAP_ANONYMOUS = 0x20; -+ static if (__USE_MISC) enum -+ { -+ MAP_FILE = 0, -+ //MAP_ANONYMOUS = __MAP_ANONYMOUS, -+ //MAP_ANON = MAP_ANONYMOUS, -+ MAP_HUGE_SHIFT = 26, -+ MAP_HUGE_MASK = 0x3f, -+ } -+ -+ /* This should be behind the static if (__USE_MISC), but it runs into -+ * trouble with the alias declaration for MAP_ANON in core.sys.posix.sys.mman -+ * due to forward reference problems. See Bugzilla 11301 for a fuller explanation. -+ */ -+ enum -+ { -+ MAP_ANONYMOUS = __MAP_ANONYMOUS, -+ MAP_ANON = MAP_ANONYMOUS, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // MS_ASYNC = 1, -+ // MS_SYNC = 4, -+ // MS_INVALIDATE = 2, -+ // } -+ -+ static if (__USE_GNU) enum -+ { -+ MREMAP_MAYMOVE = 1, -+ MREMAP_FIXED = 2, -+ } -+ -+ static if (__USE_BSD) enum -+ { -+ MADV_NORMAL = 0, -+ MADV_RANDOM = 1, -+ MADV_SEQUENTIAL = 2, -+ MADV_WILLNEED = 3, -+ MADV_DONTNEED = 4, -+ MADV_REMOVE = 9, -+ MADV_DONTFORK = 10, -+ MADV_DOFORK = 11, -+ MADV_MERGEABLE = 12, -+ MADV_UNMERGEABLE = 13, -+ MADV_HWPOISON = 100, -+ } -+ -+ // in core.sys.posix.sys.mman -+ // static if (__USE_XOPEN2K) enum -+ // { -+ // POSIX_MADV_NORMAL = 0, -+ // POSIX_MADV_RANDOM = 1, -+ // POSIX_MADV_SEQUENTIAL = 2, -+ // POSIX_MADV_WILLNEED = 3, -+ // POSIX_MADV_DONTNEED = 4, -+ // } -+ -+ // in core.sys.posix.sys.mman -+ // enum -+ // { -+ // -+ // MCL_CURRENT = 1, -+ // MCL_FUTURE = 2, -+ // } -+} -+ -+// http://sourceware.org/git/?p=glibc.git;a=blob;f=misc/sys/mman.h -+// in core.sys.posix.sys.mman -+// static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t); -+// static if (__USE_FILE_OFFSET64) -+// alias mmap64 mmap; -+// else -+// void* mmap(void*, size_t, int, int, int, off_t); -+// int munmap(void*, size_t); -+// int mprotect(void *__addr, size_t __len, int __prot); -+// int msync(void *__addr, size_t __len, int __flags); -+static if (__USE_BSD) int madvise(void *__addr, size_t __len, int __advice); -+// static if (__USE_XOPEN2K) int posix_madvise(void *__addr, size_t __len, int __advice); -+// int mlock(const(void) *__addr, size_t __len); -+// int munlock(const(void) *__addr, size_t __len); -+// int mlockall(int __flags); -+// int munlockall(); -+static if (__USE_MISC) int mincore(void *__start, size_t __len, ubyte *__vec); -+static if (__USE_GNU) void *mremap(void *__addr, size_t __old_len, size_t __new_len, int __flags, ...); -+static if (__USE_GNU) int remap_file_pages(void *__start, size_t __size, int __prot, size_t __pgoff, int __flags); -+// int shm_open(in char *__name, int __oflag, mode_t __mode); -+// int shm_unlink(in char *__name); ---- a/src/libphobos/libdruntime/core/sys/posix/config.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/config.d 2014-04-01 16:32:51.000000000 +0100 -@@ -21,6 +21,7 @@ version (Posix): - extern (C): - - enum _XOPEN_SOURCE = 600; -+enum _POSIX_SOURCE = true; - enum _POSIX_C_SOURCE = 200112L; - - version (linux) -@@ -30,11 +31,14 @@ version (linux) - enum _GNU_SOURCE = false; - enum _BSD_SOURCE = false; - enum _SVID_SOURCE = false; -+ enum _ATFILE_SOURCE = false; - - enum _FILE_OFFSET_BITS = 64; - // <sys/cdefs.h> - enum __REDIRECT = false; - -+ enum _REENTRANT = true; // set by compiler when linking -pthread -+ - // deduced <features.h> - enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64; - enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; -@@ -45,8 +49,12 @@ version (linux) - enum __USE_XOPEN2K8 = _XOPEN_SOURCE >= 700; - enum __USE_XOPEN2K8XSI = _XOPEN_SOURCE >= 700; - -- enum __USE_GNU = _GNU_SOURCE; - enum __USE_MISC = _BSD_SOURCE || _SVID_SOURCE; -+ enum __USE_BSD = _BSD_SOURCE; -+ enum __USE_SVID = _SVID_SOURCE; -+ enum __USE_ATFILE = _ATFILE_SOURCE; -+ enum __USE_GNU = _GNU_SOURCE; -+ enum __USE_REENTRANT = _REENTRANT; - - version(D_LP64) - enum __WORDSIZE=64; ---- a/src/libphobos/libdruntime/core/sys/posix/dlfcn.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/dlfcn.d 2014-04-01 16:32:51.000000000 +0100 -@@ -36,24 +36,75 @@ void* dlsym(void*, in char*); - - version( linux ) - { -- enum RTLD_LAZY = 0x00001; -- enum RTLD_NOW = 0x00002; -- enum RTLD_GLOBAL = 0x00100; -- enum RTLD_LOCAL = 0x00000; -+ version (X86) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0x00000; -+ } -+ else version (X86_64) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0x00000; -+ } -+ else version (MIPS32) -+ { -+ enum RTLD_LAZY = 0x0001; -+ enum RTLD_NOW = 0x0002; -+ enum RTLD_GLOBAL = 0x0004; -+ enum RTLD_LOCAL = 0; -+ } -+ else version (PPC) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0; -+ } -+ else version (PPC64) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0; -+ } -+ else version (ARM) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0; -+ } -+ else version (AArch64) -+ { -+ enum RTLD_LAZY = 0x00001; -+ enum RTLD_NOW = 0x00002; -+ enum RTLD_GLOBAL = 0x00100; -+ enum RTLD_LOCAL = 0; -+ } -+ else -+ static assert(0, "unimplemented"); - - int dlclose(void*); - char* dlerror(); - void* dlopen(in char*, int); - void* dlsym(void*, in char*); -- int dladdr(void* addr, Dl_info* info); -- void* dlvsym(void* handle, in char* symbol, in char* version_); - -- struct Dl_info -+ deprecated("Please use core.sys.linux.dlfcn for non-POSIX extensions") - { -- const(char)* dli_fname; -- void* dli_fbase; -- const(char)* dli_sname; -- void* dli_saddr; -+ int dladdr(void* addr, Dl_info* info); -+ void* dlvsym(void* handle, in char* symbol, in char* version_); -+ -+ struct Dl_info -+ { -+ const(char)* dli_fname; -+ void* dli_fbase; -+ const(char)* dli_sname; -+ void* dli_saddr; -+ } - } - } - else version( OSX ) ---- a/src/libphobos/libdruntime/core/sys/posix/fcntl.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/fcntl.d 2014-04-01 16:32:51.000000000 +0100 -@@ -101,7 +101,33 @@ version( linux ) - enum F_UNLCK = 2; - enum F_WRLCK = 1; - -- version (MIPS) -+ version (X86) -+ { -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 -+ enum O_RSYNC = O_SYNC; -+ } -+ else version (X86_64) -+ { -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 -+ enum O_RSYNC = O_SYNC; -+ } -+ else version (MIPS32) - { - enum O_CREAT = 0x0100; - enum O_EXCL = 0x0400; -@@ -114,19 +140,60 @@ version( linux ) - enum O_RSYNC = O_SYNC; - enum O_SYNC = 0x0010; - } -- else -+ else version (PPC) - { -- enum O_CREAT = 0x40; // octal 0100 -- enum O_EXCL = 0x80; // octal 0200 -- enum O_NOCTTY = 0x100; // octal 0400 -- enum O_TRUNC = 0x200; // octal 01000 -- -- enum O_APPEND = 0x400; // octal 02000 -- enum O_NONBLOCK = 0x800; // octal 04000 -- enum O_SYNC = 0x1000; // octal 010000 -- enum O_DSYNC = O_SYNC; -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 -+ enum O_RSYNC = O_SYNC; -+ } -+ else version (PPC64) -+ { -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 -+ enum O_RSYNC = O_SYNC; -+ } -+ else version (ARM) -+ { -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 -+ enum O_RSYNC = O_SYNC; -+ } -+ else version (AArch64) -+ { -+ enum O_CREAT = 0x40; // octal 0100 -+ enum O_EXCL = 0x80; // octal 0200 -+ enum O_NOCTTY = 0x100; // octal 0400 -+ enum O_TRUNC = 0x200; // octal 01000 -+ -+ enum O_APPEND = 0x400; // octal 02000 -+ enum O_NONBLOCK = 0x800; // octal 04000 -+ enum O_SYNC = 0x101000; // octal 04010000 -+ enum O_DSYNC = 0x1000; // octal 010000 - enum O_RSYNC = O_SYNC; - } -+ else -+ static assert(0, "unimplemented"); - - enum O_ACCMODE = 0x3; - enum O_RDONLY = 0x0; ---- a/src/libphobos/libdruntime/core/sys/posix/grp.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/grp.d 2014-04-01 16:32:51.000000000 +0100 -@@ -73,7 +73,7 @@ else - } - - group* getgrnam(in char*); --group* getgruid(uid_t); -+group* getgrgid(gid_t); - - // - // Thread-Safe Functions (TSF) ---- a/src/libphobos/libdruntime/core/sys/posix/pthread.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/pthread.d 2014-04-01 16:32:51.000000000 +0100 -@@ -123,9 +123,8 @@ version( linux ) - PTHREAD_EXPLICIT_SCHED - } - -- //enum pthread_mutex_t PTHREAD_MUTEX_INITIALIZER = { 0, 0, null, PTHREAD_MUTEX_NORMAL, { 0, 0 } }; -- -- enum PTHREAD_ONCE_INIT = pthread_once_t.init; -+ enum PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t.init; -+ enum PTHREAD_ONCE_INIT = pthread_once_t.init; - - enum - { -@@ -163,9 +162,8 @@ else version( OSX ) - PTHREAD_EXPLICIT_SCHED = 2 - } - -- //enum pthread_mutex_t PTHREAD_MUTEX_INITIALIZER = { 0, 0, null, PTHREAD_MUTEX_NORMAL, { 0, 0 } }; -- -- enum PTHREAD_ONCE_INIT = pthread_once_t.init; -+ enum PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t.init; -+ enum PTHREAD_ONCE_INIT = pthread_once_t.init; - - enum - { -@@ -205,9 +203,8 @@ else version( FreeBSD ) - enum PTHREAD_NEEDS_INIT = 0; - enum PTHREAD_DONE_INIT = 1; - -- //enum pthread_once_t PTHREAD_ONCE_INIT = { PTHREAD_NEEDS_INIT, null }; -- - enum PTHREAD_MUTEX_INITIALIZER = null; -+ enum PTHREAD_ONCE_INIT = null; - enum PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP = null; - enum PTHREAD_COND_INITIALIZER = null; - enum PTHREAD_RWLOCK_INITIALIZER = null; -@@ -238,6 +235,9 @@ else version (Solaris) - } - - enum PTHREAD_CANCELED = cast(void*)-19; -+ -+ enum PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t.init; -+ enum PTHREAD_ONCE_INIT = pthread_once_t.init; - } - else - { -@@ -652,32 +652,32 @@ else - // Timeouts (TMO) - // - /* --int pthread_mutex_timedlock(pthread_mutex_t*, timespec*); -+int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*); - int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*); - int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*); - */ - - version( linux ) - { -- int pthread_mutex_timedlock(pthread_mutex_t*, timespec*); -+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*); - int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*); - int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*); - } - else version( OSX ) - { -- int pthread_mutex_timedlock(pthread_mutex_t*, timespec*); -+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*); - int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*); - int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*); - } - else version( FreeBSD ) - { -- int pthread_mutex_timedlock(pthread_mutex_t*, timespec*); -+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*); - int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*); - int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*); - } - else version (Solaris) - { -- int pthread_mutex_timedlock(pthread_mutex_t*, timespec*); -+ int pthread_mutex_timedlock(pthread_mutex_t*, in timespec*); - int pthread_rwlock_timedrdlock(pthread_rwlock_t*, in timespec*); - int pthread_rwlock_timedwrlock(pthread_rwlock_t*, in timespec*); - } -@@ -770,7 +770,7 @@ else version( OSX ) - int pthread_attr_setscope(pthread_attr_t*, int); - int pthread_getschedparam(pthread_t, int*, sched_param*); - int pthread_setschedparam(pthread_t, int, in sched_param*); -- int pthread_setschedprio(pthread_t, int); -+ // int pthread_setschedprio(pthread_t, int); // not implemented - } - else version( FreeBSD ) - { -@@ -788,7 +788,7 @@ else version( FreeBSD ) - int pthread_attr_setscope(in pthread_attr_t*, int); - int pthread_getschedparam(pthread_t, int*, sched_param*); - int pthread_setschedparam(pthread_t, int, sched_param*); -- int pthread_setschedprio(pthread_t, int); -+ // int pthread_setschedprio(pthread_t, int); // not implemented - } - else version (Solaris) - { ---- a/src/libphobos/libdruntime/core/sys/posix/signal.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/signal.d 2014-04-01 16:32:51.000000000 +0100 -@@ -113,7 +113,55 @@ version( Posix ) - - version( linux ) - { -- version (MIPS) -+ version (X86) -+ { -+ //SIGABRT (defined in core.stdc.signal) -+ enum SIGALRM = 14; -+ enum SIGBUS = 7; -+ enum SIGCHLD = 17; -+ enum SIGCONT = 18; -+ //SIGFPE (defined in core.stdc.signal) -+ enum SIGHUP = 1; -+ //SIGILL (defined in core.stdc.signal) -+ //SIGINT (defined in core.stdc.signal) -+ enum SIGKILL = 9; -+ enum SIGPIPE = 13; -+ enum SIGQUIT = 3; -+ //SIGSEGV (defined in core.stdc.signal) -+ enum SIGSTOP = 19; -+ //SIGTERM (defined in core.stdc.signal) -+ enum SIGTSTP = 20; -+ enum SIGTTIN = 21; -+ enum SIGTTOU = 22; -+ enum SIGUSR1 = 10; -+ enum SIGUSR2 = 12; -+ enum SIGURG = 23; -+ } -+ else version (X86_64) -+ { -+ //SIGABRT (defined in core.stdc.signal) -+ enum SIGALRM = 14; -+ enum SIGBUS = 7; -+ enum SIGCHLD = 17; -+ enum SIGCONT = 18; -+ //SIGFPE (defined in core.stdc.signal) -+ enum SIGHUP = 1; -+ //SIGILL (defined in core.stdc.signal) -+ //SIGINT (defined in core.stdc.signal) -+ enum SIGKILL = 9; -+ enum SIGPIPE = 13; -+ enum SIGQUIT = 3; -+ //SIGSEGV (defined in core.stdc.signal) -+ enum SIGSTOP = 19; -+ //SIGTERM (defined in core.stdc.signal) -+ enum SIGTSTP = 20; -+ enum SIGTTIN = 21; -+ enum SIGTTOU = 22; -+ enum SIGUSR1 = 10; -+ enum SIGUSR2 = 12; -+ enum SIGURG = 23; -+ } -+ else version (MIPS32) - { - //SIGABRT (defined in core.stdc.signal) - enum SIGALRM = 14; -@@ -137,7 +185,7 @@ version( linux ) - enum SIGUSR2 = 17; - enum SIGURG = 21; - } -- else -+ else version (PPC) - { - //SIGABRT (defined in core.stdc.signal) - enum SIGALRM = 14; -@@ -161,6 +209,80 @@ version( linux ) - enum SIGUSR2 = 12; - enum SIGURG = 23; - } -+ else version (PPC64) -+ { -+ //SIGABRT (defined in core.stdc.signal) -+ enum SIGALRM = 14; -+ enum SIGBUS = 7; -+ enum SIGCHLD = 17; -+ enum SIGCONT = 18; -+ //SIGFPE (defined in core.stdc.signal) -+ enum SIGHUP = 1; -+ //SIGILL (defined in core.stdc.signal) -+ //SIGINT (defined in core.stdc.signal) -+ enum SIGKILL = 9; -+ enum SIGPIPE = 13; -+ enum SIGQUIT = 3; -+ //SIGSEGV (defined in core.stdc.signal) -+ enum SIGSTOP = 19; -+ //SIGTERM (defined in core.stdc.signal) -+ enum SIGTSTP = 20; -+ enum SIGTTIN = 21; -+ enum SIGTTOU = 22; -+ enum SIGUSR1 = 10; -+ enum SIGUSR2 = 12; -+ enum SIGURG = 23; -+ } -+ else version (ARM) -+ { -+ //SIGABRT (defined in core.stdc.signal) -+ enum SIGALRM = 14; -+ enum SIGBUS = 7; -+ enum SIGCHLD = 17; -+ enum SIGCONT = 18; -+ //SIGFPE (defined in core.stdc.signal) -+ enum SIGHUP = 1; -+ //SIGILL (defined in core.stdc.signal) -+ //SIGINT (defined in core.stdc.signal) -+ enum SIGKILL = 9; -+ enum SIGPIPE = 13; -+ enum SIGQUIT = 3; -+ //SIGSEGV (defined in core.stdc.signal) -+ enum SIGSTOP = 19; -+ //SIGTERM (defined in core.stdc.signal) -+ enum SIGTSTP = 20; -+ enum SIGTTIN = 21; -+ enum SIGTTOU = 22; -+ enum SIGUSR1 = 10; -+ enum SIGUSR2 = 12; -+ enum SIGURG = 23; -+ } -+ else version (AArch64) -+ { -+ //SIGABRT (defined in core.stdc.signal) -+ enum SIGALRM = 14; -+ enum SIGBUS = 7; -+ enum SIGCHLD = 17; -+ enum SIGCONT = 18; -+ //SIGFPE (defined in core.stdc.signal) -+ enum SIGHUP = 1; -+ //SIGILL (defined in core.stdc.signal) -+ //SIGINT (defined in core.stdc.signal) -+ enum SIGKILL = 9; -+ enum SIGPIPE = 13; -+ enum SIGQUIT = 3; -+ //SIGSEGV (defined in core.stdc.signal) -+ enum SIGSTOP = 19; -+ //SIGTERM (defined in core.stdc.signal) -+ enum SIGTSTP = 20; -+ enum SIGTTIN = 21; -+ enum SIGTTOU = 22; -+ enum SIGUSR1 = 10; -+ enum SIGUSR2 = 12; -+ enum SIGURG = 23; -+ } -+ else -+ static assert(0, "unimplemented"); - } - else version( OSX ) - { -@@ -804,17 +926,17 @@ int sigrelse(int); - - version( linux ) - { -- version (MIPS) -+ version (X86) - { -- enum SIGPOLL = 22; -- enum SIGPROF = 29; -- enum SIGSYS = 12; -- enum SIGTRAP = 5; -- enum SIGVTALRM = 28; -- enum SIGXCPU = 30; -- enum SIGXFSZ = 31; -+ enum SIGPOLL = 29; -+ enum SIGPROF = 27; -+ enum SIGSYS = 31; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 26; -+ enum SIGXCPU = 24; -+ enum SIGXFSZ = 25; - } -- else -+ else version (X86_64) - { - enum SIGPOLL = 29; - enum SIGPROF = 27; -@@ -824,6 +946,59 @@ version( linux ) - enum SIGXCPU = 24; - enum SIGXFSZ = 25; - } -+ else version (MIPS32) -+ { -+ enum SIGPOLL = 22; -+ enum SIGPROF = 29; -+ enum SIGSYS = 12; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 28; -+ enum SIGXCPU = 30; -+ enum SIGXFSZ = 31; -+ } -+ else version (PPC) -+ { -+ enum SIGPOLL = 29; -+ enum SIGPROF = 27; -+ enum SIGSYS = 31; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 26; -+ enum SIGXCPU = 24; -+ enum SIGXFSZ = 25; -+ } -+ else version (PPC64) -+ { -+ enum SIGPOLL = 29; -+ enum SIGPROF = 27; -+ enum SIGSYS = 31; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 26; -+ enum SIGXCPU = 24; -+ enum SIGXFSZ = 25; -+ } -+ else version (ARM) -+ { -+ enum SIGPOLL = 29; -+ enum SIGPROF = 27; -+ enum SIGSYS = 31; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 26; -+ enum SIGXCPU = 24; -+ enum SIGXFSZ = 25; -+ } -+ else version (AArch64) -+ { -+ enum SIGPOLL = 29; -+ enum SIGPROF = 27; -+ enum SIGSYS = 31; -+ enum SIGTRAP = 5; -+ enum SIGVTALRM = 26; -+ enum SIGXCPU = 24; -+ enum SIGXFSZ = 25; -+ } -+ else -+ static assert(0, "unimplemented"); -+ - enum SA_ONSTACK = 0x08000000; - enum SA_RESETHAND = 0x80000000; - enum SA_RESTART = 0x10000000; ---- a/src/libphobos/libdruntime/core/sys/posix/sys/mman.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/mman.d 2014-04-01 16:32:51.000000000 +0100 -@@ -20,6 +20,7 @@ public import core.sys.posix.sys.types; - - version (Posix): - extern (C): -+nothrow: - - // - // Advisory Information (ADV) -@@ -41,11 +42,23 @@ POSIX_MADV_DONTNEED - - version( linux ) - { -- enum POSIX_MADV_NORMAL = 0; -- enum POSIX_MADV_RANDOM = 1; -- enum POSIX_MADV_SEQUENTIAL = 2; -- enum POSIX_MADV_WILLNEED = 3; -- enum POSIX_MADV_DONTNEED = 4; -+ version (Alpha) -+ private enum __POSIX_MADV_DONTNEED = 6; -+ else -+ private enum __POSIX_MADV_DONTNEED = 4; -+ -+ static if (__USE_XOPEN2K) -+ { -+ enum -+ { -+ POSIX_MADV_NORMAL = 0, -+ POSIX_MADV_RANDOM = 1, -+ POSIX_MADV_SEQUENTIAL = 2, -+ POSIX_MADV_WILLNEED = 3, -+ POSIX_MADV_DONTNEED = __POSIX_MADV_DONTNEED, -+ } -+ int posix_madvise(void *__addr, size_t __len, int __advice); -+ } - } - else version( OSX ) - { -@@ -54,6 +67,7 @@ else version( OSX ) - enum POSIX_MADV_SEQUENTIAL = 2; - enum POSIX_MADV_WILLNEED = 3; - enum POSIX_MADV_DONTNEED = 4; -+ int posix_madvise(void *addr, size_t len, int advice); - } - else version( FreeBSD ) - { -@@ -62,14 +76,10 @@ else version( FreeBSD ) - enum POSIX_MADV_SEQUENTIAL = 2; - enum POSIX_MADV_WILLNEED = 3; - enum POSIX_MADV_DONTNEED = 4; -+ int posix_madvise(void *addr, size_t len, int advice); - } - else version (Solaris) - { -- enum POSIX_MADV_NORMAL = 0; -- enum POSIX_MADV_RANDOM = 1; -- enum POSIX_MADV_SEQUENTIAL = 2; -- enum POSIX_MADV_WILLNEED = 3; -- enum POSIX_MADV_DONTNEED = 4; - } - else - { -@@ -129,18 +139,12 @@ int munmap(void*, size_t); - - version( linux ) - { -- //void* mmap(void*, size_t, int, int, int, off_t); -- int munmap(void*, size_t); -- -- static if( __USE_FILE_OFFSET64 ) -- { -- void* mmap64(void*, size_t, int, int, int, off_t); -- alias mmap64 mmap; -- } -- else -- { -- void* mmap(void*, size_t, int, int, int, off_t); -- } -+ static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t); -+ static if (__USE_FILE_OFFSET64) -+ alias mmap = mmap64; -+ else -+ void* mmap(void*, size_t, int, int, int, off_t); -+ int munmap(void*, size_t); - } - else version( OSX ) - { -@@ -184,18 +188,35 @@ version( linux ) - enum MAP_PRIVATE = 0x02; - enum MAP_FIXED = 0x10; - -- version (MIPS) -- enum MAP_ANON = 0x0800; // non-standard -- else -- enum MAP_ANON = 0x20; // non-standard -+ static import core.sys.linux.sys.mman; -+ deprecated("Please use core.sys.linux.sys.mman for non-POSIX extensions") -+ alias MAP_ANON = core.sys.linux.sys.mman.MAP_ANON; - - enum MAP_FAILED = cast(void*) -1; - -- enum -+ version (Alpha) enum -+ { -+ MS_ASYNC = 1, -+ MS_SYNC = 2, -+ MS_INVALIDATE = 4, -+ } -+ else version (HPPA) enum - { -- MS_ASYNC = 1, -- MS_SYNC = 4, -- MS_INVALIDATE = 2 -+ MS_ASYNC = 1, -+ MS_SYNC = 2, -+ MS_INVALIDATE = 4, -+ } -+ else version (HPPA64) enum -+ { -+ MS_ASYNC = 1, -+ MS_SYNC = 2, -+ MS_INVALIDATE = 4, -+ } -+ else enum -+ { -+ MS_ASYNC = 1, -+ MS_SYNC = 4, -+ MS_INVALIDATE = 2 - } - - int msync(void*, size_t, int); -@@ -263,8 +284,36 @@ int munlockall(); - - version( linux ) - { -- enum MCL_CURRENT = 1; -- enum MCL_FUTURE = 2; -+ version (SPARC) enum -+ { -+ MCL_CURRENT = 0x2000, -+ MCL_FUTURE = 0x4000, -+ } -+ else version (SPARC64) enum -+ { -+ MCL_CURRENT = 0x2000, -+ MCL_FUTURE = 0x4000, -+ } -+ else version (PPC) enum -+ { -+ MCL_CURRENT = 0x2000, -+ MCL_FUTURE = 0x4000, -+ } -+ else version (PPC64) enum -+ { -+ MCL_CURRENT = 0x2000, -+ MCL_FUTURE = 0x4000, -+ } -+ else version (Alpha) enum -+ { -+ MCL_CURRENT = 8192, -+ MCL_FUTURE = 16384, -+ } -+ else enum -+ { -+ MCL_CURRENT = 1, -+ MCL_FUTURE = 2, -+ } - - int mlockall(int); - int munlockall(); ---- a/src/libphobos/libdruntime/core/sys/posix/sys/resource.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/resource.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,312 @@ -+/** -+ * D header file for POSIX. -+ * -+ * Copyright: Copyright (c) 2013 Lars Tandle Kyllingstad. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Lars Tandle Kyllingstad -+ * Standards: The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008 -+ */ -+module core.sys.posix.sys.resource; -+version (Posix): -+ -+public import core.sys.posix.sys.time; -+public import core.sys.posix.sys.types: id_t; -+import core.sys.posix.config; -+ -+nothrow extern(C): -+ -+// -+// XOpen (XSI) -+// -+// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html -+/* -+enum -+{ -+ PRIO_PROCESS, -+ PRIO_PGRP, -+ PRIO_USER, -+} -+ -+alias ulong rlim_t; -+ -+enum -+{ -+ RLIM_INFINITY, -+ RLIM_SAVED_MAX, -+ RLIM_SAVED_CUR, -+} -+ -+enum -+{ -+ RUSAGE_SELF, -+ RUSAGE_CHILDREN, -+} -+ -+struct rlimit -+{ -+ rlim_t rlim_cur; -+ rlim_t rlim_max; -+} -+ -+struct rusage -+{ -+ timeval ru_utime; -+ timeval ru_stime; -+} -+ -+enum -+{ -+ RLIMIT_CORE, -+ RLIMIT_CPU, -+ RLIMIT_DATA, -+ RLIMIT_FSIZE, -+ RLIMIT_NOFILE, -+ RLIMIT_STACK, -+ RLIMIT_AS, -+} -+ -+int getpriority(int, id_t); -+int getrlimit(int, rlimit*); -+int getrusage(int, rusage*); -+int setpriority(int, id_t, int); -+int setrlimit(int, const rlimit*); -+*/ -+ -+ -+version (linux) -+{ -+ -+ enum -+ { -+ PRIO_PROCESS = 0, -+ PRIO_PGRP = 1, -+ PRIO_USER = 2, -+ } -+ -+ static if (__USE_FILE_OFFSET64) -+ alias ulong rlim_t; -+ else -+ alias c_ulong rlim_t; -+ -+ static if (__USE_FILE_OFFSET64) -+ enum RLIM_INFINITY = 0xffffffffffffffffUL; -+ else -+ enum RLIM_INFINITY = cast(c_ulong)(~0UL); -+ -+ enum RLIM_SAVED_MAX = RLIM_INFINITY; -+ enum RLIM_SAVED_CUR = RLIM_INFINITY; -+ -+ enum -+ { -+ RUSAGE_SELF = 0, -+ RUSAGE_CHILDREN = -1, -+ } -+ -+ struct rusage -+ { -+ timeval ru_utime; -+ timeval ru_stime; -+ c_long ru_maxrss; -+ c_long ru_ixrss; -+ c_long ru_idrss; -+ c_long ru_isrss; -+ c_long ru_minflt; -+ c_long ru_majflt; -+ c_long ru_nswap; -+ c_long ru_inblock; -+ c_long ru_oublock; -+ c_long ru_msgsnd; -+ c_long ru_msgrcv; -+ c_long ru_nsignals; -+ c_long ru_nvcsw; -+ c_long ru_nivcsw; -+ } -+ -+ enum -+ { -+ RLIMIT_CORE = 4, -+ RLIMIT_CPU = 0, -+ RLIMIT_DATA = 2, -+ RLIMIT_FSIZE = 1, -+ RLIMIT_NOFILE = 7, -+ RLIMIT_STACK = 3, -+ RLIMIT_AS = 9, -+ } -+} -+else version (OSX) -+{ -+ enum -+ { -+ PRIO_PROCESS = 0, -+ PRIO_PGRP = 1, -+ PRIO_USER = 2, -+ } -+ -+ alias ulong rlim_t; -+ -+ enum -+ { -+ RLIM_INFINITY = ((cast(ulong) 1 << 63) - 1), -+ RLIM_SAVED_MAX = RLIM_INFINITY, -+ RLIM_SAVED_CUR = RLIM_INFINITY, -+ } -+ -+ enum -+ { -+ RUSAGE_SELF = 0, -+ RUSAGE_CHILDREN = -1, -+ } -+ -+ struct rusage -+ { -+ timeval ru_utime; -+ timeval ru_stime; -+ c_long[14] ru_opaque; -+ } -+ -+ enum -+ { -+ RLIMIT_CORE = 4, -+ RLIMIT_CPU = 0, -+ RLIMIT_DATA = 2, -+ RLIMIT_FSIZE = 1, -+ RLIMIT_NOFILE = 8, -+ RLIMIT_STACK = 3, -+ RLIMIT_AS = 5, -+ } -+} -+else version (FreeBSD) -+{ -+ enum -+ { -+ PRIO_PROCESS = 0, -+ PRIO_PGRP = 1, -+ PRIO_USER = 2, -+ } -+ -+ alias long rlim_t; -+ -+ enum -+ { -+ RLIM_INFINITY = (cast(rlim_t)((cast(ulong) 1 << 63) - 1)), -+ // FreeBSD explicitly does not define the following: -+ //RLIM_SAVED_MAX, -+ //RLIM_SAVED_CUR, -+ } -+ -+ enum -+ { -+ RUSAGE_SELF = 0, -+ RUSAGE_CHILDREN = -1, -+ } -+ -+ struct rusage -+ { -+ timeval ru_utime; -+ timeval ru_stime; -+ c_long ru_maxrss; -+ alias ru_ixrss ru_first; -+ c_long ru_ixrss; -+ c_long ru_idrss; -+ c_long ru_isrss; -+ c_long ru_minflt; -+ c_long ru_majflt; -+ c_long ru_nswap; -+ c_long ru_inblock; -+ c_long ru_oublock; -+ c_long ru_msgsnd; -+ c_long ru_msgrcv; -+ c_long ru_nsignals; -+ c_long ru_nvcsw; -+ c_long ru_nivcsw; -+ alias ru_nivcsw ru_last; -+ } -+ -+ enum -+ { -+ RLIMIT_CORE = 4, -+ RLIMIT_CPU = 0, -+ RLIMIT_DATA = 2, -+ RLIMIT_FSIZE = 1, -+ RLIMIT_NOFILE = 8, -+ RLIMIT_STACK = 3, -+ RLIMIT_AS = 10, -+ } -+} -+else version (Solaris) -+{ -+ enum -+ { -+ PRIO_PROCESS = 0, -+ PRIO_PGRP = 1, -+ PRIO_USER = 2, -+ } -+ -+ alias c_ulong rlim_t; -+ -+ enum : c_long -+ { -+ RLIM_INFINITY = -3, -+ RLIM_SAVED_MAX = -2, -+ RLIM_SAVED_CUR = -1, -+ } -+ -+ enum -+ { -+ RUSAGE_SELF = 0, -+ RUSAGE_CHILDREN = -1, -+ } -+ -+ struct rusage -+ { -+ timeval ru_utime; -+ timeval ru_stime; -+ c_long ru_maxrss; -+ c_long ru_ixrss; -+ c_long ru_idrss; -+ c_long ru_isrss; -+ c_long ru_minflt; -+ c_long ru_majflt; -+ c_long ru_nswap; -+ c_long ru_inblock; -+ c_long ru_oublock; -+ c_long ru_msgsnd; -+ c_long ru_msgrcv; -+ c_long ru_nsignals; -+ c_long ru_nvcsw; -+ c_long ru_nivcsw; -+ } -+ -+ enum -+ { -+ RLIMIT_CORE = 4, -+ RLIMIT_CPU = 0, -+ RLIMIT_DATA = 2, -+ RLIMIT_FSIZE = 1, -+ RLIMIT_NOFILE = 5, -+ RLIMIT_STACK = 3, -+ RLIMIT_AS = 6, -+ } -+} -+else static assert (false, "Unsupported platform"); -+ -+struct rlimit -+{ -+ rlim_t rlim_cur; -+ rlim_t rlim_max; -+} -+ -+version (FreeBSD) -+{ -+ int getpriority(int, int); -+ int setpriority(int, int, int); -+} -+else -+{ -+ int getpriority(int, id_t); -+ int setpriority(int, id_t, int); -+} -+ -+int getrlimit(int, rlimit*); -+int getrusage(int, rusage*); -+int setrlimit(int, const rlimit*); ---- a/src/libphobos/libdruntime/core/sys/posix/sys/socket.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/socket.d 2014-04-01 16:32:51.000000000 +0100 -@@ -208,7 +208,75 @@ version( linux ) - int l_linger; - } - -- version (MIPS) -+ version (X86) -+ { -+ enum -+ { -+ SOCK_DGRAM = 2, -+ SOCK_SEQPACKET = 5, -+ SOCK_STREAM = 1 -+ } -+ -+ enum -+ { -+ SOL_SOCKET = 1 -+ } -+ -+ enum -+ { -+ SO_ACCEPTCONN = 30, -+ SO_BROADCAST = 6, -+ SO_DEBUG = 1, -+ SO_DONTROUTE = 5, -+ SO_ERROR = 4, -+ SO_KEEPALIVE = 9, -+ SO_LINGER = 13, -+ SO_OOBINLINE = 10, -+ SO_RCVBUF = 8, -+ SO_RCVLOWAT = 18, -+ SO_RCVTIMEO = 20, -+ SO_REUSEADDR = 2, -+ SO_SNDBUF = 7, -+ SO_SNDLOWAT = 19, -+ SO_SNDTIMEO = 21, -+ SO_TYPE = 3 -+ } -+ } -+ else version (X86_64) -+ { -+ enum -+ { -+ SOCK_DGRAM = 2, -+ SOCK_SEQPACKET = 5, -+ SOCK_STREAM = 1 -+ } -+ -+ enum -+ { -+ SOL_SOCKET = 1 -+ } -+ -+ enum -+ { -+ SO_ACCEPTCONN = 30, -+ SO_BROADCAST = 6, -+ SO_DEBUG = 1, -+ SO_DONTROUTE = 5, -+ SO_ERROR = 4, -+ SO_KEEPALIVE = 9, -+ SO_LINGER = 13, -+ SO_OOBINLINE = 10, -+ SO_RCVBUF = 8, -+ SO_RCVLOWAT = 18, -+ SO_RCVTIMEO = 20, -+ SO_REUSEADDR = 2, -+ SO_SNDBUF = 7, -+ SO_SNDLOWAT = 19, -+ SO_SNDTIMEO = 21, -+ SO_TYPE = 3 -+ } -+ } -+ else version (MIPS32) - { - enum - { -@@ -242,7 +310,75 @@ version( linux ) - SO_TYPE = 0x1008, - } - } -- else -+ else version (PPC) -+ { -+ enum -+ { -+ SOCK_DGRAM = 2, -+ SOCK_SEQPACKET = 5, -+ SOCK_STREAM = 1 -+ } -+ -+ enum -+ { -+ SOL_SOCKET = 1 -+ } -+ -+ enum -+ { -+ SO_ACCEPTCONN = 30, -+ SO_BROADCAST = 6, -+ SO_DEBUG = 1, -+ SO_DONTROUTE = 5, -+ SO_ERROR = 4, -+ SO_KEEPALIVE = 9, -+ SO_LINGER = 13, -+ SO_OOBINLINE = 10, -+ SO_RCVBUF = 8, -+ SO_RCVLOWAT = 16, -+ SO_RCVTIMEO = 18, -+ SO_REUSEADDR = 2, -+ SO_SNDBUF = 7, -+ SO_SNDLOWAT = 17, -+ SO_SNDTIMEO = 19, -+ SO_TYPE = 3 -+ } -+ } -+ else version (PPC64) -+ { -+ enum -+ { -+ SOCK_DGRAM = 2, -+ SOCK_SEQPACKET = 5, -+ SOCK_STREAM = 1 -+ } -+ -+ enum -+ { -+ SOL_SOCKET = 1 -+ } -+ -+ enum -+ { -+ SO_ACCEPTCONN = 30, -+ SO_BROADCAST = 6, -+ SO_DEBUG = 1, -+ SO_DONTROUTE = 5, -+ SO_ERROR = 4, -+ SO_KEEPALIVE = 9, -+ SO_LINGER = 13, -+ SO_OOBINLINE = 10, -+ SO_RCVBUF = 8, -+ SO_RCVLOWAT = 16, -+ SO_RCVTIMEO = 18, -+ SO_REUSEADDR = 2, -+ SO_SNDBUF = 7, -+ SO_SNDLOWAT = 17, -+ SO_SNDTIMEO = 19, -+ SO_TYPE = 3 -+ } -+ } -+ else version (ARM) - { - enum - { -@@ -276,6 +412,8 @@ version( linux ) - SO_TYPE = 3 - } - } -+ else -+ static assert(0, "unimplemented"); - - enum - { ---- a/src/libphobos/libdruntime/core/sys/posix/sys/stat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/stat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -81,161 +81,124 @@ mode_t umask(mode_t); - - version( linux ) - { -- version (X86) version = AnyX86; -- version (X86_64) version = AnyX86; -- -- version (MIPS) -+ version (X86) - { -- version (MIPS_O32) -+ struct stat_t - { -- struct stat_t -+ dev_t st_dev; -+ ushort __pad1; -+ static if (!__USE_FILE_OFFSET64) - { -- c_ulong st_dev; -- c_long[3] st_pad1; - ino_t st_ino; -- mode_t st_mode; -- nlink_t st_nlink; -- uid_t st_uid; -- gid_t st_gid; -- c_ulong st_rdev; -- static if (!__USE_FILE_OFFSET64) -- { -- c_long[2] st_pad2; -- off_t st_size; -- c_long st_pad3; -- } -- else -- { -- c_long[3] st_pad2; -- off_t st_size; -- } -- static if (__USE_MISC || __USE_XOPEN2K8) -- { -- timespec st_atim; -- timespec st_mtim; -- timespec st_ctim; -- extern(D) -- { -- @property ref time_t st_atime() { return st_atim.tv_sec; } -- @property ref time_t st_mtime() { return st_mtim.tv_sec; } -- @property ref time_t st_ctime() { return st_ctim.tv_sec; } -- } -- } -- else -- { -- time_t st_atime; -- c_ulong st_atimensec; -- time_t st_mtime; -- c_ulong st_mtimensec; -- time_t st_ctime; -- c_ulong st_ctimensec; -- } -- blksize_t st_blksize; -- static if (!__USE_FILE_OFFSET64) -- { -- blkcnt_t st_blocks; -- } -- else -- { -- c_long st_pad4; -- blkcnt_t st_blocks; -- } -- c_long[14] st_pad5; - } -- } -- else -- { -- struct stat_t -+ else - { -- dev_t st_dev; -- int[3] st_pad1; -- ino_t st_ino; -- mode_t st_mode; -- nlink_t st_nlink; -- uid_t st_uid; -- gid_t st_gid; -- dev_t st_rdev; -- static if (!__USE_FILE_OFFSET64) -- { -- uint[2] st_pad2; -- off_t st_size; -- int st_pad3; -- } -- else -- { -- uint[3] st_pad2; -- off_t st_size; -- } -- static if (__USE_MISC || __USE_XOPEN2K8) -- { -- timespec st_atim; -- timespec st_mtim; -- timespec st_ctim; -- extern(D) -- { -- @property ref time_t st_atime() { return st_atim.tv_sec; } -- @property ref time_t st_mtime() { return st_mtim.tv_sec; } -- @property ref time_t st_ctime() { return st_ctim.tv_sec; } -- } -- } -- else -+ uint __st_ino; -+ } -+ mode_t st_mode; -+ nlink_t st_nlink; -+ uid_t st_uid; -+ gid_t st_gid; -+ dev_t st_rdev; -+ ushort __pad2; -+ off_t st_size; -+ blksize_t st_blksize; -+ blkcnt_t st_blocks; -+ static if (__USE_MISC || __USE_XOPEN2K8) -+ { -+ timespec st_atim; -+ timespec st_mtim; -+ timespec st_ctim; -+ extern(D) - { -- time_t st_atime; -- c_ulong st_atimensec; -- time_t st_mtime; -- c_ulong st_mtimensec; -- time_t st_ctime; -- c_ulong st_ctimensec; -+ @property ref time_t st_atime() { return st_atim.tv_sec; } -+ @property ref time_t st_mtime() { return st_mtim.tv_sec; } -+ @property ref time_t st_ctime() { return st_ctim.tv_sec; } - } -- blksize_t st_blksize; -- uint st_pad4; -- blkcnt_t st_blocks; -- int[14] st_pad5; - } -- } -- } -- else version (AnyX86) -- { -- struct stat_t -- { -- dev_t st_dev; -- static if(__WORDSIZE==32) -+ else - { -- ushort __pad1; -+ time_t st_atime; -+ ulong_t st_atimensec; -+ time_t st_mtime; -+ ulong_t st_mtimensec; -+ time_t st_ctime; -+ ulong_t st_ctimensec; - } -- static if( !__USE_FILE_OFFSET64 || __WORDSIZE==64 ) -+ static if (__USE_FILE_OFFSET64) - { -- uint st_ino; -+ ino_t st_ino; - } - else - { -- uint __st_ino; -+ c_ulong __unused4; -+ c_ulong __unused5; - } -- static if (__WORDSIZE==32) -+ } -+ } -+ else version (X86_64) -+ { -+ struct stat_t -+ { -+ dev_t st_dev; -+ ino_t st_ino; -+ nlink_t st_nlink; -+ mode_t st_mode; -+ uid_t st_uid; -+ gid_t st_gid; -+ uint __pad0; -+ dev_t st_rdev; -+ off_t st_size; -+ blksize_t st_blksize; -+ blkcnt_t st_blocks; -+ static if (__USE_MISC || __USE_XOPEN2K8) - { -- mode_t st_mode; -- nlink_t st_nlink; -+ timespec st_atim; -+ timespec st_mtim; -+ timespec st_ctim; -+ extern(D) -+ { -+ @property ref time_t st_atime() { return st_atim.tv_sec; } -+ @property ref time_t st_mtime() { return st_mtim.tv_sec; } -+ @property ref time_t st_ctime() { return st_ctim.tv_sec; } -+ } - } - else - { -- nlink_t st_nlink; -- mode_t st_mode; -+ time_t st_atime; -+ ulong_t st_atimensec; -+ time_t st_mtime; -+ ulong_t st_mtimensec; -+ time_t st_ctime; -+ ulong_t st_ctimensec; - } -+ slong_t __unused[3]; -+ } -+ } -+ else version (MIPS_O32) -+ { -+ struct stat_t -+ { -+ c_ulong st_dev; -+ c_long[3] st_pad1; -+ ino_t st_ino; -+ mode_t st_mode; -+ nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; -- static if(__WORDSIZE==64) -+ c_ulong st_rdev; -+ static if (!__USE_FILE_OFFSET64) - { -- uint pad0; -+ c_long[2] st_pad2; -+ off_t st_size; -+ c_long st_pad3; - } -- dev_t st_rdev; -- static if(__WORDSIZE==32) -+ else - { -- ushort __pad2; -+ c_long[3] st_pad2; -+ off_t st_size; - } -- off_t st_size; -- blksize_t st_blksize; -- blkcnt_t st_blocks; -- static if( __USE_MISC || __USE_XOPEN2K8 ) -+ static if (__USE_MISC || __USE_XOPEN2K8) - { - timespec st_atim; - timespec st_mtim; -@@ -256,23 +219,248 @@ version( linux ) - time_t st_ctime; - c_ulong st_ctimensec; - } -- static if(__WORDSIZE==64) -+ blksize_t st_blksize; -+ static if (!__USE_FILE_OFFSET64) -+ { -+ blkcnt_t st_blocks; -+ } -+ else -+ { -+ c_long st_pad4; -+ blkcnt_t st_blocks; -+ } -+ c_long[14] st_pad5; -+ } -+ } -+ else version (PPC) -+ { -+ struct stat_t -+ { -+ c_ulong st_dev; -+ ino_t st_ino; -+ mode_t st_mode; -+ nlink_t st_nlink; -+ uid_t st_uid; -+ gid_t st_gid; -+ c_ulong st_rdev; -+ off_t st_size; -+ c_ulong st_blksize; -+ c_ulong st_blocks; -+ c_ulong st_atime; -+ c_ulong st_atime_nsec; -+ c_ulong st_mtime; -+ c_ulong st_mtime_nsec; -+ c_ulong st_ctime; -+ c_ulong st_ctime_nsec; -+ c_ulong __unused4; -+ c_ulong __unused5; -+ } -+ } -+ else version (PPC64) -+ { -+ struct stat_t -+ { -+ c_ulong st_dev; -+ ino_t st_ino; -+ nlink_t st_nlink; -+ mode_t st_mode; -+ uid_t st_uid; -+ gid_t st_gid; -+ c_ulong st_rdev; -+ off_t st_size; -+ c_ulong st_blksize; -+ c_ulong st_blocks; -+ c_ulong st_atime; -+ c_ulong st_atime_nsec; -+ c_ulong st_mtime; -+ c_ulong st_mtime_nsec; -+ c_ulong st_ctime; -+ c_ulong st_ctime_nsec; -+ c_ulong __unused4; -+ c_ulong __unused5; -+ c_ulong __unused6; -+ } -+ } -+ else version (ARM) -+ { -+ private -+ { -+ alias __dev_t = ulong; -+ alias __ino_t = c_ulong; -+ alias __ino64_t = ulong; -+ alias __mode_t = uint; -+ alias __nlink_t = size_t; -+ alias __uid_t = uint; -+ alias __gid_t = uint; -+ alias __off_t = c_long; -+ alias __off64_t = long; -+ alias __blksize_t = c_long; -+ alias __blkcnt_t = c_long; -+ alias __blkcnt64_t = long; -+ alias __timespec = timespec; -+ alias __time_t = time_t; -+ } -+ struct stat_t -+ { -+ __dev_t st_dev; -+ ushort __pad1; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __ino_t st_ino; -+ } -+ else - { -- c_long __unused[3]; -+ __ino_t __st_ino; -+ } -+ __mode_t st_mode; -+ __nlink_t st_nlink; -+ __uid_t st_uid; -+ __gid_t st_gid; -+ __dev_t st_rdev; -+ ushort __pad2; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __off_t st_size; - } - else - { -- static if( __USE_FILE_OFFSET64 ) -+ __off64_t st_size; -+ } -+ __blksize_t st_blksize; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __blkcnt_t st_blocks; -+ } -+ else -+ { -+ __blkcnt64_t st_blocks; -+ } -+ -+ static if( __USE_MISC || __USE_XOPEN2K8) -+ { -+ __timespec st_atim; -+ __timespec st_mtim; -+ __timespec st_ctim; -+ extern(D) - { -- ino_t st_ino; -+ @property ref time_t st_atime() { return st_atim.tv_sec; } -+ @property ref time_t st_mtime() { return st_mtim.tv_sec; } -+ @property ref time_t st_ctime() { return st_ctim.tv_sec; } - } -- else -+ } -+ else -+ { -+ __time_t st_atime; -+ c_ulong st_atimensec; -+ __time_t st_mtime; -+ c_ulong st_mtimensec; -+ __time_t st_ctime; -+ c_ulong st_ctimensec; -+ } -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ c_ulong __unused4; -+ c_ulong __unused5; -+ } -+ else -+ { -+ __ino64_t st_ino; -+ } -+ } -+ static if(__USE_FILE_OFFSET64) -+ static assert(stat_t.sizeof == 104); -+ else -+ static assert(stat_t.sizeof == 88); -+ } -+ else version (AArch64) -+ { -+ private -+ { -+ alias __dev_t = ulong; -+ alias __ino_t = c_ulong; -+ alias __ino64_t = ulong; -+ alias __mode_t = uint; -+ alias __nlink_t = uint; -+ alias __uid_t = uint; -+ alias __gid_t = uint; -+ alias __off_t = c_long; -+ alias __off64_t = long; -+ alias __blksize_t = int; -+ alias __blkcnt_t = c_long; -+ alias __blkcnt64_t = long; -+ alias __timespec = timespec; -+ alias __time_t = time_t; -+ } -+ struct stat_t -+ { -+ __dev_t st_dev; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __ino_t st_ino; -+ } -+ else -+ { -+ __ino64_t st_ino; -+ } -+ __mode_t st_mode; -+ __nlink_t st_nlink; -+ __uid_t st_uid; -+ __gid_t st_gid; -+ __dev_t st_rdev; -+ __dev_t __pad1; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __off_t st_size; -+ } -+ else -+ { -+ __off64_t st_size; -+ } -+ __blksize_t st_blksize; -+ int __pad2; -+ -+ static if(!__USE_FILE_OFFSET64) -+ { -+ __blkcnt_t st_blocks; -+ } -+ else -+ { -+ __blkcnt64_t st_blocks; -+ } -+ -+ static if(__USE_MISC) -+ { -+ __timespec st_atim; -+ __timespec st_mtim; -+ __timespec st_ctim; -+ extern(D) - { -- c_ulong __unused4; -- c_ulong __unused5; -+ @property ref time_t st_atime() { return st_atim.tv_sec; } -+ @property ref time_t st_mtime() { return st_mtim.tv_sec; } -+ @property ref time_t st_ctime() { return st_ctim.tv_sec; } - } - } -+ else -+ { -+ __time_t st_atime; -+ c_ulong st_atimensec; -+ __time_t st_mtime; -+ c_ulong st_mtimensec; -+ __time_t st_ctime; -+ c_ulong st_ctimensec; -+ } -+ int[2] __unused; - } -+ static if(__USE_FILE_OFFSET64) -+ static assert(stat_t.sizeof == 128); -+ else -+ static assert(stat_t.sizeof == 128); - } - else - static assert(0, "unimplemented"); -@@ -554,13 +742,13 @@ else version (Solaris) - enum S_ISVTX = 0x200; - - private -- { -+ { - extern (D) bool S_ISTYPE(mode_t mode, uint mask) - { - return (mode & S_IFMT) == mask; - } - } -- -+ - extern (D) bool S_ISBLK(mode_t mode) { return S_ISTYPE(mode, S_IFBLK); } - extern (D) bool S_ISCHR(mode_t mode) { return S_ISTYPE(mode, S_IFCHR); } - extern (D) bool S_ISDIR(mode_t mode) { return S_ISTYPE(mode, S_IFDIR); } ---- a/src/libphobos/libdruntime/core/sys/posix/sys/statvfs.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/statvfs.d 2014-04-01 16:32:51.000000000 +0100 -@@ -68,6 +68,21 @@ version(linux) { - ST_NOSUID = 2 - } - } -+ -+ static if( __USE_FILE_OFFSET64 ) -+ { -+ int statvfs64 (const char * file, statvfs_t* buf); -+ alias statvfs64 statvfs; -+ -+ int fstatvfs64 (int fildes, statvfs_t *buf); -+ alias fstatvfs64 fstatvfs; -+ } -+ else -+ { -+ int statvfs (const char * file, statvfs_t* buf); -+ int fstatvfs (int fildes, statvfs_t *buf); -+ } -+ - } - else - { -@@ -91,18 +106,7 @@ else - ST_RDONLY = 1, /* Mount read-only. */ - ST_NOSUID = 2 - } --} -- --static if( __USE_FILE_OFFSET64 ) --{ -- int statvfs64 (const char * file, statvfs_t* buf); -- alias statvfs64 statvfs; - -- int fstatvfs64 (int fildes, statvfs_t *buf); -- alias fstatvfs64 fstatvfs; --} --else --{ -- int statvfs (const char * file, statvfs_t* buf); -- int fstatvfs (int fildes, statvfs_t *buf); -+ int statvfs (const char * file, statvfs_t* buf); -+ int fstatvfs (int fildes, statvfs_t *buf); - } ---- a/src/libphobos/libdruntime/core/sys/posix/sys/types.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/sys/types.d 2014-04-01 16:32:51.000000000 +0100 -@@ -18,12 +18,46 @@ module core.sys.posix.sys.types; - private import core.sys.posix.config; - private import core.stdc.stdint; - public import core.stdc.stddef; // for size_t --public import core.stdc.time; // for clock_t, time_t - - version (Posix): - extern (C): - - // -+// bits/typesizes.h -- underlying types for *_t. -+// -+/* -+__syscall_slong_t -+__syscall_ulong_t -+*/ -+version (linux) -+{ -+ version (X86_64) -+ { -+ version (D_X32) -+ { -+ // X32 kernel interface is 64-bit. -+ alias long slong_t; -+ alias ulong ulong_t; -+ } -+ else -+ { -+ alias c_long slong_t; -+ alias c_ulong ulong_t; -+ } -+ } -+ else -+ { -+ alias c_long slong_t; -+ alias c_ulong ulong_t; -+ } -+} -+else -+{ -+ alias c_long slong_t; -+ alias c_ulong ulong_t; -+} -+ -+// - // Required - // - /* -@@ -52,19 +86,19 @@ version( linux ) - } - else - { -- alias c_long blkcnt_t; -- alias c_ulong ino_t; -- alias c_long off_t; -+ alias slong_t blkcnt_t; -+ alias ulong_t ino_t; -+ alias slong_t off_t; - } -- alias c_long blksize_t; -+ alias slong_t blksize_t; - alias ulong dev_t; - alias uint gid_t; - alias uint mode_t; -- alias c_ulong nlink_t; -+ alias ulong_t nlink_t; - alias int pid_t; - //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; -- //time_t (defined in core.stdc.time) -+ alias slong_t time_t; - alias uint uid_t; - } - else version( OSX ) -@@ -80,7 +114,7 @@ else version( OSX ) - alias int pid_t; - //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; -- //time_t (defined in core.stdc.time) -+ alias c_long time_t; - alias uint uid_t; - } - else version( FreeBSD ) -@@ -96,7 +130,7 @@ else version( FreeBSD ) - alias int pid_t; - //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; -- //time_t (defined in core.stdc.time) -+ alias c_long time_t; - alias uint uid_t; - alias uint fflags_t; - } -@@ -139,6 +173,7 @@ else version (Solaris) - alias uint nlink_t; - alias int pid_t; - alias c_long ssize_t; -+ alias c_long time_t; - alias uint uid_t; - } - else -@@ -168,30 +203,30 @@ version( linux ) - } - else - { -- alias c_ulong fsblkcnt_t; -- alias c_ulong fsfilcnt_t; -+ alias ulong_t fsblkcnt_t; -+ alias ulong_t fsfilcnt_t; - } -- // clock_t (defined in core.stdc.time) -+ alias slong_t clock_t; - alias uint id_t; - alias int key_t; -- alias c_long suseconds_t; -+ alias slong_t suseconds_t; - alias uint useconds_t; - } - else version( OSX ) - { -- //clock_t -- alias uint fsblkcnt_t; -- alias uint fsfilcnt_t; -- alias uint id_t; -+ alias uint fsblkcnt_t; -+ alias uint fsfilcnt_t; -+ alias c_long clock_t; -+ alias uint id_t; - // key_t -- alias int suseconds_t; -- alias uint useconds_t; -+ alias int suseconds_t; -+ alias uint useconds_t; - } - else version( FreeBSD ) - { -- // clock_t (defined in core.stdc.time) - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; -+ alias c_long clock_t; - alias long id_t; - alias c_long key_t; - alias c_long suseconds_t; -@@ -210,6 +245,7 @@ else version (Solaris) - alias c_ulong fsfilcnt_t; - } - -+ alias c_long clock_t; - alias int id_t; - alias int key_t; - alias c_long suseconds_t; -@@ -242,9 +278,72 @@ pthread_rwlockattr_t - pthread_t - */ - --version( linux ) -+version (linux) - { -- version(D_LP64) -+ version (X86) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 36; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 24; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 32; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 20; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (X86_64) -+ { -+ static if (__WORDSIZE == 64) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 56; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 40; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 32; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 32; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 32; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 44; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 20; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ } -+ else version (AArch64) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 64; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 48; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 8; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 8; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 32; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 8; -+ } -+ else version (ARM) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 36; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 24; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 32; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 20; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (IA64) - { - enum __SIZEOF_PTHREAD_ATTR_T = 56; - enum __SIZEOF_PTHREAD_MUTEX_T = 40; -@@ -256,7 +355,31 @@ version( linux ) - enum __SIZEOF_PTHREAD_BARRIER_T = 32; - enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; - } -- else -+ else version (MIPS32) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 36; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 24; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 32; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 20; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (MIPS64) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 56; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 40; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 32; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (PPC) - { - enum __SIZEOF_PTHREAD_ATTR_T = 36; - enum __SIZEOF_PTHREAD_MUTEX_T = 24; -@@ -268,6 +391,46 @@ version( linux ) - enum __SIZEOF_PTHREAD_BARRIER_T = 20; - enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; - } -+ else version (PPC64) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 56; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 40; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 32; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (S390) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 36; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 24; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 32; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 20; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else version (S390X) -+ { -+ enum __SIZEOF_PTHREAD_ATTR_T = 56; -+ enum __SIZEOF_PTHREAD_MUTEX_T = 40; -+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4; -+ enum __SIZEOF_PTHREAD_COND_T = 48; -+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4; -+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56; -+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8; -+ enum __SIZEOF_PTHREAD_BARRIER_T = 32; -+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4; -+ } -+ else -+ { -+ static assert (false, "Unsupported platform"); -+ } - - union pthread_attr_t - { ---- a/src/libphobos/libdruntime/core/sys/posix/syslog.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/syslog.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,266 @@ -+/** -+ * D header file for POSIX system logger API. -+ * (http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html) -+ * -+ * Copyright: Copyright Adil Baig 2013. -+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0). -+ * Authors: Adil Baig -+ * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition -+ */ -+ -+/* Copyright Adil Baig 2013. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module core.sys.posix.syslog; -+ -+version (Posix): -+ -+extern (C): -+@system: -+nothrow: -+ -+version(linux) -+{ -+ //PRIORITY -+ enum { -+ LOG_EMERG = 0, /* system is unusable */ -+ LOG_ALERT = 1, /* action must be taken immediately */ -+ LOG_CRIT = 2, /* critical conditions */ -+ LOG_ERR = 3, /* error conditions */ -+ LOG_WARNING = 4, /* warning conditions */ -+ LOG_NOTICE = 5, /* normal but significant condition */ -+ LOG_INFO = 6, /* informational */ -+ LOG_DEBUG = 7, /* debug-level messages */ -+ }; -+ -+ //OPTIONS -+ enum { -+ LOG_PID = 0x01, /* log the pid with each message */ -+ LOG_CONS = 0x02, /* log on the console if errors in sending */ -+ LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */ -+ LOG_NDELAY = 0x08, /* don't delay open */ -+ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */ -+ LOG_PERROR = 0x20, /* log to stderr as well */ -+ }; -+ -+ //FACILITY -+ enum { -+ LOG_KERN = (0<<3), /* kernel messages */ -+ LOG_USER = (1<<3), /* random user-level messages */ -+ LOG_MAIL = (2<<3), /* mail system */ -+ LOG_DAEMON = (3<<3), /* system daemons */ -+ LOG_AUTH = (4<<3), /* security/authorization messages */ -+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ -+ LOG_LPR = (6<<3), /* line printer subsystem */ -+ LOG_NEWS = (7<<3), /* network news subsystem */ -+ LOG_UUCP = (8<<3), /* UUCP subsystem */ -+ LOG_CRON = (9<<3), /* clock daemon */ -+ LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */ -+ LOG_FTP = (11<<3), /* ftp daemon */ -+ -+ /* other codes through 15 reserved for system use */ -+ LOG_LOCAL0 = (16<<3), /* reserved for local use */ -+ LOG_LOCAL1 = (17<<3), /* reserved for local use */ -+ LOG_LOCAL2 = (18<<3), /* reserved for local use */ -+ LOG_LOCAL3 = (19<<3), /* reserved for local use */ -+ LOG_LOCAL4 = (20<<3), /* reserved for local use */ -+ LOG_LOCAL5 = (21<<3), /* reserved for local use */ -+ LOG_LOCAL6 = (22<<3), /* reserved for local use */ -+ LOG_LOCAL7 = (23<<3), /* reserved for local use */ -+ -+ LOG_NFACILITIES = 24, /* current number of facilities */ -+ }; -+ -+ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */ -+ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */ -+ -+ void openlog (const char *, int __option, int __facility); -+ int setlogmask (int __mask); -+ void syslog (int __pri, const char *__fmt, ...); -+ void closelog(); -+} -+else version( OSX ) -+{ -+ //http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/osfmk/sys/syslog.h -+ -+ //PRIORITY -+ enum { -+ LOG_EMERG = 0, /* system is unusable */ -+ LOG_ALERT = 1, /* action must be taken immediately */ -+ LOG_CRIT = 2, /* critical conditions */ -+ LOG_ERR = 3, /* error conditions */ -+ LOG_WARNING = 4, /* warning conditions */ -+ LOG_NOTICE = 5, /* normal but significant condition */ -+ LOG_INFO = 6, /* informational */ -+ LOG_DEBUG = 7, /* debug-level messages */ -+ }; -+ -+ //OPTIONS -+ enum { -+ LOG_PID = 0x01, /* log the pid with each message */ -+ LOG_CONS = 0x02, /* log on the console if errors in sending */ -+ LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */ -+ LOG_NDELAY = 0x08, /* don't delay open */ -+ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */ -+ }; -+ -+ //FACILITY -+ enum { -+ LOG_KERN = (0<<3), /* kernel messages */ -+ LOG_USER = (1<<3), /* random user-level messages */ -+ LOG_MAIL = (2<<3), /* mail system */ -+ LOG_DAEMON = (3<<3), /* system daemons */ -+ LOG_AUTH = (4<<3), /* security/authorization messages */ -+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ -+ LOG_LPR = (6<<3), /* line printer subsystem */ -+ LOG_NEWS = (7<<3), /* network news subsystem */ -+ LOG_UUCP = (8<<3), /* UUCP subsystem */ -+ -+ /* other codes through 15 reserved for system use */ -+ LOG_LOCAL0 = (16<<3), /* reserved for local use */ -+ LOG_LOCAL1 = (17<<3), /* reserved for local use */ -+ LOG_LOCAL2 = (18<<3), /* reserved for local use */ -+ LOG_LOCAL3 = (19<<3), /* reserved for local use */ -+ LOG_LOCAL4 = (20<<3), /* reserved for local use */ -+ LOG_LOCAL5 = (21<<3), /* reserved for local use */ -+ LOG_LOCAL6 = (22<<3), /* reserved for local use */ -+ LOG_LOCAL7 = (23<<3), /* reserved for local use */ -+ -+ LOG_NFACILITIES = 24, /* current number of facilities */ -+ }; -+ -+ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */ -+ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */ -+ -+ void openlog (const char *, int __option, int __facility); -+ int setlogmask (int __mask); -+ void syslog (int __pri, const char *__fmt, ...); -+ void closelog(); -+} -+else version( FreeBSD ) -+{ -+ //http://fxr.watson.org/fxr/source/sys/syslog.h -+ -+ //PRIORITY -+ enum { -+ LOG_EMERG = 0, /* system is unusable */ -+ LOG_ALERT = 1, /* action must be taken immediately */ -+ LOG_CRIT = 2, /* critical conditions */ -+ LOG_ERR = 3, /* error conditions */ -+ LOG_WARNING = 4, /* warning conditions */ -+ LOG_NOTICE = 5, /* normal but significant condition */ -+ LOG_INFO = 6, /* informational */ -+ LOG_DEBUG = 7, /* debug-level messages */ -+ }; -+ -+ //OPTIONS -+ enum { -+ LOG_PID = 0x01, /* log the pid with each message */ -+ LOG_CONS = 0x02, /* log on the console if errors in sending */ -+ LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */ -+ LOG_NDELAY = 0x08, /* don't delay open */ -+ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */ -+ LOG_PERROR = 0x20, /* log to stderr as well */ -+ }; -+ -+ //FACILITY -+ enum { -+ LOG_KERN = (0<<3), /* kernel messages */ -+ LOG_USER = (1<<3), /* random user-level messages */ -+ LOG_MAIL = (2<<3), /* mail system */ -+ LOG_DAEMON = (3<<3), /* system daemons */ -+ LOG_AUTH = (4<<3), /* security/authorization messages */ -+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ -+ LOG_LPR = (6<<3), /* line printer subsystem */ -+ LOG_NEWS = (7<<3), /* network news subsystem */ -+ LOG_UUCP = (8<<3), /* UUCP subsystem */ -+ LOG_CRON = (9<<3), /* clock daemon */ -+ LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */ -+ LOG_FTP = (11<<3), /* ftp daemon */ -+ LOG_NTP = (12<<3), /* NTP subsystem */ -+ LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */ -+ LOG_CONSOLE = (14<<3), /* /dev/console output */ -+ -+ /* other codes through 15 reserved for system use */ -+ LOG_LOCAL0 = (16<<3), /* reserved for local use */ -+ LOG_LOCAL1 = (17<<3), /* reserved for local use */ -+ LOG_LOCAL2 = (18<<3), /* reserved for local use */ -+ LOG_LOCAL3 = (19<<3), /* reserved for local use */ -+ LOG_LOCAL4 = (20<<3), /* reserved for local use */ -+ LOG_LOCAL5 = (21<<3), /* reserved for local use */ -+ LOG_LOCAL6 = (22<<3), /* reserved for local use */ -+ LOG_LOCAL7 = (23<<3), /* reserved for local use */ -+ -+ LOG_NFACILITIES = 24, /* current number of facilities */ -+ }; -+ -+ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */ -+ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */ -+ -+ void openlog (const char *, int __option, int __facility); -+ int setlogmask (int __mask); -+ void syslog (int __pri, const char *__fmt, ...); -+ void closelog(); -+} -+else version( Solaris ) -+{ -+ //http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html -+ -+ //PRIORITY -+ enum { -+ LOG_EMERG = 0, /* system is unusable */ -+ LOG_ALERT = 1, /* action must be taken immediately */ -+ LOG_CRIT = 2, /* critical conditions */ -+ LOG_ERR = 3, /* error conditions */ -+ LOG_WARNING = 4, /* warning conditions */ -+ LOG_NOTICE = 5, /* normal but significant condition */ -+ LOG_INFO = 6, /* informational */ -+ LOG_DEBUG = 7, /* debug-level messages */ -+ }; -+ -+ //OPTIONS -+ enum { -+ LOG_PID = 0x01, /* log the pid with each message */ -+ LOG_CONS = 0x02, /* log on the console if errors in sending */ -+ LOG_NDELAY = 0x08, /* don't delay open */ -+ LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */ -+ }; -+ -+ //FACILITY -+ enum { -+ LOG_KERN = (0<<3), /* kernel messages */ -+ LOG_USER = (1<<3), /* random user-level messages */ -+ LOG_MAIL = (2<<3), /* mail system */ -+ LOG_DAEMON = (3<<3), /* system daemons */ -+ LOG_AUTH = (4<<3), /* security/authorization messages */ -+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ -+ LOG_LPR = (6<<3), /* line printer subsystem */ -+ LOG_NEWS = (7<<3), /* network news subsystem */ -+ LOG_UUCP = (8<<3), /* UUCP subsystem */ -+ LOG_CRON = (9<<3), /* clock daemon */ -+ LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */ -+ LOG_FTP = (11<<3), /* ftp daemon */ -+ -+ /* other codes through 15 reserved for system use */ -+ LOG_LOCAL0 = (16<<3), /* reserved for local use */ -+ LOG_LOCAL1 = (17<<3), /* reserved for local use */ -+ LOG_LOCAL2 = (18<<3), /* reserved for local use */ -+ LOG_LOCAL3 = (19<<3), /* reserved for local use */ -+ LOG_LOCAL4 = (20<<3), /* reserved for local use */ -+ LOG_LOCAL5 = (21<<3), /* reserved for local use */ -+ LOG_LOCAL6 = (22<<3), /* reserved for local use */ -+ LOG_LOCAL7 = (23<<3), /* reserved for local use */ -+ -+ LOG_NFACILITIES = 24, /* current number of facilities */ -+ }; -+ -+ int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */ -+ int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */ -+ -+ void openlog (const char *, int __option, int __facility); -+ int setlogmask (int __mask); -+ void syslog (int __pri, const char *__fmt, ...); -+ void closelog(); -+} -\ No newline at end of file ---- a/src/libphobos/libdruntime/core/sys/posix/ucontext.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/posix/ucontext.d 2014-04-01 16:32:51.000000000 +0100 -@@ -270,6 +270,223 @@ version( linux ) - sigset_t uc_sigmask; - } - } -+ else version (PPC) -+ { -+ private -+ { -+ enum NGREG = 48; -+ -+ alias c_ulong greg_t; -+ alias greg_t[NGREG] gregset_t; -+ -+ struct fpregset_t -+ { -+ double[32] fpregs; -+ double fpscr; -+ uint[2] _pad; -+ } -+ -+ struct vrregset_t -+ { -+ uint[32][4] vrregs; -+ uint vrsave; -+ uint[2] __pad; -+ uint vscr; -+ } -+ -+ struct pt_regs -+ { -+ c_ulong[32] gpr; -+ c_ulong nip; -+ c_ulong msr; -+ c_ulong orig_gpr3; -+ c_ulong ctr; -+ c_ulong link; -+ c_ulong xer; -+ c_ulong ccr; -+ c_ulong mq; -+ c_ulong trap; -+ c_ulong dar; -+ c_ulong dsisr; -+ c_ulong result; -+ } -+ } -+ -+ struct mcontext_t -+ { -+ gregset_t gregs; -+ fpregset_t fpregs; -+ align(16) vrregset_t vrregs; -+ } -+ -+ struct ucontext_t -+ { -+ c_ulong uc_flags; -+ ucontext_t* uc_link; -+ stack_t uc_stack; -+ int[7] uc_pad; -+ union uc_mcontext -+ { -+ pt_regs* regs; -+ mcontext_t* uc_regs; -+ } -+ sigset_t uc_sigmask; -+ char[mcontext_t.sizeof + 12] uc_reg_space; -+ } -+ } -+ else version (PPC64) -+ { -+ private -+ { -+ enum NGREG = 48; -+ enum NFPREG = 33; -+ enum NVRREG = 34; -+ -+ alias c_ulong greg_t; -+ alias greg_t[NGREG] gregset_t; -+ alias double[NFPREG] fpregset_t; -+ -+ struct vscr_t -+ { -+ uint[3] __pad; -+ uint vscr_word; -+ } -+ -+ struct vrregset_t -+ { -+ uint[32][4] vrregs; -+ vscr_t vscr; -+ uint vrsave; -+ uint[3] __pad; -+ } -+ -+ struct pt_regs -+ { -+ c_ulong[32] gpr; -+ c_ulong nip; -+ c_ulong msr; -+ c_ulong orig_gpr3; -+ c_ulong ctr; -+ c_ulong link; -+ c_ulong xer; -+ c_ulong ccr; -+ c_ulong softe; -+ c_ulong trap; -+ c_ulong dar; -+ c_ulong dsisr; -+ c_ulong result; -+ } -+ } -+ -+ struct mcontext_t -+ { -+ c_ulong[4] __unused; -+ int signal; -+ int __pad0; -+ c_ulong handler; -+ c_ulong oldmask; -+ pt_regs* regs; -+ gregset_t gp_regs; -+ fpregset_t fp_regs; -+ vrregset_t *v_regs; -+ c_long[NVRREG+NVRREG+1] vmx_reserve; -+ } -+ -+ struct ucontext_t -+ { -+ c_ulong uc_flags; -+ ucontext_t* uc_link; -+ stack_t uc_stack; -+ sigset_t uc_sigmask; -+ mcontext_t uc_mcontext; -+ } -+ } -+ else version(ARM) -+ { -+ enum -+ { -+ R0 = 0, -+ R1 = 1, -+ R2 = 2, -+ R3 = 3, -+ R4 = 4, -+ R5 = 5, -+ R6 = 6, -+ R7 = 7, -+ R8 = 8, -+ R9 = 9, -+ R10 = 10, -+ R11 = 11, -+ R12 = 12, -+ R13 = 13, -+ R14 = 14, -+ R15 = 15 -+ } -+ -+ struct sigcontext -+ { -+ c_ulong trap_no; -+ c_ulong error_code; -+ c_ulong oldmask; -+ c_ulong arm_r0; -+ c_ulong arm_r1; -+ c_ulong arm_r2; -+ c_ulong arm_r3; -+ c_ulong arm_r4; -+ c_ulong arm_r5; -+ c_ulong arm_r6; -+ c_ulong arm_r7; -+ c_ulong arm_r8; -+ c_ulong arm_r9; -+ c_ulong arm_r10; -+ c_ulong arm_fp; -+ c_ulong arm_ip; -+ c_ulong arm_sp; -+ c_ulong arm_lr; -+ c_ulong arm_pc; -+ c_ulong arm_cpsr; -+ c_ulong fault_address; -+ } -+ -+ //alias elf_fpregset_t fpregset_t; -+ alias sigcontext mcontext_t; -+ -+ struct ucontext_t -+ { -+ c_ulong uc_flags; -+ ucontext_t* uc_link; -+ stack_t uc_stack; -+ mcontext_t uc_mcontext; -+ sigset_t uc_sigmask; -+ align(8) c_ulong[128] uc_regspace; -+ } -+ } -+ else version (AArch64) -+ { -+ alias int greg_t; -+ -+ struct sigcontext { -+ ulong fault_address; -+ /* AArch64 registers */ -+ ulong regs[31]; -+ ulong sp; -+ ulong pc; -+ ulong pstate; -+ /* 4K reserved for FP/SIMD state and future expansion */ -+ align(16) ubyte __reserved[4096]; -+ } -+ -+ alias sigcontext mcontext_t; -+ -+ struct ucontext_t -+ { -+ c_ulong uc_flags; -+ ucontext_t* uc_link; -+ stack_t uc_stack; -+ sigset_t uc_sigmask; -+ mcontext_t uc_mcontext; -+ } -+ } - else - static assert(0, "unimplemented"); - } ---- a/src/libphobos/libdruntime/core/sys/windows/dbghelp.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/windows/dbghelp.d 2014-04-01 16:32:51.000000000 +0100 -@@ -171,32 +171,41 @@ struct IMAGEHLP_CBA_READ_MEMORY - DWORD *bytesread; - }; - -+struct API_VERSION -+{ -+ USHORT MajorVersion; -+ USHORT MinorVersion; -+ USHORT Revision; -+ USHORT Reserved; -+}; -+ - - extern(System) - { -- alias BOOL function(HANDLE hProcess, DWORD64 lpBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead) ReadProcessMemoryProc64; -- alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) FunctionTableAccessProc64; -- alias DWORD64 function(HANDLE hProcess, DWORD64 Address) GetModuleBaseProc64; -- alias DWORD64 function(HANDLE hProcess, HANDLE hThread, ADDRESS64 *lpaddr) TranslateAddressProc64; -- -- alias BOOL function(HANDLE hProcess, PCSTR UserSearchPath, bool fInvadeProcess) SymInitializeFunc; -- alias BOOL function(HANDLE hProcess) SymCleanupFunc; -- alias DWORD function(DWORD SymOptions) SymSetOptionsFunc; -- alias DWORD function() SymGetOptionsFunc; -- alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) SymFunctionTableAccess64Func; -- alias BOOL function(DWORD MachineType, HANDLE hProcess, HANDLE hThread, STACKFRAME64 *StackFrame, PVOID ContextRecord, -- ReadProcessMemoryProc64 ReadMemoryRoutine, FunctionTableAccessProc64 FunctoinTableAccess, -- GetModuleBaseProc64 GetModuleBaseRoutine, TranslateAddressProc64 TranslateAddress) StackWalk64Func; -- alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, IMAGEHLP_LINE64 *line) SymGetLineFromAddr64Func; -- alias DWORD64 function(HANDLE hProcess, DWORD64 dwAddr) SymGetModuleBase64Func; -- alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, IMAGEHLP_MODULE64 *ModuleInfo) SymGetModuleInfo64Func; -- alias BOOL function(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, IMAGEHLP_SYMBOL64 *Symbol) SymGetSymFromAddr64Func; -- alias DWORD function(PCTSTR DecoratedName, PTSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags) UnDecorateSymbolNameFunc; -- alias DWORD64 function(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll) SymLoadModule64Func; -- alias BOOL function(HANDLE HProcess, PTSTR SearchPath, DWORD SearchPathLength) SymGetSearchPathFunc; -- alias BOOL function(HANDLE hProcess, DWORD64 Address) SymUnloadModule64Func; -- alias BOOL function(HANDLE hProcess, ULONG ActionCode, ulong CallbackContext, ulong UserContext) PSYMBOL_REGISTERED_CALLBACK64; -- alias BOOL function(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext) SymRegisterCallback64Func; -+ alias BOOL function(HANDLE hProcess, DWORD64 lpBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead) ReadProcessMemoryProc64; -+ alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) FunctionTableAccessProc64; -+ alias DWORD64 function(HANDLE hProcess, DWORD64 Address) GetModuleBaseProc64; -+ alias DWORD64 function(HANDLE hProcess, HANDLE hThread, ADDRESS64 *lpaddr) TranslateAddressProc64; -+ -+ alias BOOL function(HANDLE hProcess, PCSTR UserSearchPath, bool fInvadeProcess) SymInitializeFunc; -+ alias BOOL function(HANDLE hProcess) SymCleanupFunc; -+ alias DWORD function(DWORD SymOptions) SymSetOptionsFunc; -+ alias DWORD function() SymGetOptionsFunc; -+ alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) SymFunctionTableAccess64Func; -+ alias BOOL function(DWORD MachineType, HANDLE hProcess, HANDLE hThread, STACKFRAME64 *StackFrame, PVOID ContextRecord, -+ ReadProcessMemoryProc64 ReadMemoryRoutine, FunctionTableAccessProc64 FunctoinTableAccess, -+ GetModuleBaseProc64 GetModuleBaseRoutine, TranslateAddressProc64 TranslateAddress) StackWalk64Func; -+ alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, IMAGEHLP_LINE64 *line) SymGetLineFromAddr64Func; -+ alias DWORD64 function(HANDLE hProcess, DWORD64 dwAddr) SymGetModuleBase64Func; -+ alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, IMAGEHLP_MODULE64 *ModuleInfo) SymGetModuleInfo64Func; -+ alias BOOL function(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, IMAGEHLP_SYMBOL64 *Symbol) SymGetSymFromAddr64Func; -+ alias DWORD function(PCTSTR DecoratedName, PTSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags) UnDecorateSymbolNameFunc; -+ alias DWORD64 function(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll) SymLoadModule64Func; -+ alias BOOL function(HANDLE HProcess, PTSTR SearchPath, DWORD SearchPathLength) SymGetSearchPathFunc; -+ alias BOOL function(HANDLE hProcess, DWORD64 Address) SymUnloadModule64Func; -+ alias BOOL function(HANDLE hProcess, ULONG ActionCode, ulong CallbackContext, ulong UserContext) PSYMBOL_REGISTERED_CALLBACK64; -+ alias BOOL function(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext) SymRegisterCallback64Func; -+ alias API_VERSION* function() ImagehlpApiVersionFunc; - } - - struct DbgHelp -@@ -216,6 +225,7 @@ struct DbgHelp - SymGetSearchPathFunc SymGetSearchPath; - SymUnloadModule64Func SymUnloadModule64; - SymRegisterCallback64Func SymRegisterCallback64; -+ ImagehlpApiVersionFunc ImagehlpApiVersion; - - static DbgHelp* get() - { -@@ -237,11 +247,12 @@ struct DbgHelp - sm_inst.SymGetSearchPath = cast(SymGetSearchPathFunc) GetProcAddress(sm_hndl,"SymGetSearchPath"); - sm_inst.SymUnloadModule64 = cast(SymUnloadModule64Func) GetProcAddress(sm_hndl,"SymUnloadModule64"); - sm_inst.SymRegisterCallback64 = cast(SymRegisterCallback64Func) GetProcAddress(sm_hndl, "SymRegisterCallback64"); -+ sm_inst.ImagehlpApiVersion = cast(ImagehlpApiVersionFunc) GetProcAddress(sm_hndl, "ImagehlpApiVersion"); - assert( sm_inst.SymInitialize && sm_inst.SymCleanup && sm_inst.StackWalk64 && sm_inst.SymGetOptions && - sm_inst.SymSetOptions && sm_inst.SymFunctionTableAccess64 && sm_inst.SymGetLineFromAddr64 && - sm_inst.SymGetModuleBase64 && sm_inst.SymGetModuleInfo64 && sm_inst.SymGetSymFromAddr64 && - sm_inst.SymLoadModule64 && sm_inst.SymGetSearchPath && sm_inst.SymUnloadModule64 && -- sm_inst.SymRegisterCallback64); -+ sm_inst.SymRegisterCallback64 && sm_inst.ImagehlpApiVersion); - - return &sm_inst; - } ---- a/src/libphobos/libdruntime/core/sys/windows/stacktrace.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/windows/stacktrace.d 2014-04-01 16:32:51.000000000 +0100 -@@ -7,7 +7,7 @@ - * Source: $(DRUNTIMESRC core/sys/windows/_stacktrace.d) - */ - --/* Copyright Benjamin Thaut 2010 - 2011. -+/* Copyright Benjamin Thaut 2010 - 2012. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE or copy at - * http://www.boost.org/LICENSE_1_0.txt) -@@ -36,13 +36,37 @@ private __gshared immutable bool initial - class StackTrace : Throwable.TraceInfo - { - public: -- this() -+ /** -+ * Constructor -+ * Params: -+ * skip = The number of stack frames to skip. -+ * context = The context to receive the stack trace from. Can be null. -+ */ -+ this(size_t skip, CONTEXT* context) - { -+ if(context is null) -+ { -+ version(Win64) -+ static enum INTERNALFRAMES = 4; -+ else -+ static enum INTERNALFRAMES = 2; -+ -+ skip += INTERNALFRAMES; //skip the stack frames within the StackTrace class -+ } -+ else -+ { -+ //When a exception context is given the first stack frame is repeated for some reason -+ version(Win64) -+ static enum INTERNALFRAMES = 1; -+ else -+ static enum INTERNALFRAMES = 1; -+ -+ skip += INTERNALFRAMES; -+ } - if( initialized ) -- m_trace = trace(); -+ m_trace = trace(skip, context); - } - -- - int opApply( scope int delegate(ref const(char[])) dg ) const - { - return opApply( (ref size_t, ref const(char[]) buf) -@@ -55,8 +79,7 @@ public: - int opApply( scope int delegate(ref size_t, ref const(char[])) dg ) const - { - int result; -- -- foreach( i, e; m_trace ) -+ foreach( i, e; resolve(m_trace) ) - { - if( (result = dg( i, e )) != 0 ) - break; -@@ -65,40 +88,71 @@ public: - } - - -- @safe override string toString() const pure nothrow -+ override string toString() const - { - string result; - -- foreach( e; m_trace ) -+ foreach( e; this ) - { - result ~= e ~ "\n"; - } - return result; - } - -+ /** -+ * Receive a stack trace in the form of an address list. -+ * Params: -+ * skip = How many stack frames should be skipped. -+ * context = The context that should be used. If null the current context is used. -+ * Returns: -+ * A list of addresses that can be passed to resolve at a later point in time. -+ */ -+ static ulong[] trace(size_t skip = 0, CONTEXT* context = null) -+ { -+ synchronized( StackTrace.classinfo ) -+ { -+ return traceNoSync(skip, context); -+ } -+ } - --private: -- char[][] m_trace; -- -- -- static char[][] trace() -+ /** -+ * Resolve a stack trace. -+ * Params: -+ * addresses = A list of addresses to resolve. -+ * Returns: -+ * An array of strings with the results. -+ */ -+ static char[][] resolve(const(ulong)[] addresses) - { - synchronized( StackTrace.classinfo ) - { -- return traceNoSync(); -+ return resolveNoSync(addresses); - } - } - -+private: -+ ulong[] m_trace; -+ - -- static char[][] traceNoSync() -+ static ulong[] traceNoSync(size_t skip, CONTEXT* context) - { -- auto dbghelp = DbgHelp.get(); -- auto hThread = GetCurrentThread(); -- auto hProcess = GetCurrentProcess(); -+ auto dbghelp = DbgHelp.get(); -+ if(dbghelp is null) -+ return []; // dbghelp.dll not available -+ -+ HANDLE hThread = GetCurrentThread(); -+ HANDLE hProcess = GetCurrentProcess(); - CONTEXT ctxt; - -- ctxt.ContextFlags = CONTEXT_FULL; -- RtlCaptureContext(&ctxt); -+ if(context is null) -+ { -+ ctxt.ContextFlags = CONTEXT_FULL; -+ RtlCaptureContext(&ctxt); -+ } -+ else -+ { -+ ctxt = *context; -+ } - - //x86 - STACKFRAME64 stackframe; -@@ -114,7 +168,7 @@ private: - AddrStack.Offset = ctxt.Esp; - AddrStack.Mode = Flat; - } -- else version(X86_64) -+ else version(X86_64) - { - enum Flat = ADDRESS_MODE.AddrModeFlat; - AddrPC.Offset = ctxt.Rip; -@@ -126,6 +180,40 @@ private: - } - } - -+ version (X86) enum imageType = IMAGE_FILE_MACHINE_I386; -+ else version (X86_64) enum imageType = IMAGE_FILE_MACHINE_AMD64; -+ else static assert(0, "unimplemented"); -+ -+ ulong[] result; -+ size_t frameNum = 0; -+ -+ // do ... while so that we don't skip the first stackframe -+ do -+ { -+ if( stackframe.AddrPC.Offset == stackframe.AddrReturn.Offset ) -+ { -+ debug(PRINTF) printf("Endless callstack\n"); -+ break; -+ } -+ if(frameNum >= skip) -+ { -+ result ~= stackframe.AddrPC.Offset; -+ } -+ frameNum++; -+ } -+ while (dbghelp.StackWalk64(imageType, hProcess, hThread, &stackframe, -+ &ctxt, null, null, null, null)); -+ return result; -+ } -+ -+ static char[][] resolveNoSync(const(ulong)[] addresses) -+ { -+ auto dbghelp = DbgHelp.get(); -+ if(dbghelp is null) -+ return []; // dbghelp.dll not available -+ -+ HANDLE hProcess = GetCurrentProcess(); -+ - static struct BufSymbol - { - align(1): -@@ -133,27 +221,15 @@ private: - TCHAR[1024] _buf; - } - BufSymbol bufSymbol=void; -- auto symbol = &bufSymbol._base; -+ IMAGEHLP_SYMBOL64* symbol = &bufSymbol._base; - symbol.SizeOfStruct = IMAGEHLP_SYMBOL64.sizeof; - symbol.MaxNameLength = bufSymbol._buf.length; - -- version (X86) enum imageType = IMAGE_FILE_MACHINE_I386; -- else version (X86_64) enum imageType = IMAGE_FILE_MACHINE_AMD64; -- else static assert(0, "unimplemented"); -- - char[][] trace; -- debug(PRINTF) printf("Callstack:\n"); -- while (dbghelp.StackWalk64(imageType, hProcess, hThread, &stackframe, -- &ctxt, null, null, null, null)) -+ foreach(pc; addresses) - { -- if( stackframe.AddrPC.Offset == stackframe.AddrReturn.Offset ) -+ if( pc != 0 ) - { -- debug(PRINTF) printf("Endless callstack\n"); -- return trace ~ "...".dup; -- } -- else if( stackframe.AddrPC.Offset != 0 ) -- { -- immutable pc = stackframe.AddrPC.Offset; - char[] res; - if (dbghelp.SymGetSymFromAddr64(hProcess, pc, null, symbol) && - *symbol.Name.ptr) -@@ -173,7 +249,6 @@ private: - trace ~= res; - } - } -- debug(PRINTF) printf("End of Callstack\n"); - return trace; - } - -@@ -183,7 +258,7 @@ private: - char[2+2*size_t.sizeof+1] buf=void; - - immutable len = snprintf(buf.ptr, buf.length, "0x%p", pc); -- len < buf.length || assert(0); -+ cast(uint)len < buf.length || assert(0); - return buf[0 .. len].dup; - } - -@@ -193,7 +268,14 @@ private: - - auto res = formatStackFrame(pc); - res ~= " in "; -- res ~= demangle(symName[0 .. strlen(symName)], demangleBuf); -+ const(char)[] tempSymName = symName[0 .. strlen(symName)]; -+ //Deal with dmd mangling of long names -+ version(DigitalMars) version(Win32) -+ { -+ size_t decodeIndex = 0; -+ tempSymName = decodeDmdString(tempSymName, decodeIndex); -+ } -+ res ~= demangle(tempSymName, demangleBuf); - return res; - } - -@@ -208,7 +290,7 @@ private: - res ~= fileName[0 .. strlen(fileName)]; - res ~= "("; - immutable len = snprintf(buf.ptr, buf.length, "%u", lineNum); -- len < buf.length || assert(0); -+ cast(uint)len < buf.length || assert(0); - res ~= buf[0 .. len]; - res ~= ")"; - return res; -@@ -274,9 +356,15 @@ shared static this() - if( dbghelp is null ) - return; // dbghelp.dll not available - -- auto hProcess = GetCurrentProcess(); -+ debug(PRINTF) -+ { -+ API_VERSION* dbghelpVersion = dbghelp.ImagehlpApiVersion(); -+ printf("DbgHelp Version %d.%d.%d\n", dbghelpVersion.MajorVersion, dbghelpVersion.MinorVersion, dbghelpVersion.Revision); -+ } -+ -+ HANDLE hProcess = GetCurrentProcess(); - -- auto symOptions = dbghelp.SymGetOptions(); -+ DWORD symOptions = dbghelp.SymGetOptions(); - symOptions |= SYMOPT_LOAD_LINES; - symOptions |= SYMOPT_FAIL_CRITICAL_ERRORS; - symOptions |= SYMOPT_DEFERRED_LOAD; ---- a/src/libphobos/libdruntime/core/sys/windows/threadaux.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/windows/threadaux.d 2014-04-01 16:32:51.000000000 +0100 -@@ -267,9 +267,14 @@ private: - alias extern(C) void function() externCVoidFunc; - static void impersonate_thread( uint id, externCVoidFunc fn ) - { -+ impersonate_thread(id, () => fn()); -+ } -+ -+ static void impersonate_thread( uint id, scope void delegate() dg) -+ { - if( id == GetCurrentThreadId() ) - { -- fn(); -+ dg(); - return; - } - -@@ -284,7 +289,7 @@ private: - return; - - curteb[11] = tlsarray; -- fn(); -+ dg(); - curteb[11] = curtlsarray; - } - } -@@ -295,6 +300,7 @@ public: - alias thread_aux.getThreadStackBottom getThreadStackBottom; - alias thread_aux.OpenThreadHandle OpenThreadHandle; - alias thread_aux.enumProcessThreads enumProcessThreads; -+ alias thread_aux.impersonate_thread impersonate_thread; - - // get the start of the TLS memory of the thread with the given handle - void* GetTlsDataAddress( HANDLE hnd ) nothrow ---- a/src/libphobos/libdruntime/core/sys/windows/windows.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/sys/windows/windows.d 2014-04-01 16:32:51.000000000 +0100 -@@ -30,7 +30,7 @@ nothrow: - alias char CHAR; - alias short SHORT; - alias int LONG; -- -+ - alias long LONGLONG; - alias ulong ULONGLONG; - -@@ -211,6 +211,7 @@ enum - ERROR_ACCESS_DENIED = 5, - ERROR_INVALID_HANDLE = 6, - ERROR_NO_MORE_FILES = 18, -+ ERROR_INSUFFICIENT_BUFFER = 122, - ERROR_MORE_DATA = 234, - ERROR_NO_MORE_ITEMS = 259, - } -@@ -496,6 +497,7 @@ BOOL FindNextFileW(HANDLE hFindFile, W - BOOL GetExitCodeThread(HANDLE hThread, DWORD *lpExitCode); - BOOL GetExitCodeProcess(HANDLE hProcess, DWORD *lpExitCode); - DWORD GetLastError(); -+void SetLastError(DWORD dwErrCode); - DWORD GetFileAttributesA(in char *lpFileName); - DWORD GetFileAttributesW(in wchar *lpFileName); - BOOL GetFileAttributesExA(LPCSTR, GET_FILEEX_INFO_LEVELS, PVOID); -@@ -1183,14 +1185,14 @@ version (Win64) - - // Copied from Public Domain w64 mingw-runtime package's winnt.h. - -- align(16) struct M128A -+ align(16) struct M128A - { - ULONGLONG Low; - LONGLONG High; -- } -+ } - alias M128A* PM128A; - -- struct XMM_SAVE_AREA32 -+ struct XMM_SAVE_AREA32 - { - WORD ControlWord; - WORD StatusWord; -@@ -1208,9 +1210,9 @@ version (Win64) - M128A FloatRegisters[8]; - M128A XmmRegisters[16]; - BYTE Reserved4[96]; -- } -+ } - alias XMM_SAVE_AREA32 PXMM_SAVE_AREA32; -- -+ - align(16) struct CONTEXT // sizeof(1232) - { - DWORD64 P1Home; -@@ -1251,11 +1253,11 @@ version (Win64) - DWORD64 R14; - DWORD64 R15; - DWORD64 Rip; -- union -+ union - { - XMM_SAVE_AREA32 FltSave; - XMM_SAVE_AREA32 FloatSave; -- struct -+ struct - { - M128A Header[2]; - M128A Legacy[8]; -@@ -1306,8 +1308,8 @@ else // Win32 - - CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS), - -- CONTEXT_ALL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | -- CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | -+ CONTEXT_ALL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | -+ CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | - CONTEXT_EXTENDED_REGISTERS), - - MAXIMUM_SUPPORTED_EXTENSION = 512 -@@ -1344,7 +1346,7 @@ else // Win32 - // - // The context record is never used as an OUT only parameter. - // -- -+ - DWORD ContextFlags; - - // -@@ -1359,41 +1361,41 @@ else // Win32 - DWORD Dr3; - DWORD Dr6; - DWORD Dr7; -- -+ - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_FLOATING_POINT. - // -- -+ - FLOATING_SAVE_AREA FloatSave; -- -+ - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_SEGMENTS. - // -- -+ - DWORD SegGs; - DWORD SegFs; - DWORD SegEs; - DWORD SegDs; -- -+ - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_INTEGER. - // -- -+ - DWORD Edi; - DWORD Esi; - DWORD Ebx; - DWORD Edx; - DWORD Ecx; - DWORD Eax; -- -+ - // - // This section is specified/returned if the - // ContextFlags word contians the flag CONTEXT_CONTROL. - // -- -+ - DWORD Ebp; - DWORD Eip; - DWORD SegCs; // MUST BE SANITIZED -@@ -1579,11 +1581,11 @@ export BOOL SwitchToThread(); - - export - { --LONG InterlockedIncrement(LPLONG lpAddend); --LONG InterlockedDecrement(LPLONG lpAddend); --LONG InterlockedExchange(LPLONG Target, LONG Value); --LONG InterlockedExchangeAdd(LPLONG Addend, LONG Value); --PVOID InterlockedCompareExchange(PVOID *Destination, PVOID Exchange, PVOID Comperand); -+LONG InterlockedIncrement(LPLONG lpAddend); -+LONG InterlockedDecrement(LPLONG lpAddend); -+LONG InterlockedExchange(LPLONG Target, LONG Value); -+LONG InterlockedExchangeAdd(LPLONG Addend, LONG Value); -+LONG InterlockedCompareExchange(LONG *Destination, LONG Exchange, LONG Comperand); - - void InitializeCriticalSection(CRITICAL_SECTION * lpCriticalSection); - void EnterCriticalSection(CRITICAL_SECTION * lpCriticalSection); -@@ -2690,6 +2692,12 @@ export - int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cchMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar); - } - -+// Code pages -+enum : UINT -+{ -+ CP_UTF8 = 65001 -+} -+ - export HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName); - export HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName); - -@@ -3677,3 +3685,16 @@ HINSTANCE ShellExecuteW(HWND hwnd, LPCWS - - UINT_PTR SetTimer(HWND hwnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); - BOOL KillTimer(HWND hwnd, UINT_PTR nIDEvent); -+ -+BOOL GetHandleInformation(HANDLE hObject, LPDWORD lpdwFlags); -+BOOL SetHandleInformation(HANDLE hObject, DWORD dwMask, DWORD dwFlags); -+BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode); -+LPWSTR* CommandLineToArgvW(LPCWSTR lpCmdLine, int* pNumArgs); -+ -+enum -+{ -+ HANDLE_FLAG_INHERIT = 0x1, -+ HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x2, -+} -+ -+enum CREATE_UNICODE_ENVIRONMENT = 0x400; ---- a/src/libphobos/libdruntime/core/threadasm.S 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/threadasm.S 2014-04-01 16:32:51.000000000 +0100 -@@ -3,7 +3,7 @@ - * - * Copyright: Copyright Mikola Lysenko 2005 - 2012. - * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Mikola Lysenko, Martin Nowak -+ * Authors: Mikola Lysenko, Martin Nowak, Kai Nacke - */ - - /* -@@ -16,7 +16,125 @@ - /************************************************************************************ - * POWER PC ASM BITS - ************************************************************************************/ --#if defined( __ppc__ ) || defined( __PPC__ ) || defined( __powerpc__ ) -+#if defined( __PPC64__ ) -+ -+ -+ .text -+ .globl _D4core6thread18callWithStackShellFMDFPvZvZv -+ .align 2 -+ .type _D4core6thread18callWithStackShellFMDFPvZvZv,@function -+ .section .opd,"aw",@progbits -+_D4core6thread18callWithStackShellFMDFPvZvZv: -+ .align 3 -+ .quad .L._D4core6thread18callWithStackShellFMDFPvZvZv -+ .quad .TOC.@tocbase -+ .quad 0 -+ .text -+/* -+ * Called with: -+ * r3: pointer context -+ * r4: pointer to function -+ */ -+.L._D4core6thread18callWithStackShellFMDFPvZvZv: -+ .cfi_startproc -+ mflr 0 -+ std 0, 16(1) // save LR -+ stdu 1, -256(1) // stack size: 18*8 + 112 = 256 -+ .cfi_def_cfa_offset 256 -+ .cfi_offset lr, 16 -+ -+ /* Save r14-r31 in general register save area */ -+ std 14, (112 + 0 * 8)(1) -+ std 15, (112 + 1 * 8)(1) -+ std 16, (112 + 2 * 8)(1) -+ std 17, (112 + 3 * 8)(1) -+ std 18, (112 + 4 * 8)(1) -+ std 19, (112 + 5 * 8)(1) -+ std 20, (112 + 6 * 8)(1) -+ std 21, (112 + 7 * 8)(1) -+ std 22, (112 + 8 * 8)(1) -+ std 23, (112 + 9 * 8)(1) -+ std 24, (112 + 10 * 8)(1) -+ std 25, (112 + 11 * 8)(1) -+ std 26, (112 + 12 * 8)(1) -+ std 27, (112 + 13 * 8)(1) -+ std 28, (112 + 14 * 8)(1) -+ std 29, (112 + 15 * 8)(1) -+ std 30, (112 + 16 * 8)(1) -+ std 31, (112 + 17 * 8)(1) -+ -+ /* Save r3-r10 in parameter save area of caller */ -+ std 3, (256 + 48 + 0 * 8)(1) -+ std 4, (256 + 48 + 1 * 8)(1) -+ std 5, (256 + 48 + 2 * 8)(1) -+ std 6, (256 + 48 + 3 * 8)(1) -+ std 7, (256 + 48 + 4 * 8)(1) -+ std 8, (256 + 48 + 5 * 8)(1) -+ std 9, (256 + 48 + 6 * 8)(1) -+ std 10, (256 + 48 + 7 * 8)(1) -+ -+ /* Save r2 in TOC save area */ -+ std 2, 40(1) -+ -+ /* Do not save r11, r12 and r13. */ -+ -+ /* Call delegate: -+ * r3: pointer to context -+ * r4: pointer to stack -+ */ -+ mr 5, 4 -+ mr 4, 1 -+ ld 6, 0(5) -+ ld 11, 16(5) -+ ld 2, 8(5) -+ mtctr 6 -+ bctrl -+ nop -+ -+ /* Restore r2 from TOC save area */ -+ ld 2, 40(1) -+ -+ /* Restore r3-r10 from local variable space */ -+ ld 3, (256 + 48 + 0 * 8)(1) -+ ld 4, (256 + 48 + 1 * 8)(1) -+ ld 5, (256 + 48 + 2 * 8)(1) -+ ld 6, (256 + 48 + 3 * 8)(1) -+ ld 7, (256 + 48 + 4 * 8)(1) -+ ld 8, (256 + 48 + 5 * 8)(1) -+ ld 9, (256 + 48 + 6 * 8)(1) -+ ld 10, (256 + 48 + 7 * 8)(1) -+ -+ /* Restore r14-r31 from general register save area */ -+ ld 14, (112 + 0 * 8)(1) -+ ld 15, (112 + 1 * 8)(1) -+ ld 16, (112 + 2 * 8)(1) -+ ld 17, (112 + 3 * 8)(1) -+ ld 18, (112 + 4 * 8)(1) -+ ld 19, (112 + 5 * 8)(1) -+ ld 20, (112 + 6 * 8)(1) -+ ld 21, (112 + 7 * 8)(1) -+ ld 22, (112 + 8 * 8)(1) -+ ld 23, (112 + 9 * 8)(1) -+ ld 24, (112 + 10 * 8)(1) -+ ld 25, (112 + 11 * 8)(1) -+ ld 26, (112 + 12 * 8)(1) -+ ld 27, (112 + 13 * 8)(1) -+ ld 28, (112 + 14 * 8)(1) -+ ld 29, (112 + 15 * 8)(1) -+ ld 30, (112 + 16 * 8)(1) -+ ld 31, (112 + 17 * 8)(1) -+ -+ addi 1, 1, 256 -+ ld 0, 16(1) -+ mtlr 0 -+ blr -+ .long 0 -+ .quad 0 -+.Lend: -+ .size _D4core6thread18callWithStackShellFMDFPvZvZv, .Lend-.L._D4core6thread18callWithStackShellFMDFPvZvZv -+ .cfi_endproc -+ -+#elif defined( __ppc__ ) || defined( __PPC__ ) || defined( __powerpc__ ) - - - /** -@@ -214,4 +332,80 @@ fiber_switchContext: - - jr $ra // return - -+#elif defined(__arm__) && defined(__ARM_EABI__) -+/************************************************************************************ -+ * ARM ASM BITS -+ ************************************************************************************/ -+ -+/** -+ * Performs a context switch. -+ * -+ * Parameters: -+ * r0 - void** - ptr to old stack pointer -+ * r1 - void* - new stack pointer -+ * -+ * ARM EABI registers: -+ * r0-r3 : argument/scratch registers -+ * r4-r10 : callee-save registers -+ * r11 : frame pointer (or a callee save register if fp isn't needed) -+ * r12 =ip : inter procedure register. We can treat it like any other scratch register -+ * r13 =sp : stack pointer -+ * r14 =lr : link register, it contains the return address (belonging to the function which called us) -+ * r15 =pc : program counter -+ * -+ * For floating point registers: -+ * According to AAPCS (version 2.09, section 5.1.2) only the d8-d15 registers need to be preserved -+ * across method calls. This applies to all ARM FPU variants, whether they have 16 or 32 double registers -+ * NEON support or not, half-float support or not and so on does not matter. -+ * -+ * Note: If this file was compiled with -mfloat-abi=soft but the code runs on a softfp system with fpu the d8-d15 -+ * registers won't be saved (we do not know that the system has got a fpu in that case) but the registers might actually -+ * be used by other code if it was compiled with -mfloat-abi=softfp. -+ * -+ * Interworking is only supported on ARMv5+, not on ARM v4T as ARM v4t requires special stubs when changing -+ * from thumb to arm mode or the other way round. -+ */ -+ -+.text -+.align 2 -+.global fiber_switchContext -+.type fiber_switchContext, %function -+fiber_switchContext: -+ .fnstart -+ push {r4-r11} -+ // update the oldp pointer. Link register and floating point registers stored later to prevent the GC from -+ // scanning them. -+ str sp, [r0] -+ // push r0 (or any other register) as well to keep stack 8byte aligned -+ push {r0, lr} -+ -+ #if defined(__ARM_PCS_VFP) || (defined(__ARM_PCS) && !defined(__SOFTFP__)) // ARM_HardFloat || ARM_SoftFP -+ vpush {d8-d15} -+ // now switch over to the new stack. Need to subtract (8*8[d8-d15]+2*4[r0, lr]) to position stack pointer -+ // below the last saved register. Remember we saved the SP before pushing [r0, lr, d8-d15] -+ sub sp, r1, #72 -+ vpop {d8-d15} -+ #else -+ sub sp, r1, #8 -+ #endif -+ -+ // we don't really care about r0, we only used that for padding. -+ // r1 is now what used to be in the link register when saving. -+ pop {r0, r1, r4-r11} -+ /** -+ * The link register for the initial jump to fiber_entryPoint must be zero: The jump actually -+ * looks like a normal method call as we jump to the start of the fiber_entryPoint function. -+ * Although fiber_entryPoint never returns and therefore never accesses lr, it saves lr to the stack. -+ * ARM unwinding will then look at the stack, find lr and think that fiber_entryPoint was called by -+ * the function in lr! So if we have some address in lr the unwinder will try to continue stack unwinding, -+ * although it's already at the stack base and crash. -+ * In all other cases the content of lr doesn't matter. -+ * Note: If we simply loaded into lr above and then moved lr into pc, the initial method call -+ * to fiber_entryPoint would look as if it was called from fiber_entryPoint itself, as the fiber_entryPoint -+ * address is in lr on the initial context switch. -+ */ -+ mov lr, #0 -+ // return by writing lr into pc -+ mov pc, r1 -+ .fnend - #endif ---- a/src/libphobos/libdruntime/core/thread.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/thread.d 2014-04-01 16:32:51.000000000 +0100 -@@ -13,6 +13,7 @@ module core.thread; - - - public import core.time; // for Duration -+import core.exception : onOutOfMemoryError; - static import rt.tlsgc; - - // this should be true for most architectures -@@ -48,12 +49,12 @@ else version (Windows) - */ - class ThreadException : Exception - { -- this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - super(msg, file, line, next); - } - -- this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) -+ @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) - { - super(msg, file, line, next); - } -@@ -65,12 +66,12 @@ class ThreadException : Exception - */ - class FiberException : Exception - { -- this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - super(msg, file, line, next); - } - -- this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) -+ @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) - { - super(msg, file, line, next); - } -@@ -125,40 +126,6 @@ version( Windows ) - extern (Windows) alias uint function(void*) btex_fptr; - extern (C) uintptr_t _beginthreadex(void*, uint, btex_fptr, void*, uint, uint*); - -- version( DigitalMars ) -- { -- version (Win32) -- { -- // NOTE: The memory between the addresses of _tlsstart and _tlsend -- // is the storage for thread-local data in D 2.0. Both of -- // these are defined in dm\src\win32\tlsseg.asm by DMC. -- extern (C) -- { -- extern int _tlsstart; -- extern int _tlsend; -- } -- } -- version (Win64) -- { -- // NOTE: The memory between the addresses of _tls_start and _tls_end -- // is the storage for thread-local data in D 2.0. Both of -- // these are defined in LIBCMT:tlssub.obj -- extern (C) -- { -- extern int _tls_start; -- extern int _tls_end; -- } -- alias _tls_start _tlsstart; -- alias _tls_end _tlsend; -- } -- } -- else -- { -- __gshared int _tlsstart; -- alias _tlsstart _tlsend; -- } -- -- - // - // Entry point for Windows threads - // -@@ -170,10 +137,7 @@ version( Windows ) - assert( obj.m_curr is &obj.m_main ); - obj.m_main.bstack = getStackBottom(); - obj.m_main.tstack = obj.m_main.bstack; -- -- void* pstart = cast(void*) &_tlsstart; -- void* pend = cast(void*) &_tlsend; -- obj.m_tls = pstart[0 .. pend - pstart]; -+ obj.m_tlsgcdata = rt.tlsgc.init(); - - Thread.setThis( obj ); - //Thread.add( obj ); -@@ -182,7 +146,6 @@ version( Windows ) - Thread.remove( obj ); - } - Thread.add( &obj.m_main ); -- obj.m_tlsgcdata = rt.tlsgc.init(); - - // NOTE: No GC allocations may occur until the stack pointers have - // been set and Thread.getThis returns a valid reference to -@@ -266,81 +229,37 @@ else version( Posix ) - version( GNU ) - { - import gcc.builtins; -- } - -- version( DigitalMars ) -- { -- version( linux ) -- { -- extern (C) -- { -- extern int _tlsstart; -- extern int _tlsend; -- } -- } -- else version( OSX ) -- { -- extern (C) -- { -- __gshared void[][2] _tls_data_array; -- } -- } -- else version( FreeBSD ) -- { -- extern (C) -- { -- extern void* _tlsstart; -- extern void* _tlsend; -- } -- } -- else -- { -- __gshared int _tlsstart; -- alias _tlsstart _tlsend; -- } -- } -- else version( GNU ) -- { - extern (C) - { -- extern int _tlsstart; -- extern int _tlsend; -+ extern size_t _tlsstart; -+ extern size_t _tlsend; - } - } -- else -- { -- __gshared int _tlsstart; -- alias _tlsstart _tlsend; -- } -- - - // - // Entry point for POSIX threads - // - extern (C) void* thread_entryPoint( void* arg ) - { -- Thread obj = cast(Thread) arg; -+ version (Shared) -+ { -+ import rt.sections; -+ Thread obj = cast(Thread)(cast(void**)arg)[0]; -+ auto loadedLibraries = (cast(void**)arg)[1]; -+ .free(arg); -+ } -+ else -+ { -+ Thread obj = cast(Thread)arg; -+ } - assert( obj ); - - assert( obj.m_curr is &obj.m_main ); - obj.m_main.bstack = getStackBottom(); - obj.m_main.tstack = obj.m_main.bstack; -- -- version (OSX) -- { -- // NOTE: OSX does not support TLS, so we do it ourselves. The TLS -- // data output by the compiler is bracketed by _tls_data_array[2], -- // so make a copy of it for each thread. -- const sz0 = (_tls_data_array[0].length + 15) & ~cast(size_t)15; -- const sz2 = sz0 + _tls_data_array[1].length; -- auto p = malloc( sz2 ); -- assert( p ); -- obj.m_tls = p[0 .. sz2]; -- memcpy( p, _tls_data_array[0].ptr, _tls_data_array[0].length ); -- memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length ); -- scope (exit) { free( p ); obj.m_tls = null; } -- } -- else -+ obj.m_tlsgcdata = rt.tlsgc.init(); -+ version (GNU) - { - auto pstart = cast(void*) &_tlsstart; - auto pend = cast(void*) &_tlsend; -@@ -359,7 +278,6 @@ else version( Posix ) - obj.m_isRunning = false; - } - Thread.add( &obj.m_main ); -- obj.m_tlsgcdata = rt.tlsgc.init(); - - static extern (C) void thread_cleanupHandler( void* arg ) nothrow - { -@@ -419,6 +337,7 @@ else version( Posix ) - - try - { -+ version (Shared) inheritLoadedLibraries(loadedLibraries); - rt_moduleTlsCtor(); - try - { -@@ -429,6 +348,7 @@ else version( Posix ) - append( t ); - } - rt_moduleTlsDtor(); -+ version (Shared) cleanupLoadedLibraries(); - } - catch( Throwable t ) - { -@@ -741,8 +661,26 @@ class Thread - m_isRunning = true; - scope( failure ) m_isRunning = false; - -- if( pthread_create( &m_addr, &attr, &thread_entryPoint, cast(void*) this ) != 0 ) -- throw new ThreadException( "Error creating thread" ); -+ version (Shared) -+ { -+ import rt.sections; -+ auto libs = pinLoadedLibraries(); -+ auto ps = cast(void**).malloc(2 * size_t.sizeof); -+ if (ps is null) onOutOfMemoryError(); -+ ps[0] = cast(void*)this; -+ ps[1] = cast(void*)libs; -+ if( pthread_create( &m_addr, &attr, &thread_entryPoint, ps ) != 0 ) -+ { -+ unpinLoadedLibraries(libs); -+ .free(ps); -+ throw new ThreadException( "Error creating thread" ); -+ } -+ } -+ else -+ { -+ if( pthread_create( &m_addr, &attr, &thread_entryPoint, cast(void*) this ) != 0 ) -+ throw new ThreadException( "Error creating thread" ); -+ } - } - version( OSX ) - { -@@ -934,13 +872,22 @@ class Thread - /** - * The maximum scheduling priority that may be set for a thread. On - * systems where multiple scheduling policies are defined, this value -- * represents the minimum valid priority for the scheduling policy of -+ * represents the maximum valid priority for the scheduling policy of - * the process. - */ - __gshared const int PRIORITY_MAX; - - - /** -+ * The default scheduling priority that is set for a thread. On -+ * systems where multiple scheduling policies are defined, this value -+ * represents the default priority for the scheduling policy of -+ * the process. -+ */ -+ __gshared const int PRIORITY_DEFAULT; -+ -+ -+ /** - * Gets the scheduling priority for the associated thread. - * - * Returns: -@@ -971,6 +918,12 @@ class Thread - * val = The new scheduling priority of this thread. - */ - final @property void priority( int val ) -+ in -+ { -+ assert(val >= PRIORITY_MIN); -+ assert(val <= PRIORITY_MAX); -+ } -+ body - { - version( Windows ) - { -@@ -979,23 +932,42 @@ class Thread - } - else version( Posix ) - { -- // NOTE: pthread_setschedprio is not implemented on linux, so use -- // the more complicated get/set sequence below. -- //if( pthread_setschedprio( m_addr, val ) ) -- // throw new ThreadException( "Unable to set thread priority" ); -- -- int policy; -- sched_param param; -- -- if( pthread_getschedparam( m_addr, &policy, ¶m ) ) -- throw new ThreadException( "Unable to set thread priority" ); -- param.sched_priority = val; -- if( pthread_setschedparam( m_addr, policy, ¶m ) ) -- throw new ThreadException( "Unable to set thread priority" ); -+ static if( __traits( compiles, pthread_setschedprio ) ) -+ { -+ if( pthread_setschedprio( m_addr, val ) ) -+ throw new ThreadException( "Unable to set thread priority" ); -+ } -+ else -+ { -+ // NOTE: pthread_setschedprio is not implemented on OSX or FreeBSD, so use -+ // the more complicated get/set sequence below. -+ int policy; -+ sched_param param; -+ -+ if( pthread_getschedparam( m_addr, &policy, ¶m ) ) -+ throw new ThreadException( "Unable to set thread priority" ); -+ param.sched_priority = val; -+ if( pthread_setschedparam( m_addr, policy, ¶m ) ) -+ throw new ThreadException( "Unable to set thread priority" ); -+ } - } - } - - -+ unittest -+ { -+ auto thr = Thread.getThis(); -+ immutable prio = thr.priority; -+ scope (exit) thr.priority = prio; -+ -+ assert(prio == PRIORITY_DEFAULT); -+ assert(prio >= PRIORITY_MIN && prio <= PRIORITY_MAX); -+ thr.priority = PRIORITY_MIN; -+ assert(thr.priority == PRIORITY_MIN); -+ thr.priority = PRIORITY_MAX; -+ assert(thr.priority == PRIORITY_MAX); -+ } -+ - /////////////////////////////////////////////////////////////////////////// - // Actions on Calling Thread - /////////////////////////////////////////////////////////////////////////// -@@ -1031,6 +1003,10 @@ class Thread - { - auto maxSleepMillis = dur!("msecs")( uint.max - 1 ); - -+ // avoid a non-zero time to be round down to 0 -+ if( val > dur!"msecs"( 0 ) && val < dur!"msecs"( 1 ) ) -+ val = dur!"msecs"( 1 ); -+ - // NOTE: In instances where all other threads in the process have a - // lower priority than the current thread, the current thread - // will not yield with a sleep time of zero. However, unlike -@@ -1074,41 +1050,6 @@ class Thread - - - /** -- * $(RED Deprecated. It will be removed in December 2012. Please use the -- * version which takes a $(D Duration) instead.) -- * -- * Suspends the calling thread for at least the supplied period. This may -- * result in multiple OS calls if period is greater than the maximum sleep -- * duration supported by the operating system. -- * -- * Params: -- * period = The minimum duration the calling thread should be suspended, -- * in 100 nanosecond intervals. -- * -- * In: -- * period must be non-negative. -- * -- * Example: -- * ------------------------------------------------------------------------ -- * -- * Thread.sleep( 500_000 ); // sleep for 50 milliseconds -- * Thread.sleep( 50_000_000 ); // sleep for 5 seconds -- * -- * ------------------------------------------------------------------------ -- */ -- deprecated("Please use the overload of sleep which takes a Duration.") -- static void sleep( long period ) -- in -- { -- assert( period >= 0 ); -- } -- body -- { -- sleep( dur!"hnsecs"( period ) ); -- } -- -- -- /** - * Forces a context switch to occur away from the calling thread. - */ - static void yield() -@@ -1138,30 +1079,7 @@ class Thread - // NOTE: This function may not be called until thread_init has - // completed. See thread_suspendAll for more information - // on why this might occur. -- version( Windows ) -- { -- auto t = cast(Thread) TlsGetValue( sm_this ); -- -- // NOTE: If this thread was attached via thread_attachByAddr then -- // this TLS lookup won't initially be set, so when the TLS -- // lookup fails, try an exhaustive search. -- if( t is null ) -- { -- t = thread_findByAddr( GetCurrentThreadId() ); -- setThis( t ); -- } -- return t; -- } -- else version( Posix ) -- { -- auto t = cast(Thread) pthread_getspecific( sm_this ); -- -- // NOTE: See the comment near thread_findByAddr() for why the -- // secondary thread_findByAddr lookup can't be done on -- // Posix. However, because thread_attachByAddr() is for -- // Windows only, the secondary lookup is pointless anyway. -- return t; -- } -+ return sm_this; - } - - -@@ -1229,8 +1147,9 @@ class Thread - { - version( Windows ) - { -- PRIORITY_MIN = -15; -- PRIORITY_MAX = 15; -+ PRIORITY_MIN = THREAD_PRIORITY_IDLE; -+ PRIORITY_DEFAULT = THREAD_PRIORITY_NORMAL; -+ PRIORITY_MAX = THREAD_PRIORITY_TIME_CRITICAL; - } - else version( Posix ) - { -@@ -1244,6 +1163,8 @@ class Thread - PRIORITY_MIN = sched_get_priority_min( policy ); - assert( PRIORITY_MIN != -1 ); - -+ PRIORITY_DEFAULT = param.sched_priority; -+ - PRIORITY_MAX = sched_get_priority_max( policy ); - assert( PRIORITY_MAX != -1 ); - } -@@ -1265,23 +1186,7 @@ private: - m_call = Call.NO; - m_curr = &m_main; - -- version (OSX) -- { -- //printf("test2 %p %p\n", _tls_data_array[0].ptr, &_tls_data_array[1][length]); -- //printf("test2 %p %p\n", &_tls_beg, &_tls_end); -- // NOTE: OSX does not support TLS, so we do it ourselves. The TLS -- // data output by the compiler is bracketed by _tls_data_array2], -- // so make a copy of it for each thread. -- const sz0 = (_tls_data_array[0].length + 15) & ~cast(size_t)15; -- const sz2 = sz0 + _tls_data_array[1].length; -- auto p = malloc( sz2 ); -- assert( p ); -- m_tls = p[0 .. sz2]; -- memcpy( p, _tls_data_array[0].ptr, _tls_data_array[0].length ); -- memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length ); -- // The free must happen at program end, if anywhere. -- } -- else -+ version (GNU) - { - auto pstart = cast(void*) &_tlsstart; - auto pend = cast(void*) &_tlsend; -@@ -1340,7 +1245,7 @@ private: - // - // Local storage - // -- __gshared TLSKey sm_this; -+ static Thread sm_this; - - - // -@@ -1389,14 +1294,7 @@ private: - // - static void setThis( Thread t ) - { -- version( Windows ) -- { -- TlsSetValue( sm_this, cast(void*) t ); -- } -- else version( Posix ) -- { -- pthread_setspecific( sm_this, cast(void*) t ); -- } -+ sm_this = t; - } - - -@@ -1455,7 +1353,10 @@ private: - Context m_main; - Context* m_curr; - bool m_lock; -- void[] m_tls; // spans implicit thread local storage -+ version (GNU) -+ { -+ void[] m_tls; // spans implicit thread local storage -+ } - rt.tlsgc.Data* m_tlsgcdata; - - version( Windows ) -@@ -1533,21 +1434,29 @@ private: - // - @property static Mutex slock() - { -- __gshared Mutex m; -- __gshared byte[__traits(classInstanceSize, Mutex)] ms; -+ return cast(Mutex)_locks[0].ptr; -+ } - -- if (m is null) -- { -- // Initialization doesn't need to be synchronized because -- // creating a thread will lock this mutex. -- ms[] = Mutex.classinfo.init[]; -- m = cast(Mutex)ms.ptr; -- m.__ctor(); -+ @property static Mutex criticalRegionLock() -+ { -+ return cast(Mutex)_locks[1].ptr; -+ } -+ -+ __gshared byte[__traits(classInstanceSize, Mutex)][2] _locks; - -- extern(C) void destroy() { m.__dtor(); } -- atexit(&destroy); -+ static void initLocks() -+ { -+ foreach (ref lock; _locks) -+ { -+ lock[] = Mutex.classinfo.init[]; -+ (cast(Mutex)lock.ptr).__ctor(); - } -- return m; -+ } -+ -+ static void termLocks() -+ { -+ foreach (ref lock; _locks) -+ (cast(Mutex)lock.ptr).__dtor(); - } - - __gshared Context* sm_cbeg; -@@ -1742,8 +1651,10 @@ private: - } - - // These must be kept in sync with core/thread.di --version (D_LP64) -+version (GNU) - { -+ version (D_LP64) -+ { - version (Windows) - static assert(__traits(classInstanceSize, Thread) == 312); - else version (OSX) -@@ -1753,6 +1664,35 @@ version (D_LP64) - else version (Posix) - static assert(__traits(classInstanceSize, Thread) == 184); - else -+ static assert(0, "Platform not supported."); -+ } -+ else -+ { -+ static assert((void*).sizeof == 4); // 32-bit -+ -+ version (Windows) -+ static assert(__traits(classInstanceSize, Thread) == 128); -+ else version (OSX) -+ static assert(__traits(classInstanceSize, Thread) == 128); -+ else version (Posix) -+ static assert(__traits(classInstanceSize, Thread) == 92); -+ else -+ static assert(0, "Platform not supported."); -+ -+ } -+} -+else -+version (D_LP64) -+{ -+ version (Windows) -+ static assert(__traits(classInstanceSize, Thread) == 296); -+ else version (OSX) -+ static assert(__traits(classInstanceSize, Thread) == 304); -+ else version (Solaris) -+ static assert(__traits(classInstanceSize, Thread) == 160); -+ else version (Posix) -+ static assert(__traits(classInstanceSize, Thread) == 168); -+ else - static assert(0, "Platform not supported."); - } - else -@@ -1760,11 +1700,11 @@ else - static assert((void*).sizeof == 4); // 32-bit - - version (Windows) -- static assert(__traits(classInstanceSize, Thread) == 128); -+ static assert(__traits(classInstanceSize, Thread) == 120); - else version (OSX) -- static assert(__traits(classInstanceSize, Thread) == 128); -+ static assert(__traits(classInstanceSize, Thread) == 120); - else version (Posix) -- static assert(__traits(classInstanceSize, Thread) == 92); -+ static assert(__traits(classInstanceSize, Thread) == 84); - else - static assert(0, "Platform not supported."); - } -@@ -1822,17 +1762,10 @@ extern (C) void thread_init() - // exist to be scanned at this point, it is sufficient for these - // functions to detect the condition and return immediately. - -- version( Windows ) -- { -- Thread.sm_this = TlsAlloc(); -- assert( Thread.sm_this != TLS_OUT_OF_INDEXES ); -- } -- else version( OSX ) -- { -- int status; -+ Thread.initLocks(); - -- status = pthread_key_create( &Thread.sm_this, null ); -- assert( status == 0 ); -+ version( OSX ) -+ { - } - else version( Posix ) - { -@@ -1876,15 +1809,22 @@ extern (C) void thread_init() - - status = sem_init( &suspendCount, 0, 0 ); - assert( status == 0 ); -- -- status = pthread_key_create( &Thread.sm_this, null ); -- assert( status == 0 ); - } - Thread.sm_main = thread_attachThis(); - } - - - /** -+ * Terminates the thread module. No other thread routine may be called -+ * afterwards. -+ */ -+extern (C) void thread_term() -+{ -+ Thread.termLocks(); -+} -+ -+ -+/** - * - */ - extern (C) bool thread_isMainThread() -@@ -1924,6 +1864,7 @@ extern (C) Thread thread_attachThis() - thisThread.m_isRunning = true; - } - thisThread.m_isDaemon = true; -+ thisThread.m_tlsgcdata = rt.tlsgc.init(); - Thread.setThis( thisThread ); - - version( OSX ) -@@ -1932,23 +1873,7 @@ extern (C) Thread thread_attachThis() - assert( thisThread.m_tmach != thisThread.m_tmach.init ); - } - -- version (OSX) -- { -- //printf("test3 %p %p\n", _tls_data_array[0].ptr, &_tls_data_array[1][length]); -- //printf("test3 %p %p\n", &_tls_beg, &_tls_end); -- // NOTE: OSX does not support TLS, so we do it ourselves. The TLS -- // data output by the compiler is bracketed by _tls_data_array[2], -- // so make a copy of it for each thread. -- const sz0 = (_tls_data_array[0].length + 15) & ~cast(size_t)15; -- const sz2 = sz0 + _tls_data_array[1].length; -- auto p = gc_malloc( sz2 ); -- assert( p ); -- thisThread.m_tls = p[0 .. sz2]; -- memcpy( p, _tls_data_array[0].ptr, _tls_data_array[0].length ); -- memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length ); -- // used gc_malloc so no need to free -- } -- else -+ version (GNU) - { - auto pstart = cast(void*) &_tlsstart; - auto pend = cast(void*) &_tlsend; -@@ -1959,7 +1884,6 @@ extern (C) Thread thread_attachThis() - Thread.add( thisContext ); - if( Thread.sm_main !is null ) - multiThreadedFlag = true; -- thisThread.m_tlsgcdata = rt.tlsgc.init(); - return thisThread; - } - -@@ -1999,44 +1923,44 @@ version( Windows ) - thisContext.bstack = bstack; - thisContext.tstack = thisContext.bstack; - -- if( addr == GetCurrentThreadId() ) -- { -- thisThread.m_hndl = GetCurrentThreadHandle(); -- } -- else -- { -- thisThread.m_hndl = OpenThreadHandle( addr ); -- } -- - thisThread.m_isDaemon = true; - - if( addr == GetCurrentThreadId() ) - { -- auto pstart = cast(void*) &_tlsstart; -- auto pend = cast(void*) &_tlsend; -- thisThread.m_tls = pstart[0 .. pend - pstart]; -+ thisThread.m_hndl = GetCurrentThreadHandle(); -+ thisThread.m_tlsgcdata = rt.tlsgc.init(); -+ version (GNU) -+ { -+ auto pstart = cast(void*) &_tlsstart; -+ auto pend = cast(void*) &_tlsend; -+ thisThread.m_tls = pstart[0 .. pend - pstart]; -+ } - Thread.setThis( thisThread ); - } - else - { -- // TODO: This seems wrong. If we're binding threads from -- // a DLL, will they always have space reserved for -- // the TLS chunk we expect? I don't know Windows -- // well enough to say. -- auto pstart = cast(void*) &_tlsstart; -- auto pend = cast(void*) &_tlsend; -- auto pos = GetTlsDataAddress( thisThread.m_hndl ); -- if( pos ) // on x64, threads without TLS happen to exist -- thisThread.m_tls = pos[0 .. pend - pstart]; -- else -- thisThread.m_tls = []; -+ thisThread.m_hndl = OpenThreadHandle( addr ); -+ impersonate_thread(addr, -+ { -+ thisThread.m_tlsgcdata = rt.tlsgc.init(); -+ version (GNU) -+ { -+ auto pstart = cast(void*) &_tlsstart; -+ auto pend = cast(void*) &_tlsend; -+ auto pos = GetTlsDataAddress( thisThread.m_hndl ); -+ if( pos ) // on x64, threads without TLS happen to exist -+ thisThread.m_tls = pos[0 .. pend - pstart]; -+ else -+ thisThread.m_tls = []; -+ } -+ Thread.setThis( thisThread ); -+ }); - } - - Thread.add( thisThread ); - Thread.add( thisContext ); - if( Thread.sm_main !is null ) - multiThreadedFlag = true; -- thisThread.m_tlsgcdata = rt.tlsgc.init(); - return thisThread; - } - } -@@ -2151,102 +2075,95 @@ shared static ~this() - // Used for needLock below. - private __gshared bool multiThreadedFlag = false; - -+version (PPC64) version = ExternStackShell; - --// Calls the given delegate, passing the current thread's stack pointer to it. --private void callWithStackShell(scope void delegate(void* sp) fn) --in -+version (ExternStackShell) - { -- assert(fn); -+ extern(D) public void callWithStackShell(scope void delegate(void* sp) fn); - } --body -+else - { -- // The purpose of the 'shell' is to ensure all the registers -- // get put on the stack so they'll be scanned -- void *sp; -- -- version (GNU) -+ // Calls the given delegate, passing the current thread's stack pointer to it. -+ private void callWithStackShell(scope void delegate(void* sp) fn) -+ in - { -- __builtin_unwind_init(); -- sp = & sp; -+ assert(fn); - } -- else version (D_InlineAsm_X86) -+ body - { -- asm -+ // The purpose of the 'shell' is to ensure all the registers get -+ // put on the stack so they'll be scanned. We only need to push -+ // the callee-save registers. -+ void *sp = void; -+ -+ version (GNU) - { -- pushad ; -- mov sp[EBP],ESP ; -+ __builtin_unwind_init(); -+ sp = &sp; - } -- } -- else version (D_InlineAsm_X86_64) -- { -- asm -+ else version (AsmX86_Posix) - { -- push RAX ; -- push RBX ; -- push RCX ; -- push RDX ; -- push RSI ; -- push RDI ; -- push RBP ; -- push R8 ; -- push R9 ; -- push R10 ; -- push R11 ; -- push R12 ; -- push R13 ; -- push R14 ; -- push R15 ; -- push RAX ; // 16 byte align the stack -- mov sp[RBP],RSP ; -+ size_t[3] regs = void; -+ asm -+ { -+ mov [regs + 0 * 4], EBX; -+ mov [regs + 1 * 4], ESI; -+ mov [regs + 2 * 4], EDI; -+ -+ mov sp[EBP], ESP; -+ } - } -- } -- else -- { -- static assert(false, "Architecture not supported."); -- } -+ else version (AsmX86_Windows) -+ { -+ size_t[3] regs = void; -+ asm -+ { -+ mov [regs + 0 * 4], EBX; -+ mov [regs + 1 * 4], ESI; -+ mov [regs + 2 * 4], EDI; - -- fn(sp); -+ mov sp[EBP], ESP; -+ } -+ } -+ else version (AsmX86_64_Posix) -+ { -+ size_t[5] regs = void; -+ asm -+ { -+ mov [regs + 0 * 8], RBX; -+ mov [regs + 1 * 8], R12; -+ mov [regs + 2 * 8], R13; -+ mov [regs + 3 * 8], R14; -+ mov [regs + 4 * 8], R15; - -- version (GNU) -- { -- // registers will be popped automatically -- } -- else version (D_InlineAsm_X86) -- { -- asm -+ mov sp[RBP], RSP; -+ } -+ } -+ else version (AsmX86_64_Windows) - { -- popad; -+ size_t[7] regs = void; -+ asm -+ { -+ mov [regs + 0 * 8], RBX; -+ mov [regs + 1 * 8], RSI; -+ mov [regs + 2 * 8], RDI; -+ mov [regs + 3 * 8], R12; -+ mov [regs + 4 * 8], R13; -+ mov [regs + 5 * 8], R14; -+ mov [regs + 6 * 8], R15; -+ -+ mov sp[RBP], RSP; -+ } - } -- } -- else version (D_InlineAsm_X86_64) -- { -- asm -+ else - { -- pop RAX ; // 16 byte align the stack -- pop R15 ; -- pop R14 ; -- pop R13 ; -- pop R12 ; -- pop R11 ; -- pop R10 ; -- pop R9 ; -- pop R8 ; -- pop RBP ; -- pop RDI ; -- pop RSI ; -- pop RDX ; -- pop RCX ; -- pop RBX ; -- pop RAX ; -+ static assert(false, "Architecture not supported."); - } -- } -- else -- { -- static assert(false, "Architecture not supported."); -+ -+ fn(sp); - } - } - -- - // Used for suspendAll/resumeAll below. - private __gshared uint suspendDepth = 0; - -@@ -2402,17 +2319,12 @@ private void suspend( Thread t ) - } - throw new ThreadException( "Unable to suspend thread" ); - } -- // NOTE: It's really not ideal to wait for each thread to -- // signal individually -- rather, it would be better to -- // suspend them all and wait once at the end. However, -- // semaphores don't really work this way, and the obvious -- // alternative (looping on an atomic suspend count) -- // requires either the atomic module (which only works on -- // x86) or other specialized functionality. It would -- // also be possible to simply loop on sem_wait at the -- // end, but I'm not convinced that this would be much -- // faster than the current approach. -- sem_wait( &suspendCount ); -+ while (sem_wait(&suspendCount) != 0) -+ { -+ if (errno != EINTR) -+ throw new ThreadException( "Unable to wait for semaphore" ); -+ errno = 0; -+ } - } - else if( !t.m_lock ) - { -@@ -2465,61 +2377,30 @@ extern (C) void thread_suspendAll() - // the same thread to be suspended twice, which would likely - // cause the second suspend to fail, the garbage collection to - // abort, and Bad Things to occur. -- for( Thread t = Thread.sm_tbeg; t; t = t.next ) -- { -- if( t.isRunning ) -- suspend( t ); -- else -- Thread.remove( t ); -- } - -- // The world is stopped. We now make sure that all threads are outside -- // critical regions by continually suspending and resuming them until all -- // of them are safe. This is extremely error-prone; if some thread enters -- // a critical region and never exits it (e.g. it waits for a mutex forever), -- // then we'll pretty much 'deadlock' here. Not much we can do about that, -- // and it indicates incorrect use of the critical region API anyway. -- for (;;) -- { -- uint unsafeCount; -- -- for (auto t = Thread.sm_tbeg; t; t = t.next) -- { -- // NOTE: We don't need to check whether the thread has died here, -- // since it's checked in the loops above and below. -- if (atomicLoad(*cast(shared)&t.m_isInCriticalRegion)) -- { -- unsafeCount += 10; -- resume(t); -- } -+ Thread.criticalRegionLock.lock(); -+ for (Thread t = Thread.sm_tbeg; t !is null; t = t.next) -+ { -+ Duration waittime = dur!"usecs"(10); -+ Lagain: -+ if (!t.isRunning) -+ { -+ Thread.remove(t); -+ } -+ else if (t.m_isInCriticalRegion) -+ { -+ Thread.criticalRegionLock.unlock(); -+ Thread.sleep(waittime); -+ if (waittime < dur!"msecs"(10)) waittime *= 2; -+ Thread.criticalRegionLock.lock(); -+ goto Lagain; - } -- -- // If all threads are safe (i.e. unsafeCount == 0), no threads were in -- // critical regions in the first place, and we can just break. Otherwise, -- // we sleep for a bit to give the threads a chance to get to safe points. -- if (unsafeCount) -- Thread.sleep(dur!"usecs"(unsafeCount)); // This heuristic could probably use some tuning. - else -- break; -- -- // Some thread was not in a safe region, so we suspend the world again to -- // re-do this loop to check whether we're safe now. -- for (auto t = Thread.sm_tbeg; t; t = t.next) -- { -- // The thread could have died in the meantime. Also see the note in -- // the topmost loop that initially suspends the world. -- if (t.isRunning) -- suspend(t); -- else -- Thread.remove(t); -+ { -+ suspend(t); - } - } -- -- version( Posix ) -- { -- // wait on semaphore -- see note in suspend for -- // why this is currently not implemented -- } -+ Thread.criticalRegionLock.unlock(); - } - } - -@@ -2699,16 +2580,17 @@ private void scanAllTypeImpl( scope Scan - - for( Thread t = Thread.sm_tbeg; t; t = t.next ) - { -- scan( ScanType.tls, t.m_tls.ptr, t.m_tls.ptr + t.m_tls.length ); -- - version( Windows ) - { - // Ideally, we'd pass ScanType.regs or something like that, but this - // would make portability annoying because it only makes sense on Windows. - scan( ScanType.stack, t.m_reg.ptr, t.m_reg.ptr + t.m_reg.length ); - } -+ version (GNU) -+ scan( ScanType.tls, t.m_tls.ptr, t.m_tls.ptr + t.m_tls.length ); - -- rt.tlsgc.scan(t.m_tlsgcdata, (p1, p2) => scan(ScanType.tls, p1, p2)); -+ if (t.m_tlsgcdata !is null) -+ rt.tlsgc.scan(t.m_tlsgcdata, (p1, p2) => scan(ScanType.tls, p1, p2)); - } - } - -@@ -2725,7 +2607,8 @@ in - } - body - { -- atomicStore(*cast(shared)&Thread.getThis().m_isInCriticalRegion, true); -+ synchronized (Thread.criticalRegionLock) -+ Thread.getThis().m_isInCriticalRegion = true; - } - - extern (C) void thread_exitCriticalRegion() -@@ -2735,7 +2618,8 @@ in - } - body - { -- atomicStore(*cast(shared)&Thread.getThis().m_isInCriticalRegion, false); -+ synchronized (Thread.criticalRegionLock) -+ Thread.getThis().m_isInCriticalRegion = false; - } - - extern (C) bool thread_inCriticalRegion() -@@ -2745,7 +2629,8 @@ in - } - body - { -- return atomicLoad(*cast(shared)&Thread.getThis().m_isInCriticalRegion); -+ synchronized (Thread.criticalRegionLock) -+ return Thread.getThis().m_isInCriticalRegion; - } - - unittest -@@ -2773,55 +2658,66 @@ unittest - // to cause a deadlock. - // NOTE: DO NOT USE LOCKS IN CRITICAL REGIONS IN NORMAL CODE. - -- import core.sync.condition; -+ import core.sync.semaphore; - -- bool critical; -- auto cond1 = new Condition(new Mutex()); -+ auto sema = new Semaphore(), -+ semb = new Semaphore(); - -- bool stop; -- auto cond2 = new Condition(new Mutex()); -- -- auto thr = new Thread(delegate void() -+ auto thr = new Thread( - { - thread_enterCriticalRegion(); -- - assert(thread_inCriticalRegion()); -- assert(atomicLoad(*cast(shared)&Thread.getThis().m_isInCriticalRegion)); -- -- synchronized (cond1.mutex) -- { -- critical = true; -- cond1.notify(); -- } -- -- synchronized (cond2.mutex) -- while (!stop) -- cond2.wait(); -+ sema.notify(); - -+ semb.wait(); - assert(thread_inCriticalRegion()); -- assert(atomicLoad(*cast(shared)&Thread.getThis().m_isInCriticalRegion)); - - thread_exitCriticalRegion(); -+ assert(!thread_inCriticalRegion()); -+ sema.notify(); - -+ semb.wait(); - assert(!thread_inCriticalRegion()); -- assert(!atomicLoad(*cast(shared)&Thread.getThis().m_isInCriticalRegion)); - }); - - thr.start(); - -- synchronized (cond1.mutex) -- while (!critical) -- cond1.wait(); -+ sema.wait(); -+ synchronized (Thread.criticalRegionLock) -+ assert(thr.m_isInCriticalRegion); -+ semb.notify(); -+ -+ sema.wait(); -+ synchronized (Thread.criticalRegionLock) -+ assert(!thr.m_isInCriticalRegion); -+ semb.notify(); -+ -+ thr.join(); -+} -+ -+unittest -+{ -+ import core.sync.semaphore; - -- assert(atomicLoad(*cast(shared)&thr.m_isInCriticalRegion)); -+ shared bool inCriticalRegion; -+ auto sem = new Semaphore(); - -- synchronized (cond2.mutex) -+ auto thr = new Thread( - { -- stop = true; -- cond2.notify(); -- } -+ thread_enterCriticalRegion(); -+ inCriticalRegion = true; -+ sem.notify(); -+ Thread.sleep(dur!"msecs"(1)); -+ inCriticalRegion = false; -+ thread_exitCriticalRegion(); -+ }); -+ thr.start(); - -- thr.join(); -+ sem.wait(); -+ assert(inCriticalRegion); -+ thread_suspendAll(); -+ assert(!inCriticalRegion); -+ thread_resumeAll(); - } - - /** -@@ -3151,6 +3047,13 @@ private - version = AsmExternal; - } - } -+ else version( PPC64 ) -+ { -+ version( Posix ) -+ { -+ version = AlignFiberStackTo16Byte; -+ } -+ } - else version( MIPS_O32 ) - { - version( Posix ) -@@ -3159,7 +3062,14 @@ private - version = AsmExternal; - } - } -- -+ else version( ARM ) -+ { -+ version( Posix ) -+ { -+ version = AsmARM_Posix; -+ version = AsmExternal; -+ } -+ } - - version( Posix ) - { -@@ -3244,7 +3154,7 @@ private - obj.switchOut(); - } - -- -+ // Look above the definition of 'class Fiber' for some information about the implementation of this routine - version( AsmExternal ) - extern (C) void fiber_switchContext( void** oldp, void* newp ); - else -@@ -3288,7 +3198,8 @@ private - pop EBP; - - // 'return' to complete switch -- ret; -+ pop ECX; -+ jmp ECX; - } - } - else version( AsmX86_64_Windows ) -@@ -3414,7 +3325,128 @@ private - /////////////////////////////////////////////////////////////////////////////// - // Fiber - /////////////////////////////////////////////////////////////////////////////// -- -+/* -+ * Documentation of Fiber internals: -+ * -+ * The main routines to implement when porting Fibers to new architectures are -+ * fiber_switchContext and initStack. Some version constants have to be defined -+ * for the new platform as well, search for "Fiber Platform Detection and Memory Allocation". -+ * These must be kept in sync with thread.di as well! You might also want to verify -+ * the Fiber size for the new platform in thread.d and thread.di. Search for -+ * "enum FiberSize" -+ * -+ * Fibers are based on a concept called 'Context'. A Context describes the execution -+ * state of a Fiber or main thread which is fully described by the stack, some -+ * registers and a return address at which the Fiber/Thread should continue executing. -+ * Please note that not only each Fiber has a Context, but each thread also has got a -+ * Context which describes the threads stack and state. If you call Fiber fib; fib.call -+ * the first time in a thread you switch from Threads Context into the Fibers Context. -+ * If you call fib.yield in that Fiber you switch out of the Fibers context and back -+ * into the Thread Context. (However, this is not always the case. You can call a Fiber -+ * from within another Fiber, then you switch Contexts between the Fibers and the Thread -+ * Context is not involved) -+ * -+ * In all current implementations the registers and the return address are actually -+ * saved on a Contexts stack. -+ * -+ * The fiber_switchContext routine has got two parameters: -+ * void** a: This is the _location_ where we have to store the current stack pointer, -+ * the stack pointer of the currently executing Context (Fiber or Thread). -+ * void* b: This is the pointer to the stack of the Context which we want to switch into. -+ * Note that we get the same pointer here as the one we stored into the void** a -+ * in a previous call to fiber_switchContext. -+ * -+ * In the simplest case, a fiber_switchContext rountine looks like this: -+ * fiber_switchContext: -+ * push {return Address} -+ * push {registers} -+ * copy {stack pointer} into {location pointed to by a} -+ * //We have now switch to the stack of a different Context! -+ * copy {b} into {stack pointer} -+ * pop {registers} -+ * pop {return Address} -+ * jump to {return Address} -+ * -+ * The GC uses the value returned in parameter a to scan the Fibers stack. It scans from -+ * the stack base to that value. As the GC dislikes false pointers we can actually optimize -+ * this a little: By storing registers which can not contain references to memory managed -+ * by the GC outside of the region marked by the stack base pointer and the stack pointer -+ * saved in fiber_switchContext we can prevent the GC from scanning them. -+ * Such registers are usually floating point registers and the return address. In order to -+ * implement this, we return a modified stack pointer from fiber_switchContext. However, -+ * we have to remember that when we restore the registers from the stack! -+ * -+ * --------------------------- <= Stack Base -+ * | Frame | <= Many other stack frames -+ * | Frame | -+ * |-------------------------| <= The last stack frame. This one is created by fiber_switchContext -+ * | registers with pointers | -+ * | | <= Stack pointer. GC stops scanning here -+ * | return address | -+ * |floating point registers | -+ * --------------------------- <= Real Stack End -+ * -+ * fiber_switchContext: -+ * push {registers with pointers} -+ * copy {stack pointer} into {location pointed to by a} -+ * push {return Address} -+ * push {Floating point registers} -+ * //We have now switch to the stack of a different Context! -+ * copy {b} into {stack pointer} -+ * //We now have to adjust the stack pointer to point to 'Real Stack End' so we can pop -+ * //the FP registers -+ * //+ or - depends on if your stack grows downwards or upwards -+ * {stack pointer} = {stack pointer} +- ({FPRegisters}.sizeof + {return address}.sizeof} -+ * pop {Floating point registers} -+ * pop {return Address} -+ * pop {registers with pointers} -+ * jump to {return Address} -+ * -+ * So the question now is which registers need to be saved? This depends on the specific -+ * architecture ABI of course, but here are some general guidelines: -+ * - If a register is callee-save (if the callee modifies the register it must saved and -+ * restored by the callee) it needs to be saved/restored in switchContext -+ * - If a register is caller-save it needn't be saved/restored. (Calling fiber_switchContext -+ * is a function call and the compiler therefore already must save these registers before -+ * calling fiber_switchContext) -+ * - Argument registers used for passing parameters to functions needn't be saved/restored -+ * - The return register needn't be saved/restored (fiber_switchContext hasn't got a return type) -+ * - All scratch registers needn't be saved/restored -+ * - The link register usually needn't be saved/restored (but sometimes it must be cleared - -+ * see below for details) -+ * - The frame pointer register - if it exists - is usually callee-save -+ * - All current implementations do not save control registers -+ * -+ * What happens on the first switch into a Fiber? We never saved a state for this fiber before, -+ * but the initial state is prepared in the initStack routine. (This routine will also be called -+ * when a Fiber is being resetted). initStack must produce exactly the same stack layout as the -+ * part of fiber_switchContext which saves the registers. Pay special attention to set the stack -+ * pointer correctly if you use the GC optimization mentioned before. the return Address saved in -+ * initStack must be the address of fiber_entrypoint. -+ * -+ * There's now a small but important difference between the first context switch into a fiber and -+ * further context switches. On the first switch, Fiber.call is used and the returnAddress in -+ * fiber_switchContext will point to fiber_entrypoint. The important thing here is that this jump -+ * is a _function call_, we call fiber_entrypoint by jumping before it's function prologue. On later -+ * calls, the user used yield() in a function, and therefore the return address points into a user -+ * function, after the yield call. So here the jump in fiber_switchContext is a _function return_, -+ * not a function call! -+ * -+ * The most important result of this is that on entering a function, i.e. fiber_entrypoint, we -+ * would have to provide a return address / set the link register once fiber_entrypoint -+ * returns. Now fiber_entrypoint does never return and therefore the actual value of the return -+ * address / link register is never read/used and therefore doesn't matter. When fiber_switchContext -+ * performs a _function return_ the value in the link register doesn't matter either. -+ * However, the link register will still be saved to the stack in fiber_entrypoint and some -+ * exception handling / stack unwinding code might read it from this stack location and crash. -+ * The exact solution depends on your architecture, but see the ARM implementation for a way -+ * to deal with this issue. -+ * -+ * The ARM implementation is meant to be used as a kind of documented example implementation. -+ * Look there for a concrete example. -+ * -+ * FIXME: fiber_entrypoint might benefit from a @noreturn attribute, but D doesn't have one. -+ */ - - /** - * This class provides a cooperative concurrency mechanism integrated with the -@@ -3428,6 +3460,18 @@ private - * executing. Like threads, a new fiber thread may be created using either - * derivation or composition, as in the following example. - * -+ * Warning: -+ * Status registers are not saved by the current implementations. This means -+ * floating point exception status bits (overflow, divide by 0), rounding mode -+ * and similar stuff is set per-thread, not per Fiber! -+ * -+ * Warning: -+ * On ARM FPU registers are not saved if druntime was compiled as ARM_SoftFloat. -+ * If such a build is used on a ARM_SoftFP system which actually has got a FPU -+ * and other libraries are using the FPU registers (other code is compiled -+ * as ARM_SoftFP) this can cause problems. Druntime must be compiled as -+ * ARM_SoftFP in this case. -+ * - * Example: - * ---------------------------------------------------------------------- - * -@@ -3611,15 +3655,12 @@ class Fiber - - - /** -- * Resets this fiber so that it may be re-used. This routine may only be -- * called for fibers that have terminated, as doing otherwise could result -- * in scope-dependent functionality that is not executed. Stack-based -- * classes, for example, may not be cleaned up properly if a fiber is reset -- * before it has terminated. -- * -- * Params: -- * fn = The fiber function. -- * dg = The fiber function. -+ * Resets this fiber so that it may be re-used, optionally with a -+ * new function/delegate. This routine may only be called for -+ * fibers that have terminated, as doing otherwise could result in -+ * scope-dependent functionality that is not executed. -+ * Stack-based classes, for example, may not be cleaned up -+ * properly if a fiber is reset before it has terminated. - * - * In: - * This fiber must be in state TERM. -@@ -3913,6 +3954,7 @@ private: - else - { - version (Posix) import core.sys.posix.sys.mman; // mmap -+ version (linux) import core.sys.linux.sys.mman : MAP_ANON; - - static if( __traits( compiles, mmap ) ) - { -@@ -4002,6 +4044,7 @@ private: - - // - // Initialize the allocated stack. -+ // Look above the definition of 'class Fiber' for some information about the implementation of this routine - // - final void initStack() - in -@@ -4223,6 +4266,38 @@ private: - pstack -= ABOVE; - *cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint; - } -+ else version( AsmARM_Posix ) -+ { -+ /* We keep the FP registers and the return address below -+ * the stack pointer, so they don't get scanned by the -+ * GC. The last frame before swapping the stack pointer is -+ * organized like the following. -+ * -+ * | |-----------|<= 'frame starts here' -+ * | | fp | (the actual frame pointer, r11 isn't -+ * | | r10-r4 | updated and still points to the previous frame) -+ * | |-----------|<= stack pointer -+ * | | lr | -+ * | | 4byte pad | -+ * | | d15-d8 |(if FP supported) -+ * | |-----------| -+ * Y -+ * stack grows down: The pointer value here is smaller than some lines above -+ */ -+ // frame pointer can be zero, r10-r4 also zero initialized -+ version( StackGrowsDown ) -+ pstack -= int.sizeof * 8; -+ else -+ static assert(false, "Only full descending stacks supported on ARM"); -+ -+ // link register -+ push( cast(size_t) &fiber_entryPoint ); -+ /* -+ * We do not push padding and d15-d8 as those are zero initialized anyway -+ * Position the stack pointer above the lr register -+ */ -+ pstack += int.sizeof * 1; -+ } - else static if( __traits( compiles, ucontext_t ) ) - { - getcontext( &m_utxt ); -@@ -4354,7 +4429,12 @@ version (D_LP64) - else version (OSX) - static assert(__traits(classInstanceSize, Fiber) == 88); - else version (Posix) -- static assert(__traits(classInstanceSize, Fiber) == 88); -+ { -+ static if( __traits( compiles, ucontext_t ) ) -+ static assert(__traits(classInstanceSize, Fiber) == 88 + ucontext_t.sizeof + 8); -+ else -+ static assert(__traits(classInstanceSize, Fiber) == 88); -+ } - else - static assert(0, "Platform not supported."); - } -@@ -4367,7 +4447,20 @@ else - else version (OSX) - static assert(__traits(classInstanceSize, Fiber) == 44); - else version (Posix) -- static assert(__traits(classInstanceSize, Fiber) == 44); -+ { -+ static if( __traits( compiles, ucontext_t ) ) -+ { -+ // ucontext_t might have an alignment larger than 4. -+ static roundUp()(size_t n) -+ { -+ return (n + (ucontext_t.alignof - 1)) & ~(ucontext_t.alignof - 1); -+ } -+ static assert(__traits(classInstanceSize, Fiber) == -+ roundUp(roundUp(44) + ucontext_t.sizeof + 4)); -+ } -+ else -+ static assert(__traits(classInstanceSize, Fiber) == 44); -+ } - else - static assert(0, "Platform not supported."); - } -@@ -4581,6 +4674,86 @@ unittest - expect(fib, "delegate"); - } - -+ -+// stress testing GC stack scanning -+unittest -+{ -+ import core.memory; -+ -+ static void unreferencedThreadObject() -+ { -+ static void sleep() { Thread.sleep(dur!"msecs"(100)); } -+ auto thread = new Thread(&sleep); -+ thread.start(); -+ } -+ unreferencedThreadObject(); -+ GC.collect(); -+ -+ static class Foo -+ { -+ this(int value) -+ { -+ _value = value; -+ } -+ -+ int bar() -+ { -+ return _value; -+ } -+ -+ int _value; -+ } -+ -+ static void collect() -+ { -+ auto foo = new Foo(2); -+ assert(foo.bar() == 2); -+ GC.collect(); -+ Fiber.yield(); -+ GC.collect(); -+ assert(foo.bar() == 2); -+ } -+ -+ auto fiber = new Fiber(&collect); -+ -+ fiber.call(); -+ GC.collect(); -+ fiber.call(); -+ -+ // thread reference -+ auto foo = new Foo(2); -+ -+ void collect2() -+ { -+ assert(foo.bar() == 2); -+ GC.collect(); -+ Fiber.yield(); -+ GC.collect(); -+ assert(foo.bar() == 2); -+ } -+ -+ fiber = new Fiber(&collect2); -+ -+ fiber.call(); -+ GC.collect(); -+ fiber.call(); -+ -+ static void recurse(size_t cnt) -+ { -+ --cnt; -+ Fiber.yield(); -+ if (cnt) -+ { -+ auto fib = new Fiber(() { recurse(cnt); }); -+ fib.call(); -+ GC.collect(); -+ fib.call(); -+ } -+ } -+ fiber = new Fiber(() { recurse(20); }); -+ fiber.call(); -+} -+ - } - - version( AsmX86_64_Posix ) -@@ -4601,38 +4774,3 @@ version( AsmX86_64_Posix ) - fib.call(); - } - } -- -- --version( OSX ) --{ -- // NOTE: The Mach-O object file format does not allow for thread local -- // storage declarations. So instead we roll our own by putting tls -- // into the sections bracketed by _tls_beg and _tls_end. -- // -- // This function is called by the code emitted by the compiler. It -- // is expected to translate an address into the TLS static data to -- // the corresponding address in the TLS dynamic per-thread data. -- extern (D) void* ___tls_get_addr( void* p ) -- { -- // NOTE: p is an address in the TLS static data emitted by the -- // compiler. If it isn't, something is disastrously wrong. -- auto obj = Thread.getThis(); -- -- immutable off0 = cast(size_t)(p - _tls_data_array[0].ptr); -- if (off0 < _tls_data_array[0].length) -- { -- return obj.m_tls.ptr + off0; -- } -- immutable off1 = cast(size_t)(p - _tls_data_array[1].ptr); -- if (off1 < _tls_data_array[1].length) -- { -- size_t sz = (_tls_data_array[0].length + 15) & ~cast(size_t)15; -- return obj.m_tls.ptr + sz + off1; -- } -- else -- assert(0); -- -- //assert( p >= cast(void*) &_tls_beg && p < cast(void*) &_tls_end ); -- //return obj.m_tls.ptr + (p - cast(void*) &_tls_beg); -- } --} ---- a/src/libphobos/libdruntime/core/thread.di 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/thread.di 2014-04-01 16:32:51.000000000 +0100 -@@ -53,8 +53,8 @@ else version (Windows) - */ - class ThreadException : Exception - { -- this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); -- this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); -+ @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); - } - - -@@ -63,8 +63,8 @@ class ThreadException : Exception - */ - class FiberException : Exception - { -- this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); -- this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null); -+ @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__); - } - - -@@ -263,13 +263,22 @@ class Thread - /** - * The maximum scheduling priority that may be set for a thread. On - * systems where multiple scheduling policies are defined, this value -- * represents the minimum valid priority for the scheduling policy of -+ * represents the maximum valid priority for the scheduling policy of - * the process. - */ - __gshared const int PRIORITY_MAX; - - - /** -+ * The default scheduling priority that is set for a thread. On -+ * systems where multiple scheduling policies are defined, this value -+ * represents the default priority for the scheduling policy of -+ * the process. -+ */ -+ __gshared const int PRIORITY_DEFAULT; -+ -+ -+ /** - * Gets the scheduling priority for the associated thread. - * - * Returns: -@@ -315,33 +324,6 @@ class Thread - - - /** -- * $(RED Deprecated. It will be removed in December 2012. Please use the -- * version which takes a $(D Duration) instead.) -- * -- * Suspends the calling thread for at least the supplied period. This may -- * result in multiple OS calls if period is greater than the maximum sleep -- * duration supported by the operating system. -- * -- * Params: -- * period = The minimum duration the calling thread should be suspended, -- * in 100 nanosecond intervals. -- * -- * In: -- * period must be non-negative. -- * -- * Example: -- * ------------------------------------------------------------------------ -- * -- * Thread.sleep( 500_000 ); // sleep for 50 milliseconds -- * Thread.sleep( 50_000_000 ); // sleep for 5 seconds -- * -- * ------------------------------------------------------------------------ -- */ -- deprecated("Please use the overload of sleep which takes a Duration.") -- static void sleep( long period ); -- -- -- /** - * Forces a context switch to occur away from the calling thread. - */ - static void yield(); -@@ -419,21 +401,42 @@ private: - } - - // These must be kept in sync with core/thread.d -+ version (GNU) -+ { -+ version (D_LP64) -+ { -+ version (Windows) enum ThreadSize = 312; -+ else version (OSX) enum ThreadSize = 320; -+ else version (Solaris) enum ThreadSize = 176; -+ else version (Posix) enum ThreadSize = 184; -+ else static assert(0, "Platform not supported."); -+ } -+ else -+ { -+ static assert((void*).sizeof == 4); // 32-bit -+ -+ version (Windows) enum ThreadSize = 128; -+ else version (OSX) enum ThreadSize = 128; -+ else version (Posix) enum ThreadSize = 92; -+ else static assert(0, "Platform not supported."); -+ } -+ } -+ else - version (D_LP64) - { -- version (Windows) enum ThreadSize = 312; -- else version (OSX) enum ThreadSize = 320; -- else version (Solaris) enum ThreadSize = 176; -- else version (Posix) enum ThreadSize = 184; -+ version (Windows) enum ThreadSize = 296; -+ else version (OSX) enum ThreadSize = 304; -+ else version (Solaris) enum ThreadSize = 160; -+ else version (Posix) enum ThreadSize = 168; - else static assert(0, "Platform not supported."); - } - else - { - static assert((void*).sizeof == 4); // 32-bit - -- version (Windows) enum ThreadSize = 128; -- else version (OSX) enum ThreadSize = 128; -- else version (Posix) enum ThreadSize = 92; -+ version (Windows) enum ThreadSize = 120; -+ else version (OSX) enum ThreadSize = 120; -+ else version (Posix) enum ThreadSize = 84; - else static assert(0, "Platform not supported."); - } - -@@ -455,6 +458,13 @@ extern (C) void thread_init(); - - - /** -+ * Terminates the thread module. No other thread routine may be called -+ * afterwards. -+ */ -+extern (C) void thread_term(); -+ -+ -+/** - * - */ - extern (C) bool thread_isMainThread(); -@@ -598,12 +608,10 @@ extern (C) void thread_scanAllType( scop - extern (C) void thread_scanAll( scope ScanAllThreadsFn scan ); - - --/* -+/** - * Signals that the code following this call is a critical region. Any code in - * this region must finish running before the calling thread can be suspended -- * by a call to thread_suspendAll. If the world is stopped while the calling -- * thread is in a critical region, it will be continually suspended and resumed -- * until it is outside a critical region. -+ * by a call to thread_suspendAll. - * - * This function is, in particular, meant to help maintain garbage collector - * invariants when a lock is not used. -@@ -611,10 +619,9 @@ extern (C) void thread_scanAll( scope Sc - * A critical region is exited with thread_exitCriticalRegion. - * - * $(RED Warning): -- * Using critical regions is extremely error-prone. For instance, using a lock -- * inside a critical region will most likely result in an application deadlocking -- * because the stop-the-world routine will attempt to suspend and resume the thread -- * forever, to no avail. -+ * Using critical regions is extremely error-prone. For instance, using locks -+ * inside a critical region can easily result in a deadlock when another thread -+ * holding the lock already got suspended. - * - * The term and concept of a 'critical region' comes from - * $(LINK2 https://github.com/mono/mono/blob/521f4a198e442573c400835ef19bbb36b60b0ebb/mono/metadata/sgen-gc.h#L925 Mono's SGen garbage collector). -@@ -625,7 +632,7 @@ extern (C) void thread_scanAll( scope Sc - extern (C) void thread_enterCriticalRegion(); - - --/* -+/** - * Signals that the calling thread is no longer in a critical region. Following - * a call to this function, the thread can once again be suspended. - * -@@ -635,7 +642,7 @@ extern (C) void thread_enterCriticalRegi - extern (C) void thread_exitCriticalRegion(); - - --/* -+/** - * Returns true if the current thread is in a critical region; otherwise, false. - * - * In: -@@ -798,6 +805,55 @@ private: - // Fiber Platform Detection and Memory Allocation - /////////////////////////////////////////////////////////////////////////////// - -+private -+{ -+ // These must be kept in sync with core/thread.d -+ version( D_InlineAsm_X86 ) -+ { -+ version( Windows ) -+ version = NoUcontext; -+ else version( Posix ) -+ version = NoUcontext; -+ } -+ else version( D_InlineAsm_X86_64 ) -+ { -+ version( Windows ) -+ version = NoUcontext; -+ else version( Posix ) -+ version = NoUcontext; -+ } -+ else version( PPC ) -+ { -+ version( Posix ) -+ version = NoUcontext; -+ } -+ else version( PPC64 ) -+ { -+ version( Posix ) -+ { -+ // uses ucontext_t. -+ } -+ } -+ else version( MIPS_O32 ) -+ { -+ version( Posix ) -+ version = NoUcontext; -+ } -+ else version( ARM ) -+ { -+ version( Posix ) -+ version = NoUcontext; -+ } -+ -+ version( Posix ) -+ { -+ version( NoUcontext ) {} else -+ { -+ import core.sys.posix.ucontext; -+ } -+ } -+} -+ - private extern __gshared const size_t PAGESIZE; - - shared static this(); -@@ -807,7 +863,6 @@ shared static this(); - // Fiber - /////////////////////////////////////////////////////////////////////////////// - -- - /** - * This class provides a cooperative concurrency mechanism integrated with the - * threading and garbage collection functionality. Calling a fiber may be -@@ -928,15 +983,12 @@ class Fiber - - - /** -- * Resets this fiber so that it may be re-used. This routine may only be -- * called for fibers that have terminated, as doing otherwise could result -- * in scope-dependent functionality that is not executed. Stack-based -- * classes, for example, may not be cleaned up properly if a fiber is reset -- * before it has terminated. -- * -- * Params: -- * fn = The fiber function. -- * dg = The fiber function. -+ * Resets this fiber so that it may be re-used, optionally with a -+ * new function/delegate. This routine may only be called for -+ * fibers that have terminated, as doing otherwise could result in -+ * scope-dependent functionality that is not executed. -+ * Stack-based classes, for example, may not be cleaned up -+ * properly if a fiber is reset before it has terminated. - * - * In: - * This fiber must be in state TERM. -@@ -1029,13 +1081,18 @@ class Fiber - } - - private: -- - // These must be kept in sync with core/thread.d - version (D_LP64) - { - version (Windows) enum FiberSize = 88; - else version (OSX) enum FiberSize = 88; -- else version (Posix) enum FiberSize = 88; -+ else version (Posix) -+ { -+ static if( __traits( compiles, ucontext_t ) ) -+ enum FiberSize = 88 + ucontext_t.sizeof + 8; -+ else -+ enum FiberSize = 88; -+ } - else static assert(0, "Platform not supported."); - } - else -@@ -1044,7 +1101,20 @@ private: - - version (Windows) enum FiberSize = 44; - else version (OSX) enum FiberSize = 44; -- else version (Posix) enum FiberSize = 44; -+ else version (Posix) -+ { -+ static if( __traits( compiles, ucontext_t ) ) -+ { -+ // ucontext_t might have an alignment larger than 4. -+ static roundUp()(size_t n) -+ { -+ return (n + (ucontext_t.alignof - 1)) & ~(ucontext_t.alignof - 1); -+ } -+ enum FiberSize = roundUp(roundUp(44) + ucontext_t.sizeof + 4); -+ } -+ else -+ enum FiberSize = 44; -+ } - else static assert(0, "Platform not supported."); - } - ---- a/src/libphobos/libdruntime/core/time.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/core/time.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1390,15 +1390,15 @@ Duration dur(string units)(long length) - return Duration(convert!(units, "hnsecs")(length)); - } - --alias dur!"weeks" weeks; /// Ditto --alias dur!"days" days; /// Ditto --alias dur!"hours" hours; /// Ditto --alias dur!"minutes" minutes; /// Ditto --alias dur!"seconds" seconds; /// Ditto --alias dur!"msecs" msecs; /// Ditto --alias dur!"usecs" usecs; /// Ditto --alias dur!"hnsecs" hnsecs; /// Ditto --alias dur!"nsecs" nsecs; /// Ditto -+alias weeks = dur!"weeks"; /// Ditto -+alias days = dur!"days"; /// Ditto -+alias hours = dur!"hours"; /// Ditto -+alias minutes = dur!"minutes"; /// Ditto -+alias seconds = dur!"seconds"; /// Ditto -+alias msecs = dur!"msecs"; /// Ditto -+alias usecs = dur!"usecs"; /// Ditto -+alias hnsecs = dur!"hnsecs"; /// Ditto -+alias nsecs = dur!"nsecs"; /// Ditto - - //Verify Examples. - unittest -@@ -1698,11 +1698,11 @@ struct TickDuration - { - foreach(T; _TypeTuple!(TickDuration, const TickDuration, immutable TickDuration)) - { -- assertApprox((cast(T)TickDuration).from!units(1000).to!(units, long)(), -+ assertApprox((cast(T)TickDuration.from!units(1000)).to!(units, long)(), - 500, 1500, units); -- assertApprox((cast(T)TickDuration).from!units(1_000_000).to!(units, long)(), -+ assertApprox((cast(T)TickDuration.from!units(1_000_000)).to!(units, long)(), - 900_000, 1_100_000, units); -- assertApprox((cast(T)TickDuration).from!units(2_000_000).to!(units, long)(), -+ assertApprox((cast(T)TickDuration.from!units(2_000_000)).to!(units, long)(), - 1_900_000, 2_100_000, units); - } - } -@@ -2179,9 +2179,9 @@ struct TickDuration - of days in a month or year). - - Params: -- tuFrom = The units of time to covert from. -- tuFrom = The units of time to covert type. -- value = The value to convert. -+ from = The units of time to convert from. -+ to = The units of time to convert to. -+ value = The value to convert. - - Examples: - -------------------- -@@ -2946,7 +2946,7 @@ class TimeException : Exception - line = The line number where the exception occurred. - next = The previous exception in the chain of exceptions, if any. - +/ -- nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) -+ @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - super(msg, file, line, next); - } ---- a/src/libphobos/libdruntime/__entrypoint.di 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/__entrypoint.di 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,71 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* This module provides the C main() function supplied by the user's program. */ -+ -+module __entrypoint; -+ -+extern(C): -+ -+/* The memory between the addresses of _tlsstart and _tlsend is the storage for -+ thread-local data in D 2.0. Both of these rely on the default linker script -+ of: -+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } -+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } -+ to group the sections in that order. -+ -+ Sadly, this does not work because ld orders .tdata after .tdata.*, despite -+ what the linker script says. -+*/ -+ -+size_t _tlsstart = 3; -+size_t _tlsend = void; -+ -+ -+/* The D main() function supplied by the user's program -+ -+ It always has `_Dmain` symbol name and uses C calling convention. -+ But D frontend returns its type as `extern(D)` because of Issue 9028. -+ As we need to deal with actual calling convention we have to mark it -+ as `extern(C)` and use its symbol name. -+*/ -+ -+int _Dmain(char[][] args); -+int _d_run_main(int argc, char **argv, void* mainFunc); -+ -+/* Substitutes for the C main() function. Just calls into d_run_main with -+ the default main function. Applications are free to implement their own -+ main function and call the _d_run_main function themselves with any main -+ function. -+*/ -+ -+int main(int argc, char **argv) -+{ -+ return _d_run_main(argc, argv, &_Dmain); -+} -+ -+/* This is apparently needed on Solaris because the C tool chain seems to -+ expect the main function to be called _main. It needs both not just one! -+*/ -+ -+version (Solaris) -+int _main(int argc, char** argv) -+{ -+ return main(argc, argv); -+} -+ ---- a/src/libphobos/libdruntime/etc/linux/memoryerror.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/etc/linux/memoryerror.d 2014-04-01 16:32:51.000000000 +0100 -@@ -14,7 +14,15 @@ - - module etc.linux.memoryerror; - --version (linux): -+version (linux) -+{ -+ version (X86) -+ version = MemoryErrorSupported; -+ version (X86_64) -+ version = MemoryErrorSupported; -+} -+ -+version (MemoryErrorSupported): - @system: - - import core.sys.posix.signal; ---- a/src/libphobos/libdruntime/gc/bits.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/bits.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,233 @@ -+/** -+ * Contains a bitfield used by the GC. -+ * -+ * Copyright: Copyright Digital Mars 2005 - 2013. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Walter Bright, David Friedman, Sean Kelly -+ */ -+ -+/* Copyright Digital Mars 2005 - 2013. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module gc.bits; -+ -+ -+import core.bitop; -+import core.stdc.string; -+import core.stdc.stdlib; -+ -+ -+private extern (C) void onOutOfMemoryError(); -+ -+ -+version (DigitalMars) -+{ -+ version = bitops; -+} -+else version (GNU) -+{ -+ // use the unoptimized version -+} -+else version (D_InlineAsm_X86) -+{ -+ version = Asm86; -+} -+ -+struct GCBits -+{ -+ alias size_t wordtype; -+ -+ enum BITS_PER_WORD = (wordtype.sizeof * 8); -+ enum BITS_SHIFT = (wordtype.sizeof == 8 ? 6 : 5); -+ enum BITS_MASK = (BITS_PER_WORD - 1); -+ enum BITS_1 = cast(wordtype)1; -+ -+ wordtype* data = null; -+ size_t nwords = 0; // allocated words in data[] excluding sentinals -+ size_t nbits = 0; // number of bits in data[] excluding sentinals -+ -+ void Dtor() -+ { -+ if (data) -+ { -+ free(data); -+ data = null; -+ } -+ } -+ -+ invariant() -+ { -+ if (data) -+ { -+ assert(nwords * data[0].sizeof * 8 >= nbits); -+ } -+ } -+ -+ void alloc(size_t nbits) -+ { -+ this.nbits = nbits; -+ nwords = (nbits + (BITS_PER_WORD - 1)) >> BITS_SHIFT; -+ data = cast(typeof(data[0])*)calloc(nwords + 2, data[0].sizeof); -+ if (!data) -+ onOutOfMemoryError(); -+ } -+ -+ wordtype test(size_t i) -+ in -+ { -+ assert(i < nbits); -+ } -+ body -+ { -+ version (none) -+ { -+ return core.bitop.bt(data + 1, i); // this is actually slower! don't use -+ } -+ else -+ { -+ //return (cast(bit *)(data + 1))[i]; -+ return data[1 + (i >> BITS_SHIFT)] & (BITS_1 << (i & BITS_MASK)); -+ } -+ } -+ -+ void set(size_t i) -+ in -+ { -+ assert(i < nbits); -+ } -+ body -+ { -+ //(cast(bit *)(data + 1))[i] = 1; -+ data[1 + (i >> BITS_SHIFT)] |= (BITS_1 << (i & BITS_MASK)); -+ } -+ -+ void clear(size_t i) -+ in -+ { -+ assert(i < nbits); -+ } -+ body -+ { -+ //(cast(bit *)(data + 1))[i] = 0; -+ data[1 + (i >> BITS_SHIFT)] &= ~(BITS_1 << (i & BITS_MASK)); -+ } -+ -+ wordtype testClear(size_t i) -+ { -+ version (bitops) -+ { -+ return core.bitop.btr(data + 1, i); // this is faster! -+ } -+ else version (Asm86) -+ { -+ asm -+ { -+ naked ; -+ mov EAX,data[EAX] ; -+ mov ECX,i-4[ESP] ; -+ btr 4[EAX],ECX ; -+ sbb EAX,EAX ; -+ ret 4 ; -+ } -+ } -+ else -+ { -+ //result = (cast(bit *)(data + 1))[i]; -+ //(cast(bit *)(data + 1))[i] = 0; -+ -+ auto p = &data[1 + (i >> BITS_SHIFT)]; -+ auto mask = (BITS_1 << (i & BITS_MASK)); -+ auto result = *p & mask; -+ *p &= ~mask; -+ return result; -+ } -+ } -+ -+ wordtype testSet(size_t i) -+ { -+ version (bitops) -+ { -+ return core.bitop.bts(data + 1, i); // this is faster! -+ } -+ else version (Asm86) -+ { -+ asm -+ { -+ naked ; -+ mov EAX,data[EAX] ; -+ mov ECX,i-4[ESP] ; -+ bts 4[EAX],ECX ; -+ sbb EAX,EAX ; -+ ret 4 ; -+ } -+ } -+ else -+ { -+ //result = (cast(bit *)(data + 1))[i]; -+ //(cast(bit *)(data + 1))[i] = 0; -+ -+ auto p = &data[1 + (i >> BITS_SHIFT)]; -+ auto mask = (BITS_1 << (i & BITS_MASK)); -+ auto result = *p & mask; -+ *p |= mask; -+ return result; -+ } -+ } -+ -+ void zero() -+ { -+ memset(data + 1, 0, nwords * wordtype.sizeof); -+ } -+ -+ void copy(GCBits *f) -+ in -+ { -+ assert(nwords == f.nwords); -+ } -+ body -+ { -+ memcpy(data + 1, f.data + 1, nwords * wordtype.sizeof); -+ } -+ -+ wordtype* base() -+ in -+ { -+ assert(data); -+ } -+ body -+ { -+ return data + 1; -+ } -+} -+ -+unittest -+{ -+ GCBits b; -+ -+ b.alloc(786); -+ assert(b.test(123) == 0); -+ assert(b.testClear(123) == 0); -+ b.set(123); -+ assert(b.test(123) != 0); -+ assert(b.testClear(123) != 0); -+ assert(b.test(123) == 0); -+ -+ b.set(785); -+ b.set(0); -+ assert(b.test(785) != 0); -+ assert(b.test(0) != 0); -+ b.zero(); -+ assert(b.test(785) == 0); -+ assert(b.test(0) == 0); -+ -+ GCBits b2; -+ b2.alloc(786); -+ b2.set(38); -+ b.copy(&b2); -+ assert(b.test(38) != 0); -+ b2.Dtor(); -+ -+ b.Dtor(); -+} ---- a/src/libphobos/libdruntime/gc/gcalloc.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/gcalloc.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,202 +0,0 @@ --/** -- * Contains OS-level allocation routines. -- * -- * Copyright: Copyright Digital Mars 2005 - 2009. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright, David Friedman, Sean Kelly -- */ -- --/* Copyright Digital Mars 2005 - 2009. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module gc.gcalloc; -- -- --version (Windows) --{ -- private import core.sys.windows.windows; -- -- alias int pthread_t; -- -- pthread_t pthread_self() -- { -- return cast(pthread_t) GetCurrentThreadId(); -- } -- -- //version = GC_Use_Alloc_Win32; --} --else version (Posix) --{ -- private import core.sys.posix.sys.mman; -- private import core.stdc.stdlib; -- -- //version = GC_Use_Alloc_MMap; --} --else --{ -- private import core.stdc.stdlib; -- -- //version = GC_Use_Alloc_Malloc; --} -- --/+ --static if(is(typeof(VirtualAlloc))) -- version = GC_Use_Alloc_Win32; --else static if (is(typeof(mmap))) -- version = GC_Use_Alloc_MMap; --else static if (is(typeof(valloc))) -- version = GC_Use_Alloc_Valloc; --else static if (is(typeof(malloc))) -- version = GC_Use_Alloc_Malloc; --else static assert(false, "No supported allocation methods available."); --+/ -- --static if (is(typeof(VirtualAlloc))) // version (GC_Use_Alloc_Win32) --{ -- /** -- * Map memory. -- */ -- void *os_mem_map(size_t nbytes) -- { -- return VirtualAlloc(null, nbytes, MEM_RESERVE, PAGE_READWRITE); -- } -- -- -- /** -- * Commit memory. -- * Returns: -- * 0 success -- * !=0 failure -- */ -- int os_mem_commit(void *base, size_t offset, size_t nbytes) -- { void *p; -- -- p = VirtualAlloc(base + offset, nbytes, MEM_COMMIT, PAGE_READWRITE); -- return cast(int)(p is null); -- } -- -- -- /** -- * Decommit memory. -- * Returns: -- * 0 success -- * !=0 failure -- */ -- int os_mem_decommit(void *base, size_t offset, size_t nbytes) -- { -- return cast(int)(VirtualFree(base + offset, nbytes, MEM_DECOMMIT) == 0); -- } -- -- -- /** -- * Unmap memory allocated with os_mem_map(). -- * Memory must have already been decommitted. -- * Returns: -- * 0 success -- * !=0 failure -- */ -- int os_mem_unmap(void *base, size_t nbytes) -- { -- return cast(int)(VirtualFree(base, 0, MEM_RELEASE) == 0); -- } --} --else static if (is(typeof(mmap))) // else version (GC_Use_Alloc_MMap) --{ -- void *os_mem_map(size_t nbytes) -- { void *p; -- -- p = mmap(null, nbytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); -- return (p == MAP_FAILED) ? null : p; -- } -- -- -- int os_mem_commit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_decommit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_unmap(void *base, size_t nbytes) -- { -- return munmap(base, nbytes); -- } --} --else static if (is(typeof(valloc))) // else version (GC_Use_Alloc_Valloc) --{ -- void *os_mem_map(size_t nbytes) -- { -- return valloc(nbytes); -- } -- -- -- int os_mem_commit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_decommit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_unmap(void *base, size_t nbytes) -- { -- free(base); -- return 0; -- } --} --else static if (is(typeof(malloc))) // else version (GC_Use_Alloc_Malloc) --{ -- // NOTE: This assumes malloc granularity is at least (void*).sizeof. If -- // (req_size + PAGESIZE) is allocated, and the pointer is rounded up -- // to PAGESIZE alignment, there will be space for a void* at the end -- // after PAGESIZE bytes used by the GC. -- -- -- private import gc.gcx; -- -- -- const size_t PAGE_MASK = PAGESIZE - 1; -- -- -- void *os_mem_map(size_t nbytes) -- { byte *p, q; -- p = cast(byte *) malloc(nbytes + PAGESIZE); -- q = p + ((PAGESIZE - ((cast(size_t) p & PAGE_MASK))) & PAGE_MASK); -- * cast(void**)(q + nbytes) = p; -- return q; -- } -- -- -- int os_mem_commit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_decommit(void *base, size_t offset, size_t nbytes) -- { -- return 0; -- } -- -- -- int os_mem_unmap(void *base, size_t nbytes) -- { -- free( *cast(void**)( cast(byte*) base + nbytes ) ); -- return 0; -- } --} --else --{ -- static assert(false, "No supported allocation methods available."); --} ---- a/src/libphobos/libdruntime/gc/gcbits.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/gcbits.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,234 +0,0 @@ --/** -- * Contains a bitfield used by the GC. -- * -- * Copyright: Copyright Digital Mars 2005 - 2009. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright, David Friedman, Sean Kelly -- */ -- --/* Copyright Digital Mars 2005 - 2009. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module gc.gcbits; -- -- --private --{ -- import core.bitop; -- import core.stdc.string; -- import core.stdc.stdlib; -- extern (C) void onOutOfMemoryError(); --} -- -- --version (DigitalMars) --{ -- version = bitops; --} --else version (GNU) --{ -- // use the unoptimized version --} --else version (D_InlineAsm_X86) --{ -- version = Asm86; --} -- --struct GCBits --{ -- alias size_t wordtype; -- -- enum BITS_PER_WORD = (wordtype.sizeof * 8); -- enum BITS_SHIFT = (wordtype.sizeof == 8 ? 6 : 5); -- enum BITS_MASK = (BITS_PER_WORD - 1); -- enum BITS_1 = cast(wordtype)1; -- -- wordtype* data = null; -- size_t nwords = 0; // allocated words in data[] excluding sentinals -- size_t nbits = 0; // number of bits in data[] excluding sentinals -- -- void Dtor() -- { -- if (data) -- { -- free(data); -- data = null; -- } -- } -- -- invariant() -- { -- if (data) -- { -- assert(nwords * data[0].sizeof * 8 >= nbits); -- } -- } -- -- void alloc(size_t nbits) -- { -- this.nbits = nbits; -- nwords = (nbits + (BITS_PER_WORD - 1)) >> BITS_SHIFT; -- data = cast(typeof(data[0])*)calloc(nwords + 2, data[0].sizeof); -- if (!data) -- onOutOfMemoryError(); -- } -- -- wordtype test(size_t i) -- in -- { -- assert(i < nbits); -- } -- body -- { -- version (none) -- { -- return core.bitop.bt(data + 1, i); // this is actually slower! don't use -- } -- else -- { -- //return (cast(bit *)(data + 1))[i]; -- return data[1 + (i >> BITS_SHIFT)] & (BITS_1 << (i & BITS_MASK)); -- } -- } -- -- void set(size_t i) -- in -- { -- assert(i < nbits); -- } -- body -- { -- //(cast(bit *)(data + 1))[i] = 1; -- data[1 + (i >> BITS_SHIFT)] |= (BITS_1 << (i & BITS_MASK)); -- } -- -- void clear(size_t i) -- in -- { -- assert(i < nbits); -- } -- body -- { -- //(cast(bit *)(data + 1))[i] = 0; -- data[1 + (i >> BITS_SHIFT)] &= ~(BITS_1 << (i & BITS_MASK)); -- } -- -- wordtype testClear(size_t i) -- { -- version (bitops) -- { -- return core.bitop.btr(data + 1, i); // this is faster! -- } -- else version (Asm86) -- { -- asm -- { -- naked ; -- mov EAX,data[EAX] ; -- mov ECX,i-4[ESP] ; -- btr 4[EAX],ECX ; -- sbb EAX,EAX ; -- ret 4 ; -- } -- } -- else -- { -- //result = (cast(bit *)(data + 1))[i]; -- //(cast(bit *)(data + 1))[i] = 0; -- -- auto p = &data[1 + (i >> BITS_SHIFT)]; -- auto mask = (BITS_1 << (i & BITS_MASK)); -- auto result = *p & mask; -- *p &= ~mask; -- return result; -- } -- } -- -- wordtype testSet(size_t i) -- { -- version (bitops) -- { -- return core.bitop.bts(data + 1, i); // this is faster! -- } -- else version (Asm86) -- { -- asm -- { -- naked ; -- mov EAX,data[EAX] ; -- mov ECX,i-4[ESP] ; -- bts 4[EAX],ECX ; -- sbb EAX,EAX ; -- ret 4 ; -- } -- } -- else -- { -- //result = (cast(bit *)(data + 1))[i]; -- //(cast(bit *)(data + 1))[i] = 0; -- -- auto p = &data[1 + (i >> BITS_SHIFT)]; -- auto mask = (BITS_1 << (i & BITS_MASK)); -- auto result = *p & mask; -- *p |= mask; -- return result; -- } -- } -- -- void zero() -- { -- memset(data + 1, 0, nwords * wordtype.sizeof); -- } -- -- void copy(GCBits *f) -- in -- { -- assert(nwords == f.nwords); -- } -- body -- { -- memcpy(data + 1, f.data + 1, nwords * wordtype.sizeof); -- } -- -- wordtype* base() -- in -- { -- assert(data); -- } -- body -- { -- return data + 1; -- } --} -- --unittest --{ -- GCBits b; -- -- b.alloc(786); -- assert(b.test(123) == 0); -- assert(b.testClear(123) == 0); -- b.set(123); -- assert(b.test(123) != 0); -- assert(b.testClear(123) != 0); -- assert(b.test(123) == 0); -- -- b.set(785); -- b.set(0); -- assert(b.test(785) != 0); -- assert(b.test(0) != 0); -- b.zero(); -- assert(b.test(785) == 0); -- assert(b.test(0) == 0); -- -- GCBits b2; -- b2.alloc(786); -- b2.set(38); -- b.copy(&b2); -- assert(b.test(38) != 0); -- b2.Dtor(); -- -- b.Dtor(); --} ---- a/src/libphobos/libdruntime/gc/gc.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/gc.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,335 +1,3338 @@ - /** -- * Contains the external GC interface. -+ * Contains the garbage collector implementation. - * -- * Copyright: Copyright Digital Mars 2005 - 2009. -+ * Copyright: Copyright Digital Mars 2001 - 2013. - * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright, Sean Kelly -+ * Authors: Walter Bright, David Friedman, Sean Kelly - */ - --/* Copyright Digital Mars 2005 - 2009. -+/* Copyright Digital Mars 2005 - 2013. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - module gc.gc; - -+// D Programming Language Garbage Collector implementation -+ -+/************** Debugging ***************************/ -+ -+//debug = PRINTF; // turn on printf's -+//debug = COLLECT_PRINTF; // turn on printf's -+//debug = LOGGING; // log allocations / frees -+//debug = MEMSTOMP; // stomp on memory -+//debug = SENTINEL; // add underrun/overrrun protection -+//debug = PTRCHECK; // more pointer checking -+//debug = PTRCHECK2; // thorough but slow pointer checking -+//debug = PROFILING; // measure performance of various steps. -+ -+/*************** Configuration *********************/ -+ -+version = STACKGROWSDOWN; // growing the stack means subtracting from the stack pointer -+ // (use for Intel X86 CPUs) -+ // else growing the stack means adding to the stack pointer -+ -+/***************************************************/ -+ -+import gc.bits; -+import gc.stats; -+import gc.os; -+ -+import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc; -+import core.stdc.string; -+import core.bitop; -+import core.sync.mutex; -+static import core.memory; -+private alias BlkAttr = core.memory.GC.BlkAttr; -+ -+version (GNU) import gcc.builtins; -+ -+debug (PRINTF) import core.stdc.stdio : printf; -+debug (COLLECT_PRINTF) import core.stdc.stdio : printf; -+debug private import core.stdc.stdio; -+ -+debug(PRINTF) void printFreeInfo(Pool* pool) -+{ -+ uint nReallyFree; -+ foreach(i; 0..pool.npages) { -+ if(pool.pagetable[i] >= B_FREE) nReallyFree++; -+ } -+ -+ printf("Pool %p: %d really free, %d supposedly free\n", pool, nReallyFree, pool.freepages); -+} -+ -+debug(PROFILING) -+{ -+ // Track total time spent preparing for GC, -+ // marking, sweeping and recovering pages. -+ import core.stdc.stdio, core.stdc.time; -+ __gshared long prepTime; -+ __gshared long markTime; -+ __gshared long sweepTime; -+ __gshared long recoverTime; -+} -+ - private - { -- import gc.gcx; -- import gc.gcstats; -- import core.stdc.stdlib; -+ enum USE_CACHE = true; - -- version = GCCLASS; -+ // The maximum number of recursions of mark() before transitioning to -+ // multiple heap traversals to avoid consuming O(D) stack space where -+ // D is the depth of the heap graph. -+ enum MAX_MARK_RECURSIONS = 64; -+} -+ struct BlkInfo -+ { -+ void* base; -+ size_t size; -+ uint attr; -+ } -+private -+{ -+ extern (C) void rt_finalize2(void* p, bool det, bool resetMemory); - -- version( GCCLASS ) -- alias GC gc_t; -- else -- alias GC* gc_t; -+ extern (C) void thread_suspendAll(); -+ extern (C) void thread_resumeAll(); - -- __gshared gc_t _gc; -+ // core.thread -+ enum IsMarked : int -+ { -+ no, -+ yes, -+ unknown, // memory is not managed by GC -+ } -+ alias IsMarked delegate(void*) IsMarkedDg; -+ extern (C) void thread_processGCMarks(scope IsMarkedDg isMarked); - -- extern (C) void thread_init(); -+ alias void delegate(void*, void*) scanFn; -+ extern (C) void thread_scanAll(scope scanFn fn); - -- struct Proxy -+ extern (C) void onOutOfMemoryError(); -+ extern (C) void onInvalidMemoryOperationError(); -+ -+ enum - { -- extern (C) void function() gc_enable; -- extern (C) void function() gc_disable; -- extern (C) void function() gc_collect; -- extern (C) void function() gc_minimize; -+ OPFAIL = ~cast(size_t)0 -+ } -+} -+ -+ -+alias GC gc_t; - -- extern (C) uint function(void*) gc_getAttr; -- extern (C) uint function(void*, uint) gc_setAttr; -- extern (C) uint function(void*, uint) gc_clrAttr; - -- extern (C) void* function(size_t, uint) gc_malloc; -- extern (C) BlkInfo function(size_t, uint) gc_qalloc; -- extern (C) void* function(size_t, uint) gc_calloc; -- extern (C) void* function(void*, size_t, uint ba) gc_realloc; -- extern (C) size_t function(void*, size_t, size_t) gc_extend; -- extern (C) size_t function(size_t) gc_reserve; -- extern (C) void function(void*) gc_free; -+/* ======================= Leak Detector =========================== */ - -- extern (C) void* function(void*) gc_addrOf; -- extern (C) size_t function(void*) gc_sizeOf; - -- extern (C) BlkInfo function(void*) gc_query; -+debug (LOGGING) -+{ -+ struct Log -+ { -+ void* p; -+ size_t size; -+ size_t line; -+ char* file; -+ void* parent; -+ -+ void print() -+ { -+ printf(" p = %p, size = %zd, parent = %p ", p, size, parent); -+ if (file) -+ { -+ printf("%s(%u)", file, line); -+ } -+ printf("\n"); -+ } -+ } - -- extern (C) void function(void*) gc_addRoot; -- extern (C) void function(void*, size_t) gc_addRange; - -- extern (C) void function(void*) gc_removeRoot; -- extern (C) void function(void*) gc_removeRange; -+ struct LogArray -+ { -+ size_t dim; -+ size_t allocdim; -+ Log *data; -+ -+ void Dtor() -+ { -+ if (data) -+ cstdlib.free(data); -+ data = null; -+ } -+ -+ void reserve(size_t nentries) -+ { -+ assert(dim <= allocdim); -+ if (allocdim - dim < nentries) -+ { -+ allocdim = (dim + nentries) * 2; -+ assert(dim + nentries <= allocdim); -+ if (!data) -+ { -+ data = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof); -+ if (!data && allocdim) -+ onOutOfMemoryError(); -+ } -+ else -+ { Log *newdata; -+ -+ newdata = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof); -+ if (!newdata && allocdim) -+ onOutOfMemoryError(); -+ memcpy(newdata, data, dim * Log.sizeof); -+ cstdlib.free(data); -+ data = newdata; -+ } -+ } -+ } -+ -+ -+ void push(Log log) -+ { -+ reserve(1); -+ data[dim++] = log; -+ } -+ -+ void remove(size_t i) -+ { -+ memmove(data + i, data + i + 1, (dim - i) * Log.sizeof); -+ dim--; -+ } -+ -+ -+ size_t find(void *p) -+ { -+ for (size_t i = 0; i < dim; i++) -+ { -+ if (data[i].p == p) -+ return i; -+ } -+ return OPFAIL; // not found -+ } -+ -+ -+ void copy(LogArray *from) -+ { -+ reserve(from.dim - dim); -+ assert(from.dim <= allocdim); -+ memcpy(data, from.data, from.dim * Log.sizeof); -+ dim = from.dim; -+ } - } -+} -+ -+ -+/* ============================ GC =============================== */ -+ - -- __gshared Proxy pthis; -- __gshared Proxy* proxy; -+const uint GCVERSION = 1; // increment every time we change interface -+ // to GC. - -- void initProxy() -+// This just makes Mutex final to de-virtualize member function calls. -+final class GCMutex : Mutex {} -+ -+class GC -+{ -+ // For passing to debug code (not thread safe) -+ __gshared size_t line; -+ __gshared char* file; -+ -+ uint gcversion = GCVERSION; -+ -+ Gcx *gcx; // implementation -+ -+ // We can't allocate a Mutex on the GC heap because we are the GC. -+ // Store it in the static data segment instead. -+ __gshared GCMutex gcLock; // global lock -+ __gshared byte[__traits(classInstanceSize, GCMutex)] mutexStorage; -+ -+ void initialize() - { -- pthis.gc_enable = &gc_enable; -- pthis.gc_disable = &gc_disable; -- pthis.gc_collect = &gc_collect; -- pthis.gc_minimize = &gc_minimize; -+ mutexStorage[] = GCMutex.classinfo.init[]; -+ gcLock = cast(GCMutex) mutexStorage.ptr; -+ gcLock.__ctor(); -+ gcx = cast(Gcx*)cstdlib.calloc(1, Gcx.sizeof); -+ if (!gcx) -+ onOutOfMemoryError(); -+ gcx.initialize(); -+ } - -- pthis.gc_getAttr = &gc_getAttr; -- pthis.gc_setAttr = &gc_setAttr; -- pthis.gc_clrAttr = &gc_clrAttr; - -- pthis.gc_malloc = &gc_malloc; -- pthis.gc_qalloc = &gc_qalloc; -- pthis.gc_calloc = &gc_calloc; -- pthis.gc_realloc = &gc_realloc; -- pthis.gc_extend = &gc_extend; -- pthis.gc_reserve = &gc_reserve; -- pthis.gc_free = &gc_free; -+ void Dtor() -+ { -+ version (linux) -+ { -+ //debug(PRINTF) printf("Thread %x ", pthread_self()); -+ //debug(PRINTF) printf("GC.Dtor()\n"); -+ } -+ -+ if (gcx) -+ { -+ gcx.Dtor(); -+ cstdlib.free(gcx); -+ gcx = null; -+ } -+ } - -- pthis.gc_addrOf = &gc_addrOf; -- pthis.gc_sizeOf = &gc_sizeOf; - -- pthis.gc_query = &gc_query; -+ /** -+ * -+ */ -+ void enable() -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ assert(gcx.disabled > 0); -+ gcx.disabled--; -+ } - -- pthis.gc_addRoot = &gc_addRoot; -- pthis.gc_addRange = &gc_addRange; - -- pthis.gc_removeRoot = &gc_removeRoot; -- pthis.gc_removeRange = &gc_removeRange; -+ /** -+ * -+ */ -+ void disable() -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.disabled++; - } --} - --extern (C) void gc_init() --{ -- version (GCCLASS) -- { void* p; -- ClassInfo ci = GC.classinfo; - -- p = malloc(ci.init.length); -- (cast(byte*)p)[0 .. ci.init.length] = ci.init[]; -- _gc = cast(GC)p; -+ /** -+ * -+ */ -+ uint getAttr(void* p) -+ { -+ if (!p) -+ { -+ return 0; -+ } -+ -+ uint go() -+ { -+ Pool* pool = gcx.findPool(p); -+ uint oldb = 0; -+ -+ if (pool) -+ { -+ auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ oldb = gcx.getBits(pool, biti); -+ } -+ return oldb; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return go(); - } -- else -+ -+ -+ /** -+ * -+ */ -+ uint setAttr(void* p, uint mask) - { -- _gc = cast(GC*) calloc(1, GC.sizeof); -+ if (!p) -+ { -+ return 0; -+ } -+ -+ uint go() -+ { -+ Pool* pool = gcx.findPool(p); -+ uint oldb = 0; -+ -+ if (pool) -+ { -+ auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ oldb = gcx.getBits(pool, biti); -+ gcx.setBits(pool, biti, mask); -+ } -+ return oldb; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return go(); - } -- _gc.initialize(); -- // NOTE: The GC must initialize the thread library -- // before its first collection. -- thread_init(); -- initProxy(); --} - --extern (C) void gc_term() --{ -- // NOTE: There may be daemons threads still running when this routine is -- // called. If so, cleaning memory out from under then is a good -- // way to make them crash horribly. This probably doesn't matter -- // much since the app is supposed to be shutting down anyway, but -- // I'm disabling cleanup for now until I can think about it some -- // more. -+ -+ /** -+ * -+ */ -+ uint clrAttr(void* p, uint mask) -+ { -+ if (!p) -+ { -+ return 0; -+ } -+ -+ uint go() -+ { -+ Pool* pool = gcx.findPool(p); -+ uint oldb = 0; -+ -+ if (pool) -+ { -+ auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ oldb = gcx.getBits(pool, biti); -+ gcx.clrBits(pool, biti, mask); -+ } -+ return oldb; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return go(); -+ } -+ -+ -+ /** -+ * -+ */ -+ void *malloc(size_t size, uint bits = 0, size_t *alloc_size = null) -+ { -+ if (!size) -+ { -+ if(alloc_size) -+ *alloc_size = 0; -+ return null; -+ } -+ -+ void* p = void; -+ size_t localAllocSize = void; -+ if(alloc_size is null) alloc_size = &localAllocSize; -+ -+ // Since a finalizer could launch a new thread, we always need to lock -+ // when collecting. The safest way to do this is to simply always lock -+ // when allocating. -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ p = mallocNoSync(size, bits, alloc_size); -+ } -+ -+ if (!(bits & BlkAttr.NO_SCAN)) -+ { -+ memset(p + size, 0, *alloc_size - size); -+ } -+ -+ return p; -+ } -+ -+ -+ // - // -- // NOTE: Due to popular demand, this has been re-enabled. It still has -- // the problems mentioned above though, so I guess we'll see. -- _gc.fullCollectNoStack(); // not really a 'collect all' -- still scans -- // static data area, roots, and ranges. -- _gc.Dtor(); -+ // -+ private void *mallocNoSync(size_t size, uint bits = 0, size_t *alloc_size = null) -+ { -+ assert(size != 0); - -- free(cast(void*)_gc); -- _gc = null; --} -+ void *p = null; -+ Bins bin; - --extern (C) void gc_enable() --{ -- if( proxy is null ) -- return _gc.enable(); -- return proxy.gc_enable(); --} -+ //debug(PRINTF) printf("GC::malloc(size = %d, gcx = %p)\n", size, gcx); -+ assert(gcx); -+ //debug(PRINTF) printf("gcx.self = %x, pthread_self() = %x\n", gcx.self, pthread_self()); -+ -+ if (gcx.running) -+ onInvalidMemoryOperationError(); -+ -+ size += SENTINEL_EXTRA; -+ bin = gcx.findBin(size); -+ Pool *pool; -+ -+ if (bin < B_PAGE) -+ { -+ if(alloc_size) -+ *alloc_size = binsize[bin]; -+ int state = gcx.disabled ? 1 : 0; -+ bool collected = false; -+ -+ while (!gcx.bucket[bin] && !gcx.allocPage(bin)) -+ { -+ switch (state) -+ { -+ case 0: -+ auto freedpages = gcx.fullcollect(); -+ collected = true; -+ if (freedpages < gcx.npools * ((POOLSIZE / PAGESIZE) / 8)) -+ { /* Didn't free much, so try allocating more anyway. -+ * Note: freedpages is not the amount of memory freed, it's the amount -+ * of full pages freed. Perhaps this should instead be the amount of -+ * memory freed. -+ */ -+ gcx.newPool(1,false); -+ state = 2; -+ } -+ else -+ state = 1; -+ continue; -+ case 1: -+ gcx.newPool(1, false); -+ state = 2; -+ continue; -+ case 2: -+ if (collected) -+ onOutOfMemoryError(); -+ state = 0; -+ continue; -+ default: -+ assert(false); -+ } -+ } -+ p = gcx.bucket[bin]; -+ -+ // Return next item from free list -+ gcx.bucket[bin] = (cast(List*)p).next; -+ pool = (cast(List*)p).pool; -+ //debug(PRINTF) printf("\tmalloc => %p\n", p); -+ debug (MEMSTOMP) memset(p, 0xF0, size); -+ } -+ else -+ { -+ p = gcx.bigAlloc(size, &pool, alloc_size); -+ if (!p) -+ onOutOfMemoryError(); -+ } -+ size -= SENTINEL_EXTRA; -+ p = sentinel_add(p); -+ sentinel_init(p, size); -+ gcx.log_malloc(p, size); -+ -+ if (bits) -+ { -+ gcx.setBits(pool, cast(size_t)(p - pool.baseAddr) >> pool.shiftBy, bits); -+ } -+ return p; -+ } - --extern (C) void gc_disable() --{ -- if( proxy is null ) -- return _gc.disable(); -- return proxy.gc_disable(); --} - --extern (C) void gc_collect() --{ -- if( proxy is null ) -+ /** -+ * -+ */ -+ void *calloc(size_t size, uint bits = 0, size_t *alloc_size = null) - { -- _gc.fullCollect(); -- return; -+ if (!size) -+ { -+ if(alloc_size) -+ *alloc_size = 0; -+ return null; -+ } -+ -+ size_t localAllocSize = void; -+ void* p = void; -+ if(alloc_size is null) alloc_size = &localAllocSize; -+ -+ // Since a finalizer could launch a new thread, we always need to lock -+ // when collecting. The safest way to do this is to simply always lock -+ // when allocating. -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ p = mallocNoSync(size, bits, alloc_size); -+ } -+ -+ memset(p, 0, size); -+ if (!(bits & BlkAttr.NO_SCAN)) -+ { -+ memset(p + size, 0, *alloc_size - size); -+ } -+ -+ return p; - } -- return proxy.gc_collect(); --} - --extern (C) void gc_minimize() --{ -- if( proxy is null ) -- return _gc.minimize(); -- return proxy.gc_minimize(); --} -+ /** -+ * -+ */ -+ void *realloc(void *p, size_t size, uint bits = 0, size_t *alloc_size = null) -+ { -+ size_t localAllocSize = void; -+ auto oldp = p; -+ if(alloc_size is null) alloc_size = &localAllocSize; -+ -+ // Since a finalizer could launch a new thread, we always need to lock -+ // when collecting. The safest way to do this is to simply always lock -+ // when allocating. -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ p = reallocNoSync(p, size, bits, alloc_size); -+ } -+ -+ if (p !is oldp && !(bits & BlkAttr.NO_SCAN)) -+ { -+ memset(p + size, 0, *alloc_size - size); -+ } - --extern (C) uint gc_getAttr( void* p ) --{ -- if( proxy is null ) -- return _gc.getAttr( p ); -- return proxy.gc_getAttr( p ); --} -+ return p; -+ } - --extern (C) uint gc_setAttr( void* p, uint a ) --{ -- if( proxy is null ) -- return _gc.setAttr( p, a ); -- return proxy.gc_setAttr( p, a ); --} - --extern (C) uint gc_clrAttr( void* p, uint a ) --{ -- if( proxy is null ) -- return _gc.clrAttr( p, a ); -- return proxy.gc_clrAttr( p, a ); --} -+ // -+ // -+ // -+ private void *reallocNoSync(void *p, size_t size, uint bits = 0, size_t *alloc_size = null) -+ { -+ if (gcx.running) -+ onInvalidMemoryOperationError(); - --extern (C) void* gc_malloc( size_t sz, uint ba = 0 ) --{ -- if( proxy is null ) -- return _gc.malloc( sz, ba ); -- return proxy.gc_malloc( sz, ba ); --} -+ if (!size) -+ { if (p) -+ { freeNoSync(p); -+ p = null; -+ } -+ if(alloc_size) -+ *alloc_size = 0; -+ } -+ else if (!p) -+ { -+ p = mallocNoSync(size, bits, alloc_size); -+ } -+ else -+ { void *p2; -+ size_t psize; -+ -+ //debug(PRINTF) printf("GC::realloc(p = %p, size = %zu)\n", p, size); -+ version (SENTINEL) -+ { -+ sentinel_Invariant(p); -+ psize = *sentinel_size(p); -+ if (psize != size) -+ { -+ if (psize) -+ { -+ Pool *pool = gcx.findPool(p); -+ -+ if (pool) -+ { -+ auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ if (bits) -+ { -+ gcx.clrBits(pool, biti, ~BlkAttr.NONE); -+ gcx.setBits(pool, biti, bits); -+ } -+ else -+ { -+ bits = gcx.getBits(pool, biti); -+ } -+ } -+ } -+ p2 = mallocNoSync(size, bits, alloc_size); -+ if (psize < size) -+ size = psize; -+ //debug(PRINTF) printf("\tcopying %d bytes\n",size); -+ memcpy(p2, p, size); -+ p = p2; -+ } -+ } -+ else -+ { -+ psize = gcx.findSize(p); // find allocated size -+ if (psize >= PAGESIZE && size >= PAGESIZE) -+ { -+ auto psz = psize / PAGESIZE; -+ auto newsz = (size + PAGESIZE - 1) / PAGESIZE; -+ if (newsz == psz) -+ return p; -+ -+ auto pool = gcx.findPool(p); -+ auto pagenum = (p - pool.baseAddr) / PAGESIZE; -+ -+ if (newsz < psz) -+ { // Shrink in place -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ debug (MEMSTOMP) memset(p + size, 0xF2, psize - size); -+ pool.freePages(pagenum + newsz, psz - newsz); -+ pool.updateOffsets(pagenum); -+ } -+ if(alloc_size) -+ *alloc_size = newsz * PAGESIZE; -+ gcx.updateCaches(p, newsz * PAGESIZE); -+ return p; -+ } -+ else if (pagenum + newsz <= pool.npages) -+ { -+ // Attempt to expand in place -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ -+ foreach (binsz; pool.pagetable[pagenum + psz .. pagenum + newsz]) -+ if (binsz != B_FREE) goto Lno; -+ -+ debug (MEMSTOMP) memset(p + psize, 0xF0, size - psize); -+ debug(PRINTF) printFreeInfo(pool); -+ memset(&pool.pagetable[pagenum + psz], B_PAGEPLUS, newsz - psz); -+ pool.updateOffsets(pagenum); -+ if(alloc_size) -+ *alloc_size = newsz * PAGESIZE; -+ pool.freepages -= (newsz - psz); -+ debug(PRINTF) printFreeInfo(pool); -+ gcx.updateCaches(p, newsz * PAGESIZE); -+ return p; -+ -+ Lno: -+ {} -+ } -+ } -+ if (psize < size || // if new size is bigger -+ psize > size * 2) // or less than half -+ { -+ if (psize) -+ { -+ Pool *pool = gcx.findPool(p); -+ -+ if (pool) -+ { -+ auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ if (bits) -+ { -+ gcx.clrBits(pool, biti, ~BlkAttr.NONE); -+ gcx.setBits(pool, biti, bits); -+ } -+ else -+ { -+ bits = gcx.getBits(pool, biti); -+ } -+ } -+ } -+ p2 = mallocNoSync(size, bits, alloc_size); -+ if (psize < size) -+ size = psize; -+ //debug(PRINTF) printf("\tcopying %d bytes\n",size); -+ memcpy(p2, p, size); -+ p = p2; -+ } -+ else if(alloc_size) -+ *alloc_size = psize; -+ } -+ } -+ return p; -+ } - --extern (C) BlkInfo gc_qalloc( size_t sz, uint ba = 0 ) --{ -- if( proxy is null ) -+ -+ /** -+ * Attempt to in-place enlarge the memory block pointed to by p by at least -+ * minbytes beyond its current capacity, up to a maximum of maxsize. This -+ * does not attempt to move the memory block (like realloc() does). -+ * -+ * Returns: -+ * 0 if could not extend p, -+ * total size of entire memory block if successful. -+ */ -+ size_t extend(void* p, size_t minsize, size_t maxsize) - { -- BlkInfo retval; -- retval.base = _gc.malloc( sz, ba, &retval.size ); -- retval.attr = ba; -- return retval; -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return extendNoSync(p, minsize, maxsize); - } -- return proxy.gc_qalloc( sz, ba ); --} - --extern (C) void* gc_calloc( size_t sz, uint ba = 0 ) --{ -- if( proxy is null ) -- return _gc.calloc( sz, ba ); -- return proxy.gc_calloc( sz, ba ); --} - --extern (C) void* gc_realloc( void* p, size_t sz, uint ba = 0 ) --{ -- if( proxy is null ) -- return _gc.realloc( p, sz, ba ); -- return proxy.gc_realloc( p, sz, ba ); --} -+ // -+ // -+ // -+ private size_t extendNoSync(void* p, size_t minsize, size_t maxsize) -+ in -+ { -+ assert(minsize <= maxsize); -+ } -+ body -+ { -+ if (gcx.running) -+ onInvalidMemoryOperationError(); - --extern (C) size_t gc_extend( void* p, size_t mx, size_t sz ) --{ -- if( proxy is null ) -- return _gc.extend( p, mx, sz ); -- return proxy.gc_extend( p, mx, sz ); --} -+ //debug(PRINTF) printf("GC::extend(p = %p, minsize = %zu, maxsize = %zu)\n", p, minsize, maxsize); -+ version (SENTINEL) -+ { -+ return 0; -+ } -+ auto psize = gcx.findSize(p); // find allocated size -+ if (psize < PAGESIZE) -+ return 0; // cannot extend buckets -+ -+ auto psz = psize / PAGESIZE; -+ auto minsz = (minsize + PAGESIZE - 1) / PAGESIZE; -+ auto maxsz = (maxsize + PAGESIZE - 1) / PAGESIZE; -+ -+ auto pool = gcx.findPool(p); -+ auto pagenum = (p - pool.baseAddr) / PAGESIZE; -+ -+ size_t sz; -+ for (sz = 0; sz < maxsz; sz++) -+ { -+ auto i = pagenum + psz + sz; -+ if (i == pool.npages) -+ break; -+ if (pool.pagetable[i] != B_FREE) -+ { if (sz < minsz) -+ return 0; -+ break; -+ } -+ } -+ if (sz < minsz) -+ return 0; -+ debug (MEMSTOMP) memset(p + psize, 0xF0, (psz + sz) * PAGESIZE - psize); -+ memset(pool.pagetable + pagenum + psz, B_PAGEPLUS, sz); -+ pool.updateOffsets(pagenum); -+ pool.freepages -= sz; -+ gcx.updateCaches(p, (psz + sz) * PAGESIZE); -+ return (psz + sz) * PAGESIZE; -+ } - --extern (C) size_t gc_reserve( size_t sz ) --{ -- if( proxy is null ) -- return _gc.reserve( sz ); -- return proxy.gc_reserve( sz ); -+ -+ /** -+ * -+ */ -+ size_t reserve(size_t size) -+ { -+ if (!size) -+ { -+ return 0; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return reserveNoSync(size); -+ } -+ -+ -+ // -+ // -+ // -+ private size_t reserveNoSync(size_t size) -+ { -+ assert(size != 0); -+ assert(gcx); -+ -+ if (gcx.running) -+ onInvalidMemoryOperationError(); -+ -+ return gcx.reserve(size); -+ } -+ -+ -+ /** -+ * -+ */ -+ void free(void *p) -+ { -+ if (!p) -+ { -+ return; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return freeNoSync(p); -+ } -+ -+ -+ // -+ // -+ // -+ private void freeNoSync(void *p) -+ { -+ debug(PRINTF) printf("Freeing %p\n", cast(size_t) p); -+ assert (p); -+ -+ if (gcx.running) -+ onInvalidMemoryOperationError(); -+ -+ Pool* pool; -+ size_t pagenum; -+ Bins bin; -+ size_t biti; -+ -+ // Find which page it is in -+ pool = gcx.findPool(p); -+ if (!pool) // if not one of ours -+ return; // ignore -+ sentinel_Invariant(p); -+ p = sentinel_sub(p); -+ pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -+ -+ debug(PRINTF) printf("pool base = %p, PAGENUM = %d of %d, bin = %d\n", pool.baseAddr, pagenum, pool.npages, pool.pagetable[pagenum]); -+ debug(PRINTF) if(pool.isLargeObject) printf("Block size = %d\n", pool.bPageOffsets[pagenum]); -+ biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -+ -+ gcx.clrBits(pool, biti, ~BlkAttr.NONE); -+ -+ bin = cast(Bins)pool.pagetable[pagenum]; -+ if (bin == B_PAGE) // if large alloc -+ { size_t npages; -+ -+ // Free pages -+ npages = pool.bPageOffsets[pagenum]; -+ debug (MEMSTOMP) memset(p, 0xF2, npages * PAGESIZE); -+ pool.freePages(pagenum, npages); -+ } -+ else -+ { // Add to free list -+ List *list = cast(List*)p; -+ -+ debug (MEMSTOMP) memset(p, 0xF2, binsize[bin]); -+ -+ list.next = gcx.bucket[bin]; -+ list.pool = pool; -+ gcx.bucket[bin] = list; -+ } -+ gcx.log_free(sentinel_add(p)); -+ } -+ -+ -+ /** -+ * Determine the base address of the block containing p. If p is not a gc -+ * allocated pointer, return null. -+ */ -+ void* addrOf(void *p) -+ { -+ if (!p) -+ { -+ return null; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return addrOfNoSync(p); -+ } -+ -+ -+ // -+ // -+ // -+ void* addrOfNoSync(void *p) -+ { -+ if (!p) -+ { -+ return null; -+ } -+ -+ return gcx.findBase(p); -+ } -+ -+ -+ /** -+ * Determine the allocated size of pointer p. If p is an interior pointer -+ * or not a gc allocated pointer, return 0. -+ */ -+ size_t sizeOf(void *p) -+ { -+ if (!p) -+ { -+ return 0; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return sizeOfNoSync(p); -+ } -+ -+ -+ // -+ // -+ // -+ private size_t sizeOfNoSync(void *p) -+ { -+ assert (p); -+ -+ version (SENTINEL) -+ { -+ p = sentinel_sub(p); -+ size_t size = gcx.findSize(p); -+ -+ // Check for interior pointer -+ // This depends on: -+ // 1) size is a power of 2 for less than PAGESIZE values -+ // 2) base of memory pool is aligned on PAGESIZE boundary -+ if (cast(size_t)p & (size - 1) & (PAGESIZE - 1)) -+ size = 0; -+ return size ? size - SENTINEL_EXTRA : 0; -+ } -+ else -+ { -+ size_t size = gcx.findSize(p); -+ -+ // Check for interior pointer -+ // This depends on: -+ // 1) size is a power of 2 for less than PAGESIZE values -+ // 2) base of memory pool is aligned on PAGESIZE boundary -+ if (cast(size_t)p & (size - 1) & (PAGESIZE - 1)) -+ return 0; -+ return size; -+ } -+ } -+ -+ -+ /** -+ * Determine the base address of the block containing p. If p is not a gc -+ * allocated pointer, return null. -+ */ -+ BlkInfo query(void *p) -+ { -+ if (!p) -+ { -+ BlkInfo i; -+ return i; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return queryNoSync(p); -+ } -+ -+ -+ // -+ // -+ // -+ BlkInfo queryNoSync(void *p) -+ { -+ assert(p); -+ -+ return gcx.getInfo(p); -+ } -+ -+ -+ /** -+ * Verify that pointer p: -+ * 1) belongs to this memory pool -+ * 2) points to the start of an allocated piece of memory -+ * 3) is not on a free list -+ */ -+ void check(void *p) -+ { -+ if (!p) -+ { -+ return; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ checkNoSync(p); -+ } -+ -+ -+ // -+ // -+ // -+ private void checkNoSync(void *p) -+ { -+ assert(p); -+ -+ sentinel_Invariant(p); -+ debug (PTRCHECK) -+ { -+ Pool* pool; -+ size_t pagenum; -+ Bins bin; -+ size_t size; -+ -+ p = sentinel_sub(p); -+ pool = gcx.findPool(p); -+ assert(pool); -+ pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -+ bin = cast(Bins)pool.pagetable[pagenum]; -+ assert(bin <= B_PAGE); -+ size = binsize[bin]; -+ assert((cast(size_t)p & (size - 1)) == 0); -+ -+ debug (PTRCHECK2) -+ { -+ if (bin < B_PAGE) -+ { -+ // Check that p is not on a free list -+ List *list; -+ -+ for (list = gcx.bucket[bin]; list; list = list.next) -+ { -+ assert(cast(void*)list != p); -+ } -+ } -+ } -+ } -+ } -+ -+ -+ /** -+ * add p to list of roots -+ */ -+ void addRoot(void *p) -+ { -+ if (!p) -+ { -+ return; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.addRoot(p); -+ } -+ -+ -+ /** -+ * remove p from list of roots -+ */ -+ void removeRoot(void *p) -+ { -+ if (!p) -+ { -+ return; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.removeRoot(p); -+ } -+ -+ -+ /** -+ * -+ */ -+ @property int delegate(int delegate(ref void*)) rootIter() -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return &gcx.rootIter; -+ } -+ -+ -+ /** -+ * add range to scan for roots -+ */ -+ void addRange(void *p, size_t sz) -+ { -+ if (!p || !sz) -+ { -+ return; -+ } -+ -+ //debug(PRINTF) printf("+GC.addRange(p = %p, sz = 0x%zx), p + sz = %p\n", p, sz, p + sz); -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.addRange(p, p + sz); -+ -+ //debug(PRINTF) printf("-GC.addRange()\n"); -+ } -+ -+ -+ /** -+ * remove range -+ */ -+ void removeRange(void *p) -+ { -+ if (!p) -+ { -+ return; -+ } -+ -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.removeRange(p); -+ } -+ -+ -+ /** -+ * -+ */ -+ @property int delegate(int delegate(ref Range)) rangeIter() -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ return &gcx.rangeIter; -+ } -+ -+ -+ /** -+ * Do full garbage collection. -+ * Return number of pages free'd. -+ */ -+ size_t fullCollect() -+ { -+ debug(PRINTF) printf("GC.fullCollect()\n"); -+ size_t result; -+ -+ // Since a finalizer could launch a new thread, we always need to lock -+ // when collecting. -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ result = gcx.fullcollect(); -+ } -+ -+ version (none) -+ { -+ GCStats stats; -+ -+ getStats(stats); -+ debug(PRINTF) printf("poolsize = %zx, usedsize = %zx, freelistsize = %zx\n", -+ stats.poolsize, stats.usedsize, stats.freelistsize); -+ } -+ -+ gcx.log_collect(); -+ return result; -+ } -+ -+ -+ /** -+ * do full garbage collection ignoring roots -+ */ -+ void fullCollectNoStack() -+ { -+ // Since a finalizer could launch a new thread, we always need to lock -+ // when collecting. -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.noStack++; -+ gcx.fullcollect(); -+ gcx.noStack--; -+ } -+ } -+ -+ -+ /** -+ * minimize free space usage -+ */ -+ void minimize() -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ gcx.minimize(); -+ } -+ -+ -+ /** -+ * Retrieve statistics about garbage collection. -+ * Useful for debugging and tuning. -+ */ -+ void getStats(out GCStats stats) -+ { -+ gcLock.lock(); -+ scope(exit) gcLock.unlock(); -+ getStatsNoSync(stats); -+ } -+ -+ -+ // -+ // -+ // -+ private void getStatsNoSync(out GCStats stats) -+ { -+ size_t psize = 0; -+ size_t usize = 0; -+ size_t flsize = 0; -+ -+ size_t n; -+ size_t bsize = 0; -+ -+ //debug(PRINTF) printf("getStats()\n"); -+ memset(&stats, 0, GCStats.sizeof); -+ -+ for (n = 0; n < gcx.npools; n++) -+ { Pool *pool = gcx.pooltable[n]; -+ -+ psize += pool.npages * PAGESIZE; -+ for (size_t j = 0; j < pool.npages; j++) -+ { -+ Bins bin = cast(Bins)pool.pagetable[j]; -+ if (bin == B_FREE) -+ stats.freeblocks++; -+ else if (bin == B_PAGE) -+ stats.pageblocks++; -+ else if (bin < B_PAGE) -+ bsize += PAGESIZE; -+ } -+ } -+ -+ for (n = 0; n < B_PAGE; n++) -+ { -+ //debug(PRINTF) printf("bin %d\n", n); -+ for (List *list = gcx.bucket[n]; list; list = list.next) -+ { -+ //debug(PRINTF) printf("\tlist %p\n", list); -+ flsize += binsize[n]; -+ } -+ } -+ -+ usize = bsize - flsize; -+ -+ stats.poolsize = psize; -+ stats.usedsize = bsize - flsize; -+ stats.freelistsize = flsize; -+ } - } - --extern (C) void gc_free( void* p ) --{ -- if( proxy is null ) -- return _gc.free( p ); -- return proxy.gc_free( p ); -+ -+/* ============================ Gcx =============================== */ -+ -+enum -+{ PAGESIZE = 4096, -+ POOLSIZE = (4096*256), - } - --extern (C) void* gc_addrOf( void* p ) -+ -+enum - { -- if( proxy is null ) -- return _gc.addrOf( p ); -- return proxy.gc_addrOf( p ); -+ B_16, -+ B_32, -+ B_64, -+ B_128, -+ B_256, -+ B_512, -+ B_1024, -+ B_2048, -+ B_PAGE, // start of large alloc -+ B_PAGEPLUS, // continuation of large alloc -+ B_FREE, // free page -+ B_MAX - } - --extern (C) size_t gc_sizeOf( void* p ) -+ -+alias ubyte Bins; -+ -+ -+struct List - { -- if( proxy is null ) -- return _gc.sizeOf( p ); -- return proxy.gc_sizeOf( p ); -+ List *next; -+ Pool *pool; - } - --extern (C) BlkInfo gc_query( void* p ) -+ -+struct Range - { -- if( proxy is null ) -- return _gc.query( p ); -- return proxy.gc_query( p ); -+ void *pbot; -+ void *ptop; - } - --// NOTE: This routine is experimental. The stats or function name may change --// before it is made officially available. --extern (C) GCStats gc_stats() -+ -+immutable uint binsize[B_MAX] = [ 16,32,64,128,256,512,1024,2048,4096 ]; -+immutable size_t notbinsize[B_MAX] = [ ~(16-1),~(32-1),~(64-1),~(128-1),~(256-1), -+ ~(512-1),~(1024-1),~(2048-1),~(4096-1) ]; -+ -+/* ============================ Gcx =============================== */ -+ -+struct Gcx - { -- if( proxy is null ) -+ void *cached_size_key; -+ size_t cached_size_val; -+ -+ void *cached_info_key; -+ BlkInfo cached_info_val; -+ -+ size_t nroots; -+ size_t rootdim; -+ void **roots; -+ -+ size_t nranges; -+ size_t rangedim; -+ Range *ranges; -+ -+ uint noStack; // !=0 means don't scan stack -+ uint log; // turn on logging -+ uint anychanges; -+ uint inited; -+ uint running; -+ int disabled; // turn off collections if >0 -+ -+ byte *minAddr; // min(baseAddr) -+ byte *maxAddr; // max(topAddr) -+ -+ size_t npools; -+ Pool **pooltable; -+ -+ List *bucket[B_MAX]; // free list for each size -+ -+ -+ void initialize() -+ { int dummy; -+ -+ (cast(byte*)&this)[0 .. Gcx.sizeof] = 0; -+ log_init(); -+ //printf("gcx = %p, self = %x\n", &this, self); -+ inited = 1; -+ } -+ -+ -+ void Dtor() - { -- GCStats stats = void; -- _gc.getStats( stats ); -- return stats; -+ debug(PROFILING) -+ { -+ printf("\tTotal GC prep time: %d milliseconds\n", -+ prepTime * 1000 / CLOCKS_PER_SEC); -+ printf("\tTotal mark time: %d milliseconds\n", -+ markTime * 1000 / CLOCKS_PER_SEC); -+ printf("\tTotal sweep time: %d milliseconds\n", -+ sweepTime * 1000 / CLOCKS_PER_SEC); -+ printf("\tTotal page recovery time: %d milliseconds\n", -+ recoverTime * 1000 / CLOCKS_PER_SEC); -+ printf("\tGrand total GC time: %d milliseconds\n", -+ 1000 * (recoverTime + sweepTime + markTime + prepTime) -+ / CLOCKS_PER_SEC); -+ } -+ -+ inited = 0; -+ -+ for (size_t i = 0; i < npools; i++) -+ { Pool *pool = pooltable[i]; -+ -+ pool.Dtor(); -+ cstdlib.free(pool); -+ } -+ if (pooltable) -+ { -+ cstdlib.free(pooltable); -+ pooltable = null; -+ } -+ -+ if (roots) -+ cstdlib.free(roots); -+ -+ if (ranges) -+ cstdlib.free(ranges); - } -- // TODO: Add proxy support for this once the layout of GCStats is -- // finalized. -- //return proxy.gc_stats(); -- return GCStats.init; --} - --extern (C) void gc_addRoot( void* p ) --{ -- if( proxy is null ) -- return _gc.addRoot( p ); -- return proxy.gc_addRoot( p ); --} - --extern (C) void gc_addRange( void* p, size_t sz ) --{ -- if( proxy is null ) -- return _gc.addRange( p, sz ); -- return proxy.gc_addRange( p, sz ); --} -+ void Invariant() const { } - --extern (C) void gc_removeRoot( void* p ) --{ -- if( proxy is null ) -- return _gc.removeRoot( p ); -- return proxy.gc_removeRoot( p ); --} - --extern (C) void gc_removeRange( void* p ) --{ -- if( proxy is null ) -- return _gc.removeRange( p ); -- return proxy.gc_removeRange( p ); -+ invariant() -+ { -+ if (inited) -+ { -+ //printf("Gcx.invariant(): this = %p\n", &this); -+ -+ for (size_t i = 0; i < npools; i++) -+ { auto pool = pooltable[i]; -+ -+ pool.Invariant(); -+ if (i == 0) -+ { -+ assert(minAddr == pool.baseAddr); -+ } -+ if (i + 1 < npools) -+ { -+ assert(pool.opCmp(pooltable[i + 1]) < 0); -+ } -+ else if (i + 1 == npools) -+ { -+ assert(maxAddr == pool.topAddr); -+ } -+ } -+ -+ if (roots) -+ { -+ assert(rootdim != 0); -+ assert(nroots <= rootdim); -+ } -+ -+ if (ranges) -+ { -+ assert(rangedim != 0); -+ assert(nranges <= rangedim); -+ -+ for (size_t i = 0; i < nranges; i++) -+ { -+ assert(ranges[i].pbot); -+ assert(ranges[i].ptop); -+ assert(ranges[i].pbot <= ranges[i].ptop); -+ } -+ } -+ -+ for (size_t i = 0; i < B_PAGE; i++) -+ { -+ for (auto list = cast(List*)bucket[i]; list; list = list.next) -+ { -+ } -+ } -+ } -+ } -+ -+ -+ /** -+ * -+ */ -+ void addRoot(void *p) -+ { -+ if (nroots == rootdim) -+ { -+ size_t newdim = rootdim * 2 + 16; -+ void** newroots; -+ -+ newroots = cast(void**)cstdlib.malloc(newdim * newroots[0].sizeof); -+ if (!newroots) -+ onOutOfMemoryError(); -+ if (roots) -+ { memcpy(newroots, roots, nroots * newroots[0].sizeof); -+ cstdlib.free(roots); -+ } -+ roots = newroots; -+ rootdim = newdim; -+ } -+ roots[nroots] = p; -+ nroots++; -+ } -+ -+ -+ /** -+ * -+ */ -+ void removeRoot(void *p) -+ { -+ for (size_t i = nroots; i--;) -+ { -+ if (roots[i] == p) -+ { -+ nroots--; -+ memmove(roots + i, roots + i + 1, (nroots - i) * roots[0].sizeof); -+ return; -+ } -+ } -+ assert(0); -+ } -+ -+ -+ /** -+ * -+ */ -+ int rootIter(int delegate(ref void*) dg) -+ { -+ int result = 0; -+ for (size_t i = 0; i < nroots; ++i) -+ { -+ result = dg(roots[i]); -+ if (result) -+ break; -+ } -+ return result; -+ } -+ -+ -+ /** -+ * -+ */ -+ void addRange(void *pbot, void *ptop) -+ { -+ //debug(PRINTF) printf("Thread %x ", pthread_self()); -+ debug(PRINTF) printf("%p.Gcx::addRange(%p, %p), nranges = %d\n", &this, pbot, ptop, nranges); -+ if (nranges == rangedim) -+ { -+ size_t newdim = rangedim * 2 + 16; -+ Range *newranges; -+ -+ newranges = cast(Range*)cstdlib.malloc(newdim * newranges[0].sizeof); -+ if (!newranges) -+ onOutOfMemoryError(); -+ if (ranges) -+ { memcpy(newranges, ranges, nranges * newranges[0].sizeof); -+ cstdlib.free(ranges); -+ } -+ ranges = newranges; -+ rangedim = newdim; -+ } -+ ranges[nranges].pbot = pbot; -+ ranges[nranges].ptop = ptop; -+ nranges++; -+ } -+ -+ -+ /** -+ * -+ */ -+ void removeRange(void *pbot) -+ { -+ //debug(PRINTF) printf("Thread %x ", pthread_self()); -+ debug(PRINTF) printf("Gcx.removeRange(%p), nranges = %d\n", pbot, nranges); -+ for (size_t i = nranges; i--;) -+ { -+ if (ranges[i].pbot == pbot) -+ { -+ nranges--; -+ memmove(ranges + i, ranges + i + 1, (nranges - i) * ranges[0].sizeof); -+ return; -+ } -+ } -+ debug(PRINTF) printf("Wrong thread\n"); -+ -+ // This is a fatal error, but ignore it. -+ // The problem is that we can get a Close() call on a thread -+ // other than the one the range was allocated on. -+ //assert(zero); -+ } -+ -+ -+ /** -+ * -+ */ -+ int rangeIter(int delegate(ref Range) dg) -+ { -+ int result = 0; -+ for (size_t i = 0; i < nranges; ++i) -+ { -+ result = dg(ranges[i]); -+ if (result) -+ break; -+ } -+ return result; -+ } -+ -+ -+ /** -+ * Find Pool that pointer is in. -+ * Return null if not in a Pool. -+ * Assume pooltable[] is sorted. -+ */ -+ Pool *findPool(void *p) -+ { -+ if (p >= minAddr && p < maxAddr) -+ { -+ if (npools <= 1) -+ { -+ return npools == 0 ? null : pooltable[0]; -+ } -+ -+ /* The pooltable[] is sorted by address, so do a binary search -+ */ -+ auto pt = pooltable; -+ size_t low = 0; -+ size_t high = npools - 1; -+ while (low <= high) -+ { -+ size_t mid = (low + high) >> 1; -+ auto pool = pt[mid]; -+ if (p < pool.baseAddr) -+ high = mid - 1; -+ else if (p >= pool.topAddr) -+ low = mid + 1; -+ else -+ return pool; -+ } -+ } -+ return null; -+ } -+ -+ -+ /** -+ * Find base address of block containing pointer p. -+ * Returns null if not a gc'd pointer -+ */ -+ void* findBase(void *p) -+ { -+ Pool *pool; -+ -+ pool = findPool(p); -+ if (pool) -+ { -+ size_t offset = cast(size_t)(p - pool.baseAddr); -+ size_t pn = offset / PAGESIZE; -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ -+ // Adjust bit to be at start of allocated memory block -+ if (bin <= B_PAGE) -+ { -+ return pool.baseAddr + (offset & notbinsize[bin]); -+ } -+ else if (bin == B_PAGEPLUS) -+ { -+ auto pageOffset = pool.bPageOffsets[pn]; -+ offset -= pageOffset * PAGESIZE; -+ pn -= pageOffset; -+ -+ return pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1))); -+ } -+ else -+ { -+ // we are in a B_FREE page -+ return null; -+ } -+ } -+ return null; -+ } -+ -+ -+ /** -+ * Find size of pointer p. -+ * Returns 0 if not a gc'd pointer -+ */ -+ size_t findSize(void *p) -+ { -+ Pool* pool; -+ size_t size = 0; -+ -+ if (USE_CACHE && p == cached_size_key) -+ return cached_size_val; -+ -+ pool = findPool(p); -+ if (pool) -+ { -+ size_t pagenum; -+ Bins bin; -+ -+ pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -+ bin = cast(Bins)pool.pagetable[pagenum]; -+ size = binsize[bin]; -+ if (bin == B_PAGE) -+ { -+ size = pool.bPageOffsets[pagenum] * PAGESIZE; -+ } -+ cached_size_key = p; -+ cached_size_val = size; -+ } -+ return size; -+ } -+ -+ -+ /** -+ * -+ */ -+ BlkInfo getInfo(void* p) -+ { -+ Pool* pool; -+ BlkInfo info; -+ -+ if (USE_CACHE && p == cached_info_key) -+ return cached_info_val; -+ -+ pool = findPool(p); -+ if (pool) -+ { -+ size_t offset = cast(size_t)(p - pool.baseAddr); -+ size_t pn = offset / PAGESIZE; -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ -+ //////////////////////////////////////////////////////////////////// -+ // findAddr -+ //////////////////////////////////////////////////////////////////// -+ -+ if (bin <= B_PAGE) -+ { -+ info.base = cast(void*)((cast(size_t)p) & notbinsize[bin]); -+ } -+ else if (bin == B_PAGEPLUS) -+ { -+ auto pageOffset = pool.bPageOffsets[pn]; -+ offset = pageOffset * PAGESIZE; -+ pn -= pageOffset; -+ info.base = pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1))); -+ -+ // fix bin for use by size calc below -+ bin = cast(Bins)pool.pagetable[pn]; -+ } -+ -+ //////////////////////////////////////////////////////////////////// -+ // findSize -+ //////////////////////////////////////////////////////////////////// -+ -+ info.size = binsize[bin]; -+ if (bin == B_PAGE) -+ { -+ info.size = pool.bPageOffsets[pn] * PAGESIZE; -+ } -+ -+ //////////////////////////////////////////////////////////////////// -+ // getBits -+ //////////////////////////////////////////////////////////////////// -+ -+ // reset the offset to the base pointer, otherwise the bits -+ // are the bits for the pointer, which may be garbage -+ offset = cast(size_t)(info.base - pool.baseAddr); -+ info.attr = getBits(pool, cast(size_t)(offset >> pool.shiftBy)); -+ -+ cached_info_key = p; -+ cached_info_val = info; -+ } -+ return info; -+ } -+ -+ void updateCaches(void*p, size_t size) -+ { -+ if (USE_CACHE && p == cached_size_key) -+ cached_size_val = size; -+ if (p == cached_info_key) -+ cached_info_val.size = size; -+ } -+ -+ /** -+ * Compute bin for size. -+ */ -+ static Bins findBin(size_t size) -+ { -+ static const byte[2049] binTable = ctfeBins(); -+ -+ return (size <= 2048) ? -+ (cast(Bins) binTable[size]) : -+ B_PAGE; -+ } -+ -+ static Bins findBinImpl(size_t size) -+ { Bins bin; -+ -+ if (size <= 256) -+ { -+ if (size <= 64) -+ { -+ if (size <= 16) -+ bin = B_16; -+ else if (size <= 32) -+ bin = B_32; -+ else -+ bin = B_64; -+ } -+ else -+ { -+ if (size <= 128) -+ bin = B_128; -+ else -+ bin = B_256; -+ } -+ } -+ else -+ { -+ if (size <= 1024) -+ { -+ if (size <= 512) -+ bin = B_512; -+ else -+ bin = B_1024; -+ } -+ else -+ { -+ if (size <= 2048) -+ bin = B_2048; -+ else -+ bin = B_PAGE; -+ } -+ } -+ return bin; -+ } -+ -+ /** -+ * Computes the bin table using CTFE. -+ */ -+ static byte[2049] ctfeBins() -+ { -+ byte[2049] ret; -+ for(size_t i = 0; i < 2049; i++) -+ { -+ ret[i] = cast(byte) findBinImpl(i); -+ } -+ -+ return ret; -+ } -+ -+ -+ /** -+ * Allocate a new pool of at least size bytes. -+ * Sort it into pooltable[]. -+ * Mark all memory in the pool as B_FREE. -+ * Return the actual number of bytes reserved or 0 on error. -+ */ -+ size_t reserve(size_t size) -+ { -+ size_t npages = (size + PAGESIZE - 1) / PAGESIZE; -+ -+ // Assume reserve() is for small objects. -+ Pool* pool = newPool(npages, false); -+ -+ if (!pool) -+ return 0; -+ return pool.npages * PAGESIZE; -+ } -+ -+ -+ /** -+ * Minimizes physical memory usage by returning free pools to the OS. -+ */ -+ void minimize() -+ { -+ debug(PRINTF) printf("Minimizing.\n"); -+ -+ static bool isUsed(Pool *pool) -+ { -+ return pool.freepages < pool.npages; -+ } -+ -+ // semi-stable partition -+ for (size_t i = 0; i < npools; ++i) -+ { -+ auto pool = pooltable[i]; -+ // find first unused pool -+ if (isUsed(pool)) continue; -+ -+ // move used pools before unused ones -+ size_t j = i + 1; -+ for (; j < npools; ++j) -+ { -+ pool = pooltable[j]; -+ if (!isUsed(pool)) continue; -+ // swap -+ pooltable[j] = pooltable[i]; -+ pooltable[i] = pool; -+ ++i; -+ } -+ // npooltable[0 .. i] => used -+ // npooltable[i .. npools] => free -+ -+ // free unused pools -+ for (j = i; j < npools; ++j) -+ { -+ pool = pooltable[j]; -+ debug(PRINTF) printFreeInfo(pool); -+ pool.Dtor(); -+ cstdlib.free(pool); -+ } -+ npools = i; -+ } -+ -+ if (npools) -+ { -+ minAddr = pooltable[0].baseAddr; -+ maxAddr = pooltable[npools - 1].topAddr; -+ } -+ else -+ { -+ minAddr = maxAddr = null; -+ } -+ -+ debug(PRINTF) printf("Done minimizing.\n"); -+ } -+ -+ unittest -+ { -+ enum NPOOLS = 6; -+ enum NPAGES = 10; -+ Gcx gcx; -+ -+ void reset() -+ { -+ foreach(i, ref pool; gcx.pooltable[0 .. gcx.npools]) -+ pool.freepages = pool.npages; -+ gcx.minimize(); -+ assert(gcx.npools == 0); -+ -+ if (gcx.pooltable is null) -+ gcx.pooltable = cast(Pool**)cstdlib.malloc(NPOOLS * (Pool*).sizeof); -+ foreach(i; 0 .. NPOOLS) -+ { -+ auto pool = cast(Pool*)cstdlib.malloc(Pool.sizeof); -+ *pool = Pool.init; -+ gcx.pooltable[i] = pool; -+ } -+ gcx.npools = NPOOLS; -+ } -+ -+ void usePools() -+ { -+ foreach(pool; gcx.pooltable[0 .. NPOOLS]) -+ { -+ pool.pagetable = cast(ubyte*)cstdlib.malloc(NPAGES); -+ memset(pool.pagetable, B_FREE, NPAGES); -+ pool.npages = NPAGES; -+ pool.freepages = NPAGES / 2; -+ } -+ } -+ -+ // all pools are free -+ reset(); -+ assert(gcx.npools == NPOOLS); -+ gcx.minimize(); -+ assert(gcx.npools == 0); -+ -+ // all pools used -+ reset(); -+ usePools(); -+ assert(gcx.npools == NPOOLS); -+ gcx.minimize(); -+ assert(gcx.npools == NPOOLS); -+ -+ // preserves order of used pools -+ reset(); -+ usePools(); -+ -+ { -+ version (Bug7068_FIXED) -+ Pool*[NPOOLS] opools = gcx.pooltable[0 .. NPOOLS]; -+ else -+ { -+ Pool*[NPOOLS] opools = void; -+ memcpy(opools.ptr, gcx.pooltable, (Pool*).sizeof * NPOOLS); -+ } -+ gcx.pooltable[2].freepages = NPAGES; -+ -+ gcx.minimize(); -+ assert(gcx.npools == NPOOLS - 1); -+ assert(gcx.pooltable[0] == opools[0]); -+ assert(gcx.pooltable[1] == opools[1]); -+ assert(gcx.pooltable[2] == opools[3]); -+ } -+ -+ // gcx reduces address span -+ reset(); -+ usePools(); -+ -+ byte* base, top; -+ -+ { -+ byte*[NPOOLS] mem = void; -+ foreach(i; 0 .. NPOOLS) -+ mem[i] = cast(byte*)os_mem_map(NPAGES * PAGESIZE); -+ -+ extern(C) static int compare(in void* p1, in void *p2) -+ { -+ return p1 < p2 ? -1 : cast(int)(p2 > p1); -+ } -+ cstdlib.qsort(mem.ptr, mem.length, (byte*).sizeof, &compare); -+ -+ foreach(i, pool; gcx.pooltable[0 .. NPOOLS]) -+ { -+ pool.baseAddr = mem[i]; -+ pool.topAddr = pool.baseAddr + NPAGES * PAGESIZE; -+ } -+ -+ base = gcx.pooltable[0].baseAddr; -+ top = gcx.pooltable[NPOOLS - 1].topAddr; -+ } -+ -+ gcx.minimize(); -+ assert(gcx.npools == NPOOLS); -+ assert(gcx.minAddr == base); -+ assert(gcx.maxAddr == top); -+ -+ gcx.pooltable[NPOOLS - 1].freepages = NPAGES; -+ gcx.pooltable[NPOOLS - 2].freepages = NPAGES; -+ -+ gcx.minimize(); -+ assert(gcx.npools == NPOOLS - 2); -+ assert(gcx.minAddr == base); -+ assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 3].topAddr); -+ -+ gcx.pooltable[0].freepages = NPAGES; -+ -+ gcx.minimize(); -+ assert(gcx.npools == NPOOLS - 3); -+ assert(gcx.minAddr != base); -+ assert(gcx.minAddr == gcx.pooltable[0].baseAddr); -+ assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 4].topAddr); -+ -+ // free all -+ foreach(pool; gcx.pooltable[0 .. gcx.npools]) -+ pool.freepages = NPAGES; -+ gcx.minimize(); -+ assert(gcx.npools == 0); -+ cstdlib.free(gcx.pooltable); -+ gcx.pooltable = null; -+ } -+ -+ -+ /** -+ * Allocate a chunk of memory that is larger than a page. -+ * Return null if out of memory. -+ */ -+ void *bigAlloc(size_t size, Pool **poolPtr, size_t *alloc_size = null) -+ { -+ debug(PRINTF) printf("In bigAlloc. Size: %d\n", size); -+ -+ Pool* pool; -+ size_t npages; -+ size_t n; -+ size_t pn; -+ size_t freedpages; -+ void* p; -+ int state; -+ bool collected = false; -+ -+ npages = (size + PAGESIZE - 1) / PAGESIZE; -+ -+ for (state = disabled ? 1 : 0; ; ) -+ { -+ // This code could use some refinement when repeatedly -+ // allocating very large arrays. -+ -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ if(!pool.isLargeObject || pool.freepages < npages) continue; -+ pn = pool.allocPages(npages); -+ if (pn != OPFAIL) -+ goto L1; -+ } -+ -+ // Failed -+ switch (state) -+ { -+ case 0: -+ // Try collecting -+ collected = true; -+ freedpages = fullcollect(); -+ if (freedpages >= npools * ((POOLSIZE / PAGESIZE) / 4)) -+ { state = 1; -+ continue; -+ } -+ // Release empty pools to prevent bloat -+ minimize(); -+ // Allocate new pool -+ pool = newPool(npages, true); -+ if (!pool) -+ { state = 2; -+ continue; -+ } -+ pn = pool.allocPages(npages); -+ assert(pn != OPFAIL); -+ goto L1; -+ case 1: -+ // Release empty pools to prevent bloat -+ minimize(); -+ // Allocate new pool -+ pool = newPool(npages, true); -+ if (!pool) -+ { -+ if (collected) -+ goto Lnomemory; -+ state = 0; -+ continue; -+ } -+ pn = pool.allocPages(npages); -+ assert(pn != OPFAIL); -+ goto L1; -+ case 2: -+ goto Lnomemory; -+ default: -+ assert(false); -+ } -+ } -+ -+ L1: -+ debug(PRINTF) printFreeInfo(pool); -+ pool.pagetable[pn] = B_PAGE; -+ if (npages > 1) -+ memset(&pool.pagetable[pn + 1], B_PAGEPLUS, npages - 1); -+ pool.updateOffsets(pn); -+ pool.freepages -= npages; -+ -+ debug(PRINTF) printFreeInfo(pool); -+ -+ p = pool.baseAddr + pn * PAGESIZE; -+ debug(PRINTF) printf("Got large alloc: %p, pt = %d, np = %d\n", p, pool.pagetable[pn], npages); -+ debug (MEMSTOMP) memset(p, 0xF1, size); -+ if(alloc_size) -+ *alloc_size = npages * PAGESIZE; -+ //debug(PRINTF) printf("\tp = %p\n", p); -+ -+ *poolPtr = pool; -+ return p; -+ -+ Lnomemory: -+ return null; // let caller handle the error -+ } -+ -+ -+ /** -+ * Allocate a new pool with at least npages in it. -+ * Sort it into pooltable[]. -+ * Return null if failed. -+ */ -+ Pool *newPool(size_t npages, bool isLargeObject) -+ { -+ Pool* pool; -+ Pool** newpooltable; -+ size_t newnpools; -+ size_t i; -+ -+ //debug(PRINTF) printf("************Gcx::newPool(npages = %d)****************\n", npages); -+ -+ // Minimum of POOLSIZE -+ if (npages < POOLSIZE/PAGESIZE) -+ npages = POOLSIZE/PAGESIZE; -+ else if (npages > POOLSIZE/PAGESIZE) -+ { // Give us 150% of requested size, so there's room to extend -+ auto n = npages + (npages >> 1); -+ if (n < size_t.max/PAGESIZE) -+ npages = n; -+ } -+ -+ // Allocate successively larger pools up to 8 megs -+ if (npools) -+ { size_t n; -+ -+ n = npools; -+ if (n > 32) -+ n = 32; // cap pool size at 32 megs -+ else if (n > 8) -+ n = 16; -+ n *= (POOLSIZE / PAGESIZE); -+ if (npages < n) -+ npages = n; -+ } -+ -+ //printf("npages = %d\n", npages); -+ -+ pool = cast(Pool *)cstdlib.calloc(1, Pool.sizeof); -+ if (pool) -+ { -+ pool.initialize(npages, isLargeObject); -+ if (!pool.baseAddr) -+ goto Lerr; -+ -+ newnpools = npools + 1; -+ newpooltable = cast(Pool **)cstdlib.realloc(pooltable, newnpools * (Pool *).sizeof); -+ if (!newpooltable) -+ goto Lerr; -+ -+ // Sort pool into newpooltable[] -+ for (i = 0; i < npools; i++) -+ { -+ if (pool.opCmp(newpooltable[i]) < 0) -+ break; -+ } -+ memmove(newpooltable + i + 1, newpooltable + i, (npools - i) * (Pool *).sizeof); -+ newpooltable[i] = pool; -+ -+ pooltable = newpooltable; -+ npools = newnpools; -+ -+ minAddr = pooltable[0].baseAddr; -+ maxAddr = pooltable[npools - 1].topAddr; -+ } -+ return pool; -+ -+ Lerr: -+ pool.Dtor(); -+ cstdlib.free(pool); -+ return null; -+ } -+ -+ -+ /** -+ * Allocate a page of bin's. -+ * Returns: -+ * 0 failed -+ */ -+ int allocPage(Bins bin) -+ { -+ Pool* pool; -+ size_t n; -+ size_t pn; -+ byte* p; -+ byte* ptop; -+ -+ //debug(PRINTF) printf("Gcx::allocPage(bin = %d)\n", bin); -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ if(pool.isLargeObject) continue; -+ pn = pool.allocPages(1); -+ if (pn != OPFAIL) -+ goto L1; -+ } -+ return 0; // failed -+ -+ L1: -+ pool.pagetable[pn] = cast(ubyte)bin; -+ pool.freepages--; -+ -+ // Convert page to free list -+ size_t size = binsize[bin]; -+ List **b = &bucket[bin]; -+ -+ p = pool.baseAddr + pn * PAGESIZE; -+ ptop = p + PAGESIZE; -+ for (; p < ptop; p += size) -+ { -+ (cast(List *)p).next = *b; -+ (cast(List *)p).pool = pool; -+ *b = cast(List *)p; -+ } -+ return 1; -+ } -+ -+ /** -+ * Mark overload for initial mark() call. -+ */ -+ void mark(void *pbot, void *ptop) { -+ mark(pbot, ptop, MAX_MARK_RECURSIONS); -+ } -+ -+ /** -+ * Search a range of memory values and mark any pointers into the GC pool. -+ */ -+ void mark(void *pbot, void *ptop, int nRecurse) -+ { -+ //import core.stdc.stdio;printf("nRecurse = %d\n", nRecurse); -+ void **p1 = cast(void **)pbot; -+ void **p2 = cast(void **)ptop; -+ size_t pcache = 0; -+ uint changes = 0; -+ -+ //printf("marking range: %p -> %p\n", pbot, ptop); -+ for (; p1 < p2; p1++) -+ { -+ auto p = cast(byte *)(*p1); -+ -+ //if (log) debug(PRINTF) printf("\tmark %p\n", p); -+ if (p >= minAddr && p < maxAddr) -+ { -+ if ((cast(size_t)p & ~cast(size_t)(PAGESIZE-1)) == pcache) -+ continue; -+ -+ auto pool = findPool(p); -+ if (pool) -+ { -+ size_t offset = cast(size_t)(p - pool.baseAddr); -+ size_t biti = void; -+ size_t pn = offset / PAGESIZE; -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ void* base = void; -+ -+ // For the NO_INTERIOR attribute. This tracks whether -+ // the pointer is an interior pointer or points to the -+ // base address of a block. -+ bool pointsToBase = false; -+ -+ //debug(PRINTF) printf("\t\tfound pool %p, base=%p, pn = %zd, bin = %d, biti = x%x\n", pool, pool.baseAddr, pn, bin, biti); -+ -+ // Adjust bit to be at start of allocated memory block -+ if (bin < B_PAGE) -+ { -+ // We don't care abou setting pointsToBase correctly -+ // because it's ignored for small object pools anyhow. -+ auto offsetBase = offset & notbinsize[bin]; -+ biti = offsetBase >> pool.shiftBy; -+ base = pool.baseAddr + offsetBase; -+ //debug(PRINTF) printf("\t\tbiti = x%x\n", biti); -+ } -+ else if (bin == B_PAGE) -+ { -+ auto offsetBase = offset & notbinsize[bin]; -+ base = pool.baseAddr + offsetBase; -+ pointsToBase = offsetBase == offset; -+ biti = offsetBase >> pool.shiftBy; -+ //debug(PRINTF) printf("\t\tbiti = x%x\n", biti); -+ -+ pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1); -+ } -+ else if (bin == B_PAGEPLUS) -+ { -+ pn -= pool.bPageOffsets[pn]; -+ base = pool.baseAddr + (pn * PAGESIZE); -+ biti = pn * (PAGESIZE >> pool.shiftBy); -+ pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1); -+ } -+ else -+ { -+ // Don't mark bits in B_FREE pages -+ continue; -+ } -+ -+ if(pool.nointerior.nbits && !pointsToBase && pool.nointerior.test(biti)) -+ { -+ continue; -+ } -+ -+ //debug(PRINTF) printf("\t\tmark(x%x) = %d\n", biti, pool.mark.test(biti)); -+ if (!pool.mark.testSet(biti)) -+ { -+ //if (log) debug(PRINTF) printf("\t\tmarking %p\n", p); -+ if (!pool.noscan.test(biti)) -+ { -+ if(nRecurse == 0) { -+ // Then we've got a really deep heap graph. -+ // Start marking stuff to be scanned when we -+ // traverse the heap again next time, to save -+ // stack space. -+ pool.scan.set(biti); -+ changes = 1; -+ pool.newChanges = true; -+ } else { -+ // Directly recurse mark() to prevent having -+ // to traverse the heap O(D) times where D -+ // is the max depth of the heap graph. -+ if (bin < B_PAGE) -+ { -+ mark(base, base + binsize[bin], nRecurse - 1); -+ } -+ else -+ { -+ auto u = pool.bPageOffsets[pn]; -+ mark(base, base + u * PAGESIZE, nRecurse - 1); -+ } -+ } -+ } -+ -+ debug (LOGGING) log_parent(sentinel_add(pool.baseAddr + (biti << pool.shiftBy)), sentinel_add(pbot)); -+ } -+ } -+ } -+ } -+ anychanges |= changes; -+ } -+ -+ -+ /** -+ * Return number of full pages free'd. -+ */ -+ size_t fullcollect() -+ { -+ size_t n; -+ Pool* pool; -+ -+ debug(PROFILING) -+ { -+ clock_t start, stop; -+ start = clock(); -+ } -+ -+ debug(COLLECT_PRINTF) printf("Gcx.fullcollect()\n"); -+ //printf("\tpool address range = %p .. %p\n", minAddr, maxAddr); -+ -+ if (running) -+ onInvalidMemoryOperationError(); -+ running = 1; -+ -+ thread_suspendAll(); -+ -+ cached_size_key = cached_size_key.init; -+ cached_size_val = cached_size_val.init; -+ cached_info_key = cached_info_key.init; -+ cached_info_val = cached_info_val.init; -+ -+ anychanges = 0; -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ pool.mark.zero(); -+ pool.scan.zero(); -+ if(!pool.isLargeObject) pool.freebits.zero(); -+ } -+ -+ debug(COLLECT_PRINTF) printf("Set bits\n"); -+ -+ // Mark each free entry, so it doesn't get scanned -+ for (n = 0; n < B_PAGE; n++) -+ { -+ for (List *list = bucket[n]; list; list = list.next) -+ { -+ pool = list.pool; -+ assert(pool); -+ pool.freebits.set(cast(size_t)(cast(byte*)list - pool.baseAddr) / 16); -+ } -+ } -+ -+ debug(COLLECT_PRINTF) printf("Marked free entries.\n"); -+ -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ pool.newChanges = false; // Some of these get set to true on stack scan. -+ if(!pool.isLargeObject) -+ { -+ pool.mark.copy(&pool.freebits); -+ } -+ } -+ -+ debug(PROFILING) -+ { -+ stop = clock(); -+ prepTime += (stop - start); -+ start = stop; -+ } -+ -+ if (!noStack) -+ { -+ debug(COLLECT_PRINTF) printf("\tscan stacks.\n"); -+ // Scan stacks and registers for each paused thread -+ thread_scanAll(&mark); -+ } -+ -+ // Scan roots[] -+ debug(COLLECT_PRINTF) printf("\tscan roots[]\n"); -+ mark(roots, roots + nroots); -+ -+ // Scan ranges[] -+ debug(COLLECT_PRINTF) printf("\tscan ranges[]\n"); -+ //log++; -+ for (n = 0; n < nranges; n++) -+ { -+ debug(COLLECT_PRINTF) printf("\t\t%p .. %p\n", ranges[n].pbot, ranges[n].ptop); -+ mark(ranges[n].pbot, ranges[n].ptop); -+ } -+ //log--; -+ -+ debug(COLLECT_PRINTF) printf("\tscan heap\n"); -+ int nTraversals; -+ while (anychanges) -+ { -+ //import core.stdc.stdio; printf("nTraversals = %d\n", ++nTraversals); -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ pool.oldChanges = pool.newChanges; -+ pool.newChanges = false; -+ } -+ -+ debug(COLLECT_PRINTF) printf("\t\tpass\n"); -+ anychanges = 0; -+ for (n = 0; n < npools; n++) -+ { -+ pool = pooltable[n]; -+ if(!pool.oldChanges) continue; -+ -+ auto shiftBy = pool.shiftBy; -+ auto bbase = pool.scan.base(); -+ auto btop = bbase + pool.scan.nwords; -+ //printf("\t\tn = %d, bbase = %p, btop = %p\n", n, bbase, btop); -+ for (auto b = bbase; b < btop;) -+ { -+ auto bitm = *b; -+ if (!bitm) -+ { b++; -+ continue; -+ } -+ *b = 0; -+ -+ auto o = pool.baseAddr + (b - bbase) * ((typeof(bitm).sizeof*8) << shiftBy); -+ -+ auto firstset = bsf(bitm); -+ bitm >>= firstset; -+ o += firstset << shiftBy; -+ -+ while(bitm) -+ { -+ auto pn = cast(size_t)(o - pool.baseAddr) / PAGESIZE; -+ auto bin = cast(Bins)pool.pagetable[pn]; -+ if (bin < B_PAGE) -+ { -+ mark(o, o + binsize[bin]); -+ } -+ else if (bin == B_PAGE) -+ { -+ auto u = pool.bPageOffsets[pn]; -+ mark(o, o + u * PAGESIZE); -+ } -+ -+ bitm >>= 1; -+ auto nbits = bsf(bitm); -+ bitm >>= nbits; -+ o += (nbits + 1) << shiftBy; -+ } -+ } -+ } -+ } -+ -+ thread_processGCMarks(&isMarked); -+ thread_resumeAll(); -+ -+ debug(PROFILING) -+ { -+ stop = clock(); -+ markTime += (stop - start); -+ start = stop; -+ } -+ -+ // Free up everything not marked -+ debug(COLLECT_PRINTF) printf("\tfree'ing\n"); -+ size_t freedpages = 0; -+ size_t freed = 0; -+ for (n = 0; n < npools; n++) -+ { size_t pn; -+ -+ pool = pooltable[n]; -+ -+ if(pool.isLargeObject) -+ { -+ for(pn = 0; pn < pool.npages; pn++) -+ { -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ if(bin > B_PAGE) continue; -+ size_t biti = pn; -+ -+ if (!pool.mark.test(biti)) -+ { byte *p = pool.baseAddr + pn * PAGESIZE; -+ -+ sentinel_Invariant(sentinel_add(p)); -+ if (pool.finals.nbits && pool.finals.testClear(biti)) -+ rt_finalize2(sentinel_add(p), false, false); -+ clrBits(pool, biti, ~BlkAttr.NONE ^ BlkAttr.FINALIZE); -+ -+ debug(COLLECT_PRINTF) printf("\tcollecting big %p\n", p); -+ log_free(sentinel_add(p)); -+ pool.pagetable[pn] = B_FREE; -+ if(pn < pool.searchStart) pool.searchStart = pn; -+ freedpages++; -+ pool.freepages++; -+ -+ debug (MEMSTOMP) memset(p, 0xF3, PAGESIZE); -+ while (pn + 1 < pool.npages && pool.pagetable[pn + 1] == B_PAGEPLUS) -+ { -+ pn++; -+ pool.pagetable[pn] = B_FREE; -+ -+ // Don't need to update searchStart here because -+ // pn is guaranteed to be greater than last time -+ // we updated it. -+ -+ pool.freepages++; -+ freedpages++; -+ -+ debug (MEMSTOMP) -+ { p += PAGESIZE; -+ memset(p, 0xF3, PAGESIZE); -+ } -+ } -+ } -+ } -+ -+ continue; -+ } -+ else -+ { -+ -+ for (pn = 0; pn < pool.npages; pn++) -+ { -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ -+ if (bin < B_PAGE) -+ { -+ auto size = binsize[bin]; -+ byte *p = pool.baseAddr + pn * PAGESIZE; -+ byte *ptop = p + PAGESIZE; -+ size_t biti = pn * (PAGESIZE/16); -+ size_t bitstride = size / 16; -+ -+ GCBits.wordtype toClear; -+ size_t clearStart = (biti >> GCBits.BITS_SHIFT) + 1; -+ size_t clearIndex; -+ -+ for (; p < ptop; p += size, biti += bitstride, clearIndex += bitstride) -+ { -+ if(clearIndex > GCBits.BITS_PER_WORD - 1) -+ { -+ if(toClear) -+ { -+ Gcx.clrBitsSmallSweep(pool, clearStart, toClear); -+ toClear = 0; -+ } -+ -+ clearStart = (biti >> GCBits.BITS_SHIFT) + 1; -+ clearIndex = biti & GCBits.BITS_MASK; -+ } -+ -+ if (!pool.mark.test(biti)) -+ { -+ sentinel_Invariant(sentinel_add(p)); -+ -+ pool.freebits.set(biti); -+ if (pool.finals.nbits && pool.finals.test(biti)) -+ rt_finalize2(sentinel_add(p), false, false); -+ toClear |= GCBits.BITS_1 << clearIndex; -+ -+ List *list = cast(List *)p; -+ debug(PRINTF) printf("\tcollecting %p\n", list); -+ log_free(sentinel_add(list)); -+ -+ debug (MEMSTOMP) memset(p, 0xF3, size); -+ -+ freed += size; -+ } -+ } -+ -+ if(toClear) -+ { -+ Gcx.clrBitsSmallSweep(pool, clearStart, toClear); -+ } -+ } -+ } -+ } -+ } -+ -+ debug(PROFILING) -+ { -+ stop = clock(); -+ sweepTime += (stop - start); -+ start = stop; -+ } -+ -+ // Zero buckets -+ bucket[] = null; -+ -+ // Free complete pages, rebuild free list -+ debug(COLLECT_PRINTF) printf("\tfree complete pages\n"); -+ size_t recoveredpages = 0; -+ for (n = 0; n < npools; n++) -+ { size_t pn; -+ -+ pool = pooltable[n]; -+ if(pool.isLargeObject) continue; -+ for (pn = 0; pn < pool.npages; pn++) -+ { -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ size_t biti; -+ size_t u; -+ -+ if (bin < B_PAGE) -+ { -+ size_t size = binsize[bin]; -+ size_t bitstride = size / 16; -+ size_t bitbase = pn * (PAGESIZE / 16); -+ size_t bittop = bitbase + (PAGESIZE / 16); -+ byte* p; -+ -+ biti = bitbase; -+ for (biti = bitbase; biti < bittop; biti += bitstride) -+ { if (!pool.freebits.test(biti)) -+ goto Lnotfree; -+ } -+ pool.pagetable[pn] = B_FREE; -+ if(pn < pool.searchStart) pool.searchStart = pn; -+ pool.freepages++; -+ recoveredpages++; -+ continue; -+ -+ Lnotfree: -+ p = pool.baseAddr + pn * PAGESIZE; -+ for (u = 0; u < PAGESIZE; u += size) -+ { biti = bitbase + u / 16; -+ if (pool.freebits.test(biti)) -+ { List *list; -+ -+ list = cast(List *)(p + u); -+ if (list.next != bucket[bin]) // avoid unnecessary writes -+ list.next = bucket[bin]; -+ list.pool = pool; -+ bucket[bin] = list; -+ } -+ } -+ } -+ } -+ } -+ -+ debug(PROFILING) -+ { -+ stop = clock(); -+ recoverTime += (stop - start); -+ } -+ -+ debug(COLLECT_PRINTF) printf("\trecovered pages = %d\n", recoveredpages); -+ debug(COLLECT_PRINTF) printf("\tfree'd %u bytes, %u pages from %u pools\n", freed, freedpages, npools); -+ -+ running = 0; // only clear on success -+ -+ return freedpages + recoveredpages; -+ } -+ -+ /** -+ * Returns true if the addr lies within a marked block. -+ * -+ * Warning! This should only be called while the world is stopped inside -+ * the fullcollect function. -+ */ -+ IsMarked isMarked(void *addr) -+ { -+ // first, we find the Pool this block is in, then check to see if the -+ // mark bit is clear. -+ auto pool = findPool(addr); -+ if(pool) -+ { -+ auto offset = cast(size_t)(addr - pool.baseAddr); -+ auto pn = offset / PAGESIZE; -+ auto bins = cast(Bins)pool.pagetable[pn]; -+ size_t biti = void; -+ if(bins <= B_PAGE) -+ { -+ biti = (offset & notbinsize[bins]) >> pool.shiftBy; -+ } -+ else -+ { -+ pn -= pool.bPageOffsets[pn]; -+ biti = pn * (PAGESIZE >> pool.shiftBy); -+ } -+ return pool.mark.test(biti) ? IsMarked.yes : IsMarked.no; -+ } -+ return IsMarked.unknown; -+ } -+ -+ -+ /** -+ * -+ */ -+ uint getBits(Pool* pool, size_t biti) -+ in -+ { -+ assert(pool); -+ } -+ body -+ { -+ uint bits; -+ -+ if (pool.finals.nbits && -+ pool.finals.test(biti)) -+ bits |= BlkAttr.FINALIZE; -+ if (pool.noscan.test(biti)) -+ bits |= BlkAttr.NO_SCAN; -+ if (pool.nointerior.nbits && pool.nointerior.test(biti)) -+ bits |= BlkAttr.NO_INTERIOR; -+// if (pool.nomove.nbits && -+// pool.nomove.test(biti)) -+// bits |= BlkAttr.NO_MOVE; -+ if (pool.appendable.test(biti)) -+ bits |= BlkAttr.APPENDABLE; -+ return bits; -+ } -+ -+ -+ /** -+ * -+ */ -+ void setBits(Pool* pool, size_t biti, uint mask) -+ in -+ { -+ assert(pool); -+ } -+ body -+ { -+ // Calculate the mask and bit offset once and then use it to -+ // set all of the bits we need to set. -+ immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT); -+ immutable bitOffset = biti & GCBits.BITS_MASK; -+ immutable orWith = GCBits.BITS_1 << bitOffset; -+ -+ if (mask & BlkAttr.FINALIZE) -+ { -+ if (!pool.finals.nbits) -+ pool.finals.alloc(pool.mark.nbits); -+ pool.finals.data[dataIndex] |= orWith; -+ } -+ if (mask & BlkAttr.NO_SCAN) -+ { -+ pool.noscan.data[dataIndex] |= orWith; -+ } -+// if (mask & BlkAttr.NO_MOVE) -+// { -+// if (!pool.nomove.nbits) -+// pool.nomove.alloc(pool.mark.nbits); -+// pool.nomove.data[dataIndex] |= orWith; -+// } -+ if (mask & BlkAttr.APPENDABLE) -+ { -+ pool.appendable.data[dataIndex] |= orWith; -+ } -+ -+ if (pool.isLargeObject && (mask & BlkAttr.NO_INTERIOR)) -+ { -+ if(!pool.nointerior.nbits) -+ pool.nointerior.alloc(pool.mark.nbits); -+ pool.nointerior.data[dataIndex] |= orWith; -+ } -+ } -+ -+ -+ /** -+ * -+ */ -+ void clrBits(Pool* pool, size_t biti, uint mask) -+ in -+ { -+ assert(pool); -+ } -+ body -+ { -+ immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT); -+ immutable bitOffset = biti & GCBits.BITS_MASK; -+ immutable keep = ~(GCBits.BITS_1 << bitOffset); -+ -+ if (mask & BlkAttr.FINALIZE && pool.finals.nbits) -+ pool.finals.data[dataIndex] &= keep; -+ if (mask & BlkAttr.NO_SCAN) -+ pool.noscan.data[dataIndex] &= keep; -+// if (mask & BlkAttr.NO_MOVE && pool.nomove.nbits) -+// pool.nomove.data[dataIndex] &= keep; -+ if (mask & BlkAttr.APPENDABLE) -+ pool.appendable.data[dataIndex] &= keep; -+ if (pool.nointerior.nbits && (mask & BlkAttr.NO_INTERIOR)) -+ pool.nointerior.data[dataIndex] &= keep; -+ } -+ -+ void clrBitsSmallSweep(Pool* pool, size_t dataIndex, GCBits.wordtype toClear) -+ in -+ { -+ assert(pool); -+ } -+ body -+ { -+ immutable toKeep = ~toClear; -+ if (pool.finals.nbits) -+ pool.finals.data[dataIndex] &= toKeep; -+ -+ pool.noscan.data[dataIndex] &= toKeep; -+ -+// if (pool.nomove.nbits) -+// pool.nomove.data[dataIndex] &= toKeep; -+ -+ pool.appendable.data[dataIndex] &= toKeep; -+ -+ if (pool.nointerior.nbits) -+ pool.nointerior.data[dataIndex] &= toKeep; -+ } -+ -+ /***** Leak Detector ******/ -+ -+ -+ debug (LOGGING) -+ { -+ LogArray current; -+ LogArray prev; -+ -+ -+ void log_init() -+ { -+ //debug(PRINTF) printf("+log_init()\n"); -+ current.reserve(1000); -+ prev.reserve(1000); -+ //debug(PRINTF) printf("-log_init()\n"); -+ } -+ -+ -+ void log_malloc(void *p, size_t size) -+ { -+ //debug(PRINTF) printf("+log_malloc(p = %p, size = %zd)\n", p, size); -+ Log log; -+ -+ log.p = p; -+ log.size = size; -+ log.line = GC.line; -+ log.file = GC.file; -+ log.parent = null; -+ -+ GC.line = 0; -+ GC.file = null; -+ -+ current.push(log); -+ //debug(PRINTF) printf("-log_malloc()\n"); -+ } -+ -+ -+ void log_free(void *p) -+ { -+ //debug(PRINTF) printf("+log_free(%p)\n", p); -+ auto i = current.find(p); -+ if (i == OPFAIL) -+ { -+ debug(PRINTF) printf("free'ing unallocated memory %p\n", p); -+ } -+ else -+ current.remove(i); -+ //debug(PRINTF) printf("-log_free()\n"); -+ } -+ -+ -+ void log_collect() -+ { -+ //debug(PRINTF) printf("+log_collect()\n"); -+ // Print everything in current that is not in prev -+ -+ debug(PRINTF) printf("New pointers this cycle: --------------------------------\n"); -+ size_t used = 0; -+ for (size_t i = 0; i < current.dim; i++) -+ { -+ auto j = prev.find(current.data[i].p); -+ if (j == OPFAIL) -+ current.data[i].print(); -+ else -+ used++; -+ } -+ -+ debug(PRINTF) printf("All roots this cycle: --------------------------------\n"); -+ for (size_t i = 0; i < current.dim; i++) -+ { -+ void* p = current.data[i].p; -+ if (!findPool(current.data[i].parent)) -+ { -+ auto j = prev.find(current.data[i].p); -+ debug(PRINTF) printf(j == OPFAIL ? "N" : " "); -+ current.data[i].print(); -+ } -+ } -+ -+ debug(PRINTF) printf("Used = %d-------------------------------------------------\n", used); -+ prev.copy(¤t); -+ -+ debug(PRINTF) printf("-log_collect()\n"); -+ } -+ -+ -+ void log_parent(void *p, void *parent) -+ { -+ //debug(PRINTF) printf("+log_parent()\n"); -+ auto i = current.find(p); -+ if (i == OPFAIL) -+ { -+ debug(PRINTF) printf("parent'ing unallocated memory %p, parent = %p\n", p, parent); -+ Pool *pool; -+ pool = findPool(p); -+ assert(pool); -+ size_t offset = cast(size_t)(p - pool.baseAddr); -+ size_t biti; -+ size_t pn = offset / PAGESIZE; -+ Bins bin = cast(Bins)pool.pagetable[pn]; -+ biti = (offset & notbinsize[bin]); -+ debug(PRINTF) printf("\tbin = %d, offset = x%x, biti = x%x\n", bin, offset, biti); -+ } -+ else -+ { -+ current.data[i].parent = parent; -+ } -+ //debug(PRINTF) printf("-log_parent()\n"); -+ } -+ -+ } -+ else -+ { -+ void log_init() { } -+ void log_malloc(void *p, size_t size) { } -+ void log_free(void *p) { } -+ void log_collect() { } -+ void log_parent(void *p, void *parent) { } -+ } - } - --extern (C) Proxy* gc_getProxy() -+ -+/* ============================ Pool =============================== */ -+ -+ -+struct Pool - { -- return &pthis; -+ byte* baseAddr; -+ byte* topAddr; -+ GCBits mark; // entries already scanned, or should not be scanned -+ GCBits scan; // entries that need to be scanned -+ GCBits freebits; // entries that are on the free list -+ GCBits finals; // entries that need finalizer run on them -+ GCBits noscan; // entries that should not be scanned -+ GCBits appendable; // entries that are appendable -+ GCBits nointerior; // interior pointers should be ignored. -+ // Only implemented for large object pools. -+ -+ size_t npages; -+ size_t freepages; // The number of pages not in use. -+ ubyte* pagetable; -+ -+ bool isLargeObject; -+ bool oldChanges; // Whether there were changes on the last mark. -+ bool newChanges; // Whether there were changes on the current mark. -+ -+ // This tracks how far back we have to go to find the nearest B_PAGE at -+ // a smaller address than a B_PAGEPLUS. To save space, we use a uint. -+ // This limits individual allocations to 16 terabytes, assuming a 4k -+ // pagesize. -+ uint* bPageOffsets; -+ -+ // This variable tracks a conservative estimate of where the first free -+ // page in this pool is, so that if a lot of pages towards the beginning -+ // are occupied, we can bypass them in O(1). -+ size_t searchStart; -+ -+ void initialize(size_t npages, bool isLargeObject) -+ { -+ this.isLargeObject = isLargeObject; -+ size_t poolsize; -+ -+ //debug(PRINTF) printf("Pool::Pool(%u)\n", npages); -+ poolsize = npages * PAGESIZE; -+ assert(poolsize >= POOLSIZE); -+ baseAddr = cast(byte *)os_mem_map(poolsize); -+ -+ // Some of the code depends on page alignment of memory pools -+ assert((cast(size_t)baseAddr & (PAGESIZE - 1)) == 0); -+ -+ if (!baseAddr) -+ { -+ //debug(PRINTF) printf("GC fail: poolsize = x%zx, errno = %d\n", poolsize, errno); -+ //debug(PRINTF) printf("message = '%s'\n", sys_errlist[errno]); -+ -+ npages = 0; -+ poolsize = 0; -+ } -+ //assert(baseAddr); -+ topAddr = baseAddr + poolsize; -+ auto div = this.divisor; -+ auto nbits = cast(size_t)poolsize / div; -+ -+ mark.alloc(nbits); -+ scan.alloc(nbits); -+ -+ // pagetable already keeps track of what's free for the large object -+ // pool. -+ if(!isLargeObject) -+ { -+ freebits.alloc(nbits); -+ } -+ -+ noscan.alloc(nbits); -+ appendable.alloc(nbits); -+ -+ pagetable = cast(ubyte*)cstdlib.malloc(npages); -+ if (!pagetable) -+ onOutOfMemoryError(); -+ -+ if(isLargeObject) -+ { -+ bPageOffsets = cast(uint*)cstdlib.malloc(npages * uint.sizeof); -+ if (!bPageOffsets) -+ onOutOfMemoryError(); -+ } -+ -+ memset(pagetable, B_FREE, npages); -+ -+ this.npages = npages; -+ this.freepages = npages; -+ } -+ -+ -+ void Dtor() -+ { -+ if (baseAddr) -+ { -+ int result; -+ -+ if (npages) -+ { -+ result = os_mem_unmap(baseAddr, npages * PAGESIZE); -+ assert(result == 0); -+ npages = 0; -+ } -+ -+ baseAddr = null; -+ topAddr = null; -+ } -+ if (pagetable) -+ { -+ cstdlib.free(pagetable); -+ pagetable = null; -+ } -+ -+ if(bPageOffsets) -+ cstdlib.free(bPageOffsets); -+ -+ mark.Dtor(); -+ scan.Dtor(); -+ if(isLargeObject) -+ { -+ nointerior.Dtor(); -+ } -+ else -+ { -+ freebits.Dtor(); -+ } -+ finals.Dtor(); -+ noscan.Dtor(); -+ appendable.Dtor(); -+ } -+ -+ -+ void Invariant() const {} -+ -+ -+ invariant() -+ { -+ //mark.Invariant(); -+ //scan.Invariant(); -+ //freebits.Invariant(); -+ //finals.Invariant(); -+ //noscan.Invariant(); -+ //appendable.Invariant(); -+ //nointerior.Invariant(); -+ -+ if (baseAddr) -+ { -+ //if (baseAddr + npages * PAGESIZE != topAddr) -+ //printf("baseAddr = %p, npages = %d, topAddr = %p\n", baseAddr, npages, topAddr); -+ assert(baseAddr + npages * PAGESIZE == topAddr); -+ } -+ -+ if(pagetable !is null) -+ { -+ for (size_t i = 0; i < npages; i++) -+ { -+ Bins bin = cast(Bins)pagetable[i]; -+ assert(bin < B_MAX); -+ } -+ } -+ } -+ -+ // The divisor used for determining bit indices. -+ @property private size_t divisor() -+ { -+ // NOTE: Since this is called by initialize it must be private or -+ // invariant() will be called and fail. -+ return isLargeObject ? PAGESIZE : 16; -+ } -+ -+ // Bit shift for fast division by divisor. -+ @property uint shiftBy() -+ { -+ return isLargeObject ? 12 : 4; -+ } -+ -+ void updateOffsets(size_t fromWhere) -+ { -+ assert(pagetable[fromWhere] == B_PAGE); -+ size_t pn = fromWhere + 1; -+ for(uint offset = 1; pn < npages; pn++, offset++) -+ { -+ if(pagetable[pn] != B_PAGEPLUS) break; -+ bPageOffsets[pn] = offset; -+ } -+ -+ // Store the size of the block in bPageOffsets[fromWhere]. -+ bPageOffsets[fromWhere] = cast(uint) (pn - fromWhere); -+ } -+ -+ /** -+ * Allocate n pages from Pool. -+ * Returns OPFAIL on failure. -+ */ -+ size_t allocPages(size_t n) -+ { -+ if(freepages < n) return OPFAIL; -+ size_t i; -+ size_t n2; -+ -+ //debug(PRINTF) printf("Pool::allocPages(n = %d)\n", n); -+ n2 = n; -+ for (i = searchStart; i < npages; i++) -+ { -+ if (pagetable[i] == B_FREE) -+ { -+ if(pagetable[searchStart] < B_FREE) -+ { -+ searchStart = i + (!isLargeObject); -+ } -+ -+ if (--n2 == 0) -+ { //debug(PRINTF) printf("\texisting pn = %d\n", i - n + 1); -+ return i - n + 1; -+ } -+ } -+ else -+ { -+ n2 = n; -+ if(pagetable[i] == B_PAGE) -+ { -+ // Then we have the offset information. We can skip a -+ // whole bunch of stuff. -+ i += bPageOffsets[i] - 1; -+ } -+ } -+ } -+ -+ if(pagetable[searchStart] < B_FREE) -+ { -+ searchStart = npages; -+ } -+ -+ return OPFAIL; -+ } -+ -+ /** -+ * Free npages pages starting with pagenum. -+ */ -+ void freePages(size_t pagenum, size_t npages) -+ { -+ //memset(&pagetable[pagenum], B_FREE, npages); -+ if(pagenum < searchStart) searchStart = pagenum; -+ -+ for(size_t i = pagenum; i < npages + pagenum; i++) -+ { -+ if(pagetable[i] < B_FREE) -+ { -+ freepages++; -+ } -+ -+ pagetable[i] = B_FREE; -+ } -+ } -+ -+ -+ /** -+ * Used for sorting pooltable[] -+ */ -+ int opCmp(const Pool *p2) const -+ { -+ if (baseAddr < p2.baseAddr) -+ return -1; -+ else -+ return cast(int)(baseAddr > p2.baseAddr); -+ } - } - --export extern (C) void gc_setProxy( Proxy* p ) -+ -+/* ============================ SENTINEL =============================== */ -+ -+ -+version (SENTINEL) - { -- if( proxy !is null ) -+ const size_t SENTINEL_PRE = cast(size_t) 0xF4F4F4F4F4F4F4F4UL; // 32 or 64 bits -+ const ubyte SENTINEL_POST = 0xF5; // 8 bits -+ const uint SENTINEL_EXTRA = 2 * size_t.sizeof + 1; -+ -+ -+ size_t* sentinel_size(void *p) { return &(cast(size_t *)p)[-2]; } -+ size_t* sentinel_pre(void *p) { return &(cast(size_t *)p)[-1]; } -+ ubyte* sentinel_post(void *p) { return &(cast(ubyte *)p)[*sentinel_size(p)]; } -+ -+ -+ void sentinel_init(void *p, size_t size) - { -- // TODO: Decide if this is an error condition. -+ *sentinel_size(p) = size; -+ *sentinel_pre(p) = SENTINEL_PRE; -+ *sentinel_post(p) = SENTINEL_POST; - } -- proxy = p; -- foreach( r; _gc.rootIter ) -- proxy.gc_addRoot( r ); -- foreach( r; _gc.rangeIter ) -- proxy.gc_addRange( r.pbot, r.ptop - r.pbot ); --} - --export extern (C) void gc_clrProxy() -+ -+ void sentinel_Invariant(const void *p) -+ { -+ assert(*sentinel_pre(p) == SENTINEL_PRE); -+ assert(*sentinel_post(p) == SENTINEL_POST); -+ } -+ -+ -+ void *sentinel_add(void *p) -+ { -+ return p + 2 * size_t.sizeof; -+ } -+ -+ -+ void *sentinel_sub(void *p) -+ { -+ return p - 2 * size_t.sizeof; -+ } -+} -+else - { -- foreach( r; _gc.rangeIter ) -- proxy.gc_removeRange( r.pbot ); -- foreach( r; _gc.rootIter ) -- proxy.gc_removeRoot( r ); -- proxy = null; -+ const uint SENTINEL_EXTRA = 0; -+ -+ -+ void sentinel_init(void *p, size_t size) -+ { -+ } -+ -+ -+ void sentinel_Invariant(const void *p) -+ { -+ } -+ -+ -+ void *sentinel_add(void *p) -+ { -+ return p; -+ } -+ -+ -+ void *sentinel_sub(void *p) -+ { -+ return p; -+ } - } ---- a/src/libphobos/libdruntime/gc/gcstats.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/gcstats.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,27 +0,0 @@ --/** -- * Contains a struct for storing GC statistics. -- * -- * Copyright: Copyright Digital Mars 2005 - 2009. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright, Sean Kelly -- */ -- --/* Copyright Digital Mars 2005 - 2009. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module gc.gcstats; -- -- --/** -- * -- */ --struct GCStats --{ -- size_t poolsize; // total size of pool -- size_t usedsize; // bytes allocated -- size_t freeblocks; // number of blocks marked FREE -- size_t freelistsize; // total of memory on free lists -- size_t pageblocks; // number of blocks marked PAGE --} ---- a/src/libphobos/libdruntime/gc/gcx.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/gcx.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,3441 +0,0 @@ --/** -- * Contains the garbage collector implementation. -- * -- * Copyright: Copyright Digital Mars 2001 - 2009. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright, David Friedman, Sean Kelly -- */ -- --/* Copyright Digital Mars 2001 - 2009. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module gc.gcx; -- --// D Programming Language Garbage Collector implementation -- --/************** Debugging ***************************/ -- --//debug = PRINTF; // turn on printf's --//debug = COLLECT_PRINTF; // turn on printf's --//debug = LOGGING; // log allocations / frees --//debug = MEMSTOMP; // stomp on memory --//debug = SENTINEL; // add underrun/overrrun protection --//debug = PTRCHECK; // more pointer checking --//debug = PTRCHECK2; // thorough but slow pointer checking --//debug = PROFILING; // measure performance of various steps. -- --/*************** Configuration *********************/ -- --version = STACKGROWSDOWN; // growing the stack means subtracting from the stack pointer -- // (use for Intel X86 CPUs) -- // else growing the stack means adding to the stack pointer -- --/***************************************************/ -- --private import gc.gcbits; --private import gc.gcstats; --private import gc.gcalloc; -- --private import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc; --private import core.stdc.string; --private import core.bitop; --private import core.sync.mutex; -- --version (GNU) import gcc.builtins; -- --debug (PRINTF) import core.stdc.stdio : printf; --debug (COLLECT_PRINTF) import core.stdc.stdio : printf; --debug private import core.stdc.stdio; -- --debug(PRINTF) void printFreeInfo(Pool* pool) --{ -- uint nReallyFree; -- foreach(i; 0..pool.npages) { -- if(pool.pagetable[i] >= B_FREE) nReallyFree++; -- } -- -- printf("Pool %p: %d really free, %d supposedly free\n", pool, nReallyFree, pool.freepages); --} -- --debug(PROFILING) --{ -- // Track total time spent preparing for GC, -- // marking, sweeping and recovering pages. -- import core.stdc.stdio, core.stdc.time; -- __gshared long prepTime; -- __gshared long markTime; -- __gshared long sweepTime; -- __gshared long recoverTime; --} -- --private --{ -- enum USE_CACHE = true; -- -- // The maximum number of recursions of mark() before transitioning to -- // multiple heap traversals to avoid consuming O(D) stack space where -- // D is the depth of the heap graph. -- enum MAX_MARK_RECURSIONS = 64; -- -- enum BlkAttr : uint -- { -- FINALIZE = 0b0000_0001, -- NO_SCAN = 0b0000_0010, -- NO_MOVE = 0b0000_0100, -- APPENDABLE = 0b0000_1000, -- NO_INTERIOR = 0b0001_0000, -- ALL_BITS = 0b1111_1111 -- } --} -- struct BlkInfo -- { -- void* base; -- size_t size; -- uint attr; -- } --private --{ -- extern (C) void rt_finalize2(void* p, bool det, bool resetMemory); -- -- extern (C) void thread_suspendAll(); -- extern (C) void thread_resumeAll(); -- -- // core.thread -- enum IsMarked : int -- { -- no, -- yes, -- unknown, // memory is not managed by GC -- } -- alias IsMarked delegate(void*) IsMarkedDg; -- extern (C) void thread_processGCMarks(scope IsMarkedDg isMarked); -- -- alias void delegate(void*, void*) scanFn; -- extern (C) void thread_scanAll(scope scanFn fn); -- -- extern (C) void onOutOfMemoryError(); -- extern (C) void onInvalidMemoryOperationError(); -- -- enum -- { -- OPFAIL = ~cast(size_t)0 -- } --} -- -- --alias GC gc_t; -- -- --/* ======================= Leak Detector =========================== */ -- -- --debug (LOGGING) --{ -- struct Log -- { -- void* p; -- size_t size; -- size_t line; -- char* file; -- void* parent; -- -- void print() -- { -- printf(" p = %p, size = %zd, parent = %p ", p, size, parent); -- if (file) -- { -- printf("%s(%u)", file, line); -- } -- printf("\n"); -- } -- } -- -- -- struct LogArray -- { -- size_t dim; -- size_t allocdim; -- Log *data; -- -- void Dtor() -- { -- if (data) -- cstdlib.free(data); -- data = null; -- } -- -- void reserve(size_t nentries) -- { -- assert(dim <= allocdim); -- if (allocdim - dim < nentries) -- { -- allocdim = (dim + nentries) * 2; -- assert(dim + nentries <= allocdim); -- if (!data) -- { -- data = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof); -- if (!data && allocdim) -- onOutOfMemoryError(); -- } -- else -- { Log *newdata; -- -- newdata = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof); -- if (!newdata && allocdim) -- onOutOfMemoryError(); -- memcpy(newdata, data, dim * Log.sizeof); -- cstdlib.free(data); -- data = newdata; -- } -- } -- } -- -- -- void push(Log log) -- { -- reserve(1); -- data[dim++] = log; -- } -- -- void remove(size_t i) -- { -- memmove(data + i, data + i + 1, (dim - i) * Log.sizeof); -- dim--; -- } -- -- -- size_t find(void *p) -- { -- for (size_t i = 0; i < dim; i++) -- { -- if (data[i].p == p) -- return i; -- } -- return OPFAIL; // not found -- } -- -- -- void copy(LogArray *from) -- { -- reserve(from.dim - dim); -- assert(from.dim <= allocdim); -- memcpy(data, from.data, from.dim * Log.sizeof); -- dim = from.dim; -- } -- } --} -- -- --/* ============================ GC =============================== */ -- -- --const uint GCVERSION = 1; // increment every time we change interface -- // to GC. -- --// This just makes Mutex final to de-virtualize member function calls. --final class GCMutex : Mutex {} -- --class GC --{ -- // For passing to debug code (not thread safe) -- __gshared size_t line; -- __gshared char* file; -- -- uint gcversion = GCVERSION; -- -- Gcx *gcx; // implementation -- -- // We can't allocate a Mutex on the GC heap because we are the GC. -- // Store it in the static data segment instead. -- __gshared GCMutex gcLock; // global lock -- __gshared byte[__traits(classInstanceSize, GCMutex)] mutexStorage; -- -- void initialize() -- { -- mutexStorage[] = GCMutex.classinfo.init[]; -- gcLock = cast(GCMutex) mutexStorage.ptr; -- gcLock.__ctor(); -- gcx = cast(Gcx*)cstdlib.calloc(1, Gcx.sizeof); -- if (!gcx) -- onOutOfMemoryError(); -- gcx.initialize(); -- } -- -- -- void Dtor() -- { -- version (linux) -- { -- //debug(PRINTF) printf("Thread %x ", pthread_self()); -- //debug(PRINTF) printf("GC.Dtor()\n"); -- } -- -- if (gcx) -- { -- gcx.Dtor(); -- cstdlib.free(gcx); -- gcx = null; -- } -- } -- -- -- /** -- * -- */ -- void enable() -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- assert(gcx.disabled > 0); -- gcx.disabled--; -- } -- -- -- /** -- * -- */ -- void disable() -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.disabled++; -- } -- -- -- /** -- * -- */ -- uint getAttr(void* p) -- { -- if (!p) -- { -- return 0; -- } -- -- uint go() -- { -- Pool* pool = gcx.findPool(p); -- uint oldb = 0; -- -- if (pool) -- { -- auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- oldb = gcx.getBits(pool, biti); -- } -- return oldb; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return go(); -- } -- -- -- /** -- * -- */ -- uint setAttr(void* p, uint mask) -- { -- if (!p) -- { -- return 0; -- } -- -- uint go() -- { -- Pool* pool = gcx.findPool(p); -- uint oldb = 0; -- -- if (pool) -- { -- auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- oldb = gcx.getBits(pool, biti); -- gcx.setBits(pool, biti, mask); -- } -- return oldb; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return go(); -- } -- -- -- /** -- * -- */ -- uint clrAttr(void* p, uint mask) -- { -- if (!p) -- { -- return 0; -- } -- -- uint go() -- { -- Pool* pool = gcx.findPool(p); -- uint oldb = 0; -- -- if (pool) -- { -- auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- oldb = gcx.getBits(pool, biti); -- gcx.clrBits(pool, biti, mask); -- } -- return oldb; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return go(); -- } -- -- -- /** -- * -- */ -- void *malloc(size_t size, uint bits = 0, size_t *alloc_size = null) -- { -- if (!size) -- { -- if(alloc_size) -- *alloc_size = 0; -- return null; -- } -- -- void* p = void; -- size_t localAllocSize = void; -- if(alloc_size is null) alloc_size = &localAllocSize; -- -- // Since a finalizer could launch a new thread, we always need to lock -- // when collecting. The safest way to do this is to simply always lock -- // when allocating. -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- p = mallocNoSync(size, bits, alloc_size); -- } -- -- if (!(bits & BlkAttr.NO_SCAN)) -- { -- memset(p + size, 0, *alloc_size - size); -- } -- -- return p; -- } -- -- -- // -- // -- // -- private void *mallocNoSync(size_t size, uint bits = 0, size_t *alloc_size = null) -- { -- assert(size != 0); -- -- void *p = null; -- Bins bin; -- -- //debug(PRINTF) printf("GC::malloc(size = %d, gcx = %p)\n", size, gcx); -- assert(gcx); -- //debug(PRINTF) printf("gcx.self = %x, pthread_self() = %x\n", gcx.self, pthread_self()); -- -- if (gcx.running) -- onInvalidMemoryOperationError(); -- -- size += SENTINEL_EXTRA; -- bin = gcx.findBin(size); -- Pool *pool; -- -- if (bin < B_PAGE) -- { -- if(alloc_size) -- *alloc_size = binsize[bin]; -- int state = gcx.disabled ? 1 : 0; -- bool collected = false; -- -- while (!gcx.bucket[bin] && !gcx.allocPage(bin)) -- { -- switch (state) -- { -- case 0: -- auto freedpages = gcx.fullcollect(); -- collected = true; -- if (freedpages < gcx.npools * ((POOLSIZE / PAGESIZE) / 8)) -- { /* Didn't free much, so try allocating more anyway. -- * Note: freedpages is not the amount of memory freed, it's the amount -- * of full pages freed. Perhaps this should instead be the amount of -- * memory freed. -- */ -- gcx.newPool(1,false); -- state = 2; -- } -- else -- state = 1; -- continue; -- case 1: -- gcx.newPool(1, false); -- state = 2; -- continue; -- case 2: -- if (collected) -- onOutOfMemoryError(); -- state = 0; -- continue; -- default: -- assert(false); -- } -- } -- p = gcx.bucket[bin]; -- -- // Return next item from free list -- gcx.bucket[bin] = (cast(List*)p).next; -- pool = (cast(List*)p).pool; -- //debug(PRINTF) printf("\tmalloc => %p\n", p); -- debug (MEMSTOMP) memset(p, 0xF0, size); -- } -- else -- { -- p = gcx.bigAlloc(size, &pool, alloc_size); -- if (!p) -- onOutOfMemoryError(); -- } -- size -= SENTINEL_EXTRA; -- p = sentinel_add(p); -- sentinel_init(p, size); -- gcx.log_malloc(p, size); -- -- if (bits) -- { -- gcx.setBits(pool, cast(size_t)(p - pool.baseAddr) >> pool.shiftBy, bits); -- } -- return p; -- } -- -- -- /** -- * -- */ -- void *calloc(size_t size, uint bits = 0, size_t *alloc_size = null) -- { -- if (!size) -- { -- if(alloc_size) -- *alloc_size = 0; -- return null; -- } -- -- size_t localAllocSize = void; -- void* p = void; -- if(alloc_size is null) alloc_size = &localAllocSize; -- -- // Since a finalizer could launch a new thread, we always need to lock -- // when collecting. The safest way to do this is to simply always lock -- // when allocating. -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- p = mallocNoSync(size, bits, alloc_size); -- } -- -- memset(p, 0, size); -- if (!(bits & BlkAttr.NO_SCAN)) -- { -- memset(p + size, 0, *alloc_size - size); -- } -- -- return p; -- } -- -- /** -- * -- */ -- void *realloc(void *p, size_t size, uint bits = 0, size_t *alloc_size = null) -- { -- size_t localAllocSize = void; -- auto oldp = p; -- if(alloc_size is null) alloc_size = &localAllocSize; -- -- // Since a finalizer could launch a new thread, we always need to lock -- // when collecting. The safest way to do this is to simply always lock -- // when allocating. -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- p = reallocNoSync(p, size, bits, alloc_size); -- } -- -- if (p !is oldp && !(bits & BlkAttr.NO_SCAN)) -- { -- memset(p + size, 0, *alloc_size - size); -- } -- -- return p; -- } -- -- -- // -- // -- // -- private void *reallocNoSync(void *p, size_t size, uint bits = 0, size_t *alloc_size = null) -- { -- if (gcx.running) -- onInvalidMemoryOperationError(); -- -- if (!size) -- { if (p) -- { freeNoSync(p); -- p = null; -- } -- if(alloc_size) -- *alloc_size = 0; -- } -- else if (!p) -- { -- p = mallocNoSync(size, bits, alloc_size); -- } -- else -- { void *p2; -- size_t psize; -- -- //debug(PRINTF) printf("GC::realloc(p = %p, size = %zu)\n", p, size); -- version (SENTINEL) -- { -- sentinel_Invariant(p); -- psize = *sentinel_size(p); -- if (psize != size) -- { -- if (psize) -- { -- Pool *pool = gcx.findPool(p); -- -- if (pool) -- { -- auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- if (bits) -- { -- gcx.clrBits(pool, biti, BlkAttr.ALL_BITS); -- gcx.setBits(pool, biti, bits); -- } -- else -- { -- bits = gcx.getBits(pool, biti); -- } -- } -- } -- p2 = mallocNoSync(size, bits, alloc_size); -- if (psize < size) -- size = psize; -- //debug(PRINTF) printf("\tcopying %d bytes\n",size); -- memcpy(p2, p, size); -- p = p2; -- } -- } -- else -- { -- psize = gcx.findSize(p); // find allocated size -- if (psize >= PAGESIZE && size >= PAGESIZE) -- { -- auto psz = psize / PAGESIZE; -- auto newsz = (size + PAGESIZE - 1) / PAGESIZE; -- if (newsz == psz) -- return p; -- -- auto pool = gcx.findPool(p); -- auto pagenum = (p - pool.baseAddr) / PAGESIZE; -- -- if (newsz < psz) -- { // Shrink in place -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- debug (MEMSTOMP) memset(p + size, 0xF2, psize - size); -- pool.freePages(pagenum + newsz, psz - newsz); -- pool.updateOffsets(pagenum); -- } -- if(alloc_size) -- *alloc_size = newsz * PAGESIZE; -- return p; -- } -- else if (pagenum + newsz <= pool.npages) -- { -- // Attempt to expand in place -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- for (size_t i = pagenum + psz; 1;) -- { -- if (i == pagenum + newsz) -- { -- debug (MEMSTOMP) memset(p + psize, 0xF0, size - psize); -- debug(PRINTF) printFreeInfo(pool); -- memset(&pool.pagetable[pagenum + psz], B_PAGEPLUS, newsz - psz); -- pool.updateOffsets(pagenum); -- if(alloc_size) -- *alloc_size = newsz * PAGESIZE; -- pool.freepages -= (newsz - psz); -- debug(PRINTF) printFreeInfo(pool); -- return p; -- } -- if (i == pool.ncommitted) -- { -- auto u = pool.extendPages(pagenum + newsz - pool.ncommitted); -- if (u == OPFAIL) -- break; -- i = pagenum + newsz; -- continue; -- } -- if (pool.pagetable[i] != B_FREE) -- break; -- i++; -- } -- } -- } -- } -- if (psize < size || // if new size is bigger -- psize > size * 2) // or less than half -- { -- if (psize) -- { -- Pool *pool = gcx.findPool(p); -- -- if (pool) -- { -- auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- if (bits) -- { -- gcx.clrBits(pool, biti, BlkAttr.ALL_BITS); -- gcx.setBits(pool, biti, bits); -- } -- else -- { -- bits = gcx.getBits(pool, biti); -- } -- } -- } -- p2 = mallocNoSync(size, bits, alloc_size); -- if (psize < size) -- size = psize; -- //debug(PRINTF) printf("\tcopying %d bytes\n",size); -- memcpy(p2, p, size); -- p = p2; -- } -- else if(alloc_size) -- *alloc_size = psize; -- } -- } -- return p; -- } -- -- -- /** -- * Attempt to in-place enlarge the memory block pointed to by p by at least -- * minbytes beyond its current capacity, up to a maximum of maxsize. This -- * does not attempt to move the memory block (like realloc() does). -- * -- * Returns: -- * 0 if could not extend p, -- * total size of entire memory block if successful. -- */ -- size_t extend(void* p, size_t minsize, size_t maxsize) -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return extendNoSync(p, minsize, maxsize); -- } -- -- -- // -- // -- // -- private size_t extendNoSync(void* p, size_t minsize, size_t maxsize) -- in -- { -- assert(minsize <= maxsize); -- } -- body -- { -- if (gcx.running) -- onInvalidMemoryOperationError(); -- -- //debug(PRINTF) printf("GC::extend(p = %p, minsize = %zu, maxsize = %zu)\n", p, minsize, maxsize); -- version (SENTINEL) -- { -- return 0; -- } -- auto psize = gcx.findSize(p); // find allocated size -- if (psize < PAGESIZE) -- return 0; // cannot extend buckets -- -- auto psz = psize / PAGESIZE; -- auto minsz = (minsize + PAGESIZE - 1) / PAGESIZE; -- auto maxsz = (maxsize + PAGESIZE - 1) / PAGESIZE; -- -- auto pool = gcx.findPool(p); -- auto pagenum = (p - pool.baseAddr) / PAGESIZE; -- -- size_t sz; -- for (sz = 0; sz < maxsz; sz++) -- { -- auto i = pagenum + psz + sz; -- if (i == pool.ncommitted) -- break; -- if (pool.pagetable[i] != B_FREE) -- { if (sz < minsz) -- return 0; -- break; -- } -- } -- if (sz >= minsz) -- { -- } -- else if (pagenum + psz + sz == pool.ncommitted) -- { -- /* This used to only allocate as little as possible, -- now we try to allocate up to maxsz pages*/ -- /*auto u = pool.extendPages(minsz - sz); -- if (u == OPFAIL) -- return 0; -- sz = minsz;*/ -- auto u = pool.extendPagesUpTo(maxsz - sz); -- if (u == OPFAIL || (u + sz < minsz)) -- return 0; -- sz += u; -- if(sz > maxsz) sz = maxsz; -- } -- else -- return 0; -- debug (MEMSTOMP) memset(p + psize, 0xF0, (psz + sz) * PAGESIZE - psize); -- memset(pool.pagetable + pagenum + psz, B_PAGEPLUS, sz); -- pool.updateOffsets(pagenum); -- pool.freepages -= sz; -- if (p == gcx.cached_size_key) -- gcx.cached_size_val = (psz + sz) * PAGESIZE; -- if (p == gcx.cached_info_key) -- gcx.cached_info_val.size = (psz + sz) * PAGESIZE; -- return (psz + sz) * PAGESIZE; -- } -- -- -- /** -- * -- */ -- size_t reserve(size_t size) -- { -- if (!size) -- { -- return 0; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return reserveNoSync(size); -- } -- -- -- // -- // -- // -- private size_t reserveNoSync(size_t size) -- { -- assert(size != 0); -- assert(gcx); -- -- if (gcx.running) -- onInvalidMemoryOperationError(); -- -- return gcx.reserve(size); -- } -- -- -- /** -- * -- */ -- void free(void *p) -- { -- if (!p) -- { -- return; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return freeNoSync(p); -- } -- -- -- // -- // -- // -- private void freeNoSync(void *p) -- { -- debug(PRINTF) printf("Freeing %p\n", cast(size_t) p); -- assert (p); -- -- if (gcx.running) -- onInvalidMemoryOperationError(); -- -- Pool* pool; -- size_t pagenum; -- Bins bin; -- size_t biti; -- -- // Find which page it is in -- pool = gcx.findPool(p); -- if (!pool) // if not one of ours -- return; // ignore -- sentinel_Invariant(p); -- p = sentinel_sub(p); -- pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -- -- debug(PRINTF) printf("pool base = %p, PAGENUM = %d of %d / %d, bin = %d\n", pool.baseAddr, pagenum, pool.ncommitted, pool.npages, pool.pagetable[pagenum]); -- debug(PRINTF) if(pool.isLargeObject) printf("Block size = %d\n", pool.bPageOffsets[pagenum]); -- biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy; -- -- gcx.clrBits(pool, biti, BlkAttr.ALL_BITS); -- -- bin = cast(Bins)pool.pagetable[pagenum]; -- if (bin == B_PAGE) // if large alloc -- { size_t npages; -- -- // Free pages -- npages = pool.bPageOffsets[pagenum]; -- debug (MEMSTOMP) memset(p, 0xF2, npages * PAGESIZE); -- pool.freePages(pagenum, npages); -- } -- else -- { // Add to free list -- List *list = cast(List*)p; -- -- debug (MEMSTOMP) memset(p, 0xF2, binsize[bin]); -- -- list.next = gcx.bucket[bin]; -- list.pool = pool; -- gcx.bucket[bin] = list; -- } -- gcx.log_free(sentinel_add(p)); -- } -- -- -- /** -- * Determine the base address of the block containing p. If p is not a gc -- * allocated pointer, return null. -- */ -- void* addrOf(void *p) -- { -- if (!p) -- { -- return null; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return addrOfNoSync(p); -- } -- -- -- // -- // -- // -- void* addrOfNoSync(void *p) -- { -- if (!p) -- { -- return null; -- } -- -- return gcx.findBase(p); -- } -- -- -- /** -- * Determine the allocated size of pointer p. If p is an interior pointer -- * or not a gc allocated pointer, return 0. -- */ -- size_t sizeOf(void *p) -- { -- if (!p) -- { -- return 0; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return sizeOfNoSync(p); -- } -- -- -- // -- // -- // -- private size_t sizeOfNoSync(void *p) -- { -- assert (p); -- -- version (SENTINEL) -- { -- p = sentinel_sub(p); -- size_t size = gcx.findSize(p); -- -- // Check for interior pointer -- // This depends on: -- // 1) size is a power of 2 for less than PAGESIZE values -- // 2) base of memory pool is aligned on PAGESIZE boundary -- if (cast(size_t)p & (size - 1) & (PAGESIZE - 1)) -- size = 0; -- return size ? size - SENTINEL_EXTRA : 0; -- } -- else -- { -- size_t size = gcx.findSize(p); -- -- // Check for interior pointer -- // This depends on: -- // 1) size is a power of 2 for less than PAGESIZE values -- // 2) base of memory pool is aligned on PAGESIZE boundary -- if (cast(size_t)p & (size - 1) & (PAGESIZE - 1)) -- return 0; -- return size; -- } -- } -- -- -- /** -- * Determine the base address of the block containing p. If p is not a gc -- * allocated pointer, return null. -- */ -- BlkInfo query(void *p) -- { -- if (!p) -- { -- BlkInfo i; -- return i; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return queryNoSync(p); -- } -- -- -- // -- // -- // -- BlkInfo queryNoSync(void *p) -- { -- assert(p); -- -- return gcx.getInfo(p); -- } -- -- -- /** -- * Verify that pointer p: -- * 1) belongs to this memory pool -- * 2) points to the start of an allocated piece of memory -- * 3) is not on a free list -- */ -- void check(void *p) -- { -- if (!p) -- { -- return; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- checkNoSync(p); -- } -- -- -- // -- // -- // -- private void checkNoSync(void *p) -- { -- assert(p); -- -- sentinel_Invariant(p); -- debug (PTRCHECK) -- { -- Pool* pool; -- size_t pagenum; -- Bins bin; -- size_t size; -- -- p = sentinel_sub(p); -- pool = gcx.findPool(p); -- assert(pool); -- pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -- bin = cast(Bins)pool.pagetable[pagenum]; -- assert(bin <= B_PAGE); -- size = binsize[bin]; -- assert((cast(size_t)p & (size - 1)) == 0); -- -- debug (PTRCHECK2) -- { -- if (bin < B_PAGE) -- { -- // Check that p is not on a free list -- List *list; -- -- for (list = gcx.bucket[bin]; list; list = list.next) -- { -- assert(cast(void*)list != p); -- } -- } -- } -- } -- } -- -- -- /** -- * add p to list of roots -- */ -- void addRoot(void *p) -- { -- if (!p) -- { -- return; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.addRoot(p); -- } -- -- -- /** -- * remove p from list of roots -- */ -- void removeRoot(void *p) -- { -- if (!p) -- { -- return; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.removeRoot(p); -- } -- -- -- /** -- * -- */ -- @property int delegate(int delegate(ref void*)) rootIter() -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return &gcx.rootIter; -- } -- -- -- /** -- * add range to scan for roots -- */ -- void addRange(void *p, size_t sz) -- { -- if (!p || !sz) -- { -- return; -- } -- -- //debug(PRINTF) printf("+GC.addRange(p = %p, sz = 0x%zx), p + sz = %p\n", p, sz, p + sz); -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.addRange(p, p + sz); -- -- //debug(PRINTF) printf("-GC.addRange()\n"); -- } -- -- -- /** -- * remove range -- */ -- void removeRange(void *p) -- { -- if (!p) -- { -- return; -- } -- -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.removeRange(p); -- } -- -- -- /** -- * -- */ -- @property int delegate(int delegate(ref Range)) rangeIter() -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- return &gcx.rangeIter; -- } -- -- -- /** -- * Do full garbage collection. -- * Return number of pages free'd. -- */ -- size_t fullCollect() -- { -- debug(PRINTF) printf("GC.fullCollect()\n"); -- size_t result; -- -- // Since a finalizer could launch a new thread, we always need to lock -- // when collecting. -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- result = gcx.fullcollect(); -- } -- -- version (none) -- { -- GCStats stats; -- -- getStats(stats); -- debug(PRINTF) printf("poolsize = %zx, usedsize = %zx, freelistsize = %zx\n", -- stats.poolsize, stats.usedsize, stats.freelistsize); -- } -- -- gcx.log_collect(); -- return result; -- } -- -- -- /** -- * do full garbage collection ignoring roots -- */ -- void fullCollectNoStack() -- { -- // Since a finalizer could launch a new thread, we always need to lock -- // when collecting. -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.noStack++; -- gcx.fullcollect(); -- gcx.noStack--; -- } -- } -- -- -- /** -- * minimize free space usage -- */ -- void minimize() -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- gcx.minimize(); -- } -- -- -- /** -- * Retrieve statistics about garbage collection. -- * Useful for debugging and tuning. -- */ -- void getStats(out GCStats stats) -- { -- gcLock.lock(); -- scope(exit) gcLock.unlock(); -- getStatsNoSync(stats); -- } -- -- -- // -- // -- // -- private void getStatsNoSync(out GCStats stats) -- { -- size_t psize = 0; -- size_t usize = 0; -- size_t flsize = 0; -- -- size_t n; -- size_t bsize = 0; -- -- //debug(PRINTF) printf("getStats()\n"); -- memset(&stats, 0, GCStats.sizeof); -- -- for (n = 0; n < gcx.npools; n++) -- { Pool *pool = gcx.pooltable[n]; -- -- psize += pool.ncommitted * PAGESIZE; -- for (size_t j = 0; j < pool.ncommitted; j++) -- { -- Bins bin = cast(Bins)pool.pagetable[j]; -- if (bin == B_FREE) -- stats.freeblocks++; -- else if (bin == B_PAGE) -- stats.pageblocks++; -- else if (bin < B_PAGE) -- bsize += PAGESIZE; -- } -- } -- -- for (n = 0; n < B_PAGE; n++) -- { -- //debug(PRINTF) printf("bin %d\n", n); -- for (List *list = gcx.bucket[n]; list; list = list.next) -- { -- //debug(PRINTF) printf("\tlist %p\n", list); -- flsize += binsize[n]; -- } -- } -- -- usize = bsize - flsize; -- -- stats.poolsize = psize; -- stats.usedsize = bsize - flsize; -- stats.freelistsize = flsize; -- } --} -- -- --/* ============================ Gcx =============================== */ -- --enum --{ PAGESIZE = 4096, -- COMMITSIZE = (4096*16), -- POOLSIZE = (4096*256), --} -- -- --enum --{ -- B_16, -- B_32, -- B_64, -- B_128, -- B_256, -- B_512, -- B_1024, -- B_2048, -- B_PAGE, // start of large alloc -- B_PAGEPLUS, // continuation of large alloc -- B_FREE, // free page -- B_UNCOMMITTED, // memory not committed for this page -- B_MAX --} -- -- --alias ubyte Bins; -- -- --struct List --{ -- List *next; -- Pool *pool; --} -- -- --struct Range --{ -- void *pbot; -- void *ptop; --} -- -- --immutable uint binsize[B_MAX] = [ 16,32,64,128,256,512,1024,2048,4096 ]; --immutable size_t notbinsize[B_MAX] = [ ~(16-1),~(32-1),~(64-1),~(128-1),~(256-1), -- ~(512-1),~(1024-1),~(2048-1),~(4096-1) ]; -- --/* ============================ Gcx =============================== */ -- --struct Gcx --{ -- void *cached_size_key; -- size_t cached_size_val; -- -- void *cached_info_key; -- BlkInfo cached_info_val; -- -- size_t nroots; -- size_t rootdim; -- void **roots; -- -- size_t nranges; -- size_t rangedim; -- Range *ranges; -- -- uint noStack; // !=0 means don't scan stack -- uint log; // turn on logging -- uint anychanges; -- uint inited; -- uint running; -- int disabled; // turn off collections if >0 -- -- byte *minAddr; // min(baseAddr) -- byte *maxAddr; // max(topAddr) -- -- size_t npools; -- Pool **pooltable; -- -- List *bucket[B_MAX]; // free list for each size -- -- -- void initialize() -- { int dummy; -- -- (cast(byte*)&this)[0 .. Gcx.sizeof] = 0; -- log_init(); -- //printf("gcx = %p, self = %x\n", &this, self); -- inited = 1; -- } -- -- -- void Dtor() -- { -- debug(PROFILING) -- { -- printf("\tTotal GC prep time: %d milliseconds\n", -- prepTime * 1000 / CLOCKS_PER_SEC); -- printf("\tTotal mark time: %d milliseconds\n", -- markTime * 1000 / CLOCKS_PER_SEC); -- printf("\tTotal sweep time: %d milliseconds\n", -- sweepTime * 1000 / CLOCKS_PER_SEC); -- printf("\tTotal page recovery time: %d milliseconds\n", -- recoverTime * 1000 / CLOCKS_PER_SEC); -- printf("\tGrand total GC time: %d milliseconds\n", -- 1000 * (recoverTime + sweepTime + markTime + prepTime) -- / CLOCKS_PER_SEC); -- } -- -- inited = 0; -- -- for (size_t i = 0; i < npools; i++) -- { Pool *pool = pooltable[i]; -- -- pool.Dtor(); -- cstdlib.free(pool); -- } -- if (pooltable) -- cstdlib.free(pooltable); -- -- if (roots) -- cstdlib.free(roots); -- -- if (ranges) -- cstdlib.free(ranges); -- } -- -- -- void Invariant() const { } -- -- -- invariant() -- { -- if (inited) -- { -- //printf("Gcx.invariant(): this = %p\n", &this); -- -- for (size_t i = 0; i < npools; i++) -- { auto pool = pooltable[i]; -- -- pool.Invariant(); -- if (i == 0) -- { -- assert(minAddr == pool.baseAddr); -- } -- if (i + 1 < npools) -- { -- assert(pool.opCmp(pooltable[i + 1]) < 0); -- } -- else if (i + 1 == npools) -- { -- assert(maxAddr == pool.topAddr); -- } -- } -- -- if (roots) -- { -- assert(rootdim != 0); -- assert(nroots <= rootdim); -- } -- -- if (ranges) -- { -- assert(rangedim != 0); -- assert(nranges <= rangedim); -- -- for (size_t i = 0; i < nranges; i++) -- { -- assert(ranges[i].pbot); -- assert(ranges[i].ptop); -- assert(ranges[i].pbot <= ranges[i].ptop); -- } -- } -- -- for (size_t i = 0; i < B_PAGE; i++) -- { -- for (auto list = cast(List*)bucket[i]; list; list = list.next) -- { -- } -- } -- } -- } -- -- -- /** -- * -- */ -- void addRoot(void *p) -- { -- if (nroots == rootdim) -- { -- size_t newdim = rootdim * 2 + 16; -- void** newroots; -- -- newroots = cast(void**)cstdlib.malloc(newdim * newroots[0].sizeof); -- if (!newroots) -- onOutOfMemoryError(); -- if (roots) -- { memcpy(newroots, roots, nroots * newroots[0].sizeof); -- cstdlib.free(roots); -- } -- roots = newroots; -- rootdim = newdim; -- } -- roots[nroots] = p; -- nroots++; -- } -- -- -- /** -- * -- */ -- void removeRoot(void *p) -- { -- for (size_t i = nroots; i--;) -- { -- if (roots[i] == p) -- { -- nroots--; -- memmove(roots + i, roots + i + 1, (nroots - i) * roots[0].sizeof); -- return; -- } -- } -- assert(0); -- } -- -- -- /** -- * -- */ -- int rootIter(int delegate(ref void*) dg) -- { -- int result = 0; -- for (size_t i = 0; i < nroots; ++i) -- { -- result = dg(roots[i]); -- if (result) -- break; -- } -- return result; -- } -- -- -- /** -- * -- */ -- void addRange(void *pbot, void *ptop) -- { -- //debug(PRINTF) printf("Thread %x ", pthread_self()); -- debug(PRINTF) printf("%p.Gcx::addRange(%p, %p), nranges = %d\n", &this, pbot, ptop, nranges); -- if (nranges == rangedim) -- { -- size_t newdim = rangedim * 2 + 16; -- Range *newranges; -- -- newranges = cast(Range*)cstdlib.malloc(newdim * newranges[0].sizeof); -- if (!newranges) -- onOutOfMemoryError(); -- if (ranges) -- { memcpy(newranges, ranges, nranges * newranges[0].sizeof); -- cstdlib.free(ranges); -- } -- ranges = newranges; -- rangedim = newdim; -- } -- ranges[nranges].pbot = pbot; -- ranges[nranges].ptop = ptop; -- nranges++; -- } -- -- -- /** -- * -- */ -- void removeRange(void *pbot) -- { -- //debug(PRINTF) printf("Thread %x ", pthread_self()); -- debug(PRINTF) printf("Gcx.removeRange(%p), nranges = %d\n", pbot, nranges); -- for (size_t i = nranges; i--;) -- { -- if (ranges[i].pbot == pbot) -- { -- nranges--; -- memmove(ranges + i, ranges + i + 1, (nranges - i) * ranges[0].sizeof); -- return; -- } -- } -- debug(PRINTF) printf("Wrong thread\n"); -- -- // This is a fatal error, but ignore it. -- // The problem is that we can get a Close() call on a thread -- // other than the one the range was allocated on. -- //assert(zero); -- } -- -- -- /** -- * -- */ -- int rangeIter(int delegate(ref Range) dg) -- { -- int result = 0; -- for (size_t i = 0; i < nranges; ++i) -- { -- result = dg(ranges[i]); -- if (result) -- break; -- } -- return result; -- } -- -- -- /** -- * Find Pool that pointer is in. -- * Return null if not in a Pool. -- * Assume pooltable[] is sorted. -- */ -- Pool *findPool(void *p) -- { -- if (p >= minAddr && p < maxAddr) -- { -- if (npools <= 1) -- { -- return npools == 0 ? null : pooltable[0]; -- } -- -- /* The pooltable[] is sorted by address, so do a binary search -- */ -- auto pt = pooltable; -- size_t low = 0; -- size_t high = npools - 1; -- while (low <= high) -- { -- size_t mid = (low + high) >> 1; -- auto pool = pt[mid]; -- if (p < pool.baseAddr) -- high = mid - 1; -- else if (p >= pool.topAddr) -- low = mid + 1; -- else -- return pool; -- } -- } -- return null; -- } -- -- -- /** -- * Find base address of block containing pointer p. -- * Returns null if not a gc'd pointer -- */ -- void* findBase(void *p) -- { -- Pool *pool; -- -- pool = findPool(p); -- if (pool) -- { -- size_t offset = cast(size_t)(p - pool.baseAddr); -- size_t pn = offset / PAGESIZE; -- Bins bin = cast(Bins)pool.pagetable[pn]; -- -- // Adjust bit to be at start of allocated memory block -- if (bin <= B_PAGE) -- { -- return pool.baseAddr + (offset & notbinsize[bin]); -- } -- else if (bin == B_PAGEPLUS) -- { -- auto pageOffset = pool.bPageOffsets[pn]; -- offset -= pageOffset * PAGESIZE; -- pn -= pageOffset; -- -- return pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1))); -- } -- else -- { -- // we are in a B_FREE or B_UNCOMMITTED page -- return null; -- } -- } -- return null; -- } -- -- -- /** -- * Find size of pointer p. -- * Returns 0 if not a gc'd pointer -- */ -- size_t findSize(void *p) -- { -- Pool* pool; -- size_t size = 0; -- -- if (USE_CACHE && p == cached_size_key) -- return cached_size_val; -- -- pool = findPool(p); -- if (pool) -- { -- size_t pagenum; -- Bins bin; -- -- pagenum = cast(size_t)(p - pool.baseAddr) / PAGESIZE; -- bin = cast(Bins)pool.pagetable[pagenum]; -- size = binsize[bin]; -- if (bin == B_PAGE) -- { -- size = pool.bPageOffsets[pagenum] * PAGESIZE; -- } -- cached_size_key = p; -- cached_size_val = size; -- } -- return size; -- } -- -- -- /** -- * -- */ -- BlkInfo getInfo(void* p) -- { -- Pool* pool; -- BlkInfo info; -- -- if (USE_CACHE && p == cached_info_key) -- return cached_info_val; -- -- pool = findPool(p); -- if (pool) -- { -- size_t offset = cast(size_t)(p - pool.baseAddr); -- size_t pn = offset / PAGESIZE; -- Bins bin = cast(Bins)pool.pagetable[pn]; -- -- //////////////////////////////////////////////////////////////////// -- // findAddr -- //////////////////////////////////////////////////////////////////// -- -- if (bin <= B_PAGE) -- { -- info.base = cast(void*)((cast(size_t)p) & notbinsize[bin]); -- } -- else if (bin == B_PAGEPLUS) -- { -- auto pageOffset = pool.bPageOffsets[pn]; -- offset = pageOffset * PAGESIZE; -- pn -= pageOffset; -- info.base = pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1))); -- -- // fix bin for use by size calc below -- bin = cast(Bins)pool.pagetable[pn]; -- } -- -- //////////////////////////////////////////////////////////////////// -- // findSize -- //////////////////////////////////////////////////////////////////// -- -- info.size = binsize[bin]; -- if (bin == B_PAGE) -- { -- info.size = pool.bPageOffsets[pn] * PAGESIZE; -- } -- -- //////////////////////////////////////////////////////////////////// -- // getBits -- //////////////////////////////////////////////////////////////////// -- -- // reset the offset to the base pointer, otherwise the bits -- // are the bits for the pointer, which may be garbage -- offset = cast(size_t)(info.base - pool.baseAddr); -- info.attr = getBits(pool, cast(size_t)(offset >> pool.shiftBy)); -- -- cached_info_key = p; -- cached_info_val = info; -- } -- return info; -- } -- -- -- /** -- * Compute bin for size. -- */ -- static Bins findBin(size_t size) -- { -- static const byte[2049] binTable = ctfeBins(); -- -- return (size <= 2048) ? -- (cast(Bins) binTable[size]) : -- B_PAGE; -- } -- -- static Bins findBinImpl(size_t size) -- { Bins bin; -- -- if (size <= 256) -- { -- if (size <= 64) -- { -- if (size <= 16) -- bin = B_16; -- else if (size <= 32) -- bin = B_32; -- else -- bin = B_64; -- } -- else -- { -- if (size <= 128) -- bin = B_128; -- else -- bin = B_256; -- } -- } -- else -- { -- if (size <= 1024) -- { -- if (size <= 512) -- bin = B_512; -- else -- bin = B_1024; -- } -- else -- { -- if (size <= 2048) -- bin = B_2048; -- else -- bin = B_PAGE; -- } -- } -- return bin; -- } -- -- /** -- * Computes the bin table using CTFE. -- */ -- static byte[2049] ctfeBins() -- { -- byte[2049] ret; -- for(size_t i = 0; i < 2049; i++) -- { -- ret[i] = cast(byte) findBinImpl(i); -- } -- -- return ret; -- } -- -- -- /** -- * Allocate a new pool of at least size bytes. -- * Sort it into pooltable[]. -- * Mark all memory in the pool as B_FREE. -- * Return the actual number of bytes reserved or 0 on error. -- */ -- size_t reserve(size_t size) -- { -- size_t npages = (size + PAGESIZE - 1) / PAGESIZE; -- -- // Assume reserve() is for small objects. -- Pool* pool = newPool(npages, false); -- -- if (!pool || pool.extendPages(npages) == OPFAIL) -- return 0; -- return pool.ncommitted * PAGESIZE; -- } -- -- -- /** -- * Minimizes physical memory usage by returning free pools to the OS. -- */ -- void minimize() -- { -- debug(PRINTF) printf("Minimizing.\n"); -- -- static bool isUsed(Pool *pool) -- { -- return pool.freepages < pool.npages; -- } -- -- // semi-stable partition -- for (size_t i = 0; i < npools; ++i) -- { -- auto pool = pooltable[i]; -- // find first unused pool -- if (isUsed(pool)) continue; -- -- // move used pools before unused ones -- size_t j = i + 1; -- for (; j < npools; ++j) -- { -- pool = pooltable[j]; -- if (!isUsed(pool)) continue; -- // swap -- pooltable[j] = pooltable[i]; -- pooltable[i] = pool; -- ++i; -- } -- // npooltable[0 .. i] => used -- // npooltable[i .. npools] => free -- -- // free unused pools -- for (j = i; j < npools; ++j) -- { -- pool = pooltable[j]; -- debug(PRINTF) printFreeInfo(pool); -- pool.Dtor(); -- cstdlib.free(pool); -- } -- npools = i; -- } -- -- if (npools) -- { -- minAddr = pooltable[0].baseAddr; -- maxAddr = pooltable[npools - 1].topAddr; -- } -- else -- { -- minAddr = maxAddr = null; -- } -- -- debug(PRINTF) printf("Done minimizing.\n"); -- } -- -- unittest -- { -- enum NPOOLS = 6; -- enum NPAGES = 10; -- Gcx gcx; -- -- void reset() -- { -- foreach(i, ref pool; gcx.pooltable[0 .. gcx.npools]) -- pool.freepages = pool.npages; -- gcx.minimize(); -- assert(gcx.npools == 0); -- -- if (gcx.pooltable is null) -- gcx.pooltable = cast(Pool**)cstdlib.malloc(NPOOLS * (Pool*).sizeof); -- foreach(i; 0 .. NPOOLS) -- { -- auto pool = cast(Pool*)cstdlib.malloc(Pool.sizeof); -- *pool = Pool.init; -- gcx.pooltable[i] = pool; -- } -- gcx.npools = NPOOLS; -- } -- -- void usePools() -- { -- foreach(pool; gcx.pooltable[0 .. NPOOLS]) -- { -- pool.pagetable = cast(ubyte*)cstdlib.malloc(NPAGES); -- memset(pool.pagetable, B_UNCOMMITTED, NPAGES); -- pool.npages = NPAGES; -- pool.freepages = NPAGES / 2; -- } -- } -- -- // all pools are free -- reset(); -- assert(gcx.npools == NPOOLS); -- gcx.minimize(); -- assert(gcx.npools == 0); -- -- // all pools used -- reset(); -- usePools(); -- assert(gcx.npools == NPOOLS); -- gcx.minimize(); -- assert(gcx.npools == NPOOLS); -- -- // preserves order of used pools -- reset(); -- usePools(); -- -- { -- version (Bug7068_FIXED) -- Pool*[NPOOLS] opools = gcx.pooltable[0 .. NPOOLS]; -- else -- { -- Pool*[NPOOLS] opools = void; -- memcpy(opools.ptr, gcx.pooltable, (Pool*).sizeof * NPOOLS); -- } -- gcx.pooltable[2].freepages = NPAGES; -- -- gcx.minimize(); -- assert(gcx.npools == NPOOLS - 1); -- assert(gcx.pooltable[0] == opools[0]); -- assert(gcx.pooltable[1] == opools[1]); -- assert(gcx.pooltable[2] == opools[3]); -- } -- -- // gcx reduces address span -- reset(); -- usePools(); -- -- byte* base, top; -- -- { -- byte*[NPOOLS] mem = void; -- foreach(i; 0 .. NPOOLS) -- mem[i] = cast(byte*)os_mem_map(NPAGES * PAGESIZE); -- -- extern(C) static int compare(in void* p1, in void *p2) -- { -- return p1 < p2 ? -1 : cast(int)(p2 > p1); -- } -- cstdlib.qsort(mem.ptr, mem.length, (byte*).sizeof, &compare); -- -- foreach(i, pool; gcx.pooltable[0 .. NPOOLS]) -- { -- pool.baseAddr = mem[i]; -- pool.topAddr = pool.baseAddr + NPAGES * PAGESIZE; -- } -- -- base = gcx.pooltable[0].baseAddr; -- top = gcx.pooltable[NPOOLS - 1].topAddr; -- } -- -- gcx.minimize(); -- assert(gcx.npools == NPOOLS); -- assert(gcx.minAddr == base); -- assert(gcx.maxAddr == top); -- -- gcx.pooltable[NPOOLS - 1].freepages = NPAGES; -- gcx.pooltable[NPOOLS - 2].freepages = NPAGES; -- -- gcx.minimize(); -- assert(gcx.npools == NPOOLS - 2); -- assert(gcx.minAddr == base); -- assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 3].topAddr); -- -- gcx.pooltable[0].freepages = NPAGES; -- -- gcx.minimize(); -- assert(gcx.npools == NPOOLS - 3); -- assert(gcx.minAddr != base); -- assert(gcx.minAddr == gcx.pooltable[0].baseAddr); -- assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 4].topAddr); -- -- // free all -- foreach(pool; gcx.pooltable[0 .. NPOOLS - 2]) -- pool.freepages = NPAGES; -- gcx.minimize(); -- assert(gcx.npools == 0); -- cstdlib.free(gcx.pooltable); -- } -- -- -- /** -- * Allocate a chunk of memory that is larger than a page. -- * Return null if out of memory. -- */ -- void *bigAlloc(size_t size, Pool **poolPtr, size_t *alloc_size = null) -- { -- debug(PRINTF) printf("In bigAlloc. Size: %d\n", size); -- -- Pool* pool; -- size_t npages; -- size_t n; -- size_t pn; -- size_t freedpages; -- void* p; -- int state; -- bool collected = false; -- -- npages = (size + PAGESIZE - 1) / PAGESIZE; -- -- for (state = disabled ? 1 : 0; ; ) -- { -- // This code could use some refinement when repeatedly -- // allocating very large arrays. -- -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- if(!pool.isLargeObject || pool.freepages < npages) continue; -- pn = pool.allocPages(npages); -- if (pn != OPFAIL) -- goto L1; -- } -- -- // Failed -- switch (state) -- { -- case 0: -- // Try collecting -- collected = true; -- freedpages = fullcollect(); -- if (freedpages >= npools * ((POOLSIZE / PAGESIZE) / 4)) -- { state = 1; -- continue; -- } -- // Release empty pools to prevent bloat -- minimize(); -- // Allocate new pool -- pool = newPool(npages, true); -- if (!pool) -- { state = 2; -- continue; -- } -- pn = pool.allocPages(npages); -- assert(pn != OPFAIL); -- goto L1; -- case 1: -- // Release empty pools to prevent bloat -- minimize(); -- // Allocate new pool -- pool = newPool(npages, true); -- if (!pool) -- { -- if (collected) -- goto Lnomemory; -- state = 0; -- continue; -- } -- pn = pool.allocPages(npages); -- assert(pn != OPFAIL); -- goto L1; -- case 2: -- goto Lnomemory; -- default: -- assert(false); -- } -- } -- -- L1: -- debug(PRINTF) printFreeInfo(pool); -- pool.pagetable[pn] = B_PAGE; -- if (npages > 1) -- memset(&pool.pagetable[pn + 1], B_PAGEPLUS, npages - 1); -- pool.updateOffsets(pn); -- pool.freepages -= npages; -- -- debug(PRINTF) printFreeInfo(pool); -- -- p = pool.baseAddr + pn * PAGESIZE; -- debug(PRINTF) printf("Got large alloc: %p, pt = %d, np = %d\n", p, pool.pagetable[pn], npages); -- debug (MEMSTOMP) memset(p, 0xF1, size); -- if(alloc_size) -- *alloc_size = npages * PAGESIZE; -- //debug(PRINTF) printf("\tp = %p\n", p); -- -- *poolPtr = pool; -- return p; -- -- Lnomemory: -- return null; // let caller handle the error -- } -- -- -- /** -- * Allocate a new pool with at least npages in it. -- * Sort it into pooltable[]. -- * Return null if failed. -- */ -- Pool *newPool(size_t npages, bool isLargeObject) -- { -- Pool* pool; -- Pool** newpooltable; -- size_t newnpools; -- size_t i; -- -- //debug(PRINTF) printf("************Gcx::newPool(npages = %d)****************\n", npages); -- -- // Round up to COMMITSIZE pages -- npages = (npages + (COMMITSIZE/PAGESIZE) - 1) & ~(COMMITSIZE/PAGESIZE - 1); -- -- // Minimum of POOLSIZE -- if (npages < POOLSIZE/PAGESIZE) -- npages = POOLSIZE/PAGESIZE; -- else if (npages > POOLSIZE/PAGESIZE) -- { // Give us 150% of requested size, so there's room to extend -- auto n = npages + (npages >> 1); -- if (n < size_t.max/PAGESIZE) -- npages = n; -- } -- -- // Allocate successively larger pools up to 8 megs -- if (npools) -- { size_t n; -- -- n = npools; -- if (n > 32) -- n = 32; // cap pool size at 32 megs -- else if (n > 8) -- n = 16; -- n *= (POOLSIZE / PAGESIZE); -- if (npages < n) -- npages = n; -- } -- -- //printf("npages = %d\n", npages); -- -- pool = cast(Pool *)cstdlib.calloc(1, Pool.sizeof); -- if (pool) -- { -- pool.initialize(npages, isLargeObject); -- if (!pool.baseAddr) -- goto Lerr; -- -- newnpools = npools + 1; -- newpooltable = cast(Pool **)cstdlib.realloc(pooltable, newnpools * (Pool *).sizeof); -- if (!newpooltable) -- goto Lerr; -- -- // Sort pool into newpooltable[] -- for (i = 0; i < npools; i++) -- { -- if (pool.opCmp(newpooltable[i]) < 0) -- break; -- } -- memmove(newpooltable + i + 1, newpooltable + i, (npools - i) * (Pool *).sizeof); -- newpooltable[i] = pool; -- -- pooltable = newpooltable; -- npools = newnpools; -- -- minAddr = pooltable[0].baseAddr; -- maxAddr = pooltable[npools - 1].topAddr; -- } -- return pool; -- -- Lerr: -- pool.Dtor(); -- cstdlib.free(pool); -- return null; -- } -- -- -- /** -- * Allocate a page of bin's. -- * Returns: -- * 0 failed -- */ -- int allocPage(Bins bin) -- { -- Pool* pool; -- size_t n; -- size_t pn; -- byte* p; -- byte* ptop; -- -- //debug(PRINTF) printf("Gcx::allocPage(bin = %d)\n", bin); -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- if(pool.isLargeObject) continue; -- pn = pool.allocPages(1); -- if (pn != OPFAIL) -- goto L1; -- } -- return 0; // failed -- -- L1: -- pool.pagetable[pn] = cast(ubyte)bin; -- pool.freepages--; -- -- // Convert page to free list -- size_t size = binsize[bin]; -- List **b = &bucket[bin]; -- -- p = pool.baseAddr + pn * PAGESIZE; -- ptop = p + PAGESIZE; -- for (; p < ptop; p += size) -- { -- (cast(List *)p).next = *b; -- (cast(List *)p).pool = pool; -- *b = cast(List *)p; -- } -- return 1; -- } -- -- /** -- * Mark overload for initial mark() call. -- */ -- void mark(void *pbot, void *ptop) { -- mark(pbot, ptop, MAX_MARK_RECURSIONS); -- } -- -- /** -- * Search a range of memory values and mark any pointers into the GC pool. -- */ -- void mark(void *pbot, void *ptop, int nRecurse) -- { -- //import core.stdc.stdio;printf("nRecurse = %d\n", nRecurse); -- void **p1 = cast(void **)pbot; -- void **p2 = cast(void **)ptop; -- size_t pcache = 0; -- uint changes = 0; -- -- //printf("marking range: %p -> %p\n", pbot, ptop); -- for (; p1 < p2; p1++) -- { -- auto p = cast(byte *)(*p1); -- -- //if (log) debug(PRINTF) printf("\tmark %p\n", p); -- if (p >= minAddr && p < maxAddr) -- { -- if ((cast(size_t)p & ~cast(size_t)(PAGESIZE-1)) == pcache) -- continue; -- -- auto pool = findPool(p); -- if (pool) -- { -- size_t offset = cast(size_t)(p - pool.baseAddr); -- size_t biti = void; -- size_t pn = offset / PAGESIZE; -- Bins bin = cast(Bins)pool.pagetable[pn]; -- void* base = void; -- -- // For the NO_INTERIOR attribute. This tracks whether -- // the pointer is an interior pointer or points to the -- // base address of a block. -- bool pointsToBase = false; -- -- //debug(PRINTF) printf("\t\tfound pool %p, base=%p, pn = %zd, bin = %d, biti = x%x\n", pool, pool.baseAddr, pn, bin, biti); -- -- // Adjust bit to be at start of allocated memory block -- if (bin < B_PAGE) -- { -- // We don't care abou setting pointsToBase correctly -- // because it's ignored for small object pools anyhow. -- auto offsetBase = offset & notbinsize[bin]; -- biti = offsetBase >> pool.shiftBy; -- base = pool.baseAddr + offsetBase; -- //debug(PRINTF) printf("\t\tbiti = x%x\n", biti); -- } -- else if (bin == B_PAGE) -- { -- auto offsetBase = offset & notbinsize[bin]; -- base = pool.baseAddr + offsetBase; -- pointsToBase = offsetBase == offset; -- biti = offsetBase >> pool.shiftBy; -- //debug(PRINTF) printf("\t\tbiti = x%x\n", biti); -- -- pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1); -- } -- else if (bin == B_PAGEPLUS) -- { -- pn -= pool.bPageOffsets[pn]; -- base = pool.baseAddr + (pn * PAGESIZE); -- biti = pn * (PAGESIZE >> pool.shiftBy); -- pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1); -- } -- else -- { -- // Don't mark bits in B_FREE or B_UNCOMMITTED pages -- continue; -- } -- -- if(pool.nointerior.nbits && !pointsToBase && pool.nointerior.test(biti)) -- { -- continue; -- } -- -- //debug(PRINTF) printf("\t\tmark(x%x) = %d\n", biti, pool.mark.test(biti)); -- if (!pool.mark.testSet(biti)) -- { -- //if (log) debug(PRINTF) printf("\t\tmarking %p\n", p); -- if (!pool.noscan.test(biti)) -- { -- if(nRecurse == 0) { -- // Then we've got a really deep heap graph. -- // Start marking stuff to be scanned when we -- // traverse the heap again next time, to save -- // stack space. -- pool.scan.set(biti); -- changes = 1; -- pool.newChanges = true; -- } else { -- // Directly recurse mark() to prevent having -- // to traverse the heap O(D) times where D -- // is the max depth of the heap graph. -- if (bin < B_PAGE) -- { -- mark(base, base + binsize[bin], nRecurse - 1); -- } -- else -- { -- auto u = pool.bPageOffsets[pn]; -- mark(base, base + u * PAGESIZE, nRecurse - 1); -- } -- } -- } -- -- debug (LOGGING) log_parent(sentinel_add(pool.baseAddr + (biti << pool.shiftBy)), sentinel_add(pbot)); -- } -- } -- } -- } -- anychanges |= changes; -- } -- -- -- /** -- * Return number of full pages free'd. -- */ -- size_t fullcollect() -- { -- size_t n; -- Pool* pool; -- -- debug(PROFILING) -- { -- clock_t start, stop; -- start = clock(); -- } -- -- debug(COLLECT_PRINTF) printf("Gcx.fullcollect()\n"); -- //printf("\tpool address range = %p .. %p\n", minAddr, maxAddr); -- -- if (running) -- onInvalidMemoryOperationError(); -- running = 1; -- -- thread_suspendAll(); -- -- cached_size_key = cached_size_key.init; -- cached_size_val = cached_size_val.init; -- cached_info_key = cached_info_key.init; -- cached_info_val = cached_info_val.init; -- -- anychanges = 0; -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- pool.mark.zero(); -- pool.scan.zero(); -- if(!pool.isLargeObject) pool.freebits.zero(); -- } -- -- debug(COLLECT_PRINTF) printf("Set bits\n"); -- -- // Mark each free entry, so it doesn't get scanned -- for (n = 0; n < B_PAGE; n++) -- { -- for (List *list = bucket[n]; list; list = list.next) -- { -- pool = list.pool; -- assert(pool); -- pool.freebits.set(cast(size_t)(cast(byte*)list - pool.baseAddr) / 16); -- } -- } -- -- debug(COLLECT_PRINTF) printf("Marked free entries.\n"); -- -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- pool.newChanges = false; // Some of these get set to true on stack scan. -- if(!pool.isLargeObject) -- { -- pool.mark.copy(&pool.freebits); -- } -- } -- -- debug(PROFILING) -- { -- stop = clock(); -- prepTime += (stop - start); -- start = stop; -- } -- -- if (!noStack) -- { -- debug(COLLECT_PRINTF) printf("\tscan stacks.\n"); -- // Scan stacks and registers for each paused thread -- thread_scanAll(&mark); -- } -- -- // Scan roots[] -- debug(COLLECT_PRINTF) printf("\tscan roots[]\n"); -- mark(roots, roots + nroots); -- -- // Scan ranges[] -- debug(COLLECT_PRINTF) printf("\tscan ranges[]\n"); -- //log++; -- for (n = 0; n < nranges; n++) -- { -- debug(COLLECT_PRINTF) printf("\t\t%p .. %p\n", ranges[n].pbot, ranges[n].ptop); -- mark(ranges[n].pbot, ranges[n].ptop); -- } -- //log--; -- -- debug(COLLECT_PRINTF) printf("\tscan heap\n"); -- int nTraversals; -- while (anychanges) -- { -- //import core.stdc.stdio; printf("nTraversals = %d\n", ++nTraversals); -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- pool.oldChanges = pool.newChanges; -- pool.newChanges = false; -- } -- -- debug(COLLECT_PRINTF) printf("\t\tpass\n"); -- anychanges = 0; -- for (n = 0; n < npools; n++) -- { -- pool = pooltable[n]; -- if(!pool.oldChanges) continue; -- -- auto shiftBy = pool.shiftBy; -- auto bbase = pool.scan.base(); -- auto btop = bbase + pool.scan.nwords; -- //printf("\t\tn = %d, bbase = %p, btop = %p\n", n, bbase, btop); -- for (auto b = bbase; b < btop;) -- { -- auto bitm = *b; -- if (!bitm) -- { b++; -- continue; -- } -- *b = 0; -- -- auto o = pool.baseAddr + (b - bbase) * ((typeof(bitm).sizeof*8) << shiftBy); -- -- auto firstset = bsf(bitm); -- bitm >>= firstset; -- o += firstset << shiftBy; -- -- while(bitm) -- { -- auto pn = cast(size_t)(o - pool.baseAddr) / PAGESIZE; -- auto bin = cast(Bins)pool.pagetable[pn]; -- if (bin < B_PAGE) -- { -- mark(o, o + binsize[bin]); -- } -- else if (bin == B_PAGE) -- { -- auto u = pool.bPageOffsets[pn]; -- mark(o, o + u * PAGESIZE); -- } -- -- bitm >>= 1; -- auto nbits = bsf(bitm); -- bitm >>= nbits; -- o += (nbits + 1) << shiftBy; -- } -- } -- } -- } -- -- thread_processGCMarks(&isMarked); -- thread_resumeAll(); -- -- debug(PROFILING) -- { -- stop = clock(); -- markTime += (stop - start); -- start = stop; -- } -- -- // Free up everything not marked -- debug(COLLECT_PRINTF) printf("\tfree'ing\n"); -- size_t freedpages = 0; -- size_t freed = 0; -- for (n = 0; n < npools; n++) -- { size_t pn; -- -- pool = pooltable[n]; -- auto ncommitted = pool.ncommitted; -- -- if(pool.isLargeObject) -- { -- for(pn = 0; pn < ncommitted; pn++) -- { -- Bins bin = cast(Bins)pool.pagetable[pn]; -- if(bin > B_PAGE) continue; -- size_t biti = pn; -- -- if (!pool.mark.test(biti)) -- { byte *p = pool.baseAddr + pn * PAGESIZE; -- -- sentinel_Invariant(sentinel_add(p)); -- if (pool.finals.nbits && pool.finals.testClear(biti)) -- rt_finalize2(sentinel_add(p), false, false); -- clrBits(pool, biti, BlkAttr.ALL_BITS ^ BlkAttr.FINALIZE); -- -- debug(COLLECT_PRINTF) printf("\tcollecting big %p\n", p); -- log_free(sentinel_add(p)); -- pool.pagetable[pn] = B_FREE; -- if(pn < pool.searchStart) pool.searchStart = pn; -- freedpages++; -- pool.freepages++; -- -- debug (MEMSTOMP) memset(p, 0xF3, PAGESIZE); -- while (pn + 1 < ncommitted && pool.pagetable[pn + 1] == B_PAGEPLUS) -- { -- pn++; -- pool.pagetable[pn] = B_FREE; -- -- // Don't need to update searchStart here because -- // pn is guaranteed to be greater than last time -- // we updated it. -- -- pool.freepages++; -- freedpages++; -- -- debug (MEMSTOMP) -- { p += PAGESIZE; -- memset(p, 0xF3, PAGESIZE); -- } -- } -- } -- } -- -- continue; -- } -- else -- { -- -- for (pn = 0; pn < ncommitted; pn++) -- { -- Bins bin = cast(Bins)pool.pagetable[pn]; -- -- if (bin < B_PAGE) -- { -- auto size = binsize[bin]; -- byte *p = pool.baseAddr + pn * PAGESIZE; -- byte *ptop = p + PAGESIZE; -- size_t biti = pn * (PAGESIZE/16); -- size_t bitstride = size / 16; -- -- GCBits.wordtype toClear; -- size_t clearStart = (biti >> GCBits.BITS_SHIFT) + 1; -- size_t clearIndex; -- -- for (; p < ptop; p += size, biti += bitstride, clearIndex += bitstride) -- { -- if(clearIndex > GCBits.BITS_PER_WORD - 1) -- { -- if(toClear) -- { -- Gcx.clrBitsSmallSweep(pool, clearStart, toClear); -- toClear = 0; -- } -- -- clearStart = (biti >> GCBits.BITS_SHIFT) + 1; -- clearIndex = biti & GCBits.BITS_MASK; -- } -- -- if (!pool.mark.test(biti)) -- { -- sentinel_Invariant(sentinel_add(p)); -- -- pool.freebits.set(biti); -- if (pool.finals.nbits && pool.finals.test(biti)) -- rt_finalize2(sentinel_add(p), false, false); -- toClear |= GCBits.BITS_1 << clearIndex; -- -- List *list = cast(List *)p; -- debug(PRINTF) printf("\tcollecting %p\n", list); -- log_free(sentinel_add(list)); -- -- debug (MEMSTOMP) memset(p, 0xF3, size); -- -- freed += size; -- } -- } -- -- if(toClear) -- { -- Gcx.clrBitsSmallSweep(pool, clearStart, toClear); -- } -- } -- } -- } -- } -- -- debug(PROFILING) -- { -- stop = clock(); -- sweepTime += (stop - start); -- start = stop; -- } -- -- // Zero buckets -- bucket[] = null; -- -- // Free complete pages, rebuild free list -- debug(COLLECT_PRINTF) printf("\tfree complete pages\n"); -- size_t recoveredpages = 0; -- for (n = 0; n < npools; n++) -- { size_t pn; -- size_t ncommitted; -- -- pool = pooltable[n]; -- if(pool.isLargeObject) continue; -- ncommitted = pool.ncommitted; -- for (pn = 0; pn < ncommitted; pn++) -- { -- Bins bin = cast(Bins)pool.pagetable[pn]; -- size_t biti; -- size_t u; -- -- if (bin < B_PAGE) -- { -- size_t size = binsize[bin]; -- size_t bitstride = size / 16; -- size_t bitbase = pn * (PAGESIZE / 16); -- size_t bittop = bitbase + (PAGESIZE / 16); -- byte* p; -- -- biti = bitbase; -- for (biti = bitbase; biti < bittop; biti += bitstride) -- { if (!pool.freebits.test(biti)) -- goto Lnotfree; -- } -- pool.pagetable[pn] = B_FREE; -- if(pn < pool.searchStart) pool.searchStart = pn; -- pool.freepages++; -- recoveredpages++; -- continue; -- -- Lnotfree: -- p = pool.baseAddr + pn * PAGESIZE; -- for (u = 0; u < PAGESIZE; u += size) -- { biti = bitbase + u / 16; -- if (pool.freebits.test(biti)) -- { List *list; -- -- list = cast(List *)(p + u); -- if (list.next != bucket[bin]) // avoid unnecessary writes -- list.next = bucket[bin]; -- list.pool = pool; -- bucket[bin] = list; -- } -- } -- } -- } -- } -- -- debug(PROFILING) -- { -- stop = clock(); -- recoverTime += (stop - start); -- } -- -- debug(COLLECT_PRINTF) printf("\trecovered pages = %d\n", recoveredpages); -- debug(COLLECT_PRINTF) printf("\tfree'd %u bytes, %u pages from %u pools\n", freed, freedpages, npools); -- -- running = 0; // only clear on success -- -- return freedpages + recoveredpages; -- } -- -- /** -- * Returns true if the addr lies within a marked block. -- * -- * Warning! This should only be called while the world is stopped inside -- * the fullcollect function. -- */ -- IsMarked isMarked(void *addr) -- { -- // first, we find the Pool this block is in, then check to see if the -- // mark bit is clear. -- auto pool = findPool(addr); -- if(pool) -- { -- auto offset = cast(size_t)(addr - pool.baseAddr); -- auto pn = offset / PAGESIZE; -- auto bins = cast(Bins)pool.pagetable[pn]; -- size_t biti = void; -- if(bins <= B_PAGE) -- { -- biti = (offset & notbinsize[bins]) >> pool.shiftBy; -- } -- else -- { -- pn -= pool.bPageOffsets[pn]; -- biti = pn * (PAGESIZE >> pool.shiftBy); -- } -- return pool.mark.test(biti) ? IsMarked.yes : IsMarked.no; -- } -- return IsMarked.unknown; -- } -- -- -- /** -- * -- */ -- uint getBits(Pool* pool, size_t biti) -- in -- { -- assert(pool); -- } -- body -- { -- uint bits; -- -- if (pool.finals.nbits && -- pool.finals.test(biti)) -- bits |= BlkAttr.FINALIZE; -- if (pool.noscan.test(biti)) -- bits |= BlkAttr.NO_SCAN; -- if (pool.nointerior.nbits && pool.nointerior.test(biti)) -- bits |= BlkAttr.NO_INTERIOR; --// if (pool.nomove.nbits && --// pool.nomove.test(biti)) --// bits |= BlkAttr.NO_MOVE; -- if (pool.appendable.test(biti)) -- bits |= BlkAttr.APPENDABLE; -- return bits; -- } -- -- -- /** -- * -- */ -- void setBits(Pool* pool, size_t biti, uint mask) -- in -- { -- assert(pool); -- } -- body -- { -- // Calculate the mask and bit offset once and then use it to -- // set all of the bits we need to set. -- immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT); -- immutable bitOffset = biti & GCBits.BITS_MASK; -- immutable orWith = GCBits.BITS_1 << bitOffset; -- -- if (mask & BlkAttr.FINALIZE) -- { -- if (!pool.finals.nbits) -- pool.finals.alloc(pool.mark.nbits); -- pool.finals.data[dataIndex] |= orWith; -- } -- if (mask & BlkAttr.NO_SCAN) -- { -- pool.noscan.data[dataIndex] |= orWith; -- } --// if (mask & BlkAttr.NO_MOVE) --// { --// if (!pool.nomove.nbits) --// pool.nomove.alloc(pool.mark.nbits); --// pool.nomove.data[dataIndex] |= orWith; --// } -- if (mask & BlkAttr.APPENDABLE) -- { -- pool.appendable.data[dataIndex] |= orWith; -- } -- -- if (pool.isLargeObject && (mask & BlkAttr.NO_INTERIOR)) -- { -- if(!pool.nointerior.nbits) -- pool.nointerior.alloc(pool.mark.nbits); -- pool.nointerior.data[dataIndex] |= orWith; -- } -- } -- -- -- /** -- * -- */ -- void clrBits(Pool* pool, size_t biti, uint mask) -- in -- { -- assert(pool); -- } -- body -- { -- immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT); -- immutable bitOffset = biti & GCBits.BITS_MASK; -- immutable keep = ~(GCBits.BITS_1 << bitOffset); -- -- if (mask & BlkAttr.FINALIZE && pool.finals.nbits) -- pool.finals.data[dataIndex] &= keep; -- if (mask & BlkAttr.NO_SCAN) -- pool.noscan.data[dataIndex] &= keep; --// if (mask & BlkAttr.NO_MOVE && pool.nomove.nbits) --// pool.nomove.data[dataIndex] &= keep; -- if (mask & BlkAttr.APPENDABLE) -- pool.appendable.data[dataIndex] &= keep; -- if (pool.nointerior.nbits && (mask & BlkAttr.NO_INTERIOR)) -- pool.nointerior.data[dataIndex] &= keep; -- } -- -- void clrBitsSmallSweep(Pool* pool, size_t dataIndex, GCBits.wordtype toClear) -- in -- { -- assert(pool); -- } -- body -- { -- immutable toKeep = ~toClear; -- if (pool.finals.nbits) -- pool.finals.data[dataIndex] &= toKeep; -- -- pool.noscan.data[dataIndex] &= toKeep; -- --// if (pool.nomove.nbits) --// pool.nomove.data[dataIndex] &= toKeep; -- -- pool.appendable.data[dataIndex] &= toKeep; -- -- if (pool.nointerior.nbits) -- pool.nointerior.data[dataIndex] &= toKeep; -- } -- -- /***** Leak Detector ******/ -- -- -- debug (LOGGING) -- { -- LogArray current; -- LogArray prev; -- -- -- void log_init() -- { -- //debug(PRINTF) printf("+log_init()\n"); -- current.reserve(1000); -- prev.reserve(1000); -- //debug(PRINTF) printf("-log_init()\n"); -- } -- -- -- void log_malloc(void *p, size_t size) -- { -- //debug(PRINTF) printf("+log_malloc(p = %p, size = %zd)\n", p, size); -- Log log; -- -- log.p = p; -- log.size = size; -- log.line = GC.line; -- log.file = GC.file; -- log.parent = null; -- -- GC.line = 0; -- GC.file = null; -- -- current.push(log); -- //debug(PRINTF) printf("-log_malloc()\n"); -- } -- -- -- void log_free(void *p) -- { -- //debug(PRINTF) printf("+log_free(%p)\n", p); -- auto i = current.find(p); -- if (i == OPFAIL) -- { -- debug(PRINTF) printf("free'ing unallocated memory %p\n", p); -- } -- else -- current.remove(i); -- //debug(PRINTF) printf("-log_free()\n"); -- } -- -- -- void log_collect() -- { -- //debug(PRINTF) printf("+log_collect()\n"); -- // Print everything in current that is not in prev -- -- debug(PRINTF) printf("New pointers this cycle: --------------------------------\n"); -- size_t used = 0; -- for (size_t i = 0; i < current.dim; i++) -- { -- auto j = prev.find(current.data[i].p); -- if (j == OPFAIL) -- current.data[i].print(); -- else -- used++; -- } -- -- debug(PRINTF) printf("All roots this cycle: --------------------------------\n"); -- for (size_t i = 0; i < current.dim; i++) -- { -- void* p = current.data[i].p; -- if (!findPool(current.data[i].parent)) -- { -- auto j = prev.find(current.data[i].p); -- debug(PRINTF) printf(j == OPFAIL ? "N" : " "); -- current.data[i].print(); -- } -- } -- -- debug(PRINTF) printf("Used = %d-------------------------------------------------\n", used); -- prev.copy(¤t); -- -- debug(PRINTF) printf("-log_collect()\n"); -- } -- -- -- void log_parent(void *p, void *parent) -- { -- //debug(PRINTF) printf("+log_parent()\n"); -- auto i = current.find(p); -- if (i == OPFAIL) -- { -- debug(PRINTF) printf("parent'ing unallocated memory %p, parent = %p\n", p, parent); -- Pool *pool; -- pool = findPool(p); -- assert(pool); -- size_t offset = cast(size_t)(p - pool.baseAddr); -- size_t biti; -- size_t pn = offset / PAGESIZE; -- Bins bin = cast(Bins)pool.pagetable[pn]; -- biti = (offset & notbinsize[bin]); -- debug(PRINTF) printf("\tbin = %d, offset = x%x, biti = x%x\n", bin, offset, biti); -- } -- else -- { -- current.data[i].parent = parent; -- } -- //debug(PRINTF) printf("-log_parent()\n"); -- } -- -- } -- else -- { -- void log_init() { } -- void log_malloc(void *p, size_t size) { } -- void log_free(void *p) { } -- void log_collect() { } -- void log_parent(void *p, void *parent) { } -- } --} -- -- --/* ============================ Pool =============================== */ -- -- --struct Pool --{ -- byte* baseAddr; -- byte* topAddr; -- GCBits mark; // entries already scanned, or should not be scanned -- GCBits scan; // entries that need to be scanned -- GCBits freebits; // entries that are on the free list -- GCBits finals; // entries that need finalizer run on them -- GCBits noscan; // entries that should not be scanned -- GCBits appendable; // entries that are appendable -- GCBits nointerior; // interior pointers should be ignored. -- // Only implemented for large object pools. -- -- size_t npages; -- size_t freepages; // The number of pages not in use. -- size_t ncommitted; // ncommitted <= npages -- ubyte* pagetable; -- -- bool isLargeObject; -- bool oldChanges; // Whether there were changes on the last mark. -- bool newChanges; // Whether there were changes on the current mark. -- -- // This tracks how far back we have to go to find the nearest B_PAGE at -- // a smaller address than a B_PAGEPLUS. To save space, we use a uint. -- // This limits individual allocations to 16 terabytes, assuming a 4k -- // pagesize. -- uint* bPageOffsets; -- -- // This variable tracks a conservative estimate of where the first free -- // page in this pool is, so that if a lot of pages towards the beginning -- // are occupied, we can bypass them in O(1). -- size_t searchStart; -- -- void initialize(size_t npages, bool isLargeObject) -- { -- this.isLargeObject = isLargeObject; -- size_t poolsize; -- -- //debug(PRINTF) printf("Pool::Pool(%u)\n", npages); -- poolsize = npages * PAGESIZE; -- assert(poolsize >= POOLSIZE); -- baseAddr = cast(byte *)os_mem_map(poolsize); -- -- // Some of the code depends on page alignment of memory pools -- assert((cast(size_t)baseAddr & (PAGESIZE - 1)) == 0); -- -- if (!baseAddr) -- { -- //debug(PRINTF) printf("GC fail: poolsize = x%zx, errno = %d\n", poolsize, errno); -- //debug(PRINTF) printf("message = '%s'\n", sys_errlist[errno]); -- -- npages = 0; -- poolsize = 0; -- } -- //assert(baseAddr); -- topAddr = baseAddr + poolsize; -- auto div = this.divisor; -- auto nbits = cast(size_t)poolsize / div; -- -- mark.alloc(nbits); -- scan.alloc(nbits); -- -- // pagetable already keeps track of what's free for the large object -- // pool. -- if(!isLargeObject) -- { -- freebits.alloc(nbits); -- } -- -- noscan.alloc(nbits); -- appendable.alloc(nbits); -- -- pagetable = cast(ubyte*)cstdlib.malloc(npages); -- if (!pagetable) -- onOutOfMemoryError(); -- -- if(isLargeObject) -- { -- bPageOffsets = cast(uint*)cstdlib.malloc(npages * uint.sizeof); -- if (!bPageOffsets) -- onOutOfMemoryError(); -- } -- -- memset(pagetable, B_UNCOMMITTED, npages); -- -- this.npages = npages; -- this.freepages = npages; -- ncommitted = 0; -- } -- -- -- void Dtor() -- { -- if (baseAddr) -- { -- int result; -- -- if (ncommitted) -- { -- result = os_mem_decommit(baseAddr, 0, ncommitted * PAGESIZE); -- assert(result == 0); -- ncommitted = 0; -- } -- -- if (npages) -- { -- result = os_mem_unmap(baseAddr, npages * PAGESIZE); -- assert(result == 0); -- npages = 0; -- } -- -- baseAddr = null; -- topAddr = null; -- } -- if (pagetable) -- cstdlib.free(pagetable); -- -- if(bPageOffsets) -- cstdlib.free(bPageOffsets); -- -- mark.Dtor(); -- scan.Dtor(); -- if(isLargeObject) -- { -- nointerior.Dtor(); -- } -- else -- { -- freebits.Dtor(); -- } -- finals.Dtor(); -- noscan.Dtor(); -- appendable.Dtor(); -- } -- -- -- void Invariant() const {} -- -- -- invariant() -- { -- //mark.Invariant(); -- //scan.Invariant(); -- //freebits.Invariant(); -- //finals.Invariant(); -- //noscan.Invariant(); -- //appendable.Invariant(); -- //nointerior.Invariant(); -- -- if (baseAddr) -- { -- //if (baseAddr + npages * PAGESIZE != topAddr) -- //printf("baseAddr = %p, npages = %d, topAddr = %p\n", baseAddr, npages, topAddr); -- assert(baseAddr + npages * PAGESIZE == topAddr); -- assert(ncommitted <= npages); -- } -- -- for (size_t i = 0; i < npages; i++) -- { -- Bins bin = cast(Bins)pagetable[i]; -- assert(bin < B_MAX); -- } -- } -- -- // The divisor used for determining bit indices. -- @property private size_t divisor() -- { -- // NOTE: Since this is called by initialize it must be private or -- // invariant() will be called and fail. -- return isLargeObject ? PAGESIZE : 16; -- } -- -- // Bit shift for fast division by divisor. -- @property uint shiftBy() -- { -- return isLargeObject ? 12 : 4; -- } -- -- void updateOffsets(size_t fromWhere) -- { -- assert(pagetable[fromWhere] == B_PAGE); -- size_t pn = fromWhere + 1; -- for(uint offset = 1; pn < ncommitted; pn++, offset++) -- { -- if(pagetable[pn] != B_PAGEPLUS) break; -- bPageOffsets[pn] = offset; -- } -- -- // Store the size of the block in bPageOffsets[fromWhere]. -- bPageOffsets[fromWhere] = cast(uint) (pn - fromWhere); -- } -- -- /** -- * Allocate n pages from Pool. -- * Returns OPFAIL on failure. -- */ -- size_t allocPages(size_t n) -- { -- if(freepages < n) return OPFAIL; -- size_t i; -- size_t n2; -- -- //debug(PRINTF) printf("Pool::allocPages(n = %d)\n", n); -- n2 = n; -- for (i = searchStart; i < ncommitted; i++) -- { -- if (pagetable[i] == B_FREE) -- { -- if(pagetable[searchStart] < B_FREE) -- { -- searchStart = i + (!isLargeObject); -- } -- -- if (--n2 == 0) -- { //debug(PRINTF) printf("\texisting pn = %d\n", i - n + 1); -- return i - n + 1; -- } -- } -- else -- { -- n2 = n; -- if(pagetable[i] == B_PAGE) -- { -- // Then we have the offset information. We can skip a -- // whole bunch of stuff. -- i += bPageOffsets[i] - 1; -- } -- } -- } -- -- if(pagetable[searchStart] < B_FREE) -- { -- searchStart = ncommitted; -- } -- -- return extendPages(n); -- } -- -- /** -- * Extend Pool by n pages. -- * Returns OPFAIL on failure. -- */ -- size_t extendPages(size_t n) -- { -- //debug(PRINTF) printf("Pool::extendPages(n = %d)\n", n); -- if (ncommitted + n <= npages) -- { -- size_t tocommit; -- -- tocommit = (n + (COMMITSIZE/PAGESIZE) - 1) & ~(COMMITSIZE/PAGESIZE - 1); -- if (ncommitted + tocommit > npages) -- tocommit = npages - ncommitted; -- //debug(PRINTF) printf("\tlooking to commit %d more pages\n", tocommit); -- //fflush(stdout); -- if (os_mem_commit(baseAddr, ncommitted * PAGESIZE, tocommit * PAGESIZE) == 0) -- { -- memset(pagetable + ncommitted, B_FREE, tocommit); -- auto i = ncommitted; -- ncommitted += tocommit; -- -- while (i && pagetable[i - 1] == B_FREE) -- i--; -- -- return i; -- } -- //debug(PRINTF) printf("\tfailed to commit %d pages\n", tocommit); -- } -- -- return OPFAIL; -- } -- -- /** -- * extends pages up to at least n pages. Returns the number of pages -- * added. -- */ -- size_t extendPagesUpTo(size_t n) -- { -- //debug(PRINTF) printf("Pool::extendPagesUpTo(n = %d)\n", n); -- if (ncommitted + n > npages) -- n = npages - ncommitted; -- size_t tocommit; -- -- tocommit = (n + (COMMITSIZE/PAGESIZE) - 1) & ~(COMMITSIZE/PAGESIZE - 1); -- if (ncommitted + tocommit > npages) -- tocommit = npages - ncommitted; -- if(tocommit == 0) -- return 0; -- //debug(PRINTF) printf("\tlooking to commit %d more pages\n", tocommit); -- //fflush(stdout); -- if (os_mem_commit(baseAddr, ncommitted * PAGESIZE, tocommit * PAGESIZE) == 0) -- { -- memset(pagetable + ncommitted, B_FREE, tocommit); -- ncommitted += tocommit; -- -- return tocommit > n; -- } -- //debug(PRINTF) printf("\tfailed to commit %d pages\n", tocommit); -- -- return OPFAIL; -- } -- -- -- /** -- * Free npages pages starting with pagenum. -- */ -- void freePages(size_t pagenum, size_t npages) -- { -- //memset(&pagetable[pagenum], B_FREE, npages); -- if(pagenum < searchStart) searchStart = pagenum; -- -- for(size_t i = pagenum; i < npages + pagenum; i++) -- { -- if(pagetable[i] < B_FREE) -- { -- freepages++; -- } -- -- pagetable[i] = B_FREE; -- } -- } -- -- -- /** -- * Used for sorting pooltable[] -- */ -- int opCmp(const Pool *p2) const -- { -- if (baseAddr < p2.baseAddr) -- return -1; -- else -- return cast(int)(baseAddr > p2.baseAddr); -- } --} -- -- --/* ============================ SENTINEL =============================== */ -- -- --version (SENTINEL) --{ -- const size_t SENTINEL_PRE = cast(size_t) 0xF4F4F4F4F4F4F4F4UL; // 32 or 64 bits -- const ubyte SENTINEL_POST = 0xF5; // 8 bits -- const uint SENTINEL_EXTRA = 2 * size_t.sizeof + 1; -- -- -- size_t* sentinel_size(void *p) { return &(cast(size_t *)p)[-2]; } -- size_t* sentinel_pre(void *p) { return &(cast(size_t *)p)[-1]; } -- ubyte* sentinel_post(void *p) { return &(cast(ubyte *)p)[*sentinel_size(p)]; } -- -- -- void sentinel_init(void *p, size_t size) -- { -- *sentinel_size(p) = size; -- *sentinel_pre(p) = SENTINEL_PRE; -- *sentinel_post(p) = SENTINEL_POST; -- } -- -- -- void sentinel_Invariant(const void *p) -- { -- assert(*sentinel_pre(p) == SENTINEL_PRE); -- assert(*sentinel_post(p) == SENTINEL_POST); -- } -- -- -- void *sentinel_add(void *p) -- { -- return p + 2 * size_t.sizeof; -- } -- -- -- void *sentinel_sub(void *p) -- { -- return p - 2 * size_t.sizeof; -- } --} --else --{ -- const uint SENTINEL_EXTRA = 0; -- -- -- void sentinel_init(void *p, size_t size) -- { -- } -- -- -- void sentinel_Invariant(const void *p) -- { -- } -- -- -- void *sentinel_add(void *p) -- { -- return p; -- } -- -- -- void *sentinel_sub(void *p) -- { -- return p; -- } --} ---- a/src/libphobos/libdruntime/gc/os.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/os.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,141 @@ -+/** -+ * Contains OS-level routines needed by the garbage collector. -+ * -+ * Copyright: Copyright Digital Mars 2005 - 2013. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Walter Bright, David Friedman, Sean Kelly, Leandro Lucarella -+ */ -+ -+/* Copyright Digital Mars 2005 - 2013. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module gc.os; -+ -+ -+version (Windows) -+{ -+ import core.sys.windows.windows; -+ -+ alias int pthread_t; -+ -+ pthread_t pthread_self() -+ { -+ return cast(pthread_t) GetCurrentThreadId(); -+ } -+ -+ //version = GC_Use_Alloc_Win32; -+} -+else version (Posix) -+{ -+ import core.sys.posix.sys.mman; -+ version (linux) import core.sys.linux.sys.mman : MAP_ANON; -+ import core.stdc.stdlib; -+ -+ //version = GC_Use_Alloc_MMap; -+} -+else -+{ -+ import core.stdc.stdlib; -+ -+ //version = GC_Use_Alloc_Malloc; -+} -+ -+/+ -+static if(is(typeof(VirtualAlloc))) -+ version = GC_Use_Alloc_Win32; -+else static if (is(typeof(mmap))) -+ version = GC_Use_Alloc_MMap; -+else static if (is(typeof(valloc))) -+ version = GC_Use_Alloc_Valloc; -+else static if (is(typeof(malloc))) -+ version = GC_Use_Alloc_Malloc; -+else static assert(false, "No supported allocation methods available."); -++/ -+ -+static if (is(typeof(VirtualAlloc))) // version (GC_Use_Alloc_Win32) -+{ -+ /** -+ * Map memory. -+ */ -+ void *os_mem_map(size_t nbytes) -+ { -+ return VirtualAlloc(null, nbytes, MEM_RESERVE | MEM_COMMIT, -+ PAGE_READWRITE); -+ } -+ -+ -+ /** -+ * Unmap memory allocated with os_mem_map(). -+ * Returns: -+ * 0 success -+ * !=0 failure -+ */ -+ int os_mem_unmap(void *base, size_t nbytes) -+ { -+ return cast(int)(VirtualFree(base, 0, MEM_RELEASE) == 0); -+ } -+} -+else static if (is(typeof(mmap))) // else version (GC_Use_Alloc_MMap) -+{ -+ void *os_mem_map(size_t nbytes) -+ { void *p; -+ -+ p = mmap(null, nbytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); -+ return (p == MAP_FAILED) ? null : p; -+ } -+ -+ -+ int os_mem_unmap(void *base, size_t nbytes) -+ { -+ return munmap(base, nbytes); -+ } -+} -+else static if (is(typeof(valloc))) // else version (GC_Use_Alloc_Valloc) -+{ -+ void *os_mem_map(size_t nbytes) -+ { -+ return valloc(nbytes); -+ } -+ -+ -+ int os_mem_unmap(void *base, size_t nbytes) -+ { -+ free(base); -+ return 0; -+ } -+} -+else static if (is(typeof(malloc))) // else version (GC_Use_Alloc_Malloc) -+{ -+ // NOTE: This assumes malloc granularity is at least (void*).sizeof. If -+ // (req_size + PAGESIZE) is allocated, and the pointer is rounded up -+ // to PAGESIZE alignment, there will be space for a void* at the end -+ // after PAGESIZE bytes used by the GC. -+ -+ -+ import gc.gc; -+ -+ -+ const size_t PAGE_MASK = PAGESIZE - 1; -+ -+ -+ void *os_mem_map(size_t nbytes) -+ { byte *p, q; -+ p = cast(byte *) malloc(nbytes + PAGESIZE); -+ q = p + ((PAGESIZE - ((cast(size_t) p & PAGE_MASK))) & PAGE_MASK); -+ * cast(void**)(q + nbytes) = p; -+ return q; -+ } -+ -+ -+ int os_mem_unmap(void *base, size_t nbytes) -+ { -+ free( *cast(void**)( cast(byte*) base + nbytes ) ); -+ return 0; -+ } -+} -+else -+{ -+ static assert(false, "No supported allocation methods available."); -+} ---- a/src/libphobos/libdruntime/gc/proxy.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/proxy.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,348 @@ -+/** -+ * Contains the external GC interface. -+ * -+ * Copyright: Copyright Digital Mars 2005 - 2013. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Walter Bright, Sean Kelly -+ */ -+ -+/* Copyright Digital Mars 2005 - 2013. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module gc.proxy; -+ -+import gc.gc; -+import gc.stats; -+import core.stdc.stdlib; -+ -+private -+{ -+ version = GCCLASS; -+ -+ version( GCCLASS ) -+ alias GC gc_t; -+ else -+ alias GC* gc_t; -+ -+ __gshared gc_t _gc; -+ -+ extern (C) void thread_init(); -+ extern (C) void thread_term(); -+ -+ struct Proxy -+ { -+ extern (C) -+ { -+ void function() gc_enable; -+ void function() gc_disable; -+ void function() gc_collect; -+ void function() gc_minimize; -+ -+ uint function(void*) gc_getAttr; -+ uint function(void*, uint) gc_setAttr; -+ uint function(void*, uint) gc_clrAttr; -+ -+ void* function(size_t, uint) gc_malloc; -+ BlkInfo function(size_t, uint) gc_qalloc; -+ void* function(size_t, uint) gc_calloc; -+ void* function(void*, size_t, uint ba) gc_realloc; -+ size_t function(void*, size_t, size_t) gc_extend; -+ size_t function(size_t) gc_reserve; -+ void function(void*) gc_free; -+ -+ void* function(void*) gc_addrOf; -+ size_t function(void*) gc_sizeOf; -+ -+ BlkInfo function(void*) gc_query; -+ -+ void function(void*) gc_addRoot; -+ void function(void*, size_t) gc_addRange; -+ -+ void function(void*) gc_removeRoot; -+ void function(void*) gc_removeRange; -+ } -+ } -+ -+ __gshared Proxy pthis; -+ __gshared Proxy* proxy; -+ -+ void initProxy() -+ { -+ pthis.gc_enable = &gc_enable; -+ pthis.gc_disable = &gc_disable; -+ pthis.gc_collect = &gc_collect; -+ pthis.gc_minimize = &gc_minimize; -+ -+ pthis.gc_getAttr = &gc_getAttr; -+ pthis.gc_setAttr = &gc_setAttr; -+ pthis.gc_clrAttr = &gc_clrAttr; -+ -+ pthis.gc_malloc = &gc_malloc; -+ pthis.gc_qalloc = &gc_qalloc; -+ pthis.gc_calloc = &gc_calloc; -+ pthis.gc_realloc = &gc_realloc; -+ pthis.gc_extend = &gc_extend; -+ pthis.gc_reserve = &gc_reserve; -+ pthis.gc_free = &gc_free; -+ -+ pthis.gc_addrOf = &gc_addrOf; -+ pthis.gc_sizeOf = &gc_sizeOf; -+ -+ pthis.gc_query = &gc_query; -+ -+ pthis.gc_addRoot = &gc_addRoot; -+ pthis.gc_addRange = &gc_addRange; -+ -+ pthis.gc_removeRoot = &gc_removeRoot; -+ pthis.gc_removeRange = &gc_removeRange; -+ } -+} -+ -+extern (C) -+{ -+ -+ void gc_init() -+ { -+ version (GCCLASS) -+ { void* p; -+ ClassInfo ci = GC.classinfo; -+ -+ p = malloc(ci.init.length); -+ (cast(byte*)p)[0 .. ci.init.length] = ci.init[]; -+ _gc = cast(GC)p; -+ } -+ else -+ { -+ _gc = cast(GC*) calloc(1, GC.sizeof); -+ } -+ _gc.initialize(); -+ // NOTE: The GC must initialize the thread library -+ // before its first collection. -+ thread_init(); -+ initProxy(); -+ } -+ -+ void gc_term() -+ { -+ // NOTE: There may be daemons threads still running when this routine is -+ // called. If so, cleaning memory out from under then is a good -+ // way to make them crash horribly. This probably doesn't matter -+ // much since the app is supposed to be shutting down anyway, but -+ // I'm disabling cleanup for now until I can think about it some -+ // more. -+ // -+ // NOTE: Due to popular demand, this has been re-enabled. It still has -+ // the problems mentioned above though, so I guess we'll see. -+ _gc.fullCollectNoStack(); // not really a 'collect all' -- still scans -+ // static data area, roots, and ranges. -+ thread_term(); -+ -+ _gc.Dtor(); -+ free(cast(void*)_gc); -+ _gc = null; -+ } -+ -+ void gc_enable() -+ { -+ if( proxy is null ) -+ return _gc.enable(); -+ return proxy.gc_enable(); -+ } -+ -+ void gc_disable() -+ { -+ if( proxy is null ) -+ return _gc.disable(); -+ return proxy.gc_disable(); -+ } -+ -+ void gc_collect() -+ { -+ if( proxy is null ) -+ { -+ _gc.fullCollect(); -+ return; -+ } -+ return proxy.gc_collect(); -+ } -+ -+ void gc_minimize() -+ { -+ if( proxy is null ) -+ return _gc.minimize(); -+ return proxy.gc_minimize(); -+ } -+ -+ uint gc_getAttr( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.getAttr( p ); -+ return proxy.gc_getAttr( p ); -+ } -+ -+ uint gc_setAttr( void* p, uint a ) -+ { -+ if( proxy is null ) -+ return _gc.setAttr( p, a ); -+ return proxy.gc_setAttr( p, a ); -+ } -+ -+ uint gc_clrAttr( void* p, uint a ) -+ { -+ if( proxy is null ) -+ return _gc.clrAttr( p, a ); -+ return proxy.gc_clrAttr( p, a ); -+ } -+ -+ void* gc_malloc( size_t sz, uint ba = 0 ) -+ { -+ if( proxy is null ) -+ return _gc.malloc( sz, ba ); -+ return proxy.gc_malloc( sz, ba ); -+ } -+ -+ BlkInfo gc_qalloc( size_t sz, uint ba = 0 ) -+ { -+ if( proxy is null ) -+ { -+ BlkInfo retval; -+ retval.base = _gc.malloc( sz, ba, &retval.size ); -+ retval.attr = ba; -+ return retval; -+ } -+ return proxy.gc_qalloc( sz, ba ); -+ } -+ -+ void* gc_calloc( size_t sz, uint ba = 0 ) -+ { -+ if( proxy is null ) -+ return _gc.calloc( sz, ba ); -+ return proxy.gc_calloc( sz, ba ); -+ } -+ -+ void* gc_realloc( void* p, size_t sz, uint ba = 0 ) -+ { -+ if( proxy is null ) -+ return _gc.realloc( p, sz, ba ); -+ return proxy.gc_realloc( p, sz, ba ); -+ } -+ -+ size_t gc_extend( void* p, size_t mx, size_t sz ) -+ { -+ if( proxy is null ) -+ return _gc.extend( p, mx, sz ); -+ return proxy.gc_extend( p, mx, sz ); -+ } -+ -+ size_t gc_reserve( size_t sz ) -+ { -+ if( proxy is null ) -+ return _gc.reserve( sz ); -+ return proxy.gc_reserve( sz ); -+ } -+ -+ void gc_free( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.free( p ); -+ return proxy.gc_free( p ); -+ } -+ -+ void* gc_addrOf( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.addrOf( p ); -+ return proxy.gc_addrOf( p ); -+ } -+ -+ size_t gc_sizeOf( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.sizeOf( p ); -+ return proxy.gc_sizeOf( p ); -+ } -+ -+ BlkInfo gc_query( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.query( p ); -+ return proxy.gc_query( p ); -+ } -+ -+ // NOTE: This routine is experimental. The stats or function name may change -+ // before it is made officially available. -+ GCStats gc_stats() -+ { -+ if( proxy is null ) -+ { -+ GCStats stats = void; -+ _gc.getStats( stats ); -+ return stats; -+ } -+ // TODO: Add proxy support for this once the layout of GCStats is -+ // finalized. -+ //return proxy.gc_stats(); -+ return GCStats.init; -+ } -+ -+ void gc_addRoot( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.addRoot( p ); -+ return proxy.gc_addRoot( p ); -+ } -+ -+ void gc_addRange( void* p, size_t sz ) -+ { -+ if( proxy is null ) -+ return _gc.addRange( p, sz ); -+ return proxy.gc_addRange( p, sz ); -+ } -+ -+ void gc_removeRoot( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.removeRoot( p ); -+ return proxy.gc_removeRoot( p ); -+ } -+ -+ void gc_removeRange( void* p ) -+ { -+ if( proxy is null ) -+ return _gc.removeRange( p ); -+ return proxy.gc_removeRange( p ); -+ } -+ -+ Proxy* gc_getProxy() -+ { -+ return &pthis; -+ } -+ -+ export -+ { -+ void gc_setProxy( Proxy* p ) -+ { -+ if( proxy !is null ) -+ { -+ // TODO: Decide if this is an error condition. -+ } -+ proxy = p; -+ foreach( r; _gc.rootIter ) -+ proxy.gc_addRoot( r ); -+ foreach( r; _gc.rangeIter ) -+ proxy.gc_addRange( r.pbot, r.ptop - r.pbot ); -+ } -+ -+ void gc_clrProxy() -+ { -+ foreach( r; _gc.rangeIter ) -+ proxy.gc_removeRange( r.pbot ); -+ foreach( r; _gc.rootIter ) -+ proxy.gc_removeRoot( r ); -+ proxy = null; -+ } -+ } -+ -+} ---- a/src/libphobos/libdruntime/gc/stats.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gc/stats.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,27 @@ -+/** -+ * Contains a struct for storing GC statistics. -+ * -+ * Copyright: Copyright Digital Mars 2005 - 2013. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Walter Bright, Sean Kelly -+ */ -+ -+/* Copyright Digital Mars 2005 - 2013. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module gc.stats; -+ -+ -+/** -+ * -+ */ -+struct GCStats -+{ -+ size_t poolsize; // total size of pool -+ size_t usedsize; // bytes allocated -+ size_t freeblocks; // number of blocks marked FREE -+ size_t freelistsize; // total of memory on free lists -+ size_t pageblocks; // number of blocks marked PAGE -+} ---- a/src/libphobos/libdruntime/gcc/backtrace.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/backtrace.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,572 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* This module provides a backtrace implementation for gdc */ -+module gcc.backtrace; -+ -+import gcc.libbacktrace; -+ -+ -+version( Posix ) -+{ -+ // NOTE: The first 5 frames with the current implementation are -+ // inside core.runtime and the object code, so eliminate -+ // these for readability. The alternative would be to -+ // exclude the first N frames that are in a list of -+ // mangled function names. -+ static enum FIRSTFRAME = 5; -+} -+else -+{ -+ // NOTE: On Windows, the number of frames to exclude is based on -+ // whether the exception is user or system-generated, so -+ // it may be necessary to exclude a list of function names -+ // instead. -+ static enum FIRSTFRAME = 0; -+} -+ -+static if(BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC) -+{ -+ import core.stdc.stdint, core.stdc.string, core.stdc.stdio; -+ enum MAXFRAMES = 128; -+ -+ extern(C) int simpleCallback(void* data, uintptr_t pc) -+ { -+ auto context = cast(LibBacktrace)data; -+ -+ if(context.numPCs == MAXFRAMES) -+ return 1; -+ -+ context.pcs[context.numPCs++] = pc; -+ return 0; -+ } -+ -+ /* -+ * Used for backtrace_create_state and backtrace_simple -+ */ -+ extern(C) void simpleErrorCallback(void* data, const(char)* msg, int errnum) -+ { -+ if(data) //context is not available in backtrace_create_state -+ { -+ auto context = cast(LibBacktrace)data; -+ strncpy(context.errorBuf.ptr, msg, context.errorBuf.length - 1); -+ context.error = errnum; -+ } -+ } -+ -+ /* -+ * Used for backtrace_pcinfo -+ */ -+ extern(C) int pcinfoCallback(void* data, uintptr_t pc, const(char)* filename, -+ int lineno, const(char)* func) -+ { -+ auto context = cast(SymbolCallbackInfo*)data; -+ -+ //Try to get the function name via backtrace_syminfo -+ if(func is null) -+ { -+ SymbolCallbackInfo2 info; -+ info.base = context; -+ info.filename = filename; -+ info.lineno = lineno; -+ if(backtrace_syminfo(context.state, pc, &syminfoCallback2, null, &info) != 0) -+ { -+ return context.retval; -+ } -+ } -+ -+ auto sym = SymbolOrError(0, SymbolInfo(func, filename, lineno, cast(void*)pc)); -+ context.retval = context.applyCB(context.num, sym); -+ context.num++; -+ -+ return context.retval; -+ } -+ -+ /* -+ * Used for backtrace_pcinfo and backtrace_syminfo -+ */ -+ extern(C) void pcinfoErrorCallback(void* data, const(char)* msg, int errnum) -+ { -+ auto context = cast(SymbolCallbackInfo*)data; -+ -+ if(errnum == -1) -+ { -+ context.noInfo = true; -+ return; -+ } -+ -+ SymbolOrError symError; -+ symError.errnum = errnum; -+ symError.msg = msg; -+ -+ size_t i = 0; -+ context.retval = context.applyCB(i, symError); -+ } -+ -+ /* -+ * Used for backtrace_syminfo (in opApply) -+ */ -+ extern(C) void syminfoCallback(void* data, uintptr_t pc, -+ const(char)* symname, uintptr_t symval) -+ { -+ auto context = cast(SymbolCallbackInfo*)data; -+ -+ auto sym = SymbolOrError(0, SymbolInfo(symname, null, 0, cast(void*)pc)); -+ context.retval = context.applyCB(context.num, sym); -+ -+ context.num++; -+ } -+ -+ /* -+ * This callback is used if backtrace_syminfo is called from the pcinfoCallback -+ * callback. It merges it's information with the information from pcinfoCallback. -+ */ -+ extern(C) void syminfoCallback2(void* data, uintptr_t pc, -+ const(char)* symname, uintptr_t symval) -+ { -+ auto context = cast(SymbolCallbackInfo2*)data; -+ -+ auto sym = SymbolOrError(0, SymbolInfo(symname, context.filename, context.lineno, -+ cast(void*)pc)); -+ context.base.retval = context.base.applyCB(context.base.num, sym); -+ -+ context.base.num++; -+ } -+ -+ /* -+ * The callback type used with the opApply overload which returns a SymbolOrError -+ */ -+ private alias scope int delegate(ref size_t, ref SymbolOrError) ApplyCallback; -+ -+ /* -+ * Passed to syminfoCallback, pcinfoCallback and pcinfoErrorCallback -+ */ -+ struct SymbolCallbackInfo -+ { -+ bool noInfo = false; //True if debug info / symbol table is not available -+ size_t num = 0; //Counter for opApply -+ int retval; //Value returned by applyCB -+ backtrace_state* state; -+ -+ //info.fileName / funcName / errmsg may become invalid after this delegate returned -+ ApplyCallback applyCB; -+ -+ void reset() -+ { -+ noInfo = false; -+ num = 0; -+ } -+ } -+ -+ /* -+ * Passed to the syminfoCallback2 callback. That function merges it's -+ * funcName with this information and updates base as all other callbacks do. -+ */ -+ struct SymbolCallbackInfo2 -+ { -+ SymbolCallbackInfo* base; -+ const(char)* filename; -+ int lineno; -+ } -+ -+ /* -+ * Contains a valid symbol or an error message if errnum is != 0. -+ */ -+ struct SymbolOrError -+ { -+ int errnum; // == 0: No error -+ union -+ { -+ SymbolInfo symbol; -+ const(char)* msg; -+ } -+ } -+ -+ //FIXME: state is never freed as libbacktrace doesn't provide a free function... -+ public class LibBacktrace : Throwable.TraceInfo -+ { -+ enum MaxAlignment = (void*).alignof; -+ -+ static void initLibBacktrace() -+ { -+ if(!initialized) -+ { -+ state = backtrace_create_state(null, false, &simpleErrorCallback, null); -+ initialized = true; -+ } -+ } -+ -+ this(int firstFrame = FIRSTFRAME) -+ { -+ _firstFrame = firstFrame; -+ -+ initLibBacktrace(); -+ -+ if(state) -+ { -+ backtrace_simple(state, _firstFrame, &simpleCallback, -+ &simpleErrorCallback, cast(void*)this); -+ } -+ } -+ -+ override int opApply( scope int delegate(ref const(char[])) dg ) const -+ { -+ return opApply( (ref size_t, ref const(char[]) buf) -+ { -+ return dg( buf ); -+ } ); -+ } -+ -+ override int opApply( scope int delegate(ref size_t, ref const(char[])) dg ) const -+ { -+ return opApply( (ref size_t i, ref SymbolOrError sym) -+ { -+ char[512] buffer = '\0'; -+ char[] msg; -+ if(sym.errnum != 0) -+ { -+ auto retval = snprintf(buffer.ptr, buffer.length, -+ "libbacktrace error: '%s' errno: %d", sym.msg, sym.errnum); -+ -+ if(retval >= buffer.length) -+ msg = buffer[0 .. $-1]; //Ignore zero terminator -+ else if(retval > 0) -+ msg = buffer[0 .. retval]; -+ } -+ else -+ { -+ msg = formatLine(sym.symbol, buffer); -+ } -+ -+ return dg(i, msg); -+ } ); -+ } -+ -+ int opApply(ApplyCallback dg) const -+ { -+ //If backtrace_simple produced an error report it and exit -+ if(!state || error != 0) -+ { -+ size_t pos = 0; -+ SymbolOrError symError; -+ symError.errnum = error; -+ symError.msg = errorBuf.ptr; -+ -+ return dg(pos, symError); -+ } -+ -+ SymbolCallbackInfo cinfo; -+ cinfo.applyCB = dg; -+ cinfo.state = cast(backtrace_state*)state; -+ -+ //Try using debug info first -+ foreach(i, pc; pcs[0 .. numPCs]) -+ { -+ //FIXME: We may violate const guarantees here... -+ if(backtrace_pcinfo(cast(backtrace_state*)state, pc, &pcinfoCallback, -+ &pcinfoErrorCallback, &cinfo) != 0) -+ { -+ break; //User delegate requested abort or no debug info at all -+ } -+ } -+ -+ //If no error or other error which has already been reported via callback -+ if(!cinfo.noInfo) -+ return cinfo.retval; -+ -+ //Try using symbol table -+ cinfo.reset(); -+ foreach(pc; pcs[0 .. numPCs]) -+ { -+ if(backtrace_syminfo(cast(backtrace_state*)state, pc, &syminfoCallback, -+ &pcinfoErrorCallback, &cinfo) == 0) -+ { -+ break; -+ } -+ } -+ -+ if(!cinfo.noInfo) -+ return cinfo.retval; -+ -+ //No symbol table -+ foreach(i, pc; pcs[0 .. numPCs]) -+ { -+ auto sym = SymbolOrError(0, SymbolInfo(null, null, 0, cast(void*)pc)); -+ if(auto ret = dg(i, sym) != 0) -+ return ret; -+ } -+ -+ return 0; -+ } -+ -+ override string toString() const -+ { -+ string buf; -+ foreach(i, const(char[]) line; this ) -+ buf ~= i ? "\n" ~ line : line; -+ return buf; -+ } -+ -+ private: -+ static backtrace_state* state = null; -+ static bool initialized = false; -+ size_t numPCs = 0; -+ uintptr_t[MAXFRAMES] pcs; -+ -+ int error = 0; -+ int _firstFrame = 0; -+ char[128] errorBuf; -+ } -+} -+else -+{ -+ /* -+ * Our fallback backtrace implementation using libgcc's unwind -+ * and backtrace support. In theory libbacktrace should be available -+ * everywhere where this code works. We keep it anyway till libbacktrace -+ * is well-tested. -+ */ -+ public class GDCBacktrace : Throwable.TraceInfo -+ { -+ this(int firstFrame = FIRSTFRAME) -+ { -+ _firstFrame = firstFrame; -+ _callstack = gdcBacktrace(); -+ _framelist = gdcBacktraceSymbols(_callstack); -+ } -+ -+ override int opApply( scope int delegate(ref const(char[])) dg ) const -+ { -+ return opApply( (ref size_t, ref const(char[]) buf) -+ { -+ return dg( buf ); -+ } ); -+ } -+ -+ override int opApply( scope int delegate(ref size_t, ref const(char[])) dg ) const -+ { -+ int ret = 0; -+ char[512] fixbuf = '\0'; -+ -+ for( int i = _firstFrame; i < _framelist.entries; ++i ) -+ { -+ auto pos = cast(size_t)(i - _firstFrame); -+ auto buf = formatLine(_framelist.symbols[i], fixbuf); -+ ret = dg( pos, buf ); -+ if( ret ) -+ break; -+ } -+ return ret; -+ } -+ -+ override string toString() const -+ { -+ string buf; -+ foreach( i, line; this ) -+ buf ~= i ? "\n" ~ line : line; -+ return buf; -+ } -+ -+ private: -+ BTSymbolData _framelist; -+ GDCBacktraceData _callstack; -+ int _firstFrame = 0; -+ } -+ -+ // Implementation details -+ private: -+ import gcc.unwind; -+ -+ static enum MAXFRAMES = 128; -+ -+ struct GDCBacktraceData -+ { -+ void*[MAXFRAMES] callstack; -+ int numframes = 0; -+ } -+ -+ struct BTSymbolData -+ { -+ size_t entries; -+ SymbolInfo[MAXFRAMES] symbols; -+ } -+ -+ static extern (C) _Unwind_Reason_Code unwindCB(_Unwind_Context *ctx, void *d) -+ { -+ GDCBacktraceData* bt = cast(GDCBacktraceData*)d; -+ if(bt.numframes >= MAXFRAMES) -+ return _URC_NO_REASON; -+ -+ bt.callstack[bt.numframes] = cast(void*)_Unwind_GetIP(ctx); -+ bt.numframes++; -+ return _URC_NO_REASON; -+ } -+ -+ GDCBacktraceData gdcBacktrace() -+ { -+ GDCBacktraceData stackframe; -+ _Unwind_Backtrace(&unwindCB, &stackframe); -+ return stackframe; -+ } -+ -+ BTSymbolData gdcBacktraceSymbols(GDCBacktraceData data) -+ { -+ BTSymbolData symData; -+ -+ for(auto i = 0; i < data.numframes; i++) -+ { -+ static if(HAVE_DLADDR) -+ { -+ Dl_info funcInfo; -+ -+ if(data.callstack[i] !is null && dladdr(data.callstack[i], &funcInfo) != 0) -+ { -+ symData.symbols[symData.entries].funcName = funcInfo.dli_sname; -+ -+ symData.symbols[symData.entries].address = data.callstack[i]; -+ symData.entries++; -+ } -+ else -+ { -+ symData.symbols[symData.entries].address = data.callstack[i]; -+ symData.entries++; -+ } -+ } -+ else -+ { -+ symData.symbols[symData.entries].address = data.callstack[i]; -+ symData.entries++; -+ } -+ } -+ -+ return symData; -+ } -+} -+ -+/* -+ * Struct representing a symbol (function) in the backtrace -+ */ -+struct SymbolInfo -+{ -+ const(char)* funcName, fileName; -+ size_t line; -+ const(void)* address; -+} -+ -+/* -+ * Format one output line for symbol sym. -+ * Returns a slice of fixbuf. -+ */ -+char[] formatLine(const SymbolInfo sym, ref char[512] fixbuf) -+{ -+ import core.demangle, core.stdc.config; -+ import core.stdc.stdio : snprintf, printf; -+ import core.stdc.string : strlen; -+ -+ int ret; -+ -+ ret = snprintf(fixbuf.ptr, fixbuf.sizeof, "0x%lx ", cast(c_ulong)sym.address); -+ if(ret >= fixbuf.sizeof) -+ return fixbuf[0 .. $-1]; //Ignore zero terminator -+ -+ if(sym.funcName is null) -+ { -+ if(!(fixbuf.sizeof - ret > 3)) -+ return fixbuf[0 .. ret]; -+ -+ fixbuf[ret] = fixbuf[ret+1] = fixbuf[ret+2] = '?'; -+ ret += 3; -+ } -+ else -+ { -+ auto demangled = demangle(sym.funcName[0 .. strlen(sym.funcName)], -+ fixbuf[ret .. $-1]); -+ -+ ret += demangled.length; -+ if(ret + 1 >= fixbuf.sizeof) -+ return fixbuf[0 .. $-1]; //Ignore zero terminator -+ } -+ -+ ret += snprintf(fixbuf.ptr + ret, fixbuf.sizeof - ret, "\n\t%s:%d", -+ sym.fileName is null ? "???" : sym.fileName, -+ sym.line); -+ -+ if(ret >= fixbuf.sizeof) -+ return fixbuf[0 .. $-1]; //Ignore zero terminator -+ else -+ return fixbuf[0 .. ret]; -+} -+ -+ -+unittest -+{ -+ char[512] sbuf = '\0'; -+ char[] result; -+ string longString; -+ for(size_t i = 0; i < 60; i++) -+ longString ~= "abcdefghij"; -+ longString ~= '\0'; -+ -+ auto symbol = SymbolInfo(null, null, 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(longString.ptr, null, 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo("func", "test.d", 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo("func", longString.ptr, 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(longString.ptr, "test.d", 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(longString.ptr, longString.ptr, 0, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo("func", "test.d", 1000, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(null, (longString[0..500] ~ '\0').ptr, 100000000, null); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo("func", "test.d", 0, cast(void*)0x100000); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo("func", null, 0, cast(void*)0x100000); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(null, "test.d", 0, cast(void*)0x100000); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+ -+ symbol = SymbolInfo(longString.ptr, "test.d", 0, cast(void*)0x100000); -+ result = formatLine(symbol, sbuf); -+ assert(result.length < 512 && result.ptr[result.length] == '\0' && sbuf[$-1] == '\0'); -+} ---- a/src/libphobos/libdruntime/gcc/deh.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/deh.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,146 +1,113 @@ --/* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+// GDC -- D front-end for GCC -+// Copyright (C) 2011, 2012, 2014 Free Software Foundation, Inc. - -- GCC is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. -- -- GCC is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING3. If not see -- <http://www.gnu.org/licenses/>. --*/ -+// GCC is free software; you can redistribute it and/or modify it under -+// the terms of the GNU General Public License as published by the Free -+// Software Foundation; either version 3, or (at your option) any later -+// version. -+ -+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+// WARRANTY; without even the implied warranty of MERCHANTABILITY or -+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+// for more details. -+ -+// You should have received a copy of the GNU General Public License -+// along with GCC; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. - - // This code is based on the libstdc++ exception handling routines. - - module gcc.deh; - - import gcc.unwind; --import gcc.unwind_pe; -+import gcc.unwind.pe; - import gcc.builtins; - - import core.memory; - import core.stdc.stdlib; - --extern (C) -+extern(C) - { - int _d_isbaseof(ClassInfo, ClassInfo); - void _d_createTrace(Object *); -- - } - -+// This is the primary exception class we report -- "GNUCD__\0". - version (GNU_ARM_EABI_Unwinder) - { -- const _Unwind_Exception_Class GDC_Exception_Class = -- ['G','N','U','C','D','_','_','\0']; -+ const _Unwind_Exception_Class __gdc_exception_class -+ = ['G', 'N', 'U', 'C', 'D', '_', '_', '\0']; - } - else - { -- // "GNUCD__\0" -- const _Unwind_Exception_Class GDC_Exception_Class = 0x005f5f4443554e47L; -+ const _Unwind_Exception_Class __gdc_exception_class -+ = (((((((cast(_Unwind_Exception_Class) 'G' -+ << 8 | cast(_Unwind_Exception_Class) 'N') -+ << 8 | cast(_Unwind_Exception_Class) 'U') -+ << 8 | cast(_Unwind_Exception_Class) 'C') -+ << 8 | cast(_Unwind_Exception_Class) 'D') -+ << 8 | cast(_Unwind_Exception_Class) '_') -+ << 8 | cast(_Unwind_Exception_Class) '_') -+ << 8 | cast(_Unwind_Exception_Class) '\0'); - } - --struct Phase1Info --{ -- _Unwind_Word handlerSwitchValue; -- ubyte *languageSpecificData; -- _Unwind_Ptr landingPad; --} - --struct OurUnwindException --{ -- version (GNU_ARM_EABI_Unwinder) -- { -- // Cached parsed handler data is stored elsewhere -- // DNotes: There is no ARM exception handling ABI for the D -- // programming language that mandates the use of -- // barrier_cache.bitpattern, but might as well use the space. -- void save(_Unwind_Context* context, ref Phase1Info info) -- { -- unwindHeader.barrier_cache.sp = _Unwind_GetGR (context, UNWIND_STACK_REG); -- with (unwindHeader.barrier_cache) -- { -- //bitpattern[0] = cast(_uw) info.obj; // No need for this yet -- bitpattern[1] = cast(_uw) info.handlerSwitchValue; -- bitpattern[2] = cast(_uw) info.languageSpecificData; -- bitpattern[3] = cast(_uw) info.landingPad; -- } -- } -+// A D exception object consists of a header, which is a wrapper -+// around an unwind object header with additional D specific -+// information, followed by the exception object itself. - -- void restore(ref Phase1Info info) -- { -- with (unwindHeader.barrier_cache) -- { -- info.handlerSwitchValue = cast(typeof(info.handlerSwitchValue)) -- bitpattern[1]; -- info.languageSpecificData = cast(typeof(info.languageSpecificData)) -- bitpattern[2]; -- info.landingPad = cast(typeof(info.landingPad)) -- bitpattern[3]; -- } -- } -- } -- else -- { -- // Cache parsed handler data from the personality routine Phase 1 -- // for Phase 2. -- Phase1Info cache; -- -- void save(_Unwind_Context* context, ref Phase1Info info) -- { -- cache = info; -- } -- -- void restore(ref Phase1Info info) -- { -- info = cache; -- } -- } -- -- version (GNU_ARM_EABI_Unwinder) -- int _pad; // to place 'obj' behind unwindHeader -+struct d_exception_header -+{ -+ // The object being thrown. Like GCJ, the compiled code expects this to -+ // be immediately before the generic exception header. -+ // (See build_exception_object) -+ enum UNWIND_PAD = (Object.alignof < _Unwind_Exception.alignof) -+ ? _Unwind_Exception.alignof - Object.alignof : 0; - -- Object obj; -+ // Because of a lack of __aligned__ style attribute, our object -+ // and the unwind object are the first two fields. -+ ubyte[UNWIND_PAD] pad; - -- // The exception object must be directly behind unwindHeader. -- // (See IRState::exceptionObject.) -- static assert(unwindHeader.offsetof - obj.offsetof == obj.sizeof); -+ Object object; - -- // The generic exception header -+ // The generic exception header. - _Unwind_Exception unwindHeader; - -- static OurUnwindException * fromHeader(_Unwind_Exception * p_ue) -+ static assert(unwindHeader.offsetof - object.offsetof == object.sizeof); -+ -+ version (GNU_ARM_EABI_Unwinder) - { -- return cast(OurUnwindException *) -- (cast(void*) p_ue - OurUnwindException.unwindHeader.offsetof); -+ // Nothing here yet. -+ } -+ else -+ { -+ // Cache handler details between Phase 1 and Phase 2. -+ int handlerSwitchValue; -+ ubyte *actionRecord; -+ ubyte *languageSpecificData; -+ _Unwind_Ptr catchTemp; - } - } - --// D doesn't define these, so they are private for now. --private void __gdc_terminate() -+private d_exception_header * -+get_exception_header_from_ue(_Unwind_Exception *exc) - { -- // replaces std::terminate and terminating with a specific handler -- abort(); -+ return cast(d_exception_header *) -+ (cast(void *) exc - d_exception_header.unwindHeader.offsetof); - } - --private void __gdc_unexpected() --{ --} -+// D doesn't define these, so they are private for now. - --private void __gdc_beginCatch(_Unwind_Exception *exc) -+private void -+__gdc_terminate() - { -- // nothing -+ // Replaces std::terminate and terminating with a specific handler -+ abort(); - } - - // This is called by the unwinder. -- --private extern (C) void --_gdc_cleanupException(_Unwind_Reason_Code code, _Unwind_Exception *exc) -+extern(C) private void -+__gdc_exception_cleanup(_Unwind_Reason_Code code, _Unwind_Exception *exc) - { - // If we haven't been caught by a foreign handler, then this is - // some sort of unwind error. In that case just die immediately. -@@ -150,63 +117,187 @@ _gdc_cleanupException(_Unwind_Reason_Cod - if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON) - __gdc_terminate(); - -- OurUnwindException * p = OurUnwindException.fromHeader (exc); -- delete p; -+ d_exception_header *p = get_exception_header_from_ue (exc); -+ destroy (p); - } - --// This is called by compiler-generated code for throw statements. --extern (C) public void --_d_throw(Object obj) -+ -+// Perform a throw, D style. Throw will unwind through this call, -+// so there better not be any handlers or exception thrown here. -+ -+extern(C) void -+_d_throw(Object object) - { -- OurUnwindException * exc = new OurUnwindException; -+ // FIXME: OOM errors will throw recursively. -+ d_exception_header *xh = new d_exception_header(); -+ -+ xh.object = object; - -- static if ( is(typeof(exc.unwindHeader.exception_class = GDC_Exception_Class)) ) -- exc.unwindHeader.exception_class = GDC_Exception_Class; -+ static if ( is(typeof(xh.unwindHeader.exception_class = __gdc_exception_class)) ) -+ xh.unwindHeader.exception_class = __gdc_exception_class; - else -- exc.unwindHeader.exception_class[] = GDC_Exception_Class[]; -+ xh.unwindHeader.exception_class[] = __gdc_exception_class[]; - -- exc.unwindHeader.exception_cleanup = & _gdc_cleanupException; -- exc.obj = obj; -+ xh.unwindHeader.exception_cleanup = & __gdc_exception_cleanup; - - // Runtime now expects us to do this first before unwinding. -- _d_createTrace (cast(Object*)exc.obj); -+ _d_createTrace (cast(Object *) xh.object); - -+ // We're happy with setjmp/longjmp exceptions or region-based -+ // exception handlers: entry points are provided here for both. - version (GNU_SjLj_Exceptions) -- _Unwind_SjLj_RaiseException (&exc.unwindHeader); -+ _Unwind_SjLj_RaiseException (&xh.unwindHeader); - else -- _Unwind_RaiseException (&exc.unwindHeader); -+ _Unwind_RaiseException (&xh.unwindHeader); - -- // Some sort of unwinding error. Note that terminate is a handler. -- __gdc_beginCatch (&exc.unwindHeader); -+ // If code == _URC_END_OF_STACK, then we reached top of stack without -+ // finding a handler for the exception. Since each thread is run in -+ // a try/catch, this oughtn't happen. If code is something else, we -+ // encountered some sort of heinous lossage from which we could not -+ // recover. As is the way of such things, almost certainly we will have -+ // crashed before now, rather than actually being able to diagnose the -+ // problem. - __gdc_terminate(); - } - --// rethrow? - --// extern(C) alias personalityImpl ...; would be nice -+struct lsda_header_info -+{ -+ _Unwind_Ptr Start; -+ _Unwind_Ptr LPStart; -+ _Unwind_Ptr ttype_base; -+ ubyte *TType; -+ ubyte *action_table; -+ ubyte ttype_encoding; -+ ubyte call_site_encoding; -+} -+ -+private ubyte * -+parse_lsda_header (_Unwind_Context *context, ubyte *p, -+ lsda_header_info *info) -+{ -+ _uleb128_t tmp; -+ ubyte lpstart_encoding; -+ -+ info.Start = (context ? _Unwind_GetRegionStart (context) : 0); -+ -+ // Find @LPStart, the base to which landing pad offsets are relative. -+ lpstart_encoding = *p++; -+ if (lpstart_encoding != DW_EH_PE_omit) -+ p = read_encoded_value (context, lpstart_encoding, p, &info.LPStart); -+ else -+ info.LPStart = info.Start; -+ -+ // Find @TType, the base of the handler and exception spec type data. -+ info.ttype_encoding = *p++; -+ if (info.ttype_encoding != DW_EH_PE_omit) -+ { -+ version (GNU_ARM_EABI_Unwinder) -+ { -+ // Older ARM EABI toolchains set this value incorrectly, so use a -+ // hardcoded OS-specific format. -+ info.ttype_encoding = _TTYPE_ENCODING; -+ } -+ p = read_uleb128 (p, &tmp); -+ info.TType = p + tmp; -+ } -+ else -+ info.TType = null; -+ -+ // The encoding and length of the call-site table; the action table -+ // immediately follows. -+ info.call_site_encoding = *p++; -+ p = read_uleb128 (p, &tmp); -+ info.action_table = p + tmp; -+ -+ return p; -+} -+ -+private ClassInfo -+get_classinfo_entry(lsda_header_info *info, _uleb128_t i) -+{ -+ _Unwind_Ptr ptr; -+ -+ i *= size_of_encoded_value (info.ttype_encoding); -+ read_encoded_value_with_base (info.ttype_encoding, info.ttype_base, -+ info.TType - i, &ptr); -+ -+ return cast(ClassInfo)cast(void *)(ptr); -+} -+ -+private void -+save_caught_exception(_Unwind_Exception *ue_header, -+ _Unwind_Context *context, -+ int handler_switch_value, -+ ubyte *language_specific_data, -+ _Unwind_Ptr landing_pad, -+ ubyte *action_record) -+{ -+ version (GNU_ARM_EABI_Unwinder) -+ { -+ ue_header.barrier_cache.sp = _Unwind_GetGR(context, UNWIND_STACK_REG); -+ ue_header.barrier_cache.bitpattern[1] = cast(_uw) handler_switch_value; -+ ue_header.barrier_cache.bitpattern[2] = cast(_uw) language_specific_data; -+ ue_header.barrier_cache.bitpattern[3] = cast(_uw) landing_pad; -+ } -+ else -+ { -+ d_exception_header *xh = get_exception_header_from_ue (ue_header); -+ -+ xh.handlerSwitchValue = handler_switch_value; -+ xh.actionRecord = action_record; -+ xh.languageSpecificData = language_specific_data; -+ xh.catchTemp = landing_pad; -+ } -+} -+ -+private void -+restore_caught_exception(_Unwind_Exception *ue_header, -+ ref int handler_switch_value, -+ ref ubyte *language_specific_data, -+ ref _Unwind_Ptr landing_pad) -+{ -+ version (GNU_ARM_EABI_Unwinder) -+ { -+ handler_switch_value = cast(int) ue_header.barrier_cache.bitpattern[1]; -+ language_specific_data = cast(ubyte *) ue_header.barrier_cache.bitpattern[2]; -+ landing_pad = cast(_Unwind_Ptr) ue_header.barrier_cache.bitpattern[3]; -+ } -+ else -+ { -+ d_exception_header *xh = get_exception_header_from_ue (ue_header); -+ -+ handler_switch_value = xh.handlerSwitchValue; -+ language_specific_data = xh.languageSpecificData; -+ landing_pad = cast(_Unwind_Ptr) xh.catchTemp; -+ } -+} -+ -+// Using a different personality function name causes link failures -+// when trying to mix code using different exception handling models. -+// extern(C) alias __gdc_personality_impl ...; would be nice - version (GNU_SjLj_Exceptions) - { -- extern (C) -- _Unwind_Reason_Code __gdc_personality_sj0(int iversion, -- _Unwind_Action actions, -- _Unwind_Exception_Class exception_class, -- _Unwind_Exception *ue_header, -- _Unwind_Context *context) -- { -- return personalityImpl (iversion, actions, -- exception_class != GDC_Exception_Class, -- ue_header, context); -+ extern(C) _Unwind_Reason_Code -+ __gdc_personality_sj0(int iversion, -+ _Unwind_Action actions, -+ _Unwind_Exception_Class exception_class, -+ _Unwind_Exception *ue_header, -+ _Unwind_Context *context) -+ { -+ return __gdc_personality_impl (iversion, actions, -+ exception_class != __gdc_exception_class, -+ ue_header, context); - } - - private int __builtin_eh_return_data_regno(int x) { return x; } -- - } - else version (GNU_ARM_EABI_Unwinder) - { -- extern (C) -- _Unwind_Reason_Code __gdc_personality_v0(_Unwind_State state, -- _Unwind_Exception* ue_header, -- _Unwind_Context* context) -+ extern(C) _Unwind_Reason_Code -+ __gdc_personality_v0(_Unwind_State state, -+ _Unwind_Exception* ue_header, -+ _Unwind_Context* context) - { - _Unwind_Action actions; - -@@ -237,29 +328,30 @@ else version (GNU_ARM_EABI_Unwinder) - // However the ABI routines hide this from us, and we don't actually need to knowa - bool foreign_exception = false; - -- return personalityImpl (1, actions, foreign_exception, ue_header, context); -+ return __gdc_personality_impl (1, actions, foreign_exception, ue_header, context); - } - } - else - { -- extern (C) -- _Unwind_Reason_Code __gdc_personality_v0(int iversion, -- _Unwind_Action actions, -- _Unwind_Exception_Class exception_class, -- _Unwind_Exception *ue_header, -- _Unwind_Context *context) -- { -- return personalityImpl (iversion, actions, -- exception_class != GDC_Exception_Class, -- ue_header, context); -+ extern(C) _Unwind_Reason_Code -+ __gdc_personality_v0(int iversion, -+ _Unwind_Action actions, -+ _Unwind_Exception_Class exception_class, -+ _Unwind_Exception *ue_header, -+ _Unwind_Context *context) -+ { -+ return __gdc_personality_impl (iversion, actions, -+ exception_class != __gdc_exception_class, -+ ue_header, context); - } - } - --private _Unwind_Reason_Code personalityImpl(int iversion, -- _Unwind_Action actions, -- bool foreign_exception, -- _Unwind_Exception *ue_header, -- _Unwind_Context *context) -+private _Unwind_Reason_Code -+__gdc_personality_impl(int iversion, -+ _Unwind_Action actions, -+ bool foreign_exception, -+ _Unwind_Exception *ue_header, -+ _Unwind_Context *context) - { - enum Found - { -@@ -271,11 +363,11 @@ private _Unwind_Reason_Code personalityI - - Found found_type; - lsda_header_info info; -- OurUnwindException * xh = OurUnwindException.fromHeader (ue_header); -- ubyte *p; -+ ubyte *language_specific_data; - ubyte *action_record; -- _Unwind_Ptr ip; -- Phase1Info phase1; -+ ubyte *p; -+ _Unwind_Ptr landing_pad, ip; -+ int handler_switch_value; - int ip_before_insn = 0; - - version (GNU_ARM_EABI_Unwinder) -@@ -289,22 +381,31 @@ private _Unwind_Reason_Code personalityI - } - else - { -+ // Interface version check. - if (iversion != 1) - return _URC_FATAL_PHASE1_ERROR; - } - -+ d_exception_header *xh = get_exception_header_from_ue (ue_header); -+ - // Shortcut for phase 2 found handler for domestic exception. -- if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) && ! foreign_exception) -+ if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) -+ && ! foreign_exception) - { -- xh.restore (phase1); -- found_type = (phase1.landingPad == 0 ? Found.terminate : Found.handler); -+ restore_caught_exception(ue_header, handler_switch_value, -+ language_specific_data, landing_pad); -+ found_type = (landing_pad == 0 ? Found.terminate : Found.handler); - goto install_context; - } - -- phase1.languageSpecificData = cast(ubyte *) _Unwind_GetLanguageSpecificData (context); -+ // NOTE: In Phase 1, record _Unwind_GetIPInfo in xh.object as a part of -+ // the stack trace for this exception. This will only collect D frames, -+ // but perhaps that is acceptable. -+ language_specific_data = cast(ubyte *) -+ _Unwind_GetLanguageSpecificData (context); - - // If no LSDA, then there are no handlers or cleanups. -- if (! phase1.languageSpecificData) -+ if (! language_specific_data) - { - version (GNU_ARM_EABI_Unwinder) - if (__gnu_unwind_frame (ue_header, context) != _URC_OK) -@@ -313,14 +414,15 @@ private _Unwind_Reason_Code personalityI - } - - // Parse the LSDA header -- p = parse_lsda_header (context, phase1.languageSpecificData, &info); -+ p = parse_lsda_header (context, language_specific_data, &info); - info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); - ip = _Unwind_GetIPInfo (context, &ip_before_insn); -+ - if (! ip_before_insn) - --ip; -- phase1.landingPad = 0; -+ landing_pad = 0; - action_record = null; -- phase1.handlerSwitchValue = 0; -+ handler_switch_value = 0; - - version (GNU_SjLj_Exceptions) - { -@@ -332,11 +434,11 @@ private _Unwind_Reason_Code personalityI - return _URC_CONTINUE_UNWIND; - else if (ip == 0) - { -- // Fall through to set found_terminate. -+ // Fall through to set Found.terminate. - } - else - { -- _Unwind_Word cs_lp, cs_action; -+ _uleb128_t cs_lp, cs_action; - do - { - p = read_uleb128 (p, &cs_lp); -@@ -346,7 +448,7 @@ private _Unwind_Reason_Code personalityI - - // Can never have null landing pad for sjlj -- that would have - // been indicated by a -1 call site index. -- phase1.landingPad = cs_lp + 1; -+ landing_pad = cs_lp + 1; - if (cs_action) - action_record = info.action_table + cs_action - 1; - goto found_something; -@@ -358,7 +460,7 @@ private _Unwind_Reason_Code personalityI - while (p < info.action_table) - { - _Unwind_Ptr cs_start, cs_len, cs_lp; -- _Unwind_Word cs_action; -+ _uleb128_t cs_action; - - // Note that all call-site encodings are "absolute" displacements. - p = read_encoded_value (null, info.call_site_encoding, p, &cs_start); -@@ -372,7 +474,7 @@ private _Unwind_Reason_Code personalityI - else if (ip < info.Start + cs_start + cs_len) - { - if (cs_lp) -- phase1.landingPad = info.LPStart + cs_lp; -+ landing_pad = info.LPStart + cs_lp; - if (cs_action) - action_record = info.action_table + cs_action - 1; - goto found_something; -@@ -380,14 +482,14 @@ private _Unwind_Reason_Code personalityI - } - } - -- // If ip is not present in the table, call terminate. This is for -- // a destructor inside a cleanup, or a library routine the compiler -- // was not expecting to throw. -+ // If ip is not present in the table, C++ would call terminate. -+ // This is for a destructor inside a cleanup, or a library routine -+ // the compiler was not expecting to throw. - found_type = Found.terminate; - goto do_something; - - found_something: -- if (phase1.landingPad == 0) -+ if (landing_pad == 0) - { - // If ip is present, and has a null landing pad, there are - // no cleanups or handlers to be run. -@@ -403,21 +505,10 @@ private _Unwind_Reason_Code personalityI - else - { - // Otherwise we have a catch handler or exception specification. -- - _sleb128_t ar_filter, ar_disp; -- ClassInfo throw_type, catch_type; - bool saw_cleanup = false; - bool saw_handler = false; - -- // During forced unwinding, we only run cleanups. With a foreign -- // exception class, there's no exception type. -- // ??? What to do about GNU Java and GNU Ada exceptions. -- -- if ((actions & _UA_FORCE_UNWIND) || foreign_exception) -- throw_type = null; -- else -- throw_type = xh.obj.classinfo; -- - while (1) - { - p = action_record; -@@ -429,19 +520,23 @@ private _Unwind_Reason_Code personalityI - // Zero filter values are cleanups. - saw_cleanup = true; - } -+ else if ((actions & _UA_FORCE_UNWIND) || foreign_exception) -+ { -+ // During forced unwinding, we only run cleanups. With a -+ // foreign exception class, we have no class info to match. -+ // ??? What to do about GNU Java and GNU Ada exceptions. -+ } - else if (ar_filter > 0) - { - // Positive filter values are handlers. -- catch_type = get_classinfo_entry (&info, ar_filter); -+ ClassInfo catch_type = get_classinfo_entry (&info, ar_filter); - - // Null catch type is a catch-all handler; we can catch foreign - // exceptions with this. Otherwise we must match types. - // D Note: will be performing dynamic cast twice, potentially - // Once here and once at the landing pad .. unless we cached - // here and had a begin_catch call. -- if (! catch_type -- || (throw_type -- && _d_isbaseof (throw_type, catch_type))) -+ if (catch_type is null || _d_isbaseof (xh.object.classinfo, catch_type)) - { - saw_handler = true; - break; -@@ -460,7 +555,7 @@ private _Unwind_Reason_Code personalityI - - if (saw_handler) - { -- phase1.handlerSwitchValue = ar_filter; -+ handler_switch_value = cast(int) ar_filter; - found_type = Found.handler; - } - else -@@ -488,114 +583,50 @@ private _Unwind_Reason_Code personalityI - - // For domestic exceptions, we cache data from phase 1 for phase 2. - if (! foreign_exception) -- xh.save (context, phase1); -+ { -+ save_caught_exception (ue_header, context, handler_switch_value, -+ language_specific_data, landing_pad, -+ action_record); -+ } - return _URC_HANDLER_FOUND; - } - - install_context: -- - // We can't use any of the deh routines with foreign exceptions, -- // because they all expect ue_header to be an OurUnwindException. -+ // because they all expect ue_header to be an d_exception_header. - // So in that case, call terminate or unexpected directly. - if ((actions & _UA_FORCE_UNWIND) || foreign_exception) - { -- if (found_type == Found.terminate) -+ if (found_type == Found.terminate || handler_switch_value < 0) - __gdc_terminate(); -- else if (phase1.handlerSwitchValue < 0) -- __gdc_unexpected(); - } - else - { - if (found_type == Found.terminate) -- { -- __gdc_beginCatch (&xh.unwindHeader); -- __gdc_terminate(); -- } -+ __gdc_terminate(); - -- if (phase1.handlerSwitchValue < 0) -+ // Cache the TType base value for unexpected calls, as we won't -+ // have an _Unwind_Context then. -+ if (handler_switch_value < 0) - { -- parse_lsda_header (context, phase1.languageSpecificData, &info); -+ parse_lsda_header (context, language_specific_data, &info); - info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); -+ -+ version (GNU_ARM_EABI_Unwinder) -+ ue_header.barrier_cache.bitpattern[1] = info.ttype_base; -+ else -+ xh.catchTemp = info.ttype_base; - } - } - -- static if (is(typeof(__builtin_extend_pointer))) -- // For targets with pointers smaller than the word size, we must extend the -- // pointer, and this extension is target dependent. -- _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), -- __builtin_extend_pointer (&xh.unwindHeader)); -- else -- _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), -- cast(_Unwind_Ptr) &xh.unwindHeader); -- -+ // For targets with pointers smaller than the word size, we must extend the -+ // pointer, and this extension is target dependent. -+ _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), -+ cast(_Unwind_Ptr) ue_header); - _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), -- phase1.handlerSwitchValue); -- _Unwind_SetIP (context, phase1.landingPad); -+ handler_switch_value); -+ _Unwind_SetIP (context, landing_pad); - - return _URC_INSTALL_CONTEXT; - } - --struct lsda_header_info --{ -- _Unwind_Ptr Start; -- _Unwind_Ptr LPStart; -- _Unwind_Ptr ttype_base; -- ubyte *TType; -- ubyte *action_table; -- ubyte ttype_encoding; -- ubyte call_site_encoding; --} -- --private ubyte * --parse_lsda_header (_Unwind_Context *context, ubyte *p, -- lsda_header_info *info) --{ -- _uleb128_t tmp; -- ubyte lpstart_encoding; -- -- info.Start = (context ? _Unwind_GetRegionStart (context) : 0); -- -- // Find @LPStart, the base to which landing pad offsets are relative. -- lpstart_encoding = *p++; -- if (lpstart_encoding != DW_EH_PE_omit) -- p = read_encoded_value (context, lpstart_encoding, p, &info.LPStart); -- else -- info.LPStart = info.Start; -- -- // Find @TType, the base of the handler and exception spec type data. -- info.ttype_encoding = *p++; -- if (info.ttype_encoding != DW_EH_PE_omit) -- { -- version (GNU_ARM_EABI_Unwinder) -- { -- // Older ARM EABI toolchains set this value incorrectly, so use a -- // hardcoded OS-specific format. -- info.ttype_encoding = _TTYPE_ENCODING; -- } -- p = read_uleb128 (p, &tmp); -- info.TType = p + tmp; -- } -- else -- info.TType = null; -- -- // The encoding and length of the call-site table; the action table -- // immediately follows. -- info.call_site_encoding = *p++; -- p = read_uleb128 (p, &tmp); -- info.action_table = p + tmp; -- -- return p; --} -- --private ClassInfo --get_classinfo_entry (lsda_header_info *info, _Unwind_Word i) --{ -- _Unwind_Ptr ptr; -- -- i *= size_of_encoded_value (info.ttype_encoding); -- read_encoded_value_with_base (info.ttype_encoding, info.ttype_base, -- info.TType - i, &ptr); -- -- return cast(ClassInfo)cast(void *)(ptr); --} -- ---- a/src/libphobos/libdruntime/gcc/emutls.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/emutls.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,195 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+// This code is based on the libgcc TLS emulation routines. -+ -+ -+module gcc.emutls; -+ -+import core.stdc.stdlib; -+import core.stdc.string; -+import gcc.gthreads; -+import gcc.builtins; -+private alias gcc.builtins.__builtin_machine_uint word_t; -+private alias gcc.builtins.__builtin_pointer_uint pointer_t; -+ -+struct emutls_object_t -+{ -+ word_t size; -+ word_t palign; -+ loc_t loc; -+ void* templ; -+ -+ union loc_t { -+ pointer_t offset; -+ void* ptr; -+ } -+} -+ -+struct emutls_array_t -+{ -+ pointer_t length; -+ void*** ptr; -+} -+ -+private -+{ -+ static __gshared gthread_key_t emutls_key; -+ static __gshared pointer_t emutls_size; -+ static __gshared gthread_mutex_t emutls_mutex; -+} -+ -+extern(C): -+ -+private void -+emutls_destroy(void* ptr) -+{ -+ emutls_array_t* arr = cast(emutls_array_t*) ptr; -+ -+ for (pointer_t i = 0; i < arr.length; i++) -+ { -+ if (arr.ptr[i]) -+ free(arr.ptr[i][-1]); -+ } -+ -+ free(ptr); -+} -+ -+private void -+emutls_init() -+{ -+ gthread_mutex_init(&emutls_mutex); -+ -+ if (gthread_key_create(&emutls_key, &emutls_destroy) != 0) -+ abort(); -+} -+ -+private void* -+emutls_alloc(emutls_object_t* obj) -+{ -+ void* ret; -+ -+ if (obj.palign <= (void*).sizeof) -+ { -+ void* ptr = malloc(cast(pointer_t)(obj.size) + (void*).sizeof); -+ assert(ptr != null); -+ -+ (cast(void**) ptr)[0] = ptr; -+ ret = ptr + (void*).sizeof; -+ } -+ else -+ { -+ pointer_t alignsize = cast(pointer_t)(obj.palign - 1) + (void*).sizeof; -+ void* ptr = malloc(cast(pointer_t)(obj.size) + alignsize); -+ assert(ptr != null); -+ -+ ret = cast(void*)((cast(pointer_t)(ptr + alignsize)) & ~cast(pointer_t)(obj.palign - 1)); -+ (cast(void**) ret)[-1] = ptr; -+ } -+ -+ if (obj.templ) -+ memcpy(ret, obj.templ, cast(pointer_t)(obj.size)); -+ else -+ memset(ret, 0, cast(pointer_t)(obj.size)); -+ -+ return ret; -+} -+ -+void* -+__emutls_get_address(emutls_object_t* obj) -+{ -+ if (! gthread_active_p()) -+ { -+ if (obj.loc.ptr == null) -+ obj.loc.ptr = emutls_alloc(obj); -+ -+ return obj.loc.ptr; -+ } -+ -+ pointer_t offset = obj.loc.offset; -+ -+ if (offset == 0) -+ { -+ static __gshared gthread_once_t once = GTHREAD_ONCE_INIT; -+ gthread_once(&once, &emutls_init); -+ gthread_mutex_lock(&emutls_mutex); -+ offset = obj.loc.offset; -+ -+ if (offset == 0) -+ { -+ offset = ++emutls_size; -+ obj.loc.offset = offset; -+ } -+ -+ gthread_mutex_unlock(&emutls_mutex); -+ } -+ -+ emutls_array_t* arr = cast(emutls_array_t*) gthread_getspecific(emutls_key); -+ if (arr == null) -+ { -+ pointer_t size = offset + 32; -+ arr = cast(emutls_array_t*) malloc(emutls_array_t.sizeof); -+ assert(arr != null); -+ -+ arr.ptr = cast(void***) calloc(size + 1, (void*).sizeof); -+ arr.length = size; -+ gthread_setspecific(emutls_key, cast(void*) arr); -+ } -+ else if (offset > arr.length) -+ { -+ pointer_t orig_size = arr.length; -+ pointer_t size = orig_size * 2; -+ -+ if (offset > size) -+ size = offset + 32; -+ -+ arr.ptr = cast(void***) realloc(arr.ptr, (size + 1) * (void*).sizeof); -+ assert(arr.ptr != null); -+ -+ arr.length = size; -+ memset(arr.ptr + orig_size, 0, (size - orig_size) * (void*).sizeof); -+ gthread_setspecific(emutls_key, cast(void*) arr); -+ } -+ -+ void* ret = arr.ptr[offset - 1]; -+ if (ret == null) -+ { -+ ret = emutls_alloc(obj); -+ arr.ptr[offset - 1] = cast(void**) ret; -+ } -+ -+ return ret; -+} -+ -+void -+__emutls_register_common(emutls_object_t* obj, word_t size, -+ word_t palign, void* templ) -+{ -+ if (obj.size < size) -+ { -+ obj.size = size; -+ obj.templ = null; -+ } -+ -+ if (obj.palign < palign) -+ obj.palign = palign; -+ -+ if (templ && size == obj.size) -+ obj.templ = templ; -+} -+ ---- a/src/libphobos/libdruntime/gcc/gthreads/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/gthreads/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,26 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+module gcc.gthreads; -+ -+version (GNU_Thread_Posix) -+ public import gcc.gthreads.posix; -+else version (GNU_Thread_Single) -+ public import gcc.gthreads.single; -+else version (GNU_Thread_Win32) -+ public import gcc.gthreads.win32; ---- a/src/libphobos/libdruntime/gcc/gthreads/posix.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/gthreads/posix.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,154 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+// GNU/GCC threads interface routines for D. -+// This must match gthr-posix.h -+ -+module gcc.gthreads.posix; -+ -+// POSIX threads specific definitions. -+// Easy, since the interface is just one-to-one mapping. -+ -+import core.sys.posix.pthread; -+ -+alias gthread_key_t = pthread_key_t; -+alias gthread_once_t = pthread_once_t; -+alias gthread_mutex_t = pthread_mutex_t; -+alias gthread_recursive_mutex_t = pthread_mutex_t; -+ -+enum GTHREAD_MUTEX_INIT = PTHREAD_MUTEX_INITIALIZER; -+enum GTHREAD_ONCE_INIT = PTHREAD_ONCE_INIT; -+enum GTHREAD_RECURSIVE_MUTEX_INIT = PTHREAD_MUTEX_INITIALIZER; -+ -+// Backend thread functions -+extern(C): -+ -+// TODO: FreeBSD and Solaris exposes a dummy POSIX threads -+// interface that will need to be handled here. -+int gthread_active_p() -+{ -+ return 1; -+} -+ -+int gthread_once(gthread_once_t* once, void function() func) -+{ -+ if (gthread_active_p()) -+ return pthread_once(once, func); -+ else -+ return -1; -+} -+ -+int gthread_key_create(gthread_key_t* key, void function(void*) dtor) -+{ -+ return pthread_key_create(key, dtor); -+} -+ -+int gthread_key_delete(gthread_key_t key) -+{ -+ return pthread_key_delete(key); -+} -+ -+void* gthread_getspecific(gthread_key_t key) -+{ -+ return pthread_getspecific(key); -+} -+ -+int gthread_setspecific(gthread_key_t key, in void* ptr) -+{ -+ return pthread_setspecific(key, ptr); -+} -+ -+void gthread_mutex_init(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ pthread_mutex_init(mutex, null); -+} -+ -+int gthread_mutex_destroy(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ return pthread_mutex_destroy(mutex); -+ else -+ return 0; -+} -+ -+int gthread_mutex_lock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ return pthread_mutex_lock(mutex); -+ else -+ return 0; -+} -+ -+int gthread_mutex_trylock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ return pthread_mutex_trylock(mutex); -+ else -+ return 0; -+} -+ -+int gthread_mutex_unlock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ return pthread_mutex_unlock(mutex); -+ else -+ return 0; -+} -+ -+int gthread_recursive_mutex_init(gthread_recursive_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ { -+ pthread_mutexattr_t attr; -+ int status = pthread_mutexattr_init(&attr); -+ -+ if (!status) -+ status = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -+ -+ if (!status) -+ status = pthread_mutex_init(mutex, &attr); -+ -+ if (!status) -+ status = pthread_mutexattr_destroy(&attr); -+ -+ return status; -+ } -+ return 0; -+} -+ -+int gthread_recursive_mutex_lock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_lock(mutex); -+} -+ -+int gthread_recursive_mutex_trylock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_trylock(mutex); -+} -+ -+int gthread_recursive_mutex_unlock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_unlock(mutex); -+} -+ -+int gthread_recursive_mutex_destroy(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_destroy(mutex); -+} -+ ---- a/src/libphobos/libdruntime/gcc/gthreads/single.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/gthreads/single.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,118 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+// GNU/GCC threads interface routines for D. -+// This must match gthr-single.h -+ -+module gcc.gthreads.single; -+ -+// Just provide compatibility for mutex handling. -+ -+alias gthread_key_t = int; -+alias gthread_once_t = int; -+alias gthread_mutex_t = int; -+alias gthread_recursive_mutex_t = int; -+ -+enum GTHREAD_MUTEX_INIT = 0; -+enum GTHREAD_ONCE_INIT = 0; -+enum GTHREAD_RECURSIVE_MUTEX_INIT = 0; -+ -+// Backend thread functions -+extern(C): -+ -+int gthread_active_p() -+{ -+ return 0; -+} -+ -+int gthread_once(gthread_once_t*, void function()) -+{ -+ return 0; -+} -+ -+int gthread_key_create(gthread_key_t*, void* function(void*)) -+{ -+ return 0; -+} -+ -+int gthread_key_delete(gthread_key_t) -+{ -+ return 0; -+} -+ -+void* gthread_getspecific(gthread_key_t) -+{ -+ return null; -+} -+ -+int gthread_setspecific(gthread_key_t, in void*) -+{ -+ return 0; -+} -+ -+void gthread_mutex_init(gthread_mutex_t* mutex) -+{ -+ *(mutex) = GTHREAD_MUTEX_INIT; -+} -+ -+int gthread_mutex_destroy(gthread_mutex_t*) -+{ -+ return 0; -+} -+ -+int gthread_mutex_lock(gthread_mutex_t*) -+{ -+ return 0; -+} -+ -+int gthread_mutex_trylock(gthread_mutex_t*) -+{ -+ return 0; -+} -+ -+int gthread_mutex_unlock(gthread_mutex_t*) -+{ -+ return 0; -+} -+ -+int gthread_recursive_mutex_init(gthread_mutex_t* mutex) -+{ -+ gthread_mutex_init(mutex); -+ return 0; -+} -+ -+int gthread_recursive_mutex_lock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_lock(mutex); -+} -+ -+int gthread_recursive_mutex_trylock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_trylock(mutex); -+} -+ -+int gthread_recursive_mutex_unlock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_unlock(mutex); -+} -+ -+int gthread_recursive_mutex_destroy(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_destroy(mutex); -+} -+ ---- a/src/libphobos/libdruntime/gcc/gthreads/win32.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/gthreads/win32.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,219 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+// GNU/GCC threads interface routines for D. -+// This must match gthr-win32.h -+ -+module gcc.gthreads.win32; -+ -+/* Windows32 threads specific definitions. The windows32 threading model -+ does not map well into pthread-inspired gcc's threading model, and so -+ there are caveats one needs to be aware of. -+ -+ 1. The destructor supplied to gthread_key_create is ignored for -+ generic x86-win32 ports. -+ -+ However, Mingw runtime (version 0.3 or newer) provides a mechanism -+ to emulate pthreads key dtors; the runtime provides a special DLL, -+ linked in if -mthreads option is specified, that runs the dtors in -+ the reverse order of registration when each thread exits. If -+ -mthreads option is not given, a stub is linked in instead of the -+ DLL, which results in memory leak. Other x86-win32 ports can use -+ the same technique of course to avoid the leak. -+ -+ 2. The error codes returned are non-POSIX like, and cast into ints. -+ This may cause incorrect error return due to truncation values on -+ hw where DWORD.sizeof > int.sizeof. -+ -+ The basic framework should work well enough. In the long term, GCC -+ needs to use Structured Exception Handling on Windows32. */ -+ -+import core.sys.windows.windows; -+import core.stdc.errno; -+ -+alias gthread_key_t = ULONG; -+ -+struct gthread_once_t -+{ -+ INT done; -+ LONG started; -+} -+ -+alias gthread_mutex_t = CRITICAL_SECTION; -+alias gthread_recursive_mutex_t = CRITICAL_SECTION; -+ -+enum GTHREAD_MUTEX_INIT = CRITICAL_SECTION.init; -+enum GTHREAD_ONCE_INIT = gthread_once_t(0, -1); -+enum GTHREAD_RECURSIVE_MUTEX_INIT = CRITICAL_SECTION.init; -+ -+extern(C): -+ -+version (MinGW) -+{ -+ // Mingw runtime >= v0.3 provides a magic variable that is set to nonzero -+ // if -mthreads option was specified, or 0 otherwise. -+ extern int _CRT_MT; -+ extern int __mingwthr_key_dtor(ULONG, void function(void*)); -+} -+ -+// Backend thread functions -+ -+int gthread_active_p() -+{ -+ version (MinGW) -+ return _CRT_MT; -+ else -+ return 1; -+} -+ -+int gthread_once(gthread_once_t* once, void function() func) -+{ -+ if (! gthread_active_p()) -+ return -1; -+ else if (once == null || func == null) -+ return EINVAL; -+ -+ if (! once.done) -+ { -+ if (InterlockedIncrement(&(once.started)) == 0) -+ { -+ func(); -+ once.done = TRUE; -+ } -+ else -+ { -+ /* Another thread is currently executing the code, so wait for it -+ to finish; yield the CPU in the meantime. If performance -+ does become an issue, the solution is to use an Event that -+ we wait on here (and set above), but that implies a place to -+ create the event before this routine is called. */ -+ while (! once.done) -+ Sleep(0); -+ } -+ } -+ return 0; -+} -+ -+/* Windows32 thread local keys don't support destructors; this leads to -+ leaks, especially in threaded applications making extensive use of -+ C++ EH. Mingw uses a thread-support DLL to work-around this problem. */ -+int gthread_key_create(gthread_key_t* key, void function(void*) dtor) -+{ -+ DWORD tlsindex = TlsAlloc(); -+ -+ if (tlsindex != 0xFFFFFFFF) -+ { -+ *key = tlsindex; -+ /* Mingw runtime will run the dtors in reverse order for each thread -+ when the thread exits. */ -+ version (MinGW) -+ return __mingwthr_key_dtor(*key, dtor); -+ } -+ else -+ return GetLastError(); -+ -+ return 0; -+} -+ -+int gthread_key_delete(gthread_key_t key) -+{ -+ if (TlsFree(key) != 0) -+ return 0; -+ else -+ return GetLastError(); -+} -+ -+void* gthread_getspecific(gthread_key_t key) -+{ -+ DWORD lasterror = GetLastError(); -+ void* ptr = TlsGetValue(key); -+ -+ SetLastError(lasterror); -+ -+ return ptr; -+} -+ -+int gthread_setspecific(gthread_key_t key, in void* ptr) -+{ -+ if (TlsSetValue(key, cast(void*) ptr) != 0) -+ return 0; -+ else -+ return GetLastError(); -+} -+ -+void gthread_mutex_init(gthread_mutex_t* mutex) -+{ -+ InitializeCriticalSection(mutex); -+} -+ -+int gthread_mutex_destroy(gthread_mutex_t* mutex) -+{ -+ DeleteCriticalSection(mutex); -+ return 0; -+} -+ -+int gthread_mutex_lock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ EnterCriticalSection(mutex); -+ -+ return 0; -+} -+ -+int gthread_mutex_trylock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ return TryEnterCriticalSection(mutex); -+ else -+ return 0; -+} -+ -+int gthread_mutex_unlock(gthread_mutex_t* mutex) -+{ -+ if (gthread_active_p()) -+ LeaveCriticalSection(mutex); -+ -+ return 0; -+} -+ -+int gthread_recursive_mutex_init(gthread_mutex_t* mutex) -+{ -+ gthread_mutex_init(mutex); -+ return 0; -+} -+ -+int gthread_recursive_mutex_lock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_lock(mutex); -+} -+ -+int gthread_recursive_mutex_trylock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_trylock(mutex); -+} -+ -+int gthread_recursive_mutex_unlock(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_unlock(mutex); -+} -+ -+int gthread_recursive_mutex_destroy(gthread_recursive_mutex_t* mutex) -+{ -+ return gthread_mutex_destroy(mutex); -+} -+ ---- a/src/libphobos/libdruntime/gcc/libbacktrace.d.in 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/libbacktrace.d.in 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,88 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* This module provides access to GCC libbacktrace functions */ -+module gcc.libbacktrace; -+ -+/* -+ * This is not part of libbacktrace, it's used for the temporary gdc fallback -+ * implementation. To avoid adding another autoconf module it's defined here -+ */ -+ -+enum HAVE_DLADDR = @HAVE_DLADDR@; -+static if (HAVE_DLADDR) -+{ -+ extern(C): -+ int dladdr(void *addr, Dl_info *info); -+ struct Dl_info -+ { -+ const (char*) dli_fname; -+ void* dli_fbase; -+ const (char*) dli_sname; -+ void* dli_saddr; -+ } -+} -+ -+/* -+ * Part of backtrace-supported.h: These are platform specific variables. -+ * They are obtained via the configure script -+ */ -+ -+enum BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@; -+enum BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@; -+enum BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@; -+ -+/* -+ * libbacktrace.h -+ */ -+ -+static if(BACKTRACE_SUPPORTED) -+{ -+ import core.stdc.stddef, core.stdc.stdio, core.stdc.stdint; -+ -+ extern(C): -+ struct backtrace_state {} -+ -+ alias extern(C) void function(void* data, -+ const(char)* msg, int errnum) backtrace_error_callback; -+ -+ backtrace_state* backtrace_create_state( const(char)* filename, int threaded, -+ backtrace_error_callback error_callback, void* data); -+ -+ alias extern(C) int function(void* data, uintptr_t pc, -+ const(char)* filename, int lineno, const(char)* func) backtrace_full_callback; -+ -+ int backtrace_full(backtrace_state* state, int skip, backtrace_full_callback callback, -+ backtrace_error_callback error_callback, void* data); -+ -+ alias extern(C) int function(void* data, uintptr_t pc) backtrace_simple_callback; -+ -+ int backtrace_simple(backtrace_state* state, int skip, backtrace_simple_callback callback, -+ backtrace_error_callback error_callback, void* data); -+ -+ void backtrace_print(backtrace_state* state, int skip, FILE* file); -+ -+ int backtrace_pcinfo(backtrace_state* state, uintptr_t pc, backtrace_full_callback callback, -+ backtrace_error_callback error_callback, void* data); -+ -+ alias extern(C) void function(void* data, uintptr_t pc, -+ const(char)* symname, uintptr_t symval) backtrace_syminfo_callback; -+ -+ int backtrace_syminfo(backtrace_state *state, uintptr_t pc, backtrace_syminfo_callback callback, -+ backtrace_error_callback error_callback, void* data); -+} ---- a/src/libphobos/libdruntime/gcc/unwind/arm.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind/arm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,312 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* ARM unwind interface declarations for D. This must match unwind-arm.h. */ -+ -+module gcc.unwind.arm; -+ -+import gcc.builtins; -+import gcc.unwind.pe; -+ -+extern (C): -+ -+alias _Unwind_Word = __builtin_machine_uint; -+alias _Unwind_Sword = __builtin_machine_int; -+alias _Unwind_Ptr = __builtin_pointer_uint; -+alias _Unwind_Internal_Ptr =__builtin_pointer_uint; -+alias _uw = _Unwind_Word; -+alias _uw64 = ulong; -+alias _uw16 = ushort; -+alias _uw8 = ubyte; -+ -+alias _Unwind_Reason_Code = uint; -+enum : _Unwind_Reason_Code -+{ -+ _URC_OK = 0, /* operation completed successfully */ -+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1, -+ _URC_END_OF_STACK = 5, -+ _URC_HANDLER_FOUND = 6, -+ _URC_INSTALL_CONTEXT = 7, -+ _URC_CONTINUE_UNWIND = 8, -+ _URC_FAILURE = 9 /* unspecified failure of some kind */ -+} -+ -+alias _Unwind_State = int; -+enum : _Unwind_State -+{ -+ _US_VIRTUAL_UNWIND_FRAME = 0, -+ _US_UNWIND_FRAME_STARTING = 1, -+ _US_UNWIND_FRAME_RESUME = 2, -+ _US_ACTION_MASK = 3, -+ _US_FORCE_UNWIND = 8, -+ _US_END_OF_STACK = 16 -+} -+ -+/* Provided only for for compatibility with existing code. */ -+alias _Unwind_Action = int; -+enum : _Unwind_Action -+{ -+ _UA_SEARCH_PHASE = 1, -+ _UA_CLEANUP_PHASE = 2, -+ _UA_HANDLER_FRAME = 4, -+ _UA_FORCE_UNWIND = 8, -+ _UA_END_OF_STACK = 16, -+ _URC_NO_REASON = _URC_OK -+} -+ -+struct _Unwind_Context; -+alias _Unwind_EHT_Header = _uw; -+ -+extern(C) alias _Unwind_Exception_Cleanup_Fn -+ = void function(_Unwind_Reason_Code, _Unwind_Exception *); -+ -+/* UCB: */ -+ -+struct _Unwind_Control_Block -+{ -+ _Unwind_Exception_Class exception_class = '\0'; -+ _Unwind_Exception_Cleanup_Fn exception_cleanup; -+ /* Unwinder cache, private fields for the unwinder's use */ -+ struct _unwinder_cache -+ { -+ _uw reserved1; /* Forced unwind stop fn, 0 if not forced */ -+ _uw reserved2; /* Personality routine address */ -+ _uw reserved3; /* Saved callsite address */ -+ _uw reserved4; /* Forced unwind stop arg */ -+ _uw reserved5; -+ } -+ _unwinder_cache unwinder_cache; -+ /* Propagation barrier cache (valid after phase 1): */ -+ struct _barrier_cache -+ { -+ _uw sp; -+ _uw[5] bitpattern; -+ } -+ _barrier_cache barrier_cache; -+ /* Cleanup cache (preserved over cleanup): */ -+ struct _cleanup_cache -+ { -+ _uw[4] bitpattern; -+ } -+ _cleanup_cache cleanup_cache; -+ /* Pr cache (for pr's benefit): */ -+ struct _pr_cache -+ { -+ _uw fnstart; /* function start address */ -+ _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ -+ _uw additional; /* additional data */ -+ _uw reserved1; -+ } -+ _pr_cache pr_cache; -+ long[0] _force_alignment; /* Force alignment to 8-byte boundary */ -+} -+ -+/* Virtual Register Set*/ -+alias _Unwind_VRS_RegClass = int; -+enum : _Unwind_VRS_RegClass -+{ -+ _UVRSC_CORE = 0, /* integer register */ -+ _UVRSC_VFP = 1, /* vfp */ -+ _UVRSC_FPA = 2, /* fpa */ -+ _UVRSC_WMMXD = 3, /* Intel WMMX data register */ -+ _UVRSC_WMMXC = 4 /* Intel WMMX control register */ -+} -+ -+alias _Unwind_VRS_DataRepresentation = int; -+enum : _Unwind_VRS_DataRepresentation -+{ -+ _UVRSD_UINT32 = 0, -+ _UVRSD_VFPX = 1, -+ _UVRSD_FPAX = 2, -+ _UVRSD_UINT64 = 3, -+ _UVRSD_FLOAT = 4, -+ _UVRSD_DOUBLE = 5 -+} -+ -+alias _Unwind_VRS_Result = int; -+enum : _Unwind_VRS_Result -+{ -+ _UVRSR_OK = 0, -+ _UVRSR_NOT_IMPLEMENTED = 1, -+ _UVRSR_FAILED = 2 -+} -+ -+/* Frame unwinding state. */ -+struct __gnu_unwind_state -+{ -+ /* The current word (bytes packed msb first). */ -+ _uw data; -+ /* Pointer to the next word of data. */ -+ _uw *next; -+ /* The number of bytes left in this word. */ -+ _uw8 bytes_left; -+ /* The number of words pointed to by ptr. */ -+ _uw8 words_left; -+} -+ -+extern(C) alias personality_routine -+ = _Unwind_Reason_Code function(_Unwind_State, -+ _Unwind_Control_Block *, -+ _Unwind_Context *); -+ -+_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, -+ _uw, _Unwind_VRS_DataRepresentation, -+ void *); -+ -+_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, -+ _uw, _Unwind_VRS_DataRepresentation, -+ void *); -+ -+_Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, -+ _uw, _Unwind_VRS_DataRepresentation); -+ -+ -+/* Support functions for the PR. */ -+alias _Unwind_Exception = _Unwind_Control_Block; -+alias _Unwind_Exception_Class = char[8]; -+ -+void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); -+_Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); -+ -+_Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); -+/* This should never be used. */ -+_Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); -+ -+/* Interface functions: */ -+_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); -+/*pragma (noreturn)*/ void _Unwind_Resume(_Unwind_Control_Block *ucbp); -+_Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp); -+ -+extern(C) alias _Unwind_Stop_Fn -+ =_Unwind_Reason_Code function(int, _Unwind_Action, -+ _Unwind_Exception_Class, -+ _Unwind_Control_Block *, -+ _Unwind_Context *, void *); -+ -+_Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *, -+ _Unwind_Stop_Fn, void *); -+ -+/* @@@ Use unwind data to perform a stack backtrace. The trace callback -+ is called for every stack frame in the call chain, but no cleanup -+ actions are performed. */ -+extern(C) alias _Unwind_Trace_Fn -+ = _Unwind_Reason_Code function(_Unwind_Context *, void *); -+ -+_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *); -+ -+_Unwind_Word _Unwind_GetCFA (_Unwind_Context *); -+void _Unwind_Complete(_Unwind_Control_Block *ucbp); -+void _Unwind_DeleteException (_Unwind_Exception *); -+ -+_Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, -+ _Unwind_Context *); -+_Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, -+ __gnu_unwind_state *); -+ -+_Unwind_Word -+_Unwind_GetIPInfo (_Unwind_Context *context, int *ip_before_insn) -+{ -+ *ip_before_insn = 0; -+ return _Unwind_GetIP (context); -+} -+ -+_Unwind_Word -+_Unwind_GetGR (_Unwind_Context *context, int regno) -+{ -+ _uw val; -+ _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); -+ return val; -+} -+ -+void -+_Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) -+{ -+ _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); -+} -+ -+/* leb128 type numbers have a potentially unlimited size. -+ The target of the following definitions of _sleb128_t and _uleb128_t -+ is to have efficient data types large enough to hold the leb128 type -+ numbers used in the unwind code. */ -+alias _sleb128_t = __builtin_clong; -+alias _uleb128_t = __builtin_culong; -+ -+enum int UNWIND_STACK_REG = 13; -+/* Use IP as a scratch register within the personality routine. */ -+enum int UNWIND_POINTER_REG = 12; -+ -+version (linux) -+ const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel | DW_EH_PE_indirect); -+else version (NetBSD) -+ const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel | DW_EH_PE_indirect); -+else version (symbian) // TODO: name -+ const ubyte _TTYPE_ENCODING = (DW_EH_PE_absptr); -+else version (uclinux) // TODO: name -+ const ubyte _TTYPE_ENCODING = (DW_EH_PE_absptr); -+else -+ const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel); -+ -+/* Decode an R_ARM_TARGET2 relocation. */ -+_Unwind_Word -+_Unwind_decode_typeinfo_ptr (_Unwind_Word base, _Unwind_Word ptr) -+{ -+ _Unwind_Word tmp; -+ tmp = *cast(_Unwind_Word *) ptr; -+ /* Zero values are always NULL. */ -+ if (!tmp) -+ return 0; -+ -+ if (_TTYPE_ENCODING == (DW_EH_PE_pcrel | DW_EH_PE_indirect)) -+ { -+ /* Pc-relative indirect. */ -+ tmp += ptr; -+ tmp = *cast(_Unwind_Word *) tmp; -+ } -+ else if (_TTYPE_ENCODING == DW_EH_PE_absptr) -+ { -+ /* Absolute pointer. Nothing more to do. */ -+ } -+ else -+ { -+ /* Pc-relative pointer. */ -+ tmp += ptr; -+ } -+ return tmp; -+} -+ -+_Unwind_Reason_Code -+__gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact) -+{ -+ return _URC_FAILURE; -+} -+ -+/* Return the address of the instruction, not the actual IP value. */ -+_Unwind_Word -+_Unwind_GetIP(_Unwind_Context *context) -+{ -+ return _Unwind_GetGR (context, 15) & ~ cast(_Unwind_Word) 1; -+} -+ -+/* The dwarf unwinder doesn't understand arm/thumb state. We assume the -+ landing pad uses the same instruction set as the call site. */ -+void -+_Unwind_SetIP(_Unwind_Context *context, _Unwind_Word val) -+{ -+ return _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)); -+} -+ ---- a/src/libphobos/libdruntime/gcc/unwind/generic.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind/generic.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,252 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* GNU/GCC unwind interface declarations for D. This must match -+ unwind-generic.h */ -+ -+module gcc.unwind.generic; -+ -+private import gcc.builtins; -+private import core.stdc.stdlib; // for abort -+ -+/* This is derived from the C++ ABI for IA-64. Where we diverge -+ for cross-architecture compatibility are noted with "@@@". */ -+ -+extern (C): -+ -+/* Level 1: Base ABI */ -+ -+/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is -+ inefficient for 32-bit and smaller machines. */ -+alias _Unwind_Word = __builtin_unwind_uint; -+alias _Unwind_Sword = __builtin_unwind_int; -+version (IA64) -+{ -+ version (HPUX) -+ alias _Unwind_Ptr = __builtin_machine_uint; -+ else -+ alias _Unwind_Ptr = __builtin_pointer_uint; -+} -+else -+{ -+ alias _Unwind_Ptr = __builtin_pointer_uint; -+} -+alias _Unwind_Internal_Ptr = __builtin_pointer_uint; -+ -+/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and -+ consumer of an exception. We'll go along with this for now even on -+ 32-bit machines. We'll need to provide some other option for -+ 16-bit machines and for machines with > 8 bits per byte. */ -+alias _Unwind_Exception_Class = ulong; -+ -+/* The unwind interface uses reason codes in several contexts to -+ identify the reasons for failures or other actions. */ -+alias _Unwind_Reason_Code = uint; -+enum : _Unwind_Reason_Code -+{ -+ _URC_NO_REASON = 0, -+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1, -+ _URC_FATAL_PHASE2_ERROR = 2, -+ _URC_FATAL_PHASE1_ERROR = 3, -+ _URC_NORMAL_STOP = 4, -+ _URC_END_OF_STACK = 5, -+ _URC_HANDLER_FOUND = 6, -+ _URC_INSTALL_CONTEXT = 7, -+ _URC_CONTINUE_UNWIND = 8 -+} -+ -+/* The unwind interface uses a pointer to an exception header object -+ as its representation of an exception being thrown. In general, the -+ full representation of an exception object is language- and -+ implementation-specific, but it will be prefixed by a header -+ understood by the unwind interface. */ -+ -+extern(C) alias _Unwind_Exception_Cleanup_Fn -+ = void function(_Unwind_Reason_Code, _Unwind_Exception *); -+ -+/* @@@ The IA-64 ABI says that this structure must be double-word aligned. -+ Taking that literally does not make much sense generically. Instead we -+ provide the maximum alignment required by any type for the machine. */ -+struct _Unwind_Exception -+{ -+ _Unwind_Exception_Class exception_class; -+ _Unwind_Exception_Cleanup_Fn exception_cleanup; -+ _Unwind_Word private_1; -+ _Unwind_Word private_2; -+} -+ -+/* The ACTIONS argument to the personality routine is a bitwise OR of one -+ or more of the following constants. */ -+alias _Unwind_Action = int; -+ -+enum -+{ -+ _UA_SEARCH_PHASE = 1, -+ _UA_CLEANUP_PHASE = 2, -+ _UA_HANDLER_FRAME = 4, -+ _UA_FORCE_UNWIND = 8, -+ _UA_END_OF_STACK = 16 -+} -+ -+/* This is an opaque type used to refer to a system-specific data -+ structure used by the system unwinder. This context is created and -+ destroyed by the system, and passed to the personality routine -+ during unwinding. */ -+struct _Unwind_Context; -+ -+/* Raise an exception, passing along the given exception object. */ -+_Unwind_Reason_Code _Unwind_RaiseException (_Unwind_Exception *); -+ -+/* Raise an exception for forced unwinding. */ -+ -+extern(C) alias _Unwind_Stop_Fn -+ = _Unwind_Reason_Code function (int, _Unwind_Action, -+ _Unwind_Exception_Class, -+ _Unwind_Exception *, -+ _Unwind_Context *, void *); -+ -+_Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Exception *, _Unwind_Stop_Fn, void *); -+ -+/* Helper to invoke the exception_cleanup routine. */ -+void _Unwind_DeleteException (_Unwind_Exception *); -+ -+/* Resume propagation of an existing exception. This is used after -+ e.g. executing cleanup code, and not to implement rethrowing. */ -+void _Unwind_Resume (_Unwind_Exception *); -+ -+/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow -+ a normal exception that was handled. */ -+_Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Exception *); -+ -+/* @@@ Use unwind data to perform a stack backtrace. The trace callback -+ is called for every stack frame in the call chain, but no cleanup -+ actions are performed. */ -+extern(C) alias _Unwind_Trace_Fn -+ = _Unwind_Reason_Code function (_Unwind_Context *, void *); -+ -+_Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); -+ -+/* These functions are used for communicating information about the unwind -+ context (i.e. the unwind descriptors and the user register state) between -+ the unwind library and the personality routine and landing pad. Only -+ selected registers may be manipulated. */ -+ -+_Unwind_Word _Unwind_GetGR (_Unwind_Context *, int); -+void _Unwind_SetGR (_Unwind_Context *, int, _Unwind_Word); -+ -+_Unwind_Ptr _Unwind_GetIP (_Unwind_Context *); -+_Unwind_Ptr _Unwind_GetIPInfo (_Unwind_Context *, int *); -+void _Unwind_SetIP (_Unwind_Context *, _Unwind_Ptr); -+ -+/* @@@ Retrieve the CFA of the given context. */ -+_Unwind_Word _Unwind_GetCFA (_Unwind_Context *); -+ -+void *_Unwind_GetLanguageSpecificData (_Unwind_Context *); -+ -+_Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); -+ -+ -+/* The personality routine is the function in the C++ (or other language) -+ runtime library which serves as an interface between the system unwind -+ library and language-specific exception handling semantics. It is -+ specific to the code fragment described by an unwind info block, and -+ it is always referenced via the pointer in the unwind info block, and -+ hence it has no ABI-specified name. -+ -+ Note that this implies that two different C++ implementations can -+ use different names, and have different contents in the language -+ specific data area. Moreover, that the language specific data -+ area contains no version info because name of the function invoked -+ provides more effective versioning by detecting at link time the -+ lack of code to handle the different data format. */ -+ -+extern(C) alias _Unwind_Personality_Fn -+ = _Unwind_Reason_Code function (int, _Unwind_Action, -+ _Unwind_Exception_Class, -+ _Unwind_Exception *, -+ _Unwind_Context *); -+ -+/* @@@ The following alternate entry points are for setjmp/longjmp -+ based unwinding. */ -+ -+struct SjLj_Function_Context; -+extern void _Unwind_SjLj_Register (SjLj_Function_Context *); -+extern void _Unwind_SjLj_Unregister (SjLj_Function_Context *); -+ -+_Unwind_Reason_Code _Unwind_SjLj_RaiseException (_Unwind_Exception *); -+_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind (_Unwind_Exception *, _Unwind_Stop_Fn, void *); -+void _Unwind_SjLj_Resume (_Unwind_Exception *); -+_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (_Unwind_Exception *); -+ -+/* @@@ The following provide access to the base addresses for text -+ and data-relative addressing in the LDSA. In order to stay link -+ compatible with the standard ABI for IA-64, we inline these. */ -+ -+version (IA64) -+{ -+ _Unwind_Ptr -+ _Unwind_GetDataRelBase (_Unwind_Context *_C) -+ { -+ /* The GP is stored in R1. */ -+ return _Unwind_GetGR (_C, 1); -+ } -+ -+ _Unwind_Ptr -+ _Unwind_GetTextRelBase (_Unwind_Context *) -+ { -+ abort (); -+ return 0; -+ } -+ -+ /* @@@ Retrieve the Backing Store Pointer of the given context. */ -+ _Unwind_Word _Unwind_GetBSP (_Unwind_Context *); -+} -+else -+{ -+ _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); -+ _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); -+} -+ -+/* @@@ Given an address, return the entry point of the function that -+ contains it. */ -+extern void * _Unwind_FindEnclosingFunction (void *pc); -+ -+ -+/* leb128 type numbers have a potentially unlimited size. -+ The target of the following definitions of _sleb128_t and _uleb128_t -+ is to have efficient data types large enough to hold the leb128 type -+ numbers used in the unwind code. -+ Mostly these types will simply be defined to long and unsigned long -+ except when a unsigned long data type on the target machine is not -+ capable of storing a pointer. */ -+ -+static if (__builtin_clong.sizeof >= (void*).sizeof) -+{ -+ alias _sleb128_t = __builtin_clong; -+ alias _uleb128_t = __builtin_culong; -+} -+else static if (long.sizeof >= (void*).sizeof) -+{ -+ alias _sleb128_t = long; -+ alias _uleb128_t = ulong; -+} -+else -+{ -+ static assert (0, "What type shall we use for _sleb128_t?"); -+} -+ ---- a/src/libphobos/libdruntime/gcc/unwind/package.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind/package.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,24 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+module gcc.unwind; -+ -+version (GNU_ARM_EABI_Unwinder) -+ public import gcc.unwind.arm; -+else -+ public import gcc.unwind.generic; ---- a/src/libphobos/libdruntime/gcc/unwind/pe.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind/pe.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,273 @@ -+/* GDC -- D front-end for GCC -+ Copyright (C) 2011, 2012 Free Software Foundation, Inc. -+ -+ GCC is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3, or (at your option) any later -+ version. -+ -+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+ WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with GCC; see the file COPYING3. If not see -+ <http://www.gnu.org/licenses/>. -+*/ -+ -+/* GNU/GCC unwind interface declarations for D. This must match unwind-pe.h */ -+ -+module gcc.unwind.pe; -+ -+import gcc.unwind; -+private import core.stdc.stdlib : abort; -+ -+/* Pointer encodings, from dwarf2.h. */ -+enum -+{ -+ DW_EH_PE_absptr = 0x00, -+ DW_EH_PE_omit = 0xff, -+ -+ DW_EH_PE_uleb128 = 0x01, -+ DW_EH_PE_udata2 = 0x02, -+ DW_EH_PE_udata4 = 0x03, -+ DW_EH_PE_udata8 = 0x04, -+ DW_EH_PE_sleb128 = 0x09, -+ DW_EH_PE_sdata2 = 0x0A, -+ DW_EH_PE_sdata4 = 0x0B, -+ DW_EH_PE_sdata8 = 0x0C, -+ DW_EH_PE_signed = 0x08, -+ -+ DW_EH_PE_pcrel = 0x10, -+ DW_EH_PE_textrel = 0x20, -+ DW_EH_PE_datarel = 0x30, -+ DW_EH_PE_funcrel = 0x40, -+ DW_EH_PE_aligned = 0x50, -+ -+ DW_EH_PE_indirect = 0x80 -+} -+ -+version (NO_SIZE_OF_ENCODED_VALUE) {} -+else -+{ -+ /* Given an encoding, return the number of bytes the format occupies. -+ This is only defined for fixed-size encodings, and so does not -+ include leb128. */ -+ uint size_of_encoded_value (ubyte encoding) -+ { -+ if (encoding == DW_EH_PE_omit) -+ return 0; -+ -+ final switch (encoding & 0x07) -+ { -+ case DW_EH_PE_absptr: -+ return (void *).sizeof; -+ case DW_EH_PE_udata2: -+ return 2; -+ case DW_EH_PE_udata4: -+ return 4; -+ case DW_EH_PE_udata8: -+ return 8; -+ } -+ assert(0); -+ } -+} -+ -+version (NO_BASE_OF_ENCODED_VALUE) {} -+else -+{ -+ /* Given an encoding and an _Unwind_Context, return the base to which -+ the encoding is relative. This base may then be passed to -+ read_encoded_value_with_base for use when the _Unwind_Context is -+ not available. */ -+ -+ _Unwind_Ptr -+ base_of_encoded_value (ubyte encoding, _Unwind_Context *context) -+ { -+ if (encoding == DW_EH_PE_omit) -+ return cast(_Unwind_Ptr) 0; -+ -+ final switch (encoding & 0x70) -+ { -+ case DW_EH_PE_absptr: -+ case DW_EH_PE_pcrel: -+ case DW_EH_PE_aligned: -+ return cast(_Unwind_Ptr) 0; -+ -+ case DW_EH_PE_textrel: -+ return _Unwind_GetTextRelBase (context); -+ case DW_EH_PE_datarel: -+ return _Unwind_GetDataRelBase (context); -+ case DW_EH_PE_funcrel: -+ return _Unwind_GetRegionStart (context); -+ } -+ assert (0); -+ } -+} -+ -+/* Read an unsigned leb128 value from P, store the value in VAL, return -+ P incremented past the value. We assume that a word is large enough to -+ hold any value so encoded; if it is smaller than a pointer on some target, -+ pointers should not be leb128 encoded on that target. */ -+ -+ubyte * -+read_uleb128 (ubyte *p, _uleb128_t *val) -+{ -+ uint shift = 0; -+ ubyte a_byte; -+ _uleb128_t result; -+ -+ result = cast(_uleb128_t) 0; -+ do -+ { -+ a_byte = *p++; -+ result |= (cast(_uleb128_t)a_byte & 0x7f) << shift; -+ shift += 7; -+ } -+ while (a_byte & 0x80); -+ -+ *val = result; -+ return p; -+} -+ -+/* Similar, but read a signed leb128 value. */ -+ -+ubyte * -+read_sleb128 (ubyte *p, _sleb128_t *val) -+{ -+ uint shift = 0; -+ ubyte a_byte; -+ _uleb128_t result; -+ -+ result = cast(_uleb128_t) 0; -+ do -+ { -+ a_byte = *p++; -+ result |= (cast(_uleb128_t)a_byte & 0x7f) << shift; -+ shift += 7; -+ } -+ while (a_byte & 0x80); -+ -+ /* Sign-extend a negative value. */ -+ if (shift < 8 * result.sizeof && (a_byte & 0x40) != 0) -+ result |= -((cast(_uleb128_t)1L) << shift); -+ -+ *val = cast(_sleb128_t) result; -+ return p; -+} -+ -+/* Load an encoded value from memory at P. The value is returned in VAL; -+ The function returns P incremented past the value. BASE is as given -+ by base_of_encoded_value for this encoding in the appropriate context. */ -+ -+ubyte * -+read_encoded_value_with_base (ubyte encoding, _Unwind_Ptr base, -+ ubyte *p, _Unwind_Ptr *val) -+{ -+ union unaligned -+ { -+ align(1): -+ void *ptr; -+ ushort u2; -+ uint u4; -+ ulong u8; -+ short s2; -+ int s4; -+ long s8; -+ } -+ -+ unaligned *u = cast(unaligned *) p; -+ _Unwind_Internal_Ptr result; -+ -+ if (encoding == DW_EH_PE_aligned) -+ { -+ _Unwind_Internal_Ptr a = cast(_Unwind_Internal_Ptr) p; -+ a = cast(_Unwind_Internal_Ptr)( (a + (void *).sizeof - 1) & - (void *).sizeof ); -+ result = *cast(_Unwind_Internal_Ptr *) a; -+ p = cast(ubyte *) cast(_Unwind_Internal_Ptr) (a + (void *).sizeof); -+ } -+ else -+ { -+ switch (encoding & 0x0f) -+ { -+ case DW_EH_PE_absptr: -+ result = cast(_Unwind_Internal_Ptr) u.ptr; -+ p += (void *).sizeof; -+ break; -+ -+ case DW_EH_PE_uleb128: -+ { -+ _uleb128_t tmp; -+ p = read_uleb128 (p, &tmp); -+ result = cast(_Unwind_Internal_Ptr) tmp; -+ } -+ break; -+ -+ case DW_EH_PE_sleb128: -+ { -+ _sleb128_t tmp; -+ p = read_sleb128 (p, &tmp); -+ result = cast(_Unwind_Internal_Ptr) tmp; -+ } -+ break; -+ -+ case DW_EH_PE_udata2: -+ result = cast(_Unwind_Internal_Ptr) u.u2; -+ p += 2; -+ break; -+ case DW_EH_PE_udata4: -+ result = cast(_Unwind_Internal_Ptr) u.u4; -+ p += 4; -+ break; -+ case DW_EH_PE_udata8: -+ result = cast(_Unwind_Internal_Ptr) u.u8; -+ p += 8; -+ break; -+ -+ case DW_EH_PE_sdata2: -+ result = cast(_Unwind_Internal_Ptr) u.s2; -+ p += 2; -+ break; -+ case DW_EH_PE_sdata4: -+ result = cast(_Unwind_Internal_Ptr) u.s4; -+ p += 4; -+ break; -+ case DW_EH_PE_sdata8: -+ result = cast(_Unwind_Internal_Ptr) u.s8; -+ p += 8; -+ break; -+ -+ default: -+ abort (); -+ } -+ -+ if (result != 0) -+ { -+ result += ((encoding & 0x70) == DW_EH_PE_pcrel -+ ? cast(_Unwind_Internal_Ptr) u : base); -+ if (encoding & DW_EH_PE_indirect) -+ result = *cast(_Unwind_Internal_Ptr *) result; -+ } -+ } -+ -+ *val = result; -+ return p; -+} -+ -+version (NO_BASE_OF_ENCODED_VALUE) {} -+else -+{ -+ /* Like read_encoded_value_with_base, but get the base from the context -+ rather than providing it directly. */ -+ -+ ubyte * -+ read_encoded_value (_Unwind_Context *context, ubyte encoding, -+ ubyte *p, _Unwind_Ptr *val) -+ { -+ return read_encoded_value_with_base (encoding, -+ base_of_encoded_value (encoding, context), -+ p, val); -+ } -+} -+ ---- a/src/libphobos/libdruntime/gcc/unwind_arm.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind_arm.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,295 +0,0 @@ --/* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- -- GCC is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. -- -- GCC is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING3. If not see -- <http://www.gnu.org/licenses/>. --*/ -- --/* ARM unwind interface declarations for D. This must match unwind-arm.h. */ -- --module gcc.unwind_arm; -- --import gcc.builtins; --import gcc.unwind_pe; -- --extern (C): -- --alias __builtin_machine_uint _Unwind_Word; --alias __builtin_machine_int _Unwind_Sword; --alias __builtin_pointer_uint _Unwind_Ptr; --alias __builtin_pointer_uint _Unwind_Internal_Ptr; --alias _Unwind_Word _uw; --alias ulong _uw64; --alias ushort _uw16; --alias ubyte _uw8; -- --alias uint _Unwind_Reason_Code; --enum : _Unwind_Reason_Code --{ -- _URC_OK = 0, /* operation completed successfully */ -- _URC_FOREIGN_EXCEPTION_CAUGHT = 1, -- _URC_END_OF_STACK = 5, -- _URC_HANDLER_FOUND = 6, -- _URC_INSTALL_CONTEXT = 7, -- _URC_CONTINUE_UNWIND = 8, -- _URC_FAILURE = 9 /* unspecified failure of some kind */ --} -- --alias int _Unwind_State; --enum : _Unwind_State --{ -- _US_VIRTUAL_UNWIND_FRAME = 0, -- _US_UNWIND_FRAME_STARTING = 1, -- _US_UNWIND_FRAME_RESUME = 2, -- _US_ACTION_MASK = 3, -- _US_FORCE_UNWIND = 8, -- _US_END_OF_STACK = 16 --} -- --/* Provided only for for compatibility with existing code. */ --alias int _Unwind_Action; --enum : _Unwind_Action --{ -- _UA_SEARCH_PHASE = 1, -- _UA_CLEANUP_PHASE = 2, -- _UA_HANDLER_FRAME = 4, -- _UA_FORCE_UNWIND = 8, -- _UA_END_OF_STACK = 16, -- _URC_NO_REASON = _URC_OK --} -- --struct _Unwind_Context; --alias _uw _Unwind_EHT_Header; -- -- --/* UCB: */ -- --struct _Unwind_Control_Block --{ -- char exception_class[8] = '\0'; -- extern(C) void function(_Unwind_Reason_Code, _Unwind_Control_Block *) exception_cleanup; -- /* Unwinder cache, private fields for the unwinder's use */ -- struct _unwinder_cache -- { -- _uw reserved1; /* Forced unwind stop fn, 0 if not forced */ -- _uw reserved2; /* Personality routine address */ -- _uw reserved3; /* Saved callsite address */ -- _uw reserved4; /* Forced unwind stop arg */ -- _uw reserved5; -- } -- _unwinder_cache unwinder_cache; -- /* Propagation barrier cache (valid after phase 1): */ -- struct _barrier_cache -- { -- _uw sp; -- _uw bitpattern[5]; -- } -- _barrier_cache barrier_cache; -- /* Cleanup cache (preserved over cleanup): */ -- struct _cleanup_cache -- { -- _uw bitpattern[4]; -- } -- _cleanup_cache cleanup_cache; -- /* Pr cache (for pr's benefit): */ -- struct _pr_cache -- { -- _uw fnstart; /* function start address */ -- _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ -- _uw additional; /* additional data */ -- _uw reserved1; -- } -- _pr_cache pr_cache; -- long[0] _force_alignment; /* Force alignment to 8-byte boundary */ --} -- --/* Virtual Register Set*/ --alias int _Unwind_VRS_RegClass; --enum : _Unwind_VRS_RegClass --{ -- _UVRSC_CORE = 0, /* integer register */ -- _UVRSC_VFP = 1, /* vfp */ -- _UVRSC_FPA = 2, /* fpa */ -- _UVRSC_WMMXD = 3, /* Intel WMMX data register */ -- _UVRSC_WMMXC = 4 /* Intel WMMX control register */ --} -- --alias int _Unwind_VRS_DataRepresentation; --enum : _Unwind_VRS_DataRepresentation --{ -- _UVRSD_UINT32 = 0, -- _UVRSD_VFPX = 1, -- _UVRSD_FPAX = 2, -- _UVRSD_UINT64 = 3, -- _UVRSD_FLOAT = 4, -- _UVRSD_DOUBLE = 5 --} -- --alias int _Unwind_VRS_Result; --enum : _Unwind_VRS_Result --{ -- _UVRSR_OK = 0, -- _UVRSR_NOT_IMPLEMENTED = 1, -- _UVRSR_FAILED = 2 --} -- --/* Frame unwinding state. */ --struct __gnu_unwind_state --{ -- /* The current word (bytes packed msb first). */ -- _uw data; -- /* Pointer to the next word of data. */ -- _uw *next; -- /* The number of bytes left in this word. */ -- _uw8 bytes_left; -- /* The number of words pointed to by ptr. */ -- _uw8 words_left; --} -- --alias extern(C) _Unwind_Reason_Code function(_Unwind_State, -- _Unwind_Control_Block *, _Unwind_Context *) personality_routine; -- --_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, -- _uw, _Unwind_VRS_DataRepresentation, -- void *); -- --_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, -- _uw, _Unwind_VRS_DataRepresentation, -- void *); -- --_Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, -- _uw, _Unwind_VRS_DataRepresentation); -- -- --/* Support functions for the PR. */ --alias _Unwind_Control_Block _Unwind_Exception ; --alias char[8] _Unwind_Exception_Class; // = '\0' -- --void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); --_Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); -- --_Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); --/* This should never be used. */ --_Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); -- --/* Interface functions: */ --_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); --/*pragma (noreturn)*/ void _Unwind_Resume(_Unwind_Control_Block *ucbp); --_Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp); -- --alias extern(C) _Unwind_Reason_Code function(int, _Unwind_Action, _Unwind_Exception_Class, -- _Unwind_Control_Block *, _Unwind_Context *, void *) _Unwind_Stop_Fn; -- --_Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *, -- _Unwind_Stop_Fn, void *); --/* @@@ Use unwind data to perform a stack backtrace. The trace callback -- is called for every stack frame in the call chain, but no cleanup -- actions are performed. */ --alias extern(C) _Unwind_Reason_Code function(_Unwind_Context *, void *) _Unwind_Trace_Fn; --_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *); -- --_Unwind_Word _Unwind_GetCFA (_Unwind_Context *); --void _Unwind_Complete(_Unwind_Control_Block *ucbp); --void _Unwind_DeleteException (_Unwind_Exception *); -- --_Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, -- _Unwind_Context *); --_Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, -- __gnu_unwind_state *); -- --_Unwind_Word _Unwind_GetIPInfo (_Unwind_Context *context, int *ip_before_insn) --{ -- *ip_before_insn = 0; -- return _Unwind_GetIP (context); --} -- --_Unwind_Word _Unwind_GetGR (_Unwind_Context *context, int regno) --{ -- _uw val; -- _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); -- return val; --} -- --void _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) --{ -- _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); --} -- --/* leb128 type numbers have a potentially unlimited size. -- The target of the following definitions of _sleb128_t and _uleb128_t -- is to have efficient data types large enough to hold the leb128 type -- numbers used in the unwind code. */ --alias __builtin_clong _sleb128_t; --alias __builtin_culong _uleb128_t; -- --enum int UNWIND_STACK_REG = 13; --/* Use IP as a scratch register within the personality routine. */ --enum int UNWIND_POINTER_REG = 12; -- --version (linux) -- const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel | DW_EH_PE_indirect); --else version (NetBSD) -- const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel | DW_EH_PE_indirect); --else version (symbian) // TODO: name -- const ubyte _TTYPE_ENCODING = (DW_EH_PE_absptr); --else version (uclinux) // TODO: name -- const ubyte _TTYPE_ENCODING = (DW_EH_PE_absptr); --else -- const ubyte _TTYPE_ENCODING = (DW_EH_PE_pcrel); -- --/* Decode an R_ARM_TARGET2 relocation. */ --_Unwind_Word _Unwind_decode_typeinfo_ptr (_Unwind_Word base, _Unwind_Word ptr) --{ -- _Unwind_Word tmp; -- tmp = *cast(_Unwind_Word *) ptr; -- /* Zero values are always NULL. */ -- if (!tmp) -- return 0; -- -- if (_TTYPE_ENCODING == (DW_EH_PE_pcrel | DW_EH_PE_indirect)) -- { -- /* Pc-relative indirect. */ -- tmp += ptr; -- tmp = *cast(_Unwind_Word *) tmp; -- } -- else if (_TTYPE_ENCODING == DW_EH_PE_absptr) -- { -- /* Absolute pointer. Nothing more to do. */ -- } -- else -- { -- /* Pc-relative pointer. */ -- tmp += ptr; -- } -- return tmp; --} -- --_Unwind_Reason_Code __gnu_unwind_24bit (_Unwind_Context * context, _uw data, int compact) --{ -- return _URC_FAILURE; --} -- --/* Return the address of the instruction, not the actual IP value. */ --_Unwind_Word _Unwind_GetIP(_Unwind_Context *context) --{ -- return _Unwind_GetGR (context, 15) & ~ cast(_Unwind_Word) 1; --} -- --/* The dwarf unwinder doesn't understand arm/thumb state. We assume the -- landing pad uses the same instruction set as the call site. */ --void _Unwind_SetIP(_Unwind_Context *context, _Unwind_Word val) --{ -- return _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)); --} -- ---- a/src/libphobos/libdruntime/gcc/unwind.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,24 +0,0 @@ --/* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- -- GCC is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. -- -- GCC is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING3. If not see -- <http://www.gnu.org/licenses/>. --*/ -- --module gcc.unwind; -- --version (GNU_ARM_EABI_Unwinder) -- public import gcc.unwind_arm; --else -- public import gcc.unwind_generic; ---- a/src/libphobos/libdruntime/gcc/unwind_generic.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind_generic.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,244 +0,0 @@ --/* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- -- GCC is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. -- -- GCC is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING3. If not see -- <http://www.gnu.org/licenses/>. --*/ -- --/* GNU/GCC unwind interface declarations for D. This must match -- unwind-generic.h */ -- --module gcc.unwind_generic; -- --private import gcc.builtins; --private import core.stdc.stdlib; // for abort -- --/* This is derived from the C++ ABI for IA-64. Where we diverge -- for cross-architecture compatibility are noted with "@@@". */ -- --extern (C): -- --/* Level 1: Base ABI */ -- --/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is -- inefficient for 32-bit and smaller machines. */ --alias __builtin_unwind_uint _Unwind_Word; --alias __builtin_unwind_int _Unwind_Sword; --version (IA64) --{ -- version (HPUX) -- alias __builtin_machine_uint _Unwind_Ptr; -- else -- alias __builtin_pointer_uint _Unwind_Ptr; --} --else --{ -- alias __builtin_pointer_uint _Unwind_Ptr; --} --alias __builtin_pointer_uint _Unwind_Internal_Ptr; -- --/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and -- consumer of an exception. We'll go along with this for now even on -- 32-bit machines. We'll need to provide some other option for -- 16-bit machines and for machines with > 8 bits per byte. */ --alias ulong _Unwind_Exception_Class; -- --/* The unwind interface uses reason codes in several contexts to -- identify the reasons for failures or other actions. */ --alias uint _Unwind_Reason_Code; --enum : _Unwind_Reason_Code --{ -- _URC_NO_REASON = 0, -- _URC_FOREIGN_EXCEPTION_CAUGHT = 1, -- _URC_FATAL_PHASE2_ERROR = 2, -- _URC_FATAL_PHASE1_ERROR = 3, -- _URC_NORMAL_STOP = 4, -- _URC_END_OF_STACK = 5, -- _URC_HANDLER_FOUND = 6, -- _URC_INSTALL_CONTEXT = 7, -- _URC_CONTINUE_UNWIND = 8 --} -- -- --/* The unwind interface uses a pointer to an exception header object -- as its representation of an exception being thrown. In general, the -- full representation of an exception object is language- and -- implementation-specific, but it will be prefixed by a header -- understood by the unwind interface. */ -- --alias extern(C) void function(_Unwind_Reason_Code, _Unwind_Exception *) _Unwind_Exception_Cleanup_Fn; -- --/* @@@ The IA-64 ABI says that this structure must be double-word aligned. -- Taking that literally does not make much sense generically. Instead we -- provide the maximum alignment required by any type for the machine. */ --align struct _Unwind_Exception --{ -- _Unwind_Exception_Class exception_class; -- _Unwind_Exception_Cleanup_Fn exception_cleanup; -- _Unwind_Word private_1; -- _Unwind_Word private_2; --} -- -- --/* The ACTIONS argument to the personality routine is a bitwise OR of one -- or more of the following constants. */ --alias int _Unwind_Action; -- --enum --{ -- _UA_SEARCH_PHASE = 1, -- _UA_CLEANUP_PHASE = 2, -- _UA_HANDLER_FRAME = 4, -- _UA_FORCE_UNWIND = 8, -- _UA_END_OF_STACK = 16 --} -- --/* This is an opaque type used to refer to a system-specific data -- structure used by the system unwinder. This context is created and -- destroyed by the system, and passed to the personality routine -- during unwinding. */ --struct _Unwind_Context; -- --/* Raise an exception, passing along the given exception object. */ --_Unwind_Reason_Code _Unwind_RaiseException (_Unwind_Exception *); -- --/* Raise an exception for forced unwinding. */ -- --alias extern(C) _Unwind_Reason_Code function (int, _Unwind_Action, _Unwind_Exception_Class, -- _Unwind_Exception *, _Unwind_Context *, void *) _Unwind_Stop_Fn; -- --_Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Exception *, _Unwind_Stop_Fn, void *); -- --/* Helper to invoke the exception_cleanup routine. */ --void _Unwind_DeleteException (_Unwind_Exception *); -- --/* Resume propagation of an existing exception. This is used after -- e.g. executing cleanup code, and not to implement rethrowing. */ --void _Unwind_Resume (_Unwind_Exception *); -- --/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow -- a normal exception that was handled. */ --_Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Exception *); -- --/* @@@ Use unwind data to perform a stack backtrace. The trace callback -- is called for every stack frame in the call chain, but no cleanup -- actions are performed. */ --alias extern(C) _Unwind_Reason_Code function (_Unwind_Context *, void *) _Unwind_Trace_Fn; -- --_Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); -- --/* These functions are used for communicating information about the unwind -- context (i.e. the unwind descriptors and the user register state) between -- the unwind library and the personality routine and landing pad. Only -- selected registers may be manipulated. */ -- --_Unwind_Word _Unwind_GetGR (_Unwind_Context *, int); --void _Unwind_SetGR (_Unwind_Context *, int, _Unwind_Word); -- --_Unwind_Ptr _Unwind_GetIP (_Unwind_Context *); --_Unwind_Ptr _Unwind_GetIPInfo (_Unwind_Context *, int *); --void _Unwind_SetIP (_Unwind_Context *, _Unwind_Ptr); -- --/* @@@ Retrieve the CFA of the given context. */ --_Unwind_Word _Unwind_GetCFA (_Unwind_Context *); -- --void *_Unwind_GetLanguageSpecificData (_Unwind_Context *); -- --_Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); -- -- --/* The personality routine is the function in the C++ (or other language) -- runtime library which serves as an interface between the system unwind -- library and language-specific exception handling semantics. It is -- specific to the code fragment described by an unwind info block, and -- it is always referenced via the pointer in the unwind info block, and -- hence it has no ABI-specified name. -- -- Note that this implies that two different C++ implementations can -- use different names, and have different contents in the language -- specific data area. Moreover, that the language specific data -- area contains no version info because name of the function invoked -- provides more effective versioning by detecting at link time the -- lack of code to handle the different data format. */ -- --alias extern(C) _Unwind_Reason_Code function (int, _Unwind_Action, _Unwind_Exception_Class, -- _Unwind_Exception *, _Unwind_Context *) _Unwind_Personality_Fn; -- --/* @@@ The following alternate entry points are for setjmp/longjmp -- based unwinding. */ -- --struct SjLj_Function_Context; --extern void _Unwind_SjLj_Register (SjLj_Function_Context *); --extern void _Unwind_SjLj_Unregister (SjLj_Function_Context *); -- --_Unwind_Reason_Code _Unwind_SjLj_RaiseException (_Unwind_Exception *); --_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind (_Unwind_Exception *, _Unwind_Stop_Fn, void *); --void _Unwind_SjLj_Resume (_Unwind_Exception *); --_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (_Unwind_Exception *); -- --/* @@@ The following provide access to the base addresses for text -- and data-relative addressing in the LDSA. In order to stay link -- compatible with the standard ABI for IA-64, we inline these. */ -- --version (IA64) --{ -- _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *_C) -- { -- /* The GP is stored in R1. */ -- return _Unwind_GetGR (_C, 1); -- } -- -- _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *) -- { -- abort (); -- return 0; -- } -- -- /* @@@ Retrieve the Backing Store Pointer of the given context. */ -- _Unwind_Word _Unwind_GetBSP (_Unwind_Context *); --} --else --{ -- _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); -- _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); --} -- --/* @@@ Given an address, return the entry point of the function that -- contains it. */ --extern void * _Unwind_FindEnclosingFunction (void *pc); -- -- --/* leb128 type numbers have a potentially unlimited size. -- The target of the following definitions of _sleb128_t and _uleb128_t -- is to have efficient data types large enough to hold the leb128 type -- numbers used in the unwind code. -- Mostly these types will simply be defined to long and unsigned long -- except when a unsigned long data type on the target machine is not -- capable of storing a pointer. */ -- --static if (__builtin_clong.sizeof >= (void*).sizeof) --{ -- alias __builtin_clong _sleb128_t; -- alias __builtin_culong _uleb128_t; --} --else static if (long.sizeof >= (void*).sizeof) --{ -- alias long _sleb128_t; -- alias ulong _uleb128_t; --} --else --{ -- static assert (0, "What type shall we use for _sleb128_t?"); --} -- ---- a/src/libphobos/libdruntime/gcc/unwind_pe.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/gcc/unwind_pe.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,271 +0,0 @@ --/* GDC -- D front-end for GCC -- Copyright (C) 2011, 2012 Free Software Foundation, Inc. -- -- GCC is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free -- Software Foundation; either version 3, or (at your option) any later -- version. -- -- GCC is distributed in the hope that it will be useful, but WITHOUT ANY -- WARRANTY; without even the implied warranty of MERCHANTABILITY or -- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. -- -- You should have received a copy of the GNU General Public License -- along with GCC; see the file COPYING3. If not see -- <http://www.gnu.org/licenses/>. --*/ -- --/* GNU/GCC unwind interface declarations for D. This must match unwind-pe.h */ -- --module gcc.unwind_pe; -- --import gcc.unwind; --private import core.stdc.stdlib : abort; -- --/* Pointer encodings, from dwarf2.h. */ --enum --{ -- DW_EH_PE_absptr = 0x00, -- DW_EH_PE_omit = 0xff, -- -- DW_EH_PE_uleb128 = 0x01, -- DW_EH_PE_udata2 = 0x02, -- DW_EH_PE_udata4 = 0x03, -- DW_EH_PE_udata8 = 0x04, -- DW_EH_PE_sleb128 = 0x09, -- DW_EH_PE_sdata2 = 0x0A, -- DW_EH_PE_sdata4 = 0x0B, -- DW_EH_PE_sdata8 = 0x0C, -- DW_EH_PE_signed = 0x08, -- -- DW_EH_PE_pcrel = 0x10, -- DW_EH_PE_textrel = 0x20, -- DW_EH_PE_datarel = 0x30, -- DW_EH_PE_funcrel = 0x40, -- DW_EH_PE_aligned = 0x50, -- -- DW_EH_PE_indirect = 0x80 --} -- --version (NO_SIZE_OF_ENCODED_VALUE) {} --else --{ -- /* Given an encoding, return the number of bytes the format occupies. -- This is only defined for fixed-size encodings, and so does not -- include leb128. */ -- uint size_of_encoded_value (ubyte encoding) -- { -- if (encoding == DW_EH_PE_omit) -- return 0; -- -- final switch (encoding & 0x07) -- { -- case DW_EH_PE_absptr: -- return (void *).sizeof; -- case DW_EH_PE_udata2: -- return 2; -- case DW_EH_PE_udata4: -- return 4; -- case DW_EH_PE_udata8: -- return 8; -- } -- assert(0); -- } --} -- --version (NO_BASE_OF_ENCODED_VALUE) {} --else --{ -- /* Given an encoding and an _Unwind_Context, return the base to which -- the encoding is relative. This base may then be passed to -- read_encoded_value_with_base for use when the _Unwind_Context is -- not available. */ -- -- _Unwind_Ptr base_of_encoded_value (ubyte encoding, _Unwind_Context *context) -- { -- if (encoding == DW_EH_PE_omit) -- return cast(_Unwind_Ptr) 0; -- -- final switch (encoding & 0x70) -- { -- case DW_EH_PE_absptr: -- case DW_EH_PE_pcrel: -- case DW_EH_PE_aligned: -- return cast(_Unwind_Ptr) 0; -- -- case DW_EH_PE_textrel: -- return _Unwind_GetTextRelBase (context); -- case DW_EH_PE_datarel: -- return _Unwind_GetDataRelBase (context); -- case DW_EH_PE_funcrel: -- return _Unwind_GetRegionStart (context); -- } -- assert (0); -- } --} -- --/* Read an unsigned leb128 value from P, store the value in VAL, return -- P incremented past the value. We assume that a word is large enough to -- hold any value so encoded; if it is smaller than a pointer on some target, -- pointers should not be leb128 encoded on that target. */ -- --ubyte * --read_uleb128 (ubyte *p, _uleb128_t *val) --{ -- uint shift = 0; -- ubyte a_byte; -- _uleb128_t result; -- -- result = cast(_uleb128_t) 0; -- do -- { -- a_byte = *p++; -- result |= (cast(_uleb128_t)a_byte & 0x7f) << shift; -- shift += 7; -- } -- while (a_byte & 0x80); -- -- *val = result; -- return p; --} -- --/* Similar, but read a signed leb128 value. */ -- --ubyte * --read_sleb128 (ubyte *p, _sleb128_t *val) --{ -- uint shift = 0; -- ubyte a_byte; -- _uleb128_t result; -- -- result = cast(_uleb128_t) 0; -- do -- { -- a_byte = *p++; -- result |= (cast(_uleb128_t)a_byte & 0x7f) << shift; -- shift += 7; -- } -- while (a_byte & 0x80); -- -- /* Sign-extend a negative value. */ -- if (shift < 8 * result.sizeof && (a_byte & 0x40) != 0) -- result |= -((cast(_uleb128_t)1L) << shift); -- -- *val = cast(_sleb128_t) result; -- return p; --} -- --/* Load an encoded value from memory at P. The value is returned in VAL; -- The function returns P incremented past the value. BASE is as given -- by base_of_encoded_value for this encoding in the appropriate context. */ -- --ubyte * --read_encoded_value_with_base (ubyte encoding, _Unwind_Ptr base, -- ubyte *p, _Unwind_Ptr *val) --{ -- union unaligned -- { -- align(1): -- void *ptr; -- ushort u2; -- uint u4; -- ulong u8; -- short s2; -- int s4; -- long s8; -- } -- -- unaligned *u = cast(unaligned *) p; -- _Unwind_Internal_Ptr result; -- -- if (encoding == DW_EH_PE_aligned) -- { -- _Unwind_Internal_Ptr a = cast(_Unwind_Internal_Ptr) p; -- a = cast(_Unwind_Internal_Ptr)( (a + (void *).sizeof - 1) & - (void *).sizeof ); -- result = *cast(_Unwind_Internal_Ptr *) a; -- p = cast(ubyte *) cast(_Unwind_Internal_Ptr) (a + (void *).sizeof); -- } -- else -- { -- switch (encoding & 0x0f) -- { -- case DW_EH_PE_absptr: -- result = cast(_Unwind_Internal_Ptr) u.ptr; -- p += (void *).sizeof; -- break; -- -- case DW_EH_PE_uleb128: -- { -- _uleb128_t tmp; -- p = read_uleb128 (p, &tmp); -- result = cast(_Unwind_Internal_Ptr) tmp; -- } -- break; -- -- case DW_EH_PE_sleb128: -- { -- _sleb128_t tmp; -- p = read_sleb128 (p, &tmp); -- result = cast(_Unwind_Internal_Ptr) tmp; -- } -- break; -- -- case DW_EH_PE_udata2: -- result = cast(_Unwind_Internal_Ptr) u.u2; -- p += 2; -- break; -- case DW_EH_PE_udata4: -- result = cast(_Unwind_Internal_Ptr) u.u4; -- p += 4; -- break; -- case DW_EH_PE_udata8: -- result = cast(_Unwind_Internal_Ptr) u.u8; -- p += 8; -- break; -- -- case DW_EH_PE_sdata2: -- result = cast(_Unwind_Internal_Ptr) u.s2; -- p += 2; -- break; -- case DW_EH_PE_sdata4: -- result = cast(_Unwind_Internal_Ptr) u.s4; -- p += 4; -- break; -- case DW_EH_PE_sdata8: -- result = cast(_Unwind_Internal_Ptr) u.s8; -- p += 8; -- break; -- -- default: -- abort (); -- } -- -- if (result != 0) -- { -- result += ((encoding & 0x70) == DW_EH_PE_pcrel -- ? cast(_Unwind_Internal_Ptr) u : base); -- if (encoding & DW_EH_PE_indirect) -- result = *cast(_Unwind_Internal_Ptr *) result; -- } -- } -- -- *val = result; -- return p; --} -- --version (NO_BASE_OF_ENCODED_VALUE) {} --else --{ -- /* Like read_encoded_value_with_base, but get the base from the context -- rather than providing it directly. */ -- -- ubyte *read_encoded_value (_Unwind_Context *context, ubyte encoding, -- ubyte *p, _Unwind_Ptr *val) -- { -- return read_encoded_value_with_base (encoding, -- base_of_encoded_value (encoding, context), -- p, val); -- } --} -- ---- a/src/libphobos/libdruntime/Makefile.am 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/Makefile.am 2014-04-01 16:32:51.000000000 +0100 -@@ -22,6 +22,7 @@ ACLOCAL_AMFLAGS = -I . -I .. - OUR_CFLAGS=@DEFS@ -I ../ -I $(srcdir)/gcc -I $(srcdir)/../zlib - D_EXTRA_DFLAGS=-nostdinc -pipe -Wno-deprecated -I $(srcdir) -I ./$(host_alias) -I . - ALL_DFLAGS = $(DFLAGS) $(D_EXTRA_DFLAGS) $(MULTIFLAGS) -+IMPDIR = import - - toolexecdir = $(phobos_toolexecdir) - toolexeclibdir = $(phobos_toolexeclibdir) -@@ -33,12 +34,23 @@ SUFFIXES = .d - %.o : %.d - $(GDC) -o $@ $(ALL_DFLAGS) -c $< - --IMPORT = import --$(IMPORT): -- mkdir -p $(IMPORT) --# For core objects, generate .di headers --$(IMPORT)/%.di: %.d $(IMPORT) -- $(GDC) $(ALL_DFLAGS) -fintfc-file=$@ -fsyntax-only $< -+# Used to generate .di headers, now just copy from source.d to import/source.di -+$(IMPDIR): -+ mkdir -p $(IMPDIR) -+ mkdir -p $(IMPDIR)/core/stdc -+ mkdir -p $(IMPDIR)/core/sync -+ mkdir -p $(IMPDIR)/core/sys/freebsd/sys -+ mkdir -p $(IMPDIR)/core/sys/linux/sys -+ mkdir -p $(IMPDIR)/core/sys/osx/mach -+ mkdir -p $(IMPDIR)/core/sys/posix/arpa -+ mkdir -p $(IMPDIR)/core/sys/posix/net -+ mkdir -p $(IMPDIR)/core/sys/posix/netinet -+ mkdir -p $(IMPDIR)/core/sys/posix/sys -+ mkdir -p $(IMPDIR)/core/sys/windows -+ mkdir -p $(IMPDIR)/gcc -+ -+$(IMPDIR)/%.di: %.d $(IMPDIR) -+ cp $< $@ - - # %.o : %.c - # Use .c.o to override Automake -@@ -66,18 +78,19 @@ BASE_OBJS=object_.o - RUNTIME_OBJS=rt/aaA.o rt/aApply.o rt/aApplyR.o rt/adi.o rt/arrayassign.o \ - rt/arraybyte.o rt/arraycast.o rt/arraycat.o rt/arraydouble.o \ - rt/arrayfloat.o rt/arrayint.o rt/arrayreal.o rt/arrayshort.o \ -- rt/cast_.o rt/critical_.o rt/dmain2.o rt/minfo.o \ -- rt/memory.o rt/invariant.o rt/invariant_.o rt/lifetime.o \ -+ rt/cast_.o rt/critical_.o rt/deh.o rt/dmain2.o rt/minfo.o \ -+ rt/memory.o rt/invariant.o rt/lifetime.o \ - rt/monitor_.o rt/obj.o rt/qsort.o rt/switch_.o rt/tlsgc.o - - CORE_OBJS=core/atomic.o core/bitop.o core/cpuid.o core/demangle.o \ - core/exception.o core/math.o core/memory.o core/runtime.o \ -- core/simd.o core/thread.o core/time.o core/vararg.o \ -+ core/simd.o core/thread.o core/threadasm.o core/time.o core/vararg.o \ - core/sync/barrier.o core/sync/condition.o core/sync/config.o \ - core/sync/exception.o core/sync/mutex.o core/sync/rwmutex.o \ - core/sync/semaphore.o - --GCC_OBJS=gcc/atomics.o gcc/builtins.o gcc/deh.o gcc/unwind_pe.o -+GCC_OBJS=gcc/atomics.o gcc/backtrace.o gcc/builtins.o gcc/deh.o gcc/emutls.o \ -+ gcc/libbacktrace.o gcc/unwind/pe.o - - UTIL_OBJS=rt/util/console.o rt/util/container.o rt/util/hash.o \ - rt/util/string.o rt/util/utf.o -@@ -118,9 +131,6 @@ RT_WINDOWS_OBJS=core/sys/windows/dbghelp - core/sys/windows/stacktrace.o core/sys/windows/threadaux.o \ - core/sys/windows/windows.o - --# This should not be linked into a shared library. --CMAIN_OBJS= #rt/cmain.o -- - D_GC_MODULES=@D_GC_MODULES@ - - # Regardless of OS, all import headers are generated. -@@ -141,10 +151,15 @@ CORE_IMPORTS=core/atomic.di core/bitop.d - core/sync/semaphore.di \ - \ - core/sys/freebsd/dlfcn.di core/sys/freebsd/execinfo.di \ -- core/sys/freebsd/sys/event.di \ -+ core/sys/freebsd/sys/elf32.di core/sys/freebsd/sys/elf64.di \ -+ core/sys/freebsd/sys/elf_common.di core/sys/freebsd/sys/elf.di \ -+ core/sys/freebsd/sys/event.di core/sys/freebsd/sys/link_elf.di \ - \ -+ core/sys/linux/config.di core/sys/linux/dlfcn.di \ - core/sys/linux/elf.di core/sys/linux/epoll.di \ -- core/sys/linux/execinfo.di core/sys/linux/sys/signalfd.di \ -+ core/sys/linux/errno.di core/sys/linux/execinfo.di \ -+ core/sys/linux/link.di core/sys/linux/sys/inotify.di \ -+ core/sys/linux/sys/mman.di core/sys/linux/sys/signalfd.di \ - core/sys/linux/sys/xattr.di \ - \ - core/sys/osx/execinfo.di core/sys/osx/mach/dyld.di \ -@@ -161,31 +176,47 @@ CORE_IMPORTS=core/atomic.di core/bitop.d - core/sys/posix/pwd.di core/sys/posix/sched.di \ - core/sys/posix/semaphore.di core/sys/posix/setjmp.di \ - core/sys/posix/signal.di core/sys/posix/stdio.di \ -- core/sys/posix/stdlib.di core/sys/posix/termios.di \ -- core/sys/posix/time.di core/sys/posix/ucontext.di \ -- core/sys/posix/unistd.di core/sys/posix/utime.di \ -- core/sys/posix/net/if_.di core/sys/posix/netinet/in_.di \ -- core/sys/posix/netinet/tcp.di \ -+ core/sys/posix/stdlib.di core/sys/posix/syslog.di \ -+ core/sys/posix/termios.di core/sys/posix/time.di \ -+ core/sys/posix/ucontext.di core/sys/posix/unistd.di \ -+ core/sys/posix/utime.di core/sys/posix/net/if_.di \ -+ core/sys/posix/netinet/in_.di core/sys/posix/netinet/tcp.di \ - core/sys/posix/sys/ioctl.di core/sys/posix/sys/ipc.di \ -- core/sys/posix/sys/mman.di core/sys/posix/sys/select.di \ -- core/sys/posix/sys/shm.di core/sys/posix/sys/socket.di \ -- core/sys/posix/sys/stat.di core/sys/posix/sys/statvfs.di \ -- core/sys/posix/sys/time.di core/sys/posix/sys/types.di \ -- core/sys/posix/sys/uio.di core/sys/posix/sys/un.di \ -- core/sys/posix/sys/utsname.di core/sys/posix/sys/wait.di \ -+ core/sys/posix/sys/mman.di core/sys/posix/sys/resource.di \ -+ core/sys/posix/sys/select.di core/sys/posix/sys/shm.di \ -+ core/sys/posix/sys/socket.di core/sys/posix/sys/stat.di \ -+ core/sys/posix/sys/statvfs.di core/sys/posix/sys/time.di \ -+ core/sys/posix/sys/types.di core/sys/posix/sys/uio.di \ -+ core/sys/posix/sys/un.di core/sys/posix/sys/utsname.di \ -+ core/sys/posix/sys/wait.di \ - \ - core/sys/windows/dbghelp.di core/sys/windows/dll.di \ - core/sys/windows/stacktrace.di core/sys/windows/threadaux.di \ - core/sys/windows/windows.di - -+GCC_IMPORTS=gcc/atomics.di gcc/attribute.di gcc/backtrace.di \ -+ gcc/builtins.di gcc/libbacktrace.di -+ - ALL_DRUNTIME_OBJS = $(DRUNTIME_OBJS) $(CORE_OBJS) $(D_GC_MODULES) $(GCC_OBJS) - --libgdruntime.a : $(ALL_DRUNTIME_OBJS) $(CMAIN_OBJS) $(subst core/,$(IMPORT)/core/,$(CORE_IMPORTS)) -- $(AR) -r $@ $(ALL_DRUNTIME_OBJS) $(CMAIN_OBJS) -+libgdruntime.a : $(ALL_DRUNTIME_OBJS) \ -+ $(subst core/,$(IMPDIR)/core/,$(CORE_IMPORTS)) \ -+ $(subst gcc/,$(IMPDIR)/gcc/,$(GCC_IMPORTS)) -+if BACKTRACE_SUPPORTED -+ cp -f $(LIBBACKTRACE_LIB) $@ -+ $(AR) -q $@ $(ALL_DRUNTIME_OBJS) -+else -+ $(AR) -r $@ $(ALL_DRUNTIME_OBJS) -+endif - $(RANLIB) $@ - --libgdruntime_t.a : $(ALL_DRUNTIME_OBJS:.o=.t.o) $(CMAIN_OBJS:.o=.t.o) -- $(AR) -r $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) $(CMAIN_OBJS:.o=.t.o) -+libgdruntime_t.a : $(ALL_DRUNTIME_OBJS:.o=.t.o) -+if BACKTRACE_SUPPORTED -+ cp -f $(LIBBACKTRACE_LIB) $@ -+ $(AR) -q $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) -+else -+ $(AR) -r $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) -+endif - $(RANLIB) $@ - - unittest: libgdruntime.a libgdruntime_t.a unittest.o -@@ -200,37 +231,44 @@ install-exec-local: libgdruntime.a - $(RANLIB) $(DESTDIR)$(toolexeclibdir)/libgdruntime.a - - install-data-local: libgdruntime.a -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir) -+ for i in __entrypoint.di object.di; do \ -+ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ done - for i in core; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.di; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -- done; \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(srcdir)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in gcc; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.d; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -- done; \ -+ for i in core core/stdc core/sync core/sys/freebsd \ -+ core/sys/freebsd/sys core/sys/linux core/sys/linux/sys \ -+ core/sys/osx core/sys/osx/mach core/sys/posix \ -+ core/sys/posix/arpa core/sys/posix/net \ -+ core/sys/posix/netinet core/sys/posix/sys \ -+ core/sys/windows; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(IMPDIR)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in core core/stdc core/sync core/sys/osx/mach core/sys/posix \ -- core/sys/posix/arpa core/sys/posix/net core/sys/posix/netinet \ -- core/sys/posix/sys core/sys/windows; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR)/$$i; \ -- for f in $(IMPORT)/$$i/*.di; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR)/$$i; \ -- done; \ -+ for i in gcc; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(IMPDIR)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in object.di; do \ -- $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ for i in phobos-ver-syms; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR); \ -+ $(INSTALL_HEADER) $$i $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR); \ - done -- $(INSTALL) phobos-ver-syms $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR) - - clean-local: -- rm -f $(CMAIN_OBJS) - rm -f $(ALL_DRUNTIME_OBJS) - rm -f $(ALL_DRUNTIME_OBJS:.o=.t.o) - rm -f $(CORE_IMPORTS) -- rm -rf $(IMPORT) -+ rm -f $(GCC_IMPORTS) -+ rm -rf $(IMPDIR) - rm -f libgdruntime.a - - check-local: unittest ---- a/src/libphobos/libdruntime/Makefile.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/Makefile.in 2014-04-01 16:32:51.000000000 +0100 -@@ -73,7 +73,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(sr - $(srcdir)/phobos-ver-syms.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ -- $(top_srcdir)/configure.in -+ $(top_srcdir)/configure.ac - am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) - mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -@@ -97,6 +97,9 @@ AUTOCONF = @AUTOCONF@ - AUTOHEADER = @AUTOHEADER@ - AUTOMAKE = @AUTOMAKE@ - AWK = @AWK@ -+BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@ -+BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@ -+BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@ - BUILD_LIBIBERTY = @BUILD_LIBIBERTY@ - CC = @CC@ - CC_FOR_BUILD = @CC_FOR_BUILD@ -@@ -112,7 +115,7 @@ DCFG_CBRIDGE_STDIO = @DCFG_CBRIDGE_STDIO - DCFG_GETPWNAM_R = @DCFG_GETPWNAM_R@ - DCFG_MMAP = @DCFG_MMAP@ - DCFG_POSIX = @DCFG_POSIX@ --DCFG_SEMAPHORE_IMPL = @DCFG_SEMAPHORE_IMPL@ -+DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ - DCFG_UNIX = @DCFG_UNIX@ - DEFS = @DEFS@ - DFLAGS = @DFLAGS@ -@@ -128,12 +131,14 @@ EGREP = @EGREP@ - EXEEXT = @EXEEXT@ - GDC = @GDC@ - GREP = @GREP@ -+HAVE_DLADDR = @HAVE_DLADDR@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_SCRIPT = @INSTALL_SCRIPT@ - INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ - LDFLAGS = @LDFLAGS@ -+LIBBACKTRACE_LIB = @LIBBACKTRACE_LIB@ - LIBIBERTY_H_PATH = @LIBIBERTY_H_PATH@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ -@@ -217,26 +222,28 @@ ACLOCAL_AMFLAGS = -I . -I .. - OUR_CFLAGS = @DEFS@ -I ../ -I $(srcdir)/gcc -I $(srcdir)/../zlib - D_EXTRA_DFLAGS = -nostdinc -pipe -Wno-deprecated -I $(srcdir) -I ./$(host_alias) -I . - ALL_DFLAGS = $(DFLAGS) $(D_EXTRA_DFLAGS) $(MULTIFLAGS) -+IMPDIR = import - toolexecdir = $(phobos_toolexecdir) - toolexeclibdir = $(phobos_toolexeclibdir) - SUFFIXES = .d --IMPORT = import - BASE_OBJS = object_.o - RUNTIME_OBJS = rt/aaA.o rt/aApply.o rt/aApplyR.o rt/adi.o rt/arrayassign.o \ - rt/arraybyte.o rt/arraycast.o rt/arraycat.o rt/arraydouble.o \ - rt/arrayfloat.o rt/arrayint.o rt/arrayreal.o rt/arrayshort.o \ -- rt/cast_.o rt/critical_.o rt/dmain2.o rt/minfo.o \ -- rt/memory.o rt/invariant.o rt/invariant_.o rt/lifetime.o \ -+ rt/cast_.o rt/critical_.o rt/deh.o rt/dmain2.o rt/minfo.o \ -+ rt/memory.o rt/invariant.o rt/lifetime.o \ - rt/monitor_.o rt/obj.o rt/qsort.o rt/switch_.o rt/tlsgc.o - - CORE_OBJS = core/atomic.o core/bitop.o core/cpuid.o core/demangle.o \ - core/exception.o core/math.o core/memory.o core/runtime.o \ -- core/simd.o core/thread.o core/time.o core/vararg.o \ -+ core/simd.o core/thread.o core/threadasm.o core/time.o core/vararg.o \ - core/sync/barrier.o core/sync/condition.o core/sync/config.o \ - core/sync/exception.o core/sync/mutex.o core/sync/rwmutex.o \ - core/sync/semaphore.o - --GCC_OBJS = gcc/atomics.o gcc/builtins.o gcc/deh.o gcc/unwind_pe.o -+GCC_OBJS = gcc/atomics.o gcc/backtrace.o gcc/builtins.o gcc/deh.o gcc/emutls.o \ -+ gcc/libbacktrace.o gcc/unwind/pe.o -+ - UTIL_OBJS = rt/util/console.o rt/util/container.o rt/util/hash.o \ - rt/util/string.o rt/util/utf.o - -@@ -272,9 +279,6 @@ RT_WINDOWS_OBJS = core/sys/windows/dbghe - core/sys/windows/windows.o - - --# This should not be linked into a shared library. --CMAIN_OBJS = #rt/cmain.o -- - # Regardless of OS, all import headers are generated. - CORE_IMPORTS = core/atomic.di core/bitop.di core/cpuid.di core/demangle.di \ - core/exception.di core/math.di core/memory.di core/runtime.di \ -@@ -293,10 +297,15 @@ CORE_IMPORTS = core/atomic.di core/bitop - core/sync/semaphore.di \ - \ - core/sys/freebsd/dlfcn.di core/sys/freebsd/execinfo.di \ -- core/sys/freebsd/sys/event.di \ -+ core/sys/freebsd/sys/elf32.di core/sys/freebsd/sys/elf64.di \ -+ core/sys/freebsd/sys/elf_common.di core/sys/freebsd/sys/elf.di \ -+ core/sys/freebsd/sys/event.di core/sys/freebsd/sys/link_elf.di \ - \ -+ core/sys/linux/config.di core/sys/linux/dlfcn.di \ - core/sys/linux/elf.di core/sys/linux/epoll.di \ -- core/sys/linux/execinfo.di core/sys/linux/sys/signalfd.di \ -+ core/sys/linux/errno.di core/sys/linux/execinfo.di \ -+ core/sys/linux/link.di core/sys/linux/sys/inotify.di \ -+ core/sys/linux/sys/mman.di core/sys/linux/sys/signalfd.di \ - core/sys/linux/sys/xattr.di \ - \ - core/sys/osx/execinfo.di core/sys/osx/mach/dyld.di \ -@@ -313,23 +322,27 @@ CORE_IMPORTS = core/atomic.di core/bitop - core/sys/posix/pwd.di core/sys/posix/sched.di \ - core/sys/posix/semaphore.di core/sys/posix/setjmp.di \ - core/sys/posix/signal.di core/sys/posix/stdio.di \ -- core/sys/posix/stdlib.di core/sys/posix/termios.di \ -- core/sys/posix/time.di core/sys/posix/ucontext.di \ -- core/sys/posix/unistd.di core/sys/posix/utime.di \ -- core/sys/posix/net/if_.di core/sys/posix/netinet/in_.di \ -- core/sys/posix/netinet/tcp.di \ -+ core/sys/posix/stdlib.di core/sys/posix/syslog.di \ -+ core/sys/posix/termios.di core/sys/posix/time.di \ -+ core/sys/posix/ucontext.di core/sys/posix/unistd.di \ -+ core/sys/posix/utime.di core/sys/posix/net/if_.di \ -+ core/sys/posix/netinet/in_.di core/sys/posix/netinet/tcp.di \ - core/sys/posix/sys/ioctl.di core/sys/posix/sys/ipc.di \ -- core/sys/posix/sys/mman.di core/sys/posix/sys/select.di \ -- core/sys/posix/sys/shm.di core/sys/posix/sys/socket.di \ -- core/sys/posix/sys/stat.di core/sys/posix/sys/statvfs.di \ -- core/sys/posix/sys/time.di core/sys/posix/sys/types.di \ -- core/sys/posix/sys/uio.di core/sys/posix/sys/un.di \ -- core/sys/posix/sys/utsname.di core/sys/posix/sys/wait.di \ -+ core/sys/posix/sys/mman.di core/sys/posix/sys/resource.di \ -+ core/sys/posix/sys/select.di core/sys/posix/sys/shm.di \ -+ core/sys/posix/sys/socket.di core/sys/posix/sys/stat.di \ -+ core/sys/posix/sys/statvfs.di core/sys/posix/sys/time.di \ -+ core/sys/posix/sys/types.di core/sys/posix/sys/uio.di \ -+ core/sys/posix/sys/un.di core/sys/posix/sys/utsname.di \ -+ core/sys/posix/sys/wait.di \ - \ - core/sys/windows/dbghelp.di core/sys/windows/dll.di \ - core/sys/windows/stacktrace.di core/sys/windows/threadaux.di \ - core/sys/windows/windows.di - -+GCC_IMPORTS = gcc/atomics.di gcc/attribute.di gcc/backtrace.di \ -+ gcc/builtins.di gcc/libbacktrace.di -+ - ALL_DRUNTIME_OBJS = $(DRUNTIME_OBJS) $(CORE_OBJS) $(D_GC_MODULES) $(GCC_OBJS) - - # Work around what appears to be a GNU make bug handling MAKEFLAGS -@@ -569,11 +582,24 @@ all-local: libgdruntime.a - - %.o : %.d - $(GDC) -o $@ $(ALL_DFLAGS) -c $< --$(IMPORT): -- mkdir -p $(IMPORT) --# For core objects, generate .di headers --$(IMPORT)/%.di: %.d $(IMPORT) -- $(GDC) $(ALL_DFLAGS) -fintfc-file=$@ -fsyntax-only $< -+ -+# Used to generate .di headers, now just copy from source.d to import/source.di -+$(IMPDIR): -+ mkdir -p $(IMPDIR) -+ mkdir -p $(IMPDIR)/core/stdc -+ mkdir -p $(IMPDIR)/core/sync -+ mkdir -p $(IMPDIR)/core/sys/freebsd/sys -+ mkdir -p $(IMPDIR)/core/sys/linux/sys -+ mkdir -p $(IMPDIR)/core/sys/osx/mach -+ mkdir -p $(IMPDIR)/core/sys/posix/arpa -+ mkdir -p $(IMPDIR)/core/sys/posix/net -+ mkdir -p $(IMPDIR)/core/sys/posix/netinet -+ mkdir -p $(IMPDIR)/core/sys/posix/sys -+ mkdir -p $(IMPDIR)/core/sys/windows -+ mkdir -p $(IMPDIR)/gcc -+ -+$(IMPDIR)/%.di: %.d $(IMPDIR) -+ cp $< $@ - - # %.o : %.c - # Use .c.o to override Automake -@@ -595,12 +621,18 @@ $(IMPORT)/%.di: %.d $(IMPORT) - gcc/cbridge_math.o: gcc/cbridge_math.c - $(CC) -o $@ $(OUR_CFLAGS) $(CFLAGS) -fno-strict-aliasing -c $< - --libgdruntime.a : $(ALL_DRUNTIME_OBJS) $(CMAIN_OBJS) $(subst core/,$(IMPORT)/core/,$(CORE_IMPORTS)) -- $(AR) -r $@ $(ALL_DRUNTIME_OBJS) $(CMAIN_OBJS) -+libgdruntime.a : $(ALL_DRUNTIME_OBJS) \ -+ $(subst core/,$(IMPDIR)/core/,$(CORE_IMPORTS)) \ -+ $(subst gcc/,$(IMPDIR)/gcc/,$(GCC_IMPORTS)) -+@BACKTRACE_SUPPORTED_TRUE@ cp -f $(LIBBACKTRACE_LIB) $@ -+@BACKTRACE_SUPPORTED_TRUE@ $(AR) -q $@ $(ALL_DRUNTIME_OBJS) -+@BACKTRACE_SUPPORTED_FALSE@ $(AR) -r $@ $(ALL_DRUNTIME_OBJS) - $(RANLIB) $@ - --libgdruntime_t.a : $(ALL_DRUNTIME_OBJS:.o=.t.o) $(CMAIN_OBJS:.o=.t.o) -- $(AR) -r $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) $(CMAIN_OBJS:.o=.t.o) -+libgdruntime_t.a : $(ALL_DRUNTIME_OBJS:.o=.t.o) -+@BACKTRACE_SUPPORTED_TRUE@ cp -f $(LIBBACKTRACE_LIB) $@ -+@BACKTRACE_SUPPORTED_TRUE@ $(AR) -q $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) -+@BACKTRACE_SUPPORTED_FALSE@ $(AR) -r $@ $(ALL_DRUNTIME_OBJS:.o=.t.o) - $(RANLIB) $@ - - unittest: libgdruntime.a libgdruntime_t.a unittest.o -@@ -615,37 +647,44 @@ install-exec-local: libgdruntime.a - $(RANLIB) $(DESTDIR)$(toolexeclibdir)/libgdruntime.a - - install-data-local: libgdruntime.a -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir) -+ for i in __entrypoint.di object.di; do \ -+ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ done - for i in core; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.di; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -- done; \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(srcdir)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in gcc; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.d; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -- done; \ -+ for i in core core/stdc core/sync core/sys/freebsd \ -+ core/sys/freebsd/sys core/sys/linux core/sys/linux/sys \ -+ core/sys/osx core/sys/osx/mach core/sys/posix \ -+ core/sys/posix/arpa core/sys/posix/net \ -+ core/sys/posix/netinet core/sys/posix/sys \ -+ core/sys/windows; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(IMPDIR)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in core core/stdc core/sync core/sys/osx/mach core/sys/posix \ -- core/sys/posix/arpa core/sys/posix/net core/sys/posix/netinet \ -- core/sys/posix/sys core/sys/windows; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR)/$$i; \ -- for f in $(IMPORT)/$$i/*.di; do \ -- $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR)/$$i; \ -- done; \ -+ for i in gcc; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(IMPDIR)/$$i/*.di; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done -- for i in object.di; do \ -- $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ for i in phobos-ver-syms; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR); \ -+ $(INSTALL_HEADER) $$i $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR); \ - done -- $(INSTALL) phobos-ver-syms $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR) - - clean-local: -- rm -f $(CMAIN_OBJS) - rm -f $(ALL_DRUNTIME_OBJS) - rm -f $(ALL_DRUNTIME_OBJS:.o=.t.o) - rm -f $(CORE_IMPORTS) -- rm -rf $(IMPORT) -+ rm -f $(GCC_IMPORTS) -+ rm -rf $(IMPDIR) - rm -f libgdruntime.a - - check-local: unittest ---- a/src/libphobos/libdruntime/object_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/object_.d 2014-04-01 16:32:51.000000000 +0100 -@@ -117,18 +117,6 @@ class Object - return this is o; - } - -- bool opEquals(Object lhs, Object rhs) -- { -- if (lhs is rhs) -- return true; -- if (lhs is null || rhs is null) -- return false; -- if (typeid(lhs) == typeid(rhs)) -- return lhs.opEquals(rhs); -- return lhs.opEquals(rhs) && -- rhs.opEquals(lhs); -- } -- - interface Monitor - { - void lock(); -@@ -178,32 +166,6 @@ bool opEquals(Object lhs, Object rhs) - return lhs.opEquals(rhs) && rhs.opEquals(lhs); - } - --bool opEquals(TypeInfo lhs, TypeInfo rhs) --{ -- // If aliased to the same object or both null => equal -- if (lhs is rhs) return true; -- -- // If either is null => non-equal -- if (lhs is null || rhs is null) return false; -- -- // If same exact type => one call to method opEquals -- if (typeid(lhs) == typeid(rhs)) return lhs.opEquals(rhs); -- -- //printf("%.*s and %.*s, %d %d\n", lhs.toString(), rhs.toString(), lhs.opEquals(rhs), rhs.opEquals(lhs)); -- -- // Factor out top level const -- // (This still isn't right, should follow same rules as compiler does for type equality.) -- TypeInfo_Const c = cast(TypeInfo_Const) lhs; -- if (c) -- lhs = c.base; -- c = cast(TypeInfo_Const) rhs; -- if (c) -- rhs = c.base; -- -- // General case => symmetric calls to method opEquals -- return lhs.opEquals(rhs) && rhs.opEquals(lhs); --} -- - /** - * Information about an interface. - * When an object is accessed via an interface, an Interface* appears as the -@@ -213,7 +175,7 @@ struct Interface - { - TypeInfo_Class classinfo; /// .classinfo for this interface (not for containing class) - void*[] vtbl; -- ptrdiff_t offset; /// offset to Interface 'this' from Object 'this' -+ size_t offset; /// offset to Interface 'this' from Object 'this' - } - - /** -@@ -310,7 +272,7 @@ class TypeInfo - - /// Get TypeInfo for 'next' type, as defined by what kind of type this is, - /// null if none. -- @property const(TypeInfo) next() nothrow pure const { return null; } -+ @property inout(TypeInfo) next() nothrow pure inout { return null; } - - /// Return default initializer. If the type should be initialized to all zeros, - /// an array with a null ptr and a length equal to the type size will be returned. -@@ -345,38 +307,6 @@ class TypeInfo - @property immutable(void)* rtInfo() nothrow pure const @safe { return null; } - } - --class TypeInfo_Vector : TypeInfo --{ -- override string toString() const { return "__vector(" ~ base.toString() ~ ")"; } -- -- override bool opEquals(Object o) -- { -- if (this is o) -- return true; -- auto c = cast(const TypeInfo_Vector)o; -- return c && this.base == c.base; -- } -- -- override size_t getHash(in void* p) const { return base.getHash(p); } -- override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); } -- override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); } -- override @property size_t tsize() nothrow pure const { return base.tsize; } -- override void swap(void* p1, void* p2) const { return base.swap(p1, p2); } -- -- override @property const(TypeInfo) next() nothrow pure const { return base.next; } -- override @property uint flags() nothrow pure const { return base.flags; } -- override const(void)[] init() nothrow pure const { return base.init(); } -- -- override @property size_t talign() nothrow pure const { return 16; } -- -- version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2) -- { -- return base.argTypes(arg1, arg2); -- } -- -- TypeInfo base; --} -- - class TypeInfo_Typedef : TypeInfo - { - override string toString() const { return name; } -@@ -396,7 +326,7 @@ class TypeInfo_Typedef : TypeInfo - override @property size_t tsize() nothrow pure const { return base.tsize; } - override void swap(void* p1, void* p2) const { return base.swap(p1, p2); } - -- override @property const(TypeInfo) next() nothrow pure const { return base.next; } -+ override @property inout(TypeInfo) next() nothrow pure inout { return base.next; } - override @property uint flags() nothrow pure const { return base.flags; } - override const(void)[] init() nothrow pure const @safe { return m_init.length ? m_init : base.init(); } - -@@ -463,7 +393,7 @@ class TypeInfo_Pointer : TypeInfo - *cast(void**)p2 = tmp; - } - -- override @property const(TypeInfo) next() nothrow pure const { return m_next; } -+ override @property inout(TypeInfo) next() nothrow pure inout { return m_next; } - override @property uint flags() nothrow pure const { return 1; } - - TypeInfo m_next; -@@ -534,7 +464,7 @@ class TypeInfo_Array : TypeInfo - - TypeInfo value; - -- override @property const(TypeInfo) next() nothrow pure const -+ override @property inout(TypeInfo) next() nothrow pure inout - { - return value; - } -@@ -634,7 +564,7 @@ class TypeInfo_StaticArray : TypeInfo - } - - override const(void)[] init() nothrow pure const { return value.init(); } -- override @property const(TypeInfo) next() nothrow pure const { return value; } -+ override @property inout(TypeInfo) next() nothrow pure inout { return value; } - override @property uint flags() nothrow pure const { return value.flags; } - - override void destroy(void* p) const -@@ -689,6 +619,11 @@ class TypeInfo_AssociativeArray : TypeIn - this.value == c.value; - } - -+ override bool equals(in void* p1, in void* p2) @trusted const -+ { -+ return !!_aaEqual(this, *cast(const void**) p1, *cast(const void**) p2); -+ } -+ - override hash_t getHash(in void* p) nothrow @trusted const - { - return _aaGetHash(cast(void*)p, this); -@@ -701,7 +636,7 @@ class TypeInfo_AssociativeArray : TypeIn - return (char[int]).sizeof; - } - -- override @property const(TypeInfo) next() nothrow pure const { return value; } -+ override @property inout(TypeInfo) next() nothrow pure inout { return value; } - override @property uint flags() nothrow pure const { return 1; } - - TypeInfo value; -@@ -721,6 +656,38 @@ class TypeInfo_AssociativeArray : TypeIn - } - } - -+class TypeInfo_Vector : TypeInfo -+{ -+ override string toString() const { return "__vector(" ~ base.toString() ~ ")"; } -+ -+ override bool opEquals(Object o) -+ { -+ if (this is o) -+ return true; -+ auto c = cast(const TypeInfo_Vector)o; -+ return c && this.base == c.base; -+ } -+ -+ override size_t getHash(in void* p) const { return base.getHash(p); } -+ override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); } -+ override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); } -+ override @property size_t tsize() nothrow pure const { return base.tsize; } -+ override void swap(void* p1, void* p2) const { return base.swap(p1, p2); } -+ -+ override @property inout(TypeInfo) next() nothrow pure inout { return base.next; } -+ override @property uint flags() nothrow pure const { return base.flags; } -+ override const(void)[] init() nothrow pure const { return base.init(); } -+ -+ override @property size_t talign() nothrow pure const { return 16; } -+ -+ version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2) -+ { -+ return base.argTypes(arg1, arg2); -+ } -+ -+ TypeInfo base; -+} -+ - class TypeInfo_Function : TypeInfo - { - override string toString() const -@@ -866,14 +833,18 @@ class TypeInfo_Class : TypeInfo - TypeInfo_Class base; /// base class - void* destructor; - void function(Object) classInvariant; -- uint m_flags; -- // 1: // is IUnknown or is derived from IUnknown -- // 2: // has no possible pointers into GC memory -- // 4: // has offTi[] member -- // 8: // has constructors -- // 16: // has xgetMembers member -- // 32: // has typeinfo member -- // 64: // is not constructable -+ enum ClassFlags : uint -+ { -+ isCOMclass = 0x1, -+ noPointers = 0x2, -+ hasOffTi = 0x4, -+ hasCtor = 0x8, -+ hasGetMembers = 0x10, -+ hasTypeInfo = 0x20, -+ isAbstract = 0x40, -+ isCPPclass = 0x80, -+ } -+ ClassFlags m_flags; - void* deallocator; - OffsetTypeInfo[] m_offTi; - void function(Object) defaultConstructor; // default Constructor -@@ -1092,7 +1063,11 @@ class TypeInfo_Struct : TypeInfo - int function(in void*, in void*) xopCmp; - char[] function(in void*) xtoString; - -- uint m_flags; -+ enum StructFlags : uint -+ { -+ hasPointers = 0x1, -+ } -+ StructFlags m_flags; - } - void function(void*) xdtor; - void function(void*) xpostblit; -@@ -1235,7 +1210,7 @@ class TypeInfo_Const : TypeInfo - override @property size_t tsize() nothrow pure const { return base.tsize; } - override void swap(void *p1, void *p2) const { return base.swap(p1, p2); } - -- override @property const(TypeInfo) next() nothrow pure const { return base.next; } -+ override @property inout(TypeInfo) next() nothrow pure inout { return base.next; } - override @property uint flags() nothrow pure const { return base.flags; } - override const(void)[] init() nothrow pure const { return base.init(); } - -@@ -1575,9 +1550,9 @@ unittest - - enum - { -- MIctorstart = 1, // we've started constructing it -- MIctordone = 2, // finished construction -- MIstandalone = 4, // module ctor does not depend on other module -+ MIctorstart = 0x1, // we've started constructing it -+ MIctordone = 0x2, // finished construction -+ MIstandalone = 0x4, // module ctor does not depend on other module - // ctors being done first - MItlsctor = 8, - MItlsdtor = 0x10, -@@ -1588,307 +1563,147 @@ enum - MIunitTest = 0x200, - MIimportedModules = 0x400, - MIlocalClasses = 0x800, -- MInew = 0x80000000 // it's the "new" layout -+ MIname = 0x1000, - } - - - struct ModuleInfo - { -- struct New -- { -- uint flags; -- uint index; // index into _moduleinfo_array[] -+ uint _flags; -+ uint _index; // index into _moduleinfo_array[] - -- /* Order of appearance, depending on flags -- * tlsctor -- * tlsdtor -- * xgetMembers -- * ctor -- * dtor -- * ictor -- * importedModules -- * localClasses -- * name -- */ -- } -- struct Old -+ private void* addrOf(int flag) nothrow pure -+ in - { -- string name; -- ModuleInfo*[] importedModules; -- TypeInfo_Class[] localClasses; -- uint flags; -- -- void function() ctor; // module shared static constructor (order dependent) -- void function() dtor; // module shared static destructor -- void function() unitTest; // module unit tests -- -- void* xgetMembers; // module getMembers() function -- -- void function() ictor; // module shared static constructor (order independent) -- -- void function() tlsctor; // module thread local static constructor (order dependent) -- void function() tlsdtor; // module thread local static destructor -- -- uint index; // index into _moduleinfo_array[] -- -- void*[1] reserved; // for future expansion -+ assert(flag >= MItlsctor && flag <= MIname); -+ assert(!(flag & (flag - 1)) && !(flag & ~(flag - 1) << 1)); - } -- -- union -+ body - { -- New n; -- Old o; -- } -+ void* p = cast(void*)&this + ModuleInfo.sizeof; - -- @property bool isNew() nothrow pure { return (n.flags & MInew) != 0; } -+ if (flags & MItlsctor) -+ { -+ if (flag == MItlsctor) return p; -+ p += typeof(tlsctor).sizeof; -+ } -+ if (flags & MItlsdtor) -+ { -+ if (flag == MItlsdtor) return p; -+ p += typeof(tlsdtor).sizeof; -+ } -+ if (flags & MIctor) -+ { -+ if (flag == MIctor) return p; -+ p += typeof(ctor).sizeof; -+ } -+ if (flags & MIdtor) -+ { -+ if (flag == MIdtor) return p; -+ p += typeof(dtor).sizeof; -+ } -+ if (flags & MIxgetMembers) -+ { -+ if (flag == MIxgetMembers) return p; -+ p += typeof(xgetMembers).sizeof; -+ } -+ if (flags & MIictor) -+ { -+ if (flag == MIictor) return p; -+ p += typeof(ictor).sizeof; -+ } -+ if (flags & MIunitTest) -+ { -+ if (flag == MIunitTest) return p; -+ p += typeof(unitTest).sizeof; -+ } -+ if (flags & MIimportedModules) -+ { -+ if (flag == MIimportedModules) return p; -+ p += size_t.sizeof + *cast(size_t*)p * typeof(importedModules[0]).sizeof; -+ } -+ if (flags & MIlocalClasses) -+ { -+ if (flag == MIlocalClasses) return p; -+ p += size_t.sizeof + *cast(size_t*)p * typeof(localClasses[0]).sizeof; -+ } -+ if (true || flags & MIname) // always available for now -+ { -+ if (flag == MIname) return p; -+ p += .strlen(cast(immutable char*)p); -+ } -+ assert(0); -+ } - -- @property uint index() nothrow pure { return isNew ? n.index : o.index; } -- @property void index(uint i) nothrow pure { if (isNew) n.index = i; else o.index = i; } -+ @property uint index() nothrow pure { return _index; } -+ @property void index(uint i) nothrow pure { _index = i; } - -- @property uint flags() nothrow pure { return isNew ? n.flags : o.flags; } -- @property void flags(uint f) nothrow pure { if (isNew) n.flags = f; else o.flags = f; } -+ @property uint flags() nothrow pure { return _flags; } -+ @property void flags(uint f) nothrow pure { _flags = f; } - - @property void function() tlsctor() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MItlsctor) -- { -- size_t off = New.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- else -- return o.tlsctor; -+ return flags & MItlsctor ? *cast(typeof(return)*)addrOf(MItlsctor) : null; - } - - @property void function() tlsdtor() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MItlsdtor) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- else -- return o.tlsdtor; -+ return flags & MItlsdtor ? *cast(typeof(return)*)addrOf(MItlsdtor) : null; - } - - @property void* xgetMembers() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MIxgetMembers) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- return o.xgetMembers; -+ return flags & MIxgetMembers ? *cast(typeof(return)*)addrOf(MIxgetMembers) : null; - } - - @property void function() ctor() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MIctor) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- return o.ctor; -+ return flags & MIctor ? *cast(typeof(return)*)addrOf(MIctor) : null; - } - - @property void function() dtor() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MIdtor) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- return o.ctor; -+ return flags & MIdtor ? *cast(typeof(return)*)addrOf(MIdtor) : null; - } - - @property void function() ictor() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MIictor) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- if (n.flags & MIdtor) -- off += o.ctor.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- return o.ictor; -+ return flags & MIictor ? *cast(typeof(return)*)addrOf(MIictor) : null; - } - - @property void function() unitTest() nothrow pure - { -- if (isNew) -- { -- if (n.flags & MIunitTest) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- if (n.flags & MIdtor) -- off += o.ctor.sizeof; -- if (n.flags & MIictor) -- off += o.ictor.sizeof; -- return *cast(typeof(return)*)(cast(void*)(&this) + off); -- } -- return null; -- } -- return o.unitTest; -+ return flags & MIunitTest ? *cast(typeof(return)*)addrOf(MIunitTest) : null; - } - - @property ModuleInfo*[] importedModules() nothrow pure - { -- if (isNew) -+ if (flags & MIimportedModules) - { -- if (n.flags & MIimportedModules) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- if (n.flags & MIdtor) -- off += o.ctor.sizeof; -- if (n.flags & MIictor) -- off += o.ictor.sizeof; -- if (n.flags & MIunitTest) -- off += o.unitTest.sizeof; -- auto plength = cast(size_t*)(cast(void*)(&this) + off); -- ModuleInfo** pm = cast(ModuleInfo**)(plength + 1); -- return pm[0 .. *plength]; -- } -- return null; -+ auto p = cast(size_t*)addrOf(MIimportedModules); -+ return (cast(ModuleInfo**)(p + 1))[0 .. *p]; - } -- return o.importedModules; -+ return null; - } - - @property TypeInfo_Class[] localClasses() nothrow pure - { -- if (isNew) -+ if (flags & MIlocalClasses) - { -- if (n.flags & MIlocalClasses) -- { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- if (n.flags & MIdtor) -- off += o.ctor.sizeof; -- if (n.flags & MIictor) -- off += o.ictor.sizeof; -- if (n.flags & MIunitTest) -- off += o.unitTest.sizeof; -- if (n.flags & MIimportedModules) -- { -- auto plength = cast(size_t*)(cast(void*)(&this) + off); -- off += size_t.sizeof + *plength * plength.sizeof; -- } -- auto plength = cast(size_t*)(cast(void*)(&this) + off); -- TypeInfo_Class* pt = cast(TypeInfo_Class*)(plength + 1); -- return pt[0 .. *plength]; -- } -- return null; -+ auto p = cast(size_t*)addrOf(MIlocalClasses); -+ return (cast(TypeInfo_Class*)(p + 1))[0 .. *p]; - } -- return o.localClasses; -+ return null; - } - - @property string name() nothrow pure - { -- if (isNew) -+ if (true || flags & MIname) // always available for now - { -- size_t off = New.sizeof; -- if (n.flags & MItlsctor) -- off += o.tlsctor.sizeof; -- if (n.flags & MItlsdtor) -- off += o.tlsdtor.sizeof; -- if (n.flags & MIxgetMembers) -- off += o.xgetMembers.sizeof; -- if (n.flags & MIctor) -- off += o.ctor.sizeof; -- if (n.flags & MIdtor) -- off += o.ctor.sizeof; -- if (n.flags & MIictor) -- off += o.ictor.sizeof; -- if (n.flags & MIunitTest) -- off += o.unitTest.sizeof; -- if (n.flags & MIimportedModules) -- { -- auto plength = cast(size_t*)(cast(void*)(&this) + off); -- off += size_t.sizeof + *plength * plength.sizeof; -- } -- if (n.flags & MIlocalClasses) -- { -- auto plength = cast(size_t*)(cast(void*)(&this) + off); -- off += size_t.sizeof + *plength * plength.sizeof; -- } -- auto p = cast(immutable(char)*)(cast(void*)(&this) + off); -- auto len = strlen(p); -- return p[0 .. len]; -+ auto p = cast(immutable char*)addrOf(MIname); -+ return p[0 .. .strlen(p)]; - } -- return o.name; -+ // return null; - } - - alias int delegate(ref ModuleInfo*) ApplyDg; -@@ -2101,16 +1916,14 @@ extern (C) void rt_detachDisposeEvent(Ob - - extern (C) - { -- // from druntime/compiler/gdc/rt/aaA.d -+ // from druntime/rt/aaA.d - -- size_t _aaLen(void* p); -- void* _aaGetX(void** pp, TypeInfo keyti, size_t valuesize, void* pkey); -- void* _aaGetRvalueX(void* p, TypeInfo keyti, size_t valuesize, void* pkey); -- void* _aaInX(void* p, TypeInfo keyti, void* pkey); -- bool _aaDelX(void* p, TypeInfo keyti, void* pkey); -- void[] _aaValues(void* p, size_t keysize, size_t valuesize); -- void[] _aaKeys(void* p, size_t keysize); -- void* _aaRehash(void** pp, TypeInfo keyti); -+ size_t _aaLen(in void* p) pure nothrow; -+ void* _aaGetX(void** pp, const TypeInfo keyti, in size_t valuesize, in void* pkey); -+ inout(void)* _aaGetRvalueX(inout void* p, in TypeInfo keyti, in size_t valuesize, in void* pkey); -+ inout(void)[] _aaValues(inout void* p, in size_t keysize, in size_t valuesize) pure nothrow; -+ inout(void)[] _aaKeys(inout void* p, in size_t keysize) pure nothrow; -+ void* _aaRehash(void** pp, in TypeInfo keyti) pure nothrow; - - extern (D) alias scope int delegate(void *) _dg_t; - int _aaApply(void* aa, size_t keysize, _dg_t dg); -@@ -2118,106 +1931,68 @@ extern (C) - extern (D) alias scope int delegate(void *, void *) _dg2_t; - int _aaApply2(void* aa, size_t keysize, _dg2_t dg); - -- void* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values); -- hash_t _aaGetHash(void* aa, const(TypeInfo) tiRaw) nothrow; -+ private struct AARange { void* impl, current; } -+ AARange _aaRange(void* aa); -+ bool _aaRangeEmpty(AARange r); -+ void* _aaRangeFrontKey(AARange r); -+ void* _aaRangeFrontValue(AARange r); -+ void _aaRangePopFront(ref AARange r); -+ -+ int _aaEqual(in TypeInfo tiRaw, in void* e1, in void* e2); -+ hash_t _aaGetHash(in void* aa, in TypeInfo tiRaw) nothrow; -+} -+ -+private template _Unqual(T) -+{ -+ static if (is(T U == shared(const U))) alias U _Unqual; -+ else static if (is(T U == const U )) alias U _Unqual; -+ else static if (is(T U == immutable U )) alias U _Unqual; -+ else static if (is(T U == inout U )) alias U _Unqual; -+ else static if (is(T U == shared U )) alias U _Unqual; -+ else alias T _Unqual; - } - - struct AssociativeArray(Key, Value) - { - private: -- // Duplicates of the stuff found in druntime/src/rt/aaA.d -- struct Slot -- { -- Slot *next; -- size_t hash; -- Key key; -- version(D_LP64) align(16) Value value; // c.f. rt/aaA.d, aligntsize() -- else align(4) Value value; -+ void* p; - -- // Stop creating built-in opAssign -- @disable void opAssign(Slot); -- } -+public: -+ @property size_t length() const { return _aaLen(p); } - -- struct Hashtable -+ Value[Key] rehash() - { -- Slot*[] b; -- size_t nodes; -- TypeInfo keyti; -- Slot*[4] binit; -+ auto p = _aaRehash(cast(void**) &p, typeid(Value[Key])); -+ return *cast(Value[Key]*)(&p); - } - -- void* p; // really Hashtable* -+ // Note: can't make `values` and `keys` inout as it is used -+ // e.g. in Phobos like `ReturnType!(aa.keys)` instead of `typeof(aa.keys)` -+ // which will result in `inout` propagation. - -- struct Range -+ inout(Value)[] inout_values() inout @property - { -- // State -- Slot*[] slots; -- Slot* current; -- -- this(void * aa) -- { -- if (!aa) return; -- auto pImpl = cast(Hashtable*) aa; -- slots = pImpl.b; -- nextSlot(); -- } -- -- void nextSlot() -- { -- foreach (i, slot; slots) -- { -- if (!slot) continue; -- current = slot; -- slots = slots.ptr[i .. slots.length]; -- break; -- } -- } -- -- public: -- @property bool empty() const -- { -- return current is null; -- } -- -- @property ref inout(Slot) front() inout -- { -- assert(current); -- return *current; -- } -- -- void popFront() -- { -- assert(current); -- current = current.next; -- if (!current) -- { -- slots = slots[1 .. $]; -- nextSlot(); -- } -- } -+ auto a = _aaValues(p, Key.sizeof, Value.sizeof); -+ return *cast(inout Value[]*) &a; - } - --public: -- -- @property size_t length() { return _aaLen(p); } -- -- Value[Key] rehash() @property -+ inout(Key)[] inout_keys() inout @property - { -- auto p = _aaRehash(&p, typeid(Value[Key])); -- return *cast(Value[Key]*)(&p); -+ auto a = _aaKeys(p, Key.sizeof); -+ return *cast(inout Key[]*) &a; - } - - Value[] values() @property -- { -- auto a = _aaValues(p, Key.sizeof, Value.sizeof); -- return *cast(Value[]*) &a; -- } -+ { return inout_values; } - - Key[] keys() @property -- { -- auto a = _aaKeys(p, Key.sizeof); -- return *cast(Key[]*) &a; -- } -+ { return inout_keys; } -+ -+ const(Value)[] values() const @property -+ { return inout_values; } -+ -+ const(Key)[] keys() const @property -+ { return inout_keys; } - - int opApply(scope int delegate(ref Key, ref Value) dg) - { -@@ -2235,8 +2010,13 @@ public: - return p ? *p : defaultValue; - } - -- static if (is(typeof({ Value[Key] r; r[Key.init] = Value.init; }()))) -- @property Value[Key] dup() -+ static if (is(typeof({ -+ ref Value get(); // pseudo lvalue of Value -+ Value[Key] r; r[Key.init] = get(); -+ // bug 10720 - check whether Value is copyable -+ }))) -+ { -+ Value[Key] dup() - { - Value[Key] result; - foreach (k, v; this) -@@ -2245,49 +2025,38 @@ public: - } - return result; - } -+ } -+ else -+ @disable Value[Key] dup(); // for better error message - -- @property auto byKey() -+ auto byKey() - { - static struct Result - { -- Range state; -+ AARange r; - -- this(void* p) -- { -- state = Range(p); -- } -- -- @property ref Key front() -- { -- return state.front.key; -- } -- -- alias state this; -+ @property bool empty() { return _aaRangeEmpty(r); } -+ @property ref Key front() { return *cast(Key*)_aaRangeFrontKey(r); } -+ void popFront() { _aaRangePopFront(r); } -+ Result save() { return this; } - } - -- return Result(p); -+ return Result(_aaRange(p)); - } - -- @property auto byValue() -+ auto byValue() - { - static struct Result - { -- Range state; -+ AARange r; - -- this(void* p) -- { -- state = Range(p); -- } -- -- @property ref Value front() -- { -- return state.front.value; -- } -- -- alias state this; -+ @property bool empty() { return _aaRangeEmpty(r); } -+ @property ref Value front() { return *cast(Value*)_aaRangeFrontValue(r); } -+ void popFront() { _aaRangePopFront(r); } -+ Result save() { return this; } - } - -- return Result(p); -+ return Result(_aaRange(p)); - } - } - -@@ -2360,8 +2129,123 @@ unittest - assert(aa4.byValue.front == "onetwothreefourfive"); - } - --// Scheduled for deprecation in December 2012. --// Please use destroy instead of clear. -+unittest -+{ -+ // test for bug 10720 -+ static struct NC -+ { -+ @disable this(this) { } -+ } -+ -+ NC[string] aa; -+ static assert(!is(aa.nonExistingField)); -+} -+ -+unittest -+{ -+ // bug 5842 -+ string[string] test = null; -+ test["test1"] = "test1"; -+ test.remove("test1"); -+ test.rehash; -+ test["test3"] = "test3"; // causes divide by zero if rehash broke the AA -+} -+ -+unittest -+{ -+ string[] keys = ["a", "b", "c", "d", "e", "f"]; -+ -+ // Test forward range capabilities of byKey -+ { -+ int[string] aa; -+ foreach (key; keys) -+ aa[key] = 0; -+ -+ auto keyRange = aa.byKey(); -+ auto savedKeyRange = keyRange.save; -+ -+ // Consume key range once -+ size_t keyCount = 0; -+ while (!keyRange.empty) -+ { -+ aa[keyRange.front]++; -+ keyCount++; -+ keyRange.popFront(); -+ } -+ -+ foreach (key; keys) -+ { -+ assert(aa[key] == 1); -+ } -+ assert(keyCount == keys.length); -+ -+ // Verify it's possible to iterate the range the second time -+ keyCount = 0; -+ while (!savedKeyRange.empty) -+ { -+ aa[savedKeyRange.front]++; -+ keyCount++; -+ savedKeyRange.popFront(); -+ } -+ -+ foreach (key; keys) -+ { -+ assert(aa[key] == 2); -+ } -+ assert(keyCount == keys.length); -+ } -+ -+ // Test forward range capabilities of byValue -+ { -+ size_t[string] aa; -+ foreach (i; 0 .. keys.length) -+ { -+ aa[keys[i]] = i; -+ } -+ -+ auto valRange = aa.byValue(); -+ auto savedValRange = valRange.save; -+ -+ // Consume value range once -+ int[] hasSeen; -+ hasSeen.length = keys.length; -+ while (!valRange.empty) -+ { -+ assert(hasSeen[valRange.front] == 0); -+ hasSeen[valRange.front]++; -+ valRange.popFront(); -+ } -+ -+ foreach (sawValue; hasSeen) { assert(sawValue == 1); } -+ -+ // Verify it's possible to iterate the range the second time -+ hasSeen = null; -+ hasSeen.length = keys.length; -+ while (!savedValRange.empty) -+ { -+ assert(!hasSeen[savedValRange.front]); -+ hasSeen[savedValRange.front] = true; -+ savedValRange.popFront(); -+ } -+ -+ foreach (sawValue; hasSeen) { assert(sawValue); } -+ } -+} -+ -+unittest -+{ -+ // expanded test for 5842: increase AA size past the point where the AA -+ // stops using binit, in order to test another code path in rehash. -+ int[int] aa; -+ foreach (int i; 0 .. 32) -+ aa[i] = i; -+ foreach (int i; 0 .. 32) -+ aa.remove(i); -+ aa.rehash; -+ aa[1] = 1; -+} -+ -+deprecated("Please use destroy instead of clear.") - alias destroy clear; - - /++ -@@ -2485,9 +2369,9 @@ version(unittest) unittest - } - } - --void destroy(T : U[n], U, size_t n)(ref T obj) -+void destroy(T : U[n], U, size_t n)(ref T obj) if (!is(T == struct)) - { -- obj = T.init; -+ obj[] = U.init; - } - - version(unittest) unittest -@@ -2499,6 +2383,18 @@ version(unittest) unittest - assert(a == [ 0, 0 ]); - } - -+unittest -+{ -+ static struct vec2f { -+ float[2] values; -+ alias values this; -+ } -+ -+ vec2f v; -+ destroy!vec2f(v); -+} -+ -+ - void destroy(T)(ref T obj) - if (!is(T == struct) && !is(T == interface) && !is(T == class) && !_isStaticArray!T) - { -@@ -2538,63 +2434,159 @@ version (unittest) - } - - /** -- * (Property) Get the current capacity of an array. The capacity is the number -- * of elements that the array can grow to before the array must be -- * extended/reallocated. -+ * (Property) Get the current capacity of a slice. The capacity is the size -+ * that the slice can grow to before the underlying array must be -+ * reallocated or extended. -+ * -+ * If an append must reallocate a slice with no possibility of extension, then -+ * 0 is returned. This happens when the slice references a static array, or -+ * if another slice references elements past the end of the current slice. -+ * -+ * Note: The capacity of a slice may be impacted by operations on other slices. - */ - @property size_t capacity(T)(T[] arr) pure nothrow - { - return _d_arraysetcapacity(typeid(T[]), 0, cast(void *)&arr); - } -+/// -+unittest -+{ -+ //Static array slice: no capacity -+ int[4] sarray = [1, 2, 3, 4]; -+ int[] slice = sarray[]; -+ assert(sarray.capacity == 0); -+ //Appending to slice will reallocate to a new array -+ slice ~= 5; -+ assert(slice.capacity >= 5); -+ -+ //Dynamic array slices -+ int[] a = [1, 2, 3, 4]; -+ int[] b = a[1 .. $]; -+ int[] c = a[1 .. $ - 1]; -+ assert(a.capacity != 0); -+ assert(a.capacity == b.capacity + 1); //both a and b share the same tail -+ assert(c.capacity == 0); //an append to c must relocate c. -+} - - /** -- * Try to reserve capacity for an array. The capacity is the number of -- * elements that the array can grow to before the array must be -- * extended/reallocated. -+ * Reserves capacity for a slice. The capacity is the size -+ * that the slice can grow to before the underlying array must be -+ * reallocated or extended. - * - * The return value is the new capacity of the array (which may be larger than - * the requested capacity). - */ --size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow -+size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow @trusted - { - return _d_arraysetcapacity(typeid(T[]), newcapacity, cast(void *)&arr); - } -+/// -+unittest -+{ -+ //Static array slice: no capacity. Reserve relocates. -+ int[4] sarray = [1, 2, 3, 4]; -+ int[] slice = sarray[]; -+ auto u = slice.reserve(8); -+ assert(u >= 8); -+ assert(sarray.ptr !is slice.ptr); -+ assert(slice.capacity == u); -+ -+ //Dynamic array slices -+ int[] a = [1, 2, 3, 4]; -+ a.reserve(8); //prepare a for appending 4 more items -+ auto p = a.ptr; -+ u = a.capacity; -+ a ~= [5, 6, 7, 8]; -+ assert(p == a.ptr); //a should not have been reallocated -+ assert(u == a.capacity); //a should not have been extended -+} -+ -+// Issue 6646: should be possible to use array.reserve from SafeD. -+@safe unittest -+{ -+ int[] a; -+ a.reserve(10); -+} - - /** -- * Assume that it is safe to append to this array. Appends made to this array -+ * Assume that it is safe to append to this array. Appends made to this array - * after calling this function may append in place, even if the array was a - * slice of a larger array to begin with. - * -- * Use this only when you are sure no elements are in use beyond the array in -- * the memory block. If there are, those elements could be overwritten by -- * appending to this array. -+ * Use this only when it is certain there are no elements in use beyond the -+ * array in the memory block. If there are, those elements will be -+ * overwritten by appending to this array. - * - * Calling this function, and then using references to data located after the - * given array results in undefined behavior. -+ * -+ * Returns: -+ * The input is returned. - */ --void assumeSafeAppend(T)(T[] arr) -+auto ref inout(T[]) assumeSafeAppend(T)(auto ref inout(T[]) arr) - { - _d_arrayshrinkfit(typeid(T[]), *(cast(void[]*)&arr)); -+ return arr; -+} -+/// -+unittest -+{ -+ int[] a = [1, 2, 3, 4]; -+ -+ // Without assumeSafeAppend. Appending relocates. -+ int[] b = a [0 .. 3]; -+ b ~= 5; -+ assert(a.ptr != b.ptr); -+ -+ // With assumeSafeAppend. Appending overwrites. -+ int[] c = a [0 .. 3]; -+ c.assumeSafeAppend() ~= 5; -+ assert(a.ptr == c.ptr); - } - --version (unittest) unittest -+unittest - { -+ int[] arr; -+ auto newcap = arr.reserve(2000); -+ assert(newcap >= 2000); -+ assert(newcap == arr.capacity); -+ auto ptr = arr.ptr; -+ foreach(i; 0..2000) -+ arr ~= i; -+ assert(ptr == arr.ptr); -+ arr = arr[0..1]; -+ arr.assumeSafeAppend(); -+ arr ~= 5; -+ assert(ptr == arr.ptr); -+} -+ -+unittest -+{ -+ int[] arr = [1, 2, 3]; -+ void foo(ref int[] i) - { -- int[] arr; -- auto newcap = arr.reserve(2000); -- assert(newcap >= 2000); -- assert(newcap == arr.capacity); -- auto ptr = arr.ptr; -- foreach(i; 0..2000) -- arr ~= i; -- assert(ptr == arr.ptr); -- arr = arr[0..1]; -- arr.assumeSafeAppend(); -- arr ~= 5; -- assert(ptr == arr.ptr); -+ i ~= 5; - } -+ arr = arr[0 .. 2]; -+ foo(assumeSafeAppend(arr)); //pass by ref -+ assert(arr[]==[1, 2, 5]); -+ arr = arr[0 .. 1].assumeSafeAppend(); //pass by value - } - -+//@@@10574@@@ -+unittest -+{ -+ int[] a; -+ immutable(int[]) b; -+ auto a2 = &assumeSafeAppend(a); -+ auto b2 = &assumeSafeAppend(b); -+ auto a3 = assumeSafeAppend(a[]); -+ auto b3 = assumeSafeAppend(b[]); -+ assert(is(typeof(*a2) == int[])); -+ assert(is(typeof(*b2) == immutable(int[]))); -+ assert(is(typeof(a3) == int[])); -+ assert(is(typeof(b3) == immutable(int[]))); -+} - - version (none) - { -@@ -2653,6 +2645,11 @@ bool _xopEquals(in void*, in void*) - throw new Error("TypeInfo.equals is not implemented"); - } - -+bool _xopCmp(in void*, in void*) -+{ -+ throw new Error("TypeInfo.compare is not implemented"); -+} -+ - /****************************************** - * Create RTInfo for type T - */ ---- a/src/libphobos/libdruntime/object.di 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/object.di 2014-04-01 16:32:51.000000000 +0100 -@@ -35,7 +35,6 @@ class Object - size_t toHash() @trusted nothrow; - int opCmp(Object o); - bool opEquals(Object o); -- bool opEquals(Object lhs, Object rhs); - - interface Monitor - { -@@ -48,7 +47,6 @@ class Object - - bool opEquals(const Object lhs, const Object rhs); - bool opEquals(Object lhs, Object rhs); --//bool opEquals(TypeInfo lhs, TypeInfo rhs); - - void setSameMutex(shared Object ownee, shared Object owner); - -@@ -56,7 +54,7 @@ struct Interface - { - TypeInfo_Class classinfo; - void*[] vtbl; -- ptrdiff_t offset; // offset to Interface 'this' from Object 'this' -+ size_t offset; // offset to Interface 'this' from Object 'this' - } - - struct OffsetTypeInfo -@@ -76,7 +74,7 @@ class TypeInfo - int compare(in void* p1, in void* p2) const; - @property size_t tsize() nothrow pure const @safe; - void swap(void* p1, void* p2) const; -- @property const(TypeInfo) next() nothrow pure const; -+ @property inout(TypeInfo) next() nothrow pure inout; - const(void)[] init() nothrow pure const @safe; // TODO: make this a property, but may need to be renamed to diambiguate with T.init... - @property uint flags() nothrow pure const @safe; - // 1: // has possible pointers into GC memory -@@ -114,7 +112,7 @@ class TypeInfo_Array : TypeInfo - override int compare(in void* p1, in void* p2) const; - override @property size_t tsize() nothrow pure const; - override void swap(void* p1, void* p2) const; -- override @property const(TypeInfo) next() nothrow pure const; -+ override @property inout(TypeInfo) next() nothrow pure inout; - override @property uint flags() nothrow pure const; - override @property size_t talign() nothrow pure const; - version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2); -@@ -122,11 +120,6 @@ class TypeInfo_Array : TypeInfo - TypeInfo value; - } - --class TypeInfo_Vector : TypeInfo --{ -- TypeInfo base; --} -- - class TypeInfo_StaticArray : TypeInfo - { - TypeInfo value; -@@ -140,6 +133,11 @@ class TypeInfo_AssociativeArray : TypeIn - TypeInfo impl; - } - -+class TypeInfo_Vector : TypeInfo -+{ -+ TypeInfo base; -+} -+ - class TypeInfo_Function : TypeInfo - { - TypeInfo next; -@@ -164,13 +162,18 @@ class TypeInfo_Class : TypeInfo - TypeInfo_Class base; - void* destructor; - void function(Object) classInvariant; -- uint m_flags; -- // 1: // is IUnknown or is derived from IUnknown -- // 2: // has no possible pointers into GC memory -- // 4: // has offTi[] member -- // 8: // has constructors -- // 16: // has xgetMembers member -- // 32: // has typeinfo member -+ enum ClassFlags : uint -+ { -+ isCOMclass = 0x1, -+ noPointers = 0x2, -+ hasOffTi = 0x4, -+ hasCtor = 0x8, -+ hasGetMembers = 0x10, -+ hasTypeInfo = 0x20, -+ isAbstract = 0x40, -+ isCPPclass = 0x80, -+ } -+ ClassFlags m_flags; - void* deallocator; - OffsetTypeInfo[] m_offTi; - void* defaultConstructor; -@@ -199,7 +202,11 @@ class TypeInfo_Struct : TypeInfo - int function(in void*, in void*) xopCmp; - string function(in void*) xtoString; - -- uint m_flags; -+ enum StructFlags : uint -+ { -+ hasPointers = 0x1, -+ } -+ StructFlags m_flags; - } - void function(void*) xdtor; - void function(void*) xpostblit; -@@ -270,37 +277,9 @@ class MemberInfo_function : MemberInfo - - struct ModuleInfo - { -- struct New -- { -- uint flags; -- uint index; -- } -- -- struct Old -- { -- string name; -- ModuleInfo*[] importedModules; -- TypeInfo_Class[] localClasses; -- uint flags; -- -- void function() ctor; -- void function() dtor; -- void function() unitTest; -- void* xgetMembers; -- void function() ictor; -- void function() tlsctor; -- void function() tlsdtor; -- uint index; -- void*[1] reserved; -- } -+ uint _flags; -+ uint _index; - -- union -- { -- New n; -- Old o; -- } -- -- @property bool isNew() nothrow pure; - @property uint index() nothrow pure; - @property void index(uint i) nothrow pure; - @property uint flags() nothrow pure; -@@ -374,14 +353,12 @@ extern (C) - { - // from druntime/src/compiler/dmd/aaA.d - -- size_t _aaLen(void* p); -- void* _aaGetX(void** pp, TypeInfo keyti, size_t valuesize, void* pkey); -- void* _aaGetRvalueX(void* p, TypeInfo keyti, size_t valuesize, void* pkey); -- void* _aaInX(void* p, TypeInfo keyti, void* pkey); -- bool _aaDelX(void* p, TypeInfo keyti, void* pkey); -- void[] _aaValues(void* p, size_t keysize, size_t valuesize); -- void[] _aaKeys(void* p, size_t keysize); -- void* _aaRehash(void** pp, TypeInfo keyti); -+ size_t _aaLen(in void* p) pure nothrow; -+ void* _aaGetX(void** pp, const TypeInfo keyti, in size_t valuesize, in void* pkey); -+ inout(void)* _aaGetRvalueX(inout void* p, in TypeInfo keyti, in size_t valuesize, in void* pkey); -+ inout(void)[] _aaValues(inout void* p, in size_t keysize, in size_t valuesize) pure nothrow; -+ inout(void)[] _aaKeys(inout void* p, in size_t keysize) pure nothrow; -+ void* _aaRehash(void** pp, in TypeInfo keyti) pure nothrow; - - extern (D) alias scope int delegate(void *) _dg_t; - int _aaApply(void* aa, size_t keysize, _dg_t dg); -@@ -389,106 +366,65 @@ extern (C) - extern (D) alias scope int delegate(void *, void *) _dg2_t; - int _aaApply2(void* aa, size_t keysize, _dg2_t dg); - -- void* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values); -- hash_t _aaGetHash(void* aa, const(TypeInfo) tiRaw) nothrow; -+ private struct AARange { void* impl, current; } -+ AARange _aaRange(void* aa); -+ bool _aaRangeEmpty(AARange r); -+ void* _aaRangeFrontKey(AARange r); -+ void* _aaRangeFrontValue(AARange r); -+ void _aaRangePopFront(ref AARange r); -+} -+ -+private template _Unqual(T) -+{ -+ static if (is(T U == shared(const U))) alias U _Unqual; -+ else static if (is(T U == const U )) alias U _Unqual; -+ else static if (is(T U == immutable U )) alias U _Unqual; -+ else static if (is(T U == inout U )) alias U _Unqual; -+ else static if (is(T U == shared U )) alias U _Unqual; -+ else alias T _Unqual; - } - - struct AssociativeArray(Key, Value) - { - private: -- // Duplicates of the stuff found in druntime/src/rt/aaA.d -- struct Slot -- { -- Slot *next; -- size_t hash; -- Key key; -- version(D_LP64) align(16) Value value; // c.f. rt/aaA.d, aligntsize() -- else align(4) Value value; -+ void* p; - -- // Stop creating built-in opAssign -- @disable void opAssign(Slot); -- } -+public: -+ @property size_t length() const { return _aaLen(p); } - -- struct Hashtable -+ Value[Key] rehash() - { -- Slot*[] b; -- size_t nodes; -- TypeInfo keyti; -- Slot*[4] binit; -+ auto p = _aaRehash(cast(void**) &p, typeid(Value[Key])); -+ return *cast(Value[Key]*)(&p); - } - -- void* p; // really Hashtable* -+ // Note: can't make `values` and `keys` inout as it is used -+ // e.g. in Phobos like `ReturnType!(aa.keys)` instead of `typeof(aa.keys)` -+ // which will result in `inout` propagation. - -- struct Range -+ inout(Value)[] inout_values() inout @property - { -- // State -- Slot*[] slots; -- Slot* current; -- -- this(void * aa) -- { -- if (!aa) return; -- auto pImpl = cast(Hashtable*) aa; -- slots = pImpl.b; -- nextSlot(); -- } -- -- void nextSlot() -- { -- foreach (i, slot; slots) -- { -- if (!slot) continue; -- current = slot; -- slots = slots.ptr[i .. slots.length]; -- break; -- } -- } -- -- public: -- @property bool empty() const -- { -- return current is null; -- } -- -- @property ref inout(Slot) front() inout -- { -- assert(current); -- return *current; -- } -- -- void popFront() -- { -- assert(current); -- current = current.next; -- if (!current) -- { -- slots = slots[1 .. $]; -- nextSlot(); -- } -- } -+ auto a = _aaValues(p, Key.sizeof, Value.sizeof); -+ return *cast(inout Value[]*) &a; - } - --public: -- -- @property size_t length() { return _aaLen(p); } -- -- Value[Key] rehash() @property -+ inout(Key)[] inout_keys() inout @property - { -- auto p = _aaRehash(&p, typeid(Value[Key])); -- return *cast(Value[Key]*)(&p); -+ auto a = _aaKeys(p, Key.sizeof); -+ return *cast(inout Key[]*) &a; - } - - Value[] values() @property -- { -- auto a = _aaValues(p, Key.sizeof, Value.sizeof); -- return *cast(Value[]*) &a; -- } -+ { return inout_values; } - - Key[] keys() @property -- { -- auto a = _aaKeys(p, Key.sizeof); -- return *cast(Key[]*) &a; -- } -+ { return inout_keys; } -+ -+ const(Value)[] values() const @property -+ { return inout_values; } -+ -+ const(Key)[] keys() const @property -+ { return inout_keys; } - - int opApply(scope int delegate(ref Key, ref Value) dg) - { -@@ -506,8 +442,13 @@ public: - return p ? *p : defaultValue; - } - -- static if (is(typeof({ Value[Key] r; r[Key.init] = Value.init; }()))) -- @property Value[Key] dup() -+ static if (is(typeof({ -+ ref Value get(); // pseudo lvalue of Value -+ Value[Key] r; r[Key.init] = get(); -+ // bug 10720 - check whether Value is copyable -+ }))) -+ { -+ Value[Key] dup() - { - Value[Key] result; - foreach (k, v; this) -@@ -516,49 +457,38 @@ public: - } - return result; - } -+ } -+ else -+ @disable Value[Key] dup(); // for better error message - -- @property auto byKey() -+ auto byKey() - { - static struct Result - { -- Range state; -+ AARange r; - -- this(void* p) -- { -- state = Range(p); -- } -- -- @property ref Key front() -- { -- return state.front.key; -- } -- -- alias state this; -+ @property bool empty() { return _aaRangeEmpty(r); } -+ @property ref Key front() { return *cast(Key*)_aaRangeFrontKey(r); } -+ void popFront() { _aaRangePopFront(r); } -+ Result save() { return this; } - } - -- return Result(p); -+ return Result(_aaRange(p)); - } - -- @property auto byValue() -+ auto byValue() - { - static struct Result - { -- Range state; -- -- this(void* p) -- { -- state = Range(p); -- } -+ AARange r; - -- @property ref Value front() -- { -- return state.front.value; -- } -- -- alias state this; -+ @property bool empty() { return _aaRangeEmpty(r); } -+ @property ref Value front() { return *cast(Value*)_aaRangeFrontValue(r); } -+ void popFront() { _aaRangePopFront(r); } -+ Result save() { return this; } - } - -- return Result(p); -+ return Result(_aaRange(p)); - } - } - -@@ -587,9 +517,9 @@ void destroy(T)(ref T obj) if (is(T == s - buf[] = init[]; - } - --void destroy(T : U[n], U, size_t n)(ref T obj) -+void destroy(T : U[n], U, size_t n)(ref T obj) if (!is(T == struct)) - { -- obj = T.init; -+ obj[] = U.init; - } - - void destroy(T)(ref T obj) -@@ -619,14 +549,15 @@ private - return _d_arraysetcapacity(typeid(T[]), 0, cast(void *)&arr); - } - --size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow -+size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow @trusted - { - return _d_arraysetcapacity(typeid(T[]), newcapacity, cast(void *)&arr); - } - --void assumeSafeAppend(T)(T[] arr) -+auto ref inout(T[]) assumeSafeAppend(T)(auto ref inout(T[]) arr) - { - _d_arrayshrinkfit(typeid(T[]), *(cast(void[]*)&arr)); -+ return arr; - } - - bool _ArrayEq(T1, T2)(T1[] a1, T2[] a2) -@@ -641,6 +572,7 @@ bool _ArrayEq(T1, T2)(T1[] a1, T2[] a2) - } - - bool _xopEquals(in void* ptr, in void* ptr); -+bool _xopCmp(in void* ptr, in void* ptr); - - void __ctfeWrite(T...)(auto ref T) {} - void __ctfeWriteln(T...)(auto ref T values) { __ctfeWrite(values, "\n"); } ---- a/src/libphobos/libdruntime/phobos-ver-syms.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/phobos-ver-syms.in 2014-04-01 16:32:51.000000000 +0100 -@@ -1,8 +1,6 @@ - @DCFG_UNIX@ - @DCFG_POSIX@ --@DCFG_SEMAPHORE_IMPL@ --@DCFG_EXECVPE@ --@DCFG_SPAWNVP@ - @DCFG_CBRIDGE_STDIO@ - @DCFG_MMAP@ - @DCFG_ARM_EABI_UNWINDER@ -+@DCFG_THREAD_MODEL@ ---- a/src/libphobos/libdruntime/rt/aaA.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/aaA.d 2014-04-01 16:32:51.000000000 +0100 -@@ -20,28 +20,13 @@ private - import core.stdc.stdio; - import core.memory; - -- enum BlkAttr : uint -- { -- FINALIZE = 0b0000_0001, -- NO_SCAN = 0b0000_0010, -- NO_MOVE = 0b0000_0100, -- APPENDABLE = 0b0000_1000, -- NO_INTERIOR = 0b0001_0000, -- ALL_BITS = 0b1111_1111 -- } -- -- extern (C) void* gc_malloc( size_t sz, uint ba = 0 ); -- extern (C) void gc_free( void* p ); -- - // Convenience function to make sure the NO_INTERIOR gets set on the -- // aaA arrays. -- aaA*[] newaaA(size_t len) -+ // bucket array. -+ Entry*[] newBuckets(in size_t len) @trusted pure nothrow - { -- auto ptr = cast(aaA**) gc_malloc( -- len * (aaA*).sizeof, BlkAttr.NO_INTERIOR); -- auto ret = ptr[0..len]; -- ret[] = null; -- return ret; -+ auto ptr = cast(Entry**) GC.calloc( -+ len * (Entry*).sizeof, GC.BlkAttr.NO_INTERIOR); -+ return ptr[0..len]; - } - } - -@@ -72,29 +57,31 @@ struct Array - void* ptr; - } - --struct aaA -+struct Entry - { -- aaA *next; -+ Entry *next; - size_t hash; - /* key */ - /* value */ - } - --struct BB -+struct Impl - { -- aaA*[] b; -- size_t nodes; // total number of aaA nodes -- TypeInfo keyti; // TODO: replace this with TypeInfo_AssociativeArray when available in _aaGet() -- aaA*[4] binit; // initial value of b[] -+ Entry*[] buckets; -+ size_t nodes; // total number of entries -+ TypeInfo _keyti; -+ Entry*[4] binit; // initial value of buckets[] -+ -+ @property const(TypeInfo) keyti() const @safe pure nothrow -+ { return _keyti; } - } - - /* This is the type actually seen by the programmer, although - * it is completely opaque. - */ -- - struct AA - { -- BB* a; -+ Impl* impl; - } - - /********************************** -@@ -102,8 +89,7 @@ struct AA - * GC won't be faced with misaligned pointers - * in value. - */ -- --size_t aligntsize(size_t tsize) nothrow -+size_t aligntsize(in size_t tsize) @safe pure nothrow - { - version (D_LP64) { - // align to 16 bytes on 64-bit -@@ -116,79 +102,10 @@ size_t aligntsize(size_t tsize) nothrow - - extern (C): - --/************************************************* -- * Invariant for aa. -- */ -- --/+ --void _aaInvAh(aaA*[] aa) --{ -- for (size_t i = 0; i < aa.length; i++) -- { -- if (aa[i]) -- _aaInvAh_x(aa[i]); -- } --} -- --private int _aaCmpAh_x(aaA *e1, aaA *e2) --{ int c; -- -- c = e1.hash - e2.hash; -- if (c == 0) -- { -- c = e1.key.length - e2.key.length; -- if (c == 0) -- c = memcmp((char *)e1.key, (char *)e2.key, e1.key.length); -- } -- return c; --} -- --private void _aaInvAh_x(aaA *e) --{ -- size_t key_hash; -- aaA *e1; -- aaA *e2; -- -- key_hash = getHash(e.key); -- assert(key_hash == e.hash); -- -- while (1) -- { int c; -- -- e1 = e.left; -- if (e1) -- { -- _aaInvAh_x(e1); // ordinary recursion -- do -- { -- c = _aaCmpAh_x(e1, e); -- assert(c < 0); -- e1 = e1.right; -- } while (e1 != null); -- } -- -- e2 = e.right; -- if (e2) -- { -- do -- { -- c = _aaCmpAh_x(e, e2); -- assert(c < 0); -- e2 = e2.left; -- } while (e2 != null); -- e = e.right; // tail recursion -- } -- else -- break; -- } --} --+/ -- - /**************************************************** - * Determine number of entries in associative array. - */ -- --size_t _aaLen(AA aa) -+size_t _aaLen(in AA aa) pure nothrow - in - { - //printf("_aaLen()+\n"); -@@ -198,9 +115,9 @@ out (result) - { - size_t len = 0; - -- if (aa.a) -+ if (aa.impl) - { -- foreach (e; aa.a.b) -+ foreach (const(Entry)* e; aa.impl.buckets) - { - while (e) - { len++; -@@ -214,7 +131,7 @@ out (result) - } - body - { -- return aa.a ? aa.a.nodes : 0; -+ return aa.impl ? aa.impl.nodes : 0; - } - - -@@ -222,14 +139,7 @@ body - * Get pointer to value in associative array indexed by key. - * Add entry for key if it is not already there. - */ -- --// retained for backwards compatibility --void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, ...) --{ -- return _aaGetX(aa, keyti, valuesize, cast(void*)(&valuesize + 1)); --} -- --void* _aaGetX(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) -+void* _aaGetX(AA* aa, const TypeInfo keyti, in size_t valuesize, in void* pkey) - in - { - assert(aa); -@@ -237,30 +147,30 @@ in - out (result) - { - assert(result); -- assert(aa.a); -- assert(aa.a.b.length); -+ assert(aa.impl !is null); -+ assert(aa.impl.buckets.length); - //assert(_aaInAh(*aa.a, key)); - } - body - { - size_t i; -- aaA *e; -+ Entry *e; - //printf("keyti = %p\n", keyti); - //printf("aa = %p\n", aa); - immutable keytitsize = keyti.tsize; - -- if (!aa.a) -- { aa.a = new BB(); -- aa.a.b = aa.a.binit[]; -+ if (aa.impl is null) -+ { aa.impl = new Impl(); -+ aa.impl.buckets = aa.impl.binit[]; - } - //printf("aa = %p\n", aa); - //printf("aa.a = %p\n", aa.a); -- aa.a.keyti = keyti; -+ aa.impl._keyti = cast() keyti; - - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); -- i = key_hash % aa.a.b.length; -- auto pe = &aa.a.b[i]; -+ i = key_hash % aa.impl.buckets.length; -+ auto pe = &aa.impl.buckets[i]; - while ((e = *pe) !is null) - { - if (key_hash == e.hash) -@@ -274,8 +184,8 @@ body - - // Not found, create new elem - //printf("create new one\n"); -- size_t size = aaA.sizeof + aligntsize(keytitsize) + valuesize; -- e = cast(aaA *) gc_malloc(size); -+ size_t size = Entry.sizeof + aligntsize(keytitsize) + valuesize; -+ e = cast(Entry *) GC.malloc(size); - e.next = null; - e.hash = key_hash; - ubyte* ptail = cast(ubyte*)(e + 1); -@@ -283,9 +193,9 @@ body - memset(ptail + aligntsize(keytitsize), 0, valuesize); // zero value - *pe = e; - -- auto nodes = ++aa.a.nodes; -- //printf("length = %d, nodes = %d\n", aa.a.b.length, nodes); -- if (nodes > aa.a.b.length * 4) -+ auto nodes = ++aa.impl.nodes; -+ //printf("length = %d, nodes = %d\n", aa.a.buckets.length, nodes); -+ if (nodes > aa.impl.buckets.length * 4) - { - //printf("rehash\n"); - _aaRehash(aa,keyti); -@@ -300,34 +210,28 @@ Lret: - * Get pointer to value in associative array indexed by key. - * Returns null if it is not already there. - */ -- --void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, ...) --{ -- return _aaGetRvalueX(aa, keyti, valuesize, cast(void*)(&valuesize + 1)); --} -- --void* _aaGetRvalueX(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) -+inout(void)* _aaGetRvalueX(inout AA aa, in TypeInfo keyti, in size_t valuesize, in void* pkey) - { - //printf("_aaGetRvalue(valuesize = %u)\n", valuesize); -- if (!aa.a) -+ if (aa.impl is null) - return null; - - auto keysize = aligntsize(keyti.tsize); -- auto len = aa.a.b.length; -+ auto len = aa.impl.buckets.length; - - if (len) - { - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); - size_t i = key_hash % len; -- auto e = aa.a.b[i]; -+ inout(Entry)* e = aa.impl.buckets[i]; - while (e !is null) - { - if (key_hash == e.hash) - { - auto c = keyti.compare(pkey, e + 1); - if (c == 0) -- return cast(void *)(e + 1) + keysize; -+ return cast(inout void *)(e + 1) + keysize; - } - e = e.next; - } -@@ -342,13 +246,7 @@ void* _aaGetRvalueX(AA aa, TypeInfo keyt - * null not in aa - * !=null in aa, return pointer to value - */ -- --void* _aaIn(AA aa, TypeInfo keyti, ...) --{ -- return _aaInX(aa, keyti, cast(void*)(&keyti + 1)); --} -- --void* _aaInX(AA aa, TypeInfo keyti, void* pkey) -+inout(void)* _aaInX(inout AA aa, in TypeInfo keyti, in void* pkey) - in - { - } -@@ -358,24 +256,24 @@ out (result) - } - body - { -- if (aa.a) -+ if (aa.impl) - { - //printf("_aaIn(), .length = %d, .ptr = %x\n", aa.a.length, cast(uint)aa.a.ptr); -- auto len = aa.a.b.length; -+ auto len = aa.impl.buckets.length; - - if (len) - { - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); - const i = key_hash % len; -- auto e = aa.a.b[i]; -+ inout(Entry)* e = aa.impl.buckets[i]; - while (e !is null) - { - if (key_hash == e.hash) - { - auto c = keyti.compare(pkey, e + 1); - if (c == 0) -- return cast(void *)(e + 1) + aligntsize(keyti.tsize); -+ return cast(inout void *)(e + 1) + aligntsize(keyti.tsize); - } - e = e.next; - } -@@ -390,22 +288,16 @@ body - * Delete key entry in aa[]. - * If key is not in aa[], do nothing. - */ -- --bool _aaDel(AA aa, TypeInfo keyti, ...) --{ -- return _aaDelX(aa, keyti, cast(void*)(&keyti + 1)); --} -- --bool _aaDelX(AA aa, TypeInfo keyti, void* pkey) -+bool _aaDelX(AA aa, in TypeInfo keyti, in void* pkey) - { -- aaA *e; -+ Entry *e; - -- if (aa.a && aa.a.b.length) -+ if (aa.impl && aa.impl.buckets.length) - { - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); -- size_t i = key_hash % aa.a.b.length; -- auto pe = &aa.a.b[i]; -+ size_t i = key_hash % aa.impl.buckets.length; -+ auto pe = &aa.impl.buckets[i]; - while ((e = *pe) !is null) // null means not found - { - if (key_hash == e.hash) -@@ -414,8 +306,8 @@ bool _aaDelX(AA aa, TypeInfo keyti, void - if (c == 0) - { - *pe = e.next; -- aa.a.nodes--; -- gc_free(e); -+ aa.impl.nodes--; -+ GC.free(e); - return true; - } - } -@@ -429,26 +321,25 @@ bool _aaDelX(AA aa, TypeInfo keyti, void - /******************************************** - * Produce array of values from aa. - */ -- --ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize) -+inout(ArrayRet_t) _aaValues(inout AA aa, in size_t keysize, in size_t valuesize) pure nothrow - { - size_t resi; - Array a; - - auto alignsize = aligntsize(keysize); - -- if (aa.a) -+ if (aa.impl !is null) - { - a.length = _aaLen(aa); -- a.ptr = cast(byte*) gc_malloc(a.length * valuesize, -- valuesize < (void*).sizeof ? BlkAttr.NO_SCAN : 0); -+ a.ptr = cast(byte*) GC.malloc(a.length * valuesize, -+ valuesize < (void*).sizeof ? GC.BlkAttr.NO_SCAN : 0); - resi = 0; -- foreach (e; aa.a.b) -+ foreach (inout(Entry)* e; aa.impl.buckets) - { - while (e) - { - memcpy(a.ptr + resi * valuesize, -- cast(byte*)e + aaA.sizeof + alignsize, -+ cast(byte*)e + Entry.sizeof + alignsize, - valuesize); - resi++; - e = e.next; -@@ -456,15 +347,14 @@ ArrayRet_t _aaValues(AA aa, size_t keysi - } - assert(resi == a.length); - } -- return *cast(ArrayRet_t*)(&a); -+ return *cast(inout ArrayRet_t*)(&a); - } - - - /******************************************** - * Rehash an array. - */ -- --void* _aaRehash(AA* paa, TypeInfo keyti) -+void* _aaRehash(AA* paa, in TypeInfo keyti) pure nothrow - in - { - //_aaInvAh(paa); -@@ -476,59 +366,67 @@ out (result) - body - { - //printf("Rehash\n"); -- if (paa.a) -+ if (paa.impl !is null) - { -- BB newb; -- auto aa = paa.a; - auto len = _aaLen(*paa); - if (len) -- { size_t i; -+ { -+ Impl newImpl; -+ Impl* oldImpl = paa.impl; - -+ size_t i; - for (i = 0; i < prime_list.length - 1; i++) - { - if (len <= prime_list[i]) - break; - } - len = prime_list[i]; -- newb.b = newaaA(len); -+ newImpl.buckets = newBuckets(len); - -- foreach (e; aa.b) -+ foreach (e; oldImpl.buckets) - { - while (e) - { auto enext = e.next; - const j = e.hash % len; -- e.next = newb.b[j]; -- newb.b[j] = e; -+ e.next = newImpl.buckets[j]; -+ newImpl.buckets[j] = e; - e = enext; - } - } -- if (aa.b.ptr == aa.binit.ptr) -- aa.binit[] = null; -+ if (oldImpl.buckets.ptr == oldImpl.binit.ptr) -+ oldImpl.binit[] = null; - else -- GC.free(aa.b.ptr); -+ GC.free(oldImpl.buckets.ptr); - -- newb.nodes = aa.nodes; -- newb.keyti = aa.keyti; -- } -+ newImpl.nodes = oldImpl.nodes; -+ newImpl._keyti = oldImpl._keyti; - -- *paa.a = newb; -+ *paa.impl = newImpl; -+ } -+ else -+ { -+ if (paa.impl.buckets.ptr != paa.impl.binit.ptr) -+ GC.free(paa.impl.buckets.ptr); -+ paa.impl.buckets = paa.impl.binit[]; -+ } - } -- return (*paa).a; -+ return (*paa).impl; - } - - /******************************************** - * Produce array of N byte keys from aa. - */ -- --ArrayRet_t _aaKeys(AA aa, size_t keysize) -+inout(ArrayRet_t) _aaKeys(inout AA aa, in size_t keysize) pure nothrow - { - auto len = _aaLen(aa); - if (!len) - return null; -- auto res = (cast(byte*) gc_malloc(len * keysize, -- !(aa.a.keyti.flags & 1) ? BlkAttr.NO_SCAN : 0))[0 .. len * keysize]; -+ -+ immutable blkAttr = !(aa.impl.keyti.flags & 1) ? GC.BlkAttr.NO_SCAN : 0; -+ auto res = (cast(byte*) GC.malloc(len * keysize, blkAttr))[0 .. len * keysize]; -+ - size_t resi = 0; -- foreach (e; aa.a.b) -+ foreach (inout(Entry)* e; aa.impl.buckets) - { - while (e) - { -@@ -542,7 +440,7 @@ ArrayRet_t _aaKeys(AA aa, size_t keysize - Array a; - a.length = len; - a.ptr = res.ptr; -- return *cast(ArrayRet_t*)(&a); -+ return *cast(inout ArrayRet_t*)(&a); - } - - unittest -@@ -589,25 +487,35 @@ unittest - } - } - -+unittest // Test for Issue 10381 -+{ -+ alias II = int[int]; -+ II aa1 = [0: 1]; -+ II aa2 = [0: 1]; -+ II aa3 = [0: 2]; -+ assert(aa1 == aa2); // Passes -+ assert( typeid(II).equals(&aa1, &aa2)); -+ assert(!typeid(II).equals(&aa1, &aa3)); -+} -+ - - /********************************************** - * 'apply' for associative arrays - to support foreach - */ -- - // dg is D, but _aaApply() is C - extern (D) alias int delegate(void *) dg_t; - --int _aaApply(AA aa, size_t keysize, dg_t dg) -+int _aaApply(AA aa, in size_t keysize, dg_t dg) - { -- if (!aa.a) -+ if (aa.impl is null) - { - return 0; - } - - immutable alignsize = aligntsize(keysize); -- //printf("_aaApply(aa = x%llx, keysize = %d, dg = x%llx)\n", aa.a, keysize, dg); -+ //printf("_aaApply(aa = x%llx, keysize = %d, dg = x%llx)\n", aa.impl, keysize, dg); - -- foreach (e; aa.a.b) -+ foreach (e; aa.impl.buckets) - { - while (e) - { -@@ -623,18 +531,18 @@ int _aaApply(AA aa, size_t keysize, dg_t - // dg is D, but _aaApply2() is C - extern (D) alias int delegate(void *, void *) dg2_t; - --int _aaApply2(AA aa, size_t keysize, dg2_t dg) -+int _aaApply2(AA aa, in size_t keysize, dg2_t dg) - { -- if (!aa.a) -+ if (aa.impl is null) - { - return 0; - } - -- //printf("_aaApply(aa = x%llx, keysize = %d, dg = x%llx)\n", aa.a, keysize, dg); -+ //printf("_aaApply(aa = x%llx, keysize = %d, dg = x%llx)\n", aa.impl, keysize, dg); - - immutable alignsize = aligntsize(keysize); - -- foreach (e; aa.a.b) -+ foreach (e; aa.impl.buckets) - { - while (e) - { -@@ -653,99 +561,15 @@ int _aaApply2(AA aa, size_t keysize, dg2 - * Construct an associative array of type ti from - * length pairs of key/value pairs. - */ -- --version (GNU) {} else --extern (C) --BB* _d_assocarrayliteralT(TypeInfo_AssociativeArray ti, size_t length, ...) --{ -- auto valuesize = ti.next.tsize; // value size -- auto keyti = ti.key; -- auto keysize = keyti.tsize; // key size -- BB* result; -- -- //printf("_d_assocarrayliteralT(keysize = %d, valuesize = %d, length = %d)\n", keysize, valuesize, length); -- //printf("tivalue = %.*s\n", ti.next.classinfo.name); -- if (length == 0 || valuesize == 0 || keysize == 0) -- { -- } -- else -- { -- va_list q; -- version (Win64) -- va_start(q, length); -- else version(X86_64) -- va_start(q, __va_argsave); -- else -- va_start(q, length); -- -- result = new BB(); -- result.keyti = keyti; -- size_t i; -- -- for (i = 0; i < prime_list.length - 1; i++) -- { -- if (length <= prime_list[i]) -- break; -- } -- auto len = prime_list[i]; -- result.b = newaaA(len); -- -- size_t keystacksize = (keysize + int.sizeof - 1) & ~(int.sizeof - 1); -- size_t valuestacksize = (valuesize + int.sizeof - 1) & ~(int.sizeof - 1); -- -- size_t keytsize = aligntsize(keysize); -- -- for (size_t j = 0; j < length; j++) -- { void* pkey = q; -- q += keystacksize; -- void* pvalue = q; -- q += valuestacksize; -- aaA* e; -- -- auto key_hash = keyti.getHash(pkey); -- //printf("hash = %d\n", key_hash); -- i = key_hash % len; -- auto pe = &result.b[i]; -- while (1) -- { -- e = *pe; -- if (!e) -- { -- // Not found, create new elem -- //printf("create new one\n"); -- e = cast(aaA *) cast(void*) new void[aaA.sizeof + keytsize + valuesize]; -- memcpy(e + 1, pkey, keysize); -- e.hash = key_hash; -- *pe = e; -- result.nodes++; -- break; -- } -- if (key_hash == e.hash) -- { -- auto c = keyti.compare(pkey, e + 1); -- if (c == 0) -- break; -- } -- pe = &e.next; -- } -- memcpy(cast(void *)(e + 1) + keytsize, pvalue, valuesize); -- } -- -- va_end(q); -- } -- return result; --} -- --extern (C) --BB* _d_assocarrayliteralTX(TypeInfo_AssociativeArray ti, void[] keys, void[] values) -+Impl* _d_assocarrayliteralTX(const TypeInfo_AssociativeArray ti, void[] keys, void[] values) - { -- auto valuesize = ti.next.tsize; // value size -- auto keyti = ti.key; -- auto keysize = keyti.tsize; // key size -- auto length = keys.length; -- BB* result; -+ const valuesize = ti.next.tsize; // value size -+ const keyti = ti.key; -+ const keysize = keyti.tsize; // key size -+ const length = keys.length; -+ Impl* result; - -- //printf("_d_assocarrayliteralTX(keysize = %d, valuesize = %d, length = %d)\n", keysize, valuesize, length); -+ //printf("_d_assocarrayliteralT(keysize = %d, valuesize = %d, length = %d)\n", keysize, valuesize, length); - //printf("tivalue = %.*s\n", ti.next.classinfo.name); - assert(length == values.length); - if (length == 0 || valuesize == 0 || keysize == 0) -@@ -753,8 +577,8 @@ BB* _d_assocarrayliteralTX(TypeInfo_Asso - } - else - { -- result = new BB(); -- result.keyti = keyti; -+ result = new Impl(); -+ result._keyti = cast() keyti; - - size_t i; - for (i = 0; i < prime_list.length - 1; i++) -@@ -763,19 +587,19 @@ BB* _d_assocarrayliteralTX(TypeInfo_Asso - break; - } - auto len = prime_list[i]; -- result.b = newaaA(len); -+ result.buckets = newBuckets(len); - - size_t keytsize = aligntsize(keysize); - - for (size_t j = 0; j < length; j++) - { auto pkey = keys.ptr + j * keysize; - auto pvalue = values.ptr + j * valuesize; -- aaA* e; -+ Entry* e; - - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); - i = key_hash % len; -- auto pe = &result.b[i]; -+ auto pe = &result.buckets[i]; - while (1) - { - e = *pe; -@@ -783,7 +607,7 @@ BB* _d_assocarrayliteralTX(TypeInfo_Asso - { - // Not found, create new elem - //printf("create new one\n"); -- e = cast(aaA *) cast(void*) new void[aaA.sizeof + keytsize + valuesize]; -+ e = cast(Entry *) cast(void*) new void[Entry.sizeof + keytsize + valuesize]; - memcpy(e + 1, pkey, keysize); - e.hash = key_hash; - *pe = e; -@@ -805,7 +629,7 @@ BB* _d_assocarrayliteralTX(TypeInfo_Asso - } - - --static TypeInfo_AssociativeArray _aaUnwrapTypeInfo(const(TypeInfo) tiRaw) nothrow -+const(TypeInfo_AssociativeArray) _aaUnwrapTypeInfo(const(TypeInfo) tiRaw) pure nothrow - { - const(TypeInfo)* p = &tiRaw; - TypeInfo_AssociativeArray ti; -@@ -839,22 +663,28 @@ static TypeInfo_AssociativeArray _aaUnwr - * 1 equal - * 0 not equal - */ --int _aaEqual(TypeInfo tiRaw, AA e1, AA e2) -+int _aaEqual(in TypeInfo tiRaw, in AA e1, in AA e2) - { - //printf("_aaEqual()\n"); - //printf("keyti = %.*s\n", ti.key.classinfo.name); - //printf("valueti = %.*s\n", ti.next.classinfo.name); - -- if (e1.a is e2.a) -+ if (e1.impl is e2.impl) - return 1; - - size_t len = _aaLen(e1); - if (len != _aaLen(e2)) - return 0; - -+ // Bug 9852: at this point, e1 and e2 have the same length, so if one is -+ // null, the other must either also be null or have zero entries, so they -+ // must be equal. We check this here to avoid dereferencing null later on. -+ if (e1.impl is null || e2.impl is null) -+ return 1; -+ - // Check for Bug 5925. ti_raw could be a TypeInfo_Const, we need to unwrap - // it until reaching a real TypeInfo_AssociativeArray. -- TypeInfo_AssociativeArray ti = _aaUnwrapTypeInfo(tiRaw); -+ const TypeInfo_AssociativeArray ti = _aaUnwrapTypeInfo(tiRaw); - - /* Algorithm: Visit each key/value pair in e1. If that key doesn't exist - * in e2, or if the value in e1 doesn't match the one in e2, the arrays -@@ -862,12 +692,14 @@ int _aaEqual(TypeInfo tiRaw, AA e1, AA e - * After all pairs are checked, the arrays must be equal. - */ - -- auto keyti = ti.key; -- auto valueti = ti.next; -+ const keyti = ti.key; -+ const valueti = ti.next; - const keysize = aligntsize(keyti.tsize); -- const len2 = e2.a.b.length; - -- int _aaKeys_x(aaA* e) -+ assert(e2.impl !is null); -+ const len2 = e2.impl.buckets.length; -+ -+ int _aaKeys_x(const(Entry)* e) - { - do - { -@@ -880,7 +712,7 @@ int _aaEqual(TypeInfo tiRaw, AA e1, AA e - auto key_hash = keyti.getHash(pkey); - //printf("hash = %d\n", key_hash); - const i = key_hash % len2; -- auto f = e2.a.b[i]; -+ const(Entry)* f = e2.impl.buckets[i]; - while (1) - { - //printf("f is %p\n", f); -@@ -912,7 +744,7 @@ int _aaEqual(TypeInfo tiRaw, AA e1, AA e - return 1; // this subtree matches - } - -- foreach (e; e1.a.b) -+ foreach (e; e1.impl.buckets) - { - if (e) - { if (_aaKeys_x(e) == 0) -@@ -929,21 +761,20 @@ int _aaEqual(TypeInfo tiRaw, AA e1, AA e - * Returns: - * Hash value - */ --extern (C) --hash_t _aaGetHash(AA* aa, const(TypeInfo) tiRaw) nothrow -+hash_t _aaGetHash(in AA* aa, in TypeInfo tiRaw) nothrow - { - import rt.util.hash; - -- if (!aa.a) -+ if (aa.impl is null) - return 0; - - hash_t h = 0; -- TypeInfo_AssociativeArray ti = _aaUnwrapTypeInfo(tiRaw); -- auto keyti = ti.key; -- auto valueti = ti.next; -+ const TypeInfo_AssociativeArray ti = _aaUnwrapTypeInfo(tiRaw); -+ const keyti = ti.key; -+ const valueti = ti.next; - const keysize = aligntsize(keyti.tsize); - -- foreach (e; aa.a.b) -+ foreach (const(Entry)* e; aa.impl.buckets) - { - while (e) - { -@@ -996,3 +827,105 @@ unittest - - assert(aa1[key2a] == 200); - } -+ -+// Issue 9852 -+unittest -+{ -+ // Original test case (revised, original assert was wrong) -+ int[string] a; -+ a["foo"] = 0; -+ a.remove("foo"); -+ assert(a == null); // should not crash -+ -+ int[string] b; -+ assert(b is null); -+ assert(a == b); // should not deref null -+ assert(b == a); // ditto -+ -+ int[string] c; -+ c["a"] = 1; -+ assert(a != c); // comparison with empty non-null AA -+ assert(c != a); -+ assert(b != c); // comparison with null AA -+ assert(c != b); -+} -+ -+ -+/** -+ * _aaRange implements a ForwardRange -+ */ -+struct Range -+{ -+ Impl* impl; -+ Entry* current; -+} -+ -+ -+Range _aaRange(AA aa) -+{ -+ typeof(return) res; -+ if (aa.impl is null) -+ return res; -+ -+ res.impl = aa.impl; -+ foreach (entry; aa.impl.buckets) -+ { -+ if (entry !is null) -+ { -+ res.current = entry; -+ break; -+ } -+ } -+ return res; -+} -+ -+ -+bool _aaRangeEmpty(Range r) -+{ -+ return r.current is null; -+} -+ -+ -+void* _aaRangeFrontKey(Range r) -+in -+{ -+ assert(r.current !is null); -+} -+body -+{ -+ return cast(void*)r.current + Entry.sizeof; -+} -+ -+ -+void* _aaRangeFrontValue(Range r) -+in -+{ -+ assert(r.current !is null); -+ assert(r.impl.keyti !is null); // set on first insert -+} -+body -+{ -+ return cast(void*)r.current + Entry.sizeof + aligntsize(r.impl.keyti.tsize); -+} -+ -+ -+void _aaRangePopFront(ref Range r) -+{ -+ if (r.current.next !is null) -+ { -+ r.current = r.current.next; -+ } -+ else -+ { -+ immutable idx = r.current.hash % r.impl.buckets.length; -+ r.current = null; -+ foreach (entry; r.impl.buckets[idx + 1 .. $]) -+ { -+ if (entry !is null) -+ { -+ r.current = entry; -+ break; -+ } -+ } -+ } -+} ---- a/src/libphobos/libdruntime/rt/adi.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/adi.d 2014-04-01 16:32:51.000000000 +0100 -@@ -175,13 +175,13 @@ extern (C) wchar[] _adReverseWchar(wchar - break; - - if (stridelo == stridehi) -- { int stmp; -+ { -+ wchar[2] stmp; - - assert(stridelo == 2); -- assert(stmp.sizeof == 2 * (*lo).sizeof); -- stmp = *cast(int*)lo; -- *cast(int*)lo = *cast(int*)hi; -- *cast(int*)hi = stmp; -+ stmp = lo[0 .. 2]; -+ lo[0 .. 2] = hi[0 .. 2]; -+ hi[0 .. 2] = stmp; - lo += stridelo; - hi--; - continue; -@@ -462,6 +462,7 @@ unittest - assert(a == "hello"); - assert(a <= "hello"); - assert(a >= "hello"); -+ assert(a < "я"); - } - - /*************************************** ---- a/src/libphobos/libdruntime/rt/arrayassign.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arrayassign.d 2014-04-01 16:32:51.000000000 +0100 -@@ -33,8 +33,9 @@ extern (C) void[] _d_arrayassign(TypeInf - - if (to.length != from.length) - { -- char[10] tmp1 = void; -- char[10] tmp2 = void; -+ enum len = is(size_t == uint) ? 10 : 20; -+ char[len] tmp1 = void; -+ char[len] tmp2 = void; - string msg = "lengths don't match for array copy, "c; - msg ~= tmp1.uintToString(to.length) ~ " = " ~ tmp2.uintToString(from.length); - throw new Error(msg); -@@ -90,7 +91,8 @@ extern (C) void[] _d_arrayctor(TypeInfo - - if (to.length != from.length) - { -- char[10] tmp = void; -+ enum len = is(size_t == uint) ? 10 : 20; -+ char[len] tmp = void; - string msg = "lengths don't match for array initialization,"c; - msg ~= tmp.uintToString(to.length) ~ " = " ~ tmp.uintToString(from.length); - throw new Error(msg); ---- a/src/libphobos/libdruntime/rt/arraybyte.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arraybyte.d 2014-04-01 16:32:51.000000000 +0100 -@@ -303,7 +303,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -1323,7 +1322,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { ---- a/src/libphobos/libdruntime/rt/arraycat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arraycat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -17,14 +17,14 @@ private - { - import core.stdc.string; - import rt.util.string; -- debug import core.stdc.stdio; -+ debug(PRINTF) import core.stdc.stdio; - } - - extern (C) @trusted nothrow: - - byte[] _d_arraycopy(size_t size, byte[] from, byte[] to) - { -- debug printf("f = %p,%d, t = %p,%d, size = %d\n", -+ debug(PRINTF) printf("f = %p,%d, t = %p,%d, size = %d\n", - from.ptr, from.length, to.ptr, to.length, size); - - if (to.length != from.length) ---- a/src/libphobos/libdruntime/rt/arraydouble.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arraydouble.d 2014-04-01 16:32:51.000000000 +0100 -@@ -65,7 +65,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -178,7 +177,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -1118,7 +1116,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { ---- a/src/libphobos/libdruntime/rt/arrayfloat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arrayfloat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -169,7 +169,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -227,7 +226,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -285,7 +283,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { ---- a/src/libphobos/libdruntime/rt/arrayint.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arrayint.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,5 +1,5 @@ - /** -- * Contains MMX versions of certain operations for dchar, int, and uint ('w', -+ * Contains SSE/MMX versions of certain operations for dchar, int, and uint ('w', - * 'i' and 'k' suffixes). - * - * Copyright: Copyright Digital Mars 2008 - 2010. -@@ -23,19 +23,46 @@ version (unittest) - private import core.stdc.stdio : printf; - /* This is so unit tests will test every CPU variant - */ -- int cpuid; -- const int CPUID_MAX = 4; -- @property bool mmx() { return cpuid == 1 && core.cpuid.mmx; } -- @property bool sse() { return cpuid == 2 && core.cpuid.sse; } -- @property bool sse2() { return cpuid == 3 && core.cpuid.sse2; } -- @property bool amd3dnow() { return cpuid == 4 && core.cpuid.amd3dnow; } -+ uint cpuid; -+ enum CPUID_MAX = 14; -+ @property bool mmx() { return cpuid == 1 && core.cpuid.mmx; } -+ @property bool sse() { return cpuid == 2 && core.cpuid.sse; } -+ @property bool sse2() { return cpuid == 3 && core.cpuid.sse2; } -+ @property bool sse3() { return cpuid == 4 && core.cpuid.sse3; } -+ @property bool sse41() { return cpuid == 5 && core.cpuid.sse41; } -+ @property bool sse42() { return cpuid == 6 && core.cpuid.sse42; } -+ @property bool sse4a() { return cpuid == 7 && core.cpuid.sse4a; } -+ @property bool avx() { return cpuid == 8 && core.cpuid.avx; } -+ @property bool avx2() { return cpuid == 9 && core.cpuid.avx2; } -+ @property bool amd3dnow() { return cpuid == 10 && core.cpuid.amd3dnow; } -+ @property bool and3dnowExt() { return cpuid == 11 && core.cpuid.amd3dnowExt; } -+ @property bool amdMmx() { return cpuid == 12 && core.cpuid.amdMmx; } -+ @property bool has3dnowPrefetch() { return cpuid == 13 && core.cpuid.has3dnowPrefetch; } - } - else - { -- alias core.cpuid.mmx mmx; -- alias core.cpuid.sse sse; -- alias core.cpuid.sse2 sse2; -+ version(X86_64) //guaranteed on x86_64 -+ { -+ enum mmx = true; -+ enum sse = true; -+ enum sse2 = true; -+ } -+ else -+ { -+ alias core.cpuid.mmx mmx; -+ alias core.cpuid.sse sse; -+ alias core.cpuid.sse2 sse2; -+ } -+ alias core.cpuid.sse3 sse3; -+ alias core.cpuid.sse41 sse41; -+ alias core.cpuid.sse42 sse42; -+ alias core.cpuid.sse4a sse4a; -+ alias core.cpuid.avx avx; -+ alias core.cpuid.avx2 avx2; - alias core.cpuid.amd3dnow amd3dnow; -+ alias core.cpuid.amd3dnowExt and3dnowExt; -+ alias core.cpuid.amdMmx amdMmx; -+ alias core.cpuid.has3dnowPrefetch has3dnowPrefetch; - } - - //version = log; -@@ -87,20 +114,18 @@ body - { - auto n = aptr + (a.length & ~7); - -- uint l = value; -- -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) - { - asm // unaligned case - { - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM2, l; -+ movd XMM2,value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2u: -+ startaddsse2u: - add ESI, 32; - movdqu XMM0, [EAX]; - movdqu XMM1, [EAX+16]; -@@ -123,11 +148,11 @@ body - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2a: -+ startaddsse2a: - add ESI, 32; - movdqa XMM0, [EAX]; - movdqa XMM1, [EAX+16]; -@@ -144,13 +169,12 @@ body - } - } - } -- else - // MMX version is 298% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -- ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); -+ ulong l = cast(uint) value | ((cast(ulong)cast(uint) value) << 32); - - asm - { -@@ -160,7 +184,7 @@ body - movq MM2, l; - - align 4; -- startmmx: -+ startmmx: - add ESI, 16; - movq MM0, [EAX]; - movq MM1, [EAX+8]; -@@ -177,33 +201,97 @@ body - mov bptr, EAX; - } - } -- else -- if (a.length >= 2) -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2u: -+ add RSI, 32; -+ movdqu XMM0, [RAX]; -+ movdqu XMM1, [RAX+16]; -+ add RAX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM2,value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2a: -+ add RSI, 32; -+ movdqa XMM0, [RAX]; -+ movdqa XMM1, [RAX+16]; -+ add RAX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) - { -- auto n = aptr + (a.length & ~1); -+ auto n = aptr + (a.length & ~3); -+ -+ ulong l = cast(uint) value | ((cast(ulong)cast(uint) value) << 32); - - asm - { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- mov EDX, value; -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movq MM2, l; - - align 4; -- start386: -- add ESI, 8; -- mov EBX, [EAX]; -- mov ECX, [EAX+4]; -- add EAX, 8; -- add EBX, EDX; -- add ECX, EDX; -- mov [ESI -8], EBX; -- mov [ESI+4-8], ECX; -- cmp ESI, EDI; -- jb start386; -+ startmmx: -+ add RSI, 16; -+ movq MM0, [RAX]; -+ movq MM1, [RAX+8]; -+ add RAX, 16; -+ paddd MM0, MM2; -+ paddd MM1, MM2; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; - -- mov aptr, ESI; -- mov bptr, EAX; -+ emms; -+ mov aptr, RSI; -+ mov bptr, RAX; - } - } - } -@@ -227,15 +315,13 @@ unittest - const int dim = 67; - T[] a = new T[dim + j]; // aligned on 16 byte boundary - a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; - T[] c = new T[dim + j]; - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ c[i] = cast(T)((i-10) * 2); - } - - c[] = a[] + 6; -@@ -273,10 +359,9 @@ T[] _arraySliceSliceAddSliceAssign_k(T[] - T[] _arraySliceSliceAddSliceAssign_i(T[] a, T[] c, T[] b) - in - { -- assert(a.length == b.length && b.length == c.length); -- assert(disjoint(a, b)); -- assert(disjoint(a, c)); -- assert(disjoint(b, c)); -+ assert(a.length == b.length && b.length == c.length); -+ assert(disjoint(a, b)); -+ assert(disjoint(a, c)); - } - body - { -@@ -293,7 +378,7 @@ body - { - auto n = aptr + (a.length & ~7); - -- if (((cast(uint) aptr | cast(uint) bptr | cast(uint) cptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) != 0) - { - asm // unaligned case - { -@@ -303,7 +388,7 @@ body - mov ECX, cptr; - - align 4; -- startsse2u: -+ startsse2u: - add ESI, 32; - movdqu XMM0, [EAX]; - movdqu XMM2, [ECX]; -@@ -333,7 +418,7 @@ body - mov ECX, cptr; - - align 4; -- startsse2a: -+ startsse2a: - add ESI, 32; - movdqa XMM0, [EAX]; - movdqa XMM2, [ECX]; -@@ -354,9 +439,8 @@ body - } - } - } -- else - // MMX version is 995% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -368,7 +452,7 @@ body - mov ECX, cptr; - - align 4; -- startmmx: -+ startmmx: - add ESI, 16; - movq MM0, [EAX]; - movq MM2, [ECX]; -@@ -390,8 +474,108 @@ body - } - } - } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse2u: -+ add RSI, 32; -+ movdqu XMM0, [RAX]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RAX+16]; -+ movdqu XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse2a: -+ add RSI, 32; -+ movdqa XMM0, [RAX]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RAX+16]; -+ movdqa XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) -+ { -+ auto n = aptr + (a.length & ~3); -+ -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startmmx: -+ add RSI, 16; -+ movq MM0, [RAX]; -+ movq MM2, [RCX]; -+ movq MM1, [RAX+8]; -+ movq MM3, [RCX+8]; -+ add RAX, 16; -+ add RCX, 16; -+ paddd MM0, MM2; -+ paddd MM1, MM3; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; -+ -+ emms; -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ } - --normal: - while (aptr < aend) - *aptr++ = *bptr++ + *cptr++; - -@@ -417,9 +601,10 @@ unittest - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); - } - - c[] = a[] + b[]; -@@ -467,19 +652,17 @@ T[] _arrayExpSliceAddass_i(T[] a, T valu - { - auto n = aptr + (a.length & ~7); - -- uint l = value; -- -- if (((cast(uint) aptr) & 15) != 0) -+ if (((cast(size_t) aptr) & 15) != 0) - { - asm // unaligned case - { - mov ESI, aptr; - mov EDI, n; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2u: -+ startaddsse2u: - movdqu XMM0, [ESI]; - movdqu XMM1, [ESI+16]; - add ESI, 32; -@@ -499,11 +682,11 @@ T[] _arrayExpSliceAddass_i(T[] a, T valu - { - mov ESI, aptr; - mov EDI, n; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2a: -+ startaddsse2a: - movdqa XMM0, [ESI]; - movdqa XMM1, [ESI+16]; - add ESI, 32; -@@ -518,9 +701,8 @@ T[] _arrayExpSliceAddass_i(T[] a, T valu - } - } - } -- else - // MMX version is 81% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -533,7 +715,7 @@ T[] _arrayExpSliceAddass_i(T[] a, T valu - movq MM2, l; - - align 4; -- startmmx: -+ startmmx: - movq MM0, [ESI]; - movq MM1, [ESI+8]; - add ESI, 16; -@@ -548,30 +730,88 @@ T[] _arrayExpSliceAddass_i(T[] a, T valu - mov aptr, ESI; - } - } -- else -- if (a.length >= 2) -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM1, [RSI+16]; -+ add RSI, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2u; -+ -+ mov aptr, RSI; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM1, [RSI+16]; -+ add RSI, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2a; -+ -+ mov aptr, RSI; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) - { -- auto n = aptr + (a.length & ~1); -+ auto n = aptr + (a.length & ~3); -+ -+ ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); - - asm - { -- mov ESI, aptr; -- mov EDI, n; -- mov EDX, value; -+ mov RSI, aptr; -+ mov RDI, n; -+ movq MM2, l; - - align 4; -- start386: -- mov EBX, [ESI]; -- mov ECX, [ESI+4]; -- add ESI, 8; -- add EBX, EDX; -- add ECX, EDX; -- mov [ESI -8], EBX; -- mov [ESI+4-8], ECX; -- cmp ESI, EDI; -- jb start386; -+ startmmx: -+ movq MM0, [RSI]; -+ movq MM1, [RSI+8]; -+ add RSI, 16; -+ paddd MM0, MM2; -+ paddd MM1, MM2; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; - -- mov aptr, ESI; -+ emms; -+ mov aptr, RSI; - } - } - } -@@ -595,15 +835,13 @@ unittest - const int dim = 67; - T[] a = new T[dim + j]; // aligned on 16 byte boundary - a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; - T[] c = new T[dim + j]; - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ c[i] = cast(T)((i-10) * 2); - } - - a[] = c[]; -@@ -659,7 +897,7 @@ body - { - auto n = aptr + (a.length & ~7); - -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) - { - asm // unaligned case - { -@@ -668,7 +906,7 @@ body - mov ECX, bptr; - - align 4; -- startsse2u: -+ startsse2u: - movdqu XMM0, [ESI]; - movdqu XMM2, [ECX]; - movdqu XMM1, [ESI+16]; -@@ -695,7 +933,7 @@ body - mov ECX, bptr; - - align 4; -- startsse2a: -+ startsse2a: - movdqa XMM0, [ESI]; - movdqa XMM2, [ECX]; - movdqa XMM1, [ESI+16]; -@@ -714,9 +952,8 @@ body - } - } - } -- else - // MMX version is 471% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -727,7 +964,7 @@ body - mov ECX, bptr; - - align 4; -- startmmx: -+ startmmx: - movq MM0, [ESI]; - movq MM2, [ECX]; - movq MM1, [ESI+8]; -@@ -747,8 +984,100 @@ body - } - } - } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse2u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RSI+16]; -+ movdqu XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse2a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RSI+16]; -+ movdqa XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ paddd XMM0, XMM2; -+ paddd XMM1, XMM3; -+ movdqa [RSI-32], XMM0; -+ movdqa [RSI-16], XMM1; -+ -+ cmp RSI, RDI; -+ jb startsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) -+ { -+ auto n = aptr + (a.length & ~3); -+ -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startmmx: -+ movq MM0, [RSI]; -+ movq MM2, [RCX]; -+ movq MM1, [RSI+8]; -+ movq MM3, [RCX+8]; -+ add RSI, 16; -+ add RCX, 16; -+ paddd MM0, MM2; -+ paddd MM1, MM3; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; -+ -+ emms; -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ } - --normal: - while (aptr < aend) - *aptr++ += *bptr++; - -@@ -774,9 +1103,10 @@ unittest - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); - } - - b[] = c[]; -@@ -832,20 +1162,18 @@ body - { - auto n = aptr + (a.length & ~7); - -- uint l = value; -- -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) - { - asm // unaligned case - { - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2u: -+ startaddsse2u: - add ESI, 32; - movdqu XMM0, [EAX]; - movdqu XMM1, [EAX+16]; -@@ -868,11 +1196,11 @@ body - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2a: -+ startaddsse2a: - add ESI, 32; - movdqa XMM0, [EAX]; - movdqa XMM1, [EAX+16]; -@@ -889,9 +1217,8 @@ body - } - } - } -- else - // MMX version is 315% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -905,7 +1232,7 @@ body - movq MM2, l; - - align 4; -- startmmx: -+ startmmx: - add ESI, 16; - movq MM0, [EAX]; - movq MM1, [EAX+8]; -@@ -922,33 +1249,97 @@ body - mov bptr, EAX; - } - } -- else -- if (a.length >= 2) -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2u: -+ add RSI, 32; -+ movdqu XMM0, [EAX]; -+ movdqu XMM1, [EAX+16]; -+ add RAX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2a: -+ add RSI, 32; -+ movdqa XMM0, [EAX]; -+ movdqa XMM1, [EAX+16]; -+ add RAX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) - { -- auto n = aptr + (a.length & ~1); -+ auto n = aptr + (a.length & ~3); -+ -+ ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); - - asm - { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- mov EDX, value; -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movq MM2, l; - - align 4; -- start386: -- add ESI, 8; -- mov EBX, [EAX]; -- mov ECX, [EAX+4]; -- add EAX, 8; -- sub EBX, EDX; -- sub ECX, EDX; -- mov [ESI -8], EBX; -- mov [ESI+4-8], ECX; -- cmp ESI, EDI; -- jb start386; -+ startmmx: -+ add RSI, 16; -+ movq MM0, [EAX]; -+ movq MM1, [EAX+8]; -+ add RAX, 16; -+ psubd MM0, MM2; -+ psubd MM1, MM2; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; - -- mov aptr, ESI; -- mov bptr, EAX; -+ emms; -+ mov aptr, RSI; -+ mov bptr, RAX; - } - } - } -@@ -972,15 +1363,13 @@ unittest - const int dim = 67; - T[] a = new T[dim + j]; // aligned on 16 byte boundary - a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; - T[] c = new T[dim + j]; - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ c[i] = cast(T)((i-10) * 2); - } - - c[] = a[] - 6; -@@ -1035,20 +1424,18 @@ body - { - auto n = aptr + (a.length & ~7); - -- uint l = value; -- -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) - { - asm // unaligned case - { - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM4, l; -+ movd XMM4, value; - pshufd XMM4, XMM4, 0; - - align 4; -- startaddsse2u: -+ startaddsse2u: - add ESI, 32; - movdqu XMM2, [EAX]; - movdqu XMM3, [EAX+16]; -@@ -1073,11 +1460,11 @@ body - mov ESI, aptr; - mov EDI, n; - mov EAX, bptr; -- movd XMM4, l; -+ movd XMM4, value; - pshufd XMM4, XMM4, 0; - - align 4; -- startaddsse2a: -+ startaddsse2a: - add ESI, 32; - movdqa XMM2, [EAX]; - movdqa XMM3, [EAX+16]; -@@ -1096,9 +1483,8 @@ body - } - } - } -- else - // MMX version is 1077% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -1112,7 +1498,7 @@ body - movq MM4, l; - - align 4; -- startmmx: -+ startmmx: - add ESI, 16; - movq MM2, [EAX]; - movq MM3, [EAX+8]; -@@ -1132,11 +1518,110 @@ body - } - } - } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); - -- while (aptr < aend) -- *aptr++ = value - *bptr++; -- -- return a; -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM4, value; -+ pshufd XMM4, XMM4, 0; -+ -+ align 4; -+ startaddsse2u: -+ add RSI, 32; -+ movdqu XMM2, [RAX]; -+ movdqu XMM3, [RAX+16]; -+ movdqa XMM0, XMM4; -+ movdqa XMM1, XMM4; -+ add RAX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM4, value; -+ pshufd XMM4, XMM4, 0; -+ -+ align 4; -+ startaddsse2a: -+ add RSI, 32; -+ movdqa XMM2, [EAX]; -+ movdqa XMM3, [EAX+16]; -+ movdqa XMM0, XMM4; -+ movdqa XMM1, XMM4; -+ add RAX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) -+ { -+ auto n = aptr + (a.length & ~3); -+ -+ ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); -+ -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movq MM4, l; -+ -+ align 4; -+ startmmx: -+ add RSI, 16; -+ movq MM2, [EAX]; -+ movq MM3, [EAX+8]; -+ movq MM0, MM4; -+ movq MM1, MM4; -+ add RAX, 16; -+ psubd MM0, MM2; -+ psubd MM1, MM3; -+ movq [ESI -16], MM0; -+ movq [ESI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; -+ -+ emms; -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ } -+ -+ while (aptr < aend) -+ *aptr++ = value - *bptr++; -+ -+ return a; - } - - unittest -@@ -1152,15 +1637,13 @@ unittest - const int dim = 67; - T[] a = new T[dim + j]; // aligned on 16 byte boundary - a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; - T[] c = new T[dim + j]; - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ c[i] = cast(T)((i-10) * 2); - } - - c[] = 6 - a[]; -@@ -1198,10 +1681,9 @@ T[] _arraySliceSliceMinSliceAssign_k(T[] - T[] _arraySliceSliceMinSliceAssign_i(T[] a, T[] c, T[] b) - in - { -- assert(a.length == b.length && b.length == c.length); -- assert(disjoint(a, b)); -- assert(disjoint(a, c)); -- assert(disjoint(b, c)); -+ assert(a.length == b.length && b.length == c.length); -+ assert(disjoint(a, b)); -+ assert(disjoint(a, c)); - } - body - { -@@ -1217,7 +1699,7 @@ body - { - auto n = aptr + (a.length & ~7); - -- if (((cast(uint) aptr | cast(uint) bptr | cast(uint) cptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) != 0) - { - asm // unaligned case - { -@@ -1227,7 +1709,7 @@ body - mov ECX, cptr; - - align 4; -- startsse2u: -+ startsse2u: - add ESI, 32; - movdqu XMM0, [EAX]; - movdqu XMM2, [ECX]; -@@ -1257,7 +1739,7 @@ body - mov ECX, cptr; - - align 4; -- startsse2a: -+ startsse2a: - add ESI, 32; - movdqa XMM0, [EAX]; - movdqa XMM2, [ECX]; -@@ -1278,9 +1760,8 @@ body - } - } - } -- else - // MMX version is 1002% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -1292,7 +1773,7 @@ body - mov ECX, cptr; - - align 4; -- startmmx: -+ startmmx: - add ESI, 16; - movq MM0, [EAX]; - movq MM2, [ECX]; -@@ -1314,6 +1795,107 @@ body - } - } - } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse2u: -+ add RSI, 32; -+ movdqu XMM0, [RAX]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RAX+16]; -+ movdqu XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse2a: -+ add RSI, 32; -+ movdqa XMM0, [RAX]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RAX+16]; -+ movdqa XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) -+ { -+ auto n = aptr + (a.length & ~3); -+ -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startmmx: -+ add RSI, 16; -+ movq MM0, [RAX]; -+ movq MM2, [RCX]; -+ movq MM1, [RAX+8]; -+ movq MM3, [RCX+8]; -+ add RAX, 16; -+ add RCX, 16; -+ psubd MM0, MM2; -+ psubd MM1, MM3; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; -+ -+ emms; -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ } - - while (aptr < aend) - *aptr++ = *bptr++ - *cptr++; -@@ -1340,9 +1922,10 @@ unittest - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); - } - - c[] = a[] - b[]; -@@ -1390,19 +1973,17 @@ T[] _arrayExpSliceMinass_i(T[] a, T valu - { - auto n = aptr + (a.length & ~7); - -- uint l = value; -- -- if (((cast(uint) aptr) & 15) != 0) -+ if (((cast(size_t) aptr) & 15) != 0) - { - asm // unaligned case - { - mov ESI, aptr; - mov EDI, n; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2u: -+ startaddsse2u: - movdqu XMM0, [ESI]; - movdqu XMM1, [ESI+16]; - add ESI, 32; -@@ -1422,11 +2003,11 @@ T[] _arrayExpSliceMinass_i(T[] a, T valu - { - mov ESI, aptr; - mov EDI, n; -- movd XMM2, l; -+ movd XMM2, value; - pshufd XMM2, XMM2, 0; - - align 4; -- startaddsse2a: -+ startaddsse2a: - movdqa XMM0, [ESI]; - movdqa XMM1, [ESI+16]; - add ESI, 32; -@@ -1441,9 +2022,8 @@ T[] _arrayExpSliceMinass_i(T[] a, T valu - } - } - } -- else - // MMX version is 81% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -1456,7 +2036,7 @@ T[] _arrayExpSliceMinass_i(T[] a, T valu - movq MM2, l; - - align 4; -- startmmx: -+ startmmx: - movq MM0, [ESI]; - movq MM1, [ESI+8]; - add ESI, 16; -@@ -1471,30 +2051,88 @@ T[] _arrayExpSliceMinass_i(T[] a, T valu - mov aptr, ESI; - } - } -- else -- if (a.length >= 2) -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM1, [RSI+16]; -+ add RSI, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2u; -+ -+ mov aptr, RSI; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startaddsse2a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM1, [RSI+16]; -+ add RSI, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startaddsse2a; -+ -+ mov aptr, RSI; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) - { -- auto n = aptr + (a.length & ~1); -+ auto n = aptr + (a.length & ~3); -+ -+ ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); - - asm - { -- mov ESI, aptr; -- mov EDI, n; -- mov EDX, value; -+ mov RSI, aptr; -+ mov RDI, n; -+ movq MM2, l; - - align 4; -- start386: -- mov EBX, [ESI]; -- mov ECX, [ESI+4]; -- add ESI, 8; -- sub EBX, EDX; -- sub ECX, EDX; -- mov [ESI -8], EBX; -- mov [ESI+4-8], ECX; -- cmp ESI, EDI; -- jb start386; -+ startmmx: -+ movq MM0, [RSI]; -+ movq MM1, [RSI+8]; -+ add RSI, 16; -+ psubd MM0, MM2; -+ psubd MM1, MM2; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; - -- mov aptr, ESI; -+ emms; -+ mov aptr, RSI; - } - } - } -@@ -1518,15 +2156,13 @@ unittest - const int dim = 67; - T[] a = new T[dim + j]; // aligned on 16 byte boundary - a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; - T[] c = new T[dim + j]; - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ c[i] = cast(T)((i-10) * 2); - } - - a[] = c[]; -@@ -1582,7 +2218,7 @@ body - { - auto n = aptr + (a.length & ~7); - -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) - { - asm // unaligned case - { -@@ -1591,7 +2227,7 @@ body - mov ECX, bptr; - - align 4; -- startsse2u: -+ startsse2u: - movdqu XMM0, [ESI]; - movdqu XMM2, [ECX]; - movdqu XMM1, [ESI+16]; -@@ -1618,7 +2254,7 @@ body - mov ECX, bptr; - - align 4; -- startsse2a: -+ startsse2a: - movdqa XMM0, [ESI]; - movdqa XMM2, [ECX]; - movdqa XMM1, [ESI+16]; -@@ -1637,9 +2273,8 @@ body - } - } - } -- else - // MMX version is 441% faster -- if (mmx && a.length >= 4) -+ else if (mmx && a.length >= 4) - { - auto n = aptr + (a.length & ~3); - -@@ -1650,7 +2285,7 @@ body - mov ECX, bptr; - - align 4; -- startmmx: -+ startmmx: - movq MM0, [ESI]; - movq MM2, [ECX]; - movq MM1, [ESI+8]; -@@ -1670,6 +2305,98 @@ body - } - } - } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse2 && a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (((cast(size_t) aptr | cast(size_t) bptr) & 15) != 0) -+ { -+ asm // unaligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse2u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RSI+16]; -+ movdqu XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2u; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ else -+ { -+ asm // aligned case -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse2a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RSI+16]; -+ movdqa XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ psubd XMM0, XMM2; -+ psubd XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse2a; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ } -+ else if (mmx && a.length >= 4) -+ { -+ auto n = aptr + (a.length & ~3); -+ -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startmmx: -+ movq MM0, [RSI]; -+ movq MM2, [RCX]; -+ movq MM1, [RSI+8]; -+ movq MM3, [RCX+8]; -+ add RSI, 16; -+ add RCX, 16; -+ psubd MM0, MM2; -+ psubd MM1, MM3; -+ movq [RSI -16], MM0; -+ movq [RSI+8-16], MM1; -+ cmp RSI, RDI; -+ jb startmmx; -+ -+ emms; -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ } - - while (aptr < aend) - *aptr++ -= *bptr++; -@@ -1696,9 +2423,10 @@ unittest - c = c[j .. dim + j]; - - for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); - } - - b[] = c[]; -@@ -1747,112 +2475,229 @@ body - auto aend = aptr + a.length; - auto bptr = b.ptr; - -- version (none) // multiplying a pair is not supported by MMX -- { - version (D_InlineAsm_X86) - { -- // SSE2 aligned version is 1380% faster -- if (sse2 && a.length >= 8) -+ if (sse41) - { -- auto n = aptr + (a.length & ~7); -- -- uint l = value; -- -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -- { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- movd XMM2, l; -- pshufd XMM2, XMM2, 0; -- -- align 4; -- startsse2u: -- add ESI, 32; -- movdqu XMM0, [EAX]; -- movdqu XMM1, [EAX+16]; -- add EAX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM2; -- movdqu [ESI -32], XMM0; -- movdqu [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2u; -+ auto aligned = ((cast(size_t) aptr | cast(size_t) bptr) & 15) == 0; - -- mov aptr, ESI; -- mov bptr, EAX; -- } -- } -- else -+ if (a.length >= 8) - { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- movd XMM2, l; -- pshufd XMM2, XMM2, 0; -- -- align 4; -- startsse2a: -- add ESI, 32; -- movdqa XMM0, [EAX]; -- movdqa XMM1, [EAX+16]; -- add EAX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM2; -- movdqa [ESI -32], XMM0; -- movdqa [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2a; -+ auto n = aptr + (a.length & ~7); - -- mov aptr, ESI; -- mov bptr, EAX; -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov EAX, bptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41u: -+ add ESI, 32; -+ movdqu XMM0, [EAX]; -+ movdqu XMM1, [EAX+16]; -+ add EAX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqu [ESI -32], XMM0; -+ movdqu [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41u; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov EAX, bptr; -+ movd XMM1, value; -+ pshufd XMM2, XMM1, 0; -+ -+ align 4; -+ startsse41a: -+ add ESI, 32; -+ movdqa XMM0, [EAX]; -+ movdqa XMM1, [EAX+16]; -+ add EAX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqa [ESI -32], XMM0; -+ movdqa [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41a; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EAX, bptr; -+ movd XMM1,value; -+ pshufd XMM1, XMM1, 0; -+ -+ movdqu XMM0, [EAX]; -+ pmulld XMM0, XMM1; -+ movdqu [ESI], XMM0; -+ -+ add EAX, 16; -+ add ESI, 16; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EAX, bptr; -+ movd XMM1,value; -+ pshufd XMM1, XMM1, 0; -+ -+ movdqa XMM0, [EAX]; -+ pmulld XMM0, XMM1; -+ movdqa [ESI], XMM0; -+ -+ add EAX, 16; -+ add ESI, 16; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ } -+ } -+ } -+ } -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse41) -+ { -+ auto aligned = ((cast(size_t) aptr | cast(size_t) bptr) & 15) == 0; -+ -+ if (a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (!aligned) -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41u: -+ add RSI, 32; -+ movdqu XMM0, [RAX]; -+ movdqu XMM1, [RAX+16]; -+ add RAX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ movd XMM1, value; -+ pshufd XMM2, XMM1, 0; -+ -+ align 4; -+ startsse41a: -+ add RSI, 32; -+ movdqa XMM0, [RAX]; -+ movdqa XMM1, [RAX+16]; -+ add RAX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ {//possibly slow, needs measuring -+ asm -+ { -+ mov RSI, aptr; -+ mov RAX, bptr; -+ movd XMM1, value; -+ pshufd XMM1, XMM1, 0; -+ -+ movdqu XMM0, [RAX]; -+ pmulld XMM0, XMM1; -+ movdqu [RSI], XMM0; -+ -+ add RAX, 16; -+ add RSI, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RAX, bptr; -+ movd XMM1, value; -+ pshufd XMM1, XMM1, 0; -+ -+ movdqa XMM0, [RAX]; -+ pmulld XMM0, XMM1; -+ movdqa [RSI], XMM0; -+ -+ add RAX, 16; -+ add RSI, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ } - } - } - } -- else -- { -- // MMX version is 1380% faster -- if (mmx && a.length >= 4) -- { -- auto n = aptr + (a.length & ~3); -+ } - -- ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); -- -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- movq MM2, l; -- -- align 4; -- startmmx: -- add ESI, 16; -- movq MM0, [EAX]; -- movq MM1, [EAX+8]; -- add EAX, 16; -- pmuludq MM0, MM2; // only multiplies low 32 bits -- pmuludq MM1, MM2; -- movq [ESI -16], MM0; -- movq [ESI+8-16], MM1; -- cmp ESI, EDI; -- jb startmmx; -- -- emms; -- mov aptr, ESI; -- mov bptr, EAX; -- } -- } -- } -- } -- } -- -- while (aptr < aend) -- *aptr++ = *bptr++ * value; -+ while (aptr < aend) -+ *aptr++ = *bptr++ * value; - - return a; - } -@@ -1864,35 +2709,31 @@ unittest - for (cpuid = 0; cpuid < CPUID_MAX; cpuid++) - { - version (log) printf(" cpuid %d\n", cpuid); -+ for (size_t dim = 7; dim < 68; dim += 60) -+ for (int j = 0; j < 2; j++) -+ { -+ T[] b = new T[dim + j]; // aligned on 16 byte boundary -+ b = b[j .. dim + j]; // misalign for second iteration -+ T[] c = new T[dim + j]; -+ c = c[j .. dim + j]; - -- for (int j = 0; j < 2; j++) -- { -- const int dim = 67; -- T[] a = new T[dim + j]; // aligned on 16 byte boundary -- a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; -- T[] c = new T[dim + j]; -- c = c[j .. dim + j]; -- -- for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -- } -- -- c[] = a[] * 6; -+ for (int i = 0; i < dim; i++) -+ { -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); -+ } - -- for (int i = 0; i < dim; i++) -- { -- //printf("[%d]: %d ?= %d * 6\n", i, c[i], a[i]); -- if (c[i] != cast(T)(a[i] * 6)) -+ c[] = b[] * 6; -+ for (int i = 0; i < dim; i++) - { -- printf("[%d]: %d != %d * 6\n", i, c[i], a[i]); -- assert(0); -+ //printf("[%d]: %d ?= %d * 6\n", i, c[i], b[i]); -+ if (c[i] != cast(T)(b[i] * 6)) -+ { -+ printf("[%d]: %d != %d * 6\n", i, c[i], b[i]); -+ assert(0); -+ } - } - } -- } - } - } - -@@ -1917,10 +2758,9 @@ T[] _arraySliceSliceMulSliceAssign_k(T[] - T[] _arraySliceSliceMulSliceAssign_i(T[] a, T[] c, T[] b) - in - { -- assert(a.length == b.length && b.length == c.length); -- assert(disjoint(a, b)); -- assert(disjoint(a, c)); -- assert(disjoint(b, c)); -+ assert(a.length == b.length && b.length == c.length); -+ assert(disjoint(a, b)); -+ assert(disjoint(a, c)); - } - body - { -@@ -1930,113 +2770,247 @@ body - auto bptr = b.ptr; - auto cptr = c.ptr; - -- version (none) -- { - version (D_InlineAsm_X86) - { -- // SSE2 aligned version is 1407% faster -- if (sse2 && a.length >= 8) -+ if (sse41) - { -- auto n = aptr + (a.length & ~7); -+ auto aligned = ((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) == 0; - -- if (((cast(uint) aptr | cast(uint) bptr | cast(uint) cptr) & 15) != 0) -+ if (a.length >= 8) - { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- mov ECX, cptr; -- -- align 4; -- startsse2u: -- add ESI, 32; -- movdqu XMM0, [EAX]; -- movdqu XMM2, [ECX]; -- movdqu XMM1, [EAX+16]; -- movdqu XMM3, [ECX+16]; -- add EAX, 32; -- add ECX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM3; -- movdqu [ESI -32], XMM0; -- movdqu [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2u; -+ auto n = aptr + (a.length & ~7); - -- mov aptr, ESI; -- mov bptr, EAX; -- mov cptr, ECX; -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov EAX, bptr; -+ mov ECX, cptr; -+ -+ align 4; -+ startsse41u: -+ add ESI, 32; -+ movdqu XMM0, [EAX]; -+ movdqu XMM2, [ECX]; -+ movdqu XMM1, [EAX+16]; -+ movdqu XMM3, [ECX+16]; -+ add EAX, 32; -+ add ECX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqu [ESI -32], XMM0; -+ movdqu [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41u; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ mov cptr, ECX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov EAX, bptr; -+ mov ECX, cptr; -+ -+ align 4; -+ startsse41a: -+ add ESI, 32; -+ movdqa XMM0, [EAX]; -+ movdqa XMM2, [ECX]; -+ movdqa XMM1, [EAX+16]; -+ movdqa XMM3, [ECX+16]; -+ add EAX, 32; -+ add ECX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqa [ESI -32], XMM0; -+ movdqa [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41a; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ mov cptr, ECX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ {//possibly not a good idea. Performance? -+ asm -+ { -+ mov ESI, aptr; -+ mov EAX, bptr; -+ mov ECX, cptr; -+ -+ movdqu XMM0, [EAX]; -+ movdqu XMM1, [ECX]; -+ pmulld XMM0, XMM1; -+ movdqu [ESI], XMM0; -+ -+ add ESI, 16; -+ add EAX, 16; -+ add ECX, 16; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ mov cptr, ECX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EAX, bptr; -+ mov ECX, cptr; -+ -+ movdqa XMM0, [EAX]; -+ movdqa XMM1, [ECX]; -+ pmulld XMM0, XMM1; -+ movdqu [ESI], XMM0; -+ -+ add ESI, 16; -+ add EAX, 16; -+ add ECX, 16; -+ -+ mov aptr, ESI; -+ mov bptr, EAX; -+ mov cptr, ECX; -+ } -+ } -+ } -+ } -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse41) -+ { -+ auto aligned = ((cast(size_t) aptr | cast(size_t) bptr | cast(size_t) cptr) & 15) == 0; -+ -+ if (a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (!aligned) -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse41u: -+ add RSI, 32; -+ movdqu XMM0, [RAX]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RAX+16]; -+ movdqu XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41u; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ align 4; -+ startsse41a: -+ add RSI, 32; -+ movdqa XMM0, [RAX]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RAX+16]; -+ movdqa XMM3, [RCX+16]; -+ add RAX, 32; -+ add RCX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41a; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ {//possibly not a good idea. Performance? -+ asm -+ { -+ mov RSI, aptr; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ movdqu XMM0, [RAX]; -+ movdqu XMM1, [RCX]; -+ pmulld XMM0, XMM1; -+ movdqu [RSI], XMM0; -+ -+ add RSI, 16; -+ add RAX, 16; -+ add RCX, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RAX, bptr; -+ mov RCX, cptr; -+ -+ movdqa XMM0, [RAX]; -+ movdqa XMM1, [RCX]; -+ pmulld XMM0, XMM1; -+ movdqu [RSI], XMM0; -+ -+ add RSI, 16; -+ add RAX, 16; -+ add RCX, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RAX; -+ mov cptr, RCX; -+ } - } - } -- else -- { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- mov ECX, cptr; -- -- align 4; -- startsse2a: -- add ESI, 32; -- movdqa XMM0, [EAX]; -- movdqa XMM2, [ECX]; -- movdqa XMM1, [EAX+16]; -- movdqa XMM3, [ECX+16]; -- add EAX, 32; -- add ECX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM3; -- movdqa [ESI -32], XMM0; -- movdqa [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2a; -- -- mov aptr, ESI; -- mov bptr, EAX; -- mov cptr, ECX; -- } -- } -- } -- else -- // MMX version is 1029% faster -- if (mmx && a.length >= 4) -- { -- auto n = aptr + (a.length & ~3); -- -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov EAX, bptr; -- mov ECX, cptr; -- -- align 4; -- startmmx: -- add ESI, 16; -- movq MM0, [EAX]; -- movq MM2, [ECX]; -- movq MM1, [EAX+8]; -- movq MM3, [ECX+8]; -- add EAX, 16; -- add ECX, 16; -- pmuludq MM0, MM2; -- pmuludq MM1, MM3; -- movq [ESI -16], MM0; -- movq [ESI+8-16], MM1; -- cmp ESI, EDI; -- jb startmmx; -- -- emms; -- mov aptr, ESI; -- mov bptr, EAX; -- mov cptr, ECX; -- } - } - } -- } -+ - - while (aptr < aend) - *aptr++ = *bptr++ * *cptr++; -@@ -2051,31 +3025,33 @@ unittest - for (cpuid = 0; cpuid < CPUID_MAX; cpuid++) - { - version (log) printf(" cpuid %d\n", cpuid); -- -- for (int j = 0; j < 2; j++) -+ for (size_t dim = 7; dim < 68; dim += 60) - { -- const int dim = 67; -- T[] a = new T[dim + j]; // aligned on 16 byte boundary -- a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; -- T[] c = new T[dim + j]; -- c = c[j .. dim + j]; -+ for (int j = 0; j < 2; j++) -+ { -+ T[] a = new T[dim + j]; // aligned on 16 byte boundary -+ a = a[j .. dim + j]; // misalign for second iteration -+ T[] b = new T[dim + j]; -+ b = b[j .. dim + j]; -+ T[] c = new T[dim + j]; -+ c = c[j .. dim + j]; - -- for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -- } -+ for (int i = 0; i < dim; i++) -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); -+ } - -- c[] = a[] * b[]; -+ c[] = a[] * b[]; - -- for (int i = 0; i < dim; i++) -- { -- if (c[i] != cast(T)(a[i] * b[i])) -+ for (int i = 0; i < dim; i++) - { -- printf("[%d]: %d != %d * %d\n", i, c[i], a[i], b[i]); -- assert(0); -+ if (c[i] != cast(T)(a[i] * b[i])) -+ { -+ printf("[%d]: %d != %d * %d\n", i, c[i], a[i], b[i]); -+ assert(0); -+ } - } - } - } -@@ -2106,98 +3082,198 @@ T[] _arrayExpSliceMulass_i(T[] a, T valu - auto aptr = a.ptr; - auto aend = aptr + a.length; - -- version (none) -- { - version (D_InlineAsm_X86) - { -- // SSE2 aligned version is 400% faster -- if (sse2 && a.length >= 8) -+ if (sse41) - { -- auto n = aptr + (a.length & ~7); -- -- uint l = value; -+ auto aligned = ((cast(size_t) aptr) & 15) == 0; - -- if (((cast(uint) aptr) & 15) != 0) -+ if (a.length >= 8) - { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- movd XMM2, l; -- pshufd XMM2, XMM2, 0; -+ auto n = aptr + (a.length & ~7); - -- align 4; -- startsse2u: -- movdqu XMM0, [ESI]; -- movdqu XMM1, [ESI+16]; -- add ESI, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM2; -- movdqu [ESI -32], XMM0; -- movdqu [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2u; -- -- mov aptr, ESI; -- } -- } -- else -- { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- movd XMM2, l; -- pshufd XMM2, XMM2, 0; -- -- align 4; -- startsse2a: -- movdqa XMM0, [ESI]; -- movdqa XMM1, [ESI+16]; -- add ESI, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM2; -- movdqa [ESI -32], XMM0; -- movdqa [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2a; -- -- mov aptr, ESI; -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ movd XMM2,value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41u: -+ movdqu XMM0, [ESI]; -+ movdqu XMM1, [ESI+16]; -+ add ESI, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqu [ESI -32], XMM0; -+ movdqu [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41u; -+ -+ mov aptr, ESI; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ movd XMM2,value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41a: -+ movdqa XMM0, [ESI]; -+ movdqa XMM1, [ESI+16]; -+ add ESI, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqa [ESI -32], XMM0; -+ movdqa [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41a; -+ -+ mov aptr, ESI; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ movd XMM2,value; -+ pshufd XMM2, XMM2, 0; -+ -+ movdqu XMM0, [ESI]; -+ pmulld XMM0, XMM2; -+ movdqu [ESI], XMM0; -+ -+ add ESI, 16; -+ mov aptr, ESI; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ movd XMM2,value; -+ pshufd XMM2, XMM2, 0; -+ -+ movdqa XMM0, [ESI]; -+ pmulld XMM0, XMM2; -+ movdqa [ESI], XMM0; -+ -+ add ESI, 16; -+ mov aptr, ESI; -+ } -+ } -+ } -+ } -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse41) -+ { -+ auto aligned = ((cast(size_t) aptr) & 15) == 0; -+ -+ if (a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (!aligned) -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM1, [RSI+16]; -+ add RSI, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41u; -+ -+ mov aptr, RSI; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ align 4; -+ startsse41a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM1, [RSI+16]; -+ add RSI, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM2; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41a; -+ -+ mov aptr, RSI; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ { //is the overhead worth it? -+ asm -+ { -+ mov RSI, aptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ movdqu XMM0, [RSI]; -+ pmulld XMM0, XMM2; -+ movdqu [RSI], XMM0; -+ -+ add RSI, 16; -+ mov aptr, RSI; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ movd XMM2, value; -+ pshufd XMM2, XMM2, 0; -+ -+ movdqa XMM0, [RSI]; -+ pmulld XMM0, XMM2; -+ movdqa [RSI], XMM0; -+ -+ add RSI, 16; -+ mov aptr, RSI; -+ } - } - } - } -- else -- // MMX version is 402% faster -- if (mmx && a.length >= 4) -- { -- auto n = aptr + (a.length & ~3); -- -- ulong l = cast(uint) value | (cast(ulong)cast(uint) value << 32); -- -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- movq MM2, l; -- -- align 4; -- startmmx: -- movq MM0, [ESI]; -- movq MM1, [ESI+8]; -- add ESI, 16; -- pmuludq MM0, MM2; -- pmuludq MM1, MM2; -- movq [ESI -16], MM0; -- movq [ESI+8-16], MM1; -- cmp ESI, EDI; -- jb startmmx; -- -- emms; -- mov aptr, ESI; -- } -- } - } -- } - - while (aptr < aend) - *aptr++ *= value; -@@ -2213,31 +3289,31 @@ unittest - { - version (log) printf(" cpuid %d\n", cpuid); - -- for (int j = 0; j < 2; j++) -+ for (size_t dim = 7; dim < 68; dim += 60) - { -- const int dim = 67; -- T[] a = new T[dim + j]; // aligned on 16 byte boundary -- a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; -- T[] c = new T[dim + j]; -- c = c[j .. dim + j]; -+ for (int j = 0; j < 2; j++) -+ { -+ T[] a = new T[dim + j]; // aligned on 16 byte boundary -+ a = a[j .. dim + j]; // misalign for second iteration -+ T[] b = new T[dim + j]; -+ b = b[j .. dim + j]; - -- for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -- } -+ for (int i = 0; i < dim; i++) -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ } - -- b[] = a[]; -- a[] *= 6; -+ b[] = a[]; -+ a[] *= 6; - -- for (int i = 0; i < dim; i++) -- { -- if (a[i] != cast(T)(b[i] * 6)) -+ for (int i = 0; i < dim; i++) - { -- printf("[%d]: %d != %d * 6\n", i, a[i], b[i]); -- assert(0); -+ if (a[i] != cast(T)(b[i] * 6)) -+ { -+ printf("[%d]: %d != %d * 6\n", i, a[i], b[i]); -+ assert(0); -+ } - } - } - } -@@ -2275,119 +3351,226 @@ body - auto aend = aptr + a.length; - auto bptr = b.ptr; - -- version (none) -- { - version (D_InlineAsm_X86) - { -- // SSE2 aligned version is 873% faster -- if (sse2 && a.length >= 8) -+ if (sse41) - { -- auto n = aptr + (a.length & ~7); -+ auto aligned = ((cast(size_t) aptr) & 15) == 0; - -- if (((cast(uint) aptr | cast(uint) bptr) & 15) != 0) -+ if (a.length >= 8) - { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov ECX, bptr; -- -- align 4; -- startsse2u: -- movdqu XMM0, [ESI]; -- movdqu XMM2, [ECX]; -- movdqu XMM1, [ESI+16]; -- movdqu XMM3, [ECX+16]; -- add ESI, 32; -- add ECX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM3; -- movdqu [ESI -32], XMM0; -- movdqu [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2u; -+ auto n = aptr + (a.length & ~7); - -- mov aptr, ESI; -- mov bptr, ECX; -+ if (!aligned) -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov ECX, bptr; -+ -+ align 4; -+ startsse41u: -+ movdqu XMM0, [ESI]; -+ movdqu XMM2, [ECX]; -+ movdqu XMM1, [ESI+16]; -+ movdqu XMM3, [ECX+16]; -+ add ESI, 32; -+ add ECX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqu [ESI -32], XMM0; -+ movdqu [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41u; -+ -+ mov aptr, ESI; -+ mov bptr, ECX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov EDI, n; -+ mov ECX, bptr; -+ -+ align 4; -+ startsse41a: -+ movdqa XMM0, [ESI]; -+ movdqa XMM2, [ECX]; -+ movdqa XMM1, [ESI+16]; -+ movdqa XMM3, [ECX+16]; -+ add ESI, 32; -+ add ECX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqa [ESI -32], XMM0; -+ movdqa [ESI+16-32], XMM1; -+ cmp ESI, EDI; -+ jb startsse41a; -+ -+ mov aptr, ESI; -+ mov bptr, ECX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ {//is the unaligned overhead worth it -+ asm -+ { -+ mov ESI, aptr; -+ mov ECX, bptr; -+ -+ movdqu XMM0, [ESI]; -+ movdqu XMM2, [ECX]; -+ -+ pmulld XMM0, XMM2; -+ movdqu [ESI], XMM0; -+ -+ add ESI, 16; -+ add ECX, 16; -+ -+ mov aptr, ESI; -+ mov bptr, ECX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov ESI, aptr; -+ mov ECX, bptr; -+ -+ movdqa XMM0, [ESI]; -+ movdqa XMM2, [ECX]; -+ -+ pmulld XMM0, XMM2; -+ movdqa [ESI], XMM0; -+ -+ add ESI, 16; -+ add ECX, 16; -+ -+ mov aptr, ESI; -+ mov bptr, ECX; -+ } -+ } -+ } -+ } -+ } -+ version (D_InlineAsm_X86_64) -+ { -+ if (sse41) -+ { -+ auto aligned = ((cast(size_t) aptr) & 15) == 0; -+ -+ if (a.length >= 8) -+ { -+ auto n = aptr + (a.length & ~7); -+ -+ if (!aligned) -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse41u: -+ movdqu XMM0, [RSI]; -+ movdqu XMM2, [RCX]; -+ movdqu XMM1, [RSI+16]; -+ movdqu XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqu [RSI -32], XMM0; -+ movdqu [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41u; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RDI, n; -+ mov RCX, bptr; -+ -+ align 4; -+ startsse41a: -+ movdqa XMM0, [RSI]; -+ movdqa XMM2, [RCX]; -+ movdqa XMM1, [RSI+16]; -+ movdqa XMM3, [RCX+16]; -+ add RSI, 32; -+ add RCX, 32; -+ pmulld XMM0, XMM2; -+ pmulld XMM1, XMM3; -+ movdqa [RSI -32], XMM0; -+ movdqa [RSI+16-32], XMM1; -+ cmp RSI, RDI; -+ jb startsse41a; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ } -+ else if (a.length >= 4) -+ { -+ if (!aligned) -+ {//is the unaligned overhead worth it -+ asm -+ { -+ mov RSI, aptr; -+ mov RCX, bptr; -+ -+ movdqu XMM0, [RSI]; -+ movdqu XMM2, [RCX]; -+ -+ pmulld XMM0, XMM2; -+ movdqu [RSI], XMM0; -+ -+ add RSI, 16; -+ add RCX, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } -+ } -+ else -+ { -+ asm -+ { -+ mov RSI, aptr; -+ mov RCX, bptr; -+ -+ movdqa XMM0, [RSI]; -+ movdqa XMM2, [RCX]; -+ -+ pmulld XMM0, XMM2; -+ movdqa [RSI], XMM0; -+ -+ add RSI, 16; -+ add RCX, 16; -+ -+ mov aptr, RSI; -+ mov bptr, RCX; -+ } - } - } -- else -- { -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov ECX, bptr; -- -- align 4; -- startsse2a: -- movdqa XMM0, [ESI]; -- movdqa XMM2, [ECX]; -- movdqa XMM1, [ESI+16]; -- movdqa XMM3, [ECX+16]; -- add ESI, 32; -- add ECX, 32; -- pmuludq XMM0, XMM2; -- pmuludq XMM1, XMM3; -- movdqa [ESI -32], XMM0; -- movdqa [ESI+16-32], XMM1; -- cmp ESI, EDI; -- jb startsse2a; -- -- mov aptr, ESI; -- mov bptr, ECX; -- } -- } - } --/+ BUG: comment out this section until we figure out what is going -- wrong with the invalid pshufd instructions. -- -- else -- // MMX version is 573% faster -- if (mmx && a.length >= 4) -- { -- auto n = aptr + (a.length & ~3); -- -- asm -- { -- mov ESI, aptr; -- mov EDI, n; -- mov ECX, bptr; -- -- align 4; -- startmmx: -- movq MM0, [ESI]; -- movq MM2, [ECX]; -- movq MM1, [ESI+8]; -- movq MM3, [ECX+8]; -- pxor MM4, MM4; -- pxor MM5, MM5; -- punpckldq MM4, MM0; -- punpckldq MM5, MM2; -- add ESI, 16; -- add ECX, 16; -- pmuludq MM4, MM5; -- pshufd MM4, MM4, 8; // ? -- movq [ESI -16], MM4; -- pxor MM4, MM4; -- pxor MM5, MM5; -- punpckldq MM4, MM1; -- punpckldq MM5, MM3; -- pmuludq MM4, MM5; -- pshufd MM4, MM4, 8; // ? -- movq [ESI+8-16], MM4; -- cmp ESI, EDI; -- jb startmmx; -- -- emms; -- mov aptr, ESI; -- mov bptr, ECX; -- } -- } --+/ - } -- } -- - while (aptr < aend) - *aptr++ *= *bptr++; - -@@ -2402,31 +3585,34 @@ unittest - { - version (log) printf(" cpuid %d\n", cpuid); - -- for (int j = 0; j < 2; j++) -+ for (size_t dim = 7; dim < 68; dim += 60) - { -- const int dim = 67; -- T[] a = new T[dim + j]; // aligned on 16 byte boundary -- a = a[j .. dim + j]; // misalign for second iteration -- T[] b = new T[dim + j]; -- b = b[j .. dim + j]; -- T[] c = new T[dim + j]; -- c = c[j .. dim + j]; -+ for (int j = 0; j < 2; j++) -+ { -+ T[] a = new T[dim + j]; // aligned on 16 byte boundary -+ a = a[j .. dim + j]; // misalign for second iteration -+ T[] b = new T[dim + j]; -+ b = b[j .. dim + j]; -+ T[] c = new T[dim + j]; -+ c = c[j .. dim + j]; - -- for (int i = 0; i < dim; i++) -- { a[i] = cast(T)i; -- b[i] = cast(T)(i + 7); -- c[i] = cast(T)(i * 2); -- } -+ for (int i = 0; i < dim; i++) -+ { -+ a[i] = cast(T)(i-10); -+ b[i] = cast(T)(i-3); -+ c[i] = cast(T)((i-10) * 2); -+ } - -- b[] = a[]; -- a[] *= c[]; -+ b[] = a[]; -+ a[] *= c[]; - -- for (int i = 0; i < dim; i++) -- { -- if (a[i] != cast(T)(b[i] * c[i])) -+ for (int i = 0; i < dim; i++) - { -- printf("[%d]: %d != %d * %d\n", i, a[i], b[i], c[i]); -- assert(0); -+ if (a[i] != cast(T)(b[i] * c[i])) -+ { -+ printf("[%d]: %d != %d * %d\n", i, a[i], b[i], c[i]); -+ assert(0); -+ } - } - } - } ---- a/src/libphobos/libdruntime/rt/arrayreal.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arrayreal.d 2014-04-01 16:32:51.000000000 +0100 -@@ -62,7 +62,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -121,7 +120,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { ---- a/src/libphobos/libdruntime/rt/arrayshort.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/arrayshort.d 2014-04-01 16:32:51.000000000 +0100 -@@ -249,7 +249,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -1123,7 +1122,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { -@@ -1814,7 +1812,6 @@ in - assert(a.length == b.length && b.length == c.length); - assert(disjoint(a, b)); - assert(disjoint(a, c)); -- assert(disjoint(b, c)); - } - body - { ---- a/src/libphobos/libdruntime/rt/cast_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/cast_.d 2014-04-01 16:32:51.000000000 +0100 -@@ -24,23 +24,22 @@ extern (C): - */ - - Object _d_toObject(void* p) --{ Object o; -+{ -+ if(!p) -+ return null; - -- if (p) -+ Object o = cast(Object) p; -+ ClassInfo oc = o.classinfo; -+ Interface* pi = **cast(Interface***) p; -+ -+ /* Interface.offset lines up with ClassInfo.name.ptr, -+ * so we rely on pointers never being less than 64K, -+ * and Objects never being greater. -+ */ -+ if(pi.offset < 0x10000) - { -- o = cast(Object)p; -- ClassInfo oc = o.classinfo; -- Interface *pi = **cast(Interface ***)p; -- -- /* Interface.offset lines up with ClassInfo.name.ptr, -- * so we rely on pointers never being less than 64K, -- * and Objects never being greater. -- */ -- if (pi.offset < 0x10000) -- { -- //printf("\tpi.offset = %d\n", pi.offset); -- o = cast(Object)(p - pi.offset); -- } -+ debug(cast_) printf("\tpi.offset = %d\n", pi.offset); -+ return cast(Object)(p - pi.offset); - } - return o; - } -@@ -51,108 +50,102 @@ Object _d_toObject(void* p) - * Returns o if successful, null if not. - */ - --Object _d_interface_cast(void* p, ClassInfo c) --{ Object o; -+void* _d_interface_cast(void* p, ClassInfo c) -+{ -+ debug(cast_) printf("_d_interface_cast(p = %p, c = '%.*s')\n", p, c.name); -+ if(!p) -+ return null; - -- //printf("_d_interface_cast(p = %p, c = '%.*s')\n", p, c.name); -- if (p) -- { -- Interface *pi = **cast(Interface ***)p; -+ Interface* pi = **cast(Interface***) p; - -- //printf("\tpi.offset = %d\n", pi.offset); -- o = cast(Object)(p - pi.offset); -- return _d_dynamic_cast(o, c); -- } -- return o; -+ debug(cast_) printf("\tpi.offset = %d\n", pi.offset); -+ return _d_dynamic_cast(cast(Object)(p - pi.offset), c); - } - --Object _d_dynamic_cast(Object o, ClassInfo c) --{ ClassInfo oc; -- size_t offset = 0; -- -- //printf("_d_dynamic_cast(o = %p, c = '%.*s')\n", o, c.name); -+void* _d_dynamic_cast(Object o, ClassInfo c) -+{ -+ debug(cast_) printf("_d_dynamic_cast(o = %p, c = '%.*s')\n", o, c.name); - -- if (o) -+ void* res = null; -+ size_t offset = 0; -+ if(o && _d_isbaseof2(o.classinfo, c, offset)) - { -- oc = o.classinfo; -- if (_d_isbaseof2(oc, c, offset)) -- { -- //printf("\toffset = %d\n", offset); -- o = cast(Object)(cast(void*)o + offset); -- } -- else -- o = null; -+ debug(cast_) printf("\toffset = %d\n", offset); -+ res = cast(void*) o + offset; - } -- //printf("\tresult = %p\n", o); -- return o; -+ debug(cast_) printf("\tresult = %p\n", res); -+ return res; - } - - int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset) - { -- if (oc is c) -- return 1; -+ if(oc is c) -+ return true; -+ - do - { -- if (oc.base is c) -- return 1; -- foreach (i; 0..oc.interfaces.length) -+ if(oc.base is c) -+ return true; -+ -+ foreach(iface; oc.interfaces) - { -- auto ic = oc.interfaces[i].classinfo; -- if (ic is c) -- { offset = oc.interfaces[i].offset; -- return 1; -+ if(iface.classinfo is c) -+ { -+ offset = iface.offset; -+ return true; - } - } -- foreach (i; 0..oc.interfaces.length) -+ -+ foreach(iface; oc.interfaces) - { -- auto ic = oc.interfaces[i].classinfo; -- if (_d_isbaseof2(ic, c, offset)) -- { offset = oc.interfaces[i].offset; -- return 1; -+ if(_d_isbaseof2(iface.classinfo, c, offset)) -+ { -+ offset = iface.offset; -+ return true; - } - } -+ - oc = oc.base; -- } while (oc); -- return 0; -+ } -+ while(oc); -+ -+ return false; - } - - int _d_isbaseof(ClassInfo oc, ClassInfo c) - { -- if (oc is c) -- return 1; -+ if(oc is c) -+ return true; -+ - do - { -- if (oc.base is c) -- return 1; -- foreach (i; 0..oc.interfaces.length) -- { -- auto ic = oc.interfaces[i].classinfo; -- if (ic is c || _d_isbaseof(ic, c)) -- return 1; -- } -+ if(oc.base is c) -+ return true; -+ -+ foreach(iface; oc.interfaces) -+ if(iface.classinfo is c || _d_isbaseof(iface.classinfo, c)) -+ return true; -+ - oc = oc.base; -- } while (oc); -- return 0; -+ } -+ while(oc); -+ -+ return false; - } - - /********************************* - * Find the vtbl[] associated with Interface ic. - */ - --void *_d_interface_vtbl(ClassInfo ic, Object o) -+void* _d_interface_vtbl(ClassInfo ic, Object o) - { -- //printf("__d_interface_vtbl(o = %p, ic = %p)\n", o, ic); -+ debug(cast_) printf("__d_interface_vtbl(o = %p, ic = %p)\n", o, ic); - - assert(o); - -- auto oc = o.classinfo; -- foreach (i; 0..oc.interfaces.length) -- { -- auto oic = oc.interfaces[i].classinfo; -- if (oic is ic) -- { -- return cast(void *)oc.interfaces[i].vtbl; -- } -- } -+ foreach(iface; o.classinfo.interfaces) -+ if(iface.classinfo is ic) -+ return cast(void*) iface.vtbl; -+ - assert(0); - } ---- a/src/libphobos/libdruntime/rt/critical_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/critical_.d 2014-04-01 16:32:51.000000000 +0100 -@@ -11,234 +11,87 @@ - * (See accompanying file LICENSE or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -+ -+/* NOTE: This file has been patched from the original DMD distribution to -+ work with the GDC compiler. -+ Modified by Iain Buclaw, December 2013 -+*/ - module rt.critical_; - - private - { - debug(PRINTF) import core.stdc.stdio; - import core.stdc.stdlib; -+ import gcc.gthreads; - -- version( linux ) -- { -- version = USE_PTHREADS; -- } -- else version( FreeBSD ) -- { -- version = USE_PTHREADS; -- } -- else version( OSX ) -- { -- version = USE_PTHREADS; -- } -- else version( Solaris ) -- { -- version = USE_PTHREADS; -- } -- -- version( Windows ) -- { -- import core.sys.windows.windows; -- -- /* We don't initialize critical sections unless we actually need them. -- * So keep a linked list of the ones we do use, and in the static destructor -- * code, walk the list and release them. -- */ -- struct D_CRITICAL_SECTION -- { -- D_CRITICAL_SECTION *next; -- CRITICAL_SECTION cs; -- } -- } -- else version( USE_PTHREADS ) -- { -- import core.sys.posix.pthread; -- -- /* We don't initialize critical sections unless we actually need them. -- * So keep a linked list of the ones we do use, and in the static destructor -- * code, walk the list and release them. -- */ -- struct D_CRITICAL_SECTION -- { -- D_CRITICAL_SECTION *next; -- pthread_mutex_t cs; -- } -- } -- else version( NoSystem ) -- { -- /* Stub declaration. */ -- struct D_CRITICAL_SECTION -- { -- } -- } -- else -+ /* We don't initialize critical sections unless we actually need them. -+ * So keep a linked list of the ones we do use, and in the static destructor -+ * code, walk the list and release them. -+ */ -+ struct critsec_t - { -- static assert(0, "Unsupported platform"); -+ critsec_t *next; -+ gthread_recursive_mutex_t cs; - } - } - -+/****************************************** -+ * Enter/exit critical section. -+ */ - --/* ================================= Win32 ============================ */ -+static __gshared critsec_t *dcs_list; -+static __gshared critsec_t critical_section; - --version( Windows ) -+extern (C) void _d_criticalenter(critsec_t *dcs) - { -- /****************************************** -- * Enter/exit critical section. -- */ -- -- static __gshared D_CRITICAL_SECTION *dcs_list; -- static __gshared D_CRITICAL_SECTION critical_section; -- static __gshared int inited; -- -- extern (C) void _d_criticalenter(D_CRITICAL_SECTION *dcs) -- { -- if (!dcs_list) -- { -- _STI_critical_init(); -- atexit(&_STD_critical_term); -- } -- debug(PRINTF) printf("_d_criticalenter(dcs = x%x)\n", dcs); -- if (!dcs.next) -- { -- EnterCriticalSection(&critical_section.cs); -- if (!dcs.next) // if, in the meantime, another thread didn't set it -- { -- dcs.next = dcs_list; -- dcs_list = dcs; -- InitializeCriticalSection(&dcs.cs); -- } -- LeaveCriticalSection(&critical_section.cs); -- } -- EnterCriticalSection(&dcs.cs); -- } -- -- extern (C) void _d_criticalexit(D_CRITICAL_SECTION *dcs) -- { -- debug(PRINTF) printf("_d_criticalexit(dcs = x%x)\n", dcs); -- LeaveCriticalSection(&dcs.cs); -- } -- -- extern (C) void _STI_critical_init() -+ if (!dcs_list) - { -- if (!inited) -- { -- debug(PRINTF) printf("_STI_critical_init()\n"); -- InitializeCriticalSection(&critical_section.cs); -- dcs_list = &critical_section; -- inited = 1; -- } -+ _STI_critical_init(); -+ atexit(&_STD_critical_term); - } -- -- extern (C) void _STD_critical_term() -+ debug(PRINTF) printf("_d_criticalenter(dcs = x%x)\n", dcs); -+ if (!dcs.next) - { -- if (inited) -- { -- debug(PRINTF) printf("_STI_critical_term()\n"); -- while (dcs_list) -- { -- debug(PRINTF) printf("\tlooping... %x\n", dcs_list); -- DeleteCriticalSection(&dcs_list.cs); -- dcs_list = dcs_list.next; -- } -- inited = 0; -- } -+ gthread_recursive_mutex_lock(&critical_section.cs); -+ if (!dcs.next) // if, in the meantime, another thread didn't set it -+ { -+ dcs.next = dcs_list; -+ dcs_list = dcs; -+ gthread_recursive_mutex_init(&dcs.cs); -+ } -+ gthread_recursive_mutex_unlock(&critical_section.cs); - } -+ gthread_recursive_mutex_lock(&dcs.cs); - } - --/* ================================= linux ============================ */ -- --version( USE_PTHREADS ) -+extern (C) void _d_criticalexit(critsec_t *dcs) - { -- /****************************************** -- * Enter/exit critical section. -- */ -- -- static __gshared D_CRITICAL_SECTION *dcs_list; -- static __gshared D_CRITICAL_SECTION critical_section; -- static __gshared pthread_mutexattr_t _criticals_attr; -- -- extern (C) void _d_criticalenter(D_CRITICAL_SECTION *dcs) -- { -- if (!dcs_list) -- { -- _STI_critical_init(); -- atexit(&_STD_critical_term); -- } -- debug(PRINTF) printf("_d_criticalenter(dcs = x%x)\n", dcs); -- if (!dcs.next) -- { -- pthread_mutex_lock(&critical_section.cs); -- if (!dcs.next) // if, in the meantime, another thread didn't set it -- { -- dcs.next = dcs_list; -- dcs_list = dcs; -- pthread_mutex_init(&dcs.cs, &_criticals_attr); -- } -- pthread_mutex_unlock(&critical_section.cs); -- } -- pthread_mutex_lock(&dcs.cs); -- } -- -- extern (C) void _d_criticalexit(D_CRITICAL_SECTION *dcs) -- { -- debug(PRINTF) printf("_d_criticalexit(dcs = x%x)\n", dcs); -- pthread_mutex_unlock(&dcs.cs); -- } -- -- extern (C) void _STI_critical_init() -- { -- if (!dcs_list) -- { -- debug(PRINTF) printf("_STI_critical_init()\n"); -- pthread_mutexattr_init(&_criticals_attr); -- pthread_mutexattr_settype(&_criticals_attr, PTHREAD_MUTEX_RECURSIVE); -- -- // The global critical section doesn't need to be recursive -- pthread_mutex_init(&critical_section.cs, null); -- dcs_list = &critical_section; -- } -- } -- -- extern (C) void _STD_critical_term() -- { -- if (dcs_list) -- { -- debug(PRINTF) printf("_STI_critical_term()\n"); -- while (dcs_list) -- { -- debug(PRINTF) printf("\tlooping... %x\n", dcs_list); -- pthread_mutex_destroy(&dcs_list.cs); -- dcs_list = dcs_list.next; -- } -- } -- } -+ debug(PRINTF) printf("_d_criticalexit(dcs = x%x)\n", dcs); -+ gthread_recursive_mutex_unlock(&dcs.cs); - } - --/* ================================= No System ============================ */ -- --version( NoSystem ) -+extern (C) void _STI_critical_init() - { -- /****************************************** -- * Enter/exit critical section. -- */ -- -- extern (C) void _d_criticalenter(D_CRITICAL_SECTION *dcs) -- { -- debug(PRINTF) printf("_d_criticalenter(dcs = x%x)\n", dcs); -- } -- -- extern (C) void _d_criticalexit(D_CRITICAL_SECTION *dcs) -+ if (!dcs_list) - { -- debug(PRINTF) printf("_d_criticalexit(dcs = x%x)\n", dcs); -- } -- -- extern (C) void _STI_critical_init() -- { -- debug(PRINTF) printf("_STI_critical_init()\n"); -+ debug(PRINTF) printf("_STI_critical_init()\n"); -+ // The global critical section doesn't need to be recursive -+ gthread_recursive_mutex_init(&critical_section.cs); -+ dcs_list = &critical_section; - } -+} - -- extern (C) void _STD_critical_term() -+extern (C) void _STD_critical_term() -+{ -+ if (dcs_list) - { -- debug(PRINTF) printf("_STI_critical_term()\n"); -+ debug(PRINTF) printf("_STI_critical_term()\n"); -+ while (dcs_list) -+ { -+ debug(PRINTF) printf("\tlooping... %x\n", dcs_list); -+ gthread_recursive_mutex_destroy(&dcs_list.cs); -+ dcs_list = dcs_list.next; -+ } - } -- - } -+ ---- a/src/libphobos/libdruntime/rt/deh.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/deh.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,39 @@ -+/** -+ * Implementation of exception handling support routines. -+ * -+ * Copyright: Copyright Digital Mars 1999 - 2013. -+ * License: Distributed under the -+ * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). -+ * (See accompanying file LICENSE) -+ * Authors: Walter Bright -+ * Source: $(DRUNTIMESRC src/rt/deh.d) -+ */ -+ -+module rt.deh; -+ -+extern (C) -+{ -+ Throwable.TraceInfo _d_traceContext(void* ptr = null); -+ void _d_createTrace(Object o, void* context) -+ { -+ auto t = cast(Throwable) o; -+ -+ if (t !is null && t.info is null && -+ cast(byte*) t !is t.classinfo.init.ptr) -+ { -+ t.info = _d_traceContext(context); -+ } -+ } -+} -+ -+version (GNU) -+ public import gcc.deh; -+else version (Win32) -+ public import rt.deh_win32; -+else version (Win64) -+ public import rt.deh_win64_posix; -+else version (Posix) -+ public import rt.deh_win64_posix; -+else -+ static assert (0, "Unsupported architecture"); -+ ---- a/src/libphobos/libdruntime/rt/dmain2.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/dmain2.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,7 +1,7 @@ - /** -- * Contains main program entry point and support routines. -+ * Contains druntime startup and shutdown routines. - * -- * Copyright: Copyright Digital Mars 2000 - 2012. -+ * Copyright: Copyright Digital Mars 2000 - 2013. - * License: Distributed under the - * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). - * (See accompanying file LICENSE) -@@ -25,6 +25,7 @@ private - import core.stdc.stdlib; - import core.stdc.string; - import core.stdc.stdio; // for printf() -+ import core.stdc.errno : errno; - } - - version (Windows) -@@ -35,6 +36,7 @@ version (Windows) - { - alias int function() FARPROC; - FARPROC GetProcAddress(void*, in char*); -+ void* LoadLibraryA(in char*); - void* LoadLibraryW(in wchar_t*); - int FreeLibrary(void*); - void* LocalFree(void*); -@@ -47,22 +49,6 @@ version (Windows) - pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW - } - --version (all) --{ -- extern (C) Throwable.TraceInfo _d_traceContext(void* ptr = null); -- -- extern (C) void _d_createTrace(Object *o) -- { -- auto t = cast(Throwable) o; -- -- if (t !is null && t.info is null && -- cast(byte*) t !is t.classinfo.init.ptr) -- { -- t.info = _d_traceContext(); -- } -- } --} -- - version (FreeBSD) - { - import core.stdc.fenv; -@@ -79,34 +65,12 @@ extern (C) void rt_moduleTlsCtor(); - extern (C) void rt_moduleDtor(); - extern (C) void rt_moduleTlsDtor(); - extern (C) void thread_joinAll(); -- --// NOTE: This is to preserve compatibility with old Windows DLLs. --extern (C) void _moduleCtor() --{ -- rt_moduleCtor(); --} -- --extern (C) void _moduleDtor() --{ -- rt_moduleDtor(); --} -- --extern (C) void _moduleTlsCtor() --{ -- rt_moduleTlsCtor(); --} -- --extern (C) void _moduleTlsDtor() --{ -- rt_moduleTlsDtor(); --} -+extern (C) bool runModuleUnitTests(); - - version (OSX) - { - // The bottom of the stack - extern (C) __gshared void* __osx_stack_end = cast(void*)0xC0000000; -- -- extern (C) extern (C) void _d_osx_image_init2(); - } - - /*********************************** -@@ -124,33 +88,28 @@ extern (C) - alias void function() gcClrFn; - } - --extern (C) void* rt_loadLibrary(in char[] name) -+version (Windows) - { -- version (Windows) -+ /******************************************* -+ * Loads a DLL written in D with the name 'name'. -+ * Returns: -+ * opaque handle to the DLL if successfully loaded -+ * null if failure -+ */ -+ extern (C) void* rt_loadLibrary(const char* name) - { -- if (name.length == 0) return null; -- // Load a DLL at runtime -- enum CP_UTF8 = 65001; -- auto len = MultiByteToWideChar( -- CP_UTF8, 0, name.ptr, cast(int)name.length, null, 0); -- if (len == 0) -- return null; -- -- auto buf = cast(wchar_t*)malloc((len+1) * wchar_t.sizeof); -- if (buf is null) -- return null; -- scope (exit) -- free(buf); -- -- len = MultiByteToWideChar( -- CP_UTF8, 0, name.ptr, cast(int)name.length, buf, len); -- if (len == 0) -- return null; -+ return initLibrary(.LoadLibraryA(name)); -+ } - -- buf[len] = '\0'; -+ extern (C) void* rt_loadLibraryW(const wchar_t* name) -+ { -+ return initLibrary(.LoadLibraryW(name)); -+ } - -- // BUG: LoadLibraryW() call calls rt_init(), which fails if proxy is not set! -- auto mod = LoadLibraryW(buf); -+ void* initLibrary(void* mod) -+ { -+ // BUG: LoadLibrary() call calls rt_init(), which fails if proxy is not set! -+ // (What? LoadLibrary() is a Windows API call, it shouldn't call rt_init().) - if (mod is null) - return mod; - gcSetFn gcSet = cast(gcSetFn) GetProcAddress(mod, "gc_setProxy"); -@@ -159,132 +118,28 @@ extern (C) void* rt_loadLibrary(in char[ - gcSet(gc_getProxy()); - } - return mod; -- - } -- else version (Posix) -- { -- throw new Exception("rt_loadLibrary not yet implemented on Posix."); -- } --} - --extern (C) bool rt_unloadLibrary(void* ptr) --{ -- version (Windows) -+ /************************************* -+ * Unloads DLL that was previously loaded by rt_loadLibrary(). -+ * Input: -+ * ptr the handle returned by rt_loadLibrary() -+ * Returns: -+ * 1 succeeded -+ * 0 some failure happened -+ */ -+ extern (C) int rt_unloadLibrary(void* ptr) - { - gcClrFn gcClr = cast(gcClrFn) GetProcAddress(ptr, "gc_clrProxy"); - if (gcClr !is null) - gcClr(); - return FreeLibrary(ptr) != 0; - } -- else version (Posix) -- { -- throw new Exception("rt_unloadLibrary not yet implemented on Posix."); -- } - } - --/*********************************** -- * These functions must be defined for any D program linked -- * against this library. -- */ --extern (C) void onAssertError(string file, size_t line); --extern (C) void onAssertErrorMsg(string file, size_t line, string msg); --extern (C) void onUnittestErrorMsg(string file, size_t line, string msg); --extern (C) void onRangeError(string file, size_t line); --extern (C) void onHiddenFuncError(Object o); --extern (C) void onSwitchError(string file, size_t line); --extern (C) bool runModuleUnitTests(); -- --// this function is called from the utf module --//extern (C) void onUnicodeError(string msg, size_t idx); -- --/*********************************** -- * These are internal callbacks for various language errors. -+/* To get out-of-band access to the args[] passed to main(). - */ - --extern (C) --{ -- // Use ModuleInfo to get file name for "m" versions -- -- void _d_assertm(ModuleInfo* m, uint line) -- { -- onAssertError(m.name, line); -- } -- -- void _d_assert_msg(string msg, string file, uint line) -- { -- onAssertErrorMsg(file, line, msg); -- } -- -- void _d_assert(string file, uint line) -- { -- onAssertError(file, line); -- } -- -- void _d_unittestm(ModuleInfo* m, uint line) -- { -- _d_unittest(m.name, line); -- } -- -- void _d_unittest_msg(string msg, string file, uint line) -- { -- onUnittestErrorMsg(file, line, msg); -- } -- -- void _d_unittest(string file, uint line) -- { -- _d_unittest_msg("unittest failure", file, line); -- } -- -- void _d_array_boundsm(ModuleInfo* m, uint line) -- { -- onRangeError(m.name, line); -- } -- -- void _d_array_bounds(string file, uint line) -- { -- onRangeError(file, line); -- } -- -- void _d_switch_errorm(ModuleInfo* m, uint line) -- { -- onSwitchError(m.name, line); -- } -- -- void _d_switch_error(string file, uint line) -- { -- onSwitchError(file, line); -- } --} -- --version(GNU) --{ -- extern (C) void _d_hidden_func(Object o) -- { -- onHiddenFuncError(o); -- } --} --else --{ -- extern (C) void _d_hidden_func() -- { -- Object o; -- version(X86) -- asm -- { -- mov o, EAX; -- } -- else version(X86_64) -- asm -- { -- mov o, RDI; -- } -- else -- static assert(0, "unknown os"); -- -- onHiddenFuncError(o); -- } --} -- - __gshared string[] _d_args = null; - - extern (C) string[] rt_args() -@@ -296,19 +151,29 @@ extern (C) string[] rt_args() - // be fine to leave it as __gshared. - extern (C) __gshared bool rt_trapExceptions = true; - --void _d_criticalInit() --{ -- _STI_monitor_staticctor(); -- _STI_critical_init(); --} -- - alias void delegate(Throwable) ExceptionHandler; - --extern (C) bool rt_init(ExceptionHandler dg = null) -+/** -+ * Keep track of how often rt_init/rt_term were called. -+ */ -+shared size_t _initCount; -+ -+/********************************************** -+ * Initialize druntime. -+ * If a C program wishes to call D code, and there's no D main(), then it -+ * must call rt_init() and rt_term(). -+ */ -+extern (C) int rt_init() - { -- version (OSX) -- _d_osx_image_init2(); -- _d_criticalInit(); -+ /* @@BUG 11380 @@ Need to synchronize rt_init/rt_term calls for -+ version (Shared) druntime, because multiple C threads might -+ initialize different D libraries without knowing about the -+ shared druntime. Also we need to attach any thread that calls -+ rt_init. */ -+ if (_initCount++) return 1; -+ -+ _STI_monitor_staticctor(); -+ _STI_critical_init(); - - try - { -@@ -316,48 +181,51 @@ extern (C) bool rt_init(ExceptionHandler - initStaticDataGC(); - rt_moduleCtor(); - rt_moduleTlsCtor(); -- runModuleUnitTests(); -- return true; -+ return 1; - } -- catch (Throwable e) -+ catch (Throwable t) - { -- if (dg) -- dg(e); -- else -- throw e; // rethrow, don't silently ignore error -+ _initCount = 0; -+ printThrowable(t); - } -- _d_criticalTerm(); -- return false; -+ _STD_critical_term(); -+ _STD_monitor_staticdtor(); -+ return 0; - } - --void _d_criticalTerm() -+/********************************************** -+ * Terminate use of druntime. -+ */ -+extern (C) int rt_term() - { -- _STD_critical_term(); -- _STD_monitor_staticdtor(); --} -+ if (!_initCount) return 0; // was never initialized -+ if (--_initCount) return 1; - --extern (C) bool rt_term(ExceptionHandler dg = null) --{ - try - { - rt_moduleTlsDtor(); - thread_joinAll(); - rt_moduleDtor(); - gc_term(); -- return true; -+ return 1; - } -- catch (Throwable e) -+ catch (Throwable t) - { -- if (dg) -- dg(e); -+ printThrowable(t); - } - finally - { -- _d_criticalTerm(); -+ _STD_critical_term(); -+ _STD_monitor_staticdtor(); - } -- return false; -+ return 0; - } - -+/*********************************** -+ * Provide out-of-band access to the original C argc/argv -+ * passed to this program via main(argc,argv). -+ */ -+ - struct CArgs - { - int argc; -@@ -372,45 +240,18 @@ extern (C) CArgs rt_cArgs() - } - - /*********************************** -- * The D main() function supplied by the user's program -- * -- * It always has `_Dmain` symbol name and uses C calling convention. -- * But DMD frontend returns its type as `extern(D)` because of Issue @@@9028@@@. -- * As we need to deal with actual calling convention we have to mark it -- * as `extern(C)` and use its symbol name. -- */ --extern(C) int _Dmain(char[][] args); --alias extern(C) int function(char[][] args) MainFunc; -- --/*********************************** -- * Substitutes for the C main() function. -- * Just calls into d_run_main with the default main function. -- * Applications are free to implement their own -- * main function and call the _d_run_main function -- * themselves with any main function. -- */ --extern (C) int main(int argc, char **argv) --{ -- return _d_run_main(argc, argv, &_Dmain); --} -- --version (Solaris) extern (C) int _main(int argc, char** argv) --{ -- // This is apparently needed on Solaris because the -- // C tool chain seems to expect the main function -- // to be called _main. It needs both not just one! -- return main(argc, argv); --} -- --/*********************************** - * Run the given main function. - * Its purpose is to wrap the D main() - * function and catch any unhandled exceptions. - */ -+private alias extern(C) int function(char[][] args) MainFunc; -+ - extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc) - { -+ // Remember the original C argc/argv - _cArgs.argc = argc; - _cArgs.argv = argv; -+ - int result; - - version (OSX) -@@ -420,8 +261,6 @@ extern (C) int _d_run_main(int argc, cha - * of the main thread's stack, so save the address of that. - */ - __osx_stack_end = cast(void*)&argv; -- -- _d_osx_image_init2(); - } - - version (FreeBSD) version (D_InlineAsm_X86) -@@ -446,14 +285,32 @@ extern (C) int _d_run_main(int argc, cha - stdin = &fp[0]; - stdout = &fp[1]; - stderr = &fp[2]; -- } - -- _STI_monitor_staticctor(); -- _STI_critical_init(); -+ // ensure that sprintf generates only 2 digit exponent when writing floating point values -+ _set_output_format(_TWO_DIGIT_EXPONENT); -+ -+ // enable full precision for reals -+ asm -+ { -+ push RAX; -+ fstcw word ptr [RSP]; -+ or [RSP], 0b11_00_111111; // 11: use 64 bit extended-precision -+ // 111111: mask all FP exceptions -+ fldcw word ptr [RSP]; -+ pop RAX; -+ } -+ } - -+ // Allocate args[] on the stack - char[][] args = (cast(char[]*) alloca(argc * (char[]).sizeof))[0 .. argc]; -+ - version (Windows) - { -+ /* Because we want args[] to be UTF-8, and Windows doesn't guarantee that, -+ * we ignore argc/argv and go get the Windows command line again as UTF-16. -+ * Then, reparse into wargc/wargs, and then use Windows API to convert -+ * to UTF-8. -+ */ - const wchar_t* wCommandLine = GetCommandLineW(); - immutable size_t wCommandLineLength = wcslen(wCommandLine); - int wargc; -@@ -466,7 +323,7 @@ extern (C) int _d_run_main(int argc, cha - immutable size_t totalArgsLength = WideCharToMultiByte(65001, 0, wCommandLine, cast(int)wCommandLineLength, null, 0, null, null); - { - char* totalArgsBuff = cast(char*) alloca(totalArgsLength); -- int j = 0; -+ size_t j = 0; - foreach (i; 0 .. wargc) - { - immutable size_t wlen = wcslen(wargs[i]); -@@ -496,6 +353,10 @@ extern (C) int _d_run_main(int argc, cha - else - static assert(0); - -+ /* Create a copy of args[] on the stack, and set the global _d_args to refer to it. -+ * Why a copy instead of just using args[] is unclear. -+ * This also means that when this function returns, _d_args will refer to garbage. -+ */ - { - auto buff = cast(char[]*) alloca(argc * (char[]).sizeof + totalArgsLength); - -@@ -519,75 +380,6 @@ extern (C) int _d_run_main(int argc, cha - - void tryExec(scope void delegate() dg) - { -- void printLocLine(Throwable t) -- { -- if (t.file) -- { -- console(t.classinfo.name)("@")(t.file)("(")(t.line)(")"); -- } -- else -- { -- console(t.classinfo.name); -- } -- console("\n"); -- } -- -- void printMsgLine(Throwable t) -- { -- if (t.file) -- { -- console(t.classinfo.name)("@")(t.file)("(")(t.line)(")"); -- } -- else -- { -- console(t.classinfo.name); -- } -- if (t.msg) -- { -- console(": ")(t.msg); -- } -- console("\n"); -- } -- -- void printInfoBlock(Throwable t) -- { -- if (t.info) -- { -- console("----------------\n"); -- foreach (i; t.info) -- console(i)("\n"); -- console("----------------\n"); -- } -- } -- -- void print(Throwable t) -- { -- Throwable firstWithBypass = null; -- -- for (; t; t = t.next) -- { -- printMsgLine(t); -- printInfoBlock(t); -- auto e = cast(Error) t; -- if (e && e.bypassedException) -- { -- console("Bypasses "); -- printLocLine(e.bypassedException); -- if (firstWithBypass is null) -- firstWithBypass = t; -- } -- } -- if (firstWithBypass is null) -- return; -- console("=== Bypassed ===\n"); -- for (t = firstWithBypass; t; t = t.next) -- { -- auto e = cast(Error) t; -- if (e && e.bypassedException) -- print(e.bypassedException); -- } -- } -- - if (trapExceptions) - { - try -@@ -596,7 +388,7 @@ extern (C) int _d_run_main(int argc, cha - } - catch (Throwable t) - { -- print(t); -+ printThrowable(t); - result = EXIT_FAILURE; - } - } -@@ -614,32 +406,97 @@ extern (C) int _d_run_main(int argc, cha - // the user's main function. If main terminates with an exception, - // the exception is handled and then cleanup begins. An exception - // thrown during cleanup, however, will abort the cleanup process. -- -- void runMain() -- { -- result = mainFunc(args); -- } -- - void runAll() - { -- gc_init(); -- initStaticDataGC(); -- rt_moduleCtor(); -- rt_moduleTlsCtor(); -- if (runModuleUnitTests()) -- tryExec(&runMain); -+ if (rt_init() && runModuleUnitTests()) -+ tryExec({ result = mainFunc(args); }); - else - result = EXIT_FAILURE; -- rt_moduleTlsDtor(); -- thread_joinAll(); -- rt_moduleDtor(); -- gc_term(); -+ -+ if (!rt_term()) -+ result = (result == EXIT_SUCCESS) ? EXIT_FAILURE : result; - } - - tryExec(&runAll); - -- _STD_critical_term(); -- _STD_monitor_staticdtor(); -+ // Issue 10344: flush stdout and return nonzero on failure -+ if (.fflush(.stdout) != 0) -+ { -+ .fprintf(.stderr, "Failed to flush stdout: %s\n", .strerror(.errno)); -+ if (result == 0) -+ { -+ result = EXIT_FAILURE; -+ } -+ } - - return result; - } -+ -+private void printThrowable(Throwable t) -+{ -+ static void printLocLine(Throwable t) -+ { -+ if (t.file) -+ { -+ console(t.classinfo.name)("@")(t.file)("(")(t.line)(")"); -+ } -+ else -+ { -+ console(t.classinfo.name); -+ } -+ console("\n"); -+ } -+ -+ static void printMsgLine(Throwable t) -+ { -+ if (t.file) -+ { -+ console(t.classinfo.name)("@")(t.file)("(")(t.line)(")"); -+ } -+ else -+ { -+ console(t.classinfo.name); -+ } -+ if (t.msg) -+ { -+ console(": ")(t.msg); -+ } -+ console("\n"); -+ } -+ -+ static void printInfoBlock(Throwable t) -+ { -+ if (t.info) -+ { -+ console("----------------\n"); -+ foreach (i; t.info) -+ console(i)("\n"); -+ console("----------------\n"); -+ } -+ } -+ -+ Throwable firstWithBypass = null; -+ -+ for (; t; t = t.next) -+ { -+ printMsgLine(t); -+ printInfoBlock(t); -+ auto e = cast(Error) t; -+ if (e && e.bypassedException) -+ { -+ console("Bypasses "); -+ printLocLine(e.bypassedException); -+ if (firstWithBypass is null) -+ firstWithBypass = t; -+ } -+ } -+ if (firstWithBypass is null) -+ return; -+ console("=== Bypassed ===\n"); -+ for (t = firstWithBypass; t; t = t.next) -+ { -+ auto e = cast(Error) t; -+ if (e && e.bypassedException) -+ printThrowable(e.bypassedException); -+ } -+} ---- a/src/libphobos/libdruntime/rt/invariant_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/invariant_.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,36 +0,0 @@ --/** -- * Implementation of invariant support routines. -- * -- * Copyright: Copyright Digital Mars 2007 - 2010. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: Walter Bright -- */ -- --/* Copyright Digital Mars 2007 - 2010. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module rt.invariant_; -- --/** -- * -- */ --extern (C) void _d_invariant(Object o) --{ ClassInfo c; -- -- //printf("__d_invariant(%p)\n", o); -- -- // BUG: needs to be filename/line of caller, not library routine -- assert(o !is null); // just do null check, not invariant check -- -- c = o.classinfo; -- do -- { -- if (c.classInvariant) -- { -- (*c.classInvariant)(o); -- } -- c = c.base; -- } while (c); --} ---- a/src/libphobos/libdruntime/rt/lifetime.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/lifetime.d 2014-04-01 16:32:51.000000000 +0100 -@@ -17,28 +17,18 @@ - - module rt.lifetime; - --private --{ -- import core.stdc.stdlib; -- import core.stdc.string; -- import core.stdc.stdarg; -- import core.bitop; -- debug(PRINTF) import core.stdc.stdio; -- static import rt.tlsgc; --} -+import core.stdc.stdlib; -+import core.stdc.string; -+import core.stdc.stdarg; -+import core.bitop; -+static import core.memory; -+private alias BlkAttr = core.memory.GC.BlkAttr; -+debug(PRINTF) import core.stdc.stdio; -+static import rt.tlsgc; - - private - { -- enum BlkAttr : uint -- { -- FINALIZE = 0b0000_0001, -- NO_SCAN = 0b0000_0010, -- NO_MOVE = 0b0000_0100, -- APPENDABLE = 0b0000_1000, -- ALL_BITS = 0b1111_1111 -- } -- -- struct BlkInfo -+ package struct BlkInfo - { - void* base; - size_t size; -@@ -103,7 +93,7 @@ extern (C) Object _d_newclass(const Clas - void* p; - - debug(PRINTF) printf("_d_newclass(ci = %p, %s)\n", ci, cast(char *)ci.name); -- if (ci.m_flags & 1) // if COM object -+ if (ci.m_flags & TypeInfo_Class.ClassFlags.isCOMclass) - { /* COM objects are not garbage collected, they are reference counted - * using AddRef() and Release(). They get free'd by C's free() - * function called by Release() when Release()'s reference count goes -@@ -116,15 +106,20 @@ extern (C) Object _d_newclass(const Clas - else - { - // TODO: should this be + 1 to avoid having pointers to the next block? -- p = gc_malloc(ci.init.length, -- BlkAttr.FINALIZE | (ci.m_flags & 2 ? BlkAttr.NO_SCAN : 0)); -+ BlkAttr attr = BlkAttr.FINALIZE; -+ // extern(C++) classes don't have a classinfo pointer in their vtable so the GC can't finalize them -+ if (ci.m_flags & TypeInfo_Class.ClassFlags.isCPPclass) -+ attr &= ~BlkAttr.FINALIZE; -+ if (ci.m_flags & TypeInfo_Class.ClassFlags.noPointers) -+ attr |= BlkAttr.NO_SCAN; -+ p = gc_malloc(ci.init.length, attr); - debug(PRINTF) printf(" p = %p\n", p); - } - - debug(PRINTF) - { - printf("p = %p\n", p); -- printf("ci = %p, ci.init = %p, len = %d\n", ci, ci.init, ci.init.length); -+ printf("ci = %p, ci.init.ptr = %p, len = %llu\n", ci, ci.init.ptr, cast(ulong)ci.init.length); - printf("vptr = %p\n", *cast(void**) ci.init); - printf("vtbl[0] = %p\n", (*cast(void***) ci.init)[0]); - printf("vtbl[1] = %p\n", (*cast(void***) ci.init)[1]); -@@ -340,7 +335,7 @@ bool __setArrayAllocLength(ref BlkInfo i - /** - get the start of the array for the given block - */ --void *__arrayStart(BlkInfo info) -+void *__arrayStart(BlkInfo info) nothrow pure - { - return info.base + ((info.size & BIGLENGTHMASK) ? LARGEPREFIX : 0); - } -@@ -350,7 +345,7 @@ void *__arrayStart(BlkInfo info) - NOT included in the passed in size. Therefore, do NOT call this function - with the size of an allocated block. - */ --size_t __arrayPad(size_t size) -+size_t __arrayPad(size_t size) nothrow pure @safe - { - return size > MAXMEDSIZE ? LARGEPAD : (size > MAXSMALLSIZE ? MEDPAD : SMALLPAD); - } -@@ -382,7 +377,7 @@ else - int __nextBlkIdx; - } - --@property BlkInfo *__blkcache() -+@property BlkInfo *__blkcache() nothrow - { - if(!__blkcache_storage) - { -@@ -444,7 +439,7 @@ void processGCMarks(BlkInfo* cache, scop - the base ptr as an indication of whether the struct is valid, or set - the BlkInfo as a side-effect and return a bool to indicate success. - */ --BlkInfo *__getBlkInfo(void *interior) -+BlkInfo *__getBlkInfo(void *interior) nothrow - { - BlkInfo *ptr = __blkcache; - version(single_cache) -@@ -468,20 +463,20 @@ BlkInfo *__getBlkInfo(void *interior) - auto curi = ptr + __nextBlkIdx; - for(auto i = curi; i >= ptr; --i) - { -- if(i.base && i.base <= interior && (interior - i.base) < i.size) -+ if(i.base && i.base <= interior && cast(size_t)(interior - i.base) < i.size) - return i; - } - - for(auto i = ptr + N_CACHE_BLOCKS - 1; i > curi; --i) - { -- if(i.base && i.base <= interior && (interior - i.base) < i.size) -+ if(i.base && i.base <= interior && cast(size_t)(interior - i.base) < i.size) - return i; - } - } - return null; // not in cache. - } - --void __insertBlkInfoCache(BlkInfo bi, BlkInfo *curpos) -+void __insertBlkInfoCache(BlkInfo bi, BlkInfo *curpos) nothrow - { - version(single_cache) - { -@@ -634,6 +629,18 @@ body - jc Loverflow; - } - } -+ else version (D_InlineAsm_X86_64) -+ { -+ size_t reqsize = void; -+ -+ asm -+ { -+ mov RAX, newcapacity; -+ mul RAX, size; -+ mov reqsize, RAX; -+ jc Loverflow; -+ } -+ } - else - { - size_t reqsize = size * newcapacity; -@@ -701,6 +708,8 @@ body - if(u) - { - // extend worked, save the new current allocated size -+ if(bic) -+ bic.size = u; // update cache - curcapacity = u - offset - LARGEPAD; - return curcapacity / size; - } -@@ -2031,7 +2040,7 @@ void* _d_arrayliteralTX(const TypeInfo t - auto sizeelem = ti.next.tsize; // array element size - void* result; - -- //printf("_d_arrayliteralTX(sizeelem = %d, length = %d)\n", sizeelem, length); -+ debug(PRINTF) printf("_d_arrayliteralTX(sizeelem = %d, length = %d)\n", sizeelem, length); - if (length == 0 || sizeelem == 0) - result = null; - else ---- a/src/libphobos/libdruntime/rt/memory.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/memory.d 2014-04-01 16:32:51.000000000 +0100 -@@ -13,11 +13,9 @@ - module rt.memory; - - -+import core.memory; - private - { -- extern (C) void gc_addRange( void* p, size_t sz ); -- extern (C) void gc_removeRange( void* p ); -- - version( MinGW ) - { - extern (C) -@@ -110,19 +108,19 @@ void initStaticDataGC() - { - version( MinGW ) - { -- gc_addRange( &_data_start__, cast(size_t) &_bss_end__ - cast(size_t) &_data_start__ ); -+ GC.addRange( &_data_start__, cast(size_t) &_bss_end__ - cast(size_t) &_data_start__ ); - } - else version( Win32 ) - { -- gc_addRange( &_xi_a, cast(size_t) &_end - cast(size_t) &_xi_a ); -+ GC.addRange( &_xi_a, cast(size_t) &_end - cast(size_t) &_xi_a ); - } - else version( Win64 ) - { -- gc_addRange( &__xc_a, cast(size_t) &_deh_beg - cast(size_t) &__xc_a ); -+ GC.addRange( &__xc_a, cast(size_t) &_deh_beg - cast(size_t) &__xc_a ); - } - else version( linux ) - { -- gc_addRange( &__data_start, cast(size_t) &end - cast(size_t) &__data_start ); -+ GC.addRange( &__data_start, cast(size_t) &end - cast(size_t) &__data_start ); - } - else version( OSX ) - { -@@ -132,17 +130,17 @@ void initStaticDataGC() - { - version (X86_64) - { -- gc_addRange( &etext, cast(size_t) &_deh_end - cast(size_t) &etext ); -- gc_addRange( &__progname, cast(size_t) &_end - cast(size_t) &__progname ); -+ GC.addRange( &etext, cast(size_t) &_deh_end - cast(size_t) &etext ); -+ GC.addRange( &__progname, cast(size_t) &_end - cast(size_t) &__progname ); - } - else - { -- gc_addRange( &etext, cast(size_t) &_end - cast(size_t) &etext ); -+ GC.addRange( &etext, cast(size_t) &_end - cast(size_t) &etext ); - } - } - else version( Solaris ) - { -- gc_addRange(&__dso_handle, cast(size_t)&_end - cast(size_t)&__dso_handle); -+ GC.addRange(&__dso_handle, cast(size_t)&_end - cast(size_t)&__dso_handle); - } - else - { ---- a/src/libphobos/libdruntime/rt/minfo.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/minfo.d 2014-04-01 16:32:51.000000000 +0100 -@@ -2,7 +2,7 @@ - * Written in the D programming language. - * Module initialization routines. - * -- * Copyright: Copyright Digital Mars 2000 - 2012. -+ * Copyright: Copyright Digital Mars 2000 - 2013. - * License: Distributed under the - * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). - * (See accompanying file LICENSE) -@@ -17,9 +17,9 @@ import core.stdc.string; // memcpy - - enum - { -- MIctorstart = 1, // we've started constructing it -- MIctordone = 2, // finished construction -- MIstandalone = 4, // module ctor does not depend on other module -+ MIctorstart = 0x1, // we've started constructing it -+ MIctordone = 0x2, // finished construction -+ MIstandalone = 0x4, // module ctor does not depend on other module - // ctors being done first - MItlsctor = 8, - MItlsdtor = 0x10, -@@ -30,9 +30,16 @@ enum - MIunitTest = 0x200, - MIimportedModules = 0x400, - MIlocalClasses = 0x800, -- MInew = 0x80000000 // it's the "new" layout -+ MIname = 0x1000, - } - -+/***** -+ * A ModuleGroup is an unordered collection of modules. -+ * There is exactly one for: -+ * 1. all statically linked in D modules, either directely or as shared libraries -+ * 2. each call to rt_loadLibrary() -+ */ -+ - struct ModuleGroup - { - this(ModuleInfo*[] modules) -@@ -45,13 +52,152 @@ struct ModuleGroup - return _modules; - } - -+ /****************************** -+ * Allocate and fill in _ctors[] and _tlsctors[]. -+ * Modules are inserted into the arrays in the order in which the constructors -+ * need to be run. -+ * Throws: -+ * Exception if it fails. -+ */ - void sortCtors() - { -- // don't bother to initialize, as they are getting overwritten anyhow -- immutable n = _modules.length; -- _ctors = (cast(ModuleInfo**).malloc(n * size_t.sizeof))[0 .. n]; -- _tlsctors = (cast(ModuleInfo**).malloc(n * size_t.sizeof))[0 .. n]; -- .sortCtors(this); -+ immutable len = _modules.length; -+ if (!len) -+ return; -+ -+ static struct StackRec -+ { -+ @property ModuleInfo* mod() -+ { -+ return _mods[_idx]; -+ } -+ -+ ModuleInfo*[] _mods; -+ size_t _idx; -+ } -+ -+ auto stack = (cast(StackRec*).calloc(len, StackRec.sizeof))[0 .. len]; -+ if (!stack.ptr) -+ assert(0); -+ scope (exit) .free(stack.ptr); -+ -+ void sort(ref ModuleInfo*[] ctors, uint mask) -+ { -+ ctors = (cast(ModuleInfo**).malloc(len * size_t.sizeof))[0 .. len]; -+ if (!ctors.ptr) -+ assert(0); -+ -+ size_t stackidx = 0; -+ size_t cidx; -+ -+ ModuleInfo*[] mods = _modules; -+ size_t idx; -+ while (true) -+ { -+ while (idx < mods.length) -+ { -+ auto m = mods[idx]; -+ auto fl = m.flags; -+ if (fl & MIctorstart) -+ { -+ // trace back to cycle start -+ fl &= ~MIctorstart; -+ size_t start = stackidx; -+ while (start--) -+ { -+ auto sm = stack[start].mod; -+ if (sm == m) -+ break; -+ fl |= sm.flags & MIctorstart; -+ } -+ assert(stack[start].mod == m); -+ if (fl & MIctorstart) -+ { -+ /* This is an illegal cycle, no partial order can be established -+ * because the import chain have contradicting ctor/dtor -+ * constraints. -+ */ -+ string msg = "Aborting: Cycle detected between modules with ctors/dtors:\n"; -+ foreach (e; stack[start .. stackidx]) -+ { -+ msg ~= e.mod.name; -+ msg ~= " -> "; -+ } -+ msg ~= stack[start].mod.name; -+ free(); -+ throw new Exception(msg); -+ } -+ else -+ { -+ /* This is also a cycle, but the import chain does not constrain -+ * the order of initialization, either because the imported -+ * modules have no ctors or the ctors are standalone. -+ */ -+ ++idx; -+ } -+ } -+ else if (fl & MIctordone) -+ { // already visited => skip -+ ++idx; -+ } -+ else -+ { -+ if (fl & mask) -+ { -+ if (fl & MIstandalone || !m.importedModules.length) -+ { // trivial ctor => sort in -+ ctors[cidx++] = m; -+ m.flags = fl | MIctordone; -+ } -+ else -+ { // non-trivial ctor => defer -+ m.flags = fl | MIctorstart; -+ } -+ } -+ else // no ctor => mark as visited -+ m.flags = fl | MIctordone; -+ -+ if (m.importedModules.length) -+ { -+ /* Internal runtime error, dependency on an uninitialized -+ * module outside of the current module group. -+ */ -+ (stackidx < _modules.length) || assert(0); -+ -+ // recurse -+ stack[stackidx++] = StackRec(mods, idx); -+ idx = 0; -+ mods = m.importedModules; -+ } -+ } -+ } -+ -+ if (stackidx) -+ { // pop old value from stack -+ --stackidx; -+ mods = stack[stackidx]._mods; -+ idx = stack[stackidx]._idx; -+ auto m = mods[idx++]; -+ auto fl = m.flags; -+ if (fl & mask && !(fl & MIctordone)) -+ ctors[cidx++] = m; -+ m.flags = (fl & ~MIctorstart) | MIctordone; -+ } -+ else // done -+ break; -+ } -+ // store final number -+ ctors = ctors[0 .. cidx]; -+ -+ // clean flags -+ foreach(m; _modules) -+ m.flags = m.flags & ~(MIctorstart | MIctordone); -+ } -+ -+ /* Do two passes: ctor/dtor, tlsctor/tlsdtor -+ */ -+ sort(_ctors, MIctor | MIdtor); -+ sort(_tlsctors, MItlsctor | MItlsdtor); - } - - void runCtors() -@@ -85,11 +231,13 @@ struct ModuleGroup - - void free() - { -- .free(_ctors.ptr); -+ if (_ctors.ptr) -+ .free(_ctors.ptr); - _ctors = null; -- .free(_tlsctors.ptr); -+ if (_tlsctors.ptr) -+ .free(_tlsctors.ptr); - _tlsctors = null; -- _modules = null; -+ // _modules = null; // let the owner free it - } - - private: -@@ -125,24 +273,26 @@ int moduleinfos_apply(scope int delegate - * Module constructor and destructor routines. - */ - --extern (C) void rt_moduleCtor() -+extern (C) -+{ -+void rt_moduleCtor() - { - _moduleGroup = ModuleGroup(getModuleInfos()); - _moduleGroup.sortCtors(); - _moduleGroup.runCtors(); - } - --extern (C) void rt_moduleTlsCtor() -+void rt_moduleTlsCtor() - { - _moduleGroup.runTlsCtors(); - } - --extern (C) void rt_moduleTlsDtor() -+void rt_moduleTlsDtor() - { - _moduleGroup.runTlsDtors(); - } - --extern (C) void rt_moduleDtor() -+void rt_moduleDtor() - { - _moduleGroup.runDtors(); - version (Win32) {} else -@@ -150,6 +300,30 @@ extern (C) void rt_moduleDtor() - _moduleGroup.free(); - } - -+version (Win32) -+{ -+ // Alternate names for backwards compatibility with older DLL code -+ void _moduleCtor() -+ { -+ rt_moduleCtor(); -+ } -+ -+ void _moduleDtor() -+ { -+ rt_moduleDtor(); -+ } -+ -+ void _moduleTlsCtor() -+ { -+ rt_moduleTlsCtor(); -+ } -+ -+ void _moduleTlsDtor() -+ { -+ rt_moduleTlsDtor(); -+ } -+} -+ - /******************************************** - * Access compiler generated list of modules. - */ -@@ -298,7 +472,7 @@ body - } - return result; - } -- -+} - - /******************************************** - */ -@@ -321,182 +495,6 @@ void runModuleFuncsRev(alias getfp)(Modu - } - } - --/******************************************** -- * Check for cycles on module constructors, and establish an order for module -- * constructors. -- */ -- --void sortCtors(ref ModuleGroup mgroup) --in --{ -- assert(mgroup._modules.length == mgroup._ctors.length); -- assert(mgroup._modules.length == mgroup._tlsctors.length); --} --body --{ -- enum AllocaLimit = 100 * 1024; // 100KB -- -- immutable len = mgroup._modules.length; -- immutable size = len * StackRec.sizeof; -- -- if (!len) -- { -- return; -- } -- else if (size <= AllocaLimit) -- { -- auto p = cast(ubyte*).alloca(size); -- p[0 .. size] = 0; -- sortCtorsImpl(mgroup, (cast(StackRec*)p)[0 .. len]); -- } -- else -- { -- auto p = cast(ubyte*).malloc(size); -- p[0 .. size] = 0; -- sortCtorsImpl(mgroup, (cast(StackRec*)p)[0 .. len]); -- .free(p); -- } --} -- --private: -- --struct StackRec --{ -- @property ModuleInfo* mod() -- { -- return _mods[_idx]; -- } -- -- ModuleInfo*[] _mods; -- size_t _idx; --} -- --void onCycleError(StackRec[] stack) --{ -- string msg = "Aborting: Cycle detected between modules with ctors/dtors:\n"; -- foreach (e; stack) -- { -- msg ~= e.mod.name; -- msg ~= " -> "; -- } -- msg ~= stack[0].mod.name; -- throw new Exception(msg); --} -- --private void sortCtorsImpl(ref ModuleGroup mgroup, StackRec[] stack) --{ -- size_t stackidx; -- bool tlsPass; -- -- Lagain: -- -- const mask = tlsPass ? (MItlsctor | MItlsdtor) : (MIctor | MIdtor); -- auto ctors = tlsPass ? mgroup._tlsctors : mgroup._ctors; -- size_t cidx; -- -- ModuleInfo*[] mods = mgroup._modules; -- size_t idx; -- while (true) -- { -- while (idx < mods.length) -- { -- auto m = mods[idx]; -- auto fl = m.flags; -- if (fl & MIctorstart) -- { -- // trace back to cycle start -- fl &= ~MIctorstart; -- size_t start = stackidx; -- while (start--) -- { -- auto sm = stack[start].mod; -- if (sm == m) -- break; -- fl |= sm.flags & MIctorstart; -- } -- assert(stack[start].mod == m); -- if (fl & MIctorstart) -- { -- /* This is an illegal cycle, no partial order can be established -- * because the import chain have contradicting ctor/dtor -- * constraints. -- */ -- onCycleError(stack[start .. stackidx]); -- } -- else -- { -- /* This is also a cycle, but the import chain does not constrain -- * the order of initialization, either because the imported -- * modules have no ctors or the ctors are standalone. -- */ -- ++idx; -- } -- } -- else if (fl & MIctordone) -- { // already visited => skip -- ++idx; -- } -- else -- { -- if (fl & mask) -- { -- if (fl & MIstandalone || !m.importedModules.length) -- { // trivial ctor => sort in -- ctors[cidx++] = m; -- m.flags = fl | MIctordone; -- } -- else -- { // non-trivial ctor => defer -- m.flags = fl | MIctorstart; -- } -- } -- else // no ctor => mark as visited -- m.flags = fl | MIctordone; -- -- if (m.importedModules.length) -- { -- /* Internal runtime error, dependency on an uninitialized -- * module outside of the current module group. -- */ -- (stackidx < mgroup._modules.length) || assert(0); -- -- // recurse -- stack[stackidx++] = StackRec(mods, idx); -- idx = 0; -- mods = m.importedModules; -- } -- } -- } -- -- if (stackidx) -- { // pop old value from stack -- --stackidx; -- mods = stack[stackidx]._mods; -- idx = stack[stackidx]._idx; -- auto m = mods[idx++]; -- auto fl = m.flags; -- if (fl & mask && !(fl & MIctordone)) -- ctors[cidx++] = m; -- m.flags = (fl & ~MIctorstart) | MIctordone; -- } -- else // done -- break; -- } -- // store final number -- tlsPass ? mgroup._tlsctors : mgroup._ctors = ctors[0 .. cidx]; -- -- // clean flags -- foreach(m; mgroup._modules) -- m.flags = m.flags & ~(MIctorstart | MIctordone); -- -- // rerun for TLS constructors -- if (!tlsPass) -- { -- tlsPass = true; -- goto Lagain; -- } --} -- - unittest - { - static void assertThrown(T : Throwable, E)(lazy E expr) -@@ -512,38 +510,46 @@ unittest - { - } - -- static ModuleInfo mockMI(uint flags, ModuleInfo*[] imports...) -+ struct UTModuleInfo - { - ModuleInfo mi; -- mi.n.flags |= flags | MInew; -- size_t fcnt; -- auto p = cast(ubyte*)&mi + ModuleInfo.New.sizeof; -- foreach (fl; [MItlsctor, MItlsdtor, MIctor, MIdtor, MIictor]) -- { -- if (flags & fl) -- { -- *cast(void function()*)p = &stub; -- p += (&stub).sizeof; -- } -- } -+ size_t pad[8]; -+ alias mi this; -+ } -+ -+ static UTModuleInfo mockMI(uint flags, ModuleInfo*[] imports...) -+ { -+ import core.bitop; -+ size_t size = ModuleInfo.sizeof; -+ size += popcnt(flags & (MItlsctor|MItlsdtor|MIctor|MIdtor|MIictor)) * (void function()).sizeof; -+ if (imports.length) -+ size += size_t.sizeof + imports.length * (ModuleInfo*).sizeof; -+ assert(size <= UTModuleInfo.sizeof); -+ -+ UTModuleInfo mi; -+ mi._flags = flags; -+ auto p = cast(void function()*)&mi.pad; -+ if (flags & MItlsctor) *p++ = &stub; -+ if (flags & MItlsdtor) *p++ = &stub; -+ if (flags & MIctor) *p++ = &stub; -+ if (flags & MIdtor) *p++ = &stub; -+ if (flags & MIictor) *p++ = &stub; - if (imports.length) - { -- mi.n.flags |= MIimportedModules; -- *cast(size_t*)p = imports.length; -- p += size_t.sizeof; -- immutable nb = imports.length * (ModuleInfo*).sizeof; -- .memcpy(p, imports.ptr, nb); -- p += nb; -+ mi._flags |= MIimportedModules; -+ *cast(size_t*)p++ = imports.length; -+ .memcpy(p, imports.ptr, imports.length * (ModuleInfo*).sizeof); -+ p += imports.length; - } -- assert(p - cast(ubyte*)&mi <= ModuleInfo.sizeof); -+ assert(cast(void*)p <= &mi + 1); - return mi; - } - -- ModuleInfo m0, m1, m2; -+ UTModuleInfo m0, m1, m2; - - void checkExp(ModuleInfo*[] dtors=null, ModuleInfo*[] tlsdtors=null) - { -- auto mgroup = ModuleGroup([&m0, &m1, &m2]); -+ auto mgroup = ModuleGroup([&m0.mi, &m1.mi, &m2.mi]); - mgroup.sortCtors(); - foreach (m; mgroup._modules) - assert(!(m.flags & (MIctorstart | MIctordone))); -@@ -567,68 +573,75 @@ unittest - m0 = mockMI(MIstandalone | MIctor); - m1 = mockMI(0); - m2 = mockMI(0); -- checkExp([&m0]); -+ checkExp([&m0.mi]); - - // imported standalone => no dependency - m0 = mockMI(MIstandalone | MIctor); -- m1 = mockMI(MIstandalone | MIctor, &m0); -+ m1 = mockMI(MIstandalone | MIctor, &m0.mi); - m2 = mockMI(0); -- checkExp([&m0, &m1]); -+ checkExp([&m0.mi, &m1.mi]); - -- m0 = mockMI(MIstandalone | MIctor, &m1); -+ m0 = mockMI(MIstandalone | MIctor, &m1.mi); - m1 = mockMI(MIstandalone | MIctor); - m2 = mockMI(0); -- checkExp([&m0, &m1]); -+ checkExp([&m0.mi, &m1.mi]); - - // standalone may have cycle -- m0 = mockMI(MIstandalone | MIctor, &m1); -- m1 = mockMI(MIstandalone | MIctor, &m0); -+ m0 = mockMI(MIstandalone | MIctor, &m1.mi); -+ m1 = mockMI(MIstandalone | MIctor, &m0.mi); - m2 = mockMI(0); -- checkExp([&m0, &m1]); -+ checkExp([&m0.mi, &m1.mi]); - - // imported ctor => ordered ctors - m0 = mockMI(MIctor); -- m1 = mockMI(MIctor, &m0); -+ m1 = mockMI(MIctor, &m0.mi); - m2 = mockMI(0); -- checkExp([&m0, &m1], []); -+ checkExp([&m0.mi, &m1.mi], []); - -- m0 = mockMI(MIctor, &m1); -+ m0 = mockMI(MIctor, &m1.mi); - m1 = mockMI(MIctor); - m2 = mockMI(0); -- checkExp([&m1, &m0], []); -+ assert(m0.importedModules == [&m1.mi]); -+ checkExp([&m1.mi, &m0.mi], []); - - // detects ctors cycles -- m0 = mockMI(MIctor, &m1); -- m1 = mockMI(MIctor, &m0); -+ m0 = mockMI(MIctor, &m1.mi); -+ m1 = mockMI(MIctor, &m0.mi); - m2 = mockMI(0); - assertThrown!Throwable(checkExp()); - - // imported ctor/tlsctor => ordered ctors/tlsctors -- m0 = mockMI(MIctor, &m1, &m2); -+ m0 = mockMI(MIctor, &m1.mi, &m2.mi); - m1 = mockMI(MIctor); - m2 = mockMI(MItlsctor); -- checkExp([&m1, &m0], [&m2]); -+ checkExp([&m1.mi, &m0.mi], [&m2.mi]); - -- m0 = mockMI(MIctor | MItlsctor, &m1, &m2); -+ m0 = mockMI(MIctor | MItlsctor, &m1.mi, &m2.mi); - m1 = mockMI(MIctor); - m2 = mockMI(MItlsctor); -- checkExp([&m1, &m0], [&m2, &m0]); -+ checkExp([&m1.mi, &m0.mi], [&m2.mi, &m0.mi]); - - // no cycle between ctors/tlsctors -- m0 = mockMI(MIctor, &m1, &m2); -+ m0 = mockMI(MIctor, &m1.mi, &m2.mi); - m1 = mockMI(MIctor); -- m2 = mockMI(MItlsctor, &m0); -- checkExp([&m1, &m0], [&m2]); -+ m2 = mockMI(MItlsctor, &m0.mi); -+ checkExp([&m1.mi, &m0.mi], [&m2.mi]); - - // detects tlsctors cycle -- m0 = mockMI(MItlsctor, &m2); -+ m0 = mockMI(MItlsctor, &m2.mi); - m1 = mockMI(MIctor); -- m2 = mockMI(MItlsctor, &m0); -+ m2 = mockMI(MItlsctor, &m0.mi); - assertThrown!Throwable(checkExp()); - - // closed ctors cycle -- m0 = mockMI(MIctor, &m1); -- m1 = mockMI(MIstandalone | MIctor, &m2); -- m2 = mockMI(MIstandalone | MIctor, &m0); -- checkExp([&m1, &m2, &m0], []); -+ m0 = mockMI(MIctor, &m1.mi); -+ m1 = mockMI(MIstandalone | MIctor, &m2.mi); -+ m2 = mockMI(MIstandalone | MIctor, &m0.mi); -+ checkExp([&m1.mi, &m2.mi, &m0.mi], []); -+} -+ -+version (Win64) -+{ -+ // Dummy so Win32 code can still call it -+ extern(C) void _minit() { } - } ---- a/src/libphobos/libdruntime/rt/monitor_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/monitor_.d 2014-04-01 16:32:51.000000000 +0100 -@@ -11,6 +11,11 @@ - * (See accompanying file LICENSE or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -+ -+/* NOTE: This file has been patched from the original DMD distribution to -+ work with the GDC compiler. -+ Modified by Iain Buclaw, December 2013 -+*/ - module rt.monitor_; - - //debug=PRINTF; -@@ -19,64 +24,18 @@ private - { - debug(PRINTF) import core.stdc.stdio; - import core.stdc.stdlib; -- -- version( linux ) -- { -- version = USE_PTHREADS; -- } -- else version( FreeBSD ) -- { -- version = USE_PTHREADS; -- } -- else version( OSX ) -- { -- version = USE_PTHREADS; -- } -- else version( Solaris ) -- { -- version = USE_PTHREADS; -- } -+ import gcc.gthreads; - - // This is what the monitor reference in Object points to - alias Object.Monitor IMonitor; - alias void delegate(Object) DEvent; - -- version( Windows ) -+ struct Monitor - { -- import core.sys.windows.windows; -- -- struct Monitor -- { -- IMonitor impl; // for user-level monitors -- DEvent[] devt; // for internal monitors -- size_t refs; // reference count -- CRITICAL_SECTION mon; -- } -- } -- else version( USE_PTHREADS ) -- { -- import core.sys.posix.pthread; -- -- struct Monitor -- { -- IMonitor impl; // for user-level monitors -- DEvent[] devt; // for internal monitors -- size_t refs; // reference count -- pthread_mutex_t mon; -- } -- } -- else version( NoSystem ) -- { -- struct Monitor -- { -- IMonitor impl; // for user-level monitors -- DEvent[] devt; // for internal monitors -- size_t refs; // reference count -- } -- } -- else -- { -- static assert(0, "Unsupported platform"); -+ IMonitor impl; // for user-level monitors -+ DEvent[] devt; // for internal monitors -+ size_t refs; // reference count -+ gthread_recursive_mutex_t mon; - } - - Monitor* getMonitor(Object h) -@@ -93,223 +52,81 @@ private - } - - --/* =============================== Win32 ============================ */ -+static __gshared gthread_recursive_mutex_t _monitor_critsec; - --version( Windows ) -+extern (C) void _STI_monitor_staticctor() - { -- static __gshared CRITICAL_SECTION _monitor_critsec; -- -- extern (C) void _STI_monitor_staticctor() -+ debug(PRINTF) printf("+_STI_monitor_staticctor()\n"); -+ if (!inited) - { -- debug(PRINTF) printf("+_STI_monitor_staticctor()\n"); -- if (!inited) -- { -- InitializeCriticalSection(&_monitor_critsec); -- inited = 1; -- } -- debug(PRINTF) printf("-_STI_monitor_staticctor()\n"); -- } -- -- extern (C) void _STD_monitor_staticdtor() -- { -- debug(PRINTF) printf("+_STI_monitor_staticdtor() - d\n"); -- if (inited) -- { -- inited = 0; -- DeleteCriticalSection(&_monitor_critsec); -- } -- debug(PRINTF) printf("-_STI_monitor_staticdtor() - d\n"); -- } -- -- extern (C) void _d_monitor_create(Object h) -- { -- /* -- * NOTE: Assume this is only called when h.__monitor is null prior to the -- * call. However, please note that another thread may call this function -- * at the same time, so we can not assert this here. Instead, try and -- * create a lock, and if one already exists then forget about it. -- */ -- -- debug(PRINTF) printf("+_d_monitor_create(%p)\n", h); -- assert(h); -- Monitor *cs; -- EnterCriticalSection(&_monitor_critsec); -- if (!h.__monitor) -- { -- cs = cast(Monitor *)calloc(Monitor.sizeof, 1); -- assert(cs); -- InitializeCriticalSection(&cs.mon); -- setMonitor(h, cs); -- cs.refs = 1; -- cs = null; -- } -- LeaveCriticalSection(&_monitor_critsec); -- if (cs) -- free(cs); -- debug(PRINTF) printf("-_d_monitor_create(%p)\n", h); -- } -- -- extern (C) void _d_monitor_destroy(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_destroy(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- DeleteCriticalSection(&getMonitor(h).mon); -- free(h.__monitor); -- setMonitor(h, null); -- debug(PRINTF) printf("-_d_monitor_destroy(%p)\n", h); -- } -- -- extern (C) void _d_monitor_lock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_acquire(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- EnterCriticalSection(&getMonitor(h).mon); -- debug(PRINTF) printf("-_d_monitor_acquire(%p)\n", h); -- } -- -- extern (C) void _d_monitor_unlock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_release(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- LeaveCriticalSection(&getMonitor(h).mon); -- debug(PRINTF) printf("-_d_monitor_release(%p)\n", h); -+ gthread_recursive_mutex_init(&_monitor_critsec); -+ inited = 1; - } -+ debug(PRINTF) printf("-_STI_monitor_staticctor()\n"); - } - --/* =============================== linux ============================ */ -- --version( USE_PTHREADS ) -+extern (C) void _STD_monitor_staticdtor() - { -- // Includes attribute fixes from David Friedman's GDC port -- static __gshared pthread_mutex_t _monitor_critsec; -- static __gshared pthread_mutexattr_t _monitors_attr; -- -- extern (C) void _STI_monitor_staticctor() -+ debug(PRINTF) printf("+_STI_monitor_staticdtor() - d\n"); -+ if (inited) - { -- if (!inited) -- { -- pthread_mutexattr_init(&_monitors_attr); -- pthread_mutexattr_settype(&_monitors_attr, PTHREAD_MUTEX_RECURSIVE); -- pthread_mutex_init(&_monitor_critsec, &_monitors_attr); -- inited = 1; -- } -- } -- -- extern (C) void _STD_monitor_staticdtor() -- { -- if (inited) -- { -- inited = 0; -- pthread_mutex_destroy(&_monitor_critsec); -- pthread_mutexattr_destroy(&_monitors_attr); -- } -- } -- -- extern (C) void _d_monitor_create(Object h) -- { -- /* -- * NOTE: Assume this is only called when h.__monitor is null prior to the -- * call. However, please note that another thread may call this function -- * at the same time, so we can not assert this here. Instead, try and -- * create a lock, and if one already exists then forget about it. -- */ -- -- debug(PRINTF) printf("+_d_monitor_create(%p)\n", h); -- assert(h); -- Monitor *cs; -- pthread_mutex_lock(&_monitor_critsec); -- if (!h.__monitor) -- { -- cs = cast(Monitor *)calloc(Monitor.sizeof, 1); -- assert(cs); -- pthread_mutex_init(&cs.mon, &_monitors_attr); -- setMonitor(h, cs); -- cs.refs = 1; -- cs = null; -- } -- pthread_mutex_unlock(&_monitor_critsec); -- if (cs) -- free(cs); -- debug(PRINTF) printf("-_d_monitor_create(%p)\n", h); -- } -- -- extern (C) void _d_monitor_destroy(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_destroy(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- pthread_mutex_destroy(&getMonitor(h).mon); -- free(h.__monitor); -- setMonitor(h, null); -- debug(PRINTF) printf("-_d_monitor_destroy(%p)\n", h); -- } -- -- extern (C) void _d_monitor_lock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_acquire(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- pthread_mutex_lock(&getMonitor(h).mon); -- debug(PRINTF) printf("-_d_monitor_acquire(%p)\n", h); -- } -- -- extern (C) void _d_monitor_unlock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_release(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- pthread_mutex_unlock(&getMonitor(h).mon); -- debug(PRINTF) printf("-_d_monitor_release(%p)\n", h); -+ inited = 0; -+ gthread_recursive_mutex_destroy(&_monitor_critsec); - } -+ debug(PRINTF) printf("-_STI_monitor_staticdtor() - d\n"); - } - --/* ================================= No System ============================ */ -- --version( NoSystem ) -+extern (C) void _d_monitor_create(Object h) - { -- extern (C) void _STI_monitor_staticctor() -- { -- } -- -- extern (C) void _STD_monitor_staticdtor() -- { -- } -- -- extern (C) void _d_monitor_create(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_create(%p)\n", h); -- assert(h); -- Monitor *cs; -- if (!h.__monitor) -- { -- cs = cast(Monitor *)calloc(Monitor.sizeof, 1); -- assert(cs); -- setMonitor(h, cs); -- cs.refs = 1; -- cs = null; -- } -- if (cs) -- free(cs); -- debug(PRINTF) printf("-_d_monitor_create(%p)\n", h); -- } -+ /* -+ * NOTE: Assume this is only called when h.__monitor is null prior to the -+ * call. However, please note that another thread may call this function -+ * at the same time, so we can not assert this here. Instead, try and -+ * create a lock, and if one already exists then forget about it. -+ */ -+ -+ debug(PRINTF) printf("+_d_monitor_create(%p)\n", h); -+ assert(h); -+ Monitor *cs; -+ gthread_recursive_mutex_lock(&_monitor_critsec); -+ if (!h.__monitor) -+ { -+ cs = cast(Monitor *)calloc(Monitor.sizeof, 1); -+ assert(cs); -+ gthread_recursive_mutex_init(&cs.mon); -+ setMonitor(h, cs); -+ cs.refs = 1; -+ cs = null; -+ } -+ gthread_recursive_mutex_unlock(&_monitor_critsec); -+ if (cs) -+ free(cs); -+ debug(PRINTF) printf("-_d_monitor_create(%p)\n", h); -+} - -- extern (C) void _d_monitor_destroy(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_destroy(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- free(h.__monitor); -- setMonitor(h, null); -- debug(PRINTF) printf("-_d_monitor_destroy(%p)\n", h); -- } -+extern (C) void _d_monitor_destroy(Object h) -+{ -+ debug(PRINTF) printf("+_d_monitor_destroy(%p)\n", h); -+ assert(h && h.__monitor && !getMonitor(h).impl); -+ gthread_recursive_mutex_destroy(&getMonitor(h).mon); -+ free(h.__monitor); -+ setMonitor(h, null); -+ debug(PRINTF) printf("-_d_monitor_destroy(%p)\n", h); -+} - -- extern (C) void _d_monitor_lock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_acquire(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- debug(PRINTF) printf("-_d_monitor_acquire(%p)\n", h); -- } -+extern (C) void _d_monitor_lock(Object h) -+{ -+ debug(PRINTF) printf("+_d_monitor_acquire(%p)\n", h); -+ assert(h && h.__monitor && !getMonitor(h).impl); -+ gthread_recursive_mutex_lock(&getMonitor(h).mon); -+ debug(PRINTF) printf("-_d_monitor_acquire(%p)\n", h); -+} - -- extern (C) void _d_monitor_unlock(Object h) -- { -- debug(PRINTF) printf("+_d_monitor_release(%p)\n", h); -- assert(h && h.__monitor && !getMonitor(h).impl); -- debug(PRINTF) printf("-_d_monitor_release(%p)\n", h); -- } -+extern (C) void _d_monitor_unlock(Object h) -+{ -+ debug(PRINTF) printf("+_d_monitor_release(%p)\n", h); -+ assert(h && h.__monitor && !getMonitor(h).impl); -+ gthread_recursive_mutex_unlock(&getMonitor(h).mon); -+ debug(PRINTF) printf("-_d_monitor_release(%p)\n", h); - } -+ ---- a/src/libphobos/libdruntime/rt/qsort.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/qsort.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,135 +1,86 @@ --/* -- Portions of this file are: -- Copyright Prototronics, 1987 -- Totem Lake P.O. 8117 -- Kirkland, Washington 98034 -- (206) 820-1972 -- Licensed to Digital Mars. -- -- June 11, 1987 from Ray Gardner's -- Denver, Colorado) public domain version -- -- Use qsort2.d instead of this file if a redistributable version of -- _adSort() is required. --*/ -- -+/** -+ * This is a public domain version of qsort.d. All it does is call C's -+ * qsort(). -+ * -+ * Copyright: Copyright Digital Mars 2000 - 2010. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: Walter Bright, Martin Nowak -+ */ -+ -+/* Copyright Digital Mars 2000 - 2010. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE_1_0.txt or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ - module rt.qsort; - --/* --** Sorts an array starting at base, of length nbr_elements, each --** element of size width_bytes, ordered via compare_function; which --** is called as (*comp_fp)(ptr_to_element1, ptr_to_element2) --** and returns < 0 if element1 < element2, 0 if element1 = element2, --** > 0 if element1 > element2. Most of the refinements are due to --** R. Sedgewick. See "Implementing Quicksort Programs", Comm. ACM, --** Oct. 1978, and Corrigendum, Comm. ACM, June 1979. --*/ -- --//debug=qsort; // uncomment to turn on debugging printf's -- --import core.stdc.stdlib; -- -- -+//debug=qsort; - --private const int _maxspan = 7; // subarrays of _maxspan or fewer elements -- // will be sorted by a simple insertion sort -- --/* Adjust _maxspan according to relative cost of a swap and a compare. Reduce --_maxspan (not less than 1) if a swap is very expensive such as when you have --an array of large structures to be sorted, rather than an array of pointers to --structures. The default value is optimized for a high cost for compares. */ -+private import core.stdc.stdlib; - -+version (linux) -+{ -+ alias extern (C) int function(const void *, const void *, void *) Cmp; -+ extern (C) void qsort_r(void *base, size_t nmemb, size_t size, Cmp cmp, void *arg); - --extern (C) void[] _adSort(void[] a, TypeInfo ti) -+ extern (C) void[] _adSort(void[] a, TypeInfo ti) -+ { -+ extern (C) int cmp(in void* p1, in void* p2, void* ti) -+ { -+ return (cast(TypeInfo)ti).compare(p1, p2); -+ } -+ qsort_r(a.ptr, a.length, ti.tsize, &cmp, cast(void*)ti); -+ return a; -+ } -+} -+else version (FreeBSD) - { -- byte*[40] stackbuf = void; // initial stack buffer -- auto stack = stackbuf[0..$]; // stack -- auto sp = stack.ptr; // stack pointer -- -- auto width = ti.tsize; -- auto base = cast(byte *)a.ptr; -- auto thresh = _maxspan * width; // size of _maxspan elements in bytes -- auto limit = base + a.length * width; // pointer past end of array -- while (1) // repeat until done then return -- { -- while (limit - base > thresh) // if more than _maxspan elements -+ alias extern (C) int function(void *, const void *, const void *) Cmp; -+ extern (C) void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, Cmp cmp); -+ -+ extern (C) void[] _adSort(void[] a, TypeInfo ti) - { -- //swap middle, base -- ti.swap((cast(uint)(limit - base) >> 1) - -- (((cast(uint)(limit - base) >> 1)) % width) + base, base); -- -- auto i = base + width; // i scans from left to right -- auto j = limit - width; // j scans from right to left -- -- if (ti.compare(i, j) > 0) // Sedgewick's -- ti.swap(i, j); // three-element sort -- if (ti.compare(base, j) > 0) // sets things up -- ti.swap(base, j); // so that -- if (ti.compare(i, base) > 0) // *i <= *base <= *j -- ti.swap(i, base); // *base is the pivot element -- -- while (1) -- { -- do // move i right until *i >= pivot -- i += width; -- while (ti.compare(i, base) < 0); -- do // move j left until *j <= pivot -- j -= width; -- while (ti.compare(j, base) > 0); -- if (i > j) // break loop if pointers crossed -- break; -- ti.swap(i, j); // else swap elements, keep scanning -- } -- ti.swap(base, j); // move pivot into correct place -- if (j - base > limit - i) // if left subarray is larger... -- { -- sp[0] = base; // stack left subarray base -- sp[1] = j; // and limit -- base = i; // sort the right subarray -- } -- else // else right subarray is larger -- { -- sp[0] = i; // stack right subarray base -- sp[1] = limit; // and limit -- limit = j; // sort the left subarray -- } -- sp += 2; // increment stack pointer -- if (sp == stack.ptr + stack.length) -- { -- // Double the size of stack[] -- auto newstack = cast(byte**)alloca(stack.length * 2 * (*sp).sizeof); -- newstack[0..stack.length] = stack[]; -- sp = &newstack[stack.length]; -- stack = newstack[0..stack.length * 2]; -- } -+ extern (C) int cmp(void* ti, in void* p1, in void* p2) -+ { -+ return (cast(TypeInfo)ti).compare(p1, p2); -+ } -+ qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp); -+ return a; - } -+} -+else version (OSX) -+{ -+ alias extern (C) int function(void *, const void *, const void *) Cmp; -+ extern (C) void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, Cmp cmp); - -- // Insertion sort on remaining subarray -- auto i = base + width; -- while (i < limit) -+ extern (C) void[] _adSort(void[] a, TypeInfo ti) - { -- auto j = i; -- while (j > base && ti.compare(j - width, j) > 0) -- { -- ti.swap(j - width, j); -- j -= width; -- } -- i += width; -+ extern (C) int cmp(void* ti, in void* p1, in void* p2) -+ { -+ return (cast(TypeInfo)ti).compare(p1, p2); -+ } -+ qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp); -+ return a; - } -+} -+else -+{ -+ private TypeInfo tiglobal; - -- if (sp > stack.ptr) // if any entries on stack... -+ extern (C) void[] _adSort(void[] a, TypeInfo ti) - { -- sp -= 2; // pop the base and limit -- base = sp[0]; -- limit = sp[1]; -+ extern (C) int cmp(in void* p1, in void* p2) -+ { -+ return tiglobal.compare(p1, p2); -+ } -+ tiglobal = ti; -+ qsort(a.ptr, a.length, ti.tsize, &cmp); -+ return a; - } -- else // else stack empty, all done -- return *cast(void[]*)(&a); -- } -- assert(0); - } - - -+ - unittest - { - debug(qsort) printf("array.sort.unittest()\n"); -@@ -155,8 +106,4 @@ unittest - //printf(" %d %d\n", a[i], a[i + 1]); - assert(a[i] <= a[i + 1]); - } -- -- auto b = new uint[0xFF_FFFF]; -- b.sort; - } -- ---- a/src/libphobos/libdruntime/rt/switch_.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/switch_.d 2014-04-01 16:32:51.000000000 +0100 -@@ -35,9 +35,7 @@ in - assert(ca.length >= 0); - - // Make sure table[] is sorted correctly -- int j; -- -- for (j = 1; j < table.length; j++) -+ for (size_t j = 1u; j < table.length; j++) - { - auto len1 = table[j - 1].length; - auto len2 = table[j].length; -@@ -54,14 +52,13 @@ in - } - out (result) - { -- int i; - int cj; - - //printf("out _d_switch_string()\n"); - if (result == -1) - { - // Not found -- for (i = 0; i < table.length; i++) -+ for (auto i = 0u; i < table.length; i++) - { - if (table[i].length == ca.length) - { cj = memcmp(table[i].ptr, ca.ptr, ca.length); -@@ -71,8 +68,8 @@ out (result) - } - else - { -- assert(0 <= result && result < table.length); -- for (i = 0; 1; i++) -+ assert(0 <= result && cast(size_t)result < table.length); -+ for (auto i = 0u; 1; i++) - { - assert(i < table.length); - if (table[i].length == ca.length) -@@ -182,9 +179,7 @@ in - assert(ca.length >= 0); - - // Make sure table[] is sorted correctly -- int j; -- -- for (j = 1; j < table.length; j++) -+ for (size_t j = 1u; j < table.length; j++) - { - auto len1 = table[j - 1].length; - auto len2 = table[j].length; -@@ -201,14 +196,13 @@ in - } - out (result) - { -- int i; - int c; - - //printf("out _d_switch_ustring()\n"); - if (result == -1) - { - // Not found -- for (i = 0; i < table.length; i++) -+ for (auto i = 0u; i < table.length; i++) - { - if (table[i].length == ca.length) - { c = memcmp(table[i].ptr, ca.ptr, ca.length * wchar.sizeof); -@@ -218,8 +212,8 @@ out (result) - } - else - { -- assert(0 <= result && result < table.length); -- for (i = 0; 1; i++) -+ assert(0 <= result && cast(size_t)result < table.length); -+ for (auto i = 0u; 1; i++) - { - assert(i < table.length); - if (table[i].length == ca.length) -@@ -315,7 +309,7 @@ in - assert(ca.length >= 0); - - // Make sure table[] is sorted correctly -- for (auto j = 1; j < table.length; j++) -+ for (auto j = 1u; j < table.length; j++) - { - auto len1 = table[j - 1].length; - auto len2 = table[j].length; -@@ -334,7 +328,7 @@ out (result) - if (result == -1) - { - // Not found -- for (auto i = 0; i < table.length; i++) -+ for (auto i = 0u; i < table.length; i++) - { - if (table[i].length == ca.length) - { auto c = memcmp(table[i].ptr, ca.ptr, ca.length * dchar.sizeof); -@@ -344,8 +338,8 @@ out (result) - } - else - { -- assert(0 <= result && result < table.length); -- for (auto i = 0; 1; i++) -+ assert(0 <= result && cast(size_t)result < table.length); -+ for (auto i = 0u; 1; i++) - { - assert(i < table.length); - if (table[i].length == ca.length) ---- a/src/libphobos/libdruntime/rt/tlsgc.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/tlsgc.d 2014-04-01 16:32:51.000000000 +0100 -@@ -30,13 +30,13 @@ struct Data - */ - Data* init() - { -- auto p = cast(Data*).malloc(Data.sizeof); -- *p = Data.init; -+ auto data = cast(Data*).malloc(Data.sizeof); -+ *data = Data.init; - - // do module specific initialization -- p.blockInfoCache = &rt.lifetime.__blkcache_storage; -+ data.blockInfoCache = &rt.lifetime.__blkcache_storage; - -- return p; -+ return data; - } - - /** ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_AC.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_AC.d 2014-04-01 16:32:51.000000000 +0100 -@@ -21,12 +21,7 @@ class TypeInfo_AC : TypeInfo_Array - - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- //pure: -- //nothrow: -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - Object[] s = *cast(Object[]*)p; - size_t hash = 0; -@@ -39,7 +34,7 @@ class TypeInfo_AC : TypeInfo_Array - return hash; - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - Object[] s1 = *cast(Object[]*)p1; - Object[] s2 = *cast(Object[]*)p2; -@@ -62,7 +57,7 @@ class TypeInfo_AC : TypeInfo_Array - return false; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - Object[] s1 = *cast(Object[]*)p1; - Object[] s2 = *cast(Object[]*)p2; -@@ -96,8 +91,8 @@ class TypeInfo_AC : TypeInfo_Array - return c < 0 ? -1 : c > 0 ? 1 : 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(Object); -+ return cast(inout)typeid(Object); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Acdouble.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Acdouble.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Ar : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "cdouble[]"; } - -- override string toString() const pure nothrow @safe { return "cdouble[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - cdouble[] s = *cast(cdouble[]*)p; - return hashOf(s.ptr, s.length * cdouble.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - cdouble[] s1 = *cast(cdouble[]*)p1; - cdouble[] s2 = *cast(cdouble[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Ar : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - cdouble[] s1 = *cast(cdouble[]*)p1; - cdouble[] s2 = *cast(cdouble[]*)p2; -@@ -72,8 +67,8 @@ class TypeInfo_Ar : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(cdouble); -+ return cast(inout)typeid(cdouble); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Acfloat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Acfloat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Aq : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "cfloat[]"; } - -- override string toString() const pure nothrow @safe { return "cfloat[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - cfloat[] s = *cast(cfloat[]*)p; - return hashOf(s.ptr, s.length * cfloat.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - cfloat[] s1 = *cast(cfloat[]*)p1; - cfloat[] s2 = *cast(cfloat[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Aq : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - cfloat[] s1 = *cast(cfloat[]*)p1; - cfloat[] s2 = *cast(cfloat[]*)p2; -@@ -72,8 +67,8 @@ class TypeInfo_Aq : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(cfloat); -+ return cast(inout)typeid(cfloat); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Acreal.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Acreal.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Ac : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "creal[]"; } - -- override string toString() const pure nothrow @safe { return "creal[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - creal[] s = *cast(creal[]*)p; - return hashOf(s.ptr, s.length * creal.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - creal[] s1 = *cast(creal[]*)p1; - creal[] s2 = *cast(creal[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Ac : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - creal[] s1 = *cast(creal[]*)p1; - creal[] s2 = *cast(creal[]*)p2; -@@ -72,8 +67,8 @@ class TypeInfo_Ac : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(creal); -+ return cast(inout)typeid(creal); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Adouble.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Adouble.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Ad : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "double[]"; } - -- override string toString() const pure nothrow @safe { return "double[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - double[] s = *cast(double[]*)p; - return hashOf(s.ptr, s.length * double.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - double[] s1 = *cast(double[]*)p1; - double[] s2 = *cast(double[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Ad : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - double[] s1 = *cast(double[]*)p1; - double[] s2 = *cast(double[]*)p2; -@@ -72,9 +67,9 @@ class TypeInfo_Ad : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(double); -+ return cast(inout)typeid(double); - } - } - -@@ -82,15 +77,10 @@ class TypeInfo_Ad : TypeInfo_Array - - class TypeInfo_Ap : TypeInfo_Ad - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "idouble[]"; } -+ override string toString() const { return "idouble[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(idouble); -+ return cast(inout)typeid(idouble); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Afloat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Afloat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Af : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "float[]"; } - -- override string toString() const pure nothrow @safe { return "float[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - float[] s = *cast(float[]*)p; - return hashOf(s.ptr, s.length * float.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - float[] s1 = *cast(float[]*)p1; - float[] s2 = *cast(float[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Af : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - float[] s1 = *cast(float[]*)p1; - float[] s2 = *cast(float[]*)p2; -@@ -72,9 +67,9 @@ class TypeInfo_Af : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(float); -+ return cast(inout)typeid(float); - } - } - -@@ -82,15 +77,10 @@ class TypeInfo_Af : TypeInfo_Array - - class TypeInfo_Ao : TypeInfo_Af - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "ifloat[]"; } -+ override string toString() const { return "ifloat[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(ifloat); -+ return cast(inout)typeid(ifloat); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Ag.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Ag.d 2014-04-01 16:32:51.000000000 +0100 -@@ -23,20 +23,15 @@ class TypeInfo_Ag : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "byte[]"; } - -- override string toString() const pure nothrow @safe { return "byte[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - byte[] s = *cast(byte[]*)p; - return hashOf(s.ptr, s.length * byte.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - byte[] s1 = *cast(byte[]*)p1; - byte[] s2 = *cast(byte[]*)p2; -@@ -45,7 +40,7 @@ class TypeInfo_Ag : TypeInfo_Array - memcmp(cast(byte *)s1, cast(byte *)s2, s1.length) == 0; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - byte[] s1 = *cast(byte[]*)p1; - byte[] s2 = *cast(byte[]*)p2; -@@ -66,9 +61,9 @@ class TypeInfo_Ag : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(byte); -+ return cast(inout)typeid(byte); - } - } - -@@ -77,14 +72,9 @@ class TypeInfo_Ag : TypeInfo_Array - - class TypeInfo_Ah : TypeInfo_Ag - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "ubyte[]"; } -+ override string toString() const { return "ubyte[]"; } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - char[] s1 = *cast(char[]*)p1; - char[] s2 = *cast(char[]*)p2; -@@ -92,9 +82,9 @@ class TypeInfo_Ah : TypeInfo_Ag - return dstrcmp(s1, s2); - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(ubyte); -+ return cast(inout)typeid(ubyte); - } - } - -@@ -102,16 +92,11 @@ class TypeInfo_Ah : TypeInfo_Ag - - class TypeInfo_Av : TypeInfo_Ah - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "void[]"; } -+ override string toString() const { return "void[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(void); -+ return cast(inout)typeid(void); - } - } - -@@ -119,31 +104,21 @@ class TypeInfo_Av : TypeInfo_Ah - - class TypeInfo_Ab : TypeInfo_Ah - { -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "bool[]"; } - -- override string toString() const pure nothrow @safe { return "bool[]"; } -- -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(bool); -+ return cast(inout)typeid(bool); - } - } - - // char[] - --class TypeInfo_Aa : TypeInfo_Ag -+class TypeInfo_Aa : TypeInfo_Ah - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "char[]"; } -+ override string toString() const { return "char[]"; } - -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - char[] s = *cast(char[]*)p; - size_t hash = 0; -@@ -193,9 +168,9 @@ else - return hash; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(char); -+ return cast(inout)typeid(char); - } - } - -@@ -203,16 +178,22 @@ else - - class TypeInfo_Aya : TypeInfo_Aa - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "immutable(char)[]"; } -+ override string toString() const { return "immutable(char)[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(immutable(char)); -+ return cast(inout)typeid(immutable(char)); - } - } - -+// const(char)[] -+ -+class TypeInfo_Axa : TypeInfo_Aa -+{ -+ override string toString() const { return "const(char)[]"; } -+ -+ override @property inout(TypeInfo) next() inout -+ { -+ return cast(inout)typeid(const(char)); -+ } -+} ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Aint.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Aint.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Ai : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "int[]"; } - -- override string toString() const pure nothrow @safe { return "int[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - int[] s = *cast(int[]*)p; - return hashOf(s.ptr, s.length * int.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - int[] s1 = *cast(int[]*)p1; - int[] s2 = *cast(int[]*)p2; -@@ -44,7 +39,7 @@ class TypeInfo_Ai : TypeInfo_Array - memcmp(cast(void *)s1, cast(void *)s2, s1.length * int.sizeof) == 0; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - int[] s1 = *cast(int[]*)p1; - int[] s2 = *cast(int[]*)p2; -@@ -65,9 +60,9 @@ class TypeInfo_Ai : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(int); -+ return cast(inout)typeid(int); - } - } - -@@ -86,14 +81,9 @@ unittest - - class TypeInfo_Ak : TypeInfo_Ai - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "uint[]"; } -+ override string toString() const { return "uint[]"; } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - uint[] s1 = *cast(uint[]*)p1; - uint[] s2 = *cast(uint[]*)p2; -@@ -114,9 +104,9 @@ class TypeInfo_Ak : TypeInfo_Ai - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(uint); -+ return cast(inout)typeid(uint); - } - } - -@@ -124,15 +114,10 @@ class TypeInfo_Ak : TypeInfo_Ai - - class TypeInfo_Aw : TypeInfo_Ak - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "dchar[]"; } -+ override string toString() const { return "dchar[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(dchar); -+ return cast(inout)typeid(dchar); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Along.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Along.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Al : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "long[]"; } - -- override string toString() const pure nothrow @safe { return "long[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - long[] s = *cast(long[]*)p; - return hashOf(s.ptr, s.length * long.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - long[] s1 = *cast(long[]*)p1; - long[] s2 = *cast(long[]*)p2; -@@ -44,7 +39,7 @@ class TypeInfo_Al : TypeInfo_Array - memcmp(cast(void *)s1, cast(void *)s2, s1.length * long.sizeof) == 0; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - long[] s1 = *cast(long[]*)p1; - long[] s2 = *cast(long[]*)p2; -@@ -66,9 +61,9 @@ class TypeInfo_Al : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(long); -+ return cast(inout)typeid(long); - } - } - -@@ -77,14 +72,9 @@ class TypeInfo_Al : TypeInfo_Array - - class TypeInfo_Am : TypeInfo_Al - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "ulong[]"; } -+ override string toString() const { return "ulong[]"; } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - ulong[] s1 = *cast(ulong[]*)p1; - ulong[] s2 = *cast(ulong[]*)p2; -@@ -106,8 +96,8 @@ class TypeInfo_Am : TypeInfo_Al - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(ulong); -+ return cast(inout)typeid(ulong); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Areal.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Areal.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_Ae : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "real[]"; } - -- override string toString() const pure nothrow @safe { return "real[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - real[] s = *cast(real[]*)p; - return hashOf(s.ptr, s.length * real.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - real[] s1 = *cast(real[]*)p1; - real[] s2 = *cast(real[]*)p2; -@@ -51,7 +46,7 @@ class TypeInfo_Ae : TypeInfo_Array - return true; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - real[] s1 = *cast(real[]*)p1; - real[] s2 = *cast(real[]*)p2; -@@ -72,9 +67,9 @@ class TypeInfo_Ae : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(real); -+ return cast(inout)typeid(real); - } - } - -@@ -82,15 +77,10 @@ class TypeInfo_Ae : TypeInfo_Array - - class TypeInfo_Aj : TypeInfo_Ae - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "ireal[]"; } -+ override string toString() const { return "ireal[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(ireal); -+ return cast(inout)typeid(ireal); - } - } ---- a/src/libphobos/libdruntime/rt/typeinfo/ti_Ashort.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/typeinfo/ti_Ashort.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,20 +22,15 @@ class TypeInfo_As : TypeInfo_Array - { - override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - -- @trusted: -- const: -- pure: -- nothrow: -+ override string toString() const { return "short[]"; } - -- override string toString() const pure nothrow @safe { return "short[]"; } -- -- override size_t getHash(in void* p) -+ override size_t getHash(in void* p) @trusted const - { - short[] s = *cast(short[]*)p; - return hashOf(s.ptr, s.length * short.sizeof); - } - -- override bool equals(in void* p1, in void* p2) -+ override bool equals(in void* p1, in void* p2) const - { - short[] s1 = *cast(short[]*)p1; - short[] s2 = *cast(short[]*)p2; -@@ -44,7 +39,7 @@ class TypeInfo_As : TypeInfo_Array - memcmp(cast(void *)s1, cast(void *)s2, s1.length * short.sizeof) == 0; - } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - short[] s1 = *cast(short[]*)p1; - short[] s2 = *cast(short[]*)p2; -@@ -65,9 +60,9 @@ class TypeInfo_As : TypeInfo_Array - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(short); -+ return cast(inout)typeid(short); - } - } - -@@ -76,14 +71,9 @@ class TypeInfo_As : TypeInfo_Array - - class TypeInfo_At : TypeInfo_As - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "ushort[]"; } -+ override string toString() const { return "ushort[]"; } - -- override int compare(in void* p1, in void* p2) -+ override int compare(in void* p1, in void* p2) const - { - ushort[] s1 = *cast(ushort[]*)p1; - ushort[] s2 = *cast(ushort[]*)p2; -@@ -104,9 +94,9 @@ class TypeInfo_At : TypeInfo_As - return 0; - } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(ushort); -+ return cast(inout)typeid(ushort); - } - } - -@@ -114,15 +104,10 @@ class TypeInfo_At : TypeInfo_As - - class TypeInfo_Au : TypeInfo_At - { -- @trusted: -- const: -- pure: -- nothrow: -- -- override string toString() const pure nothrow @safe { return "wchar[]"; } -+ override string toString() const { return "wchar[]"; } - -- override @property const(TypeInfo) next() nothrow pure -+ override @property inout(TypeInfo) next() inout - { -- return typeid(wchar); -+ return cast(inout)typeid(wchar); - } - } ---- a/src/libphobos/libdruntime/rt/util/console.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/util/console.d 2014-04-01 16:32:51.000000000 +0100 -@@ -36,7 +36,7 @@ struct Console - { - DWORD count = void; - assert(val.length <= uint.max, "val length cannot exceed uint.max"); -- WriteFile( GetStdHandle( 0xfffffff5 ), val.ptr, cast(uint)val.length, &count, null ); -+ WriteFile( GetStdHandle( 0xfffffff4 ), val.ptr, cast(uint)val.length, &count, null ); - } - else version( Posix ) - { ---- a/src/libphobos/libdruntime/rt/util/container.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/rt/util/container.d 2014-04-01 16:32:51.000000000 +0100 -@@ -8,16 +8,42 @@ - */ - module rt.util.container; - -+import core.stdc.stdlib : free, malloc, realloc; -+ - private void* xrealloc(void* ptr, size_t sz) - { -- import core.stdc.stdlib, core.exception; -+ import core.exception; - -- if (!sz) return free(ptr), null; -- if (auto nptr = realloc(ptr, sz)) return nptr; -- free(ptr), onOutOfMemoryError(); -+ if (!sz) return .free(ptr), null; -+ if (auto nptr = .realloc(ptr, sz)) return nptr; -+ .free(ptr), onOutOfMemoryError(); - assert(0); - } - -+private void destroy(T)(ref T t) if (is(T == struct)) -+{ -+ object.destroy(t); -+} -+ -+private void destroy(T)(ref T t) if (!is(T == struct)) -+{ -+ t = T.init; -+} -+ -+private void initialize(T)(ref T t) if (is(T == struct)) -+{ -+ import core.stdc.string; -+ if(auto p = typeid(T).init().ptr) -+ memcpy(&t, p, T.sizeof); -+ else -+ memset(&t, 0, T.sizeof); -+} -+ -+private void initialize(T)(ref T t) if (!is(T == struct)) -+{ -+ t = T.init; -+} -+ - struct Array(T) - { - @disable this(this); -@@ -39,13 +65,11 @@ struct Array(T) - - @property void length(size_t nlength) - { -- static if (is(T == struct)) -- if (nlength < length) -- foreach (ref val; _ptr[nlength .. length]) destroy(val); -+ if (nlength < length) -+ foreach (ref val; _ptr[nlength .. length]) destroy(val); - _ptr = cast(T*)xrealloc(_ptr, nlength * T.sizeof); -- static if (is(T == struct)) -- if (nlength > length) -- foreach (ref val; _ptr[length .. nlength]) initialize(val); -+ if (nlength > length) -+ foreach (ref val; _ptr[length .. nlength]) initialize(val); - _length = nlength; - } - -@@ -68,19 +92,19 @@ struct Array(T) - return _ptr[_length - 1]; - } - -- @property ref inout(T) opIndex(size_t idx) inout -+ ref inout(T) opIndex(size_t idx) inout - in { assert(idx < length); } - body - { - return _ptr[idx]; - } - -- @property inout(T)[] opSlice() inout -+ inout(T)[] opSlice() inout - { - return _ptr[0 .. _length]; - } - -- @property inout(T)[] opSlice(size_t a, size_t b) inout -+ inout(T)[] opSlice(size_t a, size_t b) inout - in { assert(a < b && b <= length); } - body - { -@@ -100,19 +124,26 @@ struct Array(T) - length = length - 1; - } - --private: -- static if (is(T == struct)) -+ void remove(size_t idx) -+ in { assert(idx < length); } -+ body - { -- void initialize(ref T t) -- { -- import core.stdc.string; -- if(auto p = typeid(T).init().ptr) -- memcpy(&t, p, T.sizeof); -- else -- memset(&t, 0, T.sizeof); -- } -+ foreach (i; idx .. length - 1) -+ _ptr[i] = _ptr[i+1]; -+ popBack(); -+ } -+ -+ void swap(ref Array other) -+ { -+ auto ptr = _ptr; -+ _ptr = other._ptr; -+ other._ptr = ptr; -+ immutable len = _length; -+ _length = other._length; -+ other._length = len; - } - -+private: - T* _ptr; - size_t _length; - } -@@ -139,6 +170,10 @@ unittest - foreach (i, val; ary) assert(i == val); - foreach_reverse (i, val; ary) assert(i == val); - -+ ary.insertBack(2); -+ ary.remove(1); -+ assert(ary[] == [0, 2]); -+ - assert(!ary.empty); - ary.reset(); - assert(ary.empty); -@@ -153,18 +188,26 @@ unittest - static assert(!__traits(compiles, ary = ary2)); - static void foo(Array!size_t copy) {} - static assert(!__traits(compiles, foo(ary))); -+ -+ ary2.insertBack(0); -+ assert(ary.empty); -+ assert(ary2[] == [0]); -+ ary.swap(ary2); -+ assert(ary[] == [0]); -+ assert(ary2.empty); - } - --unittest -+ -+version (unittest) struct RC - { -- static struct RC -- { -- this(size_t* cnt) { ++*(_cnt = cnt); } -- ~this() { if (_cnt) --*_cnt; } -- this(this) { if (_cnt) ++*_cnt; } -- size_t* _cnt; -- } -+ this(size_t* cnt) { ++*(_cnt = cnt); } -+ ~this() { if (_cnt) --*_cnt; } -+ this(this) { if (_cnt) ++*_cnt; } -+ size_t* _cnt; -+} - -+unittest -+{ - Array!RC ary; - - size_t cnt; -@@ -178,3 +221,321 @@ unittest - ary.popBack(); - assert(cnt == 0); - } -+ -+struct HashTab(Key, Value) -+{ -+ static struct Node -+ { -+ Key _key; -+ Value _value; -+ Node* _next; -+ } -+ -+ @disable this(this); -+ -+ ~this() -+ { -+ reset(); -+ } -+ -+ void reset() -+ { -+ foreach (p; _buckets) -+ { -+ while (p !is null) -+ { -+ auto pn = p._next; -+ destroy(*p); -+ .free(p); -+ p = pn; -+ } -+ } -+ _buckets.reset(); -+ _length = 0; -+ } -+ -+ @property size_t length() const -+ { -+ return _length; -+ } -+ -+ @property bool empty() const -+ { -+ return !_length; -+ } -+ -+ void remove(in Key key) -+ in { assert(key in this); } -+ body -+ { -+ ensureNotInOpApply(); -+ -+ immutable hash = hashOf(key) & mask; -+ auto pp = &_buckets[hash]; -+ while (*pp) -+ { -+ auto p = *pp; -+ if (p._key == key) -+ { -+ *pp = p._next; -+ destroy(*p); -+ .free(p); -+ if (--_length < _buckets.length && _length >= 4) -+ shrink(); -+ return; -+ } -+ else -+ { -+ pp = &p._next; -+ } -+ } -+ assert(0); -+ } -+ -+ ref inout(Value) opIndex(Key key) inout -+ { -+ return *opIn_r(key); -+ } -+ -+ void opIndexAssign(Value value, Key key) -+ { -+ *get(key) = value; -+ } -+ -+ inout(Value)* opIn_r(in Key key) inout -+ { -+ if (_buckets.length) -+ { -+ immutable hash = hashOf(key) & mask; -+ for (inout(Node)* p = _buckets[hash]; p !is null; p = p._next) -+ { -+ if (p._key == key) -+ return &p._value; -+ } -+ } -+ return null; -+ } -+ -+ int opApply(scope int delegate(ref Key, ref Value) dg) -+ { -+ immutable save = _inOpApply; -+ _inOpApply = true; -+ scope (exit) _inOpApply = save; -+ foreach (p; _buckets) -+ { -+ while (p !is null) -+ { -+ if (auto res = dg(p._key, p._value)) -+ return res; -+ p = p._next; -+ } -+ } -+ return 0; -+ } -+ -+private: -+ -+ Value* get(Key key) -+ { -+ if (auto p = opIn_r(key)) -+ return p; -+ -+ ensureNotInOpApply(); -+ -+ if (!_buckets.length) -+ _buckets.length = 4; -+ -+ immutable hash = hashOf(key) & mask; -+ auto p = cast(Node*).malloc(Node.sizeof); -+ initialize(*p); -+ p._key = key; -+ p._next = _buckets[hash]; -+ _buckets[hash] = p; -+ if (++_length >= 2 * _buckets.length) -+ grow(); -+ return &p._value; -+ } -+ -+ static hash_t hashOf(in ref Key key) -+ { -+ import rt.util.hash : hashOf; -+ static if (is(Key U : U[])) -+ return hashOf(cast(const ubyte*)key.ptr, key.length * key[0].sizeof); -+ else -+ return hashOf(cast(const ubyte*)&key, Key.sizeof); -+ } -+ -+ @property hash_t mask() const -+ { -+ return _buckets.length - 1; -+ } -+ -+ void grow() -+ in -+ { -+ assert(_buckets.length); -+ } -+ body -+ { -+ immutable ocnt = _buckets.length; -+ immutable nmask = 2 * ocnt - 1; -+ _buckets.length = 2 * ocnt; -+ for (size_t i = 0; i < ocnt; ++i) -+ { -+ auto pp = &_buckets[i]; -+ while (*pp) -+ { -+ auto p = *pp; -+ -+ immutable nidx = hashOf(p._key) & nmask; -+ if (nidx != i) -+ { -+ *pp = p._next; -+ p._next = _buckets[nidx]; -+ _buckets[nidx] = p; -+ } -+ else -+ { -+ pp = &p._next; -+ } -+ } -+ } -+ } -+ -+ void shrink() -+ in -+ { -+ assert(_buckets.length >= 2); -+ } -+ body -+ { -+ immutable ocnt = _buckets.length; -+ immutable ncnt = ocnt >> 1; -+ immutable nmask = ncnt - 1; -+ -+ for (size_t i = ncnt; i < ocnt; ++i) -+ { -+ if (auto tail = _buckets[i]) -+ { -+ immutable nidx = i & nmask; -+ auto pp = &_buckets[nidx]; -+ while (*pp) -+ pp = &(*pp)._next; -+ *pp = tail; -+ _buckets[i] = null; -+ } -+ } -+ _buckets.length = ncnt; -+ } -+ -+ void ensureNotInOpApply() -+ { -+ if (_inOpApply) -+ assert(0, "Invalid HashTab manipulation during opApply iteration."); -+ } -+ -+ Array!(Node*) _buckets; -+ size_t _length; -+ bool _inOpApply; -+} -+ -+unittest -+{ -+ HashTab!(int, int) tab; -+ -+ foreach(i; 0 .. 100) -+ tab[i] = 100 - i; -+ -+ foreach(i; 0 .. 100) -+ assert(tab[i] == 100 - i); -+ -+ foreach (k, v; tab) -+ assert(v == 100 - k); -+ -+ foreach(i; 0 .. 50) -+ tab.remove(2 * i); -+ -+ assert(tab.length == 50); -+ -+ foreach(i; 0 .. 50) -+ assert(tab[2 * i + 1] == 100 - 2 * i - 1); -+ -+ assert(tab.length == 50); -+ -+ tab.reset(); -+ assert(tab.empty); -+ tab[0] = 0; -+ assert(!tab.empty); -+ destroy(tab); -+ assert(tab.empty); -+ -+ // not copyable -+ static assert(!__traits(compiles, { HashTab!(int, int) tab2 = tab; })); -+ HashTab!(int, int) tab2; -+ static assert(!__traits(compiles, tab = tab2)); -+ static void foo(HashTab!(int, int) copy) {} -+ static assert(!__traits(compiles, foo(tab))); -+} -+ -+unittest -+{ -+ HashTab!(string, size_t) tab; -+ -+ tab["foo"] = 0; -+ assert(tab["foo"] == 0); -+ ++tab["foo"]; -+ assert(tab["foo"] == 1); -+ tab["foo"]++; -+ assert(tab["foo"] == 2); -+ -+ auto s = "fo"; -+ s ~= "o"; -+ assert(tab[s] == 2); -+ assert(tab.length == 1); -+ tab[s] -= 2; -+ assert(tab[s] == 0); -+ tab["foo"] = 12; -+ assert(tab[s] == 12); -+ -+ tab.remove("foo"); -+ assert(tab.empty); -+} -+ -+unittest -+{ -+ HashTab!(size_t, RC) tab; -+ -+ size_t cnt; -+ assert(cnt == 0); -+ tab[0] = RC(&cnt); -+ assert(cnt == 1); -+ tab[1] = tab[0]; -+ assert(cnt == 2); -+ tab.remove(0); -+ assert(cnt == 1); -+ tab.remove(1); -+ assert(cnt == 0); -+} -+ -+unittest -+{ -+ import core.exception; -+ -+ HashTab!(uint, uint) tab; -+ foreach (i; 0 .. 5) -+ tab[i] = i; -+ bool thrown; -+ foreach (k, v; tab) -+ { -+ try -+ { -+ if (k == 3) tab.remove(k); -+ } -+ catch (AssertError e) -+ { -+ thrown = true; -+ } -+ } -+ assert(thrown); -+ assert(tab[3] == 3); -+} ---- a/src/libphobos/libdruntime/unittest.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/libdruntime/unittest.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,38 +1,52 @@ --// Written in the D programming language. -- - /** -- * This test program pulls in all the library modules in order to run the unit -- * tests on them. -+ * Unit tests for the D runtime. -+ * -+ * Copyright: Copyright Sean Kelly 2005 - 2010. -+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) -+ * Authors: Sean Kelly - */ - --public import core.sys.posix.sys.select; --public import core.demangle; --public import core.time; -+/* Copyright Sean Kelly 2005 - 2010. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+public import core.atomic; - public import core.bitop; --public import core.thread; -+public import core.cpuid; -+public import core.demangle; - public import core.exception; --public import core.math; --public import etc.linux.memoryerror; --public import gc.gcbits; --public import rt.adi; --public import rt.arrayshort; --public import rt.arrayfloat; --public import rt.arrayint; --public import rt.typeinfo.ti_Aint; --public import rt.switch_; --public import rt.arrayreal; --public import rt.arraybyte; --public import rt.aaA; --public import rt.qsort; --public import rt.lifetime; --public import rt.minfo; --public import rt.arraydouble; --public import rt.util.hash; --public import rt.util.container; --public import rt.util.utf; --public import rt.aApplyR; --public import rt.arraycast; -+public import core.memory; -+public import core.runtime; -+public import core.thread; -+public import core.vararg; -+ -+public import core.sync.condition; -+public import core.sync.mutex; -+public import core.sync.rwmutex; -+public import core.sync.semaphore; -+ -+version(Posix) -+ public import core.sys.posix.sys.select; - - void main() - { -+ // Bring in unit test for module by referencing a function in it -+ shared(int) i; -+ cas( &i, 0, 1 ); // atomic -+ auto b = bsf( 0 ); // bitop -+ mmx; // cpuid -+ demangle( "" ); // demangle -+ setAssertHandler( null ); // exception -+ // SES - disabled because you cannot enable the GC without disabling it. -+ //GC.enable(); // memory -+ Runtime.collectHandler = null; // runtime -+ static void fn() {} -+ new Thread( &fn ); // thread -+ //va_end( null ); // vararg -+ -+ auto m = new Mutex; // mutex -+ auto c = new Condition( m ); // condition -+ auto r = new ReadWriteMutex; // rwmutex -+ auto s = new Semaphore; // semaphore - } ---- a/src/libphobos/Makefile.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/Makefile.in 2014-04-01 16:32:51.000000000 +0100 -@@ -56,17 +56,18 @@ DIST_COMMON = $(am__configure_deps) $(sr - $(srcdir)/../config.sub $(srcdir)/../install-sh \ - $(srcdir)/../missing $(srcdir)/../mkinstalldirs \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ -- $(srcdir)/config.h.in $(top_srcdir)/configure -+ $(srcdir)/config.h.in $(top_srcdir)/configure \ -+ $(top_srcdir)/libdruntime/gcc/libbacktrace.d.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ -- $(top_srcdir)/configure.in -+ $(top_srcdir)/configure.ac - am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) - am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno - mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs - CONFIG_HEADER = config.h --CONFIG_CLEAN_FILES = -+CONFIG_CLEAN_FILES = libdruntime/gcc/libbacktrace.d - CONFIG_CLEAN_VPATH_FILES = - depcomp = - am__depfiles_maybe = -@@ -145,6 +146,9 @@ AUTOCONF = @AUTOCONF@ - AUTOHEADER = @AUTOHEADER@ - AUTOMAKE = @AUTOMAKE@ - AWK = @AWK@ -+BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@ -+BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@ -+BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@ - BUILD_LIBIBERTY = @BUILD_LIBIBERTY@ - CC = @CC@ - CC_FOR_BUILD = @CC_FOR_BUILD@ -@@ -160,7 +164,7 @@ DCFG_CBRIDGE_STDIO = @DCFG_CBRIDGE_STDIO - DCFG_GETPWNAM_R = @DCFG_GETPWNAM_R@ - DCFG_MMAP = @DCFG_MMAP@ - DCFG_POSIX = @DCFG_POSIX@ --DCFG_SEMAPHORE_IMPL = @DCFG_SEMAPHORE_IMPL@ -+DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ - DCFG_UNIX = @DCFG_UNIX@ - DEFS = @DEFS@ - DFLAGS = @DFLAGS@ -@@ -175,12 +179,14 @@ EGREP = @EGREP@ - EXEEXT = @EXEEXT@ - GDC = @GDC@ - GREP = @GREP@ -+HAVE_DLADDR = @HAVE_DLADDR@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_SCRIPT = @INSTALL_SCRIPT@ - INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ - LDFLAGS = @LDFLAGS@ -+LIBBACKTRACE_LIB = @LIBBACKTRACE_LIB@ - LIBIBERTY_H_PATH = @LIBIBERTY_H_PATH@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ -@@ -361,6 +367,8 @@ $(srcdir)/config.h.in: $(am__configure_ - - distclean-hdr: - -rm -f config.h stamp-h1 -+libdruntime/gcc/libbacktrace.d: $(top_builddir)/config.status $(top_srcdir)/libdruntime/gcc/libbacktrace.d.in -+ cd $(top_builddir) && $(SHELL) ./config.status $@ - - # GNU Make needs to see an explicit $(MAKE) variable in the command it - # runs to enable its job server during parallel builds. Hence the ---- a/src/libphobos/src/index.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/index.d 2014-04-01 16:32:51.000000000 +0100 -@@ -121,32 +121,32 @@ D language compiler. Also, check out the - - <dl> - -+ <dt><a href="std_ascii.html"><b>std.ascii</b></a> -+ <dd>Functions that operate on ASCII characters. -+ - <dt><a href="std_base64.html"><b>std.base64</b></a> - <dd>Encode/decode base64 format. - - <dt><a href="std_bigint.html"><b>std.bigint</b></a> - <dd>Arbitrary-precision ('bignum') arithmetic - -- <dt><a href="std_bind.html"><b>std.bind</b></a> -- <dd>Bind function arguments. -- -+$(V1 - <dt><a href="std_bitarray.html"><b>std.bitarray</b></a> - <dd>Arrays of bits. - - <dt><a href="std_boxer.html"><b>std.boxer</b></a> - <dd>Box/unbox types. -- -+) - <dt><a href="std_compiler.html"><b>std.compiler</b></a> - <dd>Information about the D compiler implementation. - - <dt><a href="std_conv.html"><b>std.conv</b></a> - <dd>Conversion of strings to integers. - -- <dt><a href="std_ctype.html"><b>std.ctype</b></a> -- <dd>Simple character classification -- -+$(V1 - <dt><a href="std_date.html"><b>std.date</b></a> - <dd>Date and time functions. Support locales. -+) - - <dt><a href="std_datetime.html"><b>std.datetime</b></a> - <dd>Date and time-related types and functions. -@@ -157,9 +157,10 @@ D language compiler. Also, check out the - <dt><a href="std_format.html"><b>std.format</b></a> - <dd>Formatted conversions of values to strings. - -+$(V1 - <dt><a href="std_gc.html"><b>std.gc</b></a> - <dd>Control the garbage collector. -- -+) - <dt><a href="std_math.html"><b>std.math</b></a> - <dd>Include all the usual math functions like sin, cos, atan, etc. - -@@ -184,11 +185,12 @@ D language compiler. Also, check out the - <dt><a href="std_random.html"><b>std.random</b></a> - <dd>Random number generation. - -+$(V1 - <dt><a href="std_recls.html"><b>std.recls</b></a> - <dd>Recursively search file system and (currently Windows - only) FTP sites. -- -- <dt><a href="std_regexp.html"><b>std.regexp</b></a> -+) -+ <dt><a href="std_regex.html"><b>std.regex</b></a> - <dd>The usual regular expression functions. - - <dt><a href="std_socket.html"><b>std.socket</b></a> -@@ -218,6 +220,9 @@ D language compiler. Also, check out the - <!--dt><a href="std_thread.html"><b>std.thread</b></a> - <dd>One per thread. Operations to do on a thread.--> - -+ <dt><a href="std_uni.html"><b>std.base64</b></a> -+ <dd>Functions that operate on Unicode characters. -+ - <dt><a href="std_uri.html"><b>std.uri</b></a> - <dd>Encode and decode Uniform Resource Identifiers (URIs). - ---- a/src/libphobos/src/Makefile.am 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/Makefile.am 2014-04-01 16:32:51.000000000 +0100 -@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = 1.9.4 foreign no-depe - ACLOCAL_AMFLAGS = -I. -I.. - - OUR_CFLAGS=@DEFS@ -I. -I$(srcdir)/../libdruntime/gcc -I$(top_srcdir)/../zlib --D_EXTRA_DFLAGS=-nostdinc -pipe -Wno-deprecated -fproperty -I$(srcdir) -I$(srcdir)/../libdruntime -I./libdruntime/$(host_alias) -+D_EXTRA_DFLAGS=-nostdinc -pipe -Wno-deprecated -I$(srcdir) -I$(srcdir)/../libdruntime -I./libdruntime/$(host_alias) - ALL_DFLAGS=$(DFLAGS) $(D_EXTRA_DFLAGS) $(MULTIFLAGS) - - toolexecdir = $(phobos_toolexecdir) -@@ -55,14 +55,10 @@ zlib/%.o: $(top_srcdir)/../zlib/%.c - #--------------------------------------# - # GDC LibPhobos - --# Special-case for std.xml, need to emit templates. --std/xml.o : std/xml.d -- $(GDC) -o $@ $(ALL_DFLAGS) -femit-templates -c $< -- - MAIN_OBJS=std/algorithm.o std/array.o std/ascii.o std/base64.o std/bigint.o \ - std/bitmanip.o std/compiler.o \ - std/container.o std/complex.o std/concurrency.o \ -- std/conv.o std/cpuid.o std/cstream.o std/ctype.o std/csv.o \ -+ std/conv.o std/cstream.o std/csv.o \ - std/datetime.o std/demangle.o std/encoding.o \ - std/exception.o std/format.o \ - std/functional.o std/getopt.o std/json.o \ -@@ -71,7 +67,7 @@ MAIN_OBJS=std/algorithm.o std/array.o st - std/outbuffer.o std/parallelism.o std/signals.o \ - std/stdio.o std/stdiobase.o std/stdint.o std/stream.o \ - std/string.o std/syserror.o std/system.o std/random.o std/range.o \ -- std/regex.o std/regexp.o std/traits.o std/typecons.o \ -+ std/regex.o std/traits.o std/typecons.o \ - std/typetuple.o std/uni.o std/uri.o std/utf.o \ - std/uuid.o std/variant.o std/xml.o std/zip.o std/zlib.o \ - std/c/fenv.o std/c/locale.o std/c/math.o std/c/process.o \ -@@ -84,7 +80,10 @@ MAIN_OBJS=std/algorithm.o std/array.o st - std/internal/math/biguintx86.o std/internal/math/gammafunction.o \ - std/internal/math/errorfunction.o std/internal/processinit.o \ - std/internal/uni.o std/internal/uni_tab.o \ -- std/net/isemail.o \ -+ std/internal/unicode_comp.o std/internal/unicode_decomp.o \ -+ std/internal/unicode_grapheme.o std/internal/unicode_norm.o \ -+ std/internal/unicode_tables.o \ -+ std/net/curl.o std/net/isemail.o \ - crc32.o etc/c/curl.o etc/c/zlib.o - - Z_OBJS=zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o \ -@@ -96,7 +95,7 @@ ZLIB_OBJS=@ZLIB_OBJS@ - - - # modules which require some kind of operating system --OS_OBJS=std/file.o std/mmfile.o std/path.o std/perf.o std/process.o \ -+OS_OBJS=std/file.o std/mmfile.o std/path.o std/process.o \ - std/socket.o std/socketstream.o - - LINUX_OBJS=std/c/linux/linux.o std/c/linux/socket.o -@@ -138,18 +137,19 @@ install-exec-local: libgphobos2.a - - install-data-local: libgphobos2.a - for i in etc/c \ -- std std/c std/c/freebsd \ -- std/c/linux std/c/osx std/c/windows \ -- std/internal std/internal/math std/internal/windows \ -- std/digest std/internal/digest \ -- std/net std/windows; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.d; do $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; done; \ -+ std std/c std/c/freebsd \ -+ std/c/linux std/c/osx std/c/windows \ -+ std/internal std/internal/math std/internal/windows \ -+ std/digest std/internal/digest \ -+ std/net std/windows; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(srcdir)/$$i/*.d; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done - for i in crc32.d; do \ -- $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); done --#disabled, already installed by druntime --#$(INSTALL) phobos-ver-syms $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR) -+ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ done - - clean-local: - rm -f $(ALL_PHOBOS_OBJS) ---- a/src/libphobos/src/Makefile.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/Makefile.in 2014-04-01 16:32:51.000000000 +0100 -@@ -73,7 +73,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(sr - $(srcdir)/phobos-ver-syms.in - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ -- $(top_srcdir)/configure.in -+ $(top_srcdir)/configure.ac - am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) - mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -@@ -97,6 +97,9 @@ AUTOCONF = @AUTOCONF@ - AUTOHEADER = @AUTOHEADER@ - AUTOMAKE = @AUTOMAKE@ - AWK = @AWK@ -+BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@ -+BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@ -+BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@ - BUILD_LIBIBERTY = @BUILD_LIBIBERTY@ - CC = @CC@ - CC_FOR_BUILD = @CC_FOR_BUILD@ -@@ -112,7 +115,7 @@ DCFG_CBRIDGE_STDIO = @DCFG_CBRIDGE_STDIO - DCFG_GETPWNAM_R = @DCFG_GETPWNAM_R@ - DCFG_MMAP = @DCFG_MMAP@ - DCFG_POSIX = @DCFG_POSIX@ --DCFG_SEMAPHORE_IMPL = @DCFG_SEMAPHORE_IMPL@ -+DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ - DCFG_UNIX = @DCFG_UNIX@ - DEFS = @DEFS@ - DFLAGS = @DFLAGS@ -@@ -127,12 +130,14 @@ EGREP = @EGREP@ - EXEEXT = @EXEEXT@ - GDC = @GDC@ - GREP = @GREP@ -+HAVE_DLADDR = @HAVE_DLADDR@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ - INSTALL_SCRIPT = @INSTALL_SCRIPT@ - INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ - LDFLAGS = @LDFLAGS@ -+LIBBACKTRACE_LIB = @LIBBACKTRACE_LIB@ - LIBIBERTY_H_PATH = @LIBIBERTY_H_PATH@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ -@@ -214,15 +219,18 @@ top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = 1.9.4 foreign no-dependencies - ACLOCAL_AMFLAGS = -I. -I.. - OUR_CFLAGS = @DEFS@ -I. -I$(srcdir)/../libdruntime/gcc -I$(top_srcdir)/../zlib --D_EXTRA_DFLAGS = -nostdinc -pipe -Wno-deprecated -fproperty -I$(srcdir) -I$(srcdir)/../libdruntime -I./libdruntime/$(host_alias) -+D_EXTRA_DFLAGS = -nostdinc -pipe -Wno-deprecated -I$(srcdir) -I$(srcdir)/../libdruntime -I./libdruntime/$(host_alias) - ALL_DFLAGS = $(DFLAGS) $(D_EXTRA_DFLAGS) $(MULTIFLAGS) - toolexecdir = $(phobos_toolexecdir) - toolexeclibdir = $(phobos_toolexeclibdir) - SUFFIXES = .d -+ -+#--------------------------------------# -+# GDC LibPhobos - MAIN_OBJS = std/algorithm.o std/array.o std/ascii.o std/base64.o std/bigint.o \ - std/bitmanip.o std/compiler.o \ - std/container.o std/complex.o std/concurrency.o \ -- std/conv.o std/cpuid.o std/cstream.o std/ctype.o std/csv.o \ -+ std/conv.o std/cstream.o std/csv.o \ - std/datetime.o std/demangle.o std/encoding.o \ - std/exception.o std/format.o \ - std/functional.o std/getopt.o std/json.o \ -@@ -231,7 +239,7 @@ MAIN_OBJS = std/algorithm.o std/array.o - std/outbuffer.o std/parallelism.o std/signals.o \ - std/stdio.o std/stdiobase.o std/stdint.o std/stream.o \ - std/string.o std/syserror.o std/system.o std/random.o std/range.o \ -- std/regex.o std/regexp.o std/traits.o std/typecons.o \ -+ std/regex.o std/traits.o std/typecons.o \ - std/typetuple.o std/uni.o std/uri.o std/utf.o \ - std/uuid.o std/variant.o std/xml.o std/zip.o std/zlib.o \ - std/c/fenv.o std/c/locale.o std/c/math.o std/c/process.o \ -@@ -244,7 +252,10 @@ MAIN_OBJS = std/algorithm.o std/array.o - std/internal/math/biguintx86.o std/internal/math/gammafunction.o \ - std/internal/math/errorfunction.o std/internal/processinit.o \ - std/internal/uni.o std/internal/uni_tab.o \ -- std/net/isemail.o \ -+ std/internal/unicode_comp.o std/internal/unicode_decomp.o \ -+ std/internal/unicode_grapheme.o std/internal/unicode_norm.o \ -+ std/internal/unicode_tables.o \ -+ std/net/curl.o std/net/isemail.o \ - crc32.o etc/c/curl.o etc/c/zlib.o - - Z_OBJS = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o \ -@@ -254,7 +265,7 @@ Z_OBJS = zlib/adler32.o zlib/compress.o - - - # modules which require some kind of operating system --OS_OBJS = std/file.o std/mmfile.o std/path.o std/perf.o std/process.o \ -+OS_OBJS = std/file.o std/mmfile.o std/path.o std/process.o \ - std/socket.o std/socketstream.o - - LINUX_OBJS = std/c/linux/linux.o std/c/linux/socket.o -@@ -525,13 +536,6 @@ zlib/%.o: $(top_srcdir)/../zlib/%.c - %.t.o : %.o - cp $< $@ - --#--------------------------------------# --# GDC LibPhobos -- --# Special-case for std.xml, need to emit templates. --std/xml.o : std/xml.d -- $(GDC) -o $@ $(ALL_DFLAGS) -femit-templates -c $< -- - libgphobos2.a : $(ALL_PHOBOS_OBJS) ../libdruntime/libgdruntime.a - cp ../libdruntime/libgdruntime.a libgphobos2.a - $(AR) -q $@ $(ALL_PHOBOS_OBJS) -@@ -554,18 +558,19 @@ install-exec-local: libgphobos2.a - - install-data-local: libgphobos2.a - for i in etc/c \ -- std std/c std/c/freebsd \ -- std/c/linux std/c/osx std/c/windows \ -- std/internal std/internal/math std/internal/windows \ -- std/digest std/internal/digest \ -- std/net std/windows; do \ -- $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -- for f in $(srcdir)/$$i/*.d; do $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; done; \ -+ std std/c std/c/freebsd \ -+ std/c/linux std/c/osx std/c/windows \ -+ std/internal std/internal/math std/internal/windows \ -+ std/digest std/internal/digest \ -+ std/net std/windows; do \ -+ $(mkinstalldirs) $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ for f in $(srcdir)/$$i/*.d; do \ -+ $(INSTALL_HEADER) $$f $(DESTDIR)$(gdc_include_dir)/$$i; \ -+ done; \ - done - for i in crc32.d; do \ -- $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); done --#disabled, already installed by druntime --#$(INSTALL) phobos-ver-syms $(DESTDIR)$(gdc_include_dir)/$(host_alias)/$(MULTISUBDIR) -+ $(INSTALL_HEADER) $(srcdir)/$$i $(DESTDIR)$(gdc_include_dir); \ -+ done - - clean-local: - rm -f $(ALL_PHOBOS_OBJS) ---- a/src/libphobos/src/phobos-ver-syms.in 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/phobos-ver-syms.in 2014-04-01 16:32:51.000000000 +0100 -@@ -1,12 +1,10 @@ - @DCFG_UNIX@ - @DCFG_POSIX@ --@DCFG_SEMAPHORE_IMPL@ - @DCFG_NEARBYINT@ - @DCFG_ROUND@ - @DCFG_TGAMMA@ - @DCFG_NAN@ --@DCFG_EXECVPE@ --@DCFG_SPAWNVP@ - @DCFG_CBRIDGE_STDIO@ - @DCFG_MMAP@ - @DCFG_ARM_EABI_UNWINDER@ -+@DCFG_THREAD_MODEL@ ---- a/src/libphobos/src/std/algorithm.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/algorithm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -6,13 +6,13 @@ - $(BOOKTABLE , - $(TR $(TH Category) $(TH Functions) - ) --$(TR $(TDNW Searching) $(TD $(MYREF balancedParens) $(MYREF -+$(TR $(TDNW Searching) $(TD $(MYREF all) $(MYREF any) $(MYREF balancedParens) $(MYREF - boyerMooreFinder) $(MYREF canFind) $(MYREF count) $(MYREF countUntil) --$(MYREF endsWith) $(MYREF commonPrefix) $(MYREF find) $(MYREF -+$(MYREF commonPrefix) $(MYREF endsWith) $(MYREF find) $(MYREF - findAdjacent) $(MYREF findAmong) $(MYREF findSkip) $(MYREF findSplit) --$(MYREF findSplitAfter) $(MYREF findSplitBefore) $(MYREF indexOf) --$(MYREF minCount) $(MYREF minPos) $(MYREF mismatch) $(MYREF skipOver) --$(MYREF startsWith) $(MYREF until) ) -+$(MYREF findSplitAfter) $(MYREF findSplitBefore) $(MYREF minCount) -+$(MYREF minPos) $(MYREF mismatch) $(MYREF skipOver) $(MYREF startsWith) -+$(MYREF until) ) - ) - $(TR $(TDNW Comparison) $(TD $(MYREF cmp) $(MYREF equal) $(MYREF - levenshteinDistance) $(MYREF levenshteinDistanceAndPath) $(MYREF max) -@@ -23,10 +23,10 @@ $(MYREF group) $(MYREF joiner) $(MYREF m - splitter) $(MYREF uniq) ) - ) - $(TR $(TDNW Sorting) $(TD $(MYREF completeSort) $(MYREF isPartitioned) --$(MYREF isSorted) $(MYREF makeIndex) $(MYREF partialSort) $(MYREF -+$(MYREF isSorted) $(MYREF makeIndex) $(MYREF nextPermutation) -+$(MYREF nextEvenPermutation) $(MYREF partialSort) $(MYREF - partition) $(MYREF partition3) $(MYREF schwartzSort) $(MYREF sort) --$(MYREF topN) $(MYREF topNCopy) $(MYREF nextPermutation) --$(MYREF nextEvenPermutation) ) -+$(MYREF topN) $(MYREF topNCopy) ) - ) - $(TR $(TDNW Set operations) $(TD $(MYREF cartesianProduct) $(MYREF - largestPartialIntersection) $(MYREF largestPartialIntersectionWeighted) -@@ -35,8 +35,8 @@ setSymmetricDifference) $(MYREF setUnion - ) - $(TR $(TDNW Mutation) $(TD $(MYREF bringToFront) $(MYREF copy) $(MYREF - fill) $(MYREF initializeAll) $(MYREF move) $(MYREF moveAll) $(MYREF --moveSome) $(MYREF remove) $(MYREF reverse) $(MYREF swap) $(MYREF --swapRanges) $(MYREF uninitializedFill) )) -+moveSome) $(MYREF remove) $(MYREF reverse) $(MYREF strip) $(MYREF stripLeft) -+$(MYREF stripRight) $(MYREF swap) $(MYREF swapRanges) $(MYREF uninitializedFill) )) - ) - - Implements algorithms oriented mainly towards processing of -@@ -75,6 +75,10 @@ $(TR $(TH Function Name) $(TH Descriptio - ) - $(LEADINGROW Searching - ) -+$(TR $(TDNW $(LREF all)) $(TD $(D all!"a > 0"([1, 2, 3, 4])) returns $(D true) because all elements are positive) -+) -+$(TR $(TDNW $(LREF any)) $(TD $(D any!"a > 0"([1, 2, -3, -4])) returns $(D true) because at least one element is positive) -+) - $(TR $(TDNW $(LREF balancedParens)) $(TD $(D - balancedParens("((1 + 1) / 2)")) returns $(D true) because the string - has balanced parentheses.) -@@ -146,7 +150,7 @@ until a specific value is found.) - $(LEADINGROW Comparison - ) - $(TR $(TDNW $(LREF cmp)) $(TD $(D cmp("abc", "abcd")) is $(D ---1), $(D cmp("abc", aba")) is $(D 1), and $(D cmp("abc", "abc")) is -+-1), $(D cmp("abc", "aba")) is $(D 1), and $(D cmp("abc", "abc")) is - $(D 0).) - ) - $(TR $(TDNW $(LREF equal)) $(TD Compares ranges for -@@ -173,7 +177,7 @@ $(TR $(TDNW $(LREF mismatch)) $(TD $(D m - $(LEADINGROW Iteration - ) - $(TR $(TDNW $(LREF filter)) $(TD $(D filter!"a > 0"([1, -1, 2, --0, -3])) iterates over elements $(D 1), $(D 2), and $(D 0).) -+0, -3])) iterates over elements $(D 1) and $(D 2).) - ) - $(TR $(TDNW $(LREF filterBidirectional)) $(TD Similar to $(D - filter), but also provides $(D back) and $(D popBack) at a small -@@ -218,6 +222,12 @@ returns $(D true).) - $(TR $(TDNW $(LREF makeIndex)) $(TD Creates a separate index - for a range.) - ) -+$(TR $(TDNW $(LREF nextPermutation)) $(TD Computes the next lexicographically -+greater permutation of a range in-place.) -+) -+$(TR $(TDNW $(LREF nextEvenPermutation)) $(TD Computes the next -+lexicographically greater even permutation of a range in-place.) -+) - $(TR $(TDNW $(LREF partialSort)) $(TD If $(D a = [5, 4, 3, 2, - 1]), then $(D partialSort(a, 3)) leaves $(D a[0 .. 3] = [1, 2, - 3]). The other elements of $(D a) are left in an unspecified order.) -@@ -236,12 +246,6 @@ range.) - $(TR $(TDNW $(LREF topNCopy)) $(TD Copies out the top elements - of a range.) - ) --$(TR $(TDNW $(LREF nextPermutation)) $(TD Computes the next lexicographically --greater permutation of a range in-place.) --) --$(TR $(TDNW $(LREF nextEvenPermutation)) $(TD Computes the next --lexicographically greater even permutation of a range in-place.) --) - $(LEADINGROW Set operations - ) - $(TR $(TDNW $(LREF cartesianProduct)) $(TD Computes Cartesian product of two -@@ -261,7 +265,7 @@ $(TR $(TDNW $(LREF setDifference)) $(TD - difference of two or more sorted ranges.) - ) - $(TR $(TDNW $(LREF setIntersection)) $(TD Lazily computes the --set difference of two or more sorted ranges.) -+intersection of two or more sorted ranges.) - ) - $(TR $(TDNW $(LREF setSymmetricDifference)) $(TD Lazily - computes the symmetric set difference of two or more sorted ranges.) -@@ -299,6 +303,21 @@ possible from one range to another.) - $(TR $(TDNW $(LREF reverse)) $(TD If $(D a = [1, 2, 3]), $(D - reverse(a)) changes it to $(D [3, 2, 1]).) - ) -+$(TR $(TDNW $(LREF strip)) $(TD Strips all leading and trailing -+elements equal to a value, or that satisfy a predicate. -+If $(D a = [1, 1, 0, 1, 1]), then $(D strip(a, 1)) and $(D strip!(e => e == 1)(a)) -+returns $(D [0]).) -+) -+$(TR $(TDNW $(LREF stripLeft)) $(TD Strips all leading elements equal to a value, -+or that satisfy a predicate. -+If $(D a = [1, 1, 0, 1, 1]), then $(D stripLeft(a, 1)) and $(D stripLeft!(e => e == 1)(a)) -+returns $(D [0, 1, 1]).) -+) -+$(TR $(TDNW $(LREF stripRight)) $(TD Strips all trailing elements equal to a value, -+or that satisfy a predicate. -+If $(D a = [1, 1, 0, 1, 1]), then $(D stripRight(a, 1)) and $(D stripRight!(e => e == 1)(a)) -+returns $(D [1, 1, 0]).) -+) - $(TR $(TDNW $(LREF swap)) $(TD Swaps two values.) - ) - $(TR $(TDNW $(LREF swapRanges)) $(TD Swaps all elements of two -@@ -326,15 +345,17 @@ module std.algorithm; - - import std.c.string, core.bitop; - import std.array, std.ascii, std.container, std.conv, std.exception, -- std.functional, std.math, std.metastrings, std.range, std.string, -+ std.functional, std.math, std.random, std.range, std.string, - std.traits, std.typecons, std.typetuple, std.uni, std.utf; - - version(unittest) - { -- import std.random, std.stdio, std.string; -+ import std.stdio; - mixin(dummyRanges); - } - -+private T* addressOf(T)(ref T val) { return &val; } -+ - /** - $(D auto map(Range)(Range r) if (isInputRange!(Unqual!Range));) - -@@ -348,7 +369,7 @@ Example: - ---- - int[] arr1 = [ 1, 2, 3, 4 ]; - int[] arr2 = [ 5, 6 ]; --auto squares = map!("a * a")(chain(arr1, arr2)); -+auto squares = map!(a => a * a)(chain(arr1, arr2)); - assert(equal(squares, [ 1, 4, 9, 16, 25, 36 ])); - ---- - -@@ -451,7 +472,7 @@ private struct MapResult(alias fun, Rang - } - } - -- static if (hasLength!R || isSomeString!R) -+ static if (hasLength!R) - { - @property auto length() - { -@@ -461,16 +482,33 @@ private struct MapResult(alias fun, Rang - alias length opDollar; - } - -- static if (!isInfinite!R && hasSlicing!R) -+ static if (hasSlicing!R) - { - static if (is(typeof(_input[ulong.max .. ulong.max]))) -- private alias ulong opSlice_t; -+ private alias opSlice_t = ulong; - else -- private alias uint opSlice_t; -+ private alias opSlice_t = uint; - -- auto opSlice(opSlice_t lowerBound, opSlice_t upperBound) -+ static if (hasLength!R) - { -- return typeof(this)(_input[lowerBound..upperBound]); -+ auto opSlice(opSlice_t low, opSlice_t high) -+ { -+ return typeof(this)(_input[low .. high]); -+ } -+ } -+ else static if (is(typeof(_input[opSlice_t.max .. $]))) -+ { -+ struct DollarToken{} -+ enum opDollar = DollarToken.init; -+ auto opSlice(opSlice_t low, DollarToken) -+ { -+ return typeof(this)(_input[low .. $]); -+ } -+ -+ auto opSlice(opSlice_t low, opSlice_t high) -+ { -+ return this[low .. $].take(high - low); -+ } - } - } - -@@ -595,6 +633,29 @@ unittest - assert(equal(m, [1L, 4L, 9L])); - } - -+unittest -+{ -+ // Issue #10130 - map of iota with const step. -+ const step = 2; -+ static assert(__traits(compiles, map!(i => i)(iota(0, 10, step)))); -+ -+ // Need these to all by const to repro the float case, due to the -+ // CommonType template used in the float specialization of iota. -+ const floatBegin = 0.0; -+ const floatEnd = 1.0; -+ const floatStep = 0.02; -+ static assert(__traits(compiles, map!(i => i)(iota(floatBegin, floatEnd, floatStep)))); -+} -+unittest -+{ -+ //slicing infinites -+ auto rr = iota(0, 5).cycle().map!"a * a"(); -+ alias RR = typeof(rr); -+ static assert(hasSlicing!RR); -+ rr = rr[6 .. $]; //Advances 1 cycle and 1 unit -+ assert(equal(rr[0 .. 5], [1, 4, 9, 16, 0])); -+} -+ - /** - $(D auto reduce(Args...)(Args args) - if (Args.length > 0 && Args.length <= 2 && isIterable!(Args[$ - 1]));) -@@ -617,19 +678,27 @@ Example: - ---- - int[] arr = [ 1, 2, 3, 4, 5 ]; - // Sum all elements --auto sum = reduce!("a + b")(0, arr); -+auto sum = reduce!((a,b) => a + b)(0, arr); -+assert(sum == 15); -+ -+// Sum again, using a string predicate with "a" and "b" -+sum = reduce!"a + b"(0, arr); - assert(sum == 15); - - // Compute the maximum of all elements - auto largest = reduce!(max)(arr); - assert(largest == 5); - -+// Max again, but with Uniform Function Call Syntax (UFCS) -+largest = arr.reduce!(max); -+assert(largest == 5); -+ - // Compute the number of odd elements --auto odds = reduce!("a + (b & 1)")(0, arr); -+auto odds = reduce!((a,b) => a + (b & 1))(0, arr); - assert(odds == 3); - - // Compute the sum of squares --auto ssquares = reduce!("a + b * b")(0, arr); -+auto ssquares = reduce!((a,b) => a + b * b)(0, arr); - assert(ssquares == 55); - - // Chain multiple ranges into seed -@@ -641,7 +710,11 @@ assert(r == 107); - // Mixing convertible types is fair game, too - double[] c = [ 2.5, 3.0 ]; - auto r1 = reduce!("a + b")(chain(a, b, c)); --assert(r1 == 112.5); -+assert(approxEqual(r1, 112.5)); -+ -+// To minimize nesting of parentheses, Uniform Function Call Syntax can be used -+auto r2 = chain(a, b, c).reduce!("a + b"); -+assert(approxEqual(r2, 112.5)); - ---- - - $(DDOC_SECTION_H Multiple functions:) Sometimes it is very useful to -@@ -657,14 +730,14 @@ Example: - double[] a = [ 3.0, 4, 7, 11, 3, 2, 5 ]; - // Compute minimum and maximum in one pass - auto r = reduce!(min, max)(a); --// The type of r is Tuple!(double, double) --assert(r[0] == 2); // minimum --assert(r[1] == 11); // maximum -+// The type of r is Tuple!(int, int) -+assert(approxEqual(r[0], 2)); // minimum -+assert(approxEqual(r[1], 11)); // maximum - - // Compute sum and sum of squares in one pass - r = reduce!("a + b", "a + b * b")(tuple(0.0, 0.0), a); --assert(r[0] == 35); // sum --assert(r[1] == 233); // sum of squares -+assert(approxEqual(r[0], 35)); // sum -+assert(approxEqual(r[1], 233)); // sum of squares - // Compute average and standard deviation from the above - auto avg = r[0] / a.length; - auto stdev = sqrt(r[1] / a.length - avg * avg); -@@ -713,11 +786,12 @@ template reduce(fun...) if (fun.length > - else - { - static assert(fun.length > 1); -- typeof(adjoin!(staticMap!(binaryFun, fun))(r.front, r.front)) -+ Unqual!(typeof(r.front)) seed = r.front; -+ typeof(adjoin!(staticMap!(binaryFun, fun))(seed, seed)) - result = void; - foreach (i, T; result.Types) - { -- emplace(&result[i], r.front); -+ emplace(&result[i], seed); - } - r.popFront(); - return reduce(result, r); -@@ -875,6 +949,16 @@ unittest - r = reduce!"a + b"(a, c); - } - -+unittest -+{ -+ // Issue #10408 - Two-function reduce of a const array. -+ const numbers = [10, 30, 20]; -+ immutable m = reduce!(min)(numbers); -+ assert(m == 10); -+ immutable minmax = reduce!(min, max)(numbers); -+ assert(minmax == tuple(10, 30)); -+} -+ - /** - Fills $(D range) with a $(D filler). - -@@ -1096,9 +1180,11 @@ void uninitializedFill(Range, Value)(Ran - { - alias ElementType!Range T; - static if (hasElaborateAssign!T) -+ { - // Must construct stuff by the book - for (; !range.empty; range.popFront()) -- emplace(&range.front(), filler); -+ emplace(addressOf(range.front), filler); -+ } - else - // Doesn't matter whether fill is initialized or not - return fill(range, filler); -@@ -1141,13 +1227,13 @@ void initializeAll(Range)(Range range) - auto p = typeid(T).init().ptr; - if (p) - for ( ; !range.empty ; range.popFront() ) -- memcpy(&range.front(), p, T.sizeof); -+ memcpy(addressOf(range.front), p, T.sizeof); - else - static if (isDynamicArray!Range) - memset(range.ptr, 0, range.length * T.sizeof); - else - for ( ; !range.empty ; range.popFront() ) -- memset(&range.front(), 0, T.sizeof); -+ memset(addressOf(range.front), 0, T.sizeof); - } - else - fill(range, T.init); -@@ -1196,12 +1282,12 @@ unittest - static struct S3 - { - int i; -- this(this){}; -+ this(this){} - } - static struct S4 - { - int i = 1; -- this(this){}; -+ this(this){} - } - static assert (!hasElaborateAssign!S1); - static assert (!hasElaborateAssign!S2); -@@ -1255,18 +1341,25 @@ which $(D predicate(x)) is $(D true). - Example: - ---- - int[] arr = [ 1, 2, 3, 4, 5 ]; -+ - // Sum all elements --auto small = filter!("a < 3")(arr); -+auto small = filter!(a => a < 3)(arr); - assert(equal(small, [ 1, 2 ])); -+ -+// Sum again, but with Uniform Function Call Syntax (UFCS) -+auto sum = arr.filter!(a => a < 3); -+assert(equal(sum, [ 1, 2 ])); -+ - // In combination with chain() to span multiple ranges - int[] a = [ 3, -2, 400 ]; - int[] b = [ 100, -101, 102 ]; --auto r = filter!("a > 0")(chain(a, b)); -+auto r = chain(a, b).filter!(a => a > 0); - assert(equal(r, [ 3, 400, 100, 102 ])); -+ - // Mixing convertible types is fair game, too - double[] c = [ 2.5, 3.0 ]; --auto r1 = filter!("cast(int) a != a")(chain(c, a, b)); --assert(equal(r1, [ 2.5 ])); -+auto r1 = chain(c, a, b).filter!(a => cast(int) a != a); -+assert(approxEqual(r1, [ 2.5 ])); - ---- - */ - template filter(alias pred) if (is(typeof(unaryFun!pred))) -@@ -1319,7 +1412,7 @@ private struct FilterResult(alias pred, - { - @property auto save() - { -- return typeof(this)(_input); -+ return typeof(this)(_input.save); - } - } - } -@@ -2128,6 +2221,15 @@ if (is(typeof(ElementType!Range.init == - IndexType _frontLength = _unComputed; - IndexType _backLength = _unComputed; - -+ static if (isNarrowString!Range) -+ { -+ size_t _separatorLength; -+ } -+ else -+ { -+ enum _separatorLength = 1; -+ } -+ - static if (isBidirectionalRange!Range) - { - static IndexType lastIndexOf(Range haystack, Separator needle) -@@ -2142,6 +2244,11 @@ if (is(typeof(ElementType!Range.init == - { - _input = input; - _separator = separator; -+ -+ static if (isNarrowString!Range) -+ { -+ _separatorLength = codeLength!(ElementEncodingType!Range)(separator); -+ } - } - - static if (isInfinite!Range) -@@ -2185,8 +2292,7 @@ if (is(typeof(ElementType!Range.init == - } - else - { -- _input = _input[_frontLength .. _input.length]; -- skipOver(_input, _separator) || assert(false); -+ _input = _input[_frontLength + _separatorLength .. _input.length]; - _frontLength = _unComputed; - } - } -@@ -2238,15 +2344,7 @@ if (is(typeof(ElementType!Range.init == - } - else - { -- _input = _input[0 .. _input.length - _backLength]; -- if (!_input.empty && _input.back == _separator) -- { -- _input.popBack(); -- } -- else -- { -- assert(false); -- } -+ _input = _input[0 .. _input.length - _backLength - _separatorLength]; - _backLength = _unComputed; - } - } -@@ -2261,6 +2359,7 @@ unittest - debug(std_algorithm) scope(success) - writeln("unittest @", __FILE__, ":", __LINE__, " done."); - assert(equal(splitter("hello world", ' '), [ "hello", "", "world" ])); -+ assert(equal(splitter("žlutoučkýřkůň", 'ř'), [ "žlutoučký", "kůň" ])); - int[] a = [ 1, 2, 0, 0, 3, 0, 4, 5, 0 ]; - int[][] w = [ [1, 2], [], [3], [4, 5], [] ]; - static assert(isForwardRange!(typeof(splitter(a, 0)))); -@@ -2334,7 +2433,9 @@ with string types. - */ - auto splitter(Range, Separator)(Range r, Separator s) - if (is(typeof(Range.init.front == Separator.init.front) : bool) -- && (hasSlicing!Range || isNarrowString!Range)) -+ && (hasSlicing!Range || isNarrowString!Range) -+ && isForwardRange!Separator -+ && (hasLength!Separator || isNarrowString!Separator)) - { - static struct Result - { -@@ -2354,7 +2455,8 @@ if (is(typeof(Range.init.front == Separa - if (_frontLength != _frontLength.max) return; - assert(!_input.empty); - // compute front length -- _frontLength = _input.length - find(_input, _separator).length; -+ _frontLength = (_separator.empty) ? 1 : -+ _input.length - find(_input, _separator).length; - static if (isBidirectionalRange!Range) - if (_frontLength == _input.length) _backLength = _frontLength; - } -@@ -2365,7 +2467,7 @@ if (is(typeof(Range.init.front == Separa - if (_backLength != _backLength.max) return; - assert(!_input.empty); - // compute back length -- static if (isBidirectionalRange!Range) -+ static if (isBidirectionalRange!Range && isBidirectionalRange!Separator) - { - _backLength = _input.length - - find(retro(_input), retro(_separator)).source.length; -@@ -2439,7 +2541,7 @@ if (is(typeof(Range.init.front == Separa - } - - // Bidirectional functionality as suggested by Brad Roberts. -- static if (isBidirectionalRange!Range) -+ static if (isBidirectionalRange!Range && isBidirectionalRange!Separator) - { - @property Range back() - { -@@ -2529,6 +2631,31 @@ unittest - assert(equal(sp6, ["", ""][])); - } - -+unittest -+{ -+ // Issue 10773 -+ auto s = splitter("abc", ""); -+ assert(s.equal(["a", "b", "c"])); -+} -+ -+unittest -+{ -+ // Test by-reference separator -+ class RefSep { -+ string _impl; -+ this(string s) { _impl = s; } -+ @property empty() { return _impl.empty; } -+ @property auto front() { return _impl.front; } -+ void popFront() { _impl = _impl[1..$]; } -+ @property RefSep save() { return new RefSep(_impl); } -+ @property auto length() { return _impl.length; } -+ } -+ auto sep = new RefSep("->"); -+ auto data = "i->am->pointing"; -+ auto words = splitter(data, sep); -+ assert(words.equal([ "i", "am", "pointing" ])); -+} -+ - auto splitter(alias isTerminator, Range)(Range input) - if (is(typeof(unaryFun!(isTerminator)(ElementType!(Range).init)))) - { -@@ -2684,7 +2811,7 @@ unittest - lines[1] = "line \ttwo".dup; - lines[2] = "yah last line\ryah".dup; - foreach (line; lines) { -- foreach (word; splitter(strip(line))) { -+ foreach (word; splitter(std.string.strip(line))) { - if (word in dictionary) continue; // Nothing to do - auto newID = dictionary.length; - dictionary[to!string(word)] = cast(uint)newID; -@@ -2801,7 +2928,27 @@ if (isInputRange!RoR && isInputRange!(El - { - _items = items; - _sep = sep; -- mixin(useItem); // _current should be initialized in place -+ -+ //mixin(useItem); // _current should be initialized in place -+ if (_items.empty) -+ _current = _current.init; // set invalid state -+ else -+ { -+ // If we're exporting .save, we must not consume any of the -+ // subranges, since RoR.save does not guarantee that the states -+ // of the subranges are also saved. -+ static if (isForwardRange!RoR && -+ isForwardRange!(ElementType!RoR)) -+ _current = _items.front.save; -+ else -+ _current = _items.front; -+ -+ if (_current.empty) -+ { -+ // No data in the current item - toggle to use the separator -+ useSeparator(); -+ } -+ } - } - - @property auto empty() -@@ -2988,7 +3135,24 @@ if (isInputRange!RoR && isInputRange!(El - this(RoR r) - { - _items = r; -- mixin(prepare); // _current should be initialized in place -+ //mixin(prepare); // _current should be initialized in place -+ -+ // Skip over empty subranges. -+ while (!_items.empty && _items.front.empty) -+ _items.popFront(); -+ -+ if (_items.empty) -+ _current = _current.init; // set invalid state -+ else -+ { -+ // We cannot export .save method unless we ensure subranges are not -+ // consumed when a .save'd copy of ourselves is iterated over. So -+ // we need to .save each subrange we traverse. -+ static if (isForwardRange!RoR && isForwardRange!(ElementType!RoR)) -+ _current = _items.front.save; -+ else -+ _current = _items.front; -+ } - } - static if (isInfinite!RoR) - { -@@ -3482,15 +3646,27 @@ string[] s = [ "Hello", "world", "!" ]; - assert(!find!("toLower(a) == b")(s, "hello").empty); - ---- - */ -+ - R find(alias pred = "a == b", R, E)(R haystack, E needle) - if (isInputRange!R && - is(typeof(binaryFun!pred(haystack.front, needle)) : bool)) - { -- for (; !haystack.empty; haystack.popFront()) -+ static if (isNarrowString!R && isSomeChar!E && is(typeof(pred == "a == b")) && pred == "a == b") - { -- if (binaryFun!pred(haystack.front, needle)) break; -+ alias Unqual!(ElementEncodingType!R) EEType; -+ EEType[EEType.sizeof == 1 ? 4 : 2] buf; -+ -+ size_t len = encode(buf, needle); -+ return () @trusted {return std.algorithm.find!pred(haystack, cast(R)buf[0 .. len]);}(); -+ } -+ else -+ { -+ for (; !haystack.empty; haystack.popFront()) -+ { -+ if (binaryFun!pred(haystack.front, needle)) break; -+ } -+ return haystack; - } -- return haystack; - } - - unittest -@@ -3502,6 +3678,7 @@ unittest - auto r = find(lst[], 5); - assert(equal(r, SList!int(5, 7, 3)[])); - assert(find([1, 2, 3, 5], 4).empty); -+ assert(equal(find!"a>b"("hello", 'k'), "llo")); - } - - /** -@@ -3964,7 +4141,7 @@ unittest - struct BoyerMooreFinder(alias pred, Range) - { - private: -- size_t skip[]; -+ size_t[] skip; - ptrdiff_t[ElementType!(Range)] occ; - Range needle; - -@@ -4399,11 +4576,11 @@ unittest - /++ - Returns the number of elements which must be popped from the front of - $(D haystack) before reaching an element for which -- $(D startsWith!pred(haystack, needle)) is $(D true). If -- $(D startsWith!pred(haystack, needle)) is not $(D true) for any element in -- $(D haystack), then -1 is returned. -+ $(D startsWith!pred(haystack, needles)) is $(D true). If -+ $(D startsWith!pred(haystack, needles)) is not $(D true) for any element in -+ $(D haystack), then $(D -1) is returned. - -- $(D needle) may be either an element or a range. -+ $(D needles) may be either an element or a range. - - Examples: - -------------------- -@@ -4419,47 +4596,88 @@ assert(countUntil([0, 7, 12, 22, 9], 9) - assert(countUntil!"a > b"([0, 7, 12, 22, 9], 20) == 3); - -------------------- - +/ --ptrdiff_t countUntil(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) -- if (isForwardRange!R1 && isForwardRange!R2 && -- is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) -+ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) -+ if (isForwardRange!R -+ && Rs.length > 0 -+ && isForwardRange!(Rs[0]) == isInputRange!(Rs[0]) -+ && is(typeof(startsWith!pred(haystack, needles[0]))) -+ && (Rs.length == 1 -+ || is(typeof(countUntil!pred(haystack, needles[1 .. $]))))) - { - typeof(return) result; -- static if (hasLength!R1) //Note: Narrow strings don't have length. -+ -+ static if (needles.length == 1) - { -- //We delegate to find because find is very efficient. -- //We store the length of the haystack so we don't have to save it. -- auto len = haystack.length; -- auto r2 = find!pred(haystack, needle); -- if (!r2.empty) -- return cast(typeof(return)) (len - r2.length); -+ static if (hasLength!R) //Note: Narrow strings don't have length. -+ { -+ //We delegate to find because find is very efficient. -+ //We store the length of the haystack so we don't have to save it. -+ auto len = haystack.length; -+ auto r2 = find!pred(haystack, needles[0]); -+ if (!r2.empty) -+ return cast(typeof(return)) (len - r2.length); -+ } -+ else -+ { -+ if (needles[0].empty) -+ return 0; -+ -+ //Default case, slower route doing startsWith iteration -+ for ( ; !haystack.empty ; ++result ) -+ { -+ //We compare the first elements of the ranges here before -+ //forwarding to startsWith. This avoids making useless saves to -+ //haystack/needle if they aren't even going to be mutated anyways. -+ //It also cuts down on the amount of pops on haystack. -+ if (binaryFun!pred(haystack.front, needles[0].front)) -+ { -+ //Here, we need to save the needle before popping it. -+ //haystack we pop in all paths, so we do that, and then save. -+ haystack.popFront(); -+ if (startsWith!pred(haystack.save, needles[0].save.dropOne())) -+ return result; -+ } -+ else -+ haystack.popFront(); -+ } -+ } - } - else - { -- if (needle.empty) -- return 0; -- -- //Default case, slower route doing startsWith iteration -- for ( ; !haystack.empty ; ++result ) -+ foreach (i, Ri; Rs) - { -- //We compare the first elements of the ranges here before -- //forwarding to startsWith. This avoids making useless saves to -- //haystack/needle if they aren't even going to be mutated anyways. -- //It also cuts down on the amount of pops on haystack. -- if (binaryFun!pred(haystack.front, needle.front)) -+ static if (isForwardRange!Ri) - { -- //Here, we need to save the needle before popping it. -- //haystack we pop in all paths, so we do that, and then save. -- haystack.popFront(); -- if (startsWith!pred(haystack.save, needle.save.dropOne())) -- return result; -+ if (needles[i].empty) -+ return 0; -+ } -+ } -+ Tuple!Rs t; -+ foreach (i, Ri; Rs) -+ { -+ static if (!isForwardRange!Ri) -+ { -+ t[i] = needles[i]; -+ } -+ } -+ for (; !haystack.empty ; ++result, haystack.popFront()) -+ { -+ foreach (i, Ri; Rs) -+ { -+ static if (isForwardRange!Ri) -+ { -+ t[i] = needles[i].save; -+ } -+ } -+ if (startsWith!pred(haystack.save, t.expand)) -+ { -+ return result; - } -- else -- haystack.popFront(); - } - } - - //Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement" -- static if (isInfinite!R1) assert(0); -+ static if (isInfinite!R) assert(0); - else return -1; - } - /// ditto -@@ -4509,6 +4727,14 @@ unittest - assert(r.save.countUntil(r3) == -1); - } - -+unittest -+{ -+ assert(countUntil("hello world", "world", "asd") == 6); -+ assert(countUntil("hello world", "world", "ello") == 1); -+ assert(countUntil("hello world", "world", "") == 0); -+ assert(countUntil("hello world", "world", 'l') == 2); -+} -+ - /++ - Returns the number of elements which must be popped from $(D haystack) - before $(D pred(haystack.front)) is $(D true). -@@ -4597,25 +4823,7 @@ unittest - } - } - --/** -- * $(RED Deprecated. It will be removed in January 2013. -- * Currently defaults to $(LREF countUntil) instead.) -- * -- * Not to be confused with its homonym function -- * in $(D std.string). -- * -- * Please use $(D std.string.indexOf) if you wish to find -- * the index of a character in a string. -- * -- * Otherwise, please use $(D std.string.countUntil) to find -- * an element's logical position in a range. -- * -- * Example: -- * -------- -- * assert(std.string.indexOf("日本語", '本') == 3); -- * assert(std.algorithm.countUntil("日本語", '本') == 1); -- * -------- -- */ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.algorithm.countUntil instead.") - ptrdiff_t indexOf(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) - if (is(typeof(startsWith!pred(haystack, needle)))) -@@ -5668,7 +5876,7 @@ unittest - assert(count("abcadfabf", "ab") == 2); - assert(count("ababab", "abab") == 1); - assert(count("ababab", "abx") == 0); -- assert(count!"std.uni.toLower(a) == std.uni.toLower(b)"("AbcAdFaBf", "ab") == 2); -+ assert(count!((a, b) => std.uni.toLower(a) == std.uni.toLower(b))("AbcAdFaBf", "ab") == 2); - } - - /// Ditto -@@ -5948,7 +6156,16 @@ int cmp(alias pred = "a < b", R1, R2)(R1 - static if (typeof(r1[0]).sizeof == 1) - { - immutable len = min(r1.length, r2.length); -- immutable result = std.c.string.memcmp(r1.ptr, r2.ptr, len); -+ immutable result = __ctfe ? -+ { -+ foreach (i; 0 .. len) -+ { -+ if (r1[i] != r2[i]) -+ return threeWayInt(r1[i], r2[i]); -+ } -+ return 0; -+ }() -+ : std.c.string.memcmp(r1.ptr, r2.ptr, len); - if (result) return result; - } - else -@@ -6561,7 +6778,7 @@ unittest - assert(levenshteinDistance("cat", "rat") == 1); - assert(levenshteinDistance("parks", "spark") == 2); - assert(levenshteinDistance("kitten", "sitting") == 3); -- assert(levenshteinDistance!("std.uni.toUpper(a) == std.uni.toUpper(b)") -+ assert(levenshteinDistance!((a, b) => std.uni.toUpper(a) == std.uni.toUpper(b)) - ("parks", "SPARK") == 2); - } - -@@ -6885,6 +7102,134 @@ unittest - test("hello\U00010143\u0100\U00010143", "\U00010143\u0100\U00010143olleh"); - } - -+/** -+ The strip group of functions allow stripping of either leading, trailing, -+ or both leading and trailing elements. -+ -+ The $(D stripLeft) function will strip the $(D front) of the range, -+ the $(D stripRight) function will strip the $(D back) of the range, -+ while the $(D strip) function will strip both the $(D front) and $(D back) -+ of the range. -+ -+ Note that the $(D strip) and $(D stripRight) functions require the range to -+ be a $(LREF BidirectionalRange) range. -+ -+ All of these functions come in two varieties: one takes a target element, -+ where the range will be stripped as long as this element can be found. -+ The other takes a lambda predicate, where the range will be stripped as -+ long as the predicate returns true. -+*/ -+Range strip(Range, E)(Range range, E element) -+ if (isBidirectionalRange!Range && is(typeof(range.front == element) : bool)) -+{ -+ return range.stripLeft(element).stripRight(element); -+} -+ -+/// ditto -+Range strip(alias pred, Range)(Range range) -+ if (isBidirectionalRange!Range && is(typeof(pred(range.back)) : bool)) -+{ -+ return range.stripLeft!pred().stripRight!pred(); -+} -+ -+/// ditto -+Range stripLeft(Range, E)(Range range, E element) -+ if (isInputRange!Range && is(typeof(range.front == element) : bool)) -+{ -+ return find!((auto ref a) => a != element)(range); -+} -+ -+/// ditto -+Range stripLeft(alias pred, Range)(Range range) -+ if (isInputRange!Range && is(typeof(pred(range.front)) : bool)) -+{ -+ return find!(not!pred)(range); -+} -+ -+/// ditto -+Range stripRight(Range, E)(Range range, E element) -+ if (isBidirectionalRange!Range && is(typeof(range.back == element) : bool)) -+{ -+ for (; !range.empty; range.popBack()) -+ { -+ if (range.back != element) -+ break; -+ } -+ return range; -+} -+ -+/// ditto -+Range stripRight(alias pred, Range)(Range range) -+ if (isBidirectionalRange!Range && is(typeof(pred(range.back)) : bool)) -+{ -+ for (; !range.empty; range.popBack()) -+ { -+ if (!pred(range.back)) -+ break; -+ } -+ return range; -+} -+ -+/// Strip leading and trailing elements equal to the target element. -+@safe pure unittest -+{ -+ assert(" foobar ".strip(' ') == "foobar"); -+ assert("00223.444500".strip('0') == "223.4445"); -+ assert("ëëêéüŗōpéêëë".strip('ë') == "êéüŗōpéê"); -+ assert([1, 1, 0, 1, 1].strip(1) == [0]); -+ assert([0.0, 0.01, 0.01, 0.0].strip(0).length == 2); -+} -+ -+/// Strip leading and trailing elements while the predicate returns true. -+@safe pure unittest -+{ -+ assert(" foobar ".strip!(a => a == ' ')() == "foobar"); -+ assert("00223.444500".strip!(a => a == '0')() == "223.4445"); -+ assert("ëëêéüŗōpéêëë".strip!(a => a == 'ë')() == "êéüŗōpéê"); -+ assert([1, 1, 0, 1, 1].strip!(a => a == 1)() == [0]); -+ assert([0.0, 0.01, 0.5, 0.6, 0.01, 0.0].strip!(a => a < 0.4)().length == 2); -+} -+ -+/// Strip leading elements equal to the target element. -+@safe pure unittest -+{ -+ assert(" foobar ".stripLeft(' ') == "foobar "); -+ assert("00223.444500".stripLeft('0') == "223.444500"); -+ assert("ůůűniçodêéé".stripLeft('ů') == "űniçodêéé"); -+ assert([1, 1, 0, 1, 1].stripLeft(1) == [0, 1, 1]); -+ assert([0.0, 0.01, 0.01, 0.0].stripLeft(0).length == 3); -+} -+ -+/// Strip leading elements while the predicate returns true. -+@safe pure unittest -+{ -+ assert(" foobar ".stripLeft!(a => a == ' ')() == "foobar "); -+ assert("00223.444500".stripLeft!(a => a == '0')() == "223.444500"); -+ assert("ůůűniçodêéé".stripLeft!(a => a == 'ů')() == "űniçodêéé"); -+ assert([1, 1, 0, 1, 1].stripLeft!(a => a == 1)() == [0, 1, 1]); -+ assert([0.0, 0.01, 0.10, 0.5, 0.6].stripLeft!(a => a < 0.4)().length == 2); -+} -+ -+/// Strip trailing elements equal to the target element. -+@safe pure unittest -+{ -+ assert(" foobar ".stripRight(' ') == " foobar"); -+ assert("00223.444500".stripRight('0') == "00223.4445"); -+ assert("ùniçodêéé".stripRight('é') == "ùniçodê"); -+ assert([1, 1, 0, 1, 1].stripRight(1) == [1, 1, 0]); -+ assert([0.0, 0.01, 0.01, 0.0].stripRight(0).length == 3); -+} -+ -+/// Strip trailing elements while the predicate returns true. -+@safe pure unittest -+{ -+ assert(" foobar ".stripRight!(a => a == ' ')() == " foobar"); -+ assert("00223.444500".stripRight!(a => a == '0')() == "00223.4445"); -+ assert("ùniçodêéé".stripRight!(a => a == 'é')() == "ùniçodê"); -+ assert([1, 1, 0, 1, 1].stripRight!(a => a == 1)() == [1, 1, 0]); -+ assert([0.0, 0.01, 0.10, 0.5, 0.6].stripRight!(a => a > 0.4)().length == 3); -+} -+ - // bringToFront - /** - The $(D bringToFront) function has considerable flexibility and -@@ -7217,120 +7562,80 @@ cases.)) - Range remove - (SwapStrategy s = SwapStrategy.stable, Range, Offset...) - (Range range, Offset offset) --if (isBidirectionalRange!Range && hasLength!Range && s != SwapStrategy.stable -+if (s != SwapStrategy.stable -+ && isBidirectionalRange!Range && hasLength!Range - && Offset.length >= 1) - { -- enum bool tupleLeft = is(typeof(offset[0][0])) -- && is(typeof(offset[0][1])); -- enum bool tupleRight = is(typeof(offset[$ - 1][0])) -- && is(typeof(offset[$ - 1][1])); -- static if (!tupleLeft) -- { -- alias offset[0] lStart; -- auto lEnd = lStart + 1; -- } -- else -- { -- auto lStart = offset[0][0]; -- auto lEnd = offset[0][1]; -- } -- static if (!tupleRight) -+ Tuple!(size_t, "pos", size_t, "len")[offset.length] blackouts; -+ foreach (i, v; offset) - { -- alias offset[$ - 1] rStart; -- auto rEnd = rStart + 1; -- } -- else -- { -- auto rStart = offset[$ - 1][0]; -- auto rEnd = offset[$ - 1][1]; -- } -- // Begin. Test first to see if we need to remove the rightmost -- // element(s) in the range. In that case, life is simple - chop -- // and recurse. -- if (rEnd == range.length) -- { -- // must remove the last elements of the range -- range.popBackN(rEnd - rStart); -- static if (Offset.length > 1) -+ static if (is(typeof(v[0]) : size_t) && is(typeof(v[1]) : size_t)) - { -- return .remove!(s, Range, Offset[0 .. $ - 1]) -- (range, offset[0 .. $ - 1]); -+ blackouts[i].pos = v[0]; -+ blackouts[i].len = v[1] - v[0]; - } - else - { -- return range; -- } -- } -- -- // Ok, there are "live" elements at the end of the range -- auto t = range; -- auto lDelta = lEnd - lStart, rDelta = rEnd - rStart; -- auto rid = min(lDelta, rDelta); -- foreach (i; 0 .. rid) -- { -- move(range.back, t.front); -- range.popBack(); -- t.popFront(); -- } -- if (rEnd - rStart == lEnd - lStart) -- { -- // We got rid of both left and right -- static if (Offset.length > 2) -- { -- return .remove!(s, Range, Offset[1 .. $ - 1]) -- (range, offset[1 .. $ - 1]); -+ static assert(is(typeof(v) : size_t), typeof(v).stringof); -+ blackouts[i].pos = v; -+ blackouts[i].len = 1; - } -- else -+ static if (i > 0) - { -- return range; -+ enforce(blackouts[i - 1].pos + blackouts[i - 1].len -+ <= blackouts[i].pos, -+ "remove(): incorrect ordering of elements to remove"); - } - } -- else if (rEnd - rStart < lEnd - lStart) -+ -+ size_t left = 0, right = offset.length - 1; -+ auto tgt = range.save; -+ size_t steps = 0; -+ -+ while (left <= right) - { -- // We got rid of the entire right subrange -- static if (Offset.length > 2) -+ // Look for a blackout on the right -+ if (blackouts[right].pos + blackouts[right].len >= range.length) - { -- return .remove!(s, Range) -- (range, tuple(lStart + rid, lEnd), -- offset[1 .. $ - 1]); -+ range.popBackN(blackouts[right].len); -+ --right; -+ continue; - } -- else -+ // Advance to next blackout on the left -+ assert(blackouts[left].pos >= steps); -+ tgt.popFrontN(blackouts[left].pos - steps); -+ steps = blackouts[left].pos; -+ auto toMove = min( -+ blackouts[left].len, -+ range.length - (blackouts[right].pos + blackouts[right].len)); -+ foreach (i; 0 .. toMove) - { -- auto tmp = tuple(lStart + rid, lEnd); -- return .remove!(s, Range, typeof(tmp)) -- (range, tmp); -- } -- } -- else -- { -- // We got rid of the entire left subrange -- static if (Offset.length > 2) -- { -- return .remove!(s, Range) -- (range, offset[1 .. $ - 1], -- tuple(rStart, lEnd - rid)); -+ move(range.back, tgt.front); -+ range.popBack(); -+ tgt.popFront(); - } -- else -+ steps += toMove; -+ if (toMove == blackouts[left].len) - { -- auto tmp = tuple(rStart, lEnd - rid); -- return .remove!(s, Range, typeof(tmp)) -- (range, tmp); -+ // Filled the entire left hole -+ ++left; -+ continue; - } - } -+ -+ return range; - } - - // Ditto - Range remove - (SwapStrategy s = SwapStrategy.stable, Range, Offset...) - (Range range, Offset offset) --if ((isForwardRange!Range && !isBidirectionalRange!Range -- || !hasLength!Range || s == SwapStrategy.stable) -- && Offset.length >= 1) -+if (s == SwapStrategy.stable && isForwardRange!Range && Offset.length >= 1) - { - auto result = range; - auto src = range, tgt = range; - size_t pos; -- foreach (i; offset) -+ foreach (pass, i; offset) - { - static if (is(typeof(i[0])) && is(typeof(i[1]))) - { -@@ -7341,10 +7646,20 @@ if ((isForwardRange!Range && !isBidirect - auto from = i; - enum delta = 1; - } -- assert(pos <= from); -- for (; pos < from; ++pos, src.popFront(), tgt.popFront()) -+ enforce(pos <= from, -+ "remove(): incorrect ordering of elements to remove"); -+ if (pass > 0) - { -- move(src.front, tgt.front); -+ for (; pos < from; ++pos, src.popFront(), tgt.popFront()) -+ { -+ move(src.front, tgt.front); -+ } -+ } -+ else -+ { -+ src.popFrontN(from); -+ tgt.popFrontN(from); -+ pos = from; - } - // now skip source to the "to" position - src.popFrontN(delta); -@@ -7358,6 +7673,16 @@ if ((isForwardRange!Range && !isBidirect - - unittest - { -+ // http://d.puremagic.com/issues/show_bug.cgi?id=10173 -+ int[] test = iota(0, 10).array(); -+ assertThrown(remove!(SwapStrategy.stable)(test, tuple(2, 4), tuple(1, 3))); -+ assertThrown(remove!(SwapStrategy.unstable)(test, tuple(2, 4), tuple(1, 3))); -+ assertThrown(remove!(SwapStrategy.stable)(test, 2, 4, 1, 3)); -+ assertThrown(remove!(SwapStrategy.unstable)(test, 2, 4, 1, 3)); -+} -+ -+unittest -+{ - debug(std_algorithm) scope(success) - writeln("unittest @", __FILE__, ":", __LINE__, " done."); - int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; -@@ -7368,11 +7693,15 @@ unittest - - a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - assert(remove!(SwapStrategy.unstable)(a, 0, 10) == -- [ 9, 1, 2, 3, 4, 5, 6, 7, 8 ]); -+ [ 9, 1, 2, 3, 4, 5, 6, 7, 8 ]); - - a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - assert(remove!(SwapStrategy.unstable)(a, 0, tuple(9, 11)) == - [ 8, 1, 2, 3, 4, 5, 6, 7 ]); -+ // http://d.puremagic.com/issues/show_bug.cgi?id=5224 -+ a = [ 1, 2, 3, 4 ]; -+ assert(remove!(SwapStrategy.unstable)(a, 2) == -+ [ 1, 2, 4 ]); - - a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - //writeln(remove!(SwapStrategy.stable)(a, 1, 5)); -@@ -7390,6 +7719,10 @@ unittest - a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; - assert(remove!(SwapStrategy.stable)(a, 1, tuple(3, 5)) - == [ 0, 2, 5, 6, 7, 8, 9, 10]); -+ -+ a = iota(0, 10).array(); -+ assert(remove!(SwapStrategy.unstable)(a, tuple(1, 4), tuple(6, 7)) -+ == [0, 9, 8, 7, 4, 5]); - } - - /** -@@ -7415,7 +7748,7 @@ if (isBidirectionalRange!Range) - { - for (;!range.empty;) - { -- if (!unaryFun!(pred)(range.front)) -+ if (!unaryFun!pred(range.front)) - { - range.popFront(); - continue; -@@ -7857,13 +8190,14 @@ sorted. In addition, it also partitions - $(D e1) from $(D r[0]) to $(D r[nth]) satisfy $(D !less(r[nth], e1)), - and all elements $(D e2) from $(D r[nth]) to $(D r[r.length]) satisfy - $(D !less(e2, r[nth])). Effectively, it finds the nth smallest --(according to $(D less)) elements in $(D r). Performs $(BIGOH --r.length) (if unstable) or $(BIGOH r.length * log(r.length)) (if --stable) evaluations of $(D less) and $(D swap). See also $(WEB -+(according to $(D less)) elements in $(D r). Performs an expected -+$(BIGOH r.length) (if unstable) or $(BIGOH r.length * log(r.length)) -+(if stable) evaluations of $(D less) and $(D swap). See also $(WEB - sgi.com/tech/stl/nth_element.html, STL's nth_element). - --Example: -+If $(D n >= r.length), the algorithm has no effect. - -+Examples: - ---- - int[] v = [ 25, 7, 9, 2, 0, 5, 21 ]; - auto n = 4; -@@ -7887,14 +8221,10 @@ void topN(alias less = "a < b", - "Stable topN not yet implemented"); - while (r.length > nth) - { -- auto pivot = r.length / 2; -+ auto pivot = uniform(0, r.length); - swap(r[pivot], r.back); - assert(!binaryFun!(less)(r.back, r.back)); -- bool pred(ElementType!(Range) a) -- { -- return binaryFun!(less)(a, r.back); -- } -- auto right = partition!(pred, ss)(r); -+ auto right = partition!((a) => binaryFun!less(a, r.back), ss)(r); - assert(right.length >= 1); - swap(right.front, r.back); - pivot = r.length - right.length; -@@ -8002,15 +8332,13 @@ void topN(alias less = "a < b", - } - } - -+/// Ditto - unittest - { -- debug(std_algorithm) scope(success) -- writeln("unittest @", __FILE__, ":", __LINE__, " done."); - int[] a = [ 5, 7, 2, 6, 7 ]; - int[] b = [ 2, 1, 5, 6, 7, 3, 0 ]; - topN(a, b); - sort(a); -- sort(b); - assert(a == [0, 1, 2, 2, 3]); - } - -@@ -8078,17 +8406,12 @@ sort(alias less = "a < b", SwapStrategy - quickSortImpl!(lessFun)(r); - else //use Tim Sort for semistable & stable - TimSortImpl!(lessFun, Range).sort(r, null); -- static if (is(typeof(text(r)))) -- { -- enum maxLen = 8; -- assert(isSorted!lessFun(r), text("Failed to sort range of type ", -- Range.stringof, ". Actual result is: ", -- r[0 .. r.length > maxLen ? maxLen : r.length ], -- r.length > maxLen ? "..." : "")); -- } -- else -- assert(isSorted!lessFun(r), text("Unable to sort range of type ", -- Range.stringof, ": <unable to print elements>")); -+ -+ enum maxLen = 8; -+ assert(isSorted!lessFun(r), text("Failed to sort range of type ", -+ Range.stringof, ". Actual result is: ", -+ r[0 .. r.length > maxLen ? maxLen : r.length ], -+ r.length > maxLen ? "..." : "")); - } - else - { -@@ -8141,6 +8464,13 @@ unittest - auto b = rndstuff!(string)(); - sort!("toLower(a) < toLower(b)")(b); - assert(isSorted!("toUpper(a) < toUpper(b)")(b)); -+ -+ { -+ // Issue 10317 -+ enum E_10317 { a, b } -+ auto a_10317 = new E_10317[10]; -+ sort(a_10317); -+ } - } - - private template validPredicates(E, less...) { -@@ -9012,8 +9342,7 @@ corresponding $(D sort), but $(D schwart - transform) only $(D r.length) times (less than half when compared to - regular sorting). The usage can be best illustrated with an example. - --Example: -- -+Examples: - ---- - uint hashFun(string) { ... expensive computation ... } - string[] array = ...; -@@ -9033,24 +9362,59 @@ To check whether an array was sorted and - Schwartz sorting, a function $(D schwartzIsSorted) is not provided - because the effect can be achieved by calling $(D - isSorted!less(map!transform(r))). -+ -+Returns: The initial range wrapped as a $(D SortedRange) with the -+predicate $(D (a, b) => binaryFun!less(transform(a), -+transform(b))). - */ --void schwartzSort(alias transform, alias less = "a < b", -- SwapStrategy ss = SwapStrategy.unstable, Range)(Range r) -- if (isRandomAccessRange!(Range) && hasLength!(Range)) -+SortedRange!(R, ((a, b) => binaryFun!less(unaryFun!transform(a), -+ unaryFun!transform(b)))) -+schwartzSort(alias transform, alias less = "a < b", -+ SwapStrategy ss = SwapStrategy.unstable, R)(R r) -+ if (isRandomAccessRange!R && hasLength!R) - { -- alias typeof(transform(r.front)) XformType; -- auto xform = new XformType[r.length]; -- foreach (i, e; r) -+ import core.stdc.stdlib; -+ alias T = typeof(unaryFun!transform(r.front)); -+ auto xform1 = (cast(T*) malloc(r.length * T.sizeof))[0 .. r.length]; -+ size_t length; -+ scope(exit) - { -- xform[i] = transform(e); -+ static if (hasElaborateDestructor!T) -+ { -+ foreach (i; 0 .. length) collectException(destroy(xform1[i])); -+ } -+ free(xform1.ptr); -+ } -+ for (; length != r.length; ++length) -+ { -+ emplace(xform1.ptr + length, unaryFun!transform(r[length])); - } -- auto z = zip(xform, r); -- alias typeof(z.front) ProxyType; -- bool myLess(ProxyType a, ProxyType b) -+ // Make sure we use ubyte[] and ushort[], not char[] and wchar[] -+ // for the intermediate array, lest zip gets confused. -+ static if (isNarrowString!(typeof(xform1))) - { -- return binaryFun!less(a[0], b[0]); -+ auto xform = xform1.representation(); - } -- sort!(myLess, ss)(z); -+ else -+ { -+ alias xform = xform1; -+ } -+ zip(xform, r).sort!((a, b) => binaryFun!less(a[0], b[0]), ss)(); -+ return typeof(return)(r); -+} -+ -+unittest -+{ -+ // issue 4909 -+ Tuple!(char)[] chars; -+ schwartzSort!"a[0]"(chars); -+} -+ -+unittest -+{ -+ // issue 5924 -+ Tuple!(char)[] chars; -+ schwartzSort!((Tuple!(char) c){ return c[0]; })(chars); - } - - unittest -@@ -9234,7 +9598,7 @@ bool isSorted(alias less = "a < b", Rang - ahead.popFront(); - size_t i; - -- for (; !ahead.empty; ahead.popFront(), ++i) -+ for (; !ahead.empty; ahead.popFront(), r.popFront(), ++i) - { - if (!binaryFun!less(ahead.front, r.front)) continue; - // Check for antisymmetric predicate -@@ -9250,6 +9614,26 @@ bool isSorted(alias less = "a < b", Rang - return true; - } - -+unittest -+{ -+ // Issue 9457 -+ auto x = "abcd"; -+ assert(isSorted(x)); -+ auto y = "acbd"; -+ assert(!isSorted(y)); -+ -+ int[] a = [1, 2, 3]; -+ assert(isSorted(a)); -+ int[] b = [1, 3, 2]; -+ assert(!isSorted(b)); -+ -+ dchar[] ds = "コーヒーが好きです"d.dup; -+ sort(ds); -+ string s = to!string(ds); -+ assert(isSorted(ds)); // random-access -+ assert(isSorted(s)); // bidirectional -+} -+ - // makeIndex - /** - Computes an index for $(D r) based on the comparison $(D less). The -@@ -9264,15 +9648,23 @@ extra indirection, and is always larger - because it needs space for the index in addition to the original - collection. The complexity is the same as $(D sort)'s. - --$(D makeIndex) overwrites its second argument with the result, but --never reallocates it. If the second argument's length is less than --that of the range indexed, an exception is thrown. -- - The first overload of $(D makeIndex) writes to a range containing - pointers, and the second writes to a range containing offsets. The - first overload requires $(D Range) to be a forward range, and the - latter requires it to be a random-access range. - -+$(D makeIndex) overwrites its second argument with the result, but -+never reallocates it. -+ -+Returns: The pointer-based version returns a $(D SortedRange) wrapper -+over index, of type $(D SortedRange!(RangeIndex, (a, b) => -+binaryFun!less(*a, *b))) thus reflecting the ordering of the -+index. The index-based version returns $(D void) because the ordering -+relation involves not only $(D index) but also $(D r). -+ -+Throws: If the second argument's length is less than that of the range -+indexed, an exception is thrown. -+ - Example: - ---- - immutable(int[]) arr = [ 2, 3, 1, 5, 0 ]; -@@ -9288,7 +9680,8 @@ assert(isSorted! - (index2)); - ---- - */ --void makeIndex( -+SortedRange!(RangeIndex, (a, b) => binaryFun!less(*a, *b)) -+makeIndex( - alias less = "a < b", - SwapStrategy ss = SwapStrategy.unstable, - Range, -@@ -9300,15 +9693,11 @@ void makeIndex( - // assume collection already ordered - size_t i; - for (; !r.empty; r.popFront(), ++i) -- index[i] = &(r.front); -+ index[i] = addressOf(r.front); - enforce(index.length == i); - // sort the index -- static bool indirectLess(ElementType!(RangeIndex) a, -- ElementType!(RangeIndex) b) -- { -- return binaryFun!(less)(*a, *b); -- } -- sort!(indirectLess, ss)(index); -+ sort!((a, b) => binaryFun!less(*a, *b), ss)(index); -+ return typeof(return)(index); - } - - /// Ditto -@@ -9318,32 +9707,28 @@ void makeIndex( - Range, - RangeIndex) - (Range r, RangeIndex index) -- if (isRandomAccessRange!(Range) && !isInfinite!(Range) && -- isRandomAccessRange!(RangeIndex) && !isInfinite!(RangeIndex) && -- isIntegral!(ElementType!(RangeIndex))) -+if (isRandomAccessRange!Range && !isInfinite!Range && -+ isRandomAccessRange!RangeIndex && !isInfinite!RangeIndex && -+ isIntegral!(ElementType!RangeIndex)) - { -- alias Unqual!(ElementType!RangeIndex) I; -+ alias Unqual!(ElementType!RangeIndex) IndexType; - enforce(r.length == index.length, - "r and index must be same length for makeIndex."); -- static if (I.sizeof < size_t.sizeof) -+ static if (IndexType.sizeof < size_t.sizeof) - { -- enforce(r.length <= I.max, "Cannot create an index with " ~ -- "element type " ~ I.stringof ~ " with length " ~ -- to!string(r.length) ~ "." -- ); -+ enforce(r.length <= IndexType.max, "Cannot create an index with " ~ -+ "element type " ~ IndexType.stringof ~ " with length " ~ -+ to!string(r.length) ~ "."); - } - -- for (I i = 0; i < r.length; ++i) -+ for (IndexType i = 0; i < r.length; ++i) - { - index[cast(size_t) i] = i; - } - - // sort the index -- bool indirectLess(ElementType!(RangeIndex) a, ElementType!(RangeIndex) b) -- { -- return binaryFun!(less)(r[cast(size_t) a], r[cast(size_t) b]); -- } -- sort!(indirectLess, ss)(index); -+ sort!((a, b) => binaryFun!less(r[cast(size_t) a], r[cast(size_t) b]), ss) -+ (index); - } - - unittest -@@ -9643,8 +10028,8 @@ unittest - // random data - auto b = rndstuff!(string)(); - auto index = new string*[b.length]; -- partialIndex!("std.uni.toUpper(a) < std.uni.toUpper(b)")(b, index); -- assert(isSorted!("std.uni.toUpper(*a) < std.uni.toUpper(*b)")(index)); -+ partialIndex!((a, b) => std.uni.toUpper(a) < std.uni.toUpper(b))(b, index); -+ assert(isSorted!((a, b) => std.uni.toUpper(*a) < std.uni.toUpper(*b))(index)); - - // random data with indexes - auto index1 = new size_t[b.length]; -@@ -9825,30 +10210,8 @@ unittest - { - assert(all!"a & 1"([1, 3, 5, 7, 9])); - assert(!all!"a & 1"([1, 2, 3, 5, 7, 9])); --} -- --// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.canFind. --deprecated("Please use std.range.SortedRange.canFind instead.") --bool canFindSorted(alias pred = "a < b", Range, V)(Range range, V value) { -- return assumeSorted!pred(range).canFind!V(value); --} -- --// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.lowerBound. --deprecated("Please use std.range.SortedRange.lowerBound instead.") --Range lowerBound(alias pred = "a < b", Range, V)(Range range, V value) { -- return assumeSorted!pred(range).lowerBound!V(value).release; --} -- --// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.upperBound. --deprecated("Please use std.range.SortedRange.upperBound instead.") --Range upperBound(alias pred = "a < b", Range, V)(Range range, V value) { -- return assumeSorted!pred(range).upperBound!V(value).release; --} -- --// Deprecated. It will be removed in January 2013. Use std.range.SortedRange.equalRange. --deprecated("Please use std.range.SortedRange.equalRange instead.") --Range equalRange(alias pred = "a < b", Range, V)(Range range, V value) { -- return assumeSorted!pred(range).equalRange!V(value).release; -+ int x = 1; -+ assert(all!(a => a > x)([2, 3])); - } - - /** -@@ -11399,8 +11762,6 @@ unittest - // And therefore, by set comprehension, XY == Expected - } - --// FIXME: this unittest has been disabled because of issue 8542. --version(none) - unittest - { - auto N = sequence!"n"(0); ---- a/src/libphobos/src/std/array.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/array.d 2014-04-01 16:32:51.000000000 +0100 -@@ -23,35 +23,29 @@ Returns a newly-allocated dynamic array - input range, static array, dynamic array, or class or struct with an - $(D opApply) function $(D r). Note that narrow strings are handled as - a special case in an overload. -- --Example: -- --$(D_RUN_CODE --$(ARGS ------ --auto a = array([1, 2, 3, 4, 5][]); --assert(a == [ 1, 2, 3, 4, 5 ]); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - ForeachType!Range[] array(Range)(Range r) --if (isIterable!Range && !isNarrowString!Range) -+if (isIterable!Range && !isNarrowString!Range && !isInfinite!Range) - { - alias ForeachType!Range E; - static if (hasLength!Range) - { - if(r.length == 0) return null; -- -- auto result = uninitializedArray!(Unqual!(E)[])(r.length); -- -+ //@@@BUG@@@ 10928 should be lambda -+ static @trusted nothrow auto trustedAllocateArray(size_t n) -+ { -+ return uninitializedArray!(Unqual!E[])(n); -+ } -+ auto result = trustedAllocateArray(r.length); - size_t i = 0; - foreach (e; r) - { - // hacky -- static if (is(typeof(e.opAssign(e)))) -+ static if (is(typeof(result[i].opAssign(e))) || -+ !is(typeof(result[i] = e))) - { - // this should be in-place construction -- emplace!E(result.ptr + i, e); -+ emplace(result.ptr + i, e); - } - else - { -@@ -72,6 +66,41 @@ if (isIterable!Range && !isNarrowString! - } - } - -+/// -+@safe pure nothrow unittest -+{ -+ auto a = array([1, 2, 3, 4, 5][]); -+ assert(a == [ 1, 2, 3, 4, 5 ]); -+} -+ -+@safe pure nothrow unittest -+{ -+ struct Foo -+ { -+ int a; -+ } -+ auto a = array([Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)][]); -+ assert(equal(a, [Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)])); -+} -+ -+@system unittest -+{ -+ struct Foo -+ { -+ int a; -+ auto opAssign(Foo foo) -+ { -+ assert(0); -+ } -+ auto opEquals(Foo foo) -+ { -+ return a == foo.a; -+ } -+ } -+ auto a = array([Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)][]); -+ assert(equal(a, [Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)])); -+} -+ - /** - Convert a narrow string to an array type that fully supports random access. - This is handled as a special case and always returns a $(D dchar[]), -@@ -151,12 +180,12 @@ unittest - assert(array(b) == a); - - //To verify that the opAssign branch doesn't get screwed up by using Unqual. -+ //EDIT: array no longer calls opAssign. - struct S - { - ref S opAssign(S)(const ref S rhs) - { -- i = rhs.i; -- return this; -+ assert(0); - } - - int i; -@@ -169,26 +198,54 @@ unittest - } - } - -+unittest -+{ -+ //9824 -+ static struct S -+ { -+ @disable void opAssign(S); -+ int i; -+ } -+ auto arr = [S(0), S(1), S(2)]; -+ arr.array(); -+} -+ -+// Bugzilla 10220 -+unittest -+{ -+ import std.algorithm : equal; -+ import std.range : repeat; -+ -+ static struct S -+ { -+ int val; -+ -+ @disable this(); -+ this(int v) { val = v; } -+ } -+ assertCTFEable!( -+ { -+ auto r = S(1).repeat(2).array(); -+ assert(equal(r, [S(1), S(1)])); -+ }); -+} -+ -+unittest -+{ -+ //Turn down infinity: -+ static assert(!is(typeof( -+ repeat(1).array() -+ ))); -+} -+ - /** - Returns a newly allocated associative array out of elements of the input range, - which must be a range of tuples (Key, Value). -- --Example: -- --$(D_RUN_CODE --$(ARGS ------ --auto a = assocArray(zip([0, 1, 2], ["a", "b", "c"])); --assert(a == [0:"a", 1:"b", 2:"c"]); --auto b = assocArray([ tuple("foo", "bar"), tuple("baz", "quux") ]); --assert(b == ["foo":"bar", "baz":"quux"]); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - - auto assocArray(Range)(Range r) -- if (isInputRange!Range && isTuple!(ElementType!Range) -- && ElementType!Range.length == 2) -+ if (isInputRange!Range && isTuple!(ElementType!Range) && -+ ElementType!Range.length == 2) - { - alias ElementType!Range.Types[0] KeyType; - alias ElementType!Range.Types[1] ValueType; -@@ -198,19 +255,24 @@ auto assocArray(Range)(Range r) - return aa; - } - -+/// -+/*@safe*/ pure /*nothrow*/ unittest -+{ -+ auto a = assocArray(zip([0, 1, 2], ["a", "b", "c"])); -+ assert(is(typeof(a) == string[int])); -+ assert(a == [0:"a", 1:"b", 2:"c"]); -+ -+ auto b = assocArray([ tuple("foo", "bar"), tuple("baz", "quux") ]); -+ assert(is(typeof(b) == string[string])); -+ assert(b == ["foo":"bar", "baz":"quux"]); -+} -+ -+/// @@@11053@@@ - Cannot be version(unittest) - recursive instantiation error - unittest - { - static assert(!__traits(compiles, [ tuple("foo", "bar", "baz") ].assocArray())); - static assert(!__traits(compiles, [ tuple("foo") ].assocArray())); -- static assert(__traits(compiles, [ tuple("foo", "bar") ].assocArray())); -- -- auto aa1 = [ tuple("foo", "bar"), tuple("baz", "quux") ].assocArray(); -- assert(is(typeof(aa1) == string[string])); -- assert(aa1 == ["foo":"bar", "baz":"quux"]); -- -- auto aa2 = zip([0, 1, 2], ["a", "b", "c"]).assocArray(); -- assert(is(typeof(aa2) == string[int])); -- assert(aa2 == [0:"a", 1:"b", 2:"c"]); -+ static assert( __traits(compiles, [ tuple("foo", "bar") ].assocArray())); - } - - private template blockAttribute(T) -@@ -224,7 +286,8 @@ private template blockAttribute(T) - enum blockAttribute = GC.BlkAttr.NO_SCAN; - } - } --unittest { -+version(unittest) -+{ - static assert(!(blockAttribute!void & GC.BlkAttr.NO_SCAN)); - } - -@@ -241,7 +304,8 @@ private template nDimensions(T) - } - } - --unittest { -+version(unittest) -+{ - static assert(nDimensions!(uint[]) == 1); - static assert(nDimensions!(float[][]) == 2); - } -@@ -252,19 +316,6 @@ without initializing its elements. This - element will be immediately initialized. $(D T) may be a multidimensional - array. In this case sizes may be specified for any number of dimensions from 1 - to the number in $(D T). -- --Examples: --$(D_RUN_CODE --$(ARGS ----- --double[] arr = uninitializedArray!(double[])(100); --assert(arr.length == 100); -- --double[][] matrix = uninitializedArray!(double[][])(42, 31); --assert(matrix.length == 42); --assert(matrix[0].length == 31); ----- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - auto uninitializedArray(T, I...)(I sizes) - if(allSatisfy!(isIntegral, I)) -@@ -272,6 +323,7 @@ if(allSatisfy!(isIntegral, I)) - return arrayAllocImpl!(false, T, I)(sizes); - } - -+/// - unittest - { - double[] arr = uninitializedArray!(double[])(100); -@@ -293,7 +345,7 @@ if(allSatisfy!(isIntegral, I)) - return arrayAllocImpl!(true, T, I)(sizes); - } - --unittest -+@safe unittest - { - double[] arr = minimallyInitializedArray!(double[])(100); - assert(arr.length == 100); -@@ -318,7 +370,21 @@ if(allSatisfy!(isIntegral, I)) - - alias typeof(T.init[0]) E; - -- auto ptr = cast(E*) GC.malloc(sizes[0] * E.sizeof, blockAttribute!(E)); -+ auto ptr = (__ctfe) ? -+ { -+ static if(__traits(compiles, new E[1])) -+ { -+ return (new E[sizes[0]]).ptr; -+ } -+ else -+ { -+ E[] arr; -+ foreach (i; 0 .. sizes[0]) -+ arr ~= E.init; -+ return arr.ptr; -+ } -+ }() : -+ cast(E*) GC.malloc(sizes[0] * E.sizeof, blockAttribute!(E)); - auto ret = ptr[0..sizes[0]]; - - static if(sizes.length > 1) -@@ -341,16 +407,6 @@ Implements the range interface primitive - arrays. Due to the fact that nonmember functions can be called with - the first argument using the dot notation, $(D array.empty) is - equivalent to $(D empty(array)). -- --Example: --$(D_RUN_CODE --$(ARGS ------ --auto a = [ 1, 2, 3 ]; --assert(!a.empty); --assert(a[3 .. $].empty); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - - @property bool empty(T)(in T[] a) @safe pure nothrow -@@ -358,7 +414,8 @@ assert(a[3 .. $].empty); - return !a.length; - } - --unittest -+/// -+@safe pure nothrow unittest - { - auto a = [ 1, 2, 3 ]; - assert(!a.empty); -@@ -371,16 +428,6 @@ arrays. Due to the fact that nonmember f - the first argument using the dot notation, $(D array.save) is - equivalent to $(D save(array)). The function does not duplicate the - content of the array, it simply returns its argument. -- --Example: --$(D_RUN_CODE --$(ARGS ------ --auto a = [ 1, 2, 3 ]; --auto b = a.save; --assert(b is a); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - - @property T[] save(T)(T[] a) @safe pure nothrow -@@ -388,6 +435,13 @@ assert(b is a); - return a; - } - -+/// -+@safe pure nothrow unittest -+{ -+ auto a = [ 1, 2, 3 ]; -+ auto b = a.save; -+ assert(b is a); -+} - /** - Implements the range interface primitive $(D popFront) for built-in - arrays. Due to the fact that nonmember functions can be called with -@@ -395,41 +449,34 @@ the first argument using the dot notatio - equivalent to $(D popFront(array)). For $(GLOSSARY narrow strings), - $(D popFront) automaticaly advances to the next $(GLOSSARY code - point). -- --Example: --$(D_RUN_CODE --$(ARGS ------ --int[] a = [ 1, 2, 3 ]; --a.popFront(); --assert(a == [ 2, 3 ]); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - --void popFront(A)(ref A a) --if (!isNarrowString!A && isDynamicArray!A && isMutable!A && !is(A == void[])) -+void popFront(T)(ref T[] a) @safe pure nothrow -+if (!isNarrowString!(T[]) && !is(T[] == void[])) - { -- assert(a.length, "Attempting to popFront() past the end of an array of " -- ~ typeof(a[0]).stringof); -+ assert(a.length, "Attempting to popFront() past the end of an array of " ~ T.stringof); - a = a[1 .. $]; - } - --unittest -+/// -+@safe pure nothrow unittest - { - auto a = [ 1, 2, 3 ]; - a.popFront(); - assert(a == [ 2, 3 ]); -- static assert(!__traits(compiles, popFront!(immutable int[])())); -- static assert(!__traits(compiles, popFront!(void[])())); -+} -+ -+version(unittest) -+{ -+ static assert(!is(typeof({ int[4] a; popFront(a); }))); -+ static assert(!is(typeof({ immutable int[] a; popFront(a); }))); -+ static assert(!is(typeof({ void[] a; popFront(a); }))); - } - - // Specialization for narrow strings. The necessity of --// !isStaticArray!A suggests a compiler @@@BUG@@@. --void popFront(S)(ref S str) @trusted pure nothrow --if (isNarrowString!S && isMutable!S && !isStaticArray!S) -+void popFront(C)(ref C[] str) @trusted pure nothrow -+if (isNarrowString!(C[])) - { -- alias ElementEncodingType!S C; - assert(str.length, "Attempting to popFront() past the end of an array of " ~ C.stringof); - - static if(is(Unqual!C == char)) -@@ -460,26 +507,14 @@ if (isNarrowString!S && isMutable!S && ! - else static assert(0, "Bad template constraint."); - } - --version(unittest) C[] _eatString(C)(C[] str) --{ -- while(!str.empty) -- str.popFront(); -- -- return str; --} -- --unittest -+@safe pure unittest - { -- string s1 = "\xC2\xA9hello"; -- s1.popFront(); -- assert(s1 == "hello"); -- wstring s2 = "\xC2\xA9hello"; -- s2.popFront(); -- assert(s2 == "hello"); -- string s3 = "\u20AC100"; -- - foreach(S; TypeTuple!(string, wstring, dstring)) - { -+ S s = "\xC2\xA9hello"; -+ s.popFront(); -+ assert(s == "hello"); -+ - S str = "hello\U00010143\u0100\U00010143"; - foreach(dchar c; ['h', 'e', 'l', 'l', 'o', '\U00010143', '\u0100', '\U00010143']) - { -@@ -487,11 +522,18 @@ unittest - str.popFront(); - } - assert(str.empty); -+ -+ static assert(!is(typeof({ immutable S a; popFront(a); }))); -+ static assert(!is(typeof({ typeof(S.init[0])[4] a; popFront(a); }))); - } - -- static assert(!is(typeof(popFront!(immutable string)))); -- static assert(!is(typeof(popFront!(char[4])))); -+ C[] _eatString(C)(C[] str) -+ { -+ while(!str.empty) -+ str.popFront(); - -+ return str; -+ } - enum checkCTFE = _eatString("ウェブサイト@La_Verité.com"); - static assert(checkCTFE.empty); - enum checkCTFEW = _eatString("ウェブサイト@La_Verité.com"w); -@@ -504,45 +546,39 @@ arrays. Due to the fact that nonmember f - the first argument using the dot notation, $(D array.popBack) is - equivalent to $(D popBack(array)). For $(GLOSSARY narrow strings), $(D - popFront) automaticaly eliminates the last $(GLOSSARY code point). -- -- --Example: --$(D_RUN_CODE --$(ARGS ------ --int[] a = [ 1, 2, 3 ]; --a.popBack(); --assert(a == [ 1, 2 ]); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - --void popBack(A)(ref A a) --if (isDynamicArray!A && !isNarrowString!A && isMutable!A && !is(A == void[])) -+void popBack(T)(ref T[] a) @safe pure nothrow -+if (!isNarrowString!(T[]) && !is(T[] == void[])) - { - assert(a.length); - a = a[0 .. $ - 1]; - } - --unittest -+/// -+@safe pure nothrow unittest - { - auto a = [ 1, 2, 3 ]; - a.popBack(); - assert(a == [ 1, 2 ]); -- static assert(!__traits(compiles, popBack!(immutable int[]))); -- static assert(!__traits(compiles, popBack!(void[]))); -+} -+ -+version(unittest) -+{ -+ static assert(!is(typeof({ immutable int[] a; popBack(a); }))); -+ static assert(!is(typeof({ int[4] a; popBack(a); }))); -+ static assert(!is(typeof({ void[] a; popBack(a); }))); - } - - // Specialization for arrays of char --@trusted void popBack(A)(ref A a) -- if(isNarrowString!A && isMutable!A) -+void popBack(T)(ref T[] a) @safe pure -+if (isNarrowString!(T[])) - { -- assert(a.length, "Attempting to popBack() past the front of an array of " ~ -- typeof(a[0]).stringof); -- a = a[0 .. $ - std.utf.strideBack(a, a.length)]; -+ assert(a.length, "Attempting to popBack() past the front of an array of " ~ T.stringof); -+ a = a[0 .. $ - std.utf.strideBack(a, $)]; - } - --unittest -+@safe pure unittest - { - foreach(S; TypeTuple!(string, wstring, dstring)) - { -@@ -563,7 +599,8 @@ unittest - } - assert(str.empty); - -- static assert(!__traits(compiles, popBack!(immutable S))); -+ static assert(!is(typeof({ immutable S a; popBack(a); }))); -+ static assert(!is(typeof({ typeof(S.init[0])[4] a; popBack(a); }))); - } - } - -@@ -574,34 +611,22 @@ the first argument using the dot notatio - equivalent to $(D front(array)). For $(GLOSSARY narrow strings), $(D - front) automaticaly returns the first $(GLOSSARY code point) as a $(D - dchar). -- -- --Example: --$(D_RUN_CODE --$(ARGS ------ --int[] a = [ 1, 2, 3 ]; --assert(a.front == 1); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ --@property ref T front(T)(T[] a) -+@property ref T front(T)(T[] a) @safe pure nothrow - if (!isNarrowString!(T[]) && !is(T[] == void[])) - { -- assert(a.length, "Attempting to fetch the front of an empty array of " ~ -- typeof(a[0]).stringof); -+ assert(a.length, "Attempting to fetch the front of an empty array of " ~ T.stringof); - return a[0]; - } - --@property dchar front(A)(A a) if (isNarrowString!A) -+/// -+@safe pure nothrow unittest - { -- assert(a.length, "Attempting to fetch the front of an empty array of " ~ -- typeof(a[0]).stringof); -- size_t i = 0; -- return decode(a, i); -+ int[] a = [ 1, 2, 3 ]; -+ assert(a.front == 1); - } - --unittest -+@safe pure nothrow unittest - { - auto a = [ 1, 2 ]; - a.front = 4; -@@ -610,6 +635,16 @@ unittest - - immutable b = [ 1, 2 ]; - assert(b.front == 1); -+ -+ int[2] c = [ 1, 2 ]; -+ assert(c.front == 1); -+} -+ -+@property dchar front(T)(T[] a) @safe pure if (isNarrowString!(T[])) -+{ -+ assert(a.length, "Attempting to fetch the front of an empty array of " ~ T.stringof); -+ size_t i = 0; -+ return decode(a, i); - } - - /** -@@ -619,40 +654,35 @@ the first argument using the dot notatio - equivalent to $(D back(array)). For $(GLOSSARY narrow strings), $(D - back) automaticaly returns the last $(GLOSSARY code point) as a $(D - dchar). -- --Example: --$(D_RUN_CODE --$(ARGS ------ --int[] a = [ 1, 2, 3 ]; --assert(a.back == 3); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ --@property ref T back(T)(T[] a) if (!isNarrowString!(T[])) -+@property ref T back(T)(T[] a) @safe pure nothrow if (!isNarrowString!(T[])) - { -- assert(a.length, "Attempting to fetch the back of an empty array of " ~ -- typeof(a[0]).stringof); -+ assert(a.length, "Attempting to fetch the back of an empty array of " ~ T.stringof); - return a[$ - 1]; - } - --unittest -+/// -+@safe pure nothrow unittest - { - int[] a = [ 1, 2, 3 ]; - assert(a.back == 3); - a.back += 4; - assert(a.back == 7); -+} - -+@safe pure nothrow unittest -+{ - immutable b = [ 1, 2, 3 ]; - assert(b.back == 3); -+ -+ int[3] c = [ 1, 2, 3 ]; -+ assert(c.back == 3); - } - - // Specialization for strings --@property dchar back(A)(A a) -- if(isDynamicArray!A && isNarrowString!A) -+@property dchar back(T)(T[] a) @safe pure if (isNarrowString!(T[])) - { -- assert(a.length, "Attempting to fetch the back of an empty array of " ~ -- typeof(a[0]).stringof); -+ assert(a.length, "Attempting to fetch the back of an empty array of " ~ T.stringof); - size_t i = a.length - std.utf.strideBack(a, a.length); - return decode(a, i); - } -@@ -664,19 +694,6 @@ Returns the overlapping portion, if any, - equal), $(D overlap) only compares the pointers in the ranges, not the - values referred by them. If $(D r1) and $(D r2) have an overlapping - slice, returns that slice. Otherwise, returns the null slice. -- --Example: --$(D_RUN_CODE --$(ARGS ------ --int[] a = [ 10, 11, 12, 13, 14 ]; --int[] b = a[1 .. 3]; --assert(overlap(a, b) == [ 11, 12 ]); --b = b.dup; --// overlap disappears even though the content is the same --assert(overlap(a, b).empty); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow - { -@@ -689,7 +706,18 @@ inout(T)[] overlap(T)(inout(T)[] r1, ino - return b < e ? b[0 .. e - b] : null; - } - --unittest -+/// -+@safe pure /*nothrow*/ unittest -+{ -+ int[] a = [ 10, 11, 12, 13, 14 ]; -+ int[] b = a[1 .. 3]; -+ assert(overlap(a, b) == [ 11, 12 ]); -+ b = b.dup; -+ // overlap disappears even though the content is the same -+ assert(overlap(a, b).empty); -+} -+ -+/*@safe nothrow*/ unittest - { - static void test(L, R)(L l, R r) - { -@@ -716,6 +744,25 @@ unittest - assert(overlap(c, d.idup).empty); - } - -+@safe pure nothrow unittest // bugzilla 9836 -+{ -+ // range primitives for array should work with alias this types -+ struct Wrapper -+ { -+ int[] data; -+ alias data this; -+ -+ @property Wrapper save() { return this; } -+ } -+ auto w = Wrapper([1,2,3,4]); -+ std.array.popFront(w); // should work -+ -+ static assert(isInputRange!Wrapper); -+ static assert(isForwardRange!Wrapper); -+ static assert(isBidirectionalRange!Wrapper); -+ static assert(isRandomAccessRange!Wrapper); -+} -+ - /+ - Commented out until the insert which has been deprecated has been removed. - I'd love to just remove it in favor of insertInPlace, but then code would then -@@ -728,15 +775,12 @@ it's commented out. - must be an input range or a single item) inserted at position $(D pos). - - Examples: --$(D_RUN_CODE --$(ARGS ---------------------- --int[] a = [ 1, 2, 3, 4 ]; --auto b = a.insert(2, [ 1, 2 ]); --assert(a == [ 1, 2, 3, 4 ]); --assert(b == [ 1, 2, 1, 2, 3, 4 ]); ---------------------- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) -+ -------------------- -+ int[] a = [ 1, 2, 3, 4 ]; -+ auto b = a.insert(2, [ 1, 2 ]); -+ assert(a == [ 1, 2, 3, 4 ]); -+ assert(b == [ 1, 2, 1, 2, 3, 4 ]); -+ -------------------- - +/ - T[] insert(T, Range)(T[] array, size_t pos, Range stuff) - if(isInputRange!Range && -@@ -848,17 +892,14 @@ private void copyBackwards(T)(T[] src, T - Inserts $(D stuff) (which must be an input range or any number of - implicitly convertible items) in $(D array) at position $(D pos). - --Example: --$(D_RUN_CODE --$(ARGS ----- --int[] a = [ 1, 2, 3, 4 ]; --a.insertInPlace(2, [ 1, 2 ]); --assert(a == [ 1, 2, 1, 2, 3, 4 ]); --a.insertInPlace(3, 10u, 11); --assert(a == [ 1, 2, 1, 10, 11, 2, 3, 4]); ----- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) -+ Example: -+ --- -+ int[] a = [ 1, 2, 3, 4 ]; -+ a.insertInPlace(2, [ 1, 2 ]); -+ assert(a == [ 1, 2, 1, 2, 3, 4 ]); -+ a.insertInPlace(3, 10u, 11); -+ assert(a == [ 1, 2, 1, 10, 11, 2, 3, 4]); -+ --- - +/ - void insertInPlace(T, U...)(ref T[] array, size_t pos, U stuff) - if(!isSomeString!(T[]) -@@ -1142,14 +1183,13 @@ unittest - - unittest - { -- static int[] testCTFE() -+ assertCTFEable!( - { - int[] a = [1, 2]; - a.insertInPlace(2, 3); - a.insertInPlace(0, -1, 0); -- return a; -- } -- static assert(testCTFE() == [-1, 0, 1, 2, 3]); -+ return a == [-1, 0, 1, 2, 3]; -+ }); - } - - unittest // bugzilla 6874 -@@ -1175,7 +1215,8 @@ unittest // bugzilla 6874 - same place in memory, making one of the arrays a slice of the other which - starts at index $(D 0). - +/ --pure bool sameHead(T)(T[] lhs, T[] rhs) -+@safe -+pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs) - { - return lhs.ptr == rhs.ptr; - } -@@ -1186,12 +1227,13 @@ pure bool sameHead(T)(T[] lhs, T[] rhs) - same place in memory, making one of the arrays a slice of the other which - end at index $(D $). - +/ --pure bool sameTail(T)(T[] lhs, T[] rhs) -+@trusted -+pure nothrow bool sameTail(T)(in T[] lhs, in T[] rhs) - { - return lhs.ptr + lhs.length == rhs.ptr + rhs.length; - } - --unittest -+@safe pure nothrow unittest - { - foreach(T; TypeTuple!(int[], const(int)[], immutable(int)[], const int[], immutable int[])) - { -@@ -1276,7 +1318,7 @@ unittest - Split the string $(D s) into an array of words, using whitespace as - delimiter. Runs of whitespace are merged together (no empty words are produced). - */ --S[] split(S)(S s) if (isSomeString!S) -+S[] split(S)(S s) @safe pure if (isSomeString!S) - { - size_t istart; - bool inword = false; -@@ -1325,23 +1367,21 @@ unittest - - /** - Splits a string by whitespace. -- --Example: --$(D_RUN_CODE --$(ARGS ------ --auto a = " a bcd ef gh "; --assert(equal(splitter(a), ["", "a", "bcd", "ef", "gh"][])); ------ --), $(ARGS), $(ARGS), $(ARGS import std.array, std.algorithm: equal;)) - */ --auto splitter(C)(C[] s) -+auto splitter(C)(C[] s) @safe pure - if(isSomeString!(C[])) - { - return std.algorithm.splitter!(std.uni.isWhite)(s); - } - --unittest -+/// -+@safe pure unittest -+{ -+ auto a = " a bcd ef gh "; -+ assert(equal(splitter(a), ["", "a", "bcd", "ef", "gh"][])); -+} -+ -+/*@safe*/ pure unittest - { - foreach(S; TypeTuple!(string, wstring, dstring)) - { -@@ -1350,9 +1390,6 @@ unittest - a = ""; - assert(splitter(a).empty); - } -- -- immutable string s = " a bcd ef gh "; -- assert(equal(splitter(s), ["", "a", "bcd", "ef", "gh"][])); - } - - /************************************** -@@ -1425,18 +1462,6 @@ unittest - /++ - Concatenates all of the ranges in $(D ror) together into one array using - $(D sep) as the separator if present. -- --Examples: --$(D_RUN_CODE --$(ARGS ---------------------- --assert(join(["hello", "silly", "world"], " ") == "hello silly world"); --assert(join(["hello", "silly", "world"]) == "hellosillyworld"); -- --assert(join([[1, 2, 3], [4, 5]], [72, 73]) == [1, 2, 3, 72, 73, 4, 5]); --assert(join([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]); ---------------------- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - +/ - ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, R sep) - if(isInputRange!RoR && -@@ -1508,8 +1533,8 @@ ElementEncodingType!(ElementType!RoR)[] - return result.data; - } - --//Verify Examples. --unittest -+/// -+@safe pure nothrow unittest - { - assert(join(["hello", "silly", "world"], " ") == "hello silly world"); - assert(join(["hello", "silly", "world"]) == "hellosillyworld"); -@@ -1728,16 +1753,13 @@ until then, it's commented out. - (inclusive) to $(D to) (exclusive) with the range $(D stuff). Returns a new - array without changing the contents of $(D subject). - --Examples: --$(D_RUN_CODE --$(ARGS ---------------------- --auto a = [ 1, 2, 3, 4 ]; --auto b = a.replace(1, 3, [ 9, 9, 9 ]); --assert(a == [ 1, 2, 3, 4 ]); --assert(b == [ 1, 9, 9, 9, 4 ]); ---------------------- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) -+ Examples: -+ -------------------- -+ auto a = [ 1, 2, 3, 4 ]; -+ auto b = a.replace(1, 3, [ 9, 9, 9 ]); -+ assert(a == [ 1, 2, 3, 4 ]); -+ assert(b == [ 1, 9, 9, 9, 4 ]); -+ -------------------- - +/ - T[] replace(T, Range)(T[] subject, size_t from, size_t to, Range stuff) - if(isInputRange!Range && -@@ -1827,15 +1849,12 @@ unittest - (inclusive) to $(D to) (exclusive) with the range $(D stuff). Expands or - shrinks the array as needed. - --Example: --$(D_RUN_CODE --$(ARGS ----- --int[] a = [ 1, 2, 3, 4 ]; --a.replaceInPlace(1, 3, [ 9, 9, 9 ]); --assert(a == [ 1, 9, 9, 9, 4 ]); ----- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) -+ Example: -+ --- -+ int[] a = [ 1, 2, 3, 4 ]; -+ a.replaceInPlace(1, 3, [ 9, 9, 9 ]); -+ assert(a == [ 1, 9, 9, 9, 4 ]); -+ --- - +/ - void replaceInPlace(T, Range)(ref T[] array, size_t from, size_t to, Range stuff) - if(isDynamicArray!Range && -@@ -2057,8 +2076,6 @@ recommended over $(D a ~= data) when app - efficient. - - Example: --$(D_RUN_CODE --$(ARGS - ---- - auto app = appender!string(); - string b = "abcdefg"; -@@ -2071,29 +2088,28 @@ app2.put(3); - app2.put([ 4, 5, 6 ]); - assert(app2.data == [ 1, 2, 3, 4, 5, 6 ]); - ---- --), $(ARGS), $(ARGS), $(ARGS import std.array;)) - */ - struct Appender(A : T[], T) - { - private struct Data - { - size_t capacity; -- Unqual!(T)[] arr; -+ Unqual!T[] arr; - } - - private Data* _data; - --/** --Construct an appender with a given array. Note that this does not copy the --data. If the array has a larger capacity as determined by arr.capacity, --it will be used by the appender. After initializing an appender on an array, --appending to the original array will reallocate. --*/ -- this(T[] arr) -+ /** -+ * Construct an appender with a given array. Note that this does not copy the -+ * data. If the array has a larger capacity as determined by arr.capacity, -+ * it will be used by the appender. After initializing an appender on an array, -+ * appending to the original array will reallocate. -+ */ -+ this(Unqual!T[] arr) @safe pure nothrow - { - // initialize to a given array. - _data = new Data; -- _data.arr = cast(Unqual!(T)[])arr; -+ _data.arr = arr; - - if (__ctfe) - return; -@@ -2101,96 +2117,96 @@ appending to the original array will rea - // We want to use up as much of the block the array is in as possible. - // if we consume all the block that we can, then array appending is - // safe WRT built-in append, and we can use the entire block. -- auto cap = arr.capacity; -- if(cap > arr.length) -- arr.length = cap; -+ auto cap = ()@trusted{ return arr.capacity; }(); -+ if (cap > arr.length) -+ arr = ()@trusted{ return arr.ptr[0 .. cap]; }(); - // we assume no reallocation occurred - assert(arr.ptr is _data.arr.ptr); - _data.capacity = arr.length; - } - --/** --Reserve at least newCapacity elements for appending. Note that more elements --may be reserved than requested. If newCapacity < capacity, then nothing is --done. --*/ -- void reserve(size_t newCapacity) -- { -- if(!_data) -- _data = new Data; -- if(_data.capacity < newCapacity) -- { -- // need to increase capacity -- immutable len = _data.arr.length; -- if (__ctfe) -- { -- _data.arr.length = newCapacity; -- _data.arr = _data.arr[0..len]; -- _data.capacity = newCapacity; -- return; -- } -- immutable growsize = (newCapacity - len) * T.sizeof; -- auto u = GC.extend(_data.arr.ptr, growsize, growsize); -- if(u) -- { -- // extend worked, update the capacity -- _data.capacity = u / T.sizeof; -- } -- else -- { -- // didn't work, must reallocate -- auto bi = GC.qalloc(newCapacity * T.sizeof, -- (typeid(T[]).next.flags & 1) ? 0 : GC.BlkAttr.NO_SCAN); -- _data.capacity = bi.size / T.sizeof; -- if(len) -- memcpy(bi.base, _data.arr.ptr, len * T.sizeof); -- _data.arr = (cast(Unqual!(T)*)bi.base)[0..len]; -- // leave the old data, for safety reasons -- } -- } -- } -- --/** --Returns the capacity of the array (the maximum number of elements the --managed array can accommodate before triggering a reallocation). If any --appending will reallocate, $(D capacity) returns $(D 0). -- */ -- @property size_t capacity() const -+ /** -+ * Reserve at least newCapacity elements for appending. Note that more elements -+ * may be reserved than requested. If newCapacity <= capacity, then nothing is -+ * done. -+ */ -+ void reserve(size_t newCapacity) @safe pure nothrow -+ { -+ immutable cap = _data ? _data.capacity : 0; -+ if (newCapacity > cap) -+ ensureAddable(newCapacity - cap); -+ } -+ -+ /** -+ * Returns the capacity of the array (the maximum number of elements the -+ * managed array can accommodate before triggering a reallocation). If any -+ * appending will reallocate, $(D capacity) returns $(D 0). -+ */ -+ @property size_t capacity() const @safe pure nothrow - { - return _data ? _data.capacity : 0; - } - --/** --Returns the managed array. -- */ -- @property inout(T)[] data() inout -- { -+ /** -+ * Returns the managed array. -+ */ -+ @property inout(T)[] data() inout @trusted pure nothrow -+ { -+ /* @trusted operation: -+ * casting Unqual!T[] to inout(T)[] -+ */ - return cast(typeof(return))(_data ? _data.arr : null); - } - - // ensure we can add nelems elements, resizing as necessary -- private void ensureAddable(size_t nelems) -+ private void ensureAddable(size_t nelems) @safe pure nothrow - { -- if(!_data) -+ static size_t newCapacity(size_t newlength) @safe pure nothrow -+ { -+ long mult = 100 + (1000L) / (bsr(newlength * T.sizeof) + 1); -+ // limit to doubling the length, we don't want to grow too much -+ if(mult > 200) -+ mult = 200; -+ auto newext = cast(size_t)((newlength * mult + 99) / 100); -+ return newext > newlength ? newext : newlength; -+ } -+ -+ if (!_data) - _data = new Data; - immutable len = _data.arr.length; - immutable reqlen = len + nelems; -- if (reqlen > _data.capacity) -+ -+ if (()@trusted{ return _data.capacity; }() >= reqlen) -+ return; -+ -+ // need to increase capacity -+ if (__ctfe) - { -- if (__ctfe) -+ static if (__traits(compiles, new Unqual!T[1])) - { - _data.arr.length = reqlen; -- _data.arr = _data.arr[0..len]; -- _data.capacity = reqlen; -- return; - } -+ else -+ { -+ // avoid restriction of @disable this() -+ ()@trusted{ _data.arr = _data.arr[0 .. _data.capacity]; }(); -+ foreach (i; _data.capacity .. reqlen) -+ _data.arr ~= Unqual!T.init; -+ } -+ _data.arr = _data.arr[0 .. len]; -+ _data.capacity = reqlen; -+ } -+ else -+ { - // Time to reallocate. - // We need to almost duplicate what's in druntime, except we - // have better access to the capacity field. - auto newlen = newCapacity(reqlen); - // first, try extending the current block -- auto u = GC.extend(_data.arr.ptr, nelems * T.sizeof, (newlen - len) * T.sizeof); -- if(u) -+ auto u = ()@trusted{ return -+ GC.extend(_data.arr.ptr, nelems * T.sizeof, (newlen - len) * T.sizeof); -+ }(); -+ if (u) - { - // extend worked, update the capacity - _data.capacity = u / T.sizeof; -@@ -2198,52 +2214,47 @@ Returns the managed array. - else - { - // didn't work, must reallocate -- auto bi = GC.qalloc(newlen * T.sizeof, -- (typeid(T[]).next.flags & 1) ? 0 : GC.BlkAttr.NO_SCAN); -+ auto bi = ()@trusted{ return -+ GC.qalloc(newlen * T.sizeof, (typeid(T[]).next.flags & 1) ? 0 : GC.BlkAttr.NO_SCAN); -+ }(); - _data.capacity = bi.size / T.sizeof; -- if(len) -- memcpy(bi.base, _data.arr.ptr, len * T.sizeof); -- _data.arr = (cast(Unqual!(T)*)bi.base)[0..len]; -+ if (len) -+ ()@trusted{ memcpy(bi.base, _data.arr.ptr, len * T.sizeof); }(); -+ _data.arr = ()@trusted{ return (cast(Unqual!T*)bi.base)[0 .. len]; }(); - // leave the old data, for safety reasons - } - } - } - -- private static size_t newCapacity(size_t newlength) -- { -- long mult = 100 + (1000L) / (bsr(newlength * T.sizeof) + 1); -- // limit to doubling the length, we don't want to grow too much -- if(mult > 200) -- mult = 200; -- auto newext = cast(size_t)((newlength * mult + 99) / 100); -- return newext > newlength ? newext : newlength; -- } -- - private template canPutItem(U) - { -- enum bool canPutItem = isImplicitlyConvertible!(U, T) || -+ enum bool canPutItem = -+ isImplicitlyConvertible!(U, T) || - isSomeChar!T && isSomeChar!U; - } -- - private template canPutConstRange(Range) - { -- enum bool canPutConstRange = isInputRange!(Unqual!Range) && -+ enum bool canPutConstRange = -+ isInputRange!(Unqual!Range) && - !isInputRange!Range; - } -- - private template canPutRange(Range) - { -- enum bool canPutRange = isInputRange!Range && -+ enum bool canPutRange = -+ isInputRange!Range && - is(typeof(Appender.init.put(Range.init.front))); - } - --/** --Appends one item to the managed array. -- */ -+ /** -+ * Appends one item to the managed array. -+ */ - void put(U)(U item) if (canPutItem!U) - { - static if (isSomeChar!T && isSomeChar!U && T.sizeof < U.sizeof) - { -+ /* may throwable operation: -+ * - std.utf.encode -+ */ - // must do some transcoding around here - Unqual!T[T.sizeof == 1 ? 4 : 2] encoded; - auto len = std.utf.encode(encoded, item); -@@ -2253,8 +2264,14 @@ Appends one item to the managed array. - { - ensureAddable(1); - immutable len = _data.arr.length; -- _data.arr.ptr[len] = cast(Unqual!T)item; -- _data.arr = _data.arr.ptr[0 .. len + 1]; -+ //_data.arr.ptr[len] = cast(Unqual!T)item; // assign? emplace? -+ //_data.arr = _data.arr.ptr[0 .. len + 1]; -+ -+ // Cannot return ref because it doesn't work in CTFE -+ ()@trusted{ return _data.arr.ptr[len .. len + 1]; }()[0] -+ = // assign? emplace? -+ ()@trusted{ return cast(Unqual!T)item; } (); -+ ()@trusted{ _data.arr = _data.arr.ptr[0 .. len + 1]; }(); - } - } - -@@ -2265,25 +2282,23 @@ Appends one item to the managed array. - p(items); - } - --/** --Appends an entire range to the managed array. -- */ -+ /** -+ * Appends an entire range to the managed array. -+ */ - void put(Range)(Range items) if (canPutRange!Range) - { - // note, we disable this branch for appending one type of char to - // another because we can't trust the length portion. - static if (!(isSomeChar!T && isSomeChar!(ElementType!Range) && -- !is(Range == Unqual!T[]) && -- !is(Range == const(T)[]) && -- !is(Range == immutable(T)[])) && -+ !is(immutable Range == immutable T[])) && - is(typeof(items.length) == size_t)) - { - // optimization -- if this type is something other than a string, - // and we are adding exactly one element, call the version for one - // element. -- static if(!isSomeChar!T) -+ static if (!isSomeChar!T) - { -- if(items.length == 1) -+ if (items.length == 1) - { - put(items.front); - return; -@@ -2294,15 +2309,22 @@ Appends an entire range to the managed a - ensureAddable(items.length); - immutable len = _data.arr.length; - immutable newlen = len + items.length; -- _data.arr = _data.arr.ptr[0..newlen]; -- static if(is(typeof(_data.arr[] = items[]))) -+ _data.arr = ()@trusted{ return _data.arr.ptr[0 .. newlen]; }(); -+ static if (is(typeof(_data.arr[] = items[]))) - { -- _data.arr.ptr[len..newlen] = items[]; -+ ()@trusted{ return _data.arr.ptr[len .. newlen]; }()[] = items[]; - } - else - { -- for(size_t i = len; !items.empty; items.popFront(), ++i) -- _data.arr.ptr[i] = cast(Unqual!T)items.front; -+ for (size_t i = len; !items.empty; items.popFront(), ++i) -+ { -+ //_data.arr.ptr[i] = cast(Unqual!T)items.front; -+ -+ // Cannot return ref because it doesn't work in CTFE -+ ()@trusted{ return _data.arr.ptr[i .. i + 1]; }()[0] -+ = // assign? emplace? -+ ()@trusted{ return cast(Unqual!T)items.front; }(); -+ } - } - } - else -@@ -2316,9 +2338,9 @@ Appends an entire range to the managed a - } - } - --/** --Appends one item to the managed array. -- */ -+ /** -+ * Appends one item to the managed array. -+ */ - void opOpAssign(string op : "~", U)(U item) if (canPutItem!U) - { - put(item); -@@ -2330,42 +2352,43 @@ Appends one item to the managed array. - put(items); - } - --/** --Appends an entire range to the managed array. -- */ -+ /** -+ * Appends an entire range to the managed array. -+ */ - void opOpAssign(string op : "~", Range)(Range items) if (canPutRange!Range) - { - put(items); - } - - // only allow overwriting data on non-immutable and non-const data -- static if(!is(T == immutable) && !is(T == const)) -+ static if (isMutable!T) - { --/** --Clears the managed array. This allows the elements of the array to be reused --for appending. -- --Note that clear is disabled for immutable or const element types, due to the --possibility that $(D Appender) might overwrite immutable data. --*/ -- void clear() -+ /** -+ * Clears the managed array. This allows the elements of the array to be reused -+ * for appending. -+ * -+ * Note that clear is disabled for immutable or const element types, due to the -+ * possibility that $(D Appender) might overwrite immutable data. -+ */ -+ void clear() @safe pure nothrow - { - if (_data) - { -- _data.arr = _data.arr.ptr[0..0]; -+ _data.arr = ()@trusted{ return _data.arr.ptr[0 .. 0]; }(); - } - } - --/** --Shrinks the managed array to the given length. Passing in a length that's --greater than the current array length throws an enforce exception. --*/ -- void shrinkTo(size_t newlength) -+ /** -+ * Shrinks the managed array to the given length. -+ * -+ * Throws: $(D Exception) if newlength is greater than the current array length. -+ */ -+ void shrinkTo(size_t newlength) @safe pure - { -- if(_data) -+ if (_data) - { - enforce(newlength <= _data.arr.length); -- _data.arr = _data.arr.ptr[0..newlength]; -+ _data.arr = ()@trusted{ return _data.arr.ptr[0 .. newlength]; }(); - } - else - enforce(newlength == 0); -@@ -2374,10 +2397,10 @@ greater than the current array length th - } - - /** --An appender that can update an array in-place. It forwards all calls to an --underlying appender implementation. Any calls made to the appender also update --the pointer to the original array passed in. --*/ -+ * An appender that can update an array in-place. It forwards all calls to an -+ * underlying appender implementation. Any calls made to the appender also update -+ * the pointer to the original array passed in. -+ */ - struct RefAppender(A : T[], T) - { - private -@@ -2386,16 +2409,16 @@ struct RefAppender(A : T[], T) - T[] *arr; - } - --/** --Construct a ref appender with a given array reference. This does not copy the --data. If the array has a larger capacity as determined by arr.capacity, it --will be used by the appender. $(D RefAppender) assumes that arr is a non-null --value. -- --Note, do not use builtin appending (i.e. ~=) on the original array passed in --until you are done with the appender, because calls to the appender override --those appends. --*/ -+ /** -+ * Construct a ref appender with a given array reference. This does not copy the -+ * data. If the array has a larger capacity as determined by arr.capacity, it -+ * will be used by the appender. $(D RefAppender) assumes that arr is a non-null -+ * value. -+ * -+ * Note, do not use builtin appending (i.e. ~=) on the original array passed in -+ * until you are done with the appender, because calls to the appender override -+ * those appends. -+ */ - this(T[] *arr) - { - impl = Appender!(A, T)(*arr); -@@ -2411,9 +2434,9 @@ those appends. - - private alias Appender!(A, T) AppenderType; - --/** --Appends one item to the managed array. -- */ -+ /** -+ * Appends one item to the managed array. -+ */ - void opOpAssign(string op : "~", U)(U item) if (AppenderType.canPutItem!U) - { - scope(exit) *this.arr = impl.data; -@@ -2427,28 +2450,28 @@ Appends one item to the managed array. - impl.put(items); - } - --/** --Appends an entire range to the managed array. -- */ -+ /** -+ * Appends an entire range to the managed array. -+ */ - void opOpAssign(string op : "~", Range)(Range items) if (AppenderType.canPutRange!Range) - { - scope(exit) *this.arr = impl.data; - impl.put(items); - } - --/** --Returns the capacity of the array (the maximum number of elements the --managed array can accommodate before triggering a reallocation). If any --appending will reallocate, $(D capacity) returns $(D 0). -- */ -+ /** -+ * Returns the capacity of the array (the maximum number of elements the -+ * managed array can accommodate before triggering a reallocation). If any -+ * appending will reallocate, $(D capacity) returns $(D 0). -+ */ - @property size_t capacity() const - { - return impl.capacity; - } - --/** --Returns the managed array. -- */ -+ /** -+ * Returns the managed array. -+ */ - @property inout(T)[] data() inout - { - return impl.data; -@@ -2456,15 +2479,30 @@ Returns the managed array. - } - - /++ -- Convenience function that returns an $(D Appender!(A)) object initialized -+ Convenience function that returns an $(D Appender!A) object initialized - with $(D array). - +/ --Appender!(E[]) appender(A : E[], E)(A array = null) -+Appender!(E[]) appender(A : E[], E)() -+{ -+ return Appender!(E[])(null); -+} -+/// ditto -+Appender!(E[]) appender(A : E[], E)(A array) - { -- return Appender!(E[])(array); -+ static if (isMutable!E) -+ { -+ return Appender!(E[])(array); -+ } -+ else -+ { -+ /* @system operation: -+ * - casting array to Unqual!E[] (remove qualifiers) -+ */ -+ return Appender!(E[])(cast(Unqual!E[])array); -+ } - } - --unittest -+@safe pure nothrow unittest - { - { - auto app = appender!(char[])(); -@@ -2501,7 +2539,11 @@ unittest - app2.reserve(5); - assert(app2.capacity >= 5); - -- app2.shrinkTo(3); -+ try // shrinkTo may throw -+ { -+ app2.shrinkTo(3); -+ } -+ catch (Exception) assert(0); - assert(app2.data == [ 1, 2, 3 ]); - assertThrown(app2.shrinkTo(5)); - -@@ -2510,40 +2552,110 @@ unittest - assert(app3.data == [1, 2, 3]); - - auto app4 = appender([]); -- app4.shrinkTo(0); -+ try // shrinkTo may throw -+ { -+ app4.shrinkTo(0); -+ } -+ catch (Exception) assert(0); - -- // Issue 5663 tests -+ // Issue 5663 & 9725 tests -+ foreach (S; TypeTuple!(char[], const(char)[], string)) - { -- Appender!(char[]) app5663i; -- assertNotThrown(app5663i.put("\xE3")); -- assert(app5663i.data == "\xE3"); -+ { -+ Appender!S app5663i; -+ assertNotThrown(app5663i.put("\xE3")); -+ assert(app5663i.data == "\xE3"); -+ -+ Appender!S app5663c; -+ assertNotThrown(app5663c.put(cast(const(char)[])"\xE3")); -+ assert(app5663c.data == "\xE3"); - -- Appender!(char[]) app5663c; -- assertNotThrown(app5663c.put(cast(const(char)[])"\xE3")); -- assert(app5663c.data == "\xE3"); -+ Appender!S app5663m; -+ assertNotThrown(app5663m.put("\xE3".dup)); -+ assert(app5663m.data == "\xE3"); -+ } -+ // ditto for ~= -+ { -+ Appender!S app5663i; -+ assertNotThrown(app5663i ~= "\xE3"); -+ assert(app5663i.data == "\xE3"); - -- Appender!(char[]) app5663m; -- assertNotThrown(app5663m.put(cast(char[])"\xE3")); -- assert(app5663m.data == "\xE3"); -+ Appender!S app5663c; -+ assertNotThrown(app5663c ~= cast(const(char)[])"\xE3"); -+ assert(app5663c.data == "\xE3"); -+ -+ Appender!S app5663m; -+ assertNotThrown(app5663m ~= "\xE3".dup); -+ assert(app5663m.data == "\xE3"); -+ } - } -- // ditto for ~= -+ -+ static struct S10122 - { -- Appender!(char[]) app5663i; -- assertNotThrown(app5663i ~= "\xE3"); -- assert(app5663i.data == "\xE3"); -+ int val; - -- Appender!(char[]) app5663c; -- assertNotThrown(app5663c ~= cast(const(char)[])"\xE3"); -- assert(app5663c.data == "\xE3"); -+ @disable this(); -+ this(int v) @safe pure nothrow { val = v; } -+ } -+ assertCTFEable!( -+ { -+ auto w = appender!(S10122[])(); -+ w.put(S10122(1)); -+ assert(w.data.length == 1 && w.data[0].val == 1); -+ }); -+} -+ -+@safe pure nothrow unittest -+{ -+ { -+ auto w = appender!string(); -+ w.reserve(4); -+ w.capacity; -+ w.data; -+ try -+ { -+ wchar wc = 'a'; -+ dchar dc = 'a'; -+ w.put(wc); // decoding may throw -+ w.put(dc); // decoding may throw -+ } -+ catch (Exception) assert(0); -+ } -+ { -+ auto w = appender!(int[])(); -+ w.reserve(4); -+ w.capacity; -+ w.data; -+ w.put(10); -+ w.put([10]); -+ w.clear(); -+ try -+ { -+ w.shrinkTo(0); -+ } -+ catch (Exception) assert(0); -+ -+ struct N -+ { -+ int payload; -+ alias payload this; -+ } -+ w.put(N(1)); -+ w.put([N(2)]); - -- Appender!(char[]) app5663m; -- assertNotThrown(app5663m ~= cast(char[])"\xE3"); -- assert(app5663m.data == "\xE3"); -+ struct S(T) -+ { -+ @property bool empty() { return true; } -+ @property T front() { return T.init; } -+ void popFront() {} -+ } -+ S!int r; -+ w.put(r); - } - } - - /++ -- Convenience function that returns a $(D RefAppender!(A)) object initialized -+ Convenience function that returns a $(D RefAppender!A) object initialized - with $(D array). Don't use null for the $(D array) pointer, use the other - version of $(D appender) instead. - +/ -@@ -2593,7 +2705,11 @@ unittest - app2.reserve(5); - assert(app2.capacity >= 5); - -- app2.shrinkTo(3); -+ try // shrinkTo may throw -+ { -+ app2.shrinkTo(3); -+ } -+ catch (Exception) assert(0); - assert(app2.data == [ 1, 2, 3 ]); - assertThrown(app2.shrinkTo(5)); - ---- a/src/libphobos/src/std/ascii.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/ascii.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,11 +3,12 @@ - /++ - Functions which operate on ASCII characters. - -- All of the functions in std.ascii accept unicode characters but effectively -- ignore them. All $(D isX) functions return $(D false) for unicode -- characters, and all $(D toX) functions do nothing to unicode characters. -+ All of the functions in std.ascii accept Unicode characters but effectively -+ ignore them if they're not ASCII. All $(D isX) functions return $(D false) -+ for non-ASCII characters, and all $(D toX) functions do nothing to non-ASCII -+ characters. - -- For functions which operate on unicode characters, see -+ For functions which operate on Unicode characters, see - $(LINK2 std_uni.html, std.uni). - - References: -@@ -17,26 +18,40 @@ - Macros: - WIKI=Phobos/StdASCII - -- Copyright: Copyright 2000 - -+ Copyright: Copyright 2000 - 2013 - License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). - Authors: $(WEB digitalmars.com, Walter Bright) and Jonathan M Davis - Source: $(PHOBOSSRC std/_ascii.d) - +/ - module std.ascii; - --version(unittest) import std.range; -+version (unittest) -+{ -+ // FIXME: When dmd bug #314 is fixed, make these selective. -+ import std.range; // : chain; -+ import std.traits; // : functionAttributes, FunctionAttribute, isSafe; -+ import std.typetuple; // : TypeTuple; -+} - - - immutable hexDigits = "0123456789ABCDEF"; /// 0..9A..F -+immutable lowerHexDigits = "0123456789abcdef"; /// 0..9a..f - immutable fullHexDigits = "0123456789ABCDEFabcdef"; /// 0..9A..Fa..f - immutable digits = "0123456789"; /// 0..9 - immutable octalDigits = "01234567"; /// 0..7 - immutable lowercase = "abcdefghijklmnopqrstuvwxyz"; /// a..z --immutable letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ~ -- "abcdefghijklmnopqrstuvwxyz"; /// A..Za..z - immutable uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /// A..Z -+immutable letters = uppercase ~ lowercase; /// A..Za..z - immutable whitespace = " \t\v\r\n\f"; /// ASCII whitespace - -+/** -+Letter case specifier. -+ */ -+enum LetterCase : bool -+{ -+ upper, /// Upper case letters -+ lower /// Lower case letters -+} - - version(Windows) - { -@@ -207,7 +222,7 @@ bool isControl(dchar c) @safe pure nothr - - unittest - { -- foreach(dchar c; iota(0, 32)) -+ foreach(dchar c; 0 .. 32) - assert(isControl(c)); - assert(isControl(127)); - -@@ -227,7 +242,7 @@ bool isPunctuation(dchar c) @safe pure n - - unittest - { -- foreach(dchar c; iota(0, 128)) -+ foreach(dchar c; 0 .. 128) - { - if(isControl(c) || isAlphaNum(c) || c == ' ') - assert(!isPunctuation(c)); -@@ -248,7 +263,7 @@ bool isGraphical(dchar c) @safe pure not - - unittest - { -- foreach(dchar c; iota(0, 128)) -+ foreach(dchar c; 0 .. 128) - { - if(isControl(c) || c == ' ') - assert(!isGraphical(c)); -@@ -257,6 +272,7 @@ unittest - } - } - -+ - /++ - Whether or not $(D c) is a printable character - including the space - character. -@@ -268,7 +284,7 @@ bool isPrintable(dchar c) @safe pure not - - unittest - { -- foreach(dchar c; iota(0, 128)) -+ foreach(dchar c; 0 .. 128) - { - if(isControl(c)) - assert(!isPrintable(c)); -@@ -289,7 +305,7 @@ bool isASCII(dchar c) @safe pure nothrow - - unittest - { -- foreach(dchar c; iota(0, 128)) -+ foreach(dchar c; 0 .. 128) - assert(isASCII(c)); - - assert(!isASCII(128)); -@@ -299,26 +315,48 @@ unittest - /++ - If $(D c) is an uppercase ASCII character, then its corresponding lowercase - letter is returned. Otherwise, $(D c) is returned. -+ -+ $(D C) can be any type which implicitly converts to $(D dchar). In the case -+ where it's a built-in type, or an enum of a built-in type, -+ $(D Unqual!(OriginalType!C)) is returned, whereas if it's a user-defined -+ type, $(D dchar) is returned. - +/ --dchar toLower(dchar c) @safe pure nothrow --out(result) --{ -- assert(!isUpper(result)); --} --body -+auto toLower(C)(C c) -+ if(is(C : dchar)) - { -- return isUpper(c) ? c + cast(dchar)('a' - 'A') : c; -+ import std.traits : isAggregateType, OriginalType, Unqual; -+ -+ alias OC = OriginalType!C; -+ static if (isAggregateType!OC) -+ alias R = dchar; -+ else -+ alias R = Unqual!OC; -+ -+ return isUpper(c) ? cast(R)(cast(R)c + 'a' - 'A') : cast(R)c; - } - --unittest -+@safe pure nothrow unittest - { -- foreach(i, c; uppercase) -- assert(toLower(c) == lowercase[i]); - -- foreach(dchar c; iota(0, 128)) -+ foreach(C; TypeTuple!(char, wchar, dchar, immutable char, ubyte)) - { -- if(c < 'A' || c > 'Z') -+ foreach(i, c; uppercase) -+ assert(toLower(cast(C)c) == lowercase[i]); -+ -+ foreach(C c; 0 .. 128) -+ { -+ if(c < 'A' || c > 'Z') -+ assert(toLower(c) == c); -+ else -+ assert(toLower(c) != c); -+ } -+ -+ foreach(C c; 128 .. C.max) - assert(toLower(c) == c); -+ -+ //CTFE -+ static assert(toLower(cast(C)'a') == 'a'); -+ static assert(toLower(cast(C)'A') == 'a'); - } - } - -@@ -326,29 +364,105 @@ unittest - /++ - If $(D c) is a lowercase ASCII character, then its corresponding uppercase - letter is returned. Otherwise, $(D c) is returned. -+ -+ $(D C) can be any type which implicitly converts to $(D dchar). In the case -+ where it's a built-in type, or an enum of a built-in type, -+ $(D Unqual!(OriginalType!C)) is returned, whereas if it's a user-defined -+ type, $(D dchar) is returned. - +/ --dchar toUpper(dchar c) @safe pure nothrow --out(result) -+auto toUpper(C)(C c) -+ if(is(C : dchar)) - { -- assert(!isLower(result)); -+ import std.traits : isAggregateType, OriginalType, Unqual; -+ -+ alias OC = OriginalType!C; -+ static if (isAggregateType!OC) -+ alias R = dchar; -+ else -+ alias R = Unqual!OC; -+ -+ return isLower(c) ? cast(R)(cast(R)c - ('a' - 'A')) : cast(R)c; - } --body -+ -+@safe pure nothrow unittest - { -- return isLower(c) ? c - cast(dchar)('a' - 'A') : c; -+ foreach(C; TypeTuple!(char, wchar, dchar, immutable char, ubyte)) -+ { -+ foreach(i, c; lowercase) -+ assert(toUpper(cast(C)c) == uppercase[i]); -+ -+ foreach(C c; 0 .. 128) -+ { -+ if(c < 'a' || c > 'z') -+ assert(toUpper(c) == c); -+ else -+ assert(toUpper(c) != c); -+ } -+ -+ foreach(C c; 128 .. C.max) -+ assert(toUpper(c) == c); -+ -+ //CTFE -+ static assert(toUpper(cast(C)'a') == 'A'); -+ static assert(toUpper(cast(C)'A') == 'A'); -+ } - } - --unittest -+ -+unittest //Test both toUpper and toLower with non-builtin - { -- foreach(i, c; lowercase) -- assert(toUpper(c) == uppercase[i]); -+ //User Defined [Char|Wchar|Dchar] -+ static struct UDC { char c; alias c this; } -+ static struct UDW { wchar c; alias c this; } -+ static struct UDD { dchar c; alias c this; } -+ //[Char|Wchar|Dchar] Enum -+ enum CE : char {a = 'a', A = 'A'} -+ enum WE : wchar {a = 'a', A = 'A'} -+ enum DE : dchar {a = 'a', A = 'A'} -+ //User Defined [Char|Wchar|Dchar] Enum -+ enum UDCE : UDC {a = UDC('a'), A = UDC('A')} -+ enum UDWE : UDW {a = UDW('a'), A = UDW('A')} -+ enum UDDE : UDD {a = UDD('a'), A = UDD('A')} - -- foreach(dchar c; iota(0, 128)) -+ //User defined types with implicit cast to dchar test. -+ foreach (Char; TypeTuple!(UDC, UDW, UDD)) - { -- if(c < 'a' || c > 'z') -- assert(toUpper(c) == c); -+ assert(toLower(Char('a')) == 'a'); -+ assert(toLower(Char('A')) == 'a'); -+ static assert(toLower(Char('a')) == 'a'); -+ static assert(toLower(Char('A')) == 'a'); -+ static assert(toUpper(Char('a')) == 'A'); -+ static assert(toUpper(Char('A')) == 'A'); -+ } -+ -+ //Various enum tests. -+ foreach (Enum; TypeTuple!(CE, WE, DE, UDCE, UDWE, UDDE)) -+ { -+ assert(toLower(Enum.a) == 'a'); -+ assert(toLower(Enum.A) == 'a'); -+ assert(toUpper(Enum.a) == 'A'); -+ assert(toUpper(Enum.A) == 'A'); -+ static assert(toLower(Enum.a) == 'a'); -+ static assert(toLower(Enum.A) == 'a'); -+ static assert(toUpper(Enum.a) == 'A'); -+ static assert(toUpper(Enum.A) == 'A'); - } --} - -+ //Return value type tests for enum of non-UDT. These should be the original type. -+ foreach (T; TypeTuple!(CE, WE, DE)) -+ { -+ alias C = OriginalType!T; -+ static assert(is(typeof(toLower(T.init)) == C)); -+ static assert(is(typeof(toUpper(T.init)) == C)); -+ } -+ -+ //Return value tests for UDT and enum of UDT. These should be dchar -+ foreach (T; TypeTuple!(UDC, UDW, UDD, UDCE, UDWE, UDDE)) -+ { -+ static assert(is(typeof(toLower(T.init)) == dchar)); -+ static assert(is(typeof(toUpper(T.init)) == dchar)); -+ } -+} - - //============================================================================== - // Private Section. -@@ -357,35 +471,34 @@ private: - - enum - { -- _SPC = 8, -- _CTL = 0x20, -- _BLK = 0x40, -- _HEX = 0x80, -- _UC = 1, -- _LC = 2, -- _PNC = 0x10, -- _DIG = 4, -- _ALP = _UC|_LC, -+ _UC = 0x01, -+ _LC = 0x02, -+ _DIG = 0x04, -+ _SPC = 0x08, -+ _PNC = 0x10, -+ _CTL = 0x20, -+ _BLK = 0x40, -+ _HEX = 0x80, -+ _ALP = _UC | _LC, - } - --immutable ubyte _ctype[128] = -+immutable ubyte[128] _ctype = - [ -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _CTL,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL,_CTL, -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _SPC|_BLK,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -- _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -- _PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC, -- _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -- _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -- _UC,_UC,_UC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC, -- _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -- _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -- _LC,_LC,_LC,_PNC,_PNC,_PNC,_PNC,_CTL -+ _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -+ _CTL,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL,_CTL, -+ _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -+ _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -+ _SPC|_BLK,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -+ _PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -+ _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -+ _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -+ _PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -+ _PNC,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC, -+ _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -+ _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -+ _UC,_UC,_UC,_PNC,_PNC,_PNC,_PNC,_PNC, -+ _PNC,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC, -+ _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -+ _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -+ _LC,_LC,_LC,_PNC,_PNC,_PNC,_PNC,_CTL - ]; -- ---- a/src/libphobos/src/std/base64.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/base64.d 2014-04-01 16:32:51.000000000 +0100 -@@ -6,40 +6,35 @@ - * Implemented according to $(WEB tools.ietf.org/html/rfc4648, - * RFC 4648 - The Base16, Base32, and Base64 Data Encodings). - * --* Example: -- * $(D_RUN_CODE -- * $(ARGS -+ * Example: - * ----- -- *ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; -+ * ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; - * -- *const(char)[] encoded = Base64.encode(data); -- *assert(encoded == "FPucA9l+"); -+ * const(char)[] encoded = Base64.encode(data); -+ * assert(encoded == "FPucA9l+"); - * -- *ubyte[] decoded = Base64.decode("FPucA9l+"); -- *assert(decoded == [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]); -+ * ubyte[] decoded = Base64.decode("FPucA9l+"); -+ * assert(decoded == [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]); - * ----- -- * ), $(ARGS), $(ARGS), $(ARGS import std.base64;)) -+ * - * Support Range interface using Encoder / Decoder. - * - * Example: -- * $(D_RUN_CODE -- * $(ARGS - * ----- - * // Create MIME Base64 with CRLF, per line 76. -- *File f = File("./text.txt", "r"); -- *scope(exit) f.close(); -+ * File f = File("./text.txt", "r"); -+ * scope(exit) f.close(); - * -- *Appender!string mime64 = appender!string; -+ * Appender!string mime64 = appender!string; - * -- *foreach (encoded; Base64.encoder(f.byChunk(57))) -- *{ -- * mime64.put(encoded); -- * mime64.put("\r\n"); -- *} -+ * foreach (encoded; Base64.encoder(f.byChunk(57))) -+ * { -+ * mime64.put(encoded); -+ * mime64.put("\r\n"); -+ * } - * -- *writeln(mime64.data); -+ * writeln(mime64.data); - * ----- -- *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.array, std.stdio: File, writeln;)) - * - * Copyright: Masahiro Nakagawa 2010-. - * License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). -@@ -134,7 +129,7 @@ template Base64Impl(char Map62th, char M - * - * Params: - * source = an $(D InputRange) to encode. -- * range = a buffer to store encoded result. -+ * buffer = a buffer to store encoded result. - * - * Returns: - * the encoded string that slices buffer. -@@ -459,7 +454,7 @@ template Base64Impl(char Map62th, char M - * true if there are no more elements to be iterated. - */ - @property @trusted -- bool empty() const -+ bool empty() - { - return range_.empty; - } -@@ -486,7 +481,7 @@ template Base64Impl(char Map62th, char M - */ - void popFront() - { -- enforce(!empty, "Cannot call popFront on Encoder with no data remaining"); -+ enforce(!empty, new Base64Exception("Cannot call popFront on Encoder with no data remaining")); - - range_.popFront(); - -@@ -597,7 +592,7 @@ template Base64Impl(char Map62th, char M - */ - void popFront() - { -- enforce(!empty, "Cannot call popFront on Encoder with no data remaining"); -+ enforce(!empty, new Base64Exception("Cannot call popFront on Encoder with no data remaining")); - - static if (Padding != NoPadding) - if (padding) { -@@ -672,36 +667,30 @@ template Base64Impl(char Map62th, char M - * Default $(D Encoder) encodes chunk data. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * ----- -- *File f = File("text.txt", "r"); -- *scope(exit) f.close(); -+ * File f = File("text.txt", "r"); -+ * scope(exit) f.close(); - * -- *uint line = 0; -- *foreach (encoded; Base64.encoder(f.byLine())) -- *{ -- * writeln(++line, ". ", encoded); -- *} -+ * uint line = 0; -+ * foreach (encoded; Base64.encoder(f.byLine())) -+ * { -+ * writeln(++line, ". ", encoded); -+ * } - * ----- -- *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: File, writeln;)) - * - * In addition, You can use $(D Encoder) that returns encoded single character. - * This $(D Encoder) performs Range-based and lazy encoding. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * ----- -- *ubyte[] data = cast(ubyte[]) "0123456789"; -+ * ubyte[] data = cast(ubyte[]) "0123456789"; - * - * // The ElementType of data is not aggregation type -- *foreach (encoded; Base64.encoder(data)) -- *{ -- * writeln(encoded); -- *} -+ * foreach (encoded; Base64.encoder(data)) -+ * { -+ * writeln(encoded); -+ * } - * ----- -- *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: writeln;)) - * - * Params: - * range = an $(D InputRange) to iterate. -@@ -806,6 +795,8 @@ template Base64Impl(char Map62th, char M - immutable srcLen = source.length; - if (srcLen == 0) - return []; -+ static if (Padding != NoPadding) -+ enforce(srcLen % 4 == 0, new Base64Exception("Invalid length of encoded data")); - - immutable blocks = srcLen / 4; - auto srcptr = source.ptr; -@@ -872,6 +863,8 @@ template Base64Impl(char Map62th, char M - immutable srcLen = source.length; - if (srcLen == 0) - return []; -+ static if (Padding != NoPadding) -+ enforce(srcLen % 4 == 0, new Base64Exception("Invalid length of encoded data")); - - immutable blocks = srcLen / 4; - auto bufptr = buffer.ptr; -@@ -948,6 +941,8 @@ template Base64Impl(char Map62th, char M - immutable srcLen = source.length; - if (srcLen == 0) - return 0; -+ static if (Padding != NoPadding) -+ enforce(srcLen % 4 == 0, new Base64Exception("Invalid length of encoded data")); - - immutable blocks = srcLen / 4; - auto srcptr = source.ptr; -@@ -1016,6 +1011,8 @@ template Base64Impl(char Map62th, char M - immutable srcLen = source.length; - if (srcLen == 0) - return 0; -+ static if (Padding != NoPadding) -+ enforce(srcLen % 4 == 0, new Base64Exception("Invalid length of encoded data")); - - immutable blocks = srcLen / 4; - size_t pcount; -@@ -1117,7 +1114,7 @@ template Base64Impl(char Map62th, char M - * true if there are no more elements to be iterated. - */ - @property @trusted -- bool empty() const -+ bool empty() - { - return range_.empty; - } -@@ -1144,7 +1141,7 @@ template Base64Impl(char Map62th, char M - */ - void popFront() - { -- enforce(!empty, "Cannot call popFront on Decoder with no data remaining."); -+ enforce(!empty, new Base64Exception("Cannot call popFront on Decoder with no data remaining.")); - - range_.popFront(); - -@@ -1222,7 +1219,7 @@ template Base64Impl(char Map62th, char M - range_ = range_.save; - - static if (Padding != NoPadding && hasLength!Range) -- enforce(range_.length % 4 == 0); -+ enforce(range_.length % 4 == 0, new Base64Exception("Invalid length of encoded data")); - - if (range_.empty) - pos = -1; -@@ -1265,7 +1262,7 @@ template Base64Impl(char Map62th, char M - */ - void popFront() - { -- enforce(!empty, "Cannot call popFront on Decoder with no data remaining"); -+ enforce(!empty, new Base64Exception("Cannot call popFront on Decoder with no data remaining")); - - static if (Padding == NoPadding) { - bool endCondition() -@@ -1275,7 +1272,7 @@ template Base64Impl(char Map62th, char M - } else { - bool endCondition() - { -- enforce(!range_.empty, "Missing padding"); -+ enforce(!range_.empty, new Base64Exception("Missing padding")); - return range_.front == Padding; - } - } -@@ -1287,12 +1284,12 @@ template Base64Impl(char Map62th, char M - - final switch (pos) { - case 0: -- enforce(!endCondition(), "Premature end of data found"); -+ enforce(!endCondition(), new Base64Exception("Premature end of data found")); - - immutable t = DecodeMap[range_.front] << 2; - range_.popFront(); - -- enforce(!endCondition(), "Premature end of data found"); -+ enforce(!endCondition(), new Base64Exception("Premature end of data found")); - first = cast(ubyte)(t | (DecodeMap[range_.front] >> 4)); - break; - case 1: -@@ -1349,31 +1346,24 @@ template Base64Impl(char Map62th, char M - * Default $(D Decoder) decodes chunk data. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * ----- -- *foreach (decoded; Base64.decoder(stdin.byLine())) -- *{ -- * writeln(decoded); -- *} -+ * foreach (decoded; Base64.decoder(stdin.byLine())) -+ * { -+ * writeln(decoded); -+ * } - * ----- -- *), $(ARGS FPucA9l+), $(ARGS), $(ARGS import std.base64, std.stdio;)) - * - * In addition, You can use $(D Decoder) that returns decoded single character. - * This $(D Decoder) performs Range-based and lazy decoding. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * ----- -- *auto encoded = Base64.encoder(cast(ubyte[])"0123456789"); -- *foreach (n; map!q{a - '0'}(Base64.decoder(encoded))) -- *{ -- * writeln(n); -- *} -+ * auto encoded = Base64.encoder(cast(ubyte[])"0123456789"); -+ * foreach (n; map!q{a - '0'}(Base64.decoder(encoded))) -+ * { -+ * writeln(n); -+ * } - * ----- -- *), $(ARGS), $(ARGS), $(ARGS import std.base64, std.stdio: writeln; -- *import std.algorithm: map;)) - * - * NOTE: - * If you use $(D ByChunk), chunk-size should be the multiple of 4. -@@ -1399,7 +1389,7 @@ template Base64Impl(char Map62th, char M - - // enforce can't be a pure function, so I use trivial check. - if (val == 0 && chr != 'A') -- throw new Exception("Invalid character: " ~ chr); -+ throw new Base64Exception("Invalid character: " ~ chr); - - return val; - } -@@ -1410,13 +1400,26 @@ template Base64Impl(char Map62th, char M - { - // See above comment. - if (chr > 0x7f) -- throw new Exception("Base64-encoded character must be a single byte"); -+ throw new Base64Exception("Base64-encoded character must be a single byte"); - - return decodeChar(cast(char)chr); - } - } - - -+/** -+ * Exception thrown on Base64 errors. -+ */ -+class Base64Exception : Exception -+{ -+ @safe pure nothrow -+ this(string s, string fn = __FILE__, size_t ln = __LINE__) -+ { -+ super(s, fn, ln); -+ } -+} -+ -+ - unittest - { - alias Base64Impl!('!', '=', Base64.NoPadding) Base64Re; -@@ -1467,7 +1470,7 @@ unittest - assert(Base64.decode(Base64.encode(tv["fooba"])) == tv["fooba"]); - assert(Base64.decode(Base64.encode(tv["foobar"])) == tv["foobar"]); - -- assertThrown(Base64.decode("ab|c")); -+ assertThrown!Base64Exception(Base64.decode("ab|c")); - - // Test decoding incomplete strings. RFC does not specify the correct - // behavior, but the code should never throw Errors on invalid input. -@@ -1478,9 +1481,10 @@ unittest - assert(Base64.decodeLength(3) <= 2); - - // may throw Exceptions, may not throw Errors -- collectException(Base64.decode("Zg")); -- collectException(Base64.decode("Zg=")); -- collectException(Base64.decode("Zm8")); -+ assertThrown!Base64Exception(Base64.decode("Zg")); -+ assertThrown!Base64Exception(Base64.decode("Zg=")); -+ assertThrown!Base64Exception(Base64.decode("Zm8")); -+ assertThrown!Base64Exception(Base64.decode("Zg==;")); - } - - { // No padding -@@ -1555,6 +1559,9 @@ unittest - assert(tv["foobar"] == b.data); a.clear(); b.clear(); - } - -+ // @@@9543@@@ These tests were disabled because they actually relied on the input range having length. -+ // The implementation (currently) doesn't support encoding/decoding from a length-less source. -+ version(none) - { // with InputRange - // InputRange to ubyte[] or char[] - auto encoded = Base64.encode(map!(to!(ubyte))(["20", "251", "156", "3", "217", "126"])); ---- a/src/libphobos/src/std/bigint.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/bigint.d 2014-04-01 16:32:51.000000000 +0100 -@@ -80,7 +80,7 @@ public: - /// It may have a leading + or - sign; followed by "0x" if hexadecimal. - /// Underscores are permitted. - /// BUG: Should throw a IllegalArgumentException/ConvError if invalid character found -- this(T : const(char)[] )(T s) -+ this(T : const(char)[] )(T s) pure - { - bool neg = false; - if (s[0] == '-') { -@@ -106,22 +106,22 @@ public: - } - - /// -- this(T)(T x) if (isIntegral!T) -+ this(T)(T x) pure if (isIntegral!T) - { - data = data.init; // @@@: Workaround for compiler bug - opAssign(x); - } - - /// -- BigInt opAssign(T)(T x) if (isIntegral!T) -+ BigInt opAssign(T)(T x) pure if (isIntegral!T) - { -- data = cast(ulong)((x < 0) ? -x : x); -+ data = cast(ulong)absUnsign(x); - sign = (x < 0); - return this; - } - - /// -- BigInt opAssign(T:BigInt)(T x) -+ BigInt opAssign(T:BigInt)(T x) pure - { - data = x.data; - sign = x.sign; -@@ -129,11 +129,11 @@ public: - } - - // BigInt op= integer -- BigInt opOpAssign(string op, T)(T y) -+ BigInt opOpAssign(string op, T)(T y) pure - if ((op=="+" || op=="-" || op=="*" || op=="/" || op=="%" - || op==">>" || op=="<<" || op=="^^") && isIntegral!T) - { -- ulong u = cast(ulong)(y < 0 ? -y : y); -+ ulong u = absUnsign(y); - - static if (op=="+") - { -@@ -201,7 +201,7 @@ public: - } - - // BigInt op= BigInt -- BigInt opOpAssign(string op, T)(T y) -+ BigInt opOpAssign(string op, T)(T y) pure - if ((op=="+" || op== "-" || op=="*" || op=="/" || op=="%") - && is (T: BigInt)) - { -@@ -243,15 +243,16 @@ public: - } - - // BigInt op BigInt -- BigInt opBinary(string op, T)(T y) -- if ((op=="+" || op == "*" || op=="-" || op=="/" || op=="%") && is (T: BigInt)) -+ BigInt opBinary(string op, T)(T y) pure -+ if ((op=="+" || op == "*" || op=="-" || op=="/" || op=="%") -+ && is (T: BigInt)) - { - BigInt r = this; - return r.opOpAssign!(op)(y); - } - - // BigInt op integer -- BigInt opBinary(string op, T)(T y) -+ BigInt opBinary(string op, T)(T y) pure - if ((op=="+" || op == "*" || op=="-" || op=="/" - || op==">>" || op=="<<" || op=="^^") && isIntegral!T) - { -@@ -260,11 +261,11 @@ public: - } - - // -- int opBinary(string op, T : int)(T y) -+ int opBinary(string op, T : int)(T y) pure - if (op == "%" && isIntegral!T) - { - assert(y!=0); -- uint u = y < 0 ? -y : y; -+ uint u = absUnsign(y); - int rem = BigUint.modInt(data, u); - // x%y always has the same sign as x. - // This is not the same as mathematical mod. -@@ -272,17 +273,17 @@ public: - } - - // Commutative operators -- BigInt opBinaryRight(string op, T)(T y) -+ BigInt opBinaryRight(string op, T)(T y) pure - if ((op=="+" || op=="*") && isIntegral!T) - { - return opBinary!(op)(y); - } - - // BigInt = integer op BigInt -- BigInt opBinaryRight(string op, T)(T y) -+ BigInt opBinaryRight(string op, T)(T y) pure - if (op == "-" && isIntegral!T) - { -- ulong u = cast(ulong)(y < 0 ? -y : y); -+ ulong u = absUnsign(y); - BigInt r; - static if (op == "-") - { -@@ -294,7 +295,7 @@ public: - } - - // integer = integer op BigInt -- T opBinaryRight(string op, T)(T x) -+ T opBinaryRight(string op, T)(T x) pure - if ((op=="%" || op=="/") && isIntegral!T) - { - static if (op == "%") -@@ -303,7 +304,7 @@ public: - // x%y always has the same sign as x. - if (data.ulongLength() > 1) - return x; -- ulong u = x < 0 ? -x : x; -+ ulong u = absUnsign(x); - ulong rem = u % data.peekUlong(0); - // x%y always has the same sign as x. - return cast(T)((x<0) ? -rem : rem); -@@ -317,7 +318,7 @@ public: - } - } - // const unary operations -- BigInt opUnary(string op)() /*const*/ if (op=="+" || op=="-") -+ BigInt opUnary(string op)() pure /*const*/ if (op=="+" || op=="-") - { - static if (op=="-") - { -@@ -330,7 +331,7 @@ public: - } - - // non-const unary operations -- BigInt opUnary(string op)() if (op=="++" || op=="--") -+ BigInt opUnary(string op)() pure if (op=="++" || op=="--") - { - static if (op=="++") - { -@@ -345,29 +346,44 @@ public: - } - - /// -- bool opEquals()(auto ref const BigInt y) const -+ bool opEquals()(auto ref const BigInt y) const pure - { - return sign == y.sign && y.data == data; - } - - /// -- bool opEquals(T)(T y) const if (isIntegral!T) -+ bool opEquals(T)(T y) const pure if (isIntegral!T) - { - if (sign != (y<0)) - return 0; -- return data.opEquals(cast(ulong)( y>=0 ? y : -y)); -+ return data.opEquals(cast(ulong)absUnsign(y)); - } - - /// -- int opCmp(T)(T y) if (isIntegral!T) -+ T opCast(T:bool)() pure -+ { -+ return !isZero(); -+ } -+ -+ // Hack to make BigInt's typeinfo.compare work properly. -+ // Note that this must appear before the other opCmp overloads, otherwise -+ // DMD won't find it. -+ int opCmp(ref const BigInt y) const -+ { -+ // Simply redirect to the "real" opCmp implementation. -+ return this.opCmp!BigInt(y); -+ } -+ -+ /// -+ int opCmp(T)(T y) pure if (isIntegral!T) - { - if (sign != (y<0) ) - return sign ? -1 : 1; -- int cmp = data.opCmp(cast(ulong)(y >= 0 ? y : -y)); -+ int cmp = data.opCmp(cast(ulong)absUnsign(y)); - return sign? -cmp: cmp; - } - /// -- int opCmp(T:BigInt)(T y) -+ int opCmp(T:BigInt)(const T y) pure const - { - if (sign!=y.sign) - return sign ? -1 : 1; -@@ -379,7 +395,7 @@ public: - long toLong() pure const - { - return (sign ? -1 : 1) * -- (data.ulongLength() == 1 && (data.peekUlong(0) <= cast(ulong)(long.max)) -+ (data.ulongLength() == 1 && (data.peekUlong(0) <= sign+cast(ulong)(long.max)) // 1+long.max = |long.min| - ? cast(long)(data.peekUlong(0)) - : long.max); - } -@@ -388,7 +404,7 @@ public: - int toInt() pure const - { - return (sign ? -1 : 1) * -- (data.uintLength() == 1 && (data.peekUint(0) <= cast(uint)(int.max)) -+ (data.uintLength() == 1 && (data.peekUint(0) <= sign+cast(uint)(int.max)) // 1+int.max = |int.min| - ? cast(int)(data.peekUint(0)) - : int.max); - } -@@ -478,28 +494,34 @@ private: - } - +/ - private: -- void negate() -+ void negate() pure nothrow @safe - { - if (!data.isZero()) - sign = !sign; - } -- bool isZero() pure const -+ bool isZero() pure const nothrow @safe - { - return data.isZero(); - } -- bool isNegative() pure const -+ bool isNegative() pure const nothrow @safe - { - return sign; - } - // Generate a runtime error if division by zero occurs -- void checkDivByZero() pure const -+ void checkDivByZero() pure const @safe - { - if (isZero()) - throw new Error("BigInt division by zero"); - } -+ -+ // Implement toHash so that BigInt works properly as an AA key. -+ size_t toHash() const @trusted nothrow -+ { -+ return data.toHash() + sign; -+ } - } - --string toDecimalString(BigInt x) -+string toDecimalString(BigInt x) - { - string outbuff=""; - void sink(const(char)[] s) { outbuff ~= s; } -@@ -507,7 +529,7 @@ string toDecimalString(BigInt x) - return outbuff; - } - --string toHex(BigInt x) -+string toHex(BigInt x) - { - string outbuff=""; - void sink(const(char)[] s) { outbuff ~= s; } -@@ -515,6 +537,24 @@ string toHex(BigInt x) - return outbuff; - } - -+// Returns the absolute value of x converted to the corresponding unsigned type -+Unsigned!T absUnsign(T)(T x) if (isIntegral!T) -+{ -+ static if (isSigned!T) -+ { -+ import std.conv; -+ /* This returns the correct result even when x = T.min -+ * on two's complement machines because unsigned(T.min) = |T.min| -+ * even though -T.min = T.min. -+ */ -+ return unsigned((x < 0) ? -x : x); -+ } -+ else -+ { -+ return x; -+ } -+} -+ - unittest { - // Radix conversion - assert( toDecimalString(BigInt("-1_234_567_890_123_456_789")) -@@ -546,6 +586,28 @@ unittest { - assert((-4) % BigInt(5) == -4); // bug 5928 - assert(BigInt(-4) % BigInt(5) == -4); - assert(BigInt(2)/BigInt(-3) == BigInt(0)); // bug 8022 -+ assert(BigInt("-1") > long.min); // bug 9548 -+} -+ -+unittest // Minimum signed value bug tests. -+{ -+ assert(BigInt("-0x8000000000000000") == BigInt(long.min)); -+ assert(BigInt("-0x8000000000000000")+1 > BigInt(long.min)); -+ assert(BigInt("-0x80000000") == BigInt(int.min)); -+ assert(BigInt("-0x80000000")+1 > BigInt(int.min)); -+ assert(BigInt(long.min).toLong() == long.min); // lossy toLong bug for long.min -+ assert(BigInt(int.min).toInt() == int.min); // lossy toInt bug for int.min -+ assert(BigInt(long.min).ulongLength == 1); -+ assert(BigInt(int.min).uintLength == 1); // cast/sign extend bug in opAssign -+ BigInt a; -+ a += int.min; -+ assert(a == BigInt(int.min)); -+ a = int.min - BigInt(int.min); -+ assert(a == 0); -+ a = int.min; -+ assert(a == BigInt(int.min)); -+ assert(int.min % (BigInt(int.min)-1) == int.min); -+ assert((BigInt(int.min)-1)%int.min == -1); - } - - unittest // Recursive division, bug 5568 -@@ -722,3 +784,50 @@ unittest - --y; - assert(y.toLong() == -2); - } -+ -+unittest -+{ -+ import std.math:abs; -+ auto r = abs(BigInt(-1000)); // 6486 -+ assert(r == 1000); -+ -+ // opCast!bool -+ BigInt one = 1, zero; -+ assert(one && !zero); -+} -+ -+unittest // 6850 -+{ -+ pure long pureTest() { -+ BigInt a = 1; -+ BigInt b = 1336; -+ a += b; -+ return a.toLong(); -+ } -+ -+ assert(pureTest() == 1337); -+} -+ -+unittest // 8435 & 10118 -+{ -+ auto i = BigInt(100); -+ auto j = BigInt(100); -+ -+ // Two separate BigInt instances representing same value should have same -+ // hash. -+ assert(typeid(i).getHash(&i) == typeid(j).getHash(&j)); -+ assert(typeid(i).compare(&i, &j) == 0); -+ -+ // BigInt AA keys should behave consistently. -+ int[BigInt] aa; -+ aa[BigInt(123)] = 123; -+ assert(BigInt(123) in aa); -+ -+ aa[BigInt(123)] = 321; -+ assert(aa[BigInt(123)] == 321); -+ -+ auto keys = aa.byKey; -+ assert(keys.front == BigInt(123)); -+ keys.popFront(); -+ assert(keys.empty); -+} ---- a/src/libphobos/src/std/bitmanip.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/bitmanip.d 2014-04-01 16:32:51.000000000 +0100 -@@ -27,7 +27,9 @@ module std.bitmanip; - //debug = bitarray; // uncomment to turn on debugging printf's - - import core.bitop; -+import std.format; - import std.range; -+import std.string; - import std.system; - import std.traits; - -@@ -67,23 +69,22 @@ private template createAccessors( - } - else - { -- static if (len + offset <= uint.sizeof * 8) -- alias uint MasksType; -- else -- alias ulong MasksType; -- enum MasksType -- maskAllElse = ((1uL << len) - 1u) << offset, -- signBitCheck = 1uL << (len - 1), -- extendSign = ~((cast(MasksType)1u << len) - 1); -+ enum ulong -+ maskAllElse = ((~0uL) >> (64 - len)) << offset, -+ signBitCheck = 1uL << (len - 1); -+ - static if (T.min < 0) - { - enum long minVal = -(1uL << (len - 1)); - enum ulong maxVal = (1uL << (len - 1)) - 1; -+ alias Unsigned!(T) UT; -+ enum UT extendSign = cast(UT)~((~0uL) >> (64 - len)); - } - else - { - enum ulong minVal = 0; -- enum ulong maxVal = (1uL << len) - 1; -+ enum ulong maxVal = (~0uL) >> (64 - len); -+ enum extendSign = 0; - } - - static if (is(T == bool)) -@@ -216,6 +217,106 @@ template bitfields(T...) - - unittest - { -+ // Degenerate bitfields (#8474 / #11160) tests mixed with range tests -+ struct Test1 -+ { -+ mixin(bitfields!(uint, "a", 32, -+ uint, "b", 4, -+ uint, "c", 4, -+ uint, "d", 8, -+ uint, "e", 16,)); -+ -+ static assert(Test1.b_min == 0); -+ static assert(Test1.b_max == 15); -+ } -+ -+ struct Test2 -+ { -+ mixin(bitfields!(bool, "a", 0, -+ ulong, "b", 64)); -+ -+ static assert(Test2.b_min == ulong.min); -+ static assert(Test2.b_max == ulong.max); -+ } -+ -+ struct Test1b -+ { -+ mixin(bitfields!(bool, "a", 0, -+ int, "b", 8)); -+ } -+ -+ struct Test2b -+ { -+ mixin(bitfields!(int, "a", 32, -+ int, "b", 4, -+ int, "c", 4, -+ int, "d", 8, -+ int, "e", 16,)); -+ -+ static assert(Test2b.b_min == -8); -+ static assert(Test2b.b_max == 7); -+ } -+ -+ struct Test3b -+ { -+ mixin(bitfields!(bool, "a", 0, -+ long, "b", 64)); -+ -+ static assert(Test3b.b_min == long.min); -+ static assert(Test3b.b_max == long.max); -+ } -+ -+ struct Test4b -+ { -+ mixin(bitfields!(long, "a", 32, -+ int, "b", 32)); -+ } -+ -+ // Sign extension tests -+ Test2b t2b; -+ Test4b t4b; -+ t2b.b = -5; assert(t2b.b == -5); -+ t2b.d = -5; assert(t2b.d == -5); -+ t2b.e = -5; assert(t2b.e == -5); -+ t4b.a = -5; assert(t4b.a == -5L); -+} -+ -+unittest -+{ -+ // Bug #6686 -+ union S { -+ ulong bits = ulong.max; -+ mixin (bitfields!( -+ ulong, "back", 31, -+ ulong, "front", 33) -+ ); -+ } -+ S num; -+ -+ num.bits = ulong.max; -+ num.back = 1; -+ assert(num.bits == 0xFFFF_FFFF_8000_0001uL); -+} -+ -+unittest -+{ -+ // Bug #5942 -+ struct S -+ { -+ mixin(bitfields!( -+ int, "a" , 32, -+ int, "b" , 32 -+ )); -+ } -+ -+ S data; -+ data.b = 42; -+ data.a = 1; -+ assert(data.b == 42); -+} -+ -+unittest -+{ - struct Test - { - mixin(bitfields!(bool, "a", 1, -@@ -266,7 +367,7 @@ unittest - { - struct MoreIntegrals { - bool checkExpectations(uint eu, ushort es, uint ei) { return u == eu && s == es && i == ei; } -- -+ - mixin(bitfields!( - uint, "u", 24, - short, "s", 16, -@@ -585,7 +686,7 @@ struct BitArray - } - return result; - } -- -+ - /** ditto */ - int opApply(scope int delegate(size_t, bool) dg) const - { -@@ -721,9 +822,8 @@ struct BitArray - lo++; - hi--; - } -- Ldone: -- ; - } -+ Ldone: - return this; - } - -@@ -750,19 +850,17 @@ struct BitArray - - if (this.length != a2.length) - return 0; // not equal -- byte *p1 = cast(byte*)this.ptr; -- byte *p2 = cast(byte*)a2.ptr; -- auto n = this.length / 8; -+ auto p1 = this.ptr; -+ auto p2 = a2.ptr; -+ auto n = this.length / bitsPerSizeT; - for (i = 0; i < n; i++) - { - if (p1[i] != p2[i]) - return 0; // not equal - } - -- ubyte mask; -- -- n = this.length & 7; -- mask = cast(ubyte)((1 << n) - 1); -+ n = this.length & (bitsPerSizeT-1); -+ size_t mask = (1 << n) - 1; - //printf("i = %d, n = %d, mask = %x, %x, %x\n", i, n, mask, p1[i], p2[i]); - return (mask == 0) || (p1[i] & mask) == (p2[i] & mask); - } -@@ -799,22 +897,20 @@ struct BitArray - auto len = this.length; - if (a2.length < len) - len = a2.length; -- ubyte* p1 = cast(ubyte*)this.ptr; -- ubyte* p2 = cast(ubyte*)a2.ptr; -- auto n = len / 8; -+ auto p1 = this.ptr; -+ auto p2 = a2.ptr; -+ auto n = len / bitsPerSizeT; - for (i = 0; i < n; i++) - { - if (p1[i] != p2[i]) - break; // not equal - } -- for (uint j = i * 8; j < len; j++) -+ for (size_t j = 0; j < len-i * bitsPerSizeT; j++) - { -- ubyte mask = cast(ubyte)(1 << j); -- int c; -- -- c = cast(int)(p1[i] & mask) - cast(int)(p2[i] & mask); -+ size_t mask = cast(size_t)(1 << j); -+ auto c = (cast(long)(p1[i] & mask) - cast(long)(p2[i] & mask)); - if (c) -- return c; -+ return c > 0 ? 1 : -1; - } - return cast(int)this.len - cast(int)a2.length; - } -@@ -844,6 +940,18 @@ struct BitArray - assert(a == e); - assert(a <= e); - assert(a >= e); -+ -+ bool[] v; -+ for (int i = 1; i < 256; i++) -+ { -+ v.length = i; -+ v[] = false; -+ BitArray x; x.init(v); -+ v[i-1] = true; -+ BitArray y; y.init(v); -+ assert(x < y); -+ assert(x <= y); -+ } - } - - /*************************************** -@@ -1421,6 +1529,112 @@ struct BitArray - assert(c[1] == 1); - assert(c[2] == 0); - } -+ -+ /*************************************** -+ * Return a string representation of this BitArray. -+ * -+ * Two format specifiers are supported: -+ * $(LI $(B %s) which prints the bits as an array, and) -+ * $(LI $(B %b) which prints the bits as 8-bit byte packets) -+ * separated with an underscore. -+ */ -+ void toString(scope void delegate(const(char)[]) sink, -+ FormatSpec!char fmt) const -+ { -+ switch(fmt.spec) -+ { -+ case 'b': -+ return formatBitString(sink); -+ case 's': -+ return formatBitArray(sink); -+ default: -+ throw new Exception("Unknown format specifier: %" ~ fmt.spec); -+ } -+ } -+ -+ /// -+ unittest -+ { -+ BitArray b; -+ b.init([0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]); -+ -+ auto s1 = format("%s", b); -+ assert(s1 == "[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]"); -+ -+ auto s2 = format("%b", b); -+ assert(s2 == "00001111_00001111"); -+ } -+ -+ private void formatBitString(scope void delegate(const(char)[]) sink) const -+ { -+ if (!length) -+ return; -+ -+ auto leftover = len % 8; -+ foreach (idx; 0 .. leftover) -+ { -+ char[1] res = cast(char)(bt(ptr, idx) + '0'); -+ sink.put(res[]); -+ } -+ -+ if (leftover && len > 8) -+ sink.put("_"); -+ -+ size_t count; -+ foreach (idx; leftover .. len) -+ { -+ char[1] res = cast(char)(bt(ptr, idx) + '0'); -+ sink.put(res[]); -+ if (++count == 8 && idx != len - 1) -+ { -+ sink.put("_"); -+ count = 0; -+ } -+ } -+ } -+ -+ private void formatBitArray(scope void delegate(const(char)[]) sink) const -+ { -+ sink("["); -+ foreach (idx; 0 .. len) -+ { -+ char[1] res = cast(char)(bt(ptr, idx) + '0'); -+ sink(res[]); -+ if (idx+1 < len) -+ sink(", "); -+ } -+ sink("]"); -+ } -+} -+ -+unittest -+{ -+ BitArray b; -+ -+ b.init([]); -+ assert(format("%s", b) == "[]"); -+ assert(format("%b", b) is null); -+ -+ b.init([1]); -+ assert(format("%s", b) == "[1]"); -+ assert(format("%b", b) == "1"); -+ -+ b.init([0, 0, 0, 0]); -+ assert(format("%b", b) == "0000"); -+ -+ b.init([0, 0, 0, 0, 1, 1, 1, 1]); -+ assert(format("%s", b) == "[0, 0, 0, 0, 1, 1, 1, 1]"); -+ assert(format("%b", b) == "00001111"); -+ -+ b.init([0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]); -+ assert(format("%s", b) == "[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]"); -+ assert(format("%b", b) == "00001111_00001111"); -+ -+ b.init([1, 0, 0, 0, 0, 1, 1, 1, 1]); -+ assert(format("%b", b) == "1_00001111"); -+ -+ b.init([1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]); -+ assert(format("%b", b) == "1_00001111_00001111"); - } - - /++ -@@ -1952,7 +2166,7 @@ private template canSwapEndianness(T) - unittest - { - foreach(T; TypeTuple!(bool, ubyte, byte, ushort, short, uint, int, ulong, -- long, char, wchar, dchar, float, double)) -+ long, char, wchar, dchar, float, double)) - { - static assert(canSwapEndianness!(T)); - static assert(canSwapEndianness!(const T)); -@@ -2161,7 +2375,7 @@ unittest - ubyte[] buffer = [66, 0, 0, 0, 65, 200, 0, 0]; - assert(buffer.peek!float()== 32.0); - assert(buffer.peek!float(4) == 25.0f); -- -+ - size_t index = 0; - assert(buffer.peek!float(&index) == 32.0f); - assert(index == 4); -@@ -2175,7 +2389,7 @@ unittest - ubyte[] buffer = [64, 64, 0, 0, 0, 0, 0, 0, 64, 57, 0, 0, 0, 0, 0, 0]; - assert(buffer.peek!double() == 32.0); - assert(buffer.peek!double(8) == 25.0); -- -+ - size_t index = 0; - assert(buffer.peek!double(&index) == 32.0); - assert(index == 8); -@@ -2187,7 +2401,7 @@ unittest - { - //enum - ubyte[] buffer = [0, 0, 0, 10, 0, 0, 0, 20, 0, 0, 0, 30]; -- -+ - enum Foo - { - one = 10, -@@ -2719,7 +2933,7 @@ unittest - { - //char (8bit) - ubyte[] buffer = [0, 0, 0]; -- -+ - buffer.write!char('a', 0); - assert(buffer == [97, 0, 0]); - -@@ -2743,7 +2957,7 @@ unittest - { - //wchar (16bit - 2x ubyte) - ubyte[] buffer = [0, 0, 0, 0]; -- -+ - buffer.write!wchar('ą', 0); - assert(buffer == [1, 5, 0, 0]); - -@@ -2763,7 +2977,7 @@ unittest - { - //dchar (32bit - 4x ubyte) - ubyte[] buffer = [0, 0, 0, 0, 0, 0, 0, 0]; -- -+ - buffer.write!dchar('ą', 0); - assert(buffer == [0, 0, 1, 5, 0, 0, 0, 0]); - -@@ -2778,7 +2992,7 @@ unittest - buffer.write!dchar('ą', &index); - assert(buffer == [0, 0, 1, 7, 0, 0, 1, 5]); - assert(index == 8); -- } -+ } - - { - //float (32bit - 4x ubyte) -@@ -2809,7 +3023,7 @@ unittest - - buffer.write!double(25.0, 8); - assert(buffer == [64, 64, 0, 0, 0, 0, 0, 0, 64, 57, 0, 0, 0, 0, 0, 0]); -- -+ - size_t index = 0; - buffer.write!double(25.0, &index); - assert(buffer == [64, 57, 0, 0, 0, 0, 0, 0, 64, 57, 0, 0, 0, 0, 0, 0]); -@@ -2823,7 +3037,7 @@ unittest - { - //enum - ubyte[] buffer = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; -- -+ - enum Foo - { - one = 10, -@@ -3012,19 +3226,19 @@ unittest - { - //char wchar dchar - auto buffer = appender!(const ubyte[])(); -- -+ - buffer.append!char('a'); - assert(buffer.data == [97]); - - buffer.append!char('b'); - assert(buffer.data == [97, 98]); -- -+ - buffer.append!wchar('ą'); - assert(buffer.data == [97, 98, 1, 5]); - - buffer.append!dchar('ą'); - assert(buffer.data == [97, 98, 1, 5, 0, 0, 1, 5]); -- } -+ } - - { - //float double -@@ -3040,7 +3254,7 @@ unittest - { - //enum - auto buffer = appender!(const ubyte[])(); -- -+ - enum Foo - { - one = 10, -@@ -3141,7 +3355,7 @@ unittest - size_t length = 0; - foreach(T; Types) - { -- toWrite.append!T(cast(T)values[index++]); -+ toWrite.append!(T, endianness)(cast(T)values[index++]); - length += T.sizeof; - } - -@@ -3151,11 +3365,11 @@ unittest - index = 0; - foreach(T; Types) - { -- assert(toRead.peek!T() == values[index], format("Failed Index: %s", index)); -- assert(toRead.peek!T(0) == values[index], format("Failed Index: %s", index)); -+ assert(toRead.peek!(T, endianness)() == values[index], format("Failed Index: %s", index)); -+ assert(toRead.peek!(T, endianness)(0) == values[index], format("Failed Index: %s", index)); - assert(toRead.length == length, - format("Failed Index [%s], Actual Length: %s", index, toRead.length)); -- assert(toRead.read!T() == values[index], format("Failed Index: %s", index)); -+ assert(toRead.read!(T, endianness)() == values[index], format("Failed Index: %s", index)); - length -= T.sizeof; - assert(toRead.length == length, - format("Failed Index [%s], Actual Length: %s", index, toRead.length)); ---- a/src/libphobos/src/std/c/linux/linuxextern.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/c/linux/linuxextern.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,15 @@ -+ -+/* Written by Walter Bright. -+ * www.digitalmars.com -+ * Placed into public domain. -+ * Linux(R) is the registered trademark of Linus Torvalds in the U.S. and other -+ * countries. -+ */ -+ -+/* These are all the globals defined by the linux C runtime library. -+ * Put them separate so they'll be externed - do not link in linuxextern.o -+ */ -+ -+module std.c.linux.linuxextern; -+ -+// No longer needed since "extern" storage class ---- a/src/libphobos/src/std/c/linux/tipc.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/linux/tipc.d 2014-04-01 16:32:51.000000000 +0100 -@@ -36,7 +36,7 @@ struct tipc_subscr - tipc_name_seq seq; - uint timeout; - uint filter; -- ubyte usr_handle[8]; -+ ubyte[8] usr_handle; - } - - struct tipc_event ---- a/src/libphobos/src/std/c/stdio.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/stdio.d 2014-04-01 16:32:51.000000000 +0100 -@@ -18,13 +18,4 @@ extern (C): - version (Windows) - { - extern shared ubyte[_NFILE] __fhnd_info; -- -- enum -- { -- FHND_APPEND = 0x04, -- FHND_DEVICE = 0x08, -- FHND_TEXT = 0x10, -- FHND_BYTE = 0x20, -- FHND_WCHAR = 0x40, -- } - } ---- a/src/libphobos/src/std/c/windows/com.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/windows/com.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,9 +1,11 @@ - module std.c.windows.com; -+version (Windows): - - pragma(lib,"uuid"); - --private import std.c.windows.windows; --private import std.string; -+import core.atomic; -+import std.c.windows.windows; -+import std.string; - - alias WCHAR OLECHAR; - alias OLECHAR *LPOLESTR; -@@ -37,7 +39,7 @@ struct GUID { // size is 16 - DWORD Data1; - WORD Data2; - WORD Data3; -- BYTE Data4[8]; -+ BYTE[8] Data4; - } - - enum -@@ -57,11 +59,11 @@ enum - } - - enum --{ -+{ - COINIT_APARTMENTTHREADED = 0x2, - COINIT_MULTITHREADED = 0x0, - COINIT_DISABLE_OLE1DDE = 0x4, -- COINIT_SPEED_OVER_MEMORY = 0x8 -+ COINIT_SPEED_OVER_MEMORY = 0x8 - } - alias DWORD COINIT; - enum RPC_E_CHANGED_MODE = 0x80010106; -@@ -232,12 +234,12 @@ extern (System): - - ULONG AddRef() - { -- return InterlockedIncrement(&count); -+ return atomicOp!"+="(*cast(shared)&count, 1); - } - - ULONG Release() - { -- LONG lRef = InterlockedDecrement(&count); -+ LONG lRef = atomicOp!"-="(*cast(shared)&count, 1); - if (lRef == 0) - { - // free object ---- a/src/libphobos/src/std/c/windows/stat.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/windows/stat.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,13 +3,12 @@ - /// Author: Walter Bright - - module std.c.windows.stat; -+version (Windows): - - extern (C): - - // linux version is in std.c.linux.linux - --version (Windows) --{ - const S_IFMT = 0xF000; - const S_IFDIR = 0x4000; - const S_IFCHR = 0x2000; -@@ -46,4 +45,3 @@ struct struct_stat - int stat(char *, struct_stat *); - int fstat(int, struct_stat *); - int _wstat(wchar *, struct_stat *); --} ---- a/src/libphobos/src/std/c/windows/windows.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/windows/windows.d 2014-04-01 16:32:51.000000000 +0100 -@@ -3,13 +3,6 @@ - States and other countries. */ - - module std.c.windows.windows; -+version (Windows): - - public import core.sys.windows.windows; -- --version (Windows) --{ --} --else --{ -- static assert(0); // Windows only --} ---- a/src/libphobos/src/std/c/windows/winsock.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/c/windows/winsock.d 2014-04-01 16:32:51.000000000 +0100 -@@ -5,6 +5,7 @@ - - - module std.c.windows.winsock; -+version (Windows): - - private import std.stdint; - private import std.c.windows.windows; -@@ -12,8 +13,8 @@ private import std.c.windows.windows; - - extern(Windows): - --alias int SOCKET; --alias uint socklen_t; -+alias size_t SOCKET; -+alias int socklen_t; - - const SOCKET INVALID_SOCKET = cast(SOCKET)~0; - const int SOCKET_ERROR = -1; -@@ -25,8 +26,8 @@ struct WSADATA - { - WORD wVersion; - WORD wHighVersion; -- char szDescription[WSADESCRIPTION_LEN + 1]; -- char szSystemStatus[WSASYS_STATUS_LEN + 1]; -+ char[WSADESCRIPTION_LEN + 1] szDescription; -+ char[WSASYS_STATUS_LEN + 1] szSystemStatus; - USHORT iMaxSockets; - USHORT iMaxUdpDg; - char* lpVendorInfo; -@@ -312,8 +313,17 @@ struct servent - { - char* s_name; - char** s_aliases; -- SHORT s_port; -- char* s_proto; -+ -+ version (Win64) -+ { -+ char* s_proto; -+ SHORT s_port; -+ } -+ else -+ { -+ SHORT s_port; -+ char* s_proto; -+ } - } - - ---- a/src/libphobos/src/std/complex.d 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/libphobos/src/std/complex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -115,6 +115,55 @@ struct Complex(T) if (isFloatingPoint!T - - /** Converts the complex number to a string representation. - -+ The second form of this function is usually not called directly; -+ instead, it is used via $(XREF format,format), as shown in the examples -+ below. Supported format characters are 'e', 'f', 'g', 'a', and 's'. -+ -+ See the $(LINK2 std_format.html, std.format documentation) for more -+ information. -+ */ -+ string toString() const /* TODO: pure @safe nothrow */ -+ { -+ import std.exception : assumeUnique; -+ char[] buf; -+ buf.reserve(100); -+ auto fmt = FormatSpec!char("%s"); -+ toString((const(char)[] s) { buf ~= s; }, fmt); -+ return assumeUnique(buf); -+ } -+ -+ static if (is(T == double)) -+ /// -+ unittest -+ { -+ auto c = complex(1.2, 3.4); -+ -+ // Vanilla toString formatting: -+ assert(c.toString() == "1.2+3.4i"); -+ -+ // Formatting with std.format specs: the precision and width specifiers -+ // apply to both the real and imaginary parts of the complex number. -+ import std.string; -+ assert(format("%.2f", c) == "1.20+3.40i"); -+ assert(format("%4.1f", c) == " 1.2+ 3.4i"); -+ } -+ -+ /// ditto -+ void toString(Char)(scope void delegate(const(Char)[]) sink, -+ FormatSpec!Char formatSpec) const -+ { -+ formatValue(sink, re, formatSpec); -+ if (signbit(im) == 0) sink("+"); -+ formatValue(sink, im, formatSpec); -+ sink("i"); -+ } -+ -+ /** -+ $(RED Deprecated. This function will be removed in March 2014. -+ Please use $(XREF format,format) instead.) -+ -+ Converts the complex number to a string representation. -+ - If a $(D sink) delegate is specified, the string is passed to it - and this function returns $(D null). Otherwise, this function - returns the string representation directly. -@@ -128,23 +177,22 @@ struct Complex(T) if (isFloatingPoint!T - - See the $(LINK2 std_format.html, std.format documentation) for - more information. -- */ -- string toString(scope void delegate(const(char)[]) sink = null, -+ */ -+ deprecated("Please use std.format.format() instead.") -+ string toString(scope void delegate(const(char)[]) sink, - string formatSpec = "%s") - const - { - if (sink == null) - { -+ import std.exception : assumeUnique; - char[] buf; - buf.reserve(100); -- toString((const(char)[] s) { buf ~= s; }, formatSpec); -- return cast(string) buf; -+ formattedWrite((const(char)[] s) { buf ~= s; }, formatSpec, this); -+ return assumeUnique(buf); - } - -- formattedWrite(sink, formatSpec, re); -- if (signbit(im) == 0) sink("+"); -- formattedWrite(sink, formatSpec, im); -- sink("i"); -+ formattedWrite(sink, formatSpec, this); - return null; - } - -@@ -663,7 +711,8 @@ Complex!T cos(T)(Complex!T z) @safe pur - unittest{ - assert(cos(complex(0.0)) == 1.0); - assert(cos(complex(1.3L)) == std.math.cos(1.3L)); -- assert(cos(complex(0, 5.2L)) == cosh(5.2L)); -+ assert(feqrel(cos(complex(0, 5.2L)).re, cosh(5.2L)) >= real.mant_dig - 1); -+ assert(cos(complex(0, 5.2L)).im == 0); - } - - -@@ -682,8 +731,7 @@ Complex!real expi(real y) @trusted pure - - unittest - { -- real value = 1.3e5L; //Avoid constant folding -- assert(expi(value) == complex(std.math.cos(value), std.math.sin(value))); -+ assert(expi(1.125L) == complex(std.math.cos(1.125L), std.math.sin(1.125L))); - assert(expi(0.0L) == 1.0L); - auto z1 = expi(1.234); - auto z2 = std.math.expi(1.234); -@@ -741,3 +789,36 @@ unittest - assert (sqrt(complex(1.0L, 0)) == std.math.sqrt(1.0L)); - assert (sqrt(complex(-1.0L, 0)) == complex(0, 1.0L)); - } -+ -+// Issue 10881: support %f formatting of complex numbers -+unittest -+{ -+ import std.string : format; -+ -+ auto x = complex(1.2, 3.4); -+ assert(format("%.2f", x) == "1.20+3.40i"); -+ -+ auto y = complex(1.2, -3.4); -+ assert(format("%.2f", y) == "1.20-3.40i"); -+} -+ -+unittest -+{ -+ // Test wide string formatting -+ wstring wformat(T)(string format, Complex!T c) -+ { -+ import std.array : appender; -+ auto w = appender!wstring(); -+ auto n = formattedWrite(w, format, c); -+ return w.data; -+ } -+ -+ auto x = complex(1.2, 3.4); -+ assert(wformat("%.2f", x) == "1.20+3.40i"w); -+} -+ -+unittest -+{ -+ // Test ease of use (vanilla toString() should be supported) -+ assert(complex(1.2, 3.4).toString() == "1.2+3.4i"); -+} ---- a/src/libphobos/src/std/concurrency.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/concurrency.d 2014-04-01 16:32:51.000000000 +0100 -@@ -13,8 +13,6 @@ - * additional features specific to in-process messaging. - * - * Synposis: -- *$(D_RUN_CODE -- *$(ARGS - * --- - * import std.stdio; - * import std.concurrency; -@@ -45,7 +43,6 @@ - * writeln("Successfully printed number."); - * } - * --- -- *), $(ARGS), $(ARGS), $(ARGS)) - * - * Copyright: Copyright Sean Kelly 2009 - 2010. - * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -@@ -70,6 +67,7 @@ private - import core.sync.mutex; - import core.sync.condition; - import std.algorithm; -+ import std.datetime; - import std.exception; - import std.range; - import std.string; -@@ -193,17 +191,6 @@ private - } - - --shared static this() --{ -- // NOTE: Normally, mbox is initialized by spawn() or thisTid(). This -- // doesn't support the simple case of calling only receive() in main -- // however. To ensure that this works, initialize the main thread's -- // mbox field here (as shared static ctors are run once on startup -- // by the main thread). -- mbox = new MessageBox; --} -- -- - static ~this() - { - if( mbox !is null ) -@@ -303,6 +290,19 @@ class MailboxFull : Exception - } - - -+/** -+ * Thrown when a Tid is missing, e.g. when $(D ownerTid) doesn't -+ * find an owner thread. -+ */ -+class TidMissingException : Exception -+{ -+ this(string msg, string file = __FILE__, size_t line = __LINE__) -+ { -+ super(msg, file, line); -+ } -+} -+ -+ - ////////////////////////////////////////////////////////////////////////////// - // Thread ID - ////////////////////////////////////////////////////////////////////////////// -@@ -313,14 +313,6 @@ class MailboxFull : Exception - */ - struct Tid - { -- void send(T...)( T vals ) -- { -- static assert( !hasLocalAliasing!(T), -- "Aliases to mutable thread-local data not allowed." ); -- _send( this, vals ); -- } -- -- - private: - this( MessageBox m ) - { -@@ -343,6 +335,34 @@ private: - return Tid( mbox ); - } - -+/** -+ * Return the Tid of the thread which -+ * spawned the caller's thread. -+ * -+ * Throws: A $(D TidMissingException) exception if -+ * there is no owner thread. -+ */ -+@property Tid ownerTid() -+{ -+ enforceEx!TidMissingException(owner.mbox !is null, "Error: Thread has no owner thread."); -+ return owner; -+} -+ -+unittest -+{ -+ static void fun() -+ { -+ string res = receiveOnly!string(); -+ assert(res == "Main calling"); -+ ownerTid.send("Child responding"); -+ } -+ -+ assertThrown!TidMissingException(ownerTid); -+ auto child = spawn(&fun); -+ child.send("Main calling"); -+ string res = receiveOnly!string(); -+ assert(res == "Child responding"); -+} - - ////////////////////////////////////////////////////////////////////////////// - // Thread Creation -@@ -391,8 +411,6 @@ private template isSpawnable(F, T...) - * threads. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * --- - * import std.stdio, std.concurrency; - * -@@ -417,7 +435,6 @@ private template isSpawnable(F, T...) - * auto tid2 = spawn(&f2, str.dup); - * } - * --- -- *), $(ARGS), $(ARGS), $(ARGS)) - */ - Tid spawn(F, T...)( F fn, T args ) - if ( isSpawnable!(F, T) ) -@@ -585,8 +602,6 @@ private void _send(T...)( MsgType type, - * sent. - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * --- - * import std.stdio; - * import std.variant; -@@ -607,9 +622,14 @@ private void _send(T...)( MsgType type, - * send(tid, 42); - * } - * --- -- *), $(ARGS), $(ARGS), $(ARGS)) - */ - void receive(T...)( T ops ) -+in -+{ -+ assert(mbox !is null, "Cannot receive a message until a thread was spawned " -+ "or thisTid was passed to a running thread."); -+} -+body - { - checkops( ops ); - mbox.get( ops ); -@@ -668,11 +688,9 @@ private template receiveOnlyRet(T...) - * the message will be packed into a $(XREF typecons, Tuple). - * - * Example: -- *$(D_RUN_CODE -- *$(ARGS - * --- - * import std.concurrency; -- -+ * - * void spawnedFunc() - * { - * auto msg = receiveOnly!(int, string)(); -@@ -686,9 +704,14 @@ private template receiveOnlyRet(T...) - * send(tid, 42, "42"); - * } - * --- -- *), $(ARGS), $(ARGS), $(ARGS)) - */ - receiveOnlyRet!(T) receiveOnly(T...)() -+in -+{ -+ assert(mbox !is null, "Cannot receive a message until a thread was spawned " -+ "or thisTid was passed to a running thread."); -+} -+body - { - Tuple!(T) ret; - -@@ -743,13 +766,6 @@ unittest - assert(result == "Unexpected message type: expected 'string', got 'int'"); - } - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use the overload of receiveTimeout which takes a Duration.") --bool receiveTimeout(T...)( long ms, T ops ) --{ -- return receiveTimeout( dur!"msecs"( ms ), ops ); --} -- - /++ - Same as $(D receive) except that rather than wait forever for a message, - it waits until either it receives a message or the given -@@ -757,6 +773,12 @@ bool receiveTimeout(T...)( long ms, T op - message and $(D false) if it timed out waiting for one. - +/ - bool receiveTimeout(T...)( Duration duration, T ops ) -+in -+{ -+ assert(mbox !is null, "Cannot receive a message until a thread was spawned " -+ "or thisTid was passed to a running thread."); -+} -+body - { - checkops( ops ); - return mbox.get( duration, ops ); -@@ -1246,6 +1268,11 @@ private - return false; - } - -+ static if( timedWait ) -+ { -+ auto limit = Clock.currTime( UTC() ) + period; -+ } -+ - while( true ) - { - ListT arrived; -@@ -1270,7 +1297,7 @@ private - m_notFull.notifyAll(); - static if( timedWait ) - { -- if( !m_putMsg.wait( period ) ) -+ if( period.isNegative || !m_putMsg.wait( period ) ) - return false; - } - else -@@ -1286,7 +1313,14 @@ private - scope(exit) m_localBox.put( arrived ); - if( scan( arrived ) ) - return true; -- else continue; -+ else -+ { -+ static if( timedWait ) -+ { -+ period = limit - Clock.currTime( UTC() ); -+ } -+ continue; -+ } - } - m_localBox.put( arrived ); - pty( m_localPty ); ---- a/src/libphobos/src/std/container.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/container.d 2014-04-01 16:32:51.000000000 +0100 -@@ -849,18 +849,11 @@ template make(T) - if (is(T == struct) || is(T == class)) - { - T make(Args...)(Args arguments) -- if (is(T == struct) && __traits(compiles, T(arguments)) && Args.length > 0) -+ if (is(T == struct) && __traits(compiles, T(arguments))) - { - return T(arguments); - } - -- //@@@BUG@@@ 8763 makes this extra function necessary. -- T make()() -- if (is(T == struct)) -- { -- return T(); -- } -- - T make(Args...)(Args arguments) - if (is(T == class) && __traits(compiles, new T(arguments))) - { -@@ -2240,7 +2233,7 @@ Complexity: $(BIGOH 1) - /// ditto - template linearRemove(R) if (is(R == Range)) - { -- Range linearRemove(R r) { return remove(r); }; -+ Range linearRemove(R r) { return remove(r); } - } - - /// ditto -@@ -2590,7 +2583,7 @@ struct Array(T) if (!is(T : const(bool)) - auto newPayload = - enforce((cast(T*) malloc(sz))[0 .. oldLength]); - // copy old data over to new array -- newPayload[] = _payload[]; -+ memcpy(newPayload.ptr, _payload.ptr, T.sizeof * oldLength); - // Zero out unused capacity to prevent gc from seeing - // false pointers - memset(newPayload.ptr + oldLength, -@@ -3622,14 +3615,14 @@ unittest - // make sure that Array instances refuse ranges that don't belong to them - unittest - { -- Array!int a = [1, 2, 3]; -- auto r = a.dup[]; -- assertThrown(a.insertBefore(r, 42)); -- assertThrown(a.insertBefore(r, [42])); -- assertThrown(a.insertAfter(r, 42)); -- assertThrown(a.replace(r, 42)); -- assertThrown(a.replace(r, [42])); -- assertThrown(a.linearRemove(r)); -+ Array!int a = [1, 2, 3]; -+ auto r = a.dup[]; -+ assertThrown(a.insertBefore(r, 42)); -+ assertThrown(a.insertBefore(r, [42])); -+ assertThrown(a.insertAfter(r, 42)); -+ assertThrown(a.replace(r, 42)); -+ assertThrown(a.replace(r, [42])); -+ assertThrown(a.linearRemove(r)); - } - unittest - { -@@ -3686,6 +3679,20 @@ unittest - assert(r.equal([0, 0, 40])); - } - -+// Test issue 11194 -+unittest { -+ static struct S { -+ int i = 1337; -+ void* p; -+ this(this) { assert(i == 1337); } -+ ~this() { assert(i == 1337); } -+ } -+ Array!S arr; -+ S s; -+ arr ~= s; -+ arr ~= s; -+} -+ - // BinaryHeap - /** - Implements a $(WEB en.wikipedia.org/wiki/Binary_heap, binary heap) ---- a/src/libphobos/src/std/conv.d 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/libphobos/src/std/conv.d 2014-04-01 16:32:51.000000000 +0100 -@@ -14,6 +14,10 @@ Authors: $(WEB digitalmars.com, Walter - Kenji Hara - - Source: $(PHOBOSSRC std/_conv.d) -+ -+Macros: -+WIKI = Phobos/StdConv -+ - */ - module std.conv; - -@@ -23,7 +27,6 @@ import std.algorithm, std.array, std.asc - std.string, std.traits, std.typecons, std.typetuple, std.uni, - std.utf; - import std.format; --import std.metastrings; - - //debug=conv; // uncomment to turn on debugging printf's - -@@ -34,43 +37,47 @@ import std.metastrings; - */ - class ConvException : Exception - { -+ @safe pure nothrow - this(string s, string fn = __FILE__, size_t ln = __LINE__) - { - super(s, fn, ln); - } - } - --private string convError_unexpected(S)(S source) { -+private string convError_unexpected(S)(S source) -+{ - return source.empty ? "end of input" : text("'", source.front, "'"); - } - --private void convError(S, T)(S source, string fn = __FILE__, size_t ln = __LINE__) -+private auto convError(S, T)(S source, string fn = __FILE__, size_t ln = __LINE__) - { -- throw new ConvException( -+ return new ConvException( - text("Unexpected ", convError_unexpected(source), - " when converting from type "~S.stringof~" to type "~T.stringof), - fn, ln); - } - --private void convError(S, T)(S source, int radix, string fn = __FILE__, size_t ln = __LINE__) -+private auto convError(S, T)(S source, int radix, string fn = __FILE__, size_t ln = __LINE__) - { -- throw new ConvException( -+ return new ConvException( - text("Unexpected ", convError_unexpected(source), - " when converting from type "~S.stringof~" base ", radix, - " to type "~T.stringof), - fn, ln); - } - --private void parseError(lazy string msg, string fn = __FILE__, size_t ln = __LINE__) -+@safe pure/* nothrow*/ // lazy parameter bug -+private auto parseError(lazy string msg, string fn = __FILE__, size_t ln = __LINE__) - { -- throw new ConvException(text("Can't parse string: ", msg), fn, ln); -+ return new ConvException(text("Can't parse string: ", msg), fn, ln); - } - - private void parseCheck(alias source)(dchar c, string fn = __FILE__, size_t ln = __LINE__) - { -- if (source.empty) parseError(text("unexpected end of input when expecting", "\"", c, "\"")); -+ if (source.empty) -+ throw parseError(text("unexpected end of input when expecting", "\"", c, "\"")); - if (source.front != c) -- parseError(text("\"", c, "\" is missing"), fn, ln); -+ throw parseError(text("\"", c, "\" is missing"), fn, ln); - source.popFront(); - } - -@@ -78,17 +85,17 @@ private - { - template isImaginary(T) - { -- enum bool isImaginary = staticIndexOf!(Unqual!(T), -+ enum bool isImaginary = staticIndexOf!(Unqual!T, - ifloat, idouble, ireal) >= 0; - } - template isComplex(T) - { -- enum bool isComplex = staticIndexOf!(Unqual!(T), -+ enum bool isComplex = staticIndexOf!(Unqual!T, - cfloat, cdouble, creal) >= 0; - } - template isNarrowInteger(T) - { -- enum bool isNarrowInteger = staticIndexOf!(Unqual!(T), -+ enum bool isNarrowInteger = staticIndexOf!(Unqual!T, - byte, ubyte, short, ushort) >= 0; - } - -@@ -134,6 +141,7 @@ private - */ - class ConvOverflowException : ConvException - { -+ @safe pure nothrow - this(string s, string fn = __FILE__, size_t ln = __LINE__) - { - super(s, fn, ln); -@@ -258,7 +266,6 @@ $(D_PARAM to!(double[])) applies to an $ - conversion might throw an exception because $(D_PARAM to!short) - might fail the range check. - --Macros: WIKI=Phobos/StdConv - */ - - /** -@@ -283,7 +290,7 @@ template to(T) - } - - // Tests for issue 6175 --unittest -+@safe pure unittest - { - char[9] sarr = "blablabla"; - auto darr = to!(char[])(sarr); -@@ -292,34 +299,34 @@ unittest - } - - // Tests for issue 7348 --unittest -+@safe pure unittest - { - assert(to!string(null) == "null"); - assert(text(null) == "null"); - } - - // Tests for issue 8729: do NOT skip leading WS --unittest -+@safe pure unittest - { -- foreach(T;TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)) -+ foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)) - { - assertThrown!ConvException(to!T(" 0")); - assertThrown!ConvException(to!T(" 0", 8)); - } -- foreach(T;TypeTuple!(float, double, real)) -+ foreach (T; TypeTuple!(float, double, real)) - { - assertThrown!ConvException(to!T(" 0")); - } - -- assertThrown!ConvException(to!bool (" true")); -+ assertThrown!ConvException(to!bool(" true")); - -- alias typeof(null) NullType; -+ alias NullType = typeof(null); - assertThrown!ConvException(to!NullType(" null")); - -- alias int[] ARR; -+ alias ARR = int[]; - assertThrown!ConvException(to!ARR(" [1]")); - -- alias int[int] AA; -+ alias AA = int[int]; - assertThrown!ConvException(to!AA(" [1:1]")); - } - -@@ -331,7 +338,11 @@ T toImpl(T, S)(S value) - if (isImplicitlyConvertible!(S, T) && - !isEnumStrToStr!(S, T) && !isNullToStr!(S, T)) - { -- alias isUnsigned isUnsignedInt; -+ template isSignedInt(T) -+ { -+ enum isSignedInt = isIntegral!T && isSigned!T; -+ } -+ alias isUnsignedInt = isUnsigned; - - // Conversion from integer to integer, and changing its sign - static if (isUnsignedInt!S && isSignedInt!T && S.sizeof == T.sizeof) -@@ -348,19 +359,14 @@ T toImpl(T, S)(S value) - return value; - } - --unittest -+@safe pure unittest - { - enum E { a } // Issue 9523 - Allow identity enum conversion - auto e = to!E(E.a); - assert(e == E.a); - } - --private template isSignedInt(T) --{ -- enum isSignedInt = isIntegral!T && isSigned!T; --} -- --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - int a = 42; -@@ -369,25 +375,25 @@ unittest - } - - // Tests for issue 6377 --unittest -+@safe pure unittest - { - // Conversion between same size - foreach (S; TypeTuple!(byte, short, int, long)) - { - alias Unsigned!S U; - -- foreach (Sint; TypeTuple!(S, const(S), immutable(S))) -- foreach (Uint; TypeTuple!(U, const(U), immutable(U))) -+ foreach (Sint; TypeTuple!(S, const S, immutable S)) -+ foreach (Uint; TypeTuple!(U, const U, immutable U)) - { - // positive overflow - Uint un = Uint.max; -- assertThrown!ConvOverflowException(to!Sint(un), text( -- Sint.stringof, ' ', Uint.stringof, ' ', un)); -+ assertThrown!ConvOverflowException(to!Sint(un), -+ text(Sint.stringof, ' ', Uint.stringof, ' ', un)); - - // negative overflow - Sint sn = -1; -- assertThrown!ConvOverflowException(to!Uint(sn), text( -- Sint.stringof, ' ', Uint.stringof, ' ', un)); -+ assertThrown!ConvOverflowException(to!Uint(sn), -+ text(Sint.stringof, ' ', Uint.stringof, ' ', un)); - } - } - -@@ -401,8 +407,8 @@ unittest - static assert(U1.sizeof < S2.sizeof); - - // small unsigned to big signed -- foreach (Uint; TypeTuple!(U1, const(U1), immutable(U1))) -- foreach (Sint; TypeTuple!(S2, const(S2), immutable(S2))) -+ foreach (Uint; TypeTuple!(U1, const U1, immutable U1)) -+ foreach (Sint; TypeTuple!(S2, const S2, immutable S2)) - { - Uint un = Uint.max; - assertNotThrown(to!Sint(un)); -@@ -410,8 +416,8 @@ unittest - } - - // big unsigned to small signed -- foreach (Uint; TypeTuple!(U2, const(U2), immutable(U2))) -- foreach (Sint; TypeTuple!(S1, const(S1), immutable(S1))) -+ foreach (Uint; TypeTuple!(U2, const U2, immutable U2)) -+ foreach (Sint; TypeTuple!(S1, const S1, immutable S1)) - { - Uint un = Uint.max; - assertThrown(to!Sint(un)); -@@ -420,16 +426,16 @@ unittest - static assert(S1.sizeof < U2.sizeof); - - // small signed to big unsigned -- foreach (Sint; TypeTuple!(S1, const(S1), immutable(S1))) -- foreach (Uint; TypeTuple!(U2, const(U2), immutable(U2))) -+ foreach (Sint; TypeTuple!(S1, const S1, immutable S1)) -+ foreach (Uint; TypeTuple!(U2, const U2, immutable U2)) - { - Sint sn = -1; - assertThrown!ConvOverflowException(to!Uint(sn)); - } - - // big signed to small unsigned -- foreach (Sint; TypeTuple!(S2, const(S2), immutable(S2))) -- foreach (Uint; TypeTuple!(U1, const(U1), immutable(U1))) -+ foreach (Sint; TypeTuple!(S2, const S2, immutable S2)) -+ foreach (Uint; TypeTuple!(U1, const U1, immutable U1)) - { - Sint sn = -1; - assertThrown!ConvOverflowException(to!Uint(sn)); -@@ -446,32 +452,13 @@ T toImpl(T, S)(ref S s) - return toImpl!(T, typeof(s[0])[])(s); - } - --unittest -+@safe pure unittest - { - char[4] test = ['a', 'b', 'c', 'd']; - static assert(!isInputRange!(Unqual!(char[4]))); - assert(to!string(test) == test); - } - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated T toImpl(T, S)(S value) -- if (is(S : Object) && !is(T : Object) && !isSomeString!T && -- hasMember!(S, "to") && is(typeof(S.init.to!T()) : T)) --{ -- return value.to!T(); --} -- --unittest --{ -- debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- class B -- { -- T to(T)() { return 43; } -- } -- auto b = new B; -- assert(to!int(b) == 43); --} -- - /** - When source type supports member template function opCast, is is used. - */ -@@ -482,7 +469,7 @@ T toImpl(T, S)(S value) - return value.opCast!T(); - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - class B -@@ -514,7 +501,7 @@ T toImpl(T, S)(S value) - } - - // Bugzilla 3961 --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - struct Int -@@ -526,14 +513,14 @@ unittest - static struct Int2 - { - int x; -- this(int x) { this.x = x; } -+ this(int x) @safe pure { this.x = x; } - } - Int2 i2 = to!Int2(1); - - static struct Int3 - { - int x; -- static Int3 opCall(int x) -+ static Int3 opCall(int x) @safe pure - { - Int3 i; - i.x = x; -@@ -544,11 +531,11 @@ unittest - } - - // Bugzilla 6808 --unittest -+@safe pure unittest - { - static struct FakeBigInt - { -- this(string s){} -+ this(string s) @safe pure {} - } - - string s = "101"; -@@ -563,7 +550,7 @@ T toImpl(T, S)(S value) - return new T(value); - } - --unittest -+@safe pure unittest - { - static struct S - { -@@ -572,14 +559,14 @@ unittest - static class C - { - int x; -- this(int x) { this.x = x; } -+ this(int x) @safe pure { this.x = x; } - } - - static class B - { - int value; -- this(S src) { value = src.x; } -- this(C src) { value = src.x; } -+ this(S src) @safe pure { value = src.x; } -+ this(C src) @safe pure { value = src.x; } - } - - S s = S(1); -@@ -594,34 +581,35 @@ unittest - assert(c2.x == 3); - } - --version (unittest) -+@safe pure unittest - { -- class A -- { -- this(B b) {} -- } -- class B : A -+ struct S - { -- this() { super(this); } -+ class A -+ { -+ this(B b) @safe pure {} -+ } -+ class B : A -+ { -+ this() @safe pure { super(this); } -+ } - } --} --unittest --{ -- B b = new B(); -- A a = to!A(b); // == cast(A)b -- // (do not run construction conversion like new A(b)) -+ -+ S.B b = new S.B(); -+ S.A a = to!(S.A)(b); // == cast(S.A)b -+ // (do not run construction conversion like new S.A(b)) - assert(b is a); - - static class C : Object - { -- this() {} -- this(Object o) {} -+ this() @safe pure {} -+ this(Object o) @safe pure {} - } - - Object oc = new C(); - C a2 = to!C(oc); // == new C(a) - // Construction conversion overrides down-casting conversion -- assert(a2 != a); // -+ assert(a2 !is a); // - } - - /** -@@ -669,7 +657,7 @@ T toImpl(T, S)(S value) - } - static assert(isModConvertible, "Bad modifier conversion: "~S.stringof~" to "~T.stringof); - -- auto result = cast(T) value; -+ auto result = ()@trusted{ return cast(T) value; }(); - if (!result && value) - { - throw new ConvException("Cannot convert object of static type " -@@ -679,7 +667,7 @@ T toImpl(T, S)(S value) - return result; - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - // Testing object conversions -@@ -693,14 +681,14 @@ unittest - } - - // Unittest for 6288 --version (unittest) -+@safe pure unittest - { -- private template Identity(T) { alias T Identity; } -- private template toConst(T) { alias const(T) toConst; } -- private template toShared(T) { alias shared(T) toShared; } -- private template toSharedConst(T) { alias shared(const(T)) toSharedConst; } -- private template toImmutable(T) { alias immutable(T) toImmutable; } -- private template AddModifier(int n) if (0 <= n && n < 5) -+ template Identity(T) { alias T Identity; } -+ template toConst(T) { alias const(T) toConst; } -+ template toShared(T) { alias shared(T) toShared; } -+ template toSharedConst(T) { alias shared(const(T)) toSharedConst; } -+ template toImmutable(T) { alias immutable(T) toImmutable; } -+ template AddModifier(int n) if (0 <= n && n < 5) - { - static if (n == 0) alias Identity AddModifier; - else static if (n == 1) alias toConst AddModifier; -@@ -708,9 +696,7 @@ version (unittest) - else static if (n == 3) alias toSharedConst AddModifier; - else static if (n == 4) alias toImmutable AddModifier; - } --} --unittest --{ -+ - interface I {} - interface J {} - -@@ -784,10 +770,12 @@ $(UL - $(DD Convert integral value to string in $(D_PARAM radix) radix. - radix must be a value from 2 to 36. - value is treated as a signed value only if radix is 10. -- The characters A through Z are used to represent values 10 through 36.))) -+ The characters A through Z are used to represent values 10 through 36 -+ and their case is determined by the $(D_PARAM letterCase) parameter.))) - $(LI All floating point types to all string types.) - $(LI Pointer to string conversions prints the pointer as a $(D size_t) value. -- If pointer is $(D char*), treat it as C-style strings.)) -+ If pointer is $(D char*), treat it as C-style strings. -+ In that case, this function is $(D @system).)) - */ - T toImpl(T, S)(S value) - if (!(isImplicitlyConvertible!(S, T) && -@@ -810,8 +798,16 @@ T toImpl(T, S)(S value) - } - else static if (isExactSomeString!S) - { -- // other string-to-string conversions always run decode/encode -- return toStr!T(value); -+ // other string-to-string -+ //Use Appender directly instead of toStr, which also uses a formatedWrite -+ auto w = appender!T(); -+ w.put(value); -+ return w.data; -+ } -+ else static if (isIntegral!S && !is(S == enum)) -+ { -+ // other integral-to-string conversions with default radix -+ return toImpl!(T, S)(value, 10); - } - else static if (is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) - { -@@ -823,13 +819,47 @@ T toImpl(T, S)(S value) - ~ S.stringof ~ " to a " - ~ T.stringof)); - auto result = new Char[raw.length / Char.sizeof]; -- memcpy(result.ptr, value.ptr, value.length); -+ ()@trusted{ memcpy(result.ptr, value.ptr, value.length); }(); - return cast(T) result; - } - else static if (isPointer!S && is(S : const(char)*)) - { -+ // It is unsafe because we cannot guarantee that the pointer is null terminated. - return value ? cast(T) value[0 .. strlen(value)].dup : cast(string)null; - } -+ else static if (isSomeString!T && is(S == enum)) -+ { -+ static if (isSwitchable!(OriginalType!S) && EnumMembers!S.length <= 50) -+ { -+ switch(value) -+ { -+ foreach (I, member; NoDuplicates!(EnumMembers!S)) -+ { -+ case member: -+ return to!T(enumRep!(immutable(T), S, I)); -+ } -+ default: -+ } -+ } -+ else -+ { -+ foreach (I, member; EnumMembers!S) -+ { -+ if (value == member) -+ return to!T(enumRep!(immutable(T), S, I)); -+ } -+ } -+ -+ //Default case, delegate to format -+ //Note: we don't call toStr directly, to avoid duplicate work. -+ auto app = appender!T(); -+ app.put("cast("); -+ app.put(S.stringof); -+ app.put(')'); -+ FormatSpec!char f; -+ formatValue(app, cast(OriginalType!S)value, f); -+ return app.data; -+ } - else - { - // other non-string values runs formatting -@@ -837,48 +867,81 @@ T toImpl(T, S)(S value) - } - } - -+/* -+ Check whether type $(D T) can be used in a switch statement. -+ This is useful for compile-time generation of switch case statements. -+*/ -+private template isSwitchable(E) -+{ -+ enum bool isSwitchable = is(typeof({ -+ switch (E.init) { default: } -+ })); -+} -+ -+// - unittest - { -- // string to string conversion -- debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -+ static assert(isSwitchable!int); -+ static assert(!isSwitchable!double); -+ static assert(!isSwitchable!real); -+} -+ -+//Static representation of the index I of the enum S, -+//In representation T. -+//T must be an immutable string (avoids un-necessary initializations). -+private template enumRep(T, S, size_t I) -+if (is (T == immutable) && isExactSomeString!T && is(S == enum)) -+{ -+ static T enumRep = to!T(__traits(allMembers, S)[I]); -+} - -- alias TypeTuple!(char, wchar, dchar) Chars; -- foreach (LhsC; Chars) -+@safe pure unittest -+{ -+ void dg() - { -- alias TypeTuple!(LhsC[], const(LhsC)[], immutable(LhsC)[]) LhStrings; -- foreach (Lhs; LhStrings) -+ // string to string conversion -+ debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -+ -+ alias TypeTuple!(char, wchar, dchar) Chars; -+ foreach (LhsC; Chars) - { -- foreach (RhsC; Chars) -+ alias TypeTuple!(LhsC[], const(LhsC)[], immutable(LhsC)[]) LhStrings; -+ foreach (Lhs; LhStrings) - { -- alias TypeTuple!(RhsC[], const(RhsC)[], immutable(RhsC)[]) -- RhStrings; -- foreach (Rhs; RhStrings) -+ foreach (RhsC; Chars) - { -- Lhs s1 = to!Lhs("wyda"); -- Rhs s2 = to!Rhs(s1); -- //writeln(Lhs.stringof, " -> ", Rhs.stringof); -- assert(s1 == to!Lhs(s2)); -+ alias TypeTuple!(RhsC[], const(RhsC)[], immutable(RhsC)[]) -+ RhStrings; -+ foreach (Rhs; RhStrings) -+ { -+ Lhs s1 = to!Lhs("wyda"); -+ Rhs s2 = to!Rhs(s1); -+ //writeln(Lhs.stringof, " -> ", Rhs.stringof); -+ assert(s1 == to!Lhs(s2)); -+ } - } - } - } -- } - -- foreach (T; Chars) -- { -- foreach (U; Chars) -+ foreach (T; Chars) - { -- T[] s1 = to!(T[])("Hello, world!"); -- auto s2 = to!(U[])(s1); -- assert(s1 == to!(T[])(s2)); -- auto s3 = to!(const(U)[])(s1); -- assert(s1 == to!(T[])(s3)); -- auto s4 = to!(immutable(U)[])(s1); -- assert(s1 == to!(T[])(s4)); -+ foreach (U; Chars) -+ { -+ T[] s1 = to!(T[])("Hello, world!"); -+ auto s2 = to!(U[])(s1); -+ assert(s1 == to!(T[])(s2)); -+ auto s3 = to!(const(U)[])(s1); -+ assert(s1 == to!(T[])(s3)); -+ auto s4 = to!(immutable(U)[])(s1); -+ assert(s1 == to!(T[])(s4)); -+ } - } - } -+ dg(); -+ assertCTFEable!dg; - } - --unittest -+@safe pure unittest - { - // Conversion reinterpreting void array to string - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -891,7 +954,7 @@ unittest - assert(c == "abcx"); - } - --unittest -+@system pure unittest - { - // char* to string conversion - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -901,7 +964,7 @@ unittest - assert(to!string("foo\0".ptr) == "foo"); - } - --unittest -+@safe pure unittest - { - // Conversion representing bool value with string - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -912,15 +975,15 @@ unittest - assert(to!string(b) == "true"); - } - --unittest -+@safe pure unittest - { - // Conversion representing character value with string - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - - alias TypeTuple!( -- char, wchar, dchar, -- const(char), const(wchar), const(dchar), -- immutable(char), immutable(wchar), immutable(dchar)) AllChars; -+ char, const( char), immutable( char), -+ wchar, const(wchar), immutable(wchar), -+ dchar, const(dchar), immutable(dchar)) AllChars; - foreach (Char1; AllChars) - { - foreach (Char2; AllChars) -@@ -942,7 +1005,7 @@ unittest - assert(s2 == "foo"); - } - --unittest -+@safe pure unittest - { - // Conversion representing integer values with string - -@@ -974,9 +1037,16 @@ unittest - assert(wtext(int.max) == "2147483647"w); - assert(wtext(int.min) == "-2147483648"w); - assert(to!string(0L) == "0"); -+ -+ assertCTFEable!( -+ { -+ assert(to!string(1uL << 62) == "4611686018427387904"); -+ assert(to!string(0x100000000) == "4294967296"); -+ assert(to!string(-138L) == "-138"); -+ }); - } - --unittest -+@safe pure unittest - { - // Conversion representing dynamic/static array with string - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -984,12 +1054,14 @@ unittest - long[] b = [ 1, 3, 5 ]; - auto s = to!string(b); - assert(to!string(b) == "[1, 3, 5]", s); -- -+} -+/*@safe pure */unittest // sprintf issue -+{ - double[2] a = [ 1.5, 2.5 ]; - assert(to!string(a) == "[1.5, 2.5]"); - } - --unittest -+/*@safe pure */unittest - { - // Conversion representing associative array with string - int[string] a = ["0":1, "1":2]; -@@ -1073,8 +1145,36 @@ unittest - assert(to!dstring(o) == "cast(EU)5"d); - } - -+unittest -+{ -+ enum E -+ { -+ foo, -+ bar, -+ doo = foo, // check duplicate switch statements -+ } -+ -+ foreach (S; TypeTuple!(string, wstring, dstring, const(char[]), const(wchar[]), const(dchar[]))) -+ { -+ auto s1 = to!S(E.foo); -+ auto s2 = to!S(E.foo); -+ assert(s1 == s2); -+ // ensure we don't allocate when it's unnecessary -+ assert(s1 is s2); -+ } -+ -+ foreach (S; TypeTuple!(char[], wchar[], dchar[])) -+ { -+ auto s1 = to!S(E.foo); -+ auto s2 = to!S(E.foo); -+ assert(s1 == s2); -+ // ensure each mutable array is unique -+ assert(s1 !is s2); -+ } -+} -+ - /// ditto --T toImpl(T, S)(S value, uint radix) -+@trusted pure T toImpl(T, S)(S value, uint radix, LetterCase letterCase = LetterCase.upper) - if (isIntegral!S && - isExactSomeString!T) - in -@@ -1083,34 +1183,71 @@ in - } - body - { -- static if (!is(IntegralTypeOf!S == ulong)) -- { -- enforce(radix >= 2 && radix <= 36, new ConvException("Radix error")); -- if (radix == 10) -- return to!string(value); // handle signed cases only for radix 10 -- return to!string(cast(ulong) value, radix); -- } -- else -+ alias EEType = Unqual!(ElementEncodingType!T); -+ -+ T toStringRadixConvert(size_t bufLen, uint radix = 0, bool neg = false)(uint runtimeRadix = 0) - { -- char[value.sizeof * 8] buffer; -- uint i = buffer.length; -+ static if (neg) -+ ulong div = void, mValue = unsigned(-value); -+ else -+ Unsigned!(Unqual!S) div = void, mValue = unsigned(value); - -- if (value < radix && value < hexDigits.length) -- return hexDigits[cast(size_t)value .. cast(size_t)value + 1]; -+ size_t index = bufLen; -+ EEType[bufLen] buffer = void; -+ char baseChar = letterCase == LetterCase.lower ? 'a' : 'A'; -+ char mod = void; - - do - { -- ubyte c; -- c = cast(ubyte)(value % radix); -- value = value / radix; -- i--; -- buffer[i] = cast(char)((c < 10) ? c + '0' : c + 'A' - 10); -- } while (value); -- return to!T(buffer[i .. $].dup); -+ static if (radix == 0) -+ { -+ div = cast(S)(mValue / runtimeRadix ); -+ mod = cast(ubyte)(mValue % runtimeRadix); -+ mod += mod < 10 ? '0' : baseChar - 10; -+ } -+ else static if (radix > 10) -+ { -+ div = cast(S)(mValue / radix ); -+ mod = cast(ubyte)(mValue % radix); -+ mod += mod < 10 ? '0' : baseChar - 10; -+ } -+ else -+ { -+ div = cast(S)(mValue / radix); -+ mod = mValue % radix + '0'; -+ } -+ buffer[--index] = cast(char)mod; -+ mValue = div; -+ } while (mValue); -+ -+ static if (neg) -+ { -+ buffer[--index] = '-'; -+ } -+ return cast(T)buffer[index .. $].dup; -+ } -+ -+ enforce(radix >= 2 && radix <= 36, new ConvException("Radix error")); -+ -+ switch(radix) -+ { -+ case 10: -+ if (value < 0) -+ return toStringRadixConvert!(S.sizeof * 3 + 1, 10, true)(); -+ else -+ return toStringRadixConvert!(S.sizeof * 3, 10)(); -+ case 16: -+ return toStringRadixConvert!(S.sizeof * 2, 16)(); -+ case 2: -+ return toStringRadixConvert!(S.sizeof * 8, 2)(); -+ case 8: -+ return toStringRadixConvert!(S.sizeof * 3, 8)(); -+ default: -+ return toStringRadixConvert!(S.sizeof * 6)(radix); - } - } - --unittest -+@safe pure unittest - { - foreach (Int; TypeTuple!(uint, ulong)) - { -@@ -1121,6 +1258,8 @@ unittest - assert(to!string(to!Int(15), 2u) == "1111"); - assert(to!string(to!Int(1), 2u) == "1"); - assert(to!string(to!Int(0x1234AF), 16u) == "1234AF"); -+ assert(to!string(to!Int(0x1234BCD), 16u, LetterCase.upper) == "1234BCD"); -+ assert(to!string(to!Int(0x1234AF), 16u, LetterCase.lower) == "1234af"); - } - - foreach (Int; TypeTuple!(int, long)) -@@ -1130,14 +1269,13 @@ unittest - - assert(to!string(to!Int(-10), 10u) == "-10"); - } --} - --/** -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(XREF format, formattedWrite) instead.) -+ assert(to!string(cast(byte)-10, 16) == "F6"); -+ assert(to!string(long.min) == "-9223372036854775808"); -+ assert(to!string(long.max) == "9223372036854775807"); -+} - -- Conversions to string with optional configures. --*/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.format.formattedWrite instead.") - T toImpl(T, S)(S s, in T leftBracket, in T separator = ", ", in T rightBracket = "]") - if (!isSomeChar!(ElementType!S) && (isInputRange!S || isInputRange!(Unqual!S)) && -@@ -1172,7 +1310,7 @@ T toImpl(T, S)(S s, in T leftBracket, in - } - } - --/// ditto -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.format.formattedWrite instead.") - T toImpl(T, S)(ref S s, in T leftBracket, in T separator = " ", in T rightBracket = "]") - if ((is(S == void[]) || is(S == const(void)[]) || is(S == immutable(void)[])) && -@@ -1181,7 +1319,7 @@ T toImpl(T, S)(ref S s, in T leftBracket - return toImpl(s); - } - --/// ditto -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.format.formattedWrite instead.") - T toImpl(T, S)(S s, in T leftBracket, in T keyval = ":", in T separator = ", ", in T rightBracket = "]") - if (isAssociativeArray!S && !is(S == enum) && -@@ -1205,7 +1343,7 @@ T toImpl(T, S)(S s, in T leftBracket, in - return cast(T) result.data; - } - --/// ditto -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.format.formattedWrite instead.") - T toImpl(T, S)(S s, in T nullstr) - if (is(S : Object) && -@@ -1216,7 +1354,7 @@ T toImpl(T, S)(S s, in T nullstr) - return to!T(s.toString()); - } - --/// ditto -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.format.formattedWrite instead.") - T toImpl(T, S)(S s, in T left, in T separator = ", ", in T right = ")") - if (is(S == struct) && !is(typeof(&S.init.toString)) && !isInputRange!S && -@@ -1267,8 +1405,8 @@ fit in the narrower type. - */ - T toImpl(T, S)(S value) - if (!isImplicitlyConvertible!(S, T) && -- (isNumeric!S || isSomeChar!S) && !is(S == enum) && -- (isNumeric!T || isSomeChar!T) && !is(T == enum)) -+ (isNumeric!S || isSomeChar!S || isBoolean!S) && -+ (isNumeric!T || isSomeChar!T || isBoolean!T) && !is(T == enum)) - { - enum sSmallest = mostNegative!S; - enum tSmallest = mostNegative!T; -@@ -1293,10 +1431,10 @@ T toImpl(T, S)(S value) - if (value > T.max) - throw new ConvOverflowException("Conversion positive overflow"); - } -- return cast(T) value; -+ return (ref value)@trusted{ return cast(T) value; }(value); - } - --unittest -+@safe pure unittest - { - dchar a = ' '; - assert(to!char(a) == ' '); -@@ -1319,6 +1457,37 @@ unittest - dchar to4 = to!dchar(from4); - } - -+unittest -+{ -+ // Narrowing conversions from enum -> integral should be allowed, but they -+ // should throw at runtime if the enum value doesn't fit in the target -+ // type. -+ enum E1 : ulong { A = 1, B = 1UL<<48, C = 0 } -+ assert(to!int(E1.A) == 1); -+ assert(to!bool(E1.A) == true); -+ assertThrown!ConvOverflowException(to!int(E1.B)); // E1.B overflows int -+ assertThrown!ConvOverflowException(to!bool(E1.B)); // E1.B overflows bool -+ assert(to!bool(E1.C) == false); -+ -+ enum E2 : long { A = -1L<<48, B = -1<<31, C = 1<<31 } -+ assertThrown!ConvOverflowException(to!int(E2.A)); // E2.A overflows int -+ assertThrown!ConvOverflowException(to!uint(E2.B)); // E2.B overflows uint -+ assert(to!int(E2.B) == -1<<31); // but does not overflow int -+ assert(to!int(E2.C) == 1<<31); // E2.C does not overflow int -+ -+ enum E3 : int { A = -1, B = 1, C = 255, D = 0 } -+ assertThrown!ConvOverflowException(to!ubyte(E3.A)); -+ assertThrown!ConvOverflowException(to!bool(E3.A)); -+ assert(to!byte(E3.A) == -1); -+ assert(to!byte(E3.B) == 1); -+ assert(to!ubyte(E3.C) == 255); -+ assert(to!bool(E3.B) == true); -+ assertThrown!ConvOverflowException(to!byte(E3.C)); -+ assertThrown!ConvOverflowException(to!bool(E3.C)); -+ assert(to!bool(E3.D) == false); -+ -+} -+ - /** - Array-to-array conversion (except when target is a string type) - converts each element in turn by using $(D to). -@@ -1328,19 +1497,18 @@ T toImpl(T, S)(S value) - !isSomeString!S && isDynamicArray!S && - !isExactSomeString!T && isArray!T) - { -- alias typeof(T.init[0]) E; -- auto result = new E[value.length]; -- foreach (i, e; value) -- { -- /* Temporarily cast to mutable type, so we can get it initialized, -- * this is ok because there are no other references to result[] -- */ -- cast()(result[i]) = to!E(e); -+ alias E = typeof(T.init[0]); -+ -+ auto w = appender!(E[])(); -+ w.reserve(value.length); -+ foreach (i, ref e; value) -+ { -+ w.put(to!E(e)); - } -- return result; -+ return w.data; - } - --unittest -+@safe pure unittest - { - // array to array conversions - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -1349,8 +1517,8 @@ unittest - auto b = to!(float[])(a); - assert(b == [ 1.0f, 2, 3 ]); - -- auto c = to!(string[])(b); -- assert(c[0] == "1" && c[1] == "2" && c[2] == "3"); -+ //auto c = to!(string[])(b); -+ //assert(c[0] == "1" && c[1] == "2" && c[2] == "3"); - - immutable(int)[3] d = [ 1, 2, 3 ]; - b = to!(float[])(d); -@@ -1368,6 +1536,13 @@ unittest - } - Wrap[] warr = to!(Wrap[])(["foo", "bar"]); // should work - } -+/*@safe pure */unittest -+{ -+ auto b = [ 1.0f, 2, 3 ]; -+ -+ auto c = to!(string[])(b); -+ assert(c[0] == "1" && c[1] == "2" && c[2] == "3"); -+} - - /** - Associative array to associative array conversion converts each key -@@ -1377,6 +1552,8 @@ T toImpl(T, S)(S value) - if (isAssociativeArray!S && - isAssociativeArray!T && !is(T == enum)) - { -+ /* This code is potentially unsafe. -+ */ - alias KeyType!T K2; - alias ValueType!T V2; - -@@ -1392,7 +1569,7 @@ T toImpl(T, S)(S value) - return cast(T)result; - } - --unittest -+@safe /*pure */unittest - { - // hash to hash conversions - int[string] a; -@@ -1401,7 +1578,7 @@ unittest - auto b = to!(double[dstring])(a); - assert(b["0"d] == 1 && b["1"d] == 2); - } --unittest // Bugzilla 8705, from doc -+@safe /*pure */unittest // Bugzilla 8705, from doc - { - int[string][double[int[]]] a; - auto b = to!(short[wstring][string[double[]]])(a); -@@ -1487,14 +1664,13 @@ private void testFloatingToIntegral(Floa - } - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - -- alias TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong) -- AllInts; -- alias TypeTuple!(float, double, real) AllFloats; -- alias TypeTuple!(AllInts, AllFloats) AllNumerics; -+ alias AllInts = TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong); -+ alias AllFloats = TypeTuple!(float, double, real); -+ alias AllNumerics = TypeTuple!(AllInts, AllFloats); - // test with same type - { - foreach (T; AllNumerics) -@@ -1565,6 +1741,12 @@ unittest - assert(a == 42); - } - } -+} -+/*@safe pure */unittest -+{ -+ alias AllInts = TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong); -+ alias AllFloats = TypeTuple!(float, double, real); -+ alias AllNumerics = TypeTuple!(AllInts, AllFloats); - // test conversions to string - { - foreach (T; AllNumerics) -@@ -1609,7 +1791,7 @@ T toImpl(T, S)(S value) - { - if (value.length) - { -- convError!(S, T)(value); -+ throw convError!(S, T)(value); - } - } - return parse!T(value); -@@ -1624,25 +1806,25 @@ T toImpl(T, S)(S value, uint radix) - { - if (value.length) - { -- convError!(S, T)(value); -+ throw convError!(S, T)(value); - } - } - return parse!T(value, radix); - } - --unittest -+@safe pure unittest - { - // Issue 6668 - ensure no collaterals thrown - try { to!uint("-1"); } - catch (ConvException e) { assert(e.next is null); } - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- foreach (Char; TypeTuple!(char, wchar, dchar)) -+ foreach (Str; TypeTuple!(string, wstring, dstring)) - { -- auto a = to!(Char[])("123"); -+ Str a = "123"; - assert(to!int(a) == 123); - assert(to!double(a) == 123); - } -@@ -1659,7 +1841,8 @@ a ConvException is thrown. - Enums with floating-point or string base types are not supported. - */ - T toImpl(T, S)(S value) -- if (is(T == enum) && !is(S == enum) && is(S : OriginalType!T) -+ if (is(T == enum) && !is(S == enum) -+ && is(typeof(value == OriginalType!T.init)) - && !isFloatingPoint!(OriginalType!T) && !isSomeString!(OriginalType!T)) - { - foreach (Member; EnumMembers!T) -@@ -1671,7 +1854,7 @@ T toImpl(T, S)(S value) - throw new ConvException(format("Value (%s) does not match any member value of enum '%s'", value, T.stringof)); - } - --unittest -+@safe pure unittest - { - enum En8143 : int { A = 10, B = 20, C = 30, D = 20 } - enum En8143[][] m3 = to!(En8143[][])([[10, 30], [30, 10]]); -@@ -1744,17 +1927,17 @@ unittest - * was meaningfully converted. - * - * Example: ---------------- --string test = "123 \t 76.14"; --auto a = parse!uint(test); --assert(a == 123); --assert(test == " \t 76.14"); // parse bumps string --munch(test, " \t\n\r"); // skip ws --assert(test == "76.14"); --auto b = parse!double(test); --assert(b == 76.14); --assert(test == ""); ---------------- -+ * -------------- -+ * string test = "123 \t 76.14"; -+ * auto a = parse!uint(test); -+ * assert(a == 123); -+ * assert(test == " \t 76.14"); // parse bumps string -+ * munch(test, " \t\n\r"); // skip ws -+ * assert(test == "76.14"); -+ * auto b = parse!double(test); -+ * assert(b == 76.14); -+ * assert(test == ""); -+ * -------------- - */ - - Target parse(Target, Source)(ref Source s) -@@ -1765,7 +1948,7 @@ Target parse(Target, Source)(ref Source - { - // smaller types are handled like integers - auto v = .parse!(Select!(Target.min < 0, int, uint))(s); -- auto result = cast(Target) v; -+ auto result = ()@trusted{ return cast(Target) v; }(); - if (result != v) - goto Loverflow; - return result; -@@ -1787,7 +1970,7 @@ Target parse(Target, Source)(ref Source - if (c >= '0' && c <= '9') - { - if (v >= Target.max/10 && -- (v != Target.max/10|| c + sign > maxLastDigit)) -+ (v != Target.max/10 || c + sign > maxLastDigit)) - goto Loverflow; - v = cast(Target) (v * 10 + (c - '0')); - s.popFront(); -@@ -1823,18 +2006,17 @@ Target parse(Target, Source)(ref Source - Loverflow: - throw new ConvOverflowException("Overflow in integral conversion"); - Lerr: -- convError!(Source, Target)(s); -- assert(0); -+ throw convError!(Source, Target)(s); - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - string s = "123"; - auto a = parse!int(s); - } - --unittest -+@safe pure unittest - { - foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)) - { -@@ -1931,7 +2113,7 @@ unittest - } - } - --unittest -+@safe pure unittest - { - // parsing error check - foreach (Int; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong)) -@@ -2010,6 +2192,13 @@ unittest - } - } - -+@safe pure unittest -+{ -+ assertCTFEable!({ string s = "1234abc"; assert(parse! int(s) == 1234 && s == "abc"); }); -+ assertCTFEable!({ string s = "-1234abc"; assert(parse! int(s) == -1234 && s == "abc"); }); -+ assertCTFEable!({ string s = "1234abc"; assert(parse!uint(s) == 1234 && s == "abc"); }); -+} -+ - /// ditto - Target parse(Target, Source)(ref Source s, uint radix) - if (isSomeChar!(ElementType!Source) && -@@ -2061,11 +2250,10 @@ body - Loverflow: - throw new ConvOverflowException("Overflow in integral conversion"); - Lerr: -- convError!(Source, Target)(s, radix); -- assert(0); -+ throw convError!(Source, Target)(s, radix); - } - --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - // @@@BUG@@@ the size of China -@@ -2100,7 +2288,7 @@ unittest - assert(parse!int(s, 10) == -42); - } - --unittest // bugzilla 7302 -+@safe pure unittest // bugzilla 7302 - { - auto r = cycle("2A!"); - auto u = parse!uint(r, 16); -@@ -2125,9 +2313,9 @@ Target parse(Target, Source)(ref Source - } - } - -- if( longest_match > 0 ) -+ if (longest_match > 0) - { -- s = s[longest_match..$]; -+ s = s[longest_match .. $]; - return result ; - } - -@@ -2157,7 +2345,7 @@ unittest - } - } - --unittest // bugzilla 4744 -+@safe pure unittest // bugzilla 4744 - { - enum A { member1, member11, member111 } - assert(to!A("member1" ) == A.member1 ); -@@ -2171,16 +2359,18 @@ Target parse(Target, Source)(ref Source - if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum) && - isFloatingPoint!Target && !is(Target == enum)) - { -- static immutable real negtab[14] = -+ static import core.stdc.math/* : HUGE_VAL*/; -+ -+ static immutable real[14] negtab = - [ 1e-4096L,1e-2048L,1e-1024L,1e-512L,1e-256L,1e-128L,1e-64L,1e-32L, - 1e-16L,1e-8L,1e-4L,1e-2L,1e-1L,1.0L ]; -- static immutable real postab[13] = -+ static immutable real[13] postab = - [ 1e+4096L,1e+2048L,1e+1024L,1e+512L,1e+256L,1e+128L,1e+64L,1e+32L, - 1e+16L,1e+8L,1e+4L,1e+2L,1e+1L ]; - // static immutable string infinity = "infinity"; - // static immutable string nans = "nans"; - -- ConvException bailOut(string msg = null, string fn = __FILE__, size_t ln = __LINE__) -+ ConvException bailOut()(string msg = null, string fn = __FILE__, size_t ln = __LINE__) - { - if (!msg) - msg = "Floating point conversion error"; -@@ -2342,23 +2532,88 @@ Target parse(Target, Source)(ref Source - enforce(ndigits, new ConvException("Error converting input" - " to floating point")); - -- if (msdec) -+ static if (real.mant_dig == 64) - { -- int e2 = 0x3FFF + 63; -+ if (msdec) -+ { -+ int e2 = 0x3FFF + 63; -+ -+ // left justify mantissa -+ while (msdec >= 0) -+ { msdec <<= 1; -+ e2--; -+ } -+ -+ // Stuff mantissa directly into real -+ ()@trusted{ *cast(long*)&ldval = msdec; }(); -+ ()@trusted{ (cast(ushort*)&ldval)[4] = cast(ushort) e2; }(); - -- // left justify mantissa -- while (msdec >= 0) -- { msdec <<= 1; -- e2--; -+ // Exponent is power of 2, not power of 10 -+ ldval = ldexp(ldval,exp); - } -+ } -+ else static if (real.mant_dig == 53) -+ { -+ if (msdec) -+ { -+ //Exponent bias + 52: -+ //After shifting 52 times left, exp must be 1 -+ int e2 = 0x3FF + 52; -+ -+ // right justify mantissa -+ // first 11 bits must be zero, rest is implied bit + mantissa -+ // shift one time less, do rounding, shift again -+ while ((msdec & 0xFFC0_0000_0000_0000) != 0) -+ { -+ msdec = ((cast(ulong)msdec) >> 1); -+ e2++; -+ } -+ -+ //Have to shift one more time -+ //and do rounding -+ if((msdec & 0xFFE0_0000_0000_0000) != 0) -+ { -+ auto roundUp = (msdec & 0x1); -+ -+ msdec = ((cast(ulong)msdec) >> 1); -+ e2++; -+ if(roundUp) -+ { -+ msdec += 1; -+ //If mantissa was 0b1111... and we added +1 -+ //the mantissa should be 0b10000 (think of implicit bit) -+ //and the exponent increased -+ if((msdec & 0x0020_0000_0000_0000) != 0) -+ { -+ msdec = 0x0010_0000_0000_0000; -+ e2++; -+ } -+ } -+ } -+ - -- // Stuff mantissa directly into real -- *cast(long *)&ldval = msdec; -- (cast(ushort *)&ldval)[4] = cast(ushort) e2; -+ // left justify mantissa -+ // bit 11 must be 1 -+ while ((msdec & 0x0010_0000_0000_0000) == 0) -+ { -+ msdec <<= 1; -+ e2--; -+ } - -- // Exponent is power of 2, not power of 10 -- ldval = ldexp(ldval,exp); -+ // Stuff mantissa directly into double -+ // (first including implicit bit) -+ ()@trusted{ *cast(long *)&ldval = msdec; }(); -+ //Store exponent, now overwriting implicit bit -+ ()@trusted{ *cast(long *)&ldval &= 0x000F_FFFF_FFFF_FFFF; }(); -+ ()@trusted{ *cast(long *)&ldval |= ((e2 & 0xFFFUL) << 52); }(); -+ -+ // Exponent is power of 2, not power of 10 -+ ldval = ldexp(ldval,exp); -+ } - } -+ else -+ static assert(false, "Floating point format of real type not supported"); -+ - goto L6; - } - else // not hex -@@ -2555,6 +2810,78 @@ unittest - assert(to!string(r) == to!string(real.max)); - } - -+//Tests for the double implementation -+unittest -+{ -+ import core.stdc.stdlib; -+ static if(real.mant_dig == 53) -+ { -+ //Should be parsed exactly: 53 bit mantissa -+ string s = "0x1A_BCDE_F012_3456p10"; -+ auto x = parse!real(s); -+ assert(x == 0x1A_BCDE_F012_3456p10L); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0xA_BCDE_F012_3456); -+ assert(strtod("0x1ABCDEF0123456p10", null) == x); -+ -+ //Should be parsed exactly: 10 bit mantissa -+ s = "0x3FFp10"; -+ x = parse!real(s); -+ assert(x == 0x03FFp10); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0x000F_F800_0000_0000); -+ assert(strtod("0x3FFp10", null) == x); -+ -+ //60 bit mantissa, round up -+ s = "0xFFF_FFFF_FFFF_FFFFp10"; -+ x = parse!real(s); -+ assert(approxEqual(x, 0xFFF_FFFF_FFFF_FFFFp10)); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0x0000_0000_0000_0000); -+ assert(strtod("0xFFFFFFFFFFFFFFFp10", null) == x); -+ -+ //60 bit mantissa, round down -+ s = "0xFFF_FFFF_FFFF_FF90p10"; -+ x = parse!real(s); -+ assert(approxEqual(x, 0xFFF_FFFF_FFFF_FF90p10)); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0x000F_FFFF_FFFF_FFFF); -+ assert(strtod("0xFFFFFFFFFFFFF90p10", null) == x); -+ -+ //61 bit mantissa, round up 2 -+ s = "0x1F0F_FFFF_FFFF_FFFFp10"; -+ x = parse!real(s); -+ assert(approxEqual(x, 0x1F0F_FFFF_FFFF_FFFFp10)); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0x000F_1000_0000_0000); -+ assert(strtod("0x1F0FFFFFFFFFFFFFp10", null) == x); -+ -+ //61 bit mantissa, round down 2 -+ s = "0x1F0F_FFFF_FFFF_FF10p10"; -+ x = parse!real(s); -+ assert(approxEqual(x, 0x1F0F_FFFF_FFFF_FF10p10)); -+ //1 bit is implicit -+ assert(((*cast(ulong*)&x) & 0x000F_FFFF_FFFF_FFFF) == 0x000F_0FFF_FFFF_FFFF); -+ assert(strtod("0x1F0FFFFFFFFFFF10p10", null) == x); -+ -+ //Huge exponent -+ s = "0x1F_FFFF_FFFF_FFFFp900"; -+ x = parse!real(s); -+ assert(strtod("0x1FFFFFFFFFFFFFp900", null) == x); -+ -+ //exponent too big -> converror -+ s = ""; -+ assertThrown!ConvException(x = parse!real(s)); -+ assert(strtod("0x1FFFFFFFFFFFFFp1024", null) == real.infinity); -+ -+ //-exponent too big -> 0 -+ s = "0x1FFFFFFFFFFFFFp-2000"; -+ x = parse!real(s); -+ assert(x == 0); -+ assert(strtod("0x1FFFFFFFFFFFFFp-2000", null) == x); -+ } -+} -+ - unittest - { - import core.stdc.errno; -@@ -2564,7 +2891,16 @@ unittest - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - struct longdouble - { -- ushort value[5]; -+ static if(real.mant_dig == 64) -+ { -+ ushort value[5]; -+ } -+ else static if(real.mant_dig == 53) -+ { -+ ushort value[4]; -+ } -+ else -+ static assert(false, "Not implemented"); - } - - real ld; -@@ -2573,11 +2909,18 @@ unittest - longdouble x1; - int i; - -- string s = "0x1.FFFFFFFFFFFFFFFEp-16382"; -- ld = parse!real(s); -- assert(s.empty); -+ static if(real.mant_dig == 64) -+ enum s = "0x1.FFFFFFFFFFFFFFFEp-16382"; -+ else static if(real.mant_dig == 53) -+ enum s = "0x1.FFFFFFFFFFFFFFFEp-1000"; -+ else -+ static assert(false, "Floating point format for real not supported"); -+ -+ auto s2 = s.idup; -+ ld = parse!real(s2); -+ assert(s2.empty); - x = *cast(longdouble *)&ld; -- ld1 = strtold("0x1.FFFFFFFFFFFFFFFEp-16382", null); -+ ld1 = strtold(s.ptr, null); - x1 = *cast(longdouble *)&ld1; - assert(x1 == x && ld1 == ld); - -@@ -2588,9 +2931,9 @@ unittest - // printf("\n"); - assert(!errno); - -- s = "1.0e5"; -- ld = parse!real(s); -- assert(s.empty); -+ s2 = "1.0e5"; -+ ld = parse!real(s2); -+ assert(s2.empty); - x = *cast(longdouble *)&ld; - ld1 = strtold("1.0e5", null); - x1 = *cast(longdouble *)&ld1; -@@ -2602,50 +2945,38 @@ unittest - // printf("\n"); - } - --// Unittest for bug 4959 --unittest -+@safe pure unittest - { -- auto s = "0 "; -- auto x = parse!double(s); -- assert(s == " "); -- assert(x == 0.0); --} -+ // Bugzilla 4959 -+ { -+ auto s = "0 "; -+ auto x = parse!double(s); -+ assert(s == " "); -+ assert(x == 0.0); -+ } - --// Unittest for bug 3369 --unittest --{ -+ // Bugzilla 3369 - assert(to!float("inf") == float.infinity); - assert(to!float("-inf") == -float.infinity); --} - --// Unittest for bug 6160 --unittest --{ -+ // Bugzilla 6160 - assert(6_5.536e3L == to!real("6_5.536e3")); // 2^16 - assert(0x1000_000_000_p10 == to!real("0x1000_000_000_p10")); // 7.03687e+13 --} - --// Unittest for bug 6258 --unittest --{ -+ // Bugzilla 6258 - assertThrown!ConvException(to!real("-")); - assertThrown!ConvException(to!real("in")); --} - --// Unittest for bug 7055 --unittest --{ -+ // Bugzilla 7055 - assertThrown!ConvException(to!float("INF2")); --} --unittest --{ -+ - //extra stress testing - auto ssOK = ["1.", "1.1.1", "1.e5", "2e1e", "2a", "2e1_1", - "inf", "-inf", "infa", "-infa", "inf2e2", "-inf2e2"]; - auto ssKO = ["", " ", "2e", "2e+", "2e-", "2ee", "2e++1", "2e--1", "2e_1", "+inf"]; -- foreach(s; ssOK) -+ foreach (s; ssOK) - parse!double(s); -- foreach(s; ssKO) -+ foreach (s; ssKO) - assertThrown!ConvException(parse!double(s)); - } - -@@ -2657,7 +2988,8 @@ Target parse(Target, Source)(ref Source - if (isExactSomeString!Source && - staticIndexOf!(Unqual!Target, dchar, Unqual!(ElementEncodingType!Source)) >= 0) - { -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - static if (is(Unqual!Target == dchar)) - { - Target result = s.front; -@@ -2673,7 +3005,7 @@ Target parse(Target, Source)(ref Source - } - } - --unittest -+@safe pure unittest - { - foreach (Str; TypeTuple!(string, wstring, dstring)) - { -@@ -2694,7 +3026,8 @@ Target parse(Target, Source)(ref Source - if (!isSomeString!Source && isInputRange!Source && isSomeChar!(ElementType!Source) && - isSomeChar!Target && Target.sizeof >= ElementType!Source.sizeof && !is(Target == enum)) - { -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - Target result = s.front; - s.popFront(); - return result; -@@ -2705,24 +3038,23 @@ Target parse(Target, Source)(ref Source - if (isExactSomeString!Source && - is(Unqual!Target == bool)) - { -- if (s.length >= 4 && icmp(s[0 .. 4], "true")==0) -+ if (s.length >= 4 && icmp(s[0 .. 4], "true") == 0) - { - s = s[4 .. $]; - return true; - } -- if (s.length >= 5 && icmp(s[0 .. 5], "false")==0) -+ if (s.length >= 5 && icmp(s[0 .. 5], "false") == 0) - { - s = s[5 .. $]; - return false; - } -- parseError("bool should be case-insensitive 'true' or 'false'"); -- assert(0); -+ throw parseError("bool should be case-insensitive 'true' or 'false'"); - } - - /* - Tests for to!bool and parse!bool - */ --unittest -+@safe pure unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); - debug(conv) printf("conv.to!bool.unittest\n"); -@@ -2753,16 +3085,15 @@ Target parse(Target, Source)(ref Source - if (isExactSomeString!Source && - is(Unqual!Target == typeof(null))) - { -- if (s.length >= 4 && icmp(s[0 .. 4], "null")==0) -+ if (s.length >= 4 && icmp(s[0 .. 4], "null") == 0) - { - s = s[4 .. $]; - return null; - } -- parseError("null should be case-insensitive 'null'"); -- assert(0); -+ throw parseError("null should be case-insensitive 'null'"); - } - --unittest -+@safe pure unittest - { - alias typeof(null) NullType; - auto s1 = "null"; -@@ -2778,7 +3109,7 @@ unittest - assert(m == "maybe"); // m shouldn't change on failure - - auto s = "NULL"; -- assert(parse!(const(NullType))(s) is null); -+ assert(parse!(const NullType)(s) is null); - } - - //Used internally by parse Array/AA, to remove ascii whites -@@ -2787,7 +3118,7 @@ package void skipWS(R)(ref R r) - static if (isSomeString!R) - { - //Implementation inspired from stripLeft. -- foreach(i, dchar c; r) -+ foreach (i, dchar c; r) - { - if (!std.ascii.isWhite(c)) - { -@@ -2800,8 +3131,8 @@ package void skipWS(R)(ref R r) - } - else - { -- for ( ; !r.empty && std.ascii.isWhite(r.front) ; r.popFront()) -- { } -+ for (; !r.empty && std.ascii.isWhite(r.front); r.popFront()) -+ {} - } - } - -@@ -2818,7 +3149,8 @@ Target parse(Target, Source)(ref Source - - parseCheck!s(lbracket); - skipWS(s); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front == rbracket) - { - s.popFront(); -@@ -2828,7 +3160,8 @@ Target parse(Target, Source)(ref Source - { - result ~= parseElement!(ElementType!Target)(s); - skipWS(s); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front != comma) - break; - } -@@ -2862,7 +3195,7 @@ unittest - assert( ia == ia2); - } - --unittest -+@safe pure unittest - { - auto s1 = `[['h', 'e', 'l', 'l', 'o'], "world"]`; - auto a1 = parse!(string[])(s1); -@@ -2873,11 +3206,11 @@ unittest - assert(a2 == ["aaa", "bbb", "ccc"]); - } - --unittest -+@safe pure unittest - { - //Check proper failure - auto s = "[ 1 , 2 , 3 ]"; -- foreach(i ; 0..s.length-1) -+ foreach (i ; 0..s.length-1) - { - auto ss = s[0 .. i]; - assertThrown!ConvException(parse!(int[])(ss)); -@@ -2885,16 +3218,48 @@ unittest - int[] arr = parse!(int[])(s); - } - -+@safe pure unittest -+{ -+ //Checks parsing of strings with escaped characters -+ string s1 = `[ -+ "Contains a\0null!", -+ "tab\there", -+ "line\nbreak", -+ "backslash \\ slash / question \?", -+ "number \x35 five", -+ "unicode \u65E5 sun", -+ "very long \U000065E5 sun" -+ ]`; -+ -+ //Note: escaped characters purposefully replaced and isolated to guarantee -+ //there are no typos in the escape syntax -+ string[] s2 = [ -+ "Contains a" ~ '\0' ~ "null!", -+ "tab" ~ '\t' ~ "here", -+ "line" ~ '\n' ~ "break", -+ "backslash " ~ '\\' ~ " slash / question ?", -+ "number 5 five", -+ "unicode 日 sun", -+ "very long 日 sun" -+ ]; -+ assert(s2 == parse!(string[])(s1)); -+ assert(s1.empty); -+} -+ - /// ditto - Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',') - if (isExactSomeString!Source && - isStaticArray!Target && !is(Target == enum)) - { -- Target result = void; -+ static if (hasIndirections!Target) -+ Target result = Target.init[0].init; -+ else -+ Target result = void; - - parseCheck!s(lbracket); - skipWS(s); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front == rbracket) - { - static if (result.length != 0) -@@ -2911,7 +3276,8 @@ Target parse(Target, Source)(ref Source - goto Lmanyerr; - result[i++] = parseElement!(ElementType!Target)(s); - skipWS(s); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front != comma) - { - if (i != result.length) -@@ -2924,15 +3290,13 @@ Target parse(Target, Source)(ref Source - return result; - - Lmanyerr: -- parseError(text("Too many elements in input, ", result.length, " elements expected.")); -- assert(0); -+ throw parseError(text("Too many elements in input, ", result.length, " elements expected.")); - - Lfewerr: -- parseError(text("Too few elements in input, ", result.length, " elements expected.")); -- assert(0); -+ throw parseError(text("Too few elements in input, ", result.length, " elements expected.")); - } - --unittest -+@safe pure unittest - { - auto s1 = "[1,2,3,4]"; - auto sa1 = parse!(int[4])(s1); -@@ -2958,14 +3322,15 @@ Target parse(Target, Source)(ref Source - if (isExactSomeString!Source && - isAssociativeArray!Target && !is(Target == enum)) - { -- alias typeof(Target.keys[0]) KeyType; -- alias typeof(Target.values[0]) ValueType; -+ alias KeyType = typeof(Target.keys[0]); -+ alias ValType = typeof(Target.values[0]); - - Target result; - - parseCheck!s(lbracket); - skipWS(s); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front == rbracket) - { - s.popFront(); -@@ -2977,18 +3342,20 @@ Target parse(Target, Source)(ref Source - skipWS(s); - parseCheck!s(keyval); - skipWS(s); -- auto val = parseElement!ValueType(s); -+ auto val = parseElement!ValType(s); - skipWS(s); - result[key] = val; -- if (s.empty) convError!(Source, Target)(s); -- if (s.front != comma) break; -+ if (s.empty) -+ throw convError!(Source, Target)(s); -+ if (s.front != comma) -+ break; - } - parseCheck!s(rbracket); - - return result; - } - --unittest -+@safe pure unittest - { - auto s1 = "[1:10, 2:20, 3:30]"; - auto aa1 = parse!(int[int])(s1); -@@ -3003,11 +3370,11 @@ unittest - assert(aa3 == ["aaa":[1], "bbb":[2,3], "ccc":[4,5,6]]); - } - --unittest -+@safe pure unittest - { - //Check proper failure - auto s = "[1:10, 2:20, 3:30]"; -- foreach(i ; 0..s.length-1) -+ foreach (i ; 0 .. s.length-1) - { - auto ss = s[0 .. i]; - assertThrown!ConvException(parse!(int[int])(ss)); -@@ -3019,16 +3386,19 @@ private dchar parseEscape(Source)(ref So - if (isInputRange!Source && isSomeChar!(ElementType!Source)) - { - parseCheck!s('\\'); -- if (s.empty) parseError("Unterminated escape sequence"); -+ if (s.empty) -+ throw parseError("Unterminated escape sequence"); - -- dchar getHexDigit() -+ dchar getHexDigit()(ref Source s_ = s) // workaround - { -- if (s.empty) parseError("Unterminated escape sequence"); -- s.popFront(); -- if (s.empty) parseError("Unterminated escape sequence"); -- dchar c = s.front; -+ if (s_.empty) -+ throw parseError("Unterminated escape sequence"); -+ s_.popFront(); -+ if (s_.empty) -+ throw parseError("Unterminated escape sequence"); -+ dchar c = s_.front; - if (!isHexDigit(c)) -- parseError("Hex digit is missing"); -+ throw parseError("Hex digit is missing"); - return std.ascii.isAlpha(c) ? ((c & ~0x20) - ('A' - 10)) : c - '0'; - } - -@@ -3036,6 +3406,11 @@ private dchar parseEscape(Source)(ref So - - switch (s.front) - { -+ case '"': result = '\"'; break; -+ case '\'': result = '\''; break; -+ case '0': result = '\0'; break; -+ case '?': result = '\?'; break; -+ case '\\': result = '\\'; break; - case 'a': result = '\a'; break; - case 'b': result = '\b'; break; - case 'f': result = '\f'; break; -@@ -3046,14 +3421,12 @@ private dchar parseEscape(Source)(ref So - case 'x': - result = getHexDigit() << 4; - result |= getHexDigit(); -- if (s.empty) parseError("Unterminated escape sequence"); - break; - case 'u': - result = getHexDigit() << 12; - result |= getHexDigit() << 8; - result |= getHexDigit() << 4; - result |= getHexDigit(); -- if (s.empty) parseError("Unterminated escape sequence"); - break; - case 'U': - result = getHexDigit() << 28; -@@ -3064,18 +3437,62 @@ private dchar parseEscape(Source)(ref So - result |= getHexDigit() << 8; - result |= getHexDigit() << 4; - result |= getHexDigit(); -- if (s.empty) parseError("Unterminated escape sequence"); - break; - default: -- parseError("Unknown escape character " ~ to!string(s.front)); -- break; -+ throw parseError("Unknown escape character " ~ to!string(s.front)); - } -+ if (s.empty) -+ throw parseError("Unterminated escape sequence"); - - s.popFront(); - - return result; - } - -+@safe pure unittest -+{ -+ string[] s1 = [ -+ `\"`, `\'`, `\?`, `\\`, `\a`, `\b`, `\f`, `\n`, `\r`, `\t`, `\v`, //Normal escapes -+ //`\141`, //@@@9621@@@ Octal escapes. -+ `\x61`, -+ `\u65E5`, `\U00012456` -+ //`\&`, `\"`, //@@@9621@@@ Named Character Entities. -+ ]; -+ -+ const(dchar)[] s2 = [ -+ '\"', '\'', '\?', '\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v', //Normal escapes -+ //'\141', //@@@9621@@@ Octal escapes. -+ '\x61', -+ '\u65E5', '\U00012456' -+ //'\&', '\"', //@@@9621@@@ Named Character Entities. -+ ]; -+ -+ foreach (i ; 0 .. s1.length) -+ { -+ assert(s2[i] == parseEscape(s1[i])); -+ assert(s1[i].empty); -+ } -+} -+ -+@safe pure unittest -+{ -+ string[] ss = [ -+ `hello!`, //Not an escape -+ `\`, //Premature termination -+ `\/`, //Not an escape -+ `\gggg`, //Not an escape -+ `\xzz`, //Not an hex -+ `\x0`, //Premature hex end -+ `\XB9`, //Not legal hex syntax -+ `\u!!`, //Not a unicode hex -+ `\777`, //Octal is larger than a byte //Note: Throws, but simply because octals are unsupported -+ `\u123`, //Premature hex end -+ `\U123123` //Premature hex end -+ ]; -+ foreach (s ; ss) -+ assertThrown!ConvException(parseEscape(s)); -+} -+ - // Undocumented - Target parseElement(Target, Source)(ref Source s) - if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum) && -@@ -3084,12 +3501,14 @@ Target parseElement(Target, Source)(ref - auto result = appender!Target(); - - // parse array of chars -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front == '[') - return parse!Target(s); - - parseCheck!s('\"'); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front == '\"') - { - s.popFront(); -@@ -3098,7 +3517,7 @@ Target parseElement(Target, Source)(ref - while (true) - { - if (s.empty) -- parseError("Unterminated quoted string"); -+ throw parseError("Unterminated quoted string"); - switch (s.front) - { - case '\"': -@@ -3124,7 +3543,8 @@ Target parseElement(Target, Source)(ref - Target c; - - parseCheck!s('\''); -- if (s.empty) convError!(Source, Target)(s); -+ if (s.empty) -+ throw convError!(Source, Target)(s); - if (s.front != '\\') - { - c = s.front; -@@ -3147,54 +3567,44 @@ Target parseElement(Target, Source)(ref - - - /*************************************************************** -- Convenience functions for converting any number and types of -- arguments into _text (the three character widths). -- -- Example: ------ --assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"); --assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w); --assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d); ------ --*/ --string text(T...)(T args) --{ -- return textImpl!string(args); --} -+ * Convenience functions for converting any number and types of -+ * arguments into _text (the three character widths). -+ */ -+string text(T...)(T args) { return textImpl!string(args); } - ///ditto --wstring wtext(T...)(T args) --{ -- return textImpl!wstring(args); --} -+wstring wtext(T...)(T args) { return textImpl!wstring(args); } - ///ditto --dstring dtext(T...)(T args) --{ -- return textImpl!dstring(args); --} -- --private S textImpl(S, U...)(U args) if (U.length == 0) --{ -- return null; --} -+dstring dtext(T...)(T args) { return textImpl!dstring(args); } - --private S textImpl(S, U...)(U args) if (U.length > 0) -+private S textImpl(S, U...)(U args) - { -- auto result = to!S(args[0]); -- foreach (arg; args[1 .. $]) result ~= to!S(arg); -- return result; -+ static if (U.length == 0) -+ { -+ return null; -+ } -+ else -+ { -+ auto result = to!S(args[0]); -+ foreach (arg; args[1 .. $]) -+ result ~= to!S(arg); -+ return result; -+ } - } -- -+/// - unittest - { -- debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"); -+ assert( text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"c); - assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w); - assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d); -+} -+unittest -+{ - assert(text() is null); - assert(wtext() is null); - assert(dtext() is null); - } - -+ - /*************************************************************** - The $(D octal) facility is intended as an experimental facility to - replace _octal literals starting with $(D '0'), which many find -@@ -3251,7 +3661,7 @@ auto z = octal!"1_000_000u"; - template octal(alias s) - if (isIntegral!(typeof(s))) - { -- enum auto octal = octal!(typeof(s), toStringNow!(s)); -+ enum auto octal = octal!(typeof(s), to!string(s)); - } - - /* -@@ -3444,25 +3854,18 @@ Given a pointer $(D chunk) to uninitiali - as $(D T)), constructs an object of non-$(D class) type $(D T) at that - address. - --This function can be $(D @trusted) if the corresponding constructor of --$(D T) is $(D @safe). -- - Returns: A pointer to the newly constructed object (which is the same - as $(D chunk)). - */ --T* emplace(T)(T* chunk) -- if (!is(T == class)) -+T* emplace(T)(T* chunk) @safe nothrow pure - { -- static T i; // Can't use `= T.init` here because of @@@BUG8902@@@. -- memcpy(chunk, &i, T.sizeof); -- return chunk; --} --///ditto --T* emplace(T)(T* chunk) -- if (is(T == class)) --{ -- *chunk = null; -- return chunk; -+ static assert (is(T* : void*), -+ format("Cannot emplace a %s because it is qualified.", T.stringof)); -+ -+ static assert (is(typeof({static T i;})), -+ format("Cannot emplace a %1$s because %1$s.this() is annotated with @disable.", T.stringof)); -+ -+ return emplaceInitializer(chunk); - } - - version(unittest) private struct __conv_EmplaceTest -@@ -3507,6 +3910,7 @@ unittest - struct S { @disable this(); } - S s = void; - static assert(!__traits(compiles, emplace(&s))); -+ static assert( __traits(compiles, emplace(&s, S.init))); - } - - unittest -@@ -3523,6 +3927,67 @@ unittest - assert(i is null); - } - -+unittest -+{ -+ static struct S {int i = 5;} -+ S[2] s2 = void; -+ emplace(&s2); -+ assert(s2[0].i == 5 && s2[1].i == 5); -+} -+ -+unittest -+{ -+ struct S1 -+ {} -+ -+ struct S2 -+ { -+ void opAssign(S2); -+ } -+ -+ S1 s1 = void; -+ S2 s2 = void; -+ S1[2] as1 = void; -+ S2[2] as2 = void; -+ emplace(&s1); -+ emplace(&s2); -+ emplace(&as1); -+ emplace(&as2); -+} -+ -+unittest -+{ -+ static struct S1 -+ { -+ this(this) @disable; -+ } -+ static struct S2 -+ { -+ this() @disable; -+ } -+ S1[2] ss1 = void; -+ S2[2] ss2 = void; -+ static assert( __traits(compiles, emplace(&ss1))); -+ static assert(!__traits(compiles, emplace(&ss2))); -+ S1 s1 = S1.init; -+ S2 s2 = S2.init; -+ static assert(!__traits(compiles, emplace(&ss1, s1))); -+ static assert( __traits(compiles, emplace(&ss2, s2))); -+} -+ -+unittest -+{ -+ struct S -+ { -+ immutable int i; -+ } -+ S s = void; -+ S[2] ss1 = void; -+ S[2] ss2 = void; -+ emplace(&s, 5); -+ emplace(&ss1, s); -+ emplace(&ss2, ss1); -+} - - /** - Given a pointer $(D chunk) to uninitialized memory (but already typed -@@ -3535,11 +4000,92 @@ $(D T) is $(D @safe). - Returns: A pointer to the newly constructed object (which is the same - as $(D chunk)). - */ --T* emplace(T, Args...)(T* chunk, Args args) -+T* emplace(T, Args...)(T* chunk, auto ref Args args) - if (!is(T == struct) && Args.length == 1) - { -- *chunk = args[0]; -- return chunk; -+ alias Arg = Args[0]; -+ alias arg = args[0]; -+ -+ static assert (is(T* : void*), -+ format("Cannot emplace a %s because it is qualified.", T.stringof)); -+ -+ static assert(is(typeof({T t = args[0];})), -+ format("%s cannot be emplaced from a %s.", T.stringof, Arg.stringof)); -+ -+ static if (isStaticArray!T) -+ { -+ alias UArg = Unqual!Arg; -+ alias E = typeof(chunk.ptr[0]); -+ enum N = T.length; -+ -+ static if (is(Arg : T)) -+ { -+ //Matching static array -+ static if (isAssignable!(T, Arg) && !hasElaborateAssign!T) -+ *chunk = arg; -+ else static if (is(UArg == T)) -+ { -+ memcpy(chunk, &arg, T.sizeof); -+ static if (hasElaborateCopyConstructor!T) -+ typeid(T).postblit(cast(void*)&chunk); -+ } -+ else -+ emplace(chunk, cast(T)arg); -+ } -+ else static if (is(Arg : E[])) -+ { -+ //Matching dynamic array -+ static if (is(typeof((*chunk)[] = arg[])) && !hasElaborateAssign!T) -+ (*chunk)[] = arg[]; -+ else static if (is(UArg == E[])) -+ { -+ assert(N == chunk.length, "Array length missmatch in emplace"); -+ memcpy(cast(void*)chunk, arg.ptr, T.sizeof); -+ static if (hasElaborateCopyConstructor!T) -+ typeid(T).postblit(cast(void*)&chunk); -+ } -+ else -+ emplace(chunk, cast(E[])arg); -+ } -+ else static if (is(Arg : E)) -+ { -+ //Case matching single element to array. -+ static if (is(typeof((*chunk)[] = arg)) && !hasElaborateAssign!T) -+ (*chunk)[] = arg; -+ else static if (is(UArg == E)) -+ { -+ //Note: We copy everything, and then postblit just once. -+ //This is as exception safe as what druntime can provide us. -+ foreach(i; 0 .. N) -+ memcpy(cast(void*)(chunk.ptr + i), &arg, E.sizeof); -+ static if (hasElaborateCopyConstructor!T) -+ typeid(T).postblit(chunk); -+ } -+ else -+ //Alias this. Coerce. -+ emplace(chunk, cast(E)arg); -+ } -+ else static if (is(typeof(emplace(chunk.ptr, arg)))) -+ { -+ //Final case for everything else: -+ //Types that don't match (int to uint[2]) -+ //Recursion for multidimensions -+ static if (is(typeof((*chunk)[] = arg)) && !hasElaborateAssign!T) -+ (*chunk)[] = arg; -+ -+ foreach(i; 0 .. N) -+ emplace(chunk.ptr + i, arg); -+ } -+ else -+ static assert(0, format("Sorry, this implementation doesn't know how to emplace a %s with a %s", T.stringof, Arg.stringof)); -+ -+ return chunk; -+ } -+ else -+ { -+ *chunk = arg; -+ return chunk; -+ } - } - - unittest -@@ -3566,43 +4112,115 @@ unittest - assert(i is k); - } - --// Specialization for struct -+unittest -+{ -+ static struct S -+ { -+ int i = 5; -+ void opAssign(S){assert(0);} -+ } -+ S[2] sa = void; -+ S[2] sb; -+ emplace(&sa, sb); -+ assert(sa[0].i == 5 && sa[1].i == 5); -+} -+ -+/// ditto - T* emplace(T, Args...)(T* chunk, auto ref Args args) - if (is(T == struct)) - { -- void initialize() -- { -- if(auto p = typeid(T).init().ptr) -- memcpy(chunk, p, T.sizeof); -+ static assert (is(T* : void*), -+ format("Cannot emplace a %s because it is qualified.", T.stringof)); -+ -+ static if (Args.length == 1 && is(Args[0] : T) && -+ is (typeof({T t = args[0];})) //Check for legal postblit -+ ) -+ { -+ static if (is(T == Unqual!(Args[0]))) -+ { -+ //Types match exactly: we postblit -+ static if (isAssignable!T && !hasElaborateAssign!T) -+ *chunk = args[0]; -+ else -+ { -+ memcpy(chunk, &args[0], T.sizeof); -+ static if (hasElaborateCopyConstructor!T) -+ typeid(T).postblit(chunk); -+ } -+ } - else -- memset(chunk, 0, T.sizeof); -+ //Alias this. Coerce to type T. -+ emplace(chunk, cast(T)args[0]); - } -- -- static if (is(typeof(chunk.__ctor(args)))) -+ else static if (is(typeof(chunk.__ctor(args)))) - { - // T defines a genuine constructor accepting args - // Go the classic route: write .init first, then call ctor -- initialize(); -+ emplaceInitializer(chunk); - chunk.__ctor(args); - } -+ else static if (is(typeof(T.opCall(args)))) -+ { -+ //Can be built calling opCall -+ emplaceOpCaller(chunk, args); //emplaceOpCaller is deprecated -+ } - else static if (is(typeof(T(args)))) - { - // Struct without constructor that has one matching field for -- // each argument -- *chunk = T(args); -+ // each argument. Individually emplace each field -+ emplaceInitializer(chunk); -+ foreach (i, ref field; chunk.tupleof[0 .. Args.length]) -+ emplace(emplaceGetAddr(field), args[i]); - } -- else //static if (Args.length == 1 && is(Args[0] : T)) -+ else - { -- static assert(Args.length == 1); -- //static assert(0, T.stringof ~ " " ~ Args.stringof); -- // initialize(); -- *chunk = args[0]; -+ //We can't emplace. Try to diagnose a disabled postblit. -+ static assert(!(Args.length == 1 && is(Args[0] : T)), -+ format("Cannot emplace a %1$s because %1$s.this(this) is annotated with @disable.", T.stringof)); -+ -+ //We can't emplace. -+ static assert(false, -+ format("%s cannot be emplaced from %s.", T.stringof, Args[].stringof)); - } -+ - return chunk; - } - --// Test constructor branch -+//emplace helper functions -+private T* emplaceInitializer(T)(T* chunk) @trusted pure nothrow -+{ -+ static if (isAssignable!T && !hasElaborateAssign!T) -+ *chunk = T.init; -+ else -+ { -+ static immutable T init = T.init; -+ memcpy(chunk, &init, T.sizeof); -+ } -+ return chunk; -+} -+private deprecated("Using static opCall for emplace is deprecated. Plase use emplace(chunk, T(args)) instead.") -+T* emplaceOpCaller(T, Args...)(T* chunk, auto ref Args args) -+{ -+ static assert (is(typeof({T t = T.opCall(args);})), -+ format("%s.opCall does not return adequate data for construction.", T.stringof)); -+ return emplace(chunk, chunk.opCall(args)); -+} -+private -+{ -+ //Helper to keep simple aggregate emplace safe. -+ auto emplaceGetAddr(T)(ref T t) @trusted -+ if (is(T == Unqual!T)) -+ { -+ return &t; -+ } -+ auto emplaceGetAddr(T)(ref T t) -+ if (!is(T == Unqual!T)) -+ { -+ return cast(Unqual!T*)&t; -+ } -+} - -+// Test constructor branch - unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -3640,7 +4258,6 @@ unittest - } - - // Test matching fields branch -- - unittest - { - struct S { uint n; } -@@ -3668,17 +4285,571 @@ unittest - assert(s2.a == 2 && s2.b == 3); - } - --// Test assignment branch -+//opAssign -+unittest -+{ -+ static struct S -+ { -+ int i = 5; -+ void opAssign(int){assert(0);} -+ void opAssign(S){assert(0);} -+ } -+ S sa1 = void; -+ S sa2 = void; -+ S sb1 = S(1); -+ emplace(&sa1, sb1); -+ emplace(&sa2, 2); -+ assert(sa1.i == 1); -+ assert(sa2.i == 2); -+} - --// FIXME: no tests -+//postblit precedence -+unittest -+{ -+ //Works, but breaks in "-w -O" because of @@@9332@@@. -+ //Uncomment test when 9332 is fixed. -+ static struct S -+ { -+ int i; -+ -+ this(S other){assert(false);} -+ this(int i){this.i = i;} -+ this(this){} -+ } -+ S a = void; -+ assert(is(typeof({S b = a;}))); //Postblit -+ assert(is(typeof({S b = S(a);}))); //Constructor -+ auto b = S(5); -+ emplace(&a, b); -+ assert(a.i == 5); -+ -+ static struct S2 -+ { -+ int* p; -+ this(const S2){}; -+ } -+ static assert(!is(immutable S2 : S2)); -+ S2 s2 = void; -+ immutable is2 = (immutable S2).init; -+ emplace(&s2, is2); -+} -+ -+//nested structs and postblit -+unittest -+{ -+ static struct S -+ { -+ int* p; -+ this(int i){p = [i].ptr;} -+ this(this) -+ { -+ if (p) -+ p = [*p].ptr; -+ } -+ } -+ static struct SS -+ { -+ S s; -+ void opAssign(const SS) -+ { -+ assert(0); -+ } -+ } -+ SS ssa = void; -+ SS ssb = SS(S(5)); -+ emplace(&ssa, ssb); -+ assert(*ssa.s.p == 5); -+ assert(ssa.s.p != ssb.s.p); -+} -+ -+//disabled postblit -+unittest -+{ -+ static struct S1 -+ { -+ int i; -+ @disable this(this); -+ } -+ S1 s1 = void; -+ static assert( __traits(compiles, emplace(&s1, 1))); -+ static assert(!__traits(compiles, emplace(&s1, S1.init))); -+ -+ static struct S2 -+ { -+ int i; -+ @disable this(this); -+ this(ref S2){} -+ } -+ S2 s2 = void; -+ static assert(!__traits(compiles, emplace(&s2, 1))); -+ static assert( __traits(compiles, emplace(&s2, S2.init))); -+ -+ static struct SS1 -+ { -+ S1 s; -+ } -+ SS1 ss1 = void; -+ static assert( __traits(compiles, emplace(&ss1))); -+ static assert(!__traits(compiles, emplace(&ss1, SS1.init))); -+ -+ static struct SS2 -+ { -+ S2 s; -+ } -+ SS2 ss2 = void; -+ static assert( __traits(compiles, emplace(&ss2))); -+ static assert(!__traits(compiles, emplace(&ss2, SS2.init))); -+ -+ -+ // SS1 sss1 = s1; //This doesn't compile -+ // SS1 sss1 = SS1(s1); //This doesn't compile -+ // So emplace shouldn't compile either -+ static assert(!__traits(compiles, emplace(&sss1, s1))); -+ static assert(!__traits(compiles, emplace(&sss2, s2))); -+} -+ -+//Imutability -+unittest -+{ -+ //Castable immutability -+ { -+ static struct S1 -+ { -+ int i; -+ } -+ static assert(is( immutable(S1) : S1)); -+ S1 sa = void; -+ auto sb = immutable(S1)(5); -+ emplace(&sa, sb); -+ assert(sa.i == 5); -+ } -+ //Un-castable immutability -+ { -+ static struct S2 -+ { -+ int* p; -+ } -+ static assert(!is(immutable(S2) : S2)); -+ S2 sa = void; -+ auto sb = immutable(S2)(null); -+ assert(!__traits(compiles, emplace(&sa, sb))); -+ } -+} -+ -+unittest -+{ -+ static struct S -+ { -+ immutable int i; -+ immutable(int)* j; -+ } -+ S s = void; -+ emplace(&s, 1, null); -+ emplace(&s, 2, &s.i); -+ assert(s is S(2, &s.i)); -+} -+ -+//Context pointer -+unittest -+{ -+ int i = 0; -+ { -+ struct S1 -+ { -+ void foo(){++i;} -+ } -+ S1 sa = void; -+ S1 sb; -+ emplace(&sa, sb); -+ sa.foo(); -+ assert(i == 1); -+ } -+ { -+ struct S2 -+ { -+ void foo(){++i;} -+ this(this){} -+ } -+ S2 sa = void; -+ S2 sb; -+ emplace(&sa, sb); -+ sa.foo(); -+ assert(i == 2); -+ } -+ -+ ////NOTE: THESE WILL COMPILE -+ ////But will not correctly emplace the context pointer -+ ////The problem lies with voldemort, and not emplace. -+ //{ -+ // struct S3 -+ // { -+ // int k; -+ // void foo(){++i;} -+ // } -+ //} -+ //S3 s3 = void; -+ //emplace(&s3); //S3.init has no context pointer information -+ //emplace(&s3, 1); //No way to obtain context pointer once inside emplace -+} -+ -+//Alias this -+unittest -+{ -+ static struct S -+ { -+ int i; -+ } -+ //By Ref -+ { -+ static struct SS1 -+ { -+ int j; -+ S s; -+ alias s this; -+ } -+ S s = void; -+ SS1 ss = SS1(1, S(2)); -+ emplace(&s, ss); -+ assert(s.i == 2); -+ } -+ //By Value -+ { -+ static struct SS2 -+ { -+ int j; -+ S s; -+ S foo() @property{return s;} -+ alias foo this; -+ } -+ S s = void; -+ SS2 ss = SS2(1, S(2)); -+ emplace(&s, ss); -+ assert(s.i == 2); -+ } -+} -+version(unittest) -+{ -+ //Ambiguity -+ struct __std_conv_S -+ { -+ int i; -+ this(__std_conv_SS ss) {assert(0);} -+ static opCall(__std_conv_SS ss) -+ { -+ __std_conv_S s; s.i = ss.j; -+ return s; -+ } -+ } -+ struct __std_conv_SS -+ { -+ int j; -+ __std_conv_S s; -+ ref __std_conv_S foo() @property {s.i = j; return s;} -+ alias foo this; -+ } -+ static assert(is(__std_conv_SS : __std_conv_S)); -+ unittest -+ { -+ __std_conv_S s = void; -+ __std_conv_SS ss = __std_conv_SS(1); -+ -+ __std_conv_S sTest1 = ss; //this calls "SS alias this" (and not "S.this(SS)") -+ emplace(&s, ss); //"alias this" should take precedence in emplace over "opCall" -+ assert(s.i == 1); -+ } -+} -+ -+//Nested classes -+unittest -+{ -+ class A{} -+ static struct S -+ { -+ A a; -+ } -+ S s1 = void; -+ S s2 = S(new A); -+ emplace(&s1, s2); -+ assert(s1.a is s2.a); -+} -+ -+//safety & nothrow & CTFE -+unittest -+{ -+ //emplace should be safe for anything with no elaborate opassign -+ static struct S1 -+ { -+ int i; -+ } -+ static struct S2 -+ { -+ int i; -+ this(int j)@safe nothrow{i = j;} -+ } -+ -+ int i; -+ S1 s1 = void; -+ S2 s2 = void; -+ -+ auto pi = &i; -+ auto ps1 = &s1; -+ auto ps2 = &s2; -+ -+ void foo() @safe nothrow -+ { -+ emplace(pi); -+ emplace(pi, 5); -+ emplace(ps1); -+ emplace(ps1, 5); -+ emplace(ps1, S1.init); -+ emplace(ps2); -+ emplace(ps2, 5); -+ emplace(ps2, S2.init); -+ } -+ -+ T bar(T)() @property -+ { -+ T t/+ = void+/; //CTFE void illegal -+ emplace(&t, 5); -+ return t; -+ } -+ enum a = bar!int; -+ enum b = bar!S1; -+ enum c = bar!S2; -+} -+ -+ -+unittest -+{ -+ struct S -+ { -+ int[2] get(){return [1, 2];} -+ alias get this; -+ } -+ struct SS -+ { -+ int[2] ii; -+ } -+ struct ISS -+ { -+ int[2] ii; -+ } -+ S s; -+ SS ss = void; -+ ISS iss = void; -+ emplace(&ss, s); -+ emplace(&iss, s); -+ assert(ss.ii == [1, 2]); -+ assert(iss.ii == [1, 2]); -+} -+ -+//disable opAssign -+unittest -+{ -+ static struct S -+ { -+ @disable void opAssign(S); -+ } -+ S s; -+ emplace(&s, S.init); -+} -+ -+//opCall -+unittest -+{ -+ int i; -+ //Without constructor -+ { -+ static struct S1 -+ { -+ int i; -+ static S1 opCall(int*){assert(0);} -+ } -+ S1 s = void; -+ static assert(!__traits(compiles, emplace(&s, 1))); -+ static assert( __traits(compiles, emplace(&s, &i))); //(works, but deprected) -+ } -+ //With constructor -+ { -+ static struct S2 -+ { -+ int i = 0; -+ static S2 opCall(int*){assert(0);} -+ static S2 opCall(int){assert(0);} -+ this(int i){this.i = i;} -+ } -+ S2 s = void; -+ static assert( __traits(compiles, emplace(&s, 1))); //(works, but deprected) -+ static assert( __traits(compiles, emplace(&s, &i))); //(works, but deprected) -+ emplace(&s, 1); -+ assert(s.i == 1); -+ } -+ //With postblit ambiguity -+ { -+ static struct S3 -+ { -+ int i = 0; -+ static S3 opCall(ref S3){assert(0);} -+ } -+ S3 s = void; -+ static assert( __traits(compiles, emplace(&s, S3.init))); -+ } -+} -+ -+unittest //@@@9559@@@ -+{ -+ alias Nullable!int I; -+ auto ints = [0, 1, 2].map!(i => i & 1 ? I.init : I(i))(); -+ auto asArray = std.array.array(ints); -+} -+ -+unittest //http://forum.dlang.org/thread/nxbdgtdlmwscocbiypjs@forum.dlang.org -+{ -+ import std.datetime; -+ static struct A -+ { -+ double i; -+ } -+ -+ static struct B -+ { -+ invariant() -+ { -+ if(j == 0) -+ assert(a.i.isNaN, "why is 'j' zero?? and i is not NaN?"); -+ else -+ assert(!a.i.isNaN); -+ } -+ SysTime when; // comment this line avoid the breakage -+ int j; -+ A a; -+ } -+ -+ B b1 = B.init; -+ assert(&b1); // verify that default eyes invariants are ok; -+ -+ auto b2 = B(SysTime(0, UTC()), 1, A(1)); -+ assert(&b2); -+ auto b3 = B(SysTime(0, UTC()), 1, A(1)); -+ assert(&b3); -+ -+ import std.array; -+ auto arr = [b2, b3]; -+ -+ assert(arr[0].j == 1); -+ assert(arr[1].j == 1); -+ auto a2 = arr.array(); // << bang, invariant is raised, also if b2 and b3 are good -+} -+ -+//static arrays -+unittest -+{ -+ static struct S -+ { -+ int[2] ii; -+ } -+ static struct IS -+ { -+ immutable int[2] ii; -+ } -+ int[2] ii; -+ S s = void; -+ IS ims = void; -+ ubyte ub = 2; -+ emplace(&s, ub); -+ emplace(&s, ii); -+ emplace(&ims, ub); -+ emplace(&ims, ii); -+ uint[2] uu; -+ static assert(!__traits(compiles, {S ss = S(uu);})); -+ static assert(!__traits(compiles, emplace(&s, uu))); -+} -+ -+unittest -+{ -+ int[2] sii; -+ int[2] sii2; -+ uint[2] uii; -+ uint[2] uii2; -+ emplace(&sii, 1); -+ emplace(&sii, 1U); -+ emplace(&uii, 1); -+ emplace(&uii, 1U); -+ emplace(&sii, sii2); -+ //emplace(&sii, uii2); //Sorry, this implementation doesn't know how to... -+ //emplace(&uii, sii2); //Sorry, this implementation doesn't know how to... -+ emplace(&uii, uii2); -+ emplace(&sii, sii2[]); -+ //emplace(&sii, uii2[]); //Sorry, this implementation doesn't know how to... -+ //emplace(&uii, sii2[]); //Sorry, this implementation doesn't know how to... -+ emplace(&uii, uii2[]); -+} -+ -+unittest -+{ -+ bool allowDestruction = false; -+ struct S -+ { -+ int i; -+ this(this){} -+ ~this(){assert(allowDestruction);} -+ } -+ S s = S(1); -+ S[2] ss1 = void; -+ S[2] ss2 = void; -+ S[2] ss3 = void; -+ emplace(&ss1, s); -+ emplace(&ss2, ss1); -+ emplace(&ss3, ss2[]); -+ assert(ss1[1] == s); -+ assert(ss2[1] == s); -+ assert(ss3[1] == s); -+ allowDestruction = true; -+} -+ -+unittest -+{ -+ //Checks postblit, construction, and context pointer -+ int count = 0; -+ struct S -+ { -+ this(this) -+ { -+ ++count; -+ } -+ ~this() -+ { -+ --count; -+ } -+ } -+ -+ S s; -+ { -+ S[4] ss = void; -+ emplace(&ss, s); -+ assert(count == 4); -+ } -+ assert(count == 0); -+} -+ -+unittest -+{ -+ struct S -+ { -+ int i; -+ } -+ S s; -+ S[2][2][2] sss = void; -+ emplace(&sss, s); -+} - - private void testEmplaceChunk(void[] chunk, size_t typeSize, size_t typeAlignment, string typeName) - { - enforceEx!ConvException(chunk.length >= typeSize, -- xformat("emplace: Chunk size too small: %s < %s size = %s", -+ format("emplace: Chunk size too small: %s < %s size = %s", - chunk.length, typeName, typeSize)); - enforceEx!ConvException((cast(size_t) chunk.ptr) % typeAlignment == 0, -- xformat("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", -+ format("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", - chunk.ptr, typeAlignment, typeName)); - } - -@@ -3695,7 +4866,8 @@ $(D T) is $(D @safe). - - Returns: A pointer to the newly constructed object. - */ --T emplace(T, Args...)(void[] chunk, auto ref Args args) if (is(T == class)) -+T emplace(T, Args...)(void[] chunk, auto ref Args args) -+ if (is(T == class)) - { - enum classSize = __traits(classInstanceSize, T); - testEmplaceChunk(chunk, classSize, classInstanceAlignment!T, T.stringof); -@@ -3834,3 +5006,138 @@ unittest - toTextRange(-1, result); - assert(result.data == "-1"); - } -+ -+ -+/** -+ Returns the corresponding unsigned value for $(D x) (e.g. if $(D x) has type -+ $(D int), it returns $(D cast(uint) x)). The advantage compared to the cast -+ is that you do not need to rewrite the cast if $(D x) later changes type -+ (e.g from $(D int) to $(D long)). -+ -+ Note that the result is always mutable even if the original type was const -+ or immutable. In order to retain the constness, use $(XREF traits, Unsigned). -+ */ -+auto unsigned(T)(T x) if (isIntegral!T) -+{ -+ return cast(Unqual!(Unsigned!T))x; -+} -+ -+/// -+unittest -+{ -+ uint s = 42; -+ auto u1 = unsigned(s); //not qualified -+ Unsigned!(typeof(s)) u2 = unsigned(s); //same qualification -+ immutable u3 = unsigned(s); //totally qualified -+} -+ -+unittest -+{ -+ foreach(T; TypeTuple!(byte, ubyte)) -+ { -+ static assert(is(typeof(unsigned(cast(T)1)) == ubyte)); -+ static assert(is(typeof(unsigned(cast(const T)1)) == ubyte)); -+ static assert(is(typeof(unsigned(cast(immutable T)1)) == ubyte)); -+ } -+ -+ foreach(T; TypeTuple!(short, ushort)) -+ { -+ static assert(is(typeof(unsigned(cast(T)1)) == ushort)); -+ static assert(is(typeof(unsigned(cast(const T)1)) == ushort)); -+ static assert(is(typeof(unsigned(cast(immutable T)1)) == ushort)); -+ } -+ -+ foreach(T; TypeTuple!(int, uint)) -+ { -+ static assert(is(typeof(unsigned(cast(T)1)) == uint)); -+ static assert(is(typeof(unsigned(cast(const T)1)) == uint)); -+ static assert(is(typeof(unsigned(cast(immutable T)1)) == uint)); -+ } -+ -+ foreach(T; TypeTuple!(long, ulong)) -+ { -+ static assert(is(typeof(unsigned(cast(T)1)) == ulong)); -+ static assert(is(typeof(unsigned(cast(const T)1)) == ulong)); -+ static assert(is(typeof(unsigned(cast(immutable T)1)) == ulong)); -+ } -+} -+ -+auto unsigned(T)(T x) if (isSomeChar!T) -+{ -+ // All characters are unsigned -+ static assert(T.min == 0); -+ return cast(Unqual!T) x; -+} -+ -+unittest -+{ -+ foreach(T; TypeTuple!(char, wchar, dchar)) -+ { -+ static assert(is(typeof(unsigned(cast(T)'A')) == T)); -+ static assert(is(typeof(unsigned(cast(const T)'A')) == T)); -+ static assert(is(typeof(unsigned(cast(immutable T)'A')) == T)); -+ } -+} -+ -+ -+/** -+ Returns the corresponding signed value for $(D x) (e.g. if $(D x) has type -+ $(D uint), it returns $(D cast(int) x)). The advantage compared to the cast -+ is that you do not need to rewrite the cast if $(D x) later changes type -+ (e.g from $(D uint) to $(D ulong)). -+ -+ Note that the result is always mutable even if the original type was const -+ or immutable. In order to retain the constness, use $(XREF traits, Signed). -+ */ -+auto signed(T)(T x) if (isIntegral!T) -+{ -+ return cast(Unqual!(Signed!T))x; -+} -+ -+/// -+unittest -+{ -+ uint u = 42; -+ auto s1 = unsigned(u); //not qualified -+ Unsigned!(typeof(u)) s2 = unsigned(u); //same qualification -+ immutable s3 = unsigned(u); //totally qualified -+} -+ -+unittest -+{ -+ foreach(T; TypeTuple!(byte, ubyte)) -+ { -+ static assert(is(typeof(signed(cast(T)1)) == byte)); -+ static assert(is(typeof(signed(cast(const T)1)) == byte)); -+ static assert(is(typeof(signed(cast(immutable T)1)) == byte)); -+ } -+ -+ foreach(T; TypeTuple!(short, ushort)) -+ { -+ static assert(is(typeof(signed(cast(T)1)) == short)); -+ static assert(is(typeof(signed(cast(const T)1)) == short)); -+ static assert(is(typeof(signed(cast(immutable T)1)) == short)); -+ } -+ -+ foreach(T; TypeTuple!(int, uint)) -+ { -+ static assert(is(typeof(signed(cast(T)1)) == int)); -+ static assert(is(typeof(signed(cast(const T)1)) == int)); -+ static assert(is(typeof(signed(cast(immutable T)1)) == int)); -+ } -+ -+ foreach(T; TypeTuple!(long, ulong)) -+ { -+ static assert(is(typeof(signed(cast(T)1)) == long)); -+ static assert(is(typeof(signed(cast(const T)1)) == long)); -+ static assert(is(typeof(signed(cast(immutable T)1)) == long)); -+ } -+} -+ -+unittest -+{ -+ // issue 10874 -+ enum Test { a = 0 } -+ ulong l = 0; -+ auto t = l.to!Test; -+} ---- a/src/libphobos/src/std/cpuid.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/cpuid.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,207 +0,0 @@ --// Written in the D programming language. -- --/** -- * $(RED Deprecated. It will be removed in January 2013. Please use core.cpuid instead.) -- * -- * Identify the characteristics of the host CPU. -- * -- * Implemented according to: -- --- AP-485 Intel(C) Processor Identification and the CPUID Instruction -- $(LINK http://www.intel.com/design/xeon/applnots/241618.htm) -- --- Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 2A: Instruction Set Reference, A-M -- $(LINK http://developer.intel.com/design/pentium4/manuals/index_new.htm) -- --- AMD CPUID Specification Publication # 25481 -- $(LINK http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf) -- --Example: ----- --import std.cpuid; --import std.stdio; -- --void main() --{ -- writefln(std.cpuid.toString()); --} ----- -- --BUGS: Only works on x86 CPUs -- --Macros: -- WIKI = Phobos/StdCpuid -- --Copyright: Copyright Tomas Lindquist Olsen 2007 - 2009. --License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. --Authors: Tomas Lindquist Olsen <tomas@famolsen.dk> --Source: $(PHOBOSSRC std/_cpuid.d) --*/ --/* -- * Copyright Tomas Lindquist Olsen 2007 - 2009. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE_1_0.txt or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ --module std.cpuid; -- --pragma(msg, "std.cpuid has been deprecated. It will be removed in January 2013. " ~ -- "Please use core.cpuid instead."); -- --import std.string; --import std.conv; --private import core.cpuid; -- --deprecated: -- --version(D_InlineAsm_X86) --{ -- /// Returns everything as a printable string -- string toString() -- { -- string feats; -- if (mmx) feats ~= "MMX "; -- if (fxsr) feats ~= "FXSR "; -- if (sse) feats ~= "SSE "; -- if (sse2) feats ~= "SSE2 "; -- if (sse3) feats ~= "SSE3 "; -- if (ssse3) feats ~= "SSSE3 "; -- if (amd3dnow) feats ~= "3DNow! "; -- if (amd3dnowExt) feats ~= "3DNow!+ "; -- if (amdMmx) feats ~= "MMX+ "; -- if (ia64) feats ~= "IA-64 "; -- if (amd64) feats ~= "AMD64 "; -- if (hyperThreading) feats ~= "HTT"; -- -- return format( -- "Vendor string: %s\n"~ -- "Processor string: %s\n"~ -- "Signature: Family=%d Model=%d Stepping=%d\n"~ -- "Features: %s\n"~ -- "Multithreading: %d threads / %d cores\n", -- vendor, -- processor, -- family, model, stepping, -- feats, -- threadsPerCPU, coresPerCPU); -- -- } -- -- /// Returns vendor string -- alias core.cpuid.vendor vendor; -- /// Returns processor string -- alias core.cpuid.processor processor; -- -- /// Is MMX supported? -- alias core.cpuid.mmx mmx; -- /// Is FXSR supported? -- alias core.cpuid.hasFxsr fxsr; -- /// Is SSE supported? -- alias core.cpuid.sse sse; -- /// Is SSE2 supported? -- alias core.cpuid.sse2 sse2; -- /// Is SSE3 supported? -- alias core.cpuid.sse3 sse3; -- /// Is SSSE3 supported? -- alias core.cpuid.ssse3 ssse3; -- -- /// Is AMD 3DNOW supported? -- alias core.cpuid.amd3dnow amd3dnow; -- /// Is AMD 3DNOW Ext supported? -- alias core.cpuid.amd3dnowExt amd3dnowExt; -- /// Is AMD MMX supported? -- alias core.cpuid.amdMmx amdMmx; -- -- /// Is this an Intel Architecture IA64? -- alias core.cpuid.isItanium ia64; -- /// Is this an AMD 64? -- alias core.cpuid.isX86_64 amd64; -- -- /// Is hyperthreading supported? -- alias core.cpuid.hyperThreading hyperThreading; -- /// Returns number of threads per CPU -- alias core.cpuid.threadsPerCPU threadsPerCPU; -- /// Returns number of cores in CPU -- alias core.cpuid.coresPerCPU coresPerCPU; -- -- @property -- { -- /// Is this an Intel processor? -- bool intel() {return manufac==INTEL;} -- /// Is this an AMD processor? -- bool amd() {return manufac==AMD;} -- -- /// Returns stepping -- uint stepping() {return core.cpuid.stepping;} -- /// Returns model -- uint model() {return core.cpuid.model;} -- /// Returns family -- uint family() {return core.cpuid.family;} -- } -- -- shared static this() -- { -- switch (vendor) -- { -- case "GenuineIntel": -- manufac = INTEL; -- break; -- -- case "AuthenticAMD": -- manufac = AMD; -- break; -- -- default: -- manufac = OTHER; -- } -- } -- -- private: -- // manufacturer -- enum -- { -- OTHER, -- INTEL, -- AMD -- } -- -- __gshared -- { -- uint manufac=OTHER; -- } --} --else --{ -- auto toString() { return "unknown CPU\n"; } -- -- auto vendor() {return "unknown vendor"; } -- auto processor() {return "unknown processor"; } -- -- @property -- { -- bool mmx() {return false; } -- bool fxsr() {return false; } -- bool sse() {return false; } -- bool sse2() {return false; } -- bool sse3() {return false; } -- bool ssse3() {return false; } -- -- bool amd3dnow() {return false; } -- bool amd3dnowExt() {return false; } -- bool amdMmx() {return false; } -- -- bool ia64() {return false; } -- bool amd64() {return false; } -- -- bool hyperThreading() {return false; } -- uint threadsPerCPU() {return 0; } -- uint coresPerCPU() {return 0; } -- -- bool intel() {return false; } -- bool amd() {return false; } -- -- uint stepping() {return 0; } -- uint model() {return 0; } -- uint family() {return 0; } -- } --} ---- a/src/libphobos/src/std/cstream.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/cstream.d 2014-04-01 16:32:51.000000000 +0100 -@@ -38,6 +38,7 @@ class CFile : Stream { - /** - * Create the stream wrapper for the given C file. - * Params: -+ * cfile = a valid C $(B FILE) pointer to wrap. - * mode = a bitwise combination of $(B FileMode.In) for a readable file - * and $(B FileMode.Out) for a writeable file. - * seekable = indicates if the stream should be _seekable. -@@ -102,7 +103,7 @@ class CFile : Stream { - * Ditto - */ - override char ungetc(char c) { -- return cast(char).std.c.stdio.ungetc(c,cfile); -+ return cast(char)std.c.stdio.ungetc(c,cfile); - } - - /** ---- a/src/libphobos/src/std/csv.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/csv.d 2014-04-01 16:32:51.000000000 +0100 -@@ -430,7 +430,7 @@ unittest - int value; - } - -- Layout ans[3]; -+ Layout[3] ans; - ans[0].name = "one"; - ans[0].value = 1; - ans[1].name = "two"; -@@ -481,7 +481,7 @@ unittest - double other; - } - -- Layout ans[2]; -+ Layout[2] ans; - ans[0].name = "\U00010143Hello"; - ans[0].value = 65; - ans[0].other = 63.63; -@@ -528,7 +528,7 @@ unittest - - auto records = csvReader!Layout(str, ["b","c","a"]); - -- Layout ans[2]; -+ Layout[2] ans; - ans[0].name = "Hello"; - ans[0].value = 65; - ans[0].other = 63.63; ---- a/src/libphobos/src/std/ctype.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/ctype.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,200 +0,0 @@ --// Written in the D programming language. -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(LINK2 std_ascii.html, std.ascii) instead.) -- * -- * Simple ASCII character classification functions. -- * For Unicode classification, see $(LINK2 std_uni.html, std.uni). -- * References: -- * $(LINK2 http://www.digitalmars.com/d/ascii-table.html, ASCII Table), -- * $(LINK2 http://en.wikipedia.org/wiki/Ascii, Wikipedia) -- * Macros: -- * WIKI=Phobos/StdCtype -- * -- * Copyright: Copyright Digital Mars 2000 - 2011. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: $(WEB digitalmars.com, Walter Bright) and Jonathan M Davis -- * Source: $(PHOBOSSRC std/_ctype.d) -- */ --module std.ctype; -- --import std.ascii; -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isAlphaNum) instead.) -- * -- * Returns !=0 if c is a letter in the range (0..9, a..z, A..Z). -- */ --deprecated("Please use std.ascii.isAlphaNum instead.") --pure int isalnum(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isAlpha) instead.) -- * -- * Returns !=0 if c is an ascii upper or lower case letter. -- */ --deprecated("Please use std.ascii.isAlpha instead.") --pure int isalpha(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ctype.ascii.isControl) instead.) -- * -- * Returns !=0 if c is a control character. -- */ --deprecated("Please use std.ascii.isControl instead.") --pure int iscntrl(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_CTL) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isDigit) instead.) -- * -- * Returns !=0 if c is a digit. -- */ --deprecated("Please use std.ascii.isDigit instead.") --pure int isdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_DIG) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isLower) instead.) -- * -- * Returns !=0 if c is lower case ascii letter. -- */ --deprecated("Please use std.ascii.isLower instead.") --pure int islower(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_LC) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isPunctuation) instead.) -- * -- * Returns !=0 if c is a punctuation character. -- */ --deprecated("Please use std.ascii.isPunctuation instead.") --pure int ispunct(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_PNC) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isWhite) instead.) -- * -- * Returns !=0 if c is a space, tab, vertical tab, form feed, -- * carriage return, or linefeed. -- */ --deprecated("Please use std.ascii.isWhite instead.") --pure int isspace(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_SPC) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isUpper) instead.) -- * -- * Returns !=0 if c is an upper case ascii character. -- */ --deprecated("Please use std.ascii.isUpper instead.") --pure int isupper(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_UC) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isHexDigit) instead.) -- * -- * Returns !=0 if c is a hex digit (0..9, a..f, A..F). -- */ --deprecated("Please use std.ascii.isHexDigit instead.") --pure int isxdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_HEX) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isGraphical) instead.) -- * -- * Returns !=0 if c is a printing character except for the space character. -- */ --deprecated("Please use std.ascii.isGraphical instead.") --pure int isgraph(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isPrintable) instead.) -- * -- * Returns !=0 if c is a printing character including the space character. -- */ --deprecated("Please use std.ascii.isPrintable instead.") --pure int isprint(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC|_BLK) : 0; } -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.isASCII) instead.) -- * -- * Returns !=0 if c is in the ascii character set, i.e. in the range 0..0x7F. -- */ --deprecated("Please use std.ascii.isASCII instead.") --pure int isascii(dchar c) { return c <= 0x7F; } -- -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.toLower) instead.) -- * -- * If c is an upper case ascii character, -- * return the lower case equivalent, otherwise return c. -- */ --deprecated("Please use std.ascii.toLower instead.") --pure dchar tolower(dchar c) --{ -- return std.ascii.toLower(c); --} -- -- --/** -- * $(RED Deprecated. It will be removed in March 2013. Please use -- * $(D std.ascii.toUpper) instead.) -- * -- * If c is a lower case ascii character, -- * return the upper case equivalent, otherwise return c. -- */ --deprecated("Please use std.ascii.toUpper instead.") --pure dchar toupper(dchar c) --{ -- return std.ascii.toUpper(c); --} -- -- --//============================================================================== --// Private Section. --//============================================================================== --private: -- --enum --{ -- _SPC = 8, -- _CTL = 0x20, -- _BLK = 0x40, -- _HEX = 0x80, -- _UC = 1, -- _LC = 2, -- _PNC = 0x10, -- _DIG = 4, -- _ALP = _UC|_LC, --} -- --immutable ubyte _ctype[128] = --[ -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _CTL,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL|_SPC,_CTL,_CTL, -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL,_CTL, -- _SPC|_BLK,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -- _DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX,_DIG|_HEX, -- _PNC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC|_HEX,_UC, -- _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -- _UC,_UC,_UC,_UC,_UC,_UC,_UC,_UC, -- _UC,_UC,_UC,_PNC,_PNC,_PNC,_PNC,_PNC, -- _PNC,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC|_HEX,_LC, -- _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -- _LC,_LC,_LC,_LC,_LC,_LC,_LC,_LC, -- _LC,_LC,_LC,_PNC,_PNC,_PNC,_PNC,_CTL --]; -- ---- a/src/libphobos/src/std/datetime.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/datetime.d 2014-04-01 16:32:51.000000000 +0100 -@@ -115,7 +115,6 @@ import std.exception; - import std.file; - import std.functional; - import std.math; --import std.metastrings; - import std.path; - import std.range; - import std.stdio; -@@ -612,9 +611,9 @@ public: - test(DateTime(1, 1, 1, 0, 0, 1), UTC(), 10_000_000L); - test(DateTime(0, 12, 31, 23, 59, 59), UTC(), -10_000_000L); - -- test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(dur!"minutes"(-60)), 36_000_000_000L); -- test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(Duration.zero), 0); -- test(DateTime(1, 1, 1, 0, 0, 0), new SimpleTimeZone(dur!"minutes"(60)), -36_000_000_000L); -+ test(DateTime(1, 1, 1, 0, 0, 0), new immutable SimpleTimeZone(dur!"minutes"(-60)), 36_000_000_000L); -+ test(DateTime(1, 1, 1, 0, 0, 0), new immutable SimpleTimeZone(Duration.zero), 0); -+ test(DateTime(1, 1, 1, 0, 0, 0), new immutable SimpleTimeZone(dur!"minutes"(60)), -36_000_000_000L); - } - - /++ -@@ -2161,7 +2160,7 @@ assert(SysTime(DateTime(-7, 4, 5, 7, 45, - } - - { -- immutable stz = new SimpleTimeZone(dur!"minutes"(-3 * 60)); -+ auto stz = new immutable SimpleTimeZone(dur!"minutes"(-3 * 60)); - auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27), stz); - _assertPred!"=="(sysTime, sysTime.toLocalTime()); - _assertPred!"=="(sysTime._stdTime, sysTime.toLocalTime()._stdTime); -@@ -2212,7 +2211,7 @@ assert(SysTime(DateTime(-7, 4, 5, 7, 45, - { - version(testStdDateTime) - { -- immutable stz = new SimpleTimeZone(dur!"minutes"(11 * 60)); -+ auto stz = new immutable SimpleTimeZone(dur!"minutes"(11 * 60)); - auto sysTime = SysTime(DateTime(1982, 1, 4, 8, 59, 7), FracSec.from!"hnsecs"(27)); - _assertPred!"=="(sysTime, sysTime.toOtherTZ(stz)); - _assertPred!"=="(sysTime._stdTime, sysTime.toOtherTZ(stz)._stdTime); -@@ -7390,12 +7389,6 @@ assert(SysTime(DateTime(2000, 6, 4, 12, - return Date(dayOfGregorianCal).daysInMonth; - } - -- //Explicitly undocumented. Do not use. To be removed in March 2013. -- deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow -- { -- return Date(dayOfGregorianCal).daysInMonth; -- } -- - unittest - { - version(testStdDateTime) -@@ -7819,11 +7812,11 @@ assert(SysTime(DateTime(-4, 1, 5, 0, 0, - _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOString(), "+100001020T010101.050789"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(-360))).toISOString(), -+ new immutable SimpleTimeZone(dur!"minutes"(-360))).toISOString(), - "20121221T121212-06:00"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(420))).toISOString(), -+ new immutable SimpleTimeZone(dur!"minutes"(420))).toISOString(), - "20121221T121212+07:00"); - - //Test B.C. -@@ -7964,11 +7957,11 @@ assert(SysTime(DateTime(-4, 1, 5, 0, 0, - _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toISOExtString(), "+10000-10-20T01:01:01.050789"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(-360))).toISOExtString(), -+ new immutable SimpleTimeZone(dur!"minutes"(-360))).toISOExtString(), - "2012-12-21T12:12:12-06:00"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(420))).toISOExtString(), -+ new immutable SimpleTimeZone(dur!"minutes"(420))).toISOExtString(), - "2012-12-21T12:12:12+07:00"); - - //Test B.C. -@@ -8107,11 +8100,11 @@ assert(SysTime(DateTime(-4, 1, 5, 0, 0, - _assertPred!"=="(SysTime(DateTime(10000, 10, 20, 1, 1, 1), FracSec.from!"hnsecs"(507890)).toSimpleString(), "+10000-Oct-20 01:01:01.050789"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(-360))).toSimpleString(), -+ new immutable SimpleTimeZone(dur!"minutes"(-360))).toSimpleString(), - "2012-Dec-21 12:12:12-06:00"); - - _assertPred!"=="(SysTime(DateTime(2012, 12, 21, 12, 12, 12), -- new SimpleTimeZone(dur!"minutes"(420))).toSimpleString(), -+ new immutable SimpleTimeZone(dur!"minutes"(420))).toSimpleString(), - "2012-Dec-21 12:12:12+07:00"); - - //Test B.C. -@@ -8356,21 +8349,21 @@ assert(SysTime.fromISOString("20100704T0 - _assertPred!"=="(SysTime.fromISOString("20101222T172201Z"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); - _assertPred!"=="(SysTime.fromISOString("20101222T172201-1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201-1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201-1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201-8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201+1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201+1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201+1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201+8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(480)))); - - _assertPred!"=="(SysTime.fromISOString("20101103T065106.57159Z"), - SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); -@@ -8379,28 +8372,28 @@ assert(SysTime.fromISOString("20100704T0 - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.23112-1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.45-1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.1-1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), -- new SimpleTimeZone(dur!"minutes"(-90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.55-8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), -- new SimpleTimeZone(dur!"minutes"(-480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.1234567+1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.0+1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.0000000+1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromISOString("20101222T172201.45+8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(480)))); - - //Verify Examples. - assert(SysTime.fromISOString("20100704T070612") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); -@@ -8411,9 +8404,9 @@ assert(SysTime.fromISOString("20100704T0 - - assert(SysTime.fromISOString("20100704T070612Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); - assert(SysTime.fromISOString("20100704T070612-8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(-8)))); - assert(SysTime.fromISOString("20100704T070612+8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(8)))); - } - } - -@@ -8586,21 +8579,21 @@ assert(SysTime.fromISOExtString("2010-07 - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01Z"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01-8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01+8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(480)))); - - _assertPred!"=="(SysTime.fromISOExtString("2010-11-03T06:51:06.57159Z"), - SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); -@@ -8609,28 +8602,28 @@ assert(SysTime.fromISOExtString("2010-07 - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.23112-1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.45-1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.1-1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), -- new SimpleTimeZone(dur!"minutes"(-90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.55-8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), -- new SimpleTimeZone(dur!"minutes"(-480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.1234567+1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.0+1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.0000000+1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromISOExtString("2010-12-22T17:22:01.45+8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(480)))); - - //Verify Examples. - assert(SysTime.fromISOExtString("2010-07-04T07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); -@@ -8643,9 +8636,9 @@ assert(SysTime.fromISOExtString("2010-07 - - assert(SysTime.fromISOExtString("2010-07-04T07:06:12Z") == SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); - assert(SysTime.fromISOExtString("2010-07-04T07:06:12-8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(-8)))); - assert(SysTime.fromISOExtString("2010-07-04T07:06:12+8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(8)))); - } - } - -@@ -8819,21 +8812,21 @@ assert(SysTime.fromSimpleString("2010-Ju - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01Z"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), UTC())); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01-8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(-480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(60)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+1:30"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(90)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01+8:00"), -- SysTime(DateTime(2010, 12, 22, 17, 22, 01), new SimpleTimeZone(dur!"minutes"(480)))); -+ SysTime(DateTime(2010, 12, 22, 17, 22, 01), new immutable SimpleTimeZone(dur!"minutes"(480)))); - - _assertPred!"=="(SysTime.fromSimpleString("2010-Nov-03 06:51:06.57159Z"), - SysTime(DateTime(2010, 11, 3, 6, 51, 6), FracSec.from!"hnsecs"(5715900), UTC())); -@@ -8842,28 +8835,28 @@ assert(SysTime.fromSimpleString("2010-Ju - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_341_200), UTC())); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.23112-1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(2_311_200), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.45-1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(-60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.1-1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_000_000), -- new SimpleTimeZone(dur!"minutes"(-90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-90)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.55-8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(5_500_000), -- new SimpleTimeZone(dur!"minutes"(-480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(-480)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.1234567+1:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(1_234_567), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.0+1"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(60)))); -+ new immutable SimpleTimeZone(dur!"minutes"(60)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.0000000+1:30"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(0), -- new SimpleTimeZone(dur!"minutes"(90)))); -+ new immutable SimpleTimeZone(dur!"minutes"(90)))); - _assertPred!"=="(SysTime.fromSimpleString("2010-Dec-22 17:22:01.45+8:00"), - SysTime(DateTime(2010, 12, 22, 17, 22, 01), FracSec.from!"hnsecs"(4_500_000), -- new SimpleTimeZone(dur!"minutes"(480)))); -+ new immutable SimpleTimeZone(dur!"minutes"(480)))); - - //Verify Examples. - assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12") == SysTime(DateTime(2010, 7, 4, 7, 6, 12))); -@@ -8875,9 +8868,9 @@ assert(SysTime.fromSimpleString("2010-Ju - assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12Z") == - SysTime(DateTime(2010, 7, 4, 7, 6, 12), UTC())); - assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12-8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(-8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(-8)))); - assert(SysTime.fromSimpleString("2010-Jul-04 07:06:12+8:00") == -- SysTime(DateTime(2010, 7, 4, 7, 6, 12), new SimpleTimeZone(dur!"hours"(8)))); -+ SysTime(DateTime(2010, 7, 4, 7, 6, 12), new immutable SimpleTimeZone(dur!"hours"(8)))); - } - } - -@@ -12505,12 +12498,6 @@ assert(Date(2000, 6, 4).daysInMonth == 3 - return maxDay(_year, _month); - } - -- //Explicitly undocumented. Do not use. To be removed in March 2013. -- deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow -- { -- return maxDay(_year, _month); -- } -- - unittest - { - version(testStdDateTime) -@@ -15339,7 +15326,7 @@ public: - { - auto dt = DateTime.init; - dt.timeOfDay = TimeOfDay(12, 30, 33); -- _assertPred!"=="(dt._date, date.init); -+ _assertPred!"=="(dt._date, Date.init); - _assertPred!"=="(dt._tod, TimeOfDay(12, 30, 33)); - - const cdt = DateTime(1999, 7, 6, 12, 30, 33); -@@ -17395,12 +17382,6 @@ assert(DateTime(Date(2000, 6, 4), TimeOf - return _date.daysInMonth; - } - -- //Explicitly undocumented. Do not use. To be removed in March 2013. -- deprecated("Please use daysInMonth instead.") @property ubyte endOfMonthDay() const nothrow -- { -- return _date.daysInMonth; -- } -- - unittest - { - version(testStdDateTime) -@@ -25843,9 +25824,7 @@ static TP delegate(in TP) everyDayOfWeek - (dir == Direction.fwd || dir == Direction.bwd) && - __traits(hasMember, TP, "dayOfWeek") && - !__traits(isStaticFunction, TP.dayOfWeek) && -- is(ReturnType!(TP.dayOfWeek) == DayOfWeek) && -- (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.property) && -- (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.nothrow_)) -+ is(typeof(TP.dayOfWeek) == DayOfWeek)) - { - TP func(in TP tp) - { -@@ -25977,9 +25956,7 @@ static TP delegate(in TP) everyMonth(TP, - (dir == Direction.fwd || dir == Direction.bwd) && - __traits(hasMember, TP, "month") && - !__traits(isStaticFunction, TP.month) && -- is(ReturnType!(TP.month) == Month) && -- (functionAttributes!(TP.month) & FunctionAttribute.property) && -- (functionAttributes!(TP.month) & FunctionAttribute.nothrow_)) -+ is(typeof(TP.month) == Month)) - { - enforceValid!"months"(month); - -@@ -28545,30 +28522,34 @@ private: - this() immutable - { - super("", "", ""); -- tzset(); - } - - -- static shared LocalTime _localTime; -- static bool _initialized; -+ static immutable LocalTime _localTime = new immutable(LocalTime)(); -+ // Use low-lock singleton pattern with _tzsetWasCalled (see http://dconf.org/talks/simcha.html) -+ static bool _lowLock; -+ static shared bool _tzsetWasCalled; - - -+ // This is done so that we can maintain purity in spite of doing an impure -+ // operation the first time that LocalTime() is called. - static immutable(LocalTime) singleton() - { -- //TODO Make this use double-checked locking once shared has been fixed -- //to use memory fences properly. -- if(!_initialized) -+ if(!_lowLock) - { - synchronized - { -- if(!_localTime) -- _localTime = cast(shared LocalTime)new immutable(LocalTime)(); -+ if(!_tzsetWasCalled) -+ { -+ tzset(); -+ _tzsetWasCalled = true; -+ } - } - -- _initialized = true; -+ _lowLock = true; - } - -- return cast(immutable LocalTime)_localTime; -+ return _localTime; - } - } - -@@ -28585,8 +28566,7 @@ public: - +/ - static immutable(UTC) opCall() pure nothrow - { -- alias pure nothrow immutable(UTC) function() FuncType; -- return (cast(FuncType)&singleton)(); -+ return _utc; - } - - -@@ -28699,27 +28679,7 @@ private: - } - - -- static shared UTC _utc; -- static bool _initialized; -- -- -- static immutable(UTC) singleton() -- { -- //TODO Make this use double-checked locking once shared has been fixed -- //to use memory fences properly. -- if(!_initialized) -- { -- synchronized -- { -- if(!_utc) -- _utc = cast(shared UTC)new immutable(UTC)(); -- } -- -- _initialized = true; -- } -- -- return cast(immutable UTC)_utc; -- } -+ static immutable UTC _utc = new immutable(UTC)(); - } - - -@@ -28772,8 +28732,8 @@ public: - - version(testStdDateTime) unittest - { -- auto west = new SimpleTimeZone(dur!"hours"(-8)); -- auto east = new SimpleTimeZone(dur!"hours"(8)); -+ auto west = new immutable SimpleTimeZone(dur!"hours"(-8)); -+ auto east = new immutable SimpleTimeZone(dur!"hours"(8)); - - assert(west.utcToTZ(0) == -288_000_000_000L); - assert(east.utcToTZ(0) == 288_000_000_000L); -@@ -28800,8 +28760,8 @@ public: - - version(testStdDateTime) unittest - { -- auto west = new SimpleTimeZone(dur!"hours"(-8)); -- auto east = new SimpleTimeZone(dur!"hours"(8)); -+ auto west = new immutable SimpleTimeZone(dur!"hours"(-8)); -+ auto east = new immutable SimpleTimeZone(dur!"hours"(8)); - - assert(west.tzToUTC(-288_000_000_000L) == 0); - assert(east.tzToUTC(288_000_000_000L) == 0); -@@ -28851,8 +28811,8 @@ public: - - version(testStdDateTime) unittest - { -- foreach(stz; [new SimpleTimeZone(dur!"hours"(-8), "PST"), -- new SimpleTimeZone(-8 * 60, "PST")]) -+ foreach(stz; [new immutable SimpleTimeZone(dur!"hours"(-8), "PST"), -+ new immutable SimpleTimeZone(-8 * 60, "PST")]) - - { - assert(stz.name == ""); -@@ -28969,7 +28929,7 @@ private: - immutable hours = to!int(hoursStr); - immutable minutes = minutesStr.empty ? 0 : to!int(minutesStr); - -- return new SimpleTimeZone(sign * (dur!"hours"(hours) + dur!"minutes"(minutes))); -+ return new immutable SimpleTimeZone(sign * (dur!"hours"(hours) + dur!"minutes"(minutes))); - } - - version(testStdDateTime) unittest -@@ -28988,77 +28948,77 @@ private: - assertThrown!DateTimeException(SimpleTimeZone.fromISOString("+1:0")); - - assert(SimpleTimeZone.fromISOString("+00:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(0))).utcOffset); - assert(SimpleTimeZone.fromISOString("+00:01").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(1))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(1))).utcOffset); - assert(SimpleTimeZone.fromISOString("+00:10").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(10))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(10))).utcOffset); - assert(SimpleTimeZone.fromISOString("+00:59").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(59))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(59))).utcOffset); - assert(SimpleTimeZone.fromISOString("+01:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(60))).utcOffset); - assert(SimpleTimeZone.fromISOString("+01:30").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(90))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(90))).utcOffset); - assert(SimpleTimeZone.fromISOString("+02:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(120))).utcOffset); - assert(SimpleTimeZone.fromISOString("+08:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(480))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(480))).utcOffset); - assert(SimpleTimeZone.fromISOString("+23:59").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(1439))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(1439))).utcOffset); - - assert(SimpleTimeZone.fromISOString("-00:01").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-1))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-1))).utcOffset); - assert(SimpleTimeZone.fromISOString("-00:10").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-10))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-10))).utcOffset); - assert(SimpleTimeZone.fromISOString("-00:59").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-59))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-59))).utcOffset); - assert(SimpleTimeZone.fromISOString("-01:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-60))).utcOffset); - assert(SimpleTimeZone.fromISOString("-01:30").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-90))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-90))).utcOffset); - assert(SimpleTimeZone.fromISOString("-02:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-120))).utcOffset); - assert(SimpleTimeZone.fromISOString("-08:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-480))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-480))).utcOffset); - assert(SimpleTimeZone.fromISOString("-23:59").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-1439))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-1439))).utcOffset); - - assert(SimpleTimeZone.fromISOString("+0").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(0))).utcOffset); - assert(SimpleTimeZone.fromISOString("+1").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(60))).utcOffset); - assert(SimpleTimeZone.fromISOString("+2").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(120))).utcOffset); - assert(SimpleTimeZone.fromISOString("+23").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(1380))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(1380))).utcOffset); - assert(SimpleTimeZone.fromISOString("+2").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(120))).utcOffset); - - assert(SimpleTimeZone.fromISOString("+0").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(0))).utcOffset); - assert(SimpleTimeZone.fromISOString("+1").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(60))).utcOffset); - assert(SimpleTimeZone.fromISOString("+2").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(120))).utcOffset); - assert(SimpleTimeZone.fromISOString("+23").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(1380))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(1380))).utcOffset); - assert(SimpleTimeZone.fromISOString("+1:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(60))).utcOffset); - assert(SimpleTimeZone.fromISOString("+1:01").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(61))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(61))).utcOffset); - - assert(SimpleTimeZone.fromISOString("-0").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(0))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(0))).utcOffset); - assert(SimpleTimeZone.fromISOString("-1").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-60))).utcOffset); - assert(SimpleTimeZone.fromISOString("-2").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-120))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-120))).utcOffset); - assert(SimpleTimeZone.fromISOString("-23").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-1380))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-1380))).utcOffset); - assert(SimpleTimeZone.fromISOString("-1:00").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-60))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-60))).utcOffset); - assert(SimpleTimeZone.fromISOString("-1:01").utcOffset == -- (new SimpleTimeZone(dur!"minutes"(-61))).utcOffset); -+ (new immutable SimpleTimeZone(dur!"minutes"(-61))).utcOffset); - } - - //Test that converting from an ISO string to a SimpleTimeZone to an ISO String works properly. -@@ -29600,7 +29560,7 @@ assert(tz.dstName == "PDT"); - break; - } - -- return new PosixTimeZone(transitions.idup, leapSeconds.idup, name, stdName, dstName, hasDST); -+ return new immutable PosixTimeZone(transitions.idup, leapSeconds.idup, name, stdName, dstName, hasDST); - } - catch(DateTimeException dte) - throw dte; -@@ -30130,7 +30090,7 @@ else version(Windows) - tzInfo.DaylightDate = tziFmt.DaylightDate; - tzInfo.DaylightBias = tziFmt.DaylightBias; - -- return new WindowsTimeZone(name, tzInfo); -+ return new immutable WindowsTimeZone(name, tzInfo); - } - throw new DateTimeException(format("Failed to find time zone: %s", name)); - } -@@ -30481,6 +30441,7 @@ string tzDatabaseNameToWindowsTZName(str - case "Africa/Johannesburg": return "South Africa Standard Time"; - case "Africa/Lagos": return "W. Central Africa Standard Time"; - case "Africa/Nairobi": return "E. Africa Standard Time"; -+ case "Africa/Tripoli": return "Libya Standard Time"; - case "Africa/Windhoek": return "Namibia Standard Time"; - case "America/Anchorage": return "Alaskan Standard Time"; - case "America/Asuncion": return "Paraguay Standard Time"; -@@ -30675,6 +30636,7 @@ string windowsTZNameToTZDatabaseName(str - case "Kaliningrad Standard Time": return "Europe/Kaliningrad"; - case "Kamchatka Standard Time": return "Asia/Kamchatka"; - case "Korea Standard Time": return "Asia/Seoul"; -+ case "Libya Standard Time": return "Africa/Tripoli"; - case "Magadan Standard Time": return "Asia/Magadan"; - case "Mauritius Standard Time": return "Indian/Mauritius"; - case "Mexico Standard Time": return "America/Mexico_City"; -@@ -33064,10 +33026,7 @@ template hasMin(T) - { - enum hasMin = __traits(hasMember, T, "min") && - __traits(isStaticFunction, T.min) && -- is(ReturnType!(T.min) == Unqual!T) && -- (functionAttributes!(T.min) & FunctionAttribute.property) && -- (functionAttributes!(T.min) & FunctionAttribute.nothrow_); -- //(functionAttributes!(T.min) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's min() can't currently be pure. -+ is(typeof(T.min) == Unqual!T); - } - - unittest -@@ -33097,10 +33056,7 @@ template hasMax(T) - { - enum hasMax = __traits(hasMember, T, "max") && - __traits(isStaticFunction, T.max) && -- is(ReturnType!(T.max) == Unqual!T) && -- (functionAttributes!(T.max) & FunctionAttribute.property) && -- (functionAttributes!(T.max) & FunctionAttribute.nothrow_); -- //(functionAttributes!(T.max) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's max() can't currently be pure. -+ is(typeof(T.max) == Unqual!T); - } - - unittest ---- a/src/libphobos/src/std/digest/digest.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/digest/digest.d 2014-04-01 16:32:51.000000000 +0100 -@@ -178,6 +178,7 @@ module std.digest.digest; - import std.exception, std.range, std.traits; - import std.algorithm : copy; - import std.typetuple : allSatisfy; -+import std.ascii : LetterCase; - - //verify example - unittest -@@ -649,7 +650,7 @@ unittest - * function. - * - * Params: -- * Order= the order in which the bytes are processed (see $(LREF toHexString)) -+ * order= the order in which the bytes are processed (see $(LREF toHexString)) - * range= an $(D InputRange) with $(D ElementType) $(D ubyte), $(D ubyte[]) or $(D ubyte[num]) - * - * -@@ -678,7 +679,7 @@ unittest - * This overload of the hexDigest function handles arrays. - * - * Params: -- * Order= the order in which the bytes are processed (see $(LREF toHexString)) -+ * order= the order in which the bytes are processed (see $(LREF toHexString)) - * data= one or more arrays of any type - * - * Examples: -@@ -901,6 +902,7 @@ enum Order : bool - decreasing /// - } - -+ - /** - * Used to convert a hash value (a static or dynamic array of ubytes) to a string. - * Can be used with the OOP and with the template API. -@@ -908,6 +910,10 @@ enum Order : bool - * The additional order parameter can be used to specify the order of the input data. - * By default the data is processed in increasing order, starting at index 0. To process it in the - * opposite order, pass Order.decreasing as a parameter. -+ * -+ * The additional letterCase parameter can be used to specify the case of the output data. -+ * By default the output is in upper case. To change it to the lower case -+ * pass LetterCase.lower as a parameter. - * - * Examples: - * -------- -@@ -915,7 +921,13 @@ enum Order : bool - * auto crc32 = digest!CRC32("The quick ", "brown ", "fox jumps over the lazy dog"); - * assert(toHexString(crc32) == "39A34F41"); - * -------- -- * -+ * -+ * -------- -+ * //Lower case variant: -+ * auto crc32 = digest!CRC32("The quick ", "brown ", "fox jumps over the lazy dog"); -+ * assert(toHexString!(LetterCase.lower)(crc32) == "39a34f41"); -+ * -------- -+ * - * -------- - * //Usually CRCs are printed in this order, though: - * auto crc32 = digest!CRC32("The quick ", "brown ", "fox jumps over the lazy dog"); -@@ -934,8 +946,19 @@ enum Order : bool - * assert(toHexString!(Order.decreasing)(crc32) == "414FA339"); - * -------- - */ --char[num*2] toHexString(Order order = Order.increasing, size_t num)(in ubyte[num] digest) -+char[num*2] toHexString(Order order = Order.increasing, size_t num, LetterCase letterCase = LetterCase.upper) -+(in ubyte[num] digest) - { -+ static if (letterCase == LetterCase.upper) -+ { -+ import std.ascii : hexDigits = hexDigits; -+ } -+ else -+ { -+ import std.ascii : hexDigits = lowerHexDigits; -+ } -+ -+ - char[num*2] result; - size_t i; - -@@ -943,8 +966,8 @@ char[num*2] toHexString(Order order = Or - { - foreach(u; digest) - { -- result[i++] = std.ascii.hexDigits[u >> 4]; -- result[i++] = std.ascii.hexDigits[u & 15]; -+ result[i++] = hexDigits[u >> 4]; -+ result[i++] = hexDigits[u & 15]; - } - } - else -@@ -952,8 +975,8 @@ char[num*2] toHexString(Order order = Or - size_t j = num - 1; - while(i < num*2) - { -- result[i++] = std.ascii.hexDigits[digest[j] >> 4]; -- result[i++] = std.ascii.hexDigits[digest[j] & 15]; -+ result[i++] = hexDigits[digest[j] >> 4]; -+ result[i++] = hexDigits[digest[j] & 15]; - j--; - } - } -@@ -961,8 +984,24 @@ char[num*2] toHexString(Order order = Or - } - - ///ditto --string toHexString(Order order = Order.increasing)(in ubyte[] digest) -+auto toHexString(LetterCase letterCase, Order order = Order.increasing, size_t num)(in ubyte[num] digest) -+{ -+ return toHexString!(order, num, letterCase)(digest); -+} -+ -+///ditto -+string toHexString(Order order = Order.increasing, LetterCase letterCase = LetterCase.upper) -+(in ubyte[] digest) - { -+ static if (letterCase == LetterCase.upper) -+ { -+ import std.ascii : hexDigits = hexDigits; -+ } -+ else -+ { -+ import std.ascii : hexDigits = lowerHexDigits; -+ } -+ - auto result = new char[digest.length*2]; - size_t i; - -@@ -970,21 +1009,27 @@ string toHexString(Order order = Order.i - { - foreach(u; digest) - { -- result[i++] = std.ascii.hexDigits[u >> 4]; -- result[i++] = std.ascii.hexDigits[u & 15]; -+ result[i++] = hexDigits[u >> 4]; -+ result[i++] = hexDigits[u & 15]; - } - } - else - { - foreach(u; retro(digest)) - { -- result[i++] = std.ascii.hexDigits[u >> 4]; -- result[i++] = std.ascii.hexDigits[u & 15]; -+ result[i++] = hexDigits[u >> 4]; -+ result[i++] = hexDigits[u & 15]; - } - } - return assumeUnique(result); - } - -+///ditto -+auto toHexString(LetterCase letterCase, Order order = Order.increasing)(in ubyte[] digest) -+{ -+ return toHexString!(order, letterCase)(digest); -+} -+ - //For more example unittests, see Digest.digest, digest - - //verify example -@@ -994,6 +1039,8 @@ unittest - //Usually CRCs are printed in this order, though: - auto crc32 = digest!CRC32("The quick ", "brown ", "fox jumps over the lazy dog"); - assert(toHexString!(Order.decreasing)(crc32) == "414FA339"); -+ assert(toHexString!(LetterCase.lower, Order.decreasing)(crc32) == "414fa339"); -+ assert(toHexString!(LetterCase.lower)(crc32) == "39a34f41"); - } - - //verify example -@@ -1013,6 +1060,7 @@ unittest - assert(toHexString(cast(ubyte[4])[42, 43, 44, 45]) == "2A2B2C2D"); - assert(toHexString(cast(ubyte[])[42, 43, 44, 45]) == "2A2B2C2D"); - assert(toHexString!(Order.decreasing)(cast(ubyte[4])[42, 43, 44, 45]) == "2D2C2B2A"); -+ assert(toHexString!(Order.decreasing, LetterCase.lower)(cast(ubyte[4])[42, 43, 44, 45]) == "2d2c2b2a"); - assert(toHexString!(Order.decreasing)(cast(ubyte[])[42, 43, 44, 45]) == "2D2C2B2A"); - } - ---- a/src/libphobos/src/std/digest/md.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/digest/md.d 2014-04-01 16:32:51.000000000 +0100 -@@ -168,11 +168,11 @@ struct MD5 - { - private: - // magic initialization constants -- uint _state[4] = [0x67452301,0xefcdab89,0x98badcfe,0x10325476]; // state (ABCD) -+ uint[4] _state = [0x67452301,0xefcdab89,0x98badcfe,0x10325476]; // state (ABCD) - ulong _count; //number of bits, modulo 2^64 - ubyte[64] _buffer; // input buffer - -- enum ubyte[64] _padding = -+ static immutable ubyte[64] _padding = - [ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -@@ -195,28 +195,28 @@ struct MD5 - */ - static nothrow pure void FF(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += F (b, c, d) + x + cast(uint)(ac); -+ a += F (b, c, d) + x + ac; - a = rotateLeft(a, s); - a += b; - } - - static nothrow pure void GG(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += G (b, c, d) + x + cast(uint)(ac); -+ a += G (b, c, d) + x + ac; - a = rotateLeft(a, s); - a += b; - } - - static nothrow pure void HH(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += H (b, c, d) + x + cast(uint)(ac); -+ a += H (b, c, d) + x + ac; - a = rotateLeft(a, s); - a += b; - } - - static nothrow pure void II(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += I (b, c, d) + x + cast(uint)(ac); -+ a += I (b, c, d) + x + ac; - a = rotateLeft(a, s); - a += b; - } -@@ -259,7 +259,7 @@ struct MD5 - { - for(size_t i = 0; i < 16; i++) - { -- x[i] = littleEndianToNative!uint(cast(ubyte[4])block[i*4..i+4]); -+ x[i] = littleEndianToNative!uint(*cast(ubyte[4]*)&(*block)[i*4]); - } - } - else -@@ -435,13 +435,12 @@ struct MD5 - */ - @trusted nothrow pure ubyte[16] finish() - { -- ubyte[16] data; -+ ubyte[16] data = void; - ubyte[8] bits = void; - uint index, padLen; - - //Save number of bits -- bits[0 .. 4] = nativeToLittleEndian((cast(uint*)&_count)[0])[]; -- bits[4 .. 8] = nativeToLittleEndian((cast(uint*)&_count)[1])[]; -+ bits[0 .. 8] = nativeToLittleEndian(_count)[]; - - //Pad out to 56 mod 64 - index = (cast(uint)_count >> 3) & (64 - 1); ---- a/src/libphobos/src/std/digest/ripemd.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/digest/ripemd.d 2014-04-01 16:32:51.000000000 +0100 -@@ -33,13 +33,15 @@ $(TR $(TDNW Helpers) $(TD $(MYREF ripemd - * The D implementation is a direct translation of the ANSI C implementation by Antoon Bosselaers. - * - * References: -- * $(LINK2 http://homes.esat.kuleuven.be/~bosselae/ripemd160.html, The hash function RIPEMD-160) -- * $(LINK2 http://en.wikipedia.org/wiki/RIPEMD-160, Wikipedia on RIPEMD-160) -+ * $(UL -+ * $(LI $(LINK2 http://homes.esat.kuleuven.be/~bosselae/ripemd160.html, The hash function RIPEMD-160)) -+ * $(LI $(LINK2 http://en.wikipedia.org/wiki/RIPEMD-160, Wikipedia on RIPEMD-160)) -+ * ) - * -- * Source: $(PHOBOSSRC std/digest/_md.d) -+ * Source: $(PHOBOSSRC std/digest/_ripemd.d) - * - * Macros: -- * WIKI = Phobos/StdMd5 -+ * WIKI = Phobos/StdRipemd - * MYREF = <font face='Consolas, "Bitstream Vera Sans Mono", "Andale Mono", Monaco, "DejaVu Sans Mono", "Lucida Console", monospace'><a href="#$1">$1</a> </font> - * - * Examples: -@@ -167,7 +169,7 @@ struct RIPEMD160 - { - private: - // magic initialization constants -- uint _state[5] = [0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0]; // state (ABCDE) -+ uint[5] _state = [0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0]; // state (ABCDE) - ulong _count; //number of bits, modulo 2^64 - ubyte[64] _buffer; // input buffer - -@@ -292,7 +294,7 @@ struct RIPEMD160 - { - for(size_t i = 0; i < 16; i++) - { -- x[i] = littleEndianToNative!uint(cast(ubyte[4])block[i*4..i+4]); -+ x[i] = littleEndianToNative!uint(*cast(ubyte[4]*)&(*block)[i*4]); - } - } - else -@@ -580,13 +582,12 @@ struct RIPEMD160 - */ - @trusted nothrow pure ubyte[20] finish() - { -- ubyte[20] data; -+ ubyte[20] data = void; - ubyte[8] bits = void; - uint index, padLen; - - //Save number of bits -- bits[0 .. 4] = nativeToLittleEndian((cast(uint*)&_count)[0])[]; -- bits[4 .. 8] = nativeToLittleEndian((cast(uint*)&_count)[1])[]; -+ bits[0 .. 8] = nativeToLittleEndian(_count)[]; - - //Pad out to 56 mod 64 - index = (cast(uint)_count >> 3) & (64 - 1); ---- a/src/libphobos/src/std/digest/sha.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/digest/sha.d 2014-04-01 16:32:51.000000000 +0100 -@@ -234,7 +234,7 @@ struct SHA1 - - shared static this() - { -- transform = hasSSSE3Support() ? &transformSSSE3 : &transformX86; -+ transform = hasSSSE3Support ? &transformSSSE3 : &transformX86; - } - } - else -@@ -243,7 +243,7 @@ struct SHA1 - } - - private: -- uint state[5] = /* state (ABCDE) */ -+ uint[5] state = /* state (ABCDE) */ - /* magic initialization constants */ - [0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0]; - -@@ -494,7 +494,7 @@ struct SHA1 - */ - @trusted nothrow pure ubyte[20] finish() - { -- ubyte[20] data; -+ ubyte[20] data = void; - uint index, padLen; - - /* Save number of bits */ -@@ -657,7 +657,10 @@ unittest - string a = "Mary has ", b = "a little lamb"; - int[] c = [ 1, 2, 3, 4, 5 ]; - string d = toHexString(sha1Of(a, b, c)); -- assert(d == "CDBB611D00AC2387B642D3D7BDF4C3B342237110", d); -+ version(LittleEndian) -+ assert(d == "CDBB611D00AC2387B642D3D7BDF4C3B342237110", d); -+ else -+ assert(d == "A0F1196C7A379C09390476D9CA4AA11B71FD11C8", d); - } - - /** ---- a/src/libphobos/src/std/encoding.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/encoding.d 2014-04-01 16:32:51.000000000 +0100 -@@ -645,7 +645,7 @@ template EncoderInstance(E) - //============================================================================= - - /** Defines various character sets. */ --enum AsciiChar : ubyte { init }; -+enum AsciiChar : ubyte { init } - /// Ditto - alias immutable(AsciiChar)[] AsciiString; - -@@ -725,7 +725,7 @@ template EncoderInstance(CharType : Asci - //============================================================================= - - /** Defines an Latin1-encoded character. */ --enum Latin1Char : ubyte { init }; -+enum Latin1Char : ubyte { init } - /** - Defines an Latin1-encoded string (as an array of $(D - immutable(Latin1Char))). -@@ -801,7 +801,7 @@ template EncoderInstance(CharType : Lati - //============================================================================= - - /** Defines a Windows1252-encoded character. */ --enum Windows1252Char : ubyte { init }; -+enum Windows1252Char : ubyte { init } - /** - Defines an Windows1252-encoded string (as an array of $(D - immutable(Windows1252Char))). -@@ -1514,6 +1514,7 @@ unittest - - Params: - s = the string to be counted -+ n = the current code point index - */ - ptrdiff_t index(E)(const(E)[] s,int n) - in -@@ -1688,7 +1689,8 @@ body - Standards: Unicode 5.0, ASCII, ISO-8859-1, WINDOWS-1252 - - Params: -- c = the code point to be encoded -+ c = the code point to be encoded -+ array = the destination array - - Returns: - the number of code units written to the array -@@ -1780,23 +1782,30 @@ size_t encode(E, R)(dchar c, R range) - { - if (c <= 0xFFFF) - { -- r.put(cast(wchar) c); -+ range.put(cast(wchar) c); - return 1; - } -- r.put(cast(wchar) ((((c - 0x10000) >> 10) & 0x3FF) + 0xD800)); -- r.put(cast(wchar) (((c - 0x10000) & 0x3FF) + 0xDC00)); -+ range.put(cast(wchar) ((((c - 0x10000) >> 10) & 0x3FF) + 0xD800)); -+ range.put(cast(wchar) (((c - 0x10000) & 0x3FF) + 0xDC00)); - return 2; - } - else static if (is(Unqual!E == dchar)) - { -- r.put(c); -+ range.put(c); - return 1; - } - else - { -- assert(0); -+ static assert(0); - } - } -+unittest -+{ -+ Appender!(char[]) r; -+ assert(encode!(char)('T', r) == 1); -+ assert(encode!(wchar)('T', r) == 1); -+ assert(encode!(dchar)('T', r) == 1); -+} - - /** - Encodes a single code point to a delegate. -@@ -1817,7 +1826,8 @@ size_t encode(E, R)(dchar c, R range) - Standards: Unicode 5.0, ASCII, ISO-8859-1, WINDOWS-1252 - - Params: -- c = the code point to be encoded -+ c = the code point to be encoded -+ dg = the delegate to invoke for each code unit - */ - void encode(E)(dchar c, void delegate(E) dg) - in -@@ -1898,7 +1908,7 @@ unittest - Standards: Unicode 5.0, ASCII, ISO-8859-1, WINDOWS-1252 - - Params: -- d = the code point to be encoded -+ c = the code point to be encoded - - Examples: - -------------------------------------------------------- -@@ -2145,7 +2155,8 @@ abstract class EncodingScheme - * The input to this function MUST be a valid code point. - * - * Params: -- * c = the code point to be encoded -+ * c = the code point to be encoded -+ * buffer = the destination array - * - * Returns: - * the number of ubytes written. -@@ -2333,6 +2344,7 @@ abstract class EncodingScheme - * - * Params: - * s = the string to be counted -+ * n = the current code point index - */ - ptrdiff_t index(const(ubyte)[] s, size_t n) - in ---- a/src/libphobos/src/std/exception.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/exception.d 2014-04-01 16:32:51.000000000 +0100 -@@ -5,33 +5,33 @@ - handling. It also defines functions intended to aid in unit testing. - - Synopsis of some of std.exception's functions: ---------------------- --string synopsis() --{ -- FILE* f = enforce(fopen("some/file")); -- // f is not null from here on -- FILE* g = enforceEx!WriteException(fopen("some/other/file", "w")); -- // g is not null from here on -- -- Exception e = collectException(write(g, readln(f))); -- if (e) -- { -- ... an exception occurred... -- ... We have the exception to play around with... -- } -- -- string msg = collectExceptionMsg(write(g, readln(f))); -- if (msg) -- { -- ... an exception occurred... -- ... We have the message from the exception but not the exception... -- } -- -- char[] line; -- enforce(readln(f, line)); -- return assumeUnique(line); --} ---------------------- -+ -------------------- -+ string synopsis() -+ { -+ FILE* f = enforce(fopen("some/file")); -+ // f is not null from here on -+ FILE* g = enforceEx!WriteException(fopen("some/other/file", "w")); -+ // g is not null from here on -+ -+ Exception e = collectException(write(g, readln(f))); -+ if (e) -+ { -+ ... an exception occurred... -+ ... We have the exception to play around with... -+ } -+ -+ string msg = collectExceptionMsg(write(g, readln(f))); -+ if (msg) -+ { -+ ... an exception occurred... -+ ... We have the message from the exception but not the exception... -+ } -+ -+ char[] line; -+ enforce(readln(f, line)); -+ return assumeUnique(line); -+ } -+ -------------------- - - Macros: - WIKI = Phobos/StdException -@@ -57,22 +57,17 @@ import core.exception, core.stdc.errno; - T = The $(D Throwable) to test for. - expression = The expression to test. - msg = Optional message to output on test failure. -+ If msg is empty, and the thrown exception has a -+ non-empty msg field, the exception's msg field -+ will be output on test failure. -+ file = The file where the error occurred. -+ Defaults to $(D __FILE__). -+ line = The line where the error occurred. -+ Defaults to $(D __LINE__). - - Throws: - $(D AssertError) if the given $(D Throwable) is thrown. -- -- Examples: ---------------------- --assertNotThrown!StringException(enforceEx!StringException(true, "Error!")); -- --//Exception is the default. --assertNotThrown(enforceEx!StringException(true, "Error!")); -- --assert(collectExceptionMsg!AssertError(assertNotThrown!StringException( -- enforceEx!StringException(false, "Error!"))) == -- `assertNotThrown failed: StringException was thrown.`); ---------------------- -- +/ -+ +/ - void assertNotThrown(T : Throwable = Exception, E) - (lazy E expression, - string msg = null, -@@ -80,21 +75,19 @@ void assertNotThrown(T : Throwable = Exc - size_t line = __LINE__) - { - try -+ { - expression(); -- catch(T t) -+ } -+ catch (T t) - { -- immutable tail = msg.empty ? "." : ": " ~ msg; -- -+ immutable message = msg.empty ? t.msg : msg; -+ immutable tail = message.empty ? "." : ": " ~ message; - throw new AssertError(format("assertNotThrown failed: %s was thrown%s", -- T.stringof, -- tail), -- file, -- line, -- t); -+ T.stringof, tail), -+ file, line, t); - } - } -- --//Verify Examples -+/// - unittest - { - assertNotThrown!StringException(enforceEx!StringException(true, "Error!")); -@@ -104,6 +97,20 @@ unittest - - assert(collectExceptionMsg!AssertError(assertNotThrown!StringException( - enforceEx!StringException(false, "Error!"))) == -+ `assertNotThrown failed: StringException was thrown: Error!`); -+} -+unittest -+{ -+ assert(collectExceptionMsg!AssertError(assertNotThrown!StringException( -+ enforceEx!StringException(false, ""), "Error!")) == -+ `assertNotThrown failed: StringException was thrown: Error!`); -+ -+ assert(collectExceptionMsg!AssertError(assertNotThrown!StringException( -+ enforceEx!StringException(false, ""))) == -+ `assertNotThrown failed: StringException was thrown.`); -+ -+ assert(collectExceptionMsg!AssertError(assertNotThrown!StringException( -+ enforceEx!StringException(false, ""), "")) == - `assertNotThrown failed: StringException was thrown.`); - } - -@@ -113,24 +120,28 @@ unittest - void nothrowEx() { } - - try -+ { - assertNotThrown!Exception(nothrowEx()); -- catch(AssertError) -- assert(0); -+ } -+ catch (AssertError) assert(0); - - try -+ { - assertNotThrown!Exception(nothrowEx(), "It's a message"); -- catch(AssertError) -- assert(0); -+ } -+ catch (AssertError) assert(0); - - try -+ { - assertNotThrown!AssertError(nothrowEx()); -- catch(AssertError) -- assert(0); -+ } -+ catch (AssertError) assert(0); - - try -+ { - assertNotThrown!AssertError(nothrowEx(), "It's a message"); -- catch(AssertError) -- assert(0); -+ } -+ catch (AssertError) assert(0); - - { - bool thrown = false; -@@ -139,9 +150,7 @@ unittest - assertNotThrown!Exception( - throwEx(new Exception("It's an Exception"))); - } -- catch(AssertError) -- thrown = true; -- -+ catch (AssertError) thrown = true; - assert(thrown); - } - -@@ -152,9 +161,7 @@ unittest - assertNotThrown!Exception( - throwEx(new Exception("It's an Exception")), "It's a message"); - } -- catch(AssertError) -- thrown = true; -- -+ catch (AssertError) thrown = true; - assert(thrown); - } - -@@ -163,13 +170,9 @@ unittest - try - { - assertNotThrown!AssertError( -- throwEx(new AssertError("It's an AssertError", -- __FILE__, -- __LINE__))); -+ throwEx(new AssertError("It's an AssertError", __FILE__, __LINE__))); - } -- catch(AssertError) -- thrown = true; -- -+ catch (AssertError) thrown = true; - assert(thrown); - } - -@@ -178,14 +181,10 @@ unittest - try - { - assertNotThrown!AssertError( -- throwEx(new AssertError("It's an AssertError", -- __FILE__, -- __LINE__)), -+ throwEx(new AssertError("It's an AssertError", __FILE__, __LINE__)), - "It's a message"); - } -- catch(AssertError) -- thrown = true; -- -+ catch (AssertError) thrown = true; - assert(thrown); - } - } -@@ -200,21 +199,13 @@ unittest - T = The $(D Throwable) to test for. - expression = The expression to test. - msg = Optional message to output on test failure. -+ file = The file where the error occurred. -+ Defaults to $(D __FILE__). -+ line = The line where the error occurred. -+ Defaults to $(D __LINE__). - - Throws: - $(D AssertError) if the given $(D Throwable) is not thrown. -- -- Examples: ---------------------- --assertThrown!StringException(enforceEx!StringException(false, "Error!")); -- --//Exception is the default. --assertThrown(enforceEx!StringException(false, "Error!")); -- --assert(collectExceptionMsg!AssertError(assertThrown!StringException( -- enforceEx!StringException(true, "Error!"))) == -- `assertThrown failed: No StringException was thrown.`); ---------------------- - +/ - void assertThrown(T : Throwable = Exception, E) - (lazy E expression, -@@ -222,26 +213,16 @@ void assertThrown(T : Throwable = Except - string file = __FILE__, - size_t line = __LINE__) - { -- bool thrown = false; -- - try - expression(); -- catch(T t) -- thrown = true; -- -- if(!thrown) -- { -- immutable tail = msg.empty ? "." : ": " ~ msg; -+ catch (T) -+ return; - -- throw new AssertError(format("assertThrown failed: No %s was thrown%s", -- T.stringof, -- tail), -- file, -- line); -- } -+ throw new AssertError(format("assertThrown failed: No %s was thrown%s%s", -+ T.stringof, msg.empty ? "." : ": ", msg), -+ file, line); - } -- --//Verify Examples -+/// - unittest - { - assertThrown!StringException(enforceEx!StringException(false, "Error!")); -@@ -260,36 +241,32 @@ unittest - void nothrowEx() { } - - try -+ { - assertThrown!Exception(throwEx(new Exception("It's an Exception"))); -- catch(AssertError) -- assert(0); -+ } -+ catch (AssertError) assert(0); - - try - { - assertThrown!Exception(throwEx(new Exception("It's an Exception")), - "It's a message"); - } -- catch(AssertError) -- assert(0); -+ catch(AssertError) assert(0); - - try - { - assertThrown!AssertError(throwEx(new AssertError("It's an AssertError", -- __FILE__, -- __LINE__))); -+ __FILE__, __LINE__))); - } -- catch(AssertError) -- assert(0); -+ catch (AssertError) assert(0); - - try - { - assertThrown!AssertError(throwEx(new AssertError("It's an AssertError", -- __FILE__, -- __LINE__)), -+ __FILE__, __LINE__)), - "It's a message"); - } -- catch(AssertError) -- assert(0); -+ catch (AssertError) assert(0); - - - { -@@ -346,12 +323,12 @@ unittest - blocks and $(D invariant)s), because they will be compiled out when - compiling with $(I -release). Use $(D assert) in contracts. - -- Example: ---------------------- --auto f = enforce(fopen("data.txt")); --auto line = readln(f); --enforce(line.length, "Expected a non-empty line."); ---------------------- -+ Example: -+ -------------------- -+ auto f = enforce(fopen("data.txt")); -+ auto line = readln(f); -+ enforce(line.length, "Expected a non-empty line."); -+ -------------------- - +/ - T enforce(T)(T value, lazy const(char)[] msg = null, string file = __FILE__, size_t line = __LINE__) - { -@@ -380,7 +357,7 @@ T enforce(T, string file, size_t line = - +/ - T enforce(T, Dg, string file = __FILE__, size_t line = __LINE__) - (T value, scope Dg dg) -- if (is(Dg : void delegate()) || is(Dg : void function())) -+ if (isSomeFunction!Dg && is(typeof( dg() ))) - { - if (!value) dg(); - return value; -@@ -408,6 +385,13 @@ unittest - } - } - -+unittest -+{ -+ // Issue 10510 -+ extern(C) void cFoo() { } -+ enforce(false, &cFoo); -+} -+ - // purity and safety inference test - unittest - { -@@ -482,12 +466,12 @@ unittest - /++ - If $(D !!value) is true, $(D value) is returned. Otherwise, $(D ex) is thrown. - -- Example: ---------------------- --auto f = enforce(fopen("data.txt")); --auto line = readln(f); --enforce(line.length, new IOException); // expect a non-empty line ---------------------- -+ Example: -+ -------------------- -+ auto f = enforce(fopen("data.txt")); -+ auto line = readln(f); -+ enforce(line.length, new IOException); // expect a non-empty line -+ -------------------- - +/ - T enforce(T)(T value, lazy Throwable ex) - { -@@ -506,12 +490,12 @@ unittest - $(D new ErrnoException(msg)) is thrown. $(D ErrnoException) assumes that the - last operation set $(D errno) to an error code. - -- Example: ---------------------- --auto f = errnoEnforce(fopen("data.txt")); --auto line = readln(f); --enforce(line.length); // expect a non-empty line ---------------------- -+ Example: -+ -------------------- -+ auto f = errnoEnforce(fopen("data.txt")); -+ auto line = readln(f); -+ enforce(line.length); // expect a non-empty line -+ -------------------- - +/ - T errnoEnforce(T, string file = __FILE__, size_t line = __LINE__) - (T value, lazy string msg = null) -@@ -527,12 +511,12 @@ T errnoEnforce(T, string file = __FILE__ - and can be constructed with $(D new E(file, line)), then - $(D new E(file, line)) will be thrown. - -- Example: ---------------------- -- auto f = enforceEx!FileMissingException(fopen("data.txt")); -- auto line = readln(f); -- enforceEx!DataCorruptionException(line.length); ---------------------- -+ Example: -+ -------------------- -+ auto f = enforceEx!FileMissingException(fopen("data.txt")); -+ auto line = readln(f); -+ enforceEx!DataCorruptionException(line.length); -+ -------------------- - +/ - template enforceEx(E) - if (is(typeof(new E("", __FILE__, __LINE__)))) -@@ -554,14 +538,7 @@ template enforceEx(E) - } - } - --/++ -- $(RED Deprecated. It will be removed in October 2012. Please use the version -- of $(D enforceEx) which takes an exception that constructs with -- $(D new E(msg, file, line)).) -- -- If $(D !!value) is $(D true), $(D value) is returned. Otherwise, -- $(D new E(msg)) is thrown. -- +/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use the version of enforceEx which takes an exception that constructs with new E(msg, file, line).") - template enforceEx(E) - if (is(typeof(new E(""))) && !is(typeof(new E("", __FILE__, __LINE__))) && !is(typeof(new E(__FILE__, __LINE__)))) -@@ -620,13 +597,6 @@ unittest - T = The type of exception to catch. - expression = The expression which may throw an exception. - result = The result of the expression if no exception is thrown. -- -- Example: ---------------------- --int[] a = new int[3]; --int b; --assert(collectException(a[4], b)); ---------------------- - +/ - T collectException(T = Exception, E)(lazy E expression, ref E result) - { -@@ -640,13 +610,16 @@ T collectException(T = Exception, E)(laz - } - return null; - } -- -+/// - unittest - { -- int[] a = new int[3]; - int b; - int foo() { throw new Exception("blah"); } - assert(collectException(foo(), b)); -+ -+ int[] a = new int[3]; -+ import core.exception : RangeError; -+ assert(collectException!RangeError(a[4], b)); - } - - /++ -@@ -702,18 +675,6 @@ unittest - Params: - T = The type of exception to catch. - expression = The expression which may throw an exception. -- -- Examples: ---------------------- --void throwFunc() {throw new Exception("My Message.");} --assert(collectExceptionMsg(throwFunc()) == "My Message."); -- --void nothrowFunc() {} --assert(collectExceptionMsg(nothrowFunc()) is null); -- --void throwEmptyFunc() {throw new Exception("");} --assert(collectExceptionMsg(throwEmptyFunc()) == emptyExceptionMsg); ---------------------- - +/ - string collectExceptionMsg(T = Exception, E)(lazy E expression) - { -@@ -726,17 +687,16 @@ string collectExceptionMsg(T = Exception - catch(T e) - return e.msg.empty ? emptyExceptionMsg : e.msg; - } -- --//Verify Examples. -+/// - unittest - { -- void throwFunc() {throw new Exception("My Message.");} -+ void throwFunc() { throw new Exception("My Message."); } - assert(collectExceptionMsg(throwFunc()) == "My Message."); - - void nothrowFunc() {} - assert(collectExceptionMsg(nothrowFunc()) is null); - -- void throwEmptyFunc() {throw new Exception("");} -+ void throwEmptyFunc() { throw new Exception(""); } - assert(collectExceptionMsg(throwEmptyFunc()) == emptyExceptionMsg); - } - -@@ -857,22 +817,34 @@ Returns $(D true) if $(D source)'s repre - that points to $(D target)'s representation or somewhere inside - it. - --Note that evaluating $(D pointsTo(x, x)) checks whether $(D x) has -+If $(D source) is or contains a dynamic array, then, then pointsTo will check -+if there is overlap between the dynamic array and $(D target)'s representation. -+ -+If $(D source) is or contains a union, then every member of the union is -+checked for embedded pointers. This may lead to false positives, depending on -+which should be considered the "active" member of the union. -+ -+If $(D source) is a class, then pointsTo will handle it as a pointer. -+ -+If $(D target) is a pointer, a dynamic array or a class, then pointsTo will only -+check if $(D source) points to $(D target), $(I not) what $(D target) references. -+ -+Note: Evaluating $(D pointsTo(x, x)) checks whether $(D x) has - internal pointers. This should only be done as an assertive test, - as the language is free to assume objects don't have internal pointers - (TDPL 7.1.3.5). - */ --bool pointsTo(S, T, Tdummy=void)(auto ref const S source, auto ref const T target) @trusted pure nothrow -- if ((__traits(isRef, source) || isDynamicArray!S) && // lvalue or slice rvalue -- (__traits(isRef, target) || isDynamicArray!T)) // lvalue or slice rvalue -+bool pointsTo(S, T, Tdummy=void)(auto ref const S source, ref const T target) @trusted pure nothrow -+ if (__traits(isRef, source) || isDynamicArray!S || -+ isPointer!S || is(S == class)) - { -- static if (is(S P : U*, U)) -+ static if (isPointer!S || is(S == class)) - { - const m = cast(void*) source, - b = cast(void*) &target, e = b + target.sizeof; - return b <= m && m < e; - } -- else static if (is(S == struct)) -+ else static if (is(S == struct) || is(S == union)) - { - foreach (i, Subobj; typeof(source.tupleof)) - if (pointsTo(source.tupleof[i], target)) return true; -@@ -894,10 +866,101 @@ bool pointsTo(S, T, Tdummy=void)(auto re - } - } - // for shared objects --bool pointsTo(S, T)(ref const shared S source, ref const shared T target) @trusted pure nothrow -+bool pointsTo(S, T)(auto ref const shared S source, ref const shared T target) @trusted pure nothrow - { - return pointsTo!(shared S, shared T, void)(source, target); - } -+ -+/// Pointers -+unittest -+{ -+ int i = 0; -+ int* p = null; -+ assert(!p.pointsTo(i)); -+ p = &i; -+ assert( p.pointsTo(i)); -+} -+ -+/// Structs and Unions -+unittest -+{ -+ struct S -+ { -+ int v; -+ int* p; -+ } -+ int i; -+ auto s = S(0, &i); -+ -+ //structs and unions "own" their members -+ //pointsTo will answer true if one of the members pointsTo. -+ assert(!s.pointsTo(s.v)); //s.v is just v member of s, so not pointed. -+ assert( s.p.pointsTo(i)); //i is pointed by s.p. -+ assert( s .pointsTo(i)); //which means i is pointed by s itself. -+ -+ //Unions will behave exactly the same. Points to will check each "member" -+ //individually, even if they share the same memory -+} -+ -+/// Arrays (dynamic and static) -+unittest -+{ -+ int i; -+ int[] slice = [0, 1, 2, 3, 4]; -+ int[5] arr = [0, 1, 2, 3, 4]; -+ int*[] slicep = [&i]; -+ int*[1] arrp = [&i]; -+ -+ //A slice points to all of its members: -+ assert( slice.pointsTo(slice[3])); -+ assert(!slice[0 .. 2].pointsTo(slice[3])); //Object 3 is outside of the slice [0 .. 2] -+ -+ //Note that a slice will not take into account what its members point to. -+ assert( slicep[0].pointsTo(i)); -+ assert(!slicep .pointsTo(i)); -+ -+ //static arrays are objects that own their members, just like structs: -+ assert(!arr.pointsTo(arr[0])); //arr[0] is just a member of arr, so not pointed. -+ assert( arrp[0].pointsTo(i)); //i is pointed by arrp[0]. -+ assert( arrp .pointsTo(i)); //which means i is pointed by arrp itslef. -+ -+ //Notice the difference between static and dynamic arrays: -+ assert(!arr .pointsTo(arr[0])); -+ assert( arr[].pointsTo(arr[0])); -+ assert( arrp .pointsTo(i)); -+ assert(!arrp[].pointsTo(i)); -+} -+ -+/// Classes -+unittest -+{ -+ class C -+ { -+ this(int* p){this.p = p;} -+ int* p; -+ } -+ int i; -+ C a = new C(&i); -+ C b = a; -+ //Classes are a bit particular, as they are treated like simple pointers -+ //to a class payload. -+ assert( a.p.pointsTo(i)); //a.p points to i. -+ assert(!a .pointsTo(i)); //Yet a itself does not point i. -+ -+ //To check the class payload itself, iterate on its members: -+ () -+ { -+ foreach (index, _; FieldTypeTuple!C) -+ if (pointsTo(a.tupleof[index], i)) -+ return; -+ assert(0); -+ }(); -+ -+ //To check if a class points a specific payload, a direct memmory check can be done: -+ auto aLoc = cast(ubyte[__traits(classInstanceSize, C)]*) a; -+ assert(b.pointsTo(*aLoc)); //b points to where a is pointing -+} -+ - unittest - { - struct S1 { int a; S1 * b; } -@@ -939,7 +1002,6 @@ unittest - - //dynamic arrays don't point to each other, or slices of themselves - assert(!pointsTo(darr, darr)); -- assert(!pointsTo(darr, darr[0 .. 1])); - assert(!pointsTo(darr[0 .. 1], darr)); - - //But they do point their elements -@@ -997,6 +1059,70 @@ unittest - assert(!pointsTo(ss, ss)); //The array doesn't point itself. - } - -+ -+unittest //Unions -+{ -+ int i; -+ union U //Named union -+ { -+ size_t asInt = 0; -+ int* asPointer; -+ } -+ struct S -+ { -+ union //Anonymous union -+ { -+ size_t asInt = 0; -+ int* asPointer; -+ } -+ } -+ -+ U u; -+ S s; -+ assert(!pointsTo(u, i)); -+ assert(!pointsTo(s, i)); -+ -+ u.asPointer = &i; -+ s.asPointer = &i; -+ assert( pointsTo(u, i)); -+ assert( pointsTo(s, i)); -+ -+ u.asInt = cast(size_t)&i; -+ s.asInt = cast(size_t)&i; -+ assert( pointsTo(u, i)); //logical false positive -+ assert( pointsTo(s, i)); //logical false positive -+} -+ -+unittest //Classes -+{ -+ int i; -+ static class A -+ { -+ int* p; -+ } -+ A a = new A, b = a; -+ assert(!pointsTo(a, b)); //a does not point to b -+ a.p = &i; -+ assert(!pointsTo(a, i)); //a does not point to i -+} -+unittest //alias this test -+{ -+ static int i; -+ static int j; -+ struct S -+ { -+ int* p; -+ @property int* foo(){return &i;} -+ alias foo this; -+ } -+ assert(is(S : int*)); -+ S s = S(&j); -+ assert(!pointsTo(s, i)); -+ assert( pointsTo(s, j)); -+ assert( pointsTo(cast(int*)s, i)); -+ assert(!pointsTo(cast(int*)s, j)); -+} -+ - /********************* - * Thrown if errors that set $(D errno) occur. - */ -@@ -1019,184 +1145,181 @@ class ErrnoException : Exception - } - } - --// structuralCast --// class-to-class structural cast --Target structuralCast(Target, Source)(Source obj) -- if (is(Source == class) || is(Target == class)) --{ -- // For the structural cast to work, the source and the target must -- // have the same base class, and the target must add no data or -- // methods -- static assert(0, "Not implemented"); --} -- --// interface-to-interface structural cast --Target structuralCast(Target, Source)(Source obj) -- if (is(Source == interface) || is(Target == interface)) -+/++ -+ ML-style functional exception handling. Runs the supplied expression and -+ returns its result. If the expression throws a $(D Throwable), runs the -+ supplied error handler instead and return its result. The error handler's -+ type must be the same as the expression's type. -+ -+ Params: -+ E = The type of $(D Throwable)s to catch. Defaults to ${D Exception} -+ T1 = The type of the expression. -+ T2 = The return type of the error handler. -+ expression = The expression to run and return its result. -+ errorHandler = The handler to run if the expression throwed. -+ -+ Examples: -+ -------------------- -+ //Revert to a default value upon an error: -+ assert("x".to!int().ifThrown(0) == 0); -+ -------------------- -+ -+ You can also chain multiple calls to ifThrown, each capturing errors from the -+ entire preceding expression. -+ -+ Example: -+ -------------------- -+ //Chaining multiple calls to ifThrown to attempt multiple things in a row: -+ string s="true"; -+ assert(s.to!int(). -+ ifThrown(cast(int)s.to!double()). -+ ifThrown(cast(int)s.to!bool()) -+ == 1); -+ -+ //Respond differently to different types of errors -+ assert(enforce("x".to!int() < 1).to!string() -+ .ifThrown!ConvException("not a number") -+ .ifThrown!Exception("number too small") -+ == "not a number"); -+ -------------------- -+ -+ The expression and the errorHandler must have a common type they can both -+ be implicitly casted to, and that type will be the type of the compound -+ expression. -+ -+ Examples: -+ -------------------- -+ //null and new Object have a common type(Object). -+ static assert(is(typeof(null.ifThrown(new Object())) == Object)); -+ static assert(is(typeof((new Object()).ifThrown(null)) == Object)); -+ -+ //1 and new Object do not have a common type. -+ static assert(!__traits(compiles, 1.ifThrown(new Object()))); -+ static assert(!__traits(compiles, (new Object()).ifThrown(1))); -+ -------------------- -+ -+ If you need to use the actual thrown expection, you can use a delegate. -+ Example: -+ -------------------- -+ //Use a lambda to get the thrown object. -+ assert("%s".format().ifThrown!Exception(e => e.classinfo.name) == "std.format.FormatException"); -+ -------------------- -+ +/ -+//lazy version -+CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1, T2)(lazy scope T1 expression, lazy scope T2 errorHandler) - { -+ static assert(!is(typeof(return) == void), -+ "The error handler's return value("~T2.stringof~") does not have a common type with the expression("~T1.stringof~")."); -+ try -+ { -+ return expression(); -+ } -+ catch(E) -+ { -+ return errorHandler(); -+ } - } - --unittest -+///ditto -+//delegate version -+CommonType!(T1, T2) ifThrown(E : Throwable, T1, T2)(lazy scope T1 expression, scope T2 delegate(E) errorHandler) - { -- interface I1 { void f1(); } -- interface I2 { void f2(); } -- interface I12 : I1, I2 { } -- //pragma(msg, TransitiveBaseTypeTuple!I12.stringof); -- //static assert(is(TransitiveBaseTypeTuple!I12 == TypeTuple!(I2, I1))); --} -- --// Target structuralCast(Target, Source)(Source obj) --// if (is(Source == interface) || is(Target == interface)) --// { --// static assert(is(BaseTypeTuple!(Source)[0] == --// BaseTypeTuple!(Target)[0])); --// alias BaseTypeTuple!(Source)[1 .. $] SBases; --// alias BaseTypeTuple!(Target)[1 .. $] TBases; --// else --// { --// // interface-to-class --// static assert(0); --// } --// } --// else --// { --// static if (is(Source == class)) --// { --// // class-to-interface structural cast --// alias BaseTypeTuple!(Source)[1 .. $] SBases; --// alias BaseTypeTuple!(Target) TBases; --// } --// else --// { --// // interface-to-interface structural cast --// alias BaseTypeTuple!(Source) SBases; --// alias BaseTypeTuple!(Target) TBases; --// } --// } --// static assert(SBases.length >= TBases.length, --// "Cannot structurally cast to a target with" --// " more interfaces implemented"); --// static assert( --// is(typeof(Target.tupleof) == typeof(Source.tupleof)), --// "Cannot structurally cast to a target with more fields"); --// // Target bases must be a prefix of the source bases --// foreach (i, B; TBases) --// { --// static assert(is(SBases[i] == B) --// || is(SBases[i] == interface) && is(SBases[i] : B), --// SBases[i].stringof ~ " does not inherit " --// ~ B.stringof); --// } --// union Result --// { --// Source src; --// Target tgt; --// } --// Result result = { obj }; --// return result.tgt; --// } -- --template structurallyCompatible(S, T) if (!isArray!S || !isArray!T) --{ -- enum structurallyCompatible = -- FieldTypeTuple!S.length >= FieldTypeTuple!T.length -- && is(FieldTypeTuple!S[0 .. FieldTypeTuple!T.length] -- == FieldTypeTuple!T); --} -- --template structurallyCompatible(S, T) if (isArray!S && isArray!T) --{ -- enum structurallyCompatible = -- .structurallyCompatible!(ElementType!S, ElementType!T) && -- .structurallyCompatible!(ElementType!T, ElementType!S); --} -- --unittest --{ -- // struct X { uint a; } -- // static assert(structurallyCompatible!(uint[], X[])); -- // struct Y { uint a, b; } -- // static assert(!structurallyCompatible!(uint[], Y[])); -- // static assert(!structurallyCompatible!(Y[], uint[])); -- // static assert(!structurallyCompatible!(Y[], X[])); --} -- --/* --Structural cast. Allows casting among class types that logically have --a common base, but that base is not made explicit. -- --Example: ------ --interface Document { ... } --interface Storable { ... } --interface StorableDocument : Storable, Document { ... } --class Doc : Storable, Document { ... } --void process(StorableDocument d); --... -- --auto c = new Doc; --process(c); // does not work --process(structuralCast!StorableDocument(c)); // works -- */ -+ static assert(!is(typeof(return) == void), -+ "The error handler's return value("~T2.stringof~") does not have a common type with the expression("~T1.stringof~")."); -+ try -+ { -+ return expression(); -+ } -+ catch(E e) -+ { -+ return errorHandler(e); -+ } -+} - --// template structuralCast(Target) --// { --// Target structuralCast(Source)(Source obj) --// { --// static if (is(Source : Object) || is(Source == interface)) --// { --// return .structuralCastImpl!(Target)(obj); --// } --// else --// { --// static if (structurallyCompatible!(Source, Target)) --// return *(cast(Target*) &obj); --// else --// static assert(false); --// } --// } --// } -+///ditto -+//delegate version, general overload to catch any Exception -+CommonType!(T1, T2) ifThrown(T1, T2)(lazy scope T1 expression, scope T2 delegate(Exception) errorHandler) -+{ -+ static assert(!is(typeof(return) == void), -+ "The error handler's return value("~T2.stringof~") does not have a common type with the expression("~T1.stringof~")."); -+ try -+ { -+ return expression(); -+ } -+ catch(Exception e) -+ { -+ return errorHandler(e); -+ } -+} - -+//Verify Examples - unittest - { -- // interface I1 {} -- // interface I2 {} -- // class Base : I1 { int x; } -- // class A : I1 {} -- // class B : I1, I2 {} -- -- // auto b = new B; -- // auto a = structuralCast!(A)(b); -- // assert(a); -- -- // struct X { int a; } -- // int[] arr = [ 1 ]; -- // auto x = structuralCast!(X[])(arr); -- // assert(x[0].a == 1); -+ //Revert to a default value upon an error: -+ assert("x".to!int().ifThrown(0) == 0); -+ -+ //Chaining multiple calls to ifThrown to attempt multiple things in a row: -+ string s="true"; -+ assert(s.to!int(). -+ ifThrown(cast(int)s.to!double()). -+ ifThrown(cast(int)s.to!bool()) -+ == 1); -+ -+ //Respond differently to different types of errors -+ assert(enforce("x".to!int() < 1).to!string() -+ .ifThrown!ConvException("not a number") -+ .ifThrown!Exception("number too small") -+ == "not a number"); -+ -+ //null and new Object have a common type(Object). -+ static assert(is(typeof(null.ifThrown(new Object())) == Object)); -+ static assert(is(typeof((new Object()).ifThrown(null)) == Object)); -+ -+ //1 and new Object do not have a common type. -+ static assert(!__traits(compiles, 1.ifThrown(new Object()))); -+ static assert(!__traits(compiles, (new Object()).ifThrown(1))); -+ -+ //Use a lambda to get the thrown object. -+ assert("%s".format().ifThrown(e => e.classinfo.name) == "std.format.FormatException"); - } - - unittest - { -- // interface Document { int fun(); } -- // interface Storable { int gun(); } -- // interface StorableDocument : Storable, Document { } -- // class Doc : Storable, Document { -- // int fun() { return 42; } -- // int gun() { return 43; } -- // } -- // void process(StorableDocument d) { -- // assert(d.fun + d.gun == 85, text(d.fun + d.gun)); -- // } -- -- // auto c = new Doc; -- // Document d = c; -- // //process(c); // does not work -- // union A -- // { -- // Storable s; -- // StorableDocument sd; -- // } -- // A a = { c }; -- //process(a.sd); // works -- //process(structuralCast!StorableDocument(d)); // works -+ //Basic behaviour - all versions. -+ assert("1".to!int().ifThrown(0) == 1); -+ assert("x".to!int().ifThrown(0) == 0); -+ assert("1".to!int().ifThrown!ConvException(0) == 1); -+ assert("x".to!int().ifThrown!ConvException(0) == 0); -+ assert("1".to!int().ifThrown(e=>0) == 1); -+ assert("x".to!int().ifThrown(e=>0) == 0); -+ static if (__traits(compiles, 0.ifThrown!Exception(e => 0))) //This will only work with a fix that was not yet pulled -+ { -+ assert("1".to!int().ifThrown!ConvException(e=>0) == 1); -+ assert("x".to!int().ifThrown!ConvException(e=>0) == 0); -+ } -+ -+ //Exceptions other than stated not caught. -+ assert("x".to!int().ifThrown!StringException(0).collectException!ConvException() !is null); -+ static if (__traits(compiles, 0.ifThrown!Exception(e => 0))) //This will only work with a fix that was not yet pulled -+ { -+ assert("x".to!int().ifThrown!StringException(e=>0).collectException!ConvException() !is null); -+ } -+ -+ //Default does not include errors. -+ int throwRangeError() { throw new RangeError; } -+ assert(throwRangeError().ifThrown(0).collectException!RangeError() !is null); -+ assert(throwRangeError().ifThrown(e=>0).collectException!RangeError() !is null); -+ -+ //Incompatible types are not accepted. -+ static assert(!__traits(compiles, 1.ifThrown(new Object()))); -+ static assert(!__traits(compiles, (new Object()).ifThrown(1))); -+ static assert(!__traits(compiles, 1.ifThrown(e=>new Object()))); -+ static assert(!__traits(compiles, (new Object()).ifThrown(e=>1))); -+} -+ -+version(unittest) package -+@property void assertCTFEable(alias dg)() -+{ -+ static assert({ dg(); return true; }()); -+ dg(); - } ---- a/src/libphobos/src/std/file.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/file.d 2014-04-01 16:32:51.000000000 +0100 -@@ -4,7 +4,7 @@ - Utilities for manipulating files and scanning directories. Functions - in this module handle files as a unit, e.g., read or write one _file - at a time. For opening files and manipulating them via handles refer --to module $(D $(LINK2 std_stdio.html,std.stdio)). -+to module $(LINK2 std_stdio.html,$(D std.stdio)). - - Macros: - WIKI = Phobos/StdFile -@@ -42,18 +42,17 @@ version (unittest) - { - import core.thread; - -- private @property string deleteme() -+ private @property string deleteme() @safe - { - static _deleteme = "deleteme.dmd.unittest.pid"; - static _first = true; - - if(_first) - { -- _deleteme = buildPath(tempDir(), _deleteme) ~ to!string(getpid()); -+ _deleteme = buildPath(tempDir(), _deleteme) ~ to!string(thisProcessID); - _first = false; - } - -- - return _deleteme; - } - } -@@ -68,6 +67,11 @@ version (Windows) - // Required by tempPath(): - private extern(Windows) DWORD GetTempPathW(DWORD nBufferLength, - LPWSTR lpBuffer); -+ // Required by rename(): -+ enum MOVEFILE_REPLACE_EXISTING = 1; -+ private extern(Windows) DWORD MoveFileExW(LPCWSTR lpExistingFileName, -+ LPCWSTR lpNewFileName, -+ DWORD dwFlags); - } - else version (Posix) - { -@@ -95,7 +99,7 @@ class FileException : Exception - file = The file where the error occurred. - line = The line where the error occurred. - +/ -- this(in char[] name, in char[] msg, string file = __FILE__, size_t line = __LINE__) -+ this(in char[] name, in char[] msg, string file = __FILE__, size_t line = __LINE__) @safe pure - { - if(msg.empty) - super(name.idup, file, line); -@@ -110,15 +114,17 @@ class FileException : Exception - in Windows, $(D_PARAM errno) in Posix). - - Params: -- name = Name of file for which the error occurred. -- msg = Message describing the error. -- file = The file where the error occurred. -- line = The line where the error occurred. -+ name = Name of file for which the error occurred. -+ errno = The error number. -+ file = The file where the error occurred. -+ Defaults to $(D __FILE__). -+ line = The line where the error occurred. -+ Defaults to $(D __LINE__). - +/ - version(Windows) this(in char[] name, - uint errno = .GetLastError(), - string file = __FILE__, -- size_t line = __LINE__) -+ size_t line = __LINE__) @safe - { - this(name, sysErrorString(errno), file, line); - this.errno = errno; -@@ -126,7 +132,7 @@ class FileException : Exception - else version(Posix) this(in char[] name, - uint errno = .errno, - string file = __FILE__, -- size_t line = __LINE__) -+ size_t line = __LINE__) @trusted - { - auto s = strerror(errno); - this(name, to!string(s), file, line); -@@ -391,13 +397,14 @@ version(Posix) private void writeImpl(in - - /*************************************************** - * Rename file $(D from) to $(D to). -+ * If the target file exists, it is overwritten. - * Throws: $(D FileException) on error. - */ - void rename(in char[] from, in char[] to) - { - version(Windows) - { -- enforce(MoveFileW(std.utf.toUTF16z(from), std.utf.toUTF16z(to)), -+ enforce(MoveFileExW(std.utf.toUTF16z(from), std.utf.toUTF16z(to), MOVEFILE_REPLACE_EXISTING), - new FileException( - text("Attempting to rename file ", from, " to ", - to))); -@@ -406,6 +413,19 @@ void rename(in char[] from, in char[] to - cenforce(core.stdc.stdio.rename(toStringz(from), toStringz(to)) == 0, to); - } - -+unittest -+{ -+ auto t1 = deleteme, t2 = deleteme~"2"; -+ scope(exit) foreach (t; [t1, t2]) if (t.exists) t.remove(); -+ write(t1, "1"); -+ rename(t1, t2); -+ assert(readText(t2) == "1"); -+ write(t1, "2"); -+ rename(t1, t2); -+ assert(readText(t2) == "2"); -+} -+ -+ - /*************************************************** - Delete file $(D name). - Throws: $(D FileException) on error. -@@ -469,26 +489,26 @@ unittest - - - /++ -- Get the access and modified times of file $(D name). -+ Get the access and modified times of file or folder $(D name). - - Params: -- name = File name to get times for. -- fileAccessTime = Time the file was last accessed. -- fileModificationTime = Time the file was last modified. -+ name = File/Folder name to get times for. -+ accessTime = Time the file/folder was last accessed. -+ modificationTime = Time the file/folder was last modified. - - Throws: - $(D FileException) on error. - +/ - void getTimes(in char[] name, -- out SysTime fileAccessTime, -- out SysTime fileModificationTime) -+ out SysTime accessTime, -+ out SysTime modificationTime) - { - version(Windows) - { - with (getFileAttributesWin(name)) - { -- fileAccessTime = std.datetime.FILETIMEToSysTime(&ftLastAccessTime); -- fileModificationTime = std.datetime.FILETIMEToSysTime(&ftLastWriteTime); -+ accessTime = std.datetime.FILETIMEToSysTime(&ftLastAccessTime); -+ modificationTime = std.datetime.FILETIMEToSysTime(&ftLastWriteTime); - } - } - else version(Posix) -@@ -497,8 +517,8 @@ void getTimes(in char[] name, - - cenforce(stat(toStringz(name), &statbuf) == 0, name); - -- fileAccessTime = SysTime(unixTimeToStdTime(statbuf.st_atime)); -- fileModificationTime = SysTime(unixTimeToStdTime(statbuf.st_mtime)); -+ accessTime = SysTime(unixTimeToStdTime(statbuf.st_atime)); -+ modificationTime = SysTime(unixTimeToStdTime(statbuf.st_mtime)); - } - } - -@@ -653,6 +673,78 @@ version(Windows) unittest - - - /++ -+ Set access/modified times of file or folder $(D name). -+ -+ Params: -+ name = File/Folder name to get times for. -+ accessTime = Time the file/folder was last accessed. -+ modificationTime = Time the file/folder was last modified. -+ -+ Throws: -+ $(D FileException) on error. -+ +/ -+void setTimes(in char[] name, -+ SysTime accessTime, -+ SysTime modificationTime) -+{ -+ version(Windows) -+ { -+ const ta = SysTimeToFILETIME(accessTime); -+ const tm = SysTimeToFILETIME(modificationTime); -+ alias TypeTuple!(GENERIC_WRITE, -+ 0, -+ null, -+ OPEN_EXISTING, -+ FILE_ATTRIBUTE_NORMAL | -+ FILE_ATTRIBUTE_DIRECTORY | -+ FILE_FLAG_BACKUP_SEMANTICS, -+ HANDLE.init) -+ defaults; -+ auto h = CreateFileW(std.utf.toUTF16z(name), defaults); -+ -+ cenforce(h != INVALID_HANDLE_VALUE, name); -+ -+ scope(exit) -+ cenforce(CloseHandle(h), name); -+ -+ cenforce(SetFileTime(h, null, &ta, &tm), name); -+ } -+ else version(Posix) -+ { -+ timeval[2] t = void; -+ -+ t[0] = accessTime.toTimeVal(); -+ t[1] = modificationTime.toTimeVal(); -+ -+ cenforce(utimes(toStringz(name), t) == 0, name); -+ } -+} -+ -+unittest -+{ -+ string dir = deleteme ~ r".dir/a/b/c"; -+ string file = dir ~ "/file"; -+ -+ if (!exists(dir)) mkdirRecurse(dir); -+ { auto f = File(file, "w"); } -+ -+ foreach (path; [file, dir]) // test file and dir -+ { -+ SysTime atime = SysTime(DateTime(2010, 10, 4, 0, 0, 30)); -+ SysTime mtime = SysTime(DateTime(2011, 10, 4, 0, 0, 30)); -+ setTimes(path, atime, mtime); -+ -+ SysTime atime_res; -+ SysTime mtime_res; -+ getTimes(path, atime_res, mtime_res); -+ assert(atime == atime_res); -+ assert(mtime == mtime_res); -+ } -+ -+ rmdirRecurse(dir); -+} -+ -+/++ - Returns the time that the given file was last modified. - - Throws: -@@ -757,7 +849,7 @@ unittest - /++ - Returns whether the given file (or directory) exists. - +/ --@property bool exists(in char[] name) -+bool exists(in char[] name) @trusted - { - version(Windows) - { -@@ -819,6 +911,8 @@ unittest - - Params: - name = The file to get the attributes of. -+ -+ Throws: $(D FileException) on error. - +/ - uint getAttributes(in char[] name) - { -@@ -988,7 +1082,7 @@ unittest - possible for both $(D isFile) and $(D isDir) to be $(D false) for a - particular file (in which case, it's a special file). You can use - $(D getAttributes) to get the attributes to figure out what type of special -- it is, or you can use $(D dirEntry) to get at its $(D statBuf), which is the -+ it is, or you can use $(D DirEntry) to get at its $(D statBuf), which is the - result from $(D stat). In either case, see the man page for $(D stat) for - more information. - -@@ -1258,6 +1352,8 @@ void mkdir(in char[] pathname) - - /**************************************************** - * Make directory and all parent directories as needed. -+ * -+ * Throws: $(D FileException) on error. - */ - - void mkdirRecurse(in char[] pathname) -@@ -1433,7 +1529,7 @@ else version(Posix) string readLink(C)(c - dynamicBuffer.length = dynamicBuffer.length * 3 / 2; - } - -- throw new FileException(format("Path for %s is too long to read.", link)); -+ throw new FileException(to!string(link), "Path is too long to read."); - } - - version(Posix) unittest -@@ -1498,30 +1594,130 @@ unittest - assert(s.length); - } - -+version (OSX) -+ private extern (C) int _NSGetExecutablePath(char* buf, uint* bufsize); -+else version (FreeBSD) -+ private extern (C) int sysctl (const int* name, uint namelen, void* oldp, -+ size_t* oldlenp, const void* newp, size_t newlen); -+ -+/** -+ * Returns the full path of the current executable. -+ * -+ * Throws: -+ * $(XREF object, Exception) -+ */ -+@trusted string thisExePath () -+{ -+ version (OSX) -+ { -+ import core.sys.posix.stdlib : realpath; -+ -+ uint size; -+ -+ _NSGetExecutablePath(null, &size); // get the length of the path -+ auto buffer = new char[size]; -+ _NSGetExecutablePath(buffer.ptr, &size); -+ -+ auto absolutePath = realpath(buffer.ptr, null); // let the function allocate -+ -+ scope (exit) -+ { -+ if (absolutePath) -+ free(absolutePath); -+ } -+ -+ errnoEnforce(absolutePath); -+ return to!(string)(absolutePath); -+ } -+ else version (linux) -+ { -+ return readLink("/proc/self/exe"); -+ } -+ else version (Windows) -+ { -+ wchar[MAX_PATH] buf; -+ wchar[] buffer = buf[]; -+ -+ while (true) -+ { -+ auto len = GetModuleFileNameW(null, buffer.ptr, cast(DWORD) buffer.length); -+ enforce(len, sysErrorString(GetLastError())); -+ if (len != buffer.length) -+ return to!(string)(buffer[0 .. len]); -+ buffer.length *= 2; -+ } -+ } -+ else version (FreeBSD) -+ { -+ enum -+ { -+ CTL_KERN = 1, -+ KERN_PROC = 14, -+ KERN_PROC_PATHNAME = 12 -+ } -+ -+ int[4] mib = [CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1]; -+ size_t len; -+ -+ auto result = sysctl(mib.ptr, mib.length, null, &len, null, 0); // get the length of the path -+ errnoEnforce(result == 0); -+ -+ auto buffer = new char[len - 1]; -+ result = sysctl(mib.ptr, mib.length, buffer.ptr, &len, null, 0); -+ errnoEnforce(result == 0); -+ -+ return buffer.assumeUnique; -+ } -+ else -+ static assert(0, "thisExePath is not supported on this platform"); -+} -+ -+unittest -+{ -+ auto path = thisExePath(); -+ -+ assert(path.exists); -+ assert(path.isAbsolute); -+ assert(path.isFile); -+} - - version(StdDdoc) - { - /++ - Info on a file, similar to what you'd get from stat on a Posix system. -- -- A $(D DirEntry) is obtained by using the functions $(D dirEntry) (to get -- the $(D DirEntry) for a specific file) or $(D dirEntries) (to get a -- $(D DirEntry) for each file/directory in a particular directory). - +/ - struct DirEntry - { -- void _init(T...)(T); -- public: -+ /++ -+ Constructs a DirEntry for the given file (or directory). -+ -+ Params: -+ path = The file (or directory) to get a DirEntry for. -+ -+ Throws: -+ $(D FileException) if the file does not exist. -+ +/ -+ this(string path); -+ -+ version (Windows) -+ { -+ private this(string path, in WIN32_FIND_DATA* fd); -+ private this(string path, in WIN32_FIND_DATAW *fd); -+ } -+ else version (Posix) -+ { -+ private this(string path, core.sys.posix.dirent.dirent* fd); -+ } - - /++ - Returns the path to the file represented by this $(D DirEntry). - - Examples: - -------------------- --auto de1 = dirEntry("/etc/fonts/fonts.conf"); -+auto de1 = DirEntry("/etc/fonts/fonts.conf"); - assert(de1.name == "/etc/fonts/fonts.conf"); - --auto de2 = dirEntry("/usr/share/include"); -+auto de2 = DirEntry("/usr/share/include"); - assert(de2.name == "/usr/share/include"); - -------------------- - +/ -@@ -1534,10 +1730,10 @@ assert(de2.name == "/usr/share/include") - - Examples: - -------------------- --auto de1 = dirEntry("/etc/fonts/fonts.conf"); -+auto de1 = DirEntry("/etc/fonts/fonts.conf"); - assert(!de1.isDir); - --auto de2 = dirEntry("/usr/share/include"); -+auto de2 = DirEntry("/usr/share/include"); - assert(de2.isDir); - -------------------- - +/ -@@ -1560,10 +1756,10 @@ assert(de2.isDir); - - Examples: - -------------------- --auto de1 = dirEntry("/etc/fonts/fonts.conf"); -+auto de1 = DirEntry("/etc/fonts/fonts.conf"); - assert(de1.isFile); - --auto de2 = dirEntry("/usr/share/include"); -+auto de2 = DirEntry("/usr/share/include"); - assert(!de2.isFile); - -------------------- - +/ -@@ -1655,6 +1851,52 @@ else version(Windows) - public: - alias name this; - -+ this(string path) -+ { -+ if(!path.exists) -+ throw new FileException(path, "File does not exist"); -+ -+ _name = path; -+ -+ with (getFileAttributesWin(path)) -+ { -+ _size = makeUlong(nFileSizeLow, nFileSizeHigh); -+ _timeCreated = std.datetime.FILETIMEToSysTime(&ftCreationTime); -+ _timeLastAccessed = std.datetime.FILETIMEToSysTime(&ftLastAccessTime); -+ _timeLastModified = std.datetime.FILETIMEToSysTime(&ftLastWriteTime); -+ _attributes = dwFileAttributes; -+ } -+ } -+ -+ private this(string path, in WIN32_FIND_DATA* fd) -+ { -+ auto clength = to!int(core.stdc.string.strlen(fd.cFileName.ptr)); -+ -+ // Convert cFileName[] to unicode -+ const wlength = MultiByteToWideChar(0, 0, fd.cFileName.ptr, clength, null, 0); -+ auto wbuf = new wchar[wlength]; -+ const n = MultiByteToWideChar(0, 0, fd.cFileName.ptr, clength, wbuf.ptr, wlength); -+ assert(n == wlength); -+ // toUTF8() returns a new buffer -+ _name = buildPath(path, std.utf.toUTF8(wbuf[0 .. wlength])); -+ _size = (cast(ulong)fd.nFileSizeHigh << 32) | fd.nFileSizeLow; -+ _timeCreated = std.datetime.FILETIMEToSysTime(&fd.ftCreationTime); -+ _timeLastAccessed = std.datetime.FILETIMEToSysTime(&fd.ftLastAccessTime); -+ _timeLastModified = std.datetime.FILETIMEToSysTime(&fd.ftLastWriteTime); -+ _attributes = fd.dwFileAttributes; -+ } -+ private this(string path, in WIN32_FIND_DATAW *fd) -+ { -+ size_t clength = std.string.wcslen(fd.cFileName.ptr); -+ _name = std.utf.toUTF8(fd.cFileName[0 .. clength]); -+ _name = buildPath(path, std.utf.toUTF8(fd.cFileName[0 .. clength])); -+ _size = (cast(ulong)fd.nFileSizeHigh << 32) | fd.nFileSizeLow; -+ _timeCreated = std.datetime.FILETIMEToSysTime(&fd.ftCreationTime); -+ _timeLastAccessed = std.datetime.FILETIMEToSysTime(&fd.ftLastAccessTime); -+ _timeLastModified = std.datetime.FILETIMEToSysTime(&fd.ftLastWriteTime); -+ _attributes = fd.dwFileAttributes; -+ } -+ - @property string name() const pure nothrow - { - return _name; -@@ -1709,55 +1951,8 @@ else version(Windows) - } - - private: -- -- void _init(in char[] path) -- { -- _name = path.idup; -- -- with (getFileAttributesWin(path)) -- { -- _size = makeUlong(nFileSizeLow, nFileSizeHigh); -- _timeCreated = std.datetime.FILETIMEToSysTime(&ftCreationTime); -- _timeLastAccessed = std.datetime.FILETIMEToSysTime(&ftLastAccessTime); -- _timeLastModified = std.datetime.FILETIMEToSysTime(&ftLastWriteTime); -- _attributes = dwFileAttributes; -- } -- } -- -- void _init(in char[] path, in WIN32_FIND_DATA* fd) -- { -- auto clength = to!int(std.c.string.strlen(fd.cFileName.ptr)); -- -- // Convert cFileName[] to unicode -- const wlength = MultiByteToWideChar(0, 0, fd.cFileName.ptr, clength, null, 0); -- auto wbuf = new wchar[wlength]; -- const n = MultiByteToWideChar(0, 0, fd.cFileName.ptr, clength, wbuf.ptr, wlength); -- assert(n == wlength); -- // toUTF8() returns a new buffer -- _name = buildPath(path, std.utf.toUTF8(wbuf[0 .. wlength])); -- _size = (cast(ulong)fd.nFileSizeHigh << 32) | fd.nFileSizeLow; -- _timeCreated = std.datetime.FILETIMEToSysTime(&fd.ftCreationTime); -- _timeLastAccessed = std.datetime.FILETIMEToSysTime(&fd.ftLastAccessTime); -- _timeLastModified = std.datetime.FILETIMEToSysTime(&fd.ftLastWriteTime); -- _attributes = fd.dwFileAttributes; -- } -- -- void _init(in char[] path, in WIN32_FIND_DATAW *fd) -- { -- size_t clength = std.string.wcslen(fd.cFileName.ptr); -- _name = std.utf.toUTF8(fd.cFileName[0 .. clength]); -- _name = buildPath(path, std.utf.toUTF8(fd.cFileName[0 .. clength])); -- _size = (cast(ulong)fd.nFileSizeHigh << 32) | fd.nFileSizeLow; -- _timeCreated = std.datetime.FILETIMEToSysTime(&fd.ftCreationTime); -- _timeLastAccessed = std.datetime.FILETIMEToSysTime(&fd.ftLastAccessTime); -- _timeLastModified = std.datetime.FILETIMEToSysTime(&fd.ftLastWriteTime); -- _attributes = fd.dwFileAttributes; -- } -- -- - string _name; /// The file or directory represented by this DirEntry. - -- - SysTime _timeCreated; /// The time when the file was created. - SysTime _timeLastAccessed; /// The time when the file was last accessed. - SysTime _timeLastModified; /// The time when the file was last modified. -@@ -1773,6 +1968,43 @@ else version(Posix) - public: - alias name this; - -+ this(string path) -+ { -+ if(!path.exists) -+ throw new FileException(path, "File does not exist"); -+ -+ _name = path; -+ -+ _didLStat = false; -+ _didStat = false; -+ _dTypeSet = false; -+ } -+ -+ private this(string path, core.sys.posix.dirent.dirent* fd) -+ { -+ immutable len = core.stdc.string.strlen(fd.d_name.ptr); -+ _name = buildPath(path, fd.d_name[0 .. len]); -+ -+ _didLStat = false; -+ _didStat = false; -+ -+ //fd_d_type doesn't work for all file systems, -+ //in which case the result is DT_UNKOWN. But we -+ //can determine the correct type from lstat, so -+ //we'll only set the dtype here if we could -+ //correctly determine it (not lstat in the case -+ //of DT_UNKNOWN in case we don't ever actually -+ //need the dtype, thus potentially avoiding the -+ //cost of calling lstat). -+ if(fd.d_type != DT_UNKNOWN) -+ { -+ _dType = fd.d_type; -+ _dTypeSet = true; -+ } -+ else -+ _dTypeSet = false; -+ } -+ - @property string name() const pure nothrow - { - return _name; -@@ -1848,41 +2080,6 @@ else version(Posix) - } - - private: -- -- void _init(in char[] path) -- { -- _name = path.idup; -- -- _didLStat = false; -- _didStat = false; -- _dTypeSet = false; -- } -- -- void _init(in char[] path, core.sys.posix.dirent.dirent* fd) -- { -- immutable len = std.c.string.strlen(fd.d_name.ptr); -- _name = buildPath(path, fd.d_name[0 .. len]); -- -- _didLStat = false; -- _didStat = false; -- -- //fd_d_type doesn't work for all file systems, -- //in which case the result is DT_UNKOWN. But we -- //can determine the correct type from lstat, so -- //we'll only set the dtype here if we could -- //correctly determine it (not lstat in the case -- //of DT_UNKNOWN in case we don't ever actually -- //need the dtype, thus potentially avoiding the -- //cost of calling lstat). -- if(fd.d_type != DT_UNKNOWN) -- { -- _dType = fd.d_type; -- _dTypeSet = true; -- } -- else -- _dTypeSet = false; -- } -- - /++ - This is to support lazy evaluation, because doing stat's is - expensive and not always needed. -@@ -1918,7 +2115,6 @@ else version(Posix) - _didLStat = true; - } - -- - string _name; /// The file or directory represented by this DirEntry. - - stat_t _statBuf = void; /// The result of stat(). -@@ -1937,7 +2133,7 @@ unittest - { - if("C:\\Program Files\\".exists) - { -- auto de = dirEntry("C:\\Program Files\\"); -+ auto de = DirEntry("C:\\Program Files\\"); - assert(!de.isFile); - assert(de.isDir); - assert(!de.isSymlink); -@@ -1945,13 +2141,13 @@ unittest - - if("C:\\Users\\".exists && "C:\\Documents and Settings\\".exists) - { -- auto de = dirEntry("C:\\Documents and Settings\\"); -+ auto de = DirEntry("C:\\Documents and Settings\\"); - assert(de.isSymlink); - } - - if("C:\\Windows\\system.ini".exists) - { -- auto de = dirEntry("C:\\Windows\\system.ini"); -+ auto de = DirEntry("C:\\Windows\\system.ini"); - assert(de.isFile); - assert(!de.isDir); - assert(!de.isSymlink); -@@ -1962,7 +2158,7 @@ unittest - if("/usr/include".exists) - { - { -- auto de = dirEntry("/usr/include"); -+ auto de = DirEntry("/usr/include"); - assert(!de.isFile); - assert(de.isDir); - assert(!de.isSymlink); -@@ -1974,7 +2170,7 @@ unittest - core.sys.posix.unistd.symlink("/usr/include", symfile.ptr); - - { -- auto de = dirEntry(symfile); -+ auto de = DirEntry(symfile); - assert(!de.isFile); - assert(de.isDir); - assert(de.isSymlink); -@@ -1983,7 +2179,7 @@ unittest - - if("/usr/include/assert.h".exists) - { -- auto de = dirEntry("/usr/include/assert.h"); -+ auto de = DirEntry("/usr/include/assert.h"); - assert(de.isFile); - assert(!de.isDir); - assert(!de.isSymlink); -@@ -1993,6 +2189,9 @@ unittest - - /*************************************************** - Copy file $(D from) to file $(D to). File timestamps are preserved. -+If the target file exists, it is overwritten. -+ -+Throws: $(D FileException) on error. - */ - void copy(in char[] from, in char[] to) - { -@@ -2051,66 +2250,17 @@ void copy(in char[] from, in char[] to) - } - } - -- --/++ -- Set access/modified times of file $(D name). -- -- Params: -- fileAccessTime = Time the file was last accessed. -- fileModificationTime = Time the file was last modified. -- -- Throws: -- $(D FileException) on error. -- +/ --void setTimes(in char[] name, -- SysTime fileAccessTime, -- SysTime fileModificationTime) --{ -- version(Windows) -- { -- const ta = SysTimeToFILETIME(fileAccessTime); -- const tm = SysTimeToFILETIME(fileModificationTime); -- alias TypeTuple!(GENERIC_WRITE, -- 0, -- null, -- OPEN_EXISTING, -- FILE_ATTRIBUTE_NORMAL, HANDLE.init) -- defaults; -- auto h = CreateFileW(std.utf.toUTF16z(name), defaults); -- -- cenforce(h != INVALID_HANDLE_VALUE, name); -- -- scope(exit) -- cenforce(CloseHandle(h), name); -- -- cenforce(SetFileTime(h, null, &ta, &tm), name); -- } -- else version(Posix) -- { -- timeval[2] t = void; -- -- t[0] = fileAccessTime.toTimeVal(); -- t[1] = fileModificationTime.toTimeVal(); -- -- enforce(utimes(toStringz(name), t) == 0); -- } --} -- --/+ - unittest - { -- write(deleteme, "a\n"); -- scope(exit) { assert(exists(deleteme)); remove(deleteme); } -- SysTime ftc1, fta1, ftm1; -- getTimes(deleteme, ftc1, fta1, ftm1); -- enforce(collectException(setTimes("nonexistent", fta1, ftm1))); -- setTimes(deleteme, fta1 + dur!"seconds"(50), ftm1 + dur!"seconds"(50)); -- SysTime ftc2, fta2, ftm2; -- getTimes(deleteme, ftc2, fta2, ftm2); -- assert(fta1 + dur!"seconds(50) == fta2, text(fta1 + dur!"seconds(50), "!=", fta2)); -- assert(ftm1 + dur!"seconds(50) == ftm2); -+ auto t1 = deleteme, t2 = deleteme~"2"; -+ scope(exit) foreach (t; [t1, t2]) if (t.exists) t.remove(); -+ write(t1, "1"); -+ copy(t1, t2); -+ assert(readText(t2) == "1"); -+ write(t1, "2"); -+ copy(t1, t2); -+ assert(readText(t2) == "2"); - } --+/ - - - /++ -@@ -2123,12 +2273,11 @@ unittest - +/ - void rmdirRecurse(in char[] pathname) - { -- DirEntry de = dirEntry(pathname); -- -- rmdirRecurse(de); -+ //No references to pathname will be kept after rmdirRecurse, -+ //so the cast is safe -+ rmdirRecurse(DirEntry(cast(string)pathname)); - } - -- - /++ - Remove directory and all of its content and subdirectories, - recursively. -@@ -2140,7 +2289,7 @@ void rmdirRecurse(in char[] pathname) - void rmdirRecurse(ref DirEntry de) - { - if(!de.isDir) -- throw new FileException(text("File ", de.name, " is not a directory")); -+ throw new FileException(de.name, "Not a directory"); - - if(de.isSymlink) - remove(de.name); -@@ -2156,6 +2305,16 @@ void rmdirRecurse(ref DirEntry de) - rmdir(de.name); - } - } -+///ditto -+//Note, without this overload, passing an RValue DirEntry still works, but -+//actually fully reconstructs a DirEntry inside the -+//"rmdirRecurse(in char[] pathname)" implementation. That is needlessly -+//expensive. -+//A DirEntry is a bit big (72B), so keeping the "by ref" signature is desirable. -+void rmdirRecurse(DirEntry de) -+{ -+ rmdirRecurse(de); -+} - - version(Windows) unittest - { -@@ -2289,7 +2448,7 @@ private struct DirIteratorImpl - popDirStack(); - return false; - } -- _cur._init(_stack.data[$-1].dirpath, findinfo); -+ _cur = DirEntry(_stack.data[$-1].dirpath, findinfo); - return true; - } - -@@ -2310,7 +2469,7 @@ private struct DirIteratorImpl - popDirStack(); - return false; - } -- _cur._init(_stack.data[$-1].dirpath, findinfo); -+ _cur = DirEntry(_stack.data[$-1].dirpath, findinfo); - return true; - } - -@@ -2329,15 +2488,7 @@ private struct DirIteratorImpl - - bool mayStepIn() - { -- try -- { -- return _followSymlink ? _cur.isDir : _cur.isDir && !_cur.isSymlink; -- } -- catch (Exception) -- { -- // Entry may have disappeared -- } -- return false; -+ return _followSymlink ? _cur.isDir : _cur.isDir && !_cur.isSymlink; - } - } - else version(Posix) -@@ -2365,7 +2516,7 @@ private struct DirIteratorImpl - if(core.stdc.string.strcmp(fdata.d_name.ptr, ".") && - core.stdc.string.strcmp(fdata.d_name.ptr, "..") ) - { -- _cur._init(_stack.data[$-1].dirpath, fdata); -+ _cur = DirEntry(_stack.data[$-1].dirpath, fdata); - return true; - } - } -@@ -2540,8 +2691,8 @@ unittest - auto len = enforce(walkLength(dirEntries(absolutePath(relpath), mode))); - assert(walkLength(dirEntries(relpath, mode)) == len); - assert(equal( -- map!(q{std.path.absolutePath(a.name)})(dirEntries(relpath, mode)), -- map!(q{a.name})(dirEntries(absolutePath(relpath), mode)))); -+ map!(a => std.path.absolutePath(a.name))(dirEntries(relpath, mode)), -+ map!(a => a.name)(dirEntries(absolutePath(relpath), mode)))); - return len; - } - -@@ -2575,6 +2726,10 @@ unittest - } - //issue 7138 - auto a = array(dirEntries(".", SpanMode.shallow)); -+ -+ // issue 11392 -+ auto dFiles = dirEntries(".", SpanMode.shallow); -+ foreach(d; dFiles){} - } - - /++ -@@ -2612,6 +2767,9 @@ auto dirEntries(string path, string patt - } - - /++ -+ $(RED Deprecated. It will be removed in July 2014. -+ Please use $(LREF DirEntry) constructor directly instead.) -+ - Returns a DirEntry for the given file (or directory). - - Params: -@@ -2620,16 +2778,10 @@ auto dirEntries(string path, string patt - Throws: - $(D FileException) if the file does not exist. - +/ -+deprecated("Please use DirEntry constructor directly instead.") - DirEntry dirEntry(in char[] name) - { -- if(!name.exists) -- throw new FileException(text("File ", name, " does not exist")); -- -- DirEntry dirEntry; -- -- dirEntry._init(name); -- -- return dirEntry; -+ return DirEntry(name.idup); - } - - //Test dirEntry with a directory. -@@ -2869,7 +3021,7 @@ unittest - Returns the path to a directory for temporary files. - - On Windows, this function returns the result of calling the Windows API function --$(D $(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992.aspx, GetTempPath)). -+$(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992.aspx, $(D GetTempPath)). - - On POSIX platforms, it searches through the following list of directories - and returns the first one which is found to exist: -@@ -2892,9 +3044,9 @@ environment variables and directory stru - meantime. - - The POSIX $(D tempDir) algorithm is inspired by Python's --$(D $(LINK2 http://docs.python.org/library/tempfile.html#tempfile.tempdir, tempfile.tempdir)). -+$(LINK2 http://docs.python.org/library/tempfile.html#tempfile.tempdir, $(D tempfile.tempdir)). - */ --string tempDir() -+string tempDir() @trusted - { - static string cache; - if (cache is null) ---- a/src/libphobos/src/std/format.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/format.d 2014-04-01 16:32:51.000000000 +0100 -@@ -27,11 +27,12 @@ module std.format; - import core.stdc.stdio, core.stdc.stdlib, core.stdc.string, core.vararg; - import std.algorithm, std.array, std.ascii, std.bitmanip, std.conv, - std.exception, std.functional, std.math, std.range, -- std.string, std.system, std.traits, std.typecons, std.typetuple, -+ std.system, std.traits, std.typecons, std.typetuple, - std.utf; - version(unittest) { - import std.stdio; - import core.exception; -+ import std.string; - } - - version (Win32) version (DigitalMars) -@@ -55,24 +56,26 @@ version (DigitalMarsC) - */ - class FormatException : Exception - { -+ @safe pure nothrow - this() - { - super("format error"); - } - -+ @safe pure nothrow - this(string msg, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) - { - super(msg, fn, ln, next); - } - } - --/++ -- $(RED Deprecated. It will be removed In January 2013. -- Please use $(D FormatException) instead.) -- +/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use FormatException instead.") - alias FormatException FormatError; - -+private alias enforceFmt = enforceEx!FormatException; -+ -+ - /********************************************************************** - Interprets variadic argument list $(D args), formats them according - to $(D fmt), and sends the resulting characters to $(D w). The -@@ -156,7 +159,7 @@ $(I Integer): - $(I Digit): - $(B '0')|$(B '1')|$(B '2')|$(B '3')|$(B '4')|$(B '5')|$(B '6')|$(B '7')|$(B '8')|$(B '9') - $(I FormatChar): -- $(B 's')|$(B 'b')|$(B 'd')|$(B 'o')|$(B 'x')|$(B 'X')|$(B 'e')|$(B 'E')|$(B 'f')|$(B 'F')|$(B 'g')|$(B 'G')|$(B 'a')|$(B 'A') -+ $(B 's')|$(B 'c')|$(B 'b')|$(B 'd')|$(B 'o')|$(B 'x')|$(B 'X')|$(B 'e')|$(B 'E')|$(B 'f')|$(B 'F')|$(B 'g')|$(B 'G')|$(B 'a')|$(B 'A') - ) - - $(BOOKTABLE Flags affect formatting depending on the specifier as -@@ -180,13 +183,13 @@ $(I FormatChar): - $(TR $(TD $(B '#')) $(TD floating) $(TD Always insert the decimal - point and print trailing zeros.)) - -- $(TR $(TD $(B '#')) $(TD numeric ($(B '0'))) $(TD Use leading -+ $(TR $(TD $(B '0')) $(TD numeric) $(TD Use leading - zeros to pad rather than spaces (except for the floating point - values $(D nan) and $(D infinity)). Ignore if there's a $(I - Precision).)) - -- $(TR $(TD $(B ' ')) $(TD numeric)) $(TD Prefix positive -- numbers in a signed conversion with a space.)) -+ $(TR $(TD $(B ' ')) $(TD numeric) $(TD Prefix positive -+ numbers in a signed conversion with a space.))) - - <dt>$(I Width) - <dd> -@@ -297,83 +300,82 @@ $(I FormatChar): - $(I FormatChar) is lower case, or $(B INF) or $(B INFINITY) if upper. - </dl> - --Examples: -+ Examples: -+ ------------------------- -+ import std.c.stdio; -+ import std.format; -+ -+ void main() -+ { -+ auto writer = appender!string(); -+ formattedWrite(writer, "%s is the ultimate %s.", 42, "answer"); -+ assert(writer.data == "42 is the ultimate answer."); -+ // Clear the writer -+ writer = appender!string(); -+ formattedWrite(writer, "Date: %2$s %1$s", "October", 5); -+ assert(writer.data == "Date: 5 October"); -+ } -+ ------------------------ -+ -+ The positional and non-positional styles can be mixed in the same -+ format string. (POSIX leaves this behavior undefined.) The internal -+ counter for non-positional parameters tracks the next parameter after -+ the largest positional parameter already used. - --------------------------- --import std.c.stdio; --import std.format; -- --void main() --{ -- auto writer = appender!string(); -- formattedWrite(writer, "%s is the ultimate %s.", 42, "answer"); -- assert(writer.data == "42 is the ultimate answer."); -- // Clear the writer -- writer = appender!string(); -- formattedWrite(writer, "Date: %2$s %1$s", "October", 5); -- assert(writer.data == "Date: 5 October"); --} -------------------------- -- --The positional and non-positional styles can be mixed in the same --format string. (POSIX leaves this behavior undefined.) The internal --counter for non-positional parameters tracks the next parameter after --the largest positional parameter already used. -- --Example using array and nested array formatting: --------------------------- --import std.stdio; -+ Example using array and nested array formatting: -+ ------------------------- -+ import std.stdio; - --void main() --{ -- writefln("My items are %(%s %).", [1,2,3]); -- writefln("My items are %(%s, %).", [1,2,3]); --} --------------------------- -- The output is: -+ void main() -+ { -+ writefln("My items are %(%s %).", [1,2,3]); -+ writefln("My items are %(%s, %).", [1,2,3]); -+ } -+ ------------------------- -+ The output is: - <pre class=console> - My items are 1 2 3. - My items are 1, 2, 3. - </pre> - -- The trailing end of the sub-format string following the specifier for each -- item is interpreted as the array delimiter, and is therefore omitted -- following the last array item. The $(B %|) delimiter specifier may be used -- to indicate where the delimiter begins, so that the portion of the format -- string prior to it will be retained in the last array element: --------------------------- --import std.stdio; -+ The trailing end of the sub-format string following the specifier for each -+ item is interpreted as the array delimiter, and is therefore omitted -+ following the last array item. The $(B %|) delimiter specifier may be used -+ to indicate where the delimiter begins, so that the portion of the format -+ string prior to it will be retained in the last array element: -+ ------------------------- -+ import std.stdio; - --void main() --{ -- writefln("My items are %(-%s-%|, %).", [1,2,3]); --} --------------------------- -- which gives the output: -+ void main() -+ { -+ writefln("My items are %(-%s-%|, %).", [1,2,3]); -+ } -+ ------------------------- -+ which gives the output: - <pre class=console> - My items are -1-, -2-, -3-. - </pre> - -- These compound format specifiers may be nested in the case of a nested -- array argument: --------------------------- --import std.stdio; --void main() { -- auto mat = [[1, 2, 3], -- [4, 5, 6], -- [7, 8, 9]]; -- -- writefln("%(%(%d %)\n%)", mat); -- writeln(); -+ These compound format specifiers may be nested in the case of a nested -+ array argument: -+ ------------------------- -+ import std.stdio; -+ void main() { -+ auto mat = [[1, 2, 3], -+ [4, 5, 6], -+ [7, 8, 9]]; -+ -+ writefln("%(%(%d %)\n%)", mat); -+ writeln(); - -- writefln("[%(%(%d %)\n %)]", mat); -- writeln(); -+ writefln("[%(%(%d %)\n %)]", mat); -+ writeln(); - -- writefln("[%([%(%d %)]%|\n %)]", mat); -- writeln(); --} --------------------------- -- The output is: -+ writefln("[%([%(%d %)]%|\n %)]", mat); -+ writeln(); -+ } -+ ------------------------- -+ The output is: - <pre class=console> - 1 2 3 - 4 5 6 -@@ -388,19 +390,19 @@ void main() { - [7 8 9]] - </pre> - -- Inside a compound format specifier, strings and characters are escaped -- automatically. To avoid this behavior, add $(B '-') flag to -- $(D "%$(LPAREN)"). --------------------------- --import std.stdio; -+ Inside a compound format specifier, strings and characters are escaped -+ automatically. To avoid this behavior, add $(B '-') flag to -+ $(D "%$(LPAREN)"). -+ ------------------------- -+ import std.stdio; - --void main() --{ -- writefln("My friends are %s.", ["John", "Nancy"]); -- writefln("My friends are %(%s, %).", ["John", "Nancy"]); -- writefln("My friends are %-(%s, %).", ["John", "Nancy"]); --} --------------------------- -+ void main() -+ { -+ writefln("My friends are %s.", ["John", "Nancy"]); -+ writefln("My friends are %(%s, %).", ["John", "Nancy"]); -+ writefln("My friends are %-(%s, %).", ["John", "Nancy"]); -+ } -+ ------------------------- - which gives the output: - <pre class=console> - My friends are ["John", "Nancy"]. -@@ -410,30 +412,35 @@ My friends are John, Nancy. - */ - uint formattedWrite(Writer, Char, A...)(Writer w, in Char[] fmt, A args) - { -- enum len = args.length; -- void function(Writer, const(void)*, ref FormatSpec!Char) funs[len] = void; -- const(void)* argsAddresses[len] = void; -+ alias FPfmt = void function(Writer, const(void)*, ref FormatSpec!Char) @safe pure nothrow; -+ -+ auto spec = FormatSpec!Char(fmt); -+ -+ FPfmt[A.length] funs; -+ const(void)*[A.length] argsAddresses; - if (!__ctfe) - { -- foreach (i, arg; args) -+ foreach (i, Arg; A) - { -- funs[i] = &formatGeneric!(Writer, typeof(arg), Char); -+ funs[i] = ()@trusted{ return cast(FPfmt)&formatGeneric!(Writer, Arg, Char); }(); - // We can safely cast away shared because all data is either - // immutable or completely owned by this function. -- argsAddresses[i] = cast(const(void*)) &args[ i ]; -+ argsAddresses[i] = (ref arg)@trusted{ return cast(const void*) &arg; }(args[i]); -+ -+ // Reflect formatting @safe/pure ability of each arguments to this function -+ if (0) formatValue(w, args[i], spec); - } - } -+ - // Are we already done with formats? Then just dump each parameter in turn - uint currentArg = 0; -- auto spec = FormatSpec!Char(fmt); - while (spec.writeUpToNextSpec(w)) - { - if (currentArg == funs.length && !spec.indexStart) - { - // leftover spec? -- enforceEx!FormatException( -- fmt.length == 0, -- text("Orphan format specifier: %", fmt)); -+ enforceFmt(fmt.length == 0, -+ text("Orphan format specifier: %", fmt)); - break; - } - if (spec.width == spec.DYNAMIC) -@@ -508,6 +515,13 @@ uint formattedWrite(Writer, Char, A...)( - return currentArg; - } - -+@safe pure unittest -+{ -+ auto w = appender!string(); -+ formattedWrite(w, "%s %d", "@safe/pure", 42); -+ assert(w.data == "@safe/pure 42"); -+} -+ - /** - Reads characters from input range $(D r), converts them according - to $(D fmt), and writes them to $(D args). -@@ -577,12 +591,13 @@ uint formattedRead(R, Char, S...)(ref R - - unittest - { -+ import std.math; - string s = " 1.2 3.4 "; - double x, y, z; - assert(formattedRead(s, " %s %s %s ", &x, &y, &z) == 2); - assert(s.empty); -- assert(x == 1.2); -- assert(y == 3.4); -+ assert(approxEqual(x, 1.2)); -+ assert(approxEqual(y, 3.4)); - assert(isnan(z)); - } - -@@ -593,29 +608,29 @@ template FormatSpec(Char) - } - - /** -- A General handler for $(D printf) style format specifiers. Used for building more -- specific formatting functions. -- -- Example: ------ --auto a = appender!(string)(); --auto fmt = "Number: %2.4e\nString: %s"; --auto f = FormatSpec!char(fmt); -- --f.writeUpToNextSpec(a); -- --assert(a.data == "Number: "); --assert(f.trailing == "\nString: %s"); --assert(f.spec == 'e'); --assert(f.width == 2); --assert(f.precision == 4); -- --f.writeUpToNextSpec(a); -- --assert(a.data == "Number: \nString: "); --assert(f.trailing == ""); --assert(f.spec == 's'); ------ -+ * A General handler for $(D printf) style format specifiers. Used for building more -+ * specific formatting functions. -+ * -+ * Example: -+ * ---- -+ * auto a = appender!(string)(); -+ * auto fmt = "Number: %2.4e\nString: %s"; -+ * auto f = FormatSpec!char(fmt); -+ * -+ * f.writeUpToNextSpec(a); -+ * -+ * assert(a.data == "Number: "); -+ * assert(f.trailing == "\nString: %s"); -+ * assert(f.spec == 'e'); -+ * assert(f.width == 2); -+ * assert(f.precision == 4); -+ * -+ * f.writeUpToNextSpec(a); -+ * -+ * assert(a.data == "Number: \nString: "); -+ * assert(f.trailing == ""); -+ * assert(f.spec == 's'); -+ * ---- - */ - struct FormatSpec(Char) - if (is(Unqual!Char == Char)) -@@ -624,63 +639,76 @@ struct FormatSpec(Char) - Minimum _width, default $(D 0). - */ - int width = 0; -+ - /** - Precision. Its semantics depends on the argument type. For - floating point numbers, _precision dictates the number of - decimals printed. - */ - int precision = UNSPECIFIED; -+ - /** - Special value for width and precision. $(D DYNAMIC) width or - precision means that they were specified with $(D '*') in the - format string and are passed at runtime through the varargs. - */ - enum int DYNAMIC = int.max; -+ - /** - Special value for precision, meaning the format specifier - contained no explicit precision. - */ - enum int UNSPECIFIED = DYNAMIC - 1; -+ - /** - The actual format specifier, $(D 's') by default. - */ - char spec = 's'; -+ - /** - Index of the argument for positional parameters, from $(D 1) to - $(D ubyte.max). ($(D 0) means not used). - */ - ubyte indexStart; -+ - /** - Index of the last argument for positional parameter range, from - $(D 1) to $(D ubyte.max). ($(D 0) means not used). - */ - ubyte indexEnd; -- version(StdDdoc) { -+ -+ version(StdDdoc) -+ { - /** - The format specifier contained a $(D '-') ($(D printf) - compatibility). - */ - bool flDash; -+ - /** - The format specifier contained a $(D '0') ($(D printf) - compatibility). - */ - bool flZero; -+ - /** - The format specifier contained a $(D ' ') ($(D printf) - compatibility). - */ - bool flSpace; -+ - /** - The format specifier contained a $(D '+') ($(D printf) - compatibility). - */ - bool flPlus; -+ - /** - The format specifier contained a $(D '#') ($(D printf) - compatibility). - */ - bool flHash; -+ - // Fake field to allow compilation - ubyte allFlags; - } -@@ -752,7 +780,8 @@ struct FormatSpec(Char) - - bool writeUpToNextSpec(OutputRange)(OutputRange writer) - { -- if (trailing.empty) return false; -+ if (trailing.empty) -+ return false; - for (size_t i = 0; i < trailing.length; ++i) - { - if (trailing[i] != '%') continue; -@@ -831,16 +860,11 @@ struct FormatSpec(Char) - case '(': - // Embedded format specifier. - auto j = i + 1; -- void check(bool condition) -- { -- enforce( -- condition, -- text("Incorrect format specifier: %", trailing[i .. $])); -- } - // Get the matching balanced paren - for (uint innerParens;;) - { -- check(j < trailing.length); -+ enforce(j < trailing.length, -+ text("Incorrect format specifier: %", trailing[i .. $])); - if (trailing[j++] != '%') - { - // skip, we're waiting for %( and %) -@@ -903,9 +927,8 @@ struct FormatSpec(Char) - trailing = trailing[1 .. $]; - width = -.parse!(typeof(width))(trailing); - i = 0; -- enforceEx!FormatException( -- trailing[i++] == '$', -- "$ expected"); -+ enforceFmt(trailing[i++] == '$', -+ "$ expected"); - } - else - { -@@ -915,10 +938,9 @@ struct FormatSpec(Char) - break; - case '1': .. case '9': - auto tmp = trailing[i .. $]; -- const widthOrArgIndex = .parse!(uint)(tmp); -- enforceEx!FormatException( -- tmp.length, -- text("Incorrect format specifier %", trailing[i .. $])); -+ const widthOrArgIndex = .parse!uint(tmp); -+ enforceFmt(tmp.length, -+ text("Incorrect format specifier %", trailing[i .. $])); - i = tmp.ptr - trailing.ptr; - if (tmp.startsWith('$')) - { -@@ -940,9 +962,8 @@ struct FormatSpec(Char) - indexEnd = .parse!(typeof(indexEnd))(tmp); - } - i = tmp.ptr - trailing.ptr; -- enforceEx!FormatException( -- trailing[i++] == '$', -- "$ expected"); -+ enforceFmt(trailing[i++] == '$', -+ "$ expected"); - } - else - { -@@ -961,9 +982,8 @@ struct FormatSpec(Char) - trailing = trailing[i .. $]; - i = 0; - precision = -.parse!int(trailing); -- enforceEx!FormatException( -- trailing[i++] == '$', -- "$ expected"); -+ enforceFmt(trailing[i++] == '$', -+ "$ expected"); - } - else - { -@@ -976,7 +996,7 @@ struct FormatSpec(Char) - // negative precision, as good as 0 - precision = 0; - auto tmp = trailing[i .. $]; -- .parse!(int)(tmp); // skip digits -+ .parse!int(tmp); // skip digits - i = tmp.ptr - trailing.ptr; - } - else if (isDigit(trailing[i])) -@@ -1140,7 +1160,7 @@ struct FormatSpec(Char) - "\ntrailing = ", trailing, "\n"); - } - } --unittest -+@safe pure unittest - { - //Test the example - auto a = appender!(string)(); -@@ -1233,11 +1253,16 @@ if (is(BooleanTypeOf!T) && !is(T == enum - formatValue(w, cast(int) val, f); - } - -+@safe pure unittest -+{ -+ assertCTFEable!( -+ { -+ formatTest( false, "false" ); -+ formatTest( true, "true" ); -+ }); -+} - unittest - { -- formatTest( false, "false" ); -- formatTest( true, "true" ); -- - class C1 { bool val; alias val this; this(bool v){ val = v; } } - class C2 { bool val; alias val this; this(bool v){ val = v; } - override string toString() const { return "C"; } } -@@ -1270,14 +1295,18 @@ unittest - void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) - if (is(T == typeof(null)) && !is(T == enum) && !hasToString!(T, Char)) - { -- enforceEx!FormatException(f.spec == 's', "null"); -+ enforceFmt(f.spec == 's', -+ "null"); - - put(w, "null"); - } - --unittest -+@safe pure unittest - { -- formatTest( null, "null" ); -+ assertCTFEable!( -+ { -+ formatTest( null, "null" ); -+ }); - } - - /** -@@ -1287,51 +1316,51 @@ void formatValue(Writer, T, Char)(Writer - if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) - { - alias U = IntegralTypeOf!T; -- U val = obj; -+ U val = obj; // Extracting alias this may be impure/system/may-throw - - if (f.spec == 'r') - { - // raw write, skip all else and write the thing -- auto begin = cast(const char*) &val; -+ auto raw = (ref val)@trusted{ -+ return (cast(const char*) &val)[0 .. val.sizeof]; -+ }(val); - if (std.system.endian == Endian.littleEndian && f.flPlus - || std.system.endian == Endian.bigEndian && f.flDash) - { - // must swap bytes -- foreach_reverse (i; 0 .. val.sizeof) -- put(w, begin[i]); -+ foreach_reverse (c; raw) -+ put(w, c); - } - else - { -- foreach (i; 0 .. val.sizeof) -- put(w, begin[i]); -+ foreach (c; raw) -+ put(w, c); - } - return; - } - -+ uint base = -+ f.spec == 'x' || f.spec == 'X' ? 16 : -+ f.spec == 'o' ? 8 : -+ f.spec == 'b' ? 2 : -+ f.spec == 's' || f.spec == 'd' || f.spec == 'u' ? 10 : -+ 0; -+ enforceFmt(base > 0, -+ "integral"); -+ - // Forward on to formatIntegral to handle both U and const(U) - // Saves duplication of code for both versions. - static if (isSigned!U) -- formatIntegral(w, cast(long) val, f, Unsigned!U.max); -+ formatIntegral(w, cast( long) val, f, base, Unsigned!U.max); - else -- formatIntegral(w, cast(ulong) val, f, U.max); -+ formatIntegral(w, cast(ulong) val, f, base, U.max); - } - --private void formatIntegral(Writer, T, Char)(Writer w, const(T) val, ref FormatSpec!Char f, ulong mask) -+private void formatIntegral(Writer, T, Char)(Writer w, const(T) val, ref FormatSpec!Char f, uint base, ulong mask) - { - FormatSpec!Char fs = f; // fs is copy for change its values. -- - T arg = val; - -- uint base = -- fs.spec == 'x' || fs.spec == 'X' ? 16 : -- fs.spec == 'o' ? 8 : -- fs.spec == 'b' ? 2 : -- fs.spec == 's' || fs.spec == 'd' || fs.spec == 'u' ? 10 : -- 0; -- enforceEx!FormatException( -- base > 0, -- "integral"); -- - bool negative = (base == 10 && arg < 0); - if (negative) - { -@@ -1379,9 +1408,9 @@ private void formatUnsigned(Writer, Char - forcedPrefix = '-'; - } - // fill the digits -- char[] digits = void; -+ char[64] buffer; // 64 bits in base 2 at most -+ char[] digits; - { -- char buffer[64]; // 64 bits in base 2 at most - uint i = buffer.length; - auto n = arg; - do -@@ -1443,10 +1472,15 @@ private void formatUnsigned(Writer, Char - if (!leftPad) foreach (i ; 0 .. spacesToPrint) put(w, ' '); - } - -+@safe pure unittest -+{ -+ assertCTFEable!( -+ { -+ formatTest( 10, "10" ); -+ }); -+} - unittest - { -- formatTest( 10, "10" ); -- - class C1 { long val; alias val this; this(long v){ val = v; } } - class C2 { long val; alias val this; this(long v){ val = v; } - override string toString() const { return "C"; } } -@@ -1515,24 +1549,25 @@ if (is(FloatingPointTypeOf!T) && !is(T = - if (fs.spec == 'r') - { - // raw write, skip all else and write the thing -- auto begin = cast(const char*) &val; -+ auto raw = (ref val)@trusted{ -+ return (cast(const char*) &val)[0 .. val.sizeof]; -+ }(val); - if (std.system.endian == Endian.littleEndian && f.flPlus - || std.system.endian == Endian.bigEndian && f.flDash) - { - // must swap bytes -- foreach_reverse (i; 0 .. val.sizeof) -- put(w, begin[i]); -+ foreach_reverse (c; raw) -+ put(w, c); - } - else - { -- foreach (i; 0 .. val.sizeof) -- put(w, begin[i]); -+ foreach (c; raw) -+ put(w, c); - } - return; - } -- enforceEx!FormatException( -- std.algorithm.find("fgFGaAeEs", fs.spec).length, -- "floating"); -+ enforceFmt(std.algorithm.find("fgFGaAeEs", fs.spec).length, -+ "floating"); - version (Win64) - { - if (isnan(val)) // snprintf writes 1.#QNAN -@@ -1563,8 +1598,8 @@ if (is(FloatingPointTypeOf!T) && !is(T = - } - } - if (fs.spec == 's') fs.spec = 'g'; -- char sprintfSpec[1 /*%*/ + 5 /*flags*/ + 3 /*width.prec*/ + 2 /*format*/ -- + 1 /*\0*/] = void; -+ char[1 /*%*/ + 5 /*flags*/ + 3 /*width.prec*/ + 2 /*format*/ -+ + 1 /*\0*/] sprintfSpec = void; - sprintfSpec[0] = '%'; - uint i = 1; - if (fs.flDash) sprintfSpec[i++] = '-'; -@@ -1585,19 +1620,20 @@ if (is(FloatingPointTypeOf!T) && !is(T = - // negative precision is same as no precision specified - fs.precision == fs.UNSPECIFIED ? -1 : fs.precision, - val); -- enforceEx!FormatException( -- n >= 0, -- "floating point formatting failure"); -+ enforceFmt(n >= 0, -+ "floating point formatting failure"); - put(w, buf[0 .. strlen(buf.ptr)]); - } - --unittest -+/*@safe pure */unittest - { - foreach (T; TypeTuple!(float, double, real)) - { - formatTest( to!( T)(5.5), "5.5" ); - formatTest( to!( const T)(5.5), "5.5" ); - formatTest( to!(immutable T)(5.5), "5.5" ); -+ -+ formatTest( T.nan, "nan" ); - } - } - -@@ -1618,14 +1654,6 @@ unittest - formatTest( S2(2.25), "S" ); - } - --unittest --{ -- foreach (T; TypeTuple!(float, double, real)) -- { -- formatTest( T.nan, "nan" ); -- } --} -- - /* - Formatting a $(D creal) is deprecated but still kept around for a while. - */ -@@ -1635,12 +1663,15 @@ if (is(Unqual!T : creal) && !is(T == enu - creal val = obj; - - formatValue(w, val.re, f); -- put(w, '+'); -+ if (val.im >= 0) -+ { -+ put(w, '+'); -+ } - formatValue(w, val.im, f); - put(w, 'i'); - } - --unittest -+/*@safe pure */unittest - { - foreach (T; TypeTuple!(cfloat, cdouble, creal)) - { -@@ -1648,6 +1679,12 @@ unittest - formatTest( to!( const T)(1 + 1i), "1+1i" ); - formatTest( to!(immutable T)(1 + 1i), "1+1i" ); - } -+ foreach (T; TypeTuple!(cfloat, cdouble, creal)) -+ { -+ formatTest( to!( T)(0 - 3i), "0-3i" ); -+ formatTest( to!( const T)(0 - 3i), "0-3i" ); -+ formatTest( to!(immutable T)(0 - 3i), "0-3i" ); -+ } - } - - unittest -@@ -1679,7 +1716,7 @@ if (is(Unqual!T : ireal) && !is(T == enu - put(w, 'i'); - } - --unittest -+/*@safe pure */unittest - { - foreach (T; TypeTuple!(ifloat, idouble, ireal)) - { -@@ -1722,14 +1759,21 @@ if (is(CharTypeOf!T) && !is(T == enum) & - } - else - { -- formatValue(w, cast(uint) val, f); -+ alias U = TypeTuple!(ubyte, ushort, uint)[CharTypeOf!T.sizeof/2]; -+ formatValue(w, cast(U) val, f); - } - } - --unittest -+@safe pure unittest - { -- formatTest( 'c', "c" ); -+ assertCTFEable!( -+ { -+ formatTest( 'c', "c" ); -+ }); -+} - -+unittest -+{ - class C1 { char val; alias val this; this(char v){ val = v; } } - class C2 { char val; alias val this; this(char v){ val = v; } - override string toString() const { return "C"; } } -@@ -1743,6 +1787,21 @@ unittest - formatTest( S2('c'), "S" ); - } - -+@safe pure unittest -+{ -+ //Little Endian -+ formatTest( "%-r", cast( char)'c', ['c' ] ); -+ formatTest( "%-r", cast(wchar)'c', ['c', 0 ] ); -+ formatTest( "%-r", cast(dchar)'c', ['c', 0, 0, 0] ); -+ formatTest( "%-r", '本', ['\x2c', '\x67'] ); -+ -+ //Big Endian -+ formatTest( "%+r", cast( char)'c', [ 'c'] ); -+ formatTest( "%+r", cast(wchar)'c', [0, 'c'] ); -+ formatTest( "%+r", cast(dchar)'c', [0, 0, 0, 'c'] ); -+ formatTest( "%+r", '本', ['\x67', '\x2c'] ); -+} -+ - /** - Strings are formatted like $(D printf) does. - */ -@@ -1784,6 +1843,25 @@ unittest - formatTest( S3("s3"), "S" ); - } - -+@safe pure unittest -+{ -+ //Little Endian -+ formatTest( "%-r", "ab"c, ['a' , 'b' ] ); -+ formatTest( "%-r", "ab"w, ['a', 0 , 'b', 0 ] ); -+ formatTest( "%-r", "ab"d, ['a', 0, 0, 0, 'b', 0, 0, 0] ); -+ formatTest( "%-r", "日本語"c, ['\xe6', '\x97', '\xa5', '\xe6', '\x9c', '\xac', '\xe8', '\xaa', '\x9e'] ); -+ formatTest( "%-r", "日本語"w, ['\xe5', '\x65', '\x2c', '\x67', '\x9e', '\x8a' ] ); -+ formatTest( "%-r", "日本語"d, ['\xe5', '\x65', '\x00', '\x00', '\x2c', '\x67', '\x00', '\x00', '\x9e', '\x8a', '\x00', '\x00'] ); -+ -+ //Big Endian -+ formatTest( "%+r", "ab"c, [ 'a', 'b'] ); -+ formatTest( "%+r", "ab"w, [ 0, 'a', 0, 'b'] ); -+ formatTest( "%+r", "ab"d, [0, 0, 0, 'a', 0, 0, 0, 'b'] ); -+ formatTest( "%+r", "日本語"c, ['\xe6', '\x97', '\xa5', '\xe6', '\x9c', '\xac', '\xe8', '\xaa', '\x9e'] ); -+ formatTest( "%+r", "日本語"w, [ '\x65', '\xe5', '\x67', '\x2c', '\x8a', '\x9e'] ); -+ formatTest( "%+r", "日本語"d, ['\x00', '\x00', '\x65', '\xe5', '\x00', '\x00', '\x67', '\x2c', '\x00', '\x00', '\x8a', '\x9e'] ); -+} -+ - /** - Static-size arrays are formatted as dynamic arrays. - */ -@@ -1851,7 +1929,7 @@ unittest - static if (flags & 4) - string toString() const { return "S"; } - } -- formatTest(S!0b000([0, 1, 2]), "S!(0)([0, 1, 2])"); -+ formatTest(S!0b000([0, 1, 2]), "S!0([0, 1, 2])"); - formatTest(S!0b001([0, 1, 2]), "[0, 1, 2]"); // Test for bug 7628 - formatTest(S!0b010([0, 1, 2]), "[0, 2, 4]"); - formatTest(S!0b011([0, 1, 2]), "[0, 2, 4]"); -@@ -1952,12 +2030,16 @@ unittest - `["hello"]` ); - - // 1 character escape sequences (' is not escaped in strings) -- formatTest( [cast(StrType)"\"'\\\a\b\f\n\r\t\v"], -- `["\"'\\\a\b\f\n\r\t\v"]` ); -+ formatTest( [cast(StrType)"\"'\0\\\a\b\f\n\r\t\v"], -+ `["\"'\0\\\a\b\f\n\r\t\v"]` ); -+ -+ // 1 character optional escape sequences -+ formatTest( [cast(StrType)"\'\?"], -+ `["'?"]` ); - - // Valid and non-printable code point (<= U+FF) -- formatTest( [cast(StrType)"\x00\x10\x1F\x20test"], -- `["\x00\x10\x1F test"]` ); -+ formatTest( [cast(StrType)"\x10\x1F\x20test"], -+ `["\x10\x1F test"]` ); - - // Valid and non-printable code point (<= U+FFFF) - formatTest( [cast(StrType)"\u200B..\u200F"], -@@ -1999,13 +2081,13 @@ unittest - formatTest( "%-(%s, %)", arr, `hello, world` ); - - auto aa1 = [1:"hello", 2:"world"]; -- formatTest( "%(%s:%s, %)", aa1, `1:"hello", 2:"world"` ); -- formatTest( "%-(%s:%s, %)", aa1, `1:hello, 2:world` ); -+ formatTest( "%(%s:%s, %)", aa1, [`1:"hello", 2:"world"`, `2:"world", 1:"hello"`] ); -+ formatTest( "%-(%s:%s, %)", aa1, [`1:hello, 2:world`, `2:world, 1:hello`] ); - - auto aa2 = [1:["ab", "cd"], 2:["ef", "gh"]]; -- formatTest( "%-(%s:%s, %)", aa2, `1:["ab", "cd"], 2:["ef", "gh"]` ); -- formatTest( "%-(%s:%(%s%), %)", aa2, `1:"ab""cd", 2:"ef""gh"` ); -- formatTest( "%-(%s:%-(%s%)%|, %)", aa2, `1:abcd, 2:efgh` ); -+ formatTest( "%-(%s:%s, %)", aa2, [`1:["ab", "cd"], 2:["ef", "gh"]`, `2:["ef", "gh"], 1:["ab", "cd"]`] ); -+ formatTest( "%-(%s:%(%s%), %)", aa2, [`1:"ab""cd", 2:"ef""gh"`, `2:"ef""gh", 1:"ab""cd"`] ); -+ formatTest( "%-(%s:%-(%s%)%|, %)", aa2, [`1:abcd, 2:efgh`, `2:efgh, 1:abcd`] ); - } - - // input range formatting -@@ -2013,116 +2095,126 @@ private void formatRange(Writer, T, Char - if (isInputRange!T) - { - // Formatting character ranges like string -- static if (is(CharTypeOf!(ElementType!T))) - if (f.spec == 's') - { -- static if (is(StringTypeOf!T)) -+ static if (is(CharTypeOf!(ElementType!T))) - { -- auto s = val[0 .. f.precision < $ ? f.precision : $]; -- if (!f.flDash) -+ static if (is(StringTypeOf!T)) - { -- // right align -- if (f.width > s.length) -- foreach (i ; 0 .. f.width - s.length) put(w, ' '); -- put(w, s); -- } -- else -- { -- // left align -- put(w, s); -- if (f.width > s.length) -- foreach (i ; 0 .. f.width - s.length) put(w, ' '); -- } -- } -- else -- { -- if (!f.flDash) -- { -- static if (hasLength!T) -+ auto s = val[0 .. f.precision < $ ? f.precision : $]; -+ if (!f.flDash) - { - // right align -- auto len = val.length; -- } -- else static if (isForwardRange!T && !isInfinite!T) -- { -- auto len = walkLength(val.save); -- } -- else -- { -- enforce(f.width == 0, "Cannot right-align a range without length"); -- size_t len = 0; -+ if (f.width > s.length) -+ foreach (i ; 0 .. f.width - s.length) put(w, ' '); -+ put(w, s); - } -- if (f.precision != f.UNSPECIFIED && len > f.precision) -- len = f.precision; -- -- if (f.width > len) -- foreach (i ; 0 .. f.width - len) -- put(w, ' '); -- if (f.precision == f.UNSPECIFIED) -- put(w, val); - else - { -- size_t printed = 0; -- for (; !val.empty && printed < f.precision; val.popFront(), ++printed) -- put(w, val.front); -+ // left align -+ put(w, s); -+ if (f.width > s.length) -+ foreach (i ; 0 .. f.width - s.length) put(w, ' '); - } - } - else - { -- size_t printed = void; -- -- // left align -- if (f.precision == f.UNSPECIFIED) -+ if (!f.flDash) - { - static if (hasLength!T) - { -- printed = val.length; -+ // right align -+ auto len = val.length; -+ } -+ else static if (isForwardRange!T && !isInfinite!T) -+ { -+ auto len = walkLength(val.save); -+ } -+ else -+ { -+ enforce(f.width == 0, "Cannot right-align a range without length"); -+ size_t len = 0; -+ } -+ if (f.precision != f.UNSPECIFIED && len > f.precision) -+ len = f.precision; -+ -+ if (f.width > len) -+ foreach (i ; 0 .. f.width - len) -+ put(w, ' '); -+ if (f.precision == f.UNSPECIFIED) - put(w, val); -+ else -+ { -+ size_t printed = 0; -+ for (; !val.empty && printed < f.precision; val.popFront(), ++printed) -+ put(w, val.front); -+ } -+ } -+ else -+ { -+ size_t printed = void; -+ -+ // left align -+ if (f.precision == f.UNSPECIFIED) -+ { -+ static if (hasLength!T) -+ { -+ printed = val.length; -+ put(w, val); -+ } -+ else -+ { -+ printed = 0; -+ for (; !val.empty; val.popFront(), ++printed) -+ put(w, val.front); -+ } - } - else - { - printed = 0; -- for (; !val.empty; val.popFront(), ++printed) -+ for (; !val.empty && printed < f.precision; val.popFront(), ++printed) - put(w, val.front); - } -+ -+ if (f.width > printed) -+ foreach (i ; 0 .. f.width - printed) -+ put(w, ' '); - } -- else -+ } -+ } -+ else -+ { -+ put(w, f.seqBefore); -+ if (!val.empty) -+ { -+ formatElement(w, val.front, f); -+ val.popFront(); -+ for (size_t i; !val.empty; val.popFront(), ++i) - { -- printed = 0; -- for (; !val.empty && printed < f.precision; val.popFront(), ++printed) -- put(w, val.front); -+ put(w, f.seqSeparator); -+ formatElement(w, val.front, f); - } -- -- if (f.width > printed) -- foreach (i ; 0 .. f.width - printed) -- put(w, ' '); - } -+ static if (!isInfinite!T) put(w, f.seqAfter); - } -- return; - } -- -- if (f.spec == 'r') -+ else if (f.spec == 'r') - { -- // raw writes -- for (size_t i; !val.empty; val.popFront(), ++i) -+ static if (is(DynamicArrayTypeOf!T)) - { -- formatValue(w, val.front, f); -+ alias ARR = DynamicArrayTypeOf!T; -+ foreach (e ; cast(ARR)val) -+ { -+ formatValue(w, e, f); -+ } - } -- } -- else if (f.spec == 's') -- { -- put(w, f.seqBefore); -- if (!val.empty) -+ else - { -- formatElement(w, val.front, f); -- val.popFront(); - for (size_t i; !val.empty; val.popFront(), ++i) - { -- put(w, f.seqSeparator); -- formatElement(w, val.front, f); -+ formatValue(w, val.front, f); - } - } -- static if (!isInfinite!T) put(w, f.seqAfter); - } - else if (f.spec == '(') - { -@@ -2161,6 +2253,8 @@ if (isInputRange!T) - // character formatting with ecaping - private void formatChar(Writer)(Writer w, in dchar c, in char quote) - { -+ import std.uni : isGraphical; -+ - if (std.uni.isGraphical(c)) - { - if (c == quote || c == '\\') -@@ -2173,6 +2267,7 @@ private void formatChar(Writer)(Writer w - put(w, '\\'); - switch (c) - { -+ case '\0': put(w, '0'); break; - case '\a': put(w, 'a'); break; - case '\b': put(w, 'b'); break; - case '\f': put(w, 'f'); break; -@@ -2284,7 +2379,7 @@ if (!is(StringTypeOf!T) && !is(CharTypeO - } - - /** -- Associative arrays are formatted by using $(D ':') and $(D ', ') as -+ Associative arrays are formatted by using $(D ':') and $(D ", ") as - separators, and enclosed by $(D '[') and $(D ']'). - */ - void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) -@@ -2292,9 +2387,8 @@ if (is(AssocArrayTypeOf!T) && !is(T == e - { - AssocArrayTypeOf!T val = obj; - -- enforceEx!FormatException( -- f.spec == 's' || f.spec == '(', -- "associative"); -+ enforceFmt(f.spec == 's' || f.spec == '(', -+ "associative"); - - enum const(Char)[] defSpec = "%s" ~ f.keySeparator ~ "%s" ~ f.seqSeparator; - auto fmtSpec = f.spec == '(' ? f.nested : defSpec; -@@ -2341,21 +2435,21 @@ unittest - formatTest( aa0, `[]` ); - - // elements escaping -- formatTest( ["aaa":1, "bbb":2, "ccc":3], -- `["aaa":1, "bbb":2, "ccc":3]` ); -+ formatTest( ["aaa":1, "bbb":2], -+ [`["aaa":1, "bbb":2]`, `["bbb":2, "aaa":1]`] ); - formatTest( ['c':"str"], - `['c':"str"]` ); - formatTest( ['"':"\"", '\'':"'"], -- `['"':"\"", '\'':"'"]` ); -+ [`['"':"\"", '\'':"'"]`, `['\'':"'", '"':"\""]`] ); - - // range formatting for AA - auto aa3 = [1:"hello", 2:"world"]; - // escape - formatTest( "{%(%s:%s $ %)}", aa3, -- `{1:"hello" $ 2:"world"}`); -+ [`{1:"hello" $ 2:"world"}`, `{2:"world" $ 1:"hello"}`]); - // use range formatting for key and value, and use %| - formatTest( "{%([%04d->%(%c.%)]%| $ %)}", aa3, -- `{[0001->h.e.l.l.o] $ [0002->w.o.r.l.d]}` ); -+ [`{[0001->h.e.l.l.o] $ [0002->w.o.r.l.d]}`, `{[0002->w.o.r.l.d] $ [0001->h.e.l.l.o]}`] ); - } - - unittest -@@ -2363,13 +2457,13 @@ unittest - class C1 { int[char] val; alias val this; this(int[char] v){ val = v; } } - class C2 { int[char] val; alias val this; this(int[char] v){ val = v; } - override string toString() const { return "C"; } } -- formatTest( new C1(['c':1, 'd':2]), `['c':1, 'd':2]` ); -+ formatTest( new C1(['c':1, 'd':2]), [`['c':1, 'd':2]`, `['d':2, 'c':1]`] ); - formatTest( new C2(['c':1, 'd':2]), "C" ); - - struct S1 { int[char] val; alias val this; } - struct S2 { int[char] val; alias val this; - string toString() const { return "S"; } } -- formatTest( S1(['c':1, 'd':2]), `['c':1, 'd':2]` ); -+ formatTest( S1(['c':1, 'd':2]), [`['c':1, 'd':2]`, `['d':2, 'c':1]`] ); - formatTest( S2(['c':1, 'd':2]), "S" ); - } - -@@ -2431,8 +2525,8 @@ void enforceValidFormatSpec(T, Char)(ref - { - static if (!isInputRange!T && hasToString!(T, Char) != 4) - { -- enforceEx!FormatException(f.spec == 's', -- format("Expected '%%s' format specifier for type '%s'", T.stringof)); -+ enforceFmt(f.spec == 's', -+ "Expected '%s' format specifier for type '" ~ T.stringof ~ "'"); - } - } - -@@ -2847,33 +2941,34 @@ if (isPointer!T && !is(T == enum) && !ha - else - { - const p = val; -+ const pnum = ()@trusted{ return cast(ulong) p; }(); - if (f.spec == 's') - { - FormatSpec!Char fs = f; // fs is copy for change its values. - fs.spec = 'X'; -- formatValue(w, cast(ulong) p, fs); -+ formatValue(w, pnum, fs); - } - else - { -- enforceEx!FormatException(f.spec == 'X' || f.spec == 'x', -+ enforceFmt(f.spec == 'X' || f.spec == 'x', - "Expected one of %s, %x or %X for pointer type."); -- formatValue(w, cast(ulong) p, f); -+ formatValue(w, pnum, f); - } - } - } - } - --unittest -+@safe pure unittest - { - // pointer - auto r = retro([1,2,3,4]); -- auto p = &r; -+ auto p = ()@trusted{ auto p = &r; return p; }(); - formatTest( p, "[4, 3, 2, 1]" ); - assert(p.empty); - p = null; - formatTest( p, "null" ); - -- auto q = cast(void*)0xFFEECCAA; -+ auto q = ()@trusted{ return cast(void*)0xFFEECCAA; }(); - formatTest( q, "FFEECCAA" ); - } - -@@ -2916,16 +3011,16 @@ unittest - void formatValue(Writer, T, Char)(Writer w, T val, ref FormatSpec!Char f) - if (is(T == delegate) && !is(T == enum) && !hasToString!(T, Char)) - { -- alias FunctionAttribute FA; -+ alias FA = FunctionAttribute; - if (functionAttributes!T & FA.pure_) formatValue(w, "pure ", f); - if (functionAttributes!T & FA.nothrow_) formatValue(w, "nothrow ", f); - if (functionAttributes!T & FA.ref_) formatValue(w, "ref ", f); - if (functionAttributes!T & FA.property) formatValue(w, "@property ", f); - if (functionAttributes!T & FA.trusted) formatValue(w, "@trusted ", f); - if (functionAttributes!T & FA.safe) formatValue(w, "@safe ", f); -- formatValue(w, ReturnType!(T).stringof,f); -- formatValue(w, " delegate",f); -- formatValue(w, ParameterTypeTuple!(T).stringof,f); -+ formatValue(w, ReturnType!T.stringof, f); -+ formatValue(w, " delegate", f); -+ formatValue(w, ParameterTypeTuple!T.stringof, f); - } - - unittest -@@ -3043,6 +3138,35 @@ void formatTest(T)(string fmt, T val, st - text("expected = `", expected, "`, result = `", w.data, "`"), fn, ln); - } - -+version(unittest) -+void formatTest(T)(T val, string[] expected, size_t ln = __LINE__, string fn = __FILE__) -+{ -+ FormatSpec!char f; -+ auto w = appender!string(); -+ formatValue(w, val, f); -+ foreach(cur; expected) -+ { -+ if(w.data == cur) return; -+ } -+ enforceEx!AssertError( -+ false, -+ text("expected one of `", expected, "`, result = `", w.data, "`"), fn, ln); -+} -+ -+version(unittest) -+void formatTest(T)(string fmt, T val, string[] expected, size_t ln = __LINE__, string fn = __FILE__) -+{ -+ auto w = appender!string(); -+ formattedWrite(w, fmt, val); -+ foreach(cur; expected) -+ { -+ if(w.data == cur) return; -+ } -+ enforceEx!AssertError( -+ false, -+ text("expected one of `", expected, "`, result = `", w.data, "`"), fn, ln); -+} -+ - unittest - { - auto stream = appender!string(); -@@ -3128,6 +3252,11 @@ unittest - assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 nan", - stream.data); - } -+ else version (MinGW) -+ { -+ assert(stream.data == "1.67 -0XA.3D70A3D70A3D8P-3 nan", -+ stream.data); -+ } - else - { - assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 nan", -@@ -3635,10 +3764,50 @@ void formatReflectTest(T)(ref T val, str - } - - version(unittest) --@property void checkCTFEable(alias dg)() -+void formatReflectTest(T)(ref T val, string fmt, string[] formatted, string fn = __FILE__, size_t ln = __LINE__) - { -- static assert({ dg(); return true; }()); -- dg(); -+ auto w = appender!string(); -+ formattedWrite(w, fmt, val); -+ -+ auto input = w.data; -+ -+ foreach(cur; formatted) -+ { -+ if(input == cur) return; -+ } -+ enforceEx!AssertError( -+ false, -+ input, -+ fn, -+ ln); -+ -+ T val2; -+ formattedRead(input, fmt, &val2); -+ static if (isAssociativeArray!T) -+ if (__ctfe) -+ { -+ alias val aa1; -+ alias val2 aa2; -+ //assert(aa1 == aa2); -+ -+ assert(aa1.length == aa2.length); -+ -+ assert(aa1.keys == aa2.keys); -+ -+ //assert(aa1.values == aa2.values); -+ assert(aa1.values.length == aa2.values.length); -+ foreach (i; 0 .. aa1.values.length) -+ assert(aa1.values[i] == aa2.values[i]); -+ -+ //foreach (i, key; aa1.keys) -+ // assert(aa1.values[i] == aa1[key]); -+ //foreach (i, key; aa2.keys) -+ // assert(aa2.values[i] == aa2[key]); -+ return; -+ } -+ enforceEx!AssertError( -+ val == val2, -+ input, fn, ln); - } - - unittest -@@ -3669,7 +3838,10 @@ unittest - { - auto f = 3.14; - formatReflectTest(f, "%s", `3.14`); -- formatReflectTest(f, "%e", `3.140000e+00`); -+ version (MinGW) -+ formatReflectTest(f, "%e", `3.140000e+000`); -+ else -+ formatReflectTest(f, "%e", `3.140000e+00`); - formatReflectTest(f, "%f", `3.140000`); - formatReflectTest(f, "%g", `3.14`); - } -@@ -3714,12 +3886,14 @@ unittest - void aaTest() - { - auto aa = [1:"hello", 2:"world"]; -- formatReflectTest(aa, "%s", `[1:"hello", 2:"world"]`); -- formatReflectTest(aa, "[%(%s->%s, %)]", `[1->"hello", 2->"world"]`); -- formatReflectTest(aa, "{%([%s=%(%c%)]%|; %)}", `{[1=hello]; [2=world]}`); -+ formatReflectTest(aa, "%s", [`[1:"hello", 2:"world"]`, `[2:"world", 1:"hello"]`]); -+ formatReflectTest(aa, "[%(%s->%s, %)]", [`[1->"hello", 2->"world"]`, `[2->"world", 1->"hello"]`]); -+ formatReflectTest(aa, "{%([%s=%(%c%)]%|; %)}", [`{[1=hello]; [2=world]}`, `{[2=world]; [1=hello]}`]); - } - -- checkCTFEable!({ -+ import std.exception; -+ assertCTFEable!( -+ { - booleanTest(); - integerTest(); - if (!__ctfe) floatingTest(); // snprintf -@@ -4841,7 +5015,6 @@ void doFormat(void delegate(dchar) putc, - //doFormat(putc, (&valti)[0 .. 1], p); - version (Win64) - { -- static assert (false, "needs checking"); - void* q = void; - - if (tsize > 8 && m != Mangle.Tsarray) -@@ -4862,7 +5035,7 @@ void doFormat(void delegate(dchar) putc, - va.stack_args = p; - argptr = *cast(va_list*) &va; - } -- else version(ARM) -+ else version (ARM) - *cast(void**) &argptr = p; - else - static assert(false, "unsupported platform"); -@@ -4911,7 +5084,6 @@ void doFormat(void delegate(dchar) putc, - argptr = cast(va_list) pkey; - else version (Win64) - { -- static assert (false, "needs checking"); - void* q = void; - if (keysize > 8 && m != Mangle.Tsarray) - { q = pkey; -@@ -4926,9 +5098,7 @@ void doFormat(void delegate(dchar) putc, - argptr = *cast(va_list*) &va; - } - else version (ARM) -- { - *cast(void**) &argptr = pkey; -- } - else static assert(false, "unsupported platform"); - - ti = keyti; -@@ -4941,7 +5111,6 @@ void doFormat(void delegate(dchar) putc, - argptr = cast(va_list) pvalue; - else version (Win64) - { -- static assert (false, "needs checking"); - void* q2 = void; - auto valuesize = valti.tsize; - if (valuesize > 8 && m != Mangle.Tsarray) -@@ -5104,13 +5273,13 @@ void doFormat(void delegate(dchar) putc, - - case Mangle.Tsarray: - version (X86) -- putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next); -+ putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next); - else version (Win64) -- putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next); -+ putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next); - else version (X86_64) -- putArray((cast(__va_list*)argptr).stack_args, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next); -+ putArray((cast(__va_list*)argptr).stack_args, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next); - else version (ARM) -- putArray(*cast(void**) &argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next); -+ putArray(*cast(void**) &argptr, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next); - else static assert(false, "unsupported platform"); - return; - -@@ -5119,7 +5288,7 @@ void doFormat(void delegate(dchar) putc, - if (ti.classinfo.name.length == 14 && - ti.classinfo.name[9..14] == "Array") - { // array of non-primitive types -- TypeInfo tn = cast()(cast(TypeInfo_Array)ti).next; -+ TypeInfo tn = (cast(TypeInfo_Array)ti).next; - tn = skipCI(tn); - switch (cast(Mangle)tn.classinfo.name[9]) - { -@@ -5138,7 +5307,7 @@ void doFormat(void delegate(dchar) putc, - { // associative array - ubyte[long] vaa = va_arg!(ubyte[long])(argptr); - putAArray(vaa, -- cast()(cast(TypeInfo_AssociativeArray)ti).next, -+ (cast(TypeInfo_AssociativeArray)ti).next, - (cast(TypeInfo_AssociativeArray)ti).key); - return; - } -@@ -5211,7 +5380,6 @@ void doFormat(void delegate(dchar) putc, - } - else version(Win64) - { -- static assert (false, "needs checking"); - void* p = argptr; - if (tis.tsize > 8) - p = *cast(void**)p; -@@ -5378,7 +5546,10 @@ void doFormat(void delegate(dchar) putc, - - Lcomplex: - putreal(vcreal.re); -- putc('+'); -+ if (vcreal.im >= 0) -+ { -+ putc('+'); -+ } - putreal(vcreal.im); - putc('i'); - return; -@@ -5411,7 +5582,7 @@ void doFormat(void delegate(dchar) putc, - if (ti.classinfo.name.length == 14 && - ti.classinfo.name[9..14] == "Array") - { -- TypeInfo tn = cast()(cast(TypeInfo_Array)ti).next; -+ TypeInfo tn = (cast(TypeInfo_Array)ti).next; - tn = skipCI(tn); - switch (cast(Mangle)tn.classinfo.name[9]) - { -@@ -5624,6 +5795,9 @@ unittest - //else version (OSX) - // assert(s == "1.67 -0XA.3D70A3D70A3D8P-3 nan", s); - //else -+ version (MinGW) -+ assert(s == "1.67 -0XA.3D70A3D70A3D8P-3 nan", s); -+ else - assert(s == "1.67 -0X1.47AE147AE147BP+0 nan", s); - - s = std.string.format("%x %X", 0x1234AF, 0xAFAFAFAF); -@@ -5879,9 +6053,9 @@ unittest - - immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]); - r = std.string.format("%s", aa.values); -- assert(r == `["hello", "betty"]`); -+ assert(r == `["hello", "betty"]` || r == `["betty", "hello"]`); - r = std.string.format("%s", aa); -- assert(r == `[3:"hello", 4:"betty"]`); -+ assert(r == `[3:"hello", 4:"betty"]` || r == `[4:"betty", 3:"hello"]`); - - static const dchar[] ds = ['a','b']; - for (int j = 0; j < ds.length; ++j) -@@ -5907,3 +6081,12 @@ unittest - formattedWrite(stream, "%2$.*1$d", 12, 10); - assert(stream.data == "000000000010", stream.data); - } -+ -+unittest -+{ -+ // bug 6893 -+ enum E : ulong { A, B, C } -+ auto stream = appender!(char[])(); -+ formattedWrite(stream, "%s", E.C); -+ assert(stream.data == "C"); -+} ---- a/src/libphobos/src/std/functional.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/functional.d 2014-04-01 16:32:51.000000000 +0100 -@@ -20,7 +20,7 @@ Distributed under the Boost Software Lic - */ - module std.functional; - --import std.metastrings, std.traits, std.typecons, std.typetuple; -+import std.traits, std.typecons, std.typetuple; - // for making various functions visible in *naryFun - import std.algorithm, std.conv, std.exception, std.math, std.range, std.string; - ---- a/src/libphobos/src/std/getopt.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/getopt.d 2014-04-01 16:32:51.000000000 +0100 -@@ -84,14 +84,20 @@ void main(string[] args) - Depending on the type of the pointer being bound, $(D getopt) - recognizes the following kinds of options: - -- $(OL $(LI $(I Boolean options). These are the simplest options; all -- they do is set a Boolean to $(D true): -+ $(OL $(LI $(I Boolean options). A lone argument sets the option to $(D true). -+ Additionally $(B true) or $(B false) can be set within the option separated with -+ an "=" sign: - - --------- -- bool verbose, debugging; -+ bool verbose = false, debugging = true; - getopt(args, "verbose", &verbose, "debug", &debugging); - --------- - -+ To set $(D verbose) to $(D true), invoke the program with either $(D -+ --verbose) or $(D --verbose=true). -+ -+ To set $(D debugging) to $(D false), invoke the program with $(D --debugging=false). -+ - )$(LI $(I Numeric options.) If an option is bound to a numeric type, a - number is expected as the next option, or right within the option - separated with an "=" sign: -@@ -172,15 +178,15 @@ Invoking the program with e.g. "--tune=a - set $(D tuningParms) to [ "alpha" : 0.5, "beta" : 0.6 ]. In general, - keys and values can be of any parsable types.) - --$(LI $(I Delegate options.) An option can be bound to a delegate with --the signature $(D void delegate()), $(D void delegate(string option)) --or $(D void delegate(string option, string value)). -- --$(UL $(LI In the $(D void delegate()) case, the delegate is invoked --whenever the option is seen.) $(LI In the $(D void delegate(string --option)) case, the option string (without the leading dash(es)) is --passed to the delegate. After that, the option string is considered --handled and removed from the options array. -+$(LI $(I Callback options.) An option can be bound to a function or -+delegate with the signature $(D void function()), $(D void function(string option)), -+$(D void function(string option, string value)), or their delegate equivalents. -+ -+$(UL $(LI If the callback doesn't take any arguments, the callback is invoked -+whenever the option is seen.) $(LI If the callback takes one string argument, -+the option string (without the leading dash(es)) is passed to the callback. -+After that, the option string is considered handled and removed from the -+options array. - - --------- - void main(string[] args) -@@ -202,10 +208,10 @@ void main(string[] args) - } - --------- - --)$(LI In the $(D void delegate(string option, string value)) case, the -+)$(LI If the callback takes two string arguments, the - option string is handled as an option with one argument, and parsed - accordingly. The option and its value are passed to the --delegate. After that, whatever was passed to the delegate is -+callback. After that, whatever was passed to the callback is - considered handled and removed from the list. - - --------- -@@ -366,7 +372,7 @@ enum config { - noPassThrough, - /// Stop at first argument that does not look like an option - stopOnFirstNonOption, --}; -+} - - private void getoptImpl(T...)(ref string[] args, - ref configuration cfg, T opts) -@@ -398,14 +404,19 @@ private void getoptImpl(T...)(ref string - else - { - // no more options to look for, potentially some arguments left -- foreach (a ; args[1 .. $]) { -+ foreach (i, a ; args[1 .. $]) { - if (!a.length || a[0] != optionChar) - { - // not an option - if (cfg.stopOnFirstNonOption) break; - continue; - } -- if (endOfOptions.length && a == endOfOptions) break; -+ if (endOfOptions.length && a == endOfOptions) -+ { -+ // Consume the "--" -+ args = args.remove(i + 1); -+ break; -+ } - if (!cfg.passThrough) - { - throw new Exception("Unrecognized option "~a); -@@ -451,17 +462,25 @@ void handleOption(R)(string option, R re - - static if (is(typeof(*receiver) == bool)) - { -+ // parse '--b=true/false' -+ if (val.length) -+ { -+ *receiver = parse!(typeof(*receiver))(val); -+ break; -+ } -+ -+ // no argument means set it to true - *receiver = true; - break; - } - else - { - // non-boolean option, which might include an argument -- //enum isDelegateWithOneParameter = is(typeof(receiver("")) : void); -- enum isDelegateWithLessThanTwoParameters = -- is(typeof(receiver) == delegate) && -+ //enum isCallbackWithOneParameter = is(typeof(receiver("")) : void); -+ enum isCallbackWithLessThanTwoParameters = -+ (is(typeof(receiver) == delegate) || is(typeof(*receiver) == function)) && - !is(typeof(receiver("", ""))); -- if (!isDelegateWithLessThanTwoParameters && !(val.length) && !incremental) { -+ if (!isCallbackWithLessThanTwoParameters && !(val.length) && !incremental) { - // Eat the next argument too. Check to make sure there's one - // to be eaten first, though. - enforce(i < args.length, -@@ -485,7 +504,8 @@ void handleOption(R)(string option, R re - // string receiver - *receiver = to!(typeof(*receiver))(val); - } -- else static if (is(typeof(receiver) == delegate)) -+ else static if (is(typeof(receiver) == delegate) || -+ is(typeof(*receiver) == function)) - { - static if (is(typeof(receiver("", "")) : void)) - { -@@ -629,6 +649,7 @@ private void setConfig(ref configuration - - unittest - { -+ import std.math; - uint paranoid = 2; - string[] args = (["program.name", - "--paranoid", "--paranoid", "--paranoid"]).dup; -@@ -675,8 +696,8 @@ unittest - getopt(args, "tune", &tuningParms); - assert(args.length == 1); - assert(tuningParms.length == 2); -- assert(tuningParms["alpha"] == 0.5); -- assert(tuningParms["beta"] == 0.6); -+ assert(approxEqual(tuningParms["alpha"], 0.5)); -+ assert(approxEqual(tuningParms["beta"], 0.6)); - - uint verbosityLevel = 1; - void myHandler(string option) -@@ -743,6 +764,39 @@ unittest - "foo", &foo, - "bar", &bar); - assert(foo && !bar && args[1] == "nonoption" && args[2] == "--zab"); -+ -+ args = (["program.name", "--fb1", "--fb2=true", "--tb1=false"]).dup; -+ bool fb1, fb2; -+ bool tb1 = true; -+ getopt(args, "fb1", &fb1, "fb2", &fb2, "tb1", &tb1); -+ assert(fb1 && fb2 && !tb1); -+ -+ // test function callbacks -+ -+ static class MyEx : Exception -+ { -+ this() { super(""); } -+ this(string option) { this(); this.option = option; } -+ this(string option, string value) { this(option); this.value = value; } -+ -+ string option; -+ string value; -+ } -+ -+ static void myStaticHandler1() { throw new MyEx(); } -+ args = (["program.name", "--verbose"]).dup; -+ try { getopt(args, "verbose", &myStaticHandler1); assert(0); } -+ catch (MyEx ex) { assert(ex.option is null && ex.value is null); } -+ -+ static void myStaticHandler2(string option) { throw new MyEx(option); } -+ args = (["program.name", "--verbose"]).dup; -+ try { getopt(args, "verbose", &myStaticHandler2); assert(0); } -+ catch (MyEx ex) { assert(ex.option == "verbose" && ex.value is null); } -+ -+ static void myStaticHandler3(string option, string value) { throw new MyEx(option, value); } -+ args = (["program.name", "--verbose", "2"]).dup; -+ try { getopt(args, "verbose", &myStaticHandler3); assert(0); } -+ catch (MyEx ex) { assert(ex.option == "verbose" && ex.value == "2"); } - } - - unittest -@@ -780,3 +834,12 @@ unittest - getopt(args, "t", &foo); - assert(foo == ["a":1]); - } -+ -+unittest -+{ -+ // From bugzilla 9583 -+ int opt; -+ auto args = ["prog", "--opt=123", "--", "--a", "--b", "--c"]; -+ getopt(args, "opt", &opt); -+ assert(args == ["prog", "--a", "--b", "--c"]); -+} ---- a/src/libphobos/src/std/internal/digest/sha_SSSE3.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/internal/digest/sha_SSSE3.d 2014-04-01 16:32:51.000000000 +0100 -@@ -214,6 +214,8 @@ version(USE_SSSE3) - */ - private nothrow pure string[] weave(string[] seq1, string[] seq2, uint dist = 1) - { -+ import std.algorithm : min; -+ - string[] res = []; - auto i1 = 0, i2 = 0; - while (i1 < seq1.length || i2 < seq2.length) ---- a/src/libphobos/src/std/internal/math/biguintcore.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/internal/math/biguintcore.d 2014-04-01 16:32:51.000000000 +0100 -@@ -73,6 +73,13 @@ else static if (BigDigit.sizeof == long. - } - else static assert(0, "Unsupported BigDigit size"); - -+private import std.traits:isIntegral; -+enum BigDigitBits = BigDigit.sizeof*8; -+template maxBigDigits(T) if (isIntegral!T) -+{ -+ enum maxBigDigits = (T.sizeof+BigDigit.sizeof-1)/BigDigit.sizeof; -+} -+ - enum BigDigit [] ZERO = [0]; - enum BigDigit [] ONE = [1]; - enum BigDigit [] TWO = [2]; -@@ -85,15 +92,19 @@ public: - struct BigUint - { - private: -- invariant() -+ pure invariant() - { - assert( data.length == 1 || data[$-1] != 0 ); - } - BigDigit [] data = ZERO; -- this(BigDigit [] x) -+ this(BigDigit [] x) pure - { - data = x; - } -+ this(T)(T x) pure if (isIntegral!T) -+ { -+ opAssign(x); -+ } - public: - // Length in uints - size_t uintLength() pure const -@@ -126,14 +137,7 @@ public: - static if (BigDigit.sizeof == int.sizeof) - { - if (data.length == n*2 + 1) return data[n*2]; -- version(LittleEndian) -- { -- return data[n*2] + ((cast(ulong)data[n*2 + 1]) << 32 ); -- } -- else -- { -- return data[n*2 + 1] + ((cast(ulong)data[n*2]) << 32 ); -- } -+ return data[n*2] + ((cast(ulong)data[n*2 + 1]) << 32 ); - } - else static if (BigDigit.sizeof == long.sizeof) - { -@@ -154,7 +158,7 @@ public: - } - public: - /// -- void opAssign(Tulong)(Tulong u) if (is (Tulong == ulong)) -+ void opAssign(Tulong)(Tulong u) pure if (is (Tulong == ulong)) - { - if (u == 0) data = ZERO; - else if (u == 1) data = ONE; -@@ -185,13 +189,13 @@ public: - } - } - } -- void opAssign(Tdummy = void)(BigUint y) -+ void opAssign(Tdummy = void)(BigUint y) pure - { - this.data = y.data; - } - - /// -- int opCmp(Tdummy = void)(BigUint y) -+ int opCmp(Tdummy = void)(const BigUint y) pure const - { - if (data.length != y.data.length) - return (data.length > y.data.length) ? 1 : -1; -@@ -202,17 +206,26 @@ public: - } - - /// -- int opCmp(Tulong)(Tulong y) if (is (Tulong == ulong)) -+ int opCmp(Tulong)(Tulong y) pure if(is (Tulong == ulong)) - { -- if (data.length > 2) -+ if (data.length > maxBigDigits!Tulong) - return 1; -- uint ylo = cast(uint)(y & 0xFFFF_FFFF); -- uint yhi = cast(uint)(y >> 32); -- if (data.length == 2 && data[1] != yhi) -- return data[1] > yhi ? 1: -1; -- if (data[0] == ylo) -- return 0; -- return data[0] > ylo ? 1: -1; -+ -+ foreach_reverse (i; 0 .. maxBigDigits!Tulong) -+ { -+ BigDigit tmp = cast(BigDigit)(y>>(i*BigDigitBits)); -+ if (tmp == 0) -+ if (data.length >= i+1) -+ return 1; -+ else -+ continue; -+ else -+ if (i+1 > data.length) -+ return -1; -+ else if (tmp != data[i]) -+ return data[i] > tmp ? 1 : -1; -+ } -+ return 0; - } - - bool opEquals(Tdummy = void)(ref const BigUint y) pure const -@@ -233,7 +246,7 @@ public: - return (data[0] == ylo); - } - -- bool isZero() pure const -+ bool isZero() pure const nothrow @safe - { - return data.length == 1 && data[0] == 0; - } -@@ -244,7 +257,7 @@ public: - } - - // the extra bytes are added to the start of the string -- char [] toDecimalString(int frontExtraBytes) const -+ char [] toDecimalString(int frontExtraBytes) const pure - { - auto predictlength = 20+20*(data.length/2); // just over 19 - char [] buff = new char[frontExtraBytes + predictlength]; -@@ -259,7 +272,8 @@ public: - * between every 8 digits. - * Separator characters do not contribute to the minPadding. - */ -- char [] toHexString(int frontExtraBytes, char separator = 0, int minPadding=0, char padChar = '0') const -+ char [] toHexString(int frontExtraBytes, char separator = 0, -+ int minPadding=0, char padChar = '0') const pure - { - // Calculate number of extra padding bytes - size_t extraPad = (minPadding > data.length * 2 * BigDigit.sizeof) -@@ -321,7 +335,7 @@ public: - } - - // return false if invalid character found -- bool fromHexString(const(char)[] s) -+ bool fromHexString(const(char)[] s) pure - { - //Strip leading zeros - int firstNonZero = 0; -@@ -369,7 +383,7 @@ public: - } - - // return true if OK; false if erroneous characters found -- bool fromDecimalString(const(char)[] s) -+ bool fromDecimalString(const(char)[] s) pure - { - //Strip leading zeros - int firstNonZero = 0; -@@ -395,7 +409,7 @@ public: - // All of these member functions create a new BigUint. - - // return x >> y -- BigUint opShr(Tulong)(Tulong y) if (is (Tulong == ulong)) -+ BigUint opShr(Tulong)(Tulong y) pure if (is (Tulong == ulong)) - { - assert(y>0); - uint bits = cast(uint)y & BIGDIGITSHIFTMASK; -@@ -415,7 +429,7 @@ public: - } - - // return x << y -- BigUint opShl(Tulong)(Tulong y) if (is (Tulong == ulong)) -+ BigUint opShl(Tulong)(Tulong y) pure if (is (Tulong == ulong)) - { - assert(y>0); - if (isZero()) return this; -@@ -440,8 +454,8 @@ public: - - // If wantSub is false, return x + y, leaving sign unchanged - // If wantSub is true, return abs(x - y), negating sign if x < y -- static BigUint addOrSubInt(Tulong)(const BigUint x, Tulong y, bool wantSub, ref bool sign) -- if (is(Tulong == ulong)) -+ static BigUint addOrSubInt(Tulong)(const BigUint x, Tulong y, -+ bool wantSub, ref bool sign) pure if (is(Tulong == ulong)) - { - BigUint r; - if (wantSub) -@@ -487,6 +501,7 @@ public: - // If wantSub is false, return x + y, leaving sign unchanged. - // If wantSub is true, return abs(x - y), negating sign if x<y - static BigUint addOrSub(BigUint x, BigUint y, bool wantSub, bool *sign) -+ pure - { - BigUint r; - if (wantSub) -@@ -509,7 +524,7 @@ public: - - // return x*y. - // y must not be zero. -- static BigUint mulInt(T = ulong)(BigUint x, T y) -+ static BigUint mulInt(T = ulong)(BigUint x, T y) pure - { - if (y==0 || x == 0) return BigUint(ZERO); - uint hi = cast(uint)(y >>> 32); -@@ -526,7 +541,7 @@ public: - - /* return x * y. - */ -- static BigUint mul(BigUint x, BigUint y) -+ static BigUint mul(BigUint x, BigUint y) pure - { - if (y==0 || x == 0) - return BigUint(ZERO); -@@ -547,7 +562,7 @@ public: - } - - // return x / y -- static BigUint divInt(T)(BigUint x, T y) if ( is(T == uint) ) -+ static BigUint divInt(T)(BigUint x, T y) pure if ( is(T == uint) ) - { - if (y == 1) - return x; -@@ -572,7 +587,7 @@ public: - } - - // return x % y -- static uint modInt(T)(BigUint x, T y) if ( is(T == uint) ) -+ static uint modInt(T)(BigUint x, T y) pure if ( is(T == uint) ) - { - assert(y!=0); - if ((y&(-y)) == y) -@@ -591,7 +606,7 @@ public: - } - - // return x / y -- static BigUint div(BigUint x, BigUint y) -+ static BigUint div(BigUint x, BigUint y) pure - { - if (y.data.length > x.data.length) - return BigUint(ZERO); -@@ -603,7 +618,7 @@ public: - } - - // return x % y -- static BigUint mod(BigUint x, BigUint y) -+ static BigUint mod(BigUint x, BigUint y) pure - { - if (y.data.length > x.data.length) return x; - if (y.data.length == 1) -@@ -624,7 +639,7 @@ public: - * exponentiation is used. - * Memory allocation is minimized: at most one temporary BigUint is used. - */ -- static BigUint pow(BigUint x, ulong y) -+ static BigUint pow(BigUint x, ulong y) pure - { - // Deal with the degenerate cases first. - if (y==0) return BigUint(ONE); -@@ -833,11 +848,24 @@ public: - return result; - } - -+ // Implement toHash so that BigUint works properly as an AA key. -+ size_t toHash() const @trusted nothrow -+ { -+ return typeid(data).getHash(&data); -+ } -+ - } // end BigUint - -+unittest -+{ -+ // ulong comparison test -+ BigUint a = [1]; -+ assert(a == 1); -+ assert(a < 0x8000_0000_0000_0000UL); // bug 9548 -+} - - // Remove leading zeros from x, to restore the BigUint invariant --BigDigit[] removeLeadingZeros(BigDigit [] x) -+BigDigit[] removeLeadingZeros(BigDigit [] x) pure - { - size_t k = x.length; - while(k>1 && x[k - 1]==0) --k; -@@ -853,6 +881,18 @@ unittest - } - - -+unittest -+{ -+ BigUint r; -+ r = 5UL; -+ assert(r.peekUlong(0) == 5UL); -+ assert(r.peekUint(0) == 5U); -+ r = 0x1234_5678_9ABC_DEF0UL; -+ assert(r.peekUlong(0) == 0x1234_5678_9ABC_DEF0UL); -+ assert(r.peekUint(0) == 0x9ABC_DEF0U); -+} -+ -+ - // Pow tests - unittest - { -@@ -903,7 +943,7 @@ unittest - private: - - // works for any type --T intpow(T)(T x, ulong n) -+T intpow(T)(T x, ulong n) pure - { - T p; - -@@ -938,7 +978,7 @@ T intpow(T)(T x, ulong n) - - - // returns the maximum power of x that will fit in a uint. --int highestPowerBelowUintMax(uint x) -+int highestPowerBelowUintMax(uint x) pure - { - assert(x>1); - static immutable ubyte [22] maxpwr = [ 31, 20, 15, 13, 12, 11, 10, 10, 9, 9, -@@ -953,7 +993,7 @@ int highestPowerBelowUintMax(uint x) - } - - // returns the maximum power of x that will fit in a ulong. --int highestPowerBelowUlongMax(uint x) -+int highestPowerBelowUlongMax(uint x) pure - { - assert(x>1); - static immutable ubyte [39] maxpwr = [ 63, 40, 31, 27, 24, 22, 21, 20, 19, 18, -@@ -975,7 +1015,7 @@ int highestPowerBelowUlongMax(uint x) - - version(unittest) { - --int slowHighestPowerBelowUintMax(uint x) -+int slowHighestPowerBelowUintMax(uint x) pure - { - int pwr = 1; - for (ulong q = x;x*q < cast(ulong)uint.max; ) { -@@ -996,7 +1036,7 @@ unittest - /* General unsigned subtraction routine for bigints. - * Sets result = x - y. If the result is negative, negative will be true. - */ --BigDigit [] sub(BigDigit[] x, BigDigit[] y, bool *negative) -+BigDigit [] sub(BigDigit[] x, BigDigit[] y, bool *negative) pure - { - if (x.length == y.length) - { -@@ -1051,7 +1091,7 @@ BigDigit [] sub(BigDigit[] x, BigDigit[] - - - // return a + b --BigDigit [] add(BigDigit[] a, BigDigit [] b) -+BigDigit [] add(BigDigit[] a, BigDigit [] b) pure - { - BigDigit [] x, y; - if (a.length < b.length) -@@ -1083,7 +1123,7 @@ BigDigit [] add(BigDigit[] a, BigDigit [ - - /** return x + y - */ --BigDigit [] addInt(const BigDigit[] x, ulong y) -+BigDigit [] addInt(const BigDigit[] x, ulong y) pure - { - uint hi = cast(uint)(y >>> 32); - uint lo = cast(uint)(y& 0xFFFF_FFFF); -@@ -1106,7 +1146,7 @@ BigDigit [] addInt(const BigDigit[] x, u - /** Return x - y. - * x must be greater than y. - */ --BigDigit [] subInt(const BigDigit[] x, ulong y) -+BigDigit [] subInt(const BigDigit[] x, ulong y) pure - { - uint hi = cast(uint)(y >>> 32); - uint lo = cast(uint)(y & 0xFFFF_FFFF); -@@ -1131,6 +1171,7 @@ BigDigit [] subInt(const BigDigit[] x, u - * - */ - void mulInternal(BigDigit[] result, const(BigDigit)[] x, const(BigDigit)[] y) -+ pure - { - assert( result.length == x.length + y.length ); - assert( y.length > 0 ); -@@ -1260,7 +1301,7 @@ void mulInternal(BigDigit[] result, cons - * NOTE: If the highest half-digit of x is zero, the highest digit of result will - * also be zero. - */ --void squareInternal(BigDigit[] result, BigDigit[] x) -+void squareInternal(BigDigit[] result, BigDigit[] x) pure - { - // Squaring is potentially half a multiply, plus add the squares of - // the diagonal elements. -@@ -1283,7 +1324,8 @@ void squareInternal(BigDigit[] result, B - import core.bitop : bsr; - - /// if remainder is null, only calculate quotient. --void divModInternal(BigDigit [] quotient, BigDigit[] remainder, BigDigit [] u, BigDigit [] v) -+void divModInternal(BigDigit [] quotient, BigDigit[] remainder, BigDigit [] u, -+ BigDigit [] v) pure - { - assert(quotient.length == u.length - v.length + 1); - assert(remainder == null || remainder.length == v.length); -@@ -1351,6 +1393,7 @@ private: - // buff.length must be data.length*8 if separator is zero, - // or data.length*9 if separator is non-zero. It will be completely filled. - char [] biguintToHex(char [] buff, const BigDigit [] data, char separator=0) -+ pure - { - int x=0; - for (ptrdiff_t i=data.length - 1; i>=0; --i) -@@ -1378,7 +1421,7 @@ char [] biguintToHex(char [] buff, const - * Returns: - * the lowest index of buff which was used. - */ --size_t biguintToDecimal(char [] buff, BigDigit [] data) -+size_t biguintToDecimal(char [] buff, BigDigit [] data) pure - { - ptrdiff_t sofar = buff.length; - // Might be better to divide by (10^38/2^32) since that gives 38 digits for -@@ -1415,7 +1458,7 @@ size_t biguintToDecimal(char [] buff, Bi - * Returns: - * the highest index of data which was used. - */ --int biguintFromDecimal(BigDigit [] data, const(char)[] s) -+int biguintFromDecimal(BigDigit [] data, const(char)[] s) pure - in - { - assert((data.length >= 2) || (data.length == 1 && s.length == 1)); -@@ -1465,9 +1508,9 @@ body - // Multiply existing number by 10^19, then add y1. - if (hi>0) - { -- data[hi] = multibyteMul(data[0..hi], data[0..hi], 1220703125*2, 0); // 5^13*2 = 0x9184_E72A -+ data[hi] = multibyteMul(data[0..hi], data[0..hi], 1220703125*2u, 0); // 5^13*2 = 0x9184_E72A - ++hi; -- data[hi] = multibyteMul(data[0..hi], data[0..hi], 15625*262144, 0); // 5^6*2^18 = 0xF424_0000 -+ data[hi] = multibyteMul(data[0..hi], data[0..hi], 15625*262144u, 0); // 5^6*2^18 = 0xF424_0000 - ++hi; - } - else -@@ -1501,14 +1544,14 @@ body - { - if (hi == 0) - { -+ data[0] = cast(uint)y; - if (data.length == 1) - { -- data[0] = cast(uint)(y & 0xFFFF_FFFF); - hi = 1; - } - else - { -- *cast(ulong *)(&data[hi]) = y; -+ data[1] = cast(uint)(y >>> 32); - hi=2; - } - } -@@ -1548,7 +1591,8 @@ private: - // with COW. - - // Classic 'schoolbook' multiplication. --void mulSimple(BigDigit[] result, const(BigDigit) [] left, const(BigDigit)[] right) -+void mulSimple(BigDigit[] result, const(BigDigit) [] left, -+ const(BigDigit)[] right) pure - in - { - assert(result.length == left.length + right.length); -@@ -1561,7 +1605,7 @@ body - } - - // Classic 'schoolbook' squaring --void squareSimple(BigDigit[] result, const(BigDigit) [] x) -+void squareSimple(BigDigit[] result, const(BigDigit) [] x) pure - in - { - assert(result.length == 2*x.length); -@@ -1576,7 +1620,7 @@ body - // add two uints of possibly different lengths. Result must be as long - // as the larger length. - // Returns carry (0 or 1). --uint addSimple(BigDigit [] result, BigDigit [] left, BigDigit [] right) -+uint addSimple(BigDigit [] result, BigDigit [] left, BigDigit [] right) pure - in - { - assert(result.length == left.length); -@@ -1597,7 +1641,8 @@ body - - // result = left - right - // returns carry (0 or 1) --BigDigit subSimple(BigDigit [] result,const(BigDigit) [] left, const(BigDigit) [] right) -+BigDigit subSimple(BigDigit [] result,const(BigDigit) [] left, -+ const(BigDigit) [] right) pure - in - { - assert(result.length == left.length); -@@ -1620,7 +1665,7 @@ body - /* result = result - right - * Returns carry = 1 if result was less than right. - */ --BigDigit subAssignSimple(BigDigit [] result, const(BigDigit) [] right) -+BigDigit subAssignSimple(BigDigit [] result, const(BigDigit) [] right) pure - { - assert(result.length >= right.length); - uint c = multibyteSub(result[0..right.length], result[0..right.length], right, 0); -@@ -1631,7 +1676,7 @@ BigDigit subAssignSimple(BigDigit [] res - - /* result = result + right - */ --BigDigit addAssignSimple(BigDigit [] result, const(BigDigit) [] right) -+BigDigit addAssignSimple(BigDigit [] result, const(BigDigit) [] right) pure - { - assert(result.length >= right.length); - uint c = multibyteAdd(result[0..right.length], result[0..right.length], right, 0); -@@ -1642,7 +1687,8 @@ BigDigit addAssignSimple(BigDigit [] res - - /* performs result += wantSub? - right : right; - */ --BigDigit addOrSubAssignSimple(BigDigit [] result, const(BigDigit) [] right, bool wantSub) -+BigDigit addOrSubAssignSimple(BigDigit [] result, const(BigDigit) [] right, -+ bool wantSub) pure - { - if (wantSub) - return subAssignSimple(result, right); -@@ -1652,7 +1698,7 @@ BigDigit addOrSubAssignSimple(BigDigit [ - - - // return true if x<y, considering leading zeros --bool less(const(BigDigit)[] x, const(BigDigit)[] y) -+bool less(const(BigDigit)[] x, const(BigDigit)[] y) pure - { - assert(x.length >= y.length); - auto k = x.length-1; -@@ -1667,6 +1713,7 @@ bool less(const(BigDigit)[] x, const(Big - - // Set result = abs(x-y), return true if result is negative(x<y), false if x<=y. - bool inplaceSub(BigDigit[] result, const(BigDigit)[] x, const(BigDigit)[] y) -+ pure - { - assert(result.length == (x.length >= y.length) ? x.length : y.length); - -@@ -1706,7 +1753,7 @@ bool inplaceSub(BigDigit[] result, const - /* Determine how much space is required for the temporaries - * when performing a Karatsuba multiplication. - */ --size_t karatsubaRequiredBuffSize(size_t xlen) -+size_t karatsubaRequiredBuffSize(size_t xlen) pure - { - return xlen <= KARATSUBALIMIT ? 0 : 2*xlen; // - KARATSUBALIMIT+2; - } -@@ -1722,7 +1769,8 @@ size_t karatsubaRequiredBuffSize(size_t - * Params: - * scratchbuff An array long enough to store all the temporaries. Will be destroyed. - */ --void mulKaratsuba(BigDigit [] result, const(BigDigit) [] x, const(BigDigit)[] y, BigDigit [] scratchbuff) -+void mulKaratsuba(BigDigit [] result, const(BigDigit) [] x, -+ const(BigDigit)[] y, BigDigit [] scratchbuff) pure - { - assert(x.length >= y.length); - assert(result.length < uint.max, "Operands too large"); -@@ -1826,7 +1874,8 @@ void mulKaratsuba(BigDigit [] result, co - addOrSubAssignSimple(result[half..$], mid, !midNegative); - } - --void squareKaratsuba(BigDigit [] result, BigDigit [] x, BigDigit [] scratchbuff) -+void squareKaratsuba(BigDigit [] result, BigDigit [] x, -+ BigDigit [] scratchbuff) pure - { - // See mulKaratsuba for implementation comments. - // Squaring is simpler, since it never gets asymmetric. -@@ -1883,6 +1932,7 @@ void squareKaratsuba(BigDigit [] result, - * u[0..v.length] holds the remainder. - */ - void schoolbookDivMod(BigDigit [] quotient, BigDigit [] u, in BigDigit [] v) -+ pure - { - assert(quotient.length == u.length - v.length); - assert(v.length > 1); -@@ -1964,7 +2014,7 @@ again: - private: - - // TODO: Replace with a library call --void itoaZeroPadded(char[] output, uint value, int radix = 10) -+void itoaZeroPadded(char[] output, uint value, int radix = 10) pure - { - ptrdiff_t x = output.length - 1; - for( ; x >= 0; --x) -@@ -1974,7 +2024,7 @@ void itoaZeroPadded(char[] output, uint - } - } - --void toHexZeroPadded(char[] output, uint value) -+void toHexZeroPadded(char[] output, uint value) pure - { - ptrdiff_t x = output.length - 1; - static immutable string hexDigits = "0123456789ABCDEF"; -@@ -1989,7 +2039,7 @@ private: - - // Returns the highest value of i for which left[i]!=right[i], - // or 0 if left[] == right[] --size_t highestDifferentDigit(BigDigit [] left, BigDigit [] right) -+size_t highestDifferentDigit(const BigDigit [] left, const BigDigit [] right) pure - { - assert(left.length == right.length); - for (ptrdiff_t i = left.length - 1; i>0; --i) -@@ -2001,7 +2051,7 @@ size_t highestDifferentDigit(BigDigit [] - } - - // Returns the lowest value of i for which x[i]!=0. --int firstNonZeroDigit(BigDigit[] x) -+int firstNonZeroDigit(BigDigit[] x) pure - { - int k = 0; - while (x[k]==0) -@@ -2037,7 +2087,7 @@ Returns: - Max-Planck Institute fuer Informatik, (Oct 1998). - */ - void recursiveDivMod(BigDigit[] quotient, BigDigit[] u, const(BigDigit)[] v, -- BigDigit[] scratch, bool mayOverflow = false) -+ BigDigit[] scratch, bool mayOverflow = false) pure - in - { - // v must be normalized -@@ -2127,7 +2177,7 @@ body - // Needs (quot.length * k) scratch space to store the result of the multiply. - void adjustRemainder(BigDigit[] quot, BigDigit[] rem, const(BigDigit)[] v, - ptrdiff_t k, -- BigDigit[] scratch, bool mayOverflow = false) -+ BigDigit[] scratch, bool mayOverflow = false) pure - { - assert(rem.length == v.length); - mulInternal(scratch, quot, v[0 .. k]); -@@ -2144,7 +2194,7 @@ void adjustRemainder(BigDigit[] quot, Bi - } - - // Cope with unbalanced division by performing block schoolbook division. --void blockDivMod(BigDigit [] quotient, BigDigit [] u, in BigDigit [] v) -+void blockDivMod(BigDigit [] quotient, BigDigit [] u, in BigDigit [] v) pure - { - assert(quotient.length == u.length - v.length); - assert(v.length > 1); ---- a/src/libphobos/src/std/internal/math/biguintnoasm.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/internal/math/biguintnoasm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -32,7 +32,7 @@ enum : int { KARATSUBASQUARELIMIT=12 }; - * Set op == '+' for addition, '-' for subtraction. - */ - uint multibyteAddSub(char op)(uint[] dest, const(uint) [] src1, -- const (uint) [] src2, uint carry) -+ const (uint) [] src2, uint carry) pure - { - ulong c = carry; - for (size_t i = 0; i < src2.length; ++i) -@@ -96,7 +96,7 @@ unittest - * op must be '+' or '-' - * Returns final carry or borrow (0 or 1) - */ --uint multibyteIncrementAssign(char op)(uint[] dest, uint carry) -+uint multibyteIncrementAssign(char op)(uint[] dest, uint carry) pure - { - static if (op=='+') - { -@@ -134,7 +134,7 @@ uint multibyteIncrementAssign(char op)(u - /** dest[] = src[] << numbits - * numbits must be in the range 1..31 - */ --uint multibyteShl(uint [] dest, const(uint) [] src, uint numbits) -+uint multibyteShl(uint [] dest, const(uint) [] src, uint numbits) pure - { - ulong c = 0; - for (size_t i = 0; i < dest.length; ++i) -@@ -150,7 +150,7 @@ uint multibyteShl(uint [] dest, const(ui - /** dest[] = src[] >> numbits - * numbits must be in the range 1..31 - */ --void multibyteShr(uint [] dest, const(uint) [] src, uint numbits) -+void multibyteShr(uint [] dest, const(uint) [] src, uint numbits) pure - { - ulong c = 0; - for(ptrdiff_t i = dest.length; i!=0; --i) -@@ -185,6 +185,7 @@ unittest - * Returns carry. - */ - uint multibyteMul(uint[] dest, const(uint)[] src, uint multiplier, uint carry) -+ pure - { - assert(dest.length == src.length); - ulong c = carry; -@@ -211,7 +212,7 @@ unittest - * Returns carry out of MSB (0..FFFF_FFFF). - */ - uint multibyteMulAdd(char op)(uint [] dest, const(uint)[] src, -- uint multiplier, uint carry) -+ uint multiplier, uint carry) pure - { - assert(dest.length == src.length); - ulong c = carry; -@@ -261,7 +262,8 @@ unittest - } - ---- - */ --void multibyteMultiplyAccumulate(uint [] dest, const(uint)[] left, const(uint) [] right) -+void multibyteMultiplyAccumulate(uint [] dest, const(uint)[] left, const(uint) -+ [] right) pure - { - for (size_t i = 0; i < right.length; ++i) - { -@@ -273,7 +275,7 @@ void multibyteMultiplyAccumulate(uint [] - /** dest[] /= divisor. - * overflow is the initial remainder, and must be in the range 0..divisor-1. - */ --uint multibyteDivAssign(uint [] dest, uint divisor, uint overflow) -+uint multibyteDivAssign(uint [] dest, uint divisor, uint overflow) pure - { - ulong c = cast(ulong)overflow; - for(ptrdiff_t i = dest.length-1; i>= 0; --i) -@@ -301,7 +303,7 @@ unittest - - } - // Set dest[2*i..2*i+1]+=src[i]*src[i] --void multibyteAddDiagonalSquares(uint[] dest, const(uint)[] src) -+void multibyteAddDiagonalSquares(uint[] dest, const(uint)[] src) pure - { - ulong c = 0; - for(size_t i = 0; i < src.length; ++i) -@@ -316,7 +318,7 @@ void multibyteAddDiagonalSquares(uint[] - } - - // Does half a square multiply. (square = diagonal + 2*triangle) --void multibyteTriangleAccumulate(uint[] dest, const(uint)[] x) -+void multibyteTriangleAccumulate(uint[] dest, const(uint)[] x) pure - { - // x[0]*x[1...$] + x[1]*x[2..$] + ... + x[$-2]x[$-1..$] - dest[x.length] = multibyteMul(dest[1 .. x.length], x[1..$], x[0], 0); -@@ -349,7 +351,7 @@ void multibyteTriangleAccumulate(uint[] - dest[2*x.length-2] = cast(uint)c; - } - --void multibyteSquare(BigDigit[] result, const(BigDigit) [] x) -+void multibyteSquare(BigDigit[] result, const(BigDigit) [] x) pure - { - multibyteTriangleAccumulate(result, x); - result[$-1] = multibyteShl(result[1..$-1], result[1..$-1], 1); // mul by 2 ---- a/src/libphobos/src/std/internal/math/biguintx86.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/internal/math/biguintx86.d 2014-04-01 16:32:51.000000000 +0100 -@@ -103,7 +103,8 @@ enum : int { KARATSUBASQUARELIMIT=26 }; - * Returns carry or borrow (0 or 1). - * Set op == '+' for addition, '-' for subtraction. - */ --uint multibyteAddSub(char op)(uint[] dest, const uint [] src1, const uint [] src2, uint carry) -+uint multibyteAddSub(char op)(uint[] dest, const uint [] src1, const uint [] -+ src2, uint carry) pure - { - // Timing: - // Pentium M: 2.25/int -@@ -215,7 +216,7 @@ unittest - * op must be '+' or '-' - * Returns final carry or borrow (0 or 1) - */ --uint multibyteIncrementAssign(char op)(uint[] dest, uint carry) -+uint multibyteIncrementAssign(char op)(uint[] dest, uint carry) pure - { - enum { LASTPARAM = 1*4 } // 0* pushes + return address. - asm { -@@ -245,7 +246,7 @@ L2: dec EAX; - * numbits must be in the range 1..31 - * Returns the overflow - */ --uint multibyteShlNoMMX(uint [] dest, const uint [] src, uint numbits) -+uint multibyteShlNoMMX(uint [] dest, const uint [] src, uint numbits) pure - { - // Timing: Optimal for P6 family. - // 2.0 cycles/int on PPro..PM (limited by execution port p0) -@@ -296,7 +297,7 @@ L_last: - * numbits must be in the range 1..31 - * This version uses MMX. - */ --uint multibyteShl(uint [] dest, const uint [] src, uint numbits) -+uint multibyteShl(uint [] dest, const uint [] src, uint numbits) pure - { - // Timing: - // K7 1.2/int. PM 1.7/int P4 5.3/int -@@ -380,7 +381,7 @@ L_length1: - } - } - --void multibyteShr(uint [] dest, const uint [] src, uint numbits) -+void multibyteShr(uint [] dest, const uint [] src, uint numbits) pure - { - enum { LASTPARAM = 4*4 } // 3* pushes + return address. - asm { -@@ -467,7 +468,7 @@ L_length1: - /** dest[#] = src[#] >> numbits - * numbits must be in the range 1..31 - */ --void multibyteShrNoMMX(uint [] dest, const uint [] src, uint numbits) -+void multibyteShrNoMMX(uint [] dest, const uint [] src, uint numbits) pure - { - // Timing: Optimal for P6 family. - // 2.0 cycles/int on PPro..PM (limited by execution port p0) -@@ -556,6 +557,7 @@ unittest - * Returns carry. - */ - uint multibyteMul(uint[] dest, const uint[] src, uint multiplier, uint carry) -+ pure - { - // Timing: definitely not optimal. - // Pentium M: 5.0 cycles/operation, has 3 resource stalls/iteration -@@ -626,7 +628,7 @@ unittest - // Multiples by M_ADDRESS which should be "ESP+LASTPARAM" or "ESP". OP must be "add" or "sub" - // This is the most time-critical code in the BigInt library. - // It is used by both MulAdd, multiplyAccumulate, and triangleAccumulate --string asmMulAdd_innerloop(string OP, string M_ADDRESS) { -+string asmMulAdd_innerloop(string OP, string M_ADDRESS) pure { - // The bottlenecks in this code are extremely complicated. The MUL, ADD, and ADC - // need 4 cycles on each of the ALUs units p0 and p1. So we use memory load - // (unit p2) for initializing registers to zero. -@@ -697,7 +699,7 @@ L_done: " ~ OP ~ " [-8+EDI+4*EBX], ECX; - // final carry is now in EBP - } - --string asmMulAdd_enter_odd(string OP, string M_ADDRESS) { -+string asmMulAdd_enter_odd(string OP, string M_ADDRESS) pure { - return "asm { - mul int ptr [" ~M_ADDRESS ~"]; - mov EBP, zero; -@@ -718,8 +720,8 @@ return "asm { - * where op == '+' or '-' - * Returns carry out of MSB (0..FFFF_FFFF). - */ --uint multibyteMulAdd(char op)(uint [] dest, const uint [] src, uint multiplier, uint carry) --{ -+uint multibyteMulAdd(char op)(uint [] dest, const uint [] src, uint -+ multiplier, uint carry) pure { - // Timing: This is the most time-critical bignum function. - // Pentium M: 5.4 cycles/operation, still has 2 resource stalls + 1load block/iteration - -@@ -804,8 +806,8 @@ unittest - } - ---- - */ --void multibyteMultiplyAccumulate(uint [] dest, const uint[] left, const uint [] right) --{ -+void multibyteMultiplyAccumulate(uint [] dest, const uint[] left, -+ const uint [] right) pure { - // Register usage - // EDX:EAX = used in multiply - // EBX = index -@@ -890,7 +892,7 @@ L_enter_odd: - * Based on public domain code by Eric Bainville. - * (http://www.bealto.com/) Used with permission. - */ --uint multibyteDivAssign(uint [] dest, uint divisor, uint overflow) -+uint multibyteDivAssign(uint [] dest, uint divisor, uint overflow) pure - { - // Timing: limited by a horrible dependency chain. - // Pentium M: 18 cycles/op, 8 resource stalls/op. -@@ -1008,7 +1010,7 @@ unittest - } - - // Set dest[2*i..2*i+1]+=src[i]*src[i] --void multibyteAddDiagonalSquares(uint [] dest, const uint [] src) -+void multibyteAddDiagonalSquares(uint [] dest, const uint [] src) pure - { - /* Unlike mulAdd, the carry is only 1 bit, - since FFFF*FFFF+FFFF_FFFF = 1_0000_0000. -@@ -1062,7 +1064,7 @@ unittest - for (int i=0; i<bb.length; ++i) { assert(aa[2*i]==0x8000_0000+i*i); assert(aa[2*i+1]==0x8000_0000); } - } - --void multibyteTriangleAccumulateD(uint[] dest, uint[] x) -+void multibyteTriangleAccumulateD(uint[] dest, uint[] x) pure - { - for (int i = 0; i < x.length-3; ++i) { - dest[i+x.length] = multibyteMulAdd!('+')( -@@ -1084,7 +1086,7 @@ length2: - //dest += src[0]*src[1...$] + src[1]*src[2..$] + ... + src[$-3]*src[$-2..$]+ src[$-2]*src[$-1] - // assert(dest.length = src.length*2); - // assert(src.length >= 3); --void multibyteTriangleAccumulateAsm(uint[] dest, const uint[] src) -+void multibyteTriangleAccumulateAsm(uint[] dest, const uint[] src) pure - { - // Register usage - // EDX:EAX = used in multiply -@@ -1234,7 +1236,7 @@ unittest - } - - --void multibyteSquare(BigDigit[] result, const BigDigit [] x) -+void multibyteSquare(BigDigit[] result, const BigDigit [] x) pure - { - if (x.length < 4) { - // Special cases, not worth doing triangular. -@@ -1261,7 +1263,7 @@ __gshared uint [2200] X1; - __gshared uint [2200] Y1; - __gshared uint [4000] Z1; - --void testPerformance() -+void testPerformance() pure - { - // The performance results at the top of this file were obtained using - // a Windows device driver to access the CPU performance counters. ---- a/src/libphobos/src/std/internal/math/errorfunction.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/internal/math/errorfunction.d 2014-04-01 16:32:51.000000000 +0100 -@@ -215,15 +215,15 @@ unittest { - - assert(feqrel(erfc(0.250L), erfc0_250 )>=real.mant_dig-1); - assert(feqrel(erfc(0.375L), erfc0_375 )>=real.mant_dig-0); -- assert(feqrel(erfc(0.500L), erfc0_500 )>=real.mant_dig-1); -+ assert(feqrel(erfc(0.500L), erfc0_500 )>=real.mant_dig-2); - assert(feqrel(erfc(0.625L), erfc0_625 )>=real.mant_dig-1); - assert(feqrel(erfc(0.750L), erfc0_750 )>=real.mant_dig-1); - assert(feqrel(erfc(0.875L), erfc0_875 )>=real.mant_dig-4); -- assert(feqrel(erfc(1.000L), erfc1_000 )>=real.mant_dig-0); -+ assert(feqrel(erfc(1.000L), erfc1_000 )>=real.mant_dig-2); - assert(feqrel(erfc(1.125L), erfc1_125 )>=real.mant_dig-2); - assert(feqrel(erf(0.875L), erf0_875 )>=real.mant_dig-1); - // The DMC implementation of erfc() fails this next test (just) -- assert(feqrel(erfc(4.1L),0.67000276540848983727e-8L)>=real.mant_dig-4); -+ assert(feqrel(erfc(4.1L),0.67000276540848983727e-8L)>=real.mant_dig-5); - - assert(isIdentical(erf(0.0),0.0)); - assert(isIdentical(erf(-0.0),-0.0)); ---- a/src/libphobos/src/std/internal/math/gammafunction.d 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/libphobos/src/std/internal/math/gammafunction.d 2014-04-01 16:32:51.000000000 +0100 -@@ -345,7 +345,7 @@ unittest { - for (int i=1; fact<real.max; ++i) { - // Require exact equality for small factorials - if (i<14) assert(gamma(i*1.0L) == fact); -- assert(feqrel(gamma(i*1.0L), fact) > real.mant_dig-16); -+ assert(feqrel(gamma(i*1.0L), fact) >= real.mant_dig-15); - fact *= (i*1.0L); - } - assert(gamma(0.0) == real.infinity); -@@ -364,7 +364,7 @@ unittest { - real SQRT_PI = 1.77245385090551602729816748334114518279754945612238L; - - -- assert(feqrel(gamma(0.5L), SQRT_PI) >= real.mant_dig - 1); -+ assert(feqrel(gamma(0.5L), SQRT_PI) >= real.mant_dig-1); - assert(feqrel(gamma(17.25L), 4.224986665692703551570937158682064589938e13L) >= real.mant_dig-4); - - assert(feqrel(gamma(1.0 / 3.0L), 2.67893853470774763365569294097467764412868937795730L) >= real.mant_dig-2); -@@ -894,12 +894,12 @@ unittest { // also tested by the normal - // These arbitrary points are chosen to give good code coverage. - assert(feqrel(betaIncomplete(8, 10, 0.2), 0.010_934_315_234_099_2L) >= real.mant_dig - 5); - assert(feqrel(betaIncomplete(2, 2.5, 0.9),0.989_722_597_604_452_767_171_003_59L) >= real.mant_dig - 1 ); -- assert(feqrel(betaIncomplete(1000, 800, 0.5), 1.179140859734704555102808541457164E-06L) >= real.mant_dig - 12 ); -+ assert(feqrel(betaIncomplete(1000, 800, 0.5), 1.179140859734704555102808541457164E-06L) >= real.mant_dig - 13 ); - assert(feqrel(betaIncomplete(0.0001, 10000, 0.0001),0.999978059362107134278786L) >= real.mant_dig - 18 ); - assert(betaIncomplete(0.01, 327726.7, 0.545113) == 1.0); - assert(feqrel(betaIncompleteInv(8, 10, 0.010_934_315_234_099_2L), 0.2L) >= real.mant_dig - 2); - assert(feqrel(betaIncomplete(0.01, 498.437, 0.0121433),0.99999664562033077636065L) >= real.mant_dig - 1); -- assert(feqrel(betaIncompleteInv(5, 10, 0.2000002972865658842), 0.229121208190918L) >= real.mant_dig - 4); -+ assert(feqrel(betaIncompleteInv(5, 10, 0.2000002972865658842), 0.229121208190918L) >= real.mant_dig - 3); - assert(feqrel(betaIncompleteInv(4, 7, 0.8000002209179505L), 0.483657360076904L) >= real.mant_dig - 3); - - // Coverage tests. I don't have correct values for these tests, but ---- a/src/libphobos/src/std/internal/unicode_comp.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/internal/unicode_comp.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+module std.internal.unicode_comp; -+import std.internal.unicode_tables; -+ -+static if(size_t.sizeof == 8) { -+//6976 bytes -+enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 7, 6)([ 0x0, 0x20, 0x120], [ 0x100, 0x400, 0x1240], [ 0x402030202020100, 0x206020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x20001, 0x300000000, 0x5000400000000, 0x8000000070006, 0xb0000000a0009, 0xe0000000d000c, 0x11000f0010000f, 0x11000f0011000f, 0x1100000011000f, 0x11000f00120000, 0x13000000110000, 0x17001600150014, 0x1b001a00190018, 0x1d0000001c, 0x0, 0x0, 0x1e0000, 0x0, 0x0, 0x0, 0x2000000000001f, 0x2100000000, 0x22, 0x240023, 0x28002700260025, 0x2a000000000029, 0x2b000000000000, 0x0, 0x0, 0x2c000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2d000000000000, 0x2f0000002e0000, 0x0, 0x0, 0x3100000030, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x34003300320000, 0x0, 0x36000000000035, 0x3a003900380037, 0x3c003b00000000, 0x3d000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x0, 0x3f, 0x0, 0x0, 0x40000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4200350000, 0x3a000000000043, 0x0, 0x0, 0x0, 0x0, 0x4400000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4600450000, 0x470000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6e6, 0xdcdce8e6e6e6e6e6, 0xdcdcdcdcd8e8dcdc, 0xcadcdcdcdccacadc, 0xdcdcdcdcdcdcdcca, 0x1010101dcdcdcdc, 0xe6e6e6dcdcdcdc01, 0xdce6f0e6e6e6e6e6, 0xdcdce6e6e6dcdc, 0xe6dcdcdcdce6e6e6, 0xe9eaeae9e6dcdce8, 0xe6e6e6e6e6e9eaea, 0xe6e6e6e6e6e6e6e6, 0x0, 0x0, 0xe6e6e6e6e6000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6dce6e6e6e6dc00, 0xe6e6e6e6dcdee6e6, 0xdcdcdcdcdcdce6e6, 0xe6e4dee6e6dce6e6, 0x11100f0e0d0c0b0a, 0x1700161514131312, 0x1200dce600191800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6e6e6e6e6, 0x201f1e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f1e1d1c1b000000, 0xe6dcdce6e6222120, 0xdce6e6dce6e6e6e6, 0x0, 0x0, 0x23, 0x0, 0x0, 0x0, 0xe6e6000000000000, 0xe60000e6e6e6e6e6, 0xe60000e6dce6e6e6, 0xdce6e6dc00e6, 0x0, 0x0, 0x0, 0x0, 0x2400, 0x0, 0x0, 0x0, 0xdce6e6dce6e6dce6, 0xe6dce6dcdce6dcdc, 0xe6dce6dce6dce6e6, 0xe6e6dc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6e6000000, 0xe6dce6e6, 0x0, 0x0, 0x0, 0xe6e6000000000000, 0xe6e6e6e6e600e6e6, 0xe6e6e600e6e6e6e6, 0xe6e6e6e6e600, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdcdcdc00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6dce6e600000000, 0xdcdcdce6e6e6dce6, 0xe6dce6e6e61d1c1b, 0xe6e6e6e6dcdce6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x700000000, 0x0, 0x90000000000, 0xe6e6dce600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000000000, 0x5b540000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x96767, 0x0, 0x6b6b6b6b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7676, 0x0, 0x7a7a7a7a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdcdc, 0x0, 0x0, 0xdc00dc0000000000, 0xd800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8400828100, 0x828282820000, 0xe6e60009e6e60082, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x700000000000000, 0x90900, 0x0, 0xdc0000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e60000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900000000, 0x0, 0x0, 0x0, 0x900000000, 0x0, 0x0, 0x0, 0x90000, 0xe60000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdce6de00, 0x0, 0x0, 0xe600000000000000, 0xdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0xe6e6e60000000000, 0xdc0000e6e6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x700000000, 0x0, 0x900000000, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6dce6000000, 0xe6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9090000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7000000000000, 0x0, 0x9090000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x700000000000000, 0x0, 0x0, 0x0, 0xdcdcdc0100e6e6e6, 0xdcdcdcdce6e6dcdc, 0x1010101010100e6, 0xdc0000000001, 0xe600000000, 0x0, 0xe6e6e6e6e6dce6e6, 0xdcd6eae6e6dce6e6, 0xe6e6e6e6e6e6e6ca, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6, 0x0, 0x0, 0xdce6dce900000000, 0x0, 0x0, 0xe6e6e6e60101e6e6, 0xe6e6010101, 0xe60101000000e600, 0xdcdcdcdc0101e6dc, 0xe6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe600000000000000, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900000000000000, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe0e0dee8e4da0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe600000000000000, 0xe6e6e6e600000000, 0xe6e6e6e6e6e6, 0x0, 0x0, 0x0, 0xe600000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6, 0x0, 0x9000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900000000, 0x0, 0x0, 0x0, 0xe6e6e6e6e6e6e6e6, 0xe6e6e6e6e6e6e6e6, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdcdcdc000000, 0x0, 0x0, 0x0, 0x0, 0x9000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7000000, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe60000dce6e600e6, 0xe6e60000000000e6, 0xe600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc0000000000, 0x0, 0xe600dc0000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900000000dc01e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x70900, 0xe6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x909000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x709000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1d8d80000000000, 0xd8d8e20000000101, 0xd8d8d8, 0xdcdcdcdcdc000000, 0xe6e6e60000dcdcdc, 0xdcdce6e6, 0x0, 0x0, 0x0, 0xe6e6e6e60000, 0x0, 0x0, 0xe6e6e60000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+enum composeIdxMask = (1<<11)-1, composeCntShift = 11; -+enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)([ 0x0, 0x400], [ 0x1000, 0x2000], [ 0x3000200010000, 0x7000600050004, 0x7000700070008, 0xa000700090007, 0x70007000c000b, 0x7000700070007, 0x700070007000d, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x700070007000e, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff080208010800, 0x281618138003ffff, 0x383308328821301b, 0x285108507841383a, 0x8068485f185c3056, 0x3882407affff1078, 0x30a510a398903889, 0xffff30b648ad10ab, 0xffffffffffffffff, 0x28cf18cc80bcffff, 0x38ec08eb88da30d4, 0x290b110970fb40f3, 0x8122491919163110, 0x393c4134ffff1132, 0x3960115e994b4143, 0xffff317351691167, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff1979, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff217cffffffff, 0x984118209810980, 0xffff2185ffffffff, 0x989ffffffffffff, 0xffffffffffffffff, 0xffff0991198e218a, 0xffffffffffff0992, 0xffffffffffff2193, 0xffff2197ffffffff, 0x99f119d099c099b, 0xffff21a0ffffffff, 0x9a4ffffffffffff, 0xffffffffffffffff, 0xffff09ac19a921a5, 0xffffffffffff09ad, 0xffffffffffff21ae, 0x21b621b2ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x11bc11baffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff11c011be, 0xffffffffffffffff, 0xffffffffffffffff, 0x9c309c2ffffffff, 0xffffffffffffffff, 0xffffffff09c509c4, 0xffffffffffffffff, 0x9c909c809c709c6, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x9caffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff29d029cb, 0xffffffffffffffff, 0xffffffffffffffff, 0x29d5ffffffffffff, 0xffffffffffff29da, 0x9dfffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x9e109e0ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x9e309e2ffffffff, 0xffffffff09e509e4, 0x9e709e6ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff09e8ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff39e9ffff, 0x29f4ffff21f0ffff, 0xffffffff39f9ffff, 0x2200ffffffffffff, 0xffffffff0a04ffff, 0xffffffff3205ffff, 0xffffffff2a0bffff, 0xffff0a11ffff0a10, 0xffffffff4212ffff, 0x321effff221affff, 0xffffffff4224ffff, 0x222cffffffffffff, 0xffffffff1230ffff, 0xffffffff4232ffff, 0x1a431a40323affff, 0xffff0a46ffffffff, 0xffff1247ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0a49ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa4cffffffff124a, 0xa5212501a4dffff, 0xffff0a57ffff2253, 0xffff0a58ffffffff, 0x2259ffffffffffff, 0xa5dffffffffffff, 0xa5effffffffffff, 0xffffffff0a5fffff, 0xa62ffffffff1260, 0xa6812661a63ffff, 0xffff0a6dffff2269, 0xffff0a6effffffff, 0x226fffffffffffff, 0xa73ffffffffffff, 0xa74ffffffffffff, 0xffffffff0a75ffff, 0xffffffffffffffff, 0xffff0a76ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0a780a77, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0a7a0a79, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0a7c0a7b, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1a7dffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0a81ffff0a80, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0a82ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0a83ffffffff, 0xffffffff0a84ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff0a85, 0xffffffffffffffff, 0xa87ffffffff0a86, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1288ffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1a8affffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0a8dffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa90128effffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0a91ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa92ffffffffffff, 0xffffffffffffffff, 0xffff1a93ffffffff, 0xffff0a96ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa991297ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff1a9affff, 0xffffffffffff0a9d, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0a9effff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xaa0ffff0a9fffff, 0xaa2ffff0aa1ffff, 0xffffffff0aa3ffff, 0xffffffff0aa4ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0aa5ffffffff, 0xaa80aa7ffff0aa6, 0xffff0aa9ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xaab0aaaffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xaad0aacffffffff, 0xffffffffffffffff, 0xaaf0aaeffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff12b212b0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0ab50ab4, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0ab70ab6, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xac10ac022bc22b8, 0xac50ac40ac30ac2, 0xacf0ace22ca22c6, 0xad30ad20ad10ad0, 0xffffffff12d612d4, 0xffffffffffffffff, 0xffffffff12da12d8, 0xffffffffffffffff, 0xae50ae422e022dc, 0xae90ae80ae70ae6, 0xaf30af222ee22ea, 0xaf70af60af50af4, 0xffffffff1afb1af8, 0xffffffffffffffff, 0xffffffff1b011afe, 0xffffffffffffffff, 0xffffffff13061304, 0xffffffffffffffff, 0xffffffff130a1308, 0xffffffffffffffff, 0xffffffff1b0f1b0c, 0xffffffffffffffff, 0xffffffff1b12ffff, 0xffffffffffffffff, 0xb1e0b1d23192315, 0xb220b210b200b1f, 0xb2c0b2b23272323, 0xb300b2f0b2e0b2d, 0xffffffffffff0b31, 0xffffffffffff0b32, 0xffffffffffffffff, 0xffffffffffff0b33, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b34ffffffff, 0xffffffffffffffff, 0x1b35ffffffffffff, 0xffffffffffffffff, 0xffff0b38ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b39ffffffff, 0xffffffffffffffff, 0xffff1b3affffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b3effff0b3d, 0xffffffffffff0b3f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b41ffff0b40, 0xffffffffffff0b42, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xb43ffffffffffff, 0xffffffffffffffff, 0xb45ffffffff0b44, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xb46ffffffffffff, 0xffffffff0b47ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff0b48, 0xb49ffffffffffff, 0xffffffff0b4affff, 0xffffffffffff0b4b, 0xffffffff0b4cffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0b4dffff, 0xffffffff0b4f0b4e, 0xffffffffffffffff, 0xffffffffffffffff, 0xb510b50ffffffff, 0xb530b52ffffffff, 0xb550b54ffffffff, 0xffffffff0b570b56, 0xb590b58ffffffff, 0xb5b0b5affffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b5d0b5cffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b5effffffff, 0xffffffffffffffff, 0xb61ffff0b600b5f, 0xffffffffffffffff, 0xb630b62ffffffff, 0xffffffff0b650b64, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0b66ffffffff, 0xb67ffffffffffff, 0xb69ffff0b68ffff, 0xb6bffff0b6affff, 0xb6dffff0b6cffff, 0xb6fffff0b6effff, 0xb71ffff0b70ffff, 0xffffffff0b72ffff, 0xffff0b74ffff0b73, 0xffffffffffff0b75, 0x1376ffffffffffff, 0xffff1378ffffffff, 0xffffffff137affff, 0x137effffffff137c, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0b80ffff, 0xffffffffffffffff, 0xffff0b81ffffffff, 0xb82ffffffffffff, 0xb84ffff0b83ffff, 0xb86ffff0b85ffff, 0xb88ffff0b87ffff, 0xb8affff0b89ffff, 0xb8cffff0b8bffff, 0xffffffff0b8dffff, 0xffff0b8fffff0b8e, 0xffffffffffff0b90, 0x1391ffffffffffff, 0xffff1393ffffffff, 0xffffffff1395ffff, 0x1399ffffffff1397, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xb9bffffffffffff, 0xffff0b9e0b9d0b9c, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0b9fffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xba1ffff0ba0ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0ba2ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0ba40ba3ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+@property immutable(CompEntry[]) compositionTable() -+{ -+alias CE = CompEntry; -+static immutable CE[] t = [CE(0x00338, 0x0226e),CE(0x00338, 0x02260),CE(0x00338, 0x0226f),CE(0x00300, 0x000c0),CE(0x00301, 0x000c1),CE(0x00302, 0x000c2),CE(0x00303, 0x000c3),CE(0x00304, 0x00100),CE(0x00306, 0x00102),CE(0x00307, 0x00226),CE(0x00308, 0x000c4),CE(0x00309, 0x01ea2),CE(0x0030a, 0x000c5),CE(0x0030c, 0x001cd),CE(0x0030f, 0x00200),CE(0x00311, 0x00202),CE(0x00323, 0x01ea0),CE(0x00325, 0x01e00),CE(0x00328, 0x00104),CE(0x00307, 0x01e02),CE(0x00323, 0x01e04),CE(0x00331, 0x01e06),CE(0x00301, 0x00106),CE(0x00302, 0x00108),CE(0x00307, 0x0010a),CE(0x0030c, 0x0010c),CE(0x00327, 0x000c7),CE(0x00307, 0x01e0a),CE(0x0030c, 0x0010e),CE(0x00323, 0x01e0c),CE(0x00327, 0x01e10),CE(0x0032d, 0x01e12),CE(0x00331, 0x01e0e),CE(0x00300, 0x000c8),CE(0x00301, 0x000c9),CE(0x00302, 0x000ca),CE(0x00303, 0x01ebc),CE(0x00304, 0x00112),CE(0x00306, 0x00114),CE(0x00307, 0x00116),CE(0x00308, 0x000cb),CE(0x00309, 0x01eba),CE(0x0030c, 0x0011a),CE(0x0030f, 0x00204),CE(0x00311, 0x00206),CE(0x00323, 0x01eb8),CE(0x00327, 0x00228),CE(0x00328, 0x00118),CE(0x0032d, 0x01e18),CE(0x00330, 0x01e1a),CE(0x00307, 0x01e1e),CE(0x00301, 0x001f4),CE(0x00302, 0x0011c),CE(0x00304, 0x01e20),CE(0x00306, 0x0011e),CE(0x00307, 0x00120),CE(0x0030c, 0x001e6),CE(0x00327, 0x00122),CE(0x00302, 0x00124),CE(0x00307, 0x01e22),CE(0x00308, 0x01e26),CE(0x0030c, 0x0021e),CE(0x00323, 0x01e24),CE(0x00327, 0x01e28),CE(0x0032e, 0x01e2a),CE(0x00300, 0x000cc),CE(0x00301, 0x000cd),CE(0x00302, 0x000ce),CE(0x00303, 0x00128),CE(0x00304, 0x0012a),CE(0x00306, 0x0012c),CE(0x00307, 0x00130),CE(0x00308, 0x000cf),CE(0x00309, 0x01ec8),CE(0x0030c, 0x001cf),CE(0x0030f, 0x00208),CE(0x00311, 0x0020a),CE(0x00323, 0x01eca),CE(0x00328, 0x0012e),CE(0x00330, 0x01e2c),CE(0x00302, 0x00134),CE(0x00301, 0x01e30),CE(0x0030c, 0x001e8),CE(0x00323, 0x01e32),CE(0x00327, 0x00136),CE(0x00331, 0x01e34),CE(0x00301, 0x00139),CE(0x0030c, 0x0013d),CE(0x00323, 0x01e36),CE(0x00327, 0x0013b),CE(0x0032d, 0x01e3c),CE(0x00331, 0x01e3a),CE(0x00301, 0x01e3e),CE(0x00307, 0x01e40),CE(0x00323, 0x01e42),CE(0x00300, 0x001f8),CE(0x00301, 0x00143),CE(0x00303, 0x000d1),CE(0x00307, 0x01e44),CE(0x0030c, 0x00147),CE(0x00323, 0x01e46),CE(0x00327, 0x00145),CE(0x0032d, 0x01e4a),CE(0x00331, 0x01e48),CE(0x00300, 0x000d2),CE(0x00301, 0x000d3),CE(0x00302, 0x000d4),CE(0x00303, 0x000d5),CE(0x00304, 0x0014c),CE(0x00306, 0x0014e),CE(0x00307, 0x0022e),CE(0x00308, 0x000d6),CE(0x00309, 0x01ece),CE(0x0030b, 0x00150),CE(0x0030c, 0x001d1),CE(0x0030f, 0x0020c),CE(0x00311, 0x0020e),CE(0x0031b, 0x001a0),CE(0x00323, 0x01ecc),CE(0x00328, 0x001ea),CE(0x00301, 0x01e54),CE(0x00307, 0x01e56),CE(0x00301, 0x00154),CE(0x00307, 0x01e58),CE(0x0030c, 0x00158),CE(0x0030f, 0x00210),CE(0x00311, 0x00212),CE(0x00323, 0x01e5a),CE(0x00327, 0x00156),CE(0x00331, 0x01e5e),CE(0x00301, 0x0015a),CE(0x00302, 0x0015c),CE(0x00307, 0x01e60),CE(0x0030c, 0x00160),CE(0x00323, 0x01e62),CE(0x00326, 0x00218),CE(0x00327, 0x0015e),CE(0x00307, 0x01e6a),CE(0x0030c, 0x00164),CE(0x00323, 0x01e6c),CE(0x00326, 0x0021a),CE(0x00327, 0x00162),CE(0x0032d, 0x01e70),CE(0x00331, 0x01e6e),CE(0x00300, 0x000d9),CE(0x00301, 0x000da),CE(0x00302, 0x000db),CE(0x00303, 0x00168),CE(0x00304, 0x0016a),CE(0x00306, 0x0016c),CE(0x00308, 0x000dc),CE(0x00309, 0x01ee6),CE(0x0030a, 0x0016e),CE(0x0030b, 0x00170),CE(0x0030c, 0x001d3),CE(0x0030f, 0x00214),CE(0x00311, 0x00216),CE(0x0031b, 0x001af),CE(0x00323, 0x01ee4),CE(0x00324, 0x01e72),CE(0x00328, 0x00172),CE(0x0032d, 0x01e76),CE(0x00330, 0x01e74),CE(0x00303, 0x01e7c),CE(0x00323, 0x01e7e),CE(0x00300, 0x01e80),CE(0x00301, 0x01e82),CE(0x00302, 0x00174),CE(0x00307, 0x01e86),CE(0x00308, 0x01e84),CE(0x00323, 0x01e88),CE(0x00307, 0x01e8a),CE(0x00308, 0x01e8c),CE(0x00300, 0x01ef2),CE(0x00301, 0x000dd),CE(0x00302, 0x00176),CE(0x00303, 0x01ef8),CE(0x00304, 0x00232),CE(0x00307, 0x01e8e),CE(0x00308, 0x00178),CE(0x00309, 0x01ef6),CE(0x00323, 0x01ef4),CE(0x00301, 0x00179),CE(0x00302, 0x01e90),CE(0x00307, 0x0017b),CE(0x0030c, 0x0017d),CE(0x00323, 0x01e92),CE(0x00331, 0x01e94),CE(0x00300, 0x000e0),CE(0x00301, 0x000e1),CE(0x00302, 0x000e2),CE(0x00303, 0x000e3),CE(0x00304, 0x00101),CE(0x00306, 0x00103),CE(0x00307, 0x00227),CE(0x00308, 0x000e4),CE(0x00309, 0x01ea3),CE(0x0030a, 0x000e5),CE(0x0030c, 0x001ce),CE(0x0030f, 0x00201),CE(0x00311, 0x00203),CE(0x00323, 0x01ea1),CE(0x00325, 0x01e01),CE(0x00328, 0x00105),CE(0x00307, 0x01e03),CE(0x00323, 0x01e05),CE(0x00331, 0x01e07),CE(0x00301, 0x00107),CE(0x00302, 0x00109),CE(0x00307, 0x0010b),CE(0x0030c, 0x0010d),CE(0x00327, 0x000e7),CE(0x00307, 0x01e0b),CE(0x0030c, 0x0010f),CE(0x00323, 0x01e0d),CE(0x00327, 0x01e11),CE(0x0032d, 0x01e13),CE(0x00331, 0x01e0f),CE(0x00300, 0x000e8),CE(0x00301, 0x000e9),CE(0x00302, 0x000ea),CE(0x00303, 0x01ebd),CE(0x00304, 0x00113),CE(0x00306, 0x00115),CE(0x00307, 0x00117),CE(0x00308, 0x000eb),CE(0x00309, 0x01ebb),CE(0x0030c, 0x0011b),CE(0x0030f, 0x00205),CE(0x00311, 0x00207),CE(0x00323, 0x01eb9),CE(0x00327, 0x00229),CE(0x00328, 0x00119),CE(0x0032d, 0x01e19),CE(0x00330, 0x01e1b),CE(0x00307, 0x01e1f),CE(0x00301, 0x001f5),CE(0x00302, 0x0011d),CE(0x00304, 0x01e21),CE(0x00306, 0x0011f),CE(0x00307, 0x00121),CE(0x0030c, 0x001e7),CE(0x00327, 0x00123),CE(0x00302, 0x00125),CE(0x00307, 0x01e23),CE(0x00308, 0x01e27),CE(0x0030c, 0x0021f),CE(0x00323, 0x01e25),CE(0x00327, 0x01e29),CE(0x0032e, 0x01e2b),CE(0x00331, 0x01e96),CE(0x00300, 0x000ec),CE(0x00301, 0x000ed),CE(0x00302, 0x000ee),CE(0x00303, 0x00129),CE(0x00304, 0x0012b),CE(0x00306, 0x0012d),CE(0x00308, 0x000ef),CE(0x00309, 0x01ec9),CE(0x0030c, 0x001d0),CE(0x0030f, 0x00209),CE(0x00311, 0x0020b),CE(0x00323, 0x01ecb),CE(0x00328, 0x0012f),CE(0x00330, 0x01e2d),CE(0x00302, 0x00135),CE(0x0030c, 0x001f0),CE(0x00301, 0x01e31),CE(0x0030c, 0x001e9),CE(0x00323, 0x01e33),CE(0x00327, 0x00137),CE(0x00331, 0x01e35),CE(0x00301, 0x0013a),CE(0x0030c, 0x0013e),CE(0x00323, 0x01e37),CE(0x00327, 0x0013c),CE(0x0032d, 0x01e3d),CE(0x00331, 0x01e3b),CE(0x00301, 0x01e3f),CE(0x00307, 0x01e41),CE(0x00323, 0x01e43),CE(0x00300, 0x001f9),CE(0x00301, 0x00144),CE(0x00303, 0x000f1),CE(0x00307, 0x01e45),CE(0x0030c, 0x00148),CE(0x00323, 0x01e47),CE(0x00327, 0x00146),CE(0x0032d, 0x01e4b),CE(0x00331, 0x01e49),CE(0x00300, 0x000f2),CE(0x00301, 0x000f3),CE(0x00302, 0x000f4),CE(0x00303, 0x000f5),CE(0x00304, 0x0014d),CE(0x00306, 0x0014f),CE(0x00307, 0x0022f),CE(0x00308, 0x000f6),CE(0x00309, 0x01ecf),CE(0x0030b, 0x00151),CE(0x0030c, 0x001d2),CE(0x0030f, 0x0020d),CE(0x00311, 0x0020f),CE(0x0031b, 0x001a1),CE(0x00323, 0x01ecd),CE(0x00328, 0x001eb),CE(0x00301, 0x01e55),CE(0x00307, 0x01e57),CE(0x00301, 0x00155),CE(0x00307, 0x01e59),CE(0x0030c, 0x00159),CE(0x0030f, 0x00211),CE(0x00311, 0x00213),CE(0x00323, 0x01e5b),CE(0x00327, 0x00157),CE(0x00331, 0x01e5f),CE(0x00301, 0x0015b),CE(0x00302, 0x0015d),CE(0x00307, 0x01e61),CE(0x0030c, 0x00161),CE(0x00323, 0x01e63),CE(0x00326, 0x00219),CE(0x00327, 0x0015f),CE(0x00307, 0x01e6b),CE(0x00308, 0x01e97),CE(0x0030c, 0x00165),CE(0x00323, 0x01e6d),CE(0x00326, 0x0021b),CE(0x00327, 0x00163),CE(0x0032d, 0x01e71),CE(0x00331, 0x01e6f),CE(0x00300, 0x000f9),CE(0x00301, 0x000fa),CE(0x00302, 0x000fb),CE(0x00303, 0x00169),CE(0x00304, 0x0016b),CE(0x00306, 0x0016d),CE(0x00308, 0x000fc),CE(0x00309, 0x01ee7),CE(0x0030a, 0x0016f),CE(0x0030b, 0x00171),CE(0x0030c, 0x001d4),CE(0x0030f, 0x00215),CE(0x00311, 0x00217),CE(0x0031b, 0x001b0),CE(0x00323, 0x01ee5),CE(0x00324, 0x01e73),CE(0x00328, 0x00173),CE(0x0032d, 0x01e77),CE(0x00330, 0x01e75),CE(0x00303, 0x01e7d),CE(0x00323, 0x01e7f),CE(0x00300, 0x01e81),CE(0x00301, 0x01e83),CE(0x00302, 0x00175),CE(0x00307, 0x01e87),CE(0x00308, 0x01e85),CE(0x0030a, 0x01e98),CE(0x00323, 0x01e89),CE(0x00307, 0x01e8b),CE(0x00308, 0x01e8d),CE(0x00300, 0x01ef3),CE(0x00301, 0x000fd),CE(0x00302, 0x00177),CE(0x00303, 0x01ef9),CE(0x00304, 0x00233),CE(0x00307, 0x01e8f),CE(0x00308, 0x000ff),CE(0x00309, 0x01ef7),CE(0x0030a, 0x01e99),CE(0x00323, 0x01ef5),CE(0x00301, 0x0017a),CE(0x00302, 0x01e91),CE(0x00307, 0x0017c),CE(0x0030c, 0x0017e),CE(0x00323, 0x01e93),CE(0x00331, 0x01e95),CE(0x00300, 0x01fed),CE(0x00301, 0x00385),CE(0x00342, 0x01fc1),CE(0x00300, 0x01ea6),CE(0x00301, 0x01ea4),CE(0x00303, 0x01eaa),CE(0x00309, 0x01ea8),CE(0x00304, 0x001de),CE(0x00301, 0x001fa),CE(0x00301, 0x001fc),CE(0x00304, 0x001e2),CE(0x00301, 0x01e08),CE(0x00300, 0x01ec0),CE(0x00301, 0x01ebe),CE(0x00303, 0x01ec4),CE(0x00309, 0x01ec2),CE(0x00301, 0x01e2e),CE(0x00300, 0x01ed2),CE(0x00301, 0x01ed0),CE(0x00303, 0x01ed6),CE(0x00309, 0x01ed4),CE(0x00301, 0x01e4c),CE(0x00304, 0x0022c),CE(0x00308, 0x01e4e),CE(0x00304, 0x0022a),CE(0x00301, 0x001fe),CE(0x00300, 0x001db),CE(0x00301, 0x001d7),CE(0x00304, 0x001d5),CE(0x0030c, 0x001d9),CE(0x00300, 0x01ea7),CE(0x00301, 0x01ea5),CE(0x00303, 0x01eab),CE(0x00309, 0x01ea9),CE(0x00304, 0x001df),CE(0x00301, 0x001fb),CE(0x00301, 0x001fd),CE(0x00304, 0x001e3),CE(0x00301, 0x01e09),CE(0x00300, 0x01ec1),CE(0x00301, 0x01ebf),CE(0x00303, 0x01ec5),CE(0x00309, 0x01ec3),CE(0x00301, 0x01e2f),CE(0x00300, 0x01ed3),CE(0x00301, 0x01ed1),CE(0x00303, 0x01ed7),CE(0x00309, 0x01ed5),CE(0x00301, 0x01e4d),CE(0x00304, 0x0022d),CE(0x00308, 0x01e4f),CE(0x00304, 0x0022b),CE(0x00301, 0x001ff),CE(0x00300, 0x001dc),CE(0x00301, 0x001d8),CE(0x00304, 0x001d6),CE(0x0030c, 0x001da),CE(0x00300, 0x01eb0),CE(0x00301, 0x01eae),CE(0x00303, 0x01eb4),CE(0x00309, 0x01eb2),CE(0x00300, 0x01eb1),CE(0x00301, 0x01eaf),CE(0x00303, 0x01eb5),CE(0x00309, 0x01eb3),CE(0x00300, 0x01e14),CE(0x00301, 0x01e16),CE(0x00300, 0x01e15),CE(0x00301, 0x01e17),CE(0x00300, 0x01e50),CE(0x00301, 0x01e52),CE(0x00300, 0x01e51),CE(0x00301, 0x01e53),CE(0x00307, 0x01e64),CE(0x00307, 0x01e65),CE(0x00307, 0x01e66),CE(0x00307, 0x01e67),CE(0x00301, 0x01e78),CE(0x00301, 0x01e79),CE(0x00308, 0x01e7a),CE(0x00308, 0x01e7b),CE(0x00307, 0x01e9b),CE(0x00300, 0x01edc),CE(0x00301, 0x01eda),CE(0x00303, 0x01ee0),CE(0x00309, 0x01ede),CE(0x00323, 0x01ee2),CE(0x00300, 0x01edd),CE(0x00301, 0x01edb),CE(0x00303, 0x01ee1),CE(0x00309, 0x01edf),CE(0x00323, 0x01ee3),CE(0x00300, 0x01eea),CE(0x00301, 0x01ee8),CE(0x00303, 0x01eee),CE(0x00309, 0x01eec),CE(0x00323, 0x01ef0),CE(0x00300, 0x01eeb),CE(0x00301, 0x01ee9),CE(0x00303, 0x01eef),CE(0x00309, 0x01eed),CE(0x00323, 0x01ef1),CE(0x0030c, 0x001ee),CE(0x00304, 0x001ec),CE(0x00304, 0x001ed),CE(0x00304, 0x001e0),CE(0x00304, 0x001e1),CE(0x00306, 0x01e1c),CE(0x00306, 0x01e1d),CE(0x00304, 0x00230),CE(0x00304, 0x00231),CE(0x0030c, 0x001ef),CE(0x00300, 0x01fba),CE(0x00301, 0x00386),CE(0x00304, 0x01fb9),CE(0x00306, 0x01fb8),CE(0x00313, 0x01f08),CE(0x00314, 0x01f09),CE(0x00345, 0x01fbc),CE(0x00300, 0x01fc8),CE(0x00301, 0x00388),CE(0x00313, 0x01f18),CE(0x00314, 0x01f19),CE(0x00300, 0x01fca),CE(0x00301, 0x00389),CE(0x00313, 0x01f28),CE(0x00314, 0x01f29),CE(0x00345, 0x01fcc),CE(0x00300, 0x01fda),CE(0x00301, 0x0038a),CE(0x00304, 0x01fd9),CE(0x00306, 0x01fd8),CE(0x00308, 0x003aa),CE(0x00313, 0x01f38),CE(0x00314, 0x01f39),CE(0x00300, 0x01ff8),CE(0x00301, 0x0038c),CE(0x00313, 0x01f48),CE(0x00314, 0x01f49),CE(0x00314, 0x01fec),CE(0x00300, 0x01fea),CE(0x00301, 0x0038e),CE(0x00304, 0x01fe9),CE(0x00306, 0x01fe8),CE(0x00308, 0x003ab),CE(0x00314, 0x01f59),CE(0x00300, 0x01ffa),CE(0x00301, 0x0038f),CE(0x00313, 0x01f68),CE(0x00314, 0x01f69),CE(0x00345, 0x01ffc),CE(0x00345, 0x01fb4),CE(0x00345, 0x01fc4),CE(0x00300, 0x01f70),CE(0x00301, 0x003ac),CE(0x00304, 0x01fb1),CE(0x00306, 0x01fb0),CE(0x00313, 0x01f00),CE(0x00314, 0x01f01),CE(0x00342, 0x01fb6),CE(0x00345, 0x01fb3),CE(0x00300, 0x01f72),CE(0x00301, 0x003ad),CE(0x00313, 0x01f10),CE(0x00314, 0x01f11),CE(0x00300, 0x01f74),CE(0x00301, 0x003ae),CE(0x00313, 0x01f20),CE(0x00314, 0x01f21),CE(0x00342, 0x01fc6),CE(0x00345, 0x01fc3),CE(0x00300, 0x01f76),CE(0x00301, 0x003af),CE(0x00304, 0x01fd1),CE(0x00306, 0x01fd0),CE(0x00308, 0x003ca),CE(0x00313, 0x01f30),CE(0x00314, 0x01f31),CE(0x00342, 0x01fd6),CE(0x00300, 0x01f78),CE(0x00301, 0x003cc),CE(0x00313, 0x01f40),CE(0x00314, 0x01f41),CE(0x00313, 0x01fe4),CE(0x00314, 0x01fe5),CE(0x00300, 0x01f7a),CE(0x00301, 0x003cd),CE(0x00304, 0x01fe1),CE(0x00306, 0x01fe0),CE(0x00308, 0x003cb),CE(0x00313, 0x01f50),CE(0x00314, 0x01f51),CE(0x00342, 0x01fe6),CE(0x00300, 0x01f7c),CE(0x00301, 0x003ce),CE(0x00313, 0x01f60),CE(0x00314, 0x01f61),CE(0x00342, 0x01ff6),CE(0x00345, 0x01ff3),CE(0x00300, 0x01fd2),CE(0x00301, 0x00390),CE(0x00342, 0x01fd7),CE(0x00300, 0x01fe2),CE(0x00301, 0x003b0),CE(0x00342, 0x01fe7),CE(0x00345, 0x01ff4),CE(0x00301, 0x003d3),CE(0x00308, 0x003d4),CE(0x00308, 0x00407),CE(0x00306, 0x004d0),CE(0x00308, 0x004d2),CE(0x00301, 0x00403),CE(0x00300, 0x00400),CE(0x00306, 0x004d6),CE(0x00308, 0x00401),CE(0x00306, 0x004c1),CE(0x00308, 0x004dc),CE(0x00308, 0x004de),CE(0x00300, 0x0040d),CE(0x00304, 0x004e2),CE(0x00306, 0x00419),CE(0x00308, 0x004e4),CE(0x00301, 0x0040c),CE(0x00308, 0x004e6),CE(0x00304, 0x004ee),CE(0x00306, 0x0040e),CE(0x00308, 0x004f0),CE(0x0030b, 0x004f2),CE(0x00308, 0x004f4),CE(0x00308, 0x004f8),CE(0x00308, 0x004ec),CE(0x00306, 0x004d1),CE(0x00308, 0x004d3),CE(0x00301, 0x00453),CE(0x00300, 0x00450),CE(0x00306, 0x004d7),CE(0x00308, 0x00451),CE(0x00306, 0x004c2),CE(0x00308, 0x004dd),CE(0x00308, 0x004df),CE(0x00300, 0x0045d),CE(0x00304, 0x004e3),CE(0x00306, 0x00439),CE(0x00308, 0x004e5),CE(0x00301, 0x0045c),CE(0x00308, 0x004e7),CE(0x00304, 0x004ef),CE(0x00306, 0x0045e),CE(0x00308, 0x004f1),CE(0x0030b, 0x004f3),CE(0x00308, 0x004f5),CE(0x00308, 0x004f9),CE(0x00308, 0x004ed),CE(0x00308, 0x00457),CE(0x0030f, 0x00476),CE(0x0030f, 0x00477),CE(0x00308, 0x004da),CE(0x00308, 0x004db),CE(0x00308, 0x004ea),CE(0x00308, 0x004eb),CE(0x00653, 0x00622),CE(0x00654, 0x00623),CE(0x00655, 0x00625),CE(0x00654, 0x00624),CE(0x00654, 0x00626),CE(0x00654, 0x006c2),CE(0x00654, 0x006d3),CE(0x00654, 0x006c0),CE(0x0093c, 0x00929),CE(0x0093c, 0x00931),CE(0x0093c, 0x00934),CE(0x009be, 0x009cb),CE(0x009d7, 0x009cc),CE(0x00b3e, 0x00b4b),CE(0x00b56, 0x00b48),CE(0x00b57, 0x00b4c),CE(0x00bd7, 0x00b94),CE(0x00bbe, 0x00bca),CE(0x00bd7, 0x00bcc),CE(0x00bbe, 0x00bcb),CE(0x00c56, 0x00c48),CE(0x00cd5, 0x00cc0),CE(0x00cc2, 0x00cca),CE(0x00cd5, 0x00cc7),CE(0x00cd6, 0x00cc8),CE(0x00cd5, 0x00ccb),CE(0x00d3e, 0x00d4a),CE(0x00d57, 0x00d4c),CE(0x00d3e, 0x00d4b),CE(0x00dca, 0x00dda),CE(0x00dcf, 0x00ddc),CE(0x00ddf, 0x00dde),CE(0x00dca, 0x00ddd),CE(0x0102e, 0x01026),CE(0x01b35, 0x01b06),CE(0x01b35, 0x01b08),CE(0x01b35, 0x01b0a),CE(0x01b35, 0x01b0c),CE(0x01b35, 0x01b0e),CE(0x01b35, 0x01b12),CE(0x01b35, 0x01b3b),CE(0x01b35, 0x01b3d),CE(0x01b35, 0x01b40),CE(0x01b35, 0x01b41),CE(0x01b35, 0x01b43),CE(0x00304, 0x01e38),CE(0x00304, 0x01e39),CE(0x00304, 0x01e5c),CE(0x00304, 0x01e5d),CE(0x00307, 0x01e68),CE(0x00307, 0x01e69),CE(0x00302, 0x01eac),CE(0x00306, 0x01eb6),CE(0x00302, 0x01ead),CE(0x00306, 0x01eb7),CE(0x00302, 0x01ec6),CE(0x00302, 0x01ec7),CE(0x00302, 0x01ed8),CE(0x00302, 0x01ed9),CE(0x00300, 0x01f02),CE(0x00301, 0x01f04),CE(0x00342, 0x01f06),CE(0x00345, 0x01f80),CE(0x00300, 0x01f03),CE(0x00301, 0x01f05),CE(0x00342, 0x01f07),CE(0x00345, 0x01f81),CE(0x00345, 0x01f82),CE(0x00345, 0x01f83),CE(0x00345, 0x01f84),CE(0x00345, 0x01f85),CE(0x00345, 0x01f86),CE(0x00345, 0x01f87),CE(0x00300, 0x01f0a),CE(0x00301, 0x01f0c),CE(0x00342, 0x01f0e),CE(0x00345, 0x01f88),CE(0x00300, 0x01f0b),CE(0x00301, 0x01f0d),CE(0x00342, 0x01f0f),CE(0x00345, 0x01f89),CE(0x00345, 0x01f8a),CE(0x00345, 0x01f8b),CE(0x00345, 0x01f8c),CE(0x00345, 0x01f8d),CE(0x00345, 0x01f8e),CE(0x00345, 0x01f8f),CE(0x00300, 0x01f12),CE(0x00301, 0x01f14),CE(0x00300, 0x01f13),CE(0x00301, 0x01f15),CE(0x00300, 0x01f1a),CE(0x00301, 0x01f1c),CE(0x00300, 0x01f1b),CE(0x00301, 0x01f1d),CE(0x00300, 0x01f22),CE(0x00301, 0x01f24),CE(0x00342, 0x01f26),CE(0x00345, 0x01f90),CE(0x00300, 0x01f23),CE(0x00301, 0x01f25),CE(0x00342, 0x01f27),CE(0x00345, 0x01f91),CE(0x00345, 0x01f92),CE(0x00345, 0x01f93),CE(0x00345, 0x01f94),CE(0x00345, 0x01f95),CE(0x00345, 0x01f96),CE(0x00345, 0x01f97),CE(0x00300, 0x01f2a),CE(0x00301, 0x01f2c),CE(0x00342, 0x01f2e),CE(0x00345, 0x01f98),CE(0x00300, 0x01f2b),CE(0x00301, 0x01f2d),CE(0x00342, 0x01f2f),CE(0x00345, 0x01f99),CE(0x00345, 0x01f9a),CE(0x00345, 0x01f9b),CE(0x00345, 0x01f9c),CE(0x00345, 0x01f9d),CE(0x00345, 0x01f9e),CE(0x00345, 0x01f9f),CE(0x00300, 0x01f32),CE(0x00301, 0x01f34),CE(0x00342, 0x01f36),CE(0x00300, 0x01f33),CE(0x00301, 0x01f35),CE(0x00342, 0x01f37),CE(0x00300, 0x01f3a),CE(0x00301, 0x01f3c),CE(0x00342, 0x01f3e),CE(0x00300, 0x01f3b),CE(0x00301, 0x01f3d),CE(0x00342, 0x01f3f),CE(0x00300, 0x01f42),CE(0x00301, 0x01f44),CE(0x00300, 0x01f43),CE(0x00301, 0x01f45),CE(0x00300, 0x01f4a),CE(0x00301, 0x01f4c),CE(0x00300, 0x01f4b),CE(0x00301, 0x01f4d),CE(0x00300, 0x01f52),CE(0x00301, 0x01f54),CE(0x00342, 0x01f56),CE(0x00300, 0x01f53),CE(0x00301, 0x01f55),CE(0x00342, 0x01f57),CE(0x00300, 0x01f5b),CE(0x00301, 0x01f5d),CE(0x00342, 0x01f5f),CE(0x00300, 0x01f62),CE(0x00301, 0x01f64),CE(0x00342, 0x01f66),CE(0x00345, 0x01fa0),CE(0x00300, 0x01f63),CE(0x00301, 0x01f65),CE(0x00342, 0x01f67),CE(0x00345, 0x01fa1),CE(0x00345, 0x01fa2),CE(0x00345, 0x01fa3),CE(0x00345, 0x01fa4),CE(0x00345, 0x01fa5),CE(0x00345, 0x01fa6),CE(0x00345, 0x01fa7),CE(0x00300, 0x01f6a),CE(0x00301, 0x01f6c),CE(0x00342, 0x01f6e),CE(0x00345, 0x01fa8),CE(0x00300, 0x01f6b),CE(0x00301, 0x01f6d),CE(0x00342, 0x01f6f),CE(0x00345, 0x01fa9),CE(0x00345, 0x01faa),CE(0x00345, 0x01fab),CE(0x00345, 0x01fac),CE(0x00345, 0x01fad),CE(0x00345, 0x01fae),CE(0x00345, 0x01faf),CE(0x00345, 0x01fb2),CE(0x00345, 0x01fc2),CE(0x00345, 0x01ff2),CE(0x00345, 0x01fb7),CE(0x00300, 0x01fcd),CE(0x00301, 0x01fce),CE(0x00342, 0x01fcf),CE(0x00345, 0x01fc7),CE(0x00345, 0x01ff7),CE(0x00300, 0x01fdd),CE(0x00301, 0x01fde),CE(0x00342, 0x01fdf),CE(0x00338, 0x0219a),CE(0x00338, 0x0219b),CE(0x00338, 0x021ae),CE(0x00338, 0x021cd),CE(0x00338, 0x021cf),CE(0x00338, 0x021ce),CE(0x00338, 0x02204),CE(0x00338, 0x02209),CE(0x00338, 0x0220c),CE(0x00338, 0x02224),CE(0x00338, 0x02226),CE(0x00338, 0x02241),CE(0x00338, 0x02244),CE(0x00338, 0x02247),CE(0x00338, 0x02249),CE(0x00338, 0x0226d),CE(0x00338, 0x02262),CE(0x00338, 0x02270),CE(0x00338, 0x02271),CE(0x00338, 0x02274),CE(0x00338, 0x02275),CE(0x00338, 0x02278),CE(0x00338, 0x02279),CE(0x00338, 0x02280),CE(0x00338, 0x02281),CE(0x00338, 0x022e0),CE(0x00338, 0x022e1),CE(0x00338, 0x02284),CE(0x00338, 0x02285),CE(0x00338, 0x02288),CE(0x00338, 0x02289),CE(0x00338, 0x022e2),CE(0x00338, 0x022e3),CE(0x00338, 0x022ac),CE(0x00338, 0x022ad),CE(0x00338, 0x022ae),CE(0x00338, 0x022af),CE(0x00338, 0x022ea),CE(0x00338, 0x022eb),CE(0x00338, 0x022ec),CE(0x00338, 0x022ed),CE(0x03099, 0x03094),CE(0x03099, 0x0304c),CE(0x03099, 0x0304e),CE(0x03099, 0x03050),CE(0x03099, 0x03052),CE(0x03099, 0x03054),CE(0x03099, 0x03056),CE(0x03099, 0x03058),CE(0x03099, 0x0305a),CE(0x03099, 0x0305c),CE(0x03099, 0x0305e),CE(0x03099, 0x03060),CE(0x03099, 0x03062),CE(0x03099, 0x03065),CE(0x03099, 0x03067),CE(0x03099, 0x03069),CE(0x03099, 0x03070),CE(0x0309a, 0x03071),CE(0x03099, 0x03073),CE(0x0309a, 0x03074),CE(0x03099, 0x03076),CE(0x0309a, 0x03077),CE(0x03099, 0x03079),CE(0x0309a, 0x0307a),CE(0x03099, 0x0307c),CE(0x0309a, 0x0307d),CE(0x03099, 0x0309e),CE(0x03099, 0x030f4),CE(0x03099, 0x030ac),CE(0x03099, 0x030ae),CE(0x03099, 0x030b0),CE(0x03099, 0x030b2),CE(0x03099, 0x030b4),CE(0x03099, 0x030b6),CE(0x03099, 0x030b8),CE(0x03099, 0x030ba),CE(0x03099, 0x030bc),CE(0x03099, 0x030be),CE(0x03099, 0x030c0),CE(0x03099, 0x030c2),CE(0x03099, 0x030c5),CE(0x03099, 0x030c7),CE(0x03099, 0x030c9),CE(0x03099, 0x030d0),CE(0x0309a, 0x030d1),CE(0x03099, 0x030d3),CE(0x0309a, 0x030d4),CE(0x03099, 0x030d6),CE(0x0309a, 0x030d7),CE(0x03099, 0x030d9),CE(0x0309a, 0x030da),CE(0x03099, 0x030dc),CE(0x0309a, 0x030dd),CE(0x03099, 0x030f7),CE(0x03099, 0x030f8),CE(0x03099, 0x030f9),CE(0x03099, 0x030fa),CE(0x03099, 0x030fe),CE(0x110ba, 0x1109a),CE(0x110ba, 0x1109c),CE(0x110ba, 0x110ab),CE(0x11127, 0x1112e),CE(0x11127, 0x1112f),]; -+return t; -+} -+ -+} -+ -+ -+static if(size_t.sizeof == 4) { -+//6976 bytes -+enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 7, 6)([ 0x0, 0x40, 0x240], [ 0x100, 0x400, 0x1240], [ 0x2020100, 0x4020302, 0x2020205, 0x2060202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20001, 0x0, 0x0, 0x3, 0x0, 0x50004, 0x70006, 0x80000, 0xa0009, 0xb0000, 0xd000c, 0xe0000, 0x10000f, 0x11000f, 0x11000f, 0x11000f, 0x11000f, 0x110000, 0x120000, 0x11000f, 0x110000, 0x130000, 0x150014, 0x170016, 0x190018, 0x1b001a, 0x1c, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x1e0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x200000, 0x0, 0x21, 0x22, 0x0, 0x240023, 0x0, 0x260025, 0x280027, 0x29, 0x2a0000, 0x0, 0x2b0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2d0000, 0x2e0000, 0x2f0000, 0x0, 0x0, 0x0, 0x0, 0x30, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x320000, 0x340033, 0x0, 0x0, 0x35, 0x360000, 0x380037, 0x3a0039, 0x0, 0x3c003b, 0x0, 0x3d0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x350000, 0x42, 0x43, 0x3a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x450000, 0x46, 0x470000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xdcdce8e6, 0xd8e8dcdc, 0xdcdcdcdc, 0xdccacadc, 0xcadcdcdc, 0xdcdcdcca, 0xdcdcdcdc, 0xdcdcdcdc, 0x1010101, 0xdcdcdc01, 0xe6e6e6dc, 0xe6e6e6e6, 0xdce6f0e6, 0xe6e6dcdc, 0xdcdce6, 0xdce6e6e6, 0xe6dcdcdc, 0xe6dcdce8, 0xe9eaeae9, 0xe6e9eaea, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0xe6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6dc00, 0xe6dce6e6, 0xdcdee6e6, 0xe6e6e6e6, 0xdcdce6e6, 0xdcdcdcdc, 0xe6dce6e6, 0xe6e4dee6, 0xd0c0b0a, 0x11100f0e, 0x14131312, 0x17001615, 0x191800, 0x1200dce6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6, 0xe6e6e6e6, 0x201f1e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b000000, 0x1f1e1d1c, 0xe6222120, 0xe6dcdce6, 0xe6e6e6e6, 0xdce6e6dc, 0x0, 0x0, 0x0, 0x0, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e60000, 0xe6e6e6e6, 0xe60000e6, 0xdce6e6e6, 0xe60000e6, 0xe6dc00e6, 0xdce6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6dce6, 0xdce6e6dc, 0xdce6dcdc, 0xe6dce6dc, 0xe6dce6e6, 0xe6dce6dc, 0xe6e6dc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0xe6e6e6e6, 0xe6dce6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e60000, 0xe600e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e600, 0xe6e6e600, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdcdcdc00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6dce6e6, 0xe6e6dce6, 0xdcdcdce6, 0xe61d1c1b, 0xe6dce6e6, 0xe6dcdce6, 0xe6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x900, 0xe6dce600, 0xe6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900, 0x0, 0x5b5400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x96767, 0x0, 0x0, 0x0, 0x6b6b6b6b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7676, 0x0, 0x0, 0x0, 0x7a7a7a7a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdcdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc00dc00, 0xd800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x828100, 0x84, 0x82820000, 0x8282, 0xe6e60082, 0xe6e60009, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7000000, 0x90900, 0x0, 0x0, 0x0, 0x0, 0xdc00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000, 0x0, 0x0, 0xe600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdce6de00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0xdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0xe6e6e600, 0xe6e6e6e6, 0xdc0000e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0xe6e6e6dc, 0xe6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9090000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x70000, 0x0, 0x0, 0x9090000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6, 0xdcdcdc01, 0xe6e6dcdc, 0xdcdcdcdc, 0x10100e6, 0x1010101, 0x1, 0xdc00, 0x0, 0xe6, 0x0, 0x0, 0xe6dce6e6, 0xe6e6e6e6, 0xe6dce6e6, 0xdcd6eae6, 0xe6e6e6ca, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdce6dce9, 0x0, 0x0, 0x0, 0x0, 0x101e6e6, 0xe6e6e6e6, 0xe6010101, 0xe6, 0xe600, 0xe6010100, 0x101e6dc, 0xdcdcdcdc, 0xe6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe4da0000, 0xe0e0dee8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0x0, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x90000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6e6e6, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc000000, 0xdcdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7000000, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e600e6, 0xe60000dc, 0xe6, 0xe6e60000, 0xe600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x900, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e6e6e6, 0xe6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc00, 0x0, 0x0, 0x0, 0xe600dc00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdc01e6, 0x9000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x70900, 0x0, 0xe6e6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9000000, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7090000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1d8d800, 0x101, 0xd8d8e200, 0xd8d8d8, 0x0, 0xdc000000, 0xdcdcdcdc, 0xdcdcdc, 0xe6e6e600, 0xdcdce6e6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe6e60000, 0xe6e6, 0x0, 0x0, 0x0, 0x0, 0xe6e60000, 0xe6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+enum composeIdxMask = (1<<11)-1, composeCntShift = 11; -+enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)([ 0x0, 0x800], [ 0x1000, 0x2000], [ 0x10000, 0x30002, 0x50004, 0x70006, 0x70008, 0x70007, 0x90007, 0xa0007, 0xc000b, 0x70007, 0x70007, 0x70007, 0x7000d, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x7000e, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x8010800, 0xffff0802, 0x8003ffff, 0x28161813, 0x8821301b, 0x38330832, 0x7841383a, 0x28510850, 0x185c3056, 0x8068485f, 0xffff1078, 0x3882407a, 0x98903889, 0x30a510a3, 0x48ad10ab, 0xffff30b6, 0xffffffff, 0xffffffff, 0x80bcffff, 0x28cf18cc, 0x88da30d4, 0x38ec08eb, 0x70fb40f3, 0x290b1109, 0x19163110, 0x81224919, 0xffff1132, 0x393c4134, 0x994b4143, 0x3960115e, 0x51691167, 0xffff3173, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff1979, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff217c, 0x9810980, 0x9841182, 0xffffffff, 0xffff2185, 0xffffffff, 0x989ffff, 0xffffffff, 0xffffffff, 0x198e218a, 0xffff0991, 0xffff0992, 0xffffffff, 0xffff2193, 0xffffffff, 0xffffffff, 0xffff2197, 0x99c099b, 0x99f119d, 0xffffffff, 0xffff21a0, 0xffffffff, 0x9a4ffff, 0xffffffff, 0xffffffff, 0x19a921a5, 0xffff09ac, 0xffff09ad, 0xffffffff, 0xffff21ae, 0xffffffff, 0xffffffff, 0x21b621b2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x11bc11ba, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x11c011be, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x9c309c2, 0xffffffff, 0xffffffff, 0x9c509c4, 0xffffffff, 0xffffffff, 0xffffffff, 0x9c709c6, 0x9c909c8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x9caffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x29d029cb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x29d5ffff, 0xffff29da, 0xffffffff, 0xffffffff, 0x9dfffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x9e109e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x9e309e2, 0x9e509e4, 0xffffffff, 0xffffffff, 0x9e709e6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff09e8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x39e9ffff, 0xffffffff, 0x21f0ffff, 0x29f4ffff, 0x39f9ffff, 0xffffffff, 0xffffffff, 0x2200ffff, 0xa04ffff, 0xffffffff, 0x3205ffff, 0xffffffff, 0x2a0bffff, 0xffffffff, 0xffff0a10, 0xffff0a11, 0x4212ffff, 0xffffffff, 0x221affff, 0x321effff, 0x4224ffff, 0xffffffff, 0xffffffff, 0x222cffff, 0x1230ffff, 0xffffffff, 0x4232ffff, 0xffffffff, 0x323affff, 0x1a431a40, 0xffffffff, 0xffff0a46, 0xffffffff, 0xffff1247, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a49, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff124a, 0xa4cffff, 0x1a4dffff, 0xa521250, 0xffff2253, 0xffff0a57, 0xffffffff, 0xffff0a58, 0xffffffff, 0x2259ffff, 0xffffffff, 0xa5dffff, 0xffffffff, 0xa5effff, 0xa5fffff, 0xffffffff, 0xffff1260, 0xa62ffff, 0x1a63ffff, 0xa681266, 0xffff2269, 0xffff0a6d, 0xffffffff, 0xffff0a6e, 0xffffffff, 0x226fffff, 0xffffffff, 0xa73ffff, 0xffffffff, 0xa74ffff, 0xa75ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a76, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa780a77, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa7a0a79, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa7c0a7b, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1a7dffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a80, 0xffff0a81, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa82ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a83, 0xa84ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a85, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a86, 0xa87ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1288ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1a8affff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a8d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa90128e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0a91, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa92ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff1a93, 0xffffffff, 0xffff0a96, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa991297, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1a9affff, 0xffffffff, 0xffff0a9d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa9effff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xa9fffff, 0xaa0ffff, 0xaa1ffff, 0xaa2ffff, 0xaa3ffff, 0xffffffff, 0xaa4ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0aa5, 0xffff0aa6, 0xaa80aa7, 0xffffffff, 0xffff0aa9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xaab0aaa, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xaad0aac, 0xffffffff, 0xffffffff, 0xffffffff, 0xaaf0aae, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x12b212b0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xab50ab4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xab70ab6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x22bc22b8, 0xac10ac0, 0xac30ac2, 0xac50ac4, 0x22ca22c6, 0xacf0ace, 0xad10ad0, 0xad30ad2, 0x12d612d4, 0xffffffff, 0xffffffff, 0xffffffff, 0x12da12d8, 0xffffffff, 0xffffffff, 0xffffffff, 0x22e022dc, 0xae50ae4, 0xae70ae6, 0xae90ae8, 0x22ee22ea, 0xaf30af2, 0xaf50af4, 0xaf70af6, 0x1afb1af8, 0xffffffff, 0xffffffff, 0xffffffff, 0x1b011afe, 0xffffffff, 0xffffffff, 0xffffffff, 0x13061304, 0xffffffff, 0xffffffff, 0xffffffff, 0x130a1308, 0xffffffff, 0xffffffff, 0xffffffff, 0x1b0f1b0c, 0xffffffff, 0xffffffff, 0xffffffff, 0x1b12ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x23192315, 0xb1e0b1d, 0xb200b1f, 0xb220b21, 0x23272323, 0xb2c0b2b, 0xb2e0b2d, 0xb300b2f, 0xffff0b31, 0xffffffff, 0xffff0b32, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b33, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b34, 0xffffffff, 0xffffffff, 0xffffffff, 0x1b35ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b38, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b39, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff1b3a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b3d, 0xffff0b3e, 0xffff0b3f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b40, 0xffff0b41, 0xffff0b42, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb43ffff, 0xffffffff, 0xffffffff, 0xffff0b44, 0xb45ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb46ffff, 0xb47ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b48, 0xffffffff, 0xffffffff, 0xb49ffff, 0xb4affff, 0xffffffff, 0xffff0b4b, 0xffffffff, 0xb4cffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb4dffff, 0xffffffff, 0xb4f0b4e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb510b50, 0xffffffff, 0xb530b52, 0xffffffff, 0xb550b54, 0xb570b56, 0xffffffff, 0xffffffff, 0xb590b58, 0xffffffff, 0xb5b0b5a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb5cffff, 0xffff0b5d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b5e, 0xffffffff, 0xffffffff, 0xb600b5f, 0xb61ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb630b62, 0xb650b64, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b66, 0xffffffff, 0xb67ffff, 0xb68ffff, 0xb69ffff, 0xb6affff, 0xb6bffff, 0xb6cffff, 0xb6dffff, 0xb6effff, 0xb6fffff, 0xb70ffff, 0xb71ffff, 0xb72ffff, 0xffffffff, 0xffff0b73, 0xffff0b74, 0xffff0b75, 0xffffffff, 0xffffffff, 0x1376ffff, 0xffffffff, 0xffff1378, 0x137affff, 0xffffffff, 0xffff137c, 0x137effff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb80ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0b81, 0xffffffff, 0xb82ffff, 0xb83ffff, 0xb84ffff, 0xb85ffff, 0xb86ffff, 0xb87ffff, 0xb88ffff, 0xb89ffff, 0xb8affff, 0xb8bffff, 0xb8cffff, 0xb8dffff, 0xffffffff, 0xffff0b8e, 0xffff0b8f, 0xffff0b90, 0xffffffff, 0xffffffff, 0x1391ffff, 0xffffffff, 0xffff1393, 0x1395ffff, 0xffffffff, 0xffff1397, 0x1399ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb9bffff, 0xb9d0b9c, 0xffff0b9e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xb9fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xba0ffff, 0xba1ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xba2ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xba3ffff, 0xffff0ba4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+@property immutable(CompEntry[]) compositionTable() -+{ -+alias CE = CompEntry; -+static immutable CE[] t = [CE(0x00338, 0x0226e),CE(0x00338, 0x02260),CE(0x00338, 0x0226f),CE(0x00300, 0x000c0),CE(0x00301, 0x000c1),CE(0x00302, 0x000c2),CE(0x00303, 0x000c3),CE(0x00304, 0x00100),CE(0x00306, 0x00102),CE(0x00307, 0x00226),CE(0x00308, 0x000c4),CE(0x00309, 0x01ea2),CE(0x0030a, 0x000c5),CE(0x0030c, 0x001cd),CE(0x0030f, 0x00200),CE(0x00311, 0x00202),CE(0x00323, 0x01ea0),CE(0x00325, 0x01e00),CE(0x00328, 0x00104),CE(0x00307, 0x01e02),CE(0x00323, 0x01e04),CE(0x00331, 0x01e06),CE(0x00301, 0x00106),CE(0x00302, 0x00108),CE(0x00307, 0x0010a),CE(0x0030c, 0x0010c),CE(0x00327, 0x000c7),CE(0x00307, 0x01e0a),CE(0x0030c, 0x0010e),CE(0x00323, 0x01e0c),CE(0x00327, 0x01e10),CE(0x0032d, 0x01e12),CE(0x00331, 0x01e0e),CE(0x00300, 0x000c8),CE(0x00301, 0x000c9),CE(0x00302, 0x000ca),CE(0x00303, 0x01ebc),CE(0x00304, 0x00112),CE(0x00306, 0x00114),CE(0x00307, 0x00116),CE(0x00308, 0x000cb),CE(0x00309, 0x01eba),CE(0x0030c, 0x0011a),CE(0x0030f, 0x00204),CE(0x00311, 0x00206),CE(0x00323, 0x01eb8),CE(0x00327, 0x00228),CE(0x00328, 0x00118),CE(0x0032d, 0x01e18),CE(0x00330, 0x01e1a),CE(0x00307, 0x01e1e),CE(0x00301, 0x001f4),CE(0x00302, 0x0011c),CE(0x00304, 0x01e20),CE(0x00306, 0x0011e),CE(0x00307, 0x00120),CE(0x0030c, 0x001e6),CE(0x00327, 0x00122),CE(0x00302, 0x00124),CE(0x00307, 0x01e22),CE(0x00308, 0x01e26),CE(0x0030c, 0x0021e),CE(0x00323, 0x01e24),CE(0x00327, 0x01e28),CE(0x0032e, 0x01e2a),CE(0x00300, 0x000cc),CE(0x00301, 0x000cd),CE(0x00302, 0x000ce),CE(0x00303, 0x00128),CE(0x00304, 0x0012a),CE(0x00306, 0x0012c),CE(0x00307, 0x00130),CE(0x00308, 0x000cf),CE(0x00309, 0x01ec8),CE(0x0030c, 0x001cf),CE(0x0030f, 0x00208),CE(0x00311, 0x0020a),CE(0x00323, 0x01eca),CE(0x00328, 0x0012e),CE(0x00330, 0x01e2c),CE(0x00302, 0x00134),CE(0x00301, 0x01e30),CE(0x0030c, 0x001e8),CE(0x00323, 0x01e32),CE(0x00327, 0x00136),CE(0x00331, 0x01e34),CE(0x00301, 0x00139),CE(0x0030c, 0x0013d),CE(0x00323, 0x01e36),CE(0x00327, 0x0013b),CE(0x0032d, 0x01e3c),CE(0x00331, 0x01e3a),CE(0x00301, 0x01e3e),CE(0x00307, 0x01e40),CE(0x00323, 0x01e42),CE(0x00300, 0x001f8),CE(0x00301, 0x00143),CE(0x00303, 0x000d1),CE(0x00307, 0x01e44),CE(0x0030c, 0x00147),CE(0x00323, 0x01e46),CE(0x00327, 0x00145),CE(0x0032d, 0x01e4a),CE(0x00331, 0x01e48),CE(0x00300, 0x000d2),CE(0x00301, 0x000d3),CE(0x00302, 0x000d4),CE(0x00303, 0x000d5),CE(0x00304, 0x0014c),CE(0x00306, 0x0014e),CE(0x00307, 0x0022e),CE(0x00308, 0x000d6),CE(0x00309, 0x01ece),CE(0x0030b, 0x00150),CE(0x0030c, 0x001d1),CE(0x0030f, 0x0020c),CE(0x00311, 0x0020e),CE(0x0031b, 0x001a0),CE(0x00323, 0x01ecc),CE(0x00328, 0x001ea),CE(0x00301, 0x01e54),CE(0x00307, 0x01e56),CE(0x00301, 0x00154),CE(0x00307, 0x01e58),CE(0x0030c, 0x00158),CE(0x0030f, 0x00210),CE(0x00311, 0x00212),CE(0x00323, 0x01e5a),CE(0x00327, 0x00156),CE(0x00331, 0x01e5e),CE(0x00301, 0x0015a),CE(0x00302, 0x0015c),CE(0x00307, 0x01e60),CE(0x0030c, 0x00160),CE(0x00323, 0x01e62),CE(0x00326, 0x00218),CE(0x00327, 0x0015e),CE(0x00307, 0x01e6a),CE(0x0030c, 0x00164),CE(0x00323, 0x01e6c),CE(0x00326, 0x0021a),CE(0x00327, 0x00162),CE(0x0032d, 0x01e70),CE(0x00331, 0x01e6e),CE(0x00300, 0x000d9),CE(0x00301, 0x000da),CE(0x00302, 0x000db),CE(0x00303, 0x00168),CE(0x00304, 0x0016a),CE(0x00306, 0x0016c),CE(0x00308, 0x000dc),CE(0x00309, 0x01ee6),CE(0x0030a, 0x0016e),CE(0x0030b, 0x00170),CE(0x0030c, 0x001d3),CE(0x0030f, 0x00214),CE(0x00311, 0x00216),CE(0x0031b, 0x001af),CE(0x00323, 0x01ee4),CE(0x00324, 0x01e72),CE(0x00328, 0x00172),CE(0x0032d, 0x01e76),CE(0x00330, 0x01e74),CE(0x00303, 0x01e7c),CE(0x00323, 0x01e7e),CE(0x00300, 0x01e80),CE(0x00301, 0x01e82),CE(0x00302, 0x00174),CE(0x00307, 0x01e86),CE(0x00308, 0x01e84),CE(0x00323, 0x01e88),CE(0x00307, 0x01e8a),CE(0x00308, 0x01e8c),CE(0x00300, 0x01ef2),CE(0x00301, 0x000dd),CE(0x00302, 0x00176),CE(0x00303, 0x01ef8),CE(0x00304, 0x00232),CE(0x00307, 0x01e8e),CE(0x00308, 0x00178),CE(0x00309, 0x01ef6),CE(0x00323, 0x01ef4),CE(0x00301, 0x00179),CE(0x00302, 0x01e90),CE(0x00307, 0x0017b),CE(0x0030c, 0x0017d),CE(0x00323, 0x01e92),CE(0x00331, 0x01e94),CE(0x00300, 0x000e0),CE(0x00301, 0x000e1),CE(0x00302, 0x000e2),CE(0x00303, 0x000e3),CE(0x00304, 0x00101),CE(0x00306, 0x00103),CE(0x00307, 0x00227),CE(0x00308, 0x000e4),CE(0x00309, 0x01ea3),CE(0x0030a, 0x000e5),CE(0x0030c, 0x001ce),CE(0x0030f, 0x00201),CE(0x00311, 0x00203),CE(0x00323, 0x01ea1),CE(0x00325, 0x01e01),CE(0x00328, 0x00105),CE(0x00307, 0x01e03),CE(0x00323, 0x01e05),CE(0x00331, 0x01e07),CE(0x00301, 0x00107),CE(0x00302, 0x00109),CE(0x00307, 0x0010b),CE(0x0030c, 0x0010d),CE(0x00327, 0x000e7),CE(0x00307, 0x01e0b),CE(0x0030c, 0x0010f),CE(0x00323, 0x01e0d),CE(0x00327, 0x01e11),CE(0x0032d, 0x01e13),CE(0x00331, 0x01e0f),CE(0x00300, 0x000e8),CE(0x00301, 0x000e9),CE(0x00302, 0x000ea),CE(0x00303, 0x01ebd),CE(0x00304, 0x00113),CE(0x00306, 0x00115),CE(0x00307, 0x00117),CE(0x00308, 0x000eb),CE(0x00309, 0x01ebb),CE(0x0030c, 0x0011b),CE(0x0030f, 0x00205),CE(0x00311, 0x00207),CE(0x00323, 0x01eb9),CE(0x00327, 0x00229),CE(0x00328, 0x00119),CE(0x0032d, 0x01e19),CE(0x00330, 0x01e1b),CE(0x00307, 0x01e1f),CE(0x00301, 0x001f5),CE(0x00302, 0x0011d),CE(0x00304, 0x01e21),CE(0x00306, 0x0011f),CE(0x00307, 0x00121),CE(0x0030c, 0x001e7),CE(0x00327, 0x00123),CE(0x00302, 0x00125),CE(0x00307, 0x01e23),CE(0x00308, 0x01e27),CE(0x0030c, 0x0021f),CE(0x00323, 0x01e25),CE(0x00327, 0x01e29),CE(0x0032e, 0x01e2b),CE(0x00331, 0x01e96),CE(0x00300, 0x000ec),CE(0x00301, 0x000ed),CE(0x00302, 0x000ee),CE(0x00303, 0x00129),CE(0x00304, 0x0012b),CE(0x00306, 0x0012d),CE(0x00308, 0x000ef),CE(0x00309, 0x01ec9),CE(0x0030c, 0x001d0),CE(0x0030f, 0x00209),CE(0x00311, 0x0020b),CE(0x00323, 0x01ecb),CE(0x00328, 0x0012f),CE(0x00330, 0x01e2d),CE(0x00302, 0x00135),CE(0x0030c, 0x001f0),CE(0x00301, 0x01e31),CE(0x0030c, 0x001e9),CE(0x00323, 0x01e33),CE(0x00327, 0x00137),CE(0x00331, 0x01e35),CE(0x00301, 0x0013a),CE(0x0030c, 0x0013e),CE(0x00323, 0x01e37),CE(0x00327, 0x0013c),CE(0x0032d, 0x01e3d),CE(0x00331, 0x01e3b),CE(0x00301, 0x01e3f),CE(0x00307, 0x01e41),CE(0x00323, 0x01e43),CE(0x00300, 0x001f9),CE(0x00301, 0x00144),CE(0x00303, 0x000f1),CE(0x00307, 0x01e45),CE(0x0030c, 0x00148),CE(0x00323, 0x01e47),CE(0x00327, 0x00146),CE(0x0032d, 0x01e4b),CE(0x00331, 0x01e49),CE(0x00300, 0x000f2),CE(0x00301, 0x000f3),CE(0x00302, 0x000f4),CE(0x00303, 0x000f5),CE(0x00304, 0x0014d),CE(0x00306, 0x0014f),CE(0x00307, 0x0022f),CE(0x00308, 0x000f6),CE(0x00309, 0x01ecf),CE(0x0030b, 0x00151),CE(0x0030c, 0x001d2),CE(0x0030f, 0x0020d),CE(0x00311, 0x0020f),CE(0x0031b, 0x001a1),CE(0x00323, 0x01ecd),CE(0x00328, 0x001eb),CE(0x00301, 0x01e55),CE(0x00307, 0x01e57),CE(0x00301, 0x00155),CE(0x00307, 0x01e59),CE(0x0030c, 0x00159),CE(0x0030f, 0x00211),CE(0x00311, 0x00213),CE(0x00323, 0x01e5b),CE(0x00327, 0x00157),CE(0x00331, 0x01e5f),CE(0x00301, 0x0015b),CE(0x00302, 0x0015d),CE(0x00307, 0x01e61),CE(0x0030c, 0x00161),CE(0x00323, 0x01e63),CE(0x00326, 0x00219),CE(0x00327, 0x0015f),CE(0x00307, 0x01e6b),CE(0x00308, 0x01e97),CE(0x0030c, 0x00165),CE(0x00323, 0x01e6d),CE(0x00326, 0x0021b),CE(0x00327, 0x00163),CE(0x0032d, 0x01e71),CE(0x00331, 0x01e6f),CE(0x00300, 0x000f9),CE(0x00301, 0x000fa),CE(0x00302, 0x000fb),CE(0x00303, 0x00169),CE(0x00304, 0x0016b),CE(0x00306, 0x0016d),CE(0x00308, 0x000fc),CE(0x00309, 0x01ee7),CE(0x0030a, 0x0016f),CE(0x0030b, 0x00171),CE(0x0030c, 0x001d4),CE(0x0030f, 0x00215),CE(0x00311, 0x00217),CE(0x0031b, 0x001b0),CE(0x00323, 0x01ee5),CE(0x00324, 0x01e73),CE(0x00328, 0x00173),CE(0x0032d, 0x01e77),CE(0x00330, 0x01e75),CE(0x00303, 0x01e7d),CE(0x00323, 0x01e7f),CE(0x00300, 0x01e81),CE(0x00301, 0x01e83),CE(0x00302, 0x00175),CE(0x00307, 0x01e87),CE(0x00308, 0x01e85),CE(0x0030a, 0x01e98),CE(0x00323, 0x01e89),CE(0x00307, 0x01e8b),CE(0x00308, 0x01e8d),CE(0x00300, 0x01ef3),CE(0x00301, 0x000fd),CE(0x00302, 0x00177),CE(0x00303, 0x01ef9),CE(0x00304, 0x00233),CE(0x00307, 0x01e8f),CE(0x00308, 0x000ff),CE(0x00309, 0x01ef7),CE(0x0030a, 0x01e99),CE(0x00323, 0x01ef5),CE(0x00301, 0x0017a),CE(0x00302, 0x01e91),CE(0x00307, 0x0017c),CE(0x0030c, 0x0017e),CE(0x00323, 0x01e93),CE(0x00331, 0x01e95),CE(0x00300, 0x01fed),CE(0x00301, 0x00385),CE(0x00342, 0x01fc1),CE(0x00300, 0x01ea6),CE(0x00301, 0x01ea4),CE(0x00303, 0x01eaa),CE(0x00309, 0x01ea8),CE(0x00304, 0x001de),CE(0x00301, 0x001fa),CE(0x00301, 0x001fc),CE(0x00304, 0x001e2),CE(0x00301, 0x01e08),CE(0x00300, 0x01ec0),CE(0x00301, 0x01ebe),CE(0x00303, 0x01ec4),CE(0x00309, 0x01ec2),CE(0x00301, 0x01e2e),CE(0x00300, 0x01ed2),CE(0x00301, 0x01ed0),CE(0x00303, 0x01ed6),CE(0x00309, 0x01ed4),CE(0x00301, 0x01e4c),CE(0x00304, 0x0022c),CE(0x00308, 0x01e4e),CE(0x00304, 0x0022a),CE(0x00301, 0x001fe),CE(0x00300, 0x001db),CE(0x00301, 0x001d7),CE(0x00304, 0x001d5),CE(0x0030c, 0x001d9),CE(0x00300, 0x01ea7),CE(0x00301, 0x01ea5),CE(0x00303, 0x01eab),CE(0x00309, 0x01ea9),CE(0x00304, 0x001df),CE(0x00301, 0x001fb),CE(0x00301, 0x001fd),CE(0x00304, 0x001e3),CE(0x00301, 0x01e09),CE(0x00300, 0x01ec1),CE(0x00301, 0x01ebf),CE(0x00303, 0x01ec5),CE(0x00309, 0x01ec3),CE(0x00301, 0x01e2f),CE(0x00300, 0x01ed3),CE(0x00301, 0x01ed1),CE(0x00303, 0x01ed7),CE(0x00309, 0x01ed5),CE(0x00301, 0x01e4d),CE(0x00304, 0x0022d),CE(0x00308, 0x01e4f),CE(0x00304, 0x0022b),CE(0x00301, 0x001ff),CE(0x00300, 0x001dc),CE(0x00301, 0x001d8),CE(0x00304, 0x001d6),CE(0x0030c, 0x001da),CE(0x00300, 0x01eb0),CE(0x00301, 0x01eae),CE(0x00303, 0x01eb4),CE(0x00309, 0x01eb2),CE(0x00300, 0x01eb1),CE(0x00301, 0x01eaf),CE(0x00303, 0x01eb5),CE(0x00309, 0x01eb3),CE(0x00300, 0x01e14),CE(0x00301, 0x01e16),CE(0x00300, 0x01e15),CE(0x00301, 0x01e17),CE(0x00300, 0x01e50),CE(0x00301, 0x01e52),CE(0x00300, 0x01e51),CE(0x00301, 0x01e53),CE(0x00307, 0x01e64),CE(0x00307, 0x01e65),CE(0x00307, 0x01e66),CE(0x00307, 0x01e67),CE(0x00301, 0x01e78),CE(0x00301, 0x01e79),CE(0x00308, 0x01e7a),CE(0x00308, 0x01e7b),CE(0x00307, 0x01e9b),CE(0x00300, 0x01edc),CE(0x00301, 0x01eda),CE(0x00303, 0x01ee0),CE(0x00309, 0x01ede),CE(0x00323, 0x01ee2),CE(0x00300, 0x01edd),CE(0x00301, 0x01edb),CE(0x00303, 0x01ee1),CE(0x00309, 0x01edf),CE(0x00323, 0x01ee3),CE(0x00300, 0x01eea),CE(0x00301, 0x01ee8),CE(0x00303, 0x01eee),CE(0x00309, 0x01eec),CE(0x00323, 0x01ef0),CE(0x00300, 0x01eeb),CE(0x00301, 0x01ee9),CE(0x00303, 0x01eef),CE(0x00309, 0x01eed),CE(0x00323, 0x01ef1),CE(0x0030c, 0x001ee),CE(0x00304, 0x001ec),CE(0x00304, 0x001ed),CE(0x00304, 0x001e0),CE(0x00304, 0x001e1),CE(0x00306, 0x01e1c),CE(0x00306, 0x01e1d),CE(0x00304, 0x00230),CE(0x00304, 0x00231),CE(0x0030c, 0x001ef),CE(0x00300, 0x01fba),CE(0x00301, 0x00386),CE(0x00304, 0x01fb9),CE(0x00306, 0x01fb8),CE(0x00313, 0x01f08),CE(0x00314, 0x01f09),CE(0x00345, 0x01fbc),CE(0x00300, 0x01fc8),CE(0x00301, 0x00388),CE(0x00313, 0x01f18),CE(0x00314, 0x01f19),CE(0x00300, 0x01fca),CE(0x00301, 0x00389),CE(0x00313, 0x01f28),CE(0x00314, 0x01f29),CE(0x00345, 0x01fcc),CE(0x00300, 0x01fda),CE(0x00301, 0x0038a),CE(0x00304, 0x01fd9),CE(0x00306, 0x01fd8),CE(0x00308, 0x003aa),CE(0x00313, 0x01f38),CE(0x00314, 0x01f39),CE(0x00300, 0x01ff8),CE(0x00301, 0x0038c),CE(0x00313, 0x01f48),CE(0x00314, 0x01f49),CE(0x00314, 0x01fec),CE(0x00300, 0x01fea),CE(0x00301, 0x0038e),CE(0x00304, 0x01fe9),CE(0x00306, 0x01fe8),CE(0x00308, 0x003ab),CE(0x00314, 0x01f59),CE(0x00300, 0x01ffa),CE(0x00301, 0x0038f),CE(0x00313, 0x01f68),CE(0x00314, 0x01f69),CE(0x00345, 0x01ffc),CE(0x00345, 0x01fb4),CE(0x00345, 0x01fc4),CE(0x00300, 0x01f70),CE(0x00301, 0x003ac),CE(0x00304, 0x01fb1),CE(0x00306, 0x01fb0),CE(0x00313, 0x01f00),CE(0x00314, 0x01f01),CE(0x00342, 0x01fb6),CE(0x00345, 0x01fb3),CE(0x00300, 0x01f72),CE(0x00301, 0x003ad),CE(0x00313, 0x01f10),CE(0x00314, 0x01f11),CE(0x00300, 0x01f74),CE(0x00301, 0x003ae),CE(0x00313, 0x01f20),CE(0x00314, 0x01f21),CE(0x00342, 0x01fc6),CE(0x00345, 0x01fc3),CE(0x00300, 0x01f76),CE(0x00301, 0x003af),CE(0x00304, 0x01fd1),CE(0x00306, 0x01fd0),CE(0x00308, 0x003ca),CE(0x00313, 0x01f30),CE(0x00314, 0x01f31),CE(0x00342, 0x01fd6),CE(0x00300, 0x01f78),CE(0x00301, 0x003cc),CE(0x00313, 0x01f40),CE(0x00314, 0x01f41),CE(0x00313, 0x01fe4),CE(0x00314, 0x01fe5),CE(0x00300, 0x01f7a),CE(0x00301, 0x003cd),CE(0x00304, 0x01fe1),CE(0x00306, 0x01fe0),CE(0x00308, 0x003cb),CE(0x00313, 0x01f50),CE(0x00314, 0x01f51),CE(0x00342, 0x01fe6),CE(0x00300, 0x01f7c),CE(0x00301, 0x003ce),CE(0x00313, 0x01f60),CE(0x00314, 0x01f61),CE(0x00342, 0x01ff6),CE(0x00345, 0x01ff3),CE(0x00300, 0x01fd2),CE(0x00301, 0x00390),CE(0x00342, 0x01fd7),CE(0x00300, 0x01fe2),CE(0x00301, 0x003b0),CE(0x00342, 0x01fe7),CE(0x00345, 0x01ff4),CE(0x00301, 0x003d3),CE(0x00308, 0x003d4),CE(0x00308, 0x00407),CE(0x00306, 0x004d0),CE(0x00308, 0x004d2),CE(0x00301, 0x00403),CE(0x00300, 0x00400),CE(0x00306, 0x004d6),CE(0x00308, 0x00401),CE(0x00306, 0x004c1),CE(0x00308, 0x004dc),CE(0x00308, 0x004de),CE(0x00300, 0x0040d),CE(0x00304, 0x004e2),CE(0x00306, 0x00419),CE(0x00308, 0x004e4),CE(0x00301, 0x0040c),CE(0x00308, 0x004e6),CE(0x00304, 0x004ee),CE(0x00306, 0x0040e),CE(0x00308, 0x004f0),CE(0x0030b, 0x004f2),CE(0x00308, 0x004f4),CE(0x00308, 0x004f8),CE(0x00308, 0x004ec),CE(0x00306, 0x004d1),CE(0x00308, 0x004d3),CE(0x00301, 0x00453),CE(0x00300, 0x00450),CE(0x00306, 0x004d7),CE(0x00308, 0x00451),CE(0x00306, 0x004c2),CE(0x00308, 0x004dd),CE(0x00308, 0x004df),CE(0x00300, 0x0045d),CE(0x00304, 0x004e3),CE(0x00306, 0x00439),CE(0x00308, 0x004e5),CE(0x00301, 0x0045c),CE(0x00308, 0x004e7),CE(0x00304, 0x004ef),CE(0x00306, 0x0045e),CE(0x00308, 0x004f1),CE(0x0030b, 0x004f3),CE(0x00308, 0x004f5),CE(0x00308, 0x004f9),CE(0x00308, 0x004ed),CE(0x00308, 0x00457),CE(0x0030f, 0x00476),CE(0x0030f, 0x00477),CE(0x00308, 0x004da),CE(0x00308, 0x004db),CE(0x00308, 0x004ea),CE(0x00308, 0x004eb),CE(0x00653, 0x00622),CE(0x00654, 0x00623),CE(0x00655, 0x00625),CE(0x00654, 0x00624),CE(0x00654, 0x00626),CE(0x00654, 0x006c2),CE(0x00654, 0x006d3),CE(0x00654, 0x006c0),CE(0x0093c, 0x00929),CE(0x0093c, 0x00931),CE(0x0093c, 0x00934),CE(0x009be, 0x009cb),CE(0x009d7, 0x009cc),CE(0x00b3e, 0x00b4b),CE(0x00b56, 0x00b48),CE(0x00b57, 0x00b4c),CE(0x00bd7, 0x00b94),CE(0x00bbe, 0x00bca),CE(0x00bd7, 0x00bcc),CE(0x00bbe, 0x00bcb),CE(0x00c56, 0x00c48),CE(0x00cd5, 0x00cc0),CE(0x00cc2, 0x00cca),CE(0x00cd5, 0x00cc7),CE(0x00cd6, 0x00cc8),CE(0x00cd5, 0x00ccb),CE(0x00d3e, 0x00d4a),CE(0x00d57, 0x00d4c),CE(0x00d3e, 0x00d4b),CE(0x00dca, 0x00dda),CE(0x00dcf, 0x00ddc),CE(0x00ddf, 0x00dde),CE(0x00dca, 0x00ddd),CE(0x0102e, 0x01026),CE(0x01b35, 0x01b06),CE(0x01b35, 0x01b08),CE(0x01b35, 0x01b0a),CE(0x01b35, 0x01b0c),CE(0x01b35, 0x01b0e),CE(0x01b35, 0x01b12),CE(0x01b35, 0x01b3b),CE(0x01b35, 0x01b3d),CE(0x01b35, 0x01b40),CE(0x01b35, 0x01b41),CE(0x01b35, 0x01b43),CE(0x00304, 0x01e38),CE(0x00304, 0x01e39),CE(0x00304, 0x01e5c),CE(0x00304, 0x01e5d),CE(0x00307, 0x01e68),CE(0x00307, 0x01e69),CE(0x00302, 0x01eac),CE(0x00306, 0x01eb6),CE(0x00302, 0x01ead),CE(0x00306, 0x01eb7),CE(0x00302, 0x01ec6),CE(0x00302, 0x01ec7),CE(0x00302, 0x01ed8),CE(0x00302, 0x01ed9),CE(0x00300, 0x01f02),CE(0x00301, 0x01f04),CE(0x00342, 0x01f06),CE(0x00345, 0x01f80),CE(0x00300, 0x01f03),CE(0x00301, 0x01f05),CE(0x00342, 0x01f07),CE(0x00345, 0x01f81),CE(0x00345, 0x01f82),CE(0x00345, 0x01f83),CE(0x00345, 0x01f84),CE(0x00345, 0x01f85),CE(0x00345, 0x01f86),CE(0x00345, 0x01f87),CE(0x00300, 0x01f0a),CE(0x00301, 0x01f0c),CE(0x00342, 0x01f0e),CE(0x00345, 0x01f88),CE(0x00300, 0x01f0b),CE(0x00301, 0x01f0d),CE(0x00342, 0x01f0f),CE(0x00345, 0x01f89),CE(0x00345, 0x01f8a),CE(0x00345, 0x01f8b),CE(0x00345, 0x01f8c),CE(0x00345, 0x01f8d),CE(0x00345, 0x01f8e),CE(0x00345, 0x01f8f),CE(0x00300, 0x01f12),CE(0x00301, 0x01f14),CE(0x00300, 0x01f13),CE(0x00301, 0x01f15),CE(0x00300, 0x01f1a),CE(0x00301, 0x01f1c),CE(0x00300, 0x01f1b),CE(0x00301, 0x01f1d),CE(0x00300, 0x01f22),CE(0x00301, 0x01f24),CE(0x00342, 0x01f26),CE(0x00345, 0x01f90),CE(0x00300, 0x01f23),CE(0x00301, 0x01f25),CE(0x00342, 0x01f27),CE(0x00345, 0x01f91),CE(0x00345, 0x01f92),CE(0x00345, 0x01f93),CE(0x00345, 0x01f94),CE(0x00345, 0x01f95),CE(0x00345, 0x01f96),CE(0x00345, 0x01f97),CE(0x00300, 0x01f2a),CE(0x00301, 0x01f2c),CE(0x00342, 0x01f2e),CE(0x00345, 0x01f98),CE(0x00300, 0x01f2b),CE(0x00301, 0x01f2d),CE(0x00342, 0x01f2f),CE(0x00345, 0x01f99),CE(0x00345, 0x01f9a),CE(0x00345, 0x01f9b),CE(0x00345, 0x01f9c),CE(0x00345, 0x01f9d),CE(0x00345, 0x01f9e),CE(0x00345, 0x01f9f),CE(0x00300, 0x01f32),CE(0x00301, 0x01f34),CE(0x00342, 0x01f36),CE(0x00300, 0x01f33),CE(0x00301, 0x01f35),CE(0x00342, 0x01f37),CE(0x00300, 0x01f3a),CE(0x00301, 0x01f3c),CE(0x00342, 0x01f3e),CE(0x00300, 0x01f3b),CE(0x00301, 0x01f3d),CE(0x00342, 0x01f3f),CE(0x00300, 0x01f42),CE(0x00301, 0x01f44),CE(0x00300, 0x01f43),CE(0x00301, 0x01f45),CE(0x00300, 0x01f4a),CE(0x00301, 0x01f4c),CE(0x00300, 0x01f4b),CE(0x00301, 0x01f4d),CE(0x00300, 0x01f52),CE(0x00301, 0x01f54),CE(0x00342, 0x01f56),CE(0x00300, 0x01f53),CE(0x00301, 0x01f55),CE(0x00342, 0x01f57),CE(0x00300, 0x01f5b),CE(0x00301, 0x01f5d),CE(0x00342, 0x01f5f),CE(0x00300, 0x01f62),CE(0x00301, 0x01f64),CE(0x00342, 0x01f66),CE(0x00345, 0x01fa0),CE(0x00300, 0x01f63),CE(0x00301, 0x01f65),CE(0x00342, 0x01f67),CE(0x00345, 0x01fa1),CE(0x00345, 0x01fa2),CE(0x00345, 0x01fa3),CE(0x00345, 0x01fa4),CE(0x00345, 0x01fa5),CE(0x00345, 0x01fa6),CE(0x00345, 0x01fa7),CE(0x00300, 0x01f6a),CE(0x00301, 0x01f6c),CE(0x00342, 0x01f6e),CE(0x00345, 0x01fa8),CE(0x00300, 0x01f6b),CE(0x00301, 0x01f6d),CE(0x00342, 0x01f6f),CE(0x00345, 0x01fa9),CE(0x00345, 0x01faa),CE(0x00345, 0x01fab),CE(0x00345, 0x01fac),CE(0x00345, 0x01fad),CE(0x00345, 0x01fae),CE(0x00345, 0x01faf),CE(0x00345, 0x01fb2),CE(0x00345, 0x01fc2),CE(0x00345, 0x01ff2),CE(0x00345, 0x01fb7),CE(0x00300, 0x01fcd),CE(0x00301, 0x01fce),CE(0x00342, 0x01fcf),CE(0x00345, 0x01fc7),CE(0x00345, 0x01ff7),CE(0x00300, 0x01fdd),CE(0x00301, 0x01fde),CE(0x00342, 0x01fdf),CE(0x00338, 0x0219a),CE(0x00338, 0x0219b),CE(0x00338, 0x021ae),CE(0x00338, 0x021cd),CE(0x00338, 0x021cf),CE(0x00338, 0x021ce),CE(0x00338, 0x02204),CE(0x00338, 0x02209),CE(0x00338, 0x0220c),CE(0x00338, 0x02224),CE(0x00338, 0x02226),CE(0x00338, 0x02241),CE(0x00338, 0x02244),CE(0x00338, 0x02247),CE(0x00338, 0x02249),CE(0x00338, 0x0226d),CE(0x00338, 0x02262),CE(0x00338, 0x02270),CE(0x00338, 0x02271),CE(0x00338, 0x02274),CE(0x00338, 0x02275),CE(0x00338, 0x02278),CE(0x00338, 0x02279),CE(0x00338, 0x02280),CE(0x00338, 0x02281),CE(0x00338, 0x022e0),CE(0x00338, 0x022e1),CE(0x00338, 0x02284),CE(0x00338, 0x02285),CE(0x00338, 0x02288),CE(0x00338, 0x02289),CE(0x00338, 0x022e2),CE(0x00338, 0x022e3),CE(0x00338, 0x022ac),CE(0x00338, 0x022ad),CE(0x00338, 0x022ae),CE(0x00338, 0x022af),CE(0x00338, 0x022ea),CE(0x00338, 0x022eb),CE(0x00338, 0x022ec),CE(0x00338, 0x022ed),CE(0x03099, 0x03094),CE(0x03099, 0x0304c),CE(0x03099, 0x0304e),CE(0x03099, 0x03050),CE(0x03099, 0x03052),CE(0x03099, 0x03054),CE(0x03099, 0x03056),CE(0x03099, 0x03058),CE(0x03099, 0x0305a),CE(0x03099, 0x0305c),CE(0x03099, 0x0305e),CE(0x03099, 0x03060),CE(0x03099, 0x03062),CE(0x03099, 0x03065),CE(0x03099, 0x03067),CE(0x03099, 0x03069),CE(0x03099, 0x03070),CE(0x0309a, 0x03071),CE(0x03099, 0x03073),CE(0x0309a, 0x03074),CE(0x03099, 0x03076),CE(0x0309a, 0x03077),CE(0x03099, 0x03079),CE(0x0309a, 0x0307a),CE(0x03099, 0x0307c),CE(0x0309a, 0x0307d),CE(0x03099, 0x0309e),CE(0x03099, 0x030f4),CE(0x03099, 0x030ac),CE(0x03099, 0x030ae),CE(0x03099, 0x030b0),CE(0x03099, 0x030b2),CE(0x03099, 0x030b4),CE(0x03099, 0x030b6),CE(0x03099, 0x030b8),CE(0x03099, 0x030ba),CE(0x03099, 0x030bc),CE(0x03099, 0x030be),CE(0x03099, 0x030c0),CE(0x03099, 0x030c2),CE(0x03099, 0x030c5),CE(0x03099, 0x030c7),CE(0x03099, 0x030c9),CE(0x03099, 0x030d0),CE(0x0309a, 0x030d1),CE(0x03099, 0x030d3),CE(0x0309a, 0x030d4),CE(0x03099, 0x030d6),CE(0x0309a, 0x030d7),CE(0x03099, 0x030d9),CE(0x0309a, 0x030da),CE(0x03099, 0x030dc),CE(0x0309a, 0x030dd),CE(0x03099, 0x030f7),CE(0x03099, 0x030f8),CE(0x03099, 0x030f9),CE(0x03099, 0x030fa),CE(0x03099, 0x030fe),CE(0x110ba, 0x1109a),CE(0x110ba, 0x1109c),CE(0x110ba, 0x110ab),CE(0x11127, 0x1112e),CE(0x11127, 0x1112f),]; -+return t; -+} -+ -+} -+ ---- a/src/libphobos/src/std/internal/unicode_decomp.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/internal/unicode_decomp.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,32 @@ -+module std.internal.unicode_decomp; -+import std.internal.unicode_tables; -+ -+static if(size_t.sizeof == 8) { -+//22656 bytes -+enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)([ 0x0, 0x20, 0x2a0], [ 0x100, 0xa00, 0x21c0], [ 0x402030202020100, 0x706020202020205, 0x802020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x3000200010000, 0x7000600050004, 0xa000900080000, 0xc000b, 0xf000e000d0000, 0x11001000000000, 0x15001400130012, 0x19001800170016, 0x1b001a00000000, 0x0, 0x1c, 0x1e0000001d0000, 0x1f00000000, 0x0, 0x0, 0x0, 0x0, 0x2100200000, 0x2200000000, 0x2400230000, 0x0, 0x2500000000, 0x2700000026, 0x2800000000, 0x2900000000, 0x2a00000000, 0x2b00000000, 0x2c0000, 0x2e002d0000, 0x3100300000002f, 0x330032, 0x340000, 0x35000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3800370036, 0x0, 0x0, 0x0, 0x3b003a00390000, 0x3d003c, 0x410040003f003e, 0x45004400430042, 0x49004800470046, 0x4d004c004b004a, 0x510050004f004e, 0x530052, 0x57005600550054, 0x5a00590058, 0x5e005d005c005b, 0x6100000060005f, 0x620000, 0x0, 0x63000000000000, 0x67006600650064, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x69000000000068, 0x6a00000000, 0x0, 0x0, 0x6b000000000000, 0x0, 0x6c000000000000, 0x0, 0x0, 0x6e00000000006d, 0x7200710070006f, 0x7500740073, 0x79007800770076, 0x7d007c007b007a, 0x80007f007e0000, 0x81, 0x85008400830082, 0x89008800870086, 0x8d008c008b008a, 0x910090008f008e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x92000000000000, 0x93000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x97009600950094, 0x9b009a00990098, 0x9f009e009d009c, 0xa200a100a0, 0xa600a500a400a3, 0xaa00a900a800a7, 0xae00ad00ac00ab, 0xb200b100b000af, 0xb600b500b400b3, 0xba00b900b800b7, 0xbe00bd00bc00bb, 0xc200c100c000bf, 0xc600c500c400c3, 0xca00c900c800c7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc00cb, 0xcd0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf00ce00000000, 0xd100d00000, 0x0, 0x0, 0x0, 0x0, 0xd500d400d300d2, 0xd900d800d700d6, 0xdd00dc00db00da, 0xdf00d300d200de, 0xe200e100e000d5, 0xe500e400e300d9, 0xe900e800e700e6, 0xed00ec00eb00ea, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf100f000ef00ee, 0xf300f2, 0x0, 0x0, 0x0, 0x0, 0xf700f600f500f4, 0xf8, 0xfb00fa00f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff00fe00fd00fc, 0x103010201010100, 0x107010601050104, 0x10b010a01090108, 0x10c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x69200000015, 0x9000000000000, 0x30f034300000000, 0x11b20003, 0x78703140048, 0x49403c603ce, 0x58605730570056d, 0x5f8000005b005a6, 0x6580631062e062b, 0x6f906ea06e706e4, 0x7a907a6078f0000, 0x7e307bf07ac, 0x8b708b408b10000, 0x95f08cb, 0x9c209af09ac09a9, 0xa47000009ec09e2, 0xab30a8c0a890a86, 0xb550b490b460b43, 0xc5e0c5b0c410000, 0xc980c740c61, 0xd6e0d6b0d680000, 0xe1b00000e0c0d82, 0x9c8058c09c50589, 0xa3b05ec0a0a05ce, 0xa4105f20a3e05ef, 0xa6e061a0a4405f5, 0xaa2064700000000, 0xab006550aad0652, 0xab9065e0ad00675, 0xb0106a00afb069a, 0xb0a06a90b0406a3, 0xb1606ba, 0xb4f06f00b4c06ed, 0xb6b070f0b5206f3, 0xb3706d8000006f6, 0xbae072e0b730717, 0x7500bcc07430000, 0x7400bcf07460bd9, 0x78c000000000bc9, 0x7950c4d079b0c3e, 0xed70c47, 0xc8e07d90c8307ce, 0xca207ed, 0xd1d08580d070842, 0xd2b086c0d0d0848, 0xd49088a0d320873, 0xd5d08a60d380879, 0xd54089d, 0xd7808c10d7108ba, 0xd9808e10d7f08c8, 0xdc4090d0d9b08e4, 0xe0f09620de9093f, 0x97f0e290979096e, 0x8400614060d0e2f, 0xcae07f9, 0x0, 0x0, 0x8f0000000000000, 0xda7, 0x0, 0x0, 0x0, 0x0, 0x7360a670613060c, 0x78307800bb9073d, 0x70309f305b70c32, 0x8e70ca507f00b5f, 0x8d20d8d08d60d9e, 0x8ce0d9108da0d89, 0x9e505a900000d85, 0xe630e5a09de05a2, 0xb0706a600000000, 0xccc08170ba80728, 0xecc0e7b0ccf081a, 0xa64061006090b76, 0xaf80697, 0x9ef05b30c3b0789, 0xe680e5d0e600e57, 0x9f905bd09f605ba, 0xabf06640abc0661, 0xb6507090b620706, 0xcab07f60ca807f3, 0xd13084e0d10084b, 0xda408ed0da108ea, 0xd5a08a30d460887, 0xb1f06c300000000, 0x0, 0x9db059f00000000, 0xc9b07e60ac9066e, 0xc9107dc0c7b07c6, 0xe1509680c9407df, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa11073e0e9a0b0d, 0xde10eb80eb60eb4, 0x695, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4b00240012000f, 0x270006, 0xb4108400a280e96, 0xecf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b00000004001a, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xed5, 0x5400000000, 0x54600000000, 0x0, 0x7410ee8001c0003, 0xfb40f630f43, 0x103c101600000fed, 0x1185, 0x0, 0x0, 0x0, 0x0, 0x0, 0x101f0fbd00000000, 0x1175111910f5108f, 0x1213, 0x0, 0x0, 0x0, 0x0, 0x0, 0x120c117e00000000, 0x124b120311d5, 0x10161011116e10ea, 0x11ee123c101f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11f811f011ae, 0x10f00fad, 0x100d0000, 0x0, 0x12ad000012b612b0, 0x12a4000000000000, 0x0, 0x12d712c212ce, 0x0, 0x0, 0x12c80000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x130a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12ef000012f812f2, 0x132d000000000000, 0x0, 0x131b13041310, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1333133000000000, 0x0, 0x0, 0x12fb12b90000, 0x0, 0x0, 0x0, 0x12ec12aa12e912a7, 0x12f512b300000000, 0x1339133600000000, 0x130112bf12fe12bc, 0x130712c500000000, 0x131512d1130d12cb, 0x133f133c00000000, 0x131812d4132a12e6, 0x132112dd131e12da, 0x132412e0, 0x132712e3, 0x0, 0x0, 0x1342000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13e913e600000000, 0x17ca13ec178f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x185b179213ef0000, 0x1811, 0x0, 0x18520000186d, 0x0, 0x0, 0x0, 0x186a000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18820000, 0x0, 0x188b0000, 0x188e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1879187618731870, 0x18881885187f187c, 0x0, 0x0, 0x189a000000000000, 0x189d, 0x0, 0x0, 0x0, 0x1897000018941891, 0x0, 0x0, 0x0, 0x0, 0x18ac000000000000, 0x18af00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18a618a318a00000, 0x18a900000000, 0x0, 0x0, 0x18b80000000018bb, 0x18be, 0x0, 0x0, 0x0, 0x18b518b2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18c1, 0x0, 0x0, 0x0, 0x0, 0x18ca18c400000000, 0x18c7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18cd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18d0, 0x18da000000000000, 0x18d618d3000018dd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18e618e000000000, 0x18e3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18e900000000, 0x18f318ef18ec, 0x0, 0x0, 0x0, 0x0, 0x18f6000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18ff000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18fc18f9, 0x0, 0x0, 0x0, 0x1902, 0x0, 0x0, 0x0, 0x0, 0x1907000000000000, 0x0, 0x0, 0x190a0000, 0x190d00000000, 0x1910000000000000, 0x0, 0x1913, 0x0, 0x0, 0x19040000, 0x0, 0x1916000000000000, 0x1931193519190000, 0x1938193c, 0x0, 0x191c0000, 0x0, 0x0, 0x0, 0x1922000000000000, 0x0, 0x0, 0x19250000, 0x192800000000, 0x192b000000000000, 0x0, 0x192e, 0x0, 0x0, 0x191f0000, 0x0, 0x0, 0x193f00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1942, 0x0, 0x1a3800000000, 0x1a3e00001a3b, 0x1a4400001a41, 0x1a4700000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a4a000000000000, 0x1a4d0000, 0x1a5600001a531a50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5d50e550568, 0x6870e75062905e6, 0x71a060706cf06ac, 0x77e07230734, 0x82c06af0e7e07a4, 0x6920770056b088d, 0x9371a590e840e82, 0xe8e0e8c0a7d0a2e, 0xb79000006020e90, 0xe8807870e7105d3, 0xba30cd31a5d1a5b, 0x86a0ea41a610a24, 0x10ee10ec10ea1a63, 0xa110ae0123e123c, 0x10ec10ea086a0a24, 0x123e123c11f0, 0x0, 0x0, 0x0, 0x1313, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe86000000000000, 0xe900e660e8a09a0, 0xe980e940e920ad9, 0x1a650ea00e9e0e9c, 0xed31a670ea20ed1, 0xeac0eaa0ea60ea8, 0xeba0eb20eb00eae, 0xec00ebe0e790ebc, 0x6110ec40ec21a5f, 0x116e0eca0ec80ec6, 0xa1305da0a0705cb, 0xa1905e00a1605dd, 0xa6b06170a4a05fb, 0xa7a06260a71061d, 0xa7706230a740620, 0xaa9064e0aa5064a, 0xad6067b0ad30678, 0xaef06840acc0671, 0xb1906bd0afe069d, 0xb1c06c00b2206c6, 0xb2806cc0b2506c9, 0xb5806fc0b6e0712, 0xbab072b0ba50725, 0xbd207490bb10731, 0xbdf07560bd5074c, 0xc1207720bdc0753, 0xc1807780c150775, 0xc4a07980c440792, 0xc50079e0c5307a1, 0xc7f07ca0c7707c2, 0xc8a07d50c8607d1, 0xcef08380cec0835, 0xd1608510d0a0845, 0xd20085b0d190854, 0xd3f08800d350876, 0xd3b087c0d2e086f, 0xd4e089a0d420883, 0xd6308ac0d5708a0, 0xdc1090a0d6008a9, 0xdc709100dca0913, 0xd7b08c40d7408bd, 0xdde09270ddb0924, 0xde6093c0de30939, 0xdec09420def0945, 0xe0109540df50948, 0xe18096b0e040957, 0xe3509850e2c097c, 0xd510b2b0e380988, 0xd3509a60e210df2, 0x0, 0x9e905ad09fc05c0, 0x9b2057609b6057a, 0x9ba057e09be0582, 0x9cf059309ff05c3, 0x9d7059b09cb058f, 0xa0305c709d30597, 0xab6065b0ac20667, 0xa9306380a9f0644, 0xa9b06400a8f0634, 0xac5066a0a97063c, 0xb68070c0b5c0700, 0xc9f07ea0cc50810, 0xc6407af0c6807b3, 0xc6c07b70c7007bb, 0xcb508000cc80813, 0xcbd08080cb107fc, 0xcc1080c0cb90804, 0xd9508de0dbe0907, 0xdaa08f30dae08f7, 0xdb208fb0db608ff, 0xe09095c0dba0903, 0xe1e09710e240974, 0xe120965, 0x0, 0x10c1109f10be109c, 0x10d310b110ca10a8, 0xf160ef40f130ef1, 0xf280f060f1f0efd, 0x110610fb110310f8, 0x110a10ff, 0xf540f490f510f46, 0xf580f4d, 0x1145112311421120, 0x11571135114e112c, 0xf8b0f690f880f66, 0xf9d0f7b0f940f72, 0x119f1190119c118d, 0x11a7119811a31194, 0xfd20fc30fcf0fc0, 0xfda0fcb0fd60fc7, 0x11e611db11e311d8, 0x11ea11df, 0xffe0ff30ffb0ff0, 0x10020ff7, 0x122d121e122a121b, 0x1235122612311222, 0x1025000010220000, 0x102d000010290000, 0x1277125512741252, 0x128912671280125e, 0x106410421061103f, 0x10761054106d104b, 0x10f510f2108f1088, 0x1175117211191112, 0x1203120011d511d2, 0x124b1244, 0x10c510a310dc10ba, 0x10d710b510ce10ac, 0xf1a0ef80f310f0f, 0xf2c0f0a0f230f01, 0x114911271160113e, 0x115b113911521130, 0xf8f0f6d0fa60f84, 0xfa10f7f0f980f76, 0x127b125912921270, 0x128d126b12841262, 0x10681046107f105d, 0x107a10581071104f, 0x10e7108b10961099, 0x10e310e000001092, 0xee80ee50eeb0eee, 0x2a1170002a0f35, 0x116b111500200051, 0x116711640000111c, 0xf630f600f430f40, 0x350031002d0faa, 0x118511811178117b, 0x118911ab00000000, 0xfb40fb10fb70fba, 0x440040003c0000, 0x1213120f12061209, 0x1217123911f511f2, 0x101610131019101c, 0x995001c0018100a, 0x129d124700000000, 0x129912960000124e, 0x103c10390fed0fea, 0x3900031083, 0x1000100010001, 0x1000100010001, 0x100010001, 0x0, 0x1a690000, 0x4e000000000000, 0x0, 0x0, 0x0, 0x2ff02fc02fa, 0x0, 0x1000000000000, 0x1a6f000000000000, 0x1a7e1a7b00001a72, 0x0, 0xc0000008f, 0x0, 0x563000000000000, 0x920560, 0x0, 0x0, 0x1a76000000000000, 0x0, 0x1000000000000, 0x0, 0x0, 0x0, 0x0, 0xae00305, 0x392038303740365, 0x1aad02f403b003a1, 0xb3b00a500a10544, 0x30f034303140305, 0x392038303740365, 0x1aad02f403b003a1, 0xa500a10544, 0xb4107870a7d0692, 0xa280b790b0d0e8c, 0x8400cd30b3b05d3, 0xba3, 0x0, 0x0, 0x83f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe4d05e309a2099e, 0xe770a220a1e0000, 0x6ac06020e500000, 0xe6d0b0d06ac06ac, 0xa28073406cf06cf, 0x786077e0000, 0x82c083b06af0000, 0x82c082c, 0x897088f0863, 0x77c0000060a, 0x5b0071a0000060a, 0xa7d000005e305d5, 0x7230000067e0629, 0x136a136213540787, 0x68000000ae0136f, 0x10060f3a10ec11ee, 0x1aab, 0xa7d0a2e05e60000, 0x73e0ae0, 0x0, 0x3ca03c103e203da, 0x498045903d20455, 0x3de04e703d604cf, 0x3be051104eb049c, 0x6de06d406d106cf, 0x91f091b091806b2, 0x950094d068206e1, 0x72305e605e30734, 0xb3d0b330b300ae0, 0xdd60dd20dcf086a, 0xdfd0dfa0b410b40, 0x5d30a2e09a00a28, 0x0, 0x0, 0x30d0000, 0x0, 0x0, 0x0, 0x1a8d1a8600000000, 0x0, 0x0, 0x0, 0x0, 0x1a9200000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a981a9b1a950000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1aa0, 0x1aa50000, 0x1aa8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ab200001aaf, 0x0, 0x1ac100001ab81ab5, 0x1ac4, 0x0, 0x0, 0x0, 0x1ac80000, 0x1ace000000001acb, 0x1ad10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ad700000556, 0x0, 0x0, 0x55b054a1ad40000, 0x1add1ada, 0x1ae31ae0, 0x1ae91ae6, 0x0, 0x1aef1aec, 0x1afb1af8, 0x1b011afe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b131b101b0d1b0a, 0x0, 0x0, 0x0, 0x0, 0x1b071b041af51af2, 0x0, 0x1b191b1600000000, 0x1b1f1b1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b371b350000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x365030f03430314, 0x3a1039203830374, 0x342032f031c03b0, 0x382037303640355, 0x3f703af03a00391, 0xe600e200d900a3, 0xf600f200ee00ea, 0xb100ac00a700fa, 0xc500c000bb00b6, 0xdd00d400cf00ca, 0x368035903460319, 0x3a4039503860377, 0x3450332031f03b3, 0x385037603670358, 0x3fa03b203a30394, 0x172016e016a0166, 0x182017e017a0176, 0x192018e018a0186, 0x1a2019e019a0196, 0x1b201ae01aa01a6, 0x1c201be01ba01b6, 0x5d5056801ca01c6, 0x67e062905e605e3, 0x60706cf06ac0687, 0x77e07230734071a, 0x82c083b06af07a4, 0x6b2056b088d085e, 0x60a095a06820770, 0xa2e09a009370692, 0xb0d06020ad90a7d, 0xa280b79073e0ae0, 0xcd307870b3b05d3, 0xba308400a1105d8, 0xb410de1086a0a24, 0x30506110695, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1abc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x552054f0542, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6b2073e, 0x0, 0x0, 0x0, 0x1b2f000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x227c000000000000, 0x0, 0x0, 0x0, 0x0, 0x26b0000000000000, 0x0, 0x0, 0x0, 0x1f091f011efb1ee9, 0x1f1b1f171f131f0d, 0x1f5f1f571f4b1f21, 0x1f871f771f6f1f67, 0x1fb91fa51f8b1f89, 0x1fcd1fc71fc51fc1, 0x1feb1fe91fdd1fdb, 0x204f20451ff71fef, 0x207f207d2079206f, 0x20b420ae20982087, 0x20ce20cc20ca20c4, 0x20f820f220dc20da, 0x210f2108210020fc, 0x212f212b21292113, 0x2141213921352131, 0x21972195218b214f, 0x21e521e321d921d7, 0x32521f121ed21e9, 0x2260222303292211, 0x227a2274226e2266, 0x228422822280227e, 0x230c230622e22286, 0x231623122310230e, 0x2334233023222318, 0x235c235a23562354, 0x2376237423622360, 0x238a238823862384, 0x23aa23a823a62394, 0x23ee23de23dc23bc, 0x241c240a23fa23f6, 0x2452244c2442243e, 0x245e245c245a2456, 0x247e247a246c246a, 0x248e248a24842482, 0x2498249624922490, 0x250e250c24f224e8, 0x2530252c25282512, 0x2558255425522534, 0x25742572255c255a, 0x2592258425822578, 0x25ba25aa25982596, 0x25de25c825c425c2, 0x260025fa25e825e0, 0x261a261826142608, 0x26262624261e261c, 0x263c263a2638262a, 0x2658264e264a2648, 0x26622660265c265a, 0x2670266826662664, 0x26862684267e267c, 0x2690268e268a2688, 0x26a0269c26982692, 0x26aa26a826a626a2, 0x26b226ae, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b4900000000, 0x1fd11fcf1fcd, 0x0, 0x0, 0x0, 0x0, 0x1b8100001b7e, 0x1b8700001b84, 0x1b8d00001b8a, 0x1b9300001b90, 0x1b9900001b96, 0x1b9f00001b9c, 0x1ba500001ba20000, 0x1ba80000, 0x0, 0x1bb100001bae1bab, 0x1bba1bb700001bb4, 0x1bc01bbd0000, 0x1bc91bc6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b7b, 0x87000000000000, 0x1bcc1bd30000008a, 0x0, 0x0, 0x0, 0x1c4300001c26, 0x1c9200001bf6, 0x1caf00001c9b, 0x1cca00001cbf, 0x1cdc00001ccf, 0x1ceb00001ce1, 0x1cf700001cf20000, 0x1c100000, 0x0, 0x1d3b00001d261d1d, 0x1d611d5700001d42, 0x1d7e1d760000, 0x1caa1da1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1e44000000001c01, 0x1e571e521e4d, 0x1ca11e6000000000, 0x0, 0x0, 0x0, 0x0, 0x1a10194919440000, 0x19501a141a12194b, 0x1a181a1619571955, 0x1a201a1e1a1c1a1a, 0x19661961195c19a6, 0x196f196d196819b0, 0x198e198319811977, 0x1947199d19981993, 0x19de19dc19da19d8, 0x198c19e419e219e0, 0x19ee19ec19ea19e8, 0x19f619f419f21975, 0x19fe197f19fa19f8, 0x1a2219a419a219d4, 0x1a2a1a281a261a24, 0x1a3019a81a2e1a2c, 0x19ae19ac19aa1a32, 0x19b819b619b419b2, 0x19c019be19bc19ba, 0x19c819c619c419c2, 0x1a361a3419cc19ca, 0x1a0019d219d019ce, 0x1a081a061a041a02, 0x1a0e1a0c1a0a, 0x1f171ee900000000, 0x1efd1ef120471eef, 0x1ef71f0d23641ef3, 0x1f212051208c1eeb, 0x1e901e001d701ce, 0x20d020401fb01f2, 0x245023c02330225, 0x1db01d20257024e, 0x1ff01f601ed01e4, 0x237022902110208, 0x25b025202490240, 0x21e0216022e, 0x2a0026802700260, 0x284026402880274, 0x2c402b00290026c, 0x2a402ec02b802c0, 0x2d002b402bc02ac, 0x2d402e402c80298, 0x2a8029c0278028c, 0x29402e8027c02cc, 0x2e002dc028002d8, 0x23fe21e321112021, 0x0, 0x0, 0x41c04110406082e, 0x440043904320427, 0x475046e044e0447, 0x4850482047f047c, 0x19571950194b1944, 0x196f19681961195c, 0x1993198e19831977, 0x194d1946199d1998, 0x1963195e19591952, 0x198519791971196a, 0x199f199a19951990, 0x1974197c1988, 0x20471eef1f171ee9, 0x1f5f1eed1f611f19, 0x22e203291fcd1f0f, 0x204f25c822232286, 0x2240221b223b0325, 0x23ca255e231c2007, 0x2098236823e21fab, 0x22961fdf1f4925a2, 0x208a1f731f2b262c, 0x20fa1ef31efd1ef1, 0x20b220b81fc92001, 0x1fd725681f292390, 0x48e048b04882083, 0x4b704b404b10491, 0x4c304c004bd04ba, 0x4e404cc04c904c6, 0x4d604a3034e033b, 0x5290518050304f2, 0x34d033a0327053a, 0x7390a7f0a8206b4, 0x1c0a1bff1bf11bd8, 0x1c731c411c241c1a, 0x1cbd1cad1c991c90, 0x1cdf1cda1ccd1c1e, 0x1bde1cf51cf01bfb, 0x1c8e1d111d0f1ca6, 0x1d551d391d1b1d0d, 0x1ddc1c311d9f1d74, 0x1e041e001def1c22, 0x1c351e1b1e191e11, 0x1e421c5d1e341bed, 0x1e551e501e4b, 0x1beb1be51be01bda, 0x1c0c1c041bf91bf3, 0x1c331c201c1c1c13, 0x1c2e1c291c3c1c37, 0x1c501c571c4b1c46, 0x1c6d1c661c5f1c5c, 0x1c8b1c841c7d1c61, 0x1cb21ca81ca41c95, 0x1cd61cd21cc21cb7, 0x1c811d031cfa1ce4, 0x1d291d351d171d0c, 0x1d4c1d451d201d30, 0x1d6b1d641d3e1d51, 0x1d811d951d701d5a, 0x1d8f1d8a1d9b1d85, 0x1db81da41dac1d79, 0x1dc51dbf1dbb1db2, 0x1dd61dd21dce1dca, 0x1df11de61de31dde, 0x1e0b1e061c681df5, 0x1e291e241e1f1e13, 0x1c6f1e391e361e2e, 0x3610352033f0311, 0x39d038e037f0370, 0x33e032b03bb03ac, 0x37e036f03600351, 0x3ba03ab039c038d, 0x4230418040d0402, 0x56a0a530b0f042e, 0xa590ce60c580a0f, 0x210a06db0a600a5c, 0x223d21f920892200, 0xbea11b40c260cda, 0x689075b071c0b7b, 0xc290cdd0b8c0a26, 0x6010bf611c011b7, 0x68c07640b7e068d, 0xa560bfd11c30893, 0x11c60c350aec0b94, 0xc030b970a300c00, 0xc070b9a0a340a33, 0xc1b0b9e0a380a37, 0x7680b8206910c1f, 0xd000cfa0cf60690, 0xc0f11c90c380ce9, 0xbed11ba0c2c0ce0, 0xc2f0ce3076c0b86, 0x76f0b890bf011bd, 0x5d70999077b0bb4, 0x5e805ff0a2d0a2a, 0x6ae0b1306940a50, 0xba20722071f0b3a, 0xbc60bc20bbf0bbc, 0x8200c0b0bf90bf3, 0xd25082b08230cd5, 0x5d1092a09360869, 0x36c035d034a0337, 0x3a80399038a037b, 0x3490336032303b7, 0x389037a036b035c, 0x3fe03b603a70398, 0x42a041f04140409, 0x44a0443043c0435, 0xaf4047804710451, 0x0, 0x0, 0x0, 0x0, 0x26b4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe730e6b, 0x0, 0x256a258422132556, 0x26ae1ff91eff22c6, 0x202b25c8209226ae, 0x244a238221872090, 0x25a8251e250424e6, 0x233c22f0229a2254, 0x1f11265225bc24ca, 0x24e42302225e1fe3, 0x24dc22d620e6267a, 0x250a247821a12526, 0x232822a6221d211f, 0x1fb31f7d1f3125ae, 0x23922300225a21d5, 0x257e24ec24e02456, 0x23b02678266a2610, 0x25d624bc242c23d0, 0x212d206d2540267e, 0x23b4231a24682408, 0x20d4206b260c2566, 0x242422ca22b02256, 0x246e1fb125ec2438, 0x242e23e61f811f83, 0x21a3254e25f024c8, 0x20be1f0525462254, 0x1fc3237223322159, 0x1ef5214b1f3923b8, 0x1fed242221e12290, 0x253824cc23982063, 0x21ab228c25962276, 0x1f1f237021bb24a8, 0x241822441f7f1f5d, 0x1fb725c6253e2494, 0x21ef212720982011, 0x265625e423ba22d8, 0x220f1fa5268c2680, 0x217b210d2590226c, 0x22f622d021d12189, 0x2464243223e0234e, 0x25d8259c24d02588, 0x22ee201b1fa71f91, 0x2155211d25382514, 0x232c2406227221b7, 0x20f020be20491f27, 0x24502348233a215b, 0x2612260a25ca2460, 0x25c023da1f332630, 0x1f451f15216725fe, 0x225421e720d020c0, 0x25a624d6238022fc, 0x1fa325ea220726aa, 0x22be22a22233222d, 0x242023ae236e2340, 0x25f221911f612636, 0x258a22b220e21f3d, 0x23322237216b2143, 0x20d820091f9525f6, 0x2294224a222521fc, 0x251624462378233e, 0x1fcb260425c4251c, 0x235022fe200b22c0, 0x2682266e25f824de, 0x23f6247c22ae2231, 0x22ea2326240e23fc, 0x1f9724b01f23254c, 0x241421a521151f8f, 0x258e220d229c20b6, 0x2123252c25ee250e, 0x20371f4d, 0x220500002061, 0x238c232a1f850000, 0x23d823ce23cc23be, 0x245224102616, 0x2544000024e2, 0x25b4259e0000, 0x2642264000000000, 0x25fc25b026762644, 0x1faf1f511f471f35, 0x203d202f1fd51fb5, 0x20d62065205f2041, 0x21792175216120da, 0x220921f321db2185, 0x22ce22b622a82246, 0x23b22342230822f8, 0x23c623c223c42240, 0x23d623d423ca23c8, 0x2432240023f223e8, 0x24582444243a2436, 0x24ce249a249a2480, 0x254a2548252e2522, 0x259e259a256e256c, 0x215d263426282606, 0x248c274b, 0x1f2f1f5b1f7b1ef9, 0x1fbb1fad1f651f4f, 0x203b202d2025202f, 0x2094208e20692061, 0x2125212120aa20a2, 0x21712165214d213d, 0x2185217321792169, 0x21c921c521bf2193, 0x221f221d220521dd, 0x22a22276226e2229, 0x22dc22ce22c422c8, 0x2324230a23a422f8, 0x236a2358234a232a, 0x238e238c237e237c, 0x23b6239e23a02396, 0x2428240c240023f4, 0x24b2245824402432, 0x252a2524250024c6, 0x253c2544253a252e, 0x254a254225462548, 0x25a4258c256e2550, 0x260625f425ce25be, 0x262e262826202616, 0x272126ae265e2634, 0x1ea11e8d2733271f, 0x27a9277927671ea3, 0x26ac26a4, 0x0, 0xade0ae30adf0adb, 0xd280d280ae2, 0x0, 0x0, 0x134e000000000000, 0x134b135113481345, 0x0, 0x13d2000013850000, 0x1374136f135413a6, 0x13b7139b1360138e, 0x13ca13c702f413cd, 0x1359135613c313bf, 0x1371136c1364135c, 0x137f137c1376, 0x1390138b13881382, 0x139d00001398, 0x13a8000013a313a0, 0x13b413b1000013ab, 0x137913cf13bc13b9, 0x135f13ae13931367, 0x181e181e18181818, 0x18201820181e181e, 0x1824182418201820, 0x181c181c18241824, 0x18221822181c181c, 0x181a181a18221822, 0x183c183c181a181a, 0x183e183e183c183c, 0x18281828183e183e, 0x1826182618281828, 0x182a182a18261826, 0x182c182c182a182a, 0x18321832182c182c, 0x1834183418301830, 0x18381838182e182e, 0x1840184018361836, 0x1844184418401840, 0x1848184818441844, 0x1846184618481848, 0x184a184a18461846, 0x184c184c184c184c, 0x18501850186d186d, 0x184e184e18501850, 0x15911591184e184e, 0x186a186a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1842000000000000, 0x1803184218421842, 0x180717ff17ff1803, 0x18621862185b1807, 0x1860186018551855, 0x180b180b180b180b, 0x17cd17cd14151415, 0x17f117f1180d180d, 0x17fd17fd18011801, 0x1809180918051805, 0x17f517f517f51809, 0x1864186418641864, 0x17f517e517d517d1, 0x13fe13f713f417f9, 0x141e14171414140b, 0x146a144d1438142d, 0x1484147b1472146d, 0x14311422148c1487, 0x143c14d414d11435, 0x151a150c150514fa, 0x15a515a215931562, 0x15c815c515ba15b0, 0x1607157515e415df, 0x16451642163f160a, 0x165b16561653164c, 0x1679167416711662, 0x16851682167f167c, 0x16aa169616931688, 0x1579158c16c816b9, 0x14591455145116e0, 0x172d1461145d1526, 0x17691758174f1740, 0x177f17741771176c, 0x17aa17a3179c1782, 0x14e417c717c417b3, 0x64005d179714ee, 0x8000790072006b, 0x17e917e517e117dd, 0x140813db17f917f5, 0x14171414140e140b, 0x1464144d144a1447, 0x14781475146d146a, 0x14871484147e147b, 0x1674167116561653, 0x1693168816851679, 0x16e01579158c1696, 0x17551752152616e5, 0x176c176917631758, 0x17b317b017ad1797, 0x17d117c717c417be, 0x17ed17e517d917d5, 0x140b13fe13f713f4, 0x1438142d141e1411, 0x148c147b1467144d, 0x14d1143514311422, 0x150c150514fa143c, 0x1593156d1562151a, 0x15ba15b015a515a2, 0x157515e415df15c5, 0x1642163f160a1607, 0x1662165b164c1645, 0x16851682167f167c, 0x16c816b916aa1688, 0x1455145113e0158c, 0x1740172d15261459, 0x177117661758174f, 0x17a3179c17851774, 0x17e515ed17b317aa, 0x144d1411140b17ed, 0x151a1481147b1467, 0x16851557154c1529, 0x17661758158c1688, 0x162c162515ed17b3, 0x15ff15da15d71633, 0x152c161c16191602, 0x1490155d155a152f, 0x1440142a142613fb, 0x15bd159d159a1402, 0x1546153b153415c0, 0x157015171549154c, 0x15ff15da15d715b7, 0x152c161c16191602, 0x1490155d155a152f, 0x1440142a142613fb, 0x15bd159d159a1402, 0x1546153b153415c0, 0x157015171549154c, 0x1546153b153415b7, 0x15c815571529154c, 0x1534150c150514fa, 0x15df15c81546153b, 0x13e313e3, 0x0, 0x0, 0x0, 0x0, 0x1434143014301421, 0x145814541450143b, 0x14c114c514a314a3, 0x1521150114fd1508, 0x15251525151d1521, 0x153e159615651565, 0x154f154f1537153e, 0x15b315a815531553, 0x15cf15cb15cb15b3, 0x15f315f315e715d3, 0x16111615160d15f7, 0x1669166516481648, 0x16ad16c016c416bc, 0x16d216cb16cb16ad, 0x170b170216fe16d2, 0x1716171216f316eb, 0x177716ef00000000, 0x173417471743177b, 0x175b175f17381734, 0x1429140117b617b6, 0x1460143f14431425, 0x14a7148f14ab145c, 0x15ac15421569150f, 0x179f17a616d616b5, 0x174b166d172117ba, 0x168f15fb16bc1665, 0x168b16b1171a1730, 0x14ba1493173016b1, 0x168b13fa164f16f7, 0x173c1513159615e7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13d913de165e158f, 0x15eb14e915731706, 0x1497157c1578158a, 0x14f1, 0x0, 0x0, 0x0, 0x0, 0x5401b331b3102f6, 0x1b770093008d0546, 0x2ff1b79, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9931a6b1a6d02fc, 0xe3b00a500a10993, 0x1b451b4f1b4b0e3f, 0x1b351b3b1b391b47, 0x1b411b3f1b3d1b37, 0x98b000000001b43, 0xc000c000c098f, 0x99309930993000c, 0x2fa1b3102f6, 0x8d009305400546, 0xe3b00a500a11a6d, 0x971b4f1b4b0e3f, 0x2f802f402f2009d, 0x54405590548, 0x566009b0099098d, 0x0, 0x5a161f0057, 0x1622006800000061, 0x163000761629006f, 0x163a00841637007d, 0x13e913e613e613d5, 0x13ec178f178f13e9, 0x17ca17ca17ca13ec, 0x13f213d713d717ca, 0x141a13f213f213f2, 0x141c141c141c141a, 0x147014701470141c, 0x13f513f513f51470, 0x13f813f813f813f5, 0x13ff13ff13ff13f8, 0x14e214e014e013ff, 0x140913dc13dc14e2, 0x14f814f814f81409, 0x15321532153214f8, 0x1560156015601532, 0x15a015a015a01560, 0x15c315c315c315a0, 0x15dd15dd15dd15c3, 0x15e215e215e215dd, 0x16051605160515e2, 0x163d163d163d1605, 0x165916591659163d, 0x1677167716771659, 0x14ec14ec14ec1677, 0x140c140c140c14ec, 0x140f140f140f140c, 0x13e113e113e1140f, 0x14151788178813e1, 0x13fc13fc13fc1415, 0x16a2169e169e13fc, 0x169b16a616a616a2, 0x169b, 0x970095008d0000, 0x9f009d009b0099, 0x2f402f200a500a1, 0x30302fa02f802f6, 0x30f034303140305, 0x392038303740365, 0x546054003b003a1, 0x93055905440548, 0x5e305d505680566, 0x687067e062905e6, 0x71a060706cf06ac, 0x7a4077e07230734, 0x85e082c083b06af, 0x77006b2056b088d, 0x98b060a095a0682, 0x9930991098f098d, 0x9a0093706920995, 0x6020ad90a7d0a2e, 0xb79073e0ae00b0d, 0x7870b3b05d30a28, 0x8400a1105d80cd3, 0xde1086a0a240ba3, 0xe3b061106950b41, 0x1b280e410e3f0e3d, 0x1b3f1b3d1b331b2a, 0x1bd61e551e5c1b31, 0x1c181c081bfd1bef, 0x1cee1e171e0f1e02, 0x1bff1bf11bd81c16, 0x1c411c241c1a1c0a, 0x1cad1c991c901c73, 0x1cda1ccd1c1e1cbd, 0x1cf51cf01bfb1cdf, 0x1d111d0f1ca61bde, 0x1d391d1b1d0d1c8e, 0x1c311d9f1d741d55, 0x1e001def1c221ddc, 0x1e1b1e191e111e04, 0x1c5d1e341bed1c35, 0x8b00881c061e42, 0x1a101949194419d4, 0x19501a141a12194b, 0x1a181a1619571955, 0x1a201a1e1a1c1a1a, 0x19661961195c19a6, 0x196f196d196819b0, 0x198e198319811977, 0x199d19981993, 0x19d8194700000000, 0x19e019de19dc19da, 0x19e419e200000000, 0x19ec19ea19e8198c, 0x197519ee00000000, 0x19f819f619f419f2, 0x197f19fa00000000, 0x19fe, 0x90e4b0e450e43, 0x1a820e470e49, 0x1a8b1a891a841b22, 0x1b261b241a90, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26b600000000, 0x26b9, 0x0, 0x0, 0x26bc000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26c226bf00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26c826c500000000, 0x26d726d326cf26cb, 0x26db, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26df000000000000, 0x26e626ed26e226ea, 0x26f1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae000000602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e300000568, 0x68700000000, 0x71a06070000, 0x6af07a4077e0000, 0x88d085e0000083b, 0x682077006b2056b, 0x9370692060a095a, 0xad900000a2e09a0, 0x73e0ae00b0d0000, 0xb3b05d30a280b79, 0xa1105d80cd30000, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e6000005d50568, 0x687067e0629, 0x734071a06070000, 0x6af07a4077e0723, 0x88d085e0000083b, 0x682077006b2056b, 0x93706920000095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e6000005d50568, 0x687067e0629, 0x734071a060706cf, 0x7a400000723, 0x88d085e00000000, 0x682077006b2056b, 0x93706920000095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x9370692060a095a, 0xad90a7d0a2e09a0, 0x73e0ae00b0d0602, 0xb3b05d30a280b79, 0xa1105d80cd30787, 0x86a0a240ba30840, 0x61106950b410de1, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x61106950b410de1, 0xe800e6f, 0xf3c0f3a0f380ee3, 0xfad0f5e0f5c0f3e, 0xfe20fe00fde0faf, 0x10060fe80fe60fe4, 0x100f100d0fad1008, 0x1035103310311011, 0x10ea10861aa3077c, 0x110e10f010ee10ec, 0x11ae1170116e1110, 0x11ce11cc11b211b0, 0x11f811f011ee11d0, 0x123c11fe11fc11fa, 0x1a9e12421240123e, 0x123c11ae116e10f0, 0xf380ee311ee11f0, 0xf5c0f3e0f3c0f3a, 0xfde0faf0fad0f5e, 0xfe60fe40fe20fe0, 0xfad100810060fe8, 0x10311011100f100d, 0x1aa3077c10351033, 0x10ee10ec10ea1086, 0x116e1110110e10f0, 0x11b211b011ae1170, 0x11ee11d011ce11cc, 0x11fc11fa11f811f0, 0x1240123e123c11fe, 0x116e10f01a9e1242, 0x11ee11f0123c11ae, 0xf3c0f3a0f380ee3, 0xfad0f5e0f5c0f3e, 0xfe20fe00fde0faf, 0x10060fe80fe60fe4, 0x100f100d0fad1008, 0x1035103310311011, 0x10ea10861aa3077c, 0x110e10f010ee10ec, 0x11ae1170116e1110, 0x11ce11cc11b211b0, 0x11f811f011ee11d0, 0x123c11fe11fc11fa, 0x1a9e12421240123e, 0x123c11ae116e10f0, 0xf380ee311ee11f0, 0xf5c0f3e0f3c0f3a, 0xfde0faf0fad0f5e, 0xfe60fe40fe20fe0, 0xfad100810060fe8, 0x10311011100f100d, 0x1aa3077c10351033, 0x10ee10ec10ea1086, 0x116e1110110e10f0, 0x11b211b011ae1170, 0x11ee11d011ce11cc, 0x11fc11fa11f811f0, 0x1240123e123c11fe, 0x116e10f01a9e1242, 0x11ee11f0123c11ae, 0xf3c0f3a0f380ee3, 0xfad0f5e0f5c0f3e, 0xfe20fe00fde0faf, 0x10060fe80fe60fe4, 0x100f100d0fad1008, 0x1035103310311011, 0x10ea10861aa3077c, 0x110e10f010ee10ec, 0x11ae1170116e1110, 0x11ce11cc11b211b0, 0x11f811f011ee11d0, 0x123c11fe11fc11fa, 0x1a9e12421240123e, 0x123c11ae116e10f0, 0x12a212a011ee11f0, 0x314030500000000, 0x3740365030f0343, 0x3b003a103920383, 0x30f034303140305, 0x392038303740365, 0x314030503b003a1, 0x3740365030f0343, 0x3b003a103920383, 0x30f034303140305, 0x392038303740365, 0x314030503b003a1, 0x3740365030f0343, 0x3b003a103920383, 0x14e013f513f213d7, 0x13f8140917880000, 0x14ec167713fc15c3, 0x15e214f8140f140c, 0x13dc16591560163d, 0x13ff1470141c1532, 0x160515dd15a014e2, 0x1816183a184a1814, 0x13f513f20000, 0x13f80000000013e1, 0x14ec167713fc0000, 0x15e214f8140f140c, 0x16591560163d, 0x13ff1470141c1532, 0x1605000015a00000, 0x0, 0x13f500000000, 0x13f8000000000000, 0x14ec000013fc0000, 0x15e214f8140f0000, 0x165915600000, 0x13ff000000001532, 0x1605000015a00000, 0x18160000184a0000, 0x13f513f20000, 0x13f80000000013e1, 0x167713fc15c3, 0x15e214f8140f140c, 0x16591560163d, 0x13ff1470141c1532, 0x160515dd15a00000, 0x183a00001814, 0x14e013f513f213d7, 0x13f81409178813e1, 0x14ec000013fc15c3, 0x15e214f8140f140c, 0x13dc16591560163d, 0x13ff1470141c1532, 0x160515dd15a014e2, 0x0, 0x14e013f513f20000, 0x13f8140917880000, 0x14ec000013fc15c3, 0x15e214f8140f140c, 0x13dc16591560163d, 0x13ff1470141c1532, 0x160515dd15a014e2, 0x0, 0x3f103160307030a, 0x4fa04de04ab0468, 0x5310520050b, 0x0, 0x10a0106010200fe, 0x11a01160112010e, 0x12a01260122011e, 0x13a01360132012e, 0x14a01460142013e, 0x15a01560152014e, 0x5e31b4d0162015e, 0x93305e5082c, 0x5e605e305d50568, 0x6ac0687067e0629, 0x734071a060706cf, 0x6af07a4077e0723, 0x88d085e082c083b, 0x682077006b2056b, 0x76c06b1060a095a, 0x930082708660860, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x761075e00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x606, 0x0, 0x0, 0x0, 0x1cad1c9e1bc3, 0x0, 0x0, 0x0, 0x1cf71ff320b02197, 0x208c253220811f17, 0x21e722f221fe1f1d, 0x21eb1f6921451f9d, 0x2560235c24261f93, 0x219d22cc200f2073, 0x25a01eef1ee921b3, 0x21ad20011efd20fa, 0x23f023d221992574, 0x329221b22bc2005, 0x20351f9f2366, 0x0, 0x1b5d1b551b511b69, 0x1b591b711b611b6d, 0x1b65, 0x0, 0x1ffd2147, 0x0, 0x0, 0x0, 0x26f51f0b1f031f07, 0x1f3b1f371f351f2d, 0x1f431f471f411f3f, 0x1f531f5126fd1e63, 0x1e6526f71f631f55, 0x1f7126fb1f691f59, 0x1f7b1f791f251f75, 0x1e691f8d1f8927b9, 0x1fa11f9f1f9b1f99, 0x1fb51faf1fad1e6b, 0x1fc31fbf1fbd1fbb, 0x1fe11fd91fd51fd3, 0x1fe71fe71fe71fe5, 0x1ff51ff122e42703, 0x20031fff1ffb2705, 0x20152013200d2017, 0x2023201f201d2019, 0x202d202920292027, 0x204b203920332031, 0x2043203f204d203d, 0x2057205520711f8f, 0x205b205d20532059, 0x2077207527072067, 0x209620852081207b, 0x209e209c270b2709, 0x1e6d20a4209a20a0, 0x20ac20ac20a81e6f, 0x20be20bc20ba270d, 0x20c820c6270f20c2, 0x20d21e7120cc2137, 0x271320de20e020da, 0x20e820ea271520e4, 0x1e7320f620f420ec, 0x21062104210220fe, 0x21171e7727171e75, 0x27cd211f211b2119, 0x2486271b271b212b, 0x27291e7921332133, 0x1e7b213f213b277d, 0x2157215321512149, 0x21611e7d1e7f215f, 0x216f216d2163271d, 0x21792177216f2171, 0x2183217f217d2181, 0x218f210b21872185, 0x21b121a7219f219b, 0x21b521a921af2723, 0x21c7272521c321b9, 0x21cb1e8121bd21c1, 0x1e8321cd21d321cf, 0x21f5272721df21db, 0x22091e8922032215, 0x1f6d1f6b1e851e87, 0x1ebb2470220b2217, 0x222b2221221f221d, 0x22351e8b27312227, 0x273522462242222f, 0x1e8d224c22392248, 0x225822522250224e, 0x22621e8f225c2737, 0x226a1e9122642739, 0x273b227822762270, 0x273f2288273d2711, 0x2298228a2292228e, 0x22a422a222a822a0, 0x229e274122ac22aa, 0x22c41e9322ba22b8, 0x22d222b4274322c2, 0x22de22d427472745, 0x22e01e9522da22dc, 0x26f922ec22e622e8, 0x274d22fa274922f4, 0x274f2314230a2304, 0x275327512320231e, 0x23381e972336232e, 0x234623441e991e99, 0x1e9b2352234c234a, 0x2757236c2755235e, 0x2759237a27192372, 0x1e9f1e9d275d275b, 0x2763275f27612396, 0x239c239c239a2765, 0x1ea523a21ea323a0, 0x23b023ac27691ea7, 0x23c8276b1ea923b6, 0x23e423d8276f276d, 0x23ec23ea23e81eab, 0x23f8277327732771, 0x2404240227751ead, 0x1eb1241227771eaf, 0x277b241e2416241a, 0x243424301eb3242a, 0x2781277f1eb5243c, 0x2785244827831eb7, 0x278724582454244e, 0x2466278b24622789, 0x247424721eb9272b, 0x278d20a624761ebd, 0x2486272f272d278f, 0x249e1ebf25942488, 0x24a21fa924a0249c, 0x279124aa24a624a4, 0x24b824b624ac24a8, 0x24ce24c424ba24ae, 0x24c224c024be24b4, 0x1ec1279527972793, 0x279f24d824d424d2, 0x1ec51ec3279924da, 0x24ea1ec7279d279b, 0x24f624f024ee24ec, 0x250024f824fa24f4, 0x1ec9250224fe24fc, 0x25101ecb25082506, 0x251a251827a12512, 0x27a31e6725201ecd, 0x25361ed11ecf27a5, 0x27a7255825502542, 0x2576257025642562, 0x257a257c26ff27ab, 0x258c258627012580, 0x25b225ac27af27ad, 0x25cc25b827b125b6, 0x25da25d025d425d2, 0x1ed325e227b325dc, 0x26021ed527b525e6, 0x27bb27b7260e20ee, 0x27bd26221ed91ed7, 0x262e262e27bf1edb, 0x1edd263e27c12632, 0x26542650264c2646, 0x266c265e27c31edf, 0x26741ee31ee12672, 0x27c927c71ee527c5, 0x26901ee7268627cb, 0x269e269a26962694, 0x27cf26a2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//12288 bytes -+enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x120], [ 0x100, 0x400, 0x1380], [ 0x302020202020100, 0x205020202020204, 0x602020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x1000000000000, 0x5000400030002, 0x6, 0x9000800070000, 0xc0000000b000a, 0x0, 0xe00000000000d, 0x0, 0x0, 0x1100000010000f, 0x130012, 0x16001500140000, 0x18000000170000, 0x1a000000190000, 0x0, 0x1c001b0000, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f001e, 0x0, 0x0, 0x23002200210020, 0x27002600250024, 0x28, 0x2b002a00000029, 0x2f002e002d002c, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x34003300320000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38003700360035, 0x3c003b003a0039, 0x3e003d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f00000000, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x43004200410000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x47004600450044, 0x4b004a00490048, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x250012000f000c, 0x850000004f0045, 0xcb00a400a1009e, 0x13301240121011e, 0x1a0019d01880000, 0x1da01b601a3, 0x2730270026d0000, 0x2f30287, 0x33803250322031f, 0x398000003620358, 0x3de03b703b403b1, 0x446043a04370434, 0x4b404b1049c0000, 0x4ee04ca04b7, 0x58a058705840000, 0x61c0000060d059e, 0x33e002b033b0028, 0x38c00790380006d, 0x392007f038f007c, 0x3a2008f03950082, 0x3cd00ba00000000, 0x3db00c803d800c5, 0x3e400d103fb00e8, 0x41000fd040a00f7, 0x419010604130100, 0x41c0109, 0x440012a043d0127, 0x45c01490443012d, 0x130, 0x471015d0462014f, 0x170047701630000, 0x47a01660484, 0x185000000000000, 0x18e04a801940499, 0x4a2, 0x4e401d004d901c5, 0x4f801e4, 0x5450231052f021b, 0x54b023705350221, 0x56902550552023e, 0x57b026405580244, 0x572025b, 0x594027d058d0276, 0x5b4029d059b0284, 0x5e002c905b702a0, 0x61002f605f502de, 0x3110628030b0302, 0x6310314062e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50401f0, 0x0, 0x0, 0x2ac000000000000, 0x5c3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13d036900560000, 0x2a304fb01e70450, 0x28e05a9029205ba, 0x28a05ad029605a5, 0x35b0048000005a1, 0x653064a03540041, 0x416010300000000, 0x522020e046b0157, 0x65f065c05250211, 0x465, 0x40700f4, 0x365005204960182, 0x656064d06500647, 0x36f005c036c0059, 0x3ea00d703e700d4, 0x456014304530140, 0x50101ed04fe01ea, 0x53b022705380224, 0x5c002a905bd02a6, 0x578026105660252, 0x425011200000000, 0x0, 0x351003e00000000, 0x4f101dd03f400e1, 0x4e701d304d101bd, 0x61602fc04ea01d6, 0x0, 0x0, 0x0, 0x66b00000010000d, 0x137, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x662, 0x0, 0x100000000, 0x0, 0x6450670063d0000, 0x72c06df06c3, 0x798077800000759, 0x8d1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x781073500000000, 0x8c10867084707e9, 0x92f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x92808ca00000000, 0x95f091f08fd, 0x9b4000000000000, 0x9b7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9c3000009cc09c6, 0x9ba000000000000, 0x0, 0x9ed09d809e4, 0x0, 0x0, 0x9de0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa0500000a0e0a08, 0xa41000000000000, 0x0, 0xa2f0a1a0a26, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa470a4400000000, 0x0, 0x0, 0xa1109cf0000, 0x0, 0x0, 0x0, 0xa0209c009ff09bd, 0xa0b09c900000000, 0xa4d0a4a00000000, 0xa1709d50a1409d2, 0xa1d09db00000000, 0xa2909e70a2309e1, 0xa530a5000000000, 0xa2c09ea0a3e09fc, 0xa3509f30a3209f0, 0xa3809f6, 0xa3b09f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xac10abe00000000, 0xaca0ac40ac7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xacd00000ad3, 0x0, 0x0, 0x0, 0xad0000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xae80000, 0x0, 0xaf10000, 0xaf4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xadf0adc0ad90ad6, 0xaee0aeb0ae50ae2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb00000000000000, 0xb03, 0x0, 0x0, 0x0, 0xafd00000afa0af7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb12000000000000, 0xb1500000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb0c0b090b060000, 0xb0f00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb1e000000000b21, 0xb24, 0x0, 0x0, 0x0, 0xb1b0b18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb27, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb300b2a00000000, 0xb2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb33, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb36, 0xb40000000000000, 0xb3c0b3900000b43, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb4c0b4600000000, 0xb49, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb4f00000000, 0xb590b550b52, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb5f000000000000, 0x0, 0x0, 0xb620000, 0xb6500000000, 0xb68000000000000, 0x0, 0xb6b, 0x0, 0x0, 0xb5c0000, 0x0, 0xb6e000000000000, 0xb890b710000, 0xb8c, 0x0, 0xb740000, 0x0, 0x0, 0x0, 0xb7a000000000000, 0x0, 0x0, 0xb7d0000, 0xb8000000000, 0xb83000000000000, 0x0, 0xb86, 0x0, 0x0, 0xb770000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb8f00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb9200000000, 0xb9800000b95, 0xb9e00000b9b, 0xba100000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xba4000000000000, 0xba70000, 0xbb000000bad0baa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3830070037d006a, 0x389007603860073, 0x39f008c039b0088, 0x3ae009b03a50092, 0x3ab009803a80095, 0x3d400c103d000bd, 0x40100ee03fe00eb, 0x40400f103f700e4, 0x41f010c040d00fa, 0x422010f04280115, 0x42e011b042b0118, 0x4490136045f014c, 0x46e015a04680154, 0x47d016904740160, 0x48a01760480016c, 0x48d017904870173, 0x493017f0490017c, 0x4a50191049f018b, 0x4ab019704ae019a, 0x4d501c104cd01b9, 0x4e001cc04dc01c8, 0x52c021805290215, 0x53e022a0532021e, 0x54802340541022d, 0x55f024b05550241, 0x55b0247054e023a, 0x56c02580562024e, 0x581026a0575025e, 0x5dd02c6057e0267, 0x5e302cc05e602cf, 0x597028005900279, 0x5ec02d505e902d2, 0x5f202db05ef02d8, 0x5f802e105fb02e4, 0x60402ea060102e7, 0x61902ff060702ed, 0x6340317062b030e, 0x56f04310637031a, 0x6590000062205fe, 0x0, 0x35f004c0372005f, 0x3280015032c0019, 0x330001d03340021, 0x345003203750062, 0x34d003a0341002e, 0x379006603490036, 0x3e100ce03ed00da, 0x3be00ab03ca00b7, 0x3c600b303ba00a7, 0x3f000dd03c200af, 0x4590146044d013a, 0x4f501e1051b0207, 0x4ba01a604be01aa, 0x4c201ae04c601b2, 0x50b01f7051e020a, 0x51301ff050701f3, 0x5170203050f01fb, 0x5b1029a05da02c3, 0x5c602af05ca02b3, 0x5ce02b705d202bb, 0x60a02f005d602bf, 0x61f030506250308, 0x61302f9, 0x0, 0x81b07f9081807f6, 0x82d080b08240802, 0x69e067c069b0679, 0x6b0068e06a70685, 0x858084d0855084a, 0x85c0851, 0x6d406c906d106c6, 0x6d806cd, 0x89308710890086e, 0x8a50883089c087a, 0x70706e5070406e2, 0x71906f7071006ee, 0x8eb08dc08e808d9, 0x8f308e408ef08e0, 0x74a073b07470738, 0x7520743074e073f, 0x90e0903090b0900, 0x9120907, 0x76a075f0767075c, 0x76e0763, 0x949093a09460937, 0x9510942094d093e, 0x787000007840000, 0x78f0000078b0000, 0x98b096909880966, 0x99d097b09940972, 0x7c0079e07bd079b, 0x7d207b007c907a7, 0x847084407e907e2, 0x8c108be08670860, 0x91f091c08fd08fa, 0x95f0958, 0x81f07fd08360814, 0x831080f08280806, 0x6a2068006b90697, 0x6b4069206ab0689, 0x897087508ae088c, 0x8a9088708a0087e, 0x70b06e907220700, 0x71d06fb071406f2, 0x98f096d09a60984, 0x9a1097f09980976, 0x7c407a207db07b9, 0x7d607b407cd07ab, 0x84107e507f007f3, 0x83d083a000007ec, 0x670066d06730676, 0x8bc000006bd, 0x8b9086306400000, 0x8b508b20000086a, 0x6df06dc06c306c0, 0xbb90bb60bb30726, 0x8d108cd08c408c7, 0x8d508f700000000, 0x72c0729072f0732, 0xbc20bbf0bbc0000, 0x92f092b09220925, 0x933095509190916, 0x7780775077b077e, 0x31d063d063a0772, 0x9b1095b00000000, 0x9ad09aa00000962, 0x798079507590756, 0x64307df, 0xbc70bc5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x79300000000, 0x4f015200000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbcc0bc900000000, 0x0, 0x0, 0x0, 0x0, 0xbcf00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbd50bd80bd20000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbdb, 0xbde0000, 0xbe1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbe700000be4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbea0000, 0xbf0000000000bed, 0xbf30000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbf900000006, 0x0, 0x0, 0x900030bf60000, 0xbff0bfc, 0xc050c02, 0xc0b0c08, 0x0, 0xc110c0e, 0xc1d0c1a, 0xc230c20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc350c320c2f0c2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc290c260c170c14, 0x0, 0xc3b0c3800000000, 0xc410c3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc490c470000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc5100000c4e, 0xc5700000c54, 0xc5d00000c5a, 0xc6300000c60, 0xc6900000c66, 0xc6f00000c6c, 0xc7500000c720000, 0xc780000, 0x0, 0xc8100000c7e0c7b, 0xc8a0c8700000c84, 0xc900c8d0000, 0xc960c93, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4b, 0x0, 0xc9900000000, 0x0, 0x0, 0x0, 0xca200000c9f, 0xca800000ca5, 0xcae00000cab, 0xcb400000cb1, 0xcba00000cb7, 0xcc000000cbd, 0xcc600000cc30000, 0xcc90000, 0x0, 0xcd200000ccf0ccc, 0xcdb0cd800000cd5, 0xce10cde0000, 0xce70ce4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcea000000000c9c, 0xcf30cf00ced, 0xcf600000000, 0x124b125d0fb71241, 0x13270e290d831043, 0xe4f12930e991327, 0x116710cd0f550e97, 0x1279121511fd11e3, 0x109d106910190feb, 0xd8d12f3128911c7, 0x11e110790ff50e1d, 0x11d910510edb1309, 0x120311890f65121d, 0x108d10250fbd0eff, 0xe050dd90d9d127d, 0x10d310770ff10f95, 0x125911e711dd1171, 0x10e9130712fb12cf, 0x12a111b9114d1107, 0xf0b0e87122f130b, 0x10ed1083117d112f, 0xecb0e8512cb1249, 0x11471047102f0fed, 0x117f0e0312b11159, 0x114f11150ddd0ddf, 0xf67123d12b511c5, 0xebb0d8712350feb, 0xe1110c110950f27, 0xd7f0f1b0da510f1, 0xe2311450f9d1011, 0x122711c910d70e7d, 0xf6f100d126d1005, 0xd9110bf0f7b11a5, 0x113d0fdb0ddb0dc3, 0xe091291122d1195, 0xfa10f070e9f0e37, 0x12f712ab10f31053, 0xfb50df91313130d, 0xf490ef312690ffd, 0x106d104b0f910f57, 0x11791153111110af, 0x12a3127111cd1261, 0x10670e410dfb0de9, 0xf230efd1227120b, 0x1091112d10030f77, 0xee50ebb0e670d97, 0x116b10a9109b0f29, 0x12d112c912951175, 0x128d110f0d9f12dd, 0xdb10d8f0f3512c1, 0xfeb0f9f0ec70ebd, 0x127711d310cb1073, 0xdf712af0fad1323, 0x103b10210fd10fcb, 0x114310e710bd10a1, 0x12b70f5d0dc512e3, 0x126310310ed70da9, 0x10950fd50f390f17, 0xecf0e310deb12bb, 0x10150fe10fc30fa7, 0x120d116310c3109f, 0xe1312c5128f1213, 0x10b110750e33103d, 0x130f12ff12bd11db, 0x1121118b102d0fcf, 0x1063108b11331125, 0xded11ad0d93123b, 0x11390f690ef50de7, 0x12670fb3101b0eb5, 0xf03122112b31205, 0xe590db5, 0xfab00000e7b, 0x10cf108f0de10000, 0x110d1105110310f5, 0x116d113512d3, 0x1233000011df, 0x128312730000, 0x12e912e700000000, 0x12bf127f130512eb, 0xe010db90db30da1, 0xe5f0e530e170e07, 0xecd0e7f0e790e63, 0xf470f430f2f0ed1, 0xfaf0fa30f970f53, 0x1049103510270fdd, 0x10eb10a3107d106f, 0x10fd10f910fb10f7, 0x110b1109110110ff, 0x11531127111d1117, 0x11731161115b1157, 0x11cb11971197118d, 0x1239123712231219, 0x1273126f124f124d, 0xf2b12e112d912c7, 0x119313be, 0xd9b0dc10dd70d81, 0xe0b0dff0dc90db7, 0xe5d0e510e490e53, 0xe9b0e950e830e7b, 0xf050f010eb10ea9, 0xf3f0f330f1d0f13, 0xf530f410f470f37, 0xf890f850f7f0f5f, 0xfbf0fbd0fab0f99, 0x102110050fff0fc7, 0x1057104910411045, 0x1089107f10e3106f, 0x10b910b510ab108f, 0x10d110cf10c910c7, 0x10ef10dd10df10d5, 0x114911311127111f, 0x11af1173115f1153, 0x121f121b11f911c3, 0x122b123312291223, 0x1239123112351237, 0x12751265124f123f, 0x12c712b91299128b, 0x12db12d912d512d3, 0x1394132712f912e1, 0xd370d2313a61392, 0x141c13ec13da0d39, 0x13251321, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xabb00000a7a0000, 0x0, 0x0, 0xab50ab200000000, 0xa590a560aae0aaa, 0xa680a650a5f0a5c, 0xa740a710a6b, 0xa830a800a7d0a77, 0xa8c00000a89, 0xa9500000a920a8f, 0xaa10a9e00000a98, 0xa6e0ab80aa70aa4, 0xa9b0a860a62, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x132900000000, 0x132c, 0x0, 0x0, 0x132f000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1335133200000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x133b133800000000, 0x134a13461342133e, 0x134e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1352000000000000, 0x135913601355135d, 0x1364, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13680d8b0d850d89, 0xda70da30da10d99, 0xdaf0db30dad0dab, 0xdbb0db913700cf9, 0xcfb136a0dc70dbd, 0xdd1136e0dcb0dbf, 0xdd70dd50d950dd3, 0xcff0de50de3142c, 0xdf50df30df10def, 0xe070e010dff0d01, 0xe110e0f0e0d0e0b, 0xe1b0e190e170e15, 0xe210e210e210e1f, 0xe270e25105d1376, 0xe2f0e2d0e2b1378, 0xe3b0e390e350e3d, 0xe470e450e430e3f, 0xe510e4d0e4d0e4b, 0xe690e5b0e570e55, 0xe650e610e6b0e5f, 0xe710e6f0e890de7, 0xe750e770e6d0e73, 0xe8d0e8b137a0e81, 0xe9d0e930e910e8f, 0xea50ea3137e137c, 0xd030eab0ea10ea7, 0xeb30eb30eaf0d05, 0xebb0eb90eb71380, 0xec30ec113820ebf, 0xec90d070ec50f0f, 0x13860ed30ed50ed1, 0xedd0edf13880ed9, 0xd090ee90ee70ee1, 0xef10eef0eed0eeb, 0xef70d0d138a0d0b, 0x14400eff0efb0ef9, 0x118f138e138e0f09, 0x139c0d0f0f0d0f0d, 0xd110f150f1113f0, 0xf250f210f1f0f19, 0xf2f0d130d150f2d, 0xf3d0f3b0f311390, 0xf470f450f3d0f3f, 0xf510f4d0f4b0f4f, 0xf5b0f590f550f53, 0xf730f6b0f630f61, 0xf750f6d0f711396, 0xf8713980f830f79, 0xf8b0d170f7d0f81, 0xd190f8d0f930f8f, 0xfa5139a0f9b0f97, 0xfaf0d1f0fa90fb9, 0xdcf0dcd0d1b0d1d, 0xd5111810fb10fbb, 0xfc90fc10fbf0fbd, 0xfd30d2113a40fc5, 0x13a80fdd0fd90fcd, 0xd230fe30fd70fdf, 0xfef0fe90fe70fe5, 0xff70d250ff313aa, 0xffb0d270ff913ac, 0x13ae100710051001, 0x13b2100913b01384, 0x1017100b1013100f, 0x102310211027101f, 0x101d13b4102b1029, 0x10410d2910391037, 0x104d103313b6103f, 0x1059104f13ba13b8, 0x105b0d2b10551057, 0x136c1065105f1061, 0x13c0107113bc106b, 0x13c21081107f107b, 0x13c613c410871085, 0x10990d2d10971093, 0x10a710a50d2f0d2f, 0xd3110b310ad10ab, 0x13ca10bb13c810b7, 0x13cc10c5138c10c1, 0xd350d3313d013ce, 0x13d613d213d410d5, 0x10db10db10d913d8, 0xd3b10e10d3910df, 0x10e910e513dc0d3d, 0x10ff13de0d3f10ef, 0x1113110d13e213e0, 0x111b111911170d41, 0x112313e613e613e4, 0x112b112913e80d43, 0xd47113713ea0d45, 0x13ee1141113b113f, 0x115511510d49114b, 0x13f413f20d4b115d, 0x13f8116513f60d4d, 0x13fa1173116f1169, 0x117b13fe117713fc, 0x118511830d4f139e, 0x14000ead11870d53, 0x118f13a213a01402, 0x119b0d55126b1191, 0x119f0dfd119d1199, 0x140411a711a311a1, 0x11b511b311a911a5, 0x11cb11c111b711ab, 0x11bf11bd11bb11b1, 0xd571408140a1406, 0x141211d511d111cf, 0xd5b0d59140c11d7, 0x11e50d5d1410140e, 0x11ef11eb11e911e7, 0x11f911f111f311ed, 0xd5f11fb11f711f5, 0x12070d61120111ff, 0x1211120f14141209, 0x14160cfd12170d63, 0x12250d670d651418, 0x141a1243123f1231, 0x1253125112471245, 0x125512571372141e, 0x1265125f1374125b, 0x1281127b14221420, 0x1297128714241285, 0x12a5129b129f129d, 0xd6912a9142612a7, 0x12c30d6b142812ad, 0x142e142a12cd0ee3, 0x143012d70d6f0d6d, 0x12db12db14320d71, 0xd7312e5143412df, 0x12f512f112ef12ed, 0x12fd12f914360d75, 0x13030d790d771301, 0x143c143a0d7b1438, 0x13150d7d1311143e, 0x131d131b13191317, 0x1442131f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+@property -+{ -+private alias _IDCA = immutable(dchar[]); -+_IDCA decompCanonTable() { static _IDCA t = [ 0x0, 0x3b, 0x0, 0x3c, 0x338, 0x0, 0x3d, 0x338, 0x0, 0x3e, 0x338, 0x0, 0x41, 0x300, 0x0, 0x41, 0x301, 0x0, 0x41, 0x302, 0x0, 0x41, 0x302, 0x300, 0x0, 0x41, 0x302, 0x301, 0x0, 0x41, 0x302, 0x303, 0x0, 0x41, 0x302, 0x309, 0x0, 0x41, 0x303, 0x0, 0x41, 0x304, 0x0, 0x41, 0x306, 0x0, 0x41, 0x306, 0x300, 0x0, 0x41, 0x306, 0x301, 0x0, 0x41, 0x306, 0x303, 0x0, 0x41, 0x306, 0x309, 0x0, 0x41, 0x307, 0x0, 0x41, 0x307, 0x304, 0x0, 0x41, 0x308, 0x0, 0x41, 0x308, 0x304, 0x0, 0x41, 0x309, 0x0, 0x41, 0x30a, 0x0, 0x41, 0x30a, 0x301, 0x0, 0x41, 0x30c, 0x0, 0x41, 0x30f, 0x0, 0x41, 0x311, 0x0, 0x41, 0x323, 0x0, 0x41, 0x323, 0x302, 0x0, 0x41, 0x323, 0x306, 0x0, 0x41, 0x325, 0x0, 0x41, 0x328, 0x0, 0x42, 0x307, 0x0, 0x42, 0x323, 0x0, 0x42, 0x331, 0x0, 0x43, 0x301, 0x0, 0x43, 0x302, 0x0, 0x43, 0x307, 0x0, 0x43, 0x30c, 0x0, 0x43, 0x327, 0x0, 0x43, 0x327, 0x301, 0x0, 0x44, 0x307, 0x0, 0x44, 0x30c, 0x0, 0x44, 0x323, 0x0, 0x44, 0x327, 0x0, 0x44, 0x32d, 0x0, 0x44, 0x331, 0x0, 0x45, 0x300, 0x0, 0x45, 0x301, 0x0, 0x45, 0x302, 0x0, 0x45, 0x302, 0x300, 0x0, 0x45, 0x302, 0x301, 0x0, 0x45, 0x302, 0x303, 0x0, 0x45, 0x302, 0x309, 0x0, 0x45, 0x303, 0x0, 0x45, 0x304, 0x0, 0x45, 0x304, 0x300, 0x0, 0x45, 0x304, 0x301, 0x0, 0x45, 0x306, 0x0, 0x45, 0x307, 0x0, 0x45, 0x308, 0x0, 0x45, 0x309, 0x0, 0x45, 0x30c, 0x0, 0x45, 0x30f, 0x0, 0x45, 0x311, 0x0, 0x45, 0x323, 0x0, 0x45, 0x323, 0x302, 0x0, 0x45, 0x327, 0x0, 0x45, 0x327, 0x306, 0x0, 0x45, 0x328, 0x0, 0x45, 0x32d, 0x0, 0x45, 0x330, 0x0, 0x46, 0x307, 0x0, 0x47, 0x301, 0x0, 0x47, 0x302, 0x0, 0x47, 0x304, 0x0, 0x47, 0x306, 0x0, 0x47, 0x307, 0x0, 0x47, 0x30c, 0x0, 0x47, 0x327, 0x0, 0x48, 0x302, 0x0, 0x48, 0x307, 0x0, 0x48, 0x308, 0x0, 0x48, 0x30c, 0x0, 0x48, 0x323, 0x0, 0x48, 0x327, 0x0, 0x48, 0x32e, 0x0, 0x49, 0x300, 0x0, 0x49, 0x301, 0x0, 0x49, 0x302, 0x0, 0x49, 0x303, 0x0, 0x49, 0x304, 0x0, 0x49, 0x306, 0x0, 0x49, 0x307, 0x0, 0x49, 0x308, 0x0, 0x49, 0x308, 0x301, 0x0, 0x49, 0x309, 0x0, 0x49, 0x30c, 0x0, 0x49, 0x30f, 0x0, 0x49, 0x311, 0x0, 0x49, 0x323, 0x0, 0x49, 0x328, 0x0, 0x49, 0x330, 0x0, 0x4a, 0x302, 0x0, 0x4b, 0x0, 0x4b, 0x301, 0x0, 0x4b, 0x30c, 0x0, 0x4b, 0x323, 0x0, 0x4b, 0x327, 0x0, 0x4b, 0x331, 0x0, 0x4c, 0x301, 0x0, 0x4c, 0x30c, 0x0, 0x4c, 0x323, 0x0, 0x4c, 0x323, 0x304, 0x0, 0x4c, 0x327, 0x0, 0x4c, 0x32d, 0x0, 0x4c, 0x331, 0x0, 0x4d, 0x301, 0x0, 0x4d, 0x307, 0x0, 0x4d, 0x323, 0x0, 0x4e, 0x300, 0x0, 0x4e, 0x301, 0x0, 0x4e, 0x303, 0x0, 0x4e, 0x307, 0x0, 0x4e, 0x30c, 0x0, 0x4e, 0x323, 0x0, 0x4e, 0x327, 0x0, 0x4e, 0x32d, 0x0, 0x4e, 0x331, 0x0, 0x4f, 0x300, 0x0, 0x4f, 0x301, 0x0, 0x4f, 0x302, 0x0, 0x4f, 0x302, 0x300, 0x0, 0x4f, 0x302, 0x301, 0x0, 0x4f, 0x302, 0x303, 0x0, 0x4f, 0x302, 0x309, 0x0, 0x4f, 0x303, 0x0, 0x4f, 0x303, 0x301, 0x0, 0x4f, 0x303, 0x304, 0x0, 0x4f, 0x303, 0x308, 0x0, 0x4f, 0x304, 0x0, 0x4f, 0x304, 0x300, 0x0, 0x4f, 0x304, 0x301, 0x0, 0x4f, 0x306, 0x0, 0x4f, 0x307, 0x0, 0x4f, 0x307, 0x304, 0x0, 0x4f, 0x308, 0x0, 0x4f, 0x308, 0x304, 0x0, 0x4f, 0x309, 0x0, 0x4f, 0x30b, 0x0, 0x4f, 0x30c, 0x0, 0x4f, 0x30f, 0x0, 0x4f, 0x311, 0x0, 0x4f, 0x31b, 0x0, 0x4f, 0x31b, 0x300, 0x0, 0x4f, 0x31b, 0x301, 0x0, 0x4f, 0x31b, 0x303, 0x0, 0x4f, 0x31b, 0x309, 0x0, 0x4f, 0x31b, 0x323, 0x0, 0x4f, 0x323, 0x0, 0x4f, 0x323, 0x302, 0x0, 0x4f, 0x328, 0x0, 0x4f, 0x328, 0x304, 0x0, 0x50, 0x301, 0x0, 0x50, 0x307, 0x0, 0x52, 0x301, 0x0, 0x52, 0x307, 0x0, 0x52, 0x30c, 0x0, 0x52, 0x30f, 0x0, 0x52, 0x311, 0x0, 0x52, 0x323, 0x0, 0x52, 0x323, 0x304, 0x0, 0x52, 0x327, 0x0, 0x52, 0x331, 0x0, 0x53, 0x301, 0x0, 0x53, 0x301, 0x307, 0x0, 0x53, 0x302, 0x0, 0x53, 0x307, 0x0, 0x53, 0x30c, 0x0, 0x53, 0x30c, 0x307, 0x0, 0x53, 0x323, 0x0, 0x53, 0x323, 0x307, 0x0, 0x53, 0x326, 0x0, 0x53, 0x327, 0x0, 0x54, 0x307, 0x0, 0x54, 0x30c, 0x0, 0x54, 0x323, 0x0, 0x54, 0x326, 0x0, 0x54, 0x327, 0x0, 0x54, 0x32d, 0x0, 0x54, 0x331, 0x0, 0x55, 0x300, 0x0, 0x55, 0x301, 0x0, 0x55, 0x302, 0x0, 0x55, 0x303, 0x0, 0x55, 0x303, 0x301, 0x0, 0x55, 0x304, 0x0, 0x55, 0x304, 0x308, 0x0, 0x55, 0x306, 0x0, 0x55, 0x308, 0x0, 0x55, 0x308, 0x300, 0x0, 0x55, 0x308, 0x301, 0x0, 0x55, 0x308, 0x304, 0x0, 0x55, 0x308, 0x30c, 0x0, 0x55, 0x309, 0x0, 0x55, 0x30a, 0x0, 0x55, 0x30b, 0x0, 0x55, 0x30c, 0x0, 0x55, 0x30f, 0x0, 0x55, 0x311, 0x0, 0x55, 0x31b, 0x0, 0x55, 0x31b, 0x300, 0x0, 0x55, 0x31b, 0x301, 0x0, 0x55, 0x31b, 0x303, 0x0, 0x55, 0x31b, 0x309, 0x0, 0x55, 0x31b, 0x323, 0x0, 0x55, 0x323, 0x0, 0x55, 0x324, 0x0, 0x55, 0x328, 0x0, 0x55, 0x32d, 0x0, 0x55, 0x330, 0x0, 0x56, 0x303, 0x0, 0x56, 0x323, 0x0, 0x57, 0x300, 0x0, 0x57, 0x301, 0x0, 0x57, 0x302, 0x0, 0x57, 0x307, 0x0, 0x57, 0x308, 0x0, 0x57, 0x323, 0x0, 0x58, 0x307, 0x0, 0x58, 0x308, 0x0, 0x59, 0x300, 0x0, 0x59, 0x301, 0x0, 0x59, 0x302, 0x0, 0x59, 0x303, 0x0, 0x59, 0x304, 0x0, 0x59, 0x307, 0x0, 0x59, 0x308, 0x0, 0x59, 0x309, 0x0, 0x59, 0x323, 0x0, 0x5a, 0x301, 0x0, 0x5a, 0x302, 0x0, 0x5a, 0x307, 0x0, 0x5a, 0x30c, 0x0, 0x5a, 0x323, 0x0, 0x5a, 0x331, 0x0, 0x60, 0x0, 0x61, 0x300, 0x0, 0x61, 0x301, 0x0, 0x61, 0x302, 0x0, 0x61, 0x302, 0x300, 0x0, 0x61, 0x302, 0x301, 0x0, 0x61, 0x302, 0x303, 0x0, 0x61, 0x302, 0x309, 0x0, 0x61, 0x303, 0x0, 0x61, 0x304, 0x0, 0x61, 0x306, 0x0, 0x61, 0x306, 0x300, 0x0, 0x61, 0x306, 0x301, 0x0, 0x61, 0x306, 0x303, 0x0, 0x61, 0x306, 0x309, 0x0, 0x61, 0x307, 0x0, 0x61, 0x307, 0x304, 0x0, 0x61, 0x308, 0x0, 0x61, 0x308, 0x304, 0x0, 0x61, 0x309, 0x0, 0x61, 0x30a, 0x0, 0x61, 0x30a, 0x301, 0x0, 0x61, 0x30c, 0x0, 0x61, 0x30f, 0x0, 0x61, 0x311, 0x0, 0x61, 0x323, 0x0, 0x61, 0x323, 0x302, 0x0, 0x61, 0x323, 0x306, 0x0, 0x61, 0x325, 0x0, 0x61, 0x328, 0x0, 0x62, 0x307, 0x0, 0x62, 0x323, 0x0, 0x62, 0x331, 0x0, 0x63, 0x301, 0x0, 0x63, 0x302, 0x0, 0x63, 0x307, 0x0, 0x63, 0x30c, 0x0, 0x63, 0x327, 0x0, 0x63, 0x327, 0x301, 0x0, 0x64, 0x307, 0x0, 0x64, 0x30c, 0x0, 0x64, 0x323, 0x0, 0x64, 0x327, 0x0, 0x64, 0x32d, 0x0, 0x64, 0x331, 0x0, 0x65, 0x300, 0x0, 0x65, 0x301, 0x0, 0x65, 0x302, 0x0, 0x65, 0x302, 0x300, 0x0, 0x65, 0x302, 0x301, 0x0, 0x65, 0x302, 0x303, 0x0, 0x65, 0x302, 0x309, 0x0, 0x65, 0x303, 0x0, 0x65, 0x304, 0x0, 0x65, 0x304, 0x300, 0x0, 0x65, 0x304, 0x301, 0x0, 0x65, 0x306, 0x0, 0x65, 0x307, 0x0, 0x65, 0x308, 0x0, 0x65, 0x309, 0x0, 0x65, 0x30c, 0x0, 0x65, 0x30f, 0x0, 0x65, 0x311, 0x0, 0x65, 0x323, 0x0, 0x65, 0x323, 0x302, 0x0, 0x65, 0x327, 0x0, 0x65, 0x327, 0x306, 0x0, 0x65, 0x328, 0x0, 0x65, 0x32d, 0x0, 0x65, 0x330, 0x0, 0x66, 0x307, 0x0, 0x67, 0x301, 0x0, 0x67, 0x302, 0x0, 0x67, 0x304, 0x0, 0x67, 0x306, 0x0, 0x67, 0x307, 0x0, 0x67, 0x30c, 0x0, 0x67, 0x327, 0x0, 0x68, 0x302, 0x0, 0x68, 0x307, 0x0, 0x68, 0x308, 0x0, 0x68, 0x30c, 0x0, 0x68, 0x323, 0x0, 0x68, 0x327, 0x0, 0x68, 0x32e, 0x0, 0x68, 0x331, 0x0, 0x69, 0x300, 0x0, 0x69, 0x301, 0x0, 0x69, 0x302, 0x0, 0x69, 0x303, 0x0, 0x69, 0x304, 0x0, 0x69, 0x306, 0x0, 0x69, 0x308, 0x0, 0x69, 0x308, 0x301, 0x0, 0x69, 0x309, 0x0, 0x69, 0x30c, 0x0, 0x69, 0x30f, 0x0, 0x69, 0x311, 0x0, 0x69, 0x323, 0x0, 0x69, 0x328, 0x0, 0x69, 0x330, 0x0, 0x6a, 0x302, 0x0, 0x6a, 0x30c, 0x0, 0x6b, 0x301, 0x0, 0x6b, 0x30c, 0x0, 0x6b, 0x323, 0x0, 0x6b, 0x327, 0x0, 0x6b, 0x331, 0x0, 0x6c, 0x301, 0x0, 0x6c, 0x30c, 0x0, 0x6c, 0x323, 0x0, 0x6c, 0x323, 0x304, 0x0, 0x6c, 0x327, 0x0, 0x6c, 0x32d, 0x0, 0x6c, 0x331, 0x0, 0x6d, 0x301, 0x0, 0x6d, 0x307, 0x0, 0x6d, 0x323, 0x0, 0x6e, 0x300, 0x0, 0x6e, 0x301, 0x0, 0x6e, 0x303, 0x0, 0x6e, 0x307, 0x0, 0x6e, 0x30c, 0x0, 0x6e, 0x323, 0x0, 0x6e, 0x327, 0x0, 0x6e, 0x32d, 0x0, 0x6e, 0x331, 0x0, 0x6f, 0x300, 0x0, 0x6f, 0x301, 0x0, 0x6f, 0x302, 0x0, 0x6f, 0x302, 0x300, 0x0, 0x6f, 0x302, 0x301, 0x0, 0x6f, 0x302, 0x303, 0x0, 0x6f, 0x302, 0x309, 0x0, 0x6f, 0x303, 0x0, 0x6f, 0x303, 0x301, 0x0, 0x6f, 0x303, 0x304, 0x0, 0x6f, 0x303, 0x308, 0x0, 0x6f, 0x304, 0x0, 0x6f, 0x304, 0x300, 0x0, 0x6f, 0x304, 0x301, 0x0, 0x6f, 0x306, 0x0, 0x6f, 0x307, 0x0, 0x6f, 0x307, 0x304, 0x0, 0x6f, 0x308, 0x0, 0x6f, 0x308, 0x304, 0x0, 0x6f, 0x309, 0x0, 0x6f, 0x30b, 0x0, 0x6f, 0x30c, 0x0, 0x6f, 0x30f, 0x0, 0x6f, 0x311, 0x0, 0x6f, 0x31b, 0x0, 0x6f, 0x31b, 0x300, 0x0, 0x6f, 0x31b, 0x301, 0x0, 0x6f, 0x31b, 0x303, 0x0, 0x6f, 0x31b, 0x309, 0x0, 0x6f, 0x31b, 0x323, 0x0, 0x6f, 0x323, 0x0, 0x6f, 0x323, 0x302, 0x0, 0x6f, 0x328, 0x0, 0x6f, 0x328, 0x304, 0x0, 0x70, 0x301, 0x0, 0x70, 0x307, 0x0, 0x72, 0x301, 0x0, 0x72, 0x307, 0x0, 0x72, 0x30c, 0x0, 0x72, 0x30f, 0x0, 0x72, 0x311, 0x0, 0x72, 0x323, 0x0, 0x72, 0x323, 0x304, 0x0, 0x72, 0x327, 0x0, 0x72, 0x331, 0x0, 0x73, 0x301, 0x0, 0x73, 0x301, 0x307, 0x0, 0x73, 0x302, 0x0, 0x73, 0x307, 0x0, 0x73, 0x30c, 0x0, 0x73, 0x30c, 0x307, 0x0, 0x73, 0x323, 0x0, 0x73, 0x323, 0x307, 0x0, 0x73, 0x326, 0x0, 0x73, 0x327, 0x0, 0x74, 0x307, 0x0, 0x74, 0x308, 0x0, 0x74, 0x30c, 0x0, 0x74, 0x323, 0x0, 0x74, 0x326, 0x0, 0x74, 0x327, 0x0, 0x74, 0x32d, 0x0, 0x74, 0x331, 0x0, 0x75, 0x300, 0x0, 0x75, 0x301, 0x0, 0x75, 0x302, 0x0, 0x75, 0x303, 0x0, 0x75, 0x303, 0x301, 0x0, 0x75, 0x304, 0x0, 0x75, 0x304, 0x308, 0x0, 0x75, 0x306, 0x0, 0x75, 0x308, 0x0, 0x75, 0x308, 0x300, 0x0, 0x75, 0x308, 0x301, 0x0, 0x75, 0x308, 0x304, 0x0, 0x75, 0x308, 0x30c, 0x0, 0x75, 0x309, 0x0, 0x75, 0x30a, 0x0, 0x75, 0x30b, 0x0, 0x75, 0x30c, 0x0, 0x75, 0x30f, 0x0, 0x75, 0x311, 0x0, 0x75, 0x31b, 0x0, 0x75, 0x31b, 0x300, 0x0, 0x75, 0x31b, 0x301, 0x0, 0x75, 0x31b, 0x303, 0x0, 0x75, 0x31b, 0x309, 0x0, 0x75, 0x31b, 0x323, 0x0, 0x75, 0x323, 0x0, 0x75, 0x324, 0x0, 0x75, 0x328, 0x0, 0x75, 0x32d, 0x0, 0x75, 0x330, 0x0, 0x76, 0x303, 0x0, 0x76, 0x323, 0x0, 0x77, 0x300, 0x0, 0x77, 0x301, 0x0, 0x77, 0x302, 0x0, 0x77, 0x307, 0x0, 0x77, 0x308, 0x0, 0x77, 0x30a, 0x0, 0x77, 0x323, 0x0, 0x78, 0x307, 0x0, 0x78, 0x308, 0x0, 0x79, 0x300, 0x0, 0x79, 0x301, 0x0, 0x79, 0x302, 0x0, 0x79, 0x303, 0x0, 0x79, 0x304, 0x0, 0x79, 0x307, 0x0, 0x79, 0x308, 0x0, 0x79, 0x309, 0x0, 0x79, 0x30a, 0x0, 0x79, 0x323, 0x0, 0x7a, 0x301, 0x0, 0x7a, 0x302, 0x0, 0x7a, 0x307, 0x0, 0x7a, 0x30c, 0x0, 0x7a, 0x323, 0x0, 0x7a, 0x331, 0x0, 0xa8, 0x300, 0x0, 0xa8, 0x301, 0x0, 0xa8, 0x342, 0x0, 0xb4, 0x0, 0xb7, 0x0, 0xc6, 0x301, 0x0, 0xc6, 0x304, 0x0, 0xd8, 0x301, 0x0, 0xe6, 0x301, 0x0, 0xe6, 0x304, 0x0, 0xf8, 0x301, 0x0, 0x17f, 0x307, 0x0, 0x1b7, 0x30c, 0x0, 0x292, 0x30c, 0x0, 0x2b9, 0x0, 0x300, 0x0, 0x301, 0x0, 0x308, 0x301, 0x0, 0x313, 0x0, 0x391, 0x300, 0x0, 0x391, 0x301, 0x0, 0x391, 0x304, 0x0, 0x391, 0x306, 0x0, 0x391, 0x313, 0x0, 0x391, 0x313, 0x300, 0x0, 0x391, 0x313, 0x300, 0x345, 0x0, 0x391, 0x313, 0x301, 0x0, 0x391, 0x313, 0x301, 0x345, 0x0, 0x391, 0x313, 0x342, 0x0, 0x391, 0x313, 0x342, 0x345, 0x0, 0x391, 0x313, 0x345, 0x0, 0x391, 0x314, 0x0, 0x391, 0x314, 0x300, 0x0, 0x391, 0x314, 0x300, 0x345, 0x0, 0x391, 0x314, 0x301, 0x0, 0x391, 0x314, 0x301, 0x345, 0x0, 0x391, 0x314, 0x342, 0x0, 0x391, 0x314, 0x342, 0x345, 0x0, 0x391, 0x314, 0x345, 0x0, 0x391, 0x345, 0x0, 0x395, 0x300, 0x0, 0x395, 0x301, 0x0, 0x395, 0x313, 0x0, 0x395, 0x313, 0x300, 0x0, 0x395, 0x313, 0x301, 0x0, 0x395, 0x314, 0x0, 0x395, 0x314, 0x300, 0x0, 0x395, 0x314, 0x301, 0x0, 0x397, 0x300, 0x0, 0x397, 0x301, 0x0, 0x397, 0x313, 0x0, 0x397, 0x313, 0x300, 0x0, 0x397, 0x313, 0x300, 0x345, 0x0, 0x397, 0x313, 0x301, 0x0, 0x397, 0x313, 0x301, 0x345, 0x0, 0x397, 0x313, 0x342, 0x0, 0x397, 0x313, 0x342, 0x345, 0x0, 0x397, 0x313, 0x345, 0x0, 0x397, 0x314, 0x0, 0x397, 0x314, 0x300, 0x0, 0x397, 0x314, 0x300, 0x345, 0x0, 0x397, 0x314, 0x301, 0x0, 0x397, 0x314, 0x301, 0x345, 0x0, 0x397, 0x314, 0x342, 0x0, 0x397, 0x314, 0x342, 0x345, 0x0, 0x397, 0x314, 0x345, 0x0, 0x397, 0x345, 0x0, 0x399, 0x300, 0x0, 0x399, 0x301, 0x0, 0x399, 0x304, 0x0, 0x399, 0x306, 0x0, 0x399, 0x308, 0x0, 0x399, 0x313, 0x0, 0x399, 0x313, 0x300, 0x0, 0x399, 0x313, 0x301, 0x0, 0x399, 0x313, 0x342, 0x0, 0x399, 0x314, 0x0, 0x399, 0x314, 0x300, 0x0, 0x399, 0x314, 0x301, 0x0, 0x399, 0x314, 0x342, 0x0, 0x39f, 0x300, 0x0, 0x39f, 0x301, 0x0, 0x39f, 0x313, 0x0, 0x39f, 0x313, 0x300, 0x0, 0x39f, 0x313, 0x301, 0x0, 0x39f, 0x314, 0x0, 0x39f, 0x314, 0x300, 0x0, 0x39f, 0x314, 0x301, 0x0, 0x3a1, 0x314, 0x0, 0x3a5, 0x300, 0x0, 0x3a5, 0x301, 0x0, 0x3a5, 0x304, 0x0, 0x3a5, 0x306, 0x0, 0x3a5, 0x308, 0x0, 0x3a5, 0x314, 0x0, 0x3a5, 0x314, 0x300, 0x0, 0x3a5, 0x314, 0x301, 0x0, 0x3a5, 0x314, 0x342, 0x0, 0x3a9, 0x0, 0x3a9, 0x300, 0x0, 0x3a9, 0x301, 0x0, 0x3a9, 0x313, 0x0, 0x3a9, 0x313, 0x300, 0x0, 0x3a9, 0x313, 0x300, 0x345, 0x0, 0x3a9, 0x313, 0x301, 0x0, 0x3a9, 0x313, 0x301, 0x345, 0x0, 0x3a9, 0x313, 0x342, 0x0, 0x3a9, 0x313, 0x342, 0x345, 0x0, 0x3a9, 0x313, 0x345, 0x0, 0x3a9, 0x314, 0x0, 0x3a9, 0x314, 0x300, 0x0, 0x3a9, 0x314, 0x300, 0x345, 0x0, 0x3a9, 0x314, 0x301, 0x0, 0x3a9, 0x314, 0x301, 0x345, 0x0, 0x3a9, 0x314, 0x342, 0x0, 0x3a9, 0x314, 0x342, 0x345, 0x0, 0x3a9, 0x314, 0x345, 0x0, 0x3a9, 0x345, 0x0, 0x3b1, 0x300, 0x0, 0x3b1, 0x300, 0x345, 0x0, 0x3b1, 0x301, 0x0, 0x3b1, 0x301, 0x345, 0x0, 0x3b1, 0x304, 0x0, 0x3b1, 0x306, 0x0, 0x3b1, 0x313, 0x0, 0x3b1, 0x313, 0x300, 0x0, 0x3b1, 0x313, 0x300, 0x345, 0x0, 0x3b1, 0x313, 0x301, 0x0, 0x3b1, 0x313, 0x301, 0x345, 0x0, 0x3b1, 0x313, 0x342, 0x0, 0x3b1, 0x313, 0x342, 0x345, 0x0, 0x3b1, 0x313, 0x345, 0x0, 0x3b1, 0x314, 0x0, 0x3b1, 0x314, 0x300, 0x0, 0x3b1, 0x314, 0x300, 0x345, 0x0, 0x3b1, 0x314, 0x301, 0x0, 0x3b1, 0x314, 0x301, 0x345, 0x0, 0x3b1, 0x314, 0x342, 0x0, 0x3b1, 0x314, 0x342, 0x345, 0x0, 0x3b1, 0x314, 0x345, 0x0, 0x3b1, 0x342, 0x0, 0x3b1, 0x342, 0x345, 0x0, 0x3b1, 0x345, 0x0, 0x3b5, 0x300, 0x0, 0x3b5, 0x301, 0x0, 0x3b5, 0x313, 0x0, 0x3b5, 0x313, 0x300, 0x0, 0x3b5, 0x313, 0x301, 0x0, 0x3b5, 0x314, 0x0, 0x3b5, 0x314, 0x300, 0x0, 0x3b5, 0x314, 0x301, 0x0, 0x3b7, 0x300, 0x0, 0x3b7, 0x300, 0x345, 0x0, 0x3b7, 0x301, 0x0, 0x3b7, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x0, 0x3b7, 0x313, 0x300, 0x0, 0x3b7, 0x313, 0x300, 0x345, 0x0, 0x3b7, 0x313, 0x301, 0x0, 0x3b7, 0x313, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x342, 0x0, 0x3b7, 0x313, 0x342, 0x345, 0x0, 0x3b7, 0x313, 0x345, 0x0, 0x3b7, 0x314, 0x0, 0x3b7, 0x314, 0x300, 0x0, 0x3b7, 0x314, 0x300, 0x345, 0x0, 0x3b7, 0x314, 0x301, 0x0, 0x3b7, 0x314, 0x301, 0x345, 0x0, 0x3b7, 0x314, 0x342, 0x0, 0x3b7, 0x314, 0x342, 0x345, 0x0, 0x3b7, 0x314, 0x345, 0x0, 0x3b7, 0x342, 0x0, 0x3b7, 0x342, 0x345, 0x0, 0x3b7, 0x345, 0x0, 0x3b9, 0x0, 0x3b9, 0x300, 0x0, 0x3b9, 0x301, 0x0, 0x3b9, 0x304, 0x0, 0x3b9, 0x306, 0x0, 0x3b9, 0x308, 0x0, 0x3b9, 0x308, 0x300, 0x0, 0x3b9, 0x308, 0x301, 0x0, 0x3b9, 0x308, 0x342, 0x0, 0x3b9, 0x313, 0x0, 0x3b9, 0x313, 0x300, 0x0, 0x3b9, 0x313, 0x301, 0x0, 0x3b9, 0x313, 0x342, 0x0, 0x3b9, 0x314, 0x0, 0x3b9, 0x314, 0x300, 0x0, 0x3b9, 0x314, 0x301, 0x0, 0x3b9, 0x314, 0x342, 0x0, 0x3b9, 0x342, 0x0, 0x3bf, 0x300, 0x0, 0x3bf, 0x301, 0x0, 0x3bf, 0x313, 0x0, 0x3bf, 0x313, 0x300, 0x0, 0x3bf, 0x313, 0x301, 0x0, 0x3bf, 0x314, 0x0, 0x3bf, 0x314, 0x300, 0x0, 0x3bf, 0x314, 0x301, 0x0, 0x3c1, 0x313, 0x0, 0x3c1, 0x314, 0x0, 0x3c5, 0x300, 0x0, 0x3c5, 0x301, 0x0, 0x3c5, 0x304, 0x0, 0x3c5, 0x306, 0x0, 0x3c5, 0x308, 0x0, 0x3c5, 0x308, 0x300, 0x0, 0x3c5, 0x308, 0x301, 0x0, 0x3c5, 0x308, 0x342, 0x0, 0x3c5, 0x313, 0x0, 0x3c5, 0x313, 0x300, 0x0, 0x3c5, 0x313, 0x301, 0x0, 0x3c5, 0x313, 0x342, 0x0, 0x3c5, 0x314, 0x0, 0x3c5, 0x314, 0x300, 0x0, 0x3c5, 0x314, 0x301, 0x0, 0x3c5, 0x314, 0x342, 0x0, 0x3c5, 0x342, 0x0, 0x3c9, 0x300, 0x0, 0x3c9, 0x300, 0x345, 0x0, 0x3c9, 0x301, 0x0, 0x3c9, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x0, 0x3c9, 0x313, 0x300, 0x0, 0x3c9, 0x313, 0x300, 0x345, 0x0, 0x3c9, 0x313, 0x301, 0x0, 0x3c9, 0x313, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x342, 0x0, 0x3c9, 0x313, 0x342, 0x345, 0x0, 0x3c9, 0x313, 0x345, 0x0, 0x3c9, 0x314, 0x0, 0x3c9, 0x314, 0x300, 0x0, 0x3c9, 0x314, 0x300, 0x345, 0x0, 0x3c9, 0x314, 0x301, 0x0, 0x3c9, 0x314, 0x301, 0x345, 0x0, 0x3c9, 0x314, 0x342, 0x0, 0x3c9, 0x314, 0x342, 0x345, 0x0, 0x3c9, 0x314, 0x345, 0x0, 0x3c9, 0x342, 0x0, 0x3c9, 0x342, 0x345, 0x0, 0x3c9, 0x345, 0x0, 0x3d2, 0x301, 0x0, 0x3d2, 0x308, 0x0, 0x406, 0x308, 0x0, 0x410, 0x306, 0x0, 0x410, 0x308, 0x0, 0x413, 0x301, 0x0, 0x415, 0x300, 0x0, 0x415, 0x306, 0x0, 0x415, 0x308, 0x0, 0x416, 0x306, 0x0, 0x416, 0x308, 0x0, 0x417, 0x308, 0x0, 0x418, 0x300, 0x0, 0x418, 0x304, 0x0, 0x418, 0x306, 0x0, 0x418, 0x308, 0x0, 0x41a, 0x301, 0x0, 0x41e, 0x308, 0x0, 0x423, 0x304, 0x0, 0x423, 0x306, 0x0, 0x423, 0x308, 0x0, 0x423, 0x30b, 0x0, 0x427, 0x308, 0x0, 0x42b, 0x308, 0x0, 0x42d, 0x308, 0x0, 0x430, 0x306, 0x0, 0x430, 0x308, 0x0, 0x433, 0x301, 0x0, 0x435, 0x300, 0x0, 0x435, 0x306, 0x0, 0x435, 0x308, 0x0, 0x436, 0x306, 0x0, 0x436, 0x308, 0x0, 0x437, 0x308, 0x0, 0x438, 0x300, 0x0, 0x438, 0x304, 0x0, 0x438, 0x306, 0x0, 0x438, 0x308, 0x0, 0x43a, 0x301, 0x0, 0x43e, 0x308, 0x0, 0x443, 0x304, 0x0, 0x443, 0x306, 0x0, 0x443, 0x308, 0x0, 0x443, 0x30b, 0x0, 0x447, 0x308, 0x0, 0x44b, 0x308, 0x0, 0x44d, 0x308, 0x0, 0x456, 0x308, 0x0, 0x474, 0x30f, 0x0, 0x475, 0x30f, 0x0, 0x4d8, 0x308, 0x0, 0x4d9, 0x308, 0x0, 0x4e8, 0x308, 0x0, 0x4e9, 0x308, 0x0, 0x5d0, 0x5b7, 0x0, 0x5d0, 0x5b8, 0x0, 0x5d0, 0x5bc, 0x0, 0x5d1, 0x5bc, 0x0, 0x5d1, 0x5bf, 0x0, 0x5d2, 0x5bc, 0x0, 0x5d3, 0x5bc, 0x0, 0x5d4, 0x5bc, 0x0, 0x5d5, 0x5b9, 0x0, 0x5d5, 0x5bc, 0x0, 0x5d6, 0x5bc, 0x0, 0x5d8, 0x5bc, 0x0, 0x5d9, 0x5b4, 0x0, 0x5d9, 0x5bc, 0x0, 0x5da, 0x5bc, 0x0, 0x5db, 0x5bc, 0x0, 0x5db, 0x5bf, 0x0, 0x5dc, 0x5bc, 0x0, 0x5de, 0x5bc, 0x0, 0x5e0, 0x5bc, 0x0, 0x5e1, 0x5bc, 0x0, 0x5e3, 0x5bc, 0x0, 0x5e4, 0x5bc, 0x0, 0x5e4, 0x5bf, 0x0, 0x5e6, 0x5bc, 0x0, 0x5e7, 0x5bc, 0x0, 0x5e8, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x5c1, 0x0, 0x5e9, 0x5bc, 0x5c2, 0x0, 0x5e9, 0x5c1, 0x0, 0x5e9, 0x5c2, 0x0, 0x5ea, 0x5bc, 0x0, 0x5f2, 0x5b7, 0x0, 0x627, 0x653, 0x0, 0x627, 0x654, 0x0, 0x627, 0x655, 0x0, 0x648, 0x654, 0x0, 0x64a, 0x654, 0x0, 0x6c1, 0x654, 0x0, 0x6d2, 0x654, 0x0, 0x6d5, 0x654, 0x0, 0x915, 0x93c, 0x0, 0x916, 0x93c, 0x0, 0x917, 0x93c, 0x0, 0x91c, 0x93c, 0x0, 0x921, 0x93c, 0x0, 0x922, 0x93c, 0x0, 0x928, 0x93c, 0x0, 0x92b, 0x93c, 0x0, 0x92f, 0x93c, 0x0, 0x930, 0x93c, 0x0, 0x933, 0x93c, 0x0, 0x9a1, 0x9bc, 0x0, 0x9a2, 0x9bc, 0x0, 0x9af, 0x9bc, 0x0, 0x9c7, 0x9be, 0x0, 0x9c7, 0x9d7, 0x0, 0xa16, 0xa3c, 0x0, 0xa17, 0xa3c, 0x0, 0xa1c, 0xa3c, 0x0, 0xa2b, 0xa3c, 0x0, 0xa32, 0xa3c, 0x0, 0xa38, 0xa3c, 0x0, 0xb21, 0xb3c, 0x0, 0xb22, 0xb3c, 0x0, 0xb47, 0xb3e, 0x0, 0xb47, 0xb56, 0x0, 0xb47, 0xb57, 0x0, 0xb92, 0xbd7, 0x0, 0xbc6, 0xbbe, 0x0, 0xbc6, 0xbd7, 0x0, 0xbc7, 0xbbe, 0x0, 0xc46, 0xc56, 0x0, 0xcbf, 0xcd5, 0x0, 0xcc6, 0xcc2, 0x0, 0xcc6, 0xcc2, 0xcd5, 0x0, 0xcc6, 0xcd5, 0x0, 0xcc6, 0xcd6, 0x0, 0xd46, 0xd3e, 0x0, 0xd46, 0xd57, 0x0, 0xd47, 0xd3e, 0x0, 0xdd9, 0xdca, 0x0, 0xdd9, 0xdcf, 0x0, 0xdd9, 0xdcf, 0xdca, 0x0, 0xdd9, 0xddf, 0x0, 0xf40, 0xfb5, 0x0, 0xf42, 0xfb7, 0x0, 0xf4c, 0xfb7, 0x0, 0xf51, 0xfb7, 0x0, 0xf56, 0xfb7, 0x0, 0xf5b, 0xfb7, 0x0, 0xf71, 0xf72, 0x0, 0xf71, 0xf74, 0x0, 0xf71, 0xf80, 0x0, 0xf90, 0xfb5, 0x0, 0xf92, 0xfb7, 0x0, 0xf9c, 0xfb7, 0x0, 0xfa1, 0xfb7, 0x0, 0xfa6, 0xfb7, 0x0, 0xfab, 0xfb7, 0x0, 0xfb2, 0xf80, 0x0, 0xfb3, 0xf80, 0x0, 0x1025, 0x102e, 0x0, 0x1b05, 0x1b35, 0x0, 0x1b07, 0x1b35, 0x0, 0x1b09, 0x1b35, 0x0, 0x1b0b, 0x1b35, 0x0, 0x1b0d, 0x1b35, 0x0, 0x1b11, 0x1b35, 0x0, 0x1b3a, 0x1b35, 0x0, 0x1b3c, 0x1b35, 0x0, 0x1b3e, 0x1b35, 0x0, 0x1b3f, 0x1b35, 0x0, 0x1b42, 0x1b35, 0x0, 0x1fbf, 0x300, 0x0, 0x1fbf, 0x301, 0x0, 0x1fbf, 0x342, 0x0, 0x1ffe, 0x300, 0x0, 0x1ffe, 0x301, 0x0, 0x1ffe, 0x342, 0x0, 0x2002, 0x0, 0x2003, 0x0, 0x2190, 0x338, 0x0, 0x2192, 0x338, 0x0, 0x2194, 0x338, 0x0, 0x21d0, 0x338, 0x0, 0x21d2, 0x338, 0x0, 0x21d4, 0x338, 0x0, 0x2203, 0x338, 0x0, 0x2208, 0x338, 0x0, 0x220b, 0x338, 0x0, 0x2223, 0x338, 0x0, 0x2225, 0x338, 0x0, 0x223c, 0x338, 0x0, 0x2243, 0x338, 0x0, 0x2245, 0x338, 0x0, 0x2248, 0x338, 0x0, 0x224d, 0x338, 0x0, 0x2261, 0x338, 0x0, 0x2264, 0x338, 0x0, 0x2265, 0x338, 0x0, 0x2272, 0x338, 0x0, 0x2273, 0x338, 0x0, 0x2276, 0x338, 0x0, 0x2277, 0x338, 0x0, 0x227a, 0x338, 0x0, 0x227b, 0x338, 0x0, 0x227c, 0x338, 0x0, 0x227d, 0x338, 0x0, 0x2282, 0x338, 0x0, 0x2283, 0x338, 0x0, 0x2286, 0x338, 0x0, 0x2287, 0x338, 0x0, 0x2291, 0x338, 0x0, 0x2292, 0x338, 0x0, 0x22a2, 0x338, 0x0, 0x22a8, 0x338, 0x0, 0x22a9, 0x338, 0x0, 0x22ab, 0x338, 0x0, 0x22b2, 0x338, 0x0, 0x22b3, 0x338, 0x0, 0x22b4, 0x338, 0x0, 0x22b5, 0x338, 0x0, 0x2add, 0x338, 0x0, 0x3008, 0x0, 0x3009, 0x0, 0x3046, 0x3099, 0x0, 0x304b, 0x3099, 0x0, 0x304d, 0x3099, 0x0, 0x304f, 0x3099, 0x0, 0x3051, 0x3099, 0x0, 0x3053, 0x3099, 0x0, 0x3055, 0x3099, 0x0, 0x3057, 0x3099, 0x0, 0x3059, 0x3099, 0x0, 0x305b, 0x3099, 0x0, 0x305d, 0x3099, 0x0, 0x305f, 0x3099, 0x0, 0x3061, 0x3099, 0x0, 0x3064, 0x3099, 0x0, 0x3066, 0x3099, 0x0, 0x3068, 0x3099, 0x0, 0x306f, 0x3099, 0x0, 0x306f, 0x309a, 0x0, 0x3072, 0x3099, 0x0, 0x3072, 0x309a, 0x0, 0x3075, 0x3099, 0x0, 0x3075, 0x309a, 0x0, 0x3078, 0x3099, 0x0, 0x3078, 0x309a, 0x0, 0x307b, 0x3099, 0x0, 0x307b, 0x309a, 0x0, 0x309d, 0x3099, 0x0, 0x30a6, 0x3099, 0x0, 0x30ab, 0x3099, 0x0, 0x30ad, 0x3099, 0x0, 0x30af, 0x3099, 0x0, 0x30b1, 0x3099, 0x0, 0x30b3, 0x3099, 0x0, 0x30b5, 0x3099, 0x0, 0x30b7, 0x3099, 0x0, 0x30b9, 0x3099, 0x0, 0x30bb, 0x3099, 0x0, 0x30bd, 0x3099, 0x0, 0x30bf, 0x3099, 0x0, 0x30c1, 0x3099, 0x0, 0x30c4, 0x3099, 0x0, 0x30c6, 0x3099, 0x0, 0x30c8, 0x3099, 0x0, 0x30cf, 0x3099, 0x0, 0x30cf, 0x309a, 0x0, 0x30d2, 0x3099, 0x0, 0x30d2, 0x309a, 0x0, 0x30d5, 0x3099, 0x0, 0x30d5, 0x309a, 0x0, 0x30d8, 0x3099, 0x0, 0x30d8, 0x309a, 0x0, 0x30db, 0x3099, 0x0, 0x30db, 0x309a, 0x0, 0x30ef, 0x3099, 0x0, 0x30f0, 0x3099, 0x0, 0x30f1, 0x3099, 0x0, 0x30f2, 0x3099, 0x0, 0x30fd, 0x3099, 0x0, 0x349e, 0x0, 0x34b9, 0x0, 0x34bb, 0x0, 0x34df, 0x0, 0x3515, 0x0, 0x36ee, 0x0, 0x36fc, 0x0, 0x3781, 0x0, 0x382f, 0x0, 0x3862, 0x0, 0x387c, 0x0, 0x38c7, 0x0, 0x38e3, 0x0, 0x391c, 0x0, 0x393a, 0x0, 0x3a2e, 0x0, 0x3a6c, 0x0, 0x3ae4, 0x0, 0x3b08, 0x0, 0x3b19, 0x0, 0x3b49, 0x0, 0x3b9d, 0x0, 0x3c18, 0x0, 0x3c4e, 0x0, 0x3d33, 0x0, 0x3d96, 0x0, 0x3eac, 0x0, 0x3eb8, 0x0, 0x3f1b, 0x0, 0x3ffc, 0x0, 0x4008, 0x0, 0x4018, 0x0, 0x4039, 0x0, 0x4046, 0x0, 0x4096, 0x0, 0x40e3, 0x0, 0x412f, 0x0, 0x4202, 0x0, 0x4227, 0x0, 0x42a0, 0x0, 0x4301, 0x0, 0x4334, 0x0, 0x4359, 0x0, 0x43d5, 0x0, 0x43d9, 0x0, 0x440b, 0x0, 0x446b, 0x0, 0x452b, 0x0, 0x455d, 0x0, 0x4561, 0x0, 0x456b, 0x0, 0x45d7, 0x0, 0x45f9, 0x0, 0x4635, 0x0, 0x46be, 0x0, 0x46c7, 0x0, 0x4995, 0x0, 0x49e6, 0x0, 0x4a6e, 0x0, 0x4a76, 0x0, 0x4ab2, 0x0, 0x4b33, 0x0, 0x4bce, 0x0, 0x4cce, 0x0, 0x4ced, 0x0, 0x4cf8, 0x0, 0x4d56, 0x0, 0x4e0d, 0x0, 0x4e26, 0x0, 0x4e32, 0x0, 0x4e38, 0x0, 0x4e39, 0x0, 0x4e3d, 0x0, 0x4e41, 0x0, 0x4e82, 0x0, 0x4e86, 0x0, 0x4eae, 0x0, 0x4ec0, 0x0, 0x4ecc, 0x0, 0x4ee4, 0x0, 0x4f60, 0x0, 0x4f80, 0x0, 0x4f86, 0x0, 0x4f8b, 0x0, 0x4fae, 0x0, 0x4fbb, 0x0, 0x4fbf, 0x0, 0x5002, 0x0, 0x502b, 0x0, 0x507a, 0x0, 0x5099, 0x0, 0x50cf, 0x0, 0x50da, 0x0, 0x50e7, 0x0, 0x5140, 0x0, 0x5145, 0x0, 0x514d, 0x0, 0x5154, 0x0, 0x5164, 0x0, 0x5167, 0x0, 0x5168, 0x0, 0x5169, 0x0, 0x516d, 0x0, 0x5177, 0x0, 0x5180, 0x0, 0x518d, 0x0, 0x5192, 0x0, 0x5195, 0x0, 0x5197, 0x0, 0x51a4, 0x0, 0x51ac, 0x0, 0x51b5, 0x0, 0x51b7, 0x0, 0x51c9, 0x0, 0x51cc, 0x0, 0x51dc, 0x0, 0x51de, 0x0, 0x51f5, 0x0, 0x5203, 0x0, 0x5207, 0x0, 0x5217, 0x0, 0x5229, 0x0, 0x523a, 0x0, 0x523b, 0x0, 0x5246, 0x0, 0x5272, 0x0, 0x5277, 0x0, 0x5289, 0x0, 0x529b, 0x0, 0x52a3, 0x0, 0x52b3, 0x0, 0x52c7, 0x0, 0x52c9, 0x0, 0x52d2, 0x0, 0x52de, 0x0, 0x52e4, 0x0, 0x52f5, 0x0, 0x52fa, 0x0, 0x5305, 0x0, 0x5306, 0x0, 0x5317, 0x0, 0x533f, 0x0, 0x5349, 0x0, 0x5351, 0x0, 0x535a, 0x0, 0x5373, 0x0, 0x5375, 0x0, 0x537d, 0x0, 0x537f, 0x0, 0x53c3, 0x0, 0x53ca, 0x0, 0x53df, 0x0, 0x53e5, 0x0, 0x53eb, 0x0, 0x53f1, 0x0, 0x5406, 0x0, 0x540f, 0x0, 0x541d, 0x0, 0x5438, 0x0, 0x5442, 0x0, 0x5448, 0x0, 0x5468, 0x0, 0x549e, 0x0, 0x54a2, 0x0, 0x54bd, 0x0, 0x54f6, 0x0, 0x5510, 0x0, 0x5553, 0x0, 0x5555, 0x0, 0x5563, 0x0, 0x5584, 0x0, 0x5587, 0x0, 0x5599, 0x0, 0x559d, 0x0, 0x55ab, 0x0, 0x55b3, 0x0, 0x55c0, 0x0, 0x55c2, 0x0, 0x55e2, 0x0, 0x5606, 0x0, 0x5651, 0x0, 0x5668, 0x0, 0x5674, 0x0, 0x56f9, 0x0, 0x5716, 0x0, 0x5717, 0x0, 0x578b, 0x0, 0x57ce, 0x0, 0x57f4, 0x0, 0x580d, 0x0, 0x5831, 0x0, 0x5832, 0x0, 0x5840, 0x0, 0x585a, 0x0, 0x585e, 0x0, 0x58a8, 0x0, 0x58ac, 0x0, 0x58b3, 0x0, 0x58d8, 0x0, 0x58df, 0x0, 0x58ee, 0x0, 0x58f2, 0x0, 0x58f7, 0x0, 0x5906, 0x0, 0x591a, 0x0, 0x5922, 0x0, 0x5944, 0x0, 0x5948, 0x0, 0x5951, 0x0, 0x5954, 0x0, 0x5962, 0x0, 0x5973, 0x0, 0x59d8, 0x0, 0x59ec, 0x0, 0x5a1b, 0x0, 0x5a27, 0x0, 0x5a62, 0x0, 0x5a66, 0x0, 0x5ab5, 0x0, 0x5b08, 0x0, 0x5b28, 0x0, 0x5b3e, 0x0, 0x5b85, 0x0, 0x5bc3, 0x0, 0x5bd8, 0x0, 0x5be7, 0x0, 0x5bee, 0x0, 0x5bf3, 0x0, 0x5bff, 0x0, 0x5c06, 0x0, 0x5c22, 0x0, 0x5c3f, 0x0, 0x5c60, 0x0, 0x5c62, 0x0, 0x5c64, 0x0, 0x5c65, 0x0, 0x5c6e, 0x0, 0x5c8d, 0x0, 0x5cc0, 0x0, 0x5d19, 0x0, 0x5d43, 0x0, 0x5d50, 0x0, 0x5d6b, 0x0, 0x5d6e, 0x0, 0x5d7c, 0x0, 0x5db2, 0x0, 0x5dba, 0x0, 0x5de1, 0x0, 0x5de2, 0x0, 0x5dfd, 0x0, 0x5e28, 0x0, 0x5e3d, 0x0, 0x5e69, 0x0, 0x5e74, 0x0, 0x5ea6, 0x0, 0x5eb0, 0x0, 0x5eb3, 0x0, 0x5eb6, 0x0, 0x5ec9, 0x0, 0x5eca, 0x0, 0x5ed2, 0x0, 0x5ed3, 0x0, 0x5ed9, 0x0, 0x5eec, 0x0, 0x5efe, 0x0, 0x5f04, 0x0, 0x5f22, 0x0, 0x5f53, 0x0, 0x5f62, 0x0, 0x5f69, 0x0, 0x5f6b, 0x0, 0x5f8b, 0x0, 0x5f9a, 0x0, 0x5fa9, 0x0, 0x5fad, 0x0, 0x5fcd, 0x0, 0x5fd7, 0x0, 0x5ff5, 0x0, 0x5ff9, 0x0, 0x6012, 0x0, 0x601c, 0x0, 0x6075, 0x0, 0x6081, 0x0, 0x6094, 0x0, 0x60c7, 0x0, 0x60d8, 0x0, 0x60e1, 0x0, 0x6108, 0x0, 0x6144, 0x0, 0x6148, 0x0, 0x614c, 0x0, 0x614e, 0x0, 0x6160, 0x0, 0x6168, 0x0, 0x617a, 0x0, 0x618e, 0x0, 0x6190, 0x0, 0x61a4, 0x0, 0x61af, 0x0, 0x61b2, 0x0, 0x61de, 0x0, 0x61f2, 0x0, 0x61f6, 0x0, 0x6200, 0x0, 0x6210, 0x0, 0x621b, 0x0, 0x622e, 0x0, 0x6234, 0x0, 0x625d, 0x0, 0x62b1, 0x0, 0x62c9, 0x0, 0x62cf, 0x0, 0x62d3, 0x0, 0x62d4, 0x0, 0x62fc, 0x0, 0x62fe, 0x0, 0x633d, 0x0, 0x6350, 0x0, 0x6368, 0x0, 0x637b, 0x0, 0x6383, 0x0, 0x63a0, 0x0, 0x63a9, 0x0, 0x63c4, 0x0, 0x63c5, 0x0, 0x63e4, 0x0, 0x641c, 0x0, 0x6422, 0x0, 0x6452, 0x0, 0x6469, 0x0, 0x6477, 0x0, 0x647e, 0x0, 0x649a, 0x0, 0x649d, 0x0, 0x64c4, 0x0, 0x654f, 0x0, 0x6556, 0x0, 0x656c, 0x0, 0x6578, 0x0, 0x6599, 0x0, 0x65c5, 0x0, 0x65e2, 0x0, 0x65e3, 0x0, 0x6613, 0x0, 0x6649, 0x0, 0x6674, 0x0, 0x6688, 0x0, 0x6691, 0x0, 0x669c, 0x0, 0x66b4, 0x0, 0x66c6, 0x0, 0x66f4, 0x0, 0x66f8, 0x0, 0x6700, 0x0, 0x6717, 0x0, 0x671b, 0x0, 0x6721, 0x0, 0x674e, 0x0, 0x6753, 0x0, 0x6756, 0x0, 0x675e, 0x0, 0x677b, 0x0, 0x6785, 0x0, 0x6797, 0x0, 0x67f3, 0x0, 0x67fa, 0x0, 0x6817, 0x0, 0x681f, 0x0, 0x6852, 0x0, 0x6881, 0x0, 0x6885, 0x0, 0x688e, 0x0, 0x68a8, 0x0, 0x6914, 0x0, 0x6942, 0x0, 0x69a3, 0x0, 0x69ea, 0x0, 0x6a02, 0x0, 0x6a13, 0x0, 0x6aa8, 0x0, 0x6ad3, 0x0, 0x6adb, 0x0, 0x6b04, 0x0, 0x6b21, 0x0, 0x6b54, 0x0, 0x6b72, 0x0, 0x6b77, 0x0, 0x6b79, 0x0, 0x6b9f, 0x0, 0x6bae, 0x0, 0x6bba, 0x0, 0x6bbb, 0x0, 0x6c4e, 0x0, 0x6c67, 0x0, 0x6c88, 0x0, 0x6cbf, 0x0, 0x6ccc, 0x0, 0x6ccd, 0x0, 0x6ce5, 0x0, 0x6d16, 0x0, 0x6d1b, 0x0, 0x6d1e, 0x0, 0x6d34, 0x0, 0x6d3e, 0x0, 0x6d41, 0x0, 0x6d69, 0x0, 0x6d6a, 0x0, 0x6d77, 0x0, 0x6d78, 0x0, 0x6d85, 0x0, 0x6dcb, 0x0, 0x6dda, 0x0, 0x6dea, 0x0, 0x6df9, 0x0, 0x6e1a, 0x0, 0x6e2f, 0x0, 0x6e6e, 0x0, 0x6e9c, 0x0, 0x6eba, 0x0, 0x6ec7, 0x0, 0x6ecb, 0x0, 0x6ed1, 0x0, 0x6edb, 0x0, 0x6f0f, 0x0, 0x6f22, 0x0, 0x6f23, 0x0, 0x6f6e, 0x0, 0x6fc6, 0x0, 0x6feb, 0x0, 0x6ffe, 0x0, 0x701b, 0x0, 0x701e, 0x0, 0x7039, 0x0, 0x704a, 0x0, 0x7070, 0x0, 0x7077, 0x0, 0x707d, 0x0, 0x7099, 0x0, 0x70ad, 0x0, 0x70c8, 0x0, 0x70d9, 0x0, 0x7145, 0x0, 0x7149, 0x0, 0x716e, 0x0, 0x719c, 0x0, 0x71ce, 0x0, 0x71d0, 0x0, 0x7210, 0x0, 0x721b, 0x0, 0x7228, 0x0, 0x722b, 0x0, 0x7235, 0x0, 0x7250, 0x0, 0x7262, 0x0, 0x7280, 0x0, 0x7295, 0x0, 0x72af, 0x0, 0x72c0, 0x0, 0x72fc, 0x0, 0x732a, 0x0, 0x7375, 0x0, 0x737a, 0x0, 0x7387, 0x0, 0x738b, 0x0, 0x73a5, 0x0, 0x73b2, 0x0, 0x73de, 0x0, 0x7406, 0x0, 0x7409, 0x0, 0x7422, 0x0, 0x7447, 0x0, 0x745c, 0x0, 0x7469, 0x0, 0x7471, 0x0, 0x7485, 0x0, 0x7489, 0x0, 0x7498, 0x0, 0x74ca, 0x0, 0x7506, 0x0, 0x7524, 0x0, 0x753b, 0x0, 0x753e, 0x0, 0x7559, 0x0, 0x7565, 0x0, 0x7570, 0x0, 0x75e2, 0x0, 0x7610, 0x0, 0x761d, 0x0, 0x761f, 0x0, 0x7642, 0x0, 0x7669, 0x0, 0x76ca, 0x0, 0x76db, 0x0, 0x76e7, 0x0, 0x76f4, 0x0, 0x7701, 0x0, 0x771e, 0x0, 0x771f, 0x0, 0x7740, 0x0, 0x774a, 0x0, 0x778b, 0x0, 0x77a7, 0x0, 0x784e, 0x0, 0x786b, 0x0, 0x788c, 0x0, 0x7891, 0x0, 0x78ca, 0x0, 0x78cc, 0x0, 0x78fb, 0x0, 0x792a, 0x0, 0x793c, 0x0, 0x793e, 0x0, 0x7948, 0x0, 0x7949, 0x0, 0x7950, 0x0, 0x7956, 0x0, 0x795d, 0x0, 0x795e, 0x0, 0x7965, 0x0, 0x797f, 0x0, 0x798d, 0x0, 0x798e, 0x0, 0x798f, 0x0, 0x79ae, 0x0, 0x79ca, 0x0, 0x79eb, 0x0, 0x7a1c, 0x0, 0x7a40, 0x0, 0x7a4a, 0x0, 0x7a4f, 0x0, 0x7a81, 0x0, 0x7ab1, 0x0, 0x7acb, 0x0, 0x7aee, 0x0, 0x7b20, 0x0, 0x7bc0, 0x0, 0x7bc6, 0x0, 0x7bc9, 0x0, 0x7c3e, 0x0, 0x7c60, 0x0, 0x7c7b, 0x0, 0x7c92, 0x0, 0x7cbe, 0x0, 0x7cd2, 0x0, 0x7cd6, 0x0, 0x7ce3, 0x0, 0x7ce7, 0x0, 0x7ce8, 0x0, 0x7d00, 0x0, 0x7d10, 0x0, 0x7d22, 0x0, 0x7d2f, 0x0, 0x7d5b, 0x0, 0x7d63, 0x0, 0x7da0, 0x0, 0x7dbe, 0x0, 0x7dc7, 0x0, 0x7df4, 0x0, 0x7e02, 0x0, 0x7e09, 0x0, 0x7e37, 0x0, 0x7e41, 0x0, 0x7e45, 0x0, 0x7f3e, 0x0, 0x7f72, 0x0, 0x7f79, 0x0, 0x7f7a, 0x0, 0x7f85, 0x0, 0x7f95, 0x0, 0x7f9a, 0x0, 0x7fbd, 0x0, 0x7ffa, 0x0, 0x8001, 0x0, 0x8005, 0x0, 0x8046, 0x0, 0x8060, 0x0, 0x806f, 0x0, 0x8070, 0x0, 0x807e, 0x0, 0x808b, 0x0, 0x80ad, 0x0, 0x80b2, 0x0, 0x8103, 0x0, 0x813e, 0x0, 0x81d8, 0x0, 0x81e8, 0x0, 0x81ed, 0x0, 0x8201, 0x0, 0x8204, 0x0, 0x8218, 0x0, 0x826f, 0x0, 0x8279, 0x0, 0x828b, 0x0, 0x8291, 0x0, 0x829d, 0x0, 0x82b1, 0x0, 0x82b3, 0x0, 0x82bd, 0x0, 0x82e5, 0x0, 0x82e6, 0x0, 0x831d, 0x0, 0x8323, 0x0, 0x8336, 0x0, 0x8352, 0x0, 0x8353, 0x0, 0x8363, 0x0, 0x83ad, 0x0, 0x83bd, 0x0, 0x83c9, 0x0, 0x83ca, 0x0, 0x83cc, 0x0, 0x83dc, 0x0, 0x83e7, 0x0, 0x83ef, 0x0, 0x83f1, 0x0, 0x843d, 0x0, 0x8449, 0x0, 0x8457, 0x0, 0x84ee, 0x0, 0x84f1, 0x0, 0x84f3, 0x0, 0x84fc, 0x0, 0x8516, 0x0, 0x8564, 0x0, 0x85cd, 0x0, 0x85fa, 0x0, 0x8606, 0x0, 0x8612, 0x0, 0x862d, 0x0, 0x863f, 0x0, 0x8650, 0x0, 0x865c, 0x0, 0x8667, 0x0, 0x8669, 0x0, 0x8688, 0x0, 0x86a9, 0x0, 0x86e2, 0x0, 0x870e, 0x0, 0x8728, 0x0, 0x876b, 0x0, 0x8779, 0x0, 0x8786, 0x0, 0x87ba, 0x0, 0x87e1, 0x0, 0x8801, 0x0, 0x881f, 0x0, 0x884c, 0x0, 0x8860, 0x0, 0x8863, 0x0, 0x88c2, 0x0, 0x88cf, 0x0, 0x88d7, 0x0, 0x88de, 0x0, 0x88e1, 0x0, 0x88f8, 0x0, 0x88fa, 0x0, 0x8910, 0x0, 0x8941, 0x0, 0x8964, 0x0, 0x8986, 0x0, 0x898b, 0x0, 0x8996, 0x0, 0x8aa0, 0x0, 0x8aaa, 0x0, 0x8abf, 0x0, 0x8acb, 0x0, 0x8ad2, 0x0, 0x8ad6, 0x0, 0x8aed, 0x0, 0x8af8, 0x0, 0x8afe, 0x0, 0x8b01, 0x0, 0x8b39, 0x0, 0x8b58, 0x0, 0x8b80, 0x0, 0x8b8a, 0x0, 0x8c48, 0x0, 0x8c55, 0x0, 0x8cab, 0x0, 0x8cc1, 0x0, 0x8cc2, 0x0, 0x8cc8, 0x0, 0x8cd3, 0x0, 0x8d08, 0x0, 0x8d1b, 0x0, 0x8d77, 0x0, 0x8dbc, 0x0, 0x8dcb, 0x0, 0x8def, 0x0, 0x8df0, 0x0, 0x8eca, 0x0, 0x8ed4, 0x0, 0x8f26, 0x0, 0x8f2a, 0x0, 0x8f38, 0x0, 0x8f3b, 0x0, 0x8f62, 0x0, 0x8f9e, 0x0, 0x8fb0, 0x0, 0x8fb6, 0x0, 0x9023, 0x0, 0x9038, 0x0, 0x9072, 0x0, 0x907c, 0x0, 0x908f, 0x0, 0x9094, 0x0, 0x90ce, 0x0, 0x90de, 0x0, 0x90f1, 0x0, 0x90fd, 0x0, 0x9111, 0x0, 0x911b, 0x0, 0x916a, 0x0, 0x9199, 0x0, 0x91b4, 0x0, 0x91cc, 0x0, 0x91cf, 0x0, 0x91d1, 0x0, 0x9234, 0x0, 0x9238, 0x0, 0x9276, 0x0, 0x927c, 0x0, 0x92d7, 0x0, 0x92d8, 0x0, 0x9304, 0x0, 0x934a, 0x0, 0x93f9, 0x0, 0x9415, 0x0, 0x958b, 0x0, 0x95ad, 0x0, 0x95b7, 0x0, 0x962e, 0x0, 0x964b, 0x0, 0x964d, 0x0, 0x9675, 0x0, 0x9678, 0x0, 0x967c, 0x0, 0x9686, 0x0, 0x96a3, 0x0, 0x96b7, 0x0, 0x96b8, 0x0, 0x96c3, 0x0, 0x96e2, 0x0, 0x96e3, 0x0, 0x96f6, 0x0, 0x96f7, 0x0, 0x9723, 0x0, 0x9732, 0x0, 0x9748, 0x0, 0x9756, 0x0, 0x97db, 0x0, 0x97e0, 0x0, 0x97ff, 0x0, 0x980b, 0x0, 0x9818, 0x0, 0x9829, 0x0, 0x983b, 0x0, 0x985e, 0x0, 0x98e2, 0x0, 0x98ef, 0x0, 0x98fc, 0x0, 0x9928, 0x0, 0x9929, 0x0, 0x99a7, 0x0, 0x99c2, 0x0, 0x99f1, 0x0, 0x99fe, 0x0, 0x9a6a, 0x0, 0x9b12, 0x0, 0x9b6f, 0x0, 0x9c40, 0x0, 0x9c57, 0x0, 0x9cfd, 0x0, 0x9d67, 0x0, 0x9db4, 0x0, 0x9dfa, 0x0, 0x9e1e, 0x0, 0x9e7f, 0x0, 0x9e97, 0x0, 0x9e9f, 0x0, 0x9ebb, 0x0, 0x9ece, 0x0, 0x9ef9, 0x0, 0x9efe, 0x0, 0x9f05, 0x0, 0x9f0f, 0x0, 0x9f16, 0x0, 0x9f3b, 0x0, 0x9f43, 0x0, 0x9f8d, 0x0, 0x9f8e, 0x0, 0x9f9c, 0x0, 0x11099, 0x110ba, 0x0, 0x1109b, 0x110ba, 0x0, 0x110a5, 0x110ba, 0x0, 0x11131, 0x11127, 0x0, 0x11132, 0x11127, 0x0, 0x1d157, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x1d16e, 0x0, 0x1d158, 0x1d165, 0x1d16f, 0x0, 0x1d158, 0x1d165, 0x1d170, 0x0, 0x1d158, 0x1d165, 0x1d171, 0x0, 0x1d158, 0x1d165, 0x1d172, 0x0, 0x1d1b9, 0x1d165, 0x0, 0x1d1b9, 0x1d165, 0x1d16e, 0x0, 0x1d1b9, 0x1d165, 0x1d16f, 0x0, 0x1d1ba, 0x1d165, 0x0, 0x1d1ba, 0x1d165, 0x1d16e, 0x0, 0x1d1ba, 0x1d165, 0x1d16f, 0x0, 0x20122, 0x0, 0x2051c, 0x0, 0x20525, 0x0, 0x2054b, 0x0, 0x2063a, 0x0, 0x20804, 0x0, 0x208de, 0x0, 0x20a2c, 0x0, 0x20b63, 0x0, 0x214e4, 0x0, 0x216a8, 0x0, 0x216ea, 0x0, 0x219c8, 0x0, 0x21b18, 0x0, 0x21d0b, 0x0, 0x21de4, 0x0, 0x21de6, 0x0, 0x22183, 0x0, 0x2219f, 0x0, 0x22331, 0x0, 0x226d4, 0x0, 0x22844, 0x0, 0x2284a, 0x0, 0x22b0c, 0x0, 0x22bf1, 0x0, 0x2300a, 0x0, 0x232b8, 0x0, 0x2335f, 0x0, 0x23393, 0x0, 0x2339c, 0x0, 0x233c3, 0x0, 0x233d5, 0x0, 0x2346d, 0x0, 0x236a3, 0x0, 0x238a7, 0x0, 0x23a8d, 0x0, 0x23afa, 0x0, 0x23cbc, 0x0, 0x23d1e, 0x0, 0x23ed1, 0x0, 0x23f5e, 0x0, 0x23f8e, 0x0, 0x24263, 0x0, 0x242ee, 0x0, 0x243ab, 0x0, 0x24608, 0x0, 0x24735, 0x0, 0x24814, 0x0, 0x24c36, 0x0, 0x24c92, 0x0, 0x24fa1, 0x0, 0x24fb8, 0x0, 0x25044, 0x0, 0x250f2, 0x0, 0x250f3, 0x0, 0x25119, 0x0, 0x25133, 0x0, 0x25249, 0x0, 0x2541d, 0x0, 0x25626, 0x0, 0x2569a, 0x0, 0x256c5, 0x0, 0x2597c, 0x0, 0x25aa7, 0x0, 0x25bab, 0x0, 0x25c80, 0x0, 0x25cd0, 0x0, 0x25f86, 0x0, 0x261da, 0x0, 0x26228, 0x0, 0x26247, 0x0, 0x262d9, 0x0, 0x2633e, 0x0, 0x264da, 0x0, 0x26523, 0x0, 0x265a8, 0x0, 0x267a7, 0x0, 0x267b5, 0x0, 0x26b3c, 0x0, 0x26c36, 0x0, 0x26cd5, 0x0, 0x26d6b, 0x0, 0x26f2c, 0x0, 0x26fb1, 0x0, 0x270d2, 0x0, 0x273ca, 0x0, 0x27667, 0x0, 0x278ae, 0x0, 0x27966, 0x0, 0x27ca8, 0x0, 0x27ed3, 0x0, 0x27f2f, 0x0, 0x285d2, 0x0, 0x285ed, 0x0, 0x2872e, 0x0, 0x28bfa, 0x0, 0x28d77, 0x0, 0x29145, 0x0, 0x291df, 0x0, 0x2921a, 0x0, 0x2940a, 0x0, 0x29496, 0x0, 0x295b6, 0x0, 0x29b30, 0x0, 0x2a0ce, 0x0, 0x2a105, 0x0, 0x2a20e, 0x0, 0x2a291, 0x0, 0x2a392, 0x0, 0x2a600, 0x0]; return t; } -+_IDCA decompCompatTable() { static _IDCA t = [ 0x0, 0x20, 0x0, 0x20, 0x301, 0x0, 0x20, 0x303, 0x0, 0x20, 0x304, 0x0, 0x20, 0x305, 0x0, 0x20, 0x306, 0x0, 0x20, 0x307, 0x0, 0x20, 0x308, 0x0, 0x20, 0x308, 0x300, 0x0, 0x20, 0x308, 0x301, 0x0, 0x20, 0x308, 0x342, 0x0, 0x20, 0x30a, 0x0, 0x20, 0x30b, 0x0, 0x20, 0x313, 0x0, 0x20, 0x313, 0x300, 0x0, 0x20, 0x313, 0x301, 0x0, 0x20, 0x313, 0x342, 0x0, 0x20, 0x314, 0x0, 0x20, 0x314, 0x300, 0x0, 0x20, 0x314, 0x301, 0x0, 0x20, 0x314, 0x342, 0x0, 0x20, 0x327, 0x0, 0x20, 0x328, 0x0, 0x20, 0x333, 0x0, 0x20, 0x342, 0x0, 0x20, 0x345, 0x0, 0x20, 0x64b, 0x0, 0x20, 0x64c, 0x0, 0x20, 0x64c, 0x651, 0x0, 0x20, 0x64d, 0x0, 0x20, 0x64d, 0x651, 0x0, 0x20, 0x64e, 0x0, 0x20, 0x64e, 0x651, 0x0, 0x20, 0x64f, 0x0, 0x20, 0x64f, 0x651, 0x0, 0x20, 0x650, 0x0, 0x20, 0x650, 0x651, 0x0, 0x20, 0x651, 0x0, 0x20, 0x651, 0x670, 0x0, 0x20, 0x652, 0x0, 0x20, 0x3099, 0x0, 0x20, 0x309a, 0x0, 0x21, 0x0, 0x21, 0x21, 0x0, 0x21, 0x3f, 0x0, 0x22, 0x0, 0x23, 0x0, 0x24, 0x0, 0x25, 0x0, 0x26, 0x0, 0x27, 0x0, 0x28, 0x0, 0x28, 0x31, 0x29, 0x0, 0x28, 0x31, 0x30, 0x29, 0x0, 0x28, 0x31, 0x31, 0x29, 0x0, 0x28, 0x31, 0x32, 0x29, 0x0, 0x28, 0x31, 0x33, 0x29, 0x0, 0x28, 0x31, 0x34, 0x29, 0x0, 0x28, 0x31, 0x35, 0x29, 0x0, 0x28, 0x31, 0x36, 0x29, 0x0, 0x28, 0x31, 0x37, 0x29, 0x0, 0x28, 0x31, 0x38, 0x29, 0x0, 0x28, 0x31, 0x39, 0x29, 0x0, 0x28, 0x32, 0x29, 0x0, 0x28, 0x32, 0x30, 0x29, 0x0, 0x28, 0x33, 0x29, 0x0, 0x28, 0x34, 0x29, 0x0, 0x28, 0x35, 0x29, 0x0, 0x28, 0x36, 0x29, 0x0, 0x28, 0x37, 0x29, 0x0, 0x28, 0x38, 0x29, 0x0, 0x28, 0x39, 0x29, 0x0, 0x28, 0x41, 0x29, 0x0, 0x28, 0x42, 0x29, 0x0, 0x28, 0x43, 0x29, 0x0, 0x28, 0x44, 0x29, 0x0, 0x28, 0x45, 0x29, 0x0, 0x28, 0x46, 0x29, 0x0, 0x28, 0x47, 0x29, 0x0, 0x28, 0x48, 0x29, 0x0, 0x28, 0x49, 0x29, 0x0, 0x28, 0x4a, 0x29, 0x0, 0x28, 0x4b, 0x29, 0x0, 0x28, 0x4c, 0x29, 0x0, 0x28, 0x4d, 0x29, 0x0, 0x28, 0x4e, 0x29, 0x0, 0x28, 0x4f, 0x29, 0x0, 0x28, 0x50, 0x29, 0x0, 0x28, 0x51, 0x29, 0x0, 0x28, 0x52, 0x29, 0x0, 0x28, 0x53, 0x29, 0x0, 0x28, 0x54, 0x29, 0x0, 0x28, 0x55, 0x29, 0x0, 0x28, 0x56, 0x29, 0x0, 0x28, 0x57, 0x29, 0x0, 0x28, 0x58, 0x29, 0x0, 0x28, 0x59, 0x29, 0x0, 0x28, 0x5a, 0x29, 0x0, 0x28, 0x61, 0x29, 0x0, 0x28, 0x62, 0x29, 0x0, 0x28, 0x63, 0x29, 0x0, 0x28, 0x64, 0x29, 0x0, 0x28, 0x65, 0x29, 0x0, 0x28, 0x66, 0x29, 0x0, 0x28, 0x67, 0x29, 0x0, 0x28, 0x68, 0x29, 0x0, 0x28, 0x69, 0x29, 0x0, 0x28, 0x6a, 0x29, 0x0, 0x28, 0x6b, 0x29, 0x0, 0x28, 0x6c, 0x29, 0x0, 0x28, 0x6d, 0x29, 0x0, 0x28, 0x6e, 0x29, 0x0, 0x28, 0x6f, 0x29, 0x0, 0x28, 0x70, 0x29, 0x0, 0x28, 0x71, 0x29, 0x0, 0x28, 0x72, 0x29, 0x0, 0x28, 0x73, 0x29, 0x0, 0x28, 0x74, 0x29, 0x0, 0x28, 0x75, 0x29, 0x0, 0x28, 0x76, 0x29, 0x0, 0x28, 0x77, 0x29, 0x0, 0x28, 0x78, 0x29, 0x0, 0x28, 0x79, 0x29, 0x0, 0x28, 0x7a, 0x29, 0x0, 0x28, 0x1100, 0x29, 0x0, 0x28, 0x1100, 0x1161, 0x29, 0x0, 0x28, 0x1102, 0x29, 0x0, 0x28, 0x1102, 0x1161, 0x29, 0x0, 0x28, 0x1103, 0x29, 0x0, 0x28, 0x1103, 0x1161, 0x29, 0x0, 0x28, 0x1105, 0x29, 0x0, 0x28, 0x1105, 0x1161, 0x29, 0x0, 0x28, 0x1106, 0x29, 0x0, 0x28, 0x1106, 0x1161, 0x29, 0x0, 0x28, 0x1107, 0x29, 0x0, 0x28, 0x1107, 0x1161, 0x29, 0x0, 0x28, 0x1109, 0x29, 0x0, 0x28, 0x1109, 0x1161, 0x29, 0x0, 0x28, 0x110b, 0x29, 0x0, 0x28, 0x110b, 0x1161, 0x29, 0x0, 0x28, 0x110b, 0x1169, 0x110c, 0x1165, 0x11ab, 0x29, 0x0, 0x28, 0x110b, 0x1169, 0x1112, 0x116e, 0x29, 0x0, 0x28, 0x110c, 0x29, 0x0, 0x28, 0x110c, 0x1161, 0x29, 0x0, 0x28, 0x110c, 0x116e, 0x29, 0x0, 0x28, 0x110e, 0x29, 0x0, 0x28, 0x110e, 0x1161, 0x29, 0x0, 0x28, 0x110f, 0x29, 0x0, 0x28, 0x110f, 0x1161, 0x29, 0x0, 0x28, 0x1110, 0x29, 0x0, 0x28, 0x1110, 0x1161, 0x29, 0x0, 0x28, 0x1111, 0x29, 0x0, 0x28, 0x1111, 0x1161, 0x29, 0x0, 0x28, 0x1112, 0x29, 0x0, 0x28, 0x1112, 0x1161, 0x29, 0x0, 0x28, 0x4e00, 0x29, 0x0, 0x28, 0x4e03, 0x29, 0x0, 0x28, 0x4e09, 0x29, 0x0, 0x28, 0x4e5d, 0x29, 0x0, 0x28, 0x4e8c, 0x29, 0x0, 0x28, 0x4e94, 0x29, 0x0, 0x28, 0x4ee3, 0x29, 0x0, 0x28, 0x4f01, 0x29, 0x0, 0x28, 0x4f11, 0x29, 0x0, 0x28, 0x516b, 0x29, 0x0, 0x28, 0x516d, 0x29, 0x0, 0x28, 0x52b4, 0x29, 0x0, 0x28, 0x5341, 0x29, 0x0, 0x28, 0x5354, 0x29, 0x0, 0x28, 0x540d, 0x29, 0x0, 0x28, 0x547c, 0x29, 0x0, 0x28, 0x56db, 0x29, 0x0, 0x28, 0x571f, 0x29, 0x0, 0x28, 0x5b66, 0x29, 0x0, 0x28, 0x65e5, 0x29, 0x0, 0x28, 0x6708, 0x29, 0x0, 0x28, 0x6709, 0x29, 0x0, 0x28, 0x6728, 0x29, 0x0, 0x28, 0x682a, 0x29, 0x0, 0x28, 0x6c34, 0x29, 0x0, 0x28, 0x706b, 0x29, 0x0, 0x28, 0x7279, 0x29, 0x0, 0x28, 0x76e3, 0x29, 0x0, 0x28, 0x793e, 0x29, 0x0, 0x28, 0x795d, 0x29, 0x0, 0x28, 0x796d, 0x29, 0x0, 0x28, 0x81ea, 0x29, 0x0, 0x28, 0x81f3, 0x29, 0x0, 0x28, 0x8ca1, 0x29, 0x0, 0x28, 0x8cc7, 0x29, 0x0, 0x28, 0x91d1, 0x29, 0x0, 0x29, 0x0, 0x2a, 0x0, 0x2b, 0x0, 0x2c, 0x0, 0x2d, 0x0, 0x2e, 0x0, 0x2e, 0x2e, 0x0, 0x2e, 0x2e, 0x2e, 0x0, 0x2f, 0x0, 0x30, 0x0, 0x30, 0x2c, 0x0, 0x30, 0x2e, 0x0, 0x30, 0x2044, 0x33, 0x0, 0x30, 0x70b9, 0x0, 0x31, 0x0, 0x31, 0x2c, 0x0, 0x31, 0x2e, 0x0, 0x31, 0x30, 0x0, 0x31, 0x30, 0x2e, 0x0, 0x31, 0x30, 0x65e5, 0x0, 0x31, 0x30, 0x6708, 0x0, 0x31, 0x30, 0x70b9, 0x0, 0x31, 0x31, 0x0, 0x31, 0x31, 0x2e, 0x0, 0x31, 0x31, 0x65e5, 0x0, 0x31, 0x31, 0x6708, 0x0, 0x31, 0x31, 0x70b9, 0x0, 0x31, 0x32, 0x0, 0x31, 0x32, 0x2e, 0x0, 0x31, 0x32, 0x65e5, 0x0, 0x31, 0x32, 0x6708, 0x0, 0x31, 0x32, 0x70b9, 0x0, 0x31, 0x33, 0x0, 0x31, 0x33, 0x2e, 0x0, 0x31, 0x33, 0x65e5, 0x0, 0x31, 0x33, 0x70b9, 0x0, 0x31, 0x34, 0x0, 0x31, 0x34, 0x2e, 0x0, 0x31, 0x34, 0x65e5, 0x0, 0x31, 0x34, 0x70b9, 0x0, 0x31, 0x35, 0x0, 0x31, 0x35, 0x2e, 0x0, 0x31, 0x35, 0x65e5, 0x0, 0x31, 0x35, 0x70b9, 0x0, 0x31, 0x36, 0x0, 0x31, 0x36, 0x2e, 0x0, 0x31, 0x36, 0x65e5, 0x0, 0x31, 0x36, 0x70b9, 0x0, 0x31, 0x37, 0x0, 0x31, 0x37, 0x2e, 0x0, 0x31, 0x37, 0x65e5, 0x0, 0x31, 0x37, 0x70b9, 0x0, 0x31, 0x38, 0x0, 0x31, 0x38, 0x2e, 0x0, 0x31, 0x38, 0x65e5, 0x0, 0x31, 0x38, 0x70b9, 0x0, 0x31, 0x39, 0x0, 0x31, 0x39, 0x2e, 0x0, 0x31, 0x39, 0x65e5, 0x0, 0x31, 0x39, 0x70b9, 0x0, 0x31, 0x2044, 0x0, 0x31, 0x2044, 0x31, 0x30, 0x0, 0x31, 0x2044, 0x32, 0x0, 0x31, 0x2044, 0x33, 0x0, 0x31, 0x2044, 0x34, 0x0, 0x31, 0x2044, 0x35, 0x0, 0x31, 0x2044, 0x36, 0x0, 0x31, 0x2044, 0x37, 0x0, 0x31, 0x2044, 0x38, 0x0, 0x31, 0x2044, 0x39, 0x0, 0x31, 0x65e5, 0x0, 0x31, 0x6708, 0x0, 0x31, 0x70b9, 0x0, 0x32, 0x0, 0x32, 0x2c, 0x0, 0x32, 0x2e, 0x0, 0x32, 0x30, 0x0, 0x32, 0x30, 0x2e, 0x0, 0x32, 0x30, 0x65e5, 0x0, 0x32, 0x30, 0x70b9, 0x0, 0x32, 0x31, 0x0, 0x32, 0x31, 0x65e5, 0x0, 0x32, 0x31, 0x70b9, 0x0, 0x32, 0x32, 0x0, 0x32, 0x32, 0x65e5, 0x0, 0x32, 0x32, 0x70b9, 0x0, 0x32, 0x33, 0x0, 0x32, 0x33, 0x65e5, 0x0, 0x32, 0x33, 0x70b9, 0x0, 0x32, 0x34, 0x0, 0x32, 0x34, 0x65e5, 0x0, 0x32, 0x34, 0x70b9, 0x0, 0x32, 0x35, 0x0, 0x32, 0x35, 0x65e5, 0x0, 0x32, 0x36, 0x0, 0x32, 0x36, 0x65e5, 0x0, 0x32, 0x37, 0x0, 0x32, 0x37, 0x65e5, 0x0, 0x32, 0x38, 0x0, 0x32, 0x38, 0x65e5, 0x0, 0x32, 0x39, 0x0, 0x32, 0x39, 0x65e5, 0x0, 0x32, 0x2044, 0x33, 0x0, 0x32, 0x2044, 0x35, 0x0, 0x32, 0x65e5, 0x0, 0x32, 0x6708, 0x0, 0x32, 0x70b9, 0x0, 0x33, 0x0, 0x33, 0x2c, 0x0, 0x33, 0x2e, 0x0, 0x33, 0x30, 0x0, 0x33, 0x30, 0x65e5, 0x0, 0x33, 0x31, 0x0, 0x33, 0x31, 0x65e5, 0x0, 0x33, 0x32, 0x0, 0x33, 0x33, 0x0, 0x33, 0x34, 0x0, 0x33, 0x35, 0x0, 0x33, 0x36, 0x0, 0x33, 0x37, 0x0, 0x33, 0x38, 0x0, 0x33, 0x39, 0x0, 0x33, 0x2044, 0x34, 0x0, 0x33, 0x2044, 0x35, 0x0, 0x33, 0x2044, 0x38, 0x0, 0x33, 0x65e5, 0x0, 0x33, 0x6708, 0x0, 0x33, 0x70b9, 0x0, 0x34, 0x0, 0x34, 0x2c, 0x0, 0x34, 0x2e, 0x0, 0x34, 0x30, 0x0, 0x34, 0x31, 0x0, 0x34, 0x32, 0x0, 0x34, 0x33, 0x0, 0x34, 0x34, 0x0, 0x34, 0x35, 0x0, 0x34, 0x36, 0x0, 0x34, 0x37, 0x0, 0x34, 0x38, 0x0, 0x34, 0x39, 0x0, 0x34, 0x2044, 0x35, 0x0, 0x34, 0x65e5, 0x0, 0x34, 0x6708, 0x0, 0x34, 0x70b9, 0x0, 0x35, 0x0, 0x35, 0x2c, 0x0, 0x35, 0x2e, 0x0, 0x35, 0x30, 0x0, 0x35, 0x2044, 0x36, 0x0, 0x35, 0x2044, 0x38, 0x0, 0x35, 0x65e5, 0x0, 0x35, 0x6708, 0x0, 0x35, 0x70b9, 0x0, 0x36, 0x0, 0x36, 0x2c, 0x0, 0x36, 0x2e, 0x0, 0x36, 0x65e5, 0x0, 0x36, 0x6708, 0x0, 0x36, 0x70b9, 0x0, 0x37, 0x0, 0x37, 0x2c, 0x0, 0x37, 0x2e, 0x0, 0x37, 0x2044, 0x38, 0x0, 0x37, 0x65e5, 0x0, 0x37, 0x6708, 0x0, 0x37, 0x70b9, 0x0, 0x38, 0x0, 0x38, 0x2c, 0x0, 0x38, 0x2e, 0x0, 0x38, 0x65e5, 0x0, 0x38, 0x6708, 0x0, 0x38, 0x70b9, 0x0, 0x39, 0x0, 0x39, 0x2c, 0x0, 0x39, 0x2e, 0x0, 0x39, 0x65e5, 0x0, 0x39, 0x6708, 0x0, 0x39, 0x70b9, 0x0, 0x3a, 0x0, 0x3a, 0x3a, 0x3d, 0x0, 0x3b, 0x0, 0x3c, 0x0, 0x3c, 0x338, 0x0, 0x3d, 0x0, 0x3d, 0x3d, 0x0, 0x3d, 0x3d, 0x3d, 0x0, 0x3d, 0x338, 0x0, 0x3e, 0x0, 0x3e, 0x338, 0x0, 0x3f, 0x0, 0x3f, 0x21, 0x0, 0x3f, 0x3f, 0x0, 0x40, 0x0, 0x41, 0x0, 0x41, 0x55, 0x0, 0x41, 0x300, 0x0, 0x41, 0x301, 0x0, 0x41, 0x302, 0x0, 0x41, 0x302, 0x300, 0x0, 0x41, 0x302, 0x301, 0x0, 0x41, 0x302, 0x303, 0x0, 0x41, 0x302, 0x309, 0x0, 0x41, 0x303, 0x0, 0x41, 0x304, 0x0, 0x41, 0x306, 0x0, 0x41, 0x306, 0x300, 0x0, 0x41, 0x306, 0x301, 0x0, 0x41, 0x306, 0x303, 0x0, 0x41, 0x306, 0x309, 0x0, 0x41, 0x307, 0x0, 0x41, 0x307, 0x304, 0x0, 0x41, 0x308, 0x0, 0x41, 0x308, 0x304, 0x0, 0x41, 0x309, 0x0, 0x41, 0x30a, 0x0, 0x41, 0x30a, 0x301, 0x0, 0x41, 0x30c, 0x0, 0x41, 0x30f, 0x0, 0x41, 0x311, 0x0, 0x41, 0x323, 0x0, 0x41, 0x323, 0x302, 0x0, 0x41, 0x323, 0x306, 0x0, 0x41, 0x325, 0x0, 0x41, 0x328, 0x0, 0x41, 0x2215, 0x6d, 0x0, 0x42, 0x0, 0x42, 0x71, 0x0, 0x42, 0x307, 0x0, 0x42, 0x323, 0x0, 0x42, 0x331, 0x0, 0x43, 0x0, 0x43, 0x44, 0x0, 0x43, 0x6f, 0x2e, 0x0, 0x43, 0x301, 0x0, 0x43, 0x302, 0x0, 0x43, 0x307, 0x0, 0x43, 0x30c, 0x0, 0x43, 0x327, 0x0, 0x43, 0x327, 0x301, 0x0, 0x43, 0x2215, 0x6b, 0x67, 0x0, 0x44, 0x0, 0x44, 0x4a, 0x0, 0x44, 0x5a, 0x0, 0x44, 0x5a, 0x30c, 0x0, 0x44, 0x7a, 0x0, 0x44, 0x7a, 0x30c, 0x0, 0x44, 0x307, 0x0, 0x44, 0x30c, 0x0, 0x44, 0x323, 0x0, 0x44, 0x327, 0x0, 0x44, 0x32d, 0x0, 0x44, 0x331, 0x0, 0x45, 0x0, 0x45, 0x300, 0x0, 0x45, 0x301, 0x0, 0x45, 0x302, 0x0, 0x45, 0x302, 0x300, 0x0, 0x45, 0x302, 0x301, 0x0, 0x45, 0x302, 0x303, 0x0, 0x45, 0x302, 0x309, 0x0, 0x45, 0x303, 0x0, 0x45, 0x304, 0x0, 0x45, 0x304, 0x300, 0x0, 0x45, 0x304, 0x301, 0x0, 0x45, 0x306, 0x0, 0x45, 0x307, 0x0, 0x45, 0x308, 0x0, 0x45, 0x309, 0x0, 0x45, 0x30c, 0x0, 0x45, 0x30f, 0x0, 0x45, 0x311, 0x0, 0x45, 0x323, 0x0, 0x45, 0x323, 0x302, 0x0, 0x45, 0x327, 0x0, 0x45, 0x327, 0x306, 0x0, 0x45, 0x328, 0x0, 0x45, 0x32d, 0x0, 0x45, 0x330, 0x0, 0x46, 0x0, 0x46, 0x41, 0x58, 0x0, 0x46, 0x307, 0x0, 0x47, 0x0, 0x47, 0x42, 0x0, 0x47, 0x48, 0x7a, 0x0, 0x47, 0x50, 0x61, 0x0, 0x47, 0x79, 0x0, 0x47, 0x301, 0x0, 0x47, 0x302, 0x0, 0x47, 0x304, 0x0, 0x47, 0x306, 0x0, 0x47, 0x307, 0x0, 0x47, 0x30c, 0x0, 0x47, 0x327, 0x0, 0x48, 0x0, 0x48, 0x50, 0x0, 0x48, 0x56, 0x0, 0x48, 0x67, 0x0, 0x48, 0x7a, 0x0, 0x48, 0x302, 0x0, 0x48, 0x307, 0x0, 0x48, 0x308, 0x0, 0x48, 0x30c, 0x0, 0x48, 0x323, 0x0, 0x48, 0x327, 0x0, 0x48, 0x32e, 0x0, 0x49, 0x0, 0x49, 0x49, 0x0, 0x49, 0x49, 0x49, 0x0, 0x49, 0x4a, 0x0, 0x49, 0x55, 0x0, 0x49, 0x56, 0x0, 0x49, 0x58, 0x0, 0x49, 0x300, 0x0, 0x49, 0x301, 0x0, 0x49, 0x302, 0x0, 0x49, 0x303, 0x0, 0x49, 0x304, 0x0, 0x49, 0x306, 0x0, 0x49, 0x307, 0x0, 0x49, 0x308, 0x0, 0x49, 0x308, 0x301, 0x0, 0x49, 0x309, 0x0, 0x49, 0x30c, 0x0, 0x49, 0x30f, 0x0, 0x49, 0x311, 0x0, 0x49, 0x323, 0x0, 0x49, 0x328, 0x0, 0x49, 0x330, 0x0, 0x4a, 0x0, 0x4a, 0x302, 0x0, 0x4b, 0x0, 0x4b, 0x42, 0x0, 0x4b, 0x4b, 0x0, 0x4b, 0x4d, 0x0, 0x4b, 0x301, 0x0, 0x4b, 0x30c, 0x0, 0x4b, 0x323, 0x0, 0x4b, 0x327, 0x0, 0x4b, 0x331, 0x0, 0x4c, 0x0, 0x4c, 0x4a, 0x0, 0x4c, 0x54, 0x44, 0x0, 0x4c, 0x6a, 0x0, 0x4c, 0xb7, 0x0, 0x4c, 0x301, 0x0, 0x4c, 0x30c, 0x0, 0x4c, 0x323, 0x0, 0x4c, 0x323, 0x304, 0x0, 0x4c, 0x327, 0x0, 0x4c, 0x32d, 0x0, 0x4c, 0x331, 0x0, 0x4d, 0x0, 0x4d, 0x42, 0x0, 0x4d, 0x43, 0x0, 0x4d, 0x44, 0x0, 0x4d, 0x48, 0x7a, 0x0, 0x4d, 0x50, 0x61, 0x0, 0x4d, 0x56, 0x0, 0x4d, 0x57, 0x0, 0x4d, 0x301, 0x0, 0x4d, 0x307, 0x0, 0x4d, 0x323, 0x0, 0x4d, 0x3a9, 0x0, 0x4e, 0x0, 0x4e, 0x4a, 0x0, 0x4e, 0x6a, 0x0, 0x4e, 0x6f, 0x0, 0x4e, 0x300, 0x0, 0x4e, 0x301, 0x0, 0x4e, 0x303, 0x0, 0x4e, 0x307, 0x0, 0x4e, 0x30c, 0x0, 0x4e, 0x323, 0x0, 0x4e, 0x327, 0x0, 0x4e, 0x32d, 0x0, 0x4e, 0x331, 0x0, 0x4f, 0x0, 0x4f, 0x300, 0x0, 0x4f, 0x301, 0x0, 0x4f, 0x302, 0x0, 0x4f, 0x302, 0x300, 0x0, 0x4f, 0x302, 0x301, 0x0, 0x4f, 0x302, 0x303, 0x0, 0x4f, 0x302, 0x309, 0x0, 0x4f, 0x303, 0x0, 0x4f, 0x303, 0x301, 0x0, 0x4f, 0x303, 0x304, 0x0, 0x4f, 0x303, 0x308, 0x0, 0x4f, 0x304, 0x0, 0x4f, 0x304, 0x300, 0x0, 0x4f, 0x304, 0x301, 0x0, 0x4f, 0x306, 0x0, 0x4f, 0x307, 0x0, 0x4f, 0x307, 0x304, 0x0, 0x4f, 0x308, 0x0, 0x4f, 0x308, 0x304, 0x0, 0x4f, 0x309, 0x0, 0x4f, 0x30b, 0x0, 0x4f, 0x30c, 0x0, 0x4f, 0x30f, 0x0, 0x4f, 0x311, 0x0, 0x4f, 0x31b, 0x0, 0x4f, 0x31b, 0x300, 0x0, 0x4f, 0x31b, 0x301, 0x0, 0x4f, 0x31b, 0x303, 0x0, 0x4f, 0x31b, 0x309, 0x0, 0x4f, 0x31b, 0x323, 0x0, 0x4f, 0x323, 0x0, 0x4f, 0x323, 0x302, 0x0, 0x4f, 0x328, 0x0, 0x4f, 0x328, 0x304, 0x0, 0x50, 0x0, 0x50, 0x48, 0x0, 0x50, 0x50, 0x4d, 0x0, 0x50, 0x50, 0x56, 0x0, 0x50, 0x52, 0x0, 0x50, 0x54, 0x45, 0x0, 0x50, 0x61, 0x0, 0x50, 0x301, 0x0, 0x50, 0x307, 0x0, 0x51, 0x0, 0x52, 0x0, 0x52, 0x73, 0x0, 0x52, 0x301, 0x0, 0x52, 0x307, 0x0, 0x52, 0x30c, 0x0, 0x52, 0x30f, 0x0, 0x52, 0x311, 0x0, 0x52, 0x323, 0x0, 0x52, 0x323, 0x304, 0x0, 0x52, 0x327, 0x0, 0x52, 0x331, 0x0, 0x53, 0x0, 0x53, 0x44, 0x0, 0x53, 0x4d, 0x0, 0x53, 0x53, 0x0, 0x53, 0x76, 0x0, 0x53, 0x301, 0x0, 0x53, 0x301, 0x307, 0x0, 0x53, 0x302, 0x0, 0x53, 0x307, 0x0, 0x53, 0x30c, 0x0, 0x53, 0x30c, 0x307, 0x0, 0x53, 0x323, 0x0, 0x53, 0x323, 0x307, 0x0, 0x53, 0x326, 0x0, 0x53, 0x327, 0x0, 0x54, 0x0, 0x54, 0x45, 0x4c, 0x0, 0x54, 0x48, 0x7a, 0x0, 0x54, 0x4d, 0x0, 0x54, 0x307, 0x0, 0x54, 0x30c, 0x0, 0x54, 0x323, 0x0, 0x54, 0x326, 0x0, 0x54, 0x327, 0x0, 0x54, 0x32d, 0x0, 0x54, 0x331, 0x0, 0x55, 0x0, 0x55, 0x300, 0x0, 0x55, 0x301, 0x0, 0x55, 0x302, 0x0, 0x55, 0x303, 0x0, 0x55, 0x303, 0x301, 0x0, 0x55, 0x304, 0x0, 0x55, 0x304, 0x308, 0x0, 0x55, 0x306, 0x0, 0x55, 0x308, 0x0, 0x55, 0x308, 0x300, 0x0, 0x55, 0x308, 0x301, 0x0, 0x55, 0x308, 0x304, 0x0, 0x55, 0x308, 0x30c, 0x0, 0x55, 0x309, 0x0, 0x55, 0x30a, 0x0, 0x55, 0x30b, 0x0, 0x55, 0x30c, 0x0, 0x55, 0x30f, 0x0, 0x55, 0x311, 0x0, 0x55, 0x31b, 0x0, 0x55, 0x31b, 0x300, 0x0, 0x55, 0x31b, 0x301, 0x0, 0x55, 0x31b, 0x303, 0x0, 0x55, 0x31b, 0x309, 0x0, 0x55, 0x31b, 0x323, 0x0, 0x55, 0x323, 0x0, 0x55, 0x324, 0x0, 0x55, 0x328, 0x0, 0x55, 0x32d, 0x0, 0x55, 0x330, 0x0, 0x56, 0x0, 0x56, 0x49, 0x0, 0x56, 0x49, 0x49, 0x0, 0x56, 0x49, 0x49, 0x49, 0x0, 0x56, 0x303, 0x0, 0x56, 0x323, 0x0, 0x56, 0x2215, 0x6d, 0x0, 0x57, 0x0, 0x57, 0x43, 0x0, 0x57, 0x5a, 0x0, 0x57, 0x62, 0x0, 0x57, 0x300, 0x0, 0x57, 0x301, 0x0, 0x57, 0x302, 0x0, 0x57, 0x307, 0x0, 0x57, 0x308, 0x0, 0x57, 0x323, 0x0, 0x58, 0x0, 0x58, 0x49, 0x0, 0x58, 0x49, 0x49, 0x0, 0x58, 0x307, 0x0, 0x58, 0x308, 0x0, 0x59, 0x0, 0x59, 0x300, 0x0, 0x59, 0x301, 0x0, 0x59, 0x302, 0x0, 0x59, 0x303, 0x0, 0x59, 0x304, 0x0, 0x59, 0x307, 0x0, 0x59, 0x308, 0x0, 0x59, 0x309, 0x0, 0x59, 0x323, 0x0, 0x5a, 0x0, 0x5a, 0x301, 0x0, 0x5a, 0x302, 0x0, 0x5a, 0x307, 0x0, 0x5a, 0x30c, 0x0, 0x5a, 0x323, 0x0, 0x5a, 0x331, 0x0, 0x5b, 0x0, 0x5c, 0x0, 0x5d, 0x0, 0x5e, 0x0, 0x5f, 0x0, 0x60, 0x0, 0x61, 0x0, 0x61, 0x2e, 0x6d, 0x2e, 0x0, 0x61, 0x2f, 0x63, 0x0, 0x61, 0x2f, 0x73, 0x0, 0x61, 0x2be, 0x0, 0x61, 0x300, 0x0, 0x61, 0x301, 0x0, 0x61, 0x302, 0x0, 0x61, 0x302, 0x300, 0x0, 0x61, 0x302, 0x301, 0x0, 0x61, 0x302, 0x303, 0x0, 0x61, 0x302, 0x309, 0x0, 0x61, 0x303, 0x0, 0x61, 0x304, 0x0, 0x61, 0x306, 0x0, 0x61, 0x306, 0x300, 0x0, 0x61, 0x306, 0x301, 0x0, 0x61, 0x306, 0x303, 0x0, 0x61, 0x306, 0x309, 0x0, 0x61, 0x307, 0x0, 0x61, 0x307, 0x304, 0x0, 0x61, 0x308, 0x0, 0x61, 0x308, 0x304, 0x0, 0x61, 0x309, 0x0, 0x61, 0x30a, 0x0, 0x61, 0x30a, 0x301, 0x0, 0x61, 0x30c, 0x0, 0x61, 0x30f, 0x0, 0x61, 0x311, 0x0, 0x61, 0x323, 0x0, 0x61, 0x323, 0x302, 0x0, 0x61, 0x323, 0x306, 0x0, 0x61, 0x325, 0x0, 0x61, 0x328, 0x0, 0x62, 0x0, 0x62, 0x61, 0x72, 0x0, 0x62, 0x307, 0x0, 0x62, 0x323, 0x0, 0x62, 0x331, 0x0, 0x63, 0x0, 0x63, 0x2f, 0x6f, 0x0, 0x63, 0x2f, 0x75, 0x0, 0x63, 0x61, 0x6c, 0x0, 0x63, 0x63, 0x0, 0x63, 0x64, 0x0, 0x63, 0x6d, 0x0, 0x63, 0x6d, 0x32, 0x0, 0x63, 0x6d, 0x33, 0x0, 0x63, 0x301, 0x0, 0x63, 0x302, 0x0, 0x63, 0x307, 0x0, 0x63, 0x30c, 0x0, 0x63, 0x327, 0x0, 0x63, 0x327, 0x301, 0x0, 0x64, 0x0, 0x64, 0x42, 0x0, 0x64, 0x61, 0x0, 0x64, 0x6c, 0x0, 0x64, 0x6d, 0x0, 0x64, 0x6d, 0x32, 0x0, 0x64, 0x6d, 0x33, 0x0, 0x64, 0x7a, 0x0, 0x64, 0x7a, 0x30c, 0x0, 0x64, 0x307, 0x0, 0x64, 0x30c, 0x0, 0x64, 0x323, 0x0, 0x64, 0x327, 0x0, 0x64, 0x32d, 0x0, 0x64, 0x331, 0x0, 0x65, 0x0, 0x65, 0x56, 0x0, 0x65, 0x72, 0x67, 0x0, 0x65, 0x300, 0x0, 0x65, 0x301, 0x0, 0x65, 0x302, 0x0, 0x65, 0x302, 0x300, 0x0, 0x65, 0x302, 0x301, 0x0, 0x65, 0x302, 0x303, 0x0, 0x65, 0x302, 0x309, 0x0, 0x65, 0x303, 0x0, 0x65, 0x304, 0x0, 0x65, 0x304, 0x300, 0x0, 0x65, 0x304, 0x301, 0x0, 0x65, 0x306, 0x0, 0x65, 0x307, 0x0, 0x65, 0x308, 0x0, 0x65, 0x309, 0x0, 0x65, 0x30c, 0x0, 0x65, 0x30f, 0x0, 0x65, 0x311, 0x0, 0x65, 0x323, 0x0, 0x65, 0x323, 0x302, 0x0, 0x65, 0x327, 0x0, 0x65, 0x327, 0x306, 0x0, 0x65, 0x328, 0x0, 0x65, 0x32d, 0x0, 0x65, 0x330, 0x0, 0x66, 0x0, 0x66, 0x66, 0x0, 0x66, 0x66, 0x69, 0x0, 0x66, 0x66, 0x6c, 0x0, 0x66, 0x69, 0x0, 0x66, 0x6c, 0x0, 0x66, 0x6d, 0x0, 0x66, 0x307, 0x0, 0x67, 0x0, 0x67, 0x61, 0x6c, 0x0, 0x67, 0x301, 0x0, 0x67, 0x302, 0x0, 0x67, 0x304, 0x0, 0x67, 0x306, 0x0, 0x67, 0x307, 0x0, 0x67, 0x30c, 0x0, 0x67, 0x327, 0x0, 0x68, 0x0, 0x68, 0x50, 0x61, 0x0, 0x68, 0x61, 0x0, 0x68, 0x302, 0x0, 0x68, 0x307, 0x0, 0x68, 0x308, 0x0, 0x68, 0x30c, 0x0, 0x68, 0x323, 0x0, 0x68, 0x327, 0x0, 0x68, 0x32e, 0x0, 0x68, 0x331, 0x0, 0x69, 0x0, 0x69, 0x69, 0x0, 0x69, 0x69, 0x69, 0x0, 0x69, 0x6a, 0x0, 0x69, 0x6e, 0x0, 0x69, 0x76, 0x0, 0x69, 0x78, 0x0, 0x69, 0x300, 0x0, 0x69, 0x301, 0x0, 0x69, 0x302, 0x0, 0x69, 0x303, 0x0, 0x69, 0x304, 0x0, 0x69, 0x306, 0x0, 0x69, 0x308, 0x0, 0x69, 0x308, 0x301, 0x0, 0x69, 0x309, 0x0, 0x69, 0x30c, 0x0, 0x69, 0x30f, 0x0, 0x69, 0x311, 0x0, 0x69, 0x323, 0x0, 0x69, 0x328, 0x0, 0x69, 0x330, 0x0, 0x6a, 0x0, 0x6a, 0x302, 0x0, 0x6a, 0x30c, 0x0, 0x6b, 0x0, 0x6b, 0x41, 0x0, 0x6b, 0x48, 0x7a, 0x0, 0x6b, 0x50, 0x61, 0x0, 0x6b, 0x56, 0x0, 0x6b, 0x57, 0x0, 0x6b, 0x63, 0x61, 0x6c, 0x0, 0x6b, 0x67, 0x0, 0x6b, 0x6c, 0x0, 0x6b, 0x6d, 0x0, 0x6b, 0x6d, 0x32, 0x0, 0x6b, 0x6d, 0x33, 0x0, 0x6b, 0x74, 0x0, 0x6b, 0x301, 0x0, 0x6b, 0x30c, 0x0, 0x6b, 0x323, 0x0, 0x6b, 0x327, 0x0, 0x6b, 0x331, 0x0, 0x6b, 0x3a9, 0x0, 0x6c, 0x0, 0x6c, 0x6a, 0x0, 0x6c, 0x6d, 0x0, 0x6c, 0x6e, 0x0, 0x6c, 0x6f, 0x67, 0x0, 0x6c, 0x78, 0x0, 0x6c, 0xb7, 0x0, 0x6c, 0x301, 0x0, 0x6c, 0x30c, 0x0, 0x6c, 0x323, 0x0, 0x6c, 0x323, 0x304, 0x0, 0x6c, 0x327, 0x0, 0x6c, 0x32d, 0x0, 0x6c, 0x331, 0x0, 0x6d, 0x0, 0x6d, 0x32, 0x0, 0x6d, 0x33, 0x0, 0x6d, 0x41, 0x0, 0x6d, 0x56, 0x0, 0x6d, 0x57, 0x0, 0x6d, 0x62, 0x0, 0x6d, 0x67, 0x0, 0x6d, 0x69, 0x6c, 0x0, 0x6d, 0x6c, 0x0, 0x6d, 0x6d, 0x0, 0x6d, 0x6d, 0x32, 0x0, 0x6d, 0x6d, 0x33, 0x0, 0x6d, 0x6f, 0x6c, 0x0, 0x6d, 0x73, 0x0, 0x6d, 0x301, 0x0, 0x6d, 0x307, 0x0, 0x6d, 0x323, 0x0, 0x6d, 0x2215, 0x73, 0x0, 0x6d, 0x2215, 0x73, 0x32, 0x0, 0x6e, 0x0, 0x6e, 0x41, 0x0, 0x6e, 0x46, 0x0, 0x6e, 0x56, 0x0, 0x6e, 0x57, 0x0, 0x6e, 0x6a, 0x0, 0x6e, 0x6d, 0x0, 0x6e, 0x73, 0x0, 0x6e, 0x300, 0x0, 0x6e, 0x301, 0x0, 0x6e, 0x303, 0x0, 0x6e, 0x307, 0x0, 0x6e, 0x30c, 0x0, 0x6e, 0x323, 0x0, 0x6e, 0x327, 0x0, 0x6e, 0x32d, 0x0, 0x6e, 0x331, 0x0, 0x6f, 0x0, 0x6f, 0x56, 0x0, 0x6f, 0x300, 0x0, 0x6f, 0x301, 0x0, 0x6f, 0x302, 0x0, 0x6f, 0x302, 0x300, 0x0, 0x6f, 0x302, 0x301, 0x0, 0x6f, 0x302, 0x303, 0x0, 0x6f, 0x302, 0x309, 0x0, 0x6f, 0x303, 0x0, 0x6f, 0x303, 0x301, 0x0, 0x6f, 0x303, 0x304, 0x0, 0x6f, 0x303, 0x308, 0x0, 0x6f, 0x304, 0x0, 0x6f, 0x304, 0x300, 0x0, 0x6f, 0x304, 0x301, 0x0, 0x6f, 0x306, 0x0, 0x6f, 0x307, 0x0, 0x6f, 0x307, 0x304, 0x0, 0x6f, 0x308, 0x0, 0x6f, 0x308, 0x304, 0x0, 0x6f, 0x309, 0x0, 0x6f, 0x30b, 0x0, 0x6f, 0x30c, 0x0, 0x6f, 0x30f, 0x0, 0x6f, 0x311, 0x0, 0x6f, 0x31b, 0x0, 0x6f, 0x31b, 0x300, 0x0, 0x6f, 0x31b, 0x301, 0x0, 0x6f, 0x31b, 0x303, 0x0, 0x6f, 0x31b, 0x309, 0x0, 0x6f, 0x31b, 0x323, 0x0, 0x6f, 0x323, 0x0, 0x6f, 0x323, 0x302, 0x0, 0x6f, 0x328, 0x0, 0x6f, 0x328, 0x304, 0x0, 0x70, 0x0, 0x70, 0x2e, 0x6d, 0x2e, 0x0, 0x70, 0x41, 0x0, 0x70, 0x46, 0x0, 0x70, 0x56, 0x0, 0x70, 0x57, 0x0, 0x70, 0x63, 0x0, 0x70, 0x73, 0x0, 0x70, 0x301, 0x0, 0x70, 0x307, 0x0, 0x71, 0x0, 0x72, 0x0, 0x72, 0x61, 0x64, 0x0, 0x72, 0x61, 0x64, 0x2215, 0x73, 0x0, 0x72, 0x61, 0x64, 0x2215, 0x73, 0x32, 0x0, 0x72, 0x301, 0x0, 0x72, 0x307, 0x0, 0x72, 0x30c, 0x0, 0x72, 0x30f, 0x0, 0x72, 0x311, 0x0, 0x72, 0x323, 0x0, 0x72, 0x323, 0x304, 0x0, 0x72, 0x327, 0x0, 0x72, 0x331, 0x0, 0x73, 0x0, 0x73, 0x72, 0x0, 0x73, 0x74, 0x0, 0x73, 0x301, 0x0, 0x73, 0x301, 0x307, 0x0, 0x73, 0x302, 0x0, 0x73, 0x307, 0x0, 0x73, 0x30c, 0x0, 0x73, 0x30c, 0x307, 0x0, 0x73, 0x323, 0x0, 0x73, 0x323, 0x307, 0x0, 0x73, 0x326, 0x0, 0x73, 0x327, 0x0, 0x74, 0x0, 0x74, 0x307, 0x0, 0x74, 0x308, 0x0, 0x74, 0x30c, 0x0, 0x74, 0x323, 0x0, 0x74, 0x326, 0x0, 0x74, 0x327, 0x0, 0x74, 0x32d, 0x0, 0x74, 0x331, 0x0, 0x75, 0x0, 0x75, 0x300, 0x0, 0x75, 0x301, 0x0, 0x75, 0x302, 0x0, 0x75, 0x303, 0x0, 0x75, 0x303, 0x301, 0x0, 0x75, 0x304, 0x0, 0x75, 0x304, 0x308, 0x0, 0x75, 0x306, 0x0, 0x75, 0x308, 0x0, 0x75, 0x308, 0x300, 0x0, 0x75, 0x308, 0x301, 0x0, 0x75, 0x308, 0x304, 0x0, 0x75, 0x308, 0x30c, 0x0, 0x75, 0x309, 0x0, 0x75, 0x30a, 0x0, 0x75, 0x30b, 0x0, 0x75, 0x30c, 0x0, 0x75, 0x30f, 0x0, 0x75, 0x311, 0x0, 0x75, 0x31b, 0x0, 0x75, 0x31b, 0x300, 0x0, 0x75, 0x31b, 0x301, 0x0, 0x75, 0x31b, 0x303, 0x0, 0x75, 0x31b, 0x309, 0x0, 0x75, 0x31b, 0x323, 0x0, 0x75, 0x323, 0x0, 0x75, 0x324, 0x0, 0x75, 0x328, 0x0, 0x75, 0x32d, 0x0, 0x75, 0x330, 0x0, 0x76, 0x0, 0x76, 0x69, 0x0, 0x76, 0x69, 0x69, 0x0, 0x76, 0x69, 0x69, 0x69, 0x0, 0x76, 0x303, 0x0, 0x76, 0x323, 0x0, 0x77, 0x0, 0x77, 0x300, 0x0, 0x77, 0x301, 0x0, 0x77, 0x302, 0x0, 0x77, 0x307, 0x0, 0x77, 0x308, 0x0, 0x77, 0x30a, 0x0, 0x77, 0x323, 0x0, 0x78, 0x0, 0x78, 0x69, 0x0, 0x78, 0x69, 0x69, 0x0, 0x78, 0x307, 0x0, 0x78, 0x308, 0x0, 0x79, 0x0, 0x79, 0x300, 0x0, 0x79, 0x301, 0x0, 0x79, 0x302, 0x0, 0x79, 0x303, 0x0, 0x79, 0x304, 0x0, 0x79, 0x307, 0x0, 0x79, 0x308, 0x0, 0x79, 0x309, 0x0, 0x79, 0x30a, 0x0, 0x79, 0x323, 0x0, 0x7a, 0x0, 0x7a, 0x301, 0x0, 0x7a, 0x302, 0x0, 0x7a, 0x307, 0x0, 0x7a, 0x30c, 0x0, 0x7a, 0x323, 0x0, 0x7a, 0x331, 0x0, 0x7b, 0x0, 0x7c, 0x0, 0x7d, 0x0, 0x7e, 0x0, 0xa2, 0x0, 0xa3, 0x0, 0xa5, 0x0, 0xa6, 0x0, 0xac, 0x0, 0xb0, 0x43, 0x0, 0xb0, 0x46, 0x0, 0xb7, 0x0, 0xc6, 0x0, 0xc6, 0x301, 0x0, 0xc6, 0x304, 0x0, 0xd8, 0x301, 0x0, 0xe6, 0x301, 0x0, 0xe6, 0x304, 0x0, 0xf0, 0x0, 0xf8, 0x301, 0x0, 0x126, 0x0, 0x127, 0x0, 0x131, 0x0, 0x14b, 0x0, 0x153, 0x0, 0x18e, 0x0, 0x190, 0x0, 0x1ab, 0x0, 0x1b7, 0x30c, 0x0, 0x222, 0x0, 0x237, 0x0, 0x250, 0x0, 0x251, 0x0, 0x252, 0x0, 0x254, 0x0, 0x255, 0x0, 0x259, 0x0, 0x25b, 0x0, 0x25c, 0x0, 0x25f, 0x0, 0x261, 0x0, 0x263, 0x0, 0x265, 0x0, 0x266, 0x0, 0x268, 0x0, 0x269, 0x0, 0x26a, 0x0, 0x26d, 0x0, 0x26f, 0x0, 0x270, 0x0, 0x271, 0x0, 0x272, 0x0, 0x273, 0x0, 0x274, 0x0, 0x275, 0x0, 0x278, 0x0, 0x279, 0x0, 0x27b, 0x0, 0x281, 0x0, 0x282, 0x0, 0x283, 0x0, 0x289, 0x0, 0x28a, 0x0, 0x28b, 0x0, 0x28c, 0x0, 0x290, 0x0, 0x291, 0x0, 0x292, 0x0, 0x292, 0x30c, 0x0, 0x295, 0x0, 0x29d, 0x0, 0x29f, 0x0, 0x2b9, 0x0, 0x2bc, 0x6e, 0x0, 0x300, 0x0, 0x301, 0x0, 0x308, 0x301, 0x0, 0x313, 0x0, 0x391, 0x0, 0x391, 0x300, 0x0, 0x391, 0x301, 0x0, 0x391, 0x304, 0x0, 0x391, 0x306, 0x0, 0x391, 0x313, 0x0, 0x391, 0x313, 0x300, 0x0, 0x391, 0x313, 0x300, 0x345, 0x0, 0x391, 0x313, 0x301, 0x0, 0x391, 0x313, 0x301, 0x345, 0x0, 0x391, 0x313, 0x342, 0x0, 0x391, 0x313, 0x342, 0x345, 0x0, 0x391, 0x313, 0x345, 0x0, 0x391, 0x314, 0x0, 0x391, 0x314, 0x300, 0x0, 0x391, 0x314, 0x300, 0x345, 0x0, 0x391, 0x314, 0x301, 0x0, 0x391, 0x314, 0x301, 0x345, 0x0, 0x391, 0x314, 0x342, 0x0, 0x391, 0x314, 0x342, 0x345, 0x0, 0x391, 0x314, 0x345, 0x0, 0x391, 0x345, 0x0, 0x392, 0x0, 0x393, 0x0, 0x394, 0x0, 0x395, 0x0, 0x395, 0x300, 0x0, 0x395, 0x301, 0x0, 0x395, 0x313, 0x0, 0x395, 0x313, 0x300, 0x0, 0x395, 0x313, 0x301, 0x0, 0x395, 0x314, 0x0, 0x395, 0x314, 0x300, 0x0, 0x395, 0x314, 0x301, 0x0, 0x396, 0x0, 0x397, 0x0, 0x397, 0x300, 0x0, 0x397, 0x301, 0x0, 0x397, 0x313, 0x0, 0x397, 0x313, 0x300, 0x0, 0x397, 0x313, 0x300, 0x345, 0x0, 0x397, 0x313, 0x301, 0x0, 0x397, 0x313, 0x301, 0x345, 0x0, 0x397, 0x313, 0x342, 0x0, 0x397, 0x313, 0x342, 0x345, 0x0, 0x397, 0x313, 0x345, 0x0, 0x397, 0x314, 0x0, 0x397, 0x314, 0x300, 0x0, 0x397, 0x314, 0x300, 0x345, 0x0, 0x397, 0x314, 0x301, 0x0, 0x397, 0x314, 0x301, 0x345, 0x0, 0x397, 0x314, 0x342, 0x0, 0x397, 0x314, 0x342, 0x345, 0x0, 0x397, 0x314, 0x345, 0x0, 0x397, 0x345, 0x0, 0x398, 0x0, 0x399, 0x0, 0x399, 0x300, 0x0, 0x399, 0x301, 0x0, 0x399, 0x304, 0x0, 0x399, 0x306, 0x0, 0x399, 0x308, 0x0, 0x399, 0x313, 0x0, 0x399, 0x313, 0x300, 0x0, 0x399, 0x313, 0x301, 0x0, 0x399, 0x313, 0x342, 0x0, 0x399, 0x314, 0x0, 0x399, 0x314, 0x300, 0x0, 0x399, 0x314, 0x301, 0x0, 0x399, 0x314, 0x342, 0x0, 0x39a, 0x0, 0x39b, 0x0, 0x39c, 0x0, 0x39d, 0x0, 0x39e, 0x0, 0x39f, 0x0, 0x39f, 0x300, 0x0, 0x39f, 0x301, 0x0, 0x39f, 0x313, 0x0, 0x39f, 0x313, 0x300, 0x0, 0x39f, 0x313, 0x301, 0x0, 0x39f, 0x314, 0x0, 0x39f, 0x314, 0x300, 0x0, 0x39f, 0x314, 0x301, 0x0, 0x3a0, 0x0, 0x3a1, 0x0, 0x3a1, 0x314, 0x0, 0x3a3, 0x0, 0x3a4, 0x0, 0x3a5, 0x0, 0x3a5, 0x300, 0x0, 0x3a5, 0x301, 0x0, 0x3a5, 0x304, 0x0, 0x3a5, 0x306, 0x0, 0x3a5, 0x308, 0x0, 0x3a5, 0x314, 0x0, 0x3a5, 0x314, 0x300, 0x0, 0x3a5, 0x314, 0x301, 0x0, 0x3a5, 0x314, 0x342, 0x0, 0x3a6, 0x0, 0x3a7, 0x0, 0x3a8, 0x0, 0x3a9, 0x0, 0x3a9, 0x300, 0x0, 0x3a9, 0x301, 0x0, 0x3a9, 0x313, 0x0, 0x3a9, 0x313, 0x300, 0x0, 0x3a9, 0x313, 0x300, 0x345, 0x0, 0x3a9, 0x313, 0x301, 0x0, 0x3a9, 0x313, 0x301, 0x345, 0x0, 0x3a9, 0x313, 0x342, 0x0, 0x3a9, 0x313, 0x342, 0x345, 0x0, 0x3a9, 0x313, 0x345, 0x0, 0x3a9, 0x314, 0x0, 0x3a9, 0x314, 0x300, 0x0, 0x3a9, 0x314, 0x300, 0x345, 0x0, 0x3a9, 0x314, 0x301, 0x0, 0x3a9, 0x314, 0x301, 0x345, 0x0, 0x3a9, 0x314, 0x342, 0x0, 0x3a9, 0x314, 0x342, 0x345, 0x0, 0x3a9, 0x314, 0x345, 0x0, 0x3a9, 0x345, 0x0, 0x3b1, 0x0, 0x3b1, 0x300, 0x0, 0x3b1, 0x300, 0x345, 0x0, 0x3b1, 0x301, 0x0, 0x3b1, 0x301, 0x345, 0x0, 0x3b1, 0x304, 0x0, 0x3b1, 0x306, 0x0, 0x3b1, 0x313, 0x0, 0x3b1, 0x313, 0x300, 0x0, 0x3b1, 0x313, 0x300, 0x345, 0x0, 0x3b1, 0x313, 0x301, 0x0, 0x3b1, 0x313, 0x301, 0x345, 0x0, 0x3b1, 0x313, 0x342, 0x0, 0x3b1, 0x313, 0x342, 0x345, 0x0, 0x3b1, 0x313, 0x345, 0x0, 0x3b1, 0x314, 0x0, 0x3b1, 0x314, 0x300, 0x0, 0x3b1, 0x314, 0x300, 0x345, 0x0, 0x3b1, 0x314, 0x301, 0x0, 0x3b1, 0x314, 0x301, 0x345, 0x0, 0x3b1, 0x314, 0x342, 0x0, 0x3b1, 0x314, 0x342, 0x345, 0x0, 0x3b1, 0x314, 0x345, 0x0, 0x3b1, 0x342, 0x0, 0x3b1, 0x342, 0x345, 0x0, 0x3b1, 0x345, 0x0, 0x3b2, 0x0, 0x3b3, 0x0, 0x3b4, 0x0, 0x3b5, 0x0, 0x3b5, 0x300, 0x0, 0x3b5, 0x301, 0x0, 0x3b5, 0x313, 0x0, 0x3b5, 0x313, 0x300, 0x0, 0x3b5, 0x313, 0x301, 0x0, 0x3b5, 0x314, 0x0, 0x3b5, 0x314, 0x300, 0x0, 0x3b5, 0x314, 0x301, 0x0, 0x3b6, 0x0, 0x3b7, 0x0, 0x3b7, 0x300, 0x0, 0x3b7, 0x300, 0x345, 0x0, 0x3b7, 0x301, 0x0, 0x3b7, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x0, 0x3b7, 0x313, 0x300, 0x0, 0x3b7, 0x313, 0x300, 0x345, 0x0, 0x3b7, 0x313, 0x301, 0x0, 0x3b7, 0x313, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x342, 0x0, 0x3b7, 0x313, 0x342, 0x345, 0x0, 0x3b7, 0x313, 0x345, 0x0, 0x3b7, 0x314, 0x0, 0x3b7, 0x314, 0x300, 0x0, 0x3b7, 0x314, 0x300, 0x345, 0x0, 0x3b7, 0x314, 0x301, 0x0, 0x3b7, 0x314, 0x301, 0x345, 0x0, 0x3b7, 0x314, 0x342, 0x0, 0x3b7, 0x314, 0x342, 0x345, 0x0, 0x3b7, 0x314, 0x345, 0x0, 0x3b7, 0x342, 0x0, 0x3b7, 0x342, 0x345, 0x0, 0x3b7, 0x345, 0x0, 0x3b8, 0x0, 0x3b9, 0x0, 0x3b9, 0x300, 0x0, 0x3b9, 0x301, 0x0, 0x3b9, 0x304, 0x0, 0x3b9, 0x306, 0x0, 0x3b9, 0x308, 0x0, 0x3b9, 0x308, 0x300, 0x0, 0x3b9, 0x308, 0x301, 0x0, 0x3b9, 0x308, 0x342, 0x0, 0x3b9, 0x313, 0x0, 0x3b9, 0x313, 0x300, 0x0, 0x3b9, 0x313, 0x301, 0x0, 0x3b9, 0x313, 0x342, 0x0, 0x3b9, 0x314, 0x0, 0x3b9, 0x314, 0x300, 0x0, 0x3b9, 0x314, 0x301, 0x0, 0x3b9, 0x314, 0x342, 0x0, 0x3b9, 0x342, 0x0, 0x3ba, 0x0, 0x3bb, 0x0, 0x3bc, 0x0, 0x3bc, 0x41, 0x0, 0x3bc, 0x46, 0x0, 0x3bc, 0x56, 0x0, 0x3bc, 0x57, 0x0, 0x3bc, 0x67, 0x0, 0x3bc, 0x6c, 0x0, 0x3bc, 0x6d, 0x0, 0x3bc, 0x73, 0x0, 0x3bd, 0x0, 0x3be, 0x0, 0x3bf, 0x0, 0x3bf, 0x300, 0x0, 0x3bf, 0x301, 0x0, 0x3bf, 0x313, 0x0, 0x3bf, 0x313, 0x300, 0x0, 0x3bf, 0x313, 0x301, 0x0, 0x3bf, 0x314, 0x0, 0x3bf, 0x314, 0x300, 0x0, 0x3bf, 0x314, 0x301, 0x0, 0x3c0, 0x0, 0x3c1, 0x0, 0x3c1, 0x313, 0x0, 0x3c1, 0x314, 0x0, 0x3c2, 0x0, 0x3c3, 0x0, 0x3c4, 0x0, 0x3c5, 0x0, 0x3c5, 0x300, 0x0, 0x3c5, 0x301, 0x0, 0x3c5, 0x304, 0x0, 0x3c5, 0x306, 0x0, 0x3c5, 0x308, 0x0, 0x3c5, 0x308, 0x300, 0x0, 0x3c5, 0x308, 0x301, 0x0, 0x3c5, 0x308, 0x342, 0x0, 0x3c5, 0x313, 0x0, 0x3c5, 0x313, 0x300, 0x0, 0x3c5, 0x313, 0x301, 0x0, 0x3c5, 0x313, 0x342, 0x0, 0x3c5, 0x314, 0x0, 0x3c5, 0x314, 0x300, 0x0, 0x3c5, 0x314, 0x301, 0x0, 0x3c5, 0x314, 0x342, 0x0, 0x3c5, 0x342, 0x0, 0x3c6, 0x0, 0x3c7, 0x0, 0x3c8, 0x0, 0x3c9, 0x0, 0x3c9, 0x300, 0x0, 0x3c9, 0x300, 0x345, 0x0, 0x3c9, 0x301, 0x0, 0x3c9, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x0, 0x3c9, 0x313, 0x300, 0x0, 0x3c9, 0x313, 0x300, 0x345, 0x0, 0x3c9, 0x313, 0x301, 0x0, 0x3c9, 0x313, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x342, 0x0, 0x3c9, 0x313, 0x342, 0x345, 0x0, 0x3c9, 0x313, 0x345, 0x0, 0x3c9, 0x314, 0x0, 0x3c9, 0x314, 0x300, 0x0, 0x3c9, 0x314, 0x300, 0x345, 0x0, 0x3c9, 0x314, 0x301, 0x0, 0x3c9, 0x314, 0x301, 0x345, 0x0, 0x3c9, 0x314, 0x342, 0x0, 0x3c9, 0x314, 0x342, 0x345, 0x0, 0x3c9, 0x314, 0x345, 0x0, 0x3c9, 0x342, 0x0, 0x3c9, 0x342, 0x345, 0x0, 0x3c9, 0x345, 0x0, 0x3dc, 0x0, 0x3dd, 0x0, 0x406, 0x308, 0x0, 0x410, 0x306, 0x0, 0x410, 0x308, 0x0, 0x413, 0x301, 0x0, 0x415, 0x300, 0x0, 0x415, 0x306, 0x0, 0x415, 0x308, 0x0, 0x416, 0x306, 0x0, 0x416, 0x308, 0x0, 0x417, 0x308, 0x0, 0x418, 0x300, 0x0, 0x418, 0x304, 0x0, 0x418, 0x306, 0x0, 0x418, 0x308, 0x0, 0x41a, 0x301, 0x0, 0x41e, 0x308, 0x0, 0x423, 0x304, 0x0, 0x423, 0x306, 0x0, 0x423, 0x308, 0x0, 0x423, 0x30b, 0x0, 0x427, 0x308, 0x0, 0x42b, 0x308, 0x0, 0x42d, 0x308, 0x0, 0x430, 0x306, 0x0, 0x430, 0x308, 0x0, 0x433, 0x301, 0x0, 0x435, 0x300, 0x0, 0x435, 0x306, 0x0, 0x435, 0x308, 0x0, 0x436, 0x306, 0x0, 0x436, 0x308, 0x0, 0x437, 0x308, 0x0, 0x438, 0x300, 0x0, 0x438, 0x304, 0x0, 0x438, 0x306, 0x0, 0x438, 0x308, 0x0, 0x43a, 0x301, 0x0, 0x43d, 0x0, 0x43e, 0x308, 0x0, 0x443, 0x304, 0x0, 0x443, 0x306, 0x0, 0x443, 0x308, 0x0, 0x443, 0x30b, 0x0, 0x447, 0x308, 0x0, 0x44b, 0x308, 0x0, 0x44d, 0x308, 0x0, 0x456, 0x308, 0x0, 0x474, 0x30f, 0x0, 0x475, 0x30f, 0x0, 0x4d8, 0x308, 0x0, 0x4d9, 0x308, 0x0, 0x4e8, 0x308, 0x0, 0x4e9, 0x308, 0x0, 0x565, 0x582, 0x0, 0x574, 0x565, 0x0, 0x574, 0x56b, 0x0, 0x574, 0x56d, 0x0, 0x574, 0x576, 0x0, 0x57e, 0x576, 0x0, 0x5d0, 0x0, 0x5d0, 0x5b7, 0x0, 0x5d0, 0x5b8, 0x0, 0x5d0, 0x5bc, 0x0, 0x5d0, 0x5dc, 0x0, 0x5d1, 0x0, 0x5d1, 0x5bc, 0x0, 0x5d1, 0x5bf, 0x0, 0x5d2, 0x0, 0x5d2, 0x5bc, 0x0, 0x5d3, 0x0, 0x5d3, 0x5bc, 0x0, 0x5d4, 0x0, 0x5d4, 0x5bc, 0x0, 0x5d5, 0x5b9, 0x0, 0x5d5, 0x5bc, 0x0, 0x5d6, 0x5bc, 0x0, 0x5d8, 0x5bc, 0x0, 0x5d9, 0x5b4, 0x0, 0x5d9, 0x5bc, 0x0, 0x5da, 0x5bc, 0x0, 0x5db, 0x0, 0x5db, 0x5bc, 0x0, 0x5db, 0x5bf, 0x0, 0x5dc, 0x0, 0x5dc, 0x5bc, 0x0, 0x5dd, 0x0, 0x5de, 0x5bc, 0x0, 0x5e0, 0x5bc, 0x0, 0x5e1, 0x5bc, 0x0, 0x5e2, 0x0, 0x5e3, 0x5bc, 0x0, 0x5e4, 0x5bc, 0x0, 0x5e4, 0x5bf, 0x0, 0x5e6, 0x5bc, 0x0, 0x5e7, 0x5bc, 0x0, 0x5e8, 0x0, 0x5e8, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x5c1, 0x0, 0x5e9, 0x5bc, 0x5c2, 0x0, 0x5e9, 0x5c1, 0x0, 0x5e9, 0x5c2, 0x0, 0x5ea, 0x0, 0x5ea, 0x5bc, 0x0, 0x5f2, 0x5b7, 0x0, 0x621, 0x0, 0x627, 0x0, 0x627, 0x643, 0x628, 0x631, 0x0, 0x627, 0x644, 0x644, 0x647, 0x0, 0x627, 0x64b, 0x0, 0x627, 0x653, 0x0, 0x627, 0x654, 0x0, 0x627, 0x655, 0x0, 0x627, 0x674, 0x0, 0x628, 0x0, 0x628, 0x62c, 0x0, 0x628, 0x62d, 0x0, 0x628, 0x62d, 0x64a, 0x0, 0x628, 0x62e, 0x0, 0x628, 0x62e, 0x64a, 0x0, 0x628, 0x631, 0x0, 0x628, 0x632, 0x0, 0x628, 0x645, 0x0, 0x628, 0x646, 0x0, 0x628, 0x647, 0x0, 0x628, 0x649, 0x0, 0x628, 0x64a, 0x0, 0x629, 0x0, 0x62a, 0x0, 0x62a, 0x62c, 0x0, 0x62a, 0x62c, 0x645, 0x0, 0x62a, 0x62c, 0x649, 0x0, 0x62a, 0x62c, 0x64a, 0x0, 0x62a, 0x62d, 0x0, 0x62a, 0x62d, 0x62c, 0x0, 0x62a, 0x62d, 0x645, 0x0, 0x62a, 0x62e, 0x0, 0x62a, 0x62e, 0x645, 0x0, 0x62a, 0x62e, 0x649, 0x0, 0x62a, 0x62e, 0x64a, 0x0, 0x62a, 0x631, 0x0, 0x62a, 0x632, 0x0, 0x62a, 0x645, 0x0, 0x62a, 0x645, 0x62c, 0x0, 0x62a, 0x645, 0x62d, 0x0, 0x62a, 0x645, 0x62e, 0x0, 0x62a, 0x645, 0x649, 0x0, 0x62a, 0x645, 0x64a, 0x0, 0x62a, 0x646, 0x0, 0x62a, 0x647, 0x0, 0x62a, 0x649, 0x0, 0x62a, 0x64a, 0x0, 0x62b, 0x0, 0x62b, 0x62c, 0x0, 0x62b, 0x631, 0x0, 0x62b, 0x632, 0x0, 0x62b, 0x645, 0x0, 0x62b, 0x646, 0x0, 0x62b, 0x647, 0x0, 0x62b, 0x649, 0x0, 0x62b, 0x64a, 0x0, 0x62c, 0x0, 0x62c, 0x62d, 0x0, 0x62c, 0x62d, 0x649, 0x0, 0x62c, 0x62d, 0x64a, 0x0, 0x62c, 0x644, 0x20, 0x62c, 0x644, 0x627, 0x644, 0x647, 0x0, 0x62c, 0x645, 0x0, 0x62c, 0x645, 0x62d, 0x0, 0x62c, 0x645, 0x649, 0x0, 0x62c, 0x645, 0x64a, 0x0, 0x62c, 0x649, 0x0, 0x62c, 0x64a, 0x0, 0x62d, 0x0, 0x62d, 0x62c, 0x0, 0x62d, 0x62c, 0x64a, 0x0, 0x62d, 0x645, 0x0, 0x62d, 0x645, 0x649, 0x0, 0x62d, 0x645, 0x64a, 0x0, 0x62d, 0x649, 0x0, 0x62d, 0x64a, 0x0, 0x62e, 0x0, 0x62e, 0x62c, 0x0, 0x62e, 0x62d, 0x0, 0x62e, 0x645, 0x0, 0x62e, 0x649, 0x0, 0x62e, 0x64a, 0x0, 0x62f, 0x0, 0x630, 0x0, 0x630, 0x670, 0x0, 0x631, 0x0, 0x631, 0x633, 0x648, 0x644, 0x0, 0x631, 0x670, 0x0, 0x631, 0x6cc, 0x627, 0x644, 0x0, 0x632, 0x0, 0x633, 0x0, 0x633, 0x62c, 0x0, 0x633, 0x62c, 0x62d, 0x0, 0x633, 0x62c, 0x649, 0x0, 0x633, 0x62d, 0x0, 0x633, 0x62d, 0x62c, 0x0, 0x633, 0x62e, 0x0, 0x633, 0x62e, 0x649, 0x0, 0x633, 0x62e, 0x64a, 0x0, 0x633, 0x631, 0x0, 0x633, 0x645, 0x0, 0x633, 0x645, 0x62c, 0x0, 0x633, 0x645, 0x62d, 0x0, 0x633, 0x645, 0x645, 0x0, 0x633, 0x647, 0x0, 0x633, 0x649, 0x0, 0x633, 0x64a, 0x0, 0x634, 0x0, 0x634, 0x62c, 0x0, 0x634, 0x62c, 0x64a, 0x0, 0x634, 0x62d, 0x0, 0x634, 0x62d, 0x645, 0x0, 0x634, 0x62d, 0x64a, 0x0, 0x634, 0x62e, 0x0, 0x634, 0x631, 0x0, 0x634, 0x645, 0x0, 0x634, 0x645, 0x62e, 0x0, 0x634, 0x645, 0x645, 0x0, 0x634, 0x647, 0x0, 0x634, 0x649, 0x0, 0x634, 0x64a, 0x0, 0x635, 0x0, 0x635, 0x62d, 0x0, 0x635, 0x62d, 0x62d, 0x0, 0x635, 0x62d, 0x64a, 0x0, 0x635, 0x62e, 0x0, 0x635, 0x631, 0x0, 0x635, 0x644, 0x639, 0x645, 0x0, 0x635, 0x644, 0x649, 0x0, 0x635, 0x644, 0x649, 0x20, 0x627, 0x644, 0x644, 0x647, 0x20, 0x639, 0x644, 0x64a, 0x647, 0x20, 0x648, 0x633, 0x644, 0x645, 0x0, 0x635, 0x644, 0x6d2, 0x0, 0x635, 0x645, 0x0, 0x635, 0x645, 0x645, 0x0, 0x635, 0x649, 0x0, 0x635, 0x64a, 0x0, 0x636, 0x0, 0x636, 0x62c, 0x0, 0x636, 0x62d, 0x0, 0x636, 0x62d, 0x649, 0x0, 0x636, 0x62d, 0x64a, 0x0, 0x636, 0x62e, 0x0, 0x636, 0x62e, 0x645, 0x0, 0x636, 0x631, 0x0, 0x636, 0x645, 0x0, 0x636, 0x649, 0x0, 0x636, 0x64a, 0x0, 0x637, 0x0, 0x637, 0x62d, 0x0, 0x637, 0x645, 0x0, 0x637, 0x645, 0x62d, 0x0, 0x637, 0x645, 0x645, 0x0, 0x637, 0x645, 0x64a, 0x0, 0x637, 0x649, 0x0, 0x637, 0x64a, 0x0, 0x638, 0x0, 0x638, 0x645, 0x0, 0x639, 0x0, 0x639, 0x62c, 0x0, 0x639, 0x62c, 0x645, 0x0, 0x639, 0x644, 0x64a, 0x647, 0x0, 0x639, 0x645, 0x0, 0x639, 0x645, 0x645, 0x0, 0x639, 0x645, 0x649, 0x0, 0x639, 0x645, 0x64a, 0x0, 0x639, 0x649, 0x0, 0x639, 0x64a, 0x0, 0x63a, 0x0, 0x63a, 0x62c, 0x0, 0x63a, 0x645, 0x0, 0x63a, 0x645, 0x645, 0x0, 0x63a, 0x645, 0x649, 0x0, 0x63a, 0x645, 0x64a, 0x0, 0x63a, 0x649, 0x0, 0x63a, 0x64a, 0x0, 0x640, 0x64b, 0x0, 0x640, 0x64e, 0x0, 0x640, 0x64e, 0x651, 0x0, 0x640, 0x64f, 0x0, 0x640, 0x64f, 0x651, 0x0, 0x640, 0x650, 0x0, 0x640, 0x650, 0x651, 0x0, 0x640, 0x651, 0x0, 0x640, 0x652, 0x0, 0x641, 0x0, 0x641, 0x62c, 0x0, 0x641, 0x62d, 0x0, 0x641, 0x62e, 0x0, 0x641, 0x62e, 0x645, 0x0, 0x641, 0x645, 0x0, 0x641, 0x645, 0x64a, 0x0, 0x641, 0x649, 0x0, 0x641, 0x64a, 0x0, 0x642, 0x0, 0x642, 0x62d, 0x0, 0x642, 0x644, 0x6d2, 0x0, 0x642, 0x645, 0x0, 0x642, 0x645, 0x62d, 0x0, 0x642, 0x645, 0x645, 0x0, 0x642, 0x645, 0x64a, 0x0, 0x642, 0x649, 0x0, 0x642, 0x64a, 0x0, 0x643, 0x0, 0x643, 0x627, 0x0, 0x643, 0x62c, 0x0, 0x643, 0x62d, 0x0, 0x643, 0x62e, 0x0, 0x643, 0x644, 0x0, 0x643, 0x645, 0x0, 0x643, 0x645, 0x645, 0x0, 0x643, 0x645, 0x64a, 0x0, 0x643, 0x649, 0x0, 0x643, 0x64a, 0x0, 0x644, 0x0, 0x644, 0x627, 0x0, 0x644, 0x627, 0x653, 0x0, 0x644, 0x627, 0x654, 0x0, 0x644, 0x627, 0x655, 0x0, 0x644, 0x62c, 0x0, 0x644, 0x62c, 0x62c, 0x0, 0x644, 0x62c, 0x645, 0x0, 0x644, 0x62c, 0x64a, 0x0, 0x644, 0x62d, 0x0, 0x644, 0x62d, 0x645, 0x0, 0x644, 0x62d, 0x649, 0x0, 0x644, 0x62d, 0x64a, 0x0, 0x644, 0x62e, 0x0, 0x644, 0x62e, 0x645, 0x0, 0x644, 0x645, 0x0, 0x644, 0x645, 0x62d, 0x0, 0x644, 0x645, 0x64a, 0x0, 0x644, 0x647, 0x0, 0x644, 0x649, 0x0, 0x644, 0x64a, 0x0, 0x645, 0x0, 0x645, 0x627, 0x0, 0x645, 0x62c, 0x0, 0x645, 0x62c, 0x62d, 0x0, 0x645, 0x62c, 0x62e, 0x0, 0x645, 0x62c, 0x645, 0x0, 0x645, 0x62c, 0x64a, 0x0, 0x645, 0x62d, 0x0, 0x645, 0x62d, 0x62c, 0x0, 0x645, 0x62d, 0x645, 0x0, 0x645, 0x62d, 0x645, 0x62f, 0x0, 0x645, 0x62d, 0x64a, 0x0, 0x645, 0x62e, 0x0, 0x645, 0x62e, 0x62c, 0x0, 0x645, 0x62e, 0x645, 0x0, 0x645, 0x62e, 0x64a, 0x0, 0x645, 0x645, 0x0, 0x645, 0x645, 0x64a, 0x0, 0x645, 0x649, 0x0, 0x645, 0x64a, 0x0, 0x646, 0x0, 0x646, 0x62c, 0x0, 0x646, 0x62c, 0x62d, 0x0, 0x646, 0x62c, 0x645, 0x0, 0x646, 0x62c, 0x649, 0x0, 0x646, 0x62c, 0x64a, 0x0, 0x646, 0x62d, 0x0, 0x646, 0x62d, 0x645, 0x0, 0x646, 0x62d, 0x649, 0x0, 0x646, 0x62d, 0x64a, 0x0, 0x646, 0x62e, 0x0, 0x646, 0x631, 0x0, 0x646, 0x632, 0x0, 0x646, 0x645, 0x0, 0x646, 0x645, 0x649, 0x0, 0x646, 0x645, 0x64a, 0x0, 0x646, 0x646, 0x0, 0x646, 0x647, 0x0, 0x646, 0x649, 0x0, 0x646, 0x64a, 0x0, 0x647, 0x0, 0x647, 0x62c, 0x0, 0x647, 0x645, 0x0, 0x647, 0x645, 0x62c, 0x0, 0x647, 0x645, 0x645, 0x0, 0x647, 0x649, 0x0, 0x647, 0x64a, 0x0, 0x647, 0x670, 0x0, 0x648, 0x0, 0x648, 0x633, 0x644, 0x645, 0x0, 0x648, 0x654, 0x0, 0x648, 0x674, 0x0, 0x649, 0x0, 0x649, 0x670, 0x0, 0x64a, 0x0, 0x64a, 0x62c, 0x0, 0x64a, 0x62c, 0x64a, 0x0, 0x64a, 0x62d, 0x0, 0x64a, 0x62d, 0x64a, 0x0, 0x64a, 0x62e, 0x0, 0x64a, 0x631, 0x0, 0x64a, 0x632, 0x0, 0x64a, 0x645, 0x0, 0x64a, 0x645, 0x645, 0x0, 0x64a, 0x645, 0x64a, 0x0, 0x64a, 0x646, 0x0, 0x64a, 0x647, 0x0, 0x64a, 0x649, 0x0, 0x64a, 0x64a, 0x0, 0x64a, 0x654, 0x0, 0x64a, 0x654, 0x627, 0x0, 0x64a, 0x654, 0x62c, 0x0, 0x64a, 0x654, 0x62d, 0x0, 0x64a, 0x654, 0x62e, 0x0, 0x64a, 0x654, 0x631, 0x0, 0x64a, 0x654, 0x632, 0x0, 0x64a, 0x654, 0x645, 0x0, 0x64a, 0x654, 0x646, 0x0, 0x64a, 0x654, 0x647, 0x0, 0x64a, 0x654, 0x648, 0x0, 0x64a, 0x654, 0x649, 0x0, 0x64a, 0x654, 0x64a, 0x0, 0x64a, 0x654, 0x6c6, 0x0, 0x64a, 0x654, 0x6c7, 0x0, 0x64a, 0x654, 0x6c8, 0x0, 0x64a, 0x654, 0x6d0, 0x0, 0x64a, 0x654, 0x6d5, 0x0, 0x64a, 0x674, 0x0, 0x66e, 0x0, 0x66f, 0x0, 0x671, 0x0, 0x679, 0x0, 0x67a, 0x0, 0x67b, 0x0, 0x67e, 0x0, 0x67f, 0x0, 0x680, 0x0, 0x683, 0x0, 0x684, 0x0, 0x686, 0x0, 0x687, 0x0, 0x688, 0x0, 0x68c, 0x0, 0x68d, 0x0, 0x68e, 0x0, 0x691, 0x0, 0x698, 0x0, 0x6a1, 0x0, 0x6a4, 0x0, 0x6a6, 0x0, 0x6a9, 0x0, 0x6ad, 0x0, 0x6af, 0x0, 0x6b1, 0x0, 0x6b3, 0x0, 0x6ba, 0x0, 0x6bb, 0x0, 0x6be, 0x0, 0x6c1, 0x0, 0x6c1, 0x654, 0x0, 0x6c5, 0x0, 0x6c6, 0x0, 0x6c7, 0x0, 0x6c7, 0x674, 0x0, 0x6c8, 0x0, 0x6c9, 0x0, 0x6cb, 0x0, 0x6cc, 0x0, 0x6d0, 0x0, 0x6d2, 0x0, 0x6d2, 0x654, 0x0, 0x6d5, 0x654, 0x0, 0x915, 0x93c, 0x0, 0x916, 0x93c, 0x0, 0x917, 0x93c, 0x0, 0x91c, 0x93c, 0x0, 0x921, 0x93c, 0x0, 0x922, 0x93c, 0x0, 0x928, 0x93c, 0x0, 0x92b, 0x93c, 0x0, 0x92f, 0x93c, 0x0, 0x930, 0x93c, 0x0, 0x933, 0x93c, 0x0, 0x9a1, 0x9bc, 0x0, 0x9a2, 0x9bc, 0x0, 0x9af, 0x9bc, 0x0, 0x9c7, 0x9be, 0x0, 0x9c7, 0x9d7, 0x0, 0xa16, 0xa3c, 0x0, 0xa17, 0xa3c, 0x0, 0xa1c, 0xa3c, 0x0, 0xa2b, 0xa3c, 0x0, 0xa32, 0xa3c, 0x0, 0xa38, 0xa3c, 0x0, 0xb21, 0xb3c, 0x0, 0xb22, 0xb3c, 0x0, 0xb47, 0xb3e, 0x0, 0xb47, 0xb56, 0x0, 0xb47, 0xb57, 0x0, 0xb92, 0xbd7, 0x0, 0xbc6, 0xbbe, 0x0, 0xbc6, 0xbd7, 0x0, 0xbc7, 0xbbe, 0x0, 0xc46, 0xc56, 0x0, 0xcbf, 0xcd5, 0x0, 0xcc6, 0xcc2, 0x0, 0xcc6, 0xcc2, 0xcd5, 0x0, 0xcc6, 0xcd5, 0x0, 0xcc6, 0xcd6, 0x0, 0xd46, 0xd3e, 0x0, 0xd46, 0xd57, 0x0, 0xd47, 0xd3e, 0x0, 0xdd9, 0xdca, 0x0, 0xdd9, 0xdcf, 0x0, 0xdd9, 0xdcf, 0xdca, 0x0, 0xdd9, 0xddf, 0x0, 0xe4d, 0xe32, 0x0, 0xeab, 0xe99, 0x0, 0xeab, 0xea1, 0x0, 0xecd, 0xeb2, 0x0, 0xf0b, 0x0, 0xf40, 0xfb5, 0x0, 0xf42, 0xfb7, 0x0, 0xf4c, 0xfb7, 0x0, 0xf51, 0xfb7, 0x0, 0xf56, 0xfb7, 0x0, 0xf5b, 0xfb7, 0x0, 0xf71, 0xf72, 0x0, 0xf71, 0xf74, 0x0, 0xf71, 0xf80, 0x0, 0xf90, 0xfb5, 0x0, 0xf92, 0xfb7, 0x0, 0xf9c, 0xfb7, 0x0, 0xfa1, 0xfb7, 0x0, 0xfa6, 0xfb7, 0x0, 0xfab, 0xfb7, 0x0, 0xfb2, 0xf71, 0xf80, 0x0, 0xfb2, 0xf80, 0x0, 0xfb3, 0xf71, 0xf80, 0x0, 0xfb3, 0xf80, 0x0, 0x1025, 0x102e, 0x0, 0x10dc, 0x0, 0x1100, 0x0, 0x1100, 0x1161, 0x0, 0x1101, 0x0, 0x1102, 0x0, 0x1102, 0x1161, 0x0, 0x1103, 0x0, 0x1103, 0x1161, 0x0, 0x1104, 0x0, 0x1105, 0x0, 0x1105, 0x1161, 0x0, 0x1106, 0x0, 0x1106, 0x1161, 0x0, 0x1107, 0x0, 0x1107, 0x1161, 0x0, 0x1108, 0x0, 0x1109, 0x0, 0x1109, 0x1161, 0x0, 0x110a, 0x0, 0x110b, 0x0, 0x110b, 0x1161, 0x0, 0x110b, 0x116e, 0x0, 0x110c, 0x0, 0x110c, 0x1161, 0x0, 0x110c, 0x116e, 0x110b, 0x1174, 0x0, 0x110d, 0x0, 0x110e, 0x0, 0x110e, 0x1161, 0x0, 0x110e, 0x1161, 0x11b7, 0x1100, 0x1169, 0x0, 0x110f, 0x0, 0x110f, 0x1161, 0x0, 0x1110, 0x0, 0x1110, 0x1161, 0x0, 0x1111, 0x0, 0x1111, 0x1161, 0x0, 0x1112, 0x0, 0x1112, 0x1161, 0x0, 0x1114, 0x0, 0x1115, 0x0, 0x111a, 0x0, 0x111c, 0x0, 0x111d, 0x0, 0x111e, 0x0, 0x1120, 0x0, 0x1121, 0x0, 0x1122, 0x0, 0x1123, 0x0, 0x1127, 0x0, 0x1129, 0x0, 0x112b, 0x0, 0x112c, 0x0, 0x112d, 0x0, 0x112e, 0x0, 0x112f, 0x0, 0x1132, 0x0, 0x1136, 0x0, 0x1140, 0x0, 0x1147, 0x0, 0x114c, 0x0, 0x1157, 0x0, 0x1158, 0x0, 0x1159, 0x0, 0x1160, 0x0, 0x1161, 0x0, 0x1162, 0x0, 0x1163, 0x0, 0x1164, 0x0, 0x1165, 0x0, 0x1166, 0x0, 0x1167, 0x0, 0x1168, 0x0, 0x1169, 0x0, 0x116a, 0x0, 0x116b, 0x0, 0x116c, 0x0, 0x116d, 0x0, 0x116e, 0x0, 0x116f, 0x0, 0x1170, 0x0, 0x1171, 0x0, 0x1172, 0x0, 0x1173, 0x0, 0x1174, 0x0, 0x1175, 0x0, 0x1184, 0x0, 0x1185, 0x0, 0x1188, 0x0, 0x1191, 0x0, 0x1192, 0x0, 0x1194, 0x0, 0x119e, 0x0, 0x11a1, 0x0, 0x11aa, 0x0, 0x11ac, 0x0, 0x11ad, 0x0, 0x11b0, 0x0, 0x11b1, 0x0, 0x11b2, 0x0, 0x11b3, 0x0, 0x11b4, 0x0, 0x11b5, 0x0, 0x11c7, 0x0, 0x11c8, 0x0, 0x11cc, 0x0, 0x11ce, 0x0, 0x11d3, 0x0, 0x11d7, 0x0, 0x11d9, 0x0, 0x11dd, 0x0, 0x11df, 0x0, 0x11f1, 0x0, 0x11f2, 0x0, 0x1b05, 0x1b35, 0x0, 0x1b07, 0x1b35, 0x0, 0x1b09, 0x1b35, 0x0, 0x1b0b, 0x1b35, 0x0, 0x1b0d, 0x1b35, 0x0, 0x1b11, 0x1b35, 0x0, 0x1b3a, 0x1b35, 0x0, 0x1b3c, 0x1b35, 0x0, 0x1b3e, 0x1b35, 0x0, 0x1b3f, 0x1b35, 0x0, 0x1b42, 0x1b35, 0x0, 0x1d02, 0x0, 0x1d16, 0x0, 0x1d17, 0x0, 0x1d1c, 0x0, 0x1d1d, 0x0, 0x1d25, 0x0, 0x1d7b, 0x0, 0x1d85, 0x0, 0x2010, 0x0, 0x2013, 0x0, 0x2014, 0x0, 0x2032, 0x2032, 0x0, 0x2032, 0x2032, 0x2032, 0x0, 0x2032, 0x2032, 0x2032, 0x2032, 0x0, 0x2035, 0x2035, 0x0, 0x2035, 0x2035, 0x2035, 0x0, 0x20a9, 0x0, 0x2190, 0x0, 0x2190, 0x338, 0x0, 0x2191, 0x0, 0x2192, 0x0, 0x2192, 0x338, 0x0, 0x2193, 0x0, 0x2194, 0x338, 0x0, 0x21d0, 0x338, 0x0, 0x21d2, 0x338, 0x0, 0x21d4, 0x338, 0x0, 0x2202, 0x0, 0x2203, 0x338, 0x0, 0x2207, 0x0, 0x2208, 0x338, 0x0, 0x220b, 0x338, 0x0, 0x2211, 0x0, 0x2212, 0x0, 0x2223, 0x338, 0x0, 0x2225, 0x338, 0x0, 0x222b, 0x222b, 0x0, 0x222b, 0x222b, 0x222b, 0x0, 0x222b, 0x222b, 0x222b, 0x222b, 0x0, 0x222e, 0x222e, 0x0, 0x222e, 0x222e, 0x222e, 0x0, 0x223c, 0x338, 0x0, 0x2243, 0x338, 0x0, 0x2245, 0x338, 0x0, 0x2248, 0x338, 0x0, 0x224d, 0x338, 0x0, 0x2261, 0x338, 0x0, 0x2264, 0x338, 0x0, 0x2265, 0x338, 0x0, 0x2272, 0x338, 0x0, 0x2273, 0x338, 0x0, 0x2276, 0x338, 0x0, 0x2277, 0x338, 0x0, 0x227a, 0x338, 0x0, 0x227b, 0x338, 0x0, 0x227c, 0x338, 0x0, 0x227d, 0x338, 0x0, 0x2282, 0x338, 0x0, 0x2283, 0x338, 0x0, 0x2286, 0x338, 0x0, 0x2287, 0x338, 0x0, 0x2291, 0x338, 0x0, 0x2292, 0x338, 0x0, 0x22a2, 0x338, 0x0, 0x22a8, 0x338, 0x0, 0x22a9, 0x338, 0x0, 0x22ab, 0x338, 0x0, 0x22b2, 0x338, 0x0, 0x22b3, 0x338, 0x0, 0x22b4, 0x338, 0x0, 0x22b5, 0x338, 0x0, 0x2502, 0x0, 0x25a0, 0x0, 0x25cb, 0x0, 0x2985, 0x0, 0x2986, 0x0, 0x2add, 0x338, 0x0, 0x2d61, 0x0, 0x3001, 0x0, 0x3002, 0x0, 0x3008, 0x0, 0x3009, 0x0, 0x300a, 0x0, 0x300b, 0x0, 0x300c, 0x0, 0x300d, 0x0, 0x300e, 0x0, 0x300f, 0x0, 0x3010, 0x0, 0x3011, 0x0, 0x3012, 0x0, 0x3014, 0x0, 0x3014, 0x53, 0x3015, 0x0, 0x3014, 0x4e09, 0x3015, 0x0, 0x3014, 0x4e8c, 0x3015, 0x0, 0x3014, 0x52dd, 0x3015, 0x0, 0x3014, 0x5b89, 0x3015, 0x0, 0x3014, 0x6253, 0x3015, 0x0, 0x3014, 0x6557, 0x3015, 0x0, 0x3014, 0x672c, 0x3015, 0x0, 0x3014, 0x70b9, 0x3015, 0x0, 0x3014, 0x76d7, 0x3015, 0x0, 0x3015, 0x0, 0x3016, 0x0, 0x3017, 0x0, 0x3046, 0x3099, 0x0, 0x304b, 0x3099, 0x0, 0x304d, 0x3099, 0x0, 0x304f, 0x3099, 0x0, 0x3051, 0x3099, 0x0, 0x3053, 0x3099, 0x0, 0x3055, 0x3099, 0x0, 0x3057, 0x3099, 0x0, 0x3059, 0x3099, 0x0, 0x305b, 0x3099, 0x0, 0x305d, 0x3099, 0x0, 0x305f, 0x3099, 0x0, 0x3061, 0x3099, 0x0, 0x3064, 0x3099, 0x0, 0x3066, 0x3099, 0x0, 0x3068, 0x3099, 0x0, 0x306f, 0x3099, 0x0, 0x306f, 0x309a, 0x0, 0x3072, 0x3099, 0x0, 0x3072, 0x309a, 0x0, 0x3075, 0x3099, 0x0, 0x3075, 0x309a, 0x0, 0x3078, 0x3099, 0x0, 0x3078, 0x309a, 0x0, 0x307b, 0x304b, 0x0, 0x307b, 0x3099, 0x0, 0x307b, 0x309a, 0x0, 0x3088, 0x308a, 0x0, 0x3099, 0x0, 0x309a, 0x0, 0x309d, 0x3099, 0x0, 0x30a1, 0x0, 0x30a2, 0x0, 0x30a2, 0x30cf, 0x309a, 0x30fc, 0x30c8, 0x0, 0x30a2, 0x30eb, 0x30d5, 0x30a1, 0x0, 0x30a2, 0x30f3, 0x30d8, 0x309a, 0x30a2, 0x0, 0x30a2, 0x30fc, 0x30eb, 0x0, 0x30a3, 0x0, 0x30a4, 0x0, 0x30a4, 0x30cb, 0x30f3, 0x30af, 0x3099, 0x0, 0x30a4, 0x30f3, 0x30c1, 0x0, 0x30a5, 0x0, 0x30a6, 0x0, 0x30a6, 0x3099, 0x0, 0x30a6, 0x30a9, 0x30f3, 0x0, 0x30a7, 0x0, 0x30a8, 0x0, 0x30a8, 0x30b9, 0x30af, 0x30fc, 0x30c8, 0x3099, 0x0, 0x30a8, 0x30fc, 0x30ab, 0x30fc, 0x0, 0x30a9, 0x0, 0x30aa, 0x0, 0x30aa, 0x30f3, 0x30b9, 0x0, 0x30aa, 0x30fc, 0x30e0, 0x0, 0x30ab, 0x0, 0x30ab, 0x3099, 0x0, 0x30ab, 0x3099, 0x30ed, 0x30f3, 0x0, 0x30ab, 0x3099, 0x30f3, 0x30de, 0x0, 0x30ab, 0x30a4, 0x30ea, 0x0, 0x30ab, 0x30e9, 0x30c3, 0x30c8, 0x0, 0x30ab, 0x30ed, 0x30ea, 0x30fc, 0x0, 0x30ad, 0x0, 0x30ad, 0x3099, 0x0, 0x30ad, 0x3099, 0x30ab, 0x3099, 0x0, 0x30ad, 0x3099, 0x30cb, 0x30fc, 0x0, 0x30ad, 0x3099, 0x30eb, 0x30bf, 0x3099, 0x30fc, 0x0, 0x30ad, 0x30e5, 0x30ea, 0x30fc, 0x0, 0x30ad, 0x30ed, 0x0, 0x30ad, 0x30ed, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x0, 0x30ad, 0x30ed, 0x30e1, 0x30fc, 0x30c8, 0x30eb, 0x0, 0x30ad, 0x30ed, 0x30ef, 0x30c3, 0x30c8, 0x0, 0x30af, 0x0, 0x30af, 0x3099, 0x0, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x0, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x30c8, 0x30f3, 0x0, 0x30af, 0x30eb, 0x30bb, 0x3099, 0x30a4, 0x30ed, 0x0, 0x30af, 0x30ed, 0x30fc, 0x30cd, 0x0, 0x30b1, 0x0, 0x30b1, 0x3099, 0x0, 0x30b1, 0x30fc, 0x30b9, 0x0, 0x30b3, 0x0, 0x30b3, 0x3099, 0x0, 0x30b3, 0x30b3, 0x0, 0x30b3, 0x30c8, 0x0, 0x30b3, 0x30eb, 0x30ca, 0x0, 0x30b3, 0x30fc, 0x30db, 0x309a, 0x0, 0x30b5, 0x0, 0x30b5, 0x3099, 0x0, 0x30b5, 0x30a4, 0x30af, 0x30eb, 0x0, 0x30b5, 0x30f3, 0x30c1, 0x30fc, 0x30e0, 0x0, 0x30b7, 0x0, 0x30b7, 0x3099, 0x0, 0x30b7, 0x30ea, 0x30f3, 0x30af, 0x3099, 0x0, 0x30b9, 0x0, 0x30b9, 0x3099, 0x0, 0x30bb, 0x0, 0x30bb, 0x3099, 0x0, 0x30bb, 0x30f3, 0x30c1, 0x0, 0x30bb, 0x30f3, 0x30c8, 0x0, 0x30bd, 0x0, 0x30bd, 0x3099, 0x0, 0x30bf, 0x0, 0x30bf, 0x3099, 0x0, 0x30bf, 0x3099, 0x30fc, 0x30b9, 0x0, 0x30c1, 0x0, 0x30c1, 0x3099, 0x0, 0x30c3, 0x0, 0x30c4, 0x0, 0x30c4, 0x3099, 0x0, 0x30c6, 0x0, 0x30c6, 0x3099, 0x0, 0x30c6, 0x3099, 0x30b7, 0x0, 0x30c8, 0x0, 0x30c8, 0x3099, 0x0, 0x30c8, 0x3099, 0x30eb, 0x0, 0x30c8, 0x30f3, 0x0, 0x30ca, 0x0, 0x30ca, 0x30ce, 0x0, 0x30cb, 0x0, 0x30cc, 0x0, 0x30cd, 0x0, 0x30ce, 0x0, 0x30ce, 0x30c3, 0x30c8, 0x0, 0x30cf, 0x0, 0x30cf, 0x3099, 0x0, 0x30cf, 0x3099, 0x30fc, 0x30ec, 0x30eb, 0x0, 0x30cf, 0x309a, 0x0, 0x30cf, 0x309a, 0x30fc, 0x30bb, 0x30f3, 0x30c8, 0x0, 0x30cf, 0x309a, 0x30fc, 0x30c4, 0x0, 0x30cf, 0x30a4, 0x30c4, 0x0, 0x30d2, 0x0, 0x30d2, 0x3099, 0x0, 0x30d2, 0x3099, 0x30eb, 0x0, 0x30d2, 0x309a, 0x0, 0x30d2, 0x309a, 0x30a2, 0x30b9, 0x30c8, 0x30eb, 0x0, 0x30d2, 0x309a, 0x30af, 0x30eb, 0x0, 0x30d2, 0x309a, 0x30b3, 0x0, 0x30d5, 0x0, 0x30d5, 0x3099, 0x0, 0x30d5, 0x3099, 0x30c3, 0x30b7, 0x30a7, 0x30eb, 0x0, 0x30d5, 0x309a, 0x0, 0x30d5, 0x30a1, 0x30e9, 0x30c3, 0x30c8, 0x3099, 0x0, 0x30d5, 0x30a3, 0x30fc, 0x30c8, 0x0, 0x30d5, 0x30e9, 0x30f3, 0x0, 0x30d8, 0x0, 0x30d8, 0x3099, 0x0, 0x30d8, 0x3099, 0x30fc, 0x30bf, 0x0, 0x30d8, 0x309a, 0x0, 0x30d8, 0x309a, 0x30bd, 0x0, 0x30d8, 0x309a, 0x30cb, 0x30d2, 0x0, 0x30d8, 0x309a, 0x30f3, 0x30b9, 0x0, 0x30d8, 0x309a, 0x30fc, 0x30b7, 0x3099, 0x0, 0x30d8, 0x30af, 0x30bf, 0x30fc, 0x30eb, 0x0, 0x30d8, 0x30eb, 0x30c4, 0x0, 0x30db, 0x0, 0x30db, 0x3099, 0x0, 0x30db, 0x3099, 0x30eb, 0x30c8, 0x0, 0x30db, 0x309a, 0x0, 0x30db, 0x309a, 0x30a4, 0x30f3, 0x30c8, 0x0, 0x30db, 0x309a, 0x30f3, 0x30c8, 0x3099, 0x0, 0x30db, 0x30f3, 0x0, 0x30db, 0x30fc, 0x30eb, 0x0, 0x30db, 0x30fc, 0x30f3, 0x0, 0x30de, 0x0, 0x30de, 0x30a4, 0x30af, 0x30ed, 0x0, 0x30de, 0x30a4, 0x30eb, 0x0, 0x30de, 0x30c3, 0x30cf, 0x0, 0x30de, 0x30eb, 0x30af, 0x0, 0x30de, 0x30f3, 0x30b7, 0x30e7, 0x30f3, 0x0, 0x30df, 0x0, 0x30df, 0x30af, 0x30ed, 0x30f3, 0x0, 0x30df, 0x30ea, 0x0, 0x30df, 0x30ea, 0x30cf, 0x3099, 0x30fc, 0x30eb, 0x0, 0x30e0, 0x0, 0x30e1, 0x0, 0x30e1, 0x30ab, 0x3099, 0x0, 0x30e1, 0x30ab, 0x3099, 0x30c8, 0x30f3, 0x0, 0x30e1, 0x30fc, 0x30c8, 0x30eb, 0x0, 0x30e2, 0x0, 0x30e3, 0x0, 0x30e4, 0x0, 0x30e4, 0x30fc, 0x30c8, 0x3099, 0x0, 0x30e4, 0x30fc, 0x30eb, 0x0, 0x30e5, 0x0, 0x30e6, 0x0, 0x30e6, 0x30a2, 0x30f3, 0x0, 0x30e7, 0x0, 0x30e8, 0x0, 0x30e9, 0x0, 0x30ea, 0x0, 0x30ea, 0x30c3, 0x30c8, 0x30eb, 0x0, 0x30ea, 0x30e9, 0x0, 0x30eb, 0x0, 0x30eb, 0x30d2, 0x309a, 0x30fc, 0x0, 0x30eb, 0x30fc, 0x30d5, 0x3099, 0x30eb, 0x0, 0x30ec, 0x0, 0x30ec, 0x30e0, 0x0, 0x30ec, 0x30f3, 0x30c8, 0x30b1, 0x3099, 0x30f3, 0x0, 0x30ed, 0x0, 0x30ef, 0x0, 0x30ef, 0x3099, 0x0, 0x30ef, 0x30c3, 0x30c8, 0x0, 0x30f0, 0x0, 0x30f0, 0x3099, 0x0, 0x30f1, 0x0, 0x30f1, 0x3099, 0x0, 0x30f2, 0x0, 0x30f2, 0x3099, 0x0, 0x30f3, 0x0, 0x30fb, 0x0, 0x30fc, 0x0, 0x30fd, 0x3099, 0x0, 0x349e, 0x0, 0x34b9, 0x0, 0x34bb, 0x0, 0x34df, 0x0, 0x3515, 0x0, 0x36ee, 0x0, 0x36fc, 0x0, 0x3781, 0x0, 0x382f, 0x0, 0x3862, 0x0, 0x387c, 0x0, 0x38c7, 0x0, 0x38e3, 0x0, 0x391c, 0x0, 0x393a, 0x0, 0x3a2e, 0x0, 0x3a6c, 0x0, 0x3ae4, 0x0, 0x3b08, 0x0, 0x3b19, 0x0, 0x3b49, 0x0, 0x3b9d, 0x0, 0x3c18, 0x0, 0x3c4e, 0x0, 0x3d33, 0x0, 0x3d96, 0x0, 0x3eac, 0x0, 0x3eb8, 0x0, 0x3f1b, 0x0, 0x3ffc, 0x0, 0x4008, 0x0, 0x4018, 0x0, 0x4039, 0x0, 0x4046, 0x0, 0x4096, 0x0, 0x40e3, 0x0, 0x412f, 0x0, 0x4202, 0x0, 0x4227, 0x0, 0x42a0, 0x0, 0x4301, 0x0, 0x4334, 0x0, 0x4359, 0x0, 0x43d5, 0x0, 0x43d9, 0x0, 0x440b, 0x0, 0x446b, 0x0, 0x452b, 0x0, 0x455d, 0x0, 0x4561, 0x0, 0x456b, 0x0, 0x45d7, 0x0, 0x45f9, 0x0, 0x4635, 0x0, 0x46be, 0x0, 0x46c7, 0x0, 0x4995, 0x0, 0x49e6, 0x0, 0x4a6e, 0x0, 0x4a76, 0x0, 0x4ab2, 0x0, 0x4b33, 0x0, 0x4bce, 0x0, 0x4cce, 0x0, 0x4ced, 0x0, 0x4cf8, 0x0, 0x4d56, 0x0, 0x4e00, 0x0, 0x4e01, 0x0, 0x4e03, 0x0, 0x4e09, 0x0, 0x4e0a, 0x0, 0x4e0b, 0x0, 0x4e0d, 0x0, 0x4e19, 0x0, 0x4e26, 0x0, 0x4e28, 0x0, 0x4e2d, 0x0, 0x4e32, 0x0, 0x4e36, 0x0, 0x4e38, 0x0, 0x4e39, 0x0, 0x4e3d, 0x0, 0x4e3f, 0x0, 0x4e41, 0x0, 0x4e59, 0x0, 0x4e5d, 0x0, 0x4e82, 0x0, 0x4e85, 0x0, 0x4e86, 0x0, 0x4e8c, 0x0, 0x4e94, 0x0, 0x4ea0, 0x0, 0x4ea4, 0x0, 0x4eae, 0x0, 0x4eba, 0x0, 0x4ec0, 0x0, 0x4ecc, 0x0, 0x4ee4, 0x0, 0x4f01, 0x0, 0x4f11, 0x0, 0x4f60, 0x0, 0x4f80, 0x0, 0x4f86, 0x0, 0x4f8b, 0x0, 0x4fae, 0x0, 0x4fbb, 0x0, 0x4fbf, 0x0, 0x5002, 0x0, 0x502b, 0x0, 0x507a, 0x0, 0x5099, 0x0, 0x50cf, 0x0, 0x50da, 0x0, 0x50e7, 0x0, 0x512a, 0x0, 0x513f, 0x0, 0x5140, 0x0, 0x5145, 0x0, 0x514d, 0x0, 0x5154, 0x0, 0x5164, 0x0, 0x5165, 0x0, 0x5167, 0x0, 0x5168, 0x0, 0x5169, 0x0, 0x516b, 0x0, 0x516d, 0x0, 0x5177, 0x0, 0x5180, 0x0, 0x5182, 0x0, 0x518d, 0x0, 0x5192, 0x0, 0x5195, 0x0, 0x5196, 0x0, 0x5197, 0x0, 0x5199, 0x0, 0x51a4, 0x0, 0x51ab, 0x0, 0x51ac, 0x0, 0x51b5, 0x0, 0x51b7, 0x0, 0x51c9, 0x0, 0x51cc, 0x0, 0x51dc, 0x0, 0x51de, 0x0, 0x51e0, 0x0, 0x51f5, 0x0, 0x5200, 0x0, 0x5203, 0x0, 0x5207, 0x0, 0x5217, 0x0, 0x521d, 0x0, 0x5229, 0x0, 0x523a, 0x0, 0x523b, 0x0, 0x5246, 0x0, 0x524d, 0x0, 0x5272, 0x0, 0x5277, 0x0, 0x5289, 0x0, 0x529b, 0x0, 0x52a3, 0x0, 0x52b3, 0x0, 0x52b4, 0x0, 0x52c7, 0x0, 0x52c9, 0x0, 0x52d2, 0x0, 0x52de, 0x0, 0x52e4, 0x0, 0x52f5, 0x0, 0x52f9, 0x0, 0x52fa, 0x0, 0x5305, 0x0, 0x5306, 0x0, 0x5315, 0x0, 0x5317, 0x0, 0x531a, 0x0, 0x5338, 0x0, 0x533b, 0x0, 0x533f, 0x0, 0x5341, 0x0, 0x5344, 0x0, 0x5345, 0x0, 0x5349, 0x0, 0x5351, 0x0, 0x5354, 0x0, 0x535a, 0x0, 0x535c, 0x0, 0x5369, 0x0, 0x5370, 0x0, 0x5373, 0x0, 0x5375, 0x0, 0x537d, 0x0, 0x537f, 0x0, 0x5382, 0x0, 0x53b6, 0x0, 0x53c3, 0x0, 0x53c8, 0x0, 0x53ca, 0x0, 0x53cc, 0x0, 0x53df, 0x0, 0x53e3, 0x0, 0x53e5, 0x0, 0x53eb, 0x0, 0x53ef, 0x0, 0x53f1, 0x0, 0x53f3, 0x0, 0x5406, 0x0, 0x5408, 0x0, 0x540d, 0x0, 0x540f, 0x0, 0x541d, 0x0, 0x5438, 0x0, 0x5439, 0x0, 0x5442, 0x0, 0x5448, 0x0, 0x5468, 0x0, 0x549e, 0x0, 0x54a2, 0x0, 0x54bd, 0x0, 0x54f6, 0x0, 0x5510, 0x0, 0x554f, 0x0, 0x5553, 0x0, 0x5555, 0x0, 0x5563, 0x0, 0x5584, 0x0, 0x5587, 0x0, 0x5599, 0x0, 0x559d, 0x0, 0x55ab, 0x0, 0x55b3, 0x0, 0x55b6, 0x0, 0x55c0, 0x0, 0x55c2, 0x0, 0x55e2, 0x0, 0x5606, 0x0, 0x5651, 0x0, 0x5668, 0x0, 0x5674, 0x0, 0x56d7, 0x0, 0x56db, 0x0, 0x56f9, 0x0, 0x5716, 0x0, 0x5717, 0x0, 0x571f, 0x0, 0x5730, 0x0, 0x578b, 0x0, 0x57ce, 0x0, 0x57f4, 0x0, 0x580d, 0x0, 0x5831, 0x0, 0x5832, 0x0, 0x5840, 0x0, 0x585a, 0x0, 0x585e, 0x0, 0x58a8, 0x0, 0x58ac, 0x0, 0x58b3, 0x0, 0x58d8, 0x0, 0x58df, 0x0, 0x58eb, 0x0, 0x58ee, 0x0, 0x58f0, 0x0, 0x58f2, 0x0, 0x58f7, 0x0, 0x5902, 0x0, 0x5906, 0x0, 0x590a, 0x0, 0x5915, 0x0, 0x591a, 0x0, 0x591c, 0x0, 0x5922, 0x0, 0x5927, 0x0, 0x5927, 0x6b63, 0x0, 0x5929, 0x0, 0x5944, 0x0, 0x5948, 0x0, 0x5951, 0x0, 0x5954, 0x0, 0x5962, 0x0, 0x5973, 0x0, 0x59d8, 0x0, 0x59ec, 0x0, 0x5a1b, 0x0, 0x5a27, 0x0, 0x5a62, 0x0, 0x5a66, 0x0, 0x5ab5, 0x0, 0x5b08, 0x0, 0x5b28, 0x0, 0x5b3e, 0x0, 0x5b50, 0x0, 0x5b57, 0x0, 0x5b66, 0x0, 0x5b80, 0x0, 0x5b85, 0x0, 0x5b97, 0x0, 0x5bc3, 0x0, 0x5bd8, 0x0, 0x5be7, 0x0, 0x5bee, 0x0, 0x5bf3, 0x0, 0x5bf8, 0x0, 0x5bff, 0x0, 0x5c06, 0x0, 0x5c0f, 0x0, 0x5c22, 0x0, 0x5c38, 0x0, 0x5c3f, 0x0, 0x5c60, 0x0, 0x5c62, 0x0, 0x5c64, 0x0, 0x5c65, 0x0, 0x5c6e, 0x0, 0x5c71, 0x0, 0x5c8d, 0x0, 0x5cc0, 0x0, 0x5d19, 0x0, 0x5d43, 0x0, 0x5d50, 0x0, 0x5d6b, 0x0, 0x5d6e, 0x0, 0x5d7c, 0x0, 0x5db2, 0x0, 0x5dba, 0x0, 0x5ddb, 0x0, 0x5de1, 0x0, 0x5de2, 0x0, 0x5de5, 0x0, 0x5de6, 0x0, 0x5df1, 0x0, 0x5dfd, 0x0, 0x5dfe, 0x0, 0x5e28, 0x0, 0x5e3d, 0x0, 0x5e69, 0x0, 0x5e72, 0x0, 0x5e73, 0x6210, 0x0, 0x5e74, 0x0, 0x5e7a, 0x0, 0x5e7c, 0x0, 0x5e7f, 0x0, 0x5ea6, 0x0, 0x5eb0, 0x0, 0x5eb3, 0x0, 0x5eb6, 0x0, 0x5ec9, 0x0, 0x5eca, 0x0, 0x5ed2, 0x0, 0x5ed3, 0x0, 0x5ed9, 0x0, 0x5eec, 0x0, 0x5ef4, 0x0, 0x5efe, 0x0, 0x5f04, 0x0, 0x5f0b, 0x0, 0x5f13, 0x0, 0x5f22, 0x0, 0x5f50, 0x0, 0x5f53, 0x0, 0x5f61, 0x0, 0x5f62, 0x0, 0x5f69, 0x0, 0x5f6b, 0x0, 0x5f73, 0x0, 0x5f8b, 0x0, 0x5f8c, 0x0, 0x5f97, 0x0, 0x5f9a, 0x0, 0x5fa9, 0x0, 0x5fad, 0x0, 0x5fc3, 0x0, 0x5fcd, 0x0, 0x5fd7, 0x0, 0x5ff5, 0x0, 0x5ff9, 0x0, 0x6012, 0x0, 0x601c, 0x0, 0x6075, 0x0, 0x6081, 0x0, 0x6094, 0x0, 0x60c7, 0x0, 0x60d8, 0x0, 0x60e1, 0x0, 0x6108, 0x0, 0x6144, 0x0, 0x6148, 0x0, 0x614c, 0x0, 0x614e, 0x0, 0x6160, 0x0, 0x6168, 0x0, 0x617a, 0x0, 0x618e, 0x0, 0x6190, 0x0, 0x61a4, 0x0, 0x61af, 0x0, 0x61b2, 0x0, 0x61de, 0x0, 0x61f2, 0x0, 0x61f6, 0x0, 0x6200, 0x0, 0x6208, 0x0, 0x6210, 0x0, 0x621b, 0x0, 0x622e, 0x0, 0x6234, 0x0, 0x6236, 0x0, 0x624b, 0x0, 0x6253, 0x0, 0x625d, 0x0, 0x6295, 0x0, 0x62b1, 0x0, 0x62c9, 0x0, 0x62cf, 0x0, 0x62d3, 0x0, 0x62d4, 0x0, 0x62fc, 0x0, 0x62fe, 0x0, 0x6307, 0x0, 0x633d, 0x0, 0x6350, 0x0, 0x6355, 0x0, 0x6368, 0x0, 0x637b, 0x0, 0x6383, 0x0, 0x63a0, 0x0, 0x63a9, 0x0, 0x63c4, 0x0, 0x63c5, 0x0, 0x63e4, 0x0, 0x641c, 0x0, 0x6422, 0x0, 0x6452, 0x0, 0x6469, 0x0, 0x6477, 0x0, 0x647e, 0x0, 0x649a, 0x0, 0x649d, 0x0, 0x64c4, 0x0, 0x652f, 0x0, 0x6534, 0x0, 0x654f, 0x0, 0x6556, 0x0, 0x656c, 0x0, 0x6578, 0x0, 0x6587, 0x0, 0x6597, 0x0, 0x6599, 0x0, 0x65a4, 0x0, 0x65b0, 0x0, 0x65b9, 0x0, 0x65c5, 0x0, 0x65e0, 0x0, 0x65e2, 0x0, 0x65e3, 0x0, 0x65e5, 0x0, 0x660e, 0x6cbb, 0x0, 0x6613, 0x0, 0x6620, 0x0, 0x662d, 0x548c, 0x0, 0x6649, 0x0, 0x6674, 0x0, 0x6688, 0x0, 0x6691, 0x0, 0x669c, 0x0, 0x66b4, 0x0, 0x66c6, 0x0, 0x66f0, 0x0, 0x66f4, 0x0, 0x66f8, 0x0, 0x6700, 0x0, 0x6708, 0x0, 0x6709, 0x0, 0x6717, 0x0, 0x671b, 0x0, 0x6721, 0x0, 0x6728, 0x0, 0x674e, 0x0, 0x6753, 0x0, 0x6756, 0x0, 0x675e, 0x0, 0x677b, 0x0, 0x6785, 0x0, 0x6797, 0x0, 0x67f3, 0x0, 0x67fa, 0x0, 0x6817, 0x0, 0x681f, 0x0, 0x682a, 0x0, 0x682a, 0x5f0f, 0x4f1a, 0x793e, 0x0, 0x6852, 0x0, 0x6881, 0x0, 0x6885, 0x0, 0x688e, 0x0, 0x68a8, 0x0, 0x6914, 0x0, 0x6942, 0x0, 0x69a3, 0x0, 0x69ea, 0x0, 0x6a02, 0x0, 0x6a13, 0x0, 0x6aa8, 0x0, 0x6ad3, 0x0, 0x6adb, 0x0, 0x6b04, 0x0, 0x6b20, 0x0, 0x6b21, 0x0, 0x6b54, 0x0, 0x6b62, 0x0, 0x6b63, 0x0, 0x6b72, 0x0, 0x6b77, 0x0, 0x6b79, 0x0, 0x6b9f, 0x0, 0x6bae, 0x0, 0x6bb3, 0x0, 0x6bba, 0x0, 0x6bbb, 0x0, 0x6bcb, 0x0, 0x6bcd, 0x0, 0x6bd4, 0x0, 0x6bdb, 0x0, 0x6c0f, 0x0, 0x6c14, 0x0, 0x6c34, 0x0, 0x6c4e, 0x0, 0x6c67, 0x0, 0x6c88, 0x0, 0x6cbf, 0x0, 0x6ccc, 0x0, 0x6ccd, 0x0, 0x6ce5, 0x0, 0x6ce8, 0x0, 0x6d16, 0x0, 0x6d1b, 0x0, 0x6d1e, 0x0, 0x6d34, 0x0, 0x6d3e, 0x0, 0x6d41, 0x0, 0x6d69, 0x0, 0x6d6a, 0x0, 0x6d77, 0x0, 0x6d78, 0x0, 0x6d85, 0x0, 0x6dcb, 0x0, 0x6dda, 0x0, 0x6dea, 0x0, 0x6df9, 0x0, 0x6e1a, 0x0, 0x6e2f, 0x0, 0x6e6e, 0x0, 0x6e80, 0x0, 0x6e9c, 0x0, 0x6eba, 0x0, 0x6ec7, 0x0, 0x6ecb, 0x0, 0x6ed1, 0x0, 0x6edb, 0x0, 0x6f0f, 0x0, 0x6f14, 0x0, 0x6f22, 0x0, 0x6f23, 0x0, 0x6f6e, 0x0, 0x6fc6, 0x0, 0x6feb, 0x0, 0x6ffe, 0x0, 0x701b, 0x0, 0x701e, 0x0, 0x7039, 0x0, 0x704a, 0x0, 0x706b, 0x0, 0x7070, 0x0, 0x7077, 0x0, 0x707d, 0x0, 0x7099, 0x0, 0x70ad, 0x0, 0x70c8, 0x0, 0x70d9, 0x0, 0x7121, 0x0, 0x7145, 0x0, 0x7149, 0x0, 0x716e, 0x0, 0x719c, 0x0, 0x71ce, 0x0, 0x71d0, 0x0, 0x7210, 0x0, 0x721b, 0x0, 0x7228, 0x0, 0x722a, 0x0, 0x722b, 0x0, 0x7235, 0x0, 0x7236, 0x0, 0x723b, 0x0, 0x723f, 0x0, 0x7247, 0x0, 0x7250, 0x0, 0x7259, 0x0, 0x725b, 0x0, 0x7262, 0x0, 0x7279, 0x0, 0x7280, 0x0, 0x7295, 0x0, 0x72ac, 0x0, 0x72af, 0x0, 0x72c0, 0x0, 0x72fc, 0x0, 0x732a, 0x0, 0x7375, 0x0, 0x737a, 0x0, 0x7384, 0x0, 0x7387, 0x0, 0x7389, 0x0, 0x738b, 0x0, 0x73a5, 0x0, 0x73b2, 0x0, 0x73de, 0x0, 0x7406, 0x0, 0x7409, 0x0, 0x7422, 0x0, 0x7447, 0x0, 0x745c, 0x0, 0x7469, 0x0, 0x7471, 0x0, 0x7485, 0x0, 0x7489, 0x0, 0x7498, 0x0, 0x74ca, 0x0, 0x74dc, 0x0, 0x74e6, 0x0, 0x7506, 0x0, 0x7518, 0x0, 0x751f, 0x0, 0x7524, 0x0, 0x7528, 0x0, 0x7530, 0x0, 0x7532, 0x0, 0x7533, 0x0, 0x7537, 0x0, 0x753b, 0x0, 0x753e, 0x0, 0x7559, 0x0, 0x7565, 0x0, 0x7570, 0x0, 0x758b, 0x0, 0x7592, 0x0, 0x75e2, 0x0, 0x7610, 0x0, 0x761d, 0x0, 0x761f, 0x0, 0x7642, 0x0, 0x7669, 0x0, 0x7676, 0x0, 0x767d, 0x0, 0x76ae, 0x0, 0x76bf, 0x0, 0x76ca, 0x0, 0x76db, 0x0, 0x76e3, 0x0, 0x76e7, 0x0, 0x76ee, 0x0, 0x76f4, 0x0, 0x7701, 0x0, 0x771e, 0x0, 0x771f, 0x0, 0x7740, 0x0, 0x774a, 0x0, 0x778b, 0x0, 0x77a7, 0x0, 0x77db, 0x0, 0x77e2, 0x0, 0x77f3, 0x0, 0x784e, 0x0, 0x786b, 0x0, 0x788c, 0x0, 0x7891, 0x0, 0x78ca, 0x0, 0x78cc, 0x0, 0x78fb, 0x0, 0x792a, 0x0, 0x793a, 0x0, 0x793c, 0x0, 0x793e, 0x0, 0x7948, 0x0, 0x7949, 0x0, 0x7950, 0x0, 0x7956, 0x0, 0x795d, 0x0, 0x795e, 0x0, 0x7965, 0x0, 0x797f, 0x0, 0x7981, 0x0, 0x798d, 0x0, 0x798e, 0x0, 0x798f, 0x0, 0x79ae, 0x0, 0x79b8, 0x0, 0x79be, 0x0, 0x79ca, 0x0, 0x79d8, 0x0, 0x79eb, 0x0, 0x7a1c, 0x0, 0x7a40, 0x0, 0x7a4a, 0x0, 0x7a4f, 0x0, 0x7a74, 0x0, 0x7a7a, 0x0, 0x7a81, 0x0, 0x7ab1, 0x0, 0x7acb, 0x0, 0x7aee, 0x0, 0x7af9, 0x0, 0x7b20, 0x0, 0x7b8f, 0x0, 0x7bc0, 0x0, 0x7bc6, 0x0, 0x7bc9, 0x0, 0x7c3e, 0x0, 0x7c60, 0x0, 0x7c73, 0x0, 0x7c7b, 0x0, 0x7c92, 0x0, 0x7cbe, 0x0, 0x7cd2, 0x0, 0x7cd6, 0x0, 0x7ce3, 0x0, 0x7ce7, 0x0, 0x7ce8, 0x0, 0x7cf8, 0x0, 0x7d00, 0x0, 0x7d10, 0x0, 0x7d22, 0x0, 0x7d2f, 0x0, 0x7d42, 0x0, 0x7d5b, 0x0, 0x7d63, 0x0, 0x7da0, 0x0, 0x7dbe, 0x0, 0x7dc7, 0x0, 0x7df4, 0x0, 0x7e02, 0x0, 0x7e09, 0x0, 0x7e37, 0x0, 0x7e41, 0x0, 0x7e45, 0x0, 0x7f36, 0x0, 0x7f3e, 0x0, 0x7f51, 0x0, 0x7f72, 0x0, 0x7f79, 0x0, 0x7f7a, 0x0, 0x7f85, 0x0, 0x7f8a, 0x0, 0x7f95, 0x0, 0x7f9a, 0x0, 0x7fbd, 0x0, 0x7ffa, 0x0, 0x8001, 0x0, 0x8005, 0x0, 0x800c, 0x0, 0x8012, 0x0, 0x8033, 0x0, 0x8046, 0x0, 0x8060, 0x0, 0x806f, 0x0, 0x8070, 0x0, 0x807e, 0x0, 0x807f, 0x0, 0x8089, 0x0, 0x808b, 0x0, 0x80ad, 0x0, 0x80b2, 0x0, 0x8103, 0x0, 0x813e, 0x0, 0x81d8, 0x0, 0x81e3, 0x0, 0x81e8, 0x0, 0x81ea, 0x0, 0x81ed, 0x0, 0x81f3, 0x0, 0x81fc, 0x0, 0x8201, 0x0, 0x8204, 0x0, 0x820c, 0x0, 0x8218, 0x0, 0x821b, 0x0, 0x821f, 0x0, 0x826e, 0x0, 0x826f, 0x0, 0x8272, 0x0, 0x8278, 0x0, 0x8279, 0x0, 0x828b, 0x0, 0x8291, 0x0, 0x829d, 0x0, 0x82b1, 0x0, 0x82b3, 0x0, 0x82bd, 0x0, 0x82e5, 0x0, 0x82e6, 0x0, 0x831d, 0x0, 0x8323, 0x0, 0x8336, 0x0, 0x8352, 0x0, 0x8353, 0x0, 0x8363, 0x0, 0x83ad, 0x0, 0x83bd, 0x0, 0x83c9, 0x0, 0x83ca, 0x0, 0x83cc, 0x0, 0x83dc, 0x0, 0x83e7, 0x0, 0x83ef, 0x0, 0x83f1, 0x0, 0x843d, 0x0, 0x8449, 0x0, 0x8457, 0x0, 0x84ee, 0x0, 0x84f1, 0x0, 0x84f3, 0x0, 0x84fc, 0x0, 0x8516, 0x0, 0x8564, 0x0, 0x85cd, 0x0, 0x85fa, 0x0, 0x8606, 0x0, 0x8612, 0x0, 0x862d, 0x0, 0x863f, 0x0, 0x864d, 0x0, 0x8650, 0x0, 0x865c, 0x0, 0x8667, 0x0, 0x8669, 0x0, 0x866b, 0x0, 0x8688, 0x0, 0x86a9, 0x0, 0x86e2, 0x0, 0x870e, 0x0, 0x8728, 0x0, 0x876b, 0x0, 0x8779, 0x0, 0x8786, 0x0, 0x87ba, 0x0, 0x87e1, 0x0, 0x8801, 0x0, 0x881f, 0x0, 0x8840, 0x0, 0x884c, 0x0, 0x8860, 0x0, 0x8863, 0x0, 0x88c2, 0x0, 0x88cf, 0x0, 0x88d7, 0x0, 0x88de, 0x0, 0x88e1, 0x0, 0x88f8, 0x0, 0x88fa, 0x0, 0x8910, 0x0, 0x8941, 0x0, 0x8964, 0x0, 0x897e, 0x0, 0x8986, 0x0, 0x898b, 0x0, 0x8996, 0x0, 0x89d2, 0x0, 0x89e3, 0x0, 0x8a00, 0x0, 0x8aa0, 0x0, 0x8aaa, 0x0, 0x8abf, 0x0, 0x8acb, 0x0, 0x8ad2, 0x0, 0x8ad6, 0x0, 0x8aed, 0x0, 0x8af8, 0x0, 0x8afe, 0x0, 0x8b01, 0x0, 0x8b39, 0x0, 0x8b58, 0x0, 0x8b80, 0x0, 0x8b8a, 0x0, 0x8c37, 0x0, 0x8c46, 0x0, 0x8c48, 0x0, 0x8c55, 0x0, 0x8c78, 0x0, 0x8c9d, 0x0, 0x8ca1, 0x0, 0x8ca9, 0x0, 0x8cab, 0x0, 0x8cc1, 0x0, 0x8cc2, 0x0, 0x8cc7, 0x0, 0x8cc8, 0x0, 0x8cd3, 0x0, 0x8d08, 0x0, 0x8d1b, 0x0, 0x8d64, 0x0, 0x8d70, 0x0, 0x8d77, 0x0, 0x8db3, 0x0, 0x8dbc, 0x0, 0x8dcb, 0x0, 0x8def, 0x0, 0x8df0, 0x0, 0x8eab, 0x0, 0x8eca, 0x0, 0x8ed4, 0x0, 0x8f26, 0x0, 0x8f2a, 0x0, 0x8f38, 0x0, 0x8f3b, 0x0, 0x8f62, 0x0, 0x8f9b, 0x0, 0x8f9e, 0x0, 0x8fb0, 0x0, 0x8fb5, 0x0, 0x8fb6, 0x0, 0x9023, 0x0, 0x9038, 0x0, 0x904a, 0x0, 0x9069, 0x0, 0x9072, 0x0, 0x907c, 0x0, 0x908f, 0x0, 0x9091, 0x0, 0x9094, 0x0, 0x90ce, 0x0, 0x90de, 0x0, 0x90f1, 0x0, 0x90fd, 0x0, 0x9111, 0x0, 0x911b, 0x0, 0x9149, 0x0, 0x916a, 0x0, 0x9199, 0x0, 0x91b4, 0x0, 0x91c6, 0x0, 0x91cc, 0x0, 0x91cf, 0x0, 0x91d1, 0x0, 0x9234, 0x0, 0x9238, 0x0, 0x9276, 0x0, 0x927c, 0x0, 0x92d7, 0x0, 0x92d8, 0x0, 0x9304, 0x0, 0x934a, 0x0, 0x93f9, 0x0, 0x9415, 0x0, 0x9577, 0x0, 0x9580, 0x0, 0x958b, 0x0, 0x95ad, 0x0, 0x95b7, 0x0, 0x961c, 0x0, 0x962e, 0x0, 0x964b, 0x0, 0x964d, 0x0, 0x9675, 0x0, 0x9678, 0x0, 0x967c, 0x0, 0x9686, 0x0, 0x96a3, 0x0, 0x96b6, 0x0, 0x96b7, 0x0, 0x96b8, 0x0, 0x96b9, 0x0, 0x96c3, 0x0, 0x96e2, 0x0, 0x96e3, 0x0, 0x96e8, 0x0, 0x96f6, 0x0, 0x96f7, 0x0, 0x9723, 0x0, 0x9732, 0x0, 0x9748, 0x0, 0x9751, 0x0, 0x9756, 0x0, 0x975e, 0x0, 0x9762, 0x0, 0x9769, 0x0, 0x97cb, 0x0, 0x97db, 0x0, 0x97e0, 0x0, 0x97ed, 0x0, 0x97f3, 0x0, 0x97ff, 0x0, 0x9801, 0x0, 0x9805, 0x0, 0x980b, 0x0, 0x9818, 0x0, 0x9829, 0x0, 0x983b, 0x0, 0x985e, 0x0, 0x98a8, 0x0, 0x98db, 0x0, 0x98df, 0x0, 0x98e2, 0x0, 0x98ef, 0x0, 0x98fc, 0x0, 0x9928, 0x0, 0x9929, 0x0, 0x9996, 0x0, 0x9999, 0x0, 0x99a7, 0x0, 0x99ac, 0x0, 0x99c2, 0x0, 0x99f1, 0x0, 0x99fe, 0x0, 0x9a6a, 0x0, 0x9aa8, 0x0, 0x9ad8, 0x0, 0x9adf, 0x0, 0x9b12, 0x0, 0x9b25, 0x0, 0x9b2f, 0x0, 0x9b32, 0x0, 0x9b3c, 0x0, 0x9b5a, 0x0, 0x9b6f, 0x0, 0x9c40, 0x0, 0x9c57, 0x0, 0x9ce5, 0x0, 0x9cfd, 0x0, 0x9d67, 0x0, 0x9db4, 0x0, 0x9dfa, 0x0, 0x9e1e, 0x0, 0x9e75, 0x0, 0x9e7f, 0x0, 0x9e97, 0x0, 0x9e9f, 0x0, 0x9ea5, 0x0, 0x9ebb, 0x0, 0x9ec3, 0x0, 0x9ecd, 0x0, 0x9ece, 0x0, 0x9ed1, 0x0, 0x9ef9, 0x0, 0x9efd, 0x0, 0x9efe, 0x0, 0x9f05, 0x0, 0x9f0e, 0x0, 0x9f0f, 0x0, 0x9f13, 0x0, 0x9f16, 0x0, 0x9f20, 0x0, 0x9f3b, 0x0, 0x9f43, 0x0, 0x9f4a, 0x0, 0x9f52, 0x0, 0x9f8d, 0x0, 0x9f8e, 0x0, 0x9f9c, 0x0, 0x9f9f, 0x0, 0x9fa0, 0x0, 0xa76f, 0x0, 0x11099, 0x110ba, 0x0, 0x1109b, 0x110ba, 0x0, 0x110a5, 0x110ba, 0x0, 0x11131, 0x11127, 0x0, 0x11132, 0x11127, 0x0, 0x1d157, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x1d16e, 0x0, 0x1d158, 0x1d165, 0x1d16f, 0x0, 0x1d158, 0x1d165, 0x1d170, 0x0, 0x1d158, 0x1d165, 0x1d171, 0x0, 0x1d158, 0x1d165, 0x1d172, 0x0, 0x1d1b9, 0x1d165, 0x0, 0x1d1b9, 0x1d165, 0x1d16e, 0x0, 0x1d1b9, 0x1d165, 0x1d16f, 0x0, 0x1d1ba, 0x1d165, 0x0, 0x1d1ba, 0x1d165, 0x1d16e, 0x0, 0x1d1ba, 0x1d165, 0x1d16f, 0x0, 0x20122, 0x0, 0x2051c, 0x0, 0x20525, 0x0, 0x2054b, 0x0, 0x2063a, 0x0, 0x20804, 0x0, 0x208de, 0x0, 0x20a2c, 0x0, 0x20b63, 0x0, 0x214e4, 0x0, 0x216a8, 0x0, 0x216ea, 0x0, 0x219c8, 0x0, 0x21b18, 0x0, 0x21d0b, 0x0, 0x21de4, 0x0, 0x21de6, 0x0, 0x22183, 0x0, 0x2219f, 0x0, 0x22331, 0x0, 0x226d4, 0x0, 0x22844, 0x0, 0x2284a, 0x0, 0x22b0c, 0x0, 0x22bf1, 0x0, 0x2300a, 0x0, 0x232b8, 0x0, 0x2335f, 0x0, 0x23393, 0x0, 0x2339c, 0x0, 0x233c3, 0x0, 0x233d5, 0x0, 0x2346d, 0x0, 0x236a3, 0x0, 0x238a7, 0x0, 0x23a8d, 0x0, 0x23afa, 0x0, 0x23cbc, 0x0, 0x23d1e, 0x0, 0x23ed1, 0x0, 0x23f5e, 0x0, 0x23f8e, 0x0, 0x24263, 0x0, 0x242ee, 0x0, 0x243ab, 0x0, 0x24608, 0x0, 0x24735, 0x0, 0x24814, 0x0, 0x24c36, 0x0, 0x24c92, 0x0, 0x24fa1, 0x0, 0x24fb8, 0x0, 0x25044, 0x0, 0x250f2, 0x0, 0x250f3, 0x0, 0x25119, 0x0, 0x25133, 0x0, 0x25249, 0x0, 0x2541d, 0x0, 0x25626, 0x0, 0x2569a, 0x0, 0x256c5, 0x0, 0x2597c, 0x0, 0x25aa7, 0x0, 0x25bab, 0x0, 0x25c80, 0x0, 0x25cd0, 0x0, 0x25f86, 0x0, 0x261da, 0x0, 0x26228, 0x0, 0x26247, 0x0, 0x262d9, 0x0, 0x2633e, 0x0, 0x264da, 0x0, 0x26523, 0x0, 0x265a8, 0x0, 0x267a7, 0x0, 0x267b5, 0x0, 0x26b3c, 0x0, 0x26c36, 0x0, 0x26cd5, 0x0, 0x26d6b, 0x0, 0x26f2c, 0x0, 0x26fb1, 0x0, 0x270d2, 0x0, 0x273ca, 0x0, 0x27667, 0x0, 0x278ae, 0x0, 0x27966, 0x0, 0x27ca8, 0x0, 0x27ed3, 0x0, 0x27f2f, 0x0, 0x285d2, 0x0, 0x285ed, 0x0, 0x2872e, 0x0, 0x28bfa, 0x0, 0x28d77, 0x0, 0x29145, 0x0, 0x291df, 0x0, 0x2921a, 0x0, 0x2940a, 0x0, 0x29496, 0x0, 0x295b6, 0x0, 0x29b30, 0x0, 0x2a0ce, 0x0, 0x2a105, 0x0, 0x2a20e, 0x0, 0x2a291, 0x0, 0x2a392, 0x0, 0x2a600, 0x0]; return t; } -+} -+ -+} -+ -+ -+static if(size_t.sizeof == 4) { -+//22656 bytes -+enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)([ 0x0, 0x40, 0x540], [ 0x100, 0xa00, 0x21c0], [ 0x2020100, 0x4020302, 0x2020205, 0x7060202, 0x2020202, 0x8020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x80000, 0xa0009, 0xc000b, 0x0, 0xd0000, 0xf000e, 0x0, 0x110010, 0x130012, 0x150014, 0x170016, 0x190018, 0x0, 0x1b001a, 0x0, 0x0, 0x1c, 0x0, 0x1d0000, 0x1e0000, 0x0, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200000, 0x21, 0x0, 0x22, 0x230000, 0x24, 0x0, 0x0, 0x0, 0x25, 0x26, 0x27, 0x0, 0x28, 0x0, 0x29, 0x0, 0x2a, 0x0, 0x2b, 0x2c0000, 0x0, 0x2d0000, 0x2e, 0x2f, 0x310030, 0x330032, 0x0, 0x340000, 0x0, 0x0, 0x350000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x370036, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x390000, 0x3b003a, 0x3d003c, 0x0, 0x3f003e, 0x410040, 0x430042, 0x450044, 0x470046, 0x490048, 0x4b004a, 0x4d004c, 0x4f004e, 0x510050, 0x530052, 0x0, 0x550054, 0x570056, 0x590058, 0x5a, 0x5c005b, 0x5e005d, 0x60005f, 0x610000, 0x620000, 0x0, 0x0, 0x0, 0x0, 0x630000, 0x650064, 0x670066, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x690000, 0x0, 0x6a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6b0000, 0x0, 0x0, 0x0, 0x6c0000, 0x0, 0x0, 0x0, 0x0, 0x6d, 0x6e0000, 0x70006f, 0x720071, 0x740073, 0x75, 0x770076, 0x790078, 0x7b007a, 0x7d007c, 0x7e0000, 0x80007f, 0x81, 0x0, 0x830082, 0x850084, 0x870086, 0x890088, 0x8b008a, 0x8d008c, 0x8f008e, 0x910090, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x920000, 0x0, 0x930000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x950094, 0x970096, 0x990098, 0x9b009a, 0x9d009c, 0x9f009e, 0xa100a0, 0xa2, 0xa400a3, 0xa600a5, 0xa800a7, 0xaa00a9, 0xac00ab, 0xae00ad, 0xb000af, 0xb200b1, 0xb400b3, 0xb600b5, 0xb800b7, 0xba00b9, 0xbc00bb, 0xbe00bd, 0xc000bf, 0xc200c1, 0xc400c3, 0xc600c5, 0xc800c7, 0xca00c9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc00cb, 0x0, 0xcd0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf00ce, 0xd00000, 0xd1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd300d2, 0xd500d4, 0xd700d6, 0xd900d8, 0xdb00da, 0xdd00dc, 0xd200de, 0xdf00d3, 0xe000d5, 0xe200e1, 0xe300d9, 0xe500e4, 0xe700e6, 0xe900e8, 0xeb00ea, 0xed00ec, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xef00ee, 0xf100f0, 0xf300f2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf500f4, 0xf700f6, 0xf8, 0x0, 0xfa00f9, 0xfb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfd00fc, 0xff00fe, 0x1010100, 0x1030102, 0x1050104, 0x1070106, 0x1090108, 0x10b010a, 0x10c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x15, 0x692, 0x0, 0x90000, 0x0, 0x30f0343, 0x11b20003, 0x0, 0x3140048, 0x787, 0x3c603ce, 0x494, 0x570056d, 0x5860573, 0x5b005a6, 0x5f80000, 0x62e062b, 0x6580631, 0x6e706e4, 0x6f906ea, 0x78f0000, 0x7a907a6, 0x7bf07ac, 0x7e3, 0x8b10000, 0x8b708b4, 0x95f08cb, 0x0, 0x9ac09a9, 0x9c209af, 0x9ec09e2, 0xa470000, 0xa890a86, 0xab30a8c, 0xb460b43, 0xb550b49, 0xc410000, 0xc5e0c5b, 0xc740c61, 0xc98, 0xd680000, 0xd6e0d6b, 0xe0c0d82, 0xe1b0000, 0x9c50589, 0x9c8058c, 0xa0a05ce, 0xa3b05ec, 0xa3e05ef, 0xa4105f2, 0xa4405f5, 0xa6e061a, 0x0, 0xaa20647, 0xaad0652, 0xab00655, 0xad00675, 0xab9065e, 0xafb069a, 0xb0106a0, 0xb0406a3, 0xb0a06a9, 0xb1606ba, 0x0, 0xb4c06ed, 0xb4f06f0, 0xb5206f3, 0xb6b070f, 0x6f6, 0xb3706d8, 0xb730717, 0xbae072e, 0x7430000, 0x7500bcc, 0x7460bd9, 0x7400bcf, 0xbc9, 0x78c0000, 0x79b0c3e, 0x7950c4d, 0xed70c47, 0x0, 0xc8307ce, 0xc8e07d9, 0xca207ed, 0x0, 0xd070842, 0xd1d0858, 0xd0d0848, 0xd2b086c, 0xd320873, 0xd49088a, 0xd380879, 0xd5d08a6, 0xd54089d, 0x0, 0xd7108ba, 0xd7808c1, 0xd7f08c8, 0xd9808e1, 0xd9b08e4, 0xdc4090d, 0xde9093f, 0xe0f0962, 0x979096e, 0x97f0e29, 0x60d0e2f, 0x8400614, 0xcae07f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8f00000, 0xda7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x613060c, 0x7360a67, 0xbb9073d, 0x7830780, 0x5b70c32, 0x70309f3, 0x7f00b5f, 0x8e70ca5, 0x8d60d9e, 0x8d20d8d, 0x8da0d89, 0x8ce0d91, 0xd85, 0x9e505a9, 0x9de05a2, 0xe630e5a, 0x0, 0xb0706a6, 0xba80728, 0xccc0817, 0xccf081a, 0xecc0e7b, 0x6090b76, 0xa640610, 0xaf80697, 0x0, 0xc3b0789, 0x9ef05b3, 0xe600e57, 0xe680e5d, 0x9f605ba, 0x9f905bd, 0xabc0661, 0xabf0664, 0xb620706, 0xb650709, 0xca807f3, 0xcab07f6, 0xd10084b, 0xd13084e, 0xda108ea, 0xda408ed, 0xd460887, 0xd5a08a3, 0x0, 0xb1f06c3, 0x0, 0x0, 0x0, 0x9db059f, 0xac9066e, 0xc9b07e6, 0xc7b07c6, 0xc9107dc, 0xc9407df, 0xe150968, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe9a0b0d, 0xa11073e, 0xeb60eb4, 0xde10eb8, 0x695, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12000f, 0x4b0024, 0x270006, 0x0, 0xa280e96, 0xb410840, 0xecf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4001a, 0x2b0000, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xed5, 0x0, 0x0, 0x54, 0x0, 0x546, 0x0, 0x0, 0x1c0003, 0x7410ee8, 0xf630f43, 0xfb4, 0xfed, 0x103c1016, 0x1185, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x101f0fbd, 0x10f5108f, 0x11751119, 0x1213, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x120c117e, 0x120311d5, 0x124b, 0x116e10ea, 0x10161011, 0x123c101f, 0x11ee, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11f011ae, 0x11f8, 0x10f00fad, 0x0, 0x100d0000, 0x0, 0x0, 0x0, 0x12b612b0, 0x12ad0000, 0x0, 0x12a40000, 0x0, 0x0, 0x12c212ce, 0x12d7, 0x0, 0x0, 0x0, 0x0, 0x12c80000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x130a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12f812f2, 0x12ef0000, 0x0, 0x132d0000, 0x0, 0x0, 0x13041310, 0x131b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13331330, 0x0, 0x0, 0x0, 0x0, 0x12b90000, 0x12fb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12e912a7, 0x12ec12aa, 0x0, 0x12f512b3, 0x0, 0x13391336, 0x12fe12bc, 0x130112bf, 0x0, 0x130712c5, 0x130d12cb, 0x131512d1, 0x0, 0x133f133c, 0x132a12e6, 0x131812d4, 0x131e12da, 0x132112dd, 0x132412e0, 0x0, 0x132712e3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13420000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13e913e6, 0x13ec178f, 0x17ca, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13ef0000, 0x185b1792, 0x1811, 0x0, 0x0, 0x0, 0x186d, 0x1852, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x186a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18820000, 0x0, 0x0, 0x0, 0x188b0000, 0x0, 0x188e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18731870, 0x18791876, 0x187f187c, 0x18881885, 0x0, 0x0, 0x0, 0x0, 0x0, 0x189a0000, 0x189d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18941891, 0x18970000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18ac0000, 0x0, 0x18af, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18a00000, 0x18a618a3, 0x0, 0x18a9, 0x0, 0x0, 0x0, 0x0, 0x18bb, 0x18b80000, 0x18be, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18b518b2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18c1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18ca18c4, 0x18c7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18cd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18d0, 0x0, 0x0, 0x18da0000, 0x18dd, 0x18d618d3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18e618e0, 0x18e3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18e9, 0x18ef18ec, 0x18f3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18f60000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18fc18f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1902, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19070000, 0x0, 0x0, 0x0, 0x0, 0x190a0000, 0x0, 0x0, 0x190d, 0x0, 0x19100000, 0x0, 0x0, 0x1913, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19040000, 0x0, 0x0, 0x0, 0x0, 0x19160000, 0x19190000, 0x19311935, 0x1938193c, 0x0, 0x0, 0x0, 0x191c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19220000, 0x0, 0x0, 0x0, 0x0, 0x19250000, 0x0, 0x0, 0x1928, 0x0, 0x192b0000, 0x0, 0x0, 0x192e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x191f0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x193f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1942, 0x0, 0x0, 0x0, 0x0, 0x1a38, 0x1a3b, 0x1a3e, 0x1a41, 0x1a44, 0x0, 0x1a47, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a4a0000, 0x1a4d0000, 0x0, 0x1a531a50, 0x1a560000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe550568, 0x5d5, 0x62905e6, 0x6870e75, 0x6cf06ac, 0x71a0607, 0x7230734, 0x77e, 0xe7e07a4, 0x82c06af, 0x56b088d, 0x6920770, 0xe840e82, 0x9371a59, 0xa7d0a2e, 0xe8e0e8c, 0x6020e90, 0xb790000, 0xe7105d3, 0xe880787, 0x1a5d1a5b, 0xba30cd3, 0x1a610a24, 0x86a0ea4, 0x10ea1a63, 0x10ee10ec, 0x123e123c, 0xa110ae0, 0x86a0a24, 0x10ec10ea, 0x123c11f0, 0x123e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1313, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe860000, 0xe8a09a0, 0xe900e66, 0xe920ad9, 0xe980e94, 0xe9e0e9c, 0x1a650ea0, 0xea20ed1, 0xed31a67, 0xea60ea8, 0xeac0eaa, 0xeb00eae, 0xeba0eb2, 0xe790ebc, 0xec00ebe, 0xec21a5f, 0x6110ec4, 0xec80ec6, 0x116e0eca, 0xa0705cb, 0xa1305da, 0xa1605dd, 0xa1905e0, 0xa4a05fb, 0xa6b0617, 0xa71061d, 0xa7a0626, 0xa740620, 0xa770623, 0xaa5064a, 0xaa9064e, 0xad30678, 0xad6067b, 0xacc0671, 0xaef0684, 0xafe069d, 0xb1906bd, 0xb2206c6, 0xb1c06c0, 0xb2506c9, 0xb2806cc, 0xb6e0712, 0xb5806fc, 0xba50725, 0xbab072b, 0xbb10731, 0xbd20749, 0xbd5074c, 0xbdf0756, 0xbdc0753, 0xc120772, 0xc150775, 0xc180778, 0xc440792, 0xc4a0798, 0xc5307a1, 0xc50079e, 0xc7707c2, 0xc7f07ca, 0xc8607d1, 0xc8a07d5, 0xcec0835, 0xcef0838, 0xd0a0845, 0xd160851, 0xd190854, 0xd20085b, 0xd350876, 0xd3f0880, 0xd2e086f, 0xd3b087c, 0xd420883, 0xd4e089a, 0xd5708a0, 0xd6308ac, 0xd6008a9, 0xdc1090a, 0xdca0913, 0xdc70910, 0xd7408bd, 0xd7b08c4, 0xddb0924, 0xdde0927, 0xde30939, 0xde6093c, 0xdef0945, 0xdec0942, 0xdf50948, 0xe010954, 0xe040957, 0xe18096b, 0xe2c097c, 0xe350985, 0xe380988, 0xd510b2b, 0xe210df2, 0xd3509a6, 0x0, 0x0, 0x9fc05c0, 0x9e905ad, 0x9b6057a, 0x9b20576, 0x9be0582, 0x9ba057e, 0x9ff05c3, 0x9cf0593, 0x9cb058f, 0x9d7059b, 0x9d30597, 0xa0305c7, 0xac20667, 0xab6065b, 0xa9f0644, 0xa930638, 0xa8f0634, 0xa9b0640, 0xa97063c, 0xac5066a, 0xb5c0700, 0xb68070c, 0xcc50810, 0xc9f07ea, 0xc6807b3, 0xc6407af, 0xc7007bb, 0xc6c07b7, 0xcc80813, 0xcb50800, 0xcb107fc, 0xcbd0808, 0xcb90804, 0xcc1080c, 0xdbe0907, 0xd9508de, 0xdae08f7, 0xdaa08f3, 0xdb608ff, 0xdb208fb, 0xdba0903, 0xe09095c, 0xe240974, 0xe1e0971, 0xe120965, 0x0, 0x0, 0x0, 0x10be109c, 0x10c1109f, 0x10ca10a8, 0x10d310b1, 0xf130ef1, 0xf160ef4, 0xf1f0efd, 0xf280f06, 0x110310f8, 0x110610fb, 0x110a10ff, 0x0, 0xf510f46, 0xf540f49, 0xf580f4d, 0x0, 0x11421120, 0x11451123, 0x114e112c, 0x11571135, 0xf880f66, 0xf8b0f69, 0xf940f72, 0xf9d0f7b, 0x119c118d, 0x119f1190, 0x11a31194, 0x11a71198, 0xfcf0fc0, 0xfd20fc3, 0xfd60fc7, 0xfda0fcb, 0x11e311d8, 0x11e611db, 0x11ea11df, 0x0, 0xffb0ff0, 0xffe0ff3, 0x10020ff7, 0x0, 0x122a121b, 0x122d121e, 0x12311222, 0x12351226, 0x10220000, 0x10250000, 0x10290000, 0x102d0000, 0x12741252, 0x12771255, 0x1280125e, 0x12891267, 0x1061103f, 0x10641042, 0x106d104b, 0x10761054, 0x108f1088, 0x10f510f2, 0x11191112, 0x11751172, 0x11d511d2, 0x12031200, 0x124b1244, 0x0, 0x10dc10ba, 0x10c510a3, 0x10ce10ac, 0x10d710b5, 0xf310f0f, 0xf1a0ef8, 0xf230f01, 0xf2c0f0a, 0x1160113e, 0x11491127, 0x11521130, 0x115b1139, 0xfa60f84, 0xf8f0f6d, 0xf980f76, 0xfa10f7f, 0x12921270, 0x127b1259, 0x12841262, 0x128d126b, 0x107f105d, 0x10681046, 0x1071104f, 0x107a1058, 0x10961099, 0x10e7108b, 0x1092, 0x10e310e0, 0xeeb0eee, 0xee80ee5, 0x2a0f35, 0x2a1170, 0x200051, 0x116b1115, 0x111c, 0x11671164, 0xf430f40, 0xf630f60, 0x2d0faa, 0x350031, 0x1178117b, 0x11851181, 0x0, 0x118911ab, 0xfb70fba, 0xfb40fb1, 0x3c0000, 0x440040, 0x12061209, 0x1213120f, 0x11f511f2, 0x12171239, 0x1019101c, 0x10161013, 0x18100a, 0x995001c, 0x0, 0x129d1247, 0x124e, 0x12991296, 0xfed0fea, 0x103c1039, 0x31083, 0x39, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x1, 0x0, 0x0, 0x1a690000, 0x0, 0x0, 0x4e0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2fc02fa, 0x2ff, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x1a6f0000, 0x1a72, 0x1a7e1a7b, 0x0, 0x0, 0x8f, 0xc, 0x0, 0x0, 0x0, 0x5630000, 0x920560, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a760000, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xae00305, 0x0, 0x3740365, 0x3920383, 0x3b003a1, 0x1aad02f4, 0xa10544, 0xb3b00a5, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x1aad02f4, 0xa10544, 0xa5, 0xa7d0692, 0xb410787, 0xb0d0e8c, 0xa280b79, 0xb3b05d3, 0x8400cd3, 0xba3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x83f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9a2099e, 0xe4d05e3, 0xa1e0000, 0xe770a22, 0xe500000, 0x6ac0602, 0x6ac06ac, 0xe6d0b0d, 0x6cf06cf, 0xa280734, 0x77e0000, 0x786, 0x6af0000, 0x82c083b, 0x82c082c, 0x0, 0x88f0863, 0x897, 0x60a, 0x77c, 0x60a, 0x5b0071a, 0x5e305d5, 0xa7d0000, 0x67e0629, 0x7230000, 0x13540787, 0x136a1362, 0xae0136f, 0x6800000, 0x10ec11ee, 0x10060f3a, 0x1aab, 0x0, 0x5e60000, 0xa7d0a2e, 0x73e0ae0, 0x0, 0x0, 0x0, 0x3e203da, 0x3ca03c1, 0x3d20455, 0x4980459, 0x3d604cf, 0x3de04e7, 0x4eb049c, 0x3be0511, 0x6d106cf, 0x6de06d4, 0x91806b2, 0x91f091b, 0x68206e1, 0x950094d, 0x5e30734, 0x72305e6, 0xb300ae0, 0xb3d0b33, 0xdcf086a, 0xdd60dd2, 0xb410b40, 0xdfd0dfa, 0x9a00a28, 0x5d30a2e, 0x0, 0x0, 0x0, 0x0, 0x30d0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a8d1a86, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a92, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a950000, 0x1a981a9b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1aa0, 0x0, 0x1aa50000, 0x0, 0x1aa8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1aaf, 0x1ab2, 0x0, 0x0, 0x1ab81ab5, 0x1ac10000, 0x1ac4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ac80000, 0x0, 0x1acb, 0x1ace0000, 0x1ad10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x556, 0x1ad7, 0x0, 0x0, 0x0, 0x0, 0x1ad40000, 0x55b054a, 0x1add1ada, 0x0, 0x1ae31ae0, 0x0, 0x1ae91ae6, 0x0, 0x0, 0x0, 0x1aef1aec, 0x0, 0x1afb1af8, 0x0, 0x1b011afe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b0d1b0a, 0x1b131b10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1af51af2, 0x1b071b04, 0x0, 0x0, 0x0, 0x1b191b16, 0x1b1f1b1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b350000, 0x1b37, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3430314, 0x365030f, 0x3830374, 0x3a10392, 0x31c03b0, 0x342032f, 0x3640355, 0x3820373, 0x3a00391, 0x3f703af, 0xd900a3, 0xe600e2, 0xee00ea, 0xf600f2, 0xa700fa, 0xb100ac, 0xbb00b6, 0xc500c0, 0xcf00ca, 0xdd00d4, 0x3460319, 0x3680359, 0x3860377, 0x3a40395, 0x31f03b3, 0x3450332, 0x3670358, 0x3850376, 0x3a30394, 0x3fa03b2, 0x16a0166, 0x172016e, 0x17a0176, 0x182017e, 0x18a0186, 0x192018e, 0x19a0196, 0x1a2019e, 0x1aa01a6, 0x1b201ae, 0x1ba01b6, 0x1c201be, 0x1ca01c6, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x305, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1abc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x54f0542, 0x552, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6b2073e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b2f0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x227c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26b00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1efb1ee9, 0x1f091f01, 0x1f131f0d, 0x1f1b1f17, 0x1f4b1f21, 0x1f5f1f57, 0x1f6f1f67, 0x1f871f77, 0x1f8b1f89, 0x1fb91fa5, 0x1fc51fc1, 0x1fcd1fc7, 0x1fdd1fdb, 0x1feb1fe9, 0x1ff71fef, 0x204f2045, 0x2079206f, 0x207f207d, 0x20982087, 0x20b420ae, 0x20ca20c4, 0x20ce20cc, 0x20dc20da, 0x20f820f2, 0x210020fc, 0x210f2108, 0x21292113, 0x212f212b, 0x21352131, 0x21412139, 0x218b214f, 0x21972195, 0x21d921d7, 0x21e521e3, 0x21ed21e9, 0x32521f1, 0x3292211, 0x22602223, 0x226e2266, 0x227a2274, 0x2280227e, 0x22842282, 0x22e22286, 0x230c2306, 0x2310230e, 0x23162312, 0x23222318, 0x23342330, 0x23562354, 0x235c235a, 0x23622360, 0x23762374, 0x23862384, 0x238a2388, 0x23a62394, 0x23aa23a8, 0x23dc23bc, 0x23ee23de, 0x23fa23f6, 0x241c240a, 0x2442243e, 0x2452244c, 0x245a2456, 0x245e245c, 0x246c246a, 0x247e247a, 0x24842482, 0x248e248a, 0x24922490, 0x24982496, 0x24f224e8, 0x250e250c, 0x25282512, 0x2530252c, 0x25522534, 0x25582554, 0x255c255a, 0x25742572, 0x25822578, 0x25922584, 0x25982596, 0x25ba25aa, 0x25c425c2, 0x25de25c8, 0x25e825e0, 0x260025fa, 0x26142608, 0x261a2618, 0x261e261c, 0x26262624, 0x2638262a, 0x263c263a, 0x264a2648, 0x2658264e, 0x265c265a, 0x26622660, 0x26662664, 0x26702668, 0x267e267c, 0x26862684, 0x268a2688, 0x2690268e, 0x26982692, 0x26a0269c, 0x26a626a2, 0x26aa26a8, 0x26b226ae, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b49, 0x1fcf1fcd, 0x1fd1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b7e, 0x1b81, 0x1b84, 0x1b87, 0x1b8a, 0x1b8d, 0x1b90, 0x1b93, 0x1b96, 0x1b99, 0x1b9c, 0x1b9f, 0x1ba20000, 0x1ba50000, 0x1ba80000, 0x0, 0x0, 0x0, 0x1bae1bab, 0x1bb10000, 0x1bb4, 0x1bba1bb7, 0x1bbd0000, 0x1bc0, 0x1bc91bc6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b7b, 0x0, 0x0, 0x870000, 0x8a, 0x1bcc1bd3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c26, 0x1c43, 0x1bf6, 0x1c92, 0x1c9b, 0x1caf, 0x1cbf, 0x1cca, 0x1ccf, 0x1cdc, 0x1ce1, 0x1ceb, 0x1cf20000, 0x1cf70000, 0x1c100000, 0x0, 0x0, 0x0, 0x1d261d1d, 0x1d3b0000, 0x1d42, 0x1d611d57, 0x1d760000, 0x1d7e, 0x1caa1da1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c01, 0x1e440000, 0x1e521e4d, 0x1e57, 0x0, 0x1ca11e60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19440000, 0x1a101949, 0x1a12194b, 0x19501a14, 0x19571955, 0x1a181a16, 0x1a1c1a1a, 0x1a201a1e, 0x195c19a6, 0x19661961, 0x196819b0, 0x196f196d, 0x19811977, 0x198e1983, 0x19981993, 0x1947199d, 0x19da19d8, 0x19de19dc, 0x19e219e0, 0x198c19e4, 0x19ea19e8, 0x19ee19ec, 0x19f21975, 0x19f619f4, 0x19fa19f8, 0x19fe197f, 0x19a219d4, 0x1a2219a4, 0x1a261a24, 0x1a2a1a28, 0x1a2e1a2c, 0x1a3019a8, 0x19aa1a32, 0x19ae19ac, 0x19b419b2, 0x19b819b6, 0x19bc19ba, 0x19c019be, 0x19c419c2, 0x19c819c6, 0x19cc19ca, 0x1a361a34, 0x19d019ce, 0x1a0019d2, 0x1a041a02, 0x1a081a06, 0x1a0c1a0a, 0x1a0e, 0x0, 0x1f171ee9, 0x20471eef, 0x1efd1ef1, 0x23641ef3, 0x1ef71f0d, 0x208c1eeb, 0x1f212051, 0x1d701ce, 0x1e901e0, 0x1fb01f2, 0x20d0204, 0x2330225, 0x245023c, 0x257024e, 0x1db01d2, 0x1ed01e4, 0x1ff01f6, 0x2110208, 0x2370229, 0x2490240, 0x25b0252, 0x216022e, 0x21e, 0x2700260, 0x2a00268, 0x2880274, 0x2840264, 0x290026c, 0x2c402b0, 0x2b802c0, 0x2a402ec, 0x2bc02ac, 0x2d002b4, 0x2c80298, 0x2d402e4, 0x278028c, 0x2a8029c, 0x27c02cc, 0x29402e8, 0x28002d8, 0x2e002dc, 0x21112021, 0x23fe21e3, 0x0, 0x0, 0x0, 0x0, 0x406082e, 0x41c0411, 0x4320427, 0x4400439, 0x44e0447, 0x475046e, 0x47f047c, 0x4850482, 0x194b1944, 0x19571950, 0x1961195c, 0x196f1968, 0x19831977, 0x1993198e, 0x199d1998, 0x194d1946, 0x19591952, 0x1963195e, 0x1971196a, 0x19851979, 0x19951990, 0x199f199a, 0x197c1988, 0x1974, 0x1f171ee9, 0x20471eef, 0x1f611f19, 0x1f5f1eed, 0x1fcd1f0f, 0x22e20329, 0x22232286, 0x204f25c8, 0x223b0325, 0x2240221b, 0x231c2007, 0x23ca255e, 0x23e21fab, 0x20982368, 0x1f4925a2, 0x22961fdf, 0x1f2b262c, 0x208a1f73, 0x1efd1ef1, 0x20fa1ef3, 0x1fc92001, 0x20b220b8, 0x1f292390, 0x1fd72568, 0x4882083, 0x48e048b, 0x4b10491, 0x4b704b4, 0x4bd04ba, 0x4c304c0, 0x4c904c6, 0x4e404cc, 0x34e033b, 0x4d604a3, 0x50304f2, 0x5290518, 0x327053a, 0x34d033a, 0xa8206b4, 0x7390a7f, 0x1bf11bd8, 0x1c0a1bff, 0x1c241c1a, 0x1c731c41, 0x1c991c90, 0x1cbd1cad, 0x1ccd1c1e, 0x1cdf1cda, 0x1cf01bfb, 0x1bde1cf5, 0x1d0f1ca6, 0x1c8e1d11, 0x1d1b1d0d, 0x1d551d39, 0x1d9f1d74, 0x1ddc1c31, 0x1def1c22, 0x1e041e00, 0x1e191e11, 0x1c351e1b, 0x1e341bed, 0x1e421c5d, 0x1e501e4b, 0x1e55, 0x1be01bda, 0x1beb1be5, 0x1bf91bf3, 0x1c0c1c04, 0x1c1c1c13, 0x1c331c20, 0x1c3c1c37, 0x1c2e1c29, 0x1c4b1c46, 0x1c501c57, 0x1c5f1c5c, 0x1c6d1c66, 0x1c7d1c61, 0x1c8b1c84, 0x1ca41c95, 0x1cb21ca8, 0x1cc21cb7, 0x1cd61cd2, 0x1cfa1ce4, 0x1c811d03, 0x1d171d0c, 0x1d291d35, 0x1d201d30, 0x1d4c1d45, 0x1d3e1d51, 0x1d6b1d64, 0x1d701d5a, 0x1d811d95, 0x1d9b1d85, 0x1d8f1d8a, 0x1dac1d79, 0x1db81da4, 0x1dbb1db2, 0x1dc51dbf, 0x1dce1dca, 0x1dd61dd2, 0x1de31dde, 0x1df11de6, 0x1c681df5, 0x1e0b1e06, 0x1e1f1e13, 0x1e291e24, 0x1e361e2e, 0x1c6f1e39, 0x33f0311, 0x3610352, 0x37f0370, 0x39d038e, 0x3bb03ac, 0x33e032b, 0x3600351, 0x37e036f, 0x39c038d, 0x3ba03ab, 0x40d0402, 0x4230418, 0xb0f042e, 0x56a0a53, 0xc580a0f, 0xa590ce6, 0xa600a5c, 0x210a06db, 0x20892200, 0x223d21f9, 0xc260cda, 0xbea11b4, 0x71c0b7b, 0x689075b, 0xb8c0a26, 0xc290cdd, 0x11c011b7, 0x6010bf6, 0xb7e068d, 0x68c0764, 0x11c30893, 0xa560bfd, 0xaec0b94, 0x11c60c35, 0xa300c00, 0xc030b97, 0xa340a33, 0xc070b9a, 0xa380a37, 0xc1b0b9e, 0x6910c1f, 0x7680b82, 0xcf60690, 0xd000cfa, 0xc380ce9, 0xc0f11c9, 0xc2c0ce0, 0xbed11ba, 0x76c0b86, 0xc2f0ce3, 0xbf011bd, 0x76f0b89, 0x77b0bb4, 0x5d70999, 0xa2d0a2a, 0x5e805ff, 0x6940a50, 0x6ae0b13, 0x71f0b3a, 0xba20722, 0xbbf0bbc, 0xbc60bc2, 0xbf90bf3, 0x8200c0b, 0x8230cd5, 0xd25082b, 0x9360869, 0x5d1092a, 0x34a0337, 0x36c035d, 0x38a037b, 0x3a80399, 0x32303b7, 0x3490336, 0x36b035c, 0x389037a, 0x3a70398, 0x3fe03b6, 0x4140409, 0x42a041f, 0x43c0435, 0x44a0443, 0x4710451, 0xaf40478, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26b4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe730e6b, 0x0, 0x0, 0x0, 0x22132556, 0x256a2584, 0x1eff22c6, 0x26ae1ff9, 0x209226ae, 0x202b25c8, 0x21872090, 0x244a2382, 0x250424e6, 0x25a8251e, 0x229a2254, 0x233c22f0, 0x25bc24ca, 0x1f112652, 0x225e1fe3, 0x24e42302, 0x20e6267a, 0x24dc22d6, 0x21a12526, 0x250a2478, 0x221d211f, 0x232822a6, 0x1f3125ae, 0x1fb31f7d, 0x225a21d5, 0x23922300, 0x24e02456, 0x257e24ec, 0x266a2610, 0x23b02678, 0x242c23d0, 0x25d624bc, 0x2540267e, 0x212d206d, 0x24682408, 0x23b4231a, 0x260c2566, 0x20d4206b, 0x22b02256, 0x242422ca, 0x25ec2438, 0x246e1fb1, 0x1f811f83, 0x242e23e6, 0x25f024c8, 0x21a3254e, 0x25462254, 0x20be1f05, 0x23322159, 0x1fc32372, 0x1f3923b8, 0x1ef5214b, 0x21e12290, 0x1fed2422, 0x23982063, 0x253824cc, 0x25962276, 0x21ab228c, 0x21bb24a8, 0x1f1f2370, 0x1f7f1f5d, 0x24182244, 0x253e2494, 0x1fb725c6, 0x20982011, 0x21ef2127, 0x23ba22d8, 0x265625e4, 0x268c2680, 0x220f1fa5, 0x2590226c, 0x217b210d, 0x21d12189, 0x22f622d0, 0x23e0234e, 0x24642432, 0x24d02588, 0x25d8259c, 0x1fa71f91, 0x22ee201b, 0x25382514, 0x2155211d, 0x227221b7, 0x232c2406, 0x20491f27, 0x20f020be, 0x233a215b, 0x24502348, 0x25ca2460, 0x2612260a, 0x1f332630, 0x25c023da, 0x216725fe, 0x1f451f15, 0x20d020c0, 0x225421e7, 0x238022fc, 0x25a624d6, 0x220726aa, 0x1fa325ea, 0x2233222d, 0x22be22a2, 0x236e2340, 0x242023ae, 0x1f612636, 0x25f22191, 0x20e21f3d, 0x258a22b2, 0x216b2143, 0x23322237, 0x1f9525f6, 0x20d82009, 0x222521fc, 0x2294224a, 0x2378233e, 0x25162446, 0x25c4251c, 0x1fcb2604, 0x200b22c0, 0x235022fe, 0x25f824de, 0x2682266e, 0x22ae2231, 0x23f6247c, 0x240e23fc, 0x22ea2326, 0x1f23254c, 0x1f9724b0, 0x21151f8f, 0x241421a5, 0x229c20b6, 0x258e220d, 0x25ee250e, 0x2123252c, 0x20371f4d, 0x0, 0x2061, 0x2205, 0x1f850000, 0x238c232a, 0x23cc23be, 0x23d823ce, 0x24102616, 0x2452, 0x24e2, 0x2544, 0x259e0000, 0x25b4, 0x0, 0x26422640, 0x26762644, 0x25fc25b0, 0x1f471f35, 0x1faf1f51, 0x1fd51fb5, 0x203d202f, 0x205f2041, 0x20d62065, 0x216120da, 0x21792175, 0x21db2185, 0x220921f3, 0x22a82246, 0x22ce22b6, 0x230822f8, 0x23b22342, 0x23c42240, 0x23c623c2, 0x23ca23c8, 0x23d623d4, 0x23f223e8, 0x24322400, 0x243a2436, 0x24582444, 0x249a2480, 0x24ce249a, 0x252e2522, 0x254a2548, 0x256e256c, 0x259e259a, 0x26282606, 0x215d2634, 0x248c274b, 0x0, 0x1f7b1ef9, 0x1f2f1f5b, 0x1f651f4f, 0x1fbb1fad, 0x2025202f, 0x203b202d, 0x20692061, 0x2094208e, 0x20aa20a2, 0x21252121, 0x214d213d, 0x21712165, 0x21792169, 0x21852173, 0x21bf2193, 0x21c921c5, 0x220521dd, 0x221f221d, 0x226e2229, 0x22a22276, 0x22c422c8, 0x22dc22ce, 0x23a422f8, 0x2324230a, 0x234a232a, 0x236a2358, 0x237e237c, 0x238e238c, 0x23a02396, 0x23b6239e, 0x240023f4, 0x2428240c, 0x24402432, 0x24b22458, 0x250024c6, 0x252a2524, 0x253a252e, 0x253c2544, 0x25462548, 0x254a2542, 0x256e2550, 0x25a4258c, 0x25ce25be, 0x260625f4, 0x26202616, 0x262e2628, 0x265e2634, 0x272126ae, 0x2733271f, 0x1ea11e8d, 0x27671ea3, 0x27a92779, 0x26ac26a4, 0x0, 0x0, 0x0, 0xadf0adb, 0xade0ae3, 0xd280ae2, 0xd28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x134e0000, 0x13481345, 0x134b1351, 0x0, 0x0, 0x13850000, 0x13d20000, 0x135413a6, 0x1374136f, 0x1360138e, 0x13b7139b, 0x2f413cd, 0x13ca13c7, 0x13c313bf, 0x13591356, 0x1364135c, 0x1371136c, 0x137c1376, 0x137f, 0x13881382, 0x1390138b, 0x1398, 0x139d, 0x13a313a0, 0x13a80000, 0x13ab, 0x13b413b1, 0x13bc13b9, 0x137913cf, 0x13931367, 0x135f13ae, 0x18181818, 0x181e181e, 0x181e181e, 0x18201820, 0x18201820, 0x18241824, 0x18241824, 0x181c181c, 0x181c181c, 0x18221822, 0x18221822, 0x181a181a, 0x181a181a, 0x183c183c, 0x183c183c, 0x183e183e, 0x183e183e, 0x18281828, 0x18281828, 0x18261826, 0x18261826, 0x182a182a, 0x182a182a, 0x182c182c, 0x182c182c, 0x18321832, 0x18301830, 0x18341834, 0x182e182e, 0x18381838, 0x18361836, 0x18401840, 0x18401840, 0x18441844, 0x18441844, 0x18481848, 0x18481848, 0x18461846, 0x18461846, 0x184a184a, 0x184c184c, 0x184c184c, 0x186d186d, 0x18501850, 0x18501850, 0x184e184e, 0x184e184e, 0x15911591, 0x186a186a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18420000, 0x18421842, 0x18031842, 0x17ff1803, 0x180717ff, 0x185b1807, 0x18621862, 0x18551855, 0x18601860, 0x180b180b, 0x180b180b, 0x14151415, 0x17cd17cd, 0x180d180d, 0x17f117f1, 0x18011801, 0x17fd17fd, 0x18051805, 0x18091809, 0x17f51809, 0x17f517f5, 0x18641864, 0x18641864, 0x17d517d1, 0x17f517e5, 0x13f417f9, 0x13fe13f7, 0x1414140b, 0x141e1417, 0x1438142d, 0x146a144d, 0x1472146d, 0x1484147b, 0x148c1487, 0x14311422, 0x14d11435, 0x143c14d4, 0x150514fa, 0x151a150c, 0x15931562, 0x15a515a2, 0x15ba15b0, 0x15c815c5, 0x15e415df, 0x16071575, 0x163f160a, 0x16451642, 0x1653164c, 0x165b1656, 0x16711662, 0x16791674, 0x167f167c, 0x16851682, 0x16931688, 0x16aa1696, 0x16c816b9, 0x1579158c, 0x145116e0, 0x14591455, 0x145d1526, 0x172d1461, 0x174f1740, 0x17691758, 0x1771176c, 0x177f1774, 0x179c1782, 0x17aa17a3, 0x17c417b3, 0x14e417c7, 0x179714ee, 0x64005d, 0x72006b, 0x800079, 0x17e117dd, 0x17e917e5, 0x17f917f5, 0x140813db, 0x140e140b, 0x14171414, 0x144a1447, 0x1464144d, 0x146d146a, 0x14781475, 0x147e147b, 0x14871484, 0x16561653, 0x16741671, 0x16851679, 0x16931688, 0x158c1696, 0x16e01579, 0x152616e5, 0x17551752, 0x17631758, 0x176c1769, 0x17ad1797, 0x17b317b0, 0x17c417be, 0x17d117c7, 0x17d917d5, 0x17ed17e5, 0x13f713f4, 0x140b13fe, 0x141e1411, 0x1438142d, 0x1467144d, 0x148c147b, 0x14311422, 0x14d11435, 0x14fa143c, 0x150c1505, 0x1562151a, 0x1593156d, 0x15a515a2, 0x15ba15b0, 0x15df15c5, 0x157515e4, 0x160a1607, 0x1642163f, 0x164c1645, 0x1662165b, 0x167f167c, 0x16851682, 0x16aa1688, 0x16c816b9, 0x13e0158c, 0x14551451, 0x15261459, 0x1740172d, 0x1758174f, 0x17711766, 0x17851774, 0x17a3179c, 0x17b317aa, 0x17e515ed, 0x140b17ed, 0x144d1411, 0x147b1467, 0x151a1481, 0x154c1529, 0x16851557, 0x158c1688, 0x17661758, 0x15ed17b3, 0x162c1625, 0x15d71633, 0x15ff15da, 0x16191602, 0x152c161c, 0x155a152f, 0x1490155d, 0x142613fb, 0x1440142a, 0x159a1402, 0x15bd159d, 0x153415c0, 0x1546153b, 0x1549154c, 0x15701517, 0x15d715b7, 0x15ff15da, 0x16191602, 0x152c161c, 0x155a152f, 0x1490155d, 0x142613fb, 0x1440142a, 0x159a1402, 0x15bd159d, 0x153415c0, 0x1546153b, 0x1549154c, 0x15701517, 0x153415b7, 0x1546153b, 0x1529154c, 0x15c81557, 0x150514fa, 0x1534150c, 0x1546153b, 0x15df15c8, 0x13e313e3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14301421, 0x14341430, 0x1450143b, 0x14581454, 0x14a314a3, 0x14c114c5, 0x14fd1508, 0x15211501, 0x151d1521, 0x15251525, 0x15651565, 0x153e1596, 0x1537153e, 0x154f154f, 0x15531553, 0x15b315a8, 0x15cb15b3, 0x15cf15cb, 0x15e715d3, 0x15f315f3, 0x160d15f7, 0x16111615, 0x16481648, 0x16691665, 0x16c416bc, 0x16ad16c0, 0x16cb16ad, 0x16d216cb, 0x16fe16d2, 0x170b1702, 0x16f316eb, 0x17161712, 0x0, 0x177716ef, 0x1743177b, 0x17341747, 0x17381734, 0x175b175f, 0x17b617b6, 0x14291401, 0x14431425, 0x1460143f, 0x14ab145c, 0x14a7148f, 0x1569150f, 0x15ac1542, 0x16d616b5, 0x179f17a6, 0x172117ba, 0x174b166d, 0x16bc1665, 0x168f15fb, 0x171a1730, 0x168b16b1, 0x173016b1, 0x14ba1493, 0x164f16f7, 0x168b13fa, 0x159615e7, 0x173c1513, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x165e158f, 0x13d913de, 0x15731706, 0x15eb14e9, 0x1578158a, 0x1497157c, 0x14f1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b3102f6, 0x5401b33, 0x8d0546, 0x1b770093, 0x2ff1b79, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a6d02fc, 0x9931a6b, 0xa10993, 0xe3b00a5, 0x1b4b0e3f, 0x1b451b4f, 0x1b391b47, 0x1b351b3b, 0x1b3d1b37, 0x1b411b3f, 0x1b43, 0x98b0000, 0xc098f, 0xc000c, 0x993000c, 0x9930993, 0x1b3102f6, 0x2fa, 0x5400546, 0x8d0093, 0xa11a6d, 0xe3b00a5, 0x1b4b0e3f, 0x971b4f, 0x2f2009d, 0x2f802f4, 0x5590548, 0x544, 0x99098d, 0x566009b, 0x0, 0x0, 0x161f0057, 0x5a, 0x61, 0x16220068, 0x1629006f, 0x16300076, 0x1637007d, 0x163a0084, 0x13e613d5, 0x13e913e6, 0x178f13e9, 0x13ec178f, 0x17ca13ec, 0x17ca17ca, 0x13d717ca, 0x13f213d7, 0x13f213f2, 0x141a13f2, 0x141c141a, 0x141c141c, 0x1470141c, 0x14701470, 0x13f51470, 0x13f513f5, 0x13f813f5, 0x13f813f8, 0x13ff13f8, 0x13ff13ff, 0x14e013ff, 0x14e214e0, 0x13dc14e2, 0x140913dc, 0x14f81409, 0x14f814f8, 0x153214f8, 0x15321532, 0x15601532, 0x15601560, 0x15a01560, 0x15a015a0, 0x15c315a0, 0x15c315c3, 0x15dd15c3, 0x15dd15dd, 0x15e215dd, 0x15e215e2, 0x160515e2, 0x16051605, 0x163d1605, 0x163d163d, 0x1659163d, 0x16591659, 0x16771659, 0x16771677, 0x14ec1677, 0x14ec14ec, 0x140c14ec, 0x140c140c, 0x140f140c, 0x140f140f, 0x13e1140f, 0x13e113e1, 0x178813e1, 0x14151788, 0x13fc1415, 0x13fc13fc, 0x169e13fc, 0x16a2169e, 0x16a616a2, 0x169b16a6, 0x169b, 0x0, 0x8d0000, 0x970095, 0x9b0099, 0x9f009d, 0xa500a1, 0x2f402f2, 0x2f802f6, 0x30302fa, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x5460540, 0x5440548, 0x930559, 0x5680566, 0x5e305d5, 0x62905e6, 0x687067e, 0x6cf06ac, 0x71a0607, 0x7230734, 0x7a4077e, 0x83b06af, 0x85e082c, 0x56b088d, 0x77006b2, 0x95a0682, 0x98b060a, 0x98f098d, 0x9930991, 0x6920995, 0x9a00937, 0xa7d0a2e, 0x6020ad9, 0xae00b0d, 0xb79073e, 0x5d30a28, 0x7870b3b, 0x5d80cd3, 0x8400a11, 0xa240ba3, 0xde1086a, 0x6950b41, 0xe3b0611, 0xe3f0e3d, 0x1b280e41, 0x1b331b2a, 0x1b3f1b3d, 0x1e5c1b31, 0x1bd61e55, 0x1bfd1bef, 0x1c181c08, 0x1e0f1e02, 0x1cee1e17, 0x1bd81c16, 0x1bff1bf1, 0x1c1a1c0a, 0x1c411c24, 0x1c901c73, 0x1cad1c99, 0x1c1e1cbd, 0x1cda1ccd, 0x1bfb1cdf, 0x1cf51cf0, 0x1ca61bde, 0x1d111d0f, 0x1d0d1c8e, 0x1d391d1b, 0x1d741d55, 0x1c311d9f, 0x1c221ddc, 0x1e001def, 0x1e111e04, 0x1e1b1e19, 0x1bed1c35, 0x1c5d1e34, 0x1c061e42, 0x8b0088, 0x194419d4, 0x1a101949, 0x1a12194b, 0x19501a14, 0x19571955, 0x1a181a16, 0x1a1c1a1a, 0x1a201a1e, 0x195c19a6, 0x19661961, 0x196819b0, 0x196f196d, 0x19811977, 0x198e1983, 0x19981993, 0x199d, 0x0, 0x19d81947, 0x19dc19da, 0x19e019de, 0x0, 0x19e419e2, 0x19e8198c, 0x19ec19ea, 0x0, 0x197519ee, 0x19f419f2, 0x19f819f6, 0x0, 0x197f19fa, 0x19fe, 0x0, 0xe450e43, 0x90e4b, 0xe470e49, 0x1a82, 0x1a841b22, 0x1a8b1a89, 0x1b241a90, 0x1b26, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26b6, 0x26b9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26bc0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26c226bf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26c826c5, 0x26cf26cb, 0x26d726d3, 0x26db, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x26df0000, 0x26e226ea, 0x26e626ed, 0x26f1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0x602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x568, 0x5e605e3, 0x0, 0x687, 0x6070000, 0x71a, 0x77e0000, 0x6af07a4, 0x83b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90000, 0xb0d0000, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30000, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e60000, 0x67e0629, 0x687, 0x6070000, 0x734071a, 0x77e0723, 0x6af07a4, 0x83b, 0x88d085e, 0x6b2056b, 0x6820770, 0x95a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e60000, 0x67e0629, 0x687, 0x60706cf, 0x734071a, 0x723, 0x7a4, 0x0, 0x88d085e, 0x6b2056b, 0x6820770, 0x95a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x9370692, 0xa2e09a0, 0xad90a7d, 0xb0d0602, 0x73e0ae0, 0xa280b79, 0xb3b05d3, 0xcd30787, 0xa1105d8, 0xba30840, 0x86a0a24, 0xb410de1, 0x6110695, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0xb410de1, 0x6110695, 0xe800e6f, 0x0, 0xf380ee3, 0xf3c0f3a, 0xf5c0f3e, 0xfad0f5e, 0xfde0faf, 0xfe20fe0, 0xfe60fe4, 0x10060fe8, 0xfad1008, 0x100f100d, 0x10311011, 0x10351033, 0x1aa3077c, 0x10ea1086, 0x10ee10ec, 0x110e10f0, 0x116e1110, 0x11ae1170, 0x11b211b0, 0x11ce11cc, 0x11ee11d0, 0x11f811f0, 0x11fc11fa, 0x123c11fe, 0x1240123e, 0x1a9e1242, 0x116e10f0, 0x123c11ae, 0x11ee11f0, 0xf380ee3, 0xf3c0f3a, 0xf5c0f3e, 0xfad0f5e, 0xfde0faf, 0xfe20fe0, 0xfe60fe4, 0x10060fe8, 0xfad1008, 0x100f100d, 0x10311011, 0x10351033, 0x1aa3077c, 0x10ea1086, 0x10ee10ec, 0x110e10f0, 0x116e1110, 0x11ae1170, 0x11b211b0, 0x11ce11cc, 0x11ee11d0, 0x11f811f0, 0x11fc11fa, 0x123c11fe, 0x1240123e, 0x1a9e1242, 0x116e10f0, 0x123c11ae, 0x11ee11f0, 0xf380ee3, 0xf3c0f3a, 0xf5c0f3e, 0xfad0f5e, 0xfde0faf, 0xfe20fe0, 0xfe60fe4, 0x10060fe8, 0xfad1008, 0x100f100d, 0x10311011, 0x10351033, 0x1aa3077c, 0x10ea1086, 0x10ee10ec, 0x110e10f0, 0x116e1110, 0x11ae1170, 0x11b211b0, 0x11ce11cc, 0x11ee11d0, 0x11f811f0, 0x11fc11fa, 0x123c11fe, 0x1240123e, 0x1a9e1242, 0x116e10f0, 0x123c11ae, 0x11ee11f0, 0xf380ee3, 0xf3c0f3a, 0xf5c0f3e, 0xfad0f5e, 0xfde0faf, 0xfe20fe0, 0xfe60fe4, 0x10060fe8, 0xfad1008, 0x100f100d, 0x10311011, 0x10351033, 0x1aa3077c, 0x10ea1086, 0x10ee10ec, 0x110e10f0, 0x116e1110, 0x11ae1170, 0x11b211b0, 0x11ce11cc, 0x11ee11d0, 0x11f811f0, 0x11fc11fa, 0x123c11fe, 0x1240123e, 0x1a9e1242, 0x116e10f0, 0x123c11ae, 0x11ee11f0, 0xf380ee3, 0xf3c0f3a, 0xf5c0f3e, 0xfad0f5e, 0xfde0faf, 0xfe20fe0, 0xfe60fe4, 0x10060fe8, 0xfad1008, 0x100f100d, 0x10311011, 0x10351033, 0x1aa3077c, 0x10ea1086, 0x10ee10ec, 0x110e10f0, 0x116e1110, 0x11ae1170, 0x11b211b0, 0x11ce11cc, 0x11ee11d0, 0x11f811f0, 0x11fc11fa, 0x123c11fe, 0x1240123e, 0x1a9e1242, 0x116e10f0, 0x123c11ae, 0x11ee11f0, 0x12a212a0, 0x0, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x3140305, 0x30f0343, 0x3740365, 0x3920383, 0x3b003a1, 0x13f213d7, 0x14e013f5, 0x17880000, 0x13f81409, 0x13fc15c3, 0x14ec1677, 0x140f140c, 0x15e214f8, 0x1560163d, 0x13dc1659, 0x141c1532, 0x13ff1470, 0x15a014e2, 0x160515dd, 0x184a1814, 0x1816183a, 0x13f20000, 0x13f5, 0x13e1, 0x13f80000, 0x13fc0000, 0x14ec1677, 0x140f140c, 0x15e214f8, 0x1560163d, 0x1659, 0x141c1532, 0x13ff1470, 0x15a00000, 0x16050000, 0x0, 0x0, 0x0, 0x13f5, 0x0, 0x13f80000, 0x13fc0000, 0x14ec0000, 0x140f0000, 0x15e214f8, 0x15600000, 0x1659, 0x1532, 0x13ff0000, 0x15a00000, 0x16050000, 0x184a0000, 0x18160000, 0x13f20000, 0x13f5, 0x13e1, 0x13f80000, 0x13fc15c3, 0x1677, 0x140f140c, 0x15e214f8, 0x1560163d, 0x1659, 0x141c1532, 0x13ff1470, 0x15a00000, 0x160515dd, 0x1814, 0x183a, 0x13f213d7, 0x14e013f5, 0x178813e1, 0x13f81409, 0x13fc15c3, 0x14ec0000, 0x140f140c, 0x15e214f8, 0x1560163d, 0x13dc1659, 0x141c1532, 0x13ff1470, 0x15a014e2, 0x160515dd, 0x0, 0x0, 0x13f20000, 0x14e013f5, 0x17880000, 0x13f81409, 0x13fc15c3, 0x14ec0000, 0x140f140c, 0x15e214f8, 0x1560163d, 0x13dc1659, 0x141c1532, 0x13ff1470, 0x15a014e2, 0x160515dd, 0x0, 0x0, 0x307030a, 0x3f10316, 0x4ab0468, 0x4fa04de, 0x520050b, 0x531, 0x0, 0x0, 0x10200fe, 0x10a0106, 0x112010e, 0x11a0116, 0x122011e, 0x12a0126, 0x132012e, 0x13a0136, 0x142013e, 0x14a0146, 0x152014e, 0x15a0156, 0x162015e, 0x5e31b4d, 0x5e5082c, 0x933, 0x5d50568, 0x5e605e3, 0x67e0629, 0x6ac0687, 0x60706cf, 0x734071a, 0x77e0723, 0x6af07a4, 0x82c083b, 0x88d085e, 0x6b2056b, 0x6820770, 0x60a095a, 0x76c06b1, 0x8660860, 0x9300827, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x761075e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x606, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c9e1bc3, 0x1cad, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20b02197, 0x1cf71ff3, 0x20811f17, 0x208c2532, 0x21fe1f1d, 0x21e722f2, 0x21451f9d, 0x21eb1f69, 0x24261f93, 0x2560235c, 0x200f2073, 0x219d22cc, 0x1ee921b3, 0x25a01eef, 0x1efd20fa, 0x21ad2001, 0x21992574, 0x23f023d2, 0x22bc2005, 0x329221b, 0x1f9f2366, 0x2035, 0x0, 0x0, 0x1b511b69, 0x1b5d1b55, 0x1b611b6d, 0x1b591b71, 0x1b65, 0x0, 0x0, 0x0, 0x1ffd2147, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f031f07, 0x26f51f0b, 0x1f351f2d, 0x1f3b1f37, 0x1f411f3f, 0x1f431f47, 0x26fd1e63, 0x1f531f51, 0x1f631f55, 0x1e6526f7, 0x1f691f59, 0x1f7126fb, 0x1f251f75, 0x1f7b1f79, 0x1f8927b9, 0x1e691f8d, 0x1f9b1f99, 0x1fa11f9f, 0x1fad1e6b, 0x1fb51faf, 0x1fbd1fbb, 0x1fc31fbf, 0x1fd51fd3, 0x1fe11fd9, 0x1fe71fe5, 0x1fe71fe7, 0x22e42703, 0x1ff51ff1, 0x1ffb2705, 0x20031fff, 0x200d2017, 0x20152013, 0x201d2019, 0x2023201f, 0x20292027, 0x202d2029, 0x20332031, 0x204b2039, 0x204d203d, 0x2043203f, 0x20711f8f, 0x20572055, 0x20532059, 0x205b205d, 0x27072067, 0x20772075, 0x2081207b, 0x20962085, 0x270b2709, 0x209e209c, 0x209a20a0, 0x1e6d20a4, 0x20a81e6f, 0x20ac20ac, 0x20ba270d, 0x20be20bc, 0x270f20c2, 0x20c820c6, 0x20cc2137, 0x20d21e71, 0x20e020da, 0x271320de, 0x271520e4, 0x20e820ea, 0x20f420ec, 0x1e7320f6, 0x210220fe, 0x21062104, 0x27171e75, 0x21171e77, 0x211b2119, 0x27cd211f, 0x271b212b, 0x2486271b, 0x21332133, 0x27291e79, 0x213b277d, 0x1e7b213f, 0x21512149, 0x21572153, 0x1e7f215f, 0x21611e7d, 0x2163271d, 0x216f216d, 0x216f2171, 0x21792177, 0x217d2181, 0x2183217f, 0x21872185, 0x218f210b, 0x219f219b, 0x21b121a7, 0x21af2723, 0x21b521a9, 0x21c321b9, 0x21c72725, 0x21bd21c1, 0x21cb1e81, 0x21d321cf, 0x1e8321cd, 0x21df21db, 0x21f52727, 0x22032215, 0x22091e89, 0x1e851e87, 0x1f6d1f6b, 0x220b2217, 0x1ebb2470, 0x221f221d, 0x222b2221, 0x27312227, 0x22351e8b, 0x2242222f, 0x27352246, 0x22392248, 0x1e8d224c, 0x2250224e, 0x22582252, 0x225c2737, 0x22621e8f, 0x22642739, 0x226a1e91, 0x22762270, 0x273b2278, 0x273d2711, 0x273f2288, 0x2292228e, 0x2298228a, 0x22a822a0, 0x22a422a2, 0x22ac22aa, 0x229e2741, 0x22ba22b8, 0x22c41e93, 0x274322c2, 0x22d222b4, 0x27472745, 0x22de22d4, 0x22da22dc, 0x22e01e95, 0x22e622e8, 0x26f922ec, 0x274922f4, 0x274d22fa, 0x230a2304, 0x274f2314, 0x2320231e, 0x27532751, 0x2336232e, 0x23381e97, 0x1e991e99, 0x23462344, 0x234c234a, 0x1e9b2352, 0x2755235e, 0x2757236c, 0x27192372, 0x2759237a, 0x275d275b, 0x1e9f1e9d, 0x27612396, 0x2763275f, 0x239a2765, 0x239c239c, 0x1ea323a0, 0x1ea523a2, 0x27691ea7, 0x23b023ac, 0x1ea923b6, 0x23c8276b, 0x276f276d, 0x23e423d8, 0x23e81eab, 0x23ec23ea, 0x27732771, 0x23f82773, 0x27751ead, 0x24042402, 0x27771eaf, 0x1eb12412, 0x2416241a, 0x277b241e, 0x1eb3242a, 0x24342430, 0x1eb5243c, 0x2781277f, 0x27831eb7, 0x27852448, 0x2454244e, 0x27872458, 0x24622789, 0x2466278b, 0x1eb9272b, 0x24742472, 0x24761ebd, 0x278d20a6, 0x272d278f, 0x2486272f, 0x25942488, 0x249e1ebf, 0x24a0249c, 0x24a21fa9, 0x24a624a4, 0x279124aa, 0x24ac24a8, 0x24b824b6, 0x24ba24ae, 0x24ce24c4, 0x24be24b4, 0x24c224c0, 0x27972793, 0x1ec12795, 0x24d424d2, 0x279f24d8, 0x279924da, 0x1ec51ec3, 0x279d279b, 0x24ea1ec7, 0x24ee24ec, 0x24f624f0, 0x24fa24f4, 0x250024f8, 0x24fe24fc, 0x1ec92502, 0x25082506, 0x25101ecb, 0x27a12512, 0x251a2518, 0x25201ecd, 0x27a31e67, 0x1ecf27a5, 0x25361ed1, 0x25502542, 0x27a72558, 0x25642562, 0x25762570, 0x26ff27ab, 0x257a257c, 0x27012580, 0x258c2586, 0x27af27ad, 0x25b225ac, 0x27b125b6, 0x25cc25b8, 0x25d425d2, 0x25da25d0, 0x27b325dc, 0x1ed325e2, 0x27b525e6, 0x26021ed5, 0x260e20ee, 0x27bb27b7, 0x1ed91ed7, 0x27bd2622, 0x27bf1edb, 0x262e262e, 0x27c12632, 0x1edd263e, 0x264c2646, 0x26542650, 0x27c31edf, 0x266c265e, 0x1ee12672, 0x26741ee3, 0x1ee527c5, 0x27c927c7, 0x268627cb, 0x26901ee7, 0x26962694, 0x269e269a, 0x27cf26a2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//12288 bytes -+enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x240], [ 0x100, 0x400, 0x1380], [ 0x2020100, 0x3020202, 0x2020204, 0x2050202, 0x2020202, 0x6020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x10000, 0x30002, 0x50004, 0x6, 0x0, 0x70000, 0x90008, 0xb000a, 0xc0000, 0x0, 0x0, 0xd, 0xe0000, 0x0, 0x0, 0x0, 0x0, 0x10000f, 0x110000, 0x130012, 0x0, 0x140000, 0x160015, 0x170000, 0x180000, 0x190000, 0x1a0000, 0x0, 0x0, 0x1b0000, 0x1c, 0x1d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f001e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x210020, 0x230022, 0x250024, 0x270026, 0x28, 0x0, 0x29, 0x2b002a, 0x2d002c, 0x2f002e, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x310000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x320000, 0x340033, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x360035, 0x380037, 0x3a0039, 0x3c003b, 0x3e003d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x410000, 0x430042, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x450044, 0x470046, 0x490048, 0x4b004a, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf000c, 0x250012, 0x4f0045, 0x850000, 0xa1009e, 0xcb00a4, 0x121011e, 0x1330124, 0x1880000, 0x1a0019d, 0x1b601a3, 0x1da, 0x26d0000, 0x2730270, 0x2f30287, 0x0, 0x322031f, 0x3380325, 0x3620358, 0x3980000, 0x3b403b1, 0x3de03b7, 0x4370434, 0x446043a, 0x49c0000, 0x4b404b1, 0x4ca04b7, 0x4ee, 0x5840000, 0x58a0587, 0x60d059e, 0x61c0000, 0x33b0028, 0x33e002b, 0x380006d, 0x38c0079, 0x38f007c, 0x392007f, 0x3950082, 0x3a2008f, 0x0, 0x3cd00ba, 0x3d800c5, 0x3db00c8, 0x3fb00e8, 0x3e400d1, 0x40a00f7, 0x41000fd, 0x4130100, 0x4190106, 0x41c0109, 0x0, 0x43d0127, 0x440012a, 0x443012d, 0x45c0149, 0x130, 0x0, 0x462014f, 0x471015d, 0x1630000, 0x1700477, 0x1660484, 0x47a, 0x0, 0x1850000, 0x1940499, 0x18e04a8, 0x4a2, 0x0, 0x4d901c5, 0x4e401d0, 0x4f801e4, 0x0, 0x52f021b, 0x5450231, 0x5350221, 0x54b0237, 0x552023e, 0x5690255, 0x5580244, 0x57b0264, 0x572025b, 0x0, 0x58d0276, 0x594027d, 0x59b0284, 0x5b4029d, 0x5b702a0, 0x5e002c9, 0x5f502de, 0x61002f6, 0x30b0302, 0x3110628, 0x314062e, 0x631, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50401f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2ac0000, 0x5c3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x560000, 0x13d0369, 0x1e70450, 0x2a304fb, 0x29205ba, 0x28e05a9, 0x29605a5, 0x28a05ad, 0x5a1, 0x35b0048, 0x3540041, 0x653064a, 0x0, 0x4160103, 0x46b0157, 0x522020e, 0x5250211, 0x65f065c, 0x465, 0x0, 0x40700f4, 0x0, 0x4960182, 0x3650052, 0x6500647, 0x656064d, 0x36c0059, 0x36f005c, 0x3e700d4, 0x3ea00d7, 0x4530140, 0x4560143, 0x4fe01ea, 0x50101ed, 0x5380224, 0x53b0227, 0x5bd02a6, 0x5c002a9, 0x5660252, 0x5780261, 0x0, 0x4250112, 0x0, 0x0, 0x0, 0x351003e, 0x3f400e1, 0x4f101dd, 0x4d101bd, 0x4e701d3, 0x4ea01d6, 0x61602fc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000d, 0x66b0000, 0x137, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x662, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x63d0000, 0x6450670, 0x6df06c3, 0x72c, 0x759, 0x7980778, 0x8d1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7810735, 0x84707e9, 0x8c10867, 0x92f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x92808ca, 0x91f08fd, 0x95f, 0x0, 0x9b40000, 0x9b7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9cc09c6, 0x9c30000, 0x0, 0x9ba0000, 0x0, 0x0, 0x9d809e4, 0x9ed, 0x0, 0x0, 0x0, 0x0, 0x9de0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa0e0a08, 0xa050000, 0x0, 0xa410000, 0x0, 0x0, 0xa1a0a26, 0xa2f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa470a44, 0x0, 0x0, 0x0, 0x0, 0x9cf0000, 0xa11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9ff09bd, 0xa0209c0, 0x0, 0xa0b09c9, 0x0, 0xa4d0a4a, 0xa1409d2, 0xa1709d5, 0x0, 0xa1d09db, 0xa2309e1, 0xa2909e7, 0x0, 0xa530a50, 0xa3e09fc, 0xa2c09ea, 0xa3209f0, 0xa3509f3, 0xa3809f6, 0x0, 0xa3b09f9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xac10abe, 0xac40ac7, 0xaca, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xad3, 0xacd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xad00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xae80000, 0x0, 0x0, 0x0, 0xaf10000, 0x0, 0xaf4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xad90ad6, 0xadf0adc, 0xae50ae2, 0xaee0aeb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb000000, 0xb03, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xafa0af7, 0xafd0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb120000, 0x0, 0xb15, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb060000, 0xb0c0b09, 0x0, 0xb0f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb21, 0xb1e0000, 0xb24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb1b0b18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb27, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb300b2a, 0xb2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb33, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb36, 0x0, 0x0, 0xb400000, 0xb43, 0xb3c0b39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb4c0b46, 0xb49, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb4f, 0xb550b52, 0xb59, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb5f0000, 0x0, 0x0, 0x0, 0x0, 0xb620000, 0x0, 0x0, 0xb65, 0x0, 0xb680000, 0x0, 0x0, 0xb6b, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb5c0000, 0x0, 0x0, 0x0, 0x0, 0xb6e0000, 0xb710000, 0xb89, 0xb8c, 0x0, 0x0, 0x0, 0xb740000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb7a0000, 0x0, 0x0, 0x0, 0x0, 0xb7d0000, 0x0, 0x0, 0xb80, 0x0, 0xb830000, 0x0, 0x0, 0xb86, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb770000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb8f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb92, 0xb95, 0xb98, 0xb9b, 0xb9e, 0x0, 0xba1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xba40000, 0xba70000, 0x0, 0xbad0baa, 0xbb00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x37d006a, 0x3830070, 0x3860073, 0x3890076, 0x39b0088, 0x39f008c, 0x3a50092, 0x3ae009b, 0x3a80095, 0x3ab0098, 0x3d000bd, 0x3d400c1, 0x3fe00eb, 0x40100ee, 0x3f700e4, 0x40400f1, 0x40d00fa, 0x41f010c, 0x4280115, 0x422010f, 0x42b0118, 0x42e011b, 0x45f014c, 0x4490136, 0x4680154, 0x46e015a, 0x4740160, 0x47d0169, 0x480016c, 0x48a0176, 0x4870173, 0x48d0179, 0x490017c, 0x493017f, 0x49f018b, 0x4a50191, 0x4ae019a, 0x4ab0197, 0x4cd01b9, 0x4d501c1, 0x4dc01c8, 0x4e001cc, 0x5290215, 0x52c0218, 0x532021e, 0x53e022a, 0x541022d, 0x5480234, 0x5550241, 0x55f024b, 0x54e023a, 0x55b0247, 0x562024e, 0x56c0258, 0x575025e, 0x581026a, 0x57e0267, 0x5dd02c6, 0x5e602cf, 0x5e302cc, 0x5900279, 0x5970280, 0x5e902d2, 0x5ec02d5, 0x5ef02d8, 0x5f202db, 0x5fb02e4, 0x5f802e1, 0x60102e7, 0x60402ea, 0x60702ed, 0x61902ff, 0x62b030e, 0x6340317, 0x637031a, 0x56f0431, 0x62205fe, 0x6590000, 0x0, 0x0, 0x372005f, 0x35f004c, 0x32c0019, 0x3280015, 0x3340021, 0x330001d, 0x3750062, 0x3450032, 0x341002e, 0x34d003a, 0x3490036, 0x3790066, 0x3ed00da, 0x3e100ce, 0x3ca00b7, 0x3be00ab, 0x3ba00a7, 0x3c600b3, 0x3c200af, 0x3f000dd, 0x44d013a, 0x4590146, 0x51b0207, 0x4f501e1, 0x4be01aa, 0x4ba01a6, 0x4c601b2, 0x4c201ae, 0x51e020a, 0x50b01f7, 0x50701f3, 0x51301ff, 0x50f01fb, 0x5170203, 0x5da02c3, 0x5b1029a, 0x5ca02b3, 0x5c602af, 0x5d202bb, 0x5ce02b7, 0x5d602bf, 0x60a02f0, 0x6250308, 0x61f0305, 0x61302f9, 0x0, 0x0, 0x0, 0x81807f6, 0x81b07f9, 0x8240802, 0x82d080b, 0x69b0679, 0x69e067c, 0x6a70685, 0x6b0068e, 0x855084a, 0x858084d, 0x85c0851, 0x0, 0x6d106c6, 0x6d406c9, 0x6d806cd, 0x0, 0x890086e, 0x8930871, 0x89c087a, 0x8a50883, 0x70406e2, 0x70706e5, 0x71006ee, 0x71906f7, 0x8e808d9, 0x8eb08dc, 0x8ef08e0, 0x8f308e4, 0x7470738, 0x74a073b, 0x74e073f, 0x7520743, 0x90b0900, 0x90e0903, 0x9120907, 0x0, 0x767075c, 0x76a075f, 0x76e0763, 0x0, 0x9460937, 0x949093a, 0x94d093e, 0x9510942, 0x7840000, 0x7870000, 0x78b0000, 0x78f0000, 0x9880966, 0x98b0969, 0x9940972, 0x99d097b, 0x7bd079b, 0x7c0079e, 0x7c907a7, 0x7d207b0, 0x7e907e2, 0x8470844, 0x8670860, 0x8c108be, 0x8fd08fa, 0x91f091c, 0x95f0958, 0x0, 0x8360814, 0x81f07fd, 0x8280806, 0x831080f, 0x6b90697, 0x6a20680, 0x6ab0689, 0x6b40692, 0x8ae088c, 0x8970875, 0x8a0087e, 0x8a90887, 0x7220700, 0x70b06e9, 0x71406f2, 0x71d06fb, 0x9a60984, 0x98f096d, 0x9980976, 0x9a1097f, 0x7db07b9, 0x7c407a2, 0x7cd07ab, 0x7d607b4, 0x7f007f3, 0x84107e5, 0x7ec, 0x83d083a, 0x6730676, 0x670066d, 0x6bd, 0x8bc, 0x6400000, 0x8b90863, 0x86a, 0x8b508b2, 0x6c306c0, 0x6df06dc, 0xbb30726, 0xbb90bb6, 0x8c408c7, 0x8d108cd, 0x0, 0x8d508f7, 0x72f0732, 0x72c0729, 0xbbc0000, 0xbc20bbf, 0x9220925, 0x92f092b, 0x9190916, 0x9330955, 0x77b077e, 0x7780775, 0x63a0772, 0x31d063d, 0x0, 0x9b1095b, 0x962, 0x9ad09aa, 0x7590756, 0x7980795, 0x64307df, 0x0, 0xbc70bc5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x793, 0x0, 0x4f0152, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbcc0bc9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbcf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbd20000, 0xbd50bd8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbdb, 0x0, 0xbde0000, 0x0, 0xbe1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbe4, 0xbe7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbea0000, 0x0, 0xbed, 0xbf00000, 0xbf30000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0xbf9, 0x0, 0x0, 0x0, 0x0, 0xbf60000, 0x90003, 0xbff0bfc, 0x0, 0xc050c02, 0x0, 0xc0b0c08, 0x0, 0x0, 0x0, 0xc110c0e, 0x0, 0xc1d0c1a, 0x0, 0xc230c20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc2f0c2c, 0xc350c32, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc170c14, 0xc290c26, 0x0, 0x0, 0x0, 0xc3b0c38, 0xc410c3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc470000, 0xc49, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4e, 0xc51, 0xc54, 0xc57, 0xc5a, 0xc5d, 0xc60, 0xc63, 0xc66, 0xc69, 0xc6c, 0xc6f, 0xc720000, 0xc750000, 0xc780000, 0x0, 0x0, 0x0, 0xc7e0c7b, 0xc810000, 0xc84, 0xc8a0c87, 0xc8d0000, 0xc90, 0xc960c93, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4b, 0x0, 0x0, 0x0, 0x0, 0xc99, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc9f, 0xca2, 0xca5, 0xca8, 0xcab, 0xcae, 0xcb1, 0xcb4, 0xcb7, 0xcba, 0xcbd, 0xcc0, 0xcc30000, 0xcc60000, 0xcc90000, 0x0, 0x0, 0x0, 0xccf0ccc, 0xcd20000, 0xcd5, 0xcdb0cd8, 0xcde0000, 0xce1, 0xce70ce4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc9c, 0xcea0000, 0xcf00ced, 0xcf3, 0x0, 0xcf6, 0xfb71241, 0x124b125d, 0xd831043, 0x13270e29, 0xe991327, 0xe4f1293, 0xf550e97, 0x116710cd, 0x11fd11e3, 0x12791215, 0x10190feb, 0x109d1069, 0x128911c7, 0xd8d12f3, 0xff50e1d, 0x11e11079, 0xedb1309, 0x11d91051, 0xf65121d, 0x12031189, 0xfbd0eff, 0x108d1025, 0xd9d127d, 0xe050dd9, 0xff10f95, 0x10d31077, 0x11dd1171, 0x125911e7, 0x12fb12cf, 0x10e91307, 0x114d1107, 0x12a111b9, 0x122f130b, 0xf0b0e87, 0x117d112f, 0x10ed1083, 0x12cb1249, 0xecb0e85, 0x102f0fed, 0x11471047, 0x12b11159, 0x117f0e03, 0xddd0ddf, 0x114f1115, 0x12b511c5, 0xf67123d, 0x12350feb, 0xebb0d87, 0x10950f27, 0xe1110c1, 0xda510f1, 0xd7f0f1b, 0xf9d1011, 0xe231145, 0x10d70e7d, 0x122711c9, 0x126d1005, 0xf6f100d, 0xf7b11a5, 0xd9110bf, 0xddb0dc3, 0x113d0fdb, 0x122d1195, 0xe091291, 0xe9f0e37, 0xfa10f07, 0x10f31053, 0x12f712ab, 0x1313130d, 0xfb50df9, 0x12690ffd, 0xf490ef3, 0xf910f57, 0x106d104b, 0x111110af, 0x11791153, 0x11cd1261, 0x12a31271, 0xdfb0de9, 0x10670e41, 0x1227120b, 0xf230efd, 0x10030f77, 0x1091112d, 0xe670d97, 0xee50ebb, 0x109b0f29, 0x116b10a9, 0x12951175, 0x12d112c9, 0xd9f12dd, 0x128d110f, 0xf3512c1, 0xdb10d8f, 0xec70ebd, 0xfeb0f9f, 0x10cb1073, 0x127711d3, 0xfad1323, 0xdf712af, 0xfd10fcb, 0x103b1021, 0x10bd10a1, 0x114310e7, 0xdc512e3, 0x12b70f5d, 0xed70da9, 0x12631031, 0xf390f17, 0x10950fd5, 0xdeb12bb, 0xecf0e31, 0xfc30fa7, 0x10150fe1, 0x10c3109f, 0x120d1163, 0x128f1213, 0xe1312c5, 0xe33103d, 0x10b11075, 0x12bd11db, 0x130f12ff, 0x102d0fcf, 0x1121118b, 0x11331125, 0x1063108b, 0xd93123b, 0xded11ad, 0xef50de7, 0x11390f69, 0x101b0eb5, 0x12670fb3, 0x12b31205, 0xf031221, 0xe590db5, 0x0, 0xe7b, 0xfab, 0xde10000, 0x10cf108f, 0x110310f5, 0x110d1105, 0x113512d3, 0x116d, 0x11df, 0x1233, 0x12730000, 0x1283, 0x0, 0x12e912e7, 0x130512eb, 0x12bf127f, 0xdb30da1, 0xe010db9, 0xe170e07, 0xe5f0e53, 0xe790e63, 0xecd0e7f, 0xf2f0ed1, 0xf470f43, 0xf970f53, 0xfaf0fa3, 0x10270fdd, 0x10491035, 0x107d106f, 0x10eb10a3, 0x10fb10f7, 0x10fd10f9, 0x110110ff, 0x110b1109, 0x111d1117, 0x11531127, 0x115b1157, 0x11731161, 0x1197118d, 0x11cb1197, 0x12231219, 0x12391237, 0x124f124d, 0x1273126f, 0x12d912c7, 0xf2b12e1, 0x119313be, 0x0, 0xdd70d81, 0xd9b0dc1, 0xdc90db7, 0xe0b0dff, 0xe490e53, 0xe5d0e51, 0xe830e7b, 0xe9b0e95, 0xeb10ea9, 0xf050f01, 0xf1d0f13, 0xf3f0f33, 0xf470f37, 0xf530f41, 0xf7f0f5f, 0xf890f85, 0xfab0f99, 0xfbf0fbd, 0xfff0fc7, 0x10211005, 0x10411045, 0x10571049, 0x10e3106f, 0x1089107f, 0x10ab108f, 0x10b910b5, 0x10c910c7, 0x10d110cf, 0x10df10d5, 0x10ef10dd, 0x1127111f, 0x11491131, 0x115f1153, 0x11af1173, 0x11f911c3, 0x121f121b, 0x12291223, 0x122b1233, 0x12351237, 0x12391231, 0x124f123f, 0x12751265, 0x1299128b, 0x12c712b9, 0x12d512d3, 0x12db12d9, 0x12f912e1, 0x13941327, 0x13a61392, 0xd370d23, 0x13da0d39, 0x141c13ec, 0x13251321, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa7a0000, 0xabb0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xab50ab2, 0xaae0aaa, 0xa590a56, 0xa5f0a5c, 0xa680a65, 0xa710a6b, 0xa74, 0xa7d0a77, 0xa830a80, 0xa89, 0xa8c, 0xa920a8f, 0xa950000, 0xa98, 0xaa10a9e, 0xaa70aa4, 0xa6e0ab8, 0xa860a62, 0xa9b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1329, 0x132c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x132f0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13351332, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x133b1338, 0x1342133e, 0x134a1346, 0x134e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13520000, 0x1355135d, 0x13591360, 0x1364, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd850d89, 0x13680d8b, 0xda10d99, 0xda70da3, 0xdad0dab, 0xdaf0db3, 0x13700cf9, 0xdbb0db9, 0xdc70dbd, 0xcfb136a, 0xdcb0dbf, 0xdd1136e, 0xd950dd3, 0xdd70dd5, 0xde3142c, 0xcff0de5, 0xdf10def, 0xdf50df3, 0xdff0d01, 0xe070e01, 0xe0d0e0b, 0xe110e0f, 0xe170e15, 0xe1b0e19, 0xe210e1f, 0xe210e21, 0x105d1376, 0xe270e25, 0xe2b1378, 0xe2f0e2d, 0xe350e3d, 0xe3b0e39, 0xe430e3f, 0xe470e45, 0xe4d0e4b, 0xe510e4d, 0xe570e55, 0xe690e5b, 0xe6b0e5f, 0xe650e61, 0xe890de7, 0xe710e6f, 0xe6d0e73, 0xe750e77, 0x137a0e81, 0xe8d0e8b, 0xe910e8f, 0xe9d0e93, 0x137e137c, 0xea50ea3, 0xea10ea7, 0xd030eab, 0xeaf0d05, 0xeb30eb3, 0xeb71380, 0xebb0eb9, 0x13820ebf, 0xec30ec1, 0xec50f0f, 0xec90d07, 0xed50ed1, 0x13860ed3, 0x13880ed9, 0xedd0edf, 0xee70ee1, 0xd090ee9, 0xeed0eeb, 0xef10eef, 0x138a0d0b, 0xef70d0d, 0xefb0ef9, 0x14400eff, 0x138e0f09, 0x118f138e, 0xf0d0f0d, 0x139c0d0f, 0xf1113f0, 0xd110f15, 0xf1f0f19, 0xf250f21, 0xd150f2d, 0xf2f0d13, 0xf311390, 0xf3d0f3b, 0xf3d0f3f, 0xf470f45, 0xf4b0f4f, 0xf510f4d, 0xf550f53, 0xf5b0f59, 0xf630f61, 0xf730f6b, 0xf711396, 0xf750f6d, 0xf830f79, 0xf871398, 0xf7d0f81, 0xf8b0d17, 0xf930f8f, 0xd190f8d, 0xf9b0f97, 0xfa5139a, 0xfa90fb9, 0xfaf0d1f, 0xd1b0d1d, 0xdcf0dcd, 0xfb10fbb, 0xd511181, 0xfbf0fbd, 0xfc90fc1, 0x13a40fc5, 0xfd30d21, 0xfd90fcd, 0x13a80fdd, 0xfd70fdf, 0xd230fe3, 0xfe70fe5, 0xfef0fe9, 0xff313aa, 0xff70d25, 0xff913ac, 0xffb0d27, 0x10051001, 0x13ae1007, 0x13b01384, 0x13b21009, 0x1013100f, 0x1017100b, 0x1027101f, 0x10231021, 0x102b1029, 0x101d13b4, 0x10391037, 0x10410d29, 0x13b6103f, 0x104d1033, 0x13ba13b8, 0x1059104f, 0x10551057, 0x105b0d2b, 0x105f1061, 0x136c1065, 0x13bc106b, 0x13c01071, 0x107f107b, 0x13c21081, 0x10871085, 0x13c613c4, 0x10971093, 0x10990d2d, 0xd2f0d2f, 0x10a710a5, 0x10ad10ab, 0xd3110b3, 0x13c810b7, 0x13ca10bb, 0x138c10c1, 0x13cc10c5, 0x13d013ce, 0xd350d33, 0x13d410d5, 0x13d613d2, 0x10d913d8, 0x10db10db, 0xd3910df, 0xd3b10e1, 0x13dc0d3d, 0x10e910e5, 0xd3f10ef, 0x10ff13de, 0x13e213e0, 0x1113110d, 0x11170d41, 0x111b1119, 0x13e613e4, 0x112313e6, 0x13e80d43, 0x112b1129, 0x13ea0d45, 0xd471137, 0x113b113f, 0x13ee1141, 0xd49114b, 0x11551151, 0xd4b115d, 0x13f413f2, 0x13f60d4d, 0x13f81165, 0x116f1169, 0x13fa1173, 0x117713fc, 0x117b13fe, 0xd4f139e, 0x11851183, 0x11870d53, 0x14000ead, 0x13a01402, 0x118f13a2, 0x126b1191, 0x119b0d55, 0x119d1199, 0x119f0dfd, 0x11a311a1, 0x140411a7, 0x11a911a5, 0x11b511b3, 0x11b711ab, 0x11cb11c1, 0x11bb11b1, 0x11bf11bd, 0x140a1406, 0xd571408, 0x11d111cf, 0x141211d5, 0x140c11d7, 0xd5b0d59, 0x1410140e, 0x11e50d5d, 0x11e911e7, 0x11ef11eb, 0x11f311ed, 0x11f911f1, 0x11f711f5, 0xd5f11fb, 0x120111ff, 0x12070d61, 0x14141209, 0x1211120f, 0x12170d63, 0x14160cfd, 0xd651418, 0x12250d67, 0x123f1231, 0x141a1243, 0x12471245, 0x12531251, 0x1372141e, 0x12551257, 0x1374125b, 0x1265125f, 0x14221420, 0x1281127b, 0x14241285, 0x12971287, 0x129f129d, 0x12a5129b, 0x142612a7, 0xd6912a9, 0x142812ad, 0x12c30d6b, 0x12cd0ee3, 0x142e142a, 0xd6f0d6d, 0x143012d7, 0x14320d71, 0x12db12db, 0x143412df, 0xd7312e5, 0x12ef12ed, 0x12f512f1, 0x14360d75, 0x12fd12f9, 0xd771301, 0x13030d79, 0xd7b1438, 0x143c143a, 0x1311143e, 0x13150d7d, 0x13191317, 0x131d131b, 0x1442131f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+@property -+{ -+private alias _IDCA = immutable(dchar[]); -+_IDCA decompCanonTable() { static _IDCA t = [ 0x0, 0x3b, 0x0, 0x3c, 0x338, 0x0, 0x3d, 0x338, 0x0, 0x3e, 0x338, 0x0, 0x41, 0x300, 0x0, 0x41, 0x301, 0x0, 0x41, 0x302, 0x0, 0x41, 0x302, 0x300, 0x0, 0x41, 0x302, 0x301, 0x0, 0x41, 0x302, 0x303, 0x0, 0x41, 0x302, 0x309, 0x0, 0x41, 0x303, 0x0, 0x41, 0x304, 0x0, 0x41, 0x306, 0x0, 0x41, 0x306, 0x300, 0x0, 0x41, 0x306, 0x301, 0x0, 0x41, 0x306, 0x303, 0x0, 0x41, 0x306, 0x309, 0x0, 0x41, 0x307, 0x0, 0x41, 0x307, 0x304, 0x0, 0x41, 0x308, 0x0, 0x41, 0x308, 0x304, 0x0, 0x41, 0x309, 0x0, 0x41, 0x30a, 0x0, 0x41, 0x30a, 0x301, 0x0, 0x41, 0x30c, 0x0, 0x41, 0x30f, 0x0, 0x41, 0x311, 0x0, 0x41, 0x323, 0x0, 0x41, 0x323, 0x302, 0x0, 0x41, 0x323, 0x306, 0x0, 0x41, 0x325, 0x0, 0x41, 0x328, 0x0, 0x42, 0x307, 0x0, 0x42, 0x323, 0x0, 0x42, 0x331, 0x0, 0x43, 0x301, 0x0, 0x43, 0x302, 0x0, 0x43, 0x307, 0x0, 0x43, 0x30c, 0x0, 0x43, 0x327, 0x0, 0x43, 0x327, 0x301, 0x0, 0x44, 0x307, 0x0, 0x44, 0x30c, 0x0, 0x44, 0x323, 0x0, 0x44, 0x327, 0x0, 0x44, 0x32d, 0x0, 0x44, 0x331, 0x0, 0x45, 0x300, 0x0, 0x45, 0x301, 0x0, 0x45, 0x302, 0x0, 0x45, 0x302, 0x300, 0x0, 0x45, 0x302, 0x301, 0x0, 0x45, 0x302, 0x303, 0x0, 0x45, 0x302, 0x309, 0x0, 0x45, 0x303, 0x0, 0x45, 0x304, 0x0, 0x45, 0x304, 0x300, 0x0, 0x45, 0x304, 0x301, 0x0, 0x45, 0x306, 0x0, 0x45, 0x307, 0x0, 0x45, 0x308, 0x0, 0x45, 0x309, 0x0, 0x45, 0x30c, 0x0, 0x45, 0x30f, 0x0, 0x45, 0x311, 0x0, 0x45, 0x323, 0x0, 0x45, 0x323, 0x302, 0x0, 0x45, 0x327, 0x0, 0x45, 0x327, 0x306, 0x0, 0x45, 0x328, 0x0, 0x45, 0x32d, 0x0, 0x45, 0x330, 0x0, 0x46, 0x307, 0x0, 0x47, 0x301, 0x0, 0x47, 0x302, 0x0, 0x47, 0x304, 0x0, 0x47, 0x306, 0x0, 0x47, 0x307, 0x0, 0x47, 0x30c, 0x0, 0x47, 0x327, 0x0, 0x48, 0x302, 0x0, 0x48, 0x307, 0x0, 0x48, 0x308, 0x0, 0x48, 0x30c, 0x0, 0x48, 0x323, 0x0, 0x48, 0x327, 0x0, 0x48, 0x32e, 0x0, 0x49, 0x300, 0x0, 0x49, 0x301, 0x0, 0x49, 0x302, 0x0, 0x49, 0x303, 0x0, 0x49, 0x304, 0x0, 0x49, 0x306, 0x0, 0x49, 0x307, 0x0, 0x49, 0x308, 0x0, 0x49, 0x308, 0x301, 0x0, 0x49, 0x309, 0x0, 0x49, 0x30c, 0x0, 0x49, 0x30f, 0x0, 0x49, 0x311, 0x0, 0x49, 0x323, 0x0, 0x49, 0x328, 0x0, 0x49, 0x330, 0x0, 0x4a, 0x302, 0x0, 0x4b, 0x0, 0x4b, 0x301, 0x0, 0x4b, 0x30c, 0x0, 0x4b, 0x323, 0x0, 0x4b, 0x327, 0x0, 0x4b, 0x331, 0x0, 0x4c, 0x301, 0x0, 0x4c, 0x30c, 0x0, 0x4c, 0x323, 0x0, 0x4c, 0x323, 0x304, 0x0, 0x4c, 0x327, 0x0, 0x4c, 0x32d, 0x0, 0x4c, 0x331, 0x0, 0x4d, 0x301, 0x0, 0x4d, 0x307, 0x0, 0x4d, 0x323, 0x0, 0x4e, 0x300, 0x0, 0x4e, 0x301, 0x0, 0x4e, 0x303, 0x0, 0x4e, 0x307, 0x0, 0x4e, 0x30c, 0x0, 0x4e, 0x323, 0x0, 0x4e, 0x327, 0x0, 0x4e, 0x32d, 0x0, 0x4e, 0x331, 0x0, 0x4f, 0x300, 0x0, 0x4f, 0x301, 0x0, 0x4f, 0x302, 0x0, 0x4f, 0x302, 0x300, 0x0, 0x4f, 0x302, 0x301, 0x0, 0x4f, 0x302, 0x303, 0x0, 0x4f, 0x302, 0x309, 0x0, 0x4f, 0x303, 0x0, 0x4f, 0x303, 0x301, 0x0, 0x4f, 0x303, 0x304, 0x0, 0x4f, 0x303, 0x308, 0x0, 0x4f, 0x304, 0x0, 0x4f, 0x304, 0x300, 0x0, 0x4f, 0x304, 0x301, 0x0, 0x4f, 0x306, 0x0, 0x4f, 0x307, 0x0, 0x4f, 0x307, 0x304, 0x0, 0x4f, 0x308, 0x0, 0x4f, 0x308, 0x304, 0x0, 0x4f, 0x309, 0x0, 0x4f, 0x30b, 0x0, 0x4f, 0x30c, 0x0, 0x4f, 0x30f, 0x0, 0x4f, 0x311, 0x0, 0x4f, 0x31b, 0x0, 0x4f, 0x31b, 0x300, 0x0, 0x4f, 0x31b, 0x301, 0x0, 0x4f, 0x31b, 0x303, 0x0, 0x4f, 0x31b, 0x309, 0x0, 0x4f, 0x31b, 0x323, 0x0, 0x4f, 0x323, 0x0, 0x4f, 0x323, 0x302, 0x0, 0x4f, 0x328, 0x0, 0x4f, 0x328, 0x304, 0x0, 0x50, 0x301, 0x0, 0x50, 0x307, 0x0, 0x52, 0x301, 0x0, 0x52, 0x307, 0x0, 0x52, 0x30c, 0x0, 0x52, 0x30f, 0x0, 0x52, 0x311, 0x0, 0x52, 0x323, 0x0, 0x52, 0x323, 0x304, 0x0, 0x52, 0x327, 0x0, 0x52, 0x331, 0x0, 0x53, 0x301, 0x0, 0x53, 0x301, 0x307, 0x0, 0x53, 0x302, 0x0, 0x53, 0x307, 0x0, 0x53, 0x30c, 0x0, 0x53, 0x30c, 0x307, 0x0, 0x53, 0x323, 0x0, 0x53, 0x323, 0x307, 0x0, 0x53, 0x326, 0x0, 0x53, 0x327, 0x0, 0x54, 0x307, 0x0, 0x54, 0x30c, 0x0, 0x54, 0x323, 0x0, 0x54, 0x326, 0x0, 0x54, 0x327, 0x0, 0x54, 0x32d, 0x0, 0x54, 0x331, 0x0, 0x55, 0x300, 0x0, 0x55, 0x301, 0x0, 0x55, 0x302, 0x0, 0x55, 0x303, 0x0, 0x55, 0x303, 0x301, 0x0, 0x55, 0x304, 0x0, 0x55, 0x304, 0x308, 0x0, 0x55, 0x306, 0x0, 0x55, 0x308, 0x0, 0x55, 0x308, 0x300, 0x0, 0x55, 0x308, 0x301, 0x0, 0x55, 0x308, 0x304, 0x0, 0x55, 0x308, 0x30c, 0x0, 0x55, 0x309, 0x0, 0x55, 0x30a, 0x0, 0x55, 0x30b, 0x0, 0x55, 0x30c, 0x0, 0x55, 0x30f, 0x0, 0x55, 0x311, 0x0, 0x55, 0x31b, 0x0, 0x55, 0x31b, 0x300, 0x0, 0x55, 0x31b, 0x301, 0x0, 0x55, 0x31b, 0x303, 0x0, 0x55, 0x31b, 0x309, 0x0, 0x55, 0x31b, 0x323, 0x0, 0x55, 0x323, 0x0, 0x55, 0x324, 0x0, 0x55, 0x328, 0x0, 0x55, 0x32d, 0x0, 0x55, 0x330, 0x0, 0x56, 0x303, 0x0, 0x56, 0x323, 0x0, 0x57, 0x300, 0x0, 0x57, 0x301, 0x0, 0x57, 0x302, 0x0, 0x57, 0x307, 0x0, 0x57, 0x308, 0x0, 0x57, 0x323, 0x0, 0x58, 0x307, 0x0, 0x58, 0x308, 0x0, 0x59, 0x300, 0x0, 0x59, 0x301, 0x0, 0x59, 0x302, 0x0, 0x59, 0x303, 0x0, 0x59, 0x304, 0x0, 0x59, 0x307, 0x0, 0x59, 0x308, 0x0, 0x59, 0x309, 0x0, 0x59, 0x323, 0x0, 0x5a, 0x301, 0x0, 0x5a, 0x302, 0x0, 0x5a, 0x307, 0x0, 0x5a, 0x30c, 0x0, 0x5a, 0x323, 0x0, 0x5a, 0x331, 0x0, 0x60, 0x0, 0x61, 0x300, 0x0, 0x61, 0x301, 0x0, 0x61, 0x302, 0x0, 0x61, 0x302, 0x300, 0x0, 0x61, 0x302, 0x301, 0x0, 0x61, 0x302, 0x303, 0x0, 0x61, 0x302, 0x309, 0x0, 0x61, 0x303, 0x0, 0x61, 0x304, 0x0, 0x61, 0x306, 0x0, 0x61, 0x306, 0x300, 0x0, 0x61, 0x306, 0x301, 0x0, 0x61, 0x306, 0x303, 0x0, 0x61, 0x306, 0x309, 0x0, 0x61, 0x307, 0x0, 0x61, 0x307, 0x304, 0x0, 0x61, 0x308, 0x0, 0x61, 0x308, 0x304, 0x0, 0x61, 0x309, 0x0, 0x61, 0x30a, 0x0, 0x61, 0x30a, 0x301, 0x0, 0x61, 0x30c, 0x0, 0x61, 0x30f, 0x0, 0x61, 0x311, 0x0, 0x61, 0x323, 0x0, 0x61, 0x323, 0x302, 0x0, 0x61, 0x323, 0x306, 0x0, 0x61, 0x325, 0x0, 0x61, 0x328, 0x0, 0x62, 0x307, 0x0, 0x62, 0x323, 0x0, 0x62, 0x331, 0x0, 0x63, 0x301, 0x0, 0x63, 0x302, 0x0, 0x63, 0x307, 0x0, 0x63, 0x30c, 0x0, 0x63, 0x327, 0x0, 0x63, 0x327, 0x301, 0x0, 0x64, 0x307, 0x0, 0x64, 0x30c, 0x0, 0x64, 0x323, 0x0, 0x64, 0x327, 0x0, 0x64, 0x32d, 0x0, 0x64, 0x331, 0x0, 0x65, 0x300, 0x0, 0x65, 0x301, 0x0, 0x65, 0x302, 0x0, 0x65, 0x302, 0x300, 0x0, 0x65, 0x302, 0x301, 0x0, 0x65, 0x302, 0x303, 0x0, 0x65, 0x302, 0x309, 0x0, 0x65, 0x303, 0x0, 0x65, 0x304, 0x0, 0x65, 0x304, 0x300, 0x0, 0x65, 0x304, 0x301, 0x0, 0x65, 0x306, 0x0, 0x65, 0x307, 0x0, 0x65, 0x308, 0x0, 0x65, 0x309, 0x0, 0x65, 0x30c, 0x0, 0x65, 0x30f, 0x0, 0x65, 0x311, 0x0, 0x65, 0x323, 0x0, 0x65, 0x323, 0x302, 0x0, 0x65, 0x327, 0x0, 0x65, 0x327, 0x306, 0x0, 0x65, 0x328, 0x0, 0x65, 0x32d, 0x0, 0x65, 0x330, 0x0, 0x66, 0x307, 0x0, 0x67, 0x301, 0x0, 0x67, 0x302, 0x0, 0x67, 0x304, 0x0, 0x67, 0x306, 0x0, 0x67, 0x307, 0x0, 0x67, 0x30c, 0x0, 0x67, 0x327, 0x0, 0x68, 0x302, 0x0, 0x68, 0x307, 0x0, 0x68, 0x308, 0x0, 0x68, 0x30c, 0x0, 0x68, 0x323, 0x0, 0x68, 0x327, 0x0, 0x68, 0x32e, 0x0, 0x68, 0x331, 0x0, 0x69, 0x300, 0x0, 0x69, 0x301, 0x0, 0x69, 0x302, 0x0, 0x69, 0x303, 0x0, 0x69, 0x304, 0x0, 0x69, 0x306, 0x0, 0x69, 0x308, 0x0, 0x69, 0x308, 0x301, 0x0, 0x69, 0x309, 0x0, 0x69, 0x30c, 0x0, 0x69, 0x30f, 0x0, 0x69, 0x311, 0x0, 0x69, 0x323, 0x0, 0x69, 0x328, 0x0, 0x69, 0x330, 0x0, 0x6a, 0x302, 0x0, 0x6a, 0x30c, 0x0, 0x6b, 0x301, 0x0, 0x6b, 0x30c, 0x0, 0x6b, 0x323, 0x0, 0x6b, 0x327, 0x0, 0x6b, 0x331, 0x0, 0x6c, 0x301, 0x0, 0x6c, 0x30c, 0x0, 0x6c, 0x323, 0x0, 0x6c, 0x323, 0x304, 0x0, 0x6c, 0x327, 0x0, 0x6c, 0x32d, 0x0, 0x6c, 0x331, 0x0, 0x6d, 0x301, 0x0, 0x6d, 0x307, 0x0, 0x6d, 0x323, 0x0, 0x6e, 0x300, 0x0, 0x6e, 0x301, 0x0, 0x6e, 0x303, 0x0, 0x6e, 0x307, 0x0, 0x6e, 0x30c, 0x0, 0x6e, 0x323, 0x0, 0x6e, 0x327, 0x0, 0x6e, 0x32d, 0x0, 0x6e, 0x331, 0x0, 0x6f, 0x300, 0x0, 0x6f, 0x301, 0x0, 0x6f, 0x302, 0x0, 0x6f, 0x302, 0x300, 0x0, 0x6f, 0x302, 0x301, 0x0, 0x6f, 0x302, 0x303, 0x0, 0x6f, 0x302, 0x309, 0x0, 0x6f, 0x303, 0x0, 0x6f, 0x303, 0x301, 0x0, 0x6f, 0x303, 0x304, 0x0, 0x6f, 0x303, 0x308, 0x0, 0x6f, 0x304, 0x0, 0x6f, 0x304, 0x300, 0x0, 0x6f, 0x304, 0x301, 0x0, 0x6f, 0x306, 0x0, 0x6f, 0x307, 0x0, 0x6f, 0x307, 0x304, 0x0, 0x6f, 0x308, 0x0, 0x6f, 0x308, 0x304, 0x0, 0x6f, 0x309, 0x0, 0x6f, 0x30b, 0x0, 0x6f, 0x30c, 0x0, 0x6f, 0x30f, 0x0, 0x6f, 0x311, 0x0, 0x6f, 0x31b, 0x0, 0x6f, 0x31b, 0x300, 0x0, 0x6f, 0x31b, 0x301, 0x0, 0x6f, 0x31b, 0x303, 0x0, 0x6f, 0x31b, 0x309, 0x0, 0x6f, 0x31b, 0x323, 0x0, 0x6f, 0x323, 0x0, 0x6f, 0x323, 0x302, 0x0, 0x6f, 0x328, 0x0, 0x6f, 0x328, 0x304, 0x0, 0x70, 0x301, 0x0, 0x70, 0x307, 0x0, 0x72, 0x301, 0x0, 0x72, 0x307, 0x0, 0x72, 0x30c, 0x0, 0x72, 0x30f, 0x0, 0x72, 0x311, 0x0, 0x72, 0x323, 0x0, 0x72, 0x323, 0x304, 0x0, 0x72, 0x327, 0x0, 0x72, 0x331, 0x0, 0x73, 0x301, 0x0, 0x73, 0x301, 0x307, 0x0, 0x73, 0x302, 0x0, 0x73, 0x307, 0x0, 0x73, 0x30c, 0x0, 0x73, 0x30c, 0x307, 0x0, 0x73, 0x323, 0x0, 0x73, 0x323, 0x307, 0x0, 0x73, 0x326, 0x0, 0x73, 0x327, 0x0, 0x74, 0x307, 0x0, 0x74, 0x308, 0x0, 0x74, 0x30c, 0x0, 0x74, 0x323, 0x0, 0x74, 0x326, 0x0, 0x74, 0x327, 0x0, 0x74, 0x32d, 0x0, 0x74, 0x331, 0x0, 0x75, 0x300, 0x0, 0x75, 0x301, 0x0, 0x75, 0x302, 0x0, 0x75, 0x303, 0x0, 0x75, 0x303, 0x301, 0x0, 0x75, 0x304, 0x0, 0x75, 0x304, 0x308, 0x0, 0x75, 0x306, 0x0, 0x75, 0x308, 0x0, 0x75, 0x308, 0x300, 0x0, 0x75, 0x308, 0x301, 0x0, 0x75, 0x308, 0x304, 0x0, 0x75, 0x308, 0x30c, 0x0, 0x75, 0x309, 0x0, 0x75, 0x30a, 0x0, 0x75, 0x30b, 0x0, 0x75, 0x30c, 0x0, 0x75, 0x30f, 0x0, 0x75, 0x311, 0x0, 0x75, 0x31b, 0x0, 0x75, 0x31b, 0x300, 0x0, 0x75, 0x31b, 0x301, 0x0, 0x75, 0x31b, 0x303, 0x0, 0x75, 0x31b, 0x309, 0x0, 0x75, 0x31b, 0x323, 0x0, 0x75, 0x323, 0x0, 0x75, 0x324, 0x0, 0x75, 0x328, 0x0, 0x75, 0x32d, 0x0, 0x75, 0x330, 0x0, 0x76, 0x303, 0x0, 0x76, 0x323, 0x0, 0x77, 0x300, 0x0, 0x77, 0x301, 0x0, 0x77, 0x302, 0x0, 0x77, 0x307, 0x0, 0x77, 0x308, 0x0, 0x77, 0x30a, 0x0, 0x77, 0x323, 0x0, 0x78, 0x307, 0x0, 0x78, 0x308, 0x0, 0x79, 0x300, 0x0, 0x79, 0x301, 0x0, 0x79, 0x302, 0x0, 0x79, 0x303, 0x0, 0x79, 0x304, 0x0, 0x79, 0x307, 0x0, 0x79, 0x308, 0x0, 0x79, 0x309, 0x0, 0x79, 0x30a, 0x0, 0x79, 0x323, 0x0, 0x7a, 0x301, 0x0, 0x7a, 0x302, 0x0, 0x7a, 0x307, 0x0, 0x7a, 0x30c, 0x0, 0x7a, 0x323, 0x0, 0x7a, 0x331, 0x0, 0xa8, 0x300, 0x0, 0xa8, 0x301, 0x0, 0xa8, 0x342, 0x0, 0xb4, 0x0, 0xb7, 0x0, 0xc6, 0x301, 0x0, 0xc6, 0x304, 0x0, 0xd8, 0x301, 0x0, 0xe6, 0x301, 0x0, 0xe6, 0x304, 0x0, 0xf8, 0x301, 0x0, 0x17f, 0x307, 0x0, 0x1b7, 0x30c, 0x0, 0x292, 0x30c, 0x0, 0x2b9, 0x0, 0x300, 0x0, 0x301, 0x0, 0x308, 0x301, 0x0, 0x313, 0x0, 0x391, 0x300, 0x0, 0x391, 0x301, 0x0, 0x391, 0x304, 0x0, 0x391, 0x306, 0x0, 0x391, 0x313, 0x0, 0x391, 0x313, 0x300, 0x0, 0x391, 0x313, 0x300, 0x345, 0x0, 0x391, 0x313, 0x301, 0x0, 0x391, 0x313, 0x301, 0x345, 0x0, 0x391, 0x313, 0x342, 0x0, 0x391, 0x313, 0x342, 0x345, 0x0, 0x391, 0x313, 0x345, 0x0, 0x391, 0x314, 0x0, 0x391, 0x314, 0x300, 0x0, 0x391, 0x314, 0x300, 0x345, 0x0, 0x391, 0x314, 0x301, 0x0, 0x391, 0x314, 0x301, 0x345, 0x0, 0x391, 0x314, 0x342, 0x0, 0x391, 0x314, 0x342, 0x345, 0x0, 0x391, 0x314, 0x345, 0x0, 0x391, 0x345, 0x0, 0x395, 0x300, 0x0, 0x395, 0x301, 0x0, 0x395, 0x313, 0x0, 0x395, 0x313, 0x300, 0x0, 0x395, 0x313, 0x301, 0x0, 0x395, 0x314, 0x0, 0x395, 0x314, 0x300, 0x0, 0x395, 0x314, 0x301, 0x0, 0x397, 0x300, 0x0, 0x397, 0x301, 0x0, 0x397, 0x313, 0x0, 0x397, 0x313, 0x300, 0x0, 0x397, 0x313, 0x300, 0x345, 0x0, 0x397, 0x313, 0x301, 0x0, 0x397, 0x313, 0x301, 0x345, 0x0, 0x397, 0x313, 0x342, 0x0, 0x397, 0x313, 0x342, 0x345, 0x0, 0x397, 0x313, 0x345, 0x0, 0x397, 0x314, 0x0, 0x397, 0x314, 0x300, 0x0, 0x397, 0x314, 0x300, 0x345, 0x0, 0x397, 0x314, 0x301, 0x0, 0x397, 0x314, 0x301, 0x345, 0x0, 0x397, 0x314, 0x342, 0x0, 0x397, 0x314, 0x342, 0x345, 0x0, 0x397, 0x314, 0x345, 0x0, 0x397, 0x345, 0x0, 0x399, 0x300, 0x0, 0x399, 0x301, 0x0, 0x399, 0x304, 0x0, 0x399, 0x306, 0x0, 0x399, 0x308, 0x0, 0x399, 0x313, 0x0, 0x399, 0x313, 0x300, 0x0, 0x399, 0x313, 0x301, 0x0, 0x399, 0x313, 0x342, 0x0, 0x399, 0x314, 0x0, 0x399, 0x314, 0x300, 0x0, 0x399, 0x314, 0x301, 0x0, 0x399, 0x314, 0x342, 0x0, 0x39f, 0x300, 0x0, 0x39f, 0x301, 0x0, 0x39f, 0x313, 0x0, 0x39f, 0x313, 0x300, 0x0, 0x39f, 0x313, 0x301, 0x0, 0x39f, 0x314, 0x0, 0x39f, 0x314, 0x300, 0x0, 0x39f, 0x314, 0x301, 0x0, 0x3a1, 0x314, 0x0, 0x3a5, 0x300, 0x0, 0x3a5, 0x301, 0x0, 0x3a5, 0x304, 0x0, 0x3a5, 0x306, 0x0, 0x3a5, 0x308, 0x0, 0x3a5, 0x314, 0x0, 0x3a5, 0x314, 0x300, 0x0, 0x3a5, 0x314, 0x301, 0x0, 0x3a5, 0x314, 0x342, 0x0, 0x3a9, 0x0, 0x3a9, 0x300, 0x0, 0x3a9, 0x301, 0x0, 0x3a9, 0x313, 0x0, 0x3a9, 0x313, 0x300, 0x0, 0x3a9, 0x313, 0x300, 0x345, 0x0, 0x3a9, 0x313, 0x301, 0x0, 0x3a9, 0x313, 0x301, 0x345, 0x0, 0x3a9, 0x313, 0x342, 0x0, 0x3a9, 0x313, 0x342, 0x345, 0x0, 0x3a9, 0x313, 0x345, 0x0, 0x3a9, 0x314, 0x0, 0x3a9, 0x314, 0x300, 0x0, 0x3a9, 0x314, 0x300, 0x345, 0x0, 0x3a9, 0x314, 0x301, 0x0, 0x3a9, 0x314, 0x301, 0x345, 0x0, 0x3a9, 0x314, 0x342, 0x0, 0x3a9, 0x314, 0x342, 0x345, 0x0, 0x3a9, 0x314, 0x345, 0x0, 0x3a9, 0x345, 0x0, 0x3b1, 0x300, 0x0, 0x3b1, 0x300, 0x345, 0x0, 0x3b1, 0x301, 0x0, 0x3b1, 0x301, 0x345, 0x0, 0x3b1, 0x304, 0x0, 0x3b1, 0x306, 0x0, 0x3b1, 0x313, 0x0, 0x3b1, 0x313, 0x300, 0x0, 0x3b1, 0x313, 0x300, 0x345, 0x0, 0x3b1, 0x313, 0x301, 0x0, 0x3b1, 0x313, 0x301, 0x345, 0x0, 0x3b1, 0x313, 0x342, 0x0, 0x3b1, 0x313, 0x342, 0x345, 0x0, 0x3b1, 0x313, 0x345, 0x0, 0x3b1, 0x314, 0x0, 0x3b1, 0x314, 0x300, 0x0, 0x3b1, 0x314, 0x300, 0x345, 0x0, 0x3b1, 0x314, 0x301, 0x0, 0x3b1, 0x314, 0x301, 0x345, 0x0, 0x3b1, 0x314, 0x342, 0x0, 0x3b1, 0x314, 0x342, 0x345, 0x0, 0x3b1, 0x314, 0x345, 0x0, 0x3b1, 0x342, 0x0, 0x3b1, 0x342, 0x345, 0x0, 0x3b1, 0x345, 0x0, 0x3b5, 0x300, 0x0, 0x3b5, 0x301, 0x0, 0x3b5, 0x313, 0x0, 0x3b5, 0x313, 0x300, 0x0, 0x3b5, 0x313, 0x301, 0x0, 0x3b5, 0x314, 0x0, 0x3b5, 0x314, 0x300, 0x0, 0x3b5, 0x314, 0x301, 0x0, 0x3b7, 0x300, 0x0, 0x3b7, 0x300, 0x345, 0x0, 0x3b7, 0x301, 0x0, 0x3b7, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x0, 0x3b7, 0x313, 0x300, 0x0, 0x3b7, 0x313, 0x300, 0x345, 0x0, 0x3b7, 0x313, 0x301, 0x0, 0x3b7, 0x313, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x342, 0x0, 0x3b7, 0x313, 0x342, 0x345, 0x0, 0x3b7, 0x313, 0x345, 0x0, 0x3b7, 0x314, 0x0, 0x3b7, 0x314, 0x300, 0x0, 0x3b7, 0x314, 0x300, 0x345, 0x0, 0x3b7, 0x314, 0x301, 0x0, 0x3b7, 0x314, 0x301, 0x345, 0x0, 0x3b7, 0x314, 0x342, 0x0, 0x3b7, 0x314, 0x342, 0x345, 0x0, 0x3b7, 0x314, 0x345, 0x0, 0x3b7, 0x342, 0x0, 0x3b7, 0x342, 0x345, 0x0, 0x3b7, 0x345, 0x0, 0x3b9, 0x0, 0x3b9, 0x300, 0x0, 0x3b9, 0x301, 0x0, 0x3b9, 0x304, 0x0, 0x3b9, 0x306, 0x0, 0x3b9, 0x308, 0x0, 0x3b9, 0x308, 0x300, 0x0, 0x3b9, 0x308, 0x301, 0x0, 0x3b9, 0x308, 0x342, 0x0, 0x3b9, 0x313, 0x0, 0x3b9, 0x313, 0x300, 0x0, 0x3b9, 0x313, 0x301, 0x0, 0x3b9, 0x313, 0x342, 0x0, 0x3b9, 0x314, 0x0, 0x3b9, 0x314, 0x300, 0x0, 0x3b9, 0x314, 0x301, 0x0, 0x3b9, 0x314, 0x342, 0x0, 0x3b9, 0x342, 0x0, 0x3bf, 0x300, 0x0, 0x3bf, 0x301, 0x0, 0x3bf, 0x313, 0x0, 0x3bf, 0x313, 0x300, 0x0, 0x3bf, 0x313, 0x301, 0x0, 0x3bf, 0x314, 0x0, 0x3bf, 0x314, 0x300, 0x0, 0x3bf, 0x314, 0x301, 0x0, 0x3c1, 0x313, 0x0, 0x3c1, 0x314, 0x0, 0x3c5, 0x300, 0x0, 0x3c5, 0x301, 0x0, 0x3c5, 0x304, 0x0, 0x3c5, 0x306, 0x0, 0x3c5, 0x308, 0x0, 0x3c5, 0x308, 0x300, 0x0, 0x3c5, 0x308, 0x301, 0x0, 0x3c5, 0x308, 0x342, 0x0, 0x3c5, 0x313, 0x0, 0x3c5, 0x313, 0x300, 0x0, 0x3c5, 0x313, 0x301, 0x0, 0x3c5, 0x313, 0x342, 0x0, 0x3c5, 0x314, 0x0, 0x3c5, 0x314, 0x300, 0x0, 0x3c5, 0x314, 0x301, 0x0, 0x3c5, 0x314, 0x342, 0x0, 0x3c5, 0x342, 0x0, 0x3c9, 0x300, 0x0, 0x3c9, 0x300, 0x345, 0x0, 0x3c9, 0x301, 0x0, 0x3c9, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x0, 0x3c9, 0x313, 0x300, 0x0, 0x3c9, 0x313, 0x300, 0x345, 0x0, 0x3c9, 0x313, 0x301, 0x0, 0x3c9, 0x313, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x342, 0x0, 0x3c9, 0x313, 0x342, 0x345, 0x0, 0x3c9, 0x313, 0x345, 0x0, 0x3c9, 0x314, 0x0, 0x3c9, 0x314, 0x300, 0x0, 0x3c9, 0x314, 0x300, 0x345, 0x0, 0x3c9, 0x314, 0x301, 0x0, 0x3c9, 0x314, 0x301, 0x345, 0x0, 0x3c9, 0x314, 0x342, 0x0, 0x3c9, 0x314, 0x342, 0x345, 0x0, 0x3c9, 0x314, 0x345, 0x0, 0x3c9, 0x342, 0x0, 0x3c9, 0x342, 0x345, 0x0, 0x3c9, 0x345, 0x0, 0x3d2, 0x301, 0x0, 0x3d2, 0x308, 0x0, 0x406, 0x308, 0x0, 0x410, 0x306, 0x0, 0x410, 0x308, 0x0, 0x413, 0x301, 0x0, 0x415, 0x300, 0x0, 0x415, 0x306, 0x0, 0x415, 0x308, 0x0, 0x416, 0x306, 0x0, 0x416, 0x308, 0x0, 0x417, 0x308, 0x0, 0x418, 0x300, 0x0, 0x418, 0x304, 0x0, 0x418, 0x306, 0x0, 0x418, 0x308, 0x0, 0x41a, 0x301, 0x0, 0x41e, 0x308, 0x0, 0x423, 0x304, 0x0, 0x423, 0x306, 0x0, 0x423, 0x308, 0x0, 0x423, 0x30b, 0x0, 0x427, 0x308, 0x0, 0x42b, 0x308, 0x0, 0x42d, 0x308, 0x0, 0x430, 0x306, 0x0, 0x430, 0x308, 0x0, 0x433, 0x301, 0x0, 0x435, 0x300, 0x0, 0x435, 0x306, 0x0, 0x435, 0x308, 0x0, 0x436, 0x306, 0x0, 0x436, 0x308, 0x0, 0x437, 0x308, 0x0, 0x438, 0x300, 0x0, 0x438, 0x304, 0x0, 0x438, 0x306, 0x0, 0x438, 0x308, 0x0, 0x43a, 0x301, 0x0, 0x43e, 0x308, 0x0, 0x443, 0x304, 0x0, 0x443, 0x306, 0x0, 0x443, 0x308, 0x0, 0x443, 0x30b, 0x0, 0x447, 0x308, 0x0, 0x44b, 0x308, 0x0, 0x44d, 0x308, 0x0, 0x456, 0x308, 0x0, 0x474, 0x30f, 0x0, 0x475, 0x30f, 0x0, 0x4d8, 0x308, 0x0, 0x4d9, 0x308, 0x0, 0x4e8, 0x308, 0x0, 0x4e9, 0x308, 0x0, 0x5d0, 0x5b7, 0x0, 0x5d0, 0x5b8, 0x0, 0x5d0, 0x5bc, 0x0, 0x5d1, 0x5bc, 0x0, 0x5d1, 0x5bf, 0x0, 0x5d2, 0x5bc, 0x0, 0x5d3, 0x5bc, 0x0, 0x5d4, 0x5bc, 0x0, 0x5d5, 0x5b9, 0x0, 0x5d5, 0x5bc, 0x0, 0x5d6, 0x5bc, 0x0, 0x5d8, 0x5bc, 0x0, 0x5d9, 0x5b4, 0x0, 0x5d9, 0x5bc, 0x0, 0x5da, 0x5bc, 0x0, 0x5db, 0x5bc, 0x0, 0x5db, 0x5bf, 0x0, 0x5dc, 0x5bc, 0x0, 0x5de, 0x5bc, 0x0, 0x5e0, 0x5bc, 0x0, 0x5e1, 0x5bc, 0x0, 0x5e3, 0x5bc, 0x0, 0x5e4, 0x5bc, 0x0, 0x5e4, 0x5bf, 0x0, 0x5e6, 0x5bc, 0x0, 0x5e7, 0x5bc, 0x0, 0x5e8, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x5c1, 0x0, 0x5e9, 0x5bc, 0x5c2, 0x0, 0x5e9, 0x5c1, 0x0, 0x5e9, 0x5c2, 0x0, 0x5ea, 0x5bc, 0x0, 0x5f2, 0x5b7, 0x0, 0x627, 0x653, 0x0, 0x627, 0x654, 0x0, 0x627, 0x655, 0x0, 0x648, 0x654, 0x0, 0x64a, 0x654, 0x0, 0x6c1, 0x654, 0x0, 0x6d2, 0x654, 0x0, 0x6d5, 0x654, 0x0, 0x915, 0x93c, 0x0, 0x916, 0x93c, 0x0, 0x917, 0x93c, 0x0, 0x91c, 0x93c, 0x0, 0x921, 0x93c, 0x0, 0x922, 0x93c, 0x0, 0x928, 0x93c, 0x0, 0x92b, 0x93c, 0x0, 0x92f, 0x93c, 0x0, 0x930, 0x93c, 0x0, 0x933, 0x93c, 0x0, 0x9a1, 0x9bc, 0x0, 0x9a2, 0x9bc, 0x0, 0x9af, 0x9bc, 0x0, 0x9c7, 0x9be, 0x0, 0x9c7, 0x9d7, 0x0, 0xa16, 0xa3c, 0x0, 0xa17, 0xa3c, 0x0, 0xa1c, 0xa3c, 0x0, 0xa2b, 0xa3c, 0x0, 0xa32, 0xa3c, 0x0, 0xa38, 0xa3c, 0x0, 0xb21, 0xb3c, 0x0, 0xb22, 0xb3c, 0x0, 0xb47, 0xb3e, 0x0, 0xb47, 0xb56, 0x0, 0xb47, 0xb57, 0x0, 0xb92, 0xbd7, 0x0, 0xbc6, 0xbbe, 0x0, 0xbc6, 0xbd7, 0x0, 0xbc7, 0xbbe, 0x0, 0xc46, 0xc56, 0x0, 0xcbf, 0xcd5, 0x0, 0xcc6, 0xcc2, 0x0, 0xcc6, 0xcc2, 0xcd5, 0x0, 0xcc6, 0xcd5, 0x0, 0xcc6, 0xcd6, 0x0, 0xd46, 0xd3e, 0x0, 0xd46, 0xd57, 0x0, 0xd47, 0xd3e, 0x0, 0xdd9, 0xdca, 0x0, 0xdd9, 0xdcf, 0x0, 0xdd9, 0xdcf, 0xdca, 0x0, 0xdd9, 0xddf, 0x0, 0xf40, 0xfb5, 0x0, 0xf42, 0xfb7, 0x0, 0xf4c, 0xfb7, 0x0, 0xf51, 0xfb7, 0x0, 0xf56, 0xfb7, 0x0, 0xf5b, 0xfb7, 0x0, 0xf71, 0xf72, 0x0, 0xf71, 0xf74, 0x0, 0xf71, 0xf80, 0x0, 0xf90, 0xfb5, 0x0, 0xf92, 0xfb7, 0x0, 0xf9c, 0xfb7, 0x0, 0xfa1, 0xfb7, 0x0, 0xfa6, 0xfb7, 0x0, 0xfab, 0xfb7, 0x0, 0xfb2, 0xf80, 0x0, 0xfb3, 0xf80, 0x0, 0x1025, 0x102e, 0x0, 0x1b05, 0x1b35, 0x0, 0x1b07, 0x1b35, 0x0, 0x1b09, 0x1b35, 0x0, 0x1b0b, 0x1b35, 0x0, 0x1b0d, 0x1b35, 0x0, 0x1b11, 0x1b35, 0x0, 0x1b3a, 0x1b35, 0x0, 0x1b3c, 0x1b35, 0x0, 0x1b3e, 0x1b35, 0x0, 0x1b3f, 0x1b35, 0x0, 0x1b42, 0x1b35, 0x0, 0x1fbf, 0x300, 0x0, 0x1fbf, 0x301, 0x0, 0x1fbf, 0x342, 0x0, 0x1ffe, 0x300, 0x0, 0x1ffe, 0x301, 0x0, 0x1ffe, 0x342, 0x0, 0x2002, 0x0, 0x2003, 0x0, 0x2190, 0x338, 0x0, 0x2192, 0x338, 0x0, 0x2194, 0x338, 0x0, 0x21d0, 0x338, 0x0, 0x21d2, 0x338, 0x0, 0x21d4, 0x338, 0x0, 0x2203, 0x338, 0x0, 0x2208, 0x338, 0x0, 0x220b, 0x338, 0x0, 0x2223, 0x338, 0x0, 0x2225, 0x338, 0x0, 0x223c, 0x338, 0x0, 0x2243, 0x338, 0x0, 0x2245, 0x338, 0x0, 0x2248, 0x338, 0x0, 0x224d, 0x338, 0x0, 0x2261, 0x338, 0x0, 0x2264, 0x338, 0x0, 0x2265, 0x338, 0x0, 0x2272, 0x338, 0x0, 0x2273, 0x338, 0x0, 0x2276, 0x338, 0x0, 0x2277, 0x338, 0x0, 0x227a, 0x338, 0x0, 0x227b, 0x338, 0x0, 0x227c, 0x338, 0x0, 0x227d, 0x338, 0x0, 0x2282, 0x338, 0x0, 0x2283, 0x338, 0x0, 0x2286, 0x338, 0x0, 0x2287, 0x338, 0x0, 0x2291, 0x338, 0x0, 0x2292, 0x338, 0x0, 0x22a2, 0x338, 0x0, 0x22a8, 0x338, 0x0, 0x22a9, 0x338, 0x0, 0x22ab, 0x338, 0x0, 0x22b2, 0x338, 0x0, 0x22b3, 0x338, 0x0, 0x22b4, 0x338, 0x0, 0x22b5, 0x338, 0x0, 0x2add, 0x338, 0x0, 0x3008, 0x0, 0x3009, 0x0, 0x3046, 0x3099, 0x0, 0x304b, 0x3099, 0x0, 0x304d, 0x3099, 0x0, 0x304f, 0x3099, 0x0, 0x3051, 0x3099, 0x0, 0x3053, 0x3099, 0x0, 0x3055, 0x3099, 0x0, 0x3057, 0x3099, 0x0, 0x3059, 0x3099, 0x0, 0x305b, 0x3099, 0x0, 0x305d, 0x3099, 0x0, 0x305f, 0x3099, 0x0, 0x3061, 0x3099, 0x0, 0x3064, 0x3099, 0x0, 0x3066, 0x3099, 0x0, 0x3068, 0x3099, 0x0, 0x306f, 0x3099, 0x0, 0x306f, 0x309a, 0x0, 0x3072, 0x3099, 0x0, 0x3072, 0x309a, 0x0, 0x3075, 0x3099, 0x0, 0x3075, 0x309a, 0x0, 0x3078, 0x3099, 0x0, 0x3078, 0x309a, 0x0, 0x307b, 0x3099, 0x0, 0x307b, 0x309a, 0x0, 0x309d, 0x3099, 0x0, 0x30a6, 0x3099, 0x0, 0x30ab, 0x3099, 0x0, 0x30ad, 0x3099, 0x0, 0x30af, 0x3099, 0x0, 0x30b1, 0x3099, 0x0, 0x30b3, 0x3099, 0x0, 0x30b5, 0x3099, 0x0, 0x30b7, 0x3099, 0x0, 0x30b9, 0x3099, 0x0, 0x30bb, 0x3099, 0x0, 0x30bd, 0x3099, 0x0, 0x30bf, 0x3099, 0x0, 0x30c1, 0x3099, 0x0, 0x30c4, 0x3099, 0x0, 0x30c6, 0x3099, 0x0, 0x30c8, 0x3099, 0x0, 0x30cf, 0x3099, 0x0, 0x30cf, 0x309a, 0x0, 0x30d2, 0x3099, 0x0, 0x30d2, 0x309a, 0x0, 0x30d5, 0x3099, 0x0, 0x30d5, 0x309a, 0x0, 0x30d8, 0x3099, 0x0, 0x30d8, 0x309a, 0x0, 0x30db, 0x3099, 0x0, 0x30db, 0x309a, 0x0, 0x30ef, 0x3099, 0x0, 0x30f0, 0x3099, 0x0, 0x30f1, 0x3099, 0x0, 0x30f2, 0x3099, 0x0, 0x30fd, 0x3099, 0x0, 0x349e, 0x0, 0x34b9, 0x0, 0x34bb, 0x0, 0x34df, 0x0, 0x3515, 0x0, 0x36ee, 0x0, 0x36fc, 0x0, 0x3781, 0x0, 0x382f, 0x0, 0x3862, 0x0, 0x387c, 0x0, 0x38c7, 0x0, 0x38e3, 0x0, 0x391c, 0x0, 0x393a, 0x0, 0x3a2e, 0x0, 0x3a6c, 0x0, 0x3ae4, 0x0, 0x3b08, 0x0, 0x3b19, 0x0, 0x3b49, 0x0, 0x3b9d, 0x0, 0x3c18, 0x0, 0x3c4e, 0x0, 0x3d33, 0x0, 0x3d96, 0x0, 0x3eac, 0x0, 0x3eb8, 0x0, 0x3f1b, 0x0, 0x3ffc, 0x0, 0x4008, 0x0, 0x4018, 0x0, 0x4039, 0x0, 0x4046, 0x0, 0x4096, 0x0, 0x40e3, 0x0, 0x412f, 0x0, 0x4202, 0x0, 0x4227, 0x0, 0x42a0, 0x0, 0x4301, 0x0, 0x4334, 0x0, 0x4359, 0x0, 0x43d5, 0x0, 0x43d9, 0x0, 0x440b, 0x0, 0x446b, 0x0, 0x452b, 0x0, 0x455d, 0x0, 0x4561, 0x0, 0x456b, 0x0, 0x45d7, 0x0, 0x45f9, 0x0, 0x4635, 0x0, 0x46be, 0x0, 0x46c7, 0x0, 0x4995, 0x0, 0x49e6, 0x0, 0x4a6e, 0x0, 0x4a76, 0x0, 0x4ab2, 0x0, 0x4b33, 0x0, 0x4bce, 0x0, 0x4cce, 0x0, 0x4ced, 0x0, 0x4cf8, 0x0, 0x4d56, 0x0, 0x4e0d, 0x0, 0x4e26, 0x0, 0x4e32, 0x0, 0x4e38, 0x0, 0x4e39, 0x0, 0x4e3d, 0x0, 0x4e41, 0x0, 0x4e82, 0x0, 0x4e86, 0x0, 0x4eae, 0x0, 0x4ec0, 0x0, 0x4ecc, 0x0, 0x4ee4, 0x0, 0x4f60, 0x0, 0x4f80, 0x0, 0x4f86, 0x0, 0x4f8b, 0x0, 0x4fae, 0x0, 0x4fbb, 0x0, 0x4fbf, 0x0, 0x5002, 0x0, 0x502b, 0x0, 0x507a, 0x0, 0x5099, 0x0, 0x50cf, 0x0, 0x50da, 0x0, 0x50e7, 0x0, 0x5140, 0x0, 0x5145, 0x0, 0x514d, 0x0, 0x5154, 0x0, 0x5164, 0x0, 0x5167, 0x0, 0x5168, 0x0, 0x5169, 0x0, 0x516d, 0x0, 0x5177, 0x0, 0x5180, 0x0, 0x518d, 0x0, 0x5192, 0x0, 0x5195, 0x0, 0x5197, 0x0, 0x51a4, 0x0, 0x51ac, 0x0, 0x51b5, 0x0, 0x51b7, 0x0, 0x51c9, 0x0, 0x51cc, 0x0, 0x51dc, 0x0, 0x51de, 0x0, 0x51f5, 0x0, 0x5203, 0x0, 0x5207, 0x0, 0x5217, 0x0, 0x5229, 0x0, 0x523a, 0x0, 0x523b, 0x0, 0x5246, 0x0, 0x5272, 0x0, 0x5277, 0x0, 0x5289, 0x0, 0x529b, 0x0, 0x52a3, 0x0, 0x52b3, 0x0, 0x52c7, 0x0, 0x52c9, 0x0, 0x52d2, 0x0, 0x52de, 0x0, 0x52e4, 0x0, 0x52f5, 0x0, 0x52fa, 0x0, 0x5305, 0x0, 0x5306, 0x0, 0x5317, 0x0, 0x533f, 0x0, 0x5349, 0x0, 0x5351, 0x0, 0x535a, 0x0, 0x5373, 0x0, 0x5375, 0x0, 0x537d, 0x0, 0x537f, 0x0, 0x53c3, 0x0, 0x53ca, 0x0, 0x53df, 0x0, 0x53e5, 0x0, 0x53eb, 0x0, 0x53f1, 0x0, 0x5406, 0x0, 0x540f, 0x0, 0x541d, 0x0, 0x5438, 0x0, 0x5442, 0x0, 0x5448, 0x0, 0x5468, 0x0, 0x549e, 0x0, 0x54a2, 0x0, 0x54bd, 0x0, 0x54f6, 0x0, 0x5510, 0x0, 0x5553, 0x0, 0x5555, 0x0, 0x5563, 0x0, 0x5584, 0x0, 0x5587, 0x0, 0x5599, 0x0, 0x559d, 0x0, 0x55ab, 0x0, 0x55b3, 0x0, 0x55c0, 0x0, 0x55c2, 0x0, 0x55e2, 0x0, 0x5606, 0x0, 0x5651, 0x0, 0x5668, 0x0, 0x5674, 0x0, 0x56f9, 0x0, 0x5716, 0x0, 0x5717, 0x0, 0x578b, 0x0, 0x57ce, 0x0, 0x57f4, 0x0, 0x580d, 0x0, 0x5831, 0x0, 0x5832, 0x0, 0x5840, 0x0, 0x585a, 0x0, 0x585e, 0x0, 0x58a8, 0x0, 0x58ac, 0x0, 0x58b3, 0x0, 0x58d8, 0x0, 0x58df, 0x0, 0x58ee, 0x0, 0x58f2, 0x0, 0x58f7, 0x0, 0x5906, 0x0, 0x591a, 0x0, 0x5922, 0x0, 0x5944, 0x0, 0x5948, 0x0, 0x5951, 0x0, 0x5954, 0x0, 0x5962, 0x0, 0x5973, 0x0, 0x59d8, 0x0, 0x59ec, 0x0, 0x5a1b, 0x0, 0x5a27, 0x0, 0x5a62, 0x0, 0x5a66, 0x0, 0x5ab5, 0x0, 0x5b08, 0x0, 0x5b28, 0x0, 0x5b3e, 0x0, 0x5b85, 0x0, 0x5bc3, 0x0, 0x5bd8, 0x0, 0x5be7, 0x0, 0x5bee, 0x0, 0x5bf3, 0x0, 0x5bff, 0x0, 0x5c06, 0x0, 0x5c22, 0x0, 0x5c3f, 0x0, 0x5c60, 0x0, 0x5c62, 0x0, 0x5c64, 0x0, 0x5c65, 0x0, 0x5c6e, 0x0, 0x5c8d, 0x0, 0x5cc0, 0x0, 0x5d19, 0x0, 0x5d43, 0x0, 0x5d50, 0x0, 0x5d6b, 0x0, 0x5d6e, 0x0, 0x5d7c, 0x0, 0x5db2, 0x0, 0x5dba, 0x0, 0x5de1, 0x0, 0x5de2, 0x0, 0x5dfd, 0x0, 0x5e28, 0x0, 0x5e3d, 0x0, 0x5e69, 0x0, 0x5e74, 0x0, 0x5ea6, 0x0, 0x5eb0, 0x0, 0x5eb3, 0x0, 0x5eb6, 0x0, 0x5ec9, 0x0, 0x5eca, 0x0, 0x5ed2, 0x0, 0x5ed3, 0x0, 0x5ed9, 0x0, 0x5eec, 0x0, 0x5efe, 0x0, 0x5f04, 0x0, 0x5f22, 0x0, 0x5f53, 0x0, 0x5f62, 0x0, 0x5f69, 0x0, 0x5f6b, 0x0, 0x5f8b, 0x0, 0x5f9a, 0x0, 0x5fa9, 0x0, 0x5fad, 0x0, 0x5fcd, 0x0, 0x5fd7, 0x0, 0x5ff5, 0x0, 0x5ff9, 0x0, 0x6012, 0x0, 0x601c, 0x0, 0x6075, 0x0, 0x6081, 0x0, 0x6094, 0x0, 0x60c7, 0x0, 0x60d8, 0x0, 0x60e1, 0x0, 0x6108, 0x0, 0x6144, 0x0, 0x6148, 0x0, 0x614c, 0x0, 0x614e, 0x0, 0x6160, 0x0, 0x6168, 0x0, 0x617a, 0x0, 0x618e, 0x0, 0x6190, 0x0, 0x61a4, 0x0, 0x61af, 0x0, 0x61b2, 0x0, 0x61de, 0x0, 0x61f2, 0x0, 0x61f6, 0x0, 0x6200, 0x0, 0x6210, 0x0, 0x621b, 0x0, 0x622e, 0x0, 0x6234, 0x0, 0x625d, 0x0, 0x62b1, 0x0, 0x62c9, 0x0, 0x62cf, 0x0, 0x62d3, 0x0, 0x62d4, 0x0, 0x62fc, 0x0, 0x62fe, 0x0, 0x633d, 0x0, 0x6350, 0x0, 0x6368, 0x0, 0x637b, 0x0, 0x6383, 0x0, 0x63a0, 0x0, 0x63a9, 0x0, 0x63c4, 0x0, 0x63c5, 0x0, 0x63e4, 0x0, 0x641c, 0x0, 0x6422, 0x0, 0x6452, 0x0, 0x6469, 0x0, 0x6477, 0x0, 0x647e, 0x0, 0x649a, 0x0, 0x649d, 0x0, 0x64c4, 0x0, 0x654f, 0x0, 0x6556, 0x0, 0x656c, 0x0, 0x6578, 0x0, 0x6599, 0x0, 0x65c5, 0x0, 0x65e2, 0x0, 0x65e3, 0x0, 0x6613, 0x0, 0x6649, 0x0, 0x6674, 0x0, 0x6688, 0x0, 0x6691, 0x0, 0x669c, 0x0, 0x66b4, 0x0, 0x66c6, 0x0, 0x66f4, 0x0, 0x66f8, 0x0, 0x6700, 0x0, 0x6717, 0x0, 0x671b, 0x0, 0x6721, 0x0, 0x674e, 0x0, 0x6753, 0x0, 0x6756, 0x0, 0x675e, 0x0, 0x677b, 0x0, 0x6785, 0x0, 0x6797, 0x0, 0x67f3, 0x0, 0x67fa, 0x0, 0x6817, 0x0, 0x681f, 0x0, 0x6852, 0x0, 0x6881, 0x0, 0x6885, 0x0, 0x688e, 0x0, 0x68a8, 0x0, 0x6914, 0x0, 0x6942, 0x0, 0x69a3, 0x0, 0x69ea, 0x0, 0x6a02, 0x0, 0x6a13, 0x0, 0x6aa8, 0x0, 0x6ad3, 0x0, 0x6adb, 0x0, 0x6b04, 0x0, 0x6b21, 0x0, 0x6b54, 0x0, 0x6b72, 0x0, 0x6b77, 0x0, 0x6b79, 0x0, 0x6b9f, 0x0, 0x6bae, 0x0, 0x6bba, 0x0, 0x6bbb, 0x0, 0x6c4e, 0x0, 0x6c67, 0x0, 0x6c88, 0x0, 0x6cbf, 0x0, 0x6ccc, 0x0, 0x6ccd, 0x0, 0x6ce5, 0x0, 0x6d16, 0x0, 0x6d1b, 0x0, 0x6d1e, 0x0, 0x6d34, 0x0, 0x6d3e, 0x0, 0x6d41, 0x0, 0x6d69, 0x0, 0x6d6a, 0x0, 0x6d77, 0x0, 0x6d78, 0x0, 0x6d85, 0x0, 0x6dcb, 0x0, 0x6dda, 0x0, 0x6dea, 0x0, 0x6df9, 0x0, 0x6e1a, 0x0, 0x6e2f, 0x0, 0x6e6e, 0x0, 0x6e9c, 0x0, 0x6eba, 0x0, 0x6ec7, 0x0, 0x6ecb, 0x0, 0x6ed1, 0x0, 0x6edb, 0x0, 0x6f0f, 0x0, 0x6f22, 0x0, 0x6f23, 0x0, 0x6f6e, 0x0, 0x6fc6, 0x0, 0x6feb, 0x0, 0x6ffe, 0x0, 0x701b, 0x0, 0x701e, 0x0, 0x7039, 0x0, 0x704a, 0x0, 0x7070, 0x0, 0x7077, 0x0, 0x707d, 0x0, 0x7099, 0x0, 0x70ad, 0x0, 0x70c8, 0x0, 0x70d9, 0x0, 0x7145, 0x0, 0x7149, 0x0, 0x716e, 0x0, 0x719c, 0x0, 0x71ce, 0x0, 0x71d0, 0x0, 0x7210, 0x0, 0x721b, 0x0, 0x7228, 0x0, 0x722b, 0x0, 0x7235, 0x0, 0x7250, 0x0, 0x7262, 0x0, 0x7280, 0x0, 0x7295, 0x0, 0x72af, 0x0, 0x72c0, 0x0, 0x72fc, 0x0, 0x732a, 0x0, 0x7375, 0x0, 0x737a, 0x0, 0x7387, 0x0, 0x738b, 0x0, 0x73a5, 0x0, 0x73b2, 0x0, 0x73de, 0x0, 0x7406, 0x0, 0x7409, 0x0, 0x7422, 0x0, 0x7447, 0x0, 0x745c, 0x0, 0x7469, 0x0, 0x7471, 0x0, 0x7485, 0x0, 0x7489, 0x0, 0x7498, 0x0, 0x74ca, 0x0, 0x7506, 0x0, 0x7524, 0x0, 0x753b, 0x0, 0x753e, 0x0, 0x7559, 0x0, 0x7565, 0x0, 0x7570, 0x0, 0x75e2, 0x0, 0x7610, 0x0, 0x761d, 0x0, 0x761f, 0x0, 0x7642, 0x0, 0x7669, 0x0, 0x76ca, 0x0, 0x76db, 0x0, 0x76e7, 0x0, 0x76f4, 0x0, 0x7701, 0x0, 0x771e, 0x0, 0x771f, 0x0, 0x7740, 0x0, 0x774a, 0x0, 0x778b, 0x0, 0x77a7, 0x0, 0x784e, 0x0, 0x786b, 0x0, 0x788c, 0x0, 0x7891, 0x0, 0x78ca, 0x0, 0x78cc, 0x0, 0x78fb, 0x0, 0x792a, 0x0, 0x793c, 0x0, 0x793e, 0x0, 0x7948, 0x0, 0x7949, 0x0, 0x7950, 0x0, 0x7956, 0x0, 0x795d, 0x0, 0x795e, 0x0, 0x7965, 0x0, 0x797f, 0x0, 0x798d, 0x0, 0x798e, 0x0, 0x798f, 0x0, 0x79ae, 0x0, 0x79ca, 0x0, 0x79eb, 0x0, 0x7a1c, 0x0, 0x7a40, 0x0, 0x7a4a, 0x0, 0x7a4f, 0x0, 0x7a81, 0x0, 0x7ab1, 0x0, 0x7acb, 0x0, 0x7aee, 0x0, 0x7b20, 0x0, 0x7bc0, 0x0, 0x7bc6, 0x0, 0x7bc9, 0x0, 0x7c3e, 0x0, 0x7c60, 0x0, 0x7c7b, 0x0, 0x7c92, 0x0, 0x7cbe, 0x0, 0x7cd2, 0x0, 0x7cd6, 0x0, 0x7ce3, 0x0, 0x7ce7, 0x0, 0x7ce8, 0x0, 0x7d00, 0x0, 0x7d10, 0x0, 0x7d22, 0x0, 0x7d2f, 0x0, 0x7d5b, 0x0, 0x7d63, 0x0, 0x7da0, 0x0, 0x7dbe, 0x0, 0x7dc7, 0x0, 0x7df4, 0x0, 0x7e02, 0x0, 0x7e09, 0x0, 0x7e37, 0x0, 0x7e41, 0x0, 0x7e45, 0x0, 0x7f3e, 0x0, 0x7f72, 0x0, 0x7f79, 0x0, 0x7f7a, 0x0, 0x7f85, 0x0, 0x7f95, 0x0, 0x7f9a, 0x0, 0x7fbd, 0x0, 0x7ffa, 0x0, 0x8001, 0x0, 0x8005, 0x0, 0x8046, 0x0, 0x8060, 0x0, 0x806f, 0x0, 0x8070, 0x0, 0x807e, 0x0, 0x808b, 0x0, 0x80ad, 0x0, 0x80b2, 0x0, 0x8103, 0x0, 0x813e, 0x0, 0x81d8, 0x0, 0x81e8, 0x0, 0x81ed, 0x0, 0x8201, 0x0, 0x8204, 0x0, 0x8218, 0x0, 0x826f, 0x0, 0x8279, 0x0, 0x828b, 0x0, 0x8291, 0x0, 0x829d, 0x0, 0x82b1, 0x0, 0x82b3, 0x0, 0x82bd, 0x0, 0x82e5, 0x0, 0x82e6, 0x0, 0x831d, 0x0, 0x8323, 0x0, 0x8336, 0x0, 0x8352, 0x0, 0x8353, 0x0, 0x8363, 0x0, 0x83ad, 0x0, 0x83bd, 0x0, 0x83c9, 0x0, 0x83ca, 0x0, 0x83cc, 0x0, 0x83dc, 0x0, 0x83e7, 0x0, 0x83ef, 0x0, 0x83f1, 0x0, 0x843d, 0x0, 0x8449, 0x0, 0x8457, 0x0, 0x84ee, 0x0, 0x84f1, 0x0, 0x84f3, 0x0, 0x84fc, 0x0, 0x8516, 0x0, 0x8564, 0x0, 0x85cd, 0x0, 0x85fa, 0x0, 0x8606, 0x0, 0x8612, 0x0, 0x862d, 0x0, 0x863f, 0x0, 0x8650, 0x0, 0x865c, 0x0, 0x8667, 0x0, 0x8669, 0x0, 0x8688, 0x0, 0x86a9, 0x0, 0x86e2, 0x0, 0x870e, 0x0, 0x8728, 0x0, 0x876b, 0x0, 0x8779, 0x0, 0x8786, 0x0, 0x87ba, 0x0, 0x87e1, 0x0, 0x8801, 0x0, 0x881f, 0x0, 0x884c, 0x0, 0x8860, 0x0, 0x8863, 0x0, 0x88c2, 0x0, 0x88cf, 0x0, 0x88d7, 0x0, 0x88de, 0x0, 0x88e1, 0x0, 0x88f8, 0x0, 0x88fa, 0x0, 0x8910, 0x0, 0x8941, 0x0, 0x8964, 0x0, 0x8986, 0x0, 0x898b, 0x0, 0x8996, 0x0, 0x8aa0, 0x0, 0x8aaa, 0x0, 0x8abf, 0x0, 0x8acb, 0x0, 0x8ad2, 0x0, 0x8ad6, 0x0, 0x8aed, 0x0, 0x8af8, 0x0, 0x8afe, 0x0, 0x8b01, 0x0, 0x8b39, 0x0, 0x8b58, 0x0, 0x8b80, 0x0, 0x8b8a, 0x0, 0x8c48, 0x0, 0x8c55, 0x0, 0x8cab, 0x0, 0x8cc1, 0x0, 0x8cc2, 0x0, 0x8cc8, 0x0, 0x8cd3, 0x0, 0x8d08, 0x0, 0x8d1b, 0x0, 0x8d77, 0x0, 0x8dbc, 0x0, 0x8dcb, 0x0, 0x8def, 0x0, 0x8df0, 0x0, 0x8eca, 0x0, 0x8ed4, 0x0, 0x8f26, 0x0, 0x8f2a, 0x0, 0x8f38, 0x0, 0x8f3b, 0x0, 0x8f62, 0x0, 0x8f9e, 0x0, 0x8fb0, 0x0, 0x8fb6, 0x0, 0x9023, 0x0, 0x9038, 0x0, 0x9072, 0x0, 0x907c, 0x0, 0x908f, 0x0, 0x9094, 0x0, 0x90ce, 0x0, 0x90de, 0x0, 0x90f1, 0x0, 0x90fd, 0x0, 0x9111, 0x0, 0x911b, 0x0, 0x916a, 0x0, 0x9199, 0x0, 0x91b4, 0x0, 0x91cc, 0x0, 0x91cf, 0x0, 0x91d1, 0x0, 0x9234, 0x0, 0x9238, 0x0, 0x9276, 0x0, 0x927c, 0x0, 0x92d7, 0x0, 0x92d8, 0x0, 0x9304, 0x0, 0x934a, 0x0, 0x93f9, 0x0, 0x9415, 0x0, 0x958b, 0x0, 0x95ad, 0x0, 0x95b7, 0x0, 0x962e, 0x0, 0x964b, 0x0, 0x964d, 0x0, 0x9675, 0x0, 0x9678, 0x0, 0x967c, 0x0, 0x9686, 0x0, 0x96a3, 0x0, 0x96b7, 0x0, 0x96b8, 0x0, 0x96c3, 0x0, 0x96e2, 0x0, 0x96e3, 0x0, 0x96f6, 0x0, 0x96f7, 0x0, 0x9723, 0x0, 0x9732, 0x0, 0x9748, 0x0, 0x9756, 0x0, 0x97db, 0x0, 0x97e0, 0x0, 0x97ff, 0x0, 0x980b, 0x0, 0x9818, 0x0, 0x9829, 0x0, 0x983b, 0x0, 0x985e, 0x0, 0x98e2, 0x0, 0x98ef, 0x0, 0x98fc, 0x0, 0x9928, 0x0, 0x9929, 0x0, 0x99a7, 0x0, 0x99c2, 0x0, 0x99f1, 0x0, 0x99fe, 0x0, 0x9a6a, 0x0, 0x9b12, 0x0, 0x9b6f, 0x0, 0x9c40, 0x0, 0x9c57, 0x0, 0x9cfd, 0x0, 0x9d67, 0x0, 0x9db4, 0x0, 0x9dfa, 0x0, 0x9e1e, 0x0, 0x9e7f, 0x0, 0x9e97, 0x0, 0x9e9f, 0x0, 0x9ebb, 0x0, 0x9ece, 0x0, 0x9ef9, 0x0, 0x9efe, 0x0, 0x9f05, 0x0, 0x9f0f, 0x0, 0x9f16, 0x0, 0x9f3b, 0x0, 0x9f43, 0x0, 0x9f8d, 0x0, 0x9f8e, 0x0, 0x9f9c, 0x0, 0x11099, 0x110ba, 0x0, 0x1109b, 0x110ba, 0x0, 0x110a5, 0x110ba, 0x0, 0x11131, 0x11127, 0x0, 0x11132, 0x11127, 0x0, 0x1d157, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x1d16e, 0x0, 0x1d158, 0x1d165, 0x1d16f, 0x0, 0x1d158, 0x1d165, 0x1d170, 0x0, 0x1d158, 0x1d165, 0x1d171, 0x0, 0x1d158, 0x1d165, 0x1d172, 0x0, 0x1d1b9, 0x1d165, 0x0, 0x1d1b9, 0x1d165, 0x1d16e, 0x0, 0x1d1b9, 0x1d165, 0x1d16f, 0x0, 0x1d1ba, 0x1d165, 0x0, 0x1d1ba, 0x1d165, 0x1d16e, 0x0, 0x1d1ba, 0x1d165, 0x1d16f, 0x0, 0x20122, 0x0, 0x2051c, 0x0, 0x20525, 0x0, 0x2054b, 0x0, 0x2063a, 0x0, 0x20804, 0x0, 0x208de, 0x0, 0x20a2c, 0x0, 0x20b63, 0x0, 0x214e4, 0x0, 0x216a8, 0x0, 0x216ea, 0x0, 0x219c8, 0x0, 0x21b18, 0x0, 0x21d0b, 0x0, 0x21de4, 0x0, 0x21de6, 0x0, 0x22183, 0x0, 0x2219f, 0x0, 0x22331, 0x0, 0x226d4, 0x0, 0x22844, 0x0, 0x2284a, 0x0, 0x22b0c, 0x0, 0x22bf1, 0x0, 0x2300a, 0x0, 0x232b8, 0x0, 0x2335f, 0x0, 0x23393, 0x0, 0x2339c, 0x0, 0x233c3, 0x0, 0x233d5, 0x0, 0x2346d, 0x0, 0x236a3, 0x0, 0x238a7, 0x0, 0x23a8d, 0x0, 0x23afa, 0x0, 0x23cbc, 0x0, 0x23d1e, 0x0, 0x23ed1, 0x0, 0x23f5e, 0x0, 0x23f8e, 0x0, 0x24263, 0x0, 0x242ee, 0x0, 0x243ab, 0x0, 0x24608, 0x0, 0x24735, 0x0, 0x24814, 0x0, 0x24c36, 0x0, 0x24c92, 0x0, 0x24fa1, 0x0, 0x24fb8, 0x0, 0x25044, 0x0, 0x250f2, 0x0, 0x250f3, 0x0, 0x25119, 0x0, 0x25133, 0x0, 0x25249, 0x0, 0x2541d, 0x0, 0x25626, 0x0, 0x2569a, 0x0, 0x256c5, 0x0, 0x2597c, 0x0, 0x25aa7, 0x0, 0x25bab, 0x0, 0x25c80, 0x0, 0x25cd0, 0x0, 0x25f86, 0x0, 0x261da, 0x0, 0x26228, 0x0, 0x26247, 0x0, 0x262d9, 0x0, 0x2633e, 0x0, 0x264da, 0x0, 0x26523, 0x0, 0x265a8, 0x0, 0x267a7, 0x0, 0x267b5, 0x0, 0x26b3c, 0x0, 0x26c36, 0x0, 0x26cd5, 0x0, 0x26d6b, 0x0, 0x26f2c, 0x0, 0x26fb1, 0x0, 0x270d2, 0x0, 0x273ca, 0x0, 0x27667, 0x0, 0x278ae, 0x0, 0x27966, 0x0, 0x27ca8, 0x0, 0x27ed3, 0x0, 0x27f2f, 0x0, 0x285d2, 0x0, 0x285ed, 0x0, 0x2872e, 0x0, 0x28bfa, 0x0, 0x28d77, 0x0, 0x29145, 0x0, 0x291df, 0x0, 0x2921a, 0x0, 0x2940a, 0x0, 0x29496, 0x0, 0x295b6, 0x0, 0x29b30, 0x0, 0x2a0ce, 0x0, 0x2a105, 0x0, 0x2a20e, 0x0, 0x2a291, 0x0, 0x2a392, 0x0, 0x2a600, 0x0]; return t; } -+_IDCA decompCompatTable() { static _IDCA t = [ 0x0, 0x20, 0x0, 0x20, 0x301, 0x0, 0x20, 0x303, 0x0, 0x20, 0x304, 0x0, 0x20, 0x305, 0x0, 0x20, 0x306, 0x0, 0x20, 0x307, 0x0, 0x20, 0x308, 0x0, 0x20, 0x308, 0x300, 0x0, 0x20, 0x308, 0x301, 0x0, 0x20, 0x308, 0x342, 0x0, 0x20, 0x30a, 0x0, 0x20, 0x30b, 0x0, 0x20, 0x313, 0x0, 0x20, 0x313, 0x300, 0x0, 0x20, 0x313, 0x301, 0x0, 0x20, 0x313, 0x342, 0x0, 0x20, 0x314, 0x0, 0x20, 0x314, 0x300, 0x0, 0x20, 0x314, 0x301, 0x0, 0x20, 0x314, 0x342, 0x0, 0x20, 0x327, 0x0, 0x20, 0x328, 0x0, 0x20, 0x333, 0x0, 0x20, 0x342, 0x0, 0x20, 0x345, 0x0, 0x20, 0x64b, 0x0, 0x20, 0x64c, 0x0, 0x20, 0x64c, 0x651, 0x0, 0x20, 0x64d, 0x0, 0x20, 0x64d, 0x651, 0x0, 0x20, 0x64e, 0x0, 0x20, 0x64e, 0x651, 0x0, 0x20, 0x64f, 0x0, 0x20, 0x64f, 0x651, 0x0, 0x20, 0x650, 0x0, 0x20, 0x650, 0x651, 0x0, 0x20, 0x651, 0x0, 0x20, 0x651, 0x670, 0x0, 0x20, 0x652, 0x0, 0x20, 0x3099, 0x0, 0x20, 0x309a, 0x0, 0x21, 0x0, 0x21, 0x21, 0x0, 0x21, 0x3f, 0x0, 0x22, 0x0, 0x23, 0x0, 0x24, 0x0, 0x25, 0x0, 0x26, 0x0, 0x27, 0x0, 0x28, 0x0, 0x28, 0x31, 0x29, 0x0, 0x28, 0x31, 0x30, 0x29, 0x0, 0x28, 0x31, 0x31, 0x29, 0x0, 0x28, 0x31, 0x32, 0x29, 0x0, 0x28, 0x31, 0x33, 0x29, 0x0, 0x28, 0x31, 0x34, 0x29, 0x0, 0x28, 0x31, 0x35, 0x29, 0x0, 0x28, 0x31, 0x36, 0x29, 0x0, 0x28, 0x31, 0x37, 0x29, 0x0, 0x28, 0x31, 0x38, 0x29, 0x0, 0x28, 0x31, 0x39, 0x29, 0x0, 0x28, 0x32, 0x29, 0x0, 0x28, 0x32, 0x30, 0x29, 0x0, 0x28, 0x33, 0x29, 0x0, 0x28, 0x34, 0x29, 0x0, 0x28, 0x35, 0x29, 0x0, 0x28, 0x36, 0x29, 0x0, 0x28, 0x37, 0x29, 0x0, 0x28, 0x38, 0x29, 0x0, 0x28, 0x39, 0x29, 0x0, 0x28, 0x41, 0x29, 0x0, 0x28, 0x42, 0x29, 0x0, 0x28, 0x43, 0x29, 0x0, 0x28, 0x44, 0x29, 0x0, 0x28, 0x45, 0x29, 0x0, 0x28, 0x46, 0x29, 0x0, 0x28, 0x47, 0x29, 0x0, 0x28, 0x48, 0x29, 0x0, 0x28, 0x49, 0x29, 0x0, 0x28, 0x4a, 0x29, 0x0, 0x28, 0x4b, 0x29, 0x0, 0x28, 0x4c, 0x29, 0x0, 0x28, 0x4d, 0x29, 0x0, 0x28, 0x4e, 0x29, 0x0, 0x28, 0x4f, 0x29, 0x0, 0x28, 0x50, 0x29, 0x0, 0x28, 0x51, 0x29, 0x0, 0x28, 0x52, 0x29, 0x0, 0x28, 0x53, 0x29, 0x0, 0x28, 0x54, 0x29, 0x0, 0x28, 0x55, 0x29, 0x0, 0x28, 0x56, 0x29, 0x0, 0x28, 0x57, 0x29, 0x0, 0x28, 0x58, 0x29, 0x0, 0x28, 0x59, 0x29, 0x0, 0x28, 0x5a, 0x29, 0x0, 0x28, 0x61, 0x29, 0x0, 0x28, 0x62, 0x29, 0x0, 0x28, 0x63, 0x29, 0x0, 0x28, 0x64, 0x29, 0x0, 0x28, 0x65, 0x29, 0x0, 0x28, 0x66, 0x29, 0x0, 0x28, 0x67, 0x29, 0x0, 0x28, 0x68, 0x29, 0x0, 0x28, 0x69, 0x29, 0x0, 0x28, 0x6a, 0x29, 0x0, 0x28, 0x6b, 0x29, 0x0, 0x28, 0x6c, 0x29, 0x0, 0x28, 0x6d, 0x29, 0x0, 0x28, 0x6e, 0x29, 0x0, 0x28, 0x6f, 0x29, 0x0, 0x28, 0x70, 0x29, 0x0, 0x28, 0x71, 0x29, 0x0, 0x28, 0x72, 0x29, 0x0, 0x28, 0x73, 0x29, 0x0, 0x28, 0x74, 0x29, 0x0, 0x28, 0x75, 0x29, 0x0, 0x28, 0x76, 0x29, 0x0, 0x28, 0x77, 0x29, 0x0, 0x28, 0x78, 0x29, 0x0, 0x28, 0x79, 0x29, 0x0, 0x28, 0x7a, 0x29, 0x0, 0x28, 0x1100, 0x29, 0x0, 0x28, 0x1100, 0x1161, 0x29, 0x0, 0x28, 0x1102, 0x29, 0x0, 0x28, 0x1102, 0x1161, 0x29, 0x0, 0x28, 0x1103, 0x29, 0x0, 0x28, 0x1103, 0x1161, 0x29, 0x0, 0x28, 0x1105, 0x29, 0x0, 0x28, 0x1105, 0x1161, 0x29, 0x0, 0x28, 0x1106, 0x29, 0x0, 0x28, 0x1106, 0x1161, 0x29, 0x0, 0x28, 0x1107, 0x29, 0x0, 0x28, 0x1107, 0x1161, 0x29, 0x0, 0x28, 0x1109, 0x29, 0x0, 0x28, 0x1109, 0x1161, 0x29, 0x0, 0x28, 0x110b, 0x29, 0x0, 0x28, 0x110b, 0x1161, 0x29, 0x0, 0x28, 0x110b, 0x1169, 0x110c, 0x1165, 0x11ab, 0x29, 0x0, 0x28, 0x110b, 0x1169, 0x1112, 0x116e, 0x29, 0x0, 0x28, 0x110c, 0x29, 0x0, 0x28, 0x110c, 0x1161, 0x29, 0x0, 0x28, 0x110c, 0x116e, 0x29, 0x0, 0x28, 0x110e, 0x29, 0x0, 0x28, 0x110e, 0x1161, 0x29, 0x0, 0x28, 0x110f, 0x29, 0x0, 0x28, 0x110f, 0x1161, 0x29, 0x0, 0x28, 0x1110, 0x29, 0x0, 0x28, 0x1110, 0x1161, 0x29, 0x0, 0x28, 0x1111, 0x29, 0x0, 0x28, 0x1111, 0x1161, 0x29, 0x0, 0x28, 0x1112, 0x29, 0x0, 0x28, 0x1112, 0x1161, 0x29, 0x0, 0x28, 0x4e00, 0x29, 0x0, 0x28, 0x4e03, 0x29, 0x0, 0x28, 0x4e09, 0x29, 0x0, 0x28, 0x4e5d, 0x29, 0x0, 0x28, 0x4e8c, 0x29, 0x0, 0x28, 0x4e94, 0x29, 0x0, 0x28, 0x4ee3, 0x29, 0x0, 0x28, 0x4f01, 0x29, 0x0, 0x28, 0x4f11, 0x29, 0x0, 0x28, 0x516b, 0x29, 0x0, 0x28, 0x516d, 0x29, 0x0, 0x28, 0x52b4, 0x29, 0x0, 0x28, 0x5341, 0x29, 0x0, 0x28, 0x5354, 0x29, 0x0, 0x28, 0x540d, 0x29, 0x0, 0x28, 0x547c, 0x29, 0x0, 0x28, 0x56db, 0x29, 0x0, 0x28, 0x571f, 0x29, 0x0, 0x28, 0x5b66, 0x29, 0x0, 0x28, 0x65e5, 0x29, 0x0, 0x28, 0x6708, 0x29, 0x0, 0x28, 0x6709, 0x29, 0x0, 0x28, 0x6728, 0x29, 0x0, 0x28, 0x682a, 0x29, 0x0, 0x28, 0x6c34, 0x29, 0x0, 0x28, 0x706b, 0x29, 0x0, 0x28, 0x7279, 0x29, 0x0, 0x28, 0x76e3, 0x29, 0x0, 0x28, 0x793e, 0x29, 0x0, 0x28, 0x795d, 0x29, 0x0, 0x28, 0x796d, 0x29, 0x0, 0x28, 0x81ea, 0x29, 0x0, 0x28, 0x81f3, 0x29, 0x0, 0x28, 0x8ca1, 0x29, 0x0, 0x28, 0x8cc7, 0x29, 0x0, 0x28, 0x91d1, 0x29, 0x0, 0x29, 0x0, 0x2a, 0x0, 0x2b, 0x0, 0x2c, 0x0, 0x2d, 0x0, 0x2e, 0x0, 0x2e, 0x2e, 0x0, 0x2e, 0x2e, 0x2e, 0x0, 0x2f, 0x0, 0x30, 0x0, 0x30, 0x2c, 0x0, 0x30, 0x2e, 0x0, 0x30, 0x2044, 0x33, 0x0, 0x30, 0x70b9, 0x0, 0x31, 0x0, 0x31, 0x2c, 0x0, 0x31, 0x2e, 0x0, 0x31, 0x30, 0x0, 0x31, 0x30, 0x2e, 0x0, 0x31, 0x30, 0x65e5, 0x0, 0x31, 0x30, 0x6708, 0x0, 0x31, 0x30, 0x70b9, 0x0, 0x31, 0x31, 0x0, 0x31, 0x31, 0x2e, 0x0, 0x31, 0x31, 0x65e5, 0x0, 0x31, 0x31, 0x6708, 0x0, 0x31, 0x31, 0x70b9, 0x0, 0x31, 0x32, 0x0, 0x31, 0x32, 0x2e, 0x0, 0x31, 0x32, 0x65e5, 0x0, 0x31, 0x32, 0x6708, 0x0, 0x31, 0x32, 0x70b9, 0x0, 0x31, 0x33, 0x0, 0x31, 0x33, 0x2e, 0x0, 0x31, 0x33, 0x65e5, 0x0, 0x31, 0x33, 0x70b9, 0x0, 0x31, 0x34, 0x0, 0x31, 0x34, 0x2e, 0x0, 0x31, 0x34, 0x65e5, 0x0, 0x31, 0x34, 0x70b9, 0x0, 0x31, 0x35, 0x0, 0x31, 0x35, 0x2e, 0x0, 0x31, 0x35, 0x65e5, 0x0, 0x31, 0x35, 0x70b9, 0x0, 0x31, 0x36, 0x0, 0x31, 0x36, 0x2e, 0x0, 0x31, 0x36, 0x65e5, 0x0, 0x31, 0x36, 0x70b9, 0x0, 0x31, 0x37, 0x0, 0x31, 0x37, 0x2e, 0x0, 0x31, 0x37, 0x65e5, 0x0, 0x31, 0x37, 0x70b9, 0x0, 0x31, 0x38, 0x0, 0x31, 0x38, 0x2e, 0x0, 0x31, 0x38, 0x65e5, 0x0, 0x31, 0x38, 0x70b9, 0x0, 0x31, 0x39, 0x0, 0x31, 0x39, 0x2e, 0x0, 0x31, 0x39, 0x65e5, 0x0, 0x31, 0x39, 0x70b9, 0x0, 0x31, 0x2044, 0x0, 0x31, 0x2044, 0x31, 0x30, 0x0, 0x31, 0x2044, 0x32, 0x0, 0x31, 0x2044, 0x33, 0x0, 0x31, 0x2044, 0x34, 0x0, 0x31, 0x2044, 0x35, 0x0, 0x31, 0x2044, 0x36, 0x0, 0x31, 0x2044, 0x37, 0x0, 0x31, 0x2044, 0x38, 0x0, 0x31, 0x2044, 0x39, 0x0, 0x31, 0x65e5, 0x0, 0x31, 0x6708, 0x0, 0x31, 0x70b9, 0x0, 0x32, 0x0, 0x32, 0x2c, 0x0, 0x32, 0x2e, 0x0, 0x32, 0x30, 0x0, 0x32, 0x30, 0x2e, 0x0, 0x32, 0x30, 0x65e5, 0x0, 0x32, 0x30, 0x70b9, 0x0, 0x32, 0x31, 0x0, 0x32, 0x31, 0x65e5, 0x0, 0x32, 0x31, 0x70b9, 0x0, 0x32, 0x32, 0x0, 0x32, 0x32, 0x65e5, 0x0, 0x32, 0x32, 0x70b9, 0x0, 0x32, 0x33, 0x0, 0x32, 0x33, 0x65e5, 0x0, 0x32, 0x33, 0x70b9, 0x0, 0x32, 0x34, 0x0, 0x32, 0x34, 0x65e5, 0x0, 0x32, 0x34, 0x70b9, 0x0, 0x32, 0x35, 0x0, 0x32, 0x35, 0x65e5, 0x0, 0x32, 0x36, 0x0, 0x32, 0x36, 0x65e5, 0x0, 0x32, 0x37, 0x0, 0x32, 0x37, 0x65e5, 0x0, 0x32, 0x38, 0x0, 0x32, 0x38, 0x65e5, 0x0, 0x32, 0x39, 0x0, 0x32, 0x39, 0x65e5, 0x0, 0x32, 0x2044, 0x33, 0x0, 0x32, 0x2044, 0x35, 0x0, 0x32, 0x65e5, 0x0, 0x32, 0x6708, 0x0, 0x32, 0x70b9, 0x0, 0x33, 0x0, 0x33, 0x2c, 0x0, 0x33, 0x2e, 0x0, 0x33, 0x30, 0x0, 0x33, 0x30, 0x65e5, 0x0, 0x33, 0x31, 0x0, 0x33, 0x31, 0x65e5, 0x0, 0x33, 0x32, 0x0, 0x33, 0x33, 0x0, 0x33, 0x34, 0x0, 0x33, 0x35, 0x0, 0x33, 0x36, 0x0, 0x33, 0x37, 0x0, 0x33, 0x38, 0x0, 0x33, 0x39, 0x0, 0x33, 0x2044, 0x34, 0x0, 0x33, 0x2044, 0x35, 0x0, 0x33, 0x2044, 0x38, 0x0, 0x33, 0x65e5, 0x0, 0x33, 0x6708, 0x0, 0x33, 0x70b9, 0x0, 0x34, 0x0, 0x34, 0x2c, 0x0, 0x34, 0x2e, 0x0, 0x34, 0x30, 0x0, 0x34, 0x31, 0x0, 0x34, 0x32, 0x0, 0x34, 0x33, 0x0, 0x34, 0x34, 0x0, 0x34, 0x35, 0x0, 0x34, 0x36, 0x0, 0x34, 0x37, 0x0, 0x34, 0x38, 0x0, 0x34, 0x39, 0x0, 0x34, 0x2044, 0x35, 0x0, 0x34, 0x65e5, 0x0, 0x34, 0x6708, 0x0, 0x34, 0x70b9, 0x0, 0x35, 0x0, 0x35, 0x2c, 0x0, 0x35, 0x2e, 0x0, 0x35, 0x30, 0x0, 0x35, 0x2044, 0x36, 0x0, 0x35, 0x2044, 0x38, 0x0, 0x35, 0x65e5, 0x0, 0x35, 0x6708, 0x0, 0x35, 0x70b9, 0x0, 0x36, 0x0, 0x36, 0x2c, 0x0, 0x36, 0x2e, 0x0, 0x36, 0x65e5, 0x0, 0x36, 0x6708, 0x0, 0x36, 0x70b9, 0x0, 0x37, 0x0, 0x37, 0x2c, 0x0, 0x37, 0x2e, 0x0, 0x37, 0x2044, 0x38, 0x0, 0x37, 0x65e5, 0x0, 0x37, 0x6708, 0x0, 0x37, 0x70b9, 0x0, 0x38, 0x0, 0x38, 0x2c, 0x0, 0x38, 0x2e, 0x0, 0x38, 0x65e5, 0x0, 0x38, 0x6708, 0x0, 0x38, 0x70b9, 0x0, 0x39, 0x0, 0x39, 0x2c, 0x0, 0x39, 0x2e, 0x0, 0x39, 0x65e5, 0x0, 0x39, 0x6708, 0x0, 0x39, 0x70b9, 0x0, 0x3a, 0x0, 0x3a, 0x3a, 0x3d, 0x0, 0x3b, 0x0, 0x3c, 0x0, 0x3c, 0x338, 0x0, 0x3d, 0x0, 0x3d, 0x3d, 0x0, 0x3d, 0x3d, 0x3d, 0x0, 0x3d, 0x338, 0x0, 0x3e, 0x0, 0x3e, 0x338, 0x0, 0x3f, 0x0, 0x3f, 0x21, 0x0, 0x3f, 0x3f, 0x0, 0x40, 0x0, 0x41, 0x0, 0x41, 0x55, 0x0, 0x41, 0x300, 0x0, 0x41, 0x301, 0x0, 0x41, 0x302, 0x0, 0x41, 0x302, 0x300, 0x0, 0x41, 0x302, 0x301, 0x0, 0x41, 0x302, 0x303, 0x0, 0x41, 0x302, 0x309, 0x0, 0x41, 0x303, 0x0, 0x41, 0x304, 0x0, 0x41, 0x306, 0x0, 0x41, 0x306, 0x300, 0x0, 0x41, 0x306, 0x301, 0x0, 0x41, 0x306, 0x303, 0x0, 0x41, 0x306, 0x309, 0x0, 0x41, 0x307, 0x0, 0x41, 0x307, 0x304, 0x0, 0x41, 0x308, 0x0, 0x41, 0x308, 0x304, 0x0, 0x41, 0x309, 0x0, 0x41, 0x30a, 0x0, 0x41, 0x30a, 0x301, 0x0, 0x41, 0x30c, 0x0, 0x41, 0x30f, 0x0, 0x41, 0x311, 0x0, 0x41, 0x323, 0x0, 0x41, 0x323, 0x302, 0x0, 0x41, 0x323, 0x306, 0x0, 0x41, 0x325, 0x0, 0x41, 0x328, 0x0, 0x41, 0x2215, 0x6d, 0x0, 0x42, 0x0, 0x42, 0x71, 0x0, 0x42, 0x307, 0x0, 0x42, 0x323, 0x0, 0x42, 0x331, 0x0, 0x43, 0x0, 0x43, 0x44, 0x0, 0x43, 0x6f, 0x2e, 0x0, 0x43, 0x301, 0x0, 0x43, 0x302, 0x0, 0x43, 0x307, 0x0, 0x43, 0x30c, 0x0, 0x43, 0x327, 0x0, 0x43, 0x327, 0x301, 0x0, 0x43, 0x2215, 0x6b, 0x67, 0x0, 0x44, 0x0, 0x44, 0x4a, 0x0, 0x44, 0x5a, 0x0, 0x44, 0x5a, 0x30c, 0x0, 0x44, 0x7a, 0x0, 0x44, 0x7a, 0x30c, 0x0, 0x44, 0x307, 0x0, 0x44, 0x30c, 0x0, 0x44, 0x323, 0x0, 0x44, 0x327, 0x0, 0x44, 0x32d, 0x0, 0x44, 0x331, 0x0, 0x45, 0x0, 0x45, 0x300, 0x0, 0x45, 0x301, 0x0, 0x45, 0x302, 0x0, 0x45, 0x302, 0x300, 0x0, 0x45, 0x302, 0x301, 0x0, 0x45, 0x302, 0x303, 0x0, 0x45, 0x302, 0x309, 0x0, 0x45, 0x303, 0x0, 0x45, 0x304, 0x0, 0x45, 0x304, 0x300, 0x0, 0x45, 0x304, 0x301, 0x0, 0x45, 0x306, 0x0, 0x45, 0x307, 0x0, 0x45, 0x308, 0x0, 0x45, 0x309, 0x0, 0x45, 0x30c, 0x0, 0x45, 0x30f, 0x0, 0x45, 0x311, 0x0, 0x45, 0x323, 0x0, 0x45, 0x323, 0x302, 0x0, 0x45, 0x327, 0x0, 0x45, 0x327, 0x306, 0x0, 0x45, 0x328, 0x0, 0x45, 0x32d, 0x0, 0x45, 0x330, 0x0, 0x46, 0x0, 0x46, 0x41, 0x58, 0x0, 0x46, 0x307, 0x0, 0x47, 0x0, 0x47, 0x42, 0x0, 0x47, 0x48, 0x7a, 0x0, 0x47, 0x50, 0x61, 0x0, 0x47, 0x79, 0x0, 0x47, 0x301, 0x0, 0x47, 0x302, 0x0, 0x47, 0x304, 0x0, 0x47, 0x306, 0x0, 0x47, 0x307, 0x0, 0x47, 0x30c, 0x0, 0x47, 0x327, 0x0, 0x48, 0x0, 0x48, 0x50, 0x0, 0x48, 0x56, 0x0, 0x48, 0x67, 0x0, 0x48, 0x7a, 0x0, 0x48, 0x302, 0x0, 0x48, 0x307, 0x0, 0x48, 0x308, 0x0, 0x48, 0x30c, 0x0, 0x48, 0x323, 0x0, 0x48, 0x327, 0x0, 0x48, 0x32e, 0x0, 0x49, 0x0, 0x49, 0x49, 0x0, 0x49, 0x49, 0x49, 0x0, 0x49, 0x4a, 0x0, 0x49, 0x55, 0x0, 0x49, 0x56, 0x0, 0x49, 0x58, 0x0, 0x49, 0x300, 0x0, 0x49, 0x301, 0x0, 0x49, 0x302, 0x0, 0x49, 0x303, 0x0, 0x49, 0x304, 0x0, 0x49, 0x306, 0x0, 0x49, 0x307, 0x0, 0x49, 0x308, 0x0, 0x49, 0x308, 0x301, 0x0, 0x49, 0x309, 0x0, 0x49, 0x30c, 0x0, 0x49, 0x30f, 0x0, 0x49, 0x311, 0x0, 0x49, 0x323, 0x0, 0x49, 0x328, 0x0, 0x49, 0x330, 0x0, 0x4a, 0x0, 0x4a, 0x302, 0x0, 0x4b, 0x0, 0x4b, 0x42, 0x0, 0x4b, 0x4b, 0x0, 0x4b, 0x4d, 0x0, 0x4b, 0x301, 0x0, 0x4b, 0x30c, 0x0, 0x4b, 0x323, 0x0, 0x4b, 0x327, 0x0, 0x4b, 0x331, 0x0, 0x4c, 0x0, 0x4c, 0x4a, 0x0, 0x4c, 0x54, 0x44, 0x0, 0x4c, 0x6a, 0x0, 0x4c, 0xb7, 0x0, 0x4c, 0x301, 0x0, 0x4c, 0x30c, 0x0, 0x4c, 0x323, 0x0, 0x4c, 0x323, 0x304, 0x0, 0x4c, 0x327, 0x0, 0x4c, 0x32d, 0x0, 0x4c, 0x331, 0x0, 0x4d, 0x0, 0x4d, 0x42, 0x0, 0x4d, 0x43, 0x0, 0x4d, 0x44, 0x0, 0x4d, 0x48, 0x7a, 0x0, 0x4d, 0x50, 0x61, 0x0, 0x4d, 0x56, 0x0, 0x4d, 0x57, 0x0, 0x4d, 0x301, 0x0, 0x4d, 0x307, 0x0, 0x4d, 0x323, 0x0, 0x4d, 0x3a9, 0x0, 0x4e, 0x0, 0x4e, 0x4a, 0x0, 0x4e, 0x6a, 0x0, 0x4e, 0x6f, 0x0, 0x4e, 0x300, 0x0, 0x4e, 0x301, 0x0, 0x4e, 0x303, 0x0, 0x4e, 0x307, 0x0, 0x4e, 0x30c, 0x0, 0x4e, 0x323, 0x0, 0x4e, 0x327, 0x0, 0x4e, 0x32d, 0x0, 0x4e, 0x331, 0x0, 0x4f, 0x0, 0x4f, 0x300, 0x0, 0x4f, 0x301, 0x0, 0x4f, 0x302, 0x0, 0x4f, 0x302, 0x300, 0x0, 0x4f, 0x302, 0x301, 0x0, 0x4f, 0x302, 0x303, 0x0, 0x4f, 0x302, 0x309, 0x0, 0x4f, 0x303, 0x0, 0x4f, 0x303, 0x301, 0x0, 0x4f, 0x303, 0x304, 0x0, 0x4f, 0x303, 0x308, 0x0, 0x4f, 0x304, 0x0, 0x4f, 0x304, 0x300, 0x0, 0x4f, 0x304, 0x301, 0x0, 0x4f, 0x306, 0x0, 0x4f, 0x307, 0x0, 0x4f, 0x307, 0x304, 0x0, 0x4f, 0x308, 0x0, 0x4f, 0x308, 0x304, 0x0, 0x4f, 0x309, 0x0, 0x4f, 0x30b, 0x0, 0x4f, 0x30c, 0x0, 0x4f, 0x30f, 0x0, 0x4f, 0x311, 0x0, 0x4f, 0x31b, 0x0, 0x4f, 0x31b, 0x300, 0x0, 0x4f, 0x31b, 0x301, 0x0, 0x4f, 0x31b, 0x303, 0x0, 0x4f, 0x31b, 0x309, 0x0, 0x4f, 0x31b, 0x323, 0x0, 0x4f, 0x323, 0x0, 0x4f, 0x323, 0x302, 0x0, 0x4f, 0x328, 0x0, 0x4f, 0x328, 0x304, 0x0, 0x50, 0x0, 0x50, 0x48, 0x0, 0x50, 0x50, 0x4d, 0x0, 0x50, 0x50, 0x56, 0x0, 0x50, 0x52, 0x0, 0x50, 0x54, 0x45, 0x0, 0x50, 0x61, 0x0, 0x50, 0x301, 0x0, 0x50, 0x307, 0x0, 0x51, 0x0, 0x52, 0x0, 0x52, 0x73, 0x0, 0x52, 0x301, 0x0, 0x52, 0x307, 0x0, 0x52, 0x30c, 0x0, 0x52, 0x30f, 0x0, 0x52, 0x311, 0x0, 0x52, 0x323, 0x0, 0x52, 0x323, 0x304, 0x0, 0x52, 0x327, 0x0, 0x52, 0x331, 0x0, 0x53, 0x0, 0x53, 0x44, 0x0, 0x53, 0x4d, 0x0, 0x53, 0x53, 0x0, 0x53, 0x76, 0x0, 0x53, 0x301, 0x0, 0x53, 0x301, 0x307, 0x0, 0x53, 0x302, 0x0, 0x53, 0x307, 0x0, 0x53, 0x30c, 0x0, 0x53, 0x30c, 0x307, 0x0, 0x53, 0x323, 0x0, 0x53, 0x323, 0x307, 0x0, 0x53, 0x326, 0x0, 0x53, 0x327, 0x0, 0x54, 0x0, 0x54, 0x45, 0x4c, 0x0, 0x54, 0x48, 0x7a, 0x0, 0x54, 0x4d, 0x0, 0x54, 0x307, 0x0, 0x54, 0x30c, 0x0, 0x54, 0x323, 0x0, 0x54, 0x326, 0x0, 0x54, 0x327, 0x0, 0x54, 0x32d, 0x0, 0x54, 0x331, 0x0, 0x55, 0x0, 0x55, 0x300, 0x0, 0x55, 0x301, 0x0, 0x55, 0x302, 0x0, 0x55, 0x303, 0x0, 0x55, 0x303, 0x301, 0x0, 0x55, 0x304, 0x0, 0x55, 0x304, 0x308, 0x0, 0x55, 0x306, 0x0, 0x55, 0x308, 0x0, 0x55, 0x308, 0x300, 0x0, 0x55, 0x308, 0x301, 0x0, 0x55, 0x308, 0x304, 0x0, 0x55, 0x308, 0x30c, 0x0, 0x55, 0x309, 0x0, 0x55, 0x30a, 0x0, 0x55, 0x30b, 0x0, 0x55, 0x30c, 0x0, 0x55, 0x30f, 0x0, 0x55, 0x311, 0x0, 0x55, 0x31b, 0x0, 0x55, 0x31b, 0x300, 0x0, 0x55, 0x31b, 0x301, 0x0, 0x55, 0x31b, 0x303, 0x0, 0x55, 0x31b, 0x309, 0x0, 0x55, 0x31b, 0x323, 0x0, 0x55, 0x323, 0x0, 0x55, 0x324, 0x0, 0x55, 0x328, 0x0, 0x55, 0x32d, 0x0, 0x55, 0x330, 0x0, 0x56, 0x0, 0x56, 0x49, 0x0, 0x56, 0x49, 0x49, 0x0, 0x56, 0x49, 0x49, 0x49, 0x0, 0x56, 0x303, 0x0, 0x56, 0x323, 0x0, 0x56, 0x2215, 0x6d, 0x0, 0x57, 0x0, 0x57, 0x43, 0x0, 0x57, 0x5a, 0x0, 0x57, 0x62, 0x0, 0x57, 0x300, 0x0, 0x57, 0x301, 0x0, 0x57, 0x302, 0x0, 0x57, 0x307, 0x0, 0x57, 0x308, 0x0, 0x57, 0x323, 0x0, 0x58, 0x0, 0x58, 0x49, 0x0, 0x58, 0x49, 0x49, 0x0, 0x58, 0x307, 0x0, 0x58, 0x308, 0x0, 0x59, 0x0, 0x59, 0x300, 0x0, 0x59, 0x301, 0x0, 0x59, 0x302, 0x0, 0x59, 0x303, 0x0, 0x59, 0x304, 0x0, 0x59, 0x307, 0x0, 0x59, 0x308, 0x0, 0x59, 0x309, 0x0, 0x59, 0x323, 0x0, 0x5a, 0x0, 0x5a, 0x301, 0x0, 0x5a, 0x302, 0x0, 0x5a, 0x307, 0x0, 0x5a, 0x30c, 0x0, 0x5a, 0x323, 0x0, 0x5a, 0x331, 0x0, 0x5b, 0x0, 0x5c, 0x0, 0x5d, 0x0, 0x5e, 0x0, 0x5f, 0x0, 0x60, 0x0, 0x61, 0x0, 0x61, 0x2e, 0x6d, 0x2e, 0x0, 0x61, 0x2f, 0x63, 0x0, 0x61, 0x2f, 0x73, 0x0, 0x61, 0x2be, 0x0, 0x61, 0x300, 0x0, 0x61, 0x301, 0x0, 0x61, 0x302, 0x0, 0x61, 0x302, 0x300, 0x0, 0x61, 0x302, 0x301, 0x0, 0x61, 0x302, 0x303, 0x0, 0x61, 0x302, 0x309, 0x0, 0x61, 0x303, 0x0, 0x61, 0x304, 0x0, 0x61, 0x306, 0x0, 0x61, 0x306, 0x300, 0x0, 0x61, 0x306, 0x301, 0x0, 0x61, 0x306, 0x303, 0x0, 0x61, 0x306, 0x309, 0x0, 0x61, 0x307, 0x0, 0x61, 0x307, 0x304, 0x0, 0x61, 0x308, 0x0, 0x61, 0x308, 0x304, 0x0, 0x61, 0x309, 0x0, 0x61, 0x30a, 0x0, 0x61, 0x30a, 0x301, 0x0, 0x61, 0x30c, 0x0, 0x61, 0x30f, 0x0, 0x61, 0x311, 0x0, 0x61, 0x323, 0x0, 0x61, 0x323, 0x302, 0x0, 0x61, 0x323, 0x306, 0x0, 0x61, 0x325, 0x0, 0x61, 0x328, 0x0, 0x62, 0x0, 0x62, 0x61, 0x72, 0x0, 0x62, 0x307, 0x0, 0x62, 0x323, 0x0, 0x62, 0x331, 0x0, 0x63, 0x0, 0x63, 0x2f, 0x6f, 0x0, 0x63, 0x2f, 0x75, 0x0, 0x63, 0x61, 0x6c, 0x0, 0x63, 0x63, 0x0, 0x63, 0x64, 0x0, 0x63, 0x6d, 0x0, 0x63, 0x6d, 0x32, 0x0, 0x63, 0x6d, 0x33, 0x0, 0x63, 0x301, 0x0, 0x63, 0x302, 0x0, 0x63, 0x307, 0x0, 0x63, 0x30c, 0x0, 0x63, 0x327, 0x0, 0x63, 0x327, 0x301, 0x0, 0x64, 0x0, 0x64, 0x42, 0x0, 0x64, 0x61, 0x0, 0x64, 0x6c, 0x0, 0x64, 0x6d, 0x0, 0x64, 0x6d, 0x32, 0x0, 0x64, 0x6d, 0x33, 0x0, 0x64, 0x7a, 0x0, 0x64, 0x7a, 0x30c, 0x0, 0x64, 0x307, 0x0, 0x64, 0x30c, 0x0, 0x64, 0x323, 0x0, 0x64, 0x327, 0x0, 0x64, 0x32d, 0x0, 0x64, 0x331, 0x0, 0x65, 0x0, 0x65, 0x56, 0x0, 0x65, 0x72, 0x67, 0x0, 0x65, 0x300, 0x0, 0x65, 0x301, 0x0, 0x65, 0x302, 0x0, 0x65, 0x302, 0x300, 0x0, 0x65, 0x302, 0x301, 0x0, 0x65, 0x302, 0x303, 0x0, 0x65, 0x302, 0x309, 0x0, 0x65, 0x303, 0x0, 0x65, 0x304, 0x0, 0x65, 0x304, 0x300, 0x0, 0x65, 0x304, 0x301, 0x0, 0x65, 0x306, 0x0, 0x65, 0x307, 0x0, 0x65, 0x308, 0x0, 0x65, 0x309, 0x0, 0x65, 0x30c, 0x0, 0x65, 0x30f, 0x0, 0x65, 0x311, 0x0, 0x65, 0x323, 0x0, 0x65, 0x323, 0x302, 0x0, 0x65, 0x327, 0x0, 0x65, 0x327, 0x306, 0x0, 0x65, 0x328, 0x0, 0x65, 0x32d, 0x0, 0x65, 0x330, 0x0, 0x66, 0x0, 0x66, 0x66, 0x0, 0x66, 0x66, 0x69, 0x0, 0x66, 0x66, 0x6c, 0x0, 0x66, 0x69, 0x0, 0x66, 0x6c, 0x0, 0x66, 0x6d, 0x0, 0x66, 0x307, 0x0, 0x67, 0x0, 0x67, 0x61, 0x6c, 0x0, 0x67, 0x301, 0x0, 0x67, 0x302, 0x0, 0x67, 0x304, 0x0, 0x67, 0x306, 0x0, 0x67, 0x307, 0x0, 0x67, 0x30c, 0x0, 0x67, 0x327, 0x0, 0x68, 0x0, 0x68, 0x50, 0x61, 0x0, 0x68, 0x61, 0x0, 0x68, 0x302, 0x0, 0x68, 0x307, 0x0, 0x68, 0x308, 0x0, 0x68, 0x30c, 0x0, 0x68, 0x323, 0x0, 0x68, 0x327, 0x0, 0x68, 0x32e, 0x0, 0x68, 0x331, 0x0, 0x69, 0x0, 0x69, 0x69, 0x0, 0x69, 0x69, 0x69, 0x0, 0x69, 0x6a, 0x0, 0x69, 0x6e, 0x0, 0x69, 0x76, 0x0, 0x69, 0x78, 0x0, 0x69, 0x300, 0x0, 0x69, 0x301, 0x0, 0x69, 0x302, 0x0, 0x69, 0x303, 0x0, 0x69, 0x304, 0x0, 0x69, 0x306, 0x0, 0x69, 0x308, 0x0, 0x69, 0x308, 0x301, 0x0, 0x69, 0x309, 0x0, 0x69, 0x30c, 0x0, 0x69, 0x30f, 0x0, 0x69, 0x311, 0x0, 0x69, 0x323, 0x0, 0x69, 0x328, 0x0, 0x69, 0x330, 0x0, 0x6a, 0x0, 0x6a, 0x302, 0x0, 0x6a, 0x30c, 0x0, 0x6b, 0x0, 0x6b, 0x41, 0x0, 0x6b, 0x48, 0x7a, 0x0, 0x6b, 0x50, 0x61, 0x0, 0x6b, 0x56, 0x0, 0x6b, 0x57, 0x0, 0x6b, 0x63, 0x61, 0x6c, 0x0, 0x6b, 0x67, 0x0, 0x6b, 0x6c, 0x0, 0x6b, 0x6d, 0x0, 0x6b, 0x6d, 0x32, 0x0, 0x6b, 0x6d, 0x33, 0x0, 0x6b, 0x74, 0x0, 0x6b, 0x301, 0x0, 0x6b, 0x30c, 0x0, 0x6b, 0x323, 0x0, 0x6b, 0x327, 0x0, 0x6b, 0x331, 0x0, 0x6b, 0x3a9, 0x0, 0x6c, 0x0, 0x6c, 0x6a, 0x0, 0x6c, 0x6d, 0x0, 0x6c, 0x6e, 0x0, 0x6c, 0x6f, 0x67, 0x0, 0x6c, 0x78, 0x0, 0x6c, 0xb7, 0x0, 0x6c, 0x301, 0x0, 0x6c, 0x30c, 0x0, 0x6c, 0x323, 0x0, 0x6c, 0x323, 0x304, 0x0, 0x6c, 0x327, 0x0, 0x6c, 0x32d, 0x0, 0x6c, 0x331, 0x0, 0x6d, 0x0, 0x6d, 0x32, 0x0, 0x6d, 0x33, 0x0, 0x6d, 0x41, 0x0, 0x6d, 0x56, 0x0, 0x6d, 0x57, 0x0, 0x6d, 0x62, 0x0, 0x6d, 0x67, 0x0, 0x6d, 0x69, 0x6c, 0x0, 0x6d, 0x6c, 0x0, 0x6d, 0x6d, 0x0, 0x6d, 0x6d, 0x32, 0x0, 0x6d, 0x6d, 0x33, 0x0, 0x6d, 0x6f, 0x6c, 0x0, 0x6d, 0x73, 0x0, 0x6d, 0x301, 0x0, 0x6d, 0x307, 0x0, 0x6d, 0x323, 0x0, 0x6d, 0x2215, 0x73, 0x0, 0x6d, 0x2215, 0x73, 0x32, 0x0, 0x6e, 0x0, 0x6e, 0x41, 0x0, 0x6e, 0x46, 0x0, 0x6e, 0x56, 0x0, 0x6e, 0x57, 0x0, 0x6e, 0x6a, 0x0, 0x6e, 0x6d, 0x0, 0x6e, 0x73, 0x0, 0x6e, 0x300, 0x0, 0x6e, 0x301, 0x0, 0x6e, 0x303, 0x0, 0x6e, 0x307, 0x0, 0x6e, 0x30c, 0x0, 0x6e, 0x323, 0x0, 0x6e, 0x327, 0x0, 0x6e, 0x32d, 0x0, 0x6e, 0x331, 0x0, 0x6f, 0x0, 0x6f, 0x56, 0x0, 0x6f, 0x300, 0x0, 0x6f, 0x301, 0x0, 0x6f, 0x302, 0x0, 0x6f, 0x302, 0x300, 0x0, 0x6f, 0x302, 0x301, 0x0, 0x6f, 0x302, 0x303, 0x0, 0x6f, 0x302, 0x309, 0x0, 0x6f, 0x303, 0x0, 0x6f, 0x303, 0x301, 0x0, 0x6f, 0x303, 0x304, 0x0, 0x6f, 0x303, 0x308, 0x0, 0x6f, 0x304, 0x0, 0x6f, 0x304, 0x300, 0x0, 0x6f, 0x304, 0x301, 0x0, 0x6f, 0x306, 0x0, 0x6f, 0x307, 0x0, 0x6f, 0x307, 0x304, 0x0, 0x6f, 0x308, 0x0, 0x6f, 0x308, 0x304, 0x0, 0x6f, 0x309, 0x0, 0x6f, 0x30b, 0x0, 0x6f, 0x30c, 0x0, 0x6f, 0x30f, 0x0, 0x6f, 0x311, 0x0, 0x6f, 0x31b, 0x0, 0x6f, 0x31b, 0x300, 0x0, 0x6f, 0x31b, 0x301, 0x0, 0x6f, 0x31b, 0x303, 0x0, 0x6f, 0x31b, 0x309, 0x0, 0x6f, 0x31b, 0x323, 0x0, 0x6f, 0x323, 0x0, 0x6f, 0x323, 0x302, 0x0, 0x6f, 0x328, 0x0, 0x6f, 0x328, 0x304, 0x0, 0x70, 0x0, 0x70, 0x2e, 0x6d, 0x2e, 0x0, 0x70, 0x41, 0x0, 0x70, 0x46, 0x0, 0x70, 0x56, 0x0, 0x70, 0x57, 0x0, 0x70, 0x63, 0x0, 0x70, 0x73, 0x0, 0x70, 0x301, 0x0, 0x70, 0x307, 0x0, 0x71, 0x0, 0x72, 0x0, 0x72, 0x61, 0x64, 0x0, 0x72, 0x61, 0x64, 0x2215, 0x73, 0x0, 0x72, 0x61, 0x64, 0x2215, 0x73, 0x32, 0x0, 0x72, 0x301, 0x0, 0x72, 0x307, 0x0, 0x72, 0x30c, 0x0, 0x72, 0x30f, 0x0, 0x72, 0x311, 0x0, 0x72, 0x323, 0x0, 0x72, 0x323, 0x304, 0x0, 0x72, 0x327, 0x0, 0x72, 0x331, 0x0, 0x73, 0x0, 0x73, 0x72, 0x0, 0x73, 0x74, 0x0, 0x73, 0x301, 0x0, 0x73, 0x301, 0x307, 0x0, 0x73, 0x302, 0x0, 0x73, 0x307, 0x0, 0x73, 0x30c, 0x0, 0x73, 0x30c, 0x307, 0x0, 0x73, 0x323, 0x0, 0x73, 0x323, 0x307, 0x0, 0x73, 0x326, 0x0, 0x73, 0x327, 0x0, 0x74, 0x0, 0x74, 0x307, 0x0, 0x74, 0x308, 0x0, 0x74, 0x30c, 0x0, 0x74, 0x323, 0x0, 0x74, 0x326, 0x0, 0x74, 0x327, 0x0, 0x74, 0x32d, 0x0, 0x74, 0x331, 0x0, 0x75, 0x0, 0x75, 0x300, 0x0, 0x75, 0x301, 0x0, 0x75, 0x302, 0x0, 0x75, 0x303, 0x0, 0x75, 0x303, 0x301, 0x0, 0x75, 0x304, 0x0, 0x75, 0x304, 0x308, 0x0, 0x75, 0x306, 0x0, 0x75, 0x308, 0x0, 0x75, 0x308, 0x300, 0x0, 0x75, 0x308, 0x301, 0x0, 0x75, 0x308, 0x304, 0x0, 0x75, 0x308, 0x30c, 0x0, 0x75, 0x309, 0x0, 0x75, 0x30a, 0x0, 0x75, 0x30b, 0x0, 0x75, 0x30c, 0x0, 0x75, 0x30f, 0x0, 0x75, 0x311, 0x0, 0x75, 0x31b, 0x0, 0x75, 0x31b, 0x300, 0x0, 0x75, 0x31b, 0x301, 0x0, 0x75, 0x31b, 0x303, 0x0, 0x75, 0x31b, 0x309, 0x0, 0x75, 0x31b, 0x323, 0x0, 0x75, 0x323, 0x0, 0x75, 0x324, 0x0, 0x75, 0x328, 0x0, 0x75, 0x32d, 0x0, 0x75, 0x330, 0x0, 0x76, 0x0, 0x76, 0x69, 0x0, 0x76, 0x69, 0x69, 0x0, 0x76, 0x69, 0x69, 0x69, 0x0, 0x76, 0x303, 0x0, 0x76, 0x323, 0x0, 0x77, 0x0, 0x77, 0x300, 0x0, 0x77, 0x301, 0x0, 0x77, 0x302, 0x0, 0x77, 0x307, 0x0, 0x77, 0x308, 0x0, 0x77, 0x30a, 0x0, 0x77, 0x323, 0x0, 0x78, 0x0, 0x78, 0x69, 0x0, 0x78, 0x69, 0x69, 0x0, 0x78, 0x307, 0x0, 0x78, 0x308, 0x0, 0x79, 0x0, 0x79, 0x300, 0x0, 0x79, 0x301, 0x0, 0x79, 0x302, 0x0, 0x79, 0x303, 0x0, 0x79, 0x304, 0x0, 0x79, 0x307, 0x0, 0x79, 0x308, 0x0, 0x79, 0x309, 0x0, 0x79, 0x30a, 0x0, 0x79, 0x323, 0x0, 0x7a, 0x0, 0x7a, 0x301, 0x0, 0x7a, 0x302, 0x0, 0x7a, 0x307, 0x0, 0x7a, 0x30c, 0x0, 0x7a, 0x323, 0x0, 0x7a, 0x331, 0x0, 0x7b, 0x0, 0x7c, 0x0, 0x7d, 0x0, 0x7e, 0x0, 0xa2, 0x0, 0xa3, 0x0, 0xa5, 0x0, 0xa6, 0x0, 0xac, 0x0, 0xb0, 0x43, 0x0, 0xb0, 0x46, 0x0, 0xb7, 0x0, 0xc6, 0x0, 0xc6, 0x301, 0x0, 0xc6, 0x304, 0x0, 0xd8, 0x301, 0x0, 0xe6, 0x301, 0x0, 0xe6, 0x304, 0x0, 0xf0, 0x0, 0xf8, 0x301, 0x0, 0x126, 0x0, 0x127, 0x0, 0x131, 0x0, 0x14b, 0x0, 0x153, 0x0, 0x18e, 0x0, 0x190, 0x0, 0x1ab, 0x0, 0x1b7, 0x30c, 0x0, 0x222, 0x0, 0x237, 0x0, 0x250, 0x0, 0x251, 0x0, 0x252, 0x0, 0x254, 0x0, 0x255, 0x0, 0x259, 0x0, 0x25b, 0x0, 0x25c, 0x0, 0x25f, 0x0, 0x261, 0x0, 0x263, 0x0, 0x265, 0x0, 0x266, 0x0, 0x268, 0x0, 0x269, 0x0, 0x26a, 0x0, 0x26d, 0x0, 0x26f, 0x0, 0x270, 0x0, 0x271, 0x0, 0x272, 0x0, 0x273, 0x0, 0x274, 0x0, 0x275, 0x0, 0x278, 0x0, 0x279, 0x0, 0x27b, 0x0, 0x281, 0x0, 0x282, 0x0, 0x283, 0x0, 0x289, 0x0, 0x28a, 0x0, 0x28b, 0x0, 0x28c, 0x0, 0x290, 0x0, 0x291, 0x0, 0x292, 0x0, 0x292, 0x30c, 0x0, 0x295, 0x0, 0x29d, 0x0, 0x29f, 0x0, 0x2b9, 0x0, 0x2bc, 0x6e, 0x0, 0x300, 0x0, 0x301, 0x0, 0x308, 0x301, 0x0, 0x313, 0x0, 0x391, 0x0, 0x391, 0x300, 0x0, 0x391, 0x301, 0x0, 0x391, 0x304, 0x0, 0x391, 0x306, 0x0, 0x391, 0x313, 0x0, 0x391, 0x313, 0x300, 0x0, 0x391, 0x313, 0x300, 0x345, 0x0, 0x391, 0x313, 0x301, 0x0, 0x391, 0x313, 0x301, 0x345, 0x0, 0x391, 0x313, 0x342, 0x0, 0x391, 0x313, 0x342, 0x345, 0x0, 0x391, 0x313, 0x345, 0x0, 0x391, 0x314, 0x0, 0x391, 0x314, 0x300, 0x0, 0x391, 0x314, 0x300, 0x345, 0x0, 0x391, 0x314, 0x301, 0x0, 0x391, 0x314, 0x301, 0x345, 0x0, 0x391, 0x314, 0x342, 0x0, 0x391, 0x314, 0x342, 0x345, 0x0, 0x391, 0x314, 0x345, 0x0, 0x391, 0x345, 0x0, 0x392, 0x0, 0x393, 0x0, 0x394, 0x0, 0x395, 0x0, 0x395, 0x300, 0x0, 0x395, 0x301, 0x0, 0x395, 0x313, 0x0, 0x395, 0x313, 0x300, 0x0, 0x395, 0x313, 0x301, 0x0, 0x395, 0x314, 0x0, 0x395, 0x314, 0x300, 0x0, 0x395, 0x314, 0x301, 0x0, 0x396, 0x0, 0x397, 0x0, 0x397, 0x300, 0x0, 0x397, 0x301, 0x0, 0x397, 0x313, 0x0, 0x397, 0x313, 0x300, 0x0, 0x397, 0x313, 0x300, 0x345, 0x0, 0x397, 0x313, 0x301, 0x0, 0x397, 0x313, 0x301, 0x345, 0x0, 0x397, 0x313, 0x342, 0x0, 0x397, 0x313, 0x342, 0x345, 0x0, 0x397, 0x313, 0x345, 0x0, 0x397, 0x314, 0x0, 0x397, 0x314, 0x300, 0x0, 0x397, 0x314, 0x300, 0x345, 0x0, 0x397, 0x314, 0x301, 0x0, 0x397, 0x314, 0x301, 0x345, 0x0, 0x397, 0x314, 0x342, 0x0, 0x397, 0x314, 0x342, 0x345, 0x0, 0x397, 0x314, 0x345, 0x0, 0x397, 0x345, 0x0, 0x398, 0x0, 0x399, 0x0, 0x399, 0x300, 0x0, 0x399, 0x301, 0x0, 0x399, 0x304, 0x0, 0x399, 0x306, 0x0, 0x399, 0x308, 0x0, 0x399, 0x313, 0x0, 0x399, 0x313, 0x300, 0x0, 0x399, 0x313, 0x301, 0x0, 0x399, 0x313, 0x342, 0x0, 0x399, 0x314, 0x0, 0x399, 0x314, 0x300, 0x0, 0x399, 0x314, 0x301, 0x0, 0x399, 0x314, 0x342, 0x0, 0x39a, 0x0, 0x39b, 0x0, 0x39c, 0x0, 0x39d, 0x0, 0x39e, 0x0, 0x39f, 0x0, 0x39f, 0x300, 0x0, 0x39f, 0x301, 0x0, 0x39f, 0x313, 0x0, 0x39f, 0x313, 0x300, 0x0, 0x39f, 0x313, 0x301, 0x0, 0x39f, 0x314, 0x0, 0x39f, 0x314, 0x300, 0x0, 0x39f, 0x314, 0x301, 0x0, 0x3a0, 0x0, 0x3a1, 0x0, 0x3a1, 0x314, 0x0, 0x3a3, 0x0, 0x3a4, 0x0, 0x3a5, 0x0, 0x3a5, 0x300, 0x0, 0x3a5, 0x301, 0x0, 0x3a5, 0x304, 0x0, 0x3a5, 0x306, 0x0, 0x3a5, 0x308, 0x0, 0x3a5, 0x314, 0x0, 0x3a5, 0x314, 0x300, 0x0, 0x3a5, 0x314, 0x301, 0x0, 0x3a5, 0x314, 0x342, 0x0, 0x3a6, 0x0, 0x3a7, 0x0, 0x3a8, 0x0, 0x3a9, 0x0, 0x3a9, 0x300, 0x0, 0x3a9, 0x301, 0x0, 0x3a9, 0x313, 0x0, 0x3a9, 0x313, 0x300, 0x0, 0x3a9, 0x313, 0x300, 0x345, 0x0, 0x3a9, 0x313, 0x301, 0x0, 0x3a9, 0x313, 0x301, 0x345, 0x0, 0x3a9, 0x313, 0x342, 0x0, 0x3a9, 0x313, 0x342, 0x345, 0x0, 0x3a9, 0x313, 0x345, 0x0, 0x3a9, 0x314, 0x0, 0x3a9, 0x314, 0x300, 0x0, 0x3a9, 0x314, 0x300, 0x345, 0x0, 0x3a9, 0x314, 0x301, 0x0, 0x3a9, 0x314, 0x301, 0x345, 0x0, 0x3a9, 0x314, 0x342, 0x0, 0x3a9, 0x314, 0x342, 0x345, 0x0, 0x3a9, 0x314, 0x345, 0x0, 0x3a9, 0x345, 0x0, 0x3b1, 0x0, 0x3b1, 0x300, 0x0, 0x3b1, 0x300, 0x345, 0x0, 0x3b1, 0x301, 0x0, 0x3b1, 0x301, 0x345, 0x0, 0x3b1, 0x304, 0x0, 0x3b1, 0x306, 0x0, 0x3b1, 0x313, 0x0, 0x3b1, 0x313, 0x300, 0x0, 0x3b1, 0x313, 0x300, 0x345, 0x0, 0x3b1, 0x313, 0x301, 0x0, 0x3b1, 0x313, 0x301, 0x345, 0x0, 0x3b1, 0x313, 0x342, 0x0, 0x3b1, 0x313, 0x342, 0x345, 0x0, 0x3b1, 0x313, 0x345, 0x0, 0x3b1, 0x314, 0x0, 0x3b1, 0x314, 0x300, 0x0, 0x3b1, 0x314, 0x300, 0x345, 0x0, 0x3b1, 0x314, 0x301, 0x0, 0x3b1, 0x314, 0x301, 0x345, 0x0, 0x3b1, 0x314, 0x342, 0x0, 0x3b1, 0x314, 0x342, 0x345, 0x0, 0x3b1, 0x314, 0x345, 0x0, 0x3b1, 0x342, 0x0, 0x3b1, 0x342, 0x345, 0x0, 0x3b1, 0x345, 0x0, 0x3b2, 0x0, 0x3b3, 0x0, 0x3b4, 0x0, 0x3b5, 0x0, 0x3b5, 0x300, 0x0, 0x3b5, 0x301, 0x0, 0x3b5, 0x313, 0x0, 0x3b5, 0x313, 0x300, 0x0, 0x3b5, 0x313, 0x301, 0x0, 0x3b5, 0x314, 0x0, 0x3b5, 0x314, 0x300, 0x0, 0x3b5, 0x314, 0x301, 0x0, 0x3b6, 0x0, 0x3b7, 0x0, 0x3b7, 0x300, 0x0, 0x3b7, 0x300, 0x345, 0x0, 0x3b7, 0x301, 0x0, 0x3b7, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x0, 0x3b7, 0x313, 0x300, 0x0, 0x3b7, 0x313, 0x300, 0x345, 0x0, 0x3b7, 0x313, 0x301, 0x0, 0x3b7, 0x313, 0x301, 0x345, 0x0, 0x3b7, 0x313, 0x342, 0x0, 0x3b7, 0x313, 0x342, 0x345, 0x0, 0x3b7, 0x313, 0x345, 0x0, 0x3b7, 0x314, 0x0, 0x3b7, 0x314, 0x300, 0x0, 0x3b7, 0x314, 0x300, 0x345, 0x0, 0x3b7, 0x314, 0x301, 0x0, 0x3b7, 0x314, 0x301, 0x345, 0x0, 0x3b7, 0x314, 0x342, 0x0, 0x3b7, 0x314, 0x342, 0x345, 0x0, 0x3b7, 0x314, 0x345, 0x0, 0x3b7, 0x342, 0x0, 0x3b7, 0x342, 0x345, 0x0, 0x3b7, 0x345, 0x0, 0x3b8, 0x0, 0x3b9, 0x0, 0x3b9, 0x300, 0x0, 0x3b9, 0x301, 0x0, 0x3b9, 0x304, 0x0, 0x3b9, 0x306, 0x0, 0x3b9, 0x308, 0x0, 0x3b9, 0x308, 0x300, 0x0, 0x3b9, 0x308, 0x301, 0x0, 0x3b9, 0x308, 0x342, 0x0, 0x3b9, 0x313, 0x0, 0x3b9, 0x313, 0x300, 0x0, 0x3b9, 0x313, 0x301, 0x0, 0x3b9, 0x313, 0x342, 0x0, 0x3b9, 0x314, 0x0, 0x3b9, 0x314, 0x300, 0x0, 0x3b9, 0x314, 0x301, 0x0, 0x3b9, 0x314, 0x342, 0x0, 0x3b9, 0x342, 0x0, 0x3ba, 0x0, 0x3bb, 0x0, 0x3bc, 0x0, 0x3bc, 0x41, 0x0, 0x3bc, 0x46, 0x0, 0x3bc, 0x56, 0x0, 0x3bc, 0x57, 0x0, 0x3bc, 0x67, 0x0, 0x3bc, 0x6c, 0x0, 0x3bc, 0x6d, 0x0, 0x3bc, 0x73, 0x0, 0x3bd, 0x0, 0x3be, 0x0, 0x3bf, 0x0, 0x3bf, 0x300, 0x0, 0x3bf, 0x301, 0x0, 0x3bf, 0x313, 0x0, 0x3bf, 0x313, 0x300, 0x0, 0x3bf, 0x313, 0x301, 0x0, 0x3bf, 0x314, 0x0, 0x3bf, 0x314, 0x300, 0x0, 0x3bf, 0x314, 0x301, 0x0, 0x3c0, 0x0, 0x3c1, 0x0, 0x3c1, 0x313, 0x0, 0x3c1, 0x314, 0x0, 0x3c2, 0x0, 0x3c3, 0x0, 0x3c4, 0x0, 0x3c5, 0x0, 0x3c5, 0x300, 0x0, 0x3c5, 0x301, 0x0, 0x3c5, 0x304, 0x0, 0x3c5, 0x306, 0x0, 0x3c5, 0x308, 0x0, 0x3c5, 0x308, 0x300, 0x0, 0x3c5, 0x308, 0x301, 0x0, 0x3c5, 0x308, 0x342, 0x0, 0x3c5, 0x313, 0x0, 0x3c5, 0x313, 0x300, 0x0, 0x3c5, 0x313, 0x301, 0x0, 0x3c5, 0x313, 0x342, 0x0, 0x3c5, 0x314, 0x0, 0x3c5, 0x314, 0x300, 0x0, 0x3c5, 0x314, 0x301, 0x0, 0x3c5, 0x314, 0x342, 0x0, 0x3c5, 0x342, 0x0, 0x3c6, 0x0, 0x3c7, 0x0, 0x3c8, 0x0, 0x3c9, 0x0, 0x3c9, 0x300, 0x0, 0x3c9, 0x300, 0x345, 0x0, 0x3c9, 0x301, 0x0, 0x3c9, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x0, 0x3c9, 0x313, 0x300, 0x0, 0x3c9, 0x313, 0x300, 0x345, 0x0, 0x3c9, 0x313, 0x301, 0x0, 0x3c9, 0x313, 0x301, 0x345, 0x0, 0x3c9, 0x313, 0x342, 0x0, 0x3c9, 0x313, 0x342, 0x345, 0x0, 0x3c9, 0x313, 0x345, 0x0, 0x3c9, 0x314, 0x0, 0x3c9, 0x314, 0x300, 0x0, 0x3c9, 0x314, 0x300, 0x345, 0x0, 0x3c9, 0x314, 0x301, 0x0, 0x3c9, 0x314, 0x301, 0x345, 0x0, 0x3c9, 0x314, 0x342, 0x0, 0x3c9, 0x314, 0x342, 0x345, 0x0, 0x3c9, 0x314, 0x345, 0x0, 0x3c9, 0x342, 0x0, 0x3c9, 0x342, 0x345, 0x0, 0x3c9, 0x345, 0x0, 0x3dc, 0x0, 0x3dd, 0x0, 0x406, 0x308, 0x0, 0x410, 0x306, 0x0, 0x410, 0x308, 0x0, 0x413, 0x301, 0x0, 0x415, 0x300, 0x0, 0x415, 0x306, 0x0, 0x415, 0x308, 0x0, 0x416, 0x306, 0x0, 0x416, 0x308, 0x0, 0x417, 0x308, 0x0, 0x418, 0x300, 0x0, 0x418, 0x304, 0x0, 0x418, 0x306, 0x0, 0x418, 0x308, 0x0, 0x41a, 0x301, 0x0, 0x41e, 0x308, 0x0, 0x423, 0x304, 0x0, 0x423, 0x306, 0x0, 0x423, 0x308, 0x0, 0x423, 0x30b, 0x0, 0x427, 0x308, 0x0, 0x42b, 0x308, 0x0, 0x42d, 0x308, 0x0, 0x430, 0x306, 0x0, 0x430, 0x308, 0x0, 0x433, 0x301, 0x0, 0x435, 0x300, 0x0, 0x435, 0x306, 0x0, 0x435, 0x308, 0x0, 0x436, 0x306, 0x0, 0x436, 0x308, 0x0, 0x437, 0x308, 0x0, 0x438, 0x300, 0x0, 0x438, 0x304, 0x0, 0x438, 0x306, 0x0, 0x438, 0x308, 0x0, 0x43a, 0x301, 0x0, 0x43d, 0x0, 0x43e, 0x308, 0x0, 0x443, 0x304, 0x0, 0x443, 0x306, 0x0, 0x443, 0x308, 0x0, 0x443, 0x30b, 0x0, 0x447, 0x308, 0x0, 0x44b, 0x308, 0x0, 0x44d, 0x308, 0x0, 0x456, 0x308, 0x0, 0x474, 0x30f, 0x0, 0x475, 0x30f, 0x0, 0x4d8, 0x308, 0x0, 0x4d9, 0x308, 0x0, 0x4e8, 0x308, 0x0, 0x4e9, 0x308, 0x0, 0x565, 0x582, 0x0, 0x574, 0x565, 0x0, 0x574, 0x56b, 0x0, 0x574, 0x56d, 0x0, 0x574, 0x576, 0x0, 0x57e, 0x576, 0x0, 0x5d0, 0x0, 0x5d0, 0x5b7, 0x0, 0x5d0, 0x5b8, 0x0, 0x5d0, 0x5bc, 0x0, 0x5d0, 0x5dc, 0x0, 0x5d1, 0x0, 0x5d1, 0x5bc, 0x0, 0x5d1, 0x5bf, 0x0, 0x5d2, 0x0, 0x5d2, 0x5bc, 0x0, 0x5d3, 0x0, 0x5d3, 0x5bc, 0x0, 0x5d4, 0x0, 0x5d4, 0x5bc, 0x0, 0x5d5, 0x5b9, 0x0, 0x5d5, 0x5bc, 0x0, 0x5d6, 0x5bc, 0x0, 0x5d8, 0x5bc, 0x0, 0x5d9, 0x5b4, 0x0, 0x5d9, 0x5bc, 0x0, 0x5da, 0x5bc, 0x0, 0x5db, 0x0, 0x5db, 0x5bc, 0x0, 0x5db, 0x5bf, 0x0, 0x5dc, 0x0, 0x5dc, 0x5bc, 0x0, 0x5dd, 0x0, 0x5de, 0x5bc, 0x0, 0x5e0, 0x5bc, 0x0, 0x5e1, 0x5bc, 0x0, 0x5e2, 0x0, 0x5e3, 0x5bc, 0x0, 0x5e4, 0x5bc, 0x0, 0x5e4, 0x5bf, 0x0, 0x5e6, 0x5bc, 0x0, 0x5e7, 0x5bc, 0x0, 0x5e8, 0x0, 0x5e8, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x0, 0x5e9, 0x5bc, 0x5c1, 0x0, 0x5e9, 0x5bc, 0x5c2, 0x0, 0x5e9, 0x5c1, 0x0, 0x5e9, 0x5c2, 0x0, 0x5ea, 0x0, 0x5ea, 0x5bc, 0x0, 0x5f2, 0x5b7, 0x0, 0x621, 0x0, 0x627, 0x0, 0x627, 0x643, 0x628, 0x631, 0x0, 0x627, 0x644, 0x644, 0x647, 0x0, 0x627, 0x64b, 0x0, 0x627, 0x653, 0x0, 0x627, 0x654, 0x0, 0x627, 0x655, 0x0, 0x627, 0x674, 0x0, 0x628, 0x0, 0x628, 0x62c, 0x0, 0x628, 0x62d, 0x0, 0x628, 0x62d, 0x64a, 0x0, 0x628, 0x62e, 0x0, 0x628, 0x62e, 0x64a, 0x0, 0x628, 0x631, 0x0, 0x628, 0x632, 0x0, 0x628, 0x645, 0x0, 0x628, 0x646, 0x0, 0x628, 0x647, 0x0, 0x628, 0x649, 0x0, 0x628, 0x64a, 0x0, 0x629, 0x0, 0x62a, 0x0, 0x62a, 0x62c, 0x0, 0x62a, 0x62c, 0x645, 0x0, 0x62a, 0x62c, 0x649, 0x0, 0x62a, 0x62c, 0x64a, 0x0, 0x62a, 0x62d, 0x0, 0x62a, 0x62d, 0x62c, 0x0, 0x62a, 0x62d, 0x645, 0x0, 0x62a, 0x62e, 0x0, 0x62a, 0x62e, 0x645, 0x0, 0x62a, 0x62e, 0x649, 0x0, 0x62a, 0x62e, 0x64a, 0x0, 0x62a, 0x631, 0x0, 0x62a, 0x632, 0x0, 0x62a, 0x645, 0x0, 0x62a, 0x645, 0x62c, 0x0, 0x62a, 0x645, 0x62d, 0x0, 0x62a, 0x645, 0x62e, 0x0, 0x62a, 0x645, 0x649, 0x0, 0x62a, 0x645, 0x64a, 0x0, 0x62a, 0x646, 0x0, 0x62a, 0x647, 0x0, 0x62a, 0x649, 0x0, 0x62a, 0x64a, 0x0, 0x62b, 0x0, 0x62b, 0x62c, 0x0, 0x62b, 0x631, 0x0, 0x62b, 0x632, 0x0, 0x62b, 0x645, 0x0, 0x62b, 0x646, 0x0, 0x62b, 0x647, 0x0, 0x62b, 0x649, 0x0, 0x62b, 0x64a, 0x0, 0x62c, 0x0, 0x62c, 0x62d, 0x0, 0x62c, 0x62d, 0x649, 0x0, 0x62c, 0x62d, 0x64a, 0x0, 0x62c, 0x644, 0x20, 0x62c, 0x644, 0x627, 0x644, 0x647, 0x0, 0x62c, 0x645, 0x0, 0x62c, 0x645, 0x62d, 0x0, 0x62c, 0x645, 0x649, 0x0, 0x62c, 0x645, 0x64a, 0x0, 0x62c, 0x649, 0x0, 0x62c, 0x64a, 0x0, 0x62d, 0x0, 0x62d, 0x62c, 0x0, 0x62d, 0x62c, 0x64a, 0x0, 0x62d, 0x645, 0x0, 0x62d, 0x645, 0x649, 0x0, 0x62d, 0x645, 0x64a, 0x0, 0x62d, 0x649, 0x0, 0x62d, 0x64a, 0x0, 0x62e, 0x0, 0x62e, 0x62c, 0x0, 0x62e, 0x62d, 0x0, 0x62e, 0x645, 0x0, 0x62e, 0x649, 0x0, 0x62e, 0x64a, 0x0, 0x62f, 0x0, 0x630, 0x0, 0x630, 0x670, 0x0, 0x631, 0x0, 0x631, 0x633, 0x648, 0x644, 0x0, 0x631, 0x670, 0x0, 0x631, 0x6cc, 0x627, 0x644, 0x0, 0x632, 0x0, 0x633, 0x0, 0x633, 0x62c, 0x0, 0x633, 0x62c, 0x62d, 0x0, 0x633, 0x62c, 0x649, 0x0, 0x633, 0x62d, 0x0, 0x633, 0x62d, 0x62c, 0x0, 0x633, 0x62e, 0x0, 0x633, 0x62e, 0x649, 0x0, 0x633, 0x62e, 0x64a, 0x0, 0x633, 0x631, 0x0, 0x633, 0x645, 0x0, 0x633, 0x645, 0x62c, 0x0, 0x633, 0x645, 0x62d, 0x0, 0x633, 0x645, 0x645, 0x0, 0x633, 0x647, 0x0, 0x633, 0x649, 0x0, 0x633, 0x64a, 0x0, 0x634, 0x0, 0x634, 0x62c, 0x0, 0x634, 0x62c, 0x64a, 0x0, 0x634, 0x62d, 0x0, 0x634, 0x62d, 0x645, 0x0, 0x634, 0x62d, 0x64a, 0x0, 0x634, 0x62e, 0x0, 0x634, 0x631, 0x0, 0x634, 0x645, 0x0, 0x634, 0x645, 0x62e, 0x0, 0x634, 0x645, 0x645, 0x0, 0x634, 0x647, 0x0, 0x634, 0x649, 0x0, 0x634, 0x64a, 0x0, 0x635, 0x0, 0x635, 0x62d, 0x0, 0x635, 0x62d, 0x62d, 0x0, 0x635, 0x62d, 0x64a, 0x0, 0x635, 0x62e, 0x0, 0x635, 0x631, 0x0, 0x635, 0x644, 0x639, 0x645, 0x0, 0x635, 0x644, 0x649, 0x0, 0x635, 0x644, 0x649, 0x20, 0x627, 0x644, 0x644, 0x647, 0x20, 0x639, 0x644, 0x64a, 0x647, 0x20, 0x648, 0x633, 0x644, 0x645, 0x0, 0x635, 0x644, 0x6d2, 0x0, 0x635, 0x645, 0x0, 0x635, 0x645, 0x645, 0x0, 0x635, 0x649, 0x0, 0x635, 0x64a, 0x0, 0x636, 0x0, 0x636, 0x62c, 0x0, 0x636, 0x62d, 0x0, 0x636, 0x62d, 0x649, 0x0, 0x636, 0x62d, 0x64a, 0x0, 0x636, 0x62e, 0x0, 0x636, 0x62e, 0x645, 0x0, 0x636, 0x631, 0x0, 0x636, 0x645, 0x0, 0x636, 0x649, 0x0, 0x636, 0x64a, 0x0, 0x637, 0x0, 0x637, 0x62d, 0x0, 0x637, 0x645, 0x0, 0x637, 0x645, 0x62d, 0x0, 0x637, 0x645, 0x645, 0x0, 0x637, 0x645, 0x64a, 0x0, 0x637, 0x649, 0x0, 0x637, 0x64a, 0x0, 0x638, 0x0, 0x638, 0x645, 0x0, 0x639, 0x0, 0x639, 0x62c, 0x0, 0x639, 0x62c, 0x645, 0x0, 0x639, 0x644, 0x64a, 0x647, 0x0, 0x639, 0x645, 0x0, 0x639, 0x645, 0x645, 0x0, 0x639, 0x645, 0x649, 0x0, 0x639, 0x645, 0x64a, 0x0, 0x639, 0x649, 0x0, 0x639, 0x64a, 0x0, 0x63a, 0x0, 0x63a, 0x62c, 0x0, 0x63a, 0x645, 0x0, 0x63a, 0x645, 0x645, 0x0, 0x63a, 0x645, 0x649, 0x0, 0x63a, 0x645, 0x64a, 0x0, 0x63a, 0x649, 0x0, 0x63a, 0x64a, 0x0, 0x640, 0x64b, 0x0, 0x640, 0x64e, 0x0, 0x640, 0x64e, 0x651, 0x0, 0x640, 0x64f, 0x0, 0x640, 0x64f, 0x651, 0x0, 0x640, 0x650, 0x0, 0x640, 0x650, 0x651, 0x0, 0x640, 0x651, 0x0, 0x640, 0x652, 0x0, 0x641, 0x0, 0x641, 0x62c, 0x0, 0x641, 0x62d, 0x0, 0x641, 0x62e, 0x0, 0x641, 0x62e, 0x645, 0x0, 0x641, 0x645, 0x0, 0x641, 0x645, 0x64a, 0x0, 0x641, 0x649, 0x0, 0x641, 0x64a, 0x0, 0x642, 0x0, 0x642, 0x62d, 0x0, 0x642, 0x644, 0x6d2, 0x0, 0x642, 0x645, 0x0, 0x642, 0x645, 0x62d, 0x0, 0x642, 0x645, 0x645, 0x0, 0x642, 0x645, 0x64a, 0x0, 0x642, 0x649, 0x0, 0x642, 0x64a, 0x0, 0x643, 0x0, 0x643, 0x627, 0x0, 0x643, 0x62c, 0x0, 0x643, 0x62d, 0x0, 0x643, 0x62e, 0x0, 0x643, 0x644, 0x0, 0x643, 0x645, 0x0, 0x643, 0x645, 0x645, 0x0, 0x643, 0x645, 0x64a, 0x0, 0x643, 0x649, 0x0, 0x643, 0x64a, 0x0, 0x644, 0x0, 0x644, 0x627, 0x0, 0x644, 0x627, 0x653, 0x0, 0x644, 0x627, 0x654, 0x0, 0x644, 0x627, 0x655, 0x0, 0x644, 0x62c, 0x0, 0x644, 0x62c, 0x62c, 0x0, 0x644, 0x62c, 0x645, 0x0, 0x644, 0x62c, 0x64a, 0x0, 0x644, 0x62d, 0x0, 0x644, 0x62d, 0x645, 0x0, 0x644, 0x62d, 0x649, 0x0, 0x644, 0x62d, 0x64a, 0x0, 0x644, 0x62e, 0x0, 0x644, 0x62e, 0x645, 0x0, 0x644, 0x645, 0x0, 0x644, 0x645, 0x62d, 0x0, 0x644, 0x645, 0x64a, 0x0, 0x644, 0x647, 0x0, 0x644, 0x649, 0x0, 0x644, 0x64a, 0x0, 0x645, 0x0, 0x645, 0x627, 0x0, 0x645, 0x62c, 0x0, 0x645, 0x62c, 0x62d, 0x0, 0x645, 0x62c, 0x62e, 0x0, 0x645, 0x62c, 0x645, 0x0, 0x645, 0x62c, 0x64a, 0x0, 0x645, 0x62d, 0x0, 0x645, 0x62d, 0x62c, 0x0, 0x645, 0x62d, 0x645, 0x0, 0x645, 0x62d, 0x645, 0x62f, 0x0, 0x645, 0x62d, 0x64a, 0x0, 0x645, 0x62e, 0x0, 0x645, 0x62e, 0x62c, 0x0, 0x645, 0x62e, 0x645, 0x0, 0x645, 0x62e, 0x64a, 0x0, 0x645, 0x645, 0x0, 0x645, 0x645, 0x64a, 0x0, 0x645, 0x649, 0x0, 0x645, 0x64a, 0x0, 0x646, 0x0, 0x646, 0x62c, 0x0, 0x646, 0x62c, 0x62d, 0x0, 0x646, 0x62c, 0x645, 0x0, 0x646, 0x62c, 0x649, 0x0, 0x646, 0x62c, 0x64a, 0x0, 0x646, 0x62d, 0x0, 0x646, 0x62d, 0x645, 0x0, 0x646, 0x62d, 0x649, 0x0, 0x646, 0x62d, 0x64a, 0x0, 0x646, 0x62e, 0x0, 0x646, 0x631, 0x0, 0x646, 0x632, 0x0, 0x646, 0x645, 0x0, 0x646, 0x645, 0x649, 0x0, 0x646, 0x645, 0x64a, 0x0, 0x646, 0x646, 0x0, 0x646, 0x647, 0x0, 0x646, 0x649, 0x0, 0x646, 0x64a, 0x0, 0x647, 0x0, 0x647, 0x62c, 0x0, 0x647, 0x645, 0x0, 0x647, 0x645, 0x62c, 0x0, 0x647, 0x645, 0x645, 0x0, 0x647, 0x649, 0x0, 0x647, 0x64a, 0x0, 0x647, 0x670, 0x0, 0x648, 0x0, 0x648, 0x633, 0x644, 0x645, 0x0, 0x648, 0x654, 0x0, 0x648, 0x674, 0x0, 0x649, 0x0, 0x649, 0x670, 0x0, 0x64a, 0x0, 0x64a, 0x62c, 0x0, 0x64a, 0x62c, 0x64a, 0x0, 0x64a, 0x62d, 0x0, 0x64a, 0x62d, 0x64a, 0x0, 0x64a, 0x62e, 0x0, 0x64a, 0x631, 0x0, 0x64a, 0x632, 0x0, 0x64a, 0x645, 0x0, 0x64a, 0x645, 0x645, 0x0, 0x64a, 0x645, 0x64a, 0x0, 0x64a, 0x646, 0x0, 0x64a, 0x647, 0x0, 0x64a, 0x649, 0x0, 0x64a, 0x64a, 0x0, 0x64a, 0x654, 0x0, 0x64a, 0x654, 0x627, 0x0, 0x64a, 0x654, 0x62c, 0x0, 0x64a, 0x654, 0x62d, 0x0, 0x64a, 0x654, 0x62e, 0x0, 0x64a, 0x654, 0x631, 0x0, 0x64a, 0x654, 0x632, 0x0, 0x64a, 0x654, 0x645, 0x0, 0x64a, 0x654, 0x646, 0x0, 0x64a, 0x654, 0x647, 0x0, 0x64a, 0x654, 0x648, 0x0, 0x64a, 0x654, 0x649, 0x0, 0x64a, 0x654, 0x64a, 0x0, 0x64a, 0x654, 0x6c6, 0x0, 0x64a, 0x654, 0x6c7, 0x0, 0x64a, 0x654, 0x6c8, 0x0, 0x64a, 0x654, 0x6d0, 0x0, 0x64a, 0x654, 0x6d5, 0x0, 0x64a, 0x674, 0x0, 0x66e, 0x0, 0x66f, 0x0, 0x671, 0x0, 0x679, 0x0, 0x67a, 0x0, 0x67b, 0x0, 0x67e, 0x0, 0x67f, 0x0, 0x680, 0x0, 0x683, 0x0, 0x684, 0x0, 0x686, 0x0, 0x687, 0x0, 0x688, 0x0, 0x68c, 0x0, 0x68d, 0x0, 0x68e, 0x0, 0x691, 0x0, 0x698, 0x0, 0x6a1, 0x0, 0x6a4, 0x0, 0x6a6, 0x0, 0x6a9, 0x0, 0x6ad, 0x0, 0x6af, 0x0, 0x6b1, 0x0, 0x6b3, 0x0, 0x6ba, 0x0, 0x6bb, 0x0, 0x6be, 0x0, 0x6c1, 0x0, 0x6c1, 0x654, 0x0, 0x6c5, 0x0, 0x6c6, 0x0, 0x6c7, 0x0, 0x6c7, 0x674, 0x0, 0x6c8, 0x0, 0x6c9, 0x0, 0x6cb, 0x0, 0x6cc, 0x0, 0x6d0, 0x0, 0x6d2, 0x0, 0x6d2, 0x654, 0x0, 0x6d5, 0x654, 0x0, 0x915, 0x93c, 0x0, 0x916, 0x93c, 0x0, 0x917, 0x93c, 0x0, 0x91c, 0x93c, 0x0, 0x921, 0x93c, 0x0, 0x922, 0x93c, 0x0, 0x928, 0x93c, 0x0, 0x92b, 0x93c, 0x0, 0x92f, 0x93c, 0x0, 0x930, 0x93c, 0x0, 0x933, 0x93c, 0x0, 0x9a1, 0x9bc, 0x0, 0x9a2, 0x9bc, 0x0, 0x9af, 0x9bc, 0x0, 0x9c7, 0x9be, 0x0, 0x9c7, 0x9d7, 0x0, 0xa16, 0xa3c, 0x0, 0xa17, 0xa3c, 0x0, 0xa1c, 0xa3c, 0x0, 0xa2b, 0xa3c, 0x0, 0xa32, 0xa3c, 0x0, 0xa38, 0xa3c, 0x0, 0xb21, 0xb3c, 0x0, 0xb22, 0xb3c, 0x0, 0xb47, 0xb3e, 0x0, 0xb47, 0xb56, 0x0, 0xb47, 0xb57, 0x0, 0xb92, 0xbd7, 0x0, 0xbc6, 0xbbe, 0x0, 0xbc6, 0xbd7, 0x0, 0xbc7, 0xbbe, 0x0, 0xc46, 0xc56, 0x0, 0xcbf, 0xcd5, 0x0, 0xcc6, 0xcc2, 0x0, 0xcc6, 0xcc2, 0xcd5, 0x0, 0xcc6, 0xcd5, 0x0, 0xcc6, 0xcd6, 0x0, 0xd46, 0xd3e, 0x0, 0xd46, 0xd57, 0x0, 0xd47, 0xd3e, 0x0, 0xdd9, 0xdca, 0x0, 0xdd9, 0xdcf, 0x0, 0xdd9, 0xdcf, 0xdca, 0x0, 0xdd9, 0xddf, 0x0, 0xe4d, 0xe32, 0x0, 0xeab, 0xe99, 0x0, 0xeab, 0xea1, 0x0, 0xecd, 0xeb2, 0x0, 0xf0b, 0x0, 0xf40, 0xfb5, 0x0, 0xf42, 0xfb7, 0x0, 0xf4c, 0xfb7, 0x0, 0xf51, 0xfb7, 0x0, 0xf56, 0xfb7, 0x0, 0xf5b, 0xfb7, 0x0, 0xf71, 0xf72, 0x0, 0xf71, 0xf74, 0x0, 0xf71, 0xf80, 0x0, 0xf90, 0xfb5, 0x0, 0xf92, 0xfb7, 0x0, 0xf9c, 0xfb7, 0x0, 0xfa1, 0xfb7, 0x0, 0xfa6, 0xfb7, 0x0, 0xfab, 0xfb7, 0x0, 0xfb2, 0xf71, 0xf80, 0x0, 0xfb2, 0xf80, 0x0, 0xfb3, 0xf71, 0xf80, 0x0, 0xfb3, 0xf80, 0x0, 0x1025, 0x102e, 0x0, 0x10dc, 0x0, 0x1100, 0x0, 0x1100, 0x1161, 0x0, 0x1101, 0x0, 0x1102, 0x0, 0x1102, 0x1161, 0x0, 0x1103, 0x0, 0x1103, 0x1161, 0x0, 0x1104, 0x0, 0x1105, 0x0, 0x1105, 0x1161, 0x0, 0x1106, 0x0, 0x1106, 0x1161, 0x0, 0x1107, 0x0, 0x1107, 0x1161, 0x0, 0x1108, 0x0, 0x1109, 0x0, 0x1109, 0x1161, 0x0, 0x110a, 0x0, 0x110b, 0x0, 0x110b, 0x1161, 0x0, 0x110b, 0x116e, 0x0, 0x110c, 0x0, 0x110c, 0x1161, 0x0, 0x110c, 0x116e, 0x110b, 0x1174, 0x0, 0x110d, 0x0, 0x110e, 0x0, 0x110e, 0x1161, 0x0, 0x110e, 0x1161, 0x11b7, 0x1100, 0x1169, 0x0, 0x110f, 0x0, 0x110f, 0x1161, 0x0, 0x1110, 0x0, 0x1110, 0x1161, 0x0, 0x1111, 0x0, 0x1111, 0x1161, 0x0, 0x1112, 0x0, 0x1112, 0x1161, 0x0, 0x1114, 0x0, 0x1115, 0x0, 0x111a, 0x0, 0x111c, 0x0, 0x111d, 0x0, 0x111e, 0x0, 0x1120, 0x0, 0x1121, 0x0, 0x1122, 0x0, 0x1123, 0x0, 0x1127, 0x0, 0x1129, 0x0, 0x112b, 0x0, 0x112c, 0x0, 0x112d, 0x0, 0x112e, 0x0, 0x112f, 0x0, 0x1132, 0x0, 0x1136, 0x0, 0x1140, 0x0, 0x1147, 0x0, 0x114c, 0x0, 0x1157, 0x0, 0x1158, 0x0, 0x1159, 0x0, 0x1160, 0x0, 0x1161, 0x0, 0x1162, 0x0, 0x1163, 0x0, 0x1164, 0x0, 0x1165, 0x0, 0x1166, 0x0, 0x1167, 0x0, 0x1168, 0x0, 0x1169, 0x0, 0x116a, 0x0, 0x116b, 0x0, 0x116c, 0x0, 0x116d, 0x0, 0x116e, 0x0, 0x116f, 0x0, 0x1170, 0x0, 0x1171, 0x0, 0x1172, 0x0, 0x1173, 0x0, 0x1174, 0x0, 0x1175, 0x0, 0x1184, 0x0, 0x1185, 0x0, 0x1188, 0x0, 0x1191, 0x0, 0x1192, 0x0, 0x1194, 0x0, 0x119e, 0x0, 0x11a1, 0x0, 0x11aa, 0x0, 0x11ac, 0x0, 0x11ad, 0x0, 0x11b0, 0x0, 0x11b1, 0x0, 0x11b2, 0x0, 0x11b3, 0x0, 0x11b4, 0x0, 0x11b5, 0x0, 0x11c7, 0x0, 0x11c8, 0x0, 0x11cc, 0x0, 0x11ce, 0x0, 0x11d3, 0x0, 0x11d7, 0x0, 0x11d9, 0x0, 0x11dd, 0x0, 0x11df, 0x0, 0x11f1, 0x0, 0x11f2, 0x0, 0x1b05, 0x1b35, 0x0, 0x1b07, 0x1b35, 0x0, 0x1b09, 0x1b35, 0x0, 0x1b0b, 0x1b35, 0x0, 0x1b0d, 0x1b35, 0x0, 0x1b11, 0x1b35, 0x0, 0x1b3a, 0x1b35, 0x0, 0x1b3c, 0x1b35, 0x0, 0x1b3e, 0x1b35, 0x0, 0x1b3f, 0x1b35, 0x0, 0x1b42, 0x1b35, 0x0, 0x1d02, 0x0, 0x1d16, 0x0, 0x1d17, 0x0, 0x1d1c, 0x0, 0x1d1d, 0x0, 0x1d25, 0x0, 0x1d7b, 0x0, 0x1d85, 0x0, 0x2010, 0x0, 0x2013, 0x0, 0x2014, 0x0, 0x2032, 0x2032, 0x0, 0x2032, 0x2032, 0x2032, 0x0, 0x2032, 0x2032, 0x2032, 0x2032, 0x0, 0x2035, 0x2035, 0x0, 0x2035, 0x2035, 0x2035, 0x0, 0x20a9, 0x0, 0x2190, 0x0, 0x2190, 0x338, 0x0, 0x2191, 0x0, 0x2192, 0x0, 0x2192, 0x338, 0x0, 0x2193, 0x0, 0x2194, 0x338, 0x0, 0x21d0, 0x338, 0x0, 0x21d2, 0x338, 0x0, 0x21d4, 0x338, 0x0, 0x2202, 0x0, 0x2203, 0x338, 0x0, 0x2207, 0x0, 0x2208, 0x338, 0x0, 0x220b, 0x338, 0x0, 0x2211, 0x0, 0x2212, 0x0, 0x2223, 0x338, 0x0, 0x2225, 0x338, 0x0, 0x222b, 0x222b, 0x0, 0x222b, 0x222b, 0x222b, 0x0, 0x222b, 0x222b, 0x222b, 0x222b, 0x0, 0x222e, 0x222e, 0x0, 0x222e, 0x222e, 0x222e, 0x0, 0x223c, 0x338, 0x0, 0x2243, 0x338, 0x0, 0x2245, 0x338, 0x0, 0x2248, 0x338, 0x0, 0x224d, 0x338, 0x0, 0x2261, 0x338, 0x0, 0x2264, 0x338, 0x0, 0x2265, 0x338, 0x0, 0x2272, 0x338, 0x0, 0x2273, 0x338, 0x0, 0x2276, 0x338, 0x0, 0x2277, 0x338, 0x0, 0x227a, 0x338, 0x0, 0x227b, 0x338, 0x0, 0x227c, 0x338, 0x0, 0x227d, 0x338, 0x0, 0x2282, 0x338, 0x0, 0x2283, 0x338, 0x0, 0x2286, 0x338, 0x0, 0x2287, 0x338, 0x0, 0x2291, 0x338, 0x0, 0x2292, 0x338, 0x0, 0x22a2, 0x338, 0x0, 0x22a8, 0x338, 0x0, 0x22a9, 0x338, 0x0, 0x22ab, 0x338, 0x0, 0x22b2, 0x338, 0x0, 0x22b3, 0x338, 0x0, 0x22b4, 0x338, 0x0, 0x22b5, 0x338, 0x0, 0x2502, 0x0, 0x25a0, 0x0, 0x25cb, 0x0, 0x2985, 0x0, 0x2986, 0x0, 0x2add, 0x338, 0x0, 0x2d61, 0x0, 0x3001, 0x0, 0x3002, 0x0, 0x3008, 0x0, 0x3009, 0x0, 0x300a, 0x0, 0x300b, 0x0, 0x300c, 0x0, 0x300d, 0x0, 0x300e, 0x0, 0x300f, 0x0, 0x3010, 0x0, 0x3011, 0x0, 0x3012, 0x0, 0x3014, 0x0, 0x3014, 0x53, 0x3015, 0x0, 0x3014, 0x4e09, 0x3015, 0x0, 0x3014, 0x4e8c, 0x3015, 0x0, 0x3014, 0x52dd, 0x3015, 0x0, 0x3014, 0x5b89, 0x3015, 0x0, 0x3014, 0x6253, 0x3015, 0x0, 0x3014, 0x6557, 0x3015, 0x0, 0x3014, 0x672c, 0x3015, 0x0, 0x3014, 0x70b9, 0x3015, 0x0, 0x3014, 0x76d7, 0x3015, 0x0, 0x3015, 0x0, 0x3016, 0x0, 0x3017, 0x0, 0x3046, 0x3099, 0x0, 0x304b, 0x3099, 0x0, 0x304d, 0x3099, 0x0, 0x304f, 0x3099, 0x0, 0x3051, 0x3099, 0x0, 0x3053, 0x3099, 0x0, 0x3055, 0x3099, 0x0, 0x3057, 0x3099, 0x0, 0x3059, 0x3099, 0x0, 0x305b, 0x3099, 0x0, 0x305d, 0x3099, 0x0, 0x305f, 0x3099, 0x0, 0x3061, 0x3099, 0x0, 0x3064, 0x3099, 0x0, 0x3066, 0x3099, 0x0, 0x3068, 0x3099, 0x0, 0x306f, 0x3099, 0x0, 0x306f, 0x309a, 0x0, 0x3072, 0x3099, 0x0, 0x3072, 0x309a, 0x0, 0x3075, 0x3099, 0x0, 0x3075, 0x309a, 0x0, 0x3078, 0x3099, 0x0, 0x3078, 0x309a, 0x0, 0x307b, 0x304b, 0x0, 0x307b, 0x3099, 0x0, 0x307b, 0x309a, 0x0, 0x3088, 0x308a, 0x0, 0x3099, 0x0, 0x309a, 0x0, 0x309d, 0x3099, 0x0, 0x30a1, 0x0, 0x30a2, 0x0, 0x30a2, 0x30cf, 0x309a, 0x30fc, 0x30c8, 0x0, 0x30a2, 0x30eb, 0x30d5, 0x30a1, 0x0, 0x30a2, 0x30f3, 0x30d8, 0x309a, 0x30a2, 0x0, 0x30a2, 0x30fc, 0x30eb, 0x0, 0x30a3, 0x0, 0x30a4, 0x0, 0x30a4, 0x30cb, 0x30f3, 0x30af, 0x3099, 0x0, 0x30a4, 0x30f3, 0x30c1, 0x0, 0x30a5, 0x0, 0x30a6, 0x0, 0x30a6, 0x3099, 0x0, 0x30a6, 0x30a9, 0x30f3, 0x0, 0x30a7, 0x0, 0x30a8, 0x0, 0x30a8, 0x30b9, 0x30af, 0x30fc, 0x30c8, 0x3099, 0x0, 0x30a8, 0x30fc, 0x30ab, 0x30fc, 0x0, 0x30a9, 0x0, 0x30aa, 0x0, 0x30aa, 0x30f3, 0x30b9, 0x0, 0x30aa, 0x30fc, 0x30e0, 0x0, 0x30ab, 0x0, 0x30ab, 0x3099, 0x0, 0x30ab, 0x3099, 0x30ed, 0x30f3, 0x0, 0x30ab, 0x3099, 0x30f3, 0x30de, 0x0, 0x30ab, 0x30a4, 0x30ea, 0x0, 0x30ab, 0x30e9, 0x30c3, 0x30c8, 0x0, 0x30ab, 0x30ed, 0x30ea, 0x30fc, 0x0, 0x30ad, 0x0, 0x30ad, 0x3099, 0x0, 0x30ad, 0x3099, 0x30ab, 0x3099, 0x0, 0x30ad, 0x3099, 0x30cb, 0x30fc, 0x0, 0x30ad, 0x3099, 0x30eb, 0x30bf, 0x3099, 0x30fc, 0x0, 0x30ad, 0x30e5, 0x30ea, 0x30fc, 0x0, 0x30ad, 0x30ed, 0x0, 0x30ad, 0x30ed, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x0, 0x30ad, 0x30ed, 0x30e1, 0x30fc, 0x30c8, 0x30eb, 0x0, 0x30ad, 0x30ed, 0x30ef, 0x30c3, 0x30c8, 0x0, 0x30af, 0x0, 0x30af, 0x3099, 0x0, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x0, 0x30af, 0x3099, 0x30e9, 0x30e0, 0x30c8, 0x30f3, 0x0, 0x30af, 0x30eb, 0x30bb, 0x3099, 0x30a4, 0x30ed, 0x0, 0x30af, 0x30ed, 0x30fc, 0x30cd, 0x0, 0x30b1, 0x0, 0x30b1, 0x3099, 0x0, 0x30b1, 0x30fc, 0x30b9, 0x0, 0x30b3, 0x0, 0x30b3, 0x3099, 0x0, 0x30b3, 0x30b3, 0x0, 0x30b3, 0x30c8, 0x0, 0x30b3, 0x30eb, 0x30ca, 0x0, 0x30b3, 0x30fc, 0x30db, 0x309a, 0x0, 0x30b5, 0x0, 0x30b5, 0x3099, 0x0, 0x30b5, 0x30a4, 0x30af, 0x30eb, 0x0, 0x30b5, 0x30f3, 0x30c1, 0x30fc, 0x30e0, 0x0, 0x30b7, 0x0, 0x30b7, 0x3099, 0x0, 0x30b7, 0x30ea, 0x30f3, 0x30af, 0x3099, 0x0, 0x30b9, 0x0, 0x30b9, 0x3099, 0x0, 0x30bb, 0x0, 0x30bb, 0x3099, 0x0, 0x30bb, 0x30f3, 0x30c1, 0x0, 0x30bb, 0x30f3, 0x30c8, 0x0, 0x30bd, 0x0, 0x30bd, 0x3099, 0x0, 0x30bf, 0x0, 0x30bf, 0x3099, 0x0, 0x30bf, 0x3099, 0x30fc, 0x30b9, 0x0, 0x30c1, 0x0, 0x30c1, 0x3099, 0x0, 0x30c3, 0x0, 0x30c4, 0x0, 0x30c4, 0x3099, 0x0, 0x30c6, 0x0, 0x30c6, 0x3099, 0x0, 0x30c6, 0x3099, 0x30b7, 0x0, 0x30c8, 0x0, 0x30c8, 0x3099, 0x0, 0x30c8, 0x3099, 0x30eb, 0x0, 0x30c8, 0x30f3, 0x0, 0x30ca, 0x0, 0x30ca, 0x30ce, 0x0, 0x30cb, 0x0, 0x30cc, 0x0, 0x30cd, 0x0, 0x30ce, 0x0, 0x30ce, 0x30c3, 0x30c8, 0x0, 0x30cf, 0x0, 0x30cf, 0x3099, 0x0, 0x30cf, 0x3099, 0x30fc, 0x30ec, 0x30eb, 0x0, 0x30cf, 0x309a, 0x0, 0x30cf, 0x309a, 0x30fc, 0x30bb, 0x30f3, 0x30c8, 0x0, 0x30cf, 0x309a, 0x30fc, 0x30c4, 0x0, 0x30cf, 0x30a4, 0x30c4, 0x0, 0x30d2, 0x0, 0x30d2, 0x3099, 0x0, 0x30d2, 0x3099, 0x30eb, 0x0, 0x30d2, 0x309a, 0x0, 0x30d2, 0x309a, 0x30a2, 0x30b9, 0x30c8, 0x30eb, 0x0, 0x30d2, 0x309a, 0x30af, 0x30eb, 0x0, 0x30d2, 0x309a, 0x30b3, 0x0, 0x30d5, 0x0, 0x30d5, 0x3099, 0x0, 0x30d5, 0x3099, 0x30c3, 0x30b7, 0x30a7, 0x30eb, 0x0, 0x30d5, 0x309a, 0x0, 0x30d5, 0x30a1, 0x30e9, 0x30c3, 0x30c8, 0x3099, 0x0, 0x30d5, 0x30a3, 0x30fc, 0x30c8, 0x0, 0x30d5, 0x30e9, 0x30f3, 0x0, 0x30d8, 0x0, 0x30d8, 0x3099, 0x0, 0x30d8, 0x3099, 0x30fc, 0x30bf, 0x0, 0x30d8, 0x309a, 0x0, 0x30d8, 0x309a, 0x30bd, 0x0, 0x30d8, 0x309a, 0x30cb, 0x30d2, 0x0, 0x30d8, 0x309a, 0x30f3, 0x30b9, 0x0, 0x30d8, 0x309a, 0x30fc, 0x30b7, 0x3099, 0x0, 0x30d8, 0x30af, 0x30bf, 0x30fc, 0x30eb, 0x0, 0x30d8, 0x30eb, 0x30c4, 0x0, 0x30db, 0x0, 0x30db, 0x3099, 0x0, 0x30db, 0x3099, 0x30eb, 0x30c8, 0x0, 0x30db, 0x309a, 0x0, 0x30db, 0x309a, 0x30a4, 0x30f3, 0x30c8, 0x0, 0x30db, 0x309a, 0x30f3, 0x30c8, 0x3099, 0x0, 0x30db, 0x30f3, 0x0, 0x30db, 0x30fc, 0x30eb, 0x0, 0x30db, 0x30fc, 0x30f3, 0x0, 0x30de, 0x0, 0x30de, 0x30a4, 0x30af, 0x30ed, 0x0, 0x30de, 0x30a4, 0x30eb, 0x0, 0x30de, 0x30c3, 0x30cf, 0x0, 0x30de, 0x30eb, 0x30af, 0x0, 0x30de, 0x30f3, 0x30b7, 0x30e7, 0x30f3, 0x0, 0x30df, 0x0, 0x30df, 0x30af, 0x30ed, 0x30f3, 0x0, 0x30df, 0x30ea, 0x0, 0x30df, 0x30ea, 0x30cf, 0x3099, 0x30fc, 0x30eb, 0x0, 0x30e0, 0x0, 0x30e1, 0x0, 0x30e1, 0x30ab, 0x3099, 0x0, 0x30e1, 0x30ab, 0x3099, 0x30c8, 0x30f3, 0x0, 0x30e1, 0x30fc, 0x30c8, 0x30eb, 0x0, 0x30e2, 0x0, 0x30e3, 0x0, 0x30e4, 0x0, 0x30e4, 0x30fc, 0x30c8, 0x3099, 0x0, 0x30e4, 0x30fc, 0x30eb, 0x0, 0x30e5, 0x0, 0x30e6, 0x0, 0x30e6, 0x30a2, 0x30f3, 0x0, 0x30e7, 0x0, 0x30e8, 0x0, 0x30e9, 0x0, 0x30ea, 0x0, 0x30ea, 0x30c3, 0x30c8, 0x30eb, 0x0, 0x30ea, 0x30e9, 0x0, 0x30eb, 0x0, 0x30eb, 0x30d2, 0x309a, 0x30fc, 0x0, 0x30eb, 0x30fc, 0x30d5, 0x3099, 0x30eb, 0x0, 0x30ec, 0x0, 0x30ec, 0x30e0, 0x0, 0x30ec, 0x30f3, 0x30c8, 0x30b1, 0x3099, 0x30f3, 0x0, 0x30ed, 0x0, 0x30ef, 0x0, 0x30ef, 0x3099, 0x0, 0x30ef, 0x30c3, 0x30c8, 0x0, 0x30f0, 0x0, 0x30f0, 0x3099, 0x0, 0x30f1, 0x0, 0x30f1, 0x3099, 0x0, 0x30f2, 0x0, 0x30f2, 0x3099, 0x0, 0x30f3, 0x0, 0x30fb, 0x0, 0x30fc, 0x0, 0x30fd, 0x3099, 0x0, 0x349e, 0x0, 0x34b9, 0x0, 0x34bb, 0x0, 0x34df, 0x0, 0x3515, 0x0, 0x36ee, 0x0, 0x36fc, 0x0, 0x3781, 0x0, 0x382f, 0x0, 0x3862, 0x0, 0x387c, 0x0, 0x38c7, 0x0, 0x38e3, 0x0, 0x391c, 0x0, 0x393a, 0x0, 0x3a2e, 0x0, 0x3a6c, 0x0, 0x3ae4, 0x0, 0x3b08, 0x0, 0x3b19, 0x0, 0x3b49, 0x0, 0x3b9d, 0x0, 0x3c18, 0x0, 0x3c4e, 0x0, 0x3d33, 0x0, 0x3d96, 0x0, 0x3eac, 0x0, 0x3eb8, 0x0, 0x3f1b, 0x0, 0x3ffc, 0x0, 0x4008, 0x0, 0x4018, 0x0, 0x4039, 0x0, 0x4046, 0x0, 0x4096, 0x0, 0x40e3, 0x0, 0x412f, 0x0, 0x4202, 0x0, 0x4227, 0x0, 0x42a0, 0x0, 0x4301, 0x0, 0x4334, 0x0, 0x4359, 0x0, 0x43d5, 0x0, 0x43d9, 0x0, 0x440b, 0x0, 0x446b, 0x0, 0x452b, 0x0, 0x455d, 0x0, 0x4561, 0x0, 0x456b, 0x0, 0x45d7, 0x0, 0x45f9, 0x0, 0x4635, 0x0, 0x46be, 0x0, 0x46c7, 0x0, 0x4995, 0x0, 0x49e6, 0x0, 0x4a6e, 0x0, 0x4a76, 0x0, 0x4ab2, 0x0, 0x4b33, 0x0, 0x4bce, 0x0, 0x4cce, 0x0, 0x4ced, 0x0, 0x4cf8, 0x0, 0x4d56, 0x0, 0x4e00, 0x0, 0x4e01, 0x0, 0x4e03, 0x0, 0x4e09, 0x0, 0x4e0a, 0x0, 0x4e0b, 0x0, 0x4e0d, 0x0, 0x4e19, 0x0, 0x4e26, 0x0, 0x4e28, 0x0, 0x4e2d, 0x0, 0x4e32, 0x0, 0x4e36, 0x0, 0x4e38, 0x0, 0x4e39, 0x0, 0x4e3d, 0x0, 0x4e3f, 0x0, 0x4e41, 0x0, 0x4e59, 0x0, 0x4e5d, 0x0, 0x4e82, 0x0, 0x4e85, 0x0, 0x4e86, 0x0, 0x4e8c, 0x0, 0x4e94, 0x0, 0x4ea0, 0x0, 0x4ea4, 0x0, 0x4eae, 0x0, 0x4eba, 0x0, 0x4ec0, 0x0, 0x4ecc, 0x0, 0x4ee4, 0x0, 0x4f01, 0x0, 0x4f11, 0x0, 0x4f60, 0x0, 0x4f80, 0x0, 0x4f86, 0x0, 0x4f8b, 0x0, 0x4fae, 0x0, 0x4fbb, 0x0, 0x4fbf, 0x0, 0x5002, 0x0, 0x502b, 0x0, 0x507a, 0x0, 0x5099, 0x0, 0x50cf, 0x0, 0x50da, 0x0, 0x50e7, 0x0, 0x512a, 0x0, 0x513f, 0x0, 0x5140, 0x0, 0x5145, 0x0, 0x514d, 0x0, 0x5154, 0x0, 0x5164, 0x0, 0x5165, 0x0, 0x5167, 0x0, 0x5168, 0x0, 0x5169, 0x0, 0x516b, 0x0, 0x516d, 0x0, 0x5177, 0x0, 0x5180, 0x0, 0x5182, 0x0, 0x518d, 0x0, 0x5192, 0x0, 0x5195, 0x0, 0x5196, 0x0, 0x5197, 0x0, 0x5199, 0x0, 0x51a4, 0x0, 0x51ab, 0x0, 0x51ac, 0x0, 0x51b5, 0x0, 0x51b7, 0x0, 0x51c9, 0x0, 0x51cc, 0x0, 0x51dc, 0x0, 0x51de, 0x0, 0x51e0, 0x0, 0x51f5, 0x0, 0x5200, 0x0, 0x5203, 0x0, 0x5207, 0x0, 0x5217, 0x0, 0x521d, 0x0, 0x5229, 0x0, 0x523a, 0x0, 0x523b, 0x0, 0x5246, 0x0, 0x524d, 0x0, 0x5272, 0x0, 0x5277, 0x0, 0x5289, 0x0, 0x529b, 0x0, 0x52a3, 0x0, 0x52b3, 0x0, 0x52b4, 0x0, 0x52c7, 0x0, 0x52c9, 0x0, 0x52d2, 0x0, 0x52de, 0x0, 0x52e4, 0x0, 0x52f5, 0x0, 0x52f9, 0x0, 0x52fa, 0x0, 0x5305, 0x0, 0x5306, 0x0, 0x5315, 0x0, 0x5317, 0x0, 0x531a, 0x0, 0x5338, 0x0, 0x533b, 0x0, 0x533f, 0x0, 0x5341, 0x0, 0x5344, 0x0, 0x5345, 0x0, 0x5349, 0x0, 0x5351, 0x0, 0x5354, 0x0, 0x535a, 0x0, 0x535c, 0x0, 0x5369, 0x0, 0x5370, 0x0, 0x5373, 0x0, 0x5375, 0x0, 0x537d, 0x0, 0x537f, 0x0, 0x5382, 0x0, 0x53b6, 0x0, 0x53c3, 0x0, 0x53c8, 0x0, 0x53ca, 0x0, 0x53cc, 0x0, 0x53df, 0x0, 0x53e3, 0x0, 0x53e5, 0x0, 0x53eb, 0x0, 0x53ef, 0x0, 0x53f1, 0x0, 0x53f3, 0x0, 0x5406, 0x0, 0x5408, 0x0, 0x540d, 0x0, 0x540f, 0x0, 0x541d, 0x0, 0x5438, 0x0, 0x5439, 0x0, 0x5442, 0x0, 0x5448, 0x0, 0x5468, 0x0, 0x549e, 0x0, 0x54a2, 0x0, 0x54bd, 0x0, 0x54f6, 0x0, 0x5510, 0x0, 0x554f, 0x0, 0x5553, 0x0, 0x5555, 0x0, 0x5563, 0x0, 0x5584, 0x0, 0x5587, 0x0, 0x5599, 0x0, 0x559d, 0x0, 0x55ab, 0x0, 0x55b3, 0x0, 0x55b6, 0x0, 0x55c0, 0x0, 0x55c2, 0x0, 0x55e2, 0x0, 0x5606, 0x0, 0x5651, 0x0, 0x5668, 0x0, 0x5674, 0x0, 0x56d7, 0x0, 0x56db, 0x0, 0x56f9, 0x0, 0x5716, 0x0, 0x5717, 0x0, 0x571f, 0x0, 0x5730, 0x0, 0x578b, 0x0, 0x57ce, 0x0, 0x57f4, 0x0, 0x580d, 0x0, 0x5831, 0x0, 0x5832, 0x0, 0x5840, 0x0, 0x585a, 0x0, 0x585e, 0x0, 0x58a8, 0x0, 0x58ac, 0x0, 0x58b3, 0x0, 0x58d8, 0x0, 0x58df, 0x0, 0x58eb, 0x0, 0x58ee, 0x0, 0x58f0, 0x0, 0x58f2, 0x0, 0x58f7, 0x0, 0x5902, 0x0, 0x5906, 0x0, 0x590a, 0x0, 0x5915, 0x0, 0x591a, 0x0, 0x591c, 0x0, 0x5922, 0x0, 0x5927, 0x0, 0x5927, 0x6b63, 0x0, 0x5929, 0x0, 0x5944, 0x0, 0x5948, 0x0, 0x5951, 0x0, 0x5954, 0x0, 0x5962, 0x0, 0x5973, 0x0, 0x59d8, 0x0, 0x59ec, 0x0, 0x5a1b, 0x0, 0x5a27, 0x0, 0x5a62, 0x0, 0x5a66, 0x0, 0x5ab5, 0x0, 0x5b08, 0x0, 0x5b28, 0x0, 0x5b3e, 0x0, 0x5b50, 0x0, 0x5b57, 0x0, 0x5b66, 0x0, 0x5b80, 0x0, 0x5b85, 0x0, 0x5b97, 0x0, 0x5bc3, 0x0, 0x5bd8, 0x0, 0x5be7, 0x0, 0x5bee, 0x0, 0x5bf3, 0x0, 0x5bf8, 0x0, 0x5bff, 0x0, 0x5c06, 0x0, 0x5c0f, 0x0, 0x5c22, 0x0, 0x5c38, 0x0, 0x5c3f, 0x0, 0x5c60, 0x0, 0x5c62, 0x0, 0x5c64, 0x0, 0x5c65, 0x0, 0x5c6e, 0x0, 0x5c71, 0x0, 0x5c8d, 0x0, 0x5cc0, 0x0, 0x5d19, 0x0, 0x5d43, 0x0, 0x5d50, 0x0, 0x5d6b, 0x0, 0x5d6e, 0x0, 0x5d7c, 0x0, 0x5db2, 0x0, 0x5dba, 0x0, 0x5ddb, 0x0, 0x5de1, 0x0, 0x5de2, 0x0, 0x5de5, 0x0, 0x5de6, 0x0, 0x5df1, 0x0, 0x5dfd, 0x0, 0x5dfe, 0x0, 0x5e28, 0x0, 0x5e3d, 0x0, 0x5e69, 0x0, 0x5e72, 0x0, 0x5e73, 0x6210, 0x0, 0x5e74, 0x0, 0x5e7a, 0x0, 0x5e7c, 0x0, 0x5e7f, 0x0, 0x5ea6, 0x0, 0x5eb0, 0x0, 0x5eb3, 0x0, 0x5eb6, 0x0, 0x5ec9, 0x0, 0x5eca, 0x0, 0x5ed2, 0x0, 0x5ed3, 0x0, 0x5ed9, 0x0, 0x5eec, 0x0, 0x5ef4, 0x0, 0x5efe, 0x0, 0x5f04, 0x0, 0x5f0b, 0x0, 0x5f13, 0x0, 0x5f22, 0x0, 0x5f50, 0x0, 0x5f53, 0x0, 0x5f61, 0x0, 0x5f62, 0x0, 0x5f69, 0x0, 0x5f6b, 0x0, 0x5f73, 0x0, 0x5f8b, 0x0, 0x5f8c, 0x0, 0x5f97, 0x0, 0x5f9a, 0x0, 0x5fa9, 0x0, 0x5fad, 0x0, 0x5fc3, 0x0, 0x5fcd, 0x0, 0x5fd7, 0x0, 0x5ff5, 0x0, 0x5ff9, 0x0, 0x6012, 0x0, 0x601c, 0x0, 0x6075, 0x0, 0x6081, 0x0, 0x6094, 0x0, 0x60c7, 0x0, 0x60d8, 0x0, 0x60e1, 0x0, 0x6108, 0x0, 0x6144, 0x0, 0x6148, 0x0, 0x614c, 0x0, 0x614e, 0x0, 0x6160, 0x0, 0x6168, 0x0, 0x617a, 0x0, 0x618e, 0x0, 0x6190, 0x0, 0x61a4, 0x0, 0x61af, 0x0, 0x61b2, 0x0, 0x61de, 0x0, 0x61f2, 0x0, 0x61f6, 0x0, 0x6200, 0x0, 0x6208, 0x0, 0x6210, 0x0, 0x621b, 0x0, 0x622e, 0x0, 0x6234, 0x0, 0x6236, 0x0, 0x624b, 0x0, 0x6253, 0x0, 0x625d, 0x0, 0x6295, 0x0, 0x62b1, 0x0, 0x62c9, 0x0, 0x62cf, 0x0, 0x62d3, 0x0, 0x62d4, 0x0, 0x62fc, 0x0, 0x62fe, 0x0, 0x6307, 0x0, 0x633d, 0x0, 0x6350, 0x0, 0x6355, 0x0, 0x6368, 0x0, 0x637b, 0x0, 0x6383, 0x0, 0x63a0, 0x0, 0x63a9, 0x0, 0x63c4, 0x0, 0x63c5, 0x0, 0x63e4, 0x0, 0x641c, 0x0, 0x6422, 0x0, 0x6452, 0x0, 0x6469, 0x0, 0x6477, 0x0, 0x647e, 0x0, 0x649a, 0x0, 0x649d, 0x0, 0x64c4, 0x0, 0x652f, 0x0, 0x6534, 0x0, 0x654f, 0x0, 0x6556, 0x0, 0x656c, 0x0, 0x6578, 0x0, 0x6587, 0x0, 0x6597, 0x0, 0x6599, 0x0, 0x65a4, 0x0, 0x65b0, 0x0, 0x65b9, 0x0, 0x65c5, 0x0, 0x65e0, 0x0, 0x65e2, 0x0, 0x65e3, 0x0, 0x65e5, 0x0, 0x660e, 0x6cbb, 0x0, 0x6613, 0x0, 0x6620, 0x0, 0x662d, 0x548c, 0x0, 0x6649, 0x0, 0x6674, 0x0, 0x6688, 0x0, 0x6691, 0x0, 0x669c, 0x0, 0x66b4, 0x0, 0x66c6, 0x0, 0x66f0, 0x0, 0x66f4, 0x0, 0x66f8, 0x0, 0x6700, 0x0, 0x6708, 0x0, 0x6709, 0x0, 0x6717, 0x0, 0x671b, 0x0, 0x6721, 0x0, 0x6728, 0x0, 0x674e, 0x0, 0x6753, 0x0, 0x6756, 0x0, 0x675e, 0x0, 0x677b, 0x0, 0x6785, 0x0, 0x6797, 0x0, 0x67f3, 0x0, 0x67fa, 0x0, 0x6817, 0x0, 0x681f, 0x0, 0x682a, 0x0, 0x682a, 0x5f0f, 0x4f1a, 0x793e, 0x0, 0x6852, 0x0, 0x6881, 0x0, 0x6885, 0x0, 0x688e, 0x0, 0x68a8, 0x0, 0x6914, 0x0, 0x6942, 0x0, 0x69a3, 0x0, 0x69ea, 0x0, 0x6a02, 0x0, 0x6a13, 0x0, 0x6aa8, 0x0, 0x6ad3, 0x0, 0x6adb, 0x0, 0x6b04, 0x0, 0x6b20, 0x0, 0x6b21, 0x0, 0x6b54, 0x0, 0x6b62, 0x0, 0x6b63, 0x0, 0x6b72, 0x0, 0x6b77, 0x0, 0x6b79, 0x0, 0x6b9f, 0x0, 0x6bae, 0x0, 0x6bb3, 0x0, 0x6bba, 0x0, 0x6bbb, 0x0, 0x6bcb, 0x0, 0x6bcd, 0x0, 0x6bd4, 0x0, 0x6bdb, 0x0, 0x6c0f, 0x0, 0x6c14, 0x0, 0x6c34, 0x0, 0x6c4e, 0x0, 0x6c67, 0x0, 0x6c88, 0x0, 0x6cbf, 0x0, 0x6ccc, 0x0, 0x6ccd, 0x0, 0x6ce5, 0x0, 0x6ce8, 0x0, 0x6d16, 0x0, 0x6d1b, 0x0, 0x6d1e, 0x0, 0x6d34, 0x0, 0x6d3e, 0x0, 0x6d41, 0x0, 0x6d69, 0x0, 0x6d6a, 0x0, 0x6d77, 0x0, 0x6d78, 0x0, 0x6d85, 0x0, 0x6dcb, 0x0, 0x6dda, 0x0, 0x6dea, 0x0, 0x6df9, 0x0, 0x6e1a, 0x0, 0x6e2f, 0x0, 0x6e6e, 0x0, 0x6e80, 0x0, 0x6e9c, 0x0, 0x6eba, 0x0, 0x6ec7, 0x0, 0x6ecb, 0x0, 0x6ed1, 0x0, 0x6edb, 0x0, 0x6f0f, 0x0, 0x6f14, 0x0, 0x6f22, 0x0, 0x6f23, 0x0, 0x6f6e, 0x0, 0x6fc6, 0x0, 0x6feb, 0x0, 0x6ffe, 0x0, 0x701b, 0x0, 0x701e, 0x0, 0x7039, 0x0, 0x704a, 0x0, 0x706b, 0x0, 0x7070, 0x0, 0x7077, 0x0, 0x707d, 0x0, 0x7099, 0x0, 0x70ad, 0x0, 0x70c8, 0x0, 0x70d9, 0x0, 0x7121, 0x0, 0x7145, 0x0, 0x7149, 0x0, 0x716e, 0x0, 0x719c, 0x0, 0x71ce, 0x0, 0x71d0, 0x0, 0x7210, 0x0, 0x721b, 0x0, 0x7228, 0x0, 0x722a, 0x0, 0x722b, 0x0, 0x7235, 0x0, 0x7236, 0x0, 0x723b, 0x0, 0x723f, 0x0, 0x7247, 0x0, 0x7250, 0x0, 0x7259, 0x0, 0x725b, 0x0, 0x7262, 0x0, 0x7279, 0x0, 0x7280, 0x0, 0x7295, 0x0, 0x72ac, 0x0, 0x72af, 0x0, 0x72c0, 0x0, 0x72fc, 0x0, 0x732a, 0x0, 0x7375, 0x0, 0x737a, 0x0, 0x7384, 0x0, 0x7387, 0x0, 0x7389, 0x0, 0x738b, 0x0, 0x73a5, 0x0, 0x73b2, 0x0, 0x73de, 0x0, 0x7406, 0x0, 0x7409, 0x0, 0x7422, 0x0, 0x7447, 0x0, 0x745c, 0x0, 0x7469, 0x0, 0x7471, 0x0, 0x7485, 0x0, 0x7489, 0x0, 0x7498, 0x0, 0x74ca, 0x0, 0x74dc, 0x0, 0x74e6, 0x0, 0x7506, 0x0, 0x7518, 0x0, 0x751f, 0x0, 0x7524, 0x0, 0x7528, 0x0, 0x7530, 0x0, 0x7532, 0x0, 0x7533, 0x0, 0x7537, 0x0, 0x753b, 0x0, 0x753e, 0x0, 0x7559, 0x0, 0x7565, 0x0, 0x7570, 0x0, 0x758b, 0x0, 0x7592, 0x0, 0x75e2, 0x0, 0x7610, 0x0, 0x761d, 0x0, 0x761f, 0x0, 0x7642, 0x0, 0x7669, 0x0, 0x7676, 0x0, 0x767d, 0x0, 0x76ae, 0x0, 0x76bf, 0x0, 0x76ca, 0x0, 0x76db, 0x0, 0x76e3, 0x0, 0x76e7, 0x0, 0x76ee, 0x0, 0x76f4, 0x0, 0x7701, 0x0, 0x771e, 0x0, 0x771f, 0x0, 0x7740, 0x0, 0x774a, 0x0, 0x778b, 0x0, 0x77a7, 0x0, 0x77db, 0x0, 0x77e2, 0x0, 0x77f3, 0x0, 0x784e, 0x0, 0x786b, 0x0, 0x788c, 0x0, 0x7891, 0x0, 0x78ca, 0x0, 0x78cc, 0x0, 0x78fb, 0x0, 0x792a, 0x0, 0x793a, 0x0, 0x793c, 0x0, 0x793e, 0x0, 0x7948, 0x0, 0x7949, 0x0, 0x7950, 0x0, 0x7956, 0x0, 0x795d, 0x0, 0x795e, 0x0, 0x7965, 0x0, 0x797f, 0x0, 0x7981, 0x0, 0x798d, 0x0, 0x798e, 0x0, 0x798f, 0x0, 0x79ae, 0x0, 0x79b8, 0x0, 0x79be, 0x0, 0x79ca, 0x0, 0x79d8, 0x0, 0x79eb, 0x0, 0x7a1c, 0x0, 0x7a40, 0x0, 0x7a4a, 0x0, 0x7a4f, 0x0, 0x7a74, 0x0, 0x7a7a, 0x0, 0x7a81, 0x0, 0x7ab1, 0x0, 0x7acb, 0x0, 0x7aee, 0x0, 0x7af9, 0x0, 0x7b20, 0x0, 0x7b8f, 0x0, 0x7bc0, 0x0, 0x7bc6, 0x0, 0x7bc9, 0x0, 0x7c3e, 0x0, 0x7c60, 0x0, 0x7c73, 0x0, 0x7c7b, 0x0, 0x7c92, 0x0, 0x7cbe, 0x0, 0x7cd2, 0x0, 0x7cd6, 0x0, 0x7ce3, 0x0, 0x7ce7, 0x0, 0x7ce8, 0x0, 0x7cf8, 0x0, 0x7d00, 0x0, 0x7d10, 0x0, 0x7d22, 0x0, 0x7d2f, 0x0, 0x7d42, 0x0, 0x7d5b, 0x0, 0x7d63, 0x0, 0x7da0, 0x0, 0x7dbe, 0x0, 0x7dc7, 0x0, 0x7df4, 0x0, 0x7e02, 0x0, 0x7e09, 0x0, 0x7e37, 0x0, 0x7e41, 0x0, 0x7e45, 0x0, 0x7f36, 0x0, 0x7f3e, 0x0, 0x7f51, 0x0, 0x7f72, 0x0, 0x7f79, 0x0, 0x7f7a, 0x0, 0x7f85, 0x0, 0x7f8a, 0x0, 0x7f95, 0x0, 0x7f9a, 0x0, 0x7fbd, 0x0, 0x7ffa, 0x0, 0x8001, 0x0, 0x8005, 0x0, 0x800c, 0x0, 0x8012, 0x0, 0x8033, 0x0, 0x8046, 0x0, 0x8060, 0x0, 0x806f, 0x0, 0x8070, 0x0, 0x807e, 0x0, 0x807f, 0x0, 0x8089, 0x0, 0x808b, 0x0, 0x80ad, 0x0, 0x80b2, 0x0, 0x8103, 0x0, 0x813e, 0x0, 0x81d8, 0x0, 0x81e3, 0x0, 0x81e8, 0x0, 0x81ea, 0x0, 0x81ed, 0x0, 0x81f3, 0x0, 0x81fc, 0x0, 0x8201, 0x0, 0x8204, 0x0, 0x820c, 0x0, 0x8218, 0x0, 0x821b, 0x0, 0x821f, 0x0, 0x826e, 0x0, 0x826f, 0x0, 0x8272, 0x0, 0x8278, 0x0, 0x8279, 0x0, 0x828b, 0x0, 0x8291, 0x0, 0x829d, 0x0, 0x82b1, 0x0, 0x82b3, 0x0, 0x82bd, 0x0, 0x82e5, 0x0, 0x82e6, 0x0, 0x831d, 0x0, 0x8323, 0x0, 0x8336, 0x0, 0x8352, 0x0, 0x8353, 0x0, 0x8363, 0x0, 0x83ad, 0x0, 0x83bd, 0x0, 0x83c9, 0x0, 0x83ca, 0x0, 0x83cc, 0x0, 0x83dc, 0x0, 0x83e7, 0x0, 0x83ef, 0x0, 0x83f1, 0x0, 0x843d, 0x0, 0x8449, 0x0, 0x8457, 0x0, 0x84ee, 0x0, 0x84f1, 0x0, 0x84f3, 0x0, 0x84fc, 0x0, 0x8516, 0x0, 0x8564, 0x0, 0x85cd, 0x0, 0x85fa, 0x0, 0x8606, 0x0, 0x8612, 0x0, 0x862d, 0x0, 0x863f, 0x0, 0x864d, 0x0, 0x8650, 0x0, 0x865c, 0x0, 0x8667, 0x0, 0x8669, 0x0, 0x866b, 0x0, 0x8688, 0x0, 0x86a9, 0x0, 0x86e2, 0x0, 0x870e, 0x0, 0x8728, 0x0, 0x876b, 0x0, 0x8779, 0x0, 0x8786, 0x0, 0x87ba, 0x0, 0x87e1, 0x0, 0x8801, 0x0, 0x881f, 0x0, 0x8840, 0x0, 0x884c, 0x0, 0x8860, 0x0, 0x8863, 0x0, 0x88c2, 0x0, 0x88cf, 0x0, 0x88d7, 0x0, 0x88de, 0x0, 0x88e1, 0x0, 0x88f8, 0x0, 0x88fa, 0x0, 0x8910, 0x0, 0x8941, 0x0, 0x8964, 0x0, 0x897e, 0x0, 0x8986, 0x0, 0x898b, 0x0, 0x8996, 0x0, 0x89d2, 0x0, 0x89e3, 0x0, 0x8a00, 0x0, 0x8aa0, 0x0, 0x8aaa, 0x0, 0x8abf, 0x0, 0x8acb, 0x0, 0x8ad2, 0x0, 0x8ad6, 0x0, 0x8aed, 0x0, 0x8af8, 0x0, 0x8afe, 0x0, 0x8b01, 0x0, 0x8b39, 0x0, 0x8b58, 0x0, 0x8b80, 0x0, 0x8b8a, 0x0, 0x8c37, 0x0, 0x8c46, 0x0, 0x8c48, 0x0, 0x8c55, 0x0, 0x8c78, 0x0, 0x8c9d, 0x0, 0x8ca1, 0x0, 0x8ca9, 0x0, 0x8cab, 0x0, 0x8cc1, 0x0, 0x8cc2, 0x0, 0x8cc7, 0x0, 0x8cc8, 0x0, 0x8cd3, 0x0, 0x8d08, 0x0, 0x8d1b, 0x0, 0x8d64, 0x0, 0x8d70, 0x0, 0x8d77, 0x0, 0x8db3, 0x0, 0x8dbc, 0x0, 0x8dcb, 0x0, 0x8def, 0x0, 0x8df0, 0x0, 0x8eab, 0x0, 0x8eca, 0x0, 0x8ed4, 0x0, 0x8f26, 0x0, 0x8f2a, 0x0, 0x8f38, 0x0, 0x8f3b, 0x0, 0x8f62, 0x0, 0x8f9b, 0x0, 0x8f9e, 0x0, 0x8fb0, 0x0, 0x8fb5, 0x0, 0x8fb6, 0x0, 0x9023, 0x0, 0x9038, 0x0, 0x904a, 0x0, 0x9069, 0x0, 0x9072, 0x0, 0x907c, 0x0, 0x908f, 0x0, 0x9091, 0x0, 0x9094, 0x0, 0x90ce, 0x0, 0x90de, 0x0, 0x90f1, 0x0, 0x90fd, 0x0, 0x9111, 0x0, 0x911b, 0x0, 0x9149, 0x0, 0x916a, 0x0, 0x9199, 0x0, 0x91b4, 0x0, 0x91c6, 0x0, 0x91cc, 0x0, 0x91cf, 0x0, 0x91d1, 0x0, 0x9234, 0x0, 0x9238, 0x0, 0x9276, 0x0, 0x927c, 0x0, 0x92d7, 0x0, 0x92d8, 0x0, 0x9304, 0x0, 0x934a, 0x0, 0x93f9, 0x0, 0x9415, 0x0, 0x9577, 0x0, 0x9580, 0x0, 0x958b, 0x0, 0x95ad, 0x0, 0x95b7, 0x0, 0x961c, 0x0, 0x962e, 0x0, 0x964b, 0x0, 0x964d, 0x0, 0x9675, 0x0, 0x9678, 0x0, 0x967c, 0x0, 0x9686, 0x0, 0x96a3, 0x0, 0x96b6, 0x0, 0x96b7, 0x0, 0x96b8, 0x0, 0x96b9, 0x0, 0x96c3, 0x0, 0x96e2, 0x0, 0x96e3, 0x0, 0x96e8, 0x0, 0x96f6, 0x0, 0x96f7, 0x0, 0x9723, 0x0, 0x9732, 0x0, 0x9748, 0x0, 0x9751, 0x0, 0x9756, 0x0, 0x975e, 0x0, 0x9762, 0x0, 0x9769, 0x0, 0x97cb, 0x0, 0x97db, 0x0, 0x97e0, 0x0, 0x97ed, 0x0, 0x97f3, 0x0, 0x97ff, 0x0, 0x9801, 0x0, 0x9805, 0x0, 0x980b, 0x0, 0x9818, 0x0, 0x9829, 0x0, 0x983b, 0x0, 0x985e, 0x0, 0x98a8, 0x0, 0x98db, 0x0, 0x98df, 0x0, 0x98e2, 0x0, 0x98ef, 0x0, 0x98fc, 0x0, 0x9928, 0x0, 0x9929, 0x0, 0x9996, 0x0, 0x9999, 0x0, 0x99a7, 0x0, 0x99ac, 0x0, 0x99c2, 0x0, 0x99f1, 0x0, 0x99fe, 0x0, 0x9a6a, 0x0, 0x9aa8, 0x0, 0x9ad8, 0x0, 0x9adf, 0x0, 0x9b12, 0x0, 0x9b25, 0x0, 0x9b2f, 0x0, 0x9b32, 0x0, 0x9b3c, 0x0, 0x9b5a, 0x0, 0x9b6f, 0x0, 0x9c40, 0x0, 0x9c57, 0x0, 0x9ce5, 0x0, 0x9cfd, 0x0, 0x9d67, 0x0, 0x9db4, 0x0, 0x9dfa, 0x0, 0x9e1e, 0x0, 0x9e75, 0x0, 0x9e7f, 0x0, 0x9e97, 0x0, 0x9e9f, 0x0, 0x9ea5, 0x0, 0x9ebb, 0x0, 0x9ec3, 0x0, 0x9ecd, 0x0, 0x9ece, 0x0, 0x9ed1, 0x0, 0x9ef9, 0x0, 0x9efd, 0x0, 0x9efe, 0x0, 0x9f05, 0x0, 0x9f0e, 0x0, 0x9f0f, 0x0, 0x9f13, 0x0, 0x9f16, 0x0, 0x9f20, 0x0, 0x9f3b, 0x0, 0x9f43, 0x0, 0x9f4a, 0x0, 0x9f52, 0x0, 0x9f8d, 0x0, 0x9f8e, 0x0, 0x9f9c, 0x0, 0x9f9f, 0x0, 0x9fa0, 0x0, 0xa76f, 0x0, 0x11099, 0x110ba, 0x0, 0x1109b, 0x110ba, 0x0, 0x110a5, 0x110ba, 0x0, 0x11131, 0x11127, 0x0, 0x11132, 0x11127, 0x0, 0x1d157, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x0, 0x1d158, 0x1d165, 0x1d16e, 0x0, 0x1d158, 0x1d165, 0x1d16f, 0x0, 0x1d158, 0x1d165, 0x1d170, 0x0, 0x1d158, 0x1d165, 0x1d171, 0x0, 0x1d158, 0x1d165, 0x1d172, 0x0, 0x1d1b9, 0x1d165, 0x0, 0x1d1b9, 0x1d165, 0x1d16e, 0x0, 0x1d1b9, 0x1d165, 0x1d16f, 0x0, 0x1d1ba, 0x1d165, 0x0, 0x1d1ba, 0x1d165, 0x1d16e, 0x0, 0x1d1ba, 0x1d165, 0x1d16f, 0x0, 0x20122, 0x0, 0x2051c, 0x0, 0x20525, 0x0, 0x2054b, 0x0, 0x2063a, 0x0, 0x20804, 0x0, 0x208de, 0x0, 0x20a2c, 0x0, 0x20b63, 0x0, 0x214e4, 0x0, 0x216a8, 0x0, 0x216ea, 0x0, 0x219c8, 0x0, 0x21b18, 0x0, 0x21d0b, 0x0, 0x21de4, 0x0, 0x21de6, 0x0, 0x22183, 0x0, 0x2219f, 0x0, 0x22331, 0x0, 0x226d4, 0x0, 0x22844, 0x0, 0x2284a, 0x0, 0x22b0c, 0x0, 0x22bf1, 0x0, 0x2300a, 0x0, 0x232b8, 0x0, 0x2335f, 0x0, 0x23393, 0x0, 0x2339c, 0x0, 0x233c3, 0x0, 0x233d5, 0x0, 0x2346d, 0x0, 0x236a3, 0x0, 0x238a7, 0x0, 0x23a8d, 0x0, 0x23afa, 0x0, 0x23cbc, 0x0, 0x23d1e, 0x0, 0x23ed1, 0x0, 0x23f5e, 0x0, 0x23f8e, 0x0, 0x24263, 0x0, 0x242ee, 0x0, 0x243ab, 0x0, 0x24608, 0x0, 0x24735, 0x0, 0x24814, 0x0, 0x24c36, 0x0, 0x24c92, 0x0, 0x24fa1, 0x0, 0x24fb8, 0x0, 0x25044, 0x0, 0x250f2, 0x0, 0x250f3, 0x0, 0x25119, 0x0, 0x25133, 0x0, 0x25249, 0x0, 0x2541d, 0x0, 0x25626, 0x0, 0x2569a, 0x0, 0x256c5, 0x0, 0x2597c, 0x0, 0x25aa7, 0x0, 0x25bab, 0x0, 0x25c80, 0x0, 0x25cd0, 0x0, 0x25f86, 0x0, 0x261da, 0x0, 0x26228, 0x0, 0x26247, 0x0, 0x262d9, 0x0, 0x2633e, 0x0, 0x264da, 0x0, 0x26523, 0x0, 0x265a8, 0x0, 0x267a7, 0x0, 0x267b5, 0x0, 0x26b3c, 0x0, 0x26c36, 0x0, 0x26cd5, 0x0, 0x26d6b, 0x0, 0x26f2c, 0x0, 0x26fb1, 0x0, 0x270d2, 0x0, 0x273ca, 0x0, 0x27667, 0x0, 0x278ae, 0x0, 0x27966, 0x0, 0x27ca8, 0x0, 0x27ed3, 0x0, 0x27f2f, 0x0, 0x285d2, 0x0, 0x285ed, 0x0, 0x2872e, 0x0, 0x28bfa, 0x0, 0x28d77, 0x0, 0x29145, 0x0, 0x291df, 0x0, 0x2921a, 0x0, 0x2940a, 0x0, 0x29496, 0x0, 0x295b6, 0x0, 0x29b30, 0x0, 0x2a0ce, 0x0, 0x2a105, 0x0, 0x2a20e, 0x0, 0x2a291, 0x0, 0x2a392, 0x0, 0x2a600, 0x0]; return t; } -+} -+ -+} -+ ---- a/src/libphobos/src/std/internal/unicode_grapheme.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/internal/unicode_grapheme.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,28 @@ -+module std.internal.unicode_grapheme; -+import std.internal.unicode_tables; -+ -+static if(size_t.sizeof == 8) { -+//832 bytes -+enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x40], [ 0x100, 0x80, 0xa00], [ 0x2010000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4000300020001, 0x1000700060005, 0x5000400030002, 0x2000100070006, 0x6000500040003, 0x3000200010007, 0x7000600050004, 0x4000300020001, 0x1000700060005, 0x5000400030002, 0x8000100070006, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000010000001, 0x1000000100000, 0x10000001000, 0x1000000100000010, 0x10000001000000, 0x100000010000, 0x1000000100, 0x100000010000001, 0x1000000100000, 0x10000001000, 0x1000000100000010, 0x10000001000000, 0x100000010000, 0x1000000100, 0x100000010000001, 0x1000000100000, 0x10000001000, 0x1000000100000010, 0x10000001000000, 0x100000010000, 0x1000000100, 0x100000010000001, 0x1000000100000, 0x10000001000, 0x1000000100000010, 0x10000001000000, 0x100000010000, 0x1000000100, 0x10000001000000, 0x100000010000, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//832 bytes -+enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x40], [ 0x100, 0x80, 0xa00], [ 0x2010000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4000300020001, 0x1000700060005, 0x5000400030002, 0x2000100070006, 0x6000500040003, 0x3000200010007, 0x7000600050004, 0x4000300020001, 0x1000700060005, 0x5000400030002, 0x8000100070006, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfeffffffeffffffe, 0xfffeffffffefffff, 0xfffffeffffffefff, 0xeffffffeffffffef, 0xffeffffffeffffff, 0xffffeffffffeffff, 0xffffffeffffffeff, 0xfeffffffeffffffe, 0xfffeffffffefffff, 0xfffffeffffffefff, 0xeffffffeffffffef, 0xffeffffffeffffff, 0xffffeffffffeffff, 0xffffffeffffffeff, 0xfeffffffeffffffe, 0xfffeffffffefffff, 0xfffffeffffffefff, 0xeffffffeffffffef, 0xffeffffffeffffff, 0xffffeffffffeffff, 0xffffffeffffffeff, 0xfeffffffeffffffe, 0xfffeffffffefffff, 0xfffffeffffffefff, 0xeffffffeffffffef, 0xffeffffffeffffff, 0xffffeffffffeffff, 0xffffffeffffffeff, 0xffeffffffeffffff, 0xffffeffffffeffff, 0xffffffeff, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1536 bytes -+enum mcTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x60], [ 0x100, 0x100, 0x1800], [ 0x202030202020100, 0x206020205020204, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x6000000050004, 0x7, 0x8000000000000, 0xb000a00090000, 0xc, 0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x110010000f000e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x130012, 0x1400000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc800000000000008, 0xde01, 0xc00000000000000c, 0x801981, 0xc000000000000008, 0x1, 0xc000000000000008, 0x1a01, 0x400000000000000c, 0x801981, 0xc000000000000000, 0x801dc6, 0xe, 0x1e, 0x400000000000000c, 0x600d9f, 0xc00000000000000c, 0x801dc1, 0xc, 0xc0000ff038000, 0xc000000000000000, 0x8000000000000000, 0x0, 0x0, 0x1902180000000000, 0x3f9c00c00000, 0x1c009f98, 0x0, 0x0, 0x0, 0xc040000000000000, 0x1bf, 0x1fb0e7800000000, 0x0, 0xffff000000000000, 0x301, 0x6000000, 0x7e01a00a00000, 0x0, 0x0, 0xe820000000000010, 0x1b, 0x34c200000004, 0xc5c8000000000, 0x300ff000000000, 0x0, 0x0, 0xc000200000000, 0xc00000000000, 0x0, 0x0, 0x0, 0x9800000000, 0x0, 0xfff0000000000003, 0xf, 0x0, 0xc0000, 0xec30000000000008, 0x1, 0x19800000000000, 0x800000000002000, 0x0, 0x20c80000000000, 0x0, 0x0, 0x0, 0x16d800000000, 0x5, 0x0, 0x187000000000004, 0x0, 0x100000000000, 0x0, 0x8038000000000004, 0x1, 0x0, 0x0, 0x40d00000000000, 0x0, 0x0, 0x7ffffffffffe0000, 0x0, 0x0, 0x0, 0x7e06000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2336 bytes -+enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x70], [ 0x100, 0x140, 0x2d00], [ 0x402030202020100, 0x207020206020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020208, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000000000, 0x5000400030002, 0x9000800070006, 0xd000c000b000a, 0xf00000000000e, 0x10000000000000, 0x14001300120011, 0x160015, 0x17, 0x0, 0x0, 0x190018, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b00000000, 0x1f001e001d001c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000000000, 0x22002100000000, 0x230000, 0x0, 0x2400000000, 0x0, 0x260025, 0x2700000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2a00290000, 0x0, 0x0, 0x0, 0x2b0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x3f8, 0x0, 0x0, 0x0, 0xbffffffffffe0000, 0xb6, 0x7ff0000, 0x10000fffff800, 0x0, 0x3d9f9fc00000, 0xffff000000020000, 0x7ff, 0x1ffc000000000, 0xff80000000000, 0x3eeffbc00000, 0xe000000, 0x0, 0x7ffffff000000000, 0x1400000000000007, 0xc00fe21fe, 0x5000000000000002, 0xc0080201e, 0x1000000000000006, 0x23000000023986, 0x1000000000000006, 0xc000021be, 0xd000000000000002, 0xc00c0201e, 0x4000000000000004, 0x802001, 0xc000000000000000, 0xc00603dc1, 0x9000000000000000, 0xc00603044, 0x4000000000000000, 0xc0080201e, 0x0, 0x805c8400, 0x7f2000000000000, 0x7f80, 0x1bf2000000000000, 0x3f00, 0x2a0000003000000, 0x7ffe000000000000, 0x1ffffffffeffe0df, 0x40, 0x66fde00000000000, 0x1e0001c3000000, 0x20002064, 0x0, 0x0, 0xe0000000, 0x0, 0x0, 0x1c0000001c0000, 0xc0000000c0000, 0x3fb0000000000000, 0x200ffe40, 0x3800, 0x0, 0x20000000000, 0x0, 0xe04018700000000, 0x0, 0x0, 0x0, 0x9800000, 0x9ff81fe57f400000, 0x0, 0x0, 0x17d000000000000f, 0xff80000000004, 0xb3c00000003, 0x3a34000000000, 0xcff00000000000, 0x0, 0x0, 0x1021fdfff70000, 0x0, 0x0, 0x0, 0xf000007fffffffff, 0x3000, 0x0, 0x0, 0x1ffffffff0000, 0x0, 0x0, 0x0, 0x3800000000000, 0x0, 0x8000000000000000, 0x0, 0xffffffff00000000, 0xfc0000000000, 0x0, 0x6000000, 0x0, 0x0, 0x3ff7800000000000, 0x80000000, 0x3000000000000, 0x6000000844, 0x0, 0x0, 0x3ffff00000010, 0x3fc000000000, 0x3ff80, 0x13c8000000000007, 0x0, 0x667e0000000000, 0x1008, 0xc19d000000000000, 0x40300000000002, 0x0, 0x0, 0x0, 0x212000000000, 0x40000000, 0x0, 0x0, 0x0, 0x7f0000ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x0, 0x2000000000000000, 0x870000000000f06e, 0x0, 0x0, 0x0, 0xff00000000000002, 0x7f, 0x678000000000003, 0x0, 0x1fef8000000007, 0x0, 0x7fc0000000000003, 0x0, 0x0, 0x0, 0xbf280000000000, 0x0, 0x0, 0x0, 0x78000, 0x0, 0x0, 0xf807c3a000000000, 0x3c0000000fe7, 0x0, 0x0, 0x1c, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff, 0x0, 0x0, 0x0, 0x0]); -+ -+} -+ -+ -+static if(size_t.sizeof == 4) { -+//832 bytes -+enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0x80], [ 0x100, 0x80, 0xa00], [ 0x0, 0x20100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x80001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x10000001, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x10, 0x1000000, 0x100000, 0x10000, 0x1000, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//832 bytes -+enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0x80], [ 0x100, 0x80, 0xa00], [ 0x0, 0x20100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x20001, 0x40003, 0x60005, 0x10007, 0x30002, 0x50004, 0x70006, 0x80001, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xeffffffe, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xffffffef, 0xfeffffff, 0xffefffff, 0xfffeffff, 0xffffefff, 0xfffffeff, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1536 bytes -+enum mcTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xc0], [ 0x100, 0x100, 0x1800], [ 0x2020100, 0x2020302, 0x5020204, 0x2060202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x60000, 0x7, 0x0, 0x0, 0x80000, 0x90000, 0xb000a, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf000e, 0x110010, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x130012, 0x0, 0x0, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x150000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0xc8000000, 0xde01, 0x0, 0xc, 0xc0000000, 0x801981, 0x0, 0x8, 0xc0000000, 0x1, 0x0, 0x8, 0xc0000000, 0x1a01, 0x0, 0xc, 0x40000000, 0x801981, 0x0, 0x0, 0xc0000000, 0x801dc6, 0x0, 0xe, 0x0, 0x1e, 0x0, 0xc, 0x40000000, 0x600d9f, 0x0, 0xc, 0xc0000000, 0x801dc1, 0x0, 0xc, 0x0, 0xff038000, 0xc0000, 0x0, 0xc0000000, 0x0, 0x80000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19021800, 0xc00000, 0x3f9c, 0x1c009f98, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0400000, 0x1bf, 0x0, 0x0, 0x1fb0e78, 0x0, 0x0, 0x0, 0xffff0000, 0x301, 0x0, 0x6000000, 0x0, 0xa00000, 0x7e01a, 0x0, 0x0, 0x0, 0x0, 0x10, 0xe8200000, 0x1b, 0x0, 0x4, 0x34c2, 0x0, 0xc5c80, 0x0, 0x300ff0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0002, 0x0, 0xc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x3, 0xfff00000, 0xf, 0x0, 0x0, 0x0, 0xc0000, 0x0, 0x8, 0xec300000, 0x1, 0x0, 0x0, 0x198000, 0x2000, 0x8000000, 0x0, 0x0, 0x0, 0x20c800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x16d8, 0x5, 0x0, 0x0, 0x0, 0x4, 0x1870000, 0x0, 0x0, 0x0, 0x1000, 0x0, 0x0, 0x4, 0x80380000, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40d000, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, 0x7fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7e060, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2336 bytes -+enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xe0], [ 0x100, 0x140, 0x2d00], [ 0x2020100, 0x4020302, 0x6020205, 0x2070202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020208, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xb000a, 0xd000c, 0xe, 0xf0000, 0x0, 0x100000, 0x120011, 0x140013, 0x160015, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x190018, 0x0, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b, 0x1d001c, 0x1f001e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x220021, 0x230000, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x260025, 0x0, 0x0, 0x27, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x280000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x290000, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, 0xbfffffff, 0xb6, 0x0, 0x7ff0000, 0x0, 0xfffff800, 0x10000, 0x0, 0x0, 0x9fc00000, 0x3d9f, 0x20000, 0xffff0000, 0x7ff, 0x0, 0x0, 0x1ffc0, 0x0, 0xff800, 0xfbc00000, 0x3eef, 0xe000000, 0x0, 0x0, 0x0, 0x0, 0x7ffffff0, 0x7, 0x14000000, 0xfe21fe, 0xc, 0x2, 0x50000000, 0x80201e, 0xc, 0x6, 0x10000000, 0x23986, 0x230000, 0x6, 0x10000000, 0x21be, 0xc, 0x2, 0xd0000000, 0xc0201e, 0xc, 0x4, 0x40000000, 0x802001, 0x0, 0x0, 0xc0000000, 0x603dc1, 0xc, 0x0, 0x90000000, 0x603044, 0xc, 0x0, 0x40000000, 0x80201e, 0xc, 0x0, 0x0, 0x805c8400, 0x0, 0x0, 0x7f20000, 0x7f80, 0x0, 0x0, 0x1bf20000, 0x3f00, 0x0, 0x3000000, 0x2a00000, 0x0, 0x7ffe0000, 0xfeffe0df, 0x1fffffff, 0x40, 0x0, 0x0, 0x66fde000, 0xc3000000, 0x1e0001, 0x20002064, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c0000, 0x1c0000, 0xc0000, 0xc0000, 0x0, 0x3fb00000, 0x200ffe40, 0x0, 0x3800, 0x0, 0x0, 0x0, 0x0, 0x200, 0x0, 0x0, 0x0, 0xe040187, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9800000, 0x0, 0x7f400000, 0x9ff81fe5, 0x0, 0x0, 0x0, 0x0, 0xf, 0x17d00000, 0x4, 0xff800, 0x3, 0xb3c, 0x0, 0x3a340, 0x0, 0xcff000, 0x0, 0x0, 0x0, 0x0, 0xfff70000, 0x1021fd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xf000007f, 0x3000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0x1ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38000, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x0, 0xffffffff, 0x0, 0xfc00, 0x0, 0x0, 0x6000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff78000, 0x80000000, 0x0, 0x0, 0x30000, 0x844, 0x60, 0x0, 0x0, 0x0, 0x0, 0x10, 0x3ffff, 0x0, 0x3fc0, 0x3ff80, 0x0, 0x7, 0x13c80000, 0x0, 0x0, 0x0, 0x667e00, 0x1008, 0x0, 0x0, 0xc19d0000, 0x2, 0x403000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2120, 0x40000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000, 0xf06e, 0x87000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0xff000000, 0x7f, 0x0, 0x3, 0x6780000, 0x0, 0x0, 0x7, 0x1fef80, 0x0, 0x0, 0x3, 0x7fc00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbf2800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x78000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf807c3a0, 0xfe7, 0x3c00, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+ -+} -+ ---- a/src/libphobos/src/std/internal/unicode_norm.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/internal/unicode_norm.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,28 @@ -+module std.internal.unicode_norm; -+import std.internal.unicode_tables; -+ -+static if(size_t.sizeof == 8) { -+//1600 bytes -+enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x60], [ 0x100, 0x100, 0x1a00], [ 0x302020202020100, 0x205020202020204, 0x602020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000000000, 0x200000000, 0x5000400030000, 0x8000000070006, 0xa0009, 0x0, 0xb000000000000, 0xc000000000000, 0xf0000000e000d, 0x0, 0x1000000000, 0x0, 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14001300120000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160015, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1800120012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10361f8081a9fdf, 0x401000000000003f, 0x80, 0x0, 0x0, 0x380000, 0x0, 0x0, 0x1000000000000000, 0xff000000, 0x4000000000000000, 0xb0800000, 0x48000000000000, 0x4e000000, 0x0, 0x0, 0x4000000000000000, 0x30c00000, 0x4000000000000000, 0x800000, 0x0, 0x400000, 0x0, 0x600004, 0x4000000000000000, 0x800000, 0x0, 0x80008400, 0x0, 0x168020010842008, 0x200108420080002, 0x0, 0x400000000000, 0x0, 0x0, 0x0, 0x0, 0x3ffffe00000000, 0xffffff0000000000, 0x7, 0x20000000000000, 0x0, 0x0, 0x0, 0x0, 0x2aaa000000000000, 0x4800000000000000, 0x2a00c80808080a00, 0x3, 0x0, 0x0, 0x0, 0xc4000000000, 0x0, 0x0, 0x0, 0x60000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x6000000, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffc657fe53fff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7ffc00a0000000, 0x7fdb, 0x0, 0x0, 0x0, 0x0, 0x400000000000000, 0x0, 0x8000000000, 0x0, 0x0, 0x0, 0x0, 0x1fc0000000, 0xf800000000000000, 0x1, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1920 bytes -+enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x70], [ 0x100, 0x140, 0x2000], [ 0x504030202020100, 0x207020202020206, 0x802020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x5000600050004, 0x9000800070005, 0xc0005000b000a, 0x500050005000d, 0x5000500050005, 0xe000500050005, 0x10000f00050005, 0x14001300120011, 0x5000500050005, 0x5001500050005, 0x5000500050005, 0x5000500050016, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x17001700170017, 0x18001700170017, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x1a001900170005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x50005001c001b, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x50005001d0005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5001e00170017, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x5000500050005, 0x0, 0x0, 0x0, 0xbe7effbf3e7effbf, 0x7ef1ff3ffffcffff, 0x7fffff3ffff3f1f8, 0x1800300000000, 0xff31ffcfdfffe000, 0xfffc0cfffffff, 0x0, 0x0, 0x0, 0x0, 0x401000000000001b, 0x1fc000001d7e0, 0x187c00, 0x20000000200708b, 0xc00000708b0000, 0x0, 0x33ffcfcfccf0006, 0x0, 0x0, 0x0, 0x0, 0x7c00000000, 0x0, 0x0, 0x80005, 0x12020000000000, 0xff000000, 0x0, 0xb0001800, 0x48000000000000, 0x4e000000, 0x0, 0x0, 0x0, 0x30001900, 0x100000, 0x1c00, 0x0, 0x100, 0x0, 0xd81, 0x0, 0x1c00, 0x0, 0x74000000, 0x0, 0x168020010842008, 0x200108420080002, 0x0, 0x4000000000, 0x0, 0x0, 0x0, 0x2800000000045540, 0xb, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0bffffff, 0x3ffffffffffffff, 0xffffffff3f3fffff, 0x3fffffffaaff3f3f, 0x5fdfffffffffffff, 0x3fdcffffefcfffde, 0x3, 0x0, 0x0, 0x0, 0xc4000000000, 0x0, 0x40000c000000, 0xe000, 0x5000001210, 0x333e00500000292, 0xf00000000333, 0x3c0f00000000, 0x60000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x36db02a555555000, 0x5555500040100000, 0x4790000036db02a5, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffff, 0x0, 0xfffffc657fe53fff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7ffc00a0000000, 0x7fdb, 0x0, 0x0, 0x0, 0x0, 0x80014000000, 0x0, 0xc00000000000, 0x0, 0x0, 0x0, 0x0, 0x1fc0000000, 0xf800000000000000, 0x1, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2560 bytes -+enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x70], [ 0x100, 0x140, 0x3400], [ 0x402030202020100, 0x706020202020205, 0x802020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x4000600050004, 0x9000800070004, 0xd000c000b000a, 0x40004000f000e, 0x4000400040004, 0x10000400040004, 0x13001200110004, 0x17001600150014, 0x4000400040018, 0x4001900040004, 0x1d001c001b001a, 0x210020001f001e, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x22000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x24002300210004, 0x27002600250021, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400290028, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x40004002a0004, 0x2e002d002c002b, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4002f00040004, 0x4003100300004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4003200210021, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x4000400040004, 0x0, 0x0, 0x773c850100000000, 0x0, 0x800c000000000000, 0x8000000000000201, 0x0, 0xe000000001ff0, 0x0, 0x0, 0x1ff000000000000, 0x1f3f000000, 0x10361f8081a9fdf, 0x441000000000003f, 0xb0, 0x2370000007f0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x1e0000000380000, 0x0, 0x0, 0x1000000000000000, 0xff000000, 0x4000000000000000, 0xb0800000, 0x48000000000000, 0x4e000000, 0x0, 0x0, 0x4000000000000000, 0x30c00000, 0x4000000000000000, 0x800000, 0x0, 0x400000, 0x0, 0x600004, 0x4000000000000000, 0x800000, 0x0, 0x80008400, 0x8000000000000, 0x0, 0x8000000000000, 0x30000000, 0x1000, 0x3e8020010842008, 0x200108420080002, 0x0, 0x400000000000, 0x0, 0x0, 0x1000000000000000, 0x0, 0x3ffffe00000000, 0xffffff0000000000, 0x7, 0x20000000000000, 0x0, 0x0, 0x0, 0xf7ff700000000000, 0x10007ffffffbfff, 0xfffffffff8000000, 0x0, 0x0, 0x0, 0xc000000, 0x0, 0x0, 0x2aaa000000000000, 0xe800000000000000, 0x6a00e808e808ea03, 0x50d88070008207ff, 0xfff3000080800380, 0x1001fff7fff, 0x0, 0xfbfbbd573e6ffeef, 0xffffffffffff03e1, 0x200, 0x0, 0x1b00000000000, 0x0, 0x0, 0x0, 0x60000000000, 0x0, 0x0, 0x0, 0x0, 0xffffffff00000000, 0xffffffffffffffff, 0x7ffffffffff, 0x1000, 0x70000000000000, 0x0, 0x10000000, 0x0, 0x3000000000000000, 0x0, 0x0, 0x0, 0x800000000000, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x8000000000000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffff, 0x740000000000001, 0x0, 0x9e000000, 0x8000000000000000, 0xfffe000000000000, 0xffffffffffffffff, 0xfffc7fff, 0x0, 0xffffffff7fffffff, 0x7fffffffffff00ff, 0xffffffffffffffff, 0x7fffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x1000000000000, 0x0, 0x300000000000000, 0xfffffc657fe53fff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7fffffa0f8007f, 0xffffffffffffffdb, 0x3ffffffffffff, 0xfffffffffff80000, 0x3fffffffffffffff, 0xffffffffffff0000, 0xfffffffffffcffff, 0x1fff0000000000ff, 0xffff000003ff0000, 0xffd70f7ffff7ff9f, 0xffffffffffffffff, 0x1fffffffffffffff, 0xfffffffffffffffe, 0xffffffffffffffff, 0x7fffffffffffffff, 0x7f7f1cfcfcfc, 0x0, 0x0, 0x400000000000000, 0x0, 0x8000000000, 0x0, 0x0, 0x0, 0x0, 0x1fc0000000, 0xf800000000000000, 0x1, 0xffffffffffffffff, 0xffffffffffdfffff, 0xebffde64dfffffff, 0xffffffffffffffef, 0x7bffffffdfdfe7bf, 0xfffffffffffdfc5f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffff3fffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffcfff, 0xaf7fe96ffffffef, 0x5ef7f796aa96ea84, 0xffffbee0ffffbff, 0x0, 0xffff7fffffff07ff, 0xc000000ffff, 0x10000, 0x0, 0x7ffffffffff0007, 0x301ff, 0x0, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2656 bytes -+enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x78], [ 0x100, 0x160, 0x3500], [ 0x504030202020100, 0x807020202020206, 0x902020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x7000600050004, 0xa000900080007, 0xe000d000c000b, 0x700070007000f, 0x7000700070007, 0x10000700070007, 0x13001200110007, 0x17001600150014, 0x7000700070018, 0x7001900070007, 0x1d001c001b001a, 0x210020001f001e, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x22000700070007, 0x7000700070007, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x21002100210021, 0x23002100210021, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x25002400210007, 0x28002700260021, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x70007002a0029, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x70007002b0007, 0x2f002e002d002c, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7003000070007, 0x7003200310007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7003300210021, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x7000700070007, 0x0, 0x0, 0x773c850100000000, 0xbe7effbf3e7effbf, 0xfefdff3ffffcffff, 0xffffff3ffff3f3f9, 0x1800300000000, 0xff3fffcfdffffff0, 0xfffc0cfffffff, 0x0, 0x1ff000000000000, 0x1f3f000000, 0x0, 0x441000000000001b, 0x1fc000001d7f0, 0x2370000007f7c00, 0x20000000200708b, 0xc00000708b0000, 0x0, 0x33ffcfcfccf0006, 0x0, 0x0, 0x80, 0x0, 0x7c00000000, 0x1e0000000000000, 0x0, 0x80005, 0x0, 0x0, 0x0, 0x0, 0x12020000000000, 0xff000000, 0x0, 0xb0001800, 0x48000000000000, 0x4e000000, 0x0, 0x0, 0x0, 0x30001900, 0x100000, 0x1c00, 0x0, 0x100, 0x0, 0xd81, 0x0, 0x1c00, 0x0, 0x74000000, 0x8000000000000, 0x0, 0x8000000000000, 0x30000000, 0x1000, 0x3e8020010842008, 0x200108420080002, 0x0, 0x4000000000, 0x0, 0x0, 0x1000000000000000, 0x2800000000045540, 0xb, 0x0, 0x0, 0xf7ff700000000000, 0x10007ffffffbfff, 0xfffffffff8000000, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0fffffff, 0x3ffffffffffffff, 0xffffffff3f3fffff, 0x3fffffffaaff3f3f, 0xffdfffffffffffff, 0x7fdcffffefcfffdf, 0x50d88070008207ff, 0xfff3000080800380, 0x1001fff7fff, 0x0, 0xfbfbbd573e6ffeef, 0xffffffffffff03e1, 0x40000c000200, 0xe000, 0x1b05000001210, 0x333e00500000292, 0xf00000000333, 0x3c0f00000000, 0x60000000000, 0x0, 0x0, 0x0, 0x0, 0xffffffff00000000, 0xffffffffffffffff, 0x7ffffffffff, 0x1000, 0x70000000000000, 0x0, 0x10000000, 0x0, 0x3000000000000000, 0x0, 0x0, 0x0, 0x800000000000, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x8000000000000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffff, 0x740000000000001, 0x36db02a555555000, 0x55555000d8100000, 0xc790000036db02a5, 0xfffe000000000000, 0xffffffffffffffff, 0xfffc7fff, 0x0, 0xffffffff7fffffff, 0x7fffffffffff00ff, 0xffffffffffffffff, 0x7fffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0x1000000000000, 0x0, 0x300000000000000, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffff, 0x0, 0xfffffc657fe53fff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7fffffa0f8007f, 0xffffffffffffffdb, 0x3ffffffffffff, 0xfffffffffff80000, 0x3fffffffffffffff, 0xffffffffffff0000, 0xfffffffffffcffff, 0x1fff0000000000ff, 0xffff000003ff0000, 0xffd70f7ffff7ff9f, 0xffffffffffffffff, 0x1fffffffffffffff, 0xfffffffffffffffe, 0xffffffffffffffff, 0x7fffffffffffffff, 0x7f7f1cfcfcfc, 0x0, 0x0, 0x80014000000, 0x0, 0xc00000000000, 0x0, 0x0, 0x0, 0x0, 0x1fc0000000, 0xf800000000000000, 0x1, 0xffffffffffffffff, 0xffffffffffdfffff, 0xebffde64dfffffff, 0xffffffffffffffef, 0x7bffffffdfdfe7bf, 0xfffffffffffdfc5f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffff3fffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffcfff, 0xaf7fe96ffffffef, 0x5ef7f796aa96ea84, 0xffffbee0ffffbff, 0x0, 0xffff7fffffff07ff, 0xc000000ffff, 0x10000, 0x0, 0x7ffffffffff0007, 0x301ff, 0x0, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+ -+} -+ -+ -+static if(size_t.sizeof == 4) { -+//1600 bytes -+enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xc0], [ 0x100, 0x100, 0x1a00], [ 0x2020100, 0x3020202, 0x2020204, 0x2050202, 0x2020202, 0x6020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x2, 0x30000, 0x50004, 0x70006, 0x80000, 0xa0009, 0x0, 0x0, 0x0, 0x0, 0xb0000, 0x0, 0xc0000, 0xe000d, 0xf0000, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x120000, 0x140013, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160015, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x120012, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x81a9fdf, 0x10361f8, 0x3f, 0x40100000, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x380000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0xff000000, 0x0, 0x0, 0x40000000, 0xb0800000, 0x0, 0x0, 0x480000, 0x4e000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40000000, 0x30c00000, 0x0, 0x0, 0x40000000, 0x800000, 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x600004, 0x0, 0x0, 0x40000000, 0x800000, 0x0, 0x0, 0x0, 0x80008400, 0x0, 0x0, 0x0, 0x10842008, 0x1680200, 0x20080002, 0x2001084, 0x0, 0x0, 0x0, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ffffe, 0x0, 0xffffff00, 0x7, 0x0, 0x0, 0x200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2aaa0000, 0x0, 0x48000000, 0x8080a00, 0x2a00c808, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6000000, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fe53fff, 0xfffffc65, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xa0000000, 0x5f7ffc00, 0x7fdb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4000000, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x1f, 0x0, 0xf8000000, 0x1, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1920 bytes -+enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xe0], [ 0x100, 0x140, 0x2000], [ 0x2020100, 0x5040302, 0x2020206, 0x2070202, 0x2020202, 0x8020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x50006, 0x70005, 0x90008, 0xb000a, 0xc0005, 0x5000d, 0x50005, 0x50005, 0x50005, 0x50005, 0xe0005, 0x50005, 0x10000f, 0x120011, 0x140013, 0x50005, 0x50005, 0x50005, 0x50015, 0x50005, 0x50005, 0x50016, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x170017, 0x180017, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x170005, 0x1a0019, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x1c001b, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x1d0005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x170017, 0x5001e, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x50005, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e7effbf, 0xbe7effbf, 0xfffcffff, 0x7ef1ff3f, 0xfff3f1f8, 0x7fffff3f, 0x0, 0x18003, 0xdfffe000, 0xff31ffcf, 0xcfffffff, 0xfffc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b, 0x40100000, 0x1d7e0, 0x1fc00, 0x187c00, 0x0, 0x200708b, 0x2000000, 0x708b0000, 0xc00000, 0x0, 0x0, 0xfccf0006, 0x33ffcfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x0, 0x80005, 0x0, 0x0, 0x120200, 0xff000000, 0x0, 0x0, 0x0, 0xb0001800, 0x0, 0x0, 0x480000, 0x4e000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30001900, 0x0, 0x100000, 0x0, 0x1c00, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0xd81, 0x0, 0x0, 0x0, 0x1c00, 0x0, 0x0, 0x0, 0x74000000, 0x0, 0x0, 0x0, 0x10842008, 0x1680200, 0x20080002, 0x2001084, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45540, 0x28000000, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xbffffff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x3f3fffff, 0xffffffff, 0xaaff3f3f, 0x3fffffff, 0xffffffff, 0x5fdfffff, 0xefcfffde, 0x3fdcffff, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc40, 0x0, 0x0, 0xc000000, 0x4000, 0xe000, 0x0, 0x1210, 0x50, 0x292, 0x333e005, 0x333, 0xf000, 0x0, 0x3c0f, 0x0, 0x600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x55555000, 0x36db02a5, 0x40100000, 0x55555000, 0x36db02a5, 0x47900000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf, 0x0, 0x0, 0x7fe53fff, 0xfffffc65, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xa0000000, 0x5f7ffc00, 0x7fdb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14000000, 0x800, 0x0, 0x0, 0x0, 0xc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x1f, 0x0, 0xf8000000, 0x1, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2560 bytes -+enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xe0], [ 0x100, 0x140, 0x3400], [ 0x2020100, 0x4020302, 0x2020205, 0x7060202, 0x2020202, 0x8020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x40006, 0x70004, 0x90008, 0xb000a, 0xd000c, 0xf000e, 0x40004, 0x40004, 0x40004, 0x40004, 0x100004, 0x110004, 0x130012, 0x150014, 0x170016, 0x40018, 0x40004, 0x40004, 0x40019, 0x1b001a, 0x1d001c, 0x1f001e, 0x210020, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x220004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x210004, 0x240023, 0x250021, 0x270026, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x290028, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x2a0004, 0x40004, 0x2c002b, 0x2e002d, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x4002f, 0x300004, 0x40031, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x210021, 0x40032, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x40004, 0x0, 0x0, 0x0, 0x0, 0x0, 0x773c8501, 0x0, 0x0, 0x0, 0x800c0000, 0x201, 0x80000000, 0x0, 0x0, 0x1ff0, 0xe0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ff0000, 0x3f000000, 0x1f, 0x81a9fdf, 0x10361f8, 0x3f, 0x44100000, 0xb0, 0x0, 0x7f0000, 0x2370000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x380000, 0x1e00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0xff000000, 0x0, 0x0, 0x40000000, 0xb0800000, 0x0, 0x0, 0x480000, 0x4e000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40000000, 0x30c00000, 0x0, 0x0, 0x40000000, 0x800000, 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x600004, 0x0, 0x0, 0x40000000, 0x800000, 0x0, 0x0, 0x0, 0x80008400, 0x0, 0x0, 0x80000, 0x0, 0x0, 0x0, 0x80000, 0x30000000, 0x0, 0x1000, 0x0, 0x10842008, 0x3e80200, 0x20080002, 0x2001084, 0x0, 0x0, 0x0, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x3ffffe, 0x0, 0xffffff00, 0x7, 0x0, 0x0, 0x200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf7ff7000, 0xffffbfff, 0x10007ff, 0xf8000000, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2aaa0000, 0x0, 0xe8000000, 0xe808ea03, 0x6a00e808, 0x8207ff, 0x50d88070, 0x80800380, 0xfff30000, 0x1fff7fff, 0x100, 0x0, 0x0, 0x3e6ffeef, 0xfbfbbd57, 0xffff03e1, 0xffffffff, 0x200, 0x0, 0x0, 0x0, 0x0, 0x1b000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7ff, 0x1000, 0x0, 0x0, 0x700000, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x0, 0x30000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x80000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0x0, 0x1, 0x7400000, 0x0, 0x0, 0x9e000000, 0x0, 0x0, 0x80000000, 0x0, 0xfffe0000, 0xffffffff, 0xffffffff, 0xfffc7fff, 0x0, 0x0, 0x0, 0x7fffffff, 0xffffffff, 0xffff00ff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x3000000, 0x7fe53fff, 0xfffffc65, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xa0f8007f, 0x5f7fffff, 0xffffffdb, 0xffffffff, 0xffffffff, 0x3ffff, 0xfff80000, 0xffffffff, 0xffffffff, 0x3fffffff, 0xffff0000, 0xffffffff, 0xfffcffff, 0xffffffff, 0xff, 0x1fff0000, 0x3ff0000, 0xffff0000, 0xfff7ff9f, 0xffd70f7f, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x1cfcfcfc, 0x7f7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4000000, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x1f, 0x0, 0xf8000000, 0x1, 0x0, 0xffffffff, 0xffffffff, 0xffdfffff, 0xffffffff, 0xdfffffff, 0xebffde64, 0xffffffef, 0xffffffff, 0xdfdfe7bf, 0x7bffffff, 0xfffdfc5f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff3f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffcfff, 0xffffffff, 0xffffffef, 0xaf7fe96, 0xaa96ea84, 0x5ef7f796, 0xffffbff, 0xffffbee, 0x0, 0x0, 0xffff07ff, 0xffff7fff, 0xffff, 0xc00, 0x10000, 0x0, 0x0, 0x0, 0xffff0007, 0x7ffffff, 0x301ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2656 bytes -+enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xf0], [ 0x100, 0x160, 0x3500], [ 0x2020100, 0x5040302, 0x2020206, 0x8070202, 0x2020202, 0x9020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x80007, 0xa0009, 0xc000b, 0xe000d, 0x7000f, 0x70007, 0x70007, 0x70007, 0x70007, 0x100007, 0x110007, 0x130012, 0x150014, 0x170016, 0x70018, 0x70007, 0x70007, 0x70019, 0x1b001a, 0x1d001c, 0x1f001e, 0x210020, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x220007, 0x70007, 0x70007, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x210021, 0x230021, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x210007, 0x250024, 0x260021, 0x280027, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x2a0029, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x2b0007, 0x70007, 0x2d002c, 0x2f002e, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70030, 0x310007, 0x70032, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x210021, 0x70033, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x70007, 0x0, 0x0, 0x0, 0x0, 0x0, 0x773c8501, 0x3e7effbf, 0xbe7effbf, 0xfffcffff, 0xfefdff3f, 0xfff3f3f9, 0xffffff3f, 0x0, 0x18003, 0xdffffff0, 0xff3fffcf, 0xcfffffff, 0xfffc0, 0x0, 0x0, 0x0, 0x1ff0000, 0x3f000000, 0x1f, 0x0, 0x0, 0x1b, 0x44100000, 0x1d7f0, 0x1fc00, 0x7f7c00, 0x2370000, 0x200708b, 0x2000000, 0x708b0000, 0xc00000, 0x0, 0x0, 0xfccf0006, 0x33ffcfc, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x1e00000, 0x0, 0x0, 0x80005, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x120200, 0xff000000, 0x0, 0x0, 0x0, 0xb0001800, 0x0, 0x0, 0x480000, 0x4e000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30001900, 0x0, 0x100000, 0x0, 0x1c00, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0xd81, 0x0, 0x0, 0x0, 0x1c00, 0x0, 0x0, 0x0, 0x74000000, 0x0, 0x0, 0x80000, 0x0, 0x0, 0x0, 0x80000, 0x30000000, 0x0, 0x1000, 0x0, 0x10842008, 0x3e80200, 0x20080002, 0x2001084, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000000, 0x45540, 0x28000000, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf7ff7000, 0xffffbfff, 0x10007ff, 0xf8000000, 0xffffffff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x3f3fffff, 0xffffffff, 0xaaff3f3f, 0x3fffffff, 0xffffffff, 0xffdfffff, 0xefcfffdf, 0x7fdcffff, 0x8207ff, 0x50d88070, 0x80800380, 0xfff30000, 0x1fff7fff, 0x100, 0x0, 0x0, 0x3e6ffeef, 0xfbfbbd57, 0xffff03e1, 0xffffffff, 0xc000200, 0x4000, 0xe000, 0x0, 0x1210, 0x1b050, 0x292, 0x333e005, 0x333, 0xf000, 0x0, 0x3c0f, 0x0, 0x600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7ff, 0x1000, 0x0, 0x0, 0x700000, 0x0, 0x0, 0x10000000, 0x0, 0x0, 0x0, 0x0, 0x30000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x80000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0x0, 0x1, 0x7400000, 0x55555000, 0x36db02a5, 0xd8100000, 0x55555000, 0x36db02a5, 0xc7900000, 0x0, 0xfffe0000, 0xffffffff, 0xffffffff, 0xfffc7fff, 0x0, 0x0, 0x0, 0x7fffffff, 0xffffffff, 0xffff00ff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x3000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf, 0x0, 0x0, 0x7fe53fff, 0xfffffc65, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xa0f8007f, 0x5f7fffff, 0xffffffdb, 0xffffffff, 0xffffffff, 0x3ffff, 0xfff80000, 0xffffffff, 0xffffffff, 0x3fffffff, 0xffff0000, 0xffffffff, 0xfffcffff, 0xffffffff, 0xff, 0x1fff0000, 0x3ff0000, 0xffff0000, 0xfff7ff9f, 0xffd70f7f, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x1cfcfcfc, 0x7f7f, 0x0, 0x0, 0x0, 0x0, 0x14000000, 0x800, 0x0, 0x0, 0x0, 0xc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x1f, 0x0, 0xf8000000, 0x1, 0x0, 0xffffffff, 0xffffffff, 0xffdfffff, 0xffffffff, 0xdfffffff, 0xebffde64, 0xffffffef, 0xffffffff, 0xdfdfe7bf, 0x7bffffff, 0xfffdfc5f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff3f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffcfff, 0xffffffff, 0xffffffef, 0xaf7fe96, 0xaa96ea84, 0x5ef7f796, 0xffffbff, 0xffffbee, 0x0, 0x0, 0xffff07ff, 0xffff7fff, 0xffff, 0xc00, 0x10000, 0x0, 0x0, 0x0, 0xffff0007, 0x7ffffff, 0x301ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+ -+} -+ ---- a/src/libphobos/src/std/internal/unicode_tables.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/internal/unicode_tables.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,2357 @@ -+//Written in the D programming language -+/** -+ * License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). -+ * -+ * Authors: Dmitry Olshansky -+ * -+ */ -+//Automatically generated from Unicode Character Database files -+ -+module std.internal.unicode_tables; -+@safe pure nothrow: -+ -+ -+struct SimpleCaseEntry -+{ -+ uint ch; -+ ubyte n, bucket;// n - number in bucket -+ @property ubyte size() const -+ { -+ return bucket & 0x3F; -+ } -+ @property auto isLower() const -+ { -+ return bucket & 0x40; -+ } -+ @property auto isUpper() const -+ { -+ return bucket & 0x80; -+ } -+} -+ -+struct FullCaseEntry -+{ -+ dchar[3] seq; -+ ubyte n, size;// n number in batch, size - size of batch -+ ubyte entry_len; -+ -+ @property auto value() const @trusted -+ { -+ return seq[0..entry_len]; -+ } -+} -+ -+struct CompEntry -+{ -+ dchar rhs, composed; -+} -+ -+struct UnicodeProperty -+{ -+ string name; -+ ubyte[] compressed; -+} -+ -+struct TrieEntry(T...) -+{ -+ size_t[] offsets; -+ size_t[] sizes; -+ size_t[] data; -+} -+ -+@property immutable(SimpleCaseEntry[]) simpleCaseTable() -+{ -+alias SCE = SimpleCaseEntry; -+static immutable SCE[] t = [ -+SCE(0x2c00, 0, 0x82), -+SCE(0x2c30, 1, 0x42),SCE(0x24c3, 0, 0x82),SCE(0x24dd, 1, 0x42),SCE(0x2c01, 0, 0x82), -+SCE(0x2c31, 1, 0x42),SCE(0x2c1d, 0, 0x82),SCE(0x2c4d, 1, 0x42),SCE(0x2c02, 0, 0x82), -+SCE(0x2c32, 1, 0x42),SCE(0x2c03, 0, 0x82),SCE(0x2c33, 1, 0x42),SCE(0x2c04, 0, 0x82), -+SCE(0x2c34, 1, 0x42),SCE(0x2c05, 0, 0x82),SCE(0x2c35, 1, 0x42),SCE(0x2c06, 0, 0x82), -+SCE(0x2c36, 1, 0x42),SCE(0x10400, 0, 0x82),SCE(0x10428, 1, 0x42),SCE(0x2cc2, 0, 0x82), -+SCE(0x2cc3, 1, 0x42),SCE(0x2c07, 0, 0x82),SCE(0x2c37, 1, 0x42),SCE(0x2c08, 0, 0x82), -+SCE(0x2c38, 1, 0x42),SCE(0x2c09, 0, 0x82),SCE(0x2c39, 1, 0x42),SCE(0x2c0a, 0, 0x82), -+SCE(0x2c3a, 1, 0x42),SCE(0xa68c, 0, 0x82),SCE(0xa68d, 1, 0x42),SCE(0x0041, 0, 0x82), -+SCE(0x0061, 1, 0x42),SCE(0x0042, 0, 0x82),SCE(0x0062, 1, 0x42),SCE(0x0043, 0, 0x82), -+SCE(0x0063, 1, 0x42),SCE(0x0044, 0, 0x82),SCE(0x0064, 1, 0x42),SCE(0x0045, 0, 0x82), -+SCE(0x0065, 1, 0x42),SCE(0x0046, 0, 0x82),SCE(0x0066, 1, 0x42),SCE(0x0047, 0, 0x82), -+SCE(0x0067, 1, 0x42),SCE(0x0048, 0, 0x82),SCE(0x0068, 1, 0x42),SCE(0x0049, 0, 0x82), -+SCE(0x0069, 1, 0x42),SCE(0x004a, 0, 0x82),SCE(0x006a, 1, 0x42),SCE(0x004b, 0, 0x83), -+SCE(0x006b, 1, 0x43),SCE(0x212a, 2, 0x83),SCE(0x004c, 0, 0x82),SCE(0x006c, 1, 0x42), -+SCE(0x004d, 0, 0x82),SCE(0x006d, 1, 0x42),SCE(0x004e, 0, 0x82),SCE(0x006e, 1, 0x42), -+SCE(0x004f, 0, 0x82),SCE(0x006f, 1, 0x42),SCE(0x0050, 0, 0x82),SCE(0x0070, 1, 0x42), -+SCE(0x0051, 0, 0x82),SCE(0x0071, 1, 0x42),SCE(0x0052, 0, 0x82),SCE(0x0072, 1, 0x42), -+SCE(0x0053, 0, 0x83),SCE(0x0073, 1, 0x43),SCE(0x017f, 2, 0x43),SCE(0x0054, 0, 0x82), -+SCE(0x0074, 1, 0x42),SCE(0x0055, 0, 0x82),SCE(0x0075, 1, 0x42),SCE(0x0056, 0, 0x82), -+SCE(0x0076, 1, 0x42),SCE(0x0057, 0, 0x82),SCE(0x0077, 1, 0x42),SCE(0x0058, 0, 0x82), -+SCE(0x0078, 1, 0x42),SCE(0x0059, 0, 0x82),SCE(0x0079, 1, 0x42),SCE(0x005a, 0, 0x82), -+SCE(0x007a, 1, 0x42),SCE(0x2c0f, 0, 0x82),SCE(0x2c3f, 1, 0x42),SCE(0x2c10, 0, 0x82), -+SCE(0x2c40, 1, 0x42),SCE(0x10402, 0, 0x82),SCE(0x1042a, 1, 0x42),SCE(0x2cc4, 0, 0x82), -+SCE(0x2cc5, 1, 0x42),SCE(0x2166, 0, 0x82),SCE(0x2176, 1, 0x42),SCE(0x2c11, 0, 0x82), -+SCE(0x2c41, 1, 0x42),SCE(0x2c12, 0, 0x82),SCE(0x2c42, 1, 0x42),SCE(0x2168, 0, 0x82), -+SCE(0x2178, 1, 0x42),SCE(0x2c13, 0, 0x82),SCE(0x2c43, 1, 0x42),SCE(0xa682, 0, 0x82), -+SCE(0xa683, 1, 0x42),SCE(0x2c14, 0, 0x82),SCE(0x2c44, 1, 0x42),SCE(0x216a, 0, 0x82), -+SCE(0x217a, 1, 0x42),SCE(0x24c7, 0, 0x82),SCE(0x24e1, 1, 0x42),SCE(0x2c15, 0, 0x82), -+SCE(0x2c45, 1, 0x42),SCE(0x10403, 0, 0x82),SCE(0x1042b, 1, 0x42),SCE(0x2c16, 0, 0x82), -+SCE(0x2c46, 1, 0x42),SCE(0x216c, 0, 0x82),SCE(0x217c, 1, 0x42),SCE(0x2c17, 0, 0x82), -+SCE(0x2c47, 1, 0x42),SCE(0xff38, 0, 0x82),SCE(0xff58, 1, 0x42),SCE(0x2c18, 0, 0x82), -+SCE(0x2c48, 1, 0x42),SCE(0x216e, 0, 0x82),SCE(0x217e, 1, 0x42),SCE(0x2c19, 0, 0x82), -+SCE(0x2c49, 1, 0x42),SCE(0x2c1a, 0, 0x82),SCE(0x2c4a, 1, 0x42),SCE(0x2c1e, 0, 0x82), -+SCE(0x2c4e, 1, 0x42),SCE(0x10a0, 0, 0x82),SCE(0x2d00, 1, 0x42),SCE(0x10a1, 0, 0x82), -+SCE(0x2d01, 1, 0x42),SCE(0x10a2, 0, 0x82),SCE(0x2d02, 1, 0x42),SCE(0x10a3, 0, 0x82), -+SCE(0x2d03, 1, 0x42),SCE(0x10a4, 0, 0x82),SCE(0x2d04, 1, 0x42),SCE(0x10a5, 0, 0x82), -+SCE(0x2d05, 1, 0x42),SCE(0x10a6, 0, 0x82),SCE(0x2d06, 1, 0x42),SCE(0x10a7, 0, 0x82), -+SCE(0x2d07, 1, 0x42),SCE(0x10a8, 0, 0x82),SCE(0x2d08, 1, 0x42),SCE(0x10a9, 0, 0x82), -+SCE(0x2d09, 1, 0x42),SCE(0x10aa, 0, 0x82),SCE(0x2d0a, 1, 0x42),SCE(0x10ab, 0, 0x82), -+SCE(0x2d0b, 1, 0x42),SCE(0x10ac, 0, 0x82),SCE(0x2d0c, 1, 0x42),SCE(0x10ad, 0, 0x82), -+SCE(0x2d0d, 1, 0x42),SCE(0x10ae, 0, 0x82),SCE(0x2d0e, 1, 0x42),SCE(0x10af, 0, 0x82), -+SCE(0x2d0f, 1, 0x42),SCE(0x10b0, 0, 0x82),SCE(0x2d10, 1, 0x42),SCE(0x10b1, 0, 0x82), -+SCE(0x2d11, 1, 0x42),SCE(0x10b2, 0, 0x82),SCE(0x2d12, 1, 0x42),SCE(0x10b3, 0, 0x82), -+SCE(0x2d13, 1, 0x42),SCE(0x10b4, 0, 0x82),SCE(0x2d14, 1, 0x42),SCE(0x10b5, 0, 0x82), -+SCE(0x2d15, 1, 0x42),SCE(0x10b6, 0, 0x82),SCE(0x2d16, 1, 0x42),SCE(0x10b7, 0, 0x82), -+SCE(0x2d17, 1, 0x42),SCE(0x10b8, 0, 0x82),SCE(0x2d18, 1, 0x42),SCE(0x10b9, 0, 0x82), -+SCE(0x2d19, 1, 0x42),SCE(0x10ba, 0, 0x82),SCE(0x2d1a, 1, 0x42),SCE(0x10bb, 0, 0x82), -+SCE(0x2d1b, 1, 0x42),SCE(0x10bc, 0, 0x82),SCE(0x2d1c, 1, 0x42),SCE(0x10bd, 0, 0x82), -+SCE(0x2d1d, 1, 0x42),SCE(0x10be, 0, 0x82),SCE(0x2d1e, 1, 0x42),SCE(0x10bf, 0, 0x82), -+SCE(0x2d1f, 1, 0x42),SCE(0x00c0, 0, 0x82),SCE(0x00e0, 1, 0x42),SCE(0x00c1, 0, 0x82), -+SCE(0x00e1, 1, 0x42),SCE(0x10c2, 0, 0x82),SCE(0x2d22, 1, 0x42),SCE(0x00c3, 0, 0x82), -+SCE(0x00e3, 1, 0x42),SCE(0x10c4, 0, 0x82),SCE(0x2d24, 1, 0x42),SCE(0x00c5, 0, 0x83), -+SCE(0x00e5, 1, 0x43),SCE(0x212b, 2, 0x83),SCE(0x00c6, 0, 0x82),SCE(0x00e6, 1, 0x42), -+SCE(0x00c7, 0, 0x82),SCE(0x00e7, 1, 0x42),SCE(0x00c8, 0, 0x82),SCE(0x00e8, 1, 0x42), -+SCE(0x00c9, 0, 0x82),SCE(0x00e9, 1, 0x42),SCE(0x00ca, 0, 0x82),SCE(0x00ea, 1, 0x42), -+SCE(0x00cb, 0, 0x82),SCE(0x00eb, 1, 0x42),SCE(0x00cc, 0, 0x82),SCE(0x00ec, 1, 0x42), -+SCE(0x00cd, 0, 0x82),SCE(0x00ed, 1, 0x42),SCE(0x00ce, 0, 0x82),SCE(0x00ee, 1, 0x42), -+SCE(0x00cf, 0, 0x82),SCE(0x00ef, 1, 0x42),SCE(0x00d0, 0, 0x82),SCE(0x00f0, 1, 0x42), -+SCE(0x00d1, 0, 0x82),SCE(0x00f1, 1, 0x42),SCE(0x00d2, 0, 0x82),SCE(0x00f2, 1, 0x42), -+SCE(0x00d3, 0, 0x82),SCE(0x00f3, 1, 0x42),SCE(0x00d4, 0, 0x82),SCE(0x00f4, 1, 0x42), -+SCE(0x00d5, 0, 0x82),SCE(0x00f5, 1, 0x42),SCE(0x00d6, 0, 0x82),SCE(0x00f6, 1, 0x42), -+SCE(0x00d8, 0, 0x82),SCE(0x00f8, 1, 0x42),SCE(0x00d9, 0, 0x82),SCE(0x00f9, 1, 0x42), -+SCE(0x00da, 0, 0x82),SCE(0x00fa, 1, 0x42),SCE(0x00db, 0, 0x82),SCE(0x00fb, 1, 0x42), -+SCE(0x00dc, 0, 0x82),SCE(0x00fc, 1, 0x42),SCE(0x00dd, 0, 0x82),SCE(0x00fd, 1, 0x42), -+SCE(0x00de, 0, 0x82),SCE(0x00fe, 1, 0x42),SCE(0x2c25, 0, 0x82),SCE(0x2c55, 1, 0x42), -+SCE(0x2c26, 0, 0x82),SCE(0x2c56, 1, 0x42),SCE(0x2c27, 0, 0x82),SCE(0x2c57, 1, 0x42), -+SCE(0x2c28, 0, 0x82),SCE(0x2c58, 1, 0x42),SCE(0x1040f, 0, 0x82),SCE(0x10437, 1, 0x42), -+SCE(0x24cb, 0, 0x82),SCE(0x24e5, 1, 0x42),SCE(0x2c29, 0, 0x82),SCE(0x2c59, 1, 0x42), -+SCE(0x10407, 0, 0x82),SCE(0x1042f, 1, 0x42),SCE(0x2c2a, 0, 0x82),SCE(0x2c5a, 1, 0x42), -+SCE(0x0100, 0, 0x82),SCE(0x0101, 1, 0x42),SCE(0x0102, 0, 0x82),SCE(0x0103, 1, 0x42), -+SCE(0x2c2b, 0, 0x82),SCE(0x2c5b, 1, 0x42),SCE(0x0104, 0, 0x82),SCE(0x0105, 1, 0x42), -+SCE(0x0106, 0, 0x82),SCE(0x0107, 1, 0x42),SCE(0x0108, 0, 0x82),SCE(0x0109, 1, 0x42), -+SCE(0x2c2c, 0, 0x82),SCE(0x2c5c, 1, 0x42),SCE(0x010a, 0, 0x82),SCE(0x010b, 1, 0x42), -+SCE(0x010c, 0, 0x82),SCE(0x010d, 1, 0x42),SCE(0x010e, 0, 0x82),SCE(0x010f, 1, 0x42), -+SCE(0x2c2d, 0, 0x82),SCE(0x2c5d, 1, 0x42),SCE(0x0110, 0, 0x82),SCE(0x0111, 1, 0x42), -+SCE(0x0112, 0, 0x82),SCE(0x0113, 1, 0x42),SCE(0x0114, 0, 0x82),SCE(0x0115, 1, 0x42), -+SCE(0x2c2e, 0, 0x82),SCE(0x2c5e, 1, 0x42),SCE(0x0116, 0, 0x82),SCE(0x0117, 1, 0x42), -+SCE(0x0118, 0, 0x82),SCE(0x0119, 1, 0x42),SCE(0x011a, 0, 0x82),SCE(0x011b, 1, 0x42), -+SCE(0x011c, 0, 0x82),SCE(0x011d, 1, 0x42),SCE(0x011e, 0, 0x82),SCE(0x011f, 1, 0x42), -+SCE(0x0120, 0, 0x82),SCE(0x0121, 1, 0x42),SCE(0x0122, 0, 0x82),SCE(0x0123, 1, 0x42), -+SCE(0x0124, 0, 0x82),SCE(0x0125, 1, 0x42),SCE(0x0126, 0, 0x82),SCE(0x0127, 1, 0x42), -+SCE(0x0128, 0, 0x82),SCE(0x0129, 1, 0x42),SCE(0x012a, 0, 0x82),SCE(0x012b, 1, 0x42), -+SCE(0x00c5, 0, 0x83),SCE(0x00e5, 1, 0x43),SCE(0x212b, 2, 0x83),SCE(0x012c, 0, 0x82), -+SCE(0x012d, 1, 0x42),SCE(0x012e, 0, 0x82),SCE(0x012f, 1, 0x42),SCE(0x0132, 0, 0x82), -+SCE(0x0133, 1, 0x42),SCE(0x0134, 0, 0x82),SCE(0x0135, 1, 0x42),SCE(0x0136, 0, 0x82), -+SCE(0x0137, 1, 0x42),SCE(0x0139, 0, 0x82),SCE(0x013a, 1, 0x42),SCE(0x013b, 0, 0x82), -+SCE(0x013c, 1, 0x42),SCE(0x2cde, 0, 0x82),SCE(0x2cdf, 1, 0x42),SCE(0x013d, 0, 0x82), -+SCE(0x013e, 1, 0x42),SCE(0x013f, 0, 0x82),SCE(0x0140, 1, 0x42),SCE(0x0141, 0, 0x82), -+SCE(0x0142, 1, 0x42),SCE(0x0143, 0, 0x82),SCE(0x0144, 1, 0x42),SCE(0x0145, 0, 0x82), -+SCE(0x0146, 1, 0x42),SCE(0x0147, 0, 0x82),SCE(0x0148, 1, 0x42),SCE(0x014a, 0, 0x82), -+SCE(0x014b, 1, 0x42),SCE(0x014c, 0, 0x82),SCE(0x014d, 1, 0x42),SCE(0x014e, 0, 0x82), -+SCE(0x014f, 1, 0x42),SCE(0x0150, 0, 0x82),SCE(0x0151, 1, 0x42),SCE(0x0152, 0, 0x82), -+SCE(0x0153, 1, 0x42),SCE(0x0154, 0, 0x82),SCE(0x0155, 1, 0x42),SCE(0x0156, 0, 0x82), -+SCE(0x0157, 1, 0x42),SCE(0x0158, 0, 0x82),SCE(0x0159, 1, 0x42),SCE(0x015a, 0, 0x82), -+SCE(0x015b, 1, 0x42),SCE(0x015c, 0, 0x82),SCE(0x015d, 1, 0x42),SCE(0x015e, 0, 0x82), -+SCE(0x015f, 1, 0x42),SCE(0x0160, 0, 0x82),SCE(0x0161, 1, 0x42),SCE(0x2161, 0, 0x82), -+SCE(0x2171, 1, 0x42),SCE(0x0162, 0, 0x82),SCE(0x0163, 1, 0x42),SCE(0x2163, 0, 0x82), -+SCE(0x2173, 1, 0x42),SCE(0x0164, 0, 0x82),SCE(0x0165, 1, 0x42),SCE(0x2165, 0, 0x82), -+SCE(0x2175, 1, 0x42),SCE(0x0166, 0, 0x82),SCE(0x0167, 1, 0x42),SCE(0x2167, 0, 0x82), -+SCE(0x2177, 1, 0x42),SCE(0x0168, 0, 0x82),SCE(0x0169, 1, 0x42),SCE(0x2169, 0, 0x82), -+SCE(0x2179, 1, 0x42),SCE(0x016a, 0, 0x82),SCE(0x016b, 1, 0x42),SCE(0x216b, 0, 0x82), -+SCE(0x217b, 1, 0x42),SCE(0x016c, 0, 0x82),SCE(0x016d, 1, 0x42),SCE(0x216d, 0, 0x82), -+SCE(0x217d, 1, 0x42),SCE(0x016e, 0, 0x82),SCE(0x016f, 1, 0x42),SCE(0x216f, 0, 0x82), -+SCE(0x217f, 1, 0x42),SCE(0x0170, 0, 0x82),SCE(0x0171, 1, 0x42),SCE(0x2ccc, 0, 0x82), -+SCE(0x2ccd, 1, 0x42),SCE(0x0172, 0, 0x82),SCE(0x0173, 1, 0x42),SCE(0x0174, 0, 0x82), -+SCE(0x0175, 1, 0x42),SCE(0x0176, 0, 0x82),SCE(0x0177, 1, 0x42),SCE(0x00ff, 0, 0x42), -+SCE(0x0178, 1, 0x82),SCE(0x0179, 0, 0x82),SCE(0x017a, 1, 0x42),SCE(0x017b, 0, 0x82), -+SCE(0x017c, 1, 0x42),SCE(0x017d, 0, 0x82),SCE(0x017e, 1, 0x42),SCE(0x0053, 0, 0x83), -+SCE(0x0073, 1, 0x43),SCE(0x017f, 2, 0x43),SCE(0x0181, 0, 0x82),SCE(0x0253, 1, 0x42), -+SCE(0x0182, 0, 0x82),SCE(0x0183, 1, 0x42),SCE(0x2183, 0, 0x82),SCE(0x2184, 1, 0x42), -+SCE(0x0184, 0, 0x82),SCE(0x0185, 1, 0x42),SCE(0x0186, 0, 0x82),SCE(0x0254, 1, 0x42), -+SCE(0x0187, 0, 0x82),SCE(0x0188, 1, 0x42),SCE(0x0189, 0, 0x82),SCE(0x0256, 1, 0x42), -+SCE(0x018a, 0, 0x82),SCE(0x0257, 1, 0x42),SCE(0x018b, 0, 0x82),SCE(0x018c, 1, 0x42), -+SCE(0x018e, 0, 0x82),SCE(0x01dd, 1, 0x42),SCE(0x018f, 0, 0x82),SCE(0x0259, 1, 0x42), -+SCE(0x0190, 0, 0x82),SCE(0x025b, 1, 0x42),SCE(0x0191, 0, 0x82),SCE(0x0192, 1, 0x42), -+SCE(0x0193, 0, 0x82),SCE(0x0260, 1, 0x42),SCE(0x0194, 0, 0x82),SCE(0x0263, 1, 0x42), -+SCE(0x0196, 0, 0x82),SCE(0x0269, 1, 0x42),SCE(0x0197, 0, 0x82),SCE(0x0268, 1, 0x42), -+SCE(0x0198, 0, 0x82),SCE(0x0199, 1, 0x42),SCE(0x019c, 0, 0x82),SCE(0x026f, 1, 0x42), -+SCE(0x019d, 0, 0x82),SCE(0x0272, 1, 0x42),SCE(0x019f, 0, 0x82),SCE(0x0275, 1, 0x42), -+SCE(0x01a0, 0, 0x82),SCE(0x01a1, 1, 0x42),SCE(0x01a2, 0, 0x82),SCE(0x01a3, 1, 0x42), -+SCE(0x01a4, 0, 0x82),SCE(0x01a5, 1, 0x42),SCE(0x01a6, 0, 0x82),SCE(0x0280, 1, 0x42), -+SCE(0x01a7, 0, 0x82),SCE(0x01a8, 1, 0x42),SCE(0x01a9, 0, 0x82),SCE(0x0283, 1, 0x42), -+SCE(0x01ac, 0, 0x82),SCE(0x01ad, 1, 0x42),SCE(0x01ae, 0, 0x82),SCE(0x0288, 1, 0x42), -+SCE(0x01af, 0, 0x82),SCE(0x01b0, 1, 0x42),SCE(0x01b1, 0, 0x82),SCE(0x028a, 1, 0x42), -+SCE(0x01b2, 0, 0x82),SCE(0x028b, 1, 0x42),SCE(0x01b3, 0, 0x82),SCE(0x01b4, 1, 0x42), -+SCE(0x01b5, 0, 0x82),SCE(0x01b6, 1, 0x42),SCE(0x01b7, 0, 0x82),SCE(0x0292, 1, 0x42), -+SCE(0x01b8, 0, 0x82),SCE(0x01b9, 1, 0x42),SCE(0x01bc, 0, 0x82),SCE(0x01bd, 1, 0x42), -+SCE(0x01c4, 0, 0x83),SCE(0x01c5, 1, 0x3),SCE(0x01c6, 2, 0x43),SCE(0x01c4, 0, 0x83), -+SCE(0x01c5, 1, 0x3),SCE(0x01c6, 2, 0x43),SCE(0x01c7, 0, 0x83),SCE(0x01c8, 1, 0x3), -+SCE(0x01c9, 2, 0x43),SCE(0x01c7, 0, 0x83),SCE(0x01c8, 1, 0x3),SCE(0x01c9, 2, 0x43), -+SCE(0x01ca, 0, 0x83),SCE(0x01cb, 1, 0x3),SCE(0x01cc, 2, 0x43),SCE(0x01ca, 0, 0x83), -+SCE(0x01cb, 1, 0x3),SCE(0x01cc, 2, 0x43),SCE(0x01cd, 0, 0x82),SCE(0x01ce, 1, 0x42), -+SCE(0x01cf, 0, 0x82),SCE(0x01d0, 1, 0x42),SCE(0x01d1, 0, 0x82),SCE(0x01d2, 1, 0x42), -+SCE(0x01d3, 0, 0x82),SCE(0x01d4, 1, 0x42),SCE(0x01d5, 0, 0x82),SCE(0x01d6, 1, 0x42), -+SCE(0x01d7, 0, 0x82),SCE(0x01d8, 1, 0x42),SCE(0x01d9, 0, 0x82),SCE(0x01da, 1, 0x42), -+SCE(0x01db, 0, 0x82),SCE(0x01dc, 1, 0x42),SCE(0x01de, 0, 0x82),SCE(0x01df, 1, 0x42), -+SCE(0xff36, 0, 0x82),SCE(0xff56, 1, 0x42),SCE(0x01e0, 0, 0x82),SCE(0x01e1, 1, 0x42), -+SCE(0x01e2, 0, 0x82),SCE(0x01e3, 1, 0x42),SCE(0x01e4, 0, 0x82),SCE(0x01e5, 1, 0x42), -+SCE(0x01e6, 0, 0x82),SCE(0x01e7, 1, 0x42),SCE(0x01e8, 0, 0x82),SCE(0x01e9, 1, 0x42), -+SCE(0x01ea, 0, 0x82),SCE(0x01eb, 1, 0x42),SCE(0x01ec, 0, 0x82),SCE(0x01ed, 1, 0x42), -+SCE(0x01ee, 0, 0x82),SCE(0x01ef, 1, 0x42),SCE(0x01f1, 0, 0x83),SCE(0x01f2, 1, 0x3), -+SCE(0x01f3, 2, 0x43),SCE(0x01f1, 0, 0x83),SCE(0x01f2, 1, 0x3),SCE(0x01f3, 2, 0x43), -+SCE(0x01f4, 0, 0x82),SCE(0x01f5, 1, 0x42),SCE(0x0195, 0, 0x42),SCE(0x01f6, 1, 0x82), -+SCE(0x01bf, 0, 0x42),SCE(0x01f7, 1, 0x82),SCE(0x01f8, 0, 0x82),SCE(0x01f9, 1, 0x42), -+SCE(0x1041d, 0, 0x82),SCE(0x10445, 1, 0x42),SCE(0x01fa, 0, 0x82),SCE(0x01fb, 1, 0x42), -+SCE(0x01fc, 0, 0x82),SCE(0x01fd, 1, 0x42),SCE(0x01fe, 0, 0x82),SCE(0x01ff, 1, 0x42), -+SCE(0x0200, 0, 0x82),SCE(0x0201, 1, 0x42),SCE(0x0202, 0, 0x82),SCE(0x0203, 1, 0x42), -+SCE(0x0204, 0, 0x82),SCE(0x0205, 1, 0x42),SCE(0x0206, 0, 0x82),SCE(0x0207, 1, 0x42), -+SCE(0x0208, 0, 0x82),SCE(0x0209, 1, 0x42),SCE(0x020a, 0, 0x82),SCE(0x020b, 1, 0x42), -+SCE(0x020c, 0, 0x82),SCE(0x020d, 1, 0x42),SCE(0x020e, 0, 0x82),SCE(0x020f, 1, 0x42), -+SCE(0x0210, 0, 0x82),SCE(0x0211, 1, 0x42),SCE(0x0212, 0, 0x82),SCE(0x0213, 1, 0x42), -+SCE(0x0214, 0, 0x82),SCE(0x0215, 1, 0x42),SCE(0x0216, 0, 0x82),SCE(0x0217, 1, 0x42), -+SCE(0x0218, 0, 0x82),SCE(0x0219, 1, 0x42),SCE(0x021a, 0, 0x82),SCE(0x021b, 1, 0x42), -+SCE(0x021c, 0, 0x82),SCE(0x021d, 1, 0x42),SCE(0x021e, 0, 0x82),SCE(0x021f, 1, 0x42), -+SCE(0x019e, 0, 0x42),SCE(0x0220, 1, 0x82),SCE(0x0222, 0, 0x82),SCE(0x0223, 1, 0x42), -+SCE(0x0224, 0, 0x82),SCE(0x0225, 1, 0x42),SCE(0x0226, 0, 0x82),SCE(0x0227, 1, 0x42), -+SCE(0x0228, 0, 0x82),SCE(0x0229, 1, 0x42),SCE(0x022a, 0, 0x82),SCE(0x022b, 1, 0x42), -+SCE(0x022c, 0, 0x82),SCE(0x022d, 1, 0x42),SCE(0x022e, 0, 0x82),SCE(0x022f, 1, 0x42), -+SCE(0x0230, 0, 0x82),SCE(0x0231, 1, 0x42),SCE(0x0232, 0, 0x82),SCE(0x0233, 1, 0x42), -+SCE(0xa684, 0, 0x82),SCE(0xa685, 1, 0x42),SCE(0x023a, 0, 0x82),SCE(0x2c65, 1, 0x42), -+SCE(0x023b, 0, 0x82),SCE(0x023c, 1, 0x42),SCE(0x019a, 0, 0x42),SCE(0x023d, 1, 0x82), -+SCE(0x023e, 0, 0x82),SCE(0x2c66, 1, 0x42),SCE(0x0241, 0, 0x82),SCE(0x0242, 1, 0x42), -+SCE(0x10412, 0, 0x82),SCE(0x1043a, 1, 0x42),SCE(0x0180, 0, 0x42),SCE(0x0243, 1, 0x82), -+SCE(0x0244, 0, 0x82),SCE(0x0289, 1, 0x42),SCE(0x0245, 0, 0x82),SCE(0x028c, 1, 0x42), -+SCE(0x0246, 0, 0x82),SCE(0x0247, 1, 0x42),SCE(0x0248, 0, 0x82),SCE(0x0249, 1, 0x42), -+SCE(0x024a, 0, 0x82),SCE(0x024b, 1, 0x42),SCE(0x024c, 0, 0x82),SCE(0x024d, 1, 0x42), -+SCE(0x2c1b, 0, 0x82),SCE(0x2c4b, 1, 0x42),SCE(0x024e, 0, 0x82),SCE(0x024f, 1, 0x42), -+SCE(0x1040a, 0, 0x82),SCE(0x10432, 1, 0x42),SCE(0x2160, 0, 0x82),SCE(0x2170, 1, 0x42), -+SCE(0xa692, 0, 0x82),SCE(0xa693, 1, 0x42),SCE(0x027d, 0, 0x42),SCE(0x2c64, 1, 0x82), -+SCE(0x10410, 0, 0x82),SCE(0x10438, 1, 0x42),SCE(0x2c21, 0, 0x82),SCE(0x2c51, 1, 0x42), -+SCE(0x2c69, 0, 0x82),SCE(0x2c6a, 1, 0x42),SCE(0x10409, 0, 0x82),SCE(0x10431, 1, 0x42), -+SCE(0x10414, 0, 0x82),SCE(0x1043c, 1, 0x42),SCE(0x2162, 0, 0x82),SCE(0x2172, 1, 0x42), -+SCE(0x1041e, 0, 0x82),SCE(0x10446, 1, 0x42),SCE(0x0271, 0, 0x42),SCE(0x2c6e, 1, 0x82), -+SCE(0x10415, 0, 0x82),SCE(0x1043d, 1, 0x42),SCE(0x0252, 0, 0x42),SCE(0x2c70, 1, 0x82), -+SCE(0x2c72, 0, 0x82),SCE(0x2c73, 1, 0x42),SCE(0x2c0b, 0, 0x82),SCE(0x2c3b, 1, 0x42), -+SCE(0x10416, 0, 0x82),SCE(0x1043e, 1, 0x42),SCE(0x2c75, 0, 0x82),SCE(0x2c76, 1, 0x42), -+SCE(0x2164, 0, 0x82),SCE(0x2174, 1, 0x42),SCE(0xa640, 0, 0x82),SCE(0xa641, 1, 0x42), -+SCE(0xff22, 0, 0x82),SCE(0xff42, 1, 0x42),SCE(0x2c0c, 0, 0x82),SCE(0x2c3c, 1, 0x42), -+SCE(0x10417, 0, 0x82),SCE(0x1043f, 1, 0x42),SCE(0xff24, 0, 0x82),SCE(0xff44, 1, 0x42), -+SCE(0xff25, 0, 0x82),SCE(0xff45, 1, 0x42),SCE(0xff26, 0, 0x82),SCE(0xff46, 1, 0x42), -+SCE(0x2c0d, 0, 0x82),SCE(0x2c3d, 1, 0x42),SCE(0x24c1, 0, 0x82),SCE(0x24db, 1, 0x42), -+SCE(0xa728, 0, 0x82),SCE(0xa729, 1, 0x42),SCE(0x023f, 0, 0x42),SCE(0x2c7e, 1, 0x82), -+SCE(0x10411, 0, 0x82),SCE(0x10439, 1, 0x42),SCE(0xff29, 0, 0x82),SCE(0xff49, 1, 0x42), -+SCE(0x1040b, 0, 0x82),SCE(0x10433, 1, 0x42),SCE(0xa72a, 0, 0x82),SCE(0xa72b, 1, 0x42), -+SCE(0x2c80, 0, 0x82),SCE(0x2c81, 1, 0x42),SCE(0xff2b, 0, 0x82),SCE(0xff4b, 1, 0x42), -+SCE(0xa72c, 0, 0x82),SCE(0xa72d, 1, 0x42),SCE(0x2c0e, 0, 0x82),SCE(0x2c3e, 1, 0x42), -+SCE(0xff2d, 0, 0x82),SCE(0xff4d, 1, 0x42),SCE(0x10419, 0, 0x82),SCE(0x10441, 1, 0x42), -+SCE(0xa72e, 0, 0x82),SCE(0xa72f, 1, 0x42),SCE(0x1040d, 0, 0x82),SCE(0x10435, 1, 0x42), -+SCE(0xff2f, 0, 0x82),SCE(0xff4f, 1, 0x42),SCE(0xff31, 0, 0x82),SCE(0xff51, 1, 0x42), -+SCE(0xff32, 0, 0x82),SCE(0xff52, 1, 0x42),SCE(0x1041a, 0, 0x82),SCE(0x10442, 1, 0x42), -+SCE(0xff34, 0, 0x82),SCE(0xff54, 1, 0x42),SCE(0x2c98, 0, 0x82),SCE(0x2c99, 1, 0x42), -+SCE(0x2c8a, 0, 0x82),SCE(0x2c8b, 1, 0x42),SCE(0x0345, 0, 0x44),SCE(0x0399, 1, 0x84), -+SCE(0x03b9, 2, 0x44),SCE(0x1fbe, 3, 0x44),SCE(0x2c8c, 0, 0x82),SCE(0x2c8d, 1, 0x42), -+SCE(0xff37, 0, 0x82),SCE(0xff57, 1, 0x42),SCE(0xa656, 0, 0x82),SCE(0xa657, 1, 0x42), -+SCE(0x1041b, 0, 0x82),SCE(0x10443, 1, 0x42),SCE(0xa738, 0, 0x82),SCE(0xa739, 1, 0x42), -+SCE(0x2c8e, 0, 0x82),SCE(0x2c8f, 1, 0x42),SCE(0xff39, 0, 0x82),SCE(0xff59, 1, 0x42), -+SCE(0x10404, 0, 0x82),SCE(0x1042c, 1, 0x42),SCE(0xa73a, 0, 0x82),SCE(0xa73b, 1, 0x42), -+SCE(0x2c90, 0, 0x82),SCE(0x2c91, 1, 0x42),SCE(0xa73c, 0, 0x82),SCE(0xa73d, 1, 0x42), -+SCE(0x2c92, 0, 0x82),SCE(0x2c93, 1, 0x42),SCE(0x1041c, 0, 0x82),SCE(0x10444, 1, 0x42), -+SCE(0x0370, 0, 0x82),SCE(0x0371, 1, 0x42),SCE(0x0372, 0, 0x82),SCE(0x0373, 1, 0x42), -+SCE(0xa73e, 0, 0x82),SCE(0xa73f, 1, 0x42),SCE(0x0376, 0, 0x82),SCE(0x0377, 1, 0x42), -+SCE(0x2c94, 0, 0x82),SCE(0x2c95, 1, 0x42),SCE(0x2c96, 0, 0x82),SCE(0x2c97, 1, 0x42), -+SCE(0x0386, 0, 0x82),SCE(0x03ac, 1, 0x42),SCE(0x10405, 0, 0x82),SCE(0x1042d, 1, 0x42), -+SCE(0x0388, 0, 0x82),SCE(0x03ad, 1, 0x42),SCE(0x0389, 0, 0x82),SCE(0x03ae, 1, 0x42), -+SCE(0x038a, 0, 0x82),SCE(0x03af, 1, 0x42),SCE(0x038c, 0, 0x82),SCE(0x03cc, 1, 0x42), -+SCE(0x038e, 0, 0x82),SCE(0x03cd, 1, 0x42),SCE(0x038f, 0, 0x82),SCE(0x03ce, 1, 0x42), -+SCE(0x0391, 0, 0x82),SCE(0x03b1, 1, 0x42),SCE(0x0392, 0, 0x83),SCE(0x03b2, 1, 0x43), -+SCE(0x03d0, 2, 0x43),SCE(0x0393, 0, 0x82),SCE(0x03b3, 1, 0x42),SCE(0x0394, 0, 0x82), -+SCE(0x03b4, 1, 0x42),SCE(0x0395, 0, 0x83),SCE(0x03b5, 1, 0x43),SCE(0x03f5, 2, 0x43), -+SCE(0x0396, 0, 0x82),SCE(0x03b6, 1, 0x42),SCE(0x0397, 0, 0x82),SCE(0x03b7, 1, 0x42), -+SCE(0x0398, 0, 0x84),SCE(0x03b8, 1, 0x44),SCE(0x03d1, 2, 0x44),SCE(0x03f4, 3, 0x84), -+SCE(0x0345, 0, 0x44),SCE(0x0399, 1, 0x84),SCE(0x03b9, 2, 0x44),SCE(0x1fbe, 3, 0x44), -+SCE(0x039a, 0, 0x83),SCE(0x03ba, 1, 0x43),SCE(0x03f0, 2, 0x43),SCE(0x039b, 0, 0x82), -+SCE(0x03bb, 1, 0x42),SCE(0x00b5, 0, 0x43),SCE(0x039c, 1, 0x83),SCE(0x03bc, 2, 0x43), -+SCE(0x039d, 0, 0x82),SCE(0x03bd, 1, 0x42),SCE(0x039e, 0, 0x82),SCE(0x03be, 1, 0x42), -+SCE(0x039f, 0, 0x82),SCE(0x03bf, 1, 0x42),SCE(0x03a0, 0, 0x83),SCE(0x03c0, 1, 0x43), -+SCE(0x03d6, 2, 0x43),SCE(0x03a1, 0, 0x83),SCE(0x03c1, 1, 0x43),SCE(0x03f1, 2, 0x43), -+SCE(0x03a3, 0, 0x83),SCE(0x03c2, 1, 0x43),SCE(0x03c3, 2, 0x43),SCE(0x03a4, 0, 0x82), -+SCE(0x03c4, 1, 0x42),SCE(0x03a5, 0, 0x82),SCE(0x03c5, 1, 0x42),SCE(0x03a6, 0, 0x83), -+SCE(0x03c6, 1, 0x43),SCE(0x03d5, 2, 0x43),SCE(0x03a7, 0, 0x82),SCE(0x03c7, 1, 0x42), -+SCE(0x03a8, 0, 0x82),SCE(0x03c8, 1, 0x42),SCE(0x03a9, 0, 0x83),SCE(0x03c9, 1, 0x43), -+SCE(0x2126, 2, 0x83),SCE(0x03aa, 0, 0x82),SCE(0x03ca, 1, 0x42),SCE(0x03ab, 0, 0x82), -+SCE(0x03cb, 1, 0x42),SCE(0x24c9, 0, 0x82),SCE(0x24e3, 1, 0x42),SCE(0x2ce0, 0, 0x82), -+SCE(0x2ce1, 1, 0x42),SCE(0xa748, 0, 0x82),SCE(0xa749, 1, 0x42),SCE(0x2c9c, 0, 0x82), -+SCE(0x2c9d, 1, 0x42),SCE(0x2c9e, 0, 0x82),SCE(0x2c9f, 1, 0x42),SCE(0xa74a, 0, 0x82), -+SCE(0xa74b, 1, 0x42),SCE(0x2ca0, 0, 0x82),SCE(0x2ca1, 1, 0x42),SCE(0x03a3, 0, 0x83), -+SCE(0x03c2, 1, 0x43),SCE(0x03c3, 2, 0x43),SCE(0x1041f, 0, 0x82),SCE(0x10447, 1, 0x42), -+SCE(0xa74c, 0, 0x82),SCE(0xa74d, 1, 0x42),SCE(0xa68a, 0, 0x82),SCE(0xa68b, 1, 0x42), -+SCE(0x2ca2, 0, 0x82),SCE(0x2ca3, 1, 0x42),SCE(0x03cf, 0, 0x82),SCE(0x03d7, 1, 0x42), -+SCE(0x0392, 0, 0x83),SCE(0x03b2, 1, 0x43),SCE(0x03d0, 2, 0x43),SCE(0x0398, 0, 0x84), -+SCE(0x03b8, 1, 0x44),SCE(0x03d1, 2, 0x44),SCE(0x03f4, 3, 0x84),SCE(0x03a6, 0, 0x83), -+SCE(0x03c6, 1, 0x43),SCE(0x03d5, 2, 0x43),SCE(0x03a0, 0, 0x83),SCE(0x03c0, 1, 0x43), -+SCE(0x03d6, 2, 0x43),SCE(0x03d8, 0, 0x82),SCE(0x03d9, 1, 0x42),SCE(0x2ca4, 0, 0x82), -+SCE(0x2ca5, 1, 0x42),SCE(0x03da, 0, 0x82),SCE(0x03db, 1, 0x42),SCE(0x03dc, 0, 0x82), -+SCE(0x03dd, 1, 0x42),SCE(0x03de, 0, 0x82),SCE(0x03df, 1, 0x42),SCE(0x03e0, 0, 0x82), -+SCE(0x03e1, 1, 0x42),SCE(0x03e2, 0, 0x82),SCE(0x03e3, 1, 0x42),SCE(0x03e4, 0, 0x82), -+SCE(0x03e5, 1, 0x42),SCE(0x2ca6, 0, 0x82),SCE(0x2ca7, 1, 0x42),SCE(0x03e6, 0, 0x82), -+SCE(0x03e7, 1, 0x42),SCE(0x10420, 0, 0x82),SCE(0x10448, 1, 0x42),SCE(0x03e8, 0, 0x82), -+SCE(0x03e9, 1, 0x42),SCE(0x2ce2, 0, 0x82),SCE(0x2ce3, 1, 0x42),SCE(0x03ea, 0, 0x82), -+SCE(0x03eb, 1, 0x42),SCE(0x03ec, 0, 0x82),SCE(0x03ed, 1, 0x42),SCE(0x03ee, 0, 0x82), -+SCE(0x03ef, 1, 0x42),SCE(0x039a, 0, 0x83),SCE(0x03ba, 1, 0x43),SCE(0x03f0, 2, 0x43), -+SCE(0x03a1, 0, 0x83),SCE(0x03c1, 1, 0x43),SCE(0x03f1, 2, 0x43),SCE(0x0398, 0, 0x84), -+SCE(0x03b8, 1, 0x44),SCE(0x03d1, 2, 0x44),SCE(0x03f4, 3, 0x84),SCE(0x0395, 0, 0x83), -+SCE(0x03b5, 1, 0x43),SCE(0x03f5, 2, 0x43),SCE(0x03f7, 0, 0x82),SCE(0x03f8, 1, 0x42), -+SCE(0x03f2, 0, 0x42),SCE(0x03f9, 1, 0x82),SCE(0x03fa, 0, 0x82),SCE(0x03fb, 1, 0x42), -+SCE(0x037b, 0, 0x42),SCE(0x03fd, 1, 0x82),SCE(0x037c, 0, 0x42),SCE(0x03fe, 1, 0x82), -+SCE(0x037d, 0, 0x42),SCE(0x03ff, 1, 0x82),SCE(0x0400, 0, 0x82),SCE(0x0450, 1, 0x42), -+SCE(0x0401, 0, 0x82),SCE(0x0451, 1, 0x42),SCE(0x0402, 0, 0x82),SCE(0x0452, 1, 0x42), -+SCE(0x0403, 0, 0x82),SCE(0x0453, 1, 0x42),SCE(0x0404, 0, 0x82),SCE(0x0454, 1, 0x42), -+SCE(0x0405, 0, 0x82),SCE(0x0455, 1, 0x42),SCE(0x0406, 0, 0x82),SCE(0x0456, 1, 0x42), -+SCE(0x0407, 0, 0x82),SCE(0x0457, 1, 0x42),SCE(0x0408, 0, 0x82),SCE(0x0458, 1, 0x42), -+SCE(0x0409, 0, 0x82),SCE(0x0459, 1, 0x42),SCE(0x040a, 0, 0x82),SCE(0x045a, 1, 0x42), -+SCE(0x040b, 0, 0x82),SCE(0x045b, 1, 0x42),SCE(0x040c, 0, 0x82),SCE(0x045c, 1, 0x42), -+SCE(0x040d, 0, 0x82),SCE(0x045d, 1, 0x42),SCE(0x040e, 0, 0x82),SCE(0x045e, 1, 0x42), -+SCE(0x040f, 0, 0x82),SCE(0x045f, 1, 0x42),SCE(0x0410, 0, 0x82),SCE(0x0430, 1, 0x42), -+SCE(0x0411, 0, 0x82),SCE(0x0431, 1, 0x42),SCE(0x0412, 0, 0x82),SCE(0x0432, 1, 0x42), -+SCE(0x0413, 0, 0x82),SCE(0x0433, 1, 0x42),SCE(0x0414, 0, 0x82),SCE(0x0434, 1, 0x42), -+SCE(0x0415, 0, 0x82),SCE(0x0435, 1, 0x42),SCE(0x0416, 0, 0x82),SCE(0x0436, 1, 0x42), -+SCE(0x0417, 0, 0x82),SCE(0x0437, 1, 0x42),SCE(0x0418, 0, 0x82),SCE(0x0438, 1, 0x42), -+SCE(0x0419, 0, 0x82),SCE(0x0439, 1, 0x42),SCE(0x041a, 0, 0x82),SCE(0x043a, 1, 0x42), -+SCE(0x041b, 0, 0x82),SCE(0x043b, 1, 0x42),SCE(0x041c, 0, 0x82),SCE(0x043c, 1, 0x42), -+SCE(0x041d, 0, 0x82),SCE(0x043d, 1, 0x42),SCE(0x041e, 0, 0x82),SCE(0x043e, 1, 0x42), -+SCE(0x041f, 0, 0x82),SCE(0x043f, 1, 0x42),SCE(0x0420, 0, 0x82),SCE(0x0440, 1, 0x42), -+SCE(0x0421, 0, 0x82),SCE(0x0441, 1, 0x42),SCE(0x0422, 0, 0x82),SCE(0x0442, 1, 0x42), -+SCE(0x0423, 0, 0x82),SCE(0x0443, 1, 0x42),SCE(0x0424, 0, 0x82),SCE(0x0444, 1, 0x42), -+SCE(0x0425, 0, 0x82),SCE(0x0445, 1, 0x42),SCE(0x0426, 0, 0x82),SCE(0x0446, 1, 0x42), -+SCE(0x0427, 0, 0x82),SCE(0x0447, 1, 0x42),SCE(0x0428, 0, 0x82),SCE(0x0448, 1, 0x42), -+SCE(0x0429, 0, 0x82),SCE(0x0449, 1, 0x42),SCE(0x042a, 0, 0x82),SCE(0x044a, 1, 0x42), -+SCE(0x042b, 0, 0x82),SCE(0x044b, 1, 0x42),SCE(0x042c, 0, 0x82),SCE(0x044c, 1, 0x42), -+SCE(0x042d, 0, 0x82),SCE(0x044d, 1, 0x42),SCE(0x042e, 0, 0x82),SCE(0x044e, 1, 0x42), -+SCE(0x042f, 0, 0x82),SCE(0x044f, 1, 0x42),SCE(0xff3a, 0, 0x82),SCE(0xff5a, 1, 0x42), -+SCE(0x2cb4, 0, 0x82),SCE(0x2cb5, 1, 0x42),SCE(0x00b5, 0, 0x43),SCE(0x039c, 1, 0x83), -+SCE(0x03bc, 2, 0x43),SCE(0x10423, 0, 0x82),SCE(0x1044b, 1, 0x42),SCE(0x24b6, 0, 0x82), -+SCE(0x24d0, 1, 0x42),SCE(0x24b8, 0, 0x82),SCE(0x24d2, 1, 0x42),SCE(0xff2c, 0, 0x82), -+SCE(0xff4c, 1, 0x42),SCE(0x10421, 0, 0x82),SCE(0x10449, 1, 0x42),SCE(0x24ba, 0, 0x82), -+SCE(0x24d4, 1, 0x42),SCE(0x10424, 0, 0x82),SCE(0x1044c, 1, 0x42),SCE(0x0460, 0, 0x82), -+SCE(0x0461, 1, 0x42),SCE(0x0462, 0, 0x82),SCE(0x0463, 1, 0x42),SCE(0x1d7d, 0, 0x42), -+SCE(0x2c63, 1, 0x82),SCE(0x0464, 0, 0x82),SCE(0x0465, 1, 0x42),SCE(0x0466, 0, 0x82), -+SCE(0x0467, 1, 0x42),SCE(0x2c67, 0, 0x82),SCE(0x2c68, 1, 0x42),SCE(0x0468, 0, 0x82), -+SCE(0x0469, 1, 0x42),SCE(0x24bc, 0, 0x82),SCE(0x24d6, 1, 0x42),SCE(0x046a, 0, 0x82), -+SCE(0x046b, 1, 0x42),SCE(0x2c6b, 0, 0x82),SCE(0x2c6c, 1, 0x42),SCE(0x046c, 0, 0x82), -+SCE(0x046d, 1, 0x42),SCE(0x0251, 0, 0x42),SCE(0x2c6d, 1, 0x82),SCE(0x046e, 0, 0x82), -+SCE(0x046f, 1, 0x42),SCE(0x0250, 0, 0x42),SCE(0x2c6f, 1, 0x82),SCE(0x0470, 0, 0x82), -+SCE(0x0471, 1, 0x42),SCE(0xa768, 0, 0x82),SCE(0xa769, 1, 0x42),SCE(0x0472, 0, 0x82), -+SCE(0x0473, 1, 0x42),SCE(0x0474, 0, 0x82),SCE(0x0475, 1, 0x42),SCE(0x24be, 0, 0x82), -+SCE(0x24d8, 1, 0x42),SCE(0x0476, 0, 0x82),SCE(0x0477, 1, 0x42),SCE(0x0478, 0, 0x82), -+SCE(0x0479, 1, 0x42),SCE(0x047a, 0, 0x82),SCE(0x047b, 1, 0x42),SCE(0x047c, 0, 0x82), -+SCE(0x047d, 1, 0x42),SCE(0xa76a, 0, 0x82),SCE(0xa76b, 1, 0x42),SCE(0x047e, 0, 0x82), -+SCE(0x047f, 1, 0x42),SCE(0x0240, 0, 0x42),SCE(0x2c7f, 1, 0x82),SCE(0x0480, 0, 0x82), -+SCE(0x0481, 1, 0x42),SCE(0x10c0, 0, 0x82),SCE(0x2d20, 1, 0x42),SCE(0x2c82, 0, 0x82), -+SCE(0x2c83, 1, 0x42),SCE(0x2c84, 0, 0x82),SCE(0x2c85, 1, 0x42),SCE(0x2c86, 0, 0x82), -+SCE(0x2c87, 1, 0x42),SCE(0x10c1, 0, 0x82),SCE(0x2d21, 1, 0x42),SCE(0x2c88, 0, 0x82), -+SCE(0x2c89, 1, 0x42),SCE(0xa76c, 0, 0x82),SCE(0xa76d, 1, 0x42),SCE(0x048a, 0, 0x82), -+SCE(0x048b, 1, 0x42),SCE(0x048c, 0, 0x82),SCE(0x048d, 1, 0x42),SCE(0x00c2, 0, 0x82), -+SCE(0x00e2, 1, 0x42),SCE(0x048e, 0, 0x82),SCE(0x048f, 1, 0x42),SCE(0x0490, 0, 0x82), -+SCE(0x0491, 1, 0x42),SCE(0x0492, 0, 0x82),SCE(0x0493, 1, 0x42),SCE(0x10c3, 0, 0x82), -+SCE(0x2d23, 1, 0x42),SCE(0x0494, 0, 0x82),SCE(0x0495, 1, 0x42),SCE(0xa76e, 0, 0x82), -+SCE(0xa76f, 1, 0x42),SCE(0x0496, 0, 0x82),SCE(0x0497, 1, 0x42),SCE(0x0498, 0, 0x82), -+SCE(0x0499, 1, 0x42),SCE(0x00c4, 0, 0x82),SCE(0x00e4, 1, 0x42),SCE(0x049a, 0, 0x82), -+SCE(0x049b, 1, 0x42),SCE(0x10426, 0, 0x82),SCE(0x1044e, 1, 0x42),SCE(0x049c, 0, 0x82), -+SCE(0x049d, 1, 0x42),SCE(0x049e, 0, 0x82),SCE(0x049f, 1, 0x42),SCE(0x10c5, 0, 0x82), -+SCE(0x2d25, 1, 0x42),SCE(0x04a0, 0, 0x82),SCE(0x04a1, 1, 0x42),SCE(0x04a2, 0, 0x82), -+SCE(0x04a3, 1, 0x42),SCE(0x04a4, 0, 0x82),SCE(0x04a5, 1, 0x42),SCE(0x2cc6, 0, 0x82), -+SCE(0x2cc7, 1, 0x42),SCE(0x04a6, 0, 0x82),SCE(0x04a7, 1, 0x42),SCE(0x04a8, 0, 0x82), -+SCE(0x04a9, 1, 0x42),SCE(0x2c60, 0, 0x82),SCE(0x2c61, 1, 0x42),SCE(0x04aa, 0, 0x82), -+SCE(0x04ab, 1, 0x42),SCE(0x10c7, 0, 0x82),SCE(0x2d27, 1, 0x42),SCE(0x04ac, 0, 0x82), -+SCE(0x04ad, 1, 0x42),SCE(0x10413, 0, 0x82),SCE(0x1043b, 1, 0x42),SCE(0x04ae, 0, 0x82), -+SCE(0x04af, 1, 0x42),SCE(0x04b0, 0, 0x82),SCE(0x04b1, 1, 0x42),SCE(0x2cc8, 0, 0x82), -+SCE(0x2cc9, 1, 0x42),SCE(0x04b2, 0, 0x82),SCE(0x04b3, 1, 0x42),SCE(0x04b4, 0, 0x82), -+SCE(0x04b5, 1, 0x42),SCE(0x04b6, 0, 0x82),SCE(0x04b7, 1, 0x42),SCE(0x24b7, 0, 0x82), -+SCE(0x24d1, 1, 0x42),SCE(0x04b8, 0, 0x82),SCE(0x04b9, 1, 0x42),SCE(0x24b9, 0, 0x82), -+SCE(0x24d3, 1, 0x42),SCE(0x04ba, 0, 0x82),SCE(0x04bb, 1, 0x42),SCE(0x24bb, 0, 0x82), -+SCE(0x24d5, 1, 0x42),SCE(0x04bc, 0, 0x82),SCE(0x04bd, 1, 0x42),SCE(0x24bd, 0, 0x82), -+SCE(0x24d7, 1, 0x42),SCE(0x04be, 0, 0x82),SCE(0x04bf, 1, 0x42),SCE(0x24bf, 0, 0x82), -+SCE(0x24d9, 1, 0x42),SCE(0x04c0, 0, 0x82),SCE(0x04cf, 1, 0x42),SCE(0x04c1, 0, 0x82), -+SCE(0x04c2, 1, 0x42),SCE(0x24c2, 0, 0x82),SCE(0x24dc, 1, 0x42),SCE(0x04c3, 0, 0x82), -+SCE(0x04c4, 1, 0x42),SCE(0x24c4, 0, 0x82),SCE(0x24de, 1, 0x42),SCE(0x04c5, 0, 0x82), -+SCE(0x04c6, 1, 0x42),SCE(0x24c6, 0, 0x82),SCE(0x24e0, 1, 0x42),SCE(0x04c7, 0, 0x82), -+SCE(0x04c8, 1, 0x42),SCE(0x24c8, 0, 0x82),SCE(0x24e2, 1, 0x42),SCE(0x04c9, 0, 0x82), -+SCE(0x04ca, 1, 0x42),SCE(0x24ca, 0, 0x82),SCE(0x24e4, 1, 0x42),SCE(0x04cb, 0, 0x82), -+SCE(0x04cc, 1, 0x42),SCE(0x24cc, 0, 0x82),SCE(0x24e6, 1, 0x42),SCE(0x04cd, 0, 0x82), -+SCE(0x04ce, 1, 0x42),SCE(0x24ce, 0, 0x82),SCE(0x24e8, 1, 0x42),SCE(0x10cd, 0, 0x82), -+SCE(0x2d2d, 1, 0x42),SCE(0x04d0, 0, 0x82),SCE(0x04d1, 1, 0x42),SCE(0x04d2, 0, 0x82), -+SCE(0x04d3, 1, 0x42),SCE(0x04d4, 0, 0x82),SCE(0x04d5, 1, 0x42),SCE(0x2cce, 0, 0x82), -+SCE(0x2ccf, 1, 0x42),SCE(0x04d6, 0, 0x82),SCE(0x04d7, 1, 0x42),SCE(0xa779, 0, 0x82), -+SCE(0xa77a, 1, 0x42),SCE(0x04d8, 0, 0x82),SCE(0x04d9, 1, 0x42),SCE(0x04da, 0, 0x82), -+SCE(0x04db, 1, 0x42),SCE(0x24cf, 0, 0x82),SCE(0x24e9, 1, 0x42),SCE(0x04dc, 0, 0x82), -+SCE(0x04dd, 1, 0x42),SCE(0x04de, 0, 0x82),SCE(0x04df, 1, 0x42),SCE(0x04e0, 0, 0x82), -+SCE(0x04e1, 1, 0x42),SCE(0x2cd0, 0, 0x82),SCE(0x2cd1, 1, 0x42),SCE(0x04e2, 0, 0x82), -+SCE(0x04e3, 1, 0x42),SCE(0x04e4, 0, 0x82),SCE(0x04e5, 1, 0x42),SCE(0x026b, 0, 0x42), -+SCE(0x2c62, 1, 0x82),SCE(0x04e6, 0, 0x82),SCE(0x04e7, 1, 0x42),SCE(0x04e8, 0, 0x82), -+SCE(0x04e9, 1, 0x42),SCE(0x04ea, 0, 0x82),SCE(0x04eb, 1, 0x42),SCE(0x2132, 0, 0x82), -+SCE(0x214e, 1, 0x42),SCE(0x04ec, 0, 0x82),SCE(0x04ed, 1, 0x42),SCE(0x2cd2, 0, 0x82), -+SCE(0x2cd3, 1, 0x42),SCE(0x04ee, 0, 0x82),SCE(0x04ef, 1, 0x42),SCE(0x04f0, 0, 0x82), -+SCE(0x04f1, 1, 0x42),SCE(0x10422, 0, 0x82),SCE(0x1044a, 1, 0x42),SCE(0x04f2, 0, 0x82), -+SCE(0x04f3, 1, 0x42),SCE(0x04f4, 0, 0x82),SCE(0x04f5, 1, 0x42),SCE(0x04f6, 0, 0x82), -+SCE(0x04f7, 1, 0x42),SCE(0x04f8, 0, 0x82),SCE(0x04f9, 1, 0x42),SCE(0x2cd4, 0, 0x82), -+SCE(0x2cd5, 1, 0x42),SCE(0x04fa, 0, 0x82),SCE(0x04fb, 1, 0x42),SCE(0x04fc, 0, 0x82), -+SCE(0x04fd, 1, 0x42),SCE(0x04fe, 0, 0x82),SCE(0x04ff, 1, 0x42),SCE(0x0500, 0, 0x82), -+SCE(0x0501, 1, 0x42),SCE(0x0502, 0, 0x82),SCE(0x0503, 1, 0x42),SCE(0x0504, 0, 0x82), -+SCE(0x0505, 1, 0x42),SCE(0x2cd6, 0, 0x82),SCE(0x2cd7, 1, 0x42),SCE(0x0506, 0, 0x82), -+SCE(0x0507, 1, 0x42),SCE(0x0508, 0, 0x82),SCE(0x0509, 1, 0x42),SCE(0x050a, 0, 0x82), -+SCE(0x050b, 1, 0x42),SCE(0x050c, 0, 0x82),SCE(0x050d, 1, 0x42),SCE(0x050e, 0, 0x82), -+SCE(0x050f, 1, 0x42),SCE(0x0510, 0, 0x82),SCE(0x0511, 1, 0x42),SCE(0x2cd8, 0, 0x82), -+SCE(0x2cd9, 1, 0x42),SCE(0x0512, 0, 0x82),SCE(0x0513, 1, 0x42),SCE(0x0514, 0, 0x82), -+SCE(0x0515, 1, 0x42),SCE(0x0516, 0, 0x82),SCE(0x0517, 1, 0x42),SCE(0x0518, 0, 0x82), -+SCE(0x0519, 1, 0x42),SCE(0x051a, 0, 0x82),SCE(0x051b, 1, 0x42),SCE(0x2ca8, 0, 0x82), -+SCE(0x2ca9, 1, 0x42),SCE(0x051c, 0, 0x82),SCE(0x051d, 1, 0x42),SCE(0x2cda, 0, 0x82), -+SCE(0x2cdb, 1, 0x42),SCE(0x051e, 0, 0x82),SCE(0x051f, 1, 0x42),SCE(0x0520, 0, 0x82), -+SCE(0x0521, 1, 0x42),SCE(0x0522, 0, 0x82),SCE(0x0523, 1, 0x42),SCE(0x0524, 0, 0x82), -+SCE(0x0525, 1, 0x42),SCE(0x0526, 0, 0x82),SCE(0x0527, 1, 0x42),SCE(0x2c20, 0, 0x82), -+SCE(0x2c50, 1, 0x42),SCE(0x2cdc, 0, 0x82),SCE(0x2cdd, 1, 0x42),SCE(0x0531, 0, 0x82), -+SCE(0x0561, 1, 0x42),SCE(0x0532, 0, 0x82),SCE(0x0562, 1, 0x42),SCE(0x0533, 0, 0x82), -+SCE(0x0563, 1, 0x42),SCE(0x0534, 0, 0x82),SCE(0x0564, 1, 0x42),SCE(0x0535, 0, 0x82), -+SCE(0x0565, 1, 0x42),SCE(0x0536, 0, 0x82),SCE(0x0566, 1, 0x42),SCE(0x0537, 0, 0x82), -+SCE(0x0567, 1, 0x42),SCE(0x0538, 0, 0x82),SCE(0x0568, 1, 0x42),SCE(0x0539, 0, 0x82), -+SCE(0x0569, 1, 0x42),SCE(0x053a, 0, 0x82),SCE(0x056a, 1, 0x42),SCE(0x053b, 0, 0x82), -+SCE(0x056b, 1, 0x42),SCE(0x053c, 0, 0x82),SCE(0x056c, 1, 0x42),SCE(0x053d, 0, 0x82), -+SCE(0x056d, 1, 0x42),SCE(0x053e, 0, 0x82),SCE(0x056e, 1, 0x42),SCE(0x053f, 0, 0x82), -+SCE(0x056f, 1, 0x42),SCE(0x0540, 0, 0x82),SCE(0x0570, 1, 0x42),SCE(0x0541, 0, 0x82), -+SCE(0x0571, 1, 0x42),SCE(0x0542, 0, 0x82),SCE(0x0572, 1, 0x42),SCE(0x0543, 0, 0x82), -+SCE(0x0573, 1, 0x42),SCE(0x0544, 0, 0x82),SCE(0x0574, 1, 0x42),SCE(0x0545, 0, 0x82), -+SCE(0x0575, 1, 0x42),SCE(0x0546, 0, 0x82),SCE(0x0576, 1, 0x42),SCE(0x0547, 0, 0x82), -+SCE(0x0577, 1, 0x42),SCE(0x0548, 0, 0x82),SCE(0x0578, 1, 0x42),SCE(0x0549, 0, 0x82), -+SCE(0x0579, 1, 0x42),SCE(0x054a, 0, 0x82),SCE(0x057a, 1, 0x42),SCE(0x054b, 0, 0x82), -+SCE(0x057b, 1, 0x42),SCE(0x054c, 0, 0x82),SCE(0x057c, 1, 0x42),SCE(0x054d, 0, 0x82), -+SCE(0x057d, 1, 0x42),SCE(0x054e, 0, 0x82),SCE(0x057e, 1, 0x42),SCE(0x054f, 0, 0x82), -+SCE(0x057f, 1, 0x42),SCE(0x0550, 0, 0x82),SCE(0x0580, 1, 0x42),SCE(0x0551, 0, 0x82), -+SCE(0x0581, 1, 0x42),SCE(0x0552, 0, 0x82),SCE(0x0582, 1, 0x42),SCE(0x0553, 0, 0x82), -+SCE(0x0583, 1, 0x42),SCE(0x0554, 0, 0x82),SCE(0x0584, 1, 0x42),SCE(0x0555, 0, 0x82), -+SCE(0x0585, 1, 0x42),SCE(0x0556, 0, 0x82),SCE(0x0586, 1, 0x42),SCE(0x2caa, 0, 0x82), -+SCE(0x2cab, 1, 0x42),SCE(0x2c22, 0, 0x82),SCE(0x2c52, 1, 0x42),SCE(0x2c23, 0, 0x82), -+SCE(0x2c53, 1, 0x42),SCE(0x2ceb, 0, 0x82),SCE(0x2cec, 1, 0x42),SCE(0x2cca, 0, 0x82), -+SCE(0x2ccb, 1, 0x42),SCE(0xa642, 0, 0x82),SCE(0xa643, 1, 0x42),SCE(0x2ced, 0, 0x82), -+SCE(0x2cee, 1, 0x42),SCE(0x2cac, 0, 0x82),SCE(0x2cad, 1, 0x42),SCE(0xa644, 0, 0x82), -+SCE(0xa645, 1, 0x42),SCE(0x2c24, 0, 0x82),SCE(0x2c54, 1, 0x42),SCE(0xa646, 0, 0x82), -+SCE(0xa647, 1, 0x42),SCE(0x2cf2, 0, 0x82),SCE(0x2cf3, 1, 0x42),SCE(0x10408, 0, 0x82), -+SCE(0x10430, 1, 0x42),SCE(0xa648, 0, 0x82),SCE(0xa649, 1, 0x42),SCE(0xa64a, 0, 0x82), -+SCE(0xa64b, 1, 0x42),SCE(0xa64c, 0, 0x82),SCE(0xa64d, 1, 0x42),SCE(0x2cae, 0, 0x82), -+SCE(0x2caf, 1, 0x42),SCE(0xa64e, 0, 0x82),SCE(0xa64f, 1, 0x42),SCE(0xa650, 0, 0x82), -+SCE(0xa651, 1, 0x42),SCE(0xa78b, 0, 0x82),SCE(0xa78c, 1, 0x42),SCE(0xa652, 0, 0x82), -+SCE(0xa653, 1, 0x42),SCE(0xa7a8, 0, 0x82),SCE(0xa7a9, 1, 0x42),SCE(0xa654, 0, 0x82), -+SCE(0xa655, 1, 0x42),SCE(0x0266, 0, 0x42),SCE(0xa7aa, 1, 0x82),SCE(0x1e00, 0, 0x82), -+SCE(0x1e01, 1, 0x42),SCE(0x1e02, 0, 0x82),SCE(0x1e03, 1, 0x42),SCE(0x1e04, 0, 0x82), -+SCE(0x1e05, 1, 0x42),SCE(0x2c1f, 0, 0x82),SCE(0x2c4f, 1, 0x42),SCE(0x1e06, 0, 0x82), -+SCE(0x1e07, 1, 0x42),SCE(0x1040e, 0, 0x82),SCE(0x10436, 1, 0x42),SCE(0x1e08, 0, 0x82), -+SCE(0x1e09, 1, 0x42),SCE(0x1e0a, 0, 0x82),SCE(0x1e0b, 1, 0x42),SCE(0x2cb0, 0, 0x82), -+SCE(0x2cb1, 1, 0x42),SCE(0x1e0c, 0, 0x82),SCE(0x1e0d, 1, 0x42),SCE(0x1e0e, 0, 0x82), -+SCE(0x1e0f, 1, 0x42),SCE(0x1e10, 0, 0x82),SCE(0x1e11, 1, 0x42),SCE(0xa658, 0, 0x82), -+SCE(0xa659, 1, 0x42),SCE(0x1e12, 0, 0x82),SCE(0x1e13, 1, 0x42),SCE(0x1e14, 0, 0x82), -+SCE(0x1e15, 1, 0x42),SCE(0x24cd, 0, 0x82),SCE(0x24e7, 1, 0x42),SCE(0x1e16, 0, 0x82), -+SCE(0x1e17, 1, 0x42),SCE(0x1e18, 0, 0x82),SCE(0x1e19, 1, 0x42),SCE(0x1e1a, 0, 0x82), -+SCE(0x1e1b, 1, 0x42),SCE(0x1e1c, 0, 0x82),SCE(0x1e1d, 1, 0x42),SCE(0xa65a, 0, 0x82), -+SCE(0xa65b, 1, 0x42),SCE(0x1e1e, 0, 0x82),SCE(0x1e1f, 1, 0x42),SCE(0x1e20, 0, 0x82), -+SCE(0x1e21, 1, 0x42),SCE(0x1e22, 0, 0x82),SCE(0x1e23, 1, 0x42),SCE(0x1e24, 0, 0x82), -+SCE(0x1e25, 1, 0x42),SCE(0x1e26, 0, 0x82),SCE(0x1e27, 1, 0x42),SCE(0x1e28, 0, 0x82), -+SCE(0x1e29, 1, 0x42),SCE(0xa65c, 0, 0x82),SCE(0xa65d, 1, 0x42),SCE(0x1e2a, 0, 0x82), -+SCE(0x1e2b, 1, 0x42),SCE(0x1e2c, 0, 0x82),SCE(0x1e2d, 1, 0x42),SCE(0x1e2e, 0, 0x82), -+SCE(0x1e2f, 1, 0x42),SCE(0x1e30, 0, 0x82),SCE(0x1e31, 1, 0x42),SCE(0x1e32, 0, 0x82), -+SCE(0x1e33, 1, 0x42),SCE(0x1e34, 0, 0x82),SCE(0x1e35, 1, 0x42),SCE(0xa65e, 0, 0x82), -+SCE(0xa65f, 1, 0x42),SCE(0x1e36, 0, 0x82),SCE(0x1e37, 1, 0x42),SCE(0x1e38, 0, 0x82), -+SCE(0x1e39, 1, 0x42),SCE(0x1e3a, 0, 0x82),SCE(0x1e3b, 1, 0x42),SCE(0x1e3c, 0, 0x82), -+SCE(0x1e3d, 1, 0x42),SCE(0x1e3e, 0, 0x82),SCE(0x1e3f, 1, 0x42),SCE(0x1e40, 0, 0x82), -+SCE(0x1e41, 1, 0x42),SCE(0xa660, 0, 0x82),SCE(0xa661, 1, 0x42),SCE(0x1e42, 0, 0x82), -+SCE(0x1e43, 1, 0x42),SCE(0x1e44, 0, 0x82),SCE(0x1e45, 1, 0x42),SCE(0x1e46, 0, 0x82), -+SCE(0x1e47, 1, 0x42),SCE(0x2cb2, 0, 0x82),SCE(0x2cb3, 1, 0x42),SCE(0x1e48, 0, 0x82), -+SCE(0x1e49, 1, 0x42),SCE(0x2cc0, 0, 0x82),SCE(0x2cc1, 1, 0x42),SCE(0x1e4a, 0, 0x82), -+SCE(0x1e4b, 1, 0x42),SCE(0x1e4c, 0, 0x82),SCE(0x1e4d, 1, 0x42),SCE(0xa662, 0, 0x82), -+SCE(0xa663, 1, 0x42),SCE(0x1e4e, 0, 0x82),SCE(0x1e4f, 1, 0x42),SCE(0x1e50, 0, 0x82), -+SCE(0x1e51, 1, 0x42),SCE(0x1e52, 0, 0x82),SCE(0x1e53, 1, 0x42),SCE(0x1e54, 0, 0x82), -+SCE(0x1e55, 1, 0x42),SCE(0x1e56, 0, 0x82),SCE(0x1e57, 1, 0x42),SCE(0x1e58, 0, 0x82), -+SCE(0x1e59, 1, 0x42),SCE(0xa664, 0, 0x82),SCE(0xa665, 1, 0x42),SCE(0x1e5a, 0, 0x82), -+SCE(0x1e5b, 1, 0x42),SCE(0x1e5c, 0, 0x82),SCE(0x1e5d, 1, 0x42),SCE(0x1e5e, 0, 0x82), -+SCE(0x1e5f, 1, 0x42),SCE(0x1e60, 0, 0x83),SCE(0x1e61, 1, 0x43),SCE(0x1e9b, 2, 0x43), -+SCE(0x1e62, 0, 0x82),SCE(0x1e63, 1, 0x42),SCE(0x1e64, 0, 0x82),SCE(0x1e65, 1, 0x42), -+SCE(0xa666, 0, 0x82),SCE(0xa667, 1, 0x42),SCE(0x1e66, 0, 0x82),SCE(0x1e67, 1, 0x42), -+SCE(0x1e68, 0, 0x82),SCE(0x1e69, 1, 0x42),SCE(0x1e6a, 0, 0x82),SCE(0x1e6b, 1, 0x42), -+SCE(0x1e6c, 0, 0x82),SCE(0x1e6d, 1, 0x42),SCE(0x1e6e, 0, 0x82),SCE(0x1e6f, 1, 0x42), -+SCE(0x1e70, 0, 0x82),SCE(0x1e71, 1, 0x42),SCE(0xa668, 0, 0x82),SCE(0xa669, 1, 0x42), -+SCE(0x1e72, 0, 0x82),SCE(0x1e73, 1, 0x42),SCE(0x1e74, 0, 0x82),SCE(0x1e75, 1, 0x42), -+SCE(0x1e76, 0, 0x82),SCE(0x1e77, 1, 0x42),SCE(0x2cbe, 0, 0x82),SCE(0x2cbf, 1, 0x42), -+SCE(0x1e78, 0, 0x82),SCE(0x1e79, 1, 0x42),SCE(0x1e7a, 0, 0x82),SCE(0x1e7b, 1, 0x42), -+SCE(0x1e7c, 0, 0x82),SCE(0x1e7d, 1, 0x42),SCE(0xa66a, 0, 0x82),SCE(0xa66b, 1, 0x42), -+SCE(0x1e7e, 0, 0x82),SCE(0x1e7f, 1, 0x42),SCE(0x1e80, 0, 0x82),SCE(0x1e81, 1, 0x42), -+SCE(0x1e82, 0, 0x82),SCE(0x1e83, 1, 0x42),SCE(0x1e84, 0, 0x82),SCE(0x1e85, 1, 0x42), -+SCE(0x1e86, 0, 0x82),SCE(0x1e87, 1, 0x42),SCE(0x1e88, 0, 0x82),SCE(0x1e89, 1, 0x42), -+SCE(0xa66c, 0, 0x82),SCE(0xa66d, 1, 0x42),SCE(0x1e8a, 0, 0x82),SCE(0x1e8b, 1, 0x42), -+SCE(0x1e8c, 0, 0x82),SCE(0x1e8d, 1, 0x42),SCE(0x1e8e, 0, 0x82),SCE(0x1e8f, 1, 0x42), -+SCE(0x1e90, 0, 0x82),SCE(0x1e91, 1, 0x42),SCE(0x1e92, 0, 0x82),SCE(0x1e93, 1, 0x42), -+SCE(0x1e94, 0, 0x82),SCE(0x1e95, 1, 0x42),SCE(0xa696, 0, 0x82),SCE(0xa697, 1, 0x42), -+SCE(0x10406, 0, 0x82),SCE(0x1042e, 1, 0x42),SCE(0x1e60, 0, 0x83),SCE(0x1e61, 1, 0x43), -+SCE(0x1e9b, 2, 0x43),SCE(0x00df, 0, 0x42),SCE(0x1e9e, 1, 0x82),SCE(0x1ea0, 0, 0x82), -+SCE(0x1ea1, 1, 0x42),SCE(0x1ea2, 0, 0x82),SCE(0x1ea3, 1, 0x42),SCE(0x1ea4, 0, 0x82), -+SCE(0x1ea5, 1, 0x42),SCE(0x24c5, 0, 0x82),SCE(0x24df, 1, 0x42),SCE(0x1ea6, 0, 0x82), -+SCE(0x1ea7, 1, 0x42),SCE(0x1ea8, 0, 0x82),SCE(0x1ea9, 1, 0x42),SCE(0x1eaa, 0, 0x82), -+SCE(0x1eab, 1, 0x42),SCE(0x1eac, 0, 0x82),SCE(0x1ead, 1, 0x42),SCE(0x1eae, 0, 0x82), -+SCE(0x1eaf, 1, 0x42),SCE(0xff28, 0, 0x82),SCE(0xff48, 1, 0x42),SCE(0x1eb0, 0, 0x82), -+SCE(0x1eb1, 1, 0x42),SCE(0x1eb2, 0, 0x82),SCE(0x1eb3, 1, 0x42),SCE(0x10425, 0, 0x82), -+SCE(0x1044d, 1, 0x42),SCE(0x1eb4, 0, 0x82),SCE(0x1eb5, 1, 0x42),SCE(0x1eb6, 0, 0x82), -+SCE(0x1eb7, 1, 0x42),SCE(0x1eb8, 0, 0x82),SCE(0x1eb9, 1, 0x42),SCE(0x1eba, 0, 0x82), -+SCE(0x1ebb, 1, 0x42),SCE(0x1ebc, 0, 0x82),SCE(0x1ebd, 1, 0x42),SCE(0x1ebe, 0, 0x82), -+SCE(0x1ebf, 1, 0x42),SCE(0x2cb6, 0, 0x82),SCE(0x2cb7, 1, 0x42),SCE(0x1ec0, 0, 0x82), -+SCE(0x1ec1, 1, 0x42),SCE(0x1ec2, 0, 0x82),SCE(0x1ec3, 1, 0x42),SCE(0x2c9a, 0, 0x82), -+SCE(0x2c9b, 1, 0x42),SCE(0x1ec4, 0, 0x82),SCE(0x1ec5, 1, 0x42),SCE(0x1ec6, 0, 0x82), -+SCE(0x1ec7, 1, 0x42),SCE(0x1ec8, 0, 0x82),SCE(0x1ec9, 1, 0x42),SCE(0x1eca, 0, 0x82), -+SCE(0x1ecb, 1, 0x42),SCE(0x1ecc, 0, 0x82),SCE(0x1ecd, 1, 0x42),SCE(0x1ece, 0, 0x82), -+SCE(0x1ecf, 1, 0x42),SCE(0x1ed0, 0, 0x82),SCE(0x1ed1, 1, 0x42),SCE(0x1ed2, 0, 0x82), -+SCE(0x1ed3, 1, 0x42),SCE(0x1ed4, 0, 0x82),SCE(0x1ed5, 1, 0x42),SCE(0x1ed6, 0, 0x82), -+SCE(0x1ed7, 1, 0x42),SCE(0x1ed8, 0, 0x82),SCE(0x1ed9, 1, 0x42),SCE(0x1eda, 0, 0x82), -+SCE(0x1edb, 1, 0x42),SCE(0x1edc, 0, 0x82),SCE(0x1edd, 1, 0x42),SCE(0x1ede, 0, 0x82), -+SCE(0x1edf, 1, 0x42),SCE(0x1ee0, 0, 0x82),SCE(0x1ee1, 1, 0x42),SCE(0x1ee2, 0, 0x82), -+SCE(0x1ee3, 1, 0x42),SCE(0x1ee4, 0, 0x82),SCE(0x1ee5, 1, 0x42),SCE(0x03a9, 0, 0x83), -+SCE(0x03c9, 1, 0x43),SCE(0x2126, 2, 0x83),SCE(0x1ee6, 0, 0x82),SCE(0x1ee7, 1, 0x42), -+SCE(0x1ee8, 0, 0x82),SCE(0x1ee9, 1, 0x42),SCE(0x1eea, 0, 0x82),SCE(0x1eeb, 1, 0x42), -+SCE(0xff2a, 0, 0x82),SCE(0xff4a, 1, 0x42),SCE(0x1eec, 0, 0x82),SCE(0x1eed, 1, 0x42), -+SCE(0x1eee, 0, 0x82),SCE(0x1eef, 1, 0x42),SCE(0x1ef0, 0, 0x82),SCE(0x1ef1, 1, 0x42), -+SCE(0x1ef2, 0, 0x82),SCE(0x1ef3, 1, 0x42),SCE(0x1ef4, 0, 0x82),SCE(0x1ef5, 1, 0x42), -+SCE(0x1ef6, 0, 0x82),SCE(0x1ef7, 1, 0x42),SCE(0x1ef8, 0, 0x82),SCE(0x1ef9, 1, 0x42), -+SCE(0x1efa, 0, 0x82),SCE(0x1efb, 1, 0x42),SCE(0x2cb8, 0, 0x82),SCE(0x2cb9, 1, 0x42), -+SCE(0x1efc, 0, 0x82),SCE(0x1efd, 1, 0x42),SCE(0x004b, 0, 0x83),SCE(0x006b, 1, 0x43), -+SCE(0x212a, 2, 0x83),SCE(0x1efe, 0, 0x82),SCE(0x1eff, 1, 0x42),SCE(0xa680, 0, 0x82), -+SCE(0xa681, 1, 0x42),SCE(0x1f00, 0, 0x42),SCE(0x1f08, 1, 0x82),SCE(0x1f01, 0, 0x42), -+SCE(0x1f09, 1, 0x82),SCE(0x1f02, 0, 0x42),SCE(0x1f0a, 1, 0x82),SCE(0x1f03, 0, 0x42), -+SCE(0x1f0b, 1, 0x82),SCE(0x1f04, 0, 0x42),SCE(0x1f0c, 1, 0x82),SCE(0x1f05, 0, 0x42), -+SCE(0x1f0d, 1, 0x82),SCE(0x1f06, 0, 0x42),SCE(0x1f0e, 1, 0x82),SCE(0x1f07, 0, 0x42), -+SCE(0x1f0f, 1, 0x82),SCE(0x10418, 0, 0x82),SCE(0x10440, 1, 0x42),SCE(0x0265, 0, 0x42), -+SCE(0xa78d, 1, 0x82),SCE(0x1f10, 0, 0x42),SCE(0x1f18, 1, 0x82),SCE(0x1f11, 0, 0x42), -+SCE(0x1f19, 1, 0x82),SCE(0x1f12, 0, 0x42),SCE(0x1f1a, 1, 0x82),SCE(0x1f13, 0, 0x42), -+SCE(0x1f1b, 1, 0x82),SCE(0x1f14, 0, 0x42),SCE(0x1f1c, 1, 0x82),SCE(0x1f15, 0, 0x42), -+SCE(0x1f1d, 1, 0x82),SCE(0xff21, 0, 0x82),SCE(0xff41, 1, 0x42),SCE(0xa722, 0, 0x82), -+SCE(0xa723, 1, 0x42),SCE(0xff23, 0, 0x82),SCE(0xff43, 1, 0x42),SCE(0xa724, 0, 0x82), -+SCE(0xa725, 1, 0x42),SCE(0xa686, 0, 0x82),SCE(0xa687, 1, 0x42),SCE(0xa726, 0, 0x82), -+SCE(0xa727, 1, 0x42),SCE(0xff27, 0, 0x82),SCE(0xff47, 1, 0x42),SCE(0x1f20, 0, 0x42), -+SCE(0x1f28, 1, 0x82),SCE(0x1f21, 0, 0x42),SCE(0x1f29, 1, 0x82),SCE(0x1f22, 0, 0x42), -+SCE(0x1f2a, 1, 0x82),SCE(0x1f23, 0, 0x42),SCE(0x1f2b, 1, 0x82),SCE(0x1f24, 0, 0x42), -+SCE(0x1f2c, 1, 0x82),SCE(0x1f25, 0, 0x42),SCE(0x1f2d, 1, 0x82),SCE(0x1f26, 0, 0x42), -+SCE(0x1f2e, 1, 0x82),SCE(0x1f27, 0, 0x42),SCE(0x1f2f, 1, 0x82),SCE(0xff30, 0, 0x82), -+SCE(0xff50, 1, 0x42),SCE(0xa688, 0, 0x82),SCE(0xa689, 1, 0x42),SCE(0xa732, 0, 0x82), -+SCE(0xa733, 1, 0x42),SCE(0xff33, 0, 0x82),SCE(0xff53, 1, 0x42),SCE(0xa734, 0, 0x82), -+SCE(0xa735, 1, 0x42),SCE(0xff35, 0, 0x82),SCE(0xff55, 1, 0x42),SCE(0xa736, 0, 0x82), -+SCE(0xa737, 1, 0x42),SCE(0x2cba, 0, 0x82),SCE(0x2cbb, 1, 0x42),SCE(0x1f30, 0, 0x42), -+SCE(0x1f38, 1, 0x82),SCE(0x1f31, 0, 0x42),SCE(0x1f39, 1, 0x82),SCE(0x1f32, 0, 0x42), -+SCE(0x1f3a, 1, 0x82),SCE(0x1f33, 0, 0x42),SCE(0x1f3b, 1, 0x82),SCE(0x1f34, 0, 0x42), -+SCE(0x1f3c, 1, 0x82),SCE(0x1f35, 0, 0x42),SCE(0x1f3d, 1, 0x82),SCE(0x1f36, 0, 0x42), -+SCE(0x1f3e, 1, 0x82),SCE(0x1f37, 0, 0x42),SCE(0x1f3f, 1, 0x82),SCE(0xa740, 0, 0x82), -+SCE(0xa741, 1, 0x42),SCE(0xa742, 0, 0x82),SCE(0xa743, 1, 0x42),SCE(0xa744, 0, 0x82), -+SCE(0xa745, 1, 0x42),SCE(0xa746, 0, 0x82),SCE(0xa747, 1, 0x42),SCE(0x1f40, 0, 0x42), -+SCE(0x1f48, 1, 0x82),SCE(0x1f41, 0, 0x42),SCE(0x1f49, 1, 0x82),SCE(0x1f42, 0, 0x42), -+SCE(0x1f4a, 1, 0x82),SCE(0x1f43, 0, 0x42),SCE(0x1f4b, 1, 0x82),SCE(0x1f44, 0, 0x42), -+SCE(0x1f4c, 1, 0x82),SCE(0x1f45, 0, 0x42),SCE(0x1f4d, 1, 0x82),SCE(0xa74e, 0, 0x82), -+SCE(0xa74f, 1, 0x42),SCE(0xa750, 0, 0x82),SCE(0xa751, 1, 0x42),SCE(0xa752, 0, 0x82), -+SCE(0xa753, 1, 0x42),SCE(0xa754, 0, 0x82),SCE(0xa755, 1, 0x42),SCE(0xa68e, 0, 0x82), -+SCE(0xa68f, 1, 0x42),SCE(0xa756, 0, 0x82),SCE(0xa757, 1, 0x42),SCE(0xa758, 0, 0x82), -+SCE(0xa759, 1, 0x42),SCE(0x1f51, 0, 0x42),SCE(0x1f59, 1, 0x82),SCE(0xa75a, 0, 0x82), -+SCE(0xa75b, 1, 0x42),SCE(0x1f53, 0, 0x42),SCE(0x1f5b, 1, 0x82),SCE(0xa75c, 0, 0x82), -+SCE(0xa75d, 1, 0x42),SCE(0x1f55, 0, 0x42),SCE(0x1f5d, 1, 0x82),SCE(0xa75e, 0, 0x82), -+SCE(0xa75f, 1, 0x42),SCE(0x1f57, 0, 0x42),SCE(0x1f5f, 1, 0x82),SCE(0xa760, 0, 0x82), -+SCE(0xa761, 1, 0x42),SCE(0xa690, 0, 0x82),SCE(0xa691, 1, 0x42),SCE(0xa762, 0, 0x82), -+SCE(0xa763, 1, 0x42),SCE(0xff2e, 0, 0x82),SCE(0xff4e, 1, 0x42),SCE(0xa764, 0, 0x82), -+SCE(0xa765, 1, 0x42),SCE(0xa766, 0, 0x82),SCE(0xa767, 1, 0x42),SCE(0x1f60, 0, 0x42), -+SCE(0x1f68, 1, 0x82),SCE(0x1f61, 0, 0x42),SCE(0x1f69, 1, 0x82),SCE(0x1f62, 0, 0x42), -+SCE(0x1f6a, 1, 0x82),SCE(0x1f63, 0, 0x42),SCE(0x1f6b, 1, 0x82),SCE(0x1f64, 0, 0x42), -+SCE(0x1f6c, 1, 0x82),SCE(0x1f65, 0, 0x42),SCE(0x1f6d, 1, 0x82),SCE(0x1f66, 0, 0x42), -+SCE(0x1f6e, 1, 0x82),SCE(0x1f67, 0, 0x42),SCE(0x1f6f, 1, 0x82),SCE(0x2c1c, 0, 0x82), -+SCE(0x2c4c, 1, 0x42),SCE(0x2cbc, 0, 0x82),SCE(0x2cbd, 1, 0x42),SCE(0xa694, 0, 0x82), -+SCE(0xa695, 1, 0x42),SCE(0xa77b, 0, 0x82),SCE(0xa77c, 1, 0x42),SCE(0x1d79, 0, 0x42), -+SCE(0xa77d, 1, 0x82),SCE(0xa77e, 0, 0x82),SCE(0xa77f, 1, 0x42),SCE(0xa780, 0, 0x82), -+SCE(0xa781, 1, 0x42),SCE(0xa782, 0, 0x82),SCE(0xa783, 1, 0x42),SCE(0xa784, 0, 0x82), -+SCE(0xa785, 1, 0x42),SCE(0xa786, 0, 0x82),SCE(0xa787, 1, 0x42),SCE(0x1f80, 0, 0x42), -+SCE(0x1f88, 1, 0x2),SCE(0x1f81, 0, 0x42),SCE(0x1f89, 1, 0x2),SCE(0x1f82, 0, 0x42), -+SCE(0x1f8a, 1, 0x2),SCE(0x1f83, 0, 0x42),SCE(0x1f8b, 1, 0x2),SCE(0x1f84, 0, 0x42), -+SCE(0x1f8c, 1, 0x2),SCE(0x1f85, 0, 0x42),SCE(0x1f8d, 1, 0x2),SCE(0x1f86, 0, 0x42), -+SCE(0x1f8e, 1, 0x2),SCE(0x1f87, 0, 0x42),SCE(0x1f8f, 1, 0x2),SCE(0xa790, 0, 0x82), -+SCE(0xa791, 1, 0x42),SCE(0xa792, 0, 0x82),SCE(0xa793, 1, 0x42),SCE(0x1f90, 0, 0x42), -+SCE(0x1f98, 1, 0x2),SCE(0x1f91, 0, 0x42),SCE(0x1f99, 1, 0x2),SCE(0x1f92, 0, 0x42), -+SCE(0x1f9a, 1, 0x2),SCE(0x1f93, 0, 0x42),SCE(0x1f9b, 1, 0x2),SCE(0x1f94, 0, 0x42), -+SCE(0x1f9c, 1, 0x2),SCE(0x1f95, 0, 0x42),SCE(0x1f9d, 1, 0x2),SCE(0x1f96, 0, 0x42), -+SCE(0x1f9e, 1, 0x2),SCE(0x1f97, 0, 0x42),SCE(0x1f9f, 1, 0x2),SCE(0xa7a0, 0, 0x82), -+SCE(0xa7a1, 1, 0x42),SCE(0xa7a2, 0, 0x82),SCE(0xa7a3, 1, 0x42),SCE(0xa7a4, 0, 0x82), -+SCE(0xa7a5, 1, 0x42),SCE(0xa7a6, 0, 0x82),SCE(0xa7a7, 1, 0x42),SCE(0x1fa0, 0, 0x42), -+SCE(0x1fa8, 1, 0x2),SCE(0x1fa1, 0, 0x42),SCE(0x1fa9, 1, 0x2),SCE(0x1fa2, 0, 0x42), -+SCE(0x1faa, 1, 0x2),SCE(0x1fa3, 0, 0x42),SCE(0x1fab, 1, 0x2),SCE(0x1fa4, 0, 0x42), -+SCE(0x1fac, 1, 0x2),SCE(0x1fa5, 0, 0x42),SCE(0x1fad, 1, 0x2),SCE(0x1fa6, 0, 0x42), -+SCE(0x1fae, 1, 0x2),SCE(0x1fa7, 0, 0x42),SCE(0x1faf, 1, 0x2),SCE(0x1fb0, 0, 0x42), -+SCE(0x1fb8, 1, 0x82),SCE(0x1fb1, 0, 0x42),SCE(0x1fb9, 1, 0x82),SCE(0x1f70, 0, 0x42), -+SCE(0x1fba, 1, 0x82),SCE(0x1f71, 0, 0x42),SCE(0x1fbb, 1, 0x82),SCE(0x1fb3, 0, 0x42), -+SCE(0x1fbc, 1, 0x2),SCE(0x0345, 0, 0x44),SCE(0x0399, 1, 0x84),SCE(0x03b9, 2, 0x44), -+SCE(0x1fbe, 3, 0x44),SCE(0x1f72, 0, 0x42),SCE(0x1fc8, 1, 0x82),SCE(0x1f73, 0, 0x42), -+SCE(0x1fc9, 1, 0x82),SCE(0x1f74, 0, 0x42),SCE(0x1fca, 1, 0x82),SCE(0x1f75, 0, 0x42), -+SCE(0x1fcb, 1, 0x82),SCE(0x1fc3, 0, 0x42),SCE(0x1fcc, 1, 0x2),SCE(0x1fd0, 0, 0x42), -+SCE(0x1fd8, 1, 0x82),SCE(0x1fd1, 0, 0x42),SCE(0x1fd9, 1, 0x82),SCE(0x1f76, 0, 0x42), -+SCE(0x1fda, 1, 0x82),SCE(0x1f77, 0, 0x42),SCE(0x1fdb, 1, 0x82),SCE(0x10427, 0, 0x82), -+SCE(0x1044f, 1, 0x42),SCE(0x1fe0, 0, 0x42),SCE(0x1fe8, 1, 0x82),SCE(0x1fe1, 0, 0x42), -+SCE(0x1fe9, 1, 0x82),SCE(0x1f7a, 0, 0x42),SCE(0x1fea, 1, 0x82),SCE(0x1f7b, 0, 0x42), -+SCE(0x1feb, 1, 0x82),SCE(0x1fe5, 0, 0x42),SCE(0x1fec, 1, 0x82),SCE(0x10401, 0, 0x82), -+SCE(0x10429, 1, 0x42),SCE(0x1040c, 0, 0x82),SCE(0x10434, 1, 0x42),SCE(0x1f78, 0, 0x42), -+SCE(0x1ff8, 1, 0x82),SCE(0x1f79, 0, 0x42),SCE(0x1ff9, 1, 0x82),SCE(0x1f7c, 0, 0x42), -+SCE(0x1ffa, 1, 0x82),SCE(0x1f7d, 0, 0x42),SCE(0x1ffb, 1, 0x82),SCE(0x1ff3, 0, 0x42), -+SCE(0x1ffc, 1, 0x2),SCE(0x24c0, 0, 0x82),SCE(0x24da, 1, 0x42),]; -+return t; -+} -+@property immutable(FullCaseEntry[]) fullCaseTable() -+{ -+alias FCE = FullCaseEntry; -+static immutable FCE[] t = [ -+FCE("Ⰰ", 0, 2, 1), -+FCE("ⰰ", 1, 2, 1),FCE("Ⓝ", 0, 2, 1),FCE("ⓝ", 1, 2, 1),FCE("Ⰱ", 0, 2, 1), -+FCE("ⰱ", 1, 2, 1),FCE("Ⱍ", 0, 2, 1),FCE("ⱍ", 1, 2, 1),FCE("Ⰲ", 0, 2, 1), -+FCE("ⰲ", 1, 2, 1),FCE("Ⰳ", 0, 2, 1),FCE("ⰳ", 1, 2, 1),FCE("Ⰴ", 0, 2, 1), -+FCE("ⰴ", 1, 2, 1),FCE("Ⰵ", 0, 2, 1),FCE("ⰵ", 1, 2, 1),FCE("Ⰶ", 0, 2, 1), -+FCE("ⰶ", 1, 2, 1),FCE("𐐀", 0, 2, 1),FCE("𐐨", 1, 2, 1),FCE("Ⳃ", 0, 2, 1), -+FCE("ⳃ", 1, 2, 1),FCE("Ⰷ", 0, 2, 1),FCE("ⰷ", 1, 2, 1),FCE("Ⰸ", 0, 2, 1), -+FCE("ⰸ", 1, 2, 1),FCE("Ⰹ", 0, 2, 1),FCE("ⰹ", 1, 2, 1),FCE("Ⰺ", 0, 2, 1), -+FCE("ⰺ", 1, 2, 1),FCE("Ꚍ", 0, 2, 1),FCE("ꚍ", 1, 2, 1),FCE("A", 0, 2, 1), -+FCE("a", 1, 2, 1),FCE("B", 0, 2, 1),FCE("b", 1, 2, 1),FCE("C", 0, 2, 1), -+FCE("c", 1, 2, 1),FCE("D", 0, 2, 1),FCE("d", 1, 2, 1),FCE("E", 0, 2, 1), -+FCE("e", 1, 2, 1),FCE("F", 0, 2, 1),FCE("f", 1, 2, 1),FCE("G", 0, 2, 1), -+FCE("g", 1, 2, 1),FCE("H", 0, 2, 1),FCE("h", 1, 2, 1),FCE("I", 0, 2, 1), -+FCE("i", 1, 2, 1),FCE("J", 0, 2, 1),FCE("j", 1, 2, 1),FCE("K", 0, 3, 1), -+FCE("k", 1, 3, 1),FCE("K", 2, 3, 1),FCE("L", 0, 2, 1),FCE("l", 1, 2, 1), -+FCE("M", 0, 2, 1),FCE("m", 1, 2, 1),FCE("N", 0, 2, 1),FCE("n", 1, 2, 1), -+FCE("O", 0, 2, 1),FCE("o", 1, 2, 1),FCE("P", 0, 2, 1),FCE("p", 1, 2, 1), -+FCE("Q", 0, 2, 1),FCE("q", 1, 2, 1),FCE("R", 0, 2, 1),FCE("r", 1, 2, 1), -+FCE("S", 0, 3, 1),FCE("s", 1, 3, 1),FCE("ſ", 2, 3, 1),FCE("T", 0, 2, 1), -+FCE("t", 1, 2, 1),FCE("U", 0, 2, 1),FCE("u", 1, 2, 1),FCE("V", 0, 2, 1), -+FCE("v", 1, 2, 1),FCE("W", 0, 2, 1),FCE("w", 1, 2, 1),FCE("X", 0, 2, 1), -+FCE("x", 1, 2, 1),FCE("Y", 0, 2, 1),FCE("y", 1, 2, 1),FCE("Z", 0, 2, 1), -+FCE("z", 1, 2, 1),FCE("Ⰿ", 0, 2, 1),FCE("ⰿ", 1, 2, 1),FCE("Ⱀ", 0, 2, 1), -+FCE("ⱀ", 1, 2, 1),FCE("𐐂", 0, 2, 1),FCE("𐐪", 1, 2, 1),FCE("Ⳅ", 0, 2, 1), -+FCE("ⳅ", 1, 2, 1),FCE("Ⅶ", 0, 2, 1),FCE("ⅶ", 1, 2, 1),FCE("Ⱁ", 0, 2, 1), -+FCE("ⱁ", 1, 2, 1),FCE("Ⱂ", 0, 2, 1),FCE("ⱂ", 1, 2, 1),FCE("Ⅸ", 0, 2, 1), -+FCE("ⅸ", 1, 2, 1),FCE("Ⱃ", 0, 2, 1),FCE("ⱃ", 1, 2, 1),FCE("Ꚃ", 0, 2, 1), -+FCE("ꚃ", 1, 2, 1),FCE("Ⱄ", 0, 2, 1),FCE("ⱄ", 1, 2, 1),FCE("Ⅺ", 0, 2, 1), -+FCE("ⅺ", 1, 2, 1),FCE("Ⓡ", 0, 2, 1),FCE("ⓡ", 1, 2, 1),FCE("Ⱅ", 0, 2, 1), -+FCE("ⱅ", 1, 2, 1),FCE("𐐃", 0, 2, 1),FCE("𐐫", 1, 2, 1),FCE("Ⱆ", 0, 2, 1), -+FCE("ⱆ", 1, 2, 1),FCE("Ⅼ", 0, 2, 1),FCE("ⅼ", 1, 2, 1),FCE("Ⱇ", 0, 2, 1), -+FCE("ⱇ", 1, 2, 1),FCE("X", 0, 2, 1),FCE("x", 1, 2, 1),FCE("Ⱈ", 0, 2, 1), -+FCE("ⱈ", 1, 2, 1),FCE("Ⅾ", 0, 2, 1),FCE("ⅾ", 1, 2, 1),FCE("Ⱉ", 0, 2, 1), -+FCE("ⱉ", 1, 2, 1),FCE("Ⱊ", 0, 2, 1),FCE("ⱊ", 1, 2, 1),FCE("Ⱎ", 0, 2, 1), -+FCE("ⱎ", 1, 2, 1),FCE("Ⴀ", 0, 2, 1),FCE("ⴀ", 1, 2, 1),FCE("Ⴁ", 0, 2, 1), -+FCE("ⴁ", 1, 2, 1),FCE("Ⴂ", 0, 2, 1),FCE("ⴂ", 1, 2, 1),FCE("Ⴃ", 0, 2, 1), -+FCE("ⴃ", 1, 2, 1),FCE("Ⴄ", 0, 2, 1),FCE("ⴄ", 1, 2, 1),FCE("Ⴅ", 0, 2, 1), -+FCE("ⴅ", 1, 2, 1),FCE("Ⴆ", 0, 2, 1),FCE("ⴆ", 1, 2, 1),FCE("Ⴇ", 0, 2, 1), -+FCE("ⴇ", 1, 2, 1),FCE("Ⴈ", 0, 2, 1),FCE("ⴈ", 1, 2, 1),FCE("Ⴉ", 0, 2, 1), -+FCE("ⴉ", 1, 2, 1),FCE("Ⴊ", 0, 2, 1),FCE("ⴊ", 1, 2, 1),FCE("Ⴋ", 0, 2, 1), -+FCE("ⴋ", 1, 2, 1),FCE("Ⴌ", 0, 2, 1),FCE("ⴌ", 1, 2, 1),FCE("Ⴍ", 0, 2, 1), -+FCE("ⴍ", 1, 2, 1),FCE("Ⴎ", 0, 2, 1),FCE("ⴎ", 1, 2, 1),FCE("Ⴏ", 0, 2, 1), -+FCE("ⴏ", 1, 2, 1),FCE("Ⴐ", 0, 2, 1),FCE("ⴐ", 1, 2, 1),FCE("Ⴑ", 0, 2, 1), -+FCE("ⴑ", 1, 2, 1),FCE("Ⴒ", 0, 2, 1),FCE("ⴒ", 1, 2, 1),FCE("Ⴓ", 0, 2, 1), -+FCE("ⴓ", 1, 2, 1),FCE("Ⴔ", 0, 2, 1),FCE("ⴔ", 1, 2, 1),FCE("Ⴕ", 0, 2, 1), -+FCE("ⴕ", 1, 2, 1),FCE("Ⴖ", 0, 2, 1),FCE("ⴖ", 1, 2, 1),FCE("Ⴗ", 0, 2, 1), -+FCE("ⴗ", 1, 2, 1),FCE("Ⴘ", 0, 2, 1),FCE("ⴘ", 1, 2, 1),FCE("Ⴙ", 0, 2, 1), -+FCE("ⴙ", 1, 2, 1),FCE("Ⴚ", 0, 2, 1),FCE("ⴚ", 1, 2, 1),FCE("Ⴛ", 0, 2, 1), -+FCE("ⴛ", 1, 2, 1),FCE("Ⴜ", 0, 2, 1),FCE("ⴜ", 1, 2, 1),FCE("Ⴝ", 0, 2, 1), -+FCE("ⴝ", 1, 2, 1),FCE("Ⴞ", 0, 2, 1),FCE("ⴞ", 1, 2, 1),FCE("Ⴟ", 0, 2, 1), -+FCE("ⴟ", 1, 2, 1),FCE("À", 0, 2, 1),FCE("à", 1, 2, 1),FCE("Á", 0, 2, 1), -+FCE("á", 1, 2, 1),FCE("Ⴢ", 0, 2, 1),FCE("ⴢ", 1, 2, 1),FCE("Ã", 0, 2, 1), -+FCE("ã", 1, 2, 1),FCE("Ⴤ", 0, 2, 1),FCE("ⴤ", 1, 2, 1),FCE("Å", 0, 3, 1), -+FCE("å", 1, 3, 1),FCE("Å", 2, 3, 1),FCE("Æ", 0, 2, 1),FCE("æ", 1, 2, 1), -+FCE("Ç", 0, 2, 1),FCE("ç", 1, 2, 1),FCE("È", 0, 2, 1),FCE("è", 1, 2, 1), -+FCE("É", 0, 2, 1),FCE("é", 1, 2, 1),FCE("Ê", 0, 2, 1),FCE("ê", 1, 2, 1), -+FCE("Ë", 0, 2, 1),FCE("ë", 1, 2, 1),FCE("Ì", 0, 2, 1),FCE("ì", 1, 2, 1), -+FCE("Í", 0, 2, 1),FCE("í", 1, 2, 1),FCE("Î", 0, 2, 1),FCE("î", 1, 2, 1), -+FCE("Ï", 0, 2, 1),FCE("ï", 1, 2, 1),FCE("Ð", 0, 2, 1),FCE("ð", 1, 2, 1), -+FCE("Ñ", 0, 2, 1),FCE("ñ", 1, 2, 1),FCE("Ò", 0, 2, 1),FCE("ò", 1, 2, 1), -+FCE("Ó", 0, 2, 1),FCE("ó", 1, 2, 1),FCE("Ô", 0, 2, 1),FCE("ô", 1, 2, 1), -+FCE("Õ", 0, 2, 1),FCE("õ", 1, 2, 1),FCE("Ö", 0, 2, 1),FCE("ö", 1, 2, 1), -+FCE("Ø", 0, 2, 1),FCE("ø", 1, 2, 1),FCE("Ù", 0, 2, 1),FCE("ù", 1, 2, 1), -+FCE("Ú", 0, 2, 1),FCE("ú", 1, 2, 1),FCE("Û", 0, 2, 1),FCE("û", 1, 2, 1), -+FCE("Ü", 0, 2, 1),FCE("ü", 1, 2, 1),FCE("Ý", 0, 2, 1),FCE("ý", 1, 2, 1), -+FCE("Þ", 0, 2, 1),FCE("þ", 1, 2, 1),FCE("ß", 0, 3, 1),FCE("ẞ", 1, 3, 1), -+FCE("ss", 2, 3, 2),FCE("Ⱖ", 0, 2, 1),FCE("ⱖ", 1, 2, 1),FCE("Ⱗ", 0, 2, 1), -+FCE("ⱗ", 1, 2, 1),FCE("Ⱘ", 0, 2, 1),FCE("ⱘ", 1, 2, 1),FCE("𐐆", 0, 2, 1), -+FCE("𐐮", 1, 2, 1),FCE("𐐏", 0, 2, 1),FCE("𐐷", 1, 2, 1),FCE("Ⓥ", 0, 2, 1), -+FCE("ⓥ", 1, 2, 1),FCE("Ⱙ", 0, 2, 1),FCE("ⱙ", 1, 2, 1),FCE("𐐇", 0, 2, 1), -+FCE("𐐯", 1, 2, 1),FCE("Ⱚ", 0, 2, 1),FCE("ⱚ", 1, 2, 1),FCE("Ā", 0, 2, 1), -+FCE("ā", 1, 2, 1),FCE("Ă", 0, 2, 1),FCE("ă", 1, 2, 1),FCE("Ⱛ", 0, 2, 1), -+FCE("ⱛ", 1, 2, 1),FCE("Ą", 0, 2, 1),FCE("ą", 1, 2, 1),FCE("Ć", 0, 2, 1), -+FCE("ć", 1, 2, 1),FCE("Ĉ", 0, 2, 1),FCE("ĉ", 1, 2, 1),FCE("Ⱜ", 0, 2, 1), -+FCE("ⱜ", 1, 2, 1),FCE("Ċ", 0, 2, 1),FCE("ċ", 1, 2, 1),FCE("Č", 0, 2, 1), -+FCE("č", 1, 2, 1),FCE("Ď", 0, 2, 1),FCE("ď", 1, 2, 1),FCE("Ⱝ", 0, 2, 1), -+FCE("ⱝ", 1, 2, 1),FCE("Đ", 0, 2, 1),FCE("đ", 1, 2, 1),FCE("Ē", 0, 2, 1), -+FCE("ē", 1, 2, 1),FCE("Ĕ", 0, 2, 1),FCE("ĕ", 1, 2, 1),FCE("Ⱞ", 0, 2, 1), -+FCE("ⱞ", 1, 2, 1),FCE("Ė", 0, 2, 1),FCE("ė", 1, 2, 1),FCE("Ę", 0, 2, 1), -+FCE("ę", 1, 2, 1),FCE("Ě", 0, 2, 1),FCE("ě", 1, 2, 1),FCE("Ĝ", 0, 2, 1), -+FCE("ĝ", 1, 2, 1),FCE("Ğ", 0, 2, 1),FCE("ğ", 1, 2, 1),FCE("Ġ", 0, 2, 1), -+FCE("ġ", 1, 2, 1),FCE("Ģ", 0, 2, 1),FCE("ģ", 1, 2, 1),FCE("K", 0, 2, 1), -+FCE("k", 1, 2, 1),FCE("Ĥ", 0, 2, 1),FCE("ĥ", 1, 2, 1),FCE("Ħ", 0, 2, 1), -+FCE("ħ", 1, 2, 1),FCE("Ĩ", 0, 2, 1),FCE("ĩ", 1, 2, 1),FCE("Ī", 0, 2, 1), -+FCE("ī", 1, 2, 1),FCE("Å", 0, 3, 1),FCE("å", 1, 3, 1),FCE("Å", 2, 3, 1), -+FCE("Ĭ", 0, 2, 1),FCE("ĭ", 1, 2, 1),FCE("Į", 0, 2, 1),FCE("į", 1, 2, 1), -+FCE("İ", 0, 2, 1),FCE("i̇", 1, 2, 2),FCE("IJ", 0, 2, 1),FCE("ij", 1, 2, 1), -+FCE("Ĵ", 0, 2, 1),FCE("ĵ", 1, 2, 1),FCE("Ķ", 0, 2, 1),FCE("ķ", 1, 2, 1), -+FCE("Ĺ", 0, 2, 1),FCE("ĺ", 1, 2, 1),FCE("Ļ", 0, 2, 1),FCE("ļ", 1, 2, 1), -+FCE("Ⳟ", 0, 2, 1),FCE("ⳟ", 1, 2, 1),FCE("Ľ", 0, 2, 1),FCE("ľ", 1, 2, 1), -+FCE("Ŀ", 0, 2, 1),FCE("ŀ", 1, 2, 1),FCE("Ł", 0, 2, 1),FCE("ł", 1, 2, 1), -+FCE("Ń", 0, 2, 1),FCE("ń", 1, 2, 1),FCE("Ņ", 0, 2, 1),FCE("ņ", 1, 2, 1), -+FCE("Ň", 0, 2, 1),FCE("ň", 1, 2, 1),FCE("ʼn", 0, 2, 1),FCE("ʼn", 1, 2, 2), -+FCE("Ŋ", 0, 2, 1),FCE("ŋ", 1, 2, 1),FCE("Ō", 0, 2, 1),FCE("ō", 1, 2, 1), -+FCE("Ŏ", 0, 2, 1),FCE("ŏ", 1, 2, 1),FCE("Ő", 0, 2, 1),FCE("ő", 1, 2, 1), -+FCE("Œ", 0, 2, 1),FCE("œ", 1, 2, 1),FCE("Ŕ", 0, 2, 1),FCE("ŕ", 1, 2, 1), -+FCE("Ŗ", 0, 2, 1),FCE("ŗ", 1, 2, 1),FCE("Ř", 0, 2, 1),FCE("ř", 1, 2, 1), -+FCE("Ś", 0, 2, 1),FCE("ś", 1, 2, 1),FCE("Ŝ", 0, 2, 1),FCE("ŝ", 1, 2, 1), -+FCE("Ş", 0, 2, 1),FCE("ş", 1, 2, 1),FCE("Š", 0, 2, 1),FCE("š", 1, 2, 1), -+FCE("Ⅱ", 0, 2, 1),FCE("ⅱ", 1, 2, 1),FCE("Ţ", 0, 2, 1),FCE("ţ", 1, 2, 1), -+FCE("Ⅳ", 0, 2, 1),FCE("ⅳ", 1, 2, 1),FCE("Ť", 0, 2, 1),FCE("ť", 1, 2, 1), -+FCE("Ⅵ", 0, 2, 1),FCE("ⅵ", 1, 2, 1),FCE("Ŧ", 0, 2, 1),FCE("ŧ", 1, 2, 1), -+FCE("Ⅷ", 0, 2, 1),FCE("ⅷ", 1, 2, 1),FCE("Ũ", 0, 2, 1),FCE("ũ", 1, 2, 1), -+FCE("Ⅹ", 0, 2, 1),FCE("ⅹ", 1, 2, 1),FCE("Ū", 0, 2, 1),FCE("ū", 1, 2, 1), -+FCE("Ⅻ", 0, 2, 1),FCE("ⅻ", 1, 2, 1),FCE("Ŭ", 0, 2, 1),FCE("ŭ", 1, 2, 1), -+FCE("Ⅽ", 0, 2, 1),FCE("ⅽ", 1, 2, 1),FCE("Ů", 0, 2, 1),FCE("ů", 1, 2, 1), -+FCE("Ⅿ", 0, 2, 1),FCE("ⅿ", 1, 2, 1),FCE("Ű", 0, 2, 1),FCE("ű", 1, 2, 1), -+FCE("Ⳍ", 0, 2, 1),FCE("ⳍ", 1, 2, 1),FCE("Ų", 0, 2, 1),FCE("ų", 1, 2, 1), -+FCE("Ŵ", 0, 2, 1),FCE("ŵ", 1, 2, 1),FCE("Ŷ", 0, 2, 1),FCE("ŷ", 1, 2, 1), -+FCE("ÿ", 0, 2, 1),FCE("Ÿ", 1, 2, 1),FCE("Ź", 0, 2, 1),FCE("ź", 1, 2, 1), -+FCE("Ż", 0, 2, 1),FCE("ż", 1, 2, 1),FCE("Ž", 0, 2, 1),FCE("ž", 1, 2, 1), -+FCE("S", 0, 3, 1),FCE("s", 1, 3, 1),FCE("ſ", 2, 3, 1),FCE("Ɓ", 0, 2, 1), -+FCE("ɓ", 1, 2, 1),FCE("Ƃ", 0, 2, 1),FCE("ƃ", 1, 2, 1),FCE("Ↄ", 0, 2, 1), -+FCE("ↄ", 1, 2, 1),FCE("Ƅ", 0, 2, 1),FCE("ƅ", 1, 2, 1),FCE("Ɔ", 0, 2, 1), -+FCE("ɔ", 1, 2, 1),FCE("Ƈ", 0, 2, 1),FCE("ƈ", 1, 2, 1),FCE("Ɖ", 0, 2, 1), -+FCE("ɖ", 1, 2, 1),FCE("Ɗ", 0, 2, 1),FCE("ɗ", 1, 2, 1),FCE("Ƌ", 0, 2, 1), -+FCE("ƌ", 1, 2, 1),FCE("Ǝ", 0, 2, 1),FCE("ǝ", 1, 2, 1),FCE("Ə", 0, 2, 1), -+FCE("ə", 1, 2, 1),FCE("Ɛ", 0, 2, 1),FCE("ɛ", 1, 2, 1),FCE("Ƒ", 0, 2, 1), -+FCE("ƒ", 1, 2, 1),FCE("Ɠ", 0, 2, 1),FCE("ɠ", 1, 2, 1),FCE("Ɣ", 0, 2, 1), -+FCE("ɣ", 1, 2, 1),FCE("Ɩ", 0, 2, 1),FCE("ɩ", 1, 2, 1),FCE("Ɨ", 0, 2, 1), -+FCE("ɨ", 1, 2, 1),FCE("Ƙ", 0, 2, 1),FCE("ƙ", 1, 2, 1),FCE("Ɯ", 0, 2, 1), -+FCE("ɯ", 1, 2, 1),FCE("Ɲ", 0, 2, 1),FCE("ɲ", 1, 2, 1),FCE("Ꙋ", 0, 2, 1), -+FCE("ꙋ", 1, 2, 1),FCE("Ɵ", 0, 2, 1),FCE("ɵ", 1, 2, 1),FCE("Ơ", 0, 2, 1), -+FCE("ơ", 1, 2, 1),FCE("Ƣ", 0, 2, 1),FCE("ƣ", 1, 2, 1),FCE("Ƥ", 0, 2, 1), -+FCE("ƥ", 1, 2, 1),FCE("Ʀ", 0, 2, 1),FCE("ʀ", 1, 2, 1),FCE("Ƨ", 0, 2, 1), -+FCE("ƨ", 1, 2, 1),FCE("Ʃ", 0, 2, 1),FCE("ʃ", 1, 2, 1),FCE("Ƭ", 0, 2, 1), -+FCE("ƭ", 1, 2, 1),FCE("Ʈ", 0, 2, 1),FCE("ʈ", 1, 2, 1),FCE("Ư", 0, 2, 1), -+FCE("ư", 1, 2, 1),FCE("Ʊ", 0, 2, 1),FCE("ʊ", 1, 2, 1),FCE("Ʋ", 0, 2, 1), -+FCE("ʋ", 1, 2, 1),FCE("Ƴ", 0, 2, 1),FCE("ƴ", 1, 2, 1),FCE("Ƶ", 0, 2, 1), -+FCE("ƶ", 1, 2, 1),FCE("Ʒ", 0, 2, 1),FCE("ʒ", 1, 2, 1),FCE("Ƹ", 0, 2, 1), -+FCE("ƹ", 1, 2, 1),FCE("Ƽ", 0, 2, 1),FCE("ƽ", 1, 2, 1),FCE("DŽ", 0, 3, 1), -+FCE("Dž", 1, 3, 1),FCE("dž", 2, 3, 1),FCE("DŽ", 0, 3, 1),FCE("Dž", 1, 3, 1), -+FCE("dž", 2, 3, 1),FCE("LJ", 0, 3, 1),FCE("Lj", 1, 3, 1),FCE("lj", 2, 3, 1), -+FCE("LJ", 0, 3, 1),FCE("Lj", 1, 3, 1),FCE("lj", 2, 3, 1),FCE("NJ", 0, 3, 1), -+FCE("Nj", 1, 3, 1),FCE("nj", 2, 3, 1),FCE("NJ", 0, 3, 1),FCE("Nj", 1, 3, 1), -+FCE("nj", 2, 3, 1),FCE("Ǎ", 0, 2, 1),FCE("ǎ", 1, 2, 1),FCE("Ǐ", 0, 2, 1), -+FCE("ǐ", 1, 2, 1),FCE("Ǒ", 0, 2, 1),FCE("ǒ", 1, 2, 1),FCE("Ǔ", 0, 2, 1), -+FCE("ǔ", 1, 2, 1),FCE("Ǖ", 0, 2, 1),FCE("ǖ", 1, 2, 1),FCE("Ǘ", 0, 2, 1), -+FCE("ǘ", 1, 2, 1),FCE("Ǚ", 0, 2, 1),FCE("ǚ", 1, 2, 1),FCE("Ǜ", 0, 2, 1), -+FCE("ǜ", 1, 2, 1),FCE("Ǟ", 0, 2, 1),FCE("ǟ", 1, 2, 1),FCE("V", 0, 2, 1), -+FCE("v", 1, 2, 1),FCE("Ǡ", 0, 2, 1),FCE("ǡ", 1, 2, 1),FCE("Ǣ", 0, 2, 1), -+FCE("ǣ", 1, 2, 1),FCE("Ǥ", 0, 2, 1),FCE("ǥ", 1, 2, 1),FCE("Ǧ", 0, 2, 1), -+FCE("ǧ", 1, 2, 1),FCE("Ǩ", 0, 2, 1),FCE("ǩ", 1, 2, 1),FCE("Ǫ", 0, 2, 1), -+FCE("ǫ", 1, 2, 1),FCE("Ǭ", 0, 2, 1),FCE("ǭ", 1, 2, 1),FCE("Ǯ", 0, 2, 1), -+FCE("ǯ", 1, 2, 1),FCE("ǰ", 0, 2, 1),FCE("ǰ", 1, 2, 2),FCE("DZ", 0, 3, 1), -+FCE("Dz", 1, 3, 1),FCE("dz", 2, 3, 1),FCE("DZ", 0, 3, 1),FCE("Dz", 1, 3, 1), -+FCE("dz", 2, 3, 1),FCE("Ǵ", 0, 2, 1),FCE("ǵ", 1, 2, 1),FCE("ƕ", 0, 2, 1), -+FCE("Ƕ", 1, 2, 1),FCE("ƿ", 0, 2, 1),FCE("Ƿ", 1, 2, 1),FCE("Ǹ", 0, 2, 1), -+FCE("ǹ", 1, 2, 1),FCE("𐐝", 0, 2, 1),FCE("𐑅", 1, 2, 1),FCE("Ǻ", 0, 2, 1), -+FCE("ǻ", 1, 2, 1),FCE("Ǽ", 0, 2, 1),FCE("ǽ", 1, 2, 1),FCE("Ǿ", 0, 2, 1), -+FCE("ǿ", 1, 2, 1),FCE("Ȁ", 0, 2, 1),FCE("ȁ", 1, 2, 1),FCE("Ȃ", 0, 2, 1), -+FCE("ȃ", 1, 2, 1),FCE("Ȅ", 0, 2, 1),FCE("ȅ", 1, 2, 1),FCE("Ȇ", 0, 2, 1), -+FCE("ȇ", 1, 2, 1),FCE("fi", 0, 2, 1),FCE("fi", 1, 2, 2),FCE("Ȉ", 0, 2, 1), -+FCE("ȉ", 1, 2, 1),FCE("Ȋ", 0, 2, 1),FCE("ȋ", 1, 2, 1),FCE("Ȍ", 0, 2, 1), -+FCE("ȍ", 1, 2, 1),FCE("Ȏ", 0, 2, 1),FCE("ȏ", 1, 2, 1),FCE("Ȑ", 0, 2, 1), -+FCE("ȑ", 1, 2, 1),FCE("Ȓ", 0, 2, 1),FCE("ȓ", 1, 2, 1),FCE("Ȕ", 0, 2, 1), -+FCE("ȕ", 1, 2, 1),FCE("Ȗ", 0, 2, 1),FCE("ȗ", 1, 2, 1),FCE("Ș", 0, 2, 1), -+FCE("ș", 1, 2, 1),FCE("Ț", 0, 2, 1),FCE("ț", 1, 2, 1),FCE("Ȝ", 0, 2, 1), -+FCE("ȝ", 1, 2, 1),FCE("Ȟ", 0, 2, 1),FCE("ȟ", 1, 2, 1),FCE("ƞ", 0, 2, 1), -+FCE("Ƞ", 1, 2, 1),FCE("Ȣ", 0, 2, 1),FCE("ȣ", 1, 2, 1),FCE("Ȥ", 0, 2, 1), -+FCE("ȥ", 1, 2, 1),FCE("Ȧ", 0, 2, 1),FCE("ȧ", 1, 2, 1),FCE("Ȩ", 0, 2, 1), -+FCE("ȩ", 1, 2, 1),FCE("Ꝗ", 0, 2, 1),FCE("ꝗ", 1, 2, 1),FCE("Ȫ", 0, 2, 1), -+FCE("ȫ", 1, 2, 1),FCE("Ȭ", 0, 2, 1),FCE("ȭ", 1, 2, 1),FCE("Ȯ", 0, 2, 1), -+FCE("ȯ", 1, 2, 1),FCE("Ȱ", 0, 2, 1),FCE("ȱ", 1, 2, 1),FCE("Ȳ", 0, 2, 1), -+FCE("ȳ", 1, 2, 1),FCE("Ꚅ", 0, 2, 1),FCE("ꚅ", 1, 2, 1),FCE("Ⱥ", 0, 2, 1), -+FCE("ⱥ", 1, 2, 1),FCE("Ȼ", 0, 2, 1),FCE("ȼ", 1, 2, 1),FCE("ƚ", 0, 2, 1), -+FCE("Ƚ", 1, 2, 1),FCE("Ⱦ", 0, 2, 1),FCE("ⱦ", 1, 2, 1),FCE("Ɂ", 0, 2, 1), -+FCE("ɂ", 1, 2, 1),FCE("𐐒", 0, 2, 1),FCE("𐐺", 1, 2, 1),FCE("ƀ", 0, 2, 1), -+FCE("Ƀ", 1, 2, 1),FCE("Ʉ", 0, 2, 1),FCE("ʉ", 1, 2, 1),FCE("Ʌ", 0, 2, 1), -+FCE("ʌ", 1, 2, 1),FCE("Ɇ", 0, 2, 1),FCE("ɇ", 1, 2, 1),FCE("Ɉ", 0, 2, 1), -+FCE("ɉ", 1, 2, 1),FCE("Ɋ", 0, 2, 1),FCE("ɋ", 1, 2, 1),FCE("Ɍ", 0, 2, 1), -+FCE("ɍ", 1, 2, 1),FCE("Ⱋ", 0, 2, 1),FCE("ⱋ", 1, 2, 1),FCE("Ɏ", 0, 2, 1), -+FCE("ɏ", 1, 2, 1),FCE("𐐊", 0, 2, 1),FCE("𐐲", 1, 2, 1),FCE("Ⅰ", 0, 2, 1), -+FCE("ⅰ", 1, 2, 1),FCE("Ꚓ", 0, 2, 1),FCE("ꚓ", 1, 2, 1),FCE("ɽ", 0, 2, 1), -+FCE("Ɽ", 1, 2, 1),FCE("𐐐", 0, 2, 1),FCE("𐐸", 1, 2, 1),FCE("Ⱑ", 0, 2, 1), -+FCE("ⱑ", 1, 2, 1),FCE("Ⱪ", 0, 2, 1),FCE("ⱪ", 1, 2, 1),FCE("𐐉", 0, 2, 1), -+FCE("𐐱", 1, 2, 1),FCE("𐐔", 0, 2, 1),FCE("𐐼", 1, 2, 1),FCE("ﬕ", 0, 2, 1), -+FCE("մի", 1, 2, 2),FCE("Ⅲ", 0, 2, 1),FCE("ⅲ", 1, 2, 1),FCE("𐐞", 0, 2, 1), -+FCE("𐑆", 1, 2, 1),FCE("ɱ", 0, 2, 1),FCE("Ɱ", 1, 2, 1),FCE("𐐕", 0, 2, 1), -+FCE("𐐽", 1, 2, 1),FCE("ɒ", 0, 2, 1),FCE("Ɒ", 1, 2, 1),FCE("Ⱳ", 0, 2, 1), -+FCE("ⱳ", 1, 2, 1),FCE("Ⰻ", 0, 2, 1),FCE("ⰻ", 1, 2, 1),FCE("𐐖", 0, 2, 1), -+FCE("𐐾", 1, 2, 1),FCE("Ꚗ", 0, 2, 1),FCE("ꚗ", 1, 2, 1),FCE("Ⱶ", 0, 2, 1), -+FCE("ⱶ", 1, 2, 1),FCE("Ⅴ", 0, 2, 1),FCE("ⅴ", 1, 2, 1),FCE("Ꙁ", 0, 2, 1), -+FCE("ꙁ", 1, 2, 1),FCE("B", 0, 2, 1),FCE("b", 1, 2, 1),FCE("Ⰼ", 0, 2, 1), -+FCE("ⰼ", 1, 2, 1),FCE("𐐗", 0, 2, 1),FCE("𐐿", 1, 2, 1),FCE("D", 0, 2, 1), -+FCE("d", 1, 2, 1),FCE("E", 0, 2, 1),FCE("e", 1, 2, 1),FCE("F", 0, 2, 1), -+FCE("f", 1, 2, 1),FCE("Ⰽ", 0, 2, 1),FCE("ⰽ", 1, 2, 1),FCE("Ⓛ", 0, 2, 1), -+FCE("ⓛ", 1, 2, 1),FCE("Ꜩ", 0, 2, 1),FCE("ꜩ", 1, 2, 1),FCE("ȿ", 0, 2, 1), -+FCE("Ȿ", 1, 2, 1),FCE("𐐑", 0, 2, 1),FCE("𐐹", 1, 2, 1),FCE("I", 0, 2, 1), -+FCE("i", 1, 2, 1),FCE("𐐋", 0, 2, 1),FCE("𐐳", 1, 2, 1),FCE("Ꜫ", 0, 2, 1), -+FCE("ꜫ", 1, 2, 1),FCE("ff", 0, 2, 1),FCE("ff", 1, 2, 2),FCE("Ⲁ", 0, 2, 1), -+FCE("ⲁ", 1, 2, 1),FCE("fl", 0, 2, 1),FCE("fl", 1, 2, 2),FCE("ffi", 0, 2, 1), -+FCE("ffi", 1, 2, 3),FCE("ffl", 0, 2, 1),FCE("ffl", 1, 2, 3),FCE("ſt", 0, 3, 1), -+FCE("st", 1, 3, 1),FCE("st", 2, 3, 2),FCE("ſt", 0, 3, 1),FCE("st", 1, 3, 1), -+FCE("st", 2, 3, 2),FCE("Ꜭ", 0, 2, 1),FCE("ꜭ", 1, 2, 1),FCE("Ⰾ", 0, 2, 1), -+FCE("ⰾ", 1, 2, 1),FCE("M", 0, 2, 1),FCE("m", 1, 2, 1),FCE("ﬓ", 0, 2, 1), -+FCE("մն", 1, 2, 2),FCE("ﬔ", 0, 2, 1),FCE("մե", 1, 2, 2),FCE("Ꜯ", 0, 2, 1), -+FCE("ꜯ", 1, 2, 1),FCE("ﬖ", 0, 2, 1),FCE("վն", 1, 2, 2),FCE("ﬗ", 0, 2, 1), -+FCE("մխ", 1, 2, 2),FCE("𐐍", 0, 2, 1),FCE("𐐵", 1, 2, 1),FCE("O", 0, 2, 1), -+FCE("o", 1, 2, 1),FCE("Q", 0, 2, 1),FCE("q", 1, 2, 1),FCE("R", 0, 2, 1), -+FCE("r", 1, 2, 1),FCE("𐐚", 0, 2, 1),FCE("𐑂", 1, 2, 1),FCE("T", 0, 2, 1), -+FCE("t", 1, 2, 1),FCE("Ⲙ", 0, 2, 1),FCE("ⲙ", 1, 2, 1),FCE("Ⲋ", 0, 2, 1), -+FCE("ⲋ", 1, 2, 1),FCE("ͅ", 0, 4, 1),FCE("Ι", 1, 4, 1),FCE("ι", 2, 4, 1), -+FCE("ι", 3, 4, 1),FCE("Ⲍ", 0, 2, 1),FCE("ⲍ", 1, 2, 1),FCE("W", 0, 2, 1), -+FCE("w", 1, 2, 1),FCE("Ꙗ", 0, 2, 1),FCE("ꙗ", 1, 2, 1),FCE("𐐛", 0, 2, 1), -+FCE("𐑃", 1, 2, 1),FCE("Ꜹ", 0, 2, 1),FCE("ꜹ", 1, 2, 1),FCE("Ⲏ", 0, 2, 1), -+FCE("ⲏ", 1, 2, 1),FCE("Y", 0, 2, 1),FCE("y", 1, 2, 1),FCE("𐐄", 0, 2, 1), -+FCE("𐐬", 1, 2, 1),FCE("Ꜻ", 0, 2, 1),FCE("ꜻ", 1, 2, 1),FCE("Ⲑ", 0, 2, 1), -+FCE("ⲑ", 1, 2, 1),FCE("Ꜽ", 0, 2, 1),FCE("ꜽ", 1, 2, 1),FCE("Ⲓ", 0, 2, 1), -+FCE("ⲓ", 1, 2, 1),FCE("𐐜", 0, 2, 1),FCE("𐑄", 1, 2, 1),FCE("Ͱ", 0, 2, 1), -+FCE("ͱ", 1, 2, 1),FCE("Ͳ", 0, 2, 1),FCE("ͳ", 1, 2, 1),FCE("Ꜿ", 0, 2, 1), -+FCE("ꜿ", 1, 2, 1),FCE("Ͷ", 0, 2, 1),FCE("ͷ", 1, 2, 1),FCE("Ⲕ", 0, 2, 1), -+FCE("ⲕ", 1, 2, 1),FCE("Ⲗ", 0, 2, 1),FCE("ⲗ", 1, 2, 1),FCE("Ά", 0, 2, 1), -+FCE("ά", 1, 2, 1),FCE("𐐅", 0, 2, 1),FCE("𐐭", 1, 2, 1),FCE("Έ", 0, 2, 1), -+FCE("έ", 1, 2, 1),FCE("Ή", 0, 2, 1),FCE("ή", 1, 2, 1),FCE("Ί", 0, 2, 1), -+FCE("ί", 1, 2, 1),FCE("Ό", 0, 2, 1),FCE("ό", 1, 2, 1),FCE("Ύ", 0, 2, 1), -+FCE("ύ", 1, 2, 1),FCE("Ώ", 0, 2, 1),FCE("ώ", 1, 2, 1),FCE("ΐ", 0, 3, 1), -+FCE("ΐ", 1, 3, 1),FCE("ΐ", 2, 3, 3),FCE("Α", 0, 2, 1),FCE("α", 1, 2, 1), -+FCE("Β", 0, 3, 1),FCE("β", 1, 3, 1),FCE("ϐ", 2, 3, 1),FCE("Γ", 0, 2, 1), -+FCE("γ", 1, 2, 1),FCE("Δ", 0, 2, 1),FCE("δ", 1, 2, 1),FCE("Ε", 0, 3, 1), -+FCE("ε", 1, 3, 1),FCE("ϵ", 2, 3, 1),FCE("Ζ", 0, 2, 1),FCE("ζ", 1, 2, 1), -+FCE("Η", 0, 2, 1),FCE("η", 1, 2, 1),FCE("Θ", 0, 4, 1),FCE("θ", 1, 4, 1), -+FCE("ϑ", 2, 4, 1),FCE("ϴ", 3, 4, 1),FCE("ͅ", 0, 4, 1),FCE("Ι", 1, 4, 1), -+FCE("ι", 2, 4, 1),FCE("ι", 3, 4, 1),FCE("Κ", 0, 3, 1),FCE("κ", 1, 3, 1), -+FCE("ϰ", 2, 3, 1),FCE("Λ", 0, 2, 1),FCE("λ", 1, 2, 1),FCE("µ", 0, 3, 1), -+FCE("Μ", 1, 3, 1),FCE("μ", 2, 3, 1),FCE("Ν", 0, 2, 1),FCE("ν", 1, 2, 1), -+FCE("Ξ", 0, 2, 1),FCE("ξ", 1, 2, 1),FCE("Ο", 0, 2, 1),FCE("ο", 1, 2, 1), -+FCE("Π", 0, 3, 1),FCE("π", 1, 3, 1),FCE("ϖ", 2, 3, 1),FCE("Ρ", 0, 3, 1), -+FCE("ρ", 1, 3, 1),FCE("ϱ", 2, 3, 1),FCE("Σ", 0, 3, 1),FCE("ς", 1, 3, 1), -+FCE("σ", 2, 3, 1),FCE("Τ", 0, 2, 1),FCE("τ", 1, 2, 1),FCE("Υ", 0, 2, 1), -+FCE("υ", 1, 2, 1),FCE("Φ", 0, 3, 1),FCE("φ", 1, 3, 1),FCE("ϕ", 2, 3, 1), -+FCE("Χ", 0, 2, 1),FCE("χ", 1, 2, 1),FCE("Ψ", 0, 2, 1),FCE("ψ", 1, 2, 1), -+FCE("Ω", 0, 3, 1),FCE("ω", 1, 3, 1),FCE("Ω", 2, 3, 1),FCE("Ϊ", 0, 2, 1), -+FCE("ϊ", 1, 2, 1),FCE("Ϋ", 0, 2, 1),FCE("ϋ", 1, 2, 1),FCE("Ⓣ", 0, 2, 1), -+FCE("ⓣ", 1, 2, 1),FCE("Ⳡ", 0, 2, 1),FCE("ⳡ", 1, 2, 1),FCE("ΰ", 0, 3, 1), -+FCE("ΰ", 1, 3, 1),FCE("ΰ", 2, 3, 3),FCE("Ꝉ", 0, 2, 1),FCE("ꝉ", 1, 2, 1), -+FCE("Ⲝ", 0, 2, 1),FCE("ⲝ", 1, 2, 1),FCE("Ⲟ", 0, 2, 1),FCE("ⲟ", 1, 2, 1), -+FCE("Ꝋ", 0, 2, 1),FCE("ꝋ", 1, 2, 1),FCE("Ⲡ", 0, 2, 1),FCE("ⲡ", 1, 2, 1), -+FCE("Σ", 0, 3, 1),FCE("ς", 1, 3, 1),FCE("σ", 2, 3, 1),FCE("𐐟", 0, 2, 1), -+FCE("𐑇", 1, 2, 1),FCE("Ꝍ", 0, 2, 1),FCE("ꝍ", 1, 2, 1),FCE("Ꚋ", 0, 2, 1), -+FCE("ꚋ", 1, 2, 1),FCE("Ⲣ", 0, 2, 1),FCE("ⲣ", 1, 2, 1),FCE("Ϗ", 0, 2, 1), -+FCE("ϗ", 1, 2, 1),FCE("Β", 0, 3, 1),FCE("β", 1, 3, 1),FCE("ϐ", 2, 3, 1), -+FCE("Θ", 0, 4, 1),FCE("θ", 1, 4, 1),FCE("ϑ", 2, 4, 1),FCE("ϴ", 3, 4, 1), -+FCE("Φ", 0, 3, 1),FCE("φ", 1, 3, 1),FCE("ϕ", 2, 3, 1),FCE("Π", 0, 3, 1), -+FCE("π", 1, 3, 1),FCE("ϖ", 2, 3, 1),FCE("Ϙ", 0, 2, 1),FCE("ϙ", 1, 2, 1), -+FCE("Ⲥ", 0, 2, 1),FCE("ⲥ", 1, 2, 1),FCE("Ϛ", 0, 2, 1),FCE("ϛ", 1, 2, 1), -+FCE("Ϝ", 0, 2, 1),FCE("ϝ", 1, 2, 1),FCE("Ϟ", 0, 2, 1),FCE("ϟ", 1, 2, 1), -+FCE("Ϡ", 0, 2, 1),FCE("ϡ", 1, 2, 1),FCE("Ꝑ", 0, 2, 1),FCE("ꝑ", 1, 2, 1), -+FCE("Ϣ", 0, 2, 1),FCE("ϣ", 1, 2, 1),FCE("Ϥ", 0, 2, 1),FCE("ϥ", 1, 2, 1), -+FCE("Ⲧ", 0, 2, 1),FCE("ⲧ", 1, 2, 1),FCE("Ϧ", 0, 2, 1),FCE("ϧ", 1, 2, 1), -+FCE("𐐠", 0, 2, 1),FCE("𐑈", 1, 2, 1),FCE("Ϩ", 0, 2, 1),FCE("ϩ", 1, 2, 1), -+FCE("Ⳣ", 0, 2, 1),FCE("ⳣ", 1, 2, 1),FCE("Ϫ", 0, 2, 1),FCE("ϫ", 1, 2, 1), -+FCE("Ϭ", 0, 2, 1),FCE("ϭ", 1, 2, 1),FCE("Ꝓ", 0, 2, 1),FCE("ꝓ", 1, 2, 1), -+FCE("Ϯ", 0, 2, 1),FCE("ϯ", 1, 2, 1),FCE("Κ", 0, 3, 1),FCE("κ", 1, 3, 1), -+FCE("ϰ", 2, 3, 1),FCE("Ρ", 0, 3, 1),FCE("ρ", 1, 3, 1),FCE("ϱ", 2, 3, 1), -+FCE("Θ", 0, 4, 1),FCE("θ", 1, 4, 1),FCE("ϑ", 2, 4, 1),FCE("ϴ", 3, 4, 1), -+FCE("Ε", 0, 3, 1),FCE("ε", 1, 3, 1),FCE("ϵ", 2, 3, 1),FCE("Ϸ", 0, 2, 1), -+FCE("ϸ", 1, 2, 1),FCE("ϲ", 0, 2, 1),FCE("Ϲ", 1, 2, 1),FCE("Ϻ", 0, 2, 1), -+FCE("ϻ", 1, 2, 1),FCE("ͻ", 0, 2, 1),FCE("Ͻ", 1, 2, 1),FCE("ͼ", 0, 2, 1), -+FCE("Ͼ", 1, 2, 1),FCE("ͽ", 0, 2, 1),FCE("Ͽ", 1, 2, 1),FCE("Ѐ", 0, 2, 1), -+FCE("ѐ", 1, 2, 1),FCE("Ё", 0, 2, 1),FCE("ё", 1, 2, 1),FCE("Ђ", 0, 2, 1), -+FCE("ђ", 1, 2, 1),FCE("Ѓ", 0, 2, 1),FCE("ѓ", 1, 2, 1),FCE("Є", 0, 2, 1), -+FCE("є", 1, 2, 1),FCE("Ѕ", 0, 2, 1),FCE("ѕ", 1, 2, 1),FCE("І", 0, 2, 1), -+FCE("і", 1, 2, 1),FCE("Ї", 0, 2, 1),FCE("ї", 1, 2, 1),FCE("Ј", 0, 2, 1), -+FCE("ј", 1, 2, 1),FCE("Љ", 0, 2, 1),FCE("љ", 1, 2, 1),FCE("Њ", 0, 2, 1), -+FCE("њ", 1, 2, 1),FCE("Ћ", 0, 2, 1),FCE("ћ", 1, 2, 1),FCE("Ќ", 0, 2, 1), -+FCE("ќ", 1, 2, 1),FCE("Ѝ", 0, 2, 1),FCE("ѝ", 1, 2, 1),FCE("Ў", 0, 2, 1), -+FCE("ў", 1, 2, 1),FCE("Џ", 0, 2, 1),FCE("џ", 1, 2, 1),FCE("А", 0, 2, 1), -+FCE("а", 1, 2, 1),FCE("Б", 0, 2, 1),FCE("б", 1, 2, 1),FCE("В", 0, 2, 1), -+FCE("в", 1, 2, 1),FCE("Г", 0, 2, 1),FCE("г", 1, 2, 1),FCE("Д", 0, 2, 1), -+FCE("д", 1, 2, 1),FCE("Е", 0, 2, 1),FCE("е", 1, 2, 1),FCE("Ж", 0, 2, 1), -+FCE("ж", 1, 2, 1),FCE("З", 0, 2, 1),FCE("з", 1, 2, 1),FCE("И", 0, 2, 1), -+FCE("и", 1, 2, 1),FCE("Й", 0, 2, 1),FCE("й", 1, 2, 1),FCE("К", 0, 2, 1), -+FCE("к", 1, 2, 1),FCE("Л", 0, 2, 1),FCE("л", 1, 2, 1),FCE("М", 0, 2, 1), -+FCE("м", 1, 2, 1),FCE("Н", 0, 2, 1),FCE("н", 1, 2, 1),FCE("О", 0, 2, 1), -+FCE("о", 1, 2, 1),FCE("П", 0, 2, 1),FCE("п", 1, 2, 1),FCE("Р", 0, 2, 1), -+FCE("р", 1, 2, 1),FCE("С", 0, 2, 1),FCE("с", 1, 2, 1),FCE("Т", 0, 2, 1), -+FCE("т", 1, 2, 1),FCE("У", 0, 2, 1),FCE("у", 1, 2, 1),FCE("Ф", 0, 2, 1), -+FCE("ф", 1, 2, 1),FCE("Х", 0, 2, 1),FCE("х", 1, 2, 1),FCE("Ц", 0, 2, 1), -+FCE("ц", 1, 2, 1),FCE("Ч", 0, 2, 1),FCE("ч", 1, 2, 1),FCE("Ш", 0, 2, 1), -+FCE("ш", 1, 2, 1),FCE("Щ", 0, 2, 1),FCE("щ", 1, 2, 1),FCE("Ъ", 0, 2, 1), -+FCE("ъ", 1, 2, 1),FCE("Ы", 0, 2, 1),FCE("ы", 1, 2, 1),FCE("Ь", 0, 2, 1), -+FCE("ь", 1, 2, 1),FCE("Э", 0, 2, 1),FCE("э", 1, 2, 1),FCE("Ю", 0, 2, 1), -+FCE("ю", 1, 2, 1),FCE("Я", 0, 2, 1),FCE("я", 1, 2, 1),FCE("Z", 0, 2, 1), -+FCE("z", 1, 2, 1),FCE("Ⲵ", 0, 2, 1),FCE("ⲵ", 1, 2, 1),FCE("µ", 0, 3, 1), -+FCE("Μ", 1, 3, 1),FCE("μ", 2, 3, 1),FCE("𐐣", 0, 2, 1),FCE("𐑋", 1, 2, 1), -+FCE("Ⓐ", 0, 2, 1),FCE("ⓐ", 1, 2, 1),FCE("Ⓒ", 0, 2, 1),FCE("ⓒ", 1, 2, 1), -+FCE("L", 0, 2, 1),FCE("l", 1, 2, 1),FCE("𐐡", 0, 2, 1),FCE("𐑉", 1, 2, 1), -+FCE("Ⓔ", 0, 2, 1),FCE("ⓔ", 1, 2, 1),FCE("𐐙", 0, 2, 1),FCE("𐑁", 1, 2, 1), -+FCE("Ѡ", 0, 2, 1),FCE("ѡ", 1, 2, 1),FCE("Ѣ", 0, 2, 1),FCE("ѣ", 1, 2, 1), -+FCE("ᵽ", 0, 2, 1),FCE("Ᵽ", 1, 2, 1),FCE("Ѥ", 0, 2, 1),FCE("ѥ", 1, 2, 1), -+FCE("Ѧ", 0, 2, 1),FCE("ѧ", 1, 2, 1),FCE("Ⱨ", 0, 2, 1),FCE("ⱨ", 1, 2, 1), -+FCE("Ѩ", 0, 2, 1),FCE("ѩ", 1, 2, 1),FCE("Ⓖ", 0, 2, 1),FCE("ⓖ", 1, 2, 1), -+FCE("Ѫ", 0, 2, 1),FCE("ѫ", 1, 2, 1),FCE("Ⱬ", 0, 2, 1),FCE("ⱬ", 1, 2, 1), -+FCE("Ѭ", 0, 2, 1),FCE("ѭ", 1, 2, 1),FCE("ɑ", 0, 2, 1),FCE("Ɑ", 1, 2, 1), -+FCE("Ѯ", 0, 2, 1),FCE("ѯ", 1, 2, 1),FCE("ɐ", 0, 2, 1),FCE("Ɐ", 1, 2, 1), -+FCE("Ѱ", 0, 2, 1),FCE("ѱ", 1, 2, 1),FCE("Ꝩ", 0, 2, 1),FCE("ꝩ", 1, 2, 1), -+FCE("Ѳ", 0, 2, 1),FCE("ѳ", 1, 2, 1),FCE("Ѵ", 0, 2, 1),FCE("ѵ", 1, 2, 1), -+FCE("Ⓘ", 0, 2, 1),FCE("ⓘ", 1, 2, 1),FCE("Ѷ", 0, 2, 1),FCE("ѷ", 1, 2, 1), -+FCE("Ѹ", 0, 2, 1),FCE("ѹ", 1, 2, 1),FCE("Ѻ", 0, 2, 1),FCE("ѻ", 1, 2, 1), -+FCE("Ѽ", 0, 2, 1),FCE("ѽ", 1, 2, 1),FCE("Ꝫ", 0, 2, 1),FCE("ꝫ", 1, 2, 1), -+FCE("Ѿ", 0, 2, 1),FCE("ѿ", 1, 2, 1),FCE("ɀ", 0, 2, 1),FCE("Ɀ", 1, 2, 1), -+FCE("Ҁ", 0, 2, 1),FCE("ҁ", 1, 2, 1),FCE("Ⴠ", 0, 2, 1),FCE("ⴠ", 1, 2, 1), -+FCE("Ⲃ", 0, 2, 1),FCE("ⲃ", 1, 2, 1),FCE("Ⲅ", 0, 2, 1),FCE("ⲅ", 1, 2, 1), -+FCE("Ⲇ", 0, 2, 1),FCE("ⲇ", 1, 2, 1),FCE("Ⴡ", 0, 2, 1),FCE("ⴡ", 1, 2, 1), -+FCE("Ⲉ", 0, 2, 1),FCE("ⲉ", 1, 2, 1),FCE("Ꝭ", 0, 2, 1),FCE("ꝭ", 1, 2, 1), -+FCE("Ҋ", 0, 2, 1),FCE("ҋ", 1, 2, 1),FCE("Ҍ", 0, 2, 1),FCE("ҍ", 1, 2, 1), -+FCE("Â", 0, 2, 1),FCE("â", 1, 2, 1),FCE("Ҏ", 0, 2, 1),FCE("ҏ", 1, 2, 1), -+FCE("Ґ", 0, 2, 1),FCE("ґ", 1, 2, 1),FCE("Ғ", 0, 2, 1),FCE("ғ", 1, 2, 1), -+FCE("Ⴣ", 0, 2, 1),FCE("ⴣ", 1, 2, 1),FCE("Ҕ", 0, 2, 1),FCE("ҕ", 1, 2, 1), -+FCE("Ꝯ", 0, 2, 1),FCE("ꝯ", 1, 2, 1),FCE("Җ", 0, 2, 1),FCE("җ", 1, 2, 1), -+FCE("Ҙ", 0, 2, 1),FCE("ҙ", 1, 2, 1),FCE("Ä", 0, 2, 1),FCE("ä", 1, 2, 1), -+FCE("Қ", 0, 2, 1),FCE("қ", 1, 2, 1),FCE("𐐦", 0, 2, 1),FCE("𐑎", 1, 2, 1), -+FCE("Ҝ", 0, 2, 1),FCE("ҝ", 1, 2, 1),FCE("Ҟ", 0, 2, 1),FCE("ҟ", 1, 2, 1), -+FCE("Ⴥ", 0, 2, 1),FCE("ⴥ", 1, 2, 1),FCE("Ҡ", 0, 2, 1),FCE("ҡ", 1, 2, 1), -+FCE("Ң", 0, 2, 1),FCE("ң", 1, 2, 1),FCE("Ҥ", 0, 2, 1),FCE("ҥ", 1, 2, 1), -+FCE("Ⳇ", 0, 2, 1),FCE("ⳇ", 1, 2, 1),FCE("Ҧ", 0, 2, 1),FCE("ҧ", 1, 2, 1), -+FCE("Ҩ", 0, 2, 1),FCE("ҩ", 1, 2, 1),FCE("Ⱡ", 0, 2, 1),FCE("ⱡ", 1, 2, 1), -+FCE("Ҫ", 0, 2, 1),FCE("ҫ", 1, 2, 1),FCE("Ⴧ", 0, 2, 1),FCE("ⴧ", 1, 2, 1), -+FCE("Ҭ", 0, 2, 1),FCE("ҭ", 1, 2, 1),FCE("𐐓", 0, 2, 1),FCE("𐐻", 1, 2, 1), -+FCE("Ү", 0, 2, 1),FCE("ү", 1, 2, 1),FCE("Ұ", 0, 2, 1),FCE("ұ", 1, 2, 1), -+FCE("Ⳉ", 0, 2, 1),FCE("ⳉ", 1, 2, 1),FCE("Ҳ", 0, 2, 1),FCE("ҳ", 1, 2, 1), -+FCE("Ҵ", 0, 2, 1),FCE("ҵ", 1, 2, 1),FCE("Ҷ", 0, 2, 1),FCE("ҷ", 1, 2, 1), -+FCE("Ⓑ", 0, 2, 1),FCE("ⓑ", 1, 2, 1),FCE("Ҹ", 0, 2, 1),FCE("ҹ", 1, 2, 1), -+FCE("Ⓓ", 0, 2, 1),FCE("ⓓ", 1, 2, 1),FCE("Һ", 0, 2, 1),FCE("һ", 1, 2, 1), -+FCE("Ⓕ", 0, 2, 1),FCE("ⓕ", 1, 2, 1),FCE("Ҽ", 0, 2, 1),FCE("ҽ", 1, 2, 1), -+FCE("Ⓗ", 0, 2, 1),FCE("ⓗ", 1, 2, 1),FCE("Ҿ", 0, 2, 1),FCE("ҿ", 1, 2, 1), -+FCE("Ⓙ", 0, 2, 1),FCE("ⓙ", 1, 2, 1),FCE("Ӏ", 0, 2, 1),FCE("ӏ", 1, 2, 1), -+FCE("Ӂ", 0, 2, 1),FCE("ӂ", 1, 2, 1),FCE("Ⓜ", 0, 2, 1),FCE("ⓜ", 1, 2, 1), -+FCE("Ӄ", 0, 2, 1),FCE("ӄ", 1, 2, 1),FCE("Ⓞ", 0, 2, 1),FCE("ⓞ", 1, 2, 1), -+FCE("Ӆ", 0, 2, 1),FCE("ӆ", 1, 2, 1),FCE("Ⓠ", 0, 2, 1),FCE("ⓠ", 1, 2, 1), -+FCE("Ӈ", 0, 2, 1),FCE("ӈ", 1, 2, 1),FCE("Ⓢ", 0, 2, 1),FCE("ⓢ", 1, 2, 1), -+FCE("Ӊ", 0, 2, 1),FCE("ӊ", 1, 2, 1),FCE("Ⓤ", 0, 2, 1),FCE("ⓤ", 1, 2, 1), -+FCE("Ӌ", 0, 2, 1),FCE("ӌ", 1, 2, 1),FCE("Ⓦ", 0, 2, 1),FCE("ⓦ", 1, 2, 1), -+FCE("Ӎ", 0, 2, 1),FCE("ӎ", 1, 2, 1),FCE("Ⓨ", 0, 2, 1),FCE("ⓨ", 1, 2, 1), -+FCE("Ⴭ", 0, 2, 1),FCE("ⴭ", 1, 2, 1),FCE("Ӑ", 0, 2, 1),FCE("ӑ", 1, 2, 1), -+FCE("Ӓ", 0, 2, 1),FCE("ӓ", 1, 2, 1),FCE("Ӕ", 0, 2, 1),FCE("ӕ", 1, 2, 1), -+FCE("Ⳏ", 0, 2, 1),FCE("ⳏ", 1, 2, 1),FCE("Ӗ", 0, 2, 1),FCE("ӗ", 1, 2, 1), -+FCE("Ꝺ", 0, 2, 1),FCE("ꝺ", 1, 2, 1),FCE("Ә", 0, 2, 1),FCE("ә", 1, 2, 1), -+FCE("Ӛ", 0, 2, 1),FCE("ӛ", 1, 2, 1),FCE("Ⓩ", 0, 2, 1),FCE("ⓩ", 1, 2, 1), -+FCE("Ӝ", 0, 2, 1),FCE("ӝ", 1, 2, 1),FCE("Ӟ", 0, 2, 1),FCE("ӟ", 1, 2, 1), -+FCE("Ӡ", 0, 2, 1),FCE("ӡ", 1, 2, 1),FCE("Ⳑ", 0, 2, 1),FCE("ⳑ", 1, 2, 1), -+FCE("Ӣ", 0, 2, 1),FCE("ӣ", 1, 2, 1),FCE("Ӥ", 0, 2, 1),FCE("ӥ", 1, 2, 1), -+FCE("ɫ", 0, 2, 1),FCE("Ɫ", 1, 2, 1),FCE("Ӧ", 0, 2, 1),FCE("ӧ", 1, 2, 1), -+FCE("Ө", 0, 2, 1),FCE("ө", 1, 2, 1),FCE("Ӫ", 0, 2, 1),FCE("ӫ", 1, 2, 1), -+FCE("Ⅎ", 0, 2, 1),FCE("ⅎ", 1, 2, 1),FCE("Ӭ", 0, 2, 1),FCE("ӭ", 1, 2, 1), -+FCE("Ⳓ", 0, 2, 1),FCE("ⳓ", 1, 2, 1),FCE("Ӯ", 0, 2, 1),FCE("ӯ", 1, 2, 1), -+FCE("Ӱ", 0, 2, 1),FCE("ӱ", 1, 2, 1),FCE("𐐢", 0, 2, 1),FCE("𐑊", 1, 2, 1), -+FCE("Ӳ", 0, 2, 1),FCE("ӳ", 1, 2, 1),FCE("Ӵ", 0, 2, 1),FCE("ӵ", 1, 2, 1), -+FCE("Ӷ", 0, 2, 1),FCE("ӷ", 1, 2, 1),FCE("Ӹ", 0, 2, 1),FCE("ӹ", 1, 2, 1), -+FCE("Ⳕ", 0, 2, 1),FCE("ⳕ", 1, 2, 1),FCE("Ӻ", 0, 2, 1),FCE("ӻ", 1, 2, 1), -+FCE("Ӽ", 0, 2, 1),FCE("ӽ", 1, 2, 1),FCE("Ӿ", 0, 2, 1),FCE("ӿ", 1, 2, 1), -+FCE("Ԁ", 0, 2, 1),FCE("ԁ", 1, 2, 1),FCE("Ꞁ", 0, 2, 1),FCE("ꞁ", 1, 2, 1), -+FCE("Ԃ", 0, 2, 1),FCE("ԃ", 1, 2, 1),FCE("Ԅ", 0, 2, 1),FCE("ԅ", 1, 2, 1), -+FCE("Ⳗ", 0, 2, 1),FCE("ⳗ", 1, 2, 1),FCE("Ԇ", 0, 2, 1),FCE("ԇ", 1, 2, 1), -+FCE("Ԉ", 0, 2, 1),FCE("ԉ", 1, 2, 1),FCE("Ԋ", 0, 2, 1),FCE("ԋ", 1, 2, 1), -+FCE("Ԍ", 0, 2, 1),FCE("ԍ", 1, 2, 1),FCE("Ꞃ", 0, 2, 1),FCE("ꞃ", 1, 2, 1), -+FCE("Ԏ", 0, 2, 1),FCE("ԏ", 1, 2, 1),FCE("Ԑ", 0, 2, 1),FCE("ԑ", 1, 2, 1), -+FCE("Ⳙ", 0, 2, 1),FCE("ⳙ", 1, 2, 1),FCE("Ԓ", 0, 2, 1),FCE("ԓ", 1, 2, 1), -+FCE("Ԕ", 0, 2, 1),FCE("ԕ", 1, 2, 1),FCE("Ԗ", 0, 2, 1),FCE("ԗ", 1, 2, 1), -+FCE("Ԙ", 0, 2, 1),FCE("ԙ", 1, 2, 1),FCE("Ꞅ", 0, 2, 1),FCE("ꞅ", 1, 2, 1), -+FCE("Ԛ", 0, 2, 1),FCE("ԛ", 1, 2, 1),FCE("Ⲩ", 0, 2, 1),FCE("ⲩ", 1, 2, 1), -+FCE("Ԝ", 0, 2, 1),FCE("ԝ", 1, 2, 1),FCE("Ⳛ", 0, 2, 1),FCE("ⳛ", 1, 2, 1), -+FCE("Ԟ", 0, 2, 1),FCE("ԟ", 1, 2, 1),FCE("Ԡ", 0, 2, 1),FCE("ԡ", 1, 2, 1), -+FCE("Ԣ", 0, 2, 1),FCE("ԣ", 1, 2, 1),FCE("Ԥ", 0, 2, 1),FCE("ԥ", 1, 2, 1), -+FCE("Ꞇ", 0, 2, 1),FCE("ꞇ", 1, 2, 1),FCE("Ԧ", 0, 2, 1),FCE("ԧ", 1, 2, 1), -+FCE("Ⱐ", 0, 2, 1),FCE("ⱐ", 1, 2, 1),FCE("Ⳝ", 0, 2, 1),FCE("ⳝ", 1, 2, 1), -+FCE("Ա", 0, 2, 1),FCE("ա", 1, 2, 1),FCE("Բ", 0, 2, 1),FCE("բ", 1, 2, 1), -+FCE("Գ", 0, 2, 1),FCE("գ", 1, 2, 1),FCE("Դ", 0, 2, 1),FCE("դ", 1, 2, 1), -+FCE("Ե", 0, 2, 1),FCE("ե", 1, 2, 1),FCE("Զ", 0, 2, 1),FCE("զ", 1, 2, 1), -+FCE("Է", 0, 2, 1),FCE("է", 1, 2, 1),FCE("Ը", 0, 2, 1),FCE("ը", 1, 2, 1), -+FCE("Թ", 0, 2, 1),FCE("թ", 1, 2, 1),FCE("Ժ", 0, 2, 1),FCE("ժ", 1, 2, 1), -+FCE("Ի", 0, 2, 1),FCE("ի", 1, 2, 1),FCE("Լ", 0, 2, 1),FCE("լ", 1, 2, 1), -+FCE("Խ", 0, 2, 1),FCE("խ", 1, 2, 1),FCE("Ծ", 0, 2, 1),FCE("ծ", 1, 2, 1), -+FCE("Կ", 0, 2, 1),FCE("կ", 1, 2, 1),FCE("Հ", 0, 2, 1),FCE("հ", 1, 2, 1), -+FCE("Ձ", 0, 2, 1),FCE("ձ", 1, 2, 1),FCE("Ղ", 0, 2, 1),FCE("ղ", 1, 2, 1), -+FCE("Ճ", 0, 2, 1),FCE("ճ", 1, 2, 1),FCE("Մ", 0, 2, 1),FCE("մ", 1, 2, 1), -+FCE("Յ", 0, 2, 1),FCE("յ", 1, 2, 1),FCE("Ն", 0, 2, 1),FCE("ն", 1, 2, 1), -+FCE("Շ", 0, 2, 1),FCE("շ", 1, 2, 1),FCE("Ո", 0, 2, 1),FCE("ո", 1, 2, 1), -+FCE("Չ", 0, 2, 1),FCE("չ", 1, 2, 1),FCE("Պ", 0, 2, 1),FCE("պ", 1, 2, 1), -+FCE("Ջ", 0, 2, 1),FCE("ջ", 1, 2, 1),FCE("Ռ", 0, 2, 1),FCE("ռ", 1, 2, 1), -+FCE("Ս", 0, 2, 1),FCE("ս", 1, 2, 1),FCE("Վ", 0, 2, 1),FCE("վ", 1, 2, 1), -+FCE("Տ", 0, 2, 1),FCE("տ", 1, 2, 1),FCE("Ր", 0, 2, 1),FCE("ր", 1, 2, 1), -+FCE("Ց", 0, 2, 1),FCE("ց", 1, 2, 1),FCE("Ւ", 0, 2, 1),FCE("ւ", 1, 2, 1), -+FCE("Փ", 0, 2, 1),FCE("փ", 1, 2, 1),FCE("Ք", 0, 2, 1),FCE("ք", 1, 2, 1), -+FCE("Օ", 0, 2, 1),FCE("օ", 1, 2, 1),FCE("Ֆ", 0, 2, 1),FCE("ֆ", 1, 2, 1), -+FCE("Ⲫ", 0, 2, 1),FCE("ⲫ", 1, 2, 1),FCE("Ꞑ", 0, 2, 1),FCE("ꞑ", 1, 2, 1), -+FCE("Ⱒ", 0, 2, 1),FCE("ⱒ", 1, 2, 1),FCE("Ꞓ", 0, 2, 1),FCE("ꞓ", 1, 2, 1), -+FCE("Ⱓ", 0, 2, 1),FCE("ⱓ", 1, 2, 1),FCE("Ⳬ", 0, 2, 1),FCE("ⳬ", 1, 2, 1), -+FCE("Ⳋ", 0, 2, 1),FCE("ⳋ", 1, 2, 1),FCE("և", 0, 2, 1),FCE("եւ", 1, 2, 2), -+FCE("Ꙃ", 0, 2, 1),FCE("ꙃ", 1, 2, 1),FCE("Ⳮ", 0, 2, 1),FCE("ⳮ", 1, 2, 1), -+FCE("Ⲭ", 0, 2, 1),FCE("ⲭ", 1, 2, 1),FCE("Ꙅ", 0, 2, 1),FCE("ꙅ", 1, 2, 1), -+FCE("Ⱔ", 0, 2, 1),FCE("ⱔ", 1, 2, 1),FCE("Ꝕ", 0, 2, 1),FCE("ꝕ", 1, 2, 1), -+FCE("Ꙇ", 0, 2, 1),FCE("ꙇ", 1, 2, 1),FCE("Ⳳ", 0, 2, 1),FCE("ⳳ", 1, 2, 1), -+FCE("𐐈", 0, 2, 1),FCE("𐐰", 1, 2, 1),FCE("Ꙉ", 0, 2, 1),FCE("ꙉ", 1, 2, 1), -+FCE("Ⱕ", 0, 2, 1),FCE("ⱕ", 1, 2, 1),FCE("Ꞡ", 0, 2, 1),FCE("ꞡ", 1, 2, 1), -+FCE("Ꙍ", 0, 2, 1),FCE("ꙍ", 1, 2, 1),FCE("Ꞣ", 0, 2, 1),FCE("ꞣ", 1, 2, 1), -+FCE("Ⲯ", 0, 2, 1),FCE("ⲯ", 1, 2, 1),FCE("Ꙏ", 0, 2, 1),FCE("ꙏ", 1, 2, 1), -+FCE("Ꞥ", 0, 2, 1),FCE("ꞥ", 1, 2, 1),FCE("Ꙑ", 0, 2, 1),FCE("ꙑ", 1, 2, 1), -+FCE("Ꞧ", 0, 2, 1),FCE("ꞧ", 1, 2, 1),FCE("Ꞌ", 0, 2, 1),FCE("ꞌ", 1, 2, 1), -+FCE("Ꙓ", 0, 2, 1),FCE("ꙓ", 1, 2, 1),FCE("Ꞩ", 0, 2, 1),FCE("ꞩ", 1, 2, 1), -+FCE("Ꙕ", 0, 2, 1),FCE("ꙕ", 1, 2, 1),FCE("ɦ", 0, 2, 1),FCE("Ɦ", 1, 2, 1), -+FCE("Ḁ", 0, 2, 1),FCE("ḁ", 1, 2, 1),FCE("Ḃ", 0, 2, 1),FCE("ḃ", 1, 2, 1), -+FCE("Ḅ", 0, 2, 1),FCE("ḅ", 1, 2, 1),FCE("Ⱏ", 0, 2, 1),FCE("ⱏ", 1, 2, 1), -+FCE("Ḇ", 0, 2, 1),FCE("ḇ", 1, 2, 1),FCE("𐐎", 0, 2, 1),FCE("𐐶", 1, 2, 1), -+FCE("Ḉ", 0, 2, 1),FCE("ḉ", 1, 2, 1),FCE("Ḋ", 0, 2, 1),FCE("ḋ", 1, 2, 1), -+FCE("Ⲱ", 0, 2, 1),FCE("ⲱ", 1, 2, 1),FCE("Ḍ", 0, 2, 1),FCE("ḍ", 1, 2, 1), -+FCE("Ḏ", 0, 2, 1),FCE("ḏ", 1, 2, 1),FCE("Ḑ", 0, 2, 1),FCE("ḑ", 1, 2, 1), -+FCE("Ꙙ", 0, 2, 1),FCE("ꙙ", 1, 2, 1),FCE("Ḓ", 0, 2, 1),FCE("ḓ", 1, 2, 1), -+FCE("Ḕ", 0, 2, 1),FCE("ḕ", 1, 2, 1),FCE("Ⓧ", 0, 2, 1),FCE("ⓧ", 1, 2, 1), -+FCE("Ḗ", 0, 2, 1),FCE("ḗ", 1, 2, 1),FCE("Ḙ", 0, 2, 1),FCE("ḙ", 1, 2, 1), -+FCE("Ḛ", 0, 2, 1),FCE("ḛ", 1, 2, 1),FCE("Ḝ", 0, 2, 1),FCE("ḝ", 1, 2, 1), -+FCE("Ꙛ", 0, 2, 1),FCE("ꙛ", 1, 2, 1),FCE("Ḟ", 0, 2, 1),FCE("ḟ", 1, 2, 1), -+FCE("Ḡ", 0, 2, 1),FCE("ḡ", 1, 2, 1),FCE("Ḣ", 0, 2, 1),FCE("ḣ", 1, 2, 1), -+FCE("Ḥ", 0, 2, 1),FCE("ḥ", 1, 2, 1),FCE("Ḧ", 0, 2, 1),FCE("ḧ", 1, 2, 1), -+FCE("Ḩ", 0, 2, 1),FCE("ḩ", 1, 2, 1),FCE("Ꙝ", 0, 2, 1),FCE("ꙝ", 1, 2, 1), -+FCE("Ḫ", 0, 2, 1),FCE("ḫ", 1, 2, 1),FCE("Ḭ", 0, 2, 1),FCE("ḭ", 1, 2, 1), -+FCE("Ḯ", 0, 2, 1),FCE("ḯ", 1, 2, 1),FCE("Ḱ", 0, 2, 1),FCE("ḱ", 1, 2, 1), -+FCE("Ḳ", 0, 2, 1),FCE("ḳ", 1, 2, 1),FCE("Ḵ", 0, 2, 1),FCE("ḵ", 1, 2, 1), -+FCE("Ꙟ", 0, 2, 1),FCE("ꙟ", 1, 2, 1),FCE("Ḷ", 0, 2, 1),FCE("ḷ", 1, 2, 1), -+FCE("Ḹ", 0, 2, 1),FCE("ḹ", 1, 2, 1),FCE("Ḻ", 0, 2, 1),FCE("ḻ", 1, 2, 1), -+FCE("Ḽ", 0, 2, 1),FCE("ḽ", 1, 2, 1),FCE("Ḿ", 0, 2, 1),FCE("ḿ", 1, 2, 1), -+FCE("Ṁ", 0, 2, 1),FCE("ṁ", 1, 2, 1),FCE("Ꙡ", 0, 2, 1),FCE("ꙡ", 1, 2, 1), -+FCE("Ṃ", 0, 2, 1),FCE("ṃ", 1, 2, 1),FCE("Ṅ", 0, 2, 1),FCE("ṅ", 1, 2, 1), -+FCE("Ṇ", 0, 2, 1),FCE("ṇ", 1, 2, 1),FCE("Ⲳ", 0, 2, 1),FCE("ⲳ", 1, 2, 1), -+FCE("Ṉ", 0, 2, 1),FCE("ṉ", 1, 2, 1),FCE("Ⳁ", 0, 2, 1),FCE("ⳁ", 1, 2, 1), -+FCE("Ṋ", 0, 2, 1),FCE("ṋ", 1, 2, 1),FCE("Ṍ", 0, 2, 1),FCE("ṍ", 1, 2, 1), -+FCE("Ꙣ", 0, 2, 1),FCE("ꙣ", 1, 2, 1),FCE("Ṏ", 0, 2, 1),FCE("ṏ", 1, 2, 1), -+FCE("Ṑ", 0, 2, 1),FCE("ṑ", 1, 2, 1),FCE("Ṓ", 0, 2, 1),FCE("ṓ", 1, 2, 1), -+FCE("Ṕ", 0, 2, 1),FCE("ṕ", 1, 2, 1),FCE("Ṗ", 0, 2, 1),FCE("ṗ", 1, 2, 1), -+FCE("Ṙ", 0, 2, 1),FCE("ṙ", 1, 2, 1),FCE("Ꙥ", 0, 2, 1),FCE("ꙥ", 1, 2, 1), -+FCE("Ṛ", 0, 2, 1),FCE("ṛ", 1, 2, 1),FCE("Ṝ", 0, 2, 1),FCE("ṝ", 1, 2, 1), -+FCE("Ṟ", 0, 2, 1),FCE("ṟ", 1, 2, 1),FCE("Ṡ", 0, 3, 1),FCE("ṡ", 1, 3, 1), -+FCE("ẛ", 2, 3, 1),FCE("Ṣ", 0, 2, 1),FCE("ṣ", 1, 2, 1),FCE("𐐤", 0, 2, 1), -+FCE("𐑌", 1, 2, 1),FCE("Ṥ", 0, 2, 1),FCE("ṥ", 1, 2, 1),FCE("Ꙧ", 0, 2, 1), -+FCE("ꙧ", 1, 2, 1),FCE("Ṧ", 0, 2, 1),FCE("ṧ", 1, 2, 1),FCE("Ṩ", 0, 2, 1), -+FCE("ṩ", 1, 2, 1),FCE("Ṫ", 0, 2, 1),FCE("ṫ", 1, 2, 1),FCE("Ṭ", 0, 2, 1), -+FCE("ṭ", 1, 2, 1),FCE("Ṯ", 0, 2, 1),FCE("ṯ", 1, 2, 1),FCE("Ṱ", 0, 2, 1), -+FCE("ṱ", 1, 2, 1),FCE("Ꙩ", 0, 2, 1),FCE("ꙩ", 1, 2, 1),FCE("Ṳ", 0, 2, 1), -+FCE("ṳ", 1, 2, 1),FCE("Ṵ", 0, 2, 1),FCE("ṵ", 1, 2, 1),FCE("Ṷ", 0, 2, 1), -+FCE("ṷ", 1, 2, 1),FCE("Ⲿ", 0, 2, 1),FCE("ⲿ", 1, 2, 1),FCE("Ṹ", 0, 2, 1), -+FCE("ṹ", 1, 2, 1),FCE("Ṻ", 0, 2, 1),FCE("ṻ", 1, 2, 1),FCE("Ṽ", 0, 2, 1), -+FCE("ṽ", 1, 2, 1),FCE("Ꙫ", 0, 2, 1),FCE("ꙫ", 1, 2, 1),FCE("Ṿ", 0, 2, 1), -+FCE("ṿ", 1, 2, 1),FCE("Ẁ", 0, 2, 1),FCE("ẁ", 1, 2, 1),FCE("Ẃ", 0, 2, 1), -+FCE("ẃ", 1, 2, 1),FCE("Ẅ", 0, 2, 1),FCE("ẅ", 1, 2, 1),FCE("Ẇ", 0, 2, 1), -+FCE("ẇ", 1, 2, 1),FCE("Ẉ", 0, 2, 1),FCE("ẉ", 1, 2, 1),FCE("Ꙭ", 0, 2, 1), -+FCE("ꙭ", 1, 2, 1),FCE("Ẋ", 0, 2, 1),FCE("ẋ", 1, 2, 1),FCE("Ẍ", 0, 2, 1), -+FCE("ẍ", 1, 2, 1),FCE("Ẏ", 0, 2, 1),FCE("ẏ", 1, 2, 1),FCE("Ẑ", 0, 2, 1), -+FCE("ẑ", 1, 2, 1),FCE("Ẓ", 0, 2, 1),FCE("ẓ", 1, 2, 1),FCE("Ẕ", 0, 2, 1), -+FCE("ẕ", 1, 2, 1),FCE("ẖ", 0, 2, 1),FCE("ẖ", 1, 2, 2),FCE("ẗ", 0, 2, 1), -+FCE("ẗ", 1, 2, 2),FCE("ẘ", 0, 2, 1),FCE("ẘ", 1, 2, 2),FCE("ẙ", 0, 2, 1), -+FCE("ẙ", 1, 2, 2),FCE("ẚ", 0, 2, 1),FCE("aʾ", 1, 2, 2),FCE("Ṡ", 0, 3, 1), -+FCE("ṡ", 1, 3, 1),FCE("ẛ", 2, 3, 1),FCE("ß", 0, 3, 1),FCE("ẞ", 1, 3, 1), -+FCE("ss", 2, 3, 2),FCE("Ạ", 0, 2, 1),FCE("ạ", 1, 2, 1),FCE("Ả", 0, 2, 1), -+FCE("ả", 1, 2, 1),FCE("Ấ", 0, 2, 1),FCE("ấ", 1, 2, 1),FCE("Ⓟ", 0, 2, 1), -+FCE("ⓟ", 1, 2, 1),FCE("Ầ", 0, 2, 1),FCE("ầ", 1, 2, 1),FCE("Ẩ", 0, 2, 1), -+FCE("ẩ", 1, 2, 1),FCE("Ẫ", 0, 2, 1),FCE("ẫ", 1, 2, 1),FCE("Ậ", 0, 2, 1), -+FCE("ậ", 1, 2, 1),FCE("Ắ", 0, 2, 1),FCE("ắ", 1, 2, 1),FCE("H", 0, 2, 1), -+FCE("h", 1, 2, 1),FCE("Ằ", 0, 2, 1),FCE("ằ", 1, 2, 1),FCE("Ẳ", 0, 2, 1), -+FCE("ẳ", 1, 2, 1),FCE("𐐥", 0, 2, 1),FCE("𐑍", 1, 2, 1),FCE("Ẵ", 0, 2, 1), -+FCE("ẵ", 1, 2, 1),FCE("Ặ", 0, 2, 1),FCE("ặ", 1, 2, 1),FCE("Ẹ", 0, 2, 1), -+FCE("ẹ", 1, 2, 1),FCE("Ẻ", 0, 2, 1),FCE("ẻ", 1, 2, 1),FCE("Ẽ", 0, 2, 1), -+FCE("ẽ", 1, 2, 1),FCE("Ế", 0, 2, 1),FCE("ế", 1, 2, 1),FCE("Ⲷ", 0, 2, 1), -+FCE("ⲷ", 1, 2, 1),FCE("Ề", 0, 2, 1),FCE("ề", 1, 2, 1),FCE("Ể", 0, 2, 1), -+FCE("ể", 1, 2, 1),FCE("Ⲛ", 0, 2, 1),FCE("ⲛ", 1, 2, 1),FCE("Ễ", 0, 2, 1), -+FCE("ễ", 1, 2, 1),FCE("Ệ", 0, 2, 1),FCE("ệ", 1, 2, 1),FCE("Ỉ", 0, 2, 1), -+FCE("ỉ", 1, 2, 1),FCE("Ị", 0, 2, 1),FCE("ị", 1, 2, 1),FCE("Ọ", 0, 2, 1), -+FCE("ọ", 1, 2, 1),FCE("Ỏ", 0, 2, 1),FCE("ỏ", 1, 2, 1),FCE("Ố", 0, 2, 1), -+FCE("ố", 1, 2, 1),FCE("Ồ", 0, 2, 1),FCE("ồ", 1, 2, 1),FCE("Ổ", 0, 2, 1), -+FCE("ổ", 1, 2, 1),FCE("Ỗ", 0, 2, 1),FCE("ỗ", 1, 2, 1),FCE("Ộ", 0, 2, 1), -+FCE("ộ", 1, 2, 1),FCE("Ớ", 0, 2, 1),FCE("ớ", 1, 2, 1),FCE("Ờ", 0, 2, 1), -+FCE("ờ", 1, 2, 1),FCE("Ở", 0, 2, 1),FCE("ở", 1, 2, 1),FCE("Ỡ", 0, 2, 1), -+FCE("ỡ", 1, 2, 1),FCE("Ợ", 0, 2, 1),FCE("ợ", 1, 2, 1),FCE("Ụ", 0, 2, 1), -+FCE("ụ", 1, 2, 1),FCE("Ω", 0, 3, 1),FCE("ω", 1, 3, 1),FCE("Ω", 2, 3, 1), -+FCE("Ủ", 0, 2, 1),FCE("ủ", 1, 2, 1),FCE("Ứ", 0, 2, 1),FCE("ứ", 1, 2, 1), -+FCE("Ừ", 0, 2, 1),FCE("ừ", 1, 2, 1),FCE("J", 0, 2, 1),FCE("j", 1, 2, 1), -+FCE("Ử", 0, 2, 1),FCE("ử", 1, 2, 1),FCE("Ữ", 0, 2, 1),FCE("ữ", 1, 2, 1), -+FCE("Ự", 0, 2, 1),FCE("ự", 1, 2, 1),FCE("Ỳ", 0, 2, 1),FCE("ỳ", 1, 2, 1), -+FCE("Ỵ", 0, 2, 1),FCE("ỵ", 1, 2, 1),FCE("Ỷ", 0, 2, 1),FCE("ỷ", 1, 2, 1), -+FCE("Ỹ", 0, 2, 1),FCE("ỹ", 1, 2, 1),FCE("Ỻ", 0, 2, 1),FCE("ỻ", 1, 2, 1), -+FCE("Ⲹ", 0, 2, 1),FCE("ⲹ", 1, 2, 1),FCE("Ỽ", 0, 2, 1),FCE("ỽ", 1, 2, 1), -+FCE("K", 0, 3, 1),FCE("k", 1, 3, 1),FCE("K", 2, 3, 1),FCE("Ỿ", 0, 2, 1), -+FCE("ỿ", 1, 2, 1),FCE("Ꚁ", 0, 2, 1),FCE("ꚁ", 1, 2, 1),FCE("ἀ", 0, 2, 1), -+FCE("Ἀ", 1, 2, 1),FCE("ἁ", 0, 2, 1),FCE("Ἁ", 1, 2, 1),FCE("ἂ", 0, 2, 1), -+FCE("Ἂ", 1, 2, 1),FCE("ἃ", 0, 2, 1),FCE("Ἃ", 1, 2, 1),FCE("ἄ", 0, 2, 1), -+FCE("Ἄ", 1, 2, 1),FCE("ἅ", 0, 2, 1),FCE("Ἅ", 1, 2, 1),FCE("ἆ", 0, 2, 1), -+FCE("Ἆ", 1, 2, 1),FCE("ἇ", 0, 2, 1),FCE("Ἇ", 1, 2, 1),FCE("𐐘", 0, 2, 1), -+FCE("𐑀", 1, 2, 1),FCE("ɥ", 0, 2, 1),FCE("Ɥ", 1, 2, 1),FCE("ἐ", 0, 2, 1), -+FCE("Ἐ", 1, 2, 1),FCE("ἑ", 0, 2, 1),FCE("Ἑ", 1, 2, 1),FCE("ἒ", 0, 2, 1), -+FCE("Ἒ", 1, 2, 1),FCE("ἓ", 0, 2, 1),FCE("Ἓ", 1, 2, 1),FCE("ἔ", 0, 2, 1), -+FCE("Ἔ", 1, 2, 1),FCE("ἕ", 0, 2, 1),FCE("Ἕ", 1, 2, 1),FCE("A", 0, 2, 1), -+FCE("a", 1, 2, 1),FCE("Ꜣ", 0, 2, 1),FCE("ꜣ", 1, 2, 1),FCE("C", 0, 2, 1), -+FCE("c", 1, 2, 1),FCE("Ꜥ", 0, 2, 1),FCE("ꜥ", 1, 2, 1),FCE("Ꚇ", 0, 2, 1), -+FCE("ꚇ", 1, 2, 1),FCE("Ꜧ", 0, 2, 1),FCE("ꜧ", 1, 2, 1),FCE("G", 0, 2, 1), -+FCE("g", 1, 2, 1),FCE("ἠ", 0, 2, 1),FCE("Ἠ", 1, 2, 1),FCE("ἡ", 0, 2, 1), -+FCE("Ἡ", 1, 2, 1),FCE("ἢ", 0, 2, 1),FCE("Ἢ", 1, 2, 1),FCE("ἣ", 0, 2, 1), -+FCE("Ἣ", 1, 2, 1),FCE("ἤ", 0, 2, 1),FCE("Ἤ", 1, 2, 1),FCE("ἥ", 0, 2, 1), -+FCE("Ἥ", 1, 2, 1),FCE("ἦ", 0, 2, 1),FCE("Ἦ", 1, 2, 1),FCE("ἧ", 0, 2, 1), -+FCE("Ἧ", 1, 2, 1),FCE("P", 0, 2, 1),FCE("p", 1, 2, 1),FCE("Ꚉ", 0, 2, 1), -+FCE("ꚉ", 1, 2, 1),FCE("Ꜳ", 0, 2, 1),FCE("ꜳ", 1, 2, 1),FCE("S", 0, 2, 1), -+FCE("s", 1, 2, 1),FCE("Ꜵ", 0, 2, 1),FCE("ꜵ", 1, 2, 1),FCE("U", 0, 2, 1), -+FCE("u", 1, 2, 1),FCE("Ꜷ", 0, 2, 1),FCE("ꜷ", 1, 2, 1),FCE("Ⲻ", 0, 2, 1), -+FCE("ⲻ", 1, 2, 1),FCE("ἰ", 0, 2, 1),FCE("Ἰ", 1, 2, 1),FCE("ἱ", 0, 2, 1), -+FCE("Ἱ", 1, 2, 1),FCE("ἲ", 0, 2, 1),FCE("Ἲ", 1, 2, 1),FCE("ἳ", 0, 2, 1), -+FCE("Ἳ", 1, 2, 1),FCE("ἴ", 0, 2, 1),FCE("Ἴ", 1, 2, 1),FCE("ἵ", 0, 2, 1), -+FCE("Ἵ", 1, 2, 1),FCE("ἶ", 0, 2, 1),FCE("Ἶ", 1, 2, 1),FCE("ἷ", 0, 2, 1), -+FCE("Ἷ", 1, 2, 1),FCE("Ꝁ", 0, 2, 1),FCE("ꝁ", 1, 2, 1),FCE("Ꝃ", 0, 2, 1), -+FCE("ꝃ", 1, 2, 1),FCE("Ꝅ", 0, 2, 1),FCE("ꝅ", 1, 2, 1),FCE("Ꝇ", 0, 2, 1), -+FCE("ꝇ", 1, 2, 1),FCE("ὀ", 0, 2, 1),FCE("Ὀ", 1, 2, 1),FCE("ὁ", 0, 2, 1), -+FCE("Ὁ", 1, 2, 1),FCE("ὂ", 0, 2, 1),FCE("Ὂ", 1, 2, 1),FCE("ὃ", 0, 2, 1), -+FCE("Ὃ", 1, 2, 1),FCE("ὄ", 0, 2, 1),FCE("Ὄ", 1, 2, 1),FCE("ὅ", 0, 2, 1), -+FCE("Ὅ", 1, 2, 1),FCE("Ꝏ", 0, 2, 1),FCE("ꝏ", 1, 2, 1),FCE("ὐ", 0, 2, 1), -+FCE("ὐ", 1, 2, 2),FCE("ὒ", 0, 2, 1),FCE("ὒ", 1, 2, 3),FCE("ὔ", 0, 2, 1), -+FCE("ὔ", 1, 2, 3),FCE("Ꚏ", 0, 2, 1),FCE("ꚏ", 1, 2, 1),FCE("ὖ", 0, 2, 1), -+FCE("ὖ", 1, 2, 3),FCE("Ꝙ", 0, 2, 1),FCE("ꝙ", 1, 2, 1),FCE("ὑ", 0, 2, 1), -+FCE("Ὑ", 1, 2, 1),FCE("Ꝛ", 0, 2, 1),FCE("ꝛ", 1, 2, 1),FCE("ὓ", 0, 2, 1), -+FCE("Ὓ", 1, 2, 1),FCE("Ꝝ", 0, 2, 1),FCE("ꝝ", 1, 2, 1),FCE("ὕ", 0, 2, 1), -+FCE("Ὕ", 1, 2, 1),FCE("Ꝟ", 0, 2, 1),FCE("ꝟ", 1, 2, 1),FCE("ὗ", 0, 2, 1), -+FCE("Ὗ", 1, 2, 1),FCE("Ꝡ", 0, 2, 1),FCE("ꝡ", 1, 2, 1),FCE("Ꚑ", 0, 2, 1), -+FCE("ꚑ", 1, 2, 1),FCE("Ꝣ", 0, 2, 1),FCE("ꝣ", 1, 2, 1),FCE("N", 0, 2, 1), -+FCE("n", 1, 2, 1),FCE("Ꝥ", 0, 2, 1),FCE("ꝥ", 1, 2, 1),FCE("Ꝧ", 0, 2, 1), -+FCE("ꝧ", 1, 2, 1),FCE("ὠ", 0, 2, 1),FCE("Ὠ", 1, 2, 1),FCE("ὡ", 0, 2, 1), -+FCE("Ὡ", 1, 2, 1),FCE("ὢ", 0, 2, 1),FCE("Ὢ", 1, 2, 1),FCE("ὣ", 0, 2, 1), -+FCE("Ὣ", 1, 2, 1),FCE("ὤ", 0, 2, 1),FCE("Ὤ", 1, 2, 1),FCE("ὥ", 0, 2, 1), -+FCE("Ὥ", 1, 2, 1),FCE("ὦ", 0, 2, 1),FCE("Ὦ", 1, 2, 1),FCE("ὧ", 0, 2, 1), -+FCE("Ὧ", 1, 2, 1),FCE("Ⱌ", 0, 2, 1),FCE("ⱌ", 1, 2, 1),FCE("Ⲽ", 0, 2, 1), -+FCE("ⲽ", 1, 2, 1),FCE("Ꚕ", 0, 2, 1),FCE("ꚕ", 1, 2, 1),FCE("Ꝼ", 0, 2, 1), -+FCE("ꝼ", 1, 2, 1),FCE("ᵹ", 0, 2, 1),FCE("Ᵹ", 1, 2, 1),FCE("Ꝿ", 0, 2, 1), -+FCE("ꝿ", 1, 2, 1),FCE("ᾀ", 0, 3, 1),FCE("ᾈ", 1, 3, 1),FCE("ἀι", 2, 3, 2), -+FCE("ᾁ", 0, 3, 1),FCE("ᾉ", 1, 3, 1),FCE("ἁι", 2, 3, 2),FCE("ᾂ", 0, 3, 1), -+FCE("ᾊ", 1, 3, 1),FCE("ἂι", 2, 3, 2),FCE("ᾃ", 0, 3, 1),FCE("ᾋ", 1, 3, 1), -+FCE("ἃι", 2, 3, 2),FCE("ᾄ", 0, 3, 1),FCE("ᾌ", 1, 3, 1),FCE("ἄι", 2, 3, 2), -+FCE("ᾅ", 0, 3, 1),FCE("ᾍ", 1, 3, 1),FCE("ἅι", 2, 3, 2),FCE("ᾆ", 0, 3, 1), -+FCE("ᾎ", 1, 3, 1),FCE("ἆι", 2, 3, 2),FCE("ᾇ", 0, 3, 1),FCE("ᾏ", 1, 3, 1), -+FCE("ἇι", 2, 3, 2),FCE("ᾀ", 0, 3, 1),FCE("ᾈ", 1, 3, 1),FCE("ἀι", 2, 3, 2), -+FCE("ᾁ", 0, 3, 1),FCE("ᾉ", 1, 3, 1),FCE("ἁι", 2, 3, 2),FCE("ᾂ", 0, 3, 1), -+FCE("ᾊ", 1, 3, 1),FCE("ἂι", 2, 3, 2),FCE("ᾃ", 0, 3, 1),FCE("ᾋ", 1, 3, 1), -+FCE("ἃι", 2, 3, 2),FCE("ᾄ", 0, 3, 1),FCE("ᾌ", 1, 3, 1),FCE("ἄι", 2, 3, 2), -+FCE("ᾅ", 0, 3, 1),FCE("ᾍ", 1, 3, 1),FCE("ἅι", 2, 3, 2),FCE("ᾆ", 0, 3, 1), -+FCE("ᾎ", 1, 3, 1),FCE("ἆι", 2, 3, 2),FCE("ᾇ", 0, 3, 1),FCE("ᾏ", 1, 3, 1), -+FCE("ἇι", 2, 3, 2),FCE("ᾐ", 0, 3, 1),FCE("ᾘ", 1, 3, 1),FCE("ἠι", 2, 3, 2), -+FCE("ᾑ", 0, 3, 1),FCE("ᾙ", 1, 3, 1),FCE("ἡι", 2, 3, 2),FCE("ᾒ", 0, 3, 1), -+FCE("ᾚ", 1, 3, 1),FCE("ἢι", 2, 3, 2),FCE("ᾓ", 0, 3, 1),FCE("ᾛ", 1, 3, 1), -+FCE("ἣι", 2, 3, 2),FCE("ᾔ", 0, 3, 1),FCE("ᾜ", 1, 3, 1),FCE("ἤι", 2, 3, 2), -+FCE("ᾕ", 0, 3, 1),FCE("ᾝ", 1, 3, 1),FCE("ἥι", 2, 3, 2),FCE("ᾖ", 0, 3, 1), -+FCE("ᾞ", 1, 3, 1),FCE("ἦι", 2, 3, 2),FCE("ᾗ", 0, 3, 1),FCE("ᾟ", 1, 3, 1), -+FCE("ἧι", 2, 3, 2),FCE("ᾐ", 0, 3, 1),FCE("ᾘ", 1, 3, 1),FCE("ἠι", 2, 3, 2), -+FCE("ᾑ", 0, 3, 1),FCE("ᾙ", 1, 3, 1),FCE("ἡι", 2, 3, 2),FCE("ᾒ", 0, 3, 1), -+FCE("ᾚ", 1, 3, 1),FCE("ἢι", 2, 3, 2),FCE("ᾓ", 0, 3, 1),FCE("ᾛ", 1, 3, 1), -+FCE("ἣι", 2, 3, 2),FCE("ᾔ", 0, 3, 1),FCE("ᾜ", 1, 3, 1),FCE("ἤι", 2, 3, 2), -+FCE("ᾕ", 0, 3, 1),FCE("ᾝ", 1, 3, 1),FCE("ἥι", 2, 3, 2),FCE("ᾖ", 0, 3, 1), -+FCE("ᾞ", 1, 3, 1),FCE("ἦι", 2, 3, 2),FCE("ᾗ", 0, 3, 1),FCE("ᾟ", 1, 3, 1), -+FCE("ἧι", 2, 3, 2),FCE("ᾠ", 0, 3, 1),FCE("ᾨ", 1, 3, 1),FCE("ὠι", 2, 3, 2), -+FCE("ᾡ", 0, 3, 1),FCE("ᾩ", 1, 3, 1),FCE("ὡι", 2, 3, 2),FCE("ᾢ", 0, 3, 1), -+FCE("ᾪ", 1, 3, 1),FCE("ὢι", 2, 3, 2),FCE("ᾣ", 0, 3, 1),FCE("ᾫ", 1, 3, 1), -+FCE("ὣι", 2, 3, 2),FCE("ᾤ", 0, 3, 1),FCE("ᾬ", 1, 3, 1),FCE("ὤι", 2, 3, 2), -+FCE("ᾥ", 0, 3, 1),FCE("ᾭ", 1, 3, 1),FCE("ὥι", 2, 3, 2),FCE("ᾦ", 0, 3, 1), -+FCE("ᾮ", 1, 3, 1),FCE("ὦι", 2, 3, 2),FCE("ᾧ", 0, 3, 1),FCE("ᾯ", 1, 3, 1), -+FCE("ὧι", 2, 3, 2),FCE("ᾠ", 0, 3, 1),FCE("ᾨ", 1, 3, 1),FCE("ὠι", 2, 3, 2), -+FCE("ᾡ", 0, 3, 1),FCE("ᾩ", 1, 3, 1),FCE("ὡι", 2, 3, 2),FCE("ᾢ", 0, 3, 1), -+FCE("ᾪ", 1, 3, 1),FCE("ὢι", 2, 3, 2),FCE("ᾣ", 0, 3, 1),FCE("ᾫ", 1, 3, 1), -+FCE("ὣι", 2, 3, 2),FCE("ᾤ", 0, 3, 1),FCE("ᾬ", 1, 3, 1),FCE("ὤι", 2, 3, 2), -+FCE("ᾥ", 0, 3, 1),FCE("ᾭ", 1, 3, 1),FCE("ὥι", 2, 3, 2),FCE("ᾦ", 0, 3, 1), -+FCE("ᾮ", 1, 3, 1),FCE("ὦι", 2, 3, 2),FCE("ᾧ", 0, 3, 1),FCE("ᾯ", 1, 3, 1), -+FCE("ὧι", 2, 3, 2),FCE("ᾲ", 0, 2, 1),FCE("ὰι", 1, 2, 2),FCE("ᾳ", 0, 3, 1), -+FCE("ᾼ", 1, 3, 1),FCE("αι", 2, 3, 2),FCE("ᾴ", 0, 2, 1),FCE("άι", 1, 2, 2), -+FCE("ᾶ", 0, 2, 1),FCE("ᾶ", 1, 2, 2),FCE("ᾷ", 0, 2, 1),FCE("ᾶι", 1, 2, 3), -+FCE("ᾰ", 0, 2, 1),FCE("Ᾰ", 1, 2, 1),FCE("ᾱ", 0, 2, 1),FCE("Ᾱ", 1, 2, 1), -+FCE("ὰ", 0, 2, 1),FCE("Ὰ", 1, 2, 1),FCE("ά", 0, 2, 1),FCE("Ά", 1, 2, 1), -+FCE("ᾳ", 0, 3, 1),FCE("ᾼ", 1, 3, 1),FCE("αι", 2, 3, 2),FCE("ͅ", 0, 4, 1), -+FCE("Ι", 1, 4, 1),FCE("ι", 2, 4, 1),FCE("ι", 3, 4, 1),FCE("ῂ", 0, 2, 1), -+FCE("ὴι", 1, 2, 2),FCE("ῃ", 0, 3, 1),FCE("ῌ", 1, 3, 1),FCE("ηι", 2, 3, 2), -+FCE("ῄ", 0, 2, 1),FCE("ήι", 1, 2, 2),FCE("𐐌", 0, 2, 1),FCE("𐐴", 1, 2, 1), -+FCE("ῆ", 0, 2, 1),FCE("ῆ", 1, 2, 2),FCE("ῇ", 0, 2, 1),FCE("ῆι", 1, 2, 3), -+FCE("ὲ", 0, 2, 1),FCE("Ὲ", 1, 2, 1),FCE("έ", 0, 2, 1),FCE("Έ", 1, 2, 1), -+FCE("ὴ", 0, 2, 1),FCE("Ὴ", 1, 2, 1),FCE("ή", 0, 2, 1),FCE("Ή", 1, 2, 1), -+FCE("ῃ", 0, 3, 1),FCE("ῌ", 1, 3, 1),FCE("ηι", 2, 3, 2),FCE("ῒ", 0, 2, 1), -+FCE("ῒ", 1, 2, 3),FCE("ΐ", 0, 3, 1),FCE("ΐ", 1, 3, 1),FCE("ΐ", 2, 3, 3), -+FCE("ῖ", 0, 2, 1),FCE("ῖ", 1, 2, 2),FCE("ῗ", 0, 2, 1),FCE("ῗ", 1, 2, 3), -+FCE("ῐ", 0, 2, 1),FCE("Ῐ", 1, 2, 1),FCE("ῑ", 0, 2, 1),FCE("Ῑ", 1, 2, 1), -+FCE("ὶ", 0, 2, 1),FCE("Ὶ", 1, 2, 1),FCE("ί", 0, 2, 1),FCE("Ί", 1, 2, 1), -+FCE("𐐧", 0, 2, 1),FCE("𐑏", 1, 2, 1),FCE("ῢ", 0, 2, 1),FCE("ῢ", 1, 2, 3), -+FCE("ΰ", 0, 3, 1),FCE("ΰ", 1, 3, 1),FCE("ΰ", 2, 3, 3),FCE("ῤ", 0, 2, 1), -+FCE("ῤ", 1, 2, 2),FCE("ῦ", 0, 2, 1),FCE("ῦ", 1, 2, 2),FCE("ῧ", 0, 2, 1), -+FCE("ῧ", 1, 2, 3),FCE("ῠ", 0, 2, 1),FCE("Ῠ", 1, 2, 1),FCE("ῡ", 0, 2, 1), -+FCE("Ῡ", 1, 2, 1),FCE("ὺ", 0, 2, 1),FCE("Ὺ", 1, 2, 1),FCE("ύ", 0, 2, 1), -+FCE("Ύ", 1, 2, 1),FCE("ῥ", 0, 2, 1),FCE("Ῥ", 1, 2, 1),FCE("𐐁", 0, 2, 1), -+FCE("𐐩", 1, 2, 1),FCE("ῲ", 0, 2, 1),FCE("ὼι", 1, 2, 2),FCE("ῳ", 0, 3, 1), -+FCE("ῼ", 1, 3, 1),FCE("ωι", 2, 3, 2),FCE("ῴ", 0, 2, 1),FCE("ώι", 1, 2, 2), -+FCE("ῶ", 0, 2, 1),FCE("ῶ", 1, 2, 2),FCE("ῷ", 0, 2, 1),FCE("ῶι", 1, 2, 3), -+FCE("ὸ", 0, 2, 1),FCE("Ὸ", 1, 2, 1),FCE("ό", 0, 2, 1),FCE("Ό", 1, 2, 1), -+FCE("ὼ", 0, 2, 1),FCE("Ὼ", 1, 2, 1),FCE("ώ", 0, 2, 1),FCE("Ώ", 1, 2, 1), -+FCE("ῳ", 0, 3, 1),FCE("ῼ", 1, 3, 1),FCE("ωι", 2, 3, 2),FCE("Ⓚ", 0, 2, 1), -+FCE("ⓚ", 1, 2, 1),]; -+return t; -+} -+ -+struct uniProps -+{ -+private alias _U = immutable(UnicodeProperty); -+@property static _U[] tab() { return _tab; } -+static immutable: -+private alias _T = ubyte[]; -+_T So = [0x80, 0xa6, 0x1, 0x2, 0x1, 0x4, 0x1, 0x1, 0x1, 0x83, 0xd1, 0x1, 0x81, 0x8b, 0x2, 0x80, 0xce, 0x1, 0xa, 0x1, 0x13, 0x2, 0x80, 0xf7, 0x1, 0x82, 0x3, 0x1, 0x81, 0x75, 0x1, 0x80, 0x82, 0x6, 0x1, 0x1, 0x80, 0x84, 0x1, 0x80, 0xf9, 0x1, 0x81, 0x87, 0x3, 0xf, 0x1, 0x1, 0x3, 0x2, 0x6, 0x14, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0x85, 0x8, 0x1, 0x6, 0x1, 0x2, 0x5, 0x4, 0x80, 0xc5, 0x2, 0x82, 0xf0, 0xa, 0x85, 0xa6, 0x1, 0x80, 0x9d, 0x22, 0x81, 0x61, 0xa, 0x9, 0x9, 0x85, 0x83, 0x2, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0xb, 0x2, 0xe, 0x1, 0x1, 0x2, 0x1, 0x1, 0x45, 0x5, 0x2, 0x4, 0x1, 0x2, 0x1, 0x2, 0x1, 0x7, 0x1, 0x1f, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1f, 0x81, 0xc, 0x8, 0x4, 0x14, 0x2, 0x7, 0x2, 0x51, 0x1, 0x1e, 0x19, 0x28, 0x6, 0x12, 0xc, 0x27, 0x19, 0xb, 0x51, 0x4e, 0x16, 0x80, 0xb7, 0x1, 0x9, 0x1, 0x36, 0x8, 0x6f, 0x1, 0x80, 0x90, 0x1, 0x67, 0x2c, 0x2c, 0x40, 0x81, 0x0, 0x82, 0x0, 0x30, 0x15, 0x2, 0x9, 0xa, 0x81, 0x8b, 0x6, 0x81, 0x95, 0x1a, 0x1, 0x59, 0xc, 0x80, 0xd6, 0x1a, 0xc, 0x8, 0x1, 0xd, 0x2, 0xc, 0x1, 0x15, 0x2, 0x6, 0x2, 0x81, 0x50, 0x2, 0x4, 0xa, 0x20, 0x24, 0x1c, 0x1f, 0xb, 0x1e, 0x8, 0x1, 0xf, 0x20, 0xa, 0x27, 0xf, 0x3f, 0x1, 0x81, 0x0, 0x99, 0xc0, 0x40, 0xa0, 0x56, 0x90, 0x37, 0x83, 0x61, 0x4, 0xa, 0x2, 0x1, 0x1, 0x82, 0x3d, 0x3, 0xa0, 0x53, 0x83, 0x1, 0x81, 0xe6, 0x1, 0x3, 0x1, 0x4, 0x2, 0xd, 0x2, 0x81, 0x39, 0x9, 0x39, 0x11, 0x6, 0xc, 0x34, 0x2d, 0xa0, 0xce, 0x3, 0x80, 0xf6, 0xa, 0x27, 0x2, 0x3c, 0x5, 0x3, 0x16, 0x2, 0x7, 0x1e, 0x4, 0x30, 0x22, 0x42, 0x3, 0x1, 0x80, 0xba, 0x57, 0x9c, 0xa9, 0x2c, 0x4, 0x64, 0xc, 0xf, 0x2, 0xe, 0x2, 0xf, 0x1, 0xf, 0x30, 0x1f, 0x1, 0x3c, 0x4, 0x2b, 0x4b, 0x1d, 0xd, 0x2b, 0x5, 0x9, 0x7, 0x2, 0x80, 0xae, 0x21, 0xf, 0x6, 0x1, 0x46, 0x3, 0x14, 0xc, 0x25, 0x1, 0x5, 0x15, 0x11, 0xf, 0x3f, 0x1, 0x1, 0x1, 0x80, 0xb6, 0x1, 0x4, 0x3, 0x3e, 0x2, 0x4, 0xc, 0x18, 0x80, 0x93, 0x46, 0x4, 0xb, 0x30, 0x46, 0x3a, 0x74]; -+_T Pf = [0x80, 0xbb, 0x1, 0x9f, 0x5d, 0x1, 0x3, 0x1, 0x1c, 0x1, 0x8d, 0xc8, 0x1, 0x1, 0x1, 0x4, 0x1, 0x2, 0x1, 0xf, 0x1, 0x3, 0x1]; -+_T Bidi_Control = [0x86, 0x1c, 0x1, 0x99, 0xf1, 0x2, 0x1a, 0x5, 0x37, 0x4]; -+_T Hex_Digit = [0x30, 0xa, 0x7, 0x6, 0x1a, 0x6, 0xa0, 0xfe, 0xa9, 0xa, 0x7, 0x6, 0x1a, 0x6]; -+_T Other_Lowercase = [0x80, 0xaa, 0x1, 0xf, 0x1, 0x81, 0xf5, 0x9, 0x7, 0x2, 0x1e, 0x5, 0x60, 0x1, 0x34, 0x1, 0x99, 0xb1, 0x3f, 0xd, 0x1, 0x22, 0x25, 0x82, 0xb1, 0x1, 0xd, 0x1, 0x10, 0xd, 0x80, 0xd3, 0x10, 0x83, 0x50, 0x1a, 0x87, 0x92, 0x2, 0xa0, 0x7a, 0xf2, 0x1, 0x80, 0x87, 0x2]; -+_T Quotation_Mark = [0x22, 0x1, 0x4, 0x1, 0x80, 0x83, 0x1, 0xf, 0x1, 0x9f, 0x5c, 0x8, 0x19, 0x2, 0x8f, 0xd1, 0x4, 0xd, 0x3, 0xa0, 0xce, 0x21, 0x4, 0x80, 0xbd, 0x1, 0x4, 0x1, 0x5a, 0x2]; -+_T XID_Start = [0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x4, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xca, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x80, 0x81, 0x5, 0x1, 0x2, 0x3, 0x3, 0x8, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x8, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x1, 0x7, 0x27, 0x48, 0x1b, 0x5, 0x3, 0x2d, 0x2b, 0x23, 0x2, 0x1, 0x63, 0x1, 0x1, 0xf, 0x2, 0x7, 0x2, 0xa, 0x3, 0x2, 0x1, 0x10, 0x1, 0x1, 0x1e, 0x1d, 0x59, 0xb, 0x1, 0x18, 0x21, 0x9, 0x2, 0x4, 0x1, 0x5, 0x16, 0x4, 0x1, 0x9, 0x1, 0x3, 0x1, 0x17, 0x19, 0x47, 0x1, 0x1, 0xb, 0x57, 0x36, 0x3, 0x1, 0x12, 0x1, 0x7, 0xa, 0xf, 0x7, 0x1, 0x7, 0x5, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x3, 0x1, 0x10, 0x1, 0xd, 0x2, 0x1, 0x3, 0xe, 0x2, 0x13, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1f, 0x4, 0x1, 0x1, 0x13, 0x3, 0x10, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x12, 0x1, 0xf, 0x2, 0x23, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x1e, 0x2, 0x1, 0x3, 0xf, 0x1, 0x11, 0x1, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x16, 0x1, 0x34, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x1a, 0x2, 0x6, 0x2, 0x23, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x20, 0x1, 0x1, 0x2, 0xf, 0x2, 0x12, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x1, 0x10, 0x1, 0x11, 0x2, 0x18, 0x6, 0x5, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3a, 0x30, 0x1, 0x1, 0xd, 0x7, 0x3a, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, 0x1, 0x1, 0xa, 0x1, 0x2, 0x5, 0x1, 0x1, 0x15, 0x4, 0x20, 0x1, 0x3f, 0x8, 0x1, 0x24, 0x1b, 0x5, 0x73, 0x2b, 0x14, 0x1, 0x10, 0x6, 0x4, 0x4, 0x3, 0x1, 0x3, 0x2, 0x7, 0x3, 0x4, 0xd, 0xc, 0x1, 0x11, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x81, 0x4d, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x25, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x3, 0x3, 0xf, 0xd, 0x1, 0x4, 0xe, 0x12, 0xe, 0x12, 0xe, 0xd, 0x1, 0x3, 0xf, 0x34, 0x23, 0x1, 0x4, 0x1, 0x43, 0x58, 0x8, 0x29, 0x1, 0x1, 0x5, 0x46, 0xa, 0x1d, 0x33, 0x1e, 0x2, 0x5, 0xb, 0x2c, 0x15, 0x7, 0x38, 0x17, 0x9, 0x35, 0x52, 0x1, 0x5d, 0x2f, 0x11, 0x7, 0x37, 0x1e, 0xd, 0x2, 0xa, 0x2c, 0x1a, 0x24, 0x29, 0x3, 0xa, 0x24, 0x6b, 0x4, 0x1, 0x4, 0x3, 0x2, 0x9, 0x80, 0xc0, 0x40, 0x81, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x74, 0x1, 0xd, 0x1, 0x10, 0xd, 0x65, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x29, 0x8a, 0x77, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x4, 0x3, 0x2, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x1, 0x10, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x82, 0x26, 0x3, 0x19, 0x9, 0x7, 0x5, 0x2, 0x5, 0x4, 0x56, 0x6, 0x3, 0x1, 0x5a, 0x1, 0x4, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x84, 0x8d, 0x43, 0x2e, 0x2, 0x81, 0xd, 0x3, 0x10, 0xa, 0x2, 0x14, 0x2f, 0x10, 0x19, 0x8, 0x50, 0x27, 0x9, 0x2, 0x67, 0x2, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0xa, 0x1, 0x3, 0x1, 0x4, 0x1, 0x17, 0x1d, 0x34, 0xe, 0x32, 0x3e, 0x6, 0x3, 0x1, 0xe, 0x1c, 0xa, 0x17, 0x19, 0x1d, 0x7, 0x2f, 0x1c, 0x1, 0x30, 0x29, 0x17, 0x3, 0x1, 0x8, 0x14, 0x17, 0x3, 0x1, 0x5, 0x30, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x1, 0x18, 0x3, 0x2, 0xb, 0x7, 0x3, 0xc, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x23, 0x1d, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0x1, 0x1, 0xa, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x80, 0x8b, 0x6, 0x80, 0xda, 0x12, 0x40, 0x2, 0x36, 0x28, 0xa, 0x77, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7e, 0x24, 0x1a, 0x6, 0x1a, 0xb, 0x38, 0x2, 0x1f, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x45, 0x35, 0x81, 0xb, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x1b, 0x35, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x1, 0x5, 0x2a, 0x80, 0x9e, 0x83, 0x62, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x1, 0xf, 0x4, 0x1, 0x3, 0x1, 0x1b, 0x2c, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xba, 0x35, 0x4b, 0x2d, 0x20, 0x19, 0x1a, 0x24, 0x5c, 0x30, 0xe, 0x4, 0x84, 0xbb, 0x2b, 0x89, 0x55, 0x83, 0x6f, 0x80, 0x91, 0x63, 0x8b, 0x9d, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x1, 0x42, 0xd, 0xa0, 0x40, 0x60, 0x2, 0xa0, 0x23, 0xfe, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x96, 0x34, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Terminal_Punctuation = [0x21, 0x1, 0xa, 0x1, 0x1, 0x1, 0xb, 0x2, 0x3, 0x1, 0x83, 0x3e, 0x1, 0x8, 0x1, 0x82, 0x1, 0x1, 0x39, 0x1, 0x48, 0x1, 0xe, 0x1, 0x3, 0x1, 0x80, 0xb4, 0x1, 0x2b, 0xb, 0x1, 0x1, 0x80, 0xeb, 0x2, 0x36, 0xf, 0x1f, 0x1, 0x81, 0x5, 0x2, 0x84, 0xf4, 0x2, 0x80, 0xac, 0x1, 0x4, 0x6, 0x81, 0x37, 0x2, 0x83, 0x15, 0x8, 0x83, 0x4, 0x2, 0x7c, 0x3, 0x80, 0xe6, 0x3, 0x3, 0x1, 0x27, 0x4, 0x2, 0x2, 0x81, 0x3a, 0x2, 0x81, 0x62, 0x4, 0x80, 0xae, 0x2, 0x1, 0x3, 0x80, 0xdb, 0x5, 0x3e, 0x2, 0x83, 0xbc, 0x2, 0x9, 0x3, 0x8d, 0xe4, 0x1, 0x81, 0xd2, 0x2, 0xa0, 0x74, 0xfb, 0x2, 0x81, 0xd, 0x3, 0x80, 0xe3, 0x5, 0x81, 0x7e, 0x2, 0x56, 0x2, 0x5f, 0x1, 0x80, 0x97, 0x3, 0x80, 0x93, 0x3, 0x7f, 0x1, 0x10, 0x2, 0x80, 0xf9, 0x1, 0xa0, 0x52, 0x64, 0x3, 0x1, 0x4, 0x80, 0xa9, 0x1, 0xa, 0x1, 0x1, 0x1, 0xb, 0x2, 0x3, 0x1, 0x41, 0x1, 0x2, 0x1, 0x84, 0x3a, 0x1, 0x30, 0x1, 0x84, 0x86, 0x1, 0x80, 0xc7, 0x1, 0x82, 0x1a, 0x6, 0x85, 0x7, 0x7, 0x70, 0x4, 0x7f, 0x3, 0x80, 0x81, 0x2, 0x92, 0xa9, 0x4]; -+_T Math = [0x2b, 0x1, 0x10, 0x3, 0x1f, 0x1, 0x1d, 0x1, 0x1, 0x1, 0x2d, 0x1, 0x4, 0x1, 0x25, 0x1, 0x1f, 0x1, 0x82, 0xd8, 0x3, 0x2, 0x1, 0x1a, 0x2, 0x2, 0x3, 0x82, 0xf, 0x3, 0x9a, 0xd, 0x1, 0x1b, 0x3, 0xb, 0x1, 0x3, 0x1, 0xd, 0x1, 0xe, 0x4, 0x15, 0x5, 0xb, 0x5, 0x41, 0xd, 0x4, 0x1, 0x3, 0x2, 0x4, 0x5, 0x12, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x3, 0x2, 0x2, 0x2, 0x1, 0x3, 0x1, 0x6, 0x3, 0xe, 0x1, 0x1, 0x44, 0x18, 0x1, 0x6, 0x1, 0x2, 0x4, 0x2, 0x4, 0x20, 0x1, 0x1, 0x6, 0x2, 0xe, 0x81, 0xc, 0x8, 0x4, 0x14, 0x2, 0x5a, 0x1, 0x1e, 0x1b, 0x1, 0x1, 0x18, 0x1, 0xb, 0x7, 0x81, 0xbd, 0x2, 0xc, 0xa, 0x4, 0x6, 0x4, 0x2, 0x2, 0x2, 0x3, 0x5, 0xe, 0x1, 0x1, 0x1, 0x2, 0x6, 0xb, 0x8, 0x5, 0x2, 0x39, 0x1, 0x1, 0x1, 0x1d, 0x4, 0x9, 0x3, 0x81, 0x50, 0x40, 0x81, 0x0, 0x82, 0x0, 0x30, 0x15, 0x2, 0x6, 0xa0, 0xcf, 0xdc, 0x1, 0x83, 0x37, 0x6, 0x1, 0x1, 0x80, 0xa2, 0x1, 0x10, 0x3, 0x1d, 0x1, 0x1, 0x1, 0x1d, 0x1, 0x1, 0x1, 0x80, 0x83, 0x1, 0x6, 0x4, 0xa0, 0xd4, 0x13, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x81, 0x24, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x34, 0x2]; -+_T Lu = [0x41, 0x1a, 0x65, 0x17, 0x1, 0x7, 0x21, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x3, 0x2, 0x4, 0x1, 0x2, 0x1, 0x3, 0x3, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x3, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0x21, 0x1, 0x1, 0x1, 0x3, 0x1, 0xf, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x1, 0x11, 0x1, 0x9, 0x23, 0x1, 0x2, 0x3, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x5, 0x1, 0x2, 0x1, 0x1, 0x2, 0x2, 0x33, 0x30, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa, 0x26, 0x8b, 0x49, 0x26, 0x1, 0x1, 0x5, 0x1, 0x8d, 0x32, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x8, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0x6, 0xb, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x8, 0x8, 0x48, 0x4, 0xc, 0x4, 0xc, 0x4, 0xc, 0x5, 0xb, 0x4, 0x81, 0x6, 0x1, 0x4, 0x1, 0x3, 0x3, 0x2, 0x3, 0x2, 0x1, 0x3, 0x5, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x2, 0x4, 0xa, 0x2, 0x5, 0x1, 0x3d, 0x1, 0x8a, 0x7c, 0x2f, 0x31, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x8, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x8, 0x1, 0x1, 0x1, 0x4, 0x1, 0xa0, 0x79, 0x4d, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0x8b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0xd, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa0, 0x57, 0x76, 0x1a, 0x84, 0xc5, 0x28, 0xa0, 0xcf, 0xd8, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0x8, 0x1a, 0x1a, 0x1a, 0x2, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1b, 0x2, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1b, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1e, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x1]; -+_T Other_Uppercase = [0xa0, 0x21, 0x60, 0x10, 0x83, 0x46, 0x1a]; -+_T Sk = [0x5e, 0x1, 0x1, 0x1, 0x47, 0x1, 0x6, 0x1, 0x4, 0x1, 0x3, 0x1, 0x82, 0x9, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x11, 0x75, 0x1, 0xe, 0x2, 0x9c, 0x37, 0x1, 0x1, 0x3, 0xb, 0x3, 0xd, 0x3, 0xd, 0x3, 0xd, 0x2, 0x90, 0x9c, 0x2, 0xa0, 0x76, 0x63, 0x17, 0x9, 0x2, 0x67, 0x2, 0xa0, 0x54, 0x27, 0x10, 0x83, 0x7c, 0x1, 0x1, 0x1, 0x80, 0xa2, 0x1]; -+_T Other_ID_Start = [0xa0, 0x21, 0x18, 0x1, 0x15, 0x1, 0x8f, 0x6c, 0x2]; -+_T Nl = [0x96, 0xee, 0x3, 0x8a, 0x6f, 0x23, 0x2, 0x4, 0x8e, 0x7e, 0x1, 0x19, 0x9, 0xe, 0x3, 0xa0, 0x76, 0xab, 0xa, 0xa0, 0x5a, 0x50, 0x35, 0x81, 0xcc, 0x1, 0x8, 0x1, 0x80, 0x86, 0x5, 0xa0, 0x20, 0x2a, 0x63]; -+_T Other_Alphabetic = [0x83, 0x45, 0x1, 0x82, 0x6a, 0xe, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x48, 0xb, 0x30, 0xd, 0x1, 0x7, 0x10, 0x1, 0x65, 0x7, 0x4, 0x4, 0x2, 0x2, 0x4, 0x1, 0x23, 0x1, 0x1e, 0x10, 0x66, 0xb, 0x65, 0x2, 0x3, 0x9, 0x1, 0x3, 0x1, 0x4, 0x80, 0xb7, 0x6, 0x6, 0xf, 0x1, 0x4, 0x36, 0x2, 0x2, 0xf, 0x1, 0x2, 0x5, 0x3, 0xa, 0x2, 0x1d, 0x3, 0x3a, 0x7, 0x2, 0x2, 0x2, 0x2, 0xa, 0x1, 0xa, 0x2, 0x1d, 0x3, 0x3a, 0x5, 0x4, 0x2, 0x2, 0x2, 0x4, 0x1, 0x1e, 0x2, 0x3, 0x1, 0xb, 0x3, 0x3a, 0x8, 0x1, 0x3, 0x1, 0x2, 0x15, 0x2, 0x1d, 0x3, 0x3a, 0x7, 0x2, 0x2, 0x2, 0x2, 0x9, 0x2, 0xa, 0x2, 0x1e, 0x1, 0x3b, 0x5, 0x3, 0x3, 0x1, 0x3, 0xa, 0x1, 0x29, 0x3, 0x3a, 0x7, 0x1, 0x3, 0x1, 0x3, 0x8, 0x2, 0xb, 0x2, 0x1e, 0x2, 0x3a, 0x7, 0x1, 0x3, 0x1, 0x3, 0x8, 0x2, 0xb, 0x2, 0x1e, 0x2, 0x3a, 0x7, 0x1, 0x3, 0x1, 0x3, 0xa, 0x1, 0xa, 0x2, 0x1e, 0x2, 0x4b, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x2, 0x3d, 0x1, 0x2, 0x7, 0x12, 0x1, 0x63, 0x1, 0x2, 0x6, 0x1, 0x2, 0x10, 0x1, 0x80, 0xa3, 0x11, 0xb, 0xb, 0x1, 0x24, 0x6e, 0xc, 0x1, 0x1, 0x2, 0x4, 0x17, 0x4, 0x4, 0x3, 0x1, 0x1, 0x4, 0x2, 0x8, 0x4, 0xd, 0x5, 0x15, 0x2, 0x82, 0xc1, 0x1, 0x83, 0xb2, 0x2, 0x1e, 0x2, 0x1e, 0x2, 0x1e, 0x2, 0x42, 0x13, 0x80, 0xe0, 0x1, 0x76, 0xc, 0x4, 0x9, 0x77, 0x11, 0x7, 0x2, 0x4d, 0x5, 0x39, 0xa, 0x2, 0x14, 0x80, 0x8b, 0x5, 0x30, 0xf, 0x3c, 0x3, 0x1e, 0x9, 0x2, 0x2, 0x39, 0xb, 0x32, 0x12, 0x80, 0xbc, 0x2, 0x87, 0xc2, 0x34, 0x88, 0xf6, 0x20, 0xa0, 0x78, 0x74, 0x8, 0x23, 0x1, 0x81, 0x83, 0x5, 0x58, 0x2, 0x32, 0x10, 0x62, 0x5, 0x1c, 0xc, 0x2d, 0x4, 0x30, 0xc, 0x69, 0xe, 0xc, 0x1, 0x8, 0x2, 0x62, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x1, 0x2c, 0x5, 0x5, 0x1, 0x80, 0xed, 0x8, 0xa0, 0x4f, 0x33, 0x1, 0x8e, 0xe2, 0x3, 0x1, 0x2, 0x5, 0x4, 0x85, 0xf0, 0x3, 0x35, 0xe, 0x3c, 0x1, 0x2d, 0x9, 0x47, 0x3, 0x24, 0xc, 0x4d, 0x3, 0x30, 0xd, 0x84, 0xeb, 0xb, 0xa0, 0x58, 0x9b, 0x2e]; -+_T Alphabetic = [0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x4, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xca, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x56, 0x1, 0x2a, 0x5, 0x1, 0x2, 0x2, 0x4, 0x8, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x8, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x1, 0x7, 0x27, 0x28, 0xe, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x8, 0x1b, 0x5, 0x3, 0x1d, 0xb, 0x5, 0x38, 0x1, 0x7, 0xe, 0x66, 0x1, 0x8, 0x4, 0x8, 0x4, 0x3, 0xa, 0x3, 0x2, 0x1, 0x10, 0x30, 0xd, 0x65, 0x18, 0x21, 0x9, 0x2, 0x4, 0x1, 0x5, 0x18, 0x2, 0x13, 0x13, 0x19, 0x47, 0x1, 0x1, 0xb, 0x37, 0x6, 0x6, 0xf, 0x1, 0x3c, 0x1, 0x10, 0x1, 0x3, 0x4, 0xf, 0xd, 0x7, 0x1, 0x7, 0x1, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x3, 0x8, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x8, 0x1, 0x4, 0x2, 0x1, 0x5, 0xc, 0x2, 0xf, 0x3, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x4, 0x5, 0x4, 0x2, 0x2, 0x2, 0x4, 0x1, 0x7, 0x4, 0x1, 0x1, 0x11, 0x6, 0xb, 0x3, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x9, 0x1, 0x3, 0x1, 0x2, 0x3, 0x1, 0xf, 0x4, 0x1d, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x8, 0x2, 0x2, 0x2, 0x2, 0x9, 0x2, 0x4, 0x2, 0x1, 0x5, 0xd, 0x1, 0x10, 0x2, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x4, 0x5, 0x3, 0x3, 0x1, 0x3, 0x3, 0x1, 0x6, 0x1, 0x29, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x3, 0x8, 0x2, 0x1, 0x2, 0x6, 0x4, 0x1e, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x3, 0x8, 0x2, 0x7, 0x1, 0x1, 0x4, 0xd, 0x2, 0xf, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x8, 0x1, 0x3, 0x1, 0x3, 0x1, 0x1, 0x8, 0x1, 0x8, 0x4, 0x16, 0x6, 0x2, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x8, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x2, 0xd, 0x3a, 0x5, 0x7, 0x6, 0x1, 0x33, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0xd, 0x1, 0x3, 0x2, 0x5, 0x1, 0x1, 0x6, 0x1, 0xe, 0x4, 0x20, 0x1, 0x3f, 0x8, 0x1, 0x24, 0x4, 0x11, 0x6, 0x10, 0x1, 0x24, 0x43, 0x37, 0x1, 0x1, 0x2, 0x5, 0x10, 0x13, 0x2, 0x4, 0x5, 0x19, 0x7, 0x1, 0xd, 0x2, 0x2, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x81, 0x4d, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x4, 0x1, 0x20, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x3, 0x3, 0xf, 0xd, 0x1, 0x6, 0xc, 0x14, 0xc, 0x14, 0xc, 0xd, 0x1, 0x3, 0x1, 0x2, 0xc, 0x34, 0x2, 0x13, 0xe, 0x1, 0x4, 0x1, 0x43, 0x58, 0x8, 0x2b, 0x5, 0x46, 0xa, 0x1d, 0x3, 0xc, 0x4, 0x9, 0x17, 0x1e, 0x2, 0x5, 0xb, 0x2c, 0x4, 0x1a, 0x36, 0x1c, 0x4, 0x3f, 0x2, 0x14, 0x32, 0x1, 0x58, 0x34, 0x1, 0xf, 0x1, 0x7, 0x34, 0x2a, 0x2, 0x4, 0xa, 0x2c, 0x1, 0xb, 0xe, 0x36, 0x17, 0x3, 0xa, 0x24, 0x6b, 0x4, 0x1, 0x6, 0x1, 0x2, 0x9, 0x80, 0xc0, 0x40, 0x81, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x74, 0x1, 0xd, 0x1, 0x10, 0xd, 0x65, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x3, 0x5, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0xb, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x29, 0x83, 0x2d, 0x34, 0x87, 0x16, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x4, 0x3, 0x2, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x1, 0x10, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x20, 0x2f, 0x1, 0x81, 0xd5, 0x3, 0x19, 0x9, 0x7, 0x5, 0x2, 0x5, 0x4, 0x56, 0x6, 0x3, 0x1, 0x5a, 0x1, 0x4, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x84, 0x8d, 0x43, 0x2e, 0x2, 0x81, 0xd, 0x3, 0x10, 0xa, 0x2, 0x14, 0x2f, 0x5, 0x8, 0x3, 0x19, 0x7, 0x51, 0x27, 0x9, 0x2, 0x67, 0x2, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0xa, 0x1, 0x3, 0x1, 0x4, 0x1, 0x1c, 0x18, 0x34, 0xc, 0x44, 0x2e, 0x6, 0x3, 0x1, 0xe, 0x21, 0x5, 0x23, 0xd, 0x1d, 0x3, 0x33, 0x1, 0xc, 0xf, 0x1, 0x30, 0x37, 0x9, 0xe, 0x12, 0x17, 0x3, 0x1, 0x5, 0x3f, 0x1, 0x1, 0x1, 0x1, 0x18, 0x3, 0x2, 0x10, 0x2, 0x4, 0xb, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x2b, 0x15, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0xc, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x81, 0x6b, 0x12, 0x40, 0x2, 0x36, 0x28, 0xc, 0x74, 0x5, 0x1, 0x80, 0x87, 0x24, 0x1a, 0x6, 0x1a, 0xb, 0x59, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x45, 0x35, 0x81, 0xb, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x1b, 0x35, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x1, 0x5, 0x2a, 0x80, 0x9e, 0x83, 0x62, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x4, 0x1, 0x2, 0x5, 0x8, 0x1, 0x3, 0x1, 0x1b, 0x2c, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xb7, 0x46, 0x3c, 0x37, 0x17, 0x19, 0x17, 0x33, 0x4d, 0x40, 0x1, 0x4, 0x84, 0xbb, 0x36, 0x89, 0x4a, 0x83, 0x6f, 0x80, 0x91, 0x63, 0x8b, 0x9d, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x2f, 0x14, 0xd, 0xa0, 0x40, 0x60, 0x2, 0xa0, 0x23, 0xfe, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x96, 0x34, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Zs = [0x20, 0x1, 0x7f, 0x1, 0x95, 0xdf, 0x1, 0x89, 0x7f, 0xb, 0x24, 0x1, 0x2f, 0x1, 0x8f, 0xa0, 0x1]; -+_T Variation_Selector = [0x98, 0xb, 0x3, 0xa0, 0xe5, 0xf2, 0x10, 0xad, 0x2, 0xf0, 0x80, 0xf0]; -+_T Other_Default_Ignorable_Code_Point = [0x83, 0x4f, 0x1, 0x8e, 0xf, 0x2, 0x86, 0x53, 0x2, 0x88, 0xaf, 0x1, 0x90, 0xfe, 0x1, 0xa0, 0xce, 0x3b, 0x1, 0x4f, 0x9, 0xad, 0x0, 0x7, 0x1, 0x1, 0x1e, 0x60, 0x80, 0x80, 0x80, 0xf0, 0x8e, 0x10]; -+_T IDS_Binary_Operator = [0xa0, 0x2f, 0xf0, 0x2, 0x2, 0x8]; -+_T Grapheme_Base = [0x20, 0x5f, 0x21, 0xd, 0x1, 0x82, 0x52, 0x70, 0x8, 0x2, 0x5, 0x5, 0x7, 0x1, 0x1, 0x1, 0x14, 0x1, 0x80, 0xe0, 0x7, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x7, 0x1, 0x27, 0x1, 0x2, 0x4, 0x1, 0x2e, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x9, 0x1b, 0x5, 0x5, 0x11, 0xa, 0xb, 0x1, 0x2, 0x2d, 0x15, 0x10, 0x1, 0x65, 0x8, 0x1, 0x6, 0x2, 0x2, 0x1, 0x4, 0x20, 0x2, 0x1, 0x1, 0x1e, 0x1d, 0x59, 0xb, 0x1, 0xe, 0x2b, 0x9, 0x7, 0x5, 0x16, 0x4, 0x1, 0x9, 0x1, 0x3, 0x1, 0x7, 0xf, 0x1, 0x19, 0x5, 0x1, 0x41, 0x1, 0x1, 0xb, 0x56, 0x37, 0x1, 0x1, 0x1, 0x4, 0x8, 0x4, 0x1, 0x3, 0x7, 0xa, 0x2, 0x14, 0x1, 0x7, 0x2, 0x2, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x3, 0x1, 0x1, 0x2, 0x6, 0x2, 0x2, 0x2, 0x1, 0x1, 0xd, 0x2, 0x1, 0x3, 0x4, 0x16, 0x7, 0x1, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x4, 0x3, 0x18, 0x4, 0x1, 0x1, 0x7, 0xa, 0x2, 0x3, 0xe, 0x1, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x4, 0x8, 0x1, 0x1, 0x2, 0x3, 0x1, 0xf, 0x2, 0x4, 0xc, 0x10, 0x2, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x2, 0x1, 0x6, 0x2, 0x2, 0x2, 0xf, 0x2, 0x1, 0x3, 0x4, 0x12, 0xb, 0x1, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x5, 0x1, 0x1, 0x2, 0x3, 0x3, 0x1, 0x3, 0x3, 0x1, 0x15, 0x15, 0x6, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x3, 0x4, 0x13, 0x2, 0x6, 0x2, 0x4, 0xa, 0x8, 0x8, 0x2, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x2, 0x1, 0x2, 0x12, 0x1, 0x1, 0x2, 0x4, 0xa, 0x1, 0x2, 0xf, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x1, 0x1, 0x2, 0x5, 0x3, 0x1, 0x3, 0x1, 0x1, 0x11, 0x2, 0x4, 0x10, 0x3, 0x7, 0x2, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x9, 0x2, 0x6, 0x7, 0x13, 0x3, 0xc, 0x30, 0x1, 0x2, 0xb, 0x8, 0x8, 0xd, 0x25, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, 0x1, 0x2, 0x9, 0x1, 0x2, 0x5, 0x1, 0x1, 0x9, 0xa, 0x2, 0x4, 0x20, 0x18, 0x2, 0x1b, 0x1, 0x1, 0x1, 0x1, 0x1, 0xe, 0x1, 0x24, 0x12, 0x1, 0x5, 0x1, 0x2, 0x5, 0x31, 0x8, 0x1, 0x6, 0x1, 0xd, 0x25, 0x2d, 0x4, 0x1, 0x6, 0x1, 0x2, 0x2, 0x2, 0x19, 0x2, 0x4, 0x3, 0x10, 0x4, 0xd, 0x1, 0x2, 0x2, 0x6, 0x1, 0xf, 0x1, 0x28, 0x1, 0x1, 0x5, 0x1, 0x2, 0x81, 0x79, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x5, 0x1d, 0x3, 0x1a, 0x6, 0x55, 0xb, 0x82, 0x9d, 0x3, 0x51, 0xf, 0xd, 0x1, 0x4, 0xe, 0x12, 0x3, 0x2, 0x9, 0x12, 0xe, 0xd, 0x1, 0x3, 0xf, 0x34, 0x2, 0x1, 0x7, 0x8, 0x1, 0x2, 0xb, 0x9, 0x3, 0xa, 0x6, 0xa, 0x6, 0xb, 0x5, 0xa, 0x6, 0x58, 0x8, 0x29, 0x1, 0x1, 0x5, 0x46, 0xa, 0x1d, 0x6, 0x4, 0x2, 0x3, 0x4, 0x2, 0x1, 0x6, 0x7, 0x1, 0x3, 0x2a, 0x2, 0x5, 0xb, 0x2c, 0x4, 0x1a, 0x6, 0xb, 0x3, 0x39, 0x2, 0x2, 0x3, 0x38, 0x1, 0x1, 0x9, 0x1, 0x1, 0x2, 0x8, 0x6, 0xd, 0xa, 0x6, 0xa, 0x6, 0xe, 0x56, 0x30, 0x1, 0x1, 0x5, 0x1, 0x1, 0x5, 0x1, 0x9, 0x4, 0x1b, 0x9, 0x9, 0x5, 0x20, 0x4, 0x2, 0x2, 0x1, 0x1, 0x3a, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x3, 0x2, 0x8, 0x30, 0x8, 0x2, 0x5, 0xf, 0x3, 0x33, 0x40, 0x8, 0xb, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x2, 0x9, 0x80, 0xc0, 0x40, 0x81, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0xf, 0x1, 0xe, 0x2, 0x6, 0x1, 0x13, 0x2, 0x3, 0x1, 0x9, 0x1, 0xb, 0x5, 0x18, 0x7, 0x31, 0x10, 0x2, 0x2, 0x1b, 0x1, 0xd, 0x3, 0x1b, 0x45, 0x80, 0x8a, 0x6, 0x82, 0x64, 0xc, 0x27, 0x19, 0xb, 0x15, 0x82, 0xa0, 0x1, 0x84, 0x4c, 0x3, 0xa, 0x80, 0xa6, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x8f, 0x3, 0x2, 0x5, 0x2d, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x2, 0xf, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x21, 0x3c, 0x44, 0x1a, 0x1, 0x59, 0xc, 0x80, 0xd6, 0x1a, 0xc, 0x4, 0x2a, 0x6, 0x10, 0x1, 0x56, 0x4, 0x65, 0x5, 0x29, 0x3, 0x5e, 0x1, 0x2b, 0x5, 0x24, 0xc, 0x2f, 0x1, 0x80, 0xdf, 0x1, 0x9a, 0xb6, 0xa, 0xa0, 0x52, 0xd, 0x33, 0x84, 0x8d, 0x3, 0x37, 0x9, 0x81, 0x5c, 0x14, 0x2f, 0x4, 0x1, 0xa, 0x1a, 0x8, 0x50, 0x2, 0x6, 0x8, 0x80, 0x8f, 0x1, 0x4, 0xc, 0xb, 0x4d, 0xa, 0x1, 0x3, 0x1, 0x4, 0x1, 0x19, 0x2, 0x5, 0x4, 0xa, 0x6, 0x38, 0x8, 0x44, 0xa, 0xc, 0x18, 0xa, 0x4, 0x26, 0x8, 0x19, 0xb, 0x2, 0xb, 0x1e, 0x6, 0x30, 0x1, 0x2, 0x4, 0x2, 0x1, 0x11, 0x1, 0xb, 0x4, 0x2, 0x20, 0x29, 0x6, 0x2, 0x2, 0x2, 0xb, 0x3, 0x1, 0x8, 0x1, 0x1, 0x2, 0xa, 0x2, 0x20, 0x4, 0x30, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x1, 0x18, 0x11, 0x2, 0x8, 0xb, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x25, 0x1, 0x2, 0x1, 0x4, 0x3, 0xa, 0x6, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0x1, 0x1, 0x18, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x7c, 0x11, 0x81, 0x6d, 0x10, 0x40, 0x2, 0x36, 0x28, 0xe, 0x12, 0xa, 0x16, 0x23, 0x1, 0x13, 0x1, 0x4, 0x4, 0x5, 0x1, 0x80, 0x87, 0x4, 0x80, 0x9d, 0x2, 0x1f, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x3, 0x7, 0x1, 0x7, 0xd, 0x2, 0x2, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x5, 0x3, 0x4, 0x2d, 0x3, 0x54, 0x5, 0xc, 0x34, 0x2d, 0x80, 0x83, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x1, 0x4, 0xc, 0x1b, 0x35, 0x1e, 0x1, 0x25, 0x4, 0xe, 0x2a, 0x80, 0x9e, 0x2, 0xa, 0x83, 0x56, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x1, 0x9, 0x80, 0xa0, 0x1c, 0x3, 0x1b, 0x5, 0x1, 0x40, 0x38, 0x6, 0x2, 0x40, 0x1, 0xf, 0x4, 0x1, 0x3, 0x1, 0x1b, 0xc, 0x8, 0x8, 0x9, 0x7, 0x20, 0x80, 0x80, 0x36, 0x3, 0x1d, 0x2, 0x1b, 0x5, 0x8, 0x80, 0x80, 0x49, 0x82, 0x17, 0x1f, 0x81, 0x81, 0x1, 0x1, 0x36, 0xf, 0x7, 0x4, 0x1e, 0x12, 0x31, 0x4, 0x2, 0x2, 0x2, 0x1, 0x4, 0xe, 0x19, 0x7, 0xa, 0x9, 0x24, 0x5, 0x1, 0x9, 0xe, 0x3e, 0x34, 0x9, 0xa, 0x7, 0xa, 0x84, 0xa6, 0x2b, 0x1, 0x1, 0x1, 0x2, 0x6, 0x1, 0x9, 0xa, 0x89, 0x36, 0x83, 0x6f, 0x80, 0x91, 0x63, 0xd, 0x4, 0x8b, 0x8c, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x2f, 0x14, 0xd, 0xa0, 0x40, 0x60, 0x2, 0x9f, 0xfe, 0x80, 0xf6, 0xa, 0x27, 0x2, 0x3c, 0x1, 0x1, 0x3, 0x4, 0x15, 0x2, 0x7, 0x1e, 0x4, 0x30, 0x22, 0x42, 0x3, 0x1, 0x80, 0xba, 0x57, 0x9, 0x12, 0x80, 0x8e, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x81, 0x24, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x34, 0x2, 0x81, 0xe, 0x2c, 0x4, 0x64, 0xc, 0xf, 0x2, 0xe, 0x2, 0xf, 0x1, 0xf, 0x20, 0xb, 0x5, 0x1f, 0x1, 0x3c, 0x4, 0x2b, 0x4b, 0x1d, 0xd, 0x2b, 0x5, 0x9, 0x7, 0x2, 0x80, 0xae, 0x21, 0xf, 0x6, 0x1, 0x46, 0x3, 0x14, 0xc, 0x25, 0x1, 0x5, 0x15, 0x11, 0xf, 0x3f, 0x1, 0x1, 0x1, 0x80, 0xb6, 0x1, 0x4, 0x3, 0x3e, 0x2, 0x4, 0xc, 0x18, 0x80, 0x93, 0x46, 0x4, 0xb, 0x30, 0x46, 0x3a, 0x74, 0x88, 0x8c, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Case_Ignorable = [0x27, 0x1, 0x6, 0x1, 0xb, 0x1, 0x23, 0x1, 0x1, 0x1, 0x47, 0x1, 0x4, 0x1, 0x1, 0x1, 0x4, 0x1, 0x2, 0x2, 0x81, 0xf7, 0x80, 0xc0, 0x4, 0x2, 0x4, 0x1, 0x9, 0x2, 0x1, 0x1, 0x80, 0xfb, 0x7, 0x80, 0xcf, 0x1, 0x37, 0x2d, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x2c, 0x1, 0xb, 0x5, 0xb, 0xb, 0x1, 0x1, 0x23, 0x1, 0xa, 0x15, 0x10, 0x1, 0x65, 0x8, 0x1, 0xa, 0x1, 0x4, 0x21, 0x1, 0x1, 0x1, 0x1e, 0x1b, 0x5b, 0xb, 0x3a, 0xb, 0x4, 0x1, 0x1b, 0x18, 0x2b, 0x3, 0x80, 0x88, 0x1b, 0x1, 0x3, 0x37, 0x1, 0x1, 0x1, 0x4, 0x8, 0x4, 0x1, 0x3, 0x7, 0xa, 0x2, 0xd, 0x1, 0xf, 0x1, 0x3a, 0x1, 0x4, 0x4, 0x8, 0x1, 0x14, 0x2, 0x1d, 0x2, 0x39, 0x1, 0x4, 0x2, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x1e, 0x2, 0x3, 0x1, 0xb, 0x2, 0x39, 0x1, 0x4, 0x5, 0x1, 0x2, 0x4, 0x1, 0x14, 0x2, 0x1d, 0x1, 0x3a, 0x1, 0x2, 0x1, 0x1, 0x4, 0x8, 0x1, 0x8, 0x1, 0xb, 0x2, 0x1e, 0x1, 0x3d, 0x1, 0xc, 0x1, 0x70, 0x3, 0x5, 0x3, 0x1, 0x4, 0x7, 0x2, 0xb, 0x2, 0x58, 0x1, 0x2, 0x1, 0x6, 0x1, 0x5, 0x2, 0x14, 0x2, 0x5d, 0x4, 0x8, 0x1, 0x14, 0x2, 0x66, 0x1, 0x7, 0x3, 0x1, 0x1, 0x5a, 0x1, 0x2, 0x7, 0xb, 0x9, 0x62, 0x1, 0x2, 0x6, 0x1, 0x2, 0x9, 0x1, 0x1, 0x6, 0x4a, 0x2, 0x1b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x37, 0xe, 0x1, 0x5, 0x1, 0x2, 0x5, 0xb, 0x1, 0x24, 0x9, 0x1, 0x66, 0x4, 0x1, 0x6, 0x1, 0x2, 0x2, 0x2, 0x19, 0x2, 0x4, 0x3, 0x10, 0x4, 0xd, 0x1, 0x2, 0x2, 0x6, 0x1, 0xf, 0x1, 0x5e, 0x1, 0x82, 0x60, 0x3, 0x83, 0xb2, 0x3, 0x1d, 0x3, 0x1d, 0x2, 0x1e, 0x2, 0x40, 0x2, 0x1, 0x7, 0x8, 0x1, 0x2, 0xb, 0x3, 0x1, 0x5, 0x1, 0x2d, 0x4, 0x34, 0x1, 0x65, 0x1, 0x76, 0x3, 0x4, 0x2, 0x9, 0x1, 0x6, 0x3, 0x80, 0xdb, 0x2, 0x2, 0x1, 0x3a, 0x1, 0x1, 0x7, 0x1, 0x1, 0x1, 0x1, 0x2, 0x8, 0x6, 0xa, 0x2, 0x1, 0x27, 0x1, 0x58, 0x4, 0x30, 0x1, 0x1, 0x5, 0x1, 0x1, 0x5, 0x1, 0x28, 0x9, 0xc, 0x2, 0x20, 0x4, 0x2, 0x2, 0x1, 0x1, 0x3a, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x3, 0x3a, 0x8, 0x2, 0x2, 0x40, 0x6, 0x52, 0x3, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x37, 0x3f, 0xd, 0x1, 0x22, 0x4c, 0x15, 0x4, 0x81, 0xbd, 0x1, 0x1, 0x3, 0xb, 0x3, 0xd, 0x3, 0xd, 0x3, 0xd, 0x2, 0xc, 0x5, 0x8, 0x2, 0xa, 0x1, 0x2, 0x1, 0x2, 0x5, 0x31, 0x5, 0x1, 0xa, 0x1, 0x1, 0xd, 0x1, 0x10, 0xd, 0x33, 0x21, 0x8b, 0x8b, 0x2, 0x71, 0x3, 0x7d, 0x1, 0xf, 0x1, 0x60, 0x20, 0x2f, 0x1, 0x81, 0xd5, 0x1, 0x24, 0x4, 0x3, 0x5, 0x5, 0x1, 0x5d, 0x6, 0x5d, 0x3, 0xa0, 0x6f, 0x16, 0x1, 0x84, 0xe2, 0x6, 0x81, 0xe, 0x1, 0x62, 0x4, 0x1, 0xa, 0x1, 0x1, 0x1f, 0x1, 0x50, 0x2, 0xe, 0x22, 0x4e, 0x1, 0x17, 0x3, 0x6d, 0x2, 0x8, 0x1, 0x3, 0x1, 0x4, 0x1, 0x19, 0x2, 0x80, 0x9d, 0x1, 0x1b, 0x12, 0x34, 0x8, 0x19, 0xb, 0x2e, 0x3, 0x30, 0x1, 0x2, 0x4, 0x2, 0x1, 0x12, 0x1, 0x59, 0x6, 0x2, 0x2, 0x2, 0x2, 0xc, 0x1, 0x8, 0x1, 0x23, 0x1, 0x3f, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x1b, 0x1, 0xe, 0x2, 0x5, 0x2, 0x1, 0x1, 0x80, 0xee, 0x1, 0x2, 0x1, 0x4, 0x1, 0xa0, 0x4f, 0x30, 0x1, 0x80, 0x93, 0x10, 0x82, 0x3e, 0x10, 0x3, 0x1, 0xc, 0x7, 0x2b, 0x1, 0x2, 0x1, 0x80, 0xa9, 0x1, 0x7, 0x1, 0x6, 0x1, 0xb, 0x1, 0x23, 0x1, 0x1, 0x1, 0x2f, 0x1, 0x2d, 0x2, 0x43, 0x1, 0x15, 0x3, 0x82, 0x1, 0x1, 0x88, 0x3, 0x3, 0x1, 0x2, 0x5, 0x4, 0x28, 0x3, 0x4, 0x1, 0x85, 0xc1, 0x1, 0x36, 0xf, 0x39, 0x2, 0x31, 0x4, 0x2, 0x2, 0x2, 0x1, 0x42, 0x3, 0x24, 0x5, 0x1, 0x8, 0x4b, 0x2, 0x34, 0x9, 0x84, 0xec, 0x1, 0x1, 0x1, 0x2, 0x6, 0x1, 0x1, 0xa0, 0x58, 0xd7, 0x11, 0xa0, 0x61, 0xc7, 0x3, 0x9, 0x10, 0x2, 0x7, 0x1e, 0x4, 0x80, 0x94, 0x3, 0xac, 0x2d, 0xbc, 0x1, 0x1e, 0x60, 0x80, 0x80, 0x80, 0xf0]; -+_T STerm = [0x21, 0x1, 0xc, 0x1, 0x10, 0x1, 0x85, 0x1c, 0x1, 0x1, 0x1, 0x2a, 0x1, 0x80, 0x95, 0x1, 0x80, 0xb4, 0x1, 0x2b, 0x3, 0x80, 0xf6, 0x1, 0x81, 0x6a, 0x2, 0x86, 0xe4, 0x2, 0x83, 0x16, 0x1, 0x4, 0x2, 0x83, 0x5, 0x1, 0x80, 0xc6, 0x2, 0x80, 0xcc, 0x1, 0x5, 0x1, 0x81, 0x3a, 0x2, 0x81, 0x62, 0x4, 0x80, 0xae, 0x2, 0x2, 0x2, 0x80, 0xdb, 0x2, 0x41, 0x2, 0x83, 0xbc, 0x2, 0x9, 0x3, 0x8d, 0xe4, 0x1, 0x81, 0xd3, 0x1, 0xa0, 0x74, 0xfc, 0x1, 0x81, 0xe, 0x2, 0x80, 0xe3, 0x1, 0x3, 0x1, 0x81, 0x7e, 0x2, 0x56, 0x2, 0x5f, 0x1, 0x80, 0x98, 0x2, 0x80, 0x93, 0x3, 0x80, 0x90, 0x2, 0x80, 0xf9, 0x1, 0xa0, 0x52, 0x66, 0x1, 0x3, 0x2, 0x80, 0xa9, 0x1, 0xc, 0x1, 0x10, 0x1, 0x41, 0x1, 0x8a, 0xf4, 0x2, 0x85, 0xef, 0x2, 0x75, 0x4, 0x7f, 0x3, 0x80, 0x81, 0x2]; -+_T Diacritic = [0x5e, 0x1, 0x1, 0x1, 0x47, 0x1, 0x6, 0x1, 0x4, 0x1, 0x2, 0x2, 0x81, 0xf7, 0x80, 0x9f, 0x1, 0x8, 0x5, 0x6, 0x11, 0x2, 0x4, 0x1, 0x9, 0x2, 0x80, 0xfd, 0x5, 0x80, 0xd1, 0x1, 0x37, 0x11, 0x1, 0x1b, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x80, 0x86, 0x8, 0x4, 0x2, 0x80, 0x86, 0x2, 0x4, 0x2, 0x3, 0x3, 0x43, 0x1b, 0x5b, 0xb, 0x3a, 0xb, 0x22, 0x2, 0x80, 0xca, 0x1b, 0x3d, 0x1, 0x10, 0x1, 0x3, 0x4, 0x1c, 0x1, 0x4a, 0x1, 0x10, 0x1, 0x6e, 0x1, 0x10, 0x1, 0x6e, 0x1, 0x10, 0x1, 0x6e, 0x1, 0x10, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x6e, 0x1, 0x10, 0x1, 0x7f, 0x1, 0x7c, 0x1, 0x7c, 0x6, 0x1, 0x1, 0x79, 0x5, 0x4b, 0x2, 0x1b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x2, 0x42, 0x3, 0x1, 0x2, 0x3e, 0x1, 0x70, 0x1, 0x1, 0x2, 0x4c, 0x7, 0x1, 0x1, 0xa, 0x2, 0x87, 0x2d, 0xb, 0x9, 0x1, 0x81, 0x5b, 0x3, 0x81, 0x39, 0x8, 0x2, 0x1, 0x80, 0xb4, 0x1, 0xf, 0x1, 0x26, 0x9, 0x36, 0x2, 0x80, 0x8a, 0x2, 0x40, 0x6, 0x52, 0x19, 0x4, 0x1, 0x6, 0x1, 0x37, 0x3f, 0x59, 0xc, 0x2d, 0x3, 0x81, 0xbd, 0x1, 0x1, 0x3, 0xb, 0x3, 0xd, 0x3, 0xd, 0x3, 0xd, 0x2, 0x8c, 0xf0, 0x3, 0x81, 0x3d, 0x1, 0x81, 0xfa, 0x6, 0x69, 0x4, 0x5f, 0x1, 0xa0, 0x75, 0x72, 0x1, 0xc, 0x2, 0x1, 0x1, 0x70, 0x2, 0x25, 0xb, 0x66, 0x1, 0x6f, 0x2, 0x80, 0xca, 0x1, 0x1b, 0x12, 0x39, 0x4, 0x24, 0x1, 0x5f, 0x1, 0xc, 0x1, 0x80, 0xba, 0x1, 0x43, 0x4, 0x33, 0x1, 0x80, 0xf5, 0x2, 0xa0, 0x4f, 0x30, 0x1, 0x83, 0x1, 0x7, 0x81, 0x17, 0x1, 0x1, 0x1, 0x2f, 0x1, 0x2d, 0x2, 0x43, 0x1, 0x90, 0xd5, 0x2, 0x78, 0x2, 0x80, 0x8b, 0x1, 0x84, 0xf5, 0x2, 0xa0, 0x58, 0xd7, 0x11, 0xa0, 0x61, 0xc7, 0x3, 0x3, 0x6, 0x8, 0x8, 0x2, 0x7, 0x1e, 0x4]; -+_T Lm = [0x82, 0xb0, 0x12, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x80, 0x85, 0x1, 0x5, 0x1, 0x81, 0xde, 0x1, 0x80, 0xe6, 0x1, 0x80, 0xa4, 0x2, 0x81, 0xd, 0x2, 0x4, 0x1, 0x1f, 0x1, 0x9, 0x1, 0x3, 0x1, 0x81, 0x48, 0x1, 0x84, 0xd4, 0x1, 0x7f, 0x1, 0x82, 0x35, 0x1, 0x86, 0xda, 0x1, 0x6b, 0x1, 0x82, 0x63, 0x1, 0x81, 0xd0, 0x6, 0x80, 0xae, 0x3f, 0xd, 0x1, 0x22, 0x25, 0x82, 0xb1, 0x1, 0xd, 0x1, 0x10, 0xd, 0x8b, 0xdf, 0x2, 0x80, 0xf1, 0x1, 0x80, 0xbf, 0x1, 0x81, 0xd5, 0x1, 0x2b, 0x5, 0x5, 0x1, 0x61, 0x2, 0x5d, 0x3, 0xa0, 0x6f, 0x16, 0x1, 0x84, 0xe2, 0x6, 0x81, 0xe, 0x1, 0x72, 0x1, 0x80, 0x97, 0x9, 0x50, 0x1, 0x17, 0x1, 0x6f, 0x2, 0x81, 0xd5, 0x1, 0x80, 0xa0, 0x1, 0x6c, 0x1, 0x15, 0x2, 0xa0, 0x54, 0x7b, 0x1, 0x2d, 0x2, 0xa0, 0x6f, 0xf3, 0xd]; -+_T Mc = [0x89, 0x3, 0x1, 0x37, 0x1, 0x2, 0x3, 0x8, 0x4, 0x1, 0x2, 0x32, 0x2, 0x3a, 0x3, 0x6, 0x2, 0x2, 0x2, 0xa, 0x1, 0x2b, 0x1, 0x3a, 0x3, 0x42, 0x1, 0x3a, 0x3, 0x8, 0x1, 0x1, 0x2, 0x35, 0x2, 0x3a, 0x1, 0x1, 0x1, 0x6, 0x2, 0x2, 0x2, 0xa, 0x1, 0x66, 0x2, 0x1, 0x2, 0x3, 0x3, 0x1, 0x3, 0xa, 0x1, 0x29, 0x3, 0x3d, 0x4, 0x3d, 0x2, 0x3a, 0x1, 0x1, 0x5, 0x2, 0x2, 0x1, 0x2, 0x9, 0x2, 0x2b, 0x2, 0x3a, 0x3, 0x5, 0x3, 0x1, 0x3, 0xa, 0x1, 0x2a, 0x2, 0x4b, 0x3, 0x6, 0x8, 0x12, 0x2, 0x81, 0x4a, 0x2, 0x3f, 0x1, 0x80, 0xab, 0x2, 0x4, 0x1, 0x6, 0x1, 0x2, 0x2, 0x19, 0x2, 0xa, 0x3, 0x2, 0x7, 0x15, 0x2, 0x2, 0x6, 0x2, 0x1, 0xa, 0x3, 0x87, 0x19, 0x1, 0x7, 0x8, 0x1, 0x2, 0x81, 0x5a, 0x4, 0x2, 0x3, 0x4, 0x2, 0x1, 0x6, 0x77, 0x11, 0x7, 0x2, 0x4f, 0x2, 0x3a, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x2, 0x8, 0x6, 0x80, 0x91, 0x1, 0x30, 0x1, 0x5, 0x1, 0x1, 0x5, 0x1, 0x2, 0x3d, 0x1, 0x1e, 0x1, 0x4, 0x2, 0x2, 0x1, 0x1, 0x2, 0x39, 0x1, 0x2, 0x3, 0x1, 0x1, 0x3, 0x2, 0x30, 0x8, 0x8, 0x2, 0x80, 0xab, 0x1, 0x10, 0x2, 0x93, 0x3a, 0x2, 0xa0, 0x77, 0xf3, 0x2, 0x2, 0x1, 0x58, 0x2, 0x32, 0x10, 0x80, 0x8e, 0x2, 0x2f, 0x1, 0x30, 0x2, 0x4, 0x2, 0x1, 0x4, 0x6e, 0x2, 0x2, 0x2, 0x18, 0x1, 0x2d, 0x1, 0x6f, 0x1, 0x2, 0x2, 0x5, 0x1, 0x80, 0xed, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0xa0, 0x64, 0x13, 0x1, 0x1, 0x1, 0x7f, 0x1, 0x2d, 0x3, 0x4, 0x2, 0x73, 0x1, 0x55, 0x1, 0x30, 0x3, 0x9, 0x2, 0x84, 0xeb, 0x1, 0x1, 0x2, 0x6, 0x1, 0xa0, 0x58, 0x9a, 0x2e, 0xa0, 0x61, 0xe6, 0x2, 0x6, 0x6]; -+_T Lo = [0x80, 0xaa, 0x1, 0xf, 0x1, 0x81, 0x0, 0x1, 0x4, 0x4, 0x80, 0xd0, 0x1, 0x83, 0x3b, 0x1b, 0x5, 0x3, 0x2d, 0x20, 0x1, 0xa, 0x23, 0x2, 0x1, 0x63, 0x1, 0x1, 0x18, 0x2, 0xa, 0x3, 0x2, 0x1, 0x10, 0x1, 0x1, 0x1e, 0x1d, 0x59, 0xb, 0x1, 0x18, 0x21, 0x15, 0x16, 0x2a, 0x19, 0x47, 0x1, 0x1, 0xb, 0x57, 0x36, 0x3, 0x1, 0x12, 0x1, 0x7, 0xa, 0x10, 0x6, 0x1, 0x7, 0x5, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x3, 0x1, 0x10, 0x1, 0xd, 0x2, 0x1, 0x3, 0xe, 0x2, 0x13, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1f, 0x4, 0x1, 0x1, 0x13, 0x3, 0x10, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x12, 0x1, 0xf, 0x2, 0x23, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x1e, 0x2, 0x1, 0x3, 0xf, 0x1, 0x11, 0x1, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x16, 0x1, 0x34, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x1a, 0x2, 0x6, 0x2, 0x23, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x20, 0x1, 0x1, 0x2, 0xf, 0x2, 0x12, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x1, 0x10, 0x1, 0x11, 0x2, 0x18, 0x6, 0x5, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3a, 0x30, 0x1, 0x2, 0xc, 0x6, 0x3b, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, 0x1, 0x2, 0x9, 0x1, 0x2, 0x5, 0x17, 0x4, 0x20, 0x1, 0x3f, 0x8, 0x1, 0x24, 0x1b, 0x5, 0x73, 0x2b, 0x14, 0x1, 0x10, 0x6, 0x4, 0x4, 0x3, 0x1, 0x3, 0x2, 0x7, 0x3, 0x4, 0xd, 0xc, 0x1, 0x41, 0x2b, 0x2, 0x81, 0x4c, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x25, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x15, 0xd, 0x1, 0x4, 0xe, 0x12, 0xe, 0x12, 0xe, 0xd, 0x1, 0x3, 0xf, 0x34, 0x28, 0x1, 0x43, 0x23, 0x1, 0x34, 0x8, 0x29, 0x1, 0x1, 0x5, 0x46, 0xa, 0x1d, 0x33, 0x1e, 0x2, 0x5, 0xb, 0x2c, 0x15, 0x7, 0x38, 0x17, 0x9, 0x35, 0x80, 0xb0, 0x2f, 0x11, 0x7, 0x37, 0x1e, 0xd, 0x2, 0xa, 0x2c, 0x1a, 0x24, 0x29, 0x3, 0xa, 0x1e, 0x71, 0x4, 0x1, 0x4, 0x3, 0x2, 0x84, 0x3e, 0x4, 0x8b, 0xf7, 0x38, 0x18, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x82, 0x27, 0x1, 0x35, 0x1, 0x4, 0x56, 0x8, 0x1, 0x1, 0x5a, 0x4, 0x1, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x15, 0x1, 0x84, 0x77, 0x43, 0x28, 0x8, 0x81, 0xc, 0x4, 0x10, 0xa, 0x2, 0x42, 0x1, 0x31, 0x46, 0x81, 0x15, 0x7, 0x1, 0x3, 0x1, 0x4, 0x1, 0x17, 0x1d, 0x34, 0xe, 0x32, 0x3e, 0x6, 0x3, 0x1, 0xe, 0x1c, 0xa, 0x17, 0x19, 0x1d, 0x7, 0x2f, 0x4d, 0x29, 0x17, 0x3, 0x1, 0x8, 0x14, 0x10, 0x1, 0x6, 0x3, 0x1, 0x5, 0x30, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x1, 0x18, 0x2, 0x3, 0xb, 0x7, 0x1, 0xe, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x23, 0x1d, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x43, 0x1, 0x1, 0xa, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x81, 0x6b, 0x12, 0x40, 0x2, 0x36, 0x28, 0xc, 0x74, 0x5, 0x1, 0x80, 0x87, 0x69, 0xa, 0x1, 0x2d, 0x2, 0x1f, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x81, 0x85, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x11, 0x1, 0x8, 0x36, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x80, 0x80, 0x4e, 0x83, 0x62, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x1, 0xf, 0x4, 0x1, 0x3, 0x1, 0x1b, 0x2c, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xba, 0x35, 0x4b, 0x2d, 0x20, 0x19, 0x1a, 0x24, 0x5c, 0x30, 0xe, 0x4, 0x84, 0xbb, 0x2b, 0x89, 0x55, 0x83, 0x6f, 0x8c, 0x91, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x1, 0xa0, 0x40, 0xaf, 0x2, 0xa0, 0x3d, 0xfe, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Me = [0x84, 0x88, 0x2, 0x9c, 0x53, 0x4, 0x1, 0x3, 0xa0, 0x85, 0x8b, 0x3]; -+_T ID_Start = [0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x4, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xca, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x80, 0x81, 0x5, 0x1, 0x2, 0x2, 0x4, 0x8, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x8, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x1, 0x7, 0x27, 0x48, 0x1b, 0x5, 0x3, 0x2d, 0x2b, 0x23, 0x2, 0x1, 0x63, 0x1, 0x1, 0xf, 0x2, 0x7, 0x2, 0xa, 0x3, 0x2, 0x1, 0x10, 0x1, 0x1, 0x1e, 0x1d, 0x59, 0xb, 0x1, 0x18, 0x21, 0x9, 0x2, 0x4, 0x1, 0x5, 0x16, 0x4, 0x1, 0x9, 0x1, 0x3, 0x1, 0x17, 0x19, 0x47, 0x1, 0x1, 0xb, 0x57, 0x36, 0x3, 0x1, 0x12, 0x1, 0x7, 0xa, 0xf, 0x7, 0x1, 0x7, 0x5, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x3, 0x1, 0x10, 0x1, 0xd, 0x2, 0x1, 0x3, 0xe, 0x2, 0x13, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1f, 0x4, 0x1, 0x1, 0x13, 0x3, 0x10, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x12, 0x1, 0xf, 0x2, 0x23, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x3, 0x1, 0x1e, 0x2, 0x1, 0x3, 0xf, 0x1, 0x11, 0x1, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x16, 0x1, 0x34, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x1a, 0x2, 0x6, 0x2, 0x23, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x1, 0x20, 0x1, 0x1, 0x2, 0xf, 0x2, 0x12, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x1, 0x10, 0x1, 0x11, 0x2, 0x18, 0x6, 0x5, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3a, 0x30, 0x1, 0x2, 0xc, 0x7, 0x3a, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x4, 0x1, 0x2, 0x9, 0x1, 0x2, 0x5, 0x1, 0x1, 0x15, 0x4, 0x20, 0x1, 0x3f, 0x8, 0x1, 0x24, 0x1b, 0x5, 0x73, 0x2b, 0x14, 0x1, 0x10, 0x6, 0x4, 0x4, 0x3, 0x1, 0x3, 0x2, 0x7, 0x3, 0x4, 0xd, 0xc, 0x1, 0x11, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x81, 0x4d, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x25, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x3, 0x3, 0xf, 0xd, 0x1, 0x4, 0xe, 0x12, 0xe, 0x12, 0xe, 0xd, 0x1, 0x3, 0xf, 0x34, 0x23, 0x1, 0x4, 0x1, 0x43, 0x58, 0x8, 0x29, 0x1, 0x1, 0x5, 0x46, 0xa, 0x1d, 0x33, 0x1e, 0x2, 0x5, 0xb, 0x2c, 0x15, 0x7, 0x38, 0x17, 0x9, 0x35, 0x52, 0x1, 0x5d, 0x2f, 0x11, 0x7, 0x37, 0x1e, 0xd, 0x2, 0xa, 0x2c, 0x1a, 0x24, 0x29, 0x3, 0xa, 0x24, 0x6b, 0x4, 0x1, 0x4, 0x3, 0x2, 0x9, 0x80, 0xc0, 0x40, 0x81, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x74, 0x1, 0xd, 0x1, 0x10, 0xd, 0x65, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x29, 0x8a, 0x77, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x4, 0x3, 0x2, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x1, 0x10, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x82, 0x26, 0x3, 0x19, 0x9, 0x7, 0x5, 0x2, 0x5, 0x4, 0x56, 0x4, 0x5, 0x1, 0x5a, 0x1, 0x4, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x84, 0x8d, 0x43, 0x2e, 0x2, 0x81, 0xd, 0x3, 0x10, 0xa, 0x2, 0x14, 0x2f, 0x10, 0x19, 0x8, 0x50, 0x27, 0x9, 0x2, 0x67, 0x2, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0xa, 0x1, 0x3, 0x1, 0x4, 0x1, 0x17, 0x1d, 0x34, 0xe, 0x32, 0x3e, 0x6, 0x3, 0x1, 0xe, 0x1c, 0xa, 0x17, 0x19, 0x1d, 0x7, 0x2f, 0x1c, 0x1, 0x30, 0x29, 0x17, 0x3, 0x1, 0x8, 0x14, 0x17, 0x3, 0x1, 0x5, 0x30, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x1, 0x18, 0x3, 0x2, 0xb, 0x7, 0x3, 0xc, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x23, 0x1d, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0x1, 0x1, 0xa, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x81, 0x6b, 0x12, 0x40, 0x2, 0x36, 0x28, 0xc, 0x74, 0x5, 0x1, 0x80, 0x87, 0x24, 0x1a, 0x6, 0x1a, 0xb, 0x59, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x45, 0x35, 0x81, 0xb, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x1b, 0x35, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x1, 0x5, 0x2a, 0x80, 0x9e, 0x83, 0x62, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x1, 0xf, 0x4, 0x1, 0x3, 0x1, 0x1b, 0x2c, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xba, 0x35, 0x4b, 0x2d, 0x20, 0x19, 0x1a, 0x24, 0x5c, 0x30, 0xe, 0x4, 0x84, 0xbb, 0x2b, 0x89, 0x55, 0x83, 0x6f, 0x80, 0x91, 0x63, 0x8b, 0x9d, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x1, 0x42, 0xd, 0xa0, 0x40, 0x60, 0x2, 0xa0, 0x23, 0xfe, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x96, 0x34, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Other_Grapheme_Extend = [0x89, 0xbe, 0x1, 0x18, 0x1, 0x81, 0x66, 0x1, 0x18, 0x1, 0x66, 0x1, 0x18, 0x1, 0x80, 0xea, 0x1, 0x12, 0x2, 0x67, 0x1, 0x18, 0x1, 0x77, 0x1, 0xf, 0x1, 0x92, 0x2c, 0x2, 0x90, 0x20, 0x2, 0xa0, 0xcf, 0x6e, 0x2, 0xa0, 0xd1, 0xc5, 0x1, 0x8, 0x5]; -+_T Lt = [0x81, 0xc5, 0x1, 0x2, 0x1, 0x2, 0x1, 0x26, 0x1, 0x9d, 0x95, 0x8, 0x8, 0x8, 0x8, 0x8, 0xc, 0x1, 0xf, 0x1, 0x2f, 0x1]; -+_T Pattern_White_Space = [0x9, 0x5, 0x12, 0x1, 0x64, 0x1, 0x9f, 0x88, 0x2, 0x18, 0x2]; -+_T Cased = [0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x4, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x80, 0xc3, 0x1, 0x4, 0x4, 0x80, 0xd0, 0x1, 0x24, 0x7, 0x2, 0x1e, 0x5, 0x60, 0x1, 0x2a, 0x4, 0x2, 0x2, 0x2, 0x4, 0x8, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x8, 0x80, 0x9e, 0x9, 0x26, 0xa, 0x27, 0x8b, 0x18, 0x26, 0x1, 0x1, 0x5, 0x1, 0x8c, 0x32, 0x80, 0xc0, 0x40, 0x81, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x74, 0x1, 0xd, 0x1, 0x10, 0xd, 0x65, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x3, 0x5, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x6, 0x4, 0x1, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x20, 0x3, 0x2, 0x83, 0x31, 0x34, 0x87, 0x16, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x4, 0x3, 0x2, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0xa0, 0x79, 0x12, 0x2e, 0x12, 0x18, 0x80, 0x8a, 0x66, 0x3, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0x3, 0xa0, 0x53, 0x5, 0x7, 0xc, 0x5, 0x84, 0x9, 0x1a, 0x6, 0x1a, 0x84, 0xa5, 0x50, 0xa0, 0xcf, 0xb0, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8]; -+_T Mn = [0x83, 0x0, 0x70, 0x81, 0x13, 0x5, 0x81, 0x9, 0x2d, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x48, 0xb, 0x30, 0x15, 0x10, 0x1, 0x65, 0x7, 0x2, 0x6, 0x2, 0x2, 0x1, 0x4, 0x23, 0x1, 0x1e, 0x1b, 0x5b, 0xb, 0x3a, 0x9, 0x22, 0x4, 0x1, 0x9, 0x1, 0x3, 0x1, 0x5, 0x2b, 0x3, 0x80, 0x88, 0x1b, 0x1, 0x3, 0x37, 0x1, 0x1, 0x1, 0x4, 0x8, 0x4, 0x1, 0x3, 0x7, 0xa, 0x2, 0x1d, 0x1, 0x3a, 0x1, 0x4, 0x4, 0x8, 0x1, 0x14, 0x2, 0x1d, 0x2, 0x39, 0x1, 0x4, 0x2, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x1e, 0x2, 0x3, 0x1, 0xb, 0x2, 0x39, 0x1, 0x4, 0x5, 0x1, 0x2, 0x4, 0x1, 0x14, 0x2, 0x1d, 0x1, 0x3a, 0x1, 0x2, 0x1, 0x1, 0x4, 0x8, 0x1, 0x8, 0x1, 0xb, 0x2, 0x1e, 0x1, 0x3d, 0x1, 0xc, 0x1, 0x70, 0x3, 0x5, 0x3, 0x1, 0x4, 0x7, 0x2, 0xb, 0x2, 0x58, 0x1, 0x2, 0x1, 0x6, 0x1, 0x5, 0x2, 0x14, 0x2, 0x5d, 0x4, 0x8, 0x1, 0x14, 0x2, 0x66, 0x1, 0x7, 0x3, 0x1, 0x1, 0x5a, 0x1, 0x2, 0x7, 0xc, 0x8, 0x62, 0x1, 0x2, 0x6, 0x1, 0x2, 0xb, 0x6, 0x4a, 0x2, 0x1b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x37, 0xe, 0x1, 0x5, 0x1, 0x2, 0x5, 0xb, 0x1, 0x24, 0x9, 0x1, 0x66, 0x4, 0x1, 0x6, 0x1, 0x2, 0x2, 0x2, 0x19, 0x2, 0x4, 0x3, 0x10, 0x4, 0xd, 0x1, 0x2, 0x2, 0x6, 0x1, 0xf, 0x1, 0x82, 0xbf, 0x3, 0x83, 0xb2, 0x3, 0x1d, 0x3, 0x1d, 0x2, 0x1e, 0x2, 0x40, 0x2, 0x1, 0x7, 0x8, 0x1, 0x2, 0xb, 0x9, 0x1, 0x2d, 0x3, 0x80, 0x9b, 0x1, 0x76, 0x3, 0x4, 0x2, 0x9, 0x1, 0x6, 0x3, 0x80, 0xdb, 0x2, 0x2, 0x1, 0x3a, 0x1, 0x1, 0x7, 0x1, 0x1, 0x1, 0x1, 0x2, 0x8, 0x6, 0xa, 0x2, 0x1, 0x80, 0x80, 0x4, 0x30, 0x1, 0x1, 0x5, 0x1, 0x1, 0x5, 0x1, 0x28, 0x9, 0xc, 0x2, 0x20, 0x4, 0x2, 0x2, 0x1, 0x1, 0x3a, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x3, 0x3a, 0x8, 0x2, 0x2, 0x80, 0x98, 0x3, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x80, 0xcb, 0x27, 0x15, 0x4, 0x82, 0xd0, 0xd, 0x4, 0x1, 0x3, 0xc, 0x8b, 0xfe, 0x3, 0x80, 0x8d, 0x1, 0x60, 0x20, 0x82, 0x2a, 0x4, 0x6b, 0x2, 0xa0, 0x75, 0xd4, 0x1, 0x4, 0xa, 0x21, 0x1, 0x50, 0x2, 0x81, 0x10, 0x1, 0x3, 0x1, 0x4, 0x1, 0x19, 0x2, 0x80, 0x9d, 0x1, 0x1b, 0x12, 0x34, 0x8, 0x19, 0xb, 0x2e, 0x3, 0x30, 0x1, 0x2, 0x4, 0x2, 0x1, 0x6c, 0x6, 0x2, 0x2, 0x2, 0x2, 0xc, 0x1, 0x8, 0x1, 0x63, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x2a, 0x2, 0x8, 0x1, 0x80, 0xee, 0x1, 0x2, 0x1, 0x4, 0x1, 0xa0, 0x4f, 0x30, 0x1, 0x82, 0xe1, 0x10, 0x10, 0x7, 0x83, 0xd6, 0x1, 0x88, 0x3, 0x3, 0x1, 0x2, 0x5, 0x4, 0x28, 0x3, 0x4, 0x1, 0x85, 0xc1, 0x1, 0x36, 0xf, 0x39, 0x2, 0x31, 0x4, 0x2, 0x2, 0x45, 0x3, 0x24, 0x5, 0x1, 0x8, 0x4b, 0x2, 0x34, 0x9, 0x84, 0xec, 0x1, 0x1, 0x1, 0x2, 0x6, 0x1, 0x1, 0xa0, 0x58, 0xd7, 0x4, 0xa0, 0x61, 0xd4, 0x3, 0x11, 0x8, 0x2, 0x7, 0x1e, 0x4, 0x80, 0x94, 0x3, 0xac, 0x2e, 0xbb, 0x80, 0xf0]; -+_T Dash = [0x2d, 0x1, 0x85, 0x5c, 0x1, 0x33, 0x1, 0x8e, 0x41, 0x1, 0x84, 0x5, 0x1, 0x88, 0x9, 0x6, 0x3d, 0x1, 0x27, 0x1, 0xf, 0x1, 0x81, 0x86, 0x1, 0x8c, 0x4, 0x1, 0x2, 0x1, 0x1f, 0x2, 0x81, 0xe0, 0x1, 0x13, 0x1, 0x6f, 0x1, 0xa0, 0xcd, 0x90, 0x2, 0x25, 0x1, 0xa, 0x1, 0x80, 0xa9, 0x1]; -+_T ID_Continue = [0x30, 0xa, 0x7, 0x1a, 0x4, 0x1, 0x1, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x1, 0x1, 0x2, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xca, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x11, 0x75, 0x1, 0x2, 0x2, 0x4, 0x8, 0x5, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x1, 0x5, 0x2, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x1, 0x7, 0x27, 0x9, 0x2d, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x8, 0x1b, 0x5, 0x3, 0x1d, 0xb, 0x5, 0x4a, 0x4, 0x66, 0x1, 0x8, 0x2, 0xa, 0x1, 0x13, 0x2, 0x1, 0x10, 0x3b, 0x2, 0x65, 0xe, 0x36, 0x4, 0x1, 0x5, 0x2e, 0x12, 0x1c, 0x44, 0x1, 0x1, 0xb, 0x37, 0x1b, 0x1, 0x64, 0x2, 0xa, 0x1, 0x7, 0x1, 0x7, 0x1, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x2, 0x9, 0x2, 0x2, 0x2, 0x4, 0x8, 0x1, 0x4, 0x2, 0x1, 0x5, 0x2, 0xc, 0xf, 0x3, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x5, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x7, 0x4, 0x1, 0x1, 0x7, 0x10, 0xb, 0x3, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x3, 0x1, 0x3, 0x2, 0x1, 0xf, 0x4, 0x2, 0xa, 0x11, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0x9, 0x2, 0x2, 0x2, 0x3, 0x8, 0x2, 0x4, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x1, 0x10, 0x2, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x4, 0x5, 0x3, 0x3, 0x1, 0x4, 0x2, 0x1, 0x6, 0x1, 0xe, 0xa, 0x11, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x1, 0x2, 0x6, 0x4, 0x2, 0xa, 0x12, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x2, 0x9, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x7, 0x1, 0x1, 0x4, 0x2, 0xa, 0x1, 0x2, 0xf, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x8, 0x1, 0x3, 0x1, 0x5, 0x8, 0x1, 0x8, 0x4, 0x2, 0xa, 0xa, 0x6, 0x2, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x2, 0xd, 0x3a, 0x5, 0xf, 0x1, 0xa, 0x27, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0xd, 0x1, 0x3, 0x2, 0x5, 0x1, 0x1, 0x1, 0x6, 0x2, 0xa, 0x2, 0x4, 0x20, 0x1, 0x17, 0x2, 0x6, 0xa, 0xb, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0xa, 0x1, 0x24, 0x4, 0x14, 0x1, 0x12, 0x1, 0x24, 0x9, 0x1, 0x39, 0x4a, 0x6, 0x4e, 0x2, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x81, 0x4d, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x2, 0x3, 0x9, 0x9, 0xe, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x3, 0x3, 0xf, 0xd, 0x1, 0x7, 0xb, 0x15, 0xb, 0x14, 0xc, 0xd, 0x1, 0x3, 0x1, 0x2, 0xc, 0x54, 0x3, 0x1, 0x4, 0x2, 0x2, 0xa, 0x21, 0x3, 0x2, 0xa, 0x6, 0x58, 0x8, 0x2b, 0x5, 0x46, 0xa, 0x1d, 0x3, 0xc, 0x4, 0xc, 0xa, 0x28, 0x2, 0x5, 0xb, 0x2c, 0x4, 0x1a, 0x6, 0xb, 0x25, 0x1c, 0x4, 0x3f, 0x1, 0x1d, 0x2, 0xb, 0x6, 0xa, 0xd, 0x1, 0x58, 0x4c, 0x4, 0xa, 0x11, 0x9, 0xc, 0x74, 0xc, 0x38, 0x8, 0xa, 0x3, 0x31, 0x52, 0x3, 0x1, 0x23, 0x9, 0x80, 0xe7, 0x15, 0x81, 0x1a, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x42, 0x2, 0x13, 0x1, 0x1c, 0x1, 0xd, 0x1, 0x10, 0xd, 0x33, 0xd, 0x4, 0x1, 0x3, 0xc, 0x11, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x29, 0x8a, 0x77, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x9, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x1, 0xf, 0x18, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x20, 0x82, 0x5, 0x3, 0x19, 0xf, 0x1, 0x5, 0x2, 0x5, 0x4, 0x56, 0x2, 0x7, 0x1, 0x5a, 0x1, 0x4, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x84, 0x8d, 0x43, 0x2e, 0x2, 0x81, 0xd, 0x3, 0x1c, 0x14, 0x30, 0x4, 0xa, 0x1, 0x19, 0x7, 0x53, 0x25, 0x9, 0x2, 0x67, 0x2, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0x30, 0x18, 0x34, 0xc, 0x45, 0xb, 0xa, 0x6, 0x18, 0x3, 0x1, 0x4, 0x2e, 0x2, 0x24, 0xc, 0x1d, 0x3, 0x41, 0xe, 0xb, 0x26, 0x37, 0x9, 0xe, 0x2, 0xa, 0x6, 0x17, 0x3, 0x2, 0x4, 0x43, 0x18, 0x3, 0x2, 0x10, 0x2, 0x5, 0xa, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x2b, 0x1, 0x2, 0x2, 0xa, 0x6, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0xc, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x81, 0x6b, 0x12, 0x40, 0x2, 0x36, 0x28, 0xc, 0x4, 0x10, 0x10, 0x7, 0xc, 0x2, 0x18, 0x3, 0x20, 0x5, 0x1, 0x80, 0x87, 0x13, 0xa, 0x7, 0x1a, 0x4, 0x1, 0x1, 0x1a, 0xb, 0x59, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x45, 0x35, 0x80, 0x88, 0x1, 0x80, 0x82, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x1b, 0x35, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x1, 0x5, 0x2a, 0x80, 0x9e, 0x2, 0xa, 0x83, 0x56, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x4, 0x1, 0x2, 0x5, 0x8, 0x1, 0x3, 0x1, 0x1b, 0x4, 0x3, 0x4, 0x1, 0x20, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xb7, 0x47, 0x1f, 0xa, 0x10, 0x3b, 0x15, 0x19, 0x7, 0xa, 0x6, 0x35, 0x1, 0xa, 0x40, 0x45, 0xb, 0xa, 0x84, 0xa6, 0x38, 0x8, 0xa, 0x89, 0x36, 0x83, 0x6f, 0x80, 0x91, 0x63, 0x8b, 0x9d, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x2f, 0x10, 0x11, 0xa0, 0x40, 0x60, 0x2, 0xa0, 0x21, 0x63, 0x5, 0x3, 0x6, 0x8, 0x8, 0x2, 0x7, 0x1e, 0x4, 0x80, 0x94, 0x3, 0x81, 0xbb, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e, 0xab, 0x6, 0xe2, 0x80, 0xf0]; -+_T White_Space = [0x9, 0x5, 0x12, 0x1, 0x64, 0x1, 0x1a, 0x1, 0x95, 0xdf, 0x1, 0x89, 0x7f, 0xb, 0x1d, 0x2, 0x5, 0x1, 0x2f, 0x1, 0x8f, 0xa0, 0x1]; -+_T Grapheme_Link = [0x89, 0x4d, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7f, 0x1, 0x7c, 0x1, 0x6f, 0x1, 0x81, 0x49, 0x1, 0x80, 0xb4, 0x2, 0x86, 0xd9, 0x1, 0x1f, 0x1, 0x80, 0x9d, 0x1, 0x82, 0x8d, 0x1, 0x80, 0xe3, 0x1, 0x65, 0x2, 0x46, 0x2, 0x91, 0x8b, 0x1, 0xa0, 0x7a, 0x86, 0x1, 0x80, 0xbd, 0x1, 0x80, 0x8e, 0x1, 0x6c, 0x1, 0x81, 0x35, 0x1, 0x80, 0xf6, 0x1, 0xa0, 0x5e, 0x51, 0x1, 0x86, 0x6, 0x1, 0x72, 0x1, 0x79, 0x2, 0x80, 0x8b, 0x1, 0x84, 0xf5, 0x1]; -+_T Ll = [0x61, 0x1a, 0x3a, 0x1, 0x29, 0x18, 0x1, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x3, 0x2, 0x4, 0x1, 0x2, 0x1, 0x3, 0x3, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x3, 0x6, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x45, 0x1, 0x1b, 0x80, 0xc1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x3, 0x3, 0x12, 0x1, 0x1b, 0x23, 0x1, 0x2, 0x3, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x5, 0x1, 0x1, 0x2, 0x1, 0x2, 0x2, 0x33, 0x30, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x39, 0x27, 0x97, 0x78, 0x2c, 0x3f, 0xd, 0x1, 0x22, 0x66, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0xe, 0x2, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x5, 0x1, 0x2, 0x6, 0x1, 0x3, 0x3, 0x1, 0x2, 0x8, 0x4, 0x2, 0x2, 0x8, 0x8, 0xa, 0x3, 0x1, 0x2, 0x81, 0x12, 0x1, 0x3, 0x2, 0x3, 0x1, 0x1b, 0x1, 0x4, 0x1, 0x4, 0x1, 0x2, 0x2, 0x8, 0x4, 0x4, 0x1, 0x35, 0x1, 0x8a, 0xab, 0x2f, 0x2, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x6, 0x5, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x1, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0xa0, 0x79, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0x8b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x8, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0xd, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x50, 0x1, 0xa0, 0x53, 0x5, 0x7, 0xc, 0x5, 0x84, 0x29, 0x1a, 0x84, 0xcd, 0x28, 0xa0, 0xcf, 0xca, 0x1a, 0x1a, 0x7, 0x1, 0x12, 0x1a, 0x1a, 0x1a, 0x4, 0x1, 0x1, 0x1, 0x7, 0x1, 0xb, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1c, 0x1c, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1, 0x1]; -+_T Cc = [0x0, 0x20, 0x5f, 0x21]; -+_T Pattern_Syntax = [0x21, 0xf, 0xa, 0x7, 0x1a, 0x4, 0x1, 0x1, 0x1a, 0x4, 0x22, 0x7, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x2, 0x4, 0x1, 0x4, 0x1, 0x3, 0x1, 0x17, 0x1, 0x1f, 0x1, 0x9f, 0x18, 0x18, 0x8, 0xf, 0x2, 0x13, 0x1, 0xa, 0x81, 0x31, 0x82, 0xd0, 0x80, 0xa0, 0x82, 0x76, 0x1e, 0x84, 0x6c, 0x82, 0x0, 0x80, 0x80, 0x81, 0x81, 0x3, 0x4, 0x19, 0xf, 0x1, 0xa0, 0xcd, 0xd, 0x2, 0x81, 0x5, 0x2]; -+_T XID_Continue = [0x30, 0xa, 0x7, 0x1a, 0x4, 0x1, 0x1, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x1, 0x1, 0x2, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xca, 0x4, 0xc, 0xe, 0x5, 0x7, 0x1, 0x1, 0x1, 0x11, 0x75, 0x1, 0x2, 0x3, 0x3, 0x8, 0x5, 0x1, 0x1, 0x1, 0x14, 0x1, 0x53, 0x1, 0x80, 0x8b, 0x1, 0x5, 0x2, 0x80, 0x9e, 0x9, 0x26, 0x2, 0x1, 0x7, 0x27, 0x9, 0x2d, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x8, 0x1b, 0x5, 0x3, 0x1d, 0xb, 0x5, 0x4a, 0x4, 0x66, 0x1, 0x8, 0x2, 0xa, 0x1, 0x13, 0x2, 0x1, 0x10, 0x3b, 0x2, 0x65, 0xe, 0x36, 0x4, 0x1, 0x5, 0x2e, 0x12, 0x1c, 0x44, 0x1, 0x1, 0xb, 0x37, 0x1b, 0x1, 0x64, 0x2, 0xa, 0x1, 0x7, 0x1, 0x7, 0x1, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x2, 0x9, 0x2, 0x2, 0x2, 0x4, 0x8, 0x1, 0x4, 0x2, 0x1, 0x5, 0x2, 0xc, 0xf, 0x3, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x5, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x7, 0x4, 0x1, 0x1, 0x7, 0x10, 0xb, 0x3, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x3, 0x1, 0x3, 0x2, 0x1, 0xf, 0x4, 0x2, 0xa, 0x11, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0x9, 0x2, 0x2, 0x2, 0x3, 0x8, 0x2, 0x4, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x1, 0x10, 0x2, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x4, 0x5, 0x3, 0x3, 0x1, 0x4, 0x2, 0x1, 0x6, 0x1, 0xe, 0xa, 0x11, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x1, 0x2, 0x6, 0x4, 0x2, 0xa, 0x12, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x2, 0x9, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x7, 0x1, 0x1, 0x4, 0x2, 0xa, 0x1, 0x2, 0xf, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x8, 0x1, 0x3, 0x1, 0x5, 0x8, 0x1, 0x8, 0x4, 0x2, 0xa, 0xa, 0x6, 0x2, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x2, 0xd, 0x3a, 0x5, 0xf, 0x1, 0xa, 0x27, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0xd, 0x1, 0x3, 0x2, 0x5, 0x1, 0x1, 0x1, 0x6, 0x2, 0xa, 0x2, 0x4, 0x20, 0x1, 0x17, 0x2, 0x6, 0xa, 0xb, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0xa, 0x1, 0x24, 0x4, 0x14, 0x1, 0x12, 0x1, 0x24, 0x9, 0x1, 0x39, 0x4a, 0x6, 0x4e, 0x2, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x81, 0x4d, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x2, 0x3, 0x9, 0x9, 0xe, 0x10, 0x10, 0x55, 0xc, 0x82, 0x6c, 0x2, 0x11, 0x1, 0x1a, 0x5, 0x4b, 0x3, 0x3, 0xf, 0xd, 0x1, 0x7, 0xb, 0x15, 0xb, 0x14, 0xc, 0xd, 0x1, 0x3, 0x1, 0x2, 0xc, 0x54, 0x3, 0x1, 0x4, 0x2, 0x2, 0xa, 0x21, 0x3, 0x2, 0xa, 0x6, 0x58, 0x8, 0x2b, 0x5, 0x46, 0xa, 0x1d, 0x3, 0xc, 0x4, 0xc, 0xa, 0x28, 0x2, 0x5, 0xb, 0x2c, 0x4, 0x1a, 0x6, 0xb, 0x25, 0x1c, 0x4, 0x3f, 0x1, 0x1d, 0x2, 0xb, 0x6, 0xa, 0xd, 0x1, 0x58, 0x4c, 0x4, 0xa, 0x11, 0x9, 0xc, 0x74, 0xc, 0x38, 0x8, 0xa, 0x3, 0x31, 0x52, 0x3, 0x1, 0x23, 0x9, 0x80, 0xe7, 0x15, 0x81, 0x1a, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0x7, 0x1, 0x1, 0x3, 0x3, 0x1, 0x7, 0x3, 0x4, 0x2, 0x6, 0x4, 0xd, 0x5, 0x3, 0x1, 0x7, 0x42, 0x2, 0x13, 0x1, 0x1c, 0x1, 0xd, 0x1, 0x10, 0xd, 0x33, 0xd, 0x4, 0x1, 0x3, 0xc, 0x11, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x2, 0x6, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x10, 0x2, 0x4, 0x5, 0x5, 0x4, 0x1, 0x11, 0x29, 0x8a, 0x77, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x85, 0x6, 0x9, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x1, 0xf, 0x18, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x20, 0x82, 0x5, 0x3, 0x19, 0xf, 0x1, 0x5, 0x2, 0x5, 0x4, 0x56, 0x2, 0x2, 0x2, 0x3, 0x1, 0x5a, 0x1, 0x4, 0x5, 0x29, 0x3, 0x5e, 0x11, 0x1b, 0x35, 0x10, 0x82, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0x33, 0x84, 0x8d, 0x43, 0x2e, 0x2, 0x81, 0xd, 0x3, 0x1c, 0x14, 0x30, 0x4, 0xa, 0x1, 0x19, 0x7, 0x53, 0x25, 0x9, 0x2, 0x67, 0x2, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0x30, 0x18, 0x34, 0xc, 0x45, 0xb, 0xa, 0x6, 0x18, 0x3, 0x1, 0x4, 0x2e, 0x2, 0x24, 0xc, 0x1d, 0x3, 0x41, 0xe, 0xb, 0x26, 0x37, 0x9, 0xe, 0x2, 0xa, 0x6, 0x17, 0x3, 0x2, 0x4, 0x43, 0x18, 0x3, 0x2, 0x10, 0x2, 0x5, 0xa, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x2b, 0x1, 0x2, 0x2, 0xa, 0x6, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x21, 0x4, 0x81, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0xc, 0x1, 0xd, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x6c, 0x21, 0x80, 0x8b, 0x6, 0x80, 0xda, 0x12, 0x40, 0x2, 0x36, 0x28, 0xa, 0x6, 0x10, 0x10, 0x7, 0xc, 0x2, 0x18, 0x3, 0x21, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7e, 0x13, 0xa, 0x7, 0x1a, 0x4, 0x1, 0x1, 0x1a, 0xb, 0x59, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x23, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x45, 0x35, 0x80, 0x88, 0x1, 0x80, 0x82, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x11, 0x1b, 0x35, 0x1e, 0x2, 0x24, 0x4, 0x8, 0x1, 0x5, 0x2a, 0x80, 0x9e, 0x2, 0xa, 0x83, 0x56, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x80, 0xaa, 0x16, 0xa, 0x1a, 0x46, 0x38, 0x6, 0x2, 0x40, 0x4, 0x1, 0x2, 0x5, 0x8, 0x1, 0x3, 0x1, 0x1b, 0x4, 0x3, 0x4, 0x1, 0x20, 0x1d, 0x80, 0x83, 0x36, 0xa, 0x16, 0xa, 0x13, 0x80, 0x8d, 0x49, 0x83, 0xb7, 0x47, 0x1f, 0xa, 0x10, 0x3b, 0x15, 0x19, 0x7, 0xa, 0x6, 0x35, 0x1, 0xa, 0x40, 0x45, 0xb, 0xa, 0x84, 0xa6, 0x38, 0x8, 0xa, 0x89, 0x36, 0x83, 0x6f, 0x80, 0x91, 0x63, 0x8b, 0x9d, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x2f, 0x10, 0x11, 0xa0, 0x40, 0x60, 0x2, 0xa0, 0x21, 0x63, 0x5, 0x3, 0x6, 0x8, 0x8, 0x2, 0x7, 0x1e, 0x4, 0x80, 0x94, 0x3, 0x81, 0xbb, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x91, 0x44, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e, 0xab, 0x6, 0xe2, 0x80, 0xf0]; -+_T Lowercase = [0x61, 0x1a, 0x2f, 0x1, 0xa, 0x1, 0x4, 0x1, 0x24, 0x18, 0x1, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x3, 0x2, 0x4, 0x1, 0x2, 0x1, 0x3, 0x3, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x3, 0x6, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x45, 0x1, 0x24, 0x7, 0x2, 0x1e, 0x5, 0x60, 0x1, 0x2b, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x4, 0x12, 0x1, 0x1b, 0x23, 0x1, 0x2, 0x3, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x5, 0x1, 0x1, 0x2, 0x1, 0x2, 0x2, 0x33, 0x30, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x39, 0x27, 0x97, 0x78, 0x80, 0xc0, 0x41, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0xe, 0x2, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x5, 0x1, 0x2, 0x6, 0x1, 0x3, 0x3, 0x1, 0x2, 0x8, 0x4, 0x2, 0x2, 0x8, 0x8, 0xa, 0x3, 0x1, 0x2, 0x79, 0x1, 0xd, 0x1, 0x10, 0xd, 0x6d, 0x1, 0x3, 0x2, 0x3, 0x1, 0x1b, 0x1, 0x4, 0x1, 0x4, 0x1, 0x2, 0x2, 0x8, 0x4, 0x4, 0x1, 0x21, 0x10, 0x4, 0x1, 0x83, 0x4b, 0x1a, 0x87, 0x46, 0x2f, 0x2, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x8, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x1, 0xc, 0x26, 0x1, 0x1, 0x5, 0x1, 0xa0, 0x79, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0x8b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0xd, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4e, 0x3, 0xa0, 0x53, 0x5, 0x7, 0xc, 0x5, 0x84, 0x29, 0x1a, 0x84, 0xcd, 0x28, 0xa0, 0xcf, 0xca, 0x1a, 0x1a, 0x7, 0x1, 0x12, 0x1a, 0x1a, 0x1a, 0x4, 0x1, 0x1, 0x1, 0x7, 0x1, 0xb, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1c, 0x1c, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1a, 0x19, 0x1, 0x6, 0x1, 0x1]; -+_T Zl = [0xa0, 0x20, 0x28, 0x1]; -+_T Zp = [0xa0, 0x20, 0x29, 0x1]; -+_T Radical = [0xa0, 0x2e, 0x80, 0x1a, 0x1, 0x59, 0xc, 0x80, 0xd6]; -+_T Extender = [0x80, 0xb7, 0x1, 0x82, 0x18, 0x2, 0x83, 0x6e, 0x1, 0x81, 0xb9, 0x1, 0x86, 0x4b, 0x1, 0x7f, 0x1, 0x89, 0x43, 0x1, 0x38, 0x1, 0x82, 0x63, 0x1, 0x81, 0x8e, 0x1, 0x44, 0x1, 0x93, 0x89, 0x1, 0x2b, 0x5, 0x67, 0x2, 0x5d, 0x3, 0xa0, 0x6f, 0x16, 0x1, 0x85, 0xf6, 0x1, 0x83, 0xc2, 0x1, 0x80, 0xa0, 0x1, 0x6c, 0x1, 0x15, 0x2, 0xa0, 0x54, 0x7b, 0x1]; -+_T Co = [0xa0, 0xe0, 0x0, 0x99, 0x0, 0xae, 0x7, 0x0, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe]; -+_T Unified_Ideograph = [0xa0, 0x34, 0x0, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0xa0, 0x5a, 0x41, 0x2, 0x1, 0x1, 0x1, 0x2, 0xa, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x3, 0xa1, 0x5, 0xd6, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde]; -+_T Pc = [0x5f, 0x1, 0x9f, 0xdf, 0x2, 0x13, 0x1, 0xa0, 0xdd, 0xde, 0x2, 0x18, 0x3, 0x80, 0xef, 0x1]; -+_T Cs = [0xa0, 0xd8, 0x0, 0x88, 0x0]; -+_T Noncharacter_Code_Point = [0xa0, 0xfd, 0xd0, 0x20, 0x82, 0xe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe]; -+_T Uppercase = [0x41, 0x1a, 0x65, 0x17, 0x1, 0x7, 0x21, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x1, 0x3, 0x2, 0x4, 0x1, 0x2, 0x1, 0x3, 0x3, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x3, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x7, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0x21, 0x1, 0x1, 0x1, 0x3, 0x1, 0xf, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x2, 0x1, 0x11, 0x1, 0x9, 0x23, 0x1, 0x2, 0x3, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x5, 0x1, 0x2, 0x1, 0x1, 0x2, 0x2, 0x33, 0x30, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa, 0x26, 0x8b, 0x49, 0x26, 0x1, 0x1, 0x5, 0x1, 0x8d, 0x32, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x9, 0x8, 0x8, 0x6, 0xa, 0x8, 0x8, 0x8, 0x8, 0x6, 0xb, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x8, 0x8, 0x48, 0x4, 0xc, 0x4, 0xc, 0x4, 0xc, 0x5, 0xb, 0x4, 0x81, 0x6, 0x1, 0x4, 0x1, 0x3, 0x3, 0x2, 0x3, 0x2, 0x1, 0x3, 0x5, 0x6, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x2, 0x4, 0xa, 0x2, 0x5, 0x1, 0x1a, 0x10, 0x13, 0x1, 0x83, 0x32, 0x1a, 0x87, 0x30, 0x2f, 0x31, 0x1, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x2, 0x1, 0x8, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x8, 0x1, 0x1, 0x1, 0x4, 0x1, 0xa0, 0x79, 0x4d, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x13, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0x8b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0xd, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xa0, 0x57, 0x76, 0x1a, 0x84, 0xc5, 0x28, 0xa0, 0xcf, 0xd8, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0x8, 0x1a, 0x1a, 0x1a, 0x2, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1b, 0x2, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1b, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1a, 0x1e, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x19, 0x21, 0x1]; -+_T IDS_Trinary_Operator = [0xa0, 0x2f, 0xf2, 0x2]; -+_T Logical_Order_Exception = [0x8e, 0x40, 0x5, 0x7b, 0x5, 0xa0, 0x9b, 0xf0, 0x2, 0x2, 0x1, 0x1, 0x2]; -+_T Pi = [0x80, 0xab, 0x1, 0x9f, 0x6c, 0x1, 0x2, 0x2, 0x2, 0x1, 0x19, 0x1, 0x8d, 0xc8, 0x1, 0x1, 0x1, 0x4, 0x1, 0x2, 0x1, 0xf, 0x1, 0x3, 0x1]; -+_T Soft_Dotted = [0x69, 0x2, 0x80, 0xc4, 0x1, 0x81, 0x19, 0x1, 0x1e, 0x1, 0x34, 0x1, 0x14, 0x1, 0x81, 0x40, 0x1, 0x62, 0x1, 0x1, 0x1, 0x99, 0x9, 0x1, 0x33, 0x1, 0xd, 0x1, 0x3, 0x1, 0x80, 0x84, 0x1, 0x80, 0x9d, 0x1, 0x81, 0xa5, 0x1, 0x80, 0xd6, 0x2, 0x8b, 0x32, 0x1, 0xa1, 0xa7, 0xa5, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2, 0x32, 0x2]; -+_T Po = [0x21, 0x3, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0xa, 0x2, 0x3, 0x2, 0x1b, 0x1, 0x44, 0x1, 0x5, 0x1, 0xe, 0x2, 0x7, 0x1, 0x82, 0xbe, 0x1, 0x8, 0x1, 0x81, 0xd2, 0x6, 0x29, 0x1, 0x36, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2c, 0x2, 0x14, 0x2, 0x1, 0x2, 0xd, 0x1, 0x2, 0x2, 0x4a, 0x4, 0x66, 0x1, 0x2b, 0xe, 0x80, 0xe9, 0x3, 0x36, 0xf, 0x1f, 0x1, 0x81, 0x5, 0x2, 0xa, 0x1, 0x81, 0x7f, 0x1, 0x83, 0x3, 0x1, 0x5a, 0x1, 0xa, 0x2, 0x80, 0xa8, 0xf, 0x1, 0x1, 0x70, 0x1, 0x4a, 0x5, 0x4, 0x2, 0x6f, 0x6, 0x80, 0xab, 0x1, 0x82, 0x64, 0x9, 0x83, 0x4, 0x2, 0x7c, 0x3, 0x47, 0x2, 0x80, 0x9d, 0x3, 0x1, 0x3, 0x25, 0x6, 0x1, 0x4, 0x81, 0x39, 0x2, 0x80, 0xd8, 0x2, 0x80, 0x80, 0x7, 0x1, 0x6, 0x80, 0xac, 0x7, 0x80, 0x9b, 0x4, 0x3b, 0x5, 0x3e, 0x2, 0x40, 0x8, 0xb, 0x1, 0x83, 0x42, 0x2, 0x8, 0x8, 0x8, 0x9, 0x2, 0x4, 0x2, 0x3, 0x3, 0xb, 0x1, 0x1, 0x1, 0xa, 0x8c, 0x9a, 0x4, 0x1, 0x2, 0x70, 0x1, 0x80, 0x8f, 0x2, 0x4, 0x3, 0x2, 0x1, 0x2, 0x9, 0x1, 0x2, 0x1, 0x1, 0x2, 0x2, 0xa, 0x5, 0x1, 0xa, 0x81, 0xc7, 0x3, 0x39, 0x1, 0x80, 0xbd, 0x1, 0xa0, 0x74, 0x2, 0x2, 0x81, 0xd, 0x3, 0x63, 0x1, 0xa, 0x1, 0x73, 0x6, 0x81, 0x7c, 0x4, 0x56, 0x2, 0x28, 0x3, 0x33, 0x2, 0x2f, 0x1, 0x61, 0xd, 0x10, 0x2, 0x7c, 0x4, 0x7e, 0x2, 0x10, 0x2, 0x80, 0xf9, 0x1, 0xa0, 0x52, 0x24, 0x7, 0x2, 0x1, 0x16, 0x1, 0x14, 0x2, 0x2, 0x4, 0x3, 0x3, 0x1, 0x4, 0x7, 0x3, 0x6, 0x1, 0x1, 0x2, 0x80, 0x95, 0x3, 0x1, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0xa, 0x2, 0x3, 0x2, 0x1b, 0x1, 0x24, 0x1, 0x2, 0x2, 0x81, 0x9a, 0x3, 0x82, 0x9c, 0x1, 0x30, 0x1, 0x84, 0x86, 0x1, 0x80, 0xc7, 0x1, 0x1f, 0x1, 0x81, 0x10, 0x9, 0x26, 0x1, 0x80, 0xb9, 0x7, 0x85, 0x7, 0x7, 0x6d, 0x2, 0x1, 0x4, 0x7e, 0x4, 0x80, 0x81, 0x4, 0x92, 0xa7, 0x4]; -+_T Cn = [0x83, 0x78, 0x2, 0x5, 0x5, 0x7, 0x1, 0x1, 0x1, 0x14, 0x1, 0x81, 0x85, 0x9, 0x26, 0x2, 0x7, 0x1, 0x27, 0x1, 0x2, 0x4, 0x1, 0x1, 0x37, 0x8, 0x1b, 0x5, 0x5, 0xb, 0x5, 0x1, 0x17, 0x1, 0x80, 0xf0, 0x1, 0x3c, 0x2, 0x65, 0xe, 0x3b, 0x5, 0x2e, 0x2, 0xf, 0x1, 0x1c, 0x2, 0x1, 0x41, 0x1, 0x1, 0xb, 0x37, 0x1b, 0x1, 0x78, 0x1, 0x7, 0x1, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x2, 0x9, 0x2, 0x2, 0x2, 0x4, 0x8, 0x1, 0x4, 0x2, 0x1, 0x5, 0x2, 0x16, 0x5, 0x3, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x5, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x7, 0x4, 0x1, 0x1, 0x7, 0x10, 0xb, 0x3, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x3, 0x1, 0x3, 0x2, 0x1, 0xf, 0x4, 0x2, 0xc, 0xf, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0x9, 0x2, 0x2, 0x2, 0x3, 0x8, 0x2, 0x4, 0x2, 0x1, 0x5, 0x2, 0x12, 0xa, 0x2, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x4, 0x5, 0x3, 0x3, 0x1, 0x4, 0x2, 0x1, 0x6, 0x1, 0xe, 0x15, 0x6, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x1, 0x2, 0x6, 0x4, 0x2, 0xa, 0x8, 0x8, 0x2, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x2, 0x9, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x7, 0x1, 0x1, 0x4, 0x2, 0xa, 0x1, 0x2, 0xf, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x8, 0x1, 0x3, 0x1, 0x5, 0x8, 0x1, 0x8, 0x4, 0x2, 0x10, 0x3, 0x7, 0x2, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x3, 0xc, 0x3a, 0x4, 0x1d, 0x25, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0xd, 0x1, 0x3, 0x2, 0x5, 0x1, 0x1, 0x1, 0x6, 0x2, 0xa, 0x2, 0x4, 0x20, 0x48, 0x1, 0x24, 0x4, 0x27, 0x1, 0x24, 0x1, 0xf, 0x1, 0xd, 0x25, 0x80, 0xc6, 0x1, 0x1, 0x5, 0x1, 0x2, 0x81, 0x79, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x2, 0x20, 0x3, 0x1a, 0x6, 0x55, 0xb, 0x82, 0x9d, 0x3, 0x51, 0xf, 0xd, 0x1, 0x7, 0xb, 0x17, 0x9, 0x14, 0xc, 0xd, 0x1, 0x3, 0x1, 0x2, 0xc, 0x5e, 0x2, 0xa, 0x6, 0xa, 0x6, 0xf, 0x1, 0xa, 0x6, 0x58, 0x8, 0x2b, 0x5, 0x46, 0xa, 0x1d, 0x3, 0xc, 0x4, 0xc, 0x4, 0x1, 0x3, 0x2a, 0x2, 0x5, 0xb, 0x2c, 0x4, 0x1a, 0x6, 0xb, 0x3, 0x3e, 0x2, 0x41, 0x1, 0x1d, 0x2, 0xb, 0x6, 0xa, 0x6, 0xe, 0x52, 0x4c, 0x4, 0x2d, 0x3, 0x74, 0x8, 0x3c, 0x3, 0xf, 0x3, 0x33, 0x40, 0x8, 0x8, 0x27, 0x9, 0x80, 0xe7, 0x15, 0x81, 0x1a, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0xf, 0x1, 0xe, 0x2, 0x6, 0x1, 0x13, 0x2, 0x3, 0x1, 0x9, 0x1, 0x65, 0x1, 0xc, 0x2, 0x1b, 0x1, 0xd, 0x3, 0x1b, 0x15, 0x21, 0xf, 0x80, 0x8a, 0x6, 0x82, 0x64, 0xc, 0x27, 0x19, 0xb, 0x15, 0x82, 0xa0, 0x1, 0x84, 0x4c, 0x3, 0xa, 0x80, 0xa6, 0x2f, 0x1, 0x2f, 0x1, 0x80, 0x94, 0x5, 0x2d, 0x1, 0x1, 0x5, 0x1, 0x2, 0x38, 0x7, 0x2, 0xe, 0x18, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x5c, 0x44, 0x1a, 0x1, 0x59, 0xc, 0x80, 0xd6, 0x1a, 0xc, 0x4, 0x40, 0x1, 0x56, 0x2, 0x67, 0x5, 0x29, 0x3, 0x5e, 0x1, 0x2b, 0x5, 0x24, 0xc, 0x2f, 0x1, 0x80, 0xdf, 0x1, 0x9a, 0xb6, 0xa, 0xa0, 0x52, 0xd, 0x33, 0x84, 0x8d, 0x3, 0x37, 0x9, 0x81, 0x5c, 0x14, 0x58, 0x7, 0x59, 0x8, 0x80, 0x8f, 0x1, 0x4, 0xc, 0xb, 0x4d, 0x34, 0x4, 0xa, 0x6, 0x38, 0x8, 0x45, 0x9, 0xc, 0x6, 0x1c, 0x4, 0x54, 0xb, 0x1e, 0x3, 0x4e, 0x1, 0xb, 0x4, 0x2, 0x20, 0x37, 0x9, 0xe, 0x2, 0xa, 0x2, 0x20, 0x4, 0x43, 0x18, 0x1c, 0xa, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7, 0x80, 0x91, 0x2e, 0x2, 0xa, 0x6, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0x4, 0xa0, 0x22, 0x6e, 0x2, 0x6a, 0x26, 0x7, 0xc, 0x5, 0x5, 0x1a, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x7c, 0x11, 0x81, 0x6d, 0x10, 0x40, 0x2, 0x36, 0x28, 0xe, 0x2, 0x1a, 0x6, 0x7, 0x9, 0x23, 0x1, 0x13, 0x1, 0x4, 0x4, 0x5, 0x1, 0x80, 0x87, 0x2, 0x1, 0x1, 0x80, 0xbe, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3, 0x3, 0x7, 0x1, 0x7, 0xa, 0x5, 0x2, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b, 0x5, 0x3, 0x4, 0x2d, 0x3, 0x54, 0x5, 0xc, 0x34, 0x2e, 0x80, 0x82, 0x1d, 0x3, 0x31, 0x2f, 0x1f, 0x1, 0x4, 0xc, 0x1b, 0x35, 0x1e, 0x1, 0x25, 0x4, 0xe, 0x2a, 0x80, 0x9e, 0x2, 0xa, 0x83, 0x56, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x17, 0x1, 0x9, 0x80, 0xa0, 0x1c, 0x3, 0x1b, 0x5, 0x1, 0x40, 0x38, 0x6, 0x2, 0x40, 0x4, 0x1, 0x2, 0x5, 0x8, 0x1, 0x3, 0x1, 0x1b, 0x4, 0x3, 0x4, 0x9, 0x8, 0x9, 0x7, 0x20, 0x80, 0x80, 0x36, 0x3, 0x1d, 0x2, 0x1b, 0x5, 0x8, 0x80, 0x80, 0x49, 0x82, 0x17, 0x1f, 0x81, 0x81, 0x4e, 0x4, 0x1e, 0x10, 0x42, 0xe, 0x19, 0x7, 0xa, 0x6, 0x35, 0x1, 0xe, 0x3c, 0x49, 0x7, 0xa, 0x84, 0xa6, 0x38, 0x8, 0xa, 0x89, 0x36, 0x83, 0x6f, 0x80, 0x91, 0x63, 0xd, 0x4, 0x8b, 0x8c, 0x84, 0x2f, 0xa0, 0x33, 0xd1, 0x82, 0x39, 0x84, 0xc7, 0x45, 0xb, 0x2f, 0x10, 0x11, 0xa0, 0x40, 0x60, 0x2, 0x9f, 0xfe, 0x80, 0xf6, 0xa, 0x27, 0x2, 0x80, 0xb5, 0x22, 0x46, 0x80, 0xba, 0x57, 0x9, 0x12, 0x80, 0x8e, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x81, 0x24, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x34, 0x2, 0x81, 0xe, 0x2c, 0x4, 0x64, 0xc, 0xf, 0x2, 0xe, 0x2, 0xf, 0x1, 0xf, 0x20, 0xb, 0x5, 0x1f, 0x1, 0x3c, 0x4, 0x2b, 0x4b, 0x1d, 0xd, 0x2b, 0x5, 0x9, 0x7, 0x2, 0x80, 0xae, 0x21, 0xf, 0x6, 0x1, 0x46, 0x3, 0x14, 0xc, 0x25, 0x1, 0x5, 0x15, 0x11, 0xf, 0x3f, 0x1, 0x1, 0x1, 0x80, 0xb6, 0x1, 0x4, 0x3, 0x3e, 0x2, 0x4, 0xc, 0x18, 0x80, 0x93, 0x46, 0x4, 0xb, 0x30, 0x46, 0x3a, 0x74, 0x88, 0x8c, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e, 0xab, 0x5, 0xe3, 0x1, 0x1e, 0x60, 0x80, 0x80, 0x80, 0xf0, 0xa0, 0xfe, 0x10, 0xa0, 0xff, 0xfe, 0x2, 0xa0, 0xff, 0xfe]; -+_T Ps = [0x28, 0x1, 0x32, 0x1, 0x1f, 0x1, 0x8e, 0xbe, 0x1, 0x1, 0x1, 0x87, 0x5e, 0x1, 0x89, 0x7e, 0x1, 0x3, 0x1, 0x26, 0x1, 0x37, 0x1, 0xf, 0x1, 0x82, 0x7a, 0x1, 0x1, 0x1, 0x1e, 0x1, 0x84, 0x3e, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x50, 0x1, 0x20, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0x94, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x40, 0x1, 0x1, 0x1, 0x21, 0x1, 0x84, 0x25, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0xdf, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0xa0, 0xcd, 0x20, 0x1, 0x80, 0xd8, 0x1, 0x1d, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x11, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0xaa, 0x1, 0x32, 0x1, 0x1f, 0x1, 0x3, 0x1, 0x2, 0x1]; -+_T ASCII_Hex_Digit = [0x30, 0xa, 0x7, 0x6, 0x1a, 0x6]; -+_T No = [0x80, 0xb2, 0x2, 0x5, 0x1, 0x2, 0x3, 0x89, 0x35, 0x6, 0x81, 0x78, 0x6, 0x78, 0x3, 0x80, 0x85, 0x7, 0x80, 0xf1, 0x6, 0x81, 0xb4, 0xa, 0x84, 0x35, 0x14, 0x84, 0x73, 0xa, 0x81, 0xe0, 0x1, 0x86, 0x95, 0x1, 0x3, 0x6, 0x6, 0xa, 0x80, 0xc6, 0x10, 0x29, 0x1, 0x82, 0xd6, 0x3c, 0x4e, 0x16, 0x82, 0x76, 0x1e, 0x85, 0x69, 0x1, 0x84, 0x94, 0x4, 0x80, 0x8a, 0xa, 0x1e, 0x8, 0x1, 0xf, 0x20, 0xa, 0x27, 0xf, 0xa0, 0x75, 0x70, 0x6, 0xa0, 0x58, 0xd1, 0x2d, 0x41, 0x4, 0x11, 0x1, 0x81, 0x95, 0x4, 0x85, 0x34, 0x8, 0x80, 0xb6, 0x6, 0x81, 0x24, 0x8, 0x35, 0x2, 0x80, 0xd9, 0x8, 0x18, 0x8, 0x82, 0xe0, 0x1f, 0x81, 0xd3, 0x14, 0xa0, 0xc2, 0xfa, 0x12, 0x9d, 0x8e, 0xb]; -+_T Sm = [0x2b, 0x1, 0x10, 0x3, 0x3d, 0x1, 0x1, 0x1, 0x2d, 0x1, 0x4, 0x1, 0x25, 0x1, 0x1f, 0x1, 0x82, 0xfe, 0x1, 0x82, 0xf, 0x3, 0x9a, 0x3b, 0x1, 0xd, 0x1, 0x27, 0x3, 0xd, 0x3, 0x80, 0x8b, 0x1, 0x27, 0x5, 0x6, 0x1, 0x44, 0x5, 0x5, 0x2, 0x4, 0x1, 0x2, 0x1, 0x2, 0x1, 0x7, 0x1, 0x1f, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1f, 0x81, 0xc, 0x20, 0x2, 0x5a, 0x1, 0x1e, 0x19, 0x28, 0x6, 0x81, 0xd5, 0x1, 0x9, 0x1, 0x36, 0x8, 0x6f, 0x1, 0x81, 0x50, 0x5, 0x2, 0x1f, 0xa, 0x10, 0x81, 0x0, 0x80, 0x83, 0x16, 0x3f, 0x4, 0x20, 0x2, 0x81, 0x2, 0x30, 0x15, 0x2, 0x6, 0xa0, 0xcf, 0xdc, 0x1, 0x83, 0x38, 0x1, 0x1, 0x3, 0x80, 0xa4, 0x1, 0x10, 0x3, 0x3d, 0x1, 0x1, 0x1, 0x80, 0x83, 0x1, 0x6, 0x4, 0xa0, 0xd6, 0xd4, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x97, 0x2c, 0x2]; -+_T Other_Math = [0x5e, 0x1, 0x83, 0x71, 0x3, 0x2, 0x1, 0x1a, 0x2, 0x2, 0x2, 0x9c, 0x20, 0x1, 0x1b, 0x3, 0xb, 0x1, 0x20, 0x4, 0x18, 0x2, 0xe, 0x2, 0x41, 0xd, 0x4, 0x1, 0x3, 0x2, 0x4, 0x5, 0x12, 0x1, 0x4, 0x1, 0x2, 0xa, 0x1, 0x1, 0x3, 0x5, 0x6, 0x1, 0x3, 0x2, 0x2, 0x2, 0x1, 0x3, 0x1, 0x6, 0x3, 0x4, 0x5, 0x5, 0x4b, 0x5, 0x2, 0x4, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x5, 0x2, 0x2, 0x4, 0x2, 0x4, 0x12, 0x2, 0x2, 0x1, 0x1, 0x1, 0x7, 0x1, 0x1, 0x6, 0x2, 0x81, 0x22, 0x4, 0x80, 0xa8, 0x2, 0x1, 0x1, 0x18, 0x1, 0x11, 0x1, 0x81, 0xbd, 0x2, 0xc, 0x9, 0x5, 0x5, 0x5, 0x2, 0x2, 0x2, 0x3, 0x5, 0xe, 0x1, 0x1, 0x1, 0x2, 0x6, 0x18, 0x2, 0x39, 0x1, 0x1, 0x1, 0x1d, 0x4, 0x9, 0x2, 0x81, 0x56, 0x2, 0x1f, 0xa, 0x81, 0x93, 0x16, 0x3f, 0x4, 0x20, 0x2, 0xa0, 0xd4, 0x63, 0x1, 0x1, 0x1, 0x4, 0x1, 0x80, 0xd3, 0x1, 0x1, 0x1, 0xa0, 0xd4, 0xc1, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x19, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x1f, 0x1, 0x19, 0x1, 0x8, 0x2, 0x32, 0x96, 0x0, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11]; -+_T Join_Control = [0xa0, 0x20, 0xc, 0x2]; -+_T Cf = [0x80, 0xad, 0x1, 0x85, 0x52, 0x5, 0x17, 0x1, 0x80, 0xc0, 0x1, 0x31, 0x1, 0x90, 0xfe, 0x1, 0x87, 0xfc, 0x5, 0x1a, 0x5, 0x31, 0x5, 0x1, 0xa, 0xa0, 0xde, 0x8f, 0x1, 0x80, 0xf9, 0x3, 0x90, 0xc1, 0x1, 0xa0, 0xc0, 0xb5, 0x8, 0xac, 0x2e, 0x86, 0x1, 0x1e, 0x60]; -+_T Ideographic = [0xa0, 0x30, 0x6, 0x2, 0x19, 0x9, 0xe, 0x3, 0x83, 0xc5, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0xa0, 0x59, 0x33, 0x81, 0x6e, 0x2, 0x6a, 0xa1, 0x5, 0x26, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Sc = [0x24, 0x1, 0x7d, 0x4, 0x84, 0xe9, 0x1, 0x7b, 0x1, 0x83, 0xe6, 0x2, 0x7, 0x1, 0x80, 0xf5, 0x1, 0x81, 0x7, 0x1, 0x82, 0x45, 0x1, 0x89, 0x9b, 0x1, 0x88, 0xc4, 0x1b, 0xa0, 0x87, 0x7d, 0x1, 0xa0, 0x55, 0xc3, 0x1, 0x6c, 0x1, 0x80, 0x9a, 0x1, 0x80, 0xdb, 0x2, 0x3, 0x2]; -+_T Nd = [0x30, 0xa, 0x86, 0x26, 0xa, 0x80, 0x86, 0xa, 0x80, 0xc6, 0xa, 0x81, 0x9c, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x76, 0xa, 0x80, 0xe0, 0xa, 0x76, 0xa, 0x46, 0xa, 0x81, 0x16, 0xa, 0x46, 0xa, 0x87, 0x46, 0xa, 0x26, 0xa, 0x81, 0x2c, 0xa, 0x80, 0x80, 0xa, 0x80, 0xa6, 0xa, 0x6, 0xa, 0x80, 0xb6, 0xa, 0x56, 0xa, 0x80, 0x86, 0xa, 0x6, 0xa, 0xa0, 0x89, 0xc6, 0xa, 0x82, 0xa6, 0xa, 0x26, 0xa, 0x80, 0xc6, 0xa, 0x76, 0xa, 0x81, 0x96, 0xa, 0xa0, 0x53, 0x16, 0xa, 0x85, 0x86, 0xa, 0x8b, 0xbc, 0xa, 0x80, 0x80, 0xa, 0x3c, 0xa, 0x80, 0x90, 0xa, 0x84, 0xe6, 0xa, 0xa0, 0xc1, 0x4, 0x32]; -+_T Default_Ignorable_Code_Point = [0x80, 0xad, 0x1, 0x82, 0xa1, 0x1, 0x82, 0xcc, 0x1, 0x8b, 0x42, 0x2, 0x86, 0x53, 0x2, 0x55, 0x4, 0x87, 0xfc, 0x5, 0x1a, 0x5, 0x31, 0x10, 0x90, 0xf4, 0x1, 0xa0, 0xcc, 0x9b, 0x10, 0x80, 0xef, 0x1, 0x80, 0xa0, 0x1, 0x4f, 0x9, 0xa0, 0xd1, 0x7a, 0x8, 0xac, 0x2e, 0x85, 0x90, 0x0]; -+_T Other_ID_Continue = [0x80, 0xb7, 0x1, 0x82, 0xcf, 0x1, 0x8f, 0xe1, 0x9, 0x86, 0x68, 0x1]; -+_T Pd = [0x2d, 0x1, 0x85, 0x5c, 0x1, 0x33, 0x1, 0x8e, 0x41, 0x1, 0x84, 0x5, 0x1, 0x88, 0x9, 0x6, 0x8e, 0x1, 0x1, 0x2, 0x1, 0x1f, 0x2, 0x81, 0xe0, 0x1, 0x13, 0x1, 0x6f, 0x1, 0xa0, 0xcd, 0x90, 0x2, 0x25, 0x1, 0xa, 0x1, 0x80, 0xa9, 0x1]; -+_T Deprecated = [0x81, 0x49, 0x1, 0x85, 0x29, 0x1, 0x89, 0x3, 0x1, 0x1, 0x1, 0x88, 0x29, 0x2, 0x88, 0xc5, 0x6, 0x82, 0xb9, 0x2, 0xad, 0xdc, 0xd6, 0x1, 0x1e, 0x60]; -+_T Grapheme_Extend = [0x83, 0x0, 0x70, 0x81, 0x13, 0x7, 0x81, 0x7, 0x2d, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0x1, 0x48, 0xb, 0x30, 0x15, 0x10, 0x1, 0x65, 0x7, 0x2, 0x6, 0x2, 0x2, 0x1, 0x4, 0x23, 0x1, 0x1e, 0x1b, 0x5b, 0xb, 0x3a, 0x9, 0x22, 0x4, 0x1, 0x9, 0x1, 0x3, 0x1, 0x5, 0x2b, 0x3, 0x80, 0x88, 0x1b, 0x1, 0x3, 0x37, 0x1, 0x1, 0x1, 0x4, 0x8, 0x4, 0x1, 0x3, 0x7, 0xa, 0x2, 0x1d, 0x1, 0x3a, 0x1, 0x1, 0x1, 0x2, 0x4, 0x8, 0x1, 0x9, 0x1, 0xa, 0x2, 0x1d, 0x2, 0x39, 0x1, 0x4, 0x2, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x1e, 0x2, 0x3, 0x1, 0xb, 0x2, 0x39, 0x1, 0x4, 0x5, 0x1, 0x2, 0x4, 0x1, 0x14, 0x2, 0x1d, 0x1, 0x3a, 0x1, 0x1, 0x2, 0x1, 0x4, 0x8, 0x1, 0x8, 0x2, 0xa, 0x2, 0x1e, 0x1, 0x3b, 0x1, 0x1, 0x1, 0xc, 0x1, 0x9, 0x1, 0x66, 0x3, 0x5, 0x3, 0x1, 0x4, 0x7, 0x2, 0xb, 0x2, 0x58, 0x1, 0x2, 0x1, 0x2, 0x1, 0x3, 0x1, 0x5, 0x2, 0x7, 0x2, 0xb, 0x2, 0x5a, 0x1, 0x2, 0x4, 0x8, 0x1, 0x9, 0x1, 0xa, 0x2, 0x66, 0x1, 0x4, 0x1, 0x2, 0x3, 0x1, 0x1, 0x8, 0x1, 0x51, 0x1, 0x2, 0x7, 0xc, 0x8, 0x62, 0x1, 0x2, 0x6, 0x1, 0x2, 0xb, 0x6, 0x4a, 0x2, 0x1b, 0x1, 0x1, 0x1, 0x1, 0x1, 0x37, 0xe, 0x1, 0x5, 0x1, 0x2, 0x5, 0xb, 0x1, 0x24, 0x9, 0x1, 0x66, 0x4, 0x1, 0x6, 0x1, 0x2, 0x2, 0x2, 0x19, 0x2, 0x4, 0x3, 0x10, 0x4, 0xd, 0x1, 0x2, 0x2, 0x6, 0x1, 0xf, 0x1, 0x82, 0xbf, 0x3, 0x83, 0xb2, 0x3, 0x1d, 0x3, 0x1d, 0x2, 0x1e, 0x2, 0x40, 0x2, 0x1, 0x7, 0x8, 0x1, 0x2, 0xb, 0x9, 0x1, 0x2d, 0x3, 0x80, 0x9b, 0x1, 0x76, 0x3, 0x4, 0x2, 0x9, 0x1, 0x6, 0x3, 0x80, 0xdb, 0x2, 0x2, 0x1, 0x3a, 0x1, 0x1, 0x7, 0x1, 0x1, 0x1, 0x1, 0x2, 0x8, 0x6, 0xa, 0x2, 0x1, 0x80, 0x80, 0x4, 0x30, 0x1, 0x1, 0x5, 0x1, 0x1, 0x5, 0x1, 0x28, 0x9, 0xc, 0x2, 0x20, 0x4, 0x2, 0x2, 0x1, 0x1, 0x3a, 0x1, 0x1, 0x2, 0x3, 0x1, 0x1, 0x3, 0x3a, 0x8, 0x2, 0x2, 0x80, 0x98, 0x3, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x80, 0xcb, 0x27, 0x15, 0x4, 0x82, 0xc, 0x2, 0x80, 0xc2, 0x21, 0x8b, 0xfe, 0x3, 0x80, 0x8d, 0x1, 0x60, 0x20, 0x82, 0x2a, 0x6, 0x69, 0x2, 0xa0, 0x75, 0xd4, 0x4, 0x1, 0xa, 0x21, 0x1, 0x50, 0x2, 0x81, 0x10, 0x1, 0x3, 0x1, 0x4, 0x1, 0x19, 0x2, 0x80, 0x9d, 0x1, 0x1b, 0x12, 0x34, 0x8, 0x19, 0xb, 0x2e, 0x3, 0x30, 0x1, 0x2, 0x4, 0x2, 0x1, 0x6c, 0x6, 0x2, 0x2, 0x2, 0x2, 0xc, 0x1, 0x8, 0x1, 0x63, 0x1, 0x1, 0x3, 0x2, 0x2, 0x5, 0x2, 0x1, 0x1, 0x2a, 0x2, 0x8, 0x1, 0x80, 0xee, 0x1, 0x2, 0x1, 0x4, 0x1, 0xa0, 0x4f, 0x30, 0x1, 0x82, 0xe1, 0x10, 0x10, 0x7, 0x81, 0x77, 0x2, 0x82, 0x5d, 0x1, 0x88, 0x3, 0x3, 0x1, 0x2, 0x5, 0x4, 0x28, 0x3, 0x4, 0x1, 0x85, 0xc1, 0x1, 0x36, 0xf, 0x39, 0x2, 0x31, 0x4, 0x2, 0x2, 0x45, 0x3, 0x24, 0x5, 0x1, 0x8, 0x4b, 0x2, 0x34, 0x9, 0x84, 0xec, 0x1, 0x1, 0x1, 0x2, 0x6, 0x1, 0x1, 0xa0, 0x58, 0xd7, 0x4, 0xa0, 0x61, 0xd2, 0x1, 0x1, 0x3, 0x4, 0x5, 0x8, 0x8, 0x2, 0x7, 0x1e, 0x4, 0x80, 0x94, 0x3, 0xac, 0x2e, 0xbb, 0x80, 0xf0]; -+_T Hyphen = [0x2d, 0x1, 0x7f, 0x1, 0x84, 0xdc, 0x1, 0x92, 0x7b, 0x1, 0x88, 0x9, 0x2, 0x8e, 0x5, 0x1, 0x82, 0xe3, 0x1, 0xa0, 0xcd, 0x67, 0x1, 0x80, 0xa9, 0x1, 0x57, 0x1]; -+_T Pe = [0x29, 0x1, 0x33, 0x1, 0x1f, 0x1, 0x8e, 0xbd, 0x1, 0x1, 0x1, 0x87, 0x5e, 0x1, 0x89, 0xa9, 0x1, 0x37, 0x1, 0xf, 0x1, 0x82, 0x7a, 0x1, 0x1, 0x1, 0x1e, 0x1, 0x84, 0x3e, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x50, 0x1, 0x20, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0x94, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x40, 0x1, 0x1, 0x1, 0x21, 0x1, 0x84, 0x25, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x81, 0xdf, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0xa0, 0xcd, 0x1f, 0x1, 0x80, 0xd8, 0x1, 0x1d, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x11, 0x1, 0x1, 0x1, 0x1, 0x1, 0x80, 0xaa, 0x1, 0x33, 0x1, 0x1f, 0x1, 0x2, 0x1, 0x2, 0x1]; -+_U[] _tab = [ -+_U("Alphabetic", Alphabetic), -+_U("ASCII_Hex_Digit", ASCII_Hex_Digit), -+_U("Bidi_Control", Bidi_Control), -+_U("Cased", Cased), -+_U("Case_Ignorable", Case_Ignorable), -+_U("Cc", Cc), -+_U("Cf", Cf), -+_U("Close_Punctuation", Pe), -+_U("Cn", Cn), -+_U("Co", Co), -+_U("Connector_Punctuation", Pc), -+_U("Control", Cc), -+_U("Cs", Cs), -+_U("Currency_Symbol", Sc), -+_U("Dash", Dash), -+_U("Dash_Punctuation", Pd), -+_U("Decimal_Number", Nd), -+_U("Default_Ignorable_Code_Point", Default_Ignorable_Code_Point), -+_U("Deprecated", Deprecated), -+_U("Diacritic", Diacritic), -+_U("Enclosing_Mark", Me), -+_U("Extender", Extender), -+_U("Final_Punctuation", Pf), -+_U("Format", Cf), -+_U("Grapheme_Base", Grapheme_Base), -+_U("Grapheme_Extend", Grapheme_Extend), -+_U("Grapheme_Link", Grapheme_Link), -+_U("Hex_Digit", Hex_Digit), -+_U("Hyphen", Hyphen), -+_U("ID_Continue", ID_Continue), -+_U("Ideographic", Ideographic), -+_U("IDS_Binary_Operator", IDS_Binary_Operator), -+_U("ID_Start", ID_Start), -+_U("IDS_Trinary_Operator", IDS_Trinary_Operator), -+_U("Initial_Punctuation", Pi), -+_U("Join_Control", Join_Control), -+_U("Letter_Number", Nl), -+_U("Line_Separator", Zl), -+_U("Ll", Ll), -+_U("Lm", Lm), -+_U("Lo", Lo), -+_U("Logical_Order_Exception", Logical_Order_Exception), -+_U("Lowercase", Lowercase), -+_U("Lowercase_Letter", Ll), -+_U("Lt", Lt), -+_U("Lu", Lu), -+_U("Math", Math), -+_U("Math_Symbol", Sm), -+_U("Mc", Mc), -+_U("Me", Me), -+_U("Mn", Mn), -+_U("Modifier_Letter", Lm), -+_U("Modifier_Symbol", Sk), -+_U("Nd", Nd), -+_U("Nl", Nl), -+_U("No", No), -+_U("Noncharacter_Code_Point", Noncharacter_Code_Point), -+_U("Nonspacing_Mark", Mn), -+_U("Open_Punctuation", Ps), -+_U("Other_Alphabetic", Other_Alphabetic), -+_U("Other_Default_Ignorable_Code_Point", Other_Default_Ignorable_Code_Point), -+_U("Other_Grapheme_Extend", Other_Grapheme_Extend), -+_U("Other_ID_Continue", Other_ID_Continue), -+_U("Other_ID_Start", Other_ID_Start), -+_U("Other_Letter", Lo), -+_U("Other_Lowercase", Other_Lowercase), -+_U("Other_Math", Other_Math), -+_U("Other_Number", No), -+_U("Other_Punctuation", Po), -+_U("Other_Symbol", So), -+_U("Other_Uppercase", Other_Uppercase), -+_U("Paragraph_Separator", Zp), -+_U("Pattern_Syntax", Pattern_Syntax), -+_U("Pattern_White_Space", Pattern_White_Space), -+_U("Pc", Pc), -+_U("Pd", Pd), -+_U("Pe", Pe), -+_U("Pf", Pf), -+_U("Pi", Pi), -+_U("Po", Po), -+_U("Private_Use", Co), -+_U("Ps", Ps), -+_U("Quotation_Mark", Quotation_Mark), -+_U("Radical", Radical), -+_U("Sc", Sc), -+_U("Sk", Sk), -+_U("Sm", Sm), -+_U("So", So), -+_U("Soft_Dotted", Soft_Dotted), -+_U("Space_Separator", Zs), -+_U("Spacing_Mark", Mc), -+_U("STerm", STerm), -+_U("Surrogate", Cs), -+_U("Terminal_Punctuation", Terminal_Punctuation), -+_U("Titlecase_Letter", Lt), -+_U("Unassigned", Cn), -+_U("Unified_Ideograph", Unified_Ideograph), -+_U("Uppercase", Uppercase), -+_U("Uppercase_Letter", Lu), -+_U("Variation_Selector", Variation_Selector), -+_U("White_Space", White_Space), -+_U("XID_Continue", XID_Continue), -+_U("XID_Start", XID_Start), -+_U("Zl", Zl), -+_U("Zp", Zp), -+_U("Zs", Zs), -+]; -+} -+ -+struct blocks -+{ -+private alias _U = immutable(UnicodeProperty); -+@property static _U[] tab() { return _tab; } -+static immutable: -+private alias _T = ubyte[]; -+_T Number_Forms = [0xa0, 0x21, 0x50, 0x40]; -+_T Sinhala = [0x8d, 0x80, 0x80, 0x80]; -+_T Domino_Tiles = [0xa1, 0xf0, 0x30, 0x70]; -+_T Oriya = [0x8b, 0x0, 0x80, 0x80]; -+_T Thaana = [0x87, 0x80, 0x40]; -+_T New_Tai_Lue = [0x99, 0x80, 0x60]; -+_T Byzantine_Musical_Symbols = [0xa1, 0xd0, 0x0, 0x81, 0x0]; -+_T Cham = [0xa0, 0xaa, 0x0, 0x60]; -+_T IPA_Extensions = [0x82, 0x50, 0x60]; -+_T Bopomofo = [0xa0, 0x31, 0x0, 0x30]; -+_T Katakana_Phonetic_Extensions = [0xa0, 0x31, 0xf0, 0x10]; -+_T Khmer_Symbols = [0x99, 0xe0, 0x20]; -+_T Hebrew = [0x85, 0x90, 0x70]; -+_T Saurashtra = [0xa0, 0xa8, 0x80, 0x60]; -+_T Inscriptional_Parthian = [0xa1, 0xb, 0x40, 0x20]; -+_T Lisu = [0xa0, 0xa4, 0xd0, 0x30]; -+_T Latin_1_Supplement = [0x80, 0x80, 0x80, 0x80]; -+_T Arabic_Extended_A = [0x88, 0xa0, 0x60]; -+_T Tai_Tham = [0x9a, 0x20, 0x80, 0x90]; -+_T Latin_Extended_A = [0x81, 0x0, 0x80, 0x80]; -+_T Latin_Extended_B = [0x81, 0x80, 0x80, 0xd0]; -+_T Latin_Extended_C = [0xa0, 0x2c, 0x60, 0x20]; -+_T Latin_Extended_D = [0xa0, 0xa7, 0x20, 0x80, 0xe0]; -+_T CJK_Radicals_Supplement = [0xa0, 0x2e, 0x80, 0x80, 0x80]; -+_T Meroitic_Hieroglyphs = [0xa1, 0x9, 0x80, 0x20]; -+_T Linear_B_Syllabary = [0xa1, 0x0, 0x0, 0x80, 0x80]; -+_T Phonetic_Extensions_Supplement = [0x9d, 0x80, 0x40]; -+_T Meroitic_Cursive = [0xa1, 0x9, 0xa0, 0x60]; -+_T Enclosed_Ideographic_Supplement = [0xa1, 0xf2, 0x0, 0x81, 0x0]; -+_T Halfwidth_and_Fullwidth_Forms = [0xa0, 0xff, 0x0, 0x80, 0xf0]; -+_T Takri = [0xa1, 0x16, 0x80, 0x50]; -+_T Supplemental_Punctuation = [0xa0, 0x2e, 0x0, 0x80, 0x80]; -+_T Malayalam = [0x8d, 0x0, 0x80, 0x80]; -+_T Lepcha = [0x9c, 0x0, 0x50]; -+_T Miscellaneous_Symbols_And_Pictographs = [0xa1, 0xf3, 0x0, 0x83, 0x0]; -+_T Arabic_Presentation_Forms_A = [0xa0, 0xfb, 0x50, 0x82, 0xb0]; -+_T Sora_Sompeng = [0xa1, 0x10, 0xd0, 0x30]; -+_T Lydian = [0xa1, 0x9, 0x20, 0x20]; -+_T Hangul_Jamo_Extended_B = [0xa0, 0xd7, 0xb0, 0x50]; -+_T Private_Use_Area = [0xa0, 0xe0, 0x0, 0x99, 0x0]; -+_T Coptic = [0xa0, 0x2c, 0x80, 0x80, 0x80]; -+_T Phaistos_Disc = [0xa1, 0x1, 0xd0, 0x30]; -+_T Batak = [0x9b, 0xc0, 0x40]; -+_T Khmer = [0x97, 0x80, 0x80, 0x80]; -+_T Counting_Rod_Numerals = [0xa1, 0xd3, 0x60, 0x20]; -+_T Old_South_Arabian = [0xa1, 0xa, 0x60, 0x20]; -+_T Kannada = [0x8c, 0x80, 0x80, 0x80]; -+_T Arrows = [0xa0, 0x21, 0x90, 0x70]; -+_T CJK_Compatibility_Ideographs_Supplement = [0xa2, 0xf8, 0x0, 0x82, 0x20]; -+_T Combining_Half_Marks = [0xa0, 0xfe, 0x20, 0x10]; -+_T Miscellaneous_Technical = [0xa0, 0x23, 0x0, 0x81, 0x0]; -+_T Thai = [0x8e, 0x0, 0x80, 0x80]; -+_T Alphabetic_Presentation_Forms = [0xa0, 0xfb, 0x0, 0x50]; -+_T CJK_Unified_Ideographs = [0xa0, 0x4e, 0x0, 0xa0, 0x52, 0x0]; -+_T Phonetic_Extensions = [0x9d, 0x0, 0x80, 0x80]; -+_T Kayah_Li = [0xa0, 0xa9, 0x0, 0x30]; -+_T Supplementary_Private_Use_Area_B = [0xb0, 0x0, 0x0]; -+_T Gujarati = [0x8a, 0x80, 0x80, 0x80]; -+_T Unified_Canadian_Aboriginal_Syllabics_Extended = [0x98, 0xb0, 0x50]; -+_T Hangul_Syllables = [0xa0, 0xac, 0x0, 0xa0, 0x2b, 0xb0]; -+_T Vertical_Forms = [0xa0, 0xfe, 0x10, 0x10]; -+_T Inscriptional_Pahlavi = [0xa1, 0xb, 0x60, 0x20]; -+_T Control_Pictures = [0xa0, 0x24, 0x0, 0x40]; -+_T Carian = [0xa1, 0x2, 0xa0, 0x40]; -+_T Mahjong_Tiles = [0xa1, 0xf0, 0x0, 0x30]; -+_T Geometric_Shapes = [0xa0, 0x25, 0xa0, 0x60]; -+_T Cherokee = [0x93, 0xa0, 0x60]; -+_T Imperial_Aramaic = [0xa1, 0x8, 0x40, 0x20]; -+_T Rumi_Numeral_Symbols = [0xa1, 0xe, 0x60, 0x20]; -+_T Combining_Diacritical_Marks = [0x83, 0x0, 0x70]; -+_T Specials = [0xa0, 0xff, 0xf0, 0x10]; -+_T Greek_Extended = [0x9f, 0x0, 0x81, 0x0]; -+_T Ethiopic_Supplement = [0x93, 0x80, 0x20]; -+_T Limbu = [0x99, 0x0, 0x50]; -+_T Basic_Latin = [0x0, 0x80, 0x80]; -+_T Enclosed_Alphanumeric_Supplement = [0xa1, 0xf1, 0x0, 0x81, 0x0]; -+_T Cyrillic_Supplement = [0x85, 0x0, 0x30]; -+_T Hangul_Compatibility_Jamo = [0xa0, 0x31, 0x30, 0x60]; -+_T Supplemental_Arrows_A = [0xa0, 0x27, 0xf0, 0x10]; -+_T Supplemental_Arrows_B = [0xa0, 0x29, 0x0, 0x80, 0x80]; -+_T Katakana = [0xa0, 0x30, 0xa0, 0x60]; -+_T Ancient_Greek_Musical_Notation = [0xa1, 0xd2, 0x0, 0x50]; -+_T CJK_Compatibility = [0xa0, 0x33, 0x0, 0x81, 0x0]; -+_T Old_Persian = [0xa1, 0x3, 0xa0, 0x40]; -+_T Small_Form_Variants = [0xa0, 0xfe, 0x50, 0x20]; -+_T General_Punctuation = [0xa0, 0x20, 0x0, 0x70]; -+_T Miscellaneous_Mathematical_Symbols_A = [0xa0, 0x27, 0xc0, 0x30]; -+_T Latin_Extended_Additional = [0x9e, 0x0, 0x81, 0x0]; -+_T Playing_Cards = [0xa1, 0xf0, 0xa0, 0x60]; -+_T Syriac = [0x87, 0x0, 0x50]; -+_T Alchemical_Symbols = [0xa1, 0xf7, 0x0, 0x80, 0x80]; -+_T Tibetan = [0x8f, 0x0, 0x81, 0x0]; -+_T CJK_Strokes = [0xa0, 0x31, 0xc0, 0x30]; -+_T Tamil = [0x8b, 0x80, 0x80, 0x80]; -+_T Balinese = [0x9b, 0x0, 0x80, 0x80]; -+_T Shavian = [0xa1, 0x4, 0x50, 0x30]; -+_T Greek_and_Coptic = [0x83, 0x70, 0x80, 0x90]; -+_T Telugu = [0x8c, 0x0, 0x80, 0x80]; -+_T Runic = [0x96, 0xa0, 0x60]; -+_T Javanese = [0xa0, 0xa9, 0x80, 0x60]; -+_T Bopomofo_Extended = [0xa0, 0x31, 0xa0, 0x20]; -+_T Ideographic_Description_Characters = [0xa0, 0x2f, 0xf0, 0x10]; -+_T Old_Turkic = [0xa1, 0xc, 0x0, 0x50]; -+_T Unified_Canadian_Aboriginal_Syllabics = [0x94, 0x0, 0x82, 0x80]; -+_T Ugaritic = [0xa1, 0x3, 0x80, 0x20]; -+_T Egyptian_Hieroglyphs = [0xa1, 0x30, 0x0, 0x84, 0x30]; -+_T Buginese = [0x9a, 0x0, 0x20]; -+_T Kangxi_Radicals = [0xa0, 0x2f, 0x0, 0x80, 0xe0]; -+_T Cuneiform = [0xa1, 0x20, 0x0, 0x84, 0x0]; -+_T NKo = [0x87, 0xc0, 0x40]; -+_T Sundanese_Supplement = [0x9c, 0xc0, 0x10]; -+_T Buhid = [0x97, 0x40, 0x20]; -+_T Modifier_Tone_Letters = [0xa0, 0xa7, 0x0, 0x20]; -+_T Kanbun = [0xa0, 0x31, 0x90, 0x10]; -+_T Superscripts_and_Subscripts = [0xa0, 0x20, 0x70, 0x30]; -+_T Lao = [0x8e, 0x80, 0x80, 0x80]; -+_T Ol_Chiki = [0x9c, 0x50, 0x30]; -+_T Common_Indic_Number_Forms = [0xa0, 0xa8, 0x30, 0x10]; -+_T Hangul_Jamo_Extended_A = [0xa0, 0xa9, 0x60, 0x20]; -+_T Arabic_Presentation_Forms_B = [0xa0, 0xfe, 0x70, 0x80, 0x90]; -+_T Sharada = [0xa1, 0x11, 0x80, 0x60]; -+_T Miscellaneous_Symbols = [0xa0, 0x26, 0x0, 0x81, 0x0]; -+_T Variation_Selectors_Supplement = [0xae, 0x1, 0x0, 0x80, 0xf0]; -+_T Rejang = [0xa0, 0xa9, 0x30, 0x30]; -+_T Georgian_Supplement = [0xa0, 0x2d, 0x0, 0x30]; -+_T Braille_Patterns = [0xa0, 0x28, 0x0, 0x81, 0x0]; -+_T Lycian = [0xa1, 0x2, 0x80, 0x20]; -+_T Tai_Le = [0x99, 0x50, 0x30]; -+_T Miscellaneous_Mathematical_Symbols_B = [0xa0, 0x29, 0x80, 0x80, 0x80]; -+_T Musical_Symbols = [0xa1, 0xd1, 0x0, 0x81, 0x0]; -+_T Avestan = [0xa1, 0xb, 0x0, 0x40]; -+_T Ethiopic = [0x92, 0x0, 0x81, 0x80]; -+_T Arabic_Supplement = [0x87, 0x50, 0x30]; -+_T Samaritan = [0x88, 0x0, 0x40]; -+_T Cuneiform_Numbers_and_Punctuation = [0xa1, 0x24, 0x0, 0x80, 0x80]; -+_T Mongolian = [0x98, 0x0, 0x80, 0xb0]; -+_T Arabic = [0x86, 0x0, 0x81, 0x0]; -+_T Vai = [0xa0, 0xa5, 0x0, 0x81, 0x40]; -+_T Tifinagh = [0xa0, 0x2d, 0x30, 0x50]; -+_T Bamum_Supplement = [0xa1, 0x68, 0x0, 0x82, 0x40]; -+_T Tai_Viet = [0xa0, 0xaa, 0x80, 0x60]; -+_T Mandaic = [0x88, 0x40, 0x20]; -+_T Sundanese = [0x9b, 0x80, 0x40]; -+_T Block_Elements = [0xa0, 0x25, 0x80, 0x20]; -+_T Phoenician = [0xa1, 0x9, 0x0, 0x20]; -+_T Hanunoo = [0x97, 0x20, 0x20]; -+_T Supplemental_Mathematical_Operators = [0xa0, 0x2a, 0x0, 0x81, 0x0]; -+_T Deseret = [0xa1, 0x4, 0x0, 0x50]; -+_T Brahmi = [0xa1, 0x10, 0x0, 0x80, 0x80]; -+_T Devanagari_Extended = [0xa0, 0xa8, 0xe0, 0x20]; -+_T Supplementary_Private_Use_Area_A = [0xaf, 0x0, 0x0, 0xa1, 0x0, 0x0]; -+_T Box_Drawing = [0xa0, 0x25, 0x0, 0x80, 0x80]; -+_T Mathematical_Operators = [0xa0, 0x22, 0x0, 0x81, 0x0]; -+_T Ogham = [0x96, 0x80, 0x20]; -+_T Meetei_Mayek_Extensions = [0xa0, 0xaa, 0xe0, 0x20]; -+_T Hangul_Jamo = [0x91, 0x0, 0x81, 0x0]; -+_T Miao = [0xa1, 0x6f, 0x0, 0x80, 0xa0]; -+_T Emoticons = [0xa1, 0xf6, 0x0, 0x50]; -+_T Tags = [0xae, 0x0, 0x0, 0x80, 0x80]; -+_T Yi_Syllables = [0xa0, 0xa0, 0x0, 0x84, 0x90]; -+_T Gurmukhi = [0x8a, 0x0, 0x80, 0x80]; -+_T Syloti_Nagri = [0xa0, 0xa8, 0x0, 0x30]; -+_T Spacing_Modifier_Letters = [0x82, 0xb0, 0x50]; -+_T Yi_Radicals = [0xa0, 0xa4, 0x90, 0x40]; -+_T Ancient_Greek_Numbers = [0xa1, 0x1, 0x40, 0x50]; -+_T Glagolitic = [0xa0, 0x2c, 0x0, 0x60]; -+_T Georgian = [0x90, 0xa0, 0x60]; -+_T Osmanya = [0xa1, 0x4, 0x80, 0x30]; -+_T Variation_Selectors = [0xa0, 0xfe, 0x0, 0x10]; -+_T Mathematical_Alphanumeric_Symbols = [0xa1, 0xd4, 0x0, 0x84, 0x0]; -+_T Yijing_Hexagram_Symbols = [0xa0, 0x4d, 0xc0, 0x40]; -+_T Ethiopic_Extended = [0xa0, 0x2d, 0x80, 0x60]; -+_T Transport_And_Map_Symbols = [0xa1, 0xf6, 0x80, 0x80, 0x80]; -+_T High_Private_Use_Surrogates = [0xa0, 0xdb, 0x80, 0x80, 0x80]; -+_T Meetei_Mayek = [0xa0, 0xab, 0xc0, 0x40]; -+_T CJK_Compatibility_Forms = [0xa0, 0xfe, 0x30, 0x20]; -+_T Enclosed_Alphanumerics = [0xa0, 0x24, 0x60, 0x80, 0xa0]; -+_T Ancient_Symbols = [0xa1, 0x1, 0x90, 0x40]; -+_T Ethiopic_Extended_A = [0xa0, 0xab, 0x0, 0x30]; -+_T Bengali = [0x89, 0x80, 0x80, 0x80]; -+_T Currency_Symbols = [0xa0, 0x20, 0xa0, 0x30]; -+_T Myanmar = [0x90, 0x0, 0x80, 0xa0]; -+_T Cyrillic_Extended_A = [0xa0, 0x2d, 0xe0, 0x20]; -+_T Cyrillic_Extended_B = [0xa0, 0xa6, 0x40, 0x60]; -+_T Myanmar_Extended_A = [0xa0, 0xaa, 0x60, 0x20]; -+_T Hiragana = [0xa0, 0x30, 0x40, 0x60]; -+_T Dingbats = [0xa0, 0x27, 0x0, 0x80, 0xc0]; -+_T Armenian = [0x85, 0x30, 0x60]; -+_T Tai_Xuan_Jing_Symbols = [0xa1, 0xd3, 0x0, 0x60]; -+_T Linear_B_Ideograms = [0xa1, 0x0, 0x80, 0x80, 0x80]; -+_T Kharoshthi = [0xa1, 0xa, 0x0, 0x60]; -+_T Optical_Character_Recognition = [0xa0, 0x24, 0x40, 0x20]; -+_T Enclosed_CJK_Letters_and_Months = [0xa0, 0x32, 0x0, 0x81, 0x0]; -+_T Cypriot_Syllabary = [0xa1, 0x8, 0x0, 0x40]; -+_T Vedic_Extensions = [0x9c, 0xd0, 0x30]; -+_T Kaithi = [0xa1, 0x10, 0x80, 0x50]; -+_T Low_Surrogates = [0xa0, 0xdc, 0x0, 0x84, 0x0]; -+_T Letterlike_Symbols = [0xa0, 0x21, 0x0, 0x50]; -+_T Combining_Diacritical_Marks_for_Symbols = [0xa0, 0x20, 0xd0, 0x30]; -+_T Aegean_Numbers = [0xa1, 0x1, 0x0, 0x40]; -+_T High_Surrogates = [0xa0, 0xd8, 0x0, 0x83, 0x80]; -+_T CJK_Compatibility_Ideographs = [0xa0, 0xf9, 0x0, 0x82, 0x0]; -+_T CJK_Symbols_and_Punctuation = [0xa0, 0x30, 0x0, 0x40]; -+_T Gothic = [0xa1, 0x3, 0x30, 0x20]; -+_T Combining_Diacritical_Marks_Supplement = [0x9d, 0xc0, 0x40]; -+_T Phags_pa = [0xa0, 0xa8, 0x40, 0x40]; -+_T Miscellaneous_Symbols_and_Arrows = [0xa0, 0x2b, 0x0, 0x81, 0x0]; -+_T Bamum = [0xa0, 0xa6, 0xa0, 0x60]; -+_T Chakma = [0xa1, 0x11, 0x0, 0x50]; -+_T Kana_Supplement = [0xa1, 0xb0, 0x0, 0x81, 0x0]; -+_T Tagalog = [0x97, 0x0, 0x20]; -+_T Tagbanwa = [0x97, 0x60, 0x20]; -+_T Devanagari = [0x89, 0x0, 0x80, 0x80]; -+_T Old_Italic = [0xa1, 0x3, 0x0, 0x30]; -+_T Arabic_Mathematical_Alphabetic_Symbols = [0xa1, 0xee, 0x0, 0x81, 0x0]; -+_T CJK_Unified_Ideographs_Extension_D = [0xa2, 0xb7, 0x40, 0x80, 0xe0]; -+_T CJK_Unified_Ideographs_Extension_A = [0xa0, 0x34, 0x0, 0x99, 0xc0]; -+_T CJK_Unified_Ideographs_Extension_B = [0xa2, 0x0, 0x0, 0xa0, 0xa6, 0xe0]; -+_T CJK_Unified_Ideographs_Extension_C = [0xa2, 0xa7, 0x0, 0x90, 0x40]; -+_T Cyrillic = [0x84, 0x0, 0x81, 0x0]; -+_U[] _tab = [ -+_U("Aegean Numbers", Aegean_Numbers), -+_U("Alchemical Symbols", Alchemical_Symbols), -+_U("Alphabetic Presentation Forms", Alphabetic_Presentation_Forms), -+_U("Ancient Greek Musical Notation", Ancient_Greek_Musical_Notation), -+_U("Ancient Greek Numbers", Ancient_Greek_Numbers), -+_U("Ancient Symbols", Ancient_Symbols), -+_U("Arabic", Arabic), -+_U("Arabic Extended-A", Arabic_Extended_A), -+_U("Arabic Mathematical Alphabetic Symbols", Arabic_Mathematical_Alphabetic_Symbols), -+_U("Arabic Presentation Forms-A", Arabic_Presentation_Forms_A), -+_U("Arabic Presentation Forms-B", Arabic_Presentation_Forms_B), -+_U("Arabic Supplement", Arabic_Supplement), -+_U("Armenian", Armenian), -+_U("Arrows", Arrows), -+_U("Avestan", Avestan), -+_U("Balinese", Balinese), -+_U("Bamum", Bamum), -+_U("Bamum Supplement", Bamum_Supplement), -+_U("Basic Latin", Basic_Latin), -+_U("Batak", Batak), -+_U("Bengali", Bengali), -+_U("Block Elements", Block_Elements), -+_U("Bopomofo", Bopomofo), -+_U("Bopomofo Extended", Bopomofo_Extended), -+_U("Box Drawing", Box_Drawing), -+_U("Brahmi", Brahmi), -+_U("Braille Patterns", Braille_Patterns), -+_U("Buginese", Buginese), -+_U("Buhid", Buhid), -+_U("Byzantine Musical Symbols", Byzantine_Musical_Symbols), -+_U("Carian", Carian), -+_U("Chakma", Chakma), -+_U("Cham", Cham), -+_U("Cherokee", Cherokee), -+_U("CJK Compatibility", CJK_Compatibility), -+_U("CJK Compatibility Forms", CJK_Compatibility_Forms), -+_U("CJK Compatibility Ideographs", CJK_Compatibility_Ideographs), -+_U("CJK Compatibility Ideographs Supplement", CJK_Compatibility_Ideographs_Supplement), -+_U("CJK Radicals Supplement", CJK_Radicals_Supplement), -+_U("CJK Strokes", CJK_Strokes), -+_U("CJK Symbols and Punctuation", CJK_Symbols_and_Punctuation), -+_U("CJK Unified Ideographs", CJK_Unified_Ideographs), -+_U("CJK Unified Ideographs Extension A", CJK_Unified_Ideographs_Extension_A), -+_U("CJK Unified Ideographs Extension B", CJK_Unified_Ideographs_Extension_B), -+_U("CJK Unified Ideographs Extension C", CJK_Unified_Ideographs_Extension_C), -+_U("CJK Unified Ideographs Extension D", CJK_Unified_Ideographs_Extension_D), -+_U("Combining Diacritical Marks", Combining_Diacritical_Marks), -+_U("Combining Diacritical Marks for Symbols", Combining_Diacritical_Marks_for_Symbols), -+_U("Combining Diacritical Marks Supplement", Combining_Diacritical_Marks_Supplement), -+_U("Combining Half Marks", Combining_Half_Marks), -+_U("Common Indic Number Forms", Common_Indic_Number_Forms), -+_U("Control Pictures", Control_Pictures), -+_U("Coptic", Coptic), -+_U("Counting Rod Numerals", Counting_Rod_Numerals), -+_U("Cuneiform", Cuneiform), -+_U("Cuneiform Numbers and Punctuation", Cuneiform_Numbers_and_Punctuation), -+_U("Currency Symbols", Currency_Symbols), -+_U("Cypriot Syllabary", Cypriot_Syllabary), -+_U("Cyrillic", Cyrillic), -+_U("Cyrillic Extended-A", Cyrillic_Extended_A), -+_U("Cyrillic Extended-B", Cyrillic_Extended_B), -+_U("Cyrillic Supplement", Cyrillic_Supplement), -+_U("Deseret", Deseret), -+_U("Devanagari", Devanagari), -+_U("Devanagari Extended", Devanagari_Extended), -+_U("Dingbats", Dingbats), -+_U("Domino Tiles", Domino_Tiles), -+_U("Egyptian Hieroglyphs", Egyptian_Hieroglyphs), -+_U("Emoticons", Emoticons), -+_U("Enclosed Alphanumerics", Enclosed_Alphanumerics), -+_U("Enclosed Alphanumeric Supplement", Enclosed_Alphanumeric_Supplement), -+_U("Enclosed CJK Letters and Months", Enclosed_CJK_Letters_and_Months), -+_U("Enclosed Ideographic Supplement", Enclosed_Ideographic_Supplement), -+_U("Ethiopic", Ethiopic), -+_U("Ethiopic Extended", Ethiopic_Extended), -+_U("Ethiopic Extended-A", Ethiopic_Extended_A), -+_U("Ethiopic Supplement", Ethiopic_Supplement), -+_U("General Punctuation", General_Punctuation), -+_U("Geometric Shapes", Geometric_Shapes), -+_U("Georgian", Georgian), -+_U("Georgian Supplement", Georgian_Supplement), -+_U("Glagolitic", Glagolitic), -+_U("Gothic", Gothic), -+_U("Greek and Coptic", Greek_and_Coptic), -+_U("Greek Extended", Greek_Extended), -+_U("Gujarati", Gujarati), -+_U("Gurmukhi", Gurmukhi), -+_U("Halfwidth and Fullwidth Forms", Halfwidth_and_Fullwidth_Forms), -+_U("Hangul Compatibility Jamo", Hangul_Compatibility_Jamo), -+_U("Hangul Jamo", Hangul_Jamo), -+_U("Hangul Jamo Extended-A", Hangul_Jamo_Extended_A), -+_U("Hangul Jamo Extended-B", Hangul_Jamo_Extended_B), -+_U("Hangul Syllables", Hangul_Syllables), -+_U("Hanunoo", Hanunoo), -+_U("Hebrew", Hebrew), -+_U("High Private Use Surrogates", High_Private_Use_Surrogates), -+_U("High Surrogates", High_Surrogates), -+_U("Hiragana", Hiragana), -+_U("Ideographic Description Characters", Ideographic_Description_Characters), -+_U("Imperial Aramaic", Imperial_Aramaic), -+_U("Inscriptional Pahlavi", Inscriptional_Pahlavi), -+_U("Inscriptional Parthian", Inscriptional_Parthian), -+_U("IPA Extensions", IPA_Extensions), -+_U("Javanese", Javanese), -+_U("Kaithi", Kaithi), -+_U("Kana Supplement", Kana_Supplement), -+_U("Kanbun", Kanbun), -+_U("Kangxi Radicals", Kangxi_Radicals), -+_U("Kannada", Kannada), -+_U("Katakana", Katakana), -+_U("Katakana Phonetic Extensions", Katakana_Phonetic_Extensions), -+_U("Kayah Li", Kayah_Li), -+_U("Kharoshthi", Kharoshthi), -+_U("Khmer", Khmer), -+_U("Khmer Symbols", Khmer_Symbols), -+_U("Lao", Lao), -+_U("Latin-1 Supplement", Latin_1_Supplement), -+_U("Latin Extended-A", Latin_Extended_A), -+_U("Latin Extended Additional", Latin_Extended_Additional), -+_U("Latin Extended-B", Latin_Extended_B), -+_U("Latin Extended-C", Latin_Extended_C), -+_U("Latin Extended-D", Latin_Extended_D), -+_U("Lepcha", Lepcha), -+_U("Letterlike Symbols", Letterlike_Symbols), -+_U("Limbu", Limbu), -+_U("Linear B Ideograms", Linear_B_Ideograms), -+_U("Linear B Syllabary", Linear_B_Syllabary), -+_U("Lisu", Lisu), -+_U("Low Surrogates", Low_Surrogates), -+_U("Lycian", Lycian), -+_U("Lydian", Lydian), -+_U("Mahjong Tiles", Mahjong_Tiles), -+_U("Malayalam", Malayalam), -+_U("Mandaic", Mandaic), -+_U("Mathematical Alphanumeric Symbols", Mathematical_Alphanumeric_Symbols), -+_U("Mathematical Operators", Mathematical_Operators), -+_U("Meetei Mayek", Meetei_Mayek), -+_U("Meetei Mayek Extensions", Meetei_Mayek_Extensions), -+_U("Meroitic Cursive", Meroitic_Cursive), -+_U("Meroitic Hieroglyphs", Meroitic_Hieroglyphs), -+_U("Miao", Miao), -+_U("Miscellaneous Mathematical Symbols-A", Miscellaneous_Mathematical_Symbols_A), -+_U("Miscellaneous Mathematical Symbols-B", Miscellaneous_Mathematical_Symbols_B), -+_U("Miscellaneous Symbols", Miscellaneous_Symbols), -+_U("Miscellaneous Symbols and Arrows", Miscellaneous_Symbols_and_Arrows), -+_U("Miscellaneous Symbols And Pictographs", Miscellaneous_Symbols_And_Pictographs), -+_U("Miscellaneous Technical", Miscellaneous_Technical), -+_U("Modifier Tone Letters", Modifier_Tone_Letters), -+_U("Mongolian", Mongolian), -+_U("Musical Symbols", Musical_Symbols), -+_U("Myanmar", Myanmar), -+_U("Myanmar Extended-A", Myanmar_Extended_A), -+_U("New Tai Lue", New_Tai_Lue), -+_U("NKo", NKo), -+_U("Number Forms", Number_Forms), -+_U("Ogham", Ogham), -+_U("Ol Chiki", Ol_Chiki), -+_U("Old Italic", Old_Italic), -+_U("Old Persian", Old_Persian), -+_U("Old South Arabian", Old_South_Arabian), -+_U("Old Turkic", Old_Turkic), -+_U("Optical Character Recognition", Optical_Character_Recognition), -+_U("Oriya", Oriya), -+_U("Osmanya", Osmanya), -+_U("Phags-pa", Phags_pa), -+_U("Phaistos Disc", Phaistos_Disc), -+_U("Phoenician", Phoenician), -+_U("Phonetic Extensions", Phonetic_Extensions), -+_U("Phonetic Extensions Supplement", Phonetic_Extensions_Supplement), -+_U("Playing Cards", Playing_Cards), -+_U("Private Use Area", Private_Use_Area), -+_U("Rejang", Rejang), -+_U("Rumi Numeral Symbols", Rumi_Numeral_Symbols), -+_U("Runic", Runic), -+_U("Samaritan", Samaritan), -+_U("Saurashtra", Saurashtra), -+_U("Sharada", Sharada), -+_U("Shavian", Shavian), -+_U("Sinhala", Sinhala), -+_U("Small Form Variants", Small_Form_Variants), -+_U("Sora Sompeng", Sora_Sompeng), -+_U("Spacing Modifier Letters", Spacing_Modifier_Letters), -+_U("Specials", Specials), -+_U("Sundanese", Sundanese), -+_U("Sundanese Supplement", Sundanese_Supplement), -+_U("Superscripts and Subscripts", Superscripts_and_Subscripts), -+_U("Supplemental Arrows-A", Supplemental_Arrows_A), -+_U("Supplemental Arrows-B", Supplemental_Arrows_B), -+_U("Supplemental Mathematical Operators", Supplemental_Mathematical_Operators), -+_U("Supplemental Punctuation", Supplemental_Punctuation), -+_U("Supplementary Private Use Area-A", Supplementary_Private_Use_Area_A), -+_U("Supplementary Private Use Area-B", Supplementary_Private_Use_Area_B), -+_U("Syloti Nagri", Syloti_Nagri), -+_U("Syriac", Syriac), -+_U("Tagalog", Tagalog), -+_U("Tagbanwa", Tagbanwa), -+_U("Tags", Tags), -+_U("Tai Le", Tai_Le), -+_U("Tai Tham", Tai_Tham), -+_U("Tai Viet", Tai_Viet), -+_U("Tai Xuan Jing Symbols", Tai_Xuan_Jing_Symbols), -+_U("Takri", Takri), -+_U("Tamil", Tamil), -+_U("Telugu", Telugu), -+_U("Thaana", Thaana), -+_U("Thai", Thai), -+_U("Tibetan", Tibetan), -+_U("Tifinagh", Tifinagh), -+_U("Transport And Map Symbols", Transport_And_Map_Symbols), -+_U("Ugaritic", Ugaritic), -+_U("Unified Canadian Aboriginal Syllabics", Unified_Canadian_Aboriginal_Syllabics), -+_U("Unified Canadian Aboriginal Syllabics Extended", Unified_Canadian_Aboriginal_Syllabics_Extended), -+_U("Vai", Vai), -+_U("Variation Selectors", Variation_Selectors), -+_U("Variation Selectors Supplement", Variation_Selectors_Supplement), -+_U("Vedic Extensions", Vedic_Extensions), -+_U("Vertical Forms", Vertical_Forms), -+_U("Yijing Hexagram Symbols", Yijing_Hexagram_Symbols), -+_U("Yi Radicals", Yi_Radicals), -+_U("Yi Syllables", Yi_Syllables), -+]; -+} -+ -+struct scripts -+{ -+private alias _U = immutable(UnicodeProperty); -+@property static _U[] tab() { return _tab; } -+static immutable: -+private alias _T = ubyte[]; -+_T Buhid = [0x97, 0x40, 0x14]; -+_T Sinhala = [0x8d, 0x82, 0x2, 0x1, 0x12, 0x3, 0x18, 0x1, 0x9, 0x1, 0x1, 0x2, 0x7, 0x3, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x8, 0x12, 0x3]; -+_T Phags_Pa = [0xa0, 0xa8, 0x40, 0x38]; -+_T Old_Turkic = [0xa1, 0xc, 0x0, 0x49]; -+_T Oriya = [0x8b, 0x1, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0x9, 0x2, 0x2, 0x2, 0x3, 0x8, 0x2, 0x4, 0x2, 0x1, 0x5, 0x2, 0x12]; -+_T Thaana = [0x87, 0x80, 0x32]; -+_T Inherited = [0x83, 0x0, 0x70, 0x81, 0x15, 0x2, 0x81, 0xc4, 0xb, 0x1a, 0x1, 0x82, 0xe0, 0x2, 0x93, 0x7d, 0x3, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x80, 0xcb, 0x27, 0x15, 0x4, 0x82, 0xc, 0x2, 0x80, 0xc2, 0x21, 0x8f, 0x39, 0x4, 0x6b, 0x2, 0xa0, 0xcd, 0x65, 0x10, 0x10, 0x7, 0x83, 0xd6, 0x1, 0xa0, 0xcf, 0x69, 0x3, 0x11, 0x8, 0x2, 0x7, 0x1e, 0x4, 0xac, 0x2f, 0x52, 0x80, 0xf0]; -+_T Sharada = [0xa1, 0x11, 0x80, 0x49, 0x7, 0xa]; -+_T Rejang = [0xa0, 0xa9, 0x30, 0x24, 0xb, 0x1]; -+_T Imperial_Aramaic = [0xa1, 0x8, 0x40, 0x16, 0x1, 0x9]; -+_T Cham = [0xa0, 0xaa, 0x0, 0x37, 0x9, 0xe, 0x2, 0xa, 0x2, 0x4]; -+_T Kaithi = [0xa1, 0x10, 0x80, 0x42]; -+_T Bopomofo = [0x82, 0xea, 0x2, 0xa0, 0x2e, 0x19, 0x29, 0x72, 0x1b]; -+_T Deseret = [0xa1, 0x4, 0x0, 0x50]; -+_T Syloti_Nagri = [0xa0, 0xa8, 0x0, 0x2c]; -+_T Lycian = [0xa1, 0x2, 0x80, 0x1d]; -+_T Linear_B = [0xa1, 0x0, 0x0, 0xc, 0x1, 0x1a, 0x1, 0x13, 0x1, 0x2, 0x1, 0xf, 0x2, 0xe, 0x22, 0x7b]; -+_T Hebrew = [0x85, 0x91, 0x37, 0x8, 0x1b, 0x5, 0x5, 0xa0, 0xf5, 0x28, 0x1a, 0x1, 0x5, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x1, 0xa]; -+_T Saurashtra = [0xa0, 0xa8, 0x80, 0x45, 0x9, 0xc]; -+_T Avestan = [0xa1, 0xb, 0x0, 0x36, 0x3, 0x7]; -+_T Ethiopic = [0x92, 0x0, 0x49, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0x29, 0x1, 0x4, 0x2, 0x21, 0x1, 0x4, 0x2, 0x7, 0x1, 0x1, 0x1, 0x4, 0x2, 0xf, 0x1, 0x39, 0x1, 0x4, 0x2, 0x43, 0x2, 0x20, 0x3, 0x1a, 0x99, 0xe6, 0x17, 0x9, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x7, 0xa0, 0x7d, 0x22, 0x6, 0x2, 0x6, 0x2, 0x6, 0x9, 0x7, 0x1, 0x7]; -+_T Braille = [0xa0, 0x28, 0x0, 0x81, 0x0]; -+_T Lisu = [0xa0, 0xa4, 0xd0, 0x30]; -+_T Samaritan = [0x88, 0x0, 0x2e, 0x2, 0xf]; -+_T Mongolian = [0x98, 0x0, 0x2, 0x2, 0x1, 0x1, 0x9, 0x1, 0xa, 0x6, 0x58, 0x8, 0x2b]; -+_T Hangul = [0x91, 0x0, 0x81, 0x0, 0x9e, 0x2e, 0x2, 0x81, 0x1, 0x5e, 0x71, 0x1f, 0x41, 0x1f, 0xa0, 0x76, 0xe1, 0x1d, 0x82, 0x83, 0xa0, 0x2b, 0xa4, 0xc, 0x17, 0x4, 0x31, 0xa0, 0x27, 0xa4, 0x1f, 0x3, 0x6, 0x2, 0x6, 0x2, 0x6, 0x2, 0x3]; -+_T Takri = [0xa1, 0x16, 0x80, 0x38, 0x8, 0xa]; -+_T Phoenician = [0xa1, 0x9, 0x0, 0x1c, 0x3, 0x1]; -+_T Vai = [0xa0, 0xa5, 0x0, 0x81, 0x2c]; -+_T Batak = [0x9b, 0xc0, 0x34, 0x8, 0x4]; -+_T Yi = [0xa0, 0xa0, 0x0, 0x84, 0x8d, 0x3, 0x37]; -+_T Tifinagh = [0xa0, 0x2d, 0x30, 0x38, 0x7, 0x2, 0xe, 0x1]; -+_T Glagolitic = [0xa0, 0x2c, 0x0, 0x2f, 0x1, 0x2f]; -+_T Tai_Tham = [0x9a, 0x20, 0x3f, 0x1, 0x1d, 0x2, 0xb, 0x6, 0xa, 0x6, 0xe]; -+_T Canadian_Aboriginal = [0x94, 0x0, 0x82, 0x80, 0x82, 0x30, 0x46]; -+_T Meetei_Mayek = [0xa0, 0xaa, 0xe0, 0x17, 0x80, 0xc9, 0x2e, 0x2, 0xa]; -+_T Balinese = [0x9b, 0x0, 0x4c, 0x4, 0x2d]; -+_T Kayah_Li = [0xa0, 0xa9, 0x0, 0x30]; -+_T Kharoshthi = [0xa1, 0xa, 0x0, 0x4, 0x1, 0x2, 0x5, 0x8, 0x1, 0x3, 0x1, 0x1b, 0x4, 0x3, 0x4, 0x9, 0x8, 0x9]; -+_T Lepcha = [0x9c, 0x0, 0x38, 0x3, 0xf, 0x3, 0x3]; -+_T New_Tai_Lue = [0x99, 0x80, 0x2c, 0x4, 0x1a, 0x6, 0xb, 0x3, 0x2]; -+_T Sora_Sompeng = [0xa1, 0x10, 0xd0, 0x19, 0x7, 0xa]; -+_T Arabic = [0x86, 0x0, 0x5, 0x1, 0x6, 0x1, 0xe, 0x1, 0x1, 0x1, 0x1, 0x1, 0x20, 0x1, 0xa, 0xb, 0xa, 0xa, 0x6, 0x1, 0x6c, 0x1, 0x22, 0x50, 0x30, 0x81, 0x20, 0x1, 0x1, 0xb, 0x37, 0x1b, 0xa0, 0xf2, 0x51, 0x72, 0x11, 0x81, 0x6b, 0x12, 0x40, 0x2, 0x36, 0x28, 0xd, 0x73, 0x5, 0x1, 0x80, 0x87, 0x8f, 0x63, 0x1f, 0xa0, 0xdf, 0x81, 0x4, 0x1, 0x1b, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0xa, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x6, 0x1, 0x4, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4, 0x1, 0x7, 0x1, 0x4, 0x1, 0x4, 0x1, 0x1, 0x1, 0xa, 0x1, 0x11, 0x5, 0x3, 0x1, 0x5, 0x1, 0x11, 0x34, 0x2]; -+_T Hanunoo = [0x97, 0x20, 0x15]; -+_T Lydian = [0xa1, 0x9, 0x20, 0x1a, 0x5, 0x1]; -+_T Tai_Viet = [0xa0, 0xaa, 0x80, 0x43, 0x18, 0x5]; -+_T Coptic = [0x83, 0xe2, 0xe, 0xa0, 0x28, 0x90, 0x74, 0x5, 0x7]; -+_T Brahmi = [0xa1, 0x10, 0x0, 0x4e, 0x4, 0x1e]; -+_T Runic = [0x96, 0xa0, 0x4b, 0x3, 0x3]; -+_T Egyptian_Hieroglyphs = [0xa1, 0x30, 0x0, 0x84, 0x2f]; -+_T Khmer = [0x97, 0x80, 0x5e, 0x2, 0xa, 0x6, 0xa, 0x81, 0xe6, 0x20]; -+_T Ogham = [0x96, 0x80, 0x1d]; -+_T Gothic = [0xa1, 0x3, 0x30, 0x1b]; -+_T Katakana = [0xa0, 0x30, 0xa1, 0x5a, 0x2, 0x3, 0x80, 0xf0, 0x10, 0x80, 0xd0, 0x2f, 0x1, 0x58, 0xa0, 0xcc, 0xe, 0xa, 0x1, 0x2d, 0xa0, 0xb0, 0x62, 0x1]; -+_T Miao = [0xa1, 0x6f, 0x0, 0x45, 0xb, 0x2f, 0x10, 0x11]; -+_T Meroitic_Hieroglyphs = [0xa1, 0x9, 0x80, 0x20]; -+_T Thai = [0x8e, 0x1, 0x3a, 0x5, 0x1c]; -+_T Cypriot = [0xa1, 0x8, 0x0, 0x6, 0x2, 0x1, 0x1, 0x2c, 0x1, 0x2, 0x3, 0x1, 0x2, 0x1]; -+_T Meroitic_Cursive = [0xa1, 0x9, 0xa0, 0x18, 0x6, 0x2]; -+_T Gujarati = [0x8a, 0x81, 0x3, 0x1, 0x9, 0x1, 0x3, 0x1, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x5, 0x2, 0xa, 0x1, 0x3, 0x1, 0x3, 0x2, 0x1, 0xf, 0x4, 0x2, 0xc]; -+_T Lao = [0x8e, 0x81, 0x2, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x2, 0x1, 0x6, 0x4, 0x1, 0x7, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0xd, 0x1, 0x3, 0x2, 0x5, 0x1, 0x1, 0x1, 0x6, 0x2, 0xa, 0x2, 0x4]; -+_T Georgian = [0x90, 0xa0, 0x26, 0x1, 0x1, 0x5, 0x1, 0x2, 0x2b, 0x1, 0x4, 0x9c, 0x0, 0x26, 0x1, 0x1, 0x5, 0x1]; -+_T Osmanya = [0xa1, 0x4, 0x80, 0x1e, 0x2, 0xa]; -+_T Inscriptional_Pahlavi = [0xa1, 0xb, 0x60, 0x13, 0x5, 0x8]; -+_T Shavian = [0xa1, 0x4, 0x50, 0x30]; -+_T Carian = [0xa1, 0x2, 0xa0, 0x31]; -+_T Cherokee = [0x93, 0xa0, 0x55]; -+_T Mandaic = [0x88, 0x40, 0x1c, 0x2, 0x1]; -+_T Han = [0xa0, 0x2e, 0x80, 0x1a, 0x1, 0x59, 0xc, 0x80, 0xd6, 0x2f, 0x1, 0x1, 0x1, 0x19, 0x9, 0xe, 0x4, 0x83, 0xc4, 0x99, 0xb6, 0x4a, 0xa0, 0x51, 0xcd, 0xa0, 0x59, 0x33, 0x81, 0x6e, 0x2, 0x6a, 0xa1, 0x5, 0x26, 0xa0, 0xa6, 0xd7, 0x29, 0x90, 0x35, 0xb, 0x80, 0xde, 0xa0, 0x3f, 0xe2, 0x82, 0x1e]; -+_T Latin = [0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xf, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xc1, 0x27, 0x5, 0x9a, 0x1b, 0x26, 0x6, 0x31, 0x5, 0x4, 0x5, 0xd, 0x1, 0x46, 0x41, 0x81, 0x0, 0x81, 0x71, 0x1, 0xd, 0x1, 0x10, 0xd, 0x80, 0x8d, 0x2, 0x6, 0x1, 0x1b, 0x1, 0x11, 0x29, 0x8a, 0xd7, 0x20, 0xa0, 0x7a, 0xa2, 0x66, 0x3, 0x4, 0x1, 0x4, 0xc, 0xb, 0x4d, 0x8, 0xa0, 0x53, 0x0, 0x7, 0x84, 0x1a, 0x1a, 0x6, 0x1a]; -+_T Limbu = [0x99, 0x0, 0x1d, 0x3, 0xc, 0x4, 0xc, 0x4, 0x1, 0x3, 0xc]; -+_T Ol_Chiki = [0x9c, 0x50, 0x30]; -+_T Bengali = [0x89, 0x81, 0x3, 0x1, 0x8, 0x2, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x1, 0x3, 0x4, 0x2, 0x9, 0x2, 0x2, 0x2, 0x4, 0x8, 0x1, 0x4, 0x2, 0x1, 0x5, 0x2, 0x16]; -+_T Myanmar = [0x90, 0x0, 0x80, 0xa0, 0xa0, 0x99, 0xc0, 0x1c]; -+_T Malayalam = [0x8d, 0x2, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x29, 0x2, 0x8, 0x1, 0x3, 0x1, 0x5, 0x8, 0x1, 0x8, 0x4, 0x2, 0x10, 0x3, 0x7]; -+_T Hiragana = [0xa0, 0x30, 0x41, 0x56, 0x6, 0x3, 0xa1, 0x7f, 0x61, 0x1, 0xa0, 0x41, 0xfe, 0x1]; -+_T Kannada = [0x8c, 0x82, 0x2, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x2, 0x9, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x7, 0x1, 0x1, 0x4, 0x2, 0xa, 0x1, 0x2]; -+_T Armenian = [0x85, 0x31, 0x26, 0x2, 0x7, 0x1, 0x27, 0x2, 0x1, 0x4, 0x1, 0xa0, 0xf5, 0x83, 0x5]; -+_T Common = [0x0, 0x41, 0x1a, 0x6, 0x1a, 0x2f, 0x1, 0xf, 0x1, 0x5, 0x17, 0x1, 0x1f, 0x1, 0x81, 0xc1, 0x27, 0x5, 0x5, 0x2, 0x14, 0x74, 0x1, 0x9, 0x1, 0x6, 0x1, 0x1, 0x1, 0x82, 0x1, 0x1, 0x80, 0x82, 0x1, 0xe, 0x1, 0x3, 0x1, 0x20, 0x1, 0x1f, 0xa, 0x73, 0x1, 0x82, 0x86, 0x2, 0x84, 0xd9, 0x1, 0x81, 0x95, 0x4, 0x81, 0x22, 0x1, 0x85, 0xef, 0x3, 0x47, 0x2, 0x80, 0xcb, 0x2, 0x1, 0x1, 0x84, 0xcd, 0x1, 0xd, 0x1, 0x7, 0x4, 0x1, 0x6, 0x1, 0x2, 0x83, 0x9, 0xc, 0x2, 0x57, 0x1, 0xb, 0x3, 0xb, 0x1, 0xf, 0x11, 0x1b, 0x45, 0x26, 0x1, 0x3, 0x2, 0x6, 0x1, 0x1b, 0x1, 0x11, 0x29, 0x1, 0x6, 0x82, 0x64, 0xc, 0x27, 0x19, 0xb, 0x15, 0x82, 0xa0, 0x1, 0x80, 0xff, 0x81, 0x0, 0x82, 0x4d, 0x3, 0xa, 0x82, 0xa6, 0x3c, 0x81, 0xb4, 0xc, 0x4, 0x5, 0x1, 0x1, 0x1, 0x19, 0xf, 0x8, 0x4, 0x4, 0x5b, 0x2, 0x3, 0x1, 0x5a, 0x2, 0x80, 0x93, 0x10, 0x20, 0x24, 0x3c, 0x40, 0x1f, 0x51, 0x80, 0x88, 0x80, 0xa8, 0x99, 0xc0, 0x40, 0xa0, 0x59, 0x0, 0x22, 0x66, 0x3, 0x80, 0xa5, 0xa, 0x81, 0x95, 0x1, 0xa0, 0x53, 0x6e, 0x2, 0x80, 0xbd, 0x1, 0x12, 0xa, 0x16, 0x23, 0x1, 0x13, 0x1, 0x4, 0x80, 0x93, 0x1, 0x1, 0x20, 0x1a, 0x6, 0x1a, 0xb, 0xa, 0x1, 0x2d, 0x2, 0x40, 0x7, 0x1, 0x7, 0xa, 0x5, 0x81, 0x2, 0x3, 0x4, 0x2d, 0x3, 0x9, 0x50, 0xc, 0x34, 0x2d, 0xa0, 0xce, 0x3, 0x80, 0xf6, 0xa, 0x27, 0x2, 0x3e, 0x3, 0x11, 0x8, 0x2, 0x7, 0x1e, 0x4, 0x30, 0x81, 0x22, 0x57, 0x9, 0x12, 0x80, 0x8e, 0x55, 0x1, 0x47, 0x1, 0x2, 0x2, 0x1, 0x2, 0x2, 0x2, 0x4, 0x1, 0xc, 0x1, 0x1, 0x1, 0x7, 0x1, 0x41, 0x1, 0x4, 0x2, 0x8, 0x1, 0x7, 0x1, 0x1c, 0x1, 0x4, 0x1, 0x5, 0x1, 0x1, 0x3, 0x7, 0x1, 0x81, 0x54, 0x2, 0x81, 0x24, 0x2, 0x32, 0x98, 0x0, 0x2c, 0x4, 0x64, 0xc, 0xf, 0x2, 0xe, 0x2, 0xf, 0x1, 0xf, 0x20, 0xb, 0x5, 0x1f, 0x1, 0x3c, 0x4, 0x2b, 0x4b, 0x1a, 0x1, 0x2, 0xd, 0x2b, 0x5, 0x9, 0x7, 0x2, 0x80, 0xae, 0x21, 0xf, 0x6, 0x1, 0x46, 0x3, 0x14, 0xc, 0x25, 0x1, 0x5, 0x15, 0x11, 0xf, 0x3f, 0x1, 0x1, 0x1, 0x80, 0xb6, 0x1, 0x4, 0x3, 0x3e, 0x2, 0x4, 0xc, 0x18, 0x80, 0x93, 0x46, 0x4, 0xb, 0x30, 0x46, 0x3a, 0x74, 0xac, 0x8, 0x8d, 0x1, 0x1e, 0x60]; -+_T Old_Italic = [0xa1, 0x3, 0x0, 0x1f, 0x1, 0x4]; -+_T Old_Persian = [0xa1, 0x3, 0xa0, 0x24, 0x4, 0xe]; -+_T Greek = [0x83, 0x70, 0x4, 0x1, 0x3, 0x2, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x14, 0x1, 0x3f, 0xe, 0x10, 0x99, 0x26, 0x5, 0x32, 0x5, 0x4, 0x5, 0x54, 0x1, 0x81, 0x40, 0x16, 0x2, 0x6, 0x2, 0x26, 0x2, 0x6, 0x2, 0x8, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1f, 0x2, 0x35, 0x1, 0xf, 0x1, 0xe, 0x2, 0x6, 0x1, 0x13, 0x2, 0x3, 0x1, 0x9, 0x81, 0x27, 0x1, 0xa0, 0xe0, 0x19, 0x4b, 0xa0, 0xd0, 0x75, 0x46]; -+_T Sundanese = [0x9b, 0x80, 0x40, 0x81, 0x0, 0x8]; -+_T Syriac = [0x87, 0x0, 0xe, 0x1, 0x3c, 0x2, 0x3]; -+_T Gurmukhi = [0x8a, 0x1, 0x3, 0x1, 0x6, 0x4, 0x2, 0x2, 0x16, 0x1, 0x7, 0x1, 0x2, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x1, 0x5, 0x4, 0x2, 0x2, 0x3, 0x3, 0x1, 0x7, 0x4, 0x1, 0x1, 0x7, 0x10]; -+_T Tibetan = [0x8f, 0x0, 0x48, 0x1, 0x24, 0x4, 0x27, 0x1, 0x24, 0x1, 0xf, 0x1, 0x7, 0x4, 0x2]; -+_T Tamil = [0x8b, 0x82, 0x2, 0x1, 0x6, 0x3, 0x3, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0xc, 0x4, 0x5, 0x3, 0x3, 0x1, 0x4, 0x2, 0x1, 0x6, 0x1, 0xe, 0x15]; -+_T Telugu = [0x8c, 0x1, 0x3, 0x1, 0x8, 0x1, 0x3, 0x1, 0x17, 0x1, 0xa, 0x1, 0x5, 0x3, 0x8, 0x1, 0x3, 0x1, 0x4, 0x7, 0x2, 0x1, 0x2, 0x6, 0x4, 0x2, 0xa, 0x8, 0x8]; -+_T Inscriptional_Parthian = [0xa1, 0xb, 0x40, 0x16, 0x2, 0x8]; -+_T Nko = [0x87, 0xc0, 0x3b]; -+_T Javanese = [0xa0, 0xa9, 0x80, 0x4e, 0x2, 0xa, 0x4, 0x2]; -+_T Tai_Le = [0x99, 0x50, 0x1e, 0x2, 0x5]; -+_T Old_South_Arabian = [0xa1, 0xa, 0x60, 0x20]; -+_T Bamum = [0xa0, 0xa6, 0xa0, 0x58, 0xa0, 0xc1, 0x8, 0x82, 0x39]; -+_T Chakma = [0xa1, 0x11, 0x0, 0x35, 0x1, 0xe]; -+_T Ugaritic = [0xa1, 0x3, 0x80, 0x1e, 0x1, 0x1]; -+_T Tagalog = [0x97, 0x0, 0xd, 0x1, 0x7]; -+_T Tagbanwa = [0x97, 0x60, 0xd, 0x1, 0x3, 0x1, 0x2]; -+_T Devanagari = [0x89, 0x0, 0x51, 0x2, 0x11, 0x2, 0x12, 0x1, 0x7, 0xa0, 0x9f, 0x60, 0x1c]; -+_T Buginese = [0x9a, 0x0, 0x1c, 0x2, 0x2]; -+_T Cuneiform = [0xa1, 0x20, 0x0, 0x83, 0x6f, 0x80, 0x91, 0x63, 0xd, 0x4]; -+_T Cyrillic = [0x84, 0x0, 0x80, 0x85, 0x2, 0x80, 0xa1, 0x98, 0x3, 0x1, 0x4c, 0x1, 0x90, 0x67, 0x20, 0xa0, 0x78, 0x40, 0x58, 0x7, 0x1]; -+_U[] _tab = [ -+_U("Arabic", Arabic), -+_U("Armenian", Armenian), -+_U("Avestan", Avestan), -+_U("Balinese", Balinese), -+_U("Bamum", Bamum), -+_U("Batak", Batak), -+_U("Bengali", Bengali), -+_U("Bopomofo", Bopomofo), -+_U("Brahmi", Brahmi), -+_U("Braille", Braille), -+_U("Buginese", Buginese), -+_U("Buhid", Buhid), -+_U("Canadian_Aboriginal", Canadian_Aboriginal), -+_U("Carian", Carian), -+_U("Chakma", Chakma), -+_U("Cham", Cham), -+_U("Cherokee", Cherokee), -+_U("Common", Common), -+_U("Coptic", Coptic), -+_U("Cuneiform", Cuneiform), -+_U("Cypriot", Cypriot), -+_U("Cyrillic", Cyrillic), -+_U("Deseret", Deseret), -+_U("Devanagari", Devanagari), -+_U("Egyptian_Hieroglyphs", Egyptian_Hieroglyphs), -+_U("Ethiopic", Ethiopic), -+_U("Georgian", Georgian), -+_U("Glagolitic", Glagolitic), -+_U("Gothic", Gothic), -+_U("Greek", Greek), -+_U("Gujarati", Gujarati), -+_U("Gurmukhi", Gurmukhi), -+_U("Han", Han), -+_U("Hangul", Hangul), -+_U("Hanunoo", Hanunoo), -+_U("Hebrew", Hebrew), -+_U("Hiragana", Hiragana), -+_U("Imperial_Aramaic", Imperial_Aramaic), -+_U("Inherited", Inherited), -+_U("Inscriptional_Pahlavi", Inscriptional_Pahlavi), -+_U("Inscriptional_Parthian", Inscriptional_Parthian), -+_U("Javanese", Javanese), -+_U("Kaithi", Kaithi), -+_U("Kannada", Kannada), -+_U("Katakana", Katakana), -+_U("Kayah_Li", Kayah_Li), -+_U("Kharoshthi", Kharoshthi), -+_U("Khmer", Khmer), -+_U("Lao", Lao), -+_U("Latin", Latin), -+_U("Lepcha", Lepcha), -+_U("Limbu", Limbu), -+_U("Linear_B", Linear_B), -+_U("Lisu", Lisu), -+_U("Lycian", Lycian), -+_U("Lydian", Lydian), -+_U("Malayalam", Malayalam), -+_U("Mandaic", Mandaic), -+_U("Meetei_Mayek", Meetei_Mayek), -+_U("Meroitic_Cursive", Meroitic_Cursive), -+_U("Meroitic_Hieroglyphs", Meroitic_Hieroglyphs), -+_U("Miao", Miao), -+_U("Mongolian", Mongolian), -+_U("Myanmar", Myanmar), -+_U("New_Tai_Lue", New_Tai_Lue), -+_U("Nko", Nko), -+_U("Ogham", Ogham), -+_U("Ol_Chiki", Ol_Chiki), -+_U("Old_Italic", Old_Italic), -+_U("Old_Persian", Old_Persian), -+_U("Old_South_Arabian", Old_South_Arabian), -+_U("Old_Turkic", Old_Turkic), -+_U("Oriya", Oriya), -+_U("Osmanya", Osmanya), -+_U("Phags_Pa", Phags_Pa), -+_U("Phoenician", Phoenician), -+_U("Rejang", Rejang), -+_U("Runic", Runic), -+_U("Samaritan", Samaritan), -+_U("Saurashtra", Saurashtra), -+_U("Sharada", Sharada), -+_U("Shavian", Shavian), -+_U("Sinhala", Sinhala), -+_U("Sora_Sompeng", Sora_Sompeng), -+_U("Sundanese", Sundanese), -+_U("Syloti_Nagri", Syloti_Nagri), -+_U("Syriac", Syriac), -+_U("Tagalog", Tagalog), -+_U("Tagbanwa", Tagbanwa), -+_U("Tai_Le", Tai_Le), -+_U("Tai_Tham", Tai_Tham), -+_U("Tai_Viet", Tai_Viet), -+_U("Takri", Takri), -+_U("Tamil", Tamil), -+_U("Telugu", Telugu), -+_U("Thaana", Thaana), -+_U("Thai", Thai), -+_U("Tibetan", Tibetan), -+_U("Tifinagh", Tifinagh), -+_U("Ugaritic", Ugaritic), -+_U("Vai", Vai), -+_U("Yi", Yi), -+]; -+} -+ -+struct hangul -+{ -+private alias _U = immutable(UnicodeProperty); -+@property static _U[] tab() { return _tab; } -+static immutable: -+private alias _T = ubyte[]; -+_T LVT = [0xa0, 0xac, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b]; -+_T T = [0x91, 0xa8, 0x58, 0xa0, 0xc5, 0xcb, 0x31]; -+_T V = [0x91, 0x60, 0x48, 0xa0, 0xc6, 0x8, 0x17]; -+_T LV = [0xa0, 0xac, 0x0, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1, 0x1b, 0x1]; -+_T L = [0x91, 0x0, 0x60, 0xa0, 0x98, 0x0, 0x1d]; -+_U[] _tab = [ -+_U("L", L), -+_U("Leading_Jamo", L), -+_U("LV", LV), -+_U("LV_Syllable", LV), -+_U("LVT", LVT), -+_U("LVT_Syllable", LVT), -+_U("T", T), -+_U("Trailing_Jamo", T), -+_U("V", V), -+_U("Vowel_Jamo", V), -+]; -+} -+bool isFormatGen(dchar ch) @safe pure nothrow -+{ -+ if(ch < 8288) -+ { -+ if(ch < 1807) -+ { -+ if(ch < 1564) -+ { -+ if(ch == 173) return true; -+ if(ch < 1536) return false; -+ if(ch < 1541) return true; -+ return false; -+ } -+ else if (ch < 1565) return true; -+ else -+ { -+ if(ch == 1757) return true; -+ return false; -+ } -+ } -+ else if (ch < 1808) return true; -+ else -+ { -+ if(ch < 8203) -+ { -+ if(ch == 6158) return true; -+ return false; -+ } -+ else if (ch < 8208) return true; -+ else -+ { -+ if(ch < 8234) return false; -+ if(ch < 8239) return true; -+ return false; -+ } -+ } -+ } -+ else if (ch < 8293) return true; -+ else -+ { -+ if(ch < 69821) -+ { -+ if(ch < 65279) -+ { -+ if(ch < 8294) return false; -+ if(ch < 8304) return true; -+ return false; -+ } -+ else if (ch < 65280) return true; -+ else -+ { -+ if(ch < 65529) return false; -+ if(ch < 65532) return true; -+ return false; -+ } -+ } -+ else if (ch < 69822) return true; -+ else -+ { -+ if(ch < 917505) -+ { -+ if(ch < 119155) return false; -+ if(ch < 119163) return true; -+ return false; -+ } -+ else if (ch < 917506) return true; -+ else -+ { -+ if(ch < 917536) return false; -+ if(ch < 917632) return true; -+ return false; -+ } -+ } -+ } -+} -+ -+bool isControlGen(dchar ch) @safe pure nothrow -+{ -+ if(ch < 32) return true; -+ if(ch < 127) return false; -+ if(ch < 160) return true; -+ return false; -+} -+ -+bool isSpaceGen(dchar ch) @safe pure nothrow -+{ -+ if(ch < 160) -+ { -+ if(ch == 32) return true; -+ return false; -+ } -+ else if (ch < 161) return true; -+ else -+ { -+ if(ch < 8239) -+ { -+ if(ch == 5760) return true; -+ if(ch < 8192) return false; -+ if(ch < 8203) return true; -+ return false; -+ } -+ else if (ch < 8240) return true; -+ else -+ { -+ if(ch == 8287) return true; -+ if(ch == 12288) return true; -+ return false; -+ } -+ } -+} -+ -+bool isWhiteGen(dchar ch) @safe pure nothrow -+{ -+ if(ch < 133) -+ { -+ if(ch < 9) return false; -+ if(ch < 14) return true; -+ if(ch == 32) return true; -+ return false; -+ } -+ else if (ch < 134) return true; -+ else -+ { -+ if(ch < 8232) -+ { -+ if(ch < 5760) -+ { -+ if(ch == 160) return true; -+ return false; -+ } -+ else if (ch < 5761) return true; -+ else -+ { -+ if(ch < 8192) return false; -+ if(ch < 8203) return true; -+ return false; -+ } -+ } -+ else if (ch < 8234) return true; -+ else -+ { -+ if(ch < 8287) -+ { -+ if(ch == 8239) return true; -+ return false; -+ } -+ else if (ch < 8288) return true; -+ else -+ { -+ if(ch == 12288) return true; -+ return false; -+ } -+ } -+ } -+} -+ -+bool isHangL(dchar ch) @safe pure nothrow -+{ -+ if(ch < 4352) return false; -+ if(ch < 4448) return true; -+ if(ch < 43360) return false; -+ if(ch < 43389) return true; -+ return false; -+} -+ -+bool isHangV(dchar ch) @safe pure nothrow -+{ -+ if(ch < 4448) return false; -+ if(ch < 4520) return true; -+ if(ch < 55216) return false; -+ if(ch < 55239) return true; -+ return false; -+} -+ -+bool isHangT(dchar ch) @safe pure nothrow -+{ -+ if(ch < 4520) return false; -+ if(ch < 4608) return true; -+ if(ch < 55243) return false; -+ if(ch < 55292) return true; -+ return false; -+} -+ -+ -+static if(size_t.sizeof == 8) { -+//1536 bytes -+enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 4, 9)([ 0x0, 0x20, 0x40], [ 0x100, 0x80, 0x2000], [ 0x402030202020100, 0x206020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x3000300030003, 0x3000300030003, 0x5000400030003, 0x3000700030006, 0x3000800030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x9000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0xb0003000a0003, 0x3000c00030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0xe000d00030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x0, 0x7fffffe00000000, 0x420040000000000, 0xff7fffff80000000, 0x55aaaaaaaaaaaaaa, 0xd4aaaaaaaaaaab55, 0xe6512d2a4e243129, 0xaa29aaaab5555240, 0x93faaaaaaaaaaaaa, 0xffffffffffffaa85, 0x1ffffffffefffff, 0x1f00000003, 0x0, 0x3c8a000000000020, 0xfffff00000010000, 0x192faaaaaae37fff, 0xffff000000000000, 0xaaaaaaaaffffffff, 0xaaaaaaaaaaaaa802, 0xaaaaaaaaaaaad554, 0xaaaaaaaaaa, 0xfffffffe00000000, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xaaaaaaaaaaaaaaaa, 0xaaaaaaaaaaaaaaaa, 0xaaaaaaaabfeaaaaa, 0xaaaaaaaaaaaaaaaa, 0xff00ff003f00ff, 0x3fff00ff00ff003f, 0x40df00ff00ff00ff, 0xdc00ff00cf00dc, 0x0, 0x8002000000000000, 0x1fff0000, 0x0, 0x321080000008c400, 0xffff0000000043c0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x3ffffff0000, 0x0, 0x0, 0x0, 0x0, 0xffff000000000000, 0x3fda15627fffffff, 0xaaaaaaaaaaaaaaaa, 0x8501aaaaaaaaa, 0x20bfffffffff, 0x0, 0x0, 0x0, 0x0, 0x2aaaaaaaaaaa, 0xaaaaaa, 0x0, 0xaaabaaa800000000, 0x95ffaaaaaaaaaaaa, 0x2aa000a50aa, 0x700000000000000, 0x0, 0x0, 0x0, 0x0, 0xf8007f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0xffffff0000000000, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffc000000, 0xffffdfc000, 0xebc000000ffffffc, 0xfffffc000000ffef, 0xffffffc000000f, 0xffffffc0000, 0xfc000000ffffffc0, 0xffffc000000fffff, 0xffffffc000000ff, 0xffffffc00000, 0x3ffffffc00, 0xf0000003f7fffffc, 0xffc000000fdfffff, 0xffff0000003f7fff, 0xfffffc000000fdff, 0xbf7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1472 bytes -+enum upperCaseTrieEntries = TrieEntry!(bool, 8, 4, 9)([ 0x0, 0x20, 0x40], [ 0x100, 0x80, 0x1e00], [ 0x402030202020100, 0x206020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x3000300030003, 0x3000300030004, 0x5000300030003, 0x3000700030006, 0x3000800030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x9000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0xa000300030003, 0x3000b00030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0xd000c00030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x3000300030003, 0x0, 0x7fffffe, 0x0, 0x7f7fffff, 0xaa55555555555555, 0x2b555555555554aa, 0x11aed2d5b1dbced6, 0x55d255554aaaa490, 0x6c05555555555555, 0x557a, 0x0, 0x0, 0x0, 0x45000000000000, 0xffbfffed740, 0xe6905555551c8000, 0xffffffffffff, 0x5555555500000000, 0x5555555555555401, 0x5555555555552aab, 0xfffe005555555555, 0x7fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff00000000, 0x20bf, 0x0, 0x0, 0x0, 0x0, 0x5555555555555555, 0x5555555555555555, 0x5555555540155555, 0x5555555555555555, 0xff00ff003f00ff00, 0xff00aa003f00, 0xf00000000000000, 0xf001f000f000f00, 0x0, 0x0, 0x0, 0x0, 0xc00f3d503e273884, 0xffff00000020, 0x8, 0x0, 0x0, 0x0, 0xffc0000000000000, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x7fffffffffff, 0xc025ea9d00000000, 0x5555555555555555, 0x4280555555555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x155555555555, 0x555555, 0x0, 0x5554555400000000, 0x6a00555555555555, 0x55500052855, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffe00000000, 0x0, 0x0, 0x0, 0xffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfff0000003ffffff, 0xffffff0000003fff, 0x3fde64d0000003, 0x3ffffff0000, 0x7b0000001fdfe7b0, 0xfffff0000001fc5f, 0x3ffffff0000003f, 0x3ffffff00000, 0xf0000003ffffff00, 0xffff0000003fffff, 0xffffff00000003ff, 0x7fffffc00000001, 0x1ffffff0000000, 0x7fffffc00000, 0x1ffffff0000, 0x400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//8704 bytes -+enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x100], [ 0x100, 0x380, 0xd00], [ 0x402030202020100, 0x202020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x3000200010000, 0x7000600050004, 0xa00090008, 0xd000c000b0000, 0x110010000f000e, 0x1400130012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x16001500000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x1b001a00190018, 0x1f001e001d001c, 0x0, 0x2200210020, 0x0, 0x0, 0x24002300000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28002700260025, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b002a0000, 0x2e002d002c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30002f, 0x0, 0x0, 0x0, 0x0, 0x320031, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2400220020ffff, 0x2c002a00280026, 0x72f00320030002e, 0x3d003b00390037, 0x1b000430041003f, 0x4e004c004a0048, 0xffff005400520050, 0xffffffffffffffff, 0x2500230021ffff, 0x2d002b00290027, 0x73000330031002f, 0x3e003c003a0038, 0x1b1004400420040, 0x4f004d004b0049, 0xffff005500530051, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff043fffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xcc049800c800c6, 0xd500d3014904aa, 0xdd00db00d900d7, 0xe500e300e100df, 0xed00eb00e900e7, 0xffff00f300f100ef, 0xfb00f900f700f5, 0x6be010100ff00fd, 0xcd049900c900c7, 0xd600d4014a04ab, 0xde00dc00da00d8, 0xe600e400e200e0, 0xee00ec00ea00e8, 0xffff00f400f200f0, 0xfc00fa00f800f6, 0x1a80102010000fe, 0x118011701160115, 0x11e011d011c011b, 0x12401230120011f, 0x128012701260125, 0x12e012d012c012b, 0x13401330130012f, 0x138013701360135, 0x13c013b013a0139, 0x140013f013e013d, 0x144014301420141, 0x148014701460145, 0x14f014e014d014c, 0x1510150ffffffff, 0x155015401530152, 0x15801570156ffff, 0x15e015d015c0159, 0x16201610160015f, 0x166016501640163, 0x1690168ffff0167, 0x16d016c016b016a, 0x1710170016f016e, 0x175017401730172, 0x179017801770176, 0x17d017c017b017a, 0x1830182017f017e, 0x18b018a01870186, 0x1930192018f018e, 0x19b019a01970196, 0x1a301a2019f019e, 0x1a701a601a501a4, 0x1ac01ab01aa01a9, 0x1b201af01ae01ad, 0x1b601b501b3028b, 0x1bd01bb01ba01b9, 0x1c301c101bf01be, 0x1c701c5ffff01c4, 0x1cd01cc01cb01c9, 0x1d301d1023b01cf, 0xffff028301d601d5, 0x1db026901d901d7, 0x1e001df01de01dd, 0x1e501e301e201e1, 0xffffffff01e701e6, 0x1ed01eb01ea01e9, 0x1f301f101ef01ee, 0x1f701f601f501f4, 0xffffffff01fa01f9, 0x23dffff01fc01fb, 0xffffffffffffffff, 0x206020202010200, 0x20d020c02080207, 0x2110210020f020e, 0x215021402130212, 0x219021802170216, 0x21d021c021b021a, 0x220021f01c6021e, 0x226022502240223, 0x22a022902280227, 0x22e022d022c022b, 0x23202310230022f, 0x23802370236ffff, 0x23e023c023a0239, 0x24402430240023f, 0x248024702460245, 0x24c024b024a0249, 0x250024f024e024d, 0x254025302520251, 0x258025702560255, 0x25c025b025a0259, 0x260025f025e025d, 0x264026302620261, 0x268026702660265, 0x26c026bffff026a, 0x270026f026e026d, 0x274027302720271, 0x278027702760275, 0x27c027b027a0279, 0xffffffffffffffff, 0x281027fffffffff, 0x2d7028502840282, 0x28c028802870482, 0x2920291028f028d, 0x296029502940293, 0x29c029b02980297, 0x1b402b70466046a, 0x1c201c0ffff01bc, 0x1caffff01c8ffff, 0xffffffffffffffff, 0x1d0ffffffff01ce, 0xffff05fa0748ffff, 0x528ffff01d201d4, 0x1d8ffffffffffff, 0xffff01da02b3ffff, 0xffffffff01dcffff, 0xffffffffffffffff, 0xffffffff02a3ffff, 0x1e8ffffffff01e4, 0xffffffffffffffff, 0x1f201f0028e01ec, 0xffffffffffff0290, 0xffff01f8ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff083affff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x320031f031e031d, 0x3240323ffffffff, 0x3d5ffffffffffff, 0xffffffff03d903d7, 0xffffffffffffffff, 0xffff0329ffffffff, 0xffff0331032f032d, 0x3370335ffff0333, 0x33e03950339ffff, 0x347034503cc0340, 0x35403c2083b03c8, 0x35d035b03590440, 0x388ffff03c5039f, 0x36f039c036a0368, 0x378037607100371, 0x3320330032e032a, 0x33f0396033affff, 0x348034603cd0341, 0x35503c3083c03c9, 0x35e035c035a0441, 0x38a038903c603a0, 0x370039d036b0369, 0x379037707110372, 0x393033803360334, 0xffffffff03ca0397, 0x39403a1039effff, 0x3a703a603a303a2, 0x3ab03aa03a903a8, 0x3af03ae03ad03ac, 0x3b503b403b103b0, 0x3bd03bc03b903b8, 0x3c103c003bf03be, 0xffff03d103c703c4, 0x3cfffff03ce03cb, 0x3d403d303d203d0, 0x3da03d803d6ffff, 0x3e103df03dd03db, 0x3e903e703e503e3, 0x3f103ef03ed03eb, 0x3f903f703f503f3, 0x40103ff03fd03fb, 0x409040704050403, 0x411040f040d040b, 0x419041704150413, 0x421041f041d041b, 0x429042704250423, 0x431042f042d042b, 0x439043704350433, 0x402040003fe03fc, 0x40a040804060404, 0x4120410040e040c, 0x41a041804160414, 0x4220420041e041c, 0x42a042804260424, 0x4320430042e042c, 0x43a043804360434, 0x3e203e003de03dc, 0x3ea03e803e603e4, 0x3f203f003ee03ec, 0x3fa03f803f603f4, 0x453045204510450, 0x459045804570456, 0x4610460045d045c, 0x469046804650464, 0x4710470046d046c, 0x477047604730472, 0x47b047a04790478, 0x4810480047d047c, 0xffffffff04850484, 0xffffffffffffffff, 0x4950494ffffffff, 0x49b049a04970496, 0x49f049e049d049c, 0x4a704a604a304a2, 0x4ad04ac04a904a8, 0x4b304b204b104b0, 0x4b904b804b704b6, 0x4bf04be04bb04ba, 0x4c504c404c104c0, 0x4cd04cc04c904c8, 0x4d304d204cf04ce, 0x4d704d604d504d4, 0x4df04de04db04da, 0x4e704e604e304e2, 0x4f004ed04ec04ea, 0x4f804f504f404f1, 0x50004fd04fc04f9, 0x4eb050505040501, 0x50d050c050b050a, 0x5130512050f050e, 0x519051805170516, 0x51f051e051d051c, 0x525052405210520, 0x52b052a05270526, 0x52f052e052d052c, 0x537053605330532, 0x53d053c05390538, 0x5410540053f053e, 0x547054605430542, 0x54b054a05490548, 0x54f054e054d054c, 0x555055405510550, 0x559055805570556, 0x55d055c055b055a, 0x5630562055f055e, 0x567056605650564, 0x56b056a05690568, 0x5730572056f056e, 0x577057605750574, 0x57b057a05790578, 0xffffffffffffffff, 0xffffffffffffffff, 0x58405820580ffff, 0x58c058a05880586, 0x59405920590058e, 0x59c059a05980596, 0x5a405a205a0059e, 0x5ac05aa05a805a6, 0x5b405b205b005ae, 0x5bc05ba05b805b6, 0x5c405c205c005be, 0xffff05ca05c805c6, 0xffffffffffffffff, 0xffffffffffffffff, 0x58505830581ffff, 0x58d058b05890587, 0x59505930591058f, 0x59d059b05990597, 0x5a505a305a1059f, 0x5ad05ab05a905a7, 0x5b505b305b105af, 0x5bd05bb05b905b7, 0x5c505c305c105bf, 0xffff05cb05c905c7, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x8c008a00880086, 0x9400920090008e, 0x9c009a00980096, 0xa400a200a0009e, 0xac00aa00a800a6, 0xb400b200b000ae, 0xbc00ba00b800b6, 0xc400c200c000be, 0x4a000ca048e0486, 0x4c6ffff04b400ce, 0xffffffffffffffff, 0xffffffff0508ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff07e8ffff, 0xffffffff0454ffff, 0x5ff05fe05fd05fc, 0x605060406010600, 0x60b060a06090608, 0x6110610060f060e, 0x617061606130612, 0x61d061c06190618, 0x6210620061f061e, 0x627062606230622, 0x62b062a06290628, 0x62f062e062d062c, 0x635063406310630, 0x639063806370636, 0x63d063c063b063a, 0x6430642063f063e, 0x647064606450644, 0x64b064a06490648, 0x6510650064d064c, 0x655065406530652, 0x65d065c06590658, 0x6630662065f065e, 0x667066606650664, 0x66b066a06690668, 0x6710670066d066c, 0x675067406730672, 0x67a067906bc06bb, 0x680067f067c067b, 0x684068306820681, 0x688068706860685, 0x68e068d068a0689, 0x69206910690068f, 0x698069706960695, 0x69e069d069a0699, 0x6a206a106a0069f, 0x6a606a506a406a3, 0x6ac06ab06a806a7, 0x6b006af06ae06ad, 0x6b406b306b206b1, 0xffffffff06b606b5, 0x6bdffffffffffff, 0xffff06bfffffffff, 0x6c306c206c106c0, 0x6c906c806c506c4, 0x6cd06cc06cb06ca, 0x6d106d006cf06ce, 0x6d706d606d506d4, 0x6dd06dc06db06da, 0x6e106e006df06de, 0x6e506e406e306e2, 0x6eb06ea06e906e8, 0x6f106f006ef06ee, 0x6f506f406f306f2, 0x6f906f806f706f6, 0x6fd06fc06fb06fa, 0x701070006ff06fe, 0x705070407030702, 0x709070807070706, 0x70d070c070b070a, 0x7140713070f070e, 0x718071707160715, 0x71e071d071c071b, 0x72207210720071f, 0x726072507240723, 0x72a072907280727, 0x7330732072e072d, 0x73c073a07380736, 0x74407420740073e, 0x73d073b07390737, 0x74507430741073f, 0x750074e074c074a, 0xffffffff07540752, 0x751074f074d074b, 0xffffffff07550753, 0x76a076807660764, 0x7720770076e076c, 0x76b076907670765, 0x7730771076f076d, 0x78a078807860784, 0x7920790078e078c, 0x78b078907870785, 0x7930791078f078d, 0x7a207a0079e079c, 0xffffffff07a607a4, 0x7a307a1079f079d, 0xffffffff07a707a5, 0x7baffff07b6ffff, 0x7c2ffff07beffff, 0x7bbffff07b7ffff, 0x7c3ffff07bfffff, 0x7d607d407d207d0, 0x7de07dc07da07d8, 0x7d707d507d307d1, 0x7df07dd07db07d9, 0x840083e08360834, 0x84e084c08440842, 0x858085608620860, 0xffffffff08660864, 0x7fa07f807f607f4, 0x802080007fe07fc, 0x7fb07f907f707f5, 0x803080107ff07fd, 0x80e080c080a0808, 0x816081408120810, 0x80f080d080b0809, 0x817081508130811, 0x826082408220820, 0x82e082c082a0828, 0x827082508230821, 0x82f082d082b0829, 0x838ffff08320830, 0xffffffffffffffff, 0x837083508330831, 0xffff083dffff0839, 0x846ffffffffffff, 0xffffffffffffffff, 0x84508430841083f, 0xffffffffffff0847, 0xffffffff084a0848, 0xffffffffffffffff, 0x84f084d084b0849, 0xffffffffffffffff, 0xffffffff08540852, 0xffffffff085affff, 0x859085708550853, 0xffffffffffff085b, 0x868ffffffffffff, 0xffffffffffffffff, 0x867086508630861, 0xffffffffffff0869, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0712ffffffff, 0x14b0731ffffffff, 0xffffffffffffffff, 0xffff0530ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0531ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x18402af0180029f, 0x18c005e018802c1, 0x194006c01900064, 0x19c007e01980076, 0x18502b0018102a0, 0x18d005f018902c2, 0x195006d01910065, 0x19d007f01990077, 0x1b7ffffffffffff, 0xffffffffffff01b8, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x4d80444ffffffff, 0x4e0044c04dc0446, 0x4e8047404e4045e, 0x204ee02d3086a, 0x6e04f606c604f2, 0x10d04fe037a04fa, 0x51a0506061a0502, 0x4dd044704d90445, 0x4e5045f04e1044d, 0x2d4086b04e90475, 0x6c704f3000304ef, 0x37b04fb006f04f7, 0x61b0503010e04ff, 0xffffffff051b0507, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa000800040000, 0x160010000e000c, 0x2bb001c001a0018, 0x5602e702d102c7, 0x66006200600058, 0x7800740070006a, 0x29900820080007c, 0x6020084000607e0, 0x5d005ce02a7057c, 0x1070105010305de, 0x1190113010f0109, 0xffff013101290121, 0xb000900050001, 0x170011000f000d, 0x2bc001d001b0019, 0x5702e802d202c8, 0x67006300610059, 0x7900750071006b, 0x29a00830081007d, 0x6030085000707e1, 0x5d105cf02a8057d, 0x1080106010405df, 0x11a01140110010a, 0xffff0132012a0122, 0x455052904c304c2, 0x45a0286028002a4, 0x46202aa02a9045b, 0x46b02b404670463, 0x2ba02b9ffff02b8, 0xffff02c002bfffff, 0xffffffffffffffff, 0x48302d8ffffffff, 0x489048802e202e1, 0x48d048c048b048a, 0x2fe02fd04910490, 0x30e030d03040303, 0x31a031903160315, 0x328032703260325, 0x6ed06ec02fc02fb, 0x383038203810380, 0x392039103870386, 0x3b303b203a503a4, 0x5cd05cc056d056c, 0x5ed05ec05db05da, 0x6570656060d060c, 0x6e706e6043e043d, 0x7830782072c072b, 0x694069307e307e2, 0x150014065b065a, 0x4bd04bc005d005c, 0x5d505d404d104d0, 0x511051001a101a0, 0x535053405230522, 0x553055205450544, 0x571057005610560, 0x15b015a057f057e, 0x3bb03ba037d037c, 0xffffffffffffffff, 0x5d2ffffffffffff, 0xffff05d905d805d3, 0x5e305e2ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x8d008b00890087, 0x9500930091008f, 0x9d009b00990097, 0xa500a300a1009f, 0xad00ab00a900a7, 0xb500b300b100af, 0xbd00bb00b900b7, 0xc500c300c100bf, 0x4a100cb048f0487, 0x4c7ffff04b500cf, 0xffffffffffffffff, 0xffffffff0509ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x5d705d602c402c3, 0x5e105e005dd05dc, 0x5e905e805e705e6, 0x5ef05ee05eb05ea, 0x5f505f405f105f0, 0x308030705f905f8, 0x625062406150614, 0x641064006330632, 0x6610660064f064e, 0x67e067d066f066e, 0x69c069b068c068b, 0xffffffff06aa06a9, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x69006807350734, 0x75f075e027e027d, 0x390038f07770776, 0x7b107b0001f001e, 0x2a202a107c707c6, 0x6b806b707e507e4, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7590758ffffffff, 0x7610760075d075c, 0x2e002df02d602d5, 0x2ee02ed02e602e5, 0x7790778ffffffff, 0x7810780077d077c, 0x3140313030c030b, 0x322032103180317, 0x797079607950794, 0x79b079a07990798, 0x3850384037f037e, 0x7a907a8038e038d, 0x7ad07ac07ab07aa, 0x7b307b207af07ae, 0x7b907b807b507b4, 0x7c107c007bd07bc, 0x7c907c807c507c4, 0x7cf07ce07cd07cc, 0x47f047e046f046e, 0x4a504a404930492, 0xffffffffffffffff, 0xffffffffffffffff, 0x7e605150514ffff, 0x7eb07ea07e907e7, 0x7ef07ee07ed07ec, 0x7f307f207f107f0, 0x5f2ffffffffffff, 0xffffffff074905f3, 0x807080608050804, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x81b081a08190818, 0x81f081e081d081c, 0xffff05fb05f705f6, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x75a02c50756ffff, 0x76202cf02cd02cb, 0x2e3071902db06d2, 0x2f107ca02e90448, 0x77a02f502f30774, 0x3050221077e02f9, 0xffff043b030f007a, 0xffffffffffffffff, 0x75b02c60757ffff, 0x76302d002ce02cc, 0x2e4071a02dc06d3, 0x2f207cb02ea0449, 0x77b02f602f40775, 0x3060222077f02fa, 0xffff043c0310007b, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x72005a085c0012, 0x11106b9032b0311, 0x2dd029d02ab05e4, 0x10b060602ef085e, 0x4ca028902d902a5, 0x2c902bd02b502ad, 0x30902f702eb0746, 0x38b02b10241031b, 0x442053a044a03b6, 0x85004ae06d8044e, 0x73005b085d0013, 0x11206ba032c0312, 0x2de029e02ac05e5, 0x10c060702f0085f, 0x4cb028a02da02a6, 0x2ca02be02b602ae, 0x30a02f802ec0747, 0x38c02b20242031c, 0x443053b044b03b7, 0x85104af06d9044f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+//8832 bytes -+enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x100], [ 0x100, 0x380, 0xd40], [ 0x402030202020100, 0x202020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x3000200010000, 0x7000600050004, 0xa00090008, 0xd000c000b0000, 0x110010000f000e, 0x1400130012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x16001500000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x1b001a00190018, 0x1f001e001d001c, 0x0, 0x2200210020, 0x0, 0x0, 0x24002300000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28002700260025, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b002a0000, 0x2e002d002c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2f, 0x0, 0x0, 0x0, 0x310030, 0x0, 0x0, 0x0, 0x0, 0x330032, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2400220020ffff, 0x2c002a00280026, 0x78100320030002e, 0x3d003b00390037, 0x1b900430041003f, 0x4e004c004a0048, 0xffff005400520050, 0xffffffffffffffff, 0x2500230021ffff, 0x2d002b00290027, 0x78200330031002f, 0x3e003c003a0038, 0x1ba004400420040, 0x4f004d004b0049, 0xffff005500530051, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff0470ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xcc04c900c800c6, 0xd500d3014e04db, 0xdd00db00d900d7, 0xe500e300e100df, 0xed00eb00e900e7, 0xffff00f300f100ef, 0xfb00f900f700f5, 0x70f010100ff00fd, 0xcd04ca00c900c7, 0xd600d4014f04dc, 0xde00dc00da00d8, 0xe600e400e200e0, 0xee00ec00ea00e8, 0xffff00f400f200f0, 0xfc00fa00f800f6, 0x1b10102010000fe, 0x11b011a01190118, 0x1210120011f011e, 0x127012601230122, 0x12b012a01290128, 0x1310130012f012e, 0x137013601330132, 0x13b013a01390138, 0x13f013e013d013c, 0x143014201410140, 0x149014801470146, 0x14d014c014b014a, 0x154015301520151, 0x1580157ffff0155, 0x15c015b015a0159, 0x15f015e015dffff, 0x165016401630160, 0x169016801670166, 0x16d016c016b016a, 0x1720171016f016e, 0x176017501740173, 0x17a017901780177, 0x17e017d017c017b, 0x18201810180017f, 0x186018501840183, 0x18c018b01880187, 0x19401930190018f, 0x19c019b01980197, 0x1a401a301a0019f, 0x1ac01ab01a801a7, 0x1b001af01ae01ad, 0x1b501b401b301b2, 0x1bb01b801b701b6, 0x1bf01be01bc029c, 0x1c601c401c301c2, 0x1cc01ca01c801c7, 0x1d001ceffff01cd, 0x1d601d501d401d2, 0x1dc01da024801d8, 0xffff029401df01de, 0x1e6027801e201e0, 0x1eb01ea01e901e8, 0x1f001ee01ed01ec, 0xffffffff01f201f1, 0x1f801f601f501f4, 0x1fe01fc01fa01f9, 0x2020201020001ff, 0xffffffff02050204, 0x24affff02070206, 0xffffffffffffffff, 0x211020d020c020b, 0x218021702130212, 0x21c021b021a0219, 0x220021f021e021d, 0x224022302220221, 0x228022702260225, 0x22b022a01cf0229, 0x2310230022f022e, 0x235023402330232, 0x239023802370236, 0x23d023c023b023a, 0x24502440243023e, 0x24b024902470246, 0x2510250024d024c, 0x255025402530252, 0x259025802570256, 0x25d025c025b025a, 0x263026202610260, 0x267026602650264, 0x26b026a02690268, 0x26f026e026d026c, 0x273027202710270, 0x277027602750274, 0x27b027affff0279, 0x27f027e027d027c, 0x285028402810280, 0x289028802870286, 0x28d028c028b028a, 0xffffffffffffffff, 0x2920290ffffffff, 0x2ec029602950293, 0x29d0299029804b3, 0x2a302a202a0029e, 0x2a702a602a502a4, 0x2ad02ac02a902a8, 0x1bd02ca0497049b, 0x1cb01c9ffff01c5, 0x1d3ffff01d1ffff, 0xffffffffffffffff, 0x1d9ffffffff01d7, 0xffff0643079affff, 0x559ffff01db01dd, 0x1e1ffffffffffff, 0xffff01e302c6ffff, 0xffffffff01e7ffff, 0xffffffffffffffff, 0xffffffff02b4ffff, 0x1f3ffffffff01ef, 0xffffffffffffffff, 0x1fd01fb029f01f7, 0xffffffffffff02a1, 0xffff0203ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff08e4ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x347034603450344, 0x34b034affffffff, 0x406ffffffffffff, 0xffffffff040a0408, 0xffffffffffffffff, 0xffff0350ffffffff, 0xffff035803560354, 0x35e035cffff035a, 0x36803c203630902, 0x371036f03fd036a, 0x37e03f308e503f9, 0x387038503830471, 0x3b5ffff03f603cc, 0x39903c903940392, 0x3a203a00762039b, 0x359035703550351, 0x36903c303640915, 0x372037003fe036b, 0x37f03f408e603fa, 0x388038603840472, 0x3b703b603f703cd, 0x39a03ca03950393, 0x3a303a10763039c, 0x3c0035f035d035b, 0xffffffff03fb03c4, 0x3c103ce03cbffff, 0x3d403d303d003cf, 0x3d803d703d603d5, 0x3de03dd03da03d9, 0x3e403e303e003df, 0x3ec03eb03e803e7, 0x3f203f103ee03ed, 0xffff040203f803f5, 0x400ffff03ff03fc, 0x405040404030401, 0x40b04090407ffff, 0x4120410040e040c, 0x41a041804160414, 0x4220420041e041c, 0x42a042804260424, 0x4320430042e042c, 0x43a043804360434, 0x4420440043e043c, 0x44a044804460444, 0x4520450044e044c, 0x45a045804560454, 0x4620460045e045c, 0x46a046804660464, 0x4330431042f042d, 0x43b043904370435, 0x4430441043f043d, 0x44b044904470445, 0x4530451044f044d, 0x45b045904570455, 0x4630461045f045d, 0x46b046904670465, 0x4130411040f040d, 0x41b041904170415, 0x4230421041f041d, 0x42b042904270425, 0x484048304820481, 0x48a048904880487, 0x4920491048e048d, 0x49a049904960495, 0x4a204a1049e049d, 0x4a804a704a404a3, 0x4ac04ab04aa04a9, 0x4b204b104ae04ad, 0xffffffff04b604b5, 0xffffffffffffffff, 0x4c604c5ffffffff, 0x4cc04cb04c804c7, 0x4d004cf04ce04cd, 0x4d804d704d404d3, 0x4de04dd04da04d9, 0x4e404e304e204e1, 0x4ea04e904e804e7, 0x4f004ef04ec04eb, 0x4f604f504f204f1, 0x4fe04fd04fa04f9, 0x5040503050004ff, 0x508050705060505, 0x510050f050c050b, 0x518051705140513, 0x521051e051d051b, 0x529052605250522, 0x531052e052d052a, 0x51c053605350532, 0x53e053d053c053b, 0x54405430540053f, 0x54a054905480547, 0x550054f054e054d, 0x556055505520551, 0x55c055b05580557, 0x560055f055e055d, 0x568056705640563, 0x56e056d056a0569, 0x57205710570056f, 0x578057705740573, 0x57c057b057a0579, 0x5820581057e057d, 0x588058705840583, 0x58c058b058a0589, 0x5920591058e058d, 0x598059705940593, 0x59c059b059a0599, 0x5a205a1059e059d, 0x5aa05a905a605a5, 0x5ae05ad05ac05ab, 0x5b405b305b005af, 0xffffffffffffffff, 0xffffffffffffffff, 0x5bd05bb05b9ffff, 0x5c505c305c105bf, 0x5cd05cb05c905c7, 0x5d505d305d105cf, 0x5dd05db05d905d7, 0x5e505e305e105df, 0x5ed05eb05e905e7, 0x5f505f305f105ef, 0x5fd05fb05f905f7, 0xffff0603060105ff, 0xffffffffffffffff, 0xffffffffffffffff, 0x5be05bc05baffff, 0x5c605c405c205c0, 0x5ce05cc05ca05c8, 0x5d605d405d205d0, 0x5de05dc05da05d8, 0x5e605e405e205e0, 0x5ee05ec05ea05e8, 0x5f605f405f205f0, 0x5fe05fc05fa05f8, 0x613060406020600, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x8c008a00880086, 0x9400920090008e, 0x9c009a00980096, 0xa400a200a0009e, 0xac00aa00a800a6, 0xb400b200b000ae, 0xbc00ba00b800b6, 0xc400c200c000be, 0x4d100ca04bf04b7, 0x4f7ffff04e500ce, 0xffffffffffffffff, 0xffffffff0539ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff083affff, 0xffffffff0485ffff, 0x648064706460645, 0x64e064d064a0649, 0x654065306520651, 0x65a065906580657, 0x660065f065c065b, 0x666066506620661, 0x66a066906680667, 0x670066f066c066b, 0x674067306720671, 0x678067706760675, 0x67e067d067a0679, 0x68206810680067f, 0x686068506840683, 0x68c068b06880687, 0x690068f068e068d, 0x694069306920691, 0x69a069906960695, 0x69e069d069c069b, 0x6a606a506a206a1, 0x6ac06ab06a806a7, 0x6b006af06ae06ad, 0x6b406b306b206b1, 0x6ba06b906b606b5, 0x6be06bd06bc06bb, 0x6c306c2070d070c, 0x6cb06ca06c706c6, 0x6cf06ce06cd06cc, 0x6d306d206d106d0, 0x6d906d806d506d4, 0x6dd06dc06db06da, 0x6e306e206e106e0, 0x6e906e806e506e4, 0x6ed06ec06eb06ea, 0x6f106f006ef06ee, 0x6f706f606f306f2, 0x6fb06fa06f906f8, 0x6ff06fe06fd06fc, 0x704070207010700, 0x70e070a07080706, 0xffff0710ffffffff, 0x715071407130712, 0x71b071a07170716, 0x71f071e071d071c, 0x723072207210720, 0x729072807270726, 0x72f072e072d072c, 0x733073207310730, 0x737073607350734, 0x73d073c073b073a, 0x743074207410740, 0x747074607450744, 0x74b074a07490748, 0x74f074e074d074c, 0x753075207510750, 0x757075607550754, 0x75b075a07590758, 0x75f075e075d075c, 0x766076507610760, 0x76a076907680767, 0x770076f076e076d, 0x774077307720771, 0x778077707760775, 0x77c077b077a0779, 0x78507840780077f, 0x78e078c078a0788, 0x796079407920790, 0x78f078d078b0789, 0x797079507930791, 0x7a207a0079e079c, 0xffffffff07a607a4, 0x7a307a1079f079d, 0xffffffff07a707a5, 0x7bc07ba07b807b6, 0x7c407c207c007be, 0x7bd07bb07b907b7, 0x7c507c307c107bf, 0x7dc07da07d807d6, 0x7e407e207e007de, 0x7dd07db07d907d7, 0x7e507e307e107df, 0x7f407f207f007ee, 0xffffffff07f807f6, 0x7f507f307f107ef, 0xffffffff07f907f7, 0x80c07fe080807fc, 0x814080408100800, 0x80dffff0809ffff, 0x815ffff0811ffff, 0x828082608240822, 0x830082e082c082a, 0x829082708250823, 0x831082f082d082b, 0x8f708f508df08dd, 0x90f090d08fb08f9, 0x924092209370935, 0xffffffff093b0939, 0x85f085c08590856, 0x86b086808650862, 0x860085d085a0857, 0x86c086908660863, 0x88f088c08890886, 0x89b089808950892, 0x890088d088a0887, 0x89c089908960893, 0x8bf08bc08b908b6, 0x8cb08c808c508c2, 0x8c008bd08ba08b7, 0x8cc08c908c608c3, 0x8e108ce08db08d9, 0x8d708d5ffff08d3, 0x8e008de08dc08da, 0xffff08e7ffff08e2, 0x8fd08e8ffffffff, 0x8f308f1ffff08ed, 0x8fc08fa08f808f6, 0xffffffffffff08fe, 0x9030900090b0909, 0x9070905ffffffff, 0x910090e090c090a, 0xffffffffffffffff, 0x91609130920091e, 0x91c091a09260918, 0x92509230921091f, 0xffffffffffff0927, 0x93d092affffffff, 0x9330931ffff092f, 0x93c093a09380936, 0xffffffffffff093e, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0764ffffffff, 0x1500783ffffffff, 0xffffffffffffffff, 0xffff0561ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0562ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x18d02c2018902b0, 0x195005e019102d6, 0x19d006c01990064, 0x1a5007e01a10076, 0x18e02c3018a02b1, 0x196005f019202d7, 0x19e006d019a0065, 0x1a6007f01a20077, 0x1c0ffffffffffff, 0xffffffffffff01c1, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x5090475ffffffff, 0x511047d050d0477, 0x51904a50515048f, 0x2051f02e80940, 0x6e052707180523, 0x110052f03a4052b, 0x54b053706630533, 0x50e0478050a0476, 0x51604900512047e, 0x2e90941051a04a6, 0x719052400030520, 0x3a5052c006f0528, 0x664053401110530, 0xffffffff054c0538, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xa000800040000, 0x160010000e000c, 0x2ce001c001a0018, 0x56030802e602dc, 0x66006200600058, 0x7800740070006a, 0x2aa00820080007c, 0x64b008400060832, 0x60d060902b805b5, 0x10801060629061d, 0x11c01160112010a, 0xffff0134012c0124, 0xb000900050001, 0x170011000f000d, 0x2cf001d001b0019, 0x57030902e702dd, 0x67006300610059, 0x7900750071006b, 0x2ab00830081007d, 0x64c008500070833, 0x60e060a02b905b6, 0x1090107062a061e, 0x11d01170113010b, 0xffff0135012d0125, 0x486055a04f404f3, 0x48b0297029102b5, 0x49302bb02ba048c, 0x49c02c704980494, 0x2cd02ccffff02cb, 0xffff02d502d4ffff, 0xffffffffffffffff, 0x4b402edffffffff, 0x4ba04b902f902f8, 0x4be04bd04bc04bb, 0x325032404c204c1, 0x3350334032b032a, 0x3410340033d033c, 0x34f034e034d034c, 0x73f073e03230322, 0x3b003af03ae03ad, 0x3bf03be03b403b3, 0x3e203e103d203d1, 0x606060505a405a3, 0x6320631061a0619, 0x6a0069f06560655, 0x7390738046f046e, 0x7d507d4077e077d, 0x6df06de08350834, 0x15001406a406a3, 0x4ee04ed005d005c, 0x612061105020501, 0x542054101aa01a9, 0x566056505540553, 0x586058505760575, 0x5a805a705960595, 0x162016105b805b7, 0x3ea03e903a703a6, 0xffffffffffffffff, 0x60fffffffffffff, 0xffff061806170610, 0x6240623ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x8d008b00890087, 0x9500930091008f, 0x9d009b00990097, 0xa500a300a1009f, 0xad00ab00a900a7, 0xb500b300b100af, 0xbd00bb00b900b7, 0xc500c300c100bf, 0x4d200cb04c004b8, 0x4f8ffff04e600cf, 0xffffffffffffffff, 0xffffffff053affff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x616061502d902d8, 0x6220621061c061b, 0x1e501e406280627, 0x6340633062e062d, 0x63e063d06380637, 0x32f032e06420641, 0x66e066d065e065d, 0x68a0689067c067b, 0x6aa06a906980697, 0x6c906c806b806b7, 0x6e706e606d706d6, 0xffffffff06f506f4, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x69006807870786, 0x7b107b0028f028e, 0x3bd03bc07c907c8, 0x8030802001f001e, 0x2b302b208190818, 0x2d302d208370836, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7ab07aaffffffff, 0x7b307b207af07ae, 0x2f502f402eb02ea, 0x311031003070306, 0x7cb07caffffffff, 0x7d307d207cf07ce, 0x33b033a03330332, 0x3490348033f033e, 0x7e907e807e707e6, 0x7ed07ec07eb07ea, 0x3b203b103ac03ab, 0x7fb07fa03bb03ba, 0x3f003ef03dc03db, 0x28302820620061f, 0x80b080a08070806, 0x8130812080f080e, 0x81b081a08170816, 0x8210820081f081e, 0x4b004af04a0049f, 0x4d604d504c404c3, 0xffffffffffffffff, 0xffffffffffffffff, 0x83805460545ffff, 0x83d083c083b0839, 0x590058f0580057f, 0x5b205b105a0059f, 0x63bffffffffffff, 0xffffffff079b063c, 0x60c060b06080607, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x630062f062c062b, 0x63a063906360635, 0xffff06440640063f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2fc02fa025e02f6, 0xffff0304030302fe, 0xffffffffffffffff, 0xffffffffffffffff, 0x30cffffffffffff, 0x314031202c0030e, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7ac02da07a8ffff, 0x7b402e402e202e0, 0x144076b02f00724, 0x318081c030a0479, 0x7cc031c031a07c6, 0x32c022c07d00320, 0xffff046c0336007a, 0xffffffffffffffff, 0x7ad02db07a9ffff, 0x7b502e502e302e1, 0x145076c02f10725, 0x319081d030b047a, 0x7cd031d031b07c7, 0x32d022d07d10321, 0xffff046d0337007b, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x72005a09280012, 0x114010c03520338, 0x2f202ae02bc0625, 0x10e064f031608ef, 0x4fb029a02ee02b6, 0x2de02d002c802be, 0x330031e047f0798, 0x3b802c4024e0342, 0x473056b047b03e5, 0x91104df072a06c4, 0x73005b09290013, 0x115010d03530339, 0x2f302af02bd0626, 0x10f0650031708f0, 0x4fc029b02ef02b7, 0x2df02d102c902bf, 0x331031f04800799, 0x3b902c5024f0343, 0x474056c047c03e6, 0x91204e0072b06c5, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+//4000 bytes -+enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0xb0], [ 0x100, 0x240, 0x5100], [ 0x706050403020100, 0xe0d0c0a0b0a0908, 0x100a0f0303030303, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x7000600050004, 0xb000a00090008, 0xf000e000d000c, 0x12001100010010, 0x15001400010013, 0x19001800170016, 0x1c0001001b001a, 0x1f001f001e001d, 0x1f001f001f0020, 0x1f001f001f001f, 0x1f002300220021, 0x1f001f00250024, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100260001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x27000100010001, 0x1000100010001, 0x2a002900010028, 0x2e002d002c002b, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x2f000100010001, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x3100300001001f, 0x34003300320001, 0x38003700360035, 0x1f001f001f0039, 0x3d003c003b003a, 0x1f001f001f003e, 0x1f001f0040003f, 0x1f0041001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x42000100010001, 0x1f001f001f0043, 0x1f001f001f001f, 0x1f001f001f001f, 0x1000100010001, 0x1f001f001f0044, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f004500010001, 0x46001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f0047, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x4b004a00490048, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f004c001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1000100010001, 0x1004d00010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x4e000100010001, 0x1f001f001f004f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f004f00010001, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x1f001f001f001f, 0x0, 0x7fffffe07fffffe, 0x420040000000000, 0xff7fffffff7fffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x501f0003ffc3, 0x0, 0x3cdf000000000020, 0xfffffffbffffd740, 0xffbfffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffffffffc03, 0xffffffffffffffff, 0xfffe00ffffffffff, 0xfffffffe027fffff, 0xbfff0000000000ff, 0x707ffffff00b6, 0xffffffff07ff0000, 0xffffc000feffffff, 0xffffffffffffffff, 0x9c00e1fe1fefffff, 0xffffffffffff0000, 0xffffffffffffe000, 0x3ffffffffffff, 0x43007fffffffc00, 0x1ffffcffffff, 0x1ffffff, 0x1ffd00000000, 0x7fff03f000000000, 0xefffffffffffffff, 0xfefe000fffe1dfff, 0xe3c5fdfffff99fee, 0x3000fb080599f, 0xc36dfdfffff987ee, 0x3f00005e021987, 0xe3edfdfffffbbfee, 0xf00011bbf, 0xe3edfdfffff99fee, 0x2000fb0c0199f, 0xc3ffc718d63dc7ec, 0x811dc7, 0xe3effdfffffddfee, 0xf03601ddf, 0xe3effdfffffddfec, 0x6000f40601ddf, 0xe7fffffffffddfec, 0xfc00000f00805ddf, 0x2ffbfffffc7fffec, 0xc0000ff5f807f, 0x7fffffffffffffe, 0x207f, 0x3bffecaefef02596, 0xf000205f, 0x1, 0xfffe1ffffffffeff, 0x1ffffffffeffff03, 0x0, 0xf97fffffffffffff, 0xffffc1e7ffff0000, 0xffffffff3000407f, 0xf7ffffffffff20bf, 0xffffffffffffffff, 0xffffffff3d7f3dff, 0x7f3dffffffff3dff, 0xffffffffff7fff3d, 0xffffffffff3dffff, 0x87ffffff, 0xffffffff0000ffff, 0x1fffffffffffff, 0xfffffffffffffffe, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff9fffffffffff, 0xffffffff07fffffe, 0x1c7ffffffffff, 0xfffff000fdfff, 0xddfff000fffff, 0xffcfffffffffffff, 0x108001ff, 0xffffffff00000000, 0xffffffffffffff, 0xffff07ffffffffff, 0x3fffffffffffff, 0x1ff0fff1fffffff, 0x1f3fffffff0000, 0xffff0fffffffffff, 0x3ff, 0xffffffff0fffffff, 0x1ffffe7fffffff, 0x8000000000, 0x0, 0xffefffffffffffff, 0xfef, 0xfc00f3ffffffffff, 0x3ffbfffffffff, 0x3fffffffffffff, 0x3ffffffffc00e000, 0x0, 0x6fde0000000000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffff3f3fffff, 0x3fffffffaaff3f3f, 0x5fdfffffffffffff, 0x1fdc1fff0fcf1fdc, 0x0, 0x8002000000000000, 0x1fff0000, 0x0, 0xf3ffbd503e2ffc84, 0xffffffff000043e0, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffc0000000000000, 0x3ffffffffff, 0xffff7fffffffffff, 0xffffffff7fffffff, 0xffffffffffffffff, 0xc781fffffffff, 0xffff20bfffffffff, 0x80ffffffffff, 0x7f7f7f7f007fffff, 0xffffffff7f7f7f7f, 0x800000000000, 0x0, 0x0, 0x0, 0x1f3e03fe000000e0, 0xfffffffffffffffe, 0xfffffffee07fffff, 0xf7ffffffffffffff, 0xfffe3fffffffffe0, 0xffffffffffffffff, 0x7ffffff00007fff, 0xffff000000000000, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1fff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1fff, 0x3fffffffffff0000, 0xc00ffff1fff, 0x8ff07fffffffffff, 0xffffffff80ffffff, 0xffffffffffff, 0xfffffffcff800000, 0xffffffffffffffff, 0x7ff000f79ff, 0xff00000000000000, 0xfffffff7bb, 0xfffffffffffff, 0xffffffffffffffff, 0x8fc00000000000f, 0xffff07fffffffc00, 0x1fffffff0007ffff, 0xfff7ffffffffffff, 0x8000, 0x7fffffffffffff, 0x47fffff00003fff, 0x7fffffffffffffff, 0x3cffff38000005, 0x7f7f007e7e7e, 0x0, 0x0, 0x7ffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff000fffffffff, 0xffffffffffff87f, 0xffffffffffffffff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7ffdffe0f8007f, 0xffffffffffffffdb, 0x3ffffffffffff, 0xfffffffffff80000, 0x3fffffffffffffff, 0xffffffffffff0000, 0xfffffffffffcffff, 0xfff0000000000ff, 0x0, 0xffdf000000000000, 0xffffffffffffffff, 0x1fffffffffffffff, 0x7fffffe00000000, 0xffffffc007fffffe, 0x7fffffffffffffff, 0x1cfcfcfc, 0xb7ffff7fffffefff, 0x3fff3fff, 0xffffffffffffffff, 0x7ffffffffffffff, 0x0, 0x1fffffffffffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff1fffffff, 0x1ffff, 0xffff00007fffffff, 0x7ff, 0xffffffff3fffffff, 0x3eff0f, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffff, 0x0, 0x91bffffffffffd3f, 0x3fffff, 0x0, 0x0, 0x3ffffff003fffff, 0x0, 0xc0ffffffffffffff, 0x0, 0xffffffeeff06f, 0x1fffffff00000000, 0x0, 0x0, 0x3fffffffffffff, 0x7ffff003fffff, 0x0, 0x0, 0xffffffffffffffff, 0x1ff, 0x0, 0x0, 0xffffffffffffffff, 0x3f, 0x1fffffffffffffc, 0x1ffffff0000, 0x7ffffffffffff, 0x0, 0xffffffffffffffff, 0x1e, 0x0, 0x0, 0x3fffffffffffff, 0x0, 0xffffffffffffffff, 0x7fffffffffff, 0x0, 0x0, 0xffffffffffffffff, 0x7ffffffff, 0x0, 0x0, 0x7fffffffffff, 0x0, 0x0, 0x0, 0x1ffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x7fffffffffff001f, 0xfff80000, 0x0, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffdfffff, 0xebffde64dfffffff, 0xffffffffffffffef, 0x7bffffffdfdfe7bf, 0xfffffffffffdfc5f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffff3fffffffff, 0xf7fffffff7fffffd, 0xffdfffffffdfffff, 0xffff7fffffff7fff, 0xfffffdfffffffdff, 0xff7, 0xaf7fe96ffffffef, 0x5ef7f796aa96ea84, 0xffffbee0ffffbff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7fffff, 0x1fffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2304 bytes -+enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x70], [ 0x100, 0x140, 0x2c00], [ 0x402030202020100, 0x207020206020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020208, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000000000, 0x5000400030002, 0x9000800070006, 0xd000c000b000a, 0xf00000000000e, 0x10000000000000, 0x14001300120011, 0x160015, 0x17, 0x0, 0x0, 0x190018, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b00000000, 0x1f001e001d001c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000000000, 0x2100000000, 0x220000, 0x0, 0x2300000000, 0x0, 0x250024, 0x2600000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x27000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2900280000, 0x0, 0x0, 0x0, 0x2a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x3f8, 0x0, 0x0, 0x0, 0xbffffffffffe0000, 0xb6, 0x7ff0000, 0x10000fffff800, 0x0, 0x3d9f9fc00000, 0xffff000000020000, 0x7ff, 0x1ffc000000000, 0xff80000000000, 0x3eeffbc00000, 0xe000000, 0x0, 0x7ffffff000000000, 0xdc0000000000000f, 0xc00feffff, 0xd00000000000000e, 0xc0080399f, 0xd00000000000000e, 0x23000000023987, 0xd00000000000000e, 0xc00003bbf, 0xd00000000000000e, 0xc00c0399f, 0xc000000000000004, 0x803dc7, 0xc00000000000000e, 0xc00603ddf, 0xd00000000000000c, 0xc00603ddf, 0xc00000000000000c, 0xc00803ddf, 0xc, 0xc0000ff5f8400, 0x7f2000000000000, 0x7f80, 0x1bf2000000000000, 0x3f00, 0xc2a0000003000000, 0xfffe000000000000, 0x1ffffffffeffe0df, 0x40, 0x7ffff80000000000, 0x1e3f9dc3c00000, 0x3c00bffc, 0x0, 0x0, 0xe0000000, 0x0, 0x0, 0x1c0000001c0000, 0xc0000000c0000, 0xfff0000000000000, 0x200fffff, 0x3800, 0x0, 0x20000000000, 0x0, 0xfff0fff00000000, 0x0, 0xffff000000000000, 0x301, 0xf800000, 0x9fffffff7fe00000, 0x0, 0x0, 0xfff000000000001f, 0xff8000000001f, 0x3ffe00000007, 0xfffc000000000, 0xfffff000000000, 0x0, 0x0, 0x1c21fffff70000, 0x0, 0x0, 0x0, 0xf000007fffffffff, 0x0, 0x0, 0x0, 0x1ffffffff0000, 0x0, 0x0, 0x0, 0x3800000000000, 0x0, 0x8000000000000000, 0x0, 0xffffffff00000000, 0xfc0000000000, 0x0, 0x6000000, 0x0, 0x0, 0x3ff7800000000000, 0x80000000, 0x3000000000000, 0xf800000844, 0x0, 0xfff0000000000003, 0x3ffff0000001f, 0x3fc000000000, 0xfff80, 0xfff800000000000f, 0x1, 0x7ffe0000000000, 0x800000000003008, 0xc19d000000000000, 0x60f80000000002, 0x0, 0x0, 0x0, 0x37f800000000, 0x40000000, 0x0, 0x0, 0x0, 0x7f0000ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000000000000000, 0x870000000000f06e, 0x0, 0x0, 0x0, 0xff00000000000007, 0x7f, 0x7ff000000000007, 0x0, 0x1fff8000000007, 0x0, 0xfff8000000000007, 0x1, 0x0, 0x0, 0xfff80000000000, 0x0, 0x0, 0x7ffffffffffe0000, 0x78000, 0x0, 0x0, 0xf807e3e000000000, 0x3c0000000fe7, 0x0, 0x0, 0x1c, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff, 0x0, 0x0, 0x0, 0x0]); -+//2384 bytes -+enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)([ 0x0, 0x20, 0xc0], [ 0x100, 0x280, 0x1a80], [ 0x402030202020100, 0x807020202020605, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000200010000, 0x2000200020002, 0x2000200020002, 0x5000200040003, 0x7000600020002, 0x9000800060006, 0x2000b0006000a, 0x2000d000c000c, 0x20002000e0005, 0x2000f00020002, 0x2000200020002, 0x11000200100002, 0x1300120002000e, 0xc00140002, 0x2000200020015, 0x2000200020002, 0x19001800170016, 0x2000200020002, 0x20002001b001a, 0x1d001c00020002, 0x2000200020002, 0x2000200020002, 0x20002001e0002, 0x2000200020002, 0x2000020002001f, 0x2000200220021, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200060023, 0xc0017000c0024, 0x400020002000c, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000e00020002, 0x26002500020002, 0x28002700020002, 0x2000200230002, 0x2000200020002, 0x2002a00020029, 0x2002c0002002b, 0x2000200020002, 0x200020002002d, 0xc002f0004002e, 0x2000200020002, 0x2000200020002, 0x2000200050002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020030, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2003100020002, 0x2000200020002, 0x32000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2003300020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x2000200020002, 0x3ff000000000000, 0x0, 0x720c000000000000, 0x0, 0x0, 0x0, 0x0, 0x3ff00000000, 0x0, 0x3ff000000000000, 0x0, 0x3ff, 0x0, 0xffc000000000, 0x0, 0x3f0ffc000000000, 0x0, 0xfcffc000000000, 0x0, 0x7ffc000000000, 0x0, 0x7f00ffc000000000, 0x0, 0x3fffc000000000, 0x0, 0x3ff0000, 0xfffff00000000, 0x0, 0x3ff0000, 0x0, 0x0, 0x1ffffe0000000000, 0x0, 0x1c00000000000, 0x0, 0x3ff03ff00000000, 0x0, 0xffc0, 0x0, 0x7ff0000, 0x3ff03ff, 0x0, 0x0, 0x3ff03ff, 0x0, 0x3f1000000000000, 0x3ff, 0x0, 0x0, 0xffffffffffff0000, 0x3e7, 0x0, 0x0, 0xffffffff00000000, 0xfffffff, 0xfffffc0000000000, 0x0, 0xffc0000000000000, 0xfffff, 0x0, 0x0, 0x2000000000000000, 0x70003fe00000080, 0x0, 0x3c0000, 0x0, 0x3ff00000000, 0xfffeff00, 0xfffe0000000003ff, 0x0, 0x3ff00000000, 0x0, 0x3f000000000000, 0x0, 0xfffffffffff80, 0x1ffffffffffffff, 0x400, 0x0, 0xf00000000, 0x402, 0x0, 0x3e0000, 0x0, 0xff000000, 0xfc00000, 0x0, 0x0, 0x60000000000000ff, 0x0, 0xff000000ff000000, 0x0, 0x7fffffff00000000, 0x0, 0xfffffffc0000, 0xffc0000000000000, 0x0, 0xffffffffffffffff, 0x7ffffffff, 0x0, 0x3ffff00000000, 0x0, 0xffffffffffffc000, 0x7ff, 0x0, 0x0, 0x0]); -+//2336 bytes -+enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x60], [ 0x100, 0x100, 0x3100], [ 0x402030202020100, 0x202020202020605, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000100010000, 0x5000400030001, 0x1000800070006, 0xb000a00090001, 0xd00010001000c, 0x10000f0001000e, 0x14001300120011, 0x1000100010015, 0x17000100010016, 0x18000100010001, 0x1000100190001, 0x1001c001b001a, 0x100010001001d, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1001f0001001e, 0x23002200210020, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x26002500240001, 0x28000100270001, 0x1000100010001, 0x2c002b002a0029, 0x1000100010001, 0x10001002e002d, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x100010001002f, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x8c00f7ee00000000, 0x28000000b8000001, 0x88c0088200000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4000000000000000, 0x80, 0x0, 0x0, 0xfc000000, 0x4000000000000600, 0x18000000000049, 0xc8003600, 0x3c0000000000, 0x0, 0x100000, 0x3fff, 0x0, 0x0, 0x380000000000000, 0x7fff000000000000, 0x40000000, 0x0, 0x0, 0x0, 0x1003000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000000000000, 0x0, 0x0, 0x0, 0x10000000000000, 0x0, 0xc008000, 0x0, 0x0, 0x3c0000000017fff0, 0x0, 0x20, 0x61f0000, 0x0, 0xfc00, 0x0, 0x800000000000000, 0x0, 0x1ff00000000, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x600000000000, 0x18000000, 0x380000000000, 0x60000000000000, 0x0, 0x0, 0x7700000, 0x7ff, 0x0, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0xc0000000, 0x0, 0x3f7f00000000, 0x0, 0x0, 0x1fc000000, 0x0, 0xf000000000000000, 0xf800000000000000, 0xc000000000000000, 0x0, 0x800ff, 0xffff00ffffff0000, 0x600000007ffbffef, 0x6000, 0x0, 0x60000000f00, 0x0, 0x0, 0x0, 0x0, 0x3fff0000000000, 0x0, 0xffc000000060, 0x0, 0x0, 0x1fffff8, 0x300000000f000000, 0x0, 0x0, 0x0, 0xde00000000000000, 0x0, 0x1000000000000, 0x0, 0x0, 0xfff7fffffffffff, 0x0, 0x0, 0x0, 0x20010000fff3ff0e, 0x0, 0x100000000, 0x800000000000000, 0x0, 0x0, 0x0, 0xc000000000000000, 0xe000, 0x4008000000000000, 0x0, 0xfc000000000000, 0x0, 0xf0000000000000, 0x0, 0x70000000000c000, 0xc00000000000, 0x80000000, 0x0, 0xc0003ffe, 0x0, 0xf0000000, 0x0, 0x30000c0000000, 0x0, 0x0, 0x0, 0x80000000000, 0xc000000000000000, 0x0, 0x0, 0x0, 0xffff000003ff0000, 0xd0bfff7ffff, 0x0, 0x0, 0xb80000018c00f7ee, 0x3fa8000000, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x10000, 0x0, 0x800000, 0x0, 0x0, 0x8000000080000000, 0x0, 0x0, 0x0, 0x0, 0x8000000001ff0000, 0x0, 0x0, 0xfe00000000000000, 0x0, 0x0, 0x0, 0x0, 0x3f80, 0xd800000000000000, 0x3, 0x0, 0xf, 0x0, 0x1e0, 0x0, 0xf000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2848 bytes -+enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0x70], [ 0x100, 0x140, 0x3d00], [ 0x503040303020100, 0x807030303030306, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x303030303030303, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x7000600050004, 0xa000900080001, 0xe000d000c000b, 0x1000010001000f, 0x11000100010001, 0x13000100120001, 0x14000100010001, 0x18001700160015, 0x1a001700170019, 0x1c0017001b0017, 0x1f001e0001001d, 0x17002200210020, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100230001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x25000100010024, 0x1002700010026, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x28000100010001, 0x2b002a00290001, 0x10001002c0001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x30002f002e002d, 0x32003100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1003300010001, 0x37003600350034, 0x3b003a00390038, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x7000081000000000, 0x5000000140000000, 0x113d37c00000000, 0x80000000800000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffafe0fffc003c, 0x0, 0x20000000000000, 0x30, 0x40000000000000, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8000, 0x0, 0xc9c0, 0x0, 0x0, 0x6000020040000000, 0x0, 0x0, 0x0, 0x40000000000000, 0x0, 0x0, 0x0, 0xc0c000000000000, 0x0, 0x0, 0x0, 0x2000000000000, 0x0, 0x1000000000000, 0x0, 0x7f8000000000000, 0x0, 0x8000000000000000, 0x0, 0x0, 0x0, 0x200000000000000, 0x0, 0x0, 0x8000000000000000, 0x0, 0x0, 0x0, 0x1500000fce8000e, 0x0, 0xc000000000000000, 0x1e0dfbf, 0x0, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x0, 0x1, 0x0, 0xffffffffc0000000, 0x0, 0x1ff007fe00000000, 0x0, 0x0, 0x0, 0x0, 0xa000000000000000, 0x6000e000e000e003, 0x0, 0x1c00000000040010, 0x7ffffff00001c00, 0x0, 0xc0042afc1d0037b, 0xbc1f, 0xffffffffffff0000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffff9fffffff0ff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffffffff, 0x7fffffffff, 0x7ff, 0xfffffffff0000000, 0x3ffffffffff, 0xfffffffffffffffe, 0xffffffffff, 0xfffffffffff00000, 0xffff003fffffff9f, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffffe000007, 0xcffffffff0ffffff, 0xffffffffffffffff, 0x3ff1fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7e000000000, 0x0, 0x0, 0xfffffffffbffffff, 0xfffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfff0000003fffff, 0xc0c00001000c0010, 0x0, 0x18000000, 0x0, 0x0, 0x0, 0xffc30000, 0xfffffffff, 0xfffffc007fffffff, 0xffffffff000100ff, 0x1fffffffffc00, 0x7fffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x0, 0x0, 0xffffffffffff0000, 0x7f, 0x3007fffff, 0x0, 0x600, 0x0, 0x3c00f0000000000, 0x0, 0x0, 0x0, 0x0, 0x380000000000000, 0x0, 0x0, 0x20000000000, 0x0, 0xfffc000000000000, 0x3, 0x0, 0x0, 0x0, 0x3000000000000000, 0x0, 0x27400000000, 0x0, 0x0, 0x4000000070000810, 0x50000001, 0x0, 0x30007f7f00000000, 0xff80000000000000, 0xfe00000000000000, 0xfff03ff, 0x1fffffffffff0000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffffffffff, 0xfffffe7fffffffff, 0x1c1fffffffff, 0xffffc3fffffff018, 0x3fffffff, 0xffffffffffffffff, 0x23, 0x0, 0x0, 0xffffffffffffffff, 0x7fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x800000008000002, 0x20000000200000, 0x800000008000, 0x20000000200, 0x8, 0x0, 0x0, 0x0, 0x3000000000000, 0xffff0fffffffffff, 0xffffffffffffffff, 0x7ffe7fff000fffff, 0xfffefffe, 0xffff7fffffff0000, 0xffff0fffffffffff, 0x7ffffff, 0xffffffc000000000, 0x7ffffffffff0007, 0x301ff, 0x0, 0x0, 0xffbf0001ffffffff, 0x1fffffffffffffff, 0xffffffff000fffff, 0x1ffff000007df, 0x7fffffffffffffff, 0xfffffffffffffffd, 0xffffffffffffffff, 0x1effffffffffffff, 0x3fffffffffffffff, 0xffffff000f, 0x0, 0xf800000000000000, 0xffffffffffffffff, 0xffe1, 0xffffffffffffffff, 0x3f, 0xffffffffffffffff, 0xfffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//4576 bytes -+enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x20, 0xb8], [ 0x100, 0x260, 0x6100], [ 0x706050403020100, 0xe0d0c0a0b0a0908, 0x100a0f0303030303, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a11, 0xa0a0a0a0a0a0a0a, 0xa0a0a0a0a0a0a0a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000100010000, 0x5000400030001, 0x9000800070006, 0xd000c000b000a, 0x10000f0001000e, 0x12001100010001, 0x16001500140013, 0x19000100180017, 0x1c0001001b001a, 0x1e00010001001d, 0x1f000100010001, 0x23002200210020, 0x1002600250024, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100270001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x28000100010001, 0x1000100010001, 0x2b002a00010029, 0x2f002e002d002c, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x30000100010001, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x33003200010031, 0x36003500340001, 0x3a003900380037, 0x3100310031003b, 0x3f003e003d003c, 0x31004100310040, 0x31003100430042, 0x31004400310031, 0x31003100310031, 0x31003100310031, 0x45000100010001, 0x31003100310046, 0x31003100310031, 0x31003100310031, 0x1000100010001, 0x31003100310047, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31004800010001, 0x49003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x3100310031004a, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x4e004d004c004b, 0x5200510050004f, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31005300310031, 0x57005600550054, 0x5b005a00590058, 0x31003100310031, 0x31003100310031, 0x1000100010001, 0x1005c00010001, 0x1000100010001, 0x1000100010001, 0x1000100010001, 0x5d000100010001, 0x3100310031005e, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31005e00010001, 0x31003100310031, 0x310031005f0031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0x31003100310031, 0xffffffff00000000, 0x7fffffffffffffff, 0xffffdfff00000000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7cffffffffffffff, 0xfffffffbffffd7f0, 0xffffffffffffffff, 0xfffe00ffffffffff, 0xfffffffefe7fffff, 0xfffffffffffe86ff, 0x1f07ffffff00ff, 0xffffffffcfffffc0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffdfffffff, 0xffffffffffff3fff, 0xffffffffffffe7ff, 0x3ffffffffffff, 0x7ffffffffffffff, 0x7fff3fffffffffff, 0x4fffffff, 0x1ffd00000000, 0x7ffffff000000000, 0xffffffffffffffff, 0xfeffffffffffffff, 0xf3c5fdfffff99fee, 0xfffffcfb080799f, 0xd36dfdfffff987ee, 0x3fffc05e023987, 0xf3edfdfffffbbfee, 0x3ffcf00013bbf, 0xf3edfdfffff99fee, 0xffffcfb0c0399f, 0xc3ffc718d63dc7ec, 0x7ffffc000813dc7, 0xe3effdfffffddfee, 0xff00ffcf03603ddf, 0xf3effdfffffddfec, 0x6ffcf40603ddf, 0xe7fffffffffddfec, 0xfe3fffcf00807ddf, 0x2ffbfffffc7fffec, 0x1c0000ff5f847f, 0x87fffffffffffffe, 0xfffffff, 0x3bffecaefef02596, 0xf3ff3f5f, 0xffffffffffffffff, 0xfffe1ffffffffeff, 0xdffffffffeffffff, 0x7ffdfff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff20bf, 0xffffffffffffffff, 0xffffffff3d7f3dff, 0x7f3dffffffff3dff, 0xffffffffff7fff3d, 0xffffffffff3dffff, 0x1fffffffe7ffffff, 0xffffffff03ffffff, 0x1fffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff1fffffff, 0x1ffffffffffff, 0x7fffff001fdfff, 0xddfff000fffff, 0xffffffffffffffff, 0x3ff03ff3fffffff, 0xffffffff03ff3fff, 0xffffffffffffff, 0xffff07ffffffffff, 0x3fffffffffffff, 0xfff0fff1fffffff, 0x1f3ffffffffff1, 0xffff0fffffffffff, 0xffffffffc7ff03ff, 0xffffffffcfffffff, 0x9fffffff7fffffff, 0x3fff03ff03ff, 0x0, 0xffffffffffffffff, 0x1fffffffffff0fff, 0xffffffffffffffff, 0xf00fffffffffffff, 0xf8ffffffffffffff, 0xffffffffffffe3ff, 0x0, 0x7fffffffff00ff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xf000007fffffffff, 0xffffffff3f3fffff, 0x3fffffffaaff3f3f, 0xffdfffffffffffff, 0x7fdcffffefcfffdf, 0xffff80ffffff07ff, 0xfff30000ffffffff, 0x7ffffff1fff7fff, 0x1ffffffff0000, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff03ff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffffffff, 0x7fffffffff, 0xffffffff000007ff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfffffffffffffffe, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3ff1fff, 0x0, 0x0, 0xffff7fffffffffff, 0xffffffff7fffffff, 0xffffffffffffffff, 0xfe0fffffffffffff, 0xffff20bfffffffff, 0x800180ffffffffff, 0x7f7f7f7f007fffff, 0xffffffff7f7f7f7f, 0xfffffffffffffff, 0x0, 0xfffffffffbffffff, 0xfffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfff0000003fffff, 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffe7fffff, 0xffffffffffffffff, 0xfffe3fffffffffe0, 0xffffffffffffffff, 0x7ffffffffff7fff, 0xffff000fffffffff, 0xffffffff7fffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7fffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1fff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff1fff, 0xffffffffffff007f, 0xfffffffffff, 0xffffffffffffffff, 0xffffffff80ffffff, 0xffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7ff000f7fff, 0xff00000000000000, 0x3ff0fffffffffff, 0xffffffffffffff, 0xffffffffffffffff, 0xfffffff03ffc01f, 0xffffffffffffffff, 0x1fffffff800fffff, 0xffffffffffffffff, 0xc3ffbfff, 0x7fffffffffffff, 0xffffffff3ff3fff, 0xffffffffffffffff, 0x7ffffff8000007, 0x7f7f007e7e7e, 0x0, 0x0, 0x3ff3fffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff000fffffffff, 0xffffffffffff87f, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffff3fffffffffff, 0xffffffffffffffff, 0x3ffffff, 0x5f7fffffe0f8007f, 0xffffffffffffffdb, 0xffffffffffffffff, 0xfffffffffff80003, 0xffffffffffffffff, 0xffffffffffff0000, 0xfffffffffffcffff, 0x3fff0000000000ff, 0xffff007f03ffffff, 0xffdf0f7ffff7ffff, 0xffffffffffffffff, 0x1fffffffffffffff, 0xfffffffffffffffe, 0xffffffffffffffff, 0x7fffffffffffffff, 0x30007f7f1cfcfcfc, 0xb7ffff7fffffefff, 0x3fff3fff, 0xffffffffffffffff, 0x7ffffffffffffff, 0xff8fffffffffff87, 0xffffffffffffffff, 0xfff07ff, 0x3fffffffffff0000, 0x0, 0x0, 0xffffffff1fffffff, 0x1ffff, 0xffff000f7fffffff, 0x7ff, 0xffffffffbfffffff, 0x3fff0f, 0xffffffffffffffff, 0xffffffffffffffff, 0x3ff3fffffff, 0x0, 0x91bffffffffffd3f, 0xffbfffff, 0x0, 0x0, 0x83ffffff8fffffff, 0x0, 0xc0ffffffffffffff, 0x0, 0x870ffffffeeff06f, 0xffffffff01ff00ff, 0x0, 0x0, 0xfe3fffffffffffff, 0xff07ffffff3fffff, 0x0, 0x0, 0xffffffffffffffff, 0x1ff, 0x0, 0x0, 0x0, 0x7fffffff00000000, 0x0, 0x0, 0xffffffffffffffff, 0xfffffffc3fff, 0xdfffffffffffffff, 0x3ff01ffffff0003, 0xffdfffffffffffff, 0xf, 0xffffffffffffffff, 0x3ff01ff, 0x0, 0x0, 0xffffffffffffff, 0x3ff, 0xffffffffffffffff, 0x7fffffffffff, 0x0, 0x0, 0xffffffffffffffff, 0xf0007ffffffff, 0x0, 0x0, 0x7fffffffffff, 0x0, 0x0, 0x0, 0x1ffffffffffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0x7fffffffffff001f, 0xffff8000, 0x0, 0x3, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffffffffff, 0xfffffe7fffffffff, 0xf807ffffffffffff, 0xffffffffffffffff, 0x3fffffff, 0xffffffffffffffff, 0x3f, 0x0, 0x0, 0xffffffffffffffff, 0x3ffff007fffff, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffdfffff, 0xebffde64dfffffff, 0xffffffffffffffef, 0x7bffffffdfdfe7bf, 0xfffffffffffdfc5f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffff3fffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffcfff, 0xaf7fe96ffffffef, 0x5ef7f796aa96ea84, 0xffffbee0ffffbff, 0x3000000000000, 0xffff0fffffffffff, 0xffffffffffffffff, 0x7ffe7fff000fffff, 0xfffefffe, 0xffff7fffffff07ff, 0xffff0fffffffffff, 0x7ffffff, 0xffffffc000000000, 0x7ffffffffff0007, 0x301ff, 0x0, 0x0, 0xffbf0001ffffffff, 0x1fffffffffffffff, 0xffffffff000fffff, 0x1ffff000007df, 0x7fffffffffffffff, 0xfffffffffffffffd, 0xffffffffffffffff, 0x1effffffffffffff, 0x3fffffffffffffff, 0xffffff000f, 0x0, 0xf800000000000000, 0xffffffffffffffff, 0xffe1, 0xffffffffffffffff, 0x3f, 0xffffffffffffffff, 0xfffffffffffff, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x7fffff, 0x1fffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fffffff, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff, 0x0, 0x0, 0x0, 0x0]); -+//3664 bytes -+enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)([ 0x0, 0x10, 0x4c, 0x104], [ 0x80, 0xf0, 0x2e0, 0x3180], [ 0x706050403020100, 0xb0b0b0b0a090808, 0xb0b0b0b0b0b0b0b, 0xb0b0b0b0b0b0b0b, 0xb0b0b0b0b0b0b0b, 0xb0b0b0b0b0b0b0b, 0xb0b0b0b0b0b0b0b, 0xd0808080b0b0b0c, 0xd080808, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3000200010000, 0x7000600050004, 0xb000a00090008, 0xd000d000d000c, 0xe000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xf000d000d000d, 0xd00110010000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d0012000d, 0xd000d000d000d, 0x140013000d000d, 0x18001700160015, 0x1b001b001a0019, 0x1b001b001d001c, 0x1b001b001e000d, 0x1b001b001b001b, 0x1b001b001b001b, 0x20001f001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b0021, 0x1b001b001b001b, 0x1b001b00230022, 0x24001b001b001b, 0x1b001b00260025, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d0027000d, 0x1b00290028000d, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b002a001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b002b, 0x1b001b001b001b, 0x1b001b001b001b, 0x1b001b001b001b, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0x2c000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0xd000d000d000d, 0x2c000d000d000d, 0x0, 0x0, 0x0, 0x200010000, 0x0, 0x6000500040003, 0x7, 0xb000a00090008, 0xf000e000d000c, 0x12001100100000, 0x16001500140013, 0x1a001900180017, 0x1e001d001c001b, 0x2200210020001f, 0x26002500240023, 0x29002800270000, 0x2a000000000000, 0x0, 0x2d002c002b0000, 0x310030002f002e, 0x0, 0x0, 0x33003200000000, 0x36000000350034, 0x3a003900380037, 0x3e003d003c003b, 0x4200410040003f, 0x44000000430000, 0x47004200460045, 0x48000000000000, 0x0, 0x4c004b004a0049, 0x4f004e004d0000, 0x5000000000, 0x0, 0x51000000000000, 0x530052, 0x0, 0x0, 0x54, 0x0, 0x0, 0x0, 0x42004200550000, 0x58000000570056, 0x5c005b005a0059, 0x51005e0042005d, 0x5f000000000000, 0x6000540000, 0x63006200000061, 0x64000000000057, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3a00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x65000000000000, 0x67006600000000, 0x0, 0x38006900000068, 0x6b006a00000000, 0x6d00000038006c, 0x6f0000006e0000, 0x72000000710070, 0x74004200420073, 0x0, 0x0, 0x0, 0x75006300000000, 0x0, 0x0, 0x77000000760000, 0x7a000000790078, 0x0, 0x7d007c007b0000, 0x800000007f007e, 0x81006400000054, 0xb000000830082, 0x86008500000084, 0x87003200420042, 0x8b008a00890088, 0x42008c00000000, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x420042008e008d, 0x4200900042008f, 0x42004200920091, 0x42004200940093, 0x42004200950000, 0x42004200420042, 0x42004200960042, 0x42004200420042, 0x98000000970000, 0x9a00000099004b, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x9b003800420042, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x0, 0x0, 0x0, 0x420042009c0000, 0x420042009d0000, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x4200420042009c, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x0, 0x0, 0x4200420042009e, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x4200a0009f0000, 0x420042004200a1, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x3a000000000000, 0xa30000000000a2, 0x42004200a40000, 0x42004200a50000, 0xa800a700a60000, 0xaa00a9, 0xab00000000, 0xac000000000000, 0x42004200420042, 0x42004200420042, 0xb000af00ae00ad, 0x42004200420042, 0xb200b10000003d, 0xb500b4003d00b3, 0x42004200b700b6, 0xbb00ba00b900b8, 0xbd000000bc0064, 0xc0004200bf00be, 0xa4000000c10000, 0x42004200510000, 0x0, 0x0, 0xc2000000000000, 0x0, 0x0, 0x0, 0x0, 0x31, 0x420042004200a3, 0x42004200420042, 0x42004200420042, 0x42004200420042, 0x0, 0x0, 0x420042004200a3, 0x42004200420042, 0x420042000000c3, 0xc4000000000000, 0x42004200420042, 0x42004200420042, 0x0, 0x0, 0x0, 0xbe000000000000, 0x0, 0x0, 0x0, 0xbe000000000000, 0x0, 0x8300000000000000, 0x40000280f, 0x1ff0000000000, 0x101800000, 0x17900, 0xffe0f8000000ff00, 0x20000020, 0x4000, 0x1800, 0xfffc000000000000, 0xf800000000000000, 0x8000c00000000000, 0xffffffffb0000000, 0xffffe002ffffffff, 0x8000000fffffffff, 0x100000000000000, 0xc3a020000066011, 0xf00000304f7f8660, 0x2c92020000067811, 0xffc0003fa1fdc678, 0xc12020000044011, 0xfffc0030fffec440, 0xc12020000066011, 0xff0000304f3fc660, 0x3c0038e729c23813, 0xf800003fff7ec238, 0x1c10020000022011, 0xff0030fc9fc220, 0xc10020000022013, 0xfff90030bf9fc220, 0x1800000000022013, 0x1c00030ff7f8220, 0xd004000003800013, 0xffe3ffff00a07b80, 0x7800000000000001, 0xfffffffff0000000, 0xc4001351010fda69, 0xffffffff0c00c0a0, 0x1e00000000100, 0x2000000001000000, 0xfffffffff8002000, 0xdf40, 0xc280c200, 0x80c200000000c200, 0x8000c2, 0xc20000, 0xe000000018000000, 0xfc000000, 0xffe0000000000000, 0xe0000000, 0xfffe000000000000, 0xff800000ffe02000, 0xfff22000fff00000, 0xfc00fc00c0000000, 0xfc008000, 0xff00000000000000, 0xf80000000000, 0xffc0000000000000, 0xf000f000e0000000, 0xffe0c0000000000e, 0xf00000000000, 0x3800fc00, 0x30000000, 0x6000000080000000, 0xffffc000fc00fc00, 0xffffffffffffffff, 0xe00000000000f000, 0xff0000000000000, 0x700000000000000, 0x1c00, 0xff8000000000ff00, 0xfffff8000000000, 0xc0c00000, 0xc00000005500c0c0, 0x20000000000000, 0x8023000010300020, 0xc002000000000, 0xf8000000e0008000, 0xfffe00000000ffff, 0xfc00, 0xfff0000000000000, 0xffffff8000000000, 0xfffff800, 0x1, 0xfffffffffc00e000, 0x800000000000, 0x80000000, 0x1f0000000000000, 0xdf4000000000, 0x7ffe7f0000000000, 0x80808080ff800000, 0x80808080, 0xf000000000000000, 0x4000000, 0xf000ffffffc00000, 0x1800000, 0x1c0000000001f, 0xf800000000008000, 0xfff000000000, 0x8000000000000000, 0xffffffffffffe000, 0xe000, 0xff80, 0xfffff00000000000, 0x7f000000, 0xfffff800fff08000, 0xffffffffffffff, 0xfc00f00000000000, 0xf0000000fc003fe0, 0xe00000007ff00000, 0xffffffff3c004000, 0xff80000000000000, 0xf00000000c00c000, 0xff80000007fffff8, 0xffff8080ff818181, 0xfc00c00000000000, 0xf000000000000780, 0xc00000000000, 0xfffffffffc000000, 0xa08000001f07ff80, 0x24, 0x7fffc, 0xffff, 0x30000, 0xc000ffffffffff00, 0xff80fc000000, 0x20f08000080000, 0x6000000000000000, 0xc1ff8080e3030303, 0x4800008000001000, 0xffffffffc000c000, 0x70000000000078, 0xfffffffff000f800, 0xc00000000000ffff, 0xfffffffffffe0000, 0xfff080000000, 0xfffffffffffff800, 0x40000000, 0xffffffffffc000f0, 0xfffffc00c0000000, 0x6e400000000002c0, 0xffffffff00400000, 0x7c00000070000000, 0x3f00000000000000, 0x78f0000001100f90, 0xfe00ff00, 0x1c0000000000000, 0xf8000000c00000, 0xfffffffffffffe00, 0x80000000ffffffff, 0xffff00000003c000, 0xfc00fe000000fffc, 0xfffffffffffffff0, 0xfffffffffc00fe00, 0xfffffffffffffc00, 0xffff800000000000, 0xfff0fff800000000, 0xfe00000000000000, 0x800000000000ffe0, 0xffffffff00007fff, 0xfffffffffffffffc, 0x18000000000, 0xffffffffc0000000, 0xffffffffffffffc0, 0xfffc0000ff800000, 0x200000, 0x1400219b20000000, 0x10, 0x8400000020201840, 0x203a0, 0xc000000000, 0x3000, 0xf508016900000010, 0xa10808695569157b, 0xf0000411f0000400, 0xfffcffffffffffff, 0x80018000fff00000, 0xffffffff00010001, 0x80000000f800, 0xfffffffff8000000, 0x3fffffffff, 0xf80000000000fff8, 0xfffffffffffcfe00, 0x40fffe00000000, 0xe000000000000000, 0xfff00000, 0xfffe0000fffff820, 0x2, 0xe100000000000000, 0xc000000000000000, 0xffffff000000fff0, 0x7ffffffffffffff, 0xffffffffffff001e, 0xffffffffff800000, 0xfffffffd, 0xffff000000000000, 0xc000000000000000]); -+enum MAX_SIMPLE_LOWER = 1043; -+enum MAX_SIMPLE_UPPER = 1051; -+enum MAX_SIMPLE_TITLE = 1055; -+//8192 bytes -+enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x100], [ 0x100, 0x380, 0xc00], [ 0x402030202020100, 0x202020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x3000200010000, 0x7000600050004, 0xa00090008, 0xd000c000b0000, 0x110010000f000e, 0x1400130012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x150000, 0x19001800170016, 0x1d001c001b001a, 0x0, 0x1f001e0000, 0x0, 0x0, 0x20000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24002300220021, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2700260000, 0x2a00290028, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x2c0000, 0x0, 0x0, 0x0, 0x0, 0x2e002d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x200010000ffff, 0x6000500040003, 0xa000900080007, 0xe000d000c000b, 0x1200110010000f, 0x16001500140013, 0xffff001900180017, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff001affff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41bffffffffffff, 0x1e001d001c001b, 0x2200210020001f, 0x26002500240023, 0x2a002900280027, 0x2e002d002c002b, 0xffff00310030002f, 0x35003400330032, 0x39003800370036, 0x3bffff003affff, 0x3dffff003cffff, 0x3fffff003effff, 0x41ffff0040ffff, 0x43ffff0042ffff, 0x45ffff0044ffff, 0x47ffff0046ffff, 0x49ffff0048ffff, 0x4bffff004affff, 0x4dffff004cffff, 0x4fffff004effff, 0x51ffff0050ffff, 0x53ffff0052041d, 0x55ffff0054ffff, 0xffff0056ffffffff, 0xffff0058ffff0057, 0xffff005affff0059, 0xffff005cffff005b, 0x5effff043a005d, 0x60ffff005fffff, 0x62ffff0061ffff, 0x64ffff0063ffff, 0x66ffff0065ffff, 0x68ffff0067ffff, 0x6affff0069ffff, 0x6cffff006bffff, 0x6effff006dffff, 0x70ffff006fffff, 0x72ffff0071ffff, 0x74ffff0073ffff, 0xffff0075ffffffff, 0x780077ffff0076, 0x7affffffff0079, 0xffffffff007bffff, 0xffffffffffff007c, 0xffffffffffff007d, 0xffff007effffffff, 0xffffffff007fffff, 0xffff00810080ffff, 0xffff0082ffffffff, 0x84ffff0083ffff, 0xffffffff0085ffff, 0xffffffffffff0086, 0xffffffff0087ffff, 0xffffffffffff0088, 0xffff008affff0089, 0xffffffff008bffff, 0x8dffff008cffff, 0xffffffffffffffff, 0xffff008f008effff, 0x92ffff00910090, 0xffff0094ffff0093, 0xffff0096ffff0095, 0xffff0098ffff0097, 0xffff009affff0099, 0x9dffff009c009b, 0x9fffff009effff, 0xa1ffff00a0ffff, 0xa3ffff00a2ffff, 0xa5ffff00a4ffff, 0xa700a6ffff0442, 0xffffffff00a8ffff, 0xaaffff00a9ffff, 0xacffff00abffff, 0xaeffff00adffff, 0xb0ffff00afffff, 0xb2ffff00b1ffff, 0xb4ffff00b3ffff, 0xb6ffff00b5ffff, 0xb8ffff00b7ffff, 0xbaffff00b9ffff, 0xbcffff00bbffff, 0xbdffffffffffff, 0xbfffff00beffff, 0xc1ffff00c0ffff, 0xc3ffff00c2ffff, 0xc5ffff00c4ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xc7ffffffff00c6, 0xffff00c9ffff00c8, 0xcaffffffffffff, 0xccffff00cbffff, 0xceffff00cdffff, 0xd200d100d000cf, 0xd500d4ffff00d3, 0xd7ffff00d6ffff, 0xffffffffffffffff, 0xd9ffffffff00d8, 0xffff00db00daffff, 0xdeffff00dd00dc, 0xdfffffffffffff, 0xffff00e100e0ffff, 0xffffffff00e2ffff, 0xffffffffffffffff, 0xffffffff00e3ffff, 0xe5ffffffff00e4, 0xffffffffffffffff, 0xe900e800e700e6, 0xffffffffffff00ea, 0xffff00ebffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff00ecffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xeeffff00edffff, 0xefffffffffffff, 0xf0ffffffffffff, 0xffffffff00f200f1, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff043c, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xf600f500f400f3, 0xf900f800f7043f, 0xfd00fc00fb00fa, 0x101010000ff00fe, 0x105010401030102, 0x109010801070106, 0x10d010c010b010a, 0x1110110010f010e, 0xffff011401130112, 0xffffffff01160115, 0x11901180117ffff, 0x11bffff011affff, 0x11dffff011cffff, 0x11fffff011effff, 0x121ffff0120ffff, 0x123ffff0122ffff, 0x125ffff0124ffff, 0xffff012801270126, 0xffffffff0129ffff, 0x12bffffffff012a, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x12f012e012d012c, 0x133013201310130, 0x137013601350134, 0x13b013a01390138, 0x13f013e013d013c, 0x143014201410140, 0x147014601450144, 0x14b014a01490148, 0x14f014e014d014c, 0x153015201510150, 0x157015601550154, 0x15b015a01590158, 0x15dffff015cffff, 0x15fffff015effff, 0x161ffff0160ffff, 0x163ffff0162ffff, 0x165ffff0164ffff, 0x167ffff0166ffff, 0x169ffff0168ffff, 0x16bffff016affff, 0xffffffff016cffff, 0xffffffffffffffff, 0x16dffffffffffff, 0x16fffff016effff, 0x171ffff0170ffff, 0x173ffff0172ffff, 0x175ffff0174ffff, 0x177ffff0176ffff, 0x179ffff0178ffff, 0x17bffff017affff, 0x17dffff017cffff, 0x17fffff017effff, 0x181ffff0180ffff, 0x183ffff0182ffff, 0x185ffff0184ffff, 0x187ffff0186ffff, 0xffff0188ffffffff, 0xffff018affff0189, 0xffff018cffff018b, 0x18f018effff018d, 0x191ffff0190ffff, 0x193ffff0192ffff, 0x195ffff0194ffff, 0x197ffff0196ffff, 0x199ffff0198ffff, 0x19bffff019affff, 0x19dffff019cffff, 0x19fffff019effff, 0x1a1ffff01a0ffff, 0x1a3ffff01a2ffff, 0x1a5ffff01a4ffff, 0x1a7ffff01a6ffff, 0x1a9ffff01a8ffff, 0x1abffff01aaffff, 0x1adffff01acffff, 0x1afffff01aeffff, 0x1b1ffff01b0ffff, 0x1b3ffff01b2ffff, 0x1b5ffff01b4ffff, 0x1b7ffff01b6ffff, 0x1b9ffff01b8ffff, 0x1bbffff01baffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1be01bd01bcffff, 0x1c201c101c001bf, 0x1c601c501c401c3, 0x1ca01c901c801c7, 0x1ce01cd01cc01cb, 0x1d201d101d001cf, 0x1d601d501d401d3, 0x1da01d901d801d7, 0x1de01dd01dc01db, 0x42e01e101e001df, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff01e2ffff, 0xffffffff01e3ffff, 0x1e5ffff01e4ffff, 0x1e7ffff01e6ffff, 0x1e9ffff01e8ffff, 0x1ebffff01eaffff, 0x1edffff01ecffff, 0x1efffff01eeffff, 0x1f1ffff01f0ffff, 0x1f3ffff01f2ffff, 0x1f5ffff01f4ffff, 0x1f7ffff01f6ffff, 0x1f9ffff01f8ffff, 0x1fbffff01faffff, 0x1fdffff01fcffff, 0x1ffffff01feffff, 0x201ffff0200ffff, 0x203ffff0202ffff, 0x205ffff0204ffff, 0x207ffff0206ffff, 0x209ffff0208ffff, 0x20bffff020affff, 0x20dffff020cffff, 0x20fffff020effff, 0x211ffff0210ffff, 0x213ffff0212ffff, 0x215ffff0214ffff, 0x217ffff0216ffff, 0x219ffff0218ffff, 0x21bffff021affff, 0x21dffff021cffff, 0x21fffff021effff, 0x221ffff0220ffff, 0x223ffff0222ffff, 0x225ffff0224ffff, 0x227ffff0226ffff, 0x229ffff0228ffff, 0x22bffff022affff, 0x22dffff022cffff, 0x4460444022effff, 0x22f044c044a0448, 0xffffffffffffffff, 0x231ffff0230ffff, 0x233ffff0232ffff, 0x235ffff0234ffff, 0x237ffff0236ffff, 0x239ffff0238ffff, 0x23bffff023affff, 0x23dffff023cffff, 0x23fffff023effff, 0x241ffff0240ffff, 0x243ffff0242ffff, 0x245ffff0244ffff, 0x247ffff0246ffff, 0x249ffff0248ffff, 0x24bffff024affff, 0x24dffff024cffff, 0x24fffff024effff, 0x251ffff0250ffff, 0x253ffff0252ffff, 0x255ffff0254ffff, 0x257ffff0256ffff, 0x259ffff0258ffff, 0x25bffff025affff, 0x25dffff025cffff, 0x25fffff025effff, 0x263026202610260, 0x267026602650264, 0xffffffffffffffff, 0xffffffffffffffff, 0x26b026a02690268, 0xffffffff026d026c, 0xffffffffffffffff, 0xffffffffffffffff, 0x2710270026f026e, 0x275027402730272, 0xffffffffffffffff, 0xffffffffffffffff, 0x279027802770276, 0x27d027c027b027a, 0xffffffffffffffff, 0xffffffffffffffff, 0x2810280027f027e, 0xffffffff02830282, 0xffffffffffffffff, 0xffffffffffffffff, 0x28504500284044e, 0x287045602860453, 0xffffffffffffffff, 0xffffffffffffffff, 0x28b028a02890288, 0x28f028e028d028c, 0xffffffffffffffff, 0xffffffffffffffff, 0x293029202910290, 0x297029602950294, 0x29b029a02990298, 0xffffffff029d029c, 0x47d047b04790477, 0x48504830481047f, 0x48d048b04890487, 0x49504930491048f, 0x49d049b04990497, 0x4a504a304a1049f, 0x4ad04ab04a904a7, 0x4b504b304b104af, 0x4bd04bb04b904b7, 0x4c504c304c104bf, 0x4cd04cb04c904c7, 0x4d504d304d104cf, 0x4d704e302b702b6, 0x4ef0459ffff04e5, 0xffffffffffffffff, 0xffff02b9ffff04d9, 0x4db04e7ffffffff, 0x4f2045bffff04e9, 0xffffffffffffffff, 0xffffffffffff04dd, 0x460045d02bc02bb, 0x4650463ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x46b046802be02bd, 0x472047002bf046e, 0xffffffffffffffff, 0xffffffffffffffff, 0x4df04ebffffffff, 0x4f50475ffff04ed, 0xffffffffffffffff, 0xffffffffffff04e1, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff02c1ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2c502c402c302c2, 0x2c902c802c702c6, 0x2cd02cc02cb02ca, 0x2d102d002cf02ce, 0xffffffffffffffff, 0xffffffffffff02d2, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2d602d502d402d3, 0x2da02d902d802d7, 0x2de02dd02dc02db, 0x2e202e102e002df, 0x2e602e502e402e3, 0x2ea02e902e802e7, 0xffffffff02ec02eb, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2f002ef02ee02ed, 0x2f402f302f202f1, 0x2f802f702f602f5, 0x2fc02fb02fa02f9, 0x30002ff02fe02fd, 0x304030303020301, 0x308030703060305, 0x30c030b030a0309, 0x310030f030e030d, 0x314031303120311, 0x318031703160315, 0xffff031b031a0319, 0xffffffff031cffff, 0xffff031e031dffff, 0xffff0320ffff031f, 0xffffffffffff0321, 0x322ffffffffffff, 0xffff0323ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x325ffff0324ffff, 0x327ffff0326ffff, 0x329ffff0328ffff, 0x32bffff032affff, 0x32dffff032cffff, 0x32fffff032effff, 0x331ffff0330ffff, 0x333ffff0332ffff, 0x335ffff0334ffff, 0x337ffff0336ffff, 0x339ffff0338ffff, 0x33bffff033affff, 0x33dffff033cffff, 0x33fffff033effff, 0x341ffff0340ffff, 0x343ffff0342ffff, 0x345ffff0344ffff, 0x347ffff0346ffff, 0x349ffff0348ffff, 0x34bffff034affff, 0x34dffff034cffff, 0x34fffff034effff, 0x351ffff0350ffff, 0x353ffff0352ffff, 0x355ffff0354ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0357ffff0356, 0x358ffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x35c035b035a0359, 0x360035f035e035d, 0x364036303620361, 0x368036703660365, 0x36c036b036a0369, 0x370036f036e036d, 0x374037303720371, 0x378037703760375, 0x37c037b037a0379, 0x37fffff037e037d, 0xffffffffffffffff, 0xffffffff0380ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x382ffff0381ffff, 0x384ffff0383ffff, 0x386ffff0385ffff, 0x388ffff0387ffff, 0x38affff0389ffff, 0x38cffff038bffff, 0x38effff038dffff, 0x390ffff038fffff, 0x392ffff0391ffff, 0x394ffff0393ffff, 0x396ffff0395ffff, 0xffffffff0397ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x399ffff0398ffff, 0x39bffff039affff, 0x39dffff039cffff, 0x39fffff039effff, 0x3a1ffff03a0ffff, 0x3a3ffff03a2ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3a4ffffffffffff, 0x3a6ffff03a5ffff, 0x3a8ffff03a7ffff, 0x3aaffff03a9ffff, 0x3abffffffffffff, 0x3adffff03acffff, 0x3afffff03aeffff, 0x3b1ffff03b0ffff, 0x3b3ffff03b2ffff, 0x3b5ffff03b4ffff, 0x3b7ffff03b6ffff, 0x3b9ffff03b8ffff, 0x3bbffff03baffff, 0x3bdffff03bcffff, 0x3bfffff03beffff, 0x3c1ffff03c0ffff, 0x3c3ffff03c2ffff, 0x3c5ffff03c4ffff, 0x3c7ffff03c6ffff, 0x3c9ffff03c8ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff03caffffffff, 0x3ccffffffff03cb, 0x3ceffff03cdffff, 0x3d0ffff03cfffff, 0xffffffffffffffff, 0xffffffffffff03d1, 0x3d3ffff03d2ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3d5ffff03d4ffff, 0x3d7ffff03d6ffff, 0xffffffff03d8ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x42404220420041e, 0xffff042c042a0427, 0xffffffffffffffff, 0xffffffffffffffff, 0x430ffffffffffff, 0x438043604340432, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3db03da03d9ffff, 0x3df03de03dd03dc, 0x3e303e203e103e0, 0x3e703e603e503e4, 0x3eb03ea03e903e8, 0x3ef03ee03ed03ec, 0xffff03f203f103f0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3f603f503f403f3, 0x3fa03f903f803f7, 0x3fe03fd03fc03fb, 0x4020401040003ff, 0x406040504040403, 0x40a040904080407, 0x40e040d040c040b, 0x41204110410040f, 0x416041504140413, 0x41a041904180417, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+//8064 bytes -+enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x100], [ 0x100, 0x380, 0xbc0], [ 0x402030202020100, 0x202020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x2000000010000, 0x6000500040003, 0x80007, 0xb000a00090000, 0xf000e000d000c, 0x1200110010, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14001300000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18001700160015, 0x1c001b001a0019, 0x0, 0x1f001e001d, 0x0, 0x0, 0x21002000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x25002400230022, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2700260000, 0x2a00290028, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x200010000ffff, 0x6000500040003, 0xa000900080007, 0xe000d000c000b, 0x1200110010000f, 0x16001500140013, 0xffff001900180017, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1d001c001b001a, 0x210020001f001e, 0x25002400230022, 0x29002800270026, 0x2d002c002b002a, 0xffff0030002f002e, 0x34003300320031, 0x413003700360035, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0039ffff0038, 0xffff003bffff003a, 0xffff003dffff003c, 0xffff003fffff003e, 0xffff0041ffff0040, 0xffff0043ffff0042, 0xffff0045ffff0044, 0xffff0047ffff0046, 0xffff0049ffff0048, 0xffff004bffff004a, 0xffff004dffff004c, 0xffff004fffff004e, 0xffff0051ffff0414, 0xffff0053ffff0052, 0x55ffff0054ffff, 0x57ffff0056ffff, 0x59ffff0058ffff, 0x5bffff005affff, 0xffff005c0423ffff, 0xffff005effff005d, 0xffff0060ffff005f, 0xffff0062ffff0061, 0xffff0064ffff0063, 0xffff0066ffff0065, 0xffff0068ffff0067, 0xffff006affff0069, 0xffff006cffff006b, 0xffff006effff006d, 0xffff0070ffff006f, 0xffff0072ffff0071, 0x75ffff00740073, 0xffffffff0076ffff, 0xffff00780077ffff, 0x7b007affff0079, 0x7e007d007cffff, 0x80007fffffffff, 0x83ffff00820081, 0x860085ffff0084, 0xffffffffffff0087, 0x8affff00890088, 0xffff008cffff008b, 0x8f008effff008d, 0xffffffff0090ffff, 0x930092ffff0091, 0x9600950094ffff, 0x98ffff0097ffff, 0xffffffffffff0099, 0xffffffffffff009a, 0xffffffffffffffff, 0x9dffff009c009b, 0xa0009fffff009e, 0xa2ffff00a1ffff, 0xa4ffff00a3ffff, 0xa6ffff00a5ffff, 0xa8ffff00a7ffff, 0xffff00a9ffffffff, 0xffff00abffff00aa, 0xffff00adffff00ac, 0xffff00afffff00ae, 0xffff00b1ffff00b0, 0xffff00b300b20426, 0xb600b5ffff00b4, 0xffff00b8ffff00b7, 0xffff00baffff00b9, 0xffff00bcffff00bb, 0xffff00beffff00bd, 0xffff00c0ffff00bf, 0xffff00c2ffff00c1, 0xffff00c4ffff00c3, 0xffff00c6ffff00c5, 0xffff00c8ffff00c7, 0xffff00caffff00c9, 0xffff00ccffff00cb, 0xffff00ceffff00cd, 0xffff00d0ffff00cf, 0xffff00d2ffff00d1, 0xffff00d4ffff00d3, 0xffffffffffffffff, 0xd600d5ffffffff, 0xffff00d800d7ffff, 0xdaffff00d9ffff, 0xffff00dd00dc00db, 0xffff00dfffff00de, 0xffff00e1ffff00e0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff00e3ffff00e2, 0xffff00e4ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff00e5ffffffff, 0xffff00e800e700e6, 0xeb00eaffff00e9, 0xee00ed00ec0424, 0xf200f100f000ef, 0xf600f500f400f3, 0xfa00f900f800f7, 0xfdffff00fc00fb, 0x101010000ff00fe, 0x105010401030102, 0xffffffffffffffff, 0xffffffffffff0425, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x106ffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0108ffff0107, 0xffff010affff0109, 0xffff010cffff010b, 0xffff010effff010d, 0xffff0110ffff010f, 0xffff0112ffff0111, 0xffffffffffffffff, 0x114ffffffff0113, 0xffff01160115ffff, 0x11901180117ffff, 0x11d011c011b011a, 0x1210120011f011e, 0x125012401230122, 0x129012801270126, 0x12d012c012b012a, 0x1310130012f012e, 0x135013401330132, 0x139013801370136, 0x13d013c013b013a, 0x1410140013f013e, 0x145014401430142, 0x149014801470146, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff014bffff014a, 0xffff014dffff014c, 0xffff014fffff014e, 0xffff0151ffff0150, 0xffff0153ffff0152, 0xffff0155ffff0154, 0xffff0157ffff0156, 0xffff0159ffff0158, 0xffffffffffff015a, 0xffffffffffffffff, 0xffff015bffffffff, 0xffff015dffff015c, 0xffff015fffff015e, 0xffff0161ffff0160, 0xffff0163ffff0162, 0xffff0165ffff0164, 0xffff0167ffff0166, 0xffff0169ffff0168, 0xffff016bffff016a, 0xffff016dffff016c, 0xffff016fffff016e, 0xffff0171ffff0170, 0xffff0173ffff0172, 0xffff0175ffff0174, 0x178ffff01770176, 0x17affff0179ffff, 0x17cffff017bffff, 0xffffffff017dffff, 0xffff017fffff017e, 0xffff0181ffff0180, 0xffff0183ffff0182, 0xffff0185ffff0184, 0xffff0187ffff0186, 0xffff0189ffff0188, 0xffff018bffff018a, 0xffff018dffff018c, 0xffff018fffff018e, 0xffff0191ffff0190, 0xffff0193ffff0192, 0xffff0195ffff0194, 0xffff0197ffff0196, 0xffff0199ffff0198, 0xffff019bffff019a, 0xffff019dffff019c, 0xffff019fffff019e, 0xffff01a1ffff01a0, 0xffff01a3ffff01a2, 0xffff01a5ffff01a4, 0xffff01a7ffff01a6, 0xffff01a9ffff01a8, 0xffffffffffffffff, 0xffffffffffffffff, 0x1ac01ab01aaffff, 0x1b001af01ae01ad, 0x1b401b301b201b1, 0x1b801b701b601b5, 0x1bc01bb01ba01b9, 0x1c001bf01be01bd, 0x1c401c301c201c1, 0x1c801c701c601c5, 0x1cc01cb01ca01c9, 0xffff01cf01ce01cd, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41dffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1d301d201d101d0, 0x1d701d601d501d4, 0x1db01da01d901d8, 0x1df01de01dd01dc, 0x1e301e201e101e0, 0x1e701e601e501e4, 0x1eb01ea01e901e8, 0x1ef01ee01ed01ec, 0x1f301f201f101f0, 0x1f6ffff01f501f4, 0xffffffffffffffff, 0xffffffff01f7ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff01f9ffff01f8, 0xffff01fbffff01fa, 0xffff01fdffff01fc, 0xffff01ffffff01fe, 0xffff0201ffff0200, 0xffff0203ffff0202, 0xffff0205ffff0204, 0xffff0207ffff0206, 0xffff0209ffff0208, 0xffff020bffff020a, 0xffff020dffff020c, 0xffff020fffff020e, 0xffff0211ffff0210, 0xffff0213ffff0212, 0xffff0215ffff0214, 0xffff0217ffff0216, 0xffff0219ffff0218, 0xffff021bffff021a, 0xffff021dffff021c, 0xffff021fffff021e, 0xffff0221ffff0220, 0xffff0223ffff0222, 0xffff0225ffff0224, 0xffff0227ffff0226, 0xffff0229ffff0228, 0xffff022bffff022a, 0xffff022dffff022c, 0xffff022fffff022e, 0xffff0231ffff0230, 0xffff0233ffff0232, 0xffff0235ffff0234, 0xffff0237ffff0236, 0xffff0239ffff0238, 0xffff023bffff023a, 0xffff023dffff023c, 0xffff023fffff023e, 0xffff0241ffff0240, 0x4280427ffff0242, 0xffff042b042a0429, 0xffff0243ffffffff, 0xffff0245ffff0244, 0xffff0247ffff0246, 0xffff0249ffff0248, 0xffff024bffff024a, 0xffff024dffff024c, 0xffff024fffff024e, 0xffff0251ffff0250, 0xffff0253ffff0252, 0xffff0255ffff0254, 0xffff0257ffff0256, 0xffff0259ffff0258, 0xffff025bffff025a, 0xffff025dffff025c, 0xffff025fffff025e, 0xffff0261ffff0260, 0xffff0263ffff0262, 0xffff0265ffff0264, 0xffff0267ffff0266, 0xffff0269ffff0268, 0xffff026bffff026a, 0xffff026dffff026c, 0xffff026fffff026e, 0xffff0271ffff0270, 0xffff0273ffff0272, 0xffffffffffffffff, 0xffffffffffffffff, 0x277027602750274, 0x27b027a02790278, 0xffffffffffffffff, 0xffffffffffffffff, 0x27f027e027d027c, 0xffffffff02810280, 0xffffffffffffffff, 0xffffffffffffffff, 0x285028402830282, 0x289028802870286, 0xffffffffffffffff, 0xffffffffffffffff, 0x28d028c028b028a, 0x2910290028f028e, 0xffffffffffffffff, 0xffffffffffffffff, 0x295029402930292, 0xffffffff02970296, 0xffff042dffff042c, 0xffff042fffff042e, 0x299ffff0298ffff, 0x29bffff029affff, 0xffffffffffffffff, 0xffffffffffffffff, 0x29f029e029d029c, 0x2a302a202a102a0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x43f043e043d043c, 0x443044204410440, 0x447044604450444, 0x44b044a04490448, 0x44f044e044d044c, 0x453045204510450, 0x457045604550454, 0x45b045a04590458, 0x45f045e045d045c, 0x463046204610460, 0x467046604650464, 0x46b046a04690468, 0x46c0472ffffffff, 0x4780430ffff0473, 0x2bf02be02bd02bc, 0xffffffffffff046d, 0x46e0474ffffffff, 0x4790431ffff0475, 0x2c402c302c202c1, 0xffffffffffff046f, 0x4330432ffffffff, 0x4350434ffffffff, 0x2c902c802c702c6, 0xffffffffffffffff, 0x4370436ffffffff, 0x43a0439ffff0438, 0x2cd02cc02cb02ca, 0xffffffffffff02ce, 0x4700476ffffffff, 0x47a043bffff0477, 0x2d202d102d002cf, 0xffffffffffff0471, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff02d4ffffffff, 0x2d602d5ffffffff, 0xffffffffffffffff, 0xffff02d7ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2db02da02d902d8, 0x2df02de02dd02dc, 0x2e302e202e102e0, 0x2e702e602e502e4, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2e8ffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2ea02e9ffffffff, 0x2ee02ed02ec02eb, 0x2f202f102f002ef, 0x2f602f502f402f3, 0x2fa02f902f802f7, 0x2fe02fd02fc02fb, 0x3020301030002ff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x306030503040303, 0x30a030903080307, 0x30e030d030c030b, 0x31203110310030f, 0x316031503140313, 0x31a031903180317, 0x31e031d031c031b, 0x32203210320031f, 0x326032503240323, 0x32a032903280327, 0x32e032d032c032b, 0xffff03310330032f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3340333ffff0332, 0x336ffffffff0335, 0x338ffff0337ffff, 0x33b033a0339ffff, 0xffff033dffff033c, 0xffffffff033effff, 0xffffffffffffffff, 0x340033fffffffff, 0xffff0342ffff0341, 0xffff0344ffff0343, 0xffff0346ffff0345, 0xffff0348ffff0347, 0xffff034affff0349, 0xffff034cffff034b, 0xffff034effff034d, 0xffff0350ffff034f, 0xffff0352ffff0351, 0xffff0354ffff0353, 0xffff0356ffff0355, 0xffff0358ffff0357, 0xffff035affff0359, 0xffff035cffff035b, 0xffff035effff035d, 0xffff0360ffff035f, 0xffff0362ffff0361, 0xffff0364ffff0363, 0xffff0366ffff0365, 0xffff0368ffff0367, 0xffff036affff0369, 0xffff036cffff036b, 0xffff036effff036d, 0xffff0370ffff036f, 0xffff0372ffff0371, 0xffffffffffffffff, 0x373ffffffffffff, 0xffffffff0374ffff, 0xffff0375ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0377ffff0376, 0xffff0379ffff0378, 0xffff037bffff037a, 0xffff037dffff037c, 0xffff037fffff037e, 0xffff0381ffff0380, 0xffff0383ffff0382, 0xffff0385ffff0384, 0xffff0387ffff0386, 0xffff0389ffff0388, 0xffff038bffff038a, 0xffffffffffff038c, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff038effff038d, 0xffff0390ffff038f, 0xffff0392ffff0391, 0xffff0394ffff0393, 0xffff0396ffff0395, 0xffff0398ffff0397, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff0399ffffffff, 0xffff039bffff039a, 0xffff039dffff039c, 0xffff039fffff039e, 0xffff03a0ffffffff, 0xffff03a2ffff03a1, 0xffff03a4ffff03a3, 0xffff03a6ffff03a5, 0xffff03a8ffff03a7, 0xffff03aaffff03a9, 0xffff03acffff03ab, 0xffff03aeffff03ad, 0xffff03b0ffff03af, 0xffff03b2ffff03b1, 0xffff03b4ffff03b3, 0xffff03b6ffff03b5, 0xffff03b8ffff03b7, 0xffff03baffff03b9, 0xffff03bcffff03bb, 0xffff03beffff03bd, 0xffffffffffffffff, 0xffffffffffffffff, 0x3c0ffff03bfffff, 0xffff03c203c1ffff, 0xffff03c4ffff03c3, 0xffff03c6ffff03c5, 0x3c7ffffffffffff, 0xffffffff03c8ffff, 0xffff03caffff03c9, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff03ccffff03cb, 0xffff03ceffff03cd, 0xffff03d0ffff03cf, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x419041804170416, 0xffff041c041b041a, 0xffffffffffffffff, 0xffffffffffffffff, 0x41effffffffffff, 0x42204210420041f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3d303d203d1ffff, 0x3d703d603d503d4, 0x3db03da03d903d8, 0x3df03de03dd03dc, 0x3e303e203e103e0, 0x3e703e603e503e4, 0xffff03ea03e903e8, 0xffffffffffffffff, 0x3ee03ed03ec03eb, 0x3f203f103f003ef, 0x3f603f503f403f3, 0x3fa03f903f803f7, 0x3fe03fd03fc03fb, 0x4020401040003ff, 0x406040504040403, 0x40a040904080407, 0x40e040d040c040b, 0x41204110410040f, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+//8192 bytes -+enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x20, 0x100], [ 0x100, 0x380, 0xc00], [ 0x402030202020100, 0x202020202020205, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x202020202020202, 0x3000200010000, 0x7000600050004, 0xa00090008, 0xd000c000b0000, 0x110010000f000e, 0x1400130012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x150000, 0x19001800170016, 0x1d001c001b001a, 0x0, 0x1f001e0000, 0x0, 0x0, 0x20000000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24002300220021, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2700260000, 0x2a00290028, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x2c0000, 0x0, 0x0, 0x0, 0x0, 0x2e002d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x200010000ffff, 0x6000500040003, 0xa000900080007, 0xe000d000c000b, 0x1200110010000f, 0x16001500140013, 0xffff001900180017, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff001affff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x41fffffffffffff, 0x1e001d001c001b, 0x2200210020001f, 0x26002500240023, 0x2a002900280027, 0x2e002d002c002b, 0xffff00310030002f, 0x35003400330032, 0x39003800370036, 0x3bffff003affff, 0x3dffff003cffff, 0x3fffff003effff, 0x41ffff0040ffff, 0x43ffff0042ffff, 0x45ffff0044ffff, 0x47ffff0046ffff, 0x49ffff0048ffff, 0x4bffff004affff, 0x4dffff004cffff, 0x4fffff004effff, 0x51ffff0050ffff, 0x53ffff00520421, 0x55ffff0054ffff, 0xffff0056ffffffff, 0xffff0058ffff0057, 0xffff005affff0059, 0xffff005cffff005b, 0x5effff043e005d, 0x60ffff005fffff, 0x62ffff0061ffff, 0x64ffff0063ffff, 0x66ffff0065ffff, 0x68ffff0067ffff, 0x6affff0069ffff, 0x6cffff006bffff, 0x6effff006dffff, 0x70ffff006fffff, 0x72ffff0071ffff, 0x74ffff0073ffff, 0xffff0075ffffffff, 0x780077ffff0076, 0x7affffffff0079, 0xffffffff007bffff, 0xffffffffffff007c, 0xffffffffffff007d, 0xffff007effffffff, 0xffffffff007fffff, 0xffff00810080ffff, 0xffff0082ffffffff, 0x84ffff0083ffff, 0xffffffff0085ffff, 0xffffffffffff0086, 0xffffffff0087ffff, 0xffffffffffff0088, 0xffff008affff0089, 0xffffffff008bffff, 0x8dffff008cffff, 0xffffffffffffffff, 0x910090008f008e, 0x95009400930092, 0xffff0097ffff0096, 0xffff0099ffff0098, 0xffff009bffff009a, 0xffff009dffff009c, 0xa0ffff009f009e, 0xa2ffff00a1ffff, 0xa4ffff00a3ffff, 0xa6ffff00a5ffff, 0xa8ffff00a7ffff, 0xab00aa00a90446, 0xffffffff00acffff, 0xaeffff00adffff, 0xb0ffff00afffff, 0xb2ffff00b1ffff, 0xb4ffff00b3ffff, 0xb6ffff00b5ffff, 0xb8ffff00b7ffff, 0xbaffff00b9ffff, 0xbcffff00bbffff, 0xbeffff00bdffff, 0xc0ffff00bfffff, 0xc1ffffffffffff, 0xc3ffff00c2ffff, 0xc5ffff00c4ffff, 0xc7ffff00c6ffff, 0xc9ffff00c8ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xcbffffffff00ca, 0xffff00cdffff00cc, 0xceffffffffffff, 0xd0ffff00cfffff, 0xd2ffff00d1ffff, 0xd600d500d400d3, 0xd900d8ffff00d7, 0xdbffff00daffff, 0xffffffffffffffff, 0xddffffffff00dc, 0xffff00df00deffff, 0xe2ffff00e100e0, 0xe3ffffffffffff, 0xffff00e500e4ffff, 0xffffffff00e6ffff, 0xffffffffffffffff, 0xffffffff00e7ffff, 0xe9ffffffff00e8, 0xffffffffffffffff, 0xed00ec00eb00ea, 0xffffffffffff00ee, 0xffff00efffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff00f0ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xf2ffff00f1ffff, 0xf3ffffffffffff, 0xf4ffffffffffff, 0xffffffff00f600f5, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffff0440, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xfa00f900f800f7, 0xfd00fc00fb0443, 0x101010000ff00fe, 0x105010401030102, 0x109010801070106, 0x10d010c010b010a, 0x1110110010f010e, 0x115011401130112, 0xffff011801170116, 0xffffffff011a0119, 0x11d011c011bffff, 0x11fffff011effff, 0x121ffff0120ffff, 0x123ffff0122ffff, 0x125ffff0124ffff, 0x127ffff0126ffff, 0x129ffff0128ffff, 0xffff012c012b012a, 0xffffffff012dffff, 0x12fffffffff012e, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x133013201310130, 0x137013601350134, 0x13b013a01390138, 0x13f013e013d013c, 0x143014201410140, 0x147014601450144, 0x14b014a01490148, 0x14f014e014d014c, 0x153015201510150, 0x157015601550154, 0x15b015a01590158, 0x15f015e015d015c, 0x161ffff0160ffff, 0x163ffff0162ffff, 0x165ffff0164ffff, 0x167ffff0166ffff, 0x169ffff0168ffff, 0x16bffff016affff, 0x16dffff016cffff, 0x16fffff016effff, 0xffffffff0170ffff, 0xffffffffffffffff, 0x171ffffffffffff, 0x173ffff0172ffff, 0x175ffff0174ffff, 0x177ffff0176ffff, 0x179ffff0178ffff, 0x17bffff017affff, 0x17dffff017cffff, 0x17fffff017effff, 0x181ffff0180ffff, 0x183ffff0182ffff, 0x185ffff0184ffff, 0x187ffff0186ffff, 0x189ffff0188ffff, 0x18bffff018affff, 0xffff018cffffffff, 0xffff018effff018d, 0xffff0190ffff018f, 0x1930192ffff0191, 0x195ffff0194ffff, 0x197ffff0196ffff, 0x199ffff0198ffff, 0x19bffff019affff, 0x19dffff019cffff, 0x19fffff019effff, 0x1a1ffff01a0ffff, 0x1a3ffff01a2ffff, 0x1a5ffff01a4ffff, 0x1a7ffff01a6ffff, 0x1a9ffff01a8ffff, 0x1abffff01aaffff, 0x1adffff01acffff, 0x1afffff01aeffff, 0x1b1ffff01b0ffff, 0x1b3ffff01b2ffff, 0x1b5ffff01b4ffff, 0x1b7ffff01b6ffff, 0x1b9ffff01b8ffff, 0x1bbffff01baffff, 0x1bdffff01bcffff, 0x1bfffff01beffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x1c201c101c0ffff, 0x1c601c501c401c3, 0x1ca01c901c801c7, 0x1ce01cd01cc01cb, 0x1d201d101d001cf, 0x1d601d501d401d3, 0x1da01d901d801d7, 0x1de01dd01dc01db, 0x1e201e101e001df, 0x43201e501e401e3, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffff01e6ffff, 0xffffffff01e7ffff, 0x1e9ffff01e8ffff, 0x1ebffff01eaffff, 0x1edffff01ecffff, 0x1efffff01eeffff, 0x1f1ffff01f0ffff, 0x1f3ffff01f2ffff, 0x1f5ffff01f4ffff, 0x1f7ffff01f6ffff, 0x1f9ffff01f8ffff, 0x1fbffff01faffff, 0x1fdffff01fcffff, 0x1ffffff01feffff, 0x201ffff0200ffff, 0x203ffff0202ffff, 0x205ffff0204ffff, 0x207ffff0206ffff, 0x209ffff0208ffff, 0x20bffff020affff, 0x20dffff020cffff, 0x20fffff020effff, 0x211ffff0210ffff, 0x213ffff0212ffff, 0x215ffff0214ffff, 0x217ffff0216ffff, 0x219ffff0218ffff, 0x21bffff021affff, 0x21dffff021cffff, 0x21fffff021effff, 0x221ffff0220ffff, 0x223ffff0222ffff, 0x225ffff0224ffff, 0x227ffff0226ffff, 0x229ffff0228ffff, 0x22bffff022affff, 0x22dffff022cffff, 0x22fffff022effff, 0x231ffff0230ffff, 0x44a04480232ffff, 0x2330450044e044c, 0xffffffffffffffff, 0x235ffff0234ffff, 0x237ffff0236ffff, 0x239ffff0238ffff, 0x23bffff023affff, 0x23dffff023cffff, 0x23fffff023effff, 0x241ffff0240ffff, 0x243ffff0242ffff, 0x245ffff0244ffff, 0x247ffff0246ffff, 0x249ffff0248ffff, 0x24bffff024affff, 0x24dffff024cffff, 0x24fffff024effff, 0x251ffff0250ffff, 0x253ffff0252ffff, 0x255ffff0254ffff, 0x257ffff0256ffff, 0x259ffff0258ffff, 0x25bffff025affff, 0x25dffff025cffff, 0x25fffff025effff, 0x261ffff0260ffff, 0x263ffff0262ffff, 0x267026602650264, 0x26b026a02690268, 0xffffffffffffffff, 0xffffffffffffffff, 0x26f026e026d026c, 0xffffffff02710270, 0xffffffffffffffff, 0xffffffffffffffff, 0x275027402730272, 0x279027802770276, 0xffffffffffffffff, 0xffffffffffffffff, 0x27d027c027b027a, 0x2810280027f027e, 0xffffffffffffffff, 0xffffffffffffffff, 0x285028402830282, 0xffffffff02870286, 0xffffffffffffffff, 0xffffffffffffffff, 0x289045402880452, 0x28b045a028a0457, 0xffffffffffffffff, 0xffffffffffffffff, 0x28f028e028d028c, 0x293029202910290, 0xffffffffffffffff, 0xffffffffffffffff, 0x297029602950294, 0x29b029a02990298, 0x29f029e029d029c, 0xffffffff02a102a0, 0x47e047d047c047b, 0x48204810480047f, 0x486048504840483, 0x48a048904880487, 0x48e048d048c048b, 0x49204910490048f, 0x496049504940493, 0x49a049904980497, 0x49e049d049c049b, 0x4a204a104a0049f, 0x4a604a504a404a3, 0x4aa04a904a804a7, 0x4ab04b102bb02ba, 0x4bd045dffff04b3, 0xffffffffffffffff, 0xffff02bdffff04ac, 0x4ad04b5ffffffff, 0x4c0045fffff04b7, 0xffffffffffffffff, 0xffffffffffff04ae, 0x464046102c002bf, 0x4690467ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x46f046c02c202c1, 0x476047402c30472, 0xffffffffffffffff, 0xffffffffffffffff, 0x4af04b9ffffffff, 0x4c30479ffff04bb, 0xffffffffffffffff, 0xffffffffffff04b0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff02c5ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2c902c802c702c6, 0x2cd02cc02cb02ca, 0x2d102d002cf02ce, 0x2d502d402d302d2, 0xffffffffffffffff, 0xffffffffffff02d6, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2da02d902d802d7, 0x2de02dd02dc02db, 0x2e202e102e002df, 0x2e602e502e402e3, 0x2ea02e902e802e7, 0x2ee02ed02ec02eb, 0xffffffff02f002ef, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x2f402f302f202f1, 0x2f802f702f602f5, 0x2fc02fb02fa02f9, 0x30002ff02fe02fd, 0x304030303020301, 0x308030703060305, 0x30c030b030a0309, 0x310030f030e030d, 0x314031303120311, 0x318031703160315, 0x31c031b031a0319, 0xffff031f031e031d, 0xffffffff0320ffff, 0xffff03220321ffff, 0xffff0324ffff0323, 0xffffffffffff0325, 0x326ffffffffffff, 0xffff0327ffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x329ffff0328ffff, 0x32bffff032affff, 0x32dffff032cffff, 0x32fffff032effff, 0x331ffff0330ffff, 0x333ffff0332ffff, 0x335ffff0334ffff, 0x337ffff0336ffff, 0x339ffff0338ffff, 0x33bffff033affff, 0x33dffff033cffff, 0x33fffff033effff, 0x341ffff0340ffff, 0x343ffff0342ffff, 0x345ffff0344ffff, 0x347ffff0346ffff, 0x349ffff0348ffff, 0x34bffff034affff, 0x34dffff034cffff, 0x34fffff034effff, 0x351ffff0350ffff, 0x353ffff0352ffff, 0x355ffff0354ffff, 0x357ffff0356ffff, 0x359ffff0358ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff035bffff035a, 0x35cffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x360035f035e035d, 0x364036303620361, 0x368036703660365, 0x36c036b036a0369, 0x370036f036e036d, 0x374037303720371, 0x378037703760375, 0x37c037b037a0379, 0x380037f037e037d, 0x383ffff03820381, 0xffffffffffffffff, 0xffffffff0384ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x386ffff0385ffff, 0x388ffff0387ffff, 0x38affff0389ffff, 0x38cffff038bffff, 0x38effff038dffff, 0x390ffff038fffff, 0x392ffff0391ffff, 0x394ffff0393ffff, 0x396ffff0395ffff, 0x398ffff0397ffff, 0x39affff0399ffff, 0xffffffff039bffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x39dffff039cffff, 0x39fffff039effff, 0x3a1ffff03a0ffff, 0x3a3ffff03a2ffff, 0x3a5ffff03a4ffff, 0x3a7ffff03a6ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3a8ffffffffffff, 0x3aaffff03a9ffff, 0x3acffff03abffff, 0x3aeffff03adffff, 0x3afffffffffffff, 0x3b1ffff03b0ffff, 0x3b3ffff03b2ffff, 0x3b5ffff03b4ffff, 0x3b7ffff03b6ffff, 0x3b9ffff03b8ffff, 0x3bbffff03baffff, 0x3bdffff03bcffff, 0x3bfffff03beffff, 0x3c1ffff03c0ffff, 0x3c3ffff03c2ffff, 0x3c5ffff03c4ffff, 0x3c7ffff03c6ffff, 0x3c9ffff03c8ffff, 0x3cbffff03caffff, 0x3cdffff03ccffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffff03ceffffffff, 0x3d0ffffffff03cf, 0x3d2ffff03d1ffff, 0x3d4ffff03d3ffff, 0xffffffffffffffff, 0xffffffffffff03d5, 0x3d7ffff03d6ffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3d9ffff03d8ffff, 0x3dbffff03daffff, 0xffffffff03dcffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x428042604240422, 0xffff0430042e042b, 0xffffffffffffffff, 0xffffffffffffffff, 0x434ffffffffffff, 0x43c043a04380436, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3df03de03ddffff, 0x3e303e203e103e0, 0x3e703e603e503e4, 0x3eb03ea03e903e8, 0x3ef03ee03ed03ec, 0x3f303f203f103f0, 0xffff03f603f503f4, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x3fa03f903f803f7, 0x3fe03fd03fc03fb, 0x4020401040003ff, 0x406040504040403, 0x40a040904080407, 0x40e040d040c040b, 0x41204110410040f, 0x416041504140413, 0x41a041904180417, 0x41e041d041c041b, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff]); -+@property -+{ -+private alias _IUA = immutable(uint[]); -+_IUA toUpperTable() { static _IUA t = [ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x39c, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11a, 0x11c, 0x11e, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12a, 0x12c, 0x12e, 0x49, 0x132, 0x134, 0x136, 0x139, 0x13b, 0x13d, 0x13f, 0x141, 0x143, 0x145, 0x147, 0x14a, 0x14c, 0x14e, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15a, 0x15c, 0x15e, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16a, 0x16c, 0x16e, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17b, 0x17d, 0x53, 0x243, 0x182, 0x184, 0x187, 0x18b, 0x191, 0x1f6, 0x198, 0x23d, 0x220, 0x1a0, 0x1a2, 0x1a4, 0x1a7, 0x1ac, 0x1af, 0x1b3, 0x1b5, 0x1b8, 0x1bc, 0x1f7, 0x1c4, 0x1c4, 0x1c7, 0x1c7, 0x1ca, 0x1ca, 0x1cd, 0x1cf, 0x1d1, 0x1d3, 0x1d5, 0x1d7, 0x1d9, 0x1db, 0x18e, 0x1de, 0x1e0, 0x1e2, 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f1, 0x1f1, 0x1f4, 0x1f8, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x202, 0x204, 0x206, 0x208, 0x20a, 0x20c, 0x20e, 0x210, 0x212, 0x214, 0x216, 0x218, 0x21a, 0x21c, 0x21e, 0x222, 0x224, 0x226, 0x228, 0x22a, 0x22c, 0x22e, 0x230, 0x232, 0x23b, 0x2c7e, 0x2c7f, 0x241, 0x246, 0x248, 0x24a, 0x24c, 0x24e, 0x2c6f, 0x2c6d, 0x2c70, 0x181, 0x186, 0x189, 0x18a, 0x18f, 0x190, 0x193, 0x194, 0xa78d, 0xa7aa, 0x197, 0x196, 0x2c62, 0x19c, 0x2c6e, 0x19d, 0x19f, 0x2c64, 0x1a6, 0x1a9, 0x1ae, 0x244, 0x1b1, 0x1b2, 0x245, 0x1b7, 0x399, 0x370, 0x372, 0x376, 0x3fd, 0x3fe, 0x3ff, 0x386, 0x388, 0x389, 0x38a, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b, 0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9, 0x3aa, 0x3ab, 0x38c, 0x38e, 0x38f, 0x392, 0x398, 0x3a6, 0x3a0, 0x3cf, 0x3d8, 0x3da, 0x3dc, 0x3de, 0x3e0, 0x3e2, 0x3e4, 0x3e6, 0x3e8, 0x3ea, 0x3ec, 0x3ee, 0x39a, 0x3a1, 0x3f9, 0x395, 0x3f7, 0x3fa, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, 0x460, 0x462, 0x464, 0x466, 0x468, 0x46a, 0x46c, 0x46e, 0x470, 0x472, 0x474, 0x476, 0x478, 0x47a, 0x47c, 0x47e, 0x480, 0x48a, 0x48c, 0x48e, 0x490, 0x492, 0x494, 0x496, 0x498, 0x49a, 0x49c, 0x49e, 0x4a0, 0x4a2, 0x4a4, 0x4a6, 0x4a8, 0x4aa, 0x4ac, 0x4ae, 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x4bc, 0x4be, 0x4c1, 0x4c3, 0x4c5, 0x4c7, 0x4c9, 0x4cb, 0x4cd, 0x4c0, 0x4d0, 0x4d2, 0x4d4, 0x4d6, 0x4d8, 0x4da, 0x4dc, 0x4de, 0x4e0, 0x4e2, 0x4e4, 0x4e6, 0x4e8, 0x4ea, 0x4ec, 0x4ee, 0x4f0, 0x4f2, 0x4f4, 0x4f6, 0x4f8, 0x4fa, 0x4fc, 0x4fe, 0x500, 0x502, 0x504, 0x506, 0x508, 0x50a, 0x50c, 0x50e, 0x510, 0x512, 0x514, 0x516, 0x518, 0x51a, 0x51c, 0x51e, 0x520, 0x522, 0x524, 0x526, 0x531, 0x532, 0x533, 0x534, 0x535, 0x536, 0x537, 0x538, 0x539, 0x53a, 0x53b, 0x53c, 0x53d, 0x53e, 0x53f, 0x540, 0x541, 0x542, 0x543, 0x544, 0x545, 0x546, 0x547, 0x548, 0x549, 0x54a, 0x54b, 0x54c, 0x54d, 0x54e, 0x54f, 0x550, 0x551, 0x552, 0x553, 0x554, 0x555, 0x556, 0xa77d, 0x2c63, 0x1e00, 0x1e02, 0x1e04, 0x1e06, 0x1e08, 0x1e0a, 0x1e0c, 0x1e0e, 0x1e10, 0x1e12, 0x1e14, 0x1e16, 0x1e18, 0x1e1a, 0x1e1c, 0x1e1e, 0x1e20, 0x1e22, 0x1e24, 0x1e26, 0x1e28, 0x1e2a, 0x1e2c, 0x1e2e, 0x1e30, 0x1e32, 0x1e34, 0x1e36, 0x1e38, 0x1e3a, 0x1e3c, 0x1e3e, 0x1e40, 0x1e42, 0x1e44, 0x1e46, 0x1e48, 0x1e4a, 0x1e4c, 0x1e4e, 0x1e50, 0x1e52, 0x1e54, 0x1e56, 0x1e58, 0x1e5a, 0x1e5c, 0x1e5e, 0x1e60, 0x1e62, 0x1e64, 0x1e66, 0x1e68, 0x1e6a, 0x1e6c, 0x1e6e, 0x1e70, 0x1e72, 0x1e74, 0x1e76, 0x1e78, 0x1e7a, 0x1e7c, 0x1e7e, 0x1e80, 0x1e82, 0x1e84, 0x1e86, 0x1e88, 0x1e8a, 0x1e8c, 0x1e8e, 0x1e90, 0x1e92, 0x1e94, 0x1e60, 0x1ea0, 0x1ea2, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eaa, 0x1eac, 0x1eae, 0x1eb0, 0x1eb2, 0x1eb4, 0x1eb6, 0x1eb8, 0x1eba, 0x1ebc, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ec8, 0x1eca, 0x1ecc, 0x1ece, 0x1ed0, 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1eda, 0x1edc, 0x1ede, 0x1ee0, 0x1ee2, 0x1ee4, 0x1ee6, 0x1ee8, 0x1eea, 0x1eec, 0x1eee, 0x1ef0, 0x1ef2, 0x1ef4, 0x1ef6, 0x1ef8, 0x1efa, 0x1efc, 0x1efe, 0x1f08, 0x1f09, 0x1f0a, 0x1f0b, 0x1f0c, 0x1f0d, 0x1f0e, 0x1f0f, 0x1f18, 0x1f19, 0x1f1a, 0x1f1b, 0x1f1c, 0x1f1d, 0x1f28, 0x1f29, 0x1f2a, 0x1f2b, 0x1f2c, 0x1f2d, 0x1f2e, 0x1f2f, 0x1f38, 0x1f39, 0x1f3a, 0x1f3b, 0x1f3c, 0x1f3d, 0x1f3e, 0x1f3f, 0x1f48, 0x1f49, 0x1f4a, 0x1f4b, 0x1f4c, 0x1f4d, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f68, 0x1f69, 0x1f6a, 0x1f6b, 0x1f6c, 0x1f6d, 0x1f6e, 0x1f6f, 0x1fba, 0x1fbb, 0x1fc8, 0x1fc9, 0x1fca, 0x1fcb, 0x1fda, 0x1fdb, 0x1ff8, 0x1ff9, 0x1fea, 0x1feb, 0x1ffa, 0x1ffb, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fb8, 0x1fb9, 0x1fbc, 0x399, 0x1fcc, 0x1fd8, 0x1fd9, 0x1fe8, 0x1fe9, 0x1fec, 0x1ffc, 0x2132, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0x216c, 0x216d, 0x216e, 0x216f, 0x2183, 0x24b6, 0x24b7, 0x24b8, 0x24b9, 0x24ba, 0x24bb, 0x24bc, 0x24bd, 0x24be, 0x24bf, 0x24c0, 0x24c1, 0x24c2, 0x24c3, 0x24c4, 0x24c5, 0x24c6, 0x24c7, 0x24c8, 0x24c9, 0x24ca, 0x24cb, 0x24cc, 0x24cd, 0x24ce, 0x24cf, 0x2c00, 0x2c01, 0x2c02, 0x2c03, 0x2c04, 0x2c05, 0x2c06, 0x2c07, 0x2c08, 0x2c09, 0x2c0a, 0x2c0b, 0x2c0c, 0x2c0d, 0x2c0e, 0x2c0f, 0x2c10, 0x2c11, 0x2c12, 0x2c13, 0x2c14, 0x2c15, 0x2c16, 0x2c17, 0x2c18, 0x2c19, 0x2c1a, 0x2c1b, 0x2c1c, 0x2c1d, 0x2c1e, 0x2c1f, 0x2c20, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c27, 0x2c28, 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c60, 0x23a, 0x23e, 0x2c67, 0x2c69, 0x2c6b, 0x2c72, 0x2c75, 0x2c80, 0x2c82, 0x2c84, 0x2c86, 0x2c88, 0x2c8a, 0x2c8c, 0x2c8e, 0x2c90, 0x2c92, 0x2c94, 0x2c96, 0x2c98, 0x2c9a, 0x2c9c, 0x2c9e, 0x2ca0, 0x2ca2, 0x2ca4, 0x2ca6, 0x2ca8, 0x2caa, 0x2cac, 0x2cae, 0x2cb0, 0x2cb2, 0x2cb4, 0x2cb6, 0x2cb8, 0x2cba, 0x2cbc, 0x2cbe, 0x2cc0, 0x2cc2, 0x2cc4, 0x2cc6, 0x2cc8, 0x2cca, 0x2ccc, 0x2cce, 0x2cd0, 0x2cd2, 0x2cd4, 0x2cd6, 0x2cd8, 0x2cda, 0x2cdc, 0x2cde, 0x2ce0, 0x2ce2, 0x2ceb, 0x2ced, 0x2cf2, 0x10a0, 0x10a1, 0x10a2, 0x10a3, 0x10a4, 0x10a5, 0x10a6, 0x10a7, 0x10a8, 0x10a9, 0x10aa, 0x10ab, 0x10ac, 0x10ad, 0x10ae, 0x10af, 0x10b0, 0x10b1, 0x10b2, 0x10b3, 0x10b4, 0x10b5, 0x10b6, 0x10b7, 0x10b8, 0x10b9, 0x10ba, 0x10bb, 0x10bc, 0x10bd, 0x10be, 0x10bf, 0x10c0, 0x10c1, 0x10c2, 0x10c3, 0x10c4, 0x10c5, 0x10c7, 0x10cd, 0xa640, 0xa642, 0xa644, 0xa646, 0xa648, 0xa64a, 0xa64c, 0xa64e, 0xa650, 0xa652, 0xa654, 0xa656, 0xa658, 0xa65a, 0xa65c, 0xa65e, 0xa660, 0xa662, 0xa664, 0xa666, 0xa668, 0xa66a, 0xa66c, 0xa680, 0xa682, 0xa684, 0xa686, 0xa688, 0xa68a, 0xa68c, 0xa68e, 0xa690, 0xa692, 0xa694, 0xa696, 0xa722, 0xa724, 0xa726, 0xa728, 0xa72a, 0xa72c, 0xa72e, 0xa732, 0xa734, 0xa736, 0xa738, 0xa73a, 0xa73c, 0xa73e, 0xa740, 0xa742, 0xa744, 0xa746, 0xa748, 0xa74a, 0xa74c, 0xa74e, 0xa750, 0xa752, 0xa754, 0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766, 0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77e, 0xa780, 0xa782, 0xa784, 0xa786, 0xa78b, 0xa790, 0xa792, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407, 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f, 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417, 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f, 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427, 0x2000053, 0x53, 0x130, 0x2000046, 0x46, 0x2000046, 0x49, 0x2000046, 0x4c, 0x3000046, 0x46, 0x49, 0x3000046, 0x46, 0x4c, 0x2000053, 0x54, 0x2000053, 0x54, 0x2000535, 0x552, 0x2000544, 0x546, 0x2000544, 0x535, 0x2000544, 0x53b, 0x200054e, 0x546, 0x2000544, 0x53d, 0x20002bc, 0x4e, 0x3000399, 0x308, 0x301, 0x30003a5, 0x308, 0x301, 0x200004a, 0x30c, 0x2000048, 0x331, 0x2000054, 0x308, 0x2000057, 0x30a, 0x2000059, 0x30a, 0x2000041, 0x2be, 0x20003a5, 0x313, 0x30003a5, 0x313, 0x300, 0x30003a5, 0x313, 0x301, 0x30003a5, 0x313, 0x342, 0x2000391, 0x342, 0x2000397, 0x342, 0x3000399, 0x308, 0x300, 0x3000399, 0x308, 0x301, 0x2000399, 0x342, 0x3000399, 0x308, 0x342, 0x30003a5, 0x308, 0x300, 0x30003a5, 0x308, 0x301, 0x20003a1, 0x313, 0x20003a5, 0x342, 0x30003a5, 0x308, 0x342, 0x20003a9, 0x342, 0x2001f08, 0x399, 0x2001f09, 0x399, 0x2001f0a, 0x399, 0x2001f0b, 0x399, 0x2001f0c, 0x399, 0x2001f0d, 0x399, 0x2001f0e, 0x399, 0x2001f0f, 0x399, 0x2001f08, 0x399, 0x2001f09, 0x399, 0x2001f0a, 0x399, 0x2001f0b, 0x399, 0x2001f0c, 0x399, 0x2001f0d, 0x399, 0x2001f0e, 0x399, 0x2001f0f, 0x399, 0x2001f28, 0x399, 0x2001f29, 0x399, 0x2001f2a, 0x399, 0x2001f2b, 0x399, 0x2001f2c, 0x399, 0x2001f2d, 0x399, 0x2001f2e, 0x399, 0x2001f2f, 0x399, 0x2001f28, 0x399, 0x2001f29, 0x399, 0x2001f2a, 0x399, 0x2001f2b, 0x399, 0x2001f2c, 0x399, 0x2001f2d, 0x399, 0x2001f2e, 0x399, 0x2001f2f, 0x399, 0x2001f68, 0x399, 0x2001f69, 0x399, 0x2001f6a, 0x399, 0x2001f6b, 0x399, 0x2001f6c, 0x399, 0x2001f6d, 0x399, 0x2001f6e, 0x399, 0x2001f6f, 0x399, 0x2001f68, 0x399, 0x2001f69, 0x399, 0x2001f6a, 0x399, 0x2001f6b, 0x399, 0x2001f6c, 0x399, 0x2001f6d, 0x399, 0x2001f6e, 0x399, 0x2001f6f, 0x399, 0x2000391, 0x399, 0x2000391, 0x399, 0x2000397, 0x399, 0x2000397, 0x399, 0x20003a9, 0x399, 0x20003a9, 0x399, 0x2001fba, 0x399, 0x2000386, 0x399, 0x2001fca, 0x399, 0x2000389, 0x399, 0x2001ffa, 0x399, 0x200038f, 0x399, 0x3000391, 0x342, 0x399, 0x3000397, 0x342, 0x399, 0x30003a9, 0x342, 0x399]; return t; } -+_IUA toLowerTable() { static _IUA t = [ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10b, 0x10d, 0x10f, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11b, 0x11d, 0x11f, 0x121, 0x123, 0x125, 0x127, 0x129, 0x12b, 0x12d, 0x12f, 0x69, 0x133, 0x135, 0x137, 0x13a, 0x13c, 0x13e, 0x140, 0x142, 0x144, 0x146, 0x148, 0x14b, 0x14d, 0x14f, 0x151, 0x153, 0x155, 0x157, 0x159, 0x15b, 0x15d, 0x15f, 0x161, 0x163, 0x165, 0x167, 0x169, 0x16b, 0x16d, 0x16f, 0x171, 0x173, 0x175, 0x177, 0xff, 0x17a, 0x17c, 0x17e, 0x253, 0x183, 0x185, 0x254, 0x188, 0x256, 0x257, 0x18c, 0x1dd, 0x259, 0x25b, 0x192, 0x260, 0x263, 0x269, 0x268, 0x199, 0x26f, 0x272, 0x275, 0x1a1, 0x1a3, 0x1a5, 0x280, 0x1a8, 0x283, 0x1ad, 0x288, 0x1b0, 0x28a, 0x28b, 0x1b4, 0x1b6, 0x292, 0x1b9, 0x1bd, 0x1c6, 0x1c6, 0x1c9, 0x1c9, 0x1cc, 0x1cc, 0x1ce, 0x1d0, 0x1d2, 0x1d4, 0x1d6, 0x1d8, 0x1da, 0x1dc, 0x1df, 0x1e1, 0x1e3, 0x1e5, 0x1e7, 0x1e9, 0x1eb, 0x1ed, 0x1ef, 0x1f3, 0x1f3, 0x1f5, 0x195, 0x1bf, 0x1f9, 0x1fb, 0x1fd, 0x1ff, 0x201, 0x203, 0x205, 0x207, 0x209, 0x20b, 0x20d, 0x20f, 0x211, 0x213, 0x215, 0x217, 0x219, 0x21b, 0x21d, 0x21f, 0x19e, 0x223, 0x225, 0x227, 0x229, 0x22b, 0x22d, 0x22f, 0x231, 0x233, 0x2c65, 0x23c, 0x19a, 0x2c66, 0x242, 0x180, 0x289, 0x28c, 0x247, 0x249, 0x24b, 0x24d, 0x24f, 0x371, 0x373, 0x377, 0x3ac, 0x3ad, 0x3ae, 0x3af, 0x3cc, 0x3cd, 0x3ce, 0x3b1, 0x3b2, 0x3b3, 0x3b4, 0x3b5, 0x3b6, 0x3b7, 0x3b8, 0x3b9, 0x3ba, 0x3bb, 0x3bc, 0x3bd, 0x3be, 0x3bf, 0x3c0, 0x3c1, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9, 0x3ca, 0x3cb, 0x3d7, 0x3d9, 0x3db, 0x3dd, 0x3df, 0x3e1, 0x3e3, 0x3e5, 0x3e7, 0x3e9, 0x3eb, 0x3ed, 0x3ef, 0x3b8, 0x3f8, 0x3f2, 0x3fb, 0x37b, 0x37c, 0x37d, 0x450, 0x451, 0x452, 0x453, 0x454, 0x455, 0x456, 0x457, 0x458, 0x459, 0x45a, 0x45b, 0x45c, 0x45d, 0x45e, 0x45f, 0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43a, 0x43b, 0x43c, 0x43d, 0x43e, 0x43f, 0x440, 0x441, 0x442, 0x443, 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44a, 0x44b, 0x44c, 0x44d, 0x44e, 0x44f, 0x461, 0x463, 0x465, 0x467, 0x469, 0x46b, 0x46d, 0x46f, 0x471, 0x473, 0x475, 0x477, 0x479, 0x47b, 0x47d, 0x47f, 0x481, 0x48b, 0x48d, 0x48f, 0x491, 0x493, 0x495, 0x497, 0x499, 0x49b, 0x49d, 0x49f, 0x4a1, 0x4a3, 0x4a5, 0x4a7, 0x4a9, 0x4ab, 0x4ad, 0x4af, 0x4b1, 0x4b3, 0x4b5, 0x4b7, 0x4b9, 0x4bb, 0x4bd, 0x4bf, 0x4cf, 0x4c2, 0x4c4, 0x4c6, 0x4c8, 0x4ca, 0x4cc, 0x4ce, 0x4d1, 0x4d3, 0x4d5, 0x4d7, 0x4d9, 0x4db, 0x4dd, 0x4df, 0x4e1, 0x4e3, 0x4e5, 0x4e7, 0x4e9, 0x4eb, 0x4ed, 0x4ef, 0x4f1, 0x4f3, 0x4f5, 0x4f7, 0x4f9, 0x4fb, 0x4fd, 0x4ff, 0x501, 0x503, 0x505, 0x507, 0x509, 0x50b, 0x50d, 0x50f, 0x511, 0x513, 0x515, 0x517, 0x519, 0x51b, 0x51d, 0x51f, 0x521, 0x523, 0x525, 0x527, 0x561, 0x562, 0x563, 0x564, 0x565, 0x566, 0x567, 0x568, 0x569, 0x56a, 0x56b, 0x56c, 0x56d, 0x56e, 0x56f, 0x570, 0x571, 0x572, 0x573, 0x574, 0x575, 0x576, 0x577, 0x578, 0x579, 0x57a, 0x57b, 0x57c, 0x57d, 0x57e, 0x57f, 0x580, 0x581, 0x582, 0x583, 0x584, 0x585, 0x586, 0x2d00, 0x2d01, 0x2d02, 0x2d03, 0x2d04, 0x2d05, 0x2d06, 0x2d07, 0x2d08, 0x2d09, 0x2d0a, 0x2d0b, 0x2d0c, 0x2d0d, 0x2d0e, 0x2d0f, 0x2d10, 0x2d11, 0x2d12, 0x2d13, 0x2d14, 0x2d15, 0x2d16, 0x2d17, 0x2d18, 0x2d19, 0x2d1a, 0x2d1b, 0x2d1c, 0x2d1d, 0x2d1e, 0x2d1f, 0x2d20, 0x2d21, 0x2d22, 0x2d23, 0x2d24, 0x2d25, 0x2d27, 0x2d2d, 0x1e01, 0x1e03, 0x1e05, 0x1e07, 0x1e09, 0x1e0b, 0x1e0d, 0x1e0f, 0x1e11, 0x1e13, 0x1e15, 0x1e17, 0x1e19, 0x1e1b, 0x1e1d, 0x1e1f, 0x1e21, 0x1e23, 0x1e25, 0x1e27, 0x1e29, 0x1e2b, 0x1e2d, 0x1e2f, 0x1e31, 0x1e33, 0x1e35, 0x1e37, 0x1e39, 0x1e3b, 0x1e3d, 0x1e3f, 0x1e41, 0x1e43, 0x1e45, 0x1e47, 0x1e49, 0x1e4b, 0x1e4d, 0x1e4f, 0x1e51, 0x1e53, 0x1e55, 0x1e57, 0x1e59, 0x1e5b, 0x1e5d, 0x1e5f, 0x1e61, 0x1e63, 0x1e65, 0x1e67, 0x1e69, 0x1e6b, 0x1e6d, 0x1e6f, 0x1e71, 0x1e73, 0x1e75, 0x1e77, 0x1e79, 0x1e7b, 0x1e7d, 0x1e7f, 0x1e81, 0x1e83, 0x1e85, 0x1e87, 0x1e89, 0x1e8b, 0x1e8d, 0x1e8f, 0x1e91, 0x1e93, 0x1e95, 0xdf, 0x1ea1, 0x1ea3, 0x1ea5, 0x1ea7, 0x1ea9, 0x1eab, 0x1ead, 0x1eaf, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eb7, 0x1eb9, 0x1ebb, 0x1ebd, 0x1ebf, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ec9, 0x1ecb, 0x1ecd, 0x1ecf, 0x1ed1, 0x1ed3, 0x1ed5, 0x1ed7, 0x1ed9, 0x1edb, 0x1edd, 0x1edf, 0x1ee1, 0x1ee3, 0x1ee5, 0x1ee7, 0x1ee9, 0x1eeb, 0x1eed, 0x1eef, 0x1ef1, 0x1ef3, 0x1ef5, 0x1ef7, 0x1ef9, 0x1efb, 0x1efd, 0x1eff, 0x1f00, 0x1f01, 0x1f02, 0x1f03, 0x1f04, 0x1f05, 0x1f06, 0x1f07, 0x1f10, 0x1f11, 0x1f12, 0x1f13, 0x1f14, 0x1f15, 0x1f20, 0x1f21, 0x1f22, 0x1f23, 0x1f24, 0x1f25, 0x1f26, 0x1f27, 0x1f30, 0x1f31, 0x1f32, 0x1f33, 0x1f34, 0x1f35, 0x1f36, 0x1f37, 0x1f40, 0x1f41, 0x1f42, 0x1f43, 0x1f44, 0x1f45, 0x1f51, 0x1f53, 0x1f55, 0x1f57, 0x1f60, 0x1f61, 0x1f62, 0x1f63, 0x1f64, 0x1f65, 0x1f66, 0x1f67, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fb0, 0x1fb1, 0x1f70, 0x1f71, 0x1fb3, 0x1f72, 0x1f73, 0x1f74, 0x1f75, 0x1fc3, 0x1fd0, 0x1fd1, 0x1f76, 0x1f77, 0x1fe0, 0x1fe1, 0x1f7a, 0x1f7b, 0x1fe5, 0x1f78, 0x1f79, 0x1f7c, 0x1f7d, 0x1ff3, 0x3c9, 0x6b, 0xe5, 0x214e, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217a, 0x217b, 0x217c, 0x217d, 0x217e, 0x217f, 0x2184, 0x24d0, 0x24d1, 0x24d2, 0x24d3, 0x24d4, 0x24d5, 0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, 0x24dc, 0x24dd, 0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, 0x24e4, 0x24e5, 0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x2c30, 0x2c31, 0x2c32, 0x2c33, 0x2c34, 0x2c35, 0x2c36, 0x2c37, 0x2c38, 0x2c39, 0x2c3a, 0x2c3b, 0x2c3c, 0x2c3d, 0x2c3e, 0x2c3f, 0x2c40, 0x2c41, 0x2c42, 0x2c43, 0x2c44, 0x2c45, 0x2c46, 0x2c47, 0x2c48, 0x2c49, 0x2c4a, 0x2c4b, 0x2c4c, 0x2c4d, 0x2c4e, 0x2c4f, 0x2c50, 0x2c51, 0x2c52, 0x2c53, 0x2c54, 0x2c55, 0x2c56, 0x2c57, 0x2c58, 0x2c59, 0x2c5a, 0x2c5b, 0x2c5c, 0x2c5d, 0x2c5e, 0x2c61, 0x26b, 0x1d7d, 0x27d, 0x2c68, 0x2c6a, 0x2c6c, 0x251, 0x271, 0x250, 0x252, 0x2c73, 0x2c76, 0x23f, 0x240, 0x2c81, 0x2c83, 0x2c85, 0x2c87, 0x2c89, 0x2c8b, 0x2c8d, 0x2c8f, 0x2c91, 0x2c93, 0x2c95, 0x2c97, 0x2c99, 0x2c9b, 0x2c9d, 0x2c9f, 0x2ca1, 0x2ca3, 0x2ca5, 0x2ca7, 0x2ca9, 0x2cab, 0x2cad, 0x2caf, 0x2cb1, 0x2cb3, 0x2cb5, 0x2cb7, 0x2cb9, 0x2cbb, 0x2cbd, 0x2cbf, 0x2cc1, 0x2cc3, 0x2cc5, 0x2cc7, 0x2cc9, 0x2ccb, 0x2ccd, 0x2ccf, 0x2cd1, 0x2cd3, 0x2cd5, 0x2cd7, 0x2cd9, 0x2cdb, 0x2cdd, 0x2cdf, 0x2ce1, 0x2ce3, 0x2cec, 0x2cee, 0x2cf3, 0xa641, 0xa643, 0xa645, 0xa647, 0xa649, 0xa64b, 0xa64d, 0xa64f, 0xa651, 0xa653, 0xa655, 0xa657, 0xa659, 0xa65b, 0xa65d, 0xa65f, 0xa661, 0xa663, 0xa665, 0xa667, 0xa669, 0xa66b, 0xa66d, 0xa681, 0xa683, 0xa685, 0xa687, 0xa689, 0xa68b, 0xa68d, 0xa68f, 0xa691, 0xa693, 0xa695, 0xa697, 0xa723, 0xa725, 0xa727, 0xa729, 0xa72b, 0xa72d, 0xa72f, 0xa733, 0xa735, 0xa737, 0xa739, 0xa73b, 0xa73d, 0xa73f, 0xa741, 0xa743, 0xa745, 0xa747, 0xa749, 0xa74b, 0xa74d, 0xa74f, 0xa751, 0xa753, 0xa755, 0xa757, 0xa759, 0xa75b, 0xa75d, 0xa75f, 0xa761, 0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c, 0x1d79, 0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0x265, 0xa791, 0xa793, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0x266, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0x10428, 0x10429, 0x1042a, 0x1042b, 0x1042c, 0x1042d, 0x1042e, 0x1042f, 0x10430, 0x10431, 0x10432, 0x10433, 0x10434, 0x10435, 0x10436, 0x10437, 0x10438, 0x10439, 0x1043a, 0x1043b, 0x1043c, 0x1043d, 0x1043e, 0x1043f, 0x10440, 0x10441, 0x10442, 0x10443, 0x10444, 0x10445, 0x10446, 0x10447, 0x10448, 0x10449, 0x1044a, 0x1044b, 0x1044c, 0x1044d, 0x1044e, 0x1044f, 0xdf, 0x2000069, 0x307, 0xfb00, 0xfb01, 0xfb02, 0xfb03, 0xfb04, 0xfb05, 0xfb06, 0x587, 0xfb13, 0xfb14, 0xfb15, 0xfb16, 0xfb17, 0x149, 0x390, 0x3b0, 0x1f0, 0x1e96, 0x1e97, 0x1e98, 0x1e99, 0x1e9a, 0x1f50, 0x1f52, 0x1f54, 0x1f56, 0x1fb6, 0x1fc6, 0x1fd2, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe6, 0x1fe7, 0x1ff6, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fb3, 0x1fb3, 0x1fc3, 0x1fc3, 0x1ff3, 0x1ff3, 0x1fb2, 0x1fb4, 0x1fc2, 0x1fc4, 0x1ff2, 0x1ff4, 0x1fb7, 0x1fc7, 0x1ff7]; return t; } -+_IUA toTitleTable() { static _IUA t = [ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x39c, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11a, 0x11c, 0x11e, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12a, 0x12c, 0x12e, 0x49, 0x132, 0x134, 0x136, 0x139, 0x13b, 0x13d, 0x13f, 0x141, 0x143, 0x145, 0x147, 0x14a, 0x14c, 0x14e, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15a, 0x15c, 0x15e, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16a, 0x16c, 0x16e, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17b, 0x17d, 0x53, 0x243, 0x182, 0x184, 0x187, 0x18b, 0x191, 0x1f6, 0x198, 0x23d, 0x220, 0x1a0, 0x1a2, 0x1a4, 0x1a7, 0x1ac, 0x1af, 0x1b3, 0x1b5, 0x1b8, 0x1bc, 0x1f7, 0x1c5, 0x1c5, 0x1c5, 0x1c8, 0x1c8, 0x1c8, 0x1cb, 0x1cb, 0x1cb, 0x1cd, 0x1cf, 0x1d1, 0x1d3, 0x1d5, 0x1d7, 0x1d9, 0x1db, 0x18e, 0x1de, 0x1e0, 0x1e2, 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f2, 0x1f2, 0x1f2, 0x1f4, 0x1f8, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x202, 0x204, 0x206, 0x208, 0x20a, 0x20c, 0x20e, 0x210, 0x212, 0x214, 0x216, 0x218, 0x21a, 0x21c, 0x21e, 0x222, 0x224, 0x226, 0x228, 0x22a, 0x22c, 0x22e, 0x230, 0x232, 0x23b, 0x2c7e, 0x2c7f, 0x241, 0x246, 0x248, 0x24a, 0x24c, 0x24e, 0x2c6f, 0x2c6d, 0x2c70, 0x181, 0x186, 0x189, 0x18a, 0x18f, 0x190, 0x193, 0x194, 0xa78d, 0xa7aa, 0x197, 0x196, 0x2c62, 0x19c, 0x2c6e, 0x19d, 0x19f, 0x2c64, 0x1a6, 0x1a9, 0x1ae, 0x244, 0x1b1, 0x1b2, 0x245, 0x1b7, 0x399, 0x370, 0x372, 0x376, 0x3fd, 0x3fe, 0x3ff, 0x386, 0x388, 0x389, 0x38a, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b, 0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9, 0x3aa, 0x3ab, 0x38c, 0x38e, 0x38f, 0x392, 0x398, 0x3a6, 0x3a0, 0x3cf, 0x3d8, 0x3da, 0x3dc, 0x3de, 0x3e0, 0x3e2, 0x3e4, 0x3e6, 0x3e8, 0x3ea, 0x3ec, 0x3ee, 0x39a, 0x3a1, 0x3f9, 0x395, 0x3f7, 0x3fa, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, 0x460, 0x462, 0x464, 0x466, 0x468, 0x46a, 0x46c, 0x46e, 0x470, 0x472, 0x474, 0x476, 0x478, 0x47a, 0x47c, 0x47e, 0x480, 0x48a, 0x48c, 0x48e, 0x490, 0x492, 0x494, 0x496, 0x498, 0x49a, 0x49c, 0x49e, 0x4a0, 0x4a2, 0x4a4, 0x4a6, 0x4a8, 0x4aa, 0x4ac, 0x4ae, 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x4bc, 0x4be, 0x4c1, 0x4c3, 0x4c5, 0x4c7, 0x4c9, 0x4cb, 0x4cd, 0x4c0, 0x4d0, 0x4d2, 0x4d4, 0x4d6, 0x4d8, 0x4da, 0x4dc, 0x4de, 0x4e0, 0x4e2, 0x4e4, 0x4e6, 0x4e8, 0x4ea, 0x4ec, 0x4ee, 0x4f0, 0x4f2, 0x4f4, 0x4f6, 0x4f8, 0x4fa, 0x4fc, 0x4fe, 0x500, 0x502, 0x504, 0x506, 0x508, 0x50a, 0x50c, 0x50e, 0x510, 0x512, 0x514, 0x516, 0x518, 0x51a, 0x51c, 0x51e, 0x520, 0x522, 0x524, 0x526, 0x531, 0x532, 0x533, 0x534, 0x535, 0x536, 0x537, 0x538, 0x539, 0x53a, 0x53b, 0x53c, 0x53d, 0x53e, 0x53f, 0x540, 0x541, 0x542, 0x543, 0x544, 0x545, 0x546, 0x547, 0x548, 0x549, 0x54a, 0x54b, 0x54c, 0x54d, 0x54e, 0x54f, 0x550, 0x551, 0x552, 0x553, 0x554, 0x555, 0x556, 0xa77d, 0x2c63, 0x1e00, 0x1e02, 0x1e04, 0x1e06, 0x1e08, 0x1e0a, 0x1e0c, 0x1e0e, 0x1e10, 0x1e12, 0x1e14, 0x1e16, 0x1e18, 0x1e1a, 0x1e1c, 0x1e1e, 0x1e20, 0x1e22, 0x1e24, 0x1e26, 0x1e28, 0x1e2a, 0x1e2c, 0x1e2e, 0x1e30, 0x1e32, 0x1e34, 0x1e36, 0x1e38, 0x1e3a, 0x1e3c, 0x1e3e, 0x1e40, 0x1e42, 0x1e44, 0x1e46, 0x1e48, 0x1e4a, 0x1e4c, 0x1e4e, 0x1e50, 0x1e52, 0x1e54, 0x1e56, 0x1e58, 0x1e5a, 0x1e5c, 0x1e5e, 0x1e60, 0x1e62, 0x1e64, 0x1e66, 0x1e68, 0x1e6a, 0x1e6c, 0x1e6e, 0x1e70, 0x1e72, 0x1e74, 0x1e76, 0x1e78, 0x1e7a, 0x1e7c, 0x1e7e, 0x1e80, 0x1e82, 0x1e84, 0x1e86, 0x1e88, 0x1e8a, 0x1e8c, 0x1e8e, 0x1e90, 0x1e92, 0x1e94, 0x1e60, 0x1ea0, 0x1ea2, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eaa, 0x1eac, 0x1eae, 0x1eb0, 0x1eb2, 0x1eb4, 0x1eb6, 0x1eb8, 0x1eba, 0x1ebc, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ec8, 0x1eca, 0x1ecc, 0x1ece, 0x1ed0, 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1eda, 0x1edc, 0x1ede, 0x1ee0, 0x1ee2, 0x1ee4, 0x1ee6, 0x1ee8, 0x1eea, 0x1eec, 0x1eee, 0x1ef0, 0x1ef2, 0x1ef4, 0x1ef6, 0x1ef8, 0x1efa, 0x1efc, 0x1efe, 0x1f08, 0x1f09, 0x1f0a, 0x1f0b, 0x1f0c, 0x1f0d, 0x1f0e, 0x1f0f, 0x1f18, 0x1f19, 0x1f1a, 0x1f1b, 0x1f1c, 0x1f1d, 0x1f28, 0x1f29, 0x1f2a, 0x1f2b, 0x1f2c, 0x1f2d, 0x1f2e, 0x1f2f, 0x1f38, 0x1f39, 0x1f3a, 0x1f3b, 0x1f3c, 0x1f3d, 0x1f3e, 0x1f3f, 0x1f48, 0x1f49, 0x1f4a, 0x1f4b, 0x1f4c, 0x1f4d, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f68, 0x1f69, 0x1f6a, 0x1f6b, 0x1f6c, 0x1f6d, 0x1f6e, 0x1f6f, 0x1fba, 0x1fbb, 0x1fc8, 0x1fc9, 0x1fca, 0x1fcb, 0x1fda, 0x1fdb, 0x1ff8, 0x1ff9, 0x1fea, 0x1feb, 0x1ffa, 0x1ffb, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fb8, 0x1fb9, 0x1fbc, 0x399, 0x1fcc, 0x1fd8, 0x1fd9, 0x1fe8, 0x1fe9, 0x1fec, 0x1ffc, 0x2132, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0x216c, 0x216d, 0x216e, 0x216f, 0x2183, 0x24b6, 0x24b7, 0x24b8, 0x24b9, 0x24ba, 0x24bb, 0x24bc, 0x24bd, 0x24be, 0x24bf, 0x24c0, 0x24c1, 0x24c2, 0x24c3, 0x24c4, 0x24c5, 0x24c6, 0x24c7, 0x24c8, 0x24c9, 0x24ca, 0x24cb, 0x24cc, 0x24cd, 0x24ce, 0x24cf, 0x2c00, 0x2c01, 0x2c02, 0x2c03, 0x2c04, 0x2c05, 0x2c06, 0x2c07, 0x2c08, 0x2c09, 0x2c0a, 0x2c0b, 0x2c0c, 0x2c0d, 0x2c0e, 0x2c0f, 0x2c10, 0x2c11, 0x2c12, 0x2c13, 0x2c14, 0x2c15, 0x2c16, 0x2c17, 0x2c18, 0x2c19, 0x2c1a, 0x2c1b, 0x2c1c, 0x2c1d, 0x2c1e, 0x2c1f, 0x2c20, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c27, 0x2c28, 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c60, 0x23a, 0x23e, 0x2c67, 0x2c69, 0x2c6b, 0x2c72, 0x2c75, 0x2c80, 0x2c82, 0x2c84, 0x2c86, 0x2c88, 0x2c8a, 0x2c8c, 0x2c8e, 0x2c90, 0x2c92, 0x2c94, 0x2c96, 0x2c98, 0x2c9a, 0x2c9c, 0x2c9e, 0x2ca0, 0x2ca2, 0x2ca4, 0x2ca6, 0x2ca8, 0x2caa, 0x2cac, 0x2cae, 0x2cb0, 0x2cb2, 0x2cb4, 0x2cb6, 0x2cb8, 0x2cba, 0x2cbc, 0x2cbe, 0x2cc0, 0x2cc2, 0x2cc4, 0x2cc6, 0x2cc8, 0x2cca, 0x2ccc, 0x2cce, 0x2cd0, 0x2cd2, 0x2cd4, 0x2cd6, 0x2cd8, 0x2cda, 0x2cdc, 0x2cde, 0x2ce0, 0x2ce2, 0x2ceb, 0x2ced, 0x2cf2, 0x10a0, 0x10a1, 0x10a2, 0x10a3, 0x10a4, 0x10a5, 0x10a6, 0x10a7, 0x10a8, 0x10a9, 0x10aa, 0x10ab, 0x10ac, 0x10ad, 0x10ae, 0x10af, 0x10b0, 0x10b1, 0x10b2, 0x10b3, 0x10b4, 0x10b5, 0x10b6, 0x10b7, 0x10b8, 0x10b9, 0x10ba, 0x10bb, 0x10bc, 0x10bd, 0x10be, 0x10bf, 0x10c0, 0x10c1, 0x10c2, 0x10c3, 0x10c4, 0x10c5, 0x10c7, 0x10cd, 0xa640, 0xa642, 0xa644, 0xa646, 0xa648, 0xa64a, 0xa64c, 0xa64e, 0xa650, 0xa652, 0xa654, 0xa656, 0xa658, 0xa65a, 0xa65c, 0xa65e, 0xa660, 0xa662, 0xa664, 0xa666, 0xa668, 0xa66a, 0xa66c, 0xa680, 0xa682, 0xa684, 0xa686, 0xa688, 0xa68a, 0xa68c, 0xa68e, 0xa690, 0xa692, 0xa694, 0xa696, 0xa722, 0xa724, 0xa726, 0xa728, 0xa72a, 0xa72c, 0xa72e, 0xa732, 0xa734, 0xa736, 0xa738, 0xa73a, 0xa73c, 0xa73e, 0xa740, 0xa742, 0xa744, 0xa746, 0xa748, 0xa74a, 0xa74c, 0xa74e, 0xa750, 0xa752, 0xa754, 0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766, 0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77e, 0xa780, 0xa782, 0xa784, 0xa786, 0xa78b, 0xa790, 0xa792, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407, 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f, 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417, 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f, 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427, 0x2000053, 0x73, 0x130, 0x2000046, 0x66, 0x2000046, 0x69, 0x2000046, 0x6c, 0x3000046, 0x66, 0x69, 0x3000046, 0x66, 0x6c, 0x2000053, 0x74, 0x2000053, 0x74, 0x2000535, 0x582, 0x2000544, 0x576, 0x2000544, 0x565, 0x2000544, 0x56b, 0x200054e, 0x576, 0x2000544, 0x56d, 0x20002bc, 0x4e, 0x3000399, 0x308, 0x301, 0x30003a5, 0x308, 0x301, 0x200004a, 0x30c, 0x2000048, 0x331, 0x2000054, 0x308, 0x2000057, 0x30a, 0x2000059, 0x30a, 0x2000041, 0x2be, 0x20003a5, 0x313, 0x30003a5, 0x313, 0x300, 0x30003a5, 0x313, 0x301, 0x30003a5, 0x313, 0x342, 0x2000391, 0x342, 0x2000397, 0x342, 0x3000399, 0x308, 0x300, 0x3000399, 0x308, 0x301, 0x2000399, 0x342, 0x3000399, 0x308, 0x342, 0x30003a5, 0x308, 0x300, 0x30003a5, 0x308, 0x301, 0x20003a1, 0x313, 0x20003a5, 0x342, 0x30003a5, 0x308, 0x342, 0x20003a9, 0x342, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fbc, 0x1fbc, 0x1fcc, 0x1fcc, 0x1ffc, 0x1ffc, 0x2001fba, 0x345, 0x2000386, 0x345, 0x2001fca, 0x345, 0x2000389, 0x345, 0x2001ffa, 0x345, 0x200038f, 0x345, 0x3000391, 0x342, 0x345, 0x3000397, 0x342, 0x345, 0x30003a9, 0x342, 0x345]; return t; } -+} -+ -+} -+ -+ -+static if(size_t.sizeof == 4) { -+//1536 bytes -+enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 4, 9)([ 0x0, 0x40, 0x80], [ 0x100, 0x80, 0x2000], [ 0x2020100, 0x4020302, 0x2020205, 0x2060202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x50004, 0x30006, 0x30007, 0x30003, 0x30008, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x90003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0xa0003, 0xb0003, 0x30003, 0x3000c, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0xe000d, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x4200400, 0x80000000, 0xff7fffff, 0xaaaaaaaa, 0x55aaaaaa, 0xaaaaab55, 0xd4aaaaaa, 0x4e243129, 0xe6512d2a, 0xb5555240, 0xaa29aaaa, 0xaaaaaaaa, 0x93faaaaa, 0xffffaa85, 0xffffffff, 0xffefffff, 0x1ffffff, 0x3, 0x1f, 0x0, 0x0, 0x20, 0x3c8a0000, 0x10000, 0xfffff000, 0xaae37fff, 0x192faaaa, 0x0, 0xffff0000, 0xffffffff, 0xaaaaaaaa, 0xaaaaa802, 0xaaaaaaaa, 0xaaaad554, 0xaaaaaaaa, 0xaaaaaaaa, 0xaa, 0x0, 0xfffffffe, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xbfeaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0x3f00ff, 0xff00ff, 0xff003f, 0x3fff00ff, 0xff00ff, 0x40df00ff, 0xcf00dc, 0xdc00ff, 0x0, 0x0, 0x0, 0x80020000, 0x1fff0000, 0x0, 0x0, 0x0, 0x8c400, 0x32108000, 0x43c0, 0xffff0000, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0x3ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0x7fffffff, 0x3fda1562, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0x8501a, 0xffffffff, 0x20bf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xaaaaaaaa, 0x2aaa, 0xaaaaaa, 0x0, 0x0, 0x0, 0x0, 0xaaabaaa8, 0xaaaaaaaa, 0x95ffaaaa, 0xa50aa, 0x2aa, 0x0, 0x7000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf8007f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffff00, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc000000, 0xfffff, 0xffdfc000, 0xff, 0xffffffc, 0xebc00000, 0xffef, 0xfffffc00, 0xc000000f, 0xffffff, 0xfffc0000, 0xfff, 0xffffffc0, 0xfc000000, 0xfffff, 0xffffc000, 0xff, 0xffffffc, 0xffc00000, 0xffff, 0xfffffc00, 0x3f, 0xf7fffffc, 0xf0000003, 0xfdfffff, 0xffc00000, 0x3f7fff, 0xffff0000, 0xfdff, 0xfffffc00, 0xbf7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//1472 bytes -+enum upperCaseTrieEntries = TrieEntry!(bool, 8, 4, 9)([ 0x0, 0x40, 0x80], [ 0x100, 0x80, 0x1e00], [ 0x2020100, 0x4020302, 0x2020205, 0x2060202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x30003, 0x30003, 0x30004, 0x30003, 0x30003, 0x50003, 0x30006, 0x30007, 0x30003, 0x30008, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x90003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0xa0003, 0x30003, 0x3000b, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0xd000c, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x30003, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0x7f7fffff, 0x0, 0x55555555, 0xaa555555, 0x555554aa, 0x2b555555, 0xb1dbced6, 0x11aed2d5, 0x4aaaa490, 0x55d25555, 0x55555555, 0x6c055555, 0x557a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x450000, 0xfffed740, 0xffb, 0x551c8000, 0xe6905555, 0xffffffff, 0xffff, 0x0, 0x55555555, 0x55555401, 0x55555555, 0x55552aab, 0x55555555, 0x55555555, 0xfffe0055, 0x7fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x20bf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x55555555, 0x55555555, 0x55555555, 0x55555555, 0x40155555, 0x55555555, 0x55555555, 0x55555555, 0x3f00ff00, 0xff00ff00, 0xaa003f00, 0xff00, 0x0, 0xf000000, 0xf000f00, 0xf001f00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e273884, 0xc00f3d50, 0x20, 0xffff, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffc00000, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7fff, 0x0, 0xc025ea9d, 0x55555555, 0x55555555, 0x55555555, 0x42805, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x55555555, 0x1555, 0x555555, 0x0, 0x0, 0x0, 0x0, 0x55545554, 0x55555555, 0x6a005555, 0x52855, 0x555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ffffff, 0xfff00000, 0x3fff, 0xffffff00, 0xd0000003, 0x3fde64, 0xffff0000, 0x3ff, 0x1fdfe7b0, 0x7b000000, 0x1fc5f, 0xfffff000, 0x3f, 0x3ffffff, 0xfff00000, 0x3fff, 0xffffff00, 0xf0000003, 0x3fffff, 0xffff0000, 0x3ff, 0xffffff00, 0x1, 0x7fffffc, 0xf0000000, 0x1fffff, 0xffc00000, 0x7fff, 0xffff0000, 0x1ff, 0x400, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//8704 bytes -+enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x200], [ 0x100, 0x380, 0xd00], [ 0x2020100, 0x4020302, 0x2020205, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xa, 0xb0000, 0xd000c, 0xf000e, 0x110010, 0x130012, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160015, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x0, 0x190018, 0x1b001a, 0x1d001c, 0x1f001e, 0x0, 0x0, 0x210020, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x240023, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x260025, 0x280027, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2a0000, 0x2b, 0x2d002c, 0x2e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30002f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x320031, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x20ffff, 0x240022, 0x280026, 0x2c002a, 0x30002e, 0x72f0032, 0x390037, 0x3d003b, 0x41003f, 0x1b00043, 0x4a0048, 0x4e004c, 0x520050, 0xffff0054, 0xffffffff, 0xffffffff, 0x21ffff, 0x250023, 0x290027, 0x2d002b, 0x31002f, 0x7300033, 0x3a0038, 0x3e003c, 0x420040, 0x1b10044, 0x4b0049, 0x4f004d, 0x530051, 0xffff0055, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x43fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xc800c6, 0xcc0498, 0x14904aa, 0xd500d3, 0xd900d7, 0xdd00db, 0xe100df, 0xe500e3, 0xe900e7, 0xed00eb, 0xf100ef, 0xffff00f3, 0xf700f5, 0xfb00f9, 0xff00fd, 0x6be0101, 0xc900c7, 0xcd0499, 0x14a04ab, 0xd600d4, 0xda00d8, 0xde00dc, 0xe200e0, 0xe600e4, 0xea00e8, 0xee00ec, 0xf200f0, 0xffff00f4, 0xf800f6, 0xfc00fa, 0x10000fe, 0x1a80102, 0x1160115, 0x1180117, 0x11c011b, 0x11e011d, 0x120011f, 0x1240123, 0x1260125, 0x1280127, 0x12c012b, 0x12e012d, 0x130012f, 0x1340133, 0x1360135, 0x1380137, 0x13a0139, 0x13c013b, 0x13e013d, 0x140013f, 0x1420141, 0x1440143, 0x1460145, 0x1480147, 0x14d014c, 0x14f014e, 0xffffffff, 0x1510150, 0x1530152, 0x1550154, 0x156ffff, 0x1580157, 0x15c0159, 0x15e015d, 0x160015f, 0x1620161, 0x1640163, 0x1660165, 0xffff0167, 0x1690168, 0x16b016a, 0x16d016c, 0x16f016e, 0x1710170, 0x1730172, 0x1750174, 0x1770176, 0x1790178, 0x17b017a, 0x17d017c, 0x17f017e, 0x1830182, 0x1870186, 0x18b018a, 0x18f018e, 0x1930192, 0x1970196, 0x19b019a, 0x19f019e, 0x1a301a2, 0x1a501a4, 0x1a701a6, 0x1aa01a9, 0x1ac01ab, 0x1ae01ad, 0x1b201af, 0x1b3028b, 0x1b601b5, 0x1ba01b9, 0x1bd01bb, 0x1bf01be, 0x1c301c1, 0xffff01c4, 0x1c701c5, 0x1cb01c9, 0x1cd01cc, 0x23b01cf, 0x1d301d1, 0x1d601d5, 0xffff0283, 0x1d901d7, 0x1db0269, 0x1de01dd, 0x1e001df, 0x1e201e1, 0x1e501e3, 0x1e701e6, 0xffffffff, 0x1ea01e9, 0x1ed01eb, 0x1ef01ee, 0x1f301f1, 0x1f501f4, 0x1f701f6, 0x1fa01f9, 0xffffffff, 0x1fc01fb, 0x23dffff, 0xffffffff, 0xffffffff, 0x2010200, 0x2060202, 0x2080207, 0x20d020c, 0x20f020e, 0x2110210, 0x2130212, 0x2150214, 0x2170216, 0x2190218, 0x21b021a, 0x21d021c, 0x1c6021e, 0x220021f, 0x2240223, 0x2260225, 0x2280227, 0x22a0229, 0x22c022b, 0x22e022d, 0x230022f, 0x2320231, 0x236ffff, 0x2380237, 0x23a0239, 0x23e023c, 0x240023f, 0x2440243, 0x2460245, 0x2480247, 0x24a0249, 0x24c024b, 0x24e024d, 0x250024f, 0x2520251, 0x2540253, 0x2560255, 0x2580257, 0x25a0259, 0x25c025b, 0x25e025d, 0x260025f, 0x2620261, 0x2640263, 0x2660265, 0x2680267, 0xffff026a, 0x26c026b, 0x26e026d, 0x270026f, 0x2720271, 0x2740273, 0x2760275, 0x2780277, 0x27a0279, 0x27c027b, 0xffffffff, 0xffffffff, 0xffffffff, 0x281027f, 0x2840282, 0x2d70285, 0x2870482, 0x28c0288, 0x28f028d, 0x2920291, 0x2940293, 0x2960295, 0x2980297, 0x29c029b, 0x466046a, 0x1b402b7, 0xffff01bc, 0x1c201c0, 0x1c8ffff, 0x1caffff, 0xffffffff, 0xffffffff, 0xffff01ce, 0x1d0ffff, 0x748ffff, 0xffff05fa, 0x1d201d4, 0x528ffff, 0xffffffff, 0x1d8ffff, 0x2b3ffff, 0xffff01da, 0x1dcffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2a3ffff, 0xffffffff, 0xffff01e4, 0x1e8ffff, 0xffffffff, 0xffffffff, 0x28e01ec, 0x1f201f0, 0xffff0290, 0xffffffff, 0xffffffff, 0xffff01f8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x83affff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x31e031d, 0x320031f, 0xffffffff, 0x3240323, 0xffffffff, 0x3d5ffff, 0x3d903d7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0329, 0x32f032d, 0xffff0331, 0xffff0333, 0x3370335, 0x339ffff, 0x33e0395, 0x3cc0340, 0x3470345, 0x83b03c8, 0x35403c2, 0x3590440, 0x35d035b, 0x3c5039f, 0x388ffff, 0x36a0368, 0x36f039c, 0x7100371, 0x3780376, 0x32e032a, 0x3320330, 0x33affff, 0x33f0396, 0x3cd0341, 0x3480346, 0x83c03c9, 0x35503c3, 0x35a0441, 0x35e035c, 0x3c603a0, 0x38a0389, 0x36b0369, 0x370039d, 0x7110372, 0x3790377, 0x3360334, 0x3930338, 0x3ca0397, 0xffffffff, 0x39effff, 0x39403a1, 0x3a303a2, 0x3a703a6, 0x3a903a8, 0x3ab03aa, 0x3ad03ac, 0x3af03ae, 0x3b103b0, 0x3b503b4, 0x3b903b8, 0x3bd03bc, 0x3bf03be, 0x3c103c0, 0x3c703c4, 0xffff03d1, 0x3ce03cb, 0x3cfffff, 0x3d203d0, 0x3d403d3, 0x3d6ffff, 0x3da03d8, 0x3dd03db, 0x3e103df, 0x3e503e3, 0x3e903e7, 0x3ed03eb, 0x3f103ef, 0x3f503f3, 0x3f903f7, 0x3fd03fb, 0x40103ff, 0x4050403, 0x4090407, 0x40d040b, 0x411040f, 0x4150413, 0x4190417, 0x41d041b, 0x421041f, 0x4250423, 0x4290427, 0x42d042b, 0x431042f, 0x4350433, 0x4390437, 0x3fe03fc, 0x4020400, 0x4060404, 0x40a0408, 0x40e040c, 0x4120410, 0x4160414, 0x41a0418, 0x41e041c, 0x4220420, 0x4260424, 0x42a0428, 0x42e042c, 0x4320430, 0x4360434, 0x43a0438, 0x3de03dc, 0x3e203e0, 0x3e603e4, 0x3ea03e8, 0x3ee03ec, 0x3f203f0, 0x3f603f4, 0x3fa03f8, 0x4510450, 0x4530452, 0x4570456, 0x4590458, 0x45d045c, 0x4610460, 0x4650464, 0x4690468, 0x46d046c, 0x4710470, 0x4730472, 0x4770476, 0x4790478, 0x47b047a, 0x47d047c, 0x4810480, 0x4850484, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4950494, 0x4970496, 0x49b049a, 0x49d049c, 0x49f049e, 0x4a304a2, 0x4a704a6, 0x4a904a8, 0x4ad04ac, 0x4b104b0, 0x4b304b2, 0x4b704b6, 0x4b904b8, 0x4bb04ba, 0x4bf04be, 0x4c104c0, 0x4c504c4, 0x4c904c8, 0x4cd04cc, 0x4cf04ce, 0x4d304d2, 0x4d504d4, 0x4d704d6, 0x4db04da, 0x4df04de, 0x4e304e2, 0x4e704e6, 0x4ec04ea, 0x4f004ed, 0x4f404f1, 0x4f804f5, 0x4fc04f9, 0x50004fd, 0x5040501, 0x4eb0505, 0x50b050a, 0x50d050c, 0x50f050e, 0x5130512, 0x5170516, 0x5190518, 0x51d051c, 0x51f051e, 0x5210520, 0x5250524, 0x5270526, 0x52b052a, 0x52d052c, 0x52f052e, 0x5330532, 0x5370536, 0x5390538, 0x53d053c, 0x53f053e, 0x5410540, 0x5430542, 0x5470546, 0x5490548, 0x54b054a, 0x54d054c, 0x54f054e, 0x5510550, 0x5550554, 0x5570556, 0x5590558, 0x55b055a, 0x55d055c, 0x55f055e, 0x5630562, 0x5650564, 0x5670566, 0x5690568, 0x56b056a, 0x56f056e, 0x5730572, 0x5750574, 0x5770576, 0x5790578, 0x57b057a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x580ffff, 0x5840582, 0x5880586, 0x58c058a, 0x590058e, 0x5940592, 0x5980596, 0x59c059a, 0x5a0059e, 0x5a405a2, 0x5a805a6, 0x5ac05aa, 0x5b005ae, 0x5b405b2, 0x5b805b6, 0x5bc05ba, 0x5c005be, 0x5c405c2, 0x5c805c6, 0xffff05ca, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x581ffff, 0x5850583, 0x5890587, 0x58d058b, 0x591058f, 0x5950593, 0x5990597, 0x59d059b, 0x5a1059f, 0x5a505a3, 0x5a905a7, 0x5ad05ab, 0x5b105af, 0x5b505b3, 0x5b905b7, 0x5bd05bb, 0x5c105bf, 0x5c505c3, 0x5c905c7, 0xffff05cb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x880086, 0x8c008a, 0x90008e, 0x940092, 0x980096, 0x9c009a, 0xa0009e, 0xa400a2, 0xa800a6, 0xac00aa, 0xb000ae, 0xb400b2, 0xb800b6, 0xbc00ba, 0xc000be, 0xc400c2, 0x48e0486, 0x4a000ca, 0x4b400ce, 0x4c6ffff, 0xffffffff, 0xffffffff, 0x508ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7e8ffff, 0xffffffff, 0x454ffff, 0xffffffff, 0x5fd05fc, 0x5ff05fe, 0x6010600, 0x6050604, 0x6090608, 0x60b060a, 0x60f060e, 0x6110610, 0x6130612, 0x6170616, 0x6190618, 0x61d061c, 0x61f061e, 0x6210620, 0x6230622, 0x6270626, 0x6290628, 0x62b062a, 0x62d062c, 0x62f062e, 0x6310630, 0x6350634, 0x6370636, 0x6390638, 0x63b063a, 0x63d063c, 0x63f063e, 0x6430642, 0x6450644, 0x6470646, 0x6490648, 0x64b064a, 0x64d064c, 0x6510650, 0x6530652, 0x6550654, 0x6590658, 0x65d065c, 0x65f065e, 0x6630662, 0x6650664, 0x6670666, 0x6690668, 0x66b066a, 0x66d066c, 0x6710670, 0x6730672, 0x6750674, 0x6bc06bb, 0x67a0679, 0x67c067b, 0x680067f, 0x6820681, 0x6840683, 0x6860685, 0x6880687, 0x68a0689, 0x68e068d, 0x690068f, 0x6920691, 0x6960695, 0x6980697, 0x69a0699, 0x69e069d, 0x6a0069f, 0x6a206a1, 0x6a406a3, 0x6a606a5, 0x6a806a7, 0x6ac06ab, 0x6ae06ad, 0x6b006af, 0x6b206b1, 0x6b406b3, 0x6b606b5, 0xffffffff, 0xffffffff, 0x6bdffff, 0xffffffff, 0xffff06bf, 0x6c106c0, 0x6c306c2, 0x6c506c4, 0x6c906c8, 0x6cb06ca, 0x6cd06cc, 0x6cf06ce, 0x6d106d0, 0x6d506d4, 0x6d706d6, 0x6db06da, 0x6dd06dc, 0x6df06de, 0x6e106e0, 0x6e306e2, 0x6e506e4, 0x6e906e8, 0x6eb06ea, 0x6ef06ee, 0x6f106f0, 0x6f306f2, 0x6f506f4, 0x6f706f6, 0x6f906f8, 0x6fb06fa, 0x6fd06fc, 0x6ff06fe, 0x7010700, 0x7030702, 0x7050704, 0x7070706, 0x7090708, 0x70b070a, 0x70d070c, 0x70f070e, 0x7140713, 0x7160715, 0x7180717, 0x71c071b, 0x71e071d, 0x720071f, 0x7220721, 0x7240723, 0x7260725, 0x7280727, 0x72a0729, 0x72e072d, 0x7330732, 0x7380736, 0x73c073a, 0x740073e, 0x7440742, 0x7390737, 0x73d073b, 0x741073f, 0x7450743, 0x74c074a, 0x750074e, 0x7540752, 0xffffffff, 0x74d074b, 0x751074f, 0x7550753, 0xffffffff, 0x7660764, 0x76a0768, 0x76e076c, 0x7720770, 0x7670765, 0x76b0769, 0x76f076d, 0x7730771, 0x7860784, 0x78a0788, 0x78e078c, 0x7920790, 0x7870785, 0x78b0789, 0x78f078d, 0x7930791, 0x79e079c, 0x7a207a0, 0x7a607a4, 0xffffffff, 0x79f079d, 0x7a307a1, 0x7a707a5, 0xffffffff, 0x7b6ffff, 0x7baffff, 0x7beffff, 0x7c2ffff, 0x7b7ffff, 0x7bbffff, 0x7bfffff, 0x7c3ffff, 0x7d207d0, 0x7d607d4, 0x7da07d8, 0x7de07dc, 0x7d307d1, 0x7d707d5, 0x7db07d9, 0x7df07dd, 0x8360834, 0x840083e, 0x8440842, 0x84e084c, 0x8620860, 0x8580856, 0x8660864, 0xffffffff, 0x7f607f4, 0x7fa07f8, 0x7fe07fc, 0x8020800, 0x7f707f5, 0x7fb07f9, 0x7ff07fd, 0x8030801, 0x80a0808, 0x80e080c, 0x8120810, 0x8160814, 0x80b0809, 0x80f080d, 0x8130811, 0x8170815, 0x8220820, 0x8260824, 0x82a0828, 0x82e082c, 0x8230821, 0x8270825, 0x82b0829, 0x82f082d, 0x8320830, 0x838ffff, 0xffffffff, 0xffffffff, 0x8330831, 0x8370835, 0xffff0839, 0xffff083d, 0xffffffff, 0x846ffff, 0xffffffff, 0xffffffff, 0x841083f, 0x8450843, 0xffff0847, 0xffffffff, 0x84a0848, 0xffffffff, 0xffffffff, 0xffffffff, 0x84b0849, 0x84f084d, 0xffffffff, 0xffffffff, 0x8540852, 0xffffffff, 0x85affff, 0xffffffff, 0x8550853, 0x8590857, 0xffff085b, 0xffffffff, 0xffffffff, 0x868ffff, 0xffffffff, 0xffffffff, 0x8630861, 0x8670865, 0xffff0869, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0712, 0xffffffff, 0x14b0731, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0530, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0531, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x180029f, 0x18402af, 0x18802c1, 0x18c005e, 0x1900064, 0x194006c, 0x1980076, 0x19c007e, 0x18102a0, 0x18502b0, 0x18902c2, 0x18d005f, 0x1910065, 0x195006d, 0x1990077, 0x19d007f, 0xffffffff, 0x1b7ffff, 0xffff01b8, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4d80444, 0x4dc0446, 0x4e0044c, 0x4e4045e, 0x4e80474, 0x2d3086a, 0x204ee, 0x6c604f2, 0x6e04f6, 0x37a04fa, 0x10d04fe, 0x61a0502, 0x51a0506, 0x4d90445, 0x4dd0447, 0x4e1044d, 0x4e5045f, 0x4e90475, 0x2d4086b, 0x304ef, 0x6c704f3, 0x6f04f7, 0x37b04fb, 0x10e04ff, 0x61b0503, 0x51b0507, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x40000, 0xa0008, 0xe000c, 0x160010, 0x1a0018, 0x2bb001c, 0x2d102c7, 0x5602e7, 0x600058, 0x660062, 0x70006a, 0x780074, 0x80007c, 0x2990082, 0x607e0, 0x6020084, 0x2a7057c, 0x5d005ce, 0x10305de, 0x1070105, 0x10f0109, 0x1190113, 0x1290121, 0xffff0131, 0x50001, 0xb0009, 0xf000d, 0x170011, 0x1b0019, 0x2bc001d, 0x2d202c8, 0x5702e8, 0x610059, 0x670063, 0x71006b, 0x790075, 0x81007d, 0x29a0083, 0x707e1, 0x6030085, 0x2a8057d, 0x5d105cf, 0x10405df, 0x1080106, 0x110010a, 0x11a0114, 0x12a0122, 0xffff0132, 0x4c304c2, 0x4550529, 0x28002a4, 0x45a0286, 0x2a9045b, 0x46202aa, 0x4670463, 0x46b02b4, 0xffff02b8, 0x2ba02b9, 0x2bfffff, 0xffff02c0, 0xffffffff, 0xffffffff, 0xffffffff, 0x48302d8, 0x2e202e1, 0x4890488, 0x48b048a, 0x48d048c, 0x4910490, 0x2fe02fd, 0x3040303, 0x30e030d, 0x3160315, 0x31a0319, 0x3260325, 0x3280327, 0x2fc02fb, 0x6ed06ec, 0x3810380, 0x3830382, 0x3870386, 0x3920391, 0x3a503a4, 0x3b303b2, 0x56d056c, 0x5cd05cc, 0x5db05da, 0x5ed05ec, 0x60d060c, 0x6570656, 0x43e043d, 0x6e706e6, 0x72c072b, 0x7830782, 0x7e307e2, 0x6940693, 0x65b065a, 0x150014, 0x5d005c, 0x4bd04bc, 0x4d104d0, 0x5d505d4, 0x1a101a0, 0x5110510, 0x5230522, 0x5350534, 0x5450544, 0x5530552, 0x5610560, 0x5710570, 0x57f057e, 0x15b015a, 0x37d037c, 0x3bb03ba, 0xffffffff, 0xffffffff, 0xffffffff, 0x5d2ffff, 0x5d805d3, 0xffff05d9, 0xffffffff, 0x5e305e2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x890087, 0x8d008b, 0x91008f, 0x950093, 0x990097, 0x9d009b, 0xa1009f, 0xa500a3, 0xa900a7, 0xad00ab, 0xb100af, 0xb500b3, 0xb900b7, 0xbd00bb, 0xc100bf, 0xc500c3, 0x48f0487, 0x4a100cb, 0x4b500cf, 0x4c7ffff, 0xffffffff, 0xffffffff, 0x509ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2c402c3, 0x5d705d6, 0x5dd05dc, 0x5e105e0, 0x5e705e6, 0x5e905e8, 0x5eb05ea, 0x5ef05ee, 0x5f105f0, 0x5f505f4, 0x5f905f8, 0x3080307, 0x6150614, 0x6250624, 0x6330632, 0x6410640, 0x64f064e, 0x6610660, 0x66f066e, 0x67e067d, 0x68c068b, 0x69c069b, 0x6aa06a9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7350734, 0x690068, 0x27e027d, 0x75f075e, 0x7770776, 0x390038f, 0x1f001e, 0x7b107b0, 0x7c707c6, 0x2a202a1, 0x7e507e4, 0x6b806b7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7590758, 0x75d075c, 0x7610760, 0x2d602d5, 0x2e002df, 0x2e602e5, 0x2ee02ed, 0xffffffff, 0x7790778, 0x77d077c, 0x7810780, 0x30c030b, 0x3140313, 0x3180317, 0x3220321, 0x7950794, 0x7970796, 0x7990798, 0x79b079a, 0x37f037e, 0x3850384, 0x38e038d, 0x7a907a8, 0x7ab07aa, 0x7ad07ac, 0x7af07ae, 0x7b307b2, 0x7b507b4, 0x7b907b8, 0x7bd07bc, 0x7c107c0, 0x7c507c4, 0x7c907c8, 0x7cd07cc, 0x7cf07ce, 0x46f046e, 0x47f047e, 0x4930492, 0x4a504a4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x514ffff, 0x7e60515, 0x7e907e7, 0x7eb07ea, 0x7ed07ec, 0x7ef07ee, 0x7f107f0, 0x7f307f2, 0xffffffff, 0x5f2ffff, 0x74905f3, 0xffffffff, 0x8050804, 0x8070806, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x8190818, 0x81b081a, 0x81d081c, 0x81f081e, 0x5f705f6, 0xffff05fb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x756ffff, 0x75a02c5, 0x2cd02cb, 0x76202cf, 0x2db06d2, 0x2e30719, 0x2e90448, 0x2f107ca, 0x2f30774, 0x77a02f5, 0x77e02f9, 0x3050221, 0x30f007a, 0xffff043b, 0xffffffff, 0xffffffff, 0x757ffff, 0x75b02c6, 0x2ce02cc, 0x76302d0, 0x2dc06d3, 0x2e4071a, 0x2ea0449, 0x2f207cb, 0x2f40775, 0x77b02f6, 0x77f02fa, 0x3060222, 0x310007b, 0xffff043c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x85c0012, 0x72005a, 0x32b0311, 0x11106b9, 0x2ab05e4, 0x2dd029d, 0x2ef085e, 0x10b0606, 0x2d902a5, 0x4ca0289, 0x2b502ad, 0x2c902bd, 0x2eb0746, 0x30902f7, 0x241031b, 0x38b02b1, 0x44a03b6, 0x442053a, 0x6d8044e, 0x85004ae, 0x85d0013, 0x73005b, 0x32c0312, 0x11206ba, 0x2ac05e5, 0x2de029e, 0x2f0085f, 0x10c0607, 0x2da02a6, 0x4cb028a, 0x2b602ae, 0x2ca02be, 0x2ec0747, 0x30a02f8, 0x242031c, 0x38c02b2, 0x44b03b7, 0x443053b, 0x6d9044f, 0x85104af, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+//8832 bytes -+enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x200], [ 0x100, 0x380, 0xd40], [ 0x2020100, 0x4020302, 0x2020205, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xa, 0xb0000, 0xd000c, 0xf000e, 0x110010, 0x130012, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160015, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x170000, 0x0, 0x190018, 0x1b001a, 0x1d001c, 0x1f001e, 0x0, 0x0, 0x210020, 0x22, 0x0, 0x0, 0x0, 0x0, 0x0, 0x240023, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x260025, 0x280027, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2a0000, 0x2b, 0x2d002c, 0x2e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x310030, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x330032, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x20ffff, 0x240022, 0x280026, 0x2c002a, 0x30002e, 0x7810032, 0x390037, 0x3d003b, 0x41003f, 0x1b90043, 0x4a0048, 0x4e004c, 0x520050, 0xffff0054, 0xffffffff, 0xffffffff, 0x21ffff, 0x250023, 0x290027, 0x2d002b, 0x31002f, 0x7820033, 0x3a0038, 0x3e003c, 0x420040, 0x1ba0044, 0x4b0049, 0x4f004d, 0x530051, 0xffff0055, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x470ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xc800c6, 0xcc04c9, 0x14e04db, 0xd500d3, 0xd900d7, 0xdd00db, 0xe100df, 0xe500e3, 0xe900e7, 0xed00eb, 0xf100ef, 0xffff00f3, 0xf700f5, 0xfb00f9, 0xff00fd, 0x70f0101, 0xc900c7, 0xcd04ca, 0x14f04dc, 0xd600d4, 0xda00d8, 0xde00dc, 0xe200e0, 0xe600e4, 0xea00e8, 0xee00ec, 0xf200f0, 0xffff00f4, 0xf800f6, 0xfc00fa, 0x10000fe, 0x1b10102, 0x1190118, 0x11b011a, 0x11f011e, 0x1210120, 0x1230122, 0x1270126, 0x1290128, 0x12b012a, 0x12f012e, 0x1310130, 0x1330132, 0x1370136, 0x1390138, 0x13b013a, 0x13d013c, 0x13f013e, 0x1410140, 0x1430142, 0x1470146, 0x1490148, 0x14b014a, 0x14d014c, 0x1520151, 0x1540153, 0xffff0155, 0x1580157, 0x15a0159, 0x15c015b, 0x15dffff, 0x15f015e, 0x1630160, 0x1650164, 0x1670166, 0x1690168, 0x16b016a, 0x16d016c, 0x16f016e, 0x1720171, 0x1740173, 0x1760175, 0x1780177, 0x17a0179, 0x17c017b, 0x17e017d, 0x180017f, 0x1820181, 0x1840183, 0x1860185, 0x1880187, 0x18c018b, 0x190018f, 0x1940193, 0x1980197, 0x19c019b, 0x1a0019f, 0x1a401a3, 0x1a801a7, 0x1ac01ab, 0x1ae01ad, 0x1b001af, 0x1b301b2, 0x1b501b4, 0x1b701b6, 0x1bb01b8, 0x1bc029c, 0x1bf01be, 0x1c301c2, 0x1c601c4, 0x1c801c7, 0x1cc01ca, 0xffff01cd, 0x1d001ce, 0x1d401d2, 0x1d601d5, 0x24801d8, 0x1dc01da, 0x1df01de, 0xffff0294, 0x1e201e0, 0x1e60278, 0x1e901e8, 0x1eb01ea, 0x1ed01ec, 0x1f001ee, 0x1f201f1, 0xffffffff, 0x1f501f4, 0x1f801f6, 0x1fa01f9, 0x1fe01fc, 0x20001ff, 0x2020201, 0x2050204, 0xffffffff, 0x2070206, 0x24affff, 0xffffffff, 0xffffffff, 0x20c020b, 0x211020d, 0x2130212, 0x2180217, 0x21a0219, 0x21c021b, 0x21e021d, 0x220021f, 0x2220221, 0x2240223, 0x2260225, 0x2280227, 0x1cf0229, 0x22b022a, 0x22f022e, 0x2310230, 0x2330232, 0x2350234, 0x2370236, 0x2390238, 0x23b023a, 0x23d023c, 0x243023e, 0x2450244, 0x2470246, 0x24b0249, 0x24d024c, 0x2510250, 0x2530252, 0x2550254, 0x2570256, 0x2590258, 0x25b025a, 0x25d025c, 0x2610260, 0x2630262, 0x2650264, 0x2670266, 0x2690268, 0x26b026a, 0x26d026c, 0x26f026e, 0x2710270, 0x2730272, 0x2750274, 0x2770276, 0xffff0279, 0x27b027a, 0x27d027c, 0x27f027e, 0x2810280, 0x2850284, 0x2870286, 0x2890288, 0x28b028a, 0x28d028c, 0xffffffff, 0xffffffff, 0xffffffff, 0x2920290, 0x2950293, 0x2ec0296, 0x29804b3, 0x29d0299, 0x2a0029e, 0x2a302a2, 0x2a502a4, 0x2a702a6, 0x2a902a8, 0x2ad02ac, 0x497049b, 0x1bd02ca, 0xffff01c5, 0x1cb01c9, 0x1d1ffff, 0x1d3ffff, 0xffffffff, 0xffffffff, 0xffff01d7, 0x1d9ffff, 0x79affff, 0xffff0643, 0x1db01dd, 0x559ffff, 0xffffffff, 0x1e1ffff, 0x2c6ffff, 0xffff01e3, 0x1e7ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2b4ffff, 0xffffffff, 0xffff01ef, 0x1f3ffff, 0xffffffff, 0xffffffff, 0x29f01f7, 0x1fd01fb, 0xffff02a1, 0xffffffff, 0xffffffff, 0xffff0203, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x8e4ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3450344, 0x3470346, 0xffffffff, 0x34b034a, 0xffffffff, 0x406ffff, 0x40a0408, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0350, 0x3560354, 0xffff0358, 0xffff035a, 0x35e035c, 0x3630902, 0x36803c2, 0x3fd036a, 0x371036f, 0x8e503f9, 0x37e03f3, 0x3830471, 0x3870385, 0x3f603cc, 0x3b5ffff, 0x3940392, 0x39903c9, 0x762039b, 0x3a203a0, 0x3550351, 0x3590357, 0x3640915, 0x36903c3, 0x3fe036b, 0x3720370, 0x8e603fa, 0x37f03f4, 0x3840472, 0x3880386, 0x3f703cd, 0x3b703b6, 0x3950393, 0x39a03ca, 0x763039c, 0x3a303a1, 0x35d035b, 0x3c0035f, 0x3fb03c4, 0xffffffff, 0x3cbffff, 0x3c103ce, 0x3d003cf, 0x3d403d3, 0x3d603d5, 0x3d803d7, 0x3da03d9, 0x3de03dd, 0x3e003df, 0x3e403e3, 0x3e803e7, 0x3ec03eb, 0x3ee03ed, 0x3f203f1, 0x3f803f5, 0xffff0402, 0x3ff03fc, 0x400ffff, 0x4030401, 0x4050404, 0x407ffff, 0x40b0409, 0x40e040c, 0x4120410, 0x4160414, 0x41a0418, 0x41e041c, 0x4220420, 0x4260424, 0x42a0428, 0x42e042c, 0x4320430, 0x4360434, 0x43a0438, 0x43e043c, 0x4420440, 0x4460444, 0x44a0448, 0x44e044c, 0x4520450, 0x4560454, 0x45a0458, 0x45e045c, 0x4620460, 0x4660464, 0x46a0468, 0x42f042d, 0x4330431, 0x4370435, 0x43b0439, 0x43f043d, 0x4430441, 0x4470445, 0x44b0449, 0x44f044d, 0x4530451, 0x4570455, 0x45b0459, 0x45f045d, 0x4630461, 0x4670465, 0x46b0469, 0x40f040d, 0x4130411, 0x4170415, 0x41b0419, 0x41f041d, 0x4230421, 0x4270425, 0x42b0429, 0x4820481, 0x4840483, 0x4880487, 0x48a0489, 0x48e048d, 0x4920491, 0x4960495, 0x49a0499, 0x49e049d, 0x4a204a1, 0x4a404a3, 0x4a804a7, 0x4aa04a9, 0x4ac04ab, 0x4ae04ad, 0x4b204b1, 0x4b604b5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4c604c5, 0x4c804c7, 0x4cc04cb, 0x4ce04cd, 0x4d004cf, 0x4d404d3, 0x4d804d7, 0x4da04d9, 0x4de04dd, 0x4e204e1, 0x4e404e3, 0x4e804e7, 0x4ea04e9, 0x4ec04eb, 0x4f004ef, 0x4f204f1, 0x4f604f5, 0x4fa04f9, 0x4fe04fd, 0x50004ff, 0x5040503, 0x5060505, 0x5080507, 0x50c050b, 0x510050f, 0x5140513, 0x5180517, 0x51d051b, 0x521051e, 0x5250522, 0x5290526, 0x52d052a, 0x531052e, 0x5350532, 0x51c0536, 0x53c053b, 0x53e053d, 0x540053f, 0x5440543, 0x5480547, 0x54a0549, 0x54e054d, 0x550054f, 0x5520551, 0x5560555, 0x5580557, 0x55c055b, 0x55e055d, 0x560055f, 0x5640563, 0x5680567, 0x56a0569, 0x56e056d, 0x570056f, 0x5720571, 0x5740573, 0x5780577, 0x57a0579, 0x57c057b, 0x57e057d, 0x5820581, 0x5840583, 0x5880587, 0x58a0589, 0x58c058b, 0x58e058d, 0x5920591, 0x5940593, 0x5980597, 0x59a0599, 0x59c059b, 0x59e059d, 0x5a205a1, 0x5a605a5, 0x5aa05a9, 0x5ac05ab, 0x5ae05ad, 0x5b005af, 0x5b405b3, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x5b9ffff, 0x5bd05bb, 0x5c105bf, 0x5c505c3, 0x5c905c7, 0x5cd05cb, 0x5d105cf, 0x5d505d3, 0x5d905d7, 0x5dd05db, 0x5e105df, 0x5e505e3, 0x5e905e7, 0x5ed05eb, 0x5f105ef, 0x5f505f3, 0x5f905f7, 0x5fd05fb, 0x60105ff, 0xffff0603, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x5baffff, 0x5be05bc, 0x5c205c0, 0x5c605c4, 0x5ca05c8, 0x5ce05cc, 0x5d205d0, 0x5d605d4, 0x5da05d8, 0x5de05dc, 0x5e205e0, 0x5e605e4, 0x5ea05e8, 0x5ee05ec, 0x5f205f0, 0x5f605f4, 0x5fa05f8, 0x5fe05fc, 0x6020600, 0x6130604, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x880086, 0x8c008a, 0x90008e, 0x940092, 0x980096, 0x9c009a, 0xa0009e, 0xa400a2, 0xa800a6, 0xac00aa, 0xb000ae, 0xb400b2, 0xb800b6, 0xbc00ba, 0xc000be, 0xc400c2, 0x4bf04b7, 0x4d100ca, 0x4e500ce, 0x4f7ffff, 0xffffffff, 0xffffffff, 0x539ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x83affff, 0xffffffff, 0x485ffff, 0xffffffff, 0x6460645, 0x6480647, 0x64a0649, 0x64e064d, 0x6520651, 0x6540653, 0x6580657, 0x65a0659, 0x65c065b, 0x660065f, 0x6620661, 0x6660665, 0x6680667, 0x66a0669, 0x66c066b, 0x670066f, 0x6720671, 0x6740673, 0x6760675, 0x6780677, 0x67a0679, 0x67e067d, 0x680067f, 0x6820681, 0x6840683, 0x6860685, 0x6880687, 0x68c068b, 0x68e068d, 0x690068f, 0x6920691, 0x6940693, 0x6960695, 0x69a0699, 0x69c069b, 0x69e069d, 0x6a206a1, 0x6a606a5, 0x6a806a7, 0x6ac06ab, 0x6ae06ad, 0x6b006af, 0x6b206b1, 0x6b406b3, 0x6b606b5, 0x6ba06b9, 0x6bc06bb, 0x6be06bd, 0x70d070c, 0x6c306c2, 0x6c706c6, 0x6cb06ca, 0x6cd06cc, 0x6cf06ce, 0x6d106d0, 0x6d306d2, 0x6d506d4, 0x6d906d8, 0x6db06da, 0x6dd06dc, 0x6e106e0, 0x6e306e2, 0x6e506e4, 0x6e906e8, 0x6eb06ea, 0x6ed06ec, 0x6ef06ee, 0x6f106f0, 0x6f306f2, 0x6f706f6, 0x6f906f8, 0x6fb06fa, 0x6fd06fc, 0x6ff06fe, 0x7010700, 0x7040702, 0x7080706, 0x70e070a, 0xffffffff, 0xffff0710, 0x7130712, 0x7150714, 0x7170716, 0x71b071a, 0x71d071c, 0x71f071e, 0x7210720, 0x7230722, 0x7270726, 0x7290728, 0x72d072c, 0x72f072e, 0x7310730, 0x7330732, 0x7350734, 0x7370736, 0x73b073a, 0x73d073c, 0x7410740, 0x7430742, 0x7450744, 0x7470746, 0x7490748, 0x74b074a, 0x74d074c, 0x74f074e, 0x7510750, 0x7530752, 0x7550754, 0x7570756, 0x7590758, 0x75b075a, 0x75d075c, 0x75f075e, 0x7610760, 0x7660765, 0x7680767, 0x76a0769, 0x76e076d, 0x770076f, 0x7720771, 0x7740773, 0x7760775, 0x7780777, 0x77a0779, 0x77c077b, 0x780077f, 0x7850784, 0x78a0788, 0x78e078c, 0x7920790, 0x7960794, 0x78b0789, 0x78f078d, 0x7930791, 0x7970795, 0x79e079c, 0x7a207a0, 0x7a607a4, 0xffffffff, 0x79f079d, 0x7a307a1, 0x7a707a5, 0xffffffff, 0x7b807b6, 0x7bc07ba, 0x7c007be, 0x7c407c2, 0x7b907b7, 0x7bd07bb, 0x7c107bf, 0x7c507c3, 0x7d807d6, 0x7dc07da, 0x7e007de, 0x7e407e2, 0x7d907d7, 0x7dd07db, 0x7e107df, 0x7e507e3, 0x7f007ee, 0x7f407f2, 0x7f807f6, 0xffffffff, 0x7f107ef, 0x7f507f3, 0x7f907f7, 0xffffffff, 0x80807fc, 0x80c07fe, 0x8100800, 0x8140804, 0x809ffff, 0x80dffff, 0x811ffff, 0x815ffff, 0x8240822, 0x8280826, 0x82c082a, 0x830082e, 0x8250823, 0x8290827, 0x82d082b, 0x831082f, 0x8df08dd, 0x8f708f5, 0x8fb08f9, 0x90f090d, 0x9370935, 0x9240922, 0x93b0939, 0xffffffff, 0x8590856, 0x85f085c, 0x8650862, 0x86b0868, 0x85a0857, 0x860085d, 0x8660863, 0x86c0869, 0x8890886, 0x88f088c, 0x8950892, 0x89b0898, 0x88a0887, 0x890088d, 0x8960893, 0x89c0899, 0x8b908b6, 0x8bf08bc, 0x8c508c2, 0x8cb08c8, 0x8ba08b7, 0x8c008bd, 0x8c608c3, 0x8cc08c9, 0x8db08d9, 0x8e108ce, 0xffff08d3, 0x8d708d5, 0x8dc08da, 0x8e008de, 0xffff08e2, 0xffff08e7, 0xffffffff, 0x8fd08e8, 0xffff08ed, 0x8f308f1, 0x8f808f6, 0x8fc08fa, 0xffff08fe, 0xffffffff, 0x90b0909, 0x9030900, 0xffffffff, 0x9070905, 0x90c090a, 0x910090e, 0xffffffff, 0xffffffff, 0x920091e, 0x9160913, 0x9260918, 0x91c091a, 0x921091f, 0x9250923, 0xffff0927, 0xffffffff, 0xffffffff, 0x93d092a, 0xffff092f, 0x9330931, 0x9380936, 0x93c093a, 0xffff093e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0764, 0xffffffff, 0x1500783, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0561, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0562, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x18902b0, 0x18d02c2, 0x19102d6, 0x195005e, 0x1990064, 0x19d006c, 0x1a10076, 0x1a5007e, 0x18a02b1, 0x18e02c3, 0x19202d7, 0x196005f, 0x19a0065, 0x19e006d, 0x1a20077, 0x1a6007f, 0xffffffff, 0x1c0ffff, 0xffff01c1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x5090475, 0x50d0477, 0x511047d, 0x515048f, 0x51904a5, 0x2e80940, 0x2051f, 0x7180523, 0x6e0527, 0x3a4052b, 0x110052f, 0x6630533, 0x54b0537, 0x50a0476, 0x50e0478, 0x512047e, 0x5160490, 0x51a04a6, 0x2e90941, 0x30520, 0x7190524, 0x6f0528, 0x3a5052c, 0x1110530, 0x6640534, 0x54c0538, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x40000, 0xa0008, 0xe000c, 0x160010, 0x1a0018, 0x2ce001c, 0x2e602dc, 0x560308, 0x600058, 0x660062, 0x70006a, 0x780074, 0x80007c, 0x2aa0082, 0x60832, 0x64b0084, 0x2b805b5, 0x60d0609, 0x629061d, 0x1080106, 0x112010a, 0x11c0116, 0x12c0124, 0xffff0134, 0x50001, 0xb0009, 0xf000d, 0x170011, 0x1b0019, 0x2cf001d, 0x2e702dd, 0x570309, 0x610059, 0x670063, 0x71006b, 0x790075, 0x81007d, 0x2ab0083, 0x70833, 0x64c0085, 0x2b905b6, 0x60e060a, 0x62a061e, 0x1090107, 0x113010b, 0x11d0117, 0x12d0125, 0xffff0135, 0x4f404f3, 0x486055a, 0x29102b5, 0x48b0297, 0x2ba048c, 0x49302bb, 0x4980494, 0x49c02c7, 0xffff02cb, 0x2cd02cc, 0x2d4ffff, 0xffff02d5, 0xffffffff, 0xffffffff, 0xffffffff, 0x4b402ed, 0x2f902f8, 0x4ba04b9, 0x4bc04bb, 0x4be04bd, 0x4c204c1, 0x3250324, 0x32b032a, 0x3350334, 0x33d033c, 0x3410340, 0x34d034c, 0x34f034e, 0x3230322, 0x73f073e, 0x3ae03ad, 0x3b003af, 0x3b403b3, 0x3bf03be, 0x3d203d1, 0x3e203e1, 0x5a405a3, 0x6060605, 0x61a0619, 0x6320631, 0x6560655, 0x6a0069f, 0x46f046e, 0x7390738, 0x77e077d, 0x7d507d4, 0x8350834, 0x6df06de, 0x6a406a3, 0x150014, 0x5d005c, 0x4ee04ed, 0x5020501, 0x6120611, 0x1aa01a9, 0x5420541, 0x5540553, 0x5660565, 0x5760575, 0x5860585, 0x5960595, 0x5a805a7, 0x5b805b7, 0x1620161, 0x3a703a6, 0x3ea03e9, 0xffffffff, 0xffffffff, 0xffffffff, 0x60fffff, 0x6170610, 0xffff0618, 0xffffffff, 0x6240623, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x890087, 0x8d008b, 0x91008f, 0x950093, 0x990097, 0x9d009b, 0xa1009f, 0xa500a3, 0xa900a7, 0xad00ab, 0xb100af, 0xb500b3, 0xb900b7, 0xbd00bb, 0xc100bf, 0xc500c3, 0x4c004b8, 0x4d200cb, 0x4e600cf, 0x4f8ffff, 0xffffffff, 0xffffffff, 0x53affff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2d902d8, 0x6160615, 0x61c061b, 0x6220621, 0x6280627, 0x1e501e4, 0x62e062d, 0x6340633, 0x6380637, 0x63e063d, 0x6420641, 0x32f032e, 0x65e065d, 0x66e066d, 0x67c067b, 0x68a0689, 0x6980697, 0x6aa06a9, 0x6b806b7, 0x6c906c8, 0x6d706d6, 0x6e706e6, 0x6f506f4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7870786, 0x690068, 0x28f028e, 0x7b107b0, 0x7c907c8, 0x3bd03bc, 0x1f001e, 0x8030802, 0x8190818, 0x2b302b2, 0x8370836, 0x2d302d2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7ab07aa, 0x7af07ae, 0x7b307b2, 0x2eb02ea, 0x2f502f4, 0x3070306, 0x3110310, 0xffffffff, 0x7cb07ca, 0x7cf07ce, 0x7d307d2, 0x3330332, 0x33b033a, 0x33f033e, 0x3490348, 0x7e707e6, 0x7e907e8, 0x7eb07ea, 0x7ed07ec, 0x3ac03ab, 0x3b203b1, 0x3bb03ba, 0x7fb07fa, 0x3dc03db, 0x3f003ef, 0x620061f, 0x2830282, 0x8070806, 0x80b080a, 0x80f080e, 0x8130812, 0x8170816, 0x81b081a, 0x81f081e, 0x8210820, 0x4a0049f, 0x4b004af, 0x4c404c3, 0x4d604d5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x545ffff, 0x8380546, 0x83b0839, 0x83d083c, 0x580057f, 0x590058f, 0x5a0059f, 0x5b205b1, 0xffffffff, 0x63bffff, 0x79b063c, 0xffffffff, 0x6080607, 0x60c060b, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x62c062b, 0x630062f, 0x6360635, 0x63a0639, 0x640063f, 0xffff0644, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x25e02f6, 0x2fc02fa, 0x30302fe, 0xffff0304, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x30cffff, 0x2c0030e, 0x3140312, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7a8ffff, 0x7ac02da, 0x2e202e0, 0x7b402e4, 0x2f00724, 0x144076b, 0x30a0479, 0x318081c, 0x31a07c6, 0x7cc031c, 0x7d00320, 0x32c022c, 0x336007a, 0xffff046c, 0xffffffff, 0xffffffff, 0x7a9ffff, 0x7ad02db, 0x2e302e1, 0x7b502e5, 0x2f10725, 0x145076c, 0x30b047a, 0x319081d, 0x31b07c7, 0x7cd031d, 0x7d10321, 0x32d022d, 0x337007b, 0xffff046d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x9280012, 0x72005a, 0x3520338, 0x114010c, 0x2bc0625, 0x2f202ae, 0x31608ef, 0x10e064f, 0x2ee02b6, 0x4fb029a, 0x2c802be, 0x2de02d0, 0x47f0798, 0x330031e, 0x24e0342, 0x3b802c4, 0x47b03e5, 0x473056b, 0x72a06c4, 0x91104df, 0x9290013, 0x73005b, 0x3530339, 0x115010d, 0x2bd0626, 0x2f302af, 0x31708f0, 0x10f0650, 0x2ef02b7, 0x4fc029b, 0x2c902bf, 0x2df02d1, 0x4800799, 0x331031f, 0x24f0343, 0x3b902c5, 0x47c03e6, 0x474056c, 0x72b06c5, 0x91204e0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+//4000 bytes -+enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0x160], [ 0x100, 0x240, 0x5100], [ 0x3020100, 0x7060504, 0xb0a0908, 0xe0d0c0a, 0x3030303, 0x100a0f03, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xb000a, 0xd000c, 0xf000e, 0x10010, 0x120011, 0x10013, 0x150014, 0x170016, 0x190018, 0x1b001a, 0x1c0001, 0x1e001d, 0x1f001f, 0x1f0020, 0x1f001f, 0x1f001f, 0x1f001f, 0x220021, 0x1f0023, 0x250024, 0x1f001f, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x260001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x270001, 0x10001, 0x10001, 0x10028, 0x2a0029, 0x2c002b, 0x2e002d, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x2f0001, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1001f, 0x310030, 0x320001, 0x340033, 0x360035, 0x380037, 0x1f0039, 0x1f001f, 0x3b003a, 0x3d003c, 0x1f003e, 0x1f001f, 0x40003f, 0x1f001f, 0x1f001f, 0x1f0041, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x10001, 0x420001, 0x1f0043, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x10001, 0x10001, 0x1f0044, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x10001, 0x1f0045, 0x1f001f, 0x46001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f0047, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x490048, 0x4b004a, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f004c, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x10001, 0x10001, 0x10001, 0x1004d, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x4e0001, 0x1f004f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x10001, 0x1f004f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x1f001f, 0x0, 0x0, 0x7fffffe, 0x7fffffe, 0x0, 0x4200400, 0xff7fffff, 0xff7fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3ffc3, 0x501f, 0x0, 0x0, 0x20, 0x3cdf0000, 0xffffd740, 0xfffffffb, 0xffffffff, 0xffbfffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffc03, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffe00ff, 0x27fffff, 0xfffffffe, 0xff, 0xbfff0000, 0xffff00b6, 0x707ff, 0x7ff0000, 0xffffffff, 0xfeffffff, 0xffffc000, 0xffffffff, 0xffffffff, 0x1fefffff, 0x9c00e1fe, 0xffff0000, 0xffffffff, 0xffffe000, 0xffffffff, 0xffffffff, 0x3ffff, 0xfffffc00, 0x43007ff, 0xfcffffff, 0x1fff, 0x1ffffff, 0x0, 0x0, 0x1ffd, 0x0, 0x7fff03f0, 0xffffffff, 0xefffffff, 0xffe1dfff, 0xfefe000f, 0xfff99fee, 0xe3c5fdff, 0xb080599f, 0x3000f, 0xfff987ee, 0xc36dfdff, 0x5e021987, 0x3f0000, 0xfffbbfee, 0xe3edfdff, 0x11bbf, 0xf, 0xfff99fee, 0xe3edfdff, 0xb0c0199f, 0x2000f, 0xd63dc7ec, 0xc3ffc718, 0x811dc7, 0x0, 0xfffddfee, 0xe3effdff, 0x3601ddf, 0xf, 0xfffddfec, 0xe3effdff, 0x40601ddf, 0x6000f, 0xfffddfec, 0xe7ffffff, 0x805ddf, 0xfc00000f, 0xfc7fffec, 0x2ffbffff, 0xff5f807f, 0xc0000, 0xfffffffe, 0x7ffffff, 0x207f, 0x0, 0xfef02596, 0x3bffecae, 0xf000205f, 0x0, 0x1, 0x0, 0xfffffeff, 0xfffe1fff, 0xfeffff03, 0x1fffffff, 0x0, 0x0, 0xffffffff, 0xf97fffff, 0xffff0000, 0xffffc1e7, 0x3000407f, 0xffffffff, 0xffff20bf, 0xf7ffffff, 0xffffffff, 0xffffffff, 0x3d7f3dff, 0xffffffff, 0xffff3dff, 0x7f3dffff, 0xff7fff3d, 0xffffffff, 0xff3dffff, 0xffffffff, 0x87ffffff, 0x0, 0xffff, 0xffffffff, 0xffffffff, 0x1fffff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff9fff, 0x7fffffe, 0xffffffff, 0xffffffff, 0x1c7ff, 0xfdfff, 0xfffff, 0xfffff, 0xddfff, 0xffffffff, 0xffcfffff, 0x108001ff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffff, 0xffffffff, 0xffff07ff, 0xffffffff, 0x3fffff, 0x1fffffff, 0x1ff0fff, 0xffff0000, 0x1f3fff, 0xffffffff, 0xffff0fff, 0x3ff, 0x0, 0xfffffff, 0xffffffff, 0x7fffffff, 0x1ffffe, 0x0, 0x80, 0x0, 0x0, 0xffffffff, 0xffefffff, 0xfef, 0x0, 0xffffffff, 0xfc00f3ff, 0xffffffff, 0x3ffbf, 0xffffffff, 0x3fffff, 0xfc00e000, 0x3fffffff, 0x0, 0x0, 0x0, 0x6fde00, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x3f3fffff, 0xffffffff, 0xaaff3f3f, 0x3fffffff, 0xffffffff, 0x5fdfffff, 0xfcf1fdc, 0x1fdc1fff, 0x0, 0x0, 0x0, 0x80020000, 0x1fff0000, 0x0, 0x0, 0x0, 0x3e2ffc84, 0xf3ffbd50, 0x43e0, 0xffffffff, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffc00000, 0xffffffff, 0x3ff, 0xffffffff, 0xffff7fff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xc781f, 0xffffffff, 0xffff20bf, 0xffffffff, 0x80ff, 0x7fffff, 0x7f7f7f7f, 0x7f7f7f7f, 0xffffffff, 0x0, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe0, 0x1f3e03fe, 0xfffffffe, 0xffffffff, 0xe07fffff, 0xfffffffe, 0xffffffff, 0xf7ffffff, 0xffffffe0, 0xfffe3fff, 0xffffffff, 0xffffffff, 0x7fff, 0x7ffffff, 0x0, 0xffff0000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fff, 0x0, 0xffff0000, 0x3fffffff, 0xffff1fff, 0xc00, 0xffffffff, 0x8ff07fff, 0x80ffffff, 0xffffffff, 0xffffffff, 0xffff, 0xff800000, 0xfffffffc, 0xffffffff, 0xffffffff, 0xf79ff, 0x7ff, 0x0, 0xff000000, 0xfffff7bb, 0xff, 0xffffffff, 0xfffff, 0xffffffff, 0xffffffff, 0xf, 0x8fc0000, 0xfffffc00, 0xffff07ff, 0x7ffff, 0x1fffffff, 0xffffffff, 0xfff7ffff, 0x8000, 0x0, 0xffffffff, 0x7fffff, 0x3fff, 0x47fffff, 0xffffffff, 0x7fffffff, 0x38000005, 0x3cffff, 0x7e7e7e, 0x7f7f, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7ff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff000f, 0xfffff87f, 0xfffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xe0f8007f, 0x5f7ffdff, 0xffffffdb, 0xffffffff, 0xffffffff, 0x3ffff, 0xfff80000, 0xffffffff, 0xffffffff, 0x3fffffff, 0xffff0000, 0xffffffff, 0xfffcffff, 0xffffffff, 0xff, 0xfff0000, 0x0, 0x0, 0x0, 0xffdf0000, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0x0, 0x7fffffe, 0x7fffffe, 0xffffffc0, 0xffffffff, 0x7fffffff, 0x1cfcfcfc, 0x0, 0xffffefff, 0xb7ffff7f, 0x3fff3fff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7ffffff, 0x0, 0x0, 0xffffffff, 0x1fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1fffffff, 0xffffffff, 0x1ffff, 0x0, 0x7fffffff, 0xffff0000, 0x7ff, 0x0, 0x3fffffff, 0xffffffff, 0x3eff0f, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x0, 0x0, 0x0, 0xfffffd3f, 0x91bfffff, 0x3fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fffff, 0x3ffffff, 0x0, 0x0, 0xffffffff, 0xc0ffffff, 0x0, 0x0, 0xfeeff06f, 0xfffff, 0x0, 0x1fffffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x3fffff, 0x3fffff, 0x7ffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x3f, 0x0, 0xfffffffc, 0x1ffffff, 0xffff0000, 0x1ff, 0xffffffff, 0x7ffff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x1e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x3fffff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x1ffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffff001f, 0x7fffffff, 0xfff80000, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffdfffff, 0xffffffff, 0xdfffffff, 0xebffde64, 0xffffffef, 0xffffffff, 0xdfdfe7bf, 0x7bffffff, 0xfffdfc5f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff3f, 0xf7fffffd, 0xf7ffffff, 0xffdfffff, 0xffdfffff, 0xffff7fff, 0xffff7fff, 0xfffffdff, 0xfffffdff, 0xff7, 0x0, 0xffffffef, 0xaf7fe96, 0xaa96ea84, 0x5ef7f796, 0xffffbff, 0xffffbee, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffff, 0x0, 0xffffffff, 0x1fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2304 bytes -+enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xe0], [ 0x100, 0x140, 0x2c00], [ 0x2020100, 0x4020302, 0x6020205, 0x2070202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020208, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xb000a, 0xd000c, 0xe, 0xf0000, 0x0, 0x100000, 0x120011, 0x140013, 0x160015, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x190018, 0x0, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1b, 0x1d001c, 0x1f001e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x21, 0x220000, 0x0, 0x0, 0x0, 0x0, 0x23, 0x0, 0x0, 0x250024, 0x0, 0x0, 0x26, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x270000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x280000, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2a0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, 0xbfffffff, 0xb6, 0x0, 0x7ff0000, 0x0, 0xfffff800, 0x10000, 0x0, 0x0, 0x9fc00000, 0x3d9f, 0x20000, 0xffff0000, 0x7ff, 0x0, 0x0, 0x1ffc0, 0x0, 0xff800, 0xfbc00000, 0x3eef, 0xe000000, 0x0, 0x0, 0x0, 0x0, 0x7ffffff0, 0xf, 0xdc000000, 0xfeffff, 0xc, 0xe, 0xd0000000, 0x80399f, 0xc, 0xe, 0xd0000000, 0x23987, 0x230000, 0xe, 0xd0000000, 0x3bbf, 0xc, 0xe, 0xd0000000, 0xc0399f, 0xc, 0x4, 0xc0000000, 0x803dc7, 0x0, 0xe, 0xc0000000, 0x603ddf, 0xc, 0xc, 0xd0000000, 0x603ddf, 0xc, 0xc, 0xc0000000, 0x803ddf, 0xc, 0xc, 0x0, 0xff5f8400, 0xc0000, 0x0, 0x7f20000, 0x7f80, 0x0, 0x0, 0x1bf20000, 0x3f00, 0x0, 0x3000000, 0xc2a00000, 0x0, 0xfffe0000, 0xfeffe0df, 0x1fffffff, 0x40, 0x0, 0x0, 0x7ffff800, 0xc3c00000, 0x1e3f9d, 0x3c00bffc, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c0000, 0x1c0000, 0xc0000, 0xc0000, 0x0, 0xfff00000, 0x200fffff, 0x0, 0x3800, 0x0, 0x0, 0x0, 0x0, 0x200, 0x0, 0x0, 0x0, 0xfff0fff, 0x0, 0x0, 0x0, 0xffff0000, 0x301, 0x0, 0xf800000, 0x0, 0x7fe00000, 0x9fffffff, 0x0, 0x0, 0x0, 0x0, 0x1f, 0xfff00000, 0x1f, 0xff800, 0x7, 0x3ffe, 0x0, 0xfffc0, 0x0, 0xfffff0, 0x0, 0x0, 0x0, 0x0, 0xfff70000, 0x1c21ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xf000007f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0x1ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38000, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x0, 0xffffffff, 0x0, 0xfc00, 0x0, 0x0, 0x6000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff78000, 0x80000000, 0x0, 0x0, 0x30000, 0x844, 0xf8, 0x0, 0x0, 0x3, 0xfff00000, 0x1f, 0x3ffff, 0x0, 0x3fc0, 0xfff80, 0x0, 0xf, 0xfff80000, 0x1, 0x0, 0x0, 0x7ffe00, 0x3008, 0x8000000, 0x0, 0xc19d0000, 0x2, 0x60f800, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x37f8, 0x40000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000, 0xf06e, 0x87000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xff000000, 0x7f, 0x0, 0x7, 0x7ff0000, 0x0, 0x0, 0x7, 0x1fff80, 0x0, 0x0, 0x7, 0xfff80000, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfff800, 0x0, 0x0, 0x0, 0x0, 0xfffe0000, 0x7fffffff, 0x78000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf807e3e0, 0xfe7, 0x3c00, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2384 bytes -+enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)([ 0x0, 0x40, 0x180], [ 0x100, 0x280, 0x1a80], [ 0x2020100, 0x4020302, 0x2020605, 0x8070202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x40003, 0x50002, 0x20002, 0x70006, 0x60006, 0x90008, 0x6000a, 0x2000b, 0xc000c, 0x2000d, 0xe0005, 0x20002, 0x20002, 0x2000f, 0x20002, 0x20002, 0x100002, 0x110002, 0x2000e, 0x130012, 0x140002, 0xc, 0x20015, 0x20002, 0x20002, 0x20002, 0x170016, 0x190018, 0x20002, 0x20002, 0x1b001a, 0x20002, 0x20002, 0x1d001c, 0x20002, 0x20002, 0x20002, 0x20002, 0x1e0002, 0x20002, 0x20002, 0x20002, 0x2001f, 0x200002, 0x220021, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x60023, 0x20002, 0xc0024, 0xc0017, 0x2000c, 0x40002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x2000e, 0x20002, 0x260025, 0x20002, 0x280027, 0x230002, 0x20002, 0x20002, 0x20002, 0x20029, 0x2002a, 0x2002b, 0x2002c, 0x20002, 0x20002, 0x2002d, 0x20002, 0x4002e, 0xc002f, 0x20002, 0x20002, 0x20002, 0x20002, 0x50002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20030, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20031, 0x20002, 0x20002, 0x20002, 0x320002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20033, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x20002, 0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x720c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff, 0x0, 0x0, 0x0, 0x3ff0000, 0x0, 0x0, 0x3ff, 0x0, 0x0, 0x0, 0x0, 0xffc0, 0x0, 0x0, 0x0, 0x3f0ffc0, 0x0, 0x0, 0x0, 0xfcffc0, 0x0, 0x0, 0x0, 0x7ffc0, 0x0, 0x0, 0x0, 0x7f00ffc0, 0x0, 0x0, 0x0, 0x3fffc0, 0x0, 0x0, 0x3ff0000, 0x0, 0x0, 0xfffff, 0x0, 0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ffffe00, 0x0, 0x0, 0x0, 0x1c000, 0x0, 0x0, 0x0, 0x3ff03ff, 0x0, 0x0, 0xffc0, 0x0, 0x0, 0x0, 0x7ff0000, 0x0, 0x3ff03ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff03ff, 0x0, 0x0, 0x0, 0x0, 0x3f10000, 0x3ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0xffffffff, 0x3e7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xfffffff, 0x0, 0x0, 0xfffffc00, 0x0, 0x0, 0x0, 0xffc00000, 0xfffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000000, 0x80, 0x70003fe, 0x0, 0x0, 0x3c0000, 0x0, 0x0, 0x0, 0x0, 0x3ff, 0xfffeff00, 0x0, 0x3ff, 0xfffe0000, 0x0, 0x0, 0x0, 0x3ff, 0x0, 0x0, 0x0, 0x3f0000, 0x0, 0x0, 0xffffff80, 0xfffff, 0xffffffff, 0x1ffffff, 0x400, 0x0, 0x0, 0x0, 0x0, 0xf, 0x402, 0x0, 0x0, 0x0, 0x3e0000, 0x0, 0x0, 0x0, 0xff000000, 0x0, 0xfc00000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x60000000, 0x0, 0x0, 0xff000000, 0xff000000, 0x0, 0x0, 0x0, 0x7fffffff, 0x0, 0x0, 0xfffc0000, 0xffff, 0x0, 0xffc00000, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7, 0x0, 0x0, 0x0, 0x3ffff, 0x0, 0x0, 0xffffc000, 0xffffffff, 0x7ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2336 bytes -+enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xc0], [ 0x100, 0x100, 0x3100], [ 0x2020100, 0x4020302, 0x2020605, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x20001, 0x30001, 0x50004, 0x70006, 0x10008, 0x90001, 0xb000a, 0x1000c, 0xd0001, 0x1000e, 0x10000f, 0x120011, 0x140013, 0x10015, 0x10001, 0x10016, 0x170001, 0x10001, 0x180001, 0x190001, 0x10001, 0x1b001a, 0x1001c, 0x1001d, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x1001e, 0x1001f, 0x210020, 0x230022, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x240001, 0x260025, 0x270001, 0x280001, 0x10001, 0x10001, 0x2a0029, 0x2c002b, 0x10001, 0x10001, 0x2e002d, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x1002f, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x0, 0x8c00f7ee, 0xb8000001, 0x28000000, 0x0, 0x88c00882, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40000000, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc000000, 0x0, 0x600, 0x40000000, 0x49, 0x180000, 0xc8003600, 0x0, 0x0, 0x3c00, 0x0, 0x0, 0x100000, 0x0, 0x3fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3800000, 0x0, 0x7fff0000, 0x40000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10030, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000, 0x0, 0x0, 0xc008000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x17fff0, 0x3c000000, 0x0, 0x0, 0x20, 0x0, 0x61f0000, 0x0, 0x0, 0x0, 0xfc00, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x0, 0x0, 0x0, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6000, 0x18000000, 0x0, 0x0, 0x3800, 0x0, 0x600000, 0x0, 0x0, 0x0, 0x0, 0x7700000, 0x0, 0x7ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x0, 0x3f7f, 0x0, 0x0, 0x0, 0x0, 0xfc000000, 0x1, 0x0, 0x0, 0x0, 0xf0000000, 0x0, 0xf8000000, 0x0, 0xc0000000, 0x0, 0x0, 0x800ff, 0x0, 0xffff0000, 0xffff00ff, 0x7ffbffef, 0x60000000, 0x6000, 0x0, 0x0, 0x0, 0xf00, 0x600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fff00, 0x0, 0x0, 0x60, 0xffc0, 0x0, 0x0, 0x0, 0x0, 0x1fffff8, 0x0, 0xf000000, 0x30000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xde000000, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xfff7fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfff3ff0e, 0x20010000, 0x0, 0x0, 0x0, 0x1, 0x0, 0x8000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0xe000, 0x0, 0x0, 0x40080000, 0x0, 0x0, 0x0, 0xfc0000, 0x0, 0x0, 0x0, 0xf00000, 0x0, 0x0, 0xc000, 0x7000000, 0x0, 0xc000, 0x80000000, 0x0, 0x0, 0x0, 0xc0003ffe, 0x0, 0x0, 0x0, 0xf0000000, 0x0, 0x0, 0x0, 0xc0000000, 0x30000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x800, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff0000, 0xffff0000, 0xfff7ffff, 0xd0b, 0x0, 0x0, 0x0, 0x0, 0x8c00f7ee, 0xb8000001, 0xa8000000, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x800000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x80000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1ff0000, 0x80000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfe000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3f80, 0x0, 0x0, 0xd8000000, 0x3, 0x0, 0x0, 0x0, 0xf, 0x0, 0x0, 0x0, 0x1e0, 0x0, 0x0, 0x0, 0x0, 0xf0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//2848 bytes -+enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0xe0], [ 0x100, 0x140, 0x3d00], [ 0x3020100, 0x5030403, 0x3030306, 0x8070303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x3030303, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x80001, 0xa0009, 0xc000b, 0xe000d, 0x1000f, 0x100001, 0x10001, 0x110001, 0x120001, 0x130001, 0x10001, 0x140001, 0x160015, 0x180017, 0x170019, 0x1a0017, 0x1b0017, 0x1c0017, 0x1001d, 0x1f001e, 0x210020, 0x170022, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x230001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10024, 0x250001, 0x10026, 0x10027, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x280001, 0x290001, 0x2b002a, 0x2c0001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x2e002d, 0x30002f, 0x10001, 0x320031, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10033, 0x350034, 0x370036, 0x390038, 0x3b003a, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x0, 0x70000810, 0x40000000, 0x50000001, 0x0, 0x113d37c, 0x800000, 0x800000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffc003c, 0xffffafe0, 0x0, 0x0, 0x0, 0x200000, 0x30, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000, 0x0, 0x0, 0x0, 0xc9c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40000000, 0x60000200, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20000, 0x0, 0x0, 0x0, 0x10000, 0x0, 0x0, 0x0, 0x7f80000, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfce8000e, 0x1500000, 0x0, 0x0, 0x0, 0xc0000000, 0x1e0dfbf, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000000, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc0000000, 0xffffffff, 0x0, 0x0, 0x0, 0x1ff007fe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa0000000, 0xe000e003, 0x6000e000, 0x0, 0x0, 0x40010, 0x1c000000, 0x1c00, 0x7ffffff, 0x0, 0x0, 0xc1d0037b, 0xc0042af, 0xbc1f, 0x0, 0xffff0000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff0ff, 0xfffff9ff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff, 0xffffffff, 0x7f, 0x7ff, 0x0, 0xf0000000, 0xffffffff, 0xffffffff, 0x3ff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xff, 0xfff00000, 0xffffffff, 0xffffff9f, 0xffff003f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfe000007, 0xffffffff, 0xf0ffffff, 0xcfffffff, 0xffffffff, 0xffffffff, 0x3ff1fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7e0, 0x0, 0x0, 0x0, 0x0, 0xfbffffff, 0xffffffff, 0xffffffff, 0xfffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0xfff0000, 0xc0010, 0xc0c00001, 0x0, 0x0, 0x18000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffc30000, 0x0, 0xffffffff, 0xf, 0x7fffffff, 0xfffffc00, 0x100ff, 0xffffffff, 0xfffffc00, 0x1ffff, 0xffffffff, 0x7fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0xffff0000, 0xffffffff, 0x7f, 0x0, 0x7fffff, 0x3, 0x0, 0x0, 0x600, 0x0, 0x0, 0x0, 0x0, 0x3c00f00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3800000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200, 0x0, 0x0, 0x0, 0xfffc0000, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30000000, 0x0, 0x0, 0x0, 0x274, 0x0, 0x0, 0x0, 0x0, 0x70000810, 0x40000000, 0x50000001, 0x0, 0x0, 0x0, 0x0, 0x30007f7f, 0x0, 0xff800000, 0x0, 0xfe000000, 0xfff03ff, 0x0, 0xffff0000, 0x1fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0xffffffff, 0xfffffe7f, 0xffffffff, 0x1c1f, 0xfffff018, 0xffffc3ff, 0x3fffffff, 0x0, 0xffffffff, 0xffffffff, 0x23, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x7fffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8000002, 0x8000000, 0x200000, 0x200000, 0x8000, 0x8000, 0x200, 0x200, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30000, 0xffffffff, 0xffff0fff, 0xffffffff, 0xffffffff, 0xfffff, 0x7ffe7fff, 0xfffefffe, 0x0, 0xffff0000, 0xffff7fff, 0xffffffff, 0xffff0fff, 0x7ffffff, 0x0, 0x0, 0xffffffc0, 0xffff0007, 0x7ffffff, 0x301ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffbf0001, 0xffffffff, 0x1fffffff, 0xfffff, 0xffffffff, 0x7df, 0x1ffff, 0xffffffff, 0x7fffffff, 0xfffffffd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1effffff, 0xffffffff, 0x3fffffff, 0xffff000f, 0xff, 0x0, 0x0, 0x0, 0xf8000000, 0xffffffff, 0xffffffff, 0xffe1, 0x0, 0xffffffff, 0xffffffff, 0x3f, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//4576 bytes -+enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)([ 0x0, 0x40, 0x170], [ 0x100, 0x260, 0x6100], [ 0x3020100, 0x7060504, 0xb0a0908, 0xe0d0c0a, 0x3030303, 0x100a0f03, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a11, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0xa0a0a0a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x20001, 0x30001, 0x50004, 0x70006, 0x90008, 0xb000a, 0xd000c, 0x1000e, 0x10000f, 0x10001, 0x120011, 0x140013, 0x160015, 0x180017, 0x190001, 0x1b001a, 0x1c0001, 0x1001d, 0x1e0001, 0x10001, 0x1f0001, 0x210020, 0x230022, 0x250024, 0x10026, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x270001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x280001, 0x10001, 0x10001, 0x10029, 0x2b002a, 0x2d002c, 0x2f002e, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x300001, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x10031, 0x330032, 0x340001, 0x360035, 0x380037, 0x3a0039, 0x31003b, 0x310031, 0x3d003c, 0x3f003e, 0x310040, 0x310041, 0x430042, 0x310031, 0x310031, 0x310044, 0x310031, 0x310031, 0x310031, 0x310031, 0x10001, 0x450001, 0x310046, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x10001, 0x10001, 0x310047, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x10001, 0x310048, 0x310031, 0x490031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x31004a, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x4c004b, 0x4e004d, 0x50004f, 0x520051, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310053, 0x550054, 0x570056, 0x590058, 0x5b005a, 0x310031, 0x310031, 0x310031, 0x310031, 0x10001, 0x10001, 0x10001, 0x1005c, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x10001, 0x5d0001, 0x31005e, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x10001, 0x31005e, 0x310031, 0x310031, 0x5f0031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x310031, 0x0, 0xffffffff, 0xffffffff, 0x7fffffff, 0x0, 0xffffdfff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7cffffff, 0xffffd7f0, 0xfffffffb, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffe00ff, 0xfe7fffff, 0xfffffffe, 0xfffe86ff, 0xffffffff, 0xffff00ff, 0x1f07ff, 0xcfffffc0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xdfffffff, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffe7ff, 0xffffffff, 0xffffffff, 0x3ffff, 0xffffffff, 0x7ffffff, 0xffffffff, 0x7fff3fff, 0x4fffffff, 0x0, 0x0, 0x1ffd, 0x0, 0x7ffffff0, 0xffffffff, 0xffffffff, 0xffffffff, 0xfeffffff, 0xfff99fee, 0xf3c5fdff, 0xb080799f, 0xfffffcf, 0xfff987ee, 0xd36dfdff, 0x5e023987, 0x3fffc0, 0xfffbbfee, 0xf3edfdff, 0x13bbf, 0x3ffcf, 0xfff99fee, 0xf3edfdff, 0xb0c0399f, 0xffffcf, 0xd63dc7ec, 0xc3ffc718, 0x813dc7, 0x7ffffc0, 0xfffddfee, 0xe3effdff, 0x3603ddf, 0xff00ffcf, 0xfffddfec, 0xf3effdff, 0x40603ddf, 0x6ffcf, 0xfffddfec, 0xe7ffffff, 0x807ddf, 0xfe3fffcf, 0xfc7fffec, 0x2ffbffff, 0xff5f847f, 0x1c0000, 0xfffffffe, 0x87ffffff, 0xfffffff, 0x0, 0xfef02596, 0x3bffecae, 0xf3ff3f5f, 0x0, 0xffffffff, 0xffffffff, 0xfffffeff, 0xfffe1fff, 0xfeffffff, 0xdfffffff, 0x7ffdfff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff20bf, 0xffffffff, 0xffffffff, 0xffffffff, 0x3d7f3dff, 0xffffffff, 0xffff3dff, 0x7f3dffff, 0xff7fff3d, 0xffffffff, 0xff3dffff, 0xffffffff, 0xe7ffffff, 0x1fffffff, 0x3ffffff, 0xffffffff, 0xffffffff, 0x1fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0xffffffff, 0xffffffff, 0x1ffff, 0x1fdfff, 0x7fffff, 0xfffff, 0xddfff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x3ff03ff, 0x3ff3fff, 0xffffffff, 0xffffffff, 0xffffff, 0xffffffff, 0xffff07ff, 0xffffffff, 0x3fffff, 0x1fffffff, 0xfff0fff, 0xfffffff1, 0x1f3fff, 0xffffffff, 0xffff0fff, 0xc7ff03ff, 0xffffffff, 0xcfffffff, 0xffffffff, 0x7fffffff, 0x9fffffff, 0x3ff03ff, 0x3fff, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffff0fff, 0x1fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf00fffff, 0xffffffff, 0xf8ffffff, 0xffffe3ff, 0xffffffff, 0x0, 0x0, 0xffff00ff, 0x7fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf000007f, 0x3f3fffff, 0xffffffff, 0xaaff3f3f, 0x3fffffff, 0xffffffff, 0xffdfffff, 0xefcfffdf, 0x7fdcffff, 0xffff07ff, 0xffff80ff, 0xffffffff, 0xfff30000, 0x1fff7fff, 0x7ffffff, 0xffff0000, 0x1ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff03ff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff, 0xffffffff, 0x7f, 0x7ff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3ff1fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffff7fff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfe0fffff, 0xffffffff, 0xffff20bf, 0xffffffff, 0x800180ff, 0x7fffff, 0x7f7f7f7f, 0x7f7f7f7f, 0xffffffff, 0xffffffff, 0xfffffff, 0x0, 0x0, 0xfbffffff, 0xffffffff, 0xffffffff, 0xfffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0xfff0000, 0xffffffff, 0xffffffff, 0xfffffffe, 0xffffffff, 0xfe7fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffe0, 0xfffe3fff, 0xffffffff, 0xffffffff, 0xffff7fff, 0x7ffffff, 0xffffffff, 0xffff000f, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff1fff, 0xffffffff, 0xffff007f, 0xffffffff, 0xffffffff, 0xfff, 0xffffffff, 0xffffffff, 0x80ffffff, 0xffffffff, 0xffffffff, 0xffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf7fff, 0x7ff, 0x0, 0xff000000, 0xffffffff, 0x3ff0fff, 0xffffffff, 0xffffff, 0xffffffff, 0xffffffff, 0x3ffc01f, 0xfffffff, 0xffffffff, 0xffffffff, 0x800fffff, 0x1fffffff, 0xffffffff, 0xffffffff, 0xc3ffbfff, 0x0, 0xffffffff, 0x7fffff, 0xf3ff3fff, 0xfffffff, 0xffffffff, 0xffffffff, 0xf8000007, 0x7fffff, 0x7e7e7e, 0x7f7f, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x3ff3fff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff000f, 0xfffff87f, 0xfffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff3fff, 0xffffffff, 0xffffffff, 0x3ffffff, 0x0, 0xe0f8007f, 0x5f7fffff, 0xffffffdb, 0xffffffff, 0xffffffff, 0xffffffff, 0xfff80003, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0000, 0xffffffff, 0xfffcffff, 0xffffffff, 0xff, 0x3fff0000, 0x3ffffff, 0xffff007f, 0xfff7ffff, 0xffdf0f7f, 0xffffffff, 0xffffffff, 0xffffffff, 0x1fffffff, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffffff, 0x1cfcfcfc, 0x30007f7f, 0xffffefff, 0xb7ffff7f, 0x3fff3fff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7ffffff, 0xffffff87, 0xff8fffff, 0xffffffff, 0xffffffff, 0xfff07ff, 0x0, 0xffff0000, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x1fffffff, 0xffffffff, 0x1ffff, 0x0, 0x7fffffff, 0xffff000f, 0x7ff, 0x0, 0xbfffffff, 0xffffffff, 0x3fff0f, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x3ff, 0x0, 0x0, 0xfffffd3f, 0x91bfffff, 0xffbfffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8fffffff, 0x83ffffff, 0x0, 0x0, 0xffffffff, 0xc0ffffff, 0x0, 0x0, 0xfeeff06f, 0x870fffff, 0x1ff00ff, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xfe3fffff, 0xff3fffff, 0xff07ffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x1ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xfffc3fff, 0xffff, 0xffffffff, 0xdfffffff, 0xffff0003, 0x3ff01ff, 0xffffffff, 0xffdfffff, 0xf, 0x0, 0xffffffff, 0xffffffff, 0x3ff01ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffff, 0x3ff, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xf0007, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0x1ffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffff001f, 0x7fffffff, 0xffff8000, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffff, 0xffffffff, 0xfffffe7f, 0xffffffff, 0xf807ffff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x0, 0xffffffff, 0xffffffff, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0x7fffff, 0x3ffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffdfffff, 0xffffffff, 0xdfffffff, 0xebffde64, 0xffffffef, 0xffffffff, 0xdfdfe7bf, 0x7bffffff, 0xfffdfc5f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff3f, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffcfff, 0xffffffff, 0xffffffef, 0xaf7fe96, 0xaa96ea84, 0x5ef7f796, 0xffffbff, 0xffffbee, 0x0, 0x30000, 0xffffffff, 0xffff0fff, 0xffffffff, 0xffffffff, 0xfffff, 0x7ffe7fff, 0xfffefffe, 0x0, 0xffff07ff, 0xffff7fff, 0xffffffff, 0xffff0fff, 0x7ffffff, 0x0, 0x0, 0xffffffc0, 0xffff0007, 0x7ffffff, 0x301ff, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffbf0001, 0xffffffff, 0x1fffffff, 0xfffff, 0xffffffff, 0x7df, 0x1ffff, 0xffffffff, 0x7fffffff, 0xfffffffd, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1effffff, 0xffffffff, 0x3fffffff, 0xffff000f, 0xff, 0x0, 0x0, 0x0, 0xf8000000, 0xffffffff, 0xffffffff, 0xffe1, 0x0, 0xffffffff, 0xffffffff, 0x3f, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x7fffff, 0x0, 0xffffffff, 0x1fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3fffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]); -+//3664 bytes -+enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)([ 0x0, 0x20, 0x98, 0x208], [ 0x80, 0xf0, 0x2e0, 0x3180], [ 0x3020100, 0x7060504, 0xa090808, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0b, 0xb0b0b0c, 0xd080808, 0xd080808, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xb000a, 0xd000c, 0xd000d, 0xd000d, 0xe000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xf000d, 0x10000d, 0xd0011, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0x12000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0x140013, 0x160015, 0x180017, 0x1a0019, 0x1b001b, 0x1d001c, 0x1b001b, 0x1e000d, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x20001f, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b0021, 0x1b001b, 0x1b001b, 0x1b001b, 0x230022, 0x1b001b, 0x1b001b, 0x24001b, 0x260025, 0x1b001b, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0x27000d, 0xd000d, 0x28000d, 0x1b0029, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b002a, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b002b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0x1b001b, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0x2c000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0xd000d, 0x2c000d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10000, 0x2, 0x0, 0x0, 0x40003, 0x60005, 0x7, 0x0, 0x90008, 0xb000a, 0xd000c, 0xf000e, 0x100000, 0x120011, 0x140013, 0x160015, 0x180017, 0x1a0019, 0x1c001b, 0x1e001d, 0x20001f, 0x220021, 0x240023, 0x260025, 0x270000, 0x290028, 0x0, 0x2a0000, 0x0, 0x0, 0x2b0000, 0x2d002c, 0x2f002e, 0x310030, 0x0, 0x0, 0x0, 0x0, 0x0, 0x330032, 0x350034, 0x360000, 0x380037, 0x3a0039, 0x3c003b, 0x3e003d, 0x40003f, 0x420041, 0x430000, 0x440000, 0x460045, 0x470042, 0x0, 0x480000, 0x0, 0x0, 0x4a0049, 0x4c004b, 0x4d0000, 0x4f004e, 0x0, 0x50, 0x0, 0x0, 0x0, 0x510000, 0x530052, 0x0, 0x0, 0x0, 0x0, 0x0, 0x54, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x550000, 0x420042, 0x570056, 0x580000, 0x5a0059, 0x5c005b, 0x42005d, 0x51005e, 0x0, 0x5f0000, 0x540000, 0x60, 0x61, 0x630062, 0x57, 0x640000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x650000, 0x0, 0x670066, 0x0, 0x0, 0x68, 0x380069, 0x0, 0x6b006a, 0x38006c, 0x6d0000, 0x6e0000, 0x6f0000, 0x710070, 0x720000, 0x420073, 0x740042, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x750063, 0x0, 0x0, 0x0, 0x0, 0x760000, 0x770000, 0x790078, 0x7a0000, 0x0, 0x0, 0x7b0000, 0x7d007c, 0x7f007e, 0x800000, 0x54, 0x810064, 0x830082, 0xb0000, 0x84, 0x860085, 0x420042, 0x870032, 0x890088, 0x8b008a, 0x0, 0x42008c, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x8e008d, 0x420042, 0x42008f, 0x420090, 0x920091, 0x420042, 0x940093, 0x420042, 0x950000, 0x420042, 0x420042, 0x420042, 0x960042, 0x420042, 0x420042, 0x420042, 0x970000, 0x980000, 0x99004b, 0x9a0000, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x9b0038, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9c0000, 0x420042, 0x9d0000, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x42009c, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x0, 0x0, 0x0, 0x0, 0x42009e, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x9f0000, 0x4200a0, 0x4200a1, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x0, 0x3a0000, 0xa2, 0xa30000, 0xa40000, 0x420042, 0xa50000, 0x420042, 0xa60000, 0xa800a7, 0xaa00a9, 0x0, 0x0, 0xab, 0x0, 0xac0000, 0x420042, 0x420042, 0x420042, 0x420042, 0xae00ad, 0xb000af, 0x420042, 0x420042, 0x3d, 0xb200b1, 0x3d00b3, 0xb500b4, 0xb700b6, 0x420042, 0xb900b8, 0xbb00ba, 0xbc0064, 0xbd0000, 0xbf00be, 0xc00042, 0xc10000, 0xa40000, 0x510000, 0x420042, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc20000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x31, 0x0, 0x4200a3, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x420042, 0x0, 0x0, 0x0, 0x0, 0x4200a3, 0x420042, 0x420042, 0x420042, 0xc3, 0x420042, 0x0, 0xc40000, 0x420042, 0x420042, 0x420042, 0x420042, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbe0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbe0000, 0x0, 0x0, 0x0, 0x83000000, 0x280f, 0x4, 0x0, 0x1ff00, 0x1800000, 0x1, 0x17900, 0x0, 0xff00, 0xffe0f800, 0x20000020, 0x0, 0x4000, 0x0, 0x1800, 0x0, 0x0, 0xfffc0000, 0x0, 0xf8000000, 0x0, 0x8000c000, 0xb0000000, 0xffffffff, 0xffffffff, 0xffffe002, 0xffffffff, 0x8000000f, 0x0, 0x1000000, 0x66011, 0xc3a0200, 0x4f7f8660, 0xf0000030, 0x67811, 0x2c920200, 0xa1fdc678, 0xffc0003f, 0x44011, 0xc120200, 0xfffec440, 0xfffc0030, 0x66011, 0xc120200, 0x4f3fc660, 0xff000030, 0x29c23813, 0x3c0038e7, 0xff7ec238, 0xf800003f, 0x22011, 0x1c100200, 0xfc9fc220, 0xff0030, 0x22013, 0xc100200, 0xbf9fc220, 0xfff90030, 0x22013, 0x18000000, 0xff7f8220, 0x1c00030, 0x3800013, 0xd0040000, 0xa07b80, 0xffe3ffff, 0x1, 0x78000000, 0xf0000000, 0xffffffff, 0x10fda69, 0xc4001351, 0xc00c0a0, 0xffffffff, 0x100, 0x1e000, 0x1000000, 0x20000000, 0xf8002000, 0xffffffff, 0xdf40, 0x0, 0xc280c200, 0x0, 0xc200, 0x80c20000, 0x8000c2, 0x0, 0xc20000, 0x0, 0x18000000, 0xe0000000, 0xfc000000, 0x0, 0x0, 0xffe00000, 0xe0000000, 0x0, 0x0, 0xfffe0000, 0xffe02000, 0xff800000, 0xfff00000, 0xfff22000, 0xc0000000, 0xfc00fc00, 0xfc008000, 0x0, 0x0, 0xff000000, 0x0, 0xf800, 0x0, 0xffc00000, 0xe0000000, 0xf000f000, 0xe, 0xffe0c000, 0x0, 0xf000, 0x3800fc00, 0x0, 0x30000000, 0x0, 0x80000000, 0x60000000, 0xfc00fc00, 0xffffc000, 0xffffffff, 0xffffffff, 0xf000, 0xe0000000, 0x0, 0xff00000, 0x0, 0x7000000, 0x1c00, 0x0, 0xff00, 0xff800000, 0x0, 0xfffff80, 0xc0c00000, 0x0, 0x5500c0c0, 0xc0000000, 0x0, 0x200000, 0x10300020, 0x80230000, 0x0, 0xc0020, 0xe0008000, 0xf8000000, 0xffff, 0xfffe0000, 0xfc00, 0x0, 0x0, 0xfff00000, 0x0, 0xffffff80, 0xfffff800, 0x0, 0x1, 0x0, 0xfc00e000, 0xffffffff, 0x0, 0x8000, 0x80000000, 0x0, 0x0, 0x1f00000, 0x0, 0xdf40, 0x0, 0x7ffe7f00, 0xff800000, 0x80808080, 0x80808080, 0x0, 0x0, 0xf0000000, 0x4000000, 0x0, 0xffc00000, 0xf000ffff, 0x1800000, 0x0, 0x1f, 0x1c000, 0x8000, 0xf8000000, 0x0, 0xfff0, 0x0, 0x80000000, 0xffffe000, 0xffffffff, 0xe000, 0x0, 0xff80, 0x0, 0x0, 0xfffff000, 0x7f000000, 0x0, 0xfff08000, 0xfffff800, 0xffffffff, 0xffffff, 0x0, 0xfc00f000, 0xfc003fe0, 0xf0000000, 0x7ff00000, 0xe0000000, 0x3c004000, 0xffffffff, 0x0, 0xff800000, 0xc00c000, 0xf0000000, 0x7fffff8, 0xff800000, 0xff818181, 0xffff8080, 0x0, 0xfc00c000, 0x780, 0xf0000000, 0x0, 0xc000, 0xfc000000, 0xffffffff, 0x1f07ff80, 0xa0800000, 0x24, 0x0, 0x7fffc, 0x0, 0xffff, 0x0, 0x30000, 0x0, 0xffffff00, 0xc000ffff, 0xfc000000, 0xff80, 0x80000, 0x20f080, 0x0, 0x60000000, 0xe3030303, 0xc1ff8080, 0x1000, 0x48000080, 0xc000c000, 0xffffffff, 0x78, 0x700000, 0xf000f800, 0xffffffff, 0xffff, 0xc0000000, 0xfffe0000, 0xffffffff, 0x80000000, 0xfff0, 0xfffff800, 0xffffffff, 0x40000000, 0x0, 0xffc000f0, 0xffffffff, 0xc0000000, 0xfffffc00, 0x2c0, 0x6e400000, 0x400000, 0xffffffff, 0x70000000, 0x7c000000, 0x0, 0x3f000000, 0x1100f90, 0x78f00000, 0xfe00ff00, 0x0, 0x0, 0x1c00000, 0xc00000, 0xf80000, 0xfffffe00, 0xffffffff, 0xffffffff, 0x80000000, 0x3c000, 0xffff0000, 0xfffc, 0xfc00fe00, 0xfffffff0, 0xffffffff, 0xfc00fe00, 0xffffffff, 0xfffffc00, 0xffffffff, 0x0, 0xffff8000, 0x0, 0xfff0fff8, 0x0, 0xfe000000, 0xffe0, 0x80000000, 0x7fff, 0xffffffff, 0xfffffffc, 0xffffffff, 0x0, 0x180, 0xc0000000, 0xffffffff, 0xffffffc0, 0xffffffff, 0xff800000, 0xfffc0000, 0x200000, 0x0, 0x20000000, 0x1400219b, 0x10, 0x0, 0x20201840, 0x84000000, 0x203a0, 0x0, 0x0, 0xc0, 0x3000, 0x0, 0x10, 0xf5080169, 0x5569157b, 0xa1080869, 0xf0000400, 0xf0000411, 0xffffffff, 0xfffcffff, 0xfff00000, 0x80018000, 0x10001, 0xffffffff, 0xf800, 0x8000, 0xf8000000, 0xffffffff, 0xffffffff, 0x3f, 0xfff8, 0xf8000000, 0xfffcfe00, 0xffffffff, 0x0, 0x40fffe, 0x0, 0xe0000000, 0xfff00000, 0x0, 0xfffff820, 0xfffe0000, 0x2, 0x0, 0x0, 0xe1000000, 0x0, 0xc0000000, 0xfff0, 0xffffff00, 0xffffffff, 0x7ffffff, 0xffff001e, 0xffffffff, 0xff800000, 0xffffffff, 0xfffffffd, 0x0, 0x0, 0xffff0000, 0x0, 0xc0000000]); -+enum MAX_SIMPLE_LOWER = 1043; -+enum MAX_SIMPLE_UPPER = 1051; -+enum MAX_SIMPLE_TITLE = 1055; -+//8192 bytes -+enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x200], [ 0x100, 0x380, 0xc00], [ 0x2020100, 0x4020302, 0x2020205, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xa, 0xb0000, 0xd000c, 0xf000e, 0x110010, 0x130012, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x150000, 0x0, 0x170016, 0x190018, 0x1b001a, 0x1d001c, 0x0, 0x0, 0x1e0000, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x220021, 0x240023, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x260000, 0x27, 0x290028, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2e002d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x20001, 0x40003, 0x60005, 0x80007, 0xa0009, 0xc000b, 0xe000d, 0x10000f, 0x120011, 0x140013, 0x160015, 0x180017, 0xffff0019, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1affff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x41bffff, 0x1c001b, 0x1e001d, 0x20001f, 0x220021, 0x240023, 0x260025, 0x280027, 0x2a0029, 0x2c002b, 0x2e002d, 0x30002f, 0xffff0031, 0x330032, 0x350034, 0x370036, 0x390038, 0x3affff, 0x3bffff, 0x3cffff, 0x3dffff, 0x3effff, 0x3fffff, 0x40ffff, 0x41ffff, 0x42ffff, 0x43ffff, 0x44ffff, 0x45ffff, 0x46ffff, 0x47ffff, 0x48ffff, 0x49ffff, 0x4affff, 0x4bffff, 0x4cffff, 0x4dffff, 0x4effff, 0x4fffff, 0x50ffff, 0x51ffff, 0x52041d, 0x53ffff, 0x54ffff, 0x55ffff, 0xffffffff, 0xffff0056, 0xffff0057, 0xffff0058, 0xffff0059, 0xffff005a, 0xffff005b, 0xffff005c, 0x43a005d, 0x5effff, 0x5fffff, 0x60ffff, 0x61ffff, 0x62ffff, 0x63ffff, 0x64ffff, 0x65ffff, 0x66ffff, 0x67ffff, 0x68ffff, 0x69ffff, 0x6affff, 0x6bffff, 0x6cffff, 0x6dffff, 0x6effff, 0x6fffff, 0x70ffff, 0x71ffff, 0x72ffff, 0x73ffff, 0x74ffff, 0xffffffff, 0xffff0075, 0xffff0076, 0x780077, 0xffff0079, 0x7affff, 0x7bffff, 0xffffffff, 0xffff007c, 0xffffffff, 0xffff007d, 0xffffffff, 0xffffffff, 0xffff007e, 0x7fffff, 0xffffffff, 0x80ffff, 0xffff0081, 0xffffffff, 0xffff0082, 0x83ffff, 0x84ffff, 0x85ffff, 0xffffffff, 0xffff0086, 0xffffffff, 0x87ffff, 0xffffffff, 0xffff0088, 0xffffffff, 0xffff0089, 0xffff008a, 0x8bffff, 0xffffffff, 0x8cffff, 0x8dffff, 0xffffffff, 0xffffffff, 0x8effff, 0xffff008f, 0x910090, 0x92ffff, 0xffff0093, 0xffff0094, 0xffff0095, 0xffff0096, 0xffff0097, 0xffff0098, 0xffff0099, 0xffff009a, 0x9c009b, 0x9dffff, 0x9effff, 0x9fffff, 0xa0ffff, 0xa1ffff, 0xa2ffff, 0xa3ffff, 0xa4ffff, 0xa5ffff, 0xffff0442, 0xa700a6, 0xa8ffff, 0xffffffff, 0xa9ffff, 0xaaffff, 0xabffff, 0xacffff, 0xadffff, 0xaeffff, 0xafffff, 0xb0ffff, 0xb1ffff, 0xb2ffff, 0xb3ffff, 0xb4ffff, 0xb5ffff, 0xb6ffff, 0xb7ffff, 0xb8ffff, 0xb9ffff, 0xbaffff, 0xbbffff, 0xbcffff, 0xffffffff, 0xbdffff, 0xbeffff, 0xbfffff, 0xc0ffff, 0xc1ffff, 0xc2ffff, 0xc3ffff, 0xc4ffff, 0xc5ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff00c6, 0xc7ffff, 0xffff00c8, 0xffff00c9, 0xffffffff, 0xcaffff, 0xcbffff, 0xccffff, 0xcdffff, 0xceffff, 0xd000cf, 0xd200d1, 0xffff00d3, 0xd500d4, 0xd6ffff, 0xd7ffff, 0xffffffff, 0xffffffff, 0xffff00d8, 0xd9ffff, 0xdaffff, 0xffff00db, 0xdd00dc, 0xdeffff, 0xffffffff, 0xdfffff, 0xe0ffff, 0xffff00e1, 0xe2ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xe3ffff, 0xffffffff, 0xffff00e4, 0xe5ffff, 0xffffffff, 0xffffffff, 0xe700e6, 0xe900e8, 0xffff00ea, 0xffffffff, 0xffffffff, 0xffff00eb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xecffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xedffff, 0xeeffff, 0xffffffff, 0xefffff, 0xffffffff, 0xf0ffff, 0xf200f1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff043c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf400f3, 0xf600f5, 0xf7043f, 0xf900f8, 0xfb00fa, 0xfd00fc, 0xff00fe, 0x1010100, 0x1030102, 0x1050104, 0x1070106, 0x1090108, 0x10b010a, 0x10d010c, 0x10f010e, 0x1110110, 0x1130112, 0xffff0114, 0x1160115, 0xffffffff, 0x117ffff, 0x1190118, 0x11affff, 0x11bffff, 0x11cffff, 0x11dffff, 0x11effff, 0x11fffff, 0x120ffff, 0x121ffff, 0x122ffff, 0x123ffff, 0x124ffff, 0x125ffff, 0x1270126, 0xffff0128, 0x129ffff, 0xffffffff, 0xffff012a, 0x12bffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x12d012c, 0x12f012e, 0x1310130, 0x1330132, 0x1350134, 0x1370136, 0x1390138, 0x13b013a, 0x13d013c, 0x13f013e, 0x1410140, 0x1430142, 0x1450144, 0x1470146, 0x1490148, 0x14b014a, 0x14d014c, 0x14f014e, 0x1510150, 0x1530152, 0x1550154, 0x1570156, 0x1590158, 0x15b015a, 0x15cffff, 0x15dffff, 0x15effff, 0x15fffff, 0x160ffff, 0x161ffff, 0x162ffff, 0x163ffff, 0x164ffff, 0x165ffff, 0x166ffff, 0x167ffff, 0x168ffff, 0x169ffff, 0x16affff, 0x16bffff, 0x16cffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x16dffff, 0x16effff, 0x16fffff, 0x170ffff, 0x171ffff, 0x172ffff, 0x173ffff, 0x174ffff, 0x175ffff, 0x176ffff, 0x177ffff, 0x178ffff, 0x179ffff, 0x17affff, 0x17bffff, 0x17cffff, 0x17dffff, 0x17effff, 0x17fffff, 0x180ffff, 0x181ffff, 0x182ffff, 0x183ffff, 0x184ffff, 0x185ffff, 0x186ffff, 0x187ffff, 0xffffffff, 0xffff0188, 0xffff0189, 0xffff018a, 0xffff018b, 0xffff018c, 0xffff018d, 0x18f018e, 0x190ffff, 0x191ffff, 0x192ffff, 0x193ffff, 0x194ffff, 0x195ffff, 0x196ffff, 0x197ffff, 0x198ffff, 0x199ffff, 0x19affff, 0x19bffff, 0x19cffff, 0x19dffff, 0x19effff, 0x19fffff, 0x1a0ffff, 0x1a1ffff, 0x1a2ffff, 0x1a3ffff, 0x1a4ffff, 0x1a5ffff, 0x1a6ffff, 0x1a7ffff, 0x1a8ffff, 0x1a9ffff, 0x1aaffff, 0x1abffff, 0x1acffff, 0x1adffff, 0x1aeffff, 0x1afffff, 0x1b0ffff, 0x1b1ffff, 0x1b2ffff, 0x1b3ffff, 0x1b4ffff, 0x1b5ffff, 0x1b6ffff, 0x1b7ffff, 0x1b8ffff, 0x1b9ffff, 0x1baffff, 0x1bbffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1bcffff, 0x1be01bd, 0x1c001bf, 0x1c201c1, 0x1c401c3, 0x1c601c5, 0x1c801c7, 0x1ca01c9, 0x1cc01cb, 0x1ce01cd, 0x1d001cf, 0x1d201d1, 0x1d401d3, 0x1d601d5, 0x1d801d7, 0x1da01d9, 0x1dc01db, 0x1de01dd, 0x1e001df, 0x42e01e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1e2ffff, 0xffffffff, 0x1e3ffff, 0xffffffff, 0x1e4ffff, 0x1e5ffff, 0x1e6ffff, 0x1e7ffff, 0x1e8ffff, 0x1e9ffff, 0x1eaffff, 0x1ebffff, 0x1ecffff, 0x1edffff, 0x1eeffff, 0x1efffff, 0x1f0ffff, 0x1f1ffff, 0x1f2ffff, 0x1f3ffff, 0x1f4ffff, 0x1f5ffff, 0x1f6ffff, 0x1f7ffff, 0x1f8ffff, 0x1f9ffff, 0x1faffff, 0x1fbffff, 0x1fcffff, 0x1fdffff, 0x1feffff, 0x1ffffff, 0x200ffff, 0x201ffff, 0x202ffff, 0x203ffff, 0x204ffff, 0x205ffff, 0x206ffff, 0x207ffff, 0x208ffff, 0x209ffff, 0x20affff, 0x20bffff, 0x20cffff, 0x20dffff, 0x20effff, 0x20fffff, 0x210ffff, 0x211ffff, 0x212ffff, 0x213ffff, 0x214ffff, 0x215ffff, 0x216ffff, 0x217ffff, 0x218ffff, 0x219ffff, 0x21affff, 0x21bffff, 0x21cffff, 0x21dffff, 0x21effff, 0x21fffff, 0x220ffff, 0x221ffff, 0x222ffff, 0x223ffff, 0x224ffff, 0x225ffff, 0x226ffff, 0x227ffff, 0x228ffff, 0x229ffff, 0x22affff, 0x22bffff, 0x22cffff, 0x22dffff, 0x22effff, 0x4460444, 0x44a0448, 0x22f044c, 0xffffffff, 0xffffffff, 0x230ffff, 0x231ffff, 0x232ffff, 0x233ffff, 0x234ffff, 0x235ffff, 0x236ffff, 0x237ffff, 0x238ffff, 0x239ffff, 0x23affff, 0x23bffff, 0x23cffff, 0x23dffff, 0x23effff, 0x23fffff, 0x240ffff, 0x241ffff, 0x242ffff, 0x243ffff, 0x244ffff, 0x245ffff, 0x246ffff, 0x247ffff, 0x248ffff, 0x249ffff, 0x24affff, 0x24bffff, 0x24cffff, 0x24dffff, 0x24effff, 0x24fffff, 0x250ffff, 0x251ffff, 0x252ffff, 0x253ffff, 0x254ffff, 0x255ffff, 0x256ffff, 0x257ffff, 0x258ffff, 0x259ffff, 0x25affff, 0x25bffff, 0x25cffff, 0x25dffff, 0x25effff, 0x25fffff, 0x2610260, 0x2630262, 0x2650264, 0x2670266, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2690268, 0x26b026a, 0x26d026c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x26f026e, 0x2710270, 0x2730272, 0x2750274, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2770276, 0x2790278, 0x27b027a, 0x27d027c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x27f027e, 0x2810280, 0x2830282, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x284044e, 0x2850450, 0x2860453, 0x2870456, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2890288, 0x28b028a, 0x28d028c, 0x28f028e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2910290, 0x2930292, 0x2950294, 0x2970296, 0x2990298, 0x29b029a, 0x29d029c, 0xffffffff, 0x4790477, 0x47d047b, 0x481047f, 0x4850483, 0x4890487, 0x48d048b, 0x491048f, 0x4950493, 0x4990497, 0x49d049b, 0x4a1049f, 0x4a504a3, 0x4a904a7, 0x4ad04ab, 0x4b104af, 0x4b504b3, 0x4b904b7, 0x4bd04bb, 0x4c104bf, 0x4c504c3, 0x4c904c7, 0x4cd04cb, 0x4d104cf, 0x4d504d3, 0x2b702b6, 0x4d704e3, 0xffff04e5, 0x4ef0459, 0xffffffff, 0xffffffff, 0xffff04d9, 0xffff02b9, 0xffffffff, 0x4db04e7, 0xffff04e9, 0x4f2045b, 0xffffffff, 0xffffffff, 0xffff04dd, 0xffffffff, 0x2bc02bb, 0x460045d, 0xffffffff, 0x4650463, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2be02bd, 0x46b0468, 0x2bf046e, 0x4720470, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4df04eb, 0xffff04ed, 0x4f50475, 0xffffffff, 0xffffffff, 0xffff04e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff02c1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2c302c2, 0x2c502c4, 0x2c702c6, 0x2c902c8, 0x2cb02ca, 0x2cd02cc, 0x2cf02ce, 0x2d102d0, 0xffffffff, 0xffffffff, 0xffff02d2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2d402d3, 0x2d602d5, 0x2d802d7, 0x2da02d9, 0x2dc02db, 0x2de02dd, 0x2e002df, 0x2e202e1, 0x2e402e3, 0x2e602e5, 0x2e802e7, 0x2ea02e9, 0x2ec02eb, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2ee02ed, 0x2f002ef, 0x2f202f1, 0x2f402f3, 0x2f602f5, 0x2f802f7, 0x2fa02f9, 0x2fc02fb, 0x2fe02fd, 0x30002ff, 0x3020301, 0x3040303, 0x3060305, 0x3080307, 0x30a0309, 0x30c030b, 0x30e030d, 0x310030f, 0x3120311, 0x3140313, 0x3160315, 0x3180317, 0x31a0319, 0xffff031b, 0x31cffff, 0xffffffff, 0x31dffff, 0xffff031e, 0xffff031f, 0xffff0320, 0xffff0321, 0xffffffff, 0xffffffff, 0x322ffff, 0xffffffff, 0xffff0323, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x324ffff, 0x325ffff, 0x326ffff, 0x327ffff, 0x328ffff, 0x329ffff, 0x32affff, 0x32bffff, 0x32cffff, 0x32dffff, 0x32effff, 0x32fffff, 0x330ffff, 0x331ffff, 0x332ffff, 0x333ffff, 0x334ffff, 0x335ffff, 0x336ffff, 0x337ffff, 0x338ffff, 0x339ffff, 0x33affff, 0x33bffff, 0x33cffff, 0x33dffff, 0x33effff, 0x33fffff, 0x340ffff, 0x341ffff, 0x342ffff, 0x343ffff, 0x344ffff, 0x345ffff, 0x346ffff, 0x347ffff, 0x348ffff, 0x349ffff, 0x34affff, 0x34bffff, 0x34cffff, 0x34dffff, 0x34effff, 0x34fffff, 0x350ffff, 0x351ffff, 0x352ffff, 0x353ffff, 0x354ffff, 0x355ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0356, 0xffff0357, 0xffffffff, 0x358ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x35a0359, 0x35c035b, 0x35e035d, 0x360035f, 0x3620361, 0x3640363, 0x3660365, 0x3680367, 0x36a0369, 0x36c036b, 0x36e036d, 0x370036f, 0x3720371, 0x3740373, 0x3760375, 0x3780377, 0x37a0379, 0x37c037b, 0x37e037d, 0x37fffff, 0xffffffff, 0xffffffff, 0x380ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x381ffff, 0x382ffff, 0x383ffff, 0x384ffff, 0x385ffff, 0x386ffff, 0x387ffff, 0x388ffff, 0x389ffff, 0x38affff, 0x38bffff, 0x38cffff, 0x38dffff, 0x38effff, 0x38fffff, 0x390ffff, 0x391ffff, 0x392ffff, 0x393ffff, 0x394ffff, 0x395ffff, 0x396ffff, 0x397ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x398ffff, 0x399ffff, 0x39affff, 0x39bffff, 0x39cffff, 0x39dffff, 0x39effff, 0x39fffff, 0x3a0ffff, 0x3a1ffff, 0x3a2ffff, 0x3a3ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3a4ffff, 0x3a5ffff, 0x3a6ffff, 0x3a7ffff, 0x3a8ffff, 0x3a9ffff, 0x3aaffff, 0xffffffff, 0x3abffff, 0x3acffff, 0x3adffff, 0x3aeffff, 0x3afffff, 0x3b0ffff, 0x3b1ffff, 0x3b2ffff, 0x3b3ffff, 0x3b4ffff, 0x3b5ffff, 0x3b6ffff, 0x3b7ffff, 0x3b8ffff, 0x3b9ffff, 0x3baffff, 0x3bbffff, 0x3bcffff, 0x3bdffff, 0x3beffff, 0x3bfffff, 0x3c0ffff, 0x3c1ffff, 0x3c2ffff, 0x3c3ffff, 0x3c4ffff, 0x3c5ffff, 0x3c6ffff, 0x3c7ffff, 0x3c8ffff, 0x3c9ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff03ca, 0xffff03cb, 0x3ccffff, 0x3cdffff, 0x3ceffff, 0x3cfffff, 0x3d0ffff, 0xffffffff, 0xffffffff, 0xffff03d1, 0xffffffff, 0x3d2ffff, 0x3d3ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3d4ffff, 0x3d5ffff, 0x3d6ffff, 0x3d7ffff, 0x3d8ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x420041e, 0x4240422, 0x42a0427, 0xffff042c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x430ffff, 0x4340432, 0x4380436, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3d9ffff, 0x3db03da, 0x3dd03dc, 0x3df03de, 0x3e103e0, 0x3e303e2, 0x3e503e4, 0x3e703e6, 0x3e903e8, 0x3eb03ea, 0x3ed03ec, 0x3ef03ee, 0x3f103f0, 0xffff03f2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3f403f3, 0x3f603f5, 0x3f803f7, 0x3fa03f9, 0x3fc03fb, 0x3fe03fd, 0x40003ff, 0x4020401, 0x4040403, 0x4060405, 0x4080407, 0x40a0409, 0x40c040b, 0x40e040d, 0x410040f, 0x4120411, 0x4140413, 0x4160415, 0x4180417, 0x41a0419, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+//8064 bytes -+enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x200], [ 0x100, 0x380, 0xbc0], [ 0x2020100, 0x4020302, 0x2020205, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x10000, 0x20000, 0x40003, 0x60005, 0x80007, 0x0, 0x90000, 0xb000a, 0xd000c, 0xf000e, 0x110010, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x140013, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160015, 0x180017, 0x1a0019, 0x1c001b, 0x0, 0x0, 0x1e001d, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x210020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x230022, 0x250024, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x260000, 0x27, 0x290028, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x20001, 0x40003, 0x60005, 0x80007, 0xa0009, 0xc000b, 0xe000d, 0x10000f, 0x120011, 0x140013, 0x160015, 0x180017, 0xffff0019, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1b001a, 0x1d001c, 0x1f001e, 0x210020, 0x230022, 0x250024, 0x270026, 0x290028, 0x2b002a, 0x2d002c, 0x2f002e, 0xffff0030, 0x320031, 0x340033, 0x360035, 0x4130037, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0038, 0xffff0039, 0xffff003a, 0xffff003b, 0xffff003c, 0xffff003d, 0xffff003e, 0xffff003f, 0xffff0040, 0xffff0041, 0xffff0042, 0xffff0043, 0xffff0044, 0xffff0045, 0xffff0046, 0xffff0047, 0xffff0048, 0xffff0049, 0xffff004a, 0xffff004b, 0xffff004c, 0xffff004d, 0xffff004e, 0xffff004f, 0xffff0414, 0xffff0051, 0xffff0052, 0xffff0053, 0x54ffff, 0x55ffff, 0x56ffff, 0x57ffff, 0x58ffff, 0x59ffff, 0x5affff, 0x5bffff, 0x423ffff, 0xffff005c, 0xffff005d, 0xffff005e, 0xffff005f, 0xffff0060, 0xffff0061, 0xffff0062, 0xffff0063, 0xffff0064, 0xffff0065, 0xffff0066, 0xffff0067, 0xffff0068, 0xffff0069, 0xffff006a, 0xffff006b, 0xffff006c, 0xffff006d, 0xffff006e, 0xffff006f, 0xffff0070, 0xffff0071, 0xffff0072, 0x740073, 0x75ffff, 0x76ffff, 0xffffffff, 0x77ffff, 0xffff0078, 0xffff0079, 0x7b007a, 0x7cffff, 0x7e007d, 0xffffffff, 0x80007f, 0x820081, 0x83ffff, 0xffff0084, 0x860085, 0xffff0087, 0xffffffff, 0x890088, 0x8affff, 0xffff008b, 0xffff008c, 0xffff008d, 0x8f008e, 0x90ffff, 0xffffffff, 0xffff0091, 0x930092, 0x94ffff, 0x960095, 0x97ffff, 0x98ffff, 0xffff0099, 0xffffffff, 0xffff009a, 0xffffffff, 0xffffffff, 0xffffffff, 0x9c009b, 0x9dffff, 0xffff009e, 0xa0009f, 0xa1ffff, 0xa2ffff, 0xa3ffff, 0xa4ffff, 0xa5ffff, 0xa6ffff, 0xa7ffff, 0xa8ffff, 0xffffffff, 0xffff00a9, 0xffff00aa, 0xffff00ab, 0xffff00ac, 0xffff00ad, 0xffff00ae, 0xffff00af, 0xffff00b0, 0xffff00b1, 0xb20426, 0xffff00b3, 0xffff00b4, 0xb600b5, 0xffff00b7, 0xffff00b8, 0xffff00b9, 0xffff00ba, 0xffff00bb, 0xffff00bc, 0xffff00bd, 0xffff00be, 0xffff00bf, 0xffff00c0, 0xffff00c1, 0xffff00c2, 0xffff00c3, 0xffff00c4, 0xffff00c5, 0xffff00c6, 0xffff00c7, 0xffff00c8, 0xffff00c9, 0xffff00ca, 0xffff00cb, 0xffff00cc, 0xffff00cd, 0xffff00ce, 0xffff00cf, 0xffff00d0, 0xffff00d1, 0xffff00d2, 0xffff00d3, 0xffff00d4, 0xffffffff, 0xffffffff, 0xffffffff, 0xd600d5, 0xd7ffff, 0xffff00d8, 0xd9ffff, 0xdaffff, 0xdc00db, 0xffff00dd, 0xffff00de, 0xffff00df, 0xffff00e0, 0xffff00e1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff00e2, 0xffff00e3, 0xffffffff, 0xffff00e4, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff00e5, 0xe700e6, 0xffff00e8, 0xffff00e9, 0xeb00ea, 0xec0424, 0xee00ed, 0xf000ef, 0xf200f1, 0xf400f3, 0xf600f5, 0xf800f7, 0xfa00f9, 0xfc00fb, 0xfdffff, 0xff00fe, 0x1010100, 0x1030102, 0x1050104, 0xffffffff, 0xffffffff, 0xffff0425, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x106ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0107, 0xffff0108, 0xffff0109, 0xffff010a, 0xffff010b, 0xffff010c, 0xffff010d, 0xffff010e, 0xffff010f, 0xffff0110, 0xffff0111, 0xffff0112, 0xffffffff, 0xffffffff, 0xffff0113, 0x114ffff, 0x115ffff, 0xffff0116, 0x117ffff, 0x1190118, 0x11b011a, 0x11d011c, 0x11f011e, 0x1210120, 0x1230122, 0x1250124, 0x1270126, 0x1290128, 0x12b012a, 0x12d012c, 0x12f012e, 0x1310130, 0x1330132, 0x1350134, 0x1370136, 0x1390138, 0x13b013a, 0x13d013c, 0x13f013e, 0x1410140, 0x1430142, 0x1450144, 0x1470146, 0x1490148, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff014a, 0xffff014b, 0xffff014c, 0xffff014d, 0xffff014e, 0xffff014f, 0xffff0150, 0xffff0151, 0xffff0152, 0xffff0153, 0xffff0154, 0xffff0155, 0xffff0156, 0xffff0157, 0xffff0158, 0xffff0159, 0xffff015a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff015b, 0xffff015c, 0xffff015d, 0xffff015e, 0xffff015f, 0xffff0160, 0xffff0161, 0xffff0162, 0xffff0163, 0xffff0164, 0xffff0165, 0xffff0166, 0xffff0167, 0xffff0168, 0xffff0169, 0xffff016a, 0xffff016b, 0xffff016c, 0xffff016d, 0xffff016e, 0xffff016f, 0xffff0170, 0xffff0171, 0xffff0172, 0xffff0173, 0xffff0174, 0xffff0175, 0x1770176, 0x178ffff, 0x179ffff, 0x17affff, 0x17bffff, 0x17cffff, 0x17dffff, 0xffffffff, 0xffff017e, 0xffff017f, 0xffff0180, 0xffff0181, 0xffff0182, 0xffff0183, 0xffff0184, 0xffff0185, 0xffff0186, 0xffff0187, 0xffff0188, 0xffff0189, 0xffff018a, 0xffff018b, 0xffff018c, 0xffff018d, 0xffff018e, 0xffff018f, 0xffff0190, 0xffff0191, 0xffff0192, 0xffff0193, 0xffff0194, 0xffff0195, 0xffff0196, 0xffff0197, 0xffff0198, 0xffff0199, 0xffff019a, 0xffff019b, 0xffff019c, 0xffff019d, 0xffff019e, 0xffff019f, 0xffff01a0, 0xffff01a1, 0xffff01a2, 0xffff01a3, 0xffff01a4, 0xffff01a5, 0xffff01a6, 0xffff01a7, 0xffff01a8, 0xffff01a9, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1aaffff, 0x1ac01ab, 0x1ae01ad, 0x1b001af, 0x1b201b1, 0x1b401b3, 0x1b601b5, 0x1b801b7, 0x1ba01b9, 0x1bc01bb, 0x1be01bd, 0x1c001bf, 0x1c201c1, 0x1c401c3, 0x1c601c5, 0x1c801c7, 0x1ca01c9, 0x1cc01cb, 0x1ce01cd, 0xffff01cf, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x41dffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1d101d0, 0x1d301d2, 0x1d501d4, 0x1d701d6, 0x1d901d8, 0x1db01da, 0x1dd01dc, 0x1df01de, 0x1e101e0, 0x1e301e2, 0x1e501e4, 0x1e701e6, 0x1e901e8, 0x1eb01ea, 0x1ed01ec, 0x1ef01ee, 0x1f101f0, 0x1f301f2, 0x1f501f4, 0x1f6ffff, 0xffffffff, 0xffffffff, 0x1f7ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff01f8, 0xffff01f9, 0xffff01fa, 0xffff01fb, 0xffff01fc, 0xffff01fd, 0xffff01fe, 0xffff01ff, 0xffff0200, 0xffff0201, 0xffff0202, 0xffff0203, 0xffff0204, 0xffff0205, 0xffff0206, 0xffff0207, 0xffff0208, 0xffff0209, 0xffff020a, 0xffff020b, 0xffff020c, 0xffff020d, 0xffff020e, 0xffff020f, 0xffff0210, 0xffff0211, 0xffff0212, 0xffff0213, 0xffff0214, 0xffff0215, 0xffff0216, 0xffff0217, 0xffff0218, 0xffff0219, 0xffff021a, 0xffff021b, 0xffff021c, 0xffff021d, 0xffff021e, 0xffff021f, 0xffff0220, 0xffff0221, 0xffff0222, 0xffff0223, 0xffff0224, 0xffff0225, 0xffff0226, 0xffff0227, 0xffff0228, 0xffff0229, 0xffff022a, 0xffff022b, 0xffff022c, 0xffff022d, 0xffff022e, 0xffff022f, 0xffff0230, 0xffff0231, 0xffff0232, 0xffff0233, 0xffff0234, 0xffff0235, 0xffff0236, 0xffff0237, 0xffff0238, 0xffff0239, 0xffff023a, 0xffff023b, 0xffff023c, 0xffff023d, 0xffff023e, 0xffff023f, 0xffff0240, 0xffff0241, 0xffff0242, 0x4280427, 0x42a0429, 0xffff042b, 0xffffffff, 0xffff0243, 0xffff0244, 0xffff0245, 0xffff0246, 0xffff0247, 0xffff0248, 0xffff0249, 0xffff024a, 0xffff024b, 0xffff024c, 0xffff024d, 0xffff024e, 0xffff024f, 0xffff0250, 0xffff0251, 0xffff0252, 0xffff0253, 0xffff0254, 0xffff0255, 0xffff0256, 0xffff0257, 0xffff0258, 0xffff0259, 0xffff025a, 0xffff025b, 0xffff025c, 0xffff025d, 0xffff025e, 0xffff025f, 0xffff0260, 0xffff0261, 0xffff0262, 0xffff0263, 0xffff0264, 0xffff0265, 0xffff0266, 0xffff0267, 0xffff0268, 0xffff0269, 0xffff026a, 0xffff026b, 0xffff026c, 0xffff026d, 0xffff026e, 0xffff026f, 0xffff0270, 0xffff0271, 0xffff0272, 0xffff0273, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2750274, 0x2770276, 0x2790278, 0x27b027a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x27d027c, 0x27f027e, 0x2810280, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2830282, 0x2850284, 0x2870286, 0x2890288, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x28b028a, 0x28d028c, 0x28f028e, 0x2910290, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2930292, 0x2950294, 0x2970296, 0xffffffff, 0xffff042c, 0xffff042d, 0xffff042e, 0xffff042f, 0x298ffff, 0x299ffff, 0x29affff, 0x29bffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x29d029c, 0x29f029e, 0x2a102a0, 0x2a302a2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x43d043c, 0x43f043e, 0x4410440, 0x4430442, 0x4450444, 0x4470446, 0x4490448, 0x44b044a, 0x44d044c, 0x44f044e, 0x4510450, 0x4530452, 0x4550454, 0x4570456, 0x4590458, 0x45b045a, 0x45d045c, 0x45f045e, 0x4610460, 0x4630462, 0x4650464, 0x4670466, 0x4690468, 0x46b046a, 0xffffffff, 0x46c0472, 0xffff0473, 0x4780430, 0x2bd02bc, 0x2bf02be, 0xffff046d, 0xffffffff, 0xffffffff, 0x46e0474, 0xffff0475, 0x4790431, 0x2c202c1, 0x2c402c3, 0xffff046f, 0xffffffff, 0xffffffff, 0x4330432, 0xffffffff, 0x4350434, 0x2c702c6, 0x2c902c8, 0xffffffff, 0xffffffff, 0xffffffff, 0x4370436, 0xffff0438, 0x43a0439, 0x2cb02ca, 0x2cd02cc, 0xffff02ce, 0xffffffff, 0xffffffff, 0x4700476, 0xffff0477, 0x47a043b, 0x2d002cf, 0x2d202d1, 0xffff0471, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff02d4, 0xffffffff, 0x2d602d5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff02d7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2d902d8, 0x2db02da, 0x2dd02dc, 0x2df02de, 0x2e102e0, 0x2e302e2, 0x2e502e4, 0x2e702e6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2e8ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2ea02e9, 0x2ec02eb, 0x2ee02ed, 0x2f002ef, 0x2f202f1, 0x2f402f3, 0x2f602f5, 0x2f802f7, 0x2fa02f9, 0x2fc02fb, 0x2fe02fd, 0x30002ff, 0x3020301, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3040303, 0x3060305, 0x3080307, 0x30a0309, 0x30c030b, 0x30e030d, 0x310030f, 0x3120311, 0x3140313, 0x3160315, 0x3180317, 0x31a0319, 0x31c031b, 0x31e031d, 0x320031f, 0x3220321, 0x3240323, 0x3260325, 0x3280327, 0x32a0329, 0x32c032b, 0x32e032d, 0x330032f, 0xffff0331, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0332, 0x3340333, 0xffff0335, 0x336ffff, 0x337ffff, 0x338ffff, 0x339ffff, 0x33b033a, 0xffff033c, 0xffff033d, 0x33effff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x340033f, 0xffff0341, 0xffff0342, 0xffff0343, 0xffff0344, 0xffff0345, 0xffff0346, 0xffff0347, 0xffff0348, 0xffff0349, 0xffff034a, 0xffff034b, 0xffff034c, 0xffff034d, 0xffff034e, 0xffff034f, 0xffff0350, 0xffff0351, 0xffff0352, 0xffff0353, 0xffff0354, 0xffff0355, 0xffff0356, 0xffff0357, 0xffff0358, 0xffff0359, 0xffff035a, 0xffff035b, 0xffff035c, 0xffff035d, 0xffff035e, 0xffff035f, 0xffff0360, 0xffff0361, 0xffff0362, 0xffff0363, 0xffff0364, 0xffff0365, 0xffff0366, 0xffff0367, 0xffff0368, 0xffff0369, 0xffff036a, 0xffff036b, 0xffff036c, 0xffff036d, 0xffff036e, 0xffff036f, 0xffff0370, 0xffff0371, 0xffff0372, 0xffffffff, 0xffffffff, 0xffffffff, 0x373ffff, 0x374ffff, 0xffffffff, 0xffffffff, 0xffff0375, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0376, 0xffff0377, 0xffff0378, 0xffff0379, 0xffff037a, 0xffff037b, 0xffff037c, 0xffff037d, 0xffff037e, 0xffff037f, 0xffff0380, 0xffff0381, 0xffff0382, 0xffff0383, 0xffff0384, 0xffff0385, 0xffff0386, 0xffff0387, 0xffff0388, 0xffff0389, 0xffff038a, 0xffff038b, 0xffff038c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff038d, 0xffff038e, 0xffff038f, 0xffff0390, 0xffff0391, 0xffff0392, 0xffff0393, 0xffff0394, 0xffff0395, 0xffff0396, 0xffff0397, 0xffff0398, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0399, 0xffff039a, 0xffff039b, 0xffff039c, 0xffff039d, 0xffff039e, 0xffff039f, 0xffffffff, 0xffff03a0, 0xffff03a1, 0xffff03a2, 0xffff03a3, 0xffff03a4, 0xffff03a5, 0xffff03a6, 0xffff03a7, 0xffff03a8, 0xffff03a9, 0xffff03aa, 0xffff03ab, 0xffff03ac, 0xffff03ad, 0xffff03ae, 0xffff03af, 0xffff03b0, 0xffff03b1, 0xffff03b2, 0xffff03b3, 0xffff03b4, 0xffff03b5, 0xffff03b6, 0xffff03b7, 0xffff03b8, 0xffff03b9, 0xffff03ba, 0xffff03bb, 0xffff03bc, 0xffff03bd, 0xffff03be, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3bfffff, 0x3c0ffff, 0x3c1ffff, 0xffff03c2, 0xffff03c3, 0xffff03c4, 0xffff03c5, 0xffff03c6, 0xffffffff, 0x3c7ffff, 0x3c8ffff, 0xffffffff, 0xffff03c9, 0xffff03ca, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff03cb, 0xffff03cc, 0xffff03cd, 0xffff03ce, 0xffff03cf, 0xffff03d0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4170416, 0x4190418, 0x41b041a, 0xffff041c, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x41effff, 0x420041f, 0x4220421, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3d1ffff, 0x3d303d2, 0x3d503d4, 0x3d703d6, 0x3d903d8, 0x3db03da, 0x3dd03dc, 0x3df03de, 0x3e103e0, 0x3e303e2, 0x3e503e4, 0x3e703e6, 0x3e903e8, 0xffff03ea, 0xffffffff, 0xffffffff, 0x3ec03eb, 0x3ee03ed, 0x3f003ef, 0x3f203f1, 0x3f403f3, 0x3f603f5, 0x3f803f7, 0x3fa03f9, 0x3fc03fb, 0x3fe03fd, 0x40003ff, 0x4020401, 0x4040403, 0x4060405, 0x4080407, 0x40a0409, 0x40c040b, 0x40e040d, 0x410040f, 0x4120411, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+//8192 bytes -+enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)([ 0x0, 0x40, 0x200], [ 0x100, 0x380, 0xc00], [ 0x2020100, 0x4020302, 0x2020205, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x2020202, 0x10000, 0x30002, 0x50004, 0x70006, 0x90008, 0xa, 0xb0000, 0xd000c, 0xf000e, 0x110010, 0x130012, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x150000, 0x0, 0x170016, 0x190018, 0x1b001a, 0x1d001c, 0x0, 0x0, 0x1e0000, 0x1f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x220021, 0x240023, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x260000, 0x27, 0x290028, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2c0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2e002d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff, 0x20001, 0x40003, 0x60005, 0x80007, 0xa0009, 0xc000b, 0xe000d, 0x10000f, 0x120011, 0x140013, 0x160015, 0x180017, 0xffff0019, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1affff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x41fffff, 0x1c001b, 0x1e001d, 0x20001f, 0x220021, 0x240023, 0x260025, 0x280027, 0x2a0029, 0x2c002b, 0x2e002d, 0x30002f, 0xffff0031, 0x330032, 0x350034, 0x370036, 0x390038, 0x3affff, 0x3bffff, 0x3cffff, 0x3dffff, 0x3effff, 0x3fffff, 0x40ffff, 0x41ffff, 0x42ffff, 0x43ffff, 0x44ffff, 0x45ffff, 0x46ffff, 0x47ffff, 0x48ffff, 0x49ffff, 0x4affff, 0x4bffff, 0x4cffff, 0x4dffff, 0x4effff, 0x4fffff, 0x50ffff, 0x51ffff, 0x520421, 0x53ffff, 0x54ffff, 0x55ffff, 0xffffffff, 0xffff0056, 0xffff0057, 0xffff0058, 0xffff0059, 0xffff005a, 0xffff005b, 0xffff005c, 0x43e005d, 0x5effff, 0x5fffff, 0x60ffff, 0x61ffff, 0x62ffff, 0x63ffff, 0x64ffff, 0x65ffff, 0x66ffff, 0x67ffff, 0x68ffff, 0x69ffff, 0x6affff, 0x6bffff, 0x6cffff, 0x6dffff, 0x6effff, 0x6fffff, 0x70ffff, 0x71ffff, 0x72ffff, 0x73ffff, 0x74ffff, 0xffffffff, 0xffff0075, 0xffff0076, 0x780077, 0xffff0079, 0x7affff, 0x7bffff, 0xffffffff, 0xffff007c, 0xffffffff, 0xffff007d, 0xffffffff, 0xffffffff, 0xffff007e, 0x7fffff, 0xffffffff, 0x80ffff, 0xffff0081, 0xffffffff, 0xffff0082, 0x83ffff, 0x84ffff, 0x85ffff, 0xffffffff, 0xffff0086, 0xffffffff, 0x87ffff, 0xffffffff, 0xffff0088, 0xffffffff, 0xffff0089, 0xffff008a, 0x8bffff, 0xffffffff, 0x8cffff, 0x8dffff, 0xffffffff, 0xffffffff, 0x8f008e, 0x910090, 0x930092, 0x950094, 0xffff0096, 0xffff0097, 0xffff0098, 0xffff0099, 0xffff009a, 0xffff009b, 0xffff009c, 0xffff009d, 0x9f009e, 0xa0ffff, 0xa1ffff, 0xa2ffff, 0xa3ffff, 0xa4ffff, 0xa5ffff, 0xa6ffff, 0xa7ffff, 0xa8ffff, 0xa90446, 0xab00aa, 0xacffff, 0xffffffff, 0xadffff, 0xaeffff, 0xafffff, 0xb0ffff, 0xb1ffff, 0xb2ffff, 0xb3ffff, 0xb4ffff, 0xb5ffff, 0xb6ffff, 0xb7ffff, 0xb8ffff, 0xb9ffff, 0xbaffff, 0xbbffff, 0xbcffff, 0xbdffff, 0xbeffff, 0xbfffff, 0xc0ffff, 0xffffffff, 0xc1ffff, 0xc2ffff, 0xc3ffff, 0xc4ffff, 0xc5ffff, 0xc6ffff, 0xc7ffff, 0xc8ffff, 0xc9ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff00ca, 0xcbffff, 0xffff00cc, 0xffff00cd, 0xffffffff, 0xceffff, 0xcfffff, 0xd0ffff, 0xd1ffff, 0xd2ffff, 0xd400d3, 0xd600d5, 0xffff00d7, 0xd900d8, 0xdaffff, 0xdbffff, 0xffffffff, 0xffffffff, 0xffff00dc, 0xddffff, 0xdeffff, 0xffff00df, 0xe100e0, 0xe2ffff, 0xffffffff, 0xe3ffff, 0xe4ffff, 0xffff00e5, 0xe6ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xe7ffff, 0xffffffff, 0xffff00e8, 0xe9ffff, 0xffffffff, 0xffffffff, 0xeb00ea, 0xed00ec, 0xffff00ee, 0xffffffff, 0xffffffff, 0xffff00ef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf0ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf1ffff, 0xf2ffff, 0xffffffff, 0xf3ffff, 0xffffffff, 0xf4ffff, 0xf600f5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0440, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xf800f7, 0xfa00f9, 0xfb0443, 0xfd00fc, 0xff00fe, 0x1010100, 0x1030102, 0x1050104, 0x1070106, 0x1090108, 0x10b010a, 0x10d010c, 0x10f010e, 0x1110110, 0x1130112, 0x1150114, 0x1170116, 0xffff0118, 0x11a0119, 0xffffffff, 0x11bffff, 0x11d011c, 0x11effff, 0x11fffff, 0x120ffff, 0x121ffff, 0x122ffff, 0x123ffff, 0x124ffff, 0x125ffff, 0x126ffff, 0x127ffff, 0x128ffff, 0x129ffff, 0x12b012a, 0xffff012c, 0x12dffff, 0xffffffff, 0xffff012e, 0x12fffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1310130, 0x1330132, 0x1350134, 0x1370136, 0x1390138, 0x13b013a, 0x13d013c, 0x13f013e, 0x1410140, 0x1430142, 0x1450144, 0x1470146, 0x1490148, 0x14b014a, 0x14d014c, 0x14f014e, 0x1510150, 0x1530152, 0x1550154, 0x1570156, 0x1590158, 0x15b015a, 0x15d015c, 0x15f015e, 0x160ffff, 0x161ffff, 0x162ffff, 0x163ffff, 0x164ffff, 0x165ffff, 0x166ffff, 0x167ffff, 0x168ffff, 0x169ffff, 0x16affff, 0x16bffff, 0x16cffff, 0x16dffff, 0x16effff, 0x16fffff, 0x170ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x171ffff, 0x172ffff, 0x173ffff, 0x174ffff, 0x175ffff, 0x176ffff, 0x177ffff, 0x178ffff, 0x179ffff, 0x17affff, 0x17bffff, 0x17cffff, 0x17dffff, 0x17effff, 0x17fffff, 0x180ffff, 0x181ffff, 0x182ffff, 0x183ffff, 0x184ffff, 0x185ffff, 0x186ffff, 0x187ffff, 0x188ffff, 0x189ffff, 0x18affff, 0x18bffff, 0xffffffff, 0xffff018c, 0xffff018d, 0xffff018e, 0xffff018f, 0xffff0190, 0xffff0191, 0x1930192, 0x194ffff, 0x195ffff, 0x196ffff, 0x197ffff, 0x198ffff, 0x199ffff, 0x19affff, 0x19bffff, 0x19cffff, 0x19dffff, 0x19effff, 0x19fffff, 0x1a0ffff, 0x1a1ffff, 0x1a2ffff, 0x1a3ffff, 0x1a4ffff, 0x1a5ffff, 0x1a6ffff, 0x1a7ffff, 0x1a8ffff, 0x1a9ffff, 0x1aaffff, 0x1abffff, 0x1acffff, 0x1adffff, 0x1aeffff, 0x1afffff, 0x1b0ffff, 0x1b1ffff, 0x1b2ffff, 0x1b3ffff, 0x1b4ffff, 0x1b5ffff, 0x1b6ffff, 0x1b7ffff, 0x1b8ffff, 0x1b9ffff, 0x1baffff, 0x1bbffff, 0x1bcffff, 0x1bdffff, 0x1beffff, 0x1bfffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1c0ffff, 0x1c201c1, 0x1c401c3, 0x1c601c5, 0x1c801c7, 0x1ca01c9, 0x1cc01cb, 0x1ce01cd, 0x1d001cf, 0x1d201d1, 0x1d401d3, 0x1d601d5, 0x1d801d7, 0x1da01d9, 0x1dc01db, 0x1de01dd, 0x1e001df, 0x1e201e1, 0x1e401e3, 0x43201e5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x1e6ffff, 0xffffffff, 0x1e7ffff, 0xffffffff, 0x1e8ffff, 0x1e9ffff, 0x1eaffff, 0x1ebffff, 0x1ecffff, 0x1edffff, 0x1eeffff, 0x1efffff, 0x1f0ffff, 0x1f1ffff, 0x1f2ffff, 0x1f3ffff, 0x1f4ffff, 0x1f5ffff, 0x1f6ffff, 0x1f7ffff, 0x1f8ffff, 0x1f9ffff, 0x1faffff, 0x1fbffff, 0x1fcffff, 0x1fdffff, 0x1feffff, 0x1ffffff, 0x200ffff, 0x201ffff, 0x202ffff, 0x203ffff, 0x204ffff, 0x205ffff, 0x206ffff, 0x207ffff, 0x208ffff, 0x209ffff, 0x20affff, 0x20bffff, 0x20cffff, 0x20dffff, 0x20effff, 0x20fffff, 0x210ffff, 0x211ffff, 0x212ffff, 0x213ffff, 0x214ffff, 0x215ffff, 0x216ffff, 0x217ffff, 0x218ffff, 0x219ffff, 0x21affff, 0x21bffff, 0x21cffff, 0x21dffff, 0x21effff, 0x21fffff, 0x220ffff, 0x221ffff, 0x222ffff, 0x223ffff, 0x224ffff, 0x225ffff, 0x226ffff, 0x227ffff, 0x228ffff, 0x229ffff, 0x22affff, 0x22bffff, 0x22cffff, 0x22dffff, 0x22effff, 0x22fffff, 0x230ffff, 0x231ffff, 0x232ffff, 0x44a0448, 0x44e044c, 0x2330450, 0xffffffff, 0xffffffff, 0x234ffff, 0x235ffff, 0x236ffff, 0x237ffff, 0x238ffff, 0x239ffff, 0x23affff, 0x23bffff, 0x23cffff, 0x23dffff, 0x23effff, 0x23fffff, 0x240ffff, 0x241ffff, 0x242ffff, 0x243ffff, 0x244ffff, 0x245ffff, 0x246ffff, 0x247ffff, 0x248ffff, 0x249ffff, 0x24affff, 0x24bffff, 0x24cffff, 0x24dffff, 0x24effff, 0x24fffff, 0x250ffff, 0x251ffff, 0x252ffff, 0x253ffff, 0x254ffff, 0x255ffff, 0x256ffff, 0x257ffff, 0x258ffff, 0x259ffff, 0x25affff, 0x25bffff, 0x25cffff, 0x25dffff, 0x25effff, 0x25fffff, 0x260ffff, 0x261ffff, 0x262ffff, 0x263ffff, 0x2650264, 0x2670266, 0x2690268, 0x26b026a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x26d026c, 0x26f026e, 0x2710270, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2730272, 0x2750274, 0x2770276, 0x2790278, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x27b027a, 0x27d027c, 0x27f027e, 0x2810280, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2830282, 0x2850284, 0x2870286, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2880452, 0x2890454, 0x28a0457, 0x28b045a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x28d028c, 0x28f028e, 0x2910290, 0x2930292, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2950294, 0x2970296, 0x2990298, 0x29b029a, 0x29d029c, 0x29f029e, 0x2a102a0, 0xffffffff, 0x47c047b, 0x47e047d, 0x480047f, 0x4820481, 0x4840483, 0x4860485, 0x4880487, 0x48a0489, 0x48c048b, 0x48e048d, 0x490048f, 0x4920491, 0x4940493, 0x4960495, 0x4980497, 0x49a0499, 0x49c049b, 0x49e049d, 0x4a0049f, 0x4a204a1, 0x4a404a3, 0x4a604a5, 0x4a804a7, 0x4aa04a9, 0x2bb02ba, 0x4ab04b1, 0xffff04b3, 0x4bd045d, 0xffffffff, 0xffffffff, 0xffff04ac, 0xffff02bd, 0xffffffff, 0x4ad04b5, 0xffff04b7, 0x4c0045f, 0xffffffff, 0xffffffff, 0xffff04ae, 0xffffffff, 0x2c002bf, 0x4640461, 0xffffffff, 0x4690467, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2c202c1, 0x46f046c, 0x2c30472, 0x4760474, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4af04b9, 0xffff04bb, 0x4c30479, 0xffffffff, 0xffffffff, 0xffff04b0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff02c5, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2c702c6, 0x2c902c8, 0x2cb02ca, 0x2cd02cc, 0x2cf02ce, 0x2d102d0, 0x2d302d2, 0x2d502d4, 0xffffffff, 0xffffffff, 0xffff02d6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2d802d7, 0x2da02d9, 0x2dc02db, 0x2de02dd, 0x2e002df, 0x2e202e1, 0x2e402e3, 0x2e602e5, 0x2e802e7, 0x2ea02e9, 0x2ec02eb, 0x2ee02ed, 0x2f002ef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x2f202f1, 0x2f402f3, 0x2f602f5, 0x2f802f7, 0x2fa02f9, 0x2fc02fb, 0x2fe02fd, 0x30002ff, 0x3020301, 0x3040303, 0x3060305, 0x3080307, 0x30a0309, 0x30c030b, 0x30e030d, 0x310030f, 0x3120311, 0x3140313, 0x3160315, 0x3180317, 0x31a0319, 0x31c031b, 0x31e031d, 0xffff031f, 0x320ffff, 0xffffffff, 0x321ffff, 0xffff0322, 0xffff0323, 0xffff0324, 0xffff0325, 0xffffffff, 0xffffffff, 0x326ffff, 0xffffffff, 0xffff0327, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x328ffff, 0x329ffff, 0x32affff, 0x32bffff, 0x32cffff, 0x32dffff, 0x32effff, 0x32fffff, 0x330ffff, 0x331ffff, 0x332ffff, 0x333ffff, 0x334ffff, 0x335ffff, 0x336ffff, 0x337ffff, 0x338ffff, 0x339ffff, 0x33affff, 0x33bffff, 0x33cffff, 0x33dffff, 0x33effff, 0x33fffff, 0x340ffff, 0x341ffff, 0x342ffff, 0x343ffff, 0x344ffff, 0x345ffff, 0x346ffff, 0x347ffff, 0x348ffff, 0x349ffff, 0x34affff, 0x34bffff, 0x34cffff, 0x34dffff, 0x34effff, 0x34fffff, 0x350ffff, 0x351ffff, 0x352ffff, 0x353ffff, 0x354ffff, 0x355ffff, 0x356ffff, 0x357ffff, 0x358ffff, 0x359ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff035a, 0xffff035b, 0xffffffff, 0x35cffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x35e035d, 0x360035f, 0x3620361, 0x3640363, 0x3660365, 0x3680367, 0x36a0369, 0x36c036b, 0x36e036d, 0x370036f, 0x3720371, 0x3740373, 0x3760375, 0x3780377, 0x37a0379, 0x37c037b, 0x37e037d, 0x380037f, 0x3820381, 0x383ffff, 0xffffffff, 0xffffffff, 0x384ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x385ffff, 0x386ffff, 0x387ffff, 0x388ffff, 0x389ffff, 0x38affff, 0x38bffff, 0x38cffff, 0x38dffff, 0x38effff, 0x38fffff, 0x390ffff, 0x391ffff, 0x392ffff, 0x393ffff, 0x394ffff, 0x395ffff, 0x396ffff, 0x397ffff, 0x398ffff, 0x399ffff, 0x39affff, 0x39bffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x39cffff, 0x39dffff, 0x39effff, 0x39fffff, 0x3a0ffff, 0x3a1ffff, 0x3a2ffff, 0x3a3ffff, 0x3a4ffff, 0x3a5ffff, 0x3a6ffff, 0x3a7ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3a8ffff, 0x3a9ffff, 0x3aaffff, 0x3abffff, 0x3acffff, 0x3adffff, 0x3aeffff, 0xffffffff, 0x3afffff, 0x3b0ffff, 0x3b1ffff, 0x3b2ffff, 0x3b3ffff, 0x3b4ffff, 0x3b5ffff, 0x3b6ffff, 0x3b7ffff, 0x3b8ffff, 0x3b9ffff, 0x3baffff, 0x3bbffff, 0x3bcffff, 0x3bdffff, 0x3beffff, 0x3bfffff, 0x3c0ffff, 0x3c1ffff, 0x3c2ffff, 0x3c3ffff, 0x3c4ffff, 0x3c5ffff, 0x3c6ffff, 0x3c7ffff, 0x3c8ffff, 0x3c9ffff, 0x3caffff, 0x3cbffff, 0x3ccffff, 0x3cdffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffff03ce, 0xffff03cf, 0x3d0ffff, 0x3d1ffff, 0x3d2ffff, 0x3d3ffff, 0x3d4ffff, 0xffffffff, 0xffffffff, 0xffff03d5, 0xffffffff, 0x3d6ffff, 0x3d7ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3d8ffff, 0x3d9ffff, 0x3daffff, 0x3dbffff, 0x3dcffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x4240422, 0x4280426, 0x42e042b, 0xffff0430, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x434ffff, 0x4380436, 0x43c043a, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3ddffff, 0x3df03de, 0x3e103e0, 0x3e303e2, 0x3e503e4, 0x3e703e6, 0x3e903e8, 0x3eb03ea, 0x3ed03ec, 0x3ef03ee, 0x3f103f0, 0x3f303f2, 0x3f503f4, 0xffff03f6, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x3f803f7, 0x3fa03f9, 0x3fc03fb, 0x3fe03fd, 0x40003ff, 0x4020401, 0x4040403, 0x4060405, 0x4080407, 0x40a0409, 0x40c040b, 0x40e040d, 0x410040f, 0x4120411, 0x4140413, 0x4160415, 0x4180417, 0x41a0419, 0x41c041b, 0x41e041d, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]); -+@property -+{ -+private alias _IUA = immutable(uint[]); -+_IUA toUpperTable() { static _IUA t = [ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x39c, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11a, 0x11c, 0x11e, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12a, 0x12c, 0x12e, 0x49, 0x132, 0x134, 0x136, 0x139, 0x13b, 0x13d, 0x13f, 0x141, 0x143, 0x145, 0x147, 0x14a, 0x14c, 0x14e, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15a, 0x15c, 0x15e, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16a, 0x16c, 0x16e, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17b, 0x17d, 0x53, 0x243, 0x182, 0x184, 0x187, 0x18b, 0x191, 0x1f6, 0x198, 0x23d, 0x220, 0x1a0, 0x1a2, 0x1a4, 0x1a7, 0x1ac, 0x1af, 0x1b3, 0x1b5, 0x1b8, 0x1bc, 0x1f7, 0x1c4, 0x1c4, 0x1c7, 0x1c7, 0x1ca, 0x1ca, 0x1cd, 0x1cf, 0x1d1, 0x1d3, 0x1d5, 0x1d7, 0x1d9, 0x1db, 0x18e, 0x1de, 0x1e0, 0x1e2, 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f1, 0x1f1, 0x1f4, 0x1f8, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x202, 0x204, 0x206, 0x208, 0x20a, 0x20c, 0x20e, 0x210, 0x212, 0x214, 0x216, 0x218, 0x21a, 0x21c, 0x21e, 0x222, 0x224, 0x226, 0x228, 0x22a, 0x22c, 0x22e, 0x230, 0x232, 0x23b, 0x2c7e, 0x2c7f, 0x241, 0x246, 0x248, 0x24a, 0x24c, 0x24e, 0x2c6f, 0x2c6d, 0x2c70, 0x181, 0x186, 0x189, 0x18a, 0x18f, 0x190, 0x193, 0x194, 0xa78d, 0xa7aa, 0x197, 0x196, 0x2c62, 0x19c, 0x2c6e, 0x19d, 0x19f, 0x2c64, 0x1a6, 0x1a9, 0x1ae, 0x244, 0x1b1, 0x1b2, 0x245, 0x1b7, 0x399, 0x370, 0x372, 0x376, 0x3fd, 0x3fe, 0x3ff, 0x386, 0x388, 0x389, 0x38a, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b, 0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9, 0x3aa, 0x3ab, 0x38c, 0x38e, 0x38f, 0x392, 0x398, 0x3a6, 0x3a0, 0x3cf, 0x3d8, 0x3da, 0x3dc, 0x3de, 0x3e0, 0x3e2, 0x3e4, 0x3e6, 0x3e8, 0x3ea, 0x3ec, 0x3ee, 0x39a, 0x3a1, 0x3f9, 0x395, 0x3f7, 0x3fa, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, 0x460, 0x462, 0x464, 0x466, 0x468, 0x46a, 0x46c, 0x46e, 0x470, 0x472, 0x474, 0x476, 0x478, 0x47a, 0x47c, 0x47e, 0x480, 0x48a, 0x48c, 0x48e, 0x490, 0x492, 0x494, 0x496, 0x498, 0x49a, 0x49c, 0x49e, 0x4a0, 0x4a2, 0x4a4, 0x4a6, 0x4a8, 0x4aa, 0x4ac, 0x4ae, 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x4bc, 0x4be, 0x4c1, 0x4c3, 0x4c5, 0x4c7, 0x4c9, 0x4cb, 0x4cd, 0x4c0, 0x4d0, 0x4d2, 0x4d4, 0x4d6, 0x4d8, 0x4da, 0x4dc, 0x4de, 0x4e0, 0x4e2, 0x4e4, 0x4e6, 0x4e8, 0x4ea, 0x4ec, 0x4ee, 0x4f0, 0x4f2, 0x4f4, 0x4f6, 0x4f8, 0x4fa, 0x4fc, 0x4fe, 0x500, 0x502, 0x504, 0x506, 0x508, 0x50a, 0x50c, 0x50e, 0x510, 0x512, 0x514, 0x516, 0x518, 0x51a, 0x51c, 0x51e, 0x520, 0x522, 0x524, 0x526, 0x531, 0x532, 0x533, 0x534, 0x535, 0x536, 0x537, 0x538, 0x539, 0x53a, 0x53b, 0x53c, 0x53d, 0x53e, 0x53f, 0x540, 0x541, 0x542, 0x543, 0x544, 0x545, 0x546, 0x547, 0x548, 0x549, 0x54a, 0x54b, 0x54c, 0x54d, 0x54e, 0x54f, 0x550, 0x551, 0x552, 0x553, 0x554, 0x555, 0x556, 0xa77d, 0x2c63, 0x1e00, 0x1e02, 0x1e04, 0x1e06, 0x1e08, 0x1e0a, 0x1e0c, 0x1e0e, 0x1e10, 0x1e12, 0x1e14, 0x1e16, 0x1e18, 0x1e1a, 0x1e1c, 0x1e1e, 0x1e20, 0x1e22, 0x1e24, 0x1e26, 0x1e28, 0x1e2a, 0x1e2c, 0x1e2e, 0x1e30, 0x1e32, 0x1e34, 0x1e36, 0x1e38, 0x1e3a, 0x1e3c, 0x1e3e, 0x1e40, 0x1e42, 0x1e44, 0x1e46, 0x1e48, 0x1e4a, 0x1e4c, 0x1e4e, 0x1e50, 0x1e52, 0x1e54, 0x1e56, 0x1e58, 0x1e5a, 0x1e5c, 0x1e5e, 0x1e60, 0x1e62, 0x1e64, 0x1e66, 0x1e68, 0x1e6a, 0x1e6c, 0x1e6e, 0x1e70, 0x1e72, 0x1e74, 0x1e76, 0x1e78, 0x1e7a, 0x1e7c, 0x1e7e, 0x1e80, 0x1e82, 0x1e84, 0x1e86, 0x1e88, 0x1e8a, 0x1e8c, 0x1e8e, 0x1e90, 0x1e92, 0x1e94, 0x1e60, 0x1ea0, 0x1ea2, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eaa, 0x1eac, 0x1eae, 0x1eb0, 0x1eb2, 0x1eb4, 0x1eb6, 0x1eb8, 0x1eba, 0x1ebc, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ec8, 0x1eca, 0x1ecc, 0x1ece, 0x1ed0, 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1eda, 0x1edc, 0x1ede, 0x1ee0, 0x1ee2, 0x1ee4, 0x1ee6, 0x1ee8, 0x1eea, 0x1eec, 0x1eee, 0x1ef0, 0x1ef2, 0x1ef4, 0x1ef6, 0x1ef8, 0x1efa, 0x1efc, 0x1efe, 0x1f08, 0x1f09, 0x1f0a, 0x1f0b, 0x1f0c, 0x1f0d, 0x1f0e, 0x1f0f, 0x1f18, 0x1f19, 0x1f1a, 0x1f1b, 0x1f1c, 0x1f1d, 0x1f28, 0x1f29, 0x1f2a, 0x1f2b, 0x1f2c, 0x1f2d, 0x1f2e, 0x1f2f, 0x1f38, 0x1f39, 0x1f3a, 0x1f3b, 0x1f3c, 0x1f3d, 0x1f3e, 0x1f3f, 0x1f48, 0x1f49, 0x1f4a, 0x1f4b, 0x1f4c, 0x1f4d, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f68, 0x1f69, 0x1f6a, 0x1f6b, 0x1f6c, 0x1f6d, 0x1f6e, 0x1f6f, 0x1fba, 0x1fbb, 0x1fc8, 0x1fc9, 0x1fca, 0x1fcb, 0x1fda, 0x1fdb, 0x1ff8, 0x1ff9, 0x1fea, 0x1feb, 0x1ffa, 0x1ffb, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fb8, 0x1fb9, 0x1fbc, 0x399, 0x1fcc, 0x1fd8, 0x1fd9, 0x1fe8, 0x1fe9, 0x1fec, 0x1ffc, 0x2132, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0x216c, 0x216d, 0x216e, 0x216f, 0x2183, 0x24b6, 0x24b7, 0x24b8, 0x24b9, 0x24ba, 0x24bb, 0x24bc, 0x24bd, 0x24be, 0x24bf, 0x24c0, 0x24c1, 0x24c2, 0x24c3, 0x24c4, 0x24c5, 0x24c6, 0x24c7, 0x24c8, 0x24c9, 0x24ca, 0x24cb, 0x24cc, 0x24cd, 0x24ce, 0x24cf, 0x2c00, 0x2c01, 0x2c02, 0x2c03, 0x2c04, 0x2c05, 0x2c06, 0x2c07, 0x2c08, 0x2c09, 0x2c0a, 0x2c0b, 0x2c0c, 0x2c0d, 0x2c0e, 0x2c0f, 0x2c10, 0x2c11, 0x2c12, 0x2c13, 0x2c14, 0x2c15, 0x2c16, 0x2c17, 0x2c18, 0x2c19, 0x2c1a, 0x2c1b, 0x2c1c, 0x2c1d, 0x2c1e, 0x2c1f, 0x2c20, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c27, 0x2c28, 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c60, 0x23a, 0x23e, 0x2c67, 0x2c69, 0x2c6b, 0x2c72, 0x2c75, 0x2c80, 0x2c82, 0x2c84, 0x2c86, 0x2c88, 0x2c8a, 0x2c8c, 0x2c8e, 0x2c90, 0x2c92, 0x2c94, 0x2c96, 0x2c98, 0x2c9a, 0x2c9c, 0x2c9e, 0x2ca0, 0x2ca2, 0x2ca4, 0x2ca6, 0x2ca8, 0x2caa, 0x2cac, 0x2cae, 0x2cb0, 0x2cb2, 0x2cb4, 0x2cb6, 0x2cb8, 0x2cba, 0x2cbc, 0x2cbe, 0x2cc0, 0x2cc2, 0x2cc4, 0x2cc6, 0x2cc8, 0x2cca, 0x2ccc, 0x2cce, 0x2cd0, 0x2cd2, 0x2cd4, 0x2cd6, 0x2cd8, 0x2cda, 0x2cdc, 0x2cde, 0x2ce0, 0x2ce2, 0x2ceb, 0x2ced, 0x2cf2, 0x10a0, 0x10a1, 0x10a2, 0x10a3, 0x10a4, 0x10a5, 0x10a6, 0x10a7, 0x10a8, 0x10a9, 0x10aa, 0x10ab, 0x10ac, 0x10ad, 0x10ae, 0x10af, 0x10b0, 0x10b1, 0x10b2, 0x10b3, 0x10b4, 0x10b5, 0x10b6, 0x10b7, 0x10b8, 0x10b9, 0x10ba, 0x10bb, 0x10bc, 0x10bd, 0x10be, 0x10bf, 0x10c0, 0x10c1, 0x10c2, 0x10c3, 0x10c4, 0x10c5, 0x10c7, 0x10cd, 0xa640, 0xa642, 0xa644, 0xa646, 0xa648, 0xa64a, 0xa64c, 0xa64e, 0xa650, 0xa652, 0xa654, 0xa656, 0xa658, 0xa65a, 0xa65c, 0xa65e, 0xa660, 0xa662, 0xa664, 0xa666, 0xa668, 0xa66a, 0xa66c, 0xa680, 0xa682, 0xa684, 0xa686, 0xa688, 0xa68a, 0xa68c, 0xa68e, 0xa690, 0xa692, 0xa694, 0xa696, 0xa722, 0xa724, 0xa726, 0xa728, 0xa72a, 0xa72c, 0xa72e, 0xa732, 0xa734, 0xa736, 0xa738, 0xa73a, 0xa73c, 0xa73e, 0xa740, 0xa742, 0xa744, 0xa746, 0xa748, 0xa74a, 0xa74c, 0xa74e, 0xa750, 0xa752, 0xa754, 0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766, 0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77e, 0xa780, 0xa782, 0xa784, 0xa786, 0xa78b, 0xa790, 0xa792, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407, 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f, 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417, 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f, 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427, 0x2000053, 0x53, 0x130, 0x2000046, 0x46, 0x2000046, 0x49, 0x2000046, 0x4c, 0x3000046, 0x46, 0x49, 0x3000046, 0x46, 0x4c, 0x2000053, 0x54, 0x2000053, 0x54, 0x2000535, 0x552, 0x2000544, 0x546, 0x2000544, 0x535, 0x2000544, 0x53b, 0x200054e, 0x546, 0x2000544, 0x53d, 0x20002bc, 0x4e, 0x3000399, 0x308, 0x301, 0x30003a5, 0x308, 0x301, 0x200004a, 0x30c, 0x2000048, 0x331, 0x2000054, 0x308, 0x2000057, 0x30a, 0x2000059, 0x30a, 0x2000041, 0x2be, 0x20003a5, 0x313, 0x30003a5, 0x313, 0x300, 0x30003a5, 0x313, 0x301, 0x30003a5, 0x313, 0x342, 0x2000391, 0x342, 0x2000397, 0x342, 0x3000399, 0x308, 0x300, 0x3000399, 0x308, 0x301, 0x2000399, 0x342, 0x3000399, 0x308, 0x342, 0x30003a5, 0x308, 0x300, 0x30003a5, 0x308, 0x301, 0x20003a1, 0x313, 0x20003a5, 0x342, 0x30003a5, 0x308, 0x342, 0x20003a9, 0x342, 0x2001f08, 0x399, 0x2001f09, 0x399, 0x2001f0a, 0x399, 0x2001f0b, 0x399, 0x2001f0c, 0x399, 0x2001f0d, 0x399, 0x2001f0e, 0x399, 0x2001f0f, 0x399, 0x2001f08, 0x399, 0x2001f09, 0x399, 0x2001f0a, 0x399, 0x2001f0b, 0x399, 0x2001f0c, 0x399, 0x2001f0d, 0x399, 0x2001f0e, 0x399, 0x2001f0f, 0x399, 0x2001f28, 0x399, 0x2001f29, 0x399, 0x2001f2a, 0x399, 0x2001f2b, 0x399, 0x2001f2c, 0x399, 0x2001f2d, 0x399, 0x2001f2e, 0x399, 0x2001f2f, 0x399, 0x2001f28, 0x399, 0x2001f29, 0x399, 0x2001f2a, 0x399, 0x2001f2b, 0x399, 0x2001f2c, 0x399, 0x2001f2d, 0x399, 0x2001f2e, 0x399, 0x2001f2f, 0x399, 0x2001f68, 0x399, 0x2001f69, 0x399, 0x2001f6a, 0x399, 0x2001f6b, 0x399, 0x2001f6c, 0x399, 0x2001f6d, 0x399, 0x2001f6e, 0x399, 0x2001f6f, 0x399, 0x2001f68, 0x399, 0x2001f69, 0x399, 0x2001f6a, 0x399, 0x2001f6b, 0x399, 0x2001f6c, 0x399, 0x2001f6d, 0x399, 0x2001f6e, 0x399, 0x2001f6f, 0x399, 0x2000391, 0x399, 0x2000391, 0x399, 0x2000397, 0x399, 0x2000397, 0x399, 0x20003a9, 0x399, 0x20003a9, 0x399, 0x2001fba, 0x399, 0x2000386, 0x399, 0x2001fca, 0x399, 0x2000389, 0x399, 0x2001ffa, 0x399, 0x200038f, 0x399, 0x3000391, 0x342, 0x399, 0x3000397, 0x342, 0x399, 0x30003a9, 0x342, 0x399]; return t; } -+_IUA toLowerTable() { static _IUA t = [ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10b, 0x10d, 0x10f, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11b, 0x11d, 0x11f, 0x121, 0x123, 0x125, 0x127, 0x129, 0x12b, 0x12d, 0x12f, 0x69, 0x133, 0x135, 0x137, 0x13a, 0x13c, 0x13e, 0x140, 0x142, 0x144, 0x146, 0x148, 0x14b, 0x14d, 0x14f, 0x151, 0x153, 0x155, 0x157, 0x159, 0x15b, 0x15d, 0x15f, 0x161, 0x163, 0x165, 0x167, 0x169, 0x16b, 0x16d, 0x16f, 0x171, 0x173, 0x175, 0x177, 0xff, 0x17a, 0x17c, 0x17e, 0x253, 0x183, 0x185, 0x254, 0x188, 0x256, 0x257, 0x18c, 0x1dd, 0x259, 0x25b, 0x192, 0x260, 0x263, 0x269, 0x268, 0x199, 0x26f, 0x272, 0x275, 0x1a1, 0x1a3, 0x1a5, 0x280, 0x1a8, 0x283, 0x1ad, 0x288, 0x1b0, 0x28a, 0x28b, 0x1b4, 0x1b6, 0x292, 0x1b9, 0x1bd, 0x1c6, 0x1c6, 0x1c9, 0x1c9, 0x1cc, 0x1cc, 0x1ce, 0x1d0, 0x1d2, 0x1d4, 0x1d6, 0x1d8, 0x1da, 0x1dc, 0x1df, 0x1e1, 0x1e3, 0x1e5, 0x1e7, 0x1e9, 0x1eb, 0x1ed, 0x1ef, 0x1f3, 0x1f3, 0x1f5, 0x195, 0x1bf, 0x1f9, 0x1fb, 0x1fd, 0x1ff, 0x201, 0x203, 0x205, 0x207, 0x209, 0x20b, 0x20d, 0x20f, 0x211, 0x213, 0x215, 0x217, 0x219, 0x21b, 0x21d, 0x21f, 0x19e, 0x223, 0x225, 0x227, 0x229, 0x22b, 0x22d, 0x22f, 0x231, 0x233, 0x2c65, 0x23c, 0x19a, 0x2c66, 0x242, 0x180, 0x289, 0x28c, 0x247, 0x249, 0x24b, 0x24d, 0x24f, 0x371, 0x373, 0x377, 0x3ac, 0x3ad, 0x3ae, 0x3af, 0x3cc, 0x3cd, 0x3ce, 0x3b1, 0x3b2, 0x3b3, 0x3b4, 0x3b5, 0x3b6, 0x3b7, 0x3b8, 0x3b9, 0x3ba, 0x3bb, 0x3bc, 0x3bd, 0x3be, 0x3bf, 0x3c0, 0x3c1, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9, 0x3ca, 0x3cb, 0x3d7, 0x3d9, 0x3db, 0x3dd, 0x3df, 0x3e1, 0x3e3, 0x3e5, 0x3e7, 0x3e9, 0x3eb, 0x3ed, 0x3ef, 0x3b8, 0x3f8, 0x3f2, 0x3fb, 0x37b, 0x37c, 0x37d, 0x450, 0x451, 0x452, 0x453, 0x454, 0x455, 0x456, 0x457, 0x458, 0x459, 0x45a, 0x45b, 0x45c, 0x45d, 0x45e, 0x45f, 0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43a, 0x43b, 0x43c, 0x43d, 0x43e, 0x43f, 0x440, 0x441, 0x442, 0x443, 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44a, 0x44b, 0x44c, 0x44d, 0x44e, 0x44f, 0x461, 0x463, 0x465, 0x467, 0x469, 0x46b, 0x46d, 0x46f, 0x471, 0x473, 0x475, 0x477, 0x479, 0x47b, 0x47d, 0x47f, 0x481, 0x48b, 0x48d, 0x48f, 0x491, 0x493, 0x495, 0x497, 0x499, 0x49b, 0x49d, 0x49f, 0x4a1, 0x4a3, 0x4a5, 0x4a7, 0x4a9, 0x4ab, 0x4ad, 0x4af, 0x4b1, 0x4b3, 0x4b5, 0x4b7, 0x4b9, 0x4bb, 0x4bd, 0x4bf, 0x4cf, 0x4c2, 0x4c4, 0x4c6, 0x4c8, 0x4ca, 0x4cc, 0x4ce, 0x4d1, 0x4d3, 0x4d5, 0x4d7, 0x4d9, 0x4db, 0x4dd, 0x4df, 0x4e1, 0x4e3, 0x4e5, 0x4e7, 0x4e9, 0x4eb, 0x4ed, 0x4ef, 0x4f1, 0x4f3, 0x4f5, 0x4f7, 0x4f9, 0x4fb, 0x4fd, 0x4ff, 0x501, 0x503, 0x505, 0x507, 0x509, 0x50b, 0x50d, 0x50f, 0x511, 0x513, 0x515, 0x517, 0x519, 0x51b, 0x51d, 0x51f, 0x521, 0x523, 0x525, 0x527, 0x561, 0x562, 0x563, 0x564, 0x565, 0x566, 0x567, 0x568, 0x569, 0x56a, 0x56b, 0x56c, 0x56d, 0x56e, 0x56f, 0x570, 0x571, 0x572, 0x573, 0x574, 0x575, 0x576, 0x577, 0x578, 0x579, 0x57a, 0x57b, 0x57c, 0x57d, 0x57e, 0x57f, 0x580, 0x581, 0x582, 0x583, 0x584, 0x585, 0x586, 0x2d00, 0x2d01, 0x2d02, 0x2d03, 0x2d04, 0x2d05, 0x2d06, 0x2d07, 0x2d08, 0x2d09, 0x2d0a, 0x2d0b, 0x2d0c, 0x2d0d, 0x2d0e, 0x2d0f, 0x2d10, 0x2d11, 0x2d12, 0x2d13, 0x2d14, 0x2d15, 0x2d16, 0x2d17, 0x2d18, 0x2d19, 0x2d1a, 0x2d1b, 0x2d1c, 0x2d1d, 0x2d1e, 0x2d1f, 0x2d20, 0x2d21, 0x2d22, 0x2d23, 0x2d24, 0x2d25, 0x2d27, 0x2d2d, 0x1e01, 0x1e03, 0x1e05, 0x1e07, 0x1e09, 0x1e0b, 0x1e0d, 0x1e0f, 0x1e11, 0x1e13, 0x1e15, 0x1e17, 0x1e19, 0x1e1b, 0x1e1d, 0x1e1f, 0x1e21, 0x1e23, 0x1e25, 0x1e27, 0x1e29, 0x1e2b, 0x1e2d, 0x1e2f, 0x1e31, 0x1e33, 0x1e35, 0x1e37, 0x1e39, 0x1e3b, 0x1e3d, 0x1e3f, 0x1e41, 0x1e43, 0x1e45, 0x1e47, 0x1e49, 0x1e4b, 0x1e4d, 0x1e4f, 0x1e51, 0x1e53, 0x1e55, 0x1e57, 0x1e59, 0x1e5b, 0x1e5d, 0x1e5f, 0x1e61, 0x1e63, 0x1e65, 0x1e67, 0x1e69, 0x1e6b, 0x1e6d, 0x1e6f, 0x1e71, 0x1e73, 0x1e75, 0x1e77, 0x1e79, 0x1e7b, 0x1e7d, 0x1e7f, 0x1e81, 0x1e83, 0x1e85, 0x1e87, 0x1e89, 0x1e8b, 0x1e8d, 0x1e8f, 0x1e91, 0x1e93, 0x1e95, 0xdf, 0x1ea1, 0x1ea3, 0x1ea5, 0x1ea7, 0x1ea9, 0x1eab, 0x1ead, 0x1eaf, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eb7, 0x1eb9, 0x1ebb, 0x1ebd, 0x1ebf, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ec9, 0x1ecb, 0x1ecd, 0x1ecf, 0x1ed1, 0x1ed3, 0x1ed5, 0x1ed7, 0x1ed9, 0x1edb, 0x1edd, 0x1edf, 0x1ee1, 0x1ee3, 0x1ee5, 0x1ee7, 0x1ee9, 0x1eeb, 0x1eed, 0x1eef, 0x1ef1, 0x1ef3, 0x1ef5, 0x1ef7, 0x1ef9, 0x1efb, 0x1efd, 0x1eff, 0x1f00, 0x1f01, 0x1f02, 0x1f03, 0x1f04, 0x1f05, 0x1f06, 0x1f07, 0x1f10, 0x1f11, 0x1f12, 0x1f13, 0x1f14, 0x1f15, 0x1f20, 0x1f21, 0x1f22, 0x1f23, 0x1f24, 0x1f25, 0x1f26, 0x1f27, 0x1f30, 0x1f31, 0x1f32, 0x1f33, 0x1f34, 0x1f35, 0x1f36, 0x1f37, 0x1f40, 0x1f41, 0x1f42, 0x1f43, 0x1f44, 0x1f45, 0x1f51, 0x1f53, 0x1f55, 0x1f57, 0x1f60, 0x1f61, 0x1f62, 0x1f63, 0x1f64, 0x1f65, 0x1f66, 0x1f67, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fb0, 0x1fb1, 0x1f70, 0x1f71, 0x1fb3, 0x1f72, 0x1f73, 0x1f74, 0x1f75, 0x1fc3, 0x1fd0, 0x1fd1, 0x1f76, 0x1f77, 0x1fe0, 0x1fe1, 0x1f7a, 0x1f7b, 0x1fe5, 0x1f78, 0x1f79, 0x1f7c, 0x1f7d, 0x1ff3, 0x3c9, 0x6b, 0xe5, 0x214e, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217a, 0x217b, 0x217c, 0x217d, 0x217e, 0x217f, 0x2184, 0x24d0, 0x24d1, 0x24d2, 0x24d3, 0x24d4, 0x24d5, 0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, 0x24dc, 0x24dd, 0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, 0x24e4, 0x24e5, 0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x2c30, 0x2c31, 0x2c32, 0x2c33, 0x2c34, 0x2c35, 0x2c36, 0x2c37, 0x2c38, 0x2c39, 0x2c3a, 0x2c3b, 0x2c3c, 0x2c3d, 0x2c3e, 0x2c3f, 0x2c40, 0x2c41, 0x2c42, 0x2c43, 0x2c44, 0x2c45, 0x2c46, 0x2c47, 0x2c48, 0x2c49, 0x2c4a, 0x2c4b, 0x2c4c, 0x2c4d, 0x2c4e, 0x2c4f, 0x2c50, 0x2c51, 0x2c52, 0x2c53, 0x2c54, 0x2c55, 0x2c56, 0x2c57, 0x2c58, 0x2c59, 0x2c5a, 0x2c5b, 0x2c5c, 0x2c5d, 0x2c5e, 0x2c61, 0x26b, 0x1d7d, 0x27d, 0x2c68, 0x2c6a, 0x2c6c, 0x251, 0x271, 0x250, 0x252, 0x2c73, 0x2c76, 0x23f, 0x240, 0x2c81, 0x2c83, 0x2c85, 0x2c87, 0x2c89, 0x2c8b, 0x2c8d, 0x2c8f, 0x2c91, 0x2c93, 0x2c95, 0x2c97, 0x2c99, 0x2c9b, 0x2c9d, 0x2c9f, 0x2ca1, 0x2ca3, 0x2ca5, 0x2ca7, 0x2ca9, 0x2cab, 0x2cad, 0x2caf, 0x2cb1, 0x2cb3, 0x2cb5, 0x2cb7, 0x2cb9, 0x2cbb, 0x2cbd, 0x2cbf, 0x2cc1, 0x2cc3, 0x2cc5, 0x2cc7, 0x2cc9, 0x2ccb, 0x2ccd, 0x2ccf, 0x2cd1, 0x2cd3, 0x2cd5, 0x2cd7, 0x2cd9, 0x2cdb, 0x2cdd, 0x2cdf, 0x2ce1, 0x2ce3, 0x2cec, 0x2cee, 0x2cf3, 0xa641, 0xa643, 0xa645, 0xa647, 0xa649, 0xa64b, 0xa64d, 0xa64f, 0xa651, 0xa653, 0xa655, 0xa657, 0xa659, 0xa65b, 0xa65d, 0xa65f, 0xa661, 0xa663, 0xa665, 0xa667, 0xa669, 0xa66b, 0xa66d, 0xa681, 0xa683, 0xa685, 0xa687, 0xa689, 0xa68b, 0xa68d, 0xa68f, 0xa691, 0xa693, 0xa695, 0xa697, 0xa723, 0xa725, 0xa727, 0xa729, 0xa72b, 0xa72d, 0xa72f, 0xa733, 0xa735, 0xa737, 0xa739, 0xa73b, 0xa73d, 0xa73f, 0xa741, 0xa743, 0xa745, 0xa747, 0xa749, 0xa74b, 0xa74d, 0xa74f, 0xa751, 0xa753, 0xa755, 0xa757, 0xa759, 0xa75b, 0xa75d, 0xa75f, 0xa761, 0xa763, 0xa765, 0xa767, 0xa769, 0xa76b, 0xa76d, 0xa76f, 0xa77a, 0xa77c, 0x1d79, 0xa77f, 0xa781, 0xa783, 0xa785, 0xa787, 0xa78c, 0x265, 0xa791, 0xa793, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0x266, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0x10428, 0x10429, 0x1042a, 0x1042b, 0x1042c, 0x1042d, 0x1042e, 0x1042f, 0x10430, 0x10431, 0x10432, 0x10433, 0x10434, 0x10435, 0x10436, 0x10437, 0x10438, 0x10439, 0x1043a, 0x1043b, 0x1043c, 0x1043d, 0x1043e, 0x1043f, 0x10440, 0x10441, 0x10442, 0x10443, 0x10444, 0x10445, 0x10446, 0x10447, 0x10448, 0x10449, 0x1044a, 0x1044b, 0x1044c, 0x1044d, 0x1044e, 0x1044f, 0xdf, 0x2000069, 0x307, 0xfb00, 0xfb01, 0xfb02, 0xfb03, 0xfb04, 0xfb05, 0xfb06, 0x587, 0xfb13, 0xfb14, 0xfb15, 0xfb16, 0xfb17, 0x149, 0x390, 0x3b0, 0x1f0, 0x1e96, 0x1e97, 0x1e98, 0x1e99, 0x1e9a, 0x1f50, 0x1f52, 0x1f54, 0x1f56, 0x1fb6, 0x1fc6, 0x1fd2, 0x1fd3, 0x1fd6, 0x1fd7, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe6, 0x1fe7, 0x1ff6, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7, 0x1fb3, 0x1fb3, 0x1fc3, 0x1fc3, 0x1ff3, 0x1ff3, 0x1fb2, 0x1fb4, 0x1fc2, 0x1fc4, 0x1ff2, 0x1ff4, 0x1fb7, 0x1fc7, 0x1ff7]; return t; } -+_IUA toTitleTable() { static _IUA t = [ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x39c, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11a, 0x11c, 0x11e, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12a, 0x12c, 0x12e, 0x49, 0x132, 0x134, 0x136, 0x139, 0x13b, 0x13d, 0x13f, 0x141, 0x143, 0x145, 0x147, 0x14a, 0x14c, 0x14e, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15a, 0x15c, 0x15e, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16a, 0x16c, 0x16e, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17b, 0x17d, 0x53, 0x243, 0x182, 0x184, 0x187, 0x18b, 0x191, 0x1f6, 0x198, 0x23d, 0x220, 0x1a0, 0x1a2, 0x1a4, 0x1a7, 0x1ac, 0x1af, 0x1b3, 0x1b5, 0x1b8, 0x1bc, 0x1f7, 0x1c5, 0x1c5, 0x1c5, 0x1c8, 0x1c8, 0x1c8, 0x1cb, 0x1cb, 0x1cb, 0x1cd, 0x1cf, 0x1d1, 0x1d3, 0x1d5, 0x1d7, 0x1d9, 0x1db, 0x18e, 0x1de, 0x1e0, 0x1e2, 0x1e4, 0x1e6, 0x1e8, 0x1ea, 0x1ec, 0x1ee, 0x1f2, 0x1f2, 0x1f2, 0x1f4, 0x1f8, 0x1fa, 0x1fc, 0x1fe, 0x200, 0x202, 0x204, 0x206, 0x208, 0x20a, 0x20c, 0x20e, 0x210, 0x212, 0x214, 0x216, 0x218, 0x21a, 0x21c, 0x21e, 0x222, 0x224, 0x226, 0x228, 0x22a, 0x22c, 0x22e, 0x230, 0x232, 0x23b, 0x2c7e, 0x2c7f, 0x241, 0x246, 0x248, 0x24a, 0x24c, 0x24e, 0x2c6f, 0x2c6d, 0x2c70, 0x181, 0x186, 0x189, 0x18a, 0x18f, 0x190, 0x193, 0x194, 0xa78d, 0xa7aa, 0x197, 0x196, 0x2c62, 0x19c, 0x2c6e, 0x19d, 0x19f, 0x2c64, 0x1a6, 0x1a9, 0x1ae, 0x244, 0x1b1, 0x1b2, 0x245, 0x1b7, 0x399, 0x370, 0x372, 0x376, 0x3fd, 0x3fe, 0x3ff, 0x386, 0x388, 0x389, 0x38a, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b, 0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9, 0x3aa, 0x3ab, 0x38c, 0x38e, 0x38f, 0x392, 0x398, 0x3a6, 0x3a0, 0x3cf, 0x3d8, 0x3da, 0x3dc, 0x3de, 0x3e0, 0x3e2, 0x3e4, 0x3e6, 0x3e8, 0x3ea, 0x3ec, 0x3ee, 0x39a, 0x3a1, 0x3f9, 0x395, 0x3f7, 0x3fa, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, 0x460, 0x462, 0x464, 0x466, 0x468, 0x46a, 0x46c, 0x46e, 0x470, 0x472, 0x474, 0x476, 0x478, 0x47a, 0x47c, 0x47e, 0x480, 0x48a, 0x48c, 0x48e, 0x490, 0x492, 0x494, 0x496, 0x498, 0x49a, 0x49c, 0x49e, 0x4a0, 0x4a2, 0x4a4, 0x4a6, 0x4a8, 0x4aa, 0x4ac, 0x4ae, 0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba, 0x4bc, 0x4be, 0x4c1, 0x4c3, 0x4c5, 0x4c7, 0x4c9, 0x4cb, 0x4cd, 0x4c0, 0x4d0, 0x4d2, 0x4d4, 0x4d6, 0x4d8, 0x4da, 0x4dc, 0x4de, 0x4e0, 0x4e2, 0x4e4, 0x4e6, 0x4e8, 0x4ea, 0x4ec, 0x4ee, 0x4f0, 0x4f2, 0x4f4, 0x4f6, 0x4f8, 0x4fa, 0x4fc, 0x4fe, 0x500, 0x502, 0x504, 0x506, 0x508, 0x50a, 0x50c, 0x50e, 0x510, 0x512, 0x514, 0x516, 0x518, 0x51a, 0x51c, 0x51e, 0x520, 0x522, 0x524, 0x526, 0x531, 0x532, 0x533, 0x534, 0x535, 0x536, 0x537, 0x538, 0x539, 0x53a, 0x53b, 0x53c, 0x53d, 0x53e, 0x53f, 0x540, 0x541, 0x542, 0x543, 0x544, 0x545, 0x546, 0x547, 0x548, 0x549, 0x54a, 0x54b, 0x54c, 0x54d, 0x54e, 0x54f, 0x550, 0x551, 0x552, 0x553, 0x554, 0x555, 0x556, 0xa77d, 0x2c63, 0x1e00, 0x1e02, 0x1e04, 0x1e06, 0x1e08, 0x1e0a, 0x1e0c, 0x1e0e, 0x1e10, 0x1e12, 0x1e14, 0x1e16, 0x1e18, 0x1e1a, 0x1e1c, 0x1e1e, 0x1e20, 0x1e22, 0x1e24, 0x1e26, 0x1e28, 0x1e2a, 0x1e2c, 0x1e2e, 0x1e30, 0x1e32, 0x1e34, 0x1e36, 0x1e38, 0x1e3a, 0x1e3c, 0x1e3e, 0x1e40, 0x1e42, 0x1e44, 0x1e46, 0x1e48, 0x1e4a, 0x1e4c, 0x1e4e, 0x1e50, 0x1e52, 0x1e54, 0x1e56, 0x1e58, 0x1e5a, 0x1e5c, 0x1e5e, 0x1e60, 0x1e62, 0x1e64, 0x1e66, 0x1e68, 0x1e6a, 0x1e6c, 0x1e6e, 0x1e70, 0x1e72, 0x1e74, 0x1e76, 0x1e78, 0x1e7a, 0x1e7c, 0x1e7e, 0x1e80, 0x1e82, 0x1e84, 0x1e86, 0x1e88, 0x1e8a, 0x1e8c, 0x1e8e, 0x1e90, 0x1e92, 0x1e94, 0x1e60, 0x1ea0, 0x1ea2, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eaa, 0x1eac, 0x1eae, 0x1eb0, 0x1eb2, 0x1eb4, 0x1eb6, 0x1eb8, 0x1eba, 0x1ebc, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ec8, 0x1eca, 0x1ecc, 0x1ece, 0x1ed0, 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1eda, 0x1edc, 0x1ede, 0x1ee0, 0x1ee2, 0x1ee4, 0x1ee6, 0x1ee8, 0x1eea, 0x1eec, 0x1eee, 0x1ef0, 0x1ef2, 0x1ef4, 0x1ef6, 0x1ef8, 0x1efa, 0x1efc, 0x1efe, 0x1f08, 0x1f09, 0x1f0a, 0x1f0b, 0x1f0c, 0x1f0d, 0x1f0e, 0x1f0f, 0x1f18, 0x1f19, 0x1f1a, 0x1f1b, 0x1f1c, 0x1f1d, 0x1f28, 0x1f29, 0x1f2a, 0x1f2b, 0x1f2c, 0x1f2d, 0x1f2e, 0x1f2f, 0x1f38, 0x1f39, 0x1f3a, 0x1f3b, 0x1f3c, 0x1f3d, 0x1f3e, 0x1f3f, 0x1f48, 0x1f49, 0x1f4a, 0x1f4b, 0x1f4c, 0x1f4d, 0x1f59, 0x1f5b, 0x1f5d, 0x1f5f, 0x1f68, 0x1f69, 0x1f6a, 0x1f6b, 0x1f6c, 0x1f6d, 0x1f6e, 0x1f6f, 0x1fba, 0x1fbb, 0x1fc8, 0x1fc9, 0x1fca, 0x1fcb, 0x1fda, 0x1fdb, 0x1ff8, 0x1ff9, 0x1fea, 0x1feb, 0x1ffa, 0x1ffb, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fb8, 0x1fb9, 0x1fbc, 0x399, 0x1fcc, 0x1fd8, 0x1fd9, 0x1fe8, 0x1fe9, 0x1fec, 0x1ffc, 0x2132, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0x216c, 0x216d, 0x216e, 0x216f, 0x2183, 0x24b6, 0x24b7, 0x24b8, 0x24b9, 0x24ba, 0x24bb, 0x24bc, 0x24bd, 0x24be, 0x24bf, 0x24c0, 0x24c1, 0x24c2, 0x24c3, 0x24c4, 0x24c5, 0x24c6, 0x24c7, 0x24c8, 0x24c9, 0x24ca, 0x24cb, 0x24cc, 0x24cd, 0x24ce, 0x24cf, 0x2c00, 0x2c01, 0x2c02, 0x2c03, 0x2c04, 0x2c05, 0x2c06, 0x2c07, 0x2c08, 0x2c09, 0x2c0a, 0x2c0b, 0x2c0c, 0x2c0d, 0x2c0e, 0x2c0f, 0x2c10, 0x2c11, 0x2c12, 0x2c13, 0x2c14, 0x2c15, 0x2c16, 0x2c17, 0x2c18, 0x2c19, 0x2c1a, 0x2c1b, 0x2c1c, 0x2c1d, 0x2c1e, 0x2c1f, 0x2c20, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c27, 0x2c28, 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c60, 0x23a, 0x23e, 0x2c67, 0x2c69, 0x2c6b, 0x2c72, 0x2c75, 0x2c80, 0x2c82, 0x2c84, 0x2c86, 0x2c88, 0x2c8a, 0x2c8c, 0x2c8e, 0x2c90, 0x2c92, 0x2c94, 0x2c96, 0x2c98, 0x2c9a, 0x2c9c, 0x2c9e, 0x2ca0, 0x2ca2, 0x2ca4, 0x2ca6, 0x2ca8, 0x2caa, 0x2cac, 0x2cae, 0x2cb0, 0x2cb2, 0x2cb4, 0x2cb6, 0x2cb8, 0x2cba, 0x2cbc, 0x2cbe, 0x2cc0, 0x2cc2, 0x2cc4, 0x2cc6, 0x2cc8, 0x2cca, 0x2ccc, 0x2cce, 0x2cd0, 0x2cd2, 0x2cd4, 0x2cd6, 0x2cd8, 0x2cda, 0x2cdc, 0x2cde, 0x2ce0, 0x2ce2, 0x2ceb, 0x2ced, 0x2cf2, 0x10a0, 0x10a1, 0x10a2, 0x10a3, 0x10a4, 0x10a5, 0x10a6, 0x10a7, 0x10a8, 0x10a9, 0x10aa, 0x10ab, 0x10ac, 0x10ad, 0x10ae, 0x10af, 0x10b0, 0x10b1, 0x10b2, 0x10b3, 0x10b4, 0x10b5, 0x10b6, 0x10b7, 0x10b8, 0x10b9, 0x10ba, 0x10bb, 0x10bc, 0x10bd, 0x10be, 0x10bf, 0x10c0, 0x10c1, 0x10c2, 0x10c3, 0x10c4, 0x10c5, 0x10c7, 0x10cd, 0xa640, 0xa642, 0xa644, 0xa646, 0xa648, 0xa64a, 0xa64c, 0xa64e, 0xa650, 0xa652, 0xa654, 0xa656, 0xa658, 0xa65a, 0xa65c, 0xa65e, 0xa660, 0xa662, 0xa664, 0xa666, 0xa668, 0xa66a, 0xa66c, 0xa680, 0xa682, 0xa684, 0xa686, 0xa688, 0xa68a, 0xa68c, 0xa68e, 0xa690, 0xa692, 0xa694, 0xa696, 0xa722, 0xa724, 0xa726, 0xa728, 0xa72a, 0xa72c, 0xa72e, 0xa732, 0xa734, 0xa736, 0xa738, 0xa73a, 0xa73c, 0xa73e, 0xa740, 0xa742, 0xa744, 0xa746, 0xa748, 0xa74a, 0xa74c, 0xa74e, 0xa750, 0xa752, 0xa754, 0xa756, 0xa758, 0xa75a, 0xa75c, 0xa75e, 0xa760, 0xa762, 0xa764, 0xa766, 0xa768, 0xa76a, 0xa76c, 0xa76e, 0xa779, 0xa77b, 0xa77e, 0xa780, 0xa782, 0xa784, 0xa786, 0xa78b, 0xa790, 0xa792, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407, 0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f, 0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417, 0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f, 0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427, 0x2000053, 0x73, 0x130, 0x2000046, 0x66, 0x2000046, 0x69, 0x2000046, 0x6c, 0x3000046, 0x66, 0x69, 0x3000046, 0x66, 0x6c, 0x2000053, 0x74, 0x2000053, 0x74, 0x2000535, 0x582, 0x2000544, 0x576, 0x2000544, 0x565, 0x2000544, 0x56b, 0x200054e, 0x576, 0x2000544, 0x56d, 0x20002bc, 0x4e, 0x3000399, 0x308, 0x301, 0x30003a5, 0x308, 0x301, 0x200004a, 0x30c, 0x2000048, 0x331, 0x2000054, 0x308, 0x2000057, 0x30a, 0x2000059, 0x30a, 0x2000041, 0x2be, 0x20003a5, 0x313, 0x30003a5, 0x313, 0x300, 0x30003a5, 0x313, 0x301, 0x30003a5, 0x313, 0x342, 0x2000391, 0x342, 0x2000397, 0x342, 0x3000399, 0x308, 0x300, 0x3000399, 0x308, 0x301, 0x2000399, 0x342, 0x3000399, 0x308, 0x342, 0x30003a5, 0x308, 0x300, 0x30003a5, 0x308, 0x301, 0x20003a1, 0x313, 0x20003a5, 0x342, 0x30003a5, 0x308, 0x342, 0x20003a9, 0x342, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fbc, 0x1fbc, 0x1fcc, 0x1fcc, 0x1ffc, 0x1ffc, 0x2001fba, 0x345, 0x2000386, 0x345, 0x2001fca, 0x345, 0x2000389, 0x345, 0x2001ffa, 0x345, 0x200038f, 0x345, 0x3000391, 0x342, 0x345, 0x3000397, 0x342, 0x345, 0x30003a9, 0x342, 0x345]; return t; } -+} -+ -+} -+ ---- a/src/libphobos/src/std/json.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/json.d 2014-04-01 16:32:51.000000000 +0100 -@@ -22,486 +22,598 @@ import std.conv; - import std.range; - import std.utf; - --private { -- // Prevent conflicts from these generic names -- alias std.utf.stride UTFStride; -- alias std.utf.decode toUnicode; -+private -+{ -+ // Prevent conflicts from these generic names -+ alias std.utf.stride UTFStride; -+ alias std.utf.decode toUnicode; - } - - /** -- JSON type enumeration -+JSON type enumeration - */ --enum JSON_TYPE : byte { -- /// Indicates the type of a $(D JSONValue). -- STRING, -- INTEGER, /// ditto -- UINTEGER,/// integers > 2^63-1 -- FLOAT, /// ditto -- OBJECT, /// ditto -- ARRAY, /// ditto -- TRUE, /// ditto -- FALSE, /// ditto -- NULL /// ditto -+enum JSON_TYPE : byte -+{ -+ /// Indicates the type of a $(D JSONValue). -+ STRING, -+ INTEGER, /// ditto -+ UINTEGER,/// integers > 2^63-1 -+ FLOAT, /// ditto -+ OBJECT, /// ditto -+ ARRAY, /// ditto -+ TRUE, /// ditto -+ FALSE, /// ditto -+ NULL /// ditto - } - - /** -- JSON value node -+JSON value node - */ --struct JSONValue { -- union { -- /// Value when $(D type) is $(D JSON_TYPE.STRING) -- string str; -- /// Value when $(D type) is $(D JSON_TYPE.INTEGER) -- long integer; -- /// Value when $(D type) is $(D JSON_TYPE.UINTEGER) -- ulong uinteger; -- /// Value when $(D type) is $(D JSON_TYPE.FLOAT) -- real floating; -- /// Value when $(D type) is $(D JSON_TYPE.OBJECT) -- JSONValue[string] object; -- /// Value when $(D type) is $(D JSON_TYPE.ARRAY) -- JSONValue[] array; -- } -- /// Specifies the _type of the value stored in this structure. -- JSON_TYPE type; -- -- /// array syntax for json arrays -- ref JSONValue opIndex(size_t i) -- in { assert(type == JSON_TYPE.ARRAY, "json type is not array"); } -- body -- { -- return array[i]; -- } -- -- /// hash syntax for json objects -- ref JSONValue opIndex(string k) -- in { assert(type == JSON_TYPE.OBJECT, "json type is not object"); } -- body -- { -- return object[k]; -- } -+struct JSONValue -+{ -+ union -+ { -+ /// Value when $(D type) is $(D JSON_TYPE.STRING) -+ string str; -+ /// Value when $(D type) is $(D JSON_TYPE.INTEGER) -+ long integer; -+ /// Value when $(D type) is $(D JSON_TYPE.UINTEGER) -+ ulong uinteger; -+ /// Value when $(D type) is $(D JSON_TYPE.FLOAT) -+ real floating; -+ /// Value when $(D type) is $(D JSON_TYPE.OBJECT) -+ JSONValue[string] object; -+ /// Value when $(D type) is $(D JSON_TYPE.ARRAY) -+ JSONValue[] array; -+ } -+ /// Specifies the _type of the value stored in this structure. -+ JSON_TYPE type; -+ -+ /// array syntax for json arrays -+ ref JSONValue opIndex(size_t i) -+ in { assert(type == JSON_TYPE.ARRAY, "json type is not array"); } -+ body -+ { -+ return array[i]; -+ } -+ -+ /// hash syntax for json objects -+ ref JSONValue opIndex(string k) -+ in { assert(type == JSON_TYPE.OBJECT, "json type is not object"); } -+ body -+ { -+ return object[k]; -+ } - } - - /** -- Parses a serialized string and returns a tree of JSON values. -+Parses a serialized string and returns a tree of JSON values. - */ --JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) { -- JSONValue root = void; -- root.type = JSON_TYPE.NULL; -+JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) -+{ -+ JSONValue root = void; -+ root.type = JSON_TYPE.NULL; - -- if(json.empty) return root; -+ if(json.empty) return root; - -- int depth = -1; -- dchar next = 0; -- int line = 1, pos = 1; -+ int depth = -1; -+ dchar next = 0; -+ int line = 1, pos = 1; - -- void error(string msg) { -- throw new JSONException(msg, line, pos); -- } -- -- dchar peekChar() { -- if(!next) { -- if(json.empty) return '\0'; -- next = json.front; -- json.popFront(); -- } -- return next; -- } -+ void error(string msg) -+ { -+ throw new JSONException(msg, line, pos); -+ } - -- void skipWhitespace() { -- while(isWhite(peekChar())) next = 0; -+ dchar peekChar() -+ { -+ if(!next) -+ { -+ if(json.empty) return '\0'; -+ next = json.front; -+ json.popFront(); - } -+ return next; -+ } - -- dchar getChar(bool SkipWhitespace = false)() { -- static if(SkipWhitespace) skipWhitespace(); -- -- dchar c = void; -- if(next) { -- c = next; -- next = 0; -- } -- else { -- if(json.empty) error("Unexpected end of data."); -- c = json.front; -- json.popFront(); -- } -+ void skipWhitespace() -+ { -+ while(isWhite(peekChar())) next = 0; -+ } - -- if(c == '\n' || (c == '\r' && peekChar() != '\n')) { -- line++; -- pos = 1; -- } -- else { -- pos++; -- } -+ dchar getChar(bool SkipWhitespace = false)() -+ { -+ static if(SkipWhitespace) skipWhitespace(); - -- return c; -+ dchar c = void; -+ if(next) -+ { -+ c = next; -+ next = 0; -+ } -+ else -+ { -+ if(json.empty) error("Unexpected end of data."); -+ c = json.front; -+ json.popFront(); - } - -- void checkChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) { -- static if(SkipWhitespace) skipWhitespace(); -- auto c2 = getChar(); -- static if(!CaseSensitive) c2 = toLower(c2); -- -- if(c2 != c) error(text("Found '", c2, "' when expecting '", c, "'.")); -+ if(c == '\n' || (c == '\r' && peekChar() != '\n')) -+ { -+ line++; -+ pos = 1; -+ } -+ else -+ { -+ pos++; - } - -- bool testChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) -+ return c; -+ } -+ -+ void checkChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) - { -- static if(SkipWhitespace) skipWhitespace(); -- auto c2 = peekChar(); -- static if (!CaseSensitive) c2 = toLower(c2); -+ static if(SkipWhitespace) skipWhitespace(); -+ auto c2 = getChar(); -+ static if(!CaseSensitive) c2 = toLower(c2); - -- if(c2 != c) return false; -+ if(c2 != c) error(text("Found '", c2, "' when expecting '", c, "'.")); -+ } - -- getChar(); -- return true; -- } -+ bool testChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) -+ { -+ static if(SkipWhitespace) skipWhitespace(); -+ auto c2 = peekChar(); -+ static if (!CaseSensitive) c2 = toLower(c2); - -- string parseString() { -- auto str = appender!string(); -+ if(c2 != c) return false; - -- Next: -- switch(peekChar()) { -- case '"': -- getChar(); -- break; -+ getChar(); -+ return true; -+ } - -- case '\\': -- getChar(); -- auto c = getChar(); -- switch(c) { -- case '"': str.put('"'); break; -- case '\\': str.put('\\'); break; -- case '/': str.put('/'); break; -- case 'b': str.put('\b'); break; -- case 'f': str.put('\f'); break; -- case 'n': str.put('\n'); break; -- case 'r': str.put('\r'); break; -- case 't': str.put('\t'); break; -- case 'u': -- dchar val = 0; -- foreach_reverse(i; 0 .. 4) { -- auto hex = toUpper(getChar()); -- if(!isHexDigit(hex)) error("Expecting hex character"); -- val += (isDigit(hex) ? hex - '0' : hex - ('A' - 10)) << (4 * i); -- } -- char[4] buf = void; -- str.put(toUTF8(buf, val)); -- break; -+ string parseString() -+ { -+ auto str = appender!string(); - -- default: -- error(text("Invalid escape sequence '\\", c, "'.")); -+ Next: -+ switch(peekChar()) -+ { -+ case '"': -+ getChar(); -+ break; -+ -+ case '\\': -+ getChar(); -+ auto c = getChar(); -+ switch(c) -+ { -+ case '"': str.put('"'); break; -+ case '\\': str.put('\\'); break; -+ case '/': str.put('/'); break; -+ case 'b': str.put('\b'); break; -+ case 'f': str.put('\f'); break; -+ case 'n': str.put('\n'); break; -+ case 'r': str.put('\r'); break; -+ case 't': str.put('\t'); break; -+ case 'u': -+ dchar val = 0; -+ foreach_reverse(i; 0 .. 4) -+ { -+ auto hex = toUpper(getChar()); -+ if(!isHexDigit(hex)) error("Expecting hex character"); -+ val += (isDigit(hex) ? hex - '0' : hex - ('A' - 10)) << (4 * i); - } -- goto Next; -+ char[4] buf = void; -+ str.put(toUTF8(buf, val)); -+ break; - -- default: -- auto c = getChar(); -- appendJSONChar(&str, c, &error); -- goto Next; -+ default: -+ error(text("Invalid escape sequence '\\", c, "'.")); - } -+ goto Next; - -- return str.data; -+ default: -+ auto c = getChar(); -+ appendJSONChar(&str, c, &error); -+ goto Next; - } - -- void parseValue(JSONValue* value) { -- depth++; -- -- if(maxDepth != -1 && depth > maxDepth) error("Nesting too deep."); -+ return str.data ? str.data : ""; -+ } - -- auto c = getChar!true(); -+ void parseValue(JSONValue* value) -+ { -+ depth++; - -- switch(c) { -- case '{': -- value.type = JSON_TYPE.OBJECT; -- value.object = null; -+ if(maxDepth != -1 && depth > maxDepth) error("Nesting too deep."); - -- if(testChar('}')) break; -+ auto c = getChar!true(); - -- do { -- checkChar('"'); -- string name = parseString(); -- checkChar(':'); -- JSONValue member = void; -- parseValue(&member); -- value.object[name] = member; -- } while(testChar(',')); -+ switch(c) -+ { -+ case '{': -+ value.type = JSON_TYPE.OBJECT; -+ value.object = null; - -- checkChar('}'); -- break; -+ if(testChar('}')) break; - -- case '[': -- value.type = JSON_TYPE.ARRAY; -- value.array = null; -- -- if(testChar(']')) break; -- -- do { -- JSONValue element = void; -- parseValue(&element); -- value.array ~= element; -- } while(testChar(',')); -+ do -+ { -+ checkChar('"'); -+ string name = parseString(); -+ checkChar(':'); -+ JSONValue member = void; -+ parseValue(&member); -+ value.object[name] = member; -+ } -+ while(testChar(',')); - -- checkChar(']'); -- break; -+ checkChar('}'); -+ break; - -- case '"': -- value.type = JSON_TYPE.STRING; -- value.str = parseString(); -- break; -+ case '[': -+ value.type = JSON_TYPE.ARRAY; - -- case '0': .. case '9': -- case '-': -- auto number = appender!string(); -- bool isFloat, isNegative; -- -- void readInteger() { -- if(!isDigit(c)) error("Digit expected"); -- -- Next: number.put(c); -- -- if(isDigit(peekChar())) { -- c = getChar(); -- goto Next; -- } -- } -+ if(testChar(']')) -+ { -+ value.array = cast(JSONValue[]) ""; -+ break; -+ } - -- if(c == '-') { -- number.put('-'); -- c = getChar(); -- isNegative = true; -- } -+ value.array = null; - -- readInteger(); -+ do -+ { -+ JSONValue element = void; -+ parseValue(&element); -+ value.array ~= element; -+ } -+ while(testChar(',')); - -- if(testChar('.')) { -- isFloat = true; -- number.put('.'); -- c = getChar(); -- readInteger(); -- } -- if(testChar!(false, false)('e')) { -- isFloat = true; -- number.put('e'); -- if(testChar('+')) number.put('+'); -- else if(testChar('-')) number.put('-'); -- c = getChar(); -- readInteger(); -- } -+ checkChar(']'); -+ break; - -- string data = number.data; -- if(isFloat) { -- value.type = JSON_TYPE.FLOAT; -- value.floating = parse!real(data); -- } -- else { -- if (isNegative) -- value.integer = parse!long(data); -- else -- value.uinteger = parse!ulong(data); -- value.type = !isNegative && value.uinteger & (1UL << 63) ? JSON_TYPE.UINTEGER : JSON_TYPE.INTEGER; -- } -- break; -+ case '"': -+ value.type = JSON_TYPE.STRING; -+ value.str = parseString(); -+ break; - -- case 't': -- case 'T': -- value.type = JSON_TYPE.TRUE; -- checkChar!(false, false)('r'); -- checkChar!(false, false)('u'); -- checkChar!(false, false)('e'); -- break; -+ case '0': .. case '9': -+ case '-': -+ auto number = appender!string(); -+ bool isFloat, isNegative; - -- case 'f': -- case 'F': -- value.type = JSON_TYPE.FALSE; -- checkChar!(false, false)('a'); -- checkChar!(false, false)('l'); -- checkChar!(false, false)('s'); -- checkChar!(false, false)('e'); -- break; -+ void readInteger() -+ { -+ if(!isDigit(c)) error("Digit expected"); - -- case 'n': -- case 'N': -- value.type = JSON_TYPE.NULL; -- checkChar!(false, false)('u'); -- checkChar!(false, false)('l'); -- checkChar!(false, false)('l'); -- break; -+ Next: number.put(c); - -- default: -- error(text("Unexpected character '", c, "'.")); -+ if(isDigit(peekChar())) -+ { -+ c = getChar(); -+ goto Next; -+ } - } - -- depth--; -+ if(c == '-') -+ { -+ number.put('-'); -+ c = getChar(); -+ isNegative = true; -+ } -+ -+ readInteger(); -+ -+ if(testChar('.')) -+ { -+ isFloat = true; -+ number.put('.'); -+ c = getChar(); -+ readInteger(); -+ } -+ if(testChar!(false, false)('e')) -+ { -+ isFloat = true; -+ number.put('e'); -+ if(testChar('+')) number.put('+'); -+ else if(testChar('-')) number.put('-'); -+ c = getChar(); -+ readInteger(); -+ } -+ -+ string data = number.data; -+ if(isFloat) -+ { -+ value.type = JSON_TYPE.FLOAT; -+ value.floating = parse!real(data); -+ } -+ else -+ { -+ if (isNegative) -+ value.integer = parse!long(data); -+ else -+ value.uinteger = parse!ulong(data); -+ value.type = !isNegative && value.uinteger & (1UL << 63) ? JSON_TYPE.UINTEGER : JSON_TYPE.INTEGER; -+ } -+ break; -+ -+ case 't': -+ case 'T': -+ value.type = JSON_TYPE.TRUE; -+ checkChar!(false, false)('r'); -+ checkChar!(false, false)('u'); -+ checkChar!(false, false)('e'); -+ break; -+ -+ case 'f': -+ case 'F': -+ value.type = JSON_TYPE.FALSE; -+ checkChar!(false, false)('a'); -+ checkChar!(false, false)('l'); -+ checkChar!(false, false)('s'); -+ checkChar!(false, false)('e'); -+ break; -+ -+ case 'n': -+ case 'N': -+ value.type = JSON_TYPE.NULL; -+ checkChar!(false, false)('u'); -+ checkChar!(false, false)('l'); -+ checkChar!(false, false)('l'); -+ break; -+ -+ default: -+ error(text("Unexpected character '", c, "'.")); - } - -- parseValue(&root); -- return root; -+ depth--; -+ } -+ -+ parseValue(&root); -+ return root; - } - - /** -- Takes a tree of JSON values and returns the serialized string. --*/ --string toJSON(in JSONValue* root) { -- auto json = appender!string(); -+Takes a tree of JSON values and returns the serialized string. - -- void toString(string str) { -- json.put('"'); -+If $(D pretty) is false no whitespaces are generated. -+If $(D pretty) is true serialized string is formatted to be human-readable. -+No exact formatting layout is guaranteed in the latter case. -+*/ -+string toJSON(in JSONValue* root, in bool pretty = false) -+{ -+ auto json = appender!string(); - -- foreach (dchar c; str) { -- switch(c) { -- case '"': json.put("\\\""); break; -- case '\\': json.put("\\\\"); break; -- case '/': json.put("\\/"); break; -- case '\b': json.put("\\b"); break; -- case '\f': json.put("\\f"); break; -- case '\n': json.put("\\n"); break; -- case '\r': json.put("\\r"); break; -- case '\t': json.put("\\t"); break; -- default: -- appendJSONChar(&json, c, -- (string msg){throw new JSONException(msg);}); -- } -- } -+ void toString(string str) -+ { -+ json.put('"'); - -- json.put('"'); -+ foreach (dchar c; str) -+ { -+ switch(c) -+ { -+ case '"': json.put("\\\""); break; -+ case '\\': json.put("\\\\"); break; -+ case '/': json.put("\\/"); break; -+ case '\b': json.put("\\b"); break; -+ case '\f': json.put("\\f"); break; -+ case '\n': json.put("\\n"); break; -+ case '\r': json.put("\\r"); break; -+ case '\t': json.put("\\t"); break; -+ default: -+ appendJSONChar(&json, c, -+ (msg) { throw new JSONException(msg); }); -+ } - } - -- void toValue(in JSONValue* value) { -- final switch(value.type) { -- case JSON_TYPE.OBJECT: -- json.put('{'); -- bool first = true; -- foreach(name, member; value.object) { -- if(first) first = false; -- else json.put(','); -- toString(name); -- json.put(':'); -- toValue(&member); -- } -- json.put('}'); -- break; -- -- case JSON_TYPE.ARRAY: -- json.put('['); -- auto length = value.array.length; -- foreach (i; 0 .. length) { -- if(i) json.put(','); -- toValue(&value.array[i]); -- } -- json.put(']'); -- break; -- -- case JSON_TYPE.STRING: -- toString(value.str); -- break; -- -- case JSON_TYPE.INTEGER: -- json.put(to!string(value.integer)); -- break; -- -- case JSON_TYPE.UINTEGER: -- json.put(to!string(value.uinteger)); -- break; -- -- case JSON_TYPE.FLOAT: -- json.put(to!string(value.floating)); -- break; -+ json.put('"'); -+ } - -- case JSON_TYPE.TRUE: -- json.put("true"); -- break; -- -- case JSON_TYPE.FALSE: -- json.put("false"); -- break; -+ void toValue(in JSONValue* value, ulong indentLevel) -+ { -+ void putTabs(ulong additionalIndent = 0) -+ { -+ if(pretty) -+ foreach(i; 0 .. indentLevel + additionalIndent) -+ json.put(" "); -+ } -+ void putEOL() -+ { -+ if(pretty) -+ json.put('\n'); -+ } -+ void putCharAndEOL(char ch) -+ { -+ json.put(ch); -+ putEOL(); -+ } - -- case JSON_TYPE.NULL: -- json.put("null"); -- break; -- } -+ final switch(value.type) -+ { -+ case JSON_TYPE.OBJECT: -+ if(!value.object.length) -+ { -+ json.put("{}"); -+ } -+ else -+ { -+ putCharAndEOL('{'); -+ bool first = true; -+ foreach(name, member; value.object) -+ { -+ if(!first) -+ putCharAndEOL(','); -+ first = false; -+ putTabs(1); -+ toString(name); -+ json.put(':'); -+ if(pretty) -+ json.put(' '); -+ toValue(&member, indentLevel + 1); -+ } -+ putEOL(); -+ putTabs(); -+ json.put('}'); -+ } -+ break; -+ -+ case JSON_TYPE.ARRAY: -+ if(value.array.empty) -+ { -+ json.put("[]"); -+ } -+ else -+ { -+ putCharAndEOL('['); -+ foreach (i, ref el; value.array) -+ { -+ if(i) -+ putCharAndEOL(','); -+ putTabs(1); -+ toValue(&el, indentLevel + 1); -+ } -+ putEOL(); -+ putTabs(); -+ json.put(']'); -+ } -+ break; -+ -+ case JSON_TYPE.STRING: -+ toString(value.str); -+ break; -+ -+ case JSON_TYPE.INTEGER: -+ json.put(to!string(value.integer)); -+ break; -+ -+ case JSON_TYPE.UINTEGER: -+ json.put(to!string(value.uinteger)); -+ break; -+ -+ case JSON_TYPE.FLOAT: -+ json.put(to!string(value.floating)); -+ break; -+ -+ case JSON_TYPE.TRUE: -+ json.put("true"); -+ break; -+ -+ case JSON_TYPE.FALSE: -+ json.put("false"); -+ break; -+ -+ case JSON_TYPE.NULL: -+ json.put("null"); -+ break; - } -+ } - -- toValue(root); -- return json.data; -+ toValue(root, 0); -+ return json.data; - } - - private void appendJSONChar(Appender!string* dst, dchar c, -- scope void delegate(string) error) -+ scope void delegate(string) error) - { -- if(isControl(c)) error("Illegal control character."); -+ import std.uni : isControl; -+ -+ if(isControl(c)) -+ error("Illegal control character."); - dst.put(c); --// int stride = UTFStride((&c)[0 .. 1], 0); --// if(stride == 1) { --// if(isControl(c)) error("Illegal control character."); --// dst.put(c); --// } --// else { --// char[6] utf = void; --// utf[0] = c; --// foreach(i; 1 .. stride) utf[i] = next; --// size_t index = 0; --// if(isControl(toUnicode(utf[0 .. stride], index))) --// error("Illegal control character"); --// dst.put(utf[0 .. stride]); --// } - } - - /** -- Exception thrown on JSON errors -+Exception thrown on JSON errors - */ --class JSONException : Exception { -- this(string msg, int line = 0, int pos = 0) { -- if(line) super(text(msg, " (Line ", line, ":", pos, ")")); -- else super(msg); -- } -+class JSONException : Exception -+{ -+ this(string msg, int line = 0, int pos = 0) -+ { -+ if(line) -+ super(text(msg, " (Line ", line, ":", pos, ")")); -+ else -+ super(msg); -+ } - } - --version(unittest) import std.stdio; -+version(unittest) import std.exception; - --unittest { -- // An overly simple test suite, if it can parse a serializated string and -- // then use the resulting values tree to generate an identical -- // serialization, both the decoder and encoder works. -- -- auto jsons = [ -- `null`, -- `true`, -- `false`, -- `0`, -- `123`, -- `-4321`, -- `0.23`, -- `-0.23`, -- `""`, -- `1.223e+24`, -- `"hello\nworld"`, -- `"\"\\\/\b\f\n\r\t"`, -- `[]`, -- `[12,"foo",true,false]`, -- `{}`, -- `{"a":1,"b":null}`, --// Currently broken --// `{"hello":{"json":"is great","array":[12,null,{}]},"goodbye":[true,"or",false,["test",42,{"nested":{"a":23.54,"b":0.0012}}]]}` -- ]; -- -- JSONValue val; -- string result; -- foreach(json; jsons) { -- try { -- val = parseJSON(json); -- result = toJSON(&val); -- assert(result == json, text(result, " should be ", json)); -- } -- catch(JSONException e) { -- writefln(text(json, "\n", e.toString())); -- } -+unittest -+{ -+ // An overly simple test suite, if it can parse a serializated string and -+ // then use the resulting values tree to generate an identical -+ // serialization, both the decoder and encoder works. -+ -+ auto jsons = [ -+ `null`, -+ `true`, -+ `false`, -+ `0`, -+ `123`, -+ `-4321`, -+ `0.23`, -+ `-0.23`, -+ `""`, -+ `"hello\nworld"`, -+ `"\"\\\/\b\f\n\r\t"`, -+ `[]`, -+ `[12,"foo",true,false]`, -+ `{}`, -+ `{"a":1,"b":null}`, -+ // Currently broken -+ // `{"hello":{"json":"is great","array":[12,null,{}]},"goodbye":[true,"or",false,["test",42,{"nested":{"a":23.54,"b":0.0012}}]]}` -+ ]; -+ -+ version (MinGW) -+ jsons ~= `1.223e+024`; -+ else -+ jsons ~= `1.223e+24`; -+ -+ JSONValue val; -+ string result; -+ foreach(json; jsons) -+ { -+ try -+ { -+ val = parseJSON(json); -+ result = toJSON(&val); -+ assert(result == json, text(result, " should be ", json)); - } -+ catch(JSONException e) -+ { -+ import std.stdio; -+ writefln(text(json, "\n", e.toString())); -+ } -+ } - -- // Should be able to correctly interpret unicode entities -- val = parseJSON(`"\u003C\u003E"`); -- assert(toJSON(&val) == "\"\<\>\""); -- val = parseJSON(`"\u0391\u0392\u0393"`); -- assert(toJSON(&val) == "\"\Α\Β\Γ\""); -- val = parseJSON(`"\u2660\u2666"`); -- assert(toJSON(&val) == "\"\♠\♦\""); -+ // Should be able to correctly interpret unicode entities -+ val = parseJSON(`"\u003C\u003E"`); -+ assert(toJSON(&val) == "\"\<\>\""); -+ val = parseJSON(`"\u0391\u0392\u0393"`); -+ assert(toJSON(&val) == "\"\Α\Β\Γ\""); -+ val = parseJSON(`"\u2660\u2666"`); -+ assert(toJSON(&val) == "\"\♠\♦\""); -+ -+ //0x7F is a control character (see Unicode spec) -+ assertThrown(parseJSON(`{ "foo": "` ~ "\u007F" ~ `"}`)); -+ -+ with(parseJSON(`""`)) -+ assert(str == "" && str !is null); -+ with(parseJSON(`[]`)) -+ assert(!array.length && array !is null); -+ -+ // Formatting -+ val = parseJSON(`{"a":[null,{"x":1},{},[]]}`); -+ assert(toJSON(&val, true) == `{ -+ "a": [ -+ null, -+ { -+ "x": 1 -+ }, -+ {}, -+ [] -+ ] -+}`); - } ---- a/src/libphobos/src/std/math.d 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/libphobos/src/std/math.d 2014-04-01 16:32:51.000000000 +0100 -@@ -47,9 +47,16 @@ - * HALF = ½ - * - * Copyright: Copyright Digital Mars 2000 - 2011. -+ * D implementations of tan, atan, atan2, exp, expm1, exp2, log, log10, log1p, -+ * log2, floor, ceil and lrint functions are based on the CEPHES math library, -+ * which is Copyright (C) 2001 Stephen L. Moshier <steve@moshier.net> -+ * and are incorporated herein by permission of the author. The author -+ * reserves the right to distribute this material elsewhere under different -+ * copying permissions. These modifications are distributed here under -+ * the following terms: - * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. - * Authors: $(WEB digitalmars.com, Walter Bright), -- * Don Clugston -+ * Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw - * Source: $(PHOBOSSRC std/_math.d) - */ - -@@ -127,8 +134,8 @@ version(unittest) - if (isnan(x) || isnan(y)) - return 0; - -- char bufx[30]; -- char bufy[30]; -+ char[30] bufx; -+ char[30] bufy; - assert(ndigits < bufx.length); - - int ix; -@@ -490,8 +497,7 @@ trigerr: - } - return real.nan; - --Lret: -- ; -+Lret: {} - } - else version(D_InlineAsm_X86_64) - { -@@ -539,18 +545,78 @@ trigerr: - } - return real.nan; - --Lret: -- ; -+Lret: {} - } - else - { -- return core.stdc.math.tanl(x); -+ // Coefficients for tan(x) -+ static immutable real[3] P = [ -+ -1.7956525197648487798769E7L, -+ 1.1535166483858741613983E6L, -+ -1.3093693918138377764608E4L, -+ ]; -+ static immutable real[5] Q = [ -+ -5.3869575592945462988123E7L, -+ 2.5008380182335791583922E7L, -+ -1.3208923444021096744731E6L, -+ 1.3681296347069295467845E4L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // PI/4 split into three parts. -+ enum real P1 = 7.853981554508209228515625E-1L; -+ enum real P2 = 7.946627356147928367136046290398E-9L; -+ enum real P3 = 3.061616997868382943065164830688E-17L; -+ -+ // Special cases. -+ if (x == 0.0 || isNaN(x)) -+ return x; -+ if (isInfinity(x)) -+ return real.nan; -+ -+ // Make argument positive but save the sign. -+ bool sign = false; -+ if (signbit(x)) -+ { -+ sign = true; -+ x = -x; -+ } -+ -+ // Compute x mod PI/4. -+ real y = floor(x / PI_4); -+ // Strip high bits of integer part. -+ real z = ldexp(y, -4); -+ // Compute y - 16 * (y / 16). -+ z = y - ldexp(floor(z), 4); -+ -+ // Integer and fraction part modulo one octant. -+ int j = cast(int)(z); -+ -+ // Map zeros and singularities to origin. -+ if (j & 1) -+ { -+ j += 1; -+ y += 1.0; -+ } -+ -+ z = ((x - y * P1) - y * P2) - y * P3; -+ real zz = z * z; -+ -+ if (zz > 1.0e-20L) -+ y = z + z * (zz * poly(zz, P) / poly(zz, Q)); -+ else -+ y = z; -+ -+ if (j & 2) -+ y = -1.0 / y; -+ -+ return (sign) ? -y : y; - } - } - - unittest - { -- static real vals[][2] = // angle,tan -+ static real[2][] vals = // angle,tan - [ - [ 0, 0], - [ .5, .5463024898], -@@ -671,7 +737,72 @@ unittest - * $(TR $(TD $(PLUSMN)$(INFIN)) $(TD $(NAN)) $(TD yes)) - * ) - */ --real atan(real x) @safe pure nothrow { return atan2(x, 1.0L); } -+real atan(real x) @safe pure nothrow -+{ -+ version(InlineAsm_X86_Any) -+ { -+ return atan2(x, 1.0L); -+ } -+ else -+ { -+ // Coefficients for atan(x) -+ static immutable real[5] P = [ -+ -5.0894116899623603312185E1L, -+ -9.9988763777265819915721E1L, -+ -6.3976888655834347413154E1L, -+ -1.4683508633175792446076E1L, -+ -8.6863818178092187535440E-1L, -+ ]; -+ static immutable real[6] Q = [ -+ 1.5268235069887081006606E2L, -+ 3.9157570175111990631099E2L, -+ 3.6144079386152023162701E2L, -+ 1.4399096122250781605352E2L, -+ 2.2981886733594175366172E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // tan(PI/8) -+ enum real TAN_PI_8 = 4.1421356237309504880169e-1L; -+ // tan(3 * PI/8) -+ enum real TAN3_PI_8 = 2.41421356237309504880169L; -+ -+ // Special cases. -+ if (x == 0.0) -+ return x; -+ if (isInfinity(x)) -+ return copysign(PI_2, x); -+ -+ // Make argument positive but save the sign. -+ bool sign = false; -+ if (signbit(x)) -+ { -+ sign = true; -+ x = -x; -+ } -+ -+ // Range reduction. -+ real y; -+ if (x > TAN3_PI_8) -+ { -+ y = PI_2; -+ x = -(1.0 / x); -+ } -+ else if (x > TAN_PI_8) -+ { -+ y = PI_4; -+ x = (x - 1.0)/(x + 1.0); -+ } -+ else -+ y = 0.0; -+ -+ // Rational form in x^^2. -+ real z = x * x; -+ y = y + (poly(z, P) / poly(z, Q)) * z * x + x; -+ -+ return (sign) ? -y : y; -+ } -+} - - /// ditto - double atan(double x) @safe pure nothrow { return atan(cast(real)x); } -@@ -730,7 +861,53 @@ real atan2(real y, real x) @trusted pure - } - else - { -- return core.stdc.math.atan2l(y,x); -+ // Special cases. -+ if (isNaN(x) || isNaN(y)) -+ return real.nan; -+ if (y == 0.0) -+ { -+ if (x >= 0 && !signbit(x)) -+ return copysign(0, y); -+ else -+ return copysign(PI, y); -+ } -+ if (x == 0.0) -+ return copysign(PI_2, y); -+ if (isInfinity(x)) -+ { -+ if (signbit(x)) -+ { -+ if (isInfinity(y)) -+ return copysign(3*PI_4, y); -+ else -+ return copysign(PI, y); -+ } -+ else -+ { -+ if (isInfinity(y)) -+ return copysign(PI_4, y); -+ else -+ return copysign(0.0, y); -+ } -+ } -+ if (isInfinity(y)) -+ return copysign(PI_2, y); -+ -+ // Call atan and determine the quadrant. -+ real z = atan(y / x); -+ -+ if (signbit(x)) -+ { -+ if (signbit(y)) -+ z = z - PI; -+ else -+ z = z + PI; -+ } -+ -+ if (z == 0.0) -+ return copysign(z, y); -+ -+ return z; - } - } - -@@ -1108,7 +1285,53 @@ real exp(real x) @trusted pure nothrow - } - else - { -- return exp2(LOG2E*x); -+ // Coefficients for exp(x) -+ static immutable real[3] P = [ -+ 9.9999999999999999991025E-1L, -+ 3.0299440770744196129956E-2L, -+ 1.2617719307481059087798E-4L, -+ ]; -+ static immutable real[4] Q = [ -+ 2.0000000000000000000897E0L, -+ 2.2726554820815502876593E-1L, -+ 2.5244834034968410419224E-3L, -+ 3.0019850513866445504159E-6L, -+ ]; -+ -+ // C1 + C2 = LN2. -+ enum real C1 = 6.9314575195312500000000E-1L; -+ enum real C2 = 1.428606820309417232121458176568075500134E-6L; -+ -+ // Overflow and Underflow limits. -+ enum real OF = 1.1356523406294143949492E4L; -+ enum real UF = -1.1432769596155737933527E4L; -+ -+ // Special cases. -+ if (isNaN(x)) -+ return x; -+ if (x > OF) -+ return real.infinity; -+ if (x < UF) -+ return 0.0; -+ -+ // Express: e^^x = e^^g * 2^^n -+ // = e^^g * e^^(n * LOG2E) -+ // = e^^(g + n * LOG2E) -+ int n = cast(int)floor(LOG2E * x + 0.5); -+ x -= n * C1; -+ x -= n * C2; -+ -+ // Rational approximation for exponential of the fractional part: -+ // e^^x = 1 + 2x P(x^^2) / (Q(x^^2) - P(x^^2)) -+ real xx = x * x; -+ real px = x * poly(xx, P); -+ x = px / (poly(xx, Q) - px); -+ x = 1.0 + ldexp(x, 1); -+ -+ // Scale by power of 2. -+ x = ldexp(x, n); -+ -+ return x; - } - } - -@@ -1120,7 +1343,7 @@ float exp(float x) @safe pure nothrow - - unittest - { -- assert(equalsDigit(exp(3.0), E * E * E, useDigits)); -+ assert(equalsDigit(exp(3.0L), E * E * E, useDigits)); - } - - /** -@@ -1303,7 +1526,57 @@ L_largenegative: - } - else - { -- return core.stdc.math.expm1l(x); -+ // Coefficients for exp(x) - 1 -+ static immutable real[5] P = [ -+ -1.586135578666346600772998894928250240826E4L, -+ 2.642771505685952966904660652518429479531E3L, -+ -3.423199068835684263987132888286791620673E2L, -+ 1.800826371455042224581246202420972737840E1L, -+ -5.238523121205561042771939008061958820811E-1L, -+ ]; -+ static immutable real[6] Q = [ -+ -9.516813471998079611319047060563358064497E4L, -+ 3.964866271411091674556850458227710004570E4L, -+ -7.207678383830091850230366618190187434796E3L, -+ 7.206038318724600171970199625081491823079E2L, -+ -4.002027679107076077238836622982900945173E1L, -+ 1.000000000000000000000000000000000000000E0L, -+ ]; -+ -+ // C1 + C2 = LN2. -+ enum real C1 = 6.9314575195312500000000E-1L; -+ enum real C2 = 1.4286068203094172321215E-6L; -+ -+ // Overflow and Underflow limits. -+ enum real OF = 1.1356523406294143949492E4L; -+ enum real UF = -4.5054566736396445112120088E1L; -+ -+ // Special cases. -+ if (x > OF) -+ return real.infinity; -+ if (x == 0.0) -+ return x; -+ if (x < UF) -+ return -1.0; -+ -+ // Express x = LN2 (n + remainder), remainder not exceeding 1/2. -+ int n = cast(int)floor(0.5 + x / LN2); -+ x -= n * C1; -+ x -= n * C2; -+ -+ // Rational approximation: -+ // exp(x) - 1 = x + 0.5 x^^2 + x^^3 P(x) / Q(x) -+ real px = x * poly(x, P); -+ real qx = poly(x, Q); -+ real xx = x * x; -+ qx = x + (0.5 * xx + xx * px / qx); -+ -+ // We have qx = exp(remainder LN2) - 1, so: -+ // exp(x) - 1 = 2^^n (qx + 1) - 1 = 2^^n qx + 2^^n - 1. -+ px = ldexp(1.0, n); -+ x = px * qx + (px - 1.0); -+ -+ return x; - } - } - -@@ -1510,16 +1783,54 @@ L_was_nan: - } - else - { -- return core.stdc.math.exp2l(x); -+ // Coefficients for exp2(x) -+ static immutable real[3] P = [ -+ 2.0803843631901852422887E6L, -+ 3.0286971917562792508623E4L, -+ 6.0614853552242266094567E1L, -+ ]; -+ static immutable real[4] Q = [ -+ 6.0027204078348487957118E6L, -+ 3.2772515434906797273099E5L, -+ 1.7492876999891839021063E3L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // Overflow and Underflow limits. -+ enum real OF = 16384.0L; -+ enum real UF = -16382.0L; -+ -+ // Special cases. -+ if (isNaN(x)) -+ return x; -+ if (x > OF) -+ return real.infinity; -+ if (x < UF) -+ return 0.0; -+ -+ // Separate into integer and fractional parts. -+ int n = cast(int)floor(x + 0.5); -+ x -= n; -+ -+ // Rational approximation: -+ // exp2(x) = 1.0 + 2x P(x^^2) / (Q(x^^2) - P(x^^2)) -+ real xx = x * x; -+ real px = x * poly(xx, P); -+ x = px / (poly(xx, Q) - px); -+ x = 1.0 + ldexp(x, 1); -+ -+ // Scale by power of 2. -+ x = ldexp(x, n); -+ -+ return x; - } - } - - unittest - { -- assert(exp2(0.5L)== SQRT2); -+ assert(feqrel(exp2(0.5L), SQRT2) >= real.mant_dig -1); - assert(exp2(8.0L) == 256.0); - assert(exp2(-9.0L)== 1.0L/512.0); -- assert(exp(3.0L) == E*E*E); - assert( core.stdc.math.exp2f(0.0f) == 1 ); - assert( core.stdc.math.exp2 (0.0) == 1 ); - assert( core.stdc.math.exp2l(0.0L) == 1 ); -@@ -1527,9 +1838,9 @@ unittest - - unittest - { -- pragma(msg, "overflow/underflow test disabled in gdc. stdc exp doesn't set these flags"); - FloatingPointControl ctrl; -- ctrl.disableExceptions(FloatingPointControl.allExceptions); -+ if(FloatingPointControl.hasExceptionTraps()) -+ ctrl.disableExceptions(FloatingPointControl.allExceptions); - ctrl.rounding = FloatingPointControl.roundToNearest; - - // @@BUG@@: Non-immutable array literals are ridiculous. -@@ -1557,7 +1868,7 @@ unittest - resetIeeeFlags(); - x = exp(exptestpoints[i][0]); - f = ieeeFlags; -- assert(x == exptestpoints[i][1]); -+ assert(equalsDigit(x, exptestpoints[i][1], 15)); - // Check the overflow bit - //assert(f.overflow == (fabs(x) == real.infinity)); - // Check the underflow bit -@@ -1632,7 +1943,7 @@ creal expi(real y) @trusted pure nothrow - - unittest - { -- real value = 1.3e5L; //Avoid constant folding -+ real value = 1.3e5L; // Avoid constant folding - assert(expi(value) == cos(value) + sin(value) * 1i); - assert(expi(0.0L) == 1L + 0.0Li); - } -@@ -1659,7 +1970,7 @@ real frexp(real value, out int exp) @tru - { - ushort* vu = cast(ushort*)&value; - long* vl = cast(long*)&value; -- uint ex; -+ int ex; - alias floatTraits!(real) F; - - ex = vu[F.EXPPOS_SHORT] & F.EXPMASK; -@@ -1700,6 +2011,7 @@ real frexp(real value, out int exp) @tru - exp = ex - F.EXPBIAS - real.mant_dig + 1; - vu[F.EXPPOS_SHORT] = (0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE; - } -+ return value; - } - else static if (real.mant_dig == 113) // quadruple - { -@@ -1742,6 +2054,7 @@ real frexp(real value, out int exp) @tru - vu[F.EXPPOS_SHORT] = - cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FFE); - } -+ return value; - } - else static if (real.mant_dig==53) // real is double - { -@@ -1764,7 +2077,7 @@ real frexp(real value, out int exp) @tru - else - { - exp = (ex - F.EXPBIAS) >> 4; -- vu[F.EXPPOS_SHORT] = cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FE0); -+ vu[F.EXPPOS_SHORT] = cast(ushort)((0x800F & vu[F.EXPPOS_SHORT]) | 0x3FE0); - } - } - else if (!(*vl & 0x7FFF_FFFF_FFFF_FFFF)) -@@ -1781,18 +2094,18 @@ real frexp(real value, out int exp) @tru - vu[F.EXPPOS_SHORT] = - cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) | 0x3FE0); - } -+ return value; - } -- else -+ else // static if (real.mant_dig==106) // real is doubledouble - { - assert (0, "frexp not implemented"); - } -- return value; - } - - - unittest - { -- static real vals[][3] = // x,frexp,exp -+ static real[3][] vals = // x,frexp,exp - [ - [0.0, 0.0, 0], - [-0.0, -0.0, 0], -@@ -1822,7 +2135,7 @@ unittest - - static if (real.mant_dig == 64) - { -- static real extendedvals[][3] = [ // x,frexp,exp -+ static real[3][] extendedvals = [ // x,frexp,exp - [0x1.a5f1c2eb3fe4efp+73L, 0x1.A5F1C2EB3FE4EFp-1L, 74], // normal - [0x1.fa01712e8f0471ap-1064L, 0x1.fa01712e8f0471ap-1L, -1063], - [real.min_normal, .5, -16381], -@@ -1921,19 +2234,32 @@ real ldexp(real n, int exp) @safe pure n - - unittest - { -- assert(ldexp(1, -16384) == 0x1p-16384L); -- assert(ldexp(1, -16382) == 0x1p-16382L); -- int x; -- real n = frexp(0x1p-16384L, x); -- assert(n==0.5L); -- assert(x==-16383); -- assert(ldexp(n, x)==0x1p-16384L); -- -+ static if(real.mant_dig == 64) -+ { -+ assert(ldexp(1, -16384) == 0x1p-16384L); -+ assert(ldexp(1, -16382) == 0x1p-16382L); -+ int x; -+ real n = frexp(0x1p-16384L, x); -+ assert(n==0.5L); -+ assert(x==-16383); -+ assert(ldexp(n, x)==0x1p-16384L); -+ } -+ else static if(real.mant_dig == 53) -+ { -+ assert(ldexp(1, -1024) == 0x1p-1024L); -+ assert(ldexp(1, -1022) == 0x1p-1022L); -+ int x; -+ real n = frexp(0x1p-1024L, x); -+ assert(n==0.5L); -+ assert(x==-1023); -+ assert(ldexp(n, x)==0x1p-1024L); -+ } -+ else static assert(false, "Floating point type real not supported"); - } - - unittest - { -- static real vals[][3] = // value,exp,ldexp -+ static real[3][] vals = // value,exp,ldexp - [ - [ 0, 0, 0], - [ 1, 0, 1], -@@ -1989,7 +2315,110 @@ real log(real x) @safe pure nothrow - version (INLINE_YL2X) - return yl2x(x, LN2); - else -- return core.stdc.math.logl(x); -+ { -+ // Coefficients for log(1 + x) -+ static immutable real[7] P = [ -+ 2.0039553499201281259648E1L, -+ 5.7112963590585538103336E1L, -+ 6.0949667980987787057556E1L, -+ 2.9911919328553073277375E1L, -+ 6.5787325942061044846969E0L, -+ 4.9854102823193375972212E-1L, -+ 4.5270000862445199635215E-5L, -+ ]; -+ static immutable real[7] Q = [ -+ 6.0118660497603843919306E1L, -+ 2.1642788614495947685003E2L, -+ 3.0909872225312059774938E2L, -+ 2.2176239823732856465394E2L, -+ 8.3047565967967209469434E1L, -+ 1.5062909083469192043167E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // Coefficients for log(x) -+ static immutable real[4] R = [ -+ -3.5717684488096787370998E1L, -+ 1.0777257190312272158094E1L, -+ -7.1990767473014147232598E-1L, -+ 1.9757429581415468984296E-3L, -+ ]; -+ static immutable real[4] S = [ -+ -4.2861221385716144629696E2L, -+ 1.9361891836232102174846E2L, -+ -2.6201045551331104417768E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // C1 + C2 = LN2. -+ enum real C1 = 6.9314575195312500000000E-1L; -+ enum real C2 = 1.4286068203094172321215E-6L; -+ -+ // Special cases. -+ if (isNaN(x)) -+ return x; -+ if (isInfinity(x) && !signbit(x)) -+ return x; -+ if (x == 0.0) -+ return -real.infinity; -+ if (x < 0.0) -+ return real.nan; -+ -+ // Separate mantissa from exponent. -+ // Note, frexp is used so that denormal numbers will be handled properly. -+ real y, z; -+ int exp; -+ -+ x = frexp(x, exp); -+ -+ // Logarithm using log(x) = z + z^^3 P(z) / Q(z), -+ // where z = 2(x - 1)/(x + 1) -+ if((exp > 2) || (exp < -2)) -+ { -+ if(x < SQRT1_2) -+ { // 2(2x - 1)/(2x + 1) -+ exp -= 1; -+ z = x - 0.5; -+ y = 0.5 * z + 0.5; -+ } -+ else -+ { // 2(x - 1)/(x + 1) -+ z = x - 0.5; -+ z -= 0.5; -+ y = 0.5 * x + 0.5; -+ } -+ x = z / y; -+ z = x * x; -+ z = x * (z * poly(z, R) / poly(z, S)); -+ z += exp * C2; -+ z += x; -+ z += exp * C1; -+ -+ return z; -+ } -+ -+ // Logarithm using log(1 + x) = x - .5x^^2 + x^^3 P(x) / Q(x) -+ if (x < SQRT1_2) -+ { // 2x - 1 -+ exp -= 1; -+ x = ldexp(x, 1) - 1.0; -+ } -+ else -+ { -+ x = x - 1.0; -+ } -+ z = x * x; -+ y = x * (z * poly(x, P) / poly(x, Q)); -+ y += exp * C2; -+ z = y - ldexp(z, -1); -+ -+ // Note, the sum of above terms does not exceed x/4, -+ // so it contributes at most about 1/4 lsb to the error. -+ z += x; -+ z += exp * C1; -+ -+ return z; -+ } - } - - unittest -@@ -2013,7 +2442,114 @@ real log10(real x) @safe pure nothrow - version (INLINE_YL2X) - return yl2x(x, LOG2); - else -- return core.stdc.math.log10l(x); -+ { -+ // Coefficients for log(1 + x) -+ static immutable real[7] P = [ -+ 2.0039553499201281259648E1L, -+ 5.7112963590585538103336E1L, -+ 6.0949667980987787057556E1L, -+ 2.9911919328553073277375E1L, -+ 6.5787325942061044846969E0L, -+ 4.9854102823193375972212E-1L, -+ 4.5270000862445199635215E-5L, -+ ]; -+ static immutable real[7] Q = [ -+ 6.0118660497603843919306E1L, -+ 2.1642788614495947685003E2L, -+ 3.0909872225312059774938E2L, -+ 2.2176239823732856465394E2L, -+ 8.3047565967967209469434E1L, -+ 1.5062909083469192043167E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // Coefficients for log(x) -+ static immutable real[4] R = [ -+ -3.5717684488096787370998E1L, -+ 1.0777257190312272158094E1L, -+ -7.1990767473014147232598E-1L, -+ 1.9757429581415468984296E-3L, -+ ]; -+ static immutable real[4] S = [ -+ -4.2861221385716144629696E2L, -+ 1.9361891836232102174846E2L, -+ -2.6201045551331104417768E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // log10(2) split into two parts. -+ enum real L102A = 0.3125L; -+ enum real L102B = -1.14700043360188047862611052755069732318101185E-2L; -+ -+ // log10(e) split into two parts. -+ enum real L10EA = 0.5L; -+ enum real L10EB = -6.570551809674817234887108108339491770560299E-2L; -+ -+ // Special cases are the same as for log. -+ if (isNaN(x)) -+ return x; -+ if (isInfinity(x) && !signbit(x)) -+ return x; -+ if (x == 0.0) -+ return -real.infinity; -+ if (x < 0.0) -+ return real.nan; -+ -+ // Separate mantissa from exponent. -+ // Note, frexp is used so that denormal numbers will be handled properly. -+ real y, z; -+ int exp; -+ -+ x = frexp(x, exp); -+ -+ // Logarithm using log(x) = z + z^^3 P(z) / Q(z), -+ // where z = 2(x - 1)/(x + 1) -+ if((exp > 2) || (exp < -2)) -+ { -+ if(x < SQRT1_2) -+ { // 2(2x - 1)/(2x + 1) -+ exp -= 1; -+ z = x - 0.5; -+ y = 0.5 * z + 0.5; -+ } -+ else -+ { // 2(x - 1)/(x + 1) -+ z = x - 0.5; -+ z -= 0.5; -+ y = 0.5 * x + 0.5; -+ } -+ x = z / y; -+ z = x * x; -+ y = x * (z * poly(z, R) / poly(z, S)); -+ goto Ldone; -+ } -+ -+ // Logarithm using log(1 + x) = x - .5x^^2 + x^^3 P(x) / Q(x) -+ if (x < SQRT1_2) -+ { // 2x - 1 -+ exp -= 1; -+ x = ldexp(x, 1) - 1.0; -+ } -+ else -+ x = x - 1.0; -+ -+ z = x * x; -+ y = x * (z * poly(x, P) / poly(x, Q)); -+ y = y - ldexp(z, -1); -+ -+ // Multiply log of fraction by log10(e) and base 2 exponent by log10(2). -+ // This sequence of operations is critical and it may be horribly -+ // defeated by some compiler optimizers. -+ Ldone: -+ z = y * L10EB; -+ z += x * L10EB; -+ z += exp * L102B; -+ z += y * L10EA; -+ z += x * L10EA; -+ z += exp * L102A; -+ -+ return z; -+ } - } - - unittest -@@ -2047,7 +2583,17 @@ real log1p(real x) @safe pure nothrow - } - else - { -- return core.stdc.math.log1pl(x); -+ // Special cases. -+ if (isNaN(x) || x == 0.0) -+ return x; -+ if (isInfinity(x) && !signbit(x)) -+ return x; -+ if (x == -1.0) -+ return -real.infinity; -+ if (x < -1.0) -+ return real.nan; -+ -+ return log(x + 1.0); - } - } - -@@ -2067,7 +2613,105 @@ real log2(real x) @safe pure nothrow - version (INLINE_YL2X) - return yl2x(x, 1); - else -- return core.stdc.math.log2l(x); -+ { -+ // Coefficients for log(1 + x) -+ static immutable real[7] P = [ -+ 2.0039553499201281259648E1L, -+ 5.7112963590585538103336E1L, -+ 6.0949667980987787057556E1L, -+ 2.9911919328553073277375E1L, -+ 6.5787325942061044846969E0L, -+ 4.9854102823193375972212E-1L, -+ 4.5270000862445199635215E-5L, -+ ]; -+ static immutable real[7] Q = [ -+ 6.0118660497603843919306E1L, -+ 2.1642788614495947685003E2L, -+ 3.0909872225312059774938E2L, -+ 2.2176239823732856465394E2L, -+ 8.3047565967967209469434E1L, -+ 1.5062909083469192043167E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // Coefficients for log(x) -+ static immutable real[4] R = [ -+ -3.5717684488096787370998E1L, -+ 1.0777257190312272158094E1L, -+ -7.1990767473014147232598E-1L, -+ 1.9757429581415468984296E-3L, -+ ]; -+ static immutable real[4] S = [ -+ -4.2861221385716144629696E2L, -+ 1.9361891836232102174846E2L, -+ -2.6201045551331104417768E1L, -+ 1.0000000000000000000000E0L, -+ ]; -+ -+ // Special cases are the same as for log. -+ if (isNaN(x)) -+ return x; -+ if (isInfinity(x) && !signbit(x)) -+ return x; -+ if (x == 0.0) -+ return -real.infinity; -+ if (x < 0.0) -+ return real.nan; -+ -+ // Separate mantissa from exponent. -+ // Note, frexp is used so that denormal numbers will be handled properly. -+ real y, z; -+ int exp; -+ -+ x = frexp(x, exp); -+ -+ // Logarithm using log(x) = z + z^^3 P(z) / Q(z), -+ // where z = 2(x - 1)/(x + 1) -+ if((exp > 2) || (exp < -2)) -+ { -+ if(x < SQRT1_2) -+ { // 2(2x - 1)/(2x + 1) -+ exp -= 1; -+ z = x - 0.5; -+ y = 0.5 * z + 0.5; -+ } -+ else -+ { // 2(x - 1)/(x + 1) -+ z = x - 0.5; -+ z -= 0.5; -+ y = 0.5 * x + 0.5; -+ } -+ x = z / y; -+ z = x * x; -+ y = x * (z * poly(z, R) / poly(z, S)); -+ goto Ldone; -+ } -+ -+ // Logarithm using log(1 + x) = x - .5x^^2 + x^^3 P(x) / Q(x) -+ if (x < SQRT1_2) -+ { // 2x - 1 -+ exp -= 1; -+ x = ldexp(x, 1) - 1.0; -+ } -+ else -+ x = x - 1.0; -+ -+ z = x * x; -+ y = x * (z * poly(x, P) / poly(x, Q)); -+ y = y - ldexp(z, -1); -+ -+ // Multiply log of fraction by log10(e) and base 2 exponent by log10(2). -+ // This sequence of operations is critical and it may be horribly -+ // defeated by some compiler optimizers. -+ Ldone: -+ z = y * (LOG2E - 1.0); -+ z += x * (LOG2E - 1.0); -+ z += y; -+ z += x; -+ z += exp; -+ -+ return z; -+ } - } - - unittest -@@ -2309,7 +2953,7 @@ real hypot(real x, real y) @safe pure no - - unittest - { -- static real vals[][3] = // x,y,hypot -+ static real[3][] vals = // x,y,hypot - [ - [ 0.0, 0.0, 0.0], - [ 0.0, -0.0, 0.0], -@@ -2335,7 +2979,7 @@ unittest - real y = vals[i][1]; - real z = vals[i][2]; - real h = hypot(x, y); -- assert(isIdentical(z, h)); -+ assert(isIdentical(z,h) || feqrel(z, h) >= real.mant_dig - 1); - } - } - -@@ -2343,7 +2987,7 @@ unittest - * Returns the value of x rounded upward to the next integer - * (toward positive infinity). - */ --real ceil(real x) @trusted nothrow -+real ceil(real x) @trusted pure nothrow - { - version (Win64) - { -@@ -2365,20 +3009,38 @@ real ceil(real x) @trusted nothrow - } - } - else -- return core.stdc.math.ceill(x); -+ { -+ // Special cases. -+ if (isNaN(x) || isInfinity(x)) -+ return x; -+ -+ real y = floor(x); -+ if (y < x) -+ y += 1.0; -+ -+ return y; -+ } - } - - unittest - { - assert(ceil(+123.456) == +124); - assert(ceil(-123.456) == -123); -+ assert(ceil(-1.234) == -1); -+ assert(ceil(-0.123) == 0); -+ assert(ceil(0.0) == 0); -+ assert(ceil(+0.123) == 1); -+ assert(ceil(+1.234) == 2); -+ assert(ceil(real.infinity) == real.infinity); -+ assert(isNaN(ceil(real.nan))); -+ assert(isNaN(ceil(real.init))); - } - - /************************************** - * Returns the value of x rounded downward to the next integer - * (toward negative infinity). - */ --real floor(real x) @trusted nothrow -+real floor(real x) @trusted pure nothrow - { - version (Win64) - { -@@ -2400,13 +3062,99 @@ real floor(real x) @trusted nothrow - } - } - else -- return core.stdc.math.floorl(x); -+ { -+ // Bit clearing masks. -+ static immutable ushort[17] BMASK = [ -+ 0xffff, 0xfffe, 0xfffc, 0xfff8, -+ 0xfff0, 0xffe0, 0xffc0, 0xff80, -+ 0xff00, 0xfe00, 0xfc00, 0xf800, -+ 0xf000, 0xe000, 0xc000, 0x8000, -+ 0x0000, -+ ]; -+ -+ // Special cases. -+ if (isNaN(x) || isInfinity(x) || x == 0.0) -+ return x; -+ -+ alias floatTraits!(real) F; -+ auto vu = *cast(ushort[real.sizeof/2]*)(&x); -+ -+ // Find the exponent (power of 2) -+ static if (real.mant_dig == 53) -+ { -+ int exp = ((vu[F.EXPPOS_SHORT] >> 4) & 0x7ff) - 0x3ff; -+ -+ version (LittleEndian) -+ int pos = 0; -+ else -+ int pos = 3; -+ } -+ else static if (real.mant_dig == 64) -+ { -+ int exp = (vu[F.EXPPOS_SHORT] & 0x7fff) - 0x3fff; -+ -+ version (LittleEndian) -+ int pos = 0; -+ else -+ int pos = 4; -+ } -+ else if (real.mant_dig == 113) -+ { -+ int exp = (vu[F.EXPPOS_SHORT] & 0x7fff) - 0x3fff; -+ -+ version (LittleEndian) -+ int pos = 0; -+ else -+ int pos = 7; -+ } -+ else -+ static assert(false, "Only 64-bit, 80-bit, and 128-bit reals are supported by floor()"); -+ -+ if (exp < 0) -+ { -+ if (x < 0.0) -+ return -1.0; -+ else -+ return 0.0; -+ } -+ -+ exp = (real.mant_dig - 1) - exp; -+ -+ // Clean out 16 bits at a time. -+ while (exp >= 16) -+ { -+ version (LittleEndian) -+ vu[pos++] = 0; -+ else -+ vu[pos--] = 0; -+ exp -= 16; -+ } -+ -+ // Clear the remaining bits. -+ if (exp > 0) -+ vu[pos] &= BMASK[exp]; -+ -+ real y = *cast(real*)(&vu); -+ -+ if ((x < 0.0) && (x != y)) -+ y -= 1.0; -+ -+ return y; -+ } - } - - unittest - { - assert(floor(+123.456) == +123); - assert(floor(-123.456) == -124); -+ assert(floor(-1.234) == -2); -+ assert(floor(-0.123) == -1); -+ assert(floor(0.0) == 0); -+ assert(floor(+0.123) == 0); -+ assert(floor(+1.234) == 1); -+ assert(floor(real.infinity) == real.infinity); -+ assert(isNaN(floor(real.nan))); -+ assert(isNaN(floor(real.init))); - } - - /****************************************** -@@ -2474,10 +3222,126 @@ long lrint(real x) @trusted pure nothrow - } - else - { -- return core.stdc.math.llrintl(x); -+ static if (real.mant_dig == 53) -+ { -+ long result; -+ -+ // Rounding limit when casting from real(double) to ulong. -+ enum real OF = 4.50359962737049600000E15L; -+ -+ uint* vi = cast(uint*)(&x); -+ -+ // Find the exponent and sign -+ uint msb = vi[MANTISSA_MSB]; -+ uint lsb = vi[MANTISSA_LSB]; -+ int exp = ((msb >> 20) & 0x7ff) - 0x3ff; -+ int sign = msb >> 31; -+ msb &= 0xfffff; -+ msb |= 0x100000; -+ -+ if (exp < 63) -+ { -+ if (exp >= 52) -+ result = (cast(long) msb << (exp - 20)) | (lsb << (exp - 52)); -+ else -+ { -+ // Adjust x and check result. -+ real j = sign ? -OF : OF; -+ x = (j + x) - j; -+ msb = vi[MANTISSA_MSB]; -+ lsb = vi[MANTISSA_LSB]; -+ exp = ((msb >> 20) & 0x7ff) - 0x3ff; -+ msb &= 0xfffff; -+ msb |= 0x100000; -+ -+ if (exp < 0) -+ result = 0; -+ else if (exp < 20) -+ result = cast(long) msb >> (20 - exp); -+ else if (exp == 20) -+ result = cast(long) msb; -+ else -+ result = (cast(long) msb << (exp - 20)) | (lsb >> (52 - exp)); -+ } -+ } -+ else -+ { -+ // It is left implementation defined when the number is too large. -+ return cast(long) x; -+ } -+ -+ return sign ? -result : result; -+ } -+ else static if (real.mant_dig == 64) -+ { -+ alias floatTraits!(real) F; -+ long result; -+ -+ // Rounding limit when casting from real(80-bit) to ulong. -+ enum real OF = 9.22337203685477580800E18L; -+ -+ ushort* vu = cast(ushort*)(&x); -+ uint* vi = cast(uint*)(&x); -+ -+ // Find the exponent and sign -+ int exp = (vu[F.EXPPOS_SHORT] & 0x7fff) - 0x3fff; -+ int sign = (vu[F.EXPPOS_SHORT] >> 15) & 1; -+ -+ if (exp < 63) -+ { -+ // Adjust x and check result. -+ real j = sign ? -OF : OF; -+ x = (j + x) - j; -+ exp = (vu[F.EXPPOS_SHORT] & 0x7fff) - 0x3fff; -+ -+ version (LittleEndian) -+ { -+ if (exp < 0) -+ result = 0; -+ else if (exp <= 31) -+ result = vi[1] >> (31 - exp); -+ else -+ result = (cast(long) vi[1] << (exp - 31)) | (vi[0] >> (63 - exp)); -+ } -+ else -+ { -+ if (exp < 0) -+ result = 0; -+ else if (exp <= 31) -+ result = vi[1] >> (31 - exp); -+ else -+ result = (cast(long) vi[1] << (exp - 31)) | (vi[2] >> (63 - exp)); -+ } -+ } -+ else -+ { -+ // It is left implementation defined when the number is too large -+ // to fit in a 64bit long. -+ return cast(long) x; -+ } -+ -+ return sign ? -result : result; -+ } -+ else -+ { -+ static assert(false, "Only 64-bit and 80-bit reals are supported by lrint()"); -+ } - } - } - -+unittest -+{ -+ assert(lrint(4.5) == 4); -+ assert(lrint(5.5) == 6); -+ assert(lrint(-4.5) == -4); -+ assert(lrint(-5.5) == -6); -+ -+ assert(lrint(int.max - 0.5) == 2147483646L); -+ assert(lrint(int.max + 0.5) == 2147483648L); -+ assert(lrint(int.min - 0.5) == -2147483648L); -+ assert(lrint(int.min + 0.5) == -2147483648L); -+} -+ - /******************************************* - * Return the value of x rounded to the nearest integer. - * If the fractional part of x is exactly 0.5, the return value is rounded to -@@ -2655,6 +3519,18 @@ private: - INVALID_MASK = 0xF80 // PowerPC has five types of invalid exceptions. - } - } -+ else version (PPC64) -+ { -+ // PowerPC FPSCR is a 32-bit register. -+ enum : int -+ { -+ INEXACT_MASK = 0x600, -+ UNDERFLOW_MASK = 0x010, -+ OVERFLOW_MASK = 0x008, -+ DIVBYZERO_MASK = 0x020, -+ INVALID_MASK = 0xF80 // PowerPC has five types of invalid exceptions. -+ } -+ } - else version (ARM) - { - enum : int -@@ -2718,6 +3594,14 @@ private: - { - "fstsw %%ax; andq $0x03D, %%rax;" : "=a" result; - } -+ else version (ARM_SoftFloat) -+ { -+ return 0; -+ } -+ else version (ARM) asm -+ { -+ "vmrs %0, FPSCR; and %0, %0, #0x1F;" : "=r" result; -+ } - else - assert(0, "Not yet supported"); - return result; -@@ -2758,6 +3642,15 @@ private: - { - "fnclex;"; - } -+ else version (ARM_SoftFloat) -+ { -+ } -+ else version (ARM) -+ { -+ uint old = getIeeeFlags(); -+ old &= ~0b11111; // http://infocenter.arm.com/help/topic/com.arm.doc.ddi0408i/Chdfifdc.html -+ asm {"vmsr FPSCR, %0;" : : "r" (old);} -+ } - else - assert(0, "Not yet supported"); - } -@@ -2773,7 +3666,7 @@ private: - } - } - public: -- version (X86_Any) { // TODO: Lift this version condition when we support !x86. -+ version (IeeeFlagsSupport) { - - /// The result cannot be represented exactly, so rounding occured. - /// (example: x = sin(0.1); ) -@@ -2793,7 +3686,14 @@ public: - - } - } -- -+version(X86_Any) -+{ -+ version = IeeeFlagsSupport; -+} -+else version(ARM) -+{ -+ version = IeeeFlagsSupport; -+} - - /// Set all of the floating-point status flags to false. - void resetIeeeFlags() { IeeeFlags.resetIeeeFlags(); } -@@ -2821,23 +3721,36 @@ void resetIeeeFlags() { IeeeFlags.resetI - - - Example: -- ---- -- { -+---- -+{ -+ FloatingPointControl fpctrl; -+ - // Enable hardware exceptions for division by zero, overflow to infinity, - // invalid operations, and uninitialized floating-point variables. -- -- FloatingPointControl fpctrl; - fpctrl.enableExceptions(FloatingPointControl.severeExceptions); - -- double y = x*3.0; // will generate a hardware exception, if x is uninitialized. -- // -+ // This will generate a hardware exception, if x is a -+ // default-initialized floating point variable: -+ real x; // Add `= 0` or even `= real.nan` to not throw the exception. -+ real y = x * 3.0; -+ -+ // The exception is only thrown for default-uninitialized NaN-s. -+ // NaN-s with other payload are valid: -+ real z = y * real.nan; // ok -+ -+ // Changing the rounding mode: - fpctrl.rounding = FloatingPointControl.roundUp; -+ assert(rint(1.1) == 2); - -- // The hardware exceptions will be disabled when leaving this scope. -+ // The set hardware exceptions will be disabled when leaving this scope. - // The original rounding mode will also be restored. -- } -+} - -- ---- -+// Ensure previous values are returned: -+assert(!FloatingPointControl.enabledExceptions); -+assert(FloatingPointControl.rounding == FloatingPointControl.roundToNearest); -+assert(rint(1.1) == 1); -+---- - - */ - struct FloatingPointControl -@@ -2847,62 +3760,143 @@ struct FloatingPointControl - /** IEEE rounding modes. - * The default mode is roundToNearest. - */ -- enum : RoundingMode -+ version(ARM) -+ { -+ enum : RoundingMode -+ { -+ roundToNearest = 0x000000, -+ roundDown = 0x400000, -+ roundUp = 0x800000, -+ roundToZero = 0xC00000 -+ } -+ } -+ else - { -- roundToNearest = 0x0000, -- roundDown = 0x0400, -- roundUp = 0x0800, -- roundToZero = 0x0C00 -- }; -+ enum : RoundingMode -+ { -+ roundToNearest = 0x0000, -+ roundDown = 0x0400, -+ roundUp = 0x0800, -+ roundToZero = 0x0C00 -+ } -+ } - - /** IEEE hardware exceptions. - * By default, all exceptions are masked (disabled). - */ -- enum : uint -+ version(ARM) -+ { -+ enum : uint -+ { -+ subnormalException = 0x8000, -+ inexactException = 0x1000, -+ underflowException = 0x0800, -+ overflowException = 0x0400, -+ divByZeroException = 0x0200, -+ invalidException = 0x0100, -+ /// Severe = The overflow, division by zero, and invalid exceptions. -+ severeExceptions = overflowException | divByZeroException -+ | invalidException, -+ allExceptions = severeExceptions | underflowException -+ | inexactException | subnormalException, -+ } -+ } -+ else - { -- inexactException = 0x20, -- underflowException = 0x10, -- overflowException = 0x08, -- divByZeroException = 0x04, -- subnormalException = 0x02, -- invalidException = 0x01, -- /// Severe = The overflow, division by zero, and invalid exceptions. -- severeExceptions = overflowException | divByZeroException -- | invalidException, -- allExceptions = severeExceptions | underflowException -- | inexactException | subnormalException, -- }; -+ enum : uint -+ { -+ inexactException = 0x20, -+ underflowException = 0x10, -+ overflowException = 0x08, -+ divByZeroException = 0x04, -+ subnormalException = 0x02, -+ invalidException = 0x01, -+ /// Severe = The overflow, division by zero, and invalid exceptions. -+ severeExceptions = overflowException | divByZeroException -+ | invalidException, -+ allExceptions = severeExceptions | underflowException -+ | inexactException | subnormalException, -+ } -+ } - - private: -- enum ushort EXCEPTION_MASK = 0x3F; -- enum ushort ROUNDING_MASK = 0xC00; -+ version(ARM) -+ { -+ enum uint EXCEPTION_MASK = 0x9F00; -+ enum uint ROUNDING_MASK = 0xC00000; -+ } -+ else version(X86) -+ { -+ enum ushort EXCEPTION_MASK = 0x3F; -+ enum ushort ROUNDING_MASK = 0xC00; -+ } -+ else version(X86_64) -+ { -+ enum ushort EXCEPTION_MASK = 0x3F; -+ enum ushort ROUNDING_MASK = 0xC00; -+ } -+ else -+ static assert(false, "Architecture not supported"); - - public: -+ /// Returns true if the current FPU supports exception trapping -+ @property static bool hasExceptionTraps() @safe nothrow -+ { -+ version(X86) -+ return true; -+ else version(X86_64) -+ return true; -+ else version(ARM) -+ { -+ auto oldState = getControlState(); -+ // If exceptions are not supported, we set the bit but read it back as zero -+ // https://sourceware.org/ml/libc-ports/2012-06/msg00091.html -+ setControlState(oldState | (divByZeroException & EXCEPTION_MASK)); -+ bool result = (getControlState() & EXCEPTION_MASK) != 0; -+ setControlState(oldState); -+ return result; -+ } -+ else -+ static assert(false, "Not implemented for this architecture"); -+ } -+ - /// Enable (unmask) specific hardware exceptions. Multiple exceptions may be ORed together. - void enableExceptions(uint exceptions) - { -+ assert(hasExceptionTraps); - initialize(); -- setControlState(getControlState() & ~(exceptions & EXCEPTION_MASK)); -+ version(ARM) -+ setControlState(getControlState() | (exceptions & EXCEPTION_MASK)); -+ else -+ setControlState(getControlState() & ~(exceptions & EXCEPTION_MASK)); - } - - /// Disable (mask) specific hardware exceptions. Multiple exceptions may be ORed together. - void disableExceptions(uint exceptions) - { -+ assert(hasExceptionTraps); - initialize(); -- setControlState(getControlState() | (exceptions & EXCEPTION_MASK)); -+ version(ARM) -+ setControlState(getControlState() & ~(exceptions & EXCEPTION_MASK)); -+ else -+ setControlState(getControlState() | (exceptions & EXCEPTION_MASK)); - } - - //// Change the floating-point hardware rounding mode - @property void rounding(RoundingMode newMode) - { -- ushort old = getControlState(); -- setControlState((old & ~ROUNDING_MASK) | (newMode & ROUNDING_MASK)); -+ initialize(); -+ setControlState((getControlState() & ~ROUNDING_MASK) | (newMode & ROUNDING_MASK)); - } - - /// Return the exceptions which are currently enabled (unmasked) - @property static uint enabledExceptions() - { -- return (getControlState() & EXCEPTION_MASK) ^ EXCEPTION_MASK; -+ assert(hasExceptionTraps); -+ version(ARM) -+ return (getControlState() & EXCEPTION_MASK); -+ else -+ return (getControlState() & EXCEPTION_MASK) ^ EXCEPTION_MASK; - } - - /// Return the currently active rounding mode -@@ -2915,14 +3909,24 @@ public: - ~this() - { - clearExceptions(); -- setControlState(savedState); -+ if (initialized) -+ setControlState(savedState); - } - - private: -- ushort savedState; -+ ControlState savedState; - - bool initialized = false; - -+ version(ARM) -+ { -+ alias ControlState = uint; -+ } -+ else -+ { -+ alias ControlState = ushort; -+ } -+ - void initialize() - { - // BUG: This works around the absence of this() constructors. -@@ -2952,6 +3956,15 @@ private: - { - "fclex;"; - } -+ else version (ARM_SoftFloat) -+ { -+ } -+ else version (ARM) -+ { -+ uint old = getControlState(); -+ old &= ~0b11111; // http://infocenter.arm.com/help/topic/com.arm.doc.ddi0408i/Chdfifdc.html -+ asm {"vmsr FPSCR, %0;" : : "r" (old);} -+ } - else - assert(0, "Not yet supported"); - } -@@ -2960,7 +3973,7 @@ private: - } - - // Read from the control register -- static ushort getControlState() @trusted nothrow -+ static ControlState getControlState() @trusted nothrow - { - version (D_InlineAsm_X86) - { -@@ -2986,7 +3999,7 @@ private: - else - version (GNU) - { -- short cont; -+ ControlState cont; - version (X86) asm - { - "xor %%eax, %%eax; fstcw %[cw];" : [cw] "=m" cont :: "eax"; -@@ -2995,12 +4008,14 @@ private: - { - "xor %%rax, %%rax; fstcw %[cw];" : [cw] "=m" cont :: "rax"; - } -- else version (ARM) asm -+ else version (ARM) - { -- "mrc p10, 7, %[cw], cr1, cr0, 0" -- : -- [cw] "=r" cont -- ; -+ version (ARM_SoftFloat) -+ return 0; -+ else asm -+ { -+ "vmrs %0, FPSCR;" : "=r" cont; -+ } - } - else - assert(0, "Not yet supported"); -@@ -3011,7 +4026,7 @@ private: - } - - // Set the control register -- static void setControlState(ushort newState) @trusted nothrow -+ static void setControlState(ControlState newState) @trusted nothrow - { - version (InlineAsm_X86_Any) - { -@@ -3039,27 +4054,20 @@ private: - { - version (X86) asm - { -- "fclex; fldcw %[cw]" -- : -- : -- [cw] "m" newState -- ; -+ "fclex; fldcw %[cw]" : : [cw] "m" newState; - } - else version (X86_64) asm - { -- "fclex; fldcw %[cw]" -- : -- : -- [cw] "m" newState -- ; -+ "fclex; fldcw %[cw]" : : [cw] "m" newState; - } -- else version (ARM) asm -+ else version (ARM) - { -- "mcr p10, 7, %[cw], cr1, cr0, 0" -- : -- : -- [cw] "r" newState -- ; -+ version (ARM_SoftFloat) -+ return; -+ else asm -+ { -+ "vmsr FPSCR, %0;" : : "r" (newState); -+ } - } - else - assert(0, "Not yet supported"); -@@ -3071,20 +4079,44 @@ private: - - unittest - { -- { -+ //GCC floating point emulation doesn't allow changing -+ //rounding modes, getting error bits etc -+ version(GNU) version(D_SoftFloat) -+ return; -+ -+ void ensureDefaults() -+ { -+ assert(FloatingPointControl.rounding -+ == FloatingPointControl.roundToNearest); -+ if(FloatingPointControl.hasExceptionTraps()) -+ assert(FloatingPointControl.enabledExceptions == 0); -+ } -+ -+ { -+ FloatingPointControl ctrl; -+ } -+ ensureDefaults(); -+ -+ { -+ FloatingPointControl ctrl; -+ ctrl.rounding = FloatingPointControl.roundDown; -+ assert(FloatingPointControl.rounding == FloatingPointControl.roundDown); -+ } -+ ensureDefaults(); -+ -+ if(FloatingPointControl.hasExceptionTraps) -+ { - FloatingPointControl ctrl; - ctrl.enableExceptions(FloatingPointControl.divByZeroException -- | FloatingPointControl.overflowException); -+ | FloatingPointControl.overflowException); - assert(ctrl.enabledExceptions == -- (FloatingPointControl.divByZeroException -- | FloatingPointControl.overflowException)); -+ (FloatingPointControl.divByZeroException -+ | FloatingPointControl.overflowException)); - - ctrl.rounding = FloatingPointControl.roundUp; - assert(FloatingPointControl.rounding == FloatingPointControl.roundUp); - } -- assert(FloatingPointControl.rounding -- == FloatingPointControl.roundToNearest); -- assert(FloatingPointControl.enabledExceptions ==0); -+ ensureDefaults(); - } - - -@@ -3287,7 +4319,7 @@ bool isInfinity(real x) @trusted pure no - { - // double - return ((*cast(ulong *)&x) & 0x7FFF_FFFF_FFFF_FFFF) -- == 0x7FF8_0000_0000_0000; -+ == 0x7FF0000000000000; - } - else static if(real.mant_dig == 106) - { -@@ -3448,12 +4480,13 @@ real NaN(ulong payload) @trusted pure no - { - static if (real.mant_dig == 64) - { -- //real80 -+ //real80 (in x86 real format, the implied bit is actually -+ //not implied but a real bit which is stored in the real) - ulong v = 3; // implied bit = 1, quiet bit = 1 - } - else - { -- ulong v = 2; // no implied bit. quiet bit = 1 -+ ulong v = 1; // no implied bit. quiet bit = 1 - } - - ulong a = payload; -@@ -3516,6 +4549,17 @@ real NaN(ulong payload) @trusted pure no - } - } - -+unittest -+{ -+ static if (real.mant_dig == 53) -+ { -+ auto x = NaN(1); -+ auto xl = *cast(ulong*)&x; -+ assert(xl & 0x8_0000_0000_0000UL); //non-signaling bit, bit 52 -+ assert((xl & 0x7FF0_0000_0000_0000UL) == 0x7FF0_0000_0000_0000UL); //all exp bits set -+ } -+} -+ - /** - * Extract an integral payload from a $(NAN). - * -@@ -3703,7 +4747,11 @@ real nextUp(real x) @trusted pure nothro - } - } - return x; -- } // doubledouble is not supported -+ } -+ else // static if (real.mant_dig==106) // real is doubledouble -+ { -+ assert (0, "nextUp not implemented"); -+ } - } - - /** ditto */ -@@ -4015,13 +5063,17 @@ unittest - { - pragma(msg, "test disabled on x86_64, see bug 5628"); - } -+ else version(ARM) -+ { -+ pragma(msg, "test disabled on ARM, see bug 5628"); -+ } - else - { - assert(pow(xd, neg2) == 1 / (x * x)); - assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x))); - } - -- assert(pow(x, neg3) == 1 / (x * x * x)); -+ assert(feqrel(pow(x, neg3), 1 / (x * x * x)) >= real.mant_dig - 1); - } - - unittest -@@ -4148,13 +5200,18 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - - static real impl(real x, real y) pure nothrow - { -+ // Special cases. - if (isNaN(y)) - return y; -+ if (isNaN(x) && y != 0.0) -+ return x; - -- if (y == 0) -- return 1; // even if x is $(NAN) -- if (isNaN(x) && y != 0) -+ // Even if x is NaN. -+ if (y == 0.0) -+ return 1.0; -+ if (y == 1.0) - return x; -+ - if (isInfinity(y)) - { - if (fabs(x) > 1) -@@ -4179,17 +5236,16 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - if (isInfinity(x)) - { - if (signbit(x)) -- { long i; -- -- i = cast(long)y; -- if (y > 0) -+ { -+ long i = cast(long)y; -+ if (y > 0.0) - { - if (i == y && i & 1) - return -F.infinity; - else - return F.infinity; - } -- else if (y < 0) -+ else if (y < 0.0) - { - if (i == y && i & 1) - return -0.0; -@@ -4199,9 +5255,9 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - } - else - { -- if (y > 0) -+ if (y > 0.0) - return F.infinity; -- else if (y < 0) -+ else if (y < 0.0) - return +0.0; - } - } -@@ -4209,17 +5265,16 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - if (x == 0.0) - { - if (signbit(x)) -- { long i; -- -- i = cast(long)y; -- if (y > 0) -+ { -+ long i = cast(long)y; -+ if (y > 0.0) - { - if (i == y && i & 1) - return -0.0; - else - return +0.0; - } -- else if (y < 0) -+ else if (y < 0.0) - { - if (i == y && i & 1) - return -F.infinity; -@@ -4229,12 +5284,61 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - } - else - { -- if (y > 0) -+ if (y > 0.0) - return +0.0; -- else if (y < 0) -+ else if (y < 0.0) -+ return F.infinity; -+ } -+ } -+ if (x == 1.0) -+ return 1.0; -+ -+ if (y >= F.max) -+ { -+ if ((x > 0.0 && x < 1.0) || (x > -1.0 && x < 0.0)) -+ return 0.0; -+ if (x > 1.0 || x < -1.0) -+ return F.infinity; -+ } -+ if (y <= -F.max) -+ { -+ if ((x > 0.0 && x < 1.0) || (x > -1.0 && x < 0.0)) -+ return F.infinity; -+ if (x > 1.0 || x < -1.0) -+ return 0.0; -+ } -+ -+ if (x >= F.max) -+ { -+ if (y > 0.0) -+ return F.infinity; -+ else -+ return 0.0; -+ } -+ if (x <= -F.max) -+ { -+ long i = cast(long)y; -+ if (y > 0.0) -+ { -+ if (i == y && i & 1) -+ return -F.infinity; -+ else - return F.infinity; - } -+ else if (y < 0.0) -+ { -+ if (i == y && i & 1) -+ return -0.0; -+ else -+ return +0.0; -+ } - } -+ -+ // Integer power of x. -+ long iy = cast(long)y; -+ if (iy == y && fabs(y) < 32768.0) -+ return pow(x, iy); -+ - double sign = 1.0; - if (x < 0) - { -@@ -4260,7 +5364,13 @@ Unqual!(Largest!(F, G)) pow(F, G)(F x, G - } - else - { -- return sign * core.stdc.math.powl(x, y); -+ // If x > 0, x ^^ y == 2 ^^ ( y * log2(x) ) -+ // TODO: This is not accurate in practice. A fast and accurate -+ // (though complicated) method is described in: -+ // "An efficient rounding boundary test for pow(x, y) -+ // in double precision", C.Q. Lauter and V. Lefèvre, INRIA (2007). -+ Float w = exp2(y * log2(x)); -+ return sign * w; - } - } - return impl(x, y); -@@ -4476,7 +5586,10 @@ unittest - } - - assert(feqrel(7.1824L, 7.1824L) == real.mant_dig); -- assert(feqrel(real.min_normal / 8, real.min_normal / 17) == 3); -+ static if(real.mant_dig == 64) -+ { -+ assert(feqrel(real.min_normal / 8, real.min_normal / 17) == 3); -+ } - - testFeqrel!(real)(); - testFeqrel!(double)(); -@@ -4638,6 +5751,7 @@ public: - * Uses Horner's rule A(x) = $(SUB a, 0) + x($(SUB a, 1) + x($(SUB a, 2) - * + x($(SUB a, 3) + ...))) - * Params: -+ * x = the value to evaluate. - * A = array of coefficients $(SUB a, 0), $(SUB a, 1), etc. - */ - real poly(real x, const real[] A) @trusted pure nothrow -@@ -4784,7 +5898,7 @@ unittest - { - debug (math) printf("math.poly.unittest\n"); - real x = 3.1; -- static real pp[] = [56.1, 32.7, 6]; -+ static real[] pp = [56.1, 32.7, 6]; - - assert( poly(x, pp) == (56.1L + (32.7L + 6L * x) * x) ); - } -@@ -4968,3 +6082,10 @@ unittest - real r = tan(-2.0L); - assert(fabs(r - 2.18504f) < .00001); - } -+ -+pure @safe nothrow unittest -+{ -+ // issue 6381: floor/ceil should be usable in pure function. -+ auto x = floor(1.2); -+ auto y = ceil(1.2); -+} ---- a/src/libphobos/src/std/md5.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/md5.d 2014-04-01 16:32:51.000000000 +0100 -@@ -6,7 +6,7 @@ - - /** - * $(RED Scheduled for deprecation. Please use std.digest.md instead.) -- * -+ * - * Computes MD5 digests of arbitrary data. MD5 digests are 16 byte quantities that are like a checksum or crc, but are more robust. - * - * There are two ways to do this. The first does it all in one function call to -@@ -88,6 +88,7 @@ pragma(msg, "std.md5 is scheduled for de - //debug=md5; // uncomment to turn on debugging printf's - - import std.ascii; -+import std.bitmanip; - import std.string; - import std.exception; - debug(md5) import std.c.stdio : printf; -@@ -163,7 +164,10 @@ unittest - string a = "Mary has ", b = "a little lamb"; - int[] c = [ 1, 2, 3, 4, 5 ]; - string d = getDigestString(a, b, c); -- assert(d == "F36625A66B2A8D9F47270C00C8BEFD2F", d); -+ version(LittleEndian) -+ assert(d == "F36625A66B2A8D9F47270C00C8BEFD2F", d); -+ else -+ assert(d == "2656D2008FF10DAE4B0783E6E0171655", d); - } - - /** -@@ -173,12 +177,14 @@ unittest - */ - struct MD5_CTX - { -- uint state[4] = /* state (ABCD) */ -+ private import core.stdc.string : memcpy, memset; -+ -+ uint[4] state = /* state (ABCD) */ - /* magic initialization constants */ - [0x67452301,0xefcdab89,0x98badcfe,0x10325476]; - - ulong count; /* number of bits, modulo 2^64 */ -- ubyte buffer[64]; /* input buffer */ -+ ubyte[64] buffer; /* input buffer */ - - static ubyte[64] PADDING = - [ -@@ -211,28 +217,28 @@ struct MD5_CTX - */ - static void FF(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += F (b, c, d) + x + cast(uint)(ac); -+ a += F (b, c, d) + x + ac; - a = ROTATE_LEFT (a, s); - a += b; - } - - static void GG(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += G (b, c, d) + x + cast(uint)(ac); -+ a += G (b, c, d) + x + ac; - a = ROTATE_LEFT (a, s); - a += b; - } - - static void HH(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += H (b, c, d) + x + cast(uint)(ac); -+ a += H (b, c, d) + x + ac; - a = ROTATE_LEFT (a, s); - a += b; - } - - static void II(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac) - { -- a += I (b, c, d) + x + cast(uint)(ac); -+ a += I (b, c, d) + x + ac; - a = ROTATE_LEFT (a, s); - a += b; - } -@@ -265,7 +271,7 @@ struct MD5_CTX - /* Transform as many times as possible. */ - if (inputLen >= partLen) - { -- std.c.string.memcpy(&buffer[index], input.ptr, partLen); -+ core.stdc.string.memcpy(&buffer[index], input.ptr, partLen); - transform (buffer.ptr); - - for (i = partLen; i + 63 < inputLen; i += 64) -@@ -278,7 +284,7 @@ struct MD5_CTX - - /* Buffer remaining input */ - if (inputLen - i) -- std.c.string.memcpy(&buffer[index], &input[i], inputLen-i); -+ core.stdc.string.memcpy(&buffer[index], &input[i], inputLen-i); - } - - /** MD5 finalization. Ends an MD5 message-digest operation, writing the -@@ -286,11 +292,11 @@ struct MD5_CTX - */ - void finish(ref ubyte[16] digest) /* message digest */ - { -- ubyte bits[8] = void; -+ ubyte[8] bits = void; - uint index, padLen; - - /* Save number of bits */ -- Encode (bits.ptr, cast(const uint*) &count, 8); -+ bits[0 .. 8] = nativeToLittleEndian(count)[]; - - /* Pad out to 56 mod 64. */ - index = (cast(uint)count >> 3) & (64 - 1); -@@ -301,10 +307,13 @@ struct MD5_CTX - update (bits); - - /* Store state in digest */ -- Encode (digest.ptr, state.ptr, 16); -+ digest[0 .. 4] = nativeToLittleEndian(state[0])[]; -+ digest[4 .. 8] = nativeToLittleEndian(state[1])[]; -+ digest[8 .. 12] = nativeToLittleEndian(state[2])[]; -+ digest[12 .. 16] = nativeToLittleEndian(state[3])[]; - - /* Zeroize sensitive information. */ -- std.c.string.memset (&this, 0, MD5_CTX.sizeof); -+ core.stdc.string.memset (&this, 0, MD5_CTX.sizeof); - } - - /* MD5 basic transformation. Transforms state based on block. -@@ -339,7 +348,17 @@ struct MD5_CTX - d = state[3]; - uint[16] x = void; - -- Decode (x.ptr, block, 64); -+ version(BigEndian) -+ { -+ for(size_t i = 0; i < 16; i++) -+ { -+ x[i] = littleEndianToNative!uint(*cast(ubyte[4]*)&block[i*4]); -+ } -+ } -+ else -+ { -+ (cast(ubyte*)x.ptr)[0 .. 64] = block[0 .. 64]; -+ } - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ -@@ -421,46 +440,6 @@ struct MD5_CTX - /* Zeroize sensitive information. */ - x[] = 0; - } -- -- /* Encodes input (uint) into output (ubyte). Assumes len is -- a multiple of 4. -- */ -- private static void Encode (ubyte *output, const uint *input, uint len) -- { -- version (BigEndian) -- { -- uint i, j; -- -- for (i = 0, j = 0; j < len; i++, j += 4) -- { -- *cast(uint *) &output[j] = core.bitop.bswap(input[i]); -- } -- } -- else -- { -- (cast(uint *)output)[0..len/4] = input[0..len/4]; -- } -- } -- -- /* Decodes input (ubyte) into output (uint). Assumes len is -- a multiple of 4. -- */ -- private static void Decode (uint *output, const ubyte *input, uint len) -- { -- version (BigEndian) -- { -- uint i, j; -- -- for (i = 0, j = 0; j < len; i++, j += 4) -- { -- output[i] = core.bitop.bswap(*cast(uint*)&input[j]); -- } -- } -- else -- { -- output[0..len/4] = (cast(const uint *)input)[0..len/4]; -- } -- } - } - - unittest ---- a/src/libphobos/src/std/metastrings.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/metastrings.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,26 +1,30 @@ - // Written in the D programming language. - - /** -+$(RED Deprecated. It will be removed in March 2014. -+ Please use $(XREF string, format), $(XREF conv, to), or -+ $(XREF conv, parse) instead of these templates (which one would depend on -+ which template is being replaced.) They now work in CTFE, and these -+ templates are very inefficient.) -+ - Templates with which to do compile-time manipulation of strings. - - Macros: - WIKI = Phobos/StdMetastrings - --Copyright: Copyright Digital Mars 2007 - 2009. -+Copyright: Copyright Digital Mars 2007 - 2013. - License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. - Authors: $(WEB digitalmars.com, Walter Bright), - Don Clugston - Source: $(PHOBOSSRC std/_metastrings.d) - */ --/* -- Copyright Digital Mars 2007 - 2009. --Distributed under the Boost Software License, Version 1.0. -- (See accompanying file LICENSE_1_0.txt or copy at -- http://www.boost.org/LICENSE_1_0.txt) -- */ - module std.metastrings; - - /** -+$(RED Deprecated. -+ Please use $(XREF string, format) instead. It now works in CTFE, -+ and this template is very inefficient.) -+ - Formats constants into a string at compile time. Analogous to $(XREF - string,format). - -@@ -45,6 +49,7 @@ void main() - * --- - */ - -+deprecated("std.string.format now works in CTFE. Please use it instead.") - template Format(A...) - { - static if (A.length == 0) -@@ -55,6 +60,7 @@ template Format(A...) - enum Format = toStringNow!(A[0]) ~ Format!(A[1..$]); - } - -+deprecated("std.string.format now works in CTFE. Please use it instead.") - template FormatString(const(char)[] F, A...) - { - static if (F.length == 0) -@@ -80,9 +86,14 @@ unittest - } - - /** -+ * $(RED Deprecated. -+ * Please use $(XREF conv, format) instead. It now works in CTFE, -+ * and this template is very inefficient.) -+ * - * Convert constant argument to a string. - */ - -+deprecated("std.conv.to now works in CTFE. Please use it instead.") - template toStringNow(ulong v) - { - static if (v < 10) -@@ -97,6 +108,7 @@ unittest - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(long v) - { - static if (v < 0) -@@ -112,30 +124,35 @@ unittest - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(uint U) - { - enum toStringNow = toStringNow!(cast(ulong)U); - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(int I) - { - enum toStringNow = toStringNow!(cast(long)I); - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(bool B) - { - enum toStringNow = B ? "true" : "false"; - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(string S) - { - enum toStringNow = S; - } - - /// ditto -+deprecated("std.conv.to!string now works in CTFE. Please use it instead.") - template toStringNow(char C) - { - enum toStringNow = "" ~ C; -@@ -143,6 +160,10 @@ template toStringNow(char C) - - - /******** -+ * $(RED Deprecated. -+ * Please use $(XREF conv, parse) instead. It now works in CTFE, -+ * and this template is very inefficient.) -+ * - * Parse unsigned integer literal from the start of string s. - * returns: - * .value = the integer literal as a string, -@@ -152,6 +173,7 @@ template toStringNow(char C) - * .rest = s - */ - -+deprecated("to!string(std.conv.parse!uint(value)) now works in CTFE. Please use it instead.") - template parseUinteger(const(char)[] s) - { - static if (s.length == 0) -@@ -172,6 +194,10 @@ template parseUinteger(const(char)[] s) - } - - /******** -+$(RED Deprecated. -+ Please use $(XREF conv, parse) instead. It now works in CTFE, -+ and this template is very inefficient.) -+ - Parse integer literal optionally preceded by $(D '-') from the start - of string $(D s). - -@@ -184,6 +210,7 @@ Otherwise: - .rest = s - */ - -+deprecated("to!string(std.conv.parse!int(value)) now works in CTFE. Please use it instead.") - template parseInteger(const(char)[] s) - { - static if (s.length == 0) ---- a/src/libphobos/src/std/net/curl.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/net/curl.d 2014-04-01 16:32:51.000000000 +0100 -@@ -396,9 +396,9 @@ unittest - * - * Params: - * url = resource to post to -- * putData = data to send as the body of the request. An array -- * of an arbitrary type is accepted and will be cast to ubyte[] -- * before sending it. -+ * postData = data to send as the body of the request. An array -+ * of an arbitrary type is accepted and will be cast to ubyte[] -+ * before sending it. - * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will - * guess connection type and create a new instance for this call only. - * -@@ -708,6 +708,13 @@ private auto _basicHTTP(T)(const(char)[] - client.onReceiveHeader = null; - client.onReceiveStatusLine = null; - client.onReceive = null; -+ -+ if (sendData !is null && -+ (client.method == HTTP.Method.post || client.method == HTTP.Method.put)) -+ { -+ client.onSend = null; -+ client.handle.onSeek = null; -+ } - } - client.url = url; - HTTP.StatusLine statusLine; -@@ -786,7 +793,12 @@ private auto _basicHTTP(T)(const(char)[] - */ - private auto _basicFTP(T)(const(char)[] url, const(void)[] sendData, FTP client) - { -- scope (exit) client.onReceive = null; -+ scope (exit) -+ { -+ client.onReceive = null; -+ if (!sendData.empty) -+ client.onSend = null; -+ } - - ubyte[] content; - -@@ -894,7 +906,6 @@ struct ByLineBuffer(Char) - * - * Params: - * url = The url to receive content from -- * postData = Data to HTTP Post - * keepTerminator = KeepTerminator.yes signals that the line terminator should be - * returned as part of the lines in the range. - * terminator = The character that terminates a line -@@ -1433,7 +1444,6 @@ static struct AsyncChunkInputRange - * Params: - * url = The url to receive content from - * postData = Data to HTTP Post -- * terminator = The character that terminates a line - * chunkSize = The size of the chunks - * transmitBuffers = The number of chunks buffered asynchronously - * conn = The connection to use e.g. HTTP or FTP. -@@ -2035,6 +2045,61 @@ struct HTTP - - /// The HTTP method to use. - Method method = Method.undefined; -+ -+ @property void onReceiveHeader(void delegate(in char[] key, -+ in char[] value) callback) -+ { -+ // Wrap incoming callback in order to separate http status line from -+ // http headers. On redirected requests there may be several such -+ // status lines. The last one is the one recorded. -+ auto dg = (in char[] header) -+ { -+ if (header.empty) -+ { -+ // header delimiter -+ return; -+ } -+ if (header.startsWith("HTTP/")) -+ { -+ string[string] empty; -+ headersIn = empty; // clear -+ -+ auto m = match(header, regex(r"^HTTP/(\d+)\.(\d+) (\d+) (.*)$")); -+ if (m.empty) -+ { -+ // Invalid status line -+ } -+ else -+ { -+ status.majorVersion = to!ushort(m.captures[1]); -+ status.minorVersion = to!ushort(m.captures[2]); -+ status.code = to!ushort(m.captures[3]); -+ status.reason = m.captures[4].idup; -+ if (onReceiveStatusLine != null) -+ onReceiveStatusLine(status); -+ } -+ return; -+ } -+ -+ // Normal http header -+ auto m = match(cast(char[]) header, regex("(.*?): (.*)$")); -+ -+ auto fieldName = m.captures[1].toLower().idup; -+ if (fieldName == "content-type") -+ { -+ auto mct = match(cast(char[]) m.captures[2], -+ regex("charset=([^;]*)")); -+ if (!mct.empty && mct.captures.length > 1) -+ charset = mct.captures[1].idup; -+ } -+ -+ if (!m.empty && callback !is null) -+ callback(fieldName, m.captures[2]); -+ headersIn[fieldName] = m.captures[2].idup; -+ }; -+ -+ curl.onReceiveHeader = dg; -+ } - } - - private RefCounted!Impl p; -@@ -2551,55 +2616,7 @@ struct HTTP - @property void onReceiveHeader(void delegate(in char[] key, - in char[] value) callback) - { -- // Wrap incoming callback in order to separate http status line from -- // http headers. On redirected requests there may be several such -- // status lines. The last one is the one recorded. -- auto dg = (in char[] header) -- { -- if (header.empty) -- { -- // header delimiter -- return; -- } -- if (header.startsWith("HTTP/")) -- { -- string[string] empty; -- p.headersIn = empty; // clear -- -- auto m = match(header, regex(r"^HTTP/(\d+)\.(\d+) (\d+) (.*)$")); -- if (m.empty) -- { -- // Invalid status line -- } -- else -- { -- p.status.majorVersion = to!ushort(m.captures[1]); -- p.status.minorVersion = to!ushort(m.captures[2]); -- p.status.code = to!ushort(m.captures[3]); -- p.status.reason = m.captures[4].idup; -- if (p.onReceiveStatusLine != null) -- p.onReceiveStatusLine(p.status); -- } -- return; -- } -- -- // Normal http header -- auto m = match(cast(char[]) header, regex("(.*?): (.*)$")); -- -- auto fieldName = m.captures[1].toLower().idup; -- if (fieldName == "content-type") -- { -- auto mct = match(cast(char[]) m.captures[2], -- regex("charset=([^;]*)")); -- if (!mct.empty && mct.captures.length > 1) -- p.charset = mct.captures[1].idup; -- } -- -- if (!m.empty && callback !is null) -- callback(fieldName, m.captures[2]); -- p.headersIn[fieldName] = m.captures[2].idup; -- }; -- p.curl.onReceiveHeader = dg; -+ p.onReceiveHeader = callback; - } - - /** -@@ -3060,6 +3077,23 @@ struct SMTP - curl.shutdown(); - } - Curl curl; -+ -+ @property void message(string msg) -+ { -+ auto _message = msg; -+ /** -+ This delegate reads the message text and copies it. -+ */ -+ curl.onSend = delegate size_t(void[] data) -+ { -+ if (!msg.length) return 0; -+ auto m = cast(void[])msg; -+ size_t to_copy = min(data.length, _message.length); -+ data[0..to_copy] = (cast(void[])_message)[0..to_copy]; -+ _message = _message[to_copy..$]; -+ return to_copy; -+ }; -+ } - } - - private RefCounted!Impl p; -@@ -3329,19 +3363,7 @@ struct SMTP - - @property void message(string msg) - { -- auto _message = msg; -- /** -- This delegate reads the message text and copies it. -- */ -- p.curl.onSend = delegate size_t(void[] data) -- { -- if (!msg.length) return 0; -- auto m = cast(void[])msg; -- size_t to_copy = min(data.length, _message.length); -- data[0..to_copy] = (cast(void[])_message)[0..to_copy]; -- _message = _message[to_copy..$]; -- return to_copy; -- }; -+ p.message = msg; - } - } - -@@ -3357,6 +3379,7 @@ class CurlException : Exception - line = The line number where the exception occurred. - next = The previous exception in the chain of exceptions, if any. - +/ -+ @safe pure nothrow - this(string msg, - string file = __FILE__, - size_t line = __LINE__, -@@ -3378,6 +3401,7 @@ class CurlTimeoutException : CurlExcepti - line = The line number where the exception occurred. - next = The previous exception in the chain of exceptions, if any. - +/ -+ @safe pure nothrow - this(string msg, - string file = __FILE__, - size_t line = __LINE__, -@@ -3394,6 +3418,11 @@ alias CURLcode CurlCode; - Wrapper to provide a better interface to libcurl than using the plain C API. - It is recommended to use the $(D HTTP)/$(D FTP) etc. structs instead unless - raw access to libcurl is needed. -+ -+ Warning: This struct uses interior pointers for callbacks. Only allocate it -+ on the stack if you never move or copy it. This also means passing by reference -+ when passing Curl to other functions. Otherwise always allocate on -+ the heap. - */ - struct Curl - { -@@ -3507,6 +3536,8 @@ struct Curl - - private string errorString(CurlCode code) - { -+ import core.stdc.string : strlen; -+ - auto msgZ = curl_easy_strerror(code); - // doing the following (instead of just using std.conv.to!string) avoids 1 allocation - return format("%s on handle %s", msgZ[0 .. core.stdc.string.strlen(msgZ)], handle); ---- a/src/libphobos/src/std/net/isemail.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/net/isemail.d 2014-04-01 16:32:51.000000000 +0100 -@@ -69,6 +69,7 @@ EmailStatus isEmail (Char) (const(Char)[ - { - alias const(Char)[] tstring; - -+ enum defaultThreshold = 16; - int threshold; - bool diagnose; - -@@ -84,7 +85,7 @@ EmailStatus isEmail (Char) (const(Char)[ - - switch (errorLevel) - { -- case EmailStatusCode.warning: threshold = threshold; break; -+ case EmailStatusCode.warning: threshold = defaultThreshold; break; - case EmailStatusCode.error: threshold = EmailStatusCode.valid; break; - default: threshold = errorLevel; - } -@@ -734,7 +735,7 @@ EmailStatus isEmail (Char) (const(Char)[ - returnStatus ~= EmailStatusCode.rfc5321TopLevelDomainNumeric; - } - -- returnStatus = array(std.algorithm.uniq(returnStatus)); -+ returnStatus = array(uniq(returnStatus)); - auto finalStatus = returnStatus.max(); - - if (returnStatus.length != 1) -@@ -914,86 +915,77 @@ unittest - EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322LocalTooLong, - `Quoted pair is still part of the length restriction`); - -- // assert(`test@[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5321AddressLiteral); // std.regex bug: *+? not allowed in atom -+ assert(`test@[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5321AddressLiteral); - -- // assert(`test@a[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.errorExpectingText); -- // -- // assert(`test@[255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[255.255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[255.255.255.256]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[1111:2222:3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322IpV6GroupCount); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode -- // == EmailStatusCode.rfc5321AddressLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:888G]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6BadChar); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::8888]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321IpV6Deprecated); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555::8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5321AddressLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::7777:8888]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6MaxGroups); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6::3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322IpV6ColonStart); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:::3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5321AddressLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111::4444:5555::8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322IpV6TooManyDoubleColons); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:::]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5321AddressLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:255.255.255.255]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321AddressLiteral); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:255.255.255.255]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444::255.255.255.255]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321AddressLiteral); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::255.255.255.255]`.isEmail(CheckDns.no, -- // EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6MaxGroups); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6:1111:2222:3333:4444:::255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode -- // == EmailStatusCode.rfc5322IpV6TooManyDoubleColons); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[IPv6::255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322IpV6ColonStart); // std.regex bug: *+? not allowed in atom -+ assert(`test@a[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.errorExpectingText); -+ -+ assert(`test@[255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); -+ -+ assert(`test@[255.255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); -+ -+ assert(`test@[255.255.255.256]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); -+ -+ assert(`test@[1111:2222:3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322IpV6GroupCount); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode -+ == EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:888G]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6BadChar); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::8888]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321IpV6Deprecated); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555::8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::7777:8888]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6MaxGroups); -+ -+ assert(`test@[IPv6::3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322IpV6ColonStart); -+ -+ assert(`test@[IPv6:::3333:4444:5555:6666:7777:8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111::4444:5555::8888]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322IpV6TooManyDoubleColons); -+ -+ assert(`test@[IPv6:::]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:255.255.255.255]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666:7777:255.255.255.255]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6GroupCount); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444::255.255.255.255]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5321AddressLiteral); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:5555:6666::255.255.255.255]`.isEmail(CheckDns.no, -+ EmailStatusCode.any).statusCode == EmailStatusCode.rfc5322IpV6MaxGroups); -+ -+ assert(`test@[IPv6:1111:2222:3333:4444:::255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode -+ == EmailStatusCode.rfc5322IpV6TooManyDoubleColons); -+ -+ assert(`test@[IPv6::255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322IpV6ColonStart); - - assert(` test @iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.deprecatedCommentFoldingWhitespaceNearAt); -@@ -1024,8 +1016,8 @@ unittest - assert(`test(comment)test@iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.errorTextAfterCommentFoldingWhitespace); - -- // assert(`test@(comment)[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.deprecatedCommentFoldingWhitespaceNearAt); // std.regex bug: *+? not allowed in atom -+ assert(`test@(comment)[255.255.255.255]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.deprecatedCommentFoldingWhitespaceNearAt); - - assert(`(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org`.isEmail(CheckDns.no, - EmailStatusCode.any).statusCode == EmailStatusCode.comment); -@@ -1077,46 +1069,44 @@ unittest - assert(`test@iana.org(comment\`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.errorBackslashEnd); - -- // assert(`test@[RFC-5322-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322]-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.errorTextAfterDomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322-[domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.errorExpectingDomainText); // std.regex bug: *+? not allowed in atom -- // -- // assert("test@[RFC-5322-\\\u0007-domain-literal]".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteralObsoleteText, `obs-dtext <strong>and</strong> obs-qp`); -- // std.regex bug: *+? not allowed in atom -- // -- // assert("test@[RFC-5322-\\\u0009-domain-literal]".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteralObsoleteText); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322-\]-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteralObsoleteText); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322-domain-literal\]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.errorUnclosedDomainLiteral); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322-domain-literal\`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.errorBackslashEnd); // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC 5322 domain literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral, `Spaces are FWS in a domain literal`); -- // std.regex bug: *+? not allowed in atom -- // -- // assert(`test@[RFC-5322-domain-literal] (comment)`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322DomainLiteral); // std.regex bug: *+? not allowed in atom -+ assert(`test@[RFC-5322-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); - -- assert(`@iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.errorExpectingText); -- assert(`test@.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.errorExpectingText); -- assert(`""@iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.deprecatedQuotedText); -+ assert(`test@[RFC-5322]-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.errorTextAfterDomainLiteral); - -- assert(`"\"@iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ assert(`test@[RFC-5322-[domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.errorExpectingDomainText); -+ -+ assert("test@[RFC-5322-\\\u0007-domain-literal]".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteralObsoleteText, `obs-dtext <strong>and</strong> obs-qp`); -+ -+ assert("test@[RFC-5322-\\\u0009-domain-literal]".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteralObsoleteText); -+ -+ assert(`test@[RFC-5322-\]-domain-literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteralObsoleteText); -+ -+ assert(`test@[RFC-5322-domain-literal\]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.errorUnclosedDomainLiteral); -+ -+ assert(`test@[RFC-5322-domain-literal\`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.errorBackslashEnd); -+ -+ assert(`test@[RFC 5322 domain literal]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral, `Spaces are FWS in a domain literal`); -+ -+ assert(`test@[RFC-5322-domain-literal] (comment)`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322DomainLiteral); -+ -+ assert("\u007F@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.errorExpectingText); -+ assert("test@\u007F.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.errorExpectingText); -+ assert("\"\u007F\"@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.deprecatedQuotedText); -+ -+ assert("\"\\\u007F\"@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.deprecatedQuotedPair); - -- assert(`()test@iana.org`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ assert("(\u007F)test@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.deprecatedCommentText); - - assert("test@iana.org\u000D".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.errorCrNoLf, -@@ -1216,8 +1206,8 @@ unittest - assert(" test@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.foldingWhitespace); - assert(`test@iana.org `.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == EmailStatusCode.foldingWhitespace); - -- // assert(`test@[IPv6:1::2:]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -- // EmailStatusCode.rfc5322IpV6ColonEnd); // std.regex bug: *+? not allowed in atom -+ assert(`test@[IPv6:1::2:]`.isEmail(CheckDns.no, EmailStatusCode.any).statusCode == -+ EmailStatusCode.rfc5322IpV6ColonEnd); - - assert("\"test\\\u00A9\"@iana.org".isEmail(CheckDns.no, EmailStatusCode.any).statusCode == - EmailStatusCode.errorExpectingQuotedPair); -@@ -1681,8 +1671,6 @@ enum EmailStatusCode - - private: - --enum threshold = 16; -- - // Email parts for the isEmail function - enum EmailPart - { -@@ -1751,6 +1739,8 @@ enum AsciiToken - */ - T max (T) (T[] arr) - { -+ import std.algorithm/* : max*/; -+ - auto max = arr.front; - - foreach (i ; 0 .. arr.length - 1) -@@ -1823,7 +1813,6 @@ T[] substr (T) (T[] str, ptrdiff_t start - end = str.length + end; - } - -- - else - end = start + end; - } -@@ -1835,11 +1824,17 @@ T[] substr (T) (T[] str, ptrdiff_t start - - if (end < 0) - end = str.length + end; -+ -+ else -+ end = start + end; - } - - if (start > end) - end = start; - -+ if (end > str.length) -+ end = str.length; -+ - return str[start .. end]; - } - -@@ -1852,6 +1847,8 @@ unittest - assert("abcdef".substr(2, -1) == "cde"); - assert("abcdef".substr(4, -4) == []); - assert("abcdef".substr(-3, -1) == "de"); -+ assert("abcdef".substr(1, 1) == "b"); -+ assert("abcdef".substr(-1, -1) == []); - } - - /* ---- a/src/libphobos/src/std/numeric.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/numeric.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1318,11 +1318,7 @@ unittest - [1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]; - static const y = - [2.0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]; -- assert(dotProduct(x, y) == 2280); -- -- // Test in CTFE -- enum ctfeDot = dotProduct(x, y); -- static assert(ctfeDot == 2280); -+ assertCTFEable!({ assert(dotProduct(x, y) == 2280); }); - } - - /** -@@ -2072,7 +2068,7 @@ unittest - ["nyuk", "I", "have", "no", "chocolate", "giba"], - ["wyda", "I", "have", "I", "have", "have", "I", "have", "hehe"], - 0.5); -- double witness[] = [ 7.0, 4.03125, 0, 0 ]; -+ double[] witness = [ 7.0, 4.03125, 0, 0 ]; - foreach (e; sim) - { - //writeln(e); -@@ -2221,10 +2217,10 @@ private: - recurseRange.popHalf(); - slowFourier2(recurseRange, buf[$ / 2..$]); - } -- -+ - butterfly(buf); - } -- -+ - // This algorithm works by performing the even and odd parts of our FFT - // using the "two for the price of one" method mentioned at - // http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM#Head521 -@@ -2236,7 +2232,7 @@ private: - assert(isPowerOfTwo(range.length)); - } body { - alias ElementType!R E; -- -+ - // Converts odd indices of range to the imaginary components of - // a range half the size. The even indices become the real components. - static if(isArray!R && isFloatingPoint!E) { -@@ -2244,57 +2240,57 @@ private: - // cheap way to convert. This is a common case, so take advantage. - auto oddsImag = cast(Complex!E[]) range; - } else { -- // General case: Use a higher order range. We can assume -+ // General case: Use a higher order range. We can assume - // source.length is even because it has to be a power of 2. - static struct OddToImaginary { - R source; - alias Complex!(CommonType!(E, typeof(buf[0].re))) C; -- -+ - @property { - C front() { - return C(source[0], source[1]); - } -- -+ - C back() { - immutable n = source.length; - return C(source[n - 2], source[n - 1]); - } -- -+ - typeof(this) save() { - return typeof(this)(source.save); - } -- -+ - bool empty() { - return source.empty; - } -- -+ - size_t length() { - return source.length / 2; - } - } -- -+ - void popFront() { - source.popFront(); - source.popFront(); - } -- -+ - void popBack() { - source.popBack(); - source.popBack(); - } -- -+ - C opIndex(size_t index) { - return C(source[index * 2], source[index * 2 + 1]); - } -- -+ - typeof(this) opSlice(size_t lower, size_t upper) { - return typeof(this)(source[lower * 2..upper * 2]); - } - } -- -+ - auto oddsImag = OddToImaginary(range); - } -- -+ - fft(oddsImag, buf[0..$ / 2]); - auto evenFft = buf[0..$ / 2]; - auto oddFft = buf[$ / 2..$]; -@@ -2303,7 +2299,7 @@ private: - oddFft[0].im = 0; - evenFft[0].im = 0; - // evenFft[0].re is already right b/c it's aliased with buf[0].re. -- -+ - foreach(k; 1..halfN / 2 + 1) { - immutable bufk = buf[k]; - immutable bufnk = buf[buf.length / 2 - k]; -@@ -2311,7 +2307,7 @@ private: - evenFft[halfN - k].re = evenFft[k].re; - evenFft[k].im = 0.5 * (bufk.im - bufnk.im); - evenFft[halfN - k].im = -evenFft[k].im; -- -+ - oddFft[k].re = 0.5 * (bufk.im + bufnk.im); - oddFft[halfN - k].re = oddFft[k].re; - oddFft[k].im = 0.5 * (bufnk.re - bufk.re); -@@ -2320,8 +2316,8 @@ private: - - butterfly(buf); - } -- -- void butterfly(R)(R buf) const -+ -+ void butterfly(R)(R buf) const - in { - assert(isPowerOfTwo(buf.length)); - } body { -@@ -2444,8 +2440,8 @@ private: - } - - public: -- /**Create an $(D Fft) object for computing fast Fourier transforms of -- * power of two sizes of $(D size) or smaller. $(D size) must be a -+ /**Create an $(D Fft) object for computing fast Fourier transforms of -+ * power of two sizes of $(D size) or smaller. $(D size) must be a - * power of two. - */ - this(size_t size) { -@@ -2468,7 +2464,7 @@ public: - * - * Note: Pure real FFTs are automatically detected and the relevant - * optimizations are performed. -- * -+ * - * Returns: An array of complex numbers representing the transformed data in - * the frequency domain. - */ -@@ -2510,7 +2506,7 @@ public: - alias ElementType!R E; - static if(is(E : real)) { - return fftImplPureReal(range, buf); -- } else { -+ } else { - static if(is(R : Stride!R)) { - return fftImpl(range, buf); - } else { -@@ -2615,13 +2611,13 @@ unittest { - [36.0, -4, -4, -4, -4, -4, -4, -4])); - assert(approxEqual(map!"a.im"(fft1), - [0, 9.6568, 4, 1.6568, 0, -1.6568, -4, -9.6568])); -- -+ - auto fft1Retro = fft(retro(arr)); - assert(approxEqual(map!"a.re"(fft1Retro), - [36.0, 4, 4, 4, 4, 4, 4, 4])); - assert(approxEqual(map!"a.im"(fft1Retro), -- [0, -9.6568, -4, -1.6568, 0, 1.6568, 4, 9.6568])); -- -+ [0, -9.6568, -4, -1.6568, 0, 1.6568, 4, 9.6568])); -+ - auto fft1Float = fft(to!(float[])(arr)); - assert(approxEqual(map!"a.re"(fft1), map!"a.re"(fft1Float))); - assert(approxEqual(map!"a.im"(fft1), map!"a.im"(fft1Float))); ---- a/src/libphobos/src/std/outbuffer.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/outbuffer.d 2014-04-01 16:32:51.000000000 +0100 -@@ -41,7 +41,7 @@ private - - class OutBuffer - { -- ubyte data[]; -+ ubyte[] data; - size_t offset; - - invariant() -@@ -318,10 +318,7 @@ class OutBuffer - } - else version (Win64) - { -- va_list ap; -- ap = cast(va_list)&format; -- ap += format.sizeof; -- vprintf(format, ap); -+ vprintf(format, _argptr); - } - else version (X86_64) - { ---- a/src/libphobos/src/std/parallelism.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/parallelism.d 2014-04-01 16:32:51.000000000 +0100 -@@ -39,12 +39,12 @@ Synopsis: - import std.algorithm, std.parallelism, std.range; - - void main() { -- // Parallel reduce can be combined with -- // std.algorithm.map to interesting effect. -- // The following example (thanks to Russel Winder) -- // calculates pi by quadrature using -+ // Parallel reduce can be combined with -+ // std.algorithm.map to interesting effect. -+ // The following example (thanks to Russel Winder) -+ // calculates pi by quadrature using - // std.algorithm.map and TaskPool.reduce. -- // getTerm is evaluated in parallel as needed by -+ // getTerm is evaluated in parallel as needed by - // TaskPool.reduce. - // - // Timings on an Athlon 64 X2 dual core machine: -@@ -115,8 +115,8 @@ version(Windows) - { - WORD wProcessorArchitecture; - WORD wReserved; -- }; -- }; -+ } -+ } - DWORD dwPageSize; - LPVOID lpMinimumApplicationAddress; - LPVOID lpMaximumApplicationAddress; -@@ -209,18 +209,18 @@ private template MapType(R, functions... - { - static if(functions.length == 0) - { -- alias typeof(unaryFun!(functions[0])(ElementType!(R).init)) MapType; -+ alias typeof(unaryFun!(functions[0])(ElementType!R.init)) MapType; - } - else - { - alias typeof(adjoin!(staticMap!(unaryFun, functions)) -- (ElementType!(R).init)) MapType; -+ (ElementType!R.init)) MapType; - } - } - - private template ReduceType(alias fun, R, E) - { -- alias typeof(binaryFun!(fun)(E.init, ElementType!(R).init)) ReduceType; -+ alias typeof(binaryFun!fun(E.init, ElementType!R.init)) ReduceType; - } - - private template noUnsharedAliasing(T) -@@ -234,11 +234,10 @@ private template noUnsharedAliasing(T) - private template isSafeTask(F) - { - enum bool isSafeTask = -- ((functionAttributes!(F) & FunctionAttribute.safe) || -- (functionAttributes!(F) & FunctionAttribute.trusted)) && -- !(functionAttributes!F & FunctionAttribute.ref_) && -- (isFunctionPointer!F || !hasUnsharedAliasing!F) && -- allSatisfy!(noUnsharedAliasing, ParameterTypeTuple!F); -+ (functionAttributes!F & (FunctionAttribute.safe | FunctionAttribute.trusted)) != 0 && -+ (functionAttributes!F & FunctionAttribute.ref_) == 0 && -+ (isFunctionPointer!F || !hasUnsharedAliasing!F) && -+ allSatisfy!(noUnsharedAliasing, ParameterTypeTuple!F); - } - - unittest -@@ -248,13 +247,13 @@ unittest - alias void function(uint, string) @trusted F3; - alias void function(uint, char[]) F4; - -- static assert(isSafeTask!(F1)); -- static assert(!isSafeTask!(F2)); -- static assert(isSafeTask!(F3)); -- static assert(!isSafeTask!(F4)); -+ static assert( isSafeTask!F1); -+ static assert(!isSafeTask!F2); -+ static assert( isSafeTask!F3); -+ static assert(!isSafeTask!F4); - - alias uint[] function(uint, string) pure @trusted F5; -- static assert(isSafeTask!(F5)); -+ static assert( isSafeTask!F5); - } - - // This function decides whether Tasks that meet all of the other requirements -@@ -371,11 +370,8 @@ private template isRoundRobin(T) - - unittest - { -- static assert(isRoundRobin!( -- RoundRobinBuffer!(void delegate(char[]), bool delegate()) -- )); -- -- static assert(!isRoundRobin!uint); -+ static assert( isRoundRobin!(RoundRobinBuffer!(void delegate(char[]), bool delegate()))); -+ static assert(!isRoundRobin!(uint)); - } - - // This is the base "class" for all of the other tasks. Using C-style -@@ -392,24 +388,24 @@ private struct AbstractTask - ubyte taskStatus = TaskStatus.notStarted; - - bool done() @property --{ -- if(atomicReadUbyte(taskStatus) == TaskStatus.done) - { -- if(exception) -+ if(atomicReadUbyte(taskStatus) == TaskStatus.done) - { -- throw exception; -+ if(exception) -+ { -+ throw exception; -+ } -+ -+ return true; - } - -- return true; -+ return false; - } - -- return false; --} -- --void job() --{ -- runTask(&this); --} -+ void job() -+ { -+ runTask(&this); -+ } - } - - /** -@@ -442,8 +438,7 @@ Bugs: Changes to $(D ref) and $(D out) - */ - struct Task(alias fun, Args...) - { --AbstractTask base = {runTask : -- &impl}; -+ AbstractTask base = {runTask : &impl}; - alias base this; - - private @property AbstractTask* basePtr() -@@ -773,7 +768,7 @@ AbstractTask base = {runTask : - // Calls $(D fpOrDelegate) with $(D args). This is an - // adapter that makes $(D Task) work with delegates, function pointers and - // functors instead of just aliases. --ReturnType!(F) run(F, Args...)(F fpOrDelegate, ref Args args) -+ReturnType!F run(F, Args...)(F fpOrDelegate, ref Args args) - { - return fpOrDelegate(args); - } -@@ -793,7 +788,7 @@ import std.file; - - void main() - { -- // Create and execute a Task for reading -+ // Create and execute a Task for reading - // foo.txt. - auto file1Task = task!read("foo.txt"); - file1Task.executeInNewThread(); -@@ -808,10 +803,10 @@ void main() - - --- - // Sorts an array using a parallel quick sort algorithm. --// The first partition is done serially. Both recursion -+// The first partition is done serially. Both recursion - // branches are then executed in parallel. - // --// Timings for sorting an array of 1,000,000 doubles on -+// Timings for sorting an array of 1,000,000 doubles on - // an Athlon 64 X2 dual core machine: - // - // This implementation: 176 milliseconds. -@@ -837,7 +832,7 @@ void parallelSort(T)(T[] data) - greaterEqual = data[$ - greaterEqual.length..$]; - - // Execute both recursion branches in parallel. -- auto recurseTask = task!(parallelSort)(greaterEqual); -+ auto recurseTask = task!parallelSort(greaterEqual); - taskPool.put(recurseTask); - parallelSort(less); - recurseTask.yieldForce; -@@ -855,14 +850,14 @@ class/struct with overloaded opCall. - - Examples: - --- --// Read two files in at the same time again, --// but this time use a function pointer instead -+// Read two files in at the same time again, -+// but this time use a function pointer instead - // of an alias to represent std.file.read. - import std.file; - - void main() - { -- // Create and execute a Task for reading -+ // Create and execute a Task for reading - // foo.txt. - auto file1Task = task(&read, "foo.txt"); - file1Task.executeInNewThread(); -@@ -1100,7 +1095,7 @@ private: - - // This function performs initialization for each thread that affects - // thread local storage and therefore must be done from within the -- // worker thread. It then calls executeWorkLoop(). -+ // worker thread. It then calls executeWorkLoop(). - void startWorkLoop() - { - // Initialize thread index. -@@ -1110,7 +1105,7 @@ private: - threadIndex = nextThreadIndex; - nextThreadIndex++; - } -- -+ - executeWorkLoop(); - } - -@@ -1118,7 +1113,7 @@ private: - // until they terminate. It's also entered by non-worker threads when - // finish() is called with the blocking variable set to true. - void executeWorkLoop() -- { -+ { - while(atomicReadUbyte(status) != PoolState.stopNow) - { - AbstractTask* task = pop(); -@@ -1188,7 +1183,7 @@ private: - void abstractPut(AbstractTask* task) - { - queueLock(); -- scope(exit) queueUnlock(); -+ scope(exit) queueUnlock(); - abstractPutNoSync(task); - } - -@@ -1217,7 +1212,7 @@ private: - "finish() or stop()." - ); - } -- -+ - task.next = null; - if (head is null) //Queue is empty. - { -@@ -1243,7 +1238,7 @@ private: - "finish() or stop()." - ); - } -- -+ - if(head is null) - { - head = h; -@@ -1414,8 +1409,7 @@ public: - } - - immutable size_t eightSize = 4 * (this.size + 1); -- auto ret = (rangeLen / eightSize) + -- ((rangeLen % eightSize == 0) ? 0 : 1); -+ auto ret = (rangeLen / eightSize) + ((rangeLen % eightSize == 0) ? 0 : 1); - return max(ret, 1); - } - -@@ -1673,8 +1667,7 @@ public: - } - else - { -- auto buf = uninitializedArray!(MapType!(Args[0], functions)[]) -- (len); -+ auto buf = uninitializedArray!(MapType!(Args[0], functions)[])(len); - alias args args2; - alias Args Args2; - } -@@ -1790,9 +1783,9 @@ public: - - Examples: - --- -- // Pipeline reading a file, converting each line -- // to a number, taking the logarithms of the numbers, -- // and performing the additions necessary to find -+ // Pipeline reading a file, converting each line -+ // to a number, taking the logarithms of the numbers, -+ // and performing the additions necessary to find - // the sum of the logarithms. - - auto lineRange = File("numberList.txt").byLine(); -@@ -1853,11 +1846,11 @@ public: - size_t bufPos; - bool lastTaskWaited; - -- static if(isRandomAccessRange!S) -- { -- alias S FromType; -+ static if(isRandomAccessRange!S) -+ { -+ alias S FromType; - -- void popSource() -+ void popSource() - { - static if(__traits(compiles, source[0..source.length])) - { -@@ -1870,17 +1863,15 @@ public: - else - { - static assert(0, "S must have slicing for Map." -- ~ " " ~ R.stringof ~ " doesn't."); -+ ~ " " ~ S.stringof ~ " doesn't."); - } - } -- - } - else static if(bufferTrick) -- { -- -- // Make sure we don't have the buffer recycling overload of -- // asyncBuf. -- static if( -+ { -+ // Make sure we don't have the buffer recycling overload of -+ // asyncBuf. -+ static if( - is(typeof(source.source)) && - isRoundRobin!(typeof(source.source)) - ) -@@ -1914,11 +1905,10 @@ public: - - return from; - } -- - } - else - { -- alias ElementType!(S)[] FromType; -+ alias ElementType!S[] FromType; - - // The temporary array that data is copied to before being - // mapped. -@@ -1940,155 +1930,155 @@ public: - } - - static if(hasLength!S) -- { -- size_t _length; -+ { -+ size_t _length; - -- public @property size_t length() const pure nothrow @safe -+ public @property size_t length() const pure nothrow @safe - { - return _length; - } - } - -- this(S source, size_t bufSize, size_t workUnitSize, TaskPool pool) -- { -- static if(bufferTrick) -+ this(S source, size_t bufSize, size_t workUnitSize, TaskPool pool) - { -- bufSize = source.buf1.length; -- } -+ static if(bufferTrick) -+ { -+ bufSize = source.buf1.length; -+ } - -- buf1.length = bufSize; -- buf2.length = bufSize; -+ buf1.length = bufSize; -+ buf2.length = bufSize; - -- static if(!isRandomAccessRange!S) -- { -- from.length = bufSize; -- } -- -- this.workUnitSize = (workUnitSize == size_t.max) ? -- pool.defaultWorkUnitSize(bufSize) : workUnitSize; -- this.source = source; -- this.pool = pool; -+ static if(!isRandomAccessRange!S) -+ { -+ from.length = bufSize; -+ } - -- static if(hasLength!S) -- { -- _length = source.length; -- } -+ this.workUnitSize = (workUnitSize == size_t.max) ? -+ pool.defaultWorkUnitSize(bufSize) : workUnitSize; -+ this.source = source; -+ this.pool = pool; - -- buf1 = fillBuf(buf1); -- submitBuf2(); -- } -+ static if(hasLength!S) -+ { -+ _length = source.length; -+ } - -- // The from parameter is a dummy and ignored in the random access -- // case. -- E[] fillBuf(E[] buf) -- { -- static if(isRandomAccessRange!S) -- { -- auto toMap = take(source, buf.length); -- scope(success) popSource(); -+ buf1 = fillBuf(buf1); -+ submitBuf2(); - } -- else -+ -+ // The from parameter is a dummy and ignored in the random access -+ // case. -+ E[] fillBuf(E[] buf) - { -- auto toMap = dumpToFrom(); -- } -+ static if(isRandomAccessRange!S) -+ { -+ auto toMap = take(source, buf.length); -+ scope(success) popSource(); -+ } -+ else -+ { -+ auto toMap = dumpToFrom(); -+ } - -- buf = buf[0..min(buf.length, toMap.length)]; -+ buf = buf[0..min(buf.length, toMap.length)]; - -- // Handle as a special case: -- if(pool.size == 0) -- { -- size_t index = 0; -- foreach(elem; toMap) -+ // Handle as a special case: -+ if(pool.size == 0) - { -- buf[index++] = fun(elem); -+ size_t index = 0; -+ foreach(elem; toMap) -+ { -+ buf[index++] = fun(elem); -+ } -+ return buf; - } -+ -+ pool.amap!functions(toMap, workUnitSize, buf); -+ - return buf; - } - -- pool.amap!(functions)(toMap, workUnitSize, buf); -+ void submitBuf2() -+ in -+ { -+ assert(nextBufTask.prev is null); -+ assert(nextBufTask.next is null); -+ } body -+ { -+ // Hack to reuse the task object. - -- return buf; -- } -+ nextBufTask = typeof(nextBufTask).init; -+ nextBufTask._args[0] = &fillBuf; -+ nextBufTask._args[1] = buf2; -+ pool.put(nextBufTask); -+ } - -- void submitBuf2() -- in -- { -- assert(nextBufTask.prev is null); -- assert(nextBufTask.next is null); -- } body -- { -- // Hack to reuse the task object. -+ void doBufSwap() -+ { -+ if(lastTaskWaited) -+ { -+ // Then the source is empty. Signal it here. -+ buf1 = null; -+ buf2 = null; -+ -+ static if(!isRandomAccessRange!S) -+ { -+ from = null; -+ } - -- nextBufTask = typeof(nextBufTask).init; -- nextBufTask._args[0] = &fillBuf; -- nextBufTask._args[1] = buf2; -- pool.put(nextBufTask); -- } -+ return; -+ } - -- void doBufSwap() -- { -- if(lastTaskWaited) -- { -- // Then the source is empty. Signal it here. -- buf1 = null; -- buf2 = null; -+ buf2 = buf1; -+ buf1 = nextBufTask.yieldForce; -+ bufPos = 0; - -- static if(!isRandomAccessRange!S) -+ if(source.empty) - { -- from = null; -+ lastTaskWaited = true; -+ } -+ else -+ { -+ submitBuf2(); - } -- -- return; - } - -- buf2 = buf1; -- buf1 = nextBufTask.yieldForce; -- bufPos = 0; -- -- if(source.empty) -+ public: -+ @property auto front() - { -- lastTaskWaited = true; -- } -- else -- { -- submitBuf2(); -+ return buf1[bufPos]; - } -- } -- --public: -- @property auto front() -- { -- return buf1[bufPos]; -- } - -- void popFront() -- { -- static if(hasLength!S) -+ void popFront() - { -- _length--; -+ static if(hasLength!S) -+ { -+ _length--; -+ } -+ -+ bufPos++; -+ if(bufPos >= buf1.length) -+ { -+ doBufSwap(); -+ } - } - -- bufPos++; -- if(bufPos >= buf1.length) -+ static if(std.range.isInfinite!S) - { -- doBufSwap(); -+ enum bool empty = false; - } -- } -- -- static if(std.range.isInfinite!S) -- { -- enum bool empty = false; -- } -- else -- { -- -- bool empty() @property -+ else - { -- // popFront() sets this when source is empty -- return buf1.length == 0; -+ -+ bool empty() @property -+ { -+ // popFront() sets this when source is empty -+ return buf1.length == 0; -+ } - } - } -- } - return new Map(source, bufSize, workUnitSize, this); - } - } -@@ -2099,7 +2089,7 @@ public: - $(D source) into a buffer of $(D bufSize) elements in a worker thread, - while making prevously buffered elements from a second buffer, also of size - $(D bufSize), available via the range interface of the returned -- object. The returned range has a length iff $(D hasLength!(S)). -+ object. The returned range has a length iff $(D hasLength!S). - $(D asyncBuf) is useful, for example, when performing expensive operations - on the elements of ranges that represent data on a disk or network. - -@@ -2156,10 +2146,10 @@ public: - - static if(hasLength!S) - { -- size_t _length; -+ size_t _length; - -- // Available if hasLength!(S). -- public @property size_t length() const pure nothrow @safe -+ // Available if hasLength!S. -+ public @property size_t length() const pure nothrow @safe - { - return _length; - } -@@ -2301,8 +2291,8 @@ public: - - Examples: - --- -- // Fetch lines of a file in a background -- // thread while processing prevously fetched -+ // Fetch lines of a file in a background -+ // thread while processing prevously fetched - // lines, without duplicating any lines. - auto file = File("foo.txt"); - -@@ -2311,8 +2301,8 @@ public: - file.readln(buf); - } - -- // Fetch more lines in the background while we -- // process the lines already read into memory -+ // Fetch more lines in the background while we -+ // process the lines already read into memory - // into a matrix of doubles. - double[][] matrix; - auto asyncReader = taskPool.asyncBuf(&next, &file.eof); -@@ -2336,15 +2326,13 @@ public: - processes them is in queue. This is checked for at compile time - and will result in a static assertion failure. - */ -- auto asyncBuf(C1, C2) -- (C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100) -+ auto asyncBuf(C1, C2)(C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100) - if(is(typeof(C2.init()) : bool) && -- ParameterTypeTuple!(C1).length == 1 && -- ParameterTypeTuple!(C2).length == 0 && -- isArray!(ParameterTypeTuple!(C1)[0]) -+ ParameterTypeTuple!C1.length == 1 && -+ ParameterTypeTuple!C2.length == 0 && -+ isArray!(ParameterTypeTuple!C1[0]) - ) { -- auto roundRobin = RoundRobinBuffer!(C1, C2) -- (next, empty, initialBufSize, nBuffers); -+ auto roundRobin = RoundRobinBuffer!(C1, C2)(next, empty, initialBufSize, nBuffers); - return asyncBuf(roundRobin, nBuffers / 2); - } - -@@ -2380,7 +2368,7 @@ public: - those generated by $(XREF algorithm, _reduce) or depending on how many work - units are used. The next argument must be the range to be reduced. - --- -- // Find the sum of squares of a range in parallel, using -+ // Find the sum of squares of a range in parallel, using - // an explicit seed. - // - // Timings on an Athlon 64 X2 dual core machine: -@@ -2397,7 +2385,7 @@ public: - is used as a seed. For the final reduction, the result from the first - work unit is used as the seed. - --- -- // Find the sum of a range in parallel, using the first -+ // Find the sum of a range in parallel, using the first - // element of each work unit as the seed. - auto sum = taskPool.reduce!"a + b"(nums); - --- -@@ -2436,8 +2424,8 @@ public: - /// - auto reduce(Args...)(Args args) - { -- alias reduceAdjoin!(functions) fun; -- alias reduceFinish!(functions) finishFun; -+ alias reduceAdjoin!functions fun; -+ alias reduceFinish!functions finishFun; - - static if(isIntegral!(Args[$ - 1])) - { -@@ -2459,8 +2447,7 @@ public: - } - else - { -- typeof(adjoin!(staticMap!(binaryFun, functions))(e, e)) -- seed = void; -+ typeof(adjoin!(staticMap!(binaryFun, functions))(e, e)) seed = void; - foreach (i, T; seed.Types) - { - auto p = (cast(void*) &seed.expand[i]) -@@ -2505,8 +2492,7 @@ public: - alias typeof(seed) E; - alias typeof(range) R; - -- E reduceOnRange -- (R range, size_t lowerBound, size_t upperBound) -+ E reduceOnRange(R range, size_t lowerBound, size_t upperBound) - { - // This is for exploiting instruction level parallelism by - // using multiple accumulator variables within each thread, -@@ -2603,8 +2589,7 @@ public: - workUnitSize = len; - } - -- immutable size_t nWorkUnits = (len / workUnitSize) + -- ((len % workUnitSize == 0) ? 0 : 1); -+ immutable size_t nWorkUnits = (len / workUnitSize) + ((len % workUnitSize == 0) ? 0 : 1); - assert(nWorkUnits * workUnitSize >= len); - - alias Task!(run, typeof(&reduceOnRange), R, size_t, size_t) RTask; -@@ -2740,10 +2725,10 @@ public: - - Examples: - --- -- // Execute a loop that computes the greatest common -- // divisor of every number from 0 through 999 with -+ // Execute a loop that computes the greatest common -+ // divisor of every number from 0 through 999 with - // 42 in parallel. Write the results out to -- // a set of files, one for each thread. This allows -+ // a set of files, one for each thread. This allows - // results to be written out without any synchronization. - - import std.conv, std.range, std.numeric, std.stdio; -@@ -2773,9 +2758,8 @@ public: - size_t workerIndex() @property @safe const nothrow - { - immutable rawInd = threadIndex; -- return (rawInd >= instanceStartIndex && -- rawInd < instanceStartIndex + size) ? -- (rawInd - instanceStartIndex + 1) : 0; -+ return (rawInd >= instanceStartIndex && rawInd < instanceStartIndex + size) ? -+ (rawInd - instanceStartIndex + 1) : 0; - } - - /** -@@ -2965,7 +2949,7 @@ public: - atomicSetUbyte(barrierDummy, 1); - } - -- return WorkerLocalStorageRange!(T)(this); -+ return WorkerLocalStorageRange!T(this); - } - } - -@@ -2989,7 +2973,7 @@ public: - size_t _length; - size_t beginOffset; - -- this(WorkerLocalStorage!(T) wl) -+ this(WorkerLocalStorage!T wl) - { - this.workerLocalStorage = wl; - _length = wl.size; -@@ -3066,9 +3050,9 @@ public: - create one instance of a class for each worker. For usage example, - see the $(D WorkerLocalStorage) struct. - */ -- WorkerLocalStorage!(T) workerLocalStorage(T)(lazy T initialVal = T.init) -+ WorkerLocalStorage!T workerLocalStorage(T)(lazy T initialVal = T.init) - { -- WorkerLocalStorage!(T) ret; -+ WorkerLocalStorage!T ret; - ret.initialize(this); - foreach(i; 0..size + 1) - { -@@ -3109,10 +3093,10 @@ public: - before returning. This option might be used in applications where - task results are never consumed-- e.g. when $(D TaskPool) is employed as a - rudimentary scheduler for tasks which communicate by means other than -- return values. -- -+ return values. -+ - Warning: Calling this function with $(D blocking = true) from a worker -- thread that is a member of the same $(D TaskPool) that -+ thread that is a member of the same $(D TaskPool) that - $(D finish) is being called on will result in a deadlock. - */ - void finish(bool blocking = false) @trusted -@@ -3123,23 +3107,23 @@ public: - atomicCasUbyte(status, PoolState.running, PoolState.finishing); - notifyAll(); - } -- if (blocking) -+ if (blocking) - { - // Use this thread as a worker until everything is finished. - executeWorkLoop(); -- -- foreach(t; pool) -+ -+ foreach(t; pool) - { - // Maybe there should be something here to prevent a thread - // from calling join() on itself if this function is called - // from a worker thread in the same pool, but: - // -- // 1. Using an if statement to skip join() would result in -+ // 1. Using an if statement to skip join() would result in - // finish() returning without all tasks being finished. - // - // 2. If an exception were thrown, it would bubble up to the - // Task from which finish() was called and likely be -- // swallowed. -+ // swallowed. - t.join(); - } - } -@@ -3333,8 +3317,8 @@ readable. - - Example: - --- --// Find the logarithm of every number from --// 1 to 1_000_000 in parallel, using the -+// Find the logarithm of every number from -+// 1 to 1_000_000 in parallel, using the - // default TaskPool instance. - auto logs = new double[1_000_000]; - -@@ -3380,6 +3364,7 @@ private void submitAndExecute( - - alias typeof(scopedTask(doIt)) PTask; - import core.stdc.stdlib; -+ import core.stdc.string : memcpy; - - // The logical thing to do would be to just use alloca() here, but that - // causes problems on Windows for reasons that I don't understand -@@ -3492,11 +3477,11 @@ int doSizeZeroCase(R, Delegate)(ref Para - - // The explicit ElementType!R in the foreach loops is necessary for - // correct behavior when iterating over strings. -- static if(hasLvalueElements!(R)) -+ static if(hasLvalueElements!R) - { - foreach(ref ElementType!R elem; range) - { -- static if(ParameterTypeTuple!(dg).length == 2) -+ static if(ParameterTypeTuple!dg.length == 2) - { - res = dg(index, elem); - } -@@ -3512,7 +3497,7 @@ int doSizeZeroCase(R, Delegate)(ref Para - { - foreach(ElementType!R elem; range) - { -- static if(ParameterTypeTuple!(dg).length == 2) -+ static if(ParameterTypeTuple!dg.length == 2) - { - res = dg(index, elem); - } -@@ -3621,7 +3606,8 @@ enum string parallelApplyMixinInputRange - - enum bool bufferTrick = true; - } -- else { -+ else -+ { - enum bool bufferTrick = false; - } - -@@ -3635,7 +3621,7 @@ enum string parallelApplyMixinInputRange - - static if(hasLvalueElements!R) - { -- alias ElementType!(R)*[] Temp; -+ alias ElementType!R*[] Temp; - Temp temp; - - // Returns: The previous value of nPopped. -@@ -3643,7 +3629,7 @@ enum string parallelApplyMixinInputRange - { - if(temp is null) - { -- temp = uninitializedArray!(Temp)(workUnitSize); -+ temp = uninitializedArray!Temp(workUnitSize); - } - - rangeMutex.lock(); -@@ -3665,7 +3651,7 @@ enum string parallelApplyMixinInputRange - else - { - -- alias ElementType!(R)[] Temp; -+ alias ElementType!R[] Temp; - Temp temp; - - // Returns: The previous value of nPopped. -@@ -3673,7 +3659,7 @@ enum string parallelApplyMixinInputRange - { - if(temp is null) - { -- temp = uninitializedArray!(Temp)(workUnitSize); -+ temp = uninitializedArray!Temp(workUnitSize); - } - - rangeMutex.lock(); -@@ -3786,7 +3772,8 @@ private void addToChain( - lastException.next = e; - lastException = findLastException(e); - } -- else { -+ else -+ { - firstException = e; - lastException = findLastException(e); - } -@@ -4116,8 +4103,8 @@ unittest - auto tSlow = task!slowFun(); - pool1.put(tSlow); - pool1.finish(); -- tSlow.yieldForce(); -- // Can't assert that pool1.status == PoolState.stopNow because status -+ tSlow.yieldForce; -+ // Can't assert that pool1.status == PoolState.stopNow because status - // doesn't change until after the "done" flag is set and the waiting - // thread is woken up. - -@@ -4126,14 +4113,14 @@ unittest - pool2.put(tSlow2); - pool2.finish(true); // blocking - assert(tSlow2.done); -- -+ - // Test fix for Bug 8582 by making pool size zero. - auto pool3 = new TaskPool(0); - auto tSlow3 = task!slowFun(); - pool3.put(tSlow3); - pool3.finish(true); // blocking - assert(tSlow3.done); -- -+ - // This is correct because no thread will terminate unless pool2.status - // and pool3.status have already been set to stopNow. - assert(pool2.status == TaskPool.PoolState.stopNow); -@@ -4300,7 +4287,8 @@ unittest - - assertThrown!Exception(mapThrow()); - -- struct ThrowingRange { -+ struct ThrowingRange -+ { - @property int front() - { - return 1; -@@ -4390,8 +4378,7 @@ version(parallelismStressTest) - { - foreach(j, number; poolInstance.parallel(nestedInner, 1)) - { -- synchronized writeln -- (i, ": ", letter, " ", j, ": ", number); -+ synchronized writeln(i, ": ", letter, " ", j, ": ", number); - } - } - -@@ -4417,7 +4404,7 @@ version(parallelismStressTest) - assert(poolInstance.workerIndex() == 0); - - // Test worker-local storage. -- auto workerLocalStorage = poolInstance.workerLocalStorage!(uint)(1); -+ auto workerLocalStorage = poolInstance.workerLocalStorage!uint(1); - foreach(i; poolInstance.parallel(iota(0U, 1_000_000))) - { - workerLocalStorage.get++; ---- a/src/libphobos/src/std/path.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/path.d 2014-04-01 16:32:51.000000000 +0100 -@@ -13,7 +13,7 @@ - To differentiate between these cases, use $(XREF file,isDir) and - $(XREF file,exists). - -- Note that on Windows, both the backslash ($(D '\')) and the slash ($(D '/')) -+ Note that on Windows, both the backslash ($(D `\`)) and the slash ($(D `/`)) - are in principle valid directory separators. This module treats them - both on equal footing, but in cases where a $(I new) separator is - added, a backslash will be used. Furthermore, the $(LREF buildNormalizedPath) -@@ -54,6 +54,7 @@ import std.algorithm; - import std.array; - import std.conv; - import std.file: getcwd; -+import std.range; - import std.string; - import std.traits; - -@@ -91,8 +92,8 @@ else static assert (0, "unsupported plat - - /** Determines whether the given character is a directory separator. - -- On Windows, this includes both $(D '\') and $(D '/'). -- On POSIX, it's just $(D '/'). -+ On Windows, this includes both $(D `\`) and $(D `/`). -+ On POSIX, it's just $(D `/`). - */ - bool isDirSeparator(dchar c) @safe pure nothrow - { -@@ -760,6 +761,9 @@ unittest - extension is simply appended to the filename. Including a leading dot - in $(D ext) is optional. - -+ If the extension is empty, this function is equivalent to -+ $(LREF stripExtension). -+ - This function normally allocates a new string (the possible exception - being the case when path is immutable and doesn't already have an - extension). -@@ -768,6 +772,7 @@ unittest - --- - assert (setExtension("file", "ext") == "file.ext"); - assert (setExtension("file", ".ext") == "file.ext"); -+ assert (setExtension("file.old", "") == "file"); - assert (setExtension("file.old", "new") == "file.new"); - assert (setExtension("file.old", ".new") == "file.new"); - --- -@@ -776,10 +781,10 @@ immutable(Unqual!C1)[] setExtension(C1, - @trusted pure nothrow - if (isSomeChar!C1 && !is(C1 == immutable) && is(Unqual!C1 == Unqual!C2)) - { -- if (ext.length > 0 && ext[0] == '.') -- return cast(typeof(return))(stripExtension(path)~ext); -- else -+ if (ext.length > 0 && ext[0] != '.') - return cast(typeof(return))(stripExtension(path)~'.'~ext); -+ else -+ return cast(typeof(return))(stripExtension(path)~ext); - } - - ///ditto -@@ -787,6 +792,9 @@ immutable(C1)[] setExtension(C1, C2)(imm - @trusted pure nothrow - if (isSomeChar!C1 && is(Unqual!C1 == Unqual!C2)) - { -+ if (ext.length == 0) -+ return stripExtension(path); -+ - // Optimised for the case where path is immutable and has no extension - if (ext.length > 0 && ext[0] == '.') ext = ext[1 .. $]; - auto i = extSeparatorPos(path); -@@ -829,8 +837,11 @@ unittest - - static assert (setExtension("file"w.dup, "ext"w) == "file.ext"); - static assert (setExtension("file.old"d.dup, "new"d) == "file.new"); --} - -+ // Issue 10601 -+ assert (setExtension("file", "") == "file"); -+ assert (setExtension("file.ext", "") == "file"); -+} - - - -@@ -886,56 +897,113 @@ unittest - } - - -+/** Combines one or more path segments. - -- --/** Combines one or more path components. -- -- The given path components are concatenated with each other, -- and if necessary, directory separators are inserted between -- them. If any of the path components are rooted (as defined by -- $(LREF isRooted)) the preceding path components will be dropped. -+ This function takes a set of path segments, given as an input -+ range of string elements or as a set of string arguments, -+ and concatenates them with each other. Directory separators -+ are inserted between segments if necessary. If any of the -+ path segments are absolute (as defined by $(LREF isAbsolute)), the -+ preceding segments will be dropped. -+ -+ On Windows, if one of the path segments are rooted, but not absolute -+ (e.g. $(D `\foo`)), all preceding path segments down to the previous -+ root will be dropped. (See below for an example.) - - This function always allocates memory to hold the resulting path. -+ The variadic overload is guaranteed to only perform a single -+ allocation, as is the range version if $(D paths) is a forward -+ range. -+*/ -+immutable(ElementEncodingType!(ElementType!Range))[] -+ buildPath(Range)(Range segments) -+ if (isInputRange!Range && isSomeString!(ElementType!Range)) -+{ -+ if (segments.empty) return null; - -- Examples: -- --- -- version (Posix) -+ // If this is a forward range, we can pre-calculate a maximum length. -+ static if (isForwardRange!Range) - { -- assert (buildPath("foo", "bar", "baz") == "foo/bar/baz"); -- assert (buildPath("/foo/", "bar") == "/foo/bar"); -- assert (buildPath("/foo", "/bar") == "/bar"); -+ auto segments2 = segments.save; -+ size_t precalc = 0; -+ foreach (segment; segments2) precalc += segment.length + 1; - } -+ // Otherwise, just venture a guess and resize later if necessary. -+ else size_t precalc = 255; - -- version (Windows) -+ auto buf = new Unqual!(ElementEncodingType!(ElementType!Range))[](precalc); -+ size_t pos = 0; -+ foreach (segment; segments) - { -- assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`); -- assert (buildPath(`c:\foo`, "bar") == `c:\foo\bar`); -- assert (buildPath("foo", `d:\bar`) == `d:\bar`); -- assert (buildPath("foo", `\bar`) == `\bar`); -+ if (segment.empty) continue; -+ static if (!isForwardRange!Range) -+ { -+ immutable neededLength = pos + segment.length + 1; -+ if (buf.length < neededLength) -+ buf.length = reserve(buf, neededLength + buf.length/2); -+ } -+ if (pos > 0) -+ { -+ if (isRooted(segment)) -+ { -+ version (Posix) -+ { -+ pos = 0; -+ } -+ else version (Windows) -+ { -+ if (isAbsolute(segment)) -+ pos = 0; -+ else -+ { -+ pos = rootName(buf[0 .. pos]).length; -+ if (pos > 0 && isDirSeparator(buf[pos-1])) --pos; -+ } -+ } -+ } -+ else if (!isDirSeparator(buf[pos-1])) -+ buf[pos++] = dirSeparator[0]; -+ } -+ buf[pos .. pos + segment.length] = segment[]; -+ pos += segment.length; - } -- --- --*/ -+ static U trustedCast(U, V)(V v) @trusted pure nothrow { return cast(U) v; } -+ return trustedCast!(typeof(return))(buf[0 .. pos]); -+} -+ -+/// ditto - immutable(C)[] buildPath(C)(const(C[])[] paths...) -- @safe pure //TODO: nothrow (because of reduce() and to()) -+ @safe pure nothrow - if (isSomeChar!C) - { -- static typeof(return) joinPaths(const(C)[] lhs, const(C)[] rhs) -- @trusted pure //TODO: nothrow (because of to()) -+ return buildPath!(typeof(paths))(paths); -+} -+ -+/// -+unittest -+{ -+ version (Posix) - { -- if (rhs.empty) return to!(typeof(return))(lhs); -- if (lhs.empty || isRooted(rhs)) return to!(typeof(return))(rhs); -- if (isDirSeparator(lhs[$-1]) || isDirSeparator(rhs[0])) -- return cast(typeof(return))(lhs ~ rhs); -- else -- return cast(typeof(return))(lhs ~ dirSeparator ~ rhs); -+ assert (buildPath("foo", "bar", "baz") == "foo/bar/baz"); -+ assert (buildPath("/foo/", "bar/baz") == "/foo/bar/baz"); -+ assert (buildPath("/foo", "/bar") == "/bar"); - } - -- return to!(typeof(return))(reduce!joinPaths(paths)); -+ version (Windows) -+ { -+ assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`); -+ assert (buildPath(`c:\foo`, `bar\baz`) == `c:\foo\bar\baz`); -+ assert (buildPath("foo", `d:\bar`) == `d:\bar`); -+ assert (buildPath("foo", `\bar`) == `\bar`); -+ assert (buildPath(`c:\foo`, `\bar`) == `c:\bar`); -+ } - } - -- --unittest -+unittest // non-documented - { -+ // ir() wraps an array in a plain (i.e. non-forward) input range, so that -+ // we can test both code paths -+ InputRange!(C[]) ir(C)(C[][] p...) { return inputRangeObject(p); } - version (Posix) - { - assert (buildPath("foo") == "foo"); -@@ -955,6 +1023,23 @@ unittest - - static assert (buildPath("foo", "bar", "baz") == "foo/bar/baz"); - static assert (buildPath("foo", "/bar", "baz") == "/bar/baz"); -+ -+ // The following are mostly duplicates of the above, except that the -+ // range version does not accept mixed constness. -+ assert (buildPath(ir("foo")) == "foo"); -+ assert (buildPath(ir("/foo/")) == "/foo/"); -+ assert (buildPath(ir("foo", "bar")) == "foo/bar"); -+ assert (buildPath(ir("foo", "bar", "baz")) == "foo/bar/baz"); -+ assert (buildPath(ir("foo/".dup, "bar".dup)) == "foo/bar"); -+ assert (buildPath(ir("foo///".dup, "bar".dup)) == "foo///bar"); -+ assert (buildPath(ir("/foo"w, "bar"w)) == "/foo/bar"); -+ assert (buildPath(ir("foo"w.dup, "/bar"w.dup)) == "/bar"); -+ assert (buildPath(ir("foo"w.dup, "bar/"w.dup)) == "foo/bar/"); -+ assert (buildPath(ir("/"d, "foo"d)) == "/foo"); -+ assert (buildPath(ir(""d.dup, "foo"d.dup)) == "foo"); -+ assert (buildPath(ir("foo"d, ""d)) == "foo"); -+ assert (buildPath(ir("foo", "bar", "baz")) == "foo/bar/baz"); -+ assert (buildPath(ir("foo"w.dup, "/bar"w.dup, "baz"w.dup)) == "/bar/baz"); - } - version (Windows) - { -@@ -964,10 +1049,32 @@ unittest - assert (buildPath("foo", `\bar`) == `\bar`); - assert (buildPath(`c:\foo`, "bar") == `c:\foo\bar`); - assert (buildPath("foo"w, `d:\bar`w.dup) == `d:\bar`); -+ assert (buildPath(`c:\foo\bar`, `\baz`) == `c:\baz`); -+ assert (buildPath(`\\foo\bar\baz`d, `foo`d, `\bar`d) == `\\foo\bar\bar`d); - - static assert (buildPath("foo", "bar", "baz") == `foo\bar\baz`); - static assert (buildPath("foo", `c:\bar`, "baz") == `c:\bar\baz`); -- } -+ -+ assert (buildPath(ir("foo")) == "foo"); -+ assert (buildPath(ir(`\foo/`)) == `\foo/`); -+ assert (buildPath(ir("foo", "bar", "baz")) == `foo\bar\baz`); -+ assert (buildPath(ir("foo", `\bar`)) == `\bar`); -+ assert (buildPath(ir(`c:\foo`, "bar")) == `c:\foo\bar`); -+ assert (buildPath(ir("foo"w.dup, `d:\bar`w.dup)) == `d:\bar`); -+ assert (buildPath(ir(`c:\foo\bar`, `\baz`)) == `c:\baz`); -+ assert (buildPath(ir(`\\foo\bar\baz`d, `foo`d, `\bar`d)) == `\\foo\bar\bar`d); -+ } -+ -+ // Test that allocation works as it should. -+ auto manyShort = "aaa".repeat(1000).array(); -+ auto manyShortCombined = join(manyShort, dirSeparator); -+ assert (buildPath(manyShort) == manyShortCombined); -+ assert (buildPath(ir(manyShort)) == manyShortCombined); -+ -+ auto fewLong = 'b'.repeat(500).array().repeat(10).array(); -+ auto fewLongCombined = join(fewLong, dirSeparator); -+ assert (buildPath(fewLong) == fewLongCombined); -+ assert (buildPath(ir(fewLong)) == fewLongCombined); - } - - unittest -@@ -985,7 +1092,6 @@ unittest - } - - -- - /** Performs the same task as $(LREF buildPath), - while at the same time resolving current/parent directory - symbols ($(D ".") and $(D "..")) and removing superfluous -@@ -1619,8 +1725,11 @@ unittest - assert (equal2(pathSplitter(`\\foo\bar\baz`), [`\\foo\bar`, "baz"])); - } - -- // CTFE -- static assert (equal(pathSplitter("/foo/bar".dup), ["/", "foo", "bar"])); -+ import std.exception; -+ assertCTFEable!( -+ { -+ assert (equal(pathSplitter("/foo/bar".dup), ["/", "foo", "bar"])); -+ }); - } - - -@@ -1703,7 +1812,7 @@ unittest - --- - - On Windows, an absolute path starts at the root directory of -- a specific drive. Hence, it must start with $(D "d:\") or $(D "d:/"), -+ a specific drive. Hence, it must start with $(D `d:\`) or $(D `d:/`), - where $(D d) is the drive letter. Alternatively, it may be a - network path, i.e. a path starting with a double (back)slash. - --- -@@ -1786,6 +1895,7 @@ unittest - assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`); - assert (absolutePath(`..\file`, `c:\foo\bar`) == `c:\foo\bar\..\file`); - assert (absolutePath(`c:\some\file`, `c:\foo\bar`) == `c:\some\file`); -+ assert (absolutePath(`\file`, `c:\foo\bar`) == `c:\file`); - } - --- - -@@ -1818,6 +1928,8 @@ unittest - assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`); - assert (absolutePath(`..\file`, `c:\foo\bar`) == `c:\foo\bar\..\file`); - assert (absolutePath(`c:\some\file`, `c:\foo\bar`) == `c:\some\file`); -+ assert (absolutePath(`\`, `c:\`) == `c:\`); -+ assert (absolutePath(`\some\file`, `c:\foo\bar`) == `c:\some\file`); - static assert (absolutePath(`some\file`, `c:\foo\bar`) == `c:\foo\bar\some\file`); - } - -@@ -1834,14 +1946,14 @@ unittest - taken to be the current working directory. If specified, - $(D base) must be an absolute _path, and it is always assumed - to refer to a directory. If $(D path) and $(D base) refer to -- the same directory, the function returns $(D "."). -+ the same directory, the function returns $(D `.`). - - The following algorithm is used: - $(OL - $(LI If $(D path) is a relative directory, return it unaltered.) - $(LI Find a common root between $(D path) and $(D base). - If there is no common root, return $(D path) unaltered.) -- $(LI Prepare a string with as many $(D "../") or $(D "..\") as -+ $(LI Prepare a string with as many $(D `../`) or $(D `..\`) as - necessary to reach the common root from base path.) - $(LI Append the remaining segments of $(D path) to the string - and return.) -@@ -1943,8 +2055,10 @@ unittest - assert (relativePath("/foo/bar/baz", "/foo/bar") == "baz"); - assertThrown(relativePath("/foo", "bar")); - -- // CTFE -- static assert (relativePath("/foo/bar", "/foo/baz") == "../bar"); -+ assertCTFEable!( -+ { -+ assert (relativePath("/foo/bar", "/foo/baz") == "../bar"); -+ }); - } - else version (Windows) - { -@@ -1958,8 +2072,10 @@ unittest - assert (relativePath(`\\foo\bar`, `c:\foo`) == `\\foo\bar`); - assertThrown(relativePath(`c:\foo`, "bar")); - -- // CTFE -- static assert (relativePath(`c:\foo\bar`, `c:\foo\baz`) == `..\bar`); -+ assertCTFEable!( -+ { -+ assert (relativePath(`c:\foo\bar`, `c:\foo\baz`) == `..\bar`); -+ }); - } - else static assert (0); - } -@@ -1975,7 +2091,7 @@ unittest - which, if not specified, is given by - $(LREF CaseSensitive)$(D .osDefault). - -- On Windows, the backslash and slash characters ($(D '\') and $(D '/')) -+ On Windows, the backslash and slash characters ($(D `\`) and $(D `/`)) - are considered equal. - - Examples: -@@ -2631,6 +2747,9 @@ string expandTilde(string inputPath) - { - version(Posix) - { -+ import core.stdc.string : strlen; -+ import core.stdc.stdlib : getenv, malloc, free; -+ - /* Joins a path from a C string to the remainder of path. - - The last path separator from c_path is discarded. The result -@@ -2801,1305 +2920,3 @@ unittest - assert(expandTilde("~Idontexist/hey") == "~Idontexist/hey"); - } - } -- -- -- -- --// ============================================================================= --// Everything below this line is from an old version of std.path, and is --// deprecated and will be removed in October 2012. --// ============================================================================= -- -- --import std.algorithm, std.array, std.conv, std.file, std.process, std.string, -- std.traits; --import core.stdc.errno, core.stdc.stdlib; -- --deprecated: -- --version(Posix) --{ -- private import core.sys.posix.pwd; --} -- --version(Windows) --{ -- -- /* * String used to separate directory names in a path. Under -- * Windows this is a backslash, under Linux a slash. */ -- enum string sep = "\\"; -- /* * Alternate version of sep[] used in Windows (a slash). Under -- * Linux this is empty. */ -- enum string altsep = "/"; -- /* * Path separator string. A semi colon under Windows, a colon -- * under Linux. */ -- enum string pathsep = ";"; -- /* * String used to separate lines, \r\n under Windows and \n -- * under Linux. */ -- enum string linesep = "\r\n"; // / String used to separate lines. -- enum string curdir = "."; // / String representing the current directory. -- enum string pardir = ".."; // / String representing the parent directory. -- -- private bool isSep(dchar ch) { -- return ch == sep[0] || ch == altsep[0]; -- } -- -- private bool isSepOrDriveSep(dchar ch) { -- return isSep(ch) || ch == ':'; -- } --} --version(Posix) --{ -- /* * String used to separate directory names in a path. Under -- * Windows this is a backslash, under Linux a slash. */ -- enum string sep = "/"; -- /* * Alternate version of sep[] used in Windows (a slash). Under -- * Linux this is empty. */ -- enum string altsep = ""; -- /* * Path separator string. A semi colon under Windows, a colon -- * under Linux. */ -- enum string pathsep = ":"; -- /* * String used to separate lines, \r\n under Windows and \n -- * under Linux. */ -- enum string linesep = "\n"; -- enum string curdir = "."; // / String representing the current directory. -- enum string pardir = ".."; // / String representing the parent directory. -- -- private bool isSep(dchar ch) { -- return ch == sep[0]; -- } --} -- --/****************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF filenameCmp) instead.) -- * -- * Compare file names. -- * Returns: -- * <table border=1 cellpadding=4 cellspacing=0> -- * <tr> <td> < 0 <td> filename1 < filename2 -- * <tr> <td> = 0 <td> filename1 == filename2 -- * <tr> <td> > 0 <td> filename1 > filename2 -- * </table> -- */ --int fcmp(alias pred = "a < b", S1, S2)(S1 s1, S2 s2) -- if (isSomeString!S1 && isSomeString!S2) --{ -- version (Windows) return std.string.icmp(s1, s2); -- version (Posix) return std.algorithm.cmp(s1, s2); --} -- --/*************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF extension) instead.) -- * -- * Extracts the extension from a filename or path. -- * -- * This function will search fullname from the end until the -- * first dot, path separator or first character of fullname is -- * reached. Under Windows, the drive letter separator (<i>colon</i>) -- * also terminates the search. -- * -- * Returns: If a dot was found, characters to its right are -- * returned. If a path separator was found, or fullname didn't -- * contain any dots or path separators, returns null. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * getExt(r"d:\path\foo.bat") // "bat" -- * getExt(r"d:\path.two\bar") // null -- * } -- * version(Posix) -- * { -- * getExt(r"/home/user.name/bar.") // "" -- * getExt(r"d:\\path.two\\bar") // r"two\\bar" -- * getExt(r"/home/user/.resource") // "resource" -- * } -- * ----- -- */ -- --string getExt()(string fullname) --{ -- auto i = fullname.length; -- while (i > 0) -- { -- if (fullname[i - 1] == '.') -- return fullname[i .. $]; -- i--; -- version(Windows) -- { -- if (isSepOrDriveSep(fullname[i])) -- break; -- } -- else version(Posix) -- { -- if (isSep(fullname[i])) -- break; -- } -- else -- { -- static assert(0); -- } -- } -- return null; --} -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.getExt.unittest\n"); -- string result; -- -- version (Windows) -- result = getExt("d:\\path\\foo.bat"); -- version (Posix) -- result = getExt("/path/foo.bat"); -- auto i = cmp(result, "bat"); -- assert(i == 0); -- -- version (Windows) -- result = getExt("d:\\path\\foo."); -- version (Posix) -- result = getExt("d/path/foo."); -- i = cmp(result, ""); -- assert(i == 0); -- -- version (Windows) -- result = getExt("d:\\path\\foo"); -- version (Posix) -- result = getExt("d/path/foo"); -- i = cmp(result, ""); -- assert(i == 0); -- -- version (Windows) -- result = getExt("d:\\path.bar\\foo"); -- version (Posix) -- result = getExt("/path.bar/foo"); -- -- i = cmp(result, ""); -- assert(i == 0); -- -- result = getExt("foo"); -- i = cmp(result, ""); -- assert(i == 0); --} -- --/*************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF stripExtension) instead.) -- * -- * Returns the extensionless version of a filename or path. -- * -- * This function will search fullname from the end until the -- * first dot, path separator or first character of fullname is -- * reached. Under Windows, the drive letter separator (<i>colon</i>) -- * also terminates the search. -- * -- * Returns: If a dot was found, characters to its left are -- * returned. If a path separator was found, or fullname didn't -- * contain any dots or path separators, returns null. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * getName(r"d:\path\foo.bat") => r"d:\path\foo" -- * getName(r"d:\path.two\bar") => null -- * } -- * version(Posix) -- * { -- * getName("/home/user.name/bar.") => "/home/user.name/bar" -- * getName(r"d:\path.two\bar") => r"d:\path" -- * getName("/home/user/.resource") => "/home/user/" -- * } -- * ----- -- */ -- --string getName()(string fullname) --{ -- auto i = fullname.length; -- while (i > 0) -- { -- if (fullname[i - 1] == '.') -- return fullname[0 .. i - 1]; -- i--; -- version(Windows) -- { -- if (isSepOrDriveSep(fullname[i])) -- break; -- } -- else version(Posix) -- { -- if (isSep(fullname[i])) -- break; -- } -- else -- { -- static assert(0); -- } -- } -- return null; --} -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.getName.unittest\n"); -- string result; -- -- result = getName("foo.bar"); -- auto i = cmp(result, "foo"); -- assert(i == 0); -- -- result = getName("d:\\path.two\\bar"); -- version (Windows) -- i = cmp(result, ""); -- version (Posix) -- i = cmp(result, "d:\\path"); -- assert(i == 0); --} -- --/*************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF baseName) instead.) -- * -- * Extracts the base name of a path and optionally chops off a -- * specific suffix. -- * -- * This function will search $(D_PARAM fullname) from the end until -- * the first path separator or first character of $(D_PARAM fullname) -- * is reached. Under Windows, the drive letter separator ($(I colon)) -- * also terminates the search. After the search has ended, keep the -- * portion to the right of the separator if found, or the entire -- * $(D_PARAM fullname) otherwise. If the kept portion has suffix -- * $(D_PARAM extension), remove that suffix. Return the remaining string. -- * -- * Returns: The portion of $(D_PARAM fullname) left after the path -- * part and the extension part, if any, have been removed. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * basename(r"d:\path\foo.bat") => "foo.bat" -- * basename(r"d:\path\foo", ".bat") => "foo" -- * } -- * version(Posix) -- * { -- * basename("/home/user.name/bar.") => "bar." -- * basename("/home/user.name/bar.", ".") => "bar" -- * } -- * ----- -- */ -- --Char[] basename(Char, ExtChar = immutable(char))( -- Char[] fullname, ExtChar[] extension = null) -- if (isSomeChar!Char && isSomeChar!ExtChar) --out (result) --{ -- assert(result.length <= fullname.length); --} --body --{ -- auto i = fullname.length; -- for (; i > 0; i--) -- { -- version(Windows) -- { -- if (isSepOrDriveSep(fullname[i - 1])) -- break; -- } -- else version(Posix) -- { -- if (isSep(fullname[i - 1])) -- break; -- } -- else -- { -- static assert(0); -- } -- } -- return chomp(fullname[i .. $], -- extension.length ? extension : ""); --} -- --/* * Alias for $(D_PARAM basename), kept for backward -- * compatibility. New code should use $(D_PARAM basename). */ --alias basename getBaseName; -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.basename.unittest\n"); -- string result; -- -- version (Windows) -- result = basename("d:\\path\\foo.bat"); -- version (Posix) -- result = basename("/path/foo.bat"); -- //printf("result = '%.*s'\n", result); -- assert(result == "foo.bat"); -- -- version (Windows) -- result = basename("a\\b"); -- version (Posix) -- result = basename("a/b"); -- assert(result == "b"); -- -- version (Windows) -- result = basename("a\\b.cde", ".cde"); -- version (Posix) -- result = basename("a/b.cde", ".cde"); -- assert(result == "b"); -- -- version (Windows) -- { -- assert(basename("abc/xyz") == "xyz"); -- assert(basename("abc/") == ""); -- assert(basename("C:/a/b") == "b"); -- assert(basename(`C:\a/b`) == "b"); -- } -- -- assert(basename("~/dmd.conf"w, ".conf"d) == "dmd"); -- assert(basename("~/dmd.conf"d, ".conf"d) == "dmd"); -- assert(basename("dmd.conf"w.dup, ".conf"d.dup) == "dmd"); --} -- --/*************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF dirName) instead.) -- * -- * Extracts the directory part of a path. -- * -- * This function will search $(D fullname) from the end until the -- * first path separator or first character of $(D fullname) is -- * reached. Under Windows, the drive letter separator ($(I colon)) -- * also terminates the search. -- * -- * Returns: If a path separator was found, all the characters to its -- * left without any trailing path separators are returned. Otherwise, -- * $(D ".") is returned. -- * -- * The found path separator will be included in the returned string -- * if and only if it represents the root. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * assert(dirname(r"d:\path\foo.bat") == r"d:\path"); -- * assert(dirname(r"d:\path") == r"d:\"); -- * assert(dirname("d:foo.bat") == "d:."); -- * assert(dirname("foo.bat") == "."); -- * } -- * version(Posix) -- * { -- * assert(dirname("/home/user") == "/home"); -- * assert(dirname("/home") == "/"); -- * assert(dirname("user") == "."); -- * } -- * ----- -- */ -- --Char[] dirname(Char)(Char[] fullname) -- if (isSomeChar!Char) --{ -- alias immutable(Char)[] ImmString; -- Char[] s = fullname; -- -- version (Posix) -- { -- enum ImmString sep = .sep; -- enum ImmString curdir = .curdir; -- -- for (; !s.empty; s.popBack) -- { -- if (s.endsWith(sep)) -- break; -- } -- if (s.empty) -- { -- return to!(Char[])(curdir); -- } -- -- // remove excess non-root slashes: "/home//" --> "/home" -- while (s.length > sep.length && s.endsWith(sep)) -- { -- s.popBack; -- } -- return s; -- } -- else version (Windows) -- { -- enum ImmString sep = .sep; -- enum ImmString altsep = .altsep; -- enum ImmString curdir = .curdir; -- enum ImmString drvsep = ":"; -- -- bool foundSep; -- for (; !s.empty; s.popBack) -- { -- if (uint withWhat = s.endsWith(sep, altsep, drvsep)) -- { -- foundSep = (withWhat != 3); -- break; -- } -- } -- if (!foundSep) -- { -- return to!(Char[])(s.empty ? curdir : s ~ curdir); -- } -- -- // remove excess non-root separators: "C:\\" --> "C:\" -- while (s.endsWith(sep) || s.endsWith(altsep)) -- { -- auto ss = s.save; -- s.popBack; -- if (s.empty || s.endsWith(drvsep)) -- { -- s = ss; // preserve path separator representing root -- break; -- } -- } -- return s; -- } -- else // unknown platform -- { -- static assert(0); -- } --} -- --version (OldStdPathUnittest) unittest --{ -- assert(dirname("") == "."); -- assert(dirname("fileonly") == "."); -- -- version (Posix) -- { -- assert(dirname("/path/to/file") == "/path/to"); -- assert(dirname("/home") == "/"); -- -- assert(dirname("/dev/zero"w) == "/dev"); -- assert(dirname("/dev/null"d) == "/dev"); -- assert(dirname(".login"w.dup) == "."); -- assert(dirname(".login"d.dup) == "."); -- -- // doc example -- assert(dirname("/home/user") == "/home"); -- assert(dirname("/home") == "/"); -- assert(dirname("user") == "."); -- } -- version (Windows) -- { -- assert(dirname(r"\path\to\file") == r"\path\to"); -- assert(dirname(r"\foo") == r"\"); -- assert(dirname(r"c:\foo") == r"c:\"); -- -- assert(dirname("\\Windows"w) == "\\"); -- assert(dirname("\\Users"d) == "\\"); -- assert(dirname("ntuser.dat"w.dup) == "."); -- assert(dirname("ntuser.dat"d.dup) == "."); -- -- // doc example -- assert(dirname(r"d:\path\foo.bat") == r"d:\path"); -- assert(dirname(r"d:\path") == "d:\\"); -- assert(dirname("d:foo.bat") == "d:."); -- assert(dirname("foo.bat") == "."); -- } -- -- { -- // fixed-length strings -- char[4] u = "abcd"; -- wchar[4] w = "abcd"; -- dchar[4] d = "abcd"; -- assert(dirname(u) == "."); -- assert(dirname(w) == "."w); -- assert(dirname(d) == "."d); -- } --} -- --/* * Alias for $(D_PARAM dirname), kept for backward -- * compatibility. New code should use $(D_PARAM dirname). */ --alias dirname getDirName; -- --version (OldStdPathUnittest) unittest --{ -- string filename = "foo/bar"; -- auto d = getDirName(filename); -- assert(d == "foo"); --} -- --version (OldStdPathUnittest) unittest // dirname + basename --{ -- static immutable Common_dirbasename_testcases = -- [ -- [ "/usr/lib" , "/usr" , "lib" ], -- [ "/usr/" , "/usr" , "" ], -- [ "/usr" , "/" , "usr" ], -- [ "/" , "/" , "" ], -- -- [ "var/run" , "var" , "run" ], -- [ "var/" , "var" , "" ], -- [ "var" , "." , "var" ], -- [ "." , "." , "." ], -- -- [ "/usr///lib", "/usr" , "lib" ], -- [ "///usr///" , "///usr" , "" ], -- [ "///usr" , "/" , "usr" ], -- [ "///" , "/" , "" ], -- [ "var///run" , "var" , "run" ], -- [ "var///" , "var" , "" ], -- -- [ "a/b/c" , "a/b" , "c" ], -- [ "a///c" , "a" , "c" ], -- [ "/\u7A74" , "/" , "\u7A74" ], -- [ "/\u7A74/." , "/\u7A74", "." ] -- ]; -- -- static immutable Windows_dirbasename_testcases = -- Common_dirbasename_testcases ~ -- [ -- [ "C:\\Users\\7mi", "C:\\Users", "7mi" ], -- [ "C:\\Users\\" , "C:\\Users", "" ], -- [ "C:\\Users" , "C:\\" , "Users" ], -- [ "C:\\" , "C:\\" , "" ], -- -- [ "C:Temp" , "C:." , "Temp" ], -- [ "C:" , "C:." , "" ], -- [ "\\dmd\\src" , "\\dmd" , "src" ], -- [ "\\dmd\\" , "\\dmd" , "" ], -- [ "\\dmd" , "\\" , "dmd" ], -- -- [ "C:/Users/7mi" , "C:/Users" , "7mi" ], -- [ "C:/Users/" , "C:/Users" , "" ], -- [ "C:/Users" , "C:/" , "Users" ], -- [ "C:/" , "C:/" , "" ], -- -- [ "C:\\//WinNT" , "C:\\" , "WinNT" ], -- [ "C://\\WinNT" , "C:/" , "WinNT" ], -- -- [ `a\b\c` , `a\b` , "c" ], -- [ `a\\\c` , "a" , "c" ] -- ]; -- -- version (Windows) -- alias Windows_dirbasename_testcases testcases; -- else -- alias Common_dirbasename_testcases testcases; -- -- foreach (tc; testcases) -- { -- string path = tc[0]; -- string dir = tc[1]; -- string base = tc[2]; -- -- assert(path.dirname == dir); -- assert(path.basename == base); -- } --} -- -- --/********************************* -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF driveName) instead.) -- * -- * Extracts the drive letter of a path. -- * -- * This function will search fullname for a colon from the beginning. -- * -- * Returns: If a colon is found, all the characters to its left -- * plus the colon are returned. Otherwise, null is returned. -- * -- * Under Linux, this function always returns null immediately. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * getDrive(r"d:\path\foo.bat") => "d:" -- * ----- -- */ -- --Char[] getDrive(Char)(Char[] fullname) if (isSomeChar!Char) --// out(result) --// { --// assert(result.length <= fullname.length); --// } --body --{ -- version(Windows) -- { -- foreach (i; 0 .. fullname.length) -- { -- if (fullname[i] == ':') -- return fullname[0 .. i + 1]; -- } -- return null; -- } -- else version(Posix) -- { -- return null; -- } -- else -- { -- static assert(0); -- } --} -- --/***************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF defaultExtension) instead.) -- * -- * Appends a default extension to a filename. -- * -- * This function first searches filename for an extension and -- * appends ext if there is none. ext should not have any leading -- * dots, one will be inserted between filename and ext if filename -- * doesn't already end with one. -- * -- * Returns: filename if it contains an extension, otherwise filename -- * + ext. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * defaultExt("foo.txt", "raw") => "foo.txt" -- * defaultExt("foo.", "raw") => "foo.raw" -- * defaultExt("bar", "raw") => "bar.raw" -- * ----- -- */ -- --string defaultExt()(string filename, string ext) --{ -- string existing; -- -- existing = getExt(filename); -- if (existing.length == 0) -- { -- // Check for filename ending in '.' -- if (filename.length && filename[$ - 1] == '.') -- filename ~= ext; -- else -- filename = filename ~ "." ~ ext; -- } -- return filename; --} -- -- --/***************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF setExtension) instead.) -- * -- * Adds or replaces an extension to a filename. -- * -- * This function first searches filename for an extension and -- * replaces it with ext if found. If there is no extension, ext -- * will be appended. ext should not have any leading dots, one will -- * be inserted between filename and ext if filename doesn't already -- * end with one. -- * -- * Returns: filename + ext if filename is extensionless. Otherwise -- * strips filename's extension off, appends ext and returns the -- * result. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * addExt("foo.txt", "raw") => "foo.raw" -- * addExt("foo.", "raw") => "foo.raw" -- * addExt("bar", "raw") => "bar.raw" -- * ----- -- */ -- --string addExt()(string filename, string ext) --{ -- string existing; -- -- existing = getExt(filename); -- if (existing.length == 0) -- { -- // Check for filename ending in '.' -- if (filename.length && filename[$ - 1] == '.') -- filename ~= ext; -- else -- filename = filename ~ "." ~ ext; -- } -- else -- { -- filename = filename[0 .. $ - existing.length] ~ ext; -- } -- return filename; --} -- -- --/************************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF isAbsolute) instead.) -- * -- * Checks if path is absolute. -- * -- * Returns: non-zero if the path starts from the root directory (Linux) or -- * drive letter and root directory (Windows), -- * zero otherwise. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * isabs(r"relative\path") => 0 -- * isabs(r"\relative\path") => 0 -- * isabs(r"d:\absolute") => 1 -- * } -- * version(Posix) -- * { -- * isabs("/home/user") => 1 -- * isabs("foo") => 0 -- * } -- * ----- -- */ -- --bool isabs()(in char[] path) --{ -- auto d = getDrive(path); -- version (Windows) -- { -- return d.length < path.length && isSep(path[d.length]); -- } -- else version (Posix) -- { -- return d.length < path.length && isSep(path[d.length]); -- } -- else -- { -- static assert(0); -- } --} -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.isabs.unittest\n"); -- -- version (Windows) -- { -- assert(!isabs(r"relative\path")); -- assert(isabs(r"\relative\path")); -- assert(isabs(r"d:\absolute")); -- } -- version (Posix) -- { -- assert(isabs("/home/user")); -- assert(!isabs("foo")); -- } --} -- --/** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF absolutePath) instead.) -- * -- * Converts a relative path into an absolute path. -- */ --string rel2abs()(string path) --{ -- if (!path.length || isabs(path)) -- { -- return path; -- } -- auto myDir = getcwd; -- if (path.startsWith(curdir)) -- { -- auto p = path[curdir.length .. $]; -- if (p.startsWith(sep)) -- path = p[sep.length .. $]; -- else if (altsep.length && p.startsWith(altsep)) -- path = p[altsep.length .. $]; -- else if (!p.length) -- path = null; -- } -- return myDir.endsWith(sep) || path.length -- ? join(myDir, path) -- : myDir; --} -- --version (OldStdPathUnittest) unittest --{ -- version (Posix) -- { -- auto myDir = getcwd(); -- scope(exit) std.file.chdir(myDir); -- std.file.chdir("/"); -- assert(rel2abs(".") == "/", rel2abs(".")); -- assert(rel2abs("bin") == "/bin", rel2abs("bin")); -- assert(rel2abs("./bin") == "/bin", rel2abs("./bin")); -- std.file.chdir("bin"); -- assert(rel2abs(".") == "/bin", rel2abs(".")); -- } --} -- --/************************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF buildPath) instead.) -- * -- * Joins two or more path components. -- * -- * If p1 doesn't have a trailing path separator, one will be appended -- * to it before concatenating p2. -- * -- * Returns: p1 ~ p2. However, if p2 is an absolute path, only p2 -- * will be returned. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * join(r"c:\foo", "bar") => r"c:\foo\bar" -- * join("foo", r"d:\bar") => r"d:\bar" -- * } -- * version(Posix) -- * { -- * join("/foo/", "bar") => "/foo/bar" -- * join("/foo", "/bar") => "/bar" -- * } -- * ----- -- */ -- --string join()(const(char)[] p1, const(char)[] p2, const(char[])[] more...) --{ -- if (more.length) -- { -- // more than two components present -- return join(join(p1, p2), more[0], more[1 .. $]); -- } -- -- // Focus on exactly two components -- if (!p2.length) -- return p1.idup; -- if (!p1.length) -- return p2.idup; -- -- version (Posix) -- { -- if (isabs(p2)) return p2.idup; -- if (p1.endsWith(sep) || altsep.length && p1.endsWith(altsep)) -- { -- return cast(string) (p1 ~ p2); -- } -- return cast(string) (p1 ~ sep ~ p2); -- } -- else version (Windows) -- { -- string p; -- const(char)[] d1; -- -- if (getDrive(p2)) -- { -- p = p2.idup; -- } -- else -- { -- d1 = getDrive(p1); -- if (p1.length == d1.length) -- { -- p = cast(string) (p1 ~ p2); -- } -- else if (isSep(p2[0])) -- { -- if (d1.length == 0) -- p = p2.idup; -- else if (isSep(p1[$ - 1])) -- p = cast(string) (p1 ~ p2[1 .. $]); -- else -- p = cast(string) (p1 ~ p2); -- } -- else if (isSep(p1[$ - 1])) -- { -- p = cast(string) (p1 ~ p2); -- } -- else -- { -- p = cast(string)(p1 ~ sep ~ p2); -- } -- } -- return p; -- } -- else // unknown platform -- { -- static assert(0); -- } --} -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.join.unittest\n"); -- -- string p; -- ptrdiff_t i; -- -- p = join("foo", "bar"); -- version (Windows) -- i = cmp(p, "foo\\bar"); -- version (Posix) -- i = cmp(p, "foo/bar"); -- assert(i == 0); -- -- version (Windows) -- { p = join("foo\\", "bar"); -- i = cmp(p, "foo\\bar"); -- } -- version (Posix) -- { p = join("foo/", "bar"); -- i = cmp(p, "foo/bar"); -- } -- assert(i == 0); -- -- version (Windows) -- { p = join("foo", "\\bar"); -- i = cmp(p, "\\bar"); -- } -- version (Posix) -- { p = join("foo", "/bar"); -- i = cmp(p, "/bar"); -- } -- assert(i == 0); -- -- version (Windows) -- { p = join("foo\\", "\\bar"); -- i = cmp(p, "\\bar"); -- } -- version (Posix) -- { p = join("foo/", "/bar"); -- i = cmp(p, "/bar"); -- } -- assert(i == 0); -- -- version(Windows) -- { -- p = join("d:", "bar"); -- i = cmp(p, "d:bar"); -- assert(i == 0); -- -- p = join("d:\\", "bar"); -- i = cmp(p, "d:\\bar"); -- assert(i == 0); -- -- p = join("d:\\", "\\bar"); -- i = cmp(p, "d:\\bar"); -- assert(i == 0); -- -- p = join("d:\\foo", "bar"); -- i = cmp(p, "d:\\foo\\bar"); -- assert(i == 0); -- -- p = join("d:", "\\bar"); -- i = cmp(p, "d:\\bar"); -- assert(i == 0); -- -- p = join("foo", "d:"); -- i = cmp(p, "d:"); -- assert(i == 0); -- -- p = join("foo", "d:\\"); -- i = cmp(p, "d:\\"); -- assert(i == 0); -- -- p = join("foo", "d:\\bar"); -- i = cmp(p, "d:\\bar"); -- assert(i == 0); -- -- assert(join("d","dmd","src") == "d\\dmd\\src"); -- } -- -- assert (join("", "foo") == "foo"); -- assert (join("foo", "") == "foo"); --} -- --unittest --{ -- // 7397 -- string[] ary = ["a", "b"]; -- version (Posix) -- { -- assert (join("x", "y", ary) == "x/y/a/b"); -- } -- else version (Windows) -- { -- assert (join("x", "y", ary) == `x\y\a\b`); -- } --} -- --/********************************** -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF filenameCharCmp) instead.) -- * -- * Matches filename characters. -- * -- * Under Windows, the comparison is done ignoring case. Under Linux -- * an exact match is performed. -- * -- * Returns: non zero if c1 matches c2, zero otherwise. -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * fncharmatch('a', 'b') => 0 -- * fncharmatch('A', 'a') => 1 -- * } -- * version(Posix) -- * { -- * fncharmatch('a', 'b') => 0 -- * fncharmatch('A', 'a') => 0 -- * } -- * ----- -- */ -- --bool fncharmatch()(dchar c1, dchar c2) --{ -- version (Windows) -- { -- if (c1 != c2) -- { -- if ('A' <= c1 && c1 <= 'Z') -- c1 += cast(char)'a' - 'A'; -- if ('A' <= c2 && c2 <= 'Z') -- c2 += cast(char)'a' - 'A'; -- return c1 == c2; -- } -- return true; -- } -- else version (Posix) -- { -- return c1 == c2; -- } -- else -- { -- static assert(0); -- } --} -- --/************************************* -- * $(RED Deprecated. It will be removed in October 2012. Please use -- * $(LREF globMatch) instead.) -- * -- * Matches a pattern against a filename. -- * -- * Some characters of pattern have special a meaning (they are -- * <i>meta-characters</i>) and <b>can't</b> be escaped. These are: -- * <p><table> -- * <tr><td><b>*</b></td> -- * <td>Matches 0 or more instances of any character.</td></tr> -- * <tr><td><b>?</b></td> -- * <td>Matches exactly one instances of any character.</td></tr> -- * <tr><td><b>[</b><i>chars</i><b>]</b></td> -- * <td>Matches one instance of any character that appears -- * between the brackets.</td></tr> -- * <tr><td><b>[!</b><i>chars</i><b>]</b></td> -- * <td>Matches one instance of any character that does not appear -- * between the brackets after the exclamation mark.</td></tr> -- * </table><p> -- * Internally individual character comparisons are done calling -- * fncharmatch(), so its rules apply here too. Note that path -- * separators and dots don't stop a meta-character from matching -- * further portions of the filename. -- * -- * Returns: non zero if pattern matches filename, zero otherwise. -- * -- * See_Also: fncharmatch(). -- * -- * Throws: Nothing. -- * -- * Examples: -- * ----- -- * version(Windows) -- * { -- * fnmatch("foo.bar", "*") => 1 -- * fnmatch(r"foo/foo\bar", "f*b*r") => 1 -- * fnmatch("foo.bar", "f?bar") => 0 -- * fnmatch("Goo.bar", "[fg]???bar") => 1 -- * fnmatch(r"d:\foo\bar", "d*foo?bar") => 1 -- * } -- * version(Posix) -- * { -- * fnmatch("Go*.bar", "[fg]???bar") => 0 -- * fnmatch("/foo*home/bar", "?foo*bar") => 1 -- * fnmatch("foobar", "foo?bar") => 1 -- * } -- * ----- -- */ --bool fnmatch()(const(char)[] filename, const(char)[] pattern) --in --{ -- // Verify that pattern[] is valid -- assert(balancedParens(pattern, '[', ']', 0)); -- assert(balancedParens(pattern, '{', '}', 0)); --} --body --{ -- size_t ni; // current character in filename -- -- foreach (pi; 0 .. pattern.length) -- { -- char pc = pattern[pi]; -- switch (pc) -- { -- case '*': -- if (pi + 1 == pattern.length) -- return true; -- foreach (j; ni .. filename.length) -- { -- if (fnmatch(filename[j .. $], -- pattern[pi + 1 .. $])) -- return true; -- } -- return false; -- -- case '?': -- if (ni == filename.length) -- return false; -- ni++; -- break; -- -- case '[': { -- if (ni == filename.length) -- return false; -- auto nc = filename[ni]; -- ni++; -- auto not = false; -- pi++; -- if (pattern[pi] == '!') -- { -- not = true; -- pi++; -- } -- auto anymatch = false; -- while (1) -- { -- pc = pattern[pi]; -- if (pc == ']') -- break; -- if (!anymatch && fncharmatch(nc, pc)) -- anymatch = true; -- pi++; -- } -- if (anymatch == not) -- return false; -- } -- break; -- -- case '{': { -- // find end of {} section -- auto piRemain = pi; -- for (; piRemain < pattern.length -- && pattern[piRemain] != '}'; piRemain++) -- {} -- -- if (piRemain < pattern.length) piRemain++; -- pi++; -- -- while (pi < pattern.length) -- { -- auto pi0 = pi; -- pc = pattern[pi]; -- // find end of current alternative -- for (; pi<pattern.length && pc!='}' && pc!=','; pi++) -- { -- pc = pattern[pi]; -- } -- -- if (pi0 == pi) -- { -- if (fnmatch(filename[ni..$], pattern[piRemain..$])) -- { -- return true; -- } -- pi++; -- } -- else -- { -- if (fnmatch(filename[ni..$], -- pattern[pi0..pi-1] -- ~ pattern[piRemain..$])) -- { -- return true; -- } -- } -- if (pc == '}') -- { -- break; -- } -- } -- } -- return false; -- -- default: -- if (ni == filename.length) -- return false; -- if (!fncharmatch(pc, filename[ni])) -- return false; -- ni++; -- break; -- } -- } -- assert(ni <= filename.length); -- return ni == filename.length; --} -- --version (OldStdPathUnittest) unittest --{ -- debug(path) printf("path.fnmatch.unittest\n"); -- -- version (Windows) -- assert(fnmatch("foo", "Foo")); -- version (linux) -- assert(!fnmatch("foo", "Foo")); -- assert(fnmatch("foo", "*")); -- assert(fnmatch("foo.bar", "*")); -- assert(fnmatch("foo.bar", "*.*")); -- assert(fnmatch("foo.bar", "foo*")); -- assert(fnmatch("foo.bar", "f*bar")); -- assert(fnmatch("foo.bar", "f*b*r")); -- assert(fnmatch("foo.bar", "f???bar")); -- assert(fnmatch("foo.bar", "[fg]???bar")); -- assert(fnmatch("foo.bar", "[!gh]*bar")); -- -- assert(!fnmatch("foo", "bar")); -- assert(!fnmatch("foo", "*.*")); -- assert(!fnmatch("foo.bar", "f*baz")); -- assert(!fnmatch("foo.bar", "f*b*x")); -- assert(!fnmatch("foo.bar", "[gh]???bar")); -- assert(!fnmatch("foo.bar", "[!fg]*bar")); -- assert(!fnmatch("foo.bar", "[fg]???baz")); -- assert(!fnmatch("foo.di", "*.d")); // test issue 6634: triggered bad assertion -- -- assert(fnmatch("foo.bar", "{foo,bif}.bar")); -- assert(fnmatch("bif.bar", "{foo,bif}.bar")); -- -- assert(fnmatch("bar.foo", "bar.{foo,bif}")); -- assert(fnmatch("bar.bif", "bar.{foo,bif}")); -- -- assert(fnmatch("bar.fooz", "bar.{foo,bif}z")); -- assert(fnmatch("bar.bifz", "bar.{foo,bif}z")); -- -- assert(fnmatch("bar.foo", "bar.{biz,,baz}foo")); -- assert(fnmatch("bar.foo", "bar.{biz,}foo")); -- assert(fnmatch("bar.foo", "bar.{,biz}foo")); -- assert(fnmatch("bar.foo", "bar.{}foo")); -- -- assert(fnmatch("bar.foo", "bar.{ar,,fo}o")); -- assert(fnmatch("bar.foo", "bar.{,ar,fo}o")); -- assert(fnmatch("bar.o", "bar.{,ar,fo}o")); --} ---- a/src/libphobos/src/std/perf.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/perf.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,901 +0,0 @@ --// Written in the D programming language -- --/* ///////////////////////////////////////////////////////////////////////////// -- * File: perf.d -- * -- * Created 19th March 2004 -- * Updated: 18th July 2004 -- * -- * www: http://www.digitalmars.com/ -- * -- * Copyright (C) 2004 by Digital Mars -- * All Rights Reserved -- * Written by Matthew Wilson -- * http://www.digitalmars.com -- * License for redistribution is by either the Artistic License in artistic.txt, -- * or the LGPL -- * -- * ////////////////////////////////////////////////////////////////////////// */ -- -- --/** -- * Platform-independent performance measurement and timing classes. -- * -- * $(D_PARAM PerformanceCounter) is the main platform-independent timer class provided, -- * covering the most typical use case, measuring elapsed wall-clock time. -- * -- * The module also provides several Windows-specific timers that can -- * be useful in specialized situations. -- * -- * Synopsis: -- ---- --alias PerformanceCounter.interval_t interval_t; --auto timer = new PerformanceCounter; --timer.start(); --// do computation --timer.stop(); --interval_t elapsedMsec = timer.milliseconds; --writefln("Time elapsed: %s msec", elapsedMsec); ------ -- * In particular note that $(D_PARAM stop()) must be called -- * before querying the elapsed time. -- * -- * These classes were ported to D from the -- * $(LINK2 http://stlsoft.org/,STLSoft C++ libraries), -- * which were documented in the article -- * "$(LINK2 http://www.windevnet.com/documents/win0305a/, -- * Win32 Performance Measurement Options)", -- * May 2003 issue of Windows Develper Network. -- * -- * Author: -- * Matthew Wilson -- * -- * Source: $(PHOBOSSRC std/_perf.d) -- * -- * Macros: -- * WIKI=Phobos/StdPerf -- */ -- --module std.perf; -- --pragma(msg, "std.perf has been deprecated. It will be removed in January 2013. " ~ -- "Please use std.datetime instead."); --deprecated: -- --version(Windows) --{ -- -- private import std.c.windows.windows; -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- // This library provides performance measurement facilities -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- /** A performance counter that uses the most accurate measurement APIs available on the host machine -- -- On Linux, the implementation uses $(D_PARAM gettimeofday()). -- For Windows, $(D_PARAM QueryPerformanceCounter()) is used if available, -- $(D_PARAM GetTickCount()) otherwise. -- */ -- class PerformanceCounter -- { -- private: -- alias long epoch_type; -- public: -- /// The type of the interval measurement (generally a 64-bit signed integer) -- alias long interval_t; -- -- deprecated alias interval_t interval_type; -- -- private: -- /** Class constructor -- */ -- shared static this() -- { -- // Detects availability of the high performance hardware counter, and if -- // not available adjusts -- -- interval_t freq; -- if (QueryPerformanceFrequency(&freq)) -- { -- sm_freq = freq; -- sm_fn = &_qpc; -- } -- else -- { -- sm_freq = 1000; -- sm_fn = &_qtc; -- } -- } -- -- public: -- /** Starts measurement -- -- Begins a measurement period -- */ -- void start() -- { -- sm_fn(m_start); -- } -- -- /** Ends measurement -- -- Marks the end of a measurement period. -- This must be called before querying the elapsed time with -- $(D_PARAM period_count), $(D_PARAM seconds), -- $(D_PARAM milliseconds), or $(D_PARAM microseconds). -- -- The $(D_PARAM stop()) method may be called multiple times without an intervening $(D_PARAM start()). -- Elapsed time is always measured from most recent $(D_PARAM start()) to the most recent -- $(D_PARAM stop()). -- */ -- void stop() -- { -- sm_fn(m_end); -- } -- -- public: -- /** The elapsed count in the measurement period -- -- This represents the extent, in machine-specific increments, of the measurement period -- */ -- interval_t periodCount() const -- { -- return m_end - m_start; -- } -- -- /** The number of whole seconds in the measurement period -- -- This represents the extent, in whole seconds, of the measurement period -- */ -- interval_t seconds() const -- { -- return periodCount() / sm_freq; -- } -- -- /** The number of whole milliseconds in the measurement period -- -- This represents the extent, in whole milliseconds, of the measurement period -- */ -- interval_t milliseconds() const -- { -- interval_t result; -- interval_t count = periodCount(); -- -- if(count < 0x20C49BA5E353F7L) -- { -- result = (count * 1000) / sm_freq; -- } -- else -- { -- result = (count / sm_freq) * 1000; -- } -- -- return result; -- } -- -- /** The number of whole microseconds in the measurement period -- -- This represents the extent, in whole microseconds, of the measurement period -- */ -- interval_t microseconds() const -- { -- interval_t result; -- interval_t count = periodCount(); -- -- if(count < 0x8637BD05AF6L) -- { -- result = (count * 1000000) / sm_freq; -- } -- else -- { -- result = (count / sm_freq) * 1000000; -- } -- -- return result; -- } -- -- private: -- alias void function(out epoch_type interval) measure_func; -- -- static void _qpc(out epoch_type interval) -- { -- QueryPerformanceCounter(&interval); -- } -- -- static void _qtc(out epoch_type interval) -- { -- interval = GetTickCount(); -- } -- -- private: -- epoch_type m_start; // start of measurement period -- epoch_type m_end; // End of measurement period -- __gshared const interval_t sm_freq; // Frequency -- __gshared const measure_func sm_fn; // Measurement function -- } -- -- unittest -- { -- alias PerformanceCounter counter_type; -- -- counter_type counter = new counter_type(); -- -- counter.start(); -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us1 = counter.microseconds(); -- counter_type.interval_t ms1 = counter.milliseconds(); -- counter_type.interval_t s1 = counter.seconds(); -- -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us2 = counter.microseconds(); -- counter_type.interval_t ms2 = counter.milliseconds(); -- counter_type.interval_t s2 = counter.seconds(); -- -- assert(us2 >= us1); -- assert(ms2 >= ms1); -- assert(s2 >= s1); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- /** A low-cost, low-resolution performance counter -- -- This class provides low-resolution, but low-latency, performance monitoring. -- -- This class is available only on Windows, but -- is guaranteed to be meaningful on all Windows operating systems. -- */ -- class TickCounter -- { -- private: -- alias long epoch_type; -- public: -- /** The interval type -- -- The type of the interval measurement (generally a 64-bit signed integer) -- */ -- alias long interval_t; -- -- deprecated alias interval_t interval_type; -- -- public: -- -- public: -- /** Starts measurement -- -- Begins a measurement period -- */ -- void start() -- { -- m_start = GetTickCount(); -- } -- -- /** Ends measurement -- -- Marks the end of a measurement period. -- This must be called before querying the elapsed time with -- $(D_PARAM period_count), $(D_PARAM seconds), -- $(D_PARAM milliseconds), or $(D_PARAM microseconds). -- -- The $(D_PARAM stop()) method may be called multiple times without an intervening $(D_PARAM start()). -- Elapsed time is always measured from most recent $(D_PARAM start()) to the most recent -- $(D_PARAM stop()). -- */ -- void stop() -- { -- m_end = GetTickCount(); -- } -- -- public: -- /** -- The elapsed count in the measurement period -- -- This represents the extent, in machine-specific increments, of the measurement period -- */ -- interval_t periodCount() const -- { -- return m_end - m_start; -- } -- -- /** The number of whole seconds in the measurement period -- -- This represents the extent, in whole seconds, of the measurement period -- */ -- interval_t seconds() const -- { -- return periodCount() / 1000; -- } -- -- /** The number of whole milliseconds in the measurement period -- -- This represents the extent, in whole milliseconds, of the measurement period -- */ -- interval_t milliseconds() const -- { -- return periodCount(); -- } -- -- /** The number of whole microseconds in the measurement period -- -- This represents the extent, in whole microseconds, of the measurement period -- */ -- interval_t microseconds() const -- { -- return periodCount() * 1000; -- } -- -- private: -- uint m_start; // start of measurement period -- uint m_end; // End of measurement period -- } -- -- unittest -- { -- alias TickCounter counter_type; -- -- counter_type counter = new counter_type(); -- -- counter.start(); -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us1 = counter.microseconds(); -- counter_type.interval_t ms1 = counter.milliseconds(); -- counter_type.interval_t s1 = counter.seconds(); -- -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us2 = counter.microseconds(); -- counter_type.interval_t ms2 = counter.milliseconds(); -- counter_type.interval_t s2 = counter.seconds(); -- -- assert(us2 >= us1); -- assert(ms2 >= ms1); -- assert(s2 >= s1); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- /** A performance counter that provides thread-specific performance timings -- -- This class uses the operating system's performance monitoring facilities to provide timing -- information pertaining to the calling thread only, irrespective of the activities of other -- threads on the system. This class does not provide meaningful timing information on operating -- systems that do not provide thread-specific monitoring. -- -- This class is available only on Windows. -- */ -- class ThreadTimesCounter -- { -- private: -- alias long epoch_type; -- public: -- /** The interval type -- -- The type of the interval measurement (generally a 64-bit signed integer) -- */ -- alias long interval_t; -- -- deprecated alias interval_t interval_type; -- -- public: -- /** Constructor -- -- Creates an instance of the class, and caches the thread token so that measurements will -- be taken with respect to the thread in which the class was created. -- */ -- this() -- { -- m_thread = GetCurrentThread(); -- } -- -- public: -- /** Starts measurement -- -- Begins a measurement period -- */ -- void start() -- { -- FILETIME creationTime; -- FILETIME exitTime; -- -- GetThreadTimes(m_thread, &creationTime, &exitTime, cast(FILETIME*)&m_kernelStart, cast(FILETIME*)&m_userStart); -- } -- -- /** Ends measurement -- -- Marks the end of a measurement period. -- This must be called before querying the elapsed time with -- $(D_PARAM period_count), $(D_PARAM seconds), -- $(D_PARAM milliseconds), or $(D_PARAM microseconds). -- -- The $(D_PARAM stop()) method may be called multiple times without an intervening $(D_PARAM start()). -- Elapsed time is always measured from most recent $(D_PARAM start()) to the most recent -- $(D_PARAM stop()). -- */ -- void stop() -- { -- FILETIME creationTime; -- FILETIME exitTime; -- -- GetThreadTimes(m_thread, &creationTime, &exitTime, cast(FILETIME*)&m_kernelEnd, cast(FILETIME*)&m_userEnd); -- } -- -- -- public: -- -- /** The elapsed count in the measurement period for kernel mode activity -- -- This represents the extent, in machine-specific increments, of the measurement period for kernel mode activity -- */ -- interval_t kernelPeriodCount() const -- { -- return m_kernelEnd - m_kernelStart; -- } -- /** The number of whole seconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole seconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelSeconds() const -- { -- return kernelPeriodCount() / 10000000; -- } -- /** The number of whole milliseconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole milliseconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelMilliseconds() const -- { -- return kernelPeriodCount() / 10000; -- } -- /** The number of whole microseconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole microseconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelMicroseconds() const -- { -- return kernelPeriodCount() / 10; -- } -- -- -- /** The elapsed count in the measurement period for user mode activity -- -- This represents the extent, in machine-specific increments, of the measurement period for user mode activity -- */ -- interval_t userPeriodCount() const -- { -- return m_userEnd - m_userStart; -- } -- /** The number of whole seconds in the measurement period for user mode activity -- -- This represents the extent, in whole seconds, of the measurement period for user mode activity -- */ -- interval_t userSeconds() const -- { -- return userPeriodCount() / 10000000; -- } -- /** The number of whole milliseconds in the measurement period for user mode activity -- -- This represents the extent, in whole milliseconds, of the measurement period for user mode activity -- */ -- interval_t userMilliseconds() const -- { -- return userPeriodCount() / 10000; -- } -- /** The number of whole microseconds in the measurement period for user mode activity -- -- This represents the extent, in whole microseconds, of the measurement period for user mode activity -- */ -- interval_t userMicroseconds() const -- { -- return userPeriodCount() / 10; -- } -- -- -- /** The elapsed count in the measurement period -- -- This represents the extent, in machine-specific increments, of the measurement period -- */ -- interval_t periodCount() const -- { -- return kernelPeriodCount() + userPeriodCount(); -- } -- -- /** The number of whole seconds in the measurement period -- -- This represents the extent, in whole seconds, of the measurement period -- */ -- interval_t seconds() const -- { -- return periodCount() / 10000000; -- } -- -- /** The number of whole milliseconds in the measurement period -- -- This represents the extent, in whole milliseconds, of the measurement period -- */ -- interval_t milliseconds() const -- { -- return periodCount() / 10000; -- } -- -- /** The number of whole microseconds in the measurement period -- -- This represents the extent, in whole microseconds, of the measurement period -- */ -- interval_t microseconds() const -- { -- return periodCount() / 10; -- } -- -- -- private: -- epoch_type m_kernelStart; -- epoch_type m_kernelEnd; -- epoch_type m_userStart; -- epoch_type m_userEnd; -- HANDLE m_thread; -- } -- -- unittest -- { -- alias ThreadTimesCounter counter_type; -- -- counter_type counter = new counter_type(); -- -- counter.start(); -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us1 = counter.microseconds(); -- counter_type.interval_t ms1 = counter.milliseconds(); -- counter_type.interval_t s1 = counter.seconds(); -- -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us2 = counter.microseconds(); -- counter_type.interval_t ms2 = counter.milliseconds(); -- counter_type.interval_t s2 = counter.seconds(); -- -- assert(us2 >= us1); -- assert(ms2 >= ms1); -- assert(s2 >= s1); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- /** A performance counter that provides process-specific performance timings -- -- This class uses the operating system's performance monitoring facilities to provide timing -- information pertaining to the calling process only, irrespective of the activities of other -- processes on the system. This class does not provide meaningful timing information on operating -- systems that do not provide process-specific monitoring. -- -- This class is available only on Windows. -- */ -- class ProcessTimesCounter -- { -- private: -- alias long epoch_type; -- public: -- /** The interval type -- -- The type of the interval measurement (generally a 64-bit signed integer) -- */ -- alias long interval_t; -- -- deprecated alias interval_t interval_type; -- -- private: -- /** Class constructor -- -- */ -- shared static this() -- { -- sm_process = GetCurrentProcess(); -- } -- -- public: -- /** Starts measurement -- -- Begins a measurement period -- */ -- void start() -- { -- FILETIME creationTime; -- FILETIME exitTime; -- -- GetProcessTimes(sm_process, &creationTime, &exitTime, cast(FILETIME*)&m_kernelStart, cast(FILETIME*)&m_userStart); -- } -- -- /** Ends measurement -- -- Marks the end of a measurement period. -- This must be called before querying the elapsed time with -- $(D_PARAM period_count), $(D_PARAM seconds), -- $(D_PARAM milliseconds), or $(D_PARAM microseconds). -- -- The $(D_PARAM stop()) method may be called multiple times without an intervening $(D_PARAM start()). -- Elapsed time is always measured from most recent $(D_PARAM start()) to the most recent -- $(D_PARAM stop()). -- */ -- void stop() -- { -- FILETIME creationTime; -- FILETIME exitTime; -- -- GetProcessTimes(sm_process, &creationTime, &exitTime, cast(FILETIME*)&m_kernelEnd, cast(FILETIME*)&m_userEnd); -- } -- -- public: -- /** The elapsed count in the measurement period for kernel mode activity -- -- This represents the extent, in machine-specific increments, of the measurement period for kernel mode activity -- */ -- interval_t kernelPeriodCount() const -- { -- return m_kernelEnd - m_kernelStart; -- } -- /** The number of whole seconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole seconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelSeconds() const -- { -- return kernelPeriodCount() / 10000000; -- } -- /** The number of whole milliseconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole milliseconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelMilliseconds() const -- { -- return kernelPeriodCount() / 10000; -- } -- /** The number of whole microseconds in the measurement period for kernel mode activity -- -- This represents the extent, in whole microseconds, of the measurement period for kernel mode activity -- */ -- interval_t kernelMicroseconds() const -- { -- return kernelPeriodCount() / 10; -- } -- -- -- /** The elapsed count in the measurement period for user mode activity -- -- This represents the extent, in machine-specific increments, of the measurement period for user mode activity -- */ -- interval_t userPeriodCount() const -- { -- return m_userEnd - m_userStart; -- } -- /** The number of whole seconds in the measurement period for user mode activity -- -- This represents the extent, in whole seconds, of the measurement period for user mode activity -- */ -- interval_t userSeconds() const -- { -- return userPeriodCount() / 10000000; -- } -- /** The number of whole milliseconds in the measurement period for user mode activity -- -- This represents the extent, in whole milliseconds, of the measurement period for user mode activity -- */ -- interval_t userMilliseconds() const -- { -- return userPeriodCount() / 10000; -- } -- /** The number of whole microseconds in the measurement period for user mode activity -- -- This represents the extent, in whole microseconds, of the measurement period for user mode activity -- */ -- interval_t userMicroseconds() const -- { -- return userPeriodCount() / 10; -- } -- -- /** The elapsed count in the measurement period -- -- This represents the extent, in machine-specific increments, of the measurement period -- */ -- interval_t periodCount() const -- { -- return kernelPeriodCount() + userPeriodCount(); -- } -- -- /** The number of whole seconds in the measurement period -- -- This represents the extent, in whole seconds, of the measurement period -- */ -- interval_t seconds() const -- { -- return periodCount() / 10000000; -- } -- -- /** The number of whole milliseconds in the measurement period -- -- This represents the extent, in whole milliseconds, of the measurement period -- */ -- interval_t milliseconds() const -- { -- return periodCount() / 10000; -- } -- -- /** The number of whole microseconds in the measurement period -- -- This represents the extent, in whole microseconds, of the measurement period -- */ -- interval_t microseconds() const -- { -- return periodCount() / 10; -- } -- -- private: -- epoch_type m_kernelStart; -- epoch_type m_kernelEnd; -- epoch_type m_userStart; -- epoch_type m_userEnd; -- __gshared HANDLE sm_process; -- } -- -- unittest -- { -- alias ProcessTimesCounter counter_type; -- -- counter_type counter = new counter_type(); -- -- counter.start(); -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us1 = counter.microseconds(); -- counter_type.interval_t ms1 = counter.milliseconds(); -- counter_type.interval_t s1 = counter.seconds(); -- -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us2 = counter.microseconds(); -- counter_type.interval_t ms2 = counter.milliseconds(); -- counter_type.interval_t s2 = counter.seconds(); -- -- assert(us2 >= us1); -- assert(ms2 >= ms1); -- assert(s2 >= s1); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ --} --else version(Posix) --{ -- extern (C) -- { -- private struct timeval -- { -- int tv_sec; // The number of seconds, since Jan. 1, 1970, in the time value. -- int tv_usec; // The number of microseconds in the time value. -- }; -- private struct timezone -- { -- int tz_minuteswest; // minutes west of Greenwich. -- int tz_dsttime; // type of dst corrections to apply. -- }; -- private void gettimeofday(timeval *tv, timezone *tz); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ -- -- class PerformanceCounter -- { -- // documentation is in the Windows version of the class above -- -- -- private: -- alias timeval epoch_type; -- public: -- alias long interval_t; -- -- public: -- void start() -- { -- timezone tz; -- -- gettimeofday(&m_start, &tz); -- } -- -- void stop() -- { -- timezone tz; -- -- gettimeofday(&m_end, &tz); -- } -- -- public: -- interval_t periodCount() const -- { -- return microseconds(); -- } -- -- interval_t seconds() const -- { -- interval_t start = cast(interval_t)m_start.tv_sec + cast(interval_t)m_start.tv_usec / (1000 * 1000); -- interval_t end = cast(interval_t)m_end.tv_sec + cast(interval_t)m_end.tv_usec / (1000 * 1000); -- -- return end - start; -- } -- -- interval_t milliseconds() const -- { -- interval_t start = cast(interval_t)m_start.tv_sec * 1000 + cast(interval_t)m_start.tv_usec / 1000; -- interval_t end = cast(interval_t)m_end.tv_sec * 1000 + cast(interval_t)m_end.tv_usec / 1000; -- -- return end - start; -- } -- -- interval_t microseconds() const -- { -- interval_t start = cast(interval_t)m_start.tv_sec * 1000 * 1000 + cast(interval_t)m_start.tv_usec; -- interval_t end = cast(interval_t)m_end.tv_sec * 1000 * 1000 + cast(interval_t)m_end.tv_usec; -- -- return end - start; -- } -- -- private: -- epoch_type m_start; // start of measurement period -- epoch_type m_end; // End of measurement period -- } -- -- unittest -- { -- alias PerformanceCounter counter_type; -- -- counter_type counter = new counter_type(); -- -- counter.start(); -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us1 = counter.microseconds(); -- counter_type.interval_t ms1 = counter.milliseconds(); -- counter_type.interval_t s1 = counter.seconds(); -- -- for(int i = 0; i < 10000000; ++i) -- { } -- counter.stop(); -- -- counter_type.interval_t us2 = counter.microseconds(); -- counter_type.interval_t ms2 = counter.milliseconds(); -- counter_type.interval_t s2 = counter.seconds(); -- -- assert(us2 >= us1); -- assert(ms2 >= ms1); -- assert(s2 >= s1); -- } -- -- /* ////////////////////////////////////////////////////////////////////////// */ --} --else --{ -- const int platform_not_supported = 0; -- -- static assert(platform_not_supported); --} ---- a/src/libphobos/src/std/process.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/process.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,843 +1,2152 @@ - // Written in the D programming language. - - /** --Macros: -- --WIKI=Phobos/StdProcess -+Functions for starting and interacting with other processes, and for -+working with the current _process' execution environment. - --Copyright: Copyright Digital Mars 2007 - 2009. --License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. --Authors: $(WEB digitalmars.com, Walter Bright), -- $(WEB erdani.org, Andrei Alexandrescu), -- $(WEB thecybershadow.net, Vladimir Panteleev) --Source: $(PHOBOSSRC std/_process.d) --*/ --/* -- Copyright Digital Mars 2007 - 2009. --Distributed under the Boost Software License, Version 1.0. -- (See accompanying file LICENSE_1_0.txt or copy at -- http://www.boost.org/LICENSE_1_0.txt) -+Process_handling: -+$(UL $(LI -+ $(LREF spawnProcess) spawns a new _process, optionally assigning it an -+ arbitrary set of standard input, output, and error streams. -+ The function returns immediately, leaving the child _process to execute -+ in parallel with its parent. All other functions in this module that -+ spawn processes are built around $(D spawnProcess).) -+$(LI -+ $(LREF wait) makes the parent _process wait for a child _process to -+ terminate. In general one should always do this, to avoid -+ child processes becoming "zombies" when the parent _process exits. -+ Scope guards are perfect for this – see the $(LREF spawnProcess) -+ documentation for examples. $(LREF tryWait) is similar to $(D wait), -+ but does not block if the _process has not yet terminated.) -+$(LI -+ $(LREF pipeProcess) also spawns a child _process which runs -+ in parallel with its parent. However, instead of taking -+ arbitrary streams, it automatically creates a set of -+ pipes that allow the parent to communicate with the child -+ through the child's standard input, output, and/or error streams. -+ This function corresponds roughly to C's $(D popen) function.) -+$(LI -+ $(LREF execute) starts a new _process and waits for it -+ to complete before returning. Additionally, it captures -+ the _process' standard output and error streams and returns -+ the output of these as a string.) -+$(LI -+ $(LREF spawnShell), $(LREF pipeShell) and $(LREF executeShell) work like -+ $(D spawnProcess), $(D pipeProcess) and $(D execute), respectively, -+ except that they take a single command string and run it through -+ the current user's default command interpreter. -+ $(D executeShell) corresponds roughly to C's $(D system) function.) -+$(LI -+ $(LREF kill) attempts to terminate a running _process.) -+) -+ -+The following table compactly summarises the different _process creation -+functions and how they relate to each other: -+$(BOOKTABLE, -+ $(TR $(TH ) -+ $(TH Runs program directly) -+ $(TH Runs shell command)) -+ $(TR $(TD Low-level _process creation) -+ $(TD $(LREF spawnProcess)) -+ $(TD $(LREF spawnShell))) -+ $(TR $(TD Automatic input/output redirection using pipes) -+ $(TD $(LREF pipeProcess)) -+ $(TD $(LREF pipeShell))) -+ $(TR $(TD Execute and wait for completion, collect output) -+ $(TD $(LREF execute)) -+ $(TD $(LREF executeShell))) -+) -+ -+Other_functionality: -+$(UL -+$(LI -+ $(LREF pipe) is used to create unidirectional pipes.) -+$(LI -+ $(LREF environment) is an interface through which the current _process' -+ environment variables can be read and manipulated.) -+$(LI -+ $(LREF escapeShellCommand) and $(LREF escapeShellFileName) are useful -+ for constructing shell command lines in a portable way.) -+) -+ -+Authors: -+ $(LINK2 https://github.com/kyllingstad, Lars Tandle Kyllingstad), -+ $(LINK2 https://github.com/schveiguy, Steven Schveighoffer), -+ $(WEB thecybershadow.net, Vladimir Panteleev) -+Copyright: -+ Copyright (c) 2013, the authors. All rights reserved. -+Source: -+ $(PHOBOSSRC std/_process.d) -+Macros: -+ WIKI=Phobos/StdProcess -+ OBJECTREF=$(D $(LINK2 object.html#$0,$0)) -+ LREF=$(D $(LINK2 #.$0,$0)) - */ - module std.process; - -- --import core.stdc.stdlib; --import std.c.stdlib; --import core.stdc.errno; --import core.thread; --import std.c.process; --import std.c.string; -- --import std.array; --import std.conv; --import std.exception; --import std.internal.processinit; --import std.stdio; --import std.string; --import std.typecons; -- -+version (Posix) -+{ -+ import core.stdc.errno; -+ import core.stdc.string; -+ import core.sys.posix.stdio; -+ import core.sys.posix.unistd; -+ import core.sys.posix.sys.wait; -+} - version (Windows) - { -- import std.format, std.random, std.file; -+ import core.stdc.stdio; - import core.sys.windows.windows; - import std.utf; - import std.windows.syserror; - } --version (Posix) --{ -- import core.sys.posix.stdlib; --} --version (unittest) --{ -- import std.file, std.conv, std.array, std.random; -- import std.path : absolutePath; --} -+import std.algorithm; -+import std.array; -+import std.conv; -+import std.exception; -+import std.path; -+import std.stdio; -+import std.string; -+import std.internal.processinit; - - --// The following is needed for reading/writing environment variables. --version(Posix) -+// When the DMC runtime is used, we have to use some custom functions -+// to convert between Windows file handles and FILE*s. -+version (Win32) version (DigitalMars) version = DMC_RUNTIME; -+ -+ -+// Some of the following should be moved to druntime. -+private - { -- version(OSX) -- { -- // https://www.gnu.org/software/gnulib/manual/html_node/environ.html -- private extern(C) extern __gshared char*** _NSGetEnviron(); -- __gshared char** environ; - -- // Run in std.__processinit to avoid cyclic construction errors. -- extern(C) void std_process_static_this() -+// Microsoft Visual C Runtime (MSVCRT) declarations. -+version (Windows) -+{ -+ version (DMC_RUNTIME) { } else -+ { -+ import core.stdc.stdint; -+ extern(C) - { -- environ = *_NSGetEnviron(); -+ int _fileno(FILE* stream); -+ HANDLE _get_osfhandle(int fd); -+ int _open_osfhandle(HANDLE osfhandle, int flags); -+ FILE* _fdopen(int fd, const (char)* mode); -+ int _close(int fd); -+ } -+ enum -+ { -+ STDIN_FILENO = 0, -+ STDOUT_FILENO = 1, -+ STDERR_FILENO = 2, -+ } -+ enum -+ { -+ _O_RDONLY = 0x0000, -+ _O_APPEND = 0x0004, -+ _O_TEXT = 0x4000, - } -- } -- else -- { -- // Made available by the C runtime: -- private extern(C) extern __gshared const char** environ; - } - } - -- --/** -- Execute $(D command) in a _command shell. -- -- Returns: If $(D command) is null, returns nonzero if the _command -- interpreter is found, and zero otherwise. If $(D command) is not -- null, returns -1 on error, or the exit status of command (which may -- in turn signal an error in command's execution). -- -- Note: On Unix systems, the homonym C function (which is accessible -- to D programs as $(LINK2 std_c_process.html, std.c._system)) -- returns a code in the same format as $(LUCKY waitpid, waitpid), -- meaning that C programs must use the $(D WEXITSTATUS) macro to -- extract the actual exit code from the $(D system) call. D's $(D -- system) automatically extracts the exit status. -- --*/ -- --int system(string command) -+// POSIX API declarations. -+version (Posix) - { -- if (!command) return std.c.process.system(null); -- const commandz = toStringz(command); -- immutable status = std.c.process.system(commandz); -- if (status == -1) return status; -- version (Posix) -+ version (OSX) - { -- if (exited(status)) -- return exitstatus(status); -- -- // Abnormal termination, return -1. -- return -1; -+ extern(C) char*** _NSGetEnviron() nothrow; -+ private const(char**)* environPtr; -+ extern(C) void std_process_static_this() { environPtr = _NSGetEnviron(); } -+ const(char**) environ() @property @trusted nothrow { return *environPtr; } - } -- else version (Windows) -- return status; - else -- static assert(0, "system not implemented for this OS."); --} -- --private void toAStringz(in string[] a, const(char)**az) --{ -- foreach(string s; a) - { -- *az++ = toStringz(s); -+ // Made available by the C runtime: -+ extern(C) extern __gshared const char** environ; - } -- *az = null; - } - - --/* ========================================================== */ -+} // private - --//version (Windows) --//{ --// int spawnvp(int mode, string pathname, string[] argv) --// { --// char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length)); --// --// toAStringz(argv, argv_); --// --// return std.c.process.spawnvp(mode, toStringz(pathname), argv_); --// } --//} - --// Incorporating idea (for spawnvp() on Posix) from Dave Fladebo -+// ============================================================================= -+// Functions and classes for process management. -+// ============================================================================= - --alias std.c.process._P_WAIT P_WAIT; --alias std.c.process._P_NOWAIT P_NOWAIT; - --int spawnvp(int mode, string pathname, string[] argv) -+/** -+Spawns a new _process, optionally assigning it an arbitrary set of standard -+input, output, and error streams. -+ -+The function returns immediately, leaving the child _process to execute -+in parallel with its parent. It is recommended to always call $(LREF wait) -+on the returned $(LREF Pid), as detailed in the documentation for $(D wait). -+ -+Command_line: -+There are four overloads of this function. The first two take an array -+of strings, $(D args), which should contain the program name as the -+zeroth element and any command-line arguments in subsequent elements. -+The third and fourth versions are included for convenience, and may be -+used when there are no command-line arguments. They take a single string, -+$(D program), which specifies the program name. -+ -+Unless a directory is specified in $(D args[0]) or $(D program), -+$(D spawnProcess) will search for the program in a platform-dependent -+manner. On POSIX systems, it will look for the executable in the -+directories listed in the PATH environment variable, in the order -+they are listed. On Windows, it will search for the executable in -+the following sequence: -+$(OL -+ $(LI The directory from which the application loaded.) -+ $(LI The current directory for the parent process.) -+ $(LI The 32-bit Windows system directory.) -+ $(LI The 16-bit Windows system directory.) -+ $(LI The Windows directory.) -+ $(LI The directories listed in the PATH environment variable.) -+) -+--- -+// Run an executable called "prog" located in the current working -+// directory: -+auto pid = spawnProcess("./prog"); -+scope(exit) wait(pid); -+// We can do something else while the program runs. The scope guard -+// ensures that the process is waited for at the end of the scope. -+... -+ -+// Run DMD on the file "myprog.d", specifying a few compiler switches: -+auto dmdPid = spawnProcess(["dmd", "-O", "-release", "-inline", "myprog.d" ]); -+if (wait(dmdPid) != 0) -+ writeln("Compilation failed!"); -+--- -+ -+Environment_variables: -+By default, the child process inherits the environment of the parent -+process, along with any additional variables specified in the $(D env) -+parameter. If the same variable exists in both the parent's environment -+and in $(D env), the latter takes precedence. -+ -+If the $(LREF Config.newEnv) flag is set in $(D config), the child -+process will $(I not) inherit the parent's environment. Its entire -+environment will then be determined by $(D env). -+--- -+wait(spawnProcess("myapp", ["foo" : "bar"], Config.newEnv)); -+--- -+ -+Standard_streams: -+The optional arguments $(D stdin), $(D stdout) and $(D stderr) may -+be used to assign arbitrary $(XREF stdio,File) objects as the standard -+input, output and error streams, respectively, of the child process. The -+former must be opened for reading, while the latter two must be opened for -+writing. The default is for the child process to inherit the standard -+streams of its parent. -+--- -+// Run DMD on the file myprog.d, logging any error messages to a -+// file named errors.log. -+auto logFile = File("errors.log", "w"); -+auto pid = spawnProcess(["dmd", "myprog.d"], -+ std.stdio.stdin, -+ std.stdio.stdout, -+ logFile); -+if (wait(pid) != 0) -+ writeln("Compilation failed. See errors.log for details."); -+--- -+ -+Note that if you pass a $(D File) object that is $(I not) -+one of the standard input/output/error streams of the parent process, -+that stream will by default be $(I closed) in the parent process when -+this function returns. See the $(LREF Config) documentation below for -+information about how to disable this behaviour. -+ -+Beware of buffering issues when passing $(D File) objects to -+$(D spawnProcess). The child process will inherit the low-level raw -+read/write offset associated with the underlying file descriptor, but -+it will not be aware of any buffered data. In cases where this matters -+(e.g. when a file should be aligned before being passed on to the -+child process), it may be a good idea to use unbuffered streams, or at -+least ensure all relevant buffers are flushed. -+ -+Params: -+args = An array which contains the program name as the zeroth element -+ and any command-line arguments in the following elements. -+stdin = The standard input stream of the child process. -+ This can be any $(XREF stdio,File) that is opened for reading. -+ By default the child process inherits the parent's input -+ stream. -+stdout = The standard output stream of the child process. -+ This can be any $(XREF stdio,File) that is opened for writing. -+ By default the child process inherits the parent's output stream. -+stderr = The standard error stream of the child process. -+ This can be any $(XREF stdio,File) that is opened for writing. -+ By default the child process inherits the parent's error stream. -+env = Additional environment variables for the child process. -+config = Flags that control process creation. See $(LREF Config) -+ for an overview of available flags. -+ -+Returns: -+A $(LREF Pid) object that corresponds to the spawned process. -+ -+Throws: -+$(LREF ProcessException) on failure to start the process.$(BR) -+$(XREF stdio,StdioException) on failure to pass one of the streams -+ to the child process (Windows only).$(BR) -+$(CXREF exception,RangeError) if $(D args) is empty. -+*/ -+Pid spawnProcess(in char[][] args, -+ File stdin = std.stdio.stdin, -+ File stdout = std.stdio.stdout, -+ File stderr = std.stdio.stderr, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted // TODO: Should be @safe -+{ -+ version (Windows) auto args2 = escapeShellArguments(args); -+ else version (Posix) alias args2 = args; -+ return spawnProcessImpl(args2, stdin, stdout, stderr, env, config); -+} -+ -+/// ditto -+Pid spawnProcess(in char[][] args, -+ const string[string] env, -+ Config config = Config.none) -+ @trusted // TODO: Should be @safe -+{ -+ return spawnProcess(args, -+ std.stdio.stdin, -+ std.stdio.stdout, -+ std.stdio.stderr, -+ env, -+ config); -+} -+ -+/// ditto -+Pid spawnProcess(in char[] program, -+ File stdin = std.stdio.stdin, -+ File stdout = std.stdio.stdout, -+ File stderr = std.stdio.stderr, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted -+{ -+ return spawnProcess((&program)[0 .. 1], -+ stdin, stdout, stderr, env, config); -+} -+ -+/// ditto -+Pid spawnProcess(in char[] program, -+ const string[string] env, -+ Config config = Config.none) -+ @trusted - { -- auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ return spawnProcess((&program)[0 .. 1], env, config); -+} - -- toAStringz(argv, argv_); -+/* -+Implementation of spawnProcess() for POSIX. - -- version (Posix) -+envz should be a zero-terminated array of zero-terminated strings -+on the form "var=value". -+*/ -+version (Posix) -+private Pid spawnProcessImpl(in char[][] args, -+ File stdin, -+ File stdout, -+ File stderr, -+ const string[string] env, -+ Config config) -+ @trusted // TODO: Should be @safe -+{ -+ import core.exception: RangeError; -+ -+ if (args.empty) throw new RangeError(); -+ const(char)[] name = args[0]; -+ if (any!isDirSeparator(name)) - { -- return _spawnvp(mode, toStringz(pathname), argv_); -+ if (!isExecutable(name)) -+ throw new ProcessException(text("Not an executable file: ", name)); - } -- else version (Windows) -+ else - { -- return std.c.process.spawnvp(mode, toStringz(pathname), argv_); -+ name = searchPathFor(name); -+ if (name is null) -+ throw new ProcessException(text("Executable file not found: ", name)); -+ } -+ -+ // Convert program name and arguments to C-style strings. -+ auto argz = new const(char)*[args.length+1]; -+ argz[0] = toStringz(name); -+ foreach (i; 1 .. args.length) argz[i] = toStringz(args[i]); -+ argz[$-1] = null; -+ -+ // Prepare environment. -+ auto envz = createEnv(env, !(config & Config.newEnv)); -+ -+ // Get the file descriptors of the streams. -+ // These could potentially be invalid, but that is OK. If so, later calls -+ // to dup2() and close() will just silently fail without causing any harm. -+ auto stdinFD = core.stdc.stdio.fileno(stdin.getFP()); -+ auto stdoutFD = core.stdc.stdio.fileno(stdout.getFP()); -+ auto stderrFD = core.stdc.stdio.fileno(stderr.getFP()); -+ -+ auto id = fork(); -+ if (id < 0) -+ throw ProcessException.newFromErrno("Failed to spawn new process"); -+ if (id == 0) -+ { -+ // Child process -+ -+ // Redirect streams and close the old file descriptors. -+ // In the case that stderr is redirected to stdout, we need -+ // to backup the file descriptor since stdout may be redirected -+ // as well. -+ if (stderrFD == STDOUT_FILENO) stderrFD = dup(stderrFD); -+ dup2(stdinFD, STDIN_FILENO); -+ dup2(stdoutFD, STDOUT_FILENO); -+ dup2(stderrFD, STDERR_FILENO); -+ -+ // Ensure that the standard streams aren't closed on execute, and -+ // optionally close all other file descriptors. -+ setCLOEXEC(STDIN_FILENO, false); -+ setCLOEXEC(STDOUT_FILENO, false); -+ setCLOEXEC(STDERR_FILENO, false); -+ if (!(config & Config.inheritFDs)) -+ { -+ import core.sys.posix.sys.resource; -+ rlimit r; -+ getrlimit(RLIMIT_NOFILE, &r); -+ foreach (i; 3 .. cast(int) r.rlim_cur) close(i); -+ } -+ -+ // Close the old file descriptors, unless they are -+ // either of the standard streams. -+ if (stdinFD > STDERR_FILENO) close(stdinFD); -+ if (stdoutFD > STDERR_FILENO) close(stdoutFD); -+ if (stderrFD > STDERR_FILENO) close(stderrFD); -+ -+ // Execute program. -+ core.sys.posix.unistd.execve(argz[0], argz.ptr, envz); -+ -+ // If execution fails, exit as quickly as possible. -+ core.sys.posix.stdio.perror("spawnProcess(): Failed to execute program"); -+ core.sys.posix.unistd._exit(1); -+ assert (0); - } - else -- static assert(0, "spawnvp not implemented for this OS."); -+ { -+ // Parent process: Close streams and return. -+ if (stdinFD > STDERR_FILENO && !(config & Config.retainStdin)) -+ stdin.close(); -+ if (stdoutFD > STDERR_FILENO && !(config & Config.retainStdout)) -+ stdout.close(); -+ if (stderrFD > STDERR_FILENO && !(config & Config.retainStderr)) -+ stderr.close(); -+ return new Pid(id); -+ } - } - --version (Posix) --{ --private import core.sys.posix.unistd; --private import core.sys.posix.sys.wait; --int _spawnvp(int mode, in char *pathname, in char **argv) --{ -- int retval = 0; -- pid_t pid = fork(); -+/* -+Implementation of spawnProcess() for Windows. - -- if(!pid) -- { // child -- std.c.process.execvp(pathname, argv); -- goto Lerror; -- } -- else if(pid > 0) -- { // parent -- if(mode == _P_NOWAIT) -+commandLine must contain the entire command line, properly -+quoted/escaped as required by CreateProcessW(). -+ -+envz must be a pointer to a block of UTF-16 characters on the form -+"var1=value1\0var2=value2\0...varN=valueN\0\0". -+*/ -+version (Windows) -+private Pid spawnProcessImpl(in char[] commandLine, -+ File stdin, -+ File stdout, -+ File stderr, -+ const string[string] env, -+ Config config) -+ @trusted -+{ -+ import core.exception: RangeError; -+ -+ if (commandLine.empty) throw new RangeError("Command line is empty"); -+ auto commandz = toUTFz!(wchar*)(commandLine); -+ -+ // Prepare environment. -+ auto envz = createEnv(env, !(config & Config.newEnv)); -+ -+ // Startup info for CreateProcessW(). -+ STARTUPINFO_W startinfo; -+ startinfo.cb = startinfo.sizeof; -+ startinfo.dwFlags = STARTF_USESTDHANDLES; -+ -+ // Extract file descriptors and HANDLEs from the streams and make the -+ // handles inheritable. -+ static void prepareStream(ref File file, DWORD stdHandle, string which, -+ out int fileDescriptor, out HANDLE handle) -+ { -+ fileDescriptor = _fileno(file.getFP()); -+ if (fileDescriptor < 0) handle = GetStdHandle(stdHandle); -+ else - { -- retval = pid; // caller waits -+ version (DMC_RUNTIME) handle = _fdToHandle(fileDescriptor); -+ else /* MSVCRT */ handle = _get_osfhandle(fileDescriptor); - } -- else -+ -+ DWORD dwFlags; -+ if (GetHandleInformation(handle, &dwFlags)) - { -- while(1) -+ if (!(dwFlags & HANDLE_FLAG_INHERIT)) - { -- int status; -- pid_t wpid = waitpid(pid, &status, 0); -- if(exited(status)) -- { -- retval = exitstatus(status); -- break; -- } -- else if(signaled(status)) -+ if (!SetHandleInformation(handle, -+ HANDLE_FLAG_INHERIT, -+ HANDLE_FLAG_INHERIT)) - { -- retval = -termsig(status); -- break; -+ throw new StdioException( -+ "Failed to make "~which~" stream inheritable by child process (" -+ ~sysErrorString(GetLastError()) ~ ')', -+ 0); - } -- else if(stopped(status)) // ptrace support -- continue; -- else -- goto Lerror; - } - } -- -- return retval; - } -+ int stdinFD = -1, stdoutFD = -1, stderrFD = -1; -+ prepareStream(stdin, STD_INPUT_HANDLE, "stdin" , stdinFD, startinfo.hStdInput ); -+ prepareStream(stdout, STD_OUTPUT_HANDLE, "stdout", stdoutFD, startinfo.hStdOutput); -+ prepareStream(stderr, STD_ERROR_HANDLE, "stderr", stderrFD, startinfo.hStdError ); -+ -+ // Create process. -+ PROCESS_INFORMATION pi; -+ DWORD dwCreationFlags = -+ CREATE_UNICODE_ENVIRONMENT | -+ ((config & Config.suppressConsole) ? CREATE_NO_WINDOW : 0); -+ if (!CreateProcessW(null, commandz, null, null, true, dwCreationFlags, -+ envz, null, &startinfo, &pi)) -+ throw ProcessException.newFromLastError("Failed to spawn new process"); -+ -+ // figure out if we should close any of the streams -+ if (stdinFD > STDERR_FILENO && !(config & Config.retainStdin)) -+ stdin.close(); -+ if (stdoutFD > STDERR_FILENO && !(config & Config.retainStdout)) -+ stdout.close(); -+ if (stderrFD > STDERR_FILENO && !(config & Config.retainStderr)) -+ stderr.close(); -+ -+ // close the thread handle in the process info structure -+ CloseHandle(pi.hThread); -+ -+ return new Pid(pi.dwProcessId, pi.hProcess); -+} -+ -+// Converts childEnv to a zero-terminated array of zero-terminated strings -+// on the form "name=value", optionally adding those of the current process' -+// environment strings that are not present in childEnv. If the parent's -+// environment should be inherited without modification, this function -+// returns environ directly. -+version (Posix) -+private const(char*)* createEnv(const string[string] childEnv, -+ bool mergeWithParentEnv) -+{ -+ // Determine the number of strings in the parent's environment. -+ int parentEnvLength = 0; -+ if (mergeWithParentEnv) -+ { -+ if (childEnv.length == 0) return environ; -+ while (environ[parentEnvLength] != null) ++parentEnvLength; -+ } -+ -+ // Convert the "new" variables to C-style strings. -+ auto envz = new const(char)*[parentEnvLength + childEnv.length + 1]; -+ int pos = 0; -+ foreach (var, val; childEnv) -+ envz[pos++] = (var~'='~val~'\0').ptr; -+ -+ // Add the parent's environment. -+ foreach (environStr; environ[0 .. parentEnvLength]) -+ { -+ int eqPos = 0; -+ while (environStr[eqPos] != '=' && environStr[eqPos] != '\0') ++eqPos; -+ if (environStr[eqPos] != '=') continue; -+ auto var = environStr[0 .. eqPos]; -+ if (var in childEnv) continue; -+ envz[pos++] = environStr; -+ } -+ envz[pos] = null; -+ return envz.ptr; -+} - --Lerror: -- retval = errno; -- char[80] buf = void; -- throw new Exception( -- "Cannot spawn " ~ to!string(pathname) ~ "; " -- ~ to!string(strerror_r(retval, buf.ptr, buf.length)) -- ~ " [errno " ~ to!string(retval) ~ "]"); --} // _spawnvp --private -+version (Posix) unittest - { -- alias WIFSTOPPED stopped; -- alias WIFSIGNALED signaled; -- alias WTERMSIG termsig; -- alias WIFEXITED exited; -- alias WEXITSTATUS exitstatus; --} // private --} // version (Posix) -+ auto e1 = createEnv(null, false); -+ assert (e1 != null && *e1 == null); - --/* ========================================================== */ -+ auto e2 = createEnv(null, true); -+ assert (e2 != null); -+ int i = 0; -+ for (; environ[i] != null; ++i) -+ { -+ assert (e2[i] != null); -+ import core.stdc.string; -+ assert (strcmp(e2[i], environ[i]) == 0); -+ } -+ assert (e2[i] == null); - --/** -- * Replace the current process by executing a command, $(D pathname), with -- * the arguments in $(D argv). Typically, the first element of $(D argv) is -- * the command being executed, i.e. $(D argv[0] == pathname). The 'p' -- * versions of $(D exec) search the PATH environment variable for $(D -- * pathname). The 'e' versions additionally take the new process' -- * environment variables as an array of strings of the form key=value. -- * -- * Does not return on success (the current process will have been -- * replaced). Returns -1 on failure with no indication of the -- * underlying error. -- */ -+ auto e3 = createEnv(["foo" : "bar", "hello" : "world"], false); -+ assert (e3 != null && e3[0] != null && e3[1] != null && e3[2] == null); -+ assert ((e3[0][0 .. 8] == "foo=bar\0" && e3[1][0 .. 12] == "hello=world\0") -+ || (e3[0][0 .. 12] == "hello=world\0" && e3[1][0 .. 8] == "foo=bar\0")); -+} - --int execv(in string pathname, in string[] argv) -+ -+// Converts childEnv to a Windows environment block, which is on the form -+// "name1=value1\0name2=value2\0...nameN=valueN\0\0", optionally adding -+// those of the current process' environment strings that are not present -+// in childEnv. Returns null if the parent's environment should be -+// inherited without modification, as this is what is expected by -+// CreateProcess(). -+version (Windows) -+private LPVOID createEnv(const string[string] childEnv, -+ bool mergeWithParentEnv) - { -- auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ if (mergeWithParentEnv && childEnv.length == 0) return null; - -- toAStringz(argv, argv_); -+ auto envz = appender!(wchar[])(); -+ void put(string var, string val) -+ { -+ envz.put(var); -+ envz.put('='); -+ envz.put(val); -+ envz.put(cast(wchar) '\0'); -+ } - -- return std.c.process.execv(toStringz(pathname), argv_); --} -+ // Add the variables in childEnv, removing them from parentEnv -+ // if they exist there too. -+ auto parentEnv = mergeWithParentEnv ? environment.toAA() : null; -+ foreach (k, v; childEnv) -+ { -+ auto uk = toUpper(k); -+ put(uk, v); -+ if (uk in parentEnv) parentEnv.remove(uk); -+ } - --/** ditto */ --int execve(in string pathname, in string[] argv, in string[] envp) --{ -- auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -- auto envp_ = cast(const(char)**)alloca((char*).sizeof * (1 + envp.length)); -+ // Add remaining parent environment variables. -+ foreach (k, v; parentEnv) put(k, v); - -- toAStringz(argv, argv_); -- toAStringz(envp, envp_); -+ // Two final zeros are needed in case there aren't any environment vars, -+ // and the last one does no harm when there are. -+ envz.put("\0\0"w); -+ return envz.data.ptr; -+} - -- return std.c.process.execve(toStringz(pathname), argv_, envp_); -+version (Windows) unittest -+{ -+ assert (createEnv(null, true) == null); -+ assert ((cast(wchar*) createEnv(null, false))[0 .. 2] == "\0\0"w); -+ auto e1 = (cast(wchar*) createEnv(["foo":"bar", "ab":"c"], false))[0 .. 14]; -+ assert (e1 == "FOO=bar\0AB=c\0\0"w || e1 == "AB=c\0FOO=bar\0\0"w); - } - --/** ditto */ --int execvp(in string pathname, in string[] argv) -+// Searches the PATH variable for the given executable file, -+// (checking that it is in fact executable). -+version (Posix) -+private string searchPathFor(in char[] executable) -+ @trusted //TODO: @safe nothrow - { -- auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ auto pathz = core.stdc.stdlib.getenv("PATH"); -+ if (pathz == null) return null; - -- toAStringz(argv, argv_); -+ foreach (dir; splitter(to!string(pathz), ':')) -+ { -+ auto execPath = buildPath(dir, executable); -+ if (isExecutable(execPath)) return execPath; -+ } - -- return std.c.process.execvp(toStringz(pathname), argv_); -+ return null; - } - --/** ditto */ --int execvpe(in string pathname, in string[] argv, in string[] envp) --{ --version(Posix) -+// Checks whether the file exists and can be executed by the -+// current user. -+version (Posix) -+private bool isExecutable(in char[] path) @trusted //TODO: @safe nothrow - { -- // Is pathname rooted? -- if(pathname[0] == '/') -- { -- // Yes, so just call execve() -- return execve(pathname, argv, envp); -- } -- else -- { -- // No, so must traverse PATHs, looking for first match -- string[] envPaths = std.array.split( -- to!string(core.stdc.stdlib.getenv("PATH")), ":"); -- int iRet = 0; -- -- // Note: if any call to execve() succeeds, this process will cease -- // execution, so there's no need to check the execve() result through -- // the loop. -- -- foreach(string pathDir; envPaths) -- { -- string composite = cast(string) (pathDir ~ "/" ~ pathname); -- -- iRet = execve(composite, argv, envp); -- } -- if(0 != iRet) -- { -- iRet = execve(pathname, argv, envp); -- } -- -- return iRet; -- } -+ return (access(toStringz(path), X_OK) == 0); - } --else version(Windows) --{ -- auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -- auto envp_ = cast(const(char)**)alloca((char*).sizeof * (1 + envp.length)); - -- toAStringz(argv, argv_); -- toAStringz(envp, envp_); -+version (Posix) unittest -+{ -+ auto unamePath = searchPathFor("uname"); -+ assert (!unamePath.empty); -+ assert (unamePath[0] == '/'); -+ assert (unamePath.endsWith("uname")); -+ auto unlikely = searchPathFor("lkmqwpoialhggyaofijadsohufoiqezm"); -+ assert (unlikely is null, "Are you kidding me?"); -+} - -- return std.c.process.execvpe(toStringz(pathname), argv_, envp_); -+// Sets or unsets the FD_CLOEXEC flag on the given file descriptor. -+version (Posix) -+private void setCLOEXEC(int fd, bool on) -+{ -+ import core.sys.posix.fcntl; -+ auto flags = fcntl(fd, F_GETFD); -+ if (flags >= 0) -+ { -+ if (on) flags |= FD_CLOEXEC; -+ else flags &= ~(cast(typeof(flags)) FD_CLOEXEC); -+ flags = fcntl(fd, F_SETFD, flags); -+ } -+ if (flags == -1) -+ { -+ throw new StdioException("Failed to "~(on ? "" : "un") -+ ~"set close-on-exec flag on file descriptor"); -+ } -+} -+ -+unittest // Command line arguments in spawnProcess(). -+{ -+ version (Windows) TestScript prog = -+ "if not [%~1]==[foo] ( exit 1 ) -+ if not [%~2]==[bar] ( exit 2 ) -+ exit 0"; -+ else version (Posix) TestScript prog = -+ `if test "$1" != "foo"; then exit 1; fi -+ if test "$2" != "bar"; then exit 2; fi -+ exit 0`; -+ assert (wait(spawnProcess(prog.path)) == 1); -+ assert (wait(spawnProcess([prog.path])) == 1); -+ assert (wait(spawnProcess([prog.path, "foo"])) == 2); -+ assert (wait(spawnProcess([prog.path, "foo", "baz"])) == 2); -+ assert (wait(spawnProcess([prog.path, "foo", "bar"])) == 0); -+} -+ -+unittest // Environment variables in spawnProcess(). -+{ -+ // We really should use set /a on Windows, but Wine doesn't support it. -+ version (Windows) TestScript envProg = -+ `if [%STD_PROCESS_UNITTEST1%] == [1] ( -+ if [%STD_PROCESS_UNITTEST2%] == [2] (exit 3) -+ exit 1 -+ ) -+ if [%STD_PROCESS_UNITTEST1%] == [4] ( -+ if [%STD_PROCESS_UNITTEST2%] == [2] (exit 6) -+ exit 4 -+ ) -+ if [%STD_PROCESS_UNITTEST2%] == [2] (exit 2) -+ exit 0`; -+ version (Posix) TestScript envProg = -+ `if test "$std_process_unittest1" = ""; then -+ std_process_unittest1=0 -+ fi -+ if test "$std_process_unittest2" = ""; then -+ std_process_unittest2=0 -+ fi -+ exit $(($std_process_unittest1+$std_process_unittest2))`; -+ -+ environment.remove("std_process_unittest1"); // Just in case. -+ environment.remove("std_process_unittest2"); -+ assert (wait(spawnProcess(envProg.path)) == 0); -+ assert (wait(spawnProcess(envProg.path, null, Config.newEnv)) == 0); -+ -+ environment["std_process_unittest1"] = "1"; -+ assert (wait(spawnProcess(envProg.path)) == 1); -+ assert (wait(spawnProcess(envProg.path, null, Config.newEnv)) == 0); -+ -+ auto env = ["std_process_unittest2" : "2"]; -+ assert (wait(spawnProcess(envProg.path, env)) == 3); -+ assert (wait(spawnProcess(envProg.path, env, Config.newEnv)) == 2); -+ -+ env["std_process_unittest1"] = "4"; -+ assert (wait(spawnProcess(envProg.path, env)) == 6); -+ assert (wait(spawnProcess(envProg.path, env, Config.newEnv)) == 6); -+ -+ environment.remove("std_process_unittest1"); -+ assert (wait(spawnProcess(envProg.path, env)) == 6); -+ assert (wait(spawnProcess(envProg.path, env, Config.newEnv)) == 6); -+} -+ -+unittest // Stream redirection in spawnProcess(). -+{ -+ version (Windows) TestScript prog = -+ "set /p INPUT= -+ echo %INPUT% output %~1 -+ echo %INPUT% error %~2 1>&2"; -+ else version (Posix) TestScript prog = -+ "read INPUT -+ echo $INPUT output $1 -+ echo $INPUT error $2 >&2"; -+ -+ // Pipes -+ auto pipei = pipe(); -+ auto pipeo = pipe(); -+ auto pipee = pipe(); -+ auto pid = spawnProcess([prog.path, "foo", "bar"], -+ pipei.readEnd, pipeo.writeEnd, pipee.writeEnd); -+ pipei.writeEnd.writeln("input"); -+ pipei.writeEnd.flush(); -+ assert (pipeo.readEnd.readln().chomp() == "input output foo"); -+ assert (pipee.readEnd.readln().chomp().stripRight() == "input error bar"); -+ wait(pid); -+ -+ // Files -+ import std.ascii, std.file, std.uuid; -+ auto pathi = buildPath(tempDir(), randomUUID().toString()); -+ auto patho = buildPath(tempDir(), randomUUID().toString()); -+ auto pathe = buildPath(tempDir(), randomUUID().toString()); -+ std.file.write(pathi, "INPUT"~std.ascii.newline); -+ auto filei = File(pathi, "r"); -+ auto fileo = File(patho, "w"); -+ auto filee = File(pathe, "w"); -+ pid = spawnProcess([prog.path, "bar", "baz" ], filei, fileo, filee); -+ wait(pid); -+ assert (readText(patho).chomp() == "INPUT output bar"); -+ assert (readText(pathe).chomp().stripRight() == "INPUT error baz"); -+ remove(pathi); -+ remove(patho); -+ remove(pathe); - } --else -+ -+unittest // Error handling in spawnProcess() - { -- static assert(0); --} // version -+ assertThrown!ProcessException(spawnProcess("ewrgiuhrifuheiohnmnvqweoijwf")); -+ assertThrown!ProcessException(spawnProcess("./rgiuhrifuheiohnmnvqweoijwf")); - } - --/** -- * Returns the process ID of the calling process, which is guaranteed to be -- * unique on the system. This call is always successful. -- * -- * Example: -- * --- -- * writefln("Current process id: %s", getpid()); -- * --- -- */ --alias core.thread.getpid getpid; - - /** -- Runs $(D_PARAM cmd) in a shell and returns its standard output. If -- the process could not be started or exits with an error code, -- throws an exception. -+A variation on $(LREF spawnProcess) that runs the given _command through -+the current user's preferred _command interpreter (aka. shell). - -- Example: -+The string $(D command) is passed verbatim to the shell, and is therefore -+subject to its rules about _command structure, argument/filename quoting -+and escaping of special characters. -+The path to the shell executable is determined by the $(LREF userShell) -+function. -+ -+In all other respects this function works just like $(D spawnProcess). -+Please refer to the $(LREF spawnProcess) documentation for descriptions -+of the other function parameters, the return value and any exceptions -+that may be thrown. -+--- -+// Run the command/program "foo" on the file named "my file.txt", and -+// redirect its output into foo.log. -+auto pid = spawnShell(`foo "my file.txt" > foo.log`); -+wait(pid); -+--- - -- ---- -- auto tempFilename = chomp(shell("mcookie")); -- auto f = enforce(fopen(tempFilename), "w"); -- scope(exit) -- { -- fclose(f) == 0 || assert(false); -- system(escapeShellCommand("rm", tempFilename)); -- } -- ... use f ... -- ---- -+See_also: -+$(LREF escapeShellCommand), which may be helpful in constructing a -+properly quoted and escaped shell _command line for the current platform. - */ --string shell(string cmd) -+Pid spawnShell(in char[] command, -+ File stdin = std.stdio.stdin, -+ File stdout = std.stdio.stdout, -+ File stderr = std.stdio.stderr, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted // TODO: Should be @safe - { -- version(Windows) -+ version (Windows) - { -- // Generate a random filename -- auto a = appender!string(); -- foreach (ref e; 0 .. 8) -- { -- formattedWrite(a, "%x", rndGen.front); -- rndGen.popFront(); -- } -- auto filename = a.data; -- scope(exit) if (exists(filename)) remove(filename); -- // We can't use escapeShellCommands here because we don't know -- // if cmd is escaped (wrapped in quotes) or not, without relying -- // on shady heuristics. The current code shouldn't cause much -- // trouble unless filename contained spaces (it won't). -- errnoEnforce(system(cmd ~ "> " ~ filename) == 0); -- return readText(filename); -+ auto args = escapeShellArguments(userShell, shellSwitch) -+ ~ " " ~ command; - } -- else version(Posix) -+ else version (Posix) - { -- File f; -- f.popen(cmd, "r"); -- char[] line; -- string result; -- while (f.readln(line)) -- { -- result ~= line; -- } -- f.close(); -- return result; -- } -- else -- static assert(0, "shell not implemented for this OS."); -+ const(char)[][3] args; -+ args[0] = userShell; -+ args[1] = shellSwitch; -+ args[2] = command; -+ } -+ return spawnProcessImpl(args, stdin, stdout, stderr, env, config); -+} -+ -+/// ditto -+Pid spawnShell(in char[] command, -+ const string[string] env, -+ Config config = Config.none) -+ @trusted // TODO: Should be @safe -+{ -+ return spawnShell(command, -+ std.stdio.stdin, -+ std.stdio.stdout, -+ std.stdio.stderr, -+ env, -+ config); - } - - unittest - { -- auto x = shell("echo wyda"); -- // @@@ This fails on wine -- //assert(x == "wyda" ~ newline, text(x.length)); -+ version (Windows) -+ auto cmd = "echo %FOO%"; -+ else version (Posix) -+ auto cmd = "echo $foo"; -+ import std.file; -+ auto tmpFile = uniqueTempPath(); -+ scope(exit) if (exists(tmpFile)) remove(tmpFile); -+ auto redir = "> \""~tmpFile~'"'; -+ auto env = ["foo" : "bar"]; -+ assert (wait(spawnShell(cmd~redir, env)) == 0); -+ auto f = File(tmpFile, "a"); -+ assert (wait(spawnShell(cmd, std.stdio.stdin, f, std.stdio.stderr, env)) == 0); -+ f.close(); -+ auto output = std.file.readText(tmpFile); -+ assert (output == "bar\nbar\n" || output == "bar\r\nbar\r\n"); - } - -+ - /** --Gets the value of environment variable $(D name) as a string. Calls --$(LINK2 std_c_stdlib.html#_getenv, std.c.stdlib._getenv) --internally. */ -+Flags that control the behaviour of $(LREF spawnProcess) and -+$(LREF spawnShell). - --string getenv(in char[] name) --{ -- // Cache the last call's result -- static string lastResult; -- auto p = core.stdc.stdlib.getenv(toStringz(name)); -- if (!p) return null; -- auto value = p[0 .. strlen(p)]; -- if (value == lastResult) return lastResult; -- return lastResult = value.idup; --} -+Use bitwise OR to combine flags. - --/** --Sets the value of environment variable $(D name) to $(D value). If the --value was written, or the variable was already present and $(D --overwrite) is false, returns normally. Otherwise, it throws an --exception. Calls $(LINK2 std_c_stdlib.html#_setenv, --std.c.stdlib._setenv) internally. */ --version(StdDdoc) void setenv(in char[] name, in char[] value, bool overwrite); --else version(Posix) void setenv(in char[] name, in char[] value, bool overwrite) --{ -- errnoEnforce( -- std.c.stdlib.setenv(toStringz(name), toStringz(value), overwrite) == 0); --} -+Example: -+--- -+auto logFile = File("myapp_error.log", "w"); - --/** --Removes variable $(D name) from the environment. Calls $(LINK2 --std_c_stdlib.html#_unsetenv, std.c.stdlib._unsetenv) internally. */ --version(StdDdoc) void unsetenv(in char[] name); --else version(Posix) void unsetenv(in char[] name) --{ -- errnoEnforce(std.c.stdlib.unsetenv(toStringz(name)) == 0); -+// Start program, suppressing the console window (Windows only), -+// redirect its error stream to logFile, and leave logFile open -+// in the parent process as well. -+auto pid = spawnProcess("myapp", stdin, stdout, logFile, -+ Config.retainStderr | Config.suppressConsole); -+scope(exit) -+{ -+ auto exitCode = wait(pid); -+ logFile.writeln("myapp exited with code ", exitCode); -+ logFile.close(); - } -- --version (Posix) unittest -+--- -+*/ -+enum Config - { -- setenv("wyda", "geeba", true); -- assert(getenv("wyda") == "geeba"); -- // Get again to make sure caching works -- assert(getenv("wyda") == "geeba"); -- unsetenv("wyda"); -- assert(getenv("wyda") is null); --} -+ none = 0, - --/* ////////////////////////////////////////////////////////////////////////// */ -+ /** -+ By default, the child process inherits the parent's environment, -+ and any environment variables passed to $(LREF spawnProcess) will -+ be added to it. If this flag is set, the only variables in the -+ child process' environment will be those given to spawnProcess. -+ */ -+ newEnv = 1, -+ -+ /** -+ Unless the child process inherits the standard input/output/error -+ streams of its parent, one almost always wants the streams closed -+ in the parent when $(LREF spawnProcess) returns. Therefore, by -+ default, this is done. If this is not desirable, pass any of these -+ options to spawnProcess. -+ */ -+ retainStdin = 2, -+ retainStdout = 4, /// ditto -+ retainStderr = 8, /// ditto -+ -+ /** -+ On Windows, if the child process is a console application, this -+ flag will prevent the creation of a console window. Otherwise, -+ it will be ignored. On POSIX, $(D suppressConsole) has no effect. -+ */ -+ suppressConsole = 16, -+ -+ /** -+ On POSIX, open $(LINK2 http://en.wikipedia.org/wiki/File_descriptor,file descriptors) -+ are by default inherited by the child process. As this may lead -+ to subtle bugs when pipes or multiple threads are involved, -+ $(LREF spawnProcess) ensures that all file descriptors except the -+ ones that correspond to standard input/output/error are closed -+ in the child process when it starts. Use $(D inheritFDs) to prevent -+ this. -+ -+ On Windows, this option has no effect, and any handles which have been -+ explicitly marked as inheritable will always be inherited by the child -+ process. -+ */ -+ inheritFDs = 32, -+} -+ -+ -+/// A handle that corresponds to a spawned process. -+final class Pid -+{ -+ /** -+ The process ID number. -+ -+ This is a number that uniquely identifies the process on the operating -+ system, for at least as long as the process is running. Once $(LREF wait) -+ has been called on the $(LREF Pid), this method will return an -+ invalid process ID. -+ */ -+ @property int processID() const @safe pure nothrow -+ { -+ return _processID; -+ } -+ -+ /** -+ An operating system handle to the process. -+ -+ This handle is used to specify the process in OS-specific APIs. -+ On POSIX, this function returns a $(D core.sys.posix.sys.types.pid_t) -+ with the same value as $(LREF Pid.processID), while on Windows it returns -+ a $(D core.sys.windows.windows.HANDLE). -+ -+ Once $(LREF wait) has been called on the $(LREF Pid), this method -+ will return an invalid handle. -+ */ -+ // Note: Since HANDLE is a reference, this function cannot be const. -+ version (Windows) -+ @property HANDLE osHandle() @safe pure nothrow -+ { -+ return _handle; -+ } -+ else version (Posix) -+ @property pid_t osHandle() @safe pure nothrow -+ { -+ return _processID; -+ } - --version(MainTest) --{ -- int main(string[] args) -+private: -+ /* -+ Pid.performWait() does the dirty work for wait() and nonBlockingWait(). -+ -+ If block == true, this function blocks until the process terminates, -+ sets _processID to terminated, and returns the exit code or terminating -+ signal as described in the wait() documentation. -+ -+ If block == false, this function returns immediately, regardless -+ of the status of the process. If the process has terminated, the -+ function has the exact same effect as the blocking version. If not, -+ it returns 0 and does not modify _processID. -+ */ -+ version (Posix) -+ int performWait(bool block) @trusted - { -- if(args.length < 2) -+ if (_processID == terminated) return _exitCode; -+ int exitCode; -+ while(true) -+ { -+ int status; -+ auto check = waitpid(_processID, &status, block ? 0 : WNOHANG); -+ if (check == -1) -+ { -+ if (errno == ECHILD) -+ { -+ throw new ProcessException( -+ "Process does not exist or is not a child process."); -+ } -+ else -+ { -+ // waitpid() was interrupted by a signal. We simply -+ // restart it. -+ assert (errno == EINTR); -+ continue; -+ } -+ } -+ if (!block && check == 0) return 0; -+ if (WIFEXITED(status)) -+ { -+ exitCode = WEXITSTATUS(status); -+ break; -+ } -+ else if (WIFSIGNALED(status)) -+ { -+ exitCode = -WTERMSIG(status); -+ break; -+ } -+ // We check again whether the call should be blocking, -+ // since we don't care about other status changes besides -+ // "exited" and "terminated by signal". -+ if (!block) return 0; -+ -+ // Process has stopped, but not terminated, so we continue waiting. -+ } -+ // Mark Pid as terminated, and cache and return exit code. -+ _processID = terminated; -+ _exitCode = exitCode; -+ return exitCode; -+ } -+ else version (Windows) -+ { -+ int performWait(bool block) @trusted - { -- printf("Must supply executable (and optional arguments)\n"); -- -- return 1; -+ if (_processID == terminated) return _exitCode; -+ assert (_handle != INVALID_HANDLE_VALUE); -+ if (block) -+ { -+ auto result = WaitForSingleObject(_handle, INFINITE); -+ if (result != WAIT_OBJECT_0) -+ throw ProcessException.newFromLastError("Wait failed."); -+ } -+ if (!GetExitCodeProcess(_handle, cast(LPDWORD)&_exitCode)) -+ throw ProcessException.newFromLastError(); -+ if (!block && _exitCode == STILL_ACTIVE) return 0; -+ CloseHandle(_handle); -+ _handle = INVALID_HANDLE_VALUE; -+ _processID = terminated; -+ return _exitCode; - } -- else -- { -- string[] dummy_env; -- -- dummy_env ~= "VAL0=value"; -- dummy_env ~= "VAL1=value"; - --/+ -- foreach(string arg; args) -+ ~this() -+ { -+ if(_handle != INVALID_HANDLE_VALUE) - { -- printf("%.*s\n", arg); -+ CloseHandle(_handle); -+ _handle = INVALID_HANDLE_VALUE; - } --+/ -+ } -+ } - --// int i = execv(args[1], args[1 .. args.length]); --// int i = execvp(args[1], args[1 .. args.length]); -- int i = execvpe(args[1], args[1 .. args.length], dummy_env); -+ // Special values for _processID. -+ enum invalid = -1, terminated = -2; - -- printf("exec??() has returned! Error code: %d; errno: %d\n", i, /* errno */-1); -+ // OS process ID number. Only nonnegative IDs correspond to -+ // running processes. -+ int _processID = invalid; -+ -+ // Exit code cached by wait(). This is only expected to hold a -+ // sensible value if _processID == terminated. -+ int _exitCode; - -- return 0; -+ // Pids are only meant to be constructed inside this module, so -+ // we make the constructor private. -+ version (Windows) -+ { -+ HANDLE _handle = INVALID_HANDLE_VALUE; -+ this(int pid, HANDLE handle) @safe pure nothrow -+ { -+ _processID = pid; -+ _handle = handle; -+ } -+ } -+ else -+ { -+ this(int id) @safe pure nothrow -+ { -+ _processID = id; - } - } - } - --/* ////////////////////////////////////////////////////////////////////////// */ - -+/** -+Waits for the process associated with $(D pid) to terminate, and returns -+its exit status. - -+In general one should always _wait for child processes to terminate -+before exiting the parent process. Otherwise, they may become -+"$(WEB en.wikipedia.org/wiki/Zombie_process,zombies)" – processes -+that are defunct, yet still occupy a slot in the OS process table. -+ -+If the process has already terminated, this function returns directly. -+The exit code is cached, so that if wait() is called multiple times on -+the same $(LREF Pid) it will always return the same value. -+ -+POSIX_specific: -+If the process is terminated by a signal, this function returns a -+negative number whose absolute value is the signal number. -+Since POSIX restricts normal exit codes to the range 0-255, a -+negative return value will always indicate termination by signal. -+Signal codes are defined in the $(D core.sys.posix.signal) module -+(which corresponds to the $(D signal.h) POSIX header). - -+Throws: -+$(LREF ProcessException) on failure. - --/** Manipulates environment variables using an associative-array-like -- interface. -+Examples: -+See the $(LREF spawnProcess) documentation. - -- Examples: -- --- -- // Return variable, or throw an exception if it doesn't exist. -- auto path = environment["PATH"]; -+See_also: -+$(LREF tryWait), for a non-blocking function. -+*/ -+int wait(Pid pid) @safe -+{ -+ assert(pid !is null, "Called wait on a null Pid."); -+ return pid.performWait(true); -+} - -- // Add/replace variable. -- environment["foo"] = "bar"; - -- // Remove variable. -- environment.remove("foo"); -+unittest // Pid and wait() -+{ -+ version (Windows) TestScript prog = "exit %~1"; -+ else version (Posix) TestScript prog = "exit $1"; -+ assert (wait(spawnProcess([prog.path, "0"])) == 0); -+ assert (wait(spawnProcess([prog.path, "123"])) == 123); -+ auto pid = spawnProcess([prog.path, "10"]); -+ assert (pid.processID > 0); -+ version (Windows) assert (pid.osHandle != INVALID_HANDLE_VALUE); -+ else version (Posix) assert (pid.osHandle == pid.processID); -+ assert (wait(pid) == 10); -+ assert (wait(pid) == 10); // cached exit code -+ assert (pid.processID < 0); -+ version (Windows) assert (pid.osHandle == INVALID_HANDLE_VALUE); -+ else version (Posix) assert (pid.osHandle < 0); -+} - -- // Return variable, or null if it doesn't exist. -- auto foo = environment.get("foo"); - -- // Return variable, or a default value if it doesn't exist. -- auto foo = environment.get("foo", "default foo value"); -+/** -+A non-blocking version of $(LREF wait). - -- // Return an associative array of type string[string] containing -- // all the environment variables. -- auto aa = environment.toAA(); -- --- --*/ --alias Environment environment; -+If the process associated with $(D pid) has already terminated, -+$(D tryWait) has the exact same effect as $(D wait). -+In this case, it returns a struct where the $(D terminated) field -+is set to $(D true) and the $(D status) field has the same -+interpretation as the return value of $(D wait). -+ -+If the process has $(I not) yet terminated, this function differs -+from $(D wait) in that does not wait for this to happen, but instead -+returns immediately. The $(D terminated) field of the returned -+tuple will then be set to $(D false), while the $(D status) field -+will always be 0 (zero). $(D wait) or $(D tryWait) should then be -+called again on the same $(D Pid) at some later time; not only to -+get the exit code, but also to avoid the process becoming a "zombie" -+when it finally terminates. (See $(LREF wait) for details). -+ -+Returns: -+A $(D struct) which contains the fields $(D bool terminated) -+and $(D int status). (This will most likely change to become a -+$(D std.typecons.Tuple!(bool,"terminated",int,"status")) in the future, -+but a compiler bug currently prevents this.) - --abstract final class Environment -+Throws: -+$(LREF ProcessException) on failure. -+ -+Example: -+--- -+auto pid = spawnProcess("dmd myapp.d"); -+scope(exit) wait(pid); -+... -+auto dmd = tryWait(pid); -+if (dmd.terminated) - { --static: --private: -- // Return the length of an environment variable (in number of -- // wchars, including the null terminator), 0 if it doesn't exist. -- version(Windows) -- int varLength(LPCWSTR namez) -+ if (dmd.status == 0) writeln("Compilation succeeded!"); -+ else writeln("Compilation failed"); -+} -+else writeln("Still compiling..."); -+... -+--- -+Note that in this example, the first $(D wait) call will have no -+effect if the process has already terminated by the time $(D tryWait) -+is called. In the opposite case, however, the $(D scope) statement -+ensures that we always wait for the process if it hasn't terminated -+by the time we reach the end of the scope. -+*/ -+auto tryWait(Pid pid) @safe -+{ -+ struct TryWaitResult - { -- return GetEnvironmentVariableW(namez, null, 0); -+ bool terminated; -+ int status; - } -+ assert(pid !is null, "Called tryWait on a null Pid."); -+ auto code = pid.performWait(false); -+ return TryWaitResult(pid._processID == Pid.terminated, code); -+} -+// unittest: This function is tested together with kill() below. - - -- // Retrieve the environment variable, or return false on failure. -- bool getImpl(string name, out string value) -- { -- version(Posix) -- { -- const vz = core.sys.posix.stdlib.getenv(toStringz(name)); -- if (vz == null) return false; -- auto v = vz[0 .. strlen(vz)]; -+/** -+Attempts to terminate the process associated with $(D pid). - -- // Cache the last call's result. -- static string lastResult; -- if (v != lastResult) lastResult = v.idup; -- value = lastResult; -- return true; -- } -+The effect of this function, as well as the meaning of $(D codeOrSignal), -+is highly platform dependent. Details are given below. Common to all -+platforms is that this function only $(I initiates) termination of the process, -+and returns immediately. It does not wait for the process to end, -+nor does it guarantee that the process does in fact get terminated. -+ -+Always call $(LREF wait) to wait for a process to complete, even if $(D kill) -+has been called on it. -+ -+Windows_specific: -+The process will be -+$(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.100%29.aspx, -+forcefully and abruptly terminated). If $(D codeOrSignal) is specified, it -+must be a nonnegative number which will be used as the exit code of the process. -+If not, the process wil exit with code 1. Do not use $(D codeOrSignal = 259), -+as this is a special value (aka. $(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/ms683189.aspx,STILL_ACTIVE)) -+used by Windows to signal that a process has in fact $(I not) terminated yet. -+--- -+auto pid = spawnProcess("some_app"); -+kill(pid, 10); -+assert (wait(pid) == 10); -+--- - -- else version(Windows) -- { -- const namez = toUTF16z(name); -- immutable len = varLength(namez); -- if (len == 0) return false; -- if (len == 1) return true; -- -- auto buf = new WCHAR[len]; -- GetEnvironmentVariableW(namez, buf.ptr, to!DWORD(buf.length)); -- value = toUTF8(buf[0 .. $-1]); -- return true; -- } -+POSIX_specific: -+A $(LINK2 http://en.wikipedia.org/wiki/Unix_signal,signal) will be sent to -+the process, whose value is given by $(D codeOrSignal). Depending on the -+signal sent, this may or may not terminate the process. Symbolic constants -+for various $(LINK2 http://en.wikipedia.org/wiki/Unix_signal#POSIX_signals, -+POSIX signals) are defined in $(D core.sys.posix.signal), which corresponds to the -+$(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html, -+$(D signal.h) POSIX header). If $(D codeOrSignal) is omitted, the -+$(D SIGTERM) signal will be sent. (This matches the behaviour of the -+$(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/kill.html, -+$(D _kill)) shell command.) -+--- -+import core.sys.posix.signal: SIGKILL; -+auto pid = spawnProcess("some_app"); -+kill(pid, SIGKILL); -+assert (wait(pid) == -SIGKILL); // Negative return value on POSIX! -+--- - -- else static assert(0); -+Throws: -+$(LREF ProcessException) on error (e.g. if codeOrSignal is invalid). -+ Note that failure to terminate the process is considered a "normal" -+ outcome, not an error.$(BR) -+*/ -+void kill(Pid pid) -+{ -+ version (Windows) kill(pid, 1); -+ else version (Posix) -+ { -+ import core.sys.posix.signal: SIGTERM; -+ kill(pid, SIGTERM); - } -+} - -+/// ditto -+void kill(Pid pid, int codeOrSignal) -+{ -+ version (Windows) -+ { -+ if (codeOrSignal < 0) throw new ProcessException("Invalid exit code"); -+ version (Win32) -+ { -+ // On Windows XP, TerminateProcess() appears to terminate the -+ // *current* process if it is passed an invalid handle... -+ if (pid.osHandle == INVALID_HANDLE_VALUE) -+ throw new ProcessException("Invalid process handle"); -+ } -+ if (!TerminateProcess(pid.osHandle, codeOrSignal)) -+ throw ProcessException.newFromLastError(); -+ } -+ else version (Posix) -+ { -+ import core.sys.posix.signal; -+ if (kill(pid.osHandle, codeOrSignal) == -1) -+ throw ProcessException.newFromErrno(); -+ } -+} - -- --public: -- // Retrieve an environment variable, throw on failure. -- string opIndex(string name) -+unittest // tryWait() and kill() -+{ -+ import core.thread; -+ // The test script goes into an infinite loop. -+ version (Windows) - { -- string value; -- enforce(getImpl(name, value), "Environment variable not found: "~name); -- return value; -+ TestScript prog = ":loop -+ goto loop"; -+ } -+ else version (Posix) -+ { -+ import core.sys.posix.signal: SIGTERM, SIGKILL; -+ TestScript prog = "while true; do sleep 1; done"; - } -+ auto pid = spawnProcess(prog.path); -+ Thread.sleep(dur!"seconds"(1)); -+ kill(pid); -+ version (Windows) assert (wait(pid) == 1); -+ else version (Posix) assert (wait(pid) == -SIGTERM); -+ -+ pid = spawnProcess(prog.path); -+ Thread.sleep(dur!"seconds"(1)); -+ auto s = tryWait(pid); -+ assert (!s.terminated && s.status == 0); -+ assertThrown!ProcessException(kill(pid, -123)); // Negative code not allowed. -+ version (Windows) kill(pid, 123); -+ else version (Posix) kill(pid, SIGKILL); -+ do { s = tryWait(pid); } while (!s.terminated); -+ version (Windows) assert (s.status == 123); -+ else version (Posix) assert (s.status == -SIGKILL); -+ assertThrown!ProcessException(kill(pid)); -+} -+ -+ -+/** -+Creates a unidirectional _pipe. - -+Data is written to one end of the _pipe and read from the other. -+--- -+auto p = pipe(); -+p.writeEnd.writeln("Hello World"); -+assert (p.readEnd.readln().chomp() == "Hello World"); -+--- -+Pipes can, for example, be used for interprocess communication -+by spawning a new process and passing one end of the _pipe to -+the child, while the parent uses the other end. -+(See also $(LREF pipeProcess) and $(LREF pipeShell) for an easier -+way of doing this.) -+--- -+// Use cURL to download the dlang.org front page, pipe its -+// output to grep to extract a list of links to ZIP files, -+// and write the list to the file "D downloads.txt": -+auto p = pipe(); -+auto outFile = File("D downloads.txt", "w"); -+auto cpid = spawnProcess(["curl", "http://dlang.org/download.html"], -+ std.stdio.stdin, p.writeEnd); -+scope(exit) wait(cpid); -+auto gpid = spawnProcess(["grep", "-o", `http://\S*\.zip`], -+ p.readEnd, outFile); -+scope(exit) wait(gpid); -+--- - -+Returns: -+A $(LREF Pipe) object that corresponds to the created _pipe. - -- // Assign a value to an environment variable. If the variable -- // exists, it is overwritten. -- string opIndexAssign(string value, string name) -+Throws: -+$(XREF stdio,StdioException) on failure. -+*/ -+version (Posix) -+Pipe pipe() @trusted //TODO: @safe -+{ -+ int[2] fds; -+ if (core.sys.posix.unistd.pipe(fds) != 0) -+ throw new StdioException("Unable to create pipe"); -+ Pipe p; -+ auto readFP = fdopen(fds[0], "r"); -+ if (readFP == null) -+ throw new StdioException("Cannot open read end of pipe"); -+ p._read = File(readFP, null); -+ auto writeFP = fdopen(fds[1], "w"); -+ if (writeFP == null) -+ throw new StdioException("Cannot open write end of pipe"); -+ p._write = File(writeFP, null); -+ return p; -+} -+else version (Windows) -+Pipe pipe() @trusted //TODO: @safe -+{ -+ // use CreatePipe to create an anonymous pipe -+ HANDLE readHandle; -+ HANDLE writeHandle; -+ if (!CreatePipe(&readHandle, &writeHandle, null, 0)) - { -- version(Posix) -- { -- if (core.sys.posix.stdlib.setenv(toStringz(name), -- toStringz(value), 1) != -1) -- { -- return value; -- } -+ throw new StdioException( -+ "Error creating pipe (" ~ sysErrorString(GetLastError()) ~ ')', -+ 0); -+ } - -- // The default errno error message is very uninformative -- // in the most common case, so we handle it manually. -- enforce(errno != EINVAL, -- "Invalid environment variable name: '"~name~"'"); -- errnoEnforce(false, -- "Failed to add environment variable"); -- assert(0); -- } -+ // Create file descriptors from the handles -+ version (DMC_RUNTIME) -+ { -+ auto readFD = _handleToFD(readHandle, FHND_DEVICE); -+ auto writeFD = _handleToFD(writeHandle, FHND_DEVICE); -+ } -+ else // MSVCRT -+ { -+ auto readFD = _open_osfhandle(readHandle, _O_RDONLY); -+ auto writeFD = _open_osfhandle(writeHandle, _O_APPEND); -+ } -+ version (DMC_RUNTIME) alias .close _close; -+ if (readFD == -1 || writeFD == -1) -+ { -+ // Close file descriptors, then throw. -+ if (readFD >= 0) _close(readFD); -+ else CloseHandle(readHandle); -+ if (writeFD >= 0) _close(writeFD); -+ else CloseHandle(writeHandle); -+ throw new StdioException("Error creating pipe"); -+ } - -- else version(Windows) -+ // Create FILE pointers from the file descriptors -+ Pipe p; -+ version (DMC_RUNTIME) -+ { -+ // This is a re-implementation of DMC's fdopen, but without the -+ // mucking with the file descriptor. POSIX standard requires the -+ // new fdopen'd file to retain the given file descriptor's -+ // position. -+ FILE * local_fdopen(int fd, const(char)* mode) - { -- enforce( -- SetEnvironmentVariableW(toUTF16z(name), toUTF16z(value)), -- sysErrorString(GetLastError()) -- ); -- return value; -+ auto fp = core.stdc.stdio.fopen("NUL", mode); -+ if(!fp) return null; -+ FLOCK(fp); -+ auto iob = cast(_iobuf*)fp; -+ .close(iob._file); -+ iob._file = fd; -+ iob._flag &= ~_IOTRAN; -+ FUNLOCK(fp); -+ return fp; - } - -- else static assert(0); -+ auto readFP = local_fdopen(readFD, "r"); -+ auto writeFP = local_fdopen(writeFD, "a"); - } -+ else // MSVCRT -+ { -+ auto readFP = _fdopen(readFD, "r"); -+ auto writeFP = _fdopen(writeFD, "a"); -+ } -+ if (readFP == null || writeFP == null) -+ { -+ // Close streams, then throw. -+ if (readFP != null) fclose(readFP); -+ else _close(readFD); -+ if (writeFP != null) fclose(writeFP); -+ else _close(writeFD); -+ throw new StdioException("Cannot open pipe"); -+ } -+ p._read = File(readFP, null); -+ p._write = File(writeFP, null); -+ return p; -+} - - -+/// An interface to a pipe created by the $(LREF pipe) function. -+struct Pipe -+{ -+ /// The read end of the pipe. -+ @property File readEnd() @trusted /*TODO: @safe nothrow*/ { return _read; } - -- // Remove an environment variable. The function succeeds even -- // if the variable isn't in the environment. -- void remove(string name) -- { -- version(Posix) -- { -- core.sys.posix.stdlib.unsetenv(toStringz(name)); -- } - -- else version(Windows) -- { -- SetEnvironmentVariableW(toUTF16z(name), null); -- } -+ /// The write end of the pipe. -+ @property File writeEnd() @trusted /*TODO: @safe nothrow*/ { return _write; } - -- else static assert(0); -- } - -+ /** -+ Closes both ends of the pipe. - -+ Normally it is not necessary to do this manually, as $(XREF stdio,File) -+ objects are automatically closed when there are no more references -+ to them. - -- // Same as opIndex, except return a default value if -- // the variable doesn't exist. -- string get(string name, string defaultValue = null) -+ Note that if either end of the pipe has been passed to a child process, -+ it will only be closed in the parent process. (What happens in the -+ child process is platform dependent.) -+ */ -+ void close() @trusted //TODO: @safe nothrow - { -- string value; -- auto found = getImpl(name, value); -- return found ? value : defaultValue; -+ _read.close(); -+ _write.close(); - } - -+private: -+ File _read, _write; -+} - -+unittest -+{ -+ auto p = pipe(); -+ p.writeEnd.writeln("Hello World"); -+ p.writeEnd.flush(); -+ assert (p.readEnd.readln().chomp() == "Hello World"); -+ p.close(); -+ assert (!p.readEnd.isOpen); -+ assert (!p.writeEnd.isOpen); -+} - -- // Return all environment variables in an associative array. -- string[string] toAA() -- { -- string[string] aa; - -- version(Posix) -- { -- for (int i=0; environ[i] != null; ++i) -- { -- immutable varDef = to!string(environ[i]); -- immutable eq = varDef.indexOf('='); -- assert (eq >= 0); -+/** -+Starts a new process, creating pipes to redirect its standard -+input, output and/or error streams. - -- immutable name = varDef[0 .. eq]; -- immutable value = varDef[eq+1 .. $]; -+$(D pipeProcess) and $(D pipeShell) are convenient wrappers around -+$(LREF spawnProcess) and $(LREF spawnShell), respectively, and -+automate the task of redirecting one or more of the child process' -+standard streams through pipes. Like the functions they wrap, -+these functions return immediately, leaving the child process to -+execute in parallel with the invoking process. It is recommended -+to always call $(LREF wait) on the returned $(LREF ProcessPipes.pid), -+as detailed in the documentation for $(D wait). -+ -+The $(D args)/$(D program)/$(D command), $(D env) and $(D config) -+parameters are forwarded straight to the underlying spawn functions, -+and we refer to their documentation for details. -+ -+Params: -+args = An array which contains the program name as the zeroth element -+ and any command-line arguments in the following elements. -+ (See $(LREF spawnProcess) for details.) -+program = The program name, $(I without) command-line arguments. -+ (See $(LREF spawnProcess) for details.) -+command = A shell command which is passed verbatim to the command -+ interpreter. (See $(LREF spawnShell) for details.) -+redirect = Flags that determine which streams are redirected, and -+ how. See $(LREF Redirect) for an overview of available -+ flags. -+env = Additional environment variables for the child process. -+ (See $(LREF spawnProcess) for details.) -+config = Flags that control process creation. See $(LREF Config) -+ for an overview of available flags, and note that the -+ $(D retainStd...) flags have no effect in this function. -+ -+Returns: -+A $(LREF ProcessPipes) object which contains $(XREF stdio,File) -+handles that communicate with the redirected streams of the child -+process, along with a $(LREF Pid) object that corresponds to the -+spawned process. -+ -+Throws: -+$(LREF ProcessException) on failure to start the process.$(BR) -+$(XREF stdio,StdioException) on failure to redirect any of the streams.$(BR) - -- // In POSIX, environment variables may be defined more -- // than once. This is a security issue, which we avoid -- // by checking whether the key already exists in the array. -- // For more info: -- // http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/environment-variables.html -- if (name !in aa) aa[name] = value; -- } -- } -+Example: -+--- -+auto pipes = pipeProcess("my_application", Redirect.stdout | Redirect.stderr); -+scope(exit) wait(pipes.pid); - -- else version(Windows) -- { -- auto envBlock = GetEnvironmentStringsW(); -- enforce (envBlock, "Failed to retrieve environment variables."); -- scope(exit) FreeEnvironmentStringsW(envBlock); -+// Store lines of output. -+string[] output; -+foreach (line; pipes.stdout.byLine) output ~= line.idup; -+ -+// Store lines of errors. -+string[] errors; -+foreach (line; pipes.stderr.byLine) errors ~= line.idup; -+--- -+*/ -+ProcessPipes pipeProcess(in char[][] args, -+ Redirect redirect = Redirect.all, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted //TODO: @safe -+{ -+ return pipeProcessImpl!spawnProcess(args, redirect, env, config); -+} - -- for (int i=0; envBlock[i] != '\0'; ++i) -- { -- auto start = i; -- while (envBlock[i] != '=') -- { -- assert (envBlock[i] != '\0'); -- ++i; -- } -- immutable name = toUTF8(envBlock[start .. i]); -+/// ditto -+ProcessPipes pipeProcess(in char[] program, -+ Redirect redirect = Redirect.all, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted -+{ -+ return pipeProcessImpl!spawnProcess(program, redirect, env, config); -+} - -- start = i+1; -- while (envBlock[i] != '\0') ++i; -- aa[name] = toUTF8(envBlock[start .. i]); -- } -- } -+/// ditto -+ProcessPipes pipeShell(in char[] command, -+ Redirect redirect = Redirect.all, -+ const string[string] env = null, -+ Config config = Config.none) -+ @safe -+{ -+ return pipeProcessImpl!spawnShell(command, redirect, env, config); -+} - -- else static assert(0); -+// Implementation of the pipeProcess() family of functions. -+private ProcessPipes pipeProcessImpl(alias spawnFunc, Cmd) -+ (Cmd command, -+ Redirect redirectFlags, -+ const string[string] env = null, -+ Config config = Config.none) -+ @trusted //TODO: @safe -+{ -+ File childStdin, childStdout, childStderr; -+ ProcessPipes pipes; -+ pipes._redirectFlags = redirectFlags; - -- return aa; -+ if (redirectFlags & Redirect.stdin) -+ { -+ auto p = pipe(); -+ childStdin = p.readEnd; -+ pipes._stdin = p.writeEnd; -+ } -+ else -+ { -+ childStdin = std.stdio.stdin; -+ } -+ -+ if (redirectFlags & Redirect.stdout) -+ { -+ if ((redirectFlags & Redirect.stdoutToStderr) != 0) -+ throw new StdioException("Cannot create pipe for stdout AND " -+ ~"redirect it to stderr", 0); -+ auto p = pipe(); -+ childStdout = p.writeEnd; -+ pipes._stdout = p.readEnd; -+ } -+ else -+ { -+ childStdout = std.stdio.stdout; -+ } -+ -+ if (redirectFlags & Redirect.stderr) -+ { -+ if ((redirectFlags & Redirect.stderrToStdout) != 0) -+ throw new StdioException("Cannot create pipe for stderr AND " -+ ~"redirect it to stdout", 0); -+ auto p = pipe(); -+ childStderr = p.writeEnd; -+ pipes._stderr = p.readEnd; -+ } -+ else -+ { -+ childStderr = std.stdio.stderr; -+ } -+ -+ if (redirectFlags & Redirect.stdoutToStderr) -+ { -+ if (redirectFlags & Redirect.stderrToStdout) -+ { -+ // We know that neither of the other options have been -+ // set, so we assign the std.stdio.std* streams directly. -+ childStdout = std.stdio.stderr; -+ childStderr = std.stdio.stdout; -+ } -+ else -+ { -+ childStdout = childStderr; -+ } -+ } -+ else if (redirectFlags & Redirect.stderrToStdout) -+ { -+ childStderr = childStdout; - } - -+ config &= ~(Config.retainStdin | Config.retainStdout | Config.retainStderr); -+ pipes._pid = spawnFunc(command, childStdin, childStdout, childStderr, -+ env, config); -+ return pipes; - } - - --unittest -+/** -+Flags that can be passed to $(LREF pipeProcess) and $(LREF pipeShell) -+to specify which of the child process' standard streams are redirected. -+Use bitwise OR to combine flags. -+*/ -+enum Redirect - { -- // New variable -- environment["std_process"] = "foo"; -- assert (environment["std_process"] == "foo"); -+ /// Redirect the standard input, output or error streams, respectively. -+ stdin = 1, -+ stdout = 2, /// ditto -+ stderr = 4, /// ditto -+ -+ /** -+ Redirect _all three streams. This is equivalent to -+ $(D Redirect.stdin | Redirect.stdout | Redirect.stderr). -+ */ -+ all = stdin | stdout | stderr, -+ -+ /** -+ Redirect the standard error stream into the standard output stream. -+ This can not be combined with $(D Redirect.stderr). -+ */ -+ stderrToStdout = 8, -+ -+ /** -+ Redirect the standard output stream into the standard error stream. -+ This can not be combined with $(D Redirect.stdout). -+ */ -+ stdoutToStderr = 16, -+} - -- // Set variable again -- environment["std_process"] = "bar"; -- assert (environment["std_process"] == "bar"); -+unittest -+{ -+ version (Windows) TestScript prog = -+ "call :sub %~1 %~2 0 -+ call :sub %~1 %~2 1 -+ call :sub %~1 %~2 2 -+ call :sub %~1 %~2 3 -+ exit 3 -+ -+ :sub -+ set /p INPUT= -+ if -%INPUT%-==-stop- ( exit %~3 ) -+ echo %INPUT% %~1 -+ echo %INPUT% %~2 1>&2"; -+ else version (Posix) TestScript prog = -+ `for EXITCODE in 0 1 2 3; do -+ read INPUT -+ if test "$INPUT" = stop; then break; fi -+ echo "$INPUT $1" -+ echo "$INPUT $2" >&2 -+ done -+ exit $EXITCODE`; -+ auto pp = pipeProcess([prog.path, "bar", "baz"]); -+ pp.stdin.writeln("foo"); -+ pp.stdin.flush(); -+ assert (pp.stdout.readln().chomp() == "foo bar"); -+ assert (pp.stderr.readln().chomp().stripRight() == "foo baz"); -+ pp.stdin.writeln("1234567890"); -+ pp.stdin.flush(); -+ assert (pp.stdout.readln().chomp() == "1234567890 bar"); -+ assert (pp.stderr.readln().chomp().stripRight() == "1234567890 baz"); -+ pp.stdin.writeln("stop"); -+ pp.stdin.flush(); -+ assert (wait(pp.pid) == 2); -+ -+ pp = pipeProcess([prog.path, "12345", "67890"], -+ Redirect.stdin | Redirect.stdout | Redirect.stderrToStdout); -+ pp.stdin.writeln("xyz"); -+ pp.stdin.flush(); -+ assert (pp.stdout.readln().chomp() == "xyz 12345"); -+ assert (pp.stdout.readln().chomp().stripRight() == "xyz 67890"); -+ pp.stdin.writeln("stop"); -+ pp.stdin.flush(); -+ assert (wait(pp.pid) == 1); -+ -+ pp = pipeShell(prog.path~" AAAAA BBB", -+ Redirect.stdin | Redirect.stdoutToStderr | Redirect.stderr); -+ pp.stdin.writeln("ab"); -+ pp.stdin.flush(); -+ assert (pp.stderr.readln().chomp() == "ab AAAAA"); -+ assert (pp.stderr.readln().chomp().stripRight() == "ab BBB"); -+ pp.stdin.writeln("stop"); -+ pp.stdin.flush(); -+ assert (wait(pp.pid) == 1); -+} - -- // Remove variable -- environment.remove("std_process"); -+unittest -+{ -+ TestScript prog = "exit 0"; -+ assertThrown!StdioException(pipeProcess( -+ prog.path, -+ Redirect.stdout | Redirect.stdoutToStderr)); -+ assertThrown!StdioException(pipeProcess( -+ prog.path, -+ Redirect.stderr | Redirect.stderrToStdout)); -+ auto p = pipeProcess(prog.path, Redirect.stdin); -+ assertThrown!Error(p.stdout); -+ assertThrown!Error(p.stderr); -+ wait(p.pid); -+ p = pipeProcess(prog.path, Redirect.stderr); -+ assertThrown!Error(p.stdin); -+ assertThrown!Error(p.stdout); -+ wait(p.pid); -+} - -- // Remove again, should succeed -- environment.remove("std_process"); -+/** -+Object which contains $(XREF stdio,File) handles that allow communication -+with a child process through its standard streams. -+*/ -+struct ProcessPipes -+{ -+ /// The $(LREF Pid) of the child process. -+ @property Pid pid() @safe nothrow -+ { -+ assert(_pid !is null); -+ return _pid; -+ } - -- // Throw on not found. -- try { environment["std_process"]; assert(0); } catch(Exception e) { } -+ /** -+ An $(XREF stdio,File) that allows writing to the child process' -+ standard input stream. - -- // get() without default value -- assert (environment.get("std.process") == null); -+ Throws: -+ $(OBJECTREF Error) if the child process' standard input stream hasn't -+ been redirected. -+ */ -+ @property File stdin() @trusted //TODO: @safe nothrow -+ { -+ if ((_redirectFlags & Redirect.stdin) == 0) -+ throw new Error("Child process' standard input stream hasn't " -+ ~"been redirected."); -+ return _stdin; -+ } - -- // get() with default value -- assert (environment.get("std_process", "baz") == "baz"); -+ /** -+ An $(XREF stdio,File) that allows reading from the child process' -+ standard output stream. - -- // Convert to associative array -- auto aa = environment.toAA(); -- assert (aa.length > 0); -- foreach (n, v; aa) -+ Throws: -+ $(OBJECTREF Error) if the child process' standard output stream hasn't -+ been redirected. -+ */ -+ @property File stdout() @trusted //TODO: @safe nothrow - { -- // Wine has some bugs related to environment variables: -- // - Wine allows the existence of an env. variable with the name -- // "\0", but GetEnvironmentVariable refuses to retrieve it. -- // - If an env. variable has zero length, i.e. is "\0", -- // GetEnvironmentVariable should return 1. Instead it returns -- // 0, indicating the variable doesn't exist. -- version(Windows) if (n.length == 0 || v.length == 0) continue; -+ if ((_redirectFlags & Redirect.stdout) == 0) -+ throw new Error("Child process' standard output stream hasn't " -+ ~"been redirected."); -+ return _stdout; -+ } - -- // why does this happen? -- // n = "temp" || "tmp" -- // v = "C:\Users\ADMINI~1\AppData\Local\Temp\2" -- // e[n] = "C:\cygwin\tmp" -- // for n = "TEMP" or "TMP", v and en[v] are both "C:\cygwin\tmp" -- version(Windows) if (n == "temp" || n == "tmp") continue; -+ /** -+ An $(XREF stdio,File) that allows reading from the child process' -+ standard error stream. - -- //printf("%.*s, %.*s, %.*s\n", n.length, n.ptr, v.length, v.ptr, environment[n].length, environment[n].ptr); -- assert (v == environment[n]); -+ Throws: -+ $(OBJECTREF Error) if the child process' standard error stream hasn't -+ been redirected. -+ */ -+ @property File stderr() @trusted //TODO: @safe nothrow -+ { -+ if ((_redirectFlags & Redirect.stderr) == 0) -+ throw new Error("Child process' standard error stream hasn't " -+ ~"been redirected."); -+ return _stderr; - } -+ -+private: -+ Redirect _redirectFlags; -+ Pid _pid; -+ File _stdin, _stdout, _stderr; - } - - --version(StdDdoc) -+ -+/** -+Executes the given program or shell command and returns its exit -+code and output. -+ -+$(D execute) and $(D executeShell) start a new process using -+$(LREF spawnProcess) and $(LREF spawnShell), respectively, and wait -+for the process to complete before returning. The functions capture -+what the child process prints to both its standard output and -+standard error streams, and return this together with its exit code. -+--- -+auto dmd = execute("dmd", "myapp.d"); -+if (dmd.status != 0) writeln("Compilation failed:\n", dmd.output); -+ -+auto ls = executeShell("ls -l"); -+if (ls.status == 0) writeln("Failed to retrieve file listing"); -+else writeln(ls.output); -+--- -+ -+The $(D args)/$(D program)/$(D command), $(D env) and $(D config) -+parameters are forwarded straight to the underlying spawn functions, -+and we refer to their documentation for details. -+ -+Params: -+args = An array which contains the program name as the zeroth element -+ and any command-line arguments in the following elements. -+ (See $(LREF spawnProcess) for details.) -+program = The program name, $(I without) command-line arguments. -+ (See $(LREF spawnProcess) for details.) -+command = A shell command which is passed verbatim to the command -+ interpreter. (See $(LREF spawnShell) for details.) -+env = Additional environment variables for the child process. -+ (See $(LREF spawnProcess) for details.) -+config = Flags that control process creation. See $(LREF Config) -+ for an overview of available flags, and note that the -+ $(D retainStd...) flags have no effect in this function. -+maxOutput = The maximum number of bytes of output that should be -+ captured. -+ -+Returns: -+A $(D struct) which contains the fields $(D int status) and -+$(D string output). (This will most likely change to become a -+$(D std.typecons.Tuple!(int,"status",string,"output")) in the future, -+but a compiler bug currently prevents this.) -+ -+POSIX_specific: -+If the process is terminated by a signal, the $(D status) field of -+the return value will contain a negative number whose absolute -+value is the signal number. (See $(LREF wait) for details.) -+ -+Throws: -+$(LREF ProcessException) on failure to start the process.$(BR) -+$(XREF stdio,StdioException) on failure to capture output. -+*/ -+auto execute(in char[][] args, -+ const string[string] env = null, -+ Config config = Config.none, -+ size_t maxOutput = size_t.max) -+ @trusted //TODO: @safe - { -- /**************************************** -- * Start up the browser and set it to viewing the page at url. -- */ -- void browse(string url); -+ return executeImpl!pipeProcess(args, env, config, maxOutput); - } --else --version (Windows) -+ -+/// ditto -+auto execute(in char[] program, -+ const string[string] env = null, -+ Config config = Config.none, -+ size_t maxOutput = size_t.max) -+ @trusted //TODO: @safe - { -- import core.sys.windows.windows; -+ return executeImpl!pipeProcess(program, env, config, maxOutput); -+} - -- extern (Windows) -- HINSTANCE ShellExecuteA(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd); -+/// ditto -+auto executeShell(in char[] command, -+ const string[string] env = null, -+ Config config = Config.none, -+ size_t maxOutput = size_t.max) -+ @trusted //TODO: @safe -+{ -+ return executeImpl!pipeShell(command, env, config, maxOutput); -+} - -+// Does the actual work for execute() and executeShell(). -+private auto executeImpl(alias pipeFunc, Cmd)( -+ Cmd commandLine, -+ const string[string] env = null, -+ Config config = Config.none, -+ size_t maxOutput = size_t.max) -+{ -+ auto p = pipeFunc(commandLine, Redirect.stdout | Redirect.stderrToStdout, -+ env, config); - -- pragma(lib,"shell32.lib"); -+ auto a = appender!(ubyte[])(); -+ enum size_t defaultChunkSize = 4096; -+ immutable chunkSize = min(maxOutput, defaultChunkSize); - -- void browse(string url) -+ // Store up to maxOutput bytes in a. -+ foreach (ubyte[] chunk; p.stdout.byChunk(chunkSize)) - { -- ShellExecuteA(null, "open", toStringz(url), null, null, SW_SHOWNORMAL); -+ immutable size_t remain = maxOutput - a.data.length; -+ -+ if (chunk.length < remain) a.put(chunk); -+ else -+ { -+ a.put(chunk[0 .. remain]); -+ break; -+ } - } -+ // Exhaust the stream, if necessary. -+ foreach (ubyte[] chunk; p.stdout.byChunk(defaultChunkSize)) { } -+ -+ struct ProcessOutput { int status; string output; } -+ return ProcessOutput(wait(p.pid), cast(string) a.data); - } --else version (OSX) -+ -+unittest - { -- import core.stdc.stdio; -- import core.stdc.string; -- import core.sys.posix.unistd; -+ // To avoid printing the newline characters, we use the echo|set trick on -+ // Windows, and printf on POSIX (neither echo -n nor echo \c are portable). -+ version (Windows) TestScript prog = -+ "echo|set /p=%~1 -+ echo|set /p=%~2 1>&2 -+ exit 123"; -+ else version (Posix) TestScript prog = -+ `printf '%s' $1 -+ printf '%s' $2 >&2 -+ exit 123`; -+ auto r = execute([prog.path, "foo", "bar"]); -+ assert (r.status == 123); -+ assert (r.output.stripRight() == "foobar"); -+ auto s = execute([prog.path, "Hello", "World"]); -+ assert (s.status == 123); -+ assert (s.output.stripRight() == "HelloWorld"); -+} - -- void browse(string url) -+unittest -+{ -+ auto r1 = executeShell("echo foo"); -+ assert (r1.status == 0); -+ assert (r1.output.chomp() == "foo"); -+ auto r2 = executeShell("echo bar 1>&2"); -+ assert (r2.status == 0); -+ assert (r2.output.chomp().stripRight() == "bar"); -+ auto r3 = executeShell("exit 123"); -+ assert (r3.status == 123); -+ assert (r3.output.empty); -+} -+ -+ -+/// An exception that signals a problem with starting or waiting for a process. -+class ProcessException : Exception -+{ -+ // Standard constructor. -+ this(string msg, string file = __FILE__, size_t line = __LINE__) - { -- const(char)*[5] args; -+ super(msg, file, line); -+ } - -- const(char)* browser = core.stdc.stdlib.getenv("BROWSER"); -- if (browser) -- { browser = strdup(browser); -- args[0] = browser; -- args[1] = toStringz(url); -- args[2] = null; -+ // Creates a new ProcessException based on errno. -+ static ProcessException newFromErrno(string customMsg = null, -+ string file = __FILE__, -+ size_t line = __LINE__) -+ { -+ import core.stdc.errno; -+ import std.c.string; -+ version (linux) -+ { -+ char[1024] buf; -+ auto errnoMsg = to!string( -+ std.c.string.strerror_r(errno, buf.ptr, buf.length)); - } - else - { -- args[0] = "open".ptr; -- args[1] = toStringz(url); -- args[2] = null; -+ auto errnoMsg = to!string(std.c.string.strerror(errno)); - } -+ auto msg = customMsg.empty ? errnoMsg -+ : customMsg ~ " (" ~ errnoMsg ~ ')'; -+ return new ProcessException(msg, file, line); -+ } - -- auto childpid = fork(); -- if (childpid == 0) -- { -- core.sys.posix.unistd.execvp(args[0], cast(char**)args.ptr); -- perror(args[0]); // failed to execute -- return; -- } -- if (browser) -- free(cast(void*)browser); -+ // Creates a new ProcessException based on GetLastError() (Windows only). -+ version (Windows) -+ static ProcessException newFromLastError(string customMsg = null, -+ string file = __FILE__, -+ size_t line = __LINE__) -+ { -+ auto lastMsg = sysErrorString(GetLastError()); -+ auto msg = customMsg.empty ? lastMsg -+ : customMsg ~ " (" ~ lastMsg ~ ')'; -+ return new ProcessException(msg, file, line); - } - } --else version (Posix) -+ -+ -+/** -+Determines the path to the current user's default command interpreter. -+ -+On Windows, this function returns the contents of the COMSPEC environment -+variable, if it exists. Otherwise, it returns the string $(D "cmd.exe"). -+ -+On POSIX, $(D userShell) returns the contents of the SHELL environment -+variable, if it exists and is non-empty. Otherwise, it returns -+$(D "/bin/sh"). -+*/ -+@property string userShell() @safe //TODO: nothrow - { -- import core.stdc.stdio; -- import core.stdc.string; -- import core.sys.posix.unistd; -+ version (Windows) return environment.get("COMSPEC", "cmd.exe"); -+ else version (Posix) return environment.get("SHELL", "/bin/sh"); -+} - -- void browse(string url) -- { -- const(char)*[3] args; - -- const(char)* browser = core.stdc.stdlib.getenv("BROWSER"); -- if (browser) -- { browser = strdup(browser); -- args[0] = browser; -- } -- else -- //args[0] = "x-www-browser".ptr; // doesn't work on some systems -- args[0] = "xdg-open".ptr; -+// A command-line switch that indicates to the shell that it should -+// interpret the following argument as a command to be executed. -+version (Posix) private immutable string shellSwitch = "-c"; -+version (Windows) private immutable string shellSwitch = "/C"; - -- args[1] = toStringz(url); -- args[2] = null; - -- auto childpid = fork(); -- if (childpid == 0) -+/// Returns the process ID number of the current process. -+@property int thisProcessID() @trusted //TODO: @safe nothrow -+{ -+ version (Windows) return GetCurrentProcessId(); -+ else version (Posix) return getpid(); -+} -+ -+ -+// Unittest support code: TestScript takes a string that contains a -+// shell script for the current platform, and writes it to a temporary -+// file. On Windows the file name gets a .cmd extension, while on -+// POSIX its executable permission bit is set. The file is -+// automatically deleted when the object goes out of scope. -+version (unittest) -+private struct TestScript -+{ -+ this(string code) -+ { -+ import std.ascii, std.file; -+ version (Windows) - { -- core.sys.posix.unistd.execvp(args[0], cast(char**)args.ptr); -- perror(args[0]); // failed to execute -- return; -+ auto ext = ".cmd"; -+ auto firstLine = "@echo off"; -+ } -+ else version (Posix) -+ { -+ auto ext = ""; -+ auto firstLine = "#!/bin/sh"; -+ } -+ path = uniqueTempPath()~ext; -+ std.file.write(path, firstLine~std.ascii.newline~code~std.ascii.newline); -+ version (Posix) -+ { -+ import core.sys.posix.sys.stat; -+ chmod(toStringz(path), octal!777); -+ } -+ } -+ -+ ~this() -+ { -+ import std.file; -+ if (!path.empty && exists(path)) -+ { -+ try { remove(path); } -+ catch (Exception e) -+ { -+ debug std.stdio.stderr.writeln(e.msg); -+ } - } -- if (browser) -- free(cast(void*)browser); - } -+ -+ string path; - } --else -- static assert(0, "os not supported"); - -+version (unittest) -+private string uniqueTempPath() -+{ -+ import std.file, std.uuid; -+ return buildPath(tempDir(), randomUUID().toString()); -+} -+ -+ -+// ============================================================================= -+// Functions for shell command quoting/escaping. -+// ============================================================================= - --/* ////////////////////////////////////////////////////////////////////////// */ - - /* - Command line arguments exist in three forms: -@@ -857,17 +2166,160 @@ else - format (2) is hidden away from the user in this module. - */ - --pure @safe nothrow --private char[] charAllocator(size_t size) { return new char[size]; } -- - /** -- Quote an argument in a manner conforming to the behavior of -- $(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx, -- CommandLineToArgvW). -+Escapes an argv-style argument array to be used with $(LREF spawnShell), -+$(LREF pipeShell) or $(LREF executeShell). -+--- -+string url = "http://dlang.org/"; -+executeShell(escapeShellCommand("wget", url, "-O", "dlang-index.html")); -+--- -+ -+Concatenate multiple $(D escapeShellCommand) and -+$(LREF escapeShellFileName) results to use shell redirection or -+piping operators. -+--- -+executeShell( -+ escapeShellCommand("curl", "http://dlang.org/download.html") ~ -+ "|" ~ -+ escapeShellCommand("grep", "-o", `http://\S*\.zip`) ~ -+ ">" ~ -+ escapeShellFileName("D download links.txt")); -+--- -+ -+Throws: -+$(OBJECTREF Exception) if any part of the command line contains unescapable -+characters (NUL on all platforms, as well as CR and LF on Windows). - */ -+string escapeShellCommand(in char[][] args...) -+ //TODO: @safe pure nothrow -+{ -+ return escapeShellCommandString(escapeShellArguments(args)); -+} -+ -+unittest -+{ -+ // This is a simple unit test without any special requirements, -+ // in addition to the unittest_burnin one below which requires -+ // special preparation. -+ -+ struct TestVector { string[] args; string windows, posix; } -+ TestVector[] tests = -+ [ -+ { -+ args : ["foo"], -+ windows : `^"foo^"`, -+ posix : `'foo'` -+ }, -+ { -+ args : ["foo", "hello"], -+ windows : `^"foo^" ^"hello^"`, -+ posix : `'foo' 'hello'` -+ }, -+ { -+ args : ["foo", "hello world"], -+ windows : `^"foo^" ^"hello world^"`, -+ posix : `'foo' 'hello world'` -+ }, -+ { -+ args : ["foo", "hello", "world"], -+ windows : `^"foo^" ^"hello^" ^"world^"`, -+ posix : `'foo' 'hello' 'world'` -+ }, -+ { -+ args : ["foo", `'"^\`], -+ windows : `^"foo^" ^"'\^"^^\\^"`, -+ posix : `'foo' ''\''"^\'` -+ }, -+ ]; -+ -+ foreach (test; tests) -+ version (Windows) -+ assert(escapeShellCommand(test.args) == test.windows); -+ else -+ assert(escapeShellCommand(test.args) == test.posix ); -+} -+ -+private string escapeShellCommandString(string command) -+ //TODO: @safe pure nothrow -+{ -+ version (Windows) -+ return escapeWindowsShellCommand(command); -+ else -+ return command; -+} -+ -+private string escapeWindowsShellCommand(in char[] command) -+ //TODO: @safe pure nothrow (prevented by Appender) -+{ -+ auto result = appender!string(); -+ result.reserve(command.length); -+ -+ foreach (c; command) -+ switch (c) -+ { -+ case '\0': -+ throw new Exception("Cannot put NUL in command line"); -+ case '\r': -+ case '\n': -+ throw new Exception("CR/LF are not escapable"); -+ case '\x01': .. case '\x09': -+ case '\x0B': .. case '\x0C': -+ case '\x0E': .. case '\x1F': -+ case '"': -+ case '^': -+ case '&': -+ case '<': -+ case '>': -+ case '|': -+ result.put('^'); -+ goto default; -+ default: -+ result.put(c); -+ } -+ return result.data; -+} -+ -+private string escapeShellArguments(in char[][] args...) -+ @trusted pure nothrow -+{ -+ char[] buf; -+ -+ @safe nothrow -+ char[] allocator(size_t size) -+ { -+ if (buf.length == 0) -+ return buf = new char[size]; -+ else -+ { -+ auto p = buf.length; -+ buf.length = buf.length + 1 + size; -+ buf[p++] = ' '; -+ return buf[p..p+size]; -+ } -+ } -+ -+ foreach (arg; args) -+ escapeShellArgument!allocator(arg); -+ return assumeUnique(buf); -+} -+ -+private auto escapeShellArgument(alias allocator)(in char[] arg) @safe nothrow -+{ -+ // The unittest for this function requires special -+ // preparation - see below. -+ -+ version (Windows) -+ return escapeWindowsArgumentImpl!allocator(arg); -+ else -+ return escapePosixArgumentImpl!allocator(arg); -+} - --pure nothrow --string escapeWindowsArgument(in char[] arg) -+/** -+Quotes a command-line argument in a manner conforming to the behavior of -+$(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx, -+CommandLineToArgvW). -+*/ -+string escapeWindowsArgument(in char[] arg) @trusted pure nothrow - { - // Rationale for leaving this function as public: - // this algorithm of escaping paths is also used in other software, -@@ -877,8 +2329,15 @@ string escapeWindowsArgument(in char[] a - return assumeUnique(buf); - } - --@safe nothrow -+ -+private char[] charAllocator(size_t size) @safe pure nothrow -+{ -+ return new char[size]; -+} -+ -+ - private char[] escapeWindowsArgumentImpl(alias allocator)(in char[] arg) -+ @safe nothrow - if (is(typeof(allocator(size_t.init)[0] = char.init))) - { - // References: -@@ -974,15 +2433,14 @@ version(Windows) version(unittest) - } - } - --pure nothrow --private string escapePosixArgument(in char[] arg) -+private string escapePosixArgument(in char[] arg) @trusted pure nothrow - { - auto buf = escapePosixArgumentImpl!charAllocator(arg); - return assumeUnique(buf); - } - --@safe nothrow - private char[] escapePosixArgumentImpl(alias allocator)(in char[] arg) -+ @safe nothrow - if (is(typeof(allocator(size_t.init)[0] = char.init))) - { - // '\'' means: close quoted part of argument, append an escaped -@@ -1013,169 +2471,63 @@ private char[] escapePosixArgumentImpl(a - return buf; - } - --@safe nothrow --private auto escapeShellArgument(alias allocator)(in char[] arg) -+/** -+Escapes a filename to be used for shell redirection with $(LREF spawnShell), -+$(LREF pipeShell) or $(LREF executeShell). -+*/ -+string escapeShellFileName(in char[] fileName) @trusted pure nothrow - { - // The unittest for this function requires special - // preparation - see below. - - version (Windows) -- return escapeWindowsArgumentImpl!allocator(arg); -+ return cast(string)('"' ~ fileName ~ '"'); - else -- return escapePosixArgumentImpl!allocator(arg); -+ return escapePosixArgument(fileName); - } - --pure nothrow --private string escapeShellArguments(in char[][] args) -+// Loop generating strings with random characters -+//version = unittest_burnin; -+ -+version(unittest_burnin) -+unittest - { -- char[] buf; -+ // There are no readily-available commands on all platforms suitable -+ // for properly testing command escaping. The behavior of CMD's "echo" -+ // built-in differs from the POSIX program, and Windows ports of POSIX -+ // environments (Cygwin, msys, gnuwin32) may interfere with their own -+ // "echo" ports. - -- @safe nothrow -- char[] allocator(size_t size) -+ // To run this unit test, create std_process_unittest_helper.d with the -+ // following content and compile it: -+ // import std.stdio, std.array; void main(string[] args) { write(args.join("\0")); } -+ // Then, test this module with: -+ // rdmd --main -unittest -version=unittest_burnin process.d -+ -+ auto helper = absolutePath("std_process_unittest_helper"); -+ assert(shell(helper ~ " hello").split("\0")[1..$] == ["hello"], "Helper malfunction"); -+ -+ void test(string[] s, string fn) - { -- if (buf.length == 0) -- return buf = new char[size]; -- else -+ string e; -+ string[] g; -+ -+ e = escapeShellCommand(helper ~ s); - { -- auto p = buf.length; -- buf.length = buf.length + 1 + size; -- buf[p++] = ' '; -- return buf[p..p+size]; -+ scope(failure) writefln("shell() failed.\nExpected:\t%s\nEncoded:\t%s", s, [e]); -+ g = shell(e).split("\0")[1..$]; - } -- } -- -- foreach (arg; args) -- escapeShellArgument!allocator(arg); -- return assumeUnique(buf); --} -- --string escapeWindowsShellCommand(in char[] command) --{ -- auto result = appender!string(); -- result.reserve(command.length); -+ assert(s == g, format("shell() test failed.\nExpected:\t%s\nGot:\t\t%s\nEncoded:\t%s", s, g, [e])); - -- foreach (c; command) -- switch (c) -+ e = escapeShellCommand(helper ~ s) ~ ">" ~ escapeShellFileName(fn); - { -- case '\0': -- assert(0, "Cannot put NUL in command line"); -- case '\r': -- case '\n': -- assert(0, "CR/LF are not escapable"); -- case '\x01': .. case '\x09': -- case '\x0B': .. case '\x0C': -- case '\x0E': .. case '\x1F': -- case '"': -- case '^': -- case '&': -- case '<': -- case '>': -- case '|': -- result.put('^'); -- goto default; -- default: -- result.put(c); -+ scope(failure) writefln("system() failed.\nExpected:\t%s\nFilename:\t%s\nEncoded:\t%s", s, [fn], [e]); -+ system(e); -+ g = readText(fn).split("\0")[1..$]; - } -- return result.data; --} -- --private string escapeShellCommandString(string command) --{ -- version (Windows) -- return escapeWindowsShellCommand(command); -- else -- return command; --} -- --/** -- Escape an argv-style argument array to be used with the -- $(D system) or $(D shell) functions. -- -- Example: ----- --string url = "http://dlang.org/"; --system(escapeShellCommand("wget", url, "-O", "dlang-index.html")); ----- -- -- Concatenate multiple $(D escapeShellCommand) and -- $(D escapeShellFileName) results to use shell redirection or -- piping operators. -- -- Example: ----- --system( -- escapeShellCommand("curl", "http://dlang.org/download.html") ~ -- "|" ~ -- escapeShellCommand("grep", "-o", `http://\S*\.zip`) ~ -- ">" ~ -- escapeShellFileName("D download links.txt")); ----- --*/ -- --string escapeShellCommand(in char[][] args...) --{ -- return escapeShellCommandString(escapeShellArguments(args)); --} -- --/** -- Escape a filename to be used for shell redirection with -- the $(D system) or $(D shell) functions. --*/ -- --pure nothrow --string escapeShellFileName(in char[] fn) --{ -- // The unittest for this function requires special -- // preparation - see below. -- -- version (Windows) -- return cast(string)('"' ~ fn ~ '"'); -- else -- return escapePosixArgument(fn); --} -- --// Loop generating strings with random characters --//version = unittest_burnin; -- --version(unittest_burnin) --unittest --{ -- // There are no readily-available commands on all platforms suitable -- // for properly testing command escaping. The behavior of CMD's "echo" -- // built-in differs from the POSIX program, and Windows ports of POSIX -- // environments (Cygwin, msys, gnuwin32) may interfere with their own -- // "echo" ports. -- -- // To run this unit test, create std_process_unittest_helper.d with the -- // following content and compile it: -- // import std.stdio, std.array; void main(string[] args) { write(args.join("\0")); } -- // Then, test this module with: -- // rdmd --main -unittest -version=unittest_burnin process.d -- -- auto helper = absolutePath("std_process_unittest_helper"); -- assert(shell(helper ~ " hello").split("\0")[1..$] == ["hello"], "Helper malfunction"); -- -- void test(string[] s, string fn) -- { -- string e; -- string[] g; -- -- e = escapeShellCommand(helper ~ s); -- { -- scope(failure) writefln("shell() failed.\nExpected:\t%s\nEncoded:\t%s", s, [e]); -- g = shell(e).split("\0")[1..$]; -- } -- assert(s == g, format("shell() test failed.\nExpected:\t%s\nGot:\t\t%s\nEncoded:\t%s", s, g, [e])); -- -- e = escapeShellCommand(helper ~ s) ~ ">" ~ escapeShellFileName(fn); -- { -- scope(failure) writefln("system() failed.\nExpected:\t%s\nFilename:\t%s\nEncoded:\t%s", s, [fn], [e]); -- system(e); -- g = readText(fn).split("\0")[1..$]; -- } -- remove(fn); -- assert(s == g, format("system() test failed.\nExpected:\t%s\nGot:\t\t%s\nEncoded:\t%s", s, g, [e])); -- } -+ remove(fn); -+ assert(s == g, format("system() test failed.\nExpected:\t%s\nGot:\t\t%s\nEncoded:\t%s", s, g, [e])); -+ } - - while (true) - { -@@ -1237,3 +2589,848 @@ unittest - test(args, fn); - } - } -+ -+ -+// ============================================================================= -+// Environment variable manipulation. -+// ============================================================================= -+ -+ -+/** -+Manipulates _environment variables using an associative-array-like -+interface. -+ -+This class contains only static methods, and cannot be instantiated. -+See below for examples of use. -+*/ -+abstract final class environment -+{ -+static: -+ /** -+ Retrieves the value of the environment variable with the given $(D name). -+ --- -+ auto path = environment["PATH"]; -+ --- -+ -+ Throws: -+ $(OBJECTREF Exception) if the environment variable does not exist. -+ -+ See_also: -+ $(LREF environment.get), which doesn't throw on failure. -+ */ -+ string opIndex(in char[] name) @safe -+ { -+ string value; -+ enforce(getImpl(name, value), "Environment variable not found: "~name); -+ return value; -+ } -+ -+ /** -+ Retrieves the value of the environment variable with the given $(D name), -+ or a default value if the variable doesn't exist. -+ -+ Unlike $(LREF environment.opIndex), this function never throws. -+ --- -+ auto sh = environment.get("SHELL", "/bin/sh"); -+ --- -+ This function is also useful in checking for the existence of an -+ environment variable. -+ --- -+ auto myVar = environment.get("MYVAR"); -+ if (myVar is null) -+ { -+ // Environment variable doesn't exist. -+ // Note that we have to use 'is' for the comparison, since -+ // myVar == null is also true if the variable exists but is -+ // empty. -+ } -+ --- -+ */ -+ string get(in char[] name, string defaultValue = null) @safe //TODO: nothrow -+ { -+ string value; -+ auto found = getImpl(name, value); -+ return found ? value : defaultValue; -+ } -+ -+ /** -+ Assigns the given $(D value) to the environment variable with the given -+ $(D name). -+ -+ If the variable does not exist, it will be created. If it already exists, -+ it will be overwritten. -+ --- -+ environment["foo"] = "bar"; -+ --- -+ -+ Throws: -+ $(OBJECTREF Exception) if the environment variable could not be added -+ (e.g. if the name is invalid). -+ */ -+ inout(char)[] opIndexAssign(inout char[] value, in char[] name) @trusted -+ { -+ version (Posix) -+ { -+ if (core.sys.posix.stdlib.setenv(toStringz(name), toStringz(value), 1) != -1) -+ { -+ return value; -+ } -+ // The default errno error message is very uninformative -+ // in the most common case, so we handle it manually. -+ enforce(errno != EINVAL, -+ "Invalid environment variable name: '"~name~"'"); -+ errnoEnforce(false, -+ "Failed to add environment variable"); -+ assert(0); -+ } -+ else version (Windows) -+ { -+ enforce( -+ SetEnvironmentVariableW(toUTF16z(name), toUTF16z(value)), -+ sysErrorString(GetLastError()) -+ ); -+ return value; -+ } -+ else static assert(0); -+ } -+ -+ /** -+ Removes the environment variable with the given $(D name). -+ -+ If the variable isn't in the environment, this function returns -+ successfully without doing anything. -+ */ -+ void remove(in char[] name) @trusted // TODO: @safe nothrow -+ { -+ version (Windows) SetEnvironmentVariableW(toUTF16z(name), null); -+ else version (Posix) core.sys.posix.stdlib.unsetenv(toStringz(name)); -+ else static assert(0); -+ } -+ -+ /** -+ Copies all environment variables into an associative array. -+ -+ Windows_specific: -+ While Windows environment variable names are case insensitive, D's -+ built-in associative arrays are not. This function will store all -+ variable names in uppercase (e.g. $(D PATH)). -+ -+ Throws: -+ $(OBJECTREF Exception) if the environment variables could not -+ be retrieved (Windows only). -+ */ -+ string[string] toAA() @trusted -+ { -+ string[string] aa; -+ version (Posix) -+ { -+ for (int i=0; environ[i] != null; ++i) -+ { -+ immutable varDef = to!string(environ[i]); -+ immutable eq = std.string.indexOf(varDef, '='); -+ assert (eq >= 0); -+ -+ immutable name = varDef[0 .. eq]; -+ immutable value = varDef[eq+1 .. $]; -+ -+ // In POSIX, environment variables may be defined more -+ // than once. This is a security issue, which we avoid -+ // by checking whether the key already exists in the array. -+ // For more info: -+ // http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/environment-variables.html -+ if (name !in aa) aa[name] = value; -+ } -+ } -+ else version (Windows) -+ { -+ auto envBlock = GetEnvironmentStringsW(); -+ enforce(envBlock, "Failed to retrieve environment variables."); -+ scope(exit) FreeEnvironmentStringsW(envBlock); -+ -+ for (int i=0; envBlock[i] != '\0'; ++i) -+ { -+ auto start = i; -+ while (envBlock[i] != '=') ++i; -+ immutable name = toUTF8(toUpper(envBlock[start .. i])); -+ -+ start = i+1; -+ while (envBlock[i] != '\0') ++i; -+ // Just like in POSIX systems, environment variables may be -+ // defined more than once in an environment block on Windows, -+ // and it is just as much of a security issue there. Moreso, -+ // in fact, due to the case insensensitivity of variable names, -+ // which is not handled correctly by all programs. -+ if (name !in aa) aa[name] = toUTF8(envBlock[start .. i]); -+ } -+ } -+ else static assert(0); -+ return aa; -+ } -+ -+private: -+ // Returns the length of an environment variable (in number of -+ // wchars, including the null terminator), or 0 if it doesn't exist. -+ version (Windows) -+ int varLength(LPCWSTR namez) @trusted nothrow -+ { -+ return GetEnvironmentVariableW(namez, null, 0); -+ } -+ -+ // Retrieves the environment variable, returns false on failure. -+ bool getImpl(in char[] name, out string value) @trusted //TODO: nothrow -+ { -+ version (Windows) -+ { -+ const namez = toUTF16z(name); -+ immutable len = varLength(namez); -+ if (len == 0) return false; -+ if (len == 1) -+ { -+ value = ""; -+ return true; -+ } -+ -+ auto buf = new WCHAR[len]; -+ GetEnvironmentVariableW(namez, buf.ptr, to!DWORD(buf.length)); -+ value = toUTF8(buf[0 .. $-1]); -+ return true; -+ } -+ else version (Posix) -+ { -+ const vz = core.sys.posix.stdlib.getenv(toStringz(name)); -+ if (vz == null) return false; -+ auto v = vz[0 .. strlen(vz)]; -+ -+ // Cache the last call's result. -+ static string lastResult; -+ if (v != lastResult) lastResult = v.idup; -+ value = lastResult; -+ return true; -+ } -+ else static assert(0); -+ } -+} -+ -+unittest -+{ -+ // New variable -+ environment["std_process"] = "foo"; -+ assert (environment["std_process"] == "foo"); -+ -+ // Set variable again -+ environment["std_process"] = "bar"; -+ assert (environment["std_process"] == "bar"); -+ -+ // Remove variable -+ environment.remove("std_process"); -+ -+ // Remove again, should succeed -+ environment.remove("std_process"); -+ -+ // Throw on not found. -+ assertThrown(environment["std_process"]); -+ -+ // get() without default value -+ assert (environment.get("std_process") == null); -+ -+ // get() with default value -+ assert (environment.get("std_process", "baz") == "baz"); -+ -+ // Convert to associative array -+ auto aa = environment.toAA(); -+ assert (aa.length > 0); -+ foreach (n, v; aa) -+ { -+ // Wine has some bugs related to environment variables: -+ // - Wine allows the existence of an env. variable with the name -+ // "\0", but GetEnvironmentVariable refuses to retrieve it. -+ // - If an env. variable has zero length, i.e. is "\0", -+ // GetEnvironmentVariable should return 1. Instead it returns -+ // 0, indicating the variable doesn't exist. -+ version (Windows) if (n.length == 0 || v.length == 0) continue; -+ -+ assert (v == environment[n]); -+ } -+} -+ -+ -+ -+ -+// ============================================================================= -+// Everything below this line was part of the old std.process, and most of -+// it will be deprecated and removed. -+// ============================================================================= -+ -+ -+/* -+Macros: -+ -+WIKI=Phobos/StdProcess -+ -+Copyright: Copyright Digital Mars 2007 - 2009. -+License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+Authors: $(WEB digitalmars.com, Walter Bright), -+ $(WEB erdani.org, Andrei Alexandrescu), -+ $(WEB thecybershadow.net, Vladimir Panteleev) -+Source: $(PHOBOSSRC std/_process.d) -+*/ -+/* -+ Copyright Digital Mars 2007 - 2009. -+Distributed under the Boost Software License, Version 1.0. -+ (See accompanying file LICENSE_1_0.txt or copy at -+ http://www.boost.org/LICENSE_1_0.txt) -+*/ -+ -+ -+import core.stdc.stdlib; -+import std.c.stdlib; -+import core.stdc.errno; -+import core.thread; -+import std.c.process; -+import std.c.string; -+ -+version (Windows) -+{ -+ import std.format, std.random, std.file; -+} -+version (Posix) -+{ -+ import core.sys.posix.stdlib; -+} -+version (unittest) -+{ -+ import std.file, std.conv, std.random; -+} -+ -+ -+ -+/** -+ Execute $(D command) in a _command shell. -+ -+ $(RED This function is scheduled for deprecation. Please use -+ $(LREF spawnShell) or $(LREF executeShell) instead.) -+ -+ Returns: If $(D command) is null, returns nonzero if the _command -+ interpreter is found, and zero otherwise. If $(D command) is not -+ null, returns -1 on error, or the exit status of command (which may -+ in turn signal an error in command's execution). -+ -+ Note: On Unix systems, the homonym C function (which is accessible -+ to D programs as $(LINK2 std_c_process.html, std.c._system)) -+ returns a code in the same format as $(LUCKY waitpid, waitpid), -+ meaning that C programs must use the $(D WEXITSTATUS) macro to -+ extract the actual exit code from the $(D system) call. D's $(D -+ system) automatically extracts the exit status. -+ -+*/ -+ -+int system(string command) -+{ -+ if (!command) return std.c.process.system(null); -+ const commandz = toStringz(command); -+ immutable status = std.c.process.system(commandz); -+ if (status == -1) return status; -+ version (Posix) -+ { -+ if (exited(status)) -+ return exitstatus(status); -+ -+ // Abnormal termination, return -1. -+ return -1; -+ } -+ else version (Windows) -+ return status; -+ else -+ static assert(0, "system not implemented for this OS."); -+} -+ -+private void toAStringz(in string[] a, const(char)**az) -+{ -+ foreach(string s; a) -+ { -+ *az++ = toStringz(s); -+ } -+ *az = null; -+} -+ -+ -+/* ========================================================== */ -+ -+//version (Windows) -+//{ -+// int spawnvp(int mode, string pathname, string[] argv) -+// { -+// char** argv_ = cast(char**)alloca((char*).sizeof * (1 + argv.length)); -+// -+// toAStringz(argv, argv_); -+// -+// return std.c.process.spawnvp(mode, toStringz(pathname), argv_); -+// } -+//} -+ -+// Incorporating idea (for spawnvp() on Posix) from Dave Fladebo -+ -+alias std.c.process._P_WAIT P_WAIT; -+alias std.c.process._P_NOWAIT P_NOWAIT; -+ -+int spawnvp(int mode, string pathname, string[] argv) -+{ -+ auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ -+ toAStringz(argv, argv_); -+ -+ version (Posix) -+ { -+ return _spawnvp(mode, toStringz(pathname), argv_); -+ } -+ else version (Windows) -+ { -+ return std.c.process.spawnvp(mode, toStringz(pathname), argv_); -+ } -+ else -+ static assert(0, "spawnvp not implemented for this OS."); -+} -+ -+version (Posix) -+{ -+private import core.sys.posix.unistd; -+private import core.sys.posix.sys.wait; -+int _spawnvp(int mode, in char *pathname, in char **argv) -+{ -+ int retval = 0; -+ pid_t pid = fork(); -+ -+ if(!pid) -+ { // child -+ std.c.process.execvp(pathname, argv); -+ goto Lerror; -+ } -+ else if(pid > 0) -+ { // parent -+ if(mode == _P_NOWAIT) -+ { -+ retval = pid; // caller waits -+ } -+ else -+ { -+ while(1) -+ { -+ int status; -+ pid_t wpid = waitpid(pid, &status, 0); -+ if(exited(status)) -+ { -+ retval = exitstatus(status); -+ break; -+ } -+ else if(signaled(status)) -+ { -+ retval = -termsig(status); -+ break; -+ } -+ else if(stopped(status)) // ptrace support -+ continue; -+ else -+ goto Lerror; -+ } -+ } -+ -+ return retval; -+ } -+ -+Lerror: -+ retval = errno; -+ char[80] buf = void; -+ throw new Exception( -+ "Cannot spawn " ~ to!string(pathname) ~ "; " -+ ~ to!string(strerror_r(retval, buf.ptr, buf.length)) -+ ~ " [errno " ~ to!string(retval) ~ "]"); -+} // _spawnvp -+private -+{ -+ alias WIFSTOPPED stopped; -+ alias WIFSIGNALED signaled; -+ alias WTERMSIG termsig; -+ alias WIFEXITED exited; -+ alias WEXITSTATUS exitstatus; -+} // private -+} // version (Posix) -+ -+/* ========================================================== */ -+ -+/** -+ * Replace the current process by executing a command, $(D pathname), with -+ * the arguments in $(D argv). -+ * -+ * $(RED These functions are scheduled for deprecation. Please use -+ * $(LREF spawnShell) instead (or, alternatively, the homonymous C -+ * functions declared in $(D std.c.process).)) -+ * -+ * Typically, the first element of $(D argv) is -+ * the command being executed, i.e. $(D argv[0] == pathname). The 'p' -+ * versions of $(D exec) search the PATH environment variable for $(D -+ * pathname). The 'e' versions additionally take the new process' -+ * environment variables as an array of strings of the form key=value. -+ * -+ * Does not return on success (the current process will have been -+ * replaced). Returns -1 on failure with no indication of the -+ * underlying error. -+ */ -+ -+int execv(in string pathname, in string[] argv) -+{ -+ auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ -+ toAStringz(argv, argv_); -+ -+ return std.c.process.execv(toStringz(pathname), argv_); -+} -+ -+/** ditto */ -+int execve(in string pathname, in string[] argv, in string[] envp) -+{ -+ auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ auto envp_ = cast(const(char)**)alloca((char*).sizeof * (1 + envp.length)); -+ -+ toAStringz(argv, argv_); -+ toAStringz(envp, envp_); -+ -+ return std.c.process.execve(toStringz(pathname), argv_, envp_); -+} -+ -+/** ditto */ -+int execvp(in string pathname, in string[] argv) -+{ -+ auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ -+ toAStringz(argv, argv_); -+ -+ return std.c.process.execvp(toStringz(pathname), argv_); -+} -+ -+/** ditto */ -+int execvpe(in string pathname, in string[] argv, in string[] envp) -+{ -+version(Posix) -+{ -+ // Is pathname rooted? -+ if(pathname[0] == '/') -+ { -+ // Yes, so just call execve() -+ return execve(pathname, argv, envp); -+ } -+ else -+ { -+ // No, so must traverse PATHs, looking for first match -+ string[] envPaths = std.array.split( -+ to!string(core.stdc.stdlib.getenv("PATH")), ":"); -+ int iRet = 0; -+ -+ // Note: if any call to execve() succeeds, this process will cease -+ // execution, so there's no need to check the execve() result through -+ // the loop. -+ -+ foreach(string pathDir; envPaths) -+ { -+ string composite = cast(string) (pathDir ~ "/" ~ pathname); -+ -+ iRet = execve(composite, argv, envp); -+ } -+ if(0 != iRet) -+ { -+ iRet = execve(pathname, argv, envp); -+ } -+ -+ return iRet; -+ } -+} -+else version(Windows) -+{ -+ auto argv_ = cast(const(char)**)alloca((char*).sizeof * (1 + argv.length)); -+ auto envp_ = cast(const(char)**)alloca((char*).sizeof * (1 + envp.length)); -+ -+ toAStringz(argv, argv_); -+ toAStringz(envp, envp_); -+ -+ return std.c.process.execvpe(toStringz(pathname), argv_, envp_); -+} -+else -+{ -+ static assert(0); -+} // version -+} -+ -+/** -+ * Returns the process ID of the calling process, which is guaranteed to be -+ * unique on the system. This call is always successful. -+ * -+ * $(RED This function is scheduled for deprecation. Please use -+ * $(LREF thisProcessID) instead.) -+ * -+ * Example: -+ * --- -+ * writefln("Current process id: %s", getpid()); -+ * --- -+ */ -+alias core.thread.getpid getpid; -+ -+/** -+ Runs $(D_PARAM cmd) in a shell and returns its standard output. If -+ the process could not be started or exits with an error code, -+ throws ErrnoException. -+ -+ $(RED This function is scheduled for deprecation. Please use -+ $(LREF executeShell) instead.) -+ -+ Example: -+ -+ ---- -+ auto tempFilename = chomp(shell("mcookie")); -+ auto f = enforce(fopen(tempFilename), "w"); -+ scope(exit) -+ { -+ fclose(f) == 0 || assert(false); -+ system(escapeShellCommand("rm", tempFilename)); -+ } -+ ... use f ... -+ ---- -+*/ -+string shell(string cmd) -+{ -+ version(Windows) -+ { -+ // Generate a random filename -+ auto a = appender!string(); -+ foreach (ref e; 0 .. 8) -+ { -+ formattedWrite(a, "%x", rndGen.front); -+ rndGen.popFront(); -+ } -+ auto filename = a.data; -+ scope(exit) if (exists(filename)) remove(filename); -+ // We can't use escapeShellCommands here because we don't know -+ // if cmd is escaped (wrapped in quotes) or not, without relying -+ // on shady heuristics. The current code shouldn't cause much -+ // trouble unless filename contained spaces (it won't). -+ errnoEnforce(system(cmd ~ "> " ~ filename) == 0); -+ return readText(filename); -+ } -+ else version(Posix) -+ { -+ File f; -+ f.popen(cmd, "r"); -+ char[] line; -+ string result; -+ while (f.readln(line)) -+ { -+ result ~= line; -+ } -+ f.close(); -+ return result; -+ } -+ else -+ static assert(0, "shell not implemented for this OS."); -+} -+ -+unittest -+{ -+ auto x = shell("echo wyda"); -+ // @@@ This fails on wine -+ //assert(x == "wyda" ~ newline, text(x.length)); -+ -+ import std.exception; // Issue 9444 -+ assertThrown!ErrnoException(shell("qwertyuiop09813478")); -+} -+ -+/** -+Gets the value of environment variable $(D name) as a string. Calls -+$(LINK2 std_c_stdlib.html#_getenv, std.c.stdlib._getenv) -+internally. -+ -+ $(RED This function is scheduled for deprecation. Please use -+ $(LREF environment.get) instead.) -+*/ -+ -+string getenv(in char[] name) -+{ -+ // Cache the last call's result -+ static string lastResult; -+ auto p = core.stdc.stdlib.getenv(toStringz(name)); -+ if (!p) return null; -+ auto value = p[0 .. strlen(p)]; -+ if (value == lastResult) return lastResult; -+ return lastResult = value.idup; -+} -+ -+/** -+Sets the value of environment variable $(D name) to $(D value). If the -+value was written, or the variable was already present and $(D -+overwrite) is false, returns normally. Otherwise, it throws an -+exception. Calls $(LINK2 std_c_stdlib.html#_setenv, -+std.c.stdlib._setenv) internally. -+ -+ $(RED This function is scheduled for deprecation. Please use -+ $(LREF environment.opIndexAssign) instead.) -+*/ -+version(StdDdoc) void setenv(in char[] name, in char[] value, bool overwrite); -+else version(Posix) void setenv(in char[] name, in char[] value, bool overwrite) -+{ -+ errnoEnforce( -+ std.c.stdlib.setenv(toStringz(name), toStringz(value), overwrite) == 0); -+} -+ -+/** -+Removes variable $(D name) from the environment. Calls $(LINK2 -+std_c_stdlib.html#_unsetenv, std.c.stdlib._unsetenv) internally. -+ -+ $(RED This function is scheduled for deprecation. Please use -+ $(LREF environment.remove) instead.) -+*/ -+version(StdDdoc) void unsetenv(in char[] name); -+else version(Posix) void unsetenv(in char[] name) -+{ -+ errnoEnforce(std.c.stdlib.unsetenv(toStringz(name)) == 0); -+} -+ -+version (Posix) unittest -+{ -+ setenv("wyda", "geeba", true); -+ assert(getenv("wyda") == "geeba"); -+ // Get again to make sure caching works -+ assert(getenv("wyda") == "geeba"); -+ unsetenv("wyda"); -+ assert(getenv("wyda") is null); -+} -+ -+/* ////////////////////////////////////////////////////////////////////////// */ -+ -+version(MainTest) -+{ -+ int main(string[] args) -+ { -+ if(args.length < 2) -+ { -+ printf("Must supply executable (and optional arguments)\n"); -+ -+ return 1; -+ } -+ else -+ { -+ string[] dummy_env; -+ -+ dummy_env ~= "VAL0=value"; -+ dummy_env ~= "VAL1=value"; -+ -+/+ -+ foreach(string arg; args) -+ { -+ printf("%.*s\n", arg); -+ } -++/ -+ -+// int i = execv(args[1], args[1 .. args.length]); -+// int i = execvp(args[1], args[1 .. args.length]); -+ int i = execvpe(args[1], args[1 .. args.length], dummy_env); -+ -+ printf("exec??() has returned! Error code: %d; errno: %d\n", i, /* errno */-1); -+ -+ return 0; -+ } -+ } -+} -+ -+/* ////////////////////////////////////////////////////////////////////////// */ -+ -+ -+version(StdDdoc) -+{ -+ /**************************************** -+ * Start up the browser and set it to viewing the page at url. -+ */ -+ void browse(string url); -+} -+else -+version (Windows) -+{ -+ import core.sys.windows.windows; -+ -+ extern (Windows) -+ HINSTANCE ShellExecuteA(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd); -+ -+ -+ pragma(lib,"shell32.lib"); -+ -+ void browse(string url) -+ { -+ ShellExecuteA(null, "open", toStringz(url), null, null, SW_SHOWNORMAL); -+ } -+} -+else version (OSX) -+{ -+ import core.stdc.stdio; -+ import core.stdc.string; -+ import core.sys.posix.unistd; -+ -+ void browse(string url) -+ { -+ const(char)*[5] args; -+ -+ const(char)* browser = core.stdc.stdlib.getenv("BROWSER"); -+ if (browser) -+ { browser = strdup(browser); -+ args[0] = browser; -+ args[1] = toStringz(url); -+ args[2] = null; -+ } -+ else -+ { -+ args[0] = "open".ptr; -+ args[1] = toStringz(url); -+ args[2] = null; -+ } -+ -+ auto childpid = fork(); -+ if (childpid == 0) -+ { -+ core.sys.posix.unistd.execvp(args[0], cast(char**)args.ptr); -+ perror(args[0]); // failed to execute -+ return; -+ } -+ if (browser) -+ free(cast(void*)browser); -+ } -+} -+else version (Posix) -+{ -+ import core.stdc.stdio; -+ import core.stdc.string; -+ import core.sys.posix.unistd; -+ -+ void browse(string url) -+ { -+ const(char)*[3] args; -+ -+ const(char)* browser = core.stdc.stdlib.getenv("BROWSER"); -+ if (browser) -+ { browser = strdup(browser); -+ args[0] = browser; -+ } -+ else -+ //args[0] = "x-www-browser".ptr; // doesn't work on some systems -+ args[0] = "xdg-open".ptr; -+ -+ args[1] = toStringz(url); -+ args[2] = null; -+ -+ auto childpid = fork(); -+ if (childpid == 0) -+ { -+ core.sys.posix.unistd.execvp(args[0], cast(char**)args.ptr); -+ perror(args[0]); // failed to execute -+ return; -+ } -+ if (browser) -+ free(cast(void*)browser); -+ } -+} -+else -+ static assert(0, "os not supported"); ---- a/src/libphobos/src/std/random.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/random.d 2014-04-01 16:32:51.000000000 +0100 -@@ -112,7 +112,6 @@ version(unittest) import std.typetuple; - email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) - */ - -- - /** - * Test if Rng is a random-number generator. The overload - * taking a ElementType also makes sure that the Rng generates -@@ -184,10 +183,10 @@ unittest - @property bool empty() {return false;} - void popFront() {} - } -- assert(!isUniformRNG!(NoRng, uint)); -- assert(!isUniformRNG!(NoRng)); -- assert(!isSeedable!(NoRng, uint)); -- assert(!isSeedable!(NoRng)); -+ static assert(!isUniformRNG!(NoRng, uint)); -+ static assert(!isUniformRNG!(NoRng)); -+ static assert(!isSeedable!(NoRng, uint)); -+ static assert(!isSeedable!(NoRng)); - - struct NoRng2 - { -@@ -197,10 +196,10 @@ unittest - - enum isUniformRandom = false; - } -- assert(!isUniformRNG!(NoRng2, uint)); -- assert(!isUniformRNG!(NoRng2)); -- assert(!isSeedable!(NoRng2, uint)); -- assert(!isSeedable!(NoRng2)); -+ static assert(!isUniformRNG!(NoRng2, uint)); -+ static assert(!isUniformRNG!(NoRng2)); -+ static assert(!isSeedable!(NoRng2, uint)); -+ static assert(!isSeedable!(NoRng2)); - - struct NoRng3 - { -@@ -209,10 +208,10 @@ unittest - - enum isUniformRandom = true; - } -- assert(!isUniformRNG!(NoRng3, uint)); -- assert(!isUniformRNG!(NoRng3)); -- assert(!isSeedable!(NoRng3, uint)); -- assert(!isSeedable!(NoRng3)); -+ static assert(!isUniformRNG!(NoRng3, uint)); -+ static assert(!isUniformRNG!(NoRng3)); -+ static assert(!isSeedable!(NoRng3, uint)); -+ static assert(!isSeedable!(NoRng3)); - - struct validRng - { -@@ -222,10 +221,10 @@ unittest - - enum isUniformRandom = true; - } -- assert(isUniformRNG!(validRng, uint)); -- assert(isUniformRNG!(validRng)); -- assert(!isSeedable!(validRng, uint)); -- assert(!isSeedable!(validRng)); -+ static assert(isUniformRNG!(validRng, uint)); -+ static assert(isUniformRNG!(validRng)); -+ static assert(!isSeedable!(validRng, uint)); -+ static assert(!isSeedable!(validRng)); - - struct seedRng - { -@@ -235,10 +234,10 @@ unittest - void seed(uint val){} - enum isUniformRandom = true; - } -- assert(isUniformRNG!(seedRng, uint)); -- assert(isUniformRNG!(seedRng)); -- assert(isSeedable!(seedRng, uint)); -- assert(isSeedable!(seedRng)); -+ static assert(isUniformRNG!(seedRng, uint)); -+ static assert(isUniformRNG!(seedRng)); -+ static assert(isSeedable!(seedRng, uint)); -+ static assert(isSeedable!(seedRng)); - } - - /** -@@ -456,15 +455,15 @@ alias LinearCongruentialEngine!(uint, 48 - - unittest - { -- assert(isForwardRange!MinstdRand); -- assert(isUniformRNG!MinstdRand); -- assert(isUniformRNG!MinstdRand0); -- assert(isUniformRNG!(MinstdRand, uint)); -- assert(isUniformRNG!(MinstdRand0, uint)); -- assert(isSeedable!MinstdRand); -- assert(isSeedable!MinstdRand0); -- assert(isSeedable!(MinstdRand, uint)); -- assert(isSeedable!(MinstdRand0, uint)); -+ static assert(isForwardRange!MinstdRand); -+ static assert(isUniformRNG!MinstdRand); -+ static assert(isUniformRNG!MinstdRand0); -+ static assert(isUniformRNG!(MinstdRand, uint)); -+ static assert(isUniformRNG!(MinstdRand0, uint)); -+ static assert(isSeedable!MinstdRand); -+ static assert(isSeedable!MinstdRand0); -+ static assert(isSeedable!(MinstdRand, uint)); -+ static assert(isSeedable!(MinstdRand0, uint)); - - // The correct numbers are taken from The Database of Integer Sequences - // http://www.research.att.com/~njas/sequences/eisBTfry00128.txt -@@ -505,6 +504,17 @@ unittest - rnd.seed(); - popFrontN(rnd, 9999); - assert(rnd.front == 399268537); -+ -+ // Check .save works -+ foreach (Type; TypeTuple!(MinstdRand0, MinstdRand)) -+ { -+ auto rnd1 = Type(unpredictableSeed); -+ auto rnd2 = rnd1.save; -+ assert(rnd1 == rnd2); -+ // Enable next test when RNGs are reference types -+ version(none) { assert(rnd1 !is rnd2); } -+ assert(rnd1.take(100).array() == rnd2.take(100).array()); -+ } - } - - /** -@@ -593,7 +603,7 @@ Parameter for the generator. - Throws: - $(D Exception) if the InputRange didn't provide enough elements to seed the generator. - The number of elements required is the 'n' template parameter of the MersenneTwisterEngine struct. -- -+ - Examples: - ---------------- - Mt19937 gen; -@@ -628,7 +638,7 @@ Parameter for the generator. - upperMask = ~((cast(UIntType) 1u << - (UIntType.sizeof * 8 - (w - r))) - 1), - lowerMask = (cast(UIntType) 1u << r) - 1; -- static immutable UIntType mag01[2] = [0x0UL, a]; -+ static immutable UIntType[2] mag01 = [0x0UL, a]; - - ulong y = void; - -@@ -689,7 +699,7 @@ Always $(D false). - */ - enum bool empty = false; - -- private UIntType mt[n]; -+ private UIntType[n] mt; - private size_t mti = size_t.max; /* means mt is not initialized */ - UIntType _y = UIntType.max; - } -@@ -719,11 +729,11 @@ alias MersenneTwisterEngine!(uint, 32, 6 - - unittest - { -- assert(isUniformRNG!Mt19937); -- assert(isUniformRNG!(Mt19937, uint)); -- assert(isSeedable!Mt19937); -- assert(isSeedable!(Mt19937, uint)); -- assert(isSeedable!(Mt19937, typeof(map!((a) => unpredictableSeed)(repeat(0))))); -+ static assert(isUniformRNG!Mt19937); -+ static assert(isUniformRNG!(Mt19937, uint)); -+ static assert(isSeedable!Mt19937); -+ static assert(isSeedable!(Mt19937, uint)); -+ static assert(isSeedable!(Mt19937, typeof(map!((a) => unpredictableSeed)(repeat(0))))); - Mt19937 gen; - popFrontN(gen, 9999); - assert(gen.front == 4123659995); -@@ -756,6 +766,20 @@ unittest - assert(a != b); - } - -+unittest -+{ -+ // Check .save works -+ foreach(Type; TypeTuple!(Mt19937)) -+ { -+ auto gen1 = Type(unpredictableSeed); -+ auto gen2 = gen1.save; -+ assert(gen1 == gen2); // Danger, Will Robinson -- no opEquals for MT -+ // Enable next test when RNGs are reference types -+ version(none) { assert(gen1 !is gen2); } -+ assert(gen1.take(100).array() == gen2.take(100).array()); -+ } -+} -+ - - /** - * Xorshift generator using 32bit algorithm. -@@ -776,8 +800,8 @@ struct XorshiftEngine(UIntType, UIntType - if(isUnsigned!UIntType) - { - static assert(bits == 32 || bits == 64 || bits == 96 || bits == 128 || bits == 160 || bits == 192, -- "Supporting bits are 32, 64, 96, 128, 160 and 192. " ~ to!string(bits) ~ " is not supported."); -- -+ "Xorshift supports only 32, 64, 96, 128, 160 and 192 bit versions. " -+ ~ to!string(bits) ~ " is not supported."); - - public: - ///Mark this as a Rng -@@ -803,11 +827,16 @@ struct XorshiftEngine(UIntType, UIntType - UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123]; - else static if (bits == 160) - UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123, 5783321]; -- else -- { // 192bits -+ else static if (bits == 192) -+ { - UIntType[size] seeds_ = [123456789, 362436069, 521288629, 88675123, 5783321, 6615241]; - UIntType value_; - } -+ else -+ { -+ static assert(false, "Phobos Error: Xorshift has no instantiation rule for " -+ ~ to!string(bits) ~ " bits."); -+ } - - - public: -@@ -862,7 +891,7 @@ struct XorshiftEngine(UIntType, UIntType - static if (bits == 32) - { - temp = seeds_[0] ^ (seeds_[0] << a); -- temp = temp >> b; -+ temp = temp ^ (temp >> b); - seeds_[0] = temp ^ (temp << c); - } - else static if (bits == 64) -@@ -888,15 +917,15 @@ struct XorshiftEngine(UIntType, UIntType - } - else static if (bits == 160) - { -- temp = seeds_[0] ^ (seeds_[0] >> a); -+ temp = seeds_[0] ^ (seeds_[0] << a); - seeds_[0] = seeds_[1]; - seeds_[1] = seeds_[2]; - seeds_[2] = seeds_[3]; - seeds_[3] = seeds_[4]; - seeds_[4] = seeds_[4] ^ (seeds_[4] >> c) ^ temp ^ (temp >> b); - } -- else -- { // 192bits -+ else static if (bits == 192) -+ { - temp = seeds_[0] ^ (seeds_[0] >> a); - seeds_[0] = seeds_[1]; - seeds_[1] = seeds_[2]; -@@ -905,6 +934,11 @@ struct XorshiftEngine(UIntType, UIntType - seeds_[4] = seeds_[4] ^ (seeds_[4] << c) ^ temp ^ (temp << b); - value_ = seeds_[4] + (seeds_[5] += 362437); - } -+ else -+ { -+ static assert(false, "Phobos Error: Xorshift has no popFront() update for " -+ ~ to!string(bits) ~ " bits."); -+ } - } - - -@@ -969,7 +1003,7 @@ struct XorshiftEngine(UIntType, UIntType - * num = rnd.front; // different across runs - * ----- - */ --alias XorshiftEngine!(uint, 32, 13, 17, 5) Xorshift32; -+alias XorshiftEngine!(uint, 32, 13, 17, 15) Xorshift32; - alias XorshiftEngine!(uint, 64, 10, 13, 10) Xorshift64; /// ditto - alias XorshiftEngine!(uint, 96, 10, 5, 26) Xorshift96; /// ditto - alias XorshiftEngine!(uint, 128, 11, 8, 19) Xorshift128; /// ditto -@@ -980,23 +1014,25 @@ alias Xorshift128 Xorshift; - - unittest - { -- assert(isForwardRange!Xorshift); -- assert(isUniformRNG!Xorshift); -- assert(isUniformRNG!(Xorshift, uint)); -- assert(isSeedable!Xorshift); -- assert(isSeedable!(Xorshift, uint)); -+ static assert(isForwardRange!Xorshift); -+ static assert(isUniformRNG!Xorshift); -+ static assert(isUniformRNG!(Xorshift, uint)); -+ static assert(isSeedable!Xorshift); -+ static assert(isSeedable!(Xorshift, uint)); - - // Result from reference implementation. - auto checking = [ -- [2463534242UL, 267649, 551450, 53765, 108832, 215250, 435468, 860211, 660133, 263375], -+ [2463534242UL, 901999875, 3371835698, 2675058524, 1053936272, 3811264849, 472493137, 3856898176, 2131710969, 2312157505], - [362436069UL, 2113136921, 19051112, 3010520417, 951284840, 1213972223, 3173832558, 2611145638, 2515869689, 2245824891], - [521288629UL, 1950277231, 185954712, 1582725458, 3580567609, 2303633688, 2394948066, 4108622809, 1116800180, 3357585673], - [88675123UL, 3701687786, 458299110, 2500872618, 3633119408, 516391518, 2377269574, 2599949379, 717229868, 137866584], -- [5783321UL, 93724048, 491642011, 136638118, 246438988, 238186808, 140181925, 533680092, 285770921, 462053907], -+ [5783321UL, 393427209, 1947109840, 565829276, 1006220149, 971147905, 1436324242, 2800460115, 1484058076, 3823330032], - [0UL, 246875399, 3690007200, 1264581005, 3906711041, 1866187943, 2481925219, 2464530826, 1604040631, 3653403911] - ]; - -- foreach (I, Type; TypeTuple!(Xorshift32, Xorshift64, Xorshift96, Xorshift128, Xorshift160, Xorshift192)) -+ alias TypeTuple!(Xorshift32, Xorshift64, Xorshift96, Xorshift128, Xorshift160, Xorshift192) XorshiftTypes; -+ -+ foreach (I, Type; XorshiftTypes) - { - Type rnd; - -@@ -1006,6 +1042,48 @@ unittest - rnd.popFront(); - } - } -+ -+ // Check .save works -+ foreach (Type; XorshiftTypes) -+ { -+ auto rnd1 = Type(unpredictableSeed); -+ auto rnd2 = rnd1.save; -+ assert(rnd1 == rnd2); -+ // Enable next test when RNGs are reference types -+ version(none) { assert(rnd1 !is rnd2); } -+ assert(rnd1.take(100).array() == rnd2.take(100).array()); -+ } -+} -+ -+ -+/* A complete list of all pseudo-random number generators implemented in -+ * std.random. This can be used to confirm that a given function or -+ * object is compatible with all the pseudo-random number generators -+ * available. It is enabled only in unittest mode. -+ * -+ * Example: -+ * -+ * ---- -+ * foreach(Rng; PseudoRngTypes) -+ * { -+ * static assert(isUniformRng!Rng); -+ * auto rng = Rng(unpredictableSeed); -+ * foo(rng); -+ * } -+ * ---- -+ */ -+version(unittest) -+{ -+ package alias PseudoRngTypes = TypeTuple!(MinstdRand0, MinstdRand, Mt19937, Xorshift32, Xorshift64, -+ Xorshift96, Xorshift128, Xorshift160, Xorshift192); -+} -+ -+unittest -+{ -+ foreach(Rng; PseudoRngTypes) -+ { -+ static assert(isUniformRNG!Rng); -+ } - } - - -@@ -1056,10 +1134,10 @@ alias Mt19937 Random; - - unittest - { -- assert(isUniformRNG!Random); -- assert(isUniformRNG!(Random, uint)); -- assert(isSeedable!Random); -- assert(isSeedable!(Random, uint)); -+ static assert(isUniformRNG!Random); -+ static assert(isUniformRNG!(Random, uint)); -+ static assert(isSeedable!Random); -+ static assert(isSeedable!(Random, uint)); - } - - /** -@@ -1093,7 +1171,7 @@ take $(D urng) uses the default generato - Example: - - ---- --Random gen(unpredictableSeed); -+auto gen = Random(unpredictableSeed); - // Generate an integer in [0, 1023] - auto a = uniform(0, 1024, gen); - // Generate a float in [0, 1$(RPAREN) -@@ -1253,7 +1331,7 @@ passed, uses the default $(D rndGen). - */ - auto uniform(T, UniformRandomNumberGenerator) - (ref UniformRandomNumberGenerator urng) --if (isIntegral!T || isSomeChar!T) -+if (!is(T == enum) && (isIntegral!T || isSomeChar!T)) - { - auto r = urng.front; - urng.popFront(); -@@ -1272,7 +1350,7 @@ if (isIntegral!T || isSomeChar!T) - - /// Ditto - auto uniform(T)() --if (isIntegral!T || isSomeChar!T) -+if (!is(T == enum) && (isIntegral!T || isSomeChar!T)) - { - return uniform!T(rndGen); - } -@@ -1290,6 +1368,37 @@ unittest - } - - /** -+Returns a uniformly selected member of enum $(D E). If no random number -+generator is passed, uses the default $(D rndGen). -+ */ -+auto uniform(E, UniformRandomNumberGenerator) -+(ref UniformRandomNumberGenerator urng) -+if (is(E == enum)) -+{ -+ static immutable E[EnumMembers!E.length] members = [EnumMembers!E]; -+ return members[std.random.uniform(0, members.length, urng)]; -+} -+ -+/// Ditto -+auto uniform(E)() -+if (is(E == enum)) -+{ -+ return uniform!E(rndGen); -+} -+ -+unittest -+{ -+ enum Fruit { Apple = 12, Mango = 29, Pear = 72 } -+ foreach (_; 0 .. 100) -+ { -+ foreach(f; [uniform!Fruit(), rndGen.uniform!Fruit()]) -+ { -+ assert(f == Fruit.Apple || f == Fruit.Mango || f == Fruit.Pear); -+ } -+ } -+} -+ -+/** - Generates a uniform probability distribution of size $(D n), i.e., an - array of size $(D n) of positive numbers of type $(D F) that sum to - $(D 1). If $(D useThis) is provided, it is used as storage. -@@ -1322,38 +1431,47 @@ Shuffles elements of $(D r) using $(D ge - a random-access range with length. - */ - --void randomShuffle(Range, RandomGen = Random)(Range r, -- ref RandomGen gen = rndGen) -+void randomShuffle(Range, RandomGen)(Range r, ref RandomGen gen) - if(isRandomAccessRange!Range && isUniformRNG!RandomGen) - { - return partialShuffle!(Range, RandomGen)(r, r.length, gen); - } - -+/// ditto -+void randomShuffle(Range)(Range r) -+ if(isRandomAccessRange!Range) -+{ -+ return randomShuffle(r, rndGen); -+} -+ - unittest - { -- // Also tests partialShuffle indirectly. -- auto a = ([ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]).dup; -- auto b = a.dup; -- Mt19937 gen; -- randomShuffle(a, gen); -- assert(a.sort == b.sort); -- randomShuffle(a); -- assert(a.sort == b.sort); -+ foreach(Rng; PseudoRngTypes) -+ { -+ static assert(isUniformRNG!Rng); -+ // Also tests partialShuffle indirectly. -+ auto a = ([ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]).dup; -+ auto b = a.dup; -+ Rng gen; -+ randomShuffle(a, gen); -+ assert(a.sort == b.sort); -+ randomShuffle(a); -+ assert(a.sort == b.sort); -+ } - } - - /** --Partially shuffles the elements of $(D r) such that upon returning $(D r[0..n]) --is a random subset of $(D r) and is randomly ordered. $(D r[n..r.length]) --will contain the elements not in $(D r[0..n]). These will be in an undefined --order, but will not be random in the sense that their order after --$(D partialShuffle) returns will not be independent of their order before -+Partially shuffles the elements of $(D r) such that upon returning $(D r[0..n]) -+is a random subset of $(D r) and is randomly ordered. $(D r[n..r.length]) -+will contain the elements not in $(D r[0..n]). These will be in an undefined -+order, but will not be random in the sense that their order after -+$(D partialShuffle) returns will not be independent of their order before - $(D partialShuffle) was called. - - $(D r) must be a random-access range with length. $(D n) must be less than --or equal to $(D r.length). -+or equal to $(D r.length). - */ --void partialShuffle(Range, RandomGen = Random)(Range r, size_t n, -- ref RandomGen gen = rndGen) -+void partialShuffle(Range, RandomGen)(Range r, size_t n, ref RandomGen gen) - if(isRandomAccessRange!Range && isUniformRNG!RandomGen) - { - enforce(n <= r.length, "n must be <= r.length for partialShuffle."); -@@ -1363,6 +1481,13 @@ void partialShuffle(Range, RandomGen = R - } - } - -+/// ditto -+void partialShuffle(Range)(Range r, size_t n) -+ if(isRandomAccessRange!Range) -+{ -+ return partialShuffle(r, n, rndGen); -+} -+ - /** - Rolls a dice with relative probabilities stored in $(D - proportions). Returns the index in $(D proportions) that was chosen. -@@ -1440,41 +1565,102 @@ Covers a given range $(D r) in a random - element of $(D r) once and only once, just in a random order. $(D r) - must be a random-access range with length. - -+If no random number generator is passed to $(D randomCover), the -+thread-global RNG rndGen will be used internally. -+ - Example: - ---- - int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]; --auto rnd = Random(unpredictableSeed); --foreach (e; randomCover(a, rnd)) -+foreach (e; randomCover(a)) - { - writeln(e); - } - ---- -+ -+$(B WARNING:) If an alternative RNG is desired, it is essential for this -+to be a $(I new) RNG seeded in an unpredictable manner. Passing it a RNG -+used elsewhere in the program will result in unintended correlations, -+due to the current implementation of RNGs as value types. -+ -+Example: -+---- -+int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]; -+foreach (e; randomCover(a, Random(unpredictableSeed))) // correct! -+{ -+ writeln(e); -+} -+ -+foreach (e; randomCover(a, rndGen)) // DANGEROUS!! rndGen gets copied by value -+{ -+ writeln(e); -+} -+ -+foreach (e; randomCover(a, rndGen)) // ... so this second random cover -+{ // will output the same sequence as -+ writeln(e); // the previous one. -+} -+---- -+ -+These issues will be resolved in a second-generation std.random that -+re-implements random number generators as reference types. - */ --struct RandomCover(Range, Random) -- if(isRandomAccessRange!Range && isUniformRNG!Random) -+struct RandomCover(Range, UniformRNG = void) -+ if (isRandomAccessRange!Range && (isUniformRNG!UniformRNG || is(UniformRNG == void))) - { - private Range _input; -- private Random _rnd; - private bool[] _chosen; -- private uint _current; -- private uint _alreadyChosen; -+ private size_t _current; -+ private size_t _alreadyChosen = 0; - -- this(Range input, Random rnd) -+ static if (is(UniformRNG == void)) - { -- _input = input; -- _rnd = rnd; -- _chosen.length = _input.length; -- popFront(); -+ this(Range input) -+ { -+ _input = input; -+ _chosen.length = _input.length; -+ _alreadyChosen = 0; -+ } -+ } -+ else -+ { -+ private UniformRNG _rng; -+ -+ this(Range input, ref UniformRNG rng) -+ { -+ _input = input; -+ _rng = rng; -+ _chosen.length = _input.length; -+ _alreadyChosen = 0; -+ } -+ -+ this(Range input, UniformRNG rng) -+ { -+ this(input, rng); -+ } - } - - static if (hasLength!Range) -+ { - @property size_t length() - { -- return (1 + _input.length) - _alreadyChosen; -+ if (_alreadyChosen == 0) -+ { -+ return _input.length; -+ } -+ else -+ { -+ return (1 + _input.length) - _alreadyChosen; -+ } - } -+ } - - @property auto ref front() - { -+ if (_alreadyChosen == 0) -+ { -+ _chosen[] = false; -+ popFront(); -+ } - return _input[_current]; - } - -@@ -1487,12 +1673,19 @@ struct RandomCover(Range, Random) - return; - } - size_t k = _input.length - _alreadyChosen; -- uint i; -+ size_t i; - foreach (e; _input) - { - if (_chosen[i]) { ++i; continue; } - // Roll a dice with k faces -- auto chooseMe = uniform(0, k, _rnd) == 0; -+ static if (is(UniformRNG == void)) -+ { -+ auto chooseMe = uniform(0, k) == 0; -+ } -+ else -+ { -+ auto chooseMe = uniform(0, k, _rng) == 0; -+ } - assert(k > 1 || chooseMe); - if (chooseMe) - { -@@ -1504,43 +1697,67 @@ struct RandomCover(Range, Random) - --k; - ++i; - } -- assert(false); - } - -- @property typeof(this) save() -+ static if (isForwardRange!UniformRNG) - { -- auto ret = this; -- ret._input = _input.save; -- ret._rnd = _rnd.save; -- return ret; -+ @property typeof(this) save() -+ { -+ auto ret = this; -+ ret._input = _input.save; -+ ret._rng = _rng.save; -+ return ret; -+ } - } - - @property bool empty() { return _alreadyChosen > _input.length; } - } - - /// Ditto --RandomCover!(Range, Random) randomCover(Range, Random)(Range r, Random rnd) -- if(isRandomAccessRange!Range && isUniformRNG!Random) -+auto randomCover(Range, UniformRNG)(Range r, auto ref UniformRNG rng) -+ if (isRandomAccessRange!Range && isUniformRNG!UniformRNG) - { -- return typeof(return)(r, rnd); -+ return RandomCover!(Range, UniformRNG)(r, rng); -+} -+ -+/// Ditto -+auto randomCover(Range)(Range r) -+ if (isRandomAccessRange!Range) -+{ -+ return RandomCover!(Range, void)(r); - } - - unittest - { - int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]; -- auto rnd = Random(unpredictableSeed); -- RandomCover!(int[], Random) rc = randomCover(a, rnd); -- static assert(isForwardRange!(typeof(rc))); -- -- int[] b = new int[9]; -- uint i; -- foreach (e; rc) -+ foreach (UniformRNG; TypeTuple!(void, PseudoRngTypes)) - { -- //writeln(e); -- b[i++] = e; -+ static if (is(UniformRNG == void)) -+ { -+ auto rc = randomCover(a); -+ static assert(isInputRange!(typeof(rc))); -+ static assert(!isForwardRange!(typeof(rc))); -+ } -+ else -+ { -+ auto rng = UniformRNG(unpredictableSeed); -+ auto rc = randomCover(a, rng); -+ static assert(isForwardRange!(typeof(rc))); -+ // check for constructor passed a value-type RNG -+ auto rc2 = RandomCover!(int[], UniformRNG)(a, UniformRNG(unpredictableSeed)); -+ static assert(isForwardRange!(typeof(rc2))); -+ } -+ -+ int[] b = new int[9]; -+ uint i; -+ foreach (e; rc) -+ { -+ //writeln(e); -+ b[i++] = e; -+ } -+ sort(b); -+ assert(a == b, text(b)); - } -- sort(b); -- assert(a == b, text(b)); - } - - // RandomSample -@@ -1551,10 +1768,22 @@ range. The total length of $(D r) must b - passed in, the total number of sample is considered to be $(D - total). Otherwise, $(D RandomSample) uses $(D r.length). - --If the number of elements is not exactly $(D total), $(D --RandomSample) throws an exception. This is because $(D total) is --essential to computing the probability of selecting elements in the --range. -+$(D RandomSample) implements Jeffrey Scott Vitter's Algorithm D -+(see Vitter $(WEB dx.doi.org/10.1145/358105.893, 1984), $(WEB -+dx.doi.org/10.1145/23002.23003, 1987)), which selects a sample -+of size $(D n) in O(n) steps and requiring O(n) random variates, -+regardless of the size of the data being sampled. The exception -+to this is if traversing k elements on the input range is itself -+an O(k) operation (e.g. when sampling lines from an input file), -+in which case the sampling calculation will inevitably be of -+O(total). -+ -+RandomSample will throw an exception if $(D total) is verifiably -+less than the total number of elements available in the input, -+or if $(D n > total). -+ -+If no random number generator is passed to $(D randomSample), the -+thread-global RNG rndGen will be used internally. - - Example: - ---- -@@ -1566,68 +1795,128 @@ foreach (e; randomSample(a, 5)) - } - ---- - --$(D RandomSample) implements Jeffrey Scott Vitter's Algorithm D --(see Vitter $(WEB dx.doi.org/10.1145/358105.893, 1984), $(WEB --dx.doi.org/10.1145/23002.23003, 1987)), which selects a sample --of size $(D n) in O(n) steps and requiring O(n) random variates, --regardless of the size of the data being sampled. -+$(B WARNING:) If an alternative RNG is desired, it is essential for this -+to be a $(I new) RNG seeded in an unpredictable manner. Passing it a RNG -+used elsewhere in the program will result in unintended correlations, -+due to the current implementation of RNGs as value types. -+ -+Example: -+---- -+int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; -+foreach (e; randomSample(a, 5, Random(unpredictableSeed))) // correct! -+{ -+ writeln(e); -+} -+ -+foreach (e; randomSample(a, 5, rndGen)) // DANGEROUS!! rndGen gets -+{ // copied by value -+ writeln(e); -+} -+ -+foreach (e; randomSample(a, 5, rndGen)) // ... so this second random -+{ // sample will select the same -+ writeln(e); // values as the previous one. -+} -+---- -+ -+These issues will be resolved in a second-generation std.random that -+re-implements random number generators as reference types. - */ --struct RandomSample(R, Random = void) -- if(isInputRange!R && (isUniformRNG!Random || is(Random == void))) -+struct RandomSample(Range, UniformRNG = void) -+ if (isInputRange!Range && (isUniformRNG!UniformRNG || is(UniformRNG == void))) - { - private size_t _available, _toSelect; -- private immutable ushort _alphaInverse = 13; // Vitter's recommended value. -- private bool _first, _algorithmA; -+ private enum ushort _alphaInverse = 13; // Vitter's recommended value. - private double _Vprime; -- private R _input; -+ private Range _input; - private size_t _index; -+ private enum Skip { None, A, D }; -+ private Skip _skip = Skip.None; - - // If we're using the default thread-local random number generator then -- // we shouldn't store a copy of it here. Random == void is a sentinel -+ // we shouldn't store a copy of it here. UniformRNG == void is a sentinel - // for this. If we're using a user-specified generator then we have no - // choice but to store a copy. -- static if(!is(Random == void)) -+ static if (is(UniformRNG == void)) - { -- Random _gen; -- -- static if (hasLength!R) -+ static if (hasLength!Range) - { -- this(R input, size_t howMany, Random gen) -+ this(Range input, size_t howMany) - { -- _gen = gen; -- initialize(input, howMany, input.length); -+ _input = input; -+ initialize(howMany, input.length); - } - } - -- this(R input, size_t howMany, size_t total, Random gen) -+ this(Range input, size_t howMany, size_t total) - { -- _gen = gen; -- initialize(input, howMany, total); -+ _input = input; -+ initialize(howMany, total); - } - } - else - { -- static if (hasLength!R) -+ UniformRNG _rng; -+ -+ static if (hasLength!Range) - { -- this(R input, size_t howMany) -+ this(Range input, size_t howMany, ref UniformRNG rng) - { -- initialize(input, howMany, input.length); -+ _rng = rng; -+ _input = input; -+ initialize(howMany, input.length); - } -+ -+ this(Range input, size_t howMany, UniformRNG rng) -+ { -+ this(input, howMany, rng); -+ } -+ } -+ -+ this(Range input, size_t howMany, size_t total, ref UniformRNG rng) -+ { -+ _rng = rng; -+ _input = input; -+ initialize(howMany, total); - } - -- this(R input, size_t howMany, size_t total) -+ this(Range input, size_t howMany, size_t total, UniformRNG rng) - { -- initialize(input, howMany, total); -+ this(input, howMany, total, rng); - } - } - -- private void initialize(R input, size_t howMany, size_t total) -+ private void initialize(size_t howMany, size_t total) - { -- _input = input; - _available = total; - _toSelect = howMany; -- enforce(_toSelect <= _available); -- _first = true; -+ enforce(_toSelect <= _available, -+ text("RandomSample: cannot sample ", _toSelect, -+ " items when only ", _available, " are available")); -+ static if (hasLength!Range) -+ { -+ enforce(_available <= _input.length, -+ text("RandomSample: specified ", _available, -+ " items as available when input contains only ", -+ _input.length)); -+ } -+ } -+ -+ private void initializeFront() -+ { -+ assert(_skip == Skip.None); -+ // We can save ourselves a random variate by checking right -+ // at the beginning if we should use Algorithm A. -+ if ((_alphaInverse * _toSelect) > _available) -+ { -+ _skip = Skip.A; -+ } -+ else -+ { -+ _skip = Skip.D; -+ _Vprime = newVprime(_toSelect); -+ } -+ prime(); - } - - /** -@@ -1645,21 +1934,9 @@ struct RandomSample(R, Random = void) - // having it always correspond to the first element of the - // input. The rest of the sample points are determined each - // time we call popFront(). -- if(_first) -+ if (_skip == Skip.None) - { -- // We can save ourselves a random variate by checking right -- // at the beginning if we should use Algorithm A. -- if((_alphaInverse * _toSelect) > _available) -- { -- _algorithmA = true; -- } -- else -- { -- _Vprime = newVprime(_toSelect); -- _algorithmA = false; -- } -- prime(); -- _first = false; -+ initializeFront(); - } - return _input.front; - } -@@ -1667,6 +1944,13 @@ struct RandomSample(R, Random = void) - /// Ditto - void popFront() - { -+ // First we need to check if the sample has -+ // been initialized in the first place. -+ if (_skip == Skip.None) -+ { -+ initializeFront(); -+ } -+ - _input.popFront(); - --_available; - --_toSelect; -@@ -1675,11 +1959,15 @@ struct RandomSample(R, Random = void) - } - - /// Ditto -- @property typeof(this) save() -+ static if (isForwardRange!Range && isForwardRange!UniformRNG) - { -- auto ret = this; -- ret._input = _input.save; -- return ret; -+ @property typeof(this) save() -+ { -+ auto ret = this; -+ ret._input = _input.save; -+ ret._rng = _rng.save; -+ return ret; -+ } - } - - /// Ditto -@@ -1691,11 +1979,42 @@ struct RandomSample(R, Random = void) - /** - Returns the index of the visited record. - */ -- size_t index() -+ @property size_t index() - { -+ if (_skip == Skip.None) -+ { -+ initializeFront(); -+ } - return _index; - } - -+ private size_t skip() -+ { -+ assert(_skip != Skip.None); -+ -+ // Step D1: if the number of points still to select is greater -+ // than a certain proportion of the remaining data points, i.e. -+ // if n >= alpha * N where alpha = 1/13, we carry out the -+ // sampling with Algorithm A. -+ if (_skip == Skip.A) -+ { -+ return skipA(); -+ } -+ else if ((_alphaInverse * _toSelect) > _available) -+ { -+ // We shouldn't get here unless the current selected -+ // algorithm is D. -+ assert(_skip == Skip.D); -+ _skip = Skip.A; -+ return skipA(); -+ } -+ else -+ { -+ assert(_skip == Skip.D); -+ return skipD(); -+ } -+ } -+ - /* - Vitter's Algorithm A, used when the ratio of needed sample values - to remaining data values is sufficiently large. -@@ -1705,15 +2024,15 @@ to remaining data values is sufficiently - size_t s; - double v, quot, top; - -- if(_toSelect==1) -+ if (_toSelect==1) - { -- static if(is(Random==void)) -+ static if (is(UniformRNG == void)) - { - s = uniform(0, _available); - } - else - { -- s = uniform(0, _available, _gen); -+ s = uniform(0, _available, _rng); - } - } - else -@@ -1722,13 +2041,13 @@ to remaining data values is sufficiently - top = _available - _toSelect; - quot = top / _available; - -- static if(is(Random==void)) -+ static if (is(UniformRNG == void)) - { - v = uniform!"()"(0.0, 1.0); - } - else - { -- v = uniform!"()"(0.0, 1.0, _gen); -+ v = uniform!"()"(0.0, 1.0, _rng); - } - - while (quot > v) -@@ -1746,13 +2065,13 @@ Randomly reset the value of _Vprime. - */ - private double newVprime(size_t remaining) - { -- static if(is(Random == void)) -+ static if (is(UniformRNG == void)) - { - double r = uniform!"()"(0.0, 1.0); - } - else - { -- double r = uniform!"()"(0.0, 1.0, _gen); -+ double r = uniform!"()"(0.0, 1.0, _rng); - } - - return r ^^ (1.0 / remaining); -@@ -1770,45 +2089,38 @@ and its rationale, see: - - Variable names are chosen to match those in Vitter's paper. - */ -- private size_t skip() -+ private size_t skipD() - { -- // Step D1: if the number of points still to select is greater -- // than a certain proportion of the remaining data points, i.e. -- // if n >= alpha * N where alpha = 1/13, we carry out the -- // sampling with Algorithm A. -- if(_algorithmA) -- { -- return skipA(); -- } -- else if((_alphaInverse * _toSelect) > _available) -- { -- _algorithmA = true; -- return skipA(); -- } -- // Otherwise, we use the standard Algorithm D mechanism. -- else if ( _toSelect > 1 ) -+ // Confirm that the check in Step D1 is valid and we -+ // haven't been sent here by mistake -+ assert((_alphaInverse * _toSelect) <= _available); -+ -+ // Now it's safe to use the standard Algorithm D mechanism. -+ if (_toSelect > 1) - { - size_t s; - size_t qu1 = 1 + _available - _toSelect; - double x, y1; - -- while(true) -+ assert(!_Vprime.isNaN); -+ -+ while (true) - { - // Step D2: set values of x and u. -- for(x = _available * (1-_Vprime), s = cast(size_t) trunc(x); -- s >= qu1; -- x = _available * (1-_Vprime), s = cast(size_t) trunc(x)) -+ for (x = _available * (1-_Vprime), s = cast(size_t) trunc(x); -+ s >= qu1; -+ x = _available * (1-_Vprime), s = cast(size_t) trunc(x)) - { - _Vprime = newVprime(_toSelect); - } - -- static if(is(Random == void)) -+ static if (is(UniformRNG == void)) - { - double u = uniform!"()"(0.0, 1.0); - } - else - { -- double u = uniform!"()"(0.0, 1.0, _gen); -+ double u = uniform!"()"(0.0, 1.0, _rng); - } - - y1 = (u * (cast(double) _available) / qu1) ^^ (1.0/(_toSelect - 1)); -@@ -1817,12 +2129,12 @@ Variable names are chosen to match those - - // Step D3: if _Vprime <= 1.0 our work is done and we return S. - // Otherwise ... -- if(_Vprime > 1.0) -+ if (_Vprime > 1.0) - { - size_t top = _available - 1, limit; - double y2 = 1.0, bottom; - -- if(_toSelect > (s+1) ) -+ if (_toSelect > (s+1)) - { - bottom = _available - _toSelect; - limit = _available - s; -@@ -1833,7 +2145,7 @@ Variable names are chosen to match those - limit = qu1; - } - -- foreach(size_t t; limit.._available) -+ foreach (size_t t; limit .. _available) - { - y2 *= top/bottom; - top--; -@@ -1841,10 +2153,10 @@ Variable names are chosen to match those - } - - // Step D4: decide whether or not to accept the current value of S. -- if( (_available/(_available-x)) < (y1 * (y2 ^^ (1.0/(_toSelect-1)))) ) -+ if (_available/(_available-x) < y1 * (y2 ^^ (1.0/(_toSelect-1)))) - { - // If it's not acceptable, we generate a new value of _Vprime -- // and go back to the start of the for(;;) loop. -+ // and go back to the start of the for (;;) loop. - _Vprime = newVprime(_toSelect); - } - else -@@ -1872,71 +2184,366 @@ Variable names are chosen to match those - - private void prime() - { -- if (empty) return; -+ if (empty) -+ { -+ return; -+ } - assert(_available && _available >= _toSelect); - immutable size_t s = skip(); -- _input.popFrontN(s); -+ assert(s + _toSelect <= _available); -+ static if (hasLength!Range) -+ { -+ assert(s + _toSelect <= _input.length); -+ } -+ assert(!_input.empty); -+ _input.popFrontExactly(s); - _index += s; - _available -= s; - assert(_available > 0); -- return; - } - } - - /// Ditto --auto randomSample(R)(R r, size_t n, size_t total) --if(isInputRange!R) -+auto randomSample(Range)(Range r, size_t n, size_t total) -+ if (isInputRange!Range) - { -- return RandomSample!(R, void)(r, n, total); -+ return RandomSample!(Range, void)(r, n, total); - } - - /// Ditto --auto randomSample(R)(R r, size_t n) -- if(isInputRange!R && hasLength!R) -+auto randomSample(Range)(Range r, size_t n) -+ if (isInputRange!Range && hasLength!Range) - { -- return RandomSample!(R, void)(r, n, r.length); -+ return RandomSample!(Range, void)(r, n, r.length); - } - - /// Ditto --auto randomSample(R, Random)(R r, size_t n, size_t total, Random gen) --if(isInputRange!R && isUniformRNG!Random) -+auto randomSample(Range, UniformRNG)(Range r, size_t n, size_t total, auto ref UniformRNG rng) -+ if (isInputRange!Range && isUniformRNG!UniformRNG) - { -- return RandomSample!(R, Random)(r, n, total, gen); -+ return RandomSample!(Range, UniformRNG)(r, n, total, rng); - } - - /// Ditto --auto randomSample(R, Random)(R r, size_t n, Random gen) --if (isInputRange!R && hasLength!R && isUniformRNG!Random) -+auto randomSample(Range, UniformRNG)(Range r, size_t n, auto ref UniformRNG rng) -+ if (isInputRange!Range && hasLength!Range && isUniformRNG!UniformRNG) - { -- return RandomSample!(R, Random)(r, n, r.length, gen); -+ return RandomSample!(Range, UniformRNG)(r, n, r.length, rng); - } - - unittest - { -- Random gen; -- int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; -- static assert(isForwardRange!(typeof(randomSample(a, 5)))); -- static assert(isForwardRange!(typeof(randomSample(a, 5, gen)))); -- -- //int[] a = [ 0, 1, 2 ]; -- assert(randomSample(a, 5).length == 5); -- assert(randomSample(a, 5, 10).length == 5); -- assert(randomSample(a, 5, gen).length == 5); -- uint i; -- foreach (e; randomSample(randomCover(a, rndGen), 5)) -+ // For test purposes, an infinite input range -+ struct TestInputRange - { -- ++i; -- //writeln(e); -+ private auto r = recurrence!"a[n-1] + 1"(0); -+ bool empty() @property const pure nothrow { return r.empty; } -+ auto front() @property pure nothrow { return r.front; } -+ void popFront() pure nothrow { r.popFront(); } - } -- assert(i == 5); -+ static assert(isInputRange!TestInputRange); -+ static assert(!isForwardRange!TestInputRange); -+ -+ int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]; - -- // Bugzilla 8314 -+ foreach (UniformRNG; PseudoRngTypes) - { -- auto sample(uint seed) { return randomSample(a, 1, Random(seed)).front; } -+ auto rng = UniformRNG(unpredictableSeed); -+ /* First test the most general case: randomSample of input range, with and -+ * without a specified random number generator. -+ */ -+ static assert(isInputRange!(typeof(randomSample(TestInputRange(), 5, 10)))); -+ static assert(isInputRange!(typeof(randomSample(TestInputRange(), 5, 10, rng)))); -+ static assert(!isForwardRange!(typeof(randomSample(TestInputRange(), 5, 10)))); -+ static assert(!isForwardRange!(typeof(randomSample(TestInputRange(), 5, 10, rng)))); -+ // test case with range initialized by direct call to struct -+ { -+ auto sample = -+ RandomSample!(TestInputRange, UniformRNG) -+ (TestInputRange(), 5, 10, UniformRNG(unpredictableSeed)); -+ static assert(isInputRange!(typeof(sample))); -+ static assert(!isForwardRange!(typeof(sample))); -+ } -+ -+ /* Now test the case of an input range with length. We ignore the cases -+ * already covered by the previous tests. -+ */ -+ static assert(isInputRange!(typeof(randomSample(TestInputRange().takeExactly(10), 5)))); -+ static assert(isInputRange!(typeof(randomSample(TestInputRange().takeExactly(10), 5, rng)))); -+ static assert(!isForwardRange!(typeof(randomSample(TestInputRange().takeExactly(10), 5)))); -+ static assert(!isForwardRange!(typeof(randomSample(TestInputRange().takeExactly(10), 5, rng)))); -+ // test case with range initialized by direct call to struct -+ { -+ auto sample = -+ RandomSample!(typeof(TestInputRange().takeExactly(10)), UniformRNG) -+ (TestInputRange().takeExactly(10), 5, 10, UniformRNG(unpredictableSeed)); -+ static assert(isInputRange!(typeof(sample))); -+ static assert(!isForwardRange!(typeof(sample))); -+ } -+ -+ // Now test the case of providing a forward range as input. -+ static assert(!isForwardRange!(typeof(randomSample(a, 5)))); -+ static if (isForwardRange!UniformRNG) -+ { -+ static assert(isForwardRange!(typeof(randomSample(a, 5, rng)))); -+ // ... and test with range initialized directly -+ { -+ auto sample = -+ RandomSample!(int[], UniformRNG) -+ (a, 5, UniformRNG(unpredictableSeed)); -+ static assert(isForwardRange!(typeof(sample))); -+ } -+ } -+ else -+ { -+ static assert(isInputRange!(typeof(randomSample(a, 5, rng)))); -+ static assert(!isForwardRange!(typeof(randomSample(a, 5, rng)))); -+ // ... and test with range initialized directly -+ { -+ auto sample = -+ RandomSample!(int[], UniformRNG) -+ (a, 5, UniformRNG(unpredictableSeed)); -+ static assert(isInputRange!(typeof(sample))); -+ static assert(!isForwardRange!(typeof(sample))); -+ } -+ } -+ -+ /* Check that randomSample will throw an error if we claim more -+ * items are available than there actually are, or if we try to -+ * sample more items than are available. */ -+ assert(collectExceptionMsg(randomSample(a, 5, 15)) == "RandomSample: specified 15 items as available when input contains only 10"); -+ assert(collectExceptionMsg(randomSample(a, 15)) == "RandomSample: cannot sample 15 items when only 10 are available"); -+ assert(collectExceptionMsg(randomSample(a, 9, 8)) == "RandomSample: cannot sample 9 items when only 8 are available"); -+ assert(collectExceptionMsg(randomSample(TestInputRange(), 12, 11)) == "RandomSample: cannot sample 12 items when only 11 are available"); -+ -+ /* Check that sampling algorithm never accidentally overruns the end of -+ * the input range. If input is an InputRange without .length, this -+ * relies on the user specifying the total number of available items -+ * correctly. -+ */ -+ { -+ uint i = 0; -+ foreach (e; randomSample(a, a.length)) -+ { -+ assert(e == i); -+ ++i; -+ } -+ assert(i == a.length); -+ -+ i = 0; -+ foreach (e; randomSample(TestInputRange(), 17, 17)) -+ { -+ assert(e == i); -+ ++i; -+ } -+ assert(i == 17); -+ } -+ -+ -+ // Check length properties of random samples. -+ assert(randomSample(a, 5).length == 5); -+ assert(randomSample(a, 5, 10).length == 5); -+ assert(randomSample(a, 5, rng).length == 5); -+ assert(randomSample(a, 5, 10, rng).length == 5); -+ assert(randomSample(TestInputRange(), 5, 10).length == 5); -+ assert(randomSample(TestInputRange(), 5, 10, rng).length == 5); -+ -+ // ... and emptiness! -+ assert(randomSample(a, 0).empty); -+ assert(randomSample(a, 0, 5).empty); -+ assert(randomSample(a, 0, rng).empty); -+ assert(randomSample(a, 0, 5, rng).empty); -+ assert(randomSample(TestInputRange(), 0, 10).empty); -+ assert(randomSample(TestInputRange(), 0, 10, rng).empty); -+ -+ /* Test that the (lazy) evaluation of random samples works correctly. -+ * -+ * We cover 2 different cases: a sample where the ratio of sample points -+ * to total points is greater than the threshold for using Algorithm, and -+ * one where the ratio is small enough (< 1/13) for Algorithm D to be used. -+ * -+ * For each, we also cover the case with and without a specified RNG. -+ */ -+ { -+ // Small sample/source ratio, no specified RNG. -+ uint i = 0; -+ foreach (e; randomSample(randomCover(a), 5)) -+ { -+ ++i; -+ } -+ assert(i == 5); - -- immutable fst = sample(0); -- uint n; -- while (sample(++n) == fst && n < n.max) {} -- assert(n < n.max); -+ // Small sample/source ratio, specified RNG. -+ i = 0; -+ foreach (e; randomSample(randomCover(a), 5, rng)) -+ { -+ ++i; -+ } -+ assert(i == 5); -+ -+ // Large sample/source ratio, no specified RNG. -+ i = 0; -+ foreach (e; randomSample(TestInputRange(), 123, 123_456)) -+ { -+ ++i; -+ } -+ assert(i == 123); -+ -+ // Large sample/source ratio, specified RNG. -+ i = 0; -+ foreach (e; randomSample(TestInputRange(), 123, 123_456, rng)) -+ { -+ ++i; -+ } -+ assert(i == 123); -+ -+ /* Sample/source ratio large enough to start with Algorithm D, -+ * small enough to switch to Algorithm A. -+ */ -+ i = 0; -+ foreach (e; randomSample(TestInputRange(), 10, 131)) -+ { -+ ++i; -+ } -+ assert(i == 10); -+ } -+ -+ // Test that the .index property works correctly -+ { -+ auto sample1 = randomSample(TestInputRange(), 654, 654_321); -+ for (; !sample1.empty; sample1.popFront()) -+ { -+ assert(sample1.front == sample1.index); -+ } -+ -+ auto sample2 = randomSample(TestInputRange(), 654, 654_321, rng); -+ for (; !sample2.empty; sample2.popFront()) -+ { -+ assert(sample2.front == sample2.index); -+ } -+ -+ /* Check that it also works if .index is called before .front. -+ * See: http://d.puremagic.com/issues/show_bug.cgi?id=10322 -+ */ -+ auto sample3 = randomSample(TestInputRange(), 654, 654_321); -+ for (; !sample3.empty; sample3.popFront()) -+ { -+ assert(sample3.index == sample3.front); -+ } -+ -+ auto sample4 = randomSample(TestInputRange(), 654, 654_321, rng); -+ for (; !sample4.empty; sample4.popFront()) -+ { -+ assert(sample4.index == sample4.front); -+ } -+ } -+ -+ /* Test behaviour if .popFront() is called before sample is read. -+ * This is a rough-and-ready check that the statistical properties -+ * are in the ballpark -- not a proper validation of statistical -+ * quality! This incidentally also checks for reference-type -+ * initialization bugs, as the foreach() loop will operate on a -+ * copy of the popFronted (and hence initialized) sample. -+ */ -+ { -+ size_t count0, count1, count99; -+ foreach(_; 0 .. 100_000) -+ { -+ auto sample = randomSample(iota(100), 5); -+ sample.popFront(); -+ foreach(s; sample) -+ { -+ if (s == 0) -+ { -+ ++count0; -+ } -+ else if (s == 1) -+ { -+ ++count1; -+ } -+ else if (s == 99) -+ { -+ ++count99; -+ } -+ } -+ } -+ /* Statistical assumptions here: this is a sequential sampling process -+ * so (i) 0 can only be the first sample point, so _can't_ be in the -+ * remainder of the sample after .popFront() is called. (ii) By similar -+ * token, 1 can only be in the remainder if it's the 2nd point of the -+ * whole sample, and hence if 0 was the first; probability of 0 being -+ * first and 1 second is 5/100 * 4/99 (thank you, Algorithm S:-) and -+ * so the mean count of 1 should be about 202. Finally, 99 can only -+ * be the _last_ sample point to be picked, so its probability of -+ * inclusion should be independent of the .popFront() and it should -+ * occur with frequency 5/100, hence its count should be about 5000. -+ * Unfortunately we have to set quite a high tolerance because with -+ * sample size small enough for unittests to run in reasonable time, -+ * the variance can be quite high. -+ */ -+ assert(count0 == 0); -+ assert(count1 < 300, text("1: ", count1, " > 300.")); -+ assert(4_700 < count99, text("99: ", count99, " < 4700.")); -+ assert(count99 < 5_300, text("99: ", count99, " > 5300.")); -+ } -+ -+ /* Odd corner-cases: RandomSample has 2 constructors that are not called -+ * by the randomSample() helper functions, but that can be used if the -+ * constructor is called directly. These cover the case of the user -+ * specifying input but not input length. -+ */ -+ { -+ auto input1 = TestInputRange().takeExactly(456_789); -+ static assert(hasLength!(typeof(input1))); -+ auto sample1 = RandomSample!(typeof(input1), void)(input1, 789); -+ static assert(isInputRange!(typeof(sample1))); -+ static assert(!isForwardRange!(typeof(sample1))); -+ assert(sample1.length == 789); -+ assert(sample1._available == 456_789); -+ uint i = 0; -+ for (; !sample1.empty; sample1.popFront()) -+ { -+ assert(sample1.front == sample1.index); -+ ++i; -+ } -+ assert(i == 789); -+ -+ auto input2 = TestInputRange().takeExactly(456_789); -+ static assert(hasLength!(typeof(input2))); -+ auto sample2 = RandomSample!(typeof(input2), typeof(rng))(input2, 789, rng); -+ static assert(isInputRange!(typeof(sample2))); -+ static assert(!isForwardRange!(typeof(sample2))); -+ assert(sample2.length == 789); -+ assert(sample2._available == 456_789); -+ i = 0; -+ for (; !sample2.empty; sample2.popFront()) -+ { -+ assert(sample2.front == sample2.index); -+ ++i; -+ } -+ assert(i == 789); -+ } -+ -+ /* Test that the save property works where input is a forward range, -+ * and RandomSample is using a (forward range) random number generator -+ * that is not rndGen. -+ */ -+ static if (isForwardRange!UniformRNG) -+ { -+ auto sample1 = randomSample(a, 5, rng); -+ auto sample2 = sample1.save; -+ assert(sample1.array() == sample2.array()); -+ } -+ -+ // Bugzilla 8314 -+ { -+ auto sample(RandomGen)(uint seed) { return randomSample(a, 1, RandomGen(seed)).front; } -+ -+ // Start from 1 because not all RNGs accept 0 as seed. -+ immutable fst = sample!UniformRNG(1); -+ uint n = 1; -+ while (sample!UniformRNG(++n) == fst && n < n.max) {} -+ assert(n < n.max); -+ } - } - } ---- a/src/libphobos/src/std/range.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/range.d 2014-04-01 16:32:51.000000000 +0100 -@@ -24,8 +24,8 @@ $(BOOKTABLE , - )) - $(TR $(TD $(D $(LREF isOutputRange))) - $(TD Tests if something is an $(I output _range), defined to be -- something to which one can sequentially write data using the $(D $(LREF -- put)) primitive. -+ something to which one can sequentially write data using the -+ $(D $(LREF put)) primitive. - )) - $(TR $(TD $(D $(LREF isForwardRange))) - $(TD Tests if something is a $(I forward _range), defined to be an -@@ -188,7 +188,7 @@ $(BOOKTABLE , - These _range-construction tools are implemented using templates; but sometimes - an object-based interface for ranges is needed. For this purpose, this module - provides a number of object and $(D interface) definitions that can be used to --wrap around _range objects created by the above templates: -+wrap around _range objects created by the above templates. - - $(BOOKTABLE , - $(TR $(TD $(D $(LREF InputRange))) -@@ -229,12 +229,15 @@ $(BOOKTABLE , - $(TD Class that implements the $(D InputRange) interface and wraps the - input _range methods in virtual functions. - )) -+ $(TR $(TD $(D $(LREF RefRange))) -+ $(TD Wrapper around a forward _range that gives it reference semantics. -+ )) - ) - - Ranges whose elements are sorted afford better efficiency with certain - operations. For this, the $(D $(LREF assumeSorted)) function can be used to --construct a $(D $(LREF SortedRange)) from a pre-sorted _range. The $(D $(LINK2 --std_algorithm.html#sort, std.algorithm.sort)) function also conveniently -+construct a $(D $(LREF SortedRange)) from a pre-sorted _range. The $(LINK2 -+std_algorithm.html#sort, $(D std.algorithm.sort)) function also conveniently - returns a $(D SortedRange). $(D SortedRange) objects provide some additional - _range operations that take advantage of the fact that the _range is sorted. - -@@ -286,7 +289,7 @@ module std.range; - public import std.array; - import core.bitop, core.exception; - import std.algorithm, std.conv, std.exception, std.functional, -- std.traits, std.typecons, std.typetuple; -+ std.traits, std.typecons, std.typetuple, std.string; - - // For testing only. This code is included in a string literal to be included - // in whatever module it's needed in, so that each module that uses it can be -@@ -1459,7 +1462,7 @@ if (isBidirectionalRange!(Unqual!Range)) - } - else - { -- static struct Result -+ static struct Result() - { - private alias Unqual!Range R; - -@@ -1556,7 +1559,7 @@ if (isBidirectionalRange!(Unqual!Range)) - } - } - -- return Result(r); -+ return Result!()(r); - } - } - -@@ -1887,7 +1890,7 @@ unittest - assert(s1[0..0].empty); - assert(s1[3..3].empty); - // assert(s1[$ .. $].empty); -- assert(s1[s1.opDollar() .. s1.opDollar()].empty); -+ assert(s1[s1.opDollar .. s1.opDollar].empty); - - auto s2 = stride(arr, 2); - assert(equal(s2[0..2], [1,3])); -@@ -1897,7 +1900,7 @@ unittest - assert(s2[0..0].empty); - assert(s2[3..3].empty); - // assert(s2[$ .. $].empty); -- assert(s2[s2.opDollar() .. s2.opDollar()].empty); -+ assert(s2[s2.opDollar .. s2.opDollar].empty); - - // Test fix for Bug 5035 - auto m = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]; // 3 rows, 4 columns -@@ -2944,6 +2947,28 @@ if (isInputRange!R) - { - return Result(_input.save, _n); - } -+ -+ static if (hasMobileElements!R) -+ { -+ auto moveFront() -+ { -+ assert(!empty, -+ "Attempting to move the front of an empty " -+ ~ typeof(this).stringof); -+ return .moveFront(_input); -+ } -+ } -+ -+ static if (hasAssignableElements!R) -+ { -+ @property auto ref front(ElementType!R v) -+ { -+ assert(!empty, -+ "Attempting to assign to the front of an empty " -+ ~ typeof(this).stringof); -+ return _input.front = v; -+ } -+ } - } - - return Result(range, n); -@@ -3000,11 +3025,31 @@ unittest - - foreach(DummyType; AllDummyRanges) - { -- DummyType dummy; -- auto t = takeExactly(dummy, 5); -+ { -+ DummyType dummy; -+ auto t = takeExactly(dummy, 5); -+ -+ //Test that takeExactly doesn't wrap the result of takeExactly. -+ assert(takeExactly(t, 4) == takeExactly(dummy, 4)); -+ } -+ -+ static if(hasMobileElements!DummyType) -+ { -+ { -+ auto t = takeExactly(DummyType.init, 4); -+ assert(t.moveFront() == 1); -+ assert(equal(t, [1, 2, 3, 4])); -+ } -+ } - -- //Test that takeExactly doesn't wrap the result of takeExactly. -- assert(takeExactly(t, 4) == takeExactly(dummy, 4)); -+ static if(hasAssignableElements!DummyType) -+ { -+ { -+ auto t = takeExactly(DummyType.init, 4); -+ t.front = 9; -+ assert(equal(t, [9, 2, 3, 4])); -+ } -+ } - } - } - -@@ -3162,8 +3207,6 @@ unittest - - unittest - { -- import std.metastrings; -- - string genInput() - { - return "@property bool empty() { return _arr.empty; }" ~ -@@ -3241,21 +3284,21 @@ unittest - //`InitStruct([1, 2, 3])`, - `TakeNoneStruct([1, 2, 3])`)) - { -- mixin(Format!("enum a = takeNone(%s).empty;", range)); -+ mixin(format("enum a = takeNone(%s).empty;", range)); - assert(a, typeof(range).stringof); -- mixin(Format!("assert(takeNone(%s).empty);", range)); -- mixin(Format!("static assert(is(typeof(%s) == typeof(takeNone(%s))), typeof(%s).stringof);", -- range, range, range)); -+ mixin(format("assert(takeNone(%s).empty);", range)); -+ mixin(format("static assert(is(typeof(%s) == typeof(takeNone(%s))), typeof(%s).stringof);", -+ range, range, range)); - } - - foreach(range; TypeTuple!(`NormalStruct([1, 2, 3])`, - `InitStruct([1, 2, 3])`)) - { -- mixin(Format!("enum a = takeNone(%s).empty;", range)); -+ mixin(format("enum a = takeNone(%s).empty;", range)); - assert(a, typeof(range).stringof); -- mixin(Format!("assert(takeNone(%s).empty);", range)); -- mixin(Format!("static assert(is(typeof(takeExactly(%s, 0)) == typeof(takeNone(%s))), typeof(%s).stringof);", -- range, range, range)); -+ mixin(format("assert(takeNone(%s).empty);", range)); -+ mixin(format("static assert(is(typeof(takeExactly(%s, 0)) == typeof(takeNone(%s))), typeof(%s).stringof);", -+ range, range, range)); - } - - //Don't work in CTFE. -@@ -3730,10 +3773,7 @@ Take!(Repeat!T) repeat(T)(T value, size_ - return take(repeat(value), n); - } - --/++ -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(LREF repeat) instead.) -- +/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.range.repeat instead.") Take!(Repeat!T) replicate(T)(T value, size_t n) - { - return repeat(value, n); -@@ -3826,14 +3866,11 @@ struct Cycle(Range) - } - - private static struct DollarToken {} -- -- DollarToken opDollar() -- { -- return DollarToken.init; -- } -+ enum opDollar = DollarToken.init; - - auto opSlice(size_t i, size_t j) - { -+ version (assert) if (i > j) throw new RangeError(); - auto retval = this.save; - retval._index += i; - return takeExactly(retval, j - i); -@@ -3934,6 +3971,7 @@ struct Cycle(R) - - auto opSlice(size_t i, size_t j) - { -+ version (assert) if (i > j) throw new RangeError(); - auto retval = this.save; - retval._index += i; - return takeExactly(retval, j - i); -@@ -4023,6 +4061,8 @@ unittest - } - - assert(cRange[10] == 1); -+ -+ assertThrown!RangeError(cy[2..1]); - } - } - -@@ -4161,6 +4201,14 @@ struct Zip(Ranges...) - return result; - } - -+ private void emplaceIfCan(T)(T* addr) -+ { -+ static if(__traits(compiles, emplace(addr))) -+ emplace(addr); -+ else -+ throw new Exception("Range with non-default constructable elements exhausted."); -+ } -+ - /** - Returns the current iterated element. - */ -@@ -4172,7 +4220,7 @@ struct Zip(Ranges...) - auto addr = cast(Unqual!(typeof(result[i]))*) &result[i]; - if (ranges[i].empty) - { -- emplace(addr); -+ emplaceIfCan(addr); - } - else - { -@@ -4216,7 +4264,7 @@ struct Zip(Ranges...) - } - else - { -- emplace(addr); -+ emplaceIfCan(addr); - } - } - return result; -@@ -4240,7 +4288,7 @@ struct Zip(Ranges...) - } - else - { -- emplace(addr); -+ emplaceIfCan(addr); - } - } - return result; -@@ -4263,7 +4311,7 @@ struct Zip(Ranges...) - } - else - { -- emplace(addr); -+ emplaceIfCan(addr); - } - } - return result; -@@ -4607,87 +4655,67 @@ unittest - assert(equal(z2, [tuple(7, 0L)])); - } - --/* CTFE function to generate opApply loop for Lockstep.*/ --private string lockstepApply(Ranges...)(bool withIndex) if (Ranges.length > 0) -+// Text for Issue 11196 -+unittest - { -- // Since there's basically no way to make this code readable as-is, I've -- // included formatting to make the generated code look "normal" when -- // printed out via pragma(msg). -- string ret = "int opApply(scope int delegate("; -- -- if (withIndex) -- { -- ret ~= "size_t, "; -- } -- -- foreach (ti, Type; Ranges) -- { -- static if(hasLvalueElements!Type) -- { -- ret ~= "ref "; -- } -- -- ret ~= "ElementType!(Ranges[" ~ to!string(ti) ~ "]), "; -- } -- -- // Remove trailing , -- ret = ret[0..$ - 2]; -- ret ~= ") dg) {\n"; -- -- // Shallow copy _ranges to be consistent w/ regular foreach. -- ret ~= "\tauto ranges = _ranges;\n"; -- ret ~= "\tint res;\n"; -- -- if (withIndex) -- { -- ret ~= "\tsize_t index = 0;\n"; -- } -+ static struct S { @disable this(); } -+ static assert(__traits(compiles, zip((S[5]).init[]))); -+ auto z = zip(StoppingPolicy.longest, cast(S[]) null, new int[1]); -+ assertThrown(zip(StoppingPolicy.longest, cast(S[]) null, new int[1]).front); -+} - -- // Check for emptiness. -- ret ~= "\twhile("; //someEmpty) {\n"; -- foreach(ti, Unused; Ranges) -- { -- ret ~= "!ranges[" ~ to!string(ti) ~ "].empty && "; -- } -- // Strip trailing && -- ret = ret[0..$ - 4]; -- ret ~= ") {\n"; -+/* -+ Generate lockstep's opApply function as a mixin string. -+ If withIndex is true prepend a size_t index to the delegate. -+*/ -+private string lockstepMixin(Ranges...)(bool withIndex) -+{ -+ string[] params; -+ string[] emptyChecks; -+ string[] dgArgs; -+ string[] popFronts; - -- // Create code to call the delegate. -- ret ~= "\t\tres = dg("; - if (withIndex) - { -- ret ~= "index, "; -+ params ~= "size_t"; -+ dgArgs ~= "index"; - } - -- -- foreach(ti, Range; Ranges) -+ foreach (idx, Range; Ranges) - { -- ret ~= "ranges[" ~ to!string(ti) ~ "].front, "; -+ params ~= format("%sElementType!(Ranges[%s])", hasLvalueElements!Range ? "ref " : "", idx); -+ emptyChecks ~= format("!ranges[%s].empty", idx); -+ dgArgs ~= format("ranges[%s].front", idx); -+ popFronts ~= format("ranges[%s].popFront();", idx); - } - -- // Remove trailing , -- ret = ret[0..$ - 2]; -- ret ~= ");\n"; -- ret ~= "\t\tif(res) break;\n"; -- foreach(ti, Range; Ranges) -- { -- ret ~= "\t\tranges[" ~ to!(string)(ti) ~ "].popFront();\n"; -- } -- -- if (withIndex) -- { -- ret ~= "\t\tindex++;\n"; -- } -+ return format( -+ q{ -+ int opApply(scope int delegate(%s) dg) -+ { -+ auto ranges = _ranges; -+ int res; -+ %s - -- ret ~= "\t}\n"; -- ret ~= "\tif(_s == StoppingPolicy.requireSameLength) {\n"; -- ret ~= "\t\tforeach(range; ranges)\n"; -- ret ~= "\t\t\tenforce(range.empty);\n"; -- ret ~= "\t}\n"; -- ret ~= "\treturn res;\n}"; -+ while (%s) -+ { -+ res = dg(%s); -+ if (res) break; -+ %s -+ %s -+ } - -- return ret; -+ if (_stoppingPolicy == StoppingPolicy.requireSameLength) -+ { -+ foreach(range; ranges) -+ enforce(range.empty); -+ } -+ return res; -+ } -+ }, params.join(", "), withIndex ? "size_t index = 0;" : "", -+ emptyChecks.join(" && "), dgArgs.join(", "), -+ popFronts.join("\n "), -+ withIndex ? "index++;" : "").outdent(); - } - - /** -@@ -4726,22 +4754,21 @@ private string lockstepApply(Ranges...)( - struct Lockstep(Ranges...) - if (Ranges.length > 1 && allSatisfy!(isInputRange, Ranges)) - { --private: -- alias R = Ranges; -- R _ranges; -- StoppingPolicy _s; -- --public: -- this(R ranges, StoppingPolicy s = StoppingPolicy.shortest) -+ this(R ranges, StoppingPolicy sp = StoppingPolicy.shortest) - { - _ranges = ranges; -- enforce(s != StoppingPolicy.longest, -+ enforce(sp != StoppingPolicy.longest, - "Can't use StoppingPolicy.Longest on Lockstep."); -- this._s = s; -+ _stoppingPolicy = sp; - } - -- mixin(lockstepApply!(Ranges)(false)); -- mixin(lockstepApply!(Ranges)(true)); -+ mixin(lockstepMixin!Ranges(false)); -+ mixin(lockstepMixin!Ranges(true)); -+ -+private: -+ alias R = Ranges; -+ R _ranges; -+ StoppingPolicy _stoppingPolicy; - } - - // For generic programming, make sure Lockstep!(Range) is well defined for a -@@ -4845,6 +4872,9 @@ unittest - auto c = chain(foo2, bar2); - - foreach(f, b; lockstep(c, c)) {} -+ -+ // Regression 10468 -+ foreach (x, y; lockstep(iota(0, 10), iota(0, 10))) { } - } - - /** -@@ -5109,14 +5139,15 @@ if ((isIntegral!(CommonType!(B, E)) || i - && isIntegral!S) - { - alias CommonType!(Unqual!B, Unqual!E) Value; -+ alias Unqual!S StepType; - alias typeof(unsigned((end - begin) / step)) IndexType; - - static struct Result - { - private Value current, pastLast; -- private S step; -+ private StepType step; - -- this(Value current, Value pastLast, S step) -+ this(Value current, Value pastLast, StepType step) - { - if ((current < pastLast && step >= 0) || - (current > pastLast && step <= 0)) -@@ -5267,7 +5298,7 @@ auto iota(E)(E end) - auto iota(B, E, S)(B begin, E end, S step) - if (isFloatingPoint!(CommonType!(B, E, S))) - { -- alias CommonType!(B, E, S) Value; -+ alias Unqual!(CommonType!(B, E, S)) Value; - static struct Result - { - private Value start, step; -@@ -6424,9 +6455,11 @@ unittest - - /** - This range iterates over fixed-sized chunks of size $(D chunkSize) of a --$(D source) range. $(D Source) must be an input range with slicing and length. --If $(D source.length) is not evenly divisible by $(D chunkSize), the back --element of this range will contain fewer than $(D chunkSize) elements. -+$(D source) range. $(D Source) must be a forward range. -+ -+If $(D !isInfinitite!Source) and $(D source.walkLength) is not evenly -+divisible by $(D chunkSize), the back element of this range will contain -+fewer than $(D chunkSize) elements. - - Examples: - --- -@@ -6440,102 +6473,193 @@ assert(chunks.front == chunks[0]); - assert(chunks.length == 3); - --- - */ --struct Chunks(Source) if(isInputRange!Source && hasSlicing!Source && hasLength!Source) -+struct Chunks(Source) -+ if (isForwardRange!Source) - { -- /// -+ /// Standard constructor - this(Source source, size_t chunkSize) - { -- this._source = source; -- this._chunkSize = chunkSize; -+ assert(chunkSize != 0, "Cannot create a Chunk with an empty chunkSize"); -+ _source = source; -+ _chunkSize = chunkSize; - } - -- /// Range primitives. -+ /// Forward range primitives. Always present. - @property auto front() - { - assert(!empty); -- return _source[0..min(_chunkSize, _source.length)]; -+ return _source.save.take(_chunkSize); - } - - /// Ditto - void popFront() - { - assert(!empty); -- popFrontN(_source, _chunkSize); -+ _source.popFrontN(_chunkSize); - } - -- /// Ditto -- @property bool empty() -- { -- return _source.empty; -- } -- -- static if(isForwardRange!Source) -- { -+ static if (!isInfinite!Source) - /// Ditto -- @property typeof(this) save() -+ @property bool empty() - { -- return typeof(this)(_source.save, _chunkSize); -+ return _source.empty; - } -- } -+ else -+ // undocumented -+ enum empty = false; - - /// Ditto -- auto opIndex(size_t index) -+ @property typeof(this) save() - { -- immutable end = min(_source.length, (index + 1) * _chunkSize); -- return _source[index * _chunkSize..end]; -+ return typeof(this)(_source.save, _chunkSize); - } - -- /// Ditto -- typeof(this) opSlice(size_t lower, size_t upper) -+ static if (hasLength!Source) - { -- immutable start = lower * _chunkSize; -- immutable end = min(_source.length, upper * _chunkSize); -- return typeof(this)(_source[start..end], _chunkSize); -+ /// Length. Only if $(D hasLength!Source) is $(D true) -+ @property size_t length() -+ { -+ // Note: _source.length + _chunkSize may actually overflow. -+ // We cast to ulong to mitigate the problem on x86 machines. -+ // For x64 machines, we just suppose we'll never overflow. -+ // The "safe" code would require either an extra branch, or a -+ // modulo operation, which is too expensive for such a rare case -+ return cast(size_t)((cast(ulong)(_source.length) + _chunkSize - 1) / _chunkSize); -+ } -+ //Note: No point in defining opDollar here without slicing. -+ //opDollar is defined below in the hasSlicing!Source section - } - -- /// Ditto -- @property size_t length() -+ static if (hasSlicing!Source) - { -- return (_source.length / _chunkSize) + -- (_source.length % _chunkSize > 0); -- } -+ //Used for various purposes -+ private enum hasSliceToEnd = is(typeof(Source.init[_chunkSize .. $]) == Source); - -- alias length opDollar; -+ /** -+ Indexing and slicing operations. Provided only if -+ $(D hasSlicing!Source) is $(D true). -+ */ -+ auto opIndex(size_t index) -+ { -+ immutable start = index * _chunkSize; -+ immutable end = start + _chunkSize; - -- /// Ditto -- @property auto back() -- { -- assert(!empty); -+ static if (isInfinite!Source) -+ return _source[start .. end]; -+ else -+ { -+ immutable len = _source.length; -+ assert(start < len, "chunks index out of bounds"); -+ return _source[start .. min(end, len)]; -+ } -+ } - -- immutable remainder = _source.length % _chunkSize; -- immutable len = _source.length; -+ /// Ditto -+ static if (hasLength!Source) -+ typeof(this) opSlice(size_t lower, size_t upper) -+ { -+ assert(lower <= upper && upper <= length, "chunks slicing index out of bounds"); -+ immutable len = _source.length; -+ return chunks(_source[min(lower * _chunkSize, len) .. min(upper * _chunkSize, len)], _chunkSize); -+ } -+ else static if (hasSliceToEnd) -+ //For slicing an infinite chunk, we need to slice the source to the end. -+ typeof(takeExactly(this, 0)) opSlice(size_t lower, size_t upper) -+ { -+ assert(lower <= upper, "chunks slicing index out of bounds"); -+ return chunks(_source[lower * _chunkSize .. $], _chunkSize).takeExactly(upper - lower); -+ } - -- if(remainder == 0) -+ static if (isInfinite!Source) - { -- // Return a full chunk. -- return _source[len - _chunkSize..len]; -+ static if (hasSliceToEnd) -+ { -+ private static struct DollarToken{} -+ DollarToken opDollar() -+ { -+ return DollarToken(); -+ } -+ //Slice to dollar -+ typeof(this) opSlice(size_t lower, DollarToken) -+ { -+ return typeof(this)(_source[lower * _chunkSize .. $], _chunkSize); -+ } -+ } - } - else - { -- return _source[len - remainder..len]; -+ //Dollar token carries a static type, with no extra information. -+ //It can lazily transform into _source.length on algorithmic -+ //operations such as : chunks[$/2, $-1]; -+ private static struct DollarToken -+ { -+ Chunks!Source* mom; -+ @property size_t momLength() -+ { -+ return mom.length; -+ } -+ alias momLength this; -+ } -+ DollarToken opDollar() -+ { -+ return DollarToken(&this); -+ } -+ -+ //Slice overloads optimized for using dollar. Without this, to slice to end, we would... -+ //1. Evaluate chunks.length -+ //2. Multiply by _chunksSize -+ //3. To finally just compare it (with min) to the original length of source (!) -+ //These overloads avoid that. -+ typeof(this) opSlice(DollarToken, DollarToken) -+ { -+ static if (hasSliceToEnd) -+ return chunks(_source[$ .. $], _chunkSize); -+ else -+ { -+ immutable len = _source.length; -+ return chunks(_source[len .. len], _chunkSize); -+ } -+ } -+ typeof(this) opSlice(size_t lower, DollarToken) -+ { -+ assert(lower <= length, "chunks slicing index out of bounds"); -+ static if (hasSliceToEnd) -+ return chunks(_source[min(lower * _chunkSize, _source.length) .. $], _chunkSize); -+ else -+ { -+ immutable len = _source.length; -+ return chunks(_source[min(lower * _chunkSize, len) .. len], _chunkSize); -+ } -+ } -+ typeof(this) opSlice(DollarToken, size_t upper) -+ { -+ assert(upper == length, "chunks slicing index out of bounds"); -+ return this[$ .. $]; -+ } - } - } - -- /// Ditto -- void popBack() -+ //Bidirectional range primitives -+ static if (hasSlicing!Source && hasLength!Source) - { -- assert(!empty); -- -- immutable remainder = _source.length % _chunkSize; -- immutable len = _source.length; -- -- if(remainder == 0) -- { -- _source = _source[0..len - _chunkSize]; -+ /** -+ Bidirectional range primitives. Provided only if both -+ $(D hasSlicing!Source) and $(D hasLength!Source) are $(D true). -+ */ -+ @property auto back() -+ { -+ assert(!empty, "back called on empty chunks"); -+ immutable len = _source.length; -+ immutable start = (len - 1) / _chunkSize * _chunkSize; -+ return _source[start .. len]; - } -- else -+ -+ /// Ditto -+ void popBack() - { -- _source = _source[0..len - remainder]; -+ assert(!empty, "popBack() called on empty chunks"); -+ immutable end = (_source.length - 1) / _chunkSize * _chunkSize; -+ _source = _source[0 .. end]; - } - } - -@@ -6545,7 +6669,8 @@ private: - } - - /// Ditto --Chunks!(Source) chunks(Source)(Source source, size_t chunkSize) -+Chunks!Source chunks(Source)(Source source, size_t chunkSize) -+if (isForwardRange!Source) - { - return typeof(return)(source, chunkSize); - } -@@ -6573,6 +6698,60 @@ unittest - static assert(isRandomAccessRange!(typeof(chunks))); - } - -+unittest -+{ -+ //Extra toying with slicing and indexing. -+ auto chunks1 = [0, 0, 1, 1, 2, 2, 3, 3, 4].chunks(2); -+ auto chunks2 = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4].chunks(2); -+ -+ assert (chunks1.length == 5); -+ assert (chunks2.length == 5); -+ assert (chunks1[4] == [4]); -+ assert (chunks2[4] == [4, 4]); -+ assert (chunks1.back == [4]); -+ assert (chunks2.back == [4, 4]); -+ -+ assert (chunks1[0 .. 1].equal([[0, 0]])); -+ assert (chunks1[0 .. 2].equal([[0, 0], [1, 1]])); -+ assert (chunks1[4 .. 5].equal([[4]])); -+ assert (chunks2[4 .. 5].equal([[4, 4]])); -+ -+ assert (chunks1[0 .. 0].equal((int[][]).init)); -+ assert (chunks1[5 .. 5].equal((int[][]).init)); -+ assert (chunks2[5 .. 5].equal((int[][]).init)); -+ -+ //Fun with opDollar -+ assert (chunks1[$ .. $].equal((int[][]).init)); //Quick -+ assert (chunks2[$ .. $].equal((int[][]).init)); //Quick -+ assert (chunks1[$ - 1 .. $].equal([[4]])); //Semiquick -+ assert (chunks2[$ - 1 .. $].equal([[4, 4]])); //Semiquick -+ assert (chunks1[$ .. 5].equal((int[][]).init)); //Semiquick -+ assert (chunks2[$ .. 5].equal((int[][]).init)); //Semiquick -+ -+ assert (chunks1[$ / 2 .. $ - 1].equal([[2, 2], [3, 3]])); //Slow -+} -+ -+unittest -+{ -+ //ForwardRange -+ auto r = filter!"true"([1, 2, 3, 4, 5]).chunks(2); -+ assert(equal!"equal(a, b)"(r, [[1, 2], [3, 4], [5]])); -+ -+ //InfiniteRange w/o RA -+ auto fibsByPairs = recurrence!"a[n-1] + a[n-2]"(1, 1).chunks(2); -+ assert(equal!`equal(a, b)`(fibsByPairs.take(2), [[ 1, 1], [ 2, 3]])); -+ -+ //InfiniteRange w/ RA and slicing -+ auto odds = sequence!("a[0] + n * a[1]")(1, 2); -+ auto oddsByPairs = odds.chunks(2); -+ assert(equal!`equal(a, b)`(oddsByPairs.take(2), [[ 1, 3], [ 5, 7]])); -+ -+ //Requires phobos#991 for Sequence to have slice to end -+ static assert(hasSlicing!(typeof(odds))); -+ assert(equal!`equal(a, b)`(oddsByPairs[3 .. 5], [[13, 15], [17, 19]])); -+ assert(equal!`equal(a, b)`(oddsByPairs[3 .. $].take(2), [[13, 15], [17, 19]])); -+} -+ - /** - This range iterates a single element. This is useful when a sole value - must be passed to an algorithm expecting a range. -@@ -7712,10 +7891,7 @@ sgi.com/tech/stl/binary_search.html, bin - return false; - } - --/++ -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(LREF contains) instead.) -- +/ -+ // Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use contains instead.") alias contains canFind; - } - ---- a/src/libphobos/src/std/regex.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/regex.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,12 +1,13 @@ - //Written in the D programming language - /++ -+ $(SECTION Intro) - $(LUCKY Regular expressions) are a commonly used method of pattern matching - on strings, with $(I regex) being a catchy word for a pattern in this domain - specific language. Typical problems usually solved by regular expressions - include validation of user input and the ubiquitous find & replace - in text processing utilities. - -- Synposis: -+ $(SECTION Synopsis) - --- - import std.regex; - import std.stdio; -@@ -41,19 +42,24 @@ - - - --- -- -+ $(SECTION Syntax and general information) - The general usage guideline is to keep regex complexity on the side of simplicity, -- as its capabilities reside in purely character-level manipulation, -- and as such are ill-suited for tasks involving higher level invariants -+ as its capabilities reside in purely character-level manipulation. -+ As such it's ill-suited for tasks involving higher level invariants - like matching an integer number $(U bounded) in an [a,b] interval. - Checks of this sort of are better addressed by additional post-processing. - - The basic syntax shouldn't surprise experienced users of regular expressions. -- Thankfully, nowadays the web is bustling with resources to help newcomers, and a good -- $(WEB www.regular-expressions.info, reference with tutorial) on regular expressions -- can be found. -+ For an introduction to $(D std.regex) see a -+ $(WEB dlang.org/regular-expression.html, short tour) of the module API -+ and its abilities. -+ -+ There are other web resources on regular expressions to help newcomers, -+ and a good $(WEB www.regular-expressions.info, reference with tutorial) -+ can easily be found. - -- This library uses an ECMAScript syntax flavor with the following extensions: -+ This library uses a remarkably common ECMAScript syntax flavor -+ with the following extensions: - $(UL - $(LI Named subexpressions, with Python syntax. ) - $(LI Unicode properties such as Scripts, Blocks and common binary properties e.g Alphabetic, White_Space, Hex_Digit etc.) -@@ -62,12 +68,12 @@ - - $(REG_START Pattern syntax ) - $(I std.regex operates on codepoint level, -- 'character' in this table denotes a single unicode codepoint.) -+ 'character' in this table denotes a single Unicode codepoint.) - $(REG_TABLE - $(REG_TITLE Pattern element, Semantics ) - $(REG_TITLE Atoms, Match single characters ) - $(REG_ROW any character except [{|*+?()^$, Matches the character itself. ) -- $(REG_ROW ., In single line mode matches any charcter. -+ $(REG_ROW ., In single line mode matches any character. - Otherwise it matches any character except '\n' and '\r'. ) - $(REG_ROW [class], Matches a single character - that belongs to this character class. ) -@@ -82,8 +88,8 @@ - $(REG_ROW \r, Matches a carriage return character. ) - $(REG_ROW \t, Matches a tab character. ) - $(REG_ROW \v, Matches a vertical tab character. ) -- $(REG_ROW \d, Matches any unicode digit. ) -- $(REG_ROW \D, Matches any character except unicode digits. ) -+ $(REG_ROW \d, Matches any Unicode digit. ) -+ $(REG_ROW \D, Matches any character except Unicode digits. ) - $(REG_ROW \w, Matches any word character (note: this includes numbers).) - $(REG_ROW \W, Matches any non-word character.) - $(REG_ROW \s, Matches whitespace, same as \p{White_Space}.) -@@ -91,15 +97,15 @@ - $(REG_ROW \\, Matches \ character. ) - $(REG_ROW \c where c is one of [|*+?(), Matches the character c itself. ) - $(REG_ROW \p{PropertyName}, Matches a character that belongs -- to the unicode PropertyName set. -+ to the Unicode PropertyName set. - Single letter abbreviations can be used without surrounding {,}. ) - $(REG_ROW \P{PropertyName}, Matches a character that does not belong -- to the unicode PropertyName set. -+ to the Unicode PropertyName set. - Single letter abbreviations can be used without surrounding {,}. ) - $(REG_ROW \p{InBasicLatin}, Matches any character that is part of -- the BasicLatin unicode $(U block).) -+ the BasicLatin Unicode $(U block).) - $(REG_ROW \P{InBasicLatin}, Matches any character except ones in -- the BasicLatin unicode $(U block).) -+ the BasicLatin Unicode $(U block).) - $(REG_ROW \p{Cyrilic}, Matches any character that is part of - Cyrilic $(U script).) - $(REG_ROW \P{Cyrilic}, Matches any character except ones in -@@ -178,7 +184,7 @@ - useful for formatting complex regular expressions. ) - ) - -- $(B Unicode support) -+ $(SECTION Unicode support) - - This library provides full Level 1 support* according to - $(WEB unicode.org/reports/tr18/, UTS 18). Specifically: -@@ -196,19 +202,42 @@ - *With exception of point 1.1.1, as of yet, normalization of input - is expected to be enforced by user. - -- $(B Slicing) -+ $(SECTION Replace format string) -+ -+ A set of functions in this module that do the substitution rely -+ on a simple format to guide the process. In particular the table below -+ applies to the $(D format) argument of -+ $(LREF replaceFirst) and $(LREF replaceAll). -+ -+ The format string can reference parts of match using the following notation. -+ $(REG_TABLE -+ $(REG_TITLE Format specifier, Replaced by ) -+ $(REG_ROW $&, the whole match. ) -+ $(REG_ROW $`, part of input $(I preceding) the match. ) -+ $(REG_ROW $', part of input $(I following) the match. ) -+ $(REG_ROW $$, '$' character. ) -+ $(REG_ROW \c , where c is any character, the character c itself. ) -+ $(REG_ROW \\, '\' character. ) -+ $(REG_ROW $1 .. $99, submatch number 1 to 99 respectively. ) -+ ) -+ -+ $(SECTION Slicing and zero memory allocations orientation) - - All matches returned by pattern matching functionality in this library -- are slices of the original input, with the notable exception of the $(D replace) -- family of functions which generate a new string from the input. -+ are slices of the original input. The notable exception is the $(D replace) -+ family of functions that generate a new string from the input. - -- Copyright: Copyright Dmitry Olshansky, 2011 -+ In cases where producing the replacement is the ultimate goal -+ $(LREF replaceFirstInto) and $(LREF replaceAllInto) could come in handy -+ as functions that avoid allocations even for replacement. -+ -+ Copyright: Copyright Dmitry Olshansky, 2011- - - License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). - - Authors: Dmitry Olshansky, - -- API and utility constructs are based on original $(D std.regex) -+ API and utility constructs are modeled after the original $(D std.regex) - by Walter Bright and Andrei Alexandrescu. - - Source: $(PHOBOSSRC std/_regex.d) -@@ -218,28 +247,33 @@ Macros: - REG_TITLE = $(TR $(TD $(B $1)) $(TD $(B $2)) ) - REG_TABLE = <table border="1" cellspacing="0" cellpadding="5" > $0 </table> - REG_START = <h3><div align="center"> $0 </div></h3> -+ SECTION = <h3><a id="$1">$0</a></h3> -+ S_LINK = <a href="#$1">$+</a> - +/ - - module std.regex; - --import std.internal.uni, std.internal.uni_tab;//unicode property tables -+import std.internal.uni, std.internal.uni_tab;//Unicode property tables - import std.array, std.algorithm, std.range, - std.conv, std.exception, std.traits, std.typetuple, -- std.uni, std.utf, std.format, std.typecons, std.bitmanip, -+ std.utf, std.format, std.typecons, std.bitmanip, - std.functional, std.exception; -+ - import core.bitop, core.stdc.string, core.stdc.stdlib; --import ascii = std.ascii; -+static import ascii = std.ascii; - import std.string : representation; - --debug import std.stdio; -+debug(std_regex_parser) import std.stdio; //trace parser progress -+debug(std_regex_search) import std.stdio; //trace prefix search engine -+debug(std_regex_matcher) import std.stdio; //trace matcher engine -+debug(std_regex_allocation) import std.stdio; //track object life cycle -+debug(std_regex_ctr) import std.stdio; //dump ctRegex generated sources -+debug(std_regex_test) import std.stdio; //trace test suite progress - - private: --@safe: - --//uncomment to get a barrage of debug info --//debug = fred_parser; --//debug = fred_matching; --//debug = fred_charset; -+import std.uni : isAlpha, isWhite; -+ - - // IR bit pattern: 0b1_xxxxx_yy - // where yy indicates class of instruction, xxxxx for actual operation code -@@ -338,7 +372,7 @@ int lengthOfPairedIR(IR i) - //if the operation has a merge point (this relies on the order of the ops) - bool hasMerge(IR i) - { -- return (i&0b11)==0b10 && i<=IR.RepeatQEnd; -+ return (i&0b11)==0b10 && i <= IR.RepeatQEnd; - } - - //is an IR that opens a "group" -@@ -385,7 +419,7 @@ struct Bytecode - { - assert(data < (1<<22) && code < 256 ); - assert(seq >= 2 && seq < maxSequence); -- raw = code<<24 | ((seq-2)<<22) | data; -+ raw = code << 24 | (seq - 2)<<22 | data; - } - - //store raw data -@@ -400,7 +434,7 @@ struct Bytecode - @property uint data() const { return raw & 0x003f_ffff; } - - //ditto -- @property uint sequence() const { return 2+((raw >>22) & 0x3); } -+ @property uint sequence() const { return 2 + (raw >> 22 & 0x3); } - - //ditto - @property IR code() const { return cast(IR)(raw>>24); } -@@ -424,28 +458,28 @@ struct Bytecode - void setBackrefence() - { - assert(code == IR.GroupStart || code == IR.GroupEnd); -- raw = raw | (1<<23); -+ raw = raw | 1 << 23; - } - - //is referenced - @property bool backreference() const - { - assert(code == IR.GroupStart || code == IR.GroupEnd); -- return cast(bool)(raw & (1<<23)); -+ return cast(bool)(raw & 1 << 23); - } - - //mark as local reference (for backrefs in lookarounds) - void setLocalRef() - { - assert(code == IR.Backref); -- raw = raw | (1<<23); -+ raw = raw | 1 << 23; - } - - //is a local ref - @property bool localRef() const - { - assert(code == IR.Backref); -- return cast(bool)(raw & (1<<23)); -+ return cast(bool)(raw & 1 << 23); - } - - //human readable name of instruction -@@ -470,7 +504,7 @@ struct Bytecode - @property Bytecode paired() const - {//depends on bit and struct layout order - assert(isStart || isEnd); -- return Bytecode.fromRaw(raw ^ (0b11<<24)); -+ return Bytecode.fromRaw(raw ^ 0b11 << 24); - } - - //gets an index into IR block of the respective pair -@@ -503,8 +537,8 @@ static assert(Bytecode.sizeof == 4); - break; - case IR.RepeatEnd, IR.RepeatQEnd: //backward-jump instructions - uint len = irb[pc].data; -- formattedWrite(output, " pc=>%u min=%u max=%u step=%u" -- , pc-len, irb[pc+3].raw, irb[pc+4].raw, irb[pc+2].raw); -+ formattedWrite(output, " pc=>%u min=%u max=%u step=%u", -+ pc - len, irb[pc + 3].raw, irb[pc + 4].raw, irb[pc + 2].raw); - break; - case IR.InfiniteEnd, IR.InfiniteQEnd, IR.OrEnd: //ditto - uint len = irb[pc].data; -@@ -544,77 +578,12 @@ static assert(Bytecode.sizeof == 4); - return output.data; - } - --//another pretty printer, writes out the bytecode of a regex and where the pc is --@trusted void prettyPrint(Sink,Char=const(char)) -- (Sink sink, const(Bytecode)[] irb, uint pc=uint.max, int indent=3, size_t index=0) -- if (isOutputRange!(Sink,Char)) --{//formattedWrite is @system -- while(irb.length>0) -- { -- formattedWrite(sink,"%3d",index); -- if(pc==0 && irb[0].code!=IR.Char) -- { -- for (int i=0;i<indent-2;++i) -- put(sink,"="); -- put(sink,"> "); -- } -- else -- { -- if(isEndIR(irb[0].code)) -- { -- indent-=2; -- } -- if(indent>0) -- { -- string spaces=" "; -- put(sink,spaces[0..(indent%spaces.length)]); -- for (size_t i=indent/spaces.length;i>0;--i) -- put(sink,spaces); -- } -- } -- if(irb[0].code==IR.Char) -- { -- put(sink,`"`); -- int i=0; -- do -- { -- put(sink,cast(char[])([cast(dchar)irb[i].data])); -- ++i; -- } while(i<irb.length && irb[i].code==IR.Char); -- put(sink,"\""); -- if(pc<i) -- { -- put(sink,"\n"); -- for (int ii=indent+pc+1;ii>0;++ii) -- put(sink,"="); -- put(sink,"^"); -- } -- index+=i; -- irb=irb[i..$]; -- } -- else -- { -- put(sink,irb[0].mnemonic); -- put(sink,"("); -- formattedWrite(sink,"%d",irb[0].data); -- int nArgs= irb[0].args; -- for(int iarg=0;iarg<nArgs;++iarg) -- { -- if(iarg+1<irb.length) -- formattedWrite(sink,",%d",irb[iarg+1].data); -- else -- put(sink,"*error* incomplete irb stream"); -- } -- put(sink,")"); -- if(isStartIR(irb[0].code)) -- { -- indent+=2; -- } -- index+=lengthOfIR(irb[0].code); -- irb=irb[lengthOfIR(irb[0].code)..$]; -- } -- put(sink,"\n"); -- } -+//disassemble the whole chunk -+@trusted void printBytecode()(in Bytecode[] slice, in NamedGroup[] dict=[]) -+{ -+ import std.stdio; -+ for(uint pc=0; pc<slice.length; pc += slice[pc].length) -+ writeln("\t", disassemble(slice, pc, dict)); - } - - //index entry structure for name --> number of submatch -@@ -636,6 +605,87 @@ struct Group(DataIndex) - } - } - -+@trusted void reverseBytecode()(Bytecode[] code) -+{ -+ Bytecode[] rev = new Bytecode[code.length]; -+ uint revPc = cast(uint)rev.length; -+ Stack!(Tuple!(uint, uint, uint)) stack; -+ uint start = 0; -+ uint end = cast(uint)code.length; -+ for(;;) -+ { -+ for(uint pc = start; pc < end; ) -+ { -+ uint len = code[pc].length; -+ if(code[pc].code == IR.GotoEndOr) -+ break; //pick next alternation branch -+ if(code[pc].isAtom) -+ { -+ rev[revPc - len .. revPc] = code[pc .. pc + len]; -+ revPc -= len; -+ pc += len; -+ } -+ else if(code[pc].isStart || code[pc].isEnd) -+ { -+ //skip over other embedded lookbehinds they are reversed -+ if(code[pc].code == IR.LookbehindStart -+ || code[pc].code == IR.NeglookbehindStart) -+ { -+ uint blockLen = len + code[pc].data -+ + code[pc].pairedLength; -+ rev[revPc - blockLen .. revPc] = code[pc .. pc + blockLen]; -+ pc += blockLen; -+ revPc -= blockLen; -+ continue; -+ } -+ uint second = code[pc].indexOfPair(pc); -+ uint secLen = code[second].length; -+ rev[revPc - secLen .. revPc] = code[second .. second + secLen]; -+ revPc -= secLen; -+ if(code[pc].code == IR.OrStart) -+ { -+ //we pass len bytes forward, but secLen in reverse -+ uint revStart = revPc - (second + len - secLen - pc); -+ uint r = revStart; -+ uint i = pc + IRL!(IR.OrStart); -+ while(code[i].code == IR.Option) -+ { -+ if(code[i - 1].code != IR.OrStart) -+ { -+ assert(code[i - 1].code == IR.GotoEndOr); -+ rev[r - 1] = code[i - 1]; -+ } -+ rev[r] = code[i]; -+ auto newStart = i + IRL!(IR.Option); -+ auto newEnd = newStart + code[i].data; -+ auto newRpc = r + code[i].data + IRL!(IR.Option); -+ if(code[newEnd].code != IR.OrEnd) -+ { -+ newRpc--; -+ } -+ stack.push(tuple(newStart, newEnd, newRpc)); -+ r += code[i].data + IRL!(IR.Option); -+ i += code[i].data + IRL!(IR.Option); -+ } -+ pc = i; -+ revPc = revStart; -+ assert(code[pc].code == IR.OrEnd); -+ } -+ else -+ pc += len; -+ } -+ } -+ if(stack.empty) -+ break; -+ start = stack.top[0]; -+ end = stack.top[1]; -+ revPc = stack.top[2]; -+ stack.pop(); -+ } -+ code[] = rev[]; -+} -+ -+ - //Regular expression engine/parser options: - // global - search all nonoverlapping matches in input - // casefold - case insensitive matching, do casefolding on match in unicode mode -@@ -648,27 +698,30 @@ enum RegexOption: uint { - nonunicode = 0x8, - multiline = 0x10, - singleline = 0x20 --}; -+} - alias TypeTuple!('g', 'i', 'x', 'U', 'm', 's') RegexOptionNames;//do not reorder this list - static assert( RegexOption.max < 0x80); --enum RegexInfo : uint { oneShot = 0x80 }; -+enum RegexInfo : uint { oneShot = 0x80 } -+alias Escapables = TypeTuple!('[', ']', '\\', '^', '$', '.', '|', '?', ',', '-', -+ ';', ':', '#', '&', '%', '/', '<', '>', '`', '*', '+', '(', ')', '{', '}', '~'); - - private enum NEL = '\u0085', LS = '\u2028', PS = '\u2029'; - - //test if a given string starts with hex number of maxDigit that's a valid codepoint - //returns it's value and skips these maxDigit chars on success, throws on failure --dchar parseUniHex(Char)(ref Char[] str, uint maxDigit) -+dchar parseUniHex(Char)(ref Char[] str, size_t maxDigit) - { -+ //std.conv.parse is both @system and bogus - enforce(str.length >= maxDigit,"incomplete escape sequence"); - uint val; -- for(int k=0;k<maxDigit;k++) -+ for(int k = 0; k < maxDigit; k++) - { - auto current = str[k];//accepts ascii only, so it's OK to index directly - if('0' <= current && current <= '9') - val = val * 16 + current - '0'; - else if('a' <= current && current <= 'f') - val = val * 16 + current -'a' + 10; -- else if('A' <= current && current <= 'Z') -+ else if('A' <= current && current <= 'F') - val = val * 16 + current - 'A' + 10; - else - throw new Exception("invalid escape sequence"); -@@ -678,6 +731,21 @@ dchar parseUniHex(Char)(ref Char[] str, - return val; - } - -+@system unittest //BUG canFind is system -+{ -+ string[] non_hex = [ "000j", "000z", "FffG", "0Z"]; -+ string[] hex = [ "01", "ff", "00af", "10FFFF" ]; -+ int[] value = [ 1, 0xFF, 0xAF, 0x10FFFF ]; -+ foreach(v; non_hex) -+ assert(collectException(parseUniHex(v, v.length)).msg -+ .canFind("invalid escape sequence")); -+ foreach(i, v; hex) -+ assert(parseUniHex(v, v.length) == value[i]); -+ string over = "0011FFFF"; -+ assert(collectException(parseUniHex(over, over.length)).msg -+ .canFind("invalid codepoint")); -+} -+ - //heuristic value determines maximum CodepointSet length suitable for linear search - enum maxCharsetUsed = 6; - -@@ -748,7 +816,7 @@ auto memoizeExpr(string expr)() - s.add(unicodeLu).add(unicodeLl).add(unicodeLt) - .add(unicodeLo).add(unicodeLm); - } -- else if(ucmp(name,"LC") == 0 || ucmp(name,"Cased Letter")==0) -+ else if(ucmp(name,"LC") == 0 || ucmp(name,"Cased Letter") == 0) - { - s.add(unicodeLl).add(unicodeLu).add(unicodeLt);//Title case - } -@@ -783,7 +851,8 @@ auto memoizeExpr(string expr)() - auto range = assumeSorted!((x,y) => ucmp(x.name, y.name) < 0)(unicodeProperties); - //creating empty Codepointset is a workaround - auto eq = range.lowerBound(UnicodeProperty(cast(string)name,CodepointSet.init)).length; -- enforce(eq!=range.length && ucmp(name,range[eq].name)==0,"invalid property name"); -+ enforce(eq != range.length && ucmp(name,range[eq].name) == 0, -+ "invalid property name"); - s = range[eq].set.dup; - } - -@@ -795,40 +864,29 @@ auto memoizeExpr(string expr)() - } - - //basic stack, just in case it gets used anywhere else then Parser --@trusted struct Stack(T, bool CTFE=false) -+@trusted struct Stack(T) - { -- static if(!CTFE) -- Appender!(T[]) stack;//compiles but bogus at CTFE -- else -- { -- struct Proxy -- { -- T[] data; -- void put(T val) -- { -- data ~= val; -- } -- void shrinkTo(size_t sz){ data = data[0..sz]; } -- } -- Proxy stack; -- } -- @property bool empty(){ return stack.data.empty; } -- void push(T item) -- { -- stack.put(item); -- } -- @property ref T top() -+ T[] data; -+ @property bool empty(){ return data.empty; } -+ -+ @property size_t length(){ return data.length; } -+ -+ void push(T val){ data ~= val; } -+ -+ T pop() - { - assert(!empty); -- return stack.data[$-1]; -+ auto val = data[$ - 1]; -+ data = data[0 .. $ - 1]; -+ if(!__ctfe) -+ data.assumeSafeAppend(); -+ return val; - } -- @property size_t length() { return stack.data.length; } -- T pop() -+ -+ @property ref T top() - { - assert(!empty); -- auto t = stack.data[$-1]; -- stack.shrinkTo(stack.data.length-1); -- return t; -+ return data[$ - 1]; - } - } - -@@ -845,7 +903,7 @@ template BasicElementOf(Range) - alias Unqual!(ElementEncodingType!Range) BasicElementOf; - } - --struct Parser(R, bool CTFE=false) -+struct Parser(R) - if (isForwardRange!R && is(ElementType!R : dchar)) - { - enum infinite = ~0u; -@@ -854,10 +912,10 @@ struct Parser(R, bool CTFE=false) - R pat, origin; //keep full pattern for pretty printing error messages - Bytecode[] ir; //resulting bytecode - uint re_flags = 0; //global flags e.g. multiline + internal ones -- Stack!(uint, CTFE) fixupStack; //stack of opened start instructions -+ Stack!(uint) fixupStack; //stack of opened start instructions - NamedGroup[] dict; //maps name -> user group number - //current num of group, group nesting level and repetitions step -- Stack!(uint, CTFE) groupStack; -+ Stack!(uint) groupStack; - uint nesting = 0; - uint lookaroundNest = 0; - uint counterDepth = 0; //current depth of nested counted repetitions -@@ -891,7 +949,7 @@ struct Parser(R, bool CTFE=false) - { - if(n/32 >= backrefed.length) - backrefed.length = n/32 + 1; -- backrefed[n/32] |= 1<<(n & 31); -+ backrefed[n / 32] |= 1 << (n & 31); - } - - @property dchar current(){ return _current; } -@@ -927,27 +985,22 @@ struct Parser(R, bool CTFE=false) - - void put(Bytecode code) - { -- enforce(ir.length < maxCompiledLength -- , "maximum compiled pattern length is exceeded"); -- if(__ctfe) -- { -- ir = ir ~ code; -- } -- else -- ir ~= code; -+ enforce(ir.length < maxCompiledLength, -+ "maximum compiled pattern length is exceeded"); -+ ir ~= code; - } - - void putRaw(uint number) - { -- enforce(ir.length < maxCompiledLength -- , "maximum compiled pattern length is exceeded"); -+ enforce(ir.length < maxCompiledLength, -+ "maximum compiled pattern length is exceeded"); - ir ~= Bytecode.fromRaw(number); - } - - //parsing number with basic overflow check - uint parseDecimal() - { -- uint r=0; -+ uint r = 0; - while(ascii.isDigit(current)) - { - if(r >= (uint.max/10)) -@@ -986,10 +1039,7 @@ struct Parser(R, bool CTFE=false) - break L_FlagSwitch; - } - default: -- if(__ctfe) -- assert(text("unknown regex flag '",ch,"'")); -- else -- new RegexException(text("unknown regex flag '",ch,"'")); -+ throw new RegexException(text("unknown regex flag '",ch,"'")); - } - } - } -@@ -1004,7 +1054,7 @@ struct Parser(R, bool CTFE=false) - - while(!empty) - { -- debug(fred_parser) -+ debug(std_regex_parser) - writeln("*LR*\nSource: ", pat, "\nStack: ",fixupStack.stack.data); - switch(current) - { -@@ -1045,21 +1095,9 @@ struct Parser(R, bool CTFE=false) - nglob = groupStack.top++; - enforce(groupStack.top <= maxGroupNumber, "limit on submatches is exceeded"); - auto t = NamedGroup(name, nglob); -- -- if(__ctfe) -- { -- size_t ind; -- for(ind=0; ind <dict.length; ind++) -- if(t.name >= dict[ind].name) -- break; -- insertInPlaceAlt(dict, ind, t); -- } -- else -- { -- auto d = assumeSorted!"a.name < b.name"(dict); -- auto ind = d.lowerBound(t).length; -- insertInPlaceAlt(dict, ind, t); -- } -+ auto d = assumeSorted!"a.name < b.name"(dict); -+ auto ind = d.lowerBound(t).length; -+ insertInPlaceAlt(dict, ind, t); - put(Bytecode(IR.GroupStart, nglob)); - break; - case '<': -@@ -1098,7 +1136,6 @@ struct Parser(R, bool CTFE=false) - assert(lookaroundNest); - fixLookaround(fix); - lookaroundNest--; -- put(ir[fix].paired); - break; - case IR.Option: //| xxx ) - //two fixups: last option + full OR -@@ -1116,7 +1153,6 @@ struct Parser(R, bool CTFE=false) - lookaroundNest--; - fix = fixupStack.pop(); - fixLookaround(fix); -- put(ir[fix].paired); - break; - default://(?:xxx) - fixupStack.pop(); -@@ -1240,7 +1276,7 @@ struct Parser(R, bool CTFE=false) - default: - if(replace) - { -- copyForwardAlt(ir[offset+1..$],ir[offset..$-1]); -+ copyForwardAlt(ir[offset + 1 .. $],ir[offset .. $ - 1]); - ir.length -= 1; - } - return; -@@ -1294,7 +1330,14 @@ struct Parser(R, bool CTFE=false) - } - put(Bytecode(greedy ? IR.InfiniteStart : IR.InfiniteQStart, len)); - enforce(ir.length + len < maxCompiledLength, "maximum compiled pattern length is exceeded"); -- ir ~= ir[offset .. offset+len]; -+ //workaround @@@BUG@@@ 9634 -+ if(__ctfe) -+ { -+ foreach(v; ir[offset .. offset+len]) -+ ir ~= v; -+ } -+ else -+ ir ~= ir[offset .. offset+len]; - //IR.InfinteX is always a hotspot - put(Bytecode(greedy ? IR.InfiniteEnd : IR.InfiniteQEnd, len)); - put(Bytecode.init); //merge index -@@ -1368,27 +1411,32 @@ struct Parser(R, bool CTFE=false) - put(Bytecode.fromRaw(0)); - groupStack.push(0); - lookaroundNest++; -- enforce(lookaroundNest <= maxLookaroundDepth -- , "maximum lookaround depth is exceeded"); -+ enforce(lookaroundNest <= maxLookaroundDepth, -+ "maximum lookaround depth is exceeded"); - } - -- //fixup lookaround with start at offset fix -+ //fixup lookaround with start at offset fix and append a proper *-End opcode - void fixLookaround(uint fix) - { -- ir[fix] = Bytecode(ir[fix].code -- , cast(uint)ir.length - fix - IRL!(IR.LookaheadStart)); -+ ir[fix] = Bytecode(ir[fix].code, -+ cast(uint)ir.length - fix - IRL!(IR.LookaheadStart)); - auto g = groupStack.pop(); - assert(!groupStack.empty); - ir[fix+1] = Bytecode.fromRaw(groupStack.top); - //groups are cumulative across lookarounds - ir[fix+2] = Bytecode.fromRaw(groupStack.top+g); - groupStack.top += g; -+ if(ir[fix].code == IR.LookbehindStart || ir[fix].code == IR.NeglookbehindStart) -+ { -+ reverseBytecode(ir[fix + IRL!(IR.LookbehindStart) .. $]); -+ } -+ put(ir[fix].paired); - } - - //CodepointSet operations relatively in order of priority - enum Operator:uint { -- Open=0, Negate, Difference, SymDifference, Intersection, Union, None -- }; -+ Open = 0, Negate, Difference, SymDifference, Intersection, Union, None -+ } - - //parse unit of CodepointSet spec, most notably escape sequences and char ranges - //also fetches next set operation -@@ -1527,9 +1575,10 @@ struct Parser(R, bool CTFE=false) - last = parseControlCode(); - state = State.Char; - break; -- case '[',']','\\','^','$','.','|','?',',','-',';',':' -- ,'#','&','%','/','<','>','`' -- ,'*','+','(',')','{','}', '~': -+ foreach(val; Escapables) -+ { -+ case val: -+ } - last = current; - state = State.Char; - break; -@@ -1633,9 +1682,10 @@ struct Parser(R, bool CTFE=false) - case 'v': - end = '\v'; - break; -- case '[',']','\\','^','$','.','|','?',',','-',';',':' -- ,'#','&','%','/','<','>','`' -- ,'*','+','(',')','{','}', '~': -+ foreach(val; Escapables) -+ { -+ case val: -+ } - end = current; - break; - case 'c': -@@ -1663,8 +1713,8 @@ struct Parser(R, bool CTFE=false) - return tuple(set, op); - } - -- alias Stack!(CodepointSet, CTFE) ValStack; -- alias Stack!(Operator, CTFE) OpStack; -+ alias Stack!(CodepointSet) ValStack; -+ alias Stack!(Operator) OpStack; - - //parse and store IR for CodepointSet - void parseCharset() -@@ -1708,8 +1758,6 @@ struct Parser(R, bool CTFE=false) - { - while(cond(opstack.top)) - { -- debug(fred_charset) -- writeln(opstack.stack.data); - if(!apply(opstack.pop(),vstack)) - return false;//syntax error - if(opstack.empty) -@@ -1725,18 +1773,18 @@ struct Parser(R, bool CTFE=false) - { - case '[': - opstack.push(Operator.Open); -- enforce(next(), "unexpected end of CodepointSet"); -+ enforce(next(), "unexpected end of character class"); - if(current == '^') - { - opstack.push(Operator.Negate); -- enforce(next(), "unexpected end of CodepointSet"); -+ enforce(next(), "unexpected end of character class"); - } - //[] is prohibited -- enforce(current != ']', "wrong CodepointSet"); -+ enforce(current != ']', "wrong character class"); - goto default; - case ']': -- enforce(unrollWhile!(unaryFun!"a != a.Open")(vstack, opstack) -- , "CodepointSet syntax error"); -+ enforce(unrollWhile!(unaryFun!"a != a.Open")(vstack, opstack), -+ "character class syntax error"); - enforce(!opstack.empty, "unmatched ']'"); - opstack.pop(); - next(); -@@ -1798,7 +1846,7 @@ struct Parser(R, bool CTFE=false) - auto t = getTrie(set); - put(Bytecode(IR.Trie, cast(uint)tries.length)); - tries ~= t; -- debug(fred_allocation) writeln("Trie generated"); -+ debug(std_regex_allocation) writeln("Trie generated"); - } - else - { -@@ -1874,7 +1922,7 @@ struct Parser(R, bool CTFE=false) - case '1': .. case '9': - uint nref = cast(uint)current - '0'; - uint maxBackref; -- foreach(v; groupStack.stack.data) -+ foreach(v; groupStack.data) - maxBackref += v; - uint localLimit = maxBackref - groupStack.top; - enforce(nref < maxBackref, "Backref to unseen group"); -@@ -1910,11 +1958,11 @@ struct Parser(R, bool CTFE=false) - alias comparePropertyName ucmp; - enum MAX_PROPERTY = 128; - char[MAX_PROPERTY] result; -- uint k=0; -+ uint k = 0; - enforce(next()); - if(current == '{') - { -- while(k<MAX_PROPERTY && next() && current !='}' && current !=':') -+ while(k < MAX_PROPERTY && next() && current !='}' && current !=':') - if(current != '-' && current != ' ' && current != '_') - result[k++] = cast(char)ascii.toLower(current); - enforce(k != MAX_PROPERTY, "invalid property name"); -@@ -1925,8 +1973,8 @@ struct Parser(R, bool CTFE=false) - enforce(current < 0x80, "invalid property name"); - result[k++] = cast(char)current; - } -- auto s = getUnicodeSet(result[0..k], negated -- , cast(bool)(re_flags & RegexOption.casefold)); -+ auto s = getUnicodeSet(result[0..k], negated, -+ cast(bool)(re_flags & RegexOption.casefold)); - enforce(!s.empty, "unrecognized unicode property spec"); - next(); - return s; -@@ -1973,7 +2021,71 @@ public struct Regex(Char) - assert(!r.empty); - --- - +/ -- @property bool empty() const nothrow { return ir is null; } -+ @safe @property bool empty() const nothrow { return ir is null; } -+ -+ /++ -+ A range of all the named captures in the regex. -+ Example: -+ ---- -+ import std.range; -+ import std.algorithm; -+ -+ auto re = regex(`(?P<name>\w+) = (?P<var>\d+)`); -+ auto nc = re.namedCaptures; -+ static assert(isRandomAccessRange!(typeof(nc))); -+ assert(!nc.empty); -+ assert(nc.length == 2); -+ assert(nc.equal(["name", "var"])); -+ assert(nc[0] == "name"); -+ assert(nc[1..$].equal(["var"])); -+ ---- -+ +/ -+ @safe @property auto namedCaptures() -+ { -+ static struct NamedGroupRange -+ { -+ private: -+ NamedGroup[] groups; -+ size_t start; -+ size_t end; -+ public: -+ this(NamedGroup[] g, size_t s, size_t e) -+ { -+ assert(s <= e); -+ assert(e <= g.length); -+ groups = g; -+ start = s; -+ end = e; -+ } -+ -+ @property string front() { return groups[start].name; } -+ @property string back() { return groups[end-1].name; } -+ @property bool empty() { return start >= end; } -+ @property size_t length() { return end - start; } -+ alias length opDollar; -+ @property NamedGroupRange save() -+ { -+ return NamedGroupRange(groups, start, end); -+ } -+ void popFront() { assert(!empty); start++; } -+ void popBack() { assert(!empty); end--; } -+ string opIndex()(size_t i) -+ { -+ assert(start + i < end, -+ "Requested named group is out of range."); -+ return groups[start+i].name; -+ } -+ NamedGroupRange opSlice(size_t low, size_t high) { -+ assert(low <= high); -+ assert(start + high <= end); -+ return NamedGroupRange(groups, start + low, start + high); -+ } -+ NamedGroupRange opSlice() { return this.save; } -+ } -+ return NamedGroupRange(dict, 0, dict.length); -+ } -+ -+ /// - - private: - NamedGroup[] dict; //maps name -> user group number -@@ -1991,7 +2103,7 @@ private: - { - if(n/32 >= backrefed.length) - return 0; -- return backrefed[n/32] & (1<<(n&31)); -+ return backrefed[n / 32] & (1 << (n & 31)); - } - - //check if searching is not needed -@@ -2000,7 +2112,7 @@ private: - if(flags & RegexOption.multiline) - return; - L_CheckLoop: -- for(uint i=0; i<ir.length; i+=ir[i].length) -+ for(uint i = 0; i < ir.length; i += ir[i].length) - { - switch(ir[i].code) - { -@@ -2034,12 +2146,12 @@ private: - auto counterRange = FixedStack!uint(new uint[maxCounterDepth+1], -1); - counterRange.push(1); - ulong cumRange = 0; -- for(uint i=0; i<ir.length; i+=ir[i].length) -+ for(uint i = 0; i < ir.length; i += ir[i].length) - { - if(ir[i].hotspot) - { -- assert(i + 1 < ir.length -- , "unexpected end of IR while looking for hotspot"); -+ assert(i + 1 < ir.length, -+ "unexpected end of IR while looking for hotspot"); - ir[i+1] = Bytecode.fromRaw(hotspotTableSize); - hotspotTableSize += counterRange.top; - } -@@ -2054,8 +2166,8 @@ private: - ir[repEnd+4].raw *= counterRange.top; - ulong cntRange = cast(ulong)(max)*counterRange.top; - cumRange += cntRange; -- enforce(cumRange < maxCumulativeRepetitionLength -- , "repetition length limit is exceeded"); -+ enforce(cumRange < maxCumulativeRepetitionLength, -+ "repetition length limit is exceeded"); - counterRange.push(cast(uint)cntRange + counterRange.top); - threadCount += counterRange.top; - break; -@@ -2080,21 +2192,21 @@ private: - checkIfOneShot(); - if(!(flags & RegexInfo.oneShot)) - kickstart = Kickstart!Char(this, new uint[](256)); -- debug(fred_allocation) writefln("IR processed, max threads: %d", threadCount); -+ debug(std_regex_allocation) writefln("IR processed, max threads: %d", threadCount); - } - - //IR code validator - proper nesting, illegal instructions, etc. - @trusted void validate() - {//@@@BUG@@@ text is @system -- for(uint pc=0; pc<ir.length; pc+=ir[pc].length) -+ for(uint pc = 0; pc < ir.length; pc += ir[pc].length) - { - if(ir[pc].isStart || ir[pc].isEnd) - { - uint dest = ir[pc].indexOfPair(pc); -- assert(dest < ir.length, text("Wrong length in opcode at pc=" -- , pc, " ", dest, " vs ", ir.length)); -- assert(ir[dest].paired == ir[pc] -- ,text("Wrong pairing of opcodes at pc=", pc, "and pc=", dest)); -+ assert(dest < ir.length, text("Wrong length in opcode at pc=", -+ pc, " ", dest, " vs ", ir.length)); -+ assert(ir[dest].paired == ir[pc], -+ text("Wrong pairing of opcodes at pc=", pc, "and pc=", dest)); - } - else if(ir[pc].isAtom) - { -@@ -2106,12 +2218,9 @@ private: - } - - //print out disassembly a program's IR -- @trusted debug public void print() const -+ @trusted debug(std_regex_parser) void print() const - {//@@@BUG@@@ write is system -- writefln("PC\tINST\n"); -- prettyPrint(delegate void(const(char)[] s){ write(s); },ir); -- writefln("\n"); -- for(uint i=0; i<ir.length; i+=ir[i].length) -+ for(uint i = 0; i < ir.length; i += ir[i].length) - { - writefln("%d\t%s ", i, disassemble(ir, i, dict)); - } -@@ -2120,12 +2229,9 @@ private: - } - - // -- this(S,bool x)(Parser!(S,x) p) -+ this(S)(Parser!(S) p) - { -- if(__ctfe)//CTFE something funky going on with array -- ir = p.ir.dup; -- else -- ir = p.ir; -+ ir = p.ir; - dict = p.dict; - ngroup = p.groupStack.top; - maxCounterDepth = p.counterDepth; -@@ -2134,14 +2240,46 @@ private: - tries = p.tries; - backrefed = p.backrefed; - lightPostprocess(); -- debug(fred_parser) -+ debug(std_regex_parser) - { - print(); - } -- debug validate(); -+ version(assert) validate(); - } - } - -+unittest -+{ -+ auto re = regex(`(?P<name>\w+) = (?P<var>\d+)`); -+ auto nc = re.namedCaptures; -+ static assert(isRandomAccessRange!(typeof(nc))); -+ assert(!nc.empty); -+ assert(nc.length == 2); -+ assert(nc.equal(["name", "var"])); -+ assert(nc[0] == "name"); -+ assert(nc[1..$].equal(["var"])); -+ -+ re = regex(`(\w+) (?P<named>\w+) (\w+)`); -+ nc = re.namedCaptures; -+ assert(nc.length == 1); -+ assert(nc[0] == "named"); -+ assert(nc.front == "named"); -+ assert(nc.back == "named"); -+ -+ re = regex(`(\w+) (\w+)`); -+ nc = re.namedCaptures; -+ assert(nc.empty); -+ -+ re = regex(`(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/`); -+ nc = re.namedCaptures; -+ auto cp = nc.save; -+ assert(nc.equal(cp)); -+ nc.popFront(); -+ assert(nc.equal(cp[1..$])); -+ nc.popBack(); -+ assert(nc.equal(cp[1 .. $ - 1])); -+} -+ - // - @trusted uint lookupNamedGroup(String)(NamedGroup[] dict, String name) - {//equal is @system? -@@ -2177,7 +2315,7 @@ int quickTestFwd(RegEx)(uint pc, dchar f - uint end = pc + len; - if(re.ir[pc].data != front && re.ir[pc+1].data != front) - { -- for(pc = pc+2; pc<end; pc++) -+ for(pc = pc+2; pc < end; pc++) - if(re.ir[pc].data == front) - break; - if(pc == end) -@@ -2386,7 +2524,7 @@ public struct StaticRegex(Char) - { - private: - alias BacktrackingMatcher!(true) Matcher; -- alias bool function(ref Matcher!Char) MatchFn; -+ alias bool function(ref Matcher!Char) @trusted MatchFn; - MatchFn nativeFn; - public: - Regex!Char _regex; -@@ -2452,7 +2590,7 @@ private: - tab[idx] &= ~mask; - } - -- void set(alias setBits=setInvMask)(dchar ch) -+ void set(alias setBits = setInvMask)(dchar ch) - { - static if(charSize == 3) - { -@@ -2472,7 +2610,7 @@ private: - Char[dchar.sizeof/Char.sizeof] buf; - uint tmask = mask; - size_t total = encode(buf, ch); -- for(size_t i=0; i<total; i++, tmask<<=1) -+ for(size_t i = 0; i < total; i++, tmask<<=1) - { - static if(charSize == 1) - setBits(buf[i], tmask); -@@ -2531,7 +2669,7 @@ public: - fChar = re.ir[i].data; - static if(charSize != 3) - { -- Char buf[dchar.sizeof/Char.sizeof]; -+ Char[dchar.sizeof/Char.sizeof] buf; - encode(buf, fChar); - fChar = buf[0]; - } -@@ -2573,7 +2711,7 @@ public: - uint end = t.pc + len; - uint[Bytecode.maxSequence] s; - uint numS; -- for(uint i = 0; i<len; i++) -+ for(uint i = 0; i < len; i++) - { - auto x = charLen(re.ir[t.pc+i].data); - if(countUntil(s[0..numS], x) < 0) -@@ -2583,7 +2721,7 @@ public: - { - t.add(re.ir[i].data); - } -- for(uint i=0; i<numS; i++) -+ for(uint i = 0; i < numS; i++) - { - auto tx = fork(t, t.pc + len, t.counter); - if(tx.idx + s[i] <= n_length) -@@ -2613,8 +2751,8 @@ public: - static immutable codeBounds = [0x0, 0x7F, 0x80, 0x7FF, 0x800, 0xFFFF, 0x10000, 0x10FFFF]; - else //== 2 - static immutable codeBounds = [0x0, 0xFFFF, 0x10000, 0x10FFFF]; -- auto srange = assumeSorted!"a<=b"(set.ivals); -- for(uint i = 0; i<codeBounds.length/2; i++) -+ auto srange = assumeSorted!"a <= b"(set.ivals); -+ for(uint i = 0; i < codeBounds.length/2; i++) - { - auto start = srange.lowerBound(codeBounds[2*i]).length; - auto end = srange.lowerBound(codeBounds[2*i+1]).length; -@@ -2634,7 +2772,7 @@ public: - continue; - t.add(ch); - } -- for(uint i=0; i<numS; i++) -+ for(uint i = 0; i < numS; i++) - { - auto tx = fork(t, t.pc + IRL!(IR.CodepointSet), t.counter); - tx.advance(s[i]); -@@ -2729,7 +2867,7 @@ public: - break; - t = fetch(trs); - } -- debug(fred_search) -+ debug(std_regex_search) - { - writeln("Min length: ", n_length); - } -@@ -2749,7 +2887,7 @@ public: - auto p = cast(const(ubyte)*)(haystack.ptr+idx); - uint state = uint.max; - uint limit = 1u<<(n_length - 1u); -- debug(fred_search) writefln("Limit: %32b",limit); -+ debug(std_regex_search) writefln("Limit: %32b",limit); - if(fChar != uint.max) - { - const(ubyte)* end = cast(ubyte*)(haystack.ptr + haystack.length); -@@ -2792,7 +2930,7 @@ public: - state = (state<<1) | table[p[0]]; - state = (state<<1) | table[p[1]]; - state = (state<<1) | table[p[2]]; -- p+=4; -+ p += 4; - } - else - { -@@ -2803,7 +2941,7 @@ public: - return (p-cast(ubyte*)haystack.ptr)/Char.sizeof - -length; - } -- debug(fred_search) writefln("State: %32b", state); -+ debug(std_regex_search) writefln("State: %32b", state); - } - } - else -@@ -2833,7 +2971,7 @@ public: - if(!(state & limit)) - return idx+i/Char.sizeof-length; - } -- while(i<len) -+ while(i < len) - { - state = (state<<1) | table[p[i++]]; - if(!(state & limit)) -@@ -2843,7 +2981,7 @@ public: - if(!(state & limit)) - return idx+i/Char.sizeof - -length; -- debug(fred_search) writefln("State: %32b", state); -+ debug(std_regex_search) writefln("State: %32b", state); - } - } - } -@@ -2853,7 +2991,7 @@ public: - @system debug static void dump(uint[] table) - {//@@@BUG@@@ writef(ln) is @system - import std.stdio; -- for(size_t i=0; i<table.length; i+=4) -+ for(size_t i = 0; i < table.length; i += 4) - { - writefln("%32b %32b %32b %32b",table[i], table[i+1], table[i+2], table[i+3]); - } -@@ -2931,12 +3069,13 @@ struct Input(Char) - if(is(Char :dchar)) - { - alias size_t DataIndex; -+ enum { isLoopback = false }; - alias const(Char)[] String; - String _origin; - size_t _index; - - //constructs Input object out of plain string -- this(String input, size_t idx=0) -+ this(String input, size_t idx = 0) - { - _origin = input; - _index = idx; -@@ -2945,14 +3084,14 @@ struct Input(Char) - //codepoint at current stream position - bool nextChar(ref dchar res, ref size_t pos) - { -+ pos = _index; - if(_index == _origin.length) - return false; -- pos = _index; - res = std.utf.decode(_origin, _index); - return true; - } - @property bool atEnd(){ -- return _index==_origin.length; -+ return _index == _origin.length; - } - bool search(Kickstart)(ref Kickstart kick, ref dchar res, ref size_t pos) - { -@@ -2972,201 +3111,37 @@ struct Input(Char) - struct BackLooper - { - alias size_t DataIndex; -+ enum { isLoopback = true }; - String _origin; - size_t _index; -- this(Input input) -+ this(Input input, size_t index) - { - _origin = input._origin; -- _index = input._index; -+ _index = index; - } - @trusted bool nextChar(ref dchar res,ref size_t pos) - { -+ pos = _index; - if(_index == 0) - return false; -- _index -= std.utf.strideBack(_origin, _index); -- if(_index == 0) -- return false; -- pos = _index; -- res = _origin[0.._index].back; -- return true; -- } -- @property atEnd(){ return _index==0 || _index==std.utf.strideBack(_origin, _index); } -- @property auto loopBack(){ return Input(_origin, _index); } -- -- //support for backtracker engine, might not be present -- void reset(size_t index){ _index = index+std.utf.stride(_origin, index); } - -- String opSlice(size_t start, size_t end){ return _origin[end..start]; } -- //index of at End position -- @property size_t lastIndex(){ return 0; } -- } -- @property auto loopBack(){ return BackLooper(this); } --} -- --// Test stream against simple UTF-string stream abstraction (w/o normalization and such) --struct StreamTester(Char) -- if (is(Char:dchar)) --{ -- alias ulong DataIndex; -- alias const(Char)[] String; -- Input!(Char) refStream; -- String allStr; -- StreamCBuf!(Char) stream; -- size_t[] splits; -- size_t pos; -- -- //adds the next chunk to the stream -- bool addNextChunk() -- { -- if(splits.length<pos) -- { -- ++pos; -- if(pos<splits.length) -- { -- assert(splits[pos-1]<=splits[pos],"splits is not ordered"); -- stream.addChunk(allStr[splits[pos-1]..splits[pos]]); -- } -- else -- { -- stream.addChunk(allStr[splits[pos-1]..$]); -- stream.hasEnd=true; -- } -- return true; -- } -- else -- return false; -- } -- -- //constructs Input object out of plain string -- this(String input, size_t[] splits) -- { -- allStr=input; -- refStream=Input!(Char)(input,splits); -- stream=new StreamCBuf!(Char)(); -- pos=0; -- if (splits.length) -- { -- stream.addChunk(allStr); -- stream.hasEnd=true; -- } -- else -- stream.addChunk(allStr[0..splits[0]]); -- } -+ res = _origin[0.._index].back; -+ _index -= std.utf.strideBack(_origin, _index); - -- //codepoint at current stream position -- bool nextChar(ref dchar res, ref size_t pos) -- { -- bool ret=stream.nextChar(res,pos); -- dchar refRes; -- size_t refPos; -- if(!res) -- { -- if (stream.hasEnd && refStream.nextChar(refRes,refPos)) -- { -- throw new Exception("stream eneded too early"); -- } -- return false; -- } -- else -- { -- bool refRet=refStream.nextChar(refRes,refPos); -- enforce(refRet==ret,"stream contiinued past end"); -- enforce(refRes==res,"incorrect char "~res~" vs "~refRes); -- enforce(refPos==(pos &~(255UL<<48)),"incorrect pos, string wans't normalized???"); - return true; - } -- } -- -- @property bool atEnd() -- { -- enforce(!stream.atEnd || refStream.atEnd,"stream ended too early"); -- return stream.atEnd; -- } -- -- bool search(Kickstart)(ref Kickstart kick, ref dchar res, ref ulong pos) -- { -- bool ret=stream.search(kick,res,pos); -- dchar refRes; -- size_t refPos; -- if(ret) -- { -- bool refRet=refStream.search(kick,refRes,refPos); -- enforce(refRet,"stream found spurious kickstart match"); -- enforce(refRes==res,"stream found different kickstart match "~res~" vs "~refRes); -- enforce(refPos==(pos &~(255UL<<48)),"stream found different pos for kickstart match, non normalized input?: "~to!string(pos)~" vs "~to!string(refPos)); -- } -- else if(hasEnd) -- { -- enforce(!refStream.search(kick,refRes,refPos),"stream missed kickstart match"); -- } -- return ret; -- } -- -- //index of at End position -- @property size_t lastIndex(){ return _origin.length; } -- -- String opSlice(size_t start, size_t end) -- { -- return _origin[start..end]; -- } -- -- struct BackLooper -- { -- alias ulong DataIndex; -- Input!(Char).BackLooper refBacklooper; -- StreamCBuf!(Char).BackLooper backlooper; -- ulong startPos; -- -- this(Input!(Char).BackLooper refBacklooper,StreamCBuf!(Char).BackLooper backlooper) -- { -- this.refBacklooper=refBacklooper; -- this.backlooper=backlooper; -- } -- bool nextChar(ref dchar res,ref ulong pos) -- { -- bool ret=backlooper.nextChar(res,pos); -- if(ret) -- { -- dchar refRes; -- size_t refPos; -- bool refRet=refBacklooper.nextChar(refRes,refPos); -- enforce(refRet,"stream backlooper goes back beyond start"); -- enforce(refRes==res,"stream backlooper has different char "~res~" vs "~refRes); -- enforce(refPos==(pos &~(255UL<<48)),"stream backlooper has different pos: "~to!string(pos)~" vs "~to!string(refPos)); -- } -- else if (refBacklooper.nextChar(refPos,refPos)) -- { -- enforce(refPos+historySize<=(startPos &~(255UL<<48)),"stream backlooper stopped before historyWindow"); -- } -- return ret; -- } -- @property atEnd(){ -- if(backlooper.atEnd) -- { -- dchar res; -- size_t pos; -- if (refBacklooper.nextChar(res,pos)) -- { -- // this should be mostly true for already normalized/decoded stuff -- enforce(pos+backlooper.streamBuf.historySize<=(startPos &~(255UL<<48)),"backlooper stream ended too early"); -- } -- } -- else -- { -- enforce(backlooper.atEnd,"backlooper stream did not end"); -- } -- return backlooper.atEnd; -- } -- @property auto loopBack(){ return Input(_origin, _index); } -+ @property atEnd(){ return _index == 0 || _index == std.utf.strideBack(_origin, _index); } -+ auto loopBack(size_t index){ return Input(_origin, index); } - - //support for backtracker engine, might not be present -- void reset(size_t index){ _index = index+std.utf.stride(_origin, index); } -+ //void reset(size_t index){ _index = index ? index-std.utf.strideBack(_origin, index) : 0; } -+ void reset(size_t index){ _index = index; } - - String opSlice(size_t start, size_t end){ return _origin[end..start]; } - //index of at End position - @property size_t lastIndex(){ return 0; } - } -- @property auto loopBack(){ return BackLooper(this); } -+ auto loopBack(size_t index){ return BackLooper(this, index); } - } - - //both helperd below are internal, on its own are quite "explosive" -@@ -3174,14 +3149,14 @@ struct StreamTester(Char) - //unsafe, no initialization of elements - @system T[] mallocArray(T)(size_t len) - { -- return (cast(T*)malloc(len*T.sizeof))[0..len]; -+ return (cast(T*)malloc(len * T.sizeof))[0 .. len]; - } - - //very unsafe, no initialization - @system T[] arrayInChunk(T)(size_t len, ref void[] chunk) - { - auto ret = (cast(T*)chunk.ptr)[0..len]; -- chunk = chunk[len*T.sizeof..$]; -+ chunk = chunk[len * T.sizeof .. $]; - return ret; - } - -@@ -3191,7 +3166,7 @@ struct StreamTester(Char) - +/ - template BacktrackingMatcher(bool CTregex) - { -- @trusted struct BacktrackingMatcher(Char, Stream=Input!Char) -+ @trusted struct BacktrackingMatcher(Char, Stream = Input!Char) - if(is(Char : dchar)) - { - alias Stream.DataIndex DataIndex; -@@ -3204,11 +3179,11 @@ template BacktrackingMatcher(bool CTrege - enum stateSize = State.sizeof / size_t.sizeof; - enum initialStack = 1<<16; - alias const(Char)[] String; -- static if(CTregex) -- alias StaticRegex!Char RegEx; -- else -- alias Regex!Char RegEx; -+ alias Regex!Char RegEx; -+ alias MatchFn = bool function (ref BacktrackingMatcher!(Char, Stream)); - RegEx re; //regex program -+ static if(CTregex) -+ MatchFn nativeFn; //native code for that program - //Stream state - Stream s; - DataIndex index; -@@ -3297,19 +3272,34 @@ template BacktrackingMatcher(bool CTrege - return tmp; - } - -- // -+ this(ref RegEx program, Stream stream, void[] memBlock, dchar ch, DataIndex idx) -+ { -+ initialize(program, stream, memBlock); -+ front = ch; -+ index = idx; -+ } -+ - this(ref RegEx program, Stream stream, void[] memBlock) - { - initialize(program, stream, memBlock); - next(); - } - -- // -- this(ref RegEx program, Stream stream, void[] memBlock, dchar ch, DataIndex idx) -+ auto fwdMatcher(ref BacktrackingMatcher matcher, void[] memBlock) - { -- initialize(program, stream, memBlock); -- front = ch; -- index = idx; -+ alias BackMatcherTempl = .BacktrackingMatcher!(CTregex); -+ alias BackMatcher = BackMatcherTempl!(Char, Stream); -+ auto fwdMatcher = BackMatcher(matcher.re, s, memBlock, front, index); -+ return fwdMatcher; -+ } -+ -+ auto bwdMatcher(ref BacktrackingMatcher matcher, void[] memBlock) -+ { -+ alias BackMatcherTempl = .BacktrackingMatcher!(CTregex); -+ alias BackMatcher = BackMatcherTempl!(Char, typeof(s.loopBack(index))); -+ auto fwdMatcher = -+ BackMatcher(matcher.re, s.loopBack(index), memBlock); -+ return fwdMatcher; - } - - // -@@ -3333,7 +3323,7 @@ template BacktrackingMatcher(bool CTrege - //lookup next match, fill matches with indices into input - bool match(Group!DataIndex matches[]) - { -- debug(fred_matching) -+ debug(std_regex_matcher) - { - writeln("------------------------------------------"); - } -@@ -3384,13 +3374,10 @@ template BacktrackingMatcher(bool CTrege - +/ - bool matchImpl() - { -- static if(CTregex && is(typeof(re.nativeFn(this)))) -+ static if(CTregex && is(typeof(nativeFn(this)))) - { -- if(re.nativeFn) -- { -- version(fred_ct) debug writeln("using C-T matcher"); -- return re.nativeFn(this); -- } -+ debug(std_regex_ctr) writeln("using C-T matcher"); -+ return nativeFn(this); - } - else - { -@@ -3399,14 +3386,14 @@ template BacktrackingMatcher(bool CTrege - lastState = 0; - infiniteNesting = -1;//intentional - auto start = s._index; -- debug(fred_matching) -+ debug(std_regex_matcher) - writeln("Try match starting at ", s[index..s.lastIndex]); - for(;;) - { -- debug(fred_matching) -- writefln("PC: %s\tCNT: %s\t%s \tfront: %s src: %s" -- , pc, counter, disassemble(re.ir, pc, re.dict) -- , front, s._index); -+ debug(std_regex_matcher) -+ writefln("PC: %s\tCNT: %s\t%s \tfront: %s src: %s", -+ pc, counter, disassemble(re.ir, pc, re.dict), -+ front, s._index); - switch(re.ir[pc].code) - { - case IR.OrChar://assumes IRL!(OrChar) == 1 -@@ -3416,7 +3403,7 @@ template BacktrackingMatcher(bool CTrege - uint end = pc + len; - if(re.ir[pc].data != front && re.ir[pc+1].data != front) - { -- for(pc = pc+2; pc<end; pc++) -+ for(pc = pc+2; pc < end; pc++) - if(re.ir[pc].data == front) - break; - if(pc == end) -@@ -3459,13 +3446,13 @@ template BacktrackingMatcher(bool CTrege - pc += IRL!(IR.Wordboundary); - break; - } -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - { - pc += IRL!(IR.Wordboundary); - break; - } -- else if(s.loopBack.nextChar(back, index)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back]; -@@ -3482,10 +3469,10 @@ template BacktrackingMatcher(bool CTrege - //at start & end of input - if(atStart && wordTrie[front]) - goto L_backtrack; -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - goto L_backtrack; -- else if(s.loopBack.nextChar(back, index)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back]; -@@ -3500,7 +3487,7 @@ template BacktrackingMatcher(bool CTrege - if(atStart) - pc += IRL!(IR.Bol); - else if((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -+ && s.loopBack(index).nextChar(back,bi) - && endOfLine(back, front == '\n')) - { - pc += IRL!(IR.Bol); -@@ -3511,11 +3498,11 @@ template BacktrackingMatcher(bool CTrege - case IR.Eol: - dchar back; - DataIndex bi; -- debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); -+ debug(std_regex_matcher) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); - //no matching inside \r\n - if(atEnd || ((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -- && endOfLine(front, back == '\r'))) -+ && endOfLine(front, s.loopBack(index).nextChar(back,bi) -+ && back == '\r'))) - { - pc += IRL!(IR.Eol); - } -@@ -3587,7 +3574,7 @@ template BacktrackingMatcher(bool CTrege - case IR.InfiniteEnd: - case IR.InfiniteQEnd: - uint len = re.ir[pc].data; -- debug(fred_matching) writeln("Infinited nesting:", infiniteNesting); -+ debug(std_regex_matcher) writeln("Infinited nesting:", infiniteNesting); - assert(infiniteNesting < trackers.length); - - if(trackers[infiniteNesting] == index) -@@ -3639,13 +3626,13 @@ template BacktrackingMatcher(bool CTrege - case IR.GroupStart: - uint n = re.ir[pc].data; - matches[n].begin = index; -- debug(fred_matching) writefln("IR group #%u starts at %u", n, index); -+ debug(std_regex_matcher) writefln("IR group #%u starts at %u", n, index); - pc += IRL!(IR.GroupStart); - break; - case IR.GroupEnd: - uint n = re.ir[pc].data; - matches[n].end = index; -- debug(fred_matching) writefln("IR group #%u ends at %u", n, index); -+ debug(std_regex_matcher) writefln("IR group #%u ends at %u", n, index); - pc += IRL!(IR.GroupEnd); - break; - case IR.LookaheadStart: -@@ -3655,7 +3642,14 @@ template BacktrackingMatcher(bool CTrege - uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw; - auto mem = malloc(initialMemory(re))[0..initialMemory(re)]; - scope(exit) free(mem.ptr); -- auto matcher = BacktrackingMatcher(re, s, mem, front, index); -+ static if(Stream.isLoopback) -+ { -+ auto matcher = bwdMatcher(this, mem); -+ } -+ else -+ { -+ auto matcher = fwdMatcher(this, mem); -+ } - matcher.matches = matches[ms .. me]; - matcher.backrefed = backrefed.empty ? matches : backrefed; - matcher.re.ir = re.ir[pc+IRL!(IR.LookaheadStart) .. pc+IRL!(IR.LookaheadStart)+len+IRL!(IR.LookaheadEnd)]; -@@ -3675,11 +3669,20 @@ template BacktrackingMatcher(bool CTrege - uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw; - auto mem = malloc(initialMemory(re))[0..initialMemory(re)]; - scope(exit) free(mem.ptr); -- auto backMatcher = BacktrackingMatcher!(Char, typeof(s.loopBack))(re, s.loopBack, mem); -- backMatcher.matches = matches[ms .. me]; -- backMatcher.re.ir = re.ir[pc .. pc+IRL!(IR.LookbehindStart)+len]; -- backMatcher.backrefed = backrefed.empty ? matches : backrefed; -- bool match = backMatcher.matchBackImpl() ^ (re.ir[pc].code == IR.NeglookbehindStart); -+ static if(Stream.isLoopback) -+ { -+ alias Matcher = BacktrackingMatcher!(Char, Stream); -+ auto matcher = Matcher(re, s, mem, front, index); -+ } -+ else -+ { -+ alias Matcher = BacktrackingMatcher!(Char, typeof(s.loopBack(index))); -+ auto matcher = Matcher(re, s.loopBack(index), mem); -+ } -+ matcher.matches = matches[ms .. me]; -+ matcher.re.ir = re.ir[pc + IRL!(IR.LookbehindStart) .. pc + IRL!(IR.LookbehindStart) + len + IRL!(IR.LookbehindEnd)]; -+ matcher.backrefed = backrefed.empty ? matches : backrefed; -+ bool match = matcher.matchImpl() ^ (re.ir[pc].code == IR.NeglookbehindStart); - if(!match) - goto L_backtrack; - else -@@ -3707,9 +3710,12 @@ template BacktrackingMatcher(bool CTrege - break; - case IR.LookaheadEnd: - case IR.NeglookaheadEnd: -+ case IR.LookbehindEnd: -+ case IR.NeglookbehindEnd: - case IR.End: - return true; - default: -+ debug printBytecode(re.ir[0..$]); - assert(0); - L_backtrack: - if(!popState()) -@@ -3747,7 +3753,7 @@ template BacktrackingMatcher(bool CTrege - *cast(T*)&memory[lastState] = val; - enum delta = (T.sizeof+size_t.sizeof/2)/size_t.sizeof; - lastState += delta; -- debug(fred_matching) writeln("push element SP= ", lastState); -+ debug(std_regex_matcher) writeln("push element SP= ", lastState); - } - - void stackPush(T)(T[] val) -@@ -3756,7 +3762,7 @@ template BacktrackingMatcher(bool CTrege - (cast(T*)&memory[lastState])[0..val.length] - = val[0..$]; - lastState += val.length*(T.sizeof/size_t.sizeof); -- debug(fred_matching) writeln("push array SP= ", lastState); -+ debug(std_regex_matcher) writeln("push array SP= ", lastState); - } - - void stackPop(T)(ref T val) -@@ -3765,7 +3771,7 @@ template BacktrackingMatcher(bool CTrege - enum delta = (T.sizeof+size_t.sizeof/2)/size_t.sizeof; - lastState -= delta; - val = *cast(T*)&memory[lastState]; -- debug(fred_matching) writeln("pop element SP= ", lastState); -+ debug(std_regex_matcher) writeln("pop element SP= ", lastState); - } - - void stackPop(T)(T[] val) -@@ -3776,7 +3782,7 @@ template BacktrackingMatcher(bool CTrege - { - lastState -= val.length*(T.sizeof/size_t.sizeof); - val[0..$] = (cast(T*)&memory[lastState])[0..val.length]; -- debug(fred_matching) writeln("pop array SP= ", lastState); -+ debug(std_regex_matcher) writeln("pop array SP= ", lastState); - } - - static if(!CTregex) -@@ -3792,11 +3798,11 @@ template BacktrackingMatcher(bool CTrege - *cast(State*)&memory[lastState] = - State(index, pc, counter, infiniteNesting); - lastState += stateSize; -- memory[lastState..lastState+2*matches.length] = (cast(size_t[])matches)[]; -+ memory[lastState .. lastState + 2 * matches.length] = (cast(size_t[])matches)[]; - lastState += 2*matches.length; -- debug(fred_matching) -- writefln("Saved(pc=%s) front: %s src: %s" -- , pc, front, s[index..s.lastIndex]); -+ debug(std_regex_matcher) -+ writefln("Saved(pc=%s) front: %s src: %s", -+ pc, front, s[index..s.lastIndex]); - } - - //helper function, restores engine state -@@ -3813,7 +3819,7 @@ template BacktrackingMatcher(bool CTrege - pc = state.pc; - counter = state.counter; - infiniteNesting = state.infiniteNesting; -- debug(fred_matching) -+ debug(std_regex_matcher) - { - writefln("Restored matches", front, s[index .. s.lastIndex]); - foreach(i, m; matches) -@@ -3821,383 +3827,29 @@ template BacktrackingMatcher(bool CTrege - } - s.reset(index); - next(); -- debug(fred_matching) -- writefln("Backtracked (pc=%s) front: %s src: %s" -- , pc, front, s[index..s.lastIndex]); -+ debug(std_regex_matcher) -+ writefln("Backtracked (pc=%s) front: %s src: %s", -+ pc, front, s[index..s.lastIndex]); - return true; - } -+ } -+ } -+ } - -- /+ -- Match subexpression against input, executing re.ir backwards. -- Results are stored in matches -- +/ -- -- bool matchBackImpl() -+//very shitty string formatter, $$ replaced with next argument converted to string -+@trusted string ctSub( U...)(string format, U args) -+{ -+ bool seenDollar; -+ foreach(i, ch; format) -+ { -+ if(ch == '$') -+ { -+ if(seenDollar) - { -- pc = cast(uint)re.ir.length-1; -- counter = 0; -- lastState = 0; -- infiniteNesting = -1;//intentional -- auto start = index; -- debug(fred_matching) -- writeln("Try matchBack at ",retro(s[index..s.lastIndex])); -- for(;;) -+ static if(args.length > 0) - { -- debug(fred_matching) -- writefln("PC: %s\tCNT: %s\t%s \tfront: %s src: %s" -- , pc, counter, disassemble(re.ir, pc, re.dict) -- , front, retro(s[index..s.lastIndex])); -- switch(re.ir[pc].code) -- { -- case IR.OrChar://assumes IRL!(OrChar) == 1 -- if(atEnd) -- goto L_backtrack; -- uint len = re.ir[pc].sequence; -- uint end = pc - len; -- if(re.ir[pc].data != front && re.ir[pc-1].data != front) -- { -- for(pc = pc-2; pc>end; pc--) -- if(re.ir[pc].data == front) -- break; -- if(pc == end) -- goto L_backtrack; -- } -- pc = end; -- next(); -- break; -- case IR.Char: -- if(atEnd || front != re.ir[pc].data) -- goto L_backtrack; -- pc--; -- next(); -- break; -- case IR.Any: -- if(atEnd || (!(re.flags & RegexOption.singleline) -- && (front == '\r' || front == '\n'))) -- goto L_backtrack; -- pc--; -- next(); -- break; -- case IR.CodepointSet: -- if(atEnd || !re.charsets[re.ir[pc].data].scanFor(front)) -- goto L_backtrack; -- next(); -- pc--; -- break; -- case IR.Trie: -- if(atEnd || !re.tries[re.ir[pc].data][front]) -- goto L_backtrack; -- next(); -- pc--; -- break; -- case IR.Wordboundary: -- dchar back; -- DataIndex bi; -- //at start & end of input -- if(atStart && wordTrie[front]) -- { -- pc--; -- break; -- } -- else if(atEnd && s.loopBack.nextChar(back, bi) -- && wordTrie[back]) -- { -- pc--; -- break; -- } -- else if(s.loopBack.nextChar(back, index)) -- { -- bool af = wordTrie[front]; -- bool ab = wordTrie[back]; -- if(af ^ ab) -- { -- pc--; -- break; -- } -- } -- goto L_backtrack; -- case IR.Notwordboundary: -- dchar back; -- DataIndex bi; -- //at start & end of input -- if(atStart && wordTrie[front]) -- goto L_backtrack; -- else if(atEnd && s.loopBack.nextChar(back, bi) -- && wordTrie[back]) -- goto L_backtrack; -- else if(s.loopBack.nextChar(back, index)) -- { -- bool af = wordTrie[front]; -- bool ab = wordTrie[back]; -- if(af ^ ab) -- goto L_backtrack; -- } -- pc--; -- break; -- case IR.Bol: -- dchar back; -- DataIndex bi; -- if(atStart) -- pc--; -- else if((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -- && endOfLine(back, front == '\n')) -- { -- pc--; -- } -- else -- goto L_backtrack; -- break; -- case IR.Eol: -- dchar back; -- DataIndex bi; -- debug(fred_matching) -- writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); -- //no matching inside \r\n -- if((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -- && endOfLine(front, back == '\r')) -- { -- pc -= IRL!(IR.Eol); -- } -- else -- goto L_backtrack; -- break; -- case IR.InfiniteStart, IR.InfiniteQStart: -- uint len = re.ir[pc].data; -- assert(infiniteNesting < trackers.length); -- if(trackers[infiniteNesting] == index) -- {//source not consumed -- pc--; //out of loop -- infiniteNesting--; -- break; -- } -- else -- trackers[infiniteNesting] = index; -- if(re.ir[pc].code == IR.InfiniteStart)//greedy -- { -- infiniteNesting--; -- pushState(pc-1, counter);//out of loop -- infiniteNesting++; -- pc += len; -- } -- else -- { -- pushState(pc+len, counter); -- pc--; -- infiniteNesting--; -- } -- break; -- case IR.InfiniteEnd: -- case IR.InfiniteQEnd://now it's a start -- uint len = re.ir[pc].data; -- trackers[infiniteNesting+1] = index; -- pc -= len+IRL!(IR.InfiniteStart); -- assert(re.ir[pc].code == IR.InfiniteStart -- || re.ir[pc].code == IR.InfiniteQStart); -- debug(fred_matching) -- writeln("(backmatch) Infinite nesting:", infiniteNesting); -- if(re.ir[pc].code == IR.InfiniteStart)//greedy -- { -- pushState(pc-1, counter); -- infiniteNesting++; -- pc += len; -- } -- else -- { -- infiniteNesting++; -- pushState(pc + len, counter); -- infiniteNesting--; -- pc--; -- } -- break; -- case IR.RepeatStart, IR.RepeatQStart: -- uint len = re.ir[pc].data; -- uint tail = pc + len + 1; -- uint step = re.ir[tail+2].raw; -- uint min = re.ir[tail+3].raw; -- uint max = re.ir[tail+4].raw; -- if(counter < min) -- { -- counter += step; -- pc += len; -- } -- else if(counter < max) -- { -- if(re.ir[pc].code == IR.RepeatStart)//greedy -- { -- pushState(pc-1, counter%step); -- counter += step; -- pc += len; -- } -- else -- { -- pushState(pc + len, counter + step); -- counter = counter%step; -- pc--; -- } -- } -- else -- { -- counter = counter%step; -- pc--; -- } -- break; -- case IR.RepeatEnd: -- case IR.RepeatQEnd: -- pc -= re.ir[pc].data+IRL!(IR.RepeatStart); -- assert(re.ir[pc].code == IR.RepeatStart || re.ir[pc].code == IR.RepeatQStart); -- goto case IR.RepeatStart; -- case IR.OrEnd: -- uint len = re.ir[pc].data; -- pc -= len; -- assert(re.ir[pc].code == IR.Option); -- len = re.ir[pc].data; -- auto pc_save = pc+len-IRL!(IR.GotoEndOr); -- pc = pc + len + IRL!(IR.Option); -- while(re.ir[pc].code == IR.Option) -- { -- pushState(pc-IRL!(IR.GotoEndOr)-1, counter); -- len = re.ir[pc].data; -- pc += len + IRL!(IR.Option); -- } -- assert(re.ir[pc].code == IR.OrEnd); -- pc--; -- if(pc != pc_save) -- { -- pushState(pc, counter); -- pc = pc_save; -- } -- break; -- case IR.OrStart: -- assert(0); -- case IR.Option: -- assert(re.ir[pc].code == IR.Option); -- pc += re.ir[pc].data + IRL!(IR.Option); -- if(re.ir[pc].code == IR.Option) -- { -- pc--;//hackish, assumes size of IR.Option == 1 -- if(re.ir[pc].code == IR.GotoEndOr) -- { -- pc += re.ir[pc].data + IRL!(IR.GotoEndOr); -- } -- -- } -- assert(re.ir[pc].code == IR.OrEnd); -- pc -= re.ir[pc].data + IRL!(IR.OrStart)+1; -- break; -- case IR.GotoEndOr: -- assert(0); -- case IR.GroupStart: -- uint n = re.ir[pc].data; -- matches[n].begin = index; -- debug(fred_matching) writefln("IR group #%u starts at %u", n, index); -- pc --; -- break; -- case IR.GroupEnd: -- uint n = re.ir[pc].data; -- matches[n].end = index; -- debug(fred_matching) writefln("IR group #%u ends at %u", n, index); -- pc --; -- break; -- case IR.LookaheadStart: -- case IR.NeglookaheadStart: -- assert(0); -- case IR.LookaheadEnd: -- case IR.NeglookaheadEnd: -- uint len = re.ir[pc].data; -- pc -= len + IRL!(IR.LookaheadStart); -- uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw; -- auto mem = malloc(initialMemory(re))[0..initialMemory(re)]; -- scope(exit) free(mem.ptr); -- auto matcher = BacktrackingMatcher!(Char, typeof(s.loopBack))(re, s.loopBack, mem); -- matcher.matches = matches[ms .. me]; -- matcher.backrefed = backrefed.empty ? matches : backrefed; -- matcher.re.ir = re.ir[pc+IRL!(IR.LookaheadStart) .. pc+IRL!(IR.LookaheadStart)+len+IRL!(IR.LookaheadEnd)]; -- bool match = matcher.matchImpl() ^ (re.ir[pc].code == IR.NeglookaheadStart); -- if(!match) -- goto L_backtrack; -- else -- { -- pc --; -- } -- break; -- case IR.LookbehindEnd: -- case IR.NeglookbehindEnd: -- uint len = re.ir[pc].data; -- pc -= len + IRL!(IR.LookbehindStart); -- auto save = index; -- uint ms = re.ir[pc+1].raw, me = re.ir[pc+2].raw; -- auto mem = malloc(initialMemory(re))[0..initialMemory(re)]; -- scope(exit) free(mem.ptr); -- auto matcher = BacktrackingMatcher(re, s, mem, front, index); -- matcher.re.ngroup = me - ms; -- matcher.matches = matches[ms .. me]; -- matcher.backrefed = backrefed.empty ? matches : backrefed; -- matcher.re.ir = re.ir[pc .. pc+IRL!(IR.LookbehindStart)+len]; -- bool match = matcher.matchBackImpl() ^ (re.ir[pc].code == IR.NeglookbehindStart); -- s.reset(save); -- next(); -- if(!match) -- goto L_backtrack; -- else -- { -- pc --; -- } -- break; -- case IR.Backref: -- uint n = re.ir[pc].data; -- auto referenced = re.ir[pc].localRef -- ? s[matches[n].begin .. matches[n].end] -- : s[backrefed[n].begin .. backrefed[n].end]; -- while(!atEnd && !referenced.empty && front == referenced.front) -- { -- next(); -- referenced.popFront(); -- } -- if(referenced.empty) -- pc--; -- else -- goto L_backtrack; -- break; -- case IR.Nop: -- pc --; -- break; -- case IR.LookbehindStart: -- case IR.NeglookbehindStart: -- return true; -- default: -- assert(re.ir[pc].code < 0x80); -- pc --; //data -- break; -- L_backtrack: -- if(!popState()) -- { -- s.reset(start); -- return false; -- } -- } -- } -- return true; -- } -- } -- } --} -- --//very shitty string formatter, $$ replaced with next argument converted to string --@trusted string ctSub( U...)(string format, U args) --{ -- bool seenDollar; -- foreach(i, ch; format) -- { -- if(ch == '$') -- { -- if(seenDollar) -- { -- static if(args.length > 0) -- { -- return format[0..i-1] ~ to!string(args[0]) -- ~ ctSub(format[i+1..$], args[1..$]); -+ return format[0 .. i - 1] ~ to!string(args[0]) -+ ~ ctSub(format[i + 1 .. $], args[1 .. $]); - } - else - assert(0); -@@ -4218,7 +3870,7 @@ template BacktrackingMatcher(bool CTrege - string s = "alias TypeTuple!("; - if(S < E) - s ~= to!string(S); -- for(int i=S+1; i<E;i++) -+ for(int i = S+1; i < E;i++) - { - s ~= ", "; - s ~= to!string(i); -@@ -4236,8 +3888,11 @@ struct CtContext - { - //dirty flags - bool counter, infNesting; -- int nInfLoops; // to make a unique advancement counter per loop -+ // to make a unique advancement counter per nesting level of loops -+ int curInfLoop, nInfLoops; -+ //to mark the portion of matches to save - int match, total_matches; -+ int reserved; - - - //state of codegenerator -@@ -4250,9 +3905,18 @@ struct CtContext - this(Char)(Regex!Char re) - { - match = 1; -+ reserved = 1; //first match is skipped - total_matches = re.ngroup; - } - -+ CtContext lookaround() -+ { -+ CtContext ct; -+ ct.total_matches = total_matches; -+ ct.match = 1; -+ return ct; -+ } -+ - //restore state having current context - string restoreCode() - { -@@ -4266,13 +3930,13 @@ struct CtContext - if(match < total_matches) - { - text ~= ctSub(" -- stackPop(matches[1..$$]);", match); -+ stackPop(matches[$$..$$]);", reserved, match); - text ~= ctSub(" - matches[$$..$] = typeof(matches[0]).init;", match); - } - else -- text ~= " -- stackPop(matches[1..$]);"; -+ text ~= ctSub(" -+ stackPop(matches[$$..$]);", reserved); - return text; - } - -@@ -4284,13 +3948,13 @@ struct CtContext - { - newStack(); - lastState = 0; -- }", match-1, cast(int)counter + 2); -+ }", match - reserved, cast(int)counter + 2); - if(match < total_matches) - text ~= ctSub(" -- stackPush(matches[1..$$]);", match); -+ stackPush(matches[$$..$$]);", reserved, match); - else -- text ~= " -- stackPush(matches[1..$]);"; -+ text ~= ctSub(" -+ stackPush(matches[$$..$]);", reserved); - text ~= counter ? ctSub(" - stackPush($$);", count_expr) : ""; - text ~= ctSub(" -@@ -4315,6 +3979,8 @@ struct CtContext - // - CtState ctGenGroup(ref Bytecode[] ir, int addr) - { -+ auto bailOut = "goto L_backtrack;"; -+ auto nextInstr = ctSub("goto case $$;", addr+1); - CtState r; - assert(!ir.empty); - switch(ir[0].code) -@@ -4324,15 +3990,20 @@ struct CtContext - ir[0].code == IR.InfiniteStart || ir[0].code == IR.InfiniteQStart; - infNesting = infNesting || infLoop; - if(infLoop) -- nInfLoops++; -+ { -+ curInfLoop++; -+ nInfLoops = max(nInfLoops, curInfLoop+1); -+ } - counter = counter || - ir[0].code == IR.RepeatStart || ir[0].code == IR.RepeatQStart; - uint len = ir[0].data; - auto nir = ir[ir[0].length .. ir[0].length+len]; - r = ctGenBlock(nir, addr+1); -+ if(infLoop) -+ curInfLoop--; - //start/end codegen - //r.addr is at last test+ jump of loop, addr+1 is body of loop -- nir = ir[ir[0].length+len..$]; -+ nir = ir[ir[0].length + len .. $]; - r.code = ctGenFixupCode(ir[0..ir[0].length], addr, r.addr) ~ r.code; - r.code ~= ctGenFixupCode(nir, r.addr, addr+1); - r.addr += 2; //account end instruction + restore state -@@ -4342,10 +4013,69 @@ struct CtContext - uint len = ir[0].data; - auto nir = ir[ir[0].length .. ir[0].length+len]; - r = ctGenAlternation(nir, addr); -- ir = ir[ir[0].length+len..$]; -+ ir = ir[ir[0].length + len .. $]; - assert(ir[0].code == IR.OrEnd); - ir = ir[ir[0].length..$]; - break; -+ case IR.LookaheadStart: -+ case IR.NeglookaheadStart: -+ case IR.LookbehindStart: -+ case IR.NeglookbehindStart: -+ uint len = ir[0].data; -+ bool behind = ir[0].code == IR.LookbehindStart || ir[0].code == IR.NeglookbehindStart; -+ bool negative = ir[0].code == IR.NeglookaheadStart || ir[0].code == IR.NeglookbehindStart; -+ string fwdType = "typeof(fwdMatcher(matcher, []))"; -+ string bwdType = "typeof(bwdMatcher(matcher, []))"; -+ string fwdCreate = "fwdMatcher(matcher, mem)"; -+ string bwdCreate = "bwdMatcher(matcher, mem)"; -+ uint start = IRL!(IR.LookbehindStart); -+ uint end = IRL!(IR.LookbehindStart)+len+IRL!(IR.LookaheadEnd); -+ CtContext context = lookaround(); //split off new context -+ auto slice = ir[start .. end]; -+ r.code ~= ctSub(` -+ case $$: //fake lookaround "atom" -+ static if(typeof(matcher.s).isLoopback) -+ alias Lookaround = $$; -+ else -+ alias Lookaround = $$; -+ static bool matcher_$$(ref Lookaround matcher) @trusted -+ { -+ //(neg)lookaround piece start -+ $$ -+ //(neg)lookaround piece ends -+ } -+ auto save = index; -+ auto mem = malloc(initialMemory(re))[0..initialMemory(re)]; -+ scope(exit) free(mem.ptr); -+ static if(typeof(matcher.s).isLoopback) -+ auto lookaround = $$; -+ else -+ auto lookaround = $$; -+ lookaround.matches = matches[$$..$$]; -+ lookaround.backrefed = backrefed.empty ? matches : backrefed; -+ lookaround.nativeFn = &matcher_$$; //hookup closure's binary code -+ bool match = $$; -+ s.reset(save); -+ next(); -+ if(match) -+ $$ -+ else -+ $$`, addr, -+ behind ? fwdType : bwdType, behind ? bwdType : fwdType, -+ addr, context.ctGenRegEx(slice), -+ behind ? fwdCreate : bwdCreate, behind ? bwdCreate : fwdCreate, -+ ir[1].raw, ir[2].raw, //start - end of matches slice -+ addr, -+ negative ? "!lookaround.matchImpl()" : "lookaround.matchImpl()", -+ nextInstr, bailOut); -+ ir = ir[end .. $]; -+ r.addr = addr + 1; -+ break; -+ case IR.LookaheadEnd: case IR.NeglookaheadEnd: -+ case IR.LookbehindEnd: case IR.NeglookbehindEnd: -+ ir = ir[IRL!(IR.LookaheadEnd) .. $]; -+ r.addr = addr; -+ break; - default: - assert(ir[0].isAtom, text(ir[0].mnemonic)); - r = ctGenAtom(ir, addr); -@@ -4362,16 +4092,16 @@ struct CtContext - for(;;) - { - assert(ir[0].code == IR.Option); -- auto len = ir[0].data; -- auto nir = ir[optL .. optL+len-IRL!(IR.GotoEndOr)]; -+ auto len = ir[0].data; - if(optL+len < ir.length && ir[optL+len].code == IR.Option)//not a last option - { -+ auto nir = ir[optL .. optL+len-IRL!(IR.GotoEndOr)]; - r = ctGenBlock(nir, addr+2);//space for Option + restore state - //r.addr+1 to account GotoEndOr at end of branch - r.code = ctGenFixupCode(ir[0 .. ir[0].length], addr, r.addr+1) ~ r.code; - addr = r.addr+1;//leave space for GotoEndOr - pieces ~= r; -- ir = ir[optL+len..$]; -+ ir = ir[optL + len .. $]; - } - else - { -@@ -4379,10 +4109,9 @@ struct CtContext - addr = pieces[$-1].addr; - break; - } -- - } - r = pieces[0]; -- for(uint i=1; i<pieces.length; i++) -+ for(uint i = 1; i < pieces.length; i++) - { - r.code ~= ctSub(` - case $$: -@@ -4404,18 +4133,18 @@ struct CtContext - string r; - string testCode; - r = ctSub(` -- case $$: debug(fred_matching) writeln("$$");`, -+ case $$: debug(std_regex_matcher) writeln("#$$");`, - addr, addr); - switch(ir[0].code) - { - case IR.InfiniteStart, IR.InfiniteQStart: - r ~= ctSub( ` - tracker_$$ = DataIndex.max; -- goto case $$;`, nInfLoops-1, fixup); -+ goto case $$;`, curInfLoop, fixup); - ir = ir[ir[0].length..$]; - break; - case IR.InfiniteEnd: -- testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd)..$],addr+1); -+ testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd) .. $],addr + 1); - r ~= ctSub( ` - if(tracker_$$ == index) - {//source not consumed -@@ -4430,13 +4159,13 @@ struct CtContext - goto case $$; - case $$: //restore state and go out of loop - $$ -- goto case;`, nInfLoops-1, addr+2 -- , nInfLoops-1, testCode, saveCode(addr+1) -- , fixup, addr+1, restoreCode()); -+ goto case;`, curInfLoop, addr+2, -+ curInfLoop, testCode, saveCode(addr+1), -+ fixup, addr+1, restoreCode()); - ir = ir[ir[0].length..$]; - break; - case IR.InfiniteQEnd: -- testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd)..$],addr+1); -+ testCode = ctQuickTest(ir[IRL!(IR.InfiniteEnd) .. $],addr + 1); - r ~= ctSub( ` - if(tracker_$$ == index) - {//source not consumed -@@ -4453,9 +4182,9 @@ struct CtContext - goto case $$; - case $$://restore state and go inside loop - $$ -- goto case $$;`, nInfLoops-1, addr+2, nInfLoops-1 -- , testCode, saveCode(addr+1) -- , addr+2, fixup, addr+1, restoreCode(), fixup); -+ goto case $$;`, curInfLoop, addr+2, curInfLoop, -+ testCode, saveCode(addr+1), -+ addr+2, fixup, addr+1, restoreCode(), fixup); - ir = ir[ir[0].length..$]; - break; - case IR.RepeatStart, IR.RepeatQStart: -@@ -4472,7 +4201,7 @@ struct CtContext - r ~= ctSub(` - if(counter < $$) - { -- debug(fred_matching) writeln("RepeatEnd min case pc=", $$); -+ debug(std_regex_matcher) writeln("RepeatEnd min case pc=", $$); - counter += $$; - goto case $$; - }`, min, addr, step, fixup); -@@ -4506,22 +4235,22 @@ struct CtContext - } - case $$: //restore state - $$ -- goto case $$;`, step, addr+2, addr+1, restoreCode() -- , ir[0].code == IR.RepeatEnd ? addr+2 : fixup ); -+ goto case $$;`, step, addr+2, addr+1, restoreCode(), -+ ir[0].code == IR.RepeatEnd ? addr+2 : fixup ); - ir = ir[ir[0].length..$]; -- break; -+ break; - case IR.Option: -- r ~= ctSub( ` -- { -- $$ -- } -- goto case $$; -- case $$://restore thunk to go to the next group -+ r ~= ctSub( ` -+ { - $$ -- goto case $$;`, saveCode(addr+1), addr+2 -- , addr+1, restoreCode(), fixup); -+ } -+ goto case $$; -+ case $$://restore thunk to go to the next group -+ $$ -+ goto case $$;`, saveCode(addr+1), addr+2, -+ addr+1, restoreCode(), fixup); - ir = ir[ir[0].length..$]; -- break; -+ break; - default: - assert(0, text(ir[0].mnemonic)); - } -@@ -4531,7 +4260,7 @@ struct CtContext - - string ctQuickTest(Bytecode[] ir, int id) - { -- uint pc=0; -+ uint pc = 0; - while(pc < ir.length && ir[pc].isAtom) - { - if(ir[pc].code == IR.GroupStart || ir[pc].code == IR.GroupEnd) -@@ -4546,8 +4275,8 @@ struct CtContext - { - $$ //$$ - } -- if(test_$$() >= 0)`, id, code ? code : "return 0;" -- , ir[pc].mnemonic, id); -+ if(test_$$() >= 0)`, id, code ? code : "return 0;", -+ ir[pc].mnemonic, id); - } - } - return ""; -@@ -4578,7 +4307,7 @@ struct CtContext - bailOut = "goto L_backtrack;"; - nextInstr = ctSub("goto case $$;", addr+1); - code ~= ctSub( ` -- case $$: debug(fred_matching) writeln("#$$"); -+ case $$: debug(std_regex_matcher) writeln("#$$"); - `, addr, addr); - } - switch(ir[0].code) -@@ -4588,7 +4317,7 @@ struct CtContext - if(atEnd) - $$`, bailOut); - uint len = ir[0].sequence; -- for(uint i = 0; i<len; i++) -+ for(uint i = 0; i < len; i++) - { - code ~= ctSub( ` - if(front == $$) -@@ -4637,12 +4366,12 @@ struct CtContext - { - $$ - } -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - { - $$ - } -- else if(s.loopBack.nextChar(back, bi)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back]; -@@ -4651,8 +4380,7 @@ struct CtContext - $$ - } - } -- $$` -- , nextInstr, nextInstr, nextInstr, bailOut); -+ $$`, nextInstr, nextInstr, nextInstr, bailOut); - break; - case IR.Notwordboundary: - code ~= ctSub( ` -@@ -4661,10 +4389,10 @@ struct CtContext - //at start & end of input - if(atStart && wordTrie[front]) - $$ -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - $$ -- else if(s.loopBack.nextChar(back, index)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back]; -@@ -4679,9 +4407,10 @@ struct CtContext - dchar back; - DataIndex bi; - if(atStart || ((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -+ && s.loopBack(index).nextChar(back,bi) - && endOfLine(back, front == '\n'))) - { -+ debug(std_regex_matcher) writeln("BOL matched"); - $$ - } - else -@@ -4692,12 +4421,13 @@ struct CtContext - code ~= ctSub(` - dchar back; - DataIndex bi; -- debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); -+ debug(std_regex_matcher) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); - //no matching inside \r\n - if(atEnd || ((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -- && endOfLine(front, back == '\r'))) -+ && endOfLine(front, s.loopBack(index).nextChar(back,bi) -+ && back == '\r'))) - { -+ debug(std_regex_matcher) writeln("EOL matched"); - $$ - } - else -@@ -4716,9 +4446,12 @@ struct CtContext - $$`, ir[0].data, nextInstr); - break; - case IR.Backref: -- string mStr = ir[0].localRef -- ? ctSub("matches[$$].begin .. matches[$$].end];", ir[0].data, ir[0].data) -- : ctSub("s[backrefed[$$].begin .. backrefed[$$].end];",ir[0].data, ir[0].data); -+ string mStr = "auto referenced = "; -+ mStr ~= ir[0].localRef -+ ? ctSub("s[matches[$$].begin .. matches[$$].end];", -+ ir[0].data, ir[0].data) -+ : ctSub("s[backrefed[$$].begin .. backrefed[$$].end];", -+ ir[0].data, ir[0].data); - code ~= ctSub( ` - $$ - while(!atEnd && !referenced.empty && front == referenced.front) -@@ -4735,15 +4468,15 @@ struct CtContext - case IR.End: - break; - default: -- assert(0, text(ir[0].mnemonic, "is not supported yet")); -+ assert(0, text(ir[0].mnemonic, " is not supported yet")); - } - return code; - } - - //generate D code for the whole regex -- public string ctGenRegEx(Char)(ref Regex!Char re) -+ public string ctGenRegEx(Bytecode[] ir) - { -- auto bdy = ctGenBlock(re.ir, 0); -+ auto bdy = ctGenBlock(ir, 0); - auto r = ` - with(matcher) - { -@@ -4751,12 +4484,12 @@ struct CtContext - counter = 0; - lastState = 0; - auto start = s._index;`; -- for(int i=0; i<nInfLoops; i++) -+ for(int i = 0; i < nInfLoops; i++) - r ~= ctSub(` - size_t tracker_$$;`, i); - r ~= ` - goto StartLoop; -- debug(fred_matching) writeln("Try CT matching starting at ",s[index..s.lastIndex]); -+ debug(std_regex_matcher) writeln("Try CT matching starting at ",s[index..s.lastIndex]); - L_backtrack: - if(lastState || prevStack()) - { -@@ -4792,7 +4525,7 @@ struct CtContext - string ctGenRegExCode(Char)(Regex!Char re) - { - auto context = CtContext(re); -- return context.ctGenRegEx(re); -+ return context.ctGenRegEx(re.ir); - } - - //State of VM thread -@@ -4808,7 +4541,7 @@ struct Thread(DataIndex) - //head-tail singly-linked list - struct ThreadList(DataIndex) - { -- Thread!DataIndex* tip=null, toe=null; -+ Thread!DataIndex* tip = null, toe = null; - //add new thread to the start of list - void insertFront(Thread!DataIndex* t) - { -@@ -4875,7 +4608,7 @@ enum OneShot { Fwd, Bwd }; - Thomspon matcher does all matching in lockstep, - never looking at the same char twice - +/ --@trusted struct ThompsonMatcher(Char, Stream=Input!Char) -+@trusted struct ThompsonMatcher(Char, Stream = Input!Char) - if(is(Char : dchar)) - { - alias Stream.DataIndex DataIndex; -@@ -4968,6 +4701,22 @@ enum OneShot { Fwd, Bwd }; - merge = matcher.merge; - genCounter = matcher.genCounter; - freelist = matcher.freelist; -+ front = matcher.front; -+ index = matcher.index; -+ } -+ -+ auto fwdMatcher()(Bytecode[] piece) -+ { -+ auto m = ThompsonMatcher!(Char, Stream)(this, piece, s); -+ return m; -+ } -+ -+ auto bwdMatcher()(Bytecode[] piece) -+ { -+ alias BackLooper = typeof(s.loopBack(index)); -+ auto m = ThompsonMatcher!(Char, BackLooper)(this, piece, s.loopBack(index)); -+ m.next(); -+ return m; - } - - auto dupTo(void[] memory) -@@ -4987,7 +4736,7 @@ enum OneShot { Fwd, Bwd }; - //match the input and fill matches - bool match(Group!DataIndex[] matches) - { -- debug(fred_matching) -+ debug(std_regex_matcher) - writeln("------------------------------------------"); - if(exhausted) - { -@@ -4997,7 +4746,7 @@ enum OneShot { Fwd, Bwd }; - { - next(); - exhausted = true; -- return matchOneShot!(OneShot.Fwd)(matches)==MatchResult.Match; -+ return matchOneShot(matches)==MatchResult.Match; - } - static if(kicked) - auto searchFn = re.kickstart.empty ? &this.next : &this.search; -@@ -5016,7 +4765,7 @@ enum OneShot { Fwd, Bwd }; - for(;;) - { - genCounter++; -- debug(fred_matching) -+ debug(std_regex_matcher) - { - writefln("Threaded matching threads at %s", s[index..s.lastIndex]); - foreach(t; clist[]) -@@ -5035,7 +4784,7 @@ enum OneShot { Fwd, Bwd }; - eval!true(createStart(index), matches);//new thread staring at this position - else if(nlist.empty) - { -- debug(fred_matching) writeln("Stopped matching before consuming full input"); -+ debug(std_regex_matcher) writeln("Stopped matching before consuming full input"); - break;//not a partial match for sure - } - clist = nlist; -@@ -5054,7 +4803,7 @@ enum OneShot { Fwd, Bwd }; - } - - genCounter++; //increment also on each end -- debug(fred_matching) writefln("Threaded matching threads at end"); -+ debug(std_regex_matcher) writefln("Threaded matching threads at end"); - //try out all zero-width posibilities - for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch()) - { -@@ -5082,7 +4831,7 @@ enum OneShot { Fwd, Bwd }; - void finish(const(Thread!DataIndex)* t, Group!DataIndex[] matches) - { - matches.ptr[0..re.ngroup] = t.matches.ptr[0..re.ngroup]; -- debug(fred_matching) -+ debug(std_regex_matcher) - { - writef("FOUND pc=%s prog_len=%s", - t.pc, re.ir.length); -@@ -5101,10 +4850,10 @@ enum OneShot { Fwd, Bwd }; - void eval(bool withInput)(Thread!DataIndex* t, Group!DataIndex[] matches) - { - ThreadList!DataIndex worklist; -- debug(fred_matching) writeln("---- Evaluating thread"); -+ debug(std_regex_matcher) writeln("---- Evaluating thread"); - for(;;) - { -- debug(fred_matching) -+ debug(std_regex_matcher) - { - writef("\tpc=%s [", t.pc); - foreach(x; worklist[]) -@@ -5120,7 +4869,7 @@ enum OneShot { Fwd, Bwd }; - //cut off low priority threads - recycle(clist); - recycle(worklist); -- debug(fred_matching) writeln("Finished thread ", matches); -+ debug(std_regex_matcher) writeln("Finished thread ", matches); - return; - case IR.Wordboundary: - dchar back; -@@ -5131,13 +4880,13 @@ enum OneShot { Fwd, Bwd }; - t.pc += IRL!(IR.Wordboundary); - break; - } -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - { - t.pc += IRL!(IR.Wordboundary); - break; - } -- else if(s.loopBack.nextChar(back, index)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back]; -@@ -5164,7 +4913,7 @@ enum OneShot { Fwd, Bwd }; - return; - break; - } -- else if(atEnd && s.loopBack.nextChar(back, bi) -+ else if(atEnd && s.loopBack(index).nextChar(back, bi) - && wordTrie[back]) - { - recycle(t); -@@ -5173,7 +4922,7 @@ enum OneShot { Fwd, Bwd }; - return; - break; - } -- else if(s.loopBack.nextChar(back, index)) -+ else if(s.loopBack(index).nextChar(back, bi)) - { - bool af = wordTrie[front]; - bool ab = wordTrie[back] != 0; -@@ -5193,7 +4942,7 @@ enum OneShot { Fwd, Bwd }; - DataIndex bi; - if(atStart - ||( (re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -+ && s.loopBack(index).nextChar(back,bi) - && startOfLine(back, front == '\n'))) - { - t.pc += IRL!(IR.Bol); -@@ -5207,12 +4956,12 @@ enum OneShot { Fwd, Bwd }; - } - break; - case IR.Eol: -- debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); -+ debug(std_regex_matcher) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); - dchar back; - DataIndex bi; - //no matching inside \r\n - if(atEnd || ((re.flags & RegexOption.multiline) -- && endOfLine(front, s.loopBack.nextChar(back, bi) -+ && endOfLine(front, s.loopBack(index).nextChar(back, bi) - && back == '\r'))) - { - t.pc += IRL!(IR.Eol); -@@ -5245,13 +4994,13 @@ enum OneShot { Fwd, Bwd }; - } - if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter) - { -- debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -+ debug(std_regex_matcher) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", - t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); - merge[re.ir[t.pc + 1].raw+t.counter] = genCounter; - } - else - { -- debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -+ debug(std_regex_matcher) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", - t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); - recycle(t); - t = worklist.fetch(); -@@ -5287,13 +5036,13 @@ enum OneShot { Fwd, Bwd }; - case IR.InfiniteQEnd: - if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter) - { -- debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -+ debug(std_regex_matcher) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", - t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); - merge[re.ir[t.pc + 1].raw+t.counter] = genCounter; - } - else - { -- debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -+ debug(std_regex_matcher) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", - t.pc, index, genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); - recycle(t); - t = worklist.fetch(); -@@ -5333,15 +5082,15 @@ enum OneShot { Fwd, Bwd }; - case IR.OrEnd: - if(merge[re.ir[t.pc + 1].raw+t.counter] < genCounter) - { -- debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -- t.pc, s[index..s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); -+ debug(std_regex_matcher) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -+ t.pc, s[index .. s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw + t.counter] ); - merge[re.ir[t.pc + 1].raw+t.counter] = genCounter; - t.pc += IRL!(IR.OrEnd); - } - else - { -- debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -- t.pc, s[index..s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw+t.counter] ); -+ debug(std_regex_matcher) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -+ t.pc, s[index .. s.lastIndex], genCounter, merge[re.ir[t.pc + 1].raw + t.counter] ); - recycle(t); - t = worklist.fetch(); - if(!t) -@@ -5413,17 +5162,22 @@ enum OneShot { Fwd, Bwd }; - break; - case IR.LookbehindStart: - case IR.NeglookbehindStart: -- auto matcher = -- ThompsonMatcher!(Char, typeof(s.loopBack)) -- (this, re.ir[t.pc..t.pc+re.ir[t.pc].data+IRL!(IR.LookbehindStart)], s.loopBack); -+ uint len = re.ir[t.pc].data; -+ uint ms = re.ir[t.pc + 1].raw, me = re.ir[t.pc + 2].raw; -+ uint end = t.pc + len + IRL!(IR.LookbehindEnd) + IRL!(IR.LookbehindStart); -+ bool positive = re.ir[t.pc].code == IR.LookbehindStart; -+ static if(Stream.isLoopback) -+ auto matcher = fwdMatcher(re.ir[t.pc .. end]); -+ else -+ auto matcher = bwdMatcher(re.ir[t.pc .. end]); - matcher.re.ngroup = re.ir[t.pc+2].raw - re.ir[t.pc+1].raw; - matcher.backrefed = backrefed.empty ? t.matches : backrefed; - //backMatch -- matcher.next(); //load first character from behind -- bool match = (matcher.matchOneShot!(OneShot.Bwd)(t.matches)==MatchResult.Match) ^ (re.ir[t.pc].code == IR.LookbehindStart); -+ bool nomatch = (matcher.matchOneShot(t.matches, IRL!(IR.LookbehindStart)) -+ == MatchResult.Match) ^ positive; - freelist = matcher.freelist; - genCounter = matcher.genCounter; -- if(match) -+ if(nomatch) - { - recycle(t); - t = worklist.fetch(); -@@ -5432,31 +5186,23 @@ enum OneShot { Fwd, Bwd }; - break; - } - else -- t.pc += re.ir[t.pc].data + IRL!(IR.LookbehindStart) + IRL!(IR.LookbehindEnd); -+ t.pc = end; - break; -- case IR.LookaheadEnd: -- case IR.NeglookaheadEnd: -- t.pc = re.ir[t.pc].indexOfPair(t.pc); -- assert(re.ir[t.pc].code == IR.LookaheadStart || re.ir[t.pc].code == IR.NeglookaheadStart); -- uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw; -- finish(t, matches.ptr[ms..me]); -- recycle(t); -- //cut off low priority threads -- recycle(clist); -- recycle(worklist); -- return; - case IR.LookaheadStart: - case IR.NeglookaheadStart: - auto save = index; - uint len = re.ir[t.pc].data; - uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw; -+ uint end = t.pc+len+IRL!(IR.LookaheadEnd)+IRL!(IR.LookaheadStart); - bool positive = re.ir[t.pc].code == IR.LookaheadStart; -- auto matcher = ThompsonMatcher(this, re.ir[t.pc .. t.pc+len+IRL!(IR.LookaheadEnd)+IRL!(IR.LookaheadStart)], s); -- matcher.front = front; -- matcher.index = index; -+ static if(Stream.isLoopback) -+ auto matcher = bwdMatcher(re.ir[t.pc .. end]); -+ else -+ auto matcher = fwdMatcher(re.ir[t.pc .. end]); - matcher.re.ngroup = me - ms; - matcher.backrefed = backrefed.empty ? t.matches : backrefed; -- bool nomatch = (matcher.matchOneShot!(OneShot.Fwd)(t.matches, IRL!(IR.LookaheadStart)) == MatchResult.Match) ^ positive; -+ bool nomatch = (matcher.matchOneShot(t.matches, IRL!(IR.LookaheadStart)) -+ == MatchResult.Match) ^ positive; - freelist = matcher.freelist; - genCounter = matcher.genCounter; - s.reset(index); -@@ -5470,11 +5216,20 @@ enum OneShot { Fwd, Bwd }; - break; - } - else -- t.pc += len + IRL!(IR.LookaheadEnd) + IRL!(IR.LookaheadStart); -+ t.pc = end; - break; -+ case IR.LookaheadEnd: -+ case IR.NeglookaheadEnd: - case IR.LookbehindEnd: - case IR.NeglookbehindEnd: -- assert(0); -+ t.pc = re.ir[t.pc].indexOfPair(t.pc); -+ uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw; -+ finish(t, matches.ptr[ms..me]); -+ recycle(t); -+ //cut off low priority threads -+ recycle(clist); -+ recycle(worklist); -+ return; - case IR.Nop: - t.pc += IRL!(IR.Nop); - break; -@@ -5485,7 +5240,7 @@ enum OneShot { Fwd, Bwd }; - uint len = re.ir[t.pc].sequence; - uint end = t.pc + len; - static assert(IRL!(IR.OrChar) == 1); -- for(; t.pc<end; t.pc++) -+ for(; t.pc < end; t.pc++) - if(re.ir[t.pc].data == front) - break; - if(t.pc != end) -@@ -5544,533 +5299,92 @@ enum OneShot { Fwd, Bwd }; - } - else - { -- recycle(t); -- } -- t = worklist.fetch(); -- if(!t) -- return; -- break; -- default: -- assert(0, "Unrecognized instruction " ~ re.ir[t.pc].mnemonic); -- } -- else -- { -- default: -- recycle(t); -- t = worklist.fetch(); -- if(!t) -- return; -- } -- } -- } -- -- } -- enum uint RestartPc=uint.max; -- //match the input, evaluating IR without searching -- MatchResult matchOneShot(OneShot direction)(Group!DataIndex[] matches, uint startPc=0) -- { -- debug(fred_matching) -- { -- writefln("---------------single shot match %s----------------- ", -- direction == OneShot.Fwd ? "forward" : "backward"); -- } -- static if(direction == OneShot.Fwd) -- alias eval evalFn; -- else -- alias evalBack evalFn; -- assert(clist == (ThreadList!DataIndex).init || startPc==RestartPc); // incorrect after a partial match -- assert(nlist == (ThreadList!DataIndex).init || startPc==RestartPc); -- static if(direction == OneShot.Fwd) -- startPc = startPc; -- else -- startPc = cast(uint)re.ir.length-IRL!(IR.LookbehindEnd); -- if(!atEnd)//if no char -- { -- debug(fred_matching) -- { -- static if(direction == OneShot.Fwd) -- writefln("-- Threaded matching (forward) threads at %s", s[index..s.lastIndex]); -- else -- writefln("-- Threaded matching (backward) threads at %s", retro(s[index..s.lastIndex])); -- } -- if(startPc!=RestartPc) -- { -- auto startT = createStart(index, startPc); -- genCounter++; -- evalFn!true(startT, matches); -- } -- for(;;) -- { -- debug(fred_matching) writeln("\n-- Started iteration of main cycle"); -- genCounter++; -- debug(fred_matching) -- { -- foreach(t; clist[]) -- { -- assert(t); -- } -- } -- for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch()) -- { -- evalFn!true(t, matches); -- } -- if(nlist.empty) -- { -- debug(fred_matching) writeln("Stopped matching before consuming full input"); -- break;//not a partial match for sure -- } -- clist = nlist; -- nlist = (ThreadList!DataIndex).init; -- if(!next()) -- { -- if (!atEnd) return MatchResult.PartialMatch; -- break; -- } -- debug(fred_matching) writeln("-- Ended iteration of main cycle\n"); -- } -- } -- genCounter++; //increment also on each end -- debug(fred_matching) writefln("-- Threaded matching (%s) threads at end", -- direction == OneShot.Fwd ? "forward" : "backward"); -- //try out all zero-width posibilities -- for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch()) -- { -- evalFn!false(t, matches); -- } -- if(!matched) -- evalFn!false(createStart(index, startPc), matches); -- -- return (matched?MatchResult.Match:MatchResult.NoMatch); -- } -- -- /+ -- a version of eval that executes IR backwards -- +/ -- void evalBack(bool withInput)(Thread!DataIndex* t, Group!DataIndex[] matches) -- { -- ThreadList!DataIndex worklist; -- debug(fred_matching) writeln("---- Evaluating thread backwards"); -- do -- { -- debug(fred_matching) -- { -- writef("\tpc=%s [", t.pc); -- foreach(x; worklist[]) -- writef(" %s ", x.pc); -- writeln("]"); -- } -- debug(fred_matching) writeln(disassemble(re.ir, t.pc)); -- switch(re.ir[t.pc].code) -- { -- case IR.Wordboundary: -- dchar back; -- DataIndex bi; -- //at start & end of input -- if(atStart && wordTrie[front]) -- { -- t.pc--; -- break; -- } -- else if(atEnd && s.loopBack.nextChar(back, bi) -- && wordTrie[back]) -- { -- t.pc--; -- break; -- } -- else if(s.loopBack.nextChar(back, index)) -- { -- bool af = wordTrie[front]; -- bool ab = wordTrie[back]; -- if(af ^ ab) -- { -- t.pc--; -- break; -- } -- } -- recycle(t); -- t = worklist.fetch(); -- break; -- case IR.Notwordboundary: -- dchar back; -- DataIndex bi; -- //at start & end of input -- if(atStart && wordTrie[front]) -- { -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- else if(atEnd && s.loopBack.nextChar(back, bi) -- && wordTrie[back]) -- { -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- else if(s.loopBack.nextChar(back, index)) -- { -- bool af = wordTrie[front]; -- bool ab = wordTrie[back]; -- if(af ^ ab) -- { -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- } -- t.pc--; -- break; -- case IR.Bol: -- dchar back; -- DataIndex bi; -- if(atStart -- ||((re.flags & RegexOption.multiline) -- && s.loopBack.nextChar(back,bi) -- && startOfLine(back, front == '\n'))) -- { -- t.pc--; -- } -- else -- { -- recycle(t); -- t = worklist.fetch(); -- } -- break; -- case IR.Eol: -- debug(fred_matching) writefln("EOL (front 0x%x) %s", front, s[index..s.lastIndex]); -- dchar back; -- DataIndex bi; -- //no matching inside \r\n -- if((re.flags & RegexOption.multiline) -- && endOfLine(front, s.loopBack.nextChar(back, bi) -- && back == '\r')) -- { -- t.pc--; -- } -- else -- { -- recycle(t); -- t = worklist.fetch(); -- } -- break; -- case IR.InfiniteStart, IR.InfiniteQStart: -- uint len = re.ir[t.pc].data; -- uint mIdx = t.pc + len + IRL!(IR.InfiniteEnd); //we're always pointed at the tail of instruction -- if(merge[re.ir[mIdx].raw+t.counter] < genCounter) -- { -- debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] ); -- merge[re.ir[mIdx].raw+t.counter] = genCounter; -- } -- else -- { -- debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] ); -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- if(re.ir[t.pc].code == IR.InfiniteStart)//greedy -- { -- worklist.insertFront(fork(t, t.pc-1, t.counter)); -- t.pc += len; -- } -- else -- { -- worklist.insertFront(fork(t, t.pc+len, t.counter)); -- t.pc--; -- } -- break; -- case IR.InfiniteEnd: -- case IR.InfiniteQEnd://now it's a start -- uint len = re.ir[t.pc].data; -- t.pc -= len+IRL!(IR.InfiniteStart); -- assert(re.ir[t.pc].code == IR.InfiniteStart || re.ir[t.pc].code == IR.InfiniteQStart); -- goto case IR.InfiniteStart; -- case IR.RepeatStart, IR.RepeatQStart: -- uint len = re.ir[t.pc].data; -- uint tail = t.pc + len + IRL!(IR.RepeatStart); -- uint step = re.ir[tail+2].raw; -- uint min = re.ir[tail+3].raw; -- -- if(t.counter < min) -- { -- t.counter += step; -- t.pc += len; -- break; -- } -- uint max = re.ir[tail+4].raw; -- if(merge[re.ir[tail+1].raw+t.counter] < genCounter) -- { -- debug(fred_matching) writefln("A thread(pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[tail+1].raw+t.counter] ); -- merge[re.ir[tail+1].raw+t.counter] = genCounter; -- } -- else -- { -- debug(fred_matching) writefln("A thread(pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[tail+1].raw+t.counter] ); -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- if(t.counter < max) -- { -- if(re.ir[t.pc].code == IR.RepeatStart)//greedy -- { -- worklist.insertFront(fork(t, t.pc-1, t.counter%step)); -- t.counter += step; -- t.pc += len; -- } -- else -- { -- worklist.insertFront(fork(t, t.pc + len, t.counter + step)); -- t.counter = t.counter%step; -- t.pc--; -- } -- } -- else -- { -- t.counter = t.counter%step; -- t.pc--; -- } -- break; -- case IR.RepeatEnd: -- case IR.RepeatQEnd: -- t.pc -= re.ir[t.pc].data+IRL!(IR.RepeatStart); -- assert(re.ir[t.pc].code == IR.RepeatStart || re.ir[t.pc].code == IR.RepeatQStart); -- goto case IR.RepeatStart; -- case IR.OrEnd: -- uint len = re.ir[t.pc].data; -- t.pc -= len; -- assert(re.ir[t.pc].code == IR.Option); -- len = re.ir[t.pc].data; -- t.pc = t.pc + len; //to IR.GotoEndOr or just before IR.OrEnd -- break; -- case IR.OrStart: -- uint len = re.ir[t.pc].data; -- uint mIdx = t.pc + len + IRL!(IR.OrEnd); //should point to the end of OrEnd -- if(merge[re.ir[mIdx].raw+t.counter] < genCounter) -- { -- debug(fred_matching) writefln("A thread(t.pc=%s) passed there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] ); -- merge[re.ir[mIdx].raw+t.counter] = genCounter; -- } -- else -- { -- debug(fred_matching) writefln("A thread(t.pc=%s) got merged there : %s ; GenCounter=%s mergetab=%s", -- t.pc, index, genCounter, merge[re.ir[mIdx].raw+t.counter] ); -- recycle(t); -- t = worklist.fetch(); -- break; -- } -- t.pc--; -- break; -- case IR.Option: -- assert(re.ir[t.pc].code == IR.Option); -- t.pc += re.ir[t.pc].data + IRL!(IR.Option); -- if(re.ir[t.pc].code == IR.Option) -- { -- t.pc--;//hackish, assumes size of IR.Option == 1 -- if(re.ir[t.pc].code == IR.GotoEndOr) -- { -- t.pc += re.ir[t.pc].data + IRL!(IR.GotoEndOr); -- } -+ recycle(t); -+ } -+ t = worklist.fetch(); -+ if(!t) -+ return; -+ break; -+ default: -+ assert(0, "Unrecognized instruction " ~ re.ir[t.pc].mnemonic); - } -- assert(re.ir[t.pc].code == IR.OrEnd); -- t.pc -= re.ir[t.pc].data + 1; -- break; -- case IR.GotoEndOr: -- assert(re.ir[t.pc].code == IR.GotoEndOr); -- uint npc = t.pc+IRL!(IR.GotoEndOr); -- assert(re.ir[npc].code == IR.Option); -- worklist.insertFront(fork(t, npc + re.ir[npc].data, t.counter));//queue next branch -- t.pc--; -- break; -- case IR.GroupStart: -- uint n = re.ir[t.pc].data; -- t.matches.ptr[n].begin = index; -- t.pc--; -- break; -- case IR.GroupEnd: -- uint n = re.ir[t.pc].data; -- t.matches.ptr[n].end = index; -- t.pc--; -- break; -- case IR.Backref: -- uint n = re.ir[t.pc].data; -- auto source = re.ir[t.pc].localRef ? t.matches.ptr : backrefed.ptr; -- assert(source); -- if(source[n].begin == source[n].end)//zero-width Backref! -+ else - { -- t.pc--; -+ default: -+ recycle(t); -+ t = worklist.fetch(); -+ if(!t) -+ return; - } -- else static if(withInput) -+ } -+ } -+ -+ } -+ enum uint RestartPc = uint.max; -+ //match the input, evaluating IR without searching -+ MatchResult matchOneShot(Group!DataIndex[] matches, uint startPc = 0) -+ { -+ debug(std_regex_matcher) -+ { -+ writefln("---------------single shot match ----------------- "); -+ } -+ alias eval evalFn; -+ assert(clist == (ThreadList!DataIndex).init || startPc == RestartPc); // incorrect after a partial match -+ assert(nlist == (ThreadList!DataIndex).init || startPc == RestartPc); -+ startPc = startPc; -+ if(!atEnd)//if no char -+ { -+ debug(std_regex_matcher) -+ { -+ writefln("-- Threaded matching threads at %s", s[index..s.lastIndex]); -+ } -+ if(startPc!=RestartPc) -+ { -+ auto startT = createStart(index, startPc); -+ genCounter++; -+ evalFn!true(startT, matches); -+ } -+ for(;;) -+ { -+ debug(std_regex_matcher) writeln("\n-- Started iteration of main cycle"); -+ genCounter++; -+ debug(std_regex_matcher) - { -- size_t idx = source[n].begin + t.uopCounter; -- size_t end = source[n].end; -- if(s[idx..end].front == front)//could be a BUG in backward matching -+ foreach(t; clist[]) - { -- t.uopCounter += std.utf.stride(s[idx..end], 0); -- if(t.uopCounter + source[n].begin == source[n].end) -- {//last codepoint -- t.pc--; -- t.uopCounter = 0; -- } -- nlist.insertBack(t); -+ assert(t); - } -- else -- recycle(t); -- t = worklist.fetch(); - } -- else -+ for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch()) - { -- recycle(t); -- t = worklist.fetch(); -+ evalFn!true(t, matches); - } -- break; -- -- case IR.LookbehindStart: -- case IR.NeglookbehindStart: -- uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw; -- finish(t, matches.ptr[ms .. me]); -- recycle(t); -- //cut off low priority threads -- recycle(clist); -- recycle(worklist); -- return; -- case IR.LookaheadStart: -- case IR.NeglookaheadStart: -- assert(0); -- case IR.LookaheadEnd: -- case IR.NeglookaheadEnd: -- uint len = re.ir[t.pc].data; -- t.pc -= len + IRL!(IR.LookaheadStart); -- bool positive = re.ir[t.pc].code == IR.LookaheadStart; -- auto matcher = ThompsonMatcher!(Char, typeof(s.loopBack)) -- (this -- , re.ir[t.pc .. t.pc+len+IRL!(IR.LookbehindStart)+IRL!(IR.LookbehindEnd)] -- , s.loopBack); -- matcher.re.ngroup = re.ir[t.pc+2].raw - re.ir[t.pc+1].raw; -- matcher.backrefed = backrefed.empty ? t.matches : backrefed; -- matcher.next(); //fetch a char, since direction was reversed -- bool match = (matcher.matchOneShot!(OneShot.Fwd)(t.matches, IRL!(IR.LookaheadStart)) == MatchResult.Match) ^ positive; -- freelist = matcher.freelist; -- if(match) -+ if(nlist.empty) - { -- recycle(t); -- t = worklist.fetch(); -+ debug(std_regex_matcher) writeln("Stopped matching before consuming full input"); -+ break;//not a partial match for sure - } -- else -- t.pc--; -- break; -- case IR.LookbehindEnd: -- case IR.NeglookbehindEnd: -- auto save = index; -- uint len = re.ir[t.pc].data; -- t.pc -= len + IRL!(IR.LookbehindStart); -- uint ms = re.ir[t.pc+1].raw, me = re.ir[t.pc+2].raw; -- bool positive = re.ir[t.pc].code == IR.LookbehindStart; -- auto matcher = ThompsonMatcher(this, re.ir[t.pc .. t.pc+len+IRL!(IR.LookbehindStart)], s); -- matcher.front = front; -- matcher.index = index; -- matcher.re.ngroup = me - ms; -- matcher.backrefed = backrefed.empty ? t.matches : backrefed; -- bool nomatch = (matcher.matchOneShot!(OneShot.Bwd)(t.matches) == MatchResult.Match) ^ positive; -- freelist = matcher.freelist; -- s.reset(index); -- next(); -- if(nomatch) -+ clist = nlist; -+ nlist = (ThreadList!DataIndex).init; -+ if(!next()) - { -- recycle(t); -- t = worklist.fetch(); -- if(!t) -- return; -- // -- } -- else -- t.pc--; -- break; -- case IR.Nop: -- t.pc--; -- break; -- static if(withInput) -- { -- case IR.OrChar://assumes IRL!(OrChar) == 1 -- uint len = re.ir[t.pc].sequence; -- uint end = t.pc - len; -- for(; t.pc>end; t.pc--) -- if(re.ir[t.pc].data == front) -- break; -- if(t.pc != end) -- { -- t.pc = end; -- nlist.insertBack(t); -- } -- else -- recycle(t); -- t = worklist.fetch(); -- break; -- case IR.Char: -- if(front == re.ir[t.pc].data) -- { -- t.pc--; -- nlist.insertBack(t); -- } -- else -- recycle(t); -- t = worklist.fetch(); -- break; -- case IR.Any: -- t.pc--; -- if(!(re.flags & RegexOption.singleline) -- && (front == '\r' || front == '\n')) -- recycle(t); -- else -- nlist.insertBack(t); -- t = worklist.fetch(); -- break; -- case IR.CodepointSet: -- if(re.charsets[re.ir[t.pc].data].scanFor(front)) -- { -- t.pc--; -- nlist.insertBack(t); -- } -- else -- { -- recycle(t); -- } -- t = worklist.fetch(); -- break; -- case IR.Trie: -- if(re.tries[re.ir[t.pc].data][front]) -- { -- t.pc--; -- nlist.insertBack(t); -- } -- else -- { -- recycle(t); -- } -- t = worklist.fetch(); -+ if (!atEnd) return MatchResult.PartialMatch; - break; -- default: -- assert(re.ir[t.pc].code < 0x80, "Unrecognized instruction " ~ re.ir[t.pc].mnemonic); -- t.pc--; -- } -- else -- { -- default: -- if(re.ir[t.pc].code < 0x80) -- t.pc--; -- else -- { -- recycle(t); -- t = worklist.fetch(); -- } -- } -+ } -+ debug(std_regex_matcher) writeln("-- Ended iteration of main cycle\n"); - } -- }while(t); -+ } -+ genCounter++; //increment also on each end -+ debug(std_regex_matcher) writefln("-- Matching threads at end"); -+ //try out all zero-width posibilities -+ for(Thread!DataIndex* t = clist.fetch(); t; t = clist.fetch()) -+ { -+ evalFn!false(t, matches); -+ } -+ if(!matched) -+ evalFn!false(createStart(index, startPc), matches); -+ -+ return (matched?MatchResult.Match:MatchResult.NoMatch); - } - - //get a dirty recycled Thread -@@ -6086,10 +5400,10 @@ enum OneShot { Fwd, Bwd }; - void prepareFreeList(size_t size, ref void[] memory) - { - void[] mem = memory[0 .. threadSize*size]; -- memory = memory[threadSize*size..$]; -+ memory = memory[threadSize * size .. $]; - freelist = cast(Thread!DataIndex*)&mem[0]; - size_t i; -- for(i=threadSize; i<threadSize*size; i+=threadSize) -+ for(i = threadSize; i < threadSize*size; i += threadSize) - (cast(Thread!DataIndex*)&mem[i-threadSize]).next = cast(Thread!DataIndex*)&mem[i]; - (cast(Thread!DataIndex*)&mem[i-threadSize]).next = null; - } -@@ -6126,7 +5440,7 @@ enum OneShot { Fwd, Bwd }; - } - - //creates a start thread -- Thread!DataIndex* createStart(DataIndex index, uint pc=0) -+ Thread!DataIndex* createStart(DataIndex index, uint pc = 0) - { - auto t = allocate(); - t.matches.ptr[0..re.ngroup] = (Group!DataIndex).init; -@@ -6168,7 +5482,7 @@ enum OneShot { Fwd, Bwd }; - } - ---- - +/ --@trusted public struct Captures(R, DIndex=size_t) -+@trusted public struct Captures(R, DIndex = size_t) - if(isSomeString!R) - {//@trusted because of union inside - alias DIndex DataIndex; -@@ -6182,29 +5496,39 @@ private: - Group!DataIndex[] big_matches; - Group!DataIndex[smallString] small_matches; - } -- uint f, b; -- uint ngroup; -- NamedGroup[] names; -+ uint _f, _b; -+ uint _ngroup; -+ NamedGroup[] _names; -+ -+ this()(R input, uint ngroups, NamedGroup[] named) -+ { -+ _input = input; -+ _ngroup = ngroups; -+ _names = named; -+ newMatches(); -+ _b = _ngroup; -+ _f = 0; -+ } - - this(alias Engine)(ref RegexMatch!(R,Engine) rmatch) - { - _input = rmatch._input; -- ngroup = rmatch._engine.re.ngroup; -- names = rmatch._engine.re.dict; -+ _ngroup = rmatch._engine.re.ngroup; -+ _names = rmatch._engine.re.dict; - newMatches(); -- b = ngroup; -- f = 0; -+ _b = _ngroup; -+ _f = 0; - } - - @property Group!DataIndex[] matches() - { -- return ngroup > smallString ? big_matches : small_matches[0..ngroup]; -+ return _ngroup > smallString ? big_matches : small_matches[0 .. _ngroup]; - } - - void newMatches() - { -- if(ngroup > smallString) -- big_matches = new Group!DataIndex[ngroup]; -+ if(_ngroup > smallString) -+ big_matches = new Group!DataIndex[_ngroup]; - } - - public: -@@ -6231,39 +5555,40 @@ public: - @property R front() - { - assert(!empty); -- return _input[matches[f].begin .. matches[f].end]; -+ return _input[matches[_f].begin .. matches[_f].end]; - } - - ///ditto - @property R back() - { - assert(!empty); -- return _input[matches[b-1].begin .. matches[b-1].end]; -+ return _input[matches[_b - 1].begin .. matches[_b - 1].end]; - } - - ///ditto - void popFront() - { - assert(!empty); -- ++f; -+ ++_f; - } - - ///ditto - void popBack() - { - assert(!empty); -- --b; -+ --_b; - } - - ///ditto -- @property bool empty() const { return _empty || f >= b; } -+ @property bool empty() const { return _empty || _f >= _b; } - - ///ditto - R opIndex()(size_t i) /*const*/ //@@@BUG@@@ - { -- assert(f+i < b,text("requested submatch number ", i,"is out of range")); -- assert(matches[f+i].begin <= matches[f+i].end, text("wrong match: ", matches[f+i].begin, "..", matches[f+i].end)); -- return _input[matches[f+i].begin..matches[f+i].end]; -+ assert(_f + i < _b,text("requested submatch number ", i," is out of range")); -+ assert(matches[_f + i].begin <= matches[_f + i].end, -+ text("wrong match: ", matches[_f + i].begin, "..", matches[_f + i].end)); -+ return _input[matches[_f + i].begin .. matches[_f + i].end]; - } - - /++ -@@ -6286,12 +5611,12 @@ public: - R opIndex(String)(String i) /*const*/ //@@@BUG@@@ - if(isSomeString!String) - { -- size_t index = lookupNamedGroup(names, i); -- return _input[matches[index].begin..matches[index].end]; -+ size_t index = lookupNamedGroup(_names, i); -+ return _input[matches[index].begin .. matches[index].end]; - } - - ///Number of matches in this object. -- @property size_t length() const { return _empty ? 0 : b-f; } -+ @property size_t length() const { return _empty ? 0 : _b - _f; } - - ///A hook for compatibility with original std.regex. - @property ref captures(){ return this; } -@@ -6321,10 +5646,10 @@ unittest//verify example - Effectively it's a forward range of Captures!R, produced - by lazily searching for matches in a given input. - -- alias Engine specifies an engine type to use during matching, -+ $(D alias Engine) specifies an engine type to use during matching, - and is automatically deduced in a call to $(D match)/$(D bmatch). - +/ --@trusted public struct RegexMatch(R, alias Engine=ThompsonMatcher) -+@trusted public struct RegexMatch(R, alias Engine = ThompsonMatcher) - if(isSomeString!R) - { - private: -@@ -6335,7 +5660,7 @@ private: - Captures!(R,EngineType.DataIndex) _captures; - void[] _memory;//is ref-counted - -- this(RegEx)(RegEx prog, R input) -+ this(RegEx)(R input, RegEx prog) - { - _input = input; - immutable size = EngineType.initialMemory(prog)+size_t.sizeof; -@@ -6343,9 +5668,11 @@ private: - scope(failure) free(_memory.ptr); - *cast(size_t*)_memory.ptr = 1; - _engine = EngineType(prog, Input!Char(input), _memory[size_t.sizeof..$]); -+ static if(is(RegEx == StaticRegex!(BasicElementOf!R))) -+ _engine.nativeFn = prog.nativeFn; - _captures = Captures!(R,EngineType.DataIndex)(this); - _captures._empty = !_engine.match(_captures.matches); -- debug(fred_allocation) writefln("RefCount (ctor): %x %d", _memory.ptr, counter); -+ debug(std_regex_allocation) writefln("RefCount (ctor): %x %d", _memory.ptr, counter); - } - - @property ref size_t counter(){ return *cast(size_t*)_memory.ptr; } -@@ -6355,8 +5682,8 @@ public: - if(_memory.ptr) - { - ++counter; -- debug(fred_allocation) writefln("RefCount (postblit): %x %d" -- , _memory.ptr, *cast(size_t*)_memory.ptr); -+ debug(std_regex_allocation) writefln("RefCount (postblit): %x %d", -+ _memory.ptr, *cast(size_t*)_memory.ptr); - } - } - -@@ -6364,8 +5691,8 @@ public: - { - if(_memory.ptr && --*cast(size_t*)_memory.ptr == 0) - { -- debug(fred_allocation) writefln("RefCount (dtor): %x %d" -- , _memory.ptr, *cast(size_t*)_memory.ptr); -+ debug(std_regex_allocation) writefln("RefCount (dtor): %x %d", -+ _memory.ptr, *cast(size_t*)_memory.ptr); - free(cast(void*)_memory.ptr); - } - } -@@ -6436,6 +5763,35 @@ public: - - } - -+private @trusted auto matchOnce(alias Engine, RegEx, R)(R input, RegEx re) -+{ -+ alias BasicElementOf!R Char; -+ alias Engine!Char EngineType; -+ -+ size_t size = EngineType.initialMemory(re); -+ void[] memory = enforce(malloc(size))[0..size]; -+ scope(exit) free(memory.ptr); -+ auto captures = Captures!(R, EngineType.DataIndex)(input, re.ngroup, re.dict); -+ auto engine = EngineType(re, Input!Char(input), memory); -+ static if(is(RegEx == StaticRegex!(BasicElementOf!R))) -+ engine.nativeFn = re.nativeFn; -+ captures._empty = !engine.match(captures.matches); -+ return captures; -+} -+ -+private auto matchMany(alias Engine, RegEx, R)(R input, RegEx re) -+{ -+ re.flags |= RegexOption.global; -+ return RegexMatch!(R, Engine)(input, re); -+} -+ -+unittest -+{ -+ //sanity checks for new API -+ auto re = regex("abc"); -+ assert(!"abc".matchOnce!(ThompsonMatcher)(re).empty); -+ assert("abc".matchOnce!(ThompsonMatcher)(re)[0] == "abc"); -+} - /++ - Compile regular expression pattern for the later execution. - Returns: $(D Regex) object that works on inputs having -@@ -6459,19 +5815,9 @@ public: - public auto regexImpl(S)(S pattern, const(char)[] flags="") - if(isSomeString!(S)) - { -- alias Regex!(BasicElementOf!S) Reg; -- if(!__ctfe) -- { -- auto parser = Parser!(Unqual!(typeof(pattern)))(pattern, flags); -- Regex!(BasicElementOf!S) r = parser.program; -- return r; -- } -- else -- { -- auto parser = Parser!(Unqual!(typeof(pattern)), true)(pattern, flags); -- Regex!(BasicElementOf!S) r = parser.program; -- return r; -- } -+ auto parser = Parser!(Unqual!(typeof(pattern)))(pattern, flags); -+ auto r = parser.program; -+ return r; - } - - -@@ -6483,83 +5829,197 @@ template ctRegexImpl(alias pattern, stri - alias BacktrackingMatcher!(true) Matcher; - @trusted bool func(ref Matcher!Char matcher) - { -- version(fred_ct) debug pragma(msg, source); -+ debug(std_regex_ctr) pragma(msg, source); - mixin(source); - } - enum nr = StaticRegex!Char(r, &func); - } - - /++ -- Experimental feature. -+ Experimental feature. -+ -+ Compile regular expression using CTFE -+ and generate optimized native machine code for matching it. -+ -+ Returns: StaticRegex object for faster matching. -+ -+ Params: -+ pattern = Regular expression -+ flags = The _attributes (g, i, m and x accepted) -++/ -+public template ctRegex(alias pattern, alias flags=[]) -+{ -+ enum ctRegex = ctRegexImpl!(pattern, flags).nr; -+} -+ -+template isRegexFor(RegEx, R) -+{ -+ enum isRegexFor = is(RegEx == Regex!(BasicElementOf!R)) -+ || is(RegEx == StaticRegex!(BasicElementOf!R)); -+} -+ -+/++ -+ Start matching $(D input) to regex pattern $(D re), -+ using Thompson NFA matching scheme. -+ -+ The use of this function is $(RED discouraged) - use either of -+ $(LREF matchAll) or $(LREF matchFirst). -+ -+ Delegating the kind of operation -+ to "g" flag is soon to be phased out along with the -+ ability to choose the exact matching scheme. The choice of -+ matching scheme to use depends highly on the pattern kind and -+ can done automatically on case by case basis. -+ -+ Returns: a $(D RegexMatch) object holding engine state after first match. -++/ -+ -+public auto match(R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) -+{ -+ return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(input, re); -+} -+ -+///ditto -+public auto match(R, String)(R input, String re) -+ if(isSomeString!R && isSomeString!String) -+{ -+ return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(input, regex(re)); -+} -+ -+public auto match(R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) -+{ -+ return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(input, re); -+} -+ -+/++ -+ Find the first (leftmost) slice of the $(D input) that -+ matches the pattern $(D re). This function picks the most suitable -+ regular expression engine depending on the pattern properties. - -- Compile regular expression using CTFE -- and generate optimized native machine code for matching it. -- -- Returns: StaticRegex object for faster matching. -+ $(D re) parameter can be one of three types: -+ $(UL -+ $(LI Plain string, in which case it's compiled to bytecode before matching. ) -+ $(LI Regex!char (wchar/dchar) that contains a pattern in the form of -+ compiled bytecode. ) -+ $(LI StaticRegex!char (wchar/dchar) that contains a pattern in the form of -+ compiled native machine code. ) -+ ) - -- Params: -- pattern = Regular expression -- flags = The _attributes (g, i, m and x accepted) -+ Returns: -+ $(LREF Captures) containing the extent of a match together with all submatches -+ if there was a match, otherwise an empty $(LREF Captures) object. - +/ --public template ctRegex(alias pattern, alias flags=[]) -+public auto matchFirst(R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) - { -- enum ctRegex = ctRegexImpl!(pattern, flags).nr; -+ return matchOnce!ThompsonMatcher(input, re); - } - --template isRegexFor(RegEx, R) -+///ditto -+public auto matchFirst(R, String)(R input, String re) -+ if(isSomeString!R && isSomeString!String) - { -- enum isRegexFor = is(RegEx == Regex!(BasicElementOf!R)) -- || is(RegEx == StaticRegex!(BasicElementOf!R)); -+ return matchOnce!ThompsonMatcher(input, regex(re)); -+} -+ -+public auto matchFirst(R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) -+{ -+ return matchOnce!(BacktrackingMatcher!true)(input, re); - } - - /++ -- Start matching $(D input) to regex pattern $(D re), -- using Thompson NFA matching scheme. -+ Initiate a search for all non-overlapping matches to the pattern $(D re) -+ in the given $(D input). The result is a lazy range of matches generated -+ as they are encountered in the input going left to right. - -- This is the $(U recommended) method for matching regular expression. -+ This function picks the most suitable regular expression engine -+ depending on the pattern properties. - - $(D re) parameter can be one of three types: - $(UL - $(LI Plain string, in which case it's compiled to bytecode before matching. ) -- $(LI Regex!char (wchar/dchar) that contains pattern in form of -- precompiled bytecode. ) -- $(LI StaticRegex!char (wchar/dchar) that contains pattern in form of -- specially crafted native code. ) -+ $(LI Regex!char (wchar/dchar) that contains a pattern in the form of -+ compiled bytecode. ) -+ $(LI StaticRegex!char (wchar/dchar) that contains a pattern in the form of -+ compiled native machine code. ) - ) -- Returns: a $(D RegexMatch) object holding engine state after first match. --+/ - --public auto match(R, RegEx)(R input, RegEx re) -+ Returns: -+ $(LREF RegexMatch) object that represents matcher state -+ after the first match was found or an empty one if not present. -++/ -+public auto matchAll(R, RegEx)(R input, RegEx re) - if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) - { -- return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(re, input); -+ return matchMany!ThompsonMatcher(input, re); - } - - ///ditto --public auto match(R, String)(R input, String re) -+public auto matchAll(R, String)(R input, String re) - if(isSomeString!R && isSomeString!String) - { -- return RegexMatch!(Unqual!(typeof(input)),ThompsonMatcher)(regex(re), input); -+ return matchMany!ThompsonMatcher(input, regex(re)); - } - --public auto match(R, RegEx)(R input, RegEx re) -+public auto matchAll(R, RegEx)(R input, RegEx re) - if(isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) - { -- return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(re, input); -+ return matchMany!(BacktrackingMatcher!true)(input, re); -+} -+ -+// another set of tests just to cover the new API -+@system unittest -+{ -+ foreach(String; TypeTuple!(string, wstring, const(dchar)[])) -+ { -+ auto str1 = "blah-bleh".to!String(); -+ auto pat1 = "bl[ae]h".to!String(); -+ auto mf = matchFirst(str1, pat1); -+ assert(mf.equal(["blah".to!String()])); -+ auto mAll = matchAll(str1, pat1); -+ assert(mAll.equal!((a,b) => a.equal(b)) -+ ([["blah".to!String()], ["bleh".to!String()]])); -+ -+ auto str2 = "1/03/12 - 3/03/12".to!String(); -+ auto pat2 = regex(r"(\d+)/(\d+)/(\d+)".to!String()); -+ auto mf2 = matchFirst(str2, pat2); -+ assert(mf2.equal(["1/03/12", "1", "03", "12"].map!(to!String)())); -+ auto mAll2 = matchAll(str2, pat2); -+ assert(mAll2.front.equal(mf2)); -+ mAll2.popFront(); -+ assert(mAll2.front.equal(["3/03/12", "3", "03", "12"].map!(to!String)())); -+ mf2.popFrontN(3); -+ assert(mf2.equal(["12".to!String()])); -+ -+ auto ctPat = ctRegex!(`(?P<Quot>\d+)/(?P<Denom>\d+)`.to!String()); -+ auto str = "2 + 34/56 - 6/1".to!String(); -+ auto cmf = matchFirst(str, ctPat); -+ assert(cmf.equal(["34/56", "34", "56"].map!(to!String)())); -+ assert(cmf["Quot"] == "34".to!String()); -+ assert(cmf["Denom"] == "56".to!String()); -+ -+ auto cmAll = matchAll(str, ctPat); -+ assert(cmAll.front.equal(cmf)); -+ cmAll.popFront(); -+ assert(cmAll.front.equal(["6/1", "6", "1"].map!(to!String)())); -+ } - } - - /++ -- Start matching $(D input) to regex pattern $(D re), -+ Start matching of $(D input) to regex pattern $(D re), - using traditional $(LUCKY backtracking) matching scheme. - -- $(D re) parameter can be one of three types: -- $(UL -- $(LI Plain string, in which case it's compiled to bytecode before matching. ) -- $(LI Regex!char (wchar/dchar) that contains pattern in form of -- precompiled bytecode. ) -- $(LI StaticRegex!char (wchar/dchar) that contains pattern in form of -- specially crafted native code. ) -- ) -+ The use of this function is $(RED discouraged) - use either of -+ $(LREF matchAll) or $(LREF matchFirst). -+ -+ Delegating the kind of operation -+ to "g" flag is soon to be phased out along with the -+ ability to choose the exact matching scheme. The choice of -+ matching scheme to use depends highly on the pattern kind and -+ can done automatically on case by case basis. - - Returns: a $(D RegexMatch) object holding engine - state after first match. -@@ -6568,83 +6028,245 @@ public auto match(R, RegEx)(R input, Reg - public auto bmatch(R, RegEx)(R input, RegEx re) - if(isSomeString!R && is(RegEx == Regex!(BasicElementOf!R))) - { -- return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(re, input); -+ return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(input, re); - } - - ///ditto - public auto bmatch(R, String)(R input, String re) - if(isSomeString!R && isSomeString!String) - { -- return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(regex(re), input); -+ return RegexMatch!(Unqual!(typeof(input)), BacktrackingMatcher!false)(input, regex(re)); - } - - public auto bmatch(R, RegEx)(R input, RegEx re) - if(isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) - { -- return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(re, input); -+ return RegexMatch!(Unqual!(typeof(input)),BacktrackingMatcher!true)(input, re); -+} -+ -+ -+enum isReplaceFunctor(alias fun, R) = -+ __traits(compiles, (Captures!R c) { fun(c); }); -+ -+// the lowest level - just stuff replacements into the sink -+private @trusted void replaceCapturesInto(alias output, Sink, R, T) -+ (ref Sink sink, R input, T captures) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R) -+{ -+ sink.put(captures.pre); -+ // a hack to get around bogus errors, should be simply output(captures, sink) -+ // "is a nested function and cannot be accessed from" -+ static if(isReplaceFunctor!(output, R)) -+ sink.put(output(captures)); //"mutator" type of function -+ else -+ output(captures, sink); //"output" type of function -+ sink.put(captures.post); -+} -+ -+// ditto for a range of captures -+private void replaceMatchesInto(alias output, Sink, R, T) -+ (ref Sink sink, R input, T matches) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R) -+{ -+ size_t offset = 0; -+ foreach(cap; matches) -+ { -+ sink.put(cap.pre[offset .. $]); -+ // same hack, see replaceCapturesInto -+ static if(isReplaceFunctor!(output, R)) -+ sink.put(output(cap)); //"mutator" type of function -+ else -+ output(cap, sink); //"output" type of function -+ offset = cap.pre.length + cap.hit.length; -+ } -+ sink.put(input[offset .. $]); -+} -+ -+// a general skeleton of replaceFirst -+private R replaceFirstWith(alias output, R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ auto data = matchFirst(input, re); -+ if(data.empty) -+ return input; -+ auto app = appender!(R)(); -+ replaceCapturesInto!output(app, input, data); -+ return app.data; -+} -+ -+// ditto for replaceAll -+// the method parameter allows old API to ride on the back of the new one -+private R replaceAllWith(alias output, -+ alias method=matchAll, R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ auto matches = method(input, re); //inout(C)[] fails -+ if(matches.empty) -+ return input; -+ auto app = appender!(R)(); -+ replaceMatchesInto!output(app, input, matches); -+ return app.data; - } - - /++ -- Construct a new string from $(D input) by replacing each match with -- a string generated from match according to $(D format) specifier. -+ Construct a new string from $(D input) by replacing the first match with -+ a string generated from it according to the $(D format) specifier. - -- To replace all occurrences use regex with "g" flag, otherwise -- only the first occurrence gets replaced. -+ To replace all matches use $(LREF replaceAll). - - Params: - input = string to search - re = compiled regular expression to use -- format = format string to generate replacements from -+ format = format string to generate replacements from, -+ see $(S_LINK Replace format string). -+ -+ Returns: -+ A string of the same type with the first match (if any) replaced. -+ If no match is found returns the input string itself. - - Example: - --- -- // Comify a number -- auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g"); -- assert(replace("12000 + 42100 = 54100", com, ",") == "12,000 + 42,100 = 54,100"); -+ assert(replaceFirst("noon", regex("n"), "[$&]") == "[n]oon"); - --- -++/ -+public R replaceFirst(R, C, RegEx)(R input, RegEx re, const(C)[] format) -+ if(isSomeString!R && is(C : dchar) && isRegexFor!(RegEx, R)) -+{ -+ return replaceFirstWith!((m, sink) => replaceFmt(format, m, sink))(input, re); -+} - -- The format string can reference parts of match using the following notation. -- $(REG_TABLE -- $(REG_TITLE Format specifier, Replaced by ) -- $(REG_ROW $&, the whole match. ) -- $(REG_ROW $`, part of input $(I preceding) the match. ) -- $(REG_ROW $', part of input $(I following) the match. ) -- $(REG_ROW $$, '$' character. ) -- $(REG_ROW \c , where c is any character, the character c itself. ) -- $(REG_ROW \\, '\' character. ) -- $(REG_ROW $1 .. $99, submatch number 1 to 99 respectively. ) -- ) -+/++ -+ This is a general replacement tool that construct a new string by replacing -+ matches of pattern $(D re) in the $(D input). Unlike the other overload -+ there is no format string instead captures are passed to -+ to a user-defined functor $(D fun) that returns a new string -+ to use as replacement. -+ -+ This version replaces the first match in $(D input), -+ see $(LREF replaceAll) to replace the all of the matches. -+ -+ Returns: -+ A new string of the same type as $(D input) with all matches -+ replaced by return values of $(D fun). If no matches found -+ returns the $(D input) itself. -+ -+ Example: - --- -- assert(replace("noon", regex("^n"), "[$&]") == "[n]oon"); -+ string list = "#21 out of 46"; -+ string newList = replaceFirst!(cap => to!string(to!int(cap.hit)+1)) -+ (list, regex(`[0-9]+`)); -+ assert(newList == "#22 out of 46"); - --- - +/ --public @trusted R replace(alias scheme=match, R, RegEx)(R input, RegEx re, R format) -+public R replaceFirst(alias fun, R, RegEx)(R input, RegEx re) - if(isSomeString!R && isRegexFor!(RegEx, R)) - { -- auto app = appender!(R)(); -- auto matches = scheme(input, re); -- size_t offset = 0; -- foreach(ref m; matches) -+ return replaceFirstWith!((m, sink) => sink.put(fun(m)))(input, re); -+} -+ -+/++ -+ A variation on $(LREF replaceFirst) that instead of allocating a new string -+ on each call outputs the result piece-wise to the $(D sink). In particular -+ this enables efficient construction of a final output incrementally. -+ -+ Like in $(LREF replaceFirst) family of functions there is an overload -+ for the substitution guided by the $(D format) string -+ and the one with the user defined callback. -+ -+ Example: -+ --- -+ import std.array; -+ string m1 = "first message\n"; -+ string m2 = "second message\n"; -+ auto result = appender!string(); -+ replaceFirstInto(result, m1, regex(`([a-z]+) message`), "$1"); -+ //equivalent of the above with user-defined callback -+ replaceFirstInto!(cap=>cap[1])(result, m2, regex(`([a-z]+) message`)); -+ assert(result.data == "first\nsecond\n"); -+ --- -++/ -+public @trusted void replaceFirstInto(Sink, R, C, RegEx) -+ (ref Sink sink, R input, RegEx re, const(C)[] format) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R -+ && is(C : dchar) && isRegexFor!(RegEx, R)) - { -- app.put(m.pre[offset .. $]); -- replaceFmt(format, m.captures, app); -- offset = m.pre.length + m.hit.length; -+ replaceCapturesInto!((m, sink) => replaceFmt(format, m, sink)) -+ (sink, input, matchFirst(input, re)); - } -- app.put(input[offset .. $]); -- return app.data; -+ -+///ditto -+public @trusted void replaceFirstInto(alias fun, Sink, R, RegEx) -+ (Sink sink, R input, RegEx re) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ replaceCapturesInto!fun(sink, input, matchFirst(input, re)); -+} -+ -+//examples for replaceFirst -+@system unittest -+{ -+ string list = "#21 out of 46"; -+ string newList = replaceFirst!(cap => to!string(to!int(cap.hit)+1)) -+ (list, regex(`[0-9]+`)); -+ assert(newList == "#22 out of 46"); -+ import std.array; -+ string m1 = "first message\n"; -+ string m2 = "second message\n"; -+ auto result = appender!string(); -+ replaceFirstInto(result, m1, regex(`([a-z]+) message`), "$1"); -+ //equivalent of the above with user-defined callback -+ replaceFirstInto!(cap=>cap[1])(result, m2, regex(`([a-z]+) message`)); -+ assert(result.data == "first\nsecond\n"); - } - - /++ -- Search string for matches using regular expression pattern $(D re) -- and pass captures for each match to user-defined functor $(D fun). -+ Construct a new string from $(D input) by replacing all of the -+ fragments that match a pattern $(D re) with a string generated -+ from the match according to the $(D format) specifier. -+ -+ To replace only the first match use $(LREF replaceFirst). -+ -+ Params: -+ input = string to search -+ re = compiled regular expression to use -+ format = format string to generate replacements from, -+ see $(S_LINK Replace format string). - -- To replace all occurrances use regex with "g" flag, otherwise -- only first occurrence gets replaced. -+ Returns: -+ A string of the same type as $(D input) with the all -+ of the matches (if any) replaced. -+ If no match is found returns the input string itself. -+ -+ Example: -+ --- -+ // Comify a number -+ auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g"); -+ assert(replaceAll("12000 + 42100 = 54100", com, ",") == "12,000 + 42,100 = 54,100"); -+ --- -++/ -+public @trusted R replaceAll(R, C, RegEx)(R input, RegEx re, const(C)[] format) -+ if(isSomeString!R && is(C : dchar) && isRegexFor!(RegEx, R)) -+{ -+ return replaceAllWith!((m, sink) => replaceFmt(format, m, sink))(input, re); -+} - -- Returns: new string with all matches replaced by return values of $(D fun). -+/++ -+ This is a general replacement tool that construct a new string by replacing -+ matches of pattern $(D re) in the $(D input). Unlike the other overload -+ there is no format string instead captures are passed to -+ to a user-defined functor $(D fun) that returns a new string -+ to use as replacement. -+ -+ This version replaces all of the matches found in $(D input), -+ see $(LREF replaceFirst) to replace the first match only. -+ -+ Returns: -+ A new string of the same type as $(D input) with all matches -+ replaced by return values of $(D fun). If no matches found -+ returns the $(D input) itself. - - Params: -- s = string to search -+ input = string to search - re = compiled regular expression - fun = delegate to use - -@@ -6655,30 +6277,132 @@ public @trusted R replace(alias scheme=m - { - return std.string.toUpper(m.hit); - } -- auto s = replace!(baz)("Strap a rocket engine on a chicken.", -- regex("[ar]", "g")); -+ auto s = replaceAll!(baz)("Strap a rocket engine on a chicken.", -+ regex("[ar]")); - assert(s == "StRAp A Rocket engine on A chicken."); - --- - +/ --public @trusted R replace(alias fun, R, RegEx, alias scheme=match)(R input, RegEx re) -+public @trusted R replaceAll(alias fun, R, RegEx)(R input, RegEx re) - if(isSomeString!R && isRegexFor!(RegEx, R)) - { -- auto app = appender!(R)(); -- auto matches = scheme(input, re); -- size_t offset = 0; -- foreach(m; matches) -+ return replaceAllWith!((m, sink) => sink.put(fun(m)))(input, re); -+} -+ -+/++ -+ A variation on $(LREF replaceAll) that instead of allocating a new string -+ on each call outputs the result piece-wise to the $(D sink). In particular -+ this enables efficient construction of a final output incrementally. -+ -+ As with $(LREF replaceAll) there are 2 overloads - one with a format string, -+ the other one with a user defined functor. -+ -+ Example: -+ --- -+ //swap all 3 letter words and bring it back -+ string text = "How are you doing?"; -+ auto sink = appender!(char[])(); -+ replaceAllInto!(cap => retro(cap[0]))(sink, text, regex(`\b\w{3}\b`)); -+ auto swapped = sink.data.dup; // make a copy explicitly -+ assert(swapped == "woH era uoy doing?"); -+ sink.clear(); -+ replaceAllInto!(cap => retro(cap[0]))(sink, swapped, regex(`\b\w{3}\b`)); -+ assert(sink.data == text); -+ --- -++/ -+public @trusted void replaceAllInto(Sink, R, C, RegEx) -+ (Sink sink, R input, RegEx re, const(C)[] format) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R -+ && is(C : dchar) && isRegexFor!(RegEx, R)) - { -- app.put(m.pre[offset .. $]); -- app.put(fun(m)); -- offset = m.pre.length + m.hit.length; -+ replaceMatchesInto!((m, sink) => replaceFmt(format, m, sink)) -+ (sink, input, matchAll(input, re)); - } -- app.put(input[offset .. $]); -- return app.data; -+ -+///ditto -+public @trusted void replaceAllInto(alias fun, Sink, R, RegEx) -+ (Sink sink, R input, RegEx re) -+ if(isOutputRange!(Sink, dchar) && isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ replaceMatchesInto!fun(sink, input, matchAll(input, re)); -+} -+ -+// a bit of examples -+@system unittest -+{ -+ //swap all 3 letter words and bring it back -+ string text = "How are you doing?"; -+ auto sink = appender!(char[])(); -+ replaceAllInto!(cap => retro(cap[0]))(sink, text, regex(`\b\w{3}\b`)); -+ auto swapped = sink.data.dup; // make a copy explicitly -+ assert(swapped == "woH era uoy doing?"); -+ sink.clear(); -+ replaceAllInto!(cap => retro(cap[0]))(sink, swapped, regex(`\b\w{3}\b`)); -+ assert(sink.data == text); -+} -+ -+// exercise all of the replace APIs -+@system unittest -+{ -+ // try and check first/all simple substitution -+ foreach(S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[])) -+ { -+ S s1 = "curt trial".to!S(); -+ S s2 = "round dome".to!S(); -+ S t1F = "court trial".to!S(); -+ S t2F = "hound dome".to!S(); -+ S t1A = "court trial".to!S(); -+ S t2A = "hound home".to!S(); -+ auto re1 = regex("curt".to!S()); -+ auto re2 = regex("[dr]o".to!S()); -+ -+ assert(replaceFirst(s1, re1, "court") == t1F); -+ assert(replaceFirst(s2, re2, "ho") == t2F); -+ assert(replaceAll(s1, re1, "court") == t1A); -+ assert(replaceAll(s2, re2, "ho") == t2A); -+ -+ auto rep1 = replaceFirst!(cap => cap[0][0]~"o".to!S()~cap[0][1..$])(s1, re1); -+ assert(rep1 == t1F); -+ assert(replaceFirst!(cap => "ho".to!S())(s2, re2) == t2F); -+ auto rep1A = replaceAll!(cap => cap[0][0]~"o".to!S()~cap[0][1..$])(s1, re1); -+ assert(rep1A == t1A); -+ assert(replaceAll!(cap => "ho".to!S())(s2, re2) == t2A); -+ -+ auto sink = appender!S(); -+ replaceFirstInto(sink, s1, re1, "court"); -+ assert(sink.data == t1F); -+ replaceFirstInto(sink, s2, re2, "ho"); -+ assert(sink.data == t1F~t2F); -+ replaceAllInto(sink, s1, re1, "court"); -+ assert(sink.data == t1F~t2F~t1A); -+ replaceAllInto(sink, s2, re2, "ho"); -+ assert(sink.data == t1F~t2F~t1A~t2A); -+ } -+} -+ -+/++ -+ Old API for replacement, operation depends on flags of pattern $(D re). -+ With "g" flag it performs the equivalent of $(LREF replaceAll) otherwise it -+ works the same as $(LREF replaceFirst). -+ -+ The use of this function is $(RED discouraged), please use $(LREF replaceAll) -+ or $(LREF replaceFirst) explicitly. -++/ -+public R replace(alias scheme = match, R, C, RegEx)(R input, RegEx re, const(C)[] format) -+ if(isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ return replaceAllWith!((m, sink) => replaceFmt(format, m, sink), match)(input, re); -+} -+ -+///ditto -+public R replace(alias fun, R, RegEx)(R input, RegEx re) -+ if(isSomeString!R && isRegexFor!(RegEx, R)) -+{ -+ return replaceAllWith!(fun, match)(input, re); - } - --//produce replacement string from format using captures for substitue --public @trusted void replaceFmt(R, Capt, OutR) -- (R format, Capt captures, OutR sink, bool ignoreBadSubs=false) -+//produce replacement string from format using captures for substitution -+private void replaceFmt(R, Capt, OutR) -+ (R format, Capt captures, OutR sink, bool ignoreBadSubs = false) - if(isOutputRange!(OutR, ElementEncodingType!R[]) && - isOutputRange!(OutR, ElementEncodingType!(Capt.String)[])) - { -@@ -6713,7 +6437,7 @@ L_Replace_Loop: - } - else if(format[0] == '{') - { -- auto x = find!"!std.ascii.isAlpha(a)"(format[1..$]); -+ auto x = find!(a => !ascii.isAlpha(a))(format[1..$]); - enforce(!x.empty && x[0] == '}', "no matching '}' in replacement format"); - auto name = format[1 .. $ - x.length]; - format = x[1..$]; -@@ -6757,7 +6481,7 @@ assert(equal(splitter(s1, regex(", *")), - ["", "abc", "de", "fg", "hi", ""])); - ---- - +/ --public struct Splitter(Range, alias RegEx=Regex) -+public struct Splitter(Range, alias RegEx = Regex) - if(isSomeString!Range && isRegexFor!(RegEx, Range)) - { - private: -@@ -6777,7 +6501,7 @@ private: - } - else - { -- _match = Rx(separator, _input); -+ _match = Rx(_input, separator); - } - } - -@@ -6915,6 +6639,7 @@ unittest - } - - enum TestVectors tv[] = [ -+ TestVectors( "a\\b", "a", "y", "$&", "a" ), - TestVectors( "(a)b\\1", "abaab","y", "$&", "aba" ), - TestVectors( "()b\\1", "aaab", "y", "$&", "b" ), - TestVectors( "abc", "abc", "y", "$&", "abc" ), -@@ -7203,7 +6928,7 @@ unittest - foreach(a, tvd; tv) - { - uint c = tvd.result[0]; -- debug(fred_test) writeln(" Test #", a, " pattern: ", tvd.pattern, " with Char = ", Char.stringof); -+ debug(std_regex_test) writeln(" Test #", a, " pattern: ", tvd.pattern, " with Char = ", Char.stringof); - try - { - i = 1; -@@ -7212,7 +6937,7 @@ unittest - catch (RegexException e) - { - i = 0; -- debug(fred_test) writeln(e.msg); -+ debug(std_regex_test) writeln(e.msg); - } - - assert((c == 'c') ? !i : i, "failed to compile pattern "~tvd.pattern); -@@ -7225,423 +6950,474 @@ unittest - if(c == 'y') - { - auto result = produceExpected(m, to!(String)(tvd.format)); -- assert(result == to!String(tvd.replace), text(matchFn.stringof ~": mismatch pattern #", a, ": ", tvd.pattern," expected: ", -+ assert(result == to!String(tvd.replace), -+ text(matchFn.stringof ~": mismatch pattern #", a, ": ", tvd.pattern," expected: ", - tvd.replace, " vs ", result)); - } - } - } - } -- debug(fred_test) writeln("!!! FReD bulk test done "~matchFn.stringof~" !!!"); -+ debug(std_regex_test) writeln("!!! FReD bulk test done "~matchFn.stringof~" !!!"); - } -- static string generate(uint n,uint[] black_list...) -+ -+ -+ void ct_tests() - { -- string s = "TypeTuple!("; -- for(uint i=0; i<n; i++) -+ version(std_regex_ct1) - { -- uint j; -- for(j =0; j<black_list.length; j++) -- if(i == black_list[j]) -- break; -- if(j == black_list.length) -+ pragma(msg, "Testing 1st part of ctRegex"); -+ alias Tests = Sequence!(0, 90); -+ } -+ else version(std_regex_ct2) -+ { -+ pragma(msg, "Testing 2nd part of ctRegex"); -+ alias Tests = Sequence!(90, 165); -+ } -+ else version(std_regex_ct3) -+ { -+ pragma(msg, "Testing 3rd part of ctRegex"); -+ alias Tests = Sequence!(185, 220); -+ } -+ else version(std_regex_ct4) -+ { -+ pragma(msg, "Testing 4th part of ctRegex"); -+ alias Tests = Sequence!(220, tv.length); -+ } -+ else -+ alias Tests = TypeTuple!(Sequence!(0, 30), Sequence!(235, tv.length-5)); -+ foreach(a, v; Tests) -+ { -+ enum tvd = tv[v]; -+ static if(tvd.result == "c") -+ { -+ static assert(!__traits(compiles, (){ -+ enum r = regex(tvd.pattern, tvd.flags); -+ }), "errornously compiles regex pattern: " ~ tvd.pattern); -+ } -+ else - { -- s ~= to!string(i); -- s ~= ","; -+ //BUG: tv[v] is fine but tvd is not known at compile time?! -+ enum r = ctRegex!(tv[v].pattern, tv[v].flags); -+ auto nr = regex(tvd.pattern, tvd.flags); -+ assert(equal(r.ir, nr.ir), -+ text("!C-T regex! failed to compile pattern #", a ,": ", tvd.pattern)); -+ auto m = match(tvd.input, r); -+ auto c = tvd.result[0]; -+ bool ok = (c == 'y') ^ m.empty; -+ assert(ok, text("ctRegex: failed to match pattern #", -+ a ,": ", tvd.pattern)); -+ if(c == 'y') -+ { -+ import std.stdio; -+ auto result = produceExpected(m, tvd.format); -+ if(result != tvd.replace) -+ writeln("ctRegex mismatch pattern #", a, ": ", tvd.pattern," expected: ", -+ tvd.replace, " vs ", result); -+ } - } - } -- s ~= ")"; -- return s; -+ debug(std_regex_test) writeln("!!! FReD C-T test done !!!"); -+ } -+ -+ ct_tests(); -+ run_tests!bmatch(); //backtracker -+ run_tests!match(); //thompson VM -+} -+ -+unittest -+{ -+ auto cr = ctRegex!("abc"); -+ assert(bmatch("abc",cr).hit == "abc"); -+ auto cr2 = ctRegex!("ab*c"); -+ assert(bmatch("abbbbc",cr2).hit == "abbbbc"); -+ auto cr3 = ctRegex!("^abc$"); -+ assert(bmatch("abc",cr3).hit == "abc"); -+ auto cr4 = ctRegex!(`\b(a\B[a-z]b)\b`); -+ assert(array(match("azb",cr4).captures) == ["azb", "azb"]); -+ auto cr5 = ctRegex!("(?:a{2,4}b{1,3}){1,2}"); -+ assert(bmatch("aaabaaaabbb", cr5).hit == "aaabaaaabbb"); -+ auto cr6 = ctRegex!("(?:a{2,4}b{1,3}){1,2}?"w); -+ assert(bmatch("aaabaaaabbb"w, cr6).hit == "aaab"w); -+ auto cr7 = ctRegex!(`\r.*?$`,"sm"); -+ assert(bmatch("abc\r\nxy", cr7).hit == "\r\nxy"); -+ auto greed = ctRegex!("<packet.*?/packet>"); -+ assert(bmatch("<packet>text</packet><packet>text</packet>", greed).hit -+ == "<packet>text</packet>"); -+ auto cr8 = ctRegex!("^(a)(b)?(c*)"); -+ auto m8 = bmatch("abcc",cr8); -+ assert(m8); -+ assert(m8.captures[1] == "a"); -+ assert(m8.captures[2] == "b"); -+ assert(m8.captures[3] == "cc"); -+ auto cr9 = ctRegex!("q(a|b)*q"); -+ auto m9 = match("xxqababqyy",cr9); -+ assert(m9); -+ assert(equal(bmatch("xxqababqyy",cr9).captures, ["qababq", "b"])); -+ -+ auto rtr = regex("a|b|c"); -+ enum ctr = regex("a|b|c"); -+ assert(equal(rtr.ir,ctr.ir)); -+ //CTFE parser BUG is triggered by group -+ //in the middle of alternation (at least not first and not last) -+ enum testCT = regex(`abc|(edf)|xyz`); -+ auto testRT = regex(`abc|(edf)|xyz`); -+ assert(equal(testCT.ir,testRT.ir)); -+} -+ -+unittest -+{ -+ enum cx = ctRegex!"(A|B|C)"; -+ auto mx = match("B",cx); -+ assert(mx); -+ assert(equal(mx.captures, [ "B", "B"])); -+ enum cx2 = ctRegex!"(A|B)*"; -+ assert(match("BAAA",cx2)); -+ enum cx3 = ctRegex!("a{3,4}","i"); -+ auto mx3 = match("AaA",cx3); -+ assert(mx3); -+ assert(mx3.captures[0] == "AaA"); -+ enum cx4 = ctRegex!(`^a{3,4}?[a-zA-Z0-9~]{1,2}`,"i"); -+ auto mx4 = match("aaaabc", cx4); -+ assert(mx4); -+ assert(mx4.captures[0] == "aaaab"); -+ auto cr8 = ctRegex!("(a)(b)?(c*)"); -+ auto m8 = bmatch("abcc",cr8); -+ assert(m8); -+ assert(m8.captures[1] == "a"); -+ assert(m8.captures[2] == "b"); -+ assert(m8.captures[3] == "cc"); -+ auto cr9 = ctRegex!(".*$", "gm"); -+ auto m9 = match("First\rSecond", cr9); -+ assert(m9); -+ assert(equal(map!"a.hit"(m9), ["First", "", "Second"])); -+} -+ -+unittest -+{ -+//global matching -+ void test_body(alias matchFn)() -+ { -+ string s = "a quick brown fox jumps over a lazy dog"; -+ auto r1 = regex("\\b[a-z]+\\b","g"); -+ string[] test; -+ foreach(m; matchFn(s, r1)) -+ test ~= m.hit; -+ assert(equal(test, [ "a", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog"])); -+ auto free_reg = regex(` -+ -+ abc -+ \s+ -+ " -+ ( -+ [^"]+ -+ | \\ " -+ )+ -+ " -+ z -+ `, "x"); -+ auto m = match(`abc "quoted string with \" inside"z`,free_reg); -+ assert(m); -+ string mails = " hey@you.com no@spam.net "; -+ auto rm = regex(`@(?<=\S+@)\S+`,"g"); -+ assert(equal(map!"a[0]"(matchFn(mails, rm)), ["@you.com", "@spam.net"])); -+ auto m2 = matchFn("First line\nSecond line",regex(".*$","gm")); -+ assert(equal(map!"a[0]"(m2), ["First line", "", "Second line"])); -+ auto m2a = matchFn("First line\nSecond line",regex(".+$","gm")); -+ assert(equal(map!"a[0]"(m2a), ["First line", "Second line"])); -+ auto m2b = matchFn("First line\nSecond line",regex(".+?$","gm")); -+ assert(equal(map!"a[0]"(m2b), ["First line", "Second line"])); -+ debug(std_regex_test) writeln("!!! FReD FLAGS test done "~matchFn.stringof~" !!!"); - } -- //CTFE parsing -- version(fred_ct) -- void ct_tests() -+ test_body!bmatch(); -+ test_body!match(); -+} -+ -+//tests for accumulated std.regex issues and other regressions -+unittest -+{ -+ void test_body(alias matchFn)() - { -- foreach(a, v; mixin(generate(140,38,39,40,52,55,57,62,63,67,80,190,191,192))) -- { -- enum tvd = tv[v]; -- enum r = regex(tvd.pattern, tvd.flags); -- auto nr = regex(tvd.pattern, tvd.flags); -+ //issue 5857 -+ //matching goes out of control if ... in (...){x} has .*/.+ -+ auto c = matchFn("axxxzayyyyyzd",regex("(a.*z){2}d")).captures; -+ assert(c[0] == "axxxzayyyyyzd"); -+ assert(c[1] == "ayyyyyz"); -+ auto c2 = matchFn("axxxayyyyyd",regex("(a.*){2}d")).captures; -+ assert(c2[0] == "axxxayyyyyd"); -+ assert(c2[1] == "ayyyyy"); -+ //issue 2108 -+ //greedy vs non-greedy -+ auto nogreed = regex("<packet.*?/packet>"); -+ assert(matchFn("<packet>text</packet><packet>text</packet>", nogreed).hit -+ == "<packet>text</packet>"); -+ auto greed = regex("<packet.*/packet>"); -+ assert(matchFn("<packet>text</packet><packet>text</packet>", greed).hit -+ == "<packet>text</packet><packet>text</packet>"); -+ //issue 4574 -+ //empty successful match still advances the input -+ string[] pres, posts, hits; -+ foreach(m; matchFn("abcabc", regex("","g"))) { -+ pres ~= m.pre; -+ posts ~= m.post; -+ assert(m.hit.empty); -+ -+ } -+ auto heads = [ -+ "abcabc", -+ "abcab", -+ "abca", -+ "abc", -+ "ab", -+ "a", -+ "" -+ ]; -+ auto tails = [ -+ "abcabc", -+ "bcabc", -+ "cabc", -+ "abc", -+ "bc", -+ "c", -+ "" -+ ]; -+ assert(pres == array(retro(heads))); -+ assert(posts == tails); -+ //issue 6076 -+ //regression on .* -+ auto re = regex("c.*|d"); -+ auto m = matchFn("mm", re); -+ assert(!m); -+ debug(std_regex_test) writeln("!!! FReD REGRESSION test done "~matchFn.stringof~" !!!"); -+ auto rprealloc = regex(`((.){5}.{1,10}){5}`); -+ auto arr = array(repeat('0',100)); -+ auto m2 = matchFn(arr, rprealloc); -+ assert(m2); -+ assert(collectException( -+ regex(r"^(import|file|binary|config)\s+([^\(]+)\(?([^\)]*)\)?\s*$") -+ ) is null); -+ foreach(ch; [Escapables]) -+ { -+ assert(match(to!string(ch),regex(`[\`~ch~`]`))); -+ assert(!match(to!string(ch),regex(`[^\`~ch~`]`))); -+ assert(match(to!string(ch),regex(`[\`~ch~`-\`~ch~`]`))); -+ } -+ //bugzilla 7718 -+ string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'notimer'"; -+ auto reStrCmd = regex (`(".*")|('.*')`, "g"); -+ assert(equal(map!"a[0]"(matchFn(strcmd, reStrCmd)), -+ [`"/GIT/Ruby Apps/sec"`, `'notimer'`])); -+ } -+ test_body!bmatch(); -+ test_body!match(); -+} -+ -+// tests for replace -+unittest -+{ -+ void test(alias matchFn)() -+ { -+ import std.string : toUpper; - -- debug(fred_test) -+ foreach(i, v; TypeTuple!(string, wstring, dstring)) -+ { -+ auto baz(Cap)(Cap m) -+ if (is(Cap == Captures!(Cap.String))) - { -- writeln(" Test #", a, " pattern: ", tvd.pattern); -- if(!equal(r.ir, nr.ir)) -- { -- writeln("C-T version :"); -- r.print(); -- writeln("R-T version :"); -- nr.print(); -- assert(0, text("!C-T regex! failed to compile pattern #", a ,": ", tvd.pattern)); -- } -+ return std.string.toUpper(m.hit); - } -- else -- assert(equal(r.ir, nr.ir), text("!C-T regex! failed to compile pattern #", a ,": ", tvd.pattern)); -- -+ alias v String; -+ assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c")) -+ == to!String("ack rapacity")); -+ assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r"), "g"), to!String("c")) -+ == to!String("ack capacity")); -+ assert(std.regex.replace!(matchFn)(to!String("noon"), regex(to!String("^n")), to!String("[$&]")) -+ == to!String("[n]oon")); -+ assert(std.regex.replace!(matchFn)(to!String("test1 test2"), regex(to!String(`\w+`),"g"), to!String("$`:$'")) -+ == to!String(": test2 test1 :")); -+ auto s = std.regex.replace!(baz!(Captures!(String)))(to!String("Strap a rocket engine on a chicken."), -+ regex(to!String("[ar]"), "g")); -+ assert(s == "StRAp A Rocket engine on A chicken."); - } -- debug(fred_test) writeln("!!! FReD C-T test done !!!"); -+ debug(std_regex_test) writeln("!!! Replace test done "~matchFn.stringof~" !!!"); - } -+ test!(bmatch)(); -+ test!(match)(); -+} - -- version(fred_ct) -- ct_tests(); -- else -+// tests for splitter -+unittest -+{ -+ auto s1 = ", abc, de, fg, hi, "; -+ auto sp1 = splitter(s1, regex(", *")); -+ auto w1 = ["", "abc", "de", "fg", "hi", ""]; -+ assert(equal(sp1, w1)); -+ -+ auto s2 = ", abc, de, fg, hi"; -+ auto sp2 = splitter(s2, regex(", *")); -+ auto w2 = ["", "abc", "de", "fg", "hi"]; -+ -+ uint cnt; -+ foreach(e; sp2) { -+ assert(w2[cnt++] == e); -+ } -+ assert(equal(sp2, w2)); -+} -+ -+unittest -+{ -+ char[] s1 = ", abc, de, fg, hi, ".dup; -+ auto sp2 = splitter(s1, regex(", *")); -+} -+ -+unittest -+{ -+ auto s1 = ", abc, de, fg, hi, "; -+ auto w1 = ["", "abc", "de", "fg", "hi", ""]; -+ assert(equal(split(s1, regex(", *")), w1[])); -+} -+ -+unittest -+{ // bugzilla 7141 -+ string pattern = `[a\--b]`; -+ assert(match("-", pattern)); -+ assert(match("b", pattern)); -+ string pattern2 = `[&-z]`; -+ assert(match("b", pattern2)); -+} -+unittest -+{//bugzilla 7111 -+ assert(match("", regex("^"))); -+} -+unittest -+{//bugzilla 7300 -+ assert(!match("a"d, "aa"d)); -+} -+ -+unittest -+{//bugzilla 7674 -+ assert("1234".replace(regex("^"), "$$") == "$1234"); -+ assert("hello?".replace(regex(r"\?", "g"), r"\?") == r"hello\?"); -+ assert("hello?".replace(regex(r"\?", "g"), r"\\?") != r"hello\?"); -+} -+unittest -+{// bugzilla 7679 -+ foreach(S; TypeTuple!(string, wstring, dstring)) - { -- run_tests!bmatch(); //backtracker -- run_tests!match(); //thompson VM -+ enum re = ctRegex!(to!S(r"\.")); -+ auto str = to!S("a.b"); -+ assert(equal(std.regex.splitter(str, re), [to!S("a"), to!S("b")])); -+ assert(split(str, re) == [to!S("a"), to!S("b")]); - } - } -+unittest -+{//bugzilla 8203 -+ string data = " -+ NAME = XPAW01_STA:STATION -+ NAME = XPAW01_STA -+ "; -+ auto uniFileOld = data; -+ auto r = regex( -+ r"^NAME = (?P<comp>[a-zA-Z0-9_]+):*(?P<blk>[a-zA-Z0-9_]*)","gm"); -+ auto uniCapturesNew = match(uniFileOld, r); -+ for(int i = 0; i < 20; i++) -+ foreach (matchNew; uniCapturesNew) {} -+} -+unittest -+{// bugzilla 8637 purity of enforce -+ auto m = match("hello world", regex("world")); -+ enforce(m); -+} -+ -+// bugzilla 8725 -+unittest -+{ -+ static italic = regex( r"\* -+ (?!\s+) -+ (.*?) -+ (?!\s+) -+ \*", "gx" ); -+ string input = "this * is* interesting, *very* interesting"; -+ assert(replace(input, italic, "<i>$1</i>") == -+ "this * is* interesting, <i>very</i> interesting"); -+} -+ -+// bugzilla 8349 -+unittest -+{ -+ enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>"; -+ enum peakRegex = ctRegex!(peakRegexStr); -+ //note that the regex pattern itself is probably bogus -+ assert(match(r"\>wgEncode-blah-Tfbs.narrow</a>", peakRegex)); -+} -+ -+// bugzilla 9211 -+unittest -+{ -+ auto rx_1 = regex(r"^(\w)*(\d)"); -+ auto m = match("1234", rx_1); -+ assert(equal(m.front, ["1234", "3", "4"])); -+ auto rx_2 = regex(r"^([0-9])*(\d)"); -+ auto m2 = match("1234", rx_2); -+ assert(equal(m2.front, ["1234", "3", "4"])); -+} -+ -+// bugzilla 9280 -+unittest -+{ -+ string tomatch = "a!b@c"; -+ static r = regex(r"^(?P<nick>.*?)!(?P<ident>.*?)@(?P<host>.*?)$"); -+ auto nm = match(tomatch, r); -+ assert(nm); -+ auto c = nm.captures; -+ assert(c[1] == "a"); -+ assert(c["nick"] == "a"); -+} -+ -+ -+// bugzilla 9579 -+unittest -+{ -+ char[] input = ['a', 'b', 'c']; -+ string format = "($1)"; -+ // used to give a compile error: -+ auto re = regex(`(a)`, "g"); -+ auto r = replace(input, re, format); -+ assert(r == "(a)bc"); -+} -+ -+// bugzilla 9634 -+unittest -+{ -+ auto re = ctRegex!"(?:a+)"; -+ assert(match("aaaa", re).hit == "aaaa"); -+} - --version(fred_ct) -+// bugzilla 10913 -+unittest - { -- unittest -+ @system static string foo(const(char)[] s) -+ { -+ return s.dup; -+ } -+ @safe static string bar(const(char)[] s) - { -- auto cr = ctRegex!("abc"); -- assert(bmatch("abc",cr).hit == "abc"); -- auto cr2 = ctRegex!("ab*c"); -- assert(bmatch("abbbbc",cr2).hit == "abbbbc"); -- auto cr3 = ctRegex!("^abc$"); -- assert(bmatch("abc",cr3).hit == "abc"); -- auto cr4 = ctRegex!(`\b(a\B[a-z]b)\b`); -- assert(array(match("azb",cr4).captures) == ["azb", "azb"]); -- auto cr5 = ctRegex!("(?:a{2,4}b{1,3}){1,2}"); -- assert(bmatch("aaabaaaabbb", cr5).hit == "aaabaaaabbb"); -- auto cr6 = ctRegex!("(?:a{2,4}b{1,3}){1,2}?"w); -- assert(bmatch("aaabaaaabbb"w, cr6).hit == "aaab"w); -- auto cr7 = ctRegex!(`\r.*?$`,"m"); -- assert(bmatch("abc\r\nxy", cr7).hit == "\r\nxy"); -- auto greed = ctRegex!("<packet.*?/packet>"); -- assert(bmatch("<packet>text</packet><packet>text</packet>", greed).hit -- == "<packet>text</packet>"); -- auto cr8 = ctRegex!("^(a)(b)?(c*)"); -- auto m8 = bmatch("abcc",cr8); -- assert(m8); -- assert(m8.captures[1] == "a"); -- assert(m8.captures[2] == "b"); -- assert(m8.captures[3] == "cc"); -- auto cr9 = ctRegex!("q(a|b)*q"); -- auto m9 = match("xxqababqyy",cr9); -- assert(m9); -- assert(equal(bmatch("xxqababqyy",cr9).captures, ["qababq", "b"])); -- -- auto rtr = regex("a|b|c"); -- enum ctr = regex("a|b|c"); -- assert(equal(rtr.ir,ctr.ir)); -- //CTFE parser BUG is triggered by group -- //in the middle of alternation (at least not first and not last) -- version(fred_bug) -- { -- enum testCT = regex(`abc|(edf)|xyz`); -- auto testRT = regex(`abc|(edf)|xyz`); -- debug -- { -- writeln("C-T version :"); -- testCT.print(); -- writeln("R-T version :"); -- testRT.print(); -- -- } -- -- } -- -- } -- -- unittest -- { -- enum cx = ctRegex!"(A|B|C)"; -- auto mx = match("B",cx); -- assert(mx); -- assert(equal(mx.captures, [ "B", "B"])); -- enum cx2 = ctRegex!"(A|B)*"; -- assert(match("BAAA",cx2)); -- enum cx3 = ctRegex!("a{3,4}","i"); -- auto mx3 = match("AaA",cx3); -- assert(mx3); -- assert(mx3.captures[0] == "AaA"); -- enum cx4 = ctRegex!(`^a{3,4}?[a-zA-Z0-9~]{1,2}`,"i"); -- auto mx4 = match("aaaabc", cx4); -- assert(mx4); -- assert(mx4.captures[0] == "aaaab"); -- auto cr8 = ctRegex!("(a)(b)?(c*)"); -- auto m8 = bmatch("abcc",cr8); -- assert(m8); -- assert(m8.captures[1] == "a"); -- assert(m8.captures[2] == "b"); -- assert(m8.captures[3] == "cc"); -- auto cr9 = ctRegex!(".*$", "gm"); -- auto m9 = match("First\rSecond"); -- assert(m9); -- assert(equal(map!"a.hit"(m9.captures), ["First", "", "Second"])); -- } --} --else --{ -- unittest -- { -- //global matching -- void test_body(alias matchFn)() -- { -- string s = "a quick brown fox jumps over a lazy dog"; -- auto r1 = regex("\\b[a-z]+\\b","g"); -- string[] test; -- foreach(m; matchFn(s, r1)) -- test ~= m.hit; -- assert(equal(test, [ "a", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog"])); -- auto free_reg = regex(` -- -- abc -- \s+ -- " -- ( -- [^"]+ -- | \\ " -- )+ -- " -- z -- `, "x"); -- auto m = match(`abc "quoted string with \" inside"z`,free_reg); -- assert(m); -- string mails = " hey@you.com no@spam.net "; -- auto rm = regex(`@(?<=\S+@)\S+`,"g"); -- assert(equal(map!"a[0]"(matchFn(mails, rm)), ["@you.com", "@spam.net"])); -- auto m2 = matchFn("First line\nSecond line",regex(".*$","gm")); -- assert(equal(map!"a[0]"(m2), ["First line", "", "Second line"])); -- auto m2a = matchFn("First line\nSecond line",regex(".+$","gm")); -- assert(equal(map!"a[0]"(m2a), ["First line", "Second line"])); -- auto m2b = matchFn("First line\nSecond line",regex(".+?$","gm")); -- assert(equal(map!"a[0]"(m2b), ["First line", "Second line"])); -- debug(fred_test) writeln("!!! FReD FLAGS test done "~matchFn.stringof~" !!!"); -- } -- test_body!bmatch(); -- test_body!match(); -- } -- -- //tests for accomulated std.regex issues and other regressions -- unittest -- { -- void test_body(alias matchFn)() -- { -- //issue 5857 -- //matching goes out of control if ... in (...){x} has .*/.+ -- auto c = matchFn("axxxzayyyyyzd",regex("(a.*z){2}d")).captures; -- assert(c[0] == "axxxzayyyyyzd"); -- assert(c[1] == "ayyyyyz"); -- auto c2 = matchFn("axxxayyyyyd",regex("(a.*){2}d")).captures; -- assert(c2[0] == "axxxayyyyyd"); -- assert(c2[1] == "ayyyyy"); -- //issue 2108 -- //greedy vs non-greedy -- auto nogreed = regex("<packet.*?/packet>"); -- assert(matchFn("<packet>text</packet><packet>text</packet>", nogreed).hit -- == "<packet>text</packet>"); -- auto greed = regex("<packet.*/packet>"); -- assert(matchFn("<packet>text</packet><packet>text</packet>", greed).hit -- == "<packet>text</packet><packet>text</packet>"); -- //issue 4574 -- //empty successful match still advances the input -- string[] pres, posts, hits; -- foreach(m; matchFn("abcabc", regex("","g"))) { -- pres ~= m.pre; -- posts ~= m.post; -- assert(m.hit.empty); -- -- } -- auto heads = [ -- "abcabc", -- "abcab", -- "abca", -- "abc", -- "ab", -- "a", -- "" -- ]; -- auto tails = [ -- "abcabc", -- "bcabc", -- "cabc", -- "abc", -- "bc", -- "c", -- "" -- ]; -- assert(pres == array(retro(heads))); -- assert(posts == tails); -- //issue 6076 -- //regression on .* -- auto re = regex("c.*|d"); -- auto m = matchFn("mm", re); -- assert(!m); -- debug(fred_test) writeln("!!! FReD REGRESSION test done "~matchFn.stringof~" !!!"); -- auto rprealloc = regex(`((.){5}.{1,10}){5}`); -- auto arr = array(repeat('0',100)); -- auto m2 = matchFn(arr, rprealloc); -- assert(m2); -- assert(collectException( -- regex(r"^(import|file|binary|config)\s+([^\(]+)\(?([^\)]*)\)?\s*$") -- ) is null); -- foreach(ch; ['^','$','.','|','?',',','-',';',':' -- ,'#','&','%','/','<','>','`' -- ,'*','+','(',')','{','}']) -- { -- assert(match(to!string(ch),regex(`[\`~ch~`]`))); -- assert(!match(to!string(ch),regex(`[^\`~ch~`]`))); -- if(ch != '-') //'--' is an operator -- assert(match(to!string(ch),regex(`[\`~ch~`-\`~ch~`]`))); -- } -- //bugzilla 7718 -- string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'notimer'"; -- auto reStrCmd = regex (`(".*")|('.*')`, "g"); -- assert(equal(map!"a[0]"(matchFn(strcmd, reStrCmd)), -- [`"/GIT/Ruby Apps/sec"`, `'notimer'`])); -- } -- test_body!bmatch(); -- test_body!match(); -- } -- -- // tests for replace -- unittest -- { -- void test(alias matchFn)() -- { -- foreach(i, v; TypeTuple!(string, wstring, dstring)) -- { -- auto baz(Cap)(Cap m) -- if (is(Cap==Captures!(Cap.String))) -- { -- return std.string.toUpper(m.hit); -- } -- alias v String; -- assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c")) -- == to!String("ack rapacity")); -- assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r"), "g"), to!String("c")) -- == to!String("ack capacity")); -- assert(std.regex.replace!(matchFn)(to!String("noon"), regex(to!String("^n")), to!String("[$&]")) -- == to!String("[n]oon")); -- assert(std.regex.replace!(matchFn)(to!String("test1 test2"), regex(to!String(`\w+`),"g"), to!String("$`:$'")) -- == to!String(": test2 test1 :")); -- auto s = std.regex.replace!(baz!(Captures!(String)))(to!String("Strap a rocket engine on a chicken."), -- regex(to!String("[ar]"), "g")); -- assert(s == "StRAp A Rocket engine on A chicken."); -- } -- debug(fred_test) writeln("!!! Replace test done "~matchFn.stringof~" !!!"); -- } -- test!(bmatch)(); -- test!(match)(); -- } -- -- // tests for splitter -- unittest -- { -- auto s1 = ", abc, de, fg, hi, "; -- auto sp1 = splitter(s1, regex(", *")); -- auto w1 = ["", "abc", "de", "fg", "hi", ""]; -- assert(equal(sp1, w1)); -- -- auto s2 = ", abc, de, fg, hi"; -- auto sp2 = splitter(s2, regex(", *")); -- auto w2 = ["", "abc", "de", "fg", "hi"]; -- -- uint cnt; -- foreach(e; sp2) { -- assert(w2[cnt++] == e); -- } -- assert(equal(sp2, w2)); -- } -- -- unittest -- { -- char[] s1 = ", abc, de, fg, hi, ".dup; -- auto sp2 = splitter(s1, regex(", *")); -- } -- -- unittest -- { -- auto s1 = ", abc, de, fg, hi, "; -- auto w1 = ["", "abc", "de", "fg", "hi", ""]; -- assert(equal(split(s1, regex(", *")), w1[])); -- } -- -- unittest -- { // bugzilla 7141 -- string pattern = `[a\--b]`; -- assert(match("-", pattern)); -- assert(match("b", pattern)); -- string pattern2 = `[&-z]`; -- assert(match("b", pattern2)); -- } -- unittest -- {//bugzilla 7111 -- assert(match("", regex("^"))); -- } -- unittest -- {//bugzilla 7300 -- assert(!match("a"d, "aa"d)); -- } -- -- unittest -- {//bugzilla 7674 -- assert("1234".replace(regex("^"), "$$") == "$1234"); -- assert("hello?".replace(regex(r"\?", "g"), r"\?") == r"hello\?"); -- assert("hello?".replace(regex(r"\?", "g"), r"\\?") != r"hello\?"); -- } -- unittest -- {// bugzilla 7679 -- foreach(S; TypeTuple!(string, wstring, dstring)) -- { -- enum re = ctRegex!(to!S(r"\.")); -- auto str = to!S("a.b"); -- assert(equal(std.regex.splitter(str, re), [to!S("a"), to!S("b")])); -- assert(split(str, re) == [to!S("a"), to!S("b")]); -- } -- } -- unittest -- {//bugzilla 8203 -- string data = " -- NAME = XPAW01_STA:STATION -- NAME = XPAW01_STA -- "; -- auto uniFileOld = data; -- auto r = regex( -- r"^NAME = (?P<comp>[a-zA-Z0-9_]+):*(?P<blk>[a-zA-Z0-9_]*)","gm"); -- auto uniCapturesNew = match(uniFileOld, r); -- for(int i=0; i<20; i++) -- foreach (matchNew; uniCapturesNew) {} -- } -- unittest -- {// bugzilla 8637 purity of enforce -- auto m = match("hello world", regex("world")); -- enforce(m); -- } -- -- // bugzilla 8725 -- unittest -- { -- static italic = regex( r"\* -- (?!\s+) -- (.*?) -- (?!\s+) -- \*", "gx" ); -- string input = "this * is* interesting, *very* interesting"; -- assert(replace(input, italic, "<i>$1</i>") == -- "this * is* interesting, <i>very</i> interesting"); -- } -- -- // bugzilla 8349 -- unittest -- { -- enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>"; -- enum peakRegex = ctRegex!(peakRegexStr); -- //note that the regex pattern itself is probably bogus -- assert(match(r"\>wgEncode-blah-Tfbs.narrow</a>", peakRegex)); -- } -- -- // bugzilla 9211 -- unittest -- { -- auto rx_1 = regex(r"^(\w)*(\d)"); -- auto m = match("1234", rx_1); -- assert(equal(m.front, ["1234", "3", "4"])); -- auto rx_2 = regex(r"^([0-9])*(\d)"); -- auto m2 = match("1234", rx_2); -- assert(equal(m2.front, ["1234", "3", "4"])); -+ return s.dup; - } -+ () @system { -+ replace!((a) => foo(a.hit))("blah", regex(`a`)); -+ }(); -+ () @safe { -+ replace!((a) => bar(a.hit))("blah", regex(`a`)); -+ }(); -+} -+ -+// bugzilla 11262 -+unittest -+{ -+ enum reg = ctRegex!(r",", "g"); -+ auto str = "This,List"; -+ str = str.replace(reg, "-"); -+ assert(str == "This-List"); - } - - }//version(unittest) ---- a/src/libphobos/src/std/regexp.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/regexp.d 1970-01-01 01:00:00.000000000 +0100 -@@ -1,3434 +0,0 @@ --// Written in the D programming language. --// Regular Expressions. -- --/** -- * $(RED Deprecated. -- * Please use $(LINK2 std_regex.html, std.regex) instead.) -- * -- * $(LINK2 http://www.digitalmars.com/ctg/regular.html, Regular -- * expressions) are a powerful method of string pattern matching. The -- * regular expression language used in this library is the same as -- * that commonly used, however, some of the very advanced forms may -- * behave slightly differently. The standard observed is the $(WEB -- * www.ecma-international.org/publications/standards/Ecma-262.htm, -- * ECMA standard) for regular expressions. -- * -- * std.regexp is designed to work only with valid UTF strings as input. -- * To validate untrusted input, use std.utf.validate(). -- * -- * In the following guide, $(I pattern)[] refers to a -- * $(LINK2 http://www.digitalmars.com/ctg/regular.html, regular expression). -- * The $(I attributes)[] refers to -- * a string controlling the interpretation -- * of the regular expression. -- * It consists of a sequence of one or more -- * of the following characters: -- * -- * <table border=1 cellspacing=0 cellpadding=5> -- * <caption>Attribute Characters</caption> -- * $(TR $(TH Attribute) $(TH Action)) -- * <tr> -- * $(TD $(B g)) -- * $(TD global; repeat over the whole input string) -- * </tr> -- * <tr> -- * $(TD $(B i)) -- * $(TD case insensitive) -- * </tr> -- * <tr> -- * $(TD $(B m)) -- * $(TD treat as multiple lines separated by newlines) -- * </tr> -- * </table> -- * -- * The $(I format)[] string has the formatting characters: -- * -- * <table border=1 cellspacing=0 cellpadding=5> -- * <caption>Formatting Characters</caption> -- * $(TR $(TH Format) $(TH Replaced With)) -- * $(TR -- * $(TD $(B $$)) $(TD $) -- * ) -- * $(TR -- * $(TD $(B $&)) $(TD The matched substring.) -- * ) -- * $(TR -- * $(TD $(B $`)) $(TD The portion of string that precedes the matched substring.) -- * ) -- * $(TR -- * $(TD $(B $')) $(TD The portion of string that follows the matched substring.) -- * ) -- * $(TR -- * $(TD $(B $(DOLLAR))$(I n)) $(TD The $(I n)th capture, where $(I n) -- * is a single digit 1-9 -- * and $$(I n) is not followed by a decimal digit.) -- * ) -- * $(TR -- * $(TD $(B $(DOLLAR))$(I nn)) $(TD The $(I nn)th capture, where $(I nn) -- * is a two-digit decimal -- * number 01-99. -- * If $(I nn)th capture is undefined or more than the number -- * of parenthesized subexpressions, use the empty -- * string instead.) -- * ) -- * </table> -- * -- * Any other $ are left as is. -- * -- * References: -- * $(LINK2 http://en.wikipedia.org/wiki/Regular_expressions, Wikipedia) -- * Macros: -- * WIKI = StdRegexp -- * DOLLAR = $ -- * -- * Copyright: Copyright Digital Mars 2000 - 2011. -- * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -- * Authors: $(WEB digitalmars.com, Walter Bright) -- * Source: $(PHOBOSSRC std/_regexp.d) -- */ --/* Copyright Digital Mars 2000 - 2011. -- * Distributed under the Boost Software License, Version 1.0. -- * (See accompanying file LICENSE_1_0.txt or copy at -- * http://www.boost.org/LICENSE_1_0.txt) -- */ -- --/* -- Escape sequences: -- -- \nnn starts out a 1, 2 or 3 digit octal sequence, -- where n is an octal digit. If nnn is larger than -- 0377, then the 3rd digit is not part of the sequence -- and is not consumed. -- For maximal portability, use exactly 3 digits. -- -- \xXX starts out a 1 or 2 digit hex sequence. X -- is a hex character. If the first character after the \x -- is not a hex character, the value of the sequence is 'x' -- and the XX are not consumed. -- For maximal portability, use exactly 2 digits. -- -- \uUUUU is a unicode sequence. There are exactly -- 4 hex characters after the \u, if any are not, then -- the value of the sequence is 'u', and the UUUU are not -- consumed. -- -- Character classes: -- -- [a-b], where a is greater than b, will produce -- an error. -- -- References: -- -- http://www.unicode.org/unicode/reports/tr18/ --*/ -- --module std.regexp; -- --pragma(msg, "Notice: As of Phobos 2.055, std.regexp has been deprecated. " ~ -- "Please use std.regex instead."); -- --//debug = regexp; // uncomment to turn on debugging printf's -- --private --{ -- import core.stdc.stdio; -- import core.stdc.stdlib; -- import core.stdc.string; -- import std.algorithm; -- import std.array; -- import std.stdio; -- import std.string; -- import std.ascii; -- import std.outbuffer; -- import std.bitmanip; -- import std.utf; -- import std.algorithm; -- import std.array; -- import std.traits; --} -- --deprecated: -- --/** Regular expression to extract an _email address. -- * References: -- * $(LINK2 http://www.regular-expressions.info/email.html, How to Find or Validate an Email Address)$(BR) -- * $(LINK2 http://tools.ietf.org/html/rfc2822#section-3.4.1, RFC 2822 Internet Message Format) -- */ --string email = -- r"[a-zA-Z]([.]?([[a-zA-Z0-9_]-]+)*)?@([[a-zA-Z0-9_]\-_]+\.)+[a-zA-Z]{2,6}"; -- --/** Regular expression to extract a _url */ --string url = r"(([h|H][t|T]|[f|F])[t|T][p|P]([s|S]?)\:\/\/|~/|/)?([\w]+:\w+@)?(([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?)?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?([,]\w+)*((\?\w+=\w+)?(&\w+=\w+)*([,]\w*)*)?"; -- --/************************************ -- * One of these gets thrown on compilation errors -- */ -- --class RegExpException : Exception --{ -- this(string msg) -- { -- super(msg); -- } --} -- --struct regmatch_t --{ -- ptrdiff_t rm_so; // index of start of match -- ptrdiff_t rm_eo; // index past end of match --} -- --private alias char rchar; // so we can make a wchar version -- --/****************************************************** -- * Search string for matches with regular expression -- * pattern with attributes. -- * Replace each match with string generated from format. -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * format = Replacement string format. -- * attributes = Regular expression attributes. -- * Returns: -- * the resulting string -- * Example: -- * Replace the letters 'a' with the letters 'ZZ'. -- * --- -- * s = "Strap a rocket engine on a chicken." -- * sub(s, "a", "ZZ") // result: StrZZp a rocket engine on a chicken. -- * sub(s, "a", "ZZ", "g") // result: StrZZp ZZ rocket engine on ZZ chicken. -- * --- -- * The replacement format can reference the matches using -- * the $&, $$, $', $`, $0 .. $99 notation: -- * --- -- * sub(s, "[ar]", "[$&]", "g") // result: St[r][a]p [a] [r]ocket engine on [a] chi -- * --- -- */ -- --string sub(string s, string pattern, string format, string attributes = null) --{ -- auto r = new RegExp(pattern, attributes); -- auto result = r.replace(s, format); -- delete r; -- return result; --} -- --unittest --{ -- debug(regexp) printf("regexp.sub.unittest\n"); -- -- string r = sub("hello", "ll", "ss"); -- assert(r == "hesso"); --} -- --/******************************************************* -- * Search string for matches with regular expression -- * pattern with attributes. -- * Pass each match to delegate dg. -- * Replace each match with the return value from dg. -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * dg = Delegate -- * attributes = Regular expression attributes. -- * Returns: the resulting string. -- * Example: -- * Capitalize the letters 'a' and 'r': -- * --- -- * s = "Strap a rocket engine on a chicken."; -- * sub(s, "[ar]", -- * delegate char[] (RegExp m) -- * { -- * return toUpper(m[0]); -- * }, -- * "g"); // result: StRAp A Rocket engine on A chicken. -- * --- -- */ -- --string sub(string s, string pattern, string delegate(RegExp) dg, string attributes = null) --{ -- auto r = new RegExp(pattern, attributes); -- -- string result = s; -- size_t lastindex = 0; -- size_t offset = 0; -- -- while (r.test(s, lastindex)) -- { -- auto so = r.pmatch[0].rm_so; -- auto eo = r.pmatch[0].rm_eo; -- -- string replacement = dg(r); -- -- // Optimize by using std.string.replace if possible - Dave Fladebo -- string slice = result[offset + so .. offset + eo]; -- if (r.attributes & RegExp.REA.global && // global, so replace all -- !(r.attributes & RegExp.REA.ignoreCase) && // not ignoring case -- !(r.attributes & RegExp.REA.multiline) && // not multiline -- pattern == slice) // simple pattern (exact match, no special characters) -- { -- debug(regexp) -- printf("result: %.*s, pattern: %.*s, slice: %.*s, replacement: %.*s\n", -- result.length, result.ptr, -- pattern.length, pattern.ptr, -- slice.length, slice.ptr, -- replacement.length, replacement.ptr); -- result = replace(result,slice,replacement); -- break; -- } -- -- result = replaceSlice(result, result[offset + so .. offset + eo], replacement); -- -- if (r.attributes & RegExp.REA.global) -- { -- offset += replacement.length - (eo - so); -- -- if (lastindex == eo) -- lastindex++; // always consume some source -- else -- lastindex = eo; -- } -- else -- break; -- } -- delete r; -- -- return result; --} -- --unittest --{ -- debug(regexp) printf("regexp.sub.unittest\n"); -- -- string foo(RegExp r) { return "ss"; } -- -- auto r = sub("hello", "ll", delegate string(RegExp r) { return "ss"; }); -- assert(r == "hesso"); -- -- r = sub("hello", "l", delegate string(RegExp r) { return "l"; }, "g"); -- assert(r == "hello"); -- -- auto s = sub("Strap a rocket engine on a chicken.", -- "[ar]", -- delegate string (RegExp m) -- { -- return std.string.toUpper(m[0]); -- }, -- "g"); -- assert(s == "StRAp A Rocket engine on A chicken."); --} -- -- --/************************************************* -- * Search $(D_PARAM s[]) for first match with $(D_PARAM pattern). -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * Returns: -- * index into s[] of match if found, -1 if no match. -- * Example: -- * --- -- * auto s = "abcabcabab"; -- * find(s, RegExp("b")); // match, returns 1 -- * find(s, RegExp("f")); // no match, returns -1 -- * --- -- */ -- --ptrdiff_t find(string s, RegExp pattern) --{ -- return pattern.test(s) -- ? pattern.pmatch[0].rm_so -- : -1; --} -- --unittest --{ -- debug(regexp) printf("regexp.find.unittest\n"); -- -- auto i = find("xabcy", RegExp("abc")); -- assert(i == 1); -- i = find("cba", RegExp("abc")); -- assert(i == -1); --} -- --/** -- Returns: -- -- Same as $(D_PARAM find(s, RegExp(pattern, attributes))). -- -- WARNING: -- -- This function is scheduled for deprecation due to unnecessary -- ambiguity with the homonym function in std.string. Instead of -- $(D_PARAM std.regexp.find(s, p, a)), you may want to use $(D_PARAM -- find(s, RegExp(p, a))). --*/ -- --ptrdiff_t --find(string s, string pattern, string attributes = null) --{ -- auto r = new RegExp(pattern, attributes); -- scope(exit) delete r; -- return r.test(s) ? r.pmatch[0].rm_so : -1; --} -- --unittest --{ -- debug(regexp) printf("regexp.find.unittest\n"); -- -- auto i = find("xabcy", "abc"); -- assert(i == 1); -- i = find("cba", "abc"); -- assert(i == -1); --} -- --/************************************************* -- * Search $(D_PARAM s[]) for last match with $(D_PARAM pattern). -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * Returns: -- * index into s[] of match if found, -1 if no match. -- * Example: -- * --- -- * auto s = "abcabcabab"; -- * rfind(s, RegExp("b")); // match, returns 9 -- * rfind(s, RegExp("f")); // no match, returns -1 -- * --- -- */ -- --ptrdiff_t rfind(string s, RegExp pattern) --{ -- ptrdiff_t i = -1, lastindex = 0; -- -- while (pattern.test(s, lastindex)) -- { -- auto eo = pattern.pmatch[0].rm_eo; -- i = pattern.pmatch[0].rm_so; -- if (lastindex == eo) -- lastindex++; // always consume some source -- else -- lastindex = eo; -- } -- return i; --} -- --unittest --{ -- ptrdiff_t i; -- -- debug(regexp) printf("regexp.rfind.unittest\n"); -- i = rfind("abcdefcdef", RegExp("c")); -- assert(i == 6); -- i = rfind("abcdefcdef", RegExp("cd")); -- assert(i == 6); -- i = rfind("abcdefcdef", RegExp("x")); -- assert(i == -1); -- i = rfind("abcdefcdef", RegExp("xy")); -- assert(i == -1); -- i = rfind("abcdefcdef", RegExp("")); -- assert(i == 10); --} -- --/************************************************* --Returns: -- -- Same as $(D_PARAM rfind(s, RegExp(pattern, attributes))). -- --WARNING: -- --This function is scheduled for deprecation due to unnecessary --ambiguity with the homonym function in std.string. Instead of --$(D_PARAM std.regexp.rfind(s, p, a)), you may want to use $(D_PARAM --rfind(s, RegExp(p, a))). --*/ -- --ptrdiff_t --rfind(string s, string pattern, string attributes = null) --{ -- typeof(return) i = -1, lastindex = 0; -- -- auto r = new RegExp(pattern, attributes); -- while (r.test(s, lastindex)) -- { -- auto eo = r.pmatch[0].rm_eo; -- i = r.pmatch[0].rm_so; -- if (lastindex == eo) -- lastindex++; // always consume some source -- else -- lastindex = eo; -- } -- delete r; -- return i; --} -- --unittest --{ -- ptrdiff_t i; -- -- debug(regexp) printf("regexp.rfind.unittest\n"); -- i = rfind("abcdefcdef", "c"); -- assert(i == 6); -- i = rfind("abcdefcdef", "cd"); -- assert(i == 6); -- i = rfind("abcdefcdef", "x"); -- assert(i == -1); -- i = rfind("abcdefcdef", "xy"); -- assert(i == -1); -- i = rfind("abcdefcdef", ""); -- assert(i == 10); --} -- -- --/******************************************** -- * Split s[] into an array of strings, using the regular -- * expression $(D_PARAM pattern) as the separator. -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * Returns: -- * array of slices into s[] -- * Example: -- * --- -- * foreach (s; split("abcabcabab", RegExp("C.", "i"))) -- * { -- * writefln("s = '%s'", s); -- * } -- * // Prints: -- * // s = 'ab' -- * // s = 'b' -- * // s = 'bab' -- * --- -- */ -- --string[] split(string s, RegExp pattern) --{ -- return pattern.split(s); --} -- --unittest --{ -- debug(regexp) printf("regexp.split.unittest()\n"); -- string[] result; -- -- result = split("ab", RegExp("a*")); -- assert(result.length == 2); -- assert(result[0] == ""); -- assert(result[1] == "b"); -- -- foreach (i, s; split("abcabcabab", RegExp("C.", "i"))) -- { -- //writefln("s[%d] = '%s'", i, s); -- if (i == 0) assert(s == "ab"); -- else if (i == 1) assert(s == "b"); -- else if (i == 2) assert(s == "bab"); -- else assert(0); -- } --} -- --/******************************************** -- Returns: -- Same as $(D_PARAM split(s, RegExp(pattern, attributes))). -- --WARNING: -- --This function is scheduled for deprecation due to unnecessary --ambiguity with the homonym function in std.string. Instead of --$(D_PARAM std.regexp.split(s, p, a)), you may want to use $(D_PARAM --split(s, RegExp(p, a))). --*/ -- --string[] split(string s, string pattern, string attributes = null) --{ -- auto r = new RegExp(pattern, attributes); -- auto result = r.split(s); -- delete r; -- return result; --} -- --unittest --{ -- debug(regexp) printf("regexp.split.unittest()\n"); -- string[] result; -- -- result = split("ab", "a*"); -- assert(result.length == 2); -- assert(result[0] == ""); -- assert(result[1] == "b"); -- -- foreach (i, s; split("abcabcabab", "C.", "i")) -- { -- //writefln("s[%d] = '%s'", i, s.length, s.ptr); -- if (i == 0) assert(s == "ab"); -- else if (i == 1) assert(s == "b"); -- else if (i == 2) assert(s == "bab"); -- else assert(0); -- } --} -- --/**************************************************** -- * Search s[] for first match with pattern[] with attributes[]. -- * Params: -- * s = String to search. -- * pattern = Regular expression pattern. -- * attributes = Regular expression attributes. -- * Returns: -- * corresponding RegExp if found, null if not. -- * Example: -- * --- -- * import std.stdio; -- * import std.regexp; -- * -- * void main() -- * { -- * if (auto m = std.regexp.search("abcdef", "c")) -- * { -- * writefln("%s[%s]%s", m.pre, m[0], m.post); -- * } -- * } -- * // Prints: -- * // ab[c]def -- * --- -- */ -- --RegExp search(string s, string pattern, string attributes = null) --{ -- auto r = new RegExp(pattern, attributes); -- if (!r.test(s)) -- { delete r; -- assert(r is null); -- } -- return r; --} -- --unittest --{ -- debug(regexp) printf("regexp.string.unittest()\n"); -- -- if (auto m = std.regexp.search("abcdef", "c()")) -- { -- auto result = std.string.format("%s[%s]%s", m.pre, m[0], m.post); -- assert(result == "ab[c]def"); -- assert(m[1] == null); -- assert(m[2] == null); -- } -- else -- assert(0); -- -- if (auto n = std.regexp.search("abcdef", "g")) -- { -- assert(0); -- } --} -- --/* ********************************* RegExp ******************************** */ -- --/***************************** -- * RegExp is a class to handle regular expressions. -- * -- * It is the core foundation for adding powerful string pattern matching -- * capabilities to programs like grep, text editors, awk, sed, etc. -- */ --class RegExp --{ -- /***** -- * Construct a RegExp object. Compile pattern -- * with <i>attributes</i> into -- * an internal form for fast execution. -- * Params: -- * pattern = regular expression -- * attributes = _attributes -- * Throws: RegExpException if there are any compilation errors. -- * Example: -- * Declare two variables and assign to them a RegExp object: -- * --- -- * auto r = new RegExp("pattern"); -- * auto s = new RegExp(r"p[1-5]\s*"); -- * --- -- */ -- public this(string pattern, string attributes = null) -- { -- pmatch = (&gmatch)[0 .. 1]; -- compile(pattern, attributes); -- } -- -- /***** -- * Generate instance of RegExp. -- * Params: -- * pattern = regular expression -- * attributes = _attributes -- * Throws: RegExpException if there are any compilation errors. -- * Example: -- * Declare two variables and assign to them a RegExp object: -- * --- -- * auto r = RegExp("pattern"); -- * auto s = RegExp(r"p[1-5]\s*"); -- * --- -- */ -- public static RegExp opCall(string pattern, string attributes = null) -- { -- return new RegExp(pattern, attributes); -- } -- -- unittest -- { -- debug(regexp) printf("regexp.opCall.unittest()\n"); -- auto r1 = RegExp("hello", "m"); -- string msg; -- try -- { -- auto r2 = RegExp("hello", "q"); -- assert(0); -- } -- catch (RegExpException ree) -- { -- msg = ree.toString(); -- //writefln("message: %s", ree); -- } -- assert(std.algorithm.countUntil(msg, "unrecognized attribute") >= 0); -- } -- -- /************************************ -- * Set up for start of foreach loop. -- * Returns: -- * search() returns instance of RegExp set up to _search string[]. -- * Example: -- * --- -- * import std.stdio; -- * import std.regexp; -- * -- * void main() -- * { -- * foreach(m; RegExp("ab").search("abcabcabab")) -- * { -- * writefln("%s[%s]%s", m.pre, m[0], m.post); -- * } -- * } -- * // Prints: -- * // [ab]cabcabab -- * // abc[ab]cabab -- * // abcabc[ab]ab -- * // abcabcab[ab] -- * --- -- */ -- -- public RegExp search(string string) -- { -- input = string; -- pmatch[0].rm_eo = 0; -- return this; -- } -- -- /** ditto */ -- public int opApply(scope int delegate(ref RegExp) dg) -- { -- int result; -- RegExp r = this; -- -- while (test()) -- { -- result = dg(r); -- if (result) -- break; -- } -- -- return result; -- } -- -- unittest -- { -- debug(regexp) printf("regexp.search.unittest()\n"); -- -- int i; -- foreach(m; RegExp("ab").search("abcabcabab")) -- { -- auto s = std.string.format("%s[%s]%s", m.pre, m[0], m.post); -- if (i == 0) assert(s == "[ab]cabcabab"); -- else if (i == 1) assert(s == "abc[ab]cabab"); -- else if (i == 2) assert(s == "abcabc[ab]ab"); -- else if (i == 3) assert(s == "abcabcab[ab]"); -- else assert(0); -- i++; -- } -- } -- -- /****************** -- * Retrieve match n. -- * -- * n==0 means the matched substring, n>0 means the -- * n'th parenthesized subexpression. -- * if n is larger than the number of parenthesized subexpressions, -- * null is returned. -- */ -- public string opIndex(size_t n) -- { -- if (n >= pmatch.length) -- return null; -- else -- { -- auto rm_so = pmatch[n].rm_so; -- auto rm_eo = pmatch[n].rm_eo; -- if (rm_so == rm_eo) -- return null; -- return input[rm_so .. rm_eo]; -- } -- } -- -- /** -- Same as $(D_PARAM opIndex(n)). -- -- WARNING: -- -- Scheduled for deprecation due to confusion with overloaded -- $(D_PARAM match(string)). Instead of $(D_PARAM regex.match(n)) -- you may want to use $(D_PARAM regex[n]). -- */ -- public string match(size_t n) -- { -- return this[n]; -- } -- -- /******************* -- * Return the slice of the input that precedes the matched substring. -- */ -- public @property string pre() -- { -- return input[0 .. pmatch[0].rm_so]; -- } -- -- /******************* -- * Return the slice of the input that follows the matched substring. -- */ -- public @property string post() -- { -- return input[pmatch[0].rm_eo .. $]; -- } -- -- uint re_nsub; // number of parenthesized subexpression matches -- regmatch_t[] pmatch; // array [re_nsub + 1] -- -- string input; // the string to search -- -- // per instance: -- -- string pattern; // source text of the regular expression -- -- string flags; // source text of the attributes parameter -- -- int errors; -- -- uint attributes; -- -- enum REA -- { -- global = 1, // has the g attribute -- ignoreCase = 2, // has the i attribute -- multiline = 4, // if treat as multiple lines separated -- // by newlines, or as a single line -- dotmatchlf = 8, // if . matches \n -- } -- -- --private: -- size_t src; // current source index in input[] -- size_t src_start; // starting index for match in input[] -- size_t p; // position of parser in pattern[] -- regmatch_t gmatch; // match for the entire regular expression -- // (serves as storage for pmatch[0]) -- -- const(ubyte)[] program; // pattern[] compiled into regular expression program -- OutBuffer buf; -- -- -- -- --/******************************************/ -- --// Opcodes -- -- enum : ubyte -- { -- REend, // end of program -- REchar, // single character -- REichar, // single character, case insensitive -- REdchar, // single UCS character -- REidchar, // single wide character, case insensitive -- REanychar, // any character -- REanystar, // ".*" -- REstring, // string of characters -- REistring, // string of characters, case insensitive -- REtestbit, // any in bitmap, non-consuming -- REbit, // any in the bit map -- REnotbit, // any not in the bit map -- RErange, // any in the string -- REnotrange, // any not in the string -- REor, // a | b -- REplus, // 1 or more -- REstar, // 0 or more -- REquest, // 0 or 1 -- REnm, // n..m -- REnmq, // n..m, non-greedy version -- REbol, // beginning of line -- REeol, // end of line -- REparen, // parenthesized subexpression -- REgoto, // goto offset -- -- REwordboundary, -- REnotwordboundary, -- REdigit, -- REnotdigit, -- REspace, -- REnotspace, -- REword, -- REnotword, -- REbackref, -- }; -- --// BUG: should this include '$'? -- private int isword(dchar c) { return isAlphaNum(c) || c == '_'; } -- -- private uint inf = ~0u; -- --/* ******************************** -- * Throws RegExpException on error -- */ -- -- public void compile(string pattern, string attributes) -- { -- //printf("RegExp.compile('%.*s', '%.*s')\n", pattern.length, pattern.ptr, attributes.length, attributes.ptr); -- -- this.attributes = 0; -- foreach (rchar c; attributes) -- { REA att; -- -- switch (c) -- { -- case 'g': att = REA.global; break; -- case 'i': att = REA.ignoreCase; break; -- case 'm': att = REA.multiline; break; -- default: -- error("unrecognized attribute"); -- return; -- } -- if (this.attributes & att) -- { error("redundant attribute"); -- return; -- } -- this.attributes |= att; -- } -- -- input = null; -- -- this.pattern = pattern; -- this.flags = attributes; -- -- uint oldre_nsub = re_nsub; -- re_nsub = 0; -- errors = 0; -- -- buf = new OutBuffer(); -- buf.reserve(pattern.length * 8); -- p = 0; -- parseRegexp(); -- if (p < pattern.length) -- { error("unmatched ')'"); -- } -- // @@@ SKIPPING OPTIMIZATION SOLVES BUG 941 @@@ -- //optimize(); -- program = buf.data; -- buf.data = null; -- delete buf; -- -- if (re_nsub > oldre_nsub) -- { -- if (pmatch.ptr is &gmatch) -- pmatch = null; -- pmatch.length = re_nsub + 1; -- } -- pmatch[0].rm_so = 0; -- pmatch[0].rm_eo = 0; -- } -- --/******************************************** -- * Split s[] into an array of strings, using the regular -- * expression as the separator. -- * Returns: -- * array of slices into s[] -- */ -- -- public string[] split(string s) -- { -- debug(regexp) printf("regexp.split()\n"); -- -- string[] result; -- -- if (s.length) -- { -- ptrdiff_t p, q; -- for (q = p; q != s.length;) -- { -- if (test(s, q)) -- { -- q = pmatch[0].rm_so; -- auto e = pmatch[0].rm_eo; -- if (e != p) -- { -- result ~= s[p .. q]; -- for (size_t i = 1; i < pmatch.length; i++) -- { -- auto so = pmatch[i].rm_so; -- auto eo = pmatch[i].rm_eo; -- if (so == eo) -- { so = 0; // -1 gives array bounds error -- eo = 0; -- } -- result ~= s[so .. eo]; -- } -- q = p = e; -- continue; -- } -- } -- q++; -- } -- result ~= s[p .. s.length]; -- } -- else if (!test(s)) -- result ~= s; -- return result; -- } -- -- unittest -- { -- debug(regexp) printf("regexp.split.unittest()\n"); -- -- auto r = new RegExp("a*?", null); -- string[] result; -- string j; -- int i; -- -- result = r.split("ab"); -- -- assert(result.length == 2); -- i = std.algorithm.cmp(result[0], "a"); -- assert(i == 0); -- i = std.algorithm.cmp(result[1], "b"); -- assert(i == 0); -- -- r = new RegExp("a*", null); -- result = r.split("ab"); -- assert(result.length == 2); -- i = std.algorithm.cmp(result[0], ""); -- assert(i == 0); -- i = std.algorithm.cmp(result[1], "b"); -- assert(i == 0); -- -- r = new RegExp("<(\\/)?([^<>]+)>", null); -- result = r.split("a<b>font</b>bar<TAG>hello</TAG>"); -- -- debug(regexp) -- { -- for (i = 0; i < result.length; i++) -- printf("result[%d] = '%.*s'\n", i, result[i].length, result[i].ptr); -- } -- -- j = join(result, ","); -- //printf("j = '%.*s'\n", j.length, j.ptr); -- i = std.algorithm.cmp(j, "a,,b,font,/,b,bar,,TAG,hello,/,TAG,"); -- assert(i == 0); -- -- r = new RegExp("a[bc]", null); -- result = r.match("123ab"); -- j = join(result, ","); -- i = std.algorithm.cmp(j, "ab"); -- assert(i == 0); -- -- result = r.match("ac"); -- j = join(result, ","); -- i = std.algorithm.cmp(j, "ac"); -- assert(i == 0); -- } -- --/************************************************* -- * Search string[] for match with regular expression. -- * Returns: -- * index of match if successful, -1 if not found -- */ -- -- public ptrdiff_t find(string string) -- { -- if (test(string)) -- return pmatch[0].rm_so; -- else -- return -1; // no match -- } -- --//deprecated alias find search; -- -- unittest -- { -- debug(regexp) printf("regexp.find.unittest()\n"); -- -- RegExp r = new RegExp("abc", null); -- auto i = r.find("xabcy"); -- assert(i == 1); -- i = r.find("cba"); -- assert(i == -1); -- } -- -- --/************************************************* -- * Search s[] for match. -- * Returns: -- * If global attribute, return same value as exec(s). -- * If not global attribute, return array of all matches. -- */ -- -- public string[] match(string s) -- { -- string[] result; -- -- if (attributes & REA.global) -- { -- ptrdiff_t lastindex = 0; -- -- while (test(s, lastindex)) -- { -- auto eo = pmatch[0].rm_eo; -- -- result ~= input[pmatch[0].rm_so .. eo]; -- if (lastindex == eo) -- lastindex++; // always consume some source -- else -- lastindex = eo; -- } -- } -- else -- { -- result = exec(s); -- } -- return result; -- } -- -- unittest -- { -- debug(regexp) printf("regexp.match.unittest()\n"); -- -- int i; -- string[] result; -- string j; -- RegExp r; -- -- r = new RegExp("a[bc]", null); -- result = r.match("1ab2ac3"); -- j = join(result, ","); -- i = std.algorithm.cmp(j, "ab"); -- assert(i == 0); -- -- r = new RegExp("a[bc]", "g"); -- result = r.match("1ab2ac3"); -- j = join(result, ","); -- i = std.algorithm.cmp(j, "ab,ac"); -- assert(i == 0); -- } -- -- --/************************************************* -- * Find regular expression matches in s[]. Replace those matches -- * with a new string composed of format[] merged with the result of the -- * matches. -- * If global, replace all matches. Otherwise, replace first match. -- * Returns: the new string -- */ -- -- public string replace(string s, string format) -- { -- debug(regexp) printf("string = %.*s, format = %.*s\n", s.length, s.ptr, format.length, format.ptr); -- -- string result = s; -- ptrdiff_t lastindex = 0; -- size_t offset = 0; -- -- for (;;) -- { -- if (!test(s, lastindex)) -- break; -- -- auto so = pmatch[0].rm_so; -- auto eo = pmatch[0].rm_eo; -- -- string replacement = replace(format); -- -- // Optimize by using replace if possible - Dave Fladebo -- string slice = result[offset + so .. offset + eo]; -- if (attributes & REA.global && // global, so replace all -- !(attributes & REA.ignoreCase) && // not ignoring case -- !(attributes & REA.multiline) && // not multiline -- pattern == slice && // simple pattern (exact match, no special characters) -- format == replacement) // simple format, not $ formats -- { -- debug(regexp) -- { -- auto sss = result[offset + so .. offset + eo]; -- printf("pattern: %.*s, slice: %.*s, format: %.*s, replacement: %.*s\n", -- pattern.length, pattern.ptr, sss.length, sss.ptr, format.length, format.ptr, replacement.length, replacement.ptr); -- } -- result = std.array.replace(result,slice,replacement); -- break; -- } -- -- result = replaceSlice(result, result[offset + so .. offset + eo], replacement); -- -- if (attributes & REA.global) -- { -- offset += replacement.length - (eo - so); -- -- if (lastindex == eo) -- lastindex++; // always consume some source -- else -- lastindex = eo; -- } -- else -- break; -- } -- -- return result; -- } -- -- unittest -- { -- debug(regexp) printf("regexp.replace.unittest()\n"); -- -- int i; -- string result; -- RegExp r; -- -- r = new RegExp("a[bc]", "g"); -- result = r.replace("1ab2ac3", "x$&y"); -- i = std.algorithm.cmp(result, "1xaby2xacy3"); -- assert(i == 0); -- -- r = new RegExp("ab", "g"); -- result = r.replace("1ab2ac3", "xy"); -- i = std.algorithm.cmp(result, "1xy2ac3"); -- assert(i == 0); -- } -- -- --/************************************************* -- * Search string[] for match. -- * Returns: -- * array of slices into string[] representing matches -- */ -- -- public string[] exec(string s) -- { -- debug(regexp) printf("regexp.exec(string = '%.*s')\n", s.length, s.ptr); -- input = s; -- pmatch[0].rm_so = 0; -- pmatch[0].rm_eo = 0; -- return exec(); -- } -- --/************************************************* -- * Pick up where last exec(string) or exec() left off, -- * searching string[] for next match. -- * Returns: -- * array of slices into string[] representing matches -- */ -- -- public string[] exec() -- { -- if (!test()) -- return null; -- -- auto result = new string[pmatch.length]; -- for (int i = 0; i < pmatch.length; i++) -- { -- if (pmatch[i].rm_so == pmatch[i].rm_eo) -- result[i] = null; -- else -- result[i] = input[pmatch[i].rm_so .. pmatch[i].rm_eo]; -- } -- -- return result; -- } -- --/************************************************ -- * Search s[] for match. -- * Returns: 0 for no match, !=0 for match -- * Example: ----- --import std.stdio; --import std.regexp; --import std.string; -- --int grep(int delegate(char[]) pred, char[][] list) --{ -- int count; -- foreach (s; list) -- { if (pred(s)) -- ++count; -- } -- return count; --} -- --void main() --{ -- auto x = grep(&RegExp("[Ff]oo").test, -- std.string.split("mary had a foo lamb")); -- writefln(x); --} ----- --* which prints: 1 --*/ -- //@@@ --public bool test(string s) -- { -- return test(s, 0 /*pmatch[0].rm_eo*/) != 0; -- } -- --/************************************************ -- * Pick up where last test(string) or test() left off, and search again. -- * Returns: 0 for no match, !=0 for match -- */ -- -- public int test() -- { -- return test(input, pmatch[0].rm_eo); -- } -- --/************************************************ -- * Test s[] starting at startindex against regular expression. -- * Returns: 0 for no match, !=0 for match -- */ -- -- public int test(string s, size_t startindex) -- { -- char firstc; -- -- input = s; -- debug (regexp) printf("RegExp.test(input[] = '%.*s', startindex = %zd)\n", input.length, input.ptr, startindex); -- pmatch[0].rm_so = 0; -- pmatch[0].rm_eo = 0; -- if (startindex < 0 || startindex > input.length) -- { -- return 0; // fail -- } -- //debug(regexp) printProgram(program); -- -- // First character optimization -- firstc = 0; -- if (program[0] == REchar) -- { -- firstc = program[1]; -- if (attributes & REA.ignoreCase && isAlpha(firstc)) -- firstc = 0; -- } -- -- for (auto si = startindex; ; si++) -- { -- if (firstc) -- { -- if (si == input.length) -- break; // no match -- if (input[si] != firstc) -- { -- si++; -- if (!chr(si, firstc)) // if first character not found -- break; // no match -- } -- } -- for (size_t i = 0; i < re_nsub + 1; i++) -- { -- pmatch[i].rm_so = -1; -- pmatch[i].rm_eo = -1; -- } -- src_start = src = si; -- if (trymatch(0, program.length)) -- { -- pmatch[0].rm_so = si; -- pmatch[0].rm_eo = src; -- //debug(regexp) printf("start = %d, end = %d\n", gmatch.rm_so, gmatch.rm_eo); -- return 1; -- } -- // If possible match must start at beginning, we are done -- if (program[0] == REbol || program[0] == REanystar) -- { -- if (attributes & REA.multiline) -- { -- // Scan for the next \n -- if (!chr(si, '\n')) -- break; // no match if '\n' not found -- } -- else -- break; -- } -- if (si == input.length) -- break; -- debug(regexp) -- { -- auto sss = input[si + 1 .. input.length]; -- printf("Starting new try: '%.*s'\n", sss.length, sss.ptr); -- } -- } -- return 0; // no match -- } -- -- /** -- Returns whether string $(D_PARAM s) matches $(D_PARAM this). -- */ -- alias test opEquals; --// bool opEquals(string s) --// { --// return test(s); --// } -- -- unittest -- { -- assert("abc" == RegExp(".b.")); -- assert("abc" != RegExp(".b..")); -- } -- -- int chr(ref size_t si, rchar c) -- { -- for (; si < input.length; si++) -- { -- if (input[si] == c) -- return 1; -- } -- return 0; -- } -- -- -- void printProgram(const(ubyte)[] prog) -- { -- //debug(regexp) -- { -- size_t len; -- uint n; -- uint m; -- ushort *pu; -- uint *puint; -- char[] str; -- -- printf("printProgram()\n"); -- for (size_t pc = 0; pc < prog.length; ) -- { -- printf("%3d: ", pc); -- -- //printf("prog[pc] = %d, REchar = %d, REnmq = %d\n", prog[pc], REchar, REnmq); -- switch (prog[pc]) -- { -- case REchar: -- printf("\tREchar '%c'\n", prog[pc + 1]); -- pc += 1 + char.sizeof; -- break; -- -- case REichar: -- printf("\tREichar '%c'\n", prog[pc + 1]); -- pc += 1 + char.sizeof; -- break; -- -- case REdchar: -- printf("\tREdchar '%c'\n", *cast(dchar *)&prog[pc + 1]); -- pc += 1 + dchar.sizeof; -- break; -- -- case REidchar: -- printf("\tREidchar '%c'\n", *cast(dchar *)&prog[pc + 1]); -- pc += 1 + dchar.sizeof; -- break; -- -- case REanychar: -- printf("\tREanychar\n"); -- pc++; -- break; -- -- case REstring: -- len = *cast(size_t *)&prog[pc + 1]; -- str = (cast(char*)&prog[pc + 1 + size_t.sizeof])[0 .. len]; -- printf("\tREstring x%x, '%.*s'\n", len, str.length, str.ptr); -- pc += 1 + size_t.sizeof + len * rchar.sizeof; -- break; -- -- case REistring: -- len = *cast(size_t *)&prog[pc + 1]; -- str = (cast(char*)&prog[pc + 1 + size_t.sizeof])[0 .. len]; -- printf("\tREistring x%x, '%.*s'\n", len, str.length, str.ptr); -- pc += 1 + size_t.sizeof + len * rchar.sizeof; -- break; -- -- case REtestbit: -- pu = cast(ushort *)&prog[pc + 1]; -- printf("\tREtestbit %d, %d\n", pu[0], pu[1]); -- len = pu[1]; -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case REbit: -- pu = cast(ushort *)&prog[pc + 1]; -- len = pu[1]; -- printf("\tREbit cmax=%02x, len=%d:", pu[0], len); -- for (n = 0; n < len; n++) -- printf(" %02x", prog[pc + 1 + 2 * ushort.sizeof + n]); -- printf("\n"); -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case REnotbit: -- pu = cast(ushort *)&prog[pc + 1]; -- printf("\tREnotbit %d, %d\n", pu[0], pu[1]); -- len = pu[1]; -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case RErange: -- len = *cast(uint *)&prog[pc + 1]; -- printf("\tRErange %d\n", len); -- // BUG: REAignoreCase? -- pc += 1 + uint.sizeof + len; -- break; -- -- case REnotrange: -- len = *cast(uint *)&prog[pc + 1]; -- printf("\tREnotrange %d\n", len); -- // BUG: REAignoreCase? -- pc += 1 + uint.sizeof + len; -- break; -- -- case REbol: -- printf("\tREbol\n"); -- pc++; -- break; -- -- case REeol: -- printf("\tREeol\n"); -- pc++; -- break; -- -- case REor: -- len = *cast(uint *)&prog[pc + 1]; -- printf("\tREor %d, pc=>%d\n", len, pc + 1 + uint.sizeof + len); -- pc += 1 + uint.sizeof; -- break; -- -- case REgoto: -- len = *cast(uint *)&prog[pc + 1]; -- printf("\tREgoto %d, pc=>%d\n", len, pc + 1 + uint.sizeof + len); -- pc += 1 + uint.sizeof; -- break; -- -- case REanystar: -- printf("\tREanystar\n"); -- pc++; -- break; -- -- case REnm: -- case REnmq: -- // len, n, m, () -- puint = cast(uint *)&prog[pc + 1]; -- len = puint[0]; -- n = puint[1]; -- m = puint[2]; -- printf("\tREnm%s len=%d, n=%u, m=%u, pc=>%d\n", -- (prog[pc] == REnmq) ? "q".ptr : " ".ptr, -- len, n, m, pc + 1 + uint.sizeof * 3 + len); -- pc += 1 + uint.sizeof * 3; -- break; -- -- case REparen: -- // len, n, () -- puint = cast(uint *)&prog[pc + 1]; -- len = puint[0]; -- n = puint[1]; -- printf("\tREparen len=%d n=%d, pc=>%d\n", len, n, pc + 1 + uint.sizeof * 2 + len); -- pc += 1 + uint.sizeof * 2; -- break; -- -- case REend: -- printf("\tREend\n"); -- return; -- -- case REwordboundary: -- printf("\tREwordboundary\n"); -- pc++; -- break; -- -- case REnotwordboundary: -- printf("\tREnotwordboundary\n"); -- pc++; -- break; -- -- case REdigit: -- printf("\tREdigit\n"); -- pc++; -- break; -- -- case REnotdigit: -- printf("\tREnotdigit\n"); -- pc++; -- break; -- -- case REspace: -- printf("\tREspace\n"); -- pc++; -- break; -- -- case REnotspace: -- printf("\tREnotspace\n"); -- pc++; -- break; -- -- case REword: -- printf("\tREword\n"); -- pc++; -- break; -- -- case REnotword: -- printf("\tREnotword\n"); -- pc++; -- break; -- -- case REbackref: -- printf("\tREbackref %d\n", prog[1]); -- pc += 2; -- break; -- -- default: -- assert(0); -- } -- } -- } -- } -- -- --/************************************************** -- * Match input against a section of the program[]. -- * Returns: -- * 1 if successful match -- * 0 no match -- */ -- -- int trymatch(size_t pc, size_t pcend) -- { -- size_t len; -- size_t n; -- size_t m; -- size_t count; -- size_t pop; -- size_t ss; -- regmatch_t *psave; -- size_t c1; -- size_t c2; -- ushort* pu; -- uint* puint; -- -- debug(regexp) -- { -- auto sss = input[src .. input.length]; -- printf("RegExp.trymatch(pc = %zd, src = '%.*s', pcend = %zd)\n", pc, sss.length, sss.ptr, pcend); -- } -- auto srcsave = src; -- psave = null; -- for (;;) -- { -- if (pc == pcend) // if done matching -- { debug(regex) printf("\tprogend\n"); -- return 1; -- } -- -- //printf("\top = %d\n", program[pc]); -- switch (program[pc]) -- { -- case REchar: -- if (src == input.length) -- goto Lnomatch; -- debug(regexp) printf("\tREchar '%c', src = '%c'\n", program[pc + 1], input[src]); -- if (program[pc + 1] != input[src]) -- goto Lnomatch; -- src++; -- pc += 1 + char.sizeof; -- break; -- -- case REichar: -- if (src == input.length) -- goto Lnomatch; -- debug(regexp) printf("\tREichar '%c', src = '%c'\n", program[pc + 1], input[src]); -- c1 = program[pc + 1]; -- c2 = input[src]; -- if (c1 != c2) -- { -- if (isLower(cast(rchar)c2)) -- c2 = std.ascii.toUpper(cast(rchar)c2); -- else -- goto Lnomatch; -- if (c1 != c2) -- goto Lnomatch; -- } -- src++; -- pc += 1 + char.sizeof; -- break; -- -- case REdchar: -- debug(regexp) printf("\tREdchar '%c', src = '%c'\n", *(cast(dchar *)&program[pc + 1]), input[src]); -- if (src == input.length) -- goto Lnomatch; -- if (*(cast(dchar *)&program[pc + 1]) != input[src]) -- goto Lnomatch; -- src++; -- pc += 1 + dchar.sizeof; -- break; -- -- case REidchar: -- debug(regexp) printf("\tREidchar '%c', src = '%c'\n", *(cast(dchar *)&program[pc + 1]), input[src]); -- if (src == input.length) -- goto Lnomatch; -- c1 = *(cast(dchar *)&program[pc + 1]); -- c2 = input[src]; -- if (c1 != c2) -- { -- if (isLower(cast(rchar)c2)) -- c2 = std.ascii.toUpper(cast(rchar)c2); -- else -- goto Lnomatch; -- if (c1 != c2) -- goto Lnomatch; -- } -- src++; -- pc += 1 + dchar.sizeof; -- break; -- -- case REanychar: -- debug(regexp) printf("\tREanychar\n"); -- if (src == input.length) -- goto Lnomatch; -- if (!(attributes & REA.dotmatchlf) && input[src] == cast(rchar)'\n') -- goto Lnomatch; -- src += std.utf.stride(input, src); -- //src++; -- pc++; -- break; -- -- case REstring: -- len = *cast(size_t *)&program[pc + 1]; -- debug(regexp) -- { -- auto sss2 = (&program[pc + 1 + size_t.sizeof])[0 .. len]; -- printf("\tREstring x%x, '%.*s'\n", len, sss2.length, sss2.ptr); -- } -- if (src + len > input.length) -- goto Lnomatch; -- if (memcmp(&program[pc + 1 + size_t.sizeof], &input[src], len * rchar.sizeof)) -- goto Lnomatch; -- src += len; -- pc += 1 + size_t.sizeof + len * rchar.sizeof; -- break; -- -- case REistring: -- len = *cast(size_t *)&program[pc + 1]; -- debug(regexp) -- { -- auto sss2 = (&program[pc + 1 + size_t.sizeof])[0 .. len]; -- printf("\tREistring x%x, '%.*s'\n", len, sss2.length, sss2.ptr); -- } -- if (src + len > input.length) -- goto Lnomatch; -- if (icmp((cast(char*)&program[pc + 1 + size_t.sizeof])[0..len], -- input[src .. src + len])) -- goto Lnomatch; -- src += len; -- pc += 1 + size_t.sizeof + len * rchar.sizeof; -- break; -- -- case REtestbit: -- pu = (cast(ushort *)&program[pc + 1]); -- if (src == input.length) -- goto Lnomatch; -- debug(regexp) printf("\tREtestbit %d, %d, '%c', x%02x\n", -- pu[0], pu[1], input[src], input[src]); -- len = pu[1]; -- c1 = input[src]; -- //printf("[x%02x]=x%02x, x%02x\n", c1 >> 3, ((&program[pc + 1 + 4])[c1 >> 3] ), (1 << (c1 & 7))); -- if (c1 <= pu[0] && -- !((&(program[pc + 1 + 4]))[c1 >> 3] & (1 << (c1 & 7)))) -- goto Lnomatch; -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case REbit: -- pu = (cast(ushort *)&program[pc + 1]); -- if (src == input.length) -- goto Lnomatch; -- debug(regexp) printf("\tREbit %d, %d, '%c'\n", -- pu[0], pu[1], input[src]); -- len = pu[1]; -- c1 = input[src]; -- if (c1 > pu[0]) -- goto Lnomatch; -- if (!((&program[pc + 1 + 4])[c1 >> 3] & (1 << (c1 & 7)))) -- goto Lnomatch; -- src++; -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case REnotbit: -- pu = (cast(ushort *)&program[pc + 1]); -- if (src == input.length) -- goto Lnomatch; -- debug(regexp) printf("\tREnotbit %d, %d, '%c'\n", -- pu[0], pu[1], input[src]); -- len = pu[1]; -- c1 = input[src]; -- if (c1 <= pu[0] && -- ((&program[pc + 1 + 4])[c1 >> 3] & (1 << (c1 & 7)))) -- goto Lnomatch; -- src++; -- pc += 1 + 2 * ushort.sizeof + len; -- break; -- -- case RErange: -- len = *cast(uint *)&program[pc + 1]; -- debug(regexp) printf("\tRErange %d\n", len); -- if (src == input.length) -- goto Lnomatch; -- // BUG: REA.ignoreCase? -- if (memchr(cast(char*)&program[pc + 1 + uint.sizeof], input[src], len) == null) -- goto Lnomatch; -- src++; -- pc += 1 + uint.sizeof + len; -- break; -- -- case REnotrange: -- len = *cast(uint *)&program[pc + 1]; -- debug(regexp) printf("\tREnotrange %d\n", len); -- if (src == input.length) -- goto Lnomatch; -- // BUG: REA.ignoreCase? -- if (memchr(cast(char*)&program[pc + 1 + uint.sizeof], input[src], len) != null) -- goto Lnomatch; -- src++; -- pc += 1 + uint.sizeof + len; -- break; -- -- case REbol: -- debug(regexp) printf("\tREbol\n"); -- if (src == 0) -- { -- } -- else if (attributes & REA.multiline) -- { -- if (input[src - 1] != '\n') -- goto Lnomatch; -- } -- else -- goto Lnomatch; -- pc++; -- break; -- -- case REeol: -- debug(regexp) printf("\tREeol\n"); -- if (src == input.length) -- { -- } -- else if (attributes & REA.multiline && input[src] == '\n') -- src++; -- else -- goto Lnomatch; -- pc++; -- break; -- -- case REor: -- len = (cast(uint *)&program[pc + 1])[0]; -- debug(regexp) printf("\tREor %d\n", len); -- pop = pc + 1 + uint.sizeof; -- ss = src; -- if (trymatch(pop, pcend)) -- { -- if (pcend != program.length) -- { -- auto s = src; -- if (trymatch(pcend, program.length)) -- { debug(regexp) printf("\tfirst operand matched\n"); -- src = s; -- return 1; -- } -- else -- { -- // If second branch doesn't match to end, take first anyway -- src = ss; -- if (!trymatch(pop + len, program.length)) -- { -- debug(regexp) printf("\tfirst operand matched\n"); -- src = s; -- return 1; -- } -- } -- src = ss; -- } -- else -- { debug(regexp) printf("\tfirst operand matched\n"); -- return 1; -- } -- } -- pc = pop + len; // proceed with 2nd branch -- break; -- -- case REgoto: -- debug(regexp) printf("\tREgoto\n"); -- len = (cast(uint *)&program[pc + 1])[0]; -- pc += 1 + uint.sizeof + len; -- break; -- -- case REanystar: -- debug(regexp) printf("\tREanystar\n"); -- pc++; -- for (;;) -- { -- auto s1 = src; -- if (src == input.length) -- break; -- if (!(attributes & REA.dotmatchlf) && input[src] == '\n') -- break; -- src++; -- auto s2 = src; -- -- // If no match after consumption, but it -- // did match before, then no match -- if (!trymatch(pc, program.length)) -- { -- src = s1; -- // BUG: should we save/restore pmatch[]? -- if (trymatch(pc, program.length)) -- { -- src = s1; // no match -- break; -- } -- } -- src = s2; -- } -- break; -- -- case REnm: -- case REnmq: -- // len, n, m, () -- puint = cast(uint *)&program[pc + 1]; -- len = puint[0]; -- n = puint[1]; -- m = puint[2]; -- debug(regexp) printf("\tREnm%s len=%d, n=%u, m=%u\n", -- (program[pc] == REnmq) ? "q".ptr : "".ptr, len, n, m); -- pop = pc + 1 + uint.sizeof * 3; -- for (count = 0; count < n; count++) -- { -- if (!trymatch(pop, pop + len)) -- goto Lnomatch; -- } -- if (!psave && count < m) -- { -- //version (Win32) -- psave = cast(regmatch_t *)alloca((re_nsub + 1) * regmatch_t.sizeof); -- //else -- //psave = new regmatch_t[re_nsub + 1]; -- } -- if (program[pc] == REnmq) // if minimal munch -- { -- for (; count < m; count++) -- { -- memcpy(psave, pmatch.ptr, (re_nsub + 1) * regmatch_t.sizeof); -- auto s1 = src; -- -- if (trymatch(pop + len, program.length)) -- { -- src = s1; -- memcpy(pmatch.ptr, psave, (re_nsub + 1) * regmatch_t.sizeof); -- break; -- } -- -- if (!trymatch(pop, pop + len)) -- { debug(regexp) printf("\tdoesn't match subexpression\n"); -- break; -- } -- -- // If source is not consumed, don't -- // infinite loop on the match -- if (s1 == src) -- { debug(regexp) printf("\tsource is not consumed\n"); -- break; -- } -- } -- } -- else // maximal munch -- { -- for (; count < m; count++) -- { -- memcpy(psave, pmatch.ptr, (re_nsub + 1) * regmatch_t.sizeof); -- auto s1 = src; -- if (!trymatch(pop, pop + len)) -- { debug(regexp) printf("\tdoesn't match subexpression\n"); -- break; -- } -- auto s2 = src; -- -- // If source is not consumed, don't -- // infinite loop on the match -- if (s1 == s2) -- { debug(regexp) printf("\tsource is not consumed\n"); -- break; -- } -- -- // If no match after consumption, but it -- // did match before, then no match -- if (!trymatch(pop + len, program.length)) -- { -- src = s1; -- if (trymatch(pop + len, program.length)) -- { -- src = s1; // no match -- memcpy(pmatch.ptr, psave, (re_nsub + 1) * regmatch_t.sizeof); -- break; -- } -- } -- src = s2; -- } -- } -- debug(regexp) printf("\tREnm len=%d, n=%u, m=%u, DONE count=%d\n", len, n, m, count); -- pc = pop + len; -- break; -- -- case REparen: -- // len, () -- debug(regexp) printf("\tREparen\n"); -- puint = cast(uint *)&program[pc + 1]; -- len = puint[0]; -- n = puint[1]; -- pop = pc + 1 + uint.sizeof * 2; -- ss = src; -- if (!trymatch(pop, pop + len)) -- goto Lnomatch; -- pmatch[n + 1].rm_so = ss; -- pmatch[n + 1].rm_eo = src; -- pc = pop + len; -- break; -- -- case REend: -- debug(regexp) printf("\tREend\n"); -- return 1; // successful match -- -- case REwordboundary: -- debug(regexp) printf("\tREwordboundary\n"); -- if (src > 0 && src < input.length) -- { -- c1 = input[src - 1]; -- c2 = input[src]; -- if (!( -- (isword(cast(rchar)c1) && !isword(cast(rchar)c2)) || -- (!isword(cast(rchar)c1) && isword(cast(rchar)c2)) -- ) -- ) -- goto Lnomatch; -- } -- pc++; -- break; -- -- case REnotwordboundary: -- debug(regexp) printf("\tREnotwordboundary\n"); -- if (src == 0 || src == input.length) -- goto Lnomatch; -- c1 = input[src - 1]; -- c2 = input[src]; -- if ( -- (isword(cast(rchar)c1) && !isword(cast(rchar)c2)) || -- (!isword(cast(rchar)c1) && isword(cast(rchar)c2)) -- ) -- goto Lnomatch; -- pc++; -- break; -- -- case REdigit: -- debug(regexp) printf("\tREdigit\n"); -- if (src == input.length) -- goto Lnomatch; -- if (!isDigit(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REnotdigit: -- debug(regexp) printf("\tREnotdigit\n"); -- if (src == input.length) -- goto Lnomatch; -- if (isDigit(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REspace: -- debug(regexp) printf("\tREspace\n"); -- if (src == input.length) -- goto Lnomatch; -- if (!isWhite(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REnotspace: -- debug(regexp) printf("\tREnotspace\n"); -- if (src == input.length) -- goto Lnomatch; -- if (isWhite(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REword: -- debug(regexp) printf("\tREword\n"); -- if (src == input.length) -- goto Lnomatch; -- if (!isword(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REnotword: -- debug(regexp) printf("\tREnotword\n"); -- if (src == input.length) -- goto Lnomatch; -- if (isword(input[src])) -- goto Lnomatch; -- src++; -- pc++; -- break; -- -- case REbackref: -- { -- n = program[pc + 1]; -- debug(regexp) printf("\tREbackref %d\n", n); -- -- auto so = pmatch[n + 1].rm_so; -- auto eo = pmatch[n + 1].rm_eo; -- len = eo - so; -- if (src + len > input.length) -- goto Lnomatch; -- else if (attributes & REA.ignoreCase) -- { -- if (icmp(input[src .. src + len], input[so .. eo])) -- goto Lnomatch; -- } -- else if (memcmp(&input[src], &input[so], len * rchar.sizeof)) -- goto Lnomatch; -- src += len; -- pc += 2; -- break; -- } -- -- default: -- assert(0); -- } -- } -- -- Lnomatch: -- debug(regexp) printf("\tnomatch pc=%d\n", pc); -- src = srcsave; -- return 0; -- } -- --/* =================== Compiler ================== */ -- -- int parseRegexp() -- { -- size_t gotooffset; -- uint len1; -- uint len2; -- -- debug(regexp) -- { -- auto sss = pattern[p .. pattern.length]; -- printf("parseRegexp() '%.*s'\n", sss.length, sss.ptr); -- } -- auto offset = buf.offset; -- for (;;) -- { -- assert(p <= pattern.length); -- if (p == pattern.length) -- { buf.write(REend); -- return 1; -- } -- switch (pattern[p]) -- { -- case ')': -- return 1; -- -- case '|': -- p++; -- gotooffset = buf.offset; -- buf.write(REgoto); -- buf.write(cast(uint)0); -- len1 = cast(uint)(buf.offset - offset); -- buf.spread(offset, 1 + uint.sizeof); -- gotooffset += 1 + uint.sizeof; -- parseRegexp(); -- len2 = cast(uint)(buf.offset - (gotooffset + 1 + uint.sizeof)); -- buf.data[offset] = REor; -- (cast(uint *)&buf.data[offset + 1])[0] = len1; -- (cast(uint *)&buf.data[gotooffset + 1])[0] = len2; -- break; -- -- default: -- parsePiece(); -- break; -- } -- } -- } -- -- int parsePiece() -- { -- uint len; -- uint n; -- uint m; -- ubyte op; -- auto plength = pattern.length; -- -- debug(regexp) -- { -- auto sss = pattern[p .. pattern.length]; -- printf("parsePiece() '%.*s'\n", sss.length, sss.ptr); -- } -- auto offset = buf.offset; -- parseAtom(); -- if (p == plength) -- return 1; -- switch (pattern[p]) -- { -- case '*': -- // Special optimization: replace .* with REanystar -- if (buf.offset - offset == 1 && -- buf.data[offset] == REanychar && -- p + 1 < plength && -- pattern[p + 1] != '?') -- { -- buf.data[offset] = REanystar; -- p++; -- break; -- } -- -- n = 0; -- m = inf; -- goto Lnm; -- -- case '+': -- n = 1; -- m = inf; -- goto Lnm; -- -- case '?': -- n = 0; -- m = 1; -- goto Lnm; -- -- case '{': // {n} {n,} {n,m} -- p++; -- if (p == plength || !isDigit(pattern[p])) -- goto Lerr; -- n = 0; -- do -- { -- // BUG: handle overflow -- n = n * 10 + pattern[p] - '0'; -- p++; -- if (p == plength) -- goto Lerr; -- } while (isDigit(pattern[p])); -- if (pattern[p] == '}') // {n} -- { m = n; -- goto Lnm; -- } -- if (pattern[p] != ',') -- goto Lerr; -- p++; -- if (p == plength) -- goto Lerr; -- if (pattern[p] == /*{*/ '}') // {n,} -- { m = inf; -- goto Lnm; -- } -- if (!isDigit(pattern[p])) -- goto Lerr; -- m = 0; // {n,m} -- do -- { -- // BUG: handle overflow -- m = m * 10 + pattern[p] - '0'; -- p++; -- if (p == plength) -- goto Lerr; -- } while (isDigit(pattern[p])); -- if (pattern[p] != /*{*/ '}') -- goto Lerr; -- goto Lnm; -- -- Lnm: -- p++; -- op = REnm; -- if (p < plength && pattern[p] == '?') -- { op = REnmq; // minimal munch version -- p++; -- } -- len = cast(uint)(buf.offset - offset); -- buf.spread(offset, 1 + uint.sizeof * 3); -- buf.data[offset] = op; -- uint* puint = cast(uint *)&buf.data[offset + 1]; -- puint[0] = len; -- puint[1] = n; -- puint[2] = m; -- break; -- -- default: -- break; -- } -- return 1; -- -- Lerr: -- error("badly formed {n,m}"); -- assert(0); -- } -- -- int parseAtom() -- { ubyte op; -- size_t offset; -- rchar c; -- -- debug(regexp) -- { -- auto sss = pattern[p .. pattern.length]; -- printf("parseAtom() '%.*s'\n", sss.length, sss.ptr); -- } -- if (p < pattern.length) -- { -- c = pattern[p]; -- switch (c) -- { -- case '*': -- case '+': -- case '?': -- error("*+? not allowed in atom"); -- p++; -- return 0; -- -- case '(': -- p++; -- buf.write(REparen); -- offset = buf.offset; -- buf.write(cast(uint)0); // reserve space for length -- buf.write(re_nsub); -- re_nsub++; -- parseRegexp(); -- *cast(uint *)&buf.data[offset] = -- cast(uint)(buf.offset - (offset + uint.sizeof * 2)); -- if (p == pattern.length || pattern[p] != ')') -- { -- error("')' expected"); -- return 0; -- } -- p++; -- break; -- -- case '[': -- if (!parseRange()) -- return 0; -- break; -- -- case '.': -- p++; -- buf.write(REanychar); -- break; -- -- case '^': -- p++; -- buf.write(REbol); -- break; -- -- case '$': -- p++; -- buf.write(REeol); -- break; -- -- case '\\': -- p++; -- if (p == pattern.length) -- { error("no character past '\\'"); -- return 0; -- } -- c = pattern[p]; -- switch (c) -- { -- case 'b': op = REwordboundary; goto Lop; -- case 'B': op = REnotwordboundary; goto Lop; -- case 'd': op = REdigit; goto Lop; -- case 'D': op = REnotdigit; goto Lop; -- case 's': op = REspace; goto Lop; -- case 'S': op = REnotspace; goto Lop; -- case 'w': op = REword; goto Lop; -- case 'W': op = REnotword; goto Lop; -- -- Lop: -- buf.write(op); -- p++; -- break; -- -- case 'f': -- case 'n': -- case 'r': -- case 't': -- case 'v': -- case 'c': -- case 'x': -- case 'u': -- case '0': -- c = cast(char)escape(); -- goto Lbyte; -- -- case '1': case '2': case '3': -- case '4': case '5': case '6': -- case '7': case '8': case '9': -- c -= '1'; -- if (c < re_nsub) -- { buf.write(REbackref); -- buf.write(cast(ubyte)c); -- } -- else -- { error("no matching back reference"); -- return 0; -- } -- p++; -- break; -- -- default: -- p++; -- goto Lbyte; -- } -- break; -- -- default: -- p++; -- Lbyte: -- op = REchar; -- if (attributes & REA.ignoreCase) -- { -- if (isAlpha(c)) -- { -- op = REichar; -- c = cast(char)std.ascii.toUpper(c); -- } -- } -- if (op == REchar && c <= 0xFF) -- { -- // Look ahead and see if we can make this into -- // an REstring -- auto q = p; -- for (; q < pattern.length; ++q) -- { rchar qc = pattern[q]; -- -- switch (qc) -- { -- case '{': -- case '*': -- case '+': -- case '?': -- if (q == p) -- goto Lchar; -- q--; -- break; -- -- case '(': case ')': -- case '|': -- case '[': case ']': -- case '.': case '^': -- case '$': case '\\': -- case '}': -- break; -- -- default: -- continue; -- } -- break; -- } -- auto len = q - p; -- if (len > 0) -- { -- debug(regexp) printf("writing string len %d, c = '%c', pattern[p] = '%c'\n", len+1, c, pattern[p]); -- buf.reserve(5 + (1 + len) * rchar.sizeof); -- buf.write((attributes & REA.ignoreCase) ? REistring : REstring); -- buf.write(len + 1); -- buf.write(c); -- buf.write(pattern[p .. p + len]); -- p = q; -- break; -- } -- } -- if (c >= 0x80) -- { -- // Convert to dchar opcode -- op = (op == REchar) ? REdchar : REidchar; -- buf.write(op); -- buf.write(c); -- } -- else -- { -- Lchar: -- debug(regexp) printf("It's an REchar '%c'\n", c); -- buf.write(op); -- buf.write(cast(char)c); -- } -- break; -- } -- } -- return 1; -- } -- --private: -- class Range -- { -- size_t maxc; -- size_t maxb; -- OutBuffer buf; -- ubyte* base; -- BitArray bits; -- -- this(OutBuffer buf) -- { -- this.buf = buf; -- if (buf.data.length) -- this.base = &buf.data[buf.offset]; -- } -- -- void setbitmax(size_t u) -- { -- //printf("setbitmax(x%x), maxc = x%x\n", u, maxc); -- if (u > maxc) -- { -- maxc = u; -- auto b = u / 8; -- if (b >= maxb) -- { -- auto u2 = base ? base - &buf.data[0] : 0; -- buf.fill0(b - maxb + 1); -- base = &buf.data[u2]; -- maxb = b + 1; -- //bits = (cast(bit*)this.base)[0 .. maxc + 1]; -- bits.ptr = cast(size_t*)this.base; -- } -- bits.len = maxc + 1; -- } -- } -- -- void setbit2(size_t u) -- { -- setbitmax(u + 1); -- //printf("setbit2 [x%02x] |= x%02x\n", u >> 3, 1 << (u & 7)); -- bits[u] = 1; -- } -- -- }; -- -- int parseRange() -- { -- int c; -- int c2; -- uint i; -- uint cmax; -- -- cmax = 0x7F; -- p++; -- ubyte op = REbit; -- if (p == pattern.length) -- goto Lerr; -- if (pattern[p] == '^') -- { p++; -- op = REnotbit; -- if (p == pattern.length) -- goto Lerr; -- } -- buf.write(op); -- auto offset = buf.offset; -- buf.write(cast(uint)0); // reserve space for length -- buf.reserve(128 / 8); -- auto r = new Range(buf); -- if (op == REnotbit) -- r.setbit2(0); -- switch (pattern[p]) -- { -- case ']': -- case '-': -- c = pattern[p]; -- p++; -- r.setbit2(c); -- break; -- -- default: -- break; -- } -- -- enum RS { start, rliteral, dash } -- RS rs; -- -- rs = RS.start; -- for (;;) -- { -- if (p == pattern.length) -- goto Lerr; -- switch (pattern[p]) -- { -- case ']': -- switch (rs) -- { case RS.dash: -- r.setbit2('-'); -- goto case; -- case RS.rliteral: -- r.setbit2(c); -- break; -- case RS.start: -- break; -- default: -- assert(0); -- } -- p++; -- break; -- -- case '\\': -- p++; -- r.setbitmax(cmax); -- if (p == pattern.length) -- goto Lerr; -- switch (pattern[p]) -- { -- case 'd': -- for (i = '0'; i <= '9'; i++) -- r.bits[i] = 1; -- goto Lrs; -- -- case 'D': -- for (i = 1; i < '0'; i++) -- r.bits[i] = 1; -- for (i = '9' + 1; i <= cmax; i++) -- r.bits[i] = 1; -- goto Lrs; -- -- case 's': -- for (i = 0; i <= cmax; i++) -- if (isWhite(i)) -- r.bits[i] = 1; -- goto Lrs; -- -- case 'S': -- for (i = 1; i <= cmax; i++) -- if (!isWhite(i)) -- r.bits[i] = 1; -- goto Lrs; -- -- case 'w': -- for (i = 0; i <= cmax; i++) -- if (isword(cast(rchar)i)) -- r.bits[i] = 1; -- goto Lrs; -- -- case 'W': -- for (i = 1; i <= cmax; i++) -- if (!isword(cast(rchar)i)) -- r.bits[i] = 1; -- goto Lrs; -- -- Lrs: -- switch (rs) -- { case RS.dash: -- r.setbit2('-'); -- goto case; -- case RS.rliteral: -- r.setbit2(c); -- break; -- default: -- break; -- } -- rs = RS.start; -- continue; -- -- default: -- break; -- } -- c2 = escape(); -- goto Lrange; -- -- case '-': -- p++; -- if (rs == RS.start) -- goto Lrange; -- else if (rs == RS.rliteral) -- rs = RS.dash; -- else if (rs == RS.dash) -- { -- r.setbit2(c); -- r.setbit2('-'); -- rs = RS.start; -- } -- continue; -- -- default: -- c2 = pattern[p]; -- p++; -- Lrange: -- switch (rs) -- { case RS.rliteral: -- r.setbit2(c); -- goto case; -- case RS.start: -- c = c2; -- rs = RS.rliteral; -- break; -- -- case RS.dash: -- if (c > c2) -- { error("inverted range in character class"); -- return 0; -- } -- r.setbitmax(c2); -- //printf("c = %x, c2 = %x\n",c,c2); -- for (; c <= c2; c++) -- r.bits[c] = 1; -- rs = RS.start; -- break; -- -- default: -- assert(0); -- } -- continue; -- } -- break; -- } -- if (attributes & REA.ignoreCase) -- { -- // BUG: what about dchar? -- r.setbitmax(0x7F); -- for (c = 'a'; c <= 'z'; c++) -- { -- if (r.bits[c]) -- r.bits[c + 'A' - 'a'] = 1; -- else if (r.bits[c + 'A' - 'a']) -- r.bits[c] = 1; -- } -- } -- //printf("maxc = %d, maxb = %d\n",r.maxc,r.maxb); -- (cast(ushort *)&buf.data[offset])[0] = cast(ushort)r.maxc; -- (cast(ushort *)&buf.data[offset])[1] = cast(ushort)r.maxb; -- return 1; -- -- Lerr: -- error("invalid range"); -- return 0; -- } -- -- void error(string msg) -- { -- errors++; -- debug(regexp) printf("error: %.*s\n", msg.length, msg.ptr); --//assert(0); --//*(char*)0=0; -- throw new RegExpException(msg); -- } -- --// p is following the \ char -- int escape() -- in -- { -- assert(p < pattern.length); -- } -- body -- { int c; -- int i; -- rchar tc; -- -- c = pattern[p]; // none of the cases are multibyte -- switch (c) -- { -- case 'b': c = '\b'; break; -- case 'f': c = '\f'; break; -- case 'n': c = '\n'; break; -- case 'r': c = '\r'; break; -- case 't': c = '\t'; break; -- case 'v': c = '\v'; break; -- -- // BUG: Perl does \a and \e too, should we? -- -- case 'c': -- ++p; -- if (p == pattern.length) -- goto Lretc; -- c = pattern[p]; -- // Note: we are deliberately not allowing dchar letters -- if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) -- { -- Lcerr: -- error("letter expected following \\c"); -- return 0; -- } -- c &= 0x1F; -- break; -- -- case '0': -- case '1': -- case '2': -- case '3': -- case '4': -- case '5': -- case '6': -- case '7': -- c -= '0'; -- for (i = 0; i < 2; i++) -- { -- p++; -- if (p == pattern.length) -- goto Lretc; -- tc = pattern[p]; -- if ('0' <= tc && tc <= '7') -- { c = c * 8 + (tc - '0'); -- // Treat overflow as if last -- // digit was not an octal digit -- if (c >= 0xFF) -- { c >>= 3; -- return c; -- } -- } -- else -- return c; -- } -- break; -- -- case 'x': -- c = 0; -- for (i = 0; i < 2; i++) -- { -- p++; -- if (p == pattern.length) -- goto Lretc; -- tc = pattern[p]; -- if ('0' <= tc && tc <= '9') -- c = c * 16 + (tc - '0'); -- else if ('a' <= tc && tc <= 'f') -- c = c * 16 + (tc - 'a' + 10); -- else if ('A' <= tc && tc <= 'F') -- c = c * 16 + (tc - 'A' + 10); -- else if (i == 0) // if no hex digits after \x -- { -- // Not a valid \xXX sequence -- return 'x'; -- } -- else -- return c; -- } -- break; -- -- case 'u': -- c = 0; -- for (i = 0; i < 4; i++) -- { -- p++; -- if (p == pattern.length) -- goto Lretc; -- tc = pattern[p]; -- if ('0' <= tc && tc <= '9') -- c = c * 16 + (tc - '0'); -- else if ('a' <= tc && tc <= 'f') -- c = c * 16 + (tc - 'a' + 10); -- else if ('A' <= tc && tc <= 'F') -- c = c * 16 + (tc - 'A' + 10); -- else -- { -- // Not a valid \uXXXX sequence -- p -= i; -- return 'u'; -- } -- } -- break; -- -- default: -- break; -- } -- p++; -- Lretc: -- return c; -- } -- --/* ==================== optimizer ======================= */ -- -- void optimize() -- { ubyte[] prog; -- -- debug(regexp) printf("RegExp.optimize()\n"); -- prog = buf.toBytes(); -- for (size_t i = 0; 1;) -- { -- //printf("\tprog[%d] = %d, %d\n", i, prog[i], REstring); -- switch (prog[i]) -- { -- case REend: -- case REanychar: -- case REanystar: -- case REbackref: -- case REeol: -- case REchar: -- case REichar: -- case REdchar: -- case REidchar: -- case REstring: -- case REistring: -- case REtestbit: -- case REbit: -- case REnotbit: -- case RErange: -- case REnotrange: -- case REwordboundary: -- case REnotwordboundary: -- case REdigit: -- case REnotdigit: -- case REspace: -- case REnotspace: -- case REword: -- case REnotword: -- return; -- -- case REbol: -- i++; -- continue; -- -- case REor: -- case REnm: -- case REnmq: -- case REparen: -- case REgoto: -- { -- auto bitbuf = new OutBuffer; -- auto r = new Range(bitbuf); -- auto offset = i; -- if (starrchars(r, prog[i .. prog.length])) -- { -- debug(regexp) printf("\tfilter built\n"); -- buf.spread(offset, 1 + 4 + r.maxb); -- buf.data[offset] = REtestbit; -- (cast(ushort *)&buf.data[offset + 1])[0] = cast(ushort)r.maxc; -- (cast(ushort *)&buf.data[offset + 1])[1] = cast(ushort)r.maxb; -- i = offset + 1 + 4; -- buf.data[i .. i + r.maxb] = r.base[0 .. r.maxb]; -- } -- return; -- } -- default: -- assert(0); -- } -- } -- } -- --///////////////////////////////////////// --// OR the leading character bits into r. --// Limit the character range from 0..7F, --// trymatch() will allow through anything over maxc. --// Return 1 if success, 0 if we can't build a filter or --// if there is no point to one. -- -- int starrchars(Range r, const(ubyte)[] prog) -- { rchar c; -- uint maxc; -- size_t maxb; -- size_t len; -- uint b; -- uint n; -- uint m; -- const(ubyte)* pop; -- -- //printf("RegExp.starrchars(prog = %p, progend = %p)\n", prog, progend); -- for (size_t i = 0; i < prog.length;) -- { -- switch (prog[i]) -- { -- case REchar: -- c = prog[i + 1]; -- if (c <= 0x7F) -- r.setbit2(c); -- return 1; -- -- case REichar: -- c = prog[i + 1]; -- if (c <= 0x7F) -- { r.setbit2(c); -- r.setbit2(std.ascii.toLower(cast(rchar)c)); -- } -- return 1; -- -- case REdchar: -- case REidchar: -- return 1; -- -- case REanychar: -- return 0; // no point -- -- case REstring: -- len = *cast(size_t *)&prog[i + 1]; -- assert(len); -- c = *cast(rchar *)&prog[i + 1 + size_t.sizeof]; -- debug(regexp) printf("\tREstring %d, '%c'\n", len, c); -- if (c <= 0x7F) -- r.setbit2(c); -- return 1; -- -- case REistring: -- len = *cast(size_t *)&prog[i + 1]; -- assert(len); -- c = *cast(rchar *)&prog[i + 1 + size_t.sizeof]; -- debug(regexp) printf("\tREistring %d, '%c'\n", len, c); -- if (c <= 0x7F) -- { r.setbit2(std.ascii.toUpper(cast(rchar)c)); -- r.setbit2(std.ascii.toLower(cast(rchar)c)); -- } -- return 1; -- -- case REtestbit: -- case REbit: -- maxc = (cast(ushort *)&prog[i + 1])[0]; -- maxb = (cast(ushort *)&prog[i + 1])[1]; -- if (maxc <= 0x7F) -- r.setbitmax(maxc); -- else -- maxb = r.maxb; -- for (b = 0; b < maxb; b++) -- r.base[b] |= prog[i + 1 + 4 + b]; -- return 1; -- -- case REnotbit: -- maxc = (cast(ushort *)&prog[i + 1])[0]; -- maxb = (cast(ushort *)&prog[i + 1])[1]; -- if (maxc <= 0x7F) -- r.setbitmax(maxc); -- else -- maxb = r.maxb; -- for (b = 0; b < maxb; b++) -- r.base[b] |= ~prog[i + 1 + 4 + b]; -- return 1; -- -- case REbol: -- case REeol: -- return 0; -- -- case REor: -- len = (cast(uint *)&prog[i + 1])[0]; -- return starrchars(r, prog[i + 1 + uint.sizeof .. prog.length]) && -- starrchars(r, prog[i + 1 + uint.sizeof + len .. prog.length]); -- -- case REgoto: -- len = (cast(uint *)&prog[i + 1])[0]; -- i += 1 + uint.sizeof + len; -- break; -- -- case REanystar: -- return 0; -- -- case REnm: -- case REnmq: -- // len, n, m, () -- len = (cast(uint *)&prog[i + 1])[0]; -- n = (cast(uint *)&prog[i + 1])[1]; -- m = (cast(uint *)&prog[i + 1])[2]; -- pop = &prog[i + 1 + uint.sizeof * 3]; -- if (!starrchars(r, pop[0 .. len])) -- return 0; -- if (n) -- return 1; -- i += 1 + uint.sizeof * 3 + len; -- break; -- -- case REparen: -- // len, () -- len = (cast(uint *)&prog[i + 1])[0]; -- n = (cast(uint *)&prog[i + 1])[1]; -- pop = &prog[0] + i + 1 + uint.sizeof * 2; -- return starrchars(r, pop[0 .. len]); -- -- case REend: -- return 0; -- -- case REwordboundary: -- case REnotwordboundary: -- return 0; -- -- case REdigit: -- r.setbitmax('9'); -- for (c = '0'; c <= '9'; c++) -- r.bits[c] = 1; -- return 1; -- -- case REnotdigit: -- r.setbitmax(0x7F); -- for (c = 0; c <= '0'; c++) -- r.bits[c] = 1; -- for (c = '9' + 1; c <= r.maxc; c++) -- r.bits[c] = 1; -- return 1; -- -- case REspace: -- r.setbitmax(0x7F); -- for (c = 0; c <= r.maxc; c++) -- if (isWhite(c)) -- r.bits[c] = 1; -- return 1; -- -- case REnotspace: -- r.setbitmax(0x7F); -- for (c = 0; c <= r.maxc; c++) -- if (!isWhite(c)) -- r.bits[c] = 1; -- return 1; -- -- case REword: -- r.setbitmax(0x7F); -- for (c = 0; c <= r.maxc; c++) -- if (isword(cast(rchar)c)) -- r.bits[c] = 1; -- return 1; -- -- case REnotword: -- r.setbitmax(0x7F); -- for (c = 0; c <= r.maxc; c++) -- if (!isword(cast(rchar)c)) -- r.bits[c] = 1; -- return 1; -- -- case REbackref: -- return 0; -- -- default: -- assert(0); -- } -- } -- return 1; -- } -- --/* ==================== replace ======================= */ -- --/*********************** -- * After a match is found with test(), this function -- * will take the match results and, using the format -- * string, generate and return a new string. -- */ -- -- public string replace(string format) -- { -- return replace3(format, input, pmatch[0 .. re_nsub + 1]); -- } -- --// Static version that doesn't require a RegExp object to be created -- -- public static string replace3(string format, string input, regmatch_t[] pmatch) -- { -- string result; -- size_t c2; -- ptrdiff_t rm_so, rm_eo, i; -- --// printf("replace3(format = '%.*s', input = '%.*s')\n", format.length, format.ptr, input.length, input.ptr); -- result.length = format.length; -- result.length = 0; -- for (size_t f = 0; f < format.length; f++) -- { -- char c = format[f]; -- L1: -- if (c != '$') -- { -- result ~= c; -- continue; -- } -- ++f; -- if (f == format.length) -- { -- result ~= '$'; -- break; -- } -- c = format[f]; -- switch (c) -- { -- case '&': -- rm_so = pmatch[0].rm_so; -- rm_eo = pmatch[0].rm_eo; -- goto Lstring; -- -- case '`': -- rm_so = 0; -- rm_eo = pmatch[0].rm_so; -- goto Lstring; -- -- case '\'': -- rm_so = pmatch[0].rm_eo; -- rm_eo = input.length; -- goto Lstring; -- -- case '0': case '1': case '2': case '3': case '4': -- case '5': case '6': case '7': case '8': case '9': -- i = c - '0'; -- if (f + 1 == format.length) -- { -- if (i == 0) -- { -- result ~= '$'; -- result ~= c; -- continue; -- } -- } -- else -- { -- c2 = format[f + 1]; -- if (c2 >= '0' && c2 <= '9') -- { -- i = (c - '0') * 10 + (c2 - '0'); -- f++; -- } -- if (i == 0) -- { -- result ~= '$'; -- result ~= c; -- c = cast(char)c2; -- goto L1; -- } -- } -- -- if (i < pmatch.length) -- { rm_so = pmatch[i].rm_so; -- rm_eo = pmatch[i].rm_eo; -- goto Lstring; -- } -- break; -- -- Lstring: -- if (rm_so != rm_eo) -- result ~= input[rm_so .. rm_eo]; -- break; -- -- default: -- result ~= '$'; -- result ~= c; -- break; -- } -- } -- return result; -- } -- --/************************************ -- * Like replace(char[] format), but uses old style formatting: -- <table border=1 cellspacing=0 cellpadding=5> -- <th>Format -- <th>Description -- <tr> -- <td><b>&</b> -- <td>replace with the match -- </tr> -- <tr> -- <td><b>\</b><i>n</i> -- <td>replace with the <i>n</i>th parenthesized match, <i>n</i> is 1..9 -- </tr> -- <tr> -- <td><b>\</b><i>c</i> -- <td>replace with char <i>c</i>. -- </tr> -- </table> --*/ -- -- public string replaceOld(string format) -- { -- string result; -- --//printf("replace: this = %p so = %d, eo = %d\n", this, pmatch[0].rm_so, pmatch[0].rm_eo); --//printf("3input = '%.*s'\n", input.length, input.ptr); -- result.length = format.length; -- result.length = 0; -- for (size_t i; i < format.length; i++) -- { -- char c = format[i]; -- switch (c) -- { -- case '&': -- { -- auto sss = input[pmatch[0].rm_so .. pmatch[0].rm_eo]; -- //printf("match = '%.*s'\n", sss.length, sss.ptr); -- result ~= sss; -- } -- break; -- -- case '\\': -- if (i + 1 < format.length) -- { -- c = format[++i]; -- if (c >= '1' && c <= '9') -- { uint j; -- -- j = c - '0'; -- if (j <= re_nsub && pmatch[j].rm_so != pmatch[j].rm_eo) -- result ~= input[pmatch[j].rm_so .. pmatch[j].rm_eo]; -- break; -- } -- } -- result ~= c; -- break; -- -- default: -- result ~= c; -- break; -- } -- } -- return result; -- } -- --} -- --unittest --{ // Created and placed in public domain by Don Clugston -- -- auto m = search("aBC r s", `bc\x20r[\40]s`, "i"); -- assert(m.pre=="a"); -- assert(m[0]=="BC r s"); -- auto m2 = search("7xxyxxx", `^\d([a-z]{2})\D\1`); -- assert(m2[0]=="7xxyxx"); -- // Just check the parsing. -- auto m3 = search("dcbxx", `ca|b[\d\]\D\s\S\w-\W]`); -- auto m4 = search("xy", `[^\ca-\xFa\r\n\b\f\t\v\0123]{2,485}$`); -- auto m5 = search("xxx", `^^\r\n\b{13,}\f{4}\t\v\u02aF3a\w\W`); -- auto m6 = search("xxy", `.*y`); -- assert(m6[0]=="xxy"); -- auto m7 = search("QWDEfGH", "(ca|b|defg)+", "i"); -- assert(m7[0]=="DEfG"); -- auto m8 = search("dcbxx", `a?\B\s\S`); -- auto m9 = search("dcbxx", `[-w]`); -- auto m10 = search("dcbsfd", `aB[c-fW]dB|\d|\D|\u012356|\w|\W|\s|\S`, "i"); -- auto m11 = search("dcbsfd", `[]a-]`); -- m.replaceOld(`a&b\1c`); -- m.replace(`a$&b$'$1c`); --} -- --// Andrei --//------------------------------------------------------------------------------ -- --struct Pattern(Char) --{ -- immutable(Char)[] pattern; -- -- this(immutable(Char)[] pattern) -- { -- this.pattern = pattern; -- } --} -- --Pattern!(Char) pattern(Char)(immutable(Char)[] pat) --{ -- return typeof(return)(pat); --} -- --struct Splitter(Range) --{ -- Range _input; -- size_t _chunkLength; -- RegExp _rx; -- -- private Range search() -- { -- //rx = std.regexp.search(_input, "(" ~ _separator.pattern ~ ")"); -- auto i = std.regexp.find(cast(string) _input, _rx); -- return _input[i >= 0 ? i : _input.length .. _input.length]; -- } -- -- private void advance() -- { -- //writeln("(" ~ _separator.pattern ~ ")"); -- //writeln(_input); -- //assert(_rx[0].length > 0); -- _chunkLength += _rx[0].length; -- } -- -- this(Range input, Pattern!(char) separator) -- { -- _input = input; -- _rx = RegExp(separator.pattern); -- _chunkLength = _input.length - search().length; -- } -- -- ref auto opSlice() -- { -- return this; -- } -- -- @property Range front() -- { -- return _input[0 .. _chunkLength]; -- } -- -- @property bool empty() -- { -- return _input.empty; -- } -- -- void popFront() -- { -- if (_chunkLength == _input.length) -- { -- _input = _input[_chunkLength .. _input.length]; -- return; -- } -- advance(); -- _input = _input[_chunkLength .. _input.length]; -- _chunkLength = _input.length - search().length; -- } --} -- --Splitter!(Range) splitter(Range)(Range r, Pattern!(char) pat) --{ -- static assert(is(Unqual!(typeof(Range.init[0])) == char), -- Unqual!(typeof(Range.init[0])).stringof); -- return typeof(return)(cast(string) r, pat); --} -- --unittest --{ -- auto s1 = ", abc, de, fg, hi, "; -- auto sp2 = splitter(s1, pattern(", *")); -- //foreach (e; sp2) writeln("[", e, "]"); -- assert(equal(sp2, ["", "abc", "de", "fg", "hi"][])); --} -- --unittest --{ -- auto str= "foo"; -- string[] re_strs= [ -- r"^(h|a|)fo[oas]$", -- r"^(a|b|)fo[oas]$", -- r"^(a|)foo$", -- r"(a|)foo", -- r"^(h|)foo$", -- r"(h|)foo", -- r"(h|a|)fo[oas]", -- r"^(a|b|)fo[o]$", -- r"[abf][ops](o|oo|)(h|a|)", -- r"(h|)[abf][ops](o|oo|)", -- r"(c|)[abf][ops](o|oo|)" -- ]; -- -- foreach (re_str; re_strs) { -- auto re= new RegExp(re_str); -- auto matches= cast(bool)re.test(str); -- assert(matches); -- //writefln("'%s' matches '%s' ? %s", str, re_str, matches); -- } -- -- for (char c='a'; c<='z'; ++c) { -- auto re_str= "("~c~"|)foo"; -- auto re= new RegExp(re_str); -- auto matches= cast(bool)re.test(str); -- assert(matches); -- //writefln("'%s' matches '%s' ? %s", str, re_str, matches); -- } --} ---- a/src/libphobos/src/std/socket.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/socket.d 2014-04-01 16:32:51.000000000 +0100 -@@ -61,7 +61,7 @@ version(Windows) - private alias std.c.windows.winsock.timeval _ctimeval; - private alias std.c.windows.winsock.linger _clinger; - -- enum socket_t : SOCKET { INVALID_SOCKET }; -+ enum socket_t : SOCKET { INVALID_SOCKET } - private const int _SOCKET_ERROR = SOCKET_ERROR; - - -@@ -94,6 +94,7 @@ else version(Posix) - static assert(false); - - import core.sys.posix.netdb; -+ import core.sys.posix.sys.un : sockaddr_un; - private import core.sys.posix.fcntl; - private import core.sys.posix.unistd; - private import core.sys.posix.arpa.inet; -@@ -144,12 +145,7 @@ version(unittest) - /// Base exception thrown by $(D std.socket). - class SocketException: Exception - { -- /** -- * $(RED Deprecated. It will be removed in January 2013. -- * Please use $(LREF SocketOSException) instead.) -- * -- * Provided for compatibility with older code using $(D SocketException). -- */ -+ // Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.socket.SocketOSException instead.") @property int errorCode() const - { - auto osException = cast(SocketOSException)this; -@@ -1770,13 +1766,13 @@ public: - /** - * Construct a new $(D Internet6Address). - * Params: -- * node = an IPv6 host address string in the form described in RFC 2373, -- * or a host name which will be resolved using $(D getAddressInfo). -- * port = (optional) service name or port number. -+ * addr = an IPv6 host address string in the form described in RFC 2373, -+ * or a host name which will be resolved using $(D getAddressInfo). -+ * service = (optional) service name. - */ -- this(in char[] node, in char[] service = null) -+ this(in char[] addr, in char[] service = null) - { -- auto results = getAddressInfo(node, service, AddressFamily.INET6); -+ auto results = getAddressInfo(addr, service, AddressFamily.INET6); - assert(results.length && results[0].family == AddressFamily.INET6); - sin6 = *cast(sockaddr_in6*)results[0].address.name; - } -@@ -1788,19 +1784,19 @@ public: - * or a host name which will be resolved using $(D getAddressInfo). - * port = port number, may be $(D PORT_ANY). - */ -- this(in char[] node, ushort port) -+ this(in char[] addr, ushort port) - { - if (port == PORT_ANY) -- this(node); -+ this(addr); - else -- this(node, to!string(port)); -+ this(addr, to!string(port)); - } - - /** - * Construct a new $(D Internet6Address). - * Params: - * addr = (optional) an IPv6 host address in host byte order, or -- $(D ADDR_ANY). -+ * $(D ADDR_ANY). - * port = port number, may be $(D PORT_ANY). - */ - this(ubyte[16] addr, ushort port) -@@ -1898,10 +1894,10 @@ static if (is(sockaddr_un)) - - this(in char[] path) - { -- len = sockaddr_un.sun_path.offsetof + path.length + 1; -+ len = cast(socklen_t)(sockaddr_un.init.sun_path.offsetof + path.length + 1); - sun = cast(sockaddr_un*) (new ubyte[len]).ptr; - sun.sun_family = AF_UNIX; -- sun.sun_path.ptr[0..path.length] = path; -+ sun.sun_path.ptr[0..path.length] = (cast(byte[]) path)[]; - sun.sun_path.ptr[path.length] = 0; - } - -@@ -1915,6 +1911,40 @@ static if (is(sockaddr_un)) - return path; - } - } -+ -+ unittest -+ { -+ import core.stdc.stdio : remove; -+ -+ immutable ubyte[] data = [1, 2, 3, 4]; -+ Socket[2] pair; -+ -+ auto name = "unix-address-family-unittest-socket-name"; -+ auto address = new UnixAddress(name); -+ -+ auto listener = new Socket(AddressFamily.UNIX, SocketType.STREAM); -+ scope(exit) listener.close(); -+ -+ listener.bind(address); -+ scope(exit) remove(toStringz(name)); -+ -+ listener.listen(1); -+ -+ pair[0] = new Socket(AddressFamily.UNIX, SocketType.STREAM); -+ scope(exit) listener.close(); -+ -+ pair[0].connect(address); -+ scope(exit) pair[0].close(); -+ -+ pair[1] = listener.accept(); -+ scope(exit) pair[1].close(); -+ -+ pair[0].send(data); -+ -+ auto buf = new ubyte[data.length]; -+ pair[1].receive(buf); -+ assert(buf == data); -+ } - } - - -@@ -1999,10 +2029,7 @@ struct TimeVal - } - } - --/++ -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(LREF TimeVal) instead.) -- +/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.socket.TimeVal instead.") alias TimeVal timeval; - - -@@ -2230,10 +2257,7 @@ struct Linger - } - } - --/++ -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(LREF Linger) instead.) -- +/ -+// Explicitly undocumented. It will be removed in November 2013. - deprecated("Please use std.socket.Linger instead.") alias Linger linger; - - /// Specifies a socket option: -@@ -2896,7 +2920,9 @@ public: - * randomly varies on the order of 10ms. - * - * Params: -- * value = The timeout duration to set. Must not be negative. -+ * level = The level at which a socket option is defined. -+ * option = Either $(D SocketOption.SNDTIMEO) or $(D SocketOption.RCVTIMEO). -+ * value = The timeout duration to set. Must not be negative. - * - * Throws: $(D SocketException) if setting the options fails. - * -@@ -2936,7 +2962,7 @@ public: - else version (Posix) - { - _ctimeval tv; -- tv.tv_sec = to!(typeof(tv.tv_sec ))(value.total!"seconds"()); -+ tv.tv_sec = to!(typeof(tv.tv_sec ))(value.total!"seconds"); - tv.tv_usec = to!(typeof(tv.tv_usec))(value.fracSec.usecs); - setOption(level, option, (&tv)[0 .. 1]); - } ---- a/src/libphobos/src/std/stdio.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/stdio.d 2014-04-01 16:32:51.000000000 +0100 -@@ -23,7 +23,7 @@ public import core.stdc.stdio, std.strin - static import std.c.stdio; - import std.stdiobase; - import core.stdc.errno, core.stdc.stddef, core.stdc.stdlib, core.memory, -- core.stdc.string, core.stdc.wchar_; -+ core.stdc.string, core.stdc.wchar_, core.exception; - import std.algorithm, std.array, std.conv, std.exception, std.format, - std.range, std.string, std.traits, std.typecons, - std.typetuple, std.utf; -@@ -294,6 +294,14 @@ manner, such that as soon as the last $( - given $(D FILE*) goes out of scope, the underlying $(D FILE*) is - automatically closed. - -+Bugs: -+$(D File) expects file names to be encoded in $(B CP_ACP) on $(I Windows) -+instead of UTF-8 ($(BUGZILLA 7648)) thus must not be used in $(I Windows) -+or cross-platform applications other than with an immediate ASCII string as -+a file name to prevent accidental changes to result in incorrect behavior. -+One can use $(XREF file, read)/$(XREF file, write)/$(XREF stream, File) -+instead. -+ - Example: - ---- - // test.d -@@ -326,18 +334,18 @@ struct File - { - FILE * handle = null; // Is null iff this Impl is closed by another File - uint refs = uint.max / 2; -- bool isPipe; -+ bool isPopened; // true iff the stream has been created by popen() - } - private Impl* _p; - private string _name; - -- private this(FILE* handle, string name, uint refs = 1, bool isPipe = false) -+ package this(FILE* handle, string name, uint refs = 1, bool isPopened = false) - { - assert(!_p); - _p = cast(Impl*) enforce(malloc(Impl.sizeof), "Out of memory"); - _p.handle = handle; - _p.refs = refs; -- _p.isPipe = isPipe; -+ _p.isPopened = isPopened; - _name = name; - } - -@@ -345,13 +353,15 @@ struct File - Constructor taking the name of the file to open and the open mode - (with the same semantics as in the C standard library $(WEB - cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen) --function). Throws an exception if the file could not be opened. -+function). - - Copying one $(D File) object to another results in the two $(D File) - objects referring to the same underlying file. - - The destructor automatically closes the file as soon as no $(D File) - object refers to it anymore. -+ -+Throws: $(D ErrnoException) if the file could not be opened. - */ - this(string name, in char[] stdioOpenmode = "rb") - { -@@ -388,7 +398,8 @@ First calls $(D detach) (throwing on fai - _open file $(D name) with mode $(D stdioOpenmode). The mode has the - same semantics as in the C standard library $(WEB - cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen) function. --Throws exception in case of error. -+ -+Throws: $(D ErrnoException) in case of error. - */ - void open(string name, in char[] stdioOpenmode = "rb") - { -@@ -400,6 +411,8 @@ Throws exception in case of error. - First calls $(D detach) (throwing on failure), and then runs a command - by calling the C standard library function $(WEB - opengroup.org/onlinepubs/007908799/xsh/_popen.html, _popen). -+ -+Throws: $(D ErrnoException) in case of error. - */ - version(Posix) void popen(string command, in char[] stdioOpenmode = "r") - { -@@ -417,8 +430,9 @@ opengroup.org/onlinepubs/007908799/xsh/_ - - /** - Returns $(D true) if the file is at end (see $(WEB --cplusplus.com/reference/clibrary/cstdio/feof.html, feof)). The file --must be opened, otherwise an exception is thrown. -+cplusplus.com/reference/clibrary/cstdio/feof.html, feof)). -+ -+Throws: $(D Exception) if the file is not opened. - */ - @property bool eof() const pure - { -@@ -445,8 +459,9 @@ the file handle. - } - - /** --Detaches from the underlying file. If the sole owner, calls $(D close) --and throws if that fails. -+Detaches from the underlying file. If the sole owner, calls $(D close). -+ -+Throws: $(D ErrnoException) on failure if closing the file. - */ - void detach() - { -@@ -482,6 +497,8 @@ throwing on error. Even if an exception - File) object is empty. This is different from $(D detach) in that it - always closes the file; consequently, all other $(D File) objects - referring to the same handle will see a closed file henceforth. -+ -+Throws: $(D ErrnoException) on error. - */ - void close() - { -@@ -498,11 +515,12 @@ referring to the same handle will see a - scope(exit) _p.handle = null; // nullify the handle anyway - version (Posix) - { -- if (_p.isPipe) -+ if (_p.isPopened) - { -- // Ignore the result of the command -- errnoEnforce(.pclose(_p.handle) != -1, -+ auto res = .pclose(_p.handle); -+ errnoEnforce(res != -1, - "Could not close pipe `"~_name~"'"); -+ errnoEnforce(res == 0, format("Command returned %d", res)); - return; - } - } -@@ -523,9 +541,10 @@ _clearerr) for the file handle. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/_fflush.html, _fflush) for the --file handle and throws on error. -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_fflush.html, _fflush) -+for the file handle. -+ -+Throws: $(D Exception) if the file is not opened or if the call to $D(fflush) fails. - */ - void flush() - { -@@ -535,15 +554,17 @@ file handle and throws on error. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/fread.html, fread) for the --file handle and throws on error. The number of items to read and the size of -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/fread.html, fread) for the -+file handle. The number of items to read and the size of - each item is inferred from the size and type of the input array, respectively. - - Returns: The slice of $(D buffer) containing the data that was actually read. - This will be shorter than $(D buffer) if EOF was reached before the buffer - could be filled. - -+Throws: $(D Exception) if $(D buffer) is empty. -+ $(D ErrnoException) if the file is not opened or the call to $D(fread) fails. -+ - $(D rawRead) always reads in binary mode on Windows. - */ - T[] rawRead(T)(T[] buffer) -@@ -584,13 +605,14 @@ $(D rawRead) always reads in binary mode - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/fwrite.html, fwrite) for the file --handle and throws on error. The number of items to write and the size of each -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/fwrite.html, fwrite) for the file -+handle. The number of items to write and the size of each - item is inferred from the size and type of the input array, respectively. An - error is thrown if the buffer could not be written in its entirety. - - $(D rawWrite) always writes in binary mode on Windows. -+ -+Throws: $(D ErrnoException) if the file is not opened or if the call to $D(fread) fails. - */ - void rawWrite(T)(in T[] buffer) - { -@@ -630,9 +652,11 @@ $(D rawWrite) always writes in binary mo - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/fseek.html, fseek) for the --file handle. Throws on error. -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/fseek.html, fseek) -+for the file handle. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) if the call to $D(fseek) fails. - */ - void seek(long offset, int origin = SEEK_SET) - { -@@ -677,9 +701,11 @@ file handle. Throws on error. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/ftell.html, ftell) for the --managed file handle. Throws on error. -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/ftell.html, ftell) for the -+managed file handle. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) if the call to $D(ftell) fails. - */ - @property ulong tell() const - { -@@ -709,9 +735,10 @@ managed file handle. Throws on error. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/_rewind.html, _rewind) for the --file handle. Throws on error. -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_rewind.html, _rewind) -+for the file handle. -+ -+Throws: $(D Exception) if the file is not opened. - */ - void rewind() - { -@@ -720,9 +747,11 @@ file handle. Throws on error. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls $(WEB --cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, _setvbuf) for -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, _setvbuf) for - the file handle. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) if the call to $D(setvbuf) fails. - */ - void setvbuf(size_t size, int mode = _IOFBF) - { -@@ -732,9 +761,12 @@ the file handle. - } - - /** --If the file is not opened, throws an exception. Otherwise, calls --$(WEB cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, --_setvbuf) for the file handle. */ -+Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, -+_setvbuf) for the file handle. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) if the call to $D(setvbuf) fails. -+*/ - void setvbuf(void[] buf, int mode = _IOFBF) - { - enforce(isOpen, "Attempting to call setvbuf() on an unopened file"); -@@ -744,11 +776,14 @@ _setvbuf) for the file handle. */ - } - - /** --If the file is not opened, throws an exception. Otherwise, writes its --arguments in text format to the file. */ -+Writes its arguments in text format to the file. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) on an error writing to the file. -+*/ - void write(S...)(S args) - { -- auto w = lockingTextWriter; -+ auto w = lockingTextWriter(); - foreach (arg; args) - { - alias typeof(arg) A; -@@ -781,73 +816,78 @@ arguments in text format to the file. */ - } - - /** --If the file is not opened, throws an exception. Otherwise, writes its --arguments in text format to the file, followed by a newline. */ -+Writes its arguments in text format to the file, followed by a newline. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) on an error writing to the file. -+*/ - void writeln(S...)(S args) - { - write(args, '\n'); - } - - /** --If the file is not opened, throws an exception. Otherwise, writes its --arguments in text format to the file, according to the format in the --first argument. */ -+Writes its arguments in text format to the file, according to the -+format in the first argument. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) on an error writing to the file. -+*/ - void writef(Char, A...)(in Char[] fmt, A args) - { -- std.format.formattedWrite(lockingTextWriter, fmt, args); -+ std.format.formattedWrite(lockingTextWriter(), fmt, args); - } - - /** --Same as writef, plus adds a newline. */ -+Writes its arguments in text format to the file, according to the -+format in the first argument, followed by a newline. -+ -+Throws: $(D Exception) if the file is not opened. -+ $(D ErrnoException) on an error writing to the file. -+*/ - void writefln(Char, A...)(in Char[] fmt, A args) - { -- auto w = lockingTextWriter; -+ auto w = lockingTextWriter(); - std.format.formattedWrite(w, fmt, args); - w.put('\n'); - } - --/********************************** --Read line from stream $(D fp) and write it to $(D buf[]), including --terminating character. -+/** -+Read line from the file handle and return it as a specified type. - --This is often faster than $(D File.readln(dchar)) because the buffer --is reused each call. Note that reusing the buffer means that the --previous contents of it has to be copied if needed. -+This version manages its own read buffer, which means one memory allocation per call. If you are not -+retaining a reference to the read data, consider the $(D File.readln(buf)) version, which may offer -+better performance as it can reuse its read buffer. - - Params: --fp = input stream --buf = buffer used to store the resulting line data. buf is --resized as necessary. -+ S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to $(D string). -+ terminator = line terminator (by default, '\n') - - Returns: --0 for end of file, otherwise number of characters read -+ The line that was read, including the line terminator character. - --Throws: $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode --conversion error. -+Throws: -+ $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error. - - Example: - --- - // Reads $(D stdin) and writes it to $(D stdout). - import std.stdio; - --int main() -+void main() - { -- char[] buf; -- while (stdin.readln(buf)) -- write(buf); -- return 0; -+ string line; -+ while ((line = stdin.readln()) !is null) -+ write(line); - } - --- -- --This method is more efficient than the one in the previous example --because $(D stdin.readln(buf)) reuses (if possible) memory allocated --by $(D buf), whereas $(D buf = stdin.readln()) makes a new memory allocation --with every line. */ -+*/ - S readln(S = string)(dchar terminator = '\n') -+ if (isSomeString!S) - { - Unqual!(ElementEncodingType!S)[] buf; - readln(buf, terminator); -- return assumeUnique(buf); -+ return cast(S)buf; - } - - unittest -@@ -855,13 +895,13 @@ with every line. */ - auto deleteme = testFilename(); - std.file.write(deleteme, "hello\nworld\n"); - scope(exit) std.file.remove(deleteme); -- foreach (C; Tuple!(char, wchar, dchar).Types) -+ foreach (String; TypeTuple!(string, char[], wstring, wchar[], dstring, dchar[])) - { - auto witness = [ "hello\n", "world\n" ]; - auto f = File(deleteme); - uint i = 0; -- immutable(C)[] buf; -- while ((buf = f.readln!(typeof(buf))()).length) -+ String buf; -+ while ((buf = f.readln!String()).length) - { - assert(i < witness.length); - assert(equal(buf, witness[i++])); -@@ -870,8 +910,70 @@ with every line. */ - } - } - --/** ditto */ -- size_t readln(C)(ref C[] buf, dchar terminator = '\n') if (isSomeChar!C && !is(C == enum)) -+ unittest -+ { -+ auto deleteme = testFilename(); -+ std.file.write(deleteme, "cześć \U0002000D"); -+ scope(exit) std.file.remove(deleteme); -+ uint[] lengths=[12,8,7]; -+ foreach (uint i,C; Tuple!(char, wchar, dchar).Types) -+ { -+ immutable(C)[] witness = "cześć \U0002000D"; -+ auto buf = File(deleteme).readln!(immutable(C)[])(); -+ assert(buf.length==lengths[i]); -+ assert(buf==witness); -+ } -+ } -+ -+/** -+Read line from the file handle and write it to $(D buf[]), including -+terminating character. -+ -+This can be faster than $(D line = File.readln()) because you can reuse -+the buffer for each call. Note that reusing the buffer means that you -+must copy the previous contents if you wish to retain them. -+ -+Params: -+buf = buffer used to store the resulting line data. buf is -+resized as necessary. -+terminator = line terminator (by default, '\n') -+ -+Returns: -+0 for end of file, otherwise number of characters read -+ -+Throws: $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode -+conversion error. -+ -+Example: -+--- -+// Read lines from $(D stdin) into a string -+// Ignore lines starting with '#' -+// Write the string to $(D stdout) -+ -+void main() -+{ -+ string output; -+ char[] buf; -+ -+ while (stdin.readln(buf)) -+ { -+ if (buf[0] == '#') -+ continue; -+ -+ output ~= buf; -+ } -+ -+ write(output); -+} -+--- -+ -+This method can be more efficient than the one in the previous example -+because $(D stdin.readln(buf)) reuses (if possible) memory allocated -+for $(D buf), whereas $(D line = stdin.readln()) makes a new memory allocation -+for every line. -+*/ -+ size_t readln(C)(ref C[] buf, dchar terminator = '\n') -+ if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum)) - { - static if (is(C == char)) - { -@@ -882,9 +984,9 @@ with every line. */ - { - // TODO: optimize this - string s = readln(terminator); -- if (!s.length) return 0; - buf.length = 0; -- foreach (wchar c; s) -+ if (!s.length) return 0; -+ foreach (C c; s) - { - buf ~= c; - } -@@ -894,7 +996,8 @@ with every line. */ - - /** ditto */ - size_t readln(C, R)(ref C[] buf, R terminator) -- if (isBidirectionalRange!R && is(typeof(terminator.front == buf[0]))) -+ if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) && -+ isBidirectionalRange!R && is(typeof(terminator.front == dchar.init))) - { - auto last = terminator.back; - C[] buf2; -@@ -917,15 +1020,19 @@ with every line. */ - { - auto deleteme = testFilename(); - std.file.write(deleteme, "hello\n\rworld\nhow\n\rare ya"); -- auto witness = [ "hello\n\r", "world\nhow\n\r", "are ya" ]; - scope(exit) std.file.remove(deleteme); -- auto f = File(deleteme); -- uint i = 0; -- char[] buf; -- while (f.readln(buf, "\n\r")) -+ foreach (C; Tuple!(char, wchar, dchar).Types) - { -- assert(i < witness.length); -- assert(buf == witness[i++]); -+ immutable(C)[][] witness = [ "hello\n\r", "world\nhow\n\r", "are ya" ]; -+ auto f = File(deleteme); -+ uint i = 0; -+ C[] buf; -+ while (f.readln(buf, "\n\r")) -+ { -+ assert(i < witness.length); -+ assert(buf == witness[i++]); -+ } -+ assert(buf.length==0); - } - } - -@@ -997,27 +1104,70 @@ Returns the file number corresponding to - return .fileno(cast(FILE*) _p.handle); - } - --/** --Range that reads one line at a time. */ -- /// ditto -+// Note: This was documented until 2013/08 -+/* -+Range that reads one line at a time. Returned by $(LREF byLine). -+ -+Allows to directly use range operations on lines of a file. -+*/ - struct ByLine(Char, Terminator) - { -+ private: -+ /* Ref-counting stops the source range's ByLineImpl -+ * from getting out of sync after the range is copied, e.g. -+ * when accessing range.front, then using std.range.take, -+ * then accessing range.front again. */ -+ alias Impl = RefCounted!(ByLineImpl!(Char, Terminator), -+ RefCountedAutoInitialize.no); -+ Impl impl; -+ -+ static if (isScalarType!Terminator) -+ enum defTerm = '\n'; -+ else -+ enum defTerm = cast(Terminator)"\n"; -+ -+ public: -+ this(File f, KeepTerminator kt = KeepTerminator.no, -+ Terminator terminator = defTerm) -+ { -+ impl = Impl(f, kt, terminator); -+ } -+ -+ @property bool empty() -+ { -+ return impl.refCountedPayload.empty; -+ } -+ -+ @property Char[] front() -+ { -+ return impl.refCountedPayload.front; -+ } -+ -+ void popFront() -+ { -+ impl.refCountedPayload.popFront(); -+ } -+ } -+ -+ private struct ByLineImpl(Char, Terminator) -+ { -+ private: - File file; - Char[] line; - Terminator terminator; - KeepTerminator keepTerminator; - bool first_call = true; - -- this(File f, KeepTerminator kt = KeepTerminator.no, -- Terminator terminator = '\n') -+ public: -+ this(File f, KeepTerminator kt, Terminator terminator) - { - file = f; - this.terminator = terminator; - keepTerminator = kt; - } - -- /// Range primitive implementations. -- @property bool empty() const -+ // Range primitive implementations. -+ @property bool empty() - { - if (line !is null) return false; - if (!file.isOpen) return true; -@@ -1025,21 +1175,19 @@ Range that reads one line at a time. */ - // First read ever, must make sure stream is not empty. We - // do so by reading a character and putting it back. Doing - // so is guaranteed to work on all files opened in all -- // buffering modes. Although we internally mutate the -- // state of the file, we restore everything, which -- // justifies the cast. -- auto mutableFP = (cast(File*) &file).getFP(); -- auto c = fgetc(mutableFP); -+ // buffering modes. -+ auto fp = file.getFP(); -+ auto c = fgetc(fp); - if (c == -1) - { -+ file.detach(); - return true; - } -- ungetc(c, mutableFP) == c -+ ungetc(c, fp) == c - || assert(false, "Bug in cstdlib implementation"); - return false; - } - -- /// Ditto - @property Char[] front() - { - if (first_call) -@@ -1050,7 +1198,6 @@ Range that reads one line at a time. */ - return line; - } - -- /// Ditto - void popFront() - { - assert(file.isOpen); -@@ -1064,19 +1211,91 @@ Range that reads one line at a time. */ - else if (keepTerminator == KeepTerminator.no - && std.algorithm.endsWith(line, terminator)) - { -- line = line.ptr[0 .. line.length - 1]; -+ static if (isScalarType!Terminator) -+ enum tlen = 1; -+ else static if (isArray!Terminator) -+ { -+ static assert( -+ is(Unqual!(ElementEncodingType!Terminator) == Char)); -+ const tlen = terminator.length; -+ } -+ else -+ static assert(false); -+ line = line.ptr[0 .. line.length - tlen]; - } - } - } - - /** --Convenience function that returns the $(D LinesReader) corresponding --to this file. */ -- ByLine!(Char, Terminator) byLine(Terminator = char, Char = char) -+Returns an input range set up to read from the file handle one line -+at a time. -+ -+The element type for the range will be $(D Char[]). Range primitives -+may throw $(D StdioException) on I/O error. -+ -+Note: -+Each $(D front) will not persist after $(D -+popFront) is called, so the caller must copy its contents (e.g. by -+calling $(D to!string)) if retention is needed. -+ -+Params: -+Char = Character type for each line, defaulting to $(D char). -+keepTerminator = Use $(D KeepTerminator.yes) to include the -+terminator at the end of each line. -+terminator = Line separator ($(D '\n') by default). -+ -+Example: -+---- -+import std.algorithm, std.stdio, std.string; -+// Count words in a file using ranges. -+void main() -+{ -+ auto file = File("file.txt"); // Open for reading -+ const wordCount = file.byLine() // Read lines -+ .map!split // Split into words -+ .map!(a => a.length) // Count words per line -+ .reduce!((a, b) => a + b); // Total word count -+ writeln(wordCount); -+} -+---- -+ -+Example: -+---- -+import std.range, std.stdio; -+// Read lines using foreach. -+void main() -+{ -+ auto file = File("file.txt"); // Open for reading -+ auto range = file.byLine(); -+ // Print first three lines -+ foreach (line; range.take(3)) -+ writeln(line); -+ // Print remaining lines beginning with '#' -+ foreach (line; range) -+ { -+ if (!line.empty && line[0] == '#') -+ writeln(line); -+ } -+} -+---- -+Notice that neither example accesses the line data returned by -+$(D front) after the corresponding $(D popFront) call is made (because -+the contents may well have changed). -+*/ -+ auto byLine(Terminator = char, Char = char) - (KeepTerminator keepTerminator = KeepTerminator.no, - Terminator terminator = '\n') -+ if (isScalarType!Terminator) - { -- return typeof(return)(this, keepTerminator, terminator); -+ return ByLine!(Char, Terminator)(this, keepTerminator, terminator); -+ } -+ -+/// ditto -+ auto byLine(Terminator, Char = char) -+ (KeepTerminator keepTerminator, Terminator terminator) -+ if (is(Unqual!(ElementEncodingType!Terminator) == Char)) -+ { -+ return ByLine!(Char, Terminator)(this, keepTerminator, terminator); - } - - unittest -@@ -1093,11 +1312,11 @@ to this file. */ - { - assert(false); - } -- f.close(); -+ f.detach(); -+ assert(!f.isOpen); - -- void test(string txt, string[] witness, -- KeepTerminator kt = KeepTerminator.no, -- bool popFirstLine = false) -+ void testTerm(Terminator)(string txt, string[] witness, -+ KeepTerminator kt, Terminator term, bool popFirstLine) - { - uint i; - std.file.write(deleteme, txt); -@@ -1107,30 +1326,72 @@ to this file. */ - f.close(); - assert(!f.isOpen); - } -- auto lines = f.byLine(kt); -+ auto lines = f.byLine(kt, term); - if (popFirstLine) - { - lines.popFront(); - i = 1; - } -+ assert(lines.empty || lines.front is lines.front); - foreach (line; lines) - { - assert(line == witness[i++]); - } - assert(i == witness.length, text(i, " != ", witness.length)); - } -+ /* Wrap with default args. -+ * Note: Having a default argument for terminator = '\n' would prevent -+ * instantiating Terminator=string (or "\n" would prevent Terminator=char) */ -+ void test(string txt, string[] witness, -+ KeepTerminator kt = KeepTerminator.no, -+ bool popFirstLine = false) -+ { -+ testTerm(txt, witness, kt, '\n', popFirstLine); -+ } - - test("", null); - test("\n", [ "" ]); - test("asd\ndef\nasdf", [ "asd", "def", "asdf" ]); - test("asd\ndef\nasdf", [ "asd", "def", "asdf" ], KeepTerminator.no, true); - test("asd\ndef\nasdf\n", [ "asd", "def", "asdf" ]); -+ test("foo", [ "foo" ], KeepTerminator.no, true); -+ testTerm("bob\r\nmarge\r\nsteve\r\n", ["bob", "marge", "steve"], -+ KeepTerminator.no, "\r\n", false); -+ testTerm("sue\r", ["sue"], KeepTerminator.no, '\r', false); - - test("", null, KeepTerminator.yes); - test("\n", [ "\n" ], KeepTerminator.yes); - test("asd\ndef\nasdf", [ "asd\n", "def\n", "asdf" ], KeepTerminator.yes); - test("asd\ndef\nasdf\n", [ "asd\n", "def\n", "asdf\n" ], KeepTerminator.yes); - test("asd\ndef\nasdf\n", [ "asd\n", "def\n", "asdf\n" ], KeepTerminator.yes, true); -+ test("foo", [ "foo" ], KeepTerminator.yes, false); -+ testTerm("bob\r\nmarge\r\nsteve\r\n", ["bob\r\n", "marge\r\n", "steve\r\n"], -+ KeepTerminator.yes, "\r\n", false); -+ testTerm("sue\r", ["sue\r"], KeepTerminator.yes, '\r', false); -+ -+ auto file = File.tmpfile(); -+ file.write("1\n2\n3\n"); -+ -+ // bug 9599 -+ file.rewind(); -+ File.ByLine!(char, char) fbl = file.byLine(); -+ auto fbl2 = fbl; -+ assert(fbl.front == "1"); -+ assert(fbl.front is fbl2.front); -+ assert(fbl.take(1).equal(["1"])); -+ assert(fbl.equal(["2", "3"])); -+ assert(fbl.empty); -+ assert(file.isOpen); // we still have a valid reference -+ -+ file.rewind(); -+ fbl = file.byLine(); -+ assert(!fbl.drop(2).empty); -+ assert(fbl.equal(["3"])); -+ assert(fbl.empty); -+ assert(file.isOpen); -+ -+ file.detach(); -+ assert(!file.isOpen); - } - - template byRecord(Fields...) -@@ -1160,7 +1421,8 @@ to this file. */ - } - - -- /** -+ // Note: This was documented until 2013/08 -+ /* - * Range that reads a chunk at a time. - */ - struct ByChunk -@@ -1186,7 +1448,7 @@ to this file. */ - - - /// Range primitive operations. -- @property -+ @property nothrow - bool empty() const - { - return !file_.isOpen; -@@ -1194,9 +1456,10 @@ to this file. */ - - - /// Ditto -- @property -- nothrow ubyte[] front() -+ @property nothrow -+ ubyte[] front() - { -+ version(assert) if (empty) throw new RangeError(); - return chunk_; - } - -@@ -1204,7 +1467,7 @@ to this file. */ - /// Ditto - void popFront() - { -- enforce(!empty, "Cannot call popFront on empty range"); -+ version(assert) if (empty) throw new RangeError(); - - chunk_ = file_.rawRead(chunk_); - if (chunk_.length == 0) -@@ -1213,10 +1476,17 @@ to this file. */ - } - - /** --Iterates through a file a chunk at a time by using $(D foreach). -+Returns an input range set up to read from the file handle a chunk at a -+time. - --Example: -+The element type for the range will be $(D ubyte[]). Range primitives -+may throw $(D StdioException) on I/O error. - -+Note: Each $(D front) will not persist after $(D -+popFront) is called, so the caller must copy its contents (e.g. by -+calling $(D buffer.dup)) if retention is needed. -+ -+Example: - --------- - void main() - { -@@ -1226,15 +1496,22 @@ void main() - } - } - --------- -- - The content of $(D buffer) is reused across calls. In the example - above, $(D buffer.length) is 4096 for all iterations, except for the - last one, in which case $(D buffer.length) may be less than 4096 (but - always greater than zero). - --In case of an I/O error, an $(D StdioException) is thrown. -+Example: -+--- -+import std.algorithm, std.stdio; -+ -+void main() -+{ -+ stdin.byChunk(1024).copy(stdout.lockingTextWriter()); -+} -+--- - */ -- ByChunk byChunk(size_t chunkSize) -+ auto byChunk(size_t chunkSize) - { - return ByChunk(this, chunkSize); - } -@@ -1262,7 +1539,8 @@ In case of an I/O error, an $(D StdioExc - assert(i == witness.length); - } - --/** -+// Note: This was documented until 2013/08 -+/* - $(D Range) that locks the file and allows fast writing to it. - */ - struct LockingTextWriter -@@ -1282,15 +1560,20 @@ $(D Range) that locks the file and allow - - ~this() - { -- FUNLOCK(fps); -- fps = null; -- handle = null; -+ if(fps) -+ { -+ FUNLOCK(fps); -+ fps = null; -+ handle = null; -+ } - } - - this(this) - { -- enforce(fps); -- FLOCK(fps); -+ if(fps) -+ { -+ FLOCK(fps); -+ } - } - - /// Range primitive implementations. -@@ -1396,8 +1679,11 @@ $(D Range) that locks the file and allow - } - } - --/// Convenience function. -- @property LockingTextWriter lockingTextWriter() -+/** Returns an output range that locks the file and allows fast writing to it. -+ -+See $(LREF byChunk) for an example. -+*/ -+ auto lockingTextWriter() - { - return LockingTextWriter(this); - } -@@ -1472,13 +1758,13 @@ struct LockingTextReader - - @property dchar front() - { -- enforce(!empty); -+ version(assert) if (empty) throw new RangeError(); - return _crt; - } - - void popFront() - { -- enforce(!empty); -+ version(assert) if (empty) throw new RangeError(); - if (FGETC(cast(_iobuf*) _f._p.handle) == -1) - { - enforce(_f.eof); -@@ -1752,6 +2038,19 @@ unittest - "A\nB\nA\nB\nA\nB\nA\nB\n"); - } - -+unittest -+{ -+ static auto useInit(T)(T ltw) -+ { -+ T val; -+ val = ltw; -+ val = T.init; -+ return val; -+ } -+ useInit(stdout.lockingTextWriter()); -+} -+ -+ - /*********************************** - * If the first argument $(D args[0]) is a $(D FILE*), use - * $(LINK2 std_format.html#format-string, the format specifier) in -@@ -1886,40 +2185,102 @@ unittest - } - - /********************************** -- * Read line from stream $(D fp). -+ * Read line from $(D stdin). -+ * -+ * This version manages its own read buffer, which means one memory allocation per call. If you are not -+ * retaining a reference to the read data, consider the $(D readln(buf)) version, which may offer -+ * better performance as it can reuse its read buffer. -+ * - * Returns: -- * $(D null) for end of file, -- * $(D char[]) for line read from $(D fp), including terminating character -+ * The line that was read, including the line terminator character. - * Params: -- * $(D fp) = input stream -- * $(D terminator) = line terminator, '\n' by default -+ * S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to $(D string). -+ * terminator = line terminator (by default, '\n') - * Throws: -- * $(D StdioException) on error -+ * $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error. - * Example: - * Reads $(D stdin) and writes it to $(D stdout). - --- - import std.stdio; - --int main() -+void main() - { -- string buf; -- while ((buf = stdin.readln()) !is null) -+ string line; -+ while ((line = readln()) !is null) -+ write(line); -+} -+--- -+*/ -+S readln(S = string)(dchar terminator = '\n') -+if (isSomeString!S) -+{ -+ return stdin.readln!S(terminator); -+} -+ -+/********************************** -+ * Read line from $(D stdin) and write it to buf[], including terminating character. -+ * -+ * This can be faster than $(D line = readln()) because you can reuse -+ * the buffer for each call. Note that reusing the buffer means that you -+ * must copy the previous contents if you wish to retain them. -+ * -+ * Returns: -+ * $(D size_t) 0 for end of file, otherwise number of characters read -+ * Params: -+ * buf = Buffer used to store the resulting line data. buf is resized as necessary. -+ * terminator = line terminator (by default, '\n') -+ * Throws: -+ * $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error. -+ * Example: -+ * Reads $(D stdin) and writes it to $(D stdout). -+--- -+import std.stdio; -+ -+void main() -+{ -+ char[] buf; -+ while (readln(buf)) - write(buf); -- return 0; - } - --- - */ --string readln(dchar terminator = '\n') -+size_t readln(C)(ref C[] buf, dchar terminator = '\n') -+if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum)) - { -- return stdin.readln(terminator); -+ return stdin.readln(buf, terminator); - } - - /** ditto */ --size_t readln(ref char[] buf, dchar terminator = '\n') -+size_t readln(C, R)(ref C[] buf, R terminator) -+if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) && -+ isBidirectionalRange!R && is(typeof(terminator.front == dchar.init))) - { - return stdin.readln(buf, terminator); - } - -+unittest -+{ -+ //we can't actually test readln, so at the very least, -+ //we test compilability -+ void foo() -+ { -+ readln(); -+ readln('\t'); -+ foreach (String; TypeTuple!(string, char[], wstring, wchar[], dstring, dchar[])) -+ { -+ readln!String(); -+ readln!String('\t'); -+ } -+ foreach (String; TypeTuple!(char[], wchar[], dchar[])) -+ { -+ String buf; -+ readln(buf); -+ readln(buf, '\t'); -+ readln(buf, "<br />"); -+ } -+ } -+} -+ - /* - * Convenience function that forwards to $(D core.stdc.stdio.fopen) - * (to $(D _wfopen) on Windows) -@@ -2239,18 +2600,17 @@ unittest - } - - /** --Iterates through a file a chunk at a time by using $(D --foreach). -+Iterates through a file a chunk at a time by using $(D foreach). - - Example: - - --------- - void main() - { -- foreach (ubyte[] buffer; chunks(stdin, 4096)) -- { -- ... use buffer ... -- } -+ foreach (ubyte[] buffer; chunks(stdin, 4096)) -+ { -+ ... use buffer ... -+ } - } - --------- - -@@ -2261,8 +2621,11 @@ The content of $(D buffer) is reused acr - - In case of an I/O error, an $(D StdioException) is thrown. - */ -- --struct chunks -+auto chunks(File f, size_t size) -+{ -+ return ChunksImpl(f, size); -+} -+private struct ChunksImpl - { - private File f; - private size_t size; -@@ -2290,7 +2653,7 @@ struct chunks - - int opApply(D)(scope D dg) - { -- const maxStackSize = 1024 * 16; -+ enum maxStackSize = 1024 * 16; - ubyte[] buffer = void; - if (size < maxStackSize) - buffer = (cast(ubyte*) alloca(size))[0 .. size]; -@@ -2322,7 +2685,7 @@ struct chunks - - unittest - { -- //printf("Entering test at line %d\n", __LINE__); -+ //printf("Entering test at line %d\n", __LINE__); - scope(failure) printf("Failed test at line %d\n", __LINE__); - auto deleteme = testFilename(); - scope(exit) { std.file.remove(deleteme); } -@@ -2365,6 +2728,8 @@ Initialize with a message and an error c - errno = e; - version (Posix) - { -+ import std.c.string : strerror_r; -+ - char[256] buf = void; - version (linux) - { -@@ -2378,10 +2743,13 @@ Initialize with a message and an error c - } - else - { -- auto s = std.c.string.strerror(errno); -+ auto s = core.stdc.string.strerror(errno); - } - auto sysmsg = to!string(s); -- super(message ? message ~ "(" ~ sysmsg ~ ")" : sysmsg); -+ // If e is 0, we don't use the system error message. (The message -+ // is "Success", which is rather pointless for an exception.) -+ super(e == 0 ? message -+ : (message ? message ~ " (" ~ sysmsg ~ ")" : sysmsg)); - } - - /** Convenience functions that throw an $(D StdioException). */ -@@ -2887,18 +3255,22 @@ private size_t readlnImpl(FILE* fps, ref - Bugs: - Only works on Linux - */ --version(linux) { -+version(linux) -+{ - static import linux = std.c.linux.linux; - static import sock = std.c.linux.socket; -+ import core.stdc.string : memcpy; - -- File openNetwork(string host, ushort port) { -+ File openNetwork(string host, ushort port) -+ { - auto h = enforce( sock.gethostbyname(std.string.toStringz(host)), - new StdioException("gethostbyname")); - - int s = sock.socket(sock.AF_INET, sock.SOCK_STREAM, 0); - enforce(s != -1, new StdioException("socket")); - -- scope(failure) { -+ scope(failure) -+ { - linux.close(s); // want to make sure it doesn't dangle if - // something throws. Upon normal exit, the - // File struct's reference counting takes -@@ -2910,7 +3282,7 @@ version(linux) { - - addr.sin_family = sock.AF_INET; - addr.sin_port = sock.htons(port); -- std.c.string.memcpy(&addr.sin_addr.s_addr, h.h_addr, h.h_length); -+ core.stdc.string.memcpy(&addr.sin_addr.s_addr, h.h_addr, h.h_length); - - enforce(sock.connect(s, cast(sock.sockaddr*) &addr, addr.sizeof) != -1, - new StdioException("Connect failed")); ---- a/src/libphobos/src/std/stream.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/stream.d 2014-04-01 16:32:51.000000000 +0100 -@@ -88,10 +88,7 @@ private { - import std.utf; - import core.bitop; // for bswap - import core.vararg; --} -- --version (Windows) { -- private import std.file; -+ import std.file; - } - - /// InputStream is the interface for readable streams. -@@ -1175,10 +1172,7 @@ class Stream : InputStream, OutputStream - } - else version (Win64) - size_t printf(const(char)[] format, ...) { -- va_list ap; -- ap = cast(va_list) &format; -- ap += format.sizeof; -- return vprintf(format, ap); -+ return vprintf(format, _argptr); - } - else version (X86_64) - size_t printf(const(char)[] format, ...) { ---- a/src/libphobos/src/std/string.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/string.d 2014-04-01 16:32:51.000000000 +0100 -@@ -24,11 +24,12 @@ Source: $(PHOBOSSRC std/_string.d) - module std.string; - - //debug=string; // uncomment to turn on debugging printf's -+debug(string) import core.stdc.stdio; - - import core.exception : RangeError, onRangeError; - import core.vararg, core.stdc.stdlib, core.stdc.string, - std.algorithm, std.ascii, std.conv, std.exception, std.format, std.functional, -- std.metastrings, std.range, std.regex, std.traits, -+ std.range, std.traits, - std.typecons, std.typetuple, std.uni, std.utf; - - //Remove when repeat is finally removed. They're only here as part of the -@@ -61,120 +62,32 @@ class StringException : Exception - this(string msg, - string file = __FILE__, - size_t line = __LINE__, -- Throwable next = null) -+ Throwable next = null) @safe pure nothrow - { - super(msg, file, line, next); - } - } - --/* ************* Constants *************** */ -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.ascii.hexDigits instead.") immutable char[16] hexdigits = "0123456789ABCDEF"; --deprecated("Please use std.ascii.digits instead.") immutable digits = "0123456789"; --deprecated("Please use std.ascii.octalDigits instead.") immutable char[8] octdigits = "01234567"; --deprecated("Please use std.ascii.lowercase instead.") immutable char[26] lowercase = "abcdefghijklmnopqrstuvwxyz"; --deprecated("Please use std.ascii.letters instead.") immutable char[52] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; --deprecated("Please use std.ascii.uppercase instead.") immutable char[26] uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; --deprecated("Please use std.ascii.whitespace instead.") alias std.ascii.whitespace whitespace; --deprecated("Please use std.uni.lineSep instead.") enum dchar LS = '\u2028'; --deprecated("Please use std.uni.paraSep instead.") enum dchar PS = '\u2029'; --deprecated("Please use std.ascii.newline instead.") alias std.ascii.newline newline; --deprecated("Please use std.uni.isWhite instead.") bool iswhite(dchar c) --{ -- return c <= 0x7F -- ? indexOf(whitespace, c) != -1 -- : (c == paraSep || c == lineSep); --} -- - - /++ - Compares two ranges of characters lexicographically. The comparison is -- case insensitive. Use $(D XREF algorithm, cmp) for a case sensitive -- comparison. $(D icmp) works like $(D XREF algorithm, cmp) except that it -- converts characters to lowercase prior to applying ($D pred). Technically, -- $(D icmp(r1, r2)) is equivalent to -- $(D cmp!"std.uni.toLower(a) < std.uni.toLower(b)"(r1, r2)). -+ case insensitive. Use $(XREF algorithm, cmp) for a case sensitive -+ comparison. For details see $(XREF uni, icmp). - - $(BOOKTABLE, - $(TR $(TD $(D < 0)) $(TD $(D s1 < s2) )) - $(TR $(TD $(D = 0)) $(TD $(D s1 == s2))) - $(TR $(TD $(D > 0)) $(TD $(D s1 > s2))) - ) -- +/ --int icmp(alias pred = "a < b", S1, S2)(S1 s1, S2 s2) -- if(isSomeString!S1 && isSomeString!S2) --{ -- static if(is(typeof(pred) : string)) -- enum isLessThan = pred == "a < b"; -- else -- enum isLessThan = false; -- -- size_t i, j; -- while(i < s1.length && j < s2.length) -- { -- immutable c1 = std.uni.toLower(decode(s1, i)); -- immutable c2 = std.uni.toLower(decode(s2, j)); -- -- static if(isLessThan) -- { -- if(c1 != c2) -- { -- if(c1 < c2) return -1; -- if(c1 > c2) return 1; -- } -- } -- else -- { -- if(binaryFun!pred(c1, c2)) return -1; -- if(binaryFun!pred(c2, c1)) return 1; -- } -- } -- -- if(i < s1.length) return 1; -- if(j < s2.length) return -1; -- -- return 0; --} -- --int icmp(alias pred = "a < b", S1, S2)(S1 s1, S2 s2) -- if(!(isSomeString!S1 && isSomeString!S2) && -- isForwardRange!S1 && is(Unqual!(ElementType!S1) == dchar) && -- isForwardRange!S2 && is(Unqual!(ElementType!S2) == dchar)) --{ -- static if(is(typeof(pred) : string)) -- enum isLessThan = pred == "a < b"; -- else -- enum isLessThan = false; -- -- for(;; s1.popFront(), s2.popFront()) -- { -- if(s1.empty) return s2.empty ? 0 : -1; -- if(s2.empty) return 1; -- -- immutable c1 = std.uni.toLower(s1.front); -- immutable c2 = std.uni.toLower(s2.front); -- -- static if(isLessThan) -- { -- if(c1 != c2) -- { -- if(c1 < c2) return -1; -- if(c1 > c2) return 1; -- } -- } -- else -- { -- if(binaryFun!pred(c1, c2)) return -1; -- if(binaryFun!pred(c2, c1)) return 1; -- } -- } --} -++/ -+alias icmp = std.uni.icmp; - - unittest - { - debug(string) printf("string.icmp.unittest\n"); - -+ assertCTFEable!( -+ { - assert(icmp("Ü", "ü") == 0, "Über failure"); - assert(icmp("abc", "abc") == 0); - assert(icmp("ABC", "abc") == 0); -@@ -220,6 +133,7 @@ unittest - assert(icmp("\u0430\u0410\u0543"d, filter!"true"("\u0430\u0410\u0544")) < 0); - assert(icmp(filter!"true"("\u0430\u0411\u0543"d), filter!"true"("\u0430\u0411\u0543\u0237")) < 0); - assert(icmp(filter!"true"("\u0430\u0411\u0543\u0237"d), filter!"true"("\u0430\u0411\u0543")) > 0); -+ }); - } - - -@@ -300,9 +214,12 @@ unittest - { - debug(string) printf("string.toStringz.unittest\n"); - -+ // TODO: CTFEable toStringz is really necessary? -+ //assertCTFEable!( -+ //{ - auto p = toStringz("foo"); - assert(strlen(p) == 3); -- const(char) foo[] = "abbzxyzzy"; -+ const(char)[] foo = "abbzxyzzy"; - p = toStringz(foo[3..5]); - assert(strlen(p) == 2); - -@@ -317,6 +234,7 @@ unittest - test = "foo\0"; - p = toStringz(test); - assert(p[0] == 'f' && p[1] == 'o' && p[2] == 'o' && p[3] == 0); -+ //}); - } - - -@@ -333,18 +251,19 @@ enum CaseSensitive { no, yes } - +/ - ptrdiff_t indexOf(Char)(in Char[] s, - dchar c, -- CaseSensitive cs = CaseSensitive.yes) pure -- if(isSomeChar!Char) -+ CaseSensitive cs = CaseSensitive.yes) @safe pure -+ if (isSomeChar!Char) - { - if (cs == CaseSensitive.yes) - { - static if (Char.sizeof == 1) - { -- if (std.ascii.isASCII(c)) -+ if (std.ascii.isASCII(c) && !__ctfe) - { // Plain old ASCII -- auto p = cast(char*)memchr(s.ptr, c, s.length); -+ auto trustedmemchr() @trusted { return cast(Char*)memchr(s.ptr, c, s.length); } -+ auto p = trustedmemchr(); - if (p) -- return p - cast(char *)s; -+ return p - s.ptr; - else - return -1; - } -@@ -389,6 +308,8 @@ unittest - { - debug(string) printf("string.indexOf.unittest\n"); - -+ assertCTFEable!( -+ { - foreach (S; TypeTuple!(string, wstring, dstring)) - { - assert(indexOf(cast(S)null, cast(dchar)'a') == -1); -@@ -400,6 +321,7 @@ unittest - assert(indexOf(to!S("def"), cast(dchar)'a', CaseSensitive.no) == -1); - assert(indexOf(to!S("Abba"), cast(dchar)'a', CaseSensitive.no) == 0); - assert(indexOf(to!S("def"), cast(dchar)'F', CaseSensitive.no) == 2); -+ assert(indexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0); - - S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; - assert(indexOf("def", cast(char)'f', CaseSensitive.no) == 2); -@@ -407,12 +329,78 @@ unittest - assert(indexOf(sPlts, cast(char)'R', CaseSensitive.no) == 2); - } - -- foreach(cs; EnumMembers!CaseSensitive) -+ foreach (cs; EnumMembers!CaseSensitive) - { - assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', cs) == 9); - assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', cs) == 7); - assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', cs) == 6); - } -+ }); -+} -+ -+/++ -+ Returns the index of the first occurence of $(D c) in $(D s) with respect -+ to the start index $(D startIdx). If $(D c) is not found, then $(D -1) is -+ returned. If $(D c) is found the value of the returned index is at least -+ $(D startIdx). $(D startIdx) represents a codeunit index in $(D s). If the -+ sequence starting at $(D startIdx) does not represent a well formed codepoint, -+ then a $(XREF utf,UTFException) may be thrown. -+ -+ $(D cs) indicates whether the comparisons are case sensitive. -+ +/ -+ptrdiff_t indexOf(Char)(const(Char)[] s, dchar c, const size_t startIdx, -+ CaseSensitive cs = CaseSensitive.yes) @safe pure -+ if (isSomeChar!Char) -+{ -+ if (startIdx < s.length) -+ { -+ ptrdiff_t foundIdx = indexOf(s[startIdx .. $], c, cs); -+ if (foundIdx != -1) -+ { -+ return foundIdx + cast(ptrdiff_t)startIdx; -+ } -+ } -+ return -1; -+} -+ -+unittest -+{ -+ debug(string) printf("string.indexOf(startIdx).unittest\n"); -+ -+ foreach (S; TypeTuple!(string, wstring, dstring)) -+ { -+ assert(indexOf(cast(S)null, cast(dchar)'a', 1) == -1); -+ assert(indexOf(to!S("def"), cast(dchar)'a', 1) == -1); -+ assert(indexOf(to!S("abba"), cast(dchar)'a', 1) == 3); -+ assert(indexOf(to!S("def"), cast(dchar)'f', 1) == 2); -+ -+ assert((to!S("def")).indexOf(cast(dchar)'a', 1, -+ CaseSensitive.no) == -1); -+ assert(indexOf(to!S("def"), cast(dchar)'a', 1, -+ CaseSensitive.no) == -1); -+ assert(indexOf(to!S("def"), cast(dchar)'a', 12, -+ CaseSensitive.no) == -1); -+ assert(indexOf(to!S("AbbA"), cast(dchar)'a', 2, -+ CaseSensitive.no) == 3); -+ assert(indexOf(to!S("def"), cast(dchar)'F', 2, CaseSensitive.no) == 2); -+ -+ S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; -+ assert(indexOf("def", cast(char)'f', cast(uint)2, -+ CaseSensitive.no) == 2); -+ assert(indexOf(sPlts, cast(char)'P', 12, CaseSensitive.no) == 23); -+ assert(indexOf(sPlts, cast(char)'R', cast(ulong)1, -+ CaseSensitive.no) == 2); -+ } -+ -+ foreach(cs; EnumMembers!CaseSensitive) -+ { -+ assert(indexOf("hello\U00010143\u0100\U00010143", '\u0100', 2, cs) -+ == 9); -+ assert(indexOf("hello\U00010143\u0100\U00010143"w, '\u0100', 3, cs) -+ == 7); -+ assert(indexOf("hello\U00010143\u0100\U00010143"d, '\u0100', 6, cs) -+ == 6); -+ } - } - - /++ -@@ -424,7 +412,7 @@ unittest - ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, - const(Char2)[] sub, - CaseSensitive cs = CaseSensitive.yes) -- if(isSomeChar!Char1 && isSomeChar!Char2) -+ if (isSomeChar!Char1 && isSomeChar!Char2) - { - const(Char1)[] balance; - if (cs == CaseSensitive.yes) -@@ -434,7 +422,7 @@ ptrdiff_t indexOf(Char1, Char2)(const(Ch - else - { - balance = std.algorithm.find! -- ((dchar a, dchar b){return std.uni.toLower(a) == std.uni.toLower(b);}) -+ ((a, b) => std.uni.toLower(a) == std.uni.toLower(b)) - (s, sub); - } - return balance.empty ? -1 : balance.ptr - s.ptr; -@@ -444,9 +432,11 @@ unittest - { - debug(string) printf("string.indexOf.unittest\n"); - -- foreach(S; TypeTuple!(string, wstring, dstring)) -+ assertCTFEable!( - { -- foreach(T; TypeTuple!(string, wstring, dstring)) -+ foreach (S; TypeTuple!(string, wstring, dstring)) -+ { -+ foreach (T; TypeTuple!(string, wstring, dstring)) - { - assert(indexOf(cast(S)null, to!T("a")) == -1); - assert(indexOf(to!S("def"), to!T("a")) == -1); -@@ -479,15 +469,98 @@ unittest - to!T("page-break-before"), CaseSensitive.no) == -1); - } - -- foreach(cs; EnumMembers!CaseSensitive) -+ foreach (cs; EnumMembers!CaseSensitive) - { - assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"), cs) == 9); - assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"), cs) == 7); - assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"), cs) == 6); - } - } -+ }); - } - -+/++ -+ Returns the index of the first occurence of $(D sub) in $(D s) with -+ respect to the start index $(D startIdx). If $(D sub) is not found, then -+ $(D -1) is returned. If $(D sub) is found the value of the returned index -+ is at least $(D startIdx). $(D startIdx) represents a codeunit index in -+ $(D s). If the sequence starting at $(D startIdx) does not represent a well -+ formed codepoint, then a $(XREF utf,UTFException) may be thrown. -+ -+ $(D cs) indicates whether the comparisons are case sensitive. -+ +/ -+ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, -+ const size_t startIdx, CaseSensitive cs = CaseSensitive.yes) -+ if (isSomeChar!Char1 && isSomeChar!Char2) -+{ -+ if (startIdx < s.length) -+ { -+ ptrdiff_t foundIdx = indexOf(s[startIdx .. $], sub, cs); -+ if (foundIdx != -1) -+ { -+ return foundIdx + cast(ptrdiff_t)startIdx; -+ } -+ } -+ return -1; -+} -+ -+unittest -+{ -+ debug(string) printf("string.indexOf(startIdx).unittest\n"); -+ -+ foreach(S; TypeTuple!(string, wstring, dstring)) -+ { -+ foreach(T; TypeTuple!(string, wstring, dstring)) -+ { -+ assert(indexOf(cast(S)null, to!T("a"), 1337) == -1); -+ assert(indexOf(to!S("def"), to!T("a"), 0) == -1); -+ assert(indexOf(to!S("abba"), to!T("a"), 2) == 3); -+ assert(indexOf(to!S("def"), to!T("f"), 1) == 2); -+ assert(indexOf(to!S("dfefffg"), to!T("fff"), 1) == 3); -+ assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 5) == 6); -+ -+ assert(indexOf(to!S("dfeffgfff"), to!T("a"), 1, CaseSensitive.no) == -1); -+ assert(indexOf(to!S("def"), to!T("a"), 2, CaseSensitive.no) == -1); -+ assert(indexOf(to!S("abba"), to!T("a"), 3, CaseSensitive.no) == 3); -+ assert(indexOf(to!S("def"), to!T("f"), 1, CaseSensitive.no) == 2); -+ assert(indexOf(to!S("dfefffg"), to!T("fff"), 2, CaseSensitive.no) == 3); -+ assert(indexOf(to!S("dfeffgfff"), to!T("fff"), 4, CaseSensitive.no) == 6); -+ assert(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no) == 9, -+ to!string(indexOf(to!S("dfeffgffföä"), to!T("öä"), 9, CaseSensitive.no)) -+ ~ " " ~ S.stringof ~ " " ~ T.stringof); -+ -+ S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; -+ S sMars = "Who\'s \'My Favorite Maritian?\'"; -+ -+ assert(indexOf(sMars, to!T("MY fAVe"), 10, -+ CaseSensitive.no) == -1); -+ assert(indexOf(sMars, to!T("mY fAVOriTe"), 4, CaseSensitive.no) == 7); -+ assert(indexOf(sPlts, to!T("mArS:"), 0, CaseSensitive.no) == 0); -+ assert(indexOf(sPlts, to!T("rOcK"), 12, CaseSensitive.no) == 17); -+ assert(indexOf(sPlts, to!T("Un."), 32, CaseSensitive.no) == 41); -+ assert(indexOf(sPlts, to!T(sPlts), 0, CaseSensitive.no) == 0); -+ -+ assert(indexOf("\u0100", to!T("\u0100"), 0, CaseSensitive.no) == 0); -+ -+ // Thanks to Carlos Santander B. and zwang -+ assert(indexOf("sus mejores cortesanos. Se embarcaron en el puerto de Dubai y", -+ to!T("page-break-before"), 10, CaseSensitive.no) == -1); -+ -+ // In order for indexOf with and without index to be consistent -+ assert(indexOf(to!S(""), to!T("")) == indexOf(to!S(""), to!T(""), 0)); -+ } -+ -+ foreach(cs; EnumMembers!CaseSensitive) -+ { -+ assert(indexOf("hello\U00010143\u0100\U00010143", to!S("\u0100"), -+ 3, cs) == 9); -+ assert(indexOf("hello\U00010143\u0100\U00010143"w, to!S("\u0100"), -+ 3, cs) == 7); -+ assert(indexOf("hello\U00010143\u0100\U00010143"d, to!S("\u0100"), -+ 3, cs) == 6); -+ } -+ } -+} - - /++ - Returns the index of the last occurence of $(D c) in $(D s). If $(D c) -@@ -498,54 +571,57 @@ unittest - ptrdiff_t lastIndexOf(Char)(const(Char)[] s, - dchar c, - CaseSensitive cs = CaseSensitive.yes) -- if(isSomeChar!Char) -+ if (isSomeChar!Char) - { -- if(cs == CaseSensitive.yes) -+ if (cs == CaseSensitive.yes) - { -- if(cast(dchar)(cast(Char)c) == c) -+ if (std.ascii.isASCII(c)) - { -- for(auto i = s.length; i-- != 0;) -+ foreach_reverse (i, it; s) - { -- if(s[i] == c) -- return cast(ptrdiff_t)i; -+ if (it == c) -+ { -+ return i; -+ } - } - } - else - { -- for(size_t i = s.length; !s.empty;) -+ foreach_reverse (i, dchar it; s) - { -- if(s.back == c) -- return cast(ptrdiff_t)i - codeLength!Char(c); -- -- i -= strideBack(s, i); -- s = s[0 .. i]; -+ if (it == c) -+ { -+ return i; -+ } - } - } - } - else - { -- if(std.ascii.isASCII(c)) -+ if (std.ascii.isASCII(c)) - { - immutable c1 = std.ascii.toLower(c); - -- for(auto i = s.length; i-- != 0;) -+ foreach_reverse (i, it; s) - { -- immutable c2 = std.ascii.toLower(s[i]); -- if(c1 == c2) -- return cast(ptrdiff_t)i; -+ immutable c2 = std.ascii.toLower(it); -+ if (c1 == c2) -+ { -+ return i; -+ } - } - } - else - { - immutable c1 = std.uni.toLower(c); - -- for(size_t i = s.length; !s.empty;) -+ foreach_reverse (i, dchar it; s) - { -- if(std.uni.toLower(s.back) == c1) -- return cast(ptrdiff_t)i - codeLength!Char(c); -- -- i -= strideBack(s, i); -- s = s[0 .. i]; -+ immutable c2 = std.uni.toLower(it); -+ if (c1 == c2) -+ { -+ return i; -+ } - } - } - } -@@ -557,17 +633,23 @@ unittest - { - debug(string) printf("string.lastIndexOf.unittest\n"); - -- foreach(S; TypeTuple!(string, wstring, dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!(string, wstring, dstring)) - { - assert(lastIndexOf(cast(S) null, 'a') == -1); - assert(lastIndexOf(to!S("def"), 'a') == -1); - assert(lastIndexOf(to!S("abba"), 'a') == 3); - assert(lastIndexOf(to!S("def"), 'f') == 2); -+ assert(lastIndexOf(to!S("ödef"), 'ö') == 0); - - assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1); - assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1); - assert(lastIndexOf(to!S("AbbA"), 'a', CaseSensitive.no) == 3); - assert(lastIndexOf(to!S("def"), 'F', CaseSensitive.no) == 2); -+ assert(lastIndexOf(to!S("ödef"), 'ö', CaseSensitive.no) == 0); -+ assert(lastIndexOf(to!S("i\u0100def"), to!dchar("\u0100"), -+ CaseSensitive.no) == 1); - - S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; - -@@ -576,6 +658,61 @@ unittest - assert(lastIndexOf(sPlts, 'S', CaseSensitive.no) == 40); - } - -+ foreach (cs; EnumMembers!CaseSensitive) -+ { -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4); -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, '\u0100', cs) == 2); -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, '\u0100', cs) == 1); -+ } -+ }); -+} -+ -+/++ -+ Returns the index of the last occurence of $(D c) in $(D s). If $(D c) is -+ not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in -+ the following way $(D s[0 .. startIdx]). $(D startIdx) represents a -+ codeunit index in $(D s). If the sequence ending at $(D startIdx) does not -+ represent a well formed codepoint, then a $(XREF utf,UTFException) may be -+ thrown. -+ -+ $(D cs) indicates whether the comparisons are case sensitive. -+ +/ -+ptrdiff_t lastIndexOf(Char)(const(Char)[] s, dchar c, const size_t startIdx, -+ CaseSensitive cs = CaseSensitive.yes) -+ if (isSomeChar!Char) -+{ -+ if (startIdx <= s.length) -+ { -+ return lastIndexOf(s[0u .. startIdx], c, cs); -+ } -+ -+ return -1; -+} -+ -+unittest -+{ -+ debug(string) printf("string.lastIndexOf.unittest\n"); -+ -+ foreach(S; TypeTuple!(string, wstring, dstring)) -+ { -+ assert(lastIndexOf(cast(S) null, 'a') == -1); -+ assert(lastIndexOf(to!S("def"), 'a') == -1); -+ assert(lastIndexOf(to!S("abba"), 'a', 3) == 0); -+ assert(lastIndexOf(to!S("deff"), 'f', 3) == 2); -+ -+ assert(lastIndexOf(cast(S) null, 'a', CaseSensitive.no) == -1); -+ assert(lastIndexOf(to!S("def"), 'a', CaseSensitive.no) == -1); -+ assert(lastIndexOf(to!S("AbbAa"), 'a', to!ushort(4), CaseSensitive.no) == 3, -+ to!string(lastIndexOf(to!S("AbbAa"), 'a', 4, CaseSensitive.no))); -+ assert(lastIndexOf(to!S("def"), 'F', 3, CaseSensitive.no) == 2); -+ -+ S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; -+ -+ assert(lastIndexOf(to!S("def"), 'f', 4, CaseSensitive.no) == -1); -+ assert(lastIndexOf(sPlts, 'M', sPlts.length -2, CaseSensitive.no) == 34); -+ assert(lastIndexOf(sPlts, 'S', sPlts.length -2, CaseSensitive.no) == 40); -+ } -+ - foreach(cs; EnumMembers!CaseSensitive) - { - assert(lastIndexOf("\U00010143\u0100\U00010143hello", '\u0100', cs) == 4); -@@ -593,31 +730,46 @@ unittest - ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, - const(Char2)[] sub, - CaseSensitive cs = CaseSensitive.yes) -- if(isSomeChar!Char1 && isSomeChar!Char2) -+ if (isSomeChar!Char1 && isSomeChar!Char2) - { -- if(sub.empty) -+ if (sub.empty) - return s.length; - -- if(walkLength(sub) == 1) -+ if (walkLength(sub) == 1) - return lastIndexOf(s, sub.front, cs); - -- if(cs == CaseSensitive.yes) -+ if (cs == CaseSensitive.yes) - { -- static if(is(Unqual!Char1 == Unqual!Char2)) -+ static if (is(Unqual!Char1 == Unqual!Char2)) - { - immutable c = sub[0]; - -- for(ptrdiff_t i = s.length - sub.length; i >= 0; --i) -+ for (ptrdiff_t i = s.length - sub.length; i >= 0; --i) - { -- if(s[i] == c && memcmp(&s[i + 1], &sub[1], sub.length - 1) == 0) -- return i; -+ if (s[i] == c) -+ { -+ if (__ctfe) -+ { -+ foreach (j; 1 .. sub.length) -+ { -+ if (s[i + j] != sub[j]) -+ continue; -+ } -+ return i; -+ } -+ else -+ { -+ if (memcmp(&s[i + 1], &sub[1], sub.length - 1) == 0) -+ return i; -+ } -+ } - } - } - else - { -- for(size_t i = s.length; !s.empty;) -+ for (size_t i = s.length; !s.empty;) - { -- if(s.endsWith(sub)) -+ if (s.endsWith(sub)) - return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length; - - i -= strideBack(s, i); -@@ -627,10 +779,10 @@ ptrdiff_t lastIndexOf(Char1, Char2)(cons - } - else - { -- for(size_t i = s.length; !s.empty;) -+ for (size_t i = s.length; !s.empty;) - { -- if(endsWith!((dchar a, dchar b) {return std.uni.toLower(a) == std.uni.toLower(b);}) -- (s, sub)) -+ if (endsWith!((a, b) => std.uni.toLower(a) == std.uni.toLower(b)) -+ (s, sub)) - { - return cast(ptrdiff_t)i - to!(const(Char1)[])(sub).length; - } -@@ -647,9 +799,11 @@ unittest - { - debug(string) printf("string.lastIndexOf.unittest\n"); - -- foreach(S; TypeTuple!(string, wstring, dstring)) -+ assertCTFEable!( - { -- foreach(T; TypeTuple!(string, wstring, dstring)) -+ foreach (S; TypeTuple!(string, wstring, dstring)) -+ { -+ foreach (T; TypeTuple!(string, wstring, dstring)) - { - enum typeStr = S.stringof ~ " " ~ T.stringof; - -@@ -662,6 +816,7 @@ unittest - assert(lastIndexOf(to!S("abcdefcdef"), to!T("x")) == -1, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy")) == -1, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T("")) == 10, typeStr); -+ assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö")) == 0, typeStr); - - assert(lastIndexOf(cast(S)null, to!T("a"), CaseSensitive.no) == -1, typeStr); - assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), CaseSensitive.no) == 6, typeStr); -@@ -669,11 +824,14 @@ unittest - assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"), CaseSensitive.no) == -1, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T("xy"), CaseSensitive.no) == -1, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), CaseSensitive.no) == 10, typeStr); -+ assert(lastIndexOf(to!S("öabcdefcdef"), to!T("ö"), CaseSensitive.no) == 0, typeStr); - - assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), CaseSensitive.no) == 6, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), CaseSensitive.no) == 6, typeStr); - assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), CaseSensitive.no) == 7, typeStr); - -+ assert(lastIndexOf(to!S("ödfeffgfff"), to!T("ö"), CaseSensitive.yes) == 0); -+ - S sPlts = "Mars: the fourth Rock (Planet) from the Sun."; - S sMars = "Who\'s \'My Favorite Maritian?\'"; - -@@ -683,7 +841,7 @@ unittest - assert(lastIndexOf(sMars, to!T(sMars), CaseSensitive.no) == 0, typeStr); - } - -- foreach(cs; EnumMembers!CaseSensitive) -+ foreach (cs; EnumMembers!CaseSensitive) - { - enum csString = to!string(cs); - -@@ -692,6 +850,77 @@ unittest - assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), cs) == 1, csString); - } - } -+ }); -+} -+ -+/++ -+ Returns the index of the last occurence of $(D sub) in $(D s). If $(D sub) -+ is not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in -+ the following way $(D s[0 .. startIdx]). $(D startIdx) represents a -+ codeunit index in $(D s). If the sequence ending at $(D startIdx) does not -+ represent a well formed codepoint, then a $(XREF utf,UTFException) may be -+ thrown. -+ -+ $(D cs) indicates whether the comparisons are case sensitive. -+ +/ -+ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, -+ const size_t startIdx, CaseSensitive cs = CaseSensitive.yes) -+ if (isSomeChar!Char1 && isSomeChar!Char2) -+{ -+ if (startIdx <= s.length) -+ { -+ return lastIndexOf(s[0u .. startIdx], sub, cs); -+ } -+ -+ return -1; -+} -+ -+unittest -+{ -+ debug(string) printf("string.lastIndexOf.unittest\n"); -+ -+ foreach(S; TypeTuple!(string, wstring, dstring)) -+ { -+ foreach(T; TypeTuple!(string, wstring, dstring)) -+ { -+ enum typeStr = S.stringof ~ " " ~ T.stringof; -+ -+ assert(lastIndexOf(cast(S)null, to!T("a")) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 5) == 2, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 3) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6) == 4, typeStr ~ -+ format(" %u", lastIndexOf(to!S("abcdefcdef"), to!T("ef"), 6))); -+ assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5) == 2, typeStr); -+ assert(lastIndexOf(to!S("abcdefCdef"), to!T("cd"), 3) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdefx"), to!T("x"), 1) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdefxy"), to!T("xy"), 6) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 8) == 8, typeStr); -+ assert(lastIndexOf(to!S("öafö"), to!T("ö"), 3) == 0, typeStr ~ -+ to!string(lastIndexOf(to!S("öafö"), to!T("ö"), 3))); //BUG 10472 -+ -+ assert(lastIndexOf(cast(S)null, to!T("a"), 1, CaseSensitive.no) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefCdef"), to!T("c"), 5, CaseSensitive.no) == 2, typeStr); -+ assert(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 4, CaseSensitive.no) == 2, typeStr ~ -+ " " ~ to!string(lastIndexOf(to!S("abcdefCdef"), to!T("cD"), 3, CaseSensitive.no))); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("x"),3 , CaseSensitive.no) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdefXY"), to!T("xy"), 4, CaseSensitive.no) == -1, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T(""), 7, CaseSensitive.no) == 7, typeStr); -+ -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("c"), 4, CaseSensitive.no) == 2, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("cd"), 4, CaseSensitive.no) == 2, typeStr); -+ assert(lastIndexOf(to!S("abcdefcdef"), to!T("def"), 6, CaseSensitive.no) == 3, typeStr); -+ assert(lastIndexOf(to!S(""), to!T(""), 0) == lastIndexOf(to!S(""), to!T("")), typeStr); -+ } -+ -+ foreach(cs; EnumMembers!CaseSensitive) -+ { -+ enum csString = to!string(cs); -+ -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello", to!S("\u0100"), 6, cs) == 4, csString); -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello"w, to!S("\u0100"), 6, cs) == 2, csString); -+ assert(lastIndexOf("\U00010143\u0100\U00010143hello"d, to!S("\u0100"), 3, cs) == 1, csString); -+ } -+ } - } - - -@@ -699,36 +928,32 @@ unittest - * Returns the representation of a string, which has the same type - * as the string except the character type is replaced by $(D ubyte), - * $(D ushort), or $(D uint) depending on the character width. -- * -- * Example: ------ --string s = "hello"; --static assert(is(typeof(representation(s)) == immutable(ubyte)[])); --assert(representation(s) is cast(immutable(ubyte)[]) s); --assert(representation(s) == [0x68, 0x65, 0x6c, 0x6c, 0x6f]); ------ - */ - auto representation(Char)(Char[] s) pure nothrow -- if(isSomeChar!Char) -+ if (isSomeChar!Char) - { - // Get representation type - alias TypeTuple!(ubyte, ushort, uint)[Char.sizeof / 2] U; - - // const and immutable storage classes -- static if (is(Char == immutable)) alias immutable(U) T; -- else static if (is(Char == const)) alias const(U) T; -- else alias U T; -+ static if (is(Char == immutable)) -+ alias T = immutable(U); -+ else static if (is(Char == const)) -+ alias T = const(U); -+ else -+ alias T = U; - - // shared storage class (because shared(const(T)) is possible) -- static if (is(Char == shared)) alias shared(T) ST; -- else alias T ST; -+ static if (is(Char == shared)) -+ alias ST = shared(T); -+ else -+ alias ST = T; - - return cast(ST[]) s; - } -- -+/// - unittest - { -- //test example - string s = "hello"; - static assert(is(typeof(representation(s)) == immutable(ubyte)[])); - assert(representation(s) is cast(immutable(ubyte)[]) s); -@@ -736,370 +961,87 @@ unittest - } - unittest - { -+ assertCTFEable!( -+ { - void test(Char, T)(Char[] str) - { - static assert(is(typeof(representation(str)) == T[])); - assert(representation(str) is cast(T[]) str); - } - -- foreach(Type; TypeTuple!(Tuple!(char , ubyte ), -- Tuple!(wchar, ushort), -- Tuple!(dchar, uint ))) -+ foreach (Type; TypeTuple!(Tuple!(char , ubyte ), -+ Tuple!(wchar, ushort), -+ Tuple!(dchar, uint ))) - { - alias Char = FieldTypeTuple!Type[0]; - alias Int = FieldTypeTuple!Type[1]; - enum immutable(Char)[] hello = "hello"; - -- test!( immutable(Char) , immutable(Int) )(hello); -- test!( const(Char) , const(Int) )(hello); -- test!( Char , Int )(hello.dup); -- test!( shared(Char) , shared(Int) )(cast(shared) hello.dup); -- test!(const(shared(Char)), const(shared(Int)))(hello); -+ test!( immutable Char, immutable Int)(hello); -+ test!( const Char, const Int)(hello); -+ test!( Char, Int)(hello.dup); -+ test!( shared Char, shared Int)(cast(shared) hello.dup); -+ test!(const shared Char, const shared Int)(hello); - } -+ }); - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.toLower instead.") S tolower(S)(S s) if (isSomeString!S) --{ -- return toLower!S(s); --} -- - /++ - Returns a string which is identical to $(D s) except that all of its -- characters are lowercase (in unicode, not just ASCII). If $(D s) does not -- have any uppercase characters, then $(D s) is returned. -+ characters are converted to lowercase (by preforming Unicode lowercase mapping). -+ If none of $(D s) characters were affected, then $(D s) itself is returned. - +/ --S toLower(S)(S s) @trusted pure -- if(isSomeString!S) --{ -- foreach (i, dchar cOuter; s) -- { -- if (!std.uni.isUpper(cOuter)) continue; -- auto result = s[0.. i].dup; -- foreach (dchar c; s[i .. $]) -- { -- if (std.uni.isUpper(c)) -- { -- c = std.uni.toLower(c); -- } -- result ~= c; -- } -- return cast(S) result; -- } -- return s; --} -- --unittest --{ -- debug(string) printf("string.toLower.unittest\n"); -- -- foreach(S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[])) -- { -- S s = cast(S)"hello world\u0101"; -- assert(toLower(s) is s); -- const S sc = "hello world\u0101"; -- assert(toLower(sc) is sc); -- immutable S si = "hello world\u0101"; -- assert(toLower(si) is si); -- -- S t = cast(S)"Hello World\u0100"; -- assert(toLower(t) == s); -- const S tc = "hello world\u0101"; -- assert(toLower(tc) == s); -- immutable S ti = "hello world\u0101"; -- assert(toLower(ti) == s); -- } --} -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.toLowerInPlace instead.") void tolowerInPlace(C)(ref C[] s) if (isSomeChar!C) --{ -- toLowerInPlace!C(s); --} -- -+alias toLower = std.uni.toLower; - /++ -- Converts $(D s) to lowercase (in unicode, not just ASCII) in place. -+ Converts $(D s) to lowercase (by performing Unicode lowercase mapping) in place. -+ For a few characters string length may increase after the transformation, -+ in such a case the function reallocates exactly once. - If $(D s) does not have any uppercase characters, then $(D s) is unaltered. - +/ --void toLowerInPlace(C)(ref C[] s) -- if(is(C == char) || is(C == wchar)) --{ -- for (size_t i = 0; i < s.length; ) -- { -- immutable c = s[i]; -- if (std.ascii.isUpper(c)) -- { -- s[i++] = cast(C) (c + (cast(C)'a' - 'A')); -- } -- else if (!std.ascii.isASCII(c)) -- { -- // wide character -- size_t j = i; -- dchar dc = decode(s, j); -- assert(j > i); -- if (!std.uni.isUpper(dc)) -- { -- i = j; -- continue; -- } -- auto toAdd = to!(C[])(std.uni.toLower(dc)); -- s = s[0 .. i] ~ toAdd ~ s[j .. $]; -- i += toAdd.length; -- } -- else -- { -- ++i; -- } -- } --} -- --void toLowerInPlace(C)(ref C[] s) @safe pure nothrow -- if(is(C == dchar)) --{ -- foreach(ref c; s) -- { -- if(std.uni.isUpper(c)) -- c = std.uni.toLower(c); -- } --} -- --unittest --{ -- debug(string) printf("string.toLowerInPlace.unittest\n"); -- -- foreach(S; TypeTuple!(char[], wchar[], dchar[])) -- { -- S s = to!S("hello world\u0101"); -- toLowerInPlace(s); -- assert(s == "hello world\u0101"); -- -- S t = to!S("Hello World\u0100"); -- toLowerInPlace(t); -- assert(t == "hello world\u0101"); -- } --} -- --unittest --{ -- debug(string) printf("string.toLower/toLowerInPlace.unittest\n"); -- -- string s1 = "FoL"; -- string s2 = toLower(s1); -- assert(cmp(s2, "fol") == 0, s2); -- assert(s2 != s1); -- -- char[] s3 = s1.dup; -- toLowerInPlace(s3); -- assert(s3 == s2, s3); -- -- s1 = "A\u0100B\u0101d"; -- s2 = toLower(s1); -- s3 = s1.dup; -- assert(cmp(s2, "a\u0101b\u0101d") == 0); -- assert(s2 !is s1); -- toLowerInPlace(s3); -- assert(s3 == s2, s3); -- -- s1 = "A\u0460B\u0461d"; -- s2 = toLower(s1); -- s3 = s1.dup; -- assert(cmp(s2, "a\u0461b\u0461d") == 0); -- assert(s2 !is s1); -- toLowerInPlace(s3); -- assert(s3 == s2, s3); -- -- s1 = "\u0130"; -- s2 = toLower(s1); -- s3 = s1.dup; -- assert(s2 == "i"); -- assert(s2 !is s1); -- toLowerInPlace(s3); -- assert(s3 == s2, s3); -- -- // Test on wchar and dchar strings. -- assert(toLower("Some String"w) == "some string"w); -- assert(toLower("Some String"d) == "some string"d); --} -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.toUpper instead.") S toupper(S)(S s) if (isSomeString!S) --{ -- return toUpper!S(s); --} -+alias toLowerInPlace = std.uni.toLowerInPlace; - - /++ - Returns a string which is identical to $(D s) except that all of its -- characters are uppercase (in unicode, not just ASCII). If $(D s) does not -- have any lowercase characters, then $(D s) is returned. -+ characters are converted to uppercase (by preforming Unicode uppercase mapping). -+ If none of $(D s) characters were affected, then $(D s) itself is returned. - +/ --S toUpper(S)(S s) @trusted pure -- if(isSomeString!S) --{ -- foreach (i, dchar cOuter; s) -- { -- if (!std.uni.isLower(cOuter)) continue; -- auto result = s[0.. i].dup; -- foreach (dchar c; s[i .. $]) -- { -- if (std.uni.isLower(c)) -- { -- c = std.uni.toUpper(c); -- } -- result ~= c; -- } -- return cast(S) result; -- } -- return s; --} -- --unittest --{ -- debug(string) printf("string.toUpper.unittest\n"); -- -- foreach(S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[])) -- { -- S s = cast(S)"HELLO WORLD\u0100"; -- assert(toUpper(s) is s); -- const S sc = "HELLO WORLD\u0100"; -- assert(toUpper(sc) is sc); -- immutable S si = "HELLO WORLD\u0100"; -- assert(toUpper(si) is si); -- -- S t = cast(S)"hello world\u0101"; -- assert(toUpper(t) == s); -- const S tc = "HELLO WORLD\u0100"; -- assert(toUpper(tc) == s); -- immutable S ti = "HELLO WORLD\u0100"; -- assert(toUpper(ti) == s); -- } --} -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.toUpperInPlace instead.") void toupperInPlace(C)(ref C[] s) if (isSomeChar!C) --{ -- toUpperInPlace!C(s); --} -+alias toUpper = std.uni.toUpper; - - /++ -- Converts $(D s) to uppercase (in unicode, not just ASCII) in place. -+ Converts $(D s) to uppercase (by performing Unicode uppercase mapping) in place. -+ For a few characters string length may increase after the transformation, -+ in such a case the function reallocates exactly once. - If $(D s) does not have any lowercase characters, then $(D s) is unaltered. - +/ --void toUpperInPlace(C)(ref C[] s) -- if(isSomeChar!C && -- (is(C == char) || is(C == wchar))) --{ -- for (size_t i = 0; i < s.length; ) -- { -- immutable c = s[i]; -- if ('a' <= c && c <= 'z') -- { -- s[i++] = cast(C) (c - (cast(C)'a' - 'A')); -- } -- else if (!std.ascii.isASCII(c)) -- { -- // wide character -- size_t j = i; -- dchar dc = decode(s, j); -- assert(j > i); -- if (!std.uni.isLower(dc)) -- { -- i = j; -- continue; -- } -- auto toAdd = to!(C[])(std.uni.toUpper(dc)); -- s = s[0 .. i] ~ toAdd ~ s[j .. $]; -- i += toAdd.length; -- } -- else -- { -- ++i; -- } -- } --} -- --void toUpperInPlace(C)(ref C[] s) @safe pure nothrow -- if(is(C == dchar)) --{ -- foreach(ref c; s) -- { -- if(std.uni.isLower(c)) -- c = std.uni.toUpper(c); -- } --} -- --unittest --{ -- debug(string) printf("string.toUpperInPlace.unittest\n"); -- -- foreach(S; TypeTuple!(char[], wchar[], dchar[])) -- { -- S s = to!S("HELLO WORLD\u0100"); -- toUpperInPlace(s); -- assert(s == "HELLO WORLD\u0100"); -- -- S t = to!S("Hello World\u0101"); -- toUpperInPlace(t); -- assert(t == "HELLO WORLD\u0100"); -- } --} -- --unittest --{ -- debug(string) printf("string.toUpper/toUpperInPlace.unittest\n"); -- -- string s1 = "FoL"; -- string s2; -- char[] s3; -- -- s2 = toUpper(s1); -- s3 = s1.dup; toUpperInPlace(s3); -- assert(s3 == s2, s3); -- assert(cmp(s2, "FOL") == 0); -- assert(s2 !is s1); -- -- s1 = "a\u0100B\u0101d"; -- s2 = toUpper(s1); -- s3 = s1.dup; toUpperInPlace(s3); -- assert(s3 == s2); -- assert(cmp(s2, "A\u0100B\u0100D") == 0); -- assert(s2 !is s1); -- -- s1 = "a\u0460B\u0461d"; -- s2 = toUpper(s1); -- s3 = s1.dup; toUpperInPlace(s3); -- assert(s3 == s2); -- assert(cmp(s2, "A\u0460B\u0460D") == 0); -- assert(s2 !is s1); --} -- -+alias toUpperInPlace = std.uni.toUpperInPlace; - - /++ -- Capitalize the first character of $(D s) and conver the rest of $(D s) -+ Capitalize the first character of $(D s) and convert the rest of $(D s) - to lowercase. - +/ - S capitalize(S)(S s) @trusted pure -- if(isSomeString!S) -+ if (isSomeString!S) - { - Unqual!(typeof(s[0]))[] retval; - bool changed = false; - -- foreach(i, dchar c; s) -+ foreach (i, dchar c; s) - { - dchar c2; - -- if(i == 0) -+ if (i == 0) - { - c2 = std.uni.toUpper(c); -- if(c != c2) -+ if (c != c2) - changed = true; - } - else - { - c2 = std.uni.toLower(c); -- if(c != c2) -+ if (c != c2) - { -- if(!changed) -+ if (!changed) - { - changed = true; - retval = s[0 .. i].dup; -@@ -1107,7 +1049,7 @@ S capitalize(S)(S s) @trusted pure - } - } - -- if(changed) -+ if (changed) - std.utf.encode(retval, c2); - } - -@@ -1116,8 +1058,8 @@ S capitalize(S)(S s) @trusted pure - - unittest - { -- debug(string) printf("string.capitalize.unittest\n"); -- -+ assertCTFEable!( -+ { - foreach (S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[])) - { - S s1 = to!S("FoL"); -@@ -1135,10 +1077,9 @@ unittest - s2 = capitalize(s1); - assert(cmp(s2, "Fol") == 0); - assert(s2 !is s1); -- - s1 = to!S("\u0131 \u0130"); - s2 = capitalize(s1); -- assert(cmp(s2, "\u0049 \u0069") == 0); -+ assert(cmp(s2, "I \u0130") == 0); - assert(s2 !is s1); - - s1 = to!S("\u017F \u0049"); -@@ -1146,75 +1087,7 @@ unittest - assert(cmp(s2, "\u0053 \u0069") == 0); - assert(s2 !is s1); - } --} -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated S capwords(S)(S s) if (isSomeString!S) --{ -- alias typeof(s[0]) C; -- auto retval = appender!(C[])(); -- bool inWord = false; -- size_t wordStart = 0; -- -- foreach(i, dchar c; s) -- { -- if(std.uni.isWhite(s[i])) -- { -- if(inWord) -- { -- retval.put(capitalize(s[wordStart .. i])); -- inWord = false; -- } -- } -- else if(!inWord) -- { -- if(!retval.data.empty) -- retval.put(' '); -- -- wordStart = i; -- inWord = true; -- } -- } -- -- if(inWord) -- retval.put(capitalize(s[wordStart .. $])); -- -- return cast(S)retval.data; --} -- --deprecated unittest --{ -- debug(string) printf("string.capwords.unittest\n"); -- -- foreach (S; TypeTuple!(string, wstring, dstring, char[], wchar[], dchar[])) -- { -- auto s1 = to!S("\tfoo abc(aD)* \t (q PTT "); -- S s2; -- -- s2 = capwords(s1); -- assert(cmp(s2, "Foo Abc(ad)* (q Ptt") == 0); -- -- s1 = to!S("\u0430\u0411\u0544 \uFF48elLO\u00A0\u0131\u0053\u0049\u017F " ~ -- "\u017F\u0053\u0131\u0130"); -- s2 = capwords(s1); -- assert(cmp(s2, "\u0410\u0431\u0574 \uFF28ello\u00A0\u0049\u0073\u0069\u017F " ~ -- "\u0053\u0053\u0131\u0069")); -- } --} -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.array.replicate instead.") S repeat(S)(S s, size_t n) --{ -- return std.array.replicate(s, n); --} -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.splitLines instead.") S[] splitlines(S)(S s) --{ -- return splitLines!S(s); -+ }); - } - - /++ -@@ -1225,23 +1098,23 @@ deprecated("Please use std.string.splitL - +/ - enum KeepTerminator : bool { no, yes } - /// ditto --S[] splitLines(S)(S s, KeepTerminator keepTerm = KeepTerminator.no) -- if(isSomeString!S) -+S[] splitLines(S)(S s, KeepTerminator keepTerm = KeepTerminator.no) @safe pure -+ if (isSomeString!S) - { - size_t iStart = 0; - size_t nextI = 0; - auto retval = appender!(S[])(); - -- for(size_t i; i < s.length; i = nextI) -+ for (size_t i; i < s.length; i = nextI) - { - immutable c = decode(s, nextI); - -- if(c == '\r' || c == '\n' || c == lineSep || c == paraSep) -+ if (c == '\r' || c == '\n' || c == lineSep || c == paraSep) - { - immutable isWinEOL = c == '\r' && i + 1 < s.length && s[i + 1] == '\n'; - auto iEnd = i; - -- if(keepTerm == KeepTerminator.yes) -+ if (keepTerm == KeepTerminator.yes) - { - iEnd = isWinEOL? nextI + 1 : nextI; - } -@@ -1249,7 +1122,7 @@ S[] splitLines(S)(S s, KeepTerminator ke - retval.put(s[iStart .. iEnd]); - iStart = nextI; - -- if(isWinEOL) -+ if (isWinEOL) - { - ++nextI; - ++iStart; -@@ -1257,7 +1130,7 @@ S[] splitLines(S)(S s, KeepTerminator ke - } - } - -- if(iStart != nextI) -+ if (iStart != nextI) - retval.put(s[iStart .. $]); - - return retval.data; -@@ -1267,6 +1140,8 @@ unittest - { - debug(string) printf("string.splitLines.unittest\n"); - -+ assertCTFEable!( -+ { - foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - auto s = to!S("\rpeter\n\rpaul\r\njerry\u2028ice\u2029cream\n\nsunday\n"); -@@ -1304,46 +1179,27 @@ unittest - assert(lines.length == 9); - assert(lines[8] == "sunday"); - } -+ }); - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.stripLeft instead.") String stripl(String)(String s) --{ -- return stripLeft!String(s); --} -- - /++ - Strips leading whitespace. -- -- Examples: ---------------------- --assert(stripLeft(" hello world ") == -- "hello world "); --assert(stripLeft("\n\t\v\rhello world\n\t\v\r") == -- "hello world\n\t\v\r"); --assert(stripLeft("hello world") == -- "hello world"); --assert(stripLeft([lineSep] ~ "hello world" ~ lineSep) == -- "hello world" ~ [lineSep]); --assert(stripLeft([paraSep] ~ "hello world" ~ paraSep) == -- "hello world" ~ [paraSep]); ---------------------- - +/ - C[] stripLeft(C)(C[] str) @safe pure -- if(isSomeChar!C) -+ if (isSomeChar!C) - { -- foreach(i, dchar c; str) -+ foreach (i, dchar c; str) - { -- if(!std.uni.isWhite(c)) -+ if (!std.uni.isWhite(c)) - return str[i .. $]; - } - - return str[$ .. $]; //Empty string with correct type. - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(stripLeft(" hello world ") == - "hello world "); -@@ -1358,43 +1214,23 @@ unittest - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.stripRight instead.") String stripr(String)(String s) --{ -- return stripRight!String(s); --} -- - /++ - Strips trailing whitespace. -- -- Examples: ---------------------- --assert(stripRight(" hello world ") == -- " hello world"); --assert(stripRight("\n\t\v\rhello world\n\t\v\r") == -- "\n\t\v\rhello world"); --assert(stripRight("hello world") == -- "hello world"); --assert(stripRight([lineSep] ~ "hello world" ~ lineSep) == -- [lineSep] ~ "hello world"); --assert(stripRight([paraSep] ~ "hello world" ~ paraSep) == -- [paraSep] ~ "hello world"); ---------------------- - +/ --C[] stripRight(C)(C[] str) -- if(isSomeChar!C) -+C[] stripRight(C)(C[] str) @safe pure -+ if (isSomeChar!C) - { -- foreach_reverse(i, dchar c; str) -+ foreach_reverse (i, dchar c; str) - { -- if(!std.uni.isWhite(c)) -+ if (!std.uni.isWhite(c)) - return str[0 .. i + codeLength!C(c)]; - } - - return str[0 .. 0]; - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(stripRight(" hello world ") == - " hello world"); -@@ -1411,29 +1247,15 @@ unittest - - /++ - Strips both leading and trailing whitespace. -- -- Examples: ---------------------- --assert(strip(" hello world ") == -- "hello world"); --assert(strip("\n\t\v\rhello world\n\t\v\r") == -- "hello world"); --assert(strip("hello world") == -- "hello world"); --assert(strip([lineSep] ~ "hello world" ~ [lineSep]) == -- "hello world"); --assert(strip([paraSep] ~ "hello world" ~ [paraSep]) == -- "hello world"); ---------------------- - +/ --C[] strip(C)(C[] str) -- if(isSomeChar!C) -+C[] strip(C)(C[] str) @safe pure -+ if (isSomeChar!C) - { - return stripRight(stripLeft(str)); - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(strip(" hello world ") == - "hello world"); -@@ -1451,9 +1273,11 @@ unittest - { - debug(string) printf("string.strip.unittest\n"); - -- foreach(S; TypeTuple!(char[], const char[], string, -- wchar[], const wchar[], wstring, -- dchar[], const dchar[], dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!( char[], const char[], string, -+ wchar[], const wchar[], wstring, -+ dchar[], const dchar[], dstring)) - { - assert(equal(stripLeft(to!S(" foo\t ")), "foo\t ")); - assert(equal(stripLeft(to!S("\u2008 foo\t \u2007")), "foo\t \u2007")); -@@ -1475,13 +1299,17 @@ unittest - assert(equal(strip(to!S("\U0010FFFE")), "\U0010FFFE")); - assert(equal(strip(to!S("")), "")); - } -+ }); - } - --unittest -+@safe pure unittest - { -+ assertCTFEable!( -+ { - wstring s = " "; - assert(s.sameTail(s.stripLeft())); - assert(s.sameHead(s.stripRight())); -+ }); - } - - -@@ -1494,34 +1322,18 @@ unittest - $(D "\r\n"), $(XREF uni, lineSep), or $(XREF uni, paraSep) is removed from - the end of $(D str). If $(D str) does not end with any of those characters, - then it is returned unchanged. -- -- Examples: ---------------------- --assert(chomp(" hello world \n\r") == " hello world \n"); --assert(chomp(" hello world \r\n") == " hello world "); --assert(chomp(" hello world \n\n") == " hello world \n"); --assert(chomp(" hello world \n\n ") == " hello world \n\n "); --assert(chomp(" hello world \n\n" ~ [lineSep]) == " hello world \n\n"); --assert(chomp(" hello world \n\n" ~ [paraSep]) == " hello world \n\n"); --assert(chomp(" hello world") == " hello world"); --assert(chomp("") == ""); -- --assert(chomp(" hello world", "orld") == " hello w"); --assert(chomp(" hello world", " he") == " hello world"); --assert(chomp("", "hello") == ""); ---------------------- - +/ --C[] chomp(C)(C[] str) -- if(isSomeChar!C) -+C[] chomp(C)(C[] str) @safe pure -+ if (isSomeChar!C) - { -- if(str.empty) -+ if (str.empty) - return str; - -- switch(str[$ - 1]) -+ switch (str[$ - 1]) - { - case '\n': - { -- if(str.length > 1 && str[$ - 2] == '\r') -+ if (str.length > 1 && str[$ - 2] == '\r') - return str[0 .. $ - 2]; - goto case; - } -@@ -1529,14 +1341,14 @@ C[] chomp(C)(C[] str) - return str[0 .. $ - 1]; - - //Pops off the last character if it's lineSep or paraSep. -- static if(is(C : const char)) -+ static if (is(C : const char)) - { - //In UTF-8, lineSep and paraSep are [226, 128, 168], and - //[226, 128, 169] respectively, so their first two bytes are the same. - case 168: //Last byte of lineSep - case 169: //Last byte of paraSep - { -- if(str.length > 2 && str[$ - 2] == 128 && str[$ - 3] == 226) -+ if (str.length > 2 && str[$ - 2] == 128 && str[$ - 3] == 226) - return str [0 .. $ - 3]; - goto default; - } -@@ -1553,23 +1365,23 @@ C[] chomp(C)(C[] str) - } - - /// Ditto --C1[] chomp(C1, C2)(C1[] str, const(C2)[] delimiter) -- if(isSomeChar!C1 && isSomeChar!C2) -+C1[] chomp(C1, C2)(C1[] str, const(C2)[] delimiter) @safe pure -+ if (isSomeChar!C1 && isSomeChar!C2) - { -- if(delimiter.empty) -+ if (delimiter.empty) - return chomp(str); - -- static if(is(Unqual!C1 == Unqual!C2)) -+ static if (is(Unqual!C1 == Unqual!C2)) - { -- if(str.endsWith(delimiter)) -+ if (str.endsWith(delimiter)) - return str[0 .. $ - delimiter.length]; - } - - auto orig = str; - -- foreach_reverse(dchar c; delimiter) -+ foreach_reverse (dchar c; delimiter) - { -- if(str.empty || str.back != c) -+ if (str.empty || str.back != c) - return orig; - - str.popBack(); -@@ -1578,8 +1390,8 @@ C1[] chomp(C1, C2)(C1[] str, const(C2)[] - return str; - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(chomp(" hello world \n\r") == " hello world \n"); - assert(chomp(" hello world \r\n") == " hello world "); -@@ -1600,7 +1412,9 @@ unittest - debug(string) printf("string.chomp.unittest\n"); - string s; - -- foreach(S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - // @@@ BUG IN COMPILER, MUST INSERT CAST - assert(chomp(cast(S)null) is null); -@@ -1617,7 +1431,7 @@ unittest - assert(chomp(to!S("hello\u2028\u2028")) == "hello\u2028"); - assert(chomp(to!S("hello\u2029\u2029")) == "hello\u2029"); - -- foreach(T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ foreach (T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - // @@@ BUG IN COMPILER, MUST INSERT CAST - assert(chomp(cast(S)null, cast(T)null) is null); -@@ -1631,6 +1445,7 @@ unittest - assert(chomp(to!S("\uFF28el\uFF4co"), to!T("l\uFF4co")) == "\uFF28e"); - } - } -+ }); - } - - -@@ -1638,21 +1453,13 @@ unittest - If $(D str) starts with $(D delimiter), then the part of $(D str) following - $(D delimiter) is returned. If it $(D str) does $(I not) start with - $(D delimiter), then it is returned unchanged. -- -- Examples: ---------------------- --assert(chompPrefix("hello world", "he") == "llo world"); --assert(chompPrefix("hello world", "hello w") == "orld"); --assert(chompPrefix("hello world", " world") == "hello world"); --assert(chompPrefix("", "hello") == ""); ---------------------- - +/ --C1[] chompPrefix(C1, C2)(C1[] str, C2[] delimiter) -- if(isSomeChar!C1 && isSomeChar!C2) -+C1[] chompPrefix(C1, C2)(C1[] str, C2[] delimiter) @safe pure -+ if (isSomeChar!C1 && isSomeChar!C2) - { -- static if(is(Unqual!C1 == Unqual!C2)) -+ static if (is(Unqual!C1 == Unqual!C2)) - { -- if(str.startsWith(delimiter)) -+ if (str.startsWith(delimiter)) - return str[delimiter.length .. $]; - return str; - } -@@ -1661,9 +1468,9 @@ C1[] chompPrefix(C1, C2)(C1[] str, C2[] - auto orig = str; - size_t index = 0; - -- foreach(dchar c; delimiter) -+ foreach (dchar c; delimiter) - { -- if(index >= str.length || decode(str, index) != c) -+ if (index >= str.length || decode(str, index) != c) - return orig; - } - -@@ -1671,8 +1478,8 @@ C1[] chompPrefix(C1, C2)(C1[] str, C2[] - } - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(chompPrefix("hello world", "he") == "llo world"); - assert(chompPrefix("hello world", "hello w") == "orld"); -@@ -1680,11 +1487,13 @@ unittest - assert(chompPrefix("", "hello") == ""); - } - --unittest -+/* @safe */ pure unittest - { -- foreach(S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ assertCTFEable!( - { -- foreach(T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ { -+ foreach (T; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - assert(equal(chompPrefix(to!S("abcdefgh"), to!T("abcde")), "fgh")); - assert(equal(chompPrefix(to!S("abcde"), to!T("abcdefgh")), "abcde")); -@@ -1693,6 +1502,7 @@ unittest - assert(equal(chompPrefix(to!S("\uFF28el"), to!T("\uFF28el\uFF4co")), "\uFF28el")); - } - } -+ }); - } - - -@@ -1700,25 +1510,14 @@ unittest - Returns $(D str) without its last character, if there is one. If $(D str) - ends with $(D "\r\n"), then both are removed. If $(D str) is empty, then - then it is returned unchanged. -- -- Examples: ---------------------- --assert(chop("hello world") == "hello worl"); --assert(chop("hello world\n") == "hello world"); --assert(chop("hello world\r") == "hello world"); --assert(chop("hello world\n\r") == "hello world\n"); --assert(chop("hello world\r\n") == "hello world"); --assert(chop("Walter Bright") == "Walter Brigh"); --assert(chop("") == ""); ---------------------- - +/ --S chop(S)(S str) -- if(isSomeString!S) -+S chop(S)(S str) @safe pure -+ if (isSomeString!S) - { -- if(str.empty) -+ if (str.empty) - return str; - -- if(str.length >= 2 && str[$ - 1] == '\n' && str[$ - 2] == '\r') -+ if (str.length >= 2 && str[$ - 1] == '\n' && str[$ - 2] == '\r') - return str[0 .. $ - 2]; - - str.popBack(); -@@ -1726,8 +1525,8 @@ S chop(S)(S str) - return str; - } - --//Verify Example. --unittest -+/// -+@safe pure unittest - { - assert(chop("hello world") == "hello worl"); - assert(chop("hello world\n") == "hello world"); -@@ -1742,7 +1541,9 @@ unittest - { - debug(string) printf("string.chop.unittest\n"); - -- foreach(S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - assert(chop(cast(S) null) is null); - assert(equal(chop(to!S("hello")), "hell")); -@@ -1752,29 +1553,24 @@ unittest - assert(equal(chop(to!S(`さいごの果実`)), "さいごの果")); - assert(equal(chop(to!S(`ミツバチと科学者`)), "ミツバチと科学")); - } -+ }); - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.leftJustify instead.") S ljustify(S)(S s, size_t width) if (isSomeString!S) --{ -- return leftJustify!S(s, width); --} -- - /++ - Left justify $(D s) in a field $(D width) characters wide. $(D fillChar) - is the character that will be used to fill up the space in the field that - $(D s) doesn't fill. - +/ --S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted -- if(isSomeString!S) -+S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure -+ if (isSomeString!S) - { - alias typeof(s[0]) C; - -- if(cast(dchar)(cast(C)fillChar) == fillChar) -+ if (cast(dchar)(cast(C)fillChar) == fillChar) - { - immutable len = s.walkLength(); -- if(len >= width) -+ if (len >= width) - return s; - - auto retval = new Unqual!(C)[width - len + s.length]; -@@ -1785,7 +1581,7 @@ S leftJustify(S)(S s, size_t width, dcha - else - { - auto dstr = to!dstring(s); -- if(dstr.length >= width) -+ if (dstr.length >= width) - return s; - - auto retval = new dchar[](width); -@@ -1796,29 +1592,23 @@ S leftJustify(S)(S s, size_t width, dcha - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.rightJustify instead.") S rjustify(S)(S s, size_t width) if (isSomeString!S) --{ -- return rightJustify!S(s, width); --} -- - /++ - Right justify $(D s) in a field $(D width) characters wide. $(D fillChar) - is the character that will be used to fill up the space in the field that - $(D s) doesn't fill. - +/ --S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted -- if(isSomeString!S) -+S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure -+ if (isSomeString!S) - { - alias typeof(s[0]) C; - -- if(cast(dchar)(cast(C)fillChar) == fillChar) -+ if (cast(dchar)(cast(C)fillChar) == fillChar) - { - immutable len = s.walkLength(); -- if(len >= width) -+ if (len >= width) - return s; - -- auto retval = new Unqual!(C)[width - len + s.length]; -+ auto retval = new Unqual!C[width - len + s.length]; - retval[0 .. $ - s.length] = cast(C)fillChar; - retval[$ - s.length .. $] = s[]; - return cast(S)retval; -@@ -1826,7 +1616,7 @@ S rightJustify(S)(S s, size_t width, dch - else - { - auto dstr = to!dstring(s); -- if(dstr.length >= width) -+ if (dstr.length >= width) - return s; - - auto retval = new dchar[](width); -@@ -1842,18 +1632,18 @@ S rightJustify(S)(S s, size_t width, dch - is the character that will be used to fill up the space in the field that - $(D s) doesn't fill. - +/ --S center(S)(S s, size_t width, dchar fillChar = ' ') @trusted -- if(isSomeString!S) -+S center(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure -+ if (isSomeString!S) - { - alias typeof(s[0]) C; - -- if(cast(dchar)(cast(C)fillChar) == fillChar) -+ if (cast(dchar)(cast(C)fillChar) == fillChar) - { - immutable len = s.walkLength(); -- if(len >= width) -+ if (len >= width) - return s; - -- auto retval = new Unqual!(C)[width - len + s.length]; -+ auto retval = new Unqual!C[width - len + s.length]; - immutable left = (retval.length - s.length) / 2; - retval[0 .. left] = cast(C)fillChar; - retval[left .. left + s.length] = s[]; -@@ -1863,7 +1653,7 @@ S center(S)(S s, size_t width, dchar fil - else - { - auto dstr = to!dstring(s); -- if(dstr.length >= width) -+ if (dstr.length >= width) - return s; - - auto retval = new dchar[](width); -@@ -1879,7 +1669,9 @@ unittest - { - debug(string) printf("string.justify.unittest\n"); - -- foreach(S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - S s = to!S("hello"); - -@@ -1889,53 +1681,27 @@ unittest - - assert(leftJustify(s, 7) == "hello "); - assert(rightJustify(s, 7) == " hello"); -- assert(center(s, 7) == " hello "); -- -- assert(leftJustify(s, 8) == "hello "); -- assert(rightJustify(s, 8) == " hello"); -- assert(center(s, 8) == " hello "); -- -- assert(leftJustify(s, 8, '\u0100') == "hello\u0100\u0100\u0100"); -- assert(rightJustify(s, 8, '\u0100') == "\u0100\u0100\u0100hello"); -- assert(center(s, 8, '\u0100') == "\u0100hello\u0100\u0100"); -- } --} -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.rightJustify with a fill character of '0' instead.") --S zfill(S)(S s, int width) if (isSomeString!S) --{ -- return rightJustify!S(s, width, '0'); --} -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.array.insertInPlace instead.") S insert(S)(S s, size_t index, S sub) --in --{ -- assert(0 <= index && index <= s.length); --} --body --{ -- std.array.insertInPlace(s, index, sub); -- return s; --} -+ assert(center(s, 7) == " hello "); - -+ assert(leftJustify(s, 8) == "hello "); -+ assert(rightJustify(s, 8) == " hello"); -+ assert(center(s, 8) == " hello "); - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.detab instead.") S expandtabs(S)(S str, size_t tabsize = 8) if (isSomeString!S) --{ -- return detab!S(str, tabsize); -+ assert(leftJustify(s, 8, '\u0100') == "hello\u0100\u0100\u0100"); -+ assert(rightJustify(s, 8, '\u0100') == "\u0100\u0100\u0100hello"); -+ assert(center(s, 8, '\u0100') == "\u0100hello\u0100\u0100"); -+ } -+ }); - } - -+ - /++ - Replace each tab character in $(D s) with the number of spaces necessary - to align the following character at the next tab stop where $(D tabSize) - is the distance between tab stops. - +/ - S detab(S)(S s, size_t tabSize = 8) @trusted pure -- if(isSomeString!S) -+ if (isSomeString!S) - { - assert(tabSize > 0); - alias Unqual!(typeof(s[0])) C; -@@ -1996,6 +1762,8 @@ unittest - { - debug(string) printf("string.detab.unittest\n"); - -+ assertCTFEable!( -+ { - foreach (S; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring)) - { - S s = to!S("This \tis\t a fofof\tof list"); -@@ -2010,9 +1778,9 @@ unittest - assert(detab( " ab\t asdf ") == " ab asdf "); - assert(detab( " \U00010000b\tasdf ") == " \U00010000b asdf "); - } -+ }); - } - -- - /++ - Replaces spaces in $(D s) with the optimal number of tabs. - All spaces and tabs at the end of a line are removed. -@@ -2022,7 +1790,7 @@ unittest - tabSize = Tab columns are $(D tabSize) spaces apart. - +/ - S entab(S)(S s, size_t tabSize = 8) @trusted pure -- if(isSomeString!S) -+ if (isSomeString!S) - { - bool changes = false; - alias Unqual!(typeof(s[0])) C; -@@ -2124,8 +1892,8 @@ unittest - { - debug(string) printf("string.entab.unittest\n"); - -- string r; -- -+ assertCTFEable!( -+ { - assert(entab(cast(string) null) is null); - assert(entab("").empty); - assert(entab("a") == "a"); -@@ -2156,6 +1924,7 @@ unittest - assert(entab("a\t") == "a"); - assert(entab("\uFF28\uFF45\uFF4C\uFF4C567 \t\uFF4F \t") == - "\uFF28\uFF45\uFF4C\uFF4C567\t\t\uFF4F"); -+ }); - } - - -@@ -2176,28 +1945,19 @@ unittest - transTable = The AA indicating which characters to replace and what to - replace them with. - toRemove = The characters to remove from the string. -- -- Examples: ---------------------- --dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; --assert(translate("hello world", transTable1) == "h5ll7 w7rld"); -- --assert(translate("hello world", transTable1, "low") == "h5 rd"); -- --string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; --assert(translate("hello world", transTable2) == "h5llorange worangerld"); ---------------------- - +/ - C1[] translate(C1, C2 = immutable char)(C1[] str, - dchar[dchar] transTable, -- const(C2)[] toRemove = null) @safe -- if(isSomeChar!C1 && isSomeChar!C2) -+ const(C2)[] toRemove = null) @safe pure -+ if (isSomeChar!C1 && isSomeChar!C2) - { -- return translateImpl(str, transTable, toRemove); -+ auto buffer = appender!(C1[])(); -+ translateImpl(str, transTable, toRemove, buffer); -+ return buffer.data; - } - --//Verify Examples. --unittest -+/// -+@safe pure unittest - { - dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; - assert(translate("hello world", transTable1) == "h5ll7 w7rld"); -@@ -2208,11 +1968,13 @@ unittest - assert(translate("hello world", transTable2) == "h5llorange worangerld"); - } - --unittest -+/* @safe */ pure unittest - { -- foreach(S; TypeTuple!(char[], const(char)[], immutable(char)[], -- wchar[], const(wchar)[], immutable(wchar)[], -- dchar[], const(dchar)[], immutable(dchar)[])) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!( char[], const( char)[], immutable( char)[], -+ wchar[], const(wchar)[], immutable(wchar)[], -+ dchar[], const(dchar)[], immutable(dchar)[])) - { - assert(translate(to!S("hello world"), cast(dchar[dchar])['h' : 'q', 'l' : '5']) == - to!S("qe55o wor5d")); -@@ -2224,9 +1986,9 @@ unittest - to!S("hell0 o w0rld")); - assert(translate(to!S("hello world"), cast(dchar[dchar])null) == to!S("hello world")); - -- foreach(T; TypeTuple!(char[], const(char)[], immutable(char)[], -- wchar[], const(wchar)[], immutable(wchar)[], -- dchar[], const(dchar)[], immutable(dchar)[])) -+ foreach (T; TypeTuple!( char[], const( char)[], immutable( char)[], -+ wchar[], const(wchar)[], immutable(wchar)[], -+ dchar[], const(dchar)[], immutable(dchar)[])) - { - assert(translate(to!S("hello world"), - cast(dchar[dchar])['h' : 'q', 'l' : '5'], -@@ -2250,22 +2012,27 @@ unittest - dchar[dchar] transTable = ['h' : 'q', 'l' : '5']; - static assert(is(typeof(s) == typeof(translate(s, transTable)))); - } -+ }); - } - - /++ Ditto +/ - C1[] translate(C1, S, C2 = immutable char)(C1[] str, - S[dchar] transTable, -- const(C2)[] toRemove = null) @safe -- if(isSomeChar!C1 && isSomeString!S && isSomeChar!C2) -+ const(C2)[] toRemove = null) @safe pure -+ if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2) - { -- return translateImpl(str, transTable, toRemove); -+ auto buffer = appender!(C1[])(); -+ translateImpl(str, transTable, toRemove, buffer); -+ return buffer.data; - } - --unittest -+/* @safe */ pure unittest - { -- foreach(S; TypeTuple!(char[], const(char)[], immutable(char)[], -- wchar[], const(wchar)[], immutable(wchar)[], -- dchar[], const(dchar)[], immutable(dchar)[])) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!( char[], const( char)[], immutable( char)[], -+ wchar[], const(wchar)[], immutable(wchar)[], -+ dchar[], const(dchar)[], immutable(dchar)[])) - { - assert(translate(to!S("hello world"), ['h' : "yellow", 'l' : "42"]) == - to!S("yellowe4242o wor42d")); -@@ -2281,9 +2048,9 @@ unittest - to!S("hello world")); - assert(translate(to!S("hello world"), cast(string[dchar])null) == to!S("hello world")); - -- foreach(T; TypeTuple!(char[], const(char)[], immutable(char)[], -- wchar[], const(wchar)[], immutable(wchar)[], -- dchar[], const(dchar)[], immutable(dchar)[])) -+ foreach (T; TypeTuple!( char[], const( char)[], immutable( char)[], -+ wchar[], const(wchar)[], immutable(wchar)[], -+ dchar[], const(dchar)[], immutable(dchar)[])) - { - assert(translate(to!S("hello world"), ['h' : "yellow", 'l' : "42"], to!T("r")) == - to!S("yellowe4242o wo42d")); -@@ -2305,36 +2072,80 @@ unittest - string[dchar] transTable = ['h' : "silly", 'l' : "putty"]; - static assert(is(typeof(s) == typeof(translate(s, transTable)))); - } -+ }); - } - --private auto translateImpl(C1, T, C2)(C1[] str, -- T transTable, -- const(C2)[] toRemove) @trusted -+/++ -+ This is an overload of $(D translate) which takes an existing buffer to write the contents to. -+ -+ Params: -+ str = The original string. -+ transTable = The AA indicating which characters to replace and what to -+ replace them with. -+ toRemove = The characters to remove from the string. -+ buffer = An output range to write the contents to. -+ +/ -+void translate(C1, C2 = immutable char, Buffer)(C1[] str, -+ dchar[dchar] transTable, -+ const(C2)[] toRemove, -+ Buffer buffer) -+ if (isSomeChar!C1 && isSomeChar!C2 && isOutputRange!(Buffer, C1)) -+{ -+ translateImpl(str, transTable, toRemove, buffer); -+} -+ -+/// -+@safe pure unittest -+{ -+ dchar[dchar] transTable1 = ['e' : '5', 'o' : '7', '5': 'q']; -+ auto buffer = appender!(dchar[])(); -+ translate("hello world", transTable1, null, buffer); -+ assert(buffer.data == "h5ll7 w7rld"); -+ -+ buffer.clear(); -+ translate("hello world", transTable1, "low", buffer); -+ assert(buffer.data == "h5 rd"); -+ -+ buffer.clear(); -+ string[dchar] transTable2 = ['e' : "5", 'o' : "orange"]; -+ translate("hello world", transTable2, null, buffer); -+ assert(buffer.data == "h5llorange worangerld"); -+} -+ -+/++ Ditto +/ -+void translate(C1, S, C2 = immutable char, Buffer)(C1[] str, -+ S[dchar] transTable, -+ const(C2)[] toRemove, -+ Buffer buffer) -+ if (isSomeChar!C1 && isSomeString!S && isSomeChar!C2 && isOutputRange!(Buffer, S)) - { -- auto retval = appender!(C1[])(); -+ translateImpl(str, transTable, toRemove, buffer); -+} - -+private void translateImpl(C1, T, C2, Buffer)(C1[] str, -+ T transTable, -+ const(C2)[] toRemove, -+ Buffer buffer) -+{ - bool[dchar] removeTable; - -- foreach(dchar c; toRemove) -+ foreach (dchar c; toRemove) - removeTable[c] = true; - -- foreach(dchar c; str) -+ foreach (dchar c; str) - { -- if(c in removeTable) -+ if (c in removeTable) - continue; - - auto newC = c in transTable; - -- if(newC) -- retval.put(*newC); -+ if (newC) -+ put(buffer, *newC); - else -- retval.put(c); -+ put(buffer, c); - } -- -- return retval.data; - } - -- - /++ - This is an $(I $(RED ASCII-only)) overload of $(LREF _translate). It - will $(I not) work with Unicode. It exists as an optimization for the -@@ -2367,50 +2178,30 @@ private auto translateImpl(C1, T, C2)(C1 - transTable = The string indicating which characters to replace and what - to replace them with. It is generated by $(LREF makeTrans). - toRemove = The characters to remove from the string. -- -- Examples: ---------------------- --auto transTable1 = makeTrans("eo5", "57q"); --assert(translate("hello world", transTable1) == "h5ll7 w7rld"); -- --assert(translate("hello world", transTable1, "low") == "h5 rd"); ---------------------- - +/ --C[] translate(C = immutable char)(in char[] str, in char[] transTable, in char[] toRemove = null) @trusted nothrow -- if(is(Unqual!C == char)) -+C[] translate(C = immutable char)(in char[] str, in char[] transTable, in char[] toRemove = null) @trusted pure nothrow -+ if (is(Unqual!C == char)) - in - { - assert(transTable.length == 256); -- foreach(char c; str) -- assert(c <= 256); -- foreach(char c; transTable) -- assert(c <= 256); -- foreach(char c; toRemove) -- assert(c <= 256); - } - body - { - bool[256] remTable = false; - -- foreach(char c; toRemove) -+ foreach (char c; toRemove) - remTable[c] = true; - - size_t count = 0; -- foreach(char c; str) -+ foreach (char c; str) - { -- if(!remTable[c]) -+ if (!remTable[c]) - ++count; - } - -- auto retval = new char[count]; -- size_t i = 0; -- foreach(char c; str) -- { -- if(!remTable[c]) -- retval[i++] = transTable[c]; -- } -- -- return cast(C[])(retval); -+ auto buffer = new char[count]; -+ translateImplAscii(str, transTable, remTable, buffer, toRemove); -+ return cast(C[])(buffer); - } - - -@@ -2420,25 +2211,25 @@ in - { - assert(from.length == to.length); - assert(from.length <= 256); -- foreach(char c; from) -+ foreach (char c; from) - assert(std.ascii.isASCII(c)); -- foreach(char c; to) -+ foreach (char c; to) - assert(std.ascii.isASCII(c)); - } - body - { - char[] transTable = new char[256]; - -- foreach(i; 0 .. transTable.length) -+ foreach (i; 0 .. transTable.length) - transTable[i] = cast(char)i; -- foreach(i; 0 .. from.length) -+ foreach (i; 0 .. from.length) - transTable[from[i]] = to[i]; - - return assumeUnique(transTable); - } - --// Verify Examples. --unittest -+/// -+@safe pure nothrow unittest - { - auto transTable1 = makeTrans("eo5", "57q"); - assert(translate("hello world", transTable1) == "h5ll7 w7rld"); -@@ -2446,9 +2237,11 @@ unittest - assert(translate("hello world", transTable1, "low") == "h5 rd"); - } - --unittest -+@safe pure unittest - { -- foreach(C; TypeTuple!(char, const char, immutable char)) -+ assertCTFEable!( -+ { -+ foreach (C; TypeTuple!(char, const char, immutable char)) - { - assert(translate!C("hello world", makeTrans("hl", "q5")) == to!(C[])("qe55o wor5d")); - -@@ -2457,7 +2250,7 @@ unittest - static assert(is(typeof(s) == typeof(translate!C(s, transTable)))); - } - -- foreach(S; TypeTuple!(char[], const(char)[], immutable(char)[])) -+ foreach (S; TypeTuple!(char[], const(char)[], immutable(char)[])) - { - assert(translate(to!S("hello world"), makeTrans("hl", "q5")) == to!S("qe55o wor5d")); - assert(translate(to!S("hello \U00010143 world"), makeTrans("hl", "q5")) == -@@ -2468,7 +2261,7 @@ unittest - assert(translate(to!S("hello \U00010143 world"), makeTrans("12345", "67890")) == - to!S("hello \U00010143 world")); - -- foreach(T; TypeTuple!(char[], const(char)[], immutable(char)[])) -+ foreach (T; TypeTuple!(char[], const(char)[], immutable(char)[])) - { - assert(translate(to!S("hello world"), makeTrans("hl", "q5"), to!T("r")) == - to!S("qe55o wo5d")); -@@ -2480,34 +2273,75 @@ unittest - to!S("qe55o wor5d")); - } - } -+ }); -+} -+ -+/++ -+ This is an $(I $(RED ASCII-only)) overload of $(D translate) which takes an existing buffer to write the contents to. -+ -+ Params: -+ str = The original string. -+ transTable = The string indicating which characters to replace and what -+ to replace them with. It is generated by $(LREF makeTrans). -+ toRemove = The characters to remove from the string. -+ buffer = An output range to write the contents to. -+ +/ -+void translate(C = immutable char, Buffer)(in char[] str, in char[] transTable, in char[] toRemove, Buffer buffer) -+ if (is(Unqual!C == char) && isOutputRange!(Buffer, char)) -+in -+{ -+ assert(transTable.length == 256); - } -+body -+{ -+ bool[256] remTable = false; - -+ foreach (char c; toRemove) -+ remTable[c] = true; - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.string.makeTrans instead.") alias makeTrans maketrans; -+ translateImplAscii(str, transTable, remTable, buffer, toRemove); -+} - --deprecated unittest -+/// -+@safe pure unittest - { -- debug(string) printf("string.translate.unittest\n"); -+ auto buffer = appender!(char[])(); -+ auto transTable1 = makeTrans("eo5", "57q"); -+ translate("hello world", transTable1, null, buffer); -+ assert(buffer.data == "h5ll7 w7rld"); - -- string from = "abcdef"; -- string to = "ABCDEF"; -- string s = "The quick dog fox"; -- string t; -- string r; -- int i; -- -- t = maketrans(from, to); -- r = translate(s, t, "kg"); -- //printf("r = '%.*s'\n", r); -- i = cmp(r, "ThE quiC Do Fox"); -- assert(i == 0); -+ buffer.clear(); -+ translate("hello world", transTable1, "low", buffer); -+ assert(buffer.data == "h5 rd"); - } - -+private void translateImplAscii(C = immutable char, Buffer)(in char[] str, in char[] transTable, ref bool[256] remTable, Buffer buffer, in char[] toRemove = null) -+{ -+ static if (isOutputRange!(Buffer, char)) -+ { -+ foreach (char c; str) -+ { -+ if (!remTable[c]) -+ put(buffer, transTable[c]); -+ } -+ } -+ else -+ { -+ size_t i = 0; -+ foreach (char c; str) -+ { -+ if (!remTable[c]) -+ buffer[i++] = transTable[c]; -+ } -+ } -+} - - /***************************************************** - * Format arguments into a string. - * -+ * Params: fmt = Format string. For detailed specification, see $(XREF format,formattedWrite). -+ * args = Variadic list of arguments to format into returned string. -+ * - * $(RED format's current implementation has been replaced with $(LREF xformat)'s - * implementation. in November 2012. - * This is seamless for most code, but it makes it so that the only -@@ -2516,13 +2350,13 @@ deprecated unittest - * your calls to format accordingly. - * - * e.g.: ------ --format("key = %s", key, ", value = %s", value) ------ -+ * ---- -+ * format("key = %s", key, ", value = %s", value) -+ * ---- - * needs to be rewritten as: ------ --format("key = %s, value = %s", key, value) ------ -+ * ---- -+ * format("key = %s, value = %s", key, value) -+ * ---- - * ) - */ - string format(Char, Args...)(in Char[] fmt, Args args) -@@ -2543,6 +2377,8 @@ unittest - { - debug(string) printf("std.string.format.unittest\n"); - -+ assertCTFEable!( -+ { - // assert(format(null) == ""); - assert(format("foo") == "foo"); - assert(format("foo%%") == "foo%"); -@@ -2554,13 +2390,17 @@ unittest - - assertThrown!FormatException(format("foo %s")); - assertThrown!FormatException(format("foo %s", 123, 456)); -+ -+ assert(format("hel%slo%s%s%s", "world", -138, 'c', true) == -+ "helworldlo-138ctrue"); -+ }); - } - - - /***************************************************** -- * Format arguments into string <i>s</i> which must be large -+ * Format arguments into buffer <i>buf</i> which must be large - * enough to hold the result. Throws RangeError if it is not. -- * Returns: s -+ * Returns: The slice of $(D buf) containing the formatted string. - * - * $(RED sformat's current implementation has been replaced with $(LREF xsformat)'s - * implementation. in November 2012. -@@ -2570,13 +2410,13 @@ unittest - * your calls to sformat accordingly. - * - * e.g.: ------ --sformat(buf, "key = %s", key, ", value = %s", value) ------ -+ * ---- -+ * sformat(buf, "key = %s", key, ", value = %s", value) -+ * ---- - * needs to be rewritten as: ------ --sformat(buf, "key = %s, value = %s", key, value) ------ -+ * ---- -+ * sformat(buf, "key = %s, value = %s", key, value) -+ * ---- - * ) - */ - char[] sformat(Char, Args...)(char[] buf, in Char[] fmt, Args args) -@@ -2630,6 +2470,8 @@ unittest - { - debug(string) printf("std.string.sformat.unittest\n"); - -+ assertCTFEable!( -+ { - char[10] buf; - - assert(sformat(buf[], "foo") == "foo"); -@@ -2644,35 +2486,27 @@ unittest - assertThrown!FormatException(sformat(buf[], "foo %s", 123, 456)); - - assert(sformat(buf[], "%s %s %s", "c"c, "w"w, "d"d) == "c w d"); -+ }); - } - - - /***************************************************** -+ * $(RED Deprecated. It will be removed in November 2013. -+ * Please use std.string.format instead.) -+ * - * Format arguments into a string. - * -- * $(LREF format) has been changed to use this implementation in November 2012. -- * Then xformat has been scheduled for deprecation at the same time. -- * It will be deprecateed in May 2013. -+ * $(LREF format) was changed to use this implementation in November 2012, - */ - --string xformat(Char, Args...)(in Char[] fmt, Args args) --{ -- auto w = appender!string(); -- auto n = formattedWrite(w, fmt, args); -- version (all) -- { -- // In the future, this check will be removed to increase consistency -- // with formattedWrite -- enforce(n == args.length, new FormatException( -- text("Orphan format arguments: args[", n, "..", args.length, "]"))); -- } -- return w.data; --} -+deprecated("Please use std.string.format instead.") alias format xformat; - - deprecated unittest - { - debug(string) printf("std.string.xformat.unittest\n"); - -+ assertCTFEable!( -+ { - // assert(xformat(null) == ""); - assert(xformat("foo") == "foo"); - assert(xformat("foo%%") == "foo%"); -@@ -2684,71 +2518,28 @@ deprecated unittest - - assertThrown!FormatException(xformat("foo %s")); - assertThrown!FormatException(xformat("foo %s", 123, 456)); -+ }); - } - - - /***************************************************** -- * Format arguments into string $(D_PARAM buf) which must be large -- * enough to hold the result. Throws RangeError if it is not. -+ * $(RED Deprecated. It will be removed in November 2013. -+ * Please use std.string.sformat instead.) - * -- * $(LREF sformat) has been changed to use this implementation in November 2012. -- * Then xsformat has been scheduled for deprecation at the same time. -- * It will be deprecateed in May 2013. -+ * Format arguments into string $(D buf) which must be large -+ * enough to hold the result. Throws RangeError if it is not. - * -- * Returns: filled slice of $(D_PARAM buf) -+ * $(LREF sformat) was changed to use this implementation in November 2012, - */ - --char[] xsformat(Char, Args...)(char[] buf, in Char[] fmt, Args args) --{ -- size_t i; -- -- struct Sink -- { -- void put(dchar c) -- { -- char[4] enc; -- auto n = encode(enc, c); -- -- if (buf.length < i + n) -- onRangeError("std.string.xsformat", 0); -- -- buf[i .. i + n] = enc[0 .. n]; -- i += n; -- } -- void put(const(char)[] s) -- { -- if (buf.length < i + s.length) -- onRangeError("std.string.xsformat", 0); -- -- buf[i .. i + s.length] = s[]; -- i += s.length; -- } -- void put(const(wchar)[] s) -- { -- for (; !s.empty; s.popFront()) -- put(s.front); -- } -- void put(const(dchar)[] s) -- { -- for (; !s.empty; s.popFront()) -- put(s.front); -- } -- } -- auto n = formattedWrite(Sink(), fmt, args); -- version (all) -- { -- // In the future, this check will be removed to increase consistency -- // with formattedWrite -- enforce(n == args.length, new FormatException( -- text("Orphan format arguments: args[", n, "..", args.length, "]"))); -- } -- return buf[0 .. i]; --} -+deprecated("Please use std.string.sformat instead.") alias sformat xsformat; - - deprecated unittest - { - debug(string) printf("std.string.xsformat.unittest\n"); - -+ assertCTFEable!( -+ { - char[10] buf; - - assert(xsformat(buf[], "foo") == "foo"); -@@ -2763,6 +2554,7 @@ deprecated unittest - assertThrown!FormatException(xsformat(buf[], "foo %s", 123, 456)); - - assert(xsformat(buf[], "%s %s %s", "c"c, "w"w, "d"d) == "c w d"); -+ }); - } - - -@@ -2785,7 +2577,7 @@ deprecated unittest - * to be more like regular expression character classes. - */ - --bool inPattern(S)(dchar c, in S pattern) if (isSomeString!S) -+bool inPattern(S)(dchar c, in S pattern) @safe pure if (isSomeString!S) - { - bool result = false; - int range = 0; -@@ -2793,25 +2585,26 @@ bool inPattern(S)(dchar c, in S pattern) - - foreach (size_t i, dchar p; pattern) - { -- if (p == '^' && i == 0) -- { result = true; -- if (i + 1 == pattern.length) -- return (c == p); // or should this be an error? -- } -- else if (range) -- { -- range = 0; -- if (lastc <= c && c <= p || c == p) -- return !result; -- } -- else if (p == '-' && i > result && i + 1 < pattern.length) -- { -- range = 1; -- continue; -- } -- else if (c == p) -- return !result; -- lastc = p; -+ if (p == '^' && i == 0) -+ { -+ result = true; -+ if (i + 1 == pattern.length) -+ return (c == p); // or should this be an error? -+ } -+ else if (range) -+ { -+ range = 0; -+ if (lastc <= c && c <= p || c == p) -+ return !result; -+ } -+ else if (p == '-' && i > result && i + 1 < pattern.length) -+ { -+ range = 1; -+ continue; -+ } -+ else if (c == p) -+ return !result; -+ lastc = p; - } - return result; - } -@@ -2821,46 +2614,28 @@ unittest - { - debug(string) printf("std.string.inPattern.unittest\n"); - -- int i; -- -- i = inPattern('x', "x"); -- assert(i == 1); -- i = inPattern('x', "y"); -- assert(i == 0); -- i = inPattern('x', cast(string)null); -- assert(i == 0); -- i = inPattern('x', "^y"); -- assert(i == 1); -- i = inPattern('x', "yxxy"); -- assert(i == 1); -- i = inPattern('x', "^yxxy"); -- assert(i == 0); -- i = inPattern('x', "^abcd"); -- assert(i == 1); -- i = inPattern('^', "^^"); -- assert(i == 0); -- i = inPattern('^', "^"); -- assert(i == 1); -- i = inPattern('^', "a^"); -- assert(i == 1); -- i = inPattern('x', "a-z"); -- assert(i == 1); -- i = inPattern('x', "A-Z"); -- assert(i == 0); -- i = inPattern('x', "^a-z"); -- assert(i == 0); -- i = inPattern('x', "^A-Z"); -- assert(i == 1); -- i = inPattern('-', "a-"); -- assert(i == 1); -- i = inPattern('-', "^A-"); -- assert(i == 0); -- i = inPattern('a', "z-a"); -- assert(i == 1); -- i = inPattern('z', "z-a"); -- assert(i == 1); -- i = inPattern('x', "z-a"); -- assert(i == 0); -+ assertCTFEable!( -+ { -+ assert(inPattern('x', "x") == 1); -+ assert(inPattern('x', "y") == 0); -+ assert(inPattern('x', string.init) == 0); -+ assert(inPattern('x', "^y") == 1); -+ assert(inPattern('x', "yxxy") == 1); -+ assert(inPattern('x', "^yxxy") == 0); -+ assert(inPattern('x', "^abcd") == 1); -+ assert(inPattern('^', "^^") == 0); -+ assert(inPattern('^', "^") == 1); -+ assert(inPattern('^', "a^") == 1); -+ assert(inPattern('x', "a-z") == 1); -+ assert(inPattern('x', "A-Z") == 0); -+ assert(inPattern('x', "^a-z") == 0); -+ assert(inPattern('x', "^A-Z") == 1); -+ assert(inPattern('-', "a-") == 1); -+ assert(inPattern('-', "^A-") == 0); -+ assert(inPattern('a', "z-a") == 1); -+ assert(inPattern('z', "z-a") == 1); -+ assert(inPattern('x', "z-a") == 0); -+ }); - } - - -@@ -2868,7 +2643,7 @@ unittest - * See if character c is in the intersection of the patterns. - */ - --bool inPattern(S)(dchar c, S[] patterns) if (isSomeString!S) -+bool inPattern(S)(dchar c, S[] patterns) @safe pure if (isSomeString!S) - { - foreach (string pattern; patterns) - { -@@ -2885,7 +2660,7 @@ bool inPattern(S)(dchar c, S[] patterns) - * Count characters in s that match pattern. - */ - --size_t countchars(S, S1)(S s, in S1 pattern) if (isSomeString!S && isSomeString!S1) -+size_t countchars(S, S1)(S s, in S1 pattern) @safe pure if (isSomeString!S && isSomeString!S1) - { - size_t count; - foreach (dchar c; s) -@@ -2899,12 +2674,11 @@ unittest - { - debug(string) printf("std.string.count.unittest\n"); - -- size_t c; -- -- c = countchars("abc", "a-c"); -- assert(c == 3); -- c = countchars("hello world", "or"); -- assert(c == 3); -+ assertCTFEable!( -+ { -+ assert(countchars("abc", "a-c") == 3); -+ assert(countchars("hello world", "or") == 3); -+ }); - } - - -@@ -2912,14 +2686,15 @@ unittest - * Return string that is s with all characters removed that match pattern. - */ - --S removechars(S)(S s, in S pattern) if (isSomeString!S) -+S removechars(S)(S s, in S pattern) @safe pure if (isSomeString!S) - { - Unqual!(typeof(s[0]))[] r; - bool changed = false; - - foreach (size_t i, dchar c; s) - { -- if (inPattern(c, pattern)){ -+ if (inPattern(c, pattern)) -+ { - if (!changed) - { - changed = true; -@@ -2932,23 +2707,23 @@ S removechars(S)(S s, in S pattern) if ( - std.utf.encode(r, c); - } - } -- return (changed? cast(S) r : s); -+ if (changed) -+ return r; -+ else -+ return s; - } - - unittest - { - debug(string) printf("std.string.removechars.unittest\n"); - -- string r; -- -- r = removechars("abc", "a-c"); -- assert(r.length == 0); -- r = removechars("hello world", "or"); -- assert(r == "hell wld"); -- r = removechars("hello world", "d"); -- assert(r == "hello worl"); -- r = removechars("hah", "h"); -- assert(r == "a"); -+ assertCTFEable!( -+ { -+ assert(removechars("abc", "a-c").length == 0); -+ assert(removechars("hello world", "or") == "hell wld"); -+ assert(removechars("hello world", "d") == "hello worl"); -+ assert(removechars("hah", "h") == "a"); -+ }); - } - - -@@ -2976,7 +2751,8 @@ S squeeze(S)(S s, in S pattern = null) - { - run = 1; - if (changed) -- { if (r is null) -+ { -+ if (r is null) - r = s[0 .. lasti].dup; - std.utf.encode(r, c); - } -@@ -2988,7 +2764,8 @@ S squeeze(S)(S s, in S pattern = null) - { - run = 0; - if (changed) -- { if (r is null) -+ { -+ if (r is null) - r = s[0 .. lasti].dup; - std.utf.encode(r, c); - } -@@ -3000,19 +2777,20 @@ S squeeze(S)(S s, in S pattern = null) - unittest - { - debug(string) printf("std.string.squeeze.unittest\n"); -- string s,r; - -- r = squeeze("hello"); -- //writefln("r = '%s'", r); -- assert(r == "helo"); -+ assertCTFEable!( -+ { -+ string s; -+ -+ assert(squeeze("hello") == "helo"); -+ - s = "abcd"; -- r = squeeze(s); -- assert(r is s); -+ assert(squeeze(s) is s); - s = "xyzz"; -- r = squeeze(s); -- assert(r.ptr == s.ptr); // should just be a slice -- r = squeeze("hello goodbyee", "oe"); -- assert(r == "hello godbye"); -+ assert(squeeze(s).ptr == s.ptr); // should just be a slice -+ -+ assert(squeeze("hello goodbyee", "oe") == "hello godbye"); -+ }); - } - - /*************************************************************** -@@ -3024,11 +2802,11 @@ unittest - - Example: - --- --string s = "123abc"; --string t = munch(s, "0123456789"); --assert(t == "123" && s == "abc"); --t = munch(s, "0123456789"); --assert(t == "" && s == "abc"); -+ string s = "123abc"; -+ string t = munch(s, "0123456789"); -+ assert(t == "123" && s == "abc"); -+ t = munch(s, "0123456789"); -+ assert(t == "" && s == "abc"); - --- - - The $(D_PARAM munch) function is mostly convenient for skipping -@@ -3051,7 +2829,7 @@ S1 munch(S1, S2)(ref S1 s, S2 pattern) - return s[0 .. j]; - } - --unittest -+@safe pure unittest - { - string s = "123abc"; - string t = munch(s, "0123456789"); -@@ -3068,7 +2846,7 @@ unittest - * repeated with the one to its immediate left. - */ - --S succ(S)(S s) if (isSomeString!S) -+S succ(S)(S s) @safe pure if (isSomeString!S) - { - if (s.length && std.ascii.isAlphaNum(s[$ - 1])) - { -@@ -3097,7 +2875,7 @@ S succ(S)(S s) if (isSomeString!S) - auto t = new typeof(r[0])[r.length + 1]; - t[0] = cast(char) carry; - t[1 .. $] = r[]; -- return assumeUnique(t); -+ return t; - } - i--; - break; -@@ -3105,7 +2883,7 @@ S succ(S)(S s) if (isSomeString!S) - default: - if (std.ascii.isAlphaNum(c)) - r[i]++; -- return cast(S) r; -+ return r; - } - } - } -@@ -3116,20 +2894,15 @@ unittest - { - debug(string) printf("std.string.succ.unittest\n"); - -- string r; -- -- r = succ(cast(string) null); -- assert(r is null); -- r = succ("!@#$%"); -- assert(r == "!@#$%"); -- r = succ("1"); -- assert(r == "2"); -- r = succ("9"); -- assert(r == "10"); -- r = succ("999"); -- assert(r == "1000"); -- r = succ("zz99"); -- assert(r == "aaa00"); -+ assertCTFEable!( -+ { -+ assert(succ(string.init) is null); -+ assert(succ("!@#$%") == "!@#$%"); -+ assert(succ("1") == "2"); -+ assert(succ("9") == "10"); -+ assert(succ("999") == "1000"); -+ assert(succ("zz99") == "aaa00"); -+ }); - } - - -@@ -3168,7 +2941,7 @@ unittest - $(D to). - - Both $(D from) and $(D to) may contain ranges using the $(D '-') character -- (e.g. $(D "a-d") is synonymous with $(D "abcd).) Neither accept a leading -+ (e.g. $(D "a-d") is synonymous with $(D "abcd").) Neither accept a leading - $(D '^') as meaning the complement of the string (use the $(D 'c') modifier - for that). - +/ -@@ -3288,20 +3061,21 @@ unittest - import std.algorithm; - - // Complete list of test types; too slow to test'em all -- // alias TypeTuple!(char[], const(char)[], immutable(char)[], -+ // alias TestTypes = TypeTuple!( -+ // char[], const( char)[], immutable( char)[], - // wchar[], const(wchar)[], immutable(wchar)[], -- // dchar[], const(dchar)[], immutable(dchar)[]) -- // TestTypes; -+ // dchar[], const(dchar)[], immutable(dchar)[]); - - // Reduced list of test types -- alias TypeTuple!(char[], const(wchar)[], immutable(dchar)[]) -- TestTypes; -+ alias TestTypes = TypeTuple!(char[], const(wchar)[], immutable(dchar)[]); - -- foreach(S; TestTypes) -+ assertCTFEable!( -+ { -+ foreach (S; TestTypes) - { -- foreach(T; TestTypes) -+ foreach (T; TestTypes) - { -- foreach(U; TestTypes) -+ foreach (U; TestTypes) - { - assert(equal(tr(to!S("abcdef"), to!T("cd"), to!U("CD")), "abCDef")); - assert(equal(tr(to!S("abcdef"), to!T("b-d"), to!U("B-D")), "aBCDef")); -@@ -3320,6 +3094,7 @@ unittest - auto s = to!S("hello world"); - static assert(is(typeof(s) == typeof(tr(s, "he", "if")))); - } -+ }); - } - - -@@ -3370,7 +3145,7 @@ unittest - * function, or any of the conversion functions. - */ - --bool isNumeric(const(char)[] s, in bool bAllowSep = false) -+bool isNumeric(const(char)[] s, in bool bAllowSep = false) @safe pure - { - ptrdiff_t iLen = s.length; - bool bDecimalPoint = false; -@@ -3395,7 +3170,12 @@ bool isNumeric(const(char)[] s, in bool - - // A sign is allowed only in the 1st character - if (sx[0] == '-' || sx[0] == '+') -+ { -+ if (iLen == 1) // but must be followed by other characters -+ return false; -+ - j++; -+ } - - for (int i = j; i < iLen; i++) - { -@@ -3409,6 +3189,7 @@ bool isNumeric(const(char)[] s, in bool - // Check for the complex type, and if found - // reset the flags for checking the 2nd number. - else if (c == '+') -+ { - if (i > 0) - { - bDecimalPoint = false; -@@ -3418,7 +3199,7 @@ bool isNumeric(const(char)[] s, in bool - } - else - return false; -- -+ } - // Allow only one exponent per number - else if (c == 'e') - { -@@ -3512,103 +3293,13 @@ bool isNumeric(const(char)[] s, in bool - return true; - } - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated bool isNumeric(...) --{ -- return isNumeric(_arguments, _argptr); --} -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated bool isNumeric(TypeInfo[] _arguments, va_list _argptr) --{ -- auto s = ""c; -- auto ws = ""w; -- auto ds = ""d; -- -- //writefln("isNumeric(...) called!"); -- if (_arguments.length == 0) -- return false; -- -- if (_arguments[0] == typeid(char[])) -- return isNumeric(va_arg!(char[])(_argptr)); -- else if (_arguments[0] == typeid(wchar[])) -- return isNumeric(std.utf.toUTF8(va_arg!(wchar[])(_argptr))); -- else if (_arguments[0] == typeid(dchar[])) -- return isNumeric(std.utf.toUTF8(va_arg!(dstring)(_argptr))); -- else if (_arguments[0] == typeid(real)) -- return true; -- else if (_arguments[0] == typeid(double)) -- return true; -- else if (_arguments[0] == typeid(float)) -- return true; -- else if (_arguments[0] == typeid(ulong)) -- return true; -- else if (_arguments[0] == typeid(long)) -- return true; -- else if (_arguments[0] == typeid(uint)) -- return true; -- else if (_arguments[0] == typeid(int)) -- return true; -- else if (_arguments[0] == typeid(ushort)) -- return true; -- else if (_arguments[0] == typeid(short)) -- return true; -- else if (_arguments[0] == typeid(ubyte)) -- { -- char[1] t; -- t[0]= va_arg!(ubyte)(_argptr); -- return isNumeric(cast(string)t); -- } -- else if (_arguments[0] == typeid(byte)) -- { -- char[1] t; -- t[0] = va_arg!(char)(_argptr); -- return isNumeric(cast(string)t); -- } -- else if (_arguments[0] == typeid(ireal)) -- return true; -- else if (_arguments[0] == typeid(idouble)) -- return true; -- else if (_arguments[0] == typeid(ifloat)) -- return true; -- else if (_arguments[0] == typeid(creal)) -- return true; -- else if (_arguments[0] == typeid(cdouble)) -- return true; -- else if (_arguments[0] == typeid(cfloat)) -- return true; -- else if (_arguments[0] == typeid(char)) -- { -- char[1] t; -- t[0] = va_arg!(char)(_argptr); -- return isNumeric(cast(string)t); -- } -- else if (_arguments[0] == typeid(wchar)) -- { -- wchar[1] t; -- t[0] = va_arg!(wchar)(_argptr); -- return isNumeric(std.utf.toUTF8(t)); -- } -- else if (_arguments[0] == typeid(dchar)) -- { -- dchar[1] t; -- t[0] = va_arg!(dchar)(_argptr); -- dchar[] t1 = t; -- return isNumeric(std.utf.toUTF8(cast(dstring) t1)); -- } -- //else if (_arguments[0] == typeid(cent)) -- // return true; -- //else if (_arguments[0] == typeid(ucent)) -- // return true; -- else -- return false; --} - - unittest - { -- debug (string) printf("isNumeric(in string, bool = false).unittest\n"); -- string s; -+ debug(string) printf("isNumeric(in string, bool = false).unittest\n"); - -+ assertCTFEable!( -+ { - // Test the isNumeric(in string) function - assert(isNumeric("1") == true ); - assert(isNumeric("1.0") == true ); -@@ -3634,30 +3325,23 @@ unittest - assert(isNumeric("123f") == true); - assert(isNumeric("123.u") == false); - -+ // @@@BUG@@ to!string(float) is not CTFEable. -+ // Related: formatValue(T) if (is(FloatingPointTypeOf!T)) -+ if (!__ctfe) -+ { - assert(isNumeric(to!string(real.nan)) == true); - assert(isNumeric(to!string(-real.infinity)) == true); - assert(isNumeric(to!string(123e+2+1234.78Li)) == true); -+ } - -- s = "$250.99-"; -+ string s = "$250.99-"; - assert(isNumeric(s[1..s.length - 2]) == true); - assert(isNumeric(s) == false); - assert(isNumeric(s[0..s.length - 1]) == false); --} -+ }); - --deprecated unittest --{ -- // These test calling the isNumeric(...) function -- assert(isNumeric(1,123UL) == true); -- assert(isNumeric('2') == true); -- assert(isNumeric('x') == false); -- assert(isNumeric(cast(byte)0x57) == false); // 'W' -- assert(isNumeric(cast(byte)0x37) == true); // '7' -- assert(isNumeric(cast(wchar[])"145.67") == true); -- assert(isNumeric(cast(dchar[])"145.67U") == false); -- assert(isNumeric(123_000.23fi) == true); -- assert(isNumeric(123.00E-5+1234.45E-12Li) == true); -- assert(isNumeric(real.nan) == true); -- assert(isNumeric(-real.infinity) == true); -+ assert(!isNumeric("-")); -+ assert(!isNumeric("+")); - } - - -@@ -3689,7 +3373,7 @@ deprecated unittest - * but this one is the standard one. - */ - --char[] soundex(const(char)[] string, char[] buffer = null) -+char[] soundex(const(char)[] string, char[] buffer = null) @safe pure nothrow - in - { - assert(!buffer || buffer.length >= 4); -@@ -3721,7 +3405,8 @@ body - { - } - else -- { lastc = lastc.init; -+ { -+ lastc = lastc.init; - continue; - } - if (b == 0) -@@ -3757,8 +3442,11 @@ body - return buffer; - } - --unittest --{ char[4] buffer; -+@safe pure nothrow unittest -+{ -+ assertCTFEable!( -+ { -+ char[4] buffer; - - assert(soundex(null) == null); - assert(soundex("") == null); -@@ -3798,6 +3486,7 @@ unittest - assert(soundex("johnsons") == "J525"); - assert(soundex("Hardin") == "H635"); - assert(soundex("Martinez") == "M635"); -+ }); - } - - -@@ -3835,12 +3524,12 @@ unittest - * </pre> - */ - --string[string] abbrev(string[] values) -+string[string] abbrev(string[] values) @safe pure - { - string[string] result; - - // Make a copy when sorting so we follow COW principles. -- values = values.dup.sort; -+ values = values.dup.sort; // @@@BUG@@@ not CTFEable - - size_t values_length = values.length; - size_t lasti = values_length; -@@ -3850,25 +3539,30 @@ string[string] abbrev(string[] values) - string lv; - - for (size_t i = 0; i < values_length; i = nexti) -- { string value = values[i]; -+ { -+ string value = values[i]; - -- // Skip dups -- for (nexti = i + 1; nexti < values_length; nexti++) -- { nv = values[nexti]; -- if (value != values[nexti]) -- break; -- } -+ // Skip dups -+ for (nexti = i + 1; nexti < values_length; nexti++) -+ { -+ nv = values[nexti]; -+ if (value != values[nexti]) -+ break; -+ } - -- for (size_t j = 0; j < value.length; j += std.utf.stride(value, j)) -- { string v = value[0 .. j]; -+ for (size_t j = 0; j < value.length; j += std.utf.stride(value, j)) -+ { -+ string v = value[0 .. j]; - -- if ((nexti == values_length || j > nv.length || v != nv[0 .. j]) && -- (lasti == values_length || j > lv.length || v != lv[0 .. j])) -- result[v] = value; -- } -- result[value] = value; -- lasti = i; -- lv = value; -+ if ((nexti == values_length || j > nv.length || v != nv[0 .. j]) && -+ (lasti == values_length || j > lv.length || v != lv[0 .. j])) -+ { -+ result[v] = value; -+ } -+ } -+ result[value] = value; -+ lasti = i; -+ lv = value; - } - - return result; -@@ -3878,6 +3572,9 @@ unittest - { - debug(string) printf("string.abbrev.unittest\n"); - -+ // @@@BUG@@@ Built-in arr.sort is not CTFEable -+ //assertCTFEable!( -+ //{ - string[] values; - values ~= "hello"; - values ~= "hello"; -@@ -3899,6 +3596,7 @@ unittest - assert(r[keys[1]] == "hello"); - assert(r[keys[2]] == "hello"); - assert(r[keys[3]] == "hello"); -+ //}); - } - - -@@ -3907,7 +3605,7 @@ unittest - * leftmost column, which is numbered starting from 0. - */ - --size_t column(S)(S str, size_t tabsize = 8) if (isSomeString!S) -+size_t column(S)(S str, size_t tabsize = 8) @safe pure if (isSomeString!S) - { - size_t column; - -@@ -3938,11 +3636,14 @@ unittest - { - debug(string) printf("string.column.unittest\n"); - -- assert(column(cast(string) null) == 0); -+ assertCTFEable!( -+ { -+ assert(column(string.init) == 0); - assert(column("") == 0); - assert(column("\t") == 8); - assert(column("abc\t") == 8); - assert(column("12345678\t") == 16); -+ }); - } - - /****************************************** -@@ -3964,7 +3665,7 @@ unittest - */ - - S wrap(S)(S s, size_t columns = 80, S firstindent = null, -- S indent = null, size_t tabsize = 8) if (isSomeString!S) -+ S indent = null, size_t tabsize = 8) @safe pure if (isSomeString!S) - { - typeof(s.dup) result; - int spaces; -@@ -4025,22 +3726,23 @@ S wrap(S)(S s, size_t columns = 80, S fi - } - result ~= '\n'; - -- return assumeUnique(result); -+ return result; - } - - unittest - { - debug(string) printf("string.wrap.unittest\n"); - -- assert(wrap(cast(string) null) == "\n"); -+ assertCTFEable!( -+ { -+ assert(wrap(string.init) == "\n"); - assert(wrap(" a b df ") == "a b df\n"); -- //writefln("'%s'", wrap(" a b df ",3)); - assert(wrap(" a b df ", 3) == "a b\ndf\n"); - assert(wrap(" a bc df ", 3) == "a\nbc\ndf\n"); -- //writefln("'%s'", wrap(" abcd df ",3)); - assert(wrap(" abcd df ", 3) == "abcd\ndf\n"); - assert(wrap("x") == "x\n"); - assert(wrap("u u") == "u u\n"); -+ }); - } - - /****************************************** -@@ -4076,13 +3778,13 @@ unittest - * - */ - --S outdent(S)(S str) if(isSomeString!S) -+S outdent(S)(S str) @safe pure if(isSomeString!S) - { - return str.splitLines(KeepTerminator.yes).outdent().join(); - } - - /// ditto --S[] outdent(S)(S[] lines) if(isSomeString!S) -+S[] outdent(S)(S[] lines) @safe pure if(isSomeString!S) - { - if (lines.empty) - { -@@ -4111,7 +3813,8 @@ S[] outdent(S)(S[] lines) if(isSomeStrin - // because this function throws upon inconsistent indentation. - if (shortestIndent is null || indent.length < shortestIndent.length) - { -- if (indent.empty) return lines; -+ if (indent.empty) -+ return lines; - shortestIndent = indent; - } - } -@@ -4120,6 +3823,7 @@ S[] outdent(S)(S[] lines) if(isSomeStrin - foreach (i; 0..lines.length) - { - auto stripped = __ctfe? lines[i].ctfe_strip() : lines[i].strip(); -+ - if (stripped.empty) - { - // Do nothing -@@ -4130,8 +3834,10 @@ S[] outdent(S)(S[] lines) if(isSomeStrin - } - else - { -- if (__ctfe) assert(false, "outdent: Inconsistent indentation"); -- else throw new StringException("outdent: Inconsistent indentation"); -+ if (__ctfe) -+ assert(false, "outdent: Inconsistent indentation"); -+ else -+ throw new StringException("outdent: Inconsistent indentation"); - } - } - -@@ -4163,8 +3869,10 @@ private S ctfe_stripRight(S)(S str) if(i - return str[0..endIndex]; - } - --version(unittest) -+unittest - { -+ debug(string) printf("string.outdent.unittest\n"); -+ - template outdent_testStr(S) - { - enum S outdent_testStr = -@@ -4188,12 +3896,9 @@ version(unittest) - \t\tX - "; - } --} -- --unittest --{ -- debug(string) printf("string.outdent.unittest\n"); - -+ assertCTFEable!( -+ { - static assert(ctfe_strip(" \tHi \r\n") == "Hi"); - static assert(ctfe_strip(" \tHi©\u2028 \r\n") == "Hi©"); - static assert(ctfe_strip("Hi") == "Hi"); -@@ -4253,4 +3958,5 @@ unittest - assert(testStr6.outdent() == expected6); - static assert(testStr6.outdent() == expected6); - } -+ }); - } ---- a/src/libphobos/src/std/traits.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/traits.d 2014-04-01 16:32:51.000000000 +0100 -@@ -113,7 +113,9 @@ private - alias TypeTuple!(cfloat, cdouble, creal) ComplexTypeList; - alias TypeTuple!(IntegralTypeList, FloatingPointTypeList) NumericTypeList; - alias TypeTuple!(char, wchar, dchar) CharTypeList; -- -+} -+package -+{ - /* Get an expression typed as T, like T.init */ - template defaultInit(T) - { -@@ -122,18 +124,53 @@ private - else - @property T defaultInit(); - } -+ -+ // Add specific qualifier to the given type T -+ template MutableOf(T) { alias MutableOf = T ; } -+ template InoutOf(T) { alias InoutOf = inout(T) ; } -+ template ConstOf(T) { alias ConstOf = const(T) ; } -+ template SharedOf(T) { alias SharedOf = shared(T) ; } -+ template SharedInoutOf(T) { alias SharedInoutOf = shared(inout(T)); } -+ template SharedConstOf(T) { alias SharedConstOf = shared(const(T)); } -+ template ImmutableOf(T) { alias ImmutableOf = immutable(T) ; } -+ -+ unittest -+ { -+ static assert(is( MutableOf!int == int)); -+ static assert(is( InoutOf!int == inout int)); -+ static assert(is( ConstOf!int == const int)); -+ static assert(is( SharedOf!int == shared int)); -+ static assert(is(SharedInoutOf!int == shared inout int)); -+ static assert(is(SharedConstOf!int == shared const int)); -+ static assert(is( ImmutableOf!int == immutable int)); -+ } -+ -+ // Get qualifier template from the given type T -+ template QualifierOf(T) -+ { -+ static if (is(T == shared(const U), U)) alias QualifierOf = SharedConstOf; -+ else static if (is(T == const U , U)) alias QualifierOf = ConstOf; -+ else static if (is(T == shared(inout U), U)) alias QualifierOf = SharedInoutOf; -+ else static if (is(T == inout U , U)) alias QualifierOf = InoutOf; -+ else static if (is(T == immutable U , U)) alias QualifierOf = ImmutableOf; -+ else static if (is(T == shared U , U)) alias QualifierOf = SharedOf; -+ else alias QualifierOf = MutableOf; -+ } -+ -+ unittest -+ { -+ alias Qual1 = QualifierOf!( int); static assert(is(Qual1!long == long)); -+ alias Qual2 = QualifierOf!( inout int); static assert(is(Qual2!long == inout long)); -+ alias Qual3 = QualifierOf!( const int); static assert(is(Qual3!long == const long)); -+ alias Qual4 = QualifierOf!(shared int); static assert(is(Qual4!long == shared long)); -+ alias Qual5 = QualifierOf!(shared inout int); static assert(is(Qual5!long == shared inout long)); -+ alias Qual6 = QualifierOf!(shared const int); static assert(is(Qual6!long == shared const long)); -+ alias Qual7 = QualifierOf!( immutable int); static assert(is(Qual7!long == immutable long)); -+ } - } - - version(unittest) - { -- template MutableOf(T) { alias T MutableOf; } -- template ConstOf(T) { alias const(T) ConstOf; } -- template SharedOf(T) { alias shared(T) SharedOf; } -- template SharedConstOf(T) { alias shared(const(T)) SharedConstOf; } -- template ImmutableOf(T) { alias immutable(T) ImmutableOf; } -- template WildOf(T) { alias inout(T) WildOf; } -- template SharedWildOf(T) { alias shared(inout(T)) SharedWildOf; } -- - alias TypeTuple!(MutableOf, ConstOf, SharedOf, SharedConstOf, ImmutableOf) TypeQualifierList; - - struct SubTypeOf(T) -@@ -286,6 +323,11 @@ version(unittest) - - shared(immutable(Inner) delegate(ref double, scope string) const shared @trusted nothrow) attrDeleg; - } -+ -+ private enum QualifiedEnum -+ { -+ a = 42 -+ } - } - - private template fullyQualifiedNameImplForSymbols(alias T) -@@ -300,7 +342,7 @@ private template fullyQualifiedNameImplF - if(s.skipOver("package ") || s.skipOver("module ")) - return s; - return s.findSplit("(")[0]; -- }(T.stringof); -+ }(__traits(identifier, T)); - } - - unittest -@@ -313,6 +355,7 @@ unittest - alias fqn = fullyQualifiedName; - static assert(fqn!fqn == "std.traits.fullyQualifiedName"); - static assert(fqn!(QualifiedNameTests.Inner) == "std.traits.QualifiedNameTests.Inner"); -+ static assert(fqn!(QualifiedNameTests.func) == "std.traits.QualifiedNameTests.func"); - import core.sync.barrier; - static assert(fullyQualifiedName!Barrier == "core.sync.barrier.Barrier"); - } -@@ -449,11 +492,11 @@ private template fullyQualifiedNameImplF - { - enum fullyQualifiedNameImplForTypes = "dstring"; - } -- else static if (isBasicType!T || is(T == enum)) -+ else static if (isBasicType!T && !is(T == enum)) - { - enum fullyQualifiedNameImplForTypes = chain!((Unqual!T).stringof); - } -- else static if (isAggregateType!T) -+ else static if (isAggregateType!T || is(T == enum)) - { - enum fullyQualifiedNameImplForTypes = chain!(fullyQualifiedNameImplForSymbols!T); - } -@@ -537,6 +580,8 @@ unittest - - // Basic qualified name - static assert(fqn!(Inner) == inner_name); -+ static assert(fqn!(QualifiedEnum) == "std.traits.QualifiedEnum"); // type -+ static assert(fqn!(QualifiedEnum.a) == "std.traits.QualifiedEnum.a"); // symbol - - // Array types - static assert(fqn!(typeof(array)) == format("%s[]", inner_name)); -@@ -727,7 +772,7 @@ enum ParameterStorageClass : uint - * These flags can be bitwise OR-ed together to represent complex storage - * class. - */ -- none = 0, /// ditto -+ none = 0, - scope_ = 0b000_1, /// ditto - out_ = 0b001_0, /// ditto - ref_ = 0b010_0, /// ditto -@@ -826,18 +871,18 @@ static assert([ParameterIdentifierTuple! - template ParameterIdentifierTuple(func...) - if (func.length == 1 && isCallable!func) - { -- static if (is(typeof(func[0]) PT == __parameters)) -+ static if (is(FunctionTypeOf!func PT == __parameters)) - { - template Get(size_t i) - { -- enum Get = __traits(identifier, PT[i..i+1]); -- } -- } -- else static if (is(FunctionTypeOf!func PT == __parameters)) -- { -- template Get(size_t i) -- { -- enum Get = ""; -+ static if (!isFunctionPointer!func && !isDelegate!func) -+ { -+ enum Get = __traits(identifier, PT[i..i+1]); -+ } -+ else -+ { -+ enum Get = ""; -+ } - } - } - else -@@ -881,6 +926,17 @@ unittest - // might be changed in the future? - void delegate(int num, string name, int[long] aa) dg; - static assert([PIT!dg] == ["", "", ""]); -+ -+ interface Test -+ { -+ @property string getter(); -+ @property void setter(int a); -+ Test method(int a, long b, string c); -+ } -+ static assert([PIT!(Test.getter)] == []); -+ static assert([PIT!(Test.setter)] == ["a"]); -+ static assert([PIT!(Test.method)] == ["a", "b", "c"]); -+ - /+ - // depends on internal - void baw(int, string, int[]){} -@@ -909,7 +965,7 @@ static assert( ParameterDefaultValueTu - template ParameterDefaultValueTuple(func...) - if (func.length == 1 && isCallable!func) - { -- static if (is(typeof(func[0]) PT == __parameters)) -+ static if (is(FunctionTypeOf!(func[0]) PT == __parameters)) - { - template Get(size_t i) - { -@@ -973,6 +1029,12 @@ unittest - static assert( PDVT!baz[2] == "hello"); - static assert(is(typeof(PDVT!baz) == typeof(TypeTuple!(void, 1, "hello")))); - -+ // bug 10800 - property functions return empty string -+ @property void foo(int x = 3) { } -+ static assert(PDVT!foo.length == 1); -+ static assert(PDVT!foo[0] == 3); -+ static assert(is(typeof(PDVT!foo) == typeof(TypeTuple!(3)))); -+ - struct Colour - { - ubyte a,r,g,b; -@@ -1006,7 +1068,7 @@ enum FunctionAttribute : uint - /** - * These flags can be bitwise OR-ed together to represent complex attribute. - */ -- none = 0, /// ditto -+ none = 0, - pure_ = 0b00000001, /// ditto - nothrow_ = 0b00000010, /// ditto - ref_ = 0b00000100, /// ditto -@@ -1673,22 +1735,125 @@ unittest - // Aggregate Types - //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// - -+/** -+Determines whether $(D T) has its own context pointer. -+$(D T) must be either $(D class), $(D struct), or $(D union). -+*/ -+template isNested(T) -+ if(is(T == class) || is(T == struct) || is(T == union)) -+{ -+ enum isNested = __traits(isNested, T); -+} -+ -+/** -+Determines whether $(D T) or any of its representation types -+have a context pointer. -+*/ -+template hasNested(T) -+{ -+ static if(isStaticArray!T && T.length) -+ enum hasNested = hasNested!(typeof(T.init[0])); -+ else static if(is(T == class) || is(T == struct) || is(T == union)) -+ enum hasNested = isNested!T || -+ anySatisfy!(.hasNested, FieldTypeTuple!T); -+ else -+ enum hasNested = false; -+} -+ -+unittest -+{ -+ static assert(!__traits(compiles, isNested!int)); -+ static assert(!hasNested!int); -+ -+ static struct StaticStruct { } -+ static assert(!isNested!StaticStruct); -+ static assert(!hasNested!StaticStruct); -+ -+ int i; -+ struct NestedStruct { void f() { ++i; } } -+ static assert( isNested!NestedStruct); -+ static assert( hasNested!NestedStruct); -+ static assert( isNested!(immutable NestedStruct)); -+ static assert( hasNested!(immutable NestedStruct)); -+ -+ static assert(!__traits(compiles, isNested!(NestedStruct[1]))); -+ static assert( hasNested!(NestedStruct[1])); -+ static assert(!hasNested!(NestedStruct[0])); -+ -+ struct S1 { NestedStruct nested; } -+ static assert(!isNested!S1); -+ static assert( hasNested!S1); -+ -+ static struct S2 { NestedStruct nested; } -+ static assert(!isNested!S2); -+ static assert( hasNested!S2); -+ -+ static struct S3 { NestedStruct[0] nested; } -+ static assert(!isNested!S3); -+ static assert(!hasNested!S3); -+ -+ static union U { NestedStruct nested; } -+ static assert(!isNested!U); -+ static assert( hasNested!U); -+ -+ static class StaticClass { } -+ static assert(!isNested!StaticClass); -+ static assert(!hasNested!StaticClass); -+ -+ class NestedClass { void f() { ++i; } } -+ static assert( isNested!NestedClass); -+ static assert( hasNested!NestedClass); -+ static assert( isNested!(immutable NestedClass)); -+ static assert( hasNested!(immutable NestedClass)); -+ -+ static assert(!__traits(compiles, isNested!(NestedClass[1]))); -+ static assert( hasNested!(NestedClass[1])); -+ static assert(!hasNested!(NestedClass[0])); -+} -+ -+ - /*** -- * Get the types of the fields of a struct or class. -+ * Get as a typetuple the types of the fields of a struct, class, or union. - * This consists of the fields that take up memory space, - * excluding the hidden fields like the virtual function -- * table pointer. -+ * table pointer or a context pointer for nested types. -+ * If $(D T) isn't a struct, class, or union returns typetuple -+ * with one element $(D T). - */ - --template FieldTypeTuple(S) -+template FieldTypeTuple(T) - { -- static if (is(S == struct) || is(S == class) || is(S == union)) -- alias typeof(S.tupleof) FieldTypeTuple; -+ static if (is(T == struct) || is(T == union)) -+ alias typeof(T.tupleof[0 .. $ - isNested!T]) FieldTypeTuple; -+ else static if (is(T == class)) -+ alias typeof(T.tupleof) FieldTypeTuple; - else -- alias TypeTuple!S FieldTypeTuple; -- //static assert(0, "argument is not struct or class"); -+ alias TypeTuple!T FieldTypeTuple; - } - -+unittest -+{ -+ static assert(is(FieldTypeTuple!int == TypeTuple!int)); -+ -+ static struct StaticStruct1 { } -+ static assert(is(FieldTypeTuple!StaticStruct1 == TypeTuple!())); -+ -+ static struct StaticStruct2 { int a, b; } -+ static assert(is(FieldTypeTuple!StaticStruct2 == TypeTuple!(int, int))); -+ -+ int i; -+ -+ struct NestedStruct1 { void f() { ++i; } } -+ static assert(is(FieldTypeTuple!NestedStruct1 == TypeTuple!())); -+ -+ struct NestedStruct2 { int a; void f() { ++i; } } -+ static assert(is(FieldTypeTuple!NestedStruct2 == TypeTuple!int)); -+ -+ class NestedClass { int a; void f() { ++i; } } -+ static assert(is(FieldTypeTuple!NestedClass == TypeTuple!int)); -+} -+ -+ - // // FieldOffsetsTuple - // private template FieldOffsetsTupleImpl(size_t n, T...) - // { -@@ -2439,7 +2604,7 @@ unittest - - // void static array hides actual type of bits, so "may have indirections". - static assert( hasIndirections!(void[1])); -- interface I; -+ interface I {} - struct S1 {} - struct S2 { int a; } - struct S3 { int a; int b; } -@@ -2668,8 +2833,9 @@ unittest - /** - True if $(D S) or any type embedded directly in the representation of $(D S) - defines an elaborate copy constructor. Elaborate copy constructors are -- introduced by defining $(D this(this)) for a $(D struct). (Non-struct types -- never have elaborate copy constructors.) -+ introduced by defining $(D this(this)) for a $(D struct). -+ -+ Classes and unions never have elaborate copy constructors. - */ - template hasElaborateCopyConstructor(S) - { -@@ -2680,7 +2846,7 @@ template hasElaborateCopyConstructor(S) - else static if(is(S == struct)) - { - enum hasElaborateCopyConstructor = hasMember!(S, "__postblit") -- || anySatisfy!(.hasElaborateCopyConstructor, typeof(S.tupleof)); -+ || anySatisfy!(.hasElaborateCopyConstructor, FieldTypeTuple!S); - } - else - { -@@ -2715,21 +2881,30 @@ unittest - True if $(D S) or any type directly embedded in the representation of $(D S) - defines an elaborate assignment. Elaborate assignments are introduced by - defining $(D opAssign(typeof(this))) or $(D opAssign(ref typeof(this))) -- for a $(D struct). (Non-struct types never have elaborate assignments.) -+ for a $(D struct) or when there is a compiler-generated $(D opAssign) -+ (in case $(D S) has an elaborate copy constructor or destructor). -+ -+ Classes and unions never have elaborate assignments. -+ -+ Note: Structs with (possibly nested) postblit operator(s) will have a -+ hidden yet elaborate compiler generated assignement operator (unless -+ explicitly disabled). - */ - template hasElaborateAssign(S) - { -- static if(!is(S == struct)) -+ static if(isStaticArray!S && S.length) - { -- enum bool hasElaborateAssign = false; -+ enum bool hasElaborateAssign = hasElaborateAssign!(typeof(S.init[0])); -+ } -+ else static if(is(S == struct)) -+ { -+ enum hasElaborateAssign = is(typeof(S.init.opAssign(rvalueOf!S))) || -+ is(typeof(S.init.opAssign(lvalueOf!S))) || -+ anySatisfy!(.hasElaborateAssign, FieldTypeTuple!S); - } - else - { -- @property auto ref lvalueOf() { static S s = void; return s; } -- -- enum hasElaborateAssign = is(typeof(S.init.opAssign(S.init))) || -- is(typeof(S.init.opAssign(lvalueOf))) || -- anySatisfy!(.hasElaborateAssign, typeof(S.tupleof)); -+ enum bool hasElaborateAssign = false; - } - } - -@@ -2737,34 +2912,64 @@ unittest - { - static assert(!hasElaborateAssign!int); - -- struct S { void opAssign(S) {} } -+ static struct S { void opAssign(S) {} } - static assert( hasElaborateAssign!S); - static assert(!hasElaborateAssign!(const(S))); - -- struct S1 { void opAssign(ref S1) {} } -- struct S2 { void opAssign(S1) {} } -- struct S3 { S s; } -+ static struct S1 { void opAssign(ref S1) {} } -+ static struct S2 { void opAssign(int) {} } -+ static struct S3 { S s; } - static assert( hasElaborateAssign!S1); - static assert(!hasElaborateAssign!S2); - static assert( hasElaborateAssign!S3); -+ static assert( hasElaborateAssign!(S3[1])); -+ static assert(!hasElaborateAssign!(S3[0])); - -- struct S4 -+ static struct S4 - { - void opAssign(U)(U u) {} - @disable void opAssign(U)(ref U u); - } - static assert( hasElaborateAssign!S4); - -- struct S5 { @disable this(); this(int n){ s = S(); } S s; } -+ static struct S41 -+ { -+ void opAssign(U)(ref U u) {} -+ @disable void opAssign(U)(U u); -+ } -+ static assert( hasElaborateAssign!S41); -+ -+ static struct S5 { @disable this(); this(int n){ s = S(); } S s; } - static assert( hasElaborateAssign!S5); -+ -+ static struct S6 { this(this) {} } -+ static struct S7 { this(this) {} @disable void opAssign(S7); } -+ static struct S8 { this(this) {} @disable void opAssign(S8); void opAssign(int) {} } -+ static struct S9 { this(this) {} void opAssign(int) {} } -+ static struct S10 { ~this() { } } -+ static assert( hasElaborateAssign!S6); -+ static assert(!hasElaborateAssign!S7); -+ static assert(!hasElaborateAssign!S8); -+ static assert( hasElaborateAssign!S9); -+ static assert( hasElaborateAssign!S10); -+ static struct SS6 { S6 s; } -+ static struct SS7 { S7 s; } -+ static struct SS8 { S8 s; } -+ static struct SS9 { S9 s; } -+ static assert( hasElaborateAssign!SS6); -+ static assert( hasElaborateAssign!SS7); -+ static assert( hasElaborateAssign!SS8); -+ static assert( hasElaborateAssign!SS9); - } - - /** - True if $(D S) or any type directly embedded in the representation - of $(D S) defines an elaborate destructor. Elaborate destructors - are introduced by defining $(D ~this()) for a $(D -- struct). (Non-struct types never have elaborate destructors, even -- though classes may define $(D ~this()).) -+ struct). -+ -+ Classes and unions never have elaborate destructors, even -+ though classes may define $(D ~this()). - */ - template hasElaborateDestructor(S) - { -@@ -2775,7 +2980,7 @@ template hasElaborateDestructor(S) - else static if(is(S == struct)) - { - enum hasElaborateDestructor = hasMember!(S, "__dtor") -- || anySatisfy!(.hasElaborateDestructor, typeof(S.tupleof)); -+ || anySatisfy!(.hasElaborateDestructor, FieldTypeTuple!S); - } - else - { -@@ -2844,10 +3049,9 @@ unittest - static assert(isOutputRange!(OutputRange!int, int)); - } - --// Temporarily disabled until bug4617 is fixed. --version(none) unittest -+unittest - { -- // 8231 -+ // 8321 - struct S { - int x; - void f(){} -@@ -2888,6 +3092,12 @@ Returns: - The members are arranged in the same order as declared in $(D E). - - Note: -+ An enum can have multiple members which have the same value. If you want -+ to use EnumMembers to e.g. generate switch cases at compile-time, -+ you should use the $(XREF typetuple, NoDuplicates) template to avoid -+ generating duplicate switch cases. -+ -+Note: - Returned values are strictly typed with $(D E). Thus, the following code - does not work without the explicit cast: - -------------------- -@@ -3630,41 +3840,45 @@ unittest - Returns $(D true) iff a value of type $(D Rhs) can be assigned to a variable of - type $(D Lhs). - -+$(D isAssignable) returns whether both an lvalue and rvalue can be assigned. -+ - If you omit $(D Rhs), $(D isAssignable) will check identity assignable of $(D Lhs). -+*/ -+enum isAssignable(Lhs, Rhs = Lhs) = isRvalueAssignable!(Lhs, Rhs) && isLvalueAssignable!(Lhs, Rhs); - --Examples: ----- --static assert(isAssignable!(long, int)); --static assert(!isAssignable!(int, long)); --static assert( isAssignable!(const(char)[], string)); --static assert(!isAssignable!(string, char[])); -+/// -+unittest -+{ -+ static assert( isAssignable!(long, int)); -+ static assert(!isAssignable!(int, long)); -+ static assert( isAssignable!(const(char)[], string)); -+ static assert(!isAssignable!(string, char[])); - --// int is assignable to int --static assert( isAssignable!int); -+ // int is assignable to int -+ static assert( isAssignable!int); - --// immutable int is not assinable to immutable int --static assert(!isAssignable!(immutable int)); ----- --*/ --template isAssignable(Lhs, Rhs = Lhs) --{ -- enum bool isAssignable = is(typeof({ -- Lhs l = void; -- void f(Rhs r) { l = r; } -- return l; -- })); -+ // immutable int is not assinable to immutable int -+ static assert(!isAssignable!(immutable int)); - } - -+// ditto -+private enum isRvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = rvalueOf!Rhs); -+ -+// ditto -+private enum isLvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = lvalueOf!Rhs); -+ - unittest - { -- static assert( isAssignable!(long, int)); -- static assert( isAssignable!(const(char)[], string)); -+ static assert(!isAssignable!(immutable int, int)); -+ static assert( isAssignable!(int, immutable int)); - -- static assert(!isAssignable!(int, long)); -- static assert(!isAssignable!(string, char[])); -+ static assert(!isAssignable!(inout int, int)); -+ static assert( isAssignable!(int, inout int)); -+ static assert(!isAssignable!(inout int)); - -- static assert(!isAssignable!(immutable(int), int)); -- static assert( isAssignable!(int, immutable(int))); -+ static assert( isAssignable!(shared int, int)); -+ static assert( isAssignable!(int, shared int)); -+ static assert( isAssignable!(shared int)); - - struct S { @disable this(); this(int n){} } - static assert( isAssignable!(S, S)); -@@ -3682,17 +3896,14 @@ unittest - struct S4 { void opAssign(int); } - static assert( isAssignable!(S4, S4)); - static assert( isAssignable!(S4, int)); -- static assert( isAssignable!(S4, immutable(int))); -+ static assert( isAssignable!(S4, immutable int)); - - struct S5 { @disable this(); @disable this(this); } - struct S6 { void opAssign(in ref S5); } -- static assert( isAssignable!(S6, S5)); -- static assert( isAssignable!(S6, immutable(S5))); --} --unittest --{ -- static assert( isAssignable!int); -- static assert(!isAssignable!(immutable int)); -+ static assert(!isAssignable!(S6, S5)); -+ static assert(!isRvalueAssignable!(S6, S5)); -+ static assert( isLvalueAssignable!(S6, S5)); -+ static assert( isLvalueAssignable!(S6, immutable S5)); - } - - -@@ -3915,6 +4126,57 @@ unittest - } - - -+// Needed for rvalueOf/lvalueOf because "inout on return means -+// inout must be on a parameter as well" -+private struct __InoutWorkaroundStruct{} -+ -+/** -+Creates an lvalue or rvalue of type $(D T) for $(D typeof(...)) and -+$(D __traits(compiles, ...)) purposes. No actual value is returned. -+ -+Note: Trying to use returned value will result in a -+"Symbol Undefined" error at link time. -+ -+Examples: -+--- -+// Note that `f` doesn't have to be implemented -+// as is isn't called. -+int f(int); -+bool f(ref int); -+static assert(is(typeof(f(rvalueOf!int)) == int)); -+static assert(is(typeof(f(lvalueOf!int)) == bool)); -+ -+int i = rvalueOf!int; // error, no actual value is returned -+--- -+*/ -+@property T rvalueOf(T)(inout __InoutWorkaroundStruct = __InoutWorkaroundStruct.init); -+ -+/// ditto -+@property ref T lvalueOf(T)(inout __InoutWorkaroundStruct = __InoutWorkaroundStruct.init); -+ -+// Note: unittest can't be used as an example here as function overloads -+// aren't allowed inside functions. -+ -+unittest -+{ -+ void needLvalue(T)(ref T); -+ static struct S { } -+ int i; -+ struct Nested { void f() { ++i; } } -+ foreach(T; TypeTuple!(int, immutable int, inout int, string, S, Nested, Object)) -+ { -+ static assert(!__traits(compiles, needLvalue(rvalueOf!T))); -+ static assert( __traits(compiles, needLvalue(lvalueOf!T))); -+ static assert(is(typeof(rvalueOf!T) == T)); -+ static assert(is(typeof(lvalueOf!T) == T)); -+ } -+ -+ static assert(!__traits(compiles, rvalueOf!int = 1)); -+ static assert( __traits(compiles, lvalueOf!byte = 127)); -+ static assert(!__traits(compiles, lvalueOf!byte = 128)); -+} -+ -+ - //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// - // SomethingTypeOf - //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// -@@ -3942,17 +4204,18 @@ unittest - { - // unexpected failure, maybe dmd type-merging bug - foreach (T; TypeTuple!bool) -- foreach (Q; TypeQualifierList) -- { -- static assert( is(Q!T == BooleanTypeOf!( Q!T ))); -- static assert( is(Q!T == BooleanTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert( is(Q!T == BooleanTypeOf!( Q!T ))); -+ static assert( is(Q!T == BooleanTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(void, NumericTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(BooleanTypeOf!( Q!T )), Q!T.stringof); -- static assert(!is(BooleanTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(BooleanTypeOf!( Q!T )), Q!T.stringof); -+ static assert(!is(BooleanTypeOf!( SubTypeOf!(Q!T) ))); -+ } - } - - /* -@@ -3979,7 +4242,7 @@ template IntegralTypeOf(T) - immutable( char) idy( immutable( char) ); - immutable( wchar) idy( immutable( wchar) ); - immutable( dchar) idy( immutable( dchar) ); -- // Integrals and characers are impilcit convertible each other with value copy. -+ // Integrals and characers are implicitly convertible with each other for value copy. - // Then adding exact overloads to detect it. - immutable( byte) idy( immutable( byte) ); - immutable( ubyte) idy( immutable( ubyte) ); -@@ -4003,17 +4266,18 @@ template IntegralTypeOf(T) - unittest - { - foreach (T; IntegralTypeList) -- foreach (Q; TypeQualifierList) -- { -- static assert( is(Q!T == IntegralTypeOf!( Q!T ))); -- static assert( is(Q!T == IntegralTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert( is(Q!T == IntegralTypeOf!( Q!T ))); -+ static assert( is(Q!T == IntegralTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(void, bool, FloatingPointTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(IntegralTypeOf!( Q!T ))); -- static assert(!is(IntegralTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(IntegralTypeOf!( Q!T ))); -+ static assert(!is(IntegralTypeOf!( SubTypeOf!(Q!T) ))); -+ } - } - - /* -@@ -4044,17 +4308,18 @@ template FloatingPointTypeOf(T) - unittest - { - foreach (T; FloatingPointTypeList) -- foreach (Q; TypeQualifierList) -- { -- static assert( is(Q!T == FloatingPointTypeOf!( Q!T ))); -- static assert( is(Q!T == FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert( is(Q!T == FloatingPointTypeOf!( Q!T ))); -+ static assert( is(Q!T == FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(void, bool, IntegralTypeList, ImaginaryTypeList, ComplexTypeList, CharTypeList)) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(FloatingPointTypeOf!( Q!T ))); -- static assert(!is(FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(FloatingPointTypeOf!( Q!T ))); -+ static assert(!is(FloatingPointTypeOf!( SubTypeOf!(Q!T) ))); -+ } - } - - /* -@@ -4072,17 +4337,18 @@ template NumericTypeOf(T) - unittest - { - foreach (T; NumericTypeList) -- foreach (Q; TypeQualifierList) -- { -- static assert( is(Q!T == NumericTypeOf!( Q!T ))); -- static assert( is(Q!T == NumericTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert( is(Q!T == NumericTypeOf!( Q!T ))); -+ static assert( is(Q!T == NumericTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(void, bool, CharTypeList, ImaginaryTypeList, ComplexTypeList)) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(NumericTypeOf!( Q!T ))); -- static assert(!is(NumericTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(NumericTypeOf!( Q!T ))); -+ static assert(!is(NumericTypeOf!( SubTypeOf!(Q!T) ))); -+ } - } - - /* -@@ -4123,7 +4389,7 @@ template CharTypeOf(T) - immutable( char) idy( immutable( char) ); - immutable( wchar) idy( immutable( wchar) ); - immutable( dchar) idy( immutable( dchar) ); -- // Integrals and characers are impilcit convertible each other with value copy. -+ // Integrals and characers are implicitly convertible with each other for value copy. - // Then adding exact overloads to detect it. - immutable( byte) idy( immutable( byte) ); - immutable( ubyte) idy( immutable( ubyte) ); -@@ -4131,8 +4397,6 @@ template CharTypeOf(T) - immutable(ushort) idy( immutable(ushort) ); - immutable( int) idy( immutable( int) ); - immutable( uint) idy( immutable( uint) ); -- immutable( long) idy( immutable( long) ); -- immutable( ulong) idy( immutable( ulong) ); - - static if (is(T == enum)) - alias .CharTypeOf!(OriginalType!T) CharTypeOf; -@@ -4147,23 +4411,25 @@ template CharTypeOf(T) - unittest - { - foreach (T; CharTypeList) -- foreach (Q; TypeQualifierList) -- { -- static assert( is(CharTypeOf!( Q!T ))); -- static assert( is(CharTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert( is(CharTypeOf!( Q!T ))); -+ static assert( is(CharTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(void, bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(CharTypeOf!( Q!T ))); -- static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(CharTypeOf!( Q!T ))); -+ static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); -+ } -+ - foreach (T; TypeTuple!(string, wstring, dstring, char[4])) -- foreach (Q; TypeQualifierList) -- { -- static assert(!is(CharTypeOf!( Q!T ))); -- static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); -- } -+ foreach (Q; TypeQualifierList) -+ { -+ static assert(!is(CharTypeOf!( Q!T ))); -+ static assert(!is(CharTypeOf!( SubTypeOf!(Q!T) ))); -+ } - } - - /* -@@ -4183,20 +4449,21 @@ template StaticArrayTypeOf(T) - unittest - { - foreach (T; TypeTuple!(bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) -- foreach (Q; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- { -- static assert(is( Q!( T[1] ) == StaticArrayTypeOf!( Q!( T[1] ) ) )); -+ foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ { -+ static assert(is( Q!( T[1] ) == StaticArrayTypeOf!( Q!( T[1] ) ) )); -+ -+ foreach (P; TypeQualifierList) -+ { // SubTypeOf cannot have inout type -+ static assert(is( Q!(P!(T[1])) == StaticArrayTypeOf!( Q!(SubTypeOf!(P!(T[1]))) ) )); -+ } -+ } - -- foreach (P; TypeQualifierList) -- { // SubTypeOf cannot have inout type -- static assert(is( Q!(P!(T[1])) == StaticArrayTypeOf!( Q!(SubTypeOf!(P!(T[1]))) ) )); -- } -- } - foreach (T; TypeTuple!void) -- foreach (Q; TypeTuple!TypeQualifierList) -- { -- static assert(is( StaticArrayTypeOf!( Q!(void[1]) ) == Q!(void[1]) )); -- } -+ foreach (Q; TypeTuple!TypeQualifierList) -+ { -+ static assert(is( StaticArrayTypeOf!( Q!(void[1]) ) == Q!(void[1]) )); -+ } - } - - /* -@@ -4229,17 +4496,17 @@ template DynamicArrayTypeOf(T) - unittest - { - foreach (T; TypeTuple!(/*void, */bool, NumericTypeList, ImaginaryTypeList, ComplexTypeList)) -- foreach (Q; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- { -- static assert(is( Q!T[] == DynamicArrayTypeOf!( Q!T[] ) )); -- static assert(is( Q!(T[]) == DynamicArrayTypeOf!( Q!(T[]) ) )); -+ foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ { -+ static assert(is( Q!T[] == DynamicArrayTypeOf!( Q!T[] ) )); -+ static assert(is( Q!(T[]) == DynamicArrayTypeOf!( Q!(T[]) ) )); - -- foreach (P; TypeTuple!(MutableOf, ConstOf, ImmutableOf)) -- { -- static assert(is( Q!(P!T[]) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!T[])) ) )); -- static assert(is( Q!(P!(T[])) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!(T[]))) ) )); -- } -- } -+ foreach (P; TypeTuple!(MutableOf, ConstOf, ImmutableOf)) -+ { -+ static assert(is( Q!(P!T[]) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!T[])) ) )); -+ static assert(is( Q!(P!(T[])) == DynamicArrayTypeOf!( Q!(SubTypeOf!(P!(T[]))) ) )); -+ } -+ } - - static assert(!is(DynamicArrayTypeOf!(int[3]))); - static assert(!is(DynamicArrayTypeOf!(void[3]))); -@@ -4284,24 +4551,25 @@ template StringTypeOf(T) - unittest - { - foreach (T; CharTypeList) -- foreach (Q; TypeTuple!(MutableOf, ConstOf, ImmutableOf, WildOf)) -- { -- static assert(is(Q!T[] == StringTypeOf!( Q!T[] ))); -- -- static if (!__traits(isSame, Q, WildOf)) -+ foreach (Q; TypeTuple!(MutableOf, ConstOf, ImmutableOf, InoutOf)) - { -- static assert(is(Q!T[] == StringTypeOf!( SubTypeOf!(Q!T[]) ))); -+ static assert(is(Q!T[] == StringTypeOf!( Q!T[] ))); -+ -+ static if (!__traits(isSame, Q, InoutOf)) -+ { -+ static assert(is(Q!T[] == StringTypeOf!( SubTypeOf!(Q!T[]) ))); - -- alias Q!T[] Str; -- class C(Str) { Str val; alias val this; } -- static assert(is(StringTypeOf!(C!Str) == Str)); -+ alias Q!T[] Str; -+ class C(Str) { Str val; alias val this; } -+ static assert(is(StringTypeOf!(C!Str) == Str)); -+ } - } -- } -+ - foreach (T; CharTypeList) -- foreach (Q; TypeTuple!(SharedOf, SharedConstOf, SharedWildOf)) -- { -- static assert(!is(StringTypeOf!( Q!T[] ))); -- } -+ foreach (Q; TypeTuple!(SharedOf, SharedConstOf, SharedInoutOf)) -+ { -+ static assert(!is(StringTypeOf!( Q!T[] ))); -+ } - } - - /* -@@ -4330,7 +4598,6 @@ template AssocArrayTypeOf(T) - else static if (is(typeof(idz(defaultInit!T)) X)) - { - inout( V [K]) idzp(K, V)( inout( V [K]) ); -- inout( shared(V) [K]) idzp(K, V)( inout( shared(V) [K]) ); - inout( const(V) [K]) idzp(K, V)( inout( const(V) [K]) ); - inout(shared(const V) [K]) idzp(K, V)( inout(shared(const V) [K]) ); - inout( immutable(V) [K]) idzp(K, V)( inout( immutable(V) [K]) ); -@@ -4349,20 +4616,21 @@ template AssocArrayTypeOf(T) - unittest - { - foreach (T; TypeTuple!(int/*bool, CharTypeList, NumericTypeList, ImaginaryTypeList, ComplexTypeList*/)) -- foreach (P; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- foreach (Q; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- foreach (R; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- { -- static assert(is( P!(Q!T[R!T]) == AssocArrayTypeOf!( P!(Q!T[R!T]) ) )); -- } -+ foreach (P; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ foreach (Q; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ foreach (R; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ { -+ static assert(is( P!(Q!T[R!T]) == AssocArrayTypeOf!( P!(Q!T[R!T]) ) )); -+ } -+ - foreach (T; TypeTuple!(int/*bool, CharTypeList, NumericTypeList, ImaginaryTypeList, ComplexTypeList*/)) -- foreach (O; TypeTuple!(TypeQualifierList, WildOf, SharedWildOf)) -- foreach (P; TypeTuple!TypeQualifierList) -- foreach (Q; TypeTuple!TypeQualifierList) -- foreach (R; TypeTuple!TypeQualifierList) -- { -- static assert(is( O!(P!(Q!T[R!T])) == AssocArrayTypeOf!( O!(SubTypeOf!(P!(Q!T[R!T]))) ) )); -- } -+ foreach (O; TypeTuple!(TypeQualifierList, InoutOf, SharedInoutOf)) -+ foreach (P; TypeTuple!TypeQualifierList) -+ foreach (Q; TypeTuple!TypeQualifierList) -+ foreach (R; TypeTuple!TypeQualifierList) -+ { -+ static assert(is( O!(P!(Q!T[R!T])) == AssocArrayTypeOf!( O!(SubTypeOf!(P!(Q!T[R!T]))) ) )); -+ } - } - - /* -@@ -4899,10 +5167,13 @@ unittest - */ - template isExpressionTuple(T ...) - { -- static if (T.length > 0) -+ static if (T.length >= 2) - enum bool isExpressionTuple = -- !is(T[0]) && __traits(compiles, { auto ex = T[0]; }) && -- isExpressionTuple!(T[1 .. $]); -+ isExpressionTuple!(T[0 .. $/2]) && -+ isExpressionTuple!(T[$/2 .. $]); -+ else static if (T.length == 1) -+ enum bool isExpressionTuple = -+ !is(T[0]) && __traits(compiles, { auto ex = T[0]; }); - else - enum bool isExpressionTuple = true; // default - } -@@ -4932,8 +5203,10 @@ Detect whether tuple $(D T) is a type tu - */ - template isTypeTuple(T...) - { -- static if (T.length > 0) -- enum bool isTypeTuple = is(T[0]) && isTypeTuple!(T[1 .. $]); -+ static if (T.length >= 2) -+ enum bool isTypeTuple = isTypeTuple!(T[0 .. $/2]) && isTypeTuple!(T[$/2 .. $]); -+ else static if (T.length == 1) -+ enum bool isTypeTuple = is(T[0]); - else - enum bool isTypeTuple = true; // default - } -@@ -4993,25 +5266,42 @@ unittest - } - - /** --Detect whether $(D T) is a delegate. -+Detect whether symbol or type $(D T) is a delegate. - */ - template isDelegate(T...) -- if(T.length == 1) -+ if (T.length == 1) - { -- enum bool isDelegate = is(T[0] == delegate); -+ static if (is(typeof(& T[0]) U : U*) && is(typeof(& T[0]) U == delegate)) -+ { -+ // T is a (nested) function symbol. -+ enum bool isDelegate = true; -+ } -+ else static if (is(T[0] W) || is(typeof(T[0]) W)) -+ { -+ // T is an expression or a type. Take the type of it and examine. -+ enum bool isDelegate = is(W == delegate); -+ } -+ else -+ enum bool isDelegate = false; - } - - unittest - { -- static assert( isDelegate!(void delegate())); -- static assert( isDelegate!(uint delegate(uint))); -- static assert( isDelegate!(shared uint delegate(uint))); -+ static void sfunc() { } -+ int x; -+ void func() { x++; } - -- static assert(!isDelegate!uint); -- static assert(!isDelegate!(void function())); -+ int delegate() dg; -+ assert(isDelegate!dg); -+ assert(isDelegate!(int delegate())); -+ assert(isDelegate!(typeof(&func))); -+ -+ int function() fp; -+ assert(!isDelegate!fp); -+ assert(!isDelegate!(int function())); -+ assert(!isDelegate!(typeof(&sfunc))); - } - -- - /** - Detect whether symbol or type $(D T) is a function, a function pointer or a delegate. - */ -@@ -5150,6 +5440,22 @@ unittest - } - - /** -+Determines whether function $(D f) requires a context pointer. -+*/ -+template isNestedFunction(alias f) -+{ -+ enum isNestedFunction = __traits(isNested, f); -+} -+ -+unittest -+{ -+ static void f() { } -+ void g() { } -+ static assert(!isNestedFunction!f); -+ static assert( isNestedFunction!g); -+} -+ -+/** - * Detect whether $(D T) is a an abstract class. - */ - template isAbstractClass(T...) -@@ -5217,10 +5523,11 @@ template Unqual(T) - } - else // workaround - { -- static if (is(T U == shared(const U))) alias U Unqual; -+ static if (is(T U == shared(inout U))) alias U Unqual; -+ else static if (is(T U == shared(const U))) alias U Unqual; -+ else static if (is(T U == inout U )) alias U Unqual; - else static if (is(T U == const U )) alias U Unqual; - else static if (is(T U == immutable U )) alias U Unqual; -- else static if (is(T U == inout U )) alias U Unqual; - else static if (is(T U == shared U )) alias U Unqual; - else alias T Unqual; - } -@@ -5228,12 +5535,13 @@ template Unqual(T) - - unittest - { -- static assert(is(Unqual!int == int)); -- static assert(is(Unqual!(const int) == int)); -- static assert(is(Unqual!(immutable int) == int)); -- static assert(is(Unqual!(inout int) == int)); -- static assert(is(Unqual!(shared int) == int)); -- static assert(is(Unqual!(shared(const int)) == int)); -+ static assert(is(Unqual!( int) == int)); -+ static assert(is(Unqual!( const int) == int)); -+ static assert(is(Unqual!( inout int) == int)); -+ static assert(is(Unqual!( immutable int) == int)); -+ static assert(is(Unqual!( shared int) == int)); -+ static assert(is(Unqual!(shared const int) == int)); -+ static assert(is(Unqual!(shared inout int) == int)); - alias immutable(int[]) ImmIntArr; - static assert(is(Unqual!ImmIntArr == immutable(int)[])); - } -@@ -5241,7 +5549,9 @@ unittest - // [For internal use] - private template ModifyTypePreservingSTC(alias Modifier, T) - { -- static if (is(T U == shared(const U))) alias shared(const Modifier!U) ModifyTypePreservingSTC; -+ static if (is(T U == shared(inout U))) alias shared(inout Modifier!U) ModifyTypePreservingSTC; -+ else static if (is(T U == shared(const U))) alias shared(const Modifier!U) ModifyTypePreservingSTC; -+ else static if (is(T U == inout U )) alias inout(Modifier!U) ModifyTypePreservingSTC; - else static if (is(T U == const U )) alias const(Modifier!U) ModifyTypePreservingSTC; - else static if (is(T U == immutable U )) alias immutable(Modifier!U) ModifyTypePreservingSTC; - else static if (is(T U == shared U )) alias shared(Modifier!U) ModifyTypePreservingSTC; -@@ -5250,10 +5560,13 @@ private template ModifyTypePreservingSTC - - unittest - { -- static assert(is(ModifyTypePreservingSTC!(Intify, const real) == const int)); -- static assert(is(ModifyTypePreservingSTC!(Intify, immutable real) == immutable int)); -- static assert(is(ModifyTypePreservingSTC!(Intify, shared real) == shared int)); -- static assert(is(ModifyTypePreservingSTC!(Intify, shared(const real)) == shared(const int))); -+ static assert(is(ModifyTypePreservingSTC!(Intify, real) == int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, shared real) == shared int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, immutable real) == immutable int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, const real) == const int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, inout real) == inout int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, shared const real) == shared const int)); -+ static assert(is(ModifyTypePreservingSTC!(Intify, shared inout real) == shared inout int)); - } - version (unittest) private template Intify(T) { alias int Intify; } - -@@ -5426,13 +5739,13 @@ template Largest(T...) if(T.length >= 1) - } - else - { -- alias Largest!(Largest!(T[0], T[1]), T[2..$]) Largest; -+ alias Largest!(Largest!(T[0 .. $/2]), Largest!(T[$/2 .. $])) Largest; - } - } - - unittest - { -- static assert(is(Largest!(uint, ubyte, ulong, real) == real)); -+ static assert(is(Largest!(uint, ubyte, ushort, real) == real)); - static assert(is(Largest!(ulong, double) == ulong)); - static assert(is(Largest!(double, ulong) == double)); - static assert(is(Largest!(uint, byte, double, short) == double)); -@@ -5473,78 +5786,20 @@ unittest - static assert(is(S3 == immutable(int))); - } - --/** -- * Returns the corresponding unsigned value for $(D x), e.g. if $(D x) -- * has type $(D int), returns $(D cast(uint) x). The advantage -- * compared to the cast is that you do not need to rewrite the cast if -- * $(D x) later changes type to e.g. $(D long). -- */ --auto unsigned(T)(T x) if (isIntegral!T) --{ -- static if (is(Unqual!T == byte )) return cast(ubyte ) x; -- else static if (is(Unqual!T == short)) return cast(ushort) x; -- else static if (is(Unqual!T == int )) return cast(uint ) x; -- else static if (is(Unqual!T == long )) return cast(ulong ) x; -- else -- { -- static assert(T.min == 0, "Bug in either unsigned or isIntegral"); -- return cast(Unqual!T) x; -- } --} - --unittest --{ -- foreach(T; TypeTuple!(byte, ubyte)) -- { -- static assert(is(typeof(unsigned(cast(T)1)) == ubyte)); -- static assert(is(typeof(unsigned(cast(const T)1)) == ubyte)); -- static assert(is(typeof(unsigned(cast(immutable T)1)) == ubyte)); -- } -+// Remove import when unsigned is removed. -+import std.conv; - -- foreach(T; TypeTuple!(short, ushort)) -- { -- static assert(is(typeof(unsigned(cast(T)1)) == ushort)); -- static assert(is(typeof(unsigned(cast(const T)1)) == ushort)); -- static assert(is(typeof(unsigned(cast(immutable T)1)) == ushort)); -- } -+// Purposefully undocumented. Will be removed in June 2014. -+deprecated("unsigned has been moved to std.conv. Please adjust your imports accordingly.") -+alias std.conv.unsigned unsigned; - -- foreach(T; TypeTuple!(int, uint)) -- { -- static assert(is(typeof(unsigned(cast(T)1)) == uint)); -- static assert(is(typeof(unsigned(cast(const T)1)) == uint)); -- static assert(is(typeof(unsigned(cast(immutable T)1)) == uint)); -- } -- -- foreach(T; TypeTuple!(long, ulong)) -- { -- static assert(is(typeof(unsigned(cast(T)1)) == ulong)); -- static assert(is(typeof(unsigned(cast(const T)1)) == ulong)); -- static assert(is(typeof(unsigned(cast(immutable T)1)) == ulong)); -- } --} -- --auto unsigned(T)(T x) if (isSomeChar!T) --{ -- // All characters are unsigned -- static assert(T.min == 0); -- return cast(Unqual!T) x; --} -- --unittest --{ -- foreach(T; TypeTuple!(char, wchar, dchar)) -- { -- static assert(is(typeof(unsigned(cast(T)'A')) == T)); -- static assert(is(typeof(unsigned(cast(const T)'A')) == T)); -- static assert(is(typeof(unsigned(cast(immutable T)'A')) == T)); -- } --} - - /** - Returns the most negative value of the numeric type T. - */ - template mostNegative(T) -- if(isNumeric!T || isSomeChar!T) -+ if(isNumeric!T || isSomeChar!T || isBoolean!T) - { - static if (is(typeof(T.min_normal))) - enum mostNegative = -T.max; -@@ -5559,8 +5814,9 @@ unittest - static assert(mostNegative!float == -float.max); - static assert(mostNegative!double == -double.max); - static assert(mostNegative!real == -real.max); -+ static assert(mostNegative!bool == false); - -- foreach(T; TypeTuple!(byte, short, int, long)) -+ foreach(T; TypeTuple!(bool, byte, short, int, long)) - static assert(mostNegative!T == T.min); - - foreach(T; TypeTuple!(ubyte, ushort, uint, ulong, char, wchar, dchar)) -@@ -5675,10 +5931,12 @@ unittest - // Test for bug 5718 - import std.demangle; - int foo; -- assert(demangle(mangledName!foo)[$-7 .. $] == "int foo"); -+ auto foo_demangled = demangle(mangledName!foo); -+ assert(foo_demangled[0 .. 4] == "int " && foo_demangled[$-3 .. $] == "foo"); - - void bar(){} -- assert(demangle(mangledName!bar)[$-10 .. $] == "void bar()"); -+ auto bar_demangled = demangle(mangledName!bar); -+ assert(bar_demangled[0 .. 5] == "void " && bar_demangled[$-5 .. $] == "bar()"); - } - - -@@ -5686,24 +5944,28 @@ unittest - // XXX Select & select should go to another module. (functional or algorithm?) - - /** --Aliases itself to $(D T) if the boolean $(D condition) is $(D true) --and to $(D F) otherwise. -- --Example: ------ --alias Select!(size_t.sizeof == 4, int, long) Int; ------ -+Aliases itself to $(D T[0]) if the boolean $(D condition) is $(D true) -+and to $(D T[1]) otherwise. - */ --template Select(bool condition, T, F) -+template Select(bool condition, T...) if (T.length == 2) - { -- static if (condition) alias T Select; -- else alias F Select; -+ alias Select = T[!condition]; - } - -+/// - unittest - { -+ // can select types - static assert(is(Select!(true, int, long) == int)); - static assert(is(Select!(false, int, long) == long)); -+ -+ // can select symbols -+ int a = 1; -+ int b = 2; -+ alias selA = Select!(true, a, b); -+ alias selB = Select!(false, a, b); -+ assert(selA == 1); -+ assert(selB == 2); - } - - /** ---- a/src/libphobos/src/std/typecons.d 2013-06-02 11:37:56.000000000 +0100 -+++ b/src/libphobos/src/std/typecons.d 2014-04-01 16:32:51.000000000 +0100 -@@ -45,7 +45,7 @@ Authors: $(WEB erdani.org, Andrei Alex - module std.typecons; - import core.memory, core.stdc.stdlib; - import std.algorithm, std.array, std.conv, std.exception, std.format, -- std.metastrings, std.traits, std.typetuple, std.range; -+ std.string, std.traits, std.typetuple, std.range; - - debug(Unique) import std.stdio; - -@@ -268,10 +268,8 @@ Tuple!(int, int) point2; - assert(!is(typeof(point1) == typeof(point2))); // passes - ---- - */ --struct Tuple(Specs...) -+template Tuple(Specs...) - { --private: -- - // Parse (type,name) pairs (FieldSpecs) out of the specified - // arguments. Some fields would have name, others not. - template parseSpecs(Specs...) -@@ -318,16 +316,15 @@ private: - // : - // NOTE: field[k] is an expression (which yields a symbol of a - // variable) and can't be aliased directly. -- static string injectNamedFields() -+ string injectNamedFields() - { - string decl = ""; - foreach (i, name; staticMap!(extractName, fieldSpecs)) - { -- enum numbered = toStringNow!(i); -- decl ~= "alias Identity!(field[" ~ numbered ~ "]) _" ~ numbered ~ ";"; -+ decl ~= format("alias Identity!(field[%s]) _%s;", i, i); - if (name.length != 0) - { -- decl ~= "alias _" ~ numbered ~ " " ~ name ~ ";"; -+ decl ~= format("alias _%s %s;", i, name); - } - } - return decl; -@@ -353,206 +350,229 @@ private: - } - } - -- template defaultInit(T) -- { -- static if (!is(typeof({ T v = void; }))) // inout(U) and others -- @property T defaultInit(T v = T.init); -- else -- @property T defaultInit(); -- } -- template isCompatibleTuples(Tup1, Tup2, string op) -+ template areCompatibleTuples(Tup1, Tup2, string op) - { -- enum isCompatibleTuples = is(typeof( -+ enum areCompatibleTuples = isTuple!Tup2 && is(typeof( - { - Tup1 tup1 = void; - Tup2 tup2 = void; - static assert(tup1.field.length == tup2.field.length); - foreach (i, _; Tup1.Types) - { -- // this doesn't work if typeof(tup1.field[i]) == const(int) -- //typeof(tup1.field[i]) lhs = void; -- //typeof(tup2.field[i]) rhs = void; -- auto lhs = defaultInit!(typeof(tup1.field[i])); // workaround -- auto rhs = defaultInit!(typeof(tup2.field[i])); -+ auto lhs = typeof(tup1.field[i]).init; -+ auto rhs = typeof(tup2.field[i]).init; - auto result = mixin("lhs "~op~" rhs"); - } - })); - } - --public: --/** -- The type of the tuple's components. --*/ -- alias staticMap!(extractType, fieldSpecs) Types; -+ struct Tuple -+ { -+ /** -+ * The type of the tuple's components. -+ */ -+ alias staticMap!(extractType, fieldSpecs) Types; - -- Types field; -- mixin(injectNamedFields()); -- alias field expand; -- alias field this; -+ /** -+ * Use $(D t.expand) for a tuple $(D t) to expand it into its -+ * components. The result of $(D expand) acts as if the tuple components -+ * were listed as a list of values. (Ordinarily, a $(D Tuple) acts as a -+ * single value.) -+ * -+ * Examples: -+ * ---- -+ * auto t = tuple(1, " hello ", 2.3); -+ * writeln(t); // Tuple!(int, string, double)(1, " hello ", 2.3) -+ * writeln(t.expand); // 1 hello 2.3 -+ * ---- -+ */ -+ Types expand; -+ mixin(injectNamedFields()); - -- // This mitigates breakage of old code now that std.range.Zip uses -- // Tuple instead of the old Proxy. It's intentionally lacking ddoc -- // because it was intended for deprecation. -- // Now that it has been deprecated, it will be removed in January 2013. -- deprecated auto at(size_t index)() { -- return field[index]; -- } -+ static if (is(Specs)) -+ { -+ // This is mostly to make t[n] work. -+ alias expand this; -+ } -+ else -+ { -+ @property -+ ref inout(Tuple!Types) _Tuple_super() inout @trusted -+ { -+ foreach (i, _; Types) // Rely on the field layout -+ { -+ static assert(typeof(return).init.tupleof[i].offsetof == -+ expand[i].offsetof); -+ } -+ return *cast(typeof(return)*) &(field[0]); -+ } -+ // This is mostly to make t[n] work. -+ alias _Tuple_super this; -+ } - --/** -- Constructor taking one value for each field. Each argument must be -- implicitly assignable to the respective element of the target. -- */ -- this(U...)(U values) if (U.length == Types.length) -- { -- foreach (i, Unused; Types) -+ // backwards compatibility -+ alias field = expand; -+ -+ /** -+ * Constructor taking one value for each field. Each argument must be -+ * implicitly assignable to the respective element of the target. -+ */ -+ this()(Types values) - { -- field[i] = values[i]; -+ field[] = values[]; - } -- } - --/** -- Constructor taking a compatible tuple. Each element of the source -- must be implicitly assignable to the respective element of the -- target. -- */ -- this(U)(U another) -- if (isTuple!U && isCompatibleTuples!(typeof(this), U, "=")) -- { -- foreach (i, T; Types) -+ /** -+ * Constructor taking a compatible array. The array element type must -+ * be implicitly assignable to each element of the target. -+ * -+ * Examples: -+ * ---- -+ * int[2] ints; -+ * Tuple!(int, int) t = ints; -+ * ---- -+ */ -+ this(U, size_t n)(U[n] values) -+ if (n == Types.length && -+ is(typeof({ foreach (i, _; Types) field[i] = values[i]; }))) - { -- field[i] = another.field[i]; -+ foreach (i, _; Types) -+ { -+ field[i] = values[i]; -+ } - } -- } - --/** -- Comparison for equality. -- */ -- bool opEquals(R)(R rhs) -- if (isTuple!R && isCompatibleTuples!(typeof(this), R, "==")) -- { -- foreach (i, Unused; Types) -+ /** -+ * Constructor taking a compatible tuple. Each element of the source -+ * must be implicitly assignable to the respective element of the -+ * target. -+ */ -+ this(U)(U another) -+ if (areCompatibleTuples!(typeof(this), U, "=")) - { -- if (field[i] != rhs.field[i]) return false; -+ field[] = another.field[]; - } -- return true; -- } -- /// ditto -- bool opEquals(R)(R rhs) const -- if (isTuple!R && isCompatibleTuples!(typeof(this), R, "==")) -- { -- foreach (i, Unused; Types) -+ -+ /** -+ * Comparison for equality. -+ */ -+ bool opEquals(R)(R rhs) -+ if (areCompatibleTuples!(typeof(this), R, "==")) - { -- if (field[i] != rhs.field[i]) return false; -+ return field[] == rhs.field[]; -+ } -+ /// ditto -+ bool opEquals(R)(R rhs) const -+ if (areCompatibleTuples!(typeof(this), R, "==")) -+ { -+ return field[] == rhs.field[]; - } -- return true; -- } - --/** -- Comparison for ordering. -- */ -- int opCmp(R)(R rhs) -- if (isTuple!R && isCompatibleTuples!(typeof(this), R, "<")) -- { -- foreach (i, Unused; Types) -+ /** -+ * Comparison for ordering. -+ */ -+ int opCmp(R)(R rhs) -+ if (areCompatibleTuples!(typeof(this), R, "<")) - { -- if (field[i] != rhs.field[i]) -+ foreach (i, Unused; Types) - { -- return field[i] < rhs.field[i] ? -1 : 1; -+ if (field[i] != rhs.field[i]) -+ { -+ return field[i] < rhs.field[i] ? -1 : 1; -+ } - } -+ return 0; - } -- return 0; -- } -- /// ditto -- int opCmp(R)(R rhs) const -- if (isTuple!R && isCompatibleTuples!(typeof(this), R, "<")) -- { -- foreach (i, Unused; Types) -+ /// ditto -+ int opCmp(R)(R rhs) const -+ if (areCompatibleTuples!(typeof(this), R, "<")) - { -- if (field[i] != rhs.field[i]) -+ foreach (i, Unused; Types) - { -- return field[i] < rhs.field[i] ? -1 : 1; -+ if (field[i] != rhs.field[i]) -+ { -+ return field[i] < rhs.field[i] ? -1 : 1; -+ } - } -+ return 0; - } -- return 0; -- } - --/** -- Assignment from another tuple. Each element of the source must be -- implicitly assignable to the respective element of the target. -- */ -- void opAssign(R)(R rhs) -- if (isTuple!R && allSatisfy!(isAssignable, Types)) -- { -- static assert(field.length == rhs.field.length, -- "Length mismatch in attempting to assign a " -- ~ R.stringof ~" to a "~ typeof(this).stringof); -- // Do not swap; opAssign should be called on the fields. -- foreach (i, Unused; Types) -+ /** -+ * Assignment from another tuple. Each element of the source must be -+ * implicitly assignable to the respective element of the target. -+ */ -+ void opAssign(R)(auto ref R rhs) -+ if (areCompatibleTuples!(typeof(this), R, "=")) - { -- field[i] = rhs.field[i]; -+ static if (is(R : Tuple!Types) && !__traits(isRef, rhs)) -+ { -+ if (__ctfe) -+ { -+ // Cannot use swap at compile time -+ field[] = rhs.field[]; -+ } -+ else -+ { -+ // Use swap-and-destroy to optimize rvalue assignment -+ swap!(Tuple!Types)(this, rhs); -+ } -+ } -+ else -+ { -+ // Do not swap; opAssign should be called on the fields. -+ field[] = rhs.field[]; -+ } - } -- } -- -- // @@@BUG4424@@@ workaround -- private mixin template _workaround4424() -- { -- @disable void opAssign(typeof(this) ); -- } -- mixin _workaround4424; -- --/** -- Takes a slice of the tuple. -- -- Example: -- ------ --Tuple!(int, string, float, double) a; --a[1] = "abc"; --a[2] = 4.5; --auto s = a.slice!(1, 3); --static assert(is(typeof(s) == Tuple!(string, float))); --assert(s[0] == "abc" && s[1] == 4.5); ------ -- */ -- @property -- ref Tuple!(sliceSpecs!(from, to)) slice(uint from, uint to)() -- { -- return *cast(typeof(return) *) &(field[from]); -- } -- --/** -- The length of the tuple. -- */ -- enum length = field.length; - --/** -- Converts to string. -- */ -- string toString() -- { -- enum header = typeof(this).stringof ~ "(", -- footer = ")", -- separator = ", "; -+ /** -+ * Takes a slice of the tuple. -+ * -+ * Examples: -+ * ---- -+ * Tuple!(int, string, float, double) a; -+ * a[1] = "abc"; -+ * a[2] = 4.5; -+ * auto s = a.slice!(1, 3); -+ * static assert(is(typeof(s) == Tuple!(string, float))); -+ * assert(s[0] == "abc" && s[1] == 4.5); -+ * ---- -+ */ -+ @property -+ ref Tuple!(sliceSpecs!(from, to)) slice(size_t from, size_t to)() @trusted -+ if (from <= to && to <= Types.length) -+ { -+ return *cast(typeof(return)*) &(field[from]); -+ } - -- Appender!string app; -- app.put(header); -- foreach (i, Unused; Types) -+ /** -+ * Converts to string. -+ */ -+ string toString() - { -- static if (i > 0) -- { -- app.put(separator); -- } -- // TODO: Change this once toString() works for shared objects. -- static if (is(Unused == class) && is(Unused == shared)) -- formattedWrite(app, "%s", field[i].stringof); -- else -+ enum header = typeof(this).stringof ~ "(", -+ footer = ")", -+ separator = ", "; -+ -+ Appender!string w; -+ w.put(header); -+ foreach (i, Unused; Types) - { -- FormatSpec!char f; // "%s" -- formatElement(app, field[i], f); -+ static if (i > 0) -+ { -+ w.put(separator); -+ } -+ // TODO: Change this once toString() works for shared objects. -+ static if (is(Unused == class) && is(Unused == shared)) -+ formattedWrite(w, "%s", field[i].stringof); -+ else -+ { -+ FormatSpec!char f; // "%s" -+ formatElement(w, field[i], f); -+ } - } -+ w.put(footer); -+ return w.data; - } -- app.put(footer); -- return app.data; - } - } - -@@ -708,6 +728,11 @@ unittest - alias Tuple!(const(int)) T; - auto t2 = T(1); - } -+ // 9431 -+ { -+ alias T = Tuple!(int[1][]); -+ auto t = T([[10]]); -+ } - } - unittest - { -@@ -779,6 +804,45 @@ unittest - static assert( is(typeof(tc4 < tm4))); - static assert( is(typeof(tc4 < tc4))); - } -+ { -+ int[2] ints = [ 1, 2 ]; -+ Tuple!(int, int) t = ints; -+ assert(t[0] == 1 && t[1] == 2); -+ Tuple!(long, uint) t2 = ints; -+ assert(t2[0] == 1 && t2[1] == 2); -+ } -+} -+@safe unittest -+{ -+ auto t1 = Tuple!(int, "x", string, "y")(1, "a"); -+ assert(t1.x == 1); -+ assert(t1.y == "a"); -+ void foo(Tuple!(int, string) t2) {} -+ foo(t1); -+ -+ Tuple!(int, int)[] arr; -+ arr ~= tuple(10, 20); // OK -+ arr ~= Tuple!(int, "x", int, "y")(10, 20); // NG -> OK -+ -+ static assert(is(typeof(Tuple!(int, "x", string, "y").tupleof) == -+ typeof(Tuple!(int, string ).tupleof))); -+} -+unittest -+{ -+ // Bugzilla 10686 -+ immutable Tuple!(int) t1; -+ auto r1 = t1[0]; // OK -+ immutable Tuple!(int, "x") t2; -+ auto r2 = t2[0]; // error -+} -+unittest -+{ -+ // Bugzilla 10218 -+ assertCTFEable!( -+ { -+ auto t = tuple(1); -+ t = tuple(2); // assignment -+ }); - } - - /** -@@ -844,7 +908,7 @@ $(D Rebindable!(T)) does not compile if - Regular $(D const) object references cannot be reassigned: - - ---- --class Widget { int x; int y() const { return a; } } -+class Widget { int x; int y() const { return x; } } - const a = new Widget; - a.y(); // fine - a.x = 5; // error! can't modify const a -@@ -1038,7 +1102,8 @@ string alignForSize(E...)(string[] names - - string[7] declaration = ["", "", "", "", "", "", ""]; - -- foreach (i, T; E) { -+ foreach (i, T; E) -+ { - auto a = T.alignof; - auto k = a>=64? 0 : a>=32? 1 : a>=16? 2 : a>=8? 3 : a>=4? 4 : a>=2? 5 : 6; - declaration[k] ~= T.stringof ~ " " ~ names[i] ~ ";\n"; -@@ -1050,28 +1115,21 @@ string alignForSize(E...)(string[] names - return s; - } - --unittest { -+unittest -+{ - enum x = alignForSize!(int[], char[3], short, double[5])("x", "y","z", "w"); -- struct Foo{ int x; } -- enum y = alignForSize!(ubyte, Foo, cdouble)("x", "y","z"); -+ struct Foo { int x; } -+ enum y = alignForSize!(ubyte, Foo, cdouble)("x", "y", "z"); - -- static if(size_t.sizeof == uint.sizeof) -- { -- enum passNormalX = x == "double[5u] w;\nint[] x;\nshort z;\nchar[3u] y;\n"; -- enum passNormalY = y == "cdouble z;\nFoo y;\nubyte x;\n"; -+ enum passNormalX = x == "double[5] w;\nint[] x;\nshort z;\nchar[3] y;\n"; -+ enum passNormalY = y == "cdouble z;\nFoo y;\nubyte x;\n"; - -- enum passAbnormalX = x == "int[] x;\ndouble[5u] w;\nshort z;\nchar[3u] y;\n"; -- enum passAbnormalY = y == "Foo y;\ncdouble z;\nubyte x;\n"; -- // ^ blame http://d.puremagic.com/issues/show_bug.cgi?id=231 -+ enum passAbnormalX = x == "int[] x;\ndouble[5] w;\nshort z;\nchar[3] y;\n"; -+ enum passAbnormalY = y == "Foo y;\ncdouble z;\nubyte x;\n"; -+ // ^ blame http://d.puremagic.com/issues/show_bug.cgi?id=231 - -- static assert(passNormalX || double.alignof <= (int[]).alignof && passAbnormalX); -- static assert(passNormalY || double.alignof <= int.alignof && passAbnormalY); -- } -- else -- { -- static assert(x == "int[] x;\ndouble[5LU] w;\nshort z;\nchar[3LU] y;\n"); -- static assert(y == "cdouble z;\nFoo y;\nubyte x;\n"); -- } -+ static assert(passNormalX || passAbnormalX && double.alignof <= (int[]).alignof); -+ static assert(passNormalY || passAbnormalY && double.alignof <= int.alignof); - } - - /*--* -@@ -1131,7 +1189,8 @@ struct Nullable(T) - /** - Constructor initializing $(D this) with $(D value). - */ -- this()(T value) -+ //this()(inout T value) inout // proper signature -+ this(U:T)(inout U value) inout // workaround for BUG 10313 - { - _value = value; - _isNull = false; -@@ -1154,13 +1213,6 @@ Forces $(D this) to the null state. - _isNull = true; - } - -- //@@@BUG4424@@@ -- private mixin template _workaround4424() -- { -- @disable void opAssign(ref const Nullable); -- } -- mixin _workaround4424; -- - /** - Assigns $(D value) to the internally-held state. If the assignment - succeeds, $(D this) becomes non-null. -@@ -1172,19 +1224,19 @@ succeeds, $(D this) becomes non-null. - } - - /** --Gets the value. Throws an exception if $(D this) is in the null --state. This function is also called for the implicit conversion to $(D --T). -+Gets the value. $(D this) must not be in the null state. -+This function is also called for the implicit conversion to $(D T). - */ -- @property ref inout(T) get() inout pure @safe -+ @property ref inout(T) get() inout pure nothrow @safe - { -- enforce(!isNull); -+ enum message = "Called `get' on null Nullable!" ~ T.stringof ~ "."; -+ assert(!isNull, message); - return _value; - } - - /** --Implicitly converts to $(D T). Throws an exception if $(D this) is in --the null state. -+Implicitly converts to $(D T). -+$(D this) must not be in the null state. - */ - alias get this; - } -@@ -1193,7 +1245,7 @@ unittest - { - Nullable!int a; - assert(a.isNull); -- assertThrown(a.get); -+ assertThrown!Throwable(a.get); - a = 5; - assert(!a.isNull); - assert(a == 5); -@@ -1208,7 +1260,7 @@ unittest - a = a; - assert(a == 18); - a.nullify(); -- assertThrown(a += 2); -+ assertThrown!Throwable(a += 2); - } - unittest - { -@@ -1241,7 +1293,7 @@ unittest - s.x = 9190; - assert(s.x == 9190); - s.nullify(); -- assertThrown(s.x = 9441); -+ assertThrown!Throwable(s.x = 9441); - } - unittest - { -@@ -1252,7 +1304,7 @@ unittest - assert(n.isNull); - n = 4; - assert(!n.isNull); -- try { assert(n == 4); } catch (Exception) { assert(false); } -+ assert(n == 4); - n.nullify(); - assert(n.isNull); - }(); -@@ -1287,6 +1339,139 @@ unittest - N n; - foo(n); - } -+unittest -+{ -+ //Check nullable immutable is constructable -+ { -+ auto a1 = Nullable!(immutable int)(); -+ auto a2 = Nullable!(immutable int)(1); -+ auto i = a2.get; -+ } -+ //Check immutable nullable is constructable -+ { -+ auto a1 = immutable (Nullable!int)(); -+ auto a2 = immutable (Nullable!int)(1); -+ auto i = a2.get; -+ } -+} -+unittest -+{ -+ alias NInt = Nullable!int; -+ -+ //Construct tests -+ { -+ //from other Nullable null -+ NInt a1; -+ NInt b1 = a1; -+ assert(b1.isNull); -+ -+ //from other Nullable non-null -+ NInt a2 = NInt(1); -+ NInt b2 = a2; -+ assert(b2 == 1); -+ -+ //Construct from similar nullable -+ auto a3 = immutable(NInt)(); -+ NInt b3 = a3; -+ assert(b3.isNull); -+ } -+ -+ //Assign tests -+ { -+ //from other Nullable null -+ NInt a1; -+ NInt b1; -+ b1 = a1; -+ assert(b1.isNull); -+ -+ //from other Nullable non-null -+ NInt a2 = NInt(1); -+ NInt b2; -+ b2 = a2; -+ assert(b2 == 1); -+ -+ //Construct from similar nullable -+ auto a3 = immutable(NInt)(); -+ NInt b3 = a3; -+ b3 = a3; -+ assert(b3.isNull); -+ } -+} -+unittest -+{ -+ //Check nullable is nicelly embedable in a struct -+ static struct S1 -+ { -+ Nullable!int ni; -+ } -+ static struct S2 //inspired from 9404 -+ { -+ Nullable!int ni; -+ this(S2 other) -+ { -+ ni = other.ni; -+ } -+ void opAssign(S2 other) -+ { -+ ni = other.ni; -+ } -+ } -+ foreach (S; TypeTuple!(S1, S2)) -+ { -+ S a; -+ S b = a; -+ S c; -+ c = a; -+ } -+} -+unittest -+{ -+ // Bugzilla 10268 -+ import std.json; -+ JSONValue value = void; -+ value.type = JSON_TYPE.NULL; -+ auto na = Nullable!JSONValue(value); -+ -+ struct S1 { int val; } -+ struct S2 { int* val; } -+ struct S3 { immutable int* val; } -+ -+ { -+ auto sm = S1(1); -+ immutable si = immutable S1(1); -+ static assert( __traits(compiles, { auto x1 = Nullable!S1(sm); })); -+ static assert( __traits(compiles, { auto x2 = immutable Nullable!S1(sm); })); -+ static assert( __traits(compiles, { auto x3 = Nullable!S1(si); })); -+ static assert( __traits(compiles, { auto x4 = immutable Nullable!S1(si); })); -+ } -+ -+ auto nm = 10; -+ immutable ni = 10; -+ -+ { -+ auto sm = S2(&nm); -+ immutable si = immutable S2(&ni); -+ static assert( __traits(compiles, { auto x = Nullable!S2(sm); })); -+ static assert(!__traits(compiles, { auto x = immutable Nullable!S2(sm); })); -+ static assert(!__traits(compiles, { auto x = Nullable!S2(si); })); -+ static assert( __traits(compiles, { auto x = immutable Nullable!S2(si); })); -+ } -+ -+ { -+ auto sm = S3(&ni); -+ immutable si = immutable S3(&ni); -+ static assert( __traits(compiles, { auto x = Nullable!S3(sm); })); -+ static assert( __traits(compiles, { auto x = immutable Nullable!S3(sm); })); -+ static assert( __traits(compiles, { auto x = Nullable!S3(si); })); -+ static assert( __traits(compiles, { auto x = immutable Nullable!S3(si); })); -+ } -+} -+unittest -+{ -+ // Bugzila 10357 -+ import std.datetime; -+ Nullable!SysTime time = SysTime(0); -+} - - /** - Just like $(D Nullable!T), except that the null state is defined as a -@@ -1325,7 +1510,7 @@ Forces $(D this) to the null state. - - /** - Assigns $(D value) to the internally-held state. No null checks are --made. -+made. Note that the assignment may leave $(D this) in the null state. - */ - void opAssign()(T value) - { -@@ -1333,19 +1518,21 @@ made. - } - - /** --Gets the value. Throws an exception if $(D this) is in the null --state. This function is also called for the implicit conversion to $(D --T). -+Gets the value. $(D this) must not be in the null state. -+This function is also called for the implicit conversion to $(D T). - */ - @property ref inout(T) get()() inout - { -- enforce(!isNull); -+ //@@@6169@@@: We avoid any call that might evaluate nullValue's %s, -+ //Because it might messup get's purity and safety inference. -+ enum message = "Called `get' on null Nullable!(" ~ T.stringof ~ ",nullValue)."; -+ assert(!isNull, message); - return _value; - } - - /** --Implicitly converts to $(D T). Throws an exception if $(D this) is in --the null state. -+Implicitly converts to $(D T). -+Gets the value. $(D this) must not be in the null state. - */ - alias get this; - } -@@ -1354,7 +1541,7 @@ unittest - { - Nullable!(int, int.min) a; - assert(a.isNull); -- assertThrown(a.get); -+ assertThrown!Throwable(a.get); - a = 5; - assert(!a.isNull); - assert(a == 5); -@@ -1385,12 +1572,10 @@ unittest - function() pure nothrow @safe - { - Nullable!(int, int.min) n; -- pragma(msg, typeof(&n.get!())); -- - assert(n.isNull); - n = 4; - assert(!n.isNull); -- try { assert(n == 4); } catch (Exception) { assert(false); } -+ assert(n == 4); - n.nullify(); - assert(n.isNull); - }(); -@@ -1412,6 +1597,33 @@ unittest - s.nullify(); - assert(s.isNull); - } -+unittest -+{ -+ //Check nullable is nicelly embedable in a struct -+ static struct S1 -+ { -+ Nullable!(int, 0) ni; -+ } -+ static struct S2 //inspired from 9404 -+ { -+ Nullable!(int, 0) ni; -+ this(S2 other) -+ { -+ ni = other.ni; -+ } -+ void opAssign(S2 other) -+ { -+ ni = other.ni; -+ } -+ } -+ foreach (S; TypeTuple!(S1, S2)) -+ { -+ S a; -+ S b = a; -+ S c; -+ c = a; -+ } -+} - - /** - Just like $(D Nullable!T), except that the object refers to a value -@@ -1426,7 +1638,7 @@ struct NullableRef(T) - /** - Constructor binding $(D this) with $(D value). - */ -- this(T * value) pure nothrow @safe -+ this(T* value) pure nothrow @safe - { - _value = value; - } -@@ -1434,7 +1646,7 @@ Constructor binding $(D this) with $(D v - /** - Binds the internal state to $(D value). - */ -- void bind(T * value) pure nothrow @safe -+ void bind(T* value) pure nothrow @safe - { - _value = value; - } -@@ -1459,25 +1671,27 @@ Forces $(D this) to the null state. - Assigns $(D value) to the internally-held state. - */ - void opAssign()(T value) -+ if (isAssignable!T) //@@@9416@@@ - { -- enforce(_value); -+ enum message = "Called `opAssign' on null NullableRef!" ~ T.stringof ~ "."; -+ assert(!isNull, message); - *_value = value; - } - - /** --Gets the value. Throws an exception if $(D this) is in the null --state. This function is also called for the implicit conversion to $(D --T). -+Gets the value. $(D this) must not be in the null state. -+This function is also called for the implicit conversion to $(D T). - */ -- @property ref inout(T) get()() inout -+ @property ref inout(T) get() inout pure nothrow @safe - { -- enforce(!isNull); -+ enum message = "Called `get' on null NullableRef!" ~ T.stringof ~ "."; -+ assert(!isNull, message); - return *_value; - } - - /** --Implicitly converts to $(D T). Throws an exception if $(D this) is in --the null state. -+Implicitly converts to $(D T). -+$(D this) must not be in the null state. - */ - alias get this; - } -@@ -1496,8 +1710,8 @@ unittest - a.nullify(); - assert(x == 42); - assert(a.isNull); -- assertThrown(a.get); -- assertThrown(a = 71); -+ assertThrown!Throwable(a.get); -+ assertThrown!Throwable(a = 71); - a.bind(&y); - assert(a == 7); - y = 135; -@@ -1525,16 +1739,9 @@ unittest - assert(n.isNull); - n.bind(storage); - assert(!n.isNull); -- try -- { -- assert(n == 19902); -- n = 2294; -- assert(n == 2294); -- } -- catch (Exception) -- { -- assert(false); -- } -+ assert(n == 19902); -+ n = 2294; -+ assert(n == 2294); - assert(*storage == 2294); - n.nullify(); - assert(n.isNull); -@@ -1560,6 +1767,33 @@ unittest - s.nullify(); - assert(s.isNull); - } -+unittest -+{ -+ //Check nullable is nicelly embedable in a struct -+ static struct S1 -+ { -+ NullableRef!int ni; -+ } -+ static struct S2 //inspired from 9404 -+ { -+ NullableRef!int ni; -+ this(S2 other) -+ { -+ ni = other.ni; -+ } -+ void opAssign(S2 other) -+ { -+ ni = other.ni; -+ } -+ } -+ foreach (S; TypeTuple!(S1, S2)) -+ { -+ S a; -+ S b = a; -+ S c; -+ c = a; -+ } -+} - - /** - $(D BlackHole!Base) is a subclass of $(D Base) which automatically implements -@@ -1738,6 +1972,7 @@ Params: - // Prints log messages for each call to overridden functions. - string generateLogger(C, alias fun)() @property - { -+ import std.traits; - enum qname = C.stringof ~ "." ~ __traits(identifier, fun); - string stmt; - -@@ -1745,7 +1980,7 @@ string generateLogger(C, alias fun)() @p - stmt ~= `Importer.writeln$(LPAREN)"Log: ` ~ qname ~ `(", args, ")"$(RPAREN);`; - static if (!__traits(isAbstractFunction, fun)) - { -- static if (is(typeof(return) == void)) -+ static if (is(ReturnType!fun == void)) - stmt ~= q{ parent(args); }; - else - stmt ~= q{ -@@ -1903,7 +2138,7 @@ private static: - // overloaded function with the name. - template INTERNAL_FUNCINFO_ID(string name, size_t i) - { -- enum string INTERNAL_FUNCINFO_ID = "F_" ~ name ~ "_" ~ toStringNow!(i); -+ enum string INTERNAL_FUNCINFO_ID = format("F_%s_%s", name, i); - } - - /* -@@ -2036,7 +2271,6 @@ unittest - void test(string); - real test(real); - int test(); -- int test() @property; // ? - } - auto o = new BlackHole!I_5; - } -@@ -2090,6 +2324,44 @@ unittest - }+/ - } - -+version(unittest) -+{ -+ // Issue 10647 -+ private string generateDoNothing(C, alias fun)() @property -+ { -+ string stmt; -+ -+ static if (is(ReturnType!fun == void)) -+ stmt ~= ""; -+ else -+ { -+ string returnType = ReturnType!fun.stringof; -+ stmt ~= "return "~returnType~".init;"; -+ } -+ return stmt; -+ } -+ -+ private template isAlwaysTrue(alias fun) -+ { -+ enum isAlwaysTrue = true; -+ } -+ -+ // Do nothing template -+ private template DoNothing(Base) -+ { -+ alias DoNothing = AutoImplement!(Base, generateDoNothing, isAlwaysTrue); -+ } -+ -+ // A class to be overridden -+ private class Foo{ -+ void bar(int a) { } -+ } -+} -+unittest -+{ -+ auto foo = new DoNothing!Foo(); -+ foo.bar(13); -+} - - /* - Used by MemberFunctionGenerator. -@@ -2164,7 +2436,7 @@ private static: - { - template PARAMETER_VARIABLE_ID(size_t i) - { -- enum string PARAMETER_VARIABLE_ID = "a" ~ toStringNow!(i); -+ enum string PARAMETER_VARIABLE_ID = format("a%s", i); - // default: a0, a1, ... - } - } -@@ -2204,7 +2476,7 @@ private static: - // The generated function declarations may hide existing ones - // in the base class (cf. HiddenFuncError), so we put an alias - // declaration here to reveal possible hidden functions. -- code ~= Format!("alias %s.%s %s;\n", -+ code ~= format("alias %s.%s %s;\n", - Policy.BASE_CLASS_ID, // [BUG 2540] super. - oset.name, oset.name ); - } -@@ -2246,6 +2518,8 @@ private static: - enum atts = functionAttributes!(func); - enum realName = isCtor ? "this" : name; - -+ // FIXME?? Make it so that these aren't CTFE funcs any more, since -+ // Format is deprecated, and format works at compile time? - /* Made them CTFE funcs just for the sake of Format!(...) */ - - // return type with optional "ref" -@@ -2287,9 +2561,9 @@ private static: - enum storageClass = make_storageClass(); - - // -- if (isAbstractFunction!func) -+ if (__traits(isVirtualMethod, func)) - code ~= "override "; -- code ~= Format!("extern(%s) %s %s(%s) %s %s\n", -+ code ~= format("extern(%s) %s %s(%s) %s %s\n", - functionLinkage!(func), - returnType, - realName, -@@ -2351,7 +2625,7 @@ private static: - if (stc & STC.lazy_ ) params ~= "lazy "; - - // Take parameter type from the FuncInfo. -- params ~= myFuncInfo ~ ".PT[" ~ toStringNow!(i) ~ "]"; -+ params ~= format("%s.PT[%s]", myFuncInfo, i); - - // Declare a parameter variable. - params ~= " " ~ PARAMETER_VARIABLE_ID!(i); -@@ -2431,21 +2705,774 @@ template generateAssertTrap(C, func.../+ - ~ __traits(identifier, func) ~ `");`; - } - --/** --Options regarding auto-initialization of a $(D RefCounted) object (see --the definition of $(D RefCounted) below). -- */ --enum RefCountedAutoInitialize -+private - { -- /// Do not auto-initialize the object -- no, -- /// Auto-initialize the object -- yes, -+ pragma(mangle, "_d_toObject") -+ extern(C) pure nothrow Object typecons_d_toObject(void* p); - } - --/** --Defines a reference-counted object containing a $(D T) value as --payload. $(D RefCounted) keeps track of all references of an object, -+/* -+ * Avoids opCast operator overloading. -+ */ -+private template dynamicCast(T) -+if (is(T == class) || is(T == interface)) -+{ -+ @trusted -+ T dynamicCast(S)(inout S source) -+ if (is(S == class) || is(S == interface)) -+ { -+ static if (is(Unqual!S : Unqual!T)) -+ { -+ import std.traits : QualifierOf; -+ alias Qual = QualifierOf!S; // SharedOf or MutableOf -+ alias TmpT = Qual!(Unqual!T); -+ inout(TmpT) tmp = source; // bypass opCast by implicit conversion -+ return *cast(T*)(&tmp); // + variable pointer cast + dereference -+ } -+ else -+ { -+ return cast(T)typecons_d_toObject(*cast(void**)(&source)); -+ } -+ } -+} -+ -+unittest -+{ -+ class C { @disable opCast(T)() {} } -+ auto c = new C; -+ static assert(!__traits(compiles, cast(Object)c)); -+ auto o = dynamicCast!Object(c); -+ assert(c is o); -+ -+ interface I { @disable opCast(T)() {} Object instance(); } -+ interface J { @disable opCast(T)() {} Object instance(); } -+ class D : I, J { Object instance() { return this; } } -+ I i = new D(); -+ static assert(!__traits(compiles, cast(J)i)); -+ J j = dynamicCast!J(i); -+ assert(i.instance() is j.instance()); -+} -+ -+/** -+ * Supports structural based typesafe conversion. -+ * -+ * If $(D Source) has structural conformance with the $(D interface) $(D Targets), -+ * wrap creates internal wrapper class which inherits $(D Targets) and -+ * wrap $(D src) object, then return it. -+ */ -+template wrap(Targets...) -+if (Targets.length >= 1 && allSatisfy!(isMutable, Targets)) -+{ -+ // strict upcast -+ auto wrap(Source)(inout Source src) @trusted pure nothrow -+ if (Targets.length == 1 && is(Source : Targets[0])) -+ { -+ alias T = Select!(is(Source == shared), shared Targets[0], Targets[0]); -+ return dynamicCast!(inout T)(src); -+ } -+ // structural upcast -+ template wrap(Source) -+ if (!allSatisfy!(Bind!(isImplicitlyConvertible, Source), Targets)) -+ { -+ auto wrap(inout Source src) -+ { -+ static assert(hasRequireMethods!(), -+ "Source "~Source.stringof~ -+ " does not have structural conformance to "~ -+ Targets.stringof); -+ -+ alias T = Select!(is(Source == shared), shared Impl, Impl); -+ return new inout T(src); -+ } -+ -+ template FuncInfo(string s, F) -+ { -+ enum name = s; -+ alias type = F; -+ } -+ -+ // Concat all Targets function members into one tuple -+ template Concat(size_t i = 0) -+ { -+ static if (i >= Targets.length) -+ alias Concat = TypeTuple!(); -+ else -+ { -+ alias Concat = TypeTuple!(GetOverloadedMethods!(Targets[i]), Concat!(i + 1)); -+ } -+ } -+ // Remove duplicated functions based on the identifier name and function type covariance -+ template Uniq(members...) -+ { -+ static if (members.length == 0) -+ alias Uniq = TypeTuple!(); -+ else -+ { -+ alias func = members[0]; -+ enum name = __traits(identifier, func); -+ alias type = FunctionTypeOf!func; -+ template check(size_t i, mem...) -+ { -+ static if (i >= mem.length) -+ enum ptrdiff_t check = -1; -+ else -+ { -+ enum ptrdiff_t check = -+ __traits(identifier, func) == __traits(identifier, mem[i]) && -+ !is(DerivedFunctionType!(type, FunctionTypeOf!(mem[i])) == void) -+ ? i : check!(i + 1, mem); -+ } -+ } -+ enum ptrdiff_t x = 1 + check!(0, members[1 .. $]); -+ static if (x >= 1) -+ { -+ alias typex = DerivedFunctionType!(type, FunctionTypeOf!(members[x])); -+ alias remain = Uniq!(members[1 .. x], members[x + 1 .. $]); -+ -+ static if (remain.length >= 1 && remain[0].name == name && -+ !is(DerivedFunctionType!(typex, remain[0].type) == void)) -+ { -+ alias F = DerivedFunctionType!(typex, remain[0].type); -+ alias Uniq = TypeTuple!(FuncInfo!(name, F), remain[1 .. $]); -+ } -+ else -+ alias Uniq = TypeTuple!(FuncInfo!(name, typex), remain); -+ } -+ else -+ { -+ alias Uniq = TypeTuple!(FuncInfo!(name, type), Uniq!(members[1 .. $])); -+ } -+ } -+ } -+ alias TargetMembers = Uniq!(Concat!()); // list of FuncInfo -+ alias SourceMembers = GetOverloadedMethods!Source; // list of function symbols -+ -+ // Check whether all of SourceMembers satisfy covariance target in TargetMembers -+ template hasRequireMethods(size_t i = 0) -+ { -+ static if (i >= TargetMembers.length) -+ enum hasRequireMethods = true; -+ else -+ { -+ enum hasRequireMethods = -+ findCovariantFunction!(TargetMembers[i], Source, SourceMembers) != -1 && -+ hasRequireMethods!(i + 1); -+ } -+ } -+ -+ // Internal wrapper class -+ final class Impl : Structural, Targets -+ { -+ private: -+ Source _wrap_source; -+ -+ this( inout Source s) inout @safe pure nothrow { _wrap_source = s; } -+ this(shared inout Source s) shared inout @safe pure nothrow { _wrap_source = s; } -+ -+ // BUG: making private should work with NVI. -+ protected final inout(Object) _wrap_getSource() inout @trusted -+ { -+ return dynamicCast!(inout Object)(_wrap_source); -+ } -+ -+ import std.conv : to; -+ import std.algorithm : forward; -+ template generateFun(size_t i) -+ { -+ enum name = TargetMembers[i].name; -+ enum fa = functionAttributes!(TargetMembers[i].type); -+ static @property stc() -+ { -+ string r; -+ if (fa & FunctionAttribute.property) r ~= "@property "; -+ if (fa & FunctionAttribute.ref_) r ~= "ref "; -+ if (fa & FunctionAttribute.pure_) r ~= "pure "; -+ if (fa & FunctionAttribute.nothrow_) r ~= "nothrow "; -+ if (fa & FunctionAttribute.trusted) r ~= "@trusted "; -+ if (fa & FunctionAttribute.safe) r ~= "@safe "; -+ return r; -+ } -+ static @property mod() -+ { -+ alias TypeTuple!(TargetMembers[i].type)[0] type; -+ string r; -+ static if (is(type == immutable)) r ~= " immutable"; -+ else -+ { -+ static if (is(type == shared)) r ~= " shared"; -+ static if (is(type == const)) r ~= " const"; -+ else static if (is(type == inout)) r ~= " inout"; -+ //else --> mutable -+ } -+ return r; -+ } -+ enum n = to!string(i); -+ static if (fa & FunctionAttribute.property) -+ { -+ static if (ParameterTypeTuple!(TargetMembers[i].type).length == 0) -+ enum fbody = "_wrap_source."~name; -+ else -+ enum fbody = "_wrap_source."~name~" = forward!args"; -+ } -+ else -+ { -+ enum fbody = "_wrap_source."~name~"(forward!args)"; -+ } -+ enum generateFun = -+ "override "~stc~"ReturnType!(TargetMembers["~n~"].type) " -+ ~ name~"(ParameterTypeTuple!(TargetMembers["~n~"].type) args) "~mod~ -+ "{ return "~fbody~"; }"; -+ } -+ -+ public: -+ mixin mixinAll!( -+ staticMap!(generateFun, staticIota!(0, TargetMembers.length))); -+ } -+ } -+} -+/// ditto -+template wrap(Targets...) -+if (Targets.length >= 1 && !allSatisfy!(isMutable, Targets)) -+{ -+ alias wrap = .wrap!(staticMap!(Unqual, Targets)); -+} -+ -+// Internal class to support dynamic cross-casting -+private interface Structural -+{ -+ inout(Object) _wrap_getSource() inout @safe pure nothrow; -+} -+ -+/** -+ * Extract object which wrapped by $(D wrap). -+ */ -+template unwrap(Target) -+if (isMutable!Target) -+{ -+ // strict downcast -+ auto unwrap(Source)(inout Source src) @trusted pure nothrow -+ if (is(Target : Source)) -+ { -+ alias T = Select!(is(Source == shared), shared Target, Target); -+ return dynamicCast!(inout T)(src); -+ } -+ // structural downcast -+ auto unwrap(Source)(inout Source src) @trusted pure nothrow -+ if (!is(Target : Source)) -+ { -+ alias T = Select!(is(Source == shared), shared Target, Target); -+ Object o = dynamicCast!(Object)(src); // remove qualifier -+ do -+ { -+ if (auto a = dynamicCast!(Structural)(o)) -+ { -+ if (auto d = dynamicCast!(inout T)(o = a._wrap_getSource())) -+ return d; -+ } -+ else if (auto d = dynamicCast!(inout T)(o)) -+ return d; -+ else -+ break; -+ } while (o); -+ return null; -+ } -+} -+/// ditto -+template unwrap(Target) -+if (!isMutable!Target) -+{ -+ alias unwrap = .unwrap!(Unqual!Target); -+} -+ -+/// -+unittest -+{ -+ interface Quack -+ { -+ int quack(); -+ @property int height(); -+ } -+ interface Flyer -+ { -+ @property int height(); -+ } -+ class Duck : Quack -+ { -+ int quack() { return 1; } -+ @property int height() { return 10; } -+ } -+ class Human -+ { -+ int quack() { return 2; } -+ @property int height() { return 20; } -+ } -+ -+ Duck d1 = new Duck(); -+ Human h1 = new Human(); -+ -+ interface Refleshable -+ { -+ int reflesh(); -+ } -+ // does not have structural conformance -+ static assert(!__traits(compiles, d1.wrap!Refleshable)); -+ static assert(!__traits(compiles, h1.wrap!Refleshable)); -+ -+ // strict upcast -+ Quack qd = d1.wrap!Quack; -+ assert(qd is d1); -+ assert(qd.quack() == 1); // calls Duck.quack -+ // strict downcast -+ Duck d2 = qd.unwrap!Duck; -+ assert(d2 is d1); -+ -+ // structural upcast -+ Quack qh = h1.wrap!Quack; -+ assert(qh.quack() == 2); // calls Human.quack -+ // structural downcast -+ Human h2 = qh.unwrap!Human; -+ assert(h2 is h1); -+ -+ // structural upcast (two steps) -+ Quack qx = h1.wrap!Quack; // Human -> Quack -+ Flyer fx = qx.wrap!Flyer; // Quack -> Flyer -+ assert(fx.height == 20); // calls Human.height -+ // strucural downcast (two steps) -+ Quack qy = fx.unwrap!Quack; // Flyer -> Quack -+ Human hy = qy.unwrap!Human; // Quack -> Human -+ assert(hy is h1); -+ // strucural downcast (one step) -+ Human hz = fx.unwrap!Human; // Flyer -> Human -+ assert(hz is h1); -+} -+/// -+unittest -+{ -+ interface A { int run(); } -+ interface B { int stop(); @property int status(); } -+ class X -+ { -+ int run() { return 1; } -+ int stop() { return 2; } -+ @property int status() { return 3; } -+ } -+ -+ auto x = new X(); -+ auto ab = x.wrap!(A, B); -+ A a = ab; -+ B b = ab; -+ assert(a.run() == 1); -+ assert(b.stop() == 2); -+ assert(b.status == 3); -+ static assert(functionAttributes!(typeof(ab).status) & FunctionAttribute.property); -+} -+unittest -+{ -+ class A -+ { -+ int draw() { return 1; } -+ int draw(int v) { return v; } -+ -+ int draw() const { return 2; } -+ int draw() shared { return 3; } -+ int draw() shared const { return 4; } -+ int draw() immutable { return 5; } -+ } -+ interface Drawable -+ { -+ int draw(); -+ int draw() const; -+ int draw() shared; -+ int draw() shared const; -+ int draw() immutable; -+ } -+ interface Drawable2 -+ { -+ int draw(int v); -+ } -+ -+ auto ma = new A(); -+ auto sa = new shared A(); -+ auto ia = new immutable A(); -+ { -+ Drawable md = ma.wrap!Drawable; -+ const Drawable cd = ma.wrap!Drawable; -+ shared Drawable sd = sa.wrap!Drawable; -+ shared const Drawable scd = sa.wrap!Drawable; -+ immutable Drawable id = ia.wrap!Drawable; -+ assert( md.draw() == 1); -+ assert( cd.draw() == 2); -+ assert( sd.draw() == 3); -+ assert(scd.draw() == 4); -+ assert( id.draw() == 5); -+ } -+ { -+ Drawable2 d = ma.wrap!Drawable2; -+ static assert(!__traits(compiles, d.draw())); -+ assert(d.draw(10) == 10); -+ } -+} -+unittest -+{ -+ // Bugzilla 10377 -+ import std.range, std.algorithm; -+ -+ interface MyInputRange(T) -+ { -+ @property T front(); -+ void popFront(); -+ @property bool empty(); -+ } -+ -+ //auto o = iota(0,10,1).inputRangeObject(); -+ //pragma(msg, __traits(allMembers, typeof(o))); -+ auto r = iota(0,10,1).inputRangeObject().wrap!(MyInputRange!int)(); -+ assert(equal(r, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])); -+} -+unittest -+{ -+ // Bugzilla 10536 -+ interface Interface -+ { -+ int foo(); -+ } -+ class Pluggable -+ { -+ int foo() { return 1; } -+ @disable void opCast(T, this X)(); // ! -+ } -+ -+ Interface i = new Pluggable().wrap!Interface; -+ assert(i.foo() == 1); -+} -+unittest -+{ -+ // Enhancement 10538 -+ interface Interface -+ { -+ int foo(); -+ int bar(int); -+ } -+ class Pluggable -+ { -+ int opDispatch(string name, A...)(A args) { return 100; } -+ } -+ -+ Interface i = wrap!Interface(new Pluggable()); -+ assert(i.foo() == 100); -+ assert(i.bar(10) == 100); -+} -+ -+// Make a tuple of non-static function symbols -+private template GetOverloadedMethods(T) -+{ -+ alias allMembers = TypeTuple!(__traits(allMembers, T)); -+ template follows(size_t i = 0) -+ { -+ static if (i >= allMembers.length) -+ { -+ alias follows = TypeTuple!(); -+ } -+ else static if (!__traits(compiles, mixin("T."~allMembers[i]))) -+ { -+ alias follows = follows!(i + 1); -+ } -+ else -+ { -+ enum name = allMembers[i]; -+ -+ template isMethod(alias f) -+ { -+ static if (is(typeof(&f) F == F*) && is(F == function)) -+ enum isMethod = !__traits(isStaticFunction, f); -+ else -+ enum isMethod = false; -+ } -+ alias follows = TypeTuple!( -+ std.typetuple.Filter!(isMethod, __traits(getOverloads, T, name)), -+ follows!(i + 1)); -+ } -+ } -+ alias GetOverloadedMethods = follows!(); -+} -+// find a function from Fs that has same identifier and covariant type with f -+private template findCovariantFunction(alias finfo, Source, Fs...) -+{ -+ template check(size_t i = 0) -+ { -+ static if (i >= Fs.length) -+ enum ptrdiff_t check = -1; -+ else -+ { -+ enum ptrdiff_t check = -+ (finfo.name == __traits(identifier, Fs[i])) && -+ isCovariantWith!(FunctionTypeOf!(Fs[i]), finfo.type) -+ ? i : check!(i + 1); -+ } -+ } -+ enum x = check!(); -+ static if (x == -1 && is(typeof(Source.opDispatch))) -+ { -+ alias Params = ParameterTypeTuple!(finfo.type); -+ enum ptrdiff_t findCovariantFunction = -+ is(typeof(( Source).init.opDispatch!(finfo.name)(Params.init))) || -+ is(typeof(( const Source).init.opDispatch!(finfo.name)(Params.init))) || -+ is(typeof(( immutable Source).init.opDispatch!(finfo.name)(Params.init))) || -+ is(typeof(( shared Source).init.opDispatch!(finfo.name)(Params.init))) || -+ is(typeof((shared const Source).init.opDispatch!(finfo.name)(Params.init))) -+ ? ptrdiff_t.max : -1; -+ } -+ else -+ enum ptrdiff_t findCovariantFunction = x; -+} -+ -+private enum TypeModifier -+{ -+ mutable = 0, // type is mutable -+ const_ = 1, // type is const -+ immutable_ = 2, // type is immutable -+ shared_ = 4, // type is shared -+ inout_ = 8, // type is wild -+} -+private template TypeMod(T) -+{ -+ static if (is(T == immutable)) -+ { -+ enum mod1 = TypeModifier.immutable_; -+ enum mod2 = 0; -+ } -+ else -+ { -+ enum mod1 = is(T == shared) ? TypeModifier.shared_ : 0; -+ static if (is(T == const)) -+ enum mod2 = TypeModifier.const_; -+ else static if (is(T == inout)) -+ enum mod2 = TypeModifier.inout_; -+ else -+ enum mod2 = TypeModifier.mutable; -+ } -+ enum TypeMod = cast(TypeModifier)(mod1 | mod2); -+} -+ -+version(unittest) -+{ -+ private template UnittestFuncInfo(alias f) -+ { -+ enum name = __traits(identifier, f); -+ alias type = FunctionTypeOf!f; -+ } -+} -+unittest -+{ -+ class A -+ { -+ int draw() { return 1; } -+ @property int value() { return 2; } -+ final int run() { return 3; } -+ } -+ alias methods = GetOverloadedMethods!A; -+ -+ alias int F1(); -+ alias @property int F2(); -+ alias string F3(); -+ alias nothrow @trusted uint F4(); -+ alias int F5(Object); -+ alias bool F6(Object); -+ static assert(methods.length == 3 + 4); -+ static assert(__traits(identifier, methods[0]) == "draw" && is(typeof(&methods[0]) == F1*)); -+ static assert(__traits(identifier, methods[1]) == "value" && is(typeof(&methods[1]) == F2*)); -+ static assert(__traits(identifier, methods[2]) == "run" && is(typeof(&methods[2]) == F1*)); -+ -+ int draw() { return 0; } -+ @property int value() { return 0; } -+ void opEquals() {} -+ int nomatch() { return 0; } -+ static assert(findCovariantFunction!(UnittestFuncInfo!draw, A, methods) == 0); -+ static assert(findCovariantFunction!(UnittestFuncInfo!value, A, methods) == 1); -+ static assert(findCovariantFunction!(UnittestFuncInfo!opEquals, A, methods) == -1); -+ static assert(findCovariantFunction!(UnittestFuncInfo!nomatch, A, methods) == -1); -+ -+ // considering opDispatch -+ class B -+ { -+ void opDispatch(string name, A...)(A) {} -+ } -+ alias methodsB = GetOverloadedMethods!B; -+ static assert(findCovariantFunction!(UnittestFuncInfo!draw, B, methodsB) == ptrdiff_t.max); -+ static assert(findCovariantFunction!(UnittestFuncInfo!value, B, methodsB) == ptrdiff_t.max); -+ static assert(findCovariantFunction!(UnittestFuncInfo!opEquals, B, methodsB) == ptrdiff_t.max); -+ static assert(findCovariantFunction!(UnittestFuncInfo!nomatch, B, methodsB) == ptrdiff_t.max); -+} -+ -+private template DerivedFunctionType(T...) -+{ -+ static if (!T.length) -+ { -+ alias DerivedFunctionType = void; -+ } -+ else static if (T.length == 1) -+ { -+ static if (is(T[0] == function)) -+ { -+ alias DerivedFunctionType = T[0]; -+ } -+ else -+ { -+ alias DerivedFunctionType = void; -+ } -+ } -+ else static if (is(T[0] P0 == function) && is(T[1] P1 == function)) -+ { -+ alias FA = FunctionAttribute; -+ -+ alias F0 = T[0], R0 = ReturnType!F0, PSTC0 = ParameterStorageClassTuple!F0; -+ alias F1 = T[1], R1 = ReturnType!F1, PSTC1 = ParameterStorageClassTuple!F1; -+ enum FA0 = functionAttributes!F0; -+ enum FA1 = functionAttributes!F1; -+ -+ template CheckParams(size_t i = 0) -+ { -+ static if (i >= P0.length) -+ enum CheckParams = true; -+ else -+ { -+ enum CheckParams = (is(P0[i] == P1[i]) && PSTC0[i] == PSTC1[i]) && -+ CheckParams!(i + 1); -+ } -+ } -+ static if (R0.sizeof == R1.sizeof && !is(CommonType!(R0, R1) == void) && -+ P0.length == P1.length && CheckParams!() && TypeMod!F0 == TypeMod!F1 && -+ variadicFunctionStyle!F0 == variadicFunctionStyle!F1 && -+ functionLinkage!F0 == functionLinkage!F1 && -+ ((FA0 ^ FA1) & (FA.ref_ | FA.property)) == 0) -+ { -+ alias R = Select!(is(R0 : R1), R0, R1); -+ alias FX = FunctionTypeOf!(R function(P0)); -+ alias FY = SetFunctionAttributes!(FX, functionLinkage!F0, FA0 | FA1); -+ alias DerivedFunctionType = DerivedFunctionType!(FY, T[2 .. $]); -+ } -+ else -+ alias DerivedFunctionType = void; -+ } -+ else -+ alias DerivedFunctionType = void; -+} -+unittest -+{ -+ // attribute covariance -+ alias int F1(); -+ static assert(is(DerivedFunctionType!(F1, F1) == F1)); -+ alias int F2() pure nothrow; -+ static assert(is(DerivedFunctionType!(F1, F2) == F2)); -+ alias int F3() @safe; -+ alias int F23() pure nothrow @safe; -+ static assert(is(DerivedFunctionType!(F2, F3) == F23)); -+ -+ // return type covariance -+ alias long F4(); -+ static assert(is(DerivedFunctionType!(F1, F4) == void)); -+ class C {} -+ class D : C {} -+ alias C F5(); -+ alias D F6(); -+ static assert(is(DerivedFunctionType!(F5, F6) == F6)); -+ alias typeof(null) F7(); -+ alias int[] F8(); -+ alias int* F9(); -+ static assert(is(DerivedFunctionType!(F5, F7) == F7)); -+ static assert(is(DerivedFunctionType!(F7, F8) == void)); -+ static assert(is(DerivedFunctionType!(F7, F9) == F7)); -+ -+ // variadic type equality -+ alias int F10(int); -+ alias int F11(int...); -+ alias int F12(int, ...); -+ static assert(is(DerivedFunctionType!(F10, F11) == void)); -+ static assert(is(DerivedFunctionType!(F10, F12) == void)); -+ static assert(is(DerivedFunctionType!(F11, F12) == void)); -+ -+ // linkage equality -+ alias extern(C) int F13(int); -+ alias extern(D) int F14(int); -+ alias extern(Windows) int F15(int); -+ static assert(is(DerivedFunctionType!(F13, F14) == void)); -+ static assert(is(DerivedFunctionType!(F13, F15) == void)); -+ static assert(is(DerivedFunctionType!(F14, F15) == void)); -+ -+ // ref & @property equality -+ alias int F16(int); -+ alias ref int F17(int); -+ alias @property int F18(int); -+ static assert(is(DerivedFunctionType!(F16, F17) == void)); -+ static assert(is(DerivedFunctionType!(F16, F18) == void)); -+ static assert(is(DerivedFunctionType!(F17, F18) == void)); -+} -+ -+private template staticIota(int beg, int end, int step = 1) if (step != 0) -+{ -+ static if (beg + 1 >= end) -+ { -+ static if (beg >= end) -+ { -+ alias TypeTuple!() staticIota; -+ } -+ else -+ { -+ alias TypeTuple!(+beg) staticIota; -+ } -+ } -+ else -+ { -+ enum mid = beg + (end - beg) / 2; -+ alias staticIota = TypeTuple!(staticIota!(beg, mid), staticIota!(mid, end)); -+ } -+} -+ -+private template mixinAll(mixins...) -+{ -+ static if (mixins.length == 1) -+ { -+ static if (is(typeof(mixins[0]) == string)) -+ { -+ mixin(mixins[0]); -+ } -+ else -+ { -+ alias mixins[0] it; -+ mixin it; -+ } -+ } -+ else static if (mixins.length >= 2) -+ { -+ mixin mixinAll!(mixins[ 0 .. $/2]); -+ mixin mixinAll!(mixins[$/2 .. $ ]); -+ } -+} -+ -+private template Bind(alias Template, args1...) -+{ -+ template Bind(args2...) -+ { -+ alias Bind = Template!(args1, args2); -+ } -+} -+ -+ -+/** -+Options regarding auto-initialization of a $(D RefCounted) object (see -+the definition of $(D RefCounted) below). -+ */ -+enum RefCountedAutoInitialize -+{ -+ /// Do not auto-initialize the object -+ no, -+ /// Auto-initialize the object -+ yes, -+} -+ -+/** -+Defines a reference-counted object containing a $(D T) value as -+payload. $(D RefCounted) keeps track of all references of an object, - and when the reference count goes down to zero, frees the underlying - store. $(D RefCounted) uses $(D malloc) and $(D free) for operation. - -@@ -2457,7 +3484,7 @@ automatically initialized. Leaving $(D a - RefCountedAutoInitialize.yes) (the default option) is convenient but - has the cost of a test whenever the payload is accessed. If $(D - autoInit == RefCountedAutoInitialize.no), user code must call either --$(D refCountedIsInitialized) or $(D refCountedEnsureInitialized) -+$(D refCountedStore.isInitialized) or $(D refCountedStore.ensureInitialized) - before attempting to access the payload. Not doing so results in null - pointer dereference. - -@@ -2541,7 +3568,7 @@ if (!is(T == class)) - /** - Constructor that initializes the payload. - --Postcondition: $(D refCountedIsInitialized) -+Postcondition: $(D refCountedStore.isInitialized) - */ - this(A...)(auto ref A args) if (A.length > 0) - { -@@ -2550,7 +3577,7 @@ Postcondition: $(D refCountedIsInitializ - - /** - Constructor that tracks the reference count appropriately. If $(D --!refCountedIsInitialized), does nothing. -+!refCountedStore.isInitialized), does nothing. - */ - this(this) - { -@@ -2560,7 +3587,7 @@ Constructor that tracks the reference co - - /** - Destructor that tracks the reference count appropriately. If $(D --!refCountedIsInitialized), does nothing. When the reference count goes -+!refCountedStore.isInitialized), does nothing. When the reference count goes - down to zero, calls $(D destroy) agaist the payload and calls $(D free) - to deallocate the corresponding resource. - */ -@@ -2606,8 +3633,8 @@ Assignment operators - /** - Returns a reference to the payload. If (autoInit == - RefCountedAutoInitialize.yes), calls $(D -- refCountedEnsureInitialized). Otherwise, just issues $(D -- assert(refCountedIsInitialized)). Used with $(D alias -+ refCountedStore.ensureInitialized). Otherwise, just issues $(D -+ assert(refCountedStore.isInitialized)). Used with $(D alias - refCountedPayload this;), so callers can just use the $(D RefCounted) - object as a $(D T). - -@@ -2640,7 +3667,7 @@ Assignment operators - @property nothrow @safe - ref inout(T) refCountedPayload() inout - { -- assert(_refCounted.isInitialized); -+ assert(_refCounted.isInitialized, "Attempted to access an uninitialized payload."); - return _refCounted._store._payload; - } - } -@@ -2648,8 +3675,8 @@ Assignment operators - /** - Returns a reference to the payload. If (autoInit == - RefCountedAutoInitialize.yes), calls $(D --refCountedEnsureInitialized). Otherwise, just issues $(D --assert(refCountedIsInitialized)). -+refCountedStore.ensureInitialized). Otherwise, just issues $(D -+assert(refCountedStore.isInitialized)). - */ - alias refCountedPayload this; - } -@@ -2764,15 +3791,16 @@ void func(int n) { } - */ - mixin template Proxy(alias a) - { -- auto ref opEquals(this X)(auto ref typeof(this) b) -- { -- import std.algorithm; -- static assert(startsWith(a.stringof, "this.")); -- return a == mixin("b."~a.stringof[5..$]); // remove "this." -- } -- auto ref opEquals(this X, B)(auto ref B b) if (!is(B == typeof(this))) -+ auto ref opEquals(this X, B)(auto ref B b) - { -- return a == b; -+ static if (is(immutable B == immutable typeof(this))) -+ { -+ import std.algorithm; -+ static assert(startsWith(a.stringof, "this.")); -+ return a == mixin("b."~a.stringof[5..$]); // remove "this." -+ } -+ else -+ return a == b; - } - - auto ref opCmp(this X, B)(auto ref B b) -@@ -2799,13 +3827,17 @@ mixin template Proxy(alias a) - auto ref opSliceUnary(string op, this X )() { return mixin(op~"a[]"); } - auto ref opSliceUnary(string op, this X, B, E)(auto ref B b, auto ref E e) { return mixin(op~"a[b..e]"); } - -- auto ref opBinary (string op, this X, B)(auto ref B b) { return mixin("a "~op~" b"); } -+ auto ref opBinary(string op, this X, B)(auto ref B b) -+ if (op == "in" && is(typeof(a in b)) || op != "in") -+ { -+ return mixin("a "~op~" b"); -+ } - auto ref opBinaryRight(string op, this X, B)(auto ref B b) { return mixin("b "~op~" a"); } - - static if (!is(typeof(this) == class)) - { - private import std.traits; -- static if (isAssignable!(typeof(a), typeof(a))) -+ static if (isAssignable!(typeof(a))) - { - auto ref opAssign(this X)(auto ref typeof(this) v) - { -@@ -2836,6 +3868,11 @@ mixin template Proxy(alias a) - // non template function - auto ref opDispatch(this X, Args...)(auto ref Args args) { return mixin("a."~name~"(args)"); } - } -+ else static if (is(typeof({ enum x = mixin("a."~name); }))) -+ { -+ // built-in type field, manifest constant, and static non-mutable field -+ enum opDispatch = mixin("a."~name); -+ } - else static if (is(typeof(mixin("a."~name))) || __traits(getOverloads, a, name).length != 0) - { - // field or property function -@@ -2858,32 +3895,46 @@ unittest - { - private int value; - mixin Proxy!value; -- this(int n){ value = n; } -+ this(int n) inout { value = n; } -+ -+ enum str = "str"; -+ static immutable arr = [1,2,3]; - } - -- MyInt m = 10; -- static assert(!__traits(compiles, { int x = m; })); -- static assert(!__traits(compiles, { void func(int n){} func(m); })); -- assert(m == 10); -- assert(m != 20); -- assert(m < 20); -- assert(+m == 10); -- assert(-m == -10); -- assert(++m == 11); -- assert(m++ == 11); assert(m == 12); -- assert(--m == 11); -- assert(m-- == 11); assert(m == 10); -- assert(cast(double)m == 10.0); -- assert(m + 10 == 20); -- assert(m - 5 == 5); -- assert(m * 20 == 200); -- assert(m / 2 == 5); -- assert(10 + m == 20); -- assert(15 - m == 5); -- assert(20 * m == 200); -- assert(50 / m == 5); -- m = m; -- m = 20; assert(m == 20); -+ foreach (T; TypeTuple!(MyInt, const MyInt, immutable MyInt)) -+ { -+ T m = 10; -+ static assert(!__traits(compiles, { int x = m; })); -+ static assert(!__traits(compiles, { void func(int n){} func(m); })); -+ assert(m == 10); -+ assert(m != 20); -+ assert(m < 20); -+ assert(+m == 10); -+ assert(-m == -10); -+ assert(cast(double)m == 10.0); -+ assert(m + 10 == 20); -+ assert(m - 5 == 5); -+ assert(m * 20 == 200); -+ assert(m / 2 == 5); -+ assert(10 + m == 20); -+ assert(15 - m == 5); -+ assert(20 * m == 200); -+ assert(50 / m == 5); -+ static if (is(T == MyInt)) // mutable -+ { -+ assert(++m == 11); -+ assert(m++ == 11); assert(m == 12); -+ assert(--m == 11); -+ assert(m-- == 11); assert(m == 10); -+ m = m; -+ m = 20; assert(m == 20); -+ } -+ static assert(T.max == int.max); -+ static assert(T.min == int.min); -+ static assert(T.init == int.init); -+ static assert(T.str == "str"); -+ static assert(T.arr == [1,2,3]); -+ } - } - unittest - { -@@ -2891,29 +3942,39 @@ unittest - { - private int[] value; - mixin Proxy!value; -- this(int[] arr){ value = arr; } -+ this(int[] arr) { value = arr; } -+ this(immutable int[] arr) immutable { value = arr; } - } - -- MyArray a = [1,2,3,4]; -- assert(a == [1,2,3,4]); -- assert(a != [5,6,7,8]); -- assert(+a[0] == 1); -- version (LittleEndian) -- assert(cast(ulong[])a == [0x0000_0002_0000_0001, 0x0000_0004_0000_0003]); -- else -- assert(cast(ulong[])a == [0x0000_0001_0000_0002, 0x0000_0003_0000_0004]); -- assert(a ~ [10,11] == [1,2,3,4,10,11]); -- assert(a[0] == 1); -- //assert(a[] == [1,2,3,4]); // blocked by bug 2486 -- //assert(a[2..4] == [3,4]); // blocked by bug 2486 -- a = a; -- a = [5,6,7,8]; assert(a == [5,6,7,8]); -- a[0] = 0; assert(a == [0,6,7,8]); -- a[] = 1; assert(a == [1,1,1,1]); -- a[0..3] = 2; assert(a == [2,2,2,1]); -- a[0] += 2; assert(a == [4,2,2,1]); -- a[] *= 2; assert(a == [8,4,4,2]); -- a[0..2] /= 2; assert(a == [4,2,4,2]); -+ foreach (T; TypeTuple!(MyArray, const MyArray, immutable MyArray)) -+ { -+ static if (is(T == immutable) && !is(typeof({ T a = [1,2,3,4]; }))) -+ T a = [1,2,3,4].idup; // workaround until qualified ctor is properly supported -+ else -+ T a = [1,2,3,4]; -+ assert(a == [1,2,3,4]); -+ assert(a != [5,6,7,8]); -+ assert(+a[0] == 1); -+ version (LittleEndian) -+ assert(cast(ulong[])a == [0x0000_0002_0000_0001, 0x0000_0004_0000_0003]); -+ else -+ assert(cast(ulong[])a == [0x0000_0001_0000_0002, 0x0000_0003_0000_0004]); -+ assert(a ~ [10,11] == [1,2,3,4,10,11]); -+ assert(a[0] == 1); -+ assert(a[] == [1,2,3,4]); -+ assert(a[2..4] == [3,4]); -+ static if (is(T == MyArray)) // mutable -+ { -+ a = a; -+ a = [5,6,7,8]; assert(a == [5,6,7,8]); -+ a[0] = 0; assert(a == [0,6,7,8]); -+ a[] = 1; assert(a == [1,1,1,1]); -+ a[0..3] = 2; assert(a == [2,2,2,1]); -+ a[0] += 2; assert(a == [4,2,2,1]); -+ a[] *= 2; assert(a == [8,4,4,2]); -+ a[0..2] /= 2; assert(a == [4,2,4,2]); -+ } -+ } - } - unittest - { -@@ -2943,8 +4004,7 @@ unittest - auto h = new Hoge(new Foo()); - int n; - -- // blocked by bug 7641 -- //static assert(!__traits(compiles, { Foo f = h; })); -+ static assert(!__traits(compiles, { Foo f = h; })); - - // field - h.field = 1; // lhs of assign -@@ -2975,7 +4035,7 @@ unittest - // bug5896 test - assert(h.opCast!int() == 0); - assert(cast(int)h == 0); -- immutable(Hoge) ih = new immutable(Hoge)(new Foo()); -+ const ih = new const Hoge(new Foo()); - static assert(!__traits(compiles, ih.opCast!int())); - static assert(!__traits(compiles, cast(int)ih)); - -@@ -3019,6 +4079,20 @@ unittest - MyFoo2 f2; - f2 = f2; - } -+unittest -+{ -+ // bug8613 -+ static struct Name -+ { -+ mixin Proxy!val; -+ private string val; -+ this(string s) { val = s; } -+ } -+ -+ bool[Name] names; -+ names[Name("a")] = true; -+ bool* b = Name("a") in names; -+} - - /** - Library typedef. -@@ -3050,12 +4124,38 @@ unittest - Typedef!int y = 10; - assert(x == y); - -+ static assert(Typedef!int.init == int.init); -+ - Typedef!(float, 1.0) z; // specifies the init - assert(z == 1.0); - -+ static assert(typeof(z).init == 1.0); -+ - alias Typedef!(int, 0, "dollar") Dollar; - alias Typedef!(int, 0, "yen") Yen; - static assert(!is(Dollar == Yen)); -+ -+ Typedef!(int[3]) sa; -+ static assert(sa.length == 3); -+ static assert(typeof(sa).length == 3); -+} -+ -+unittest -+{ -+ // bug8655 -+ import std.typecons; -+ import std.bitmanip; -+ static import core.stdc.config; -+ -+ alias Typedef!(core.stdc.config.c_ulong) c_ulong; -+ -+ static struct Foo -+ { -+ mixin(bitfields!( -+ c_ulong, "NameOffset", 31, -+ c_ulong, "NameIsString", 1 -+ )); -+ } - } - - -@@ -3066,32 +4166,17 @@ it is the responsibility of the user to - object outside the scope. - - Note: it's illegal to move a class reference even if you are sure there --are no pointers to it. -- --Example: ------ --unittest --{ -- class A { int x; } -- auto a1 = scoped!A(); -- auto a2 = scoped!A(); -- a1.x = 42; -- a2.x = 53; -- assert(a1.x == 42); -- -- auto a3 = a2; // illegal, fails to compile -- assert([a2][0].x == 42); // illegal, unexpected behaviour --} ------ -+are no pointers to it. As such, it is illegal to move a scoped object. - */ --@system auto scoped(T, Args...)(auto ref Args args) if (is(T == class)) -+template scoped(T) -+ if (is(T == class)) - { - // _d_newclass now use default GC alignment (looks like (void*).sizeof * 2 for - // small objects). We will just use the maximum of filed alignments. - alias classInstanceAlignment!T alignment; - alias _alignUp!alignment aligned; - -- static struct Scoped(T) -+ static struct Scoped - { - // Addition of `alignment` is required as `Scoped_store` can be misaligned in memory. - private void[aligned(__traits(classInstanceSize, T) + size_t.sizeof) + alignment] Scoped_store = void; -@@ -3112,10 +4197,8 @@ unittest - } - alias Scoped_payload this; - -- @disable this(this) -- { -- assert(false, "Illegal call to Scoped this(this)"); -- } -+ @disable this(); -+ @disable this(this); - - ~this() - { -@@ -3125,11 +4208,47 @@ unittest - } - } - -- Scoped!T result; -- immutable size_t d = cast(void*) result.Scoped_payload - result.Scoped_store.ptr; -- *cast(size_t*) &result.Scoped_store[$ - size_t.sizeof] = d; -- emplace!(Unqual!T)(result.Scoped_store[d .. $ - size_t.sizeof], args); -- return result; -+ /// Returns the scoped object -+ @system auto scoped(Args...)(auto ref Args args) -+ { -+ Scoped result = void; -+ void* alignedStore = cast(void*) aligned(cast(size_t) result.Scoped_store.ptr); -+ immutable size_t d = alignedStore - result.Scoped_store.ptr; -+ *cast(size_t*) &result.Scoped_store[$ - size_t.sizeof] = d; -+ emplace!(Unqual!T)(result.Scoped_store[d .. $ - size_t.sizeof], args); -+ return result; -+ } -+} -+/// -+unittest -+{ -+ class A -+ { -+ int x; -+ this() {x = 0;} -+ this(int i){x = i;} -+ } -+ -+ // Standard usage -+ auto a1 = scoped!A(); -+ auto a2 = scoped!A(1); -+ a1.x = 42; -+ assert(a1.x == 42); -+ assert(a2.x == 1); -+ -+ // Restrictions -+ static assert(!is(typeof({ -+ auto e1 = a1; // illegal, scoped objects can't be copied -+ assert([a2][0].x == 42); // ditto -+ alias ScopedObject = typeof(a1); -+ auto e2 = ScopedObject(); //Illegal, must be built via scoped!A -+ auto e3 = ScopedObject(1); //Illegal, must be built via scoped!A -+ }))); -+ -+ // Use with alias -+ alias makeScopedA = scoped!A; -+ auto a6 = makeScopedA(); -+ auto a7 = makeScopedA(); - } - - private size_t _alignUp(size_t alignment)(size_t n) -@@ -3278,11 +4397,10 @@ unittest // Issue 8039 testcase - assert(dels == 1+6); - } - -+//GDC bug 52 -+/+ - unittest - { -- pragma(msg, "test disabled on gdc, see gdc bug 52 (NRVO not implemented)"); -- version(none) -- { - // bug4500 - class A - { -@@ -3300,8 +4418,8 @@ unittest - - a1.a = a1; - assert(a1.check()); -- } - } -++/ - - unittest - { -@@ -3370,6 +4488,24 @@ unittest - assert(val == 4); - } - -+unittest -+{ -+ class C -+ { -+ this(){} -+ this(int){} -+ this(int, int){} -+ } -+ alias makeScopedC = scoped!C; -+ -+ auto a = makeScopedC(); -+ auto b = makeScopedC(1); -+ auto c = makeScopedC(1, 1); -+ -+ static assert(is(typeof(a) == typeof(b))); -+ static assert(is(typeof(b) == typeof(c))); -+} -+ - /** - Defines a simple, self-documenting yes/no flag. This makes it easy for - APIs to define functions accepting flags without resorting to $(D ---- a/src/libphobos/src/std/typelist.d 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/libphobos/src/std/typelist.d 2014-04-01 16:32:51.000000000 +0100 -@@ -0,0 +1,456 @@ -+// Written in the D programming language. -+ -+/** -+ * This module defines a list of types $(D_PARAM TypeList) -+ * and operations on $(D_PARAM TypeList)s. -+ * Together they define a compile-time functional programming framework, -+ * complete with lambdas, higher-order functions, and arbitrary data structures -+ * -+ * Macros: -+ * WIKI = Phobos/StdTypelist -+ * -+ * Synopsis: -+ * -+ * ---- -+ * // **** BUG **** problems with mutual recursion -+ * template Synopsis(T...) -+ * { -+ * alias TypeList!(T) list; -+ * -+ * template IsPtr(U) { -+ * static if (is(U foo: V*, V)) -+ * enum IsPtr = true; -+ * else -+ * enum IsPtr = false; -+ * } -+ * enum arePointers = All!(list, IsPtr); -+ * -+ * alias Map!(StripPtr, list) StripPointers; -+ * } -+ * static assert(is (Synopsis!(char**, void***).StripPointers.toTuple == TypeTuple!(char, void))); -+ * ---- -+ * -+ * Copyright: Copyright Bartosz Milewski 2008- 2009. -+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. -+ * Authors: $(WEB bartoszmilewski.wordpress.com, Bartosz Milewski) -+ * Source: $(PHOBOSSRC std/_typelist.d) -+ */ -+/* Copyright Burton Radons 2008 - 2009. -+ * Distributed under the Boost Software License, Version 1.0. -+ * (See accompanying file LICENSE_1_0.txt or copy at -+ * http://www.boost.org/LICENSE_1_0.txt) -+ */ -+module std.typelist; -+version(unittest) { -+ import std.typetuple; -+} -+ -+/** -+ * Creates a compile-time list of types from a tuple. -+ * $(D TypeList)s are more general than tuples because -+ * you can pass more than one $(D TypeList) to a template. -+ * You may also combine them into higher-order structures. -+ * $(D TypeList)s are passed to other templates as alias parameters -+ * To create an empty list use $(D TypeList!()) -+ * -+ * $(D TypeList) efines several "methods": -+ * -+ * $(D_PARAM toTuple), $(D_PARAM head), $(D_PARAM tail), $(D_PARAM length), $(D_PARAM isEmpty) -+ * -+ * Example: -+ * --- -+ * template Filter(alias Pred, alias List) -+ * { -+ * static if (List.isEmpty) -+ * alias TypeList!() Filter; -+ * else static if (Pred!(List.head)) -+ * alias Cons!(List.head, Filter!(Pred, List.tail)) Filter; -+ * else -+ * alias Filter!(Pred, List.tail) Filter; -+ * } -+ * --- -+ */ -+ -+template TypeList(T...) -+{ -+ alias T toTuple; -+ -+ static if(T.length != 0) -+ { -+ alias T[0] head; -+ alias TypeList!(T[1..$]) tail; -+ enum length = T.length; -+ enum isEmpty = false; -+ } -+ else -+ { -+ enum length = 0; -+ enum isEmpty = true; -+ } -+} -+ -+unittest { -+ static assert (is (TypeList!(void*, int).toTuple == TypeTuple!(void*, int))); -+ static assert (is (TypeList!(void*, int).head == void*)); -+ static assert (is (TypeList!(void*, int).tail.toTuple == TypeTuple!(int))); -+ static assert (is (TypeList!(int).tail.toTuple == TypeTuple!())); -+ static assert (TypeList!(int).tail.isEmpty); -+ -+ static assert (TypeList!(void*, int).length == 2); -+ static assert (!TypeList!(void*, int).isEmpty); -+ static assert (TypeList!().length == 0); -+ static assert (TypeList!().isEmpty); -+} -+ -+/** -+ * Appends a type tuple to a $(D TypeList), returns a $(D TypeList) -+*/ -+template AppendTypes(alias List, T...) -+{ -+ static if (List.isEmpty) -+ alias TypeList!(T) AppendTypes; -+ else -+ alias TypeList!(List.toTuple, T) AppendTypes; -+} -+ -+unittest { -+ static assert (is (AppendTypes!(TypeList!(void*, int), long, short).toTuple -+ == TypeTuple!(void*, int, long, short))); -+ static assert (is (AppendTypes!(TypeList!(void*, int)).toTuple -+ == TypeTuple!(void*, int))); -+ static assert (AppendTypes!(TypeList!()).isEmpty); -+} -+ -+/** -+ * Appends one $(D TypeList) to another, returns a $(D TypeList) -+*/ -+template Append(alias Left, alias Right) -+{ -+ alias AppendTypes!(Left, Right.toTuple) Append; -+} -+ -+unittest { -+ static assert (is (Append!(TypeList!(void*, int), TypeList!(long, short)).toTuple -+ == TypeTuple!(void*, int, long, short))); -+ static assert (is (Append!(TypeList!(void*, int), TypeList!()).toTuple -+ == TypeTuple!(void*, int))); -+ static assert (Append!(TypeList!(), TypeList!()).isEmpty); -+} -+ -+/** -+ * Prepends a type to a $(D TypeList), returns a $(D TypeList) -+*/ -+template Cons(T, alias List) -+{ -+ static if (List.isEmpty) -+ alias TypeList!(T) Cons; -+ else -+ alias TypeList!(T, List.toTuple) Cons; -+} -+ -+unittest { -+ static assert (is (Cons!(long, TypeList!(void*, int)).toTuple -+ == TypeTuple!(long, void*, int))); -+ static assert (is (Cons!(long, TypeList!(void*, int)).head -+ == long)); -+ static assert (is (Cons!(int, TypeList!()).toTuple == TypeTuple!(int))); -+ static assert (is (Cons!(char[], Cons!(int, TypeList!())).toTuple -+ == TypeTuple!(char[], int))); -+} -+ -+/** -+ * Tests if all emements of a $(D TypeList) against a predicate. -+ * Returns true if all all types satisfy the predicate, false otherwise. -+*/ -+template All(alias List, alias F) -+{ -+ static if (List.isEmpty) -+ enum All = true; -+ else -+ enum All = F!(List.head) && All!(List.tail, F); -+} -+ -+version(unittest) { -+ template IsPointer(T) -+ { -+ static if (is (T foo: U*, U)) -+ enum IsPointer = true; -+ else -+ enum IsPointer = false; -+ } -+} -+ -+unittest { -+ static assert (All!(TypeList!(void*, char*, int**), IsPointer)); -+ static assert (!All!(TypeList!(void*, char*, int), IsPointer)); -+} -+ -+/** -+ * Tests if there is an emement in a $(D TypeList) that satisfies a predicate. -+*/ -+template Any(alias List, alias F) -+{ -+ static if (List.isEmpty) -+ enum Any = false; -+ else -+ enum Any = F!(List.head) || Any!(List.tail, F); -+} -+ -+unittest { -+ static assert (Any!(TypeList!(int, char*, int**), IsPointer)); -+ static assert (!Any!(TypeList!(char[], char, int), IsPointer)); -+} -+ -+/** -+ * Applies a given "function" on types to a type tuple. Returns a tuple of results -+*/ -+template Map(alias F, T...) -+{ -+ alias Map!(F, TypeList!(T)).toTuple Map; -+} -+ -+/** -+ * Applies a given "function" to a $(D TypeList). Returns a $(D TypeList) of results -+*/ -+private template Map(alias F, alias List) -+{ -+ static if (List.isEmpty) -+ alias TypeList!() Map; -+ else -+ alias Cons!(F!(List.head), Map!(F, List.tail)) Map; -+} -+ -+version(unittest) { -+ template MakePtr(T) -+ { -+ alias T* MakePtr; -+ } -+} -+ -+unittest { -+ static assert (is (MakePtr!(int) == int*)); -+ static assert (is (Map!(MakePtr, void *, char) == TypeTuple!(void**, char*))); -+} -+ -+/** -+ * Filters a type tuple using a predicate. -+ * Takes a predicate and a tuple and returns another tuple -+*/ -+template Filter(alias Pred, T...) -+{ -+ alias Filter!(Pred, TypeList!(T)).toTuple Filter; -+} -+ -+/** -+ * Filters a $(D TypeList) using a predicate. Returns a $(D TypeList) of elements that -+ * satisfy the predicate. -+*/ -+template Filter(alias Pred, alias List) -+{ -+ static if (List.isEmpty) -+ alias TypeList!() Filter; -+ else static if (Pred!(List.head)) -+ alias Cons!(List.head, Filter!(Pred, List.tail)) Filter; -+ else -+ alias Filter!(Pred, List.tail) Filter; -+} -+ -+unittest { -+ static assert(is(Filter!(IsPointer, int, void*, char[], int*) == TypeTuple!(void*, int*))); -+ static assert(is(Filter!(IsPointer) == TypeTuple!())); -+} -+ -+template FoldRight(alias F, alias Init, alias List) -+{ -+ static if (List.isEmpty) -+ alias Init FoldRight; -+ else -+ alias F!(List.head, FoldRight!(F, Init, List.tail)) FoldRight; -+} -+ -+template FoldRight(alias F, int Init, alias List) -+{ -+ static if (List.isEmpty) -+ alias Init FoldRight; -+ else -+ alias F!(List.head, FoldRight!(F, Init, List.tail)) FoldRight; -+} -+ -+version(unittest) { -+ template snoC(T, alias List) -+ { -+ alias TypeList!(List.toTuple, T) snoC; -+ } -+ -+ template Inc(T, int i) -+ { -+ enum Inc = i + 1; -+ } -+} -+ -+unittest { -+ // *** Compiler bugs -+ //static assert (snoC!(int, TypeList!(long)).toTuple == TypeTuple!(long, int)); -+ //static assert (FoldRight!(snoC, TypeList!(), TypeList!(int, long)).toTuple == TypeTuple!(long, int)); -+ static assert (!FoldRight!(snoC, TypeList!(), TypeList!(int)).isEmpty); -+ static assert (FoldRight!(Inc, 0, TypeList!(int, long)) == 2); -+} -+ -+/** A list of functions operating on types. -+ * Used to pass multiple type functions to -+ * a template. -+ * -+ * Example: -+ * ---- -+ * template Or(alias FList) -+ * { -+ * template lambda(X) -+ * { -+ * static if (FList.isEmpty) -+ * enum lambda = true; -+ * else -+ * enum lambda = FList.head!(X) || Or!(FList.tail).apply!(X); -+ * } -+ * alias lambda apply; -+ * } -+ * ---- -+*/ -+template TypeFunList() -+{ -+ enum length = 0; -+ enum isEmpty = true; -+} -+ -+template TypeFunList(alias F) -+{ -+ alias F head; -+ alias TypeFunList!() tail; -+ enum length = 1; -+ enum isEmpty = false; -+} -+ -+template TypeFunList(alias F, alias Tail) -+{ -+ alias F head; -+ alias Tail tail; -+ enum length = 1 + Tail.length; -+ enum isEmpty = false; -+} -+ -+unittest { -+ static assert (TypeFunList!().isEmpty); -+ static assert (!TypeFunList!(IsPointer).isEmpty); -+ static assert (TypeFunList!(IsPointer).tail.isEmpty); -+ static assert (TypeFunList!(IsPointer).head!(void*)); -+ static assert (TypeFunList!(IsPointer, TypeFunList!(IsPointer)).head!(void *)); -+ static assert (TypeFunList!(IsPointer, TypeFunList!(IsPointer)).tail.head!(void *)); -+} -+ -+/** Negates a type predicate. -+ * The negated predicate is a "member" $(D apply). -+ * -+ * Example: -+ * ---- -+ * static assert (Not!(IsPointer).apply!(int)); -+ * ---- -+*/ -+template Not(alias F) -+{ -+ template lambda(X) -+ { -+ enum lambda = !F!(X); -+ } -+ alias lambda apply; -+} -+ -+unittest { -+ static assert (Not!(IsPointer).apply!(int)); -+} -+ -+/** Combines two type predicates using logical OR. -+ * The resulting predicate is callable through the field $(D apply) -+ * -+ * Example: -+ * ---- -+ * static assert(Or!(IsPointer, Not!(IsPointer).apply).apply!(int)); -+ * ---- -+*/ -+template Or(alias F1, alias F2) -+{ -+ template lambda(X) -+ { -+ enum lambda = F1!(X) || F2!(X); -+ } -+ alias lambda apply; -+} -+ -+unittest { -+ static assert(Or!(IsPointer, IsPointer).apply!(int*)); -+ static assert(Or!(IsPointer, Not!(IsPointer).apply).apply!(int)); -+} -+ -+/** Combines a list of type predicates using logical OR. -+ * The resulting predicate is callable through the field $(D apply) -+*/ -+template Or(alias FList) -+{ -+ template lambda(X) -+ { -+ static if (FList.isEmpty) -+ enum lambda = true; -+ else -+ enum lambda = FList.head!(X) || Or!(FList.tail).apply!(X); -+ } -+ alias lambda apply; -+} -+ -+unittest { -+ static assert (Or!( -+ TypeFunList!(IsPointer, -+ TypeFunList!(Not!(IsPointer).apply) -+ )).apply!(int*)); -+} -+ -+/** Combines two type predicates using logical AND. -+ * The resulting predicate is callable through the field $(D apply) -+ * -+ * Example: -+ * ---- -+ * static assert(!And!(IsPointer, Not!(IsPointer).apply).apply!(int)); -+ * ---- -+*/ -+template And(alias F1, alias F2) -+{ -+ template lambda(X) -+ { -+ enum lambda = F1!(X) && F2!(X); -+ } -+ alias lambda apply; -+} -+ -+unittest { -+ static assert(And!(IsPointer, IsPointer).apply!(int*)); -+ static assert(!And!(IsPointer, Not!(IsPointer).apply).apply!(int)); -+} -+ -+/** Combines a list of type predicates using logical AND. -+ * The resulting predicate is callable through the field $(D apply) -+*/ -+template And(alias FList) -+{ -+ template lambda(X) -+ { -+ static if (FList.isEmpty) -+ enum lambda = true; -+ else -+ enum lambda = FList.head!(X) && And!(FList.tail).apply!(X); -+ } -+ alias lambda apply; -+} -+ -+unittest { -+ static assert (!And!( -+ TypeFunList!(IsPointer, -+ TypeFunList!(Not!(IsPointer).apply) -+ )).apply!(int*)); -+} ---- a/src/libphobos/src/std/typetuple.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/typetuple.d 2014-04-01 16:32:51.000000000 +0100 -@@ -38,45 +38,37 @@ import std.traits; - - /** - * Creates a typetuple out of a sequence of zero or more types. -- * Example: -- * --- -- * import std.typetuple; -- * alias TypeTuple!(int, double) TL; -- * -- * int foo(TL td) // same as int foo(int, double); -- * { -- * return td[0] + cast(int)td[1]; -- * } -- * --- -- * -- * Example: -- * --- -- * TypeTuple!(TL, char) -- * // is equivalent to: -- * TypeTuple!(int, double, char) -- * --- - */ - template TypeTuple(TList...) - { - alias TList TypeTuple; - } - -+/// -+unittest -+{ -+ import std.typetuple; -+ alias TL = TypeTuple!(int, double); -+ -+ int foo(TL td) // same as int foo(int, double); -+ { -+ return td[0] + cast(int)td[1]; -+ } -+} -+ -+/// -+unittest -+{ -+ alias TL = TypeTuple!(int, double); -+ -+ alias Types = TypeTuple!(TL, char); -+ static assert(is(Types == TypeTuple!(int, double, char))); -+} -+ - /** - * Returns the index of the first occurrence of type T in the - * sequence of zero or more types TList. - * If not found, -1 is returned. -- * Example: -- * --- -- * import std.typetuple; -- * import std.stdio; -- * -- * void foo() -- * { -- * writefln("The index of long is %s", -- * staticIndexOf!(long, TypeTuple!(int, long, double))); -- * // prints: The index of long is 1 -- * } -- * --- - */ - template staticIndexOf(T, TList...) - { -@@ -89,6 +81,20 @@ template staticIndexOf(alias T, TList... - enum staticIndexOf = genericIndexOf!(T, TList).index; - } - -+/// -+unittest -+{ -+ import std.typetuple; -+ import std.stdio; -+ -+ void foo() -+ { -+ writefln("The index of long is %s", -+ staticIndexOf!(long, TypeTuple!(int, long, double))); -+ // prints: The index of long is 1 -+ } -+} -+ - // [internal] - private template genericIndexOf(args...) - if (args.length >= 1) -@@ -145,24 +151,9 @@ alias staticIndexOf IndexOf; - /** - * Returns a typetuple created from TList with the first occurrence, - * if any, of T removed. -- * Example: -- * --- -- * Erase!(long, int, long, double, char) -- * // is the same as: -- * TypeTuple!(int, double, char) -- * --- -- */ --// template Erase(T, TList...) --// { --// static if (TList.length == 0) --// alias TList Erase; --// else static if (is(T == TList[0])) --// alias TList[1 .. $] Erase; --// else --// alias TypeTuple!(TList[0], Erase!(T, TList[1 .. $])) Erase; --// } -- template Erase(T, TList...) -- { -+ */ -+template Erase(T, TList...) -+{ - alias GenericErase!(T, TList).result Erase; - } - -@@ -172,6 +163,14 @@ template Erase(alias T, TList...) - alias GenericErase!(T, TList).result Erase; - } - -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, double, char); -+ alias TL = Erase!(long, Types); -+ static assert(is(TL == TypeTuple!(int, double, char))); -+} -+ - // [internal] - private template GenericErase(args...) - if (args.length >= 1) -@@ -189,11 +188,11 @@ private template GenericErase(args...) - else - alias TypeTuple!(head, GenericErase!(e, tail).result) result; - } -- else -+ else - { - alias TypeTuple!() result; - } -- } -+} - - unittest - { -@@ -210,14 +209,6 @@ unittest - /** - * Returns a typetuple created from TList with the all occurrences, - * if any, of T removed. -- * Example: -- * --- -- * alias TypeTuple!(int, long, long, int) TL; -- * -- * EraseAll!(long, TL) -- * // is the same as: -- * TypeTuple!(int, int) -- * --- - */ - template EraseAll(T, TList...) - { -@@ -230,6 +221,15 @@ template EraseAll(alias T, TList...) - alias GenericEraseAll!(T, TList).result EraseAll; - } - -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, long, int); -+ -+ alias TL = EraseAll!(long, Types); -+ static assert(is(TL == TypeTuple!(int, int))); -+} -+ - // [internal] - private template GenericEraseAll(args...) - if (args.length >= 1) -@@ -248,11 +248,11 @@ private template GenericEraseAll(args... - else - alias TypeTuple!(head, next) result; - } -- else -+ else - { - alias TypeTuple!() result; - } -- } -+} - - unittest - { -@@ -269,14 +269,6 @@ unittest - /** - * Returns a typetuple created from TList with the all duplicate - * types removed. -- * Example: -- * --- -- * alias TypeTuple!(int, long, long, int, float) TL; -- * -- * NoDuplicates!(TL) -- * // is the same as: -- * TypeTuple!(int, long, float) -- * --- - */ - template NoDuplicates(TList...) - { -@@ -286,6 +278,15 @@ template NoDuplicates(TList...) - alias TypeTuple!(TList[0], NoDuplicates!(EraseAll!(TList[0], TList[1 .. $]))) NoDuplicates; - } - -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, long, int, float); -+ -+ alias TL = NoDuplicates!(Types); -+ static assert(is(TL == TypeTuple!(int, long, float))); -+} -+ - unittest - { - static assert( -@@ -298,14 +299,6 @@ unittest - /** - * Returns a typetuple created from TList with the first occurrence - * of type T, if found, replaced with type U. -- * Example: -- * --- -- * alias TypeTuple!(int, long, long, int, float) TL; -- * -- * Replace!(long, char, TL) -- * // is the same as: -- * TypeTuple!(int, char, long, int, float) -- * --- - */ - template Replace(T, U, TList...) - { -@@ -330,6 +323,15 @@ template Replace(alias T, alias U, TList - alias GenericReplace!(T, U, TList).result Replace; - } - -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, long, int, float); -+ -+ alias TL = Replace!(long, char, Types); -+ static assert(is(TL == TypeTuple!(int, char, long, int, float))); -+} -+ - // [internal] - private template GenericReplace(args...) - if (args.length >= 2) -@@ -349,7 +351,7 @@ private template GenericReplace(args...) - alias TypeTuple!(head, - GenericReplace!(from, to, tail).result) result; - } -- else -+ else - { - alias TypeTuple!() result; - } -@@ -377,14 +379,6 @@ unittest - /** - * Returns a typetuple created from TList with all occurrences - * of type T, if found, replaced with type U. -- * Example: -- * --- -- * alias TypeTuple!(int, long, long, int, float) TL; -- * -- * ReplaceAll!(long, char, TL) -- * // is the same as: -- * TypeTuple!(int, char, char, int, float) -- * --- - */ - template ReplaceAll(T, U, TList...) - { -@@ -409,6 +403,15 @@ template ReplaceAll(alias T, alias U, TL - alias GenericReplaceAll!(T, U, TList).result ReplaceAll; - } - -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, long, int, float); -+ -+ alias TL = ReplaceAll!(long, char, Types); -+ static assert(is(TL == TypeTuple!(int, char, char, int, float))); -+} -+ - // [internal] - private template GenericReplaceAll(args...) - if (args.length >= 2) -@@ -455,35 +458,34 @@ unittest - - /** - * Returns a typetuple created from TList with the order reversed. -- * Example: -- * --- -- * alias TypeTuple!(int, long, long, int, float) TL; -- * -- * Reverse!(TL) -- * // is the same as: -- * TypeTuple!(float, int, long, long, int) -- * --- - */ - template Reverse(TList...) - { -- static if (TList.length == 0) -- alias TList Reverse; -+ static if (TList.length <= 1) -+ { -+ alias Reverse = TList; -+ } - else -- alias TypeTuple!(Reverse!(TList[1 .. $]), TList[0]) Reverse; -+ { -+ alias Reverse = -+ TypeTuple!( -+ Reverse!(TList[$/2 .. $ ]), -+ Reverse!(TList[ 0 .. $/2])); -+ } -+} -+ -+/// -+unittest -+{ -+ alias Types = TypeTuple!(int, long, long, int, float); -+ -+ alias TL = Reverse!(Types); -+ static assert(is(TL == TypeTuple!(float, int, long, long, int))); - } - - /** - * Returns the type from TList that is the most derived from type T. - * If none are found, T is returned. -- * Example: -- * --- -- * class A { } -- * class B : A { } -- * class C : B { } -- * alias TypeTuple!(A, C, B) TL; -- * -- * MostDerived!(Object, TL) x; // x is declared as type C -- * --- - */ - template MostDerived(T, TList...) - { -@@ -495,20 +497,21 @@ template MostDerived(T, TList...) - alias MostDerived!(T, TList[1 .. $]) MostDerived; - } - -+/// -+unittest -+{ -+ class A { } -+ class B : A { } -+ class C : B { } -+ alias Types = TypeTuple!(A, C, B); -+ -+ MostDerived!(Object, Types) x; // x is declared as type C -+ static assert(is(typeof(x) == C)); -+} -+ - /** - * Returns the typetuple TList with the types sorted so that the most - * derived types come first. -- * Example: -- * --- -- * class A { } -- * class B : A { } -- * class C : B { } -- * alias TypeTuple!(A, C, B) TL; -- * -- * DerivedToFront!(TL) -- * // is the same as: -- * TypeTuple!(C, B, A) -- * --- - */ - template DerivedToFront(TList...) - { -@@ -521,29 +524,47 @@ template DerivedToFront(TList...) - TList[1 .. $]))) DerivedToFront; - } - -+/// -+unittest -+{ -+ class A { } -+ class B : A { } -+ class C : B { } -+ alias Types = TypeTuple!(A, C, B); -+ -+ alias TL = DerivedToFront!(Types); -+ static assert(is(TL == TypeTuple!(C, B, A))); -+} - - /** - Evaluates to $(D TypeTuple!(F!(T[0]), F!(T[1]), ..., F!(T[$ - 1]))). -- --Example: ------ --alias staticMap!(Unqual, int, const int, immutable int) T; --static assert(is(T == TypeTuple!(int, int, int))); ------ - */ - template staticMap(alias F, T...) - { - static if (T.length == 0) - { -- alias TypeTuple!() staticMap; -+ alias staticMap = TypeTuple!(); -+ } -+ else static if (T.length == 1) -+ { -+ alias staticMap = TypeTuple!(F!(T[0])); - } - else - { -- alias TypeTuple!(F!(T[0]), -- staticMap!(F, T[1 .. $])) staticMap; -+ alias staticMap = -+ TypeTuple!( -+ staticMap!(F, T[ 0 .. $/2]), -+ staticMap!(F, T[$/2 .. $ ])); - } - } - -+/// -+unittest -+{ -+ alias TL = staticMap!(Unqual, int, const int, immutable int); -+ static assert(is(TL == TypeTuple!(int, int, int))); -+} -+ - unittest - { - // empty -@@ -564,33 +585,30 @@ $(D F!(T[0]) && F!(T[1]) && ... && F!(T[ - - Evaluation is $(I not) short-circuited if a false result is encountered; the - template predicate must be instantiable with all the given items. -- --Example: ------ --static assert(!allSatisfy!(isIntegral, int, double)); --static assert(allSatisfy!(isIntegral, int, long)); ------ - */ - template allSatisfy(alias F, T...) - { - static if (T.length == 0) - { -- enum bool allSatisfy = true; -+ enum allSatisfy = true; - } - else static if (T.length == 1) - { -- alias F!(T[0]) allSatisfy; -+ enum allSatisfy = F!(T[0]); - } - else - { -- enum bool allSatisfy = F!(T[0]) && allSatisfy!(F, T[1 .. $]); -+ enum allSatisfy = -+ allSatisfy!(F, T[ 0 .. $/2]) && -+ allSatisfy!(F, T[$/2 .. $ ]); - } - } - -+/// - unittest - { - static assert(!allSatisfy!(isIntegral, int, double)); -- static assert(allSatisfy!(isIntegral, int, long)); -+ static assert( allSatisfy!(isIntegral, int, long)); - } - - /** -@@ -599,69 +617,69 @@ $(D F!(T[0]) || F!(T[1]) || ... || F!(T[ - - Evaluation is $(I not) short-circuited if a true result is encountered; the - template predicate must be instantiable with all the given items. -- --Example: ------ --static assert(!anySatisfy!(isIntegral, string, double)); --static assert(anySatisfy!(isIntegral, int, double)); ------ - */ - template anySatisfy(alias F, T...) - { - static if(T.length == 0) - { -- enum bool anySatisfy = false; -+ enum anySatisfy = false; - } - else static if (T.length == 1) - { -- alias F!(T[0]) anySatisfy; -+ enum anySatisfy = F!(T[0]); - } - else - { -- enum bool anySatisfy = F!(T[0]) || anySatisfy!(F, T[1 .. $]); -+ enum anySatisfy = -+ anySatisfy!(F, T[ 0 .. $/2]) || -+ anySatisfy!(F, T[$/2 .. $ ]); - } - } - -+/// - unittest - { - static assert(!anySatisfy!(isIntegral, string, double)); -- static assert(anySatisfy!(isIntegral, int, double)); -+ static assert( anySatisfy!(isIntegral, int, double)); - } - - --/++ -- Filters a $(D TypeTuple) using a template predicate. Returns a -- $(D TypeTuple) of the elements which satisfy the predicate. -- -- Examples: ---------------------- --static assert(is(Filter!(isNarrowString, string, wstring, -- dchar[], char[], dstring, int) == -- TypeTuple!(string, wstring, char[]))); --static assert(is(Filter!(isUnsigned, int, byte, ubyte, -- dstring, dchar, uint, ulong) == -- TypeTuple!(ubyte, uint, ulong))); ---------------------- -- +/ -+/** -+ * Filters a $(D TypeTuple) using a template predicate. Returns a -+ * $(D TypeTuple) of the elements which satisfy the predicate. -+ */ - template Filter(alias pred, TList...) - { -- static if(TList.length == 0) -- alias TypeTuple!() Filter; -- else static if(pred!(TList[0])) -- alias TypeTuple!(TList[0], Filter!(pred, TList[1 .. $])) Filter; -+ static if (TList.length == 0) -+ { -+ alias Filter = TypeTuple!(); -+ } -+ else static if (TList.length == 1) -+ { -+ static if (pred!(TList[0])) -+ alias Filter = TypeTuple!(TList[0]); -+ else -+ alias Filter = TypeTuple!(); -+ } - else -- alias Filter!(pred, TList[1 .. $]) Filter; -+ { -+ alias Filter = -+ TypeTuple!( -+ Filter!(pred, TList[ 0 .. $/2]), -+ Filter!(pred, TList[$/2 .. $ ])); -+ } - } - --//Verify Examples -+/// - unittest - { -- static assert(is(Filter!(isNarrowString, string, wstring, -- dchar[], char[], dstring, int) == -- TypeTuple!(string, wstring, char[]))); -- static assert(is(Filter!(isUnsigned, int, byte, ubyte, -- dstring, dchar, uint, ulong) == -- TypeTuple!(ubyte, uint, ulong))); -+ alias Types1 = TypeTuple!(string, wstring, dchar[], char[], dstring, int); -+ alias TL1 = Filter!(isNarrowString, Types1); -+ static assert(is(TL1 == TypeTuple!(string, wstring, char[]))); -+ -+ alias Types2 = TypeTuple!(int, byte, ubyte, dstring, dchar, uint, ulong); -+ alias TL2 = Filter!(isUnsigned, Types2); -+ static assert(is(TL2 == TypeTuple!(ubyte, uint, ulong))); - } - - unittest -@@ -693,13 +711,6 @@ private version (unittest) - - /** - * Negates the passed template predicate. -- * -- * Examples: -- * --- -- * alias templateNot!isPointer isNoPointer; -- * static assert(!isNoPointer!(int*)); -- * static assert(allSatisfy!(isNoPointer, string, char, float)); -- * --- - */ - template templateNot(alias pred) - { -@@ -709,12 +720,12 @@ template templateNot(alias pred) - } - } - --// Verify examples. -+/// - unittest - { - import std.traits; - -- alias templateNot!isPointer isNoPointer; -+ alias isNoPointer = templateNot!isPointer; - static assert(!isNoPointer!(int*)); - static assert(allSatisfy!(isNoPointer, string, char, float)); - } -@@ -737,17 +748,6 @@ unittest - * The predicates are evaluated from left to right, aborting evaluation in a - * short-cut manner if a false result is encountered, in which case the latter - * instantiations do not need to compile. -- * -- * Examples: -- * --- -- * alias templateAnd!(isNumeric, templateNot!isUnsigned) storesNegativeNumbers; -- * static assert(storesNegativeNumbers!int); -- * static assert(!storesNegativeNumbers!string && !storesNegativeNumbers!uint); -- * -- * // An empty list of predicates always yields true. -- * alias templateAnd!() alwaysTrue; -- * static assert(alwaysTrue!int); -- * --- - */ - template templateAnd(Preds...) - { -@@ -767,15 +767,15 @@ template templateAnd(Preds...) - } - } - --// Verify examples. -+/// - unittest - { -- alias templateAnd!(isNumeric, templateNot!isUnsigned) storesNegativeNumbers; -+ alias storesNegativeNumbers = templateAnd!(isNumeric, templateNot!isUnsigned); - static assert(storesNegativeNumbers!int); - static assert(!storesNegativeNumbers!string && !storesNegativeNumbers!uint); - - // An empty list of predicates always yields true. -- alias templateAnd!() alwaysTrue; -+ alias alwaysTrue = templateAnd!(); - static assert(alwaysTrue!int); - } - -@@ -783,9 +783,9 @@ unittest - { - foreach (T; TypeTuple!(int, staticMap, 42)) - { -- static assert(Instantiate!(templateAnd!(), T)); -- static assert(Instantiate!(templateAnd!(testAlways), T)); -- static assert(Instantiate!(templateAnd!(testAlways, testAlways), T)); -+ static assert( Instantiate!(templateAnd!(), T)); -+ static assert( Instantiate!(templateAnd!(testAlways), T)); -+ static assert( Instantiate!(templateAnd!(testAlways, testAlways), T)); - static assert(!Instantiate!(templateAnd!(testNever), T)); - static assert(!Instantiate!(templateAnd!(testAlways, testNever), T)); - static assert(!Instantiate!(templateAnd!(testNever, testAlways), T)); -@@ -804,17 +804,6 @@ unittest - * The predicates are evaluated from left to right, aborting evaluation in a - * short-cut manner if a true result is encountered, in which case the latter - * instantiations do not need to compile. -- * -- * Examples: -- * --- -- * alias templateOr!(isPointer, isUnsigned) isPtrOrUnsigned; -- * static assert(isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*)); -- * static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!string); -- * -- * // An empty list of predicates never yields true. -- * alias templateOr!() alwaysFalse; -- * static assert(!alwaysFalse!int); -- * --- - */ - template templateOr(Preds...) - { -@@ -834,15 +823,15 @@ template templateOr(Preds...) - } - } - --// Verify examples. -+/// - unittest - { -- alias templateOr!(isPointer, isUnsigned) isPtrOrUnsigned; -- static assert(isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*)); -- static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!string); -+ alias isPtrOrUnsigned = templateOr!(isPointer, isUnsigned); -+ static assert( isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*)); -+ static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!(string)); - - // An empty list of predicates never yields true. -- alias templateOr!() alwaysFalse; -+ alias alwaysFalse = templateOr!(); - static assert(!alwaysFalse!int); - } - -@@ -850,15 +839,15 @@ unittest - { - foreach (T; TypeTuple!(int, staticMap, 42)) - { -- static assert(Instantiate!(templateOr!(testAlways), T)); -- static assert(Instantiate!(templateOr!(testAlways, testAlways), T)); -- static assert(Instantiate!(templateOr!(testAlways, testNever), T)); -- static assert(Instantiate!(templateOr!(testNever, testAlways), T)); -+ static assert( Instantiate!(templateOr!(testAlways), T)); -+ static assert( Instantiate!(templateOr!(testAlways, testAlways), T)); -+ static assert( Instantiate!(templateOr!(testAlways, testNever), T)); -+ static assert( Instantiate!(templateOr!(testNever, testAlways), T)); - static assert(!Instantiate!(templateOr!(), T)); - static assert(!Instantiate!(templateOr!(testNever), T)); - -- static assert(Instantiate!(templateOr!(testAlways, testError), T)); -- static assert(Instantiate!(templateOr!(testNever, testAlways, testError), T)); -+ static assert( Instantiate!(templateOr!(testAlways, testError), T)); -+ static assert( Instantiate!(templateOr!(testNever, testAlways, testError), T)); - // DMD @@BUG@@: Assertion fails for int, seems like a error gagging - // problem. The bug goes away when removing some of the other template - // instantiations in the module. ---- a/src/libphobos/src/std/uni.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/uni.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,1457 +1,7217 @@ - // Written in the D programming language. - - /++ -- Functions which operate on Unicode characters. -- -- For functions which operate on ASCII characters and ignore Unicode -- characters, see $(LINK2 std_ascii.html, std.ascii). -+ $(SECTION Overview) - -+ $(P The $(D std.uni) module provides an implementation -+ of fundamental Unicode algorithms and data structures. -+ This doesn't include UTF encoding and decoding primitives, -+ see $(XREF _utf, decode) and $(XREF _utf, encode) in std.utf -+ for this functionality. ) -+ -+ $(P All primitives listed operate on Unicode characters and -+ sets of characters. For functions which operate on ASCII characters -+ and ignore Unicode $(CHARACTERS), see $(LINK2 std_ascii.html, std.ascii). -+ For definitions of Unicode $(CHARACTER), $(CODEPOINT) and other terms -+ used throughout this module see the $(S_LINK Terminology, terminology) section -+ below. -+ ) -+ -+ $(P The focus of this module is the core needs of developing Unicode-aware -+ applications. To that effect it provides the following optimized primitives: -+ ) -+ $(UL -+ $(LI Character classification by category and common properties: -+ $(LREF isAlpha), $(LREF isWhite) and others. -+ ) -+ $(LI -+ Case-insensitive string comparison ($(LREF sicmp), $(LREF icmp)). -+ ) -+ $(LI -+ Converting text to any of the four normalization forms via $(LREF normalize). -+ ) -+ $(LI -+ Decoding ($(LREF decodeGrapheme)) and iteration ($(LREF graphemeStride)) -+ by user-perceived characters, that is by $(LREF Grapheme) clusters. -+ ) -+ $(LI -+ Decomposing and composing of individual character(s) according to canonical -+ or compatibility rules, see $(LREF compose) and $(LREF decompose), -+ including the specific version for Hangul syllables $(LREF composeJamo) -+ and $(LREF decomposeHangul). -+ ) -+ ) -+ $(P It's recognized that an application may need further enhancements -+ and extensions, such as less commonly known algorithms, -+ or tailoring existing ones for region specific needs. To help users -+ with building any extra functionality beyond the core primitives, -+ the module provides: -+ ) -+ $(UL -+ $(LI -+ $(LREF CodepointSet), a type for easy manipulation of sets of characters. -+ Besides the typical set algebra it provides an unusual feature: -+ a D source code generator for detection of $(CODEPOINTS) in this set. -+ This is a boon for meta-programming parser frameworks, -+ and is used internally to power classification in small -+ sets like $(LREF isWhite). -+ ) -+ $(LI -+ A way to construct optimal packed multi-stage tables also known as a -+ special case of $(LUCKY Trie). -+ The functions $(LREF codepointTrie), $(LREF codepointSetTrie) -+ construct custom tries that map dchar to value. -+ The end result is a fast and predictable $(BIGOH 1) lookup that powers -+ functions like $(LREF isAlpha) and $(LREF combiningClass), -+ but for user-defined data sets. -+ ) -+ $(LI -+ Generally useful building blocks for customized normalization: -+ $(LREF combiningClass) for querying combining class -+ and $(LREF allowedIn) for testing the Quick_Check -+ property of a given normalization form. -+ ) -+ $(LI -+ Access to a large selection of commonly used sets of $(CODEPOINTS). -+ $(S_LINK Unicode properties, Supported sets) include Script, -+ Block and General Category. The exact contents of a set can be -+ observed in the CLDR utility, on the -+ $(WEB www.unicode.org/cldr/utility/properties.jsp, property index) page -+ of the Unicode website. -+ See $(LREF unicode) for easy and (optionally) compile-time checked set -+ queries. -+ ) -+ ) -+ $(SECTION Synopsis) -+ --- -+ import std.uni; -+ void main() -+ { -+ // initialize code point sets using script/block or property name -+ // now 'set' contains code points from both scripts. -+ auto set = unicode("Cyrillic") | unicode("Armenian"); -+ // same thing but simpler and checked at compile-time -+ auto ascii = unicode.ASCII; -+ auto currency = unicode.Currency_Symbol; -+ -+ // easy set ops -+ auto a = set & ascii; -+ assert(a.empty); // as it has no intersection with ascii -+ a = set | ascii; -+ auto b = currency - a; // subtract all ASCII, Cyrillic and Armenian -+ -+ // some properties of code point sets -+ assert(b.length > 45); // 46 items in Unicode 6.1, even more in 6.2 -+ // testing presence of a code point in a set -+ // is just fine, it is O(logN) -+ assert(!b['$']); -+ assert(!b['\u058F']); // Armenian dram sign -+ assert(b['¥']); -+ -+ // building fast lookup tables, these guarantee O(1) complexity -+ // 1-level Trie lookup table essentially a huge bit-set ~262Kb -+ auto oneTrie = toTrie!1(b); -+ // 2-level far more compact but typically slightly slower -+ auto twoTrie = toTrie!2(b); -+ // 3-level even smaller, and a bit slower yet -+ auto threeTrie = toTrie!3(b); -+ assert(oneTrie['£']); -+ assert(twoTrie['£']); -+ assert(threeTrie['£']); -+ -+ // build the trie with the most sensible trie level -+ // and bind it as a functor -+ auto cyrilicOrArmenian = toDelegate(set); -+ auto balance = find!(cyrilicOrArmenian)("Hello ընկեր!"); -+ assert(balance == "ընկեր!"); -+ // compatible with bool delegate(dchar) -+ bool delegate(dchar) bindIt = cyrilicOrArmenian; -+ -+ // Normalization -+ string s = "Plain ascii (and not only), is always normalized!"; -+ assert(s is normalize(s));// is the same string -+ -+ string nonS = "A\u0308ffin"; // A ligature -+ auto nS = normalize(nonS); // to NFC, the W3C endorsed standard -+ assert(nS == "Äffin"); -+ assert(nS != nonS); -+ string composed = "Äffin"; -+ -+ assert(normalize!NFD(composed) == "A\u0308ffin"); -+ // to NFKD, compatibility decomposition useful for fuzzy matching/searching -+ assert(normalize!NFKD("2¹⁰") == "210"); -+ } -+ --- -+ $(SECTION Terminology) -+ $(P The following is a list of important Unicode notions -+ and definitions. Any conventions used specifically in this -+ module alone are marked as such. The descriptions are based on the formal -+ definition as found in ($WEB http://www.unicode.org/versions/Unicode6.2.0/ch03.pdf, -+ chapter three of The Unicode Standard Core Specification.) -+ ) -+ -+ $(P $(DEF Abstract character) A unit of information used for the organization, -+ control, or representation of textual data. -+ Note that: -+ $(UL -+ $(LI When representing data, the nature of that data -+ is generally symbolic as opposed to some other -+ kind of data (for example, visual).) -+ -+ $(LI An abstract character has no concrete form -+ and should not be confused with a $(S_LINK Glyph, glyph).) -+ -+ $(LI An abstract character does not necessarily -+ correspond to what a user thinks of as a “character” -+ and should not be confused with a $(LREF Grapheme).) -+ -+ $(LI The abstract characters encoded (see Encoded character) -+ are known as Unicode abstract characters.) -+ -+ $(LI Abstract characters not directly -+ encoded by the Unicode Standard can often be -+ represented by the use of combining character sequences.) -+ ) -+ ) -+ -+ $(P $(DEF Canonical decomposition) -+ The decomposition of a character or character sequence -+ that results from recursively applying the canonical -+ mappings found in the Unicode Character Database -+ and these described in Conjoining Jamo Behavior -+ (section 12 of -+ $(WEB www.unicode.org/uni2book/ch03.pdf, Unicode Conformance)). -+ ) -+ -+ $(P $(DEF Canonical composition) -+ The precise definition of the Canonical composition -+ is the algorithm as specified in $(WEB www.unicode.org/uni2book/ch03.pdf, -+ Unicode Conformance) section 11. -+ Informally it's the process that does the reverse of the canonical -+ decomposition with the addition of certain rules -+ that e.g. prevent legacy characters from appearing in the composed result. -+ ) -+ -+ $(P $(DEF Canonical equivalent) -+ Two character sequences are said to be canonical equivalents if -+ their full canonical decompositions are identical. -+ ) -+ -+ $(P $(DEF Character) Typically differs by context. -+ For the purpose of this documentation the term $(I character) -+ implies $(I encoded character), that is, a code point having -+ an assigned abstract character (a symbolic meaning). -+ ) -+ -+ $(P $(DEF Code point) Any value in the Unicode codespace; -+ that is, the range of integers from 0 to 10FFFF (hex). -+ Not all code points are assigned to encoded characters. -+ ) -+ -+ $(P $(DEF Code unit) The minimal bit combination that can represent -+ a unit of encoded text for processing or interchange. -+ Depending on the encoding this could be: -+ 8-bit code units in the UTF-8 ($(D char)), -+ 16-bit code units in the UTF-16 ($(D wchar)), -+ and 32-bit code units in the UTF-32 ($(D dchar)). -+ $(I Note that in UTF-32, a code unit is a code point -+ and is represented by the D $(D dchar) type.) -+ ) -+ -+ $(P $(DEF Combining character) A character with the General Category -+ of Combining Mark(M). -+ $(UL -+ $(LI All characters with non-zero canonical combining class -+ are combining characters, but the reverse is not the case: -+ there are combining characters with a zero combining class. -+ ) -+ $(LI These characters are not normally used in isolation -+ unless they are being described. They include such characters -+ as accents, diacritics, Hebrew points, Arabic vowel signs, -+ and Indic matras. -+ ) -+ ) -+ ) -+ -+ $(P $(DEF Combining class) -+ A numerical value used by the Unicode Canonical Ordering Algorithm -+ to determine which sequences of combining marks are to be -+ considered canonically equivalent and which are not. -+ ) -+ -+ $(P $(DEF Compatibility decomposition) -+ The decomposition of a character or character sequence that results -+ from recursively applying both the compatibility mappings and -+ the canonical mappings found in the Unicode Character Database, and those -+ described in Conjoining Jamo Behavior no characters -+ can be further decomposed. -+ ) -+ -+ $(P $(DEF Compatibility equivalent) -+ Two character sequences are said to be compatibility -+ equivalents if their full compatibility decompositions are identical. -+ ) -+ -+ $(P $(DEF Encoded character) An association (or mapping) -+ between an abstract character and a code point. -+ ) -+ -+ $(P $(DEF Glyph) The actual, concrete image of a glyph representation -+ having been rasterized or otherwise imaged onto some display surface. -+ ) -+ -+ $(P $(DEF Grapheme base) A character with the property -+ Grapheme_Base, or any standard Korean syllable block. -+ ) -+ -+ $(P $(DEF Grapheme cluster) Defined as the text between -+ grapheme boundaries as specified by Unicode Standard Annex #29, -+ $(WEB www.unicode.org/reports/tr29/, Unicode text segmentation). -+ Important general properties of a grapheme: -+ $(UL -+ $(LI The grapheme cluster represents a horizontally segmentable -+ unit of text, consisting of some grapheme base (which may -+ consist of a Korean syllable) together with any number of -+ nonspacing marks applied to it. -+ ) -+ $(LI A grapheme cluster typically starts with a grapheme base -+ and then extends across any subsequent sequence of nonspacing marks. -+ A grapheme cluster is most directly relevant to text rendering and -+ processes such as cursor placement and text selection in editing, -+ but may also be relevant to comparison and searching. -+ ) -+ $(LI For many processes, a grapheme cluster behaves as if it was a -+ single character with the same properties as its grapheme base. -+ Effectively, nonspacing marks apply $(I graphically) to the base, -+ but do not change its properties. -+ ) -+ ) -+ $(P This module defines a number of primitives that work with graphemes: -+ $(LREF Grapheme), $(LREF decodeGrapheme) and $(LREF graphemeStride). -+ All of them are using $(I extended grapheme) boundaries -+ as defined in the aforementioned standard annex. -+ ) -+ ) -+ -+ -+ $(P $(DEF Nonspacing mark) A combining character with the -+ General Category of Nonspacing Mark (Mn) or Enclosing Mark (Me). -+ ) -+ -+ $(P $(DEF Spacing mark) A combining character that is not a nonspacing mark.) -+ -+ -+ $(SECTION Normalization) -+ -+ $(P The concepts of $(S_LINK Canonical equivalent, canonical equivalent) -+ or $(S_LINK Compatibility equivalent, compatibility equivalent) -+ characters in the Unicode Standard make it necessary to have a full, formal -+ definition of equivalence for Unicode strings. -+ String equivalence is determined by a process called normalization, -+ whereby strings are converted into forms which are compared -+ directly for identity. This is the primary goal of the normalization process, -+ see the function $(LREF normalize) to convert into any of -+ the four defined forms. -+ ) -+ -+ $(P A very important attribute of the Unicode Normalization Forms -+ is that they must remain stable between versions of the Unicode Standard. -+ A Unicode string normalized to a particular Unicode Normalization Form -+ in one version of the standard is guaranteed to remain in that Normalization -+ Form for implementations of future versions of the standard. -+ ) -+ -+ $(P The Unicode Standard specifies four normalization forms. -+ Informally, two of these forms are defined by maximal decomposition -+ of equivalent sequences, and two of these forms are defined -+ by maximal $(I composition) of equivalent sequences. -+ $(UL -+ $(LI Normalization Form D (NFD): The $(S_LINK Canonical decomposition, -+ canonical decomposition) of a character sequence.) -+ $(LI Normalization Form KD (NFKD): The $(S_LINK Compatibility decomposition, -+ compatibility decomposition) of a character sequence.) -+ $(LI Normalization Form C (NFC): The canonical composition of the -+ $(S_LINK Canonical decomposition, canonical decomposition) -+ of a coded character sequence.) -+ $(LI Normalization Form KC (NFKC): The canonical composition -+ of the $(S_LINK Compatibility decomposition, -+ compatibility decomposition) of a character sequence) -+ ) -+ ) -+ -+ $(P The choice of the normalization form depends on the particular use case. -+ NFC is the best form for general text, since it's more compatible with -+ strings converted from legacy encodings. NFKC is the preferred form for -+ identifiers, especially where there are security concerns. NFD and NFKD -+ are the most useful for internal processing. -+ ) -+ -+ $(SECTION Construction of lookup tables) -+ -+ $(P The Unicode standard describes a set of algorithms that -+ depend on having the ability to quickly look up various properties -+ of a code point. Given the the codespace of about 1 million $(CODEPOINTS), -+ it is not a trivial task to provide a space-efficient solution for -+ the multitude of properties.) -+ -+ $(P Common approaches such as hash-tables or binary search over -+ sorted code point intervals (as in $(LREF InversionList)) are insufficient. -+ Hash-tables have enormous memory footprint and binary search -+ over intervals is not fast enough for some heavy-duty algorithms. -+ ) -+ -+ $(P The recommended solution (see Unicode Implementation Guidelines) -+ is using multi-stage tables that are an implementation of the -+ $(WEB http://en.wikipedia.org/wiki/Trie, Trie) data structure with integer -+ keys and a fixed number of stages. For the remainder of the section -+ this will be called a fixed trie. The following describes a particular -+ implementation that is aimed for the speed of access at the expense -+ of ideal size savings. -+ ) -+ -+ $(P Taking a 2-level Trie as an example the principle of operation is as follows. -+ Split the number of bits in a key (code point, 21 bits) into 2 components -+ (e.g. 15 and 8). The first is the number of bits in the index of the trie -+ and the other is number of bits in each page of the trie. -+ The layout of the trie is then an array of size 2^^bits-of-index followed -+ an array of memory chunks of size 2^^bits-of-page/bits-per-element. -+ ) -+ -+ $(P The number of pages is variable (but not less then 1) -+ unlike the number of entries in the index. The slots of the index -+ all have to contain a number of a page that is present. The lookup is then -+ just a couple of operations - slice the upper bits, -+ lookup an index for these, take a page at this index and use -+ the lower bits as an offset within this page. -+ -+ Assuming that pages are laid out consequently -+ in one array at $(D pages), the pseudo-code is: -+ ) -+ --- -+ auto elemsPerPage = (2 ^^ bits_per_page) / Value.sizeOfInBits; -+ pages[index[n >> bits_per_page]][n & (elemsPerPage - 1)]; -+ --- -+ $(P Where if $(D elemsPerPage) is a power of 2 the whole process is -+ a handful of simple instructions and 2 array reads. Subsequent levels -+ of the trie are introduced by recursing on this notion - the index array -+ is treated as values. The number of bits in index is then again -+ split into 2 parts, with pages over 'current-index' and the new 'upper-index'. -+ ) -+ -+ $(P For completeness a level 1 trie is simply an array. -+ The current implementation takes advantage of bit-packing values -+ when the range is known to be limited in advance (such as $(D bool)). -+ See also $(LREF BitPacked) for enforcing it manually. -+ The major size advantage however comes from the fact -+ that multiple $(B identical pages on every level are merged) by construction. -+ ) -+ -+ $(P The process of constructing a trie is more involved and is hidden from -+ the user in a form of the convenience functions $(LREF codepointTrie), -+ $(LREF codepointSetTrie) and the even more convenient $(LREF toTrie). -+ In general a set or built-in AA with $(D dchar) type -+ can be turned into a trie. The trie object in this module -+ is read-only (immutable); it's effectively frozen after construction. -+ ) -+ -+ $(SECTION Unicode properties) -+ -+ $(P This is a full list of Unicode properties accessible through $(LREF unicode) -+ with specific helpers per category nested within. Consult the -+ $(WEB www.unicode.org/cldr/utility/properties.jsp, CLDR utility) -+ when in doubt about the contents of a particular set.) -+ -+ $(P General category sets listed below are only accessible with the -+ $(LREF unicode) shorthand accessor.) -+ $(BOOKTABLE $(B General category ), -+ $(TR $(TH Abb.) $(TH Long form) -+ $(TH Abb.) $(TH Long form)$(TH Abb.) $(TH Long form)) -+ $(TR $(TD L) $(TD Letter) -+ $(TD Cn) $(TD Unassigned) $(TD Po) $(TD Other_Punctuation)) -+ $(TR $(TD Ll) $(TD Lowercase_Letter) -+ $(TD Co) $(TD Private_Use) $(TD Ps) $(TD Open_Punctuation)) -+ $(TR $(TD Lm) $(TD Modifier_Letter) -+ $(TD Cs) $(TD Surrogate) $(TD S) $(TD Symbol)) -+ $(TR $(TD Lo) $(TD Other_Letter) -+ $(TD N) $(TD Number) $(TD Sc) $(TD Currency_Symbol)) -+ $(TR $(TD Lt) $(TD Titlecase_Letter) -+ $(TD Nd) $(TD Decimal_Number) $(TD Sk) $(TD Modifier_Symbol)) -+ $(TR $(TD Lu) $(TD Uppercase_Letter) -+ $(TD Nl) $(TD Letter_Number) $(TD Sm) $(TD Math_Symbol)) -+ $(TR $(TD M) $(TD Mark) -+ $(TD No) $(TD Other_Number) $(TD So) $(TD Other_Symbol)) -+ $(TR $(TD Mc) $(TD Spacing_Mark) -+ $(TD P) $(TD Punctuation) $(TD Z) $(TD Separator)) -+ $(TR $(TD Me) $(TD Enclosing_Mark) -+ $(TD Pc) $(TD Connector_Punctuation) $(TD Zl) $(TD Line_Separator)) -+ $(TR $(TD Mn) $(TD Nonspacing_Mark) -+ $(TD Pd) $(TD Dash_Punctuation) $(TD Zp) $(TD Paragraph_Separator)) -+ $(TR $(TD C) $(TD Other) -+ $(TD Pe) $(TD Close_Punctuation) $(TD Zs) $(TD Space_Separator)) -+ $(TR $(TD Cc) $(TD Control) $(TD Pf) -+ $(TD Final_Punctuation) $(TD -) $(TD Any)) -+ $(TR $(TD Cf) $(TD Format) -+ $(TD Pi) $(TD Initial_Punctuation) $(TD -) $(TD ASCII)) -+ ) -+ $(P Sets for other commonly useful properties that are -+ accessible with $(LREF unicode):) -+ $(BOOKTABLE $(B Common binary properties), -+ $(TR $(TH Name) $(TH Name) $(TH Name)) -+ $(TR $(TD Alphabetic) $(TD Ideographic) $(TD Other_Uppercase)) -+ $(TR $(TD ASCII_Hex_Digit) $(TD IDS_Binary_Operator) $(TD Pattern_Syntax)) -+ $(TR $(TD Bidi_Control) $(TD ID_Start) $(TD Pattern_White_Space)) -+ $(TR $(TD Cased) $(TD IDS_Trinary_Operator) $(TD Quotation_Mark)) -+ $(TR $(TD Case_Ignorable) $(TD Join_Control) $(TD Radical)) -+ $(TR $(TD Dash) $(TD Logical_Order_Exception) $(TD Soft_Dotted)) -+ $(TR $(TD Default_Ignorable_Code_Point) $(TD Lowercase) $(TD STerm)) -+ $(TR $(TD Deprecated) $(TD Math) $(TD Terminal_Punctuation)) -+ $(TR $(TD Diacritic) $(TD Noncharacter_Code_Point) $(TD Unified_Ideograph)) -+ $(TR $(TD Extender) $(TD Other_Alphabetic) $(TD Uppercase)) -+ $(TR $(TD Grapheme_Base) $(TD Other_Default_Ignorable_Code_Point) $(TD Variation_Selector)) -+ $(TR $(TD Grapheme_Extend) $(TD Other_Grapheme_Extend) $(TD White_Space)) -+ $(TR $(TD Grapheme_Link) $(TD Other_ID_Continue) $(TD XID_Continue)) -+ $(TR $(TD Hex_Digit) $(TD Other_ID_Start) $(TD XID_Start)) -+ $(TR $(TD Hyphen) $(TD Other_Lowercase) ) -+ $(TR $(TD ID_Continue) $(TD Other_Math) ) -+ ) -+ $(P Bellow is the table with block names accepted by $(LREF unicode.block). -+ Note that the shorthand version $(LREF unicode) requires "In" -+ to be prepended to the names of blocks so as to disambiguate -+ scripts and blocks.) -+ -+ $(BOOKTABLE $(B Blocks), -+ $(TR $(TD Aegean Numbers) $(TD Ethiopic Extended) $(TD Mongolian)) -+ $(TR $(TD Alchemical Symbols) $(TD Ethiopic Extended-A) $(TD Musical Symbols)) -+ $(TR $(TD Alphabetic Presentation Forms) $(TD Ethiopic Supplement) $(TD Myanmar)) -+ $(TR $(TD Ancient Greek Musical Notation) $(TD General Punctuation) $(TD Myanmar Extended-A)) -+ $(TR $(TD Ancient Greek Numbers) $(TD Geometric Shapes) $(TD New Tai Lue)) -+ $(TR $(TD Ancient Symbols) $(TD Georgian) $(TD NKo)) -+ $(TR $(TD Arabic) $(TD Georgian Supplement) $(TD Number Forms)) -+ $(TR $(TD Arabic Extended-A) $(TD Glagolitic) $(TD Ogham)) -+ $(TR $(TD Arabic Mathematical Alphabetic Symbols) $(TD Gothic) $(TD Ol Chiki)) -+ $(TR $(TD Arabic Presentation Forms-A) $(TD Greek and Coptic) $(TD Old Italic)) -+ $(TR $(TD Arabic Presentation Forms-B) $(TD Greek Extended) $(TD Old Persian)) -+ $(TR $(TD Arabic Supplement) $(TD Gujarati) $(TD Old South Arabian)) -+ $(TR $(TD Armenian) $(TD Gurmukhi) $(TD Old Turkic)) -+ $(TR $(TD Arrows) $(TD Halfwidth and Fullwidth Forms) $(TD Optical Character Recognition)) -+ $(TR $(TD Avestan) $(TD Hangul Compatibility Jamo) $(TD Oriya)) -+ $(TR $(TD Balinese) $(TD Hangul Jamo) $(TD Osmanya)) -+ $(TR $(TD Bamum) $(TD Hangul Jamo Extended-A) $(TD Phags-pa)) -+ $(TR $(TD Bamum Supplement) $(TD Hangul Jamo Extended-B) $(TD Phaistos Disc)) -+ $(TR $(TD Basic Latin) $(TD Hangul Syllables) $(TD Phoenician)) -+ $(TR $(TD Batak) $(TD Hanunoo) $(TD Phonetic Extensions)) -+ $(TR $(TD Bengali) $(TD Hebrew) $(TD Phonetic Extensions Supplement)) -+ $(TR $(TD Block Elements) $(TD High Private Use Surrogates) $(TD Playing Cards)) -+ $(TR $(TD Bopomofo) $(TD High Surrogates) $(TD Private Use Area)) -+ $(TR $(TD Bopomofo Extended) $(TD Hiragana) $(TD Rejang)) -+ $(TR $(TD Box Drawing) $(TD Ideographic Description Characters) $(TD Rumi Numeral Symbols)) -+ $(TR $(TD Brahmi) $(TD Imperial Aramaic) $(TD Runic)) -+ $(TR $(TD Braille Patterns) $(TD Inscriptional Pahlavi) $(TD Samaritan)) -+ $(TR $(TD Buginese) $(TD Inscriptional Parthian) $(TD Saurashtra)) -+ $(TR $(TD Buhid) $(TD IPA Extensions) $(TD Sharada)) -+ $(TR $(TD Byzantine Musical Symbols) $(TD Javanese) $(TD Shavian)) -+ $(TR $(TD Carian) $(TD Kaithi) $(TD Sinhala)) -+ $(TR $(TD Chakma) $(TD Kana Supplement) $(TD Small Form Variants)) -+ $(TR $(TD Cham) $(TD Kanbun) $(TD Sora Sompeng)) -+ $(TR $(TD Cherokee) $(TD Kangxi Radicals) $(TD Spacing Modifier Letters)) -+ $(TR $(TD CJK Compatibility) $(TD Kannada) $(TD Specials)) -+ $(TR $(TD CJK Compatibility Forms) $(TD Katakana) $(TD Sundanese)) -+ $(TR $(TD CJK Compatibility Ideographs) $(TD Katakana Phonetic Extensions) $(TD Sundanese Supplement)) -+ $(TR $(TD CJK Compatibility Ideographs Supplement) $(TD Kayah Li) $(TD Superscripts and Subscripts)) -+ $(TR $(TD CJK Radicals Supplement) $(TD Kharoshthi) $(TD Supplemental Arrows-A)) -+ $(TR $(TD CJK Strokes) $(TD Khmer) $(TD Supplemental Arrows-B)) -+ $(TR $(TD CJK Symbols and Punctuation) $(TD Khmer Symbols) $(TD Supplemental Mathematical Operators)) -+ $(TR $(TD CJK Unified Ideographs) $(TD Lao) $(TD Supplemental Punctuation)) -+ $(TR $(TD CJK Unified Ideographs Extension A) $(TD Latin-1 Supplement) $(TD Supplementary Private Use Area-A)) -+ $(TR $(TD CJK Unified Ideographs Extension B) $(TD Latin Extended-A) $(TD Supplementary Private Use Area-B)) -+ $(TR $(TD CJK Unified Ideographs Extension C) $(TD Latin Extended Additional) $(TD Syloti Nagri)) -+ $(TR $(TD CJK Unified Ideographs Extension D) $(TD Latin Extended-B) $(TD Syriac)) -+ $(TR $(TD Combining Diacritical Marks) $(TD Latin Extended-C) $(TD Tagalog)) -+ $(TR $(TD Combining Diacritical Marks for Symbols) $(TD Latin Extended-D) $(TD Tagbanwa)) -+ $(TR $(TD Combining Diacritical Marks Supplement) $(TD Lepcha) $(TD Tags)) -+ $(TR $(TD Combining Half Marks) $(TD Letterlike Symbols) $(TD Tai Le)) -+ $(TR $(TD Common Indic Number Forms) $(TD Limbu) $(TD Tai Tham)) -+ $(TR $(TD Control Pictures) $(TD Linear B Ideograms) $(TD Tai Viet)) -+ $(TR $(TD Coptic) $(TD Linear B Syllabary) $(TD Tai Xuan Jing Symbols)) -+ $(TR $(TD Counting Rod Numerals) $(TD Lisu) $(TD Takri)) -+ $(TR $(TD Cuneiform) $(TD Low Surrogates) $(TD Tamil)) -+ $(TR $(TD Cuneiform Numbers and Punctuation) $(TD Lycian) $(TD Telugu)) -+ $(TR $(TD Currency Symbols) $(TD Lydian) $(TD Thaana)) -+ $(TR $(TD Cypriot Syllabary) $(TD Mahjong Tiles) $(TD Thai)) -+ $(TR $(TD Cyrillic) $(TD Malayalam) $(TD Tibetan)) -+ $(TR $(TD Cyrillic Extended-A) $(TD Mandaic) $(TD Tifinagh)) -+ $(TR $(TD Cyrillic Extended-B) $(TD Mathematical Alphanumeric Symbols) $(TD Transport And Map Symbols)) -+ $(TR $(TD Cyrillic Supplement) $(TD Mathematical Operators) $(TD Ugaritic)) -+ $(TR $(TD Deseret) $(TD Meetei Mayek) $(TD Unified Canadian Aboriginal Syllabics)) -+ $(TR $(TD Devanagari) $(TD Meetei Mayek Extensions) $(TD Unified Canadian Aboriginal Syllabics Extended)) -+ $(TR $(TD Devanagari Extended) $(TD Meroitic Cursive) $(TD Vai)) -+ $(TR $(TD Dingbats) $(TD Meroitic Hieroglyphs) $(TD Variation Selectors)) -+ $(TR $(TD Domino Tiles) $(TD Miao) $(TD Variation Selectors Supplement)) -+ $(TR $(TD Egyptian Hieroglyphs) $(TD Miscellaneous Mathematical Symbols-A) $(TD Vedic Extensions)) -+ $(TR $(TD Emoticons) $(TD Miscellaneous Mathematical Symbols-B) $(TD Vertical Forms)) -+ $(TR $(TD Enclosed Alphanumerics) $(TD Miscellaneous Symbols) $(TD Yijing Hexagram Symbols)) -+ $(TR $(TD Enclosed Alphanumeric Supplement) $(TD Miscellaneous Symbols and Arrows) $(TD Yi Radicals)) -+ $(TR $(TD Enclosed CJK Letters and Months) $(TD Miscellaneous Symbols And Pictographs) $(TD Yi Syllables)) -+ $(TR $(TD Enclosed Ideographic Supplement) $(TD Miscellaneous Technical) ) -+ $(TR $(TD Ethiopic) $(TD Modifier Tone Letters) ) -+ ) -+ -+ $(P Bellow is the table with script names accepted by $(LREF unicode.script) -+ and by the shorthand version $(LREF unicode):) -+ $(BOOKTABLE $(B Scripts), -+ $(TR $(TD Arabic) $(TD Hanunoo) $(TD Old_Italic)) -+ $(TR $(TD Armenian) $(TD Hebrew) $(TD Old_Persian)) -+ $(TR $(TD Avestan) $(TD Hiragana) $(TD Old_South_Arabian)) -+ $(TR $(TD Balinese) $(TD Imperial_Aramaic) $(TD Old_Turkic)) -+ $(TR $(TD Bamum) $(TD Inherited) $(TD Oriya)) -+ $(TR $(TD Batak) $(TD Inscriptional_Pahlavi) $(TD Osmanya)) -+ $(TR $(TD Bengali) $(TD Inscriptional_Parthian) $(TD Phags_Pa)) -+ $(TR $(TD Bopomofo) $(TD Javanese) $(TD Phoenician)) -+ $(TR $(TD Brahmi) $(TD Kaithi) $(TD Rejang)) -+ $(TR $(TD Braille) $(TD Kannada) $(TD Runic)) -+ $(TR $(TD Buginese) $(TD Katakana) $(TD Samaritan)) -+ $(TR $(TD Buhid) $(TD Kayah_Li) $(TD Saurashtra)) -+ $(TR $(TD Canadian_Aboriginal) $(TD Kharoshthi) $(TD Sharada)) -+ $(TR $(TD Carian) $(TD Khmer) $(TD Shavian)) -+ $(TR $(TD Chakma) $(TD Lao) $(TD Sinhala)) -+ $(TR $(TD Cham) $(TD Latin) $(TD Sora_Sompeng)) -+ $(TR $(TD Cherokee) $(TD Lepcha) $(TD Sundanese)) -+ $(TR $(TD Common) $(TD Limbu) $(TD Syloti_Nagri)) -+ $(TR $(TD Coptic) $(TD Linear_B) $(TD Syriac)) -+ $(TR $(TD Cuneiform) $(TD Lisu) $(TD Tagalog)) -+ $(TR $(TD Cypriot) $(TD Lycian) $(TD Tagbanwa)) -+ $(TR $(TD Cyrillic) $(TD Lydian) $(TD Tai_Le)) -+ $(TR $(TD Deseret) $(TD Malayalam) $(TD Tai_Tham)) -+ $(TR $(TD Devanagari) $(TD Mandaic) $(TD Tai_Viet)) -+ $(TR $(TD Egyptian_Hieroglyphs) $(TD Meetei_Mayek) $(TD Takri)) -+ $(TR $(TD Ethiopic) $(TD Meroitic_Cursive) $(TD Tamil)) -+ $(TR $(TD Georgian) $(TD Meroitic_Hieroglyphs) $(TD Telugu)) -+ $(TR $(TD Glagolitic) $(TD Miao) $(TD Thaana)) -+ $(TR $(TD Gothic) $(TD Mongolian) $(TD Thai)) -+ $(TR $(TD Greek) $(TD Myanmar) $(TD Tibetan)) -+ $(TR $(TD Gujarati) $(TD New_Tai_Lue) $(TD Tifinagh)) -+ $(TR $(TD Gurmukhi) $(TD Nko) $(TD Ugaritic)) -+ $(TR $(TD Han) $(TD Ogham) $(TD Vai)) -+ $(TR $(TD Hangul) $(TD Ol_Chiki) $(TD Yi)) -+ ) -+ -+ $(P Bellow is the table of names accepted by $(LREF unicode.hangulSyllableType).) -+ $(BOOKTABLE $(B Hangul syllable type), -+ $(TR $(TH Abb.) $(TH Long form)) -+ $(TR $(TD L) $(TD Leading_Jamo)) -+ $(TR $(TD LV) $(TD LV_Syllable)) -+ $(TR $(TD LVT) $(TD LVT_Syllable) ) -+ $(TR $(TD T) $(TD Trailing_Jamo)) -+ $(TR $(TD V) $(TD Vowel_Jamo)) -+ ) - References: - $(WEB www.digitalmars.com/d/ascii-table.html, ASCII Table), - $(WEB en.wikipedia.org/wiki/Unicode, Wikipedia), -- $(WEB www.unicode.org, The Unicode Consortium) -+ $(WEB www.unicode.org, The Unicode Consortium), -+ $(WEB www.unicode.org/reports/tr15/, Unicode normalization forms), -+ $(WEB www.unicode.org/reports/tr29/, Unicode text segmentation) -+ $(WEB www.unicode.org/uni2book/ch05.pdf, -+ Unicode Implementation Guidelines) -+ $(WEB www.unicode.org/uni2book/ch03.pdf, -+ Unicode Conformance) -+ Trademarks: -+ Unicode(tm) is a trademark of Unicode, Inc. -+ -+ Macros: -+ WIKI=Phobos/StdUni -+ -+ Copyright: Copyright 2013 - -+ License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). -+ Authors: Dmitry Olshansky -+ Source: $(PHOBOSSRC std/_uni.d) -+ Standards: $(WEB www.unicode.org/versions/Unicode6.2.0/, Unicode v6.2) -+ -+Macros: -+ -+SECTION = <h3><a id="$1">$0</a></h3> -+DEF = <div><a id="$1"><i>$0</i></a></div> -+S_LINK = <a href="#$1">$+</a> -+CODEPOINT = $(S_LINK Code point, code point) -+CODEPOINTS = $(S_LINK Code point, code points) -+CHARACTER = $(S_LINK Character, character) -+CHARACTERS = $(S_LINK Character, characters) -+CLUSTER = $(S_LINK Grapheme cluster, grapheme cluster) -++/ -+module std.uni; -+ -+static import std.ascii; -+import std.traits, std.range, std.algorithm, std.conv, -+ std.typetuple, std.exception, core.stdc.stdlib; -+import std.array; //@@BUG UFCS doesn't work with 'local' imports -+import core.bitop; -+ -+version(unittest) import std.typecons; -+ -+// debug = std_uni; -+ -+debug(std_uni) import std.stdio; -+ -+private: -+ -+version(std_uni_bootstrap){} -+else -+{ -+ import std.internal.unicode_tables; // generated file -+} -+ -+void copyBackwards(T)(T[] src, T[] dest) -+{ -+ assert(src.length == dest.length); -+ for(size_t i=src.length; i-- > 0; ) -+ dest[i] = src[i]; -+} -+ -+void copyForward(T)(T[] src, T[] dest) -+{ -+ assert(src.length == dest.length); -+ for(size_t i=0; i<src.length; i++) -+ dest[i] = src[i]; -+} -+ -+// TODO: update to reflect all major CPUs supporting unaligned reads -+version(X86) -+ enum hasUnalignedReads = true; -+else version(X86_64) -+ enum hasUnalignedReads = true; -+else -+ enum hasUnalignedReads = false; // better be safe then sorry -+ -+public enum dchar lineSep = '\u2028'; /// Constant $(CODEPOINT) (0x2028) - line separator. -+public enum dchar paraSep = '\u2029'; /// Constant $(CODEPOINT) (0x2029) - paragraph separator. -+ -+// test the intro example -+unittest -+{ -+ // initialize code point sets using script/block or property name -+ // set contains code points from both scripts. -+ auto set = unicode("Cyrillic") | unicode("Armenian"); -+ // or simpler and statically-checked look -+ auto ascii = unicode.ASCII; -+ auto currency = unicode.Currency_Symbol; -+ -+ // easy set ops -+ auto a = set & ascii; -+ assert(a.empty); // as it has no intersection with ascii -+ a = set | ascii; -+ auto b = currency - a; // subtract all ASCII, Cyrillic and Armenian -+ -+ // some properties of code point sets -+ assert(b.length > 45); // 46 items in Unicode 6.1, even more in 6.2 -+ // testing presence of a code point in a set -+ // is just fine, it is O(logN) -+ assert(!b['$']); -+ assert(!b['\u058F']); // Armenian dram sign -+ assert(b['¥']); -+ -+ // building fast lookup tables, these guarantee O(1) complexity -+ // 1-level Trie lookup table essentially a huge bit-set ~262Kb -+ auto oneTrie = toTrie!1(b); -+ // 2-level far more compact but typically slightly slower -+ auto twoTrie = toTrie!2(b); -+ // 3-level even smaller, and a bit slower yet -+ auto threeTrie = toTrie!3(b); -+ assert(oneTrie['£']); -+ assert(twoTrie['£']); -+ assert(threeTrie['£']); -+ -+ // build the trie with the most sensible trie level -+ // and bind it as a functor -+ auto cyrilicOrArmenian = toDelegate(set); -+ auto balance = find!(cyrilicOrArmenian)("Hello ընկեր!"); -+ assert(balance == "ընկեր!"); -+ // compatible with bool delegate(dchar) -+ bool delegate(dchar) bindIt = cyrilicOrArmenian; -+ -+ // Normalization -+ string s = "Plain ascii (and not only), is always normalized!"; -+ assert(s is normalize(s));// is the same string -+ -+ string nonS = "A\u0308ffin"; // A ligature -+ auto nS = normalize(nonS); // to NFC, the W3C endorsed standard -+ assert(nS == "Äffin"); -+ assert(nS != nonS); -+ string composed = "Äffin"; -+ -+ assert(normalize!NFD(composed) == "A\u0308ffin"); -+ // to NFKD, compatibility decomposition useful for fuzzy matching/searching -+ assert(normalize!NFKD("2¹⁰") == "210"); -+} -+ -+enum lastDchar = 0x10FFFF; -+ -+auto force(T, F)(F from) -+ if(isIntegral!T && !is(T == F)) -+{ -+ assert(from <= T.max && from >= T.min); -+ return cast(T)from; -+} -+ -+auto force(T, F)(F from) -+ if(isBitPacked!T && !is(T == F)) -+{ -+ assert(from <= 2^^bitSizeOf!T-1); -+ return T(cast(TypeOfBitPacked!T)from); -+} -+ -+auto force(T, F)(F from) -+ if(is(T == F)) -+{ -+ return from; -+} -+ -+// cheap algorithm grease ;) -+auto adaptIntRange(T, F)(F[] src) -+{ -+ //@@@BUG when in the 9 hells will map be copyable again?! -+ static struct ConvertIntegers -+ { -+ private F[] data; -+ -+ @property T front() -+ { -+ return force!T(data.front); -+ } -+ -+ void popFront(){ data.popFront(); } -+ -+ @property bool empty()const { return data.empty; } -+ -+ @property size_t length()const { return data.length; } -+ -+ auto opSlice(size_t s, size_t e) -+ { -+ return ConvertIntegers(data[s..e]); -+ } -+ -+ @property size_t opDollar(){ return data.length; } -+ } -+ return ConvertIntegers(src); -+} -+ -+// repeat X times the bit-pattern in val assuming it's length is 'bits' -+size_t replicateBits(size_t times, size_t bits)(size_t val) -+{ -+ static if(times == 1) -+ return val; -+ else static if(times % 2) -+ return (replicateBits!(times-1, bits)(val)<<bits) | val; -+ else -+ return replicateBits!(times/2, bits*2)((val<<bits) | val); -+} -+ -+unittest // for replicate -+{ -+ size_t m = 0b111; -+ size_t m2 = 0b01; -+ foreach(i; TypeTuple!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) -+ { -+ assert(replicateBits!(i, 3)(m)+1 == (1<<(3*i))); -+ assert(replicateBits!(i, 2)(m2) == iota(0, i).map!"2^^(2*a)"().reduce!"a+b"()); -+ } -+} -+ -+// multiple arrays squashed into one memory block -+struct MultiArray(Types...) -+{ -+ this(size_t[] sizes...) -+ { -+ size_t full_size; -+ foreach(i, v; Types) -+ { -+ full_size += spaceFor!(bitSizeOf!v)(sizes[i]); -+ sz[i] = sizes[i]; -+ static if(i >= 1) -+ offsets[i] = offsets[i-1] + -+ spaceFor!(bitSizeOf!(Types[i-1]))(sizes[i-1]); -+ } -+ -+ storage = new size_t[full_size]; -+ } -+ -+ this(const(size_t)[] raw_offsets, -+ const(size_t)[] raw_sizes, const(size_t)[] data)const -+ { -+ offsets[] = raw_offsets[]; -+ sz[] = raw_sizes[]; -+ storage = data; -+ } -+ -+ @property auto slice(size_t n)()inout pure nothrow -+ { -+ auto ptr = raw_ptr!n; -+ return packedArrayView!(Types[n])(ptr, sz[n]); -+ } -+ -+ @property auto ptr(size_t n)()inout pure nothrow -+ { -+ auto ptr = raw_ptr!n; -+ return inout(PackedPtr!(Types[n]))(ptr); -+ } -+ -+ template length(size_t n) -+ { -+ @property size_t length()const{ return sz[n]; } -+ -+ @property void length(size_t new_size) -+ { -+ if(new_size > sz[n]) -+ {// extend -+ size_t delta = (new_size - sz[n]); -+ sz[n] += delta; -+ delta = spaceFor!(bitSizeOf!(Types[n]))(delta); -+ storage.length += delta;// extend space at end -+ // raw_slice!x must follow resize as it could be moved! -+ // next stmts move all data past this array, last-one-goes-first -+ static if(n != dim-1) -+ { -+ auto start = raw_ptr!(n+1); -+ // len includes delta -+ size_t len = (storage.ptr+storage.length-start); -+ -+ copyBackwards(start[0..len-delta], start[delta..len]); -+ -+ start[0..delta] = 0; -+ // offsets are used for raw_slice, ptr etc. -+ foreach(i; n+1..dim) -+ offsets[i] += delta; -+ } -+ } -+ else if(new_size < sz[n]) -+ {// shrink -+ size_t delta = (sz[n] - new_size); -+ sz[n] -= delta; -+ delta = spaceFor!(bitSizeOf!(Types[n]))(delta); -+ // move all data past this array, forward direction -+ static if(n != dim-1) -+ { -+ auto start = raw_ptr!(n+1); -+ size_t len = storage.length; -+ copyForward(start[0..len-delta], start[delta..len]); -+ -+ // adjust offsets last, they affect raw_slice -+ foreach(i; n+1..dim) -+ offsets[i] -= delta; -+ } -+ storage.length -= delta; -+ } -+ // else - NOP -+ } -+ } -+ -+ @property size_t bytes(size_t n=size_t.max)() const -+ { -+ static if(n == size_t.max) -+ return storage.length*size_t.sizeof; -+ else static if(n != Types.length-1) -+ return (raw_ptr!(n+1)-raw_ptr!n)*size_t.sizeof; -+ else -+ return (storage.ptr+storage.length - raw_ptr!n)*size_t.sizeof; -+ } -+ -+ void store(OutRange)(scope OutRange sink) const -+ if(isOutputRange!(OutRange, char)) -+ { -+ formattedWrite(sink, "[%( 0x%x, %)]", offsets[]); -+ formattedWrite(sink, ", [%( 0x%x, %)]", sz[]); -+ formattedWrite(sink, ", [%( 0x%x, %)]", storage); -+ } -+ -+private: -+ @property auto raw_ptr(size_t n)()inout -+ { -+ static if(n == 0) -+ return storage.ptr; -+ else -+ { -+ return storage.ptr+offsets[n]; -+ } -+ } -+ enum dim = Types.length; -+ size_t[dim] offsets;// offset for level x -+ size_t[dim] sz;// size of level x -+ alias staticMap!(bitSizeOf, Types) bitWidth; -+ size_t[] storage; -+} -+ -+unittest -+{ -+ // sizes are: -+ // lvl0: 3, lvl1 : 2, lvl2: 1 -+ auto m = MultiArray!(int, ubyte, int)(3,2,1); -+ -+ static void check(size_t k, T)(ref T m, int n) -+ { -+ foreach(i; 0..n) -+ assert(m.slice!(k)[i] == i+1, text("level:",i," : ",m.slice!(k)[0..n])); -+ } -+ -+ static void checkB(size_t k, T)(ref T m, int n) -+ { -+ foreach(i; 0..n) -+ assert(m.slice!(k)[i] == n-i, text("level:",i," : ",m.slice!(k)[0..n])); -+ } -+ -+ static void fill(size_t k, T)(ref T m, int n) -+ { -+ foreach(i; 0..n) -+ m.slice!(k)[i] = force!ubyte(i+1); -+ } -+ -+ static void fillB(size_t k, T)(ref T m, int n) -+ { -+ foreach(i; 0..n) -+ m.slice!(k)[i] = force!ubyte(n-i); -+ } -+ -+ m.length!1 = 100; -+ fill!1(m, 100); -+ check!1(m, 100); -+ -+ m.length!0 = 220; -+ fill!0(m, 220); -+ check!1(m, 100); -+ check!0(m, 220); -+ -+ m.length!2 = 17; -+ fillB!2(m, 17); -+ checkB!2(m, 17); -+ check!0(m, 220); -+ check!1(m, 100); -+ -+ m.length!2 = 33; -+ checkB!2(m, 17); -+ fillB!2(m, 33); -+ checkB!2(m, 33); -+ check!0(m, 220); -+ check!1(m, 100); -+ -+ m.length!1 = 195; -+ fillB!1(m, 195); -+ checkB!1(m, 195); -+ checkB!2(m, 33); -+ check!0(m, 220); -+ -+ auto marr = MultiArray!(BitPacked!(uint, 4), BitPacked!(uint, 6))(20, 10); -+ marr.length!0 = 15; -+ marr.length!1 = 30; -+ fill!1(marr, 30); -+ fill!0(marr, 15); -+ check!1(marr, 30); -+ check!0(marr, 15); -+} -+ -+unittest -+{// more bitpacking tests -+ alias MultiArray!(BitPacked!(size_t, 3) -+ , BitPacked!(size_t, 4) -+ , BitPacked!(size_t, 3) -+ , BitPacked!(size_t, 6) -+ , bool) Bitty; -+ alias sliceBits!(13, 16) fn1; -+ alias sliceBits!( 9, 13) fn2; -+ alias sliceBits!( 6, 9) fn3; -+ alias sliceBits!( 0, 6) fn4; -+ static void check(size_t lvl, MA)(ref MA arr){ -+ for(size_t i = 0; i< arr.length!lvl; i++) -+ assert(arr.slice!(lvl)[i] == i, text("Mismatch on lvl ", lvl, " idx ", i, " value: ", arr.slice!(lvl)[i])); -+ } -+ -+ static void fillIdx(size_t lvl, MA)(ref MA arr){ -+ for(size_t i = 0; i< arr.length!lvl; i++) -+ arr.slice!(lvl)[i] = i; -+ } -+ Bitty m1; -+ -+ m1.length!4 = 10; -+ m1.length!3 = 2^^6; -+ m1.length!2 = 2^^3; -+ m1.length!1 = 2^^4; -+ m1.length!0 = 2^^3; -+ -+ m1.length!4 = 2^^16; -+ -+ for(size_t i = 0; i< m1.length!4; i++) -+ m1.slice!(4)[i] = i % 2; -+ -+ fillIdx!1(m1); -+ check!1(m1); -+ fillIdx!2(m1); -+ check!2(m1); -+ fillIdx!3(m1); -+ check!3(m1); -+ fillIdx!0(m1); -+ check!0(m1); -+ check!3(m1); -+ check!2(m1); -+ check!1(m1); -+ for(size_t i=0; i < 2^^16; i++) -+ { -+ m1.slice!(4)[i] = i % 2; -+ m1.slice!(0)[fn1(i)] = fn1(i); -+ m1.slice!(1)[fn2(i)] = fn2(i); -+ m1.slice!(2)[fn3(i)] = fn3(i); -+ m1.slice!(3)[fn4(i)] = fn4(i); -+ } -+ for(size_t i=0; i < 2^^16; i++) -+ { -+ assert(m1.slice!(4)[i] == i % 2); -+ assert(m1.slice!(0)[fn1(i)] == fn1(i)); -+ assert(m1.slice!(1)[fn2(i)] == fn2(i)); -+ assert(m1.slice!(2)[fn3(i)] == fn3(i)); -+ assert(m1.slice!(3)[fn4(i)] == fn4(i)); -+ } -+} -+ -+size_t spaceFor(size_t _bits)(size_t new_len) pure nothrow -+{ -+ enum bits = _bits == 1 ? 1 : ceilPowerOf2(_bits);// see PackedArrayView -+ static if(bits > 8*size_t.sizeof) -+ { -+ static assert(bits % (size_t.sizeof*8) == 0); -+ return new_len * bits/(8*size_t.sizeof); -+ } -+ else -+ { -+ enum factor = size_t.sizeof*8/bits; -+ return (new_len+factor-1)/factor; // rounded up -+ } -+} -+ -+template isBitPackableType(T) -+{ -+ enum isBitPackableType = isBitPacked!T -+ || isIntegral!T || is(T == bool) || isSomeChar!T; -+} -+ -+//============================================================================ -+template PackedArrayView(T) -+ if((is(T dummy == BitPacked!(U, sz), U, size_t sz) -+ && isBitPackableType!U) || isBitPackableType!T) -+{ -+ private enum bits = bitSizeOf!T; -+ alias PackedArrayView = PackedArrayViewImpl!(T, bits > 1 ? ceilPowerOf2(bits) : 1); -+} -+ -+//unsafe and fast access to a chunk of RAM as if it contains packed values -+template PackedPtr(T) -+ if((is(T dummy == BitPacked!(U, sz), U, size_t sz) -+ && isBitPackableType!U) || isBitPackableType!T) -+{ -+ private enum bits = bitSizeOf!T; -+ alias PackedPtr = PackedPtrImpl!(T, bits > 1 ? ceilPowerOf2(bits) : 1); -+} -+ -+@trusted struct PackedPtrImpl(T, size_t bits) -+{ -+pure nothrow: -+ static assert(isPowerOf2(bits)); -+ -+ this(inout(size_t)* ptr)inout -+ { -+ origin = ptr; -+ } -+ -+ private T simpleIndex(size_t n) inout -+ { -+ static if(factor == bytesPerWord*8) -+ { -+ // a re-write with less data dependency -+ auto q = n / factor; -+ auto r = n % factor; -+ return cast(T)(origin[q] & (mask<<r) ? 1 : 0); -+ } -+ else -+ { -+ auto q = n / factor; -+ auto r = n % factor; -+ return cast(T)((origin[q] >> bits*r) & mask); -+ } -+ } -+ -+ static if(factor == bytesPerWord// can safely pack by byte -+ || factor == 1 // a whole word at a time -+ || ((factor == bytesPerWord/2 || factor == bytesPerWord/4) -+ && hasUnalignedReads)) // this needs unaligned reads -+ { -+ static if(factor == bytesPerWord) -+ alias U = ubyte; -+ else static if(factor == bytesPerWord/2) -+ alias U = ushort; -+ else static if(factor == bytesPerWord/4) -+ alias U = uint; -+ else static if(size_t.sizeof == 8 && factor == bytesPerWord/8) -+ alias U = ulong; -+ -+ T opIndex(size_t idx) inout -+ { -+ return __ctfe ? simpleIndex(idx) : -+ cast(inout(T))(cast(U*)origin)[idx]; -+ } -+ -+ static if(isBitPacked!T) // lack of user-defined implicit conversion -+ { -+ void opIndexAssign(T val, size_t idx) -+ { -+ return opIndexAssign(cast(TypeOfBitPacked!T)val, idx); -+ } -+ } -+ -+ void opIndexAssign(TypeOfBitPacked!T val, size_t idx) -+ { -+ (cast(U*)origin)[idx] = cast(U)val; -+ } -+ } -+ else -+ { -+ T opIndex(size_t n) inout -+ { -+ return simpleIndex(n); -+ } -+ -+ static if(isBitPacked!T) // lack of user-defined implicit conversion -+ { -+ void opIndexAssign(T val, size_t idx) -+ { -+ return opIndexAssign(cast(TypeOfBitPacked!T)val, idx); -+ } -+ } -+ -+ void opIndexAssign(TypeOfBitPacked!T val, size_t n) -+ in -+ { -+ static if(isIntegral!T) -+ assert(val <= mask); -+ } -+ body -+ { -+ auto q = n / factor; -+ auto r = n % factor; -+ size_t tgt_shift = bits*r; -+ size_t word = origin[q]; -+ origin[q] = (word & ~(mask<<tgt_shift)) -+ | (cast(size_t)val << tgt_shift); -+ } -+ } -+ -+private: -+ // factor - number of elements in one machine word -+ enum factor = size_t.sizeof*8/bits, mask = 2^^bits-1; -+ enum bytesPerWord = size_t.sizeof; -+ size_t* origin; -+} -+ -+// data is packed only by power of two sized packs per word, -+// thus avoiding mul/div overhead at the cost of ultimate packing -+// this construct doesn't own memory, only provides access, see MultiArray for usage -+@trusted struct PackedArrayViewImpl(T, size_t bits) -+{ -+pure nothrow: -+ -+ this(inout(size_t)* origin, size_t items)inout -+ { -+ ptr = inout(PackedPtr!(T))(origin); -+ limit = items; -+ } -+ -+ T opIndex(size_t idx) inout -+ in -+ { -+ assert(idx < limit); -+ } -+ body -+ { -+ return ptr[idx]; -+ } -+ -+ static if(isBitPacked!T) // lack of user-defined implicit conversion -+ { -+ void opIndexAssign(T val, size_t idx) -+ { -+ return opIndexAssign(cast(TypeOfBitPacked!T)val, idx); -+ } -+ } -+ -+ void opIndexAssign(TypeOfBitPacked!T val, size_t idx) -+ in -+ { -+ assert(idx < limit); -+ } -+ body -+ { -+ ptr[idx] = val; -+ } -+ -+ static if(isBitPacked!T) // lack of user-defined implicit conversions -+ { -+ void opSliceAssign(T val, size_t start, size_t end) -+ { -+ opSliceAssign(cast(TypeOfBitPacked!T)val, start, end); -+ } -+ } -+ -+ void opSliceAssign(TypeOfBitPacked!T val, size_t start, size_t end) -+ in -+ { -+ assert(start <= end); -+ assert(end <= limit); -+ } -+ body -+ { -+ // rounded to factor granularity -+ size_t pad_start = (start+factor-1)/factor*factor;// rounded up -+ if(pad_start >= end) //rounded up >= then end of slice -+ { -+ //nothing to gain, use per element assignment -+ foreach(i; start..end) -+ ptr[i] = val; -+ return; -+ } -+ size_t pad_end = end/factor*factor; // rounded down -+ size_t i; -+ for(i=start; i<pad_start; i++) -+ ptr[i] = val; -+ // all in between is x*factor elements -+ if(pad_start != pad_end) -+ { -+ size_t repval = replicateBits!(factor, bits)(val); -+ for(size_t j=i/factor; i<pad_end; i+=factor, j++) -+ ptr.origin[j] = repval;// so speed it up by factor -+ } -+ for(; i<end; i++) -+ ptr[i] = val; -+ } -+ -+ auto opSlice(size_t from, size_t to) -+ { -+ return sliceOverIndexed(from, to, &this); -+ } -+ -+ auto opSlice(){ return opSlice(0, length); } -+ -+ bool opEquals(T)(auto ref T arr) const -+ { -+ if(length != arr.length) -+ return false; -+ for(size_t i=0;i<length; i++) -+ if(this[i] != arr[i]) -+ return false; -+ return true; -+ } -+ -+ @property size_t length()const{ return limit; } -+ -+private: -+ // factor - number of elements in one machine word -+ enum factor = size_t.sizeof*8/bits; -+ PackedPtr!(T) ptr; -+ size_t limit; -+} -+ -+ -+private struct SliceOverIndexed(T) -+{ -+ enum assignableIndex = is(typeof((){ T.init[0] = Item.init; })); -+ enum assignableSlice = is(typeof((){ T.init[0..0] = Item.init; })); -+ -+ auto opIndex(size_t idx)const -+ in -+ { -+ assert(idx < to - from); -+ } -+ body -+ { -+ return (*arr)[from+idx]; -+ } -+ -+ static if(assignableIndex) -+ void opIndexAssign(Item val, size_t idx) -+ in -+ { -+ assert(idx < to - from); -+ } -+ body -+ { -+ (*arr)[from+idx] = val; -+ } -+ -+ auto opSlice(size_t a, size_t b) -+ { -+ return typeof(this)(from+a, from+b, arr); -+ } -+ -+ // static if(assignableSlice) -+ void opSliceAssign(T)(T val, size_t start, size_t end) -+ { -+ (*arr)[start+from .. end+from] = val; -+ } -+ -+ auto opSlice() -+ { -+ return typeof(this)(from, to, arr); -+ } -+ -+ @property size_t length()const { return to-from;} -+ -+ auto opDollar()const { return length; } -+ -+ @property bool empty()const { return from == to; } -+ -+ @property auto front()const { return (*arr)[from]; } -+ -+ static if(assignableIndex) -+ @property void front(Item val) { (*arr)[from] = val; } -+ -+ @property auto back()const { return (*arr)[to-1]; } -+ -+ static if(assignableIndex) -+ @property void back(Item val) { (*arr)[to-1] = val; } -+ -+ @property auto save() inout { return this; } -+ -+ void popFront() { from++; } -+ -+ void popBack() { to--; } -+ -+ bool opEquals(T)(auto ref T arr) const -+ { -+ if(arr.length != length) -+ return false; -+ for(size_t i=0; i <length; i++) -+ if(this[i] != arr[i]) -+ return false; -+ return true; -+ } -+private: -+ alias typeof(T.init[0]) Item; -+ size_t from, to; -+ T* arr; -+} -+ -+static assert(isRandomAccessRange!(SliceOverIndexed!(int[]))); -+ -+// BUG? forward reference to return type of sliceOverIndexed!Grapheme -+SliceOverIndexed!(const(T)) sliceOverIndexed(T)(size_t a, size_t b, const(T)* x) -+ if(is(Unqual!T == T)) -+{ -+ return SliceOverIndexed!(const(T))(a, b, x); -+} -+ -+// BUG? inout is out of reach -+//...SliceOverIndexed.arr only parameters or stack based variables can be inout -+SliceOverIndexed!T sliceOverIndexed(T)(size_t a, size_t b, T* x) -+ if(is(Unqual!T == T)) -+{ -+ return SliceOverIndexed!T(a, b, x); -+} -+ -+unittest -+{ -+ int[] idxArray = [2, 3, 5, 8, 13]; -+ auto sliced = sliceOverIndexed(0, idxArray.length, &idxArray); -+ -+ assert(!sliced.empty); -+ assert(sliced.front == 2); -+ sliced.front = 1; -+ assert(sliced.front == 1); -+ assert(sliced.back == 13); -+ sliced.popFront(); -+ assert(sliced.front == 3); -+ assert(sliced.back == 13); -+ sliced.back = 11; -+ assert(sliced.back == 11); -+ sliced.popBack(); -+ -+ assert(sliced.front == 3); -+ assert(sliced[$-1] == 8); -+ sliced = sliced[]; -+ assert(sliced[0] == 3); -+ assert(sliced.back == 8); -+ sliced = sliced[1..$]; -+ assert(sliced.front == 5); -+ sliced = sliced[0..$-1]; -+ assert(sliced[$-1] == 5); -+ -+ int[] other = [2, 5]; -+ assert(sliced[] == sliceOverIndexed(1, 2, &other)); -+ sliceOverIndexed(0, 2, &idxArray)[0..2] = -1; -+ assert(idxArray[0..2] == [-1, -1]); -+ uint[] nullArr = null; -+ auto nullSlice = sliceOverIndexed(0, 0, &idxArray); -+ assert(nullSlice.empty); -+} -+ -+private auto packedArrayView(T)(inout(size_t)* ptr, size_t items) @trusted pure nothrow -+{ -+ return inout(PackedArrayView!T)(ptr, items); -+} -+ -+ -+//============================================================================ -+// Partially unrolled binary search using Shar's method -+//============================================================================ -+ -+string genUnrolledSwitchSearch(size_t size) -+{ -+ assert(isPowerOf2(size)); -+ string code = `auto power = bsr(m)+1; -+ switch(power){`; -+ size_t i = bsr(size); -+ foreach_reverse(val; 0..bsr(size)) -+ { -+ auto v = 2^^val; -+ code ~= ` -+ case pow: -+ if(pred(range[idx+m], needle)) -+ idx += m; -+ goto case; -+ `.replace("m", to!string(v)) -+ .replace("pow", to!string(i)); -+ i--; -+ } -+ code ~= ` -+ case 0: -+ if(pred(range[idx], needle)) -+ idx += 1; -+ goto default; -+ `; -+ code ~= ` -+ default: -+ }`; -+ return code; -+} -+ -+bool isPowerOf2(size_t sz) @safe pure nothrow -+{ -+ return (sz & (sz-1)) == 0; -+} -+ -+size_t uniformLowerBound(alias pred, Range, T)(Range range, T needle) -+ if(is(T : ElementType!Range)) -+{ -+ assert(isPowerOf2(range.length)); -+ size_t idx = 0, m = range.length/2; -+ while(m != 0) -+ { -+ if(pred(range[idx+m], needle)) -+ idx += m; -+ m /= 2; -+ } -+ if(pred(range[idx], needle)) -+ idx += 1; -+ return idx; -+} -+ -+size_t switchUniformLowerBound(alias pred, Range, T)(Range range, T needle) -+ if(is(T : ElementType!Range)) -+{ -+ assert(isPowerOf2(range.length)); -+ size_t idx = 0, m = range.length/2; -+ enum max = 1<<10; -+ while(m >= max) -+ { -+ if(pred(range[idx+m], needle)) -+ idx += m; -+ m /= 2; -+ } -+ mixin(genUnrolledSwitchSearch(max)); -+ return idx; -+} -+ -+// -+size_t floorPowerOf2(size_t arg) @safe pure nothrow -+{ -+ assert(arg > 1); // else bsr is undefined -+ return 1<<bsr(arg-1); -+} -+ -+size_t ceilPowerOf2(size_t arg) @safe pure nothrow -+{ -+ assert(arg > 1); // else bsr is undefined -+ return 1<<bsr(arg-1)+1; -+} -+ -+template sharMethod(alias uniLowerBound) -+{ -+ size_t sharMethod(alias _pred="a<b", Range, T)(Range range, T needle) -+ if(is(T : ElementType!Range)) -+ { -+ import std.functional; -+ alias binaryFun!_pred pred; -+ if(range.length == 0) -+ return 0; -+ if(isPowerOf2(range.length)) -+ return uniLowerBound!pred(range, needle); -+ size_t n = floorPowerOf2(range.length); -+ if(pred(range[n-1], needle)) -+ {// search in another 2^^k area that fully covers the tail of range -+ size_t k = ceilPowerOf2(range.length - n + 1); -+ return range.length - k + uniLowerBound!pred(range[$-k..$], needle); -+ } -+ else -+ return uniLowerBound!pred(range[0..n], needle); -+ } -+} -+ -+alias sharMethod!uniformLowerBound sharLowerBound; -+alias sharMethod!switchUniformLowerBound sharSwitchLowerBound; -+ -+unittest -+{ -+ auto stdLowerBound(T)(T[] range, T needle) -+ { -+ return assumeSorted(range).lowerBound(needle).length; -+ } -+ immutable MAX = 5*1173; -+ auto arr = array(iota(5, MAX, 5)); -+ assert(arr.length == MAX/5-1); -+ foreach(i; 0..MAX+5) -+ { -+ auto std = stdLowerBound(arr, i); -+ assert(std == sharLowerBound(arr, i)); -+ assert(std == sharSwitchLowerBound(arr, i)); -+ } -+ arr = []; -+ auto std = stdLowerBound(arr, 33); -+ assert(std == sharLowerBound(arr, 33)); -+ assert(std == sharSwitchLowerBound(arr, 33)); -+} -+//============================================================================ -+ -+@safe: -+// hope to see simillar stuff in public interface... once Allocators are out -+//@@@BUG moveFront and friends? dunno, for now it's POD-only -+ -+@trusted size_t genericReplace(Policy=void, T, Range) -+ (ref T dest, size_t from, size_t to, Range stuff) -+{ -+ size_t delta = to - from; -+ size_t stuff_end = from+stuff.length; -+ if(stuff.length > delta) -+ {// replace increases length -+ delta = stuff.length - delta;// now, new is > old by delta -+ static if(is(Policy == void)) -+ dest.length = dest.length+delta;//@@@BUG lame @property -+ else -+ dest = Policy.realloc(dest, dest.length+delta); -+ auto rem = copy(retro(dest[to..dest.length-delta]) -+ , retro(dest[to+delta..dest.length])); -+ assert(rem.empty); -+ copy(stuff, dest[from..stuff_end]); -+ } -+ else if(stuff.length == delta) -+ { -+ copy(stuff, dest[from..to]); -+ } -+ else -+ {// replace decreases length by delta -+ delta = delta - stuff.length; -+ copy(stuff, dest[from..stuff_end]); -+ auto rem = copy(dest[to..dest.length] -+ , dest[stuff_end..dest.length-delta]); -+ static if(is(Policy == void)) -+ dest.length = dest.length - delta;//@@@BUG lame @property -+ else -+ dest = Policy.realloc(dest, dest.length-delta); -+ assert(rem.empty); -+ } -+ return stuff_end; -+} -+ -+ -+// Simple storage manipulation policy -+@trusted public struct GcPolicy -+{ -+ static T[] dup(T)(const T[] arr) -+ { -+ return arr.dup; -+ } -+ -+ static T[] alloc(T)(size_t size) -+ { -+ return new T[size]; -+ } -+ -+ static T[] realloc(T)(T[] arr, size_t sz) -+ { -+ arr.length = sz; -+ return arr; -+ } -+ -+ static void replaceImpl(T, Range)(ref T[] dest, size_t from, size_t to, Range stuff) -+ { -+ replaceInPlace(dest, from, to, stuff); -+ } -+ -+ static void append(T, V)(ref T[] arr, V value) -+ if(!isInputRange!V) -+ { -+ arr ~= force!T(value); -+ } -+ -+ static void append(T, V)(ref T[] arr, V value) -+ if(isInputRange!V) -+ { -+ insertInPlace(arr, arr.length, value); -+ } -+ -+ static void destroy(T)(ref T arr) -+ if(isDynamicArray!T && is(Unqual!T == T)) -+ { -+ debug -+ { -+ arr[] = cast(typeof(T.init[0]))(0xdead_beef); -+ } -+ arr = null; -+ } -+ -+ static void destroy(T)(ref T arr) -+ if(isDynamicArray!T && !is(Unqual!T == T)) -+ { -+ arr = null; -+ } -+} -+ -+// ditto -+@trusted struct ReallocPolicy -+{ -+ static T[] dup(T)(const T[] arr) -+ { -+ auto result = alloc!T(arr.length); -+ result[] = arr[]; -+ return result; -+ } -+ -+ static T[] alloc(T)(size_t size) -+ { -+ auto ptr = cast(T*)enforce(malloc(T.sizeof*size), "out of memory on C heap"); -+ return ptr[0..size]; -+ } -+ -+ static T[] realloc(T)(T[] arr, size_t size) -+ { -+ if(!size) -+ { -+ destroy(arr); -+ return null; -+ } -+ auto ptr = cast(T*)enforce(core.stdc.stdlib.realloc( -+ arr.ptr, T.sizeof*size), "out of memory on C heap"); -+ return ptr[0..size]; -+ } -+ -+ static void replaceImpl(T, Range)(ref T[] dest, size_t from, size_t to, Range stuff) -+ { -+ genericReplace!(ReallocPolicy)(dest, from, to, stuff); -+ } -+ -+ static void append(T, V)(ref T[] arr, V value) -+ if(!isInputRange!V) -+ { -+ arr = realloc(arr, arr.length+1); -+ arr[$-1] = force!T(value); -+ } -+ -+ static void append(T, V)(ref T[] arr, V value) -+ if(isInputRange!V && hasLength!V) -+ { -+ arr = realloc(arr, arr.length+value.length); -+ copy(value, arr[$-value.length..$]); -+ } -+ -+ static void destroy(T)(ref T[] arr) -+ { -+ if(arr.ptr) -+ free(arr.ptr); -+ arr = null; -+ } -+} -+ -+//build hack -+alias Uint24Array!ReallocPolicy _RealArray; -+ -+unittest -+{ -+ with(ReallocPolicy) -+ { -+ bool test(T, U, V)(T orig, size_t from, size_t to, U toReplace, V result, -+ string file = __FILE__, size_t line = __LINE__) -+ { -+ { -+ replaceImpl(orig, from, to, toReplace); -+ scope(exit) destroy(orig); -+ if(!equalS(orig, result)) -+ return false; -+ } -+ return true; -+ } -+ static T[] arr(T)(T[] args... ) -+ { -+ return dup(args); -+ } -+ -+ assert(test(arr([1, 2, 3, 4]), 0, 0, [5, 6, 7], [5, 6, 7, 1, 2, 3, 4])); -+ assert(test(arr([1, 2, 3, 4]), 0, 2, cast(int[])[], [3, 4])); -+ assert(test(arr([1, 2, 3, 4]), 0, 4, [5, 6, 7], [5, 6, 7])); -+ assert(test(arr([1, 2, 3, 4]), 0, 2, [5, 6, 7], [5, 6, 7, 3, 4])); -+ assert(test(arr([1, 2, 3, 4]), 2, 3, [5, 6, 7], [1, 2, 5, 6, 7, 4])); -+ } -+} -+ -+/** -+ Tests if T is some kind a set of code points. Intended for template constraints. -+*/ -+public template isCodepointSet(T) -+{ -+ static if(is(T dummy == InversionList!(Args), Args...)) -+ enum isCodepointSet = true; -+ else -+ enum isCodepointSet = false; -+} -+ -+/** -+ Tests if $(D T) is a pair of integers that implicitly convert to $(D V). -+ The following code must compile for any pair $(D T): -+ --- -+ (T x){ V a = x[0]; V b = x[1];} -+ --- -+ The following must not compile: -+ --- -+ (T x){ V c = x[2];} -+ --- -+*/ -+public template isIntegralPair(T, V=uint) -+{ -+ enum isIntegralPair = is(typeof((T x){ V a = x[0]; V b = x[1];})) -+ && !is(typeof((T x){ V c = x[2]; })); -+} -+ -+ -+/** -+ The recommended default type for set of $(CODEPOINTS). -+ For details, see the current implementation: $(LREF InversionList). -+*/ -+public alias InversionList!GcPolicy CodepointSet; -+ -+ -+//@@@BUG: std.typecons tuples depend on std.format to produce fields mixin -+// which relies on std.uni.isGraphical and this chain blows up with Forward reference error -+// hence below doesn't seem to work -+// public alias Tuple!(uint, "a", uint, "b") CodepointInterval; -+ -+/** -+ The recommended type of $(XREF _typecons, Tuple) -+ to represent [a, b$(RPAREN) intervals of $(CODEPOINTS). As used in $(LREF InversionList). -+ Any interval type should pass $(LREF isIntegralPair) trait. -+*/ -+public struct CodepointInterval -+{ -+ uint[2] _tuple; -+ alias _tuple this; -+ this(uint low, uint high) -+ { -+ _tuple[0] = low; -+ _tuple[1] = high; -+ } -+ bool opEquals(T)(T val) const -+ { -+ return this[0] == val[0] && this[1] == val[1]; -+ } -+ @property ref uint a(){ return _tuple[0]; } -+ @property ref uint b(){ return _tuple[1]; } -+} -+ -+//@@@BUG another forward reference workaround -+@trusted bool equalS(R1, R2)(R1 lhs, R2 rhs) -+{ -+ for(;;){ -+ if(lhs.empty) -+ return rhs.empty; -+ if(rhs.empty) -+ return false; -+ if(lhs.front != rhs.front) -+ return false; -+ lhs.popFront(); -+ rhs.popFront(); -+ } -+} -+ -+/** -+ $(P -+ $(D InversionList) is a set of $(CODEPOINTS) -+ represented as an array of open-right [a, b$(RPAREN) -+ intervals (see $(LREF CodepointInterval) above). -+ The name comes from the way the representation reads left to right. -+ For instance a set of all values [10, 50$(RPAREN), [80, 90$(RPAREN), -+ plus a singular value 60 looks like this: -+ ) -+ --- -+ 10, 50, 60, 61, 80, 90 -+ --- -+ $(P -+ The way to read this is: start with negative meaning that all numbers -+ smaller then the next one are not present in this set (and positive -+ - the contrary). Then switch positive/negative after each -+ number passed from left to right. -+ ) -+ $(P This way negative spans until 10, then positive until 50, -+ then negative until 60, then positive until 61, and so on. -+ As seen this provides a space-efficient storage of highly redundant data -+ that comes in long runs. A description which Unicode $(CHARACTER) -+ properties fit nicely. The technique itself could be seen as a variation -+ on $(LUCKY RLE encoding). -+ ) -+ -+ $(P Sets are value types (just like $(D int) is) thus they -+ are never aliased. -+ ) -+ Example: -+ --- -+ auto a = CodepointSet('a', 'z'+1); -+ auto b = CodepointSet('A', 'Z'+1); -+ auto c = a; -+ a = a | b; -+ assert(a == CodepointSet('A', 'Z'+1, 'a', 'z'+1)); -+ assert(a != c); -+ --- -+ $(P See also $(LREF unicode) for simpler construction of sets -+ from predefined ones. -+ ) -+ -+ $(P Memory usage is 6 bytes per each contiguous interval in a set. -+ The value semantics are achieved by using the -+ ($WEB http://en.wikipedia.org/wiki/Copy-on-write, COW) technique -+ and thus it's $(RED not) safe to cast this type to $(D_KEYWORD shared). -+ ) -+ -+ Note: -+ $(P It's not recommended to rely on the template parameters -+ or the exact type of a current $(CODEPOINT) set in $(D std.uni). -+ The type and parameters may change when the standard -+ allocators design is finalized. -+ Use $(LREF isCodepointSet) with templates or just stick with the default -+ alias $(LREF CodepointSet) throughout the whole code base. -+ ) -+*/ -+@trusted public struct InversionList(SP=GcPolicy) -+{ -+public: -+ /** -+ Construct from another code point set of any type. -+ */ -+ this(Set)(Set set) -+ if(isCodepointSet!Set) -+ { -+ uint[] arr; -+ foreach(v; set.byInterval) -+ { -+ arr ~= v.a; -+ arr ~= v.b; -+ } -+ data = Uint24Array!(SP)(arr); -+ } -+ -+ /** -+ Construct a set from a range of sorted code point intervals. -+ */ -+ this(Range)(Range intervals) -+ if(isForwardRange!Range && isIntegralPair!(ElementType!Range)) -+ { -+ auto flattened = roundRobin(intervals.save.map!"a[0]"(), -+ intervals.save.map!"a[1]"()); -+ data = Uint24Array!(SP)(flattened); -+ } -+ -+ /** -+ Construct a set from plain values of sorted code point intervals. -+ Example: -+ --- -+ auto set = CodepointSet('a', 'z'+1, 'а', 'я'+1); -+ foreach(v; 'a'..'z'+1) -+ assert(set[v]); -+ // Cyrillic lowercase interval -+ foreach(v; 'а'..'я'+1) -+ assert(set[v]); -+ --- -+ */ -+ this()(uint[] intervals...) -+ in -+ { -+ assert(intervals.length % 2 == 0, "Odd number of interval bounds [a, b)!"); -+ for(uint i=1; i<intervals.length; i++) -+ assert(intervals[i-1] < intervals[i]); -+ } -+ body -+ { -+ data = Uint24Array!(SP)(intervals); -+ } -+ -+ /** -+ Get range that spans all of the $(CODEPOINT) intervals in this $(LREF InversionList). -+ -+ Example: -+ --- -+ import std.algorithm, std.typecons; -+ auto set = CodepointSet('A', 'D'+1, 'a', 'd'+1); -+ set.byInterval.equal([tuple('A', 'E'), tuple('a', 'e')]); -+ --- -+ */ -+ @property auto byInterval() -+ { -+ static struct Intervals -+ { -+ this(Uint24Array!SP sp) -+ { -+ slice = sp; -+ start = 0; -+ end = sp.length; -+ } -+ -+ @property auto front()const -+ { -+ uint a = slice[start]; -+ uint b = slice[start+1]; -+ return CodepointInterval(a, b); -+ } -+ -+ @property auto back()const -+ { -+ uint a = slice[end-2]; -+ uint b = slice[end-1]; -+ return CodepointInterval(a, b); -+ } -+ -+ void popFront() -+ { -+ start += 2; -+ } -+ -+ void popBack() -+ { -+ end -= 2; -+ } -+ -+ @property bool empty()const { return start == end; } -+ -+ @property auto save(){ return this; } -+ private: -+ size_t start, end; -+ Uint24Array!SP slice; -+ } -+ return Intervals(data); -+ } -+ -+ /** -+ Tests the presence of code point $(D val) in this set. -+ -+ Example: -+ --- -+ auto gothic = unicode.Gothic; -+ // Gothic letter ahsa -+ assert(gothic['\U00010330']); -+ // no ascii in Gothic obviously -+ assert(!gothic['$']); -+ --- -+ */ -+ bool opIndex(uint val) const -+ { -+ // the <= ensures that searching in interval of [a, b) for 'a' you get .length == 1 -+ // return assumeSorted!((a,b) => a<=b)(data[]).lowerBound(val).length & 1; -+ return sharSwitchLowerBound!"a<=b"(data[], val) & 1; -+ } -+ -+ /// Number of $(CODEPOINTS) in this set -+ @property size_t length() -+ { -+ size_t sum = 0; -+ foreach(iv; byInterval) -+ { -+ sum += iv.b - iv.a; -+ } -+ return sum; -+ } -+ -+// bootstrap full set operations from 4 primitives (suitable as a template mixin): -+// addInterval, skipUpTo, dropUpTo & byInterval iteration -+//============================================================================ -+public: -+ /** -+ $(P Sets support natural syntax for set algebra, namely: ) -+ $(BOOKTABLE , -+ $(TR $(TH Operator) $(TH Math notation) $(TH Description) ) -+ $(TR $(TD &) $(TD a ∩ b) $(TD intersection) ) -+ $(TR $(TD |) $(TD a ∪ b) $(TD union) ) -+ $(TR $(TD -) $(TD a ∖ b) $(TD subtraction) ) -+ $(TR $(TD ~) $(TD a ~ b) $(TD symmetric set difference i.e. (a ∪ b) \ (a ∩ b)) ) -+ ) -+ -+ Example: -+ --- -+ auto lower = unicode.LowerCase; -+ auto upper = unicode.UpperCase; -+ auto ascii = unicode.ASCII; -+ -+ assert((lower & upper).empty); // no intersection -+ auto lowerASCII = lower & ascii; -+ assert(lowerASCII.byCodepoint.equal(iota('a', 'z'+1))); -+ // throw away all of the lowercase ASCII -+ assert((ascii - lower).length == 128 - 26); -+ -+ auto onlyOneOf = lower ~ ascii; -+ assert(!onlyOneOf['Δ']); // not ASCII and not lowercase -+ assert(onlyOneOf['$']); // ASCII and not lowercase -+ assert(!onlyOneOf['a']); // ASCII and lowercase -+ assert(onlyOneOf['я']); // not ASCII but lowercase -+ -+ // throw away all cased letters from ASCII -+ auto noLetters = ascii - (lower | upper); -+ assert(noLetters.length == 128 - 26*2); -+ --- -+ */ -+ This opBinary(string op, U)(U rhs) -+ if(isCodepointSet!U || is(U:dchar)) -+ { -+ static if(op == "&" || op == "|" || op == "~") -+ {// symmetric ops thus can swap arguments to reuse r-value -+ static if(is(U:dchar)) -+ { -+ auto tmp = this; -+ mixin("tmp "~op~"= rhs; "); -+ return tmp; -+ } -+ else -+ { -+ static if(is(Unqual!U == U)) -+ { -+ // try hard to reuse r-value -+ mixin("rhs "~op~"= this;"); -+ return rhs; -+ } -+ else -+ { -+ auto tmp = this; -+ mixin("tmp "~op~"= rhs;"); -+ return tmp; -+ } -+ } -+ } -+ else static if(op == "-") // anti-symmetric -+ { -+ auto tmp = this; -+ tmp -= rhs; -+ return tmp; -+ } -+ else -+ static assert(0, "no operator "~op~" defined for Set"); -+ } -+ -+ /// The 'op=' versions of the above overloaded operators. -+ ref This opOpAssign(string op, U)(U rhs) -+ if(isCodepointSet!U || is(U:dchar)) -+ { -+ static if(op == "|") // union -+ { -+ static if(is(U:dchar)) -+ { -+ this.addInterval(rhs, rhs+1); -+ return this; -+ } -+ else -+ return this.add(rhs); -+ } -+ else static if(op == "&") // intersection -+ return this.intersect(rhs);// overloaded -+ else static if(op == "-") // set difference -+ return this.sub(rhs);// overloaded -+ else static if(op == "~") // symmetric set difference -+ { -+ auto copy = this & rhs; -+ this |= rhs; -+ this -= copy; -+ return this; -+ } -+ else -+ static assert(0, "no operator "~op~" defined for Set"); -+ } -+ -+ /** -+ Tests the presence of codepoint $(D ch) in this set, -+ the same as $(LREF opIndex). -+ */ -+ bool opBinaryRight(string op: "in", U)(U ch) -+ if(is(U : dchar)) -+ { -+ return this[ch]; -+ } -+ -+ /// Obtains a set that is the inversion of this set. See also $(LREF inverted). -+ auto opUnary(string op: "!")() -+ { -+ return this.inverted; -+ } -+ -+ /** -+ A range that spans each $(CODEPOINT) in this set. -+ -+ Example: -+ --- -+ import std.algorithm; -+ auto set = unicode.ASCII; -+ set.byCodepoint.equal(iota(0, 0x80)); -+ --- -+ */ -+ @property auto byCodepoint() -+ { -+ @trusted static struct CodepointRange -+ { -+ this(This set) -+ { -+ r = set.byInterval; -+ if(!r.empty) -+ cur = r.front.a; -+ } -+ -+ @property dchar front() const -+ { -+ return cast(dchar)cur; -+ } -+ -+ @property bool empty() const -+ { -+ return r.empty; -+ } -+ -+ void popFront() -+ { -+ cur++; -+ while(cur >= r.front.b) -+ { -+ r.popFront(); -+ if(r.empty) -+ break; -+ cur = r.front.a; -+ } -+ } -+ private: -+ uint cur; -+ typeof(This.init.byInterval) r; -+ } -+ -+ return CodepointRange(this); -+ } -+ -+ /** -+ $(P Obtain textual representation of this set in from of -+ open-right intervals and feed it to $(D sink). -+ ) -+ $(P Used by various standard formatting facilities such as -+ $(XREF _format, formattedWrite), $(XREF _stdio, write), -+ $(XREF _stdio, writef), $(XREF _conv, to) and others. -+ ) -+ Example: -+ --- -+ import std.conv; -+ assert(unicode.ASCII.to!string == "[0..128$(RPAREN)"); -+ --- -+ */ -+ void toString(scope void delegate (const(char)[]) sink) -+ { -+ import std.format; -+ auto range = byInterval; -+ if(range.empty) -+ return; -+ auto val = range.front; -+ formattedWrite(sink, "[%d..%d)", val.a, val.b); -+ range.popFront(); -+ foreach(i; range) -+ formattedWrite(sink, " [%d..%d)", i.a, i.b); -+ } -+ /** -+ Add an interval [a, b$(RPAREN) to this set. -+ -+ Example: -+ --- -+ CodepointSet someSet; -+ someSet.add('0', '5').add('A','Z'+1); -+ someSet.add('5', '9'+1); -+ assert(someSet['0']); -+ assert(someSet['5']); -+ assert(someSet['9']); -+ assert(someSet['Z']); -+ --- -+ */ -+ ref add()(uint a, uint b) -+ { -+ addInterval(a, b); -+ return this; -+ } -+ -+private: -+ -+ ref intersect(U)(U rhs) -+ if(isCodepointSet!U) -+ { -+ Marker mark; -+ foreach( i; rhs.byInterval) -+ { -+ mark = this.dropUpTo(i.a, mark); -+ mark = this.skipUpTo(i.b, mark); -+ } -+ this.dropUpTo(uint.max, mark); -+ return this; -+ } -+ -+ ref intersect()(dchar ch) -+ { -+ foreach(i; byInterval) -+ if(i.a >= ch && ch < i.b) -+ return this = This.init.add(ch, ch+1); -+ this = This.init; -+ return this; -+ } -+ -+ ref sub()(dchar ch) -+ { -+ return subChar(ch); -+ } -+ -+ // same as the above except that skip & drop parts are swapped -+ ref sub(U)(U rhs) -+ if(isCodepointSet!U) -+ { -+ uint top; -+ Marker mark; -+ foreach(i; rhs.byInterval) -+ { -+ mark = this.skipUpTo(i.a, mark); -+ mark = this.dropUpTo(i.b, mark); -+ } -+ return this; -+ } -+ -+ ref add(U)(U rhs) -+ if(isCodepointSet!U) -+ { -+ Marker start; -+ foreach(i; rhs.byInterval) -+ { -+ start = addInterval(i.a, i.b, start); -+ } -+ return this; -+ } -+// end of mixin-able part -+//============================================================================ -+public: -+ /** -+ Obtains a set that is the inversion of this set. -+ -+ See the '!' $(LREF opUnary) for the same but using operators. -+ -+ Example: -+ --- -+ set = unicode.ASCII; -+ // union with the inverse gets all of the code points in the Unicode -+ assert((set | set.inverted).length == 0x110000); -+ // no intersection with the inverse -+ assert((set & set.inverted).empty); -+ --- -+ */ -+ @property auto inverted() -+ { -+ InversionList inversion = this; -+ if(inversion.data.length == 0) -+ { -+ inversion.addInterval(0, lastDchar+1); -+ return inversion; -+ } -+ if(inversion.data[0] != 0) -+ genericReplace(inversion.data, 0, 0, [0]); -+ else -+ genericReplace(inversion.data, 0, 1, cast(uint[])null); -+ if(data[data.length-1] != lastDchar+1) -+ genericReplace(inversion.data, -+ inversion.data.length, inversion.data.length, [lastDchar+1]); -+ else -+ genericReplace(inversion.data, -+ inversion.data.length-1, inversion.data.length, cast(uint[])null); -+ -+ return inversion; -+ } -+ -+ /** -+ Generates string with D source code of unary function with name of -+ $(D funcName) taking a single $(D dchar) argument. If $(D funcName) is empty -+ the code is adjusted to be a lambda function. -+ -+ The function generated tests if the $(CODEPOINT) passed -+ belongs to this set or not. The result is to be used with string mixin. -+ The intended usage area is aggressive optimization via meta programming -+ in parser generators and the like. -+ -+ Note: Use with care for relatively small or regular sets. It -+ could end up being slower then just using multi-staged tables. -+ -+ Example: -+ --- -+ import std.stdio; -+ -+ // construct set directly from [a, b) intervals -+ auto set = CodepointSet(10, 12, 45, 65, 100, 200); -+ writeln(set); -+ writeln(set.toSourceCode("func")); -+ --- -+ -+ The above outputs something along the lines of: -+ --- -+ bool func(dchar ch) -+ { -+ if(ch < 45) -+ { -+ if(ch == 10 || ch == 11) return true; -+ return false; -+ } -+ else if (ch < 65) return true; -+ else -+ { -+ if(ch < 100) return false; -+ if(ch < 200) return true; -+ return false; -+ } -+ } -+ --- -+ */ -+ string toSourceCode(string funcName="") -+ { -+ import std.string; -+ enum maxBinary = 3; -+ static string linearScope(R)(R ivals, string indent) -+ { -+ string result = indent~"{\n"; -+ string deeper = indent~" "; -+ foreach(ival; ivals) -+ { -+ auto span = ival[1] - ival[0]; -+ assert(span != 0); -+ if(span == 1) -+ { -+ result ~= format("%sif(ch == %s) return true;\n", deeper, ival[0]); -+ } -+ else if(span == 2) -+ { -+ result ~= format("%sif(ch == %s || ch == %s) return true;\n", -+ deeper, ival[0], ival[0]+1); -+ } -+ else -+ { -+ if(ival[0] != 0) // dchar is unsigned and < 0 is useless -+ result ~= format("%sif(ch < %s) return false;\n", deeper, ival[0]); -+ result ~= format("%sif(ch < %s) return true;\n", deeper, ival[1]); -+ } -+ } -+ result ~= format("%sreturn false;\n%s}\n", deeper, indent); // including empty range of intervals -+ return result; -+ } -+ -+ static string binaryScope(R)(R ivals, string indent) -+ { -+ // time to do unrolled comparisons? -+ if(ivals.length < maxBinary) -+ return linearScope(ivals, indent); -+ else -+ return bisect(ivals, ivals.length/2, indent); -+ } -+ -+ // not used yet if/elsebinary search is far better with DMD as of 2.061 -+ // and GDC is doing fine job either way -+ static string switchScope(R)(R ivals, string indent) -+ { -+ string result = indent~"switch(ch){\n"; -+ string deeper = indent~" "; -+ foreach(ival; ivals) -+ { -+ if(ival[0]+1 == ival[1]) -+ { -+ result ~= format("%scase %s: return true;\n", -+ deeper, ival[0]); -+ } -+ else -+ { -+ result ~= format("%scase %s: .. case %s: return true;\n", -+ deeper, ival[0], ival[1]-1); -+ } -+ } -+ result ~= deeper~"default: return false;\n"~indent~"}\n"; -+ return result; -+ } -+ -+ static string bisect(R)(R range, size_t idx, string indent) -+ { -+ string deeper = indent ~ " "; -+ // bisect on one [a, b) interval at idx -+ string result = indent~"{\n"; -+ // less branch, < a -+ result ~= format("%sif(ch < %s)\n%s", -+ deeper, range[idx][0], binaryScope(range[0..idx], deeper)); -+ // middle point, >= a && < b -+ result ~= format("%selse if (ch < %s) return true;\n", -+ deeper, range[idx][1]); -+ // greater or equal branch, >= b -+ result ~= format("%selse\n%s", -+ deeper, binaryScope(range[idx+1..$], deeper)); -+ return result~indent~"}\n"; -+ } -+ -+ string code = format("bool %s(dchar ch) @safe pure nothrow\n", -+ funcName.empty ? "function" : funcName); -+ auto range = byInterval.array(); -+ // special case first bisection to be on ASCII vs beyond -+ auto tillAscii = countUntil!"a[0] > 0x80"(range); -+ if(tillAscii <= 0) // everything is ASCII or nothing is ascii (-1 & 0) -+ code ~= binaryScope(range, ""); -+ else -+ code ~= bisect(range, tillAscii, ""); -+ return code; -+ } -+ -+ /** -+ True if this set doesn't contain any $(CODEPOINTS). -+ Example: -+ --- -+ CodepointSet emptySet; -+ assert(emptySet.length == 0); -+ assert(emptySet.empty); -+ --- -+ */ -+ @property bool empty() const -+ { -+ return data.length == 0; -+ } -+ -+private: -+ alias typeof(this) This; -+ alias size_t Marker; -+ -+ // special case for normal InversionList -+ ref subChar(dchar ch) -+ { -+ auto mark = skipUpTo(ch); -+ if(mark != data.length -+ && data[mark] == ch && data[mark-1] == ch) -+ { -+ // it has split, meaning that ch happens to be in one of intervals -+ data[mark] = data[mark]+1; -+ } -+ return this; -+ } -+ -+ // -+ Marker addInterval(int a, int b, Marker hint=Marker.init) -+ in -+ { -+ assert(a <= b, text(a, " > ", b)); -+ } -+ body -+ { -+ auto range = assumeSorted(data[]); -+ size_t pos; -+ size_t a_idx = range.lowerBound(a).length; -+ if(a_idx == range.length) -+ { -+ // [---+++----++++----++++++] -+ // [ a b] -+ data.append([a, b]); -+ return data.length-1; -+ } -+ size_t b_idx = range[a_idx..range.length].lowerBound(b).length+a_idx; -+ uint[] to_insert; -+ debug(std_uni) -+ { -+ writefln("a_idx=%d; b_idx=%d;", a_idx, b_idx); -+ } -+ if(b_idx == range.length) -+ { -+ // [-------++++++++----++++++-] -+ // [ s a b] -+ if(a_idx & 1)// a in positive -+ { -+ to_insert = [ b ]; -+ } -+ else// a in negative -+ { -+ to_insert = [a, b]; -+ } -+ genericReplace(data, a_idx, b_idx, to_insert); -+ return a_idx+to_insert.length-1; -+ } -+ -+ uint top = data[b_idx]; -+ -+ debug(std_uni) -+ { -+ writefln("a_idx=%d; b_idx=%d;", a_idx, b_idx); -+ writefln("a=%s; b=%s; top=%s;", a, b, top); -+ } -+ if(a_idx & 1) -+ {// a in positive -+ if(b_idx & 1)// b in positive -+ { -+ // [-------++++++++----++++++-] -+ // [ s a b ] -+ to_insert = [top]; -+ } -+ else // b in negative -+ { -+ // [-------++++++++----++++++-] -+ // [ s a b ] -+ if(top == b) -+ { -+ assert(b_idx+1 < data.length); -+ pos = genericReplace(data, a_idx, b_idx+2, [data[b_idx+1]]); -+ return pos; -+ } -+ to_insert = [b, top ]; -+ } -+ } -+ else -+ { // a in negative -+ if(b_idx & 1) // b in positive -+ { -+ // [----------+++++----++++++-] -+ // [ a b ] -+ to_insert = [a, top]; -+ } -+ else// b in negative -+ { -+ // [----------+++++----++++++-] -+ // [ a s b ] -+ if(top == b) -+ { -+ assert(b_idx+1 < data.length); -+ pos = genericReplace(data, a_idx, b_idx+2, [a, data[b_idx+1] ]); -+ return pos; -+ } -+ to_insert = [a, b, top]; -+ } -+ } -+ pos = genericReplace(data, a_idx, b_idx+1, to_insert); -+ debug(std_uni) -+ { -+ writefln("marker idx: %d; length=%d", pos, data[pos], data.length); -+ writeln("inserting ", to_insert); -+ } -+ return pos; -+ } -+ -+ // -+ Marker dropUpTo(uint a, Marker pos=Marker.init) -+ in -+ { -+ assert(pos % 2 == 0); // at start of interval -+ } -+ body -+ { -+ auto range = assumeSorted!"a<=b"(data[pos..data.length]); -+ if(range.empty) -+ return pos; -+ size_t idx = pos; -+ idx += range.lowerBound(a).length; -+ -+ debug(std_uni) -+ { -+ writeln("dropUpTo full length=", data.length); -+ writeln(pos,"~~~", idx); -+ } -+ if(idx == data.length) -+ return genericReplace(data, pos, idx, cast(uint[])[]); -+ if(idx & 1) -+ { // a in positive -+ //[--+++----++++++----+++++++------...] -+ // |<---si s a t -+ genericReplace(data, pos, idx, [a]); -+ } -+ else -+ { // a in negative -+ //[--+++----++++++----+++++++-------+++...] -+ // |<---si s a t -+ genericReplace(data, pos, idx, cast(uint[])[]); -+ } -+ return pos; -+ } -+ -+ // -+ Marker skipUpTo(uint a, Marker pos=Marker.init) -+ out(result) -+ { -+ assert(result % 2 == 0);// always start of interval -+ //(may be 0-width after-split) -+ } -+ body -+ { -+ assert(data.length % 2 == 0); -+ auto range = assumeSorted!"a<=b"(data[pos..data.length]); -+ size_t idx = pos+range.lowerBound(a).length; -+ -+ if(idx >= data.length) // could have Marker point to recently removed stuff -+ return data.length; -+ -+ if(idx & 1)// inside of interval, check for split -+ { -+ -+ uint top = data[idx]; -+ if(top == a)// no need to split, it's end -+ return idx+1; -+ uint start = data[idx-1]; -+ if(a == start) -+ return idx-1; -+ // split it up -+ genericReplace(data, idx, idx+1, [a, a, top]); -+ return idx+1; // avoid odd index -+ } -+ return idx; -+ } -+ -+ Uint24Array!SP data; -+}; -+ -+@system unittest -+{ -+ // test examples -+ import std.algorithm, std.typecons; -+ auto set = CodepointSet('A', 'D'+1, 'a', 'd'+1); -+ set.byInterval.equalS([tuple('A', 'E'), tuple('a', 'e')]); -+ set = unicode.ASCII; -+ assert(set.byCodepoint.equalS(iota(0, 0x80))); -+ set = CodepointSet('a', 'z'+1, 'а', 'я'+1); -+ foreach(v; 'a'..'z'+1) -+ assert(set[v]); -+ // Cyrillic lowercase interval -+ foreach(v; 'а'..'я'+1) -+ assert(set[v]); -+ -+ auto gothic = unicode.Gothic; -+ // Gothic letter ahsa -+ assert(gothic['\U00010330']); -+ // no ascii in Gothic obviously -+ assert(!gothic['$']); -+ -+ CodepointSet emptySet; -+ assert(emptySet.length == 0); -+ assert(emptySet.empty); -+ -+ set = unicode.ASCII; -+ // union with the inverse gets all of code points in the Unicode -+ assert((set | set.inverted).length == 0x110000); -+ // no intersection with inverse -+ assert((set & set.inverted).empty); -+ -+ CodepointSet someSet; -+ someSet.add('0', '5').add('A','Z'+1); -+ someSet.add('5', '9'+1); -+ assert(someSet['0']); -+ assert(someSet['5']); -+ assert(someSet['9']); -+ assert(someSet['Z']); -+ -+ auto lower = unicode.LowerCase; -+ auto upper = unicode.UpperCase; -+ auto ascii = unicode.ASCII; -+ assert((lower & upper).empty); // no intersection -+ auto lowerASCII = lower & ascii; -+ assert(lowerASCII.byCodepoint.equalS(iota('a', 'z'+1))); -+ // throw away all of the lowercase ASCII -+ assert((ascii - lower).length == 128 - 26); -+ auto onlyOneOf = lower ~ ascii; -+ assert(!onlyOneOf['Δ']); // not ASCII and not lowercase -+ assert(onlyOneOf['$']); // ASCII and not lowercase -+ assert(!onlyOneOf['a']); // ASCII and lowercase -+ assert(onlyOneOf['я']); // not ASCII but lowercase -+ -+ auto noLetters = ascii - (lower | upper); -+ assert(noLetters.length == 128 - 26*2); -+ import std.conv; -+ assert(unicode.ASCII.to!string() == "[0..128)"); -+} -+ -+// pedantic version for ctfe, and aligned-access only architectures -+@trusted uint safeRead24(const ubyte* ptr, size_t idx) pure nothrow -+{ -+ idx *= 3; -+ version(LittleEndian) -+ return ptr[idx] + (cast(uint)ptr[idx+1]<<8) -+ + (cast(uint)ptr[idx+2]<<16); -+ else -+ return (cast(uint)ptr[idx]<<16) + (cast(uint)ptr[idx+1]<<8) -+ + ptr[idx+2]; -+} -+ -+// ditto -+@trusted void safeWrite24(ubyte* ptr, uint val, size_t idx) pure nothrow -+{ -+ idx *= 3; -+ version(LittleEndian) -+ { -+ ptr[idx] = val & 0xFF; -+ ptr[idx+1] = (val>>8) & 0xFF; -+ ptr[idx+2] = (val>>16) & 0xFF; -+ } -+ else -+ { -+ ptr[idx] = (val>>16) & 0xFF; -+ ptr[idx+1] = (val>>8) & 0xFF; -+ ptr[idx+2] = val & 0xFF; -+ } -+} -+ -+// unaligned x86-like read/write functions -+@trusted uint unalignedRead24(const ubyte* ptr, size_t idx) pure nothrow -+{ -+ uint* src = cast(uint*)(ptr+3*idx); -+ version(LittleEndian) -+ return *src & 0xFF_FFFF; -+ else -+ return *src >> 8; -+} -+ -+// ditto -+@trusted void unalignedWrite24(ubyte* ptr, uint val, size_t idx) pure nothrow -+{ -+ uint* dest = cast(uint*)(cast(ubyte*)ptr + 3*idx); -+ version(LittleEndian) -+ *dest = val | (*dest & 0xFF00_0000); -+ else -+ *dest = (val<<8) | (*dest & 0xFF); -+} -+ -+uint read24(const ubyte* ptr, size_t idx) pure nothrow -+{ -+ static if(hasUnalignedReads) -+ return __ctfe ? safeRead24(ptr, idx) : unalignedRead24(ptr, idx); -+ else -+ return safeRead24(ptr, idx); -+} -+ -+void write24(ubyte* ptr, uint val, size_t idx) pure nothrow -+{ -+ static if(hasUnalignedReads) -+ return __ctfe ? safeWrite24(ptr, val, idx) : unalignedWrite24(ptr, val, idx); -+ else -+ return safeWrite24(ptr, val, idx); -+} -+ -+// Packed array of 24-bit integers, COW semantics. -+@trusted struct Uint24Array(SP=GcPolicy) -+{ -+ this(Range)(Range range) -+ if(isInputRange!Range && hasLength!Range) -+ { -+ length = range.length; -+ copy(range, this[]); -+ } -+ -+ this(Range)(Range range) -+ if(isForwardRange!Range && !hasLength!Range) -+ { -+ auto len = walkLength(range.save); -+ length = len; -+ copy(range, this[]); -+ } -+ -+ this(this) -+ { -+ if(!empty) -+ { -+ refCount = refCount + 1; -+ } -+ } -+ -+ ~this() -+ { -+ if(!empty) -+ { -+ auto cnt = refCount; -+ if(cnt == 1) -+ SP.destroy(data); -+ else -+ refCount = cnt - 1; -+ } -+ } -+ -+ // no ref-count for empty U24 array -+ @property bool empty() const { return data.length == 0; } -+ -+ // report one less then actual size -+ @property size_t length() const -+ { -+ return data.length ? (data.length-4)/3 : 0; -+ } -+ -+ //+ an extra slot for ref-count -+ @property void length(size_t len) -+ { -+ if(len == 0) -+ { -+ if(!empty) -+ freeThisReference(); -+ return; -+ } -+ immutable bytes = len*3+4; // including ref-count -+ if(empty) -+ { -+ data = SP.alloc!ubyte(bytes); -+ refCount = 1; -+ return; -+ } -+ auto cur_cnt = refCount; -+ if(cur_cnt != 1) // have more references to this memory -+ { -+ refCount = cur_cnt - 1; -+ auto new_data = SP.alloc!ubyte(bytes); -+ // take shrinking into account -+ auto to_copy = min(bytes, data.length)-4; -+ copy(data[0..to_copy], new_data[0..to_copy]); -+ data = new_data; // before setting refCount! -+ refCount = 1; -+ } -+ else // 'this' is the only reference -+ { -+ // use the realloc (hopefully in-place operation) -+ data = SP.realloc(data, bytes); -+ refCount = 1; // setup a ref-count in the new end of the array -+ } -+ } -+ -+ alias opDollar = length; -+ -+ // Read 24-bit packed integer -+ uint opIndex(size_t idx)const -+ { -+ return read24(data.ptr, idx); -+ } -+ -+ // Write 24-bit packed integer -+ void opIndexAssign(uint val, size_t idx) -+ in -+ { -+ assert(!empty && val <= 0xFF_FFFF); -+ } -+ body -+ { -+ auto cnt = refCount; -+ if(cnt != 1) -+ dupThisReference(cnt); -+ write24(data.ptr, val, idx); -+ } -+ -+ // -+ auto opSlice(size_t from, size_t to) -+ { -+ return sliceOverIndexed(from, to, &this); -+ } -+ -+ /// -+ auto opSlice(size_t from, size_t to) const -+ { -+ return sliceOverIndexed(from, to, &this); -+ } -+ -+ // length slices before the ref count -+ auto opSlice() -+ { -+ return opSlice(0, length); -+ } -+ -+ // length slices before the ref count -+ auto opSlice() const -+ { -+ return opSlice(0, length); -+ } -+ -+ void append(Range)(Range range) -+ if(isInputRange!Range && hasLength!Range && is(ElementType!Range : uint)) -+ { -+ size_t nl = length + range.length; -+ length = nl; -+ copy(range, this[nl-range.length..nl]); -+ } -+ -+ void append()(uint val) -+ { -+ length = length + 1; -+ this[$-1] = val; -+ } -+ -+ bool opEquals()(auto const ref Uint24Array rhs)const -+ { -+ if(empty ^ rhs.empty) -+ return false; // one is empty and the other isn't -+ return empty || data[0..$-4] == rhs.data[0..$-4]; -+ } -+ -+private: -+ // ref-count is right after the data -+ @property uint refCount() const -+ { -+ return read24(data.ptr, length); -+ } -+ -+ @property void refCount(uint cnt) -+ in -+ { -+ assert(cnt <= 0xFF_FFFF); -+ } -+ body -+ { -+ write24(data.ptr, cnt, length); -+ } -+ -+ void freeThisReference() -+ { -+ auto count = refCount; -+ if(count != 1) // have more references to this memory -+ { -+ // dec shared ref-count -+ refCount = count - 1; -+ data = []; -+ } -+ else -+ SP.destroy(data); -+ assert(!data.ptr); -+ } -+ -+ void dupThisReference(uint count) -+ in -+ { -+ assert(!empty && count != 1 && count == refCount); -+ } -+ body -+ { -+ // dec shared ref-count -+ refCount = count - 1; -+ // copy to the new chunk of RAM -+ auto new_data = SP.alloc!ubyte(data.length); -+ // bit-blit old stuff except the counter -+ copy(data[0..$-4], new_data[0..$-4]); -+ data = new_data; // before setting refCount! -+ refCount = 1; // so that this updates the right one -+ } -+ -+ ubyte[] data; -+} -+ -+@trusted unittest// Uint24 tests //@@@BUG@@ iota is system ?! -+{ -+ void funcRef(T)(ref T u24) -+ { -+ u24.length = 2; -+ u24[1] = 1024; -+ T u24_c = u24; -+ assert(u24[1] == 1024); -+ u24.length = 0; -+ assert(u24.empty); -+ u24.append([1, 2]); -+ assert(equalS(u24[], [1, 2])); -+ u24.append(111); -+ assert(equalS(u24[], [1, 2, 111])); -+ assert(!u24_c.empty && u24_c[1] == 1024); -+ u24.length = 3; -+ copy(iota(0, 3), u24[]); -+ assert(equalS(u24[], iota(0, 3))); -+ assert(u24_c[1] == 1024); -+ } -+ -+ void func2(T)(T u24) -+ { -+ T u24_2 = u24; -+ T u24_3; -+ u24_3 = u24_2; -+ assert(u24_2 == u24_3); -+ assert(equalS(u24[], u24_2[])); -+ assert(equalS(u24_2[], u24_3[])); -+ funcRef(u24_3); -+ -+ assert(equalS(u24_3[], iota(0, 3))); -+ assert(!equalS(u24_2[], u24_3[])); -+ assert(equalS(u24_2[], u24[])); -+ u24_2 = u24_3; -+ assert(equalS(u24_2[], iota(0, 3))); -+ // to test that passed arg is intact outside -+ // plus try out opEquals -+ u24 = u24_3; -+ u24 = T.init; -+ u24_3 = T.init; -+ assert(u24.empty); -+ assert(u24 == u24_3); -+ assert(u24 != u24_2); -+ } -+ -+ foreach(Policy; TypeTuple!(GcPolicy, ReallocPolicy)) -+ { -+ alias typeof(Uint24Array!Policy.init[]) Range; -+ alias Uint24Array!Policy U24A; -+ static assert(isForwardRange!Range); -+ static assert(isBidirectionalRange!Range); -+ static assert(isOutputRange!(Range, uint)); -+ static assert(isRandomAccessRange!(Range)); -+ -+ auto arr = U24A([42u, 36, 100]); -+ assert(arr[0] == 42); -+ assert(arr[1] == 36); -+ arr[0] = 72; -+ arr[1] = 0xFE_FEFE; -+ assert(arr[0] == 72); -+ assert(arr[1] == 0xFE_FEFE); -+ assert(arr[2] == 100); -+ U24A arr2 = arr; -+ assert(arr2[0] == 72); -+ arr2[0] = 11; -+ // test COW-ness -+ assert(arr[0] == 72); -+ assert(arr2[0] == 11); -+ // set this to about 100M to stress-test COW memory management -+ foreach(v; 0..10_000) -+ func2(arr); -+ assert(equalS(arr[], [72, 0xFE_FEFE, 100])); -+ -+ auto r2 = U24A(iota(0, 100)); -+ assert(equalS(r2[], iota(0, 100)), text(r2[])); -+ copy(iota(10, 170, 2), r2[10..90]); -+ assert(equalS(r2[], chain(iota(0, 10), iota(10, 170, 2), iota(90, 100))) -+ , text(r2[])); -+ } -+} -+ -+version(unittest) -+{ -+ private alias TypeTuple!(InversionList!GcPolicy, InversionList!ReallocPolicy) AllSets; -+} -+ -+@trusted unittest// core set primitives test -+{ -+ foreach(CodeList; AllSets) -+ { -+ CodeList a; -+ //"plug a hole" test -+ a.add(10, 20).add(25, 30).add(15, 27); -+ assert(a == CodeList(10, 30), text(a)); -+ -+ auto x = CodeList.init; -+ x.add(10, 20).add(30, 40).add(50, 60); -+ -+ a = x; -+ a.add(20, 49);//[10, 49) [50, 60) -+ assert(a == CodeList(10, 49, 50 ,60)); -+ -+ a = x; -+ a.add(20, 50); -+ assert(a == CodeList(10, 60), text(a)); -+ -+ // simple unions, mostly edge effects -+ x = CodeList.init; -+ x.add(10, 20).add(40, 60); -+ -+ a = x; -+ a.add(10, 25); //[10, 25) [40, 60) -+ assert(a == CodeList(10, 25, 40, 60)); -+ -+ a = x; -+ a.add(5, 15); //[5, 20) [40, 60) -+ assert(a == CodeList(5, 20, 40, 60)); -+ -+ a = x; -+ a.add(0, 10); // [0, 20) [40, 60) -+ assert(a == CodeList(0, 20, 40, 60)); -+ -+ a = x; -+ a.add(0, 5); // prepand -+ assert(a == CodeList(0, 5, 10, 20, 40, 60), text(a)); -+ -+ a = x; -+ a.add(5, 20); -+ assert(a == CodeList(5, 20, 40, 60)); -+ -+ a = x; -+ a.add(3, 37); -+ assert(a == CodeList(3, 37, 40, 60)); -+ -+ a = x; -+ a.add(37, 65); -+ assert(a == CodeList(10, 20, 37, 65)); -+ -+ // some tests on helpers for set intersection -+ x = CodeList.init.add(10, 20).add(40, 60).add(100, 120); -+ a = x; -+ -+ auto m = a.skipUpTo(60); -+ a.dropUpTo(110, m); -+ assert(a == CodeList(10, 20, 40, 60, 110, 120), text(a.data[])); -+ -+ a = x; -+ a.dropUpTo(100); -+ assert(a == CodeList(100, 120), text(a.data[])); -+ -+ a = x; -+ m = a.skipUpTo(50); -+ a.dropUpTo(140, m); -+ assert(a == CodeList(10, 20, 40, 50), text(a.data[])); -+ a = x; -+ a.dropUpTo(60); -+ assert(a == CodeList(100, 120), text(a.data[])); -+ } -+} -+ -+@trusted unittest -+{ // full set operations -+ foreach(CodeList; AllSets) -+ { -+ CodeList a, b, c, d; -+ -+ //"plug a hole" -+ a.add(20, 40).add(60, 80).add(100, 140).add(150, 200); -+ b.add(40, 60).add(80, 100).add(140, 150); -+ c = a | b; -+ d = b | a; -+ assert(c == CodeList(20, 200), text(CodeList.stringof," ", c)); -+ assert(c == d, text(c," vs ", d)); -+ -+ b = CodeList.init.add(25, 45).add(65, 85).add(95,110).add(150, 210); -+ c = a | b; //[20,45) [60, 85) [95, 140) [150, 210) -+ d = b | a; -+ assert(c == CodeList(20, 45, 60, 85, 95, 140, 150, 210), text(c)); -+ assert(c == d, text(c," vs ", d)); -+ -+ b = CodeList.init.add(10, 20).add(30,100).add(145,200); -+ c = a | b;//[10, 140) [145, 200) -+ d = b | a; -+ assert(c == CodeList(10, 140, 145, 200)); -+ assert(c == d, text(c," vs ", d)); -+ -+ b = CodeList.init.add(0, 10).add(15, 100).add(10, 20).add(200, 220); -+ c = a | b;//[0, 140) [150, 220) -+ d = b | a; -+ assert(c == CodeList(0, 140, 150, 220)); -+ assert(c == d, text(c," vs ", d)); -+ -+ -+ a = CodeList.init.add(20, 40).add(60, 80); -+ b = CodeList.init.add(25, 35).add(65, 75); -+ c = a & b; -+ d = b & a; -+ assert(c == CodeList(25, 35, 65, 75), text(c)); -+ assert(c == d, text(c," vs ", d)); -+ -+ a = CodeList.init.add(20, 40).add(60, 80).add(100, 140).add(150, 200); -+ b = CodeList.init.add(25, 35).add(65, 75).add(110, 130).add(160, 180); -+ c = a & b; -+ d = b & a; -+ assert(c == CodeList(25, 35, 65, 75, 110, 130, 160, 180), text(c)); -+ assert(c == d, text(c," vs ", d)); -+ -+ a = CodeList.init.add(20, 40).add(60, 80).add(100, 140).add(150, 200); -+ b = CodeList.init.add(10, 30).add(60, 120).add(135, 160); -+ c = a & b;//[20, 30)[60, 80) [100, 120) [135, 140) [150, 160) -+ d = b & a; -+ -+ assert(c == CodeList(20, 30, 60, 80, 100, 120, 135, 140, 150, 160),text(c)); -+ assert(c == d, text(c, " vs ",d)); -+ assert((c & a) == c); -+ assert((d & b) == d); -+ assert((c & d) == d); -+ -+ b = CodeList.init.add(40, 60).add(80, 100).add(140, 200); -+ c = a & b; -+ d = b & a; -+ assert(c == CodeList(150, 200), text(c)); -+ assert(c == d, text(c, " vs ",d)); -+ assert((c & a) == c); -+ assert((d & b) == d); -+ assert((c & d) == d); -+ -+ assert((a & a) == a); -+ assert((b & b) == b); -+ -+ a = CodeList.init.add(20, 40).add(60, 80).add(100, 140).add(150, 200); -+ b = CodeList.init.add(30, 60).add(75, 120).add(190, 300); -+ c = a - b;// [30, 40) [60, 75) [120, 140) [150, 190) -+ d = b - a;// [40, 60) [80, 100) [200, 300) -+ assert(c == CodeList(20, 30, 60, 75, 120, 140, 150, 190), text(c)); -+ assert(d == CodeList(40, 60, 80, 100, 200, 300), text(d)); -+ assert(c - d == c, text(c-d, " vs ", c)); -+ assert(d - c == d, text(d-c, " vs ", d)); -+ assert(c - c == CodeList.init); -+ assert(d - d == CodeList.init); -+ -+ a = CodeList.init.add(20, 40).add( 60, 80).add(100, 140).add(150, 200); -+ b = CodeList.init.add(10, 50).add(60, 160).add(190, 300); -+ c = a - b;// [160, 190) -+ d = b - a;// [10, 20) [40, 50) [80, 100) [140, 150) [200, 300) -+ assert(c == CodeList(160, 190), text(c)); -+ assert(d == CodeList(10, 20, 40, 50, 80, 100, 140, 150, 200, 300), text(d)); -+ assert(c - d == c, text(c-d, " vs ", c)); -+ assert(d - c == d, text(d-c, " vs ", d)); -+ assert(c - c == CodeList.init); -+ assert(d - d == CodeList.init); -+ -+ a = CodeList.init.add(20, 40).add(60, 80).add(100, 140).add(150, 200); -+ b = CodeList.init.add(10, 30).add(45, 100).add(130, 190); -+ c = a ~ b; // [10, 20) [30, 40) [45, 60) [80, 130) [140, 150) [190, 200) -+ d = b ~ a; -+ assert(c == CodeList(10, 20, 30, 40, 45, 60, 80, 130, 140, 150, 190, 200), -+ text(c)); -+ assert(c == d, text(c, " vs ", d)); -+ } -+} -+ -+ -+@system: -+unittest// vs single dchar -+{ -+ CodepointSet a = CodepointSet(10, 100, 120, 200); -+ assert(a - 'A' == CodepointSet(10, 65, 66, 100, 120, 200), text(a - 'A')); -+ assert((a & 'B') == CodepointSet(66, 67)); -+} -+ -+unittest// iteration & opIndex -+{ -+ import std.typecons; -+ foreach(CodeList; TypeTuple!(InversionList!(ReallocPolicy))) -+ { -+ auto arr = "ABCDEFGHIJKLMabcdefghijklm"d; -+ auto a = CodeList('A','N','a', 'n'); -+ assert(equalS(a.byInterval, -+ [tuple(cast(uint)'A', cast(uint)'N'), tuple(cast(uint)'a', cast(uint)'n')] -+ ), text(a.byInterval)); -+ -+ // same @@@BUG as in issue 8949 ? -+ version(bug8949) -+ { -+ assert(equalS(retro(a.byInterval), -+ [tuple(cast(uint)'a', cast(uint)'n'), tuple(cast(uint)'A', cast(uint)'N')] -+ ), text(retro(a.byInterval))); -+ } -+ auto achr = a.byCodepoint; -+ assert(equalS(achr, arr), text(a.byCodepoint)); -+ foreach(ch; a.byCodepoint) -+ assert(a[ch]); -+ auto x = CodeList(100, 500, 600, 900, 1200, 1500); -+ assert(equalS(x.byInterval, [ tuple(100, 500), tuple(600, 900), tuple(1200, 1500)]), text(x.byInterval)); -+ foreach(ch; x.byCodepoint) -+ assert(x[ch]); -+ static if(is(CodeList == CodepointSet)) -+ { -+ auto y = CodeList(x.byInterval); -+ assert(equalS(x.byInterval, y.byInterval)); -+ } -+ assert(equalS(CodepointSet.init.byInterval, cast(Tuple!(uint, uint)[])[])); -+ assert(equalS(CodepointSet.init.byCodepoint, cast(dchar[])[])); -+ } -+} -+ -+//============================================================================ -+// Generic Trie template and various ways to build it -+//============================================================================ -+ -+// debug helper to get a shortened array dump -+auto arrayRepr(T)(T x) -+{ -+ if(x.length > 32) -+ { -+ return text(x[0..16],"~...~", x[x.length-16..x.length]); -+ } -+ else -+ return text(x); -+} -+ -+/** -+ Maps $(D Key) to a suitable integer index within the range of $(D size_t). -+ The mapping is constructed by applying predicates from $(D Prefix) left to right -+ and concatenating the resulting bits. -+ -+ The first (leftmost) predicate defines the most significant bits of -+ the resulting index. -+ */ -+template mapTrieIndex(Prefix...) -+{ -+ size_t mapTrieIndex(Key)(Key key) -+ if(isValidPrefixForTrie!(Key, Prefix)) -+ { -+ alias Prefix p; -+ size_t idx; -+ foreach(i, v; p[0..$-1]) -+ { -+ idx |= p[i](key); -+ idx <<= p[i+1].bitSize; -+ } -+ idx |= p[$-1](key); -+ return idx; -+ } -+} -+ -+/* -+ $(D TrieBuilder) is a type used for incremental construction -+ of $(LREF Trie)s. -+ -+ See $(LREF buildTrie) for generic helpers built on top of it. -+*/ -+@trusted struct TrieBuilder(Value, Key, Args...) -+ if(isBitPackableType!Value && isValidArgsForTrie!(Key, Args)) -+{ -+private: -+ // last index is not stored in table, it is used as an offset to values in a block. -+ static if(is(Value == bool))// always pack bool -+ alias V = BitPacked!(Value, 1); -+ else -+ alias V = Value; -+ static auto deduceMaxIndex(Preds...)() -+ { -+ size_t idx = 1; -+ foreach(v; Preds) -+ idx *= 2^^v.bitSize; -+ return idx; -+ } -+ -+ static if(is(typeof(Args[0]) : Key)) // Args start with upper bound on Key -+ { -+ alias Prefix = Args[1..$]; -+ enum lastPageSize = 2^^Prefix[$-1].bitSize; -+ enum translatedMaxIndex = mapTrieIndex!(Prefix)(Args[0]); -+ enum roughedMaxIndex = -+ (translatedMaxIndex + lastPageSize-1)/lastPageSize*lastPageSize; -+ // check warp around - if wrapped, use the default deduction rule -+ enum maxIndex = roughedMaxIndex < translatedMaxIndex ? -+ deduceMaxIndex!(Prefix)() : roughedMaxIndex; -+ } -+ else -+ { -+ alias Prefix = Args; -+ enum maxIndex = deduceMaxIndex!(Prefix)(); -+ } -+ -+ alias getIndex = mapTrieIndex!(Prefix); -+ -+ enum lastLevel = Prefix.length-1; -+ struct ConstructState -+ { -+ bool zeros, ones; // current page is zeros? ones? -+ uint idx_zeros, idx_ones; -+ } -+ // iteration over levels of Trie, each indexes its own level and thus a shortened domain -+ size_t[Prefix.length] indices; -+ // default filler value to use -+ Value defValue; -+ // this is a full-width index of next item -+ size_t curIndex; -+ // all-zeros page index, all-ones page index (+ indicator if there is such a page) -+ ConstructState[Prefix.length] state; -+ // the table being constructed -+ MultiArray!(idxTypes!(Key, fullBitSize!(Prefix), Prefix[0..$]), V) table; -+ -+ @disable this(); -+ -+ // this function assumes no holes in the input so -+ // indices are going one by one -+ void addValue(size_t level, T)(T val, size_t numVals) -+ { -+ enum pageSize = 1<<Prefix[level].bitSize; -+ if(numVals == 0) -+ return; -+ do -+ { -+ // need to take pointer again, memory block may move on resize -+ auto ptr = table.slice!(level); -+ static if(is(T : bool)) -+ { -+ if(val) -+ state[level].zeros = false; -+ else -+ state[level].ones = false; -+ } -+ if(numVals == 1) -+ { -+ static if(level == Prefix.length-1) -+ ptr[indices[level]] = val; -+ else{// can incur narrowing conversion -+ assert(indices[level] < ptr.length); -+ ptr[indices[level]] = force!(typeof(ptr[indices[level]]))(val); -+ } -+ indices[level]++; -+ numVals = 0; -+ } -+ else -+ { -+ // where is the next page boundary -+ size_t nextPB = (indices[level]+pageSize)/pageSize*pageSize; -+ size_t j = indices[level]; -+ size_t n = nextPB-j;// can fill right in this page -+ if(numVals > n) -+ numVals -= n; -+ else -+ { -+ n = numVals; -+ numVals = 0; -+ } -+ static if(level < Prefix.length-1) -+ assert(indices[level] <= 2^^Prefix[level+1].bitSize); -+ ptr[j..j+n] = val; -+ j += n; -+ indices[level] = j; -+ } -+ // last level (i.e. topmost) has 1 "page" -+ // thus it need not to add a new page on upper level -+ static if(level != 0) -+ { -+ if(indices[level] % pageSize == 0) -+ spillToNextPage!level(ptr); -+ } -+ } -+ while(numVals); -+ } -+ -+ // this can re-use the current page if duplicate or allocate a new one -+ // it also makes sure that previous levels point to the correct page in this level -+ void spillToNextPage(size_t level, Slice)(ref Slice ptr) -+ { -+ alias typeof(table.slice!(level-1)[0]) NextIdx; -+ NextIdx next_lvl_index; -+ enum pageSize = 1<<Prefix[level].bitSize; -+ static if(is(T : bool)) -+ { -+ if(state[level].zeros) -+ { -+ if(state[level].idx_empty == uint.max) -+ { -+ state[level].idx_empty = cast(uint)(indices[level]/pageSize - 1); -+ goto L_allocate_page; -+ } -+ else -+ { -+ next_lvl_index = force!NextIdx(state[level].idx_empty); -+ indices[level] -= pageSize;// it is a duplicate -+ goto L_know_index; -+ } -+ } -+ } -+ auto last = indices[level]-pageSize; -+ auto slice = ptr[indices[level] - pageSize..indices[level]]; -+ size_t j; -+ for(j=0; j<last; j+=pageSize) -+ { -+ if(equalS(ptr[j..j+pageSize], slice[0..pageSize])) -+ { -+ // get index to it, reuse ptr space for the next block -+ next_lvl_index = force!NextIdx(j/pageSize); -+ version(none) -+ { -+ writefln("LEVEL(%s) page maped idx: %s: 0..%s ---> [%s..%s]" -+ ,level -+ ,indices[level-1], pageSize, j, j+pageSize); -+ writeln("LEVEL(", level -+ , ") mapped page is: ", slice, ": ", arrayRepr(ptr[j..j+pageSize])); -+ writeln("LEVEL(", level -+ , ") src page is :", ptr, ": ", arrayRepr(slice[0..pageSize])); -+ } -+ indices[level] -= pageSize; // reuse this page, it is duplicate -+ break; -+ } -+ } -+ if(j == last) -+ { -+ L_allocate_page: -+ next_lvl_index = force!NextIdx(indices[level]/pageSize - 1); -+ // allocate next page -+ version(none) -+ { -+ writefln("LEVEL(%s) page allocated: %s" -+ , level, arrayRepr(slice[0..pageSize])); -+ writefln("LEVEL(%s) index: %s ; page at this index %s" -+ , level -+ , next_lvl_index -+ , arrayRepr( -+ table.slice!(level) -+ [pageSize*next_lvl_index..(next_lvl_index+1)*pageSize] -+ )); -+ } -+ table.length!level = table.length!level + pageSize; -+ } -+ L_know_index: -+ // reset all zero/ones tracking variables -+ static if(is(TypeOfBitPacked!T : bool)) -+ { -+ state[level].zeros = true; -+ state[level].ones = true; -+ } -+ // for the previous level, values are indices to the pages in the current level -+ addValue!(level-1)(next_lvl_index, 1); -+ } -+ -+ // idx - full-width index to fill with v (full-width index != key) -+ // fills everything in the range of [curIndex, idx) with filler -+ void putAt(size_t idx, Value v) -+ { -+ assert(idx >= curIndex); -+ size_t numFillers = idx - curIndex; -+ addValue!lastLevel(defValue, numFillers); -+ addValue!lastLevel(v, 1); -+ curIndex = idx + 1; -+ } -+ -+ // ditto, but sets the range of [idxA, idxB) to v -+ void putRangeAt(size_t idxA, size_t idxB, Value v) -+ { -+ assert(idxA >= curIndex); -+ assert(idxB >= idxA); -+ size_t numFillers = idxA - curIndex; -+ addValue!lastLevel(defValue, numFillers); -+ addValue!lastLevel(v, idxB - idxA); -+ curIndex = idxB; // open-right -+ } -+ -+ enum errMsg = "non-monotonic prefix function(s), an unsorted range or " -+ "duplicate key->value mapping"; -+ -+public: -+ /** -+ Construct a builder, where $(D filler) is a value -+ to indicate empty slots (or "not found" condition). -+ */ -+ this(Value filler) -+ { -+ curIndex = 0; -+ defValue = filler; -+ // zeros-page index, ones-page index -+ foreach(ref v; state) -+ v = ConstructState(true, true, uint.max, uint.max); -+ table = typeof(table)(indices); -+ // one page per level is a bootstrap minimum -+ foreach(i; Sequence!(0, Prefix.length)) -+ table.length!i = (1<<Prefix[i].bitSize); -+ } -+ -+ /** -+ Put a value $(D v) into interval as -+ mapped by keys from $(D a) to $(D b). -+ All slots prior to $(D a) are filled with -+ the default filler. -+ */ -+ void putRange(Key a, Key b, Value v) -+ { -+ auto idxA = getIndex(a), idxB = getIndex(b); -+ // indexes of key should always grow -+ enforce(idxB >= idxA && idxA >= curIndex, errMsg); -+ putRangeAt(idxA, idxB, v); -+ } -+ -+ /** -+ Put a value $(D v) into slot mapped by $(D key). -+ All slots prior to $(D key) are filled with the -+ default filler. -+ */ -+ void putValue(Key key, Value v) -+ { -+ auto idx = getIndex(key); -+ enforce(idx >= curIndex, text(errMsg, " ", idx)); -+ putAt(idx, v); -+ } -+ -+ /// Finishes construction of Trie, yielding an immutable Trie instance. -+ auto build() -+ { -+ static if(maxIndex != 0) // doesn't cover full range of size_t -+ { -+ assert(curIndex <= maxIndex); -+ addValue!lastLevel(defValue, maxIndex - curIndex); -+ } -+ else -+ { -+ if(curIndex != 0 // couldn't wrap around -+ || (Prefix.length != 1 && indices[lastLevel] == 0)) // can be just empty -+ { -+ addValue!lastLevel(defValue, size_t.max - curIndex); -+ addValue!lastLevel(defValue, 1); -+ } -+ // else curIndex already completed the full range of size_t by wrapping around -+ } -+ return Trie!(V, Key, maxIndex, Prefix)(table); -+ } -+} -+ -+/* -+ $(P A generic Trie data-structure for a fixed number of stages. -+ The design goal is optimal speed with smallest footprint size. -+ ) -+ $(P It's intentionally read-only and doesn't provide constructors. -+ To construct one use a special builder, -+ see $(LREF TrieBuilder) and $(LREF buildTrie). -+ ) -+ -+*/ -+@trusted public struct Trie(Value, Key, Args...) -+ if(isValidPrefixForTrie!(Key, Args) -+ || (isValidPrefixForTrie!(Key, Args[1..$]) -+ && is(typeof(Args[0]) : size_t))) -+{ -+ static if(is(typeof(Args[0]) : size_t)) -+ { -+ enum maxIndex = Args[0]; -+ enum hasBoundsCheck = true; -+ alias Prefix = Args[1..$]; -+ } -+ else -+ { -+ enum hasBoundsCheck = false; -+ alias Prefix = Args; -+ } -+ -+ private this()(typeof(_table) table) -+ { -+ _table = table; -+ } -+ -+ // only for constant Tries constructed from precompiled tables -+ private this()(const(size_t)[] offsets, const(size_t)[] sizes, -+ const(size_t)[] data) const -+ { -+ _table = typeof(_table)(offsets, sizes, data); -+ } -+ -+ /* -+ $(P Lookup the $(D key) in this $(D Trie). ) -+ -+ $(P The lookup always succeeds if key fits the domain -+ provided during construction. The whole domain defined -+ is covered so instead of not found condition -+ the sentinel (filler) value could be used. ) -+ -+ $(P See $(LREF buildTrie), $(LREF TrieBuilder) for how to -+ define a domain of $(D Trie) keys and the sentinel value. ) -+ -+ Note: -+ Domain range-checking is only enabled in debug builds -+ and results in assertion failure. -+ */ -+ // templated to auto-detect pure, @safe and nothrow -+ TypeOfBitPacked!Value opIndex()(Key key) const -+ { -+ static if(hasBoundsCheck) -+ assert(mapTrieIndex!Prefix(key) < maxIndex); -+ size_t idx; -+ alias p = Prefix; -+ idx = cast(size_t)p[0](key); -+ foreach(i, v; p[0..$-1]) -+ idx = cast(size_t)((_table.ptr!i[idx]<<p[i+1].bitSize) + p[i+1](key)); -+ auto val = _table.ptr!(p.length-1)[idx]; -+ return val; -+ } -+ -+ @property size_t bytes(size_t n=size_t.max)() const -+ { -+ return _table.bytes!n; -+ } -+ -+ @property size_t pages(size_t n)() const -+ { -+ return (bytes!n+2^^(Prefix[n].bitSize-1)) -+ /2^^Prefix[n].bitSize; -+ } -+ -+ void store(OutRange)(scope OutRange sink) const -+ if(isOutputRange!(OutRange, char)) -+ { -+ _table.store(sink); -+ } -+ -+private: -+ MultiArray!(idxTypes!(Key, fullBitSize!(Prefix), Prefix[0..$]), Value) _table; -+} -+ -+// create a tuple of 'sliceBits' that slice the 'top' of bits into pieces of sizes 'sizes' -+// left-to-right, the most significant bits first -+template GetBitSlicing(size_t top, sizes...) -+{ -+ static if(sizes.length > 0) -+ alias TypeTuple!(sliceBits!(top - sizes[0], top) -+ , GetBitSlicing!(top - sizes[0], sizes[1..$])) GetBitSlicing; -+ else -+ alias TypeTuple!() GetBitSlicing; -+} -+ -+template callableWith(T) -+{ -+ template callableWith(alias Pred) -+ { -+ static if(!is(typeof(Pred(T.init)))) -+ enum callableWith = false; -+ else -+ { -+ alias Result = typeof(Pred(T.init)); -+ enum callableWith = isBitPackableType!(TypeOfBitPacked!(Result)); -+ } -+ } -+} -+ -+/* -+ Check if $(D Prefix) is a valid set of predicates -+ for $(D Trie) template having $(D Key) as the type of keys. -+ This requires all predicates to be callable, take -+ single argument of type $(D Key) and return unsigned value. -+*/ -+template isValidPrefixForTrie(Key, Prefix...) -+{ -+ enum isValidPrefixForTrie = allSatisfy!(callableWith!Key, Prefix); // TODO: tighten the screws -+} -+ -+/* -+ Check if $(D Args) is a set of maximum key value followed by valid predicates -+ for $(D Trie) template having $(D Key) as the type of keys. -+*/ -+template isValidArgsForTrie(Key, Args...) -+{ -+ static if(Args.length > 1) -+ { -+ enum isValidArgsForTrie = isValidPrefixForTrie!(Key, Args) -+ || (isValidPrefixForTrie!(Key, Args[1..$]) && is(typeof(Args[0]) : Key)); -+ } -+ else -+ enum isValidArgsForTrie = isValidPrefixForTrie!Args; -+} -+ -+@property size_t sumOfIntegerTuple(ints...)() -+{ -+ size_t count=0; -+ foreach(v; ints) -+ count += v; -+ return count; -+} -+ -+/** -+ A shorthand for creating a custom multi-level fixed Trie -+ from a $(D CodepointSet). $(D sizes) are numbers of bits per level, -+ with the most significant bits used first. -+ -+ Note: The sum of $(D sizes) must be equal 21. -+ -+ See_Also: $(LREF toTrie), which is even simpler. -+ -+ Example: -+ --- -+ { -+ import std.stdio; -+ auto set = unicode("Number"); -+ auto trie = codepointSetTrie!(8, 5, 8)(set); -+ writeln("Input code points to test:"); -+ foreach(line; stdin.byLine) -+ { -+ int count=0; -+ foreach(dchar ch; line) -+ if(trie[ch])// is number -+ count++; -+ writefln("Contains %d number code points.", count); -+ } -+ } -+ --- -+*/ -+public template codepointSetTrie(sizes...) -+ if(sumOfIntegerTuple!sizes == 21) -+{ -+ auto codepointSetTrie(Set)(Set set) -+ if(isCodepointSet!Set) -+ { -+ auto builder = TrieBuilder!(bool, dchar, lastDchar+1, GetBitSlicing!(21, sizes))(false); -+ foreach(ival; set.byInterval) -+ builder.putRange(ival[0], ival[1], true); -+ return builder.build(); -+ } -+} -+ -+/// Type of Trie generated by codepointSetTrie function. -+public template CodepointSetTrie(sizes...) -+ if(sumOfIntegerTuple!sizes == 21) -+{ -+ alias Prefix = GetBitSlicing!(21, sizes); -+ alias CodepointSetTrie = typeof(TrieBuilder!(bool, dchar, lastDchar+1, Prefix)(false).build()); -+} -+ -+/** -+ A slightly more general tool for building fixed $(D Trie) -+ for the Unicode data. -+ -+ Specifically unlike $(D codepointSetTrie) it's allows creating mappings -+ of $(D dchar) to an arbitrary type $(D T). -+ -+ Note: Overload taking $(D CodepointSet)s will naturally convert -+ only to bool mapping $(D Trie)s. -+ -+ Example: -+ --- -+ // pick characters from the Greek script -+ auto set = unicode.Greek; -+ -+ // a user-defined property (or an expensive function) -+ // that we want to look up -+ static uint luckFactor(dchar ch) -+ { -+ // here we consider a character lucky -+ // if its code point has a lot of identical hex-digits -+ // e.g. arabic letter DDAL (\u0688) has a "luck factor" of 2 -+ ubyte[6] nibbles; // 6 4-bit chunks of code point -+ uint value = ch; -+ foreach(i; 0..6) -+ { -+ nibbles[i] = value & 0xF; -+ value >>= 4; -+ } -+ uint luck; -+ foreach(n; nibbles) -+ luck = cast(uint)max(luck, count(nibbles[], n)); -+ return luck; -+ } -+ -+ // only unsigned built-ins are supported at the moment -+ alias LuckFactor = BitPacked!(uint, 3); -+ -+ // create a temporary associative array (AA) -+ LuckFactor[dchar] map; -+ foreach(ch; set.byCodepoint) -+ map[ch] = luckFactor(ch); -+ -+ // bits per stage are chosen randomly, fell free to optimize -+ auto trie = codepointTrie!(LuckFactor, 8, 5, 8)(map); -+ -+ // from now on the AA is not needed -+ foreach(ch; set.byCodepoint) -+ assert(trie[ch] == luckFactor(ch)); // verify -+ // CJK is not Greek, thus it has the default value -+ assert(trie['\u4444'] == 0); -+ // and here is a couple of quite lucky Greek characters: -+ // Greek small letter epsilon with dasia -+ assert(trie['\u1F11'] == 3); -+ // Ancient Greek metretes sign -+ assert(trie['\U00010181'] == 3); -+ --- -+*/ -+public template codepointTrie(T, sizes...) -+ if(sumOfIntegerTuple!sizes == 21) -+{ -+ alias Prefix = GetBitSlicing!(21, sizes); -+ -+ static if(is(TypeOfBitPacked!T == bool)) -+ { -+ auto codepointTrie(Set)(in Set set) -+ if(isCodepointSet!Set) -+ { -+ return codepointSetTrie(set); -+ } -+ } -+ -+ auto codepointTrie()(T[dchar] map, T defValue=T.init) -+ { -+ return buildTrie!(T, dchar, Prefix)(map, defValue); -+ } -+ -+ // unsorted range of pairs -+ auto codepointTrie(R)(R range, T defValue=T.init) -+ if(isInputRange!R -+ && is(typeof(ElementType!R.init[0]) : T) -+ && is(typeof(ElementType!R.init[1]) : dchar)) -+ { -+ // build from unsorted array of pairs -+ // TODO: expose index sorting functions for Trie -+ return buildTrie!(T, dchar, Prefix)(range, defValue, true); -+ } -+} -+ -+unittest // codepointTrie example -+{ -+ // pick characters from the Greek script -+ auto set = unicode.Greek; -+ -+ // a user-defined property (or an expensive function) -+ // that we want to look up -+ static uint luckFactor(dchar ch) -+ { -+ // here we consider a character lucky -+ // if its code point has a lot of identical hex-digits -+ // e.g. arabic letter DDAL (\u0688) has a "luck factor" of 2 -+ ubyte[6] nibbles; // 6 4-bit chunks of code point -+ uint value = ch; -+ foreach(i; 0..6) -+ { -+ nibbles[i] = value & 0xF; -+ value >>= 4; -+ } -+ uint luck; -+ foreach(n; nibbles) -+ luck = cast(uint)max(luck, count(nibbles[], n)); -+ return luck; -+ } -+ -+ // only unsigned built-ins are supported at the moment -+ alias LuckFactor = BitPacked!(uint, 3); -+ -+ // create a temporary associative array (AA) -+ LuckFactor[dchar] map; -+ foreach(ch; set.byCodepoint) -+ map[ch] = LuckFactor(luckFactor(ch)); -+ -+ // bits per stage are chosen randomly, fell free to optimize -+ auto trie = codepointTrie!(LuckFactor, 8, 5, 8)(map); -+ -+ // from now on the AA is not needed -+ foreach(ch; set.byCodepoint) -+ assert(trie[ch] == luckFactor(ch)); // verify -+ // CJK is not Greek, thus it has the default value -+ assert(trie['\u4444'] == 0); -+ // and here is a couple of quite lucky Greek characters: -+ // Greek small letter epsilon with dasia -+ assert(trie['\u1F11'] == 3); -+ // Ancient Greek metretes sign -+ assert(trie['\U00010181'] == 3); -+ -+} -+ -+/// Type of Trie as generated by codepointTrie function. -+public template CodepointTrie(T, sizes...) -+ if(sumOfIntegerTuple!sizes == 21) -+{ -+ alias Prefix = GetBitSlicing!(21, sizes); -+ alias CodepointTrie = typeof(TrieBuilder!(T, dchar, lastDchar+1, Prefix)(T.init).build()); -+} -+ -+// @@@BUG multiSort can's access private symbols from uni -+public template cmpK0(alias Pred) -+{ -+ static bool cmpK0(Value, Key) -+ (Tuple!(Value, Key) a, Tuple!(Value, Key) b) -+ { -+ return Pred(a[1]) < Pred(b[1]); -+ } -+} -+ -+/* -+ The most general utility for construction of $(D Trie)s -+ short of using $(D TrieBuilder) directly. -+ -+ Provides a number of convenience overloads. -+ $(D Args) is tuple of maximum key value followed by -+ predicates to construct index from key. -+ -+ Alternatively if the first argument is not a value convertible to $(D Key) -+ then the whole tuple of $(D Args) is treated as predicates -+ and the maximum Key is deduced from predicates. -+*/ -+public template buildTrie(Value, Key, Args...) -+ if(isValidArgsForTrie!(Key, Args)) -+{ -+ static if(is(typeof(Args[0]) : Key)) // prefix starts with upper bound on Key -+ { -+ alias Prefix = Args[1..$]; -+ } -+ else -+ alias Prefix = Args; -+ -+ alias getIndex = mapTrieIndex!(Prefix); -+ -+ // for multi-sort -+ template GetComparators(size_t n) -+ { -+ static if(n > 0) -+ alias GetComparators = -+ TypeTuple!(GetComparators!(n-1), cmpK0!(Prefix[n-1])); -+ else -+ alias GetComparators = TypeTuple!(); -+ } -+ -+ /* -+ Build $(D Trie) from a range of a Key-Value pairs, -+ assuming it is sorted by Key as defined by the following lambda: -+ ------ -+ (a, b) => mapTrieIndex!(Prefix)(a) < mapTrieIndex!(Prefix)(b) -+ ------ -+ Exception is thrown if it's detected that the above order doesn't hold. -+ -+ In other words $(LREF mapTrieIndex) should be a -+ monotonically increasing function that maps $(D Key) to an integer. -+ -+ See also: $(XREF _algorithm, sort), -+ $(XREF _range, SortedRange), -+ $(XREF _algorithm, setUnion). -+ */ -+ auto buildTrie(Range)(Range range, Value filler=Value.init) -+ if(isInputRange!Range && is(typeof(Range.init.front[0]) : Value) -+ && is(typeof(Range.init.front[1]) : Key)) -+ { -+ auto builder = TrieBuilder!(Value, Key, Prefix)(filler); -+ foreach(v; range) -+ builder.putValue(v[1], v[0]); -+ return builder.build(); -+ } -+ -+ /* -+ If $(D Value) is bool (or BitPacked!(bool, x)) then it's possible -+ to build $(D Trie) from a range of open-right intervals of $(D Key)s. -+ The requirement on the ordering of keys (and the behavior on the -+ violation of it) is the same as for Key-Value range overload. -+ -+ Intervals denote ranges of !$(D filler) i.e. the opposite of filler. -+ If no filler provided keys inside of the intervals map to true, -+ and $(D filler) is false. -+ */ -+ auto buildTrie(Range)(Range range, Value filler=Value.init) -+ if(is(TypeOfBitPacked!Value == bool) -+ && isInputRange!Range && is(typeof(Range.init.front[0]) : Key) -+ && is(typeof(Range.init.front[1]) : Key)) -+ { -+ auto builder = TrieBuilder!(Value, Key, Prefix)(filler); -+ foreach(ival; range) -+ builder.putRange(ival[0], ival[1], !filler); -+ return builder.build(); -+ } -+ -+ auto buildTrie(Range)(Range range, Value filler, bool unsorted) -+ if(isInputRange!Range -+ && is(typeof(Range.init.front[0]) : Value) -+ && is(typeof(Range.init.front[1]) : Key)) -+ { -+ alias Comps = GetComparators!(Prefix.length); -+ if(unsorted) -+ multiSort!(Comps)(range); -+ return buildTrie(range, filler); -+ } -+ -+ /* -+ If $(D Value) is bool (or BitPacked!(bool, x)) then it's possible -+ to build $(D Trie) simply from an input range of $(D Key)s. -+ The requirement on the ordering of keys (and the behavior on the -+ violation of it) is the same as for Key-Value range overload. -+ -+ Keys found in range denote !$(D filler) i.e. the opposite of filler. -+ If no filler provided keys map to true, and $(D filler) is false. -+ */ -+ auto buildTrie(Range)(Range range, Value filler=Value.init) -+ if(is(TypeOfBitPacked!Value == bool) -+ && isInputRange!Range && is(typeof(Range.init.front) : Key)) -+ { -+ auto builder = TrieBuilder!(Value, Key, Prefix)(filler); -+ foreach(v; range) -+ builder.putValue(v, !filler); -+ return builder.build(); -+ } -+ -+ /* -+ If $(D Key) is unsigned integer $(D Trie) could be constructed from array -+ of values where array index serves as key. -+ */ -+ auto buildTrie()(Value[] array, Value filler=Value.init) -+ if(isUnsigned!Key) -+ { -+ auto builder = TrieBuilder!(Value, Key, Prefix)(filler); -+ foreach(idx, v; array) -+ builder.putValue(idx, v); -+ return builder.build(); -+ } -+ -+ /* -+ Builds $(D Trie) from associative array. -+ */ -+ auto buildTrie(Key, Value)(Value[Key] map, Value filler=Value.init) -+ { -+ auto range = array(zip(map.values, map.keys)); -+ return buildTrie(range, filler, true); // sort it -+ } -+} -+ -+/++ -+ Convenience function to construct optimal configurations for -+ packed Trie from any $(D set) of $(CODEPOINTS). -+ -+ The parameter $(D level) indicates the number of trie levels to use, -+ allowed values are: 1, 2, 3 or 4. Levels represent different trade-offs -+ speed-size wise. -+ -+ $(P Level 1 is fastest and the most memory hungry (a bit array). ) -+ $(P Level 4 is the slowest and has the smallest footprint. ) -+ -+ See the $(S_LINK Synopsis, Synopsis) section for example. -+ -+ Note: -+ Level 4 stays very practical (being faster and more predictable) -+ compared to using direct lookup on the $(D set) itself. -+ -+ -++/ -+public auto toTrie(size_t level, Set)(Set set) -+ if(isCodepointSet!Set) -+{ -+ static if(level == 1) -+ return codepointSetTrie!(21)(set); -+ else static if(level == 2) -+ return codepointSetTrie!(10, 11)(set); -+ else static if(level == 3) -+ return codepointSetTrie!(8, 5, 8)(set); -+ else static if(level == 4) -+ return codepointSetTrie!(6, 4, 4, 7)(set); -+ else -+ static assert(false, -+ "Sorry, toTrie doesn't support levels > 4, use codepointSetTrie directly"); -+} -+ -+/** -+ $(P Builds a $(D Trie) with typically optimal speed-size trade-off -+ and wraps it into a delegate of the following type: -+ $(D bool delegate(dchar ch)). ) -+ -+ $(P Effectively this creates a 'tester' lambda suitable -+ for algorithms like std.algorithm.find that take unary predicates. ) -+ -+ See the $(S_LINK Synopsis, Synopsis) section for example. -+*/ -+public auto toDelegate(Set)(Set set) -+ if(isCodepointSet!Set) -+{ -+ // 3 is very small and is almost as fast as 2-level (due to CPU caches?) -+ auto t = toTrie!3(set); -+ return (dchar ch) => t[ch]; -+} -+ -+/** -+ $(P Opaque wrapper around unsigned built-in integers and -+ code unit (char/wchar/dchar) types. -+ Parameter $(D sz) indicates that the value is confined -+ to the range of [0, 2^^sz$(RPAREN). With this knowledge it can be -+ packed more tightly when stored in certain -+ data-structures like trie. ) -+ -+ Note: -+ $(P The $(D BitPacked!(T, sz)) is implicitly convertible to $(D T) -+ but not vise-versa. Users have to ensure the value fits in -+ the range required and use the $(D cast) -+ operator to perform the conversion.) -+*/ -+struct BitPacked(T, size_t sz) -+ if(isIntegral!T || is(T:dchar)) -+{ -+ enum bitSize = sz; -+ T _value; -+ alias _value this; -+} -+ -+/* -+ Depending on the form of the passed argument $(D bitSizeOf) returns -+ the amount of bits required to represent a given type -+ or a return type of a given functor. -+*/ -+template bitSizeOf(Args...) -+ if(Args.length == 1) -+{ -+ alias T = Args[0]; -+ static if(__traits(compiles, { size_t val = T.bitSize; })) //(is(typeof(T.bitSize) : size_t)) -+ { -+ enum bitSizeOf = T.bitSize; -+ } -+ else static if(is(ReturnType!T dummy == BitPacked!(U, bits), U, size_t bits)) -+ { -+ enum bitSizeOf = bitSizeOf!(ReturnType!T); -+ } -+ else -+ { -+ enum bitSizeOf = T.sizeof*8; -+ } -+} -+ -+/** -+ Tests if $(D T) is some instantiation of $(LREF BitPacked)!(U, x) -+ and thus suitable for packing. -+*/ -+template isBitPacked(T) -+{ -+ static if(is(T dummy == BitPacked!(U, bits), U, size_t bits)) -+ enum isBitPacked = true; -+ else -+ enum isBitPacked = false; -+} -+ -+/** -+ Gives the type $(D U) from $(LREF BitPacked)!(U, x) -+ or $(D T) itself for every other type. -+*/ -+template TypeOfBitPacked(T) -+{ -+ static if(is(T dummy == BitPacked!(U, bits), U, size_t bits)) -+ alias TypeOfBitPacked = U; -+ else -+ alias TypeOfBitPacked = T; -+} -+ -+/* -+ Wrapper, used in definition of custom data structures from $(D Trie) template. -+ Applying it to a unary lambda function indicates that the returned value always -+ fits within $(D bits) of bits. -+*/ -+struct assumeSize(alias Fn, size_t bits) -+{ -+ enum bitSize = bits; -+ static auto ref opCall(T)(auto ref T arg) -+ { -+ return Fn(arg); -+ } -+} -+ -+/* -+ A helper for defining lambda function that yields a slice -+ of certain bits from an unsigned integral value. -+ The resulting lambda is wrapped in assumeSize and can be used directly -+ with $(D Trie) template. -+*/ -+struct sliceBits(size_t from, size_t to) -+{ -+ //for now bypass assumeSize, DMD has trouble inlining it -+ enum bitSize = to-from; -+ static auto opCall(T)(T x) -+ out(result) -+ { -+ assert(result < (1<<to-from)); -+ } -+ body -+ { -+ static assert(from < to); -+ return (x >> from) & ((1<<(to-from))-1); -+ } -+} -+ -+uint low_8(uint x) { return x&0xFF; } -+@safe pure nothrow uint midlow_8(uint x){ return (x&0xFF00)>>8; } -+alias assumeSize!(low_8, 8) lo8; -+alias assumeSize!(midlow_8, 8) mlo8; -+ -+static assert(bitSizeOf!lo8 == 8); -+static assert(bitSizeOf!(sliceBits!(4, 7)) == 3); -+static assert(bitSizeOf!(BitPacked!(uint, 2)) == 2); -+ -+template Sequence(size_t start, size_t end) -+{ -+ static if(start < end) -+ alias TypeTuple!(start, Sequence!(start+1, end)) Sequence; -+ else -+ alias TypeTuple!() Sequence; -+} -+ -+//---- TRIE TESTS ---- -+unittest -+{ -+ static trieStats(TRIE)(TRIE t) -+ { -+ version(std_uni_stats) -+ { -+ import std.stdio; -+ writeln("---TRIE FOOTPRINT STATS---"); -+ foreach(i; Sequence!(0, t.table.dim) ) -+ { -+ writefln("lvl%s = %s bytes; %s pages" -+ , i, t.bytes!i, t.pages!i); -+ } -+ writefln("TOTAL: %s bytes", t.bytes); -+ version(none) -+ { -+ writeln("INDEX (excluding value level):"); -+ foreach(i; Sequence!(0, t.table.dim-1) ) -+ writeln(t.table.slice!(i)[0..t.table.length!i]); -+ } -+ writeln("---------------------------"); -+ } -+ } -+ //@@@BUG link failure, lambdas not found by linker somehow (in case of trie2) -+ // alias assumeSize!(8, function (uint x) { return x&0xFF; }) lo8; -+ // alias assumeSize!(7, function (uint x) { return (x&0x7F00)>>8; }) next8; -+ alias CodepointSet Set; -+ auto set = Set('A','Z','a','z'); -+ auto trie = buildTrie!(bool, uint, 256, lo8)(set.byInterval);// simple bool array -+ for(int a='a'; a<'z';a++) -+ assert(trie[a]); -+ for(int a='A'; a<'Z';a++) -+ assert(trie[a]); -+ for(int a=0; a<'A'; a++) -+ assert(!trie[a]); -+ for(int a ='Z'; a<'a'; a++) -+ assert(!trie[a]); -+ trieStats(trie); -+ -+ auto redundant2 = Set( -+ 1, 18, 256+2, 256+111, 512+1, 512+18, 768+2, 768+111); -+ auto trie2 = buildTrie!(bool, uint, 1024, mlo8, lo8)(redundant2.byInterval); -+ trieStats(trie2); -+ foreach(e; redundant2.byCodepoint) -+ assert(trie2[e], text(cast(uint)e, " - ", trie2[e])); -+ foreach(i; 0..1024) -+ { -+ assert(trie2[i] == (i in redundant2)); -+ } -+ -+ -+ auto redundant3 = Set( -+ 2, 4, 6, 8, 16, -+ 2+16, 4+16, 16+6, 16+8, 16+16, -+ 2+32, 4+32, 32+6, 32+8, -+ ); -+ -+ enum max3 = 256; -+ // sliceBits -+ auto trie3 = buildTrie!(bool, uint, max3, -+ sliceBits!(6,8), sliceBits!(4,6), sliceBits!(0,4) -+ )(redundant3.byInterval); -+ trieStats(trie3); -+ foreach(i; 0..max3) -+ assert(trie3[i] == (i in redundant3), text(cast(uint)i)); -+ -+ auto redundant4 = Set( -+ 10, 64, 64+10, 128, 128+10, 256, 256+10, 512, -+ 1000, 2000, 3000, 4000, 5000, 6000 -+ ); -+ enum max4 = 2^^16; -+ auto trie4 = buildTrie!(bool, size_t, max4, -+ sliceBits!(13, 16), sliceBits!(9, 13), sliceBits!(6, 9) , sliceBits!(0, 6) -+ )(redundant4.byInterval); -+ foreach(i; 0..max4){ -+ if(i in redundant4) -+ assert(trie4[i], text(cast(uint)i)); -+ } -+ trieStats(trie4); -+ -+ alias mapToS = mapTrieIndex!(useItemAt!(0, char)); -+ string[] redundantS = ["tea", "start", "orange"]; -+ redundantS.sort!((a,b) => mapToS(a) < mapToS(b))(); -+ auto strie = buildTrie!(bool, string, useItemAt!(0, char))(redundantS); -+ // using first char only -+ assert(redundantS == ["orange", "start", "tea"]); -+ assert(strie["test"], text(strie["test"])); -+ assert(!strie["aea"]); -+ assert(strie["s"]); -+ -+ // a bit size test -+ auto a = array(map!(x => to!ubyte(x))(iota(0, 256))); -+ auto bt = buildTrie!(bool, ubyte, sliceBits!(7, 8), sliceBits!(5, 7), sliceBits!(0, 5))(a); -+ trieStats(bt); -+ foreach(i; 0..256) -+ assert(bt[cast(ubyte)i]); -+} -+ -+template useItemAt(size_t idx, T) -+ if(isIntegral!T || is(T: dchar)) -+{ -+ size_t impl(in T[] arr){ return arr[idx]; } -+ alias useItemAt = assumeSize!(impl, 8*T.sizeof); -+} -+ -+template useLastItem(T) -+{ -+ size_t impl(in T[] arr){ return arr[$-1]; } -+ alias useLastItem = assumeSize!(impl, 8*T.sizeof); -+} -+ -+template fullBitSize(Prefix...) -+{ -+ static if(Prefix.length > 0) -+ enum fullBitSize = bitSizeOf!(Prefix[0])+fullBitSize!(Prefix[1..$]); -+ else -+ enum fullBitSize = 0; -+} -+ -+template idxTypes(Key, size_t fullBits, Prefix...) -+{ -+ static if(Prefix.length == 1) -+ {// the last level is value level, so no index once reduced to 1-level -+ alias TypeTuple!() idxTypes; -+ } -+ else -+ { -+ // Important note on bit packing -+ // Each level has to hold enough of bits to address the next one -+ // The bottom level is known to hold full bit width -+ // thus it's size in pages is full_bit_width - size_of_last_prefix -+ // Recourse on this notion -+ alias TypeTuple!( -+ idxTypes!(Key, fullBits - bitSizeOf!(Prefix[$-1]), Prefix[0..$-1]), -+ BitPacked!(typeof(Prefix[$-2](Key.init)), fullBits - bitSizeOf!(Prefix[$-1])) -+ ) idxTypes; -+ } -+} -+ -+//============================================================================ -+ -+@trusted int comparePropertyName(Char1, Char2)(const(Char1)[] a, const(Char2)[] b) -+{ -+ alias low = std.ascii.toLower; -+ return cmp( -+ a.map!(x => low(x))() -+ .filter!(x => !isWhite(x) && x != '-' && x != '_')(), -+ b.map!(x => low(x))() -+ .filter!(x => !isWhite(x) && x != '-' && x != '_')() -+ ); -+} -+ -+bool propertyNameLess(Char1, Char2)(const(Char1)[] a, const(Char2)[] b) -+{ -+ return comparePropertyName(a, b) < 0; -+} -+ -+//============================================================================ -+// Utilities for compression of Unicode code point sets -+//============================================================================ -+ -+@safe void compressTo(uint val, ref ubyte[] arr) pure nothrow -+{ -+ // not optimized as usually done 1 time (and not public interface) -+ if(val < 128) -+ arr ~= cast(ubyte)val; -+ else if(val < (1<<13)) -+ { -+ arr ~= (0b1_00<<5) | cast(ubyte)(val>>8); -+ arr ~= val & 0xFF; -+ } -+ else -+ { -+ assert(val < (1<<21)); -+ arr ~= (0b1_01<<5) | cast(ubyte)(val>>16); -+ arr ~= (val >> 8) & 0xFF; -+ arr ~= val & 0xFF; -+ } -+} -+ -+@safe uint decompressFrom(const(ubyte)[] arr, ref size_t idx) pure -+{ -+ uint first = arr[idx++]; -+ if(!(first & 0x80)) // no top bit -> [0..127] -+ return first; -+ uint extra = ((first>>5) & 1) + 1; // [1, 2] -+ uint val = (first & 0x1F); -+ enforce(idx + extra <= arr.length, "bad code point interval encoding"); -+ foreach(j; 0..extra) -+ val = (val<<8) | arr[idx+j]; -+ idx += extra; -+ return val; -+} -+ -+ -+package ubyte[] compressIntervals(Range)(Range intervals) -+ if(isInputRange!Range && isIntegralPair!(ElementType!Range)) -+{ -+ ubyte[] storage; -+ uint base = 0; -+ // RLE encode -+ foreach(val; intervals) -+ { -+ compressTo(val[0]-base, storage); -+ base = val[0]; -+ if(val[1] != lastDchar+1) // till the end of the domain so don't store it -+ { -+ compressTo(val[1]-base, storage); -+ base = val[1]; -+ } -+ } -+ return storage; -+} -+ -+unittest -+{ -+ auto run = [tuple(80, 127), tuple(128, (1<<10)+128)]; -+ ubyte[] enc = [cast(ubyte)80, 47, 1, (0b1_00<<5) | (1<<2), 0]; -+ assert(compressIntervals(run) == enc); -+ auto run2 = [tuple(0, (1<<20)+512+1), tuple((1<<20)+512+4, lastDchar+1)]; -+ ubyte[] enc2 = [cast(ubyte)0, (0b1_01<<5) | (1<<4), 2, 1, 3]; // odd length-ed -+ assert(compressIntervals(run2) == enc2); -+ size_t idx = 0; -+ assert(decompressFrom(enc, idx) == 80); -+ assert(decompressFrom(enc, idx) == 47); -+ assert(decompressFrom(enc, idx) == 1); -+ assert(decompressFrom(enc, idx) == (1<<10)); -+ idx = 0; -+ assert(decompressFrom(enc2, idx) == 0); -+ assert(decompressFrom(enc2, idx) == (1<<20)+512+1); -+ assert(equalS(decompressIntervals(compressIntervals(run)), run)); -+ assert(equalS(decompressIntervals(compressIntervals(run2)), run2)); -+} -+ -+// Creates a range of $(D CodepointInterval) that lazily decodes compressed data. -+@safe package auto decompressIntervals(const(ubyte)[] data) -+{ -+ return DecompressedIntervals(data); -+} -+ -+@trusted struct DecompressedIntervals -+{ -+ const(ubyte)[] _stream; -+ size_t _idx; -+ CodepointInterval _front; -+ -+ this(const(ubyte)[] stream) -+ { -+ _stream = stream; -+ popFront(); -+ } -+ -+ @property CodepointInterval front() -+ { -+ assert(!empty); -+ return _front; -+ } -+ -+ void popFront() -+ { -+ if(_idx == _stream.length) -+ { -+ _idx = size_t.max; -+ return; -+ } -+ uint base = _front[1]; -+ _front[0] = base + decompressFrom(_stream, _idx); -+ if(_idx == _stream.length)// odd length ---> till the end -+ _front[1] = lastDchar+1; -+ else -+ { -+ base = _front[0]; -+ _front[1] = base + decompressFrom(_stream, _idx); -+ } -+ } -+ -+ @property bool empty() const -+ { -+ return _idx == size_t.max; -+ } -+ -+ @property DecompressedIntervals save() { return this; } -+} -+ -+static assert(isInputRange!DecompressedIntervals); -+static assert(isForwardRange!DecompressedIntervals); -+//============================================================================ -+ -+version(std_uni_bootstrap){} -+else -+{ -+ -+// helper for looking up code point sets -+@trusted ptrdiff_t findUnicodeSet(alias table, C)(in C[] name) -+{ -+ auto range = assumeSorted!((a,b) => propertyNameLess(a,b)) -+ (table.map!"a.name"()); -+ size_t idx = range.lowerBound(name).length; -+ if(idx < range.length && comparePropertyName(range[idx], name) == 0) -+ return idx; -+ return -1; -+} -+ -+// another one that loads it -+@trusted bool loadUnicodeSet(alias table, Set, C)(in C[] name, ref Set dest) -+{ -+ auto idx = findUnicodeSet!table(name); -+ if(idx >= 0) -+ { -+ dest = Set(asSet(table[idx].compressed)); -+ return true; -+ } -+ return false; -+} -+ -+@trusted bool loadProperty(Set=CodepointSet, C) -+ (in C[] name, ref Set target) -+{ -+ alias comparePropertyName ucmp; -+ // conjure cumulative properties by hand -+ if(ucmp(name, "L") == 0 || ucmp(name, "Letter") == 0) -+ { -+ target |= asSet(uniProps.Lu); -+ target |= asSet(uniProps.Ll); -+ target |= asSet(uniProps.Lt); -+ target |= asSet(uniProps.Lo); -+ target |= asSet(uniProps.Lm); -+ } -+ else if(ucmp(name,"LC") == 0 || ucmp(name,"Cased Letter")==0) -+ { -+ target |= asSet(uniProps.Ll); -+ target |= asSet(uniProps.Lu); -+ target |= asSet(uniProps.Lt);// Title case -+ } -+ else if(ucmp(name, "M") == 0 || ucmp(name, "Mark") == 0) -+ { -+ target |= asSet(uniProps.Mn); -+ target |= asSet(uniProps.Mc); -+ target |= asSet(uniProps.Me); -+ } -+ else if(ucmp(name, "N") == 0 || ucmp(name, "Number") == 0) -+ { -+ target |= asSet(uniProps.Nd); -+ target |= asSet(uniProps.Nl); -+ target |= asSet(uniProps.No); -+ } -+ else if(ucmp(name, "P") == 0 || ucmp(name, "Punctuation") == 0) -+ { -+ target |= asSet(uniProps.Pc); -+ target |= asSet(uniProps.Pd); -+ target |= asSet(uniProps.Ps); -+ target |= asSet(uniProps.Pe); -+ target |= asSet(uniProps.Pi); -+ target |= asSet(uniProps.Pf); -+ target |= asSet(uniProps.Po); -+ } -+ else if(ucmp(name, "S") == 0 || ucmp(name, "Symbol") == 0) -+ { -+ target |= asSet(uniProps.Sm); -+ target |= asSet(uniProps.Sc); -+ target |= asSet(uniProps.Sk); -+ target |= asSet(uniProps.So); -+ } -+ else if(ucmp(name, "Z") == 0 || ucmp(name, "Separator") == 0) -+ { -+ target |= asSet(uniProps.Zs); -+ target |= asSet(uniProps.Zl); -+ target |= asSet(uniProps.Zp); -+ } -+ else if(ucmp(name, "C") == 0 || ucmp(name, "Other") == 0) -+ { -+ target |= asSet(uniProps.Co); -+ target |= asSet(uniProps.Lo); -+ target |= asSet(uniProps.No); -+ target |= asSet(uniProps.So); -+ target |= asSet(uniProps.Po); -+ } -+ else if(ucmp(name, "graphical") == 0){ -+ target |= asSet(uniProps.Alphabetic); -+ -+ target |= asSet(uniProps.Mn); -+ target |= asSet(uniProps.Mc); -+ target |= asSet(uniProps.Me); -+ -+ target |= asSet(uniProps.Nd); -+ target |= asSet(uniProps.Nl); -+ target |= asSet(uniProps.No); -+ -+ target |= asSet(uniProps.Pc); -+ target |= asSet(uniProps.Pd); -+ target |= asSet(uniProps.Ps); -+ target |= asSet(uniProps.Pe); -+ target |= asSet(uniProps.Pi); -+ target |= asSet(uniProps.Pf); -+ target |= asSet(uniProps.Po); -+ -+ target |= asSet(uniProps.Zs); -+ -+ target |= asSet(uniProps.Sm); -+ target |= asSet(uniProps.Sc); -+ target |= asSet(uniProps.Sk); -+ target |= asSet(uniProps.So); -+ } -+ else if(ucmp(name, "any") == 0) -+ target = Set(0,0x110000); -+ else if(ucmp(name, "ascii") == 0) -+ target = Set(0,0x80); -+ else -+ return loadUnicodeSet!(uniProps.tab)(name, target); -+ return true; -+} -+ -+// CTFE-only helper for checking property names at compile-time -+@safe bool isPrettyPropertyName(C)(in C[] name) -+{ -+ auto names = [ -+ "L", "Letters", -+ "LC", "Cased Letter", -+ "M", "Mark", -+ "N", "Number", -+ "P", "Punctuation", -+ "S", "Symbol", -+ "Z", "Separator" -+ "Graphical", -+ "any", -+ "ascii" -+ ]; -+ auto x = find!(x => comparePropertyName(x, name) == 0)(names); -+ return !x.empty; -+} -+ -+// ditto, CTFE-only, not optimized -+@safe private static bool findSetName(alias table, C)(in C[] name) -+{ -+ return findUnicodeSet!table(name) >= 0; -+} -+ -+template SetSearcher(alias table, string kind) -+{ -+ /// Run-time checked search. -+ static auto opCall(C)(in C[] name) -+ if(is(C : dchar)) -+ { -+ CodepointSet set; -+ if(loadUnicodeSet!table(name, set)) -+ return set; -+ throw new Exception("No unicode set for "~kind~" by name " -+ ~name.to!string()~" was found."); -+ } -+ /// Compile-time checked search. -+ static @property auto opDispatch(string name)() -+ { -+ static if(findSetName!table(name)) -+ { -+ CodepointSet set; -+ loadUnicodeSet!table(name, set); -+ return set; -+ } -+ else -+ static assert(false, "No unicode set for "~kind~" by name " -+ ~name~" was found."); -+ } -+} -+ -+/** -+ A single entry point to lookup Unicode $(CODEPOINT) sets by name or alias of -+ a block, script or general category. -+ -+ It uses well defined standard rules of property name lookup. -+ This includes fuzzy matching of names, so that -+ 'White_Space', 'white-SpAce' and 'whitespace' are all considered equal -+ and yield the same set of white space $(CHARACTERS). -+*/ -+@safe public struct unicode -+{ -+ /** -+ Performs the lookup of set of $(CODEPOINTS) -+ with compile-time correctness checking. -+ This short-cut version combines 3 searches: -+ across blocks, scripts, and common binary properties. -+ -+ Note that since scripts and blocks overlap the -+ usual trick to disambiguate is used - to get a block use -+ $(D unicode.InBlockName), to search a script -+ use $(D unicode.ScriptName). -+ -+ See also $(LREF block), $(LREF script) -+ and (not included in this search) $(LREF hangulSyllableType). -+ -+ Example: -+ --- -+ auto ascii = unicode.ASCII; -+ assert(ascii['A']); -+ assert(ascii['~']); -+ assert(!ascii['\u00e0']); -+ // matching is case-insensitive -+ assert(ascii == unicode.ascII); -+ assert(!ascii['à']); -+ // underscores, '-' and whitespace in names are ignored too -+ auto latin = unicode.in_latin1_Supplement; -+ assert(latin['à']); -+ assert(!latin['$']); -+ // BTW Latin 1 Supplement is a block, hence "In" prefix -+ assert(latin == unicode("In Latin 1 Supplement")); -+ import std.exception; -+ // run-time look up throws if no such set is found -+ assert(collectException(unicode("InCyrilliac"))); -+ --- -+ */ -+ -+ static @property auto opDispatch(string name)() -+ { -+ static if(findAny(name)) -+ return loadAny(name); -+ else -+ static assert(false, "No unicode set by name "~name~" was found."); -+ } -+ -+ /** -+ The same lookup across blocks, scripts, or binary properties, -+ but performed at run-time. -+ This version is provided for cases where $(D name) -+ is not known beforehand; otherwise compile-time -+ checked $(LREF opDispatch) is typically a better choice. -+ -+ See the $(S_LINK Unicode properties, table of properties) for available -+ sets. -+ */ -+ static auto opCall(C)(in C[] name) -+ if(is(C : dchar)) -+ { -+ return loadAny(name); -+ } -+ -+ /** -+ Narrows down the search for sets of $(CODEPOINTS) to all Unicode blocks. -+ -+ See also $(S_LINK Unicode properties, table of properties). -+ -+ Note: -+ Here block names are unambiguous as no scripts are searched -+ and thus to search use simply $(D unicode.block.BlockName) notation. -+ -+ See $(S_LINK Unicode properties, table of properties) for available sets. -+ -+ Example: -+ --- -+ // use .block for explicitness -+ assert(unicode.block.Greek_and_Coptic == unicode.InGreek_and_Coptic); -+ --- -+ */ -+ struct block -+ { -+ mixin SetSearcher!(blocks.tab, "block"); -+ } -+ -+ /** -+ Narrows down the search for sets of $(CODEPOINTS) to all Unicode scripts. -+ -+ See the $(S_LINK Unicode properties, table of properties) for available -+ sets. -+ -+ Example: -+ --- -+ auto arabicScript = unicode.script.arabic; -+ auto arabicBlock = unicode.block.arabic; -+ // there is an intersection between script and block -+ assert(arabicBlock['']); -+ assert(arabicScript['']); -+ // but they are different -+ assert(arabicBlock != arabicScript); -+ assert(arabicBlock == unicode.inArabic); -+ assert(arabicScript == unicode.arabic); -+ --- -+ */ -+ struct script -+ { -+ mixin SetSearcher!(scripts.tab, "script"); -+ } -+ -+ /** -+ Fetch a set of $(CODEPOINTS) that have the given hangul syllable type. -+ -+ Other non-binary properties (once supported) follow the same -+ notation - $(D unicode.propertyName.propertyValue) for compile-time -+ checked access and $(D unicode.propertyName(propertyValue)) -+ for run-time checked one. -+ -+ See the $(S_LINK Unicode properties, table of properties) for available -+ sets. -+ -+ Example: -+ --- -+ // L here is syllable type not Letter as in unicode.L short-cut -+ auto leadingVowel = unicode.hangulSyllableType("L"); -+ // check that some leading vowels are present -+ foreach(vowel; '\u1110'..'\u115F') -+ assert(leadingVowel[vowel]); -+ assert(leadingVowel == unicode.hangulSyllableType.L); -+ --- -+ */ -+ struct hangulSyllableType -+ { -+ mixin SetSearcher!(hangul.tab, "hangul syllable type"); -+ } -+ -+private: -+ alias ucmp = comparePropertyName; -+ -+ static bool findAny(string name) -+ { -+ return isPrettyPropertyName(name) -+ || findSetName!(uniProps.tab)(name) || findSetName!(scripts.tab)(name) -+ || (ucmp(name[0..2],"In") == 0 && findSetName!(blocks.tab)(name[2..$])); -+ } -+ -+ static auto loadAny(Set=CodepointSet, C)(in C[] name) -+ { -+ Set set; -+ bool loaded = loadProperty(name, set) || loadUnicodeSet!(scripts.tab)(name, set) -+ || (ucmp(name[0..2],"In") == 0 -+ && loadUnicodeSet!(blocks.tab)(name[2..$], set)); -+ if(loaded) -+ return set; -+ throw new Exception("No unicode set by name "~name.to!string()~" was found."); -+ } -+ -+ // FIXME: re-disable once the compiler is fixed -+ // Disabled to prevent the mistake of creating instances of this pseudo-struct. -+ //@disable ~this(); -+} -+ -+unittest -+{ -+ auto ascii = unicode.ASCII; -+ assert(ascii['A']); -+ assert(ascii['~']); -+ assert(!ascii['\u00e0']); -+ // matching is case-insensitive -+ assert(ascii == unicode.ascII); -+ assert(!ascii['à']); -+ // underscores, '-' and whitespace in names are ignored too -+ auto latin = unicode.Inlatin1_Supplement; -+ assert(latin['à']); -+ assert(!latin['$']); -+ // BTW Latin 1 Supplement is a block, hence "In" prefix -+ assert(latin == unicode("In Latin 1 Supplement")); -+ import std.exception; -+ // R-T look up throws if no such set is found -+ assert(collectException(unicode("InCyrilliac"))); -+ -+ assert(unicode.block.Greek_and_Coptic == unicode.InGreek_and_Coptic); -+ -+ // L here is explicitly syllable type not "Letter" as in unicode.L -+ auto leadingVowel = unicode.hangulSyllableType("L"); -+ // check that some leading vowels are present -+ foreach(vowel; '\u1110'..'\u115F'+1) -+ assert(leadingVowel[vowel]); -+ assert(leadingVowel == unicode.hangulSyllableType.L); -+ -+ auto arabicScript = unicode.script.arabic; -+ auto arabicBlock = unicode.block.arabic; -+ // there is an intersection between script and block -+ assert(arabicBlock['']); -+ assert(arabicScript['']); -+ // but they are different -+ assert(arabicBlock != arabicScript); -+ assert(arabicBlock == unicode.inArabic); -+ assert(arabicScript == unicode.arabic); -+} -+ -+unittest -+{ -+ assert(unicode("InHebrew") == asSet(blocks.Hebrew)); -+ assert(unicode("separator") == (asSet(uniProps.Zs) | asSet(uniProps.Zl) | asSet(uniProps.Zp))); -+ assert(unicode("In-Kharoshthi") == asSet(blocks.Kharoshthi)); -+} -+ -+enum EMPTY_CASE_TRIE = ushort.max;// from what gen_uni uses internally -+ -+// control - '\r' -+enum controlSwitch = ` -+ case '\u0000':..case '\u0008':case '\u000E':..case '\u001F':case '\u007F':..case '\u0084':case '\u0086':..case '\u009F': case '\u0009':..case '\u000C': case '\u0085': -+`; -+// TODO: redo the most of hangul stuff algorithmically in case of Graphemes too -+// kill unrolled switches -+ -+private static bool isRegionalIndicator(dchar ch) -+{ -+ return ch >= '\U0001F1E6' && ch <= '\U0001F1FF'; -+} -+ -+template genericDecodeGrapheme(bool getValue) -+{ -+ alias graphemeExtend = graphemeExtendTrie; -+ alias spacingMark = mcTrie; -+ static if(getValue) -+ alias Grapheme Value; -+ else -+ alias void Value; -+ -+ Value genericDecodeGrapheme(Input)(ref Input range) -+ { -+ enum GraphemeState { -+ Start, -+ CR, -+ RI, -+ L, -+ V, -+ LVT -+ } -+ static if(getValue) -+ Grapheme grapheme; -+ auto state = GraphemeState.Start; -+ enum eat = q{ -+ static if(getValue) -+ grapheme ~= ch; -+ range.popFront(); -+ }; -+ -+ dchar ch; -+ assert(!range.empty, "Attempting to decode grapheme from an empty " ~ Input.stringof); -+ while(!range.empty) -+ { -+ ch = range.front; -+ final switch(state) with(GraphemeState) -+ { -+ case Start: -+ mixin(eat); -+ if(ch == '\r') -+ state = CR; -+ else if(isRegionalIndicator(ch)) -+ state = RI; -+ else if(isHangL(ch)) -+ state = L; -+ else if(hangLV[ch] || isHangV(ch)) -+ state = V; -+ else if(hangLVT[ch]) -+ state = LVT; -+ else if(isHangT(ch)) -+ state = LVT; -+ else -+ { -+ switch(ch) -+ { -+ mixin(controlSwitch); -+ goto L_End; -+ default: -+ goto L_End_Extend; -+ } -+ } -+ break; -+ case CR: -+ if(ch == '\n') -+ mixin(eat); -+ goto L_End_Extend; -+ case RI: -+ if(isRegionalIndicator(ch)) -+ mixin(eat); -+ else -+ goto L_End_Extend; -+ break; -+ case L: -+ if(isHangL(ch)) -+ mixin(eat); -+ else if(isHangV(ch) || hangLV[ch]) -+ { -+ state = V; -+ mixin(eat); -+ } -+ else if(hangLVT[ch]) -+ { -+ state = LVT; -+ mixin(eat); -+ } -+ else -+ goto L_End_Extend; -+ break; -+ case V: -+ if(isHangV(ch)) -+ mixin(eat); -+ else if(isHangT(ch)) -+ { -+ state = LVT; -+ mixin(eat); -+ } -+ else -+ goto L_End_Extend; -+ break; -+ case LVT: -+ if(isHangT(ch)) -+ { -+ mixin(eat); -+ } -+ else -+ goto L_End_Extend; -+ break; -+ } -+ } -+ L_End_Extend: -+ while(!range.empty) -+ { -+ ch = range.front; -+ // extend & spacing marks -+ if(!graphemeExtend[ch] && !spacingMark[ch]) -+ break; -+ mixin(eat); -+ } -+ L_End: -+ static if(getValue) -+ return grapheme; -+ } -+ -+} -+ -+@trusted: -+public: // Public API continues -+ -+/++ -+ Returns the length of grapheme cluster starting at $(D index). -+ Both the resulting length and the $(D index) are measured -+ in $(S_LINK Code unit, code units). -+ -+ Example: -+ --- -+ // ASCII as usual is 1 code unit, 1 code point etc. -+ assert(graphemeStride(" ", 1) == 1); -+ // A + combing ring above -+ string city = "A\u030Arhus"; -+ size_t first = graphemeStride(city, 0); -+ assert(first == 3); //\u030A has 2 UTF-8 code units -+ assert(city[0..first] == "A\u030A"); -+ assert(city[first..$] == "rhus"); -+ --- -++/ -+size_t graphemeStride(C)(in C[] input, size_t index) -+ if(is(C : dchar)) -+{ -+ auto src = input[index..$]; -+ auto n = src.length; -+ genericDecodeGrapheme!(false)(src); -+ return n - src.length; -+} -+ -+// for now tested separately see test_grapheme.d -+unittest -+{ -+ assert(graphemeStride(" ", 1) == 1); -+ // A + combing ring above -+ string city = "A\u030Arhus"; -+ size_t first = graphemeStride(city, 0); -+ assert(first == 3); //\u030A has 2 UTF-8 code units -+ assert(city[0..first] == "A\u030A"); -+ assert(city[first..$] == "rhus"); -+} -+ -+/++ -+ Reads one full grapheme cluster from an input range of dchar $(D inp). -+ -+ For examples see the $(LREF Grapheme) below. -+ -+ Note: -+ This function modifies $(D inp) and thus $(D inp) -+ must be an L-value. -++/ -+Grapheme decodeGrapheme(Input)(ref Input inp) -+ if(isInputRange!Input && is(Unqual!(ElementType!Input) == dchar)) -+{ -+ return genericDecodeGrapheme!true(inp); -+} -+ -+unittest -+{ -+ Grapheme gr; -+ string s = " \u0020\u0308 "; -+ gr = decodeGrapheme(s); -+ assert(gr.length == 1 && gr[0] == ' '); -+ gr = decodeGrapheme(s); -+ assert(gr.length == 2 && equalS(gr[0..2], " \u0308")); -+ s = "\u0300\u0308\u1100"; -+ assert(equalS(decodeGrapheme(s)[], "\u0300\u0308")); -+ assert(equalS(decodeGrapheme(s)[], "\u1100")); -+ s = "\u11A8\u0308\uAC01"; -+ assert(equalS(decodeGrapheme(s)[], "\u11A8\u0308")); -+ assert(equalS(decodeGrapheme(s)[], "\uAC01")); -+} -+ -+/++ -+ $(P A structure designed to effectively pack $(CHARACTERS) -+ of a $(CLUSTER). -+ ) -+ -+ $(P $(D Grapheme) has value semantics so 2 copies of a $(D Grapheme) -+ always refer to distinct objects. In most actual scenarios a $(D Grapheme) -+ fits on the stack and avoids memory allocation overhead for all but quite -+ long clusters. -+ ) -+ -+ Example: -+ --- -+ import std.algorithm; -+ string bold = "ku\u0308hn"; -+ -+ // note that decodeGrapheme takes parameter by ref -+ // slicing a grapheme yields a range of dchar -+ assert(decodeGrapheme(bold)[].equal("k")); -+ -+ // the next grapheme is 2 characters long -+ auto wideOne = decodeGrapheme(bold); -+ assert(wideOne.length == 2); -+ assert(wideOne[].equal("u\u0308")); -+ -+ // the usual range manipulation is possible -+ assert(wideOne[].filter!isMark.equal("\u0308")); -+ --- -+ $(P See also $(LREF decodeGrapheme), $(LREF graphemeStride). ) -++/ -+@trusted struct Grapheme -+{ -+public: -+ this(C)(in C[] chars...) -+ if(is(C : dchar)) -+ { -+ this ~= chars; -+ } -+ -+ this(Input)(Input seq) -+ if(!isDynamicArray!Input -+ && isInputRange!Input && is(ElementType!Input : dchar)) -+ { -+ this ~= seq; -+ } -+ -+ /// Gets a $(CODEPOINT) at the given index in this cluster. -+ dchar opIndex(size_t index) const pure nothrow -+ { -+ assert(index < length); -+ return read24(isBig ? ptr_ : small_.ptr, index); -+ } -+ -+ /++ -+ Writes a $(CODEPOINT) $(D ch) at given index in this cluster. -+ -+ Warning: -+ Use of this facility may invalidate grapheme cluster, -+ see also $(LREF Grapheme.valid). -+ -+ Example: -+ --- -+ auto g = Grapheme("A\u0302"); -+ assert(g[0] == 'A'); -+ assert(g.valid); -+ g[1] = '~'; // ASCII tilda is not a combining mark -+ assert(g[1] == '~'); -+ assert(!g.valid); -+ --- -+ +/ -+ void opIndexAssign(dchar ch, size_t index) pure nothrow -+ { -+ assert(index < length); -+ write24(isBig ? ptr_ : small_.ptr, ch, index); -+ } -+ -+ /++ -+ Random-access range over Grapheme's $(CHARACTERS). -+ -+ Warning: Invalidates when this Grapheme leaves the scope, -+ attempts to use it then would lead to memory corruption. -+ +/ -+ @system auto opSlice(size_t a, size_t b) pure nothrow -+ { -+ return sliceOverIndexed(a, b, &this); -+ } -+ -+ /// ditto -+ @system auto opSlice() pure nothrow -+ { -+ return sliceOverIndexed(0, length, &this); -+ } -+ -+ /// Grapheme cluster length in $(CODEPOINTS). -+ @property size_t length() const pure nothrow -+ { -+ return isBig ? len_ : slen_ & 0x7F; -+ } -+ -+ /++ -+ Append $(CHARACTER) $(D ch) to this grapheme. -+ Warning: -+ Use of this facility may invalidate grapheme cluster, -+ see also $(D valid). -+ -+ Example: -+ --- -+ auto g = Grapheme("A"); -+ assert(g.valid); -+ g ~= '\u0301'; -+ assert(g[].equal("A\u0301")); -+ assert(g.valid); -+ g ~= "B"; -+ // not a valid grapheme cluster anymore -+ assert(!g.valid); -+ // still could be useful though -+ assert(g[].equal("A\u0301B")); -+ --- -+ See also $(LREF Grapheme.valid) below. -+ +/ -+ ref opOpAssign(string op)(dchar ch) -+ { -+ static if(op == "~") -+ { -+ if(!isBig) -+ { -+ if(slen_ + 1 > small_cap) -+ convertToBig();// & fallthrough to "big" branch -+ else -+ { -+ write24(small_.ptr, ch, smallLength); -+ slen_++; -+ return this; -+ } -+ } -+ -+ assert(isBig); -+ if(len_ + 1 > cap_) -+ { -+ cap_ += grow; -+ ptr_ = cast(ubyte*)enforce(realloc(ptr_, 3*(cap_+1))); -+ } -+ write24(ptr_, ch, len_++); -+ return this; -+ } -+ else -+ static assert(false, "No operation "~op~" defined for Grapheme"); -+ } -+ -+ /// Append all $(CHARACTERS) from the input range $(D inp) to this Grapheme. -+ ref opOpAssign(string op, Input)(Input inp) -+ if(isInputRange!Input && is(ElementType!Input : dchar)) -+ { -+ static if(op == "~") -+ { -+ foreach(dchar ch; inp) -+ this ~= ch; -+ return this; -+ } -+ else -+ static assert(false, "No operation "~op~" defined for Grapheme"); -+ } -+ -+ /++ -+ True if this object contains valid extended grapheme cluster. -+ Decoding primitives of this module always return a valid $(D Grapheme). -+ -+ Appending to and direct manipulation of grapheme's $(CHARACTERS) may -+ render it no longer valid. Certain applications may chose to use -+ Grapheme as a "small string" of any $(CODEPOINTS) and ignore this property -+ entirely. -+ +/ -+ @property bool valid()() /*const*/ -+ { -+ auto r = this[]; -+ genericDecodeGrapheme!false(r); -+ return r.length == 0; -+ } -+ -+ this(this) -+ { -+ if(isBig) -+ {// dup it -+ auto raw_cap = 3*(cap_+1); -+ auto p = cast(ubyte*)enforce(malloc(raw_cap)); -+ p[0..raw_cap] = ptr_[0..raw_cap]; -+ ptr_ = p; -+ } -+ } -+ -+ ~this() -+ { -+ if(isBig) -+ { -+ free(ptr_); -+ } -+ } -+ -+ -+private: -+ enum small_bytes = ((ubyte*).sizeof+3*size_t.sizeof-1); -+ // "out of the blue" grow rate, needs testing -+ // (though graphemes are typically small < 9) -+ enum grow = 20; -+ enum small_cap = small_bytes/3; -+ enum small_flag = 0x80, small_mask = 0x7F; -+ // 16 bytes in 32bits, should be enough for the majority of cases -+ union -+ { -+ struct -+ { -+ ubyte* ptr_; -+ size_t cap_; -+ size_t len_; -+ size_t padding_; -+ } -+ struct -+ { -+ ubyte[small_bytes] small_; -+ ubyte slen_; -+ } -+ } -+ -+ void convertToBig() -+ { -+ size_t k = smallLength; -+ ubyte* p = cast(ubyte*)enforce(malloc(3*(grow+1))); -+ for(int i=0; i<k; i++) -+ write24(p, read24(small_.ptr, i), i); -+ // now we can overwrite small array data -+ ptr_ = p; -+ len_ = slen_; -+ assert(grow > len_); -+ cap_ = grow; -+ setBig(); -+ } -+ -+ void setBig(){ slen_ |= small_flag; } -+ -+ @property size_t smallLength() pure nothrow -+ { -+ return slen_ & small_mask; -+ } -+ @property ubyte isBig() const pure nothrow -+ { -+ return slen_ & small_flag; -+ } -+} -+ -+static assert(Grapheme.sizeof == size_t.sizeof*4); -+ -+// verify the example -+unittest -+{ -+ import std.algorithm; -+ string bold = "ku\u0308hn"; -+ -+ // note that decodeGrapheme takes parameter by ref -+ auto first = decodeGrapheme(bold); -+ -+ assert(first.length == 1); -+ assert(first[0] == 'k'); -+ -+ // the next grapheme is 2 characters long -+ auto wideOne = decodeGrapheme(bold); -+ // slicing a grapheme yields a random-access range of dchar -+ assert(wideOne[].equalS("u\u0308")); -+ assert(wideOne.length == 2); -+ static assert(isRandomAccessRange!(typeof(wideOne[]))); -+ -+ // all of the usual range manipulation is possible -+ assert(wideOne[].filter!isMark().equalS("\u0308")); -+ -+ auto g = Grapheme("A"); -+ assert(g.valid); -+ g ~= '\u0301'; -+ assert(g[].equalS("A\u0301")); -+ assert(g.valid); -+ g ~= "B"; -+ // not a valid grapheme cluster anymore -+ assert(!g.valid); -+ // still could be useful though -+ assert(g[].equalS("A\u0301B")); -+} -+ -+unittest -+{ -+ auto g = Grapheme("A\u0302"); -+ assert(g[0] == 'A'); -+ assert(g.valid); -+ g[1] = '~'; // ASCII tilda is not a combining mark -+ assert(g[1] == '~'); -+ assert(!g.valid); -+} -+ -+unittest -+{ -+ // not valid clusters (but it just a test) -+ auto g = Grapheme('a', 'b', 'c', 'd', 'e'); -+ assert(g[0] == 'a'); -+ assert(g[1] == 'b'); -+ assert(g[2] == 'c'); -+ assert(g[3] == 'd'); -+ assert(g[4] == 'e'); -+ g[3] = 'Й'; -+ assert(g[2] == 'c'); -+ assert(g[3] == 'Й', text(g[3], " vs ", 'Й')); -+ assert(g[4] == 'e'); -+ assert(!g.valid); -+ -+ g ~= 'ц'; -+ g ~= '~'; -+ assert(g[0] == 'a'); -+ assert(g[1] == 'b'); -+ assert(g[2] == 'c'); -+ assert(g[3] == 'Й'); -+ assert(g[4] == 'e'); -+ assert(g[5] == 'ц'); -+ assert(g[6] == '~'); -+ assert(!g.valid); -+ -+ Grapheme copy = g; -+ copy[0] = 'X'; -+ copy[1] = '-'; -+ assert(g[0] == 'a' && copy[0] == 'X'); -+ assert(g[1] == 'b' && copy[1] == '-'); -+ assert(equalS(g[2..g.length], copy[2..copy.length])); -+ copy = Grapheme("АБВГДЕЁЖЗИКЛМ"); -+ assert(equalS(copy[0..8], "АБВГДЕЁЖ"), text(copy[0..8])); -+ copy ~= "xyz"; -+ assert(equalS(copy[13..15], "xy"), text(copy[13..15])); -+ assert(!copy.valid); -+ -+ Grapheme h; -+ foreach(dchar v; iota(cast(int)'A', cast(int)'Z'+1).map!"cast(dchar)a"()) -+ h ~= v; -+ assert(equalS(h[], iota(cast(int)'A', cast(int)'Z'+1))); -+} -+ -+/++ -+ $(P Does basic case-insensitive comparison of strings $(D str1) and $(D str2). -+ This function uses simpler comparison rule thus achieving better performance -+ then $(LREF icmp). However keep in mind the warning below.) -+ -+ Warning: -+ This function only handles 1:1 $(CODEPOINT) mapping -+ and thus is not sufficient for certain alphabets -+ like German, Greek and few others. -+ -+ Example: -+ --- -+ assert(sicmp("Август", "авгусТ") == 0); -+ // Greek also works as long as there is no 1:M mapping in sight -+ assert(sicmp("ΌΎ", "όύ") == 0); -+ // things like the following won't get matched as equal -+ // Greek small letter iota with dialytika and tonos -+ assert(sicmp("ΐ", "\u03B9\u0308\u0301") != 0); -+ -+ // while icmp has no problem with that -+ assert(icmp("ΐ", "\u03B9\u0308\u0301") == 0); -+ assert(icmp("ΌΎ", "όύ") == 0); -+ --- -++/ -+int sicmp(S1, S2)(S1 str1, S2 str2) -+ if(isForwardRange!S1 && is(Unqual!(ElementType!S1) == dchar) -+ && isForwardRange!S2 && is(Unqual!(ElementType!S2) == dchar)) -+{ -+ alias sTable = simpleCaseTable; -+ size_t ridx=0; -+ foreach(dchar lhs; str1) -+ { -+ if(ridx == str2.length) -+ return 1; -+ dchar rhs = std.utf.decode(str2, ridx); -+ int diff = lhs - rhs; -+ if(!diff) -+ continue; -+ size_t idx = simpleCaseTrie[lhs]; -+ size_t idx2 = simpleCaseTrie[rhs]; -+ // simpleCaseTrie is packed index table -+ if(idx != EMPTY_CASE_TRIE) -+ { -+ if(idx2 != EMPTY_CASE_TRIE) -+ {// both cased chars -+ // adjust idx --> start of bucket -+ idx = idx - sTable[idx].n; -+ idx2 = idx2 - sTable[idx2].n; -+ if(idx == idx2)// one bucket, equivalent chars -+ continue; -+ else// not the same bucket -+ diff = sTable[idx].ch - sTable[idx2].ch; -+ } -+ else -+ diff = sTable[idx - sTable[idx].n].ch - rhs; -+ } -+ else if(idx2 != EMPTY_CASE_TRIE) -+ { -+ diff = lhs - sTable[idx2 - sTable[idx2].n].ch; -+ } -+ // one of chars is not cased at all -+ return diff; -+ } -+ return ridx == str2.length ? 0 : -1; -+} -+// overloads for the most common cases to reduce compile time -+@safe pure /*TODO nothrow*/ -+{ -+ int sicmp(const(char)[] str1, const(char)[] str2) -+ { return sicmp!(const(char)[], const(char)[])(str1, str2); } -+ int sicmp(const(wchar)[] str1, const(wchar)[] str2) -+ { return sicmp!(const(wchar)[], const(wchar)[])(str1, str2); } -+ int sicmp(const(dchar)[] str1, const(dchar)[] str2) -+ { return sicmp!(const(dchar)[], const(dchar)[])(str1, str2); } -+} -+ -+private int fullCasedCmp(Range)(dchar lhs, dchar rhs, ref Range rtail) -+ @trusted pure /*TODO nothrow*/ -+{ -+ alias fTable = fullCaseTable; -+ size_t idx = fullCaseTrie[lhs]; -+ // fullCaseTrie is packed index table -+ if(idx == EMPTY_CASE_TRIE) -+ return lhs; -+ size_t start = idx - fTable[idx].n; -+ size_t end = fTable[idx].size + start; -+ assert(fTable[start].entry_len == 1); -+ for(idx=start; idx<end; idx++) -+ { -+ auto entryLen = fTable[idx].entry_len; -+ if(entryLen == 1) -+ { -+ if(fTable[idx].seq[0] == rhs) -+ { -+ return 0; -+ } -+ } -+ else -+ {// OK it's a long chunk, like 'ss' for German -+ dstring seq = fTable[idx].seq[0..entryLen]; -+ if(rhs == seq[0] -+ && rtail.skipOver(seq[1..$])) -+ { -+ // note that this path modifies rtail -+ // iff we managed to get there -+ return 0; -+ } -+ } -+ } -+ return fTable[start].seq[0]; // new remapped character for accurate diffs -+} -+ -+/++ -+ $(P Does case insensitive comparison of $(D str1) and $(D str2). -+ Follows the rules of full case-folding mapping. -+ This includes matching as equal german ß with "ss" and -+ other 1:M $(CODEPOINT) mappings unlike $(LREF sicmp). -+ The cost of $(D icmp) being pedantically correct is -+ slightly worse performance. -+ ) -+ -+ Example: -+ --- -+ assert(icmp("Rußland", "Russland") == 0); -+ assert(icmp("ᾩ -> \u1F70\u03B9", "\u1F61\u03B9 -> ᾲ") == 0); -+ --- -++/ -+int icmp(S1, S2)(S1 str1, S2 str2) -+ if(isForwardRange!S1 && is(Unqual!(ElementType!S1) == dchar) -+ && isForwardRange!S2 && is(Unqual!(ElementType!S2) == dchar)) -+{ -+ for(;;) -+ { -+ if(str1.empty) -+ return str2.empty ? 0 : -1; -+ dchar lhs = str1.front; -+ if(str2.empty) -+ return 1; -+ dchar rhs = str2.front; -+ str1.popFront(); -+ str2.popFront(); -+ int diff = lhs - rhs; -+ if(!diff) -+ continue; -+ // first try to match lhs to <rhs,right-tail> sequence -+ int cmpLR = fullCasedCmp(lhs, rhs, str2); -+ if(!cmpLR) -+ continue; -+ // then rhs to <lhs,left-tail> sequence -+ int cmpRL = fullCasedCmp(rhs, lhs, str1); -+ if(!cmpRL) -+ continue; -+ // cmpXX contain remapped codepoints -+ // to obtain stable ordering of icmp -+ diff = cmpLR - cmpRL; -+ return diff; -+ } -+} -+// overloads for the most common cases to reduce compile time -+@safe pure /*TODO nothrow*/ -+{ -+ int icmp(const(char)[] str1, const(char)[] str2) -+ { return icmp!(const(char)[], const(char)[])(str1, str2); } -+ int icmp(const(wchar)[] str1, const(wchar)[] str2) -+ { return icmp!(const(wchar)[], const(wchar)[])(str1, str2); } -+ int icmp(const(dchar)[] str1, const(dchar)[] str2) -+ { return icmp!(const(dchar)[], const(dchar)[])(str1, str2); } -+} -+ -+unittest -+{ -+ assertCTFEable!( -+ { -+ foreach(cfunc; TypeTuple!(icmp, sicmp)) -+ { -+ foreach(S1; TypeTuple!(string, wstring, dstring)) -+ foreach(S2; TypeTuple!(string, wstring, dstring)) -+ { -+ assert(cfunc("".to!S1(), "".to!S2()) == 0); -+ assert(cfunc("A".to!S1(), "".to!S2()) > 0); -+ assert(cfunc("".to!S1(), "0".to!S2()) < 0); -+ assert(cfunc("abc".to!S1(), "abc".to!S2()) == 0); -+ assert(cfunc("abcd".to!S1(), "abc".to!S2()) > 0); -+ assert(cfunc("abc".to!S1(), "abcd".to!S2()) < 0); -+ assert(cfunc("Abc".to!S1(), "aBc".to!S2()) == 0); -+ assert(cfunc("авГуст".to!S1(), "АВгУСТ".to!S2()) == 0); -+ // Check example: -+ assert(cfunc("Август".to!S1(), "авгусТ".to!S2()) == 0); -+ assert(cfunc("ΌΎ".to!S1(), "όύ".to!S2()) == 0); -+ } -+ // check that the order is properly agnostic to the case -+ auto strs = [ "Apple", "ORANGE", "orAcle", "amp", "banana"]; -+ sort!((a,b) => cfunc(a,b) < 0)(strs); -+ assert(strs == ["amp", "Apple", "banana", "orAcle", "ORANGE"]); -+ } -+ assert(icmp("ßb", "ssa") > 0); -+ // Check example: -+ assert(icmp("Russland", "Rußland") == 0); -+ assert(icmp("ᾩ -> \u1F70\u03B9", "\u1F61\u03B9 -> ᾲ") == 0); -+ assert(icmp("ΐ"w, "\u03B9\u0308\u0301") == 0); -+ assert(sicmp("ΐ", "\u03B9\u0308\u0301") != 0); -+ //bugzilla 11057 -+ assert( icmp("K", "L") < 0 ); -+ }); -+} -+ -+/++ -+ $(P Returns the $(S_LINK Combining class, combining class) of $(D ch).) -+ -+ Example: -+ --- -+ // shorten the code -+ alias CC = combiningClass; -+ -+ // combining tilda -+ assert(CC('\u0303') == 230); -+ // combining ring below -+ assert(CC('\u0325') == 220); -+ // the simple consequence is that "tilda" should be -+ // placed after a "ring below" in a sequence -+ --- -++/ -+ubyte combiningClass(dchar ch) -+{ -+ return combiningClassTrie[ch]; -+} -+ -+unittest -+{ -+ foreach(ch; 0..0x80) -+ assert(combiningClass(ch) == 0); -+ assert(combiningClass('\u05BD') == 22); -+ assert(combiningClass('\u0300') == 230); -+ assert(combiningClass('\u0317') == 220); -+ assert(combiningClass('\u1939') == 222); -+} -+ -+/// Unicode character decomposition type. -+enum UnicodeDecomposition { -+ /// Canonical decomposition. The result is canonically equivalent sequence. -+ Canonical, -+ /** -+ Compatibility decomposition. The result is compatibility equivalent sequence. -+ Note: Compatibility decomposition is a $(B lossy) conversion, -+ typically suitable only for fuzzy matching and internal processing. -+ */ -+ Compatibility -+}; -+ -+/** -+ Shorthand aliases for character decomposition type, passed as a -+ template parameter to $(LREF decompose). -+*/ -+enum { -+ Canonical = UnicodeDecomposition.Canonical, -+ Compatibility = UnicodeDecomposition.Compatibility -+}; -+ -+/++ -+ Try to canonically compose 2 $(CHARACTERS). -+ Returns the composed $(CHARACTER) if they do compose and dchar.init otherwise. -+ -+ The assumption is that $(D first) comes before $(D second) in the original text, -+ usually meaning that the first is a starter. -+ -+ Note: Hangul syllables are not covered by this function. -+ See $(D composeJamo) below. -+ -+ Example: -+ --- -+ assert(compose('A','\u0308') == '\u00C4'); -+ assert(compose('A', 'B') == dchar.init); -+ assert(compose('C', '\u0301') == '\u0106'); -+ // note that the starter is the first one -+ // thus the following doesn't compose -+ assert(compose('\u0308', 'A') == dchar.init); -+ --- -++/ -+public dchar compose(dchar first, dchar second) -+{ -+ import std.internal.unicode_comp; -+ size_t packed = compositionJumpTrie[first]; -+ if(packed == ushort.max) -+ return dchar.init; -+ // unpack offset and length -+ size_t idx = packed & composeIdxMask, cnt = packed >> composeCntShift; -+ // TODO: optimize this micro binary search (no more then 4-5 steps) -+ auto r = compositionTable[idx..idx+cnt].map!"a.rhs"().assumeSorted(); -+ auto target = r.lowerBound(second).length; -+ if(target == cnt) -+ return dchar.init; -+ auto entry = compositionTable[idx+target]; -+ if(entry.rhs != second) -+ return dchar.init; -+ return entry.composed; -+} -+ -+/++ -+ Returns a full $(S_LINK Canonical decomposition, Canonical) -+ (by default) or $(S_LINK Compatibility decomposition, Compatibility) -+ decomposition of $(CHARACTER) $(D ch). -+ If no decomposition is available returns a $(LREF Grapheme) -+ with the $(D ch) itself. -+ -+ Note: -+ This function also decomposes hangul syllables -+ as prescribed by the standard. -+ See also $(LREF decomposeHangul) for a restricted version -+ that takes into account only hangul syllables but -+ no other decompositions. -+ -+ Example: -+ --- -+ import std.algorithm; -+ assert(decompose('Ĉ')[].equal("C\u0302")); -+ assert(decompose('D')[].equal("D")); -+ assert(decompose('\uD4DC')[].equal("\u1111\u1171\u11B7")); -+ assert(decompose!Compatibility('¹').equal("1")); -+ --- -++/ -+public Grapheme decompose(UnicodeDecomposition decompType=Canonical)(dchar ch) -+{ -+ import std.internal.unicode_decomp; -+ static if(decompType == Canonical) -+ { -+ alias table = decompCanonTable; -+ alias mapping = canonMappingTrie; -+ } -+ else static if(decompType == Compatibility) -+ { -+ alias table = decompCompatTable; -+ alias mapping = compatMappingTrie; -+ } -+ ushort idx = mapping[ch]; -+ if(!idx) // not found, check hangul arithmetic decomposition -+ return decomposeHangul(ch); -+ auto decomp = table[idx..$].until(0); -+ return Grapheme(decomp); -+} -+ -+unittest -+{ -+ // verify examples -+ assert(compose('A','\u0308') == '\u00C4'); -+ assert(compose('A', 'B') == dchar.init); -+ assert(compose('C', '\u0301') == '\u0106'); -+ // note that the starter is the first one -+ // thus the following doesn't compose -+ assert(compose('\u0308', 'A') == dchar.init); -+ -+ import std.algorithm; -+ assert(decompose('Ĉ')[].equalS("C\u0302")); -+ assert(decompose('D')[].equalS("D")); -+ assert(decompose('\uD4DC')[].equalS("\u1111\u1171\u11B7")); -+ assert(decompose!Compatibility('¹')[].equalS("1")); -+} -+ -+//---------------------------------------------------------------------------- -+// Hangul specific composition/decomposition -+enum jamoSBase = 0xAC00; -+enum jamoLBase = 0x1100; -+enum jamoVBase = 0x1161; -+enum jamoTBase = 0x11A7; -+enum jamoLCount = 19, jamoVCount = 21, jamoTCount = 28; -+enum jamoNCount = jamoVCount * jamoTCount; -+enum jamoSCount = jamoLCount * jamoNCount; -+ -+// Tests if $(D ch) is a Hangul leading consonant jamo. -+bool isJamoL(dchar ch) -+{ -+ // first cmp rejects ~ 1M code points above leading jamo range -+ return ch < jamoLBase+jamoLCount && ch >= jamoLBase; -+} -+ -+// Tests if $(D ch) is a Hangul vowel jamo. -+bool isJamoT(dchar ch) -+{ -+ // first cmp rejects ~ 1M code points above trailing jamo range -+ // Note: ch == jamoTBase doesn't indicate trailing jamo (TIndex must be > 0) -+ return ch < jamoTBase+jamoTCount && ch > jamoTBase; -+} -+ -+// Tests if $(D ch) is a Hangul trailnig consonant jamo. -+bool isJamoV(dchar ch) -+{ -+ // first cmp rejects ~ 1M code points above vowel range -+ return ch < jamoVBase+jamoVCount && ch >= jamoVBase; -+} -+ -+int hangulSyllableIndex(dchar ch) -+{ -+ int idxS = cast(int)ch - jamoSBase; -+ return idxS >= 0 && idxS < jamoSCount ? idxS : -1; -+} -+ -+// internal helper: compose hangul syllables leaving dchar.init in holes -+void hangulRecompose(dchar[] seq) -+{ -+ for(size_t idx = 0; idx + 1 < seq.length; ) -+ { -+ if(isJamoL(seq[idx]) && isJamoV(seq[idx+1])) -+ { -+ int indexL = seq[idx] - jamoLBase; -+ int indexV = seq[idx+1] - jamoVBase; -+ int indexLV = indexL * jamoNCount + indexV * jamoTCount; -+ if(idx + 2 < seq.length && isJamoT(seq[idx+2])) -+ { -+ seq[idx] = jamoSBase + indexLV + seq[idx+2] - jamoTBase; -+ seq[idx+1] = dchar.init; -+ seq[idx+2] = dchar.init; -+ idx += 3; -+ } -+ else -+ { -+ seq[idx] = jamoSBase + indexLV; -+ seq[idx+1] = dchar.init; -+ idx += 2; -+ } -+ } -+ else -+ idx++; -+ } -+} -+ -+//---------------------------------------------------------------------------- -+public: -+ -+/** -+ Decomposes a Hangul syllable. If $(D ch) is not a composed syllable -+ then this function returns $(LREF Grapheme) containing only $(D ch) as is. -+ -+ Example: -+ --- -+ import std.algorithm; -+ assert(decomposeHangul('\uD4DB')[].equal("\u1111\u1171\u11B6")); -+ --- -+*/ -+Grapheme decomposeHangul(dchar ch) -+{ -+ int idxS = cast(int)ch - jamoSBase; -+ if(idxS < 0 || idxS >= jamoSCount) return Grapheme(ch); -+ int idxL = idxS / jamoNCount; -+ int idxV = (idxS % jamoNCount) / jamoTCount; -+ int idxT = idxS % jamoTCount; -+ -+ int partL = jamoLBase + idxL; -+ int partV = jamoVBase + idxV; -+ if(idxT > 0) // there is a trailling consonant (T); <L,V,T> decomposition -+ return Grapheme(partL, partV, jamoTBase + idxT); -+ else // <L, V> decomposition -+ return Grapheme(partL, partV); -+} -+ -+/++ -+ Try to compose hangul syllable out of a leading consonant ($(D lead)), -+ a $(D vowel) and optional $(D trailing) consonant jamos. -+ -+ On success returns the composed LV or LVT hangul syllable. -+ -+ If any of $(D lead) and $(D vowel) are not a valid hangul jamo -+ of the respective $(CHARACTER) class returns dchar.init. -+ -+ Example: -+ --- -+ assert(composeJamo('\u1111', '\u1171', '\u11B6') == '\uD4DB'); -+ // leaving out T-vowel, or passing any codepoint -+ // that is not trailing consonant composes an LV-syllable -+ assert(composeJamo('\u1111', '\u1171') == '\uD4CC'); -+ assert(composeJamo('\u1111', '\u1171', ' ') == '\uD4CC'); -+ assert(composeJamo('\u1111', 'A') == dchar.init); -+ assert(composeJamo('A', '\u1171') == dchar.init); -+ --- -++/ -+dchar composeJamo(dchar lead, dchar vowel, dchar trailing=dchar.init) -+{ -+ if(!isJamoL(lead)) -+ return dchar.init; -+ int indexL = lead - jamoLBase; -+ if(!isJamoV(vowel)) -+ return dchar.init; -+ int indexV = vowel - jamoVBase; -+ int indexLV = indexL * jamoNCount + indexV * jamoTCount; -+ dchar syllable = jamoSBase + indexLV; -+ return isJamoT(trailing) ? syllable + (trailing - jamoTBase) : syllable; -+} -+ -+unittest -+{ -+ static void testDecomp(UnicodeDecomposition T)(dchar ch, string r) -+ { -+ Grapheme g = decompose!T(ch); -+ assert(equalS(g[], r), text(g[], " vs ", r)); -+ } -+ testDecomp!Canonical('\u1FF4', "\u03C9\u0301\u0345"); -+ testDecomp!Canonical('\uF907', "\u9F9C"); -+ testDecomp!Compatibility('\u33FF', "\u0067\u0061\u006C"); -+ testDecomp!Compatibility('\uA7F9', "\u0153"); -+ -+ // check examples -+ assert(decomposeHangul('\uD4DB')[].equalS("\u1111\u1171\u11B6")); -+ assert(composeJamo('\u1111', '\u1171', '\u11B6') == '\uD4DB'); -+ assert(composeJamo('\u1111', '\u1171') == '\uD4CC'); // leave out T-vowel -+ assert(composeJamo('\u1111', '\u1171', ' ') == '\uD4CC'); -+ assert(composeJamo('\u1111', 'A') == dchar.init); -+ assert(composeJamo('A', '\u1171') == dchar.init); -+} -+ -+/** -+ Enumeration type for normalization forms, -+ passed as template parameter for functions like $(LREF normalize). -+*/ -+enum NormalizationForm { -+ NFC, -+ NFD, -+ NFKC, -+ NFKD -+} -+ -+ -+enum { -+ /** -+ Shorthand aliases from values indicating normalization forms. -+ */ -+ NFC = NormalizationForm.NFC, -+ ///ditto -+ NFD = NormalizationForm.NFD, -+ ///ditto -+ NFKC = NormalizationForm.NFKC, -+ ///ditto -+ NFKD = NormalizationForm.NFKD -+}; -+ -+/++ -+ Returns $(D input) string normalized to the chosen form. -+ Form C is used by default. -+ -+ For more information on normalization forms see -+ the $(S_LINK Normalization, normalization section). -+ -+ Note: -+ In cases where the string in question is already normalized, -+ it is returned unmodified and no memory allocation happens. -+ -+ Example: -+ --- -+ // any encoding works -+ wstring greet = "Hello world"; -+ assert(normalize(greet) is greet); // the same exact slice -+ -+ // An example of a character with all 4 forms being different: -+ // Greek upsilon with acute and hook symbol (code point 0x03D3) -+ assert(normalize!NFC("ϓ") == "\u03D3"); -+ assert(normalize!NFD("ϓ") == "\u03D2\u0301"); -+ assert(normalize!NFKC("ϓ") == "\u038E"); -+ assert(normalize!NFKD("ϓ") == "\u03A5\u0301"); -+ --- -++/ -+inout(C)[] normalize(NormalizationForm norm=NFC, C)(inout(C)[] input) -+{ -+ auto anchors = splitNormalized!norm(input); -+ if(anchors[0] == input.length && anchors[1] == input.length) -+ return input; -+ dchar[] decomposed; -+ decomposed.reserve(31); -+ ubyte[] ccc; -+ ccc.reserve(31); -+ auto app = appender!(C[])(); -+ do -+ { -+ app.put(input[0..anchors[0]]); -+ foreach(dchar ch; input[anchors[0]..anchors[1]]) -+ static if(norm == NFD || norm == NFC) -+ { -+ foreach(dchar c; decompose!Canonical(ch)[]) -+ decomposed ~= c; -+ } -+ else // NFKD & NFKC -+ { -+ foreach(dchar c; decompose!Compatibility(ch)[]) -+ decomposed ~= c; -+ } -+ ccc.length = decomposed.length; -+ size_t firstNonStable = 0; -+ ubyte lastClazz = 0; -+ -+ foreach(idx, dchar ch; decomposed) -+ { -+ auto clazz = combiningClass(ch); -+ ccc[idx] = clazz; -+ if(clazz == 0 && lastClazz != 0) -+ { -+ // found a stable code point after unstable ones -+ sort!("a[0] < b[0]", SwapStrategy.stable) -+ (zip(ccc[firstNonStable..idx], decomposed[firstNonStable..idx])); -+ firstNonStable = decomposed.length; -+ } -+ else if(clazz != 0 && lastClazz == 0) -+ { -+ // found first unstable code point after stable ones -+ firstNonStable = idx; -+ } -+ lastClazz = clazz; -+ } -+ sort!("a[0] < b[0]", SwapStrategy.stable) -+ (zip(ccc[firstNonStable..$], decomposed[firstNonStable..$])); -+ static if(norm == NFC || norm == NFKC) -+ { -+ size_t idx = 0; -+ auto first = countUntil(ccc, 0); -+ if(first >= 0) // no starters?? no recomposition -+ { -+ for(;;) -+ { -+ auto second = recompose(first, decomposed, ccc); -+ if(second == decomposed.length) -+ break; -+ first = second; -+ } -+ // 2nd pass for hangul syllables -+ hangulRecompose(decomposed); -+ } -+ } -+ static if(norm == NFD || norm == NFKD) -+ app.put(decomposed); -+ else -+ { -+ auto clean = remove!("a == dchar.init", SwapStrategy.stable)(decomposed); -+ app.put(decomposed[0 .. clean.length]); -+ } -+ // reset variables -+ decomposed.length = 0; -+ decomposed.assumeSafeAppend(); -+ ccc.length = 0; -+ ccc.assumeSafeAppend(); -+ input = input[anchors[1]..$]; -+ // and move on -+ anchors = splitNormalized!norm(input); -+ }while(anchors[0] != input.length); -+ app.put(input[0..anchors[0]]); -+ return cast(inout(C)[])app.data; -+} -+ -+unittest -+{ -+ assert(normalize!NFD("abc\uF904def") == "abc\u6ED1def", text(normalize!NFD("abc\uF904def"))); -+ assert(normalize!NFKD("2¹⁰") == "210", normalize!NFKD("2¹⁰")); -+ assert(normalize!NFD("Äffin") == "A\u0308ffin"); -+ -+ // check example -+ -+ // any encoding works -+ wstring greet = "Hello world"; -+ assert(normalize(greet) is greet); // the same exact slice -+ -+ // An example of a character with all 4 forms being different: -+ // Greek upsilon with acute and hook symbol (code point 0x03D3) -+ assert(normalize!NFC("ϓ") == "\u03D3"); -+ assert(normalize!NFD("ϓ") == "\u03D2\u0301"); -+ assert(normalize!NFKC("ϓ") == "\u038E"); -+ assert(normalize!NFKD("ϓ") == "\u03A5\u0301"); -+} -+ -+// canonically recompose given slice of code points, works in-place and mutates data -+private size_t recompose(size_t start, dchar[] input, ubyte[] ccc) -+{ -+ assert(input.length == ccc.length); -+ int accumCC = -1;// so that it's out of 0..255 range -+ bool foundSolidStarter = false; -+ // writefln("recomposing %( %04x %)", input); -+ // first one is always a starter thus we start at i == 1 -+ size_t i = start+1; -+ for(; ; ) -+ { -+ if(i == input.length) -+ break; -+ int curCC = ccc[i]; -+ // In any character sequence beginning with a starter S -+ // a character C is blocked from S if and only if there -+ // is some character B between S and C, and either B -+ // is a starter or it has the same or higher combining class as C. -+ //------------------------ -+ // Applying to our case: -+ // S is input[0] -+ // accumCC is the maximum CCC of characters between C and S, -+ // as ccc are sorted -+ // C is input[i] -+ -+ if(curCC > accumCC) -+ { -+ dchar comp = compose(input[start], input[i]); -+ if(comp != dchar.init) -+ { -+ input[start] = comp; -+ input[i] = dchar.init;// put a sentinel -+ // current was merged so its CCC shouldn't affect -+ // composing with the next one -+ } -+ else { -+ // if it was a starter then accumCC is now 0, end of loop -+ accumCC = curCC; -+ if(accumCC == 0) -+ break; -+ } -+ } -+ else{ -+ // ditto here -+ accumCC = curCC; -+ if(accumCC == 0) -+ break; -+ } -+ i++; -+ } -+ return i; -+} -+ -+// returns tuple of 2 indexes that delimit: -+// normalized text, piece that needs normalization and -+// the rest of input starting with stable code point -+private auto splitNormalized(NormalizationForm norm, C)(const(C)[] input) -+{ -+ auto result = input; -+ ubyte lastCC = 0; -+ -+ foreach(idx, dchar ch; input) -+ { -+ static if(norm == NFC) -+ if(ch < 0x0300) -+ { -+ lastCC = 0; -+ continue; -+ } -+ ubyte CC = combiningClass(ch); -+ if(lastCC > CC && CC != 0) -+ { -+ return seekStable!norm(idx, input); -+ } -+ -+ if(notAllowedIn!norm(ch)) -+ { -+ return seekStable!norm(idx, input); -+ } -+ lastCC = CC; -+ } -+ return tuple(input.length, input.length); -+} -+ -+private auto seekStable(NormalizationForm norm, C)(size_t idx, in C[] input) -+{ -+ auto br = input[0..idx]; -+ size_t region_start = 0;// default -+ for(;;) -+ { -+ if(br.empty)// start is 0 -+ break; -+ dchar ch = br.back; -+ if(combiningClass(ch) == 0 && allowedIn!norm(ch)) -+ { -+ region_start = br.length - std.utf.codeLength!C(ch); -+ break; -+ } -+ br.popFront(); -+ } -+ ///@@@BUG@@@ can't use find: " find is a nested function and can't be used..." -+ size_t region_end=input.length;// end is $ by default -+ foreach(i, dchar ch; input[idx..$]) -+ { -+ if(combiningClass(ch) == 0 && allowedIn!norm(ch)) -+ { -+ region_end = i+idx; -+ break; -+ } -+ } -+ // writeln("Region to normalize: ", input[region_start..region_end]); -+ return tuple(region_start, region_end); -+} -+ -+/** -+ Tests if dchar $(D ch) is always allowed (Quick_Check=YES) in normalization -+ form $(D norm). -+ --- -+ // e.g. Cyrillic is always allowed, so is ASCII -+ assert(allowedIn!NFC('я')); -+ assert(allowedIn!NFD('я')); -+ assert(allowedIn!NFKC('я')); -+ assert(allowedIn!NFKD('я')); -+ assert(allowedIn!NFC('Z')); -+ --- -+*/ -+public bool allowedIn(NormalizationForm norm)(dchar ch) -+{ -+ return !notAllowedIn!norm(ch); -+} -+ -+// not user friendly name but more direct -+private bool notAllowedIn(NormalizationForm norm)(dchar ch) -+{ -+ static if(norm == NFC) -+ alias qcTrie = nfcQCTrie; -+ else static if(norm == NFD) -+ alias qcTrie = nfdQCTrie; -+ else static if(norm == NFKC) -+ alias qcTrie = nfkcQCTrie; -+ else static if(norm == NFKD) -+ alias qcTrie = nfkdQCTrie; -+ else -+ static assert("Unknown normalization form "~norm); -+ return qcTrie[ch]; -+} -+ -+unittest -+{ -+ assert(allowedIn!NFC('я')); -+ assert(allowedIn!NFD('я')); -+ assert(allowedIn!NFKC('я')); -+ assert(allowedIn!NFKD('я')); -+ assert(allowedIn!NFC('Z')); -+} -+ -+} -+ -+version(std_uni_bootstrap) -+{ -+ // old version used for bootstrapping of gen_uni.d that generates -+ // up to date optimal versions of all of isXXX functions -+ @safe pure nothrow public bool isWhite(dchar c) -+ { -+ return std.ascii.isWhite(c) || -+ c == lineSep || c == paraSep || -+ c == '\u0085' || c == '\u00A0' || c == '\u1680' || c == '\u180E' || -+ (c >= '\u2000' && c <= '\u200A') || -+ c == '\u202F' || c == '\u205F' || c == '\u3000'; -+ } -+} -+else -+{ -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+ushort toLowerIndex(dchar c) -+{ -+ alias trie = toLowerIndexTrie; -+ return trie[c]; -+} -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+dchar toLowerTab(size_t idx) -+{ -+ return toLowerTable[idx]; -+} -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+ushort toTitleIndex(dchar c) -+{ -+ alias trie = toTitleIndexTrie; -+ return trie[c]; -+} -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+dchar toTitleTab(size_t idx) -+{ -+ return toTitleTable[idx]; -+} -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+ushort toUpperIndex(dchar c) -+{ -+ alias trie = toUpperIndexTrie; -+ return trie[c]; -+} -+ -+// trusted -> avoid bounds check -+@trusted pure nothrow -+dchar toUpperTab(size_t idx) -+{ -+ return toUpperTable[idx]; -+} -+ -+public: -+ -+/++ -+ Whether or not $(D c) is a Unicode whitespace $(CHARACTER). -+ (general Unicode category: Part of C0(tab, vertical tab, form feed, -+ carriage return, and linefeed characters), Zs, Zl, Zp, and NEL(U+0085)) -++/ -+@safe pure nothrow -+public bool isWhite(dchar c) -+{ -+ return isWhiteGen(c); // call pregenerated binary search -+} -+ -+deprecated ("Please use std.uni.isLower instead") -+bool isUniLower(dchar c) @safe pure nothrow -+{ -+ return isLower(c); -+} -+ -+/++ -+ Return whether $(D c) is a Unicode lowercase $(CHARACTER). -++/ -+@safe pure nothrow -+bool isLower(dchar c) -+{ -+ if(std.ascii.isASCII(c)) -+ return std.ascii.isLower(c); -+ return lowerCaseTrie[c]; -+} -+ -+@safe unittest -+{ -+ foreach(v; 0..0x80) -+ assert(std.ascii.isLower(v) == isLower(v)); -+ assert(isLower('я')); -+ assert(isLower('й')); -+ assert(!isLower('Ж')); -+ // Greek HETA -+ assert(!isLower('\u0370')); -+ assert(isLower('\u0371')); -+ assert(!isLower('\u039C')); // capital MU -+ assert(isLower('\u03B2')); // beta -+ // from extended Greek -+ assert(!isLower('\u1F18')); -+ assert(isLower('\u1F00')); -+ foreach(v; unicode.lowerCase.byCodepoint) -+ assert(isLower(v) && !isUpper(v)); -+} -+ -+ -+deprecated ("Please use std.uni.isUpper instead") -+@safe pure nothrow -+bool isUniUpper(dchar c) -+{ -+ return isUpper(c); -+} -+ -+/++ -+ Return whether $(D c) is a Unicode uppercase $(CHARACTER). -++/ -+@safe pure nothrow -+bool isUpper(dchar c) -+{ -+ if(std.ascii.isASCII(c)) -+ return std.ascii.isUpper(c); -+ return upperCaseTrie[c]; -+} -+ -+@safe unittest -+{ -+ foreach(v; 0..0x80) -+ assert(std.ascii.isLower(v) == isLower(v)); -+ assert(!isUpper('й')); -+ assert(isUpper('Ж')); -+ // Greek HETA -+ assert(isUpper('\u0370')); -+ assert(!isUpper('\u0371')); -+ assert(isUpper('\u039C')); // capital MU -+ assert(!isUpper('\u03B2')); // beta -+ // from extended Greek -+ assert(!isUpper('\u1F00')); -+ assert(isUpper('\u1F18')); -+ foreach(v; unicode.upperCase.byCodepoint) -+ assert(isUpper(v) && !isLower(v)); -+} -+ -+ -+deprecated ("Please use std.uni.toLower instead") -+@safe pure nothrow -+dchar toUniLower(dchar c) -+{ -+ return toLower(c); -+} -+ -+ -+/++ -+ If $(D c) is a Unicode uppercase $(CHARACTER), then its lowercase equivalent -+ is returned. Otherwise $(D c) is returned. -+ -+ Warning: certain alphabets like German and Greek have no 1:1 -+ upper-lower mapping. Use overload of toLower which takes full string instead. -++/ -+@safe pure nothrow -+dchar toLower(dchar c) -+{ -+ // optimize ASCII case -+ if(c < 0xAA) -+ { -+ if(c < 'A') -+ return c; -+ if(c <= 'Z') -+ return c + 32; -+ return c; -+ } -+ size_t idx = toLowerIndex(c); -+ if(idx < MAX_SIMPLE_LOWER) -+ { -+ return toLowerTab(idx); -+ } -+ return c; -+} -+ -+//TODO: Hidden for now, needs better API. -+//Other transforms could use better API as well, but this one is a new primitive. -+@safe pure nothrow -+private dchar toTitlecase(dchar c) -+{ -+ // optimize ASCII case -+ if(c < 0xAA) -+ { -+ if(c < 'a') -+ return c; -+ if(c <= 'z') -+ return c - 32; -+ return c; -+ } -+ size_t idx = toTitleIndex(c); -+ if(idx < MAX_SIMPLE_TITLE) -+ { -+ return toTitleTab(idx); -+ } -+ return c; -+} -+ -+private alias UpperTriple = TypeTuple!(toUpperIndex, MAX_SIMPLE_UPPER, toUpperTab); -+private alias LowerTriple = TypeTuple!(toLowerIndex, MAX_SIMPLE_LOWER, toLowerTab); -+ -+// generic toUpper/toLower on whole string, creates new or returns as is -+private S toCase(alias indexFn, uint maxIdx, alias tableFn, S)(S s) @trusted pure -+ if(isSomeString!S) -+{ -+ foreach(i, dchar cOuter; s) -+ { -+ ushort idx = indexFn(cOuter); -+ if(idx == ushort.max) -+ continue; -+ auto result = s[0 .. i].dup; -+ foreach(dchar c; s[i .. $]) -+ { -+ idx = indexFn(c); -+ if(idx == ushort.max) -+ result ~= c; -+ else if(idx < maxIdx) -+ { -+ c = tableFn(idx); -+ result ~= c; -+ } -+ else -+ { -+ auto val = tableFn(idx); -+ // unpack length + codepoint -+ uint len = val>>24; -+ result ~= cast(dchar)(val & 0xFF_FFFF); -+ foreach(j; idx+1..idx+len) -+ result ~= tableFn(j); -+ } -+ } -+ return cast(S) result; -+ } -+ return s; -+} -+ -+// TODO: helper, I wish std.utf was more flexible (and stright) -+private size_t encodeTo(char[] buf, size_t idx, dchar c) @trusted pure -+{ -+ if (c <= 0x7F) -+ { -+ buf[idx] = cast(char)c; -+ idx++; -+ } -+ else if (c <= 0x7FF) -+ { -+ buf[idx] = cast(char)(0xC0 | (c >> 6)); -+ buf[idx+1] = cast(char)(0x80 | (c & 0x3F)); -+ idx += 2; -+ } -+ else if (c <= 0xFFFF) -+ { -+ buf[idx] = cast(char)(0xE0 | (c >> 12)); -+ buf[idx+1] = cast(char)(0x80 | ((c >> 6) & 0x3F)); -+ buf[idx+2] = cast(char)(0x80 | (c & 0x3F)); -+ idx += 3; -+ } -+ else if (c <= 0x10FFFF) -+ { -+ buf[idx] = cast(char)(0xF0 | (c >> 18)); -+ buf[idx+1] = cast(char)(0x80 | ((c >> 12) & 0x3F)); -+ buf[idx+2] = cast(char)(0x80 | ((c >> 6) & 0x3F)); -+ buf[idx+3] = cast(char)(0x80 | (c & 0x3F)); -+ idx += 4; -+ } -+ else -+ assert(0); -+ return idx; -+} -+ -+unittest -+{ -+ char[] s = "abcd".dup; -+ size_t i = 0; -+ i = encodeTo(s, i, 'X'); -+ assert(s == "Xbcd"); -+ -+ i = encodeTo(s, i, cast(dchar)'\u00A9'); -+ assert(s == "X\xC2\xA9d"); -+} -+ -+// TODO: helper, I wish std.utf was more flexible (and stright) -+private size_t encodeTo(wchar[] buf, size_t idx, dchar c) @trusted pure -+{ -+ import std.utf; -+ if (c <= 0xFFFF) -+ { -+ if (0xD800 <= c && c <= 0xDFFF) -+ throw (new UTFException("Encoding an isolated surrogate code point in UTF-16")).setSequence(c); -+ buf[idx] = cast(wchar)c; -+ idx++; -+ } -+ else if (c <= 0x10FFFF) -+ { -+ buf[idx] = cast(wchar)((((c - 0x10000) >> 10) & 0x3FF) + 0xD800); -+ buf[idx+1] = cast(wchar)(((c - 0x10000) & 0x3FF) + 0xDC00); -+ idx += 2; -+ } -+ else -+ assert(0); -+ return idx; -+} - -- Trademarks: -- Unicode(tm) is a trademark of Unicode, Inc. -+private size_t encodeTo(dchar[] buf, size_t idx, dchar c) @trusted pure -+{ -+ buf[idx] = c; -+ idx++; -+ return idx; -+} - -- Macros: -- WIKI=Phobos/StdUni -+private void toCaseInPlace(alias indexFn, uint maxIdx, alias tableFn, C)(ref C[] s) @trusted pure -+ if (is(C == char) || is(C == wchar) || is(C == dchar)) -+{ -+ import std.utf; -+ size_t curIdx = 0; -+ size_t destIdx = 0; -+ alias slowToCase = toCaseInPlaceAlloc!(indexFn, maxIdx, tableFn); -+ size_t lastUnchanged = 0; -+ // in-buffer move of bytes to a new start index -+ // the trick is that it may not need to copy at all -+ static size_t moveTo(C[] str, size_t dest, size_t from, size_t to) -+ { -+ // Interestingly we may just bump pointer for a while -+ // then have to copy if a re-cased char was smaller the original -+ // later we may regain pace with char that got bigger -+ // In the end it sometimes flip-flops between the 2 cases below -+ if(dest == from) -+ return to; -+ // got to copy -+ foreach(C c; str[from..to]) -+ str[dest++] = c; -+ return dest; -+ } -+ while(curIdx != s.length) -+ { -+ size_t startIdx = curIdx; -+ dchar ch = decode(s, curIdx); -+ // TODO: special case for ASCII -+ auto caseIndex = indexFn(ch); -+ if(caseIndex == ushort.max) // unchanged, skip over -+ { -+ continue; -+ } -+ else if(caseIndex < maxIdx) // 1:1 codepoint mapping -+ { -+ // previous cased chars had the same length as uncased ones -+ // thus can just adjust pointer -+ destIdx = moveTo(s, destIdx, lastUnchanged, startIdx); -+ lastUnchanged = curIdx; -+ dchar cased = tableFn(caseIndex); -+ auto casedLen = codeLength!C(cased); -+ if(casedLen + destIdx > curIdx) // no place to fit cased char -+ { -+ // switch to slow codepath, where we allocate -+ return slowToCase(s, startIdx, destIdx); -+ } -+ else -+ { -+ destIdx = encodeTo(s, destIdx, cased); -+ } -+ } -+ else // 1:m codepoint mapping, slow codepath -+ { -+ destIdx = moveTo(s, destIdx, lastUnchanged, startIdx); -+ lastUnchanged = curIdx; -+ return slowToCase(s, startIdx, destIdx); -+ } -+ assert(destIdx <= curIdx); -+ } -+ if(lastUnchanged != s.length) -+ { -+ destIdx = moveTo(s, destIdx, lastUnchanged, s.length); -+ } -+ s = s[0..destIdx]; -+} - -- Copyright: Copyright 2000 - -- License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). -- Authors: $(WEB digitalmars.com, Walter Bright), Jonathan M Davis, and Kenji Hara -- Source: $(PHOBOSSRC std/_uni.d) -- +/ --module std.uni; -+// helper to precalculate size of case-converted string -+private template toCaseLength(alias indexFn, uint maxIdx, alias tableFn) -+{ -+ size_t toCaseLength(C)(in C[] str) -+ { -+ import std.utf; -+ size_t codeLen = 0; -+ size_t lastNonTrivial = 0; -+ size_t curIdx = 0; -+ while(curIdx != str.length) -+ { -+ size_t startIdx = curIdx; -+ dchar ch = decode(str, curIdx); -+ ushort caseIndex = indexFn(ch); -+ if(caseIndex == ushort.max) -+ continue; -+ else if(caseIndex < maxIdx) -+ { -+ codeLen += startIdx - lastNonTrivial; -+ lastNonTrivial = curIdx; -+ dchar cased = tableFn(caseIndex); -+ codeLen += codeLength!C(cased); -+ } -+ else -+ { -+ codeLen += startIdx - lastNonTrivial; -+ lastNonTrivial = curIdx; -+ auto val = tableFn(caseIndex); -+ auto len = val>>24; -+ dchar cased = val & 0xFF_FFFF; -+ codeLen += codeLength!C(cased); -+ foreach(j; caseIndex+1..caseIndex+len) -+ codeLen += codeLength!C(tableFn(j)); -+ } -+ } -+ if(lastNonTrivial != str.length) -+ codeLen += str.length - lastNonTrivial; -+ return codeLen; -+ } -+} - --static import std.ascii; -+unittest -+{ -+ import std.conv; -+ alias toLowerLength = toCaseLength!(LowerTriple); -+ assert(toLowerLength("abcd") == 4); -+ assert(toLowerLength("аБВгд456") == 10+3); -+} - --enum dchar lineSep = '\u2028'; /// UTF line separator --enum dchar paraSep = '\u2029'; /// UTF paragraph separator -+// slower code path that preallocates and then copies -+// case-converted stuf to the new string -+private template toCaseInPlaceAlloc(alias indexFn, uint maxIdx, alias tableFn) -+{ -+ void toCaseInPlaceAlloc(C)(ref C[] s, size_t curIdx, -+ size_t destIdx) @trusted pure -+ if (is(C == char) || is(C == wchar) || is(C == dchar)) -+ { -+ import std.utf : decode; -+ alias caseLength = toCaseLength!(indexFn, maxIdx, tableFn); -+ auto trueLength = destIdx + caseLength(s[curIdx..$]); -+ C[] ns = new C[trueLength]; -+ ns[0..destIdx] = s[0..destIdx]; -+ size_t lastUnchanged = curIdx; -+ while(curIdx != s.length) -+ { -+ size_t startIdx = curIdx; // start of current codepoint -+ dchar ch = decode(s, curIdx); -+ auto caseIndex = indexFn(ch); -+ if(caseIndex == ushort.max) // skip over -+ { -+ continue; -+ } -+ else if(caseIndex < maxIdx) // 1:1 codepoint mapping -+ { -+ dchar cased = tableFn(caseIndex); -+ auto toCopy = startIdx - lastUnchanged; -+ ns[destIdx .. destIdx+toCopy] = s[lastUnchanged .. startIdx]; -+ lastUnchanged = curIdx; -+ destIdx += toCopy; -+ destIdx = encodeTo(ns, destIdx, cased); -+ } -+ else // 1:m codepoint mapping, slow codepath -+ { -+ auto toCopy = startIdx - lastUnchanged; -+ ns[destIdx .. destIdx+toCopy] = s[lastUnchanged .. startIdx]; -+ lastUnchanged = curIdx; -+ destIdx += toCopy; -+ auto val = tableFn(caseIndex); -+ // unpack length + codepoint -+ uint len = val>>24; -+ destIdx = encodeTo(ns, destIdx, cast(dchar)(val & 0xFF_FFFF)); -+ foreach(j; caseIndex+1..caseIndex+len) -+ destIdx = encodeTo(ns, destIdx, tableFn(j)); -+ } -+ } -+ if(lastUnchanged != s.length) -+ { -+ auto toCopy = s.length - lastUnchanged; -+ ns[destIdx..destIdx+toCopy] = s[lastUnchanged..$]; -+ destIdx += toCopy; -+ } -+ assert(ns.length == destIdx); -+ s = ns; -+ } -+} - - /++ -- Whether or not $(D c) is a Unicode whitespace character. -- (general Unicode category: Part of C0(tab, vertical tab, form feed, -- carriage return, and linefeed characters), Zs, Zl, Zp, and NEL(U+0085)) -- +/ --bool isWhite(dchar c) @safe pure nothrow -+ Converts $(D s) to lowercase (by performing Unicode lowercase mapping) in place. -+ For a few characters string length may increase after the transformation, -+ in such a case the function reallocates exactly once. -+ If $(D s) does not have any uppercase characters, then $(D s) is unaltered. -++/ -+void toLowerInPlace(C)(ref C[] s) @trusted pure -+ if (is(C == char) || is(C == wchar) || is(C == dchar)) - { -- return std.ascii.isWhite(c) || -- c == lineSep || c == paraSep || -- c == '\u0085' || c == '\u00A0' || c == '\u1680' || c == '\u180E' || -- (c >= '\u2000' && c <= '\u200A') || -- c == '\u202F' || c == '\u205F' || c == '\u3000'; -+ toCaseInPlace!(LowerTriple)(s); - } -- -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.uni.isLower instead.") bool isUniLower(dchar c) @safe pure nothrow -+// overloads for the most common cases to reduce compile time -+@safe pure /*TODO nothrow*/ - { -- return isLower(c); -+ void toLowerInPlace(ref char[] s) -+ { toLowerInPlace!char(s); } -+ void toLowerInPlace(ref wchar[] s) -+ { toLowerInPlace!wchar(s); } -+ void toLowerInPlace(ref dchar[] s) -+ { toLowerInPlace!dchar(s); } - } - - /++ -- Return whether $(D c) is a Unicode lowercase character. -- +/ --bool isLower(dchar c) @safe pure nothrow -+ Converts $(D s) to uppercase (by performing Unicode uppercase mapping) in place. -+ For a few characters string length may increase after the transformation, -+ in such a case the function reallocates exactly once. -+ If $(D s) does not have any lowercase characters, then $(D s) is unaltered. -++/ -+void toUpperInPlace(C)(ref C[] s) @trusted pure -+ if (is(C == char) || is(C == wchar) || is(C == dchar)) - { -- if(std.ascii.isASCII(c)) -- return std.ascii.isLower(c); -+ toCaseInPlace!(UpperTriple)(s); -+} -+// overloads for the most common cases to reduce compile time/code size -+@safe pure /*TODO nothrow*/ -+{ -+ void toUpperInPlace(ref char[] s) -+ { toUpperInPlace!char(s); } -+ void toUpperInPlace(ref wchar[] s) -+ { toUpperInPlace!wchar(s); } -+ void toUpperInPlace(ref dchar[] s) -+ { toUpperInPlace!dchar(s); } -+} - -- return isAlpha(c) && c == toLower(c); -+/++ -+ Returns a string which is identical to $(D s) except that all of its -+ characters are converted to lowercase (by preforming Unicode lowercase mapping). -+ If none of $(D s) characters were affected, then $(D s) itself is returned. -++/ -+S toLower(S)(S s) @trusted pure -+ if(isSomeString!S) -+{ -+ return toCase!(LowerTriple)(s); -+} -+// overloads for the most common cases to reduce compile time -+@safe pure /*TODO nothrow*/ -+{ -+ string toLower(string s) -+ { return toLower!string(s); } -+ wstring toLower(wstring s) -+ { return toLower!wstring(s); } -+ dstring toLower(dstring s) -+ { return toLower!dstring(s); } - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.uni.isUpper instead.") bool isUniUpper(dchar c) @safe pure nothrow -+@trusted unittest //@@@BUG std.format is not @safe - { -- return isUpper(c); -+ import std.string : format; -+ foreach(ch; 0..0x80) -+ assert(std.ascii.toLower(ch) == toLower(ch)); -+ assert(toLower('Я') == 'я'); -+ assert(toLower('Δ') == 'δ'); -+ foreach(ch; unicode.upperCase.byCodepoint) -+ { -+ dchar low = ch.toLower(); -+ assert(low == ch || isLower(low), format("%s -> %s", ch, low)); -+ } -+ assert(toLower("АЯ") == "ая"); -+ -+ assert("\u1E9E".toLower == "\u00df"); -+ assert("\u00df".toUpper == "SS"); - } - --/++ -- Return whether $(D c) is a Unicode uppercase character. -- +/ --bool isUpper(dchar c) @safe pure nothrow -+//bugzilla 9629 -+unittest - { -- if(std.ascii.isASCII(c)) -- return std.ascii.isUpper(c); -+ wchar[] test = "hello þ world"w.dup; -+ auto piece = test[6..7]; -+ toUpperInPlace(piece); -+ assert(test == "hello Þ world"); -+} - -- return isAlpha(c) && c == toUpper(c); -+ -+unittest -+{ -+ string s1 = "FoL"; -+ string s2 = toLower(s1); -+ assert(cmp(s2, "fol") == 0, s2); -+ assert(s2 != s1); -+ -+ char[] s3 = s1.dup; -+ toLowerInPlace(s3); -+ assert(s3 == s2); -+ -+ s1 = "A\u0100B\u0101d"; -+ s2 = toLower(s1); -+ s3 = s1.dup; -+ assert(cmp(s2, "a\u0101b\u0101d") == 0); -+ assert(s2 !is s1); -+ toLowerInPlace(s3); -+ assert(s3 == s2); -+ -+ s1 = "A\u0460B\u0461d"; -+ s2 = toLower(s1); -+ s3 = s1.dup; -+ assert(cmp(s2, "a\u0461b\u0461d") == 0); -+ assert(s2 !is s1); -+ toLowerInPlace(s3); -+ assert(s3 == s2); -+ -+ s1 = "\u0130"; -+ s2 = toLower(s1); -+ s3 = s1.dup; -+ assert(s2 == "i\u0307"); -+ assert(s2 !is s1); -+ toLowerInPlace(s3); -+ assert(s3 == s2); -+ -+ // Test on wchar and dchar strings. -+ assert(toLower("Some String"w) == "some string"w); -+ assert(toLower("Some String"d) == "some string"d); - } - - --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.uni.toLower instead.") dchar toUniLower(dchar c) @safe pure nothrow -+deprecated("Please use std.uni.toUpper instead") -+@safe pure nothrow -+dchar toUniUpper(dchar c) - { -- return toLower(c); -+ return toUpper(c); - } - - /++ -- If $(D c) is a Unicode uppercase character, then its lowercase equivalent -+ If $(D c) is a Unicode lowercase $(CHARACTER), then its uppercase equivalent - is returned. Otherwise $(D c) is returned. -- +/ --dchar toLower(dchar c) @safe pure nothrow -+ -+ Warning: -+ Certain alphabets like German and Greek have no 1:1 -+ upper-lower mapping. Use overload of toUpper which takes full string instead. -++/ -+@safe pure nothrow -+dchar toUpper(dchar c) - { -- if(std.ascii.isUpper(c)) -- c += 32; -- else if(c >= 0x00C0) -+ // optimize ASCII case -+ if(c < 0xAA) - { -- if((c >= 0x00C0 && c <= 0x00D6) || -- (c >= 0x00D8 && c<=0x00DE)) -- { -- c += 32; -- } -- else if((c >= 0x0100 && c < 0x0138) || -- (c > 0x0149 && c < 0x0178)) -- { -- if(c == 0x0130) -- c = 0x0069; -- else if((c & 1) == 0) -- ++c; -- } -- else if(c == 0x0178) -- c = 0x00FF; -- else if((c >= 0x0139 && c < 0x0149) || -- (c > 0x0178 && c < 0x017F)) -- { -- if(c & 1) -- ++c; -- } -- else if(c >= 0x0200 && c <= 0x0217) -- { -- if((c & 1) == 0) -- ++c; -- } -- else if((c >= 0x0401 && c <= 0x040C) || -- (c>= 0x040E && c <= 0x040F)) -- { -- c += 80; -- } -- else if(c >= 0x0410 && c <= 0x042F) -- c += 32; -- else if(c >= 0x0460 && c <= 0x047F) -- { -- if((c & 1) == 0) -- ++c; -- } -- else if(c >= 0x0531 && c <= 0x0556) -- c += 48; -- else if(c >= 0x10A0 && c <= 0x10C5) -- c += 48; -- else if(c >= 0xFF21 && c <= 0xFF3A) -- c += 32; -+ if(c < 'a') -+ return c; -+ if(c <= 'z') -+ return c - 32; -+ return c; -+ } -+ size_t idx = toUpperIndex(c); -+ if(idx < MAX_SIMPLE_UPPER) -+ { -+ return toUpperTab(idx); - } -- - return c; - } - -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.uni.toUpper instead.") dchar toUniUpper(dchar c) @safe pure nothrow -+@trusted unittest - { -- return toUpper(c); -+ import std.string : format; -+ foreach(ch; 0..0x80) -+ assert(std.ascii.toUpper(ch) == toUpper(ch)); -+ assert(toUpper('я') == 'Я'); -+ assert(toUpper('δ') == 'Δ'); -+ foreach(ch; unicode.lowerCase.byCodepoint) -+ { -+ dchar up = ch.toUpper(); -+ assert(up == ch || isUpper(up), format("%s -> %s", ch, up)); -+ } - } - - /++ -- If $(D c) is a Unicode lowercase character, then its uppercase equivalent -- is returned. Otherwise $(D c) is returned. -- +/ --dchar toUpper(dchar c) @safe pure nothrow -+ Returns a string which is identical to $(D s) except that all of its -+ characters are converted to uppercase (by preforming Unicode uppercase mapping). -+ If none of $(D s) characters were affected, then $(D s) itself is returned. -++/ -+S toUpper(S)(S s) @trusted pure -+ if(isSomeString!S) -+{ -+ return toCase!(UpperTriple)(s); -+} -+// overloads for the most common cases to reduce compile time -+@safe pure /*TODO nothrow*/ -+{ -+ string toUpper(string s) -+ { return toUpper!string(s); } -+ wstring toUpper(wstring s) -+ { return toUpper!wstring(s); } -+ dstring toUpper(dstring s) -+ { return toUpper!dstring(s); } -+} -+ -+unittest -+{ -+ string s1 = "FoL"; -+ string s2; -+ char[] s3; -+ -+ s2 = toUpper(s1); -+ s3 = s1.dup; toUpperInPlace(s3); -+ assert(s3 == s2, s3); -+ assert(cmp(s2, "FOL") == 0); -+ assert(s2 !is s1); -+ -+ s1 = "a\u0100B\u0101d"; -+ s2 = toUpper(s1); -+ s3 = s1.dup; toUpperInPlace(s3); -+ assert(s3 == s2); -+ assert(cmp(s2, "A\u0100B\u0100D") == 0); -+ assert(s2 !is s1); -+ -+ s1 = "a\u0460B\u0461d"; -+ s2 = toUpper(s1); -+ s3 = s1.dup; toUpperInPlace(s3); -+ assert(s3 == s2); -+ assert(cmp(s2, "A\u0460B\u0460D") == 0); -+ assert(s2 !is s1); -+} -+ -+unittest - { -- if(std.ascii.isLower(c)) -- c -= 32; -- else if(c >= 0x00E0) -+ static void doTest(C)(const(C)[] s, const(C)[] trueUp, const(C)[] trueLow) - { -- if((c >= 0x00E0 && c <= 0x00F6) || -- (c >= 0x00F8 && c <= 0x00FE)) -- { -- c -= 32; -- } -- else if(c == 0x00FF) -- c = 0x0178; -- else if((c >= 0x0100 && c < 0x0138) || -- (c > 0x0149 && c < 0x0178)) -- { -- if(c == 0x0131) -- c = 0x0049; -- else if(c & 1) -- --c; -- } -- else if((c >= 0x0139 && c < 0x0149) || -- (c > 0x0178 && c < 0x017F)) -- { -- if((c & 1) == 0) -- --c; -- } -- else if(c == 0x017F) -- c = 0x0053; -- else if(c >= 0x0200 && c <= 0x0217) -+ import std.string : format; -+ string diff = "src: %( %x %)\nres: %( %x %)\ntru: %( %x %)"; -+ auto low = s.toLower() , up = s.toUpper(); -+ auto lowInp = s.dup, upInp = s.dup; -+ lowInp.toLowerInPlace(); -+ upInp.toUpperInPlace(); -+ assert(low == trueLow, format(diff, low, trueLow)); -+ assert(up == trueUp, format(diff, up, trueUp)); -+ assert(lowInp == trueLow, -+ format(diff, cast(ubyte[])s, cast(ubyte[])lowInp, cast(ubyte[])trueLow)); -+ assert(upInp == trueUp, -+ format(diff, cast(ubyte[])s, cast(ubyte[])upInp, cast(ubyte[])trueUp)); -+ } -+ foreach(S; TypeTuple!(dstring, wstring, string)) -+ { -+ -+ S easy = "123"; -+ S good = "abCФеж"; -+ S awful = "\u0131\u023f\u2126"; -+ S wicked = "\u0130\u1FE2"; -+ auto options = [easy, good, awful, wicked]; -+ S[] lower = ["123", "abcфеж", "\u0131\u023f\u03c9", "i\u0307\u1Fe2"]; -+ S[] upper = ["123", "ABCФЕЖ", "I\u2c7e\u2126", "\u0130\u03A5\u0308\u0300"]; -+ -+ foreach(val; TypeTuple!(easy, good)) - { -- if(c & 1) -- --c; -+ auto e = val.dup; -+ auto g = e; -+ e.toUpperInPlace(); -+ assert(e is g); -+ e.toLowerInPlace(); -+ assert(e is g); - } -- else if(c >= 0x0430 && c<= 0x044F) -- c -= 32; -- else if((c >= 0x0451 && c <= 0x045C) || -- (c >=0x045E && c<= 0x045F)) -+ foreach(i, v; options) - { -- c -= 80; -+ doTest(v, upper[i], lower[i]); - } -- else if(c >= 0x0460 && c <= 0x047F) -+ -+ // a few combinatorial runs -+ foreach(i; 0..options.length) -+ foreach(j; i..options.length) -+ foreach(k; j..options.length) - { -- if(c & 1) -- --c; -+ auto sample = options[i] ~ options[j] ~ options[k]; -+ auto sample2 = options[k] ~ options[j] ~ options[i]; -+ doTest(sample, upper[i] ~ upper[j] ~ upper[k], -+ lower[i] ~ lower[j] ~ lower[k]); -+ doTest(sample2, upper[k] ~ upper[j] ~ upper[i], -+ lower[k] ~ lower[j] ~ lower[i]); - } -- else if(c >= 0x0561 && c < 0x0587) -- c -= 48; -- else if(c >= 0xFF41 && c <= 0xFF5A) -- c -= 32; - } -- -- return c; - } - -- --//Explicitly undocumented. Do not use. To be removed in March 2013. --deprecated("Please use std.uni.isAlpha instead.") bool isUniAlpha(dchar c) @safe pure nothrow -+deprecated("Please use std.uni.isAlpha instead.") -+@safe pure nothrow -+bool isUniAlpha(dchar c) - { - return isAlpha(c); - } - - /++ -- Returns whether $(D c) is a Unicode alpha character -- (general Unicode category: Lu, Ll, Lt, Lm, and Lo). -- -- Standards: Unicode 5.0.0. -- +/ --bool isAlpha(dchar c) @safe pure nothrow --{ -- static immutable dchar[2][] table = -- [ -- [ 'A', 'Z' ], -- [ 'a', 'z' ], -- [ 0x00AA, 0x00AA ], -- [ 0x00B5, 0x00B5 ], -- [ 0x00BA, 0x00BA ], -- [ 0x00C0, 0x00D6 ], -- [ 0x00D8, 0x00F6 ], -- [ 0x00F8, 0x02C1 ], -- [ 0x02C6, 0x02D1 ], -- [ 0x02E0, 0x02E4 ], -- [ 0x02EE, 0x02EE ], -- [ 0x037A, 0x037D ], -- [ 0x0386, 0x0386 ], -- [ 0x0388, 0x038A ], -- [ 0x038C, 0x038C ], -- [ 0x038E, 0x03A1 ], -- [ 0x03A3, 0x03CE ], -- [ 0x03D0, 0x03F5 ], -- [ 0x03F7, 0x0481 ], -- [ 0x048A, 0x0513 ], -- [ 0x0531, 0x0556 ], -- [ 0x0559, 0x0559 ], -- [ 0x0561, 0x0587 ], -- [ 0x05D0, 0x05EA ], -- [ 0x05F0, 0x05F2 ], -- [ 0x0621, 0x063A ], -- [ 0x0640, 0x064A ], -- [ 0x066E, 0x066F ], -- [ 0x0671, 0x06D3 ], -- [ 0x06D5, 0x06D5 ], -- [ 0x06E5, 0x06E6 ], -- [ 0x06EE, 0x06EF ], -- [ 0x06FA, 0x06FC ], -- [ 0x06FF, 0x06FF ], -- [ 0x0710, 0x0710 ], -- [ 0x0712, 0x072F ], -- [ 0x074D, 0x076D ], -- [ 0x0780, 0x07A5 ], -- [ 0x07B1, 0x07B1 ], -- [ 0x07CA, 0x07EA ], -- [ 0x07F4, 0x07F5 ], -- [ 0x07FA, 0x07FA ], -- [ 0x0904, 0x0939 ], -- [ 0x093D, 0x093D ], -- [ 0x0950, 0x0950 ], -- [ 0x0958, 0x0961 ], -- [ 0x097B, 0x097F ], -- [ 0x0985, 0x098C ], -- [ 0x098F, 0x0990 ], -- [ 0x0993, 0x09A8 ], -- [ 0x09AA, 0x09B0 ], -- [ 0x09B2, 0x09B2 ], -- [ 0x09B6, 0x09B9 ], -- [ 0x09BD, 0x09BD ], -- [ 0x09CE, 0x09CE ], -- [ 0x09DC, 0x09DD ], -- [ 0x09DF, 0x09E1 ], -- [ 0x09F0, 0x09F1 ], -- [ 0x0A05, 0x0A0A ], -- [ 0x0A0F, 0x0A10 ], -- [ 0x0A13, 0x0A28 ], -- [ 0x0A2A, 0x0A30 ], -- [ 0x0A32, 0x0A33 ], -- [ 0x0A35, 0x0A36 ], -- [ 0x0A38, 0x0A39 ], -- [ 0x0A59, 0x0A5C ], -- [ 0x0A5E, 0x0A5E ], -- [ 0x0A72, 0x0A74 ], -- [ 0x0A85, 0x0A8D ], -- [ 0x0A8F, 0x0A91 ], -- [ 0x0A93, 0x0AA8 ], -- [ 0x0AAA, 0x0AB0 ], -- [ 0x0AB2, 0x0AB3 ], -- [ 0x0AB5, 0x0AB9 ], -- [ 0x0ABD, 0x0ABD ], -- [ 0x0AD0, 0x0AD0 ], -- [ 0x0AE0, 0x0AE1 ], -- [ 0x0B05, 0x0B0C ], -- [ 0x0B0F, 0x0B10 ], -- [ 0x0B13, 0x0B28 ], -- [ 0x0B2A, 0x0B30 ], -- [ 0x0B32, 0x0B33 ], -- [ 0x0B35, 0x0B39 ], -- [ 0x0B3D, 0x0B3D ], -- [ 0x0B5C, 0x0B5D ], -- [ 0x0B5F, 0x0B61 ], -- [ 0x0B71, 0x0B71 ], -- [ 0x0B83, 0x0B83 ], -- [ 0x0B85, 0x0B8A ], -- [ 0x0B8E, 0x0B90 ], -- [ 0x0B92, 0x0B95 ], -- [ 0x0B99, 0x0B9A ], -- [ 0x0B9C, 0x0B9C ], -- [ 0x0B9E, 0x0B9F ], -- [ 0x0BA3, 0x0BA4 ], -- [ 0x0BA8, 0x0BAA ], -- [ 0x0BAE, 0x0BB9 ], -- [ 0x0C05, 0x0C0C ], -- [ 0x0C0E, 0x0C10 ], -- [ 0x0C12, 0x0C28 ], -- [ 0x0C2A, 0x0C33 ], -- [ 0x0C35, 0x0C39 ], -- [ 0x0C60, 0x0C61 ], -- [ 0x0C85, 0x0C8C ], -- [ 0x0C8E, 0x0C90 ], -- [ 0x0C92, 0x0CA8 ], -- [ 0x0CAA, 0x0CB3 ], -- [ 0x0CB5, 0x0CB9 ], -- [ 0x0CBD, 0x0CBD ], -- [ 0x0CDE, 0x0CDE ], -- [ 0x0CE0, 0x0CE1 ], -- [ 0x0D05, 0x0D0C ], -- [ 0x0D0E, 0x0D10 ], -- [ 0x0D12, 0x0D28 ], -- [ 0x0D2A, 0x0D39 ], -- [ 0x0D60, 0x0D61 ], -- [ 0x0D85, 0x0D96 ], -- [ 0x0D9A, 0x0DB1 ], -- [ 0x0DB3, 0x0DBB ], -- [ 0x0DBD, 0x0DBD ], -- [ 0x0DC0, 0x0DC6 ], -- [ 0x0E01, 0x0E30 ], -- [ 0x0E32, 0x0E33 ], -- [ 0x0E40, 0x0E46 ], -- [ 0x0E81, 0x0E82 ], -- [ 0x0E84, 0x0E84 ], -- [ 0x0E87, 0x0E88 ], -- [ 0x0E8A, 0x0E8A ], -- [ 0x0E8D, 0x0E8D ], -- [ 0x0E94, 0x0E97 ], -- [ 0x0E99, 0x0E9F ], -- [ 0x0EA1, 0x0EA3 ], -- [ 0x0EA5, 0x0EA5 ], -- [ 0x0EA7, 0x0EA7 ], -- [ 0x0EAA, 0x0EAB ], -- [ 0x0EAD, 0x0EB0 ], -- [ 0x0EB2, 0x0EB3 ], -- [ 0x0EBD, 0x0EBD ], -- [ 0x0EC0, 0x0EC4 ], -- [ 0x0EC6, 0x0EC6 ], -- [ 0x0EDC, 0x0EDD ], -- [ 0x0F00, 0x0F00 ], -- [ 0x0F40, 0x0F47 ], -- [ 0x0F49, 0x0F6A ], -- [ 0x0F88, 0x0F8B ], -- [ 0x1000, 0x1021 ], -- [ 0x1023, 0x1027 ], -- [ 0x1029, 0x102A ], -- [ 0x1050, 0x1055 ], -- [ 0x10A0, 0x10C5 ], -- [ 0x10D0, 0x10FA ], -- [ 0x10FC, 0x10FC ], -- [ 0x1100, 0x1159 ], -- [ 0x115F, 0x11A2 ], -- [ 0x11A8, 0x11F9 ], -- [ 0x1200, 0x1248 ], -- [ 0x124A, 0x124D ], -- [ 0x1250, 0x1256 ], -- [ 0x1258, 0x1258 ], -- [ 0x125A, 0x125D ], -- [ 0x1260, 0x1288 ], -- [ 0x128A, 0x128D ], -- [ 0x1290, 0x12B0 ], -- [ 0x12B2, 0x12B5 ], -- [ 0x12B8, 0x12BE ], -- [ 0x12C0, 0x12C0 ], -- [ 0x12C2, 0x12C5 ], -- [ 0x12C8, 0x12D6 ], -- [ 0x12D8, 0x1310 ], -- [ 0x1312, 0x1315 ], -- [ 0x1318, 0x135A ], -- [ 0x1380, 0x138F ], -- [ 0x13A0, 0x13F4 ], -- [ 0x1401, 0x166C ], -- [ 0x166F, 0x1676 ], -- [ 0x1681, 0x169A ], -- [ 0x16A0, 0x16EA ], -- [ 0x1700, 0x170C ], -- [ 0x170E, 0x1711 ], -- [ 0x1720, 0x1731 ], -- [ 0x1740, 0x1751 ], -- [ 0x1760, 0x176C ], -- [ 0x176E, 0x1770 ], -- [ 0x1780, 0x17B3 ], -- [ 0x17D7, 0x17D7 ], -- [ 0x17DC, 0x17DC ], -- [ 0x1820, 0x1877 ], -- [ 0x1880, 0x18A8 ], -- [ 0x1900, 0x191C ], -- [ 0x1950, 0x196D ], -- [ 0x1970, 0x1974 ], -- [ 0x1980, 0x19A9 ], -- [ 0x19C1, 0x19C7 ], -- [ 0x1A00, 0x1A16 ], -- [ 0x1B05, 0x1B33 ], -- [ 0x1B45, 0x1B4B ], -- [ 0x1D00, 0x1DBF ], -- [ 0x1E00, 0x1E9B ], -- [ 0x1EA0, 0x1EF9 ], -- [ 0x1F00, 0x1F15 ], -- [ 0x1F18, 0x1F1D ], -- [ 0x1F20, 0x1F45 ], -- [ 0x1F48, 0x1F4D ], -- [ 0x1F50, 0x1F57 ], -- [ 0x1F59, 0x1F59 ], -- [ 0x1F5B, 0x1F5B ], -- [ 0x1F5D, 0x1F5D ], -- [ 0x1F5F, 0x1F7D ], -- [ 0x1F80, 0x1FB4 ], -- [ 0x1FB6, 0x1FBC ], -- [ 0x1FBE, 0x1FBE ], -- [ 0x1FC2, 0x1FC4 ], -- [ 0x1FC6, 0x1FCC ], -- [ 0x1FD0, 0x1FD3 ], -- [ 0x1FD6, 0x1FDB ], -- [ 0x1FE0, 0x1FEC ], -- [ 0x1FF2, 0x1FF4 ], -- [ 0x1FF6, 0x1FFC ], -- [ 0x2071, 0x2071 ], -- [ 0x207F, 0x207F ], -- [ 0x2090, 0x2094 ], -- [ 0x2102, 0x2102 ], -- [ 0x2107, 0x2107 ], -- [ 0x210A, 0x2113 ], -- [ 0x2115, 0x2115 ], -- [ 0x2119, 0x211D ], -- [ 0x2124, 0x2124 ], -- [ 0x2126, 0x2126 ], -- [ 0x2128, 0x2128 ], -- [ 0x212A, 0x212D ], -- [ 0x212F, 0x2139 ], -- [ 0x213C, 0x213F ], -- [ 0x2145, 0x2149 ], -- [ 0x214E, 0x214E ], -- [ 0x2183, 0x2184 ], -- [ 0x2C00, 0x2C2E ], -- [ 0x2C30, 0x2C5E ], -- [ 0x2C60, 0x2C6C ], -- [ 0x2C74, 0x2C77 ], -- [ 0x2C80, 0x2CE4 ], -- [ 0x2D00, 0x2D25 ], -- [ 0x2D30, 0x2D65 ], -- [ 0x2D6F, 0x2D6F ], -- [ 0x2D80, 0x2D96 ], -- [ 0x2DA0, 0x2DA6 ], -- [ 0x2DA8, 0x2DAE ], -- [ 0x2DB0, 0x2DB6 ], -- [ 0x2DB8, 0x2DBE ], -- [ 0x2DC0, 0x2DC6 ], -- [ 0x2DC8, 0x2DCE ], -- [ 0x2DD0, 0x2DD6 ], -- [ 0x2DD8, 0x2DDE ], -- [ 0x3005, 0x3006 ], -- [ 0x3031, 0x3035 ], -- [ 0x303B, 0x303C ], -- [ 0x3041, 0x3096 ], -- [ 0x309D, 0x309F ], -- [ 0x30A1, 0x30FA ], -- [ 0x30FC, 0x30FF ], -- [ 0x3105, 0x312C ], -- [ 0x3131, 0x318E ], -- [ 0x31A0, 0x31B7 ], -- [ 0x31F0, 0x31FF ], -- [ 0x3400, 0x4DB5 ], -- [ 0x4E00, 0x9FBB ], -- [ 0xA000, 0xA48C ], -- [ 0xA717, 0xA71A ], -- [ 0xA800, 0xA801 ], -- [ 0xA803, 0xA805 ], -- [ 0xA807, 0xA80A ], -- [ 0xA80C, 0xA822 ], -- [ 0xA840, 0xA873 ], -- [ 0xAC00, 0xD7A3 ], -- [ 0xF900, 0xFA2D ], -- [ 0xFA30, 0xFA6A ], -- [ 0xFA70, 0xFAD9 ], -- [ 0xFB00, 0xFB06 ], -- [ 0xFB13, 0xFB17 ], -- [ 0xFB1D, 0xFB1D ], -- [ 0xFB1F, 0xFB28 ], -- [ 0xFB2A, 0xFB36 ], -- [ 0xFB38, 0xFB3C ], -- [ 0xFB3E, 0xFB3E ], -- [ 0xFB40, 0xFB41 ], -- [ 0xFB43, 0xFB44 ], -- [ 0xFB46, 0xFBB1 ], -- [ 0xFBD3, 0xFD3D ], -- [ 0xFD50, 0xFD8F ], -- [ 0xFD92, 0xFDC7 ], -- [ 0xFDF0, 0xFDFB ], -- [ 0xFE70, 0xFE74 ], -- [ 0xFE76, 0xFEFC ], -- [ 0xFF21, 0xFF3A ], -- [ 0xFF41, 0xFF5A ], -- [ 0xFF66, 0xFFBE ], -- [ 0xFFC2, 0xFFC7 ], -- [ 0xFFCA, 0xFFCF ], -- [ 0xFFD2, 0xFFD7 ], -- [ 0xFFDA, 0xFFDC ], -- [ 0x10000, 0x1000B ], -- [ 0x1000D, 0x10026 ], -- [ 0x10028, 0x1003A ], -- [ 0x1003C, 0x1003D ], -- [ 0x1003F, 0x1004D ], -- [ 0x10050, 0x1005D ], -- [ 0x10080, 0x100FA ], -- [ 0x10300, 0x1031E ], -- [ 0x10330, 0x10340 ], -- [ 0x10342, 0x10349 ], -- [ 0x10380, 0x1039D ], -- [ 0x103A0, 0x103C3 ], -- [ 0x103C8, 0x103CF ], -- [ 0x10400, 0x1049D ], -- [ 0x10800, 0x10805 ], -- [ 0x10808, 0x10808 ], -- [ 0x1080A, 0x10835 ], -- [ 0x10837, 0x10838 ], -- [ 0x1083C, 0x1083C ], -- [ 0x1083F, 0x1083F ], -- [ 0x10900, 0x10915 ], -- [ 0x10A00, 0x10A00 ], -- [ 0x10A10, 0x10A13 ], -- [ 0x10A15, 0x10A17 ], -- [ 0x10A19, 0x10A33 ], -- [ 0x12000, 0x1236E ], -- [ 0x1D400, 0x1D454 ], -- [ 0x1D456, 0x1D49C ], -- [ 0x1D49E, 0x1D49F ], -- [ 0x1D4A2, 0x1D4A2 ], -- [ 0x1D4A5, 0x1D4A6 ], -- [ 0x1D4A9, 0x1D4AC ], -- [ 0x1D4AE, 0x1D4B9 ], -- [ 0x1D4BB, 0x1D4BB ], -- [ 0x1D4BD, 0x1D4C3 ], -- [ 0x1D4C5, 0x1D505 ], -- [ 0x1D507, 0x1D50A ], -- [ 0x1D50D, 0x1D514 ], -- [ 0x1D516, 0x1D51C ], -- [ 0x1D51E, 0x1D539 ], -- [ 0x1D53B, 0x1D53E ], -- [ 0x1D540, 0x1D544 ], -- [ 0x1D546, 0x1D546 ], -- [ 0x1D54A, 0x1D550 ], -- [ 0x1D552, 0x1D6A5 ], -- [ 0x1D6A8, 0x1D6C0 ], -- [ 0x1D6C2, 0x1D6DA ], -- [ 0x1D6DC, 0x1D6FA ], -- [ 0x1D6FC, 0x1D714 ], -- [ 0x1D716, 0x1D734 ], -- [ 0x1D736, 0x1D74E ], -- [ 0x1D750, 0x1D76E ], -- [ 0x1D770, 0x1D788 ], -- [ 0x1D78A, 0x1D7A8 ], -- [ 0x1D7AA, 0x1D7C2 ], -- [ 0x1D7C4, 0x1D7CB ], -- [ 0x20000, 0x2A6D6 ], -- [ 0x2F800, 0x2FA1D ], -- ]; -- -+ Returns whether $(D c) is a Unicode alphabetic $(CHARACTER) -+ (general Unicode category: Alphabetic). -++/ -+@safe pure nothrow -+bool isAlpha(dchar c) -+{ - // optimization - if(c < 0xAA) - { -- if(c < 'A') -- return false; -- if(c <= 'Z') -- return true; -- if(c < 'a') -- return false; -- if(c <= 'z') -+ size_t x = c - 'A'; -+ if(x <= 'Z' - 'A') - return true; -+ else -+ { -+ x = c - 'a'; -+ if(x <= 'z'-'a') -+ return true; -+ } - return false; - } - -- return binarySearch!table(c); -+ return alphaTrie[c]; - } - --unittest -+@safe unittest - { -- for(dchar c = 0; c < 0x80; ++c) -- { -- if(c >= 'A' && c <= 'Z') -- assert(isAlpha(c)); -- else if(c >= 'a' && c <= 'z') -- assert(isAlpha(c)); -- else -- assert(!isAlpha(c)); -- } -+ auto alpha = unicode("Alphabetic"); -+ foreach(ch; alpha.byCodepoint) -+ assert(isAlpha(ch)); -+ foreach(ch; 0..0x4000) -+ assert((ch in alpha) == isAlpha(ch)); - } - - - /++ - Returns whether $(D c) is a Unicode mark - (general Unicode category: Mn, Me, Mc). -- -- Standards: Unicode 6.0.0. -- +/ -- --bool isMark(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isMark(dchar c) - { -- static immutable dchar[2][] tableMn = -- [ -- [ 0x0300, 0x036F ], -- [ 0x0483, 0x0487 ], -- [ 0x0591, 0x05BD ], -- [ 0x05BF, 0x05BF ], -- [ 0x05C1, 0x05C2 ], -- [ 0x05C4, 0x05C5 ], -- [ 0x05C7, 0x05C7 ], -- [ 0x0610, 0x061A ], -- [ 0x064B, 0x065F ], -- [ 0x0670, 0x0670 ], -- [ 0x06D6, 0x06DC ], -- [ 0x06DF, 0x06E4 ], -- [ 0x06E7, 0x06E8 ], -- [ 0x06EA, 0x06ED ], -- [ 0x0711, 0x0711 ], -- [ 0x0730, 0x074A ], -- [ 0x07A6, 0x07B0 ], -- [ 0x07EB, 0x07F3 ], -- [ 0x0816, 0x0819 ], -- [ 0x081B, 0x0823 ], -- [ 0x0825, 0x0827 ], -- [ 0x0829, 0x082D ], -- [ 0x0859, 0x085B ], -- [ 0x0900, 0x0902 ], -- [ 0x093A, 0x093A ], -- [ 0x093C, 0x093C ], -- [ 0x0941, 0x0948 ], -- [ 0x094D, 0x094D ], -- [ 0x0951, 0x0957 ], -- [ 0x0962, 0x0963 ], -- [ 0x0981, 0x0981 ], -- [ 0x09BC, 0x09BC ], -- [ 0x09C1, 0x09C4 ], -- [ 0x09CD, 0x09CD ], -- [ 0x09E2, 0x09E3 ], -- [ 0x0A01, 0x0A02 ], -- [ 0x0A3C, 0x0A3C ], -- [ 0x0A41, 0x0A42 ], -- [ 0x0A47, 0x0A48 ], -- [ 0x0A4B, 0x0A4D ], -- [ 0x0A51, 0x0A51 ], -- [ 0x0A70, 0x0A71 ], -- [ 0x0A75, 0x0A75 ], -- [ 0x0A81, 0x0A82 ], -- [ 0x0ABC, 0x0ABC ], -- [ 0x0AC1, 0x0AC5 ], -- [ 0x0AC7, 0x0AC8 ], -- [ 0x0ACD, 0x0ACD ], -- [ 0x0AE2, 0x0AE3 ], -- [ 0x0B01, 0x0B01 ], -- [ 0x0B3C, 0x0B3C ], -- [ 0x0B3F, 0x0B3F ], -- [ 0x0B41, 0x0B44 ], -- [ 0x0B4D, 0x0B4D ], -- [ 0x0B56, 0x0B56 ], -- [ 0x0B62, 0x0B63 ], -- [ 0x0B82, 0x0B82 ], -- [ 0x0BC0, 0x0BC0 ], -- [ 0x0BCD, 0x0BCD ], -- [ 0x0C3E, 0x0C40 ], -- [ 0x0C46, 0x0C48 ], -- [ 0x0C4A, 0x0C4D ], -- [ 0x0C55, 0x0C56 ], -- [ 0x0C62, 0x0C63 ], -- [ 0x0CBC, 0x0CBC ], -- [ 0x0CBF, 0x0CBF ], -- [ 0x0CC6, 0x0CC6 ], -- [ 0x0CCC, 0x0CCD ], -- [ 0x0CE2, 0x0CE3 ], -- [ 0x0D41, 0x0D44 ], -- [ 0x0D4D, 0x0D4D ], -- [ 0x0D62, 0x0D63 ], -- [ 0x0DCA, 0x0DCA ], -- [ 0x0DD2, 0x0DD4 ], -- [ 0x0DD6, 0x0DD6 ], -- [ 0x0E31, 0x0E31 ], -- [ 0x0E34, 0x0E3A ], -- [ 0x0E47, 0x0E4E ], -- [ 0x0EB1, 0x0EB1 ], -- [ 0x0EB4, 0x0EB9 ], -- [ 0x0EBB, 0x0EBC ], -- [ 0x0EC8, 0x0ECD ], -- [ 0x0F18, 0x0F19 ], -- [ 0x0F35, 0x0F35 ], -- [ 0x0F37, 0x0F37 ], -- [ 0x0F39, 0x0F39 ], -- [ 0x0F71, 0x0F7E ], -- [ 0x0F80, 0x0F84 ], -- [ 0x0F86, 0x0F87 ], -- [ 0x0F8D, 0x0F97 ], -- [ 0x0F99, 0x0FBC ], -- [ 0x0FC6, 0x0FC6 ], -- [ 0x102D, 0x1030 ], -- [ 0x1032, 0x1037 ], -- [ 0x1039, 0x103A ], -- [ 0x103D, 0x103E ], -- [ 0x1058, 0x1059 ], -- [ 0x105E, 0x1060 ], -- [ 0x1071, 0x1074 ], -- [ 0x1082, 0x1082 ], -- [ 0x1085, 0x1086 ], -- [ 0x108D, 0x108D ], -- [ 0x109D, 0x109D ], -- [ 0x135D, 0x135F ], -- [ 0x1712, 0x1714 ], -- [ 0x1732, 0x1734 ], -- [ 0x1752, 0x1753 ], -- [ 0x1772, 0x1773 ], -- [ 0x17B7, 0x17BD ], -- [ 0x17C6, 0x17C6 ], -- [ 0x17C9, 0x17D3 ], -- [ 0x17DD, 0x17DD ], -- [ 0x180B, 0x180D ], -- [ 0x18A9, 0x18A9 ], -- [ 0x1920, 0x1922 ], -- [ 0x1927, 0x1928 ], -- [ 0x1932, 0x1932 ], -- [ 0x1939, 0x193B ], -- [ 0x1A17, 0x1A18 ], -- [ 0x1A56, 0x1A56 ], -- [ 0x1A58, 0x1A5E ], -- [ 0x1A60, 0x1A60 ], -- [ 0x1A62, 0x1A62 ], -- [ 0x1A65, 0x1A6C ], -- [ 0x1A73, 0x1A7C ], -- [ 0x1A7F, 0x1A7F ], -- [ 0x1B00, 0x1B03 ], -- [ 0x1B34, 0x1B34 ], -- [ 0x1B36, 0x1B3A ], -- [ 0x1B3C, 0x1B3C ], -- [ 0x1B42, 0x1B42 ], -- [ 0x1B6B, 0x1B73 ], -- [ 0x1B80, 0x1B81 ], -- [ 0x1BA2, 0x1BA5 ], -- [ 0x1BA8, 0x1BA9 ], -- [ 0x1BE6, 0x1BE6 ], -- [ 0x1BE8, 0x1BE9 ], -- [ 0x1BED, 0x1BED ], -- [ 0x1BEF, 0x1BF1 ], -- [ 0x1C2C, 0x1C33 ], -- [ 0x1C36, 0x1C37 ], -- [ 0x1CD0, 0x1CD2 ], -- [ 0x1CD4, 0x1CE0 ], -- [ 0x1CE2, 0x1CE8 ], -- [ 0x1CED, 0x1CED ], -- [ 0x1DC0, 0x1DE6 ], -- [ 0x1DFC, 0x1DFF ], -- [ 0x20D0, 0x20DC ], -- [ 0x20E1, 0x20E1 ], -- [ 0x20E5, 0x20F0 ], -- [ 0x2CEF, 0x2CF1 ], -- [ 0x2D7F, 0x2D7F ], -- [ 0x2DE0, 0x2DFF ], -- [ 0x302A, 0x302F ], -- [ 0x3099, 0x309A ], -- [ 0xA66F, 0xA66F ], -- [ 0xA67C, 0xA67D ], -- [ 0xA6F0, 0xA6F1 ], -- [ 0xA802, 0xA802 ], -- [ 0xA806, 0xA806 ], -- [ 0xA80B, 0xA80B ], -- [ 0xA825, 0xA826 ], -- [ 0xA8C4, 0xA8C4 ], -- [ 0xA8E0, 0xA8F1 ], -- [ 0xA926, 0xA92D ], -- [ 0xA947, 0xA951 ], -- [ 0xA980, 0xA982 ], -- [ 0xA9B3, 0xA9B3 ], -- [ 0xA9B6, 0xA9B9 ], -- [ 0xA9BC, 0xA9BC ], -- [ 0xAA29, 0xAA2E ], -- [ 0xAA31, 0xAA32 ], -- [ 0xAA35, 0xAA36 ], -- [ 0xAA43, 0xAA43 ], -- [ 0xAA4C, 0xAA4C ], -- [ 0xAAB0, 0xAAB0 ], -- [ 0xAAB2, 0xAAB4 ], -- [ 0xAAB7, 0xAAB8 ], -- [ 0xAABE, 0xAABF ], -- [ 0xAAC1, 0xAAC1 ], -- [ 0xABE5, 0xABE5 ], -- [ 0xABE8, 0xABE8 ], -- [ 0xABED, 0xABED ], -- [ 0xFB1E, 0xFB1E ], -- [ 0xFE00, 0xFE0F ], -- [ 0xFE20, 0xFE26 ], -- [ 0x101FD, 0x101FD ], -- [ 0x10A01, 0x10A03 ], -- [ 0x10A05, 0x10A06 ], -- [ 0x10A0C, 0x10A0F ], -- [ 0x10A38, 0x10A3A ], -- [ 0x10A3F, 0x10A3F ], -- [ 0x11001, 0x11001 ], -- [ 0x11038, 0x11046 ], -- [ 0x11080, 0x11081 ], -- [ 0x110B3, 0x110B6 ], -- [ 0x110B9, 0x110BA ], -- [ 0x1D167, 0x1D169 ], -- [ 0x1D17B, 0x1D182 ], -- [ 0x1D185, 0x1D18B ], -- [ 0x1D1AA, 0x1D1AD ], -- [ 0x1D242, 0x1D244 ], -- [ 0xE0100, 0xE01EF ], -- ]; -- -- static immutable dchar[2][] tableMe = -- [ -- [ 0x0488, 0x0489 ], -- [ 0x20DD, 0x20E0 ], -- [ 0x20E2, 0x20E4 ], -- [ 0xA670, 0xA672 ], -- ]; -- -- static immutable dchar[2][] tableMc = -- [ -- [ 0x0903, 0x0903 ], -- [ 0x093B, 0x093B ], -- [ 0x093E, 0x0940 ], -- [ 0x0949, 0x094C ], -- [ 0x094E, 0x094F ], -- [ 0x0982, 0x0983 ], -- [ 0x09BE, 0x09C0 ], -- [ 0x09C7, 0x09C8 ], -- [ 0x09CB, 0x09CC ], -- [ 0x09D7, 0x09D7 ], -- [ 0x0A03, 0x0A03 ], -- [ 0x0A3E, 0x0A40 ], -- [ 0x0A83, 0x0A83 ], -- [ 0x0ABE, 0x0AC0 ], -- [ 0x0AC9, 0x0AC9 ], -- [ 0x0ACB, 0x0ACC ], -- [ 0x0B02, 0x0B03 ], -- [ 0x0B3E, 0x0B3E ], -- [ 0x0B40, 0x0B40 ], -- [ 0x0B47, 0x0B48 ], -- [ 0x0B4B, 0x0B4C ], -- [ 0x0B57, 0x0B57 ], -- [ 0x0BBE, 0x0BBF ], -- [ 0x0BC1, 0x0BC2 ], -- [ 0x0BC6, 0x0BC8 ], -- [ 0x0BCA, 0x0BCC ], -- [ 0x0BD7, 0x0BD7 ], -- [ 0x0C01, 0x0C03 ], -- [ 0x0C41, 0x0C44 ], -- [ 0x0C82, 0x0C83 ], -- [ 0x0CBE, 0x0CBE ], -- [ 0x0CC0, 0x0CC4 ], -- [ 0x0CC7, 0x0CC8 ], -- [ 0x0CCA, 0x0CCB ], -- [ 0x0CD5, 0x0CD6 ], -- [ 0x0D02, 0x0D03 ], -- [ 0x0D3E, 0x0D40 ], -- [ 0x0D46, 0x0D48 ], -- [ 0x0D4A, 0x0D4C ], -- [ 0x0D57, 0x0D57 ], -- [ 0x0D82, 0x0D83 ], -- [ 0x0DCF, 0x0DD1 ], -- [ 0x0DD8, 0x0DDF ], -- [ 0x0DF2, 0x0DF3 ], -- [ 0x0F3E, 0x0F3F ], -- [ 0x0F7F, 0x0F7F ], -- [ 0x102B, 0x102C ], -- [ 0x1031, 0x1031 ], -- [ 0x1038, 0x1038 ], -- [ 0x103B, 0x103C ], -- [ 0x1056, 0x1057 ], -- [ 0x1062, 0x1064 ], -- [ 0x1067, 0x106D ], -- [ 0x1083, 0x1084 ], -- [ 0x1087, 0x108C ], -- [ 0x108F, 0x108F ], -- [ 0x109A, 0x109C ], -- [ 0x17B6, 0x17B6 ], -- [ 0x17BE, 0x17C5 ], -- [ 0x17C7, 0x17C8 ], -- [ 0x1923, 0x1926 ], -- [ 0x1929, 0x192B ], -- [ 0x1930, 0x1931 ], -- [ 0x1933, 0x1938 ], -- [ 0x19B0, 0x19C0 ], -- [ 0x19C8, 0x19C9 ], -- [ 0x1A19, 0x1A1B ], -- [ 0x1A55, 0x1A55 ], -- [ 0x1A57, 0x1A57 ], -- [ 0x1A61, 0x1A61 ], -- [ 0x1A63, 0x1A64 ], -- [ 0x1A6D, 0x1A72 ], -- [ 0x1B04, 0x1B04 ], -- [ 0x1B35, 0x1B35 ], -- [ 0x1B3B, 0x1B3B ], -- [ 0x1B3D, 0x1B41 ], -- [ 0x1B43, 0x1B44 ], -- [ 0x1B82, 0x1B82 ], -- [ 0x1BA1, 0x1BA1 ], -- [ 0x1BA6, 0x1BA7 ], -- [ 0x1BAA, 0x1BAA ], -- [ 0x1BE7, 0x1BE7 ], -- [ 0x1BEA, 0x1BEC ], -- [ 0x1BEE, 0x1BEE ], -- [ 0x1BF2, 0x1BF3 ], -- [ 0x1C24, 0x1C2B ], -- [ 0x1C34, 0x1C35 ], -- [ 0x1CE1, 0x1CE1 ], -- [ 0x1CF2, 0x1CF2 ], -- [ 0xA823, 0xA824 ], -- [ 0xA827, 0xA827 ], -- [ 0xA880, 0xA881 ], -- [ 0xA8B4, 0xA8C3 ], -- [ 0xA952, 0xA953 ], -- [ 0xA983, 0xA983 ], -- [ 0xA9B4, 0xA9B5 ], -- [ 0xA9BA, 0xA9BB ], -- [ 0xA9BD, 0xA9C0 ], -- [ 0xAA2F, 0xAA30 ], -- [ 0xAA33, 0xAA34 ], -- [ 0xAA4D, 0xAA4D ], -- [ 0xAA7B, 0xAA7B ], -- [ 0xABE3, 0xABE4 ], -- [ 0xABE6, 0xABE7 ], -- [ 0xABE9, 0xABEA ], -- [ 0xABEC, 0xABEC ], -- [ 0x11000, 0x11000 ], -- [ 0x11002, 0x11002 ], -- [ 0x11082, 0x11082 ], -- [ 0x110B0, 0x110B2 ], -- [ 0x110B7, 0x110B8 ], -- [ 0x1D165, 0x1D166 ], -- [ 0x1D16D, 0x1D172 ], -- ]; -- -- return binarySearch!tableMn(c) || binarySearch!tableMe(c) || binarySearch!tableMc(c); -+ return markTrie[c]; - } - --unittest -+@safe unittest - { -- assert(isMark('\u0300')); -- assert(isMark('\u0488')); -- assert(isMark('\u0903')); -+ auto mark = unicode("Mark"); -+ foreach(ch; mark.byCodepoint) -+ assert(isMark(ch)); -+ foreach(ch; 0..0x4000) -+ assert((ch in mark) == isMark(ch)); - } - -- - /++ -- Returns whether $(D c) is a Unicode numerical character -+ Returns whether $(D c) is a Unicode numerical $(CHARACTER) - (general Unicode category: Nd, Nl, No). -- -- Standards: Unicode 6.0.0. -- +/ -- --bool isNumber(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isNumber(dchar c) - { -- static immutable dchar[2][] tableNd = -- [ -- [ 0x0030, 0x0039 ], -- [ 0x0660, 0x0669 ], -- [ 0x06F0, 0x06F9 ], -- [ 0x07C0, 0x07C9 ], -- [ 0x0966, 0x096F ], -- [ 0x09E6, 0x09EF ], -- [ 0x0A66, 0x0A6F ], -- [ 0x0AE6, 0x0AEF ], -- [ 0x0B66, 0x0B6F ], -- [ 0x0BE6, 0x0BEF ], -- [ 0x0C66, 0x0C6F ], -- [ 0x0CE6, 0x0CEF ], -- [ 0x0D66, 0x0D6F ], -- [ 0x0E50, 0x0E59 ], -- [ 0x0ED0, 0x0ED9 ], -- [ 0x0F20, 0x0F29 ], -- [ 0x1040, 0x1049 ], -- [ 0x1090, 0x1099 ], -- [ 0x17E0, 0x17E9 ], -- [ 0x1810, 0x1819 ], -- [ 0x1946, 0x194F ], -- [ 0x19D0, 0x19D9 ], -- [ 0x1A80, 0x1A89 ], -- [ 0x1A90, 0x1A99 ], -- [ 0x1B50, 0x1B59 ], -- [ 0x1BB0, 0x1BB9 ], -- [ 0x1C40, 0x1C49 ], -- [ 0x1C50, 0x1C59 ], -- [ 0xA620, 0xA629 ], -- [ 0xA8D0, 0xA8D9 ], -- [ 0xA900, 0xA909 ], -- [ 0xA9D0, 0xA9D9 ], -- [ 0xAA50, 0xAA59 ], -- [ 0xABF0, 0xABF9 ], -- [ 0xFF10, 0xFF19 ], -- [ 0x104A0, 0x104A9 ], -- [ 0x11066, 0x1106F ], -- [ 0x1D7CE, 0x1D7FF ], -- ]; -- -- static immutable dchar[2][] tableNl = -- [ -- [ 0x16EE, 0x16F0 ], -- [ 0x2160, 0x2182 ], -- [ 0x2185, 0x2188 ], -- [ 0x3007, 0x3007 ], -- [ 0x3021, 0x3029 ], -- [ 0x3038, 0x303A ], -- [ 0xA6E6, 0xA6EF ], -- [ 0x10140, 0x10174 ], -- [ 0x10341, 0x10341 ], -- [ 0x1034A, 0x1034A ], -- [ 0x103D1, 0x103D5 ], -- [ 0x12400, 0x12462 ], -- ]; -- -- static immutable dchar[2][] tableNo = -- [ -- [ 0x00B2, 0x00B3 ], -- [ 0x00B9, 0x00B9 ], -- [ 0x00BC, 0x00BE ], -- [ 0x09F4, 0x09F9 ], -- [ 0x0B72, 0x0B77 ], -- [ 0x0BF0, 0x0BF2 ], -- [ 0x0C78, 0x0C7E ], -- [ 0x0D70, 0x0D75 ], -- [ 0x0F2A, 0x0F33 ], -- [ 0x1369, 0x137C ], -- [ 0x17F0, 0x17F9 ], -- [ 0x19DA, 0x19DA ], -- [ 0x2070, 0x2070 ], -- [ 0x2074, 0x2079 ], -- [ 0x2080, 0x2089 ], -- [ 0x2150, 0x215F ], -- [ 0x2189, 0x2189 ], -- [ 0x2460, 0x249B ], -- [ 0x24EA, 0x24FF ], -- [ 0x2776, 0x2793 ], -- [ 0x2CFD, 0x2CFD ], -- [ 0x3192, 0x3195 ], -- [ 0x3220, 0x3229 ], -- [ 0x3251, 0x325F ], -- [ 0x3280, 0x3289 ], -- [ 0x32B1, 0x32BF ], -- [ 0xA830, 0xA835 ], -- [ 0x10107, 0x10133 ], -- [ 0x10175, 0x10178 ], -- [ 0x1018A, 0x1018A ], -- [ 0x10320, 0x10323 ], -- [ 0x10858, 0x1085F ], -- [ 0x10916, 0x1091B ], -- [ 0x10A40, 0x10A47 ], -- [ 0x10A7D, 0x10A7E ], -- [ 0x10B58, 0x10B5F ], -- [ 0x10B78, 0x10B7F ], -- [ 0x10E60, 0x10E7E ], -- [ 0x11052, 0x11065 ], -- [ 0x1D360, 0x1D371 ], -- [ 0x1F100, 0x1F10A ], -- ]; -- -- return binarySearch!tableNd(c) -- || binarySearch!tableNl(c) -- || binarySearch!tableNo(c); -+ return numberTrie[c]; - } - --unittest -+@safe unittest - { -- for (dchar c = '0'; c < '9'; ++c) -- { -- assert(isNumber(c)); -- } -+ auto n = unicode("N"); -+ foreach(ch; n.byCodepoint) -+ assert(isNumber(ch)); -+ foreach(ch; 0..0x4000) -+ assert((ch in n) == isNumber(ch)); - } - - - /++ -- Returns whether $(D c) is a Unicode punctuation character -+ Returns whether $(D c) is a Unicode punctuation $(CHARACTER) - (general Unicode category: Pd, Ps, Pe, Pc, Po, Pi, Pf). -- -- Standards: Unicode 6.0.0. -- +/ -- --bool isPunctuation(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isPunctuation(dchar c) - { -- static immutable dchar[2][] tablePd = -- [ -- [ 0x002D, 0x002D ], -- [ 0x058A, 0x058A ], -- [ 0x05BE, 0x05BE ], -- [ 0x1400, 0x1400 ], -- [ 0x1806, 0x1806 ], -- [ 0x2010, 0x2015 ], -- [ 0x2E17, 0x2E17 ], -- [ 0x2E1A, 0x2E1A ], -- [ 0x301C, 0x301C ], -- [ 0x3030, 0x3030 ], -- [ 0x30A0, 0x30A0 ], -- [ 0xFE31, 0xFE32 ], -- [ 0xFE58, 0xFE58 ], -- [ 0xFE63, 0xFE63 ], -- [ 0xFF0D, 0xFF0D ], -- ]; -- -- static immutable dchar[2][] tablePs = -- [ -- [ 0x0028, 0x0028 ], -- [ 0x005B, 0x005B ], -- [ 0x007B, 0x007B ], -- [ 0x0F3A, 0x0F3A ], -- [ 0x0F3C, 0x0F3C ], -- [ 0x169B, 0x169B ], -- [ 0x201A, 0x201A ], -- [ 0x201E, 0x201E ], -- [ 0x2045, 0x2045 ], -- [ 0x207D, 0x207D ], -- [ 0x208D, 0x208D ], -- [ 0x2329, 0x2329 ], -- [ 0x2768, 0x2768 ], -- [ 0x276A, 0x276A ], -- [ 0x276C, 0x276C ], -- [ 0x276E, 0x276E ], -- [ 0x2770, 0x2770 ], -- [ 0x2772, 0x2772 ], -- [ 0x2774, 0x2774 ], -- [ 0x27C5, 0x27C5 ], -- [ 0x27E6, 0x27E6 ], -- [ 0x27E8, 0x27E8 ], -- [ 0x27EA, 0x27EA ], -- [ 0x27EC, 0x27EC ], -- [ 0x27EE, 0x27EE ], -- [ 0x2983, 0x2983 ], -- [ 0x2985, 0x2985 ], -- [ 0x2987, 0x2987 ], -- [ 0x2989, 0x2989 ], -- [ 0x298B, 0x298B ], -- [ 0x298D, 0x298D ], -- [ 0x298F, 0x298F ], -- [ 0x2991, 0x2991 ], -- [ 0x2993, 0x2993 ], -- [ 0x2995, 0x2995 ], -- [ 0x2997, 0x2997 ], -- [ 0x29D8, 0x29D8 ], -- [ 0x29DA, 0x29DA ], -- [ 0x29FC, 0x29FC ], -- [ 0x2E22, 0x2E22 ], -- [ 0x2E24, 0x2E24 ], -- [ 0x2E26, 0x2E26 ], -- [ 0x2E28, 0x2E28 ], -- [ 0x3008, 0x3008 ], -- [ 0x300A, 0x300A ], -- [ 0x300C, 0x300C ], -- [ 0x300E, 0x300E ], -- [ 0x3010, 0x3010 ], -- [ 0x3014, 0x3014 ], -- [ 0x3016, 0x3016 ], -- [ 0x3018, 0x3018 ], -- [ 0x301A, 0x301A ], -- [ 0x301D, 0x301D ], -- [ 0xFD3E, 0xFD3E ], -- [ 0xFE17, 0xFE17 ], -- [ 0xFE35, 0xFE35 ], -- [ 0xFE37, 0xFE37 ], -- [ 0xFE39, 0xFE39 ], -- [ 0xFE3B, 0xFE3B ], -- [ 0xFE3D, 0xFE3D ], -- [ 0xFE3F, 0xFE3F ], -- [ 0xFE41, 0xFE41 ], -- [ 0xFE43, 0xFE43 ], -- [ 0xFE47, 0xFE47 ], -- [ 0xFE59, 0xFE59 ], -- [ 0xFE5B, 0xFE5B ], -- [ 0xFE5D, 0xFE5D ], -- [ 0xFF08, 0xFF08 ], -- [ 0xFF3B, 0xFF3B ], -- [ 0xFF5B, 0xFF5B ], -- [ 0xFF5F, 0xFF5F ], -- [ 0xFF62, 0xFF62 ], -- ]; -- -- static immutable dchar[2][] tablePe = -- [ -- [ 0x0029, 0x0029 ], -- [ 0x005D, 0x005D ], -- [ 0x007D, 0x007D ], -- [ 0x0F3B, 0x0F3B ], -- [ 0x0F3D, 0x0F3D ], -- [ 0x169C, 0x169C ], -- [ 0x2046, 0x2046 ], -- [ 0x207E, 0x207E ], -- [ 0x208E, 0x208E ], -- [ 0x232A, 0x232A ], -- [ 0x2769, 0x2769 ], -- [ 0x276B, 0x276B ], -- [ 0x276D, 0x276D ], -- [ 0x276F, 0x276F ], -- [ 0x2771, 0x2771 ], -- [ 0x2773, 0x2773 ], -- [ 0x2775, 0x2775 ], -- [ 0x27C6, 0x27C6 ], -- [ 0x27E7, 0x27E7 ], -- [ 0x27E9, 0x27E9 ], -- [ 0x27EB, 0x27EB ], -- [ 0x27ED, 0x27ED ], -- [ 0x27EF, 0x27EF ], -- [ 0x2984, 0x2984 ], -- [ 0x2986, 0x2986 ], -- [ 0x2988, 0x2988 ], -- [ 0x298A, 0x298A ], -- [ 0x298C, 0x298C ], -- [ 0x298E, 0x298E ], -- [ 0x2990, 0x2990 ], -- [ 0x2992, 0x2992 ], -- [ 0x2994, 0x2994 ], -- [ 0x2996, 0x2996 ], -- [ 0x2998, 0x2998 ], -- [ 0x29D9, 0x29D9 ], -- [ 0x29DB, 0x29DB ], -- [ 0x29FD, 0x29FD ], -- [ 0x2E23, 0x2E23 ], -- [ 0x2E25, 0x2E25 ], -- [ 0x2E27, 0x2E27 ], -- [ 0x2E29, 0x2E29 ], -- [ 0x3009, 0x3009 ], -- [ 0x300B, 0x300B ], -- [ 0x300D, 0x300D ], -- [ 0x300F, 0x300F ], -- [ 0x3011, 0x3011 ], -- [ 0x3015, 0x3015 ], -- [ 0x3017, 0x3017 ], -- [ 0x3019, 0x3019 ], -- [ 0x301B, 0x301B ], -- [ 0x301E, 0x301F ], -- [ 0xFD3F, 0xFD3F ], -- [ 0xFE18, 0xFE18 ], -- [ 0xFE36, 0xFE36 ], -- [ 0xFE38, 0xFE38 ], -- [ 0xFE3A, 0xFE3A ], -- [ 0xFE3C, 0xFE3C ], -- [ 0xFE3E, 0xFE3E ], -- [ 0xFE40, 0xFE40 ], -- [ 0xFE42, 0xFE42 ], -- [ 0xFE44, 0xFE44 ], -- [ 0xFE48, 0xFE48 ], -- [ 0xFE5A, 0xFE5A ], -- [ 0xFE5C, 0xFE5C ], -- [ 0xFE5E, 0xFE5E ], -- [ 0xFF09, 0xFF09 ], -- [ 0xFF3D, 0xFF3D ], -- [ 0xFF5D, 0xFF5D ], -- [ 0xFF60, 0xFF60 ], -- [ 0xFF63, 0xFF63 ], -- ]; -- -- static immutable dchar[2][] tablePc = -- [ -- [ 0x005F, 0x005F ], -- [ 0x203F, 0x2040 ], -- [ 0x2054, 0x2054 ], -- [ 0xFE33, 0xFE34 ], -- [ 0xFE4D, 0xFE4F ], -- [ 0xFF3F, 0xFF3F ], -- ]; -- -- static immutable dchar[2][] tablePo = -- [ -- [ 0x0021, 0x0023 ], -- [ 0x0025, 0x0027 ], -- [ 0x002A, 0x002A ], -- [ 0x002C, 0x002C ], -- [ 0x002E, 0x002F ], -- [ 0x003A, 0x003B ], -- [ 0x003F, 0x0040 ], -- [ 0x005C, 0x005C ], -- [ 0x00A1, 0x00A1 ], -- [ 0x00B7, 0x00B7 ], -- [ 0x00BF, 0x00BF ], -- [ 0x037E, 0x037E ], -- [ 0x0387, 0x0387 ], -- [ 0x055A, 0x055F ], -- [ 0x0589, 0x0589 ], -- [ 0x05C0, 0x05C0 ], -- [ 0x05C3, 0x05C3 ], -- [ 0x05C6, 0x05C6 ], -- [ 0x05F3, 0x05F4 ], -- [ 0x0609, 0x060A ], -- [ 0x060C, 0x060D ], -- [ 0x061B, 0x061B ], -- [ 0x061E, 0x061F ], -- [ 0x066A, 0x066D ], -- [ 0x06D4, 0x06D4 ], -- [ 0x0700, 0x070D ], -- [ 0x07F7, 0x07F9 ], -- [ 0x0830, 0x083E ], -- [ 0x085E, 0x085E ], -- [ 0x0964, 0x0965 ], -- [ 0x0970, 0x0970 ], -- [ 0x0DF4, 0x0DF4 ], -- [ 0x0E4F, 0x0E4F ], -- [ 0x0E5A, 0x0E5B ], -- [ 0x0F04, 0x0F12 ], -- [ 0x0F85, 0x0F85 ], -- [ 0x0FD0, 0x0FD4 ], -- [ 0x0FD9, 0x0FDA ], -- [ 0x104A, 0x104F ], -- [ 0x10FB, 0x10FB ], -- [ 0x1361, 0x1368 ], -- [ 0x166D, 0x166E ], -- [ 0x16EB, 0x16ED ], -- [ 0x1735, 0x1736 ], -- [ 0x17D4, 0x17D6 ], -- [ 0x17D8, 0x17DA ], -- [ 0x1800, 0x1805 ], -- [ 0x1807, 0x180A ], -- [ 0x1944, 0x1945 ], -- [ 0x1A1E, 0x1A1F ], -- [ 0x1AA0, 0x1AA6 ], -- [ 0x1AA8, 0x1AAD ], -- [ 0x1B5A, 0x1B60 ], -- [ 0x1BFC, 0x1BFF ], -- [ 0x1C3B, 0x1C3F ], -- [ 0x1C7E, 0x1C7F ], -- [ 0x1CD3, 0x1CD3 ], -- [ 0x2016, 0x2017 ], -- [ 0x2020, 0x2027 ], -- [ 0x2030, 0x2038 ], -- [ 0x203B, 0x203E ], -- [ 0x2041, 0x2043 ], -- [ 0x2047, 0x2051 ], -- [ 0x2053, 0x2053 ], -- [ 0x2055, 0x205E ], -- [ 0x2CF9, 0x2CFC ], -- [ 0x2CFE, 0x2CFF ], -- [ 0x2D70, 0x2D70 ], -- [ 0x2E00, 0x2E01 ], -- [ 0x2E06, 0x2E08 ], -- [ 0x2E0B, 0x2E0B ], -- [ 0x2E0E, 0x2E16 ], -- [ 0x2E18, 0x2E19 ], -- [ 0x2E1B, 0x2E1B ], -- [ 0x2E1E, 0x2E1F ], -- [ 0x2E2A, 0x2E2E ], -- [ 0x2E30, 0x2E31 ], -- [ 0x3001, 0x3003 ], -- [ 0x303D, 0x303D ], -- [ 0x30FB, 0x30FB ], -- [ 0xA4FE, 0xA4FF ], -- [ 0xA60D, 0xA60F ], -- [ 0xA673, 0xA673 ], -- [ 0xA67E, 0xA67E ], -- [ 0xA6F2, 0xA6F7 ], -- [ 0xA874, 0xA877 ], -- [ 0xA8CE, 0xA8CF ], -- [ 0xA8F8, 0xA8FA ], -- [ 0xA92E, 0xA92F ], -- [ 0xA95F, 0xA95F ], -- [ 0xA9C1, 0xA9CD ], -- [ 0xA9DE, 0xA9DF ], -- [ 0xAA5C, 0xAA5F ], -- [ 0xAADE, 0xAADF ], -- [ 0xABEB, 0xABEB ], -- [ 0xFE10, 0xFE16 ], -- [ 0xFE19, 0xFE19 ], -- [ 0xFE30, 0xFE30 ], -- [ 0xFE45, 0xFE46 ], -- [ 0xFE49, 0xFE4C ], -- [ 0xFE50, 0xFE52 ], -- [ 0xFE54, 0xFE57 ], -- [ 0xFE5F, 0xFE61 ], -- [ 0xFE68, 0xFE68 ], -- [ 0xFE6A, 0xFE6B ], -- [ 0xFF01, 0xFF03 ], -- [ 0xFF05, 0xFF07 ], -- [ 0xFF0A, 0xFF0A ], -- [ 0xFF0C, 0xFF0C ], -- [ 0xFF0E, 0xFF0F ], -- [ 0xFF1A, 0xFF1B ], -- [ 0xFF1F, 0xFF20 ], -- [ 0xFF3C, 0xFF3C ], -- [ 0xFF61, 0xFF61 ], -- [ 0xFF64, 0xFF65 ], -- [ 0x10100, 0x10101 ], -- [ 0x1039F, 0x1039F ], -- [ 0x103D0, 0x103D0 ], -- [ 0x10857, 0x10857 ], -- [ 0x1091F, 0x1091F ], -- [ 0x1093F, 0x1093F ], -- [ 0x10A50, 0x10A58 ], -- [ 0x10A7F, 0x10A7F ], -- [ 0x10B39, 0x10B3F ], -- [ 0x11047, 0x1104D ], -- [ 0x110BB, 0x110BC ], -- [ 0x110BE, 0x110C1 ], -- [ 0x12470, 0x12473 ], -- ]; -- -- static immutable dchar[2][] tablePi = -- [ -- [ 0x00AB, 0x00AB ], -- [ 0x2018, 0x2018 ], -- [ 0x201B, 0x201C ], -- [ 0x201F, 0x201F ], -- [ 0x2039, 0x2039 ], -- [ 0x2E02, 0x2E02 ], -- [ 0x2E04, 0x2E04 ], -- [ 0x2E09, 0x2E09 ], -- [ 0x2E0C, 0x2E0C ], -- [ 0x2E1C, 0x2E1C ], -- [ 0x2E20, 0x2E20 ], -- ]; -- -- static immutable dchar[2][] tablePf = -- [ -- [ 0x00BB, 0x00BB ], -- [ 0x2019, 0x2019 ], -- [ 0x201D, 0x201D ], -- [ 0x203A, 0x203A ], -- [ 0x2E03, 0x2E03 ], -- [ 0x2E05, 0x2E05 ], -- [ 0x2E0A, 0x2E0A ], -- [ 0x2E0D, 0x2E0D ], -- [ 0x2E1D, 0x2E1D ], -- [ 0x2E21, 0x2E21 ], -- ]; -- -- return binarySearch!tablePd(c) -- || binarySearch!tablePs(c) -- || binarySearch!tablePe(c) -- || binarySearch!tablePc(c) -- || binarySearch!tablePo(c) -- || binarySearch!tablePi(c) -- || binarySearch!tablePf(c); -+ return punctuationTrie[c]; - } - - unittest -@@ -1463,1052 +7223,305 @@ unittest - assert(isPunctuation('\u005F')); - assert(isPunctuation('\u00AB')); - assert(isPunctuation('\u00BB')); -+ foreach(ch; unicode("P").byCodepoint) -+ assert(isPunctuation(ch)); - } - -- - /++ -- Returns whether $(D c) is a Unicode symbol character -- (general Unicode category: Sm, Sc, Sk, So) -- -- Standards: Unicode 6.0.0. -- +/ --bool isSymbol(dchar c) @safe pure nothrow --{ -- static immutable dchar[2][] tableSm = -- [ -- [ 0x002B, 0x002B ], -- [ 0x003C, 0x003E ], -- [ 0x007C, 0x007C ], -- [ 0x007E, 0x007E ], -- [ 0x00AC, 0x00AC ], -- [ 0x00B1, 0x00B1 ], -- [ 0x00D7, 0x00D7 ], -- [ 0x00F7, 0x00F7 ], -- [ 0x03F6, 0x03F6 ], -- [ 0x0606, 0x0608 ], -- [ 0x2044, 0x2044 ], -- [ 0x2052, 0x2052 ], -- [ 0x207A, 0x207C ], -- [ 0x208A, 0x208C ], -- [ 0x2118, 0x2118 ], -- [ 0x2140, 0x2144 ], -- [ 0x214B, 0x214B ], -- [ 0x2190, 0x2194 ], -- [ 0x219A, 0x219B ], -- [ 0x21A0, 0x21A0 ], -- [ 0x21A3, 0x21A3 ], -- [ 0x21A6, 0x21A6 ], -- [ 0x21AE, 0x21AE ], -- [ 0x21CE, 0x21CF ], -- [ 0x21D2, 0x21D2 ], -- [ 0x21D4, 0x21D4 ], -- [ 0x21F4, 0x22FF ], -- [ 0x2308, 0x230B ], -- [ 0x2320, 0x2321 ], -- [ 0x237C, 0x237C ], -- [ 0x239B, 0x23B3 ], -- [ 0x23DC, 0x23E1 ], -- [ 0x25B7, 0x25B7 ], -- [ 0x25C1, 0x25C1 ], -- [ 0x25F8, 0x25FF ], -- [ 0x266F, 0x266F ], -- [ 0x27C0, 0x27C4 ], -- [ 0x27C7, 0x27CA ], -- [ 0x27CC, 0x27CC ], -- [ 0x27CE, 0x27E5 ], -- [ 0x27F0, 0x27FF ], -- [ 0x2900, 0x2982 ], -- [ 0x2999, 0x29D7 ], -- [ 0x29DC, 0x29FB ], -- [ 0x29FE, 0x2AFF ], -- [ 0x2B30, 0x2B44 ], -- [ 0x2B47, 0x2B4C ], -- [ 0xFB29, 0xFB29 ], -- [ 0xFE62, 0xFE62 ], -- [ 0xFE64, 0xFE66 ], -- [ 0xFF0B, 0xFF0B ], -- [ 0xFF1C, 0xFF1E ], -- [ 0xFF5C, 0xFF5C ], -- [ 0xFF5E, 0xFF5E ], -- [ 0xFFE2, 0xFFE2 ], -- [ 0xFFE9, 0xFFEC ], -- [ 0x1D6C1, 0x1D6C1 ], -- [ 0x1D6DB, 0x1D6DB ], -- [ 0x1D6FB, 0x1D6FB ], -- [ 0x1D715, 0x1D715 ], -- [ 0x1D735, 0x1D735 ], -- [ 0x1D74F, 0x1D74F ], -- [ 0x1D76F, 0x1D76F ], -- [ 0x1D789, 0x1D789 ], -- [ 0x1D7A9, 0x1D7A9 ], -- [ 0x1D7C3, 0x1D7C3 ], -- ]; -- -- static immutable dchar[2][] tableSc = -- [ -- [ 0x0024, 0x0024 ], -- [ 0x00A2, 0x00A5 ], -- [ 0x060B, 0x060B ], -- [ 0x09F2, 0x09F3 ], -- [ 0x09FB, 0x09FB ], -- [ 0x0AF1, 0x0AF1 ], -- [ 0x0BF9, 0x0BF9 ], -- [ 0x0E3F, 0x0E3F ], -- [ 0x17DB, 0x17DB ], -- [ 0x20A0, 0x20B9 ], -- [ 0xA838, 0xA838 ], -- [ 0xFDFC, 0xFDFC ], -- [ 0xFE69, 0xFE69 ], -- [ 0xFF04, 0xFF04 ], -- [ 0xFFE0, 0xFFE1 ], -- [ 0xFFE5, 0xFFE6 ], -- ]; -- -- static immutable dchar[2][] tableSk = -- [ -- [ 0x005E, 0x005E ], -- [ 0x0060, 0x0060 ], -- [ 0x00A8, 0x00A8 ], -- [ 0x00AF, 0x00AF ], -- [ 0x00B4, 0x00B4 ], -- [ 0x00B8, 0x00B8 ], -- [ 0x02C2, 0x02C5 ], -- [ 0x02D2, 0x02DF ], -- [ 0x02E5, 0x02EB ], -- [ 0x02ED, 0x02ED ], -- [ 0x02EF, 0x02FF ], -- [ 0x0375, 0x0375 ], -- [ 0x0384, 0x0385 ], -- [ 0x1FBD, 0x1FBD ], -- [ 0x1FBF, 0x1FC1 ], -- [ 0x1FCD, 0x1FCF ], -- [ 0x1FDD, 0x1FDF ], -- [ 0x1FED, 0x1FEF ], -- [ 0x1FFD, 0x1FFE ], -- [ 0x309B, 0x309C ], -- [ 0xA700, 0xA716 ], -- [ 0xA720, 0xA721 ], -- [ 0xA789, 0xA78A ], -- [ 0xFBB2, 0xFBC1 ], -- [ 0xFF3E, 0xFF3E ], -- [ 0xFF40, 0xFF40 ], -- [ 0xFFE3, 0xFFE3 ], -- ]; -- -- static immutable dchar[2][] tableSo = -- [ -- [ 0x00A6, 0x00A7 ], -- [ 0x00A9, 0x00A9 ], -- [ 0x00AE, 0x00AE ], -- [ 0x00B0, 0x00B0 ], -- [ 0x00B6, 0x00B6 ], -- [ 0x0482, 0x0482 ], -- [ 0x060E, 0x060F ], -- [ 0x06DE, 0x06DE ], -- [ 0x06E9, 0x06E9 ], -- [ 0x06FD, 0x06FE ], -- [ 0x07F6, 0x07F6 ], -- [ 0x09FA, 0x09FA ], -- [ 0x0B70, 0x0B70 ], -- [ 0x0BF3, 0x0BF8 ], -- [ 0x0BFA, 0x0BFA ], -- [ 0x0C7F, 0x0C7F ], -- [ 0x0D79, 0x0D79 ], -- [ 0x0F01, 0x0F03 ], -- [ 0x0F13, 0x0F17 ], -- [ 0x0F1A, 0x0F1F ], -- [ 0x0F34, 0x0F34 ], -- [ 0x0F36, 0x0F36 ], -- [ 0x0F38, 0x0F38 ], -- [ 0x0FBE, 0x0FC5 ], -- [ 0x0FC7, 0x0FCC ], -- [ 0x0FCE, 0x0FCF ], -- [ 0x0FD5, 0x0FD8 ], -- [ 0x109E, 0x109F ], -- [ 0x1360, 0x1360 ], -- [ 0x1390, 0x1399 ], -- [ 0x1940, 0x1940 ], -- [ 0x19DE, 0x19FF ], -- [ 0x1B61, 0x1B6A ], -- [ 0x1B74, 0x1B7C ], -- [ 0x2100, 0x2101 ], -- [ 0x2103, 0x2106 ], -- [ 0x2108, 0x2109 ], -- [ 0x2114, 0x2114 ], -- [ 0x2116, 0x2117 ], -- [ 0x211E, 0x2123 ], -- [ 0x2125, 0x2125 ], -- [ 0x2127, 0x2127 ], -- [ 0x2129, 0x2129 ], -- [ 0x212E, 0x212E ], -- [ 0x213A, 0x213B ], -- [ 0x214A, 0x214A ], -- [ 0x214C, 0x214D ], -- [ 0x214F, 0x214F ], -- [ 0x2195, 0x2199 ], -- [ 0x219C, 0x219F ], -- [ 0x21A1, 0x21A2 ], -- [ 0x21A4, 0x21A5 ], -- [ 0x21A7, 0x21AD ], -- [ 0x21AF, 0x21CD ], -- [ 0x21D0, 0x21D1 ], -- [ 0x21D3, 0x21D3 ], -- [ 0x21D5, 0x21F3 ], -- [ 0x2300, 0x2307 ], -- [ 0x230C, 0x231F ], -- [ 0x2322, 0x2328 ], -- [ 0x232B, 0x237B ], -- [ 0x237D, 0x239A ], -- [ 0x23B4, 0x23DB ], -- [ 0x23E2, 0x23F3 ], -- [ 0x2400, 0x2426 ], -- [ 0x2440, 0x244A ], -- [ 0x249C, 0x24E9 ], -- [ 0x2500, 0x25B6 ], -- [ 0x25B8, 0x25C0 ], -- [ 0x25C2, 0x25F7 ], -- [ 0x2600, 0x266E ], -- [ 0x2670, 0x26FF ], -- [ 0x2701, 0x2767 ], -- [ 0x2794, 0x27BF ], -- [ 0x2800, 0x28FF ], -- [ 0x2B00, 0x2B2F ], -- [ 0x2B45, 0x2B46 ], -- [ 0x2B50, 0x2B59 ], -- [ 0x2CE5, 0x2CEA ], -- [ 0x2E80, 0x2E99 ], -- [ 0x2E9B, 0x2EF3 ], -- [ 0x2F00, 0x2FD5 ], -- [ 0x2FF0, 0x2FFB ], -- [ 0x3004, 0x3004 ], -- [ 0x3012, 0x3013 ], -- [ 0x3020, 0x3020 ], -- [ 0x3036, 0x3037 ], -- [ 0x303E, 0x303F ], -- [ 0x3190, 0x3191 ], -- [ 0x3196, 0x319F ], -- [ 0x31C0, 0x31E3 ], -- [ 0x3200, 0x321E ], -- [ 0x322A, 0x3250 ], -- [ 0x3260, 0x327F ], -- [ 0x328A, 0x32B0 ], -- [ 0x32C0, 0x32FE ], -- [ 0x3300, 0x33FF ], -- [ 0x4DC0, 0x4DFF ], -- [ 0xA490, 0xA4C6 ], -- [ 0xA828, 0xA82B ], -- [ 0xA836, 0xA837 ], -- [ 0xA839, 0xA839 ], -- [ 0xAA77, 0xAA79 ], -- [ 0xFDFD, 0xFDFD ], -- [ 0xFFE4, 0xFFE4 ], -- [ 0xFFE8, 0xFFE8 ], -- [ 0xFFED, 0xFFEE ], -- [ 0xFFFC, 0xFFFD ], -- [ 0x10102, 0x10102 ], -- [ 0x10137, 0x1013F ], -- [ 0x10179, 0x10189 ], -- [ 0x10190, 0x1019B ], -- [ 0x101D0, 0x101FC ], -- [ 0x1D000, 0x1D0F5 ], -- [ 0x1D100, 0x1D126 ], -- [ 0x1D129, 0x1D164 ], -- [ 0x1D16A, 0x1D16C ], -- [ 0x1D183, 0x1D184 ], -- [ 0x1D18C, 0x1D1A9 ], -- [ 0x1D1AE, 0x1D1DD ], -- [ 0x1D200, 0x1D241 ], -- [ 0x1D245, 0x1D245 ], -- [ 0x1D300, 0x1D356 ], -- [ 0x1F000, 0x1F02B ], -- [ 0x1F030, 0x1F093 ], -- [ 0x1F0A0, 0x1F0AE ], -- [ 0x1F0B1, 0x1F0BE ], -- [ 0x1F0C1, 0x1F0CF ], -- [ 0x1F0D1, 0x1F0DF ], -- [ 0x1F110, 0x1F12E ], -- [ 0x1F130, 0x1F169 ], -- [ 0x1F170, 0x1F19A ], -- [ 0x1F1E6, 0x1F202 ], -- [ 0x1F210, 0x1F23A ], -- [ 0x1F240, 0x1F248 ], -- [ 0x1F250, 0x1F251 ], -- [ 0x1F300, 0x1F320 ], -- [ 0x1F330, 0x1F335 ], -- [ 0x1F337, 0x1F37C ], -- [ 0x1F380, 0x1F393 ], -- [ 0x1F3A0, 0x1F3C4 ], -- [ 0x1F3C6, 0x1F3CA ], -- [ 0x1F3E0, 0x1F3F0 ], -- [ 0x1F400, 0x1F43E ], -- [ 0x1F440, 0x1F440 ], -- [ 0x1F442, 0x1F4F7 ], -- [ 0x1F4F9, 0x1F4FC ], -- [ 0x1F500, 0x1F53D ], -- [ 0x1F550, 0x1F567 ], -- [ 0x1F5FB, 0x1F5FF ], -- [ 0x1F601, 0x1F610 ], -- [ 0x1F612, 0x1F614 ], -- [ 0x1F616, 0x1F616 ], -- [ 0x1F618, 0x1F618 ], -- [ 0x1F61A, 0x1F61A ], -- [ 0x1F61C, 0x1F61E ], -- [ 0x1F620, 0x1F625 ], -- [ 0x1F628, 0x1F62B ], -- [ 0x1F62D, 0x1F62D ], -- [ 0x1F630, 0x1F633 ], -- [ 0x1F635, 0x1F640 ], -- [ 0x1F645, 0x1F64F ], -- [ 0x1F680, 0x1F6C5 ], -- [ 0x1F700, 0x1F773 ], -- ]; -- -- return binarySearch!tableSm(c) -- || binarySearch!tableSc(c) -- || binarySearch!tableSk(c) -- || binarySearch!tableSo(c); -+ Returns whether $(D c) is a Unicode symbol $(CHARACTER) -+ (general Unicode category: Sm, Sc, Sk, So). -++/ -+@safe pure nothrow -+bool isSymbol(dchar c) -+{ -+ return symbolTrie[c]; - } - - unittest - { -+ import std.string; - assert(isSymbol('\u0024')); - assert(isSymbol('\u002B')); - assert(isSymbol('\u005E')); - assert(isSymbol('\u00A6')); -+ foreach(ch; unicode("S").byCodepoint) -+ assert(isSymbol(ch), format("%04x", ch)); - } - -- - /++ -- Returns whether $(D c) is a Unicode whitespace character -+ Returns whether $(D c) is a Unicode space $(CHARACTER) - (general Unicode category: Zs) -- -- Standards: Unicode 6.0.0. -- +/ --bool isSpace(dchar c) @safe pure nothrow --{ -- return (c == 0x0020 || -- c == 0x00A0 || c == 0x1680 || c == 0x180E || -- (0x2000 <= c && c <= 0x200A) || -- c == 0x202F || c == 0x205F || c == 0x3000); -+ Note: This doesn't include '\n', '\r', \t' and other non-space $(CHARACTER). -+ For commonly used less strict semantics see $(LREF isWhite). -++/ -+@safe pure nothrow -+bool isSpace(dchar c) -+{ -+ return isSpaceGen(c); - } - - unittest - { - assert(isSpace('\u0020')); -+ auto space = unicode.Zs; -+ foreach(ch; space.byCodepoint) -+ assert(isSpace(ch)); -+ foreach(ch; 0..0x1000) -+ assert(isSpace(ch) == space[ch]); - } - - - /++ -- Returns whether $(D c) is a Unicode graphical character -+ Returns whether $(D c) is a Unicode graphical $(CHARACTER) - (general Unicode category: L, M, N, P, S, Zs). - -- Standards: Unicode 6.0.0. -- +/ -- --bool isGraphical(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isGraphical(dchar c) - { -- return isAlpha(c) || isNumber(c) || isSpace(c) -- || isMark(c) || isPunctuation(c) || isSymbol(c); -+ return graphicalTrie[c]; - } - -+ - unittest - { -+ auto set = unicode("Graphical"); -+ import std.string; -+ foreach(ch; set.byCodepoint) -+ assert(isGraphical(ch), format("%4x", ch)); -+ foreach(ch; 0..0x4000) -+ assert((ch in set) == isGraphical(ch)); - } - - - /++ -- Returns whether $(D c) is a Unicode control character -- (general Unicode category: Cc) -- -- Standards: Unicode 6.0.0. -- +/ -- --bool isControl(dchar c) @safe pure nothrow -+ Returns whether $(D c) is a Unicode control $(CHARACTER) -+ (general Unicode category: Cc). -++/ -+@safe pure nothrow -+bool isControl(dchar c) - { -- return (c <= 0x1F || (0x80 <= c && c <= 0x9F)); -+ return isControlGen(c); - } - - unittest - { - assert(isControl('\u0000')); -+ assert(isControl('\u0081')); -+ assert(!isControl('\u0100')); -+ auto cc = unicode.Cc; -+ foreach(ch; cc.byCodepoint) -+ assert(isControl(ch)); -+ foreach(ch; 0..0x1000) -+ assert(isControl(ch) == cc[ch]); - } - - - /++ -- Returns whether $(D c) is a Unicode formatting character -- (general Unicode category: Cf) -- -- Standards: Unicode 6.0.0. -- +/ --bool isFormat(dchar c) @safe pure nothrow --{ -- static immutable dchar[2][] tableCf = -- [ -- [ 0x00AD, 0x00AD ], -- [ 0x0600, 0x0603 ], -- [ 0x06DD, 0x06DD ], -- [ 0x070F, 0x070F ], -- [ 0x17B4, 0x17B5 ], -- [ 0x200B, 0x200F ], -- [ 0x202A, 0x202E ], -- [ 0x2060, 0x2064 ], -- [ 0x206A, 0x206F ], -- [ 0xFEFF, 0xFEFF ], -- [ 0xFFF9, 0xFFFB ], -- [ 0x110BD, 0x110BD ], -- [ 0x1D173, 0x1D17A ], -- [ 0xE0001, 0xE0001 ], -- [ 0xE0020, 0xE007F ], -- ]; -- -- return binarySearch!tableCf(c); -+ Returns whether $(D c) is a Unicode formatting $(CHARACTER) -+ (general Unicode category: Cf). -++/ -+@safe pure nothrow -+bool isFormat(dchar c) -+{ -+ return isFormatGen(c); - } - -+ - unittest - { - assert(isFormat('\u00AD')); -+ foreach(ch; unicode("Format").byCodepoint) -+ assert(isFormat(ch)); - } - -+// code points for private use, surrogates are not likely to change in near feature -+// if need be they can be generated from unicode data as well - - /++ -- Returns whether $(D c) is a Unicode Private Use character -- (general Unicode category: Co) -- -- Standards: Unicode 6.0.0. -- +/ --bool isPrivateUse(dchar c) @safe pure nothrow -+ Returns whether $(D c) is a Unicode Private Use $(CODEPOINT) -+ (general Unicode category: Co). -++/ -+@safe pure nothrow -+bool isPrivateUse(dchar c) - { - return (0x00_E000 <= c && c <= 0x00_F8FF) - || (0x0F_0000 <= c && c <= 0x0F_FFFD) - || (0x10_0000 <= c && c <= 0x10_FFFD); - } - -- --unittest --{ --} -- -- - /++ -- Returns whether $(D c) is a Unicode surrogate character -- (general Unicode category: Cs) -- -- Standards: Unicode 6.0.0. -- +/ --bool isSurrogate(dchar c) @safe pure nothrow -+ Returns whether $(D c) is a Unicode surrogate $(CODEPOINT) -+ (general Unicode category: Cs). -++/ -+@safe pure nothrow -+bool isSurrogate(dchar c) - { - return (0xD800 <= c && c <= 0xDFFF); - } - - /++ - Returns whether $(D c) is a Unicode high surrogate (lead surrogate). -- -- Standards: Unicode 2.0. -- +/ --bool isSurrogateHi(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isSurrogateHi(dchar c) - { - return (0xD800 <= c && c <= 0xDBFF); - } - - /++ - Returns whether $(D c) is a Unicode low surrogate (trail surrogate). -- -- Standards: Unicode 2.0. -- +/ --bool isSurrogateLo(dchar c) @safe pure nothrow -++/ -+@safe pure nothrow -+bool isSurrogateLo(dchar c) - { - return (0xDC00 <= c && c <= 0xDFFF); - } - --unittest -+/++ -+ Returns whether $(D c) is a Unicode non-character i.e. -+ a $(CODEPOINT) with no assigned abstract character. -+ (general Unicode category: Cn) -++/ -+@safe pure nothrow -+bool isNonCharacter(dchar c) - { -+ return nonCharacterTrie[c]; - } - -+unittest -+{ -+ auto set = unicode("Cn"); -+ foreach(ch; set.byCodepoint) -+ assert(isNonCharacter(ch)); -+} - --/++ -- Returns whether $(D c) is a Unicode non-character -- (general Unicode category: Cn) -+private: -+// load static data from pre-generated tables into usable datastructures - -- Standards: Unicode 6.0.0. -- +/ --bool isNonCharacter(dchar c) @safe pure nothrow --{ -- static immutable dchar[2][] table = -- [ -- [ 0x0378, 0x0379 ], -- [ 0x037F, 0x0383 ], -- [ 0x038B, 0x038B ], -- [ 0x038D, 0x038D ], -- [ 0x03A2, 0x03A2 ], -- [ 0x0528, 0x0530 ], -- [ 0x0557, 0x0558 ], -- [ 0x0560, 0x0560 ], -- [ 0x0588, 0x0588 ], -- [ 0x058B, 0x0590 ], -- [ 0x05C8, 0x05CF ], -- [ 0x05EB, 0x05EF ], -- [ 0x05F5, 0x05FF ], -- [ 0x0604, 0x0605 ], -- [ 0x061C, 0x061D ], -- [ 0x070E, 0x070E ], -- [ 0x074B, 0x074C ], -- [ 0x07B2, 0x07BF ], -- [ 0x07FB, 0x07FF ], -- [ 0x082E, 0x082F ], -- [ 0x083F, 0x083F ], -- [ 0x085C, 0x085D ], -- [ 0x085F, 0x08FF ], -- [ 0x0978, 0x0978 ], -- [ 0x0980, 0x0980 ], -- [ 0x0984, 0x0984 ], -- [ 0x098D, 0x098E ], -- [ 0x0991, 0x0992 ], -- [ 0x09A9, 0x09A9 ], -- [ 0x09B1, 0x09B1 ], -- [ 0x09B3, 0x09B5 ], -- [ 0x09BA, 0x09BB ], -- [ 0x09C5, 0x09C6 ], -- [ 0x09C9, 0x09CA ], -- [ 0x09CF, 0x09D6 ], -- [ 0x09D8, 0x09DB ], -- [ 0x09DE, 0x09DE ], -- [ 0x09E4, 0x09E5 ], -- [ 0x09FC, 0x0A00 ], -- [ 0x0A04, 0x0A04 ], -- [ 0x0A0B, 0x0A0E ], -- [ 0x0A11, 0x0A12 ], -- [ 0x0A29, 0x0A29 ], -- [ 0x0A31, 0x0A31 ], -- [ 0x0A34, 0x0A34 ], -- [ 0x0A37, 0x0A37 ], -- [ 0x0A3A, 0x0A3B ], -- [ 0x0A3D, 0x0A3D ], -- [ 0x0A43, 0x0A46 ], -- [ 0x0A49, 0x0A4A ], -- [ 0x0A4E, 0x0A50 ], -- [ 0x0A52, 0x0A58 ], -- [ 0x0A5D, 0x0A5D ], -- [ 0x0A5F, 0x0A65 ], -- [ 0x0A76, 0x0A80 ], -- [ 0x0A84, 0x0A84 ], -- [ 0x0A8E, 0x0A8E ], -- [ 0x0A92, 0x0A92 ], -- [ 0x0AA9, 0x0AA9 ], -- [ 0x0AB1, 0x0AB1 ], -- [ 0x0AB4, 0x0AB4 ], -- [ 0x0ABA, 0x0ABB ], -- [ 0x0AC6, 0x0AC6 ], -- [ 0x0ACA, 0x0ACA ], -- [ 0x0ACE, 0x0ACF ], -- [ 0x0AD1, 0x0ADF ], -- [ 0x0AE4, 0x0AE5 ], -- [ 0x0AF0, 0x0AF0 ], -- [ 0x0AF2, 0x0B00 ], -- [ 0x0B04, 0x0B04 ], -- [ 0x0B0D, 0x0B0E ], -- [ 0x0B11, 0x0B12 ], -- [ 0x0B29, 0x0B29 ], -- [ 0x0B31, 0x0B31 ], -- [ 0x0B34, 0x0B34 ], -- [ 0x0B3A, 0x0B3B ], -- [ 0x0B45, 0x0B46 ], -- [ 0x0B49, 0x0B4A ], -- [ 0x0B4E, 0x0B55 ], -- [ 0x0B58, 0x0B5B ], -- [ 0x0B5E, 0x0B5E ], -- [ 0x0B64, 0x0B65 ], -- [ 0x0B78, 0x0B81 ], -- [ 0x0B84, 0x0B84 ], -- [ 0x0B8B, 0x0B8D ], -- [ 0x0B91, 0x0B91 ], -- [ 0x0B96, 0x0B98 ], -- [ 0x0B9B, 0x0B9B ], -- [ 0x0B9D, 0x0B9D ], -- [ 0x0BA0, 0x0BA2 ], -- [ 0x0BA5, 0x0BA7 ], -- [ 0x0BAB, 0x0BAD ], -- [ 0x0BBA, 0x0BBD ], -- [ 0x0BC3, 0x0BC5 ], -- [ 0x0BC9, 0x0BC9 ], -- [ 0x0BCE, 0x0BCF ], -- [ 0x0BD1, 0x0BD6 ], -- [ 0x0BD8, 0x0BE5 ], -- [ 0x0BFB, 0x0C00 ], -- [ 0x0C04, 0x0C04 ], -- [ 0x0C0D, 0x0C0D ], -- [ 0x0C11, 0x0C11 ], -- [ 0x0C29, 0x0C29 ], -- [ 0x0C34, 0x0C34 ], -- [ 0x0C3A, 0x0C3C ], -- [ 0x0C45, 0x0C45 ], -- [ 0x0C49, 0x0C49 ], -- [ 0x0C4E, 0x0C54 ], -- [ 0x0C57, 0x0C57 ], -- [ 0x0C5A, 0x0C5F ], -- [ 0x0C64, 0x0C65 ], -- [ 0x0C70, 0x0C77 ], -- [ 0x0C80, 0x0C81 ], -- [ 0x0C84, 0x0C84 ], -- [ 0x0C8D, 0x0C8D ], -- [ 0x0C91, 0x0C91 ], -- [ 0x0CA9, 0x0CA9 ], -- [ 0x0CB4, 0x0CB4 ], -- [ 0x0CBA, 0x0CBB ], -- [ 0x0CC5, 0x0CC5 ], -- [ 0x0CC9, 0x0CC9 ], -- [ 0x0CCE, 0x0CD4 ], -- [ 0x0CD7, 0x0CDD ], -- [ 0x0CDF, 0x0CDF ], -- [ 0x0CE4, 0x0CE5 ], -- [ 0x0CF0, 0x0CF0 ], -- [ 0x0CF3, 0x0D01 ], -- [ 0x0D04, 0x0D04 ], -- [ 0x0D0D, 0x0D0D ], -- [ 0x0D11, 0x0D11 ], -- [ 0x0D3B, 0x0D3C ], -- [ 0x0D45, 0x0D45 ], -- [ 0x0D49, 0x0D49 ], -- [ 0x0D4F, 0x0D56 ], -- [ 0x0D58, 0x0D5F ], -- [ 0x0D64, 0x0D65 ], -- [ 0x0D76, 0x0D78 ], -- [ 0x0D80, 0x0D81 ], -- [ 0x0D84, 0x0D84 ], -- [ 0x0D97, 0x0D99 ], -- [ 0x0DB2, 0x0DB2 ], -- [ 0x0DBC, 0x0DBC ], -- [ 0x0DBE, 0x0DBF ], -- [ 0x0DC7, 0x0DC9 ], -- [ 0x0DCB, 0x0DCE ], -- [ 0x0DD5, 0x0DD5 ], -- [ 0x0DD7, 0x0DD7 ], -- [ 0x0DE0, 0x0DF1 ], -- [ 0x0DF5, 0x0E00 ], -- [ 0x0E3B, 0x0E3E ], -- [ 0x0E5C, 0x0E80 ], -- [ 0x0E83, 0x0E83 ], -- [ 0x0E85, 0x0E86 ], -- [ 0x0E89, 0x0E89 ], -- [ 0x0E8B, 0x0E8C ], -- [ 0x0E8E, 0x0E93 ], -- [ 0x0E98, 0x0E98 ], -- [ 0x0EA0, 0x0EA0 ], -- [ 0x0EA4, 0x0EA4 ], -- [ 0x0EA6, 0x0EA6 ], -- [ 0x0EA8, 0x0EA9 ], -- [ 0x0EAC, 0x0EAC ], -- [ 0x0EBA, 0x0EBA ], -- [ 0x0EBE, 0x0EBF ], -- [ 0x0EC5, 0x0EC5 ], -- [ 0x0EC7, 0x0EC7 ], -- [ 0x0ECE, 0x0ECF ], -- [ 0x0EDA, 0x0EDB ], -- [ 0x0EDE, 0x0EFF ], -- [ 0x0F48, 0x0F48 ], -- [ 0x0F6D, 0x0F70 ], -- [ 0x0F98, 0x0F98 ], -- [ 0x0FBD, 0x0FBD ], -- [ 0x0FCD, 0x0FCD ], -- [ 0x0FDB, 0x0FFF ], -- [ 0x10C6, 0x10CF ], -- [ 0x10FD, 0x10FF ], -- [ 0x1249, 0x1249 ], -- [ 0x124E, 0x124F ], -- [ 0x1257, 0x1257 ], -- [ 0x1259, 0x1259 ], -- [ 0x125E, 0x125F ], -- [ 0x1289, 0x1289 ], -- [ 0x128E, 0x128F ], -- [ 0x12B1, 0x12B1 ], -- [ 0x12B6, 0x12B7 ], -- [ 0x12BF, 0x12BF ], -- [ 0x12C1, 0x12C1 ], -- [ 0x12C6, 0x12C7 ], -- [ 0x12D7, 0x12D7 ], -- [ 0x1311, 0x1311 ], -- [ 0x1316, 0x1317 ], -- [ 0x135B, 0x135C ], -- [ 0x137D, 0x137F ], -- [ 0x139A, 0x139F ], -- [ 0x13F5, 0x13FF ], -- [ 0x169D, 0x169F ], -- [ 0x16F1, 0x16FF ], -- [ 0x170D, 0x170D ], -- [ 0x1715, 0x171F ], -- [ 0x1737, 0x173F ], -- [ 0x1754, 0x175F ], -- [ 0x176D, 0x176D ], -- [ 0x1771, 0x1771 ], -- [ 0x1774, 0x177F ], -- [ 0x17DE, 0x17DF ], -- [ 0x17EA, 0x17EF ], -- [ 0x17FA, 0x17FF ], -- [ 0x180F, 0x180F ], -- [ 0x181A, 0x181F ], -- [ 0x1878, 0x187F ], -- [ 0x18AB, 0x18AF ], -- [ 0x18F6, 0x18FF ], -- [ 0x191D, 0x191F ], -- [ 0x192C, 0x192F ], -- [ 0x193C, 0x193F ], -- [ 0x1941, 0x1943 ], -- [ 0x196E, 0x196F ], -- [ 0x1975, 0x197F ], -- [ 0x19AC, 0x19AF ], -- [ 0x19CA, 0x19CF ], -- [ 0x19DB, 0x19DD ], -- [ 0x1A1C, 0x1A1D ], -- [ 0x1A5F, 0x1A5F ], -- [ 0x1A7D, 0x1A7E ], -- [ 0x1A8A, 0x1A8F ], -- [ 0x1A9A, 0x1A9F ], -- [ 0x1AAE, 0x1AFF ], -- [ 0x1B4C, 0x1B4F ], -- [ 0x1B7D, 0x1B7F ], -- [ 0x1BAB, 0x1BAD ], -- [ 0x1BBA, 0x1BBF ], -- [ 0x1BF4, 0x1BFB ], -- [ 0x1C38, 0x1C3A ], -- [ 0x1C4A, 0x1C4C ], -- [ 0x1C80, 0x1CCF ], -- [ 0x1CF3, 0x1CFF ], -- [ 0x1DE7, 0x1DFB ], -- [ 0x1F16, 0x1F17 ], -- [ 0x1F1E, 0x1F1F ], -- [ 0x1F46, 0x1F47 ], -- [ 0x1F4E, 0x1F4F ], -- [ 0x1F58, 0x1F58 ], -- [ 0x1F5A, 0x1F5A ], -- [ 0x1F5C, 0x1F5C ], -- [ 0x1F5E, 0x1F5E ], -- [ 0x1F7E, 0x1F7F ], -- [ 0x1FB5, 0x1FB5 ], -- [ 0x1FC5, 0x1FC5 ], -- [ 0x1FD4, 0x1FD5 ], -- [ 0x1FDC, 0x1FDC ], -- [ 0x1FF0, 0x1FF1 ], -- [ 0x1FF5, 0x1FF5 ], -- [ 0x1FFF, 0x1FFF ], -- [ 0x2065, 0x2069 ], -- [ 0x2072, 0x2073 ], -- [ 0x208F, 0x208F ], -- [ 0x209D, 0x209F ], -- [ 0x20BA, 0x20CF ], -- [ 0x20F1, 0x20FF ], -- [ 0x218A, 0x218F ], -- [ 0x23F4, 0x23FF ], -- [ 0x2427, 0x243F ], -- [ 0x244B, 0x245F ], -- [ 0x2700, 0x2700 ], -- [ 0x27CB, 0x27CB ], -- [ 0x27CD, 0x27CD ], -- [ 0x2B4D, 0x2B4F ], -- [ 0x2B5A, 0x2BFF ], -- [ 0x2C2F, 0x2C2F ], -- [ 0x2C5F, 0x2C5F ], -- [ 0x2CF2, 0x2CF8 ], -- [ 0x2D26, 0x2D2F ], -- [ 0x2D66, 0x2D6E ], -- [ 0x2D71, 0x2D7E ], -- [ 0x2D97, 0x2D9F ], -- [ 0x2DA7, 0x2DA7 ], -- [ 0x2DAF, 0x2DAF ], -- [ 0x2DB7, 0x2DB7 ], -- [ 0x2DBF, 0x2DBF ], -- [ 0x2DC7, 0x2DC7 ], -- [ 0x2DCF, 0x2DCF ], -- [ 0x2DD7, 0x2DD7 ], -- [ 0x2DDF, 0x2DDF ], -- [ 0x2E32, 0x2E7F ], -- [ 0x2E9A, 0x2E9A ], -- [ 0x2EF4, 0x2EFF ], -- [ 0x2FD6, 0x2FEF ], -- [ 0x2FFC, 0x2FFF ], -- [ 0x3040, 0x3040 ], -- [ 0x3097, 0x3098 ], -- [ 0x3100, 0x3104 ], -- [ 0x312E, 0x3130 ], -- [ 0x318F, 0x318F ], -- [ 0x31BB, 0x31BF ], -- [ 0x31E4, 0x31EF ], -- [ 0x321F, 0x321F ], -- [ 0x32FF, 0x32FF ], -- [ 0x4DB6, 0x4DBF ], -- [ 0x9FCC, 0x9FFF ], -- [ 0xA48D, 0xA48F ], -- [ 0xA4C7, 0xA4CF ], -- [ 0xA62C, 0xA63F ], -- [ 0xA674, 0xA67B ], -- [ 0xA698, 0xA69F ], -- [ 0xA6F8, 0xA6FF ], -- [ 0xA78F, 0xA78F ], -- [ 0xA792, 0xA79F ], -- [ 0xA7AA, 0xA7F9 ], -- [ 0xA82C, 0xA82F ], -- [ 0xA83A, 0xA83F ], -- [ 0xA878, 0xA87F ], -- [ 0xA8C5, 0xA8CD ], -- [ 0xA8DA, 0xA8DF ], -- [ 0xA8FC, 0xA8FF ], -- [ 0xA954, 0xA95E ], -- [ 0xA97D, 0xA97F ], -- [ 0xA9CE, 0xA9CE ], -- [ 0xA9DA, 0xA9DD ], -- [ 0xA9E0, 0xA9FF ], -- [ 0xAA37, 0xAA3F ], -- [ 0xAA4E, 0xAA4F ], -- [ 0xAA5A, 0xAA5B ], -- [ 0xAA7C, 0xAA7F ], -- [ 0xAAC3, 0xAADA ], -- [ 0xAAE0, 0xAB00 ], -- [ 0xAB07, 0xAB08 ], -- [ 0xAB0F, 0xAB10 ], -- [ 0xAB17, 0xAB1F ], -- [ 0xAB27, 0xAB27 ], -- [ 0xAB2F, 0xABBF ], -- [ 0xABEE, 0xABEF ], -- [ 0xABFA, 0xABFF ], -- [ 0xD7A4, 0xD7AF ], -- [ 0xD7C7, 0xD7CA ], -- [ 0xD7FC, 0xD7FF ], -- [ 0xFA2E, 0xFA2F ], -- [ 0xFA6E, 0xFA6F ], -- [ 0xFADA, 0xFAFF ], -- [ 0xFB07, 0xFB12 ], -- [ 0xFB18, 0xFB1C ], -- [ 0xFB37, 0xFB37 ], -- [ 0xFB3D, 0xFB3D ], -- [ 0xFB3F, 0xFB3F ], -- [ 0xFB42, 0xFB42 ], -- [ 0xFB45, 0xFB45 ], -- [ 0xFBC2, 0xFBD2 ], -- [ 0xFD40, 0xFD4F ], -- [ 0xFD90, 0xFD91 ], -- [ 0xFDC8, 0xFDEF ], -- [ 0xFDFE, 0xFDFF ], -- [ 0xFE1A, 0xFE1F ], -- [ 0xFE27, 0xFE2F ], -- [ 0xFE53, 0xFE53 ], -- [ 0xFE67, 0xFE67 ], -- [ 0xFE6C, 0xFE6F ], -- [ 0xFE75, 0xFE75 ], -- [ 0xFEFD, 0xFEFE ], -- [ 0xFF00, 0xFF00 ], -- [ 0xFFBF, 0xFFC1 ], -- [ 0xFFC8, 0xFFC9 ], -- [ 0xFFD0, 0xFFD1 ], -- [ 0xFFD8, 0xFFD9 ], -- [ 0xFFDD, 0xFFDF ], -- [ 0xFFE7, 0xFFE7 ], -- [ 0xFFEF, 0xFFF8 ], -- [ 0xFFFE, 0xFFFF ], -- [ 0x1000C, 0x1000C ], -- [ 0x10027, 0x10027 ], -- [ 0x1003B, 0x1003B ], -- [ 0x1003E, 0x1003E ], -- [ 0x1004E, 0x1004F ], -- [ 0x1005E, 0x1007F ], -- [ 0x100FB, 0x100FF ], -- [ 0x10103, 0x10106 ], -- [ 0x10134, 0x10136 ], -- [ 0x1018B, 0x1018F ], -- [ 0x1019C, 0x101CF ], -- [ 0x101FE, 0x1027F ], -- [ 0x1029D, 0x1029F ], -- [ 0x102D1, 0x102FF ], -- [ 0x1031F, 0x1031F ], -- [ 0x10324, 0x1032F ], -- [ 0x1034B, 0x1037F ], -- [ 0x1039E, 0x1039E ], -- [ 0x103C4, 0x103C7 ], -- [ 0x103D6, 0x103FF ], -- [ 0x1049E, 0x1049F ], -- [ 0x104AA, 0x107FF ], -- [ 0x10806, 0x10807 ], -- [ 0x10809, 0x10809 ], -- [ 0x10836, 0x10836 ], -- [ 0x10839, 0x1083B ], -- [ 0x1083D, 0x1083E ], -- [ 0x10856, 0x10856 ], -- [ 0x10860, 0x108FF ], -- [ 0x1091C, 0x1091E ], -- [ 0x1093A, 0x1093E ], -- [ 0x10940, 0x109FF ], -- [ 0x10A04, 0x10A04 ], -- [ 0x10A07, 0x10A0B ], -- [ 0x10A14, 0x10A14 ], -- [ 0x10A18, 0x10A18 ], -- [ 0x10A34, 0x10A37 ], -- [ 0x10A3B, 0x10A3E ], -- [ 0x10A48, 0x10A4F ], -- [ 0x10A59, 0x10A5F ], -- [ 0x10A80, 0x10AFF ], -- [ 0x10B36, 0x10B38 ], -- [ 0x10B56, 0x10B57 ], -- [ 0x10B73, 0x10B77 ], -- [ 0x10B80, 0x10BFF ], -- [ 0x10C49, 0x10E5F ], -- [ 0x10E7F, 0x10FFF ], -- [ 0x1104E, 0x11051 ], -- [ 0x11070, 0x1107F ], -- [ 0x110C2, 0x11FFF ], -- [ 0x1236F, 0x123FF ], -- [ 0x12463, 0x1246F ], -- [ 0x12474, 0x12FFF ], -- [ 0x1342F, 0x167FF ], -- [ 0x16A39, 0x1AFFF ], -- [ 0x1B002, 0x1CFFF ], -- [ 0x1D0F6, 0x1D0FF ], -- [ 0x1D127, 0x1D128 ], -- [ 0x1D1DE, 0x1D1FF ], -- [ 0x1D246, 0x1D2FF ], -- [ 0x1D357, 0x1D35F ], -- [ 0x1D372, 0x1D3FF ], -- [ 0x1D455, 0x1D455 ], -- [ 0x1D49D, 0x1D49D ], -- [ 0x1D4A0, 0x1D4A1 ], -- [ 0x1D4A3, 0x1D4A4 ], -- [ 0x1D4A7, 0x1D4A8 ], -- [ 0x1D4AD, 0x1D4AD ], -- [ 0x1D4BA, 0x1D4BA ], -- [ 0x1D4BC, 0x1D4BC ], -- [ 0x1D4C4, 0x1D4C4 ], -- [ 0x1D506, 0x1D506 ], -- [ 0x1D50B, 0x1D50C ], -- [ 0x1D515, 0x1D515 ], -- [ 0x1D51D, 0x1D51D ], -- [ 0x1D53A, 0x1D53A ], -- [ 0x1D53F, 0x1D53F ], -- [ 0x1D545, 0x1D545 ], -- [ 0x1D547, 0x1D549 ], -- [ 0x1D551, 0x1D551 ], -- [ 0x1D6A6, 0x1D6A7 ], -- [ 0x1D7CC, 0x1D7CD ], -- [ 0x1D800, 0x1EFFF ], -- [ 0x1F02C, 0x1F02F ], -- [ 0x1F094, 0x1F09F ], -- [ 0x1F0AF, 0x1F0B0 ], -- [ 0x1F0BF, 0x1F0C0 ], -- [ 0x1F0D0, 0x1F0D0 ], -- [ 0x1F0E0, 0x1F0FF ], -- [ 0x1F10B, 0x1F10F ], -- [ 0x1F12F, 0x1F12F ], -- [ 0x1F16A, 0x1F16F ], -- [ 0x1F19B, 0x1F1E5 ], -- [ 0x1F203, 0x1F20F ], -- [ 0x1F23B, 0x1F23F ], -- [ 0x1F249, 0x1F24F ], -- [ 0x1F252, 0x1F2FF ], -- [ 0x1F321, 0x1F32F ], -- [ 0x1F336, 0x1F336 ], -- [ 0x1F37D, 0x1F37F ], -- [ 0x1F394, 0x1F39F ], -- [ 0x1F3C5, 0x1F3C5 ], -- [ 0x1F3CB, 0x1F3DF ], -- [ 0x1F3F1, 0x1F3FF ], -- [ 0x1F43F, 0x1F43F ], -- [ 0x1F441, 0x1F441 ], -- [ 0x1F4F8, 0x1F4F8 ], -- [ 0x1F4FD, 0x1F4FF ], -- [ 0x1F53E, 0x1F54F ], -- [ 0x1F568, 0x1F5FA ], -- [ 0x1F600, 0x1F600 ], -- [ 0x1F611, 0x1F611 ], -- [ 0x1F615, 0x1F615 ], -- [ 0x1F617, 0x1F617 ], -- [ 0x1F619, 0x1F619 ], -- [ 0x1F61B, 0x1F61B ], -- [ 0x1F61F, 0x1F61F ], -- [ 0x1F626, 0x1F627 ], -- [ 0x1F62C, 0x1F62C ], -- [ 0x1F62E, 0x1F62F ], -- [ 0x1F634, 0x1F634 ], -- [ 0x1F641, 0x1F644 ], -- [ 0x1F650, 0x1F67F ], -- [ 0x1F6C6, 0x1F6FF ], -- [ 0x1F774, 0x1FFFF ], -- [ 0x2A6D7, 0x2A6FF ], -- [ 0x2B735, 0x2B73F ], -- [ 0x2B81E, 0x2F7FF ], -- [ 0x2FA1E, 0xE0000 ], -- [ 0xE0002, 0xE001F ], -- [ 0xE0080, 0xE00FF ], -- [ 0xE01F0, 0xEFFFF ], -- [ 0xFFFFE, 0xFFFFF ], -- [ 0x10FFFE, 0x10FFFF ], -- ]; - -- return binarySearch!table(c); -+@safe auto asSet(const (ubyte)[] compressed) -+{ -+ return CodepointSet(decompressIntervals(compressed)); - } - --unittest -+@safe pure nothrow auto asTrie(T...)(in TrieEntry!T e) - { -+ return const(CodepointTrie!T)(e.offsets, e.sizes, e.data); - } - -+@safe pure nothrow @property -+{ -+ // It's important to use auto return here, so that the compiler -+ // only runs semantic on the return type if the function gets -+ // used. Also these are functions rather than templates to not -+ // increase the object size of the caller. -+ auto lowerCaseTrie() { static immutable res = asTrie(lowerCaseTrieEntries); return res; } -+ auto upperCaseTrie() { static immutable res = asTrie(upperCaseTrieEntries); return res; } -+ auto simpleCaseTrie() { static immutable res = asTrie(simpleCaseTrieEntries); return res; } -+ auto fullCaseTrie() { static immutable res = asTrie(fullCaseTrieEntries); return res; } -+ auto alphaTrie() { static immutable res = asTrie(alphaTrieEntries); return res; } -+ auto markTrie() { static immutable res = asTrie(markTrieEntries); return res; } -+ auto numberTrie() { static immutable res = asTrie(numberTrieEntries); return res; } -+ auto punctuationTrie() { static immutable res = asTrie(punctuationTrieEntries); return res; } -+ auto symbolTrie() { static immutable res = asTrie(symbolTrieEntries); return res; } -+ auto graphicalTrie() { static immutable res = asTrie(graphicalTrieEntries); return res; } -+ auto nonCharacterTrie() { static immutable res = asTrie(nonCharacterTrieEntries); return res; } - --//============================================================================== --// Private Section. --//============================================================================== --private: -+ //normalization quick-check tables -+ auto nfcQCTrie() -+ { -+ import std.internal.unicode_norm; -+ static immutable res = asTrie(nfcQCTrieEntries); -+ return res; -+ } - --bool binarySearch(alias table)(dchar c) @safe pure nothrow --{ -- static @property bool checkTableEntry(alias table)() -+ auto nfdQCTrie() - { -- foreach(i, entry; table) -- { -- assert(table[i][0] <= table[i][1]); -- if(i < table.length - 1) -- assert(table[i][1] < table[i + 1][0]); -- } -- return true; -+ import std.internal.unicode_norm; -+ static immutable res = asTrie(nfdQCTrieEntries); -+ return res; - } -- static assert(checkTableEntry!table); - -- return binarySearch2(c, table); --} -+ auto nfkcQCTrie() -+ { -+ import std.internal.unicode_norm; -+ static immutable res = asTrie(nfkcQCTrieEntries); -+ return res; -+ } - --bool binarySearch2(dchar c, immutable dchar[2][] table) @safe pure nothrow --{ -- // Binary search -- size_t mid; -- size_t low; -- size_t high; -+ auto nfkdQCTrie() -+ { -+ import std.internal.unicode_norm; -+ static immutable res = asTrie(nfkdQCTrieEntries); -+ return res; -+ } - -- low = 0; -- high = table.length - 1; -- while(cast(int)low <= cast(int)high) -+ //grapheme breaking algorithm tables -+ auto mcTrie() - { -- mid = (low + high) >> 1; -+ import std.internal.unicode_grapheme; -+ static immutable res = asTrie(mcTrieEntries); -+ return res; -+ } - -- if(c < table[mid][0]) -- high = mid - 1; -- else if(c > table[mid][1]) -- low = mid + 1; -- else -- goto Lis; -+ auto graphemeExtendTrie() -+ { -+ import std.internal.unicode_grapheme; -+ static immutable res = asTrie(graphemeExtendTrieEntries); -+ return res; - } - --Lisnot: -- debug -+ auto hangLV() -+ { -+ import std.internal.unicode_grapheme; -+ static immutable res = asTrie(hangulLVTrieEntries); -+ return res; -+ } -+ -+ auto hangLVT() - { -- for(size_t i = 0; i < table.length; ++i) -- assert(c < table[i][0] || c > table[i][1]); -+ import std.internal.unicode_grapheme; -+ static immutable res = asTrie(hangulLVTTrieEntries); -+ return res; - } - -- return false; -+ // tables below are used for composition/decomposition -+ auto combiningClassTrie() -+ { -+ import std.internal.unicode_comp; -+ static immutable res = asTrie(combiningClassTrieEntries); -+ return res; -+ } - --Lis: -- debug -- { -- for(size_t i = 0; i < table.length; ++i) -- { -- if(c >= table[i][0] && c <= table[i][1]) -- return true; -- } -+ auto compatMappingTrie() -+ { -+ import std.internal.unicode_decomp; -+ static immutable res = asTrie(compatMappingTrieEntries); -+ return res; -+ } - -- assert(0); // should have been in table -+ auto canonMappingTrie() -+ { -+ import std.internal.unicode_decomp; -+ static immutable res = asTrie(canonMappingTrieEntries); -+ return res; - } -- else -- return true; --}; -+ -+ auto compositionJumpTrie() -+ { -+ import std.internal.unicode_comp; -+ static immutable res = asTrie(compositionJumpTrieEntries); -+ return res; -+ } -+ -+ //case conversion tables -+ auto toUpperIndexTrie() { static immutable res = asTrie(toUpperIndexTrieEntries); return res; } -+ auto toLowerIndexTrie() { static immutable res = asTrie(toLowerIndexTrieEntries); return res; } -+ auto toTitleIndexTrie() { static immutable res = asTrie(toTitleIndexTrieEntries); return res; } -+ -+ -+} -+ -+}// version(!std_uni_bootstrap) -+ ---- a/src/libphobos/src/std/uri.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/uri.d 2014-04-01 16:32:51.000000000 +0100 -@@ -26,21 +26,21 @@ - */ - module std.uri; - --//debug=uri; // uncomment to turn on debugging printf's -+//debug=uri; // uncomment to turn on debugging writefln's -+debug(uri) private import std.stdio; - - /* ====================== URI Functions ================ */ - - private import std.ascii; - private import std.c.stdlib; - private import std.utf; --private import std.stdio; - import std.exception; - - class URIerror : Error - { - this() - { -- super("URI error"); -+ super("URI error"); - } - } - -@@ -60,19 +60,18 @@ __gshared ubyte[128] uri_flags; // - shared static this() - { - // Initialize uri_flags[] -- - static void helper(immutable char[] p, uint flags) -- { int i; -- -- for (i = 0; i < p.length; i++) -- uri_flags[p[i]] |= flags; -+ { -+ for (int i = 0; i < p.length; i++) -+ uri_flags[p[i]] |= flags; - } - - uri_flags['#'] |= URI_Hash; - - for (int i = 'A'; i <= 'Z'; i++) -- { uri_flags[i] |= URI_Alpha; -- uri_flags[i + 0x20] |= URI_Alpha; // lowercase letters -+ { -+ uri_flags[i] |= URI_Alpha; -+ uri_flags[i + 0x20] |= URI_Alpha; // lowercase letters - } - helper("0123456789", URI_Digit); - helper(";/?:@&=+$,", URI_Reserved); -@@ -101,110 +100,118 @@ private string URI_Encode(dstring string - - for (k = 0; k != len; k++) - { -- C = string[k]; -- // if (C in unescapedSet) -- if (C < uri_flags.length && uri_flags[C] & unescapedSet) -- { -- if (Rlen == Rsize) -- { char* R2; -- -- Rsize *= 2; -- if (Rsize > 1024) -- R2 = (new char[Rsize]).ptr; -- else -- { R2 = cast(char *)alloca(Rsize * char.sizeof); -- if (!R2) -- goto LthrowURIerror; -- } -- R2[0..Rlen] = R[0..Rlen]; -- R = R2; -- } -- R[Rlen] = cast(char)C; -- Rlen++; -- } -- else -- { char[6] Octet; -- uint L; -- -- V = C; -- -- // Transform V into octets -- if (V <= 0x7F) -- { -- Octet[0] = cast(char) V; -- L = 1; -- } -- else if (V <= 0x7FF) -- { -- Octet[0] = cast(char)(0xC0 | (V >> 6)); -- Octet[1] = cast(char)(0x80 | (V & 0x3F)); -- L = 2; -- } -- else if (V <= 0xFFFF) -- { -- Octet[0] = cast(char)(0xE0 | (V >> 12)); -- Octet[1] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -- Octet[2] = cast(char)(0x80 | (V & 0x3F)); -- L = 3; -- } -- else if (V <= 0x1FFFFF) -- { -- Octet[0] = cast(char)(0xF0 | (V >> 18)); -- Octet[1] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -- Octet[2] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -- Octet[3] = cast(char)(0x80 | (V & 0x3F)); -- L = 4; -- } -- /+ -- else if (V <= 0x3FFFFFF) -- { -- Octet[0] = cast(char)(0xF8 | (V >> 24)); -- Octet[1] = cast(char)(0x80 | ((V >> 18) & 0x3F)); -- Octet[2] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -- Octet[3] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -- Octet[4] = cast(char)(0x80 | (V & 0x3F)); -- L = 5; -- } -- else if (V <= 0x7FFFFFFF) -+ C = string[k]; -+ // if (C in unescapedSet) -+ if (C < uri_flags.length && uri_flags[C] & unescapedSet) - { -- Octet[0] = cast(char)(0xFC | (V >> 30)); -- Octet[1] = cast(char)(0x80 | ((V >> 24) & 0x3F)); -- Octet[2] = cast(char)(0x80 | ((V >> 18) & 0x3F)); -- Octet[3] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -- Octet[4] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -- Octet[5] = cast(char)(0x80 | (V & 0x3F)); -- L = 6; -+ if (Rlen == Rsize) -+ { -+ char* R2; -+ -+ Rsize *= 2; -+ if (Rsize > 1024) { -+ R2 = (new char[Rsize]).ptr; -+ } -+ else -+ { -+ R2 = cast(char *)alloca(Rsize * char.sizeof); -+ if (!R2) -+ goto LthrowURIerror; -+ } -+ R2[0..Rlen] = R[0..Rlen]; -+ R = R2; -+ } -+ R[Rlen] = cast(char)C; -+ Rlen++; - } -- +/ - else -- { goto LthrowURIerror; // undefined UTF-32 code -- } -- -- if (Rlen + L * 3 > Rsize) -- { char *R2; -+ { -+ char[6] Octet; -+ uint L; - -- Rsize = 2 * (Rlen + L * 3); -- if (Rsize > 1024) -- R2 = (new char[Rsize]).ptr; -- else -- { R2 = cast(char *)alloca(Rsize * char.sizeof); -- if (!R2) -- goto LthrowURIerror; -- } -- R2[0..Rlen] = R[0..Rlen]; -- R = R2; -- } -+ V = C; - -- for (j = 0; j < L; j++) -- { -- R[Rlen] = '%'; -- R[Rlen + 1] = hex2ascii[Octet[j] >> 4]; -- R[Rlen + 2] = hex2ascii[Octet[j] & 15]; -+ // Transform V into octets -+ if (V <= 0x7F) -+ { -+ Octet[0] = cast(char) V; -+ L = 1; -+ } -+ else if (V <= 0x7FF) -+ { -+ Octet[0] = cast(char)(0xC0 | (V >> 6)); -+ Octet[1] = cast(char)(0x80 | (V & 0x3F)); -+ L = 2; -+ } -+ else if (V <= 0xFFFF) -+ { -+ Octet[0] = cast(char)(0xE0 | (V >> 12)); -+ Octet[1] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -+ Octet[2] = cast(char)(0x80 | (V & 0x3F)); -+ L = 3; -+ } -+ else if (V <= 0x1FFFFF) -+ { -+ Octet[0] = cast(char)(0xF0 | (V >> 18)); -+ Octet[1] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -+ Octet[2] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -+ Octet[3] = cast(char)(0x80 | (V & 0x3F)); -+ L = 4; -+ } -+ /+ -+ else if (V <= 0x3FFFFFF) -+ { -+ Octet[0] = cast(char)(0xF8 | (V >> 24)); -+ Octet[1] = cast(char)(0x80 | ((V >> 18) & 0x3F)); -+ Octet[2] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -+ Octet[3] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -+ Octet[4] = cast(char)(0x80 | (V & 0x3F)); -+ L = 5; -+ } -+ else if (V <= 0x7FFFFFFF) -+ { -+ Octet[0] = cast(char)(0xFC | (V >> 30)); -+ Octet[1] = cast(char)(0x80 | ((V >> 24) & 0x3F)); -+ Octet[2] = cast(char)(0x80 | ((V >> 18) & 0x3F)); -+ Octet[3] = cast(char)(0x80 | ((V >> 12) & 0x3F)); -+ Octet[4] = cast(char)(0x80 | ((V >> 6) & 0x3F)); -+ Octet[5] = cast(char)(0x80 | (V & 0x3F)); -+ L = 6; -+ } -+ +/ -+ else -+ { -+ goto LthrowURIerror; // undefined UTF-32 code -+ } -+ -+ if (Rlen + L * 3 > Rsize) -+ { -+ char *R2; -+ -+ Rsize = 2 * (Rlen + L * 3); -+ if (Rsize > 1024) { -+ R2 = (new char[Rsize]).ptr; -+ } -+ else -+ { -+ R2 = cast(char *)alloca(Rsize * char.sizeof); -+ if (!R2) -+ goto LthrowURIerror; -+ } -+ R2[0..Rlen] = R[0..Rlen]; -+ R = R2; -+ } -+ -+ for (j = 0; j < L; j++) -+ { -+ R[Rlen] = '%'; -+ R[Rlen + 1] = hex2ascii[Octet[j] >> 4]; -+ R[Rlen + 2] = hex2ascii[Octet[j] & 15]; - -- Rlen += 3; -+ Rlen += 3; -+ } - } - } -- } - - return R[0..Rlen].idup; - -@@ -215,8 +222,8 @@ LthrowURIerror: - uint ascii2hex(dchar c) - { - return (c <= '9') ? c - '0' : -- (c <= 'F') ? c - 'A' + 10 : -- c - 'a' + 10; -+ (c <= 'F') ? c - 'A' + 10 : -+ c - 'a' + 10; - } - - private dstring URI_Decode(string string, uint reservedSet) -@@ -226,8 +233,6 @@ private dstring URI_Decode(string string - uint V; - dchar C; - -- //printf("URI_Decode('%.*s')\n", string); -- - // Result array, allocated on stack - dchar* R; - uint Rlen; -@@ -237,86 +242,91 @@ private dstring URI_Decode(string string - - // Preallocate result buffer R guaranteed to be large enough for result - auto Rsize = len; -- if (Rsize > 1024 / dchar.sizeof) -- R = (new dchar[Rsize]).ptr; -+ if (Rsize > 1024 / dchar.sizeof) { -+ R = (new dchar[Rsize]).ptr; -+ } - else -- { R = cast(dchar *)alloca(Rsize * dchar.sizeof); -- if (!R) -- goto LthrowURIerror; -+ { -+ R = cast(dchar *)alloca(Rsize * dchar.sizeof); -+ if (!R) -+ goto LthrowURIerror; - } - Rlen = 0; - - for (k = 0; k != len; k++) -- { char B; -- uint start; -- -- C = s[k]; -- if (C != '%') -- { R[Rlen] = C; -- Rlen++; -- continue; -- } -- start = k; -- if (k + 2 >= len) -- goto LthrowURIerror; -- if (!isHexDigit(s[k + 1]) || !isHexDigit(s[k + 2])) -- goto LthrowURIerror; -- B = cast(char)((ascii2hex(s[k + 1]) << 4) + ascii2hex(s[k + 2])); -- k += 2; -- if ((B & 0x80) == 0) - { -- C = B; -- } -- else -- { uint n; -+ char B; -+ uint start; - -- for (n = 1; ; n++) -- { -- if (n > 4) -- goto LthrowURIerror; -- if (((B << n) & 0x80) == 0) -+ C = s[k]; -+ if (C != '%') - { -- if (n == 1) -- goto LthrowURIerror; -- break; -- } -+ R[Rlen] = C; -+ Rlen++; -+ continue; - } -- -- // Pick off (7 - n) significant bits of B from first byte of octet -- V = B & ((1 << (7 - n)) - 1); // (!!!) -- -- if (k + (3 * (n - 1)) >= len) -- goto LthrowURIerror; -- for (j = 1; j != n; j++) -- { -- k++; -- if (s[k] != '%') -+ start = k; -+ if (k + 2 >= len) - goto LthrowURIerror; - if (!isHexDigit(s[k + 1]) || !isHexDigit(s[k + 2])) - goto LthrowURIerror; - B = cast(char)((ascii2hex(s[k + 1]) << 4) + ascii2hex(s[k + 2])); -- if ((B & 0xC0) != 0x80) -- goto LthrowURIerror; - k += 2; -- V = (V << 6) | (B & 0x3F); -+ if ((B & 0x80) == 0) -+ { -+ C = B; -+ } -+ else -+ { -+ uint n; -+ -+ for (n = 1; ; n++) -+ { -+ if (n > 4) -+ goto LthrowURIerror; -+ if (((B << n) & 0x80) == 0) -+ { -+ if (n == 1) -+ goto LthrowURIerror; -+ break; -+ } -+ } -+ -+ // Pick off (7 - n) significant bits of B from first byte of octet -+ V = B & ((1 << (7 - n)) - 1); // (!!!) -+ -+ if (k + (3 * (n - 1)) >= len) -+ goto LthrowURIerror; -+ for (j = 1; j != n; j++) -+ { -+ k++; -+ if (s[k] != '%') -+ goto LthrowURIerror; -+ if (!isHexDigit(s[k + 1]) || !isHexDigit(s[k + 2])) -+ goto LthrowURIerror; -+ B = cast(char)((ascii2hex(s[k + 1]) << 4) + ascii2hex(s[k + 2])); -+ if ((B & 0xC0) != 0x80) -+ goto LthrowURIerror; -+ k += 2; -+ V = (V << 6) | (B & 0x3F); -+ } -+ if (V > 0x10FFFF) -+ goto LthrowURIerror; -+ C = V; -+ } -+ if (C < uri_flags.length && uri_flags[C] & reservedSet) -+ { -+ // R ~= s[start .. k + 1]; -+ int width = (k + 1) - start; -+ for (int ii = 0; ii < width; ii++) -+ R[Rlen + ii] = s[start + ii]; -+ Rlen += width; -+ } -+ else -+ { -+ R[Rlen] = C; -+ Rlen++; - } -- if (V > 0x10FFFF) -- goto LthrowURIerror; -- C = V; -- } -- if (C < uri_flags.length && uri_flags[C] & reservedSet) -- { -- // R ~= s[start .. k + 1]; -- int width = (k + 1) - start; -- for (int ii = 0; ii < width; ii++) -- R[Rlen + ii] = s[start + ii]; -- Rlen += width; -- } -- else -- { -- R[Rlen] = C; -- Rlen++; -- } - } - assert(Rlen <= Rsize); // enforce our preallocation size guarantee - -@@ -387,43 +397,47 @@ size_t uriLength(string s) - * https:// - * www. - */ -+ import std.string : icmp; - - size_t i; - - if (s.length <= 4) -- goto Lno; -+ goto Lno; - -- //writefln("isURL(%s)", s); -- if (s.length > 7 && std.string.icmp(s[0 .. 7], "http://") == 0) -- i = 7; -- else if (s.length > 8 && std.string.icmp(s[0 .. 8], "https://") == 0) -- i = 8; --// if (icmp(s[0 .. 4], "www.") == 0) --// i = 4; -+ if (s.length > 7 && std.string.icmp(s[0 .. 7], "http://") == 0) { -+ i = 7; -+ } - else -- goto Lno; -+ { -+ if (s.length > 8 && std.string.icmp(s[0 .. 8], "https://") == 0) -+ i = 8; -+ else -+ goto Lno; -+ } -+ // if (icmp(s[0 .. 4], "www.") == 0) -+ // i = 4; - - size_t lastdot; - for (; i < s.length; i++) - { -- auto c = s[i]; -- if (isAlphaNum(c)) -- continue; -- if (c == '-' || c == '_' || c == '?' || -- c == '=' || c == '%' || c == '&' || -- c == '/' || c == '+' || c == '#' || -- c == '~' || c == '$') -- continue; -- if (c == '.') -- { -- lastdot = i; -- continue; -- } -- break; -+ auto c = s[i]; -+ if (isAlphaNum(c)) -+ continue; -+ if (c == '-' || c == '_' || c == '?' || -+ c == '=' || c == '%' || c == '&' || -+ c == '/' || c == '+' || c == '#' || -+ c == '~' || c == '$') -+ continue; -+ if (c == '.') -+ { -+ lastdot = i; -+ continue; -+ } -+ break; - } - //if (!lastdot || (i - lastdot != 3 && i - lastdot != 4)) - if (!lastdot) -- goto Lno; -+ goto Lno; - - return i; - -@@ -431,6 +445,15 @@ Lno: - return -1; - } - -+unittest -+{ -+ string s1 = "http://www.digitalmars.com/~fred/fredsRX.html#foo end!"; -+ assert (uriLength(s1) == 49); -+ string s2 = "no uri here"; -+ assert (uriLength(s2) == -1); -+} -+ -+ - /*************************** - * Does string s[] start with an email address? - * Returns: -@@ -440,46 +463,46 @@ Lno: - * RFC2822 - */ - size_t emailLength(string s) --{ size_t i; -+{ -+ size_t i; - - if (!isAlpha(s[0])) -- goto Lno; -+ goto Lno; - - for (i = 1; 1; i++) - { -- if (i == s.length) -- goto Lno; -- auto c = s[i]; -- if (isAlphaNum(c)) -- continue; -- if (c == '-' || c == '_' || c == '.') -- continue; -- if (c != '@') -- goto Lno; -- i++; -- break; -+ if (i == s.length) -+ goto Lno; -+ auto c = s[i]; -+ if (isAlphaNum(c)) -+ continue; -+ if (c == '-' || c == '_' || c == '.') -+ continue; -+ if (c != '@') -+ goto Lno; -+ i++; -+ break; - } -- //writefln("test1 '%s'", s[0 .. i]); - - /* Now do the part past the '@' - */ - size_t lastdot; - for (; i < s.length; i++) - { -- auto c = s[i]; -- if (isAlphaNum(c)) -- continue; -- if (c == '-' || c == '_') -- continue; -- if (c == '.') -- { -- lastdot = i; -- continue; -- } -- break; -+ auto c = s[i]; -+ if (isAlphaNum(c)) -+ continue; -+ if (c == '-' || c == '_') -+ continue; -+ if (c == '.') -+ { -+ lastdot = i; -+ continue; -+ } -+ break; - } - if (!lastdot || (i - lastdot != 3 && i - lastdot != 4)) -- goto Lno; -+ goto Lno; - - return i; - -@@ -487,34 +510,41 @@ Lno: - return -1; - } - -+unittest -+{ -+ string s1 = "my.e-mail@www.example-domain.com with garbage added"; -+ assert (emailLength(s1) == 32); -+ string s2 = "no email address here"; -+ assert (emailLength(s2) == -1); -+} -+ - - unittest - { -- debug(uri) printf("uri.encodeURI.unittest\n"); -+ debug(uri) writeln("uri.encodeURI.unittest"); - - string s = "http://www.digitalmars.com/~fred/fred's RX.html#foo"; - string t = "http://www.digitalmars.com/~fred/fred's%20RX.html#foo"; - - auto r = encode(s); -- debug(uri) printf("r = '%.*s'\n", r); -+ debug(uri) writefln("r = '%s'", r); - assert(r == t); - r = decode(t); -- debug(uri) printf("r = '%.*s'\n", r); -+ debug(uri) writefln("r = '%s'", r); - assert(r == s); - - r = encode( decode("%E3%81%82%E3%81%82") ); - assert(r == "%E3%81%82%E3%81%82"); - - r = encodeComponent("c++"); -- //printf("r = '%.*s'\n", r); - assert(r == "c%2B%2B"); - - auto str = new char[10_000_000]; - str[] = 'A'; - r = encodeComponent(assumeUnique(str)); - foreach (char c; r) -- assert(c == 'A'); -+ assert(c == 'A'); - - r = decode("%41%42%43"); -- debug(uri) writefln(r); -+ debug(uri) writeln(r); - } ---- a/src/libphobos/src/std/utf.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/utf.d 2014-04-01 16:32:51.000000000 +0100 -@@ -45,8 +45,8 @@ class UTFException : Exception - uint[4] sequence; - size_t len; - -- -- UTFException setSequence(uint[] data...) @safe pure nothrow -+ @safe pure nothrow -+ UTFException setSequence(uint[] data...) - { - import std.algorithm; - -@@ -58,13 +58,13 @@ class UTFException : Exception - return this; - } - -- -+ @safe pure nothrow - this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - super(msg, file, line, next); - } - -- -+ @safe pure - this(string msg, size_t index, string file = __FILE__, size_t line = __LINE__, Throwable next = null) - { - import std.string; -@@ -75,15 +75,15 @@ class UTFException : Exception - override string toString() - { - import std.string; -- if(len == 0) -+ if (len == 0) - return super.toString(); - - string result = "Invalid UTF sequence:"; - -- foreach(i; sequence[0 .. len]) -+ foreach (i; sequence[0 .. len]) - result ~= format(" %02x", i); - -- if(super.msg.length > 0) -+ if (super.msg.length > 0) - { - result ~= " - "; - result ~= super.msg; -@@ -94,11 +94,8 @@ class UTFException : Exception - } - - --/++ -- $(RED Deprecated. It will be removed in January 2013. -- Please use $(LREF UTFException) instead.) -- +/ --deprecated("Please use std.utf.UTFException instead.") alias UTFException UtfException; -+// Explicitly undocumented. It will be removed in November 2013. -+deprecated("Please use std.utf.UTFException instead.") alias UtfException = UTFException; - - - /++ -@@ -124,18 +121,22 @@ pure nothrow bool isValidDchar(dchar c) - unittest - { - debug(utf) printf("utf.isValidDchar.unittest\n"); -- assert(isValidDchar(cast(dchar)'a') == true); -- assert(isValidDchar(cast(dchar)0x1FFFFF) == false); -+ -+ assertCTFEable!( -+ { -+ assert( isValidDchar(cast(dchar)'a') == true); -+ assert( isValidDchar(cast(dchar)0x1FFFFF) == false); - - assert(!isValidDchar(cast(dchar)0x00D800)); - assert(!isValidDchar(cast(dchar)0x00DBFF)); - assert(!isValidDchar(cast(dchar)0x00DC00)); - assert(!isValidDchar(cast(dchar)0x00DFFF)); -- assert(isValidDchar(cast(dchar)0x00FFFE)); -- assert(isValidDchar(cast(dchar)0x00FFFF)); -- assert(isValidDchar(cast(dchar)0x01FFFF)); -- assert(isValidDchar(cast(dchar)0x10FFFF)); -+ assert( isValidDchar(cast(dchar)0x00FFFE)); -+ assert( isValidDchar(cast(dchar)0x00FFFF)); -+ assert( isValidDchar(cast(dchar)0x01FFFF)); -+ assert( isValidDchar(cast(dchar)0x10FFFF)); - assert(!isValidDchar(cast(dchar)0x110000)); -+ }); - } - - -@@ -213,6 +214,13 @@ unittest - enforce(stride(RandomCU!char(s), i) == codeLength!char(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!char(s); -+ immutable randLen = refRandom.length; -+ enforce(stride(refRandom, i) == codeLength!char(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == 0) - { - enforce(stride(s) == codeLength!char(c), -@@ -220,9 +228,18 @@ unittest - - enforce(stride(InputCU!char(s)) == codeLength!char(c), - new AssertError(format("Unit test failure range 0: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!char(s); -+ immutable bidirLen = refBidir.length; -+ enforce(stride(refBidir) == codeLength!char(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -239,14 +256,15 @@ unittest - test("hello\U00010143\u0100\U00010143", '\u0100', 9); - test("hello\U00010143\u0100\U00010143", '\U00010143', 11); - -- foreach(S; TypeTuple!(char[], const char[], string)) -+ foreach (S; TypeTuple!(char[], const char[], string)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){stride(str, 0);})); -- static assert(isSafe!((){stride(str);})); -- static assert((functionAttributes!((){stride(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){stride(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ stride(str, 0); })); -+ static assert(isSafe!({ stride(str); })); -+ static assert((functionAttributes!({ stride(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ stride(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -278,14 +296,14 @@ uint strideBack(S)(auto ref S str, size_ - { - static if (is(typeof(str.length) : ulong)) - assert(index <= str.length, "Past the end of the UTF-8 sequence"); -- assert (index > 0, "Not the end of the UTF-8 sequence"); -+ assert(index > 0, "Not the end of the UTF-8 sequence"); - - if ((str[index-1] & 0b1100_0000) != 0b1000_0000) - return 1; - - if (index >= 4) //single verification for most common case - { -- foreach(i; TypeTuple!(2, 3, 4)) -+ foreach (i; TypeTuple!(2, 3, 4)) - { - if ((str[index-i] & 0b1100_0000) != 0b1000_0000) - return i; -@@ -293,7 +311,7 @@ uint strideBack(S)(auto ref S str, size_ - } - else - { -- foreach(i; TypeTuple!(2, 3)) -+ foreach (i; TypeTuple!(2, 3)) - { - if (index >= i && (str[index-i] & 0b1100_0000) != 0b1000_0000) - return i; -@@ -305,7 +323,7 @@ uint strideBack(S)(auto ref S str, size_ - /// Ditto - uint strideBack(S)(auto ref S str) - if (is(S : const char[]) || -- (isRandomAccessRange!S && hasLength!S && is(Unqual!(ElementType!S) == char))) -+ (isRandomAccessRange!S && hasLength!S && is(Unqual!(ElementType!S) == char))) - { - return strideBack(str, str.length); - } -@@ -314,11 +332,14 @@ uint strideBack(S)(auto ref S str) - if (isBidirectionalRange!S && is(Unqual!(ElementType!S) == char) && !isRandomAccessRange!S) - { - assert(!str.empty, "Past the end of the UTF-8 sequence"); -- foreach(i; TypeTuple!(1, 2, 3, 4)) -+ auto temp = str.save; -+ foreach (i; TypeTuple!(1, 2, 3, 4)) - { -- if ((str.back & 0b1100_0000) != 0b1000_0000) return i; -- str.popBack(); -- if (str.empty) break; -+ if ((temp.back & 0b1100_0000) != 0b1000_0000) -+ return i; -+ temp.popBack(); -+ if (temp.empty) -+ break; - } - throw new UTFException("The last code unit is not the end of the UTF-8 sequence"); - } -@@ -333,16 +354,32 @@ unittest - enforce(strideBack(RandomCU!char(s), i == size_t.max ? s.length : i) == codeLength!char(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!char(s); -+ immutable randLen = refRandom.length; -+ enforce(strideBack(refRandom, i == size_t.max ? s.length : i) == codeLength!char(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == size_t.max) - { - enforce(strideBack(s) == codeLength!char(c), -- new AssertError(format("Unit test failure string length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure string code length: %s", s), __FILE__, line)); - - enforce(strideBack(BidirCU!char(s)) == codeLength!char(c), -- new AssertError(format("Unit test failure range length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure range code length: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!char(s); -+ immutable bidirLen = refBidir.length; -+ enforce(strideBack(refBidir) == codeLength!char(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -359,14 +396,15 @@ unittest - test("\U00010143\u0100\U00010143hello", '\u0100', 6); - test("\U00010143\u0100\U00010143hello", '\U00010143', 4); - -- foreach(S; TypeTuple!(char[], const char[], string)) -+ foreach (S; TypeTuple!(char[], const char[], string)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){strideBack(str, 0);})); -- static assert(isSafe!((){strideBack(str);})); -- static assert((functionAttributes!((){strideBack(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){strideBack(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ strideBack(str, 0); })); -+ static assert(isSafe!({ strideBack(str); })); -+ static assert((functionAttributes!({ strideBack(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ strideBack(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -413,7 +451,7 @@ uint stride(S)(auto ref S str) @safe pur - uint stride(S)(auto ref S str) - if (isInputRange!S && is(Unqual!(ElementType!S) == wchar)) - { -- assert (!str.empty, "UTF-16 sequence is empty"); -+ assert(!str.empty, "UTF-16 sequence is empty"); - immutable uint u = str.front; - return 1 + (u >= 0xD800 && u <= 0xDBFF); - } -@@ -428,6 +466,13 @@ uint stride(S)(auto ref S str) - enforce(stride(RandomCU!wchar(s), i) == codeLength!wchar(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!wchar(s); -+ immutable randLen = refRandom.length; -+ enforce(stride(refRandom, i) == codeLength!wchar(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == 0) - { - enforce(stride(s) == codeLength!wchar(c), -@@ -435,9 +480,18 @@ uint stride(S)(auto ref S str) - - enforce(stride(InputCU!wchar(s)) == codeLength!wchar(c), - new AssertError(format("Unit test failure range 0: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!wchar(s); -+ immutable bidirLen = refBidir.length; -+ enforce(stride(refBidir) == codeLength!wchar(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -454,14 +508,15 @@ uint stride(S)(auto ref S str) - test("hello\U00010143\u0100\U00010143", '\u0100', 7); - test("hello\U00010143\u0100\U00010143", '\U00010143', 8); - -- foreach(S; TypeTuple!(wchar[], const wchar[], wstring)) -+ foreach (S; TypeTuple!(wchar[], const wchar[], wstring)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){stride(str, 0);})); -- static assert(isSafe!((){stride(str);})); -- static assert((functionAttributes!((){stride(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){stride(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ stride(str, 0); })); -+ static assert(isSafe!({ stride(str); })); -+ static assert((functionAttributes!({ stride(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ stride(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -496,7 +551,7 @@ uint strideBack(S)(auto ref S str, size_ - { - static if (is(typeof(str.length) : ulong)) - assert(index <= str.length, "Past the end of the UTF-16 sequence"); -- assert (index > 0, "Not the end of a UTF-16 sequence"); -+ assert(index > 0, "Not the end of a UTF-16 sequence"); - - immutable c2 = str[index-1]; - return 1 + (0xDC00 <= c2 && c2 < 0xE000); -@@ -507,7 +562,7 @@ uint strideBack(S)(auto ref S str) - if (is(S : const wchar[]) || - (isBidirectionalRange!S && is(Unqual!(ElementType!S) == wchar))) - { -- assert (!str.empty, "UTF-16 sequence is empty"); -+ assert(!str.empty, "UTF-16 sequence is empty"); - - static if (is(S : const(wchar)[])) - immutable c2 = str[$ - 1]; -@@ -527,16 +582,32 @@ unittest - enforce(strideBack(RandomCU!wchar(s), i == size_t.max ? s.length : i) == codeLength!wchar(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!wchar(s); -+ immutable randLen = refRandom.length; -+ enforce(strideBack(refRandom, i == size_t.max ? s.length : i) == codeLength!wchar(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == size_t.max) - { - enforce(strideBack(s) == codeLength!wchar(c), -- new AssertError(format("Unit test failure string length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure string code length: %s", s), __FILE__, line)); - - enforce(strideBack(BidirCU!wchar(s)) == codeLength!wchar(c), -- new AssertError(format("Unit test failure range length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure range code length: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!wchar(s); -+ immutable bidirLen = refBidir.length; -+ enforce(strideBack(refBidir) == codeLength!wchar(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -553,14 +624,15 @@ unittest - test("\U00010143\u0100\U00010143hello", '\u0100', 3); - test("\U00010143\u0100\U00010143hello", '\U00010143', 2); - -- foreach(S; TypeTuple!(wchar[], const wchar[], wstring)) -+ foreach (S; TypeTuple!(wchar[], const wchar[], wstring)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){strideBack(str, 0);})); -- static assert(isSafe!((){strideBack(str);})); -- static assert((functionAttributes!((){strideBack(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){strideBack(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ strideBack(str, 0); })); -+ static assert(isSafe!({ strideBack(str); })); -+ static assert((functionAttributes!({ strideBack(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ strideBack(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -597,6 +669,13 @@ unittest - enforce(stride(RandomCU!dchar(s), i) == codeLength!dchar(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!dchar(s); -+ immutable randLen = refRandom.length; -+ enforce(stride(refRandom, i) == codeLength!dchar(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == 0) - { - enforce(stride(s) == codeLength!dchar(c), -@@ -604,9 +683,18 @@ unittest - - enforce(stride(InputCU!dchar(s)) == codeLength!dchar(c), - new AssertError(format("Unit test failure range 0: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!dchar(s); -+ immutable bidirLen = refBidir.length; -+ enforce(stride(refBidir) == codeLength!dchar(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -623,14 +711,15 @@ unittest - test("hello\U00010143\u0100\U00010143", '\u0100', 6); - test("hello\U00010143\u0100\U00010143", '\U00010143', 7); - -- foreach(S; TypeTuple!(dchar[], const dchar[], dstring)) -+ foreach (S; TypeTuple!(dchar[], const dchar[], dstring)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){stride(str, 0);})); -- static assert(isSafe!((){stride(str);})); -- static assert((functionAttributes!((){stride(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){stride(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ stride(str, 0); })); -+ static assert(isSafe!({ stride(str); })); -+ static assert((functionAttributes!({ stride(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ stride(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -655,7 +744,7 @@ uint strideBack(S)(auto ref S str, size_ - { - static if (is(typeof(str.length) : ulong)) - assert(index <= str.length, "Past the end of the UTF-32 sequence"); -- assert (index > 0, "Not the end of the UTF-32 sequence"); -+ assert(index > 0, "Not the end of the UTF-32 sequence"); - return 1; - } - -@@ -677,16 +766,32 @@ unittest - enforce(strideBack(RandomCU!dchar(s), i == size_t.max ? s.length : i) == codeLength!dchar(c), - new AssertError(format("Unit test failure range: %s", s), __FILE__, line)); - -+ auto refRandom = new RefRandomCU!dchar(s); -+ immutable randLen = refRandom.length; -+ enforce(strideBack(refRandom, i == size_t.max ? s.length : i) == codeLength!dchar(c), -+ new AssertError(format("Unit test failure rand ref range: %s", s), __FILE__, line)); -+ enforce(refRandom.length == randLen, -+ new AssertError(format("Unit test failure rand ref range length: %s", s), __FILE__, line)); -+ - if (i == size_t.max) - { - enforce(strideBack(s) == codeLength!dchar(c), -- new AssertError(format("Unit test failure string length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure string code length: %s", s), __FILE__, line)); - - enforce(strideBack(BidirCU!dchar(s)) == codeLength!dchar(c), -- new AssertError(format("Unit test failure range length: %s", s), __FILE__, line)); -+ new AssertError(format("Unit test failure range code length: %s", s), __FILE__, line)); -+ -+ auto refBidir = new RefBidirCU!dchar(s); -+ immutable bidirLen = refBidir.length; -+ enforce(strideBack(refBidir) == codeLength!dchar(c), -+ new AssertError(format("Unit test failure bidir ref range code length: %s", s), __FILE__, line)); -+ enforce(refBidir.length == bidirLen, -+ new AssertError(format("Unit test failure bidir ref range length: %s", s), __FILE__, line)); - } - } - -+ assertCTFEable!( -+ { - test("a", 'a'); - test(" ", ' '); - test("\u2029", '\u2029'); //paraSep -@@ -703,14 +808,15 @@ unittest - test("\U00010143\u0100\U00010143hello", '\u0100', 2); - test("\U00010143\u0100\U00010143hello", '\U00010143', 1); - -- foreach(S; TypeTuple!(dchar[], const dchar[], dstring)) -+ foreach (S; TypeTuple!(dchar[], const dchar[], dstring)) - { - enum str = to!S("hello world"); -- static assert(isSafe!((){strideBack(str, 0);})); -- static assert(isSafe!((){strideBack(str);})); -- static assert((functionAttributes!((){strideBack(str, 0);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){strideBack(str);}) & FunctionAttribute.pure_) != 0); -+ static assert(isSafe!({ strideBack(str, 0); })); -+ static assert(isSafe!({ strideBack(str); })); -+ static assert((functionAttributes!({ strideBack(str, 0); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ strideBack(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -720,38 +826,23 @@ unittest - up to $(D index). So, $(D index) is the index of a code unit at the - beginning of a code point, and the return value is how many code points into - the string that that code point is. -- --Examples: ---------------------- --assert(toUCSindex(`hello world`, 7) == 7); --assert(toUCSindex(`hello world`w, 7) == 7); --assert(toUCSindex(`hello world`d, 7) == 7); -- --assert(toUCSindex(`Ma Chérie`, 7) == 6); --assert(toUCSindex(`Ma Chérie`w, 7) == 7); --assert(toUCSindex(`Ma Chérie`d, 7) == 7); -- --assert(toUCSindex(`さいごの果実 / ミツバチと科学者`, 9) == 3); --assert(toUCSindex(`さいごの果実 / ミツバチと科学者`w, 9) == 9); --assert(toUCSindex(`さいごの果実 / ミツバチと科学者`d, 9) == 9); ---------------------- - +/ - size_t toUCSindex(C)(const(C)[] str, size_t index) @safe pure -- if(isSomeChar!C) -+ if (isSomeChar!C) - { -- static if(is(Unqual!C == dchar)) -+ static if (is(Unqual!C == dchar)) - return index; - else - { - size_t n = 0; - size_t j = 0; - -- for(; j < index; ++n) -+ for (; j < index; ++n) - j += stride(str, j); - -- if(j > index) -+ if (j > index) - { -- static if(is(Unqual!C == char)) -+ static if (is(Unqual!C == char)) - throw new UTFException("Invalid UTF-8 sequence", index); - else - throw new UTFException("Invalid UTF-16 sequence", index); -@@ -761,6 +852,7 @@ size_t toUCSindex(C)(const(C)[] str, siz - } - } - -+/// - unittest - { - assert(toUCSindex(`hello world`, 7) == 7); -@@ -781,73 +873,61 @@ unittest - Given a UCS index $(D n) into $(D str), returns the UTF index. - So, $(D n) is how many code points into the string the code point is, and - the array index of the code unit is returned. -- --Examples: ---------------------- --assert(toUTFindex(`hello world`, 7) == 7); --assert(toUTFindex(`hello world`w, 7) == 7); --assert(toUTFindex(`hello world`d, 7) == 7); -- --assert(toUTFindex(`Ma Chérie`, 6) == 7); --assert(toUTFindex(`Ma Chérie`w, 7) == 7); --assert(toUTFindex(`Ma Chérie`d, 7) == 7); -- --assert(toUTFindex(`さいごの果実 / ミツバチと科学者`, 3) == 9); --assert(toUTFindex(`さいごの果実 / ミツバチと科学者`w, 9) == 9); --assert(toUTFindex(`さいごの果実 / ミツバチと科学者`d, 9) == 9); ---------------------- - +/ --size_t toUTFindex(in char[] str, size_t n) @safe pure -+size_t toUTFindex(C)(const(C)[] str, size_t n) @safe pure -+ if (isSomeChar!C) - { -- size_t i; -- while (n--) -- i += stride(str, i); -- return i; --} -- --/// ditto --size_t toUTFindex(in wchar[] str, size_t n) @safe pure nothrow --{ -- size_t i; -- -- while (n--) -+ static if (is(Unqual!C == dchar)) - { -- wchar u = str[i]; -- -- i += 1 + (u >= 0xD800 && u <= 0xDBFF); -+ return n; -+ } -+ else -+ { -+ size_t i; -+ while (n--) -+ { -+ i += stride(str, i); -+ } -+ return i; - } -- -- return i; - } - --/// ditto --size_t toUTFindex(in dchar[] str, size_t n) @safe pure nothrow -+/// -+unittest - { -- return n; -+ assert(toUTFindex(`hello world`, 7) == 7); -+ assert(toUTFindex(`hello world`w, 7) == 7); -+ assert(toUTFindex(`hello world`d, 7) == 7); -+ -+ assert(toUTFindex(`Ma Chérie`, 6) == 7); -+ assert(toUTFindex(`Ma Chérie`w, 7) == 7); -+ assert(toUTFindex(`Ma Chérie`d, 7) == 7); -+ -+ assert(toUTFindex(`さいごの果実 / ミツバチと科学者`, 3) == 9); -+ assert(toUTFindex(`さいごの果実 / ミツバチと科学者`w, 9) == 9); -+ assert(toUTFindex(`さいごの果実 / ミツバチと科学者`d, 9) == 9); - } - - - /* =================== Decode ======================= */ - - /++ -- Decodes and returns the character starting at $(D str[index]). $(D index) -- is advanced to one past the decoded character. If the character is not -+ Decodes and returns the code point starting at $(D str[index]). $(D index) -+ is advanced to one past the decoded code point. If the code point is not - well-formed, then a $(D UTFException) is thrown and $(D index) remains - unchanged. - -- $(D decodeFront) is a variant of $(D decode) which specifically decodes -- the first character. -- -- $(D decode) will only work with strings and random access ranges of -- code units with length and slicing, whereas $(D decodeFront) will also work -- with any input range of code units. -+ decode will only work with strings and random access ranges of code units -+ with length and slicing, whereas $(LREF decodeFront) will work with any -+ input range of code units. - - Throws: -- $(D UTFException) if $(D str[index]) is not the start of a valid UTF -+ $(LREF UTFException) if $(D str[index]) is not the start of a valid UTF - sequence. - +/ --dchar decode(S)(auto ref S str, ref size_t index) @trusted pure -- if (isSomeString!S) -+dchar decode(S)(auto ref S str, ref size_t index) -+ if (!isSomeString!S && -+ isRandomAccessRange!S && hasSlicing!S && hasLength!S && isSomeChar!(ElementType!S)) - in - { - assert(index < str.length, "Attempted to decode past the end of a string"); -@@ -863,9 +943,8 @@ body - return decodeImpl!true(str, index); - } - --dchar decode(S)(auto ref S str, ref size_t index) -- if (!isSomeString!S && -- (isRandomAccessRange!S && hasSlicing!S && hasLength!S && isSomeChar!(ElementType!S))) -+dchar decode(S)(auto ref S str, ref size_t index) @trusted pure -+ if (isSomeString!S) - in - { - assert(index < str.length, "Attempted to decode past the end of a string"); -@@ -881,9 +960,23 @@ body - return decodeImpl!true(str, index); - } - --/// Ditto --dchar decodeFront(S)(auto ref S str, out size_t index) @trusted pure -- if (isSomeString!S) -+/++ -+ $(D decodeFront) is a variant of $(LREF decode) which specifically decodes -+ the first code point. Unlike $(LREF decode), $(D decodeFront) accepts any -+ input range of code units (rather than just a string or random access -+ range). It also takes the range by $(D ref) and pops off the elements as it -+ decodes them. If $(D numCodeUnits) is passed in, it gets set to the number -+ of code units which were in the code point which was decoded. -+ -+ Throws: -+ $(LREF UTFException) if $(D str.front) is not the start of a valid UTF -+ sequence. If an exception is thrown, then there is no guarantee as to -+ the number of code units which were popped off, as it depends on the -+ type of range being used and how many code units had to be popped off -+ before the code point was determined to be invalid. -+ +/ -+dchar decodeFront(S)(ref S str, out size_t numCodeUnits) -+ if (!isSomeString!S && isInputRange!S && isSomeChar!(ElementType!S)) - in - { - assert(!str.empty); -@@ -894,18 +987,30 @@ out (result) - } - body - { -- if (str[0] < codeUnitLimit!S) -+ immutable fst = str.front; -+ -+ if (fst < codeUnitLimit!S) - { -- index = 1; -- return str[0]; -+ str.popFront(); -+ numCodeUnits = 1; -+ return fst; - } - -- return decodeImpl!true(str, index); -+ //@@@BUG@@@ 8521 forces canIndex to be done outside of decodeImpl, which -+ //is undesirable, since not all overloads of decodeImpl need it. So, it -+ //should be moved back into decodeImpl once bug# 8521 has been fixed. -+ enum canIndex = isRandomAccessRange!S && hasSlicing!S && hasLength!S; -+ immutable retval = decodeImpl!canIndex(str, numCodeUnits); -+ -+ // The other range types were already popped by decodeImpl. -+ static if (isRandomAccessRange!S && hasSlicing!S && hasLength!S) -+ str = str[numCodeUnits .. str.length]; -+ -+ return retval; - } - --/// Ditto --dchar decodeFront(S)(auto ref S str, out size_t index) -- if (!isSomeString!S) -+dchar decodeFront(S)(ref S str, out size_t numCodeUnits) @trusted pure -+ if (isSomeString!S) - in - { - assert(!str.empty); -@@ -916,28 +1021,30 @@ out (result) - } - body - { -- //@@@BUG@@@ 8521 forces canIndex to be down outside of decodeImpl, which -- //is undesirable, since not all overloads of decodeImpl need it. So, it -- //should be moved back into decodeImpl once bug# 8521 has been fixed. -- enum canIndex = isRandomAccessRange!S && hasSlicing!S && hasLength!S && isSomeChar!(ElementType!S); -- //static if (isRandomAccessRange!S && hasSlicing!S && hasLength!S && isSomeChar!(ElementType!S)) -- static if (canIndex) -- immutable fst = str[0]; -- else -- immutable fst = str.front; -- -- if (fst < codeUnitLimit!S) -+ if (str[0] < codeUnitLimit!S) - { -- index = 1; -- return fst; -+ numCodeUnits = 1; -+ immutable retval = str[0]; -+ str = str[1 .. $]; -+ return retval; - } - -- return decodeImpl!canIndex(str, index); -+ immutable retval = decodeImpl!true(str, numCodeUnits); -+ str = str[numCodeUnits .. $]; -+ return retval; -+} -+ -+/++ Ditto +/ -+dchar decodeFront(S)(ref S str) -+ if (isInputRange!S && isSomeChar!(ElementType!S)) -+{ -+ size_t numCodeUnits; -+ return decodeFront(str, numCodeUnits); - } - - // Gives the maximum value that a code unit for the given range type can hold. - private template codeUnitLimit(S) -- if (isSomeChar!(ElementEncodingType!S)) -+ if (isSomeChar!(ElementEncodingType!S)) - { - static if (is(Unqual!(ElementEncodingType!S) == char)) - enum char codeUnitLimit = 0x80; -@@ -975,9 +1082,9 @@ private dchar decodeImpl(bool canIndex, - else static if (isRandomAccessRange!S && hasSlicing!S && hasLength!S) - auto pstr = str[index .. str.length]; - else -- alias str pstr; -+ alias pstr = str; - -- //@@@BUG@@@ 8521 forces this to be down outside of decodeImpl -+ //@@@BUG@@@ 8521 forces this to be done outside of decodeImpl - //enum canIndex = is(S : const char[]) || (isRandomAccessRange!S && hasSlicing!S && hasLength!S); - - static if (canIndex) -@@ -1003,7 +1110,7 @@ private dchar decodeImpl(bool canIndex, - sequence[i] = str[i]; - } while (++i < str.length && i < 4 && (str[i] & 0xC0) == 0x80); - -- return (new UTFException(msg, i)).setSequence(sequence[0 .. i]); -+ return new UTFException(msg, i).setSequence(sequence[0 .. i]); - } - } - -@@ -1037,7 +1144,7 @@ private dchar decodeImpl(bool canIndex, - dchar d = fst; // upper control bits are masked out later - fst <<= 1; - -- foreach(i; TypeTuple!(1, 2, 3)) -+ foreach (i; TypeTuple!(1, 2, 3)) - { - - static if (canIndex) -@@ -1096,9 +1203,9 @@ private dchar decodeImpl(bool canIndex, - else static if (isRandomAccessRange!S && hasSlicing!S && hasLength!S) - auto pstr = str[index .. str.length]; - else -- alias str pstr; -+ alias pstr = str; - -- //@@@BUG@@@ 8521 forces this to be down outside of decodeImpl -+ //@@@BUG@@@ 8521 forces this to be done outside of decodeImpl - //enum canIndex = is(S : const wchar[]) || (isRandomAccessRange!S && hasSlicing!S && hasLength!S); - - static if (canIndex) -@@ -1115,7 +1222,7 @@ private dchar decodeImpl(bool canIndex, - UTFException exception(string msg) - { - static if (canIndex) -- return (new UTFException(msg)).setSequence(pstr[0]); -+ return new UTFException(msg).setSequence(pstr[0]); - else - return new UTFException(msg); - } -@@ -1164,220 +1271,262 @@ private dchar decodeImpl(bool canIndex, - static if (is(S : const dchar[])) - auto pstr = str.ptr; - else -- alias str pstr; -+ alias pstr = str; - - static if (is(S : const dchar[]) || (isRandomAccessRange!S && hasSlicing!S && hasLength!S)) - { - if (!isValidDchar(pstr[index])) -- throw (new UTFException("Invalid UTF-32 value")).setSequence(pstr[index]); -+ throw new UTFException("Invalid UTF-32 value").setSequence(pstr[index]); - return pstr[index++]; - } - else - { - if (!isValidDchar(pstr.front)) -- throw (new UTFException("Invalid UTF-32 value")).setSequence(pstr.front); -+ throw new UTFException("Invalid UTF-32 value").setSequence(pstr.front); - ++index; -- return pstr.front; -+ immutable retval = pstr.front; -+ pstr.popFront(); -+ return retval; - } - } - --unittest -+version(unittest) private void testDecode(R)(R range, -+ size_t index, -+ dchar expectedChar, -+ size_t expectedIndex, -+ size_t line = __LINE__) - { -- foreach(S; TypeTuple!(to!string, RandomCU!char)) -- { -- size_t i; -- dchar c; -- -- debug(utf) printf("utf.decode.unittest\n"); -- -- auto s1 = S("abcd"); -- i = 0; -- c = decode(s1, i); -- assert(c == cast(dchar)'a'); -- assert(i == 1); -- c = decode(s1, i); -- assert(c == cast(dchar)'b'); -- assert(i == 2); -- -- auto s2 = S("\xC2\xA9"); -- i = 0; -- c = decode(s2, i); -- assert(c == cast(dchar)'\u00A9'); -- assert(i == 2); -- -- auto s3 = S("\xE2\x89\xA0"); -- i = 0; -- c = decode(s3, i); -- assert(c == cast(dchar)'\u2260'); -- assert(i == 3); -- -- string[] s4 = [ -- "\xE2\x89", // too short -- "\xC0\x8A", -- "\xE0\x80\x8A", -- "\xF0\x80\x80\x8A", -- "\xF8\x80\x80\x80\x8A", -- "\xFC\x80\x80\x80\x80\x8A", -- ]; -+ static if (hasLength!R) -+ immutable lenBefore = range.length; - -- for (int j = 0; j < s4.length; j++) -+ static if (isRandomAccessRange!R) -+ { - { -- i = 0; -- assertThrown!UTFException(decode(S(s4[j]), i)); -+ immutable result = decode(range, index); -+ enforce(result == expectedChar, -+ new AssertError(format("decode: Wrong character: %s", result), __FILE__, line)); -+ enforce(index == expectedIndex, -+ new AssertError(format("decode: Wrong index: %s", index), __FILE__, line)); -+ static if (hasLength!R) -+ { -+ enforce(range.length == lenBefore, -+ new AssertError(format("decode: length changed: %s", range.length), __FILE__, line)); -+ } - } - } -+} -+ -+version(unittest) private void testDecodeFront(R)(ref R range, -+ dchar expectedChar, -+ size_t expectedNumCodeUnits, -+ size_t line = __LINE__) -+{ -+ static if (hasLength!R) -+ immutable lenBefore = range.length; -+ -+ size_t numCodeUnits; -+ immutable result = decodeFront(range, numCodeUnits); -+ enforce(result == expectedChar, -+ new AssertError(format("decodeFront: Wrong character: %s", result), __FILE__, line)); -+ enforce(numCodeUnits == expectedNumCodeUnits, -+ new AssertError(format("decodeFront: Wrong numCodeUnits: %s", numCodeUnits), __FILE__, line)); - -- foreach(S; TypeTuple!(to!string, RandomCU!char, InputCU!char)) -+ static if (hasLength!R) - { -- size_t i; -- dchar c; -+ enforce(range.length == lenBefore - numCodeUnits, -+ new AssertError(format("decodeFront: wrong length: %s", range.length), __FILE__, line)); -+ } -+} - -- debug(utf) printf("utf.decode.unittest\n"); -+version(unittest) private void testBothDecode(R)(R range, -+ dchar expectedChar, -+ size_t expectedIndex, -+ size_t line = __LINE__) -+{ -+ testDecode(range, 0, expectedChar, expectedIndex, line); -+ testDecodeFront(range, expectedChar, expectedIndex, line); -+} -+ -+version(unittest) private void testBadDecode(R)(R range, size_t index, size_t line = __LINE__) -+{ -+ immutable initialIndex = index; - -- auto s1 = S("abcd"); -- i = 42; -- c = decodeFront(s1, i); -- assert(c == cast(dchar)'a'); -- assert(i == 1); -- -- auto s2 = S("\xC2\xA9"); -- i = 42; -- c = decodeFront(s2, i); -- assert(c == cast(dchar)'\u00A9'); -- assert(i == 2); -- -- auto s3 = S("\xE2\x89\xA0"); -- i = 42; -- c = decodeFront(s3, i); -- assert(c == cast(dchar)'\u2260'); -- assert(i == 3); -- -- string[] s4 = [ -- "\xE2\x89", // too short -- "\xC0\x8A", -- "\xE0\x80\x8A", -- "\xF0\x80\x80\x8A", -- "\xF8\x80\x80\x80\x8A", -- "\xFC\x80\x80\x80\x80\x8A", -- ]; -+ static if (hasLength!R) -+ immutable lenBefore = range.length; - -- for (int j = 0; j < s4.length; j++) -+ static if (isRandomAccessRange!R) -+ { -+ assertThrown!UTFException(decode(range, index), null, __FILE__, line); -+ enforce(index == initialIndex, -+ new AssertError(format("decode: Wrong index: %s", index), __FILE__, line)); -+ static if (hasLength!R) - { -- i = 0; -- assertThrown!UTFException(decodeFront(S(s4[j]), i)); -+ enforce(range.length == lenBefore, -+ new AssertError(format("decode: length changed:", range.length), __FILE__, line)); - } - } -+ -+ if (initialIndex == 0) -+ assertThrown!UTFException(decodeFront(range, index), null, __FILE__, line); - } - - unittest - { -- size_t i; -+ debug(utf) printf("utf.decode.unittest\n"); - -- foreach(S; TypeTuple!(to!string, RandomCU!char, InputCU!char)) -+ assertCTFEable!( - { -- static if (is(S == InputCU!char)) -- alias TypeTuple!(decodeFront) funcs; -- else -- alias TypeTuple!(decode, decodeFront) funcs; -+ foreach (S; TypeTuple!(to!string, InputCU!char, RandomCU!char, -+ (string s) => new RefBidirCU!char(s), -+ (string s) => new RefRandomCU!char(s))) -+ { -+ enum sHasLength = hasLength!(typeof(S("abcd"))); -+ -+ { -+ auto range = S("abcd"); -+ testDecode(range, 0, 'a', 1); -+ testDecode(range, 1, 'b', 2); -+ testDecodeFront(range, 'a', 1); -+ testDecodeFront(range, 'b', 1); -+ assert(decodeFront(range) == 'c'); -+ assert(decodeFront(range) == 'd'); -+ } -+ -+ { -+ auto range = S("ウェブサイト"); -+ testDecode(range, 0, 'ウ', 3); -+ testDecode(range, 3, 'ェ', 6); -+ testDecodeFront(range, 'ウ', 3); -+ testDecodeFront(range, 'ェ', 3); -+ assert(decodeFront(range) == 'ブ'); -+ assert(decodeFront(range) == 'サ'); -+ } - -- foreach(func; funcs) -+ testBothDecode(S("\xC2\xA9"), '\u00A9', 2); -+ testBothDecode(S("\xE2\x89\xA0"), '\u2260', 3); -+ -+ foreach (str; ["\xE2\x89", // too short -+ "\xC0\x8A", -+ "\xE0\x80\x8A", -+ "\xF0\x80\x80\x8A", -+ "\xF8\x80\x80\x80\x8A", -+ "\xFC\x80\x80\x80\x80\x8A"]) - { -- i = 0; assert(func(S("\xEF\xBF\xBE"c), i) == cast(dchar)0xFFFE); -- i = 0; assert(func(S("\xEF\xBF\xBF"c), i) == cast(dchar)0xFFFF); -- i = 0; -- -- assertThrown!UTFException(func(S("\xED\xA0\x80"c), i)); -- assertThrown!UTFException(func(S("\xED\xAD\xBF"c), i)); -- assertThrown!UTFException(func(S("\xED\xAE\x80"c), i)); -- assertThrown!UTFException(func(S("\xED\xAF\xBF"c), i)); -- assertThrown!UTFException(func(S("\xED\xB0\x80"c), i)); -- assertThrown!UTFException(func(S("\xED\xBE\x80"c), i)); -- assertThrown!UTFException(func(S("\xED\xBF\xBF"c), i)); -+ testBadDecode(S(str), 0); -+ testBadDecode(S(str), 1); - } -+ -+ //Invalid UTF-8 sequence where the first code unit is valid. -+ testBothDecode(S("\xEF\xBF\xBE"), cast(dchar)0xFFFE, 3); -+ testBothDecode(S("\xEF\xBF\xBF"), cast(dchar)0xFFFF, 3); -+ -+ //Invalid UTF-8 sequence where the first code unit isn't valid. -+ testBadDecode(S("\xED\xA0\x80"), 0); -+ testBadDecode(S("\xED\xAD\xBF"), 0); -+ testBadDecode(S("\xED\xAE\x80"), 0); -+ testBadDecode(S("\xED\xAF\xBF"), 0); -+ testBadDecode(S("\xED\xB0\x80"), 0); -+ testBadDecode(S("\xED\xBE\x80"), 0); -+ testBadDecode(S("\xED\xBF\xBF"), 0); - } -+ }); - } - - unittest - { -- size_t i; -- -- foreach(S; TypeTuple!(to!wstring, RandomCU!wchar, InputCU!wchar)) -+ assertCTFEable!( - { -- static if (is(S == InputCU!wchar)) -- alias TypeTuple!(decodeFront) funcs; -- else -- alias TypeTuple!(decode, decodeFront) funcs; -+ foreach (S; TypeTuple!(to!wstring, InputCU!wchar, RandomCU!wchar, -+ (wstring s) => new RefBidirCU!wchar(s), -+ (wstring s) => new RefRandomCU!wchar(s))) -+ { -+ testBothDecode(S([cast(wchar)0x1111]), cast(dchar)0x1111, 1); -+ testBothDecode(S([cast(wchar)0xD800, cast(wchar)0xDC00]), cast(dchar)0x10000, 2); -+ testBothDecode(S([cast(wchar)0xDBFF, cast(wchar)0xDFFF]), cast(dchar)0x10FFFF, 2); -+ testBothDecode(S([cast(wchar)0xFFFE]), cast(dchar)0xFFFE, 1); -+ testBothDecode(S([cast(wchar)0xFFFF]), cast(dchar)0xFFFF, 1); -+ -+ testBadDecode(S([ cast(wchar)0xD801 ]), 0); -+ testBadDecode(S([ cast(wchar)0xD800, cast(wchar)0x1200 ]), 0); - -- foreach(func; funcs) - { -- i = 0; assert(func(S([ cast(wchar)0x1111 ]), i) == cast(dchar)0x1111 && i == 1); -- i = 0; assert(func(S([ cast(wchar)0xD800, cast(wchar)0xDC00 ]), i) == cast(dchar)0x10000 && i == 2); -- i = 0; assert(func(S([ cast(wchar)0xDBFF, cast(wchar)0xDFFF ]), i) == cast(dchar)0x10FFFF && i == 2); -- i = 0; assert(func(S([ cast(wchar)0xFFFE ]), i) == cast(dchar)0xFFFE && i == 1); -- i = 0; assert(func(S([ cast(wchar)0xFFFF ]), i) == cast(dchar)0xFFFF && i == 1); -- i = 0; assertThrown!UTFException(func(S([ cast(wchar)0xD801 ]), i)); -- i = 0; assertThrown!UTFException(func(S([ cast(wchar)0xD800, cast(wchar)0x1200 ]), i)); -+ auto range = S("ウェブサイト"); -+ testDecode(range, 0, 'ウ', 1); -+ testDecode(range, 1, 'ェ', 2); -+ testDecodeFront(range, 'ウ', 1); -+ testDecodeFront(range, 'ェ', 1); -+ assert(decodeFront(range) == 'ブ'); -+ assert(decodeFront(range) == 'サ'); - } - } - -- foreach(S; TypeTuple!(to!wstring, RandomCU!wchar)) -+ foreach (S; TypeTuple!(to!wstring, RandomCU!wchar, (wstring s) => new RefRandomCU!wchar(s))) - { -- auto str = S([ cast(wchar)0xD800, cast(wchar)0xDC00, -- cast(wchar)0x1400, -- cast(wchar)0xDAA7, cast(wchar)0xDDDE ]); -- i = 0; -- assert(decode(str, i) == 0x10000 && i == 2); -- assert(decode(str, i) == 0x1400 && i == 3); -- assert(decode(str, i) == 0xB9DDE && i == 5); -+ auto str = S([cast(wchar)0xD800, cast(wchar)0xDC00, -+ cast(wchar)0x1400, -+ cast(wchar)0xDAA7, cast(wchar)0xDDDE]); -+ testDecode(str, 0, cast(dchar)0x10000, 2); -+ testDecode(str, 2, cast(dchar)0x1400, 3); -+ testDecode(str, 3, cast(dchar)0xB9DDE, 5); - } -+ }); - } - - unittest - { -- size_t i; -- -- foreach(S; TypeTuple!(to!dstring, RandomCU!dchar, InputCU!dchar)) -+ assertCTFEable!( - { -- static if (is(S == InputCU!dchar)) -- alias TypeTuple!(decodeFront) funcs; -- else -- alias TypeTuple!(decode, decodeFront) funcs; -+ foreach (S; TypeTuple!(to!dstring, RandomCU!dchar, InputCU!dchar, -+ (dstring s) => new RefBidirCU!dchar(s), -+ (dstring s) => new RefRandomCU!dchar(s))) -+ { -+ testBothDecode(S([cast(dchar)0x1111]), cast(dchar)0x1111, 1); -+ testBothDecode(S([cast(dchar)0x10000]), cast(dchar)0x10000, 1); -+ testBothDecode(S([cast(dchar)0x10FFFF]), cast(dchar)0x10FFFF, 1); -+ testBothDecode(S([cast(dchar)0xFFFE]), cast(dchar)0xFFFE, 1); -+ testBothDecode(S([cast(dchar)0xFFFF]), cast(dchar)0xFFFF, 1); -+ -+ testBadDecode(S([cast(dchar)0xD800]), 0); -+ testBadDecode(S([cast(dchar)0xDFFE]), 0); -+ testBadDecode(S([cast(dchar)0x110000]), 0); - -- foreach(func; funcs) - { -- i = 0; assert(func(S([ cast(dchar)0x1111 ]), i) == cast(dchar)0x1111 && i == 1); -- i = 0; assert(func(S([ cast(dchar)0x10000 ]), i) == cast(dchar)0x10000 && i == 1); -- i = 0; assert(func(S([ cast(dchar)0x10FFFF ]), i) == cast(dchar)0x10FFFF && i == 1); -- i = 0; assert(func(S([ cast(dchar)0xFFFE ]), i) == cast(dchar)0xFFFE && i == 1); -- i = 0; assert(func(S([ cast(dchar)0xFFFF ]), i) == cast(dchar)0xFFFF && i == 1); -- i = 0; assertThrown!UTFException(func(S([ cast(dchar)0xD800 ]), i)); -- i = 0; assertThrown!UTFException(func(S([ cast(dchar)0xDFFE ]), i)); -- i = 0; assertThrown!UTFException(func(S([ cast(dchar)0x110000 ]), i)); -+ auto range = S("ウェブサイト"); -+ testDecode(range, 0, 'ウ', 1); -+ testDecode(range, 1, 'ェ', 2); -+ testDecodeFront(range, 'ウ', 1); -+ testDecodeFront(range, 'ェ', 1); -+ assert(decodeFront(range) == 'ブ'); -+ assert(decodeFront(range) == 'サ'); - } - } - -- foreach(S; TypeTuple!(to!dstring, RandomCU!dchar)) -+ foreach (S; TypeTuple!(to!dstring, RandomCU!dchar, (dstring s) => new RefRandomCU!dchar(s))) - { -- auto str = S([ cast(dchar)0x10000, cast(dchar)0x1400, cast(dchar)0xB9DDE ]); -- i = 0; -- assert(decode(str, i) == 0x10000 && i == 1); -- assert(decode(str, i) == 0x1400 && i == 2); -- assert(decode(str, i) == 0xB9DDE && i == 3); -+ auto str = S([cast(dchar)0x10000, cast(dchar)0x1400, cast(dchar)0xB9DDE]); -+ testDecode(str, 0, 0x10000, 1); -+ testDecode(str, 1, 0x1400, 2); -+ testDecode(str, 2, 0xB9DDE, 3); - } -+ }); - } - - unittest - { -- foreach(S; TypeTuple!(char[], const char[], string, -- wchar[], const wchar[], wstring, -- dchar[], const dchar[], dstring)) -+ assertCTFEable!( - { -- enum str = to!S("hello world"); -- static assert(isSafe!((){size_t i = 0; decode(str, i);})); -- static assert(isSafe!((){size_t i = 0; decodeFront(str, i);})); -- static assert((functionAttributes!((){size_t i = 0; decode(str, i);}) & FunctionAttribute.pure_) != 0); -- static assert((functionAttributes!((){size_t i = 0; decodeFront(str, i);}) & FunctionAttribute.pure_) != 0); -+ foreach (S; TypeTuple!( char[], const( char)[], string, -+ wchar[], const(wchar)[], wstring, -+ dchar[], const(dchar)[], dstring)) -+ { -+ static assert(isSafe!({ S str; size_t i = 0; decode(str, i); })); -+ static assert(isSafe!({ S str; size_t i = 0; decodeFront(str, i); })); -+ static assert(isSafe!({ S str; decodeFront(str); })); -+ static assert((functionAttributes!({ S str; size_t i = 0; decode(str, i); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ S str; size_t i = 0; decodeFront(str, i); }) & FunctionAttribute.pure_) != 0); -+ static assert((functionAttributes!({ S str; decodeFront(str); }) & FunctionAttribute.pure_) != 0); - } -+ }); - } - - -@@ -1410,7 +1559,7 @@ size_t encode(ref char[4] buf, dchar c) - if (c <= 0xFFFF) - { - if (0xD800 <= c && c <= 0xDFFF) -- throw (new UTFException("Encoding a surrogate code point in UTF-8")).setSequence(c); -+ throw new UTFException("Encoding a surrogate code point in UTF-8").setSequence(c); - - assert(isValidDchar(c)); - buf[0] = cast(char)(0xE0 | (c >> 12)); -@@ -1429,11 +1578,13 @@ size_t encode(ref char[4] buf, dchar c) - } - - assert(!isValidDchar(c)); -- throw (new UTFException("Encoding an invalid code point in UTF-8")).setSequence(c); -+ throw new UTFException("Encoding an invalid code point in UTF-8").setSequence(c); - } - - unittest - { -+ assertCTFEable!( -+ { - char[4] buf; - - assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000"); -@@ -1453,6 +1604,7 @@ unittest - assertThrown!UTFException(encode(buf, cast(dchar)0xDC00)); - assertThrown!UTFException(encode(buf, cast(dchar)0xDFFF)); - assertThrown!UTFException(encode(buf, cast(dchar)0x110000)); -+ }); - } - - -@@ -1462,7 +1614,7 @@ size_t encode(ref wchar[2] buf, dchar c) - if (c <= 0xFFFF) - { - if (0xD800 <= c && c <= 0xDFFF) -- throw (new UTFException("Encoding an isolated surrogate code point in UTF-16")).setSequence(c); -+ throw new UTFException("Encoding an isolated surrogate code point in UTF-16").setSequence(c); - - assert(isValidDchar(c)); - buf[0] = cast(wchar)c; -@@ -1477,11 +1629,13 @@ size_t encode(ref wchar[2] buf, dchar c) - } - - assert(!isValidDchar(c)); -- throw (new UTFException("Encoding an invalid code point in UTF-16")).setSequence(c); -+ throw new UTFException("Encoding an invalid code point in UTF-16").setSequence(c); - } - - unittest - { -+ assertCTFEable!( -+ { - wchar[2] buf; - - assert(encode(buf, '\u0000') == 1 && buf[0 .. 1] == "\u0000"); -@@ -1497,6 +1651,7 @@ unittest - assertThrown!UTFException(encode(buf, cast(dchar)0xDC00)); - assertThrown!UTFException(encode(buf, cast(dchar)0xDFFF)); - assertThrown!UTFException(encode(buf, cast(dchar)0x110000)); -+ }); - } - - -@@ -1530,7 +1685,7 @@ void encode(ref char[] str, dchar c) @sa - else if (c <= 0xFFFF) - { - if (0xD800 <= c && c <= 0xDFFF) -- throw (new UTFException("Encoding a surrogate code point in UTF-8")).setSequence(c); -+ throw new UTFException("Encoding a surrogate code point in UTF-8").setSequence(c); - - assert(isValidDchar(c)); - buf[0] = cast(char)(0xE0 | (c >> 12)); -@@ -1550,7 +1705,7 @@ void encode(ref char[] str, dchar c) @sa - else - { - assert(!isValidDchar(c)); -- throw (new UTFException("Encoding an invalid code point in UTF-8")).setSequence(c); -+ throw new UTFException("Encoding an invalid code point in UTF-8").setSequence(c); - } - r ~= buf[0 .. L]; - } -@@ -1561,6 +1716,8 @@ unittest - { - debug(utf) printf("utf.encode.unittest\n"); - -+ assertCTFEable!( -+ { - char[] s = "abcd".dup; - encode(s, cast(dchar)'a'); - assert(s.length == 5); -@@ -1574,10 +1731,13 @@ unittest - encode(s, cast(dchar)'\u2260'); - assert(s.length == 10); - assert(s == "abcda\xC2\xA9\xE2\x89\xA0"); -+ }); - } - - unittest - { -+ assertCTFEable!( -+ { - char[] buf; - - encode(buf, '\u0000'); assert(buf[0 .. $] == "\u0000"); -@@ -1597,6 +1757,7 @@ unittest - assertThrown!UTFException(encode(buf, cast(dchar)0xDC00)); - assertThrown!UTFException(encode(buf, cast(dchar)0xDFFF)); - assertThrown!UTFException(encode(buf, cast(dchar)0x110000)); -+ }); - } - - /// ditto -@@ -1607,7 +1768,7 @@ void encode(ref wchar[] str, dchar c) @s - if (c <= 0xFFFF) - { - if (0xD800 <= c && c <= 0xDFFF) -- throw (new UTFException("Encoding an isolated surrogate code point in UTF-16")).setSequence(c); -+ throw new UTFException("Encoding an isolated surrogate code point in UTF-16").setSequence(c); - - assert(isValidDchar(c)); - r ~= cast(wchar)c; -@@ -1624,7 +1785,7 @@ void encode(ref wchar[] str, dchar c) @s - else - { - assert(!isValidDchar(c)); -- throw (new UTFException("Encoding an invalid code point in UTF-16")).setSequence(c); -+ throw new UTFException("Encoding an invalid code point in UTF-16").setSequence(c); - } - - str = r; -@@ -1632,6 +1793,8 @@ void encode(ref wchar[] str, dchar c) @s - - unittest - { -+ assertCTFEable!( -+ { - wchar[] buf; - - encode(buf, '\u0000'); assert(buf[0] == '\u0000'); -@@ -1647,13 +1810,14 @@ unittest - assertThrown!UTFException(encode(buf, cast(dchar)0xDC00)); - assertThrown!UTFException(encode(buf, cast(dchar)0xDFFF)); - assertThrown!UTFException(encode(buf, cast(dchar)0x110000)); -+ }); - } - - /// ditto - void encode(ref dchar[] str, dchar c) @safe pure - { - if ((0xD800 <= c && c <= 0xDFFF) || 0x10FFFF < c) -- throw (new UTFException("Encoding an invalid code point in UTF-32")).setSequence(c); -+ throw new UTFException("Encoding an invalid code point in UTF-32").setSequence(c); - - assert(isValidDchar(c)); - str ~= c; -@@ -1661,6 +1825,8 @@ void encode(ref dchar[] str, dchar c) @s - - unittest - { -+ assertCTFEable!( -+ { - dchar[] buf; - - encode(buf, '\u0000'); assert(buf[0] == '\u0000'); -@@ -1675,26 +1841,16 @@ unittest - assertThrown!UTFException(encode(buf, cast(dchar)0xDC00)); - assertThrown!UTFException(encode(buf, cast(dchar)0xDFFF)); - assertThrown!UTFException(encode(buf, cast(dchar)0x110000)); -+ }); - } - - - /++ - Returns the number of code units that are required to encode the code point - $(D c) when $(D C) is the character type used to encode it. -- --Examples: -------- --assert(codeLength!char('a') == 1); --assert(codeLength!wchar('a') == 1); --assert(codeLength!dchar('a') == 1); -- --assert(codeLength!char('\U0010FFFF') == 4); --assert(codeLength!wchar('\U0010FFFF') == 2); --assert(codeLength!dchar('\U0010FFFF') == 1); -------- - +/ - ubyte codeLength(C)(dchar c) @safe pure nothrow -- if(isSomeChar!C) -+ if (isSomeChar!C) - { - static if (C.sizeof == 1) - { -@@ -1716,7 +1872,7 @@ ubyte codeLength(C)(dchar c) @safe pure - } - } - --//Verify Examples. -+/// - unittest - { - assert(codeLength!char('a') == 1); -@@ -1734,48 +1890,25 @@ unittest - in a string whose character type is $(D C). This is particularly useful - when slicing one string with the length of another and the two string - types use different character types. -- --Examples: -------- --assert(codeLength!char("hello world") == -- to!string("hello world").length); --assert(codeLength!wchar("hello world") == -- to!wstring("hello world").length); --assert(codeLength!dchar("hello world") == -- to!dstring("hello world").length); -- --assert(codeLength!char(`プログラミング`) == -- to!string(`プログラミング`).length); --assert(codeLength!wchar(`プログラミング`) == -- to!wstring(`プログラミング`).length); --assert(codeLength!dchar(`プログラミング`) == -- to!dstring(`プログラミング`).length); -- --string haystack = `Être sans la verité, ça, ce ne serait pas bien.`; --wstring needle = `Être sans la verité`; --assert(haystack[codeLength!char(needle) .. $] == -- `, ça, ce ne serait pas bien.`); -------- - +/ - size_t codeLength(C, InputRange)(InputRange input) -- if(isInputRange!InputRange && is(ElementType!InputRange : dchar)) -+ if (isInputRange!InputRange && is(ElementType!InputRange : dchar)) - { -- alias Unqual!(ElementEncodingType!InputRange) EncType; -- static if(isSomeString!InputRange && is(EncType == C) && is(typeof(input.length))) -- return input.length; -- else -- { -+ alias EncType = Unqual!(ElementEncodingType!InputRange); -+ static if (isSomeString!InputRange && is(EncType == C) && is(typeof(input.length))) -+ return input.length; -+ else -+ { - size_t total = 0; - -- foreach(dchar c; input) -+ foreach (dchar c; input) - total += codeLength!C(c); - - return total; -- } -+ } - } -- - --//Verify Examples. -+/// - unittest - { - assert(codeLength!char("hello world") == -@@ -1800,20 +1933,23 @@ unittest - - unittest - { -- foreach(S; TypeTuple!(char[], const char[], string, -- wchar[], const wchar[], wstring, -- dchar[], const dchar[], dstring)) -+ assertCTFEable!( -+ { -+ foreach (S; TypeTuple!( char[], const char[], string, -+ wchar[], const wchar[], wstring, -+ dchar[], const dchar[], dstring)) - { -- foreach(C; TypeTuple!(char, wchar, dchar)) -+ foreach (C; TypeTuple!(char, wchar, dchar)) - { - assert(codeLength!C(to!S("Walter Bright")) == to!(C[])("Walter Bright").length); - assert(codeLength!C(to!S(`言語`)) == to!(C[])(`言語`).length); - assert(codeLength!C(to!S(`ウェブサイト@La_Verité.com`)) == - to!(C[])(`ウェブサイト@La_Verité.com`).length); -- assert(codeLength!C(to!S(`ウェブサイト@La_Verité.com`).filter!(x => true)()) == -+ assert(codeLength!C(to!S(`ウェブサイト@La_Verité.com`).filter!(x => true)()) == - to!(C[])(`ウェブサイト@La_Verité.com`).length); - } - } -+ }); - } - - -@@ -1826,7 +1962,7 @@ unittest - $(D UTFException) if $(D str) is not well-formed. - +/ - void validate(S)(in S str) @safe pure -- if(isSomeString!S) -+ if (isSomeString!S) - { - immutable len = str.length; - for (size_t i = 0; i < len; ) -@@ -2111,16 +2247,6 @@ dstring toUTF32(in dchar[] s) @safe - C function keeps it around for any reason, make sure that you keep a - reference to it in your D code. Otherwise, it may go away during a garbage - collection cycle and cause a nasty bug when the C code tries to use it. -- -- Examples: ---------------------- --auto p1 = toUTFz!(char*)("hello world"); --auto p2 = toUTFz!(const(char)*)("hello world"); --auto p3 = toUTFz!(immutable(char)*)("hello world"); --auto p4 = toUTFz!(char*)("hello world"d); --auto p5 = toUTFz!(const(wchar)*)("hello world"); --auto p6 = toUTFz!(immutable(dchar)*)("hello world"w); ---------------------- - +/ - template toUTFz(P) - { -@@ -2130,71 +2256,81 @@ template toUTFz(P) - } - } - --/++ Ditto +/ --template toUTFz(P, S) -+/// -+unittest - { -- P toUTFz(S str) @system -- { -- return toUTFzImpl!(P, S)(str); -- } -+ auto p1 = toUTFz!(char*)("hello world"); -+ auto p2 = toUTFz!(const(char)*)("hello world"); -+ auto p3 = toUTFz!(immutable(char)*)("hello world"); -+ auto p4 = toUTFz!(char*)("hello world"d); -+ auto p5 = toUTFz!(const(wchar)*)("hello world"); -+ auto p6 = toUTFz!(immutable(dchar)*)("hello world"w); - } - - private P toUTFzImpl(P, S)(S str) @system -- if(isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -- is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S)) && -- is(immutable(Unqual!(ElementEncodingType!S)) == ElementEncodingType!S)) -+ if (isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -+ is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S)) && -+ is(immutable(Unqual!(ElementEncodingType!S)) == ElementEncodingType!S)) - //immutable(C)[] -> C*, const(C)*, or immutable(C)* - { -- if(str.empty) -+ if (str.empty) - { - typeof(*P.init)[] retval = ['\0']; - - return retval.ptr; - } - -- alias Unqual!(ElementEncodingType!S) C; -+ alias C = Unqual!(ElementEncodingType!S); - - //If the P is mutable, then we have to make a copy. -- static if(is(Unqual!(typeof(*P.init)) == typeof(*P.init))) -+ static if (is(Unqual!(typeof(*P.init)) == typeof(*P.init))) -+ { - return toUTFzImpl!(P, const(C)[])(cast(const(C)[])str); -+ } - else - { -- immutable p = str.ptr + str.length; -+ if (!__ctfe) -+ { -+ immutable p = str.ptr + str.length; - -- // Peek past end of str, if it's 0, no conversion necessary. -- // Note that the compiler will put a 0 past the end of static -- // strings, and the storage allocator will put a 0 past the end -- // of newly allocated char[]'s. -- // Is p dereferenceable? A simple test: if the p points to an -- // address multiple of 4, then conservatively assume the pointer -- // might be pointing to a new block of memory, which might be -- // unreadable. Otherwise, it's definitely pointing to valid -- // memory. -- if((cast(size_t)p & 3) && *p == '\0') -- return str.ptr; -+ // Peek past end of str, if it's 0, no conversion necessary. -+ // Note that the compiler will put a 0 past the end of static -+ // strings, and the storage allocator will put a 0 past the end -+ // of newly allocated char[]'s. -+ // Is p dereferenceable? A simple test: if the p points to an -+ // address multiple of 4, then conservatively assume the pointer -+ // might be pointing to a new block of memory, which might be -+ // unreadable. Otherwise, it's definitely pointing to valid -+ // memory. -+ if ((cast(size_t)p & 3) && *p == '\0') -+ return str.ptr; -+ } - - return toUTFzImpl!(P, const(C)[])(cast(const(C)[])str); - } - } - - private P toUTFzImpl(P, S)(S str) @system -- if(isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -- is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S)) && -- !is(immutable(Unqual!(ElementEncodingType!S)) == ElementEncodingType!S)) -+ if (isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -+ is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S)) && -+ !is(immutable(Unqual!(ElementEncodingType!S)) == ElementEncodingType!S)) - //C[] or const(C)[] -> C*, const(C)*, or immutable(C)* - { -- alias ElementEncodingType!S InChar; -- alias typeof(*P.init) OutChar; -+ alias InChar = ElementEncodingType!S; -+ alias OutChar = typeof(*P.init); - - //const(C)[] -> const(C)* or - //C[] -> C* or const(C)* -- static if((is(const(Unqual!InChar) == InChar) && is(const(Unqual!OutChar) == OutChar)) || -- (!is(const(Unqual!InChar) == InChar) && !is(immutable(Unqual!OutChar) == OutChar))) -+ static if (( is(const(Unqual!InChar) == InChar) && is(const(Unqual!OutChar) == OutChar)) || -+ (!is(const(Unqual!InChar) == InChar) && !is(immutable(Unqual!OutChar) == OutChar))) - { -- auto p = str.ptr + str.length; -+ if (!__ctfe) -+ { -+ auto p = str.ptr + str.length; - -- if((cast(size_t)p & 3) && *p == '\0') -- return str.ptr; -+ if ((cast(size_t)p & 3) && *p == '\0') -+ return str.ptr; -+ } - - str ~= '\0'; - return str.ptr; -@@ -2212,42 +2348,28 @@ private P toUTFzImpl(P, S)(S str) @syste - } - - private P toUTFzImpl(P, S)(S str) -- if(isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -- !is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S))) -+ if (isSomeString!S && isPointer!P && isSomeChar!(typeof(*P.init)) && -+ !is(Unqual!(typeof(*P.init)) == Unqual!(ElementEncodingType!S))) - //C1[], const(C1)[], or immutable(C1)[] -> C2*, const(C2)*, or immutable(C2)* - { - auto retval = appender!(typeof(*P.init)[])(); - -- foreach(dchar c; str) -+ foreach (dchar c; str) - retval.put(c); - retval.put('\0'); - - return cast(P)retval.data.ptr; - } - --//Verify Examples. --unittest --{ -- auto p1 = toUTFz!(char*)("hello world"); -- auto p2 = toUTFz!(const(char)*)("hello world"); -- auto p3 = toUTFz!(immutable(char)*)("hello world"); -- auto p4 = toUTFz!(char*)("hello world"d); -- auto p5 = toUTFz!(const(wchar)*)("hello world"); -- auto p6 = toUTFz!(immutable(dchar)*)("hello world"w); --} -- - unittest - { -- import core.exception; - import std.algorithm; -- import std.metastrings; -- import std.typetuple; - -- size_t zeroLen(C)(const(C)* ptr) -+ static size_t zeroLen(C)(const(C)* ptr) - { - size_t len = 0; - -- while(*ptr != '\0') -+ while (*ptr != '\0') - { - ++ptr; - ++len; -@@ -2256,9 +2378,11 @@ unittest - return len; - } - -- foreach(S; TypeTuple!(string, wstring, dstring)) -+ assertCTFEable!( - { -- alias Unqual!(ElementEncodingType!S) C; -+ foreach (S; TypeTuple!(string, wstring, dstring)) -+ { -+ alias C = Unqual!(ElementEncodingType!S); - - auto s1 = to!S("hello\U00010143\u0100\U00010143"); - auto temp = new C[](s1.length + 1); -@@ -2268,7 +2392,7 @@ unittest - auto s2 = assumeUnique(temp); - assert(s1 == s2); - -- foreach(P; TypeTuple!(C*, const(C)*, immutable(C)*)) -+ foreach (P; TypeTuple!(C*, const(C)*, immutable(C)*)) - { - auto p1 = toUTFz!P(s1); - assert(p1[0 .. s1.length] == s1); -@@ -2279,46 +2403,48 @@ unittest - assert(p2[s2.length] == '\0'); - } - } -+ }); - -- void test(P, S)(S s, size_t line = __LINE__) -+ static void test(P, S)(S s, size_t line = __LINE__) - { - auto p = toUTFz!P(s); - immutable len = zeroLen(p); - enforce(cmp(s, p[0 .. len]) == 0, -- new AssertError(Format!("Unit test failed: %s %s", P.stringof, S.stringof), -+ new AssertError(format("Unit test failed: %s %s", P.stringof, S.stringof), - __FILE__, line)); - } - -- foreach(P; TypeTuple!(wchar*, const(wchar)*, immutable(wchar)*, -- dchar*, const(dchar)*, immutable(dchar)*)) -+ assertCTFEable!( -+ { -+ foreach (P; TypeTuple!(wchar*, const(wchar)*, immutable(wchar)*, -+ dchar*, const(dchar)*, immutable(dchar)*)) - { - test!P("hello\U00010143\u0100\U00010143"); - } -- -- foreach(P; TypeTuple!(char*, const(char)*, immutable(char)*, -- dchar*, const(dchar)*, immutable(dchar)*)) -+ foreach (P; TypeTuple!( char*, const( char)*, immutable( char)*, -+ dchar*, const(dchar)*, immutable(dchar)*)) - { - test!P("hello\U00010143\u0100\U00010143"w); - } -- -- foreach(P; TypeTuple!(char*, const(char)*, immutable(char)*, -- wchar*, const(wchar)*, immutable(wchar)*)) -+ foreach (P; TypeTuple!( char*, const( char)*, immutable( char)*, -+ wchar*, const(wchar)*, immutable(wchar)*)) - { - test!P("hello\U00010143\u0100\U00010143"d); - } -- -- foreach(S; TypeTuple!(char[], wchar[], dchar[], -- const(char)[], const(wchar)[], const(dchar)[])) -+ foreach (S; TypeTuple!( char[], const( char)[], -+ wchar[], const(wchar)[], -+ dchar[], const(dchar)[])) - { - auto s = to!S("hello\U00010143\u0100\U00010143"); - -- foreach(P; TypeTuple!(char*, wchar*, dchar*, -- const(char)*, const(wchar)*, const(dchar)*, -- immutable(char)*, immutable(wchar)*, immutable(dchar)*)) -+ foreach (P; TypeTuple!( char*, const( char)*, immutable( char)*, -+ wchar*, const(wchar)*, immutable(wchar)*, -+ dchar*, const(dchar)*, immutable(dchar)*)) - { - test!P(s); - } - } -+ }); - } - - -@@ -2330,18 +2456,16 @@ unittest - that take an $(D LPWSTR) or $(D LPCWSTR) argument. - +/ - const(wchar)* toUTF16z(C)(const(C)[] str) -- if(isSomeChar!C) -+ if (isSomeChar!C) - { - return toUTFz!(const(wchar)*)(str); - } - - unittest - { -- import std.typetuple; -- - //toUTFz is already thoroughly tested, so this will just verify that - //toUTF16z compiles properly for the various string types. -- foreach(S; TypeTuple!(string, wstring, dstring)) -+ foreach (S; TypeTuple!(string, wstring, dstring)) - static assert(__traits(compiles, toUTF16z(to!S("hello world")))); - } - -@@ -2352,60 +2476,29 @@ unittest - { - debug(utf) printf("utf.toUTF.unittest\n"); - -- string c; -- wstring w; -- dstring d; -- -- c = "hello"; -- w = toUTF16(c); -- assert(w == "hello"); -- d = toUTF32(c); -- assert(d == "hello"); -- c = toUTF8(w); -- assert(c == "hello"); -- d = toUTF32(w); -- assert(d == "hello"); -- -- c = toUTF8(d); -- assert(c == "hello"); -- w = toUTF16(d); -- assert(w == "hello"); -- -- -- c = "hel\u1234o"; -- w = toUTF16(c); -- assert(w == "hel\u1234o"); -- d = toUTF32(c); -- assert(d == "hel\u1234o"); -- -- c = toUTF8(w); -- assert(c == "hel\u1234o"); -- d = toUTF32(w); -- assert(d == "hel\u1234o"); -- -- c = toUTF8(d); -- assert(c == "hel\u1234o"); -- w = toUTF16(d); -- assert(w == "hel\u1234o"); -- -- -- c = "he\U0010AAAAllo"; -- w = toUTF16(c); -- //foreach (wchar c; w) printf("c = x%x\n", c); -- //foreach (wchar c; cast(wstring)"he\U0010AAAAllo") printf("c = x%x\n", c); -- assert(w == "he\U0010AAAAllo"); -- d = toUTF32(c); -- assert(d == "he\U0010AAAAllo"); -- -- c = toUTF8(w); -- assert(c == "he\U0010AAAAllo"); -- d = toUTF32(w); -- assert(d == "he\U0010AAAAllo"); -- -- c = toUTF8(d); -- assert(c == "he\U0010AAAAllo"); -- w = toUTF16(d); -- assert(w == "he\U0010AAAAllo"); -+ assertCTFEable!( -+ { -+ assert(toUTF16("hello"c) == "hello"); -+ assert(toUTF32("hello"c) == "hello"); -+ assert(toUTF8 ("hello"w) == "hello"); -+ assert(toUTF32("hello"w) == "hello"); -+ assert(toUTF8 ("hello"d) == "hello"); -+ assert(toUTF16("hello"d) == "hello"); -+ -+ assert(toUTF16("hel\u1234o"c) == "hel\u1234o"); -+ assert(toUTF32("hel\u1234o"c) == "hel\u1234o"); -+ assert(toUTF8 ("hel\u1234o"w) == "hel\u1234o"); -+ assert(toUTF32("hel\u1234o"w) == "hel\u1234o"); -+ assert(toUTF8 ("hel\u1234o"d) == "hel\u1234o"); -+ assert(toUTF16("hel\u1234o"d) == "hel\u1234o"); -+ -+ assert(toUTF16("he\U0010AAAAllo"c) == "he\U0010AAAAllo"); -+ assert(toUTF32("he\U0010AAAAllo"c) == "he\U0010AAAAllo"); -+ assert(toUTF8 ("he\U0010AAAAllo"w) == "he\U0010AAAAllo"); -+ assert(toUTF32("he\U0010AAAAllo"w) == "he\U0010AAAAllo"); -+ assert(toUTF8 ("he\U0010AAAAllo"d) == "he\U0010AAAAllo"); -+ assert(toUTF16("he\U0010AAAAllo"d) == "he\U0010AAAAllo"); -+ }); - } - - -@@ -2420,17 +2513,20 @@ unittest - $(D UTFException) if $(D str) is not well-formed. - +/ - size_t count(C)(const(C)[] str) @trusted pure -- if(isSomeChar!C) -+ if (isSomeChar!C) - { - return walkLength(str); - } - - unittest - { -+ assertCTFEable!( -+ { - assert(count("") == 0); - assert(count("a") == 1); - assert(count("abc") == 3); - assert(count("\u20AC100") == 4); -+ }); - } - - -@@ -2459,6 +2555,7 @@ version(unittest) - @property C back() { return _str[$ - 1]; } - void popBack() { _str = _str[0 .. $ - 1]; } - @property auto save() { return BidirCU(_str); } -+ @property size_t length() { return _str.length; } - - this(inout(C)[] str) - { -@@ -2482,6 +2579,44 @@ version(unittest) - - this(inout(C)[] str) - { -+ _str = to!(C[])(str); -+ } -+ -+ C[] _str; -+ } -+ -+ class RefBidirCU(C) -+ { -+ @property bool empty() { return _str.empty; } -+ @property C front() { return _str[0]; } -+ void popFront() { _str = _str[1 .. $]; } -+ @property C back() { return _str[$ - 1]; } -+ void popBack() { _str = _str[0 .. $ - 1]; } -+ @property auto save() { return new RefBidirCU(_str); } -+ @property size_t length() { return _str.length; } -+ -+ this(inout(C)[] str) -+ { -+ _str = to!(C[])(str); -+ } -+ -+ C[] _str; -+ } -+ -+ class RefRandomCU(C) -+ { -+ @property bool empty() { return _str.empty; } -+ @property C front() { return _str[0]; } -+ void popFront() { _str = _str[1 .. $]; } -+ @property C back() { return _str[$ - 1]; } -+ void popBack() { _str = _str[0 .. $ - 1]; } -+ @property auto save() { return new RefRandomCU(_str); } -+ @property size_t length() { return _str.length; } -+ C opIndex(size_t i) { return _str[i]; } -+ auto opSlice(size_t i, size_t j) { return new RefRandomCU(_str[i .. j]); } -+ -+ this(inout(C)[] str) -+ { - _str = to!(C[])(str); - } - ---- a/src/libphobos/src/std/uuid.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/uuid.d 2014-04-01 16:32:51.000000000 +0100 -@@ -493,7 +493,7 @@ public struct UUID - - enum ctfeEmpty = UUID.init.empty; - assert(ctfeEmpty); -- -+ - bool ctfeTest() - { - for(size_t i = 0; i < 16; i++) -@@ -1396,7 +1396,7 @@ unittest - id = parseHelper!S("///8ab3060e2cba4f23b74cb52db3bdfb46||"); - enum ctfeId = parseHelper!S("8ab3060e-2cba-4f23-b74c-b52db3bdfb46"); - assert(parseHelper!S("8AB3060E-2cba-4f23-b74c-b52db3bdfb46") == ctfeId); -- -+ - //Test valid, working cases - assert(parseHelper!S("00000000-0000-0000-0000-000000000000").empty); - assert(parseHelper!S("8AB3060E-2CBA-4F23-b74c-B52Db3BDFB46").data ---- a/src/libphobos/src/std/variant.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/variant.d 2014-04-01 16:32:51.000000000 +0100 -@@ -29,7 +29,7 @@ - * a = 3.14; - * assert(a.type == typeid(double)); - * // Implicit conversions work just as with built-in types -- * assert(a > b); -+ * assert(a < b); - * // Check for convertibility - * assert(!a.convertsTo!(int)); // double not convertible to int - * // Strings and all other arrays are supported -@@ -211,7 +211,7 @@ private: - // no need to copy the data (it's garbage) - break; - case OpID.compare: -- auto rhs = cast(VariantN *) parm; -+ auto rhs = cast(const VariantN *) parm; - return rhs.peek!(A) - ? 0 // all uninitialized are equal - : ptrdiff_t.min; // uninitialized variant is not comparable otherwise -@@ -299,6 +299,12 @@ private: - case OpID.copyOut: - auto target = cast(VariantN *) parm; - assert(target); -+ -+ static if (target.size < A.sizeof) -+ { -+ if (target.type.tsize < A.sizeof) -+ *cast(A**)&target.store = new A; -+ } - tryPutting(zis, typeid(A), cast(void*) getPtr(&target.store)) - || assert(false); - target.fptr = &handler!(A); -@@ -595,7 +601,7 @@ public: - * assert(a == 6); - * ---- - */ -- @property T * peek(T)() -+ @property inout T * peek(T)() inout - { - static if (!is(T == void)) - static assert(allowed!(T), "Cannot store a " ~ T.stringof -@@ -752,7 +758,7 @@ public: - unittest - { - Variant a = "10"; -- assert(a.coerce!int == 10); -+ assert(a.coerce!int == 10); - } - - /** -@@ -771,13 +777,20 @@ public: - */ - - // returns 1 if the two are equal -- bool opEquals(T)(T rhs) -+ bool opEquals(T)(auto ref T rhs) const - { -- static if (is(T == VariantN)) -+ static if (is(Unqual!T == VariantN)) - alias rhs temp; - else - auto temp = VariantN(rhs); -- return fptr(OpID.compare, &store, &temp) == 0; -+ return !fptr(OpID.compare, cast(ubyte[size]*) &store, -+ cast(void*) &temp); -+ } -+ -+ // workaround for bug 10567 fix -+ int opCmp(ref const VariantN rhs) const -+ { -+ return (cast()this).opCmp!(VariantN)(cast()rhs); - } - - /** -@@ -898,7 +911,7 @@ public: - // Commenteed all _r versions for now because of ambiguities - // arising when two Variants are used - -- /////ditto -+ // ///ditto - // VariantN opSub_r(T)(T lhs) - // { - // return VariantN(lhs).opArithmetic!(VariantN, "-")(this); -@@ -1096,7 +1109,7 @@ unittest - int a; - long b; - string c; -- real d; -+ real d = 0.0; - bool e; - } - -@@ -1353,9 +1366,9 @@ unittest - assert( v.get!(string) == "Hello, World!" ); - - // Literal arrays are dynamically-typed -- v = cast(int[5]) [1,2,3,4,5]; -- assert( v.peek!(int[5]) ); -- assert( v.get!(int[5]) == [1,2,3,4,5] ); -+ v = cast(int[4]) [1,2,3,4]; -+ assert( v.peek!(int[4]) ); -+ assert( v.get!(int[4]) == [1,2,3,4] ); - - { - // @@@BUG@@@: array literals should have type T[], not T[5] (I guess) -@@ -1871,3 +1884,26 @@ private auto visitImpl(bool Strict, Vari - assert(false); - } - -+unittest -+{ -+ // http://d.puremagic.com/issues/show_bug.cgi?id=5310 -+ const Variant a; -+ assert(a == a); -+ Variant b; -+ assert(a == b); -+ assert(b == a); -+} -+ -+unittest -+{ -+ // http://d.puremagic.com/issues/show_bug.cgi?id=10017 -+ static struct S -+ { -+ ubyte[Variant.size + 1] s; -+ } -+ -+ Variant v1, v2; -+ v1 = S(); // the payload is allocated on the heap -+ v2 = v1; // AssertError: target must be non-null -+ assert(v1 == v2); -+} ---- a/src/libphobos/src/std/windows/charset.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/windows/charset.d 2014-04-01 16:32:51.000000000 +0100 -@@ -16,6 +16,7 @@ - * http://www.boost.org/LICENSE_1_0.txt) - */ - module std.windows.charset; -+version (Windows): - - private import std.conv; - private import std.c.windows.windows; ---- a/src/libphobos/src/std/windows/iunknown.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/windows/iunknown.d 2014-04-01 16:32:51.000000000 +0100 -@@ -1,6 +1,7 @@ - // Written in the D programming language. - - module std.windows.iunknown; -+version (Windows): - - // Replaced by: - public import std.c.windows.com; ---- a/src/libphobos/src/std/windows/registry.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/windows/registry.d 2014-04-01 16:32:51.000000000 +0100 -@@ -36,6 +36,7 @@ - * - * ////////////////////////////////////////////////////////////////////////// */ - module std.windows.registry; -+version (Windows): - - import std.array; - import std.system : Endian, endian; -@@ -68,11 +69,13 @@ class Win32Exception : Exception - { - int error; - -+ @safe pure nothrow - this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) - { - super(message, fn, ln, next); - } - -+ @safe pure - this(string message, int errnum, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) - { - super(text(message, " (", errnum, ")"), fn, ln, next); -@@ -116,6 +119,7 @@ public: - Params: - message = The message associated with the exception. - */ -+ @safe pure - this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) - { - super(message, fn, ln, next); -@@ -128,6 +132,7 @@ public: - message = The message associated with the exception. - error = The Win32 error number associated with the exception. - */ -+ @safe pure - this(string message, int error, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) - { - super(message, error, fn, ln, next); -@@ -520,6 +525,8 @@ in - } - body - { -+ import core.bitop : bswap; -+ - REG_VALUE_TYPE type; - - // See bugzilla 961 on this -@@ -631,6 +638,8 @@ in - } - body - { -+ import core.bitop : bswap; -+ - REG_VALUE_TYPE type; - - DWORD cbData = value.sizeof; -@@ -782,12 +791,14 @@ private void regProcessNthValue(HKEY hke - */ - class Key - { -+ @safe pure nothrow - invariant() - { - assert(m_hkey !is null); - } - - private: -+ @safe pure nothrow - this(HKEY hkey, string name, bool created) - in - { -@@ -1147,12 +1158,14 @@ private: - */ - class Value - { -+ @safe pure nothrow - invariant() - { - assert(m_key !is null); - } - - private: -+ @safe pure nothrow - this(Key key, string name, REG_VALUE_TYPE type) - in - { -@@ -1363,12 +1376,14 @@ foreach (string subkeyName; key.keyNames - */ - class KeyNameSequence - { -+ @safe pure nothrow - invariant() - { - assert(m_key !is null); - } - - private: -+ @safe pure nothrow - this(Key key) - { - m_key = key; -@@ -1458,12 +1473,14 @@ foreach (Key subkey; key.keys) - */ - class KeySequence - { -+ @safe pure nothrow - invariant() - { - assert(m_key !is null); - } - - private: -+ @safe pure nothrow - this(Key key) - { - m_key = key; -@@ -1565,12 +1582,14 @@ foreach (string valueName; key.valueName - */ - class ValueNameSequence - { -+ @safe pure nothrow - invariant() - { - assert(m_key !is null); - } - - private: -+ @safe pure nothrow - this(Key key) - { - m_key = key; -@@ -1659,12 +1678,14 @@ foreach (Value value; key.values) - */ - class ValueSequence - { -+ @safe pure nothrow - invariant() - { - assert(m_key !is null); - } - - private: -+ @safe pure nothrow - this(Key key) - { - m_key = key; ---- a/src/libphobos/src/std/windows/syserror.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/windows/syserror.d 2014-04-01 16:32:51.000000000 +0100 -@@ -14,11 +14,12 @@ - * http://www.boost.org/LICENSE_1_0.txt) - */ - module std.windows.syserror; -+version (Windows): - - private import std.windows.charset; - private import std.c.windows.windows; - --string sysErrorString(uint errcode) -+string sysErrorString(uint errcode) @trusted - { - char[] result; - char* buffer; -@@ -46,8 +47,9 @@ string sysErrorString(uint errcode) - result[0 .. r] = buffer[0 .. r]; - result[r] = 0; - -+ LocalFree(cast(HLOCAL)buffer); -+ - auto res = std.windows.charset.fromMBSz(cast(immutable)result.ptr); - -- LocalFree(cast(HLOCAL)buffer); - return res; - } ---- a/src/libphobos/src/std/xml.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/xml.d 2014-04-01 16:32:51.000000000 +0100 -@@ -441,6 +441,8 @@ enum DecodeMode - */ - string decode(string s, DecodeMode mode=DecodeMode.LOOSE) - { -+ import std.utf : encode; -+ - if (mode == DecodeMode.NONE) return s; - - char[] buffer; -@@ -691,7 +693,7 @@ class Element : Item - * Constructs an Element from a Tag. - * - * Params: -- * tag = the start or empty tag of the element. -+ * tag_ = the start or empty tag of the element. - */ - this(const(Tag) tag_) - { -@@ -967,7 +969,7 @@ class Element : Item - * $(DDOC_ENUM_MEMBERS EMPTY) Used for empty tags - * - */ --enum TagType { START, END, EMPTY }; -+enum TagType { START, END, EMPTY } - - /** - * Class representing an XML tag. -@@ -1115,9 +1117,10 @@ class Tag - override int opCmp(Object o) - { - const tag = toType!(const Tag)(o); -+ // Note that attr is an AA, so the comparison is nonsensical (bug 10381) - return - ((name != tag.name) ? ( name < tag.name ? -1 : 1 ) : -- ((attr != tag.attr) ? ( attr < tag.attr ? -1 : 1 ) : -+ ((attr != tag.attr) ? ( cast(void *)attr < cast(void*)tag.attr ? -1 : 1 ) : - ((type != tag.type) ? ( type < tag.type ? -1 : 1 ) : - 0 ))); - } -@@ -1154,7 +1157,7 @@ class Tag - { - string s = "<" ~ name; - foreach(key,val;attr) -- s ~= format(" %s=\"%s\"",key,decode(val,DecodeMode.LOOSE)); -+ s ~= format(" %s=\"%s\"",key,encode(val)); - return s; - } - -@@ -1653,7 +1656,7 @@ class DocumentParser : ElementParser - * This is enforced by the function's in contract. - * - * Params: -- * xmltext = the entire XML document as text -+ * xmlText_ = the entire XML document as text - * - */ - this(string xmlText_) -@@ -2729,6 +2732,13 @@ EOS"; - xml.parse(); - } - -+unittest -+{ -+ string s = `<tag attr=""value>" />`; -+ auto doc = new Document(s); -+ assert(doc.toString() == s); -+} -+ - /** The base class for exceptions thrown by this module */ - class XMLException : Exception { this(string msg) { super(msg); } } - ---- a/src/libphobos/src/std/zip.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/zip.d 2014-04-01 16:32:51.000000000 +0100 -@@ -37,6 +37,7 @@ import std.datetime; - import core.bitop; - import std.conv; - import std.algorithm; -+import std.bitmanip : littleEndianToNative, nativeToLittleEndian; - - //debug=print; - -@@ -473,50 +474,24 @@ class ZipArchive - - ushort getUshort(int i) - { -- version (LittleEndian) -- { -- return *cast(ushort *)&data[i]; -- } -- else -- { -- ubyte b0 = data[i]; -- ubyte b1 = data[i + 1]; -- return (b1 << 8) | b0; -- } -+ ubyte[2] result = data[i .. i + 2]; -+ return littleEndianToNative!ushort(result); - } - - uint getUint(int i) - { -- version (LittleEndian) -- { -- return *cast(uint *)&data[i]; -- } -- else -- { -- return bswap(*cast(uint *)&data[i]); -- } -+ ubyte[4] result = data[i .. i + 4]; -+ return littleEndianToNative!uint(result); - } - - void putUshort(int i, ushort us) - { -- version (LittleEndian) -- { -- *cast(ushort *)&data[i] = us; -- } -- else -- { -- data[i] = cast(ubyte)us; -- data[i + 1] = cast(ubyte)(us >> 8); -- } -+ data[i .. i + 2] = nativeToLittleEndian(us); - } - - void putUint(int i, uint ui) - { -- version (BigEndian) -- { -- ui = bswap(ui); -- } -- *cast(uint *)&data[i] = ui; -+ data[i .. i + 4] = nativeToLittleEndian(ui); - } - } - ---- a/src/libphobos/src/std/zlib.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std/zlib.d 2014-04-01 16:32:51.000000000 +0100 -@@ -143,9 +143,12 @@ const(void)[] compress(const(void)[] buf - - /********************************************* - * Decompresses the data in srcbuf[]. -- * Params: destlen = size of the uncompressed data. -- * It need not be accurate, but the decompression will be faster if the exact -- * size is supplied. -+ * Params: -+ * srcbuf = buffer containing the compressed data. -+ * destlen = size of the uncompressed data. -+ * It need not be accurate, but the decompression will be faster -+ * if the exact size is supplied. -+ * winbits = the base two logarithm of the maximum window size. - * Returns: the decompressed data. - */ - ---- a/src/libphobos/src/std.ddoc 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/std.ddoc 1970-01-01 01:00:00.000000000 +0100 -@@ -1,298 +0,0 @@ --BR = <br>
--DDOC_DITTO = $(BR)$0
--DDOC_SUMMARY = $0$(P)
--DDOC_DESCRIPTION = $0$(P)
--DDOC_AUTHORS = $(B Authors:)$(BR)$0$(P)
--DDOC_BUGS = $(RED BUGS:)$(BR)$0$(P)
--DDOC_COPYRIGHT = $(B Copyright:)$(BR)$0$(P)
--DDOC_DATE = $(B Date:)$(BR)$0$(P)
--DDOC_DEPRECATED = $(RED Deprecated:)$(BR)$0$(P)
--DDOC_EXAMPLES = $(B Examples:)$(BR)$0$(P)
--DDOC_HISTORY = $(B History:)$(BR)$0$(P)
--DDOC_LICENSE = $(B License:)$(BR)$0$(P)
--DDOC_RETURNS = $(B Returns:)$(BR)$0$(P)
--DDOC_SEE_ALSO = $(B See Also:)$(BR)$0$(P)
--DDOC_STANDARDS = $(B Standards:)$(BR)$0$(P)
--DDOC_THROWS = $(B Throws:)$(BR)$0$(P)
--DDOC_VERSION = $(B Version:)$(BR)$0$(P)
--DDOC_SECTION_H = $(B $0)$(BR)
--DDOC_SECTION = $0$(P)
--DDOC_PARAMS = $(B Parameters:)<table class=parms>$0</table>$(P)
--DDOC_BLANKLINE = $(P)
--
--DDOC = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-- "http://www.w3.org/TR/html4/loose.dtd">
--<html lang='en'>
--
--<!--
-- Copyright (c) 1999-2010 by Digital Mars
-- All Rights Reserved Written by Walter Bright
-- http://www.digitalmars.com
-- -->
--
--<head>
--<meta http-equiv="content-type" content="text/html; charset=utf-8" >
--<title>$(TITLE) - D Programming Language - Digital Mars</title>
--<link rel="stylesheet" type="text/css" href="../style.css">
--
--<script type="text/javascript">
--function listanchors()
--{
-- if (typeof inhibitQuickIndex !== 'undefined') return;
-- var a = document.getElementById("quickindex");
-- if (!a) return;
-- var newText = "";
-- var hash = new Array;
-- var n = 0;
-- var values = new Array;
-- // List all anchors.
-- for (var i = 0; i < document.anchors.length; i++)
-- {
-- var a = document.anchors[i];
-- var text = a.name;
-- if (hash[text] > 0) continue;
-- hash[text] = 1;
-- values[n++] = a.name
-- }
--
-- values.sort();
--
-- for(var i = 0; i < values.length; i++) {
-- var a = values[i];
-- newText += ' \x3Ca href="\x23' + a +
-- '"\x3E\x3Cspan class="d_psymbol"\x3E' + a + '\x3C/span\x3E\x3C/a\x3E';
-- }
-- if (newText != "") newText = "\x3Cp\x3E\x3Cb\x3EJump to:\x3C/b\x3E" + newText + "\x3C/p\x3E";
-- var a = document.getElementById("quickindex");
-- a.innerHTML = newText;
--}
--</script>
--
--</head>
--
--<body onload="listanchors()">
--<div id="heading">
-- <a href="http://www.digitalmars.com/"><img src="../dmlogo.gif" width="270" height="53" border="0" alt="www.digitalmars.com" align="left"></a>
-- <p align="right">D Programming Language 2.0</p>
--
--
-- <div id="headingNav">
-- $(UL
-- $(LI <a href="http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/$(WIKI)" title="Read/write comments and feedback">Comments</a>)
-- $(LI <a href="../index.html" title="D Programming Language" class="dlink">D</a>)
-- $(LI <a href="http://www.digitalmars.com/advancedsearch.html" title="Search Digital Mars web site">Search</a>)
-- $(LI <a href="http://www.digitalmars.com/" title="www.digitalmars.com">Home</a>)
-- )
-- </div>
--
-- <div id="lastupdate">Last update $(DATETIME)</div>
--</div>
--
--<div id="navigation">
-- $(TOP)
-- $(NAVIGATION_PHOBOS)
--</div>
--<div id="content">
-- <h1>$(TITLE)</h1>
-- <div id=quickindex class=quickindex></div>
-- $(BODY)
-- $(GOOGLE_FOOTER)
--</div>
--
--
--<div id="copyright">
--$(COPYRIGHT) |
--Page generated by $(LINK2 http://www.digitalmars.com/d/2.0/ddoc.html, Ddoc).
--</div>
--
--</body>
--</html>
--
--GOOGLE_FOOTER=
--<br><br>
--<br><br>
--<!-- Google ad -->
--<script type="text/javascript"><!--
--/**/google_ad_client = "pub-5628673096434613";
--/**/google_ad_width = 728;
--/**/google_ad_height = 90;
--/**/google_ad_format = "728x90_as";
--/**/google_ad_channel ="6203743411";
--/**/google_page_url = document.location;
--//--></script>
--<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
--</script>
--
--TOP=
--<div class="navblock">
--<form method="get" action="http://www.google.com/search">
--<div id="searchbox">
--<input id="q" name="q" size="10" value="RTL Search" onFocus='if(this.value == "RTL Search"){this.value="";}'>
--<input type="hidden" id="domains" name="domains" value="www.digitalmars.com">
--<input type="hidden" id="sitesearch" name="sitesearch" value="www.digitalmars.com/d/2.0/phobos">
--<input type="hidden" id="sourceid" name="sourceid" value="google-search">
--<input type="submit" id="submit" name="submit" value="Go">
--</div>
--</form>
--<div id="toctop">
-- $(UL
-- $(LI <a href="../index.html" title="D Programming Language">D</a>)
-- $(LI <a href="../lex.html" title="D Language Specification">Language</a>)
-- $(LI <a href="phobos.html" title="D Runtime Library">Phobos</a>)
-- $(LI <a href="../comparison.html" title="Language Comparisons">Comparisons</a>)
-- )
--</div>
--</div>
--
--NAVIGATION_PHOBOS=
--<div class="navblock">
-- $(UL
-- $(LI <a href="object.html" title="root of object hierarchy">object</a>)
-- )
-- <h2><a href="phobos.html#std" title="D standard modules">std</a></h2>
-- $(UL
-- $(LI <a href="std_algorithm.html" title="General-purpose algorithms">std.algorithm</a>)
-- $(LI <a href="std_array.html" title="Array functions">std.array</a>)
-- $(LI <a href="std_ascii.html" title="Functions which operate on ASCII characters">std.ascii</a>)
-- $(LI <a href="std_base64.html" title="Encode/decode base64 format">std.base64</a>)
-- $(LI <a href="std_bigint.html" title="Arbitrary-precision ('bignum') arithmetic">std.bigint</a>)
-- $(LI <a href="std_bitmanip.html" title="Bit-level manipulation">std.bitmanip</a>)
-- $(LI <a href="std_compiler.html" title="Information about the D compiler implementation">std.compiler</a>)
-- $(LI <a href="std_complex.html" title="Complex numbers">std.complex</a>)
-- $(LI <a href="std_concurrency.html" title="Message Passing">std.concurrency</a>)
-- $(LI <a href="std_container.html" title="Containers">std.container</a>)
-- $(LI <a href="std_contracts.html" title="Think assert">std.contracts</a>)
-- $(LI <a href="std_conv.html" title="Conversion of strings to integers">std.conv</a>)
-- $(LI <a href="std_cpuid.html" title="CPU identification">std.cpuid</a>)
-- $(LI <a href="std_ctype.html" title="Simple character classification">std.ctype</a>)
-- $(LI <a href="std_date.html" title="Date and time functions">std.date</a>)
-- $(LI <a href="std_datetime.html" title="Date and time-related types and functions">std.datetime</a>)
-- $(LI <a href="std_demangle.html" title="Demangle D names">std.demangle</a>)
-- $(LI <a href="std_encoding.html" title="Character and string encoding">std.encoding</a>)
-- $(LI <a href="std_exception.html" title="Exceptions and error handling">std.exception</a>)
-- $(LI <a href="std_file.html" title="Basic file operations">std.file</a>)
-- $(LI <a href="std_format.html" title="Formatted conversions of values to strings">std.format</a>)
-- $(LI <a href="std_functional.html" title="functional">std.functional</a>)
-- $(LI <a href="std_getopt.html" title="Command line options">std.getopt</a>)
-- $(LI <a href="std_gregorian.html" title="Gregorian Calendar">std.gregorian</a>)
-- $(LI <a href="std_json.html" title="JSON reader">std.json</a>)
-- $(LI <a href="std_math.html" title="the usual math functions">std.math</a>)
-- $(LI <a href="std_mathspecial.html" title="mathematical special functions">std.mathspecial</a>)
-- $(LI <a href="std_md5.html" title="Compute MD5 digests">std.md5</a>)
-- $(LI <a href="std_metastrings.html" title="Metaprogramming with strings">std.metastrings</a>)
-- $(LI <a href="std_mmfile.html" title="Memory mapped files">std.mmfile</a>)
-- $(LI <a href="std_numeric.html" title="Numeric algorithms">std.numeric</a>)
-- $(LI <a href="std_outbuffer.html" title="Assemble data into an array of bytes">std.outbuffer</a>)
-- $(LI <a href="std_parallelism.html" title="High-level primitives for SMP parallelism">std.parallelism</a>)
-- $(LI <a href="std_path.html" title="Manipulate file names, path names, etc.">std.path</a>)
-- $(LI <a href="std_process.html" title="Create/destroy processes">std.process</a>)
-- $(LI <a href="std_random.html" title="Random number generation">std.random</a>)
-- $(LI <a href="std_range.html" title="Ranges">std.range</a>)
-- $(LI <a href="std_regex.html" title="regular expressions">std.regex</a>)
-- $(LI <a href="std_regexp.html" title="regular expressions (deprecated)">std.regexp</a>)
-- $(LI <a href="std_signals.html" title="Signals">std.signals</a>)
-- $(LI <a href="std_socket.html" title="Sockets">std.socket</a>)
-- $(LI <a href="std_socketstream.html" title="Stream for a blocking, connected Socket">std.socketstream</a>)
-- $(LI <a href="std_stdint.html" title="Integral types for various purposes">std.stdint</a>)
-- $(LI <a href="std_stdio.html" title="Standard I/O">std.stdio</a>)
-- $(LI <a href="std_cstream.html" title="Stream I/O">std.cstream</a>)
-- $(LI <a href="std_stream.html" title="Stream I/O">std.stream</a>)
-- $(LI <a href="std_string.html" title="Basic string operations">std.string</a>)
-- $(LI <a href="std_system.html" title="Inquire about the CPU, operating system">std.system</a>)
-- $(LI <a href="std_traits.html" title="Type traits">std.traits</a>)
-- $(LI <a href="std_typecons.html" title="Type constructors">std.typecons</a>)
-- $(LI <a href="std_typetuple.html" title="Type tuples">std.typetuple</a>)
-- $(LI <a href="std_uni.html" title="Unicode classification">std.uni</a>)
-- $(LI <a href="std_uri.html" title="Encode and decode Uniform Resource Identifiers (URIs)">std.uri</a>)
-- $(LI <a href="std_utf.html" title="Encode and decode utf character encodings">std.utf</a>)
-- $(LI <a href="std_variant.html" title="Stores all types in a uniform, dynamically-checked representation">std.variant</a>)
-- $(LI <a href="std_xml.html" title="XML file processing">std.xml</a>)
-- $(LI <a href="std_zip.html" title="Read/write zip archives">std.zip</a>)
-- $(LI <a href="std_zlib.html" title="Compression / Decompression of data">std.zlib</a>)
-- $(LI <a href="std_c_fenv.html" title="Floating point environment">std.c.fenv</a>)
-- $(LI <a href="std_c_locale.html" title="Locale">std.c.locale</a>)
-- $(LI <a href="std_c_math.html" title="Math">std.c.math</a>)
-- $(LI <a href="std_c_process.html" title="Process">std.c.process</a>)
-- $(LI <a href="std_c_stdarg.html" title="Variadic arguments">std.c.stdarg</a>)
-- $(LI <a href="std_c_stddef.html" title="Standard definitions">std.c.stddef</a>)
-- $(LI <a href="std_c_stdio.html" title="Standard I/O">std.c.stdio</a>)
-- $(LI <a href="std_c_stdlib.html" title="Standard library">std.c.stdlib</a>)
-- $(LI <a href="std_c_string.html" title="Strings">std.c.string</a>)
-- $(LI <a href="std_c_time.html" title="Time">std.c.time</a>)
-- $(LI <a href="std_c_wcharh.html" title="Wide characters">std.c.wcharh</a>)
-- $(LI <a href="std_net_isemail.html" title="Validate e-mail addresses">std.net.isemail</a>)
-- $(LI <a href="std_windows_charset.html" title="Conversion to/from Windows character sets">std.windows.charset</a>)
-- $(LI <a href="phobos.html#std_windows" title="Modules specific to Windows">std.windows</a>)
-- $(LI <a href="phobos.html#std_linux" title="Modules specific to Windows">std.linux</a>)
-- $(LI <a href="phobos.html#std_c_windows" title="C Windows API">std.c.windows</a>)
-- $(LI <a href="phobos.html#std_c_linux" title="C Linux API">std.c.linux</a>)
-- )
-- <h2><a href="phobos.html#etc" title="D etc modules">etc</a></h2>
-- $(UL
-- $(LI <a href="etc_c_curl.html" title="Interface to libcurl library">etc.c.curl</a>)
-- $(LI <a href="etc_c_zlib.html" title="Interface to zlib library">etc.c.zlib</a>)
-- )
-- <h2><a href="phobos.html#core" title="D core modules">core</a></h2>
-- $(UL
-- $(LI <a href="core_atomic.html" title="Atomic operations">core.atomic</a>)
-- $(LI <a href="core_bitop.html" title="Bitwise operations">core.bitop</a>)
-- $(LI <a href="core_cpuid.html" title="CPU identification">core.cpuid</a>)
-- $(LI <a href="core_exception.html" title="Root of exception hierarchy">core.exception</a>)
-- $(LI <a href="core_memory.html" title="Interface to memory management">core.memory</a>)
-- $(LI <a href="core_runtime.html" title="Interface to D runtime library internals">core.runtime</a>)
-- $(LI <a href="core_thread.html" title="Thread management">core.thread</a>)
-- $(LI <a href="core_time.html" title="Core time functionality">core.time</a>)
-- $(LI <a href="core_vararg.html" title="Variable function arguments">core.vararg</a>)
-- $(LI <a href="core_sync_barrier.html" title="Synchronizing progress of a group of threads">core.sync.barrier</a>)
-- $(LI <a href="core_sync_condition.html" title="Synchronized condition checking">core.sync.condition</a>)
-- $(LI <a href="core_sync_config.html" title="Stuff for core.sync">core.sync.config</a>)
-- $(LI <a href="core_sync_exception.html" title="SyncException">core.sync.exception</a>)
-- $(LI <a href="core_sync_mutex.html" title="Mutexes">core.sync.mutex</a>)
-- $(LI <a href="core_sync_rwmutex.html" title="R/W mutually exclusive access">core.sync.rwmutex</a>)
-- $(LI <a href="core_sync_semaphore.html" title="Semaphores">core.sync.semaphore</a>)
-- )
--</div>
--
--RED = <span style="color:red">$0</span>
--GREEN = <span style="color:green">$0</span>
--BLUE = <span style="color:blue">$0</span>
--YELLOW = <span style="color:yellow">$0</span>
--BLACK = <span style="color:black">$0</span>
--WHITE = <span style="color:white">$0</span>
--
--D_COMMENT = <span class="d_comment">$0</span>
--D_STRING = <span class="d_string">$0</span>
--D_KEYWORD = <span class="d_keyword">$0</span>
--D_PSYMBOL = <span class="d_psymbol">$0</span>
--D_PARAM = <span class="d_param">$0</span>
--RPAREN = )
--LPAREN = (
--LESS = <
--GREATER = >
--WEB = $(LINK2 http://$1,$2)
--LUCKY = $(WEB
--google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=$0,$0)
--D = <font face=Courier><b>$0</b></font>
--D = <span class="d_inlinecode">$0</span>
--BIGOH = <i><b>Ο</i>(</i></b>$(D $0)<b></i>)</i></b>
--GLOSSARY = $(LINK2 ../glossary.html#$0, $0)
--
--DDOC_PSYMBOL = <a name="$0"></a>$(U $0)
--DDOC_DECL = $(DT <div class="d_decl">$0</div>)
--XREF = <a href="std_$1.html#$2">$(D std.$1.$2)</a>
--CXREF = <a href="core_$1.html#$2">$(D core.$1.$2)</a>
--LREF = <a href="#$1">$(D $1)</a>
--BUGZILLA = $(LINK2 http://d.puremagic.com/issues/show_bug.cgi?id=$0, Bugzilla $0)
--PRE = <pre>$0</pre>
--PHOBOSSRC=$(LINK2 https://github.com/D-Programming-Language/phobos/blob/master/$0, $0)
--DRUNTIMESRC=$(LINK2 https://github.com/D-Programming-Language/druntime/blob/master/src/$0, $0)
--SAMPLESRC=$(LINK2 https://github.com/D-Programming-Language/dmd/blob/master/samples/$0, /dmd/samples/d/$0)
--
--BOOKTABLE = <table cellspacing=0 cellpadding=5 valign=top class=book><caption>$1</caption>$2</table>
--TABLE = <table cellspacing=0 cellpadding=5><caption>$1</caption>$2</table>
--TD = <td valign=top>$0</td>
--TDNW = <td valign=top>$0</td>
--SUB = <sub>$0</sub>
--
--COPYRIGHT= Copyright © 1999-$(YEAR) by Digital Mars, All Rights Reserved
--
---- a/src/libphobos/src/unittest.d 2013-06-01 16:19:09.000000000 +0100 -+++ b/src/libphobos/src/unittest.d 2014-04-01 16:32:51.000000000 +0100 -@@ -13,13 +13,14 @@ - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -+version(Win64) {} -+else -+{ - public import std.base64; - public import std.compiler; - public import std.concurrency; - public import std.conv; --public import std.cpuid; - public import std.cstream; --public import std.ctype; - public import std.datetime; - public import std.demangle; - public import std.file; -@@ -33,10 +34,9 @@ public import std.mmfile; - public import std.outbuffer; - public import std.parallelism; - public import std.path; --public import std.perf; - public import std.process; - public import std.random; --public import std.regexp; -+public import std.regex; - public import std.signals; - //public import std.slist; - public import std.socket; -@@ -52,35 +52,44 @@ public import std.typetuple; - public import std.uni; - public import std.uri; - public import std.utf; -+public import std.uuid; - public import std.variant; - public import std.zip; - public import std.zlib; -+public import std.net.isemail; -+//public import std.net.curl; -+public import std.digest.digest; -+public import std.digest.crc; -+public import std.digest.sha; -+public import std.digest.md; -+ -+} - - int main(char[][] args) - { - --version (all) -+version(Win64) {} -+else - { - // Bring in unit test for module by referencing function in it - - cmp("foo", "bar"); // string -- fncharmatch('a', 'b'); // path -+ filenameCharCmp('a', 'b'); // path - isNaN(1.0); // math - std.conv.to!double("1.0"); // std.conv - OutBuffer b = new OutBuffer(); // outbuffer -- std.ctype.tolower('A'); // ctype -- RegExp r = new RegExp(null, null); // regexp -- uint ranseed = std.random.unpredictableSeed(); -- thisTid(); -+ auto r = regex(""); // regex -+ uint ranseed = std.random.unpredictableSeed; -+ thisTid; - int a[]; - a.reverse; // adi - a.sort; // qsort - Clock.currTime(); // datetime - Exception e = new ReadException(""); // stream - din.eof(); // cstream -- isValidDchar(cast(dchar)0); // utf -- std.uri.ascii2hex(0); // uri -- std.zlib.adler32(0,null); // D.zlib -+ isValidDchar(cast(dchar)0); // utf -+ std.uri.ascii2hex(0); // uri -+ std.zlib.adler32(0,null); // D.zlib - auto t = task!cmp("foo", "bar"); // parallelism - - ubyte[16] buf; -@@ -109,7 +118,7 @@ version (all) - - std.demangle.demangle("hello"); - -- std.uni.isUniAlpha('A'); -+ std.uni.isAlpha('A'); - - std.file.exists("foo"); - -@@ -118,8 +127,15 @@ version (all) - - std.signals.linkin(); - -- writefln(std.cpuid.toString()); -+ bool isEmail = std.net.isemail.isEmail("abc"); -+ //auto http = std.net.curl.HTTP("dlang.org"); -+ auto uuid = randomUUID(); -+ -+ auto md5 = md5Of("hello"); -+ auto sha1 = sha1Of("hello"); -+ auto crc = crc32Of("hello"); -+ auto string = toHexString(crc); -+ puts("Success!"); - } -- printf("Success!\n"); - return 0; - } diff --git a/debian/patches/gdc-versym-cpu.diff b/debian/patches/gdc-versym-cpu.diff index b777f99..6cadb49 100644 --- a/debian/patches/gdc-versym-cpu.diff +++ b/debian/patches/gdc-versym-cpu.diff @@ -66,7 +66,7 @@ Index: b/src/gcc/config/alpha/alpha.h =================================================================== --- a/src/gcc/config/alpha/alpha.h +++ b/src/gcc/config/alpha/alpha.h -@@ -72,6 +72,23 @@ +@@ -72,6 +72,23 @@ along with GCC; see the file COPYING3. SUBTARGET_LANGUAGE_CPP_BUILTINS(); \ } while (0) @@ -94,7 +94,7 @@ Index: b/src/gcc/config/arm/arm.h =================================================================== --- a/src/gcc/config/arm/arm.h +++ b/src/gcc/config/arm/arm.h -@@ -158,6 +158,31 @@ +@@ -158,6 +158,31 @@ extern char arm_arch_name[]; builtin_define ("__ARM_ARCH_EXT_IDIV__"); \ } while (0) @@ -130,7 +130,7 @@ Index: b/src/gcc/config/i386/i386.h =================================================================== --- a/src/gcc/config/i386/i386.h +++ b/src/gcc/config/i386/i386.h -@@ -588,6 +588,24 @@ +@@ -588,6 +588,24 @@ extern const char *host_detect_local_cpu /* Target CPU builtins. */ #define TARGET_CPU_CPP_BUILTINS() ix86_target_macros () @@ -159,7 +159,7 @@ Index: b/src/gcc/config/ia64/ia64.h =================================================================== --- a/src/gcc/config/ia64/ia64.h +++ b/src/gcc/config/ia64/ia64.h -@@ -40,6 +40,13 @@ +@@ -40,6 +40,13 @@ do { \ builtin_define("__BIG_ENDIAN__"); \ } while (0) @@ -177,7 +177,7 @@ Index: b/src/gcc/config/mips/mips.h =================================================================== --- a/src/gcc/config/mips/mips.h +++ b/src/gcc/config/mips/mips.h -@@ -551,6 +551,54 @@ +@@ -551,6 +551,54 @@ struct mips_cpu_info { } \ while (0) @@ -236,7 +236,7 @@ Index: b/src/gcc/config/pa/pa.h =================================================================== --- a/src/gcc/config/pa/pa.h +++ b/src/gcc/config/pa/pa.h -@@ -185,6 +185,20 @@ +@@ -185,6 +185,20 @@ do { \ builtin_define("_PA_RISC1_0"); \ } while (0) @@ -261,7 +261,7 @@ Index: b/src/gcc/config/rs6000/rs6000.h =================================================================== --- a/src/gcc/config/rs6000/rs6000.h +++ b/src/gcc/config/rs6000/rs6000.h -@@ -613,6 +613,28 @@ +@@ -702,6 +702,28 @@ extern unsigned char rs6000_recip_bits[] #define TARGET_CPU_CPP_BUILTINS() \ rs6000_cpu_cpp_builtins (pfile) @@ -294,7 +294,7 @@ Index: b/src/gcc/config/s390/s390.h =================================================================== --- a/src/gcc/config/s390/s390.h +++ b/src/gcc/config/s390/s390.h -@@ -114,6 +114,22 @@ +@@ -114,6 +114,22 @@ enum processor_flags } \ while (0) @@ -321,7 +321,7 @@ Index: b/src/gcc/config/sh/sh.h =================================================================== --- a/src/gcc/config/sh/sh.h +++ b/src/gcc/config/sh/sh.h -@@ -31,6 +31,22 @@ +@@ -31,6 +31,22 @@ extern int code_for_indirect_jump_scratc #define TARGET_CPU_CPP_BUILTINS() sh_cpu_cpp_builtins (pfile) @@ -348,7 +348,7 @@ Index: b/src/gcc/config/sparc/sparc.h =================================================================== --- a/src/gcc/config/sparc/sparc.h +++ b/src/gcc/config/sparc/sparc.h -@@ -27,6 +27,31 @@ +@@ -27,6 +27,31 @@ along with GCC; see the file COPYING3. #define TARGET_CPU_CPP_BUILTINS() sparc_target_macros () diff --git a/debian/patches/gdc-versym-os.diff b/debian/patches/gdc-versym-os.diff index 282d34f..f1f0750 100644 --- a/debian/patches/gdc-versym-os.diff +++ b/debian/patches/gdc-versym-os.diff @@ -36,7 +36,7 @@ Index: b/src/gcc/config/alpha/linux.h =================================================================== --- a/src/gcc/config/alpha/linux.h +++ b/src/gcc/config/alpha/linux.h -@@ -33,6 +33,16 @@ +@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3. builtin_define ("_GNU_SOURCE"); \ } while (0) @@ -77,7 +77,7 @@ Index: b/src/gcc/config/darwin.h =================================================================== --- a/src/gcc/config/darwin.h +++ b/src/gcc/config/darwin.h -@@ -921,4 +921,10 @@ +@@ -921,4 +921,10 @@ extern void darwin_driver_init (unsigned providing an osx-version-min of this unless overridden by the User. */ #define DEF_MIN_OSX_VERSION "10.4" @@ -92,7 +92,7 @@ Index: b/src/gcc/config/freebsd.h =================================================================== --- a/src/gcc/config/freebsd.h +++ b/src/gcc/config/freebsd.h -@@ -32,6 +32,13 @@ +@@ -32,6 +32,13 @@ along with GCC; see the file COPYING3. #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS() @@ -110,7 +110,7 @@ Index: b/src/gcc/config/gnu.h =================================================================== --- a/src/gcc/config/gnu.h +++ b/src/gcc/config/gnu.h -@@ -39,3 +39,11 @@ +@@ -39,3 +39,11 @@ along with GCC. If not, see <http://www builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } while (0) @@ -126,7 +126,7 @@ Index: b/src/gcc/config/i386/cygwin.h =================================================================== --- a/src/gcc/config/i386/cygwin.h +++ b/src/gcc/config/i386/cygwin.h -@@ -20,6 +20,13 @@ +@@ -20,6 +20,13 @@ along with GCC; see the file COPYING3. #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */ @@ -144,7 +144,7 @@ Index: b/src/gcc/config/i386/linux-common.h =================================================================== --- a/src/gcc/config/i386/linux-common.h +++ b/src/gcc/config/i386/linux-common.h -@@ -27,6 +27,15 @@ +@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -164,7 +164,7 @@ Index: b/src/gcc/config/i386/mingw32.h =================================================================== --- a/src/gcc/config/i386/mingw32.h +++ b/src/gcc/config/i386/mingw32.h -@@ -53,6 +53,18 @@ +@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -187,7 +187,7 @@ Index: b/src/gcc/config/i386/mingw-w64.h =================================================================== --- a/src/gcc/config/i386/mingw-w64.h +++ b/src/gcc/config/i386/mingw-w64.h -@@ -84,3 +84,10 @@ +@@ -84,3 +84,10 @@ along with GCC; see the file COPYING3. %{static:-Bstatic} %{!static:-Bdynamic} \ %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ %(shared_libgcc_undefs)" @@ -202,7 +202,7 @@ Index: b/src/gcc/config/kfreebsd-gnu.h =================================================================== --- a/src/gcc/config/kfreebsd-gnu.h +++ b/src/gcc/config/kfreebsd-gnu.h -@@ -29,6 +29,14 @@ +@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -221,7 +221,7 @@ Index: b/src/gcc/config/knetbsd-gnu.h =================================================================== --- a/src/gcc/config/knetbsd-gnu.h +++ b/src/gcc/config/knetbsd-gnu.h -@@ -30,6 +30,16 @@ +@@ -30,6 +30,16 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -242,7 +242,7 @@ Index: b/src/gcc/config/kopensolaris-gnu.h =================================================================== --- a/src/gcc/config/kopensolaris-gnu.h +++ b/src/gcc/config/kopensolaris-gnu.h -@@ -30,5 +30,15 @@ +@@ -30,5 +30,15 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -279,7 +279,7 @@ Index: b/src/gcc/config/linux.h =================================================================== --- a/src/gcc/config/linux.h +++ b/src/gcc/config/linux.h -@@ -49,6 +49,20 @@ +@@ -49,6 +49,20 @@ see the files COPYING3 and COPYING.RUNTI builtin_assert ("system=posix"); \ } while (0) @@ -304,7 +304,7 @@ Index: b/src/gcc/config/mips/linux-common.h =================================================================== --- a/src/gcc/config/mips/linux-common.h +++ b/src/gcc/config/mips/linux-common.h -@@ -27,6 +27,15 @@ +@@ -27,6 +27,15 @@ along with GCC; see the file COPYING3. ANDROID_TARGET_OS_CPP_BUILTINS(); \ } while (0) @@ -324,7 +324,7 @@ Index: b/src/gcc/config/netbsd.h =================================================================== --- a/src/gcc/config/netbsd.h +++ b/src/gcc/config/netbsd.h -@@ -29,6 +29,14 @@ +@@ -29,6 +29,14 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -343,7 +343,7 @@ Index: b/src/gcc/config/openbsd.h =================================================================== --- a/src/gcc/config/openbsd.h +++ b/src/gcc/config/openbsd.h -@@ -84,6 +84,14 @@ +@@ -84,6 +84,14 @@ along with GCC; see the file COPYING3. } \ while (0) @@ -380,7 +380,7 @@ Index: b/src/gcc/config/rs6000/linux64.h =================================================================== --- a/src/gcc/config/rs6000/linux64.h +++ b/src/gcc/config/rs6000/linux64.h -@@ -323,6 +323,17 @@ +@@ -339,6 +339,17 @@ extern int dot_symbols; } \ while (0) diff --git a/debian/patches/go-use-gold.diff b/debian/patches/go-use-gold.diff index 8b56a81..54d9cd2 100644 --- a/debian/patches/go-use-gold.diff +++ b/debian/patches/go-use-gold.diff @@ -17,7 +17,7 @@ Index: b/src/gcc/go/gospec.c =================================================================== --- a/src/gcc/go/gospec.c +++ b/src/gcc/go/gospec.c -@@ -117,6 +117,10 @@ +@@ -117,6 +117,10 @@ lang_specific_driver (struct cl_decoded_ /* Whether the -S option was used. */ bool saw_opt_S = false; @@ -28,7 +28,7 @@ Index: b/src/gcc/go/gospec.c /* The first input file with an extension of .go. */ const char *first_go_file = NULL; -@@ -217,6 +221,11 @@ +@@ -217,6 +221,11 @@ lang_specific_driver (struct cl_decoded_ } break; @@ -40,7 +40,7 @@ Index: b/src/gcc/go/gospec.c } } -@@ -226,8 +235,14 @@ +@@ -226,8 +235,14 @@ lang_specific_driver (struct cl_decoded_ shared_libgcc = 0; #endif @@ -56,7 +56,7 @@ Index: b/src/gcc/go/gospec.c new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args); i = 0; -@@ -244,6 +259,14 @@ +@@ -244,6 +259,14 @@ lang_specific_driver (struct cl_decoded_ &new_decoded_options[j]); j++; } @@ -75,7 +75,7 @@ Index: b/src/libgo/configure.ac =================================================================== --- a/src/libgo/configure.ac +++ b/src/libgo/configure.ac -@@ -348,10 +348,10 @@ +@@ -348,10 +348,10 @@ dnl possible for the linker to support t dnl others. AC_CACHE_CHECK([whether linker supports split stack], [libgo_cv_c_linker_supports_split_stack], @@ -93,7 +93,7 @@ Index: b/src/gcc/config.in =================================================================== --- a/src/gcc/config.in +++ b/src/gcc/config.in -@@ -1133,6 +1133,12 @@ +@@ -1139,6 +1139,12 @@ #endif @@ -110,7 +110,7 @@ Index: b/src/gcc/configure.ac =================================================================== --- a/src/gcc/configure.ac +++ b/src/gcc/configure.ac -@@ -2059,6 +2059,12 @@ +@@ -2064,6 +2064,12 @@ if test x$gcc_cv_ld != x; then fi AC_MSG_RESULT($ld_is_gold) diff --git a/debian/patches/goarch-aarch64.diff b/debian/patches/goarch-aarch64.diff index e48f62a..ab46374 100644 --- a/debian/patches/goarch-aarch64.diff +++ b/debian/patches/goarch-aarch64.diff @@ -1,8 +1,10 @@ # DP: Introduce the arm64 goarch. +Index: b/src/gcc/testsuite/go.test/go-test.exp +=================================================================== --- a/src/gcc/testsuite/go.test/go-test.exp +++ b/src/gcc/testsuite/go.test/go-test.exp -@@ -172,6 +172,9 @@ +@@ -172,6 +172,9 @@ proc go-set-goarch { } { global target_triplet switch -glob $target_triplet { @@ -12,9 +14,11 @@ "alpha*-*-*" { set goarch "alpha" } +Index: b/src/libgo/configure.ac +=================================================================== --- a/src/libgo/configure.ac +++ b/src/libgo/configure.ac -@@ -174,6 +174,7 @@ +@@ -171,6 +171,7 @@ dnl N.B. Keep in sync with gcc/testsuite is_386=no is_alpha=no is_arm=no @@ -22,7 +26,7 @@ is_m68k=no mips_abi=unknown is_ppc=no -@@ -187,6 +188,10 @@ +@@ -184,6 +185,10 @@ case ${host} in is_alpha=yes GOARCH=alpha ;; @@ -33,7 +37,7 @@ arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) is_arm=yes GOARCH=arm -@@ -267,6 +272,7 @@ +@@ -264,6 +269,7 @@ esac AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes) AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes) AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes) @@ -41,9 +45,11 @@ AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes) AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown) AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32) +Index: b/src/libgo/go/go/build/build.go +=================================================================== --- a/src/libgo/go/go/build/build.go +++ b/src/libgo/go/go/build/build.go -@@ -1211,6 +1211,8 @@ +@@ -1118,6 +1118,8 @@ func ArchChar(goarch string) (string, er return "6", nil case "arm": return "5", nil @@ -52,9 +58,11 @@ } return "", errors.New("unsupported GOARCH " + goarch) } +Index: b/src/libgo/go/go/build/deps_test.go +=================================================================== --- a/src/libgo/go/go/build/deps_test.go +++ b/src/libgo/go/go/build/deps_test.go -@@ -360,7 +360,7 @@ +@@ -360,7 +360,7 @@ func allowed(pkg string) map[string]bool var bools = []bool{false, true} var geese = []string{"darwin", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"} @@ -63,6 +71,8 @@ type osPkg struct { goos, pkg string +Index: b/src/libgo/go/go/build/syslist.go +=================================================================== --- a/src/libgo/go/go/build/syslist.go +++ b/src/libgo/go/go/build/syslist.go @@ -5,4 +5,4 @@ @@ -71,9 +81,11 @@ const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows solaris " -const goarchList = "386 amd64 arm alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 " +const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 " +Index: b/src/libgo/go/runtime/extern.go +=================================================================== --- a/src/libgo/go/runtime/extern.go +++ b/src/libgo/go/runtime/extern.go -@@ -185,5 +185,5 @@ +@@ -170,5 +170,5 @@ func Version() string { const GOOS string = theGoos // GOARCH is the running program's architecture target: diff --git a/debian/patches/libffi-ro-eh_frame_sect.diff b/debian/patches/libffi-ro-eh_frame_sect.diff index 778a949..556a3b5 100644 --- a/debian/patches/libffi-ro-eh_frame_sect.diff +++ b/debian/patches/libffi-ro-eh_frame_sect.diff @@ -4,7 +4,7 @@ Index: b/src/libffi/configure.ac =================================================================== --- a/src/libffi/configure.ac +++ b/src/libffi/configure.ac -@@ -411,6 +411,8 @@ +@@ -420,6 +420,8 @@ if test "x$GCC" = "xyes"; then libffi_cv_ro_eh_frame=yes fi fi diff --git a/debian/patches/libgo-explicit-reservation.diff b/debian/patches/libgo-explicit-reservation.diff index 0743f69..6fd761d 100644 --- a/debian/patches/libgo-explicit-reservation.diff +++ b/debian/patches/libgo-explicit-reservation.diff @@ -1,5 +1,7 @@ # DP: Fix statically linked gccgo binaries on AArch64. +Index: b/src/libgo/runtime/malloc.goc +=================================================================== --- a/src/libgo/runtime/malloc.goc +++ b/src/libgo/runtime/malloc.goc @@ -339,12 +339,14 @@ runtime_mallocinit(void) @@ -45,7 +47,7 @@ // Initialize the rest of the allocator. runtime_MHeap_Init(runtime_mheap, runtime_SysAlloc); -@@ -462,12 +467,15 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n) +@@ -462,12 +467,15 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr byte *new_end; uintptr needed; @@ -62,7 +64,7 @@ if(p == h->arena_end) h->arena_end = new_end; } -@@ -475,7 +483,7 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr n) +@@ -475,7 +483,7 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr if(n <= (uintptr)(h->arena_end - h->arena_used)) { // Keep taking from our reservation. p = h->arena_used; @@ -71,6 +73,8 @@ h->arena_used += n; runtime_MHeap_MapBits(h); if(raceenabled) +Index: b/src/libgo/runtime/malloc.h +=================================================================== --- a/src/libgo/runtime/malloc.h +++ b/src/libgo/runtime/malloc.h @@ -177,8 +177,8 @@ struct MLink @@ -92,6 +96,8 @@ }; extern MHeap *runtime_mheap; +Index: b/src/libgo/runtime/mem.c +=================================================================== --- a/src/libgo/runtime/mem.c +++ b/src/libgo/runtime/mem.c @@ -110,7 +110,7 @@ runtime_SysFree(void *v, uintptr n) @@ -130,9 +136,11 @@ p = mmap_fixed(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, fd, 0); if(p == MAP_FAILED && errno == ENOMEM) runtime_throw("runtime: out of memory"); +Index: b/src/libgo/runtime/mgc0.c +=================================================================== --- a/src/libgo/runtime/mgc0.c +++ b/src/libgo/runtime/mgc0.c -@@ -2483,6 +2483,6 @@ runtime_MHeap_MapBits(MHeap *h) +@@ -2479,6 +2479,6 @@ runtime_MHeap_MapBits(MHeap *h) page_size = getpagesize(); n = (n+page_size-1) & ~(page_size-1); diff --git a/debian/patches/libitm-aarch64.diff b/debian/patches/libitm-aarch64.diff new file mode 100644 index 0000000..faf93cd --- /dev/null +++ b/debian/patches/libitm-aarch64.diff @@ -0,0 +1,155 @@ +# DP: Build libitm on AArch64, patch taken from the trunk. +--- /dev/null ++++ b/src/libitm/config/aarch64/sjlj.S +@@ -0,0 +1,93 @@ ++/* Copyright (C) 2014 Free Software Foundation, Inc. ++ Contributed by Richard Henderson <rth@redhat.com>. ++ ++ This file is part of the GNU Transactional Memory Library (libitm). ++ ++ Libitm is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ Libitm is distributed in the hope that it will be useful, but WITHOUT ANY ++ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ++ FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++#include "asmcfi.h" ++ ++ .text ++ .align 2 ++ .global _ITM_beginTransaction ++ .type _ITM_beginTransaction, %function ++ ++_ITM_beginTransaction: ++ cfi_startproc ++ mov x1, sp ++ stp x29, x30, [sp, -11*16]! ++ cfi_adjust_cfa_offset(11*16) ++ cfi_rel_offset(x29, 0) ++ cfi_rel_offset(x30, 8) ++ mov x29, sp ++ stp x19, x20, [sp, 1*16] ++ stp x21, x22, [sp, 2*16] ++ stp x23, x24, [sp, 3*16] ++ stp x25, x26, [sp, 4*16] ++ stp x27, x28, [sp, 5*16] ++ stp d8, d9, [sp, 6*16] ++ stp d10, d11, [sp, 7*16] ++ stp d12, d13, [sp, 8*16] ++ stp d14, d15, [sp, 9*16] ++ str x1, [sp, 10*16] ++ ++ /* Invoke GTM_begin_transaction with the struct we just built. */ ++ mov x1, sp ++ bl GTM_begin_transaction ++ ++ /* Return; we don't need to restore any of the call-saved regs. */ ++ ldp x29, x30, [sp] ++ add sp, sp, #11*16 ++ cfi_adjust_cfa_offset(-11*16) ++ cfi_restore(x29) ++ cfi_restore(x30) ++ ret ++ cfi_endproc ++ .size _ITM_beginTransaction, . - _ITM_beginTransaction ++ ++ .align 2 ++ .global GTM_longjmp ++ .hidden GTM_longjmp ++ .type GTM_longjmp, %function ++ ++GTM_longjmp: ++ /* The first parameter becomes the return value (x0). ++ The third parameter is ignored for now. */ ++ cfi_startproc ++ ldp x19, x20, [x1, 1*16] ++ ldp x21, x22, [x1, 2*16] ++ ldp x23, x24, [x1, 3*16] ++ ldp x25, x26, [x1, 4*16] ++ ldp x27, x28, [x1, 5*16] ++ ldp d8, d9, [x1, 6*16] ++ ldp d10, d11, [x1, 7*16] ++ ldp d12, d13, [x1, 8*16] ++ ldp d14, d15, [x1, 9*16] ++ ldr x3, [x1, 10*16] ++ ldp x29, x30, [x1] ++ cfi_def_cfa(x1, 0) ++ mov sp, x3 ++ br x30 ++ cfi_endproc ++ .size GTM_longjmp, . - GTM_longjmp ++ ++#ifdef __linux__ ++.section .note.GNU-stack, "", %progbits ++#endif +--- /dev/null ++++ b/src/libitm/config/aarch64/target.h +@@ -0,0 +1,45 @@ ++/* Copyright (C) 2014 Free Software Foundation, Inc. ++ Contributed by Richard Henderson <rth@redhat.com>. ++ ++ This file is part of the GNU Transactional Memory Library (libitm). ++ ++ Libitm is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ Libitm is distributed in the hope that it will be useful, but WITHOUT ANY ++ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ++ FOR A PARTICULAR PURPOSE. See the GNU General Public License for ++ more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++namespace GTM HIDDEN { ++ ++typedef struct gtm_jmpbuf ++{ ++ unsigned long long fp; /* x29 */ ++ unsigned long long pc; /* x30 */ ++ unsigned long long gr[10]; /* x19-x28 */ ++ unsigned long long vr[8]; /* d8-d15 */ ++ void *cfa; ++} gtm_jmpbuf; ++ ++/* ??? The size of one line in hardware caches (in bytes). */ ++#define HW_CACHELINE_SIZE 128 ++ ++static inline void ++cpu_relax (void) ++{ ++ __asm volatile ("" : : : "memory"); ++} ++ ++} // namespace GTM +--- a/src/libitm/configure.tgt ++++ b/src/libitm/configure.tgt +@@ -46,6 +46,7 @@ fi + # Map the target cpu to an ARCH sub-directory. At the same time, + # work out any special compilation flags as necessary. + case "${target_cpu}" in ++ aarch64*) ARCH=aarch64 ;; + alpha*) ARCH=alpha ;; + rs6000 | powerpc*) + XCFLAGS="${XCFLAGS} -mhtm" diff --git a/debian/patches/libstdc++-arm-wno-abi.diff b/debian/patches/libstdc++-arm-wno-abi.diff deleted file mode 100644 index c46c900..0000000 --- a/debian/patches/libstdc++-arm-wno-abi.diff +++ /dev/null @@ -1,18 +0,0 @@ -# DP: Temporary work around: -# DP: On arm-linux-gnueabi run the libstdc++v3 testsuite with -Wno-abi - -Index: b/src/libstdc++-v3/testsuite/lib/libstdc++.exp -=================================================================== ---- a/src/libstdc++-v3/testsuite/lib/libstdc++.exp -+++ b/src/libstdc++-v3/testsuite/lib/libstdc++.exp -@@ -288,6 +288,10 @@ - } - append cxxflags " " - append cxxflags [getenv CXXFLAGS] -+ # ARM C++ emits an ABI warning for varargs. -+ if [istarget "arm*"] { -+ append cxxflags " -Wno-abi" -+ } - v3track cxxflags 2 - - # Always use MO files built by this test harness. diff --git a/debian/patches/libstdc++-python3.diff b/debian/patches/libstdc++-python3.diff index 38ffb7d..40ba67d 100644 --- a/debian/patches/libstdc++-python3.diff +++ b/debian/patches/libstdc++-python3.diff @@ -1,8 +1,10 @@ # DP: Make the libstdc++-v3 pretty printer compatible with Python3. +Index: b/src/libstdc++-v3/python/libstdcxx/v6/printers.py +=================================================================== --- a/src/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/src/libstdc++-v3/python/libstdcxx/v6/printers.py -@@ -51,7 +51,7 @@ +@@ -51,7 +51,7 @@ def find_type(orig, name): # anything fancier here. field = typ.fields()[0] if not field.is_base_class: @@ -11,7 +13,7 @@ typ = field.type class SharedPointerPrinter: -@@ -97,7 +97,7 @@ +@@ -97,7 +97,7 @@ class StdListPrinter: def __iter__(self): return self @@ -20,7 +22,7 @@ if self.base == self.head: raise StopIteration elt = self.base.cast(self.nodetype).dereference() -@@ -144,7 +144,7 @@ +@@ -144,7 +144,7 @@ class StdSlistPrinter: def __iter__(self): return self @@ -29,7 +31,7 @@ if self.base == 0: raise StopIteration elt = self.base.cast(self.nodetype).dereference() -@@ -198,7 +198,7 @@ +@@ -198,7 +198,7 @@ class StdVectorPrinter: def __iter__(self): return self @@ -38,7 +40,7 @@ count = self.count self.count = self.count + 1 if self.bitvec: -@@ -276,20 +276,20 @@ +@@ -276,20 +276,20 @@ class StdTuplePrinter: # Set the actual head to the first pair. self.head = self.head.cast (nodes[0].type) elif len (nodes) != 0: @@ -62,7 +64,7 @@ # - Left node is the next recursion parent. # - Right node is the actual class contained in the tuple. -@@ -353,7 +353,7 @@ +@@ -353,7 +353,7 @@ class RbtreeIterator: def __len__(self): return int (self.size) @@ -71,7 +73,7 @@ if self.count == self.size: raise StopIteration result = self.node -@@ -414,9 +414,9 @@ +@@ -414,9 +414,9 @@ class StdMapPrinter: def __iter__(self): return self @@ -83,7 +85,7 @@ n = n.cast(self.type).dereference()['_M_value_field'] self.pair = n item = n['first'] -@@ -456,8 +456,8 @@ +@@ -456,8 +456,8 @@ class StdSetPrinter: def __iter__(self): return self @@ -94,7 +96,7 @@ item = item.cast(self.type).dereference()['_M_value_field'] # FIXME: this is weird ... what to do? # Maybe a 'set' display hint? -@@ -534,7 +534,7 @@ +@@ -534,7 +534,7 @@ class StdDequePrinter: def __iter__(self): return self @@ -103,7 +105,7 @@ if self.p == self.last: raise StopIteration -@@ -572,7 +572,7 @@ +@@ -572,7 +572,7 @@ class StdDequePrinter: size = self.buffer_size * delta_n + delta_s + delta_e @@ -112,7 +114,7 @@ def children(self): start = self.val['_M_impl']['_M_start'] -@@ -627,7 +627,7 @@ +@@ -627,7 +627,7 @@ class Tr1HashtableIterator: def __iter__ (self): return self @@ -121,33 +123,33 @@ if self.node == 0: raise StopIteration node = self.node.cast(self.node_type) -@@ -655,8 +655,8 @@ +@@ -655,8 +655,8 @@ class Tr1UnorderedSetPrinter: return '[%d]' % i def children (self): - counter = itertools.imap (self.format_count, itertools.count()) - return itertools.izip (counter, Tr1HashtableIterator (self.hashtable())) -+ counter = map (self.format_count, itertools.count()) -+ return zip (counter, Tr1HashtableIterator (self.hashtable())) ++ counter = list(map (self.format_count, itertools.count())) ++ return list(zip (counter, Tr1HashtableIterator (self.hashtable()))) class Tr1UnorderedMapPrinter: "Print a tr1::unordered_map" -@@ -688,11 +688,11 @@ +@@ -688,11 +688,11 @@ class Tr1UnorderedMapPrinter: return '[%d]' % i def children (self): - counter = itertools.imap (self.format_count, itertools.count()) -+ counter = map (self.format_count, itertools.count()) ++ counter = list(map (self.format_count, itertools.count())) # Map over the hash table and flatten the result. - data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable()))) -+ data = self.flatten (map (self.format_one, Tr1HashtableIterator (self.hashtable()))) ++ data = self.flatten (list(map (self.format_one, Tr1HashtableIterator (self.hashtable())))) # Zip the two iterators together. - return itertools.izip (counter, data) -+ return zip (counter, data) ++ return list(zip (counter, data)) def display_hint (self): return 'map' -@@ -709,7 +709,7 @@ +@@ -709,7 +709,7 @@ class StdForwardListPrinter: def __iter__(self): return self @@ -156,7 +158,7 @@ if self.base == 0: raise StopIteration elt = self.base.cast(self.nodetype).dereference() -@@ -764,7 +764,7 @@ +@@ -764,7 +764,7 @@ class Printer(object): # A small sanity check. # FIXME if not self.compiled_rx.match(name + '<>'): diff --git a/debian/patches/mips-fix-loongson2f-nop.diff b/debian/patches/mips-fix-loongson2f-nop.diff index 047e617..953c02e 100644 --- a/debian/patches/mips-fix-loongson2f-nop.diff +++ b/debian/patches/mips-fix-loongson2f-nop.diff @@ -5,7 +5,7 @@ Index: b/src/gcc/config/mips/mips.h =================================================================== --- a/src/gcc/config/mips/mips.h +++ b/src/gcc/config/mips/mips.h -@@ -1188,6 +1188,7 @@ +@@ -1193,6 +1193,7 @@ struct mips_cpu_info { %{mshared} %{mno-shared} \ %{msym32} %{mno-sym32} \ %{mtune=*} \ diff --git a/debian/patches/note-gnu-stack.diff b/debian/patches/note-gnu-stack.diff index 50a8b2c..e2f5ba9 100644 --- a/debian/patches/note-gnu-stack.diff +++ b/debian/patches/note-gnu-stack.diff @@ -61,6 +61,8 @@ libffi/ libgcc/config/ia64/lib1funcs.S | 4 ++++ 9 files changed, 39 insertions(+), 13 deletions(-) +Index: b/src/boehm-gc/ia64_save_regs_in_stack.s +=================================================================== --- a/src/boehm-gc/ia64_save_regs_in_stack.s +++ /dev/null @@ -1,12 +0,0 @@ @@ -76,6 +78,8 @@ libffi/ - br.ret.sptk.few rp - .endp GC_save_regs_in_stack - +Index: b/src/boehm-gc/ia64_save_regs_in_stack.S +=================================================================== --- /dev/null +++ b/src/boehm-gc/ia64_save_regs_in_stack.S @@ -0,0 +1,15 @@ @@ -94,9 +98,11 @@ libffi/ +#ifdef __linux__ + .section .note.GNU-stack,"",@progbits +#endif +Index: b/src/libgcc/config/ia64/crtbegin.S +=================================================================== --- a/src/libgcc/config/ia64/crtbegin.S +++ b/src/libgcc/config/ia64/crtbegin.S -@@ -252,3 +252,7 @@ +@@ -252,3 +252,7 @@ __do_jv_register_classes: .weak __cxa_finalize #endif .weak _Jv_RegisterClasses @@ -104,9 +110,11 @@ libffi/ +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif +Index: b/src/libgcc/config/ia64/crtend.S +=================================================================== --- a/src/libgcc/config/ia64/crtend.S +++ b/src/libgcc/config/ia64/crtend.S -@@ -119,3 +119,7 @@ +@@ -119,3 +119,7 @@ __do_global_ctors_aux: br.ret.sptk.many rp .endp __do_global_ctors_aux @@ -114,9 +122,11 @@ libffi/ +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif +Index: b/src/libgcc/config/ia64/crti.S +=================================================================== --- a/src/libgcc/config/ia64/crti.S +++ b/src/libgcc/config/ia64/crti.S -@@ -51,3 +51,7 @@ +@@ -51,3 +51,7 @@ _fini: .body # end of crti.S @@ -124,6 +134,8 @@ libffi/ +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif +Index: b/src/libgcc/config/ia64/crtn.S +=================================================================== --- a/src/libgcc/config/ia64/crtn.S +++ b/src/libgcc/config/ia64/crtn.S @@ -41,3 +41,7 @@ @@ -134,9 +146,11 @@ libffi/ +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif +Index: b/src/libgcc/config/ia64/lib1funcs.S +=================================================================== --- a/src/libgcc/config/ia64/lib1funcs.S +++ b/src/libgcc/config/ia64/lib1funcs.S -@@ -793,3 +793,7 @@ +@@ -793,3 +793,7 @@ __floattitf: .endp __floattitf #endif #endif @@ -144,21 +158,24 @@ libffi/ +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif +Index: b/src/gcc/config/ia64/linux.h +=================================================================== --- a/src/gcc/config/ia64/linux.h +++ b/src/gcc/config/ia64/linux.h -@@ -85,6 +85,9 @@ - +@@ -86,5 +86,8 @@ do { \ #undef TARGET_INIT_LIBFUNCS #define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs -+ + +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack - ++ /* Define this to be nonzero if static stack checking is supported. */ #define STACK_CHECK_STATIC_BUILTIN 1 +Index: b/src/gcc/config/rs6000/ppc-asm.h +=================================================================== --- a/src/gcc/config/rs6000/ppc-asm.h +++ b/src/gcc/config/rs6000/ppc-asm.h -@@ -352,7 +352,7 @@ +@@ -375,7 +375,7 @@ GLUE(.L,name): \ #endif #endif diff --git a/debian/patches/pr57653.diff b/debian/patches/pr57653.diff new file mode 100644 index 0000000..0d368f4 --- /dev/null +++ b/debian/patches/pr57653.diff @@ -0,0 +1,17 @@ +# DP: Proposed patch for PR c/57653. + +Index: b/src/gcc/c-family/c-opts.c +=================================================================== +--- a/src/gcc/c-family/c-opts.c ++++ b/src/gcc/c-family/c-opts.c +@@ -1347,6 +1347,10 @@ + static void + push_command_line_include (void) + { ++ // This can happen if disabled by -imacros for example. ++ if (include_cursor > deferred_count) ++ return; ++ + if (!done_preinclude) + { + done_preinclude = true; diff --git a/debian/patches/pr58595.diff b/debian/patches/pr58595.diff deleted file mode 100644 index fd9c7c1..0000000 --- a/debian/patches/pr58595.diff +++ /dev/null @@ -1,131 +0,0 @@ -# DP: Fix PR target/58595, ARM TLS handling - -2014-03-05 Jakub Jelinek <jakub@redhat.com> - Meador Inge <meadori@codesourcery.com> - - PR target/58595 - * config/arm/arm.c (arm_tls_symbol_p): Remove. - (arm_legitimize_address): Call legitimize_tls_address for any - arm_tls_referenced_p expression, handle constant addend. Call it - before testing for !TARGET_ARM. - (thumb_legitimize_address): Don't handle arm_tls_symbol_p here. - - * gcc.dg/tls/pr58595.c: New test. - ---- a/src/gcc/config/arm/arm.c -+++ b/src/gcc/config/arm/arm.c -@@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tr - static void arm_option_override (void); - static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode); - static bool arm_cannot_copy_insn_p (rtx); --static bool arm_tls_symbol_p (rtx x); - static int arm_issue_rate (void); - static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; - static bool arm_output_addr_const_extra (FILE *, rtx); -@@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg) - rtx - arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) - { -+ if (arm_tls_referenced_p (x)) -+ { -+ rtx addend = NULL; -+ -+ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS) -+ { -+ addend = XEXP (XEXP (x, 0), 1); -+ x = XEXP (XEXP (x, 0), 0); -+ } -+ -+ if (GET_CODE (x) != SYMBOL_REF) -+ return x; -+ -+ gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0); -+ -+ x = legitimize_tls_address (x, NULL_RTX); -+ -+ if (addend) -+ { -+ x = gen_rtx_PLUS (SImode, x, addend); -+ orig_x = x; -+ } -+ else -+ return x; -+ } -+ - if (!TARGET_ARM) - { - /* TODO: legitimize_address for Thumb2. */ -@@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_ - return thumb_legitimize_address (x, orig_x, mode); - } - -- if (arm_tls_symbol_p (x)) -- return legitimize_tls_address (x, NULL_RTX); -- - if (GET_CODE (x) == PLUS) - { - rtx xop0 = XEXP (x, 0); -@@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_ - rtx - thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) - { -- if (arm_tls_symbol_p (x)) -- return legitimize_tls_address (x, NULL_RTX); -- - if (GET_CODE (x) == PLUS - && CONST_INT_P (XEXP (x, 1)) - && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode) -@@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_ - - /* Test for various thread-local symbols. */ - --/* Return TRUE if X is a thread-local symbol. */ -- --static bool --arm_tls_symbol_p (rtx x) --{ -- if (! TARGET_HAVE_TLS) -- return false; -- -- if (GET_CODE (x) != SYMBOL_REF) -- return false; -- -- return SYMBOL_REF_TLS_MODEL (x) != 0; --} -- - /* Helper for arm_tls_referenced_p. */ - - static int ---- a/src/gcc/testsuite/gcc.dg/tls/pr58595.c -+++ b/src/gcc/testsuite/gcc.dg/tls/pr58595.c -@@ -0,0 +1,28 @@ -+/* PR target/58595 */ -+/* { dg-do run } */ -+/* { dg-options "-O2" } */ -+/* { dg-additional-options "-fpic" { target fpic } } */ -+/* { dg-require-effective-target tls } */ -+/* { dg-require-effective-target sync_int_long } */ -+ -+struct S { unsigned long a, b; }; -+__thread struct S s; -+void bar (unsigned long *); -+ -+__attribute__((noinline)) void -+foo (void) -+{ -+ int i; -+ for (i = 0; i < 10; i++) -+ __sync_fetch_and_add (&s.b, 1L); -+} -+ -+int -+main () -+{ -+ s.b = 12; -+ foo (); -+ if (s.b != 22) -+ __builtin_abort (); -+ return 0; -+} - - Jakub diff --git a/debian/patches/pr60609.diff b/debian/patches/pr60609.diff deleted file mode 100644 index a0b204b..0000000 --- a/debian/patches/pr60609.diff +++ /dev/null @@ -1,289 +0,0 @@ -# DP: Fix PR target/60609, proposed patch - -2014-04-02 Charles Baylis <charles.baylis@linaro.org> - - PR target/60609 - * config/arm/arm.h (ASM_OUTPUT_CASE_END) Remove. - (LABEL_ALIGN_AFTER_BARRIER) Align barriers which occur after - ADDR_DIFF_VEC. - -2014-04-02 Charles Baylis <charles.baylis@linaro.org> - - PR target/60609 - * g++.dg/torture/pr60609.C: New test. - ---- a/src/gcc/config/arm/arm.h -+++ b/src/gcc/config/arm/arm.h -@@ -2194,14 +2194,9 @@ extern int making_const_table; - #undef ASM_OUTPUT_BEFORE_CASE_LABEL - #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) /* Empty. */ - --/* Make sure subsequent insns are aligned after a TBB. */ --#define ASM_OUTPUT_CASE_END(FILE, NUM, JUMPTABLE) \ -- do \ -- { \ -- if (GET_MODE (PATTERN (JUMPTABLE)) == QImode) \ -- ASM_OUTPUT_ALIGN (FILE, 1); \ -- } \ -- while (0) -+#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \ -+ (GET_CODE (PATTERN (prev_active_insn (LABEL))) == ADDR_DIFF_VEC \ -+ ? 1 : 0) - - #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ - do \ ---- /dev/null -+++ b/src/gcc/testsuite/g++.dg/torture/pr60609.C -@@ -0,0 +1,252 @@ -+/* { dg-do assemble } */ -+ -+class exception -+{ -+}; -+class bad_alloc:exception -+{ -+}; -+class logic_error:exception -+{ -+}; -+class domain_error:logic_error -+{ -+}; -+class invalid_argument:logic_error -+{ -+}; -+class length_error:logic_error -+{ -+}; -+class overflow_error:exception -+{ -+}; -+typedef int mpz_t[]; -+template < class > class __gmp_expr; -+template <> class __gmp_expr < mpz_t > -+{ -+ ~__gmp_expr (); -+}; -+ -+class PIP_Solution_Node; -+class internal_exception -+{ -+ ~internal_exception (); -+}; -+class not_an_integer:internal_exception -+{ -+}; -+class not_a_variable:internal_exception -+{ -+}; -+class not_an_optimization_mode:internal_exception -+{ -+}; -+class not_a_bounded_integer_type_width:internal_exception -+{ -+}; -+class not_a_bounded_integer_type_representation:internal_exception -+{ -+}; -+class not_a_bounded_integer_type_overflow:internal_exception -+{ -+}; -+class not_a_complexity_class:internal_exception -+{ -+}; -+class not_a_control_parameter_name:internal_exception -+{ -+}; -+class not_a_control_parameter_value:internal_exception -+{ -+}; -+class not_a_pip_problem_control_parameter_name:internal_exception -+{ -+}; -+class not_a_pip_problem_control_parameter_value:internal_exception -+{ -+}; -+class not_a_relation:internal_exception -+{ -+}; -+class ppl_handle_mismatch:internal_exception -+{ -+}; -+class timeout_exception -+{ -+ ~timeout_exception (); -+}; -+class deterministic_timeout_exception:timeout_exception -+{ -+}; -+void __assert_fail (const char *, const char *, int, int *) -+__attribute__ ((__noreturn__)); -+void PL_get_pointer (void *); -+int Prolog_is_address (); -+inline int -+Prolog_get_address (void **p1) -+{ -+ Prolog_is_address ()? static_cast < -+ void >(0) : __assert_fail ("Prolog_is_address", "./swi_cfli.hh", 0, 0); -+ PL_get_pointer (p1); -+ return 0; -+} -+ -+class non_linear:internal_exception -+{ -+}; -+class not_unsigned_integer:internal_exception -+{ -+}; -+class not_universe_or_empty:internal_exception -+{ -+}; -+class not_a_nil_terminated_list:internal_exception -+{ -+}; -+class PPL_integer_out_of_range -+{ -+ __gmp_expr < mpz_t > n; -+}; -+void handle_exception (); -+template < typename T > T * term_to_handle (int, const char *) -+{ -+ if (Prolog_is_address ()) -+ { -+ void *p; -+ Prolog_get_address (&p); -+ return static_cast < T * >(0); -+ } -+ throw; -+} -+ -+void -+ppl_new_MIP_Problem_from_MIP_Problem () -+try -+{ -+ term_to_handle < int >(0, "ppl_new_MIP_Problem_from_MIP_Problem/2"); -+} -+ -+catch (exception &) -+{ -+} -+ -+int -+ppl_PIP_Tree_Node_parametric_values () -+{ -+ try -+ { -+ PIP_Solution_Node *a = term_to_handle < PIP_Solution_Node > (0, 0); -+ (void)a; -+ return 1; -+ } -+ catch (internal_exception &) -+ { -+ } -+ catch (not_unsigned_integer &) -+ { -+ handle_exception (); -+ } -+ catch (non_linear &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_variable &) -+ { -+ handle_exception (); -+ } -+ catch (not_an_integer &) -+ { -+ handle_exception (); -+ } -+ catch (ppl_handle_mismatch &) -+ { -+ handle_exception (); -+ } -+ catch (not_an_optimization_mode &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_complexity_class &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_bounded_integer_type_width &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_bounded_integer_type_representation &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_bounded_integer_type_overflow &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_control_parameter_name &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_control_parameter_value &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_pip_problem_control_parameter_name &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_pip_problem_control_parameter_value &) -+ { -+ handle_exception (); -+ } -+ catch (not_universe_or_empty &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_relation &) -+ { -+ handle_exception (); -+ } -+ catch (not_a_nil_terminated_list &) -+ { -+ handle_exception (); -+ } -+ catch (PPL_integer_out_of_range &) -+ { -+ handle_exception (); -+ } -+ catch (int &) -+ { -+ } catch (timeout_exception &) -+ { -+ handle_exception (); -+ } catch (deterministic_timeout_exception &) -+ { -+ handle_exception (); -+ } catch (overflow_error &) -+ { -+ handle_exception (); -+ } catch (domain_error &) -+ { -+ handle_exception (); -+ } catch (length_error &) -+ { -+ handle_exception (); -+ } catch (invalid_argument &) -+ { -+ handle_exception (); -+ } catch (logic_error &) -+ { -+ handle_exception (); -+ } catch (bad_alloc &) -+ { -+ handle_exception (); -+ } catch (exception &) -+ { -+ handle_exception (); -+ } catch ( ...) -+ { -+ handle_exception (); -+ } -+ return 0; -+} diff --git a/debian/patches/pr61046.diff b/debian/patches/pr61046.diff new file mode 100644 index 0000000..f303f43 --- /dev/null +++ b/debian/patches/pr61046.diff @@ -0,0 +1,50 @@ +# DP: Fix PR c++/61046, taken from the trunk. + +gcc/cp/ + +2014-06-02 Jason Merrill <jason@redhat.com> + + PR c++/61046 + * decl.c (reshape_init_class): Handle un-folded + constant-expressions. + +--- a/src/gcc/testsuite/g++.dg/ext/desig7.C ++++ a/src/gcc/testsuite/g++.dg/ext/desig7.C +@@ -0,0 +1,8 @@ ++// PR c++/61046 ++ ++struct A ++{ ++ int ary[4]; ++}; ++const int i = 0; ++A bar = { [i] = 0 }; // { dg-error "designated" } +--- a/src/gcc/cp/decl.c ++++ a/src/gcc/cp/decl.c +@@ -5294,7 +5294,12 @@ + if (d->cur->index == error_mark_node) + return error_mark_node; + +- if (TREE_CODE (d->cur->index) == INTEGER_CST) ++ if (TREE_CODE (d->cur->index) == FIELD_DECL) ++ /* We already reshaped this. */ ++ gcc_assert (d->cur->index == field); ++ else if (TREE_CODE (d->cur->index) == IDENTIFIER_NODE) ++ field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); ++ else + { + if (complain & tf_error) + error ("%<[%E] =%> used in a GNU-style designated initializer" +@@ -5302,12 +5307,6 @@ + return error_mark_node; + } + +- if (TREE_CODE (d->cur->index) == FIELD_DECL) +- /* We already reshaped this. */ +- gcc_assert (d->cur->index == field); +- else +- field = lookup_field_1 (type, d->cur->index, /*want_type=*/false); +- + if (!field || TREE_CODE (field) != FIELD_DECL) + { + if (complain & tf_error) diff --git a/debian/patches/pr61106.diff b/debian/patches/pr61106.diff new file mode 100644 index 0000000..fd5dc57 --- /dev/null +++ b/debian/patches/pr61106.diff @@ -0,0 +1,24 @@ +# DP: Proposed patch for PR driver/61106 + +--- a/src/gcc/optc-gen.awk ++++ b/src/gcc/optc-gen.awk +@@ -404,15 +404,17 @@ for (i = 0; i < n_enabledby; i++) { + for (j = 1; j < n_enables; j++) { + opt_var_name = var_name(flags[opt_numbers[thisenable[j]]]); + if (opt_var_name != "") { + condition = "!opts_set->x_" opt_var_name + if (thisenableif[j] != "") { +- condition = condition " && (" thisenableif[j] ")" ++ value = "(" thisenableif[j] ")" ++ } else { ++ value = "value" + } + print " if (" condition ")" + print " handle_generated_option (opts, opts_set," +- print " " opt_enum(thisenable[j]) ", NULL, value," ++ print " " opt_enum(thisenable[j]) ", NULL, " value "," + print " lang_mask, kind, loc, handlers, dc);" + } else { + print "#error " thisenable[j] " does not have a Var() flag" + } + } diff --git a/debian/patches/pr61126.diff b/debian/patches/pr61126.diff new file mode 100644 index 0000000..c3f6688 --- /dev/null +++ b/debian/patches/pr61126.diff @@ -0,0 +1,53 @@ +# DP: Proposed patch for PR driver/61126. + +Index: b/src/gcc/fortran/lang.opt +=================================================================== +--- a/src/gcc/fortran/lang.opt ++++ b/src/gcc/fortran/lang.opt +@@ -293,6 +293,10 @@ + Fortran Warning + Warn about unused dummy arguments. + ++Wunused-parameter ++LangEnabledBy(Fortran,Wextra) ++; Documented in common.opt ++ + cpp + Fortran Negative(nocpp) + Enable preprocessing +Index: b/src/gcc/fortran/options.c +=================================================================== +--- a/src/gcc/fortran/options.c ++++ b/src/gcc/fortran/options.c +@@ -658,12 +658,7 @@ + break; + + case OPT_Wextra: +- handle_generated_option (&global_options, &global_options_set, +- OPT_Wunused_parameter, NULL, value, +- gfc_option_lang_mask (), kind, loc, +- handlers, global_dc); + set_Wextra (value); +- + break; + + case OPT_Wfunction_elimination: +Index: b/src/gcc/opts-global.c +=================================================================== +--- a/src/gcc/opts-global.c ++++ b/src/gcc/opts-global.c +@@ -301,10 +301,10 @@ + handlers->unknown_option_callback = unknown_option_callback; + handlers->wrong_lang_callback = complain_wrong_lang; + handlers->num_handlers = 3; +- handlers->handlers[0].handler = lang_handle_option; +- handlers->handlers[0].mask = initial_lang_mask; +- handlers->handlers[1].handler = common_handle_option; +- handlers->handlers[1].mask = CL_COMMON; ++ handlers->handlers[0].handler = common_handle_option; ++ handlers->handlers[0].mask = CL_COMMON; ++ handlers->handlers[1].handler = lang_handle_option; ++ handlers->handlers[1].mask = initial_lang_mask; + handlers->handlers[2].handler = target_handle_option; + handlers->handlers[2].mask = CL_TARGET; + } diff --git a/debian/patches/pr61208-linaro.diff b/debian/patches/pr61208-linaro.diff new file mode 100644 index 0000000..fd47ae9 --- /dev/null +++ b/debian/patches/pr61208-linaro.diff @@ -0,0 +1,30 @@ +# DP: Fix PR target/61208 (ARM) for the Linaro branch, taken from the trunk. + +Index: b/src/gcc/config/arm/arm.md +=================================================================== +--- a/src/gcc/config/arm/arm.md ++++ b/src/gcc/config/arm/arm.md +@@ -8480,8 +8480,8 @@ + + (define_insn_and_split "*arm_cmpdi_unsigned" + [(set (reg:CC_CZ CC_REGNUM) +- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r") +- (match_operand:DI 1 "arm_di_operand" "Py,r,rDi")))] ++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r,r") ++ (match_operand:DI 1 "arm_di_operand" "Py,r,Di,rDi")))] + + "TARGET_32BIT" + "#" ; "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1" +@@ -8501,9 +8501,9 @@ + operands[1] = gen_lowpart (SImode, operands[1]); + } + [(set_attr "conds" "set") +- (set_attr "enabled_for_depr_it" "yes,yes,no") +- (set_attr "arch" "t2,t2,*") +- (set_attr "length" "6,6,8")] ++ (set_attr "enabled_for_depr_it" "yes,yes,no,*") ++ (set_attr "arch" "t2,t2,t2,a") ++ (set_attr "length" "6,6,10,8") + ) + + (define_insn "*arm_cmpdi_zero" diff --git a/debian/patches/pr61208-revert.diff b/debian/patches/pr61208-revert.diff new file mode 100644 index 0000000..dc4d1da --- /dev/null +++ b/debian/patches/pr61208-revert.diff @@ -0,0 +1,21 @@ +# DP: Revert the 4.8 version of the PR target/61208 (ARM) fix. + +--- a/src/gcc/config/arm/arm.md ++++ b/src/gcc/config/arm/arm.md +@@ -7630,13 +7630,12 @@ + + (define_insn "*arm_cmpdi_unsigned" + [(set (reg:CC_CZ CC_REGNUM) +- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r,r") +- (match_operand:DI 1 "arm_di_operand" "rDi,rDi")))] ++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r") ++ (match_operand:DI 1 "arm_di_operand" "rDi")))] + "TARGET_32BIT" + "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1" + [(set_attr "conds" "set") +- (set_attr "arch" "a,t2") +- (set_attr "length" "8,10")] ++ (set_attr "length" "8")] + ) + + (define_insn "*arm_cmpdi_zero" diff --git a/debian/patches/pr61336.diff b/debian/patches/pr61336.diff new file mode 100644 index 0000000..7e3e7ad --- /dev/null +++ b/debian/patches/pr61336.diff @@ -0,0 +1,40 @@ +# DP: Fix PR target/61336, taken from the trunk. + +2014-06-02 Richard Henderson <rth@redhat.com> + + PR target/61336 + * config/alpha/alpha.c (print_operand_address): Allow symbolic + addresses inside asms. Use output_operand_lossage instead of + gcc_unreachable. + +--- a/src/gcc/config/alpha/alpha.c ++++ b/src/gcc/config/alpha/alpha.c +@@ -5450,12 +5450,13 @@ + offset = INTVAL (addr); + break; + +-#if TARGET_ABI_OPEN_VMS + case SYMBOL_REF: ++ gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands); + fprintf (file, "%s", XSTR (addr, 0)); + return; + + case CONST: ++ gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands); + gcc_assert (GET_CODE (XEXP (addr, 0)) == PLUS + && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF); + fprintf (file, "%s+" HOST_WIDE_INT_PRINT_DEC, +@@ -5462,10 +5463,10 @@ + XSTR (XEXP (XEXP (addr, 0), 0), 0), + INTVAL (XEXP (XEXP (addr, 0), 1))); + return; +- +-#endif ++ + default: +- gcc_unreachable (); ++ output_operand_lossage ("invalid operand address"); ++ return; + } + + fprintf (file, HOST_WIDE_INT_PRINT_DEC "($%d)", offset, basereg); diff --git a/debian/patches/sparc-force-cpu.diff b/debian/patches/sparc-force-cpu.diff index 5ac08ea..2deb9a4 100644 --- a/debian/patches/sparc-force-cpu.diff +++ b/debian/patches/sparc-force-cpu.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/config.gcc =================================================================== --- a/src/gcc/config.gcc +++ b/src/gcc/config.gcc -@@ -3816,6 +3816,13 @@ +@@ -3842,6 +3842,13 @@ do ;; esac diff --git a/debian/patches/svn-doc-updates.diff b/debian/patches/svn-doc-updates.diff index b8b88ed..2a0a5b9 100644 --- a/debian/patches/svn-doc-updates.diff +++ b/debian/patches/svn-doc-updates.diff @@ -4,1241 +4,3 @@ svn diff svn://gcc.gnu.org/svn/gcc/tags/gcc_4_8_2_release svn://gcc.gnu.org/svn/ | sed -r 's,^--- (\S+)\t(\S+)(.*)$,--- a/src/\1\t\2,;s,^\+\+\+ (\S+)\t(\S+)(.*)$,+++ b/src/\1\t\2,' \ | awk '/^Index:.*\.texi/ {skip=0; print; next} /^Index:/ {skip=1; next} skip==0' -Index: gcc/doc/extend.texi -=================================================================== ---- a/src/gcc/doc/extend.texi (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/doc/extend.texi (.../branches/gcc-4_8-branch) -@@ -3121,6 +3121,17 @@ - prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2 - and newer. - -+@item hotpatch [(@var{prologue-halfwords})] -+@cindex @code{hotpatch} attribute -+ -+On S/390 System z targets, you can use this function attribute to -+make GCC generate a ``hot-patching'' function prologue. The -+@code{hotpatch} has no effect on funtions that are explicitly -+inline. If the @option{-mhotpatch} or @option{-mno-hotpatch} -+command-line option is used at the same time, the @code{hotpatch} -+attribute takes precedence. If an argument is given, the maximum -+allowed value is 1000000. -+ - @item naked - @cindex function without a prologue/epilogue code - Use this attribute on the ARM, AVR, MCORE, RX and SPU ports to indicate that -@@ -8793,6 +8804,7 @@ - * picoChip Built-in Functions:: - * PowerPC Built-in Functions:: - * PowerPC AltiVec/VSX Built-in Functions:: -+* PowerPC Hardware Transactional Memory Built-in Functions:: - * RX Built-in Functions:: - * S/390 System z Built-in Functions:: - * SH Built-in Functions:: -@@ -13920,6 +13932,579 @@ - @samp{vec_vsx_st} built-in functions always generate the VSX @samp{LXVD2X}, - @samp{LXVW4X}, @samp{STXVD2X}, and @samp{STXVW4X} instructions. - -+If the ISA 2.07 additions to the vector/scalar (power8-vector) -+instruction set is available, the following additional functions are -+available for both 32-bit and 64-bit targets. For 64-bit targets, you -+can use @var{vector long} instead of @var{vector long long}, -+@var{vector bool long} instead of @var{vector bool long long}, and -+@var{vector unsigned long} instead of @var{vector unsigned long long}. -+ -+@smallexample -+vector long long vec_abs (vector long long); -+ -+vector long long vec_add (vector long long, vector long long); -+vector unsigned long long vec_add (vector unsigned long long, -+ vector unsigned long long); -+ -+int vec_all_eq (vector long long, vector long long); -+int vec_all_ge (vector long long, vector long long); -+int vec_all_gt (vector long long, vector long long); -+int vec_all_le (vector long long, vector long long); -+int vec_all_lt (vector long long, vector long long); -+int vec_all_ne (vector long long, vector long long); -+int vec_any_eq (vector long long, vector long long); -+int vec_any_ge (vector long long, vector long long); -+int vec_any_gt (vector long long, vector long long); -+int vec_any_le (vector long long, vector long long); -+int vec_any_lt (vector long long, vector long long); -+int vec_any_ne (vector long long, vector long long); -+ -+vector long long vec_eqv (vector long long, vector long long); -+vector long long vec_eqv (vector bool long long, vector long long); -+vector long long vec_eqv (vector long long, vector bool long long); -+vector unsigned long long vec_eqv (vector unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_eqv (vector bool long long, -+ vector unsigned long long); -+vector unsigned long long vec_eqv (vector unsigned long long, -+ vector bool long long); -+vector int vec_eqv (vector int, vector int); -+vector int vec_eqv (vector bool int, vector int); -+vector int vec_eqv (vector int, vector bool int); -+vector unsigned int vec_eqv (vector unsigned int, vector unsigned int); -+vector unsigned int vec_eqv (vector bool unsigned int, -+ vector unsigned int); -+vector unsigned int vec_eqv (vector unsigned int, -+ vector bool unsigned int); -+vector short vec_eqv (vector short, vector short); -+vector short vec_eqv (vector bool short, vector short); -+vector short vec_eqv (vector short, vector bool short); -+vector unsigned short vec_eqv (vector unsigned short, vector unsigned short); -+vector unsigned short vec_eqv (vector bool unsigned short, -+ vector unsigned short); -+vector unsigned short vec_eqv (vector unsigned short, -+ vector bool unsigned short); -+vector signed char vec_eqv (vector signed char, vector signed char); -+vector signed char vec_eqv (vector bool signed char, vector signed char); -+vector signed char vec_eqv (vector signed char, vector bool signed char); -+vector unsigned char vec_eqv (vector unsigned char, vector unsigned char); -+vector unsigned char vec_eqv (vector bool unsigned char, vector unsigned char); -+vector unsigned char vec_eqv (vector unsigned char, vector bool unsigned char); -+ -+vector long long vec_max (vector long long, vector long long); -+vector unsigned long long vec_max (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_min (vector long long, vector long long); -+vector unsigned long long vec_min (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_nand (vector long long, vector long long); -+vector long long vec_nand (vector bool long long, vector long long); -+vector long long vec_nand (vector long long, vector bool long long); -+vector unsigned long long vec_nand (vector unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_nand (vector bool long long, -+ vector unsigned long long); -+vector unsigned long long vec_nand (vector unsigned long long, -+ vector bool long long); -+vector int vec_nand (vector int, vector int); -+vector int vec_nand (vector bool int, vector int); -+vector int vec_nand (vector int, vector bool int); -+vector unsigned int vec_nand (vector unsigned int, vector unsigned int); -+vector unsigned int vec_nand (vector bool unsigned int, -+ vector unsigned int); -+vector unsigned int vec_nand (vector unsigned int, -+ vector bool unsigned int); -+vector short vec_nand (vector short, vector short); -+vector short vec_nand (vector bool short, vector short); -+vector short vec_nand (vector short, vector bool short); -+vector unsigned short vec_nand (vector unsigned short, vector unsigned short); -+vector unsigned short vec_nand (vector bool unsigned short, -+ vector unsigned short); -+vector unsigned short vec_nand (vector unsigned short, -+ vector bool unsigned short); -+vector signed char vec_nand (vector signed char, vector signed char); -+vector signed char vec_nand (vector bool signed char, vector signed char); -+vector signed char vec_nand (vector signed char, vector bool signed char); -+vector unsigned char vec_nand (vector unsigned char, vector unsigned char); -+vector unsigned char vec_nand (vector bool unsigned char, vector unsigned char); -+vector unsigned char vec_nand (vector unsigned char, vector bool unsigned char); -+ -+vector long long vec_orc (vector long long, vector long long); -+vector long long vec_orc (vector bool long long, vector long long); -+vector long long vec_orc (vector long long, vector bool long long); -+vector unsigned long long vec_orc (vector unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_orc (vector bool long long, -+ vector unsigned long long); -+vector unsigned long long vec_orc (vector unsigned long long, -+ vector bool long long); -+vector int vec_orc (vector int, vector int); -+vector int vec_orc (vector bool int, vector int); -+vector int vec_orc (vector int, vector bool int); -+vector unsigned int vec_orc (vector unsigned int, vector unsigned int); -+vector unsigned int vec_orc (vector bool unsigned int, -+ vector unsigned int); -+vector unsigned int vec_orc (vector unsigned int, -+ vector bool unsigned int); -+vector short vec_orc (vector short, vector short); -+vector short vec_orc (vector bool short, vector short); -+vector short vec_orc (vector short, vector bool short); -+vector unsigned short vec_orc (vector unsigned short, vector unsigned short); -+vector unsigned short vec_orc (vector bool unsigned short, -+ vector unsigned short); -+vector unsigned short vec_orc (vector unsigned short, -+ vector bool unsigned short); -+vector signed char vec_orc (vector signed char, vector signed char); -+vector signed char vec_orc (vector bool signed char, vector signed char); -+vector signed char vec_orc (vector signed char, vector bool signed char); -+vector unsigned char vec_orc (vector unsigned char, vector unsigned char); -+vector unsigned char vec_orc (vector bool unsigned char, vector unsigned char); -+vector unsigned char vec_orc (vector unsigned char, vector bool unsigned char); -+ -+vector int vec_pack (vector long long, vector long long); -+vector unsigned int vec_pack (vector unsigned long long, -+ vector unsigned long long); -+vector bool int vec_pack (vector bool long long, vector bool long long); -+ -+vector int vec_packs (vector long long, vector long long); -+vector unsigned int vec_packs (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned int vec_packsu (vector long long, vector long long); -+ -+vector long long vec_rl (vector long long, -+ vector unsigned long long); -+vector long long vec_rl (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_sl (vector long long, vector unsigned long long); -+vector long long vec_sl (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_sr (vector long long, vector unsigned long long); -+vector unsigned long long char vec_sr (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_sra (vector long long, vector unsigned long long); -+vector unsigned long long vec_sra (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_sub (vector long long, vector long long); -+vector unsigned long long vec_sub (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_unpackh (vector int); -+vector unsigned long long vec_unpackh (vector unsigned int); -+ -+vector long long vec_unpackl (vector int); -+vector unsigned long long vec_unpackl (vector unsigned int); -+ -+vector long long vec_vaddudm (vector long long, vector long long); -+vector long long vec_vaddudm (vector bool long long, vector long long); -+vector long long vec_vaddudm (vector long long, vector bool long long); -+vector unsigned long long vec_vaddudm (vector unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_vaddudm (vector bool unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_vaddudm (vector unsigned long long, -+ vector bool unsigned long long); -+ -+vector long long vec_vclz (vector long long); -+vector unsigned long long vec_vclz (vector unsigned long long); -+vector int vec_vclz (vector int); -+vector unsigned int vec_vclz (vector int); -+vector short vec_vclz (vector short); -+vector unsigned short vec_vclz (vector unsigned short); -+vector signed char vec_vclz (vector signed char); -+vector unsigned char vec_vclz (vector unsigned char); -+ -+vector signed char vec_vclzb (vector signed char); -+vector unsigned char vec_vclzb (vector unsigned char); -+ -+vector long long vec_vclzd (vector long long); -+vector unsigned long long vec_vclzd (vector unsigned long long); -+ -+vector short vec_vclzh (vector short); -+vector unsigned short vec_vclzh (vector unsigned short); -+ -+vector int vec_vclzw (vector int); -+vector unsigned int vec_vclzw (vector int); -+ -+vector signed char vec_vgbbd (vector signed char); -+vector unsigned char vec_vgbbd (vector unsigned char); -+ -+vector long long vec_vmaxsd (vector long long, vector long long); -+ -+vector unsigned long long vec_vmaxud (vector unsigned long long, -+ unsigned vector long long); -+ -+vector long long vec_vminsd (vector long long, vector long long); -+ -+vector unsigned long long vec_vminud (vector long long, -+ vector long long); -+ -+vector int vec_vpksdss (vector long long, vector long long); -+vector unsigned int vec_vpksdss (vector long long, vector long long); -+ -+vector unsigned int vec_vpkudus (vector unsigned long long, -+ vector unsigned long long); -+ -+vector int vec_vpkudum (vector long long, vector long long); -+vector unsigned int vec_vpkudum (vector unsigned long long, -+ vector unsigned long long); -+vector bool int vec_vpkudum (vector bool long long, vector bool long long); -+ -+vector long long vec_vpopcnt (vector long long); -+vector unsigned long long vec_vpopcnt (vector unsigned long long); -+vector int vec_vpopcnt (vector int); -+vector unsigned int vec_vpopcnt (vector int); -+vector short vec_vpopcnt (vector short); -+vector unsigned short vec_vpopcnt (vector unsigned short); -+vector signed char vec_vpopcnt (vector signed char); -+vector unsigned char vec_vpopcnt (vector unsigned char); -+ -+vector signed char vec_vpopcntb (vector signed char); -+vector unsigned char vec_vpopcntb (vector unsigned char); -+ -+vector long long vec_vpopcntd (vector long long); -+vector unsigned long long vec_vpopcntd (vector unsigned long long); -+ -+vector short vec_vpopcnth (vector short); -+vector unsigned short vec_vpopcnth (vector unsigned short); -+ -+vector int vec_vpopcntw (vector int); -+vector unsigned int vec_vpopcntw (vector int); -+ -+vector long long vec_vrld (vector long long, vector unsigned long long); -+vector unsigned long long vec_vrld (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_vsld (vector long long, vector unsigned long long); -+vector long long vec_vsld (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_vsrad (vector long long, vector unsigned long long); -+vector unsigned long long vec_vsrad (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_vsrd (vector long long, vector unsigned long long); -+vector unsigned long long char vec_vsrd (vector unsigned long long, -+ vector unsigned long long); -+ -+vector long long vec_vsubudm (vector long long, vector long long); -+vector long long vec_vsubudm (vector bool long long, vector long long); -+vector long long vec_vsubudm (vector long long, vector bool long long); -+vector unsigned long long vec_vsubudm (vector unsigned long long, -+ vector unsigned long long); -+vector unsigned long long vec_vsubudm (vector bool long long, -+ vector unsigned long long); -+vector unsigned long long vec_vsubudm (vector unsigned long long, -+ vector bool long long); -+ -+vector long long vec_vupkhsw (vector int); -+vector unsigned long long vec_vupkhsw (vector unsigned int); -+ -+vector long long vec_vupklsw (vector int); -+vector unsigned long long vec_vupklsw (vector int); -+@end smallexample -+ -+If the ISA 2.07 additions to the vector/scalar (power8-vector) -+instruction set is available, the following additional functions are -+available for 64-bit targets. New vector types -+(@var{vector __int128_t} and @var{vector __uint128_t}) are available -+to hold the @var{__int128_t} and @var{__uint128_t} types to use these -+builtins. -+ -+The normal vector extract, and set operations work on -+@var{vector __int128_t} and @var{vector __uint128_t} types, -+but the index value must be 0. -+ -+@smallexample -+vector __int128_t vec_vaddcuq (vector __int128_t, vector __int128_t); -+vector __uint128_t vec_vaddcuq (vector __uint128_t, vector __uint128_t); -+ -+vector __int128_t vec_vadduqm (vector __int128_t, vector __int128_t); -+vector __uint128_t vec_vadduqm (vector __uint128_t, vector __uint128_t); -+ -+vector __int128_t vec_vaddecuq (vector __int128_t, vector __int128_t, -+ vector __int128_t); -+vector __uint128_t vec_vaddecuq (vector __uint128_t, vector __uint128_t, -+ vector __uint128_t); -+ -+vector __int128_t vec_vaddeuqm (vector __int128_t, vector __int128_t, -+ vector __int128_t); -+vector __uint128_t vec_vaddeuqm (vector __uint128_t, vector __uint128_t, -+ vector __uint128_t); -+ -+vector __int128_t vec_vsubecuq (vector __int128_t, vector __int128_t, -+ vector __int128_t); -+vector __uint128_t vec_vsubecuq (vector __uint128_t, vector __uint128_t, -+ vector __uint128_t); -+ -+vector __int128_t vec_vsubeuqm (vector __int128_t, vector __int128_t, -+ vector __int128_t); -+vector __uint128_t vec_vsubeuqm (vector __uint128_t, vector __uint128_t, -+ vector __uint128_t); -+ -+vector __int128_t vec_vsubcuq (vector __int128_t, vector __int128_t); -+vector __uint128_t vec_vsubcuq (vector __uint128_t, vector __uint128_t); -+ -+__int128_t vec_vsubuqm (__int128_t, __int128_t); -+__uint128_t vec_vsubuqm (__uint128_t, __uint128_t); -+@end smallexample -+ -+If the cryptographic instructions are enabled (@option{-mcrypto} or -+@option{-mcpu=power8}), the following builtins are enabled. -+ -+@smallexample -+vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long); -+ -+vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned long long __builtin_crypto_vcipherlast -+ (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned long long __builtin_crypto_vncipherlast -+ (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned char __builtin_crypto_vpermxor (vector unsigned char, -+ vector unsigned char, -+ vector unsigned char); -+ -+vector unsigned short __builtin_crypto_vpermxor (vector unsigned short, -+ vector unsigned short, -+ vector unsigned short); -+ -+vector unsigned int __builtin_crypto_vpermxor (vector unsigned int, -+ vector unsigned int, -+ vector unsigned int); -+ -+vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long, -+ vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char, -+ vector unsigned char); -+ -+vector unsigned short __builtin_crypto_vpmsumb (vector unsigned short, -+ vector unsigned short); -+ -+vector unsigned int __builtin_crypto_vpmsumb (vector unsigned int, -+ vector unsigned int); -+ -+vector unsigned long long __builtin_crypto_vpmsumb (vector unsigned long long, -+ vector unsigned long long); -+ -+vector unsigned long long __builtin_crypto_vshasigmad -+ (vector unsigned long long, int, int); -+ -+vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int, -+ int, int); -+@end smallexample -+ -+The second argument to the @var{__builtin_crypto_vshasigmad} and -+@var{__builtin_crypto_vshasigmaw} builtin functions must be a constant -+integer that is 0 or 1. The third argument to these builtin functions -+must be a constant integer in the range of 0 to 15. -+ -+@node PowerPC Hardware Transactional Memory Built-in Functions -+@subsection PowerPC Hardware Transactional Memory Built-in Functions -+GCC provides two interfaces for accessing the Hardware Transactional -+Memory (HTM) instructions available on some of the PowerPC family -+of prcoessors (eg, POWER8). The two interfaces come in a low level -+interface, consisting of built-in functions specific to PowerPC and a -+higher level interface consisting of inline functions that are common -+between PowerPC and S/390. -+ -+@subsubsection PowerPC HTM Low Level Built-in Functions -+ -+The following low level built-in functions are available with -+@option{-mhtm} or @option{-mcpu=CPU} where CPU is `power8' or later. -+They all generate the machine instruction that is part of the name. -+ -+The HTM built-ins return true or false depending on their success and -+their arguments match exactly the type and order of the associated -+hardware instruction's operands. Refer to the ISA manual for a -+description of each instruction's operands. -+ -+@smallexample -+unsigned int __builtin_tbegin (unsigned int) -+unsigned int __builtin_tend (unsigned int) -+ -+unsigned int __builtin_tabort (unsigned int) -+unsigned int __builtin_tabortdc (unsigned int, unsigned int, unsigned int) -+unsigned int __builtin_tabortdci (unsigned int, unsigned int, int) -+unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int) -+unsigned int __builtin_tabortwci (unsigned int, unsigned int, int) -+ -+unsigned int __builtin_tcheck (unsigned int) -+unsigned int __builtin_treclaim (unsigned int) -+unsigned int __builtin_trechkpt (void) -+unsigned int __builtin_tsr (unsigned int) -+@end smallexample -+ -+In addition to the above HTM built-ins, we have added built-ins for -+some common extended mnemonics of the HTM instructions: -+ -+@smallexample -+unsigned int __builtin_tendall (void) -+unsigned int __builtin_tresume (void) -+unsigned int __builtin_tsuspend (void) -+@end smallexample -+ -+The following set of built-in functions are available to gain access -+to the HTM specific special purpose registers. -+ -+@smallexample -+unsigned long __builtin_get_texasr (void) -+unsigned long __builtin_get_texasru (void) -+unsigned long __builtin_get_tfhar (void) -+unsigned long __builtin_get_tfiar (void) -+ -+void __builtin_set_texasr (unsigned long); -+void __builtin_set_texasru (unsigned long); -+void __builtin_set_tfhar (unsigned long); -+void __builtin_set_tfiar (unsigned long); -+@end smallexample -+ -+Example usage of these low level built-in functions may look like: -+ -+@smallexample -+#include <htmintrin.h> -+ -+int num_retries = 10; -+ -+while (1) -+ @{ -+ if (__builtin_tbegin (0)) -+ @{ -+ /* Transaction State Initiated. */ -+ if (is_locked (lock)) -+ __builtin_tabort (0); -+ ... transaction code... -+ __builtin_tend (0); -+ break; -+ @} -+ else -+ @{ -+ /* Transaction State Failed. Use locks if the transaction -+ failure is "persistent" or we've tried too many times. */ -+ if (num_retries-- <= 0 -+ || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) -+ @{ -+ acquire_lock (lock); -+ ... non transactional fallback path... -+ release_lock (lock); -+ break; -+ @} -+ @} -+ @} -+@end smallexample -+ -+One final built-in function has been added that returns the value of -+the 2-bit Transaction State field of the Machine Status Register (MSR) -+as stored in @code{CR0}. -+ -+@smallexample -+unsigned long __builtin_ttest (void) -+@end smallexample -+ -+This built-in can be used to determine the current transaction state -+using the following code example: -+ -+@smallexample -+#include <htmintrin.h> -+ -+unsigned char tx_state = _HTM_STATE (__builtin_ttest ()); -+ -+if (tx_state == _HTM_TRANSACTIONAL) -+ @{ -+ /* Code to use in transactional state. */ -+ @} -+else if (tx_state == _HTM_NONTRANSACTIONAL) -+ @{ -+ /* Code to use in non-transactional state. */ -+ @} -+else if (tx_state == _HTM_SUSPENDED) -+ @{ -+ /* Code to use in transaction suspended state. */ -+ @} -+@end smallexample -+ -+@subsubsection PowerPC HTM High Level Inline Functions -+ -+The following high level HTM interface is made available by including -+@code{<htmxlintrin.h>} and using @option{-mhtm} or @option{-mcpu=CPU} -+where CPU is `power8' or later. This interface is common between PowerPC -+and S/390, allowing users to write one HTM source implementation that -+can be compiled and executed on either system. -+ -+@smallexample -+long __TM_simple_begin (void) -+long __TM_begin (void* const TM_buff) -+long __TM_end (void) -+void __TM_abort (void) -+void __TM_named_abort (unsigned char const code) -+void __TM_resume (void) -+void __TM_suspend (void) -+ -+long __TM_is_user_abort (void* const TM_buff) -+long __TM_is_named_user_abort (void* const TM_buff, unsigned char *code) -+long __TM_is_illegal (void* const TM_buff) -+long __TM_is_footprint_exceeded (void* const TM_buff) -+long __TM_nesting_depth (void* const TM_buff) -+long __TM_is_nested_too_deep(void* const TM_buff) -+long __TM_is_conflict(void* const TM_buff) -+long __TM_is_failure_persistent(void* const TM_buff) -+long __TM_failure_address(void* const TM_buff) -+long long __TM_failure_code(void* const TM_buff) -+@end smallexample -+ -+Using these common set of HTM inline functions, we can create -+a more portable version of the HTM example in the previous -+section that will work on either PowerPC or S/390: -+ -+@smallexample -+#include <htmxlintrin.h> -+ -+int num_retries = 10; -+TM_buff_type TM_buff; -+ -+while (1) -+ @{ -+ if (__TM_begin (TM_buff)) -+ @{ -+ /* Transaction State Initiated. */ -+ if (is_locked (lock)) -+ __TM_abort (); -+ ... transaction code... -+ __TM_end (); -+ break; -+ @} -+ else -+ @{ -+ /* Transaction State Failed. Use locks if the transaction -+ failure is "persistent" or we've tried too many times. */ -+ if (num_retries-- <= 0 -+ || __TM_is_failure_persistent (TM_buff)) -+ @{ -+ acquire_lock (lock); -+ ... non transactional fallback path... -+ release_lock (lock); -+ break; -+ @} -+ @} -+ @} -+@end smallexample -+ - @node RX Built-in Functions - @subsection RX Built-in Functions - GCC supports some of the RX instructions which cannot be expressed in -Index: gcc/doc/invoke.texi -=================================================================== ---- a/src/gcc/doc/invoke.texi (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/doc/invoke.texi (.../branches/gcc-4_8-branch) -@@ -161,7 +161,7 @@ - -pipe -pass-exit-codes @gol - -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol - --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol ---fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{arg} -fdump-go-spec=@var{file}} -+-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} - - @item C Language Options - @xref{C Dialect Options,,Options Controlling C Dialect}. -@@ -855,7 +855,12 @@ - -mno-recip-precision @gol - -mveclibabi=@var{type} -mfriz -mno-friz @gol - -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol ---msave-toc-indirect -mno-save-toc-indirect} -+-msave-toc-indirect -mno-save-toc-indirect @gol -+-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol -+-mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol -+-mquad-memory -mno-quad-memory @gol -+-mquad-memory-atomic -mno-quad-memory-atomic @gol -+-mcompat-align-parm -mno-compat-align-parm} - - @emph{RX Options} - @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol -@@ -879,7 +884,8 @@ - -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol - -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol - -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol ---mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} -+-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol -+-mhotpatch[=@var{halfwords}] -mno-hotpatch} - - @emph{Score Options} - @gccoptlist{-meb -mel @gol -@@ -928,7 +934,7 @@ - -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol - -mcbcond -mno-cbcond @gol - -mfmaf -mno-fmaf -mpopc -mno-popc @gol ---mfix-at697f} -+-mfix-at697f -mfix-ut699} - - @emph{SPU Options} - @gccoptlist{-mwarn-reloc -merror-reloc @gol -@@ -1460,11 +1466,18 @@ - for the plugin called @var{name}. - - @item -fdump-ada-spec@r{[}-slim@r{]} --For C and C++ source and include files, generate corresponding Ada --specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, -+@opindex fdump-ada-spec -+For C and C++ source and include files, generate corresponding Ada specs. -+@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, - GNAT User's Guide}, which provides detailed documentation on this feature. - -+@item -fada-spec-parent=@var{unit} -+@opindex fada-spec-parent -+In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate -+Ada specs as child units of parent @var{unit}. -+ - @item -fdump-go-spec=@var{file} -+@opindex fdump-go-spec - For input files in any language, generate corresponding Go - declarations in @var{file}. This generates Go @code{const}, - @code{type}, @code{var}, and @code{func} declarations which may be a -@@ -11241,11 +11254,32 @@ - big-endian ARM processors generated by versions of the compiler prior to - 2.8. This option is now deprecated. - --@item -mcpu=@var{name} --@opindex mcpu --This specifies the name of the target ARM processor. GCC uses this name --to determine what kind of instructions it can emit when generating --assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, -+@item -march=@var{name} -+@opindex march -+This specifies the name of the target ARM architecture. GCC uses this -+name to determine what kind of instructions it can emit when generating -+assembly code. This option can be used in conjunction with or instead -+of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, -+@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, -+@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, -+@samp{armv6}, @samp{armv6j}, -+@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, -+@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m} -+@samp{armv8-a}, -+@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. -+ -+@option{-march=native} causes the compiler to auto-detect the architecture -+of the build computer. At present, this feature is only supported on -+Linux, and not all architectures are recognized. If the auto-detect is -+unsuccessful the option has no effect. -+ -+@item -mtune=@var{name} -+@opindex mtune -+This option specifies the name of the target ARM processor for -+which GCC should tune the performance of the code. -+For some ARM implementations better performance can be obtained by using -+this option. -+Permissible names are: @samp{arm2}, @samp{arm250}, - @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, - @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, - @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, -@@ -11273,27 +11307,6 @@ - @samp{fa526}, @samp{fa626}, - @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}. - -- --@option{-mcpu=generic-@var{arch}} is also permissible, and is --equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. --See @option{-mtune} for more information. -- --@option{-mcpu=native} causes the compiler to auto-detect the CPU --of the build computer. At present, this feature is only supported on --Linux, and not all architectures are recognized. If the auto-detect is --unsuccessful the option has no effect. -- --@item -mtune=@var{name} --@opindex mtune --This option is very similar to the @option{-mcpu=} option, except that --instead of specifying the actual target processor type, and hence --restricting which instructions can be used, it specifies that GCC should --tune the performance of the code as if the target were of the type --specified in this option, but still choosing the instructions it --generates based on the CPU specified by a @option{-mcpu=} option. --For some ARM implementations better performance can be obtained by using --this option. -- - @option{-mtune=generic-@var{arch}} specifies that GCC should tune the - performance for a blend of processors within architecture @var{arch}. - The aim is to generate code that run well on the current most popular -@@ -11306,21 +11319,23 @@ - Linux, and not all architectures are recognized. If the auto-detect is - unsuccessful the option has no effect. - --@item -march=@var{name} --@opindex march --This specifies the name of the target ARM architecture. GCC uses this --name to determine what kind of instructions it can emit when generating --assembly code. This option can be used in conjunction with or instead --of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, --@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, --@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, --@samp{armv6}, @samp{armv6j}, --@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, --@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, --@samp{armv8-a}, --@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. -+@item -mcpu=@var{name} -+@opindex mcpu -+This specifies the name of the target ARM processor. GCC uses this name -+to derive the name of the target ARM architecture (as if specified -+by @option{-march}) and the ARM processor type for which to tune for -+performance (as if specified by @option{-mtune}). Where this option -+is used in conjunction with @option{-march} or @option{-mtune}, -+those options take precedence over the appropriate part of this option. - --@option{-march=native} causes the compiler to auto-detect the architecture -+Permissible names for this option are the same as those for -+@option{-mtune}. -+ -+@option{-mcpu=generic-@var{arch}} is also permissible, and is -+equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. -+See @option{-mtune} for more information. -+ -+@option{-mcpu=native} causes the compiler to auto-detect the CPU - of the build computer. At present, this feature is only supported on - Linux, and not all architectures are recognized. If the auto-detect is - unsuccessful the option has no effect. -@@ -11409,8 +11424,11 @@ - - @item -mpic-register=@var{reg} - @opindex mpic-register --Specify the register to be used for PIC addressing. The default is R10 --unless stack-checking is enabled, when R9 is used. -+Specify the register to be used for PIC addressing. -+For standard PIC base case, the default will be any suitable register -+determined by compiler. For single PIC base case, the default is -+@samp{R9} if target is EABI based or stack-checking is enabled, -+otherwise the default is @samp{R10}. - - @item -mpoke-function-name - @opindex mpoke-function-name -@@ -17226,7 +17244,9 @@ - @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol - -mpopcntb -mpopcntd -mpowerpc64 @gol - -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol ---msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx} -+-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol -+-mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol -+-mquad-memory -mquad-memory-atomic} - - The particular options set for any particular CPU varies between - compiler versions, depending on what setting seems to produce optimal -@@ -17277,6 +17297,38 @@ - @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI - enhancements. - -+When @option{-maltivec} is used, rather than @option{-maltivec=le} or -+@option{-maltivec=be}, the element order for Altivec intrinsics such -+as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} will -+match array element order corresponding to the endianness of the -+target. That is, element zero identifies the leftmost element in a -+vector register when targeting a big-endian platform, and identifies -+the rightmost element in a vector register when targeting a -+little-endian platform. -+ -+@item -maltivec=be -+@opindex maltivec=be -+Generate Altivec instructions using big-endian element order, -+regardless of whether the target is big- or little-endian. This is -+the default when targeting a big-endian platform. -+ -+The element order is used to interpret element numbers in Altivec -+intrinsics such as @code{vec_splat}, @code{vec_extract}, and -+@code{vec_insert}. By default, these will match array element order -+corresponding to the endianness for the target. -+ -+@item -maltivec=le -+@opindex maltivec=le -+Generate Altivec instructions using little-endian element order, -+regardless of whether the target is big- or little-endian. This is -+the default when targeting a little-endian platform. This option is -+currently ignored when targeting a big-endian platform. -+ -+The element order is used to interpret element numbers in Altivec -+intrinsics such as @code{vec_splat}, @code{vec_extract}, and -+@code{vec_insert}. By default, these will match array element order -+corresponding to the endianness for the target. -+ - @item -mvrsave - @itemx -mno-vrsave - @opindex mvrsave -@@ -17344,6 +17396,55 @@ - instructions, and also enable the use of built-in functions that allow - more direct access to the VSX instruction set. - -+@item -mcrypto -+@itemx -mno-crypto -+@opindex mcrypto -+@opindex mno-crypto -+Enable the use (disable) of the built-in functions that allow direct -+access to the cryptographic instructions that were added in version -+2.07 of the PowerPC ISA. -+ -+@item -mdirect-move -+@itemx -mno-direct-move -+@opindex mdirect-move -+@opindex mno-direct-move -+Generate code that uses (does not use) the instructions to move data -+between the general purpose registers and the vector/scalar (VSX) -+registers that were added in version 2.07 of the PowerPC ISA. -+ -+@item -mpower8-fusion -+@itemx -mno-power8-fusion -+@opindex mpower8-fusion -+@opindex mno-power8-fusion -+Generate code that keeps (does not keeps) some integer operations -+adjacent so that the instructions can be fused together on power8 and -+later processors. -+ -+@item -mpower8-vector -+@itemx -mno-power8-vector -+@opindex mpower8-vector -+@opindex mno-power8-vector -+Generate code that uses (does not use) the vector and scalar -+instructions that were added in version 2.07 of the PowerPC ISA. Also -+enable the use of built-in functions that allow more direct access to -+the vector instructions. -+ -+@item -mquad-memory -+@itemx -mno-quad-memory -+@opindex mquad-memory -+@opindex mno-quad-memory -+Generate code that uses (does not use) the non-atomic quad word memory -+instructions. The @option{-mquad-memory} option requires use of -+64-bit mode. -+ -+@item -mquad-memory-atomic -+@itemx -mno-quad-memory-atomic -+@opindex mquad-memory-atomic -+@opindex mno-quad-memory-atomic -+Generate code that uses (does not use) the atomic quad word memory -+instructions. The @option{-mquad-memory-atomic} option requires use of -+64-bit mode. -+ - @item -mfloat-gprs=@var{yes/single/double/no} - @itemx -mfloat-gprs - @opindex mfloat-gprs -@@ -17763,7 +17864,8 @@ - @opindex mabi - Extend the current ABI with a particular extension, or remove such extension. - Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, --@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. -+@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}, -+@var{elfv1}, @var{elfv2}@. - - @item -mabi=spe - @opindex mabi=spe -@@ -17785,6 +17887,20 @@ - Change the current ABI to use IEEE extended-precision long double. - This is a PowerPC 32-bit Linux ABI option. - -+@item -mabi=elfv1 -+@opindex mabi=elfv1 -+Change the current ABI to use the ELFv1 ABI. -+This is the default ABI for big-endian PowerPC 64-bit Linux. -+Overriding the default ABI requires special system support and is -+likely to fail in spectacular ways. -+ -+@item -mabi=elfv2 -+@opindex mabi=elfv2 -+Change the current ABI to use the ELFv2 ABI. -+This is the default ABI for little-endian PowerPC 64-bit Linux. -+Overriding the default ABI requires special system support and is -+likely to fail in spectacular ways. -+ - @item -mprototype - @itemx -mno-prototype - @opindex mprototype -@@ -18070,6 +18186,23 @@ - a pointer on AIX and 64-bit Linux systems. If the TOC value is not - saved in the prologue, it is saved just before the call through the - pointer. The @option{-mno-save-toc-indirect} option is the default. -+ -+@item -mcompat-align-parm -+@itemx -mno-compat-align-parm -+@opindex mcompat-align-parm -+Generate (do not generate) code to pass structure parameters with a -+maximum alignment of 64 bits, for compatibility with older versions -+of GCC. -+ -+Older versions of GCC (prior to 4.9.0) incorrectly did not align a -+structure parameter on a 128-bit boundary when that structure contained -+a member requiring 128-bit alignment. This is corrected in more -+recent versions of GCC. This option may be used to generate code -+that is compatible with functions compiled with older versions of -+GCC. -+ -+In this version of the compiler, the @option{-mcompat-align-parm} -+is the default, except when using the Linux ELFv2 ABI. - @end table - - @node RX Options -@@ -18449,6 +18582,21 @@ - In order to be efficient the extra code makes the assumption that the stack starts - at an address aligned to the value given by @var{stack-size}. - The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. -+ -+@item -mhotpatch[=@var{halfwords}] -+@itemx -mno-hotpatch -+@opindex mhotpatch -+If the hotpatch option is enabled, a ``hot-patching'' function -+prologue is generated for all functions in the compilation unit. -+The funtion label is prepended with the given number of two-byte -+Nop instructions (@var{halfwords}, maximum 1000000) or 12 Nop -+instructions if no argument is present. Functions with a -+hot-patching prologue are never inlined automatically, and a -+hot-patching prologue is never generated for functions functions -+that are explicitly inline. -+ -+This option can be overridden for individual functions with the -+@code{hotpatch} attribute. - @end table - - @node Score Options -@@ -19039,8 +19187,9 @@ - @opindex mno-app-regs - @opindex mapp-regs - Specify @option{-mapp-regs} to generate output using the global registers --2 through 4, which the SPARC SVR4 ABI reserves for applications. This --is the default. -+2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the -+global register 1, each global register 2 through 4 is then treated as an -+allocable register that is clobbered by function calls. This is the default. - - To be fully SVR4 ABI-compliant at the cost of some performance loss, - specify @option{-mno-app-regs}. You should compile libraries and system -@@ -19133,10 +19282,10 @@ - Set the instruction set, register set, and instruction scheduling parameters - for machine type @var{cpu_type}. Supported values for @var{cpu_type} are - @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, --@samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, --@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, --@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3}, --and @samp{niagara4}. -+@samp{leon}, @samp{leon3}, @samp{sparclite}, @samp{f930}, @samp{f934}, -+@samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, -+@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, -+@samp{niagara3} and @samp{niagara4}. - - Native Solaris and GNU/Linux toolchains also support the value @samp{native}, - which selects the best architecture option for the host processor. -@@ -19155,7 +19304,7 @@ - cypress - - @item v8 --supersparc, hypersparc, leon -+supersparc, hypersparc, leon, leon3 - - @item sparclite - f930, f934, sparclite86x -@@ -19217,10 +19366,11 @@ - The same values for @option{-mcpu=@var{cpu_type}} can be used for - @option{-mtune=@var{cpu_type}}, but the only useful values are those - that select a particular CPU implementation. Those are @samp{cypress}, --@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934}, --@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3}, --@samp{niagara}, @samp{niagara2}, @samp{niagara3} and @samp{niagara4}. With --native Solaris and GNU/Linux toolchains, @samp{native} can also be used. -+@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, @samp{f930}, -+@samp{f934}, @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, -+@samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3} and -+@samp{niagara4}. With native Solaris and GNU/Linux toolchains, @samp{native} -+can also be used. - - @item -mv8plus - @itemx -mno-v8plus -@@ -19289,6 +19439,11 @@ - @opindex mfix-at697f - Enable the documented workaround for the single erratum of the Atmel AT697F - processor (which corresponds to erratum #13 of the AT697E processor). -+ -+@item -mfix-ut699 -+@opindex mfix-ut699 -+Enable the documented workarounds for the floating-point errata and the data -+cache nullify errata of the UT699 processor. - @end table - - These @samp{-m} options are supported in addition to the above -Index: gcc/doc/md.texi -=================================================================== ---- a/src/gcc/doc/md.texi (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/doc/md.texi (.../branches/gcc-4_8-branch) -@@ -2055,7 +2055,7 @@ - - @end table - --@item PowerPC and IBM RS6000---@file{config/rs6000/rs6000.h} -+@item PowerPC and IBM RS6000---@file{config/rs6000/constraints.md} - @table @code - @item b - Address base register -@@ -2069,18 +2069,58 @@ - @item v - Altivec vector register - -+@item wa -+Any VSX register if the -mvsx option was used or NO_REGS. -+ - @item wd --VSX vector register to hold vector double data -+VSX vector register to hold vector double data or NO_REGS. - - @item wf --VSX vector register to hold vector float data -+VSX vector register to hold vector float data or NO_REGS. - -+@item wg -+If @option{-mmfpgpr} was used, a floating point register or NO_REGS. -+ -+@item wl -+Floating point register if the LFIWAX instruction is enabled or NO_REGS. -+ -+@item wm -+VSX register if direct move instructions are enabled, or NO_REGS. -+ -+@item wn -+No register (NO_REGS). -+ -+@item wr -+General purpose register if 64-bit instructions are enabled or NO_REGS. -+ - @item ws --VSX vector register to hold scalar float data -+VSX vector register to hold scalar double values or NO_REGS. - --@item wa --Any VSX register -+@item wt -+VSX vector register to hold 128 bit integer or NO_REGS. - -+@item wu -+Altivec register to use for float/32-bit int loads/stores or NO_REGS. -+ -+@item wv -+Altivec register to use for double loads/stores or NO_REGS. -+ -+@item ww -+FP or VSX register to perform float operations under @option{-mvsx} or NO_REGS. -+ -+@item wx -+Floating point register if the STFIWX instruction is enabled or NO_REGS. -+ -+@item wy -+VSX vector register to hold scalar float values or NO_REGS. -+ -+@item wz -+Floating point register if the LFIWZX instruction is enabled or NO_REGS. -+ -+@item wQ -+A memory address that will work with the @code{lq} and @code{stq} -+instructions. -+ - @item h - @samp{MQ}, @samp{CTR}, or @samp{LINK} register - -Index: gcc/fortran/invoke.texi -=================================================================== ---- a/src/gcc/fortran/invoke.texi (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/invoke.texi (.../branches/gcc-4_8-branch) -@@ -982,11 +982,12 @@ - into internal representation. Only really useful for debugging the - GNU Fortran compiler itself. - --@item -fdump-optimized-tree -+@item -fdump-fortran-optimized - @opindex @code{fdump-fortran-optimized} - Output the parse tree after front-end optimization. Only really - useful for debugging the GNU Fortran compiler itself. - -+@item -fdump-parse-tree - @opindex @code{fdump-parse-tree} - Output the internal parse tree after translating the source program - into internal representation. Only really useful for debugging the -Index: libffi/doc/libffi.texi -=================================================================== ---- a/src/libffi/doc/libffi.texi (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/doc/libffi.texi (.../branches/gcc-4_8-branch) -@@ -184,11 +184,11 @@ - - @var{rvalue} is a pointer to a chunk of memory that will hold the - result of the function call. This must be large enough to hold the --result and must be suitably aligned; it is the caller's responsibility -+result, no smaller than the system register size (generally 32 or 64 -+bits), and must be suitably aligned; it is the caller's responsibility - to ensure this. If @var{cif} declares that the function returns - @code{void} (using @code{ffi_type_void}), then @var{rvalue} is --ignored. If @var{rvalue} is @samp{NULL}, then the return value is --discarded. -+ignored. - - @var{avalues} is a vector of @code{void *} pointers that point to the - memory locations holding the argument values for a call. If @var{cif} -@@ -214,7 +214,7 @@ - ffi_type *args[1]; - void *values[1]; - char *s; -- int rc; -+ ffi_arg rc; - - /* Initialize the argument info vectors */ - args[0] = &ffi_type_pointer; -@@ -222,7 +222,7 @@ - - /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, -- &ffi_type_uint, args) == FFI_OK) -+ &ffi_type_sint, args) == FFI_OK) - @{ - s = "Hello World!"; - ffi_call(&cif, puts, &rc, values); -@@ -360,7 +360,7 @@ - new @code{ffi_type} object for it. - - @tindex ffi_type --@deftp ffi_type -+@deftp {Data type} ffi_type - The @code{ffi_type} has the following members: - @table @code - @item size_t size -@@ -414,6 +414,7 @@ - int i; - - tm_type.size = tm_type.alignment = 0; -+ tm_type.type = FFI_TYPE_STRUCT; - tm_type.elements = &tm_type_elements; - - for (i = 0; i < 9; i++) -@@ -540,12 +541,14 @@ - #include <ffi.h> - - /* Acts like puts with the file given at time of enclosure. */ --void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], -- FILE *stream) -+void puts_binding(ffi_cif *cif, void *ret, void* args[], -+ void *stream) - @{ -- *ret = fputs(*(char **)args[0], stream); -+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream); - @} - -+typedef int (*puts_t)(char *); -+ - int main() - @{ - ffi_cif cif; -@@ -552,9 +555,9 @@ - ffi_type *args[1]; - ffi_closure *closure; - -- int (*bound_puts)(char *); -+ void *bound_puts; - int rc; -- -+ - /* Allocate closure and bound_puts */ - closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); - -@@ -565,13 +568,13 @@ - - /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, -- &ffi_type_uint, args) == FFI_OK) -+ &ffi_type_sint, args) == FFI_OK) - @{ - /* Initialize the closure, setting stream to stdout */ -- if (ffi_prep_closure_loc(closure, &cif, puts_binding, -+ if (ffi_prep_closure_loc(closure, &cif, puts_binding, - stdout, bound_puts) == FFI_OK) - @{ -- rc = bound_puts("Hello World!"); -+ rc = ((puts_t)bound_puts)("Hello World!"); - /* rc now holds the result of the call to fputs */ - @} - @} diff --git a/debian/patches/svn-updates.diff b/debian/patches/svn-updates.diff index b5a6d57..fd86973 100644 --- a/debian/patches/svn-updates.diff +++ b/debian/patches/svn-updates.diff @@ -1,4430 +1,207 @@ -# DP: updates from the 4.8 branch upto 20140404 (r209122). +# DP: updates from the 4.8 branch upto 20140717 (r212756). last_updated() { cat > ${dir}LAST_UPDATED <<EOF -Fri Apr 4 19:07:33 CEST 2014 -Fri Apr 4 17:07:33 UTC 2014 (revision 209122) +Thu Jul 17 16:06:36 CEST 2014 +Thu Jul 17 14:06:36 UTC 2014 (revision 212756) EOF } -LANG=C svn diff svn://gcc.gnu.org/svn/gcc/tags/gcc_4_8_2_release svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch \ +LANG=C svn diff svn://gcc.gnu.org/svn/gcc/tags/gcc_4_8_3_release svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch \ | sed -r 's,^--- (\S+)\t(\S+)(.*)$,--- a/src/\1\t\2,;s,^\+\+\+ (\S+)\t(\S+)(.*)$,+++ b/src/\1\t\2,' \ | awk '/^Index:.*\.(class|texi)/ {skip=1; next} /^Index:/ { skip=0 } skip==0' -Index: libitm/configure -=================================================================== ---- a/src/libitm/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/configure (.../branches/gcc-4_8-branch) -@@ -7270,7 +7270,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -7295,7 +7295,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -7314,7 +7317,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11779,7 +11785,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11782 "configure" -+#line 11788 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11885,7 +11891,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11888 "configure" -+#line 11894 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -17401,7 +17407,44 @@ - esac - LIBITM_CHECK_AS_HTM - -+case "${target_cpu}" in -+powerpc*) -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler supports HTM" >&5 -+$as_echo_n "checking if the assembler supports HTM... " >&6; } -+if test "${libitm_cv_as_htm+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else - -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+asm("tbegin. 0; tend. 0"); -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ libitm_cv_as_htm=yes -+else -+ libitm_cv_as_htm=no -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_as_htm" >&5 -+$as_echo "$libitm_cv_as_htm" >&6; } -+ if test x$libitm_cv_as_htm = xyes; then -+ -+$as_echo "#define HAVE_AS_HTM 1" >>confdefs.h -+ -+ fi -+ ;; -+esac -+ -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether weak refs work like ELF" >&5 - $as_echo_n "checking whether weak refs work like ELF... " >&6; } - if test "${ac_cv_have_elf_style_weakref+set}" = set; then : -Index: libitm/configure.tgt -=================================================================== ---- a/src/libitm/configure.tgt (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/configure.tgt (.../branches/gcc-4_8-branch) -@@ -47,7 +47,10 @@ - # work out any special compilation flags as necessary. - case "${target_cpu}" in - alpha*) ARCH=alpha ;; -- rs6000 | powerpc*) ARCH=powerpc ;; -+ rs6000 | powerpc*) -+ XCFLAGS="${XCFLAGS} -mhtm" -+ ARCH=powerpc -+ ;; - - arm*) ARCH=arm ;; - -Index: libitm/ChangeLog -=================================================================== ---- a/src/libitm/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,52 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r204808: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/powerpc/sjlj.S [__powerpc64__ && _CALL_ELF == 2]: -+ (FUNC): Define ELFv2 variant. -+ (END): Likewise. -+ (HIDDEN): Likewise. -+ (CALL): Likewise. -+ (BASE): Likewise. -+ (LR_SAVE): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Power8 HTM Support -+ Backport from mainline -+ * acinclude.m4 (LIBITM_CHECK_AS_HTM): New. -+ * configure: Rebuild. -+ * configure.tgt (target_cpu): Add -mhtm to XCFLAGS. -+ * config/powerpc/target.h: Include sys/auxv.h and htmintrin.h. -+ (USE_HTM_FASTPATH): Define. -+ (_TBEGIN_STARTED, _TBEGIN_INDETERMINATE, _TBEGIN_PERSISTENT) -+ (_HTM_RETRIES) New macros. -+ (htm_abort, htm_abort_should_retry, htm_available, htm_begin, htm_init) -+ (htm_begin_success, htm_commit, htm_transaction_active): New functions. -+ -+2014-03-26 Jakub Jelinek <jakub@redhat.com> -+ -+ * config/linux/futex_bits.h: Include errno.h. -+ (sys_futex0): If syscall returns -1, return -errno rather than -+ -1. -+ -+2014-03-03 Peter Bergner <bergner@vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-06-20 Torvald Riegel <triegel@redhat.com> -+ -+ * query.cc (_ITM_inTransaction): Abort when using the HTM fastpath. -+ (_ITM_getTransactionId): Same. -+ * config/x86/target.h (htm_transaction_active): New. -+ -+ 2013-06-20 Torvald Riegel <triegel@redhat.com> -+ -+ PR libitm/57643 -+ * beginend.cc (gtm_thread::begin_transaction): Handle reentrancy in -+ the HTM fastpath. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -@@ -8,13 +57,12 @@ - 2013-08-02 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> - - * configure.tgt: Add -msoft-float to XCFLAGS. -- - - 2013-08-14 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> - - * config/s390/sjlj.S: Add file missing from last commit. - * config/s390/target.h: Likewise. -- -+ - 2013-08-02 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> - - Backports from mainline: -Index: libitm/query.cc -=================================================================== ---- a/src/libitm/query.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/query.cc (.../branches/gcc-4_8-branch) -@@ -43,6 +43,15 @@ - _ITM_howExecuting ITM_REGPARM - _ITM_inTransaction (void) - { -+#if defined(USE_HTM_FASTPATH) -+ // If we use the HTM fastpath, we cannot reliably detect whether we are -+ // in a transaction because this function can be called outside of -+ // a transaction and thus we can't deduce this by looking at just the serial -+ // lock. This function isn't used in practice currently, so the easiest -+ // way to handle it is to just abort. -+ if (htm_fastpath && htm_transaction_active()) -+ htm_abort(); -+#endif - struct gtm_thread *tx = gtm_thr(); - if (tx && (tx->nesting > 0)) - { -@@ -58,6 +67,11 @@ - _ITM_transactionId_t ITM_REGPARM - _ITM_getTransactionId (void) - { -+#if defined(USE_HTM_FASTPATH) -+ // See ITM_inTransaction. -+ if (htm_fastpath && htm_transaction_active()) -+ htm_abort(); -+#endif - struct gtm_thread *tx = gtm_thr(); - return (tx && (tx->nesting > 0)) ? tx->id : _ITM_noTransactionId; - } -Index: libitm/beginend.cc -=================================================================== ---- a/src/libitm/beginend.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/beginend.cc (.../branches/gcc-4_8-branch) -@@ -197,6 +197,8 @@ - // We are executing a transaction now. - // Monitor the writer flag in the serial-mode lock, and abort - // if there is an active or waiting serial-mode transaction. -+ // Note that this can also happen due to an enclosing -+ // serial-mode transaction; we handle this case below. - if (unlikely(serial_lock.is_write_locked())) - htm_abort(); - else -@@ -219,6 +221,14 @@ - tx = new gtm_thread(); - set_gtm_thr(tx); - } -+ // Check whether there is an enclosing serial-mode transaction; -+ // if so, we just continue as a nested transaction and don't -+ // try to use the HTM fastpath. This case can happen when an -+ // outermost relaxed transaction calls unsafe code that starts -+ // a transaction. -+ if (tx->nesting > 0) -+ break; -+ // Another thread is running a serial-mode transaction. Wait. - serial_lock.read_lock(tx); - serial_lock.read_unlock(tx); - // TODO We should probably reset the retry count t here, unless -Index: libitm/config/linux/futex_bits.h -=================================================================== ---- a/src/libitm/config/linux/futex_bits.h (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/config/linux/futex_bits.h (.../branches/gcc-4_8-branch) -@@ -31,9 +31,13 @@ - - #include <unistd.h> - #include <sys/syscall.h> -+#include <errno.h> - - static inline long - sys_futex0 (std::atomic<int> *addr, long op, long val) - { -- return syscall (SYS_futex, (int*) addr, op, val, 0); -+ long res = syscall (SYS_futex, (int*) addr, op, val, 0); -+ if (__builtin_expect (res == -1, 0)) -+ return -errno; -+ return res; - } -Index: libitm/config/powerpc/sjlj.S -=================================================================== ---- a/src/libitm/config/powerpc/sjlj.S (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/config/powerpc/sjlj.S (.../branches/gcc-4_8-branch) -@@ -26,8 +26,27 @@ - - #include "asmcfi.h" - --#if defined(__powerpc64__) && defined(__ELF__) -+#if defined(__powerpc64__) && _CALL_ELF == 2 - .macro FUNC name -+ .globl \name -+ .type \name, @function -+\name: -+0: addis 2,12,(.TOC.-0b)@ha -+ addi 2,2,(.TOC.-0b)@l -+ .localentry \name, . - \name -+.endm -+.macro END name -+ .size \name, . - \name -+.endm -+.macro HIDDEN name -+ .hidden \name -+.endm -+.macro CALL name -+ bl \name -+ nop -+.endm -+#elif defined(__powerpc64__) && defined(__ELF__) -+.macro FUNC name - .globl \name, .\name - .section ".opd","aw" - .align 3 -@@ -117,6 +136,9 @@ - #if defined(_CALL_AIXDESC) - # define BASE 6*WS - # define LR_SAVE 2*WS -+#elif _CALL_ELF == 2 -+# define BASE 6*WS -+# define LR_SAVE 2*WS - #elif defined(_CALL_SYSV) - # define BASE 2*WS - # define LR_SAVE 1*WS -Index: libitm/config/powerpc/target.h -=================================================================== ---- a/src/libitm/config/powerpc/target.h (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/config/powerpc/target.h (.../branches/gcc-4_8-branch) -@@ -22,6 +22,10 @@ - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - <http://www.gnu.org/licenses/>. */ - -+#ifdef HAVE_SYS_AUXV_H -+#include <sys/auxv.h> -+#endif -+ - namespace GTM HIDDEN { - - typedef int v128 __attribute__((vector_size(16), may_alias, aligned(16))); -@@ -55,4 +59,82 @@ - __asm volatile ("" : : : "memory"); - } - -+// Use HTM if it is supported by the system. -+// See gtm_thread::begin_transaction for how these functions are used. -+#if defined (__linux__) \ -+ && defined (HAVE_AS_HTM) \ -+ && defined (HAVE_GETAUXVAL) \ -+ && defined (AT_HWCAP2) \ -+ && defined (PPC_FEATURE2_HAS_HTM) -+ -+#include <htmintrin.h> -+ -+#define USE_HTM_FASTPATH -+ -+#define _TBEGIN_STARTED 0 -+#define _TBEGIN_INDETERMINATE 1 -+#define _TBEGIN_PERSISTENT 2 -+ -+/* Number of retries for transient failures. */ -+#define _HTM_RETRIES 10 -+ -+static inline bool -+htm_available (void) -+{ -+ return (getauxval (AT_HWCAP2) & PPC_FEATURE2_HAS_HTM) ? true : false; -+} -+ -+static inline uint32_t -+htm_init (void) -+{ -+ // Maximum number of times we try to execute a transaction -+ // as a HW transaction. -+ return htm_available () ? _HTM_RETRIES : 0; -+} -+ -+static inline uint32_t -+htm_begin (void) -+{ -+ if (__builtin_expect (__builtin_tbegin (0), 1)) -+ return _TBEGIN_STARTED; -+ -+ if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) -+ return _TBEGIN_PERSISTENT; -+ -+ return _TBEGIN_INDETERMINATE; -+} -+ -+static inline bool -+htm_begin_success (uint32_t begin_ret) -+{ -+ return begin_ret == _TBEGIN_STARTED; -+} -+ -+static inline void -+htm_commit (void) -+{ -+ __builtin_tend (0); -+} -+ -+static inline void -+htm_abort (void) -+{ -+ __builtin_tabort (0); -+} -+ -+static inline bool -+htm_abort_should_retry (uint32_t begin_ret) -+{ -+ return begin_ret != _TBEGIN_PERSISTENT; -+} -+ -+/* Returns true iff a hardware transaction is currently being executed. */ -+static inline bool -+htm_transaction_active (void) -+{ -+ return (_HTM_STATE (__builtin_ttest ()) == _HTM_TRANSACTIONAL); -+} -+ -+#endif -+ - } // namespace GTM -Index: libitm/config/x86/target.h -=================================================================== ---- a/src/libitm/config/x86/target.h (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/config/x86/target.h (.../branches/gcc-4_8-branch) -@@ -125,6 +125,13 @@ - { - return begin_ret & _XABORT_RETRY; - } -+ -+/* Returns true iff a hardware transaction is currently being executed. */ -+static inline bool -+htm_transaction_active () -+{ -+ return _xtest() != 0; -+} - #endif - - -Index: libitm/acinclude.m4 -=================================================================== ---- a/src/libitm/acinclude.m4 (.../tags/gcc_4_8_2_release) -+++ b/src/libitm/acinclude.m4 (.../branches/gcc-4_8-branch) -@@ -134,6 +134,20 @@ - ;; - esac]) - -+dnl Check if as supports HTM instructions. -+AC_DEFUN([LIBITM_CHECK_AS_HTM], [ -+case "${target_cpu}" in -+powerpc*) -+ AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [ -+ AC_TRY_COMPILE([], [asm("tbegin. 0; tend. 0");], -+ [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no]) -+ ]) -+ if test x$libitm_cv_as_htm = xyes; then -+ AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.]) -+ fi -+ ;; -+esac]) -+ - sinclude(../libtool.m4) - dnl The lines below arrange for aclocal not to bring an installed - dnl libtool.m4 into aclocal.m4, while still arranging for automake to -Index: libtool.m4 -=================================================================== ---- a/src/libtool.m4 (.../tags/gcc_4_8_2_release) -+++ b/src/libtool.m4 (.../branches/gcc-4_8-branch) -@@ -1220,7 +1220,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -1241,7 +1241,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -1260,7 +1263,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -Index: libgomp/configure -=================================================================== ---- a/src/libgomp/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libgomp/configure (.../branches/gcc-4_8-branch) -@@ -6580,7 +6580,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6605,7 +6605,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6624,7 +6627,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11088,7 +11094,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11091 "configure" -+#line 11097 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11194,7 +11200,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11197 "configure" -+#line 11203 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libgomp/ChangeLog -=================================================================== ---- a/src/libgomp/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libgomp/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,14 @@ -+2014-04-02 Richard Henderson <rth@redhat.com> -+ -+ * config/linux/futex.h (futex_wait): Get error value from errno. -+ (futex_wake): Likewise. -+ -+2013-12-12 Jakub Jelinek <jakub@redhat.com> -+ -+ PR libgomp/59467 -+ * testsuite/libgomp.fortran/crayptr2.f90: Add private (d) clause to -+ !$omp parallel. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libgomp/testsuite/libgomp.fortran/crayptr2.f90 -=================================================================== ---- a/src/libgomp/testsuite/libgomp.fortran/crayptr2.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/libgomp/testsuite/libgomp.fortran/crayptr2.f90 (.../branches/gcc-4_8-branch) -@@ -12,7 +12,7 @@ - b = 2 - c = 3 - l = .false. --!$omp parallel num_threads (3) reduction (.or.:l) -+!$omp parallel num_threads (3) reduction (.or.:l) private (d) - if (omp_get_thread_num () .eq. 0) then - ip = loc (a) - elseif (omp_get_thread_num () .eq. 1) then -Index: libgomp/config/linux/futex.h -=================================================================== ---- a/src/libgomp/config/linux/futex.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgomp/config/linux/futex.h (.../branches/gcc-4_8-branch) -@@ -41,8 +41,8 @@ - static inline void - futex_wait (int *addr, int val) - { -- long err = syscall (SYS_futex, addr, gomp_futex_wait, val, NULL); -- if (__builtin_expect (err == -ENOSYS, 0)) -+ int err = syscall (SYS_futex, addr, gomp_futex_wait, val, NULL); -+ if (__builtin_expect (err < 0 && errno == ENOSYS, 0)) - { - gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG; - gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG; -@@ -53,8 +53,8 @@ - static inline void - futex_wake (int *addr, int count) - { -- long err = syscall (SYS_futex, addr, gomp_futex_wake, count); -- if (__builtin_expect (err == -ENOSYS, 0)) -+ int err = syscall (SYS_futex, addr, gomp_futex_wake, count); -+ if (__builtin_expect (err < 0 && errno == ENOSYS, 0)) - { - gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG; - gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG; -Index: libquadmath/configure -=================================================================== ---- a/src/libquadmath/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libquadmath/configure (.../branches/gcc-4_8-branch) -@@ -6248,7 +6248,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6273,7 +6273,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6292,7 +6295,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10521,7 +10527,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10524 "configure" -+#line 10530 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10627,7 +10633,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10630 "configure" -+#line 10636 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libsanitizer/configure -=================================================================== ---- a/src/libsanitizer/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libsanitizer/configure (.../branches/gcc-4_8-branch) -@@ -6604,7 +6604,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6629,7 +6629,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6648,7 +6651,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11111,7 +11117,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11114 "configure" -+#line 11120 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11217,7 +11223,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11220 "configure" -+#line 11226 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libsanitizer/ChangeLog -=================================================================== ---- a/src/libsanitizer/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libsanitizer/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,10 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r208290 -+ 2014-03-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * configure.tgt: Unsupported for little endian PowerPC for now. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libsanitizer/configure.tgt -=================================================================== ---- a/src/libsanitizer/configure.tgt (.../tags/gcc_4_8_2_release) -+++ b/src/libsanitizer/configure.tgt (.../branches/gcc-4_8-branch) -@@ -25,6 +25,9 @@ - TSAN_SUPPORTED=yes - fi - ;; -+ powerpc*le-*-linux*) -+ UNSUPPORTED=1 -+ ;; - powerpc*-*-linux*) - ;; - sparc*-*-linux*) -Index: zlib/configure -=================================================================== ---- a/src/zlib/configure (.../tags/gcc_4_8_2_release) -+++ b/src/zlib/configure (.../branches/gcc-4_8-branch) -@@ -5853,7 +5853,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -5878,7 +5878,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -5897,7 +5900,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10394,7 +10400,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10397 "configure" -+#line 10403 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10500,7 +10506,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10503 "configure" -+#line 10509 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libstdc++-v3/configure -=================================================================== ---- a/src/libstdc++-v3/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/configure (.../branches/gcc-4_8-branch) -@@ -7111,7 +7111,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -7136,7 +7136,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -7155,7 +7158,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11513,7 +11519,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11516 "configure" -+#line 11522 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11619,7 +11625,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11622 "configure" -+#line 11628 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -15033,7 +15039,7 @@ - # - # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. - cat > conftest.$ac_ext << EOF --#line 15036 "configure" -+#line 15042 "configure" - struct S { ~S(); }; - void bar(); - void foo() -@@ -15383,7 +15389,7 @@ - # Fake what AC_TRY_COMPILE does. - - cat > conftest.$ac_ext << EOF --#line 15386 "configure" -+#line 15392 "configure" - int main() - { - typedef bool atomic_type; -@@ -15418,7 +15424,7 @@ - rm -f conftest* - - cat > conftest.$ac_ext << EOF --#line 15421 "configure" -+#line 15427 "configure" - int main() - { - typedef short atomic_type; -@@ -15453,7 +15459,7 @@ - rm -f conftest* - - cat > conftest.$ac_ext << EOF --#line 15456 "configure" -+#line 15462 "configure" - int main() - { - // NB: _Atomic_word not necessarily int. -@@ -15489,7 +15495,7 @@ - rm -f conftest* - - cat > conftest.$ac_ext << EOF --#line 15492 "configure" -+#line 15498 "configure" - int main() - { - typedef long long atomic_type; -@@ -15568,7 +15574,7 @@ - # unnecessary for this test. - - cat > conftest.$ac_ext << EOF --#line 15571 "configure" -+#line 15577 "configure" - int main() - { - _Decimal32 d1; -@@ -15610,7 +15616,7 @@ - # unnecessary for this test. - - cat > conftest.$ac_ext << EOF --#line 15613 "configure" -+#line 15619 "configure" - template<typename T1, typename T2> - struct same - { typedef T2 type; }; -@@ -15644,7 +15650,7 @@ - rm -f conftest* - - cat > conftest.$ac_ext << EOF --#line 15647 "configure" -+#line 15653 "configure" - template<typename T1, typename T2> - struct same - { typedef T2 type; }; -@@ -71573,7 +71579,7 @@ - fi - - # For libtool versioning info, format is CURRENT:REVISION:AGE --libtool_VERSION=6:18:0 -+libtool_VERSION=6:19:0 - - # Everything parsed; figure out what files and settings to use. - case $enable_symvers in -Index: libstdc++-v3/scripts/extract_symvers.in -=================================================================== ---- a/src/libstdc++-v3/scripts/extract_symvers.in (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/scripts/extract_symvers.in (.../branches/gcc-4_8-branch) -@@ -53,6 +53,7 @@ - # present on Solaris. - ${readelf} ${lib} |\ - sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\ -+ sed -e 's/ \[<localentry>: [0-9]*\] //' |\ - egrep -v ' (LOCAL|UND) ' |\ - egrep -v ' (_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\ - sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\ -Index: libstdc++-v3/src/c++11/thread.cc +Index: libstdc++-v3/scripts/run_doxygen +=================================================================== +--- a/src/libstdc++-v3/scripts/run_doxygen (.../tags/gcc_4_8_3_release) ++++ b/src/libstdc++-v3/scripts/run_doxygen (.../branches/gcc-4_8-branch) +@@ -193,8 +193,15 @@ + if $do_latex; then + cd ${outdir}/${mode} + +- # Also drop in the header file and style sheet +- doxygen -w latex header.tex doxygen.sty ++ # Grrr, Doxygen 1.8.x changed the -w latex options. ++ need_footer=`doxygen -h | sed -n -e '/-w latex/s=.*footer.*=true=p'` ++ ++ # Also drop in the header file (maybe footer file) and style sheet ++ if $need_footer; then ++ doxygen -w latex header.tex footer.tex doxygen.sty ++ else ++ doxygen -w latex header.tex doxygen.sty ++ fi + + echo :: + echo :: LaTeX pages begin with +Index: libstdc++-v3/include/std/future =================================================================== ---- a/src/libstdc++-v3/src/c++11/thread.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/src/c++11/thread.cc (.../branches/gcc-4_8-branch) -@@ -183,7 +183,7 @@ - ::usleep(__us); +--- a/src/libstdc++-v3/include/std/future (.../tags/gcc_4_8_3_release) ++++ b/src/libstdc++-v3/include/std/future (.../branches/gcc-4_8-branch) +@@ -351,12 +351,14 @@ + void + _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false) + { +- bool __set = __ignore_failure; ++ bool __set = false; + // all calls to this function are serialized, + // side-effects of invoking __res only happen once + call_once(_M_once, &_State_base::_M_do_set, this, ref(__res), + ref(__set)); +- if (!__set) ++ if (__set) ++ _M_cond.notify_all(); ++ else if (!__ignore_failure) + __throw_future_error(int(future_errc::promise_already_satisfied)); } - # else -- ::sleep(__s.count() + (__ns >= 1000000)); -+ ::sleep(__s.count() + (__ns.count() >= 1000000)); - # endif - #elif defined(_GLIBCXX_HAVE_WIN32_SLEEP) - unsigned long ms = __ns.count() / 1000000; -Index: libstdc++-v3/doc/xml/manual/abi.xml -=================================================================== ---- a/src/libstdc++-v3/doc/xml/manual/abi.xml (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/xml/manual/abi.xml (.../branches/gcc-4_8-branch) -@@ -203,6 +203,7 @@ - <listitem><para>GCC 4.5.0: GCC_4.5.0</para></listitem> - <listitem><para>GCC 4.6.0: GCC_4.6.0</para></listitem> - <listitem><para>GCC 4.7.0: GCC_4.7.0</para></listitem> -+ <listitem><para>GCC 4.8.0: GCC_4.8.0</para></listitem> - </itemizedlist> - </listitem> - -@@ -261,6 +262,7 @@ - <listitem><para>GCC 4.6.1: libstdc++.so.6.0.16</para></listitem> - <listitem><para>GCC 4.7.0: libstdc++.so.6.0.17</para></listitem> - <listitem><para>GCC 4.8.0: libstdc++.so.6.0.18</para></listitem> -+ <listitem><para>GCC 4.8.3: libstdc++.so.6.0.19</para></listitem> - </itemizedlist> - <para> - Note 1: Error should be libstdc++.so.3.0.3. -@@ -324,6 +326,7 @@ - <listitem><para>GCC 4.6.1: GLIBCXX_3.4.16, CXXABI_1.3.5</para></listitem> - <listitem><para>GCC 4.7.0: GLIBCXX_3.4.17, CXXABI_1.3.6</para></listitem> - <listitem><para>GCC 4.8.0: GLIBCXX_3.4.18, CXXABI_1.3.7</para></listitem> -+ <listitem><para>GCC 4.8.3: GLIBCXX_3.4.19, CXXABI_1.3.7</para></listitem> - </itemizedlist> - </listitem> - -Index: libstdc++-v3/doc/xml/manual/status_cxx2011.xml -=================================================================== ---- a/src/libstdc++-v3/doc/xml/manual/status_cxx2011.xml (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/xml/manual/status_cxx2011.xml (.../branches/gcc-4_8-branch) -@@ -877,10 +877,11 @@ - <entry/> - </row> - <row> -+ <?dbhtml bgcolor="#B0B0B0" ?> - <entry>20.9.7.6</entry> - <entry>Other transformations</entry> -- <entry>Y</entry> -- <entry/> -+ <entry>Partial</entry> -+ <entry>Missing <code>aligned_union</code>.</entry> - </row> - <row> - <entry>20.10</entry> -Index: libstdc++-v3/doc/xml/manual/spine.xml -=================================================================== ---- a/src/libstdc++-v3/doc/xml/manual/spine.xml (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/xml/manual/spine.xml (.../branches/gcc-4_8-branch) -@@ -20,6 +20,7 @@ - <year>2010</year> - <year>2011</year> - <year>2012</year> -+ <year>2013</year> - <holder> - <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.fsf.org">FSF</link> - </holder> -Index: libstdc++-v3/doc/html/bk02.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/bk02.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/bk02.html (.../branches/gcc-4_8-branch) -@@ -1,2 +1,2 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library" /><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility" /><link rel="next" href="api.html" title="The GNU C++ Library API Reference" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Backwards Compatibility </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> -\ No newline at end of file -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library" /><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility" /><link rel="next" href="api.html" title="The GNU C++ Library API Reference" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Backwards Compatibility </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/bk03.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/bk03.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/bk03.html (.../branches/gcc-4_8-branch) -@@ -1,2 +1,2 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library" /><link rel="prev" href="api.html" title="The GNU C++ Library API Reference" /><link rel="next" href="faq.html" title="Frequently Asked Questions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library API Reference </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> -\ No newline at end of file -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library" /><link rel="prev" href="api.html" title="The GNU C++ Library API Reference" /><link rel="next" href="faq.html" title="Frequently Asked Questions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library API Reference </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/faq.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/faq.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/faq.html (.../branches/gcc-4_8-branch) -@@ -1,9 +1,9 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Frequently Asked Questions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="bk03.html" title="" /><link rel="prev" href="bk03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Frequently Asked Questions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03.html">Prev</a> </td><th width="60%" align="center"></th><td width="20%" align="right"> </td></tr></table><hr /></div><div class="article"><div class="titlepage"><div><div><h1 class="title"><a id="faq"></a>Frequently Asked Questions</h1></div><div><p class="copyright">Copyright © -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Frequently Asked Questions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="bk03.html" title="" /><link rel="prev" href="bk03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Frequently Asked Questions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03.html">Prev</a> </td><th width="60%" align="center"></th><td width="20%" align="right"> </td></tr></table><hr /></div><div class="article"><div class="titlepage"><div><div><h1 class="title"><a id="faq"></a>Frequently Asked Questions</h1></div><div><p class="copyright">Copyright © - 2008, 2010 - - <a class="link" href="http://www.fsf.org" target="_top">FSF</a> -- </p></div></div><hr /></div><div class="qandaset"><a id="idp1581728"></a><dl><dt></dt><dd><dl><dt>1.1. <a href="faq.html#faq.what"> -+ </p></div></div><hr /></div><div class="qandaset"><a id="idm270011560848"></a><dl><dt></dt><dd><dl><dt>1.1. <a href="faq.html#faq.what"> - What is libstdc++? - </a></dt><dt>1.2. <a href="faq.html#faq.why"> - Why should I use libstdc++? -Index: libstdc++-v3/doc/html/index.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/index.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/index.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="description" content="Short Contents Copyright (C) 2008-2013 FSF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. This is the top level of the libstdc++ documentation set. The documentation is divided into the following three sections. Manual Frequently Asked Questions API and Source Documentation" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="next" href="manual/index.html" title="The GNU C++ Library Manual" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manual/index.html">Next</a></td></tr></table><hr /></div><div class="set" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="set-index"></a>The GNU C++ Library</h1></div><div><div class="abstract"><a id="contents"></a><p class="title"><strong>Short Contents</strong></p><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="description" content="Short Contents Copyright (C) 2008-2013 FSF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. This is the top level of the libstdc++ documentation set. The documentation is divided into the following three sections. Manual Frequently Asked Questions API and Source Documentation" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="next" href="manual/index.html" title="The GNU C++ Library Manual" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="manual/index.html">Next</a></td></tr></table><hr /></div><div class="set" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="set-index"></a>The GNU C++ Library</h1></div><div><div class="abstract"><a id="contents"></a><p class="title"><strong>Short Contents</strong></p><p> - Copyright (C) 2008-2013 - <a class="link" href="http://www.fsf.org/" target="_top">FSF - </a> -@@ -20,7 +20,7 @@ - </p></li><li class="listitem"><p> - <a class="link" href="api.html" title="The GNU C++ Library API Reference">API and Source Documentation</a> - </p></li></ul></div><p> -- </p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="book"><a href="manual/index.html">The GNU C++ Library Manual</a></span></dt><dd><dl><dt><span class="part"><a href="manual/intro.html">I. -+ </p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="book"><a href="manual/index.html">The GNU C++ Library Manual</a></span></dt><dd><dl><dt><span class="part"><a href="manual/intro.html">I. - Introduction - - </a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="manual/status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="manual/license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="manual/bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="manual/setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/configure.html">Configure</a></span></dt><dt><span class="section"><a href="manual/make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="manual/using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="manual/debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/std_contents.html">II. -@@ -34,13 +34,13 @@ - </a></span></dt><dd><dl><dt><span class="section"><a href="manual/diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="manual/diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="section"><a href="manual/diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="section"><a href="manual/concept_checking.html">Concept Checking</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/utilities.html">6. - Utilities - --</a></span></dt><dd><dl><dt><span class="section"><a href="manual/utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="manual/pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="manual/memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idp13920976">Interface Design</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp13924528">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp13937824">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="manual/memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="manual/memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idp15512272">Class Hierarchy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp15534784">Thread Safety</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp15542080">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp15556704">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idp15573056">Examples</a></span></dt><dt><span class="section"><a href="manual/memory.html#idp15576640">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/strings.html">7. -+</a></span></dt><dd><dl><dt><span class="section"><a href="manual/utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="manual/pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="manual/memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idm270001611968">Interface Design</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm270001608416">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm270001595120">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="manual/memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="manual/memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="manual/memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idm270000019344">Class Hierarchy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm269999996832">Thread Safety</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm269999989536">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm269999974912">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="manual/memory.html#idm269999958496">Examples</a></span></dt><dt><span class="section"><a href="manual/memory.html#idm269999954912">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="manual/memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/strings.html">7. - Strings - - </a></span></dt><dd><dl><dt><span class="section"><a href="manual/strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="section"><a href="manual/strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="section"><a href="manual/strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="section"><a href="manual/strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="section"><a href="manual/strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="section"><a href="manual/strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="section"><a href="manual/strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/localization.html">8. - Localization - --</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="manual/localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="manual/localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#idp15778336">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="manual/facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="manual/facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="manual/facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/containers.html">9. -+</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="manual/localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="manual/localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#idm269999753024">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="manual/facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="manual/facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="manual/facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="manual/facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="manual/facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="manual/facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/containers.html">9. - Containers - - </a></span></dt><dd><dl><dt><span class="section"><a href="manual/containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="section"><a href="manual/containers.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="section"><a href="manual/containers.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="section"><a href="manual/containers.html#containers.sequences.vector">vector</a></span></dt><dd><dl><dt><span class="section"><a href="manual/containers.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/associative.html">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="manual/associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="section"><a href="manual/associative.html#containers.associative.bitset">bitset</a></span></dt><dd><dl><dt><span class="section"><a href="manual/associative.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="section"><a href="manual/associative.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/unordered_associative.html">Unordered Associative</a></span></dt><dd><dl><dt><span class="section"><a href="manual/unordered_associative.html#containers.unordered.hash">Hash Code</a></span></dt><dd><dl><dt><span class="section"><a href="manual/unordered_associative.html#containers.unordered.cache">Hash Code Caching Policy</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="manual/containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/iterators.html">10. -Index: libstdc++-v3/doc/html/api.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/api.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/api.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library API Reference</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="bk02.html" title="" /><link rel="prev" href="bk02.html" title="" /><link rel="next" href="bk03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library API Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk02.html">Prev</a> </td><th width="60%" align="center"></th><td width="20%" align="right"> <a accesskey="n" href="bk03.html">Next</a></td></tr></table><hr /></div><div class="article"><div class="titlepage"><div><div><h1 class="title"><a id="api"></a>The GNU C++ Library API Reference</h1></div><div><p class="copyright">Copyright © -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library API Reference</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="index.html" title="The GNU C++ Library" /><link rel="up" href="bk02.html" title="" /><link rel="prev" href="bk02.html" title="" /><link rel="next" href="bk03.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library API Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk02.html">Prev</a> </td><th width="60%" align="center"></th><td width="20%" align="right"> <a accesskey="n" href="bk03.html">Next</a></td></tr></table><hr /></div><div class="article"><div class="titlepage"><div><div><h1 class="title"><a id="api"></a>The GNU C++ Library API Reference</h1></div><div><p class="copyright">Copyright © - 2008 - , - 2010 -@@ -6,7 +6,7 @@ - - <a class="link" href="http://www.fsf.org/" target="_top">FSF - </a> -- </p></div><div><div class="legalnotice"><a id="idp3706336"></a><p> -+ </p></div><div><div class="legalnotice"><a id="idm270006235696"></a><p> - <a class="link" href="manual/license.html" title="License">License - </a> - </p></div></div></div><hr /></div><p> -Index: libstdc++-v3/doc/html/manual/dynamic_memory.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/dynamic_memory.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/dynamic_memory.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Dynamic Memory</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="support.html" title="Chapter 4. Support" /><link rel="prev" href="support.html" title="Chapter 4. Support" /><link rel="next" href="termination.html" title="Termination" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Dynamic Memory</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="support.html">Prev</a> </td><th width="60%" align="center">Chapter 4. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Dynamic Memory</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="support.html" title="Chapter 4. Support" /><link rel="prev" href="support.html" title="Chapter 4. Support" /><link rel="next" href="termination.html" title="Termination" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Dynamic Memory</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="support.html">Prev</a> </td><th width="60%" align="center">Chapter 4. - Support - - </th><td width="20%" align="right"> <a accesskey="n" href="termination.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.support.memory"></a>Dynamic Memory</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/iterators.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/iterators.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/iterators.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 10. Iterators</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="containers_and_c.html" title="Interacting with C" /><link rel="next" href="algorithms.html" title="Chapter 11. Algorithms" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 10. Iterators</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="containers_and_c.html" title="Interacting with C" /><link rel="next" href="algorithms.html" title="Chapter 11. Algorithms" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. - Iterators - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="containers_and_c.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="algorithms.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.iterators"></a>Chapter 10. - Iterators -- <a id="idp16156992" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="iterators.html#std.iterators.predefined">Predefined</a></span></dt><dd><dl><dt><span class="section"><a href="iterators.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="section"><a href="iterators.html#iterators.predefined.end">One Past the End</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.iterators.predefined"></a>Predefined</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="iterators.predefined.vs_pointers"></a>Iterators vs. Pointers</h3></div></div></div><p> -+ <a id="idm269999374096" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="iterators.html#std.iterators.predefined">Predefined</a></span></dt><dd><dl><dt><span class="section"><a href="iterators.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="section"><a href="iterators.html#iterators.predefined.end">One Past the End</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.iterators.predefined"></a>Predefined</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="iterators.predefined.vs_pointers"></a>Iterators vs. Pointers</h3></div></div></div><p> - The following - FAQ <a class="link" href="../faq.html#faq.iterator_as_pod" title="7.1.">entry</a> points out that - iterators are not implemented as pointers. They are a generalization -Index: libstdc++-v3/doc/html/manual/mt_allocator_ex_single.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/mt_allocator_ex_single.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/mt_allocator_ex_single.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Single Thread Example</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_impl.html" title="Implementation" /><link rel="next" href="mt_allocator_ex_multi.html" title="Multiple Thread Example" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Single Thread Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_ex_multi.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.example_single"></a>Single Thread Example</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Single Thread Example</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_impl.html" title="Implementation" /><link rel="next" href="mt_allocator_ex_multi.html" title="Multiple Thread Example" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Single Thread Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_ex_multi.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.example_single"></a>Single Thread Example</h2></div></div></div><p> - Let's start by describing how the data on a freelist is laid out in memory. - This is the first two blocks in freelist for thread id 3 in bin 3 (8 bytes): - </p><pre class="programlisting"> -Index: libstdc++-v3/doc/html/manual/generalized_numeric_operations.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Generalized Operations</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="numerics.html" title="Chapter 12. Numerics" /><link rel="prev" href="numerics.html" title="Chapter 12. Numerics" /><link rel="next" href="numerics_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Generalized Operations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="numerics.html">Prev</a> </td><th width="60%" align="center">Chapter 12. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Generalized Operations</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="numerics.html" title="Chapter 12. Numerics" /><link rel="prev" href="numerics.html" title="Chapter 12. Numerics" /><link rel="next" href="numerics_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Generalized Operations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="numerics.html">Prev</a> </td><th width="60%" align="center">Chapter 12. - Numerics - - </th><td width="20%" align="right"> <a accesskey="n" href="numerics_and_c.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.numerics.generalized_ops"></a>Generalized Operations</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/mt_allocator.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/mt_allocator.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/mt_allocator.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 20. The mt_allocator</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="profile_mode_diagnostics.html" title="Diagnostics" /><link rel="next" href="mt_allocator_design.html" title="Design Issues" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 20. The mt_allocator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_diagnostics.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 20. The mt_allocator</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="profile_mode_diagnostics.html" title="Diagnostics" /><link rel="next" href="mt_allocator_design.html" title="Design Issues" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 20. The mt_allocator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_diagnostics.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_design.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.allocator.mt"></a>Chapter 20. The mt_allocator</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="mt_allocator.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="section"><a href="mt_allocator_design.html">Design Issues</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_design.html#allocator.mt.overview">Overview</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.tune">Tunable Parameters</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.init">Initialization</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.deallocation">Deallocation Notes</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_ex_single.html">Single Thread Example</a></span></dt><dt><span class="section"><a href="mt_allocator_ex_multi.html">Multiple Thread Example</a></span></dt></dl></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_design.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.allocator.mt"></a>Chapter 20. The mt_allocator</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="mt_allocator.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="section"><a href="mt_allocator_design.html">Design Issues</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_design.html#allocator.mt.overview">Overview</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.tune">Tunable Parameters</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.init">Initialization</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.deallocation">Deallocation Notes</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_ex_single.html">Single Thread Example</a></span></dt><dt><span class="section"><a href="mt_allocator_ex_multi.html">Multiple Thread Example</a></span></dt></dl></div><p> - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.intro"></a>Intro</h2></div></div></div><p> - The mt allocator [hereinafter referred to simply as "the allocator"] - is a fixed size (power of two) allocator that was initially -Index: libstdc++-v3/doc/html/manual/unordered_associative.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/unordered_associative.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/unordered_associative.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Unordered Associative</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="associative.html" title="Associative" /><link rel="next" href="containers_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Unordered Associative</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="associative.html">Prev</a> </td><th width="60%" align="center">Chapter 9. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Unordered Associative</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="associative.html" title="Associative" /><link rel="next" href="containers_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Unordered Associative</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="associative.html">Prev</a> </td><th width="60%" align="center">Chapter 9. - Containers - - </th><td width="20%" align="right"> <a accesskey="n" href="containers_and_c.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.unordered"></a>Unordered Associative</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="containers.unordered.hash"></a>Hash Code</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="containers.unordered.cache"></a>Hash Code Caching Policy</h4></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/configure.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/configure.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/configure.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Configure</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, configure, options" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="setup.html" title="Chapter 2. Setup" /><link rel="prev" href="setup.html" title="Chapter 2. Setup" /><link rel="next" href="make.html" title="Make" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Configure</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="setup.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Setup</th><td width="20%" align="right"> <a accesskey="n" href="make.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.configure"></a>Configure</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Configure</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, configure, options" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="setup.html" title="Chapter 2. Setup" /><link rel="prev" href="setup.html" title="Chapter 2. Setup" /><link rel="next" href="make.html" title="Make" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Configure</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="setup.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Setup</th><td width="20%" align="right"> <a accesskey="n" href="make.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.configure"></a>Configure</h2></div></div></div><p> - When configuring libstdc++, you'll have to configure the entire - <span class="emphasis"><em>gccsrcdir</em></span> directory. Consider using the - toplevel gcc configuration option -Index: libstdc++-v3/doc/html/manual/status.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/status.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/status.html (.../branches/gcc-4_8-branch) -@@ -1,13 +1,13 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 1. Status</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="intro.html" title="Part I. Introduction" /><link rel="next" href="license.html" title="License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Status</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><th width="60%" align="center">Part I. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 1. Status</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="intro.html" title="Part I. Introduction" /><link rel="next" href="license.html" title="License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Status</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><th width="60%" align="center">Part I. - Introduction - --</th><td width="20%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.status"></a>Chapter 1. Status</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.iso"></a>Implementation Status</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.1998"></a>C++ 1998/2003</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="iso.1998.status"></a>Implementation Status</h4></div></div></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.status"></a>Chapter 1. Status</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.iso"></a>Implementation Status</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.1998"></a>C++ 1998/2003</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="iso.1998.status"></a>Implementation Status</h4></div></div></div><p> - This status table is based on the table of contents of ISO/IEC 14882:2003. - </p><p> - This page describes the C++ support in mainline GCC SVN, not in any - particular release. --</p><div class="table"><a id="idp452240"></a><p class="title"><strong>Table 1.1. C++ 1998/2003 Implementation Status</strong></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> -+</p><div class="table"><a id="idm270008034928"></a><p class="title"><strong>Table 1.1. C++ 1998/2003 Implementation Status</strong></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> - <span class="emphasis"><em>18</em></span> - </td><td colspan="3" align="left"> - <span class="emphasis"><em>Language support</em></span> -@@ -157,7 +157,7 @@ - </p><p> - This page describes the C++11 support in mainline GCC SVN, not in any - particular release. --</p><div class="table"><a id="idp8670848"></a><p class="title"><strong>Table 1.2. C++ 2011 Implementation Status</strong></p><div class="table-contents"><table summary="C++ 2011 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> -+</p><div class="table"><a id="idm270007982624"></a><p class="title"><strong>Table 1.2. C++ 2011 Implementation Status</strong></p><div class="table-contents"><table summary="C++ 2011 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> - <span class="emphasis"><em>18</em></span> - </td><td colspan="3" align="left"> - <span class="emphasis"><em>Language support</em></span> -@@ -183,7 +183,7 @@ - is_trivially_copy_constructible, is_trivially_move_constructible, - is_trivially_assignable, is_trivially_default_assignable, - is_trivially_copy_assignable, is_trivially_move_assignable -- </td></tr><tr><td align="left">20.9.5</td><td align="left">Type property queries</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.6</td><td align="left">Relationships between types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7</td><td align="left">Transformations between types</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.9.7.1</td><td align="left">Const-volatile modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.2</td><td align="left">Reference modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.3</td><td align="left">Sign modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.4</td><td align="left">Array modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.5</td><td align="left">Pointer modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.6</td><td align="left">Other transformations</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10</td><td align="left">Compile-time rational arithmetic</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.2</td><td align="left">Header <code class="code"><ratio></code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.3</td><td align="left">Class template <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.4</td><td align="left">Arithmetic on <code class="code">ratio</code>s</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.5</td><td align="left">Comparison of <code class="code">ratio</code>s</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.6</td><td align="left">SI types for <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11</td><td align="left">Time utilities</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.3</td><td align="left">Clock requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4</td><td align="left">Time-related traits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.4.1</td><td align="left"><code class="code">treat_as_floating_point</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4.2</td><td align="left"><code class="code">duration_values</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4.3</td><td align="left">Specializations of <code class="code">common_type</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.11.5</td><td align="left">Class template <code class="code">duration</code></td><td align="left">Partial</td><td align="left">Missing constexpr for non-member arithmetic operations</td></tr><tr><td align="left">20.11.6</td><td align="left">Class template <code class="code">time_point</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7</td><td align="left">Clocks</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.7.1</td><td align="left">Class <code class="code">system_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7.2</td><td align="left">Class <code class="code">steady_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7.3</td><td align="left">Class <code class="code">high_resolution_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.8</td><td align="left">Date and time functions</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.12</td><td align="left">Scoped allocator adaptor</td><td align="left">Partial</td><td align="left"> </td></tr><tr><td align="left">20.12.1</td><td align="left">Header <code class="code"><scoped_allocator></code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.12.2</td><td align="left">Scoped allocator adaptor member types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.12.3</td><td align="left">Scoped allocator adaptor constructors</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.12.4</td><td align="left">Scoped allocator adaptor members</td><td align="left">Partial</td><td align="left">OUTERMOST is not recursive.</td></tr><tr><td align="left">20.12.5</td><td align="left">Scoped allocator operators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.13</td><td align="left">Class <code class="code">type_index</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left"> -+ </td></tr><tr><td align="left">20.9.5</td><td align="left">Type property queries</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.6</td><td align="left">Relationships between types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7</td><td align="left">Transformations between types</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.9.7.1</td><td align="left">Const-volatile modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.2</td><td align="left">Reference modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.3</td><td align="left">Sign modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.4</td><td align="left">Array modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.9.7.5</td><td align="left">Pointer modifications</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.9.7.6</td><td align="left">Other transformations</td><td align="left">Partial</td><td align="left">Missing <code class="code">aligned_union</code>.</td></tr><tr><td align="left">20.10</td><td align="left">Compile-time rational arithmetic</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.1</td><td align="left">In general</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.2</td><td align="left">Header <code class="code"><ratio></code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.10.3</td><td align="left">Class template <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.4</td><td align="left">Arithmetic on <code class="code">ratio</code>s</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.5</td><td align="left">Comparison of <code class="code">ratio</code>s</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.10.6</td><td align="left">SI types for <code class="code">ratio</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11</td><td align="left">Time utilities</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.3</td><td align="left">Clock requirements</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4</td><td align="left">Time-related traits</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.4.1</td><td align="left"><code class="code">treat_as_floating_point</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4.2</td><td align="left"><code class="code">duration_values</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.4.3</td><td align="left">Specializations of <code class="code">common_type</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.11.5</td><td align="left">Class template <code class="code">duration</code></td><td align="left">Partial</td><td align="left">Missing constexpr for non-member arithmetic operations</td></tr><tr><td align="left">20.11.6</td><td align="left">Class template <code class="code">time_point</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7</td><td align="left">Clocks</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.11.7.1</td><td align="left">Class <code class="code">system_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7.2</td><td align="left">Class <code class="code">steady_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.7.3</td><td align="left">Class <code class="code">high_resolution_clock</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.11.8</td><td align="left">Date and time functions</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.12</td><td align="left">Scoped allocator adaptor</td><td align="left">Partial</td><td align="left"> </td></tr><tr><td align="left">20.12.1</td><td align="left">Header <code class="code"><scoped_allocator></code> synopsis</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">20.12.2</td><td align="left">Scoped allocator adaptor member types</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.12.3</td><td align="left">Scoped allocator adaptor constructors</td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">20.12.4</td><td align="left">Scoped allocator adaptor members</td><td align="left">Partial</td><td align="left">OUTERMOST is not recursive.</td></tr><tr><td align="left">20.12.5</td><td align="left">Scoped allocator operators</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">20.13</td><td align="left">Class <code class="code">type_index</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left"> - <span class="emphasis"><em>21</em></span> - </td><td colspan="3" align="left"> - <span class="emphasis"><em>Strings</em></span> -@@ -302,7 +302,7 @@ - </p><p> - This page describes the TR1 support in mainline GCC SVN, not in any particular - release. --</p><div class="table"><a id="idp7483200"></a><p class="title"><strong>Table 1.3. C++ TR1 Implementation Status</strong></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left"> -+</p><div class="table"><a id="idm270006687472"></a><p class="title"><strong>Table 1.3. C++ TR1 Implementation Status</strong></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code"><functional></code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code"><memory></code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left"> - <p> - Uses code from - <a class="link" href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top">boost::shared_ptr</a>. -@@ -323,7 +323,7 @@ - </p><p> - This page describes the TR 24733 support in mainline GCC SVN, not in any - particular release. --</p><div class="table"><a id="idp12559072"></a><p class="title"><strong>Table 1.4. C++ TR 24733 Implementation Status</strong></p><div class="table-contents"><table summary="C++ TR 24733 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> -+</p><div class="table"><a id="idm270002960368"></a><p class="title"><strong>Table 1.4. C++ TR 24733 Implementation Status</strong></p><div class="table-contents"><table summary="C++ TR 24733 Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"> - <span class="emphasis"><em>0</em></span> - </td><td colspan="3" align="left"> - <span class="emphasis"><em>Introduction</em></span> -Index: libstdc++-v3/doc/html/manual/profile_mode_devel.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_devel.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_devel.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Developer Information</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_impl.html" title="Implementation Issues" /><link rel="next" href="profile_mode_diagnostics.html" title="Diagnostics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Developer Information</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_diagnostics.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.developer"></a>Developer Information</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.developer.bigpic"></a>Big Picture</h3></div></div></div><p>The profile mode headers are included with -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Developer Information</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_impl.html" title="Implementation Issues" /><link rel="next" href="profile_mode_diagnostics.html" title="Diagnostics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Developer Information</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_diagnostics.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.developer"></a>Developer Information</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.developer.bigpic"></a>Big Picture</h3></div></div></div><p>The profile mode headers are included with - <code class="code">-D_GLIBCXX_PROFILE</code> through preprocessor directives in - <code class="code">include/std/*</code>. - </p><p>Instrumented implementations are provided in -Index: libstdc++-v3/doc/html/manual/debug_mode_design.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/debug_mode_design.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/debug_mode_design.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode_using.html" title="Using" /><link rel="next" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_using.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.design"></a>Design</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode_using.html" title="Using" /><link rel="next" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_using.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.design"></a>Design</h2></div></div></div><p> - </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="debug_mode.design.goals"></a>Goals</h3></div></div></div><p> - </p><p> The libstdc++ debug mode replaces unsafe (but efficient) standard - containers and iterators with semantically equivalent safe standard -@@ -391,7 +391,7 @@ - </p><p> There are several existing implementations of debug modes for C++ - standard library implementations, although none of them directly - supports debugging for programs using libstdc++. The existing -- implementations include:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="http://www.mathcs.sjsu.edu/faculty/horstman/safestl.html" target="_top">SafeSTL</a>: -+ implementations include:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a class="link" href="http://www.cs.sjsu.edu/faculty/horstman/safestl.html" target="_top">SafeSTL</a>: - SafeSTL was the original debugging version of the Standard Template - Library (STL), implemented by Cay S. Horstmann on top of the - Hewlett-Packard STL. Though it inspired much work in this area, it -Index: libstdc++-v3/doc/html/manual/policy_data_structures_design.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/policy_data_structures_design.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/policy_data_structures_design.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures_using.html" title="Using" /><link rel="next" href="policy_based_data_structures_test.html" title="Testing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_using.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_based_data_structures_test.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="containers.pbds.design"></a>Design</h2></div></div></div><p></p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.design.concepts"></a>Concepts</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="pbds.design.concepts.null_type"></a>Null Policy Classes</h4></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures_using.html" title="Using" /><link rel="next" href="policy_based_data_structures_test.html" title="Testing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_using.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_based_data_structures_test.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="containers.pbds.design"></a>Design</h2></div></div></div><p></p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.design.concepts"></a>Concepts</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="pbds.design.concepts.null_type"></a>Null Policy Classes</h4></div></div></div><p> - Associative containers are typically parametrized by various - policies. For example, a hash-based associative container is - parametrized by a hash-functor, transforming each key into an -@@ -170,7 +170,7 @@ - naturally; collision-chaining hash tables (label B) store - equivalent-key values in the same bucket, the bucket can be - arranged so that equivalent-key values are consecutive. -- </p><div class="figure"><a id="idp18000448"></a><p class="title"><strong>Figure 22.8. Non-unique Mapping Standard Containers</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_embedded_lists_1.png" align="middle" alt="Non-unique Mapping Standard Containers" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997530416"></a><p class="title"><strong>Figure 22.8. Non-unique Mapping Standard Containers</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_embedded_lists_1.png" align="middle" alt="Non-unique Mapping Standard Containers" /></div></div></div><br class="figure-break" /><p> - Put differently, the standards' non-unique mapping - associative-containers are associative containers that map - primary keys to linked lists that are embedded into the -@@ -252,7 +252,7 @@ - first graphic above. Labels A and B, respectively. Each shaded - box represents some size-type or secondary - associative-container. -- </p><div class="figure"><a id="idp18023952"></a><p class="title"><strong>Figure 22.10. Non-unique Mapping Containers</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_embedded_lists_3.png" align="middle" alt="Non-unique Mapping Containers" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997506912"></a><p class="title"><strong>Figure 22.10. Non-unique Mapping Containers</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_embedded_lists_3.png" align="middle" alt="Non-unique Mapping Containers" /></div></div></div><br class="figure-break" /><p> - In the first example above, then, one would use an associative - container mapping each user to an associative container which - maps each application id to a start time (see -@@ -305,7 +305,7 @@ - shows invariants for order-preserving containers: point-type - iterators are synonymous with range-type iterators. - Orthogonally, <span class="emphasis"><em>C</em></span>shows invariants for "set" -- containers: iterators are synonymous with const iterators.</p><div class="figure"><a id="idp18043824"></a><p class="title"><strong>Figure 22.11. Point Iterator Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterator_hierarchy.png" align="middle" alt="Point Iterator Hierarchy" /></div></div></div><br class="figure-break" /><p>Note that point-type iterators in self-organizing containers -+ containers: iterators are synonymous with const iterators.</p><div class="figure"><a id="idm269997487104"></a><p class="title"><strong>Figure 22.11. Point Iterator Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterator_hierarchy.png" align="middle" alt="Point Iterator Hierarchy" /></div></div></div><br class="figure-break" /><p>Note that point-type iterators in self-organizing containers - (hash-based associative containers) lack movement - operators, such as <code class="literal">operator++</code> - in fact, this - is the reason why this library differentiates from the standard C++ librarys -@@ -344,7 +344,7 @@ - to the question of whether point-type iterators and range-type - iterators are valid. The graphic below shows tags corresponding to - different types of invalidation guarantees. -- </p><div class="figure"><a id="idp18057168"></a><p class="title"><strong>Figure 22.12. Invalidation Guarantee Tags Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_invalidation_tag_hierarchy.png" align="middle" alt="Invalidation Guarantee Tags Hierarchy" /></div></div></div><br class="figure-break" /><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> -+ </p><div class="figure"><a id="idm269997473760"></a><p class="title"><strong>Figure 22.12. Invalidation Guarantee Tags Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_invalidation_tag_hierarchy.png" align="middle" alt="Invalidation Guarantee Tags Hierarchy" /></div></div></div><br class="figure-break" /><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> - <code class="classname">basic_invalidation_guarantee</code> - corresponds to a basic guarantee that a point-type iterator, - a found pointer, or a found reference, remains valid as long -@@ -428,7 +428,7 @@ - </p><p> - This library contains a container tag hierarchy corresponding to the - diagram below. -- </p><div class="figure"><a id="idp18087392"></a><p class="title"><strong>Figure 22.13. Container Tag Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_container_tag_hierarchy.png" align="middle" alt="Container Tag Hierarchy" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997443664"></a><p class="title"><strong>Figure 22.13. Container Tag Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_container_tag_hierarchy.png" align="middle" alt="Container Tag Hierarchy" /></div></div></div><br class="figure-break" /><p> - Given any container <span class="type">Cntnr</span>, the tag of - the underlying data structure can be found via <code class="literal">typename - Cntnr::container_category</code>. -@@ -487,7 +487,7 @@ - collision-chaining container, except for the following.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p><code class="classname">Comb_Probe_Fn</code> describes how to transform a probe - sequence into a sequence of positions within the table.</p></li><li class="listitem"><p><code class="classname">Probe_Fn</code> describes a probe sequence policy.</p></li></ol></div><p>Some of the default template values depend on the values of - other parameters, and are explained below.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="container.hash.details"></a>Details</h5></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.hash.details.hash_policies"></a>Hash Policies</h6></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="details.hash_policies.general"></a>General</h6></div></div></div><p>Following is an explanation of some functions which hashing -- involves. The graphic below illustrates the discussion.</p><div class="figure"><a id="idp18127536"></a><p class="title"><strong>Figure 22.14. Hash functions, ranged-hash functions, and -+ involves. The graphic below illustrates the discussion.</p><div class="figure"><a id="idm269997403584"></a><p class="title"><strong>Figure 22.14. Hash functions, ranged-hash functions, and - range-hashing functions</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_ranged_hash_range_hashing_fns.png" align="middle" alt="Hash functions, ranged-hash functions, and range-hashing functions" /></div></div></div><br class="figure-break" /><p>Let U be a domain (e.g., the integers, or the - strings of 3 characters). A hash-table algorithm needs to map - elements of U "uniformly" into the range [0,..., m - -@@ -504,7 +504,7 @@ - Z<sub>+</sub>,</p><p>which maps a non-negative hash value, and a non-negative - range upper-bound into a non-negative integral in the range - between 0 (inclusive) and the range upper bound (exclusive), -- i.e., for any r in Z<sub>+</sub>,</p><p>0 ≤ g(r, m) ≤ m - 1</p><p>The resulting ranged-hash function, is</p><div class="equation"><a id="idp18141344"></a><p class="title"><strong>Equation 22.1. Ranged Hash Function</strong></p><div class="equation-contents"><span class="mathphrase"> -+ i.e., for any r in Z<sub>+</sub>,</p><p>0 ≤ g(r, m) ≤ m - 1</p><p>The resulting ranged-hash function, is</p><div class="equation"><a id="idm269997389776"></a><p class="title"><strong>Equation 22.1. Ranged Hash Function</strong></p><div class="equation-contents"><span class="mathphrase"> - f(u , m) = g(h(u), m) - </span></div></div><br class="equation-break" /><p>From the above, it is obvious that given g and - h, f can always be composed (however the converse -@@ -524,7 +524,7 @@ - transforming the sequence of hash values into a sequence of - positions.</p></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="details.hash_policies.range"></a>Range Hashing</h6></div></div></div><p>Some common choices for range-hashing functions are the - division, multiplication, and middle-square methods (<a class="xref" href="policy_data_structures.html#biblio.knuth98sorting" title="The Art of Computer Programming - Sorting and Searching">[biblio.knuth98sorting]</a>), defined -- as</p><div class="equation"><a id="idp18147232"></a><p class="title"><strong>Equation 22.2. Range-Hashing, Division Method</strong></p><div class="equation-contents"><span class="mathphrase"> -+ as</p><div class="equation"><a id="idm269997383888"></a><p class="title"><strong>Equation 22.2. Range-Hashing, Division Method</strong></p><div class="equation-contents"><span class="mathphrase"> - g(r, m) = r mod m - </span></div></div><br class="equation-break" /><p>g(r, m) = ⌈ u/v ( a r mod v ) ⌉</p><p>and</p><p>g(r, m) = ⌈ u/v ( r<sup>2</sup> mod v ) ⌉</p><p>respectively, for some positive integrals u and - v (typically powers of 2), and some a. Each of -@@ -535,9 +535,9 @@ - implement using the low - level % (modulo) operation (for any m), or the - low level & (bit-mask) operation (for the case where -- m is a power of 2), i.e.,</p><div class="equation"><a id="idp18151744"></a><p class="title"><strong>Equation 22.3. Division via Prime Modulo</strong></p><div class="equation-contents"><span class="mathphrase"> -+ m is a power of 2), i.e.,</p><div class="equation"><a id="idm269997379376"></a><p class="title"><strong>Equation 22.3. Division via Prime Modulo</strong></p><div class="equation-contents"><span class="mathphrase"> - g(r, m) = r % m -- </span></div></div><br class="equation-break" /><p>and</p><div class="equation"><a id="idp18153568"></a><p class="title"><strong>Equation 22.4. Division via Bit Mask</strong></p><div class="equation-contents"><span class="mathphrase"> -+ </span></div></div><br class="equation-break" /><p>and</p><div class="equation"><a id="idm269997377552"></a><p class="title"><strong>Equation 22.4. Division via Bit Mask</strong></p><div class="equation-contents"><span class="mathphrase"> - g(r, m) = r & m - 1, (with m = - 2<sup>k</sup> for some k) - </span></div></div><br class="equation-break" /><p>respectively.</p><p>The % (modulo) implementation has the advantage that for -@@ -563,7 +563,7 @@ - s = [ s<sub>0</sub>,..., s<sub>t - 1</sub>] - </p><p>be a string of t characters, each of which is from - domain S. Consider the following ranged-hash -- function:</p><div class="equation"><a id="idp18163200"></a><p class="title"><strong>Equation 22.5. -+ function:</p><div class="equation"><a id="idm269997367984"></a><p class="title"><strong>Equation 22.5. - A Standard String Hash Function - </strong></p><div class="equation-contents"><span class="mathphrase"> - f<sub>1</sub>(s, m) = ∑ <sub>i = -@@ -575,7 +575,7 @@ - of a long DNA sequence (and so S = {'A', 'C', 'G', - 'T'}). In this case, scanning the entire string might be - prohibitively expensive. A possible alternative might be to use -- only the first k characters of the string, where</p><p>|S|<sup>k</sup> ≥ m ,</p><p>i.e., using the hash function</p><div class="equation"><a id="idp18169344"></a><p class="title"><strong>Equation 22.6. -+ only the first k characters of the string, where</p><p>|S|<sup>k</sup> ≥ m ,</p><p>i.e., using the hash function</p><div class="equation"><a id="idm269997361840"></a><p class="title"><strong>Equation 22.6. - Only k String DNA Hash - </strong></p><div class="equation-contents"><span class="mathphrase"> - f<sub>2</sub>(s, m) = ∑ <sub>i -@@ -606,12 +606,12 @@ - the container transforms the key into a non-negative integral - using the hash functor (points B and C), and transforms the - result into a position using the combining functor (points D -- and E).</p><div class="figure"><a id="idp18191968"></a><p class="title"><strong>Figure 22.15. Insert hash sequence diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_range_hashing_seq_diagram.png" align="middle" alt="Insert hash sequence diagram" /></div></div></div><br class="figure-break" /><p>If <code class="classname">cc_hash_table</code>'s -+ and E).</p><div class="figure"><a id="idm269997339216"></a><p class="title"><strong>Figure 22.15. Insert hash sequence diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_range_hashing_seq_diagram.png" align="middle" alt="Insert hash sequence diagram" /></div></div></div><br class="figure-break" /><p>If <code class="classname">cc_hash_table</code>'s - hash-functor, <code class="classname">Hash_Fn</code> is instantiated by <code class="classname">null_type</code> , then <code class="classname">Comb_Hash_Fn</code> is taken to be - a ranged-hash function. The graphic below shows an <code class="function">insert</code> sequence - diagram. The user inserts an element (point A), the container - transforms the key into a position using the combining functor -- (points B and C).</p><div class="figure"><a id="idp18199024"></a><p class="title"><strong>Figure 22.16. Insert hash sequence diagram with a null policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_range_hashing_seq_diagram2.png" align="middle" alt="Insert hash sequence diagram with a null policy" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="hash_policies.implementation.probe"></a> -+ (points B and C).</p><div class="figure"><a id="idm269997332160"></a><p class="title"><strong>Figure 22.16. Insert hash sequence diagram with a null policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_range_hashing_seq_diagram2.png" align="middle" alt="Insert hash sequence diagram with a null policy" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="hash_policies.implementation.probe"></a> - Probing tables - </h6></div></div></div><p><code class="classname">gp_hash_table</code> is parametrized by - <code class="classname">Hash_Fn</code>, <code class="classname">Probe_Fn</code>, -@@ -634,7 +634,7 @@ - a linear probe and a quadratic probe function, - respectively.</p></li></ol></div><p> - The graphic below shows the relationships. -- </p><div class="figure"><a id="idp18215840"></a><p class="title"><strong>Figure 22.17. Hash policy class diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_policy_cd.png" align="middle" alt="Hash policy class diagram" /></div></div></div><br class="figure-break" /></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.hash.details.resize_policies"></a>Resize Policies</h6></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="resize_policies.general"></a>General</h6></div></div></div><p>Hash-tables, as opposed to trees, do not naturally grow or -+ </p><div class="figure"><a id="idm269997315408"></a><p class="title"><strong>Figure 22.17. Hash policy class diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_hash_policy_cd.png" align="middle" alt="Hash policy class diagram" /></div></div></div><br class="figure-break" /></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.hash.details.resize_policies"></a>Resize Policies</h6></div></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="resize_policies.general"></a>General</h6></div></div></div><p>Hash-tables, as opposed to trees, do not naturally grow or - shrink. It is necessary to specify policies to determine how - and when a hash table should change its size. Usually, resize - policies can be decomposed into orthogonal policies:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>A size policy indicating how a hash table -@@ -667,10 +667,10 @@ - and some load factor be denoted by Α. We would like to - calculate the minimal length of k, such that if there were Α - m elements in the hash table, a probe sequence of length k would -- be found with probability at most 1/m.</p><div class="figure"><a id="idp18234944"></a><p class="title"><strong>Figure 22.18. Balls and bins</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_balls_and_bins.png" align="middle" alt="Balls and bins" /></div></div></div><br class="figure-break" /><p>Denote the probability that a probe sequence of length -+ be found with probability at most 1/m.</p><div class="figure"><a id="idm269997296368"></a><p class="title"><strong>Figure 22.18. Balls and bins</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_balls_and_bins.png" align="middle" alt="Balls and bins" /></div></div></div><br class="figure-break" /><p>Denote the probability that a probe sequence of length - k appears in bin i by p<sub>i</sub>, the - length of the probe sequence of bin i by -- l<sub>i</sub>, and assume uniform distribution. Then</p><div class="equation"><a id="idp18240448"></a><p class="title"><strong>Equation 22.7. -+ l<sub>i</sub>, and assume uniform distribution. Then</p><div class="equation"><a id="idm269997290864"></a><p class="title"><strong>Equation 22.7. - Probability of Probe Sequence of Length k - </strong></p><div class="equation-contents"><span class="mathphrase"> - p<sub>1</sub> = -@@ -684,7 +684,7 @@ - l<sub>i</sub> are negatively-dependent - (<a class="xref" href="policy_data_structures.html#biblio.dubhashi98neg" title="Balls and bins: A study in negative dependence">[biblio.dubhashi98neg]</a>) - . Let -- I(.) denote the indicator function. Then</p><div class="equation"><a id="idp18247216"></a><p class="title"><strong>Equation 22.8. -+ I(.) denote the indicator function. Then</p><div class="equation"><a id="idm269997284096"></a><p class="title"><strong>Equation 22.8. - Probability Probe Sequence in Some Bin - </strong></p><div class="equation-contents"><span class="mathphrase"> - P( exists<sub>i</sub> l<sub>i</sub> ≥ k ) = -@@ -723,7 +723,7 @@ - a resize is needed, and if so, what is the new size (points D - to G); following the resize, it notifies the policy that a - resize has completed (point H); finally, the element is -- inserted, and the policy notified (point I).</p><div class="figure"><a id="idp18265728"></a><p class="title"><strong>Figure 22.19. Insert resize sequence diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_insert_resize_sequence_diagram1.png" align="middle" alt="Insert resize sequence diagram" /></div></div></div><br class="figure-break" /><p>In practice, a resize policy can be usually orthogonally -+ inserted, and the policy notified (point I).</p><div class="figure"><a id="idm269997265648"></a><p class="title"><strong>Figure 22.19. Insert resize sequence diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_insert_resize_sequence_diagram1.png" align="middle" alt="Insert resize sequence diagram" /></div></div></div><br class="figure-break" /><p>In practice, a resize policy can be usually orthogonally - decomposed to a size policy and a trigger policy. Consequently, - the library contains a single class for instantiating a resize - policy: <code class="classname">hash_standard_resize_policy</code> -@@ -732,8 +732,8 @@ - both, and acts as a standard delegate (<a class="xref" href="policy_data_structures.html#biblio.gof" title="Design Patterns - Elements of Reusable Object-Oriented Software">[biblio.gof]</a>) - to these policies.</p><p>The two graphics immediately below show sequence diagrams - illustrating the interaction between the standard resize policy -- and its trigger and size policies, respectively.</p><div class="figure"><a id="idp18273504"></a><p class="title"><strong>Figure 22.20. Standard resize policy trigger sequence -- diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_insert_resize_sequence_diagram2.png" align="middle" alt="Standard resize policy trigger sequence diagram" /></div></div></div><br class="figure-break" /><div class="figure"><a id="idp18277664"></a><p class="title"><strong>Figure 22.21. Standard resize policy size sequence -+ and its trigger and size policies, respectively.</p><div class="figure"><a id="idm269997257872"></a><p class="title"><strong>Figure 22.20. Standard resize policy trigger sequence -+ diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_insert_resize_sequence_diagram2.png" align="middle" alt="Standard resize policy trigger sequence diagram" /></div></div></div><br class="figure-break" /><div class="figure"><a id="idm269997253712"></a><p class="title"><strong>Figure 22.21. Standard resize policy size sequence - diagram</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_insert_resize_sequence_diagram3.png" align="middle" alt="Standard resize policy size sequence diagram" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="resize_policies.impl.predefined"></a>Predefined Policies</h6></div></div></div><p>The library includes the following - instantiations of size and trigger policies:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p><code class="classname">hash_load_check_resize_trigger</code> - implements a load check trigger policy.</p></li><li class="listitem"><p><code class="classname">cc_hash_max_collision_check_resize_trigger</code> -@@ -876,7 +876,7 @@ - each node, and maintains node invariants (see <a class="xref" href="policy_data_structures.html#biblio.clrs2001" title="Introduction to Algorithms, 2nd edition">[biblio.clrs2001]</a>.) The first stores in - each node the size of the sub-tree rooted at the node; the - second stores at each node the maximal endpoint of the -- intervals at the sub-tree rooted at the node.</p><div class="figure"><a id="idp18355696"></a><p class="title"><strong>Figure 22.22. Tree node invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_invariants.png" align="middle" alt="Tree node invariants" /></div></div></div><br class="figure-break" /><p>Supporting such trees is difficult for a number of -+ intervals at the sub-tree rooted at the node.</p><div class="figure"><a id="idm269997175616"></a><p class="title"><strong>Figure 22.22. Tree node invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_invariants.png" align="middle" alt="Tree node invariants" /></div></div></div><br class="figure-break" /><p>Supporting such trees is difficult for a number of - reasons:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>There must be a way to specify what a node's metadata - should be (if any).</p></li><li class="listitem"><p>Various operations can invalidate node - invariants. The graphic below shows how a right rotation, -@@ -890,7 +890,7 @@ - metadata.</p></li><li class="listitem"><p>It is not feasible to know in advance which methods trees - can support. Besides the usual <code class="classname">find</code> method, the - first tree can support a <code class="classname">find_by_order</code> method, while -- the second can support an <code class="classname">overlaps</code> method.</p></li></ol></div><div class="figure"><a id="idp18365136"></a><p class="title"><strong>Figure 22.23. Tree node invalidation</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_invalidations.png" align="middle" alt="Tree node invalidation" /></div></div></div><br class="figure-break" /><p>These problems are solved by a combination of two means: -+ the second can support an <code class="classname">overlaps</code> method.</p></li></ol></div><div class="figure"><a id="idm269997166176"></a><p class="title"><strong>Figure 22.23. Tree node invalidation</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_invalidations.png" align="middle" alt="Tree node invalidation" /></div></div></div><br class="figure-break" /><p>These problems are solved by a combination of two means: - node iterators, and template-template node updater - parameters.</p><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.tree.node.iterators"></a>Node Iterators</h6></div></div></div><p>Each tree-based container defines two additional iterator - types, <code class="classname">const_node_iterator</code> -@@ -919,7 +919,7 @@ - <code class="classname">node_update</code> class, and publicly subclasses - <code class="classname">node_update</code>. The graphic below shows this - scheme, as well as some predefined policies (which are explained -- below).</p><div class="figure"><a id="idp18378304"></a><p class="title"><strong>Figure 22.24. A tree and its update policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_updator_policy_cd.png" align="middle" alt="A tree and its update policy" /></div></div></div><br class="figure-break" /><p><code class="classname">node_update</code> (an instantiation of -+ below).</p><div class="figure"><a id="idm269997153072"></a><p class="title"><strong>Figure 22.24. A tree and its update policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_tree_node_updator_policy_cd.png" align="middle" alt="A tree and its update policy" /></div></div></div><br class="figure-break" /><p><code class="classname">node_update</code> (an instantiation of - <code class="classname">Node_Update</code>) must define <code class="classname">metadata_type</code> as - the type of metadata it requires. For order statistics, - e.g., <code class="classname">metadata_type</code> might be <code class="classname">size_t</code>. -@@ -938,7 +938,7 @@ - <code class="classname">nd_it</code>. For example, say node x in the - graphic below label A has an invalid invariant, but its' children, - y and z have valid invariants. After the invocation, all three -- nodes should have valid invariants, as in label B.</p><div class="figure"><a id="idp18389968"></a><p class="title"><strong>Figure 22.25. Restoring node invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_restoring_node_invariants.png" align="middle" alt="Restoring node invariants" /></div></div></div><br class="figure-break" /><p>When a tree operation might invalidate some node invariant, -+ nodes should have valid invariants, as in label B.</p><div class="figure"><a id="idm269997141408"></a><p class="title"><strong>Figure 22.25. Restoring node invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_restoring_node_invariants.png" align="middle" alt="Restoring node invariants" /></div></div></div><br class="figure-break" /><p>When a tree operation might invalidate some node invariant, - it invokes this method in its <code class="classname">node_update</code> base to - restore the invariant. For example, the graphic below shows - an <code class="function">insert</code> operation (point A); the tree performs some -@@ -946,7 +946,7 @@ - C, and D). (It is well known that any <code class="function">insert</code>, - <code class="function">erase</code>, <code class="function">split</code> or <code class="function">join</code>, can restore - all node invariants by a small number of node invariant updates (<a class="xref" href="policy_data_structures.html#biblio.clrs2001" title="Introduction to Algorithms, 2nd edition">[biblio.clrs2001]</a>) -- .</p><div class="figure"><a id="idp18398144"></a><p class="title"><strong>Figure 22.26. Insert update sequence</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_update_seq_diagram.png" align="middle" alt="Insert update sequence" /></div></div></div><br class="figure-break" /><p>To complete the description of the scheme, three questions -+ .</p><div class="figure"><a id="idm269997133232"></a><p class="title"><strong>Figure 22.26. Insert update sequence</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_update_seq_diagram.png" align="middle" alt="Insert update sequence" /></div></div></div><br class="figure-break" /><p>To complete the description of the scheme, three questions - need to be answered:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>How can a tree which supports order statistics define a - method such as <code class="classname">find_by_order</code>?</p></li><li class="listitem"><p>How can the node updater base access methods of the - tree?</p></li><li class="listitem"><p>How can the following cyclic dependency be resolved? -@@ -988,7 +988,7 @@ - node's metadata (this is halting reducible). In the graphic - below, assume the shaded node is inserted. The tree would have - to traverse the useless path shown to the root, applying -- redundant updates all the way.</p></li></ol></div><div class="figure"><a id="idp18420400"></a><p class="title"><strong>Figure 22.27. Useless update path</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_rationale_null_node_updator.png" align="middle" alt="Useless update path" /></div></div></div><br class="figure-break" /><p>A null policy class, <code class="classname">null_node_update</code> -+ redundant updates all the way.</p></li></ol></div><div class="figure"><a id="idm269997110976"></a><p class="title"><strong>Figure 22.27. Useless update path</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_rationale_null_node_updator.png" align="middle" alt="Useless update path" /></div></div></div><br class="figure-break" /><p>A null policy class, <code class="classname">null_node_update</code> - solves both these problems. The tree detects that node - invariants are irrelevant, and defines all accordingly.</p></div></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.tree.details.split"></a>Split and Join</h6></div></div></div><p>Tree-based containers support split and join methods. - It is possible to split a tree so that it passes -@@ -1071,7 +1071,7 @@ - sub-tree with leafs "a" and "as". The maximal common prefix is - "a". The internal node contains, consequently, to const - iterators, one pointing to <code class="varname">'a'</code>, and the other to -- <code class="varname">'s'</code>.</p><div class="figure"><a id="idp18465088"></a><p class="title"><strong>Figure 22.28. A PATRICIA trie</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_pat_trie.png" align="middle" alt="A PATRICIA trie" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.trie.details.node"></a>Node Invariants</h6></div></div></div><p>Trie-based containers support node invariants, as do -+ <code class="varname">'s'</code>.</p><div class="figure"><a id="idm269997066288"></a><p class="title"><strong>Figure 22.28. A PATRICIA trie</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_pat_trie.png" align="middle" alt="A PATRICIA trie" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.trie.details.node"></a>Node Invariants</h6></div></div></div><p>Trie-based containers support node invariants, as do - tree-based containers. There are two minor - differences, though, which, unfortunately, thwart sharing them - sharing the same node-updating policies:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>A trie's <code class="classname">Node_Update</code> template-template -@@ -1080,7 +1080,7 @@ - parametrized by <code class="classname">Cmp_Fn</code>.</p></li><li class="listitem"><p>Tree-based containers store values in all nodes, while - trie-based containers (at least in this implementation) store - values in leafs.</p></li></ol></div><p>The graphic below shows the scheme, as well as some predefined -- policies (which are explained below).</p><div class="figure"><a id="idp18475584"></a><p class="title"><strong>Figure 22.29. A trie and its update policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_trie_node_updator_policy_cd.png" align="middle" alt="A trie and its update policy" /></div></div></div><br class="figure-break" /><p>This library offers the following pre-defined trie node -+ policies (which are explained below).</p><div class="figure"><a id="idm269997055856"></a><p class="title"><strong>Figure 22.29. A trie and its update policy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_trie_node_updator_policy_cd.png" align="middle" alt="A trie and its update policy" /></div></div></div><br class="figure-break" /><p>This library offers the following pre-defined trie node - updating policies:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p> - <code class="classname">trie_order_statistics_node_update</code> - supports order statistics. -@@ -1128,7 +1128,7 @@ - simple list of integer keys. If we search for the integer 6, we - are paying an overhead: the link with key 6 is only the fifth - link; if it were the first link, it could be accessed -- faster.</p><div class="figure"><a id="idp18506160"></a><p class="title"><strong>Figure 22.30. A simple list</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_simple_list.png" align="middle" alt="A simple list" /></div></div></div><br class="figure-break" /><p>List-update algorithms reorder lists as elements are -+ faster.</p><div class="figure"><a id="idm269997025344"></a><p class="title"><strong>Figure 22.30. A simple list</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_simple_list.png" align="middle" alt="A simple list" /></div></div></div><br class="figure-break" /><p>List-update algorithms reorder lists as elements are - accessed. They try to determine, by the access history, which - keys to move to the front of the list. Some of these algorithms - require adding some metadata alongside each entry.</p><p>For example, in the graphic below label A shows the counter -@@ -1138,7 +1138,7 @@ - predetermined value, say 10, as shown in label C, the count is set - to 0 and the node is moved to the front of the list, as in label - D. -- </p><div class="figure"><a id="idp18511744"></a><p class="title"><strong>Figure 22.31. The counter algorithm</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_list_update.png" align="middle" alt="The counter algorithm" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.list.details.policies"></a>Policies</h6></div></div></div><p>this library allows instantiating lists with policies -+ </p><div class="figure"><a id="idm269997019760"></a><p class="title"><strong>Figure 22.31. The counter algorithm</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_list_update.png" align="middle" alt="The counter algorithm" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h6 class="title"><a id="container.list.details.policies"></a>Policies</h6></div></div></div><p>this library allows instantiating lists with policies - implementing any algorithm moving nodes to the front of the - list (policies implementing algorithms interchanging nodes are - unsupported).</p><p>Associative containers based on lists are parametrized by a -@@ -1310,7 +1310,7 @@ - sequence; the second uses a tree (or forest of trees), which is - typically less structured than an associative container's tree; - the third simply uses an associative container. These are -- shown in the graphic below, in labels A1 and A2, label B, and label C.</p><div class="figure"><a id="idp18575568"></a><p class="title"><strong>Figure 22.32. Underlying Priority-Queue Data-Structures.</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_priority_queue_different_underlying_dss.png" align="middle" alt="Underlying Priority-Queue Data-Structures." /></div></div></div><br class="figure-break" /><p>Roughly speaking, any value that is both pushed and popped -+ shown in the graphic below, in labels A1 and A2, label B, and label C.</p><div class="figure"><a id="idm269996955920"></a><p class="title"><strong>Figure 22.32. Underlying Priority-Queue Data-Structures.</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_priority_queue_different_underlying_dss.png" align="middle" alt="Underlying Priority-Queue Data-Structures." /></div></div></div><br class="figure-break" /><p>Roughly speaking, any value that is both pushed and popped - from a priority queue must incur a logarithmic expense (in the - amortized sense). Any priority queue implementation that would - avoid this, would violate known bounds on comparison-based -@@ -1390,7 +1390,7 @@ - container <code class="classname">Cntnr</code>, the tag of the underlying - data structure can be found via <code class="classname">typename - Cntnr::container_category</code>; this is one of the possible tags shown in the graphic below. -- </p><div class="figure"><a id="idp18610544"></a><p class="title"><strong>Figure 22.33. Priority-Queue Data-Structure Tags.</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_priority_queue_tag_hierarchy.png" align="middle" alt="Priority-Queue Data-Structure Tags." /></div></div></div><br class="figure-break" /><p>Additionally, a traits mechanism can be used to query a -+ </p><div class="figure"><a id="idm269996920880"></a><p class="title"><strong>Figure 22.33. Priority-Queue Data-Structure Tags.</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_priority_queue_tag_hierarchy.png" align="middle" alt="Priority-Queue Data-Structure Tags." /></div></div></div><br class="figure-break" /><p>Additionally, a traits mechanism can be used to query a - container type for its attributes. Given any container - <code class="classname">Cntnr</code>, then </p><pre class="programlisting">__gnu_pbds::container_traits<Cntnr></pre><p> - is a traits class identifying the properties of the -Index: libstdc++-v3/doc/html/manual/using.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="make.html" title="Make" /><link rel="next" href="using_headers.html" title="Headers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="make.html">Prev</a> </td><th width="60%" align="center">Part I. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="make.html" title="Make" /><link rel="next" href="using_headers.html" title="Headers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="make.html">Prev</a> </td><th width="60%" align="center">Part I. - Introduction - --</th><td width="20%" align="right"> <a accesskey="n" href="using_headers.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.using"></a>Chapter 3. Using</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.flags"></a>Command Options</h2></div></div></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="using_headers.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.using"></a>Chapter 3. Using</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.flags"></a>Command Options</h2></div></div></div><p> - The set of features available in the GNU C++ library is shaped - by - several <a class="link" href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Invoking-GCC.html" target="_top">GCC -@@ -10,5 +10,5 @@ - enumerated and detailed in the table below. - </p><p> - By default, <span class="command"><strong>g++</strong></span> is equivalent to <span class="command"><strong>g++ -std=gnu++98</strong></span>. The standard library also defaults to this dialect. -- </p><div class="table"><a id="idp13051936"></a><p class="title"><strong>Table 3.1. C++ Command Options</strong></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code></td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++11</code></td><td align="left">Use the 2011 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++11</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++11 <thread>, <future>, -+ </p><div class="table"><a id="idm270002481088"></a><p class="title"><strong>Table 3.1. C++ Command Options</strong></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code></td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++11</code></td><td align="left">Use the 2011 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++11</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++11 <thread>, <future>, - <mutex>, or <condition_variable>.</td></tr><tr><td align="left"><code class="literal">-fopenmp</code></td><td align="left">For <a class="link" href="parallel_mode.html" title="Chapter 18. Parallel Mode">parallel</a> mode.</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="make.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="intro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="using_headers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Make </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Headers</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/manual/profile_mode_impl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_impl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_impl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation Issues</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_cost_model.html" title="Empirical Cost Model" /><link rel="next" href="profile_mode_devel.html" title="Developer Information" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation Issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_cost_model.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_devel.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.implementation"></a>Implementation Issues</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.implementation.stack"></a>Stack Traces</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation Issues</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_cost_model.html" title="Empirical Cost Model" /><link rel="next" href="profile_mode_devel.html" title="Developer Information" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation Issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_cost_model.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_devel.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.implementation"></a>Implementation Issues</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.implementation.stack"></a>Stack Traces</h3></div></div></div><p> - Accurate stack traces are needed during profiling since we group events by - call context and dynamic instance. Without accurate traces, diagnostics - may be hard to interpret. For instance, when giving advice to the user -Index: libstdc++-v3/doc/html/manual/ext_containers.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_containers.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_containers.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 23. HP/SGI Extensions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="policy_data_structures_ack.html" title="Acknowledgments" /><link rel="next" href="ext_sgi.html" title="Deprecated" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 23. HP/SGI Extensions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_ack.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 23. HP/SGI Extensions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="policy_data_structures_ack.html" title="Acknowledgments" /><link rel="next" href="ext_sgi.html" title="Deprecated" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 23. HP/SGI Extensions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_ack.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="ext_sgi.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.containers"></a>Chapter 23. HP/SGI Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="ext_containers.html#manual.ext.containers.sgi">Backwards Compatibility</a></span></dt><dt><span class="section"><a href="ext_sgi.html">Deprecated</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.containers.sgi"></a>Backwards Compatibility</h2></div></div></div><p>A few extensions and nods to backwards-compatibility have -+</th><td width="20%" align="right"> <a accesskey="n" href="ext_sgi.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.containers"></a>Chapter 23. HP/SGI Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="ext_containers.html#manual.ext.containers.sgi">Backwards Compatibility</a></span></dt><dt><span class="section"><a href="ext_sgi.html">Deprecated</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.containers.sgi"></a>Backwards Compatibility</h2></div></div></div><p>A few extensions and nods to backwards-compatibility have - been made with containers. Those dealing with older SGI-style - allocators are dealt with elsewhere. The remaining ones all deal - with bits: -Index: libstdc++-v3/doc/html/manual/ext_concurrency_use.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_concurrency_use.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_concurrency_use.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Use</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="prev" href="ext_concurrency_impl.html" title="Implementation" /><link rel="next" href="appendix.html" title="Part IV. Appendices" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Use</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_concurrency_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 30. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="appendix.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.use"></a>Use</h2></div></div></div><p>Typical usage of the last two constructs is demonstrated as follows: -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Use</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="prev" href="ext_concurrency_impl.html" title="Implementation" /><link rel="next" href="appendix.html" title="Part IV. Appendices" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Use</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_concurrency_impl.html">Prev</a> </td><th width="60%" align="center">Chapter 30. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="appendix.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.use"></a>Use</h2></div></div></div><p>Typical usage of the last two constructs is demonstrated as follows: - </p><pre class="programlisting"> - #include <ext/concurrence.h> - -Index: libstdc++-v3/doc/html/manual/ext_io.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_io.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_io.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 28. Input and Output</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_iterators.html" title="Chapter 27. Iterators" /><link rel="next" href="ext_demangling.html" title="Chapter 29. Demangling" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 28. Input and Output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 28. Input and Output</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_iterators.html" title="Chapter 27. Iterators" /><link rel="next" href="ext_demangling.html" title="Chapter 29. Demangling" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 28. Input and Output</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_iterators.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.io"></a>Chapter 28. Input and Output</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="ext_demangling.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.io"></a>Chapter 28. Input and Output</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></div><p> - Extensions allowing <code class="code">filebuf</code>s to be constructed from - "C" types like FILE*s and file descriptors. - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.io.filebuf_derived"></a>Derived filebufs</h2></div></div></div><p>The v2 library included non-standard extensions to construct -Index: libstdc++-v3/doc/html/manual/termination.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/termination.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/termination.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Termination</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="support.html" title="Chapter 4. Support" /><link rel="prev" href="dynamic_memory.html" title="Dynamic Memory" /><link rel="next" href="diagnostics.html" title="Chapter 5. Diagnostics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Termination</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dynamic_memory.html">Prev</a> </td><th width="60%" align="center">Chapter 4. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Termination</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="support.html" title="Chapter 4. Support" /><link rel="prev" href="dynamic_memory.html" title="Dynamic Memory" /><link rel="next" href="diagnostics.html" title="Chapter 5. Diagnostics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Termination</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dynamic_memory.html">Prev</a> </td><th width="60%" align="center">Chapter 4. - Support - - </th><td width="20%" align="right"> <a accesskey="n" href="diagnostics.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.support.termination"></a>Termination</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="support.termination.handlers"></a>Termination Handlers</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/using_macros.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_macros.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_macros.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Macros</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_headers.html" title="Headers" /><link rel="next" href="using_namespaces.html" title="Namespaces" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Macros</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_headers.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_namespaces.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.macros"></a>Macros</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Macros</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_headers.html" title="Headers" /><link rel="next" href="using_namespaces.html" title="Namespaces" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Macros</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_headers.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_namespaces.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.macros"></a>Macros</h2></div></div></div><p> - All library macros begin with <code class="code">_GLIBCXX_</code>. - </p><p> - Furthermore, all pre-processor macros, switches, and -Index: libstdc++-v3/doc/html/manual/concurrency.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/concurrency.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/concurrency.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library, mutex, thread, future, condition_variable" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="atomics.html" title="Chapter 14. Atomics" /><link rel="next" href="extensions.html" title="Part III. Extensions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library, mutex, thread, future, condition_variable" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="atomics.html" title="Chapter 14. Atomics" /><link rel="next" href="extensions.html" title="Part III. Extensions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. - Concurrency - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="atomics.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="extensions.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.concurrency"></a>Chapter 15. - Concurrency -- <a id="idp16404464" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="concurrency.html#std.concurrency.api">API Reference</a></span></dt></dl></div><p> -+ <a id="idm269999126816" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="concurrency.html#std.concurrency.api">API Reference</a></span></dt></dl></div><p> - Facilities for concurrent operation, and control thereof. - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.concurrency.api"></a>API Reference</h2></div></div></div><p> - All items are declared in one of four standard header files. -Index: libstdc++-v3/doc/html/manual/ext_utilities.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_utilities.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_utilities.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 24. Utilities</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_sgi.html" title="Deprecated" /><link rel="next" href="ext_algorithms.html" title="Chapter 25. Algorithms" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 24. Utilities</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_sgi.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 24. Utilities</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_sgi.html" title="Deprecated" /><link rel="next" href="ext_algorithms.html" title="Chapter 25. Algorithms" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 24. Utilities</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_sgi.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="ext_algorithms.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.util"></a>Chapter 24. Utilities</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/policy_data_structures.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/policy_data_structures.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/policy_data_structures.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 22. Policy-Based Data Structures</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="bitmap_allocator_impl.html" title="Implementation" /><link rel="next" href="policy_data_structures_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 22. Policy-Based Data Structures</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bitmap_allocator_impl.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 22. Policy-Based Data Structures</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="bitmap_allocator_impl.html" title="Implementation" /><link rel="next" href="policy_data_structures_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 22. Policy-Based Data Structures</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bitmap_allocator_impl.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_using.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.containers.pbds"></a>Chapter 22. Policy-Based Data Structures</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues">Performance Issues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.associative">Associative</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.priority_queue">Priority Que</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation">Goals</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.associative">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.iterators">Iterators</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.functions">Functional</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.priority_queue">Priority Queues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.binary_heap">Binary Heaps</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="section"><a href="policy_data_structures_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.organization">Organization</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial">Tutorial</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.basic">Basic Use</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.configuring"> -+</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_using.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.containers.pbds"></a>Chapter 22. Policy-Based Data Structures</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="policy_data_structures.html#pbds.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues">Performance Issues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.associative">Associative</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.priority_queue">Priority Que</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation">Goals</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.associative">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.iterators">Iterators</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.functions">Functional</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.priority_queue">Priority Queues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.binary_heap">Binary Heaps</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="section"><a href="policy_data_structures_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.organization">Organization</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial">Tutorial</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.basic">Basic Use</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.configuring"> - Configuring via Template Parameters - </a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.traits"> - Querying Container Attributes -@@ -248,7 +248,7 @@ - these invariants, one must supply some policy that is aware - of these changes. Without this, it would be better to use a - linked list (in itself very efficient for these purposes). -- </p></li></ol></div><div class="figure"><a id="idp17613296"></a><p class="title"><strong>Figure 22.1. Node Invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_node_invariants.png" align="middle" alt="Node Invariants" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="motivation.associative.underlying"></a>Underlying Data Structures</h5></div></div></div><p> -+ </p></li></ol></div><div class="figure"><a id="idm269997917584"></a><p class="title"><strong>Figure 22.1. Node Invariants</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_node_invariants.png" align="middle" alt="Node Invariants" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="motivation.associative.underlying"></a>Underlying Data Structures</h5></div></div></div><p> - The standard C++ library contains associative containers based on - red-black trees and collision-chaining hash tables. These are - very useful, but they are not ideal for all types of -@@ -256,7 +256,7 @@ - </p><p> - The figure below shows the different underlying data structures - currently supported in this library. -- </p><div class="figure"><a id="idp17619952"></a><p class="title"><strong>Figure 22.2. Underlying Associative Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_different_underlying_dss_1.png" align="middle" alt="Underlying Associative Data Structures" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997910864"></a><p class="title"><strong>Figure 22.2. Underlying Associative Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_different_underlying_dss_1.png" align="middle" alt="Underlying Associative Data Structures" /></div></div></div><br class="figure-break" /><p> - A shows a collision-chaining hash-table, B shows a probing - hash-table, C shows a red-black tree, D shows a splay tree, E shows - a tree based on an ordered vector(implicit in the order of the -@@ -375,7 +375,7 @@ - no guarantee that the elements traversed will coincide with the - <span class="emphasis"><em>logical</em></span> elements between 1 and 5, as in - label B. -- </p><div class="figure"><a id="idp17651648"></a><p class="title"><strong>Figure 22.3. Range Iteration in Different Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterators_range_ops_1.png" align="middle" alt="Node Invariants" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997879168"></a><p class="title"><strong>Figure 22.3. Range Iteration in Different Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterators_range_ops_1.png" align="middle" alt="Node Invariants" /></div></div></div><br class="figure-break" /><p> - In our opinion, this problem is not caused just because - red-black trees are order preserving while - collision-chaining hash tables are (generally) not - it -@@ -426,7 +426,7 @@ - list, as in the graphic below, label B. Here the iterators are as - light as can be, but the hash-table's operations are more - complicated. -- </p><div class="figure"><a id="idp17666528"></a><p class="title"><strong>Figure 22.4. Point Iteration in Hash Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterators_range_ops_2.png" align="middle" alt="Point Iteration in Hash Data Structures" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997864256"></a><p class="title"><strong>Figure 22.4. Point Iteration in Hash Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_point_iterators_range_ops_2.png" align="middle" alt="Point Iteration in Hash Data Structures" /></div></div></div><br class="figure-break" /><p> - It should be noted that containers based on collision-chaining - hash-tables are not the only ones with this type of behavior; - many other self-organizing data structures display it as well. -@@ -442,7 +442,7 @@ - container. The graphic below shows three cases: A1 and A2 show - a red-black tree; B1 and B2 show a probing hash-table; C1 and C2 - show a collision-chaining hash table. -- </p><div class="figure"><a id="idp17675840"></a><p class="title"><strong>Figure 22.5. Effect of erase in different underlying data structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_invalidation_guarantee_erase.png" align="middle" alt="Effect of erase in different underlying data structures" /></div></div></div><br class="figure-break" /><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p> -+ </p><div class="figure"><a id="idm269997855056"></a><p class="title"><strong>Figure 22.5. Effect of erase in different underlying data structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_invalidation_guarantee_erase.png" align="middle" alt="Effect of erase in different underlying data structures" /></div></div></div><br class="figure-break" /><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p> - Erasing 5 from A1 yields A2. Clearly, an iterator to 3 can - be de-referenced and incremented. The sequence of iterators - changed, but in a way that is well-defined by the interface. -@@ -678,7 +678,7 @@ - typically less structured than an associative container's tree; - the third simply uses an associative container. These are - shown in the figure below with labels A1 and A2, B, and C. -- </p><div class="figure"><a id="idp17743424"></a><p class="title"><strong>Figure 22.6. Underlying Priority Queue Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_different_underlying_dss_2.png" align="middle" alt="Underlying Priority Queue Data Structures" /></div></div></div><br class="figure-break" /><p> -+ </p><div class="figure"><a id="idm269997787392"></a><p class="title"><strong>Figure 22.6. Underlying Priority Queue Data Structures</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_different_underlying_dss_2.png" align="middle" alt="Underlying Priority Queue Data Structures" /></div></div></div><br class="figure-break" /><p> - No single implementation can completely replace any of the - others. Some have better <code class="function">push</code> - and <code class="function">pop</code> amortized performance, some have -@@ -1098,7 +1098,7 @@ - </span>. </span><span class="publisher"><span class="publishername"> - Proceedings of International Conference on Very Large Data Bases - . </span></span></p></div><div class="biblioentry"><a id="biblio.maverik_lowerbounds"></a><p>[biblio.maverik_lowerbounds] <span class="title"><em> -- <a class="link" href="http://magic.aladdin.cs.cmu.edu/2005/08/01/deamortization-part-2-binomial-heaps" target="_top"> -+ <a class="link" href="http://magic.aladdin.cs.cmu.edu/2005/08/01/deamortization-part-2-binomial-heaps/" target="_top"> - Deamortization - Part 2: Binomial Heaps - </a> - </em>. </span><span class="date"> -@@ -1190,7 +1190,7 @@ - </span>. </span><span class="publisher"><span class="publishername"> - Addison-Wesley Publishing Company - . </span></span></p></div><div class="biblioentry"><a id="biblio.nelson96stlpq"></a><p>[biblio.nelson96stlpq] <span class="title"><em> -- <a class="link" href="http://www.dogma.net/markn/articles/pq_stl/priority.htm" target="_top">Priority Queues and the STL -+ <a class="link" href="http://marknelson.us/1996/01/01/priority-queues/" target="_top">Priority Queues and the STL - </a> - </em>. </span><span class="date"> - January 1996 -Index: libstdc++-v3/doc/html/manual/ext_iterators.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_iterators.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_iterators.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 27. Iterators</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_numerics.html" title="Chapter 26. Numerics" /><link rel="next" href="ext_io.html" title="Chapter 28. Input and Output" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 27. Iterators</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_numerics.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 27. Iterators</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_numerics.html" title="Chapter 26. Numerics" /><link rel="next" href="ext_io.html" title="Chapter 28. Input and Output" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 27. Iterators</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_numerics.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="ext_io.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.iterators"></a>Chapter 27. Iterators</h2></div></div></div><p>24.3.2 describes <code class="code">struct iterator</code>, which didn't exist in the -Index: libstdc++-v3/doc/html/manual/bitmap_allocator_impl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/bitmap_allocator_impl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/bitmap_allocator_impl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /><link rel="prev" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /><link rel="next" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bitmap_allocator.html">Prev</a> </td><th width="60%" align="center">Chapter 21. The bitmap_allocator</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.bitmap.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bitmap.impl.free_list_store"></a>Free List Store</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /><link rel="prev" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /><link rel="next" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bitmap_allocator.html">Prev</a> </td><th width="60%" align="center">Chapter 21. The bitmap_allocator</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.bitmap.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bitmap.impl.free_list_store"></a>Free List Store</h3></div></div></div><p> - The Free List Store (referred to as FLS for the remaining part of this - document) is the Global memory pool that is shared by all instances of - the bitmapped allocator instantiated for any type. This maintains a -@@ -75,7 +75,7 @@ - </p><p> - Consider a block of size 64 ints. In memory, it would look like this: - (assume a 32-bit system where, size_t is a 32-bit entity). -- </p><div class="table"><a id="idp17500848"></a><p class="title"><strong>Table 21.1. Bitmap Allocator Memory Map</strong></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -> Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p> -+ </p><div class="table"><a id="idm269998030352"></a><p class="title"><strong>Table 21.1. Bitmap Allocator Memory Map</strong></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -> Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p> - The first Column(268) represents the size of the Block in bytes as - seen by the Bitmap Allocator. Internally, a global free list is - used to keep track of the free blocks used and given back by the -Index: libstdc++-v3/doc/html/manual/appendix_contributing.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix_contributing.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix_contributing.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Contributing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix.html" title="Part IV. Appendices" /><link rel="next" href="source_organization.html" title="Directory Layout and Source Conventions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Contributing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix.html" title="Part IV. Appendices" /><link rel="next" href="source_organization.html" title="Directory Layout and Source Conventions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. - Contributing - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix.html">Prev</a> </td><th width="60%" align="center">Part IV. -@@ -6,8 +6,8 @@ - Appendices - </th><td width="20%" align="right"> <a accesskey="n" href="source_organization.html">Next</a></td></tr></table><hr /></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="appendix.contrib"></a> - Contributing -- <a id="idp21875168" class="indexterm"></a> --</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="section"><a href="source_organization.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="section"><a href="source_code_style.html">Coding Style</a></span></dt><dd><dl><dt><span class="section"><a href="source_code_style.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="section"><a href="source_code_style.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="section"><a href="source_design_notes.html">Design Notes</a></span></dt></dl></div><p> -+ <a id="idm269993657472" class="indexterm"></a> -+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="section"><a href="source_organization.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="section"><a href="source_code_style.html">Coding Style</a></span></dt><dd><dl><dt><span class="section"><a href="source_code_style.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="section"><a href="source_code_style.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="section"><a href="source_design_notes.html">Design Notes</a></span></dt></dl></div><p> - The GNU C++ Library follows an open development model. Active - contributors are assigned maintainer-ship responsibility, and given - write access to the source repository. First time contributors -@@ -36,7 +36,7 @@ - for this group is quite useful. - </p></li><li class="listitem"><p> - Peruse -- the <a class="link" href="http://www.gnu.org/prep/standards" target="_top">GNU -+ the <a class="link" href="http://www.gnu.org/prep/standards/" target="_top">GNU - Coding Standards</a>, and chuckle when you hit the part - about <span class="quote">“<span class="quote">Using Languages Other Than C</span>”</span>. - </p></li><li class="listitem"><p> -Index: libstdc++-v3/doc/html/manual/parallel_mode_test.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/parallel_mode_test.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/parallel_mode_test.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Testing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_design.html" title="Design" /><link rel="next" href="profile_mode.html" title="Chapter 19. Profile Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Testing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_design.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.test"></a>Testing</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Testing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_design.html" title="Design" /><link rel="next" href="profile_mode.html" title="Chapter 19. Profile Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Testing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_design.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.test"></a>Testing</h2></div></div></div><p> - Both the normal conformance and regression tests and the - supplemental performance tests work. - </p><p> -Index: libstdc++-v3/doc/html/manual/profile_mode.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 19. Profile Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="parallel_mode_test.html" title="Testing" /><link rel="next" href="profile_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 19. Profile Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_test.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 19. Profile Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="parallel_mode_test.html" title="Testing" /><link rel="next" href="profile_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 19. Profile Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_test.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_design.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.profile_mode"></a>Chapter 19. Profile Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.using">Using the Profile Mode</a></span></dt><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.tuning">Tuning the Profile Mode</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.wrapper">Wrapper Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.instrumentation">Instrumentation</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.rtlib">Run Time Behavior</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.analysis">Analysis and Diagnostics</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.cost-model">Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.reports">Reports</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.testing">Testing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_api.html">Extensions for Custom Containers</a></span></dt><dt><span class="section"><a href="profile_mode_cost_model.html">Empirical Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html">Implementation Issues</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stack">Stack Traces</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.symbols">Symbolization of Instruction Addresses</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.concurrency">Concurrency</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stdlib-in-proflib">Using the Standard Library in the Instrumentation Implementation</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.malloc-hooks">Malloc Hooks</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.construction-destruction">Construction and Destruction of Global Objects</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_devel.html">Developer Information</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.bigpic">Big Picture</a></span></dt><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.howto">How To Add A Diagnostic</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html">Diagnostics</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.template">Diagnostic Template</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.containers">Containers</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_small">Hashtable Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_large">Hashtable Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.inefficient_hash">Inefficient Hash</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_small">Vector Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_large">Vector Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_hashtable">Vector to Hashtable</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_to_vector">Hashtable to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_list">Vector to List</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_vector">List to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_slist">List to Forward List (Slist)</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.assoc_ord_to_unord">Ordered to Unordered Associative Container</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms">Algorithms</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms.sort">Sort Algorithm Performance</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality">Data Locality</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.sw_prefetch">Need Software Prefetch</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.linked">Linked Structure Locality</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread">Multithreaded Data Access</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.ddtest">Data Dependence Violations at Container Level</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.false_share">False Sharing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.statistics">Statistics</a></span></dt></dl></dd><dt><span class="bibliography"><a href="profile_mode.html#profile_mode.biblio">Bibliography</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.intro"></a>Intro</h2></div></div></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_design.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.profile_mode"></a>Chapter 19. Profile Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.using">Using the Profile Mode</a></span></dt><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.tuning">Tuning the Profile Mode</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.wrapper">Wrapper Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.instrumentation">Instrumentation</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.rtlib">Run Time Behavior</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.analysis">Analysis and Diagnostics</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.cost-model">Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.reports">Reports</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.testing">Testing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_api.html">Extensions for Custom Containers</a></span></dt><dt><span class="section"><a href="profile_mode_cost_model.html">Empirical Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html">Implementation Issues</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stack">Stack Traces</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.symbols">Symbolization of Instruction Addresses</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.concurrency">Concurrency</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stdlib-in-proflib">Using the Standard Library in the Instrumentation Implementation</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.malloc-hooks">Malloc Hooks</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.construction-destruction">Construction and Destruction of Global Objects</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_devel.html">Developer Information</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.bigpic">Big Picture</a></span></dt><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.howto">How To Add A Diagnostic</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html">Diagnostics</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.template">Diagnostic Template</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.containers">Containers</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_small">Hashtable Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_large">Hashtable Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.inefficient_hash">Inefficient Hash</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_small">Vector Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_large">Vector Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_hashtable">Vector to Hashtable</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_to_vector">Hashtable to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_list">Vector to List</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_vector">List to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_slist">List to Forward List (Slist)</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.assoc_ord_to_unord">Ordered to Unordered Associative Container</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms">Algorithms</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms.sort">Sort Algorithm Performance</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality">Data Locality</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.sw_prefetch">Need Software Prefetch</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.linked">Linked Structure Locality</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread">Multithreaded Data Access</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.ddtest">Data Dependence Violations at Container Level</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.false_share">False Sharing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.statistics">Statistics</a></span></dt></dl></dd><dt><span class="bibliography"><a href="profile_mode.html#profile_mode.biblio">Bibliography</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.intro"></a>Intro</h2></div></div></div><p> - <span class="emphasis"><em>Goal: </em></span>Give performance improvement advice based on - recognition of suboptimal usage patterns of the standard library. - </p><p> -@@ -137,7 +137,7 @@ - call context. - (Environment variable not supported.) - </p></li></ul></div><p> -- </p></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="profile_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="idp17395456"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="profile_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="idm269998135936"></a><p><span class="citetitle"><em class="citetitle"> - Perflint: A Context Sensitive Performance Advisor for C++ Programs - </em>. </span><span class="author"><span class="firstname">Lixia</span> <span class="surname">Liu</span>. </span><span class="author"><span class="firstname">Silvius</span> <span class="surname">Rus</span>. </span><span class="copyright">Copyright © 2009 . </span><span class="publisher"><span class="publishername"> - Proceedings of the 2009 International Symposium on Code Generation -Index: libstdc++-v3/doc/html/manual/stringstreams.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/stringstreams.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/stringstreams.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Memory Based Streams</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="streambufs.html" title="Stream Buffers" /><link rel="next" href="fstreams.html" title="File Based Streams" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Memory Based Streams</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="streambufs.html">Prev</a> </td><th width="60%" align="center">Chapter 13. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Memory Based Streams</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="streambufs.html" title="Stream Buffers" /><link rel="next" href="fstreams.html" title="File Based Streams" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Memory Based Streams</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="streambufs.html">Prev</a> </td><th width="60%" align="center">Chapter 13. - Input and Output - - </th><td width="20%" align="right"> <a accesskey="n" href="fstreams.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.memstreams"></a>Memory Based Streams</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.io.memstreams.compat"></a>Compatibility With strstream</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/traits.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/traits.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/traits.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Traits</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="memory.html" title="Memory" /><link rel="next" href="strings.html" title="Chapter 7. Strings" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Traits</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="memory.html">Prev</a> </td><th width="60%" align="center">Chapter 6. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Traits</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="memory.html" title="Memory" /><link rel="next" href="strings.html" title="Chapter 7. Strings" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Traits</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="memory.html">Prev</a> </td><th width="60%" align="center">Chapter 6. - Utilities - - </th><td width="20%" align="right"> <a accesskey="n" href="strings.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.traits"></a>Traits</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/policy_data_structures_ack.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/policy_data_structures_ack.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/policy_data_structures_ack.html (.../branches/gcc-4_8-branch) -@@ -1,10 +1,9 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Acknowledgments</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_based_data_structures_test.html" title="Testing" /><link rel="next" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Acknowledgments</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_based_data_structures_test.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="ext_containers.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pbds.ack"></a>Acknowledgments</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Acknowledgments</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_based_data_structures_test.html" title="Testing" /><link rel="next" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Acknowledgments</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_based_data_structures_test.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="ext_containers.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pbds.ack"></a>Acknowledgments</h2></div></div></div><p> - Written by Ami Tavory and Vladimir Dreizin (IBM Haifa Research - Laboratories), and Benjamin Kosnik (Red Hat). - </p><p> -- This library was partially written at -- <a class="link" href="http://www.haifa.il.ibm.com/" target="_top">IBM's Haifa Research Labs</a>. -+ This library was partially written at IBM's Haifa Research Labs. - It is based heavily on policy-based design and uses many useful - techniques from Modern C++ Design: Generic Programming and Design - Patterns Applied by Andrei Alexandrescu. -Index: libstdc++-v3/doc/html/manual/associative.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/associative.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/associative.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Associative</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="containers.html" title="Chapter 9. Containers" /><link rel="next" href="unordered_associative.html" title="Unordered Associative" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Associative</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="containers.html">Prev</a> </td><th width="60%" align="center">Chapter 9. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Associative</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="containers.html" title="Chapter 9. Containers" /><link rel="next" href="unordered_associative.html" title="Unordered Associative" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Associative</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="containers.html">Prev</a> </td><th width="60%" align="center">Chapter 9. - Containers - - </th><td width="20%" align="right"> <a accesskey="n" href="unordered_associative.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.associative"></a>Associative</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="containers.associative.insert_hints"></a>Insertion Hints</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/ext_concurrency.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_concurrency.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_concurrency.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 30. Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_demangling.html" title="Chapter 29. Demangling" /><link rel="next" href="ext_concurrency_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 30. Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_demangling.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 30. Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_demangling.html" title="Chapter 29. Demangling" /><link rel="next" href="ext_concurrency_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 30. Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_demangling.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency_impl.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.concurrency"></a>Chapter 30. Concurrency</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_use.html">Use</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.design"></a>Design</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.threads"></a>Interface to Locks and Mutexes</h3></div></div></div><p>The file <code class="filename"><ext/concurrence.h></code> -+</th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency_impl.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.concurrency"></a>Chapter 30. Concurrency</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="section"><a href="ext_concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="section"><a href="ext_concurrency_impl.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="ext_concurrency_use.html">Use</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.design"></a>Design</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.design.threads"></a>Interface to Locks and Mutexes</h3></div></div></div><p>The file <code class="filename"><ext/concurrence.h></code> - contains all the higher-level - constructs for playing with threads. In contrast to the atomics layer, - the concurrence layer consists largely of types. All types are defined within <code class="code">namespace __gnu_cxx</code>. -Index: libstdc++-v3/doc/html/manual/support.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/support.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/support.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. Support</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="std_contents.html" title="Part II. Standard Contents" /><link rel="next" href="dynamic_memory.html" title="Dynamic Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. Support</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="std_contents.html" title="Part II. Standard Contents" /><link rel="next" href="dynamic_memory.html" title="Dynamic Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. - Support - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="std_contents.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="dynamic_memory.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.support"></a>Chapter 4. - Support -- <a id="idp13745936" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="support.html#std.support.types">Types</a></span></dt><dd><dl><dt><span class="section"><a href="support.html#std.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.numeric_limits">Numeric Properties</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.null">NULL</a></span></dt></dl></dd><dt><span class="section"><a href="dynamic_memory.html">Dynamic Memory</a></span></dt><dt><span class="section"><a href="termination.html">Termination</a></span></dt><dd><dl><dt><span class="section"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="section"><a href="termination.html#support.termination.verbose">Verbose Terminate Handler</a></span></dt></dl></dd></dl></div><p> -+ <a id="idm270001786944" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="support.html#std.support.types">Types</a></span></dt><dd><dl><dt><span class="section"><a href="support.html#std.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.numeric_limits">Numeric Properties</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.null">NULL</a></span></dt></dl></dd><dt><span class="section"><a href="dynamic_memory.html">Dynamic Memory</a></span></dt><dt><span class="section"><a href="termination.html">Termination</a></span></dt><dd><dl><dt><span class="section"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="section"><a href="termination.html#support.termination.verbose">Verbose Terminate Handler</a></span></dt></dl></dd></dl></div><p> - This part deals with the functions called and objects created - automatically during the course of a program's existence. - </p><p> -Index: libstdc++-v3/doc/html/manual/bitmap_allocator.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/bitmap_allocator.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/bitmap_allocator.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 21. The bitmap_allocator</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="mt_allocator_ex_multi.html" title="Multiple Thread Example" /><link rel="next" href="bitmap_allocator_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 21. The bitmap_allocator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_ex_multi.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 21. The bitmap_allocator</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="mt_allocator_ex_multi.html" title="Multiple Thread Example" /><link rel="next" href="bitmap_allocator_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 21. The bitmap_allocator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_ex_multi.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="bitmap_allocator_impl.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.allocator.bitmap"></a>Chapter 21. The bitmap_allocator</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.free_list_store">Free List Store</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block">Super Block</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block_data">Super Block Data Layout</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.max_wasted">Maximum Wasted Percentage</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.allocate"><code class="function">allocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.deallocate"><code class="function">deallocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.questions">Questions</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.1">1</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.2">2</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.3">3</a></span></dt></dl></dd><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.locality">Locality</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.grow_policy">Overhead and Grow Policy</a></span></dt></dl></dd></dl></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="bitmap_allocator_impl.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.allocator.bitmap"></a>Chapter 21. The bitmap_allocator</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.free_list_store">Free List Store</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block">Super Block</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block_data">Super Block Data Layout</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.max_wasted">Maximum Wasted Percentage</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.allocate"><code class="function">allocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.deallocate"><code class="function">deallocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.questions">Questions</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.1">1</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.2">2</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.3">3</a></span></dt></dl></dd><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.locality">Locality</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.grow_policy">Overhead and Grow Policy</a></span></dt></dl></dd></dl></div><p> - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.bitmap.design"></a>Design</h2></div></div></div><p> - As this name suggests, this allocator uses a bit-map to keep track - of the used and unused memory locations for its book-keeping -Index: libstdc++-v3/doc/html/manual/license.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/license.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/license.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>License</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="status.html" title="Chapter 1. Status" /><link rel="prev" href="status.html" title="Chapter 1. Status" /><link rel="next" href="bugs.html" title="Bugs" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">License</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="status.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Status</th><td width="20%" align="right"> <a accesskey="n" href="bugs.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.license"></a>License</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>License</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="status.html" title="Chapter 1. Status" /><link rel="prev" href="status.html" title="Chapter 1. Status" /><link rel="next" href="bugs.html" title="Bugs" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">License</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="status.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Status</th><td width="20%" align="right"> <a accesskey="n" href="bugs.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.license"></a>License</h2></div></div></div><p> - There are two licenses affecting GNU libstdc++: one for the code, - and one for the documentation. - </p><p> -Index: libstdc++-v3/doc/html/manual/numerics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/numerics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/numerics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 12. Numerics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="algorithms.html" title="Chapter 11. Algorithms" /><link rel="next" href="generalized_numeric_operations.html" title="Generalized Operations" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 12. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 12. Numerics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="algorithms.html" title="Chapter 11. Algorithms" /><link rel="next" href="generalized_numeric_operations.html" title="Generalized Operations" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 12. - Numerics - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="algorithms.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="generalized_numeric_operations.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.numerics"></a>Chapter 12. - Numerics -- <a id="idp16214640" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="numerics.html#std.numerics.complex">Complex</a></span></dt><dd><dl><dt><span class="section"><a href="numerics.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="section"><a href="generalized_numeric_operations.html">Generalized Operations</a></span></dt><dt><span class="section"><a href="numerics_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="numerics_and_c.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="section"><a href="numerics_and_c.html#numerics.c.c99">C99</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.numerics.complex"></a>Complex</h2></div></div></div><p> -+ <a id="idm269999316576" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="numerics.html#std.numerics.complex">Complex</a></span></dt><dd><dl><dt><span class="section"><a href="numerics.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="section"><a href="generalized_numeric_operations.html">Generalized Operations</a></span></dt><dt><span class="section"><a href="numerics_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="numerics_and_c.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="section"><a href="numerics_and_c.html#numerics.c.c99">C99</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.numerics.complex"></a>Complex</h2></div></div></div><p> - </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="numerics.complex.processing"></a>complex Processing</h3></div></div></div><p> - </p><p>Using <code class="code">complex<></code> becomes even more comple- er, sorry, - <span class="emphasis"><em>complicated</em></span>, with the not-quite-gratuitously-incompatible -Index: libstdc++-v3/doc/html/manual/using_exceptions.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_exceptions.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_exceptions.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Exceptions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, exception, error, exception neutrality, exception safety, exception propagation, -fno-exceptions" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_concurrency.html" title="Concurrency" /><link rel="next" href="debug.html" title="Debugging Support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Exceptions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="debug.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.exceptions"></a>Exceptions</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Exceptions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, exception, error, exception neutrality, exception safety, exception propagation, -fno-exceptions" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_concurrency.html" title="Concurrency" /><link rel="next" href="debug.html" title="Debugging Support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Exceptions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="debug.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.exceptions"></a>Exceptions</h2></div></div></div><p> - The C++ language provides language support for stack unwinding - with <code class="literal">try</code> and <code class="literal">catch</code> blocks and - the <code class="literal">throw</code> keyword. -@@ -265,7 +265,7 @@ - } - catch(...) - { this->_M_setstate(ios_base::badbit); } --</pre></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="using.exceptions.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="idp13644000"></a><p><span class="title"><em> -+</pre></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="using.exceptions.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="idm270001889024"></a><p><span class="title"><em> - <a class="link" href="http://www.opengroup.org/austin/" target="_top"> - System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008) - </a> -@@ -274,39 +274,39 @@ - . </span><span class="copyright">Copyright © 2008 - The Open Group/The Institute of Electrical and Electronics - Engineers, Inc. -- . </span></p></div><div class="biblioentry"><a id="idp13647696"></a><p><span class="title"><em> -+ . </span></p></div><div class="biblioentry"><a id="idm270001885328"></a><p><span class="title"><em> - <a class="link" href="http://www.boost.org/community/error_handling.html" target="_top"> - Error and Exception Handling - </a> - </em>. </span><span class="author"><span class="firstname">David</span> <span class="surname">Abrahams </span>. </span><span class="publisher"><span class="publishername"> - Boost -- . </span></span></p></div><div class="biblioentry"><a id="idp13651392"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270001881632"></a><p><span class="title"><em> - <a class="link" href="http://www.boost.org/community/exception_safety.html" target="_top"> - Exception-Safety in Generic Components - </a> - </em>. </span><span class="author"><span class="firstname">David</span> <span class="surname">Abrahams</span>. </span><span class="publisher"><span class="publishername"> - Boost -- . </span></span></p></div><div class="biblioentry"><a id="idp13655104"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270001877920"></a><p><span class="title"><em> - <a class="link" href="www.open-std.org/jtc1/sc22/wg21/docs/papers/1997/N1077.pdf" target="_top"> - Standard Library Exception Policy - </a> - </em>. </span><span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername"> - WG21 N1077 -- . </span></span></p></div><div class="biblioentry"><a id="idp13658816"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270001874208"></a><p><span class="title"><em> - <a class="link" href="http://gcc.gnu.org/ml/gcc-patches/2001-03/msg00661.html" target="_top"> - ia64 c++ abi exception handling - </a> - </em>. </span><span class="author"><span class="firstname">Richard</span> <span class="surname">Henderson</span>. </span><span class="publisher"><span class="publishername"> - GNU -- . </span></span></p></div><div class="biblioentry"><a id="idp13662512"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270001870512"></a><p><span class="title"><em> - <a class="link" href="http://www.research.att.com/~bs/3rd_safe.pdf" target="_top"> - Appendix E: Standard-Library Exception Safety - </a> -- </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span></p></div><div class="biblioentry"><a id="idp13665328"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span></p></div><div class="biblioentry"><a id="idm270001867696"></a><p><span class="citetitle"><em class="citetitle"> - Exceptional C++ - </em>. </span><span class="pagenums"> - Exception-Safety Issues and Techniques -- . </span><span class="author"><span class="firstname">Herb</span> <span class="surname">Sutter</span>. </span></p></div><div class="biblioentry"><a id="idp13667712"></a><p><span class="title"><em> -+ . </span><span class="author"><span class="firstname">Herb</span> <span class="surname">Sutter</span>. </span></p></div><div class="biblioentry"><a id="idm270001865312"></a><p><span class="title"><em> - <a class="link" href="http://gcc.gnu.org/PR25191" target="_top"> - GCC Bug 25191: exception_defines.h #defines try/catch - </a> -Index: libstdc++-v3/doc/html/manual/policy_based_data_structures_test.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/policy_based_data_structures_test.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/policy_based_data_structures_test.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Testing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures_design.html" title="Design" /><link rel="next" href="policy_data_structures_ack.html" title="Acknowledgments" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Testing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_design.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_ack.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pbds.test"></a>Testing</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.test.regression"></a>Regression</h3></div></div></div><p>The library contains a single comprehensive regression test. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Testing</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures_design.html" title="Design" /><link rel="next" href="policy_data_structures_ack.html" title="Acknowledgments" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Testing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures_design.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_ack.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pbds.test"></a>Testing</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.test.regression"></a>Regression</h3></div></div></div><p>The library contains a single comprehensive regression test. - For a given container type in this library, the test creates - an object of the container type and an object of the - corresponding standard type (e.g., <code class="classname">std::set</code>). It -Index: libstdc++-v3/doc/html/manual/parallel_mode_design.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/parallel_mode_design.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/parallel_mode_design.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_using.html" title="Using" /><link rel="next" href="parallel_mode_test.html" title="Testing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_using.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_test.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.design"></a>Design</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_using.html" title="Using" /><link rel="next" href="parallel_mode_test.html" title="Testing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_using.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_test.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.design"></a>Design</h2></div></div></div><p> - </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="parallel_mode.design.intro"></a>Interface Basics</h3></div></div></div><p> - All parallel algorithms are intended to have signatures that are - equivalent to the ISO C++ algorithms replaced. For instance, the -Index: libstdc++-v3/doc/html/manual/abi.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/abi.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/abi.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ABI Policy and Guidelines</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, ABI, version, dynamic, shared, compatibility" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="test.html" title="Test" /><link rel="next" href="api.html" title="API Evolution and Deprecation History" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ABI Policy and Guidelines</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="test.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ABI Policy and Guidelines</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, ABI, version, dynamic, shared, compatibility" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="test.html" title="Test" /><link rel="next" href="api.html" title="API Evolution and Deprecation History" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ABI Policy and Guidelines</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="test.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.abi"></a>ABI Policy and Guidelines</h2></div></div></div><p> -@@ -493,39 +493,39 @@ - <a class="link" href="http://www.codesourcery.com/cxx-abi/" target="_top"> - C++ ABI Summary - </a> -- </em>. </span></p></div><div class="biblioentry"><a id="idp22945936"></a><p><span class="title"><em> -+ </em>. </span></p></div><div class="biblioentry"><a id="idm269992586624"></a><p><span class="title"><em> - <a class="link" href="http://www.intel.com/cd/software/products/asmo-na/eng/284736.htm" target="_top"> - Intel Compilers for Linux Compatibility with the GNU Compilers - </a> -- </em>. </span></p></div><div class="biblioentry"><a id="idp22947792"></a><p><span class="title"><em> -+ </em>. </span></p></div><div class="biblioentry"><a id="idm269992584768"></a><p><span class="title"><em> - <a class="link" href="http://download.oracle.com/docs/cd/E19963-01/html/819-0690/index.html" target="_top"> - Linker and Libraries Guide (document 819-0690) - </a> -- </em>. </span></p></div><div class="biblioentry"><a id="idp22949632"></a><p><span class="title"><em> -+ </em>. </span></p></div><div class="biblioentry"><a id="idm269992582928"></a><p><span class="title"><em> - <a class="link" href="http://download.oracle.com/docs/cd/E19422-01/819-3689/index.html" target="_top"> - Sun Studio 11: C++ Migration Guide (document 819-3689) - </a> -- </em>. </span></p></div><div class="biblioentry"><a id="idp22951488"></a><p><span class="title"><em> -+ </em>. </span></p></div><div class="biblioentry"><a id="idm269992581072"></a><p><span class="title"><em> - <a class="link" href="http://www.akkadia.org/drepper/dsohowto.pdf" target="_top"> - How to Write Shared Libraries - </a> -- </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span></p></div><div class="biblioentry"><a id="idp22954928"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span></p></div><div class="biblioentry"><a id="idm269992577632"></a><p><span class="title"><em> - <a class="link" href="http://www.arm.com/miscPDFs/8033.pdf" target="_top"> - C++ ABI for the ARM Architecture - </a> -- </em>. </span></p></div><div class="biblioentry"><a id="idp22956736"></a><p><span class="title"><em> -+ </em>. </span></p></div><div class="biblioentry"><a id="idm269992575824"></a><p><span class="title"><em> - <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1976.html" target="_top"> - Dynamic Shared Objects: Survey and Issues - </a> - </em>. </span><span class="subtitle"> - ISO C++ J16/06-0046 -- . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="idp22960032"></a><p><span class="title"><em> -+ . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="idm269992572528"></a><p><span class="title"><em> - <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2013.html" target="_top"> - Versioning With Namespaces - </a> - </em>. </span><span class="subtitle"> - ISO C++ J16/06-0083 -- . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="idp22963312"></a><p><span class="title"><em> -+ . </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span></p></div><div class="biblioentry"><a id="idm269992569248"></a><p><span class="title"><em> - <a class="link" href="http://syrcose.ispras.ru/2009/files/SYRCoSE2009-CfP.pdf" target="_top"> - Binary Compatibility of Shared Libraries Implemented in C++ - on GNU/Linux Systems -Index: libstdc++-v3/doc/html/manual/intro.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/intro.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/intro.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part I. Introduction</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="index.html" title="The GNU C++ Library Manual" /><link rel="next" href="status.html" title="Chapter 1. Status" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part I. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part I. Introduction</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="index.html" title="The GNU C++ Library Manual" /><link rel="next" href="status.html" title="Chapter 1. Status" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part I. - Introduction - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library Manual</th><td width="20%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr></table><hr /></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="manual.intro"></a>Part I. - Introduction -- <a id="idp9040416" class="indexterm"></a> --</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Manual </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html> -\ No newline at end of file -+ <a id="idm270013458800" class="indexterm"></a> -+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Manual </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/manual/profile_mode_api.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_api.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_api.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Extensions for Custom Containers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_design.html" title="Design" /><link rel="next" href="profile_mode_cost_model.html" title="Empirical Cost Model" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Extensions for Custom Containers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_design.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_cost_model.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.api"></a>Extensions for Custom Containers</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Extensions for Custom Containers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_design.html" title="Design" /><link rel="next" href="profile_mode_cost_model.html" title="Empirical Cost Model" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Extensions for Custom Containers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_design.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_cost_model.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.api"></a>Extensions for Custom Containers</h2></div></div></div><p> - Many large projects use their own data structures instead of the ones in the - standard library. If these data structures are similar in functionality - to the standard library, they can be instrumented with the same hooks -Index: libstdc++-v3/doc/html/manual/atomics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/atomics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/atomics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 14. Atomics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library, atomic" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="io_and_c.html" title="Interacting with C" /><link rel="next" href="concurrency.html" title="Chapter 15. Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 14. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 14. Atomics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library, atomic" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="io_and_c.html" title="Interacting with C" /><link rel="next" href="concurrency.html" title="Chapter 15. Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 14. - Atomics - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="io_and_c.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="concurrency.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.atomics"></a>Chapter 14. - Atomics -- <a id="idp16390640" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="atomics.html#std.atomics.api">API Reference</a></span></dt></dl></div><p> -+ <a id="idm269999140704" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="atomics.html#std.atomics.api">API Reference</a></span></dt></dl></div><p> - Facilities for atomic operations. - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.atomics.api"></a>API Reference</h2></div></div></div><p> - All items are declared in the standard header -Index: libstdc++-v3/doc/html/manual/internals.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/internals.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/internals.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Porting to New Hardware or Operating Systems</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, internals" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="documentation_hacking.html" title="Writing and Generating Documentation" /><link rel="next" href="test.html" title="Test" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Porting to New Hardware or Operating Systems</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="documentation_hacking.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Porting to New Hardware or Operating Systems</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, internals" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="documentation_hacking.html" title="Writing and Generating Documentation" /><link rel="next" href="test.html" title="Test" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Porting to New Hardware or Operating Systems</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="documentation_hacking.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="test.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.internals"></a>Porting to New Hardware or Operating Systems</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/policy_data_structures_using.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/policy_data_structures_using.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/policy_data_structures_using.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="next" href="policy_data_structures_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="containers.pbds.using"></a>Using</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.using.prereq"></a>Prerequisites</h3></div></div></div><p>The library contains only header files, and does not require any -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, policy, container, data, structure, associated, tree, trie, hash, metaprogramming" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="prev" href="policy_data_structures.html" title="Chapter 22. Policy-Based Data Structures" /><link rel="next" href="policy_data_structures_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="policy_data_structures.html">Prev</a> </td><th width="60%" align="center">Chapter 22. Policy-Based Data Structures</th><td width="20%" align="right"> <a accesskey="n" href="policy_data_structures_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="containers.pbds.using"></a>Using</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.using.prereq"></a>Prerequisites</h3></div></div></div><p>The library contains only header files, and does not require any - other libraries except the standard C++ library . All classes are - defined in namespace <code class="code">__gnu_pbds</code>. The library internally - uses macros beginning with <code class="code">PB_DS</code>, but -@@ -61,7 +61,7 @@ - In addition, there are the following diagnostics classes, - used to report errors specific to this library's data - structures. -- </p><div class="figure"><a id="idp17806128"></a><p class="title"><strong>Figure 22.7. Exception Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_exception_hierarchy.png" align="middle" alt="Exception Hierarchy" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.using.tutorial"></a>Tutorial</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="pbds.using.tutorial.basic"></a>Basic Use</h4></div></div></div><p> -+ </p><div class="figure"><a id="idm269997724688"></a><p class="title"><strong>Figure 22.7. Exception Hierarchy</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/pbds_exception_hierarchy.png" align="middle" alt="Exception Hierarchy" /></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pbds.using.tutorial"></a>Tutorial</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="pbds.using.tutorial.basic"></a>Basic Use</h4></div></div></div><p> - For the most part, the policy-based containers containers in - namespace <code class="literal">__gnu_pbds</code> have the same interface as - the equivalent containers in the standard C++ library, except for -Index: libstdc++-v3/doc/html/manual/bugs.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/bugs.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/bugs.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Bugs</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="status.html" title="Chapter 1. Status" /><link rel="prev" href="license.html" title="License" /><link rel="next" href="setup.html" title="Chapter 2. Setup" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Bugs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="license.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Status</th><td width="20%" align="right"> <a accesskey="n" href="setup.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.bugs"></a>Bugs</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.status.bugs.impl"></a>Implementation Bugs</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Bugs</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="status.html" title="Chapter 1. Status" /><link rel="prev" href="license.html" title="License" /><link rel="next" href="setup.html" title="Chapter 2. Setup" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Bugs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="license.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Status</th><td width="20%" align="right"> <a accesskey="n" href="setup.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.bugs"></a>Bugs</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.status.bugs.impl"></a>Implementation Bugs</h3></div></div></div><p> - Information on known bugs, details on efforts to fix them, and - fixed bugs are all available as part of the <a class="link" href="http://gcc.gnu.org/bugs/" target="_top">GCC bug tracking system</a>, - with the category set to <code class="literal">libstdc++</code>. -Index: libstdc++-v3/doc/html/manual/parallel_mode_using.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/parallel_mode_using.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/parallel_mode_using.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_semantics.html" title="Semantics" /><link rel="next" href="parallel_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_semantics.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.using"></a>Using</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="parallel_mode.using.prereq_flags"></a>Prerequisite Compiler Flags</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode_semantics.html" title="Semantics" /><link rel="next" href="parallel_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode_semantics.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.using"></a>Using</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="parallel_mode.using.prereq_flags"></a>Prerequisite Compiler Flags</h3></div></div></div><p> - Any use of parallel functionality requires additional compiler - and runtime support, in particular support for OpenMP. Adding this support is - not difficult: just compile your application with the compiler -@@ -62,4 +62,4 @@ - flags for atomic operations.) - </p><p> The following table provides the names and headers of all the - parallel algorithms that can be used in a similar manner: --</p><div class="table"><a id="idp16725920"></a><p class="title"><strong>Table 18.1. Parallel Algorithms</strong></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="parallel_mode_semantics.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="parallel_mode_design.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> -\ No newline at end of file -+</p><div class="table"><a id="idm269998805216"></a><p class="title"><strong>Table 18.1. Parallel Algorithms</strong></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="parallel_mode_semantics.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="parallel_mode_design.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/manual/ext_numerics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_numerics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_numerics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 26. Numerics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_algorithms.html" title="Chapter 25. Algorithms" /><link rel="next" href="ext_iterators.html" title="Chapter 27. Iterators" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 26. Numerics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_algorithms.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 26. Numerics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_algorithms.html" title="Chapter 25. Algorithms" /><link rel="next" href="ext_iterators.html" title="Chapter 27. Iterators" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 26. Numerics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_algorithms.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="ext_iterators.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.numerics"></a>Chapter 26. Numerics</h2></div></div></div><p>26.4, the generalized numeric operations such as <code class="code">accumulate</code>, -Index: libstdc++-v3/doc/html/manual/parallel_mode_semantics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/parallel_mode_semantics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/parallel_mode_semantics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Semantics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="next" href="parallel_mode_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Semantics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.semantics"></a>Semantics</h2></div></div></div><p> The parallel mode STL algorithms are currently not exception-safe, -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Semantics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="prev" href="parallel_mode.html" title="Chapter 18. Parallel Mode" /><link rel="next" href="parallel_mode_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Semantics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="parallel_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Parallel Mode</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.semantics"></a>Semantics</h2></div></div></div><p> The parallel mode STL algorithms are currently not exception-safe, - i.e. user-defined functors must not throw exceptions. - Also, the order of execution is not guaranteed for some functions, of course. - Therefore, user-defined functors should not have any concurrent side effects. -Index: libstdc++-v3/doc/html/manual/std_contents.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/std_contents.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/std_contents.html (.../branches/gcc-4_8-branch) -@@ -1,9 +1,9 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part II. Standard Contents</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="debug.html" title="Debugging Support" /><link rel="next" href="support.html" title="Chapter 4. Support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part II. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part II. Standard Contents</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="debug.html" title="Debugging Support" /><link rel="next" href="support.html" title="Chapter 4. Support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part II. - Standard Contents - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library Manual</th><td width="20%" align="right"> <a accesskey="n" href="support.html">Next</a></td></tr></table><hr /></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="manual.std"></a>Part II. - Standard Contents -- </h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="chapter"><a href="support.html">4. -+ </h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="support.html">4. - Support - - </a></span></dt><dd><dl><dt><span class="section"><a href="support.html#std.support.types">Types</a></span></dt><dd><dl><dt><span class="section"><a href="support.html#std.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.numeric_limits">Numeric Properties</a></span></dt><dt><span class="section"><a href="support.html#std.support.types.null">NULL</a></span></dt></dl></dd><dt><span class="section"><a href="dynamic_memory.html">Dynamic Memory</a></span></dt><dt><span class="section"><a href="termination.html">Termination</a></span></dt><dd><dl><dt><span class="section"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="section"><a href="termination.html#support.termination.verbose">Verbose Terminate Handler</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="diagnostics.html">5. -@@ -12,13 +12,13 @@ - </a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="section"><a href="concept_checking.html">Concept Checking</a></span></dt></dl></dd><dt><span class="chapter"><a href="utilities.html">6. - Utilities - --</a></span></dt><dd><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp13920976">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idp13924528">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp13937824">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15512272">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idp15534784">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idp15542080">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp15556704">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15573056">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idp15576640">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="strings.html">7. -+</a></span></dt><dd><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270001611968">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idm270001608416">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm270001595120">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270000019344">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999996832">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idm269999989536">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999974912">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm269999958496">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idm269999954912">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="strings.html">7. - Strings - - </a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="localization.html">8. - Localization - --</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idp15778336">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="containers.html">9. -+</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idm269999753024">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="containers.html">9. - Containers - - </a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="section"><a href="containers.html#containers.sequences.vector">vector</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="associative.html">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="section"><a href="associative.html#containers.associative.bitset">bitset</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="section"><a href="associative.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="unordered_associative.html">Unordered Associative</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.hash">Hash Code</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.cache">Hash Code Caching Policy</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="iterators.html">10. -Index: libstdc++-v3/doc/html/manual/appendix.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix.html (.../branches/gcc-4_8-branch) -@@ -1,9 +1,9 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part IV. Appendices</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="ext_concurrency_use.html" title="Use" /><link rel="next" href="appendix_contributing.html" title="Appendix A. Contributing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part IV. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part IV. Appendices</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="ext_concurrency_use.html" title="Use" /><link rel="next" href="appendix_contributing.html" title="Appendix A. Contributing" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part IV. - Appendices - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_concurrency_use.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library Manual</th><td width="20%" align="right"> <a accesskey="n" href="appendix_contributing.html">Next</a></td></tr></table><hr /></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="appendix"></a>Part IV. - Appendices --</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="appendix"><a href="appendix_contributing.html">A. -+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="appendix"><a href="appendix_contributing.html">A. - Contributing - - </a></span></dt><dd><dl><dt><span class="section"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="section"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="section"><a href="source_organization.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="section"><a href="source_code_style.html">Coding Style</a></span></dt><dd><dl><dt><span class="section"><a href="source_code_style.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="section"><a href="source_code_style.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="section"><a href="source_design_notes.html">Design Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendix_porting.html">B. -Index: libstdc++-v3/doc/html/manual/memory.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/memory.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/memory.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Memory</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="pairs.html" title="Pairs" /><link rel="next" href="traits.html" title="Traits" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Memory</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pairs.html">Prev</a> </td><th width="60%" align="center">Chapter 6. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Memory</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="pairs.html" title="Pairs" /><link rel="next" href="traits.html" title="Traits" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Memory</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pairs.html">Prev</a> </td><th width="60%" align="center">Chapter 6. - Utilities - - </th><td width="20%" align="right"> <a accesskey="n" href="traits.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.memory"></a>Memory</h2></div></div></div><p> -@@ -92,7 +92,7 @@ - or loading and unloading shared objects in memory. As such, using - caching allocators on systems that do not support - <code class="function">abi::__cxa_atexit</code> is not recommended. -- </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp13920976"></a>Interface Design</h5></div></div></div><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm270001611968"></a>Interface Design</h5></div></div></div><p> - The only allocator interface that - is supported is the standard C++ interface. As such, all STL - containers have been adjusted, and all external allocators have -@@ -105,7 +105,7 @@ - </p><p> - The base class that <code class="classname">allocator</code> is derived from - may not be user-configurable. --</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp13924528"></a>Selecting Default Allocation Policy</h5></div></div></div><p> -+</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm270001608416"></a>Selecting Default Allocation Policy</h5></div></div></div><p> - It's difficult to pick an allocation strategy that will provide - maximum utility, without excessively penalizing some behavior. In - fact, it's difficult just deciding which typical actions to measure -@@ -142,7 +142,7 @@ - The current default choice for - <code class="classname">allocator</code> is - <code class="classname">__gnu_cxx::new_allocator</code>. -- </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp13937824"></a>Disabling Memory Caching</h5></div></div></div><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm270001595120"></a>Disabling Memory Caching</h5></div></div></div><p> - In use, <code class="classname">allocator</code> may allocate and - deallocate using implementation-specific strategies and - heuristics. Because of this, a given call to an allocator object's -@@ -309,33 +309,33 @@ - of the used and unused memory locations. It has its own - <a class="link" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator">chapter</a> - in the documentation. -- </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp13992848"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="allocator.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm270000084224"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 14882:1998 Programming languages - C++ - </em>. </span> - isoc++_1998 -- <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="idp13994688"></a><p><span class="title"><em> -- <a class="link" href="http://www.drdobbs.com/cpp/184403759" target="_top"> -+ <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="idm270000082384"></a><p><span class="title"><em> -+ <a class="link" href="http://www.drdobbs.com/the-standard-librarian-what-are-allocato/184403759" target="_top"> - The Standard Librarian: What Are Allocators Good For? - </a> - </em>. </span><span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername"> - C/C++ Users Journal -- . </span></span></p></div><div class="biblioentry"><a id="idp13998416"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270000078608"></a><p><span class="title"><em> - <a class="link" href="http://www.hoard.org/" target="_top"> - The Hoard Memory Allocator - </a> -- </em>. </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span></p></div><div class="biblioentry"><a id="idp14001184"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span></p></div><div class="biblioentry"><a id="idm270000075840"></a><p><span class="title"><em> - <a class="link" href="http://people.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf" target="_top"> - Reconsidering Custom Memory Allocation - </a> -- </em>. </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span></p></div><div class="biblioentry"><a id="idp14007344"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span></p></div><div class="biblioentry"><a id="idm270000069680"></a><p><span class="title"><em> - <a class="link" href="http://www.angelikalanger.com/Articles/C++Report/Allocators/Allocators.html" target="_top"> - Allocator Types - </a> - </em>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="publisher"><span class="publishername"> - C/C++ Users Journal -- . </span></span></p></div><div class="biblioentry"><a id="idp14012080"></a><p><span class="citetitle"><em class="citetitle">The C++ Programming Language</em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm270000064944"></a><p><span class="citetitle"><em class="citetitle">The C++ Programming Language</em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername"> - Addison Wesley -- . </span></span></p></div><div class="biblioentry"><a id="idp14016512"></a><p><span class="citetitle"><em class="citetitle">Yalloc: A Recycling C++ Allocator</em>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span></p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.util.memory.auto_ptr"></a>auto_ptr</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="auto_ptr.limitations"></a>Limitations</h4></div></div></div><p>Explaining all of the fun and delicious things that can -+ . </span></span></p></div><div class="biblioentry"><a id="idm270000060512"></a><p><span class="citetitle"><em class="citetitle">Yalloc: A Recycling C++ Allocator</em>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span></p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.util.memory.auto_ptr"></a>auto_ptr</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="auto_ptr.limitations"></a>Limitations</h4></div></div></div><p>Explaining all of the fun and delicious things that can - happen with misuse of the <code class="classname">auto_ptr</code> class - template (called <acronym class="acronym">AP</acronym> here) would take some - time. Suffice it to say that the use of <acronym class="acronym">AP</acronym> -@@ -445,7 +445,7 @@ - Derived classes override those functions to destroy resources in a context - where the correct dynamic type is known. This is an application of the - technique known as type erasure. -- </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15512272"></a>Class Hierarchy</h5></div></div></div><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm270000019344"></a>Class Hierarchy</h5></div></div></div><p> - A <code class="classname">shared_ptr<T></code> contains a pointer of - type <span class="type">T*</span> and an object of type - <code class="classname">__shared_count</code>. The shared_count contains a -@@ -492,9 +492,9 @@ - aliasing constructor, make_shared & allocate_shared. Additionally, - the constructors taking <code class="classname">auto_ptr</code> parameters are - deprecated in C++11 mode. -- </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15534784"></a>Thread Safety</h5></div></div></div><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999996832"></a>Thread Safety</h5></div></div></div><p> - The --<a class="link" href="http://boost.org/libs/smart_ptr/shared_ptr.htm#ThreadSafety" target="_top">Thread -+<a class="link" href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm#ThreadSafety" target="_top">Thread - Safety</a> section of the Boost shared_ptr documentation says "shared_ptr - objects offer the same level of thread safety as built-in types." - The implementation must ensure that concurrent updates to separate shared_ptr -@@ -537,7 +537,7 @@ - shared_ptr in libstdc++ the compiler and library are fixed, which - makes things much simpler: we have an atomic CAS or we don't, see Lock - Policy below for details. --</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15542080"></a>Selecting Lock Policy</h5></div></div></div><p> -+</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999989536"></a>Selecting Lock Policy</h5></div></div></div><p> - </p><p> - There is a single <code class="classname">_Sp_counted_base</code> class, - which is a template parameterized on the enum -@@ -578,7 +578,7 @@ - <code class="filename">ext/atomicity.h</code>, which detect if the program - is multi-threaded. If only one thread of execution exists in - the program then less expensive non-atomic operations are used. -- </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15556704"></a>Related functions and classes</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>, -+ </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999974912"></a>Related functions and classes</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>, - <code class="code">const_pointer_cast</code></span></dt><dd><p> - As noted in N2351, these functions can be implemented non-intrusively using - the alias constructor. However the aliasing constructor is only available -@@ -611,13 +611,13 @@ - As well as the extra constructors, this implementation also needs some - members of _Sp_counted_deleter to be protected where they could otherwise - be private. -- </p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.using"></a>Use</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15573056"></a>Examples</h5></div></div></div><p> -+ </p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.using"></a>Use</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999958496"></a>Examples</h5></div></div></div><p> - Examples of use can be found in the testsuite, under - <code class="filename">testsuite/tr1/2_general_utilities/shared_ptr</code>, - <code class="filename">testsuite/20_util/shared_ptr</code> - and - <code class="filename">testsuite/20_util/weak_ptr</code>. -- </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15576640"></a>Unresolved Issues</h5></div></div></div><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999954912"></a>Unresolved Issues</h5></div></div></div><p> - The <span class="emphasis"><em><code class="classname">shared_ptr</code> atomic access</em></span> - clause in the C++11 standard is not implemented in GCC. - </p><p> -@@ -658,25 +658,25 @@ - code to work with, Peter Dimov in particular for his help and - invaluable advice on thread safety. Phillip Jordan and Paolo - Carlini for the lock policy implementation. -- </p></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp15587936"></a><p><span class="title"><em> -+ </p></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm269999943680"></a><p><span class="title"><em> - <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm" target="_top"> - Improving shared_ptr for C++0x, Revision 2 - </a> - </em>. </span><span class="subtitle"> - N2351 -- . </span></p></div><div class="biblioentry"><a id="idp15590224"></a><p><span class="title"><em> -+ . </span></p></div><div class="biblioentry"><a id="idm269999941392"></a><p><span class="title"><em> - <a class="link" href="http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2456.html" target="_top"> - C++ Standard Library Active Issues List - </a> - </em>. </span><span class="subtitle"> - N2456 -- . </span></p></div><div class="biblioentry"><a id="idp15592512"></a><p><span class="title"><em> -+ . </span></p></div><div class="biblioentry"><a id="idm269999939104"></a><p><span class="title"><em> - <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf" target="_top"> - Working Draft, Standard for Programming Language C++ - </a> - </em>. </span><span class="subtitle"> - N2461 -- . </span></p></div><div class="biblioentry"><a id="idp15594816"></a><p><span class="title"><em> -+ . </span></p></div><div class="biblioentry"><a id="idm269999936800"></a><p><span class="title"><em> - <a class="link" href="http://boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"> - Boost C++ Libraries documentation, shared_ptr - </a> -Index: libstdc++-v3/doc/html/manual/api.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/api.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/api.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>API Evolution and Deprecation History</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, api, evolution, deprecation, history" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="abi.html" title="ABI Policy and Guidelines" /><link rel="next" href="backwards.html" title="Backwards Compatibility" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">API Evolution and Deprecation History</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="abi.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>API Evolution and Deprecation History</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, api, evolution, deprecation, history" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="abi.html" title="ABI Policy and Guidelines" /><link rel="next" href="backwards.html" title="Backwards Compatibility" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">API Evolution and Deprecation History</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="abi.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="backwards.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.api"></a>API Evolution and Deprecation History</h2></div></div></div><p> -@@ -77,11 +77,11 @@ - <span class="type">__alloc</span> to select an underlying allocator that - satisfied memory allocation requests. The selection of this - underlying allocator was not user-configurable. -- </p><div class="table"><a id="idp23030528"></a><p class="title"><strong>Table B.6. Extension Allocators</strong></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator<T></code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator<T></code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template<int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator<T></code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc<T></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc<T></code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template<bool,int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc<T></code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator<T></code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection -+ </p><div class="table"><a id="idm269992502096"></a><p class="title"><strong>Table B.6. Extension Allocators</strong></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator<T></code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator<T></code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template<int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator<T></code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc<T></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc<T></code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template<bool,int></code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc<T></code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator<T></code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection - of available allocators. All of these new allocators are - standard-style. The following table includes details, along with - the first released version of GCC that included the extension allocator. -- </p><div class="table"><a id="idp23058160"></a><p class="title"><strong>Table B.7. Extension Allocators Continued</strong></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator<T></code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator<T></code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p> -+ </p><div class="table"><a id="idm269992474464"></a><p class="title"><strong>Table B.7. Extension Allocators Continued</strong></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator<T></code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator<T></code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p> - Debug mode first appears. - </p><p> - Precompiled header support <acronym class="acronym">PCH</acronym> support. -Index: libstdc++-v3/doc/html/manual/source_organization.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/source_organization.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/source_organization.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Directory Layout and Source Conventions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="next" href="source_code_style.html" title="Coding Style" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Directory Layout and Source Conventions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_contributing.html">Prev</a> </td><th width="60%" align="center">Appendix A. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Directory Layout and Source Conventions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="next" href="source_code_style.html" title="Coding Style" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Directory Layout and Source Conventions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_contributing.html">Prev</a> </td><th width="60%" align="center">Appendix A. - Contributing - - </th><td width="20%" align="right"> <a accesskey="n" href="source_code_style.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="contrib.organization"></a>Directory Layout and Source Conventions</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/fstreams.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/fstreams.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/fstreams.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>File Based Streams</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="stringstreams.html" title="Memory Based Streams" /><link rel="next" href="io_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">File Based Streams</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="stringstreams.html">Prev</a> </td><th width="60%" align="center">Chapter 13. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>File Based Streams</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="stringstreams.html" title="Memory Based Streams" /><link rel="next" href="io_and_c.html" title="Interacting with C" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">File Based Streams</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="stringstreams.html">Prev</a> </td><th width="60%" align="center">Chapter 13. - Input and Output - - </th><td width="20%" align="right"> <a accesskey="n" href="io_and_c.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.filestreams"></a>File Based Streams</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.io.filestreams.copying_a_file"></a>Copying a File</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/ext_demangling.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_demangling.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_demangling.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 29. Demangling</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_io.html" title="Chapter 28. Input and Output" /><link rel="next" href="ext_concurrency.html" title="Chapter 30. Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 29. Demangling</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_io.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 29. Demangling</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_io.html" title="Chapter 28. Input and Output" /><link rel="next" href="ext_concurrency.html" title="Chapter 30. Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 29. Demangling</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_io.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.demangle"></a>Chapter 29. Demangling</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/ext_preface.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_preface.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_preface.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="extensions.html" title="Part III. Extensions" /><link rel="next" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="extensions.html" title="Part III. Extensions" /><link rel="next" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="idp16425920"></a></h1></div></div></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="idm269999105296"></a></h1></div></div></div><p> - Here we will make an attempt at describing the non-Standard - extensions to the library. Some of these are from older versions of - standard library components, namely SGI's STL, and some of these are -Index: libstdc++-v3/doc/html/manual/concept_checking.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/concept_checking.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/concept_checking.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Concept Checking</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="diagnostics.html" title="Chapter 5. Diagnostics" /><link rel="prev" href="diagnostics.html" title="Chapter 5. Diagnostics" /><link rel="next" href="utilities.html" title="Chapter 6. Utilities" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Concept Checking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="diagnostics.html">Prev</a> </td><th width="60%" align="center">Chapter 5. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Concept Checking</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="diagnostics.html" title="Chapter 5. Diagnostics" /><link rel="prev" href="diagnostics.html" title="Chapter 5. Diagnostics" /><link rel="next" href="utilities.html" title="Chapter 6. Utilities" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Concept Checking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="diagnostics.html">Prev</a> </td><th width="60%" align="center">Chapter 5. - Diagnostics - - </th><td width="20%" align="right"> <a accesskey="n" href="utilities.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.diagnostics.concept_checking"></a>Concept Checking</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/mt_allocator_ex_multi.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/mt_allocator_ex_multi.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/mt_allocator_ex_multi.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Multiple Thread Example</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_ex_single.html" title="Single Thread Example" /><link rel="next" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Multiple Thread Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_ex_single.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="bitmap_allocator.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.example_multi"></a>Multiple Thread Example</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Multiple Thread Example</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_ex_single.html" title="Single Thread Example" /><link rel="next" href="bitmap_allocator.html" title="Chapter 21. The bitmap_allocator" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Multiple Thread Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_ex_single.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="bitmap_allocator.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.example_multi"></a>Multiple Thread Example</h2></div></div></div><p> - In the ST example we never used the thread_id variable present in each block. - Let's start by explaining the purpose of this in a MT application. - </p><p> -Index: libstdc++-v3/doc/html/manual/ext_compile_checks.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_compile_checks.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_compile_checks.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 16. Compile Time Checks</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_preface.html" title="" /><link rel="next" href="debug_mode.html" title="Chapter 17. Debug Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 16. Compile Time Checks</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_preface.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 16. Compile Time Checks</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_preface.html" title="" /><link rel="next" href="debug_mode.html" title="Chapter 17. Debug Mode" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 16. Compile Time Checks</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_preface.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="debug_mode.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.compile_checks"></a>Chapter 16. Compile Time Checks</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/strings.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/strings.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/strings.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 7. Strings</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="traits.html" title="Traits" /><link rel="next" href="localization.html" title="Chapter 8. Localization" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 7. Strings</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="traits.html" title="Traits" /><link rel="next" href="localization.html" title="Chapter 8. Localization" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. - Strings - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="traits.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="localization.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.strings"></a>Chapter 7. - Strings -- <a id="idp15603440" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.strings.string"></a>String Classes</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="strings.string.simple"></a>Simple Transformations</h3></div></div></div><p> -+ <a id="idm269999928112" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.strings.string"></a>String Classes</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="strings.string.simple"></a>Simple Transformations</h3></div></div></div><p> - Here are Standard, simple, and portable ways to perform common - transformations on a <code class="code">string</code> instance, such as - "convert to all upper case." The word transformations -Index: libstdc++-v3/doc/html/manual/containers_and_c.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/containers_and_c.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/containers_and_c.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="unordered_associative.html" title="Unordered Associative" /><link rel="next" href="iterators.html" title="Chapter 10. Iterators" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="unordered_associative.html">Prev</a> </td><th width="60%" align="center">Chapter 9. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="containers.html" title="Chapter 9. Containers" /><link rel="prev" href="unordered_associative.html" title="Unordered Associative" /><link rel="next" href="iterators.html" title="Chapter 10. Iterators" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="unordered_associative.html">Prev</a> </td><th width="60%" align="center">Chapter 9. - Containers - - </th><td width="20%" align="right"> <a accesskey="n" href="iterators.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.c"></a>Interacting with C</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="containers.c.vs_array"></a>Containers vs. Arrays</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/profile_mode_diagnostics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_diagnostics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_diagnostics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Diagnostics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_devel.html" title="Developer Information" /><link rel="next" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Diagnostics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_devel.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.diagnostics"></a>Diagnostics</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Diagnostics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_devel.html" title="Developer Information" /><link rel="next" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Diagnostics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_devel.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.diagnostics"></a>Diagnostics</h2></div></div></div><p> - The table below presents all the diagnostics we intend to implement. - Each diagnostic has a corresponding compile time switch - <code class="code">-D_GLIBCXX_PROFILE_<diagnostic></code>. -@@ -17,7 +17,7 @@ - A high accuracy means that the diagnostic is unlikely to be wrong. - These grades are not perfect. They are just meant to guide users with - specific needs or time budgets. -- </p><div class="table"><a id="idp17088912"></a><p class="title"><strong>Table 19.2. Profile Diagnostics</strong></p><div class="table-contents"><table summary="Profile Diagnostics" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /><col align="left" class="c6" /><col align="left" class="c7" /></colgroup><thead><tr><th align="left">Group</th><th align="left">Flag</th><th align="left">Benefit</th><th align="left">Cost</th><th align="left">Freq.</th><th align="left">Implemented</th><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><a class="link" href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.containers" title="Containers"> -+ </p><div class="table"><a id="idm269998442544"></a><p class="title"><strong>Table 19.2. Profile Diagnostics</strong></p><div class="table-contents"><table summary="Profile Diagnostics" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /><col align="left" class="c6" /><col align="left" class="c7" /></colgroup><thead><tr><th align="left">Group</th><th align="left">Flag</th><th align="left">Benefit</th><th align="left">Cost</th><th align="left">Freq.</th><th align="left">Implemented</th><td class="auto-generated"> </td></tr></thead><tbody><tr><td align="left"><a class="link" href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.containers" title="Containers"> - CONTAINERS</a></td><td align="left"><a class="link" href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_small" title="Hashtable Too Small"> - HASHTABLE_TOO_SMALL</a></td><td align="left">10</td><td align="left">1</td><td align="left"> </td><td align="left">10</td><td align="left">yes</td></tr><tr><td align="left"> </td><td align="left"><a class="link" href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_large" title="Hashtable Too Large"> - HASHTABLE_TOO_LARGE</a></td><td align="left">5</td><td align="left">1</td><td align="left"> </td><td align="left">10</td><td align="left">yes</td></tr><tr><td align="left"> </td><td align="left"><a class="link" href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.inefficient_hash" title="Inefficient Hash"> -@@ -374,7 +374,7 @@ - Quick Sort for a particular call context. - </p></li><li class="listitem"><p><span class="emphasis"><em>Fundamentals:</em></span> - See papers: -- <a class="link" href="http://portal.acm.org/citation.cfm?doid=1065944.1065981" target="_top"> -+ <a class="link" href="https://dl.acm.org/citation.cfm?doid=1065944.1065981" target="_top"> - A framework for adaptive algorithm selection in STAPL</a> and - <a class="link" href="http://ieeexplore.ieee.org/search/wrapper.jsp?arnumber=4228227" target="_top"> - Optimizing Sorting with Machine Learning Algorithms</a>. -@@ -500,7 +500,7 @@ - Keep a shadow for each container. Record iterator dereferences and - container member accesses. Issue advice for elements referenced by - multiple threads. -- See paper: <a class="link" href="http://portal.acm.org/citation.cfm?id=207110.207148" target="_top"> -+ See paper: <a class="link" href="https://dl.acm.org/citation.cfm?id=207110.207148" target="_top"> - The LRPD test: speculative run-time parallelization of loops with - privatization and reduction parallelization</a>. - </p></li><li class="listitem"><p><span class="emphasis"><em>Cost model:</em></span> -Index: libstdc++-v3/doc/html/manual/ext_concurrency_impl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_concurrency_impl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_concurrency_impl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="prev" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="next" href="ext_concurrency_use.html" title="Use" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 30. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency_use.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.atomic_fallbacks"></a>Using Builtin Atomic Functions</h3></div></div></div><p>The functions for atomic operations described above are either -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="prev" href="ext_concurrency.html" title="Chapter 30. Concurrency" /><link rel="next" href="ext_concurrency_use.html" title="Use" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_concurrency.html">Prev</a> </td><th width="60%" align="center">Chapter 30. Concurrency</th><td width="20%" align="right"> <a accesskey="n" href="ext_concurrency_use.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.concurrency.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.concurrency.impl.atomic_fallbacks"></a>Using Builtin Atomic Functions</h3></div></div></div><p>The functions for atomic operations described above are either - implemented via compiler intrinsics (if the underlying host is - capable) or by library fallbacks.</p><p>Compiler intrinsics (builtins) are always preferred. However, as - the compiler builtins for atomics are not universally implemented, -Index: libstdc++-v3/doc/html/manual/io_and_c.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/io_and_c.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/io_and_c.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="fstreams.html" title="File Based Streams" /><link rel="next" href="atomics.html" title="Chapter 14. Atomics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="fstreams.html">Prev</a> </td><th width="60%" align="center">Chapter 13. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="fstreams.html" title="File Based Streams" /><link rel="next" href="atomics.html" title="Chapter 14. Atomics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="fstreams.html">Prev</a> </td><th width="60%" align="center">Chapter 13. - Input and Output - - </th><td width="20%" align="right"> <a accesskey="n" href="atomics.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.c"></a>Interacting with C</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.io.c.FILE"></a>Using FILE* and file descriptors</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/documentation_hacking.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/documentation_hacking.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/documentation_hacking.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Writing and Generating Documentation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, documentation, style, docbook, doxygen" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="next" href="internals.html" title="Porting to New Hardware or Operating Systems" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Writing and Generating Documentation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_porting.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Writing and Generating Documentation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, documentation, style, docbook, doxygen" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="next" href="internals.html" title="Porting to New Hardware or Operating Systems" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Writing and Generating Documentation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_porting.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.doc"></a>Writing and Generating Documentation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doc.intro"></a>Introduction</h3></div></div></div><p> -@@ -112,7 +112,7 @@ - supported, and are always aliased to dummy rules. These - unsupported formats are: <span class="emphasis"><em>info</em></span>, - <span class="emphasis"><em>ps</em></span>, and <span class="emphasis"><em>dvi</em></span>. -- </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doc.doxygen"></a>Doxygen</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.prereq"></a>Prerequisites</h4></div></div></div><div class="table"><a id="idp22162432"></a><p class="title"><strong>Table B.1. Doxygen Prerequisites</strong></p><div class="table-contents"><table summary="Doxygen Prerequisites" border="1"><colgroup><col align="center" class="c1" /><col align="center" class="c2" /><col align="center" class="c3" /></colgroup><thead><tr><th align="center">Tool</th><th align="center">Version</th><th align="center">Required By</th></tr></thead><tbody><tr><td align="center">coreutils</td><td align="center">8.5</td><td align="center">all</td></tr><tr><td align="center">bash</td><td align="center">4.1</td><td align="center">all</td></tr><tr><td align="center">doxygen</td><td align="center">1.7.6.1</td><td align="center">all</td></tr><tr><td align="center">graphviz</td><td align="center">2.26</td><td align="center">graphical hierarchies</td></tr><tr><td align="center">pdflatex</td><td align="center">2007-59</td><td align="center">pdf output</td></tr></tbody></table></div></div><br class="table-break" /><p> -+ </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doc.doxygen"></a>Doxygen</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.prereq"></a>Prerequisites</h4></div></div></div><div class="table"><a id="idm269993370272"></a><p class="title"><strong>Table B.1. Doxygen Prerequisites</strong></p><div class="table-contents"><table summary="Doxygen Prerequisites" border="1"><colgroup><col align="center" class="c1" /><col align="center" class="c2" /><col align="center" class="c3" /></colgroup><thead><tr><th align="center">Tool</th><th align="center">Version</th><th align="center">Required By</th></tr></thead><tbody><tr><td align="center">coreutils</td><td align="center">8.5</td><td align="center">all</td></tr><tr><td align="center">bash</td><td align="center">4.1</td><td align="center">all</td></tr><tr><td align="center">doxygen</td><td align="center">1.7.6.1</td><td align="center">all</td></tr><tr><td align="center">graphviz</td><td align="center">2.26</td><td align="center">graphical hierarchies</td></tr><tr><td align="center">pdflatex</td><td align="center">2007-59</td><td align="center">pdf output</td></tr></tbody></table></div></div><br class="table-break" /><p> - Prerequisite tools are Bash 2.0 or later, - <a class="link" href="http://www.doxygen.org/" target="_top">Doxygen</a>, and - the <a class="link" href="http://www.gnu.org/software/coreutils/" target="_top">GNU -@@ -232,9 +232,8 @@ - member functions. - </p><p> - Some commentary to accompany -- the first list in the <a class="link" href="http://www.stack.nl/~dimitri/doxygen/docblocks.html" target="_top">Special -- Documentation Blocks</a> section of -- the Doxygen manual: -+ the first list in the <a class="link" href="http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html" target="_top">Special -+ Documentation Blocks</a> section of the Doxygen manual: - </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>For longer comments, use the Javadoc style...</p></li><li class="listitem"><p> - ...not the Qt style. The intermediate *'s are preferred. - </p></li><li class="listitem"><p> -@@ -310,7 +309,7 @@ - writing Doxygen comments. Single and double quotes, and - separators in filenames are two common trouble spots. When in - doubt, consult the following table. -- </p><div class="table"><a id="idp22238096"></a><p class="title"><strong>Table B.2. HTML to Doxygen Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Doxygen Markup Comparison" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Doxygen</th></tr></thead><tbody><tr><td align="left">\</td><td align="left">\\</td></tr><tr><td align="left">"</td><td align="left">\"</td></tr><tr><td align="left">'</td><td align="left">\'</td></tr><tr><td align="left"><i></td><td align="left">@a word</td></tr><tr><td align="left"><b></td><td align="left">@b word</td></tr><tr><td align="left"><code></td><td align="left">@c word</td></tr><tr><td align="left"><em></td><td align="left">@a word</td></tr><tr><td align="left"><em></td><td align="left"><em>two words or more</em></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doc.docbook"></a>Docbook</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><div class="table"><a id="idp22257536"></a><p class="title"><strong>Table B.3. Docbook Prerequisites</strong></p><div class="table-contents"><table summary="Docbook Prerequisites" border="1"><colgroup><col align="center" class="c1" /><col align="center" class="c2" /><col align="center" class="c3" /></colgroup><thead><tr><th align="center">Tool</th><th align="center">Version</th><th align="center">Required By</th></tr></thead><tbody><tr><td align="center">docbook5-style-xsl</td><td align="center">1.76.1</td><td align="center">all</td></tr><tr><td align="center">xsltproc</td><td align="center">1.1.26</td><td align="center">all</td></tr><tr><td align="center">xmllint</td><td align="center">2.7.7</td><td align="center">validation</td></tr><tr><td align="center">dblatex</td><td align="center">0.3</td><td align="center">pdf output</td></tr><tr><td align="center">pdflatex</td><td align="center">2007-59</td><td align="center">pdf output</td></tr><tr><td align="center">docbook2X</td><td align="center">0.8.8</td><td align="center">info output</td></tr><tr><td align="center">epub3 stylesheets</td><td align="center">b3</td><td align="center">epub output</td></tr></tbody></table></div></div><br class="table-break" /><p> -+ </p><div class="table"><a id="idm269993294592"></a><p class="title"><strong>Table B.2. HTML to Doxygen Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Doxygen Markup Comparison" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Doxygen</th></tr></thead><tbody><tr><td align="left">\</td><td align="left">\\</td></tr><tr><td align="left">"</td><td align="left">\"</td></tr><tr><td align="left">'</td><td align="left">\'</td></tr><tr><td align="left"><i></td><td align="left">@a word</td></tr><tr><td align="left"><b></td><td align="left">@b word</td></tr><tr><td align="left"><code></td><td align="left">@c word</td></tr><tr><td align="left"><em></td><td align="left">@a word</td></tr><tr><td align="left"><em></td><td align="left"><em>two words or more</em></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doc.docbook"></a>Docbook</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><div class="table"><a id="idm269993275152"></a><p class="title"><strong>Table B.3. Docbook Prerequisites</strong></p><div class="table-contents"><table summary="Docbook Prerequisites" border="1"><colgroup><col align="center" class="c1" /><col align="center" class="c2" /><col align="center" class="c3" /></colgroup><thead><tr><th align="center">Tool</th><th align="center">Version</th><th align="center">Required By</th></tr></thead><tbody><tr><td align="center">docbook5-style-xsl</td><td align="center">1.76.1</td><td align="center">all</td></tr><tr><td align="center">xsltproc</td><td align="center">1.1.26</td><td align="center">all</td></tr><tr><td align="center">xmllint</td><td align="center">2.7.7</td><td align="center">validation</td></tr><tr><td align="center">dblatex</td><td align="center">0.3</td><td align="center">pdf output</td></tr><tr><td align="center">pdflatex</td><td align="center">2007-59</td><td align="center">pdf output</td></tr><tr><td align="center">docbook2X</td><td align="center">0.8.8</td><td align="center">info output</td></tr><tr><td align="center">epub3 stylesheets</td><td align="center">b3</td><td align="center">epub output</td></tr></tbody></table></div></div><br class="table-break" /><p> - Editing the DocBook sources requires an XML editor. Many - exist: some notable options - include <span class="command"><strong>emacs</strong></span>, <span class="application">Kate</span>, -@@ -520,11 +519,11 @@ - <a class="link" href="http://www.docbook.org/tdg/en/html/part2.html" target="_top">online</a>. - An incomplete reference for HTML to Docbook conversion is - detailed in the table below. -- </p><div class="table"><a id="idp22335040"></a><p class="title"><strong>Table B.4. HTML to Docbook XML Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Docbook XML Markup Comparison" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Docbook</th></tr></thead><tbody><tr><td align="left"><p></td><td align="left"><para></td></tr><tr><td align="left"><pre></td><td align="left"><computeroutput>, <programlisting>, -+ </p><div class="table"><a id="idm269993197520"></a><p class="title"><strong>Table B.4. HTML to Docbook XML Markup Comparison</strong></p><div class="table-contents"><table summary="HTML to Docbook XML Markup Comparison" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">Docbook</th></tr></thead><tbody><tr><td align="left"><p></td><td align="left"><para></td></tr><tr><td align="left"><pre></td><td align="left"><computeroutput>, <programlisting>, - <literallayout></td></tr><tr><td align="left"><ul></td><td align="left"><itemizedlist></td></tr><tr><td align="left"><ol></td><td align="left"><orderedlist></td></tr><tr><td align="left"><il></td><td align="left"><listitem></td></tr><tr><td align="left"><dl></td><td align="left"><variablelist></td></tr><tr><td align="left"><dt></td><td align="left"><term></td></tr><tr><td align="left"><dd></td><td align="left"><listitem></td></tr><tr><td align="left"><a href=""></td><td align="left"><ulink url=""></td></tr><tr><td align="left"><code></td><td align="left"><literal>, <programlisting></td></tr><tr><td align="left"><strong></td><td align="left"><emphasis></td></tr><tr><td align="left"><em></td><td align="left"><emphasis></td></tr><tr><td align="left">"</td><td align="left"><quote></td></tr></tbody></table></div></div><br class="table-break" /><p> - And examples of detailed markup for which there are no real HTML - equivalents are listed in the table below. --</p><div class="table"><a id="idp22359184"></a><p class="title"><strong>Table B.5. Docbook XML Element Use</strong></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><structname></td><td align="left"><structname>char_traits</structname></td></tr><tr><td align="left"><classname></td><td align="left"><classname>string</classname></td></tr><tr><td align="left"><function></td><td align="left"> -+</p><div class="table"><a id="idm269993173376"></a><p class="title"><strong>Table B.5. Docbook XML Element Use</strong></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><structname></td><td align="left"><structname>char_traits</structname></td></tr><tr><td align="left"><classname></td><td align="left"><classname>string</classname></td></tr><tr><td align="left"><function></td><td align="left"> - <p><function>clear()</function></p> - <p><function>fs.clear()</function></p> - </td></tr><tr><td align="left"><type></td><td align="left"><type>long long</type></td></tr><tr><td align="left"><varname></td><td align="left"><varname>fs</varname></td></tr><tr><td align="left"><literal></td><td align="left"> -Index: libstdc++-v3/doc/html/manual/extensions.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/extensions.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/extensions.html (.../branches/gcc-4_8-branch) -@@ -1,11 +1,11 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part III. Extensions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="io_and_c.html" title="Interacting with C" /><link rel="next" href="ext_preface.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Part III. Extensions</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="index.html" title="The GNU C++ Library Manual" /><link rel="prev" href="io_and_c.html" title="Interacting with C" /><link rel="next" href="ext_preface.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part III. - Extensions - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="io_and_c.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library Manual</th><td width="20%" align="right"> <a accesskey="n" href="ext_preface.html">Next</a></td></tr></table><hr /></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="manual.ext"></a>Part III. - Extensions -- <a id="idp16423680" class="indexterm"></a> --</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="preface"><a href="ext_preface.html"></a></span></dt><dt><span class="chapter"><a href="ext_compile_checks.html">16. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">17. Debug Mode</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="debug_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="debug_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods">Methods</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.wrappers">The Wrapper Model</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_iter">Safe Iterators</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_seq">Safe Sequences (Containers)</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.precond">Precondition Checking</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.coexistence">Release- and debug-mode coexistence</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.compile">Compile-time coexistence of release- and debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.link">Link- and run-time coexistence of release- and -+ <a id="idm269999107536" class="indexterm"></a> -+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="preface"><a href="ext_preface.html"></a></span></dt><dt><span class="chapter"><a href="ext_compile_checks.html">16. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">17. Debug Mode</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="debug_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="debug_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods">Methods</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.wrappers">The Wrapper Model</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_iter">Safe Iterators</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_seq">Safe Sequences (Containers)</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.precond">Precondition Checking</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.coexistence">Release- and debug-mode coexistence</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.compile">Compile-time coexistence of release- and debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.link">Link- and run-time coexistence of release- and - debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.alt">Alternatives for Coexistence</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">18. Parallel Mode</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="parallel_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.prereq_flags">Prerequisite Compiler Flags</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.specific">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.omp">Setting up the OpenMP Environment</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.compile">Compile Time Switches</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.settings">Run Time Settings and Defaults</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_test.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="profile_mode.html">19. Profile Mode</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.using">Using the Profile Mode</a></span></dt><dt><span class="section"><a href="profile_mode.html#manual.ext.profile_mode.tuning">Tuning the Profile Mode</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.wrapper">Wrapper Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.instrumentation">Instrumentation</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.rtlib">Run Time Behavior</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.analysis">Analysis and Diagnostics</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.cost-model">Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.reports">Reports</a></span></dt><dt><span class="section"><a href="profile_mode_design.html#manual.ext.profile_mode.design.testing">Testing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_api.html">Extensions for Custom Containers</a></span></dt><dt><span class="section"><a href="profile_mode_cost_model.html">Empirical Cost Model</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html">Implementation Issues</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stack">Stack Traces</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.symbols">Symbolization of Instruction Addresses</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.concurrency">Concurrency</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.stdlib-in-proflib">Using the Standard Library in the Instrumentation Implementation</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.malloc-hooks">Malloc Hooks</a></span></dt><dt><span class="section"><a href="profile_mode_impl.html#manual.ext.profile_mode.implementation.construction-destruction">Construction and Destruction of Global Objects</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_devel.html">Developer Information</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.bigpic">Big Picture</a></span></dt><dt><span class="section"><a href="profile_mode_devel.html#manual.ext.profile_mode.developer.howto">How To Add A Diagnostic</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html">Diagnostics</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.template">Diagnostic Template</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.containers">Containers</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_small">Hashtable Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_too_large">Hashtable Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.inefficient_hash">Inefficient Hash</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_small">Vector Too Small</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_too_large">Vector Too Large</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_hashtable">Vector to Hashtable</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.hashtable_to_vector">Hashtable to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.vector_to_list">Vector to List</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_vector">List to Vector</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.list_to_slist">List to Forward List (Slist)</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.assoc_ord_to_unord">Ordered to Unordered Associative Container</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms">Algorithms</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.algorithms.sort">Sort Algorithm Performance</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality">Data Locality</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.sw_prefetch">Need Software Prefetch</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.locality.linked">Linked Structure Locality</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread">Multithreaded Data Access</a></span></dt><dd><dl><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.ddtest">Data Dependence Violations at Container Level</a></span></dt><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.mthread.false_share">False Sharing</a></span></dt></dl></dd><dt><span class="section"><a href="profile_mode_diagnostics.html#manual.ext.profile_mode.analysis.statistics">Statistics</a></span></dt></dl></dd><dt><span class="bibliography"><a href="profile_mode.html#profile_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="mt_allocator.html">20. The mt_allocator</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="section"><a href="mt_allocator_design.html">Design Issues</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_design.html#allocator.mt.overview">Overview</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.tune">Tunable Parameters</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.init">Initialization</a></span></dt><dt><span class="section"><a href="mt_allocator_impl.html#allocator.mt.deallocation">Deallocation Notes</a></span></dt></dl></dd><dt><span class="section"><a href="mt_allocator_ex_single.html">Single Thread Example</a></span></dt><dt><span class="section"><a href="mt_allocator_ex_multi.html">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="chapter"><a href="bitmap_allocator.html">21. The bitmap_allocator</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.free_list_store">Free List Store</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block">Super Block</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.super_block_data">Super Block Data Layout</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.max_wasted">Maximum Wasted Percentage</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.allocate"><code class="function">allocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.deallocate"><code class="function">deallocate</code></a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.questions">Questions</a></span></dt><dd><dl><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.1">1</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.2">2</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.question.3">3</a></span></dt></dl></dd><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.locality">Locality</a></span></dt><dt><span class="section"><a href="bitmap_allocator_impl.html#bitmap.impl.grow_policy">Overhead and Grow Policy</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="policy_data_structures.html">22. Policy-Based Data Structures</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro">Intro</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues">Performance Issues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.associative">Associative</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.issues.priority_queue">Priority Que</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation">Goals</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.associative">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.iterators">Iterators</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.associative.functions">Functional</a></span></dt></dl></dd><dt><span class="section"><a href="policy_data_structures.html#pbds.intro.motivation.priority_queue">Priority Queues</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.policy">Policy Choices</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.underlying">Underlying Data Structures</a></span></dt><dt><span class="section"><a href="policy_data_structures.html#motivation.priority_queue.binary_heap">Binary Heaps</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="section"><a href="policy_data_structures_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.organization">Organization</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial">Tutorial</a></span></dt><dd><dl><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.basic">Basic Use</a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.configuring"> - Configuring via Template Parameters - </a></span></dt><dt><span class="section"><a href="policy_data_structures_using.html#pbds.using.tutorial.traits"> -Index: libstdc++-v3/doc/html/manual/debug_mode_using.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/debug_mode_using.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/debug_mode_using.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode_semantics.html" title="Semantics" /><link rel="next" href="debug_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_semantics.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.using"></a>Using</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Using</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode_semantics.html" title="Semantics" /><link rel="next" href="debug_mode_design.html" title="Design" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_semantics.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_design.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.using"></a>Using</h2></div></div></div><p> - </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="debug_mode.using.mode"></a>Using the Debug Mode</h3></div></div></div><p>To use the libstdc++ debug mode, compile your application with the - compiler flag <code class="code">-D_GLIBCXX_DEBUG</code>. Note that this flag - changes the sizes and behavior of standard class templates such -@@ -18,6 +18,6 @@ - mode or with debug mode. The - following table provides the names and headers of the debugging - containers: --</p><div class="table"><a id="idp16490400"></a><p class="title"><strong>Table 17.1. Debugging Containers</strong></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename"><debug/bitset></code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename"><debug/deque></code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename"><debug/list></code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename"><debug/map></code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename"><debug/map></code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename"><debug/set></code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename"><debug/set></code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename"><debug/vector></code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++11 mode, these additional -+</p><div class="table"><a id="idm269999040896"></a><p class="title"><strong>Table 17.1. Debugging Containers</strong></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename"><debug/bitset></code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename"><debug/deque></code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename"><debug/list></code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename"><debug/map></code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename"><debug/map></code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename"><debug/set></code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename"><debug/set></code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename"><debug/string></code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename"><debug/vector></code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++11 mode, these additional - containers have additional debug capability. --</p><div class="table"><a id="idp16535296"></a><p class="title"><strong>Table 17.2. Debugging Containers C++11</strong></p><div class="table-contents"><table summary="Debugging Containers C++11" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename"><debug/unordered_map></code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename"><debug/unordered_map></code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename"><debug/unordered_set></code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename"><debug/unordered_set></code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="debug_mode_semantics.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="debug_mode_design.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> -\ No newline at end of file -+</p><div class="table"><a id="idm269998996000"></a><p class="title"><strong>Table 17.2. Debugging Containers C++11</strong></p><div class="table-contents"><table summary="Debugging Containers C++11" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename"><debug/unordered_map></code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename"><debug/unordered_map></code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename"><debug/unordered_set></code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename"><debug/unordered_set></code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="debug_mode_semantics.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="debug_mode_design.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html> -\ No newline at end of file -Index: libstdc++-v3/doc/html/manual/parallel_mode.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/parallel_mode.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/parallel_mode.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 18. Parallel Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="debug_mode_design.html" title="Design" /><link rel="next" href="parallel_mode_semantics.html" title="Semantics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 18. Parallel Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_design.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 18. Parallel Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, parallel" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="debug_mode_design.html" title="Design" /><link rel="next" href="parallel_mode_semantics.html" title="Semantics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 18. Parallel Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode_design.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_semantics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.parallel_mode"></a>Chapter 18. Parallel Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="parallel_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.prereq_flags">Prerequisite Compiler Flags</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.specific">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.omp">Setting up the OpenMP Environment</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.compile">Compile Time Switches</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.settings">Run Time Settings and Defaults</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_test.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></div><p> The libstdc++ parallel mode is an experimental parallel -+</th><td width="20%" align="right"> <a accesskey="n" href="parallel_mode_semantics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.parallel_mode"></a>Chapter 18. Parallel Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="parallel_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.prereq_flags">Prerequisite Compiler Flags</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="section"><a href="parallel_mode_using.html#parallel_mode.using.specific">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dd><dl><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.omp">Setting up the OpenMP Environment</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.compile">Compile Time Switches</a></span></dt><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.tuning.settings">Run Time Settings and Defaults</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_design.html#parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="section"><a href="parallel_mode_test.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></div><p> The libstdc++ parallel mode is an experimental parallel - implementation of many algorithms the C++ Standard Library. - </p><p> - Several of the standard algorithms, for instance -@@ -12,11 +12,11 @@ - specific compiler flag. - </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.intro"></a>Intro</h2></div></div></div><p>The following library components in the include - <code class="filename">numeric</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="function">std::accumulate</code></p></li><li class="listitem"><p><code class="function">std::adjacent_difference</code></p></li><li class="listitem"><p><code class="function">std::inner_product</code></p></li><li class="listitem"><p><code class="function">std::partial_sum</code></p></li></ul></div><p>The following library components in the include --<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="function">std::adjacent_find</code></p></li><li class="listitem"><p><code class="function">std::count</code></p></li><li class="listitem"><p><code class="function">std::count_if</code></p></li><li class="listitem"><p><code class="function">std::equal</code></p></li><li class="listitem"><p><code class="function">std::find</code></p></li><li class="listitem"><p><code class="function">std::find_if</code></p></li><li class="listitem"><p><code class="function">std::find_first_of</code></p></li><li class="listitem"><p><code class="function">std::for_each</code></p></li><li class="listitem"><p><code class="function">std::generate</code></p></li><li class="listitem"><p><code class="function">std::generate_n</code></p></li><li class="listitem"><p><code class="function">std::lexicographical_compare</code></p></li><li class="listitem"><p><code class="function">std::mismatch</code></p></li><li class="listitem"><p><code class="function">std::search</code></p></li><li class="listitem"><p><code class="function">std::search_n</code></p></li><li class="listitem"><p><code class="function">std::transform</code></p></li><li class="listitem"><p><code class="function">std::replace</code></p></li><li class="listitem"><p><code class="function">std::replace_if</code></p></li><li class="listitem"><p><code class="function">std::max_element</code></p></li><li class="listitem"><p><code class="function">std::merge</code></p></li><li class="listitem"><p><code class="function">std::min_element</code></p></li><li class="listitem"><p><code class="function">std::nth_element</code></p></li><li class="listitem"><p><code class="function">std::partial_sort</code></p></li><li class="listitem"><p><code class="function">std::partition</code></p></li><li class="listitem"><p><code class="function">std::random_shuffle</code></p></li><li class="listitem"><p><code class="function">std::set_union</code></p></li><li class="listitem"><p><code class="function">std::set_intersection</code></p></li><li class="listitem"><p><code class="function">std::set_symmetric_difference</code></p></li><li class="listitem"><p><code class="function">std::set_difference</code></p></li><li class="listitem"><p><code class="function">std::sort</code></p></li><li class="listitem"><p><code class="function">std::stable_sort</code></p></li><li class="listitem"><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="idp16926864"></a><p><span class="citetitle"><em class="citetitle"> -+<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="function">std::adjacent_find</code></p></li><li class="listitem"><p><code class="function">std::count</code></p></li><li class="listitem"><p><code class="function">std::count_if</code></p></li><li class="listitem"><p><code class="function">std::equal</code></p></li><li class="listitem"><p><code class="function">std::find</code></p></li><li class="listitem"><p><code class="function">std::find_if</code></p></li><li class="listitem"><p><code class="function">std::find_first_of</code></p></li><li class="listitem"><p><code class="function">std::for_each</code></p></li><li class="listitem"><p><code class="function">std::generate</code></p></li><li class="listitem"><p><code class="function">std::generate_n</code></p></li><li class="listitem"><p><code class="function">std::lexicographical_compare</code></p></li><li class="listitem"><p><code class="function">std::mismatch</code></p></li><li class="listitem"><p><code class="function">std::search</code></p></li><li class="listitem"><p><code class="function">std::search_n</code></p></li><li class="listitem"><p><code class="function">std::transform</code></p></li><li class="listitem"><p><code class="function">std::replace</code></p></li><li class="listitem"><p><code class="function">std::replace_if</code></p></li><li class="listitem"><p><code class="function">std::max_element</code></p></li><li class="listitem"><p><code class="function">std::merge</code></p></li><li class="listitem"><p><code class="function">std::min_element</code></p></li><li class="listitem"><p><code class="function">std::nth_element</code></p></li><li class="listitem"><p><code class="function">std::partial_sort</code></p></li><li class="listitem"><p><code class="function">std::partition</code></p></li><li class="listitem"><p><code class="function">std::random_shuffle</code></p></li><li class="listitem"><p><code class="function">std::set_union</code></p></li><li class="listitem"><p><code class="function">std::set_intersection</code></p></li><li class="listitem"><p><code class="function">std::set_symmetric_difference</code></p></li><li class="listitem"><p><code class="function">std::set_difference</code></p></li><li class="listitem"><p><code class="function">std::sort</code></p></li><li class="listitem"><p><code class="function">std::stable_sort</code></p></li><li class="listitem"><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="idm269998604464"></a><p><span class="citetitle"><em class="citetitle"> - Parallelization of Bulk Operations for STL Dictionaries - </em>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Leonor</span> <span class="surname">Frias</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername"> - Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS) -- . </span></span></p></div><div class="biblioentry"><a id="idp16931936"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269998599392"></a><p><span class="citetitle"><em class="citetitle"> - The Multi-Core Standard Template Library - </em>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Peter</span> <span class="surname">Sanders</span>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Putze</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername"> - Euro-Par 2007: Parallel Processing. (LNCS 4641) -Index: libstdc++-v3/doc/html/manual/debug_mode_semantics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/debug_mode_semantics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/debug_mode_semantics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Semantics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="next" href="debug_mode_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Semantics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.semantics"></a>Semantics</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Semantics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="prev" href="debug_mode.html" title="Chapter 17. Debug Mode" /><link rel="next" href="debug_mode_using.html" title="Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Semantics</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 17. Debug Mode</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.semantics"></a>Semantics</h2></div></div></div><p> - </p><p>A program that uses the C++ standard library correctly - will maintain the same semantics under debug mode as it had with - the normal (release) library. All functional and exception-handling -Index: libstdc++-v3/doc/html/manual/setup.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/setup.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/setup.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 2. Setup</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="bugs.html" title="Bugs" /><link rel="next" href="configure.html" title="Configure" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Setup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bugs.html">Prev</a> </td><th width="60%" align="center">Part I. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 2. Setup</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I. Introduction" /><link rel="prev" href="bugs.html" title="Bugs" /><link rel="next" href="configure.html" title="Configure" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Setup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bugs.html">Prev</a> </td><th width="60%" align="center">Part I. - Introduction - --</th><td width="20%" align="right"> <a accesskey="n" href="configure.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.setup"></a>Chapter 2. Setup</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></div><p>To transform libstdc++ sources into installed include files -+</th><td width="20%" align="right"> <a accesskey="n" href="configure.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.setup"></a>Chapter 2. Setup</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></div><p>To transform libstdc++ sources into installed include files - and properly built binaries useful for linking to other software is - a multi-step process. Steps include getting the sources, - configuring and building the sources, testing, and installation. -Index: libstdc++-v3/doc/html/manual/backwards.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/backwards.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/backwards.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Backwards Compatibility</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, backwards" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="api.html" title="API Evolution and Deprecation History" /><link rel="next" href="appendix_free.html" title="Appendix C. Free Software Needs Free Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Backwards Compatibility</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Backwards Compatibility</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, backwards" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="api.html" title="API Evolution and Deprecation History" /><link rel="next" href="appendix_free.html" title="Appendix C. Free Software Needs Free Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Backwards Compatibility</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="appendix_free.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.appendix.porting.backwards"></a>Backwards Compatibility</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.first"></a>First</h3></div></div></div><p>The first generation GNU C++ library was called libg++. It was a -@@ -940,15 +940,15 @@ - This is a change in behavior from older versions. Now, most - <span class="type">iterator_type</span> typedefs in container classes are POD - objects, not <span class="type">value_type</span> pointers. --</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="idp23415104"></a><p><span class="title"><em> -+</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="idm269992117648"></a><p><span class="title"><em> - <a class="link" href="http://www.kegel.com/gcc/gcc4.html" target="_top"> - Migrating to GCC 4.1 - </a> -- </em>. </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span></p></div><div class="biblioentry"><a id="idp23417888"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span></p></div><div class="biblioentry"><a id="idm269992114864"></a><p><span class="title"><em> - <a class="link" href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html" target="_top"> - Building the Whole Debian Archive with GCC 4.1: A Summary - </a> -- </em>. </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span></p></div><div class="biblioentry"><a id="idp23420736"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span></p></div><div class="biblioentry"><a id="idm269992112016"></a><p><span class="title"><em> - <a class="link" href="http://annwm.lbl.gov/~leggett/Atlas/gcc-3.2.html" target="_top"> - Migration guide for GCC-3.2 - </a> -Index: libstdc++-v3/doc/html/manual/source_design_notes.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/source_design_notes.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/source_design_notes.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design Notes</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="source_code_style.html" title="Coding Style" /><link rel="next" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design Notes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_code_style.html">Prev</a> </td><th width="60%" align="center">Appendix A. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design Notes</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="source_code_style.html" title="Coding Style" /><link rel="next" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design Notes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_code_style.html">Prev</a> </td><th width="60%" align="center">Appendix A. - Contributing - - </th><td width="20%" align="right"> <a accesskey="n" href="appendix_porting.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="contrib.design_notes"></a>Design Notes</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/ext_sgi.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_sgi.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_sgi.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Deprecated</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /><link rel="prev" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /><link rel="next" href="ext_utilities.html" title="Chapter 24. Utilities" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Deprecated</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_containers.html">Prev</a> </td><th width="60%" align="center">Chapter 23. HP/SGI Extensions</th><td width="20%" align="right"> <a accesskey="n" href="ext_utilities.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.containers.deprecated_sgi"></a>Deprecated</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Deprecated</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /><link rel="prev" href="ext_containers.html" title="Chapter 23. HP/SGI Extensions" /><link rel="next" href="ext_utilities.html" title="Chapter 24. Utilities" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Deprecated</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_containers.html">Prev</a> </td><th width="60%" align="center">Chapter 23. HP/SGI Extensions</th><td width="20%" align="right"> <a accesskey="n" href="ext_utilities.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.containers.deprecated_sgi"></a>Deprecated</h2></div></div></div><p> - The SGI hashing classes <code class="classname">hash_set</code> and - <code class="classname">hash_set</code> have been deprecated by the - unordered_set, unordered_multiset, unordered_map, -Index: libstdc++-v3/doc/html/manual/facets.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/facets.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/facets.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Facets</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="localization.html" title="Chapter 8. Localization" /><link rel="prev" href="localization.html" title="Chapter 8. Localization" /><link rel="next" href="containers.html" title="Chapter 9. Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Facets</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="localization.html">Prev</a> </td><th width="60%" align="center">Chapter 8. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Facets</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="localization.html" title="Chapter 8. Localization" /><link rel="prev" href="localization.html" title="Chapter 8. Localization" /><link rel="next" href="containers.html" title="Chapter 9. Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Facets</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="localization.html">Prev</a> </td><th width="60%" align="center">Chapter 8. - Localization - --</th><td width="20%" align="right"> <a accesskey="n" href="containers.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.facet"></a>Facets</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.facet.ctype"></a>ctype</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idp15778336"></a>Specializations</h5></div></div></div><p> -+</th><td width="20%" align="right"> <a accesskey="n" href="containers.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.facet"></a>Facets</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.facet.ctype"></a>ctype</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.impl"></a>Implementation</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="idm269999753024"></a>Specializations</h5></div></div></div><p> - For the required specialization codecvt<wchar_t, char, mbstate_t> , - conversions are made between the internal character set (always UCS4 - on GNU/Linux) and whatever the currently selected locale for the -@@ -49,24 +49,24 @@ - </p></li><li class="listitem"><p> - Rename abstract base class. See if just smash-overriding is a - better approach. Clarify, add sanity to naming. -- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp15793392"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm269999738032"></a><p><span class="citetitle"><em class="citetitle"> - The GNU C Library -- </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="idp15798144"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="idm269999733280"></a><p><span class="citetitle"><em class="citetitle"> - Correspondence -- </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idp15801232"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idm269999730192"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 14882:1998 Programming languages - C++ -- </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idp15803520"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idm269999727904"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 9899:1999 Programming languages - C -- </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idp15805792"></a><p><span class="title"><em> -+ </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idm269999725632"></a><p><span class="title"><em> - <a class="link" href="http://www.unix.org/version3/ieee_std.html" target="_top"> - The Open Group Base Specifications, Issue 6 (IEEE Std. 1003.1-2004) - </a> - </em>. </span><span class="copyright">Copyright © 1999 -- The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span></p></div><div class="biblioentry"><a id="idp15809040"></a><p><span class="citetitle"><em class="citetitle"> -+ The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span></p></div><div class="biblioentry"><a id="idm269999722384"></a><p><span class="citetitle"><em class="citetitle"> - The C++ Programming Language, Special Edition - </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> - Addison Wesley -- . </span></span></p></div><div class="biblioentry"><a id="idp15813664"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999717760"></a><p><span class="citetitle"><em class="citetitle"> - Standard C++ IOStreams and Locales - </em>. </span><span class="subtitle"> - Advanced Programmer's Guide and Reference -@@ -409,17 +409,17 @@ - </p></li><li class="listitem"><p> - wchar_t/char internal buffers and conversions between - internal/external buffers? -- </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp15891136"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm269999640080"></a><p><span class="citetitle"><em class="citetitle"> - The GNU C Library - </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums"> - Chapters 6 Character Set Handling and 7 Locales and Internationalization -- . </span></p></div><div class="biblioentry"><a id="idp15895888"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999635328"></a><p><span class="citetitle"><em class="citetitle"> - Correspondence -- </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idp15898976"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idm269999632240"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 14882:1998 Programming languages - C++ -- </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idp15901264"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idm269999629952"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 9899:1999 Programming languages - C -- </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idp15903536"></a><p><span class="title"><em> -+ </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idm269999627680"></a><p><span class="title"><em> - <a class="link" href="http://www.opengroup.org/austin/" target="_top"> - System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008) - </a> -@@ -426,25 +426,25 @@ - </em>. </span><span class="copyright">Copyright © 2008 - The Open Group/The Institute of Electrical and Electronics - Engineers, Inc. -- . </span></p></div><div class="biblioentry"><a id="idp15906768"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999624448"></a><p><span class="citetitle"><em class="citetitle"> - The C++ Programming Language, Special Edition - </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> - Addison Wesley -- . </span></span></p></div><div class="biblioentry"><a id="idp15911392"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999619824"></a><p><span class="citetitle"><em class="citetitle"> - Standard C++ IOStreams and Locales - </em>. </span><span class="subtitle"> - Advanced Programmer's Guide and Reference - . </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername"> - Addison Wesley Longman -- . </span></span></p></div><div class="biblioentry"><a id="idp15917056"></a><p><span class="title"><em> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999614160"></a><p><span class="title"><em> - <a class="link" href="http://www.lysator.liu.se/c/na1.html" target="_top"> - A brief description of Normative Addendum 1 - </a> -- </em>. </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span></p></div><div class="biblioentry"><a id="idp15920304"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span></p></div><div class="biblioentry"><a id="idm269999610912"></a><p><span class="title"><em> - <a class="link" href="http://tldp.org/HOWTO/Unicode-HOWTO.html" target="_top"> - The Unicode HOWTO - </a> -- </em>. </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span></p></div><div class="biblioentry"><a id="idp15923088"></a><p><span class="title"><em> -+ </em>. </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span></p></div><div class="biblioentry"><a id="idm269999608128"></a><p><span class="title"><em> - <a class="link" href="http://www.cl.cam.ac.uk/~mgk25/unicode.html" target="_top"> - UTF-8 and Unicode FAQ for Unix/Linux - </a> -@@ -690,16 +690,16 @@ - model. As of this writing, it is unknown how to query to see - if a specified message catalog exists using the gettext - package. -- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.messages.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp16003632"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="facet.messages.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm269999527584"></a><p><span class="citetitle"><em class="citetitle"> - The GNU C Library - </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling, and 7 Locales and Internationalization -- . </span></p></div><div class="biblioentry"><a id="idp16008384"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999522832"></a><p><span class="citetitle"><em class="citetitle"> - Correspondence -- </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idp16011472"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idm269999519744"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 14882:1998 Programming languages - C++ -- </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idp16013760"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idm269999517456"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 9899:1999 Programming languages - C -- </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idp16016032"></a><p><span class="title"><em> -+ </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idm269999515184"></a><p><span class="title"><em> - <a class="link" href="http://www.opengroup.org/austin/" target="_top"> - System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008) - </a> -@@ -706,23 +706,23 @@ - </em>. </span><span class="copyright">Copyright © 2008 - The Open Group/The Institute of Electrical and Electronics - Engineers, Inc. -- . </span></p></div><div class="biblioentry"><a id="idp16019264"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999511952"></a><p><span class="citetitle"><em class="citetitle"> - The C++ Programming Language, Special Edition - </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> - Addison Wesley -- . </span></span></p></div><div class="biblioentry"><a id="idp16023888"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999507328"></a><p><span class="citetitle"><em class="citetitle"> - Standard C++ IOStreams and Locales - </em>. </span><span class="subtitle"> - Advanced Programmer's Guide and Reference - . </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername"> - Addison Wesley Longman -- . </span></span></p></div><div class="biblioentry"><a id="idp16029552"></a><p><span class="title"><em> -- <a class="link" href="http://java.sun.com/reference/api/index.html" target="_top"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999501664"></a><p><span class="title"><em> -+ <a class="link" href="http://www.oracle.com/technetwork/java/api/index.html" target="_top"> - API Specifications, Java Platform - </a> - </em>. </span><span class="pagenums">java.util.Properties, java.text.MessageFormat, - java.util.Locale, java.util.ResourceBundle -- . </span></p></div><div class="biblioentry"><a id="idp16031888"></a><p><span class="title"><em> -+ . </span></p></div><div class="biblioentry"><a id="idm269999499328"></a><p><span class="title"><em> - <a class="link" href="https://www.gnu.org/software/gettext/" target="_top"> - GNU gettext tools, version 0.10.38, Native Language Support - Library and Tools. -Index: libstdc++-v3/doc/html/manual/diagnostics.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/diagnostics.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/diagnostics.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Diagnostics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="termination.html" title="Termination" /><link rel="next" href="concept_checking.html" title="Concept Checking" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Diagnostics</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="termination.html" title="Termination" /><link rel="next" href="concept_checking.html" title="Concept Checking" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. - Diagnostics - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="termination.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="concept_checking.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.diagnostics"></a>Chapter 5. - Diagnostics -- <a id="idp13835248" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="section"><a href="concept_checking.html">Concept Checking</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.diagnostics.exceptions"></a>Exceptions</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.diagnostics.exceptions.api"></a>API Reference</h3></div></div></div><p> -+ <a id="idm270001697504" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="section"><a href="concept_checking.html">Concept Checking</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.diagnostics.exceptions"></a>Exceptions</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.diagnostics.exceptions.api"></a>API Reference</h3></div></div></div><p> - All exception objects are defined in one of the standard header - files: <code class="filename">exception</code>, - <code class="filename">stdexcept</code>, <code class="filename">new</code>, and -Index: libstdc++-v3/doc/html/manual/mt_allocator_design.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/mt_allocator_design.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/mt_allocator_design.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design Issues</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="next" href="mt_allocator_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design Issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_impl.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.design_issues"></a>Design Issues</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.mt.overview"></a>Overview</h3></div></div></div><p> There are three general components to the allocator: a datum -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design Issues</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="next" href="mt_allocator_impl.html" title="Implementation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design Issues</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_impl.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.design_issues"></a>Design Issues</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.mt.overview"></a>Overview</h3></div></div></div><p> There are three general components to the allocator: a datum - describing the characteristics of the memory pool, a policy class - containing this pool that links instantiation types to common or - individual pools, and a class inheriting from the policy class that is -Index: libstdc++-v3/doc/html/manual/appendix_free.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix_free.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix_free.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix C. Free Software Needs Free Documentation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="backwards.html" title="Backwards Compatibility" /><link rel="next" href="appendix_gpl.html" title="Appendix D. GNU General Public License version 3" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix C. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix C. Free Software Needs Free Documentation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="backwards.html" title="Backwards Compatibility" /><link rel="next" href="appendix_gpl.html" title="Appendix D. GNU General Public License version 3" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix C. - Free Software Needs Free Documentation - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="backwards.html">Prev</a> </td><th width="60%" align="center">Part IV. -@@ -6,7 +6,7 @@ - Appendices - </th><td width="20%" align="right"> <a accesskey="n" href="appendix_gpl.html">Next</a></td></tr></table><hr /></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="appendix.free"></a> - Free Software Needs Free Documentation -- <a id="idp23426192" class="indexterm"></a> -+ <a id="idm269992106560" class="indexterm"></a> - </h1></div></div></div><p> - The biggest deficiency in free operating systems is not in the - software--it is the lack of good free manuals that we can include in -Index: libstdc++-v3/doc/html/manual/algorithms.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/algorithms.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/algorithms.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 11. Algorithms</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library, algorithm" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="iterators.html" title="Chapter 10. Iterators" /><link rel="next" href="numerics.html" title="Chapter 12. Numerics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 11. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 11. Algorithms</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library, algorithm" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="iterators.html" title="Chapter 10. Iterators" /><link rel="next" href="numerics.html" title="Chapter 12. Numerics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 11. - Algorithms - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="iterators.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="numerics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.algorithms"></a>Chapter 11. - Algorithms -- <a id="idp16191968" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="algorithms.html#std.algorithms.mutating">Mutating</a></span></dt><dd><dl><dt><span class="section"><a href="algorithms.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="section"><a href="algorithms.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></div><p> -+ <a id="idm269999339120" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="algorithms.html#std.algorithms.mutating">Mutating</a></span></dt><dd><dl><dt><span class="section"><a href="algorithms.html#algorithms.mutating.swap"><code class="function">swap</code></a></span></dt><dd><dl><dt><span class="section"><a href="algorithms.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></div><p> - The neatest accomplishment of the algorithms section is that all the - work is done via iterators, not containers directly. This means two - important things: -Index: libstdc++-v3/doc/html/manual/appendix_porting.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix_porting.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix_porting.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix B. Porting and Maintenance</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="source_design_notes.html" title="Design Notes" /><link rel="next" href="documentation_hacking.html" title="Writing and Generating Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix B. Porting and Maintenance</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="source_design_notes.html" title="Design Notes" /><link rel="next" href="documentation_hacking.html" title="Writing and Generating Documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix B. - Porting and Maintenance - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_design_notes.html">Prev</a> </td><th width="60%" align="center">Part IV. -@@ -6,8 +6,8 @@ - Appendices - </th><td width="20%" align="right"> <a accesskey="n" href="documentation_hacking.html">Next</a></td></tr></table><hr /></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="appendix.porting"></a> - Porting and Maintenance -- <a id="idp22008864" class="indexterm"></a> --</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview">Overview</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview.basic">General Process</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview.map">What Comes from Where</a></span></dt></dl></dd><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure">Configure</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="section"><a href="appendix_porting.html#build_hacking.make">Make</a></span></dt></dl></dd><dt><span class="section"><a href="documentation_hacking.html">Writing and Generating Documentation</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#doc.intro">Introduction</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doc.generation">Generating Documentation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doc.doxygen">Doxygen</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#doxygen.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.rules">Generating the Doxygen Files</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.debug">Debugging Generation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.markup">Markup</a></span></dt></dl></dd><dt><span class="section"><a href="documentation_hacking.html#doc.docbook">Docbook</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#docbook.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.rules">Generating the DocBook Files</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.debug">Debugging Generation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.validation">Editing and Validation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.examples">File Organization and Basics</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.markup">Markup By Example</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="section"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="section"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="section"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="section"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="section"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="section"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.organization">Organization</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.organization.layout">Directory Layout</a></span></dt><dt><span class="section"><a href="test.html#test.organization.naming">Naming Conventions</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.run.basic">Basic</a></span></dt><dt><span class="section"><a href="test.html#test.run.variations">Variations</a></span></dt><dt><span class="section"><a href="test.html#test.run.permutations">Permutations</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.new_tests">Writing a new test case</a></span></dt><dt><span class="section"><a href="test.html#test.harness">Test Harness and Utilities</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.harness.dejagnu">Dejagnu Harness Details</a></span></dt><dt><span class="section"><a href="test.html#test.harness.utils">Utilities</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.special">Special Topics</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.exception.safety"> -+ <a id="idm269993523968" class="indexterm"></a> -+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview">Overview</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview.basic">General Process</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.overview.map">What Comes from Where</a></span></dt></dl></dd><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure">Configure</a></span></dt><dd><dl><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="section"><a href="appendix_porting.html#build_hacking.configure.enable"><code class="constant">GLIBCXX_ENABLE</code>, the <code class="literal">--enable</code> maker</a></span></dt></dl></dd><dt><span class="section"><a href="appendix_porting.html#build_hacking.make">Make</a></span></dt></dl></dd><dt><span class="section"><a href="documentation_hacking.html">Writing and Generating Documentation</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#doc.intro">Introduction</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doc.generation">Generating Documentation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doc.doxygen">Doxygen</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#doxygen.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.rules">Generating the Doxygen Files</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.debug">Debugging Generation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#doxygen.markup">Markup</a></span></dt></dl></dd><dt><span class="section"><a href="documentation_hacking.html#doc.docbook">Docbook</a></span></dt><dd><dl><dt><span class="section"><a href="documentation_hacking.html#docbook.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.rules">Generating the DocBook Files</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.debug">Debugging Generation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.validation">Editing and Validation</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.examples">File Organization and Basics</a></span></dt><dt><span class="section"><a href="documentation_hacking.html#docbook.markup">Markup By Example</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="section"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="section"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="section"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="section"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="section"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="section"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.organization">Organization</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.organization.layout">Directory Layout</a></span></dt><dt><span class="section"><a href="test.html#test.organization.naming">Naming Conventions</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.run.basic">Basic</a></span></dt><dt><span class="section"><a href="test.html#test.run.variations">Variations</a></span></dt><dt><span class="section"><a href="test.html#test.run.permutations">Permutations</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.new_tests">Writing a new test case</a></span></dt><dt><span class="section"><a href="test.html#test.harness">Test Harness and Utilities</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.harness.dejagnu">Dejagnu Harness Details</a></span></dt><dt><span class="section"><a href="test.html#test.harness.utils">Utilities</a></span></dt></dl></dd><dt><span class="section"><a href="test.html#test.special">Special Topics</a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.exception.safety"> - Qualifying Exception Safety Guarantees - - </a></span></dt><dd><dl><dt><span class="section"><a href="test.html#test.exception.safety.overview">Overview</a></span></dt><dt><span class="section"><a href="test.html#test.exception.safety.status"> -@@ -61,7 +61,7 @@ - in the build directory starts the build process. The <code class="literal">all</code> target comes from the <code class="filename">Makefile</code> file, which is generated via <span class="command"><strong>configure</strong></span> from the <code class="filename">Makefile.in</code> file, which is in turn generated (via - <span class="command"><strong>automake</strong></span>) from the file - <code class="filename">Makefile.am</code>. --</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="build_hacking.overview.map"></a>What Comes from Where</h4></div></div></div><div class="figure"><a id="idp22035648"></a><p class="title"><strong>Figure B.1. Configure and Build File Dependencies</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/confdeps.png" align="middle" alt="Dependency Graph for Configure and Build Files" /></div></div></div><br class="figure-break" /><p> -+</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="build_hacking.overview.map"></a>What Comes from Where</h4></div></div></div><div class="figure"><a id="idm269993497120"></a><p class="title"><strong>Figure B.1. Configure and Build File Dependencies</strong></p><div class="figure-contents"><div class="mediaobject" align="center"><img src="../images/confdeps.png" align="middle" alt="Dependency Graph for Configure and Build Files" /></div></div></div><br class="figure-break" /><p> - Regenerate all generated files by using the command - <code class="code">autoreconf</code> at the top level of the libstdc++ source - directory. -Index: libstdc++-v3/doc/html/manual/profile_mode_cost_model.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_cost_model.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_cost_model.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Empirical Cost Model</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_api.html" title="Extensions for Custom Containers" /><link rel="next" href="profile_mode_impl.html" title="Implementation Issues" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Empirical Cost Model</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_api.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_impl.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.cost_model"></a>Empirical Cost Model</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Empirical Cost Model</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode_api.html" title="Extensions for Custom Containers" /><link rel="next" href="profile_mode_impl.html" title="Implementation Issues" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Empirical Cost Model</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode_api.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_impl.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.cost_model"></a>Empirical Cost Model</h2></div></div></div><p> - Currently, the cost model uses formulas with predefined relative weights - for alternative containers or container implementations. For instance, - iterating through a vector is X times faster than iterating through a list. -Index: libstdc++-v3/doc/html/manual/make.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/make.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/make.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Make</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="setup.html" title="Chapter 2. Setup" /><link rel="prev" href="configure.html" title="Configure" /><link rel="next" href="using.html" title="Chapter 3. Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Make</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="configure.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Setup</th><td width="20%" align="right"> <a accesskey="n" href="using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.make"></a>Make</h2></div></div></div><p>If you have never done this before, you should read the basic -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Make</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="setup.html" title="Chapter 2. Setup" /><link rel="prev" href="configure.html" title="Configure" /><link rel="next" href="using.html" title="Chapter 3. Using" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Make</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="configure.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Setup</th><td width="20%" align="right"> <a accesskey="n" href="using.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.make"></a>Make</h2></div></div></div><p>If you have never done this before, you should read the basic - <a class="link" href="http://gcc.gnu.org/install/" target="_top">GCC Installation - Instructions</a> first. Read <span class="emphasis"><em>all of them</em></span>. - <span class="emphasis"><em>Twice.</em></span> -Index: libstdc++-v3/doc/html/manual/pairs.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/pairs.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/pairs.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Pairs</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="utilities.html" title="Chapter 6. Utilities" /><link rel="next" href="memory.html" title="Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Pairs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="utilities.html">Prev</a> </td><th width="60%" align="center">Chapter 6. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Pairs</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="utilities.html" title="Chapter 6. Utilities" /><link rel="prev" href="utilities.html" title="Chapter 6. Utilities" /><link rel="next" href="memory.html" title="Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Pairs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="utilities.html">Prev</a> </td><th width="60%" align="center">Chapter 6. - Utilities - - </th><td width="20%" align="right"> <a accesskey="n" href="memory.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.pairs"></a>Pairs</h2></div></div></div><p>The <code class="code">pair<T1,T2></code> is a simple and handy way to -Index: libstdc++-v3/doc/html/manual/test.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/test.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/test.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Test</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, test, testsuite, performance, conformance, ABI, exception safety" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="internals.html" title="Porting to New Hardware or Operating Systems" /><link rel="next" href="abi.html" title="ABI Policy and Guidelines" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Test</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="internals.html">Prev</a> </td><th width="60%" align="center">Appendix B. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Test</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, test, testsuite, performance, conformance, ABI, exception safety" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_porting.html" title="Appendix B. Porting and Maintenance" /><link rel="prev" href="internals.html" title="Porting to New Hardware or Operating Systems" /><link rel="next" href="abi.html" title="ABI Policy and Guidelines" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Test</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="internals.html">Prev</a> </td><th width="60%" align="center">Appendix B. - Porting and Maintenance - - </th><td width="20%" align="right"> <a accesskey="n" href="abi.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.test"></a>Test</h2></div></div></div><p> -@@ -492,7 +492,7 @@ - reporting functions including: - </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>time_counter</p></li><li class="listitem"><p>resource_counter</p></li><li class="listitem"><p>report_performance</p></li></ul></div></li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="test.special"></a>Special Topics</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="test.exception.safety"></a> - Qualifying Exception Safety Guarantees -- <a id="idp22628992" class="indexterm"></a> -+ <a id="idm269992903504" class="indexterm"></a> - </h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="test.exception.safety.overview"></a>Overview</h5></div></div></div><p> - Testing is composed of running a particular test sequence, - and looking at what happens to the surrounding code when -Index: libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Linking</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_namespaces.html" title="Namespaces" /><link rel="next" href="using_concurrency.html" title="Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Linking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_namespaces.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_concurrency.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.linkage"></a>Linking</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.linkage.freestanding"></a>Almost Nothing</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Linking</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_namespaces.html" title="Namespaces" /><link rel="next" href="using_concurrency.html" title="Concurrency" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Linking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_namespaces.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_concurrency.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.linkage"></a>Linking</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.linkage.freestanding"></a>Almost Nothing</h3></div></div></div><p> - Or as close as it gets: freestanding. This is a minimal - configuration, with only partial support for the standard - library. Assume only the following header files can be used: -Index: libstdc++-v3/doc/html/manual/using_headers.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_headers.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_headers.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Headers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using.html" title="Chapter 3. Using" /><link rel="next" href="using_macros.html" title="Macros" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_macros.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.headers"></a>Headers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.all"></a>Header Files</h3></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Headers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using.html" title="Chapter 3. Using" /><link rel="next" href="using_macros.html" title="Macros" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_macros.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.headers"></a>Headers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.all"></a>Header Files</h3></div></div></div><p> - The C++ standard specifies the entire set of header files that - must be available to all hosted implementations. Actually, the - word "files" is a misnomer, since the contents of the -@@ -18,19 +18,19 @@ - the 1998 standard as updated for 2003, and the current 2011 standard. - </p><p> - C++98/03 include files. These are available in the default compilation mode, i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>. -- </p><div class="table"><a id="idp13079360"></a><p class="title"><strong>Table 3.2. C++ 1998 Library Headers</strong></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13115840"></a><p class="title"><strong>Table 3.3. C++ 1998 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p> -+ </p><div class="table"><a id="idm270002453792"></a><p class="title"><strong>Table 3.2. C++ 1998 Library Headers</strong></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002417312"></a><p class="title"><strong>Table 3.3. C++ 1998 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p> - C++11 include files. These are only available in C++11 compilation - mode, i.e. <code class="literal">-std=c++11</code> or <code class="literal">-std=gnu++11</code>. --</p><p></p><div class="table"><a id="idp13140576"></a><p class="title"><strong>Table 3.4. C++ 2011 Library Headers</strong></p><div class="table-contents"><table summary="C++ 2011 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td></tr><tr><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td></tr><tr><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td></tr><tr><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13192016"></a><p class="title"><strong>Table 3.5. C++ 2011 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ 2011 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> -+</p><p></p><div class="table"><a id="idm270002392576"></a><p class="title"><strong>Table 3.4. C++ 2011 Library Headers</strong></p><div class="table-contents"><table summary="C++ 2011 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">future</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td></tr><tr><td align="left"><code class="filename">iosfwd</code></td><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td></tr><tr><td align="left"><code class="filename">list</code></td><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td></tr><tr><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td></tr><tr><td align="left"><code class="filename">ratio</code></td><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td></tr><tr><td align="left"><code class="filename">tuple</code></td><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002341136"></a><p class="title"><strong>Table 3.5. C++ 2011 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ 2011 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdbool</code></td></tr><tr><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p> - In addition, TR1 includes as: --</p><div class="table"><a id="idp13221904"></a><p class="title"><strong>Table 3.6. C++ TR 1 Library Headers</strong></p><div class="table-contents"><table summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13238832"></a><p class="title"><strong>Table 3.7. C++ TR 1 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++ -+</p><div class="table"><a id="idm270002311248"></a><p class="title"><strong>Table 3.6. C++ TR 1 Library Headers</strong></p><div class="table-contents"><table summary="C++ TR 1 Library Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002294320"></a><p class="title"><strong>Table 3.7. C++ TR 1 Library Headers for C Library Facilities</strong></p><div class="table-contents"><table summary="C++ TR 1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>Decimal floating-point arithmetic is available if the C++ - compiler supports scalar decimal floating-point types defined via - <code class="code">__attribute__((mode(SD|DD|LD)))</code>. --</p><div class="table"><a id="idp13259904"></a><p class="title"><strong>Table 3.8. C++ TR 24733 Decimal Floating-Point Header</strong></p><div class="table-contents"><table summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p> -+</p><div class="table"><a id="idm270002273248"></a><p class="title"><strong>Table 3.8. C++ TR 24733 Decimal Floating-Point Header</strong></p><div class="table-contents"><table summary="C++ TR 24733 Decimal Floating-Point Header" border="1"><colgroup><col align="left" class="c1" /></colgroup><tbody><tr><td align="left"><code class="filename">decimal/decimal</code></td></tr></tbody></table></div></div><br class="table-break" /><p> - Also included are files for the C++ ABI interface: --</p><div class="table"><a id="idp13265424"></a><p class="title"><strong>Table 3.9. C++ ABI Headers</strong></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> -+</p><div class="table"><a id="idm270002267728"></a><p class="title"><strong>Table 3.9. C++ ABI Headers</strong></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p> - And a large variety of extensions. --</p><div class="table"><a id="idp13271824"></a><p class="title"><strong>Table 3.10. Extension Headers</strong></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13307552"></a><p class="title"><strong>Table 3.11. Extension Debug Headers</strong></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13322320"></a><p class="title"><strong>Table 3.12. Extension Profile Headers</strong></p><div class="table-contents"><table summary="Extension Profile Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idp13335696"></a><p class="title"><strong>Table 3.13. Extension Parallel Headers</strong></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. -+</p><div class="table"><a id="idm270002261328"></a><p class="title"><strong>Table 3.10. Extension Headers</strong></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002225600"></a><p class="title"><strong>Table 3.11. Extension Debug Headers</strong></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /><col align="left" class="c5" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002210832"></a><p class="title"><strong>Table 3.12. Extension Profile Headers</strong></p><div class="table-contents"><table summary="Extension Profile Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><tbody><tr><td align="left"><code class="filename">profile/bitset</code></td><td align="left"><code class="filename">profile/deque</code></td><td align="left"><code class="filename">profile/list</code></td><td align="left"><code class="filename">profile/map</code></td></tr><tr><td align="left"><code class="filename">profile/set</code></td><td align="left"><code class="filename">profile/unordered_map</code></td><td align="left"><code class="filename">profile/unordered_set</code></td><td align="left"><code class="filename">profile/vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="idm270002197456"></a><p class="title"><strong>Table 3.13. Extension Parallel Headers</strong></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules. - </p><p>First, mixing different dialects of the standard headers is not - possible. It's an all-or-nothing affair. Thus, code like - </p><pre class="programlisting"> -Index: libstdc++-v3/doc/html/manual/using_namespaces.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_namespaces.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_namespaces.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Namespaces</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_macros.html" title="Macros" /><link rel="next" href="using_dynamic_or_shared.html" title="Linking" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Namespaces</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_macros.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_dynamic_or_shared.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.namespaces"></a>Namespaces</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.namespaces.all"></a>Available Namespaces</h3></div></div></div><p> There are three main namespaces. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Namespaces</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_macros.html" title="Macros" /><link rel="next" href="using_dynamic_or_shared.html" title="Linking" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Namespaces</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_macros.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_dynamic_or_shared.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.namespaces"></a>Namespaces</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.namespaces.all"></a>Available Namespaces</h3></div></div></div><p> There are three main namespaces. - </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>std</p><p>The ISO C++ standards specify that "all library entities are defined - within namespace std." This includes namespaces nested - within <code class="code">namespace std</code>, such as <code class="code">namespace -Index: libstdc++-v3/doc/html/manual/debug.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/debug.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/debug.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Debugging Support</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_exceptions.html" title="Exceptions" /><link rel="next" href="std_contents.html" title="Part II. Standard Contents" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Debugging Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_exceptions.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="std_contents.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.debug"></a>Debugging Support</h2></div></div></div><p> -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Debugging Support</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_exceptions.html" title="Exceptions" /><link rel="next" href="std_contents.html" title="Part II. Standard Contents" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Debugging Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_exceptions.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="std_contents.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.debug"></a>Debugging Support</h2></div></div></div><p> - There are numerous things that can be done to improve the ease with - which C++ binaries are debugged when using the GNU tool chain. Here - are some of them. -@@ -161,7 +161,7 @@ - DRD</a>, - <a class="link" href="http://valgrind.org/docs/manual/hg-manual.html" target="_top"> - Helgrind</a>, and -- <a class="link" href="http://code.google.com/p/data-race-test" target="_top"> -+ <a class="link" href="http://code.google.com/p/data-race-test/" target="_top"> - ThreadSanitizer</a>. - </p><p> - With DRD, Helgrind and ThreadSanitizer you will need to define -Index: libstdc++-v3/doc/html/manual/localization.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/localization.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/localization.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Localization</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="strings.html" title="Chapter 7. Strings" /><link rel="next" href="facets.html" title="Facets" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Localization</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="strings.html" title="Chapter 7. Strings" /><link rel="next" href="facets.html" title="Facets" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. - Localization - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="strings.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="facets.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.localization"></a>Chapter 8. - Localization -- <a id="idp15701088" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idp15778336">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.locales"></a>Locales</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.locales.locale"></a>locale</h3></div></div></div><p> -+ <a id="idm269999830208" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idm269999753024">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.localization.locales"></a>Locales</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="std.localization.locales.locale"></a>locale</h3></div></div></div><p> - Describes the basic locale object, including nested - classes id, facet, and the reference-counted implementation object, - class _Impl. -@@ -402,18 +402,18 @@ - What should non-required facet instantiations do? If the - generic implementation is provided, then how to end-users - provide specializations? -- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idp15744064"></a><p><span class="citetitle"><em class="citetitle"> -+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h4 class="title"><a id="locales.locale.biblio"></a>Bibliography</h4></div></div></div><div class="biblioentry"><a id="idm269999787232"></a><p><span class="citetitle"><em class="citetitle"> - The GNU C Library - </em>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums"> - Chapters 6 Character Set Handling and 7 Locales and - Internationalization -- . </span></p></div><div class="biblioentry"><a id="idp15748832"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999782464"></a><p><span class="citetitle"><em class="citetitle"> - Correspondence -- </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idp15751920"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="idm269999779376"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 14882:1998 Programming languages - C++ -- </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idp15754208"></a><p><span class="citetitle"><em class="citetitle"> -+ </em>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="idm269999777088"></a><p><span class="citetitle"><em class="citetitle"> - ISO/IEC 9899:1999 Programming languages - C -- </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idp15756480"></a><p><span class="title"><em> -+ </em>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="idm269999774816"></a><p><span class="title"><em> - <a class="link" href="http://www.opengroup.org/austin/" target="_top"> - System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008) - </a> -@@ -420,11 +420,11 @@ - </em>. </span><span class="copyright">Copyright © 2008 - The Open Group/The Institute of Electrical and Electronics - Engineers, Inc. -- . </span></p></div><div class="biblioentry"><a id="idp15759712"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></p></div><div class="biblioentry"><a id="idm269999771584"></a><p><span class="citetitle"><em class="citetitle"> - The C++ Programming Language, Special Edition - </em>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername"> - Addison Wesley -- . </span></span></p></div><div class="biblioentry"><a id="idp15764336"></a><p><span class="citetitle"><em class="citetitle"> -+ . </span></span></p></div><div class="biblioentry"><a id="idm269999766960"></a><p><span class="citetitle"><em class="citetitle"> - Standard C++ IOStreams and Locales - </em>. </span><span class="subtitle"> - Advanced Programmer's Guide and Reference -Index: libstdc++-v3/doc/html/manual/ext_algorithms.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/ext_algorithms.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/ext_algorithms.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 25. Algorithms</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_utilities.html" title="Chapter 24. Utilities" /><link rel="next" href="ext_numerics.html" title="Chapter 26. Numerics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 25. Algorithms</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_utilities.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 25. Algorithms</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_utilities.html" title="Chapter 24. Utilities" /><link rel="next" href="ext_numerics.html" title="Chapter 26. Numerics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 25. Algorithms</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_utilities.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - - </th><td width="20%" align="right"> <a accesskey="n" href="ext_numerics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.algorithms"></a>Chapter 25. Algorithms</h2></div></div></div><p>25.1.6 (count, count_if) is extended with two more versions of count -Index: libstdc++-v3/doc/html/manual/debug_mode.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/debug_mode.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/debug_mode.html (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 17. Debug Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks" /><link rel="next" href="debug_mode_semantics.html" title="Semantics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 17. Debug Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_compile_checks.html">Prev</a> </td><th width="60%" align="center">Part III. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 17. Debug Mode</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, debug" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="extensions.html" title="Part III. Extensions" /><link rel="prev" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks" /><link rel="next" href="debug_mode_semantics.html" title="Semantics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 17. Debug Mode</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ext_compile_checks.html">Prev</a> </td><th width="60%" align="center">Part III. - Extensions - --</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_semantics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.debug_mode"></a>Chapter 17. Debug Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="debug_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="debug_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods">Methods</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.wrappers">The Wrapper Model</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_iter">Safe Iterators</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_seq">Safe Sequences (Containers)</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.precond">Precondition Checking</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.coexistence">Release- and debug-mode coexistence</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.compile">Compile-time coexistence of release- and debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.link">Link- and run-time coexistence of release- and -+</th><td width="20%" align="right"> <a accesskey="n" href="debug_mode_semantics.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.debug_mode"></a>Chapter 17. Debug Mode</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="section"><a href="debug_mode_semantics.html">Semantics</a></span></dt><dt><span class="section"><a href="debug_mode_using.html">Using</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="section"><a href="debug_mode_using.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html">Design</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods">Methods</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.wrappers">The Wrapper Model</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_iter">Safe Iterators</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.safe_seq">Safe Sequences (Containers)</a></span></dt></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.precond">Precondition Checking</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.methods.coexistence">Release- and debug-mode coexistence</a></span></dt><dd><dl><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.compile">Compile-time coexistence of release- and debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.link">Link- and run-time coexistence of release- and - debug-mode components</a></span></dt><dt><span class="section"><a href="debug_mode_design.html#methods.coexistence.alt">Alternatives for Coexistence</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug_mode_design.html#debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.debug_mode.intro"></a>Intro</h2></div></div></div><p> - By default, libstdc++ is built with efficiency in mind, and - therefore performs little or no error checking that is not -Index: libstdc++-v3/doc/html/manual/profile_mode_design.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/profile_mode_design.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/profile_mode_design.html (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="next" href="profile_mode_api.html" title="Extensions for Custom Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_api.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.design"></a>Design</h2></div></div></div><p> --</p><div class="table"><a id="idp16981200"></a><p class="title"><strong>Table 19.1. Profile Code Location</strong></p><div class="table-contents"><table summary="Profile Code Location" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Code Location</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><code class="code">libstdc++-v3/include/std/*</code></td><td align="left">Preprocessor code to redirect to profile extension headers.</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/*</code></td><td align="left">Profile extension public headers (map, vector, ...).</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/impl/*</code></td><td align="left">Profile extension internals. Implementation files are -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Design</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="C++, library, profile" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="prev" href="profile_mode.html" title="Chapter 19. Profile Mode" /><link rel="next" href="profile_mode_api.html" title="Extensions for Custom Containers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Design</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="profile_mode.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td width="20%" align="right"> <a accesskey="n" href="profile_mode_api.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.profile_mode.design"></a>Design</h2></div></div></div><p> -+</p><div class="table"><a id="idm269998550064"></a><p class="title"><strong>Table 19.1. Profile Code Location</strong></p><div class="table-contents"><table summary="Profile Code Location" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Code Location</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left"><code class="code">libstdc++-v3/include/std/*</code></td><td align="left">Preprocessor code to redirect to profile extension headers.</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/*</code></td><td align="left">Profile extension public headers (map, vector, ...).</td></tr><tr><td align="left"><code class="code">libstdc++-v3/include/profile/impl/*</code></td><td align="left">Profile extension internals. Implementation files are - only included from <code class="code">impl/profiler.h</code>, which is the only - file included from the public headers.</td></tr></tbody></table></div></div><br class="table-break" /><p> - </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.design.wrapper"></a>Wrapper Model</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/using_concurrency.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/using_concurrency.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/using_concurrency.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_dynamic_or_shared.html" title="Linking" /><link rel="next" href="using_exceptions.html" title="Exceptions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_dynamic_or_shared.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_exceptions.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.concurrency"></a>Concurrency</h2></div></div></div><p>This section discusses issues surrounding the proper compilation -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Concurrency</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="using.html" title="Chapter 3. Using" /><link rel="prev" href="using_dynamic_or_shared.html" title="Linking" /><link rel="next" href="using_exceptions.html" title="Exceptions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Concurrency</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_dynamic_or_shared.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using</th><td width="20%" align="right"> <a accesskey="n" href="using_exceptions.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.using.concurrency"></a>Concurrency</h2></div></div></div><p>This section discusses issues surrounding the proper compilation - of multithreaded applications which use the Standard C++ - library. This information is GCC-specific since the C++ - standard does not address matters of multithreaded applications. -Index: libstdc++-v3/doc/html/manual/mt_allocator_impl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/mt_allocator_impl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/mt_allocator_impl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_design.html" title="Design Issues" /><link rel="next" href="mt_allocator_ex_single.html" title="Single Thread Example" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_design.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_ex_single.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.mt.tune"></a>Tunable Parameters</h3></div></div></div><p>Certain allocation parameters can be modified, or tuned. There -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, allocator" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="mt_allocator.html" title="Chapter 20. The mt_allocator" /><link rel="prev" href="mt_allocator_design.html" title="Design Issues" /><link rel="next" href="mt_allocator_ex_single.html" title="Single Thread Example" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Implementation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mt_allocator_design.html">Prev</a> </td><th width="60%" align="center">Chapter 20. The mt_allocator</th><td width="20%" align="right"> <a accesskey="n" href="mt_allocator_ex_single.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="allocator.mt.impl"></a>Implementation</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.mt.tune"></a>Tunable Parameters</h3></div></div></div><p>Certain allocation parameters can be modified, or tuned. There - exists a nested <code class="code">struct __pool_base::_Tune</code> that contains all - these parameters, which include settings for - </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Alignment</p></li><li class="listitem"><p>Maximum bytes before calling <code class="code">::operator new</code> directly</p></li><li class="listitem"><p>Minimum bytes</p></li><li class="listitem"><p>Size of underlying global allocations</p></li><li class="listitem"><p>Maximum number of supported threads</p></li><li class="listitem"><p>Migration of deallocations to the global free list</p></li><li class="listitem"><p>Shunt for global <code class="code">new</code> and <code class="code">delete</code></p></li></ul></div><p>Adjusting parameters for a given instance of an allocator can only -Index: libstdc++-v3/doc/html/manual/appendix_gfdl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix_gfdl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix_gfdl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix E. GNU Free Documentation License</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix_gpl.html" title="Appendix D. GNU General Public License version 3" /><link rel="next" href="../bk02.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix E. GNU Free Documentation License</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_gpl.html">Prev</a> </td><th width="60%" align="center">Part IV. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix E. GNU Free Documentation License</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix_gpl.html" title="Appendix D. GNU General Public License version 3" /><link rel="next" href="../bk02.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix E. GNU Free Documentation License</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_gpl.html">Prev</a> </td><th width="60%" align="center">Part IV. - Appendices - </th><td width="20%" align="right"> <a accesskey="n" href="../bk02.html">Next</a></td></tr></table><hr /></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="appendix.gfdl-1.3"></a>GNU Free Documentation License</h1></div></div></div><p>Version 1.3, 3 November 2008</p><p> - Copyright © 2000, 2001, 2002, 2007, 2008 -Index: libstdc++-v3/doc/html/manual/containers.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/containers.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/containers.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 9. Containers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="facets.html" title="Facets" /><link rel="next" href="associative.html" title="Associative" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 9. Containers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="facets.html" title="Facets" /><link rel="next" href="associative.html" title="Associative" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. - Containers - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="facets.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="associative.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.containers"></a>Chapter 9. - Containers -- <a id="idp16037808" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="section"><a href="containers.html#containers.sequences.vector">vector</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="associative.html">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="section"><a href="associative.html#containers.associative.bitset">bitset</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="section"><a href="associative.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="unordered_associative.html">Unordered Associative</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.hash">Hash Code</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.cache">Hash Code Caching Policy</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.sequences"></a>Sequences</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="containers.sequences.list"></a>list</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sequences.list.size"></a>list::size() is O(n)</h4></div></div></div><p> -+ <a id="idm269999493408" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="section"><a href="containers.html#containers.sequences.vector">vector</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="associative.html">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="section"><a href="associative.html#containers.associative.bitset">bitset</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="section"><a href="associative.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="unordered_associative.html">Unordered Associative</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.hash">Hash Code</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.cache">Hash Code Caching Policy</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.containers.sequences"></a>Sequences</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="containers.sequences.list"></a>list</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sequences.list.size"></a>list::size() is O(n)</h4></div></div></div><p> - Yes it is, and that's okay. This is a decision that we preserved - when we imported SGI's STL implementation. The following is - quoted from <a class="link" href="http://www.sgi.com/tech/stl/FAQ.html" target="_top">their FAQ</a>: -Index: libstdc++-v3/doc/html/manual/io.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/io.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/io.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 13. Input and Output</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="numerics_and_c.html" title="Interacting with C" /><link rel="next" href="streambufs.html" title="Stream Buffers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 13. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 13. Input and Output</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="numerics_and_c.html" title="Interacting with C" /><link rel="next" href="streambufs.html" title="Stream Buffers" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 13. - Input and Output - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="numerics_and_c.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="streambufs.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.io"></a>Chapter 13. - Input and Output -- <a id="idp16257600" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="io.html#std.io.objects">Iostream Objects</a></span></dt><dt><span class="section"><a href="streambufs.html">Stream Buffers</a></span></dt><dd><dl><dt><span class="section"><a href="streambufs.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="section"><a href="streambufs.html#io.streambuf.buffering">Buffering</a></span></dt></dl></dd><dt><span class="section"><a href="stringstreams.html">Memory Based Streams</a></span></dt><dd><dl><dt><span class="section"><a href="stringstreams.html#std.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="section"><a href="fstreams.html">File Based Streams</a></span></dt><dd><dl><dt><span class="section"><a href="fstreams.html#std.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="section"><a href="fstreams.html#std.io.filestreams.binary">Binary Input and Output</a></span></dt></dl></dd><dt><span class="section"><a href="io_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="io_and_c.html#std.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="section"><a href="io_and_c.html#std.io.c.sync">Performance</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.objects"></a>Iostream Objects</h2></div></div></div><p>To minimize the time you have to wait on the compiler, it's good to -+ <a id="idm269999273616" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="io.html#std.io.objects">Iostream Objects</a></span></dt><dt><span class="section"><a href="streambufs.html">Stream Buffers</a></span></dt><dd><dl><dt><span class="section"><a href="streambufs.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="section"><a href="streambufs.html#io.streambuf.buffering">Buffering</a></span></dt></dl></dd><dt><span class="section"><a href="stringstreams.html">Memory Based Streams</a></span></dt><dd><dl><dt><span class="section"><a href="stringstreams.html#std.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="section"><a href="fstreams.html">File Based Streams</a></span></dt><dd><dl><dt><span class="section"><a href="fstreams.html#std.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="section"><a href="fstreams.html#std.io.filestreams.binary">Binary Input and Output</a></span></dt></dl></dd><dt><span class="section"><a href="io_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="io_and_c.html#std.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="section"><a href="io_and_c.html#std.io.c.sync">Performance</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.objects"></a>Iostream Objects</h2></div></div></div><p>To minimize the time you have to wait on the compiler, it's good to - only include the headers you really need. Many people simply include - <iostream> when they don't need to -- and that can <span class="emphasis"><em>penalize - your runtime as well.</em></span> Here are some tips on which header to use -Index: libstdc++-v3/doc/html/manual/index.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/index.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/index.html (.../branches/gcc-4_8-branch) -@@ -1,7 +1,7 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library Manual</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="../index.html" title="The GNU C++ Library" /><link rel="prev" href="../index.html" title="The GNU C++ Library" /><link rel="next" href="intro.html" title="Part I. Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library Manual</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="../index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><div><div><h1 class="title"><a id="manual"></a>The GNU C++ Library Manual</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname"></span> <span class="surname"></span></h3></div><div class="author"><h3 class="author"><span class="firstname">Paolo</span> <span class="surname">Carlini</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Phil</span> <span class="surname">Edwards</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Doug</span> <span class="surname">Gregor</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Dhruv</span> <span class="surname">Matani</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jason</span> <span class="surname">Merrill</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Mark</span> <span class="surname">Mitchell</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Nathan</span> <span class="surname">Myers</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Felix</span> <span class="surname">Natter</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Stefan</span> <span class="surname">Olsson</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Silvius</span> <span class="surname">Rus</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Ami</span> <span class="surname">Tavory</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jonathan</span> <span class="surname">Wakely</span></h3></div></div></div><div><p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library Manual</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="../index.html" title="The GNU C++ Library" /><link rel="prev" href="../index.html" title="The GNU C++ Library" /><link rel="next" href="intro.html" title="Part I. Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library Manual</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="../index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr /></div><div class="book"><div class="titlepage"><div><div><h1 class="title"><a id="manual"></a>The GNU C++ Library Manual</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname"></span> <span class="surname"></span></h3></div><div class="author"><h3 class="author"><span class="firstname">Paolo</span> <span class="surname">Carlini</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Phil</span> <span class="surname">Edwards</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Doug</span> <span class="surname">Gregor</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Dhruv</span> <span class="surname">Matani</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jason</span> <span class="surname">Merrill</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Mark</span> <span class="surname">Mitchell</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Nathan</span> <span class="surname">Myers</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Felix</span> <span class="surname">Natter</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Stefan</span> <span class="surname">Olsson</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Silvius</span> <span class="surname">Rus</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Ami</span> <span class="surname">Tavory</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Jonathan</span> <span class="surname">Wakely</span></h3></div></div></div><div><p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 - <a class="link" href="http://www.fsf.org" target="_top">FSF</a> -- </p></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="part"><a href="intro.html">I. -+ </p></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="part"><a href="intro.html">I. - Introduction - - </a></span></dt><dd><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="std_contents.html">II. -@@ -15,13 +15,13 @@ - </a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.api">API Reference</a></span></dt><dt><span class="section"><a href="diagnostics.html#std.diagnostics.exceptions.data">Adding Data to <code class="classname">exception</code></a></span></dt></dl></dd><dt><span class="section"><a href="concept_checking.html">Concept Checking</a></span></dt></dl></dd><dt><span class="chapter"><a href="utilities.html">6. - Utilities - --</a></span></dt><dd><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp13920976">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idp13924528">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp13937824">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15512272">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idp15534784">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idp15542080">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp15556704">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15573056">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idp15576640">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="strings.html">7. -+</a></span></dt><dd><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270001611968">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idm270001608416">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm270001595120">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270000019344">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999996832">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idm269999989536">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999974912">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm269999958496">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idm269999954912">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></dd><dt><span class="chapter"><a href="strings.html">7. - Strings - - </a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#std.strings.string">String Classes</a></span></dt><dd><dl><dt><span class="section"><a href="strings.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.case">Case Sensitivity</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.character_types">Arbitrary Character Types</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.token">Tokenizing</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.shrink">Shrink to Fit</a></span></dt><dt><span class="section"><a href="strings.html#strings.string.Cstring">CString (MFC)</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="localization.html">8. - Localization - --</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idp15778336">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="containers.html">9. -+</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales">Locales</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#std.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locales.locale.req">Requirements</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.design">Design</a></span></dt><dt><span class="section"><a href="localization.html#locales.locale.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="localization.html#locale.impl.c">Interacting with "C" locales</a></span></dt></dl></dd><dt><span class="section"><a href="localization.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="facets.html">Facets</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#std.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#idm269999753024">Specializations</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#std.localization.facet.codecvt">codecvt</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.design">Design</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#codecvt.design.wchar_t_size"><span class="type">wchar_t</span> Size</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.unicode">Support for Unicode</a></span></dt><dt><span class="section"><a href="facets.html#codecvt.design.issues">Other Issues</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#manual.localization.facet.messages">messages</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#facet.messages.req">Requirements</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.design">Design</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="facets.html#messages.impl.models">Models</a></span></dt><dt><span class="section"><a href="facets.html#messages.impl.gnu">The GNU Model</a></span></dt></dl></dd><dt><span class="section"><a href="facets.html#facet.messages.use">Use</a></span></dt><dt><span class="section"><a href="facets.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="chapter"><a href="containers.html">9. - Containers - - </a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#std.containers.sequences">Sequences</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="section"><a href="containers.html#containers.sequences.vector">vector</a></span></dt><dd><dl><dt><span class="section"><a href="containers.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="associative.html">Associative</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="section"><a href="associative.html#containers.associative.bitset">bitset</a></span></dt><dd><dl><dt><span class="section"><a href="associative.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="section"><a href="associative.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="unordered_associative.html">Unordered Associative</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.hash">Hash Code</a></span></dt><dd><dl><dt><span class="section"><a href="unordered_associative.html#containers.unordered.cache">Hash Code Caching Policy</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="containers_and_c.html">Interacting with C</a></span></dt><dd><dl><dt><span class="section"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="iterators.html">10. -@@ -143,19 +143,19 @@ - - </a></span></dt><dt><span class="appendix"><a href="appendix_gpl.html">D. - <acronym class="acronym">GNU</acronym> General Public License version 3 -- </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt></dl></dd></dl></div><div class="list-of-figures"><p><strong>List of Figures</strong></p><dl><dt>22.1. <a href="policy_data_structures.html#idp17613296">Node Invariants</a></dt><dt>22.2. <a href="policy_data_structures.html#idp17619952">Underlying Associative Data Structures</a></dt><dt>22.3. <a href="policy_data_structures.html#idp17651648">Range Iteration in Different Data Structures</a></dt><dt>22.4. <a href="policy_data_structures.html#idp17666528">Point Iteration in Hash Data Structures</a></dt><dt>22.5. <a href="policy_data_structures.html#idp17675840">Effect of erase in different underlying data structures</a></dt><dt>22.6. <a href="policy_data_structures.html#idp17743424">Underlying Priority Queue Data Structures</a></dt><dt>22.7. <a href="policy_data_structures_using.html#idp17806128">Exception Hierarchy</a></dt><dt>22.8. <a href="policy_data_structures_design.html#idp18000448">Non-unique Mapping Standard Containers</a></dt><dt>22.9. <a href="policy_data_structures_design.html#fig.pbds_embedded_lists_2"> -+ </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt></dl></dd></dl></div><div class="list-of-figures"><p><strong>List of Figures</strong></p><dl><dt>22.1. <a href="policy_data_structures.html#idm269997917584">Node Invariants</a></dt><dt>22.2. <a href="policy_data_structures.html#idm269997910864">Underlying Associative Data Structures</a></dt><dt>22.3. <a href="policy_data_structures.html#idm269997879168">Range Iteration in Different Data Structures</a></dt><dt>22.4. <a href="policy_data_structures.html#idm269997864256">Point Iteration in Hash Data Structures</a></dt><dt>22.5. <a href="policy_data_structures.html#idm269997855056">Effect of erase in different underlying data structures</a></dt><dt>22.6. <a href="policy_data_structures.html#idm269997787392">Underlying Priority Queue Data Structures</a></dt><dt>22.7. <a href="policy_data_structures_using.html#idm269997724688">Exception Hierarchy</a></dt><dt>22.8. <a href="policy_data_structures_design.html#idm269997530416">Non-unique Mapping Standard Containers</a></dt><dt>22.9. <a href="policy_data_structures_design.html#fig.pbds_embedded_lists_2"> - Effect of embedded lists in - <code class="classname">std::multimap</code> -- </a></dt><dt>22.10. <a href="policy_data_structures_design.html#idp18023952">Non-unique Mapping Containers</a></dt><dt>22.11. <a href="policy_data_structures_design.html#idp18043824">Point Iterator Hierarchy</a></dt><dt>22.12. <a href="policy_data_structures_design.html#idp18057168">Invalidation Guarantee Tags Hierarchy</a></dt><dt>22.13. <a href="policy_data_structures_design.html#idp18087392">Container Tag Hierarchy</a></dt><dt>22.14. <a href="policy_data_structures_design.html#idp18127536">Hash functions, ranged-hash functions, and -- range-hashing functions</a></dt><dt>22.15. <a href="policy_data_structures_design.html#idp18191968">Insert hash sequence diagram</a></dt><dt>22.16. <a href="policy_data_structures_design.html#idp18199024">Insert hash sequence diagram with a null policy</a></dt><dt>22.17. <a href="policy_data_structures_design.html#idp18215840">Hash policy class diagram</a></dt><dt>22.18. <a href="policy_data_structures_design.html#idp18234944">Balls and bins</a></dt><dt>22.19. <a href="policy_data_structures_design.html#idp18265728">Insert resize sequence diagram</a></dt><dt>22.20. <a href="policy_data_structures_design.html#idp18273504">Standard resize policy trigger sequence -- diagram</a></dt><dt>22.21. <a href="policy_data_structures_design.html#idp18277664">Standard resize policy size sequence -- diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#idp18355696">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#idp18365136">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#idp18378304">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#idp18389968">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#idp18398144">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#idp18420400">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#idp18465088">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#idp18475584">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#idp18506160">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#idp18511744">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#idp18575568">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#idp18610544">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#idp22035648">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#idp452240">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#idp8670848">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#idp7483200">C++ TR1 Implementation Status</a></dt><dt>1.4. <a href="status.html#idp12559072">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#idp13051936">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#idp13079360">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#idp13115840">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#idp13140576">C++ 2011 Library Headers</a></dt><dt>3.5. <a href="using_headers.html#idp13192016">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#idp13221904">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#idp13238832">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#idp13259904">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#idp13265424">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#idp13271824">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#idp13307552">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#idp13322320">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#idp13335696">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#idp16490400">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#idp16535296">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#idp16725920">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#idp16981200">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#idp17088912">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#idp17500848">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#idp22162432">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#idp22238096">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#idp22257536">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#idp22335040">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#idp22359184">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#idp23030528">Extension Allocators</a></dt><dt>B.7. <a href="api.html#idp23058160">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#idp18141344">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#idp18147232">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#idp18151744">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#idp18153568">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#idp18163200"> -+ </a></dt><dt>22.10. <a href="policy_data_structures_design.html#idm269997506912">Non-unique Mapping Containers</a></dt><dt>22.11. <a href="policy_data_structures_design.html#idm269997487104">Point Iterator Hierarchy</a></dt><dt>22.12. <a href="policy_data_structures_design.html#idm269997473760">Invalidation Guarantee Tags Hierarchy</a></dt><dt>22.13. <a href="policy_data_structures_design.html#idm269997443664">Container Tag Hierarchy</a></dt><dt>22.14. <a href="policy_data_structures_design.html#idm269997403584">Hash functions, ranged-hash functions, and -+ range-hashing functions</a></dt><dt>22.15. <a href="policy_data_structures_design.html#idm269997339216">Insert hash sequence diagram</a></dt><dt>22.16. <a href="policy_data_structures_design.html#idm269997332160">Insert hash sequence diagram with a null policy</a></dt><dt>22.17. <a href="policy_data_structures_design.html#idm269997315408">Hash policy class diagram</a></dt><dt>22.18. <a href="policy_data_structures_design.html#idm269997296368">Balls and bins</a></dt><dt>22.19. <a href="policy_data_structures_design.html#idm269997265648">Insert resize sequence diagram</a></dt><dt>22.20. <a href="policy_data_structures_design.html#idm269997257872">Standard resize policy trigger sequence -+ diagram</a></dt><dt>22.21. <a href="policy_data_structures_design.html#idm269997253712">Standard resize policy size sequence -+ diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#idm269997175616">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#idm269997166176">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#idm269997153072">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#idm269997141408">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#idm269997133232">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#idm269997110976">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#idm269997066288">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#idm269997055856">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#idm269997025344">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#idm269997019760">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#idm269996955920">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#idm269996920880">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#idm269993497120">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#idm270008034928">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#idm270007982624">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#idm270006687472">C++ TR1 Implementation Status</a></dt><dt>1.4. <a href="status.html#idm270002960368">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#idm270002481088">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#idm270002453792">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#idm270002417312">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#idm270002392576">C++ 2011 Library Headers</a></dt><dt>3.5. <a href="using_headers.html#idm270002341136">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#idm270002311248">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#idm270002294320">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#idm270002273248">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#idm270002267728">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#idm270002261328">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#idm270002225600">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#idm270002210832">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#idm270002197456">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#idm269999040896">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#idm269998996000">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#idm269998805216">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#idm269998550064">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#idm269998442544">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#idm269998030352">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#idm269993370272">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#idm269993294592">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#idm269993275152">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#idm269993197520">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#idm269993173376">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#idm269992502096">Extension Allocators</a></dt><dt>B.7. <a href="api.html#idm269992474464">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#idm269997389776">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#idm269997383888">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#idm269997379376">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#idm269997377552">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#idm269997367984"> - A Standard String Hash Function -- </a></dt><dt>22.6. <a href="policy_data_structures_design.html#idp18169344"> -+ </a></dt><dt>22.6. <a href="policy_data_structures_design.html#idm269997361840"> - Only k String DNA Hash -- </a></dt><dt>22.7. <a href="policy_data_structures_design.html#idp18240448"> -+ </a></dt><dt>22.7. <a href="policy_data_structures_design.html#idm269997290864"> - Probability of Probe Sequence of Length k -- </a></dt><dt>22.8. <a href="policy_data_structures_design.html#idp18247216"> -+ </a></dt><dt>22.8. <a href="policy_data_structures_design.html#idm269997284096"> - Probability Probe Sequence in Some Bin - </a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. - Introduction -Index: libstdc++-v3/doc/html/manual/numerics_and_c.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/numerics_and_c.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/numerics_and_c.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="numerics.html" title="Chapter 12. Numerics" /><link rel="prev" href="generalized_numeric_operations.html" title="Generalized Operations" /><link rel="next" href="io.html" title="Chapter 13. Input and Output" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generalized_numeric_operations.html">Prev</a> </td><th width="60%" align="center">Chapter 12. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="numerics.html" title="Chapter 12. Numerics" /><link rel="prev" href="generalized_numeric_operations.html" title="Generalized Operations" /><link rel="next" href="io.html" title="Chapter 13. Input and Output" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generalized_numeric_operations.html">Prev</a> </td><th width="60%" align="center">Chapter 12. - Numerics - - </th><td width="20%" align="right"> <a accesskey="n" href="io.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.numerics.c"></a>Interacting with C</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="numerics.c.array"></a>Numerics vs. Arrays</h3></div></div></div><p>One of the major reasons why FORTRAN can chew through numbers so well -Index: libstdc++-v3/doc/html/manual/appendix_gpl.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/appendix_gpl.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/appendix_gpl.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix D. GNU General Public License version 3</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix_free.html" title="Appendix C. Free Software Needs Free Documentation" /><link rel="next" href="appendix_gfdl.html" title="Appendix E. GNU Free Documentation License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix D. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix D. GNU General Public License version 3</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix.html" title="Part IV. Appendices" /><link rel="prev" href="appendix_free.html" title="Appendix C. Free Software Needs Free Documentation" /><link rel="next" href="appendix_gfdl.html" title="Appendix E. GNU Free Documentation License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix D. - <acronym class="acronym">GNU</acronym> General Public License version 3 - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_free.html">Prev</a> </td><th width="60%" align="center">Part IV. - Appendices -@@ -77,7 +77,7 @@ - </p><p> - The precise terms and conditions for copying, distribution and modification - follow. -- </p><h2><a id="idp23466384"></a> -+ </p><h2><a id="idm269992066368"></a> - TERMS AND CONDITIONS - </h2><h2><a id="gpl-3-definitions"></a> - 0. Definitions. -@@ -618,7 +618,7 @@ - waiver of all civil liability in connection with the Program, unless a - warranty or assumption of liability accompanies a copy of the Program in - return for a fee. -- </p><h2><a id="idp23565184"></a> -+ </p><h2><a id="idm269991967568"></a> - END OF TERMS AND CONDITIONS - </h2><h2><a id="HowToApply"></a> - How to Apply These Terms to Your New Programs -Index: libstdc++-v3/doc/html/manual/source_code_style.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/source_code_style.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/source_code_style.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Coding Style</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="source_organization.html" title="Directory Layout and Source Conventions" /><link rel="next" href="source_design_notes.html" title="Design Notes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Coding Style</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_organization.html">Prev</a> </td><th width="60%" align="center">Appendix A. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Coding Style</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="source_organization.html" title="Directory Layout and Source Conventions" /><link rel="next" href="source_design_notes.html" title="Design Notes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Coding Style</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_organization.html">Prev</a> </td><th width="60%" align="center">Appendix A. - Contributing - - </th><td width="20%" align="right"> <a accesskey="n" href="source_design_notes.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="contrib.coding_style"></a>Coding Style</h2></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/streambufs.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/streambufs.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/streambufs.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Stream Buffers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="io.html" title="Chapter 13. Input and Output" /><link rel="next" href="stringstreams.html" title="Memory Based Streams" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Stream Buffers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="io.html">Prev</a> </td><th width="60%" align="center">Chapter 13. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Stream Buffers</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="io.html" title="Chapter 13. Input and Output" /><link rel="prev" href="io.html" title="Chapter 13. Input and Output" /><link rel="next" href="stringstreams.html" title="Memory Based Streams" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Stream Buffers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="io.html">Prev</a> </td><th width="60%" align="center">Chapter 13. - Input and Output - - </th><td width="20%" align="right"> <a accesskey="n" href="stringstreams.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.io.streambufs"></a>Stream Buffers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="io.streambuf.derived"></a>Derived streambuf Classes</h3></div></div></div><p> -Index: libstdc++-v3/doc/html/manual/utilities.html -=================================================================== ---- a/src/libstdc++-v3/doc/html/manual/utilities.html (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/doc/html/manual/utilities.html (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - <?xml version="1.0" encoding="UTF-8" standalone="no"?> --<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 6. Utilities</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.77.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="concept_checking.html" title="Concept Checking" /><link rel="next" href="pairs.html" title="Pairs" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. -+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 6. Utilities</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.78.1" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="std_contents.html" title="Part II. Standard Contents" /><link rel="prev" href="concept_checking.html" title="Concept Checking" /><link rel="next" href="pairs.html" title="Pairs" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. - Utilities - - </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="concept_checking.html">Prev</a> </td><th width="60%" align="center">Part II. -@@ -6,8 +6,8 @@ - Standard Contents - </th><td width="20%" align="right"> <a accesskey="n" href="pairs.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="std.util"></a>Chapter 6. - Utilities -- <a id="idp13862416" class="indexterm"></a> --</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp13920976">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idp13924528">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp13937824">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15512272">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idp15534784">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idp15542080">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idp15556704">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idp15573056">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idp15576640">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.functors"></a>Functors</h2></div></div></div><p>If you don't know what functors are, you're not alone. Many people -+ <a id="idm270001670464" class="indexterm"></a> -+</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="utilities.html#std.util.functors">Functors</a></span></dt><dt><span class="section"><a href="pairs.html">Pairs</a></span></dt><dt><span class="section"><a href="memory.html">Memory</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#std.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270001611968">Interface Design</a></span></dt><dt><span class="section"><a href="memory.html#idm270001608416">Selecting Default Allocation Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm270001595120">Disabling Memory Caching</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="section"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="section"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.auto_ptr">auto_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="section"><a href="memory.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#std.util.memory.shared_ptr">shared_ptr</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="section"><a href="memory.html#shared_ptr.impl">Implementation</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm270000019344">Class Hierarchy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999996832">Thread Safety</a></span></dt><dt><span class="section"><a href="memory.html#idm269999989536">Selecting Lock Policy</a></span></dt><dt><span class="section"><a href="memory.html#idm269999974912">Related functions and classes</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.using">Use</a></span></dt><dd><dl><dt><span class="section"><a href="memory.html#idm269999958496">Examples</a></span></dt><dt><span class="section"><a href="memory.html#idm269999954912">Unresolved Issues</a></span></dt></dl></dd><dt><span class="section"><a href="memory.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="traits.html">Traits</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std.util.functors"></a>Functors</h2></div></div></div><p>If you don't know what functors are, you're not alone. Many people - get slightly the wrong idea. In the interest of not reinventing - the wheel, we will refer you to the introduction to the functor - concept written by SGI as part of their STL, in -Index: libstdc++-v3/include/debug/functions.h -=================================================================== ---- a/src/libstdc++-v3/include/debug/functions.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/debug/functions.h (.../branches/gcc-4_8-branch) -@@ -345,11 +345,13 @@ - return __check_sorted_set_aux(__first, __last, __pred, _SameType()); - } - -+ // _GLIBCXX_RESOLVE_LIB_DEFECTS -+ // 270. Binary search requirements overly strict -+ // Determine if a sequence is partitioned w.r.t. this element. - template<typename _ForwardIterator, typename _Tp> - inline bool -- __check_partitioned_lower_aux(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value, -- std::forward_iterator_tag) -+ __check_partitioned_lower(_ForwardIterator __first, -+ _ForwardIterator __last, const _Tp& __value) - { - while (__first != __last && *__first < __value) - ++__first; -@@ -362,38 +364,11 @@ - return __first == __last; - } - -- // For performance reason, as the iterator range has been validated, check on -- // random access safe iterators is done using the base iterator. -- template<typename _Iterator, typename _Sequence, typename _Tp> -- inline bool -- __check_partitioned_lower_aux( -- const _Safe_iterator<_Iterator, _Sequence>& __first, -- const _Safe_iterator<_Iterator, _Sequence>& __last, -- const _Tp& __value, -- std::random_access_iterator_tag __tag) -- { -- return __check_partitioned_lower_aux(__first.base(), __last.base(), -- __value, __tag); -- } -- -- // _GLIBCXX_RESOLVE_LIB_DEFECTS -- // 270. Binary search requirements overly strict -- // Determine if a sequence is partitioned w.r.t. this element. - template<typename _ForwardIterator, typename _Tp> - inline bool -- __check_partitioned_lower(_ForwardIterator __first, -+ __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value) - { -- return __check_partitioned_lower_aux(__first, __last, __value, -- std::__iterator_category(__first)); -- } -- -- template<typename _ForwardIterator, typename _Tp> -- inline bool -- __check_partitioned_upper_aux(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value, -- std::forward_iterator_tag) -- { - while (__first != __last && !(__value < *__first)) - ++__first; - if (__first != __last) -@@ -405,35 +380,12 @@ - return __first == __last; - } -- // For performance reason, as the iterator range has been validated, check on -- // random access safe iterators is done using the base iterator. -- template<typename _Iterator, typename _Sequence, typename _Tp> -- inline bool -- __check_partitioned_upper_aux( -- const _Safe_iterator<_Iterator, _Sequence>& __first, -- const _Safe_iterator<_Iterator, _Sequence>& __last, -- const _Tp& __value, -- std::random_access_iterator_tag __tag) -- { -- return __check_partitioned_upper_aux(__first.base(), __last.base(), -- __value, __tag); -- } -- -- template<typename _ForwardIterator, typename _Tp> -- inline bool -- __check_partitioned_upper(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value) -- { -- return __check_partitioned_upper_aux(__first, __last, __value, -- std::__iterator_category(__first)); -- } -- -+ // Determine if a sequence is partitioned w.r.t. this element. - template<typename _ForwardIterator, typename _Tp, typename _Pred> - inline bool -- __check_partitioned_lower_aux(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value, -- _Pred __pred, -- std::forward_iterator_tag) -+ __check_partitioned_lower(_ForwardIterator __first, -+ _ForwardIterator __last, const _Tp& __value, -+ _Pred __pred) - { - while (__first != __last && bool(__pred(*__first, __value))) - ++__first; -@@ -446,39 +398,12 @@ - return __first == __last; - } +@@ -471,7 +473,6 @@ + lock_guard<mutex> __lock(_M_mutex); + _M_result.swap(__res); + } +- _M_cond.notify_all(); + __set = true; + } -- // For performance reason, as the iterator range has been validated, check on -- // random access safe iterators is done using the base iterator. -- template<typename _Iterator, typename _Sequence, -- typename _Tp, typename _Pred> -- inline bool -- __check_partitioned_lower_aux( -- const _Safe_iterator<_Iterator, _Sequence>& __first, -- const _Safe_iterator<_Iterator, _Sequence>& __last, -- const _Tp& __value, _Pred __pred, -- std::random_access_iterator_tag __tag) -- { -- return __check_partitioned_lower_aux(__first.base(), __last.base(), -- __value, __pred, __tag); -- } -- -- // Determine if a sequence is partitioned w.r.t. this element. - template<typename _ForwardIterator, typename _Tp, typename _Pred> - inline bool -- __check_partitioned_lower(_ForwardIterator __first, -+ __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred) - { -- return __check_partitioned_lower_aux(__first, __last, __value, __pred, -- std::__iterator_category(__first)); -- } -- -- template<typename _ForwardIterator, typename _Tp, typename _Pred> -- inline bool -- __check_partitioned_upper_aux(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value, -- _Pred __pred, -- std::forward_iterator_tag) -- { - while (__first != __last && !bool(__pred(__value, *__first))) - ++__first; - if (__first != __last) -@@ -490,31 +415,6 @@ - return __first == __last; - } +@@ -983,22 +984,25 @@ + void + set_value(const _Res& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, __r); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } -- // For performance reason, as the iterator range has been validated, check on -- // random access safe iterators is done using the base iterator. -- template<typename _Iterator, typename _Sequence, -- typename _Tp, typename _Pred> -- inline bool -- __check_partitioned_upper_aux( -- const _Safe_iterator<_Iterator, _Sequence>& __first, -- const _Safe_iterator<_Iterator, _Sequence>& __last, -- const _Tp& __value, _Pred __pred, -- std::random_access_iterator_tag __tag) -- { -- return __check_partitioned_upper_aux(__first.base(), __last.base(), -- __value, __pred, __tag); -- } -- -- template<typename _ForwardIterator, typename _Tp, typename _Pred> -- inline bool -- __check_partitioned_upper(_ForwardIterator __first, -- _ForwardIterator __last, const _Tp& __value, -- _Pred __pred) -- { -- return __check_partitioned_upper_aux(__first, __last, __value, __pred, -- std::__iterator_category(__first)); -- } -- - // Helper struct to detect random access safe iterators. - template<typename _Iterator> - struct __is_safe_random_iterator -Index: libstdc++-v3/include/debug/safe_unordered_base.h -=================================================================== ---- a/src/libstdc++-v3/include/debug/safe_unordered_base.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/debug/safe_unordered_base.h (.../branches/gcc-4_8-branch) -@@ -133,9 +133,19 @@ - protected: - // Initialize with a version number of 1 and no iterators - _Safe_unordered_container_base() -- : _M_local_iterators(0), _M_const_local_iterators(0) -+ : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr) - { } + void + set_value(_Res&& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, std::move(__r)); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } -+ // Initialize with a version number of 1 and no iterators -+ _Safe_unordered_container_base(const _Safe_unordered_container_base&) -+ noexcept -+ : _Safe_unordered_container_base() { } -+ -+ _Safe_unordered_container_base(_Safe_unordered_container_base&& __x) -+ noexcept -+ : _Safe_unordered_container_base() -+ { this->_M_swap(__x); } -+ - /** Notify all iterators that reference this container that the - container is being destroyed. */ - ~_Safe_unordered_container_base() -Index: libstdc++-v3/include/debug/macros.h -=================================================================== ---- a/src/libstdc++-v3/include/debug/macros.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/debug/macros.h (.../branches/gcc-4_8-branch) -@@ -261,8 +261,9 @@ - w.r.t. the value _Value. */ - #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ - __glibcxx_check_valid_range(_First,_Last); \ --_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ -- _Value), \ -+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ -+ __gnu_debug::__base(_First), \ -+ __gnu_debug::__base(_Last), _Value), \ - _M_message(__gnu_debug::__msg_unpartitioned) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ -@@ -270,8 +271,9 @@ + void + set_exception(exception_ptr __p) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + }; - #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ - __glibcxx_check_valid_range(_First,_Last); \ --_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ -- _Value), \ -+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ -+ __gnu_debug::__base(_First), \ -+ __gnu_debug::__base(_Last), _Value), \ - _M_message(__gnu_debug::__msg_unpartitioned) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ -@@ -281,8 +283,9 @@ - w.r.t. the value _Value and predicate _Pred. */ - #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ - __glibcxx_check_valid_range(_First,_Last); \ --_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ -- _Value, _Pred), \ -+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ -+ __gnu_debug::__base(_First), \ -+ __gnu_debug::__base(_Last), _Value, _Pred), \ - _M_message(__gnu_debug::__msg_unpartitioned_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ -@@ -293,8 +296,9 @@ - w.r.t. the value _Value and predicate _Pred. */ - #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ - __glibcxx_check_valid_range(_First,_Last); \ --_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ -- _Value, _Pred), \ -+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ -+ __gnu_debug::__base(_First), \ -+ __gnu_debug::__base(_Last), _Value, _Pred), \ - _M_message(__gnu_debug::__msg_unpartitioned_pred) \ - ._M_iterator(_First, #_First) \ - ._M_iterator(_Last, #_Last) \ -Index: libstdc++-v3/include/std/future -=================================================================== ---- a/src/libstdc++-v3/include/std/future (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/std/future (.../branches/gcc-4_8-branch) -@@ -1261,9 +1261,11 @@ - struct __future_base::_Task_state<_Fn, _Alloc, _Res(_Args...)> final - : __future_base::_Task_state_base<_Res(_Args...)> - { -- _Task_state(_Fn&& __fn, const _Alloc& __a) -- : _Task_state_base<_Res(_Args...)>(__a), _M_impl(std::move(__fn), __a) -- { } -+ template<typename _Fn2> -+ _Task_state(_Fn2&& __fn, const _Alloc& __a) -+ : _Task_state_base<_Res(_Args...)>(__a), -+ _M_impl(std::forward<_Fn2>(__fn), __a) -+ { } +@@ -1081,15 +1085,17 @@ + void + set_value(_Res& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, __r); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } - private: - virtual void -@@ -1292,19 +1294,21 @@ + void + set_exception(exception_ptr __p) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + }; - struct _Impl : _Alloc +@@ -1166,8 +1172,9 @@ + void + set_exception(exception_ptr __p) { -- _Impl(_Fn&& __fn, const _Alloc& __a) -- : _Alloc(__a), _M_fn(std::move(__fn)) { } -+ template<typename _Fn2> -+ _Impl(_Fn2&& __fn, const _Alloc& __a) -+ : _Alloc(__a), _M_fn(std::forward<_Fn2>(__fn)) { } - _Fn _M_fn; - } _M_impl; ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } }; -- template<typename _Signature, typename _Fn, typename _Alloc> -- static shared_ptr<__future_base::_Task_state_base<_Signature>> -- __create_task_state(_Fn&& __fn, const _Alloc& __a) -- { -- typedef __future_base::_Task_state<_Fn, _Alloc, _Signature> _State; -- return std::allocate_shared<_State>(__a, std::move(__fn), __a); -- } -+ template<typename _Signature, typename _Fn, typename _Alloc> -+ static shared_ptr<__future_base::_Task_state_base<_Signature>> -+ __create_task_state(_Fn&& __fn, const _Alloc& __a) -+ { -+ typedef typename decay<_Fn>::type _Fn2; -+ typedef __future_base::_Task_state<_Fn2, _Alloc, _Signature> _State; -+ return std::allocate_shared<_State>(__a, std::forward<_Fn>(__fn), __a); -+ } +@@ -1193,8 +1200,9 @@ + inline void + promise<void>::set_value() + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } - template<typename _Fn, typename _Alloc, typename _Res, typename... _Args> - shared_ptr<__future_base::_Task_state_base<_Res(_Args...)>> -@@ -1344,7 +1348,8 @@ - __constrain_pkgdtask<packaged_task, _Fn>::__type> - explicit - packaged_task(_Fn&& __fn) -- : packaged_task(allocator_arg, std::allocator<int>(), std::move(__fn)) -+ : packaged_task(allocator_arg, std::allocator<int>(), -+ std::forward<_Fn>(__fn)) - { } - // _GLIBCXX_RESOLVE_LIB_DEFECTS -Index: libstdc++-v3/include/bits/atomic_base.h +Index: libstdc++-v3/include/bits/stl_tree.h =================================================================== ---- a/src/libstdc++-v3/include/bits/atomic_base.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/bits/atomic_base.h (.../branches/gcc-4_8-branch) -@@ -764,11 +764,11 @@ +--- a/src/libstdc++-v3/include/bits/stl_tree.h (.../tags/gcc_4_8_3_release) ++++ b/src/libstdc++-v3/include/bits/stl_tree.h (.../branches/gcc-4_8-branch) +@@ -510,11 +510,11 @@ - bool - is_lock_free() const noexcept -- { return __atomic_is_lock_free(_M_type_size(1), nullptr); } -+ { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); } + _Link_type + _M_end() +- { return static_cast<_Link_type>(&this->_M_impl._M_header); } ++ { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); } - bool - is_lock_free() const volatile noexcept -- { return __atomic_is_lock_free(_M_type_size(1), nullptr); } -+ { return __atomic_is_lock_free(sizeof(__pointer_type), nullptr); } + _Const_Link_type + _M_end() const +- { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); } ++ { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); } - void - store(__pointer_type __p, -Index: libstdc++-v3/include/bits/stl_vector.h -=================================================================== ---- a/src/libstdc++-v3/include/bits/stl_vector.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/bits/stl_vector.h (.../branches/gcc-4_8-branch) -@@ -1361,7 +1361,8 @@ - void - _M_move_assign(vector&& __x, std::true_type) noexcept - { -- const vector __tmp(std::move(*this)); -+ vector __tmp(get_allocator()); -+ this->_M_impl._M_swap_data(__tmp._M_impl); - this->_M_impl._M_swap_data(__x._M_impl); - if (_Alloc_traits::_S_propagate_on_move_assign()) - std::__alloc_on_move(_M_get_Tp_allocator(), -Index: libstdc++-v3/include/bits/stl_algo.h -=================================================================== ---- a/src/libstdc++-v3/include/bits/stl_algo.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/bits/stl_algo.h (.../branches/gcc-4_8-branch) -@@ -2279,7 +2279,7 @@ - _RandomAccessIterator __last) - { - _RandomAccessIterator __mid = __first + (__last - __first) / 2; -- std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2)); -+ std::__move_median_to_first(__first, __first + 1, __mid, __last - 1); - return std::__unguarded_partition(__first + 1, __last, *__first); - } - -@@ -2291,7 +2291,7 @@ - _RandomAccessIterator __last, _Compare __comp) - { - _RandomAccessIterator __mid = __first + (__last - __first) / 2; -- std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2), -+ std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, - __comp); - return std::__unguarded_partition(__first + 1, __last, *__first, __comp); - } -Index: libstdc++-v3/include/bits/shared_ptr_base.h + static const_reference + _S_value(_Const_Link_type __x) +Index: libstdc++-v3/include/tr2/bool_set =================================================================== ---- a/src/libstdc++-v3/include/bits/shared_ptr_base.h (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/bits/shared_ptr_base.h (.../branches/gcc-4_8-branch) -@@ -233,7 +233,7 @@ - _M_add_ref_lock() - { - // Perform lock-free add-if-not-zero operation. -- _Atomic_word __count = _M_use_count; -+ _Atomic_word __count = _M_get_use_count(); - do - { - if (__count == 0) -@@ -391,7 +391,7 @@ - public: - template<typename... _Args> - _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) -- : _M_impl(__a), _M_storage() -+ : _M_impl(__a) - { - _M_impl._M_ptr = static_cast<_Tp*>(static_cast<void*>(&_M_storage)); - // _GLIBCXX_RESOLVE_LIB_DEFECTS -@@ -819,7 +819,7 @@ - : _M_ptr(__r.get()), _M_refcount() - { - __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) -- auto __tmp = std::__addressof(*__r.get()); -+ auto __tmp = __r.get(); - _M_refcount = __shared_count<_Lp>(std::move(__r)); - __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); - } -Index: libstdc++-v3/include/c_global/cstdio -=================================================================== ---- a/src/libstdc++-v3/include/c_global/cstdio (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/include/c_global/cstdio (.../branches/gcc-4_8-branch) -@@ -69,6 +69,7 @@ - #undef ftell - #undef fwrite - #undef getc -+#undef getchar - #undef gets - #undef perror - #undef printf +--- a/src/libstdc++-v3/include/tr2/bool_set (.../tags/gcc_4_8_3_release) ++++ b/src/libstdc++-v3/include/tr2/bool_set (.../branches/gcc-4_8-branch) +@@ -44,7 +44,7 @@ + * bool_set + * + * See N2136, Bool_set: multi-valued logic +- * by Herv Brnnimann, Guillaume Melquiond, Sylvain Pion. ++ * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. + * + * The implicit conversion to bool is slippery! I may use the new + * explicit conversion. This has been specialized in the language Index: libstdc++-v3/ChangeLog =================================================================== ---- a/src/libstdc++-v3/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/libstdc++-v3/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/libstdc++-v3/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,159 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r204808: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * scripts/extract_symvers.in: Ignore <localentry: > fields -+ in readelf --symbols output. -+ -+2014-03-26 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/59548 -+ * include/debug/safe_unordered_base.h (_Safe_unordered_container_base): -+ Define copy and move constructors that handle iterators correctly. -+ * testsuite/23_containers/unordered_map/59548.cc: New. -+ -+2014-03-25 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/60658 -+ * include/bits/atomic_base.h (__atomic_base<_PTp*>::is_lock_free()): -+ Use sizeof pointer type not the element type. -+ * testsuite/29_atomics/atomic/60658.cc: New. -+ -+2014-03-18 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/60564 -+ * include/std/future (__future_base::_Task_state<>): Change -+ constructors to template functions using perfect forwarding. -+ (__create_task_state): Use decayed type as stored task. -+ (packaged_task::packaged_task(_Fn&&)): Forward instead of moving. -+ * testsuite/30_threads/packaged_task/60564.cc: New. -+ -+2014-03-12 Roland McGrath <mcgrathr@google.com> -+ Mark Seaborn <mseaborn@google.com> -+ -+ PR libstdc++/59392 -+ * libsupc++/eh_call.cc (__cxa_call_unexpected): Call __do_catch with -+ the address of a null pointer, not with a null pointer to pointer. -+ Copy comment for this case from eh_personality.cc:__cxa_call_unexpected. -+ * testsuite/18_support/bad_exception/59392.cc: New file. -+ -+2014-03-11 Jonathan Wakely <jwakely@redhat.com> -+ -+ Backport from mainline. -+ 2014-01-09 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/59680 -+ * src/c++11/thread.cc (__sleep_for): Fix call to ::sleep. -+ -+2014-03-11 Jonathan Wakely <jwakely@redhat.com> -+ -+ Backport from mainline. -+ 2014-01-27 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/59215 -+ * include/bits/shared_ptr_base.h -+ (_Sp_counted_base<_S_atomic>::_M_add_ref_lock()): Use relaxed atomic -+ load. -+ -+2014-03-11 Jonathan Wakely <jwakely@redhat.com> +@@ -1,3 +1,27 @@ ++2014-06-03 Jonathan Wakely <jwakely@redhat.com> + -+ Backport from mainline. -+ -+ 2014-01-09 Jonathan Wakely <jwakely@redhat.com> -+ -+ PR libstdc++/59738 -+ * include/bits/stl_vector.h (vector<>::_M_move_assign): Restore -+ support for non-Movable types. -+ -+ 2014-01-08 François Dumont <fdumont@gcc.gnu.org> -+ -+ * include/bits/stl_vector.h (std::vector<>::_M_move_assign): Pass -+ *this allocator instance when building temporary vector instance -+ so that *this allocator does not get moved. -+ * testsuite/23_containers/vector/allocator/move.cc (test01): Add -+ check on a vector iterator. -+ * testsuite/23_containers/vector/allocator/move_assign.cc -+ (test02): Likewise. -+ (test03): New, test with a non-propagating allocator. -+ -+ 2013-11-15 Jonathan Wakely <jwakely.gcc@gmail.com> -+ -+ * testsuite/23_containers/vector/allocator/move.cc: New -+ -+2014-01-27 Jason Merrill <jason@redhat.com> -+ -+ Core DR 475 -+ PR c++/41174 -+ PR c++/59224 -+ * libsupc++/eh_throw.cc (__cxa_throw): Set uncaughtExceptions. -+ * libsupc++/eh_alloc.cc (__cxa_allocate_dependent_exception) -+ (__cxa_allocate_exception): Don't set it here. -+ -+2013-12-15 H.J. Lu <hongjiu.lu@intel.com> -+ -+ * config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Update. -+ -+2013-11-22 Jonathan Wakely <jwakely.gcc@gmail.com> -+ -+ * acinclude.m4 (libtool_VERSION): Bump. -+ * configure: Regenerate. -+ * doc/xml/manual/abi.xml: Update version information. -+ -+2013-11-05 Jonathan Wakely <jwakely.gcc@gmail.com> -+ -+ * doc/xml/manual/status_cxx2011.xml: Document aligned_union as -+ missing. -+ -+ * doc/xml/manual/spine.xml: Update copyright years. -+ * doc/html/*: Regenerate. -+ -+2013-11-01 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR libstdc++/58952 -+ * include/c_global/cstdio: Undef getchar. -+ -+2013-10-31 Jonathan Wakely <jwakely.gcc@gmail.com> -+ -+ * testsuite/20_util/shared_ptr/cons/58839.cc: Do not use -+ default_delete<void>. -+ -+2013-10-30 Chris Studholme <cvs@cs.utoronto.ca> -+ -+ PR libstdc++/58912 -+ * include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace): Remove -+ unnecessary initialization of storage buffer. -+ -+2013-10-29 Jonathan Wakely <jwakely.gcc@gmail.com> ++ Backport from mainline ++ 2014-04-15 Jonathan Wakely <jwakely@redhat.com> + -+ PR libstdc++/58839 -+ * include/bits/shared_ptr_base.h -+ (__shared_ptr<T>::__shared_ptr(unique_ptr<U,D>&&)): Do not dereference -+ pointer. -+ * testsuite/20_util/shared_ptr/cons/58839.cc: New. ++ PR libstdc++/60734 ++ * include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast. + -+2013-10-20 Chris Jefferson <chris@bubblescope.net> -+ Paolo Carlini <paolo.carlini@oracle.com> ++ Backport from mainline ++ 2014-05-16 Jonathan Wakely <jwakely@redhat.com> + -+ PR libstdc++/58800 -+ * include/bits/stl_algo.h (__unguarded_partition_pivot): Change -+ __last - 2 to __last - 1. -+ * testsuite/25_algorithms/nth_element/58800.cc: New ++ PR libstdc++/60966 ++ * include/std/future (__future_base::_State_baseV2::_M_set_result): ++ Signal condition variable after call_once returns. ++ (__future_base::_State_baseV2::_M_do_set): Do not signal here. ++ (promise::set_value, promise::set_exception): Increment the reference ++ count on the shared state until the function returns. ++ * testsuite/30_threads/promise/60966.cc: New. + -+2013-10-16 François Dumont <fdumont@gcc.gnu.org> ++2014-05-29 Jonathan Wakely <jwakely@redhat.com> + -+ PR libstdc++/58191 -+ * include/debug/macros.h (__glibcxx_check_partitioned_lower): Add -+ __gnu_debug::__base calls on iterators passed to internal debug -+ check. -+ (__glibcxx_check_partitioned_lower_pred): Likewise. -+ (__glibcxx_check_partitioned_upper): Likewise. -+ (__glibcxx_check_partitioned_upper_pred): Likewise. -+ * include/debug/functions.h (__check_partitioned_lower): -+ Remove code to detect safe iterators. -+ (__check_partitioned_upper): Likewise. ++ * include/tr2/bool_set: Use UTF-8 for accented characters. ++ * scripts/run_doxygen: Handle Doxygen 1.8.x change. + - 2013-10-16 Release Manager + 2014-05-22 Release Manager - * GCC 4.8.2 released. -Index: libstdc++-v3/libsupc++/eh_call.cc + * GCC 4.8.3 released. +Index: libstdc++-v3/testsuite/30_threads/promise/60966.cc =================================================================== ---- a/src/libstdc++-v3/libsupc++/eh_call.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/libsupc++/eh_call.cc (.../branches/gcc-4_8-branch) -@@ -104,14 +104,14 @@ - } end_catch_protect_obj; - - -- __try -- { -+ __try -+ { - if (foreign_exception) - std::unexpected(); - else - __unexpected(unexpectedHandler); - } -- __catch(...) -+ __catch(...) - { - /* See if the new exception matches the rtti list. */ - if (foreign_exception) -@@ -140,15 +140,19 @@ - &new_ptr) != ctm_failed) - __throw_exception_again; - -- if (catch_type->__do_catch(&bad_exc, 0, 1)) -+ // If the exception spec allows std::bad_exception, throw that. -+ // We don't have a thrown object to compare against, but since -+ // bad_exception doesn't have virtual bases, that's OK; just pass NULL. -+ void* obj = NULL; -+ if (catch_type->__do_catch(&bad_exc, &obj, 1)) - bad_exception_allowed = true; - } - - // If the exception spec allows std::bad_exception, throw that. --#ifdef __EXCEPTIONS -+#ifdef __EXCEPTIONS - if (bad_exception_allowed) - throw std::bad_exception(); --#endif -+#endif - - // Otherwise, die. - __terminate(terminateHandler); -Index: libstdc++-v3/libsupc++/eh_alloc.cc -=================================================================== ---- a/src/libstdc++-v3/libsupc++/eh_alloc.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/libsupc++/eh_alloc.cc (.../branches/gcc-4_8-branch) -@@ -129,12 +129,6 @@ - std::terminate (); - } - -- // We have an uncaught exception as soon as we allocate memory. This -- // yields uncaught_exception() true during the copy-constructor that -- // initializes the exception object. See Issue 475. -- __cxa_eh_globals *globals = __cxa_get_globals (); -- globals->uncaughtExceptions += 1; -- - memset (ret, 0, sizeof (__cxa_refcounted_exception)); - - return (void *)((char *)ret + sizeof (__cxa_refcounted_exception)); -@@ -191,12 +185,6 @@ - std::terminate (); - } - -- // We have an uncaught exception as soon as we allocate memory. This -- // yields uncaught_exception() true during the copy-constructor that -- // initializes the exception object. See Issue 475. -- __cxa_eh_globals *globals = __cxa_get_globals (); -- globals->uncaughtExceptions += 1; -- - memset (ret, 0, sizeof (__cxa_dependent_exception)); - - return ret; -Index: libstdc++-v3/libsupc++/eh_throw.cc -=================================================================== ---- a/src/libstdc++-v3/libsupc++/eh_throw.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/libsupc++/eh_throw.cc (.../branches/gcc-4_8-branch) -@@ -62,6 +62,9 @@ - { - PROBE2 (throw, obj, tinfo); - -+ __cxa_eh_globals *globals = __cxa_get_globals (); -+ globals->uncaughtExceptions += 1; -+ - // Definitely a primary. - __cxa_refcounted_exception *header - = __get_refcounted_exception_header_from_obj (obj); -Index: libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,52 @@ -+// Copyright (C) 2013 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+// 25.3.2 [lib.alg.nth.element] -+ -+// { dg-options "-std=gnu++11" } -+ -+#include <algorithm> -+#include <testsuite_hooks.h> -+#include <testsuite_iterators.h> -+ -+using __gnu_test::test_container; -+using __gnu_test::random_access_iterator_wrapper; -+ -+typedef test_container<int, random_access_iterator_wrapper> Container; -+ -+void test01() -+{ -+ std::vector<int> v = { -+ 207089, -+ 202585, -+ 180067, -+ 157549, -+ 211592, -+ 216096, -+ 207089 -+ }; -+ -+ Container con(v.data(), v.data() + 7); -+ -+ std::nth_element(con.begin(), con.begin() + 3, con.end()); -+} -+ -+int main() -+{ -+ test01(); -+ return 0; -+} -Index: libstdc++-v3/testsuite/18_support/bad_exception/59392.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,51 @@ -+// Copyright (C) 2014 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+#include <exception> -+#include <cstdlib> -+ -+class expected {}; -+class unexpected {}; -+class from_handler {}; -+ -+static void func_with_exception_spec() throw(expected) -+{ -+ throw unexpected(); -+} -+ -+static void unexpected_handler() -+{ -+ throw from_handler(); -+} -+ -+static void terminate_handler() -+{ -+ exit(0); -+} -+ -+// libstdc++/59392 -+int main() -+{ -+ std::set_unexpected(unexpected_handler); -+ std::set_terminate(terminate_handler); -+ try { -+ func_with_exception_spec(); -+ } catch (expected&) { -+ abort(); -+ } -+ abort(); -+} - -Property changes on: libstdc++-v3/testsuite/18_support/bad_exception/59392.cc -___________________________________________________________________ -Added: svn:eol-style -## -0,0 +1 ## -+LF -\ No newline at end of property -Index: libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,51 @@ +--- a/src/libstdc++-v3/testsuite/30_threads/promise/60966.cc (.../tags/gcc_4_8_3_release) ++++ b/src/libstdc++-v3/testsuite/30_threads/promise/60966.cc (.../branches/gcc-4_8-branch) +@@ -0,0 +1,67 @@ +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } @@ -4450,78528 +227,3214 @@ Index: libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + ++// libstdc++/60966 ++// This test hangs if std::promise::~promise() destroys the ++// shared state before std::promise::set_value() finishes using it. + +#include <future> -+#include <testsuite_hooks.h> -+ -+struct X -+{ -+ X() = default; -+ X(const X&) = default; -+ X(X&& x) { x.moved = true; } -+ -+ void operator()() const { } ++#include <thread> ++#include <vector> + -+ bool moved = false; -+}; ++const int THREADS = 10; + -+void test01() ++void run_task(std::promise<void>* pr) +{ -+ X x; -+ std::packaged_task<void()> p(x); -+ VERIFY( !x.moved ); ++ std::this_thread::sleep_for(std::chrono::milliseconds(100)); ++ pr->set_value(); +} + +int main() +{ -+ test01(); -+} -Index: libstdc++-v3/testsuite/29_atomics/atomic/60658.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/29_atomics/atomic/60658.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/29_atomics/atomic/60658.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,43 @@ -+// { dg-require-atomic-builtins "" } -+// { dg-options "-std=gnu++11" } -+ -+// Copyright (C) 2014 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+#include <atomic> -+#include <testsuite_hooks.h> -+ -+// libstdc++/60658 -+ -+struct Foo { -+ char buf[1]; -+}; -+ -+struct Bar { -+ char buf[100]; -+}; -+ -+int -+main () -+{ -+ bool test __attribute__((unused)) = true; -+ -+ std::atomic<Foo*> a; -+ std::atomic<Bar*> b; -+ -+ VERIFY (a.is_lock_free() == b.is_lock_free()); -+} -Index: libstdc++-v3/testsuite/23_containers/unordered_map/59548.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/23_containers/unordered_map/59548.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/23_containers/unordered_map/59548.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+// { dg-options "-std=gnu++11" } -+// { dg-do compile } -+// { dg-require-debug-mode "" } -+ -+// Copyright (C) 2014 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+// libstdc++/59548 ++ std::vector<std::promise<void>*> tasks(THREADS); ++ std::vector<std::thread> threads(THREADS); ++ std::vector<std::future<void>> futures(THREADS); + -+#include <unordered_map> -+ -+int main() -+{ -+ std::unordered_map<int,int> foo{ {0,1} }; -+ auto i = foo.begin(); ++ for (int i = 0; i < THREADS; ++i) + { -+ auto bar = foo; ++ std::promise<void>* task = new std::promise<void>; ++ tasks[i] = task; ++ futures[i] = task->get_future(); ++ threads[i] = std::thread(run_task, task); + } -+ return i->first; -+} -Index: libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/23_containers/vector/allocator/move.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,59 @@ -+// Copyright (C) 2013 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+// { dg-options "-std=gnu++11" } -+ -+#include <vector> -+#include <testsuite_hooks.h> -+#include <testsuite_allocator.h> -+ -+struct T { int i; }; -+ -+using __gnu_test::uneq_allocator; -+ -+void test01() -+{ -+ bool test __attribute__((unused)) = true; -+ typedef uneq_allocator<T> alloc_type; -+ typedef std::vector<T, alloc_type> test_type; -+ test_type v1(alloc_type(1)); -+ v1 = { T() }; -+ auto it = v1.begin(); -+ test_type v2(std::move(v1)); -+ VERIFY(1 == v1.get_allocator().get_personality()); -+ VERIFY(1 == v2.get_allocator().get_personality()); -+ VERIFY( it == v2.begin() ); -+} -+ -+void test02() -+{ -+ bool test __attribute__((unused)) = true; -+ typedef uneq_allocator<T> alloc_type; -+ typedef std::vector<T, alloc_type> test_type; -+ test_type v1(alloc_type(1)); -+ v1 = { T() }; -+ test_type v2(std::move(v1), alloc_type(2)); -+ VERIFY(1 == v1.get_allocator().get_personality()); -+ VERIFY(2 == v2.get_allocator().get_personality()); -+} -+ -+int main() -+{ -+ test01(); -+ test02(); -+ return 0; -+} -Index: libstdc++-v3/testsuite/23_containers/vector/allocator/move_assign.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/23_containers/vector/allocator/move_assign.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/23_containers/vector/allocator/move_assign.cc (.../branches/gcc-4_8-branch) -@@ -46,16 +46,35 @@ - typedef std::vector<T, alloc_type> test_type; - test_type v1(alloc_type(1)); - v1.push_back(T()); -+ auto it = v1.begin(); - test_type v2(alloc_type(2)); -+ v2.push_back(T()); - v2 = std::move(v1); -- v2.push_back(T()); -+ VERIFY( it == v2.begin() ); - VERIFY(0 == v1.get_allocator().get_personality()); - VERIFY(1 == v2.get_allocator().get_personality()); - } - -+void test03() -+{ -+ bool test __attribute__((unused)) = true; -+ typedef propagating_allocator<T, false> alloc_type; -+ typedef std::vector<T, alloc_type> test_type; -+ test_type v1(alloc_type(1)); -+ v1.push_back(T()); -+ auto it = v1.begin(); -+ test_type v2(alloc_type(1)); -+ v2.push_back(T()); -+ v2 = std::move(v1); -+ VERIFY( it == v2.begin() ); -+ VERIFY(1 == v1.get_allocator().get_personality()); -+ VERIFY(1 == v2.get_allocator().get_personality()); -+} -+ - int main() - { - test01(); - test02(); -+ test03(); - return 0; - } -Index: libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+// { dg-options "-std=gnu++11" } -+// { dg-do compile } -+ -+// Copyright (C) 2013 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. + -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+#include <memory> -+ -+// libstdc++/58839 -+ -+struct D { -+ void operator()(void*) const noexcept { } -+}; -+ -+void test01() -+{ -+ std::unique_ptr<void, D> y; -+ std::shared_ptr<void> x = std::move(y); -+} -Index: libstdc++-v3/testsuite/20_util/bind/57899.cc -=================================================================== ---- a/src/libstdc++-v3/testsuite/20_util/bind/57899.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/testsuite/20_util/bind/57899.cc (.../branches/gcc-4_8-branch) -@@ -0,0 +1,48 @@ -+// Copyright (C) 2010-2014 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 3, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING3. If not see -+// <http://www.gnu.org/licenses/>. -+ -+// 20.7.11 Function template bind -+ -+// PR c++/57899 -+// { dg-do compile } -+// { dg-options -std=c++11 } -+ -+#include <functional> -+using std::bind; -+using std::placeholders::_1; -+ -+struct S { int i; }; -+ -+struct P { S s; }; -+ -+struct get_s -+{ -+ const S& operator()(const P& p) const { return p.s; } -+} gs; -+ -+int gi(const S& s) { return s.i; } -+ -+bool cmp(int, int) { return true; } ++ for (int i = 0; i < THREADS; ++i) ++ { ++ // the temporary future releases the state as soon as wait() returns ++ std::future<void>(std::move(futures[i])).wait(); ++ // state is ready, should now be safe to delete promise, so it ++ // releases the shared state too ++ delete tasks[i]; ++ } + -+int main() -+{ -+ P p{}; -+ auto f1 = bind(gs, _1); -+ auto f2 = bind(gi, f1); -+ auto f3 = bind(cmp, f2, 5); -+ f3(p); ++ for (auto& t : threads) ++ t.join(); +} -Index: libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt -=================================================================== ---- a/src/libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt (.../branches/gcc-4_8-branch) -@@ -403,6 +403,7 @@ - FUNC:_ZNKSt15basic_streambufIwSt11char_traitsIwEE6getlocEv@@GLIBCXX_3.4 - FUNC:_ZNKSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strEv@@GLIBCXX_3.4 - FUNC:_ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv@@GLIBCXX_3.4 -+FUNC:_ZNKSt17bad_function_call4whatEv@@GLIBCXX_3.4.18 - FUNC:_ZNKSt18basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv@@GLIBCXX_3.4 - FUNC:_ZNKSt18basic_stringstreamIcSt11char_traitsIcESaIcEE5rdbufEv@@GLIBCXX_3.4 - FUNC:_ZNKSt18basic_stringstreamIwSt11char_traitsIwESaIwEE3strEv@@GLIBCXX_3.4 -@@ -590,6 +591,8 @@ - FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewm@@GLIBCXX_3.4 - FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewx@@GLIBCXX_3.4 - FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewy@@GLIBCXX_3.4 -+FUNC:_ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEj@@GLIBCXX_3.4.18 -+FUNC:_ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEjjj@@GLIBCXX_3.4.18 - FUNC:_ZNKSt8bad_cast4whatEv@@GLIBCXX_3.4.9 - FUNC:_ZNKSt8ios_base7failure4whatEv@@GLIBCXX_3.4 - FUNC:_ZNKSt8messagesIcE18_M_convert_to_charERKSs@@GLIBCXX_3.4 -@@ -1207,6 +1210,7 @@ - FUNC:_ZNSt11regex_errorD0Ev@@GLIBCXX_3.4.15 - FUNC:_ZNSt11regex_errorD1Ev@@GLIBCXX_3.4.15 - FUNC:_ZNSt11regex_errorD2Ev@@GLIBCXX_3.4.15 -+FUNC:_ZNSt11this_thread11__sleep_forENSt6chrono8durationIxSt5ratioILx1ELx1EEEENS1_IxS2_ILx1ELx1000000000EEEE@@GLIBCXX_3.4.18 - FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCXX_3.4 - FUNC:_ZNSt12__basic_fileIcE4fileEv@@GLIBCXX_3.4.1 - FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCXX_3.4 -@@ -1485,6 +1489,11 @@ - FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEt@@GLIBCXX_3.4 - FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEx@@GLIBCXX_3.4 - FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEy@@GLIBCXX_3.4 -+FUNC:_ZNSt13random_device14_M_init_pretr1ERKSs@@GLIBCXX_3.4.18 -+FUNC:_ZNSt13random_device16_M_getval_pretr1Ev@@GLIBCXX_3.4.18 -+FUNC:_ZNSt13random_device7_M_finiEv@@GLIBCXX_3.4.18 -+FUNC:_ZNSt13random_device7_M_initERKSs@@GLIBCXX_3.4.18 -+FUNC:_ZNSt13random_device9_M_getvalEv@@GLIBCXX_3.4.18 - FUNC:_ZNSt13runtime_errorC1ERKSs@@GLIBCXX_3.4 - FUNC:_ZNSt13runtime_errorC2ERKSs@@GLIBCXX_3.4 - FUNC:_ZNSt13runtime_errorD0Ev@@GLIBCXX_3.4 -@@ -1929,6 +1938,8 @@ - FUNC:_ZNSt6__norm15_List_node_base8transferEPS0_S1_@@GLIBCXX_3.4.9 - FUNC:_ZNSt6__norm15_List_node_base9_M_unhookEv@@GLIBCXX_3.4.14 - FUNC:_ZNSt6chrono12system_clock3nowEv@@GLIBCXX_3.4.11 -+FUNC:_ZNSt6chrono3_V212steady_clock3nowEv@@GLIBCXX_3.4.19 -+FUNC:_ZNSt6chrono3_V212system_clock3nowEv@@GLIBCXX_3.4.19 - FUNC:_ZNSt6gslice8_IndexerC1EjRKSt8valarrayIjES4_@@GLIBCXX_3.4 - FUNC:_ZNSt6gslice8_IndexerC2EjRKSt8valarrayIjES4_@@GLIBCXX_3.4 - FUNC:_ZNSt6locale11_M_coalesceERKS_S1_i@@GLIBCXX_3.4 -@@ -2467,6 +2478,7 @@ - FUNC:__cxa_guard_release@@CXXABI_1.3 - FUNC:__cxa_pure_virtual@@CXXABI_1.3 - FUNC:__cxa_rethrow@@CXXABI_1.3 -+FUNC:__cxa_thread_atexit@@CXXABI_1.3.7 - FUNC:__cxa_throw@@CXXABI_1.3 - FUNC:__cxa_tm_cleanup@@CXXABI_TM_1 - FUNC:__cxa_vec_cctor@@CXXABI_1.3 -@@ -2491,6 +2503,7 @@ - OBJECT:0:CXXABI_1.3.4 - OBJECT:0:CXXABI_1.3.5 - OBJECT:0:CXXABI_1.3.6 -+OBJECT:0:CXXABI_1.3.7 - OBJECT:0:CXXABI_TM_1 - OBJECT:0:GLIBCXX_3.4 - OBJECT:0:GLIBCXX_3.4.1 -@@ -2502,6 +2515,8 @@ - OBJECT:0:GLIBCXX_3.4.15 - OBJECT:0:GLIBCXX_3.4.16 - OBJECT:0:GLIBCXX_3.4.17 -+OBJECT:0:GLIBCXX_3.4.18 -+OBJECT:0:GLIBCXX_3.4.19 - OBJECT:0:GLIBCXX_3.4.2 - OBJECT:0:GLIBCXX_3.4.3 - OBJECT:0:GLIBCXX_3.4.4 -@@ -3033,6 +3048,8 @@ - OBJECT:1:_ZNSt21__numeric_limits_base9is_moduloE@@GLIBCXX_3.4 - OBJECT:1:_ZNSt21__numeric_limits_base9is_signedE@@GLIBCXX_3.4 - OBJECT:1:_ZNSt6chrono12system_clock12is_monotonicE@@GLIBCXX_3.4.11 -+OBJECT:1:_ZNSt6chrono3_V212steady_clock9is_steadyE@@GLIBCXX_3.4.19 -+OBJECT:1:_ZNSt6chrono3_V212system_clock9is_steadyE@@GLIBCXX_3.4.19 - OBJECT:1:_ZSt10adopt_lock@@GLIBCXX_3.4.11 - OBJECT:1:_ZSt10defer_lock@@GLIBCXX_3.4.11 - OBJECT:1:_ZSt11try_to_lock@@GLIBCXX_3.4.11 -Index: libstdc++-v3/acinclude.m4 -=================================================================== ---- a/src/libstdc++-v3/acinclude.m4 (.../tags/gcc_4_8_2_release) -+++ b/src/libstdc++-v3/acinclude.m4 (.../branches/gcc-4_8-branch) -@@ -3266,7 +3266,7 @@ - fi - - # For libtool versioning info, format is CURRENT:REVISION:AGE --libtool_VERSION=6:18:0 -+libtool_VERSION=6:19:0 - - # Everything parsed; figure out what files and settings to use. - case $enable_symvers in -Index: libmudflap/configure -=================================================================== ---- a/src/libmudflap/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libmudflap/configure (.../branches/gcc-4_8-branch) -@@ -6377,7 +6377,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6402,7 +6402,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6421,7 +6424,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10615,7 +10621,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10618 "configure" -+#line 10624 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10721,7 +10727,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10724 "configure" -+#line 10730 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: boehm-gc/include/private/gcconfig.h -=================================================================== ---- a/src/boehm-gc/include/private/gcconfig.h (.../tags/gcc_4_8_2_release) -+++ b/src/boehm-gc/include/private/gcconfig.h (.../branches/gcc-4_8-branch) -@@ -837,7 +837,15 @@ - # define NO_PTHREAD_TRYLOCK - # endif - # ifdef FREEBSD -+# if defined(__powerpc64__) -+# define ALIGNMENT 8 -+# define CPP_WORDSZ 64 -+# ifndef HBLKSIZE -+# define HBLKSIZE 4096 -+# endif -+# else - # define ALIGNMENT 4 -+# endif - # define OS_TYPE "FREEBSD" - # ifndef GC_FREEBSD_THREADS - # define MPROTECT_VDB -Index: boehm-gc/ChangeLog -=================================================================== ---- a/src/boehm-gc/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/boehm-gc/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,8 @@ -+2013-12-29 Andreas Tobler <andreast@gcc.gnu.org> -+ -+ Merge from trunk: -+ * include/private/gcconfig.h: Add FreeBSD powerpc64 defines. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: boehm-gc/configure -=================================================================== ---- a/src/boehm-gc/configure (.../tags/gcc_4_8_2_release) -+++ b/src/boehm-gc/configure (.../branches/gcc-4_8-branch) -@@ -6770,7 +6770,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6795,7 +6795,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6814,7 +6817,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11312,7 +11318,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11315 "configure" -+#line 11321 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11418,7 +11424,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11421 "configure" -+#line 11427 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: ChangeLog -=================================================================== ---- a/src/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,58 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-11-22 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * libgo/config/libtool.m4: Update to mainline version. -+ * libgo/configure: Regenerate. -+ -+ 2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * libgo/config/libtool.m4: Update to mainline version. -+ * libgo/configure: Regenerate. -+ -+ 2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * libtool.m4: Update to mainline version. -+ * libjava/libltdl/acinclude.m4: Likewise. -+ -+ * gcc/configure: Regenerate. -+ * boehm-gc/configure: Regenerate. -+ * libatomic/configure: Regenerate. -+ * libbacktrace/configure: Regenerate. -+ * libffi/configure: Regenerate. -+ * libgfortran/configure: Regenerate. -+ * libgomp/configure: Regenerate. -+ * libitm/configure: Regenerate. -+ * libjava/configure: Regenerate. -+ * libjava/libltdl/configure: Regenerate. -+ * libjava/classpath/configure: Regenerate. -+ * libmudflap/configure: Regenerate. -+ * libobjc/configure: Regenerate. -+ * libquadmath/configure: Regenerate. -+ * libsanitizer/configure: Regenerate. -+ * libssp/configure: Regenerate. -+ * libstdc++-v3/configure: Regenerate. -+ * lto-plugin/configure: Regenerate. -+ * zlib/configure: Regenerate. -+ -+ Backport from mainline -+ 2013-09-20 Alan Modra <amodra@gmail.com> -+ -+ * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical -+ ppc host match. Support little-endian powerpc linux hosts. -+ * configure: Regenerate. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r203071: -+ -+ 2013-10-01 Joern Rennecke <joern.rennecke@embecosm.com> -+ -+ Import from savannah.gnu.org: -+ * config.guess: Update to 2013-06-10 version. -+ * config.sub: Update to 2013-10-01 version. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: lto-plugin/configure -=================================================================== ---- a/src/lto-plugin/configure (.../tags/gcc_4_8_2_release) -+++ b/src/lto-plugin/configure (.../branches/gcc-4_8-branch) -@@ -6044,7 +6044,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6069,7 +6069,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6088,7 +6091,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10552,7 +10558,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10555 "configure" -+#line 10561 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10658,7 +10664,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10661 "configure" -+#line 10667 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H Index: contrib/ChangeLog =================================================================== ---- a/src/contrib/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/contrib/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/contrib/ChangeLog (.../branches/gcc-4_8-branch) @@ -1,3 +1,7 @@ -+2013-10-21 Mike Stump <mikestump@comcast.net> -+ -+ * gcc_update (configure): Update to handle svn 1.8.1. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: contrib/gcc_update -=================================================================== ---- a/src/contrib/gcc_update (.../tags/gcc_4_8_2_release) -+++ b/src/contrib/gcc_update (.../branches/gcc-4_8-branch) -@@ -382,7 +382,7 @@ - fi - - revision=`$GCC_SVN info | awk '/Revision:/ { print $2 }'` -- branch=`$GCC_SVN info | sed -ne "/URL:/ { -+ branch=`$GCC_SVN info | sed -ne "/^URL:/ { - s,.*/trunk,trunk, - s,.*/branches/,, - s,.*/tags/,, -Index: libatomic/configure -=================================================================== ---- a/src/libatomic/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libatomic/configure (.../branches/gcc-4_8-branch) -@@ -6505,7 +6505,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6530,7 +6530,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6549,7 +6552,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11013,7 +11019,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11016 "configure" -+#line 11022 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11119,7 +11125,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11122 "configure" -+#line 11128 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libatomic/cas_n.c -=================================================================== ---- a/src/libatomic/cas_n.c (.../tags/gcc_4_8_2_release) -+++ b/src/libatomic/cas_n.c (.../branches/gcc-4_8-branch) -@@ -51,10 +51,9 @@ - #if !DONE && N <= WORDSIZE && defined(atomic_compare_exchange_w) - bool - SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval, -- int smodel, int fmodel UNUSED) -+ int smodel, int fmodel) - { - UWORD mask, shift, weval, woldval, wnewval, t, *wptr; -- bool ret = false; - - pre_barrier (smodel); - -@@ -82,12 +81,13 @@ - } - while (!atomic_compare_exchange_w (wptr, &woldval, t, true, - __ATOMIC_RELAXED, __ATOMIC_RELAXED)); -- ret = true; -+ post_barrier (smodel); -+ return true; -+ - failure: - *eptr = woldval >> shift; -- -- post_barrier (smodel); -- return ret; -+ post_barrier (fmodel); -+ return false; - } - - #define DONE 1 -@@ -102,18 +102,17 @@ - { - UTYPE oldval; - UWORD magic; -- bool ret = false; -+ bool ret; - - pre_seq_barrier (smodel); - magic = protect_start (mptr); - - oldval = *mptr; -- if (oldval == *eptr) -- { -- *mptr = newval; -- ret = true; -- } -- *eptr = oldval; -+ ret = (oldval == *eptr); -+ if (ret) -+ *mptr = newval; -+ else -+ *eptr = oldval; - - protect_end (mptr, magic); - post_seq_barrier (smodel); -Index: libatomic/ChangeLog -=================================================================== ---- a/src/libatomic/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libatomic/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,9 @@ -+2014-02-20 Richard Henderson <rth@redhat.com> -+ -+ PR c++/60272 -+ * cas_n.c (libat_compare_exchange): Conditionalize on failure -+ the store back to EPTR. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libbacktrace/configure -=================================================================== ---- a/src/libbacktrace/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/configure (.../branches/gcc-4_8-branch) -@@ -6842,7 +6842,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6867,7 +6867,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6886,7 +6889,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11081,7 +11087,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11084 "configure" -+#line 11090 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11187,7 +11193,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11190 "configure" -+#line 11196 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11667,12 +11673,13 @@ - return 0; - } - _ACEOF --if ac_fn_c_try_compile "$LINENO"; then : -+if ac_fn_c_try_link "$LINENO"; then : - have_unwind_getipinfo=yes - else - have_unwind_getipinfo=no - fi --rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5 - $as_echo "$have_unwind_getipinfo" >&6; } -Index: libbacktrace/Makefile.in -=================================================================== ---- a/src/libbacktrace/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/Makefile.in (.../branches/gcc-4_8-branch) -@@ -16,7 +16,7 @@ - @SET_MAKE@ - - # Makefile.am -- Backtrace Makefile. --# Copyright (C) 2012 Free Software Foundation, Inc. -+# Copyright (C) 2012-2013 Free Software Foundation, Inc. - - # Redistribution and use in source and binary forms, with or without - # modification, are permitted provided that the following conditions are -Index: libbacktrace/dwarf.c -=================================================================== ---- a/src/libbacktrace/dwarf.c (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/dwarf.c (.../branches/gcc-4_8-branch) -@@ -2507,7 +2507,6 @@ - if (pfvec->count == 0) - return; - -- addrs = (struct function_addrs *) pfvec->vec.base; - addrs_count = pfvec->count; - - if (fvec == NULL) -@@ -2514,12 +2513,17 @@ - { - if (!backtrace_vector_release (state, &lvec.vec, error_callback, data)) - return; -+ addrs = (struct function_addrs *) pfvec->vec.base; - } - else - { - /* Finish this list of addresses, but leave the remaining space in - the vector available for the next function unit. */ -- backtrace_vector_finish (state, &fvec->vec); -+ addrs = ((struct function_addrs *) -+ backtrace_vector_finish (state, &fvec->vec, -+ error_callback, data)); -+ if (addrs == NULL) -+ return; - fvec->count = 0; - } - -Index: libbacktrace/ChangeLog -=================================================================== ---- a/src/libbacktrace/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,28 @@ -+2014-02-07 Misty De Meo <misty@brew.sh> -+ -+ PR target/58710 -+ * configure.ac: Use AC_LINK_IFELSE in check for -+ _Unwind_GetIPInfo. -+ * configure: Regenerate. -+ -+2013-12-05 Ian Lance Taylor <iant@google.com> -+ -+ * alloc.c (backtrace_vector_finish): Add error_callback and data -+ parameters. Call backtrace_vector_release. Return address base. -+ * mmap.c (backtrace_vector_finish): Add error_callback and data -+ parameters. Return address base. -+ * dwarf.c (read_function_info): Get new address base from -+ backtrace_vector_finish. -+ * internal.h (backtrace_vector_finish): Update declaration. -+ -+2013-11-30 Ian Lance Taylor <iant@google.com> -+ -+ Backport from mainline: -+ 2013-10-17 Ian Lance Taylor <iant@google.com> -+ -+ * elf.c (elf_add): Don't get the wrong offsets if a debug section -+ is missing. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libbacktrace/elf.c -=================================================================== ---- a/src/libbacktrace/elf.c (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/elf.c (.../branches/gcc-4_8-branch) -@@ -725,6 +725,8 @@ - { - off_t end; - -+ if (sections[i].size == 0) -+ continue; - if (min_offset == 0 || sections[i].offset < min_offset) - min_offset = sections[i].offset; - end = sections[i].offset + sections[i].size; -@@ -751,8 +753,13 @@ - descriptor = -1; - - for (i = 0; i < (int) DEBUG_MAX; ++i) -- sections[i].data = ((const unsigned char *) debug_view.data -- + (sections[i].offset - min_offset)); -+ { -+ if (sections[i].size == 0) -+ sections[i].data = NULL; -+ else -+ sections[i].data = ((const unsigned char *) debug_view.data -+ + (sections[i].offset - min_offset)); -+ } - - if (!backtrace_dwarf_add (state, base_address, - sections[DEBUG_INFO].data, -Index: libbacktrace/internal.h -=================================================================== ---- a/src/libbacktrace/internal.h (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/internal.h (.../branches/gcc-4_8-branch) -@@ -192,13 +192,17 @@ - struct backtrace_vector *vec); - - /* Finish the current allocation on VEC. Prepare to start a new -- allocation. The finished allocation will never be freed. */ -+ allocation. The finished allocation will never be freed. Returns -+ a pointer to the base of the finished entries, or NULL on -+ failure. */ - --extern void backtrace_vector_finish (struct backtrace_state *state, -- struct backtrace_vector *vec); -+extern void* backtrace_vector_finish (struct backtrace_state *state, -+ struct backtrace_vector *vec, -+ backtrace_error_callback error_callback, -+ void *data); - --/* Release any extra space allocated for VEC. Returns 1 on success, 0 -- on failure. */ -+/* Release any extra space allocated for VEC. This may change -+ VEC->base. Returns 1 on success, 0 on failure. */ - - extern int backtrace_vector_release (struct backtrace_state *state, - struct backtrace_vector *vec, -Index: libbacktrace/configure.ac -=================================================================== ---- a/src/libbacktrace/configure.ac (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/configure.ac (.../branches/gcc-4_8-branch) -@@ -144,7 +144,7 @@ - ac_save_CFFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror-implicit-function-declaration" - AC_MSG_CHECKING([for _Unwind_GetIPInfo]) -- AC_COMPILE_IFELSE( -+ AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include "unwind.h" - struct _Unwind_Context *context; -Index: libbacktrace/alloc.c -=================================================================== ---- a/src/libbacktrace/alloc.c (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/alloc.c (.../branches/gcc-4_8-branch) -@@ -113,12 +113,24 @@ - - /* Finish the current allocation on VEC. */ - --void --backtrace_vector_finish (struct backtrace_state *state ATTRIBUTE_UNUSED, -- struct backtrace_vector *vec) -+void * -+backtrace_vector_finish (struct backtrace_state *state, -+ struct backtrace_vector *vec, -+ backtrace_error_callback error_callback, -+ void *data) - { -- vec->base = (char *) vec->base + vec->size; -+ void *ret; -+ -+ /* With this allocator we call realloc in backtrace_vector_grow, -+ which means we can't easily reuse the memory here. So just -+ release it. */ -+ if (!backtrace_vector_release (state, vec, error_callback, data)) -+ return NULL; -+ ret = vec->base; -+ vec->base = NULL; - vec->size = 0; -+ vec->alc = 0; -+ return ret; - } - - /* Release any extra space allocated for VEC. */ -Index: libbacktrace/mmap.c -=================================================================== ---- a/src/libbacktrace/mmap.c (.../tags/gcc_4_8_2_release) -+++ b/src/libbacktrace/mmap.c (.../branches/gcc-4_8-branch) -@@ -230,12 +230,19 @@ - - /* Finish the current allocation on VEC. */ - --void --backtrace_vector_finish (struct backtrace_state *state ATTRIBUTE_UNUSED, -- struct backtrace_vector *vec) -+void * -+backtrace_vector_finish ( -+ struct backtrace_state *state ATTRIBUTE_UNUSED, -+ struct backtrace_vector *vec, -+ backtrace_error_callback error_callback ATTRIBUTE_UNUSED, -+ void *data ATTRIBUTE_UNUSED) - { -+ void *ret; -+ -+ ret = vec->base; - vec->base = (char *) vec->base + vec->size; - vec->size = 0; -+ return ret; - } - - /* Release any extra space allocated for VEC. */ -Index: libjava/libltdl/configure -=================================================================== ---- a/src/libjava/libltdl/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/libltdl/configure (.../branches/gcc-4_8-branch) -@@ -4806,7 +4806,7 @@ - rm -rf conftest* - ;; - --x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) -+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 -@@ -4820,7 +4820,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -4836,7 +4839,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) -@@ -6456,11 +6462,11 @@ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` -- (eval echo "\"\$as_me:6459: $lt_compile\"" >&5) -+ (eval echo "\"\$as_me:6465: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 -- echo "$as_me:6463: \$? = $ac_status" >&5 -+ echo "$as_me:6469: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. -@@ -6718,11 +6724,11 @@ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` -- (eval echo "\"\$as_me:6721: $lt_compile\"" >&5) -+ (eval echo "\"\$as_me:6727: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 -- echo "$as_me:6725: \$? = $ac_status" >&5 -+ echo "$as_me:6731: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. -@@ -6780,11 +6786,11 @@ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` -- (eval echo "\"\$as_me:6783: $lt_compile\"" >&5) -+ (eval echo "\"\$as_me:6789: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 -- echo "$as_me:6787: \$? = $ac_status" >&5 -+ echo "$as_me:6793: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized -@@ -8099,7 +8105,7 @@ - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) -- echo '#line 8102 "configure"' > conftest.$ac_ext -+ echo '#line 8108 "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? -@@ -8652,7 +8658,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF --#line 8655 "configure" -+#line 8661 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -8750,7 +8756,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF --#line 8753 "configure" -+#line 8759 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10591,7 +10597,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<EOF --#line 10594 "configure" -+#line 10600 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libjava/libltdl/acinclude.m4 -=================================================================== ---- a/src/libjava/libltdl/acinclude.m4 (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/libltdl/acinclude.m4 (.../branches/gcc-4_8-branch) -@@ -519,7 +519,7 @@ - rm -rf conftest* - ;; - --x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) -+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then -@@ -529,7 +529,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -545,7 +548,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) -Index: libjava/classpath/configure -=================================================================== ---- a/src/libjava/classpath/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/classpath/configure (.../branches/gcc-4_8-branch) -@@ -7577,7 +7577,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -7602,7 +7602,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -7621,7 +7624,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11820,7 +11826,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11823 "configure" -+#line 11829 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11926,7 +11932,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11929 "configure" -+#line 11935 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -25300,7 +25306,7 @@ - JAVA_TEST=Object.java - CLASS_TEST=Object.class - cat << \EOF > $JAVA_TEST --/* #line 25303 "configure" */ -+/* #line 25309 "configure" */ - package java.lang; - - public class Object -@@ -25393,7 +25399,7 @@ - if uudecode$EXEEXT Test.uue; then - ac_cv_prog_uudecode_base64=yes - else -- echo "configure: 25396: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 -+ echo "configure: 25402: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 - echo "configure: failed file was:" >&5 - cat Test.uue >&5 - ac_cv_prog_uudecode_base64=no -@@ -25421,7 +25427,7 @@ - CLASS_TEST=Test.class - TEST=Test - cat << \EOF > $JAVA_TEST --/* [#]line 25424 "configure" */ -+/* [#]line 25430 "configure" */ - public class Test { - public static void main (String args[]) { - System.exit (0); -@@ -25629,7 +25635,7 @@ - JAVA_TEST=Test.java - CLASS_TEST=Test.class - cat << \EOF > $JAVA_TEST -- /* #line 25632 "configure" */ -+ /* #line 25638 "configure" */ - public class Test - { - public static void main(String args) -Index: libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c -=================================================================== ---- a/src/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c (.../branches/gcc-4_8-branch) -@@ -39,10 +39,11 @@ - #include <pango/pango.h> - #include <pango/pangoft2.h> - #include <pango/pangofc-font.h> --#include <freetype/ftglyph.h> --#include <freetype/ftoutln.h> --#include <freetype/fttypes.h> --#include <freetype/tttables.h> -+#include <ft2build.h> -+#include FT_GLYPH_H -+#include FT_OUTLINE_H -+#include FT_TYPES_H -+#include FT_TRUETYPE_TABLES_H - #include "gdkfont.h" - #include "gtkpeer.h" - #include "gnu_java_awt_peer_gtk_GdkFontPeer.h" -Index: libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c -=================================================================== ---- a/src/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (.../branches/gcc-4_8-branch) -@@ -42,8 +42,9 @@ - #include <pango/pango.h> - #include <pango/pangoft2.h> - #include <pango/pangofc-font.h> --#include <freetype/ftglyph.h> --#include <freetype/ftoutln.h> -+#include <ft2build.h> -+#include FT_GLYPH_H -+#include FT_OUTLINE_H - #include "jcl.h" - #include "gdkfont.h" - #include "gnu_java_awt_peer_gtk_FreetypeGlyphVector.h" -Index: libjava/classpath/ChangeLog.gcj -=================================================================== ---- a/src/libjava/classpath/ChangeLog.gcj (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/classpath/ChangeLog.gcj (.../branches/gcc-4_8-branch) -@@ -1,3 +1,9 @@ -+2013-11-29 Matthias Klose <doko@ubuntu.com> -+ -+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c, -+ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c: -+ Fix freetype includes. -+ - 2013-03-22 Jakub Jelinek <jakub@redhat.com> - - PR other/43620 ++2014-07-07 Richard Biener <rguenther@suse.de> ++ ++ * gennews: Use gcc-3.0/index.html. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: contrib/gennews +=================================================================== +--- a/src/contrib/gennews (.../tags/gcc_4_8_3_release) ++++ b/src/contrib/gennews (.../branches/gcc-4_8-branch) +@@ -37,7 +37,7 @@ + gcc-3.3/index.html gcc-3.3/changes.html + gcc-3.2/index.html gcc-3.2/changes.html + gcc-3.1/index.html gcc-3.1/changes.html +- gcc-3.0/gcc-3.0.html gcc-3.0/features.html gcc-3.0/caveats.html ++ gcc-3.0/index.html gcc-3.0/features.html gcc-3.0/caveats.html + gcc-2.95/index.html gcc-2.95/features.html gcc-2.95/caveats.html + egcs-1.1/index.html egcs-1.1/features.html egcs-1.1/caveats.html + egcs-1.0/index.html egcs-1.0/features.html egcs-1.0/caveats.html" Index: libjava/classpath =================================================================== ---- a/src/libjava/classpath (.../tags/gcc_4_8_2_release) +--- a/src/libjava/classpath (.../tags/gcc_4_8_3_release) +++ b/src/libjava/classpath (.../branches/gcc-4_8-branch) Property changes on: libjava/classpath ___________________________________________________________________ Modified: svn:mergeinfo - Merged /trunk/libjava/classpath:r206395 -Index: libjava/ChangeLog -=================================================================== ---- a/src/libjava/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,16 @@ -+2014-04-01 Dominique d'Humieres <dominiq@lps.ens.fr> -+ -+ Backport from mainline -+ 2014-02-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> -+ -+ PR libgcj/55637 -+ * testsuite/libjava.lang/sourcelocation.xfail: New file. -+ -+2014-03-11 Uros Bizjak <ubizjak@gmail.com> -+ -+ * java/lang/natObject.cc (_Jv_MonitorEnter): Add missing parenthesis -+ around comparison with (address | LOCKED) in JvAssert. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libjava/testsuite/libjava.lang/sourcelocation.xfail -=================================================================== ---- a/src/libjava/testsuite/libjava.lang/sourcelocation.xfail (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/testsuite/libjava.lang/sourcelocation.xfail (.../branches/gcc-4_8-branch) -@@ -0,0 +1 @@ -+xfail-output -Index: libjava/configure -=================================================================== ---- a/src/libjava/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/configure (.../branches/gcc-4_8-branch) -@@ -8842,7 +8842,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -8867,7 +8867,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -8886,7 +8889,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -13382,7 +13388,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 13385 "configure" -+#line 13391 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -13488,7 +13494,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 13491 "configure" -+#line 13497 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -19483,7 +19489,7 @@ - enableval=$enable_sjlj_exceptions; : - else - cat > conftest.$ac_ext << EOF --#line 19486 "configure" -+#line 19492 "configure" - struct S { ~S(); }; - void bar(); - void foo() -Index: libjava/java/lang/natObject.cc -=================================================================== ---- a/src/libjava/java/lang/natObject.cc (.../tags/gcc_4_8_2_release) -+++ b/src/libjava/java/lang/natObject.cc (.../branches/gcc-4_8-branch) -@@ -929,7 +929,7 @@ - // only be held by other threads waiting for conversion, and - // they, like us, drop it quickly without blocking. - _Jv_MutexLock(&(hl->si.mutex)); -- JvAssert(he -> address == address | LOCKED ); -+ JvAssert(he -> address == (address | LOCKED)); - release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY)); - // release lock on he - LOG(REQ_CONV, (address | REQUEST_CONVERSION | HEAVY), self); -@@ -961,7 +961,7 @@ - } - obj_addr_t was_heavy = (address & HEAVY); - if ((address & LOCKED) || -- !compare_and_swap(&(he -> address), address, (address | LOCKED ))) -+ !compare_and_swap(&(he -> address), address, address | LOCKED )) - { - wait_unlocked(he); - goto retry; -Index: gnattools/configure -=================================================================== ---- a/src/gnattools/configure (.../tags/gcc_4_8_2_release) -+++ b/src/gnattools/configure (.../branches/gcc-4_8-branch) -@@ -2029,66 +2029,59 @@ - # Per-target case statement - # ------------------------- - case "${target}" in -- alpha*-dec-vx*) # Unlike all other Vxworks -+ *-*-aix*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \ -+ indepsw.adb<indepsw-aix.adb" - ;; -- m68k*-wrs-vx* \ -- | powerpc*-wrs-vxworks \ -- | sparc*-wrs-vx* \ -- | *86-wrs-vxworks \ -- | mips*-wrs-vx*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb" -+ *-*-darwin*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb \ -+ indepsw.adb<indepsw-darwin.adb" - ;; -- sparc-sun-solaris*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -+ *-*-freebsd*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ -+ indepsw.adb<indepsw-gnu.adb" - ;; -- *86-*-solaris2* | x86_64-*-solaris2.1[0-9]*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -- ;; -- *86-*-linux* \ -- | powerpc*-*-linux* \ -- | *ia64-*-linux* \ -- | alpha*-*-linux* \ -- | sparc*-*-linux* \ -- | hppa*-*-linux* \ -- | *x86_64-*-linux*) -+ *-*-linux*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ - indepsw.adb<indepsw-gnu.adb" - ;; -- s390*-*-linux*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb" -+ *-*-lynxos*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \ -+ indepsw.adb<indepsw-gnu.adb" - ;; -- *86-*-freebsd*) -+ *-*-solaris*) -+ TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -+ ;; -+ *-*-vxworks*) - TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ -+ mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \ - indepsw.adb<indepsw-gnu.adb" - ;; -- hppa*-hp-hpux10*) # Unlike hpux11 -+ hppa*-hp-hpux10*) - ;; - hppa*-hp-hpux11*) - TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb" - ;; -- *-ibm-aix*) -- TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \ -- indepsw.adb<indepsw-aix.adb" -+ ia64-hp-hpux11*) -+ TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-ia64-hpux.adb" - ;; -- alpha*-dec-vms* | alpha*-dec-openvms* | alpha*-dec-vms* \ -- | alpha*-hp-vms* | alpha*-hp-openvms* | alpha*-hp-vms*) -+ alpha*-*-vms* | alpha*-*-openvms*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \ - symbols.adb<symbols-vms.adb \ - symbols-processing.adb<symbols-processing-vms-alpha.adb" -- - EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)' - ;; -- ia64*-dec-vms* | ia64*-dec-openvms* | ia64*-dec-vms* \ -- | ia64*-hp-vms* | ia64*-hp-openvms* | ia64*-hp-vms*) -+ ia64-*-vms* | ia64-*-openvms*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \ - symbols.adb<symbols-vms.adb \ - symbols-processing.adb<symbols-processing-vms-ia64.adb" -- - EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)' - ;; - *-*-cygwin32* | *-*-mingw32* | *-*-pe) -@@ -2097,14 +2090,6 @@ - indepsw.adb<indepsw-mingw.adb" - EXTRA_GNATTOOLS='../../gnatdll$(exeext)' - ;; -- *-*-darwin*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb" -- ;; -- *-*-lynxos) -- TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \ -- indepsw.adb<indepsw-gnu.adb" -- ;; - esac - - # From user or toplevel makefile. -Index: gnattools/Makefile.in -=================================================================== ---- a/src/gnattools/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/gnattools/Makefile.in (.../branches/gcc-4_8-branch) -@@ -24,6 +24,8 @@ - libdir = @libdir@ - build = @build@ - target = @target@ -+host = @host@ -+host_alias = @host_alias@ - prefix = @prefix@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ -@@ -84,6 +86,7 @@ - TOOLS_FLAGS_TO_PASS_RE= \ - "CC=../../xgcc -B../../" \ - "CFLAGS=$(CFLAGS)" \ -+ "LDFLAGS=$(LDFLAGS)" \ - "ADAFLAGS=$(ADAFLAGS)" \ - "ADA_CFLAGS=$(ADA_CFLAGS)" \ - "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ -@@ -97,6 +100,22 @@ - "TOOLSCASE=cross" - - # Variables for gnattools, cross -+ifeq ($(build), $(host)) -+ GNATMAKE_FOR_HOST=gnatmake -+ GNATLINK_FOR_HOST=gnatlink -+ GNATBIND_FOR_HOST=gnatbind -+ GNATLS_FOR_HOST=gnatls -+else -+ GNATMAKE_FOR_HOST=$(host_alias)-gnatmake -+ GNATLINK_FOR_HOST=$(host_alias)-gnatlink -+ GNATBIND_FOR_HOST=$(host_alias)-gnatbind -+ GNATLS_FOR_HOST=$(host_alias)-gnatls -+endif -+ -+# Put the host RTS dir first in the PATH to hide the default runtime -+# files that are among the sources -+RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib ))) -+ - TOOLS_FLAGS_TO_PASS_CROSS= \ - "CC=$(CC)" \ - "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ -@@ -108,9 +127,9 @@ - "exeext=$(exeext)" \ - "fsrcdir=$(fsrcdir)" \ - "srcdir=$(fsrcdir)" \ -- "GNATMAKE=gnatmake" \ -- "GNATLINK=gnatlink" \ -- "GNATBIND=gnatbind" \ -+ "GNATMAKE=$(GNATMAKE_FOR_HOST)" \ -+ "GNATLINK=$(GNATLINK_FOR_HOST)" \ -+ "GNATBIND=$(GNATBIND_FOR_HOST)" \ - "TOOLSCASE=cross" \ - "LIBGNAT=" - -@@ -179,11 +198,6 @@ - $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ - $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools - --# For cross builds of gnattools, --# put the host RTS dir first in the PATH to hide the default runtime --# files that are among the sources --# FIXME: This should be done in configure. --RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib ))) - gnattools-cross: $(GCC_DIR)/stamp-tools - # gnattools1-re - $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ -Index: gnattools/configure.ac -=================================================================== ---- a/src/gnattools/configure.ac (.../tags/gcc_4_8_2_release) -+++ b/src/gnattools/configure.ac (.../branches/gcc-4_8-branch) -@@ -69,66 +69,59 @@ - # Per-target case statement - # ------------------------- - case "${target}" in -- alpha*-dec-vx*) # Unlike all other Vxworks -+ *-*-aix*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \ -+ indepsw.adb<indepsw-aix.adb" - ;; -- m68k*-wrs-vx* \ -- | powerpc*-wrs-vxworks \ -- | sparc*-wrs-vx* \ -- | *86-wrs-vxworks \ -- | mips*-wrs-vx*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb" -+ *-*-darwin*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb \ -+ indepsw.adb<indepsw-darwin.adb" - ;; -- sparc-sun-solaris*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -+ *-*-freebsd*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ -+ indepsw.adb<indepsw-gnu.adb" - ;; -- *86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -- ;; -- *86-*-linux* \ -- | powerpc*-*-linux* \ -- | *ia64-*-linux* \ -- | alpha*-*-linux* \ -- | sparc*-*-linux* \ -- | hppa*-*-linux* \ -- | *x86_64-*-linux*) -+ *-*-linux*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ - indepsw.adb<indepsw-gnu.adb" - ;; -- s390*-*-linux*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb" -+ *-*-lynxos*) -+ TOOLS_TARGET_PAIRS="\ -+ mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \ -+ indepsw.adb<indepsw-gnu.adb" - ;; -- *86-*-freebsd*) -+ *-*-solaris*) -+ TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-solaris.adb" -+ ;; -+ *-*-vxworks*) - TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ -+ mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \ - indepsw.adb<indepsw-gnu.adb" - ;; -- hppa*-hp-hpux10*) # Unlike hpux11 -+ hppa*-hp-hpux10*) - ;; - hppa*-hp-hpux11*) - TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb" - ;; -- *-ibm-aix*) -- TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-aix.adb \ -- indepsw.adb<indepsw-aix.adb" -+ ia64-hp-hpux11*) -+ TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-ia64-hpux.adb" - ;; -- alpha*-dec-vms* | alpha*-dec-openvms* | alpha*-dec-vms* \ -- | alpha*-hp-vms* | alpha*-hp-openvms* | alpha*-hp-vms*) -+ alpha*-*-vms* | alpha*-*-openvms*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \ - symbols.adb<symbols-vms.adb \ - symbols-processing.adb<symbols-processing-vms-alpha.adb" -- - EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)' - ;; -- ia64*-dec-vms* | ia64*-dec-openvms* | ia64*-dec-vms* \ -- | ia64*-hp-vms* | ia64*-hp-openvms* | ia64*-hp-vms*) -+ ia64-*-vms* | ia64-*-openvms*) - TOOLS_TARGET_PAIRS="\ - mlib-tgt-specific.adb<mlib-tgt-specific-vms-ia64.adb \ - symbols.adb<symbols-vms.adb \ - symbols-processing.adb<symbols-processing-vms-ia64.adb" -- - EXTRA_GNATTOOLS='../../gnatlbr$(exeext) ../../gnatsym$(exeext)' - ;; - *-*-cygwin32* | *-*-mingw32* | *-*-pe) -@@ -137,14 +130,6 @@ - indepsw.adb<indepsw-mingw.adb" - EXTRA_GNATTOOLS='../../gnatdll$(exeext)' - ;; -- *-*-darwin*) -- TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-darwin.adb" -- ;; -- *-*-lynxos) -- TOOLS_TARGET_PAIRS="\ -- mlib-tgt-specific.adb<mlib-tgt-specific-lynxos.adb \ -- indepsw.adb<indepsw-gnu.adb" -- ;; - esac - - # From user or toplevel makefile. -Index: gnattools/ChangeLog -=================================================================== ---- a/src/gnattools/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gnattools/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,23 @@ -+2013-12-12 Eric Botcazou <ebotcazou@adacore.com> -+ Iain Sandoe <iain@codesourcery.com> -+ -+ PR ada/55946 -+ * Makefile.in (host): Define. -+ (host_alias): Likewise. -+ (TOOLS_FLAGS_TO_PASS_RE): Add LDFLAGS. -+ (GNATMAKE_FOR_HOST): Define. -+ (GNATLINK_FOR_HOST): Likewise. -+ (GNATBIND_FOR_HOST): Likewise. -+ (GNATLS_FOR_HOST): Likewise. -+ (RTS_DIR): Move around and use GNATLS_FOR_HOST. -+ (TOOLS_FLAGS_TO_PASS_CROSS): Use the other *_HOST variables. -+ -+2013-12-04 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR ada/59382 -+ * configure.ac (target parameterization): Rewrite. -+ * configure: Regenerate. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: maintainer-scripts/ChangeLog -=================================================================== ---- a/src/maintainer-scripts/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/maintainer-scripts/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,9 @@ -+2014-02-01 Dmitry Gorbachev <d.g.gorbachev@gmail.com> -+ -+ PR other/56653 -+ * gcc_release: Avoid printing empty line to generated MD5SUMS files. -+ Bump copyright year. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: maintainer-scripts/gcc_release -=================================================================== ---- a/src/maintainer-scripts/gcc_release (.../tags/gcc_4_8_2_release) -+++ b/src/maintainer-scripts/gcc_release (.../branches/gcc-4_8-branch) -@@ -9,7 +9,7 @@ - # Contents: - # Script to create a GCC release. - # --# Copyright (c) 2001, 2002, 2006, 2009, 2010, 2011 Free Software Foundation. -+# Copyright (c) 2001-2014 Free Software Foundation. - # - # This file is part of GCC. - # -@@ -213,7 +213,7 @@ - # - # Suggested usage: - # md5sum -c MD5SUMS | grep -v \"OK$\" --" > MD5SUMS -+#" > MD5SUMS - - find . -type f | - sed -e 's:^\./::' -e '/MD5SUMS/d' | -Index: libgcc/config.host -=================================================================== ---- a/src/libgcc/config.host (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config.host (.../branches/gcc-4_8-branch) -@@ -331,10 +331,10 @@ - ;; - arm*-*-uclinux*) # ARM ucLinux - tmake_file="${tmake_file} t-fixedpoint-gnu-prefix" -+ tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" - tmake_file="${tmake_file} arm/t-bpabi" - tm_file="$tm_file arm/bpabi-lib.h" - unwind_header=config/arm/unwind-arm.h -- tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" - extra_parts="$extra_parts crti.o crtn.o" - ;; - arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*) -@@ -718,6 +718,10 @@ - tmake_file="${tmake_file} microblaze/t-microblaze t-fdpbit" - extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o" - ;; -+microblaze*-*-rtems*) -+ tmake_file="${tmake_file} microblaze/t-microblaze t-fdpbit" -+ extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o crti.o crtn.o" -+ ;; - mips*-*-netbsd*) # NetBSD/mips, either endian. - ;; - mips*-*-linux*) # Linux MIPS, either endian. -@@ -1081,7 +1085,7 @@ - md_unwind_header=tilepro/linux-unwind.h - ;; - v850*-*-*) -- tmake_file="v850/t-v850 t-fdpbit" -+ tmake_file="${tmake_file} v850/t-v850 t-fdpbit" - ;; - vax-*-linux*) - tmake_file="$tmake_file vax/t-linux" -@@ -1098,7 +1102,7 @@ - extra_parts="$extra_parts crti.o crtn.o" - ;; - xtensa*-*-linux*) -- tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux" -+ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc" - md_unwind_header=xtensa/linux-unwind.h - ;; - am33_2.0-*-linux*) -Index: libgcc/ChangeLog -=================================================================== ---- a/src/libgcc/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,206 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r204808: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define. -+ (frob_update_context): Use it. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/tramp.S [__powerpc64__ && _CALL_ELF == 2]: -+ (trampoline_initial): Provide ELFv2 variant. -+ (__trampoline_setup): Likewise. -+ -+ * config/rs6000/linux-unwind.h (frob_update_context): Do not -+ check for AIX indirect function call sequence if _CALL_ELF == 2. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/linux-unwind.h (get_regs): Do not support -+ old kernel versions if _CALL_ELF == 2. -+ (frob_update_context): Do not support PLT stub variants only -+ generated by old linkers if _CALL_ELF == 2. -+ -+ Backport from mainline r204800: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Correct -+ location of CR save area for 64-bit little-endian systems. -+ -+2014-03-20 Joel Sherrill <joel.sherrill@oarcorp.com> -+ -+ * config.host (v850*-*-*): Add to tmake_file instead of resetting it. -+ -+2014-02-28 Joey Ye <joey.ye@arm.com> -+ -+ Backport from mainline r208229 -+ 2014-02-28 Joey Ye <joey.ye@arm.com> -+ -+ PR libgcc/60166 -+ * config/arm/sfp-machine.h (_FP_NANFRAC_H, -+ _FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q): -+ Set to zero. -+ -+2014-02-18 Kai Tietz <ktietz@redhat.com> -+ Jonathan Schleifer <js@webkeks.org> -+ -+ PR objc/56870 -+ * unwind-seh.c (_GCC_specific_handler): Pass proper -+ value to unwind-handler. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilepro/atomic.c (pre_atomic_barrier): Mark inline. -+ (post_atomic_barrier): Ditto. -+ (__fetch_and_do): New macro. -+ (__atomic_fetch_and_do): Use __fetch_and_do. -+ (__sync_fetch_and_do): New macro. -+ (__sync_fetch_and_add_4): New function. -+ (__sync_fetch_and_sub_4): New function. -+ (__sync_fetch_and_or_4): New function. -+ (__sync_fetch_and_and_4): New function. -+ (__sync_fetch_and_xor_4): New function. -+ (__sync_fetch_and_nand_4): New function. -+ (__sync_fetch_and_add_8): New function. -+ (__sync_fetch_and_sub_8): New function. -+ (__sync_fetch_and_or_8): New function. -+ (__sync_fetch_and_and_8): New function. -+ (__sync_fetch_and_xor_8): New function. -+ (__sync_fetch_and_nand_8): New function. -+ (__do_and_fetch): New macro. -+ (__atomic_do_and_fetch): Use __do_and_fetch. -+ (__sync_do_and_fetch): New macro. -+ (__sync_add_and_fetch_4): New function. -+ (__sync_sub_and_fetch_4): New function. -+ (__sync_or_and_fetch_4): New function. -+ (__sync_and_and_fetch_4): New function. -+ (__sync_xor_and_fetch_4): New function. -+ (__sync_nand_and_fetch_4): New function. -+ (__sync_add_and_fetch_8): New function. -+ (__sync_sub_and_fetch_8): New function. -+ (__sync_or_and_fetch_8): New function. -+ (__sync_and_and_fetch_8): New function. -+ (__sync_xor_and_fetch_8): New function. -+ (__sync_nand_and_fetch_8): New function. -+ (__sync_exchange_methods): New macro. -+ (__sync_val_compare_and_swap_4): New function. -+ (__sync_bool_compare_and_swap_4): New function. -+ (__sync_lock_test_and_test_4): New function. -+ (__sync_val_compare_and_swap_8): New function. -+ (__sync_bool_compare_and_swap_8): New function. -+ (__sync_lock_test_and_test_8): New function. -+ (__subword_cmpxchg_body): New macro. -+ (__atomic_compare_exchange_1): Use __subword_cmpxchg_body. -+ (__atomic_compare_exchange_2): Ditto. -+ (__sync_subword_cmpxchg): New macro. -+ (__sync_val_compare_and_swap_1): New function. -+ (__sync_bool_compare_and_swap_1): New function. -+ (__sync_val_compare_and_swap_2): New function. -+ (__sync_bool_compare_and_swap_2): New function. -+ (__atomic_subword): Rename to ... -+ (__subword): ... New name. -+ (__atomic_subword_fetch): Use __subword. -+ (__sync_subword_fetch): New macro. -+ (__sync_fetch_and_add_1): New function. -+ (__sync_fetch_and_sub_1): New function. -+ (__sync_fetch_and_or_1): New function. -+ (__sync_fetch_and_and_1): New function. -+ (__sync_fetch_and_xor_1): New function. -+ (__sync_fetch_and_nand_1): New function. -+ (__sync_fetch_and_add_2): New function. -+ (__sync_fetch_and_sub_2): New function. -+ (__sync_fetch_and_or_2): New function. -+ (__sync_fetch_and_and_2): New function. -+ (__sync_fetch_and_xor_2): New function. -+ (__sync_fetch_and_nand_2): New function. -+ (__sync_add_and_fetch_1): New function. -+ (__sync_sub_and_fetch_1): New function. -+ (__sync_or_and_fetch_1): New function. -+ (__sync_and_and_fetch_1): New function. -+ (__sync_xor_and_fetch_1): New function. -+ (__sync_nand_and_fetch_1): New function. -+ (__sync_add_and_fetch_2): New function. -+ (__sync_sub_and_fetch_2): New function. -+ (__sync_or_and_fetch_2): New function. -+ (__sync_and_and_fetch_2): New function. -+ (__sync_xor_and_fetch_2): New function. -+ (__sync_nand_and_fetch_2): New function. -+ (__atomic_subword_lock): Use __subword. -+ (__sync_subword_lock): New macro. -+ (__sync_lock_test_and_set_1): New function. -+ (__sync_lock_test_and_set_2): New function. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilepro/atomic.c (BIT_OFFSET): Define. -+ (__atomic_subword_cmpxchg): Use BIT_OFFSET. -+ (__atomic_subword): Ditto. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilepro/atomic.c (__atomic_do_and_fetch): Add -+ a prefix op argument. -+ (__atomic_nand_fetch_4): Add prefix op. -+ (__atomic_nand_fetch_8): Ditto. -+ -+2014-01-21 Baruch Siach <barch@tkos.co.il> -+ -+ * config.host (tmake_file): add t-slibgcc-libgcc for xtensa*-*-linux*. -+ -+2014-01-03 Joseph Myers <joseph@codesourcery.com> -+ -+ * config/rs6000/ibm-ldouble.c (__gcc_qdiv): Scale up arguments in -+ case of small numerator and finite nonzero result. -+ -+2013-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> -+ -+ Backport from trunk r205917. -+ 2013-12-12 Zhenqiang Chen <zhenqiang.chen@arm.com> -+ * config.host (arm*-*-uclinux*): Move t-arm before t-bpabi. -+ -+2013-12-10 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/sfp-exceptions.c (__sfp_handle_exceptions): Emit SSE -+ instructions when __SSE_MATH__ is defined. -+ -+2013-12-06 Ralf Corsépius <ralf.corsepius@rtems.org> -+ -+ * config.host (microblaze-*-rtems*): New. -+ -+2013-11-10 Kai Tietz <ktietz@redhat.com> -+ -+ Back-merged from trunk -+ * config/i386/cygming-crtbegin.c (__gcc_register_frame): -+ Increment load-count on use of LIBGCC_SONAME DLL. -+ (hmod_libgcc): New static variable to hold handle of -+ LIBGCC_SONAME DLL. -+ (__gcc_deregister_frame): Decrement load-count of -+ LIBGCC_SONAME DLL. -+ -+2013-11-07 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/sfp-exceptions.c (__sfp_handle_exceptions): Handle -+ FP_EX_DENORM. Store result to volatile location after SSE division -+ to close interrupt window. Remove unneeded fwait after x87 -+ division since interrupt window will be closed by emitted fstp. -+ Rewrite FP_EX_INEXACT handling. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -@@ -151,7 +354,7 @@ - * config/mips/crtn.S (fini, init): New labels. - - 2012-02-19 Edgar E. Iglesias <edgar.iglesias@gmail.com> -- * config/microblaze/modsi3.S (modsi3): Fix case with 0x80000000 -+ * config/microblaze/modsi3.S (modsi3): Fix case with 0x80000000 - as dividend. - - 2013-02-16 Alan Modra <amodra@gmail.com> -Index: libgcc/config/i386/sfp-exceptions.c -=================================================================== ---- a/src/libgcc/config/i386/sfp-exceptions.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/i386/sfp-exceptions.c (.../branches/gcc-4_8-branch) -@@ -47,21 +47,33 @@ - if (_fex & FP_EX_INVALID) - { - float f = 0.0f; --#ifdef __x86_64__ -+#ifdef __SSE_MATH__ -+ volatile float r __attribute__ ((unused)); - asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f)); -+ r = f; /* Needed to trigger exception. */ - #else - asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f)); -- asm volatile ("fwait"); -+ /* No need for fwait, exception is triggered by emitted fstp. */ - #endif - } -+ if (_fex & FP_EX_DENORM) -+ { -+ struct fenv temp; -+ asm volatile ("fnstenv\t%0" : "=m" (temp)); -+ temp.__status_word |= FP_EX_DENORM; -+ asm volatile ("fldenv\t%0" : : "m" (temp)); -+ asm volatile ("fwait"); -+ } - if (_fex & FP_EX_DIVZERO) - { - float f = 1.0f, g = 0.0f; --#ifdef __x86_64__ -+#ifdef __SSE_MATH__ -+ volatile float r __attribute__ ((unused)); - asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g)); -+ r = f; /* Needed to trigger exception. */ - #else - asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g)); -- asm volatile ("fwait"); -+ /* No need for fwait, exception is triggered by emitted fstp. */ - #endif - } - if (_fex & FP_EX_OVERFLOW) -@@ -82,11 +94,15 @@ - } - if (_fex & FP_EX_INEXACT) - { -- struct fenv temp; -- asm volatile ("fnstenv\t%0" : "=m" (temp)); -- temp.__status_word |= FP_EX_INEXACT; -- asm volatile ("fldenv\t%0" : : "m" (temp)); -- asm volatile ("fwait"); -+ float f = 1.0f, g = 3.0f; -+#ifdef __SSE_MATH__ -+ volatile float r __attribute__ ((unused)); -+ asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g)); -+ r = f; /* Needed to trigger exception. */ -+#else -+ asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g)); -+ /* No need for fwait, exception is triggered by emitted fstp. */ -+#endif - } - }; - #endif -Index: libgcc/config/i386/cygming-crtbegin.c -=================================================================== ---- a/src/libgcc/config/i386/cygming-crtbegin.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/i386/cygming-crtbegin.c (.../branches/gcc-4_8-branch) -@@ -69,6 +69,9 @@ - = { }; - - static struct object obj; -+ -+/* Handle of libgcc's DLL reference. */ -+HANDLE hmod_libgcc; - #endif - - #if TARGET_USE_JCR_SECTION -@@ -93,9 +96,14 @@ - - void (*register_frame_fn) (const void *, struct object *); - HANDLE h = GetModuleHandle (LIBGCC_SONAME); -+ - if (h) -- register_frame_fn = (void (*) (const void *, struct object *)) -- GetProcAddress (h, "__register_frame_info"); -+ { -+ /* Increasing the load-count of LIBGCC_SONAME DLL. */ -+ hmod_libgcc = LoadLibrary (LIBGCC_SONAME); -+ register_frame_fn = (void (*) (const void *, struct object *)) -+ GetProcAddress (h, "__register_frame_info"); -+ } - else - register_frame_fn = __register_frame_info; - if (register_frame_fn) -@@ -132,5 +140,7 @@ - deregister_frame_fn = __deregister_frame_info; - if (deregister_frame_fn) - deregister_frame_fn (__EH_FRAME_BEGIN__); -+ if (hmod_libgcc) -+ FreeLibrary (hmod_libgcc); - #endif - } -Index: libgcc/config/rs6000/tramp.S -=================================================================== ---- a/src/libgcc/config/rs6000/tramp.S (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/rs6000/tramp.S (.../branches/gcc-4_8-branch) -@@ -116,4 +116,70 @@ - - #endif - -+#elif _CALL_ELF == 2 -+ .type trampoline_initial,@object -+ .align 3 -+trampoline_initial: -+ ld r11,.Lchain(r12) -+ ld r12,.Lfunc(r12) -+ mtctr r12 -+ bctr -+.Lfunc = .-trampoline_initial -+ .quad 0 /* will be replaced with function address */ -+.Lchain = .-trampoline_initial -+ .quad 0 /* will be replaced with static chain */ -+ -+trampoline_size = .-trampoline_initial -+ .size trampoline_initial,trampoline_size -+ -+ -+/* R3 = stack address to store trampoline */ -+/* R4 = length of trampoline area */ -+/* R5 = function address */ -+/* R6 = static chain */ -+ -+ .pushsection ".toc","aw" -+.LC0: -+ .quad trampoline_initial-8 -+ .popsection -+ -+FUNC_START(__trampoline_setup) -+ addis 7,2,.LC0@toc@ha -+ ld 7,.LC0@toc@l(7) /* trampoline address -8 */ -+ -+ li r8,trampoline_size /* verify that the trampoline is big enough */ -+ cmpw cr1,r8,r4 -+ srwi r4,r4,3 /* # doublewords to move */ -+ addi r9,r3,-8 /* adjust pointer for stdu */ -+ mtctr r4 -+ blt cr1,.Labort -+ -+ /* Copy the instructions to the stack */ -+.Lmove: -+ ldu r10,8(r7) -+ stdu r10,8(r9) -+ bdnz .Lmove -+ -+ /* Store correct function and static chain */ -+ std r5,.Lfunc(r3) -+ std r6,.Lchain(r3) -+ -+ /* Now flush both caches */ -+ mtctr r4 -+.Lcache: -+ icbi 0,r3 -+ dcbf 0,r3 -+ addi r3,r3,8 -+ bdnz .Lcache -+ -+ /* Finally synchronize things & return */ -+ sync -+ isync -+ blr -+ -+.Labort: -+ bl JUMP_TARGET(abort) -+ nop -+FUNC_END(__trampoline_setup) -+ - #endif -Index: libgcc/config/rs6000/linux-unwind.h -=================================================================== ---- a/src/libgcc/config/rs6000/linux-unwind.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/rs6000/linux-unwind.h (.../branches/gcc-4_8-branch) -@@ -24,9 +24,19 @@ - - #define R_LR 65 - #define R_CR2 70 -+#define R_CR3 71 -+#define R_CR4 72 - #define R_VR0 77 - #define R_VRSAVE 109 - -+#ifdef __powerpc64__ -+#if _CALL_ELF == 2 -+#define TOC_SAVE_SLOT 24 -+#else -+#define TOC_SAVE_SLOT 40 -+#endif -+#endif -+ - struct gcc_vregs - { - __attribute__ ((vector_size (16))) int vr[32]; -@@ -107,6 +117,8 @@ - } - else if (pc[1] == 0x380000AC) - { -+#if _CALL_ELF != 2 -+ /* These old kernel versions never supported ELFv2. */ - /* This works for 2.4 kernels, but not for 2.6 kernels with vdso - because pc isn't pointing into the stack. Can be removed when - no one is running 2.4.19 or 2.4.20, the first two ppc64 -@@ -121,6 +133,7 @@ - if ((long) frame24->puc != -21 * 8) - return frame24->puc->regs; - else -+#endif - { - /* This works for 2.4.21 and later kernels. */ - struct rt_sigframe { -@@ -185,6 +198,7 @@ - { - struct gcc_regs *regs = get_regs (context); - struct gcc_vregs *vregs; -+ long cr_offset; - long new_cfa; - int i; - -@@ -206,11 +220,21 @@ - fs->regs.reg[i].loc.offset = (long) ®s->gpr[i] - new_cfa; - } - -+ /* The CR is saved in the low 32 bits of regs->ccr. */ -+ cr_offset = (long) ®s->ccr - new_cfa; -+#ifndef __LITTLE_ENDIAN__ -+ cr_offset += sizeof (long) - 4; -+#endif -+ /* In the ELFv1 ABI, CR2 stands in for the whole CR. */ - fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET; -- /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit -- libgcc loc.offset needs to point to the low 32 bits of regs->ccr. */ -- fs->regs.reg[R_CR2].loc.offset = (long) ®s->ccr - new_cfa -- + sizeof (long) - 4; -+ fs->regs.reg[R_CR2].loc.offset = cr_offset; -+#if _CALL_ELF == 2 -+ /* In the ELFv2 ABI, every CR field has a separate CFI entry. */ -+ fs->regs.reg[R_CR3].how = REG_SAVED_OFFSET; -+ fs->regs.reg[R_CR3].loc.offset = cr_offset; -+ fs->regs.reg[R_CR4].how = REG_SAVED_OFFSET; -+ fs->regs.reg[R_CR4].loc.offset = cr_offset; -+#endif - - fs->regs.reg[R_LR].how = REG_SAVED_OFFSET; - fs->regs.reg[R_LR].loc.offset = (long) ®s->link - new_cfa; -@@ -294,9 +318,13 @@ - figure out if it was saved. The big problem here is that the - code that does the save/restore is generated by the linker, so - we have no good way to determine at compile time what to do. */ -- if (pc[0] == 0xF8410028 -+ if (pc[0] == 0xF8410000 + TOC_SAVE_SLOT -+#if _CALL_ELF != 2 -+ /* The ELFv2 linker never generates the old PLT stub form. */ - || ((pc[0] & 0xFFFF0000) == 0x3D820000 -- && pc[1] == 0xF8410028)) -+ && pc[1] == 0xF8410000 + TOC_SAVE_SLOT) -+#endif -+ ) - { - /* We are in a plt call stub or r2 adjusting long branch stub, - before r2 has been saved. Keep REG_UNSAVED. */ -@@ -305,10 +333,12 @@ - { - unsigned int *insn - = (unsigned int *) _Unwind_GetGR (context, R_LR); -- if (insn && *insn == 0xE8410028) -- _Unwind_SetGRPtr (context, 2, context->cfa + 40); -+ if (insn && *insn == 0xE8410000 + TOC_SAVE_SLOT) -+ _Unwind_SetGRPtr (context, 2, context->cfa + TOC_SAVE_SLOT); -+#if _CALL_ELF != 2 -+ /* ELFv2 does not use this function pointer call sequence. */ - else if (pc[0] == 0x4E800421 -- && pc[1] == 0xE8410028) -+ && pc[1] == 0xE8410000 + TOC_SAVE_SLOT) - { - /* We are at the bctrl instruction in a call via function - pointer. gcc always emits the load of the new R2 just -@@ -315,8 +345,9 @@ - before the bctrl so this is the first and only place - we need to use the stored R2. */ - _Unwind_Word sp = _Unwind_GetGR (context, 1); -- _Unwind_SetGRPtr (context, 2, (void *)(sp + 40)); -+ _Unwind_SetGRPtr (context, 2, (void *)(sp + TOC_SAVE_SLOT)); - } -+#endif - } - } - #endif -Index: libgcc/config/rs6000/ibm-ldouble.c -=================================================================== ---- a/src/libgcc/config/rs6000/ibm-ldouble.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/rs6000/ibm-ldouble.c (.../branches/gcc-4_8-branch) -@@ -188,7 +188,16 @@ - || nonfinite (t)) - return t; - -- /* Finite nonzero result requires corrections to the highest order term. */ -+ /* Finite nonzero result requires corrections to the highest order -+ term. These corrections require the low part of c * t to be -+ exactly represented in double. */ -+ if (fabs (a) <= 0x1p-969) -+ { -+ a *= 0x1p106; -+ b *= 0x1p106; -+ c *= 0x1p106; -+ d *= 0x1p106; -+ } - - s = c * t; /* (s,sigma) = c*t exactly. */ - w = -(-b + d * t); /* Written to get fnmsub for speed, but not -Index: libgcc/config/tilepro/atomic.c -=================================================================== ---- a/src/libgcc/config/tilepro/atomic.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/tilepro/atomic.c (.../branches/gcc-4_8-branch) -@@ -28,7 +28,7 @@ - /* This code should be inlined by the compiler, but for now support - it as out-of-line methods in libgcc. */ - --static void -+static inline void - pre_atomic_barrier (int model) - { - switch ((enum memmodel) model) -@@ -44,7 +44,7 @@ - return; - } - --static void -+static inline void - post_atomic_barrier (int model) - { - switch ((enum memmodel) model) -@@ -62,16 +62,21 @@ - - #define __unused __attribute__((unused)) - --#define __atomic_fetch_and_do(type, size, opname) \ --type \ --__atomic_fetch_##opname##_##size(type* p, type i, int model) \ -+#define __fetch_and_do(proto, type, size, opname, top, bottom) \ -+proto \ - { \ -- pre_atomic_barrier(model); \ -+ top; \ - type rv = arch_atomic_##opname(p, i); \ -- post_atomic_barrier(model); \ -+ bottom; \ - return rv; \ - } - -+#define __atomic_fetch_and_do(type, size, opname) \ -+ __fetch_and_do(type __atomic_fetch_##opname##_##size(type* p, type i, int model), \ -+ type, size, opname, \ -+ pre_atomic_barrier(model), \ -+ post_atomic_barrier(model)) \ -+ - __atomic_fetch_and_do (int, 4, add) - __atomic_fetch_and_do (int, 4, sub) - __atomic_fetch_and_do (int, 4, or) -@@ -84,27 +89,73 @@ - __atomic_fetch_and_do (long long, 8, and) - __atomic_fetch_and_do (long long, 8, xor) - __atomic_fetch_and_do (long long, 8, nand) --#define __atomic_do_and_fetch(type, size, opname, op) \ --type \ --__atomic_##opname##_fetch_##size(type* p, type i, int model) \ --{ \ -- pre_atomic_barrier(model); \ -- type rv = arch_atomic_##opname(p, i) op i; \ -- post_atomic_barrier(model); \ -- return rv; \ -+ -+#define __sync_fetch_and_do(type, size, opname) \ -+ __fetch_and_do(type __sync_fetch_and_##opname##_##size(type* p, type i), \ -+ type, size, opname, \ -+ arch_atomic_write_barrier(), \ -+ arch_atomic_read_barrier()) -+ -+__sync_fetch_and_do (int, 4, add) -+__sync_fetch_and_do (int, 4, sub) -+__sync_fetch_and_do (int, 4, or) -+__sync_fetch_and_do (int, 4, and) -+__sync_fetch_and_do (int, 4, xor) -+__sync_fetch_and_do (int, 4, nand) -+__sync_fetch_and_do (long long, 8, add) -+__sync_fetch_and_do (long long, 8, sub) -+__sync_fetch_and_do (long long, 8, or) -+__sync_fetch_and_do (long long, 8, and) -+__sync_fetch_and_do (long long, 8, xor) -+__sync_fetch_and_do (long long, 8, nand) -+ -+#define __do_and_fetch(proto, type, size, opname, op, op2, top, bottom) \ -+proto \ -+{ \ -+ top; \ -+ type rv = op2 (arch_atomic_##opname(p, i) op i); \ -+ bottom; \ -+ return rv; \ - } --__atomic_do_and_fetch (int, 4, add, +) --__atomic_do_and_fetch (int, 4, sub, -) --__atomic_do_and_fetch (int, 4, or, |) --__atomic_do_and_fetch (int, 4, and, &) --__atomic_do_and_fetch (int, 4, xor, |) --__atomic_do_and_fetch (int, 4, nand, &) --__atomic_do_and_fetch (long long, 8, add, +) --__atomic_do_and_fetch (long long, 8, sub, -) --__atomic_do_and_fetch (long long, 8, or, |) --__atomic_do_and_fetch (long long, 8, and, &) --__atomic_do_and_fetch (long long, 8, xor, |) --__atomic_do_and_fetch (long long, 8, nand, &) -+ -+#define __atomic_do_and_fetch(type, size, opname, op, op2) \ -+ __do_and_fetch(type __atomic_##opname##_fetch_##size(type* p, type i, int model), \ -+ type, size, opname, op, op2, \ -+ pre_atomic_barrier(model), \ -+ post_atomic_barrier(model)) \ -+ -+__atomic_do_and_fetch (int, 4, add, +, ) -+__atomic_do_and_fetch (int, 4, sub, -, ) -+__atomic_do_and_fetch (int, 4, or, |, ) -+__atomic_do_and_fetch (int, 4, and, &, ) -+__atomic_do_and_fetch (int, 4, xor, |, ) -+__atomic_do_and_fetch (int, 4, nand, &, ~) -+__atomic_do_and_fetch (long long, 8, add, +, ) -+__atomic_do_and_fetch (long long, 8, sub, -, ) -+__atomic_do_and_fetch (long long, 8, or, |, ) -+__atomic_do_and_fetch (long long, 8, and, &, ) -+__atomic_do_and_fetch (long long, 8, xor, |, ) -+__atomic_do_and_fetch (long long, 8, nand, &, ~) -+ -+#define __sync_do_and_fetch(type, size, opname, op, op2) \ -+ __do_and_fetch(type __sync_##opname##_and_fetch_##size(type* p, type i), \ -+ type, size, opname, op, op2, \ -+ arch_atomic_write_barrier(), \ -+ arch_atomic_read_barrier()) \ -+ -+__sync_do_and_fetch (int, 4, add, +, ) -+__sync_do_and_fetch (int, 4, sub, -, ) -+__sync_do_and_fetch (int, 4, or, |, ) -+__sync_do_and_fetch (int, 4, and, &, ) -+__sync_do_and_fetch (int, 4, xor, |, ) -+__sync_do_and_fetch (int, 4, nand, &, ~) -+__sync_do_and_fetch (long long, 8, add, +, ) -+__sync_do_and_fetch (long long, 8, sub, -, ) -+__sync_do_and_fetch (long long, 8, or, |, ) -+__sync_do_and_fetch (long long, 8, and, &, ) -+__sync_do_and_fetch (long long, 8, xor, |, ) -+__sync_do_and_fetch (long long, 8, nand, &, ~) -+ - #define __atomic_exchange_methods(type, size) \ - bool \ - __atomic_compare_exchange_##size(volatile type* ptr, type* oldvalp, \ -@@ -128,49 +179,117 @@ - post_atomic_barrier(model); \ - return retval; \ - } -+ - __atomic_exchange_methods (int, 4) - __atomic_exchange_methods (long long, 8) - -+#define __sync_exchange_methods(type, size) \ -+type \ -+__sync_val_compare_and_swap_##size(type* ptr, type oldval, type newval) \ -+{ \ -+ arch_atomic_write_barrier(); \ -+ type retval = arch_atomic_val_compare_and_exchange(ptr, oldval, newval); \ -+ arch_atomic_read_barrier(); \ -+ return retval; \ -+} \ -+ \ -+bool \ -+__sync_bool_compare_and_swap_##size(type* ptr, type oldval, type newval) \ -+{ \ -+ arch_atomic_write_barrier(); \ -+ bool retval = arch_atomic_bool_compare_and_exchange(ptr, oldval, newval); \ -+ arch_atomic_read_barrier(); \ -+ return retval; \ -+} \ -+ \ -+type \ -+__sync_lock_test_and_set_##size(type* ptr, type val) \ -+{ \ -+ type retval = arch_atomic_exchange(ptr, val); \ -+ arch_atomic_acquire_barrier_value(retval); \ -+ return retval; \ -+} -+ -+__sync_exchange_methods (int, 4) -+__sync_exchange_methods (long long, 8) -+ -+#ifdef __LITTLE_ENDIAN__ -+#define BIT_OFFSET(n, type) ((n) * 8) -+#else -+#define BIT_OFFSET(n, type) ((4 - sizeof(type) - (n)) * 8) -+#endif -+ - /* Subword methods require the same approach for both TILEPro and - TILE-Gx. We load the background data for the word, insert the - desired subword piece, then compare-and-exchange it into place. */ - #define u8 unsigned char - #define u16 unsigned short -+ -+#define __subword_cmpxchg_body(type, size, ptr, guess, val) \ -+ ({ \ -+ unsigned int *p = (unsigned int *)((unsigned long)ptr & ~3UL); \ -+ const int shift = BIT_OFFSET((unsigned long)ptr & 3UL, type); \ -+ const unsigned int valmask = (1 << (sizeof(type) * 8)) - 1; \ -+ const unsigned int bgmask = ~(valmask << shift); \ -+ unsigned int oldword = *p; \ -+ type oldval = (oldword >> shift) & valmask; \ -+ if (__builtin_expect((oldval == guess), 1)) { \ -+ unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \ -+ oldword = arch_atomic_val_compare_and_exchange(p, oldword, word); \ -+ oldval = (oldword >> shift) & valmask; \ -+ } \ -+ oldval; \ -+ }) \ -+ - #define __atomic_subword_cmpxchg(type, size) \ - \ - bool \ --__atomic_compare_exchange_##size(volatile type* ptr, type* guess, \ -+__atomic_compare_exchange_##size(volatile type* ptr, type* guess_ptr, \ - type val, bool weak __unused, int models, \ - int modelf __unused) \ - { \ - pre_atomic_barrier(models); \ -- unsigned int *p = (unsigned int *)((unsigned long)ptr & ~3UL); \ -- const int shift = ((unsigned long)ptr & 3UL) * 8; \ -- const unsigned int valmask = (1 << (sizeof(type) * 8)) - 1; \ -- const unsigned int bgmask = ~(valmask << shift); \ -- unsigned int oldword = *p; \ -- type oldval = (oldword >> shift) & valmask; \ -- if (__builtin_expect((oldval == *guess), 1)) { \ -- unsigned int word = (oldword & bgmask) | ((val & valmask) << shift); \ -- oldword = arch_atomic_val_compare_and_exchange(p, oldword, word); \ -- oldval = (oldword >> shift) & valmask; \ -- } \ -+ type guess = *guess_ptr; \ -+ type oldval = __subword_cmpxchg_body(type, size, ptr, guess, val); \ - post_atomic_barrier(models); \ -- bool success = (oldval == *guess); \ -- *guess = oldval; \ -+ bool success = (oldval == guess); \ -+ *guess_ptr = oldval; \ - return success; \ - } -+ - __atomic_subword_cmpxchg (u8, 1) - __atomic_subword_cmpxchg (u16, 2) -+ -+#define __sync_subword_cmpxchg(type, size) \ -+ \ -+type \ -+__sync_val_compare_and_swap_##size(type* ptr, type guess, type val) \ -+{ \ -+ arch_atomic_write_barrier(); \ -+ type oldval = __subword_cmpxchg_body(type, size, ptr, guess, val); \ -+ arch_atomic_read_barrier(); \ -+ return oldval; \ -+} \ -+ \ -+bool \ -+__sync_bool_compare_and_swap_##size(type* ptr, type guess, type val) \ -+{ \ -+ type oldval = __sync_val_compare_and_swap_##size(ptr, guess, val); \ -+ return oldval == guess; \ -+} -+ -+__sync_subword_cmpxchg (u8, 1) -+__sync_subword_cmpxchg (u16, 2) -+ - /* For the atomic-update subword methods, we use the same approach as - above, but we retry until we succeed if the compare-and-exchange - fails. */ --#define __atomic_subword(type, proto, top, expr, bottom) \ -+#define __subword(type, proto, top, expr, bottom) \ - proto \ - { \ - top \ - unsigned int *p = (unsigned int *)((unsigned long)ptr & ~3UL); \ -- const int shift = ((unsigned long)ptr & 3UL) * 8; \ -+ const int shift = BIT_OFFSET((unsigned long)ptr & 3UL, type); \ - const unsigned int valmask = (1 << (sizeof(type) * 8)) - 1; \ - const unsigned int bgmask = ~(valmask << shift); \ - unsigned int oldword, xword = *p; \ -@@ -184,12 +303,14 @@ - } while (__builtin_expect(xword != oldword, 0)); \ - bottom \ - } -+ - #define __atomic_subword_fetch(type, funcname, expr, retval) \ -- __atomic_subword(type, \ -- type __atomic_ ## funcname(volatile type *ptr, type i, int model), \ -- pre_atomic_barrier(model);, \ -- expr, \ -- post_atomic_barrier(model); return retval;) -+ __subword(type, \ -+ type __atomic_ ## funcname(volatile type *ptr, type i, int model), \ -+ pre_atomic_barrier(model);, \ -+ expr, \ -+ post_atomic_barrier(model); return retval;) -+ - __atomic_subword_fetch (u8, fetch_add_1, oldval + i, oldval) - __atomic_subword_fetch (u8, fetch_sub_1, oldval - i, oldval) - __atomic_subword_fetch (u8, fetch_or_1, oldval | i, oldval) -@@ -196,6 +317,7 @@ - __atomic_subword_fetch (u8, fetch_and_1, oldval & i, oldval) - __atomic_subword_fetch (u8, fetch_xor_1, oldval ^ i, oldval) - __atomic_subword_fetch (u8, fetch_nand_1, ~(oldval & i), oldval) -+ - __atomic_subword_fetch (u16, fetch_add_2, oldval + i, oldval) - __atomic_subword_fetch (u16, fetch_sub_2, oldval - i, oldval) - __atomic_subword_fetch (u16, fetch_or_2, oldval | i, oldval) -@@ -202,6 +324,7 @@ - __atomic_subword_fetch (u16, fetch_and_2, oldval & i, oldval) - __atomic_subword_fetch (u16, fetch_xor_2, oldval ^ i, oldval) - __atomic_subword_fetch (u16, fetch_nand_2, ~(oldval & i), oldval) -+ - __atomic_subword_fetch (u8, add_fetch_1, oldval + i, val) - __atomic_subword_fetch (u8, sub_fetch_1, oldval - i, val) - __atomic_subword_fetch (u8, or_fetch_1, oldval | i, val) -@@ -208,6 +331,7 @@ - __atomic_subword_fetch (u8, and_fetch_1, oldval & i, val) - __atomic_subword_fetch (u8, xor_fetch_1, oldval ^ i, val) - __atomic_subword_fetch (u8, nand_fetch_1, ~(oldval & i), val) -+ - __atomic_subword_fetch (u16, add_fetch_2, oldval + i, val) - __atomic_subword_fetch (u16, sub_fetch_2, oldval - i, val) - __atomic_subword_fetch (u16, or_fetch_2, oldval | i, val) -@@ -214,12 +338,58 @@ - __atomic_subword_fetch (u16, and_fetch_2, oldval & i, val) - __atomic_subword_fetch (u16, xor_fetch_2, oldval ^ i, val) - __atomic_subword_fetch (u16, nand_fetch_2, ~(oldval & i), val) -+ -+#define __sync_subword_fetch(type, funcname, expr, retval) \ -+ __subword(type, \ -+ type __sync_ ## funcname(type *ptr, type i), \ -+ arch_atomic_read_barrier();, \ -+ expr, \ -+ arch_atomic_write_barrier(); return retval;) -+ -+__sync_subword_fetch (u8, fetch_and_add_1, oldval + i, oldval) -+__sync_subword_fetch (u8, fetch_and_sub_1, oldval - i, oldval) -+__sync_subword_fetch (u8, fetch_and_or_1, oldval | i, oldval) -+__sync_subword_fetch (u8, fetch_and_and_1, oldval & i, oldval) -+__sync_subword_fetch (u8, fetch_and_xor_1, oldval ^ i, oldval) -+__sync_subword_fetch (u8, fetch_and_nand_1, ~(oldval & i), oldval) -+ -+__sync_subword_fetch (u16, fetch_and_add_2, oldval + i, oldval) -+__sync_subword_fetch (u16, fetch_and_sub_2, oldval - i, oldval) -+__sync_subword_fetch (u16, fetch_and_or_2, oldval | i, oldval) -+__sync_subword_fetch (u16, fetch_and_and_2, oldval & i, oldval) -+__sync_subword_fetch (u16, fetch_and_xor_2, oldval ^ i, oldval) -+__sync_subword_fetch (u16, fetch_and_nand_2, ~(oldval & i), oldval) -+ -+__sync_subword_fetch (u8, add_and_fetch_1, oldval + i, val) -+__sync_subword_fetch (u8, sub_and_fetch_1, oldval - i, val) -+__sync_subword_fetch (u8, or_and_fetch_1, oldval | i, val) -+__sync_subword_fetch (u8, and_and_fetch_1, oldval & i, val) -+__sync_subword_fetch (u8, xor_and_fetch_1, oldval ^ i, val) -+__sync_subword_fetch (u8, nand_and_fetch_1, ~(oldval & i), val) -+ -+__sync_subword_fetch (u16, add_and_fetch_2, oldval + i, val) -+__sync_subword_fetch (u16, sub_and_fetch_2, oldval - i, val) -+__sync_subword_fetch (u16, or_and_fetch_2, oldval | i, val) -+__sync_subword_fetch (u16, and_and_fetch_2, oldval & i, val) -+__sync_subword_fetch (u16, xor_and_fetch_2, oldval ^ i, val) -+__sync_subword_fetch (u16, nand_and_fetch_2, ~(oldval & i), val) -+ - #define __atomic_subword_lock(type, size) \ -- \ --__atomic_subword(type, \ -- type __atomic_exchange_##size(volatile type* ptr, type nval, int model), \ -- pre_atomic_barrier(model);, \ -- nval, \ -- post_atomic_barrier(model); return oldval;) -+ __subword(type, \ -+ type __atomic_exchange_##size(volatile type* ptr, type nval, int model), \ -+ pre_atomic_barrier(model);, \ -+ nval, \ -+ post_atomic_barrier(model); return oldval;) -+ - __atomic_subword_lock (u8, 1) - __atomic_subword_lock (u16, 2) -+ -+#define __sync_subword_lock(type, size) \ -+ __subword(type, \ -+ type __sync_lock_test_and_set_##size(type* ptr, type nval), \ -+ , \ -+ nval, \ -+ arch_atomic_acquire_barrier_value(oldval); return oldval;) -+ -+__sync_subword_lock (u8, 1) -+__sync_subword_lock (u16, 2) -Index: libgcc/config/arm/sfp-machine.h -=================================================================== ---- a/src/libgcc/config/arm/sfp-machine.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/config/arm/sfp-machine.h (.../branches/gcc-4_8-branch) -@@ -19,10 +19,12 @@ - #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) - #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) - --#define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1) --#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) --#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 --#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 -+/* According to RTABI, QNAN is only with the most significant bit of the -+ significand set, and all other significand bits zero. */ -+#define _FP_NANFRAC_H 0 -+#define _FP_NANFRAC_S 0 -+#define _FP_NANFRAC_D 0, 0 -+#define _FP_NANFRAC_Q 0, 0, 0, 0 - #define _FP_NANSIGN_H 0 - #define _FP_NANSIGN_S 0 - #define _FP_NANSIGN_D 0 -Index: libgcc/unwind-seh.c -=================================================================== ---- a/src/libgcc/unwind-seh.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgcc/unwind-seh.c (.../branches/gcc-4_8-branch) -@@ -313,8 +313,9 @@ - ms_exc->ExceptionInformation[3] = gcc_context.reg[1]; - - /* Begin phase 2. Perform the unwinding. */ -- RtlUnwindEx (this_frame, gcc_context.ra, ms_exc, gcc_exc, -- ms_orig_context, ms_disp->HistoryTable); -+ RtlUnwindEx (this_frame, gcc_context.ra, ms_exc, -+ (PVOID)gcc_context.reg[0], ms_orig_context, -+ ms_disp->HistoryTable); - } - - /* In _Unwind_RaiseException we return _URC_FATAL_PHASE1_ERROR. */ -Index: config.guess -=================================================================== ---- a/src/config.guess (.../tags/gcc_4_8_2_release) -+++ b/src/config.guess (.../branches/gcc-4_8-branch) -@@ -1,10 +1,8 @@ - #! /bin/sh - # Attempt to guess a canonical system name. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, --# 2011, 2012, 2013 Free Software Foundation, Inc. -+# Copyright 1992-2013 Free Software Foundation, Inc. - --timestamp='2012-12-30' -+timestamp='2013-06-10' - - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by -@@ -52,9 +50,7 @@ - GNU config.guess ($timestamp) - - Originally written by Per Bothner. --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, --2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, --2012, 2013 Free Software Foundation, Inc. -+Copyright 1992-2013 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -136,6 +132,27 @@ - UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown - UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -+case "${UNAME_SYSTEM}" in -+Linux|GNU|GNU/*) -+ # If the system lacks a compiler, then just pick glibc. -+ # We could probably try harder. -+ LIBC=gnu -+ -+ eval $set_cc_for_build -+ cat <<-EOF > $dummy.c -+ #include <features.h> -+ #if defined(__UCLIBC__) -+ LIBC=uclibc -+ #elif defined(__dietlibc__) -+ LIBC=dietlibc -+ #else -+ LIBC=gnu -+ #endif -+ EOF -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` -+ ;; -+esac -+ - # Note: order is significant - the case branches are not exclusive. - - case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in -@@ -857,21 +874,21 @@ - exit ;; - *:GNU:*:*) - # the GNU system -- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland -- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu -+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -@@ -884,59 +901,54 @@ - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 -- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi -- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} -+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; -+ arc:Linux:*:* | arceb:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then -- echo ${UNAME_MACHINE}-unknown-linux-gnueabi -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else -- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) -- echo ${UNAME_MACHINE}-axis-linux-gnu -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) -- echo ${UNAME_MACHINE}-axis-linux-gnu -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) -- LIBC=gnu -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #ifdef __dietlibc__ -- LIBC=dietlibc -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` -- echo "${UNAME_MACHINE}-pc-linux-${LIBC}" -+ echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build -@@ -955,54 +967,63 @@ - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` -- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; -+ or1k:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - or32:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) -- echo sparc-unknown-linux-gnu -+ echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) -- echo hppa64-unknown-linux-gnu -+ echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -- PA7*) echo hppa1.1-unknown-linux-gnu ;; -- PA8*) echo hppa2.0-unknown-linux-gnu ;; -- *) echo hppa-unknown-linux-gnu ;; -+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; -+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; -+ *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) -- echo powerpc64-unknown-linux-gnu -+ echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) -- echo powerpc-unknown-linux-gnu -+ echo powerpc-unknown-linux-${LIBC} - exit ;; -+ ppc64le:Linux:*:*) -+ echo powerpc64le-unknown-linux-${LIBC} -+ exit ;; -+ ppcle:Linux:*:*) -+ echo powerpcle-unknown-linux-${LIBC} -+ exit ;; - s390:Linux:*:* | s390x:Linux:*:*) -- echo ${UNAME_MACHINE}-ibm-linux -+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) -- echo ${UNAME_MACHINE}-dec-linux-gnu -+ echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. -@@ -1235,19 +1256,21 @@ - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown -- case $UNAME_PROCESSOR in -- i386) -- eval $set_cc_for_build -- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -- grep IS_64BIT_ARCH >/dev/null -- then -- UNAME_PROCESSOR="x86_64" -- fi -- fi ;; -- unknown) UNAME_PROCESSOR=powerpc ;; -- esac -+ eval $set_cc_for_build -+ if test "$UNAME_PROCESSOR" = unknown ; then -+ UNAME_PROCESSOR=powerpc -+ fi -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ case $UNAME_PROCESSOR in -+ i386) UNAME_PROCESSOR=x86_64 ;; -+ powerpc) UNAME_PROCESSOR=powerpc64 ;; -+ esac -+ fi -+ fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) -Index: gcc/tree-vrp.c -=================================================================== ---- a/src/gcc/tree-vrp.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-vrp.c (.../branches/gcc-4_8-branch) -@@ -5271,9 +5271,13 @@ - } - else if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (op_def))) - { -- /* Recurse through the type conversion. */ -- retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def), -- code, e, bsi); -+ /* Recurse through the type conversion, unless it is a narrowing -+ conversion or conversion from non-integral type. */ -+ tree rhs = gimple_assign_rhs1 (op_def); -+ if (INTEGRAL_TYPE_P (TREE_TYPE (rhs)) -+ && (TYPE_PRECISION (TREE_TYPE (rhs)) -+ <= TYPE_PRECISION (TREE_TYPE (op)))) -+ retval |= register_edge_assert_for_1 (rhs, code, e, bsi); - } - - return retval; -@@ -7453,7 +7457,8 @@ - } - else if ((operand_less_p (vr1min, *vr0max) == 1 - || operand_equal_p (vr1min, *vr0max, 0)) -- && operand_less_p (*vr0min, vr1min) == 1) -+ && operand_less_p (*vr0min, vr1min) == 1 -+ && operand_less_p (*vr0max, vr1max) == 1) - { - /* [ ( ] ) or [ ]( ) */ - if (*vr0type == VR_RANGE -@@ -7487,7 +7492,8 @@ - } - else if ((operand_less_p (*vr0min, vr1max) == 1 - || operand_equal_p (*vr0min, vr1max, 0)) -- && operand_less_p (vr1min, *vr0min) == 1) -+ && operand_less_p (vr1min, *vr0min) == 1 -+ && operand_less_p (vr1max, *vr0max) == 1) - { - /* ( [ ) ] or ( )[ ] */ - if (*vr0type == VR_RANGE -Index: gcc/loop-unswitch.c -=================================================================== ---- a/src/gcc/loop-unswitch.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/loop-unswitch.c (.../branches/gcc-4_8-branch) -@@ -191,6 +191,7 @@ - if (!test) - return NULL_RTX; - -+ mode = VOIDmode; - for (i = 0; i < 2; i++) - { - op[i] = XEXP (test, i); -@@ -205,11 +206,15 @@ - return NULL_RTX; - - op[i] = get_iv_value (&iv, const0_rtx); -+ if (iv.extend != IV_UNKNOWN_EXTEND -+ && iv.mode != iv.extend_mode) -+ op[i] = lowpart_subreg (iv.mode, op[i], iv.extend_mode); -+ if (mode == VOIDmode) -+ mode = iv.mode; -+ else -+ gcc_assert (mode == iv.mode); - } - -- mode = GET_MODE (op[0]); -- if (mode == VOIDmode) -- mode = GET_MODE (op[1]); - if (GET_MODE_CLASS (mode) == MODE_CC) - { - if (at != BB_END (bb)) -Index: gcc/tree-ssa-loop-im.c -=================================================================== ---- a/src/gcc/tree-ssa-loop-im.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-loop-im.c (.../branches/gcc-4_8-branch) -@@ -1190,6 +1190,67 @@ - fini_walk_dominator_tree (&walk_data); - } - -+/* Return true if CODE is an operation that when operating on signed -+ integer types involves undefined behavior on overflow and the -+ operation can be expressed with unsigned arithmetic. */ -+ -+static bool -+arith_code_with_undefined_signed_overflow (tree_code code) -+{ -+ switch (code) -+ { -+ case PLUS_EXPR: -+ case MINUS_EXPR: -+ case MULT_EXPR: -+ case NEGATE_EXPR: -+ case POINTER_PLUS_EXPR: -+ return true; -+ default: -+ return false; -+ } -+} -+ -+/* Rewrite STMT, an assignment with a signed integer or pointer arithmetic -+ operation that can be transformed to unsigned arithmetic by converting -+ its operand, carrying out the operation in the corresponding unsigned -+ type and converting the result back to the original type. -+ -+ Returns a sequence of statements that replace STMT and also contain -+ a modified form of STMT itself. */ -+ -+static gimple_seq -+rewrite_to_defined_overflow (gimple stmt) -+{ -+ if (dump_file && (dump_flags & TDF_DETAILS)) -+ { -+ fprintf (dump_file, "rewriting stmt with undefined signed " -+ "overflow "); -+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); -+ } -+ -+ tree lhs = gimple_assign_lhs (stmt); -+ tree type = unsigned_type_for (TREE_TYPE (lhs)); -+ gimple_seq stmts = NULL; -+ for (unsigned i = 1; i < gimple_num_ops (stmt); ++i) -+ { -+ gimple_seq stmts2 = NULL; -+ gimple_set_op (stmt, i, -+ force_gimple_operand (fold_convert (type, -+ gimple_op (stmt, i)), -+ &stmts2, true, NULL_TREE)); -+ gimple_seq_add_seq (&stmts, stmts2); -+ } -+ gimple_assign_set_lhs (stmt, make_ssa_name (type, stmt)); -+ if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) -+ gimple_assign_set_rhs_code (stmt, PLUS_EXPR); -+ gimple_seq_add_stmt (&stmts, stmt); -+ gimple cvt = gimple_build_assign_with_ops -+ (NOP_EXPR, lhs, gimple_assign_lhs (stmt), NULL_TREE); -+ gimple_seq_add_stmt (&stmts, cvt); -+ -+ return stmts; -+} -+ - /* Hoist the statements in basic block BB out of the loops prescribed by - data stored in LIM_DATA structures associated with each statement. Callback - for walk_dominator_tree. */ -@@ -1321,7 +1382,21 @@ - } - } - gsi_remove (&bsi, false); -- gsi_insert_on_edge (e, stmt); -+ /* In case this is a stmt that is not unconditionally executed -+ when the target loop header is executed and the stmt may -+ invoke undefined integer or pointer overflow rewrite it to -+ unsigned arithmetic. */ -+ if (is_gimple_assign (stmt) -+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))) -+ && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (gimple_assign_lhs (stmt))) -+ && arith_code_with_undefined_signed_overflow -+ (gimple_assign_rhs_code (stmt)) -+ && (!ALWAYS_EXECUTED_IN (bb) -+ || !(ALWAYS_EXECUTED_IN (bb) == level -+ || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) -+ gsi_insert_seq_on_edge (e, rewrite_to_defined_overflow (stmt)); -+ else -+ gsi_insert_on_edge (e, stmt); - } - } - -Index: gcc/tree-ssa-tail-merge.c -=================================================================== ---- a/src/gcc/tree-ssa-tail-merge.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-tail-merge.c (.../branches/gcc-4_8-branch) -@@ -297,7 +297,8 @@ - tree val; - def_operand_p def_p; - -- if (gimple_has_side_effects (stmt)) -+ if (gimple_has_side_effects (stmt) -+ || gimple_vdef (stmt) != NULL_TREE) - return false; - - def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); -Index: gcc/cgraphbuild.c -=================================================================== ---- a/src/gcc/cgraphbuild.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cgraphbuild.c (.../branches/gcc-4_8-branch) -@@ -73,7 +73,7 @@ - decl = get_base_var (*tp); - if (TREE_CODE (decl) == FUNCTION_DECL) - { -- struct cgraph_node *node = cgraph_get_create_node (decl); -+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl); - if (!ctx->only_vars) - cgraph_mark_address_taken_node (node); - ipa_record_reference ((symtab_node)ctx->varpool_node, -@@ -143,7 +143,7 @@ - { - struct cgraph_node *per_node; - -- per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); -+ per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); - ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL); - cgraph_mark_address_taken_node (per_node); - } -@@ -218,12 +218,12 @@ - /* Mark address taken in STMT. */ - - static bool --mark_address (gimple stmt, tree addr, void *data) -+mark_address (gimple stmt, tree addr, tree, void *data) - { - addr = get_base_address (addr); - if (TREE_CODE (addr) == FUNCTION_DECL) - { -- struct cgraph_node *node = cgraph_get_create_node (addr); -+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); - cgraph_mark_address_taken_node (node); - ipa_record_reference ((symtab_node)data, - (symtab_node)node, -@@ -245,7 +245,7 @@ - /* Mark load of T. */ - - static bool --mark_load (gimple stmt, tree t, void *data) -+mark_load (gimple stmt, tree t, tree, void *data) - { - t = get_base_address (t); - if (t && TREE_CODE (t) == FUNCTION_DECL) -@@ -252,7 +252,7 @@ - { - /* ??? This can happen on platforms with descriptors when these are - directly manipulated in the code. Pretend that it's an address. */ -- struct cgraph_node *node = cgraph_get_create_node (t); -+ struct cgraph_node *node = cgraph_get_create_real_symbol_node (t); - cgraph_mark_address_taken_node (node); - ipa_record_reference ((symtab_node)data, - (symtab_node)node, -@@ -273,7 +273,7 @@ - /* Mark store of T. */ - - static bool --mark_store (gimple stmt, tree t, void *data) -+mark_store (gimple stmt, tree t, tree, void *data) - { - t = get_base_address (t); - if (t && TREE_CODE (t) == VAR_DECL -@@ -330,7 +330,7 @@ - { - tree fn = gimple_omp_parallel_child_fn (stmt); - ipa_record_reference ((symtab_node)node, -- (symtab_node)cgraph_get_create_node (fn), -+ (symtab_node)cgraph_get_create_real_symbol_node (fn), - IPA_REF_ADDR, stmt); - } - if (gimple_code (stmt) == GIMPLE_OMP_TASK) -@@ -338,12 +338,12 @@ - tree fn = gimple_omp_task_child_fn (stmt); - if (fn) - ipa_record_reference ((symtab_node)node, -- (symtab_node) cgraph_get_create_node (fn), -+ (symtab_node) cgraph_get_create_real_symbol_node (fn), - IPA_REF_ADDR, stmt); - fn = gimple_omp_task_copy_fn (stmt); - if (fn) - ipa_record_reference ((symtab_node)node, -- (symtab_node)cgraph_get_create_node (fn), -+ (symtab_node)cgraph_get_create_real_symbol_node (fn), - IPA_REF_ADDR, stmt); - } - } -Index: gcc/tree-ssa-uninit.c -=================================================================== ---- a/src/gcc/tree-ssa-uninit.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-uninit.c (.../branches/gcc-4_8-branch) -@@ -36,6 +36,7 @@ - #include "hashtab.h" - #include "tree-pass.h" - #include "diagnostic-core.h" -+#include "params.h" - - /* This implements the pass that does predicate aware warning on uses of - possibly uninitialized variables. The pass first collects the set of -@@ -246,8 +247,8 @@ - - /* Computes the control dependence chains (paths of edges) - for DEP_BB up to the dominating basic block BB (the head node of a -- chain should be dominated by it). CD_CHAINS is pointer to a -- dynamic array holding the result chains. CUR_CD_CHAIN is the current -+ chain should be dominated by it). CD_CHAINS is pointer to an -+ array holding the result chains. CUR_CD_CHAIN is the current - chain being computed. *NUM_CHAINS is total number of chains. The - function returns true if the information is successfully computed, - return false if there is no control dependence or not computed. */ -@@ -256,7 +257,8 @@ - compute_control_dep_chain (basic_block bb, basic_block dep_bb, - vec<edge> *cd_chains, - size_t *num_chains, -- vec<edge> *cur_cd_chain) -+ vec<edge> *cur_cd_chain, -+ int *num_calls) - { - edge_iterator ei; - edge e; -@@ -267,6 +269,10 @@ - if (EDGE_COUNT (bb->succs) < 2) - return false; - -+ if (*num_calls > PARAM_VALUE (PARAM_UNINIT_CONTROL_DEP_ATTEMPTS)) -+ return false; -+ ++*num_calls; -+ - /* Could use a set instead. */ - cur_chain_len = cur_cd_chain->length (); - if (cur_chain_len > MAX_CHAIN_LEN) -@@ -306,7 +312,7 @@ - - /* Now check if DEP_BB is indirectly control dependent on BB. */ - if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, -- num_chains, cur_cd_chain)) -+ num_chains, cur_cd_chain, num_calls)) - { - found_cd_chain = true; - break; -@@ -438,14 +444,12 @@ - basic_block use_bb) - { - size_t num_chains = 0, i; -- vec<edge> *dep_chains = 0; -+ int num_calls = 0; -+ vec<edge> dep_chains[MAX_NUM_CHAINS]; - vec<edge> cur_chain = vNULL; - bool has_valid_pred = false; - basic_block cd_root = 0; - -- typedef vec<edge> vec_edge_heap; -- dep_chains = XCNEWVEC (vec_edge_heap, MAX_NUM_CHAINS); -- - /* First find the closest bb that is control equivalent to PHI_BB - that also dominates USE_BB. */ - cd_root = phi_bb; -@@ -458,20 +462,16 @@ - break; - } - -- compute_control_dep_chain (cd_root, use_bb, -- dep_chains, &num_chains, -- &cur_chain); -+ compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains, -+ &cur_chain, &num_calls); - - has_valid_pred -- = convert_control_dep_chain_into_preds (dep_chains, -- num_chains, -- preds, -- num_preds); -+ = convert_control_dep_chain_into_preds (dep_chains, num_chains, preds, -+ num_preds); - /* Free individual chain */ - cur_chain.release (); - for (i = 0; i < num_chains; i++) - dep_chains[i].release (); -- free (dep_chains); - return has_valid_pred; - } - -@@ -539,7 +539,7 @@ - size_t *num_preds, gimple phi) - { - size_t num_chains = 0, i, n; -- vec<edge> *dep_chains = 0; -+ vec<edge> dep_chains[MAX_NUM_CHAINS]; - vec<edge> cur_chain = vNULL; - vec<edge> def_edges = vNULL; - bool has_valid_pred = false; -@@ -546,9 +546,6 @@ - basic_block phi_bb, cd_root = 0; - struct pointer_set_t *visited_phis; - -- typedef vec<edge> vec_edge_heap; -- dep_chains = XCNEWVEC (vec_edge_heap, MAX_NUM_CHAINS); -- - phi_bb = gimple_bb (phi); - /* First find the closest dominating bb to be - the control dependence root */ -@@ -567,38 +564,33 @@ - for (i = 0; i < n; i++) - { - size_t prev_nc, j; -+ int num_calls = 0; - edge opnd_edge; - - opnd_edge = def_edges[i]; - prev_nc = num_chains; -- compute_control_dep_chain (cd_root, opnd_edge->src, -- dep_chains, &num_chains, -- &cur_chain); -- /* Free individual chain */ -- cur_chain.release (); -+ compute_control_dep_chain (cd_root, opnd_edge->src, dep_chains, -+ &num_chains, &cur_chain, &num_calls); - - /* Now update the newly added chains with - the phi operand edge: */ - if (EDGE_COUNT (opnd_edge->src->succs) > 1) - { -- if (prev_nc == num_chains -- && num_chains < MAX_NUM_CHAINS) -- num_chains++; -+ if (prev_nc == num_chains && num_chains < MAX_NUM_CHAINS) -+ dep_chains[num_chains++] = vNULL; - for (j = prev_nc; j < num_chains; j++) -- { -- dep_chains[j].safe_push (opnd_edge); -- } -+ dep_chains[j].safe_push (opnd_edge); - } - } - -+ /* Free individual chain */ -+ cur_chain.release (); -+ - has_valid_pred -- = convert_control_dep_chain_into_preds (dep_chains, -- num_chains, -- preds, -- num_preds); -+ = convert_control_dep_chain_into_preds (dep_chains, num_chains, preds, -+ num_preds); - for (i = 0; i < num_chains; i++) - dep_chains[i].release (); -- free (dep_chains); - return has_valid_pred; - } - -Index: gcc/tree-ssa-loop-niter.c -=================================================================== ---- a/src/gcc/tree-ssa-loop-niter.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-loop-niter.c (.../branches/gcc-4_8-branch) -@@ -2075,7 +2075,8 @@ - return NULL; - } - -- if (gimple_code (stmt) != GIMPLE_ASSIGN) -+ if (gimple_code (stmt) != GIMPLE_ASSIGN -+ || gimple_assign_rhs_class (stmt) == GIMPLE_TERNARY_RHS) - return NULL; - - code = gimple_assign_rhs_code (stmt); -@@ -2143,7 +2144,7 @@ - { - gimple stmt; - -- gcc_assert (is_gimple_min_invariant (base)); -+ gcc_checking_assert (is_gimple_min_invariant (base)); - - if (!x) - return base; -@@ -2152,7 +2153,7 @@ - if (gimple_code (stmt) == GIMPLE_PHI) - return base; - -- gcc_assert (is_gimple_assign (stmt)); -+ gcc_checking_assert (is_gimple_assign (stmt)); - - /* STMT must be either an assignment of a single SSA name or an - expression involving an SSA name and a constant. Try to fold that -Index: gcc/c-family/ChangeLog -=================================================================== ---- a/src/gcc/c-family/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/c-family/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,36 @@ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ Backport from mainline -+ 2014-02-19 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/37743 -+ * c-common.c (c_common_nodes_and_builtins): When initializing -+ c_uint{16,32,64}_type_node, also set corresponding -+ uint{16,32,64}_type_node to the same value. -+ -+ 2014-02-12 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/60101 -+ * c-common.c (merge_tlist): If copy is true, call new_tlist, -+ if false, add ADD itself, rather than vice versa. -+ (verify_tree): For COND_EXPR, don't call merge_tlist with non-zero -+ copy. For SAVE_EXPR, only call merge_tlist once. -+ -+2013-11-29 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/59280 -+ * c-common.c (get_priority): If TREE_VALUE (args) is IDENTIFIER_NODE, -+ goto invalid. If it is error_mark_node, don't issue further -+ diagnostics. -+ -+2013-11-04 Marek Polacek <polacek@redhat.com> -+ -+ Backport from mainline -+ 2013-11-04 Marek Polacek <polacek@redhat.com> -+ -+ PR c++/58979 -+ * c-common.c (invalid_indirection_error): Handle RO_ARROW_STAR case. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: gcc/c-family/c-common.c -=================================================================== ---- a/src/gcc/c-family/c-common.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/c-family/c-common.c (.../branches/gcc-4_8-branch) -@@ -2894,7 +2894,7 @@ - } - if (!found) - { -- *end = copy ? add : new_tlist (NULL, add->expr, add->writer); -+ *end = copy ? new_tlist (NULL, add->expr, add->writer) : add; - end = &(*end)->next; - *end = 0; - } -@@ -3052,7 +3052,7 @@ - verify_tree (TREE_OPERAND (x, 0), &tmp_before, &tmp_list2, NULL_TREE); - warn_for_collisions (tmp_list2); - merge_tlist (pbefore_sp, tmp_before, 0); -- merge_tlist (pbefore_sp, tmp_list2, 1); -+ merge_tlist (pbefore_sp, tmp_list2, 0); - - tmp_list3 = tmp_nosp = 0; - verify_tree (TREE_OPERAND (x, 1), &tmp_list3, &tmp_nosp, NULL_TREE); -@@ -3156,12 +3156,7 @@ - warn_for_collisions (tmp_nosp); - - tmp_list3 = 0; -- while (tmp_nosp) -- { -- struct tlist *t = tmp_nosp; -- tmp_nosp = t->next; -- merge_tlist (&tmp_list3, t, 0); -- } -+ merge_tlist (&tmp_list3, tmp_nosp, 0); - t->cache_before_sp = tmp_before; - t->cache_after_sp = tmp_list3; - } -@@ -5511,13 +5506,13 @@ - uint8_type_node = - TREE_TYPE (identifier_global_value (c_get_ident (UINT8_TYPE))); - if (UINT16_TYPE) -- c_uint16_type_node = -+ c_uint16_type_node = uint16_type_node = - TREE_TYPE (identifier_global_value (c_get_ident (UINT16_TYPE))); - if (UINT32_TYPE) -- c_uint32_type_node = -+ c_uint32_type_node = uint32_type_node = - TREE_TYPE (identifier_global_value (c_get_ident (UINT32_TYPE))); - if (UINT64_TYPE) -- c_uint64_type_node = -+ c_uint64_type_node = uint64_type_node = - TREE_TYPE (identifier_global_value (c_get_ident (UINT64_TYPE))); - if (INT_LEAST8_TYPE) - int_least8_type_node = -@@ -6917,6 +6912,10 @@ - } - - arg = TREE_VALUE (args); -+ if (TREE_CODE (arg) == IDENTIFIER_NODE) -+ goto invalid; -+ if (arg == error_mark_node) -+ return DEFAULT_INIT_PRIORITY; - arg = default_conversion (arg); - if (!host_integerp (arg, /*pos=*/0) - || !INTEGRAL_TYPE_P (TREE_TYPE (arg))) -@@ -9763,6 +9762,11 @@ - "invalid type argument of %<->%> (have %qT)", - type); - break; -+ case RO_ARROW_STAR: -+ error_at (loc, -+ "invalid type argument of %<->*%> (have %qT)", -+ type); -+ break; - case RO_IMPLICIT_CONVERSION: - error_at (loc, - "invalid type argument of implicit conversion (have %qT)", -Index: gcc/c/c-typeck.c -=================================================================== ---- a/src/gcc/c/c-typeck.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/c/c-typeck.c (.../branches/gcc-4_8-branch) -@@ -3629,7 +3629,8 @@ - /* Report invalid types. */ - - if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE -- && typecode != INTEGER_TYPE && typecode != REAL_TYPE) -+ && typecode != INTEGER_TYPE && typecode != REAL_TYPE -+ && typecode != VECTOR_TYPE) - { - if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) - error_at (location, "wrong type argument to increment"); -@@ -3694,7 +3695,9 @@ - } - else - { -- inc = integer_one_node; -+ inc = (TREE_CODE (argtype) == VECTOR_TYPE -+ ? build_one_cst (argtype) -+ : integer_one_node); - inc = convert (argtype, inc); - } - -@@ -4331,8 +4334,10 @@ - { - if (int_operands) - { -- op1 = remove_c_maybe_const_expr (op1); -- op2 = remove_c_maybe_const_expr (op2); -+ /* Use c_fully_fold here, since C_MAYBE_CONST_EXPR might be -+ nested inside of the expression. */ -+ op1 = c_fully_fold (op1, false, NULL); -+ op2 = c_fully_fold (op2, false, NULL); - } - ret = build3 (COND_EXPR, result_type, ifexp, op1, op2); - if (int_operands) -@@ -10618,7 +10623,8 @@ - "%qE has invalid type for %<reduction%>", t); - remove = true; - } -- else if (FLOAT_TYPE_P (TREE_TYPE (t))) -+ else if (FLOAT_TYPE_P (TREE_TYPE (t)) -+ || TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) - { - enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); - const char *r_name = NULL; -@@ -10628,8 +10634,14 @@ - case PLUS_EXPR: - case MULT_EXPR: - case MINUS_EXPR: -+ break; - case MIN_EXPR: -+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) -+ r_name = "min"; -+ break; - case MAX_EXPR: -+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) -+ r_name = "max"; - break; - case BIT_AND_EXPR: - r_name = "&"; -@@ -10641,10 +10653,12 @@ - r_name = "|"; - break; - case TRUTH_ANDIF_EXPR: -- r_name = "&&"; -+ if (FLOAT_TYPE_P (TREE_TYPE (t))) -+ r_name = "&&"; - break; - case TRUTH_ORIF_EXPR: -- r_name = "||"; -+ if (FLOAT_TYPE_P (TREE_TYPE (t))) -+ r_name = "||"; - break; - default: - gcc_unreachable (); -Index: gcc/c/ChangeLog -=================================================================== ---- a/src/gcc/c/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/c/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,33 @@ -+2014-01-23 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58809 -+ * c-typeck.c (c_finish_omp_clause): Reject MIN_EXPR, MAX_EXPR, -+ BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR on COMPLEX_TYPEs. -+ -+2014-01-22 Marek Polacek <polacek@redhat.com> -+ -+ Backport from mainline -+ 2014-01-22 Marek Polacek <polacek@redhat.com> -+ -+ PR c/59891 -+ * c-typeck.c (build_conditional_expr): Call c_fully_fold instead -+ of remove_c_maybe_const_expr on op1 and op2. -+ -+2013-12-03 Marek Polacek <polacek@redhat.com> -+ -+ Backport from mainline -+ 2013-12-03 Marek Polacek <polacek@redhat.com> -+ -+ PR c/59351 -+ * c-decl.c (build_compound_literal): Allow compound literals with -+ empty initial value. -+ -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> -+ -+ PR c++/59032 -+ * c-typeck.c (build_unary_op): Allow vector increment and decrement. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: gcc/c/c-decl.c -=================================================================== ---- a/src/gcc/c/c-decl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/c/c-decl.c (.../branches/gcc-4_8-branch) -@@ -4632,7 +4632,9 @@ - { - int failure = complete_array_type (&TREE_TYPE (decl), - DECL_INITIAL (decl), true); -- gcc_assert (!failure); -+ /* If complete_array_type returns 3, it means that the -+ initial value of the compound literal is empty. Allow it. */ -+ gcc_assert (failure == 0 || failure == 3); - - type = TREE_TYPE (decl); - TREE_TYPE (DECL_INITIAL (decl)) = type; -Index: gcc/cgraph.c -=================================================================== ---- a/src/gcc/cgraph.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cgraph.c (.../branches/gcc-4_8-branch) -@@ -2596,4 +2596,47 @@ - FOR_EACH_FUNCTION (node) - verify_cgraph_node (node); - } -+ -+/* Create external decl node for DECL. -+ The difference i nbetween cgraph_get_create_node and -+ cgraph_get_create_real_symbol_node is that cgraph_get_create_node -+ may return inline clone, while cgraph_get_create_real_symbol_node -+ will create a new node in this case. -+ FIXME: This function should be removed once clones are put out of decl -+ hash. */ -+ -+struct cgraph_node * -+cgraph_get_create_real_symbol_node (tree decl) -+{ -+ struct cgraph_node *first_clone = cgraph_get_node (decl); -+ struct cgraph_node *node; -+ /* create symbol table node. even if inline clone exists, we can not take -+ it as a target of non-inlined call. */ -+ node = cgraph_get_node (decl); -+ if (node && !node->global.inlined_to) -+ return node; -+ -+ node = cgraph_create_node (decl); -+ -+ /* ok, we previously inlined the function, then removed the offline copy and -+ now we want it back for external call. this can happen when devirtualizing -+ while inlining function called once that happens after extern inlined and -+ virtuals are already removed. in this case introduce the external node -+ and make it available for call. */ -+ if (first_clone) -+ { -+ first_clone->clone_of = node; -+ node->clones = first_clone; -+ symtab_prevail_in_asm_name_hash ((symtab_node) node); -+ symtab_insert_node_to_hashtable ((symtab_node) node); -+ if (dump_file) -+ fprintf (dump_file, "Introduced new external node " -+ "(%s/%i) and turned into root of the clone tree.\n", -+ xstrdup (cgraph_node_name (node)), node->uid); -+ } -+ else if (dump_file) -+ fprintf (dump_file, "Introduced new external node " -+ "(%s/%i).\n", xstrdup (cgraph_node_name (node)), node->uid); -+ return node; -+} - #include "gt-cgraph.h" -Index: gcc/cgraph.h -=================================================================== ---- a/src/gcc/cgraph.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cgraph.h (.../branches/gcc-4_8-branch) -@@ -575,6 +575,7 @@ - struct cgraph_node * cgraph_create_node (tree); - struct cgraph_node * cgraph_create_empty_node (void); - struct cgraph_node * cgraph_get_create_node (tree); -+struct cgraph_node * cgraph_get_create_real_symbol_node (tree); - struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree); - struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT, - HOST_WIDE_INT, tree, tree); -Index: gcc/optabs.c -=================================================================== ---- a/src/gcc/optabs.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/optabs.c (.../branches/gcc-4_8-branch) -@@ -4558,8 +4558,11 @@ - if (!COMPARISON_P (comparison)) - return NULL_RTX; - -+ /* State variables we need to save and restore if cmove can't be used. */ -+ int save_pending_stack_adjust = pending_stack_adjust; -+ int save_stack_pointer_delta = stack_pointer_delta; -+ last = get_last_insn (); - do_pending_stack_adjust (); -- last = get_last_insn (); - prepare_cmp_insn (XEXP (comparison, 0), XEXP (comparison, 1), - GET_CODE (comparison), NULL_RTX, unsignedp, OPTAB_WIDEN, - &comparison, &cmode); -@@ -4579,6 +4582,8 @@ - } - } - delete_insns_since (last); -+ pending_stack_adjust = save_pending_stack_adjust; -+ stack_pointer_delta = save_stack_pointer_delta; - return NULL_RTX; - } - -@@ -6233,7 +6238,7 @@ - - /* If the optabs changed, record it. */ - if (memcmp (tmp_optabs, this_target_optabs, sizeof (struct target_optabs))) -- TREE_OPTIMIZATION_OPTABS (optnode) = (unsigned char *) tmp_optabs; -+ TREE_OPTIMIZATION_OPTABS (optnode) = tmp_optabs; - else - { - TREE_OPTIMIZATION_OPTABS (optnode) = NULL; -@@ -7035,8 +7040,7 @@ - - create_output_operand (&ops[0], target, mode); - create_fixed_operand (&ops[1], mem); -- /* VAL may have been promoted to a wider mode. Shrink it if so. */ -- create_convert_operand_to (&ops[2], val, mode, true); -+ create_input_operand (&ops[2], val, mode); - create_integer_operand (&ops[3], model); - if (maybe_expand_insn (icode, 4, ops)) - return ops[0].value; -@@ -7075,8 +7079,7 @@ - struct expand_operand ops[3]; - create_output_operand (&ops[0], target, mode); - create_fixed_operand (&ops[1], mem); -- /* VAL may have been promoted to a wider mode. Shrink it if so. */ -- create_convert_operand_to (&ops[2], val, mode, true); -+ create_input_operand (&ops[2], val, mode); - if (maybe_expand_insn (icode, 3, ops)) - return ops[0].value; - } -@@ -7118,8 +7121,6 @@ - { - if (!target || !register_operand (target, mode)) - target = gen_reg_rtx (mode); -- if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode) -- val = convert_modes (mode, GET_MODE (val), val, 1); - if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX)) - return target; - } -@@ -7331,8 +7332,8 @@ - create_output_operand (&ops[0], target_bool, bool_mode); - create_output_operand (&ops[1], target_oval, mode); - create_fixed_operand (&ops[2], mem); -- create_convert_operand_to (&ops[3], expected, mode, true); -- create_convert_operand_to (&ops[4], desired, mode, true); -+ create_input_operand (&ops[3], expected, mode); -+ create_input_operand (&ops[4], desired, mode); - create_integer_operand (&ops[5], is_weak); - create_integer_operand (&ops[6], succ_model); - create_integer_operand (&ops[7], fail_model); -@@ -7353,8 +7354,8 @@ - - create_output_operand (&ops[0], target_oval, mode); - create_fixed_operand (&ops[1], mem); -- create_convert_operand_to (&ops[2], expected, mode, true); -- create_convert_operand_to (&ops[3], desired, mode, true); -+ create_input_operand (&ops[2], expected, mode); -+ create_input_operand (&ops[3], desired, mode); - if (!maybe_expand_insn (icode, 4, ops)) - return false; - + Merged /trunk/libjava/classpath:r211733 Index: gcc/DATESTAMP =================================================================== ---- a/src/gcc/DATESTAMP (.../tags/gcc_4_8_2_release) +--- a/src/gcc/DATESTAMP (.../tags/gcc_4_8_3_release) +++ b/src/gcc/DATESTAMP (.../branches/gcc-4_8-branch) @@ -1 +1 @@ --20131016 -+20140404 -Index: gcc/value-prof.c -=================================================================== ---- a/src/gcc/value-prof.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/value-prof.c (.../branches/gcc-4_8-branch) -@@ -1270,8 +1270,7 @@ - - /* Build an EH edge for the direct call if necessary. */ - lp_nr = lookup_stmt_eh_lp (icall_stmt); -- if (lp_nr != 0 -- && stmt_could_throw_p (dcall_stmt)) -+ if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt)) - { - edge e_eh, e; - edge_iterator ei; -Index: gcc/tree.h -=================================================================== ---- a/src/gcc/tree.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree.h (.../branches/gcc-4_8-branch) -@@ -3589,7 +3589,7 @@ - - /* Target optabs for this set of optimization options. This is of - type `struct target_optabs *'. */ -- unsigned char *GTY ((atomic)) optabs; -+ void *GTY ((atomic)) optabs; - - /* The value of this_target_optabs against which the optabs above were - generated. */ -@@ -5854,6 +5854,7 @@ - extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree); - extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree); - extern tree fold_builtin_strncpy (location_t, tree, tree, tree, tree, tree); -+extern tree fold_builtin_strcat (location_t, tree, tree, tree); - extern tree fold_builtin_memory_chk (location_t, tree, tree, tree, tree, tree, tree, bool, - enum built_in_function); - extern tree fold_builtin_stxcpy_chk (location_t, tree, tree, tree, tree, tree, bool, -@@ -6545,4 +6546,18 @@ - && builtin_info.implicit_p[uns_fncode]); - } - -+/* Return pointer to optimization flags of FNDECL. */ -+static inline struct cl_optimization * -+opts_for_fn (const_tree fndecl) -+{ -+ tree fn_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl); -+ if (fn_opts == NULL_TREE) -+ fn_opts = optimization_default_node; -+ return TREE_OPTIMIZATION (fn_opts); -+} -+ -+/* opt flag for function FNDECL, e.g. opts_for_fn (fndecl, optimize) is -+ the optimization level of function fndecl. */ -+#define opt_for_fn(fndecl, opt) (opts_for_fn (fndecl)->x_##opt) -+ - #endif /* GCC_TREE_H */ +-20140522 ++20140717 Index: gcc/ipa-cp.c =================================================================== ---- a/src/gcc/ipa-cp.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/ipa-cp.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/ipa-cp.c (.../branches/gcc-4_8-branch) -@@ -444,6 +444,9 @@ - reason = "not a tree_versionable_function"; - else if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE) - reason = "insufficient body availability"; -+ else if (!opt_for_fn (node->symbol.decl, optimize) -+ || !opt_for_fn (node->symbol.decl, flag_ipa_cp)) -+ reason = "non-optimized function"; +@@ -447,6 +447,8 @@ + else if (!opt_for_fn (node->symbol.decl, optimize) + || !opt_for_fn (node->symbol.decl, flag_ipa_cp)) + reason = "non-optimized function"; ++ else if (node->tm_clone) ++ reason = "transactional memory clone"; if (reason && dump_file && !node->alias && !node->thunk.thunk_p) fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", -@@ -3119,6 +3122,7 @@ - struct cgraph_node *node) - { - struct ipa_node_params *orig_caller_info = IPA_NODE_REF (cs->caller); -+ struct ipa_node_params *orig_node_info; - struct ipa_agg_replacement_value *aggval; - int i, ec, count; - -@@ -3133,6 +3137,7 @@ - if (aggval->index >= ec) - return false; - -+ orig_node_info = IPA_NODE_REF (IPA_NODE_REF (node)->ipcp_orig_node); - if (orig_caller_info->ipcp_orig_node) - orig_caller_info = IPA_NODE_REF (orig_caller_info->ipcp_orig_node); - -@@ -3150,7 +3155,7 @@ - if (!interesting) - continue; - -- plats = ipa_get_parm_lattices (orig_caller_info, aggval->index); -+ plats = ipa_get_parm_lattices (orig_node_info, aggval->index); - if (plats->aggs_bottom) - return false; - -Index: gcc/rtlanal.c -=================================================================== ---- a/src/gcc/rtlanal.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/rtlanal.c (.../branches/gcc-4_8-branch) -@@ -224,10 +224,10 @@ - return 0; - } - --/* Return nonzero if the use of X as an address in a MEM can cause a trap. -- MODE is the mode of the MEM (not that of X) and UNALIGNED_MEMS controls -- whether nonzero is returned for unaligned memory accesses on strict -- alignment machines. */ -+/* Return nonzero if the use of X+OFFSET as an address in a MEM with SIZE -+ bytes can cause a trap. MODE is the mode of the MEM (not that of X) and -+ UNALIGNED_MEMS controls whether nonzero is returned for unaligned memory -+ references on strict alignment machines. */ - - static int - rtx_addr_can_trap_p_1 (const_rtx x, HOST_WIDE_INT offset, HOST_WIDE_INT size, -@@ -235,11 +235,12 @@ - { - enum rtx_code code = GET_CODE (x); - -- if (STRICT_ALIGNMENT -- && unaligned_mems -- && GET_MODE_SIZE (mode) != 0) -+ /* The offset must be a multiple of the mode size if we are considering -+ unaligned memory references on strict alignment machines. */ -+ if (STRICT_ALIGNMENT && unaligned_mems && GET_MODE_SIZE (mode) != 0) - { - HOST_WIDE_INT actual_offset = offset; -+ - #ifdef SPARC_STACK_BOUNDARY_HACK - /* ??? The SPARC port may claim a STACK_BOUNDARY higher than - the real alignment of %sp. However, when it does this, the -@@ -298,8 +299,27 @@ - return 0; - - case REG: -- /* As in rtx_varies_p, we have to use the actual rtx, not reg number. */ -- if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx -+ /* Stack references are assumed not to trap, but we need to deal with -+ nonsensical offsets. */ -+ if (x == frame_pointer_rtx) -+ { -+ HOST_WIDE_INT adj_offset = offset - STARTING_FRAME_OFFSET; -+ if (size == 0) -+ size = GET_MODE_SIZE (mode); -+ if (FRAME_GROWS_DOWNWARD) -+ { -+ if (adj_offset < frame_offset || adj_offset + size - 1 >= 0) -+ return 1; -+ } -+ else -+ { -+ if (adj_offset < 0 || adj_offset + size - 1 >= frame_offset) -+ return 1; -+ } -+ return 0; -+ } -+ /* ??? Need to add a similar guard for nonsensical offsets. */ -+ if (x == hard_frame_pointer_rtx - || x == stack_pointer_rtx - /* The arg pointer varies if it is not a fixed register. */ - || (x == arg_pointer_rtx && fixed_regs[ARG_POINTER_REGNUM])) -@@ -320,9 +340,7 @@ - if (XEXP (x, 0) == pic_offset_table_rtx && CONSTANT_P (XEXP (x, 1))) - return 0; - -- /* - or it is an address that can't trap plus a constant integer, -- with the proper remainder modulo the mode size if we are -- considering unaligned memory references. */ -+ /* - or it is an address that can't trap plus a constant integer. */ - if (CONST_INT_P (XEXP (x, 1)) - && !rtx_addr_can_trap_p_1 (XEXP (x, 0), offset + INTVAL (XEXP (x, 1)), - size, mode, unaligned_mems)) -Index: gcc/configure -=================================================================== ---- a/src/gcc/configure (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/configure (.../branches/gcc-4_8-branch) -@@ -11202,13 +11202,11 @@ - /* | A-Za-z:\\/* ) realsrcdir=${srcdir};; - *) realsrcdir=../${srcdir};; - esac -- saved_CFLAGS="${CFLAGS}" - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ -- LDFLAGS="${LDFLAGS_FOR_BUILD}" \ -+ LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \ - ${realsrcdir}/configure \ - --enable-languages=${enable_languages-all} \ - --target=$target_alias --host=$build_alias --build=$build_alias -- CFLAGS="${saved_CFLAGS}" - - # We just finished tests for the build machine, so rename - # the file auto-build.h in the gcc directory. -@@ -11703,6 +11701,7 @@ - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - -@@ -13590,7 +13589,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -13615,7 +13614,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -13634,7 +13636,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -17828,7 +17833,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 17831 "configure" -+#line 17836 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -17934,7 +17939,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 17937 "configure" -+#line 17942 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -24263,6 +24268,43 @@ - $as_echo "#define HAVE_AS_SPARC4 1" >>confdefs.h - - fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for LEON instructions" >&5 -+$as_echo_n "checking assembler for LEON instructions... " >&6; } -+if test "${gcc_cv_as_sparc_leon+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ gcc_cv_as_sparc_leon=no -+ if test x$gcc_cv_as != x; then -+ $as_echo '.text -+ .register %g2, #scratch -+ .register %g3, #scratch -+ .align 4 -+ smac %g2, %g3, %g1 -+ umac %g2, %g3, %g1 -+ cas [%g2], %g3, %g1' > conftest.s -+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -Aleon -o conftest.o conftest.s >&5' -+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -+ test $ac_status = 0; }; } -+ then -+ gcc_cv_as_sparc_leon=yes -+ else -+ echo "configure: failed program was" >&5 -+ cat conftest.s >&5 -+ fi -+ rm -f conftest.o conftest.s -+ fi -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_sparc_leon" >&5 -+$as_echo "$gcc_cv_as_sparc_leon" >&6; } -+if test $gcc_cv_as_sparc_leon = yes; then -+ -+$as_echo "#define HAVE_AS_LEON 1" >>confdefs.h -+ -+fi - ;; - - i[34567]86-*-* | x86_64-*-*) -@@ -24745,6 +24787,10 @@ - - # These two are used unconditionally by i386.[ch]; it is to be defined - # to 1 if the feature is present, 0 otherwise. -+ as_ix86_gotoff_in_data_opt= -+ if test x$gas = xyes; then -+ as_ix86_gotoff_in_data_opt="--32" -+ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GOTOFF in data" >&5 - $as_echo_n "checking assembler for GOTOFF in data... " >&6; } - if test "${gcc_cv_as_ix86_gotoff_in_data+set}" = set; then : -@@ -24761,7 +24807,7 @@ - nop - .data - .long .L0@GOTOFF' > conftest.s -- if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' -+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gotoff_in_data_opt -o conftest.o conftest.s >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -24822,6 +24868,37 @@ - - fi - -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for ud2 mnemonic" >&5 -+$as_echo_n "checking assembler for ud2 mnemonic... " >&6; } -+if test "${gcc_cv_as_ix86_ud2+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ gcc_cv_as_ix86_ud2=no -+ if test x$gcc_cv_as != x; then -+ $as_echo 'ud2' > conftest.s -+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' -+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 -+ test $ac_status = 0; }; } -+ then -+ gcc_cv_as_ix86_ud2=yes -+ else -+ echo "configure: failed program was" >&5 -+ cat conftest.s >&5 -+ fi -+ rm -f conftest.o conftest.s -+ fi -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ix86_ud2" >&5 -+$as_echo "$gcc_cv_as_ix86_ud2" >&6; } -+if test $gcc_cv_as_ix86_ud2 = yes; then -+ -+$as_echo "#define HAVE_AS_IX86_UD2 1" >>confdefs.h -+ -+fi -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for R_386_TLS_GD_PLT reloc" >&5 - $as_echo_n "checking assembler for R_386_TLS_GD_PLT reloc... " >&6; } - if test "${gcc_cv_as_ix86_tlsgdplt+set}" = set; then : -@@ -27239,8 +27316,8 @@ - $as_echo_n "checking for exported symbols... " >&6; } - if test "x$export_sym_check" != x; then - echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c -- ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1 -- if $export_sym_check conftest | grep foobar > /dev/null; then -+ ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 -+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - : # No need to use a flag - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 - $as_echo "yes" >&6; } -@@ -27249,8 +27326,8 @@ - $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -rdynamic" >&5 - $as_echo_n "checking for -rdynamic... " >&6; } -- ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1 -- if $export_sym_check conftest | grep foobar > /dev/null; then -+ ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 -+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - plugin_rdynamic=yes - pluginlibs="-rdynamic" - else -Index: gcc/builtins.c -=================================================================== ---- a/src/gcc/builtins.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/builtins.c (.../branches/gcc-4_8-branch) -@@ -180,7 +180,6 @@ - static tree fold_builtin_strpbrk (location_t, tree, tree, tree); - static tree fold_builtin_strstr (location_t, tree, tree, tree); - static tree fold_builtin_strrchr (location_t, tree, tree, tree); --static tree fold_builtin_strcat (location_t, tree, tree); - static tree fold_builtin_strncat (location_t, tree, tree, tree); - static tree fold_builtin_strspn (location_t, tree, tree); - static tree fold_builtin_strcspn (location_t, tree, tree); -@@ -1958,6 +1957,7 @@ - tree fndecl = get_callee_fndecl (exp); - enum machine_mode mode; - bool errno_set = false; -+ bool try_widening = false; - tree arg; - - if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) -@@ -1969,6 +1969,7 @@ - { - CASE_FLT_FN (BUILT_IN_SQRT): - errno_set = ! tree_expr_nonnegative_p (arg); -+ try_widening = true; - builtin_optab = sqrt_optab; - break; - CASE_FLT_FN (BUILT_IN_EXP): -@@ -2025,8 +2026,10 @@ - if (! flag_errno_math || ! HONOR_NANS (mode)) - errno_set = false; - -- /* Before working hard, check whether the instruction is available. */ -- if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing -+ /* Before working hard, check whether the instruction is available, but try -+ to widen the mode for specific operations. */ -+ if ((optab_handler (builtin_optab, mode) != CODE_FOR_nothing -+ || (try_widening && !excess_precision_type (TREE_TYPE (exp)))) - && (!errno_set || !optimize_insn_for_size_p ())) - { - rtx result = gen_reg_rtx (mode); -@@ -5347,7 +5350,7 @@ - expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp, - rtx target) - { -- rtx expect, desired, mem, oldval; -+ rtx expect, desired, mem, oldval, label; - enum memmodel success, failure; - tree weak; - bool is_weak; -@@ -5385,14 +5388,26 @@ - if (host_integerp (weak, 0) && tree_low_cst (weak, 0) != 0) - is_weak = true; - -- oldval = expect; -- if (!expand_atomic_compare_and_swap ((target == const0_rtx ? NULL : &target), -- &oldval, mem, oldval, desired, -+ if (target == const0_rtx) -+ target = NULL; -+ -+ /* Lest the rtl backend create a race condition with an imporoper store -+ to memory, always create a new pseudo for OLDVAL. */ -+ oldval = NULL; -+ -+ if (!expand_atomic_compare_and_swap (&target, &oldval, mem, expect, desired, - is_weak, success, failure)) - return NULL_RTX; - -- if (oldval != expect) -- emit_move_insn (expect, oldval); -+ /* Conditionally store back to EXPECT, lest we create a race condition -+ with an improper store to memory. */ -+ /* ??? With a rearrangement of atomics at the gimple level, we can handle -+ the normal case where EXPECT is totally private, i.e. a register. At -+ which point the store can be unconditional. */ -+ label = gen_label_rtx (); -+ emit_cmp_and_jump_insns (target, const0_rtx, NE, NULL, VOIDmode, 1, label); -+ emit_move_insn (expect, oldval); -+ emit_label (label); - - return target; - } -@@ -5846,6 +5861,9 @@ - switch (fcode) - { - CASE_FLT_FN (BUILT_IN_FABS): -+ case BUILT_IN_FABSD32: -+ case BUILT_IN_FABSD64: -+ case BUILT_IN_FABSD128: - target = expand_builtin_fabs (exp, target, subtarget); - if (target) - return target; -@@ -10298,6 +10316,9 @@ - return fold_builtin_strlen (loc, type, arg0); - - CASE_FLT_FN (BUILT_IN_FABS): -+ case BUILT_IN_FABSD32: -+ case BUILT_IN_FABSD64: -+ case BUILT_IN_FABSD128: - return fold_builtin_fabs (loc, arg0, type); - - case BUILT_IN_ABS: -@@ -10766,7 +10787,7 @@ - return fold_builtin_strstr (loc, arg0, arg1, type); - - case BUILT_IN_STRCAT: -- return fold_builtin_strcat (loc, arg0, arg1); -+ return fold_builtin_strcat (loc, arg0, arg1, NULL_TREE); - - case BUILT_IN_STRSPN: - return fold_builtin_strspn (loc, arg0, arg1); -@@ -11809,8 +11830,9 @@ - COMPOUND_EXPR in the chain will contain the tree for the simplified - form of the builtin function call. */ - --static tree --fold_builtin_strcat (location_t loc ATTRIBUTE_UNUSED, tree dst, tree src) -+tree -+fold_builtin_strcat (location_t loc ATTRIBUTE_UNUSED, tree dst, tree src, -+ tree len) - { - if (!validate_arg (dst, POINTER_TYPE) - || !validate_arg (src, POINTER_TYPE)) -@@ -11828,22 +11850,17 @@ - /* See if we can store by pieces into (dst + strlen(dst)). */ - tree newdst, call; - tree strlen_fn = builtin_decl_implicit (BUILT_IN_STRLEN); -- tree strcpy_fn = builtin_decl_implicit (BUILT_IN_STRCPY); -+ tree memcpy_fn = builtin_decl_implicit (BUILT_IN_MEMCPY); - -- if (!strlen_fn || !strcpy_fn) -+ if (!strlen_fn || !memcpy_fn) - return NULL_TREE; - -- /* If we don't have a movstr we don't want to emit an strcpy -- call. We have to do that if the length of the source string -- isn't computable (in that case we can use memcpy probably -- later expanding to a sequence of mov instructions). If we -- have movstr instructions we can emit strcpy calls. */ -- if (!HAVE_movstr) -- { -- tree len = c_strlen (src, 1); -- if (! len || TREE_SIDE_EFFECTS (len)) -- return NULL_TREE; -- } -+ /* If the length of the source string isn't computable don't -+ split strcat into strlen and memcpy. */ -+ if (! len) -+ len = c_strlen (src, 1); -+ if (! len || TREE_SIDE_EFFECTS (len)) -+ return NULL_TREE; - - /* Stabilize the argument list. */ - dst = builtin_save_expr (dst); -@@ -11855,7 +11872,11 @@ - newdst = fold_build_pointer_plus_loc (loc, dst, newdst); - newdst = builtin_save_expr (newdst); - -- call = build_call_expr_loc (loc, strcpy_fn, 2, newdst, src); -+ len = fold_convert_loc (loc, size_type_node, len); -+ len = size_binop_loc (loc, PLUS_EXPR, len, -+ build_int_cst (size_type_node, 1)); -+ -+ call = build_call_expr_loc (loc, memcpy_fn, 3, newdst, src, len); - return build2 (COMPOUND_EXPR, TREE_TYPE (dst), call, dst); - } - return NULL_TREE; -Index: gcc/gcc.c -=================================================================== ---- a/src/gcc/gcc.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gcc.c (.../branches/gcc-4_8-branch) -@@ -5441,7 +5441,7 @@ - const char *save_suffix_subst; - - int save_growing_size; -- void *save_growing_value; -+ void *save_growing_value = NULL; - - sf = lookup_spec_function (func); - if (sf == NULL) -Index: gcc/fold-const.c -=================================================================== ---- a/src/gcc/fold-const.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fold-const.c (.../branches/gcc-4_8-branch) -@@ -2664,10 +2664,11 @@ - case COMPONENT_REF: - /* Handle operand 2 the same as for ARRAY_REF. Operand 0 - may be NULL when we're called to compare MEM_EXPRs. */ -- if (!OP_SAME_WITH_NULL (0)) -+ if (!OP_SAME_WITH_NULL (0) -+ || !OP_SAME (1)) - return 0; - flags &= ~OEP_CONSTANT_ADDRESS_OF; -- return OP_SAME (1) && OP_SAME_WITH_NULL (2); -+ return OP_SAME_WITH_NULL (2); - - case BIT_FIELD_REF: - if (!OP_SAME (0)) -@@ -4920,12 +4921,16 @@ - int in0_p, in1_p, in_p; - tree low0, low1, low, high0, high1, high; - bool strict_overflow_p = false; -- tree lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p); -- tree rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p); -- tree tem; -+ tree tem, lhs, rhs; - const char * const warnmsg = G_("assuming signed overflow does not occur " - "when simplifying range test"); - -+ if (!INTEGRAL_TYPE_P (type)) -+ return 0; -+ -+ lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p); -+ rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p); -+ - /* If this is an OR operation, invert both sides; we will invert - again at the end. */ - if (or_op) -@@ -10927,6 +10932,13 @@ - fold_build2_loc (loc, MULT_EXPR, type, - build_int_cst (type, 2) , arg1)); - -+ /* ((T) (X /[ex] C)) * C cancels out if the conversion is -+ sign-changing only. */ -+ if (TREE_CODE (arg1) == INTEGER_CST -+ && TREE_CODE (arg0) == EXACT_DIV_EXPR -+ && operand_equal_p (arg1, TREE_OPERAND (arg0, 1), 0)) -+ return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); -+ - strict_overflow_p = false; - if (TREE_CODE (arg1) == INTEGER_CST - && 0 != (tem = extract_muldiv (op0, arg1, code, NULL_TREE, -@@ -16587,7 +16599,7 @@ - unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; - tree index = bitsize_int (indexi); - -- if (offset/part_widthi <= TYPE_VECTOR_SUBPARTS (op00type)) -+ if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type)) - return fold_build3_loc (loc, - BIT_FIELD_REF, type, op00, - part_width, index); -Index: gcc/reorg.c -=================================================================== ---- a/src/gcc/reorg.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/reorg.c (.../branches/gcc-4_8-branch) -@@ -1105,6 +1105,7 @@ - int used_annul = 0; - int i; - struct resources cc_set; -+ bool *redundant; - - /* We can't do anything if there are more delay slots in SEQ than we - can handle, or if we don't know that it will be a taken branch. -@@ -1145,6 +1146,7 @@ - return delay_list; - #endif - -+ redundant = XALLOCAVEC (bool, XVECLEN (seq, 0)); - for (i = 1; i < XVECLEN (seq, 0); i++) - { - rtx trial = XVECEXP (seq, 0, i); -@@ -1166,7 +1168,8 @@ - - /* If this insn was already done (usually in a previous delay slot), - pretend we put it in our delay slot. */ -- if (redundant_insn (trial, insn, new_delay_list)) -+ redundant[i] = redundant_insn (trial, insn, new_delay_list); -+ if (redundant[i]) - continue; - - /* We will end up re-vectoring this branch, so compute flags -@@ -1199,6 +1202,12 @@ - return delay_list; - } - -+ /* Record the effect of the instructions that were redundant and which -+ we therefore decided not to copy. */ -+ for (i = 1; i < XVECLEN (seq, 0); i++) -+ if (redundant[i]) -+ update_block (XVECEXP (seq, 0, i), insn); -+ - /* Show the place to which we will be branching. */ - *pnew_thread = first_active_target_insn (JUMP_LABEL (XVECEXP (seq, 0, 0))); - -@@ -1262,6 +1271,7 @@ - /* If this insn was already done, we don't need it. */ - if (redundant_insn (trial, insn, delay_list)) - { -+ update_block (trial, insn); - delete_from_delay_slot (trial); - continue; - } -@@ -3266,6 +3276,7 @@ - to reprocess this insn. */ - if (redundant_insn (XVECEXP (pat, 0, 1), delay_insn, 0)) - { -+ update_block (XVECEXP (pat, 0, 1), insn); - delete_from_delay_slot (XVECEXP (pat, 0, 1)); - next = prev_active_insn (next); - continue; -@@ -3385,6 +3396,7 @@ - && redirect_with_delay_slots_safe_p (delay_insn, target_label, - insn)) - { -+ update_block (XVECEXP (PATTERN (trial), 0, 1), insn); - reorg_redirect_jump (delay_insn, target_label); - next = insn; - continue; -Index: gcc/tree-ssa-sccvn.c -=================================================================== ---- a/src/gcc/tree-ssa-sccvn.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-sccvn.c (.../branches/gcc-4_8-branch) -@@ -660,7 +660,7 @@ - } - - /* For non-calls, store the information that makes up the address. */ -- -+ tree orig = ref; - while (ref) - { - vn_reference_op_s temp; -@@ -711,7 +711,15 @@ - .arshift (BITS_PER_UNIT == 8 - ? 3 : exact_log2 (BITS_PER_UNIT), - HOST_BITS_PER_DOUBLE_INT); -- if (off.fits_shwi ()) -+ if (off.fits_shwi () -+ /* Probibit value-numbering zero offset components -+ of addresses the same before the pass folding -+ __builtin_object_size had a chance to run -+ (checking cfun->after_inlining does the -+ trick here). */ -+ && (TREE_CODE (orig) != ADDR_EXPR -+ || !off.is_zero () -+ || cfun->after_inlining)) - temp.off = off.low; - } - } +Index: gcc/omp-low.c +=================================================================== +--- a/src/gcc/omp-low.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/omp-low.c (.../branches/gcc-4_8-branch) +@@ -1586,7 +1586,6 @@ + TREE_STATIC (decl) = 1; + TREE_USED (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; +- DECL_NAMELESS (decl) = 1; + DECL_IGNORED_P (decl) = 0; + TREE_PUBLIC (decl) = 0; + DECL_UNINLINABLE (decl) = 1; Index: gcc/ChangeLog =================================================================== ---- a/src/gcc/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/gcc/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/gcc/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,4828 @@ -+2014-04-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ Backport from mainline r208895: -+ 2014-03-28 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (fusion_gpr_load_p): Refuse optimization -+ if it would clobber the stack pointer, even temporarily. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from main line: -+ 2014-04-01 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): -+ Document vec_vgbbd. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port mainline subversion id 209025. -+ 2014-04-02 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60735 -+ * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): If we have -+ software floating point or no floating point registers, do not -+ allow any type in the FPRs. Eliminate a test for SPE SIMD types -+ in GPRs that occurs after we tested for GPRs that would never be -+ true. -+ -+ * config/rs6000/rs6000.md (mov<mode>_softfloat32, FMOVE64): -+ Rewrite tests to use TARGET_DOUBLE_FLOAT and TARGET_E500_DOUBLE, -+ since the FMOVE64 type is DFmode/DDmode. If TARGET_E500_DOUBLE, -+ specifically allow DDmode, since that does not use the SPE SIMD -+ instructions. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r205308 -+ 2013-11-23 David Edelsohn <dje.gcc@gmail.com> -+ -+ * config/rs6000/rs6000.c (IN_NAMED_SECTION): New macro. -+ (rs6000_xcoff_select_section): Place decls with stricter alignment -+ into named sections. -+ (rs6000_xcoff_unique_section): Allow unique sections for -+ uninitialized data with strict alignment. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from trunk -+ 2013-04-25 Alan Modra <amodra@gmail.com> -+ -+ PR target/57052 -+ * config/rs6000/rs6000.md (rotlsi3_internal7): Rename to -+ rotlsi3_internal7le and condition on !BYTES_BIG_ENDIAN. -+ (rotlsi3_internal8be): New BYTES_BIG_ENDIAN insn. -+ Repeat for many other rotate/shift and mask patterns using subregs. -+ Name lshiftrt insns. -+ (ashrdisi3_noppc64): Rename to ashrdisi3_noppc64be and condition -+ on WORDS_BIG_ENDIAN. -+ -+ 2013-06-07 Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Don't -+ override user -mfp-in-toc. -+ (offsettable_ok_by_alignment): Consider just the current access -+ rather than the whole object, unless BLKmode. Handle -+ CONSTANT_POOL_ADDRESS_P constants that lack a decl too. -+ (use_toc_relative_ref): Allow CONSTANT_POOL_ADDRESS_P constants -+ for -mcmodel=medium. -+ * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Don't -+ override user -mfp-in-toc or -msum-in-toc. Default to -+ -mno-fp-in-toc for -mcmodel=medium. -+ -+ 2013-06-18 Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/rs6000.h (enum data_align): New. -+ (LOCAL_ALIGNMENT, DATA_ALIGNMENT): Use rs6000_data_alignment. -+ (DATA_ABI_ALIGNMENT): Define. -+ (CONSTANT_ALIGNMENT): Correct comment. -+ * config/rs6000/rs6000-protos.h (rs6000_data_alignment): Declare. -+ * config/rs6000/rs6000.c (rs6000_data_alignment): New function. -+ -+ 2013-07-11 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.md (""*tls_gd_low<TLSmode:tls_abi_suffix>"): -+ Require GOT register as additional operand in UNSPEC. -+ ("*tls_ld_low<TLSmode:tls_abi_suffix>"): Likewise. -+ ("*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"): Likewise. -+ ("*tls_got_tprel_low<TLSmode:tls_abi_suffix>"): Likewise. -+ ("*tls_gd<TLSmode:tls_abi_suffix>"): Update splitter. -+ ("*tls_ld<TLSmode:tls_abi_suffix>"): Likewise. -+ ("tls_got_dtprel_<TLSmode:tls_abi_suffix>"): Likewise. -+ ("tls_got_tprel_<TLSmode:tls_abi_suffix>"): Likewise. -+ -+ 2014-01-23 Pat Haugen <pthaugen@us.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Don't -+ force flag_ira_loop_pressure if set via command line. -+ -+ 2014-02-06 Alan Modra <amodra@gmail.com> -+ -+ PR target/60032 -+ * config/rs6000/rs6000.c (rs6000_secondary_memory_needed_mode): Only -+ change SDmode to DDmode when lra_in_progress. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ V1TImode Support -+ Back port from trunk -+ 2014-03-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (VEC_L): Add V1TI mode to vector types. -+ (VEC_M): Likewise. -+ (VEC_N): Likewise. -+ (VEC_R): Likewise. -+ (VEC_base): Likewise. -+ (mov<MODE>, VEC_M modes): If we are loading TImode into VSX -+ registers, we need to swap double words in little endian mode. -+ -+ * config/rs6000/rs6000-modes.def (V1TImode): Add new vector mode -+ to be a container mode for 128-bit integer operations added in ISA -+ 2.07. Unlike TImode and PTImode, the preferred register set is -+ the Altivec/VMX registers for the 128-bit operations. -+ -+ * config/rs6000/rs6000-protos.h (rs6000_move_128bit_ok_p): Add -+ declarations. -+ (rs6000_split_128bit_ok_p): Likewise. -+ -+ * config/rs6000/rs6000-builtin.def (BU_P8V_AV_3): Add new support -+ macros for creating ISA 2.07 normal and overloaded builtin -+ functions with 3 arguments. -+ (BU_P8V_OVERLOAD_3): Likewise. -+ (VPERM_1T): Add support for V1TImode in 128-bit vector operations -+ for use as overloaded functions. -+ (VPERM_1TI_UNS): Likewise. -+ (VSEL_1TI): Likewise. -+ (VSEL_1TI_UNS): Likewise. -+ (ST_INTERNAL_1ti): Likewise. -+ (LD_INTERNAL_1ti): Likewise. -+ (XXSEL_1TI): Likewise. -+ (XXSEL_1TI_UNS): Likewise. -+ (VPERM_1TI): Likewise. -+ (VPERM_1TI_UNS): Likewise. -+ (XXPERMDI_1TI): Likewise. -+ (SET_1TI): Likewise. -+ (LXVD2X_V1TI): Likewise. -+ (STXVD2X_V1TI): Likewise. -+ (VEC_INIT_V1TI): Likewise. -+ (VEC_SET_V1TI): Likewise. -+ (VEC_EXT_V1TI): Likewise. -+ (EQV_V1TI): Likewise. -+ (NAND_V1TI): Likewise. -+ (ORC_V1TI): Likewise. -+ (VADDCUQ): Add support for 128-bit integer arithmetic instructions -+ added in ISA 2.07. Add both normal 'altivec' builtins, and the -+ overloaded builtin. -+ (VADDUQM): Likewise. -+ (VSUBCUQ): Likewise. -+ (VADDEUQM): Likewise. -+ (VADDECUQ): Likewise. -+ (VSUBEUQM): Likewise. -+ (VSUBECUQ): Likewise. -+ -+ * config/rs6000/rs6000-c.c (__int128_type): New static to hold -+ __int128_t and __uint128_t types. -+ (__uint128_type): Likewise. -+ (altivec_categorize_keyword): Add support for vector __int128_t, -+ vector __uint128_t, vector __int128, and vector unsigned __int128 -+ as a container type for TImode operations that need to be done in -+ VSX/Altivec registers. -+ (rs6000_macro_to_expand): Likewise. -+ (altivec_overloaded_builtins): Add ISA 2.07 overloaded functions -+ to support 128-bit integer instructions vaddcuq, vadduqm, -+ vaddecuq, vaddeuqm, vsubcuq, vsubuqm, vsubecuq, vsubeuqm. -+ (altivec_resolve_overloaded_builtin): Add support for V1TImode. -+ -+ * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Add support -+ for V1TImode, and set up preferences to use VSX/Altivec -+ registers. Setup VSX reload handlers. -+ (rs6000_debug_reg_global): Likewise. -+ (rs6000_init_hard_regno_mode_ok): Likewise. -+ (rs6000_preferred_simd_mode): Likewise. -+ (vspltis_constant): Do not allow V1TImode as easy altivec -+ constants. -+ (easy_altivec_constant): Likewise. -+ (output_vec_const_move): Likewise. -+ (rs6000_expand_vector_set): Convert V1TImode set and extract to -+ simple move. -+ (rs6000_expand_vector_extract): Likewise. -+ (reg_offset_addressing_ok_p): Setup V1TImode to use VSX reg+reg -+ addressing. -+ (rs6000_const_vec): Add support for V1TImode. -+ (rs6000_emit_le_vsx_load): Swap double words when loading or -+ storing TImode/V1TImode. -+ (rs6000_emit_le_vsx_store): Likewise. -+ (rs6000_emit_le_vsx_move): Likewise. -+ (rs6000_emit_move): Add support for V1TImode. -+ (altivec_expand_ld_builtin): Likewise. -+ (altivec_expand_st_builtin): Likewise. -+ (altivec_expand_vec_init_builtin): Likewise. -+ (altivec_expand_builtin): Likewise. -+ (rs6000_init_builtins): Add support for V1TImode type. Add -+ support for ISA 2.07 128-bit integer builtins. Define type names -+ for the VSX/Altivec vector types. -+ (altivec_init_builtins): Add support for overloaded vector -+ functions with V1TImode type. -+ (rs6000_preferred_reload_class): Prefer Altivec registers for -+ V1TImode. -+ (rs6000_move_128bit_ok_p): Move 128-bit move/split validation to -+ external function. -+ (rs6000_split_128bit_ok_p): Likewise. -+ (rs6000_handle_altivec_attribute): Create V1TImode from vector -+ __int128_t and vector __uint128_t. -+ -+ * config/rs6000/vsx.md (VSX_L): Add V1TImode to vector iterators -+ and mode attributes. -+ (VSX_M): Likewise. -+ (VSX_M2): Likewise. -+ (VSm): Likewise. -+ (VSs): Likewise. -+ (VSr): Likewise. -+ (VSv): Likewise. -+ (VS_scalar): Likewise. -+ (VS_double): Likewise. -+ (vsx_set_v1ti): New builtin function to create V1TImode from -+ TImode. -+ -+ * config/rs6000/rs6000.h (TARGET_VADDUQM): New macro to say -+ whether we support the ISA 2.07 128-bit integer arithmetic -+ instructions. -+ (ALTIVEC_OR_VSX_VECTOR_MODE): Add V1TImode. -+ (enum rs6000_builtin_type_index): Add fields to hold V1TImode -+ and TImode types for use with the builtin functions. -+ (V1TI_type_node): Likewise. -+ (unsigned_V1TI_type_node): Likewise. -+ (intTI_type_internal_node): Likewise. -+ (uintTI_type_internal_node): Likewise. -+ -+ * config/rs6000/altivec.md (UNSPEC_VADDCUQ): New unspecs for ISA -+ 2.07 128-bit builtin functions. -+ (UNSPEC_VADDEUQM): Likewise. -+ (UNSPEC_VADDECUQ): Likewise. -+ (UNSPEC_VSUBCUQ): Likewise. -+ (UNSPEC_VSUBEUQM): Likewise. -+ (UNSPEC_VSUBECUQ): Likewise. -+ (VM): Add V1TImode to vector mode iterators. -+ (VM2): Likewise. -+ (VI_unit): Likewise. -+ (altivec_vadduqm): Add ISA 2.07 128-bit binary builtins. -+ (altivec_vaddcuq): Likewise. -+ (altivec_vsubuqm): Likewise. -+ (altivec_vsubcuq): Likewise. -+ (altivec_vaddeuqm): Likewise. -+ (altivec_vaddecuq): Likewise. -+ (altivec_vsubeuqm): Likewise. -+ (altivec_vsubecuq): Likewise. -+ -+ * config/rs6000/rs6000.md (FMOVE128_GPR): Add V1TImode to vector -+ mode iterators. -+ (BOOL_128): Likewise. -+ (BOOL_REGS_OUTPUT): Likewise. -+ (BOOL_REGS_OP1): Likewise. -+ (BOOL_REGS_OP2): Likewise. -+ (BOOL_REGS_UNARY): Likewise. -+ (BOOL_REGS_AND_CR0): Likewise. -+ -+ * config/rs6000/altivec.h (vec_vaddcuq): Add support for ISA 2.07 -+ 128-bit integer builtin support. -+ (vec_vadduqm): Likewise. -+ (vec_vaddecuq): Likewise. -+ (vec_vaddeuqm): Likewise. -+ (vec_vsubecuq): Likewise. -+ (vec_vsubeuqm): Likewise. -+ (vec_vsubcuq): Likewise. -+ (vec_vsubuqm): Likewise. -+ -+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): -+ Document vec_vaddcuq, vec_vadduqm, vec_vaddecuq, vec_vaddeuqm, -+ vec_subecuq, vec_subeuqm, vec_vsubcuq, vec_vsubeqm builtins adding -+ 128-bit integer add/subtract to ISA 2.07. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Apply mainline r207798 -+ 2014-02-26 Alan Modra <amodra@gmail.com> -+ PR target/58675 -+ PR target/57935 -+ * config/rs6000/rs6000.c (rs6000_secondary_reload_inner): Use -+ find_replacement on parts of insn rtl that might be reloaded. -+ -+ Backport from mainline r208287 -+ 2014-03-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_preferred_reload_class): Disallow -+ reload of PLUS rtx's outside of GENERAL_REGS or BASE_REGS; relax -+ constraint on constants to permit them being loaded into -+ GENERAL_REGS or BASE_REGS. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r207699. -+ 2014-02-11 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60137 -+ * config/rs6000/rs6000.md (128-bit GPR splitter): Add a splitter -+ for VSX/Altivec vectors that land in GPR registers. -+ -+ Backport from mainline r207808. -+ 2014-02-15 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60203 -+ * config/rs6000/rs6000.md (rreg): Add TFmode, TDmode constraints. -+ (mov<mode>_internal, TFmode/TDmode): Split TFmode/TDmode moves -+ into 64-bit and 32-bit moves. On 64-bit moves, add support for -+ using direct move instructions on ISA 2.07. Also adjust -+ instruction length for 64-bit. -+ (mov<mode>_64bit, TFmode/TDmode): Likewise. -+ (mov<mode>_32bit, TFmode/TDmode): Likewise. -+ -+ Backport from mainline r207868. -+ 2014-02-18 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60203 -+ * config/rs6000/rs6000.md (mov<mode>_64bit, TF/TDmode moves): -+ Split 64-bit moves into 2 patterns. Do not allow the use of -+ direct move for TDmode in little endian, since the decimal value -+ has little endian bytes within a word, but the 64-bit pieces are -+ ordered in a big endian fashion, and normal subreg's of TDmode are -+ not allowed. -+ (mov<mode>_64bit_dm): Likewise. -+ (movtd_64bit_nodm): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r207658 -+ 2014-02-06 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/sysv4.h (ENDIAN_SELECT): Do not attempt to enforce -+ big-endian mode for -mcall-aixdesc, -mcall-freebsd, -mcall-netbsd, -+ -mcall-openbsd, or -mcall-linux. -+ (CC1_ENDIAN_BIG_SPEC): Remove. -+ (CC1_ENDIAN_LITTLE_SPEC): Remove. -+ (CC1_ENDIAN_DEFAULT_SPEC): Remove. -+ (CC1_SPEC): Remove (always empty) %cc1_endian_... spec. -+ (SUBTARGET_EXTRA_SPECS): Remove %cc1_endian_big, %cc1_endian_little, -+ and %cc1_endian_default. -+ * config/rs6000/sysv4le.h (CC1_ENDIAN_DEFAULT_SPEC): Remove. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Little Endian Vector API Support -+ Backport from mainline r206443 -+ 2014-01-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Remove -+ two duplicate entries. -+ -+ Backport from mainline r206494 -+ 2014-01-09 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * doc/invoke.texi: Add -maltivec={be,le} options, and document -+ default element-order behavior for -maltivec. -+ * config/rs6000/rs6000.opt: Add -maltivec={be,le} options. -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Ensure -+ that -maltivec={le,be} implies -maltivec; disallow -maltivec=le -+ when targeting big endian, at least for now. -+ * config/rs6000/rs6000.h: Add #define of VECTOR_ELT_ORDER_BIG. -+ -+ Backport from mainline r206541 -+ 2014-01-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000-builtin.def: Fix pasto for VPKSDUS. -+ -+ Backport from mainline r206590 -+ 2014-01-13 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): -+ Implement -maltivec=be for vec_insert and vec_extract. -+ -+ Backport from mainline r206641 -+ 2014-01-15 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ -+ * config/rs6000/altivec.md (mulv8hi3): Explicitly generate vmulesh -+ and vmulosh rather than call gen_vec_widen_smult_*. -+ (vec_widen_umult_even_v16qi): Test VECTOR_ELT_ORDER_BIG rather -+ than BYTES_BIG_ENDIAN to determine use of even or odd instruction. -+ (vec_widen_smult_even_v16qi): Likewise. -+ (vec_widen_umult_even_v8hi): Likewise. -+ (vec_widen_smult_even_v8hi): Likewise. -+ (vec_widen_umult_odd_v16qi): Likewise. -+ (vec_widen_smult_odd_v16qi): Likewise. -+ (vec_widen_umult_odd_v8hi): Likewise. -+ (vec_widen_smult_odd_v8hi): Likewise. -+ (vec_widen_umult_hi_v16qi): Explicitly generate vmuleub and -+ vmuloub rather than call gen_vec_widen_umult_*. -+ (vec_widen_umult_lo_v16qi): Likewise. -+ (vec_widen_smult_hi_v16qi): Explicitly generate vmulesb and -+ vmulosb rather than call gen_vec_widen_smult_*. -+ (vec_widen_smult_lo_v16qi): Likewise. -+ (vec_widen_umult_hi_v8hi): Explicitly generate vmuleuh and vmulouh -+ rather than call gen_vec_widen_umult_*. -+ (vec_widen_umult_lo_v8hi): Likewise. -+ (vec_widen_smult_hi_v8hi): Explicitly gnerate vmulesh and vmulosh -+ rather than call gen_vec_widen_smult_*. -+ (vec_widen_smult_lo_v8hi): Likewise. -+ -+ Backport from mainline r207062 -+ 2014-01-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Remove -+ correction for little endian... -+ * config/rs6000/vsx.md (vsx_xxpermdi2_<mode>_1): ...and move it to -+ here. -+ -+ Backport from mainline r207262 -+ 2014-01-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Use -+ CODE_FOR_altivec_vmrg*_direct rather than CODE_FOR_altivec_vmrg*. -+ * config/rs6000/vsx.md (vsx_mergel_<mode>): Adjust for -+ -maltivec=be with LE targets. -+ (vsx_mergeh_<mode>): Likewise. -+ * config/rs6000/altivec.md (UNSPEC_VMRG[HL]_DIRECT): New -+ unspecs. -+ (mulv8hi3): Use gen_altivec_vmrg[hl]w_direct. -+ (altivec_vmrghb): Replace with define_expand and new -+ *altivec_vmrghb_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrghb_direct): New define_insn. -+ (altivec_vmrghh): Replace with define_expand and new -+ *altivec_vmrghh_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrghh_direct): New define_insn. -+ (altivec_vmrghw): Replace with define_expand and new -+ *altivec_vmrghw_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrghw_direct): New define_insn. -+ (*altivec_vmrghsf): Adjust for endianness. -+ (altivec_vmrglb): Replace with define_expand and new -+ *altivec_vmrglb_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrglb_direct): New define_insn. -+ (altivec_vmrglh): Replace with define_expand and new -+ *altivec_vmrglh_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrglh_direct): New define_insn. -+ (altivec_vmrglw): Replace with define_expand and new -+ *altivec_vmrglw_internal insn; adjust for -maltivec=be with LE -+ targets. -+ (altivec_vmrglw_direct): New define_insn. -+ (*altivec_vmrglsf): Adjust for endianness. -+ (vec_widen_umult_hi_v16qi): Use gen_altivec_vmrghh_direct. -+ (vec_widen_umult_lo_v16qi): Use gen_altivec_vmrglh_direct. -+ (vec_widen_smult_hi_v16qi): Use gen_altivec_vmrghh_direct. -+ (vec_widen_smult_lo_v16qi): Use gen_altivec_vmrglh_direct. -+ (vec_widen_umult_hi_v8hi): Use gen_altivec_vmrghw_direct. -+ (vec_widen_umult_lo_v8hi): Use gen_altivec_vmrglw_direct. -+ (vec_widen_smult_hi_v8hi): Use gen_altivec_vmrghw_direct. -+ (vec_widen_smult_lo_v8hi): Use gen_altivec_vmrglw_direct. -+ -+ Backport from mainline r207318 -+ 2014-01-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc/config/rs6000/rs6000.c (rs6000_expand_vector_init): Use -+ gen_vsx_xxspltw_v4sf_direct instead of gen_vsx_xxspltw_v4sf; -+ remove element index adjustment for endian (now handled in vsx.md -+ and altivec.md). -+ (altivec_expand_vec_perm_const): Use -+ gen_altivec_vsplt[bhw]_direct instead of gen_altivec_vsplt[bhw]. -+ * gcc/config/rs6000/vsx.md (UNSPEC_VSX_XXSPLTW): New unspec. -+ (vsx_xxspltw_<mode>): Adjust element index for little endian. -+ * gcc/config/rs6000/altivec.md (altivec_vspltb): Divide into a -+ define_expand and a new define_insn *altivec_vspltb_internal; -+ adjust for -maltivec=be on a little endian target. -+ (altivec_vspltb_direct): New. -+ (altivec_vsplth): Divide into a define_expand and a new -+ define_insn *altivec_vsplth_internal; adjust for -maltivec=be on a -+ little endian target. -+ (altivec_vsplth_direct): New. -+ (altivec_vspltw): Divide into a define_expand and a new -+ define_insn *altivec_vspltw_internal; adjust for -maltivec=be on a -+ little endian target. -+ (altivec_vspltw_direct): New. -+ (altivec_vspltsf): Divide into a define_expand and a new -+ define_insn *altivec_vspltsf_internal; adjust for -maltivec=be on -+ a little endian target. -+ -+ Backport from mainline r207326 -+ 2014-01-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Remove -+ unused variable "field". -+ * config/rs6000/vsx.md (vsx_mergel_<mode>): Add missing DONE. -+ (vsx_mergeh_<mode>): Likewise. -+ * config/rs6000/altivec.md (altivec_vmrghb): Likewise. -+ (altivec_vmrghh): Likewise. -+ (altivec_vmrghw): Likewise. -+ (altivec_vmrglb): Likewise. -+ (altivec_vmrglh): Likewise. -+ (altivec_vmrglw): Likewise. -+ (altivec_vspltb): Add missing uses. -+ (altivec_vsplth): Likewise. -+ (altivec_vspltw): Likewise. -+ (altivec_vspltsf): Likewise. -+ -+ Backport from mainline r207414 -+ 2014-02-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (UNSPEC_VSUMSWS_DIRECT): New unspec. -+ (altivec_vsumsws): Add handling for -maltivec=be with a little -+ endian target. -+ (altivec_vsumsws_direct): New. -+ (reduc_splus_<mode>): Call gen_altivec_vsumsws_direct instead of -+ gen_altivec_vsumsws. -+ -+ Backport from mainline r207415 -+ 2014-02-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_le): Generalize -+ for vector types other than V16QImode. -+ * config/rs6000/altivec.md (altivec_vperm_<mode>): Change to a -+ define_expand, and call altivec_expand_vec_perm_le when producing -+ code with little endian element order. -+ (*altivec_vperm_<mode>_internal): New insn having previous -+ behavior of altivec_vperm_<mode>. -+ (altivec_vperm_<mode>_uns): Change to a define_expand, and call -+ altivec_expand_vec_perm_le when producing code with little endian -+ element order. -+ (*altivec_vperm_<mode>_uns_internal): New insn having previous -+ behavior of altivec_vperm_<mode>_uns. -+ -+ Backport from mainline r207520 -+ 2014-02-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * altivec.md (UNSPEC_VPACK_UNS_UNS_MOD_DIRECT): New unspec. -+ (UNSPEC_VUNPACK_HI_SIGN_DIRECT): Likewise. -+ (UNSPEC_VUNPACK_LO_SIGN_DIRECT): Likewise. -+ (mulv8hi3): Use gen_altivec_vpkuwum_direct instead of -+ gen_altivec_vpkuwum. -+ (altivec_vpkpx): Test for VECTOR_ELT_ORDER_BIG instead of for -+ BYTES_BIG_ENDIAN. -+ (altivec_vpks<VI_char>ss): Likewise. -+ (altivec_vpks<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>um): Likewise. -+ (altivec_vpku<VI_char>um_direct): New (copy of -+ altivec_vpku<VI_char>um that still relies on BYTES_BIG_ENDIAN, for -+ internal use). -+ (altivec_vupkhs<VU_char>): Emit vupkls* instead of vupkhs* when -+ target is little endian and -maltivec=be is not specified. -+ (*altivec_vupkhs<VU_char>_direct): New (copy of -+ altivec_vupkhs<VU_char> that always emits vupkhs*, for internal -+ use). -+ (altivec_vupkls<VU_char>): Emit vupkhs* instead of vupkls* when -+ target is little endian and -maltivec=be is not specified. -+ (*altivec_vupkls<VU_char>_direct): New (copy of -+ altivec_vupkls<VU_char> that always emits vupkls*, for internal -+ use). -+ (altivec_vupkhpx): Emit vupklpx instead of vupkhpx when target is -+ little endian and -maltivec=be is not specified. -+ (altivec_vupklpx): Emit vupkhpx instead of vupklpx when target is -+ little endian and -maltivec=be is not specified. -+ -+ Backport from mainline r207521 -+ 2014-02-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (altivec_vsum2sws): Adjust code -+ generation for -maltivec=be. -+ (altivec_vsumsws): Simplify redundant test. -+ -+ Backport from mainline r207525 -+ 2014-02-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Change -+ CODE_FOR_altivec_vpku[hw]um to -+ CODE_FOR_altivec_vpku[hw]um_direct. -+ * config/rs6000/altivec.md (vec_unpacks_hi_<VP_small_lc>): Change -+ UNSPEC_VUNPACK_HI_SIGN to UNSPEC_VUNPACK_HI_SIGN_DIRECT. -+ (vec_unpacks_lo_<VP_small_lc>): Change UNSPEC_VUNPACK_LO_SIGN to -+ UNSPEC_VUNPACK_LO_SIGN_DIRECT. -+ -+ Backport from mainline r207814. -+ 2014-02-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vsx.md (vsx_xxpermdi_<mode>): Handle little -+ endian targets. -+ -+ Backport from mainline r207815. -+ 2014-02-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (p8_vmrgew): Handle little endian -+ targets. -+ (p8_vmrgow): Likewise. -+ -+ Backport from mainline r207919. -+ 2014-02-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (vspltis_constant): Fix most significant -+ bit of zero. -+ -+ Backport from mainline 208019 -+ 2014-02-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (altivec_lvxl): Rename as -+ *altivec_lvxl_<mode>_internal and use VM2 iterator instead of -+ V4SI. -+ (altivec_lvxl_<mode>): New define_expand incorporating -+ -maltivec=be semantics where needed. -+ (altivec_lvx): Rename as *altivec_lvx_<mode>_internal. -+ (altivec_lvx_<mode>): New define_expand incorporating -maltivec=be -+ semantics where needed. -+ (altivec_stvx): Rename as *altivec_stvx_<mode>_internal. -+ (altivec_stvx_<mode>): New define_expand incorporating -+ -maltivec=be semantics where needed. -+ (altivec_stvxl): Rename as *altivec_stvxl_<mode>_internal and use -+ VM2 iterator instead of V4SI. -+ (altivec_stvxl_<mode>): New define_expand incorporating -+ -maltivec=be semantics where needed. -+ * config/rs6000/rs6000-builtin.def: Add new built-in definitions -+ LVXL_V2DF, LVXL_V2DI, LVXL_V4SF, LVXL_V4SI, LVXL_V8HI, LVXL_V16QI, -+ LVX_V2DF, LVX_V2DI, LVX_V4SF, LVX_V4SI, LVX_V8HI, LVX_V16QI, -+ STVX_V2DF, STVX_V2DI, STVX_V4SF, STVX_V4SI, STVX_V8HI, STVX_V16QI, -+ STVXL_V2DF, STVXL_V2DI, STVXL_V4SF, STVXL_V4SI, STVXL_V8HI, -+ STVXL_V16QI. -+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Replace -+ ALTIVEC_BUILTIN_LVX with ALTIVEC_BUILTIN_LVX_<MODE> throughout; -+ similarly for ALTIVEC_BUILTIN_LVXL, ALTIVEC_BUILTIN_STVX, and -+ ALTIVEC_BUILTIN_STVXL. -+ * config/rs6000/rs6000-protos.h (altivec_expand_lvx_be): New -+ prototype. -+ (altivec_expand_stvx_be): Likewise. -+ * config/rs6000/rs6000.c (swap_selector_for_mode): New function. -+ (altivec_expand_lvx_be): Likewise. -+ (altivec_expand_stvx_be): Likewise. -+ (altivec_expand_builtin): Add cases for -+ ALTIVEC_BUILTIN_STVX_<MODE>, ALTIVEC_BUILTIN_STVXL_<MODE>, -+ ALTIVEC_BUILTIN_LVXL_<MODE>, and ALTIVEC_BUILTIN_LVX_<MODE>. -+ (altivec_init_builtins): Add definitions for -+ __builtin_altivec_lvxl_<mode>, __builtin_altivec_lvx_<mode>, -+ __builtin_altivec_stvx_<mode>, and -+ __builtin_altivec_stvxl_<mode>. -+ -+ Backport from mainline 208021 -+ 2014-02-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (altivec_vsumsws): Replace second -+ vspltw with vsldoi. -+ (reduc_uplus_v16qi): Use gen_altivec_vsumsws_direct instead of -+ gen_altivec_vsumsws. -+ -+ Backport from mainline 208049 -+ 2014-02-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (altivec_lve<VI_char>x): Replace -+ define_insn with define_expand and new define_insn -+ *altivec_lve<VI_char>x_internal. -+ (altivec_stve<VI_char>x): Replace define_insn with define_expand -+ and new define_insn *altivec_stve<VI_char>x_internal. -+ * config/rs6000/rs6000-protos.h (altivec_expand_stvex_be): New -+ prototype. -+ * config/rs6000/rs6000.c (altivec_expand_lvx_be): Document use by -+ lve*x built-ins. -+ (altivec_expand_stvex_be): New function. -+ -+ Backport from mainline -+ 2014-02-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ * config/rs6000/rs6000.c (rs6000_emit_le_vsx_move): Relax assert -+ to permit subregs. -+ -+ Backport from mainline -+ 2014-02-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ * config/rs6000/vector.md (*vector_unordered<mode>): Change split -+ to use canonical form for nor<mode>3. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2014-02-04 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.opt (-mlra): Add switch to enable the LRA -+ register allocator. -+ -+ * config/rs6000/rs6000.c (TARGET_LRA_P): Add support for -mlra to -+ enable the LRA register allocator. Back port the changes from the -+ trunk to enable LRA. -+ (rs6000_legitimate_offset_address_p): Likewise. -+ (legitimate_lo_sum_address_p): Likewise. -+ (use_toc_relative_ref): Likewise. -+ (rs6000_legitimate_address_p): Likewise. -+ (rs6000_emit_move): Likewise. -+ (rs6000_secondary_memory_needed_mode): Likewise. -+ (rs6000_alloc_sdmode_stack_slot): Likewise. -+ (rs6000_lra_p): Likewise. -+ -+ * config/rs6000/sync.md (load_lockedti): Copy TI/PTI variables by -+ 64-bit parts to force the register allocator to allocate even/odd -+ register pairs for the quad word atomic instructions. -+ (store_conditionalti): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from mainline -+ 2014-01-23 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59909 -+ * doc/invoke.texi (RS/6000 and PowerPC Options): Document -+ -mquad-memory-atomic. Update -mquad-memory documentation to say -+ it is only used for non-atomic loads/stores. -+ -+ * config/rs6000/predicates.md (quad_int_reg_operand): Allow either -+ -mquad-memory or -mquad-memory-atomic switches. -+ -+ * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Add -+ -mquad-memory-atomic to ISA 2.07 support. -+ -+ * config/rs6000/rs6000.opt (-mquad-memory-atomic): Add new switch -+ to separate support of normal quad word memory operations (ldq, -+ stq) from the atomic quad word memory operations. -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Add -+ support to separate non-atomic quad word operations from atomic -+ quad word operations. Disable non-atomic quad word operations in -+ little endian mode so that we don't have to swap words after the -+ load and before the store. -+ (quad_load_store_p): Add comment about atomic quad word support. -+ (rs6000_opt_masks): Add -mquad-memory-atomic to the list of -+ options printed with -mdebug=reg. -+ -+ * config/rs6000/rs6000.h (TARGET_SYNC_TI): Use -+ -mquad-memory-atomic as the test for whether we have quad word -+ atomic instructions. -+ (TARGET_SYNC_HI_QI): If either -mquad-memory-atomic, -+ -mquad-memory, or -mp8-vector are used, allow byte/half-word -+ atomic operations. -+ -+ * config/rs6000/sync.md (load_lockedti): Insure that the address -+ is a proper indexed or indirect address for the lqarx instruction. -+ On little endian systems, swap the hi/lo registers after the lqarx -+ instruction. -+ (load_lockedpti): Use indexed_or_indirect_operand predicate to -+ insure the address is valid for the lqarx instruction. -+ (store_conditionalti): Insure that the address is a proper indexed -+ or indirect address for the stqcrx. instruction. On little endian -+ systems, swap the hi/lo registers before doing the stqcrx. -+ instruction. -+ (store_conditionalpti): Use indexed_or_indirect_operand predicate to -+ insure the address is valid for the stqcrx. instruction. -+ -+ * gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros): -+ Define __QUAD_MEMORY__ and __QUAD_MEMORY_ATOMIC__ based on what -+ type of quad memory support is available. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Apply mainline r202190, powerpc64le multilibs and multiarch dir -+ 2013-09-03 Alan Modra <amodra@gmail.com> -+ -+ * config.gcc (powerpc*-*-linux*): Add support for little-endian -+ multilibs to big-endian target and vice versa. -+ * config/rs6000/t-linux64: Use := assignment on all vars. -+ (MULTILIB_EXTRA_OPTS): Remove fPIC. -+ (MULTILIB_OSDIRNAMES): Specify using mapping from multilib_options. -+ * config/rs6000/t-linux64le: New file. -+ * config/rs6000/t-linux64bele: New file. -+ * config/rs6000/t-linux64lebe: New file. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from mainline -+ 2014-01-16 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59844 -+ * config/rs6000/rs6000.md (reload_vsx_from_gprsf): Add little -+ endian support, remove tests for WORDS_BIG_ENDIAN. -+ (p8_mfvsrd_3_<mode>): Likewise. -+ (reload_gpr_from_vsx<mode>): Likewise. -+ (reload_gpr_from_vsxsf): Likewise. -+ (p8_mfvsrd_4_disf): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ PR target/56843 -+ * config/rs6000/rs6000.c (rs6000_emit_swdiv_high_precision): Remove. -+ (rs6000_emit_swdiv_low_precision): Remove. -+ (rs6000_emit_swdiv): Rewrite to handle between one and four -+ iterations of Newton-Raphson generally; modify required number of -+ iterations for some cases. -+ * config/rs6000/rs6000.h (RS6000_RECIP_HIGH_PRECISION_P): Remove. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com> -+ Jakub Jelinek <jakub@redhat.com> -+ -+ * builtins.def (BUILT_IN_FABSD32): New DFP ABS builtin. -+ (BUILT_IN_FABSD64): Likewise. -+ (BUILT_IN_FABSD128): Likewise. -+ * builtins.c (expand_builtin): Add support for -+ new DFP ABS builtins. -+ (fold_builtin_1): Likewise. -+ * config/rs6000/dfp.md -+ (*abstd2_fpr): Handle non-overlapping destination -+ and source operands. -+ (*nabstd2_fpr): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Apply mainline r205060. -+ 2013-11-20 Alan Modra <amodra@gmail.com> -+ * config/rs6000/sysv4.h (CC1_ENDIAN_LITTLE_SPEC): Define as empty. -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Default -+ to strict alignment on older processors when little-endian. -+ * config/rs6000/linux64.h (PROCESSOR_DEFAULT64): Default to power8 -+ for ELFv2. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ POWER ELFv2 ABI Support -+ Backport from mainline r204842: -+ -+ 2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * doc/invoke.texi (-mabi=elfv1, -mabi=elfv2): Document. -+ -+ Backport from mainline r204809: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/sysv4le.h (LINUX64_DEFAULT_ABI_ELFv2): Define. -+ -+ Backport from mainline r204808: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/rs6000.h (RS6000_SAVE_AREA): Handle ABI_ELFv2. -+ (RS6000_SAVE_TOC): Remove. -+ (RS6000_TOC_SAVE_SLOT): New macro. -+ * config/rs6000/rs6000.c (rs6000_parm_offset): New function. -+ (rs6000_parm_start): Use it. -+ (rs6000_function_arg_advance_1): Likewise. -+ (rs6000_emit_prologue): Use RS6000_TOC_SAVE_SLOT. -+ (rs6000_emit_epilogue): Likewise. -+ (rs6000_call_aix): Likewise. -+ (rs6000_output_function_prologue): Do not save/restore r11 -+ around calling _mcount for ABI_ELFv2. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * config/rs6000/rs6000-protos.h (rs6000_reg_parm_stack_space): -+ Add prototype. -+ * config/rs6000/rs6000.h (RS6000_REG_SAVE): Remove. -+ (REG_PARM_STACK_SPACE): Call rs6000_reg_parm_stack_space. -+ * config/rs6000/rs6000.c (rs6000_parm_needs_stack): New function. -+ (rs6000_function_parms_need_stack): Likewise. -+ (rs6000_reg_parm_stack_space): Likewise. -+ (rs6000_function_arg): Do not replace BLKmode by Pmode when -+ returning a register argument. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Michael Gschwind <mkg@us.ibm.com> -+ -+ * config/rs6000/rs6000.h (FP_ARG_MAX_RETURN): New macro. -+ (ALTIVEC_ARG_MAX_RETURN): Likewise. -+ (FUNCTION_VALUE_REGNO_P): Use them. -+ * config/rs6000/rs6000.c (TARGET_RETURN_IN_MSB): Define. -+ (rs6000_return_in_msb): New function. -+ (rs6000_return_in_memory): Handle ELFv2 homogeneous aggregates. -+ Handle aggregates of up to 16 bytes for ELFv2. -+ (rs6000_function_value): Handle ELFv2 homogeneous aggregates. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Michael Gschwind <mkg@us.ibm.com> -+ -+ * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define. -+ * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function. -+ (rs6000_discover_homogeneous_aggregate): Likewise. -+ (rs6000_function_arg_boundary): Handle homogeneous aggregates. -+ (rs6000_function_arg_advance_1): Likewise. -+ (rs6000_function_arg): Likewise. -+ (rs6000_arg_partial_bytes): Likewise. -+ (rs6000_psave_function_arg): Handle BLKmode arguments. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Michael Gschwind <mkg@us.ibm.com> -+ -+ * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define. -+ * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function. -+ (rs6000_discover_homogeneous_aggregate): Likewise. -+ (rs6000_function_arg_boundary): Handle homogeneous aggregates. -+ (rs6000_function_arg_advance_1): Likewise. -+ (rs6000_function_arg): Likewise. -+ (rs6000_arg_partial_bytes): Likewise. -+ (rs6000_psave_function_arg): Handle BLKmode arguments. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (machine_function): New member -+ r2_setup_needed. -+ (rs6000_emit_prologue): Set r2_setup_needed if necessary. -+ (rs6000_output_mi_thunk): Set r2_setup_needed. -+ (rs6000_output_function_prologue): Output global entry point -+ prologue and local entry point marker if needed for ABI_ELFv2. -+ Output -mprofile-kernel code here. -+ (output_function_profiler): Do not output -mprofile-kernel -+ code here; moved to rs6000_output_function_prologue. -+ (rs6000_file_start): Output ".abiversion 2" for ABI_ELFv2. -+ -+ (rs6000_emit_move): Do not handle dot symbols for ABI_ELFv2. -+ (rs6000_output_function_entry): Likewise. -+ (rs6000_assemble_integer): Likewise. -+ (rs6000_elf_encode_section_info): Likewise. -+ (rs6000_elf_declare_function_name): Do not create dot symbols -+ or .opd section for ABI_ELFv2. -+ -+ (rs6000_trampoline_size): Update for ABI_ELFv2 trampolines. -+ (rs6000_trampoline_init): Likewise. -+ (rs6000_elf_file_end): Call file_end_indicate_exec_stack -+ for ABI_ELFv2. -+ -+ (rs6000_call_aix): Handle ELFv2 indirect calls. Do not check -+ for function descriptors in ABI_ELFv2. -+ -+ * config/rs6000/rs6000.md ("*call_indirect_aix<mode>"): Support -+ on ABI_AIX only, not ABI_ELFv2. -+ ("*call_value_indirect_aix<mode>"): Likewise. -+ ("*call_indirect_elfv2<mode>"): New pattern. -+ ("*call_value_indirect_elfv2<mode>"): Likewise. -+ -+ * config/rs6000/predicates.md ("symbol_ref_operand"): Do not -+ check for function descriptors in ABI_ELFv2. -+ ("current_file_function_operand"): Likewise. -+ -+ * config/rs6000/ppc-asm.h [__powerpc64__ && _CALL_ELF == 2]: -+ (toc): Undefine. -+ (FUNC_NAME): Define ELFv2 variant. -+ (JUMP_TARGET): Likewise. -+ (FUNC_START): Likewise. -+ (HIDDEN_FUNC): Likewise. -+ (FUNC_END): Likeiwse. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config.gcc [powerpc*-*-* | rs6000-*-*]: Support --with-abi=elfv1 -+ and --with-abi=elfv2. -+ * config/rs6000/option-defaults.h (OPTION_DEFAULT_SPECS): Add "abi". -+ * config/rs6000/rs6000.opt (mabi=elfv1): New option. -+ (mabi=elfv2): Likewise. -+ * config/rs6000/rs6000-opts.h (enum rs6000_abi): Add ABI_ELFv2. -+ * config/rs6000/linux64.h (DEFAULT_ABI): Do not hard-code to AIX_ABI -+ if !RS6000_BI_ARCH. -+ (ELFv2_ABI_CHECK): New macro. -+ (SUBSUBTARGET_OVERRIDE_OPTIONS): Use it to decide whether to set -+ rs6000_current_abi to ABI_AIX or ABI_ELFv2. -+ (GLIBC_DYNAMIC_LINKER64): Support ELFv2 ld.so version. -+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine -+ _CALL_ELF and __STRUCT_PARM_ALIGN__ if appropriate. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Handle ABI_ELFv2. -+ (debug_stack_info): Likewise. -+ (rs6000_file_start): Treat ABI_ELFv2 the same as ABI_AIX. -+ (rs6000_legitimize_tls_address): Likewise. -+ (rs6000_conditional_register_usage): Likewise. -+ (rs6000_emit_move): Likewise. -+ (init_cumulative_args): Likewise. -+ (rs6000_function_arg_advance_1): Likewise. -+ (rs6000_function_arg): Likewise. -+ (rs6000_arg_partial_bytes): Likewise. -+ (rs6000_output_function_entry): Likewise. -+ (rs6000_assemble_integer): Likewise. -+ (rs6000_savres_strategy): Likewise. -+ (rs6000_stack_info): Likewise. -+ (rs6000_function_ok_for_sibcall): Likewise. -+ (rs6000_emit_load_toc_table): Likewise. -+ (rs6000_savres_routine_name): Likewise. -+ (ptr_regno_for_savres): Likewise. -+ (rs6000_emit_prologue): Likewise. -+ (rs6000_emit_epilogue): Likewise. -+ (rs6000_output_function_epilogue): Likewise. -+ (output_profile_hook): Likewise. -+ (output_function_profiler): Likewise. -+ (rs6000_trampoline_size): Likewise. -+ (rs6000_trampoline_init): Likewise. -+ (rs6000_elf_output_toc_section_asm_op): Likewise. -+ (rs6000_elf_encode_section_info): Likewise. -+ (rs6000_elf_reloc_rw_mask): Likewise. -+ (rs6000_elf_declare_function_name): Likewise. -+ (rs6000_function_arg_boundary): Treat ABI_ELFv2 the same as ABI_AIX, -+ except that rs6000_compat_align_parm is always assumed false. -+ (rs6000_gimplify_va_arg): Likewise. -+ (rs6000_call_aix): Update comment. -+ (rs6000_sibcall_aix): Likewise. -+ * config/rs6000/rs6000.md ("tls_gd_aix<TLSmode:tls_abi_suffix>"): -+ Treat ABI_ELFv2 the same as ABI_AIX. -+ ("*tls_gd_call_aix<TLSmode:tls_abi_suffix>"): Likewise. -+ ("tls_ld_aix<TLSmode:tls_abi_suffix>"): Likewise. -+ ("*tls_ld_call_aix<TLSmode:tls_abi_suffix>"): Likewise. -+ ("load_toc_aix_si"): Likewise. -+ ("load_toc_aix_di"): Likewise. -+ ("call"): Likewise. -+ ("call_value"): Likewise. -+ ("*call_local_aix<mode>"): Likewise. -+ ("*call_value_local_aix<mode>"): Likewise. -+ ("*call_nonlocal_aix<mode>"): Likewise. -+ ("*call_value_nonlocal_aix<mode>"): Likewise. -+ ("*call_indirect_aix<mode>"): Likewise. -+ ("*call_value_indirect_aix<mode>"): Likewise. -+ ("sibcall"): Likewise. -+ ("sibcall_value"): Likewise. -+ ("*sibcall_aix<mode>"): Likewise. -+ ("*sibcall_value_aix<mode>"): Likewise. -+ * config/rs6000/predicates.md ("symbol_ref_operand"): Likewise. -+ ("current_file_function_operand"): Likewise. -+ -+ Backport from mainline r204807: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Simplify logic -+ by making use of the fact that for vector / floating point arguments -+ passed both in VRs/FPRs and in the fixed parameter area, the partial -+ bytes mechanism is in fact not used. -+ -+ Backport from mainline r204806: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_psave_function_arg): New function. -+ (rs6000_finish_function_arg): Likewise. -+ (rs6000_function_arg): Use rs6000_psave_function_arg and -+ rs6000_finish_function_arg to handle both vector and floating -+ point arguments that are also passed in GPRs / the stack. -+ -+ Backport from mainline r204805: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (USE_FP_FOR_ARG_P): Remove TYPE argument. -+ (USE_ALTIVEC_FOR_ARG_P): Likewise. -+ (rs6000_darwin64_record_arg_advance_recurse): Update uses. -+ (rs6000_function_arg_advance_1):Likewise. -+ (rs6000_darwin64_record_arg_recurse): Likewise. -+ (rs6000_function_arg): Likewise. -+ (rs6000_arg_partial_bytes): Likewise. -+ -+ Backport from mainline r204804: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Replace -+ "DEFAULT_ABI != ABI_AIX" test by testing for ABI_V4 or ABI_DARWIN. -+ (rs6000_savres_strategy): Likewise. -+ (rs6000_return_addr): Likewise. -+ (rs6000_emit_load_toc_table): Replace "DEFAULT_ABI != ABI_AIX" by -+ testing for ABI_V4 (since ABI_DARWIN is impossible here). -+ (rs6000_emit_prologue): Likewise. -+ (legitimate_lo_sum_address_p): Simplify DEFAULT_ABI test. -+ (rs6000_elf_declare_function_name): Remove duplicated test. -+ * config/rs6000/rs6000.md ("load_toc_v4_PIC_1"): Explicitly test -+ for ABI_V4 (instead of "DEFAULT_ABI != ABI_AIX" test). -+ ("load_toc_v4_PIC_1_normal"): Likewise. -+ ("load_toc_v4_PIC_1_476"): Likewise. -+ ("load_toc_v4_PIC_1b"): Likewise. -+ ("load_toc_v4_PIC_1b_normal"): Likewise. -+ ("load_toc_v4_PIC_1b_476"): Likewise. -+ ("load_toc_v4_PIC_2"): Likewise. -+ ("load_toc_v4_PIC_3b"): Likewise. -+ ("load_toc_v4_PIC_3c"): Likewise. -+ * config/rs6000/rs6000.h (RS6000_REG_SAVE): Simplify DEFAULT_ABI test. -+ (RS6000_SAVE_AREA): Likewise. -+ (FP_ARG_MAX_REG): Likewise. -+ (RETURN_ADDRESS_OFFSET): Likewise. -+ * config/rs6000/sysv.h (TARGET_TOC): Test for ABI_V4 instead -+ of ABI_AIX. -+ (SUBTARGET_OVERRIDE_OPTIONS): Likewise. -+ (MINIMAL_TOC_SECTION_ASM_OP): Likewise. -+ -+ Backport from mainline r204803: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_call_indirect_aix): Rename to ... -+ (rs6000_call_aix): ... this. Handle both direct and indirect calls. -+ Create call insn directly instead of via various gen_... routines. -+ Mention special registers used by the call in CALL_INSN_FUNCTION_USAGE. -+ (rs6000_sibcall_aix): New function. -+ * config/rs6000/rs6000.md (TOC_SAVE_OFFSET_32BIT): Remove. -+ (TOC_SAVE_OFFSET_64BIT): Likewise. -+ (AIX_FUNC_DESC_TOC_32BIT): Likewise. -+ (AIX_FUNC_DESC_TOC_64BIT): Likewise. -+ (AIX_FUNC_DESC_SC_32BIT): Likewise. -+ (AIX_FUNC_DESC_SC_64BIT): Likewise. -+ ("call" expander): Call rs6000_call_aix. -+ ("call_value" expander): Likewise. -+ ("call_indirect_aix<ptrsize>"): Replace this pattern ... -+ ("call_indirect_aix<ptrsize>_nor11"): ... and this pattern ... -+ ("*call_indirect_aix<mode>"): ... by this insn pattern. -+ ("call_value_indirect_aix<ptrsize>"): Replace this pattern ... -+ ("call_value_indirect_aix<ptrsize>_nor11"): ... and this pattern ... -+ ("*call_value_indirect_aix<mode>"): ... by this insn pattern. -+ ("*call_nonlocal_aix32", "*call_nonlocal_aix64"): Replace by ... -+ ("*call_nonlocal_aix<mode>"): ... this pattern. -+ ("*call_value_nonlocal_aix32", "*call_value_nonlocal_aix64"): Replace -+ ("*call_value_nonlocal_aix<mode>"): ... by this pattern. -+ ("*call_local_aix<mode>"): New insn pattern. -+ ("*call_value_local_aix<mode>"): Likewise. -+ ("sibcall" expander): Call rs6000_sibcall_aix. -+ ("sibcall_value" expander): Likewise. Move earlier in file. -+ ("*sibcall_nonlocal_aix<mode>"): Replace by ... -+ ("*sibcall_aix<mode>"): ... this pattern. -+ ("*sibcall_value_nonlocal_aix<mode>"): Replace by ... -+ ("*sibcall_value_aix<mode>"): ... this pattern. -+ * config/rs6000/rs6000-protos.h (rs6000_call_indirect_aix): Remove. -+ (rs6000_call_aix): Add prototype. -+ (rs6000_sibcall_aix): Likewise. -+ -+ Backport from mainline r204799: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_emit_prologue): Do not place a -+ RTX_FRAME_RELATED_P marker on the UNSPEC_MOVESI_FROM_CR insn. -+ Instead, add USEs of all modified call-saved CR fields to the -+ insn storing the result to the stack slot, and provide an -+ appropriate REG_FRAME_RELATED_EXPR for that insn. -+ * config/rs6000/rs6000.md ("*crsave"): New insn pattern. -+ * config/rs6000/predicates.md ("crsave_operation"): New predicate. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ ELFv2 ABI Call Support -+ Backport from mainline r204798: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ Alan Modra <amodra@gmail.com> -+ -+ * function.c (assign_parms): Use all.reg_parm_stack_space instead -+ of re-evaluating REG_PARM_STACK_SPACE target macro. -+ (locate_and_pad_parm): New parameter REG_PARM_STACK_SPACE. Use it -+ instead of evaluating target macro REG_PARM_STACK_SPACE every time. -+ (assign_parm_find_entry_rtl): Update call. -+ * calls.c (initialize_argument_information): Update call. -+ (emit_library_call_value_1): Likewise. -+ * expr.h (locate_and_pad_parm): Update prototype. -+ -+ Backport from mainline r204797: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * calls.c (store_unaligned_arguments_into_pseudos): Skip PARALLEL -+ arguments. -+ -+ Backport from mainline r197003: -+ -+ 2013-03-23 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * calls.c (expand_call): Add missing guard to code handling return -+ of non-BLKmode structures in MSB. -+ * function.c (expand_function_end): Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r201750. -+ Note: Default setting of -mcompat-align-parm inverted! -+ -+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ PR target/57949 -+ * doc/invoke.texi: Add documentation of mcompat-align-parm -+ option. -+ * config/rs6000/rs6000.opt: Add mcompat-align-parm option. -+ * config/rs6000/rs6000.c (rs6000_function_arg_boundary): For AIX -+ and Linux, correct BLKmode alignment when 128-bit alignment is -+ required and compatibility flag is not set. -+ (rs6000_gimplify_va_arg): For AIX and Linux, honor specified -+ alignment for zero-size arguments when compatibility flag is not -+ set. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Little Endian Vector Support -+ Backport from mainline r205333 -+ 2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct -+ for little endian. -+ -+ Backport from mainline r205241 -+ 2013-11-21 Bill Schmidt <wschmidt@vnet.ibm.com> -+ -+ * config/rs6000/vector.md (vec_pack_trunc_v2df): Revert previous -+ little endian change. -+ (vec_pack_sfix_trunc_v2df): Likewise. -+ (vec_pack_ufix_trunc_v2df): Likewise. -+ * config/rs6000/rs6000.c (rs6000_expand_interleave): Correct -+ double checking of endianness. -+ -+ Backport from mainline r205146 -+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vsx.md (vsx_set_<mode>): Adjust for little endian. -+ (vsx_extract_<mode>): Likewise. -+ (*vsx_extract_<mode>_one_le): New LE variant on -+ *vsx_extract_<mode>_zero. -+ (vsx_extract_v4sf): Adjust for little endian. -+ -+ Backport from mainline r205080 -+ 2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Adjust -+ V16QI vector splat case for little endian. -+ -+ Backport from mainline r205045: -+ -+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/vector.md ("mov<mode>"): Do not call -+ rs6000_emit_le_vsx_move to move into or out of GPRs. -+ * config/rs6000/rs6000.c (rs6000_emit_le_vsx_move): Assert -+ source and destination are not GPR hard regs. -+ -+ Backport from mainline r204920 -+ 2011-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_frame_related): Add split_reg -+ parameter and use it in REG_FRAME_RELATED_EXPR note. -+ (emit_frame_save): Call rs6000_frame_related with extra NULL_RTX -+ parameter. -+ (rs6000_emit_prologue): Likewise, but for little endian VSX -+ stores, pass the source register of the store instead. -+ -+ Backport from mainline r204862 -+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (UNSPEC_VPERM_X, UNSPEC_VPERM_UNS_X): -+ Remove. -+ (altivec_vperm_<mode>): Revert earlier little endian change. -+ (*altivec_vperm_<mode>_internal): Remove. -+ (altivec_vperm_<mode>_uns): Revert earlier little endian change. -+ (*altivec_vperm_<mode>_uns_internal): Remove. -+ * config/rs6000/vector.md (vec_realign_load_<mode>): Revise -+ commentary. -+ -+ Backport from mainline r204441 -+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): -+ Remove restriction against use of VSX instructions when generating -+ code for little endian mode. -+ -+ Backport from mainline r204440 -+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (mulv4si3): Ensure we generate vmulouh -+ for both big and little endian. -+ (mulv8hi3): Swap input operands for merge high and merge low -+ instructions for little endian. -+ -+ Backport from mainline r204439 -+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (vec_widen_umult_even_v16qi): Change -+ define_insn to define_expand that uses even patterns for big -+ endian and odd patterns for little endian. -+ (vec_widen_smult_even_v16qi): Likewise. -+ (vec_widen_umult_even_v8hi): Likewise. -+ (vec_widen_smult_even_v8hi): Likewise. -+ (vec_widen_umult_odd_v16qi): Likewise. -+ (vec_widen_smult_odd_v16qi): Likewise. -+ (vec_widen_umult_odd_v8hi): Likewise. -+ (vec_widen_smult_odd_v8hi): Likewise. -+ (altivec_vmuleub): New define_insn. -+ (altivec_vmuloub): Likewise. -+ (altivec_vmulesb): Likewise. -+ (altivec_vmulosb): Likewise. -+ (altivec_vmuleuh): Likewise. -+ (altivec_vmulouh): Likewise. -+ (altivec_vmulesh): Likewise. -+ (altivec_vmulosh): Likewise. -+ -+ Backport from mainline r204395 -+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (vec_pack_sfix_trunc_v2df): Adjust for -+ little endian. -+ (vec_pack_ufix_trunc_v2df): Likewise. -+ -+ Backport from mainline r204363 -+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (vec_widen_umult_hi_v16qi): Swap -+ arguments to merge instruction for little endian. -+ (vec_widen_umult_lo_v16qi): Likewise. -+ (vec_widen_smult_hi_v16qi): Likewise. -+ (vec_widen_smult_lo_v16qi): Likewise. -+ (vec_widen_umult_hi_v8hi): Likewise. -+ (vec_widen_umult_lo_v8hi): Likewise. -+ (vec_widen_smult_hi_v8hi): Likewise. -+ (vec_widen_smult_lo_v8hi): Likewise. -+ -+ Backport from mainline r204350 -+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vsx.md (*vsx_le_perm_store_<mode> for VSX_D): -+ Replace the define_insn_and_split with a define_insn and two -+ define_splits, with the split after reload re-permuting the source -+ register to its original value. -+ (*vsx_le_perm_store_<mode> for VSX_W): Likewise. -+ (*vsx_le_perm_store_v8hi): Likewise. -+ (*vsx_le_perm_store_v16qi): Likewise. -+ -+ Backport from mainline r204321 -+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (vec_pack_trunc_v2df): Adjust for -+ little endian. -+ -+ Backport from mainline r204321 -+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Adjust for -+ little endian. -+ -+ Backport from mainline r203980 -+ 2013-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (mulv8hi3): Adjust for little endian. -+ -+ Backport from mainline r203930 -+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse -+ meaning of merge-high and merge-low masks for little endian; avoid -+ use of vector-pack masks for little endian for mismatched modes. -+ -+ Backport from mainline r203877 -+ 2013-10-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for -+ little endian. -+ (vec_unpacku_hi_v8hi): Likewise. -+ (vec_unpacku_lo_v16qi): Likewise. -+ (vec_unpacku_lo_v8hi): Likewise. -+ -+ Backport from mainline r203863 -+ 2013-10-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (vspltis_constant): Make sure we check -+ all elements for both endian flavors. -+ -+ Backport from mainline r203714 -+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc/config/rs6000/vector.md (vec_unpacks_hi_v4sf): Correct for -+ endianness. -+ (vec_unpacks_lo_v4sf): Likewise. -+ (vec_unpacks_float_hi_v4si): Likewise. -+ (vec_unpacks_float_lo_v4si): Likewise. -+ (vec_unpacku_float_hi_v4si): Likewise. -+ (vec_unpacku_float_lo_v4si): Likewise. -+ -+ Backport from mainline r203713 -+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vsx.md (vsx_concat_<mode>): Adjust output for LE. -+ (vsx_concat_v2sf): Likewise. -+ -+ Backport from mainline r203458 -+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): Generalize to -+ handle vector float as well. -+ (*vsx_le_perm_load_v4si): Likewise. -+ (*vsx_le_perm_store_v2di): Likewise. -+ (*vsx_le_perm_store_v4si): Likewise. -+ -+ Backport from mainline r203457 -+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (vec_realign_load<mode>): Generate vperm -+ directly to circumvent subtract from splat{31} workaround. -+ * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_le): New -+ prototype. -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_le): New. -+ * config/rs6000/altivec.md (define_c_enum "unspec"): Add -+ UNSPEC_VPERM_X and UNSPEC_VPERM_UNS_X. -+ (altivec_vperm_<mode>): Convert to define_insn_and_split to -+ separate big and little endian logic. -+ (*altivec_vperm_<mode>_internal): New define_insn. -+ (altivec_vperm_<mode>_uns): Convert to define_insn_and_split to -+ separate big and little endian logic. -+ (*altivec_vperm_<mode>_uns_internal): New define_insn. -+ (vec_permv16qi): Add little endian logic. -+ -+ Backport from mainline r203247 -+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const_le): New. -+ (altivec_expand_vec_perm_const): Call it. -+ -+ Backport from mainline r203246 -+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (mov<mode>): Emit permuted move -+ sequences for LE VSX loads and stores at expand time. -+ * config/rs6000/rs6000-protos.h (rs6000_emit_le_vsx_move): New -+ prototype. -+ * config/rs6000/rs6000.c (rs6000_const_vec): New. -+ (rs6000_gen_le_vsx_permute): New. -+ (rs6000_gen_le_vsx_load): New. -+ (rs6000_gen_le_vsx_store): New. -+ (rs6000_gen_le_vsx_move): New. -+ * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): New. -+ (*vsx_le_perm_load_v4si): New. -+ (*vsx_le_perm_load_v8hi): New. -+ (*vsx_le_perm_load_v16qi): New. -+ (*vsx_le_perm_store_v2di): New. -+ (*vsx_le_perm_store_v4si): New. -+ (*vsx_le_perm_store_v8hi): New. -+ (*vsx_le_perm_store_v16qi): New. -+ (*vsx_xxpermdi2_le_<mode>): New. -+ (*vsx_xxpermdi4_le_<mode>): New. -+ (*vsx_xxpermdi8_le_V8HI): New. -+ (*vsx_xxpermdi16_le_V16QI): New. -+ (*vsx_lxvd2x2_le_<mode>): New. -+ (*vsx_lxvd2x4_le_<mode>): New. -+ (*vsx_lxvd2x8_le_V8HI): New. -+ (*vsx_lxvd2x16_le_V16QI): New. -+ (*vsx_stxvd2x2_le_<mode>): New. -+ (*vsx_stxvd2x4_le_<mode>): New. -+ (*vsx_stxvd2x8_le_V8HI): New. -+ (*vsx_stxvd2x16_le_V16QI): New. -+ -+ Backport from mainline r201235 -+ 2013-07-24 Bill Schmidt <wschmidt@linux.ibm.com> -+ Anton Blanchard <anton@au1.ibm.com> -+ -+ * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian. -+ (altivec_vpks<VI_char>ss): Likewise. -+ (altivec_vpks<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>um): Likewise. -+ -+ Backport from mainline r201208 -+ 2013-07-24 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ Anton Blanchard <anton@au1.ibm.com> -+ -+ * config/rs6000/vector.md (vec_realign_load_<mode>): Reorder input -+ operands to vperm for little endian. -+ * config/rs6000/rs6000.c (rs6000_expand_builtin): Use lvsr instead -+ of lvsl to create the control mask for a vperm for little endian. -+ -+ Backport from mainline r201195 -+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ Anton Blanchard <anton@au1.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse -+ two operands for little-endian. -+ -+ Backport from mainline r201193 -+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ Anton Blanchard <anton@au1.ibm.com> -+ -+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Correct -+ selection of field for vector splat in little endian mode. -+ -+ Backport from mainline r201149 -+ 2013-07-22 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ Anton Blanchard <anton@au1.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix -+ endianness when selecting field to splat. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r205123: -+ -+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_cannot_change_mode_class): Do not -+ allow subregs of TDmode in FPRs of smaller size in little-endian. -+ (rs6000_split_multireg_move): When splitting an access to TDmode -+ in FPRs, do not use simplify_gen_subreg. -+ -+ Backport from mainline r204927: -+ -+ 2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_emit_move): Use low word of -+ sdmode_stack_slot also in little-endian mode. +@@ -1,3 +1,283 @@ ++2014-07-17 Richard Biener <rguenther@suse.de> + -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> ++ PR rtl-optimization/61801 ++ * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and ++ ASM_INPUT don't set reg_pending_barrier if it appears in a ++ debug-insn. + -+ Power8 HTM Support -+ Backport from mainline -+ 2013-12-03 Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/htmintrin.h (_TEXASR_INSTRUCTION_FETCH_CONFLICT): Fix -+ typo in macro name. -+ (_TEXASRU_INSTRUCTION_FETCH_CONFLICT): Likewise. -+ -+ Backport from mainline r205233. -+ 2013-11-21 Peter Bergner <bergner@vnet.ibm.com> -+ -+ * doc/extend.texi: Document htm builtins. -+ -+ Backport from mainline -+ 2013-07-17 Iain Sandoe <iain@codesourcery.com> -+ -+ * config/rs6000/darwin.h (REGISTER_NAMES): Add HTM registers. -+ -+ Backport from mainline -+ 2013-07-16 Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not -+ enable extra ISA flags with TARGET_HTM. -+ -+ 2013-07-16 Jakub Jelinek <jakub@redhat.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTERS): Mention HTM -+ registers in the comment. -+ (DWARF_FRAME_REGISTERS): Subtract also the 3 HTM registers. -+ (DWARF_REG_TO_UNWIND_COLUMN): Use DWARF_FRAME_REGISTERS -+ rather than FIRST_PSEUDO_REGISTERS. -+ -+ * config.gcc (powerpc*-*-*): Install htmintrin.h and htmxlintrin.h. -+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add htm.md. -+ * config/rs6000/rs6000.opt: Add -mhtm option. -+ * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add OPTION_MASK_HTM. -+ (ISA_2_7_MASKS_SERVER): Add OPTION_MASK_HTM. -+ * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define -+ __HTM__ if the HTM instructions are available. -+ * config/rs6000/predicates.md (u3bit_cint_operand, u10bit_cint_operand) -+ (htm_spr_reg_operand): New define_predicates. -+ * config/rs6000/rs6000.md (define_attr "type"): Add htm. -+ (TFHAR_REGNO, TFIAR_REGNO, TEXASR_REGNO): New define_constants. -+ Include htm.md. -+ * config/rs6000/rs6000-builtin.def (BU_HTM_0, BU_HTM_1, BU_HTM_2) -+ (BU_HTM_3, BU_HTM_SPR0, BU_HTM_SPR1): Add support macros for defining -+ HTM builtin functions. -+ * config/rs6000/rs6000.c (RS6000_BUILTIN_H): New macro. -+ (rs6000_reg_names, alt_reg_names): Add HTM SPR register names. -+ (rs6000_init_hard_regno_mode_ok): Add support for HTM instructions. -+ (rs6000_builtin_mask_calculate): Likewise. -+ (rs6000_option_override_internal): Likewise. -+ (bdesc_htm): Add new HTM builtin support. -+ (htm_spr_num): New function. -+ (htm_spr_regno): Likewise. -+ (rs6000_htm_spr_icode): Likewise. -+ (htm_expand_builtin): Likewise. -+ (htm_init_builtins): Likewise. -+ (rs6000_expand_builtin): Add support for HTM builtin functions. -+ (rs6000_init_builtins): Likewise. -+ (rs6000_invalid_builtin, rs6000_opt_mask): Add support for -mhtm option. -+ * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mhtm. -+ (TARGET_HTM, MASK_HTM): Define macros. -+ (FIRST_PSEUDO_REGISTER): Adjust for new HTM SPR registers. -+ (FIXED_REGISTERS): Likewise. -+ (CALL_USED_REGISTERS): Likewise. -+ (CALL_REALLY_USED_REGISTERS): Likewise. -+ (REG_ALLOC_ORDER): Likewise. -+ (enum reg_class): Likewise. -+ (REG_CLASS_NAMES): Likewise. -+ (REG_CLASS_CONTENTS): Likewise. -+ (REGISTER_NAMES): Likewise. -+ (ADDITIONAL_REGISTER_NAMES): Likewise. -+ (RS6000_BTC_SPR, RS6000_BTC_VOID, RS6000_BTC_32BIT, RS6000_BTC_64BIT) -+ (RS6000_BTC_MISC_MASK, RS6000_BTM_HTM): New macros. -+ (RS6000_BTM_COMMON): Add RS6000_BTM_HTM. -+ * config/rs6000/htm.md: New file. -+ * config/rs6000/htmintrin.h: New file. -+ * config/rs6000/htmxlintrin.h: New file. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Power8 Base Support -+ Apply mainline -+ 2013-11-23 Alan Modra <amodra@gmail.com> -+ * config/rs6000/vsx.md (fusion peepholes): Disable when !TARGET_VSX. -+ -+ Backport from mainline -+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59054 -+ * config/rs6000/rs6000.md (movdi_internal32): Eliminate -+ constraints that would allow DImode into the traditional Altivec -+ registers, but cause undesirable code generation when loading 0 as -+ a constant. -+ (movdi_internal64): Likewise. -+ (cmp<mode>_fpr): Do not use %x for CR register output. -+ (extendsfdf2_fpr): Fix constraints when -mallow-upper-df and -+ -mallow-upper-sf debug switches are used. -+ -+ Backport from mainline -+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (enum rs6000_reload_reg_type): Add new -+ fields to the reg_addr array that describes the valid addressing -+ mode for any register, general purpose registers, floating point -+ registers, and Altivec registers. -+ (FIRST_RELOAD_REG_CLASS): Likewise. -+ (LAST_RELOAD_REG_CLASS): Likewise. -+ (struct reload_reg_map_type): Likewise. -+ (reload_reg_map_type): Likewise. -+ (RELOAD_REG_VALID): Likewise. -+ (RELOAD_REG_MULTIPLE): Likewise. -+ (RELOAD_REG_INDEXED): Likewise. -+ (RELOAD_REG_OFFSET): Likewise. -+ (RELOAD_REG_PRE_INCDEC): Likewise. -+ (RELOAD_REG_PRE_MODIFY): Likewise. -+ (reg_addr): Likewise. -+ (mode_supports_pre_incdec_p): New helper functions to say whether -+ a given mode supports PRE_INC, PRE_DEC, and PRE_MODIFY. -+ (mode_supports_pre_modify_p): Likewise. -+ (rs6000_debug_vector_unit): Rearrange the -mdebug=reg output to -+ print the valid address mode bits for each mode. -+ (rs6000_debug_print_mode): Likewise. -+ (rs6000_debug_reg_global): Likewise. -+ (rs6000_setup_reg_addr_masks): New function to set up the address -+ mask bits for each type. -+ (rs6000_init_hard_regno_mode_ok): Use memset to clear arrays. -+ Call rs6000_setup_reg_addr_masks to set up the address mask bits. -+ (rs6000_legitimate_address_p): Use mode_supports_pre_incdec_p and -+ mode_supports_pre_modify_p to determine if PRE_INC, PRE_DEC, and -+ PRE_MODIFY are supported. -+ (rs6000_output_move_128bit): Change to use {src,dest}_vmx_p for altivec -+ registers, instead of {src,dest}_av_p. -+ (rs6000_print_options_internal): Tweak the debug output slightly. -+ -+ Backport from mainline -+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2, -+ ceildf2, btruncdf2, instead of vsx_* name. -+ -+ * config/rs6000/vsx.md (vsx_add<mode>3): Change arithmetic -+ iterators to only do V2DF and V4SF here. Move the DF code to -+ rs6000.md where it is combined with SF mode. Replace <VSv> with -+ just 'v' since only vector operations are handled with these insns -+ after moving the DF support to rs6000.md. -+ (vsx_sub<mode>3): Likewise. -+ (vsx_mul<mode>3): Likewise. -+ (vsx_div<mode>3): Likewise. -+ (vsx_fre<mode>2): Likewise. -+ (vsx_neg<mode>2): Likewise. -+ (vsx_abs<mode>2): Likewise. -+ (vsx_nabs<mode>2): Likewise. -+ (vsx_smax<mode>3): Likewise. -+ (vsx_smin<mode>3): Likewise. -+ (vsx_sqrt<mode>2): Likewise. -+ (vsx_rsqrte<mode>2): Likewise. -+ (vsx_fms<mode>4): Likewise. -+ (vsx_nfma<mode>4): Likewise. -+ (vsx_copysign<mode>3): Likewise. -+ (vsx_btrunc<mode>2): Likewise. -+ (vsx_floor<mode>2): Likewise. -+ (vsx_ceil<mode>2): Likewise. -+ (vsx_smaxsf3): Delete scalar ops that were moved to rs6000.md. -+ (vsx_sminsf3): Likewise. -+ (vsx_fmadf4): Likewise. -+ (vsx_fmsdf4): Likewise. -+ (vsx_nfmadf4): Likewise. -+ (vsx_nfmsdf4): Likewise. -+ (vsx_cmpdf_internal1): Likewise. -+ -+ * config/rs6000/rs6000.h (TARGET_SF_SPE): Define macros to make it -+ simpler to select whether a target has SPE or traditional floating -+ point support in iterators. -+ (TARGET_DF_SPE): Likewise. -+ (TARGET_SF_FPR): Likewise. -+ (TARGET_DF_FPR): Likewise. -+ (TARGET_SF_INSN): Macros to say whether floating point support -+ exists for a given operation for expanders. -+ (TARGET_DF_INSN): Likewise. -+ -+ * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow -+ combining of SF/DF mode operations, using both traditional and VSX -+ registers. -+ (Fvsx): Likewise. -+ (Ff): Likewise. -+ (Fv): Likewise. -+ (Fs): Likewise. -+ (Ffre): Likewise. -+ (FFRE): Likewise. -+ (abs<mode>2): Combine SF/DF modes using traditional floating point -+ instructions. Add support for using the upper DF registers with -+ VSX support, and SF registers with power8-vector support. Update -+ expanders for operations supported by both the SPE and traditional -+ floating point units. -+ (abs<mode>2_fpr): Likewise. -+ (nabs<mode>2): Likewise. -+ (nabs<mode>2_fpr): Likewise. -+ (neg<mode>2): Likewise. -+ (neg<mode>2_fpr): Likewise. -+ (add<mode>3): Likewise. -+ (add<mode>3_fpr): Likewise. -+ (sub<mode>3): Likewise. -+ (sub<mode>3_fpr): Likewise. -+ (mul<mode>3): Likewise. -+ (mul<mode>3_fpr): Likewise. -+ (div<mode>3): Likewise. -+ (div<mode>3_fpr): Likewise. -+ (sqrt<mode>3): Likewise. -+ (sqrt<mode>3_fpr): Likewise. -+ (fre<Fs>): Likewise. -+ (rsqrt<mode>2): Likewise. -+ (cmp<mode>_fpr): Likewise. -+ (smax<mode>3): Likewise. -+ (smin<mode>3): Likewise. -+ (smax<mode>3_vsx): Likewise. -+ (smin<mode>3_vsx): Likewise. -+ (negsf2): Delete SF operations that are merged with DF. -+ (abssf2): Likewise. -+ (addsf3): Likewise. -+ (subsf3): Likewise. -+ (mulsf3): Likewise. -+ (divsf3): Likewise. -+ (fres): Likewise. -+ (fmasf4_fpr): Likewise. -+ (fmssf4_fpr): Likewise. -+ (nfmasf4_fpr): Likewise. -+ (nfmssf4_fpr): Likewise. -+ (sqrtsf2): Likewise. -+ (rsqrtsf_internal1): Likewise. -+ (smaxsf3): Likewise. -+ (sminsf3): Likewise. -+ (cmpsf_internal1): Likewise. -+ (copysign<mode>3_fcpsgn): Add VSX/power8-vector support. -+ (negdf2): Delete DF operations that are merged with SF. -+ (absdf2): Likewise. -+ (nabsdf2): Likewise. -+ (adddf3): Likewise. -+ (subdf3): Likewise. -+ (muldf3): Likewise. -+ (divdf3): Likewise. -+ (fred): Likewise. -+ (rsqrtdf_internal1): Likewise. -+ (fmadf4_fpr): Likewise. -+ (fmsdf4_fpr): Likewise. -+ (nfmadf4_fpr): Likewise. -+ (nfmsdf4_fpr): Likewise. -+ (sqrtdf2): Likewise. -+ (smaxdf3): Likewise. -+ (smindf3): Likewise. -+ (cmpdf_internal1): Likewise. -+ (lrint<mode>di2): Use TARGET_<MODE>_FPR macro. -+ (btrunc<mode>2): Delete separate expander, and combine with the -+ insn and add VSX instruction support. Use TARGET_<MODE>_FPR. -+ (btrunc<mode>2_fpr): Likewise. -+ (ceil<mode>2): Likewise. -+ (ceil<mode>2_fpr): Likewise. -+ (floor<mode>2): Likewise. -+ (floor<mode>2_fpr): Likewise. -+ (fma<mode>4_fpr): Combine SF and DF fused multiply/add support. -+ Add support for using the upper registers with VSX and -+ power8-vector. Move insns to be closer to the define_expands. On -+ VSX systems, prefer the traditional form of FMA over the VSX -+ version, since the traditional form allows the target not to -+ overlap with the inputs. -+ (fms<mode>4_fpr): Likewise. -+ (nfma<mode>4_fpr): Likewise. -+ (nfms<mode>4_fpr): Likewise. -+ -+ Backport from mainline -+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow -+ DFmode, DImode, and SFmode in the upper VSX registers based on the -+ -mupper-regs-{df,sf} flags. Fix wu constraint to be ALTIVEC_REGS -+ if -mpower8-vector. Combine -mvsx-timode handling with the rest -+ of the VSX register handling. -+ -+ * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters. -+ (f32_sv): Likewise. -+ (zero_extendsidi2_lfiwzx): Add support for loading into the -+ Altivec registers with -mpower8-vector. Use wu/wv constraints to -+ only do VSX memory options on Altivec registers. -+ (extendsidi2_lfiwax): Likewise. -+ (extendsfdf2_fpr): Likewise. -+ (mov<mode>_hardfloat, SF/SD modes): Likewise. -+ (mov<mode>_hardfloat32, DF/DD modes): Likewise. -+ (mov<mode>_hardfloat64, DF/DD modes): Likewise. -+ (movdi_internal64): Likewise. -+ -+ Backport from mainline -+ 2013-09-23 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine -+ reload helper function arrays into a single array reg_addr. -+ (reload_fpr_gpr): Likewise. -+ (reload_gpr_vsx): Likewise. -+ (reload_vsx_gpr): Likewise. -+ (struct rs6000_reg_addr): Likewise. -+ (reg_addr): Likewise. -+ (rs6000_debug_reg_global): Change rs6000_vector_reload, -+ reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr. -+ (rs6000_init_hard_regno_mode_ok): Likewise. -+ (rs6000_secondary_reload_direct_move): Likewise. -+ (rs6000_secondary_reload): Likewise. -+ -+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new -+ constraints: wu, ww, and wy. Repurpose wv constraint added during -+ power8 changes. Put wg constraint in alphabetical order. -+ -+ * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch -+ for future work to add ISA 2.07 VSX single precision support. -+ (-mvsx-scalar-double): Change default from -1 to 1, update -+ documentation comment. -+ (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df. -+ (-mupper-regs-df): New debug switch to control whether DF values -+ can go in the traditional Altivec registers. -+ (-mupper-regs-sf): New debug switch to control whether SF values -+ can go in the traditional Altivec registers. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww, -+ and wy constraints. -+ (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for -+ loop variables. Rename -mvsx-scalar-memory to -mupper-regs-df. -+ Add new constraints, wu/ww/wy. Repurpose wv constraint. -+ (rs6000_debug_legitimate_address_p): Print if we are running -+ before, during, or after reload. -+ (rs6000_secondary_reload): Add a comment. -+ (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf. -+ -+ * config/rs6000/constraints.md (wa constraint): Sort w<x> -+ constraints. Update documentation string. -+ (wd constraint): Likewise. -+ (wf constraint): Likewise. -+ (wg constraint): Likewise. -+ (wn constraint): Likewise. -+ (ws constraint): Likewise. -+ (wt constraint): Likewise. -+ (wx constraint): Likewise. -+ (wz constraint): Likewise. -+ (wu constraint): New constraint for ISA 2.07 SFmode scalar -+ instructions. -+ (ww constraint): Likewise. -+ (wy constraint): Likewise. -+ (wv constraint): Repurpose ISA 2.07 constraint that did not use in -+ the previous submissions. -+ * doc/md.texi (PowerPC and IBM RS6000): Likewise. -+ -+ Backport from mainline -+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/58673 -+ * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only -+ restrict TImode addresses to single indirect registers if both -+ -mquad-memory and -mvsx-timode are used. -+ (rs6000_output_move_128bit): Use quad_load_store_p to determine if -+ we should emit load/store quad. Remove using %y for quad memory -+ addresses. -+ -+ * config/rs6000/rs6000.md (mov<mode>_ppc64, TI/PTImode): Add -+ constraints to allow load/store quad on machines where TImode is -+ not allowed in VSX registers. Use 'n' instead of 'F' constraint -+ for TImode to load integer constants. -+ -+ Backport from mainline -+ 2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/58587 -+ * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off -+ setting -mvsx-timode by default until the underlying problem is -+ fixed. -+ (RS6000_CPU, power7 defaults): Likewise. -+ -+ Backport from trunk -+ 2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/58160 -+ * config/rs6000/predicates.md (fusion_gpr_mem_load): Allow the -+ memory rtx to contain ZERO_EXTEND and SIGN_EXTEND. -+ -+ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): Pass operands -+ array instead of each individual operand as a separate argument. -+ (emit_fusion_gpr_load): Likewise. -+ (expand_fusion_gpr_load): Add new function declaration. -+ -+ * config/rs6000/rs6000.c (fusion_gpr_load_p): Change the calling -+ signature to have the operands passed as an array, instead of as -+ separate arguments. Allow ZERO_EXTEND to be in the memory -+ address, and also SIGN_EXTEND if -mpower8-fusion-sign. Do not -+ depend on the register live/dead flags when peepholes are run. -+ (expand_fusion_gpr_load): New function to be called from the -+ peephole2 pass, to change the register that addis sets to be the -+ target register. -+ (emit_fusion_gpr_load): Change the calling signature to have the -+ operands passed as an array, instead of as separate arguments. -+ Allow ZERO_EXTEND to be in the memory address, and also -+ SIGN_EXTEND if -mpower8-fusion-sign. -+ -+ * config/rs6000/rs6000.md (UNSPEC_FUSION_GPR): Delete unused -+ unspec enumeration. -+ (power8 fusion peephole/peephole2): Rework the fusion peepholes to -+ adjust the register addis loads up in the peephole2 pass. Do not -+ depend on the register live/dead state when the peephole pass is -+ done. -+ -+ Backport from trunk -+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (xor<mode>3): Move 128-bit boolean -+ expanders to rs6000.md. -+ (ior<mode>3): Likewise. -+ (and<mode>3): Likewise. -+ (one_cmpl<mode>2): Likewise. -+ (nor<mode>3): Likewise. -+ (andc<mode>3): Likewise. -+ (eqv<mode>3): Likewise. -+ (nand<mode>3): Likewise. -+ (orc<mode>3): Likewise. -+ -+ * config/rs6000/rs6000-protos.h (rs6000_split_logical): New -+ declaration. -+ -+ * config/rs6000/rs6000.c (rs6000_split_logical_inner): Add support -+ to split multi-word logical operations. -+ (rs6000_split_logical_di): Likewise. -+ (rs6000_split_logical): Likewise. -+ -+ * config/rs6000/vsx.md (VSX_L2): Delete, no longer used. -+ (vsx_and<mode>3_32bit): Move 128-bit logical insns to rs6000.md, -+ and allow TImode operations in 32-bit. -+ (vsx_and<mode>3_64bit): Likewise. -+ (vsx_ior<mode>3_32bit): Likewise. -+ (vsx_ior<mode>3_64bit): Likewise. -+ (vsx_xor<mode>3_32bit): Likewise. -+ (vsx_xor<mode>3_64bit): Likewise. -+ (vsx_one_cmpl<mode>2_32bit): Likewise. -+ (vsx_one_cmpl<mode>2_64bit): Likewise. -+ (vsx_nor<mode>3_32bit): Likewise. -+ (vsx_nor<mode>3_64bit): Likewise. -+ (vsx_andc<mode>3_32bit): Likewise. -+ (vsx_andc<mode>3_64bit): Likewise. -+ (vsx_eqv<mode>3_32bit): Likewise. -+ (vsx_eqv<mode>3_64bit): Likewise. -+ (vsx_nand<mode>3_32bit): Likewise. -+ (vsx_nand<mode>3_64bit): Likewise. -+ (vsx_orc<mode>3_32bit): Likewise. -+ (vsx_orc<mode>3_64bit): Likewise. -+ -+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Always allow vector -+ logical types in GPRs. -+ -+ * config/rs6000/altivec.md (altivec_and<mode>3): Move 128-bit -+ logical insns to rs6000.md, and allow TImode operations in -+ 32-bit. -+ (altivec_ior<mode>3): Likewise. -+ (altivec_xor<mode>3): Likewise. -+ (altivec_one_cmpl<mode>2): Likewise. -+ (altivec_nor<mode>3): Likewise. -+ (altivec_andc<mode>3): Likewise. -+ -+ * config/rs6000/rs6000.md (BOOL_128): New mode iterators and mode -+ attributes for moving the 128-bit logical operations into -+ rs6000.md. -+ (BOOL_REGS_OUTPUT): Likewise. -+ (BOOL_REGS_OP1): Likewise. -+ (BOOL_REGS_OP2): Likewise. -+ (BOOL_REGS_UNARY): Likewise. -+ (BOOL_REGS_AND_CR0): Likewise. -+ (one_cmpl<mode>2): Add support for DI logical operations on -+ 32-bit, splitting the operations to 32-bit. -+ (anddi3): Likewise. -+ (iordi3): Likewise. -+ (xordi3): Likewise. -+ (and<mode>3, 128-bit types): Rewrite 2013-06-06 logical operator -+ changes to combine the 32/64-bit code, allow logical operations on -+ TI mode in 32-bit, and to use similar match_operator patterns like -+ scalar mode uses. Combine the Altivec and VSX code for logical -+ operations, and move it here. -+ (ior<mode>3, 128-bit types): Likewise. -+ (xor<mode>3, 128-bit types): Likewise. -+ (one_cmpl<mode>3, 128-bit types): Likewise. -+ (nor<mode>3, 128-bit types): Likewise. -+ (andc<mode>3, 128-bit types): Likewise. -+ (eqv<mode>3, 128-bit types): Likewise. -+ (nand<mode>3, 128-bit types): Likewise. -+ (orc<mode>3, 128-bit types): Likewise. -+ (and<mode>3_internal): Likewise. -+ (bool<mode>3_internal): Likewise. -+ (boolc<mode>3_internal1): Likewise. -+ (boolc<mode>3_internal2): Likewise. -+ (boolcc<mode>3_internal1): Likewise. -+ (boolcc<mode>3_internal2): Likewise. -+ (eqv<mode>3_internal1): Likewise. -+ (eqv<mode>3_internal2): Likewise. -+ (one_cmpl1<mode>3_internal): Likewise. -+ -+ Back port from mainline: -+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8 -+ support. -+ (check_effective_target_powerpc_p8vector_ok): Likewise. -+ (is-effective-target): Likewise. -+ (check_vect_support_and_set_flags): Likewise. -+ -+ Backport from mainline -+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/predicates.md (fusion_gpr_addis): New predicates -+ to support power8 load fusion. -+ (fusion_gpr_mem_load): Likewise. -+ -+ * config/rs6000/rs6000-modes.def (PTImode): Update a comment. -+ -+ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): New -+ declarations for power8 load fusion. -+ (emit_fusion_gpr_load): Likewise. -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): If -+ tuning for power8, turn on fusion mode by default. Turn on sign -+ extending fusion mode if normal fusion mode is on, and we are at -+ -O2 or -O3. -+ (fusion_gpr_load_p): New function, return true if we can fuse an -+ addis instruction with a dependent load to a GPR. -+ (emit_fusion_gpr_load): Emit the instructions for power8 load -+ fusion to GPRs. -+ -+ * config/rs6000/vsx.md (VSX_M2): New iterator for fusion -+ peepholes. -+ (VSX load fusion peepholes): New peepholes to fuse together an -+ addi instruction with a VSX load instruction. -+ -+ * config/rs6000/rs6000.md (GPR load fusion peepholes): New -+ peepholes to fuse an addis instruction with a load to a GPR base -+ register. If we are supporting sign extending fusions, convert -+ sign extending loads to zero extending loads and add an explicit -+ sign extension. -+ -+ Backport from mainline -+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com> ++2014-07-16 Jakub Jelinek <jakub@redhat.com> + -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Adjust flag -+ interaction for new Power8 flags and VSX. ++ * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS ++ on the FUNCTION_DECL. + -+ Back port from the trunk -+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com> ++2014-07-10 Tom G. Christensen <tgc@jupiterrise.com> + -+ PR target/57744 -+ * config/rs6000/rs6000.h (MODES_TIEABLE_P): Do not allow PTImode -+ to tie with any other modes. Eliminate Altivec vector mode tests, -+ since these are a subset of ALTIVEC or VSX vector modes. Simplify -+ code, to return 0 if testing MODE2 for a condition, if we've -+ already tested MODE1 for the same condition. ++ * doc/install.texi: Remove links to defunct package providers for ++ Solaris. + -+ Backport from mainline -+ 2013-06-28 Pat Haugen <pthaugen@us.ibm.com> -+ -+ * config/rs6000/rs6000.md (define_insn ""): Fix insn type. -+ -+ Back port from the trunk -+ 2013-06-26 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/power8.md: New. -+ * config/rs6000/rs6000-cpus.def (RS6000_CPU table): Adjust processor -+ setting for power8 entry. -+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add power8.md. -+ * config/rs6000/rs6000.c (is_microcoded_insn, is_cracked_insn): Adjust -+ test for Power4/Power5 only. -+ (insn_must_be_first_in_group, insn_must_be_last_in_group): Add Power8 -+ support. -+ (force_new_group): Adjust comment. -+ * config/rs6000/rs6000.md: Include power8.md. -+ -+ Back port from the trunk -+ 2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/57615 -+ * config/rs6000/rs6000.md (mov<mode>_ppc64): Call -+ rs6000_output_move_128bit to handle emitting quad memory -+ operations. Set attribute length to 8 bytes. -+ -+ Back port from the trunk -+ 2013-06-13 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Move -+ test for clearing quad memory on 32-bit later. -+ -+ Back port from the trunk -+ -+ 2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/rs6000.c (emit_load_locked): Add support for -+ power8 byte, half-word, and quad-word atomic instructions. -+ (emit_store_conditional): Likewise. -+ (rs6000_expand_atomic_compare_and_swap): Likewise. -+ (rs6000_expand_atomic_op): Likewise. -+ -+ * config/rs6000/sync.md (larx): Add new modes for power8. -+ (stcx): Likewise. -+ (AINT): New mode iterator to include TImode as well as normal -+ integer modes on power8. -+ (fetchop_pred): Use int_reg_operand instead of gpc_reg_operand so -+ that VSX registers are not considered. Use AINT mode iterator -+ instead of INT1 to allow inclusion of quad word atomic operations -+ on power8. -+ (load_locked<mode>): Likewise. -+ (store_conditional<mode>): Likewise. -+ (atomic_compare_and_swap<mode>): Likewise. -+ (atomic_exchange<mode>): Likewise. -+ (atomic_nand<mode>): Likewise. -+ (atomic_fetch_<fetchop_name><mode>): Likewise. -+ (atomic_nand_fetch<mode>): Likewise. -+ (mem_thread_fence): Use gen_loadsync_<mode> instead of enumerating -+ each type. -+ (ATOMIC): On power8, add QImode, HImode modes. -+ (load_locked<QHI:mode>_si): Varients of load_locked for QI/HI -+ modes that promote to SImode. -+ (load_lockedti): Convert TImode arguments to PTImode, so that we -+ get a guaranteed even/odd register pair. -+ (load_lockedpti): Likewise. -+ (store_conditionalti): Likewise. -+ (store_conditionalpti): Likewise. -+ -+ * config/rs6000/rs6000.md (QHI): New mode iterator for power8 -+ atomic load/store instructions. -+ (HSI): Likewise. -+ -+ Back port from the trunk -+ -+ 2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * config/rs6000/vector.md (GPR move splitter): Do not split moves -+ of vectors in GPRS if they are direct moves or quad word load or -+ store moves. -+ -+ * config/rs6000/rs6000-protos.h (rs6000_output_move_128bit): Add -+ declaration. -+ (direct_move_p): Likewise. -+ (quad_load_store_p): Likewise. -+ -+ * config/rs6000/rs6000.c (enum rs6000_reg_type): Simplify register -+ classes into bins based on the physical register type. -+ (reg_class_to_reg_type): Likewise. -+ (IS_STD_REG_TYPE): Likewise. -+ (IS_FP_VECT_REG_TYPE): Likewise. -+ (reload_fpr_gpr): Arrays to determine what insn to use if we can -+ use direct move instructions. -+ (reload_gpr_vsx): Likewise. -+ (reload_vsx_gpr): Likewise. -+ (rs6000_init_hard_regno_mode_ok): Precalculate the register type -+ information that is a simplification of register classes. Also -+ precalculate direct move reload helpers. -+ (direct_move_p): New function to return true if the operation can -+ be done as a direct move instruciton. -+ (quad_load_store_p): New function to return true if the operation -+ is a quad memory operation. -+ (rs6000_legitimize_address): If quad memory, only allow register -+ indirect for TImode addresses. -+ (rs6000_legitimate_address_p): Likewise. -+ (enum reload_reg_type): Delete, replace with rs6000_reg_type. -+ (rs6000_reload_register_type): Likewise. -+ (register_to_reg_type): Return register type. -+ (rs6000_secondary_reload_simple_move): New helper function for -+ secondary reload and secondary memory needed to identify anything -+ that is a simple move, and does not need reloading. -+ (rs6000_secondary_reload_direct_move): New helper function for -+ secondary reload to identify cases that can be done with several -+ instructions via the direct move instructions. -+ (rs6000_secondary_reload_move): New helper function for secondary -+ reload to identify moves between register types that can be done. -+ (rs6000_secondary_reload): Add support for quad memory operations -+ and for direct move. -+ (rs6000_secondary_memory_needed): Likewise. -+ (rs6000_debug_secondary_memory_needed): Change argument names. -+ (rs6000_output_move_128bit): New function to return the move to -+ use for 128-bit moves, including knowing about the various -+ limitations of quad memory operations. -+ -+ * config/rs6000/vsx.md (vsx_mov<mode>): Add support for quad -+ memory operations. call rs6000_output_move_128bit for the actual -+ instruciton(s) to generate. -+ (vsx_movti_64bit): Likewise. -+ -+ * config/rs6000/rs6000.md (UNSPEC_P8V_FMRGOW): New unspec values. -+ (UNSPEC_P8V_MTVSRWZ): Likewise. -+ (UNSPEC_P8V_RELOAD_FROM_GPR): Likewise. -+ (UNSPEC_P8V_MTVSRD): Likewise. -+ (UNSPEC_P8V_XXPERMDI): Likewise. -+ (UNSPEC_P8V_RELOAD_FROM_VSX): Likewise. -+ (UNSPEC_FUSION_GPR): Likewise. -+ (FMOVE128_GPR): New iterator for direct move. -+ (f32_lv): New mode attribute for load/store of SFmode/SDmode -+ values. -+ (f32_sv): Likewise. -+ (f32_dm): Likewise. -+ (zero_extend<mode>di2_internal1): Add support for power8 32-bit -+ loads and direct move instructions. -+ (zero_extendsidi2_lfiwzx): Likewise. -+ (extendsidi2_lfiwax): Likewise. -+ (extendsidi2_nocell): Likewise. -+ (floatsi<mode>2_lfiwax): Likewise. -+ (lfiwax): Likewise. -+ (floatunssi<mode>2_lfiwzx): Likewise. -+ (lfiwzx): Likewise. -+ (fix_trunc<mode>_stfiwx): Likewise. -+ (fixuns_trunc<mode>_stfiwx): Likewise. -+ (mov<mode>_hardfloat, 32-bit floating point): Likewise. -+ (mov<move>_hardfloat64, 64-bit floating point): Likewise. -+ (parity<mode>2_cmpb): Set length/type attr. -+ (unnamed shift right patterns, mov<mode>_internal2): Change type attr -+ for 'mr.' to fast_compare. -+ (bpermd_<mode>): Change type attr to popcnt. -+ (p8_fmrgow_<mode>): New insns for power8 direct move support. -+ (p8_mtvsrwz_1): Likewise. -+ (p8_mtvsrwz_2): Likewise. -+ (reload_fpr_from_gpr<mode>): Likewise. -+ (p8_mtvsrd_1): Likewise. -+ (p8_mtvsrd_2): Likewise. -+ (p8_xxpermdi_<mode>): Likewise. -+ (reload_vsx_from_gpr<mode>): Likewise. -+ (reload_vsx_from_gprsf): Likewise. -+ (p8_mfvsrd_3_<mode>): LIkewise. -+ (reload_gpr_from_vsx<mode>): Likewise. -+ (reload_gpr_from_vsxsf): Likewise. -+ (p8_mfvsrd_4_disf): Likewise. -+ (multi-word GPR splits): Do not split direct moves or quad memory -+ operations. -+ -+ Backport from the trunk -+ -+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): -+ Document new power8 builtins. -+ -+ * config/rs6000/vector.md (and<mode>3): Add a clobber/scratch of a -+ condition code register, to allow 128-bit logical operations to be -+ done in the VSX or GPR registers. -+ (nor<mode>3): Use the canonical form for nor. -+ (eqv<mode>3): Add expanders for power8 xxleqv, xxlnand, xxlorc, -+ vclz*, and vpopcnt* vector instructions. -+ (nand<mode>3): Likewise. -+ (orc<mode>3): Likewise. -+ (clz<mode>2): LIkewise. -+ (popcount<mode>2): Likewise. -+ -+ * config/rs6000/predicates.md (int_reg_operand): Rework tests so -+ that only the GPRs are recognized. -+ -+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add -+ support for new power8 builtins. -+ -+ * config/rs6000/rs6000-builtin.def (xscvspdpn): Add new power8 -+ builtin functions. -+ (xscvdpspn): Likewise. -+ (vclz): Likewise. -+ (vclzb): Likewise. -+ (vclzh): Likewise. -+ (vclzw): Likewise. -+ (vclzd): Likewise. -+ (vpopcnt): Likewise. -+ (vpopcntb): Likewise. -+ (vpopcnth): Likewise. -+ (vpopcntw): Likewise. -+ (vpopcntd): Likewise. -+ (vgbbd): Likewise. -+ (vmrgew): Likewise. -+ (vmrgow): Likewise. -+ (eqv): Likewise. -+ (eqv_v16qi3): Likewise. -+ (eqv_v8hi3): Likewise. -+ (eqv_v4si3): Likewise. -+ (eqv_v2di3): Likewise. -+ (eqv_v4sf3): Likewise. -+ (eqv_v2df3): Likewise. -+ (nand): Likewise. -+ (nand_v16qi3): Likewise. -+ (nand_v8hi3): Likewise. -+ (nand_v4si3): Likewise. -+ (nand_v2di3): Likewise. -+ (nand_v4sf3): Likewise. -+ (nand_v2df3): Likewise. -+ (orc): Likewise. -+ (orc_v16qi3): Likewise. -+ (orc_v8hi3): Likewise. -+ (orc_v4si3): Likewise. -+ (orc_v2di3): Likewise. -+ (orc_v4sf3): Likewise. -+ (orc_v2df3): Likewise. -+ -+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Only -+ allow power8 quad mode in 64-bit. -+ (rs6000_builtin_vectorized_function): Add support to vectorize -+ ISA 2.07 count leading zeros, population count builtins. -+ (rs6000_expand_vector_init): On ISA 2.07 use xscvdpspn to form -+ V4SF vectors instead of xscvdpsp to avoid IEEE related traps. -+ (builtin_function_type): Add vgbbd builtin function which takes an -+ unsigned argument. -+ (altivec_expand_vec_perm_const): Add support for new power8 merge -+ instructions. -+ -+ * config/rs6000/vsx.md (VSX_L2): New iterator for 128-bit types, -+ that does not include TImdoe for use with 32-bit. -+ (UNSPEC_VSX_CVSPDPN): Support for power8 xscvdpspn and xscvspdpn -+ instructions. -+ (UNSPEC_VSX_CVDPSPN): Likewise. -+ (vsx_xscvdpspn): Likewise. -+ (vsx_xscvspdpn): Likewise. -+ (vsx_xscvdpspn_scalar): Likewise. -+ (vsx_xscvspdpn_directmove): Likewise. -+ (vsx_and<mode>3): Split logical operations into 32-bit and -+ 64-bit. Add support to do logical operations on TImode as well as -+ VSX vector types. Allow logical operations to be done in either -+ VSX registers or in general purpose registers in 64-bit mode. Add -+ splitters if GPRs were used. For AND, add clobber of CCmode to -+ allow use of ANDI on GPRs. Rewrite nor to use the canonical RTL -+ encoding. -+ (vsx_and<mode>3_32bit): Likewise. -+ (vsx_and<mode>3_64bit): Likewise. -+ (vsx_ior<mode>3): Likewise. -+ (vsx_ior<mode>3_32bit): Likewise. -+ (vsx_ior<mode>3_64bit): Likewise. -+ (vsx_xor<mode>3): Likewise. -+ (vsx_xor<mode>3_32bit): Likewise. -+ (vsx_xor<mode>3_64bit): Likewise. -+ (vsx_one_cmpl<mode>2): Likewise. -+ (vsx_one_cmpl<mode>2_32bit): Likewise. -+ (vsx_one_cmpl<mode>2_64bit): Likewise. -+ (vsx_nor<mode>3): Likewise. -+ (vsx_nor<mode>3_32bit): Likewise. -+ (vsx_nor<mode>3_64bit): Likewise. -+ (vsx_andc<mode>3): Likewise. -+ (vsx_andc<mode>3_32bit): Likewise. -+ (vsx_andc<mode>3_64bit): Likewise. -+ (vsx_eqv<mode>3_32bit): Add support for power8 xxleqv, xxlnand, -+ and xxlorc instructions. -+ (vsx_eqv<mode>3_64bit): Likewise. -+ (vsx_nand<mode>3_32bit): Likewise. -+ (vsx_nand<mode>3_64bit): Likewise. -+ (vsx_orc<mode>3_32bit): Likewise. -+ (vsx_orc<mode>3_64bit): Likewise. -+ -+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Update comment. -+ -+ * config/rs6000/altivec.md (UNSPEC_VGBBD): Add power8 vgbbd -+ instruction. -+ (p8_vmrgew): Add power8 vmrgew and vmrgow instructions. -+ (p8_vmrgow): Likewise. -+ (altivec_and<mode>3): Add clobber of CCmode to allow AND using -+ GPRs to be split under VSX. -+ (p8v_clz<mode>2): Add power8 count leading zero support. -+ (p8v_popcount<mode>2): Add power8 population count support. -+ (p8v_vgbbd): Add power8 gather bits by bytes by doubleword -+ support. -+ -+ * config/rs6000/rs6000.md (eqv<mode>3): Add support for powerp eqv -+ instruction. -+ -+ * config/rs6000/altivec.h (vec_eqv): Add defines to export power8 -+ builtin functions. -+ (vec_nand): Likewise. -+ (vec_vclz): Likewise. -+ (vec_vclzb): Likewise. -+ (vec_vclzd): Likewise. -+ (vec_vclzh): Likewise. -+ (vec_vclzw): Likewise. -+ (vec_vgbbd): Likewise. -+ (vec_vmrgew): Likewise. -+ (vec_vmrgow): Likewise. -+ (vec_vpopcnt): Likewise. -+ (vec_vpopcntb): Likewise. -+ (vec_vpopcntd): Likewise. -+ (vec_vpopcnth): Likewise. -+ (vec_vpopcntw): Likewise. -+ -+ Backport from trunk -+ -+ 2013-05-29 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> ++2014-07-10 Eric Botcazou <ebotcazou@adacore.com> + -+ * config/rs6000/vector.md (VEC_I): Add support for new power8 V2DI -+ instructions. -+ (VEC_A): Likewise. -+ (VEC_C): Likewise. -+ (vrotl<mode>3): Likewise. -+ (vashl<mode>3): Likewise. -+ (vlshr<mode>3): Likewise. -+ (vashr<mode>3): Likewise. ++ PR middle-end/53590 ++ * function.c (allocate_struct_function): Revert r188667 change. + -+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add -+ support for power8 V2DI builtins. ++2014-07-04 Jakub Jelinek <jakub@redhat.com> + -+ * config/rs6000/rs6000-builtin.def (abs_v2di): Add support for -+ power8 V2DI builtins. -+ (vupkhsw): Likewise. -+ (vupklsw): Likewise. -+ (vaddudm): Likewise. -+ (vminsd): Likewise. -+ (vmaxsd): Likewise. -+ (vminud): Likewise. -+ (vmaxud): Likewise. -+ (vpkudum): Likewise. -+ (vpksdss): Likewise. -+ (vpkudus): Likewise. -+ (vpksdus): Likewise. -+ (vrld): Likewise. -+ (vsld): Likewise. -+ (vsrd): Likewise. -+ (vsrad): Likewise. -+ (vsubudm): Likewise. -+ (vcmpequd): Likewise. -+ (vcmpgtsd): Likewise. -+ (vcmpgtud): Likewise. -+ (vcmpequd_p): Likewise. -+ (vcmpgtsd_p): Likewise. -+ (vcmpgtud_p): Likewise. -+ (vupkhsw): Likewise. -+ (vupklsw): Likewise. -+ (vaddudm): Likewise. -+ (vmaxsd): Likewise. -+ (vmaxud): Likewise. -+ (vminsd): Likewise. -+ (vminud): Likewise. -+ (vpksdss): Likewise. -+ (vpksdus): Likewise. -+ (vpkudum): Likewise. -+ (vpkudus): Likewise. -+ (vrld): Likewise. -+ (vsld): Likewise. -+ (vsrad): Likewise. -+ (vsrd): Likewise. -+ (vsubudm): Likewise. ++ PR tree-optimization/61684 ++ * tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure ++ rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it. + -+ * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add -+ support for power8 V2DI instructions. ++2014-06-30 Thomas Preud'homme <thomas.preudhomme@arm.com> + -+ * config/rs6000/altivec.md (UNSPEC_VPKUHUM): Add support for -+ power8 V2DI instructions. Combine pack and unpack insns to use an -+ iterator for each mode. Check whether a particular mode supports -+ Altivec instructions instead of just checking TARGET_ALTIVEC. -+ (UNSPEC_VPKUWUM): Likewise. -+ (UNSPEC_VPKSHSS): Likewise. -+ (UNSPEC_VPKSWSS): Likewise. -+ (UNSPEC_VPKUHUS): Likewise. -+ (UNSPEC_VPKSHUS): Likewise. -+ (UNSPEC_VPKUWUS): Likewise. -+ (UNSPEC_VPKSWUS): Likewise. -+ (UNSPEC_VPACK_SIGN_SIGN_SAT): Likewise. -+ (UNSPEC_VPACK_SIGN_UNS_SAT): Likewise. -+ (UNSPEC_VPACK_UNS_UNS_SAT): Likewise. -+ (UNSPEC_VPACK_UNS_UNS_MOD): Likewise. -+ (UNSPEC_VUPKHSB): Likewise. -+ (UNSPEC_VUNPACK_HI_SIGN): Likewise. -+ (UNSPEC_VUNPACK_LO_SIGN): Likewise. -+ (UNSPEC_VUPKHSH): Likewise. -+ (UNSPEC_VUPKLSB): Likewise. -+ (UNSPEC_VUPKLSH): Likewise. -+ (VI2): Likewise. -+ (VI_char): Likewise. -+ (VI_scalar): Likewise. -+ (VI_unit): Likewise. -+ (VP): Likewise. -+ (VP_small): Likewise. -+ (VP_small_lc): Likewise. -+ (VU_char): Likewise. -+ (add<mode>3): Likewise. -+ (altivec_vaddcuw): Likewise. -+ (altivec_vaddu<VI_char>s): Likewise. -+ (altivec_vadds<VI_char>s): Likewise. -+ (sub<mode>3): Likewise. -+ (altivec_vsubcuw): Likewise. -+ (altivec_vsubu<VI_char>s): Likewise. -+ (altivec_vsubs<VI_char>s): Likewise. -+ (altivec_vavgs<VI_char>): Likewise. -+ (altivec_vcmpbfp): Likewise. -+ (altivec_eq<mode>): Likewise. -+ (altivec_gt<mode>): Likewise. -+ (altivec_gtu<mode>): Likewise. -+ (umax<mode>3): Likewise. -+ (smax<mode>3): Likewise. -+ (umin<mode>3): Likewise. -+ (smin<mode>3): Likewise. -+ (altivec_vpkuhum): Likewise. -+ (altivec_vpkuwum): Likewise. -+ (altivec_vpkshss): Likewise. -+ (altivec_vpkswss): Likewise. -+ (altivec_vpkuhus): Likewise. -+ (altivec_vpkshus): Likewise. -+ (altivec_vpkuwus): Likewise. -+ (altivec_vpkswus): Likewise. -+ (altivec_vpks<VI_char>ss): Likewise. -+ (altivec_vpks<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>us): Likewise. -+ (altivec_vpku<VI_char>um): Likewise. -+ (altivec_vrl<VI_char>): Likewise. -+ (altivec_vsl<VI_char>): Likewise. -+ (altivec_vsr<VI_char>): Likewise. -+ (altivec_vsra<VI_char>): Likewise. -+ (altivec_vsldoi_<mode>): Likewise. -+ (altivec_vupkhsb): Likewise. -+ (altivec_vupkhs<VU_char>): Likewise. -+ (altivec_vupkls<VU_char>): Likewise. -+ (altivec_vupkhsh): Likewise. -+ (altivec_vupklsb): Likewise. -+ (altivec_vupklsh): Likewise. -+ (altivec_vcmpequ<VI_char>_p): Likewise. -+ (altivec_vcmpgts<VI_char>_p): Likewise. -+ (altivec_vcmpgtu<VI_char>_p): Likewise. -+ (abs<mode>2): Likewise. -+ (vec_unpacks_hi_v16qi): Likewise. -+ (vec_unpacks_hi_v8hi): Likewise. -+ (vec_unpacks_lo_v16qi): Likewise. -+ (vec_unpacks_hi_<VP_small_lc>): Likewise. -+ (vec_unpacks_lo_v8hi): Likewise. -+ (vec_unpacks_lo_<VP_small_lc>): Likewise. -+ (vec_pack_trunc_v8h): Likewise. -+ (vec_pack_trunc_v4si): Likewise. -+ (vec_pack_trunc_<mode>): Likewise. -+ -+ * config/rs6000/altivec.h (vec_vaddudm): Add defines for power8 -+ V2DI builtins. -+ (vec_vmaxsd): Likewise. -+ (vec_vmaxud): Likewise. -+ (vec_vminsd): Likewise. -+ (vec_vminud): Likewise. -+ (vec_vpksdss): Likewise. -+ (vec_vpksdus): Likewise. -+ (vec_vpkudum): Likewise. -+ (vec_vpkudus): Likewise. -+ (vec_vrld): Likewise. -+ (vec_vsld): Likewise. -+ (vec_vsrad): Likewise. -+ (vec_vsrd): Likewise. -+ (vec_vsubudm): Likewise. -+ (vec_vupkhsw): Likewise. -+ (vec_vupklsw): Likewise. -+ -+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Add -+ documentation for the power8 crypto builtins. -+ -+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add crypto.md. -+ -+ * config/rs6000/rs6000-builtin.def (BU_P8V_AV_1): Add support -+ macros for defining power8 builtin functions. -+ (BU_P8V_AV_2): Likewise. -+ (BU_P8V_AV_P): Likewise. -+ (BU_P8V_VSX_1): Likewise. -+ (BU_P8V_OVERLOAD_1): Likewise. -+ (BU_P8V_OVERLOAD_2): Likewise. -+ (BU_CRYPTO_1): Likewise. -+ (BU_CRYPTO_2): Likewise. -+ (BU_CRYPTO_3): Likewise. -+ (BU_CRYPTO_OVERLOAD_1): Likewise. -+ (BU_CRYPTO_OVERLOAD_2): Likewise. -+ (XSCVSPDP): Fix typo, point to the correct instruction. -+ (VCIPHER): Add power8 crypto builtins. -+ (VCIPHERLAST): Likewise. -+ (VNCIPHER): Likewise. -+ (VNCIPHERLAST): Likewise. -+ (VPMSUMB): Likewise. -+ (VPMSUMH): Likewise. -+ (VPMSUMW): Likewise. -+ (VPERMXOR_V2DI): Likewise. -+ (VPERMXOR_V4SI: Likewise. -+ (VPERMXOR_V8HI: Likewise. -+ (VPERMXOR_V16QI: Likewise. -+ (VSHASIGMAW): Likewise. -+ (VSHASIGMAD): Likewise. -+ (VPMSUM): Likewise. -+ (VPERMXOR): Likewise. -+ (VSHASIGMA): Likewise. -+ -+ * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define -+ __CRYPTO__ if the crypto instructions are available. -+ (altivec_overloaded_builtins): Add support for overloaded power8 -+ builtins. -+ -+ * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add -+ support for power8 crypto builtins. -+ (builtin_function_type): Likewise. -+ (altivec_init_builtins): Add support for builtins that take vector -+ long long (V2DI) arguments. -+ -+ * config/rs6000/crypto.md: New file, define power8 crypto -+ instructions. -+ -+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * doc/invoke.texi (Option Summary): Add power8 options. -+ (RS/6000 and PowerPC Options): Likewise. -+ -+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Update to use -+ constraints.md instead of rs6000.h. Reorder w* constraints. Add -+ wm, wn, wr documentation. -+ -+ * gcc/config/rs6000/constraints.md (wm): New constraint for VSX -+ registers if direct move instructions are enabled. -+ (wn): New constraint for no registers. -+ (wq): New constraint for quad word even GPR registers. -+ (wr): New constraint if 64-bit instructions are enabled. -+ (wv): New constraint if power8 vector instructions are enabled. -+ (wQ): New constraint for quad word memory locations. -+ -+ * gcc/config/rs6000/predicates.md (const_0_to_15_operand): New -+ constraint for 0..15 for crypto instructions. -+ (gpc_reg_operand): If VSX allow registers in VSX registers as well -+ as GPR and floating point registers. -+ (int_reg_operand): New predicate to match only GPR registers. -+ (base_reg_operand): New predicate to match base registers. -+ (quad_int_reg_operand): New predicate to match even GPR registers -+ for quad memory operations. -+ (vsx_reg_or_cint_operand): New predicate to allow vector logical -+ operations in both GPR and VSX registers. -+ (quad_memory_operand): New predicate for quad memory operations. -+ (reg_or_indexed_operand): New predicate for direct move support. -+ -+ * gcc/config/rs6000/rs6000-cpus.def (ISA_2_5_MASKS_EMBEDDED): -+ Inherit from ISA_2_4_MASKS, not ISA_2_2_MASKS. -+ (ISA_2_7_MASKS_SERVER): New mask for ISA 2.07 (i.e. power8). -+ (POWERPC_MASKS): Add power8 options. -+ (power8 cpu): Use ISA_2_7_MASKS_SERVER instead of specifying the -+ various options. -+ -+ * gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros): -+ Define _ARCH_PWR8 and __POWER8_VECTOR__ for power8. -+ -+ * gcc/config/rs6000/rs6000.opt (-mvsx-timode): Add documentation. -+ (-mpower8-fusion): New power8 options. -+ (-mpower8-fusion-sign): Likewise. -+ (-mpower8-vector): Likewise. -+ (-mcrypto): Likewise. -+ (-mdirect-move): Likewise. -+ (-mquad-memory): Likewise. -+ -+ * gcc/config/rs6000/rs6000.c (power8_cost): Initial definition for -+ power8. -+ (rs6000_hard_regno_mode_ok): Make PTImode only match even GPR -+ registers. -+ (rs6000_debug_reg_print): Print the base register class if -+ -mdebug=reg. -+ (rs6000_debug_vector_unit): Add p8_vector. -+ (rs6000_debug_reg_global): If -mdebug=reg, print power8 constraint -+ definitions. Also print fusion state. -+ (rs6000_init_hard_regno_mode_ok): Set up power8 constraints. -+ (rs6000_builtin_mask_calculate): Add power8 builtin support. -+ (rs6000_option_override_internal): Add support for power8. -+ (rs6000_common_init_builtins): Add debugging for skipped builtins -+ if -mdebug=builtin. -+ (rs6000_adjust_cost): Add power8 support. -+ (rs6000_issue_rate): Likewise. -+ (insn_must_be_first_in_group): Likewise. -+ (insn_must_be_last_in_group): Likewise. -+ (force_new_group): Likewise. -+ (rs6000_register_move_cost): Likewise. -+ (rs6000_opt_masks): Likewise. -+ -+ * config/rs6000/rs6000.h (ASM_CPU_POWER8_SPEC): If we don't have a -+ power8 capable assembler, default to power7 options. -+ (TARGET_DIRECT_MOVE): Likewise. -+ (TARGET_CRYPTO): Likewise. -+ (TARGET_P8_VECTOR): Likewise. -+ (VECTOR_UNIT_P8_VECTOR_P): Define power8 vector support. -+ (VECTOR_UNIT_VSX_OR_P8_VECTOR_P): Likewise. -+ (VECTOR_MEM_P8_VECTOR_P): Likewise. -+ (VECTOR_MEM_VSX_OR_P8_VECTOR_P): Likewise. -+ (VECTOR_MEM_ALTIVEC_OR_VSX_P): Likewise. -+ (TARGET_XSCVDPSPN): Likewise. -+ (TARGET_XSCVSPDPN): Likewsie. -+ (TARGET_SYNC_HI_QI): Likewise. -+ (TARGET_SYNC_TI): Likewise. -+ (MASK_CRYPTO): Likewise. -+ (MASK_DIRECT_MOVE): Likewise. -+ (MASK_P8_FUSION): Likewise. -+ (MASK_P8_VECTOR): Likewise. -+ (REG_ALLOC_ORDER): Move fr13 to be lower in priority so that the -+ TFmode temporary used by some of the direct move instructions to -+ get two FP temporary registers does not force creation of a stack -+ frame. -+ (VLOGICAL_REGNO_P): Allow vector logical operations in GPRs. -+ (MODES_TIEABLE_P): Move the VSX tests above the Altivec tests so -+ that any VSX registers are tieable, even if they are also an -+ Altivec vector mode. -+ (r6000_reg_class_enum): Add wm, wr, wv constraints. -+ (RS6000_BTM_P8_VECTOR): Power8 builtin support. -+ (RS6000_BTM_CRYPTO): Likewise. -+ (RS6000_BTM_COMMON): Likewise. -+ -+ * config/rs6000/rs6000.md (cpu attribute): Add power8. -+ * config/rs6000/rs6000-opts.h (PROCESSOR_POWER8): Likewise. -+ (enum rs6000_vector): Add power8 vector support. -+ -+ -+ Backport from mainline -+ 2013-03-20 Pat Haugen <pthaugen@us.ibm.com> -+ -+ * config/rs6000/predicates.md (indexed_address, update_address_mem -+ update_indexed_address_mem): New predicates. -+ * config/rs6000/vsx.md (vsx_extract_<mode>_zero): Set correct "type" -+ attribute for load/store instructions. -+ * config/rs6000/dfp.md (movsd_store): Likewise. -+ (movsd_load): Likewise. -+ * config/rs6000/rs6000.md (zero_extend<mode>di2_internal1): Likewise. -+ (unnamed HI->DI extend define_insn): Likewise. -+ (unnamed SI->DI extend define_insn): Likewise. -+ (unnamed QI->SI extend define_insn): Likewise. -+ (unnamed QI->HI extend define_insn): Likewise. -+ (unnamed HI->SI extend define_insn): Likewise. -+ (unnamed HI->SI extend define_insn): Likewise. -+ (extendsfdf2_fpr): Likewise. -+ (movsi_internal1): Likewise. -+ (movsi_internal1_single): Likewise. -+ (movhi_internal): Likewise. -+ (movqi_internal): Likewise. -+ (movcc_internal1): Correct mnemonic for stw insn. Set correct "type" -+ attribute for load/store instructions. -+ (mov<mode>_hardfloat): Set correct "type" attribute for load/store -+ instructions. -+ (mov<mode>_softfloat): Likewise. -+ (mov<mode>_hardfloat32): Likewise. -+ (mov<mode>_hardfloat64): Likewise. -+ (mov<mode>_softfloat64): Likewise. -+ (movdi_internal32): Likewise. -+ (movdi_internal64): Likewise. -+ (probe_stack_<mode>): Likewise. -+ -+ Backport from mainline -+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * config/rs6000/vector.md (VEC_R): Add 32-bit integer, binary -+ floating point, and decimal floating point to reload iterator. -+ -+ * config/rs6000/constraints.md (wl constraint): New constraints to -+ return FLOAT_REGS if certain options are used to reduce the number -+ of separate patterns that exist in the file. -+ (wx constraint): Likewise. -+ (wz constraint): Likewise. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): If -+ -mdebug=reg, print wg, wl, wx, and wz constraints. -+ (rs6000_init_hard_regno_mode_ok): Initialize new constraints. -+ Initialize the reload functions for 64-bit binary/decimal floating -+ point types. -+ (reg_offset_addressing_ok_p): If we are on a power7 or later, use -+ LFIWZX and STFIWX to load/store 32-bit decimal types, and don't -+ create the buffer on the stack to overcome not having a 32-bit -+ load and store. -+ (rs6000_emit_move): Likewise. -+ (rs6000_secondary_memory_needed_rtx): Likewise. -+ (rs6000_alloc_sdmode_stack_slot): Likewise. -+ (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f -+ via xxlxor, just like DFmode 0.0. -+ -+ * config/rs6000/rs6000.h (TARGET_NO_SDMODE_STACK): New macro) -+ (define as 1 if we are running on a power7 or newer. -+ (enum r6000_reg_class_enum): Add new constraints. -+ -+ * config/rs6000/dfp.md (movsd): Delete, combine with binary -+ floating point moves in rs6000.md. Combine power6x (mfpgpr) moves -+ with other moves by using conditional constraits (wg). Use LFIWZX -+ and STFIWX for loading SDmode on power7. Use xxlxor to create -+ 0.0f. -+ (movsd splitter): Likewise. -+ (movsd_hardfloat): Likewise. -+ (movsd_softfloat): Likewise. -+ -+ * config/rs6000/rs6000.md (FMOVE32): New iterators to combine -+ binary and decimal floating point moves. -+ (fmove_ok): New attributes to combine binary and decimal floating -+ point moves, and to combine power6x (mfpgpr) moves along normal -+ floating moves. -+ (real_value_to_target): Likewise. -+ (f32_lr): Likewise. -+ (f32_lm): Likewise. -+ (f32_li): Likewise. -+ (f32_sr): Likewise. -+ (f32_sm): Likewise. -+ (f32_si): Likewise. -+ (movsf): Combine binary and decimal floating point moves. Combine -+ power6x (mfpgpr) moves with other moves by using conditional -+ constraits (wg). Use LFIWZX and STFIWX for loading SDmode on -+ power7. -+ (mov<mode> for SFmode/SDmode); Likewise. -+ (SFmode/SDmode splitters): Likewise. -+ (movsf_hardfloat): Likewise. -+ (mov<mode>_hardfloat for SFmode/SDmode): Likewise. -+ (movsf_softfloat): Likewise. -+ (mov<mode>_softfloat for SFmode/SDmode): Likewise. -+ -+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wl) -+ (wx and wz constraints. -+ -+ * config/rs6000/constraints.md (wg constraint): New constraint to -+ return FLOAT_REGS if -mmfpgpr (power6x) was used. -+ -+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add wg -+ constraint. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): If -+ -mdebug=reg, print wg, wl, wx, and wz constraints. -+ (rs6000_init_hard_regno_mode_ok): Initialize new constraints. -+ Initialize the reload functions for 64-bit binary/decimal floating -+ point types. -+ (reg_offset_addressing_ok_p): If we are on a power7 or later, use -+ LFIWZX and STFIWX to load/store 32-bit decimal types, and don't -+ create the buffer on the stack to overcome not having a 32-bit -+ load and store. -+ (rs6000_emit_move): Likewise. -+ (rs6000_secondary_memory_needed_rtx): Likewise. -+ (rs6000_alloc_sdmode_stack_slot): Likewise. -+ (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f -+ via xxlxor, just like DFmode 0.0. -+ -+ -+ * config/rs6000/dfp.md (movdd): Delete, combine with binary -+ floating point moves in rs6000.md. Combine power6x (mfpgpr) moves -+ with other moves by using conditional constraits (wg). Use LFIWZX -+ and STFIWX for loading SDmode on power7. -+ (movdd splitters): Likewise. -+ (movdd_hardfloat32): Likewise. -+ (movdd_softfloat32): Likewise. -+ (movdd_hardfloat64_mfpgpr): Likewise. -+ (movdd_hardfloat64): Likewise. -+ (movdd_softfloat64): Likewise. -+ -+ * config/rs6000/rs6000.md (FMOVE64): New iterators to combine -+ 64-bit binary and decimal floating point moves. -+ (FMOVE64X): Likewise. -+ (movdf): Combine 64-bit binary and decimal floating point moves. -+ Combine power6x (mfpgpr) moves with other moves by using -+ conditional constraits (wg). -+ (mov<mode> for DFmode/DDmode): Likewise. -+ (DFmode/DDmode splitters): Likewise. -+ (movdf_hardfloat32): Likewise. -+ (mov<mode>_hardfloat32 for DFmode/DDmode): Likewise. -+ (movdf_softfloat32): Likewise. -+ (movdf_hardfloat64_mfpgpr): Likewise. -+ (movdf_hardfloat64): Likewise. -+ (mov<mode>_hardfloat64 for DFmode/DDmode): Likewise. -+ (movdf_softfloat64): Likewise. -+ (mov<mode>_softfloat64 for DFmode/DDmode): Likewise. -+ (reload_<mode>_load): Move to later in the file so they aren't in -+ the middle of the floating point move insns. -+ (reload_<mode>_store): Likewise. -+ -+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wg -+ constraint. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print out wg -+ constraint if -mdebug=reg. -+ (rs6000_initi_hard_regno_mode_ok): Enable wg constraint if -+ -mfpgpr. Enable using dd reload support if needed. -+ -+ * config/rs6000/dfp.md (movtd): Delete, combine with 128-bit -+ binary and decimal floating point moves in rs6000.md. -+ (movtd_internal): Likewise. -+ -+ * config/rs6000/rs6000.md (FMOVE128): Combine 128-bit binary and -+ decimal floating point moves. -+ (movtf): Likewise. -+ (movtf_internal): Likewise. -+ (mov<mode>_internal, TDmode/TFmode): Likewise. -+ (movtf_softfloat): Likewise. -+ (mov<mode>_softfloat, TDmode/TFmode): Likewise. -+ -+ * config/rs6000/rs6000.md (movdi_mfpgpr): Delete, combine with -+ movdi_internal64, using wg constraint for move direct operations. -+ (movdi_internal64): Likewise. -+ -+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print -+ MODES_TIEABLE_P for selected modes. Print the numerical value of -+ the various virtual registers. Use GPR/FPR first/last values) -+ (instead of hard coding the register numbers. Print which modes -+ have reload functions registered. -+ (rs6000_option_override_internal): If -mdebug=reg, trace the -+ options settings before/after setting cpu, target and subtarget -+ settings. -+ (rs6000_secondary_reload_trace): Improve the RTL dump for -+ -mdebug=addr and for secondary reload failures in -+ rs6000_secondary_reload_inner. -+ (rs6000_secondary_reload_fail): Likewise. -+ (rs6000_secondary_reload_inner): Likewise. -+ -+ * config/rs6000/rs6000.md (FIRST_GPR_REGNO): Add convenience -+ macros for first/last GPR and FPR registers. -+ (LAST_GPR_REGNO): Likewise. -+ (FIRST_FPR_REGNO): Likewise. -+ (LAST_FPR_REGNO): Likewise. -+ -+ * config/rs6000/vector.md (mul<mode>3): Use the combined macro -+ VECTOR_UNIT_ALTIVEC_OR_VSX_P instead of separate calls to -+ VECTOR_UNIT_ALTIVEC_P and VECTOR_UNIT_VSX_P. -+ (vcond<mode><mode>): Likewise. -+ (vcondu<mode><mode>): Likewise. -+ (vector_gtu<mode>): Likewise. -+ (vector_gte<mode>): Likewise. -+ (xor<mode>3): Don't allow logical operations on TImode in 32-bit -+ to prevent the compiler from converting DImode operations to -+ TImode. -+ (ior<mode>3): Likewise. -+ (and<mode>3): Likewise. -+ (one_cmpl<mode>2): Likewise. -+ (nor<mode>3): Likewise. -+ (andc<mode>3): Likewise. -+ -+ * config/rs6000/constraints.md (wt constraint): New constraint -+ that returns VSX_REGS if TImode is allowed in VSX registers. -+ -+ * config/rs6000/predicates.md (easy_fp_constant): 0.0f is an easy -+ constant under VSX. -+ -+ * config/rs6000/rs6000-modes.def (PTImode): Define, PTImode is -+ similar to TImode, but it is restricted to being in the GPRs. -+ -+ * config/rs6000/rs6000.opt (-mvsx-timode): New switch to allow -+ TImode to occupy a single VSX register. -+ -+ * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Default to -+ -mvsx-timode for power7/power8. -+ (power7 cpu): Likewise. -+ (power8 cpu): Likewise. -+ -+ * config/rs6000/rs6000.c (rs6000_hard_regno_nregs_internal): Make -+ sure that TFmode/TDmode take up two registers if they are ever -+ allowed in the upper VSX registers. -+ (rs6000_hard_regno_mode_ok): If -mvsx-timode, allow TImode in VSX -+ registers. -+ (rs6000_init_hard_regno_mode_ok): Likewise. -+ (rs6000_debug_reg_global): Add debugging for PTImode and wt -+ constraint. Print if LRA is turned on. -+ (rs6000_option_override_internal): Give an error if -mvsx-timode -+ and VSX is not enabled. -+ (invalid_e500_subreg): Handle PTImode, restricting it to GPRs. If -+ -mvsx-timode, restrict TImode to reg+reg addressing, and PTImode -+ to reg+offset addressing. Use PTImode when checking offset -+ addresses for validity. -+ (reg_offset_addressing_ok_p): Likewise. -+ (rs6000_legitimate_offset_address_p): Likewise. -+ (rs6000_legitimize_address): Likewise. -+ (rs6000_legitimize_reload_address): Likewise. -+ (rs6000_legitimate_address_p): Likewise. -+ (rs6000_eliminate_indexed_memrefs): Likewise. -+ (rs6000_emit_move): Likewise. -+ (rs6000_secondary_reload): Likewise. -+ (rs6000_secondary_reload_inner): Handle PTImode. Allow 64-bit -+ reloads to fpr registers to continue to use reg+offset addressing) -+ (but 64-bit reloads to altivec registers need reg+reg addressing. -+ Drop test for PRE_MODIFY, since VSX loads/stores no longer support -+ it. Treat LO_SUM like a PLUS operation. -+ (rs6000_secondary_reload_class): If type is 64-bit, prefer to use -+ FLOAT_REGS instead of VSX_RGS to allow use of reg+offset -+ addressing. -+ (rs6000_cannot_change_mode_class): Do not allow TImode in VSX -+ registers to share a register with a smaller sized type, since VSX -+ puts scalars in the upper 64-bits. -+ (print_operand): Add support for PTImode. -+ (rs6000_register_move_cost): Use VECTOR_MEM_VSX_P instead of -+ VECTOR_UNIT_VSX_P to catch types that can be loaded in VSX -+ registers, but don't have arithmetic support. -+ (rs6000_memory_move_cost): Add test for VSX. -+ (rs6000_opt_masks): Add -mvsx-timode. -+ -+ * config/rs6000/vsx.md (VSm): Change to use 64-bit aligned moves -+ for TImode. -+ (VSs): Likewise. -+ (VSr): Use wt constraint for TImode. -+ (VSv): Drop TImode support. -+ (vsx_movti): Delete, replace with versions for 32-bit and 64-bit. -+ (vsx_movti_64bit): Likewise. -+ (vsx_movti_32bit): Likewise. -+ (vec_store_<mode>): Use VSX iterator instead of vector iterator. -+ (vsx_and<mode>3): Delete use of '?' constraint on inputs, just put -+ one '?' on the appropriate output constraint. Do not allow TImode -+ logical operations on 32-bit systems. -+ (vsx_ior<mode>3): Likewise. -+ (vsx_xor<mode>3): Likewise. -+ (vsx_one_cmpl<mode>2): Likewise. -+ (vsx_nor<mode>3): Likewise. -+ (vsx_andc<mode>3): Likewise. -+ (vsx_concat_<mode>): Likewise. -+ (vsx_xxpermdi_<mode>): Fix thinko for non V2DF/V2DI modes. -+ -+ * config/rs6000/rs6000.h (MASK_VSX_TIMODE): Map from -+ OPTION_MASK_VSX_TIMODE. -+ (enum rs6000_reg_class_enum): Add RS6000_CONSTRAINT_wt. -+ (STACK_SAVEAREA_MODE): Use PTImode instead of TImode. -+ -+ * config/rs6000/rs6000.md (INT mode attribute): Add PTImode. -+ (TI2 iterator): New iterator for TImode, PTImode. -+ (wd mode attribute): Add values for vector types. -+ (movti_string): Replace TI move operations with operations for -+ TImode and PTImode. Add support for TImode being allowed in VSX -+ registers. -+ (mov<mode>_string, TImode/PTImode): Likewise. -+ (movti_ppc64): Likewise. -+ (mov<mode>_ppc64, TImode/PTImode): Likewise. -+ (TI mode splitters): Likewise. -+ -+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wt -+ constraint. -+ -+2014-04-04 Richard Biener <rguenther@suse.de> -+ -+ * tree-ssanames.c (make_ssa_name_fn): Fix assert. -+ -+2014-04-02 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ -+ * config/s390/s390.c (s390_expand_insv): Use GET_MODE_BITSIZE. -+ -+2014-04-01 Richard Biener <rguenther@suse.de> -+ -+ * gimple.h (struct gimple_statement_base): Align subcode to -+ 16 bits. -+ -+2014-04-01 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ * doc/invoke.texi (mapp-regs): Clarify. -+ -+2014-03-31 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR rtl-optimization/60700 -+ Backport from mainline -+ 2013-07-30 Zhenqiang Chen <zhenqiang.chen@linaro.org> -+ -+ PR rtl-optimization/57637 -+ * function.c (move_insn_for_shrink_wrap): Also check the -+ GEN set of the LIVE problem for the liveness analysis -+ if it exists, otherwise give up. -+ -+2014-03-30 Kaz Kojima <kkojima@gcc.gnu.org> -+ -+ Backport from mainline -+ 2014-03-19 Kaz Kojima <kkojima@gcc.gnu.org> -+ -+ PR target/60039 -+ * config/sh/sh.md (udivsi3_i1): Clobber R1 register. -+ -+2014-03-26 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/60419 -+ * ipa.c (symtab_remove_unreachable_nodes): Clear thunk and -+ alias flags of nodes in the border. -+ -+2014-03-26 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR rtl-optimization/60452 -+ * rtlanal.c (rtx_addr_can_trap_p_1): Fix head comment. -+ <case REG>: Return 1 for invalid offsets from the frame pointer. -+ -+2014-03-24 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60429 -+ * tree-ssa-structalias.c (get_constraint_for_ptr_offset): Remove -+ duplicated line. -+ -+2014-03-23 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR rtl-optimization/60601 -+ * bb-reorder.c (fix_up_fall_thru_edges): Test EDGE_FALLTHRU everywhere. -+ -+ * gcc.c (eval_spec_function): Initialize save_growing_value. -+ -+2014-03-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/60568 -+ * config/i386/i386.c (x86_output_mi_thunk): Surround UNSPEC_GOT -+ into CONST, put pic register as first operand of PLUS. Use -+ gen_const_mem for both 32-bit and 64-bit PIC got loads. -+ -+2014-03-20 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * config/sparc/sparc.c (sparc_do_work_around_errata): Implement work -+ around for store forwarding issue in the FPU on the UT699. -+ * config/sparc/sparc.md (in_branch_delay): Return false for single FP -+ loads and operations if -mfix-ut699 is specified. -+ (divtf3_hq): Tweak attribute. -+ (sqrttf2_hq): Likewise. -+ -+2014-03-18 Kai Tietz <ktietz@redhat.com> -+ -+ PR rtl-optimization/56356 -+ * sdbout.c (sdbout_parms): Verify that parms' -+ incoming argument is valid. -+ (sdbout_reg_parms): Likewise. -+ -+2014-03-18 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * config/sparc/sparc.c (sparc_do_work_around_errata): Speed up and use -+ proper constant for the store mode. -+ -+2014-03-17 Mikael Pettersson <mikpelinux@gmail.com> -+ Committed by Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline: -+ -+ 2013-06-20 Joern Rennecke <joern.rennecke@embecosm.com> -+ -+ PR rtl-optimization/57425 -+ PR rtl-optimization/57569 -+ * alias.c (write_dependence_p): Remove parameters mem_mode and -+ canon_mem_addr. Add parameters x_mode, x_addr and x_canonicalized. -+ Changed all callers. -+ (canon_anti_dependence): Get comments and semantics in sync. -+ Add parameter mem_canonicalized. Changed all callers. -+ * rtl.h (canon_anti_dependence): Update prototype. -+ -+ 2013-06-16 Joern Rennecke <joern.rennecke@embecosm.com> -+ -+ PR rtl-optimization/57425 -+ PR rtl-optimization/57569 -+ * alias.c (write_dependence_p): Add new parameters mem_mode, -+ canon_mem_addr and mem_canonicalized. Change type of writep to bool. -+ Changed all callers. -+ (canon_anti_dependence): New function. -+ * cse.c (check_dependence): Use canon_anti_dependence. -+ * cselib.c (cselib_invalidate_mem): Likewise. -+ * rtl.h (canon_anti_dependence): Declare. -+ -+2014-03-17 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-03-11 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60429 -+ PR tree-optimization/60485 -+ * tree-ssa-structalias.c (set_union_with_increment): Properly -+ take into account all fields that overlap the shifted vars. -+ (do_sd_constraint): Likewise. -+ (do_ds_constraint): Likewise. -+ (get_constraint_for_ptr_offset): Likewise. -+ -+2014-03-15 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * config/sparc/sparc-protos.h (tls_call_delay): Delete. -+ (eligible_for_call_delay): New prototype. -+ * config/sparc/sparc.c (tls_call_delay): Rename into... -+ (eligible_for_call_delay): ...this. Return false if the instruction -+ cannot be put in the delay slot of a branch. -+ (eligible_for_restore_insn): Simplify. -+ (eligible_for_return_delay): Return false if the instruction cannot be -+ put in the delay slot of a branch and simplify. -+ (eligible_for_sibcall_delay): Return false if the instruction cannot be -+ put in the delay slot of a branch. -+ * config/sparc/sparc.md (fix_ut699): New attribute. -+ (tls_call_delay): Delete. -+ (in_call_delay): Reimplement. -+ (eligible_for_sibcall_delay): Rename into... -+ (in_sibcall_delay): ...this. -+ (eligible_for_return_delay): Rename into... -+ (in_return_delay): ...this. -+ (in_branch_delay): Reimplement. -+ (in_uncond_branch_delay): Delete. -+ (in_annul_branch_delay): Delete. -+ -+2014-03-14 Georg-Johann Lay <avr@gjlay.de> -+ -+ Backport from 2014-03-14 trunk r208562. -+ -+ PR target/59396 -+ * config/avr/avr.c (avr_set_current_function): Pass function name -+ through default_strip_name_encoding before sanity checking instead -+ of skipping the first char of the assembler name. -+ -+2014-03-13 Georg-Johann Lay <avr@gjlay.de> -+ -+ Backport from 2014-03-13 trunk r208532. -+ -+ PR target/60486 -+ * config/avr/avr.c (avr_out_plus): Swap cc_plus and cc_minus in -+ calls of avr_out_plus_1. -+ -+2014-03-13 Joey Ye <joey.ye@arm.com> -+ -+ Backport from mainline -+ 2014-03-12 Thomas Preud'homme <thomas.preudhomme@arm.com> -+ -+ PR tree-optimization/60454 -+ * tree-ssa-math-opts.c (find_bswap_1): Fix bswap detection. -+ -+2014-03-06 Matthias Klose <doko@ubuntu.com> -+ -+ * Makefile.in (s-mlib): Only pass MULTIARCH_DIRNAME if -+ MULTILIB_OSDIRNAMES is not defined. -+ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/60276 -+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Avoid -+ a -Wsign-compare warning. -+ -+ * Makefile.in (tree-ssa-uninit.o): Depend on $(PARAMS_H). -+ -+ Backport from mainline -+ 2014-02-21 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/56490 -+ * params.def (PARAM_UNINIT_CONTROL_DEP_ATTEMPTS): New param. -+ * tree-ssa-uninit.c: Include params.h. -+ (compute_control_dep_chain): Add num_calls argument, return false -+ if it exceed PARAM_UNINIT_CONTROL_DEP_ATTEMPTS param, pass -+ num_calls to recursive call. -+ (find_predicates): Change dep_chain into normal array, add num_calls -+ variable and adjust compute_control_dep_chain caller. -+ (find_def_preds): Likewise. -+ -+ 2014-02-13 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/43546 -+ * expr.c (compress_float_constant): If x is a hard register, -+ extend into a pseudo and then move to x. -+ -+ 2014-02-11 Richard Henderson <rth@redhat.com> -+ Jakub Jelinek <jakub@redhat.com> -+ -+ PR debug/59776 -+ * tree-sra.c (load_assign_lhs_subreplacements): Add VIEW_CONVERT_EXPR -+ around drhs if type conversion to lacc->type is not useless. -+ -+ 2014-02-08 Jakub Jelinek <jakub@redhat.com> -+ -+ PR ipa/60026 -+ * ipa-cp.c (determine_versionability): Fail at -O0 -+ or __attribute__((optimize (0))) or -fno-ipa-cp functions. -+ * tree-sra.c (ipa_sra_preliminary_function_checks): Similarly. -+ -+ 2014-02-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/60062 -+ * tree.h (opts_for_fn): New inline function. -+ (opt_for_fn): Define. -+ * config/i386/i386.c (ix86_function_regparm): Use -+ opt_for_fn (decl, optimize) instead of optimize. -+ -+ 2014-02-05 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/57499 -+ * tree-eh.c (cleanup_empty_eh): Bail out on totally empty -+ bb with no successors. -+ -+2014-03-04 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60382 -+ * tree-vect-loop.c (vect_is_simple_reduction_1): Do not consider -+ dead PHIs a reduction. -+ -+2014-02-25 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-02-21 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60276 -+ * tree-vectorizer.h (struct _stmt_vec_info): Add min_neg_dist field. -+ (STMT_VINFO_MIN_NEG_DIST): New macro. -+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Record -+ STMT_VINFO_MIN_NEG_DIST. -+ * tree-vect-stmts.c (vectorizable_load): Verify if assumptions -+ made for negative dependence distances still hold. -+ -+2014-02-25 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-02-21 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/60291 -+ * tree-ssa-live.c (mark_all_vars_used_1): Do not walk -+ DECL_INITIAL for globals not in the current function context. -+ -+ 2014-02-20 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/60221 -+ * tree-eh.c (execute_cleanup_eh_1): Also cleanup empty EH -+ regions at -O0. -+ -+ 2014-02-14 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60183 -+ * tree-ssa-phiprop.c (propagate_with_phi): Avoid speculating -+ loads. -+ (tree_ssa_phiprop): Calculate and free post-dominators. -+ -+2014-02-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> -+ -+ PR target/55426 -+ * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Allow 128 to 64-bit -+ conversions. -+ -+2014-02-24 John David Anglin <danglin@gcc.gnu.org> -+ -+ * config/pa/pa.c (pa_output_move_double): Don't valididate when -+ adjusting offsetable addresses. -+ -+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * config/microblaze/microblaze.md: Correct ashrsi_reg / lshrsi_reg names -+ -+2014-02-23 Edgar E. Iglesias <edgar.iglesias@xilinx.com> -+ -+ * config/microblaze/microblaze.h: Remove SECONDARY_MEMORY_NEEDED -+ definition. -+ -+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * /config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk -+ and define TARGET_ASM_OUTPUT_MI_THUNK and -+ TARGET_ASM_CAN_OUTPUT_MI_THUNK. -+ -+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * config/microblaze/predicates.md: Add cmp_op predicate. -+ * config/microblaze/microblaze.md: Add branch_compare instruction -+ which uses cmp_op predicate and emits cmp insn before branch. -+ * config/microblaze/microblaze.c (microblaze_emit_compare): Rename -+ to microblaze_expand_conditional_branch and consolidate logic. -+ (microblaze_expand_conditional_branch): emit branch_compare -+ insn instead of handling cmp op separate from branch insn. -+ -+2014-02-21 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/55260 -+ * ipa-cp.c (cgraph_edge_brings_all_agg_vals_for_node): Uce correct -+ info when checking whether lattices are bottom. -+ -+2014-02-21 Jakub Jelinek <jakub@redhat.com> -+ -+ * config/i386/i386.c (ix86_expand_vec_perm): Use V8SImode -+ mode for mask of V8SFmode permutation. -+ -+2014-02-20 Richard Henderson <rth@redhat.com> -+ -+ PR c++/60272 -+ * builtins.c (expand_builtin_atomic_compare_exchange): Conditionalize -+ on failure the store back into EXPECT. Always make a new pseudo for -+ OLDVAL. -+ -+2014-02-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/57896 -+ * config/i386/i386.c (expand_vec_perm_interleave2): Don't call -+ gen_reg_rtx if d->testing_p. -+ (expand_vec_perm_pshufb2, expand_vec_perm_even_odd_1, -+ expand_vec_perm_broadcast_1): Return early if d->testing_p and -+ we will certainly return true. -+ -+2014-02-20 Richard Biener <rguenther@suse.de> -+ -+ * tree-cfg.c (replace_uses_by): Mark altered BBs before -+ doing the substitution. -+ -+2014-02-19 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-02-19 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/60207 -+ * config/i386/i386.c (construct_container): Remove TFmode check -+ for X86_64_INTEGER_CLASS. -+ -+2014-02-19 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-02-19 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59794 -+ * config/i386/i386.c (type_natural_mode): Warn for ABI changes -+ only when -Wpsabi is enabled. -+ -+2014-02-19 Terry Guo <terry.guo@arm.com> -+ -+ Backport from mainline -+ 2014-02-08 Terry Guo <terry.guo@arm.com> ++ Backport from Mainline ++ 2014-06-20 Jakub Jelinek <jakub@redhat.com> ++ 2014-06-11 Thomas Preud'homme <thomas.preudhomme@arm.com> + -+ * doc/invoke.texi: Document ARM -march=armv7e-m. ++ PR tree-optimization/61306 ++ * tree-ssa-math-opts.c (struct symbolic_number): Store type of ++ expression instead of its size. ++ (do_shift_rotate): Adapt to change in struct symbolic_number. Return ++ false to prevent optimization when the result is unpredictable due to ++ arithmetic right shift of signed type with highest byte is set. ++ (verify_symbolic_number_p): Adapt to change in struct symbolic_number. ++ (find_bswap_1): Likewise. Return NULL to prevent optimization when the ++ result is unpredictable due to sign extension. ++ (find_bswap): Adapt to change in struct symbolic_number. + -+2014-02-18 Kai Tietz <ktietz@redhat.com> ++2014-06-27 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline -+ 2014-02-18 Kai Tietz <ktietz@redhat.com> ++ 2014-06-26 Uros Bizjak <ubizjak@gmail.com> + -+ PR target/60193 -+ * config/i386/i386.c (ix86_expand_prologue): Use -+ rax register as displacement for restoring %r10, %rax. -+ Additional fix wrong offset for restoring both-registers. ++ PR target/61586 ++ * config/alpha/alpha.c (alpha_handle_trap_shadows): Handle BARRIER RTX. + -+2014-02-18 Eric Botcazou <ebotcazou@adacore.com> ++2014-06-26 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + -+ * ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous -+ assertion with conditional return. ++ PR target/61542 ++ * config/rs6000/vsx.md (vsx_extract_v4sf): Fix bug with element ++ extraction other than index 3. + -+2014-02-18 Jakub Jelinek <jakub@redhat.com> -+ Uros Bizjak <ubizjak@gmail.com> ++2014-06-24 Jakub Jelinek <jakub@redhat.com> + -+ PR driver/60233 -+ * config/i386/driver-i386.c (host_detect_local_cpu): If -+ YMM state is not saved by the OS, also clear has_f16c. Move -+ CPUID 0x80000001 handling before YMM state saving checking. ++ PR target/61570 ++ * config/i386/driver-i386.c (host_detect_local_cpu): For unknown ++ model family 6 CPU with has_longmode never use a CPU without ++ 64-bit support. + -+2014-02-14 Roland McGrath <mcgrathr@google.com> -+ -+ * configure.ac (HAVE_AS_IX86_UD2): New test for 'ud2' mnemonic. -+ * configure: Regenerated. -+ * config.in: Regenerated. -+ * config/i386/i386.md (trap) [HAVE_AS_IX86_UD2]: Use the mnemonic -+ instead of ASM_SHORT. -+ -+2014-02-13 Uros Bizjak <ubizjak@gmail.com> ++2014-06-20 Chung-Lin Tang <cltang@codesourcery.com> + + Backport from mainline -+ 2014-02-13 Uros Bizjak <ubizjak@gmail.com> + -+ * config/i386/sse.md (xop_vmfrcz<mode>2): Generate const0 in -+ operands[2], not operands[3]. ++ 2014-06-20 Julian Brown <julian@codesourcery.com> ++ Chung-Lin Tang <cltang@codesourcery.com> + -+2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com> ++ * config/arm/arm.c (arm_output_mi_thunk): Fix offset for ++ TARGET_THUMB1_ONLY. Add comments. + -+ * config/s390/s390.c (s390_asm_output_function_label): Fix crash -+ caused by bad second argument to warning_at() with -mhotpatch and -+ nested functions (e.g. with gfortran). -+ -+2014-02-12 H.J. Lu <hongjiu.lu@intel.com> ++2014-06-18 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline -+ 2014-02-12 H.J. Lu <hongjiu.lu@intel.com> -+ Uros Bizjak <ubizjak@gmail.com> ++ 2014-06-06 Uros Bizjak <ubizjak@gmail.com> + -+ PR target/60151 -+ * configure.ac (HAVE_AS_GOTOFF_IN_DATA): Pass --32 to GNU assembler. ++ PR target/61423 ++ * config/i386/i386.md (*floatunssi<mode>2_i387_with_xmm): New ++ define_insn_and_split pattern, merged from *floatunssi<mode>2_1 ++ and corresponding splitters. Zero extend general register ++ or memory input operand to XMM temporary. Enable for ++ TARGET_SSE2 and TARGET_INTER_UNIT_MOVES_TO_VEC only. ++ (floatunssi<mode>2): Update expander predicate. + -+2014-02-12 Eric Botcazou <ebotcazou@adacore.com> ++2014-06-18 Richard Henderson <rth@redhat.com> + -+ PR rtl-optimization/60116 -+ * combine.c (try_combine): Also remove dangling REG_DEAD notes on the -+ other_insn once the combination has been validated. ++ PR target/61545 ++ * config/aarch64/aarch64.md (tlsdesc_small): Clobber CC_REGNUM. + -+2014-02-10 Nagaraju Mekala <nagaraju.mekala@xilinx.com> ++2014-06-17 Nagaraju Mekala <nagaraju.mekala@xilinx.com> + ++ Revert on gcc-4_8-branch. + * config/microblaze/microblaze.md: Add movsi4_rev insn pattern. + * config/microblaze/predicates.md: Add reg_or_mem_operand predicate. + -+2014-02-10 Nagaraju Mekala <nagaraju.mekala@xilinx.com> -+ -+ * config/microblaze/microblaze.c: Extend mcpu version format -+ -+2014-02-10 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * config/microblaze/microblaze.h: Define SIZE_TYPE and PTRDIFF_TYPE. -+ -+2014-02-10 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-01-30 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59903 -+ * tree-vect-loop.c (vect_transform_loop): Guard multiple-types -+ check properly. -+ -+ 2014-02-10 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60115 -+ * tree-eh.c (tree_could_trap_p): Unify TARGET_MEM_REF and -+ MEM_REF handling. Properly verify that the accesses are not -+ out of the objects bound. -+ -+2014-02-05 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ Backport from mainline. -+ 2014-02-05 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ PR target/59718 -+ * doc/invoke.texi (-march): Clarify documentation for ARM. -+ (-mtune): Likewise. -+ (-mcpu): Likewise. -+ -+2014-02-04 John David Anglin <danglin@gcc.gnu.org> -+ -+ PR target/59777 -+ * config/pa/pa.c (legitimize_tls_address): Return original address -+ if not passed a SYMBOL_REF rtx. -+ (hppa_legitimize_address): Call legitimize_tls_address for all TLS -+ addresses. -+ (pa_emit_move_sequence): Simplify TLS source operands. -+ (pa_legitimate_constant_p): Reject all TLS constants. -+ * config/pa/pa.h (PA_SYMBOL_REF_TLS_P): Correct comment. -+ (CONSTANT_ADDRESS_P): Reject TLS CONST addresses. -+ -+2014-02-04 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-02-02 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/60017 -+ * config/i386/i386.c (classify_argument): Fix handling of bit_offset -+ when calculating size of integer atomic types. -+ -+2014-02-02 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-01-30 Jakub Jelinek <jakub@redhat.com> -+ -+ * config/i386/f16cintrin.h (_cvtsh_ss): Avoid -Wnarrowing warning. -+ -+2014-01-31 Richard Henderson <rth@redhat.com> -+ -+ PR middle-end/60004 -+ * tree-eh.c (lower_try_finally_switch): Delay lowering finally block -+ until after else_eh is processed. -+ -+2014-01-30 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ Backport from mainline -+ * config/microblaze/microblaze.md(cstoresf4, cbranchsf4): Replace -+ comparison_operator with ordered_comparison_operator. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilegx/sync.md (atomic_fetch_sub): Fix negation and -+ avoid clobbering a live register. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilegx/tilegx-c.c (tilegx_cpu_cpp_builtins): -+ Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_{1,2}. -+ * config/tilegx/tilepro-c.c (tilepro_cpu_cpp_builtins): -+ Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_{1,2,4,8}. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilegx/tilegx.c (tilegx_gen_bundles): Delete barrier -+ insns before bundling. -+ * config/tilegx/tilegx.md (tile_network_barrier): Update comment. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilegx/tilegx.c (tilegx_expand_builtin): Set -+ PREFETCH_SCHEDULE_BARRIER_P to true for prefetches. -+ * config/tilepro/tilepro.c (tilepro_expand_builtin): Ditto. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilepro/tilepro.md (ctzdi2): Use register_operand -+ predicate. -+ (clzdi2): Ditto. -+ (ffsdi2): Ditto. -+ -+2014-01-25 Walter Lee <walt@tilera.com> -+ -+ Backport from mainline -+ 2014-01-25 Walter Lee <walt@tilera.com> -+ -+ * config/tilegx/tilegx.c (tilegx_expand_to_rtl_hook): New. -+ (TARGET_EXPAND_TO_RTL_HOOK): Define. -+ -+2014-01-24 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-01-23 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59929 -+ * config/i386/i386.md (pushsf splitter): Get stack adjustment -+ from push operand if code of push isn't PRE_DEC. -+ -+2014-01-23 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ Backport from mainline. -+ * config/microblaze/microblaze.md: Add trap insn and attribute -+ -+2014-01-23 Marek Polacek <polacek@redhat.com> -+ -+ Backport from mainline -+ 2013-10-21 Marek Polacek <polacek@redhat.com> -+ -+ PR middle-end/58809 -+ * fold-const.c (fold_range_test): Return 0 if the type is not -+ an integral type. -+ -+2014-01-22 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * config/microblaze/microblaze.md: Correct bswaphi2 insn. -+ -+2014-01-22 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-01-20 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false -+ for SImode_address_operand operands, having only a REG argument. -+ -+ 2014-01-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59880 -+ * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false -+ if operands[1] is a REG or ZERO_EXTEND of a REG. -+ -+ 2014-01-18 Uros Bizjak <ubizjak@gmail.com> -+ H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59379 -+ * config/i386/i386.md (*lea<mode>): Zero-extend return register -+ to DImode for zero-extended addresses. -+ -+2014-01-21 Andrew Pinski <apinski@cavium.com> -+ Steve Ellcey <sellcey@mips.com> -+ -+ PR target/59462 -+ * config/mips/mips.c (mips_print_operand): Check operand mode instead -+ of operator mode. -+ -+2014-01-21 Andrey Belevantsev <abel@ispras.ru> -+ -+ Backport from mainline -+ 2013-12-23 Andrey Belevantsev <abel@ispras.ru> -+ -+ PR rtl-optimization/57422 -+ * sel-sched.c (mark_unavailable_hard_regs): Fix typo when calling -+ add_to_hard_reg_set. -+ -+2014-01-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/59860 -+ * tree.h (fold_builtin_strcat): New prototype. -+ * builtins.c (fold_builtin_strcat): No longer static. Add len -+ argument, if non-NULL, don't call c_strlen. Optimize -+ directly into __builtin_memcpy instead of __builtin_strcpy. -+ (fold_builtin_2): Adjust fold_builtin_strcat caller. -+ * gimple-fold.c (gimple_fold_builtin): Handle BUILT_IN_STRCAT. -+ -+2014-01-20 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/59860 -+ * builtins.c (fold_builtin_strcat): Remove case better handled -+ by tree-ssa-strlen.c. -+ -+2014-01-19 John David Anglin <danglin@gcc.gnu.org> -+ -+ * config/pa/pa.c (pa_attr_length_millicode_call): Correct length of -+ long non-pic millicode calls. -+ -+2014-01-17 John David Anglin <danglin@gcc.gnu.org> -+ -+ * config/pa/pa.c (pa_attr_length_indirect_call): Don't output a short -+ call to $$dyncall when TARGET_LONG_CALLS is true. -+ -+2014-01-17 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-01-14 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59794 -+ * config/i386/i386.c (type_natural_mode): Add a bool parameter -+ to indicate if type is used for function return value. Warn -+ ABI change if the vector mode isn't available for function -+ return value. -+ (ix86_function_arg_advance): Pass false to type_natural_mode. -+ (ix86_function_arg): Likewise. -+ (ix86_gimplify_va_arg): Likewise. -+ (function_arg_32): Don't warn ABI change. -+ (ix86_function_value): Pass true to type_natural_mode. -+ (ix86_return_in_memory): Likewise. -+ (ix86_struct_value_rtx): Removed. -+ (TARGET_STRUCT_VALUE_RTX): Likewise. -+ -+2014-01-17 Charles Baylis <charles.baylis@linaro.org> -+ -+ Backport from mainline -+ 2013-12-19 Charles Baylis <charles.baylis@linaro.org> -+ -+ PR target/59142 -+ * config/arm/arm-ldmstm.ml: Use low_register_operand for Thumb -+ patterns. -+ * config/arm/ldmstm.md: Regenerate. -+ -+ 2013-12-19 Charles Baylis <charles.baylis@linaro.org> -+ -+ PR target/59142 -+ * config/arm/predicates.md (arm_hard_general_register_operand): -+ New predicate. -+ (arm_hard_register_operand): Remove. -+ * config/arm/arm-ldmstm.ml: Use arm_hard_general_register_operand -+ for all patterns. -+ * config/arm/ldmstm.md: Regenerate. -+ -+ 2013-12-19 Charles Baylis <charles.baylis@linaro.org> -+ -+ PR target/59142 -+ * config/arm/predicates.md (vfp_hard_register_operand): New predicate. -+ * config/arm/arm.md (vfp_pop_multiple_with_writeback): Use -+ vfp_hard_register_operand. -+ -+2014-01-17 Kugan Vivekanandarajah <kuganv@linaro.org> -+ -+ Backport from mainline -+ 2014-01-15 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org> -+ Kugan Vivekanandarajah <kuganv@linaro.org> -+ -+ PR target/59695 -+ * config/aarch64/aarch64.c (aarch64_build_constant): Fix incorrect -+ truncation. -+ -+2014-01-17 Terry Guo <terry.guo@arm.com> -+ -+ PR target/59826 -+ * config/arm/arm.md (prefetch): Set insn type attribute to load1. -+ -+2014-01-16 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59839 -+ * config/i386/i386.c (ix86_expand_builtin): If target doesn't -+ satisfy operand 0 predicate for gathers, use a new pseudo as -+ subtarget. -+ -+2014-01-16 Richard Henderson <rth@redhat.com> -+ -+ PR debug/54694 -+ * reginfo.c (global_regs_decl): Globalize. -+ * rtl.h (global_regs_decl): Declare. -+ * ira.c (do_reload): Diagnose frame_pointer_needed and it -+ reserved via global_regs. -+ -+2014-01-16 Peter Bergner <bergner@vnet.ibm.com> -+ -+ Backport from mainline -+ 2014-01-15 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/i386.c (ix86_hard_regno_mode_ok): Use -+ VALID_AVX256_REG_OR_OI_MODE. -+ -+ 2013-09-05 Peter Bergner <bergner@vnet.ibm.com> -+ -+ PR target/58139 -+ * reginfo.c (choose_hard_reg_mode): Scan through all mode classes -+ looking for widest mode. -+ -+2014-01-16 Marek Polacek <polacek@redhat.com> -+ -+ Backported from mainline -+ 2014-01-16 Marek Polacek <polacek@redhat.com> -+ -+ PR middle-end/59827 -+ * gimple-low.c (gimple_check_call_args): Don't use DECL_ARG_TYPE if -+ it is error_mark_node. -+ -+2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ -+ PR target/59803 -+ * config/s390/s390.c (s390_preferred_reload_class): Don't return -+ ADDR_REGS for invalid symrefs in non-PIC code. -+ -+2014-01-14 Uros Bizjak <ubizjak@gmail.com> -+ -+ Revert: -+ 2014-01-08 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/i386.c (ix86_data_alignment): Calculate max_align -+ from prefetch_block tune setting. -+ -+2014-01-13 Jakub Jelinek <jakub@redhat.com> -+ -+ Backported from mainline -+ 2014-01-10 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59745 -+ * tree-predcom.c (tree_predictive_commoning_loop): Call -+ free_affine_expand_cache if giving up because components is NULL. -+ -+2014-01-10 Yufeng Zhang <yufeng.zhang@arm.com> -+ -+ * config/arm/arm.c (arm_expand_neon_args): Call expand_expr -+ with EXPAND_MEMORY for NEON_ARG_MEMORY; check if the returned -+ rtx is const0_rtx or not. -+ -+2014-01-10 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ -+ * config/s390/s390.c (s390_expand_tbegin): Remove jump over CC -+ extraction in good case. -+ -+2014-01-10 Huacai Chen <chenhc@lemote.com> -+ -+ * config/mips/driver-native.c (host_detect_local_cpu): Handle new -+ kernel strings for Loongson-2E/2F/3A. -+ -+2014-01-10 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59715 -+ * tree-flow.h (split_critical_edges): Declare. -+ * tree-cfg.c (split_critical_edges): Export. -+ * tree-ssa-sink.c (execute_sink_code): Split critical edges. -+ -+2014-01-09 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ * config/mips/mips.h (ISA_HAS_WSBH): Define. -+ * config/mips/mips.md (UNSPEC_WSBH, UNSPEC_DSBH, UNSPEC_DSHD): New -+ constants. -+ (bswaphi2, bswapsi2, bswapdi2, wsbh, dsbh, dshd): New patterns. -+ -+2014-01-09 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ PR rtl-optimization/59137 -+ * reorg.c (steal_delay_list_from_target): Call update_block for -+ elided insns. -+ (steal_delay_list_from_fallthrough, relax_delay_slots): Likewise. -+ -+2014-01-09 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ Revert: -+ 2012-10-07 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ * config/mips/mips.c (mips_truncated_op_cost): New function. -+ (mips_rtx_costs): Adjust test for BADDU. -+ * config/mips/mips.md (*baddu_di<mode>): Push truncates to operands. -+ -+ 2012-10-02 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ * config/mips/mips.md (*baddu_si_eb, *baddu_si_el): Merge into... -+ (*baddu_si): ...this new pattern. -+ -+2014-01-09 Richard Biener <rguenther@suse.de> ++2014-06-17 Yufeng Zhang <yufeng.zhang@arm.com> + + Backport from mainline -+ 2013-11-18 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59125 -+ PR tree-optimization/54570 -+ * tree-ssa-sccvn.c (copy_reference_ops_from_ref): When inlining -+ is not complete do not treat component-references with offset zero -+ but different fields as equal. -+ * tree-object-size.c: Include tree-phinodes.h and ssa-iterators.h. -+ (compute_object_sizes): Apply TLC. Propagate the constant -+ results into all uses and fold their stmts. -+ * passes.def (pass_all_optimizations): Move pass_object_sizes -+ after the first pass_forwprop and before pass_fre. -+ -+ 2013-12-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59362 -+ * tree-object-size.c (object_sizes): Change into array of -+ vec<unsigned HOST_WIDE_INT>. -+ (compute_builtin_object_size): Check computed bitmap for -+ non-NULL instead of object_sizes. Call safe_grow on object_sizes -+ vector if new SSA_NAMEs appeared. -+ (init_object_sizes): Check computed bitmap for non-NULL. -+ Call safe_grow on object_sizes elements instead of initializing -+ it with XNEWVEC. -+ (fini_object_sizes): Call release on object_sizes elements, don't -+ set it to NULL. -+ -+2014-01-09 Richard Earnshaw <rearnsha@arm.com> -+ -+ PR rtl-optimization/54300 -+ * regcprop.c (copyprop_hardreg_forward_1): Ensure any unused -+ outputs in a single-set are killed from the value chains. -+ -+2014-01-09 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/59724 -+ * ifcvt.c (cond_exec_process_if_block): Don't call -+ flow_find_head_matching_sequence with 0 longest_match. -+ * cfgcleanup.c (flow_find_head_matching_sequence): Count even -+ non-active insns if !stop_after. -+ (try_head_merge_bb): Revert 2014-01-07 changes. -+ -+2014-01-09 Hans-Peter Nilsson <hp@axis.com> -+ -+ Backport from mainline -+ 2013-12-23 Hans-Peter Nilsson <hp@axis.com> -+ -+ PR middle-end/59584 -+ * config/cris/predicates.md (cris_nonsp_register_operand): -+ New define_predicate. -+ * config/cris/cris.md: Replace register_operand with -+ cris_nonsp_register_operand for destinations in all -+ define_splits where a register is set more than once. -+ -+2014-01-08 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2013-12-25 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59587 -+ * config/i386/i386.c (struct ptt): Add a field for processor name. -+ (processor_target_table): Sync with processor_type. Add -+ processor names. -+ (cpu_names): Removed. -+ (ix86_option_override_internal): Default x_ix86_tune_string -+ to processor_target_table[TARGET_CPU_DEFAULT].name. -+ (ix86_function_specific_print): Assert arch and tune < -+ PROCESSOR_max. Use processor_target_table to print arch and -+ tune names. -+ * config/i386/i386.h (TARGET_CPU_DEFAULT): Default to -+ PROCESSOR_GENERIC32. -+ (target_cpu_default): Removed. -+ (processor_type): Reordered. -+ -+2014-01-08 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-01-05 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/i386.c (ix86_data_alignment): Calculate max_align -+ from prefetch_block tune setting. -+ (nocona_cost): Correct size of prefetch block to 64. -+ -+2014-01-08 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/59610 -+ * ipa-prop.c (ipa_compute_jump_functions): Bail out if not optimizing. -+ (parm_preserved_before_stmt_p): Assume modification present when not -+ optimizing. -+ -+2014-01-07 John David Anglin <danglin@gcc.gnu.org> -+ -+ PR target/59652 -+ * config/pa/pa.c (pa_legitimate_address_p): Return false before reload -+ for 14-bit register offsets when INT14_OK_STRICT is false. -+ -+2014-01-07 Roland Stigge <stigge@antcom.de> -+ Michael Meissner <meissner@linux.vnet.ibm.com> + -+ PR 57386/target -+ * config/rs6000/rs6000.c (rs6000_legitimate_offset_address_p): -+ Only check TFmode for SPE constants. Don't check TImode or TDmode. ++ PR target/61483 ++ * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local ++ variable 'size'; calculate 'size' right in the front; use ++ 'size' to compute 'nregs' (when 'allocate_ncrn != 0') and ++ pcum->aapcs_stack_words. + -+2014-01-07 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/58668 -+ * cfgcleanup.c (flow_find_cross_jump): Don't count -+ any jumps if dir_p is NULL. Remove p1 variable and make USE/CLOBBER -+ check consistent with other places. -+ (flow_find_head_matching_sequence): Don't count USE or CLOBBER insns. -+ (try_head_merge_bb): Adjust for the flow_find_head_matching_sequence -+ counting change. -+ * ifcvt.c (count_bb_insns): Don't count USE or CLOBBER insns. -+ -+2014-01-07 Mike Stump <mikestump@comcast.net> -+ Jakub Jelinek <jakub@redhat.com> -+ -+ PR pch/59436 -+ * tree.h (struct tree_optimization_option): Change optabs -+ type from unsigned char * to void *. -+ * optabs.c (init_tree_optimization_optabs): Adjust -+ TREE_OPTIMIZATION_OPTABS initialization. -+ -+2014-01-07 Jakub Jelinek <jakub@redhat.com> -+ -+ Backported from mainline -+ 2013-12-16 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58956 -+ PR middle-end/59470 -+ * gimple.h (walk_stmt_load_store_addr_fn): New typedef. -+ (walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Use it -+ for callback params. -+ * gimple.c (walk_stmt_load_store_ops): Likewise. -+ (walk_stmt_load_store_addr_ops): Likewise. Adjust all callback -+ calls to supply the gimple operand containing the base tree -+ as an extra argument. -+ * tree-ssa-ter.c (find_ssaname, find_ssaname_in_store): New helper -+ functions. -+ (find_replaceable_in_bb): For calls or GIMPLE_ASM, only set -+ same_root_var if USE is used somewhere in the stores of the stmt. -+ * ipa-prop.c (visit_ref_for_mod_analysis): Remove name of the stmt -+ argument and ATTRIBUTE_UNUSED, add another unnamed tree argument. -+ * ipa-pure-const.c (check_load, check_store, check_ipa_load, -+ check_ipa_store): Likewise. -+ * gimple.c (gimple_ior_addresses_taken_1): Likewise. -+ * ipa-split.c (test_nonssa_use, mark_nonssa_use): Likewise. -+ (verify_non_ssa_vars, visit_bb): Adjust their callers. -+ * cfgexpand.c (add_scope_conflicts_1): Use -+ walk_stmt_load_store_addr_fn type for visit variable. -+ (visit_op, visit_conflict): Remove name of the stmt -+ argument and ATTRIBUTE_UNUSED, add another unnamed tree argument. -+ * tree-sra.c (asm_visit_addr): Likewise. Remove name of the data -+ argument and ATTRIBUTE_UNUSED. -+ * cgraphbuild.c (mark_address, mark_load, mark_store): Add another -+ unnamed tree argument. -+ -+2014-01-03 Andreas Schwab <schwab@linux-m68k.org> -+ -+ * config/m68k/m68k.c (handle_move_double): Handle pushes with -+ overlapping registers also for registers other than the stack -+ pointer. -+ -+2014-01-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59625 -+ * config/i386/i386.c (ix86_avoid_jump_mispredicts): Don't consider -+ asm goto as jump. -+ -+2014-01-01 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/59647 -+ * cse.c (cse_process_notes_1): Don't substitute negative VOIDmode -+ new_rtx into UNSIGNED_FLOAT rtxes. -+ -+2013-12-28 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * doc/invoke.texi (output file options): Document -fada-spec-parent. -+ -+2013-12-26 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/driver-i386.c (decode_caches_intel): Add missing entries. -+ -+2013-12-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c++/59255 -+ Backported from mainline -+ 2013-08-19 Dehao Chen <dehao@google.com> -+ -+ * value-prof.c (gimple_ic): Fix the bug of adding EH edge. -+ -+2013-12-19 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ Backport from Mainline. -+ 2013-05-01 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ * config/aarch64/aarch64-simd-builtins.def (cmhs): Rename to... -+ (cmgeu): ...This. -+ (cmhi): Rename to... -+ (cmgtu): ...This. -+ * config/aarch64/aarch64-simd.md -+ (simd_mode): Add SF. -+ (aarch64_vcond_internal): Use new names for unsigned comparison insns. -+ (aarch64_cm<optab><mode>): Rewrite to not use UNSPECs. -+ * config/aarch64/aarch64.md (*cstore<mode>_neg): Rename to... -+ (cstore<mode>_neg): ...This. -+ * config/aarch64/iterators.md -+ (VALLF): new. -+ (unspec): Remove UNSPEC_CM<EQ, LE, LT, GE, GT, HS, HI, TST>. -+ (COMPARISONS): New. -+ (UCOMPARISONS): Likewise. -+ (optab): Add missing comparisons. -+ (n_optab): New. -+ (cmp_1): Likewise. -+ (cmp_2): Likewise. -+ (CMP): Likewise. -+ (cmp): Remove. -+ (VCMP_S): Likewise. -+ (VCMP_U): Likewise. -+ (V_cmp_result): Add DF, SF modes. -+ (v_cmp_result): Likewise. -+ (v): Likewise. -+ (vmtype): Likewise. -+ * config/aarch64/predicates.md (aarch64_reg_or_fp_zero): New. -+ -+ Partial Backport from mainline. -+ 2013-05-01 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ * config/aarch64/arm_neon.h -+ (vc<eq, lt, le, gt, ge, tst><qsd>_<u><8,16,32,64>): Remap -+ to builtins or C as appropriate. -+ -+2013-12-19 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ Andreas Krebbel <Andreas.Krebbel@de.ibm.com> ++2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline -+ 2013-12-19 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ * config/s390/s390.c (s390_hotpatch_trampoline_halfwords_default): New -+ constant -+ (s390_hotpatch_trampoline_halfwords_max): New constant -+ (s390_hotpatch_trampoline_halfwords): New static variable -+ (get_hotpatch_attribute): New function -+ (s390_handle_hotpatch_attribute): New function -+ (s390_attribute_table): New target specific attribute table to implement -+ the hotpatch attribute -+ (s390_option_override): Parse hotpatch options -+ (s390_function_num_hotpatch_trampoline_halfwords): New function -+ (s390_can_inline_p): Implement target hook to -+ suppress hotpatching for explicitly inlined functions -+ (s390_asm_output_function_label): Generate hotpatch prologue -+ (TARGET_ATTRIBUTE_TABLE): Define to implement target attribute table -+ (TARGET_CAN_INLINE_P): Define to implement target hook -+ * config/s390/s390.opt (mhotpatch): New options -mhotpatch, -mhotpatch= -+ * config/s390/s390-protos.h (s390_asm_output_function_label): Add -+ prototype -+ * config/s390/s390.h (ASM_OUTPUT_FUNCTION_LABEL): Target specific -+ function label generation for hotpatching -+ (FUNCTION_BOUNDARY): Align functions to eight bytes -+ * doc/extend.texi: Document hotpatch attribute -+ * doc/invoke.texi: Document -mhotpatch option + -+2013-12-18 Eric Botcazou <ebotcazou@adacore.com> ++ 2014-06-13 Peter Bergner <bergner@vnet.ibm.com> ++ PR target/61415 ++ * config/rs6000/rs6000-builtin.def (BU_MISC_1): Delete. ++ (BU_MISC_2): Rename to ... ++ (BU_LDBL128_2): ... this. ++ * config/rs6000/rs6000.h (RS6000_BTM_LDBL128): New define. ++ (RS6000_BTM_COMMON): Add RS6000_BTM_LDBL128. ++ * config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Handle ++ RS6000_BTM_LDBL128. ++ (rs6000_invalid_builtin): Add long double 128-bit builtin support. ++ (rs6000_builtin_mask_names): Add RS6000_BTM_LDBL128. ++ * config/rs6000/rs6000.md (unpacktf_0): Remove define)expand. ++ (unpacktf_1): Likewise. ++ * doc/extend.texi (__builtin_longdouble_dw0): Remove documentation. ++ (__builtin_longdouble_dw1): Likewise. ++ * doc/sourcebuild.texi (longdouble128): Document. + -+ * config/arm/arm.c (arm_expand_epilogue_apcs_frame): Fix thinko. ++2014-06-13 Jason Merrill <jason@redhat.com> + -+2013-12-12 Vladimir Makarov <vmakarov@redhat.com> ++ PR c++/60731 ++ * common.opt (-fno-gnu-unique): Add. ++ * config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it. + -+ PR middle-end/59470 -+ * lra-coalesce.c (lra_coalesce): Invalidate inheritance pseudo -+ values if necessary. ++2014-06-12 Georg-Johann Lay <avr@gjlay.de> + -+2013-12-12 Jakub Jelinek <jakub@redhat.com> ++ Backport from 2014-05-09 trunk r210272 + -+ PR libgomp/59467 -+ * gimplify.c (omp_check_private): Add copyprivate argument, if it -+ is true, don't check omp_privatize_by_reference. -+ (gimplify_scan_omp_clauses): For OMP_CLAUSE_COPYPRIVATE verify -+ decl is private in outer context. Adjust omp_check_private caller. ++ * config/avr/avr-fixed.md (round<mode>3): Use -1U instead of -1 in ++ unsigned int initializers for regno_in, regno_out. + -+2013-12-10 Eric Botcazou <ebotcazou@adacore.com> ++ Backport from 2014-05-14 trunk r210418 ++ * config/avr/avr.h (REG_CLASS_CONTENTS): Use unsigned suffix for ++ shifted values to avoid build warning. + -+ PR rtl-optimization/58295 -+ * simplify-rtx.c (simplify_truncation): Restrict the distribution for -+ WORD_REGISTER_OPERATIONS targets. ++ Backport from 2014-06-12 trunk r211491 + -+2013-12-10 Kai Tietz <ktietz@redhat.com> ++ PR target/61443 ++ * config/avr/avr.md (push<mode>1): Avoid (subreg(mem)) when ++ loading from address spaces. + -+ PR target/56807 -+ * config/i386/i386.c (ix86_expand_prologue): Address saved -+ registers stack-relative, not via frame-pointer. ++2014-06-12 Alan Modra <amodra@gmail.com> + -+2013-12-09 Alan Modra <amodra@gmail.com> ++ PR target/61300 ++ * doc/tm.texi.in (INCOMING_REG_PARM_STACK_SPACE): Document. ++ * doc/tm.texi: Regenerate. ++ * function.c (INCOMING_REG_PARM_STACK_SPACE): Provide default. ++ Use throughout in place of REG_PARM_STACK_SPACE. ++ * config/rs6000/rs6000.c (rs6000_reg_parm_stack_space): Add ++ "incoming" param. Pass to rs6000_function_parms_need_stack. ++ (rs6000_function_parms_need_stack): Add "incoming" param, ignore ++ prototype_p when incoming. Use function decl when incoming ++ to handle K&R style functions. ++ * config/rs6000/rs6000.h (REG_PARM_STACK_SPACE): Adjust. ++ (INCOMING_REG_PARM_STACK_SPACE): Define. + -+ Apply from mainline -+ 2013-12-05 Alan Modra <amodra@gmail.com> -+ * configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for -+ build != host. -+ <recursive call for build != host>: Clear GMPINC. Don't bother -+ saving CFLAGS. -+ * configure: Regenerate. ++2014-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> + -+2013-12-08 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-12-06 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59405 -+ * config/i386/i386.c (type_natural_mode): Properly handle -+ size 8 for !TARGET_64BIT. -+ -+2013-12-07 Ralf Corsépius <ralf.corsepius@rtems.org> -+ -+ * config.gcc (microblaze*-*-rtems*): Add TARGET_BIG_ENDIAN_DEFAULT. -+ -+2013-12-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59388 -+ * tree-ssa-reassoc.c (update_range_test): If op == range->exp, -+ gimplify tem after stmt rather than before it. -+ -+2013-12-06 Oleg Endo <olegendo@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-11-26 Oleg Endo <olegendo@gcc.gnu.org> -+ -+ PR target/58314 -+ PR target/50751 -+ * config/sh/sh.c (max_mov_insn_displacement, disp_addr_displacement): -+ Prefix function names with 'sh_'. Make them non-static. -+ * config/sh/sh-protos.h (sh_disp_addr_displacement, -+ sh_max_mov_insn_displacement): Add declarations. -+ * config/sh/constraints.md (Q): Reject QImode. -+ (Sdd): Use match_code "mem". -+ (Snd): Fix erroneous matching of non-memory operands. -+ * config/sh/predicates.md (short_displacement_mem_operand): New -+ predicate. -+ (general_movsrc_operand): Disallow PC relative QImode loads. -+ * config/sh/sh.md (*mov<mode>_reg_reg): Remove it. -+ (*movqi, *movhi): Merge both insns into... -+ (*mov<mode>): ... this new insn. Replace generic 'm' constraints with -+ 'Snd' and 'Sdd' constraints. Calculate insn length dynamically based -+ on the operand types. -+ -+2013-12-06 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-29 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59334 -+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Fix bug -+ in previous commit. -+ -+ 2013-11-28 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59330 -+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Simplify -+ and fix delayed marking of free calls not necessary. -+ -+2013-12-06 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-27 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59288 -+ * tree-vect-loop.c (get_initial_def_for_induction): Do not -+ re-analyze the PHI but use STMT_VINFO_LOOP_PHI_EVOLUTION_PART. -+ -+ 2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59164 -+ * tree-vect-loop.c (vect_analyze_loop_operations): Adjust -+ check whether we can create an epilogue loop to reflect the -+ cases where we create one. -+ -+ 2013-09-05 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58137 -+ * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): -+ Do not create vectors of pointers. -+ * tree-vect-loop.c (get_initial_def_for_induction): Use proper -+ types for the components of the vector initializer. -+ * tree-cfg.c (verify_gimple_assign_binary): Remove special-casing -+ allowing pointer vectors with PLUS_EXPR/MINUS_EXPR. -+ -+2013-12-06 Oleg Endo <olegendo@gcc.gnu.org> -+ -+ PR target/51244 -+ PR target/59343 -+ * config/sh/sh.md (*cbranch_t): Check that there are no labels between -+ the s1 insn and the testing insn. Remove REG_DEAD note from s1 insn. -+ -+2013-12-05 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58956 -+ * tree-ssa-ter.c (find_replaceable_in_bb): Avoid forwarding -+ loads into stmts that may clobber it. -+ -+2013-12-04 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/58726 -+ * combine.c (force_to_mode): Fix comment typo. Don't destructively -+ modify x for ROTATE, ROTATERT and IF_THEN_ELSE. -+ -+2013-12-04 Jakub Jelinek <jakub@redhat.com> -+ Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59163 -+ * config/i386/i386.c (ix86_legitimate_combined_insn): If for -+ !TARGET_AVX there is misaligned MEM operand with vector mode -+ and get_attr_ssememalign is 0, return false. -+ (ix86_expand_special_args_builtin): Add get_pointer_alignment -+ computed alignment and for non-temporal loads/stores also -+ at least GET_MODE_ALIGNMENT as MEM_ALIGN. -+ * config/i386/sse.md -+ (<sse>_loadu<ssemodesuffix><avxsizesuffix>, -+ <sse>_storeu<ssemodesuffix><avxsizesuffix>, -+ <sse2>_loaddqu<avxsizesuffix>, -+ <sse2>_storedqu<avxsizesuffix>, <sse3>_lddqu<avxsizesuffix>, -+ sse_vmrcpv4sf2, sse_vmrsqrtv4sf2, sse2_cvtdq2pd, sse_movhlps, -+ sse_movlhps, sse_storehps, sse_loadhps, sse_loadlps, -+ *vec_interleave_highv2df, *vec_interleave_lowv2df, -+ *vec_extractv2df_1_sse, sse2_loadhpd, sse2_loadlpd, sse2_movsd, -+ sse4_1_<code>v8qiv8hi2, sse4_1_<code>v4qiv4si2, -+ sse4_1_<code>v4hiv4si2, sse4_1_<code>v2qiv2di2, -+ sse4_1_<code>v2hiv2di2, sse4_1_<code>v2siv2di2, sse4_2_pcmpestr, -+ *sse4_2_pcmpestr_unaligned, sse4_2_pcmpestri, sse4_2_pcmpestrm, -+ sse4_2_pcmpestr_cconly, sse4_2_pcmpistr, *sse4_2_pcmpistr_unaligned, -+ sse4_2_pcmpistri, sse4_2_pcmpistrm, sse4_2_pcmpistr_cconly): Add -+ ssememalign attribute. -+ * config/i386/i386.md (ssememalign): New define_attr. -+ -+2013-12-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/59011 -+ * gimplify.c (nonlocal_vla_vars): New variable. -+ (gimplify_var_or_parm_decl): Put VAR_DECLs for VLAs into -+ nonlocal_vla_vars chain. -+ (gimplify_body): Call declare_vars on nonlocal_vla_vars chain -+ if outer_bind has DECL_INITIAL (current_function_decl) block. -+ -+ PR target/58864 -+ * optabs.c (emit_conditional_move): Save and restore -+ pending_stack_adjust and stack_pointer_delta if cmove can't be used. -+ -+2013-12-02 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59358 -+ * tree-vrp.c (union_ranges): To check for the partially -+ overlapping ranges or adjacent ranges, also compare *vr0max -+ with vr1max. -+ -+2013-12-02 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59139 -+ * tree-ssa-loop-niter.c (chain_of_csts_start): Properly match -+ code in get_val_for. -+ (get_val_for): Use gcc_checking_asserts. -+ -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> -+ -+ PR middle-end/59037 -+ * fold-const.c (fold_indirect_ref_1): Don't create out-of-bounds -+ BIT_FIELD_REF. -+ * gimplify.c (gimple_fold_indirect_ref): Same. -+ -+2013-12-01 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * config/i386/winnt.c (i386_pe_asm_named_section): Be prepared for an -+ identifier node. -+ -+2013-12-01 Bernd Edlinger <bernd.edlinger@hotmail.de> -+ -+ * expr.c (emit_group_store): Fix off-by-one BITFIELD_END argument. -+ -+2013-11-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> -+ -+ Backport from mainline -+ 2013-11-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> -+ -+ * config/arm/iterators.md (vrint_conds): New int attribute. -+ * config/arm/vfp.md (<vrint_pattern><SDF:mode>2): Set conds attribute. -+ (smax<mode>3): Likewise. -+ (smin<mode>3): Likewise. -+ -+2013-11-28 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-11-27 Uros Bizjak <ubizjak@gmail.com> -+ Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> -+ -+ PR target/56788 -+ * gcc.target/i386/xop-frczX.c: New test. -+ -+2013-11-28 Terry Guo <terry.guo@arm.com> -+ -+ Backport mainline r205391 -+ 2013-11-26 Terry Guo <terry.guo@arm.com> -+ -+ * config/arm/arm.c (require_pic_register): Handle high pic base -+ register for thumb-1. -+ (arm_load_pic_register): Also initialize high pic base register. -+ * doc/invoke.texi: Update documentation for option -mpic-register. -+ -+2013-11-27 Jakub Jelinek <jakub@redhat.com> -+ -+ Backported from mainline -+ 2013-11-26 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59014 -+ * tree-vrp.c (register_edge_assert_for_1): Don't look -+ through conversions from non-integral types or through -+ narrowing conversions. -+ -+2013-11-27 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR middle-end/59138 -+ * expr.c (emit_group_store): Don't write past the end of the structure. -+ (store_bit_field): Fix formatting. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-09-17 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ * config/sparc/t-rtems: Add leon3 multilibs. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-08-09 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * configure.ac: Add GAS check for LEON instructions on SPARC. -+ * configure: Regenerate. -+ * config.in: Likewise. -+ * config.gcc (with_cpu): Remove sparc-leon*-* and deal with LEON in the -+ sparc*-*-* block. -+ * config/sparc/sparc.opt (LEON, LEON3): New masks. -+ * config/sparc/sparc.h (ASM_CPU32_DEFAULT_SPEC): Set to AS_LEON_FLAG -+ for LEON or LEON3. -+ (ASM_CPU_SPEC): Pass AS_LEON_FLAG if -mcpu=leon or -mcpu=leon3. -+ (AS_LEON_FLAG): New macro. -+ * config/sparc/sparc.c (sparc_option_override): Set MASK_LEON for leon -+ and MASK_LEON3 for leon3 and unset them if HAVE_AS_LEON is not defined. -+ Deal with LEON and LEON3 for the memory model. -+ * config/sparc/sync.md (atomic_compare_and_swap<mode>): Enable if LEON3 -+ (atomic_compare_and_swap<mode>_1): Likewise. -+ (*atomic_compare_and_swap<mode>_1): Likewise. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-07-23 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * doc/invoke.texi (SPARC Options): Document new leon3 processor value. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-07-22 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * config.gcc (sparc*-*-*): Accept leon3 processor. -+ (sparc-leon*-*): Merge with sparc*-*-* and add leon3 support. -+ * doc/invoke.texi (SPARC Options): Adjust -mfix-ut699 entry. -+ * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3. -+ * config/sparc/sparc.opt (enum processor_type): Add leon3. -+ (mfix-ut699): Adjust comment. -+ * config/sparc/sparc.h (TARGET_CPU_leon3): New define. -+ (CPP_CPU32_DEFAULT_SPEC): Add leon3 support. -+ (CPP_CPU_SPEC): Likewise. -+ (ASM_CPU_SPEC): Likewise. -+ * config/sparc/sparc.c (leon3_cost): New constant. -+ (sparc_option_override): Add leon3 support. -+ (mem_ref): New function. -+ (sparc_gate_work_around_errata): Return true if -mfix-ut699 is enabled. -+ (sparc_do_work_around_errata): Look into the instruction in the delay -+ slot and adjust accordingly. Add fix for the data cache nullify issues -+ of the UT699. Change insertion position for the NOP. -+ * config/sparc/leon.md (leon_fpalu, leon_fpmds, write_buf): Delete. -+ (leon3_load): New reservation. -+ (leon_store): Bump latency to 2. -+ (grfpu): New automaton. -+ (grfpu_alu): New unit. -+ (grfpu_ds): Likewise. -+ (leon_fp_alu): Adjust. -+ (leon_fp_mult): Delete. -+ (leon_fp_div): Split into leon_fp_divs and leon_fp_divd. -+ (leon_fp_sqrt): Split into leon_fp_sqrts and leon_fp_sqrtd. -+ * config/sparc/sparc.md (cpu): Add leon3. -+ * config/sparc/sync.md (atomic_exchangesi): Disable if -mfix-ut699. -+ (swapsi): Likewise. -+ (atomic_test_and_set): Likewise. -+ (ldstub): Likewise. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-04-10 Steven Bosscher <steven@gcc.gnu.org> -+ -+ * config/sparc/sparc.c: Include tree-pass.h. -+ (TARGET_MACHINE_DEPENDENT_REORG): Do not redefine. -+ (sparc_reorg): Rename to sparc_do_work_around_errata. Move to -+ head of file. Change return type. Split off gate function. -+ (sparc_gate_work_around_errata): New function. -+ (pass_work_around_errata): New pass definition. -+ (insert_pass_work_around_errata) New pass insert definition to -+ insert pass_work_around_errata just after delayed-branch scheduling. -+ (sparc_option_override): Insert the pass. -+ * config/sparc/t-sparc (sparc.o): Add TREE_PASS_H dependence. -+ -+2013-11-24 Sebastian Huber <sebastian.huber@embedded-brains.de> -+ -+ Backport from mainline -+ 2013-05-28 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * doc/invoke.texi (SPARC Options): Document -mfix-ut699. -+ * builtins.c (expand_builtin_mathfn) <BUILT_IN_SQRT>: Try to widen the -+ mode if the instruction isn't available in the original mode. -+ * config/sparc/sparc.opt (mfix-ut699): New option. -+ * config/sparc/sparc.md (muldf3_extend): Disable if -mfix-ut699. -+ (divdf3): Turn into expander. -+ (divdf3_nofix): New insn. -+ (divdf3_fix): Likewise. -+ (divsf3): Disable if -mfix-ut699. -+ (sqrtdf2): Turn into expander. -+ (sqrtdf2_nofix): New insn. -+ (sqrtdf2_fix): Likewise. -+ (sqrtsf2): Disable if -mfix-ut699. -+ -+2013-11-22 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * print-rtl.c (print_rtx) <case MEM>: Output a space if no MEM_EXPR. -+ -+2013-11-21 Zhenqiang Chen <zhenqiang.chen@linaro.org> -+ -+ PR bootstrap/57683 -+ Backport from mainline: r197467 and r198999. -+ 2013-04-03 Jeff Law <law@redhat.com> -+ -+ * Makefile.in (lra-constraints.o): Depend on $(OPTABS_H). -+ (lra-eliminations.o): Likewise. -+ -+ 2013-05-16 Jeff Law <law@redhat.com> -+ -+ * Makefile.in (tree-switch-conversion.o): Depend on $(OPTABS_H). -+ -+2013-11-20 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR target/59207 -+ * config/sparc/sparc.c (sparc_fold_builtin) <case CODE_FOR_pdist_vis>: -+ Make sure neg2_ovf is set before being used. -+ -+2013-11-20 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ Dominik Vogt <vogt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ * config/s390/s390.c (s390_canonicalize_comparison): Don't fold -+ int comparisons with an out of range condition code. -+ (s390_optimize_nonescaping_tx): Skip empty BBs. -+ Generate the new tbegin RTX when removing the FPR clobbers (with -+ two SETs). -+ (s390_expand_tbegin): Fix the retry loop counter. Copy CC to the -+ result before doing the retry calculations. -+ (s390_init_builtins): Make tbegin "returns_twice" and tabort -+ "noreturn". -+ * config/s390/s390.md (UNSPECV_TBEGIN_TDB): New constant used for -+ the TDB setting part of an tbegin. -+ ("tbegin_1", "tbegin_nofloat_1"): Add a set for the TDB. -+ ("tx_assist"): Set unused argument to an immediate zero instead of -+ loading zero into a GPR and pass it as argument. -+ * config/s390/htmxlintrin.h (__TM_simple_begin, __TM_begin): -+ Remove inline and related attributes. -+ (__TM_nesting_depth, __TM_is_user_abort, __TM_is_named_user_abort) -+ (__TM_is_illegal, __TM_is_footprint_exceeded) -+ (__TM_is_nested_too_deep, __TM_is_conflict): Fix format value -+ check. -+ -+2013-11-19 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-11-18 Uros Bizjak <ubizjak@gmail.com> -+ -+ * config/i386/i386.c (ix86_decompose_address): Use REG_P instead of -+ ix86_address_subreg_operand. Move subreg checks to -+ ix86_validate_address_register. Move address override check to -+ ix86_legitimate_address_p. -+ (ix86_validate_address_register): New function. -+ (ix86_legitimate_address_p): Call ix86_validate_address_register -+ to validate base and index registers. Add address override check -+ from ix86_decompose_address. -+ (ix86_decompose_address): Remove. -+ -+ Backport from mainline -+ 2013-11-17 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59153 -+ * config/i386/i386.c (ix86_address_subreg_operand): Do not -+ reject non-integer subregs. -+ (ix86_decompose_address): Do not reject invalid CONST_INT RTXes. -+ Move check for invalid x32 constant addresses ... -+ (ix86_legitimate_address_p): ... here. -+ -+2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-07 Richard Biener <rguenther@suse.de> -+ -+ * tree-dfa.c (get_ref_base_and_extent): Fix casting. -+ -+2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/57517 -+ * tree-predcom.c (combinable_refs_p): Verify the combination -+ is always executed when the refs are. -+ -+2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-05 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58941 -+ * tree-dfa.c (get_ref_base_and_extent): Merge common code -+ in MEM_REF and TARGET_MEM_REF handling. Make sure to -+ process trailing array detection before diving into the -+ view-converted object (and possibly apply some extra offset). -+ -+2013-11-18 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-10-21 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58794 -+ * fold-const.c (operand_equal_p): Compare FIELD_DECL operand -+ of COMPONENT_REFs with OEP_CONSTANT_ADDRESS_OF left in place. -+ -+ 2013-10-21 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58742 -+ * fold-const.c (fold_binary_loc): Fold ((T) (X /[ex] C)) * C -+ to (T) X for sign-changing conversions (or no conversion). -+ -+ 2013-11-06 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58653 -+ * tree-predcom.c (ref_at_iteration): Rewrite to generate -+ a MEM_REF. -+ (prepare_initializers_chain): Adjust. -+ -+ PR tree-optimization/59047 -+ * tree-predcom.c (ref_at_iteration): Handle bitfield accesses -+ properly. -+ -+ 2013-10-15 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58143 -+ * tree-ssa-loop-im.c (arith_code_with_undefined_signed_overflow): -+ New function. -+ (rewrite_to_defined_overflow): Likewise. -+ (move_computations_dom_walker::before_dom): Rewrite stmts -+ with undefined signed overflow that are not always executed -+ into unsigned arithmetic. -+ -+2013-11-14 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-11-10 Uros Bizjak <ubizjak@gmail.com> -+ -+ * mode-switching.c (optimize_mode_switching): Mark block as -+ nontransparent, if last_mode at block exit is different from no_mode. -+ -+ Backport from mainline -+ 2013-11-06 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59021 -+ * config/i386/i386.c (ix86_avx_u128_mode_needed): Require -+ AVX_U128_DIRTY mode for call_insn RTXes that use AVX256 registers. -+ (ix86_avx_u128_mode_needed): Return AVX_U128_DIRTY mode for call_insn -+ RTXes that return in AVX256 register. -+ -+2013-11-14 Jakub Jelinek <jakub@redhat.com> -+ Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59101 -+ * config/i386/i386.md (*anddi_2): Only allow CCZmode if -+ operands[2] satisfies_constraint_Z that might have bit 31 set. -+ -+2013-11-12 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backported from mainline -+ 2013-11-12 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59088 -+ * config/i386/i386.c (initial_ix86_tune_features): Set -+ X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL and -+ X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL for m_HASWELL. -+ -+2013-11-11 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> -+ -+ Backported from mainline -+ 2013-10-30 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> -+ -+ PR target/58854 -+ * config/arm/arm.c (arm_expand_epilogue_apcs_frame): Emit blockage -+ -+2013-11-11 Jakub Jelinek <jakub@redhat.com> -+ -+ Backported from mainline -+ 2013-11-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58970 -+ * expr.c (get_bit_range): Handle *offset == NULL_TREE. -+ (expand_assignment): If *bitpos is negative, set *offset -+ and adjust *bitpos, so that it is not negative. -+ -+ 2013-11-05 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/58997 -+ * loop-iv.c (iv_subreg): For IV_UNKNOWN_EXTEND, expect -+ get_iv_value to be in iv->mode rather than iv->extend_mode. -+ (iv_extend): Likewise. Otherwise, if iv->extend != extend, -+ use lowpart_subreg on get_iv_value before calling simplify_gen_unary. -+ * loop-unswitch.c (may_unswitch_on): Make sure op[i] is in the right -+ mode. -+ -+2013-11-10 Karlson2k <k2k@narod.ru> -+ Kai Tietz <ktietz@redhat.com> -+ -+ Merged from trunk -+ PR plugins/52872 -+ * configure.ac: Adding for exported symbols check -+ and for rdynamic-check executable-extension. -+ * configure: Regenerated. -+ -+2013-11-07 H.J. Lu <hongjiu.lu@intel.com> ++ Back port from trunk ++ 2014-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> + -+ PR target/59034 -+ * config/i386/i386.md (push peepholer/splitter): Use Pmode -+ with stack_pointer_rtx. ++ PR target/61431 ++ * config/rs6000/vsx.md (VSX_LE): Split VSX_D into 2 separate ++ iterators, VSX_D that handles 64-bit types, and VSX_LE that ++ handles swapping the two 64-bit double words on little endian ++ systems. Include V1TImode and optionally TImode in VSX_LE so that ++ these types are properly swapped. Change all of the insns and ++ splits that do the 64-bit swaps to use VSX_LE. ++ (vsx_le_perm_load_<mode>): Likewise. ++ (vsx_le_perm_store_<mode>): Likewise. ++ (splitters for little endian memory operations): Likewise. ++ (vsx_xxpermdi2_le_<mode>): Likewise. ++ (vsx_lxvd2x2_le_<mode>): Likewise. ++ (vsx_stxvd2x2_le_<mode>): Likewise. + -+2013-11-05 Uros Bizjak <ubizjak@gmail.com> ++2014-06-05 Martin Jambor <mjambor@suse.cz> + -+ * config/i386/t-rtems (MULTILIB_MATCHES): Fix option typos. ++ PR ipa/61393 ++ * ipa-cp.c (determine_versionability): Pretend that tm_clones are ++ not versionable. + -+2013-11-05 Jakub Jelinek <jakub@redhat.com> ++2014-06-04 Richard Biener <rguenther@suse.de> + -+ PR tree-optimization/58984 -+ * ipa-prop.c (ipa_load_from_parm_agg_1): Add SIZE_P argument, -+ set *SIZE_P if non-NULL on success. -+ (ipa_load_from_parm_agg, ipa_analyze_indirect_call_uses): Adjust -+ callers. -+ (ipcp_transform_function): Likewise. Punt if size of access -+ is different from TYPE_SIZE on v->value's type. ++ PR tree-optimization/61383 ++ * tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure ++ stmts can't trap. + -+2013-11-03 H.J. Lu <hongjiu.lu@intel.com> ++2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline -+ 2013-10-12 H.J. Lu <hongjiu.lu@intel.com> ++ 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + -+ PR target/58690 -+ * config/i386/i386.c (ix86_copy_addr_to_reg): New function. -+ (ix86_expand_movmem): Replace copy_addr_to_reg with -+ ix86_copy_addr_to_reg. -+ (ix86_expand_setmem): Likewise. ++ PR rtl-optimization/60866 ++ * sel-sched-ir (sel_init_new_insn): New parameter old_seqno. ++ Default it to -1. Pass it down to init_simplejump_data. ++ (init_simplejump_data): New parameter old_seqno. Pass it down ++ to get_seqno_for_a_jump. ++ (get_seqno_for_a_jump): New parameter old_seqno. Use it for ++ initializing new jump seqno as a last resort. Add comment. ++ (sel_redirect_edge_and_branch): Save old seqno of the conditional ++ jump and pass it down to sel_init_new_insn. ++ (sel_redirect_edge_and_branch_force): Likewise. + -+2013-10-29 Uros Bizjak <ubizjak@gmail.com> ++2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline -+ 2013-08-08 Richard Sandiford <rdsandiford@googlemail.com> ++ 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + -+ PR rtl-optimization/58079 -+ * combine.c (combine_simplify_rtx): Avoid using SUBST if -+ simplify_comparison has widened a comparison with an integer. ++ PR rtl-optimization/60901 ++ * config/i386/i386.c (ix86_dependencies_evaluation_hook): Check that ++ bb predecessor belongs to the same scheduling region. Adjust comment. + -+2013-10-29 Martin Jambor <mjambor@suse.cz> ++2014-06-03 Uros Bizjak <ubizjak@gmail.com> + -+ PR middle-end/58789 + Backport from mainline -+ 2013-05-09 Martin Jambor <mjambor@suse.cz> -+ -+ PR lto/57084 -+ * gimple-fold.c (canonicalize_constructor_val): Call -+ cgraph_get_create_real_symbol_node instead of cgraph_get_create_node. -+ -+ Backport from mainline -+ 2013-03-16 Jan Hubicka <jh@suse.cz> -+ -+ * cgraph.h (cgraph_get_create_real_symbol_node): Declare. -+ * cgraph.c (cgraph_get_create_real_symbol_node): New function. -+ * cgrpahbuild.c: Use cgraph_get_create_real_symbol_node instead -+ of cgraph_get_create_node. -+ * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. -+ -+2013-10-28 Tom de Vries <tom@codesourcery.com> -+ -+ * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. -+ Don't commit insertions after NOTE_INSN_FUNCTION_BEG. ++ 2014-06-02 Uros Bizjak <ubizjak@gmail.com> + -+2013-10-26 Uros Bizjak <ubizjak@gmail.com> ++ PR target/61239 ++ * config/i386/i386.c (ix86_expand_vec_perm) [case V32QImode]: Use ++ GEN_INT (-128) instead of GEN_INT (128) to set MSB of QImode constant. + -+ Backport from mainline -+ 2013-10-22 Uros Bizjak <ubizjak@gmail.com> ++2014-05-28 Guozhi Wei <carrot@google.com> + -+ PR target/58779 -+ * config/i386/i386.c (put_condition_code) <case GTU, case LEU>: -+ Remove CCCmode handling. -+ <case LTU>: Return 'c' suffix for CCCmode. -+ <case GEU>: Return 'nc' suffix for CCCmode. -+ (ix86_cc_mode) <case GTU, case LEU>: Do not generate overflow checks. -+ * config/i386/i386.md (*sub<mode>3_cconly_overflow): Remove. -+ (*sub<mode>3_cc_overflow): Ditto. -+ (*subsi3_zext_cc_overflow): Ditto. ++ PR target/61202 ++ * config/aarch64/arm_neon.h (vqdmulh_n_s16): Change the last operand's ++ constraint. ++ (vqdmulhq_n_s16): Likewise. + -+2013-10-26 Uros Bizjak <ubizjak@gmail.com> ++2014-05-28 Eric Botcazou <ebotcazou@adacore.com> + + Backport from mainline -+ 2013-10-19 Uros Bizjak <ubizjak@gmail.com> ++ 2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + -+ PR target/58792 -+ * config/i386/i386.c (ix86_function_value_regno): Add DX_REG, -+ ST1_REG and XMM1_REG for 32bit and 64bit targets. Also add DI_REG -+ and SI_REG for 64bit SYSV ABI targets. ++ * double-int.c (div_and_round_double) <ROUND_DIV_EXPR>: Use the proper ++ predicate to detect a negative quotient. + -+2013-08-25 Richard Henderson <rth@twiddle.net> ++2014-05-28 Georg-Johann Lay <avr@gjlay.de> + -+ PR rtl/58542 -+ * optabs.c (maybe_emit_atomic_exchange): Use create_input_operand -+ instead of create_convert_operand_to. -+ (maybe_emit_sync_lock_test_and_set): Likewise. -+ (expand_atomic_compare_and_swap): Likewise. -+ (maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes. ++ PR target/61044 ++ * doc/extend.texi (Local Labels): Note that label differences are ++ not supported for AVR. + -+2013-10-25 Eric Botcazou <ebotcazou@adacore.com> ++2014-05-26 Michael Tautschnig <mt@debian.org> + -+ PR rtl-optimization/58831 -+ * alias.c (init_alias_analysis): At the beginning of each iteration, set -+ the reg_seen[N] bit if static_reg_base_value[N] is non-null. ++ PR target/61249 ++ * doc/extend.texi (X86 Built-in Functions): Fix parameter lists of ++ __builtin_ia32_vfrczs[sd] and __builtin_ia32_mpsadbw256. + -+2013-10-25 Eric Botcazou <ebotcazou@adacore.com> ++2014-05-23 Alan Modra <amodra@gmail.com> + -+ * recog.c (search_ofs): New static variable moved from... -+ (peep2_find_free_register): ...here. -+ (peephole2_optimize): Initialize it. ++ PR target/61231 ++ * config/rs6000/rs6000.c (mem_operand_gpr): Handle SImode. ++ * config/rs6000/rs6000.md (extendsidi2_lfiwax, extendsidi2_nocell): ++ Use "Y" constraint rather than "m". + -+2013-10-24 David Edelsohn <dje.gcc@gmail.com> ++2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline -+ 2013-10-23 David Edelsohn <dje.gcc@gmail.com> -+ -+ PR target/58838 -+ * config/rs6000/rs6000.md (mulsi3_internal1 and splitter): Add -+ TARGET_32BIT final condition. -+ (mulsi3_internal2 and splitter): Same. ++ 2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + -+2013-10-23 Tom de Vries <tom@codesourcery.com> ++ * config/rs6000/htm.md (ttest): Use correct shift value to get CR0. + -+ PR tree-optimization/58805 -+ * tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check. ++2014-05-22 Richard Earnshaw <rearnsha@arm.com> + -+2013-10-23 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-06-24 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/57488 -+ * tree-ssa-pre.c (insert): Clear NEW sets before each iteration. -+ -+2013-10-16 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> -+ -+ Backport from mainline -+ 2013-10-16 Ganesh Gopalasubramanian -+ <Ganesh.Gopalasubramanian@amd.com> ++ PR target/61208 ++ * arm.md (arm_cmpdi_unsigned): Fix length calculation for Thumb2. + -+ * config/i386/i386.c (ix86_option_override_internal): Enable FMA4 -+ for AMD bdver3. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -@@ -639,7 +5469,7 @@ - 2013-07-31 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> - - Backport from mainline -- 2013-03-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ 2013-03-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + 2014-05-22 Release Manager - * config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Define. - -Index: gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* { dg-do compile } */ -+/* { dg-require-effective-target arm_thumb1_ok } */ -+/* { dg-options "-mthumb -fpic -msingle-pic-base" } */ -+ -+int g_test; -+ -+int -+foo (int par) -+{ -+ g_test = par; -+} -Index: gcc/testsuite/gcc.target/arm/neon/vst1Q_laneu64-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/neon/vst1Q_laneu64-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/neon/vst1Q_laneu64-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,25 @@ -+/* Test the `vst1Q_laneu64' ARM Neon intrinsic. */ -+ -+/* Detect ICE in the case of unaligned memory address. */ -+ -+/* { dg-do compile } */ -+/* { dg-require-effective-target arm_neon_ok } */ -+/* { dg-add-options arm_neon } */ -+ -+#include "arm_neon.h" -+ -+unsigned char dummy_store[1000]; -+ -+void -+foo (char* addr) -+{ -+ uint8x16_t vdata = vld1q_u8 (addr); -+ vst1q_lane_u64 ((uint64_t*) &dummy_store, vreinterpretq_u64_u8 (vdata), 0); -+} -+ -+uint64_t -+bar (uint64x2_t vdata) -+{ -+ vdata = vld1q_lane_u64 ((uint64_t*) &dummy_store, vdata, 0); -+ return vgetq_lane_u64 (vdata, 0); -+} -Index: gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* { dg-do compile } */ -+/* { dg-require-effective-target arm_thumb1_ok } */ -+/* { dg-options "-mthumb -fpic -mpic-register=9" } */ -+ -+int g_test; -+ -+int -+foo (int par) -+{ -+ g_test = par; -+} -Index: gcc/testsuite/gcc.target/arm/require-pic-register-loc.c + * GCC 4.8.3 released. +Index: gcc/testsuite/gcc.target/powerpc/tfmode_off.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-do compile } */ -+/* { dg-options "-g -fPIC" } */ -+ -+void *v; -+void a (void *x) { } -+void b (void) { } -+ /* line 7. */ -+int /* line 8. */ -+main (int argc) /* line 9. */ -+{ /* line 10. */ -+ if (argc == 12345) /* line 11. */ -+ { -+ a (v); -+ return 1; -+ } -+ b (); -+ -+ return 0; -+} -+ -+/* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */ -+/* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */ -+/* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */ -+ -+/* The loc at the start of the prologue. */ -+/* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */ -+ -+/* The loc at the end of the prologue, with the first user line. */ -+/* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */ -Index: gcc/testsuite/gcc.target/arm/vrinta-ce.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/vrinta-ce.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/vrinta-ce.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* { dg-do compile } */ -+/* { dg-require-effective-target arm_v8_vfp_ok } */ -+/* { dg-options "-O2 -marm -march=armv8-a" } */ -+/* { dg-add-options arm_v8_vfp } */ -+ -+double foo (double a) -+{ -+ if (a > 3.0) -+ return __builtin_round (a); -+ -+ return 0.0; -+} -+ -+/* { dg-final { scan-assembler-times "vrinta.f64\td\[0-9\]+" 1 } } */ -+ -Index: gcc/testsuite/gcc.target/arm/pr54300.C -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/pr54300.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/pr54300.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,61 @@ -+/* { dg-do run } */ -+/* { dg-require-effective-target arm_neon } */ -+/* { dg-options "-O2" } */ -+/* { dg-add-options arm_neon } */ -+ -+#include <arm_neon.h> -+#include <stdlib.h> -+ -+struct __attribute__ ((aligned(8))) _v16u8_ { -+ uint8x16_t val; -+ _v16u8_( const int16x8_t &src) { val = vreinterpretq_u8_s16(src); } -+ operator int16x8_t () const { return vreinterpretq_s16_u8(val); } -+}; -+typedef struct _v16u8_ v16u8; -+ -+struct __attribute__ ((aligned(4))) _v8u8_ { -+ uint8x8_t val; -+ _v8u8_( const uint8x8_t &src) { val = src; } -+ operator int16x4_t () const { return vreinterpret_s16_u8(val); } -+}; -+typedef struct _v8u8_ v8u8; -+ -+typedef v16u8 v8i16; -+typedef int32x4_t v4i32; -+typedef const short cv1i16; -+typedef const unsigned char cv1u8; -+typedef const v8i16 cv8i16; -+ -+static inline __attribute__((always_inline)) v8u8 zero_64(){ return vdup_n_u8( 0 ); } -+ -+static inline __attribute__((always_inline)) v8i16 loadlo_8i16( cv8i16* p ){ -+ return vcombine_s16( vld1_s16( (cv1i16 *)p ), zero_64() ); -+} -+static inline __attribute__((always_inline)) v8i16 _loadlo_8i16( cv8i16* p, int offset ){ -+ return loadlo_8i16( (cv8i16*)(&((cv1u8*)p)[offset]) ); -+} -+ -+void __attribute__((noinline)) -+test(unsigned short *_Inp, int32_t *_Out, -+ unsigned int s1v, unsigned int dv0, -+ unsigned int smask_v) -+{ -+ int32x4_t c = vdupq_n_s32(0); -+ -+ for(unsigned int sv=0 ; sv!=dv0 ; sv=(sv+s1v)&smask_v ) -+ { -+ int32x4_t s; -+ s = vmovl_s16( vget_low_s16( _loadlo_8i16( (cv8i16*) _Inp, sv ) ) ); -+ c = vaddq_s32( c, s ); -+ } -+ vst1q_s32( _Out, c ); -+} -+ -+main() -+{ -+ unsigned short a[4] = {1, 2, 3, 4}; -+ int32_t b[4] = {0, 0, 0, 0}; -+ test(a, b, 1, 1, ~0); -+ if (b[0] != 1 || b[1] != 2 || b[2] != 3 || b[3] != 4) -+ abort(); -+} -Index: gcc/testsuite/gcc.target/arm/pr59826.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/pr59826.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/pr59826.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,35 @@ -+/* { dg-do compile } */ -+/* { dg-options "-mthumb -mcpu=cortex-m4 -fprefetch-loop-arrays -O2" } */ -+ -+typedef struct genxWriter_rec * genxWriter; -+typedef unsigned char * utf8; -+typedef const unsigned char * constUtf8; -+ -+int genxScrubText(genxWriter w, constUtf8 in, utf8 out) -+{ -+ int problems = 0; -+ constUtf8 last = in; -+ -+ while (*in) -+ { -+ int c = genxNextUnicodeChar(&in); -+ if (c == -1) -+ { -+ problems++; -+ last = in; -+ continue; -+ } -+ -+ if (!isXMLChar(w, c)) -+ { -+ problems++; -+ last = in; -+ continue; -+ } -+ -+ while (last < in) -+ *out++ = *last++; -+ } -+ *out = 0; -+ return problems; -+} -Index: gcc/testsuite/gcc.target/arm/pr57637.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/arm/pr57637.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/arm/pr57637.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,206 @@ -+/* { dg-do run } */ -+/* { dg-options "-O2 -fno-inline" } */ -+ -+typedef struct _GtkCssStyleProperty GtkCssStyleProperty; -+ -+struct _GtkCssStyleProperty -+{ -+ int *initial_value; -+ unsigned int id; -+ unsigned int inherit :1; -+ unsigned int animated :1; -+ unsigned int affects_size :1; -+ unsigned int affects_font :1; -+ -+ int * parse_value; -+ int * query_value; -+ int * assign_value; -+}; -+ -+void -+g_assertion_message_expr (const char *domain, -+ const char *file, -+ int line, -+ const char *func, -+ const char *expr) __attribute__((__noreturn__)); -+ -+void -+g_assertion_message_expr (const char *domain, -+ const char *file, -+ int line, -+ const char *func, -+ const char *expr) -+{ -+ __builtin_abort (); -+} -+int -+get_id (GtkCssStyleProperty *property) -+{ -+ return 1; -+} -+int -+_gtk_css_style_property_get_type () -+{ -+ return 1; -+} -+ -+GtkCssStyleProperty * -+g_object_new (int object_type, -+ const char *first_property_name, -+ ...) -+{ -+ return (GtkCssStyleProperty *) __builtin_malloc (sizeof (GtkCssStyleProperty)); -+} -+ -+typedef enum { -+ INHERIT = (1 << 0), -+ ANIMATED = (1 << 1), -+ RESIZE = (1 << 2), -+ FONT = (1 << 3) -+} GtkStylePropertyFlags; -+ -+int t = 0; -+void -+gtk_css_style_property_register (const char * name, -+ int expected_id, -+ int value_type, -+ int flags, -+ int *parse_value, -+ int *query_value, -+ int *assign_value, -+ int *initial_value) -+{ -+ GtkCssStyleProperty *node; -+ -+ do -+ { -+ if (__builtin_expect (__extension__ ( -+ { -+ int _g_boolean_var_; -+ if (initial_value != ((void *)0)) -+ _g_boolean_var_ = 1; -+ else -+ _g_boolean_var_ = 0; -+ _g_boolean_var_; -+ }), -+ 1)) -+ ; -+ else -+ g_assertion_message_expr ("Gtk", -+ "gtkcssstylepropertyimpl.c", -+ 85, -+ ((const char*) (__PRETTY_FUNCTION__)), -+ "initial_value != NULL"); -+ } while (0); -+ -+ do -+ { -+ if (__builtin_expect (__extension__ ( -+ { -+ int _g_boolean_var_; -+ if (parse_value != ((void *)0)) -+ _g_boolean_var_ = 1; -+ else -+ _g_boolean_var_ = 0; -+ _g_boolean_var_; -+ }), -+ 1)) -+ ; -+ else -+ g_assertion_message_expr ("Gtk", -+ "gtkcssstylepropertyimpl.c", -+ 86, -+ ((const char*) (__PRETTY_FUNCTION__)), -+ "parse_value != NULL"); -+ } while (0); -+ -+ do -+ { -+ if (__builtin_expect (__extension__ ( -+ { -+ int _g_boolean_var_; -+ if (value_type == ((int) ((1) << (2))) -+ || query_value != ((void *)0)) -+ _g_boolean_var_ = 1; -+ else -+ _g_boolean_var_ = 0; -+ _g_boolean_var_; -+ }), -+ 1)) -+ ; -+ else -+ g_assertion_message_expr ("Gtk", -+ "gtkcssstylepropertyimpl.c", -+ 87, ((const char*) (__PRETTY_FUNCTION__)), -+ "value_type == NONE || query_value != NULL"); -+ } while (0); -+ -+ /* FLAGS is changed in a cond_exec instruction with pr57637. */ -+ if (flags == 15) -+ t = 15; -+ -+ do -+ { -+ if (__builtin_expect (__extension__ ( -+ { -+ int _g_boolean_var_; -+ if (value_type == ((1) << (2)) -+ || assign_value != ((void *)0)) -+ _g_boolean_var_ = 1; -+ else -+ _g_boolean_var_ = 0; -+ _g_boolean_var_; -+ }), -+ 1)) -+ ; -+ else -+ g_assertion_message_expr ("Gtk", -+ "gtkcssstylepropertyimpl.c", -+ 88, ((const char*) (__PRETTY_FUNCTION__)), -+ "value_type == NONE || assign_value != NULL"); -+ } while (0); -+ -+ node = g_object_new ((_gtk_css_style_property_get_type ()), -+ "value-type", value_type, -+ "affects-size", (flags & RESIZE) ? (0) : (!(0)), -+ "affects-font", (flags & FONT) ? (!(0)) : (0), -+ "animated", (flags & ANIMATED) ? (!(0)) : (0), -+ "inherit", (flags & INHERIT) ? (!(0)) : (0), -+ "initial-value", initial_value, -+ "name", name, -+ ((void *)0)); -+ -+ node->parse_value = parse_value; -+ node->query_value = query_value; -+ node->assign_value = assign_value; -+ -+ do -+ { -+ if (__builtin_expect (__extension__ ( -+ { -+ int _g_boolean_var_; -+ if (get_id (node) == expected_id) -+ _g_boolean_var_ = 1; -+ else -+ _g_boolean_var_ = 0; -+ _g_boolean_var_; -+ }), -+ 1)) -+ ; -+ else -+ g_assertion_message_expr ("Gtk", -+ "gtkcssstylepropertyimpl.c", -+ 106, -+ ((const char*) (__PRETTY_FUNCTION__)), -+ "get_id (node) == expected_id"); -+ } while (0); -+} -+ -+int main () -+{ -+ gtk_css_style_property_register ("test", 1, 4, 15, &t, &t, &t, &t); -+ -+ if (t != 15) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.target/powerpc/ppc-target-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c (.../branches/gcc-4_8-branch) -@@ -5,8 +5,7 @@ - /* { dg-final { scan-assembler-times "fabs" 3 } } */ - /* { dg-final { scan-assembler-times "fnabs" 3 } } */ - /* { dg-final { scan-assembler-times "fsel" 3 } } */ --/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */ --/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */ -+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */ - - /* fabs/fnabs/fsel */ - double normal1 (double a, double b) { return __builtin_copysign (a, b); } -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,65 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#ifndef TYPE -+#define TYPE long long -+#endif -+ -+#ifndef SIGN_TYPE -+#define SIGN_TYPE signed TYPE -+#endif -+ -+#ifndef UNS_TYPE -+#define UNS_TYPE unsigned TYPE -+#endif -+ -+typedef vector SIGN_TYPE v_sign; -+typedef vector UNS_TYPE v_uns; -+ -+v_sign sign_add (v_sign a, v_sign b) -+{ -+ return a + b; -+} -+ -+v_sign sign_sub (v_sign a, v_sign b) -+{ -+ return a - b; -+} -+ -+v_sign sign_shift_left (v_sign a, v_sign b) -+{ -+ return a << b; -+} -+ -+v_sign sign_shift_right (v_sign a, v_sign b) -+{ -+ return a >> b; -+} -+ -+v_uns uns_add (v_uns a, v_uns b) -+{ -+ return a + b; -+} -+ -+v_uns uns_sub (v_uns a, v_uns b) -+{ -+ return a - b; -+} -+ -+v_uns uns_shift_left (v_uns a, v_uns b) -+{ -+ return a << b; -+} -+ -+v_uns uns_shift_right (v_uns a, v_uns b) -+{ -+ return a >> b; -+} -+ -+/* { dg-final { scan-assembler-times "vaddudm" 2 } } */ -+/* { dg-final { scan-assembler-times "vsubudm" 2 } } */ -+/* { dg-final { scan-assembler-times "vsld" 2 } } */ -+/* { dg-final { scan-assembler-times "vsrad" 1 } } */ -+/* { dg-final { scan-assembler-times "vsrd" 1 } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,200 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#ifndef TYPE -+#define TYPE long long -+#endif -+ -+#ifndef SIGN_TYPE -+#define SIGN_TYPE signed TYPE -+#endif -+ -+#ifndef UNS_TYPE -+#define UNS_TYPE unsigned TYPE -+#endif -+ -+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN))) -+ -+SIGN_TYPE sa[SIZE] ALIGN_ATTR; -+SIGN_TYPE sb[SIZE] ALIGN_ATTR; -+SIGN_TYPE sc[SIZE] ALIGN_ATTR; -+ -+UNS_TYPE ua[SIZE] ALIGN_ATTR; -+UNS_TYPE ub[SIZE] ALIGN_ATTR; -+UNS_TYPE uc[SIZE] ALIGN_ATTR; -+ -+void -+sign_add (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = sb[i] + sc[i]; -+} -+ -+void -+sign_sub (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = sb[i] - sc[i]; -+} -+ -+void -+sign_shift_left (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = sb[i] << sc[i]; -+} -+ -+void -+sign_shift_right (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = sb[i] >> sc[i]; -+} -+ -+void -+sign_max (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = (sb[i] > sc[i]) ? sb[i] : sc[i]; -+} -+ -+void -+sign_min (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = (sb[i] < sc[i]) ? sb[i] : sc[i]; -+} -+ -+void -+sign_abs (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = (sb[i] < 0) ? -sb[i] : sb[i]; /* xor, vsubudm, vmaxsd. */ -+} -+ -+void -+sign_eq (SIGN_TYPE val1, SIGN_TYPE val2) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = (sb[i] == sc[i]) ? val1 : val2; -+} -+ -+void -+sign_lt (SIGN_TYPE val1, SIGN_TYPE val2) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ sa[i] = (sb[i] < sc[i]) ? val1 : val2; -+} -+ -+void -+uns_add (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = ub[i] + uc[i]; -+} -+ -+void -+uns_sub (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = ub[i] - uc[i]; -+} -+ -+void -+uns_shift_left (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = ub[i] << uc[i]; -+} -+ -+void -+uns_shift_right (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = ub[i] >> uc[i]; -+} -+ -+void -+uns_max (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = (ub[i] > uc[i]) ? ub[i] : uc[i]; -+} -+ -+void -+uns_min (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = (ub[i] < uc[i]) ? ub[i] : uc[i]; -+} -+ -+void -+uns_eq (UNS_TYPE val1, UNS_TYPE val2) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = (ub[i] == uc[i]) ? val1 : val2; -+} -+ -+void -+uns_lt (UNS_TYPE val1, UNS_TYPE val2) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ ua[i] = (ub[i] < uc[i]) ? val1 : val2; -+} -+ -+/* { dg-final { scan-assembler-times "\[\t \]vaddudm\[\t \]" 2 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vsubudm\[\t \]" 3 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vmaxsd\[\t \]" 2 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vmaxud\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vminsd\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vminud\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vsld\[\t \]" 2 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vsrad\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vsrd\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vcmpequd\[\t \]" 2 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtsd\[\t \]" 1 } } */ -+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtud\[\t \]" 1 } } */ -Index: gcc/testsuite/gcc.target/powerpc/pr57744.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr57744.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57744.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,39 @@ -+/* { dg-do run { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3" } */ -+ -+void abort (void); -+ -+typedef unsigned U_16 __attribute__((mode(TI))); -+ -+extern int libat_compare_exchange_16 (U_16 *, U_16 *, U_16, int, int) -+ __attribute__((__noinline__)); -+ -+/* PR 57744: lqarx/stqcx needs even/odd register pairs. The assembler will -+ complain if the compiler gets an odd/even register pair. Create a function -+ which has the 16 byte compare and exchange instructions, but don't actually -+ execute it, so that we can detect these failures on older machines. */ -+ -+int -+libat_compare_exchange_16 (U_16 *mptr, U_16 *eptr, U_16 newval, -+ int smodel, int fmodel __attribute__((unused))) -+{ -+ if (((smodel) == 0)) -+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 0, 0); -+ else if (((smodel) != 5)) -+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 4, 0); -+ else -+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 5, 0); -+} -+ -+U_16 a = 1, b = 1, c = -2; -+volatile int do_test = 0; -+ -+int main (void) -+{ -+ if (do_test && !libat_compare_exchange_16 (&a, &b, c, 0, 0)) -+ abort (); -+ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/powerpc/recip-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/recip-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-1.c (.../branches/gcc-4_8-branch) -@@ -3,8 +3,8 @@ - /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power6" } */ - /* { dg-final { scan-assembler-times "frsqrte" 2 } } */ - /* { dg-final { scan-assembler-times "fmsub" 2 } } */ --/* { dg-final { scan-assembler-times "fmul" 8 } } */ --/* { dg-final { scan-assembler-times "fnmsub" 4 } } */ -+/* { dg-final { scan-assembler-times "fmul" 6 } } */ -+/* { dg-final { scan-assembler-times "fnmsub" 3 } } */ - - double - rsqrt_d (double a) -Index: gcc/testsuite/gcc.target/powerpc/darwin-longlong.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c (.../branches/gcc-4_8-branch) -@@ -11,7 +11,11 @@ - int i[2]; - } ud; - ud.ll = in; -+#ifdef __LITTLE_ENDIAN__ -+ return ud.i[1]; -+#else - return ud.i[0]; -+#endif - } +--- a/src/gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../branches/gcc-4_8-branch) +@@ -1,6 +1,7 @@ + /* { dg-do assemble } */ + /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ + /* { dg-skip-if "no TFmode" { powerpc-*-eabi* } { "*" } { "" } } */ ++/* { dg-require-effective-target longdouble128 } */ + /* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ - int main() -Index: gcc/testsuite/gcc.target/powerpc/bool2-p8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-O2 -mcpu=power8" } */ -+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlnand " } } */ -+ -+#ifndef TYPE -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+ -+#include "bool2.h" -Index: gcc/testsuite/gcc.target/powerpc/mmfpgpr.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power6x -mmfpgpr" } */ -+/* { dg-final { scan-assembler "mffgpr" } } */ -+/* { dg-final { scan-assembler "mftgpr" } } */ -+ -+/* Test that we generate the instructions to move between the GPR and FPR -+ registers under power6x. */ -+ -+extern long return_long (void); -+extern double return_double (void); -+ -+double return_double2 (void) -+{ -+ return (double) return_long (); -+} -+ -+long return_long2 (void) -+{ -+ return (long) return_double (); -+} -Index: gcc/testsuite/gcc.target/powerpc/pr60203.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr60203.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr60203.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,40 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3" } */ -+ -+union u_ld { long double ld; double d[2]; }; -+ -+long double -+pack (double a, double aa) -+{ -+ union u_ld u; -+ u.d[0] = a; -+ u.d[1] = aa; -+ return u.ld; -+} -+ -+double -+unpack_0 (long double x) -+{ -+ union u_ld u; -+ u.ld = x; -+ return u.d[0]; -+} -+ -+double -+unpack_1 (long double x) -+{ -+ union u_ld u; -+ u.ld = x; -+ return u.d[1]; -+} -+ -+/* { dg-final { scan-assembler-not "stfd" } } */ -+/* { dg-final { scan-assembler-not "lfd" } } */ -+/* { dg-final { scan-assembler-not "lxsdx" } } */ -+/* { dg-final { scan-assembler-not "stxsdx" } } */ -+/* { dg-final { scan-assembler-not "mfvsrd" } } */ -+/* { dg-final { scan-assembler-not "mtvsrd" } } */ -+ -+ -Index: gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c + typedef float TFmode __attribute__ ((mode (TF))); +Index: gcc/testsuite/gcc.target/powerpc/pack02.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+/* { dg-final { scan-assembler "mtvsrd" } } */ -+/* { dg-final { scan-assembler "mfvsrd" } } */ -+ -+/* Check code generation for direct move for vector types. */ -+ -+#define TYPE vector int -+#define VSX_REG_ATTR "wa" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/bool2-av.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_altivec_ok } */ -+/* { dg-options "-O2 -mcpu=power6 -maltivec" } */ -+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */ -+/* { dg-final { scan-assembler "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+#ifndef TYPE -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+ -+#include "bool2.h" -Index: gcc/testsuite/gcc.target/powerpc/pr43154.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr43154.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr43154.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* { dg-do compile { target { powerpc*-*-* } } } */ +--- a/src/gcc/testsuite/gcc.target/powerpc/pack02.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/pack02.c (.../branches/gcc-4_8-branch) +@@ -2,6 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */ - /* { dg-require-effective-target powerpc_vsx_ok } */ - /* { dg-options "-O2 -mcpu=power7" } */ - -Index: gcc/testsuite/gcc.target/powerpc/pr59054.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr59054.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr59054.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-mcpu=power7 -O0 -m64" } */ -+ -+long foo (void) { return 0; } -+ -+/* { dg-final { scan-assembler-not "xxlor" } } */ -+/* { dg-final { scan-assembler-not "stfd" } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,204 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#include <altivec.h> -+ -+typedef vector long long v_sign; -+typedef vector unsigned long long v_uns; -+typedef vector bool long long v_bool; -+ -+v_sign sign_add_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vaddudm (a, b); -+} -+ -+v_sign sign_add_2 (v_sign a, v_sign b) -+{ -+ return vec_add (a, b); -+} -+ -+v_sign sign_add_3 (v_sign a, v_sign b) -+{ -+ return vec_vaddudm (a, b); -+} -+ -+v_sign sign_sub_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vsubudm (a, b); -+} -+ -+v_sign sign_sub_2 (v_sign a, v_sign b) -+{ -+ return vec_sub (a, b); -+} -+ -+ -+v_sign sign_sub_3 (v_sign a, v_sign b) -+{ -+ return vec_vsubudm (a, b); -+} -+ -+v_sign sign_min_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vminsd (a, b); -+} -+ -+v_sign sign_min_2 (v_sign a, v_sign b) -+{ -+ return vec_min (a, b); -+} -+ -+v_sign sign_min_3 (v_sign a, v_sign b) -+{ -+ return vec_vminsd (a, b); -+} -+ -+v_sign sign_max_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vmaxsd (a, b); -+} -+ -+v_sign sign_max_2 (v_sign a, v_sign b) -+{ -+ return vec_max (a, b); -+} -+ -+v_sign sign_max_3 (v_sign a, v_sign b) -+{ -+ return vec_vmaxsd (a, b); -+} -+ -+v_sign sign_abs (v_sign a) -+{ -+ return vec_abs (a); /* xor, vsubudm, vmaxsd. */ -+} -+ -+v_bool sign_eq (v_sign a, v_sign b) -+{ -+ return vec_cmpeq (a, b); -+} -+ -+v_bool sign_lt (v_sign a, v_sign b) -+{ -+ return vec_cmplt (a, b); -+} -+ -+v_uns uns_add_2 (v_uns a, v_uns b) -+{ -+ return vec_add (a, b); -+} -+ -+v_uns uns_add_3 (v_uns a, v_uns b) -+{ -+ return vec_vaddudm (a, b); -+} -+ -+v_uns uns_sub_2 (v_uns a, v_uns b) -+{ -+ return vec_sub (a, b); -+} -+ -+v_uns uns_sub_3 (v_uns a, v_uns b) -+{ -+ return vec_vsubudm (a, b); -+} -+ -+v_uns uns_min_2 (v_uns a, v_uns b) -+{ -+ return vec_min (a, b); -+} -+ -+v_uns uns_min_3 (v_uns a, v_uns b) -+{ -+ return vec_vminud (a, b); -+} -+ -+v_uns uns_max_2 (v_uns a, v_uns b) -+{ -+ return vec_max (a, b); -+} -+ -+v_uns uns_max_3 (v_uns a, v_uns b) -+{ -+ return vec_vmaxud (a, b); -+} -+ -+v_bool uns_eq (v_uns a, v_uns b) -+{ -+ return vec_cmpeq (a, b); -+} -+ -+v_bool uns_lt (v_uns a, v_uns b) -+{ -+ return vec_cmplt (a, b); -+} -+ -+v_sign sign_rl_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vrld (a, b); -+} -+ -+v_sign sign_rl_2 (v_sign a, v_uns b) -+{ -+ return vec_rl (a, b); -+} -+ -+v_uns uns_rl_2 (v_uns a, v_uns b) -+{ -+ return vec_rl (a, b); -+} -+ -+v_sign sign_sl_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vsld (a, b); -+} -+ -+v_sign sign_sl_2 (v_sign a, v_uns b) -+{ -+ return vec_sl (a, b); -+} -+ -+v_sign sign_sl_3 (v_sign a, v_uns b) -+{ -+ return vec_vsld (a, b); -+} -+ -+v_uns uns_sl_2 (v_uns a, v_uns b) -+{ -+ return vec_sl (a, b); -+} -+ -+v_uns uns_sl_3 (v_uns a, v_uns b) -+{ -+ return vec_vsld (a, b); -+} -+ -+v_sign sign_sra_1 (v_sign a, v_sign b) -+{ -+ return __builtin_altivec_vsrad (a, b); -+} -+ -+v_sign sign_sra_2 (v_sign a, v_uns b) -+{ -+ return vec_sra (a, b); -+} -+ -+v_sign sign_sra_3 (v_sign a, v_uns b) -+{ -+ return vec_vsrad (a, b); -+} -+ -+/* { dg-final { scan-assembler-times "vaddudm" 5 } } */ -+/* { dg-final { scan-assembler-times "vsubudm" 6 } } */ -+/* { dg-final { scan-assembler-times "vmaxsd" 4 } } */ -+/* { dg-final { scan-assembler-times "vminsd" 3 } } */ -+/* { dg-final { scan-assembler-times "vmaxud" 2 } } */ -+/* { dg-final { scan-assembler-times "vminud" 2 } } */ -+/* { dg-final { scan-assembler-times "vcmpequd" 2 } } */ -+/* { dg-final { scan-assembler-times "vcmpgtsd" 1 } } */ -+/* { dg-final { scan-assembler-times "vcmpgtud" 1 } } */ -+/* { dg-final { scan-assembler-times "vrld" 3 } } */ -+/* { dg-final { scan-assembler-times "vsld" 5 } } */ -+/* { dg-final { scan-assembler-times "vsrad" 3 } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,30 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */ -+ -+#include <stddef.h> -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN))) -+ -+long long sign_ll[SIZE] ALIGN_ATTR; -+int sign_i [SIZE] ALIGN_ATTR; -+ -+void copy_int_to_long_long (void) -+{ -+ size_t i; -+ -+ for (i = 0; i < SIZE; i++) -+ sign_ll[i] = sign_i[i]; -+} -+ -+/* { dg-final { scan-assembler "vupkhsw" } } */ -+/* { dg-final { scan-assembler "vupklsw" } } */ -Index: gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-require-effective-target powerpc_altivec_ok } */ -+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */ -+/* { dg-options "-O -maltivec -mno-vsx" } */ -+ -+typedef unsigned char V __attribute__((vector_size(16))); -+ -+V p2(V x, V y) -+{ -+ return __builtin_shuffle(x, y, -+ (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 }); -+ -+} -+ -+V p4(V x, V y) -+{ -+ return __builtin_shuffle(x, y, -+ (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 }); -+} -+ -+/* { dg-final { scan-assembler-not "vperm" } } */ -+/* { dg-final { scan-assembler "vpkuhum" } } */ -+/* { dg-final { scan-assembler "vpkuwum" } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,85 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3 -mvsx-timode" } */ -+ -+#include <altivec.h> -+ -+#ifndef TYPE -+#define TYPE vector __int128_t -+#endif -+ -+TYPE -+do_addcuq (TYPE p, TYPE q) -+{ -+ return __builtin_vec_vaddcuq (p, q); -+} -+ -+TYPE -+do_adduqm (TYPE p, TYPE q) -+{ -+ return __builtin_vec_add (p, q); -+} -+ -+TYPE -+do_addeuqm (TYPE p, TYPE q, TYPE r) -+{ -+ return __builtin_vec_vaddeuqm (p, q, r); -+} -+ -+TYPE -+do_addecuq (TYPE p, TYPE q, TYPE r) -+{ -+ return __builtin_vec_vaddecuq (p, q, r); -+} -+ -+TYPE -+do_subeuqm (TYPE p, TYPE q, TYPE r) -+{ -+ return __builtin_vec_vsubeuqm (p, q, r); -+} -+ -+TYPE -+do_subecuq (TYPE p, TYPE q, TYPE r) -+{ -+ return __builtin_vec_vsubecuq (p, q, r); -+} -+ -+TYPE -+do_subcuq (TYPE p, TYPE q) -+{ -+ return __builtin_vec_vsubcuq (p, q); -+} -+ -+TYPE -+do_subuqm (TYPE p, TYPE q) -+{ -+ return __builtin_vec_vsubuqm (p, q); -+} -+ -+TYPE -+do_zero (void) -+{ -+ return (TYPE) { 0 }; -+} -+ -+TYPE -+do_minus_one (void) -+{ -+ return (TYPE) { -1 }; -+} -+ -+/* { dg-final { scan-assembler "vaddcuq" } } */ -+/* { dg-final { scan-assembler "vadduqm" } } */ -+/* { dg-final { scan-assembler "vaddecuq" } } */ -+/* { dg-final { scan-assembler "vaddeuqm" } } */ -+/* { dg-final { scan-assembler "vsubecuq" } } */ -+/* { dg-final { scan-assembler "vsubeuqm" } } */ -+/* { dg-final { scan-assembler "vsubcuq" } } */ -+/* { dg-final { scan-assembler "vsubuqm" } } */ -+/* { dg-final { scan-assembler-not "mtvsrd" } } */ -+/* { dg-final { scan-assembler-not "mfvsrd" } } */ -+/* { dg-final { scan-assembler-not "ori 2,2,0" } } */ -+/* { dg-final { scan-assembler-not "xxpermdi" } } */ -+/* { dg-final { scan-assembler-not "stxvd2x" } } */ -+/* { dg-final { scan-assembler-not "stxvw4x" } } */ -Index: gcc/testsuite/gcc.target/powerpc/pr58673-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,78 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -m64 -O1" } */ -+ -+enum typecode -+{ -+ QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode, -+ DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE -+}; -+enum bytecode_opcode -+{ -+ neverneverland, drop, duplicate, over, setstackSI, adjstackSI, constQI, -+ constHI, constSI, constDI, constSF, constDF, constXF, constP, loadQI, -+ loadHI, loadSI, loadDI, loadSF, loadDF, loadXF, loadP, storeQI, storeHI, -+ storeSI, storeDI, storeSF, storeDF, storeXF, storeP, storeBLK, clearBLK, -+ addconstPSI, newlocalSI, localP, argP, convertQIHI, convertHISI, -+ convertSIDI, convertQISI, convertQUHU, convertHUSU, convertSUDU, -+ convertQUSU, convertSFDF, convertDFXF, convertHIQI, convertSIHI, -+ convertDISI, convertSIQI, convertSUQU, convertDFSF, convertXFDF, -+ convertSISF, convertSIDF, convertSIXF, convertSUSF, convertSUDF, -+ convertSUXF, convertDISF, convertDIDF, convertDIXF, convertDUSF, -+ convertDUDF, convertDUXF, convertSFSI, convertDFSI, convertXFSI, -+ convertSFSU, convertDFSU, convertXFSU, convertSFDI, convertDFDI, -+ convertXFDI, convertSFDU, convertDFDU, convertXFDU, convertPSI, -+ convertSIP, convertSIT, convertDIT, convertSFT, convertDFT, convertXFT, -+ convertPT, zxloadBI, sxloadBI, sstoreBI, addSI, addDI, addSF, addDF, -+ addXF, addPSI, subSI, subDI, subSF, subDF, subXF, subPP, mulSI, mulDI, -+ mulSU, mulDU, mulSF, mulDF, mulXF, divSI, divDI, divSU, divDU, divSF, -+ divDF, divXF, modSI, modDI, modSU, modDU, andSI, andDI, iorSI, iorDI, -+ xorSI, xorDI, lshiftSI, lshiftSU, lshiftDI, lshiftDU, rshiftSI, rshiftSU, -+ rshiftDI, rshiftDU, ltSI, ltSU, ltDI, ltDU, ltSF, ltDF, ltXF, ltP, leSI, -+ leSU, leDI, leDU, leSF, leDF, leXF, leP, geSI, geSU, geDI, geDU, geSF, -+ geDF, geXF, geP, gtSI, gtSU, gtDI, gtDU, gtSF, gtDF, gtXF, gtP, eqSI, -+ eqDI, eqSF, eqDF, eqXF, eqP, neSI, neDI, neSF, neDF, neXF, neP, negSI, -+ negDI, negSF, negDF, negXF, notSI, notDI, notT, predecQI, predecHI, -+ predecSI, predecDI, predecP, predecSF, predecDF, predecXF, predecBI, -+ preincQI, preincHI, preincSI, preincDI, preincP, preincSF, preincDF, -+ preincXF, preincBI, postdecQI, postdecHI, postdecSI, postdecDI, postdecP, -+ postdecSF, postdecDF, postdecXF, postdecBI, postincQI, postincHI, -+ postincSI, postincDI, postincP, postincSF, postincDF, postincXF, -+ postincBI, xjumpif, xjumpifnot, jump, jumpP, caseSI, caseSU, caseDI, -+ caseDU, call, returnP, ret, linenote, LAST_AND_UNUSED_OPCODE -+}; -+struct binary_operator -+{ -+ enum bytecode_opcode opcode; -+ enum typecode arg0; -+}; -+static struct conversion_recipe -+{ -+ unsigned char *opcodes; -+ int cost; -+} -+conversion_recipe[((int) LAST_AND_UNUSED_TYPECODE)][((int) -+ LAST_AND_UNUSED_TYPECODE)]; -+static struct conversion_recipe -+deduce_conversion (from, to) -+ enum typecode from, to; -+{ -+ (conversion_recipe[(int) from][(int) to]. -+ opcodes ? 0 : (conversion_recipe[(int) from][(int) to] = -+ deduce_conversion (from, to), 0)); -+} -+ -+void -+bc_expand_binary_operation (optab, resulttype, arg0, arg1) -+ struct binary_operator optab[]; -+{ -+ int i, besti, cost, bestcost; -+ enum typecode resultcode, arg0code; -+ for (i = 0; optab[i].opcode != -1; ++i) -+ { -+ (conversion_recipe[(int) arg0code][(int) optab[i].arg0]. -+ opcodes ? 0 : (conversion_recipe[(int) arg0code][(int) optab[i].arg0] = -+ deduce_conversion (arg0code, optab[i].arg0), 0)); -+ } -+} -Index: gcc/testsuite/gcc.target/powerpc/no-r11-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ - /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */ - /* { dg-options "-O2 -mno-pointers-to-nested-functions" } */ - - int -Index: gcc/testsuite/gcc.target/powerpc/p8vector-fp.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,139 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf -fno-math-errno" } */ -+ -+float abs_sf (float *p) -+{ -+ float f = *p; -+ __asm__ ("# reg %x0" : "+v" (f)); -+ return __builtin_fabsf (f); -+} -+ -+float nabs_sf (float *p) -+{ -+ float f = *p; -+ __asm__ ("# reg %x0" : "+v" (f)); -+ return - __builtin_fabsf (f); -+} -+ -+float neg_sf (float *p) -+{ -+ float f = *p; -+ __asm__ ("# reg %x0" : "+v" (f)); -+ return - f; -+} -+ -+float add_sf (float *p, float *q) -+{ -+ float f1 = *p; -+ float f2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); -+ return f1 + f2; -+} -+ -+float sub_sf (float *p, float *q) -+{ -+ float f1 = *p; -+ float f2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); -+ return f1 - f2; -+} -+ -+float mul_sf (float *p, float *q) -+{ -+ float f1 = *p; -+ float f2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); -+ return f1 * f2; -+} -+ -+float div_sf (float *p, float *q) -+{ -+ float f1 = *p; -+ float f2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); -+ return f1 / f2; -+} -+ -+float sqrt_sf (float *p) -+{ -+ float f = *p; -+ __asm__ ("# reg %x0" : "+v" (f)); -+ return __builtin_sqrtf (f); -+} -+ -+ -+double abs_df (double *p) -+{ -+ double d = *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return __builtin_fabs (d); -+} -+ -+double nabs_df (double *p) -+{ -+ double d = *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return - __builtin_fabs (d); -+} -+ -+double neg_df (double *p) -+{ -+ double d = *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return - d; -+} -+ -+double add_df (double *p, double *q) -+{ -+ double d1 = *p; -+ double d2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); -+ return d1 + d2; -+} -+ -+double sub_df (double *p, double *q) -+{ -+ double d1 = *p; -+ double d2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); -+ return d1 - d2; -+} -+ -+double mul_df (double *p, double *q) -+{ -+ double d1 = *p; -+ double d2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); -+ return d1 * d2; -+} -+ -+double div_df (double *p, double *q) -+{ -+ double d1 = *p; -+ double d2 = *q; -+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); -+ return d1 / d2; -+} -+ -+double sqrt_df (float *p) -+{ -+ double d = *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return __builtin_sqrt (d); -+} -+ -+/* { dg-final { scan-assembler "xsabsdp" } } */ -+/* { dg-final { scan-assembler "xsadddp" } } */ -+/* { dg-final { scan-assembler "xsaddsp" } } */ -+/* { dg-final { scan-assembler "xsdivdp" } } */ -+/* { dg-final { scan-assembler "xsdivsp" } } */ -+/* { dg-final { scan-assembler "xsmuldp" } } */ -+/* { dg-final { scan-assembler "xsmulsp" } } */ -+/* { dg-final { scan-assembler "xsnabsdp" } } */ -+/* { dg-final { scan-assembler "xsnegdp" } } */ -+/* { dg-final { scan-assembler "xssqrtdp" } } */ -+/* { dg-final { scan-assembler "xssqrtsp" } } */ -+/* { dg-final { scan-assembler "xssubdp" } } */ -+/* { dg-final { scan-assembler "xssubsp" } } */ -Index: gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+/* Check whether we get the right bits for direct move at runtime. */ -+ -+#define TYPE vector int -+#define DO_MAIN -+#define VSX_REG_ATTR "wa" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/bool3-p7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power7" } */ -+/* { dg-final { scan-assembler "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+/* On power7, for 128-bit types, ORC/ANDC/EQV might not show up, since the -+ vector unit doesn't support these, so the appropriate combine patterns may -+ not be generated. */ -+ -+#ifndef TYPE -+#ifdef _ARCH_PPC64 -+#define TYPE __int128_t -+#else -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+#endif -+ -+#include "bool3.h" -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,104 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */ -+ -+#include <altivec.h> -+ -+typedef vector long long vll_sign; -+typedef vector unsigned long long vll_uns; -+typedef vector bool long long vll_bool; -+ -+typedef vector int vi_sign; -+typedef vector unsigned int vi_uns; -+typedef vector bool int vi_bool; -+ -+typedef vector short vs_sign; -+typedef vector unsigned short vs_uns; -+typedef vector bool short vs_bool; -+ -+typedef vector signed char vc_sign; -+typedef vector unsigned char vc_uns; -+typedef vector bool char vc_bool; -+ -+ -+vi_sign vi_pack_1 (vll_sign a, vll_sign b) -+{ -+ return __builtin_altivec_vpkudum (a, b); -+} -+ -+vi_sign vi_pack_2 (vll_sign a, vll_sign b) -+{ -+ return vec_pack (a, b); -+} -+ -+vi_sign vi_pack_3 (vll_sign a, vll_sign b) -+{ -+ return vec_vpkudum (a, b); -+} -+ -+vs_sign vs_pack_1 (vi_sign a, vi_sign b) -+{ -+ return __builtin_altivec_vpkuwum (a, b); -+} -+ -+vs_sign vs_pack_2 (vi_sign a, vi_sign b) -+{ -+ return vec_pack (a, b); -+} -+ -+vs_sign vs_pack_3 (vi_sign a, vi_sign b) -+{ -+ return vec_vpkuwum (a, b); -+} -+ -+vc_sign vc_pack_1 (vs_sign a, vs_sign b) -+{ -+ return __builtin_altivec_vpkuhum (a, b); -+} -+ -+vc_sign vc_pack_2 (vs_sign a, vs_sign b) -+{ -+ return vec_pack (a, b); -+} -+ -+vc_sign vc_pack_3 (vs_sign a, vs_sign b) -+{ -+ return vec_vpkuhum (a, b); -+} -+ -+vll_sign vll_unpack_hi_1 (vi_sign a) -+{ -+ return __builtin_altivec_vupkhsw (a); -+} -+ -+vll_sign vll_unpack_hi_2 (vi_sign a) -+{ -+ return vec_unpackh (a); -+} -+ -+vll_sign vll_unpack_hi_3 (vi_sign a) -+{ -+ return __builtin_vec_vupkhsw (a); -+} -+ -+vll_sign vll_unpack_lo_1 (vi_sign a) -+{ -+ return vec_vupklsw (a); -+} -+ -+vll_sign vll_unpack_lo_2 (vi_sign a) -+{ -+ return vec_unpackl (a); -+} -+ -+vll_sign vll_unpack_lo_3 (vi_sign a) -+{ -+ return vec_vupklsw (a); -+} -+ -+/* { dg-final { scan-assembler-times "vpkudum" 3 } } */ -+/* { dg-final { scan-assembler-times "vpkuwum" 3 } } */ -+/* { dg-final { scan-assembler-times "vpkuhum" 3 } } */ -+/* { dg-final { scan-assembler-times "vupklsw" 3 } } */ -+/* { dg-final { scan-assembler-times "vupkhsw" 3 } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */ -+ -+#include <stddef.h> -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN))) -+ -+long long sign_ll[SIZE] ALIGN_ATTR; -+int sign_i [SIZE] ALIGN_ATTR; -+ -+void copy_long_long_to_int (void) -+{ -+ size_t i; -+ -+ for (i = 0; i < SIZE; i++) -+ sign_i[i] = sign_ll[i]; -+} -+ -+/* { dg-final { scan-assembler "vpkudum" } } */ -Index: gcc/testsuite/gcc.target/powerpc/direct-move.h -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,188 @@ -+/* Test functions for direct move support. */ -+ -+#include <math.h> -+extern void abort (void); -+ -+#ifndef VSX_REG_ATTR -+#define VSX_REG_ATTR "wa" -+#endif -+ -+void __attribute__((__noinline__)) -+copy (TYPE *a, TYPE *b) -+{ -+ *b = *a; -+} -+ -+#ifndef NO_GPR -+void __attribute__((__noinline__)) -+load_gpr (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ __asm__ ("# gpr, reg = %0" : "+b" (c)); -+ *b = c; -+} -+#endif -+ -+#ifndef NO_FPR -+void __attribute__((__noinline__)) -+load_fpr (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ __asm__ ("# fpr, reg = %0" : "+d" (c)); -+ *b = c; -+} -+#endif -+ -+#ifndef NO_ALTIVEC -+void __attribute__((__noinline__)) -+load_altivec (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ __asm__ ("# altivec, reg = %0" : "+v" (c)); -+ *b = c; -+} -+#endif -+ -+#ifndef NO_VSX -+void __attribute__((__noinline__)) -+load_vsx (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c)); -+ *b = c; -+} -+#endif -+ -+#ifndef NO_GPR_TO_VSX -+void __attribute__((__noinline__)) -+load_gpr_to_vsx (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ TYPE d; -+ __asm__ ("# gpr, reg = %0" : "+b" (c)); -+ d = c; -+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (d)); -+ *b = d; -+} -+#endif -+ -+#ifndef NO_VSX_TO_GPR -+void __attribute__((__noinline__)) -+load_vsx_to_gpr (TYPE *a, TYPE *b) -+{ -+ TYPE c = *a; -+ TYPE d; -+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c)); -+ d = c; -+ __asm__ ("# gpr, reg = %0" : "+b" (d)); -+ *b = d; -+} -+#endif -+ -+#ifdef DO_MAIN -+typedef void (fn_type (TYPE *, TYPE *)); -+ -+struct test_struct { -+ fn_type *func; -+ const char *name; -+}; -+ -+const struct test_struct test_functions[] = { -+ { copy, "copy" }, -+#ifndef NO_GPR -+ { load_gpr, "load_gpr" }, -+#endif -+#ifndef NO_FPR -+ { load_fpr, "load_fpr" }, -+#endif -+#ifndef NO_ALTIVEC -+ { load_altivec, "load_altivec" }, -+#endif -+#ifndef NO_VSX -+ { load_vsx, "load_vsx" }, -+#endif -+#ifndef NO_GPR_TO_VSX -+ { load_gpr_to_vsx, "load_gpr_to_vsx" }, -+#endif -+#ifndef NO_VSX_TO_GPR -+ { load_vsx_to_gpr, "load_vsx_to_gpr" }, -+#endif -+}; -+ -+/* Test a given value for each of the functions. */ -+void __attribute__((__noinline__)) -+test_value (TYPE a) -+{ -+ long i; -+ -+ for (i = 0; i < sizeof (test_functions) / sizeof (test_functions[0]); i++) -+ { -+ TYPE b; -+ -+ test_functions[i].func (&a, &b); -+ if (memcmp ((void *)&a, (void *)&b, sizeof (TYPE)) != 0) -+ abort (); -+ } -+} -+ -+/* Main program. */ -+int -+main (void) -+{ -+ long i,j; -+ union { -+ TYPE value; -+ unsigned char bytes[sizeof (TYPE)]; -+ } u; -+ -+#if IS_INT -+ TYPE value = (TYPE)-5; -+ for (i = 0; i < 12; i++) -+ { -+ test_value (value); -+ value++; -+ } -+ -+ for (i = 0; i < 8*sizeof (TYPE); i++) -+ test_value (((TYPE)1) << i); -+ -+#elif IS_UNS -+ TYPE value = (TYPE)0; -+ for (i = 0; i < 10; i++) -+ { -+ test_value (value); -+ test_value (~ value); -+ value++; -+ } -+ -+ for (i = 0; i < 8*sizeof (TYPE); i++) -+ test_value (((TYPE)1) << i); -+ -+#elif IS_FLOAT -+ TYPE value = (TYPE)-5; -+ for (i = 0; i < 12; i++) -+ { -+ test_value (value); -+ value++; -+ } -+ -+ test_value ((TYPE)3.1415926535); -+ test_value ((TYPE)1.23456); -+ test_value ((TYPE)(-0.0)); -+ test_value ((TYPE)NAN); -+ test_value ((TYPE)+INFINITY); -+ test_value ((TYPE)-INFINITY); -+#else -+ -+ for (j = 0; j < 10; j++) -+ { -+ for (i = 0; i < sizeof (TYPE); i++) -+ u.bytes[i] = (unsigned char) (random () >> 4); -+ -+ test_value (u.value); -+ } -+#endif -+ -+ return 0; -+} -+#endif -Index: gcc/testsuite/gcc.target/powerpc/sd-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* powerpc-ibm-aix* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power7 -mhard-dfp" } */ -+/* { dg-final { scan-assembler-times "lfiwzx" 2 } } */ -+/* { dg-final { scan-assembler-times "stfiwx" 1 } } */ -+/* { dg-final { scan-assembler-not "lfd" } } */ -+/* { dg-final { scan-assembler-not "stfd" } } */ -+/* { dg-final { scan-assembler-times "dctdp" 2 } } */ -+/* { dg-final { scan-assembler-times "dadd" 1 } } */ -+/* { dg-final { scan-assembler-times "drsp" 1 } } */ -+ -+/* Test that power7 can directly load/store SDmode variables without using a -+ bounce buffer. */ -+_Decimal32 a; -+ -+void inc_dec32 (void) -+{ -+ a += (_Decimal32) 1.0; -+} -Index: gcc/testsuite/gcc.target/powerpc/p8vector-int128-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-int128-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-int128-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,177 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+#include <stddef.h> -+#include <stdlib.h> -+#include <altivec.h> -+ -+#ifdef DEBUG -+#include <stdio.h> -+#define UNUSED -+ -+#ifdef __LITTLE_ENDIAN__ -+#define HI_WORD 1 -+#define LO_WORD 0 -+#else -+#define HI_WORD 0 -+#define LO_WORD 1 -+#endif -+ -+#else -+#define UNUSED __attribute__((__unused__)) -+#endif -+ -+#ifndef S_TYPE -+#define S_TYPE __uint128_t -+#endif -+ -+#ifndef V_TYPE -+#define V_TYPE vector S_TYPE -+#endif -+ -+static int compare (S_TYPE, V_TYPE, const char *, const char *) -+ __attribute__((__noinline__)); -+ -+static int -+compare (S_TYPE scalar, -+ V_TYPE vect, -+ const char *nl UNUSED, -+ const char *which UNUSED) -+{ -+ unsigned long scalar_lo = (unsigned long) scalar; -+ unsigned long scalar_hi = (unsigned long) (scalar >> 64); -+ unsigned long vect_lo; -+ unsigned long vect_hi; -+ vector long long tmp; -+ int ret; -+ -+ __asm__ ("mfvsrd %0,%x3\n\t" -+ "xxpermdi %x2,%x3,%x3,3\n\t" -+ "mfvsrd %1,%x2" -+ : "=r" (vect_hi), -+ "=r" (vect_lo), -+ "=wa" (tmp) -+ : "wa" (vect)); -+ -+ ret = (scalar_lo != vect_lo) || (scalar_hi != vect_hi); -+ -+#ifdef DEBUG -+ printf ("%s%s: 0x%.16lx %.16lx %s 0x%.16lx %.16lx\n", -+ nl, which, -+ scalar_hi, scalar_lo, -+ (ret) ? "!=" : "==", -+ vect_hi, vect_lo); -+ -+ fflush (stdout); -+#endif -+ -+ return ret; -+} -+ -+static void convert_via_mem (V_TYPE *, S_TYPE *) -+ __attribute__((__noinline__)); -+ -+static void -+convert_via_mem (V_TYPE *v, S_TYPE *s) -+{ -+ *v = (V_TYPE) { *s }; -+ __asm__ volatile ("nop" -+ : "+m" (*s), "+m" (*v) -+ : -+ : "memory"); -+ -+} -+ -+ -+/* Check if vadduqm returns the same values as normal 128-bit add. */ -+ -+/* Values to add together. */ -+const static struct { -+ unsigned long hi_1; -+ unsigned long lo_1; -+ unsigned long hi_2; -+ unsigned long lo_2; -+} values[] = { -+ { 0x0000000000000000UL, 0xfffffffffffffffeUL, -+ 0x0000000000000000UL, 0x0000000000000002UL }, -+ { 0x0000000000000000UL, 0x0000000000000002UL, -+ 0x0000000000000000UL, 0xfffffffffffffffeUL }, -+ { 0xffffffffffffffffUL, 0xfffffffffffffffeUL, -+ 0x0000000000000000UL, 0x0000000000000002UL }, -+ { 0xfffffffffffffff2UL, 0xffffffffffffffffUL, -+ 0x0000000000000002UL, 0x0000000000000000UL }, -+ { 0x7fffffffffffffffUL, 0xfffffffffffffffeUL, -+ 0x0000000000000000UL, 0x0000000000000002UL }, -+ { 0x7ffffffffffffff2UL, 0xffffffffffffffffUL, -+ 0x0000000000000002UL, 0x0000000000000000UL }, -+}; -+ -+int -+main (void) -+{ -+ int reg_errors = 0; -+ int mem_errors = 0; -+ size_t i; -+ const char *nl = ""; -+ -+ for (i = 0; i < sizeof (values) / sizeof (values[0]); i++) -+ { -+ S_TYPE s_reg_res, s_reg_in1, s_reg_in2, s_mem_res, s_mem_in1, s_mem_in2; -+ V_TYPE v_reg_res, v_reg_in1, v_reg_in2, v_mem_res, v_mem_in1, v_mem_in2; -+ -+ s_reg_in1 = ((((S_TYPE)values[i].hi_1 << 64)) + ((S_TYPE)values[i].lo_1)); -+ reg_errors += compare (s_reg_in1, (V_TYPE) { s_reg_in1 }, nl, "reg, in1"); -+ -+ s_reg_in2 = ((((S_TYPE)values[i].hi_2 << 64)) + ((S_TYPE)values[i].lo_2)); -+ reg_errors += compare (s_reg_in2, (V_TYPE) { s_reg_in2 }, "", "reg, in2"); -+ -+ s_reg_res = s_reg_in1 + s_reg_in2; -+ -+ v_reg_in1 = (V_TYPE) { s_reg_in1 }; -+ v_reg_in2 = (V_TYPE) { s_reg_in2 }; -+ v_reg_res = vec_vadduqm (v_reg_in1, v_reg_in2); -+ reg_errors += compare (s_reg_res, v_reg_res, "", "reg, res"); -+ -+ s_mem_in1 = s_reg_in1; -+ convert_via_mem (&v_mem_in1, &s_mem_in1); -+ mem_errors += compare (s_mem_in1, (V_TYPE) { s_mem_in1 }, "\n", "mem, in1"); -+ -+ s_mem_in2 = s_reg_in2; -+ convert_via_mem (&v_mem_in2, &s_mem_in2); -+ mem_errors += compare (s_mem_in2, (V_TYPE) { s_mem_in2 }, "", "mem, in2"); -+ -+ s_mem_res = s_mem_in1 + s_mem_in2; -+ v_mem_res = vec_vadduqm (v_mem_in1, v_mem_in2); -+ mem_errors += compare (s_mem_res, v_mem_res, "", "mem, res"); -+ -+ nl = "\n"; -+ } -+ -+#ifdef DEBUG -+ putchar ('\n'); -+ -+ if (!reg_errors) -+ fputs ("no errors found on register operations\n", stdout); -+ else -+ printf ("%d error%s found on register operations\n", -+ reg_errors, -+ (reg_errors == 1) ? "s" : ""); -+ -+ if (!mem_errors) -+ fputs ("no errors found on memory operations\n", stdout); -+ else -+ printf ("%d error%s found on memory operations\n", -+ mem_errors, -+ (mem_errors == 1) ? "s" : ""); -+ -+ fflush (stdout); -+#endif -+ -+ if ((reg_errors + mem_errors) != 0) -+ abort (); -+ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/powerpc/pr58673-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,217 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3 -m64 -funroll-loops" } */ -+ -+#include <stddef.h> -+#include <stdlib.h> -+#include <math.h> -+#include <string.h> -+ -+typedef long unsigned int size_t; -+typedef struct _IO_FILE FILE; -+typedef float real; -+typedef real rvec[3]; -+typedef real matrix[3][3]; -+typedef real tensor[3][3]; -+enum -+{ -+ F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC, -+ F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ, -+ F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES, -+ F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE, -+ F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD, -+ F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES, -+ F_DVDL, F_DVDLKIN, F_NRE -+}; -+typedef union -+{ -+ struct -+ { -+ } -+ bham; -+ struct -+ { -+ real rA, krA, rB, krB; -+ } -+ harmonic; -+} -+t_iparams; -+typedef struct -+{ -+ t_iparams *iparams; -+} -+t_idef; -+typedef struct -+{ -+} -+t_inputrec; -+typedef struct -+{ -+} -+t_commrec; -+typedef struct -+{ -+} -+t_forcerec; -+typedef struct -+{ -+} -+t_mdatoms; -+typedef struct -+{ -+} -+t_filenm; -+enum -+{ -+ eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy, -+ eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory = -+ eoObsNR, eoInter, eoUseVirial, eoNR -+}; -+extern char *eoNames[eoNR]; -+typedef struct -+{ -+ int bPrint; -+} -+t_coupl_LJ; -+typedef struct -+{ -+ int eObs; -+ t_iparams xi; -+} -+t_coupl_iparams; -+typedef struct -+{ -+ real act_value[eoObsNR]; -+ real av_value[eoObsNR]; -+ real ref_value[eoObsNR]; -+ int bObsUsed[eoObsNR]; -+ int nLJ, nBU, nQ, nIP; -+ t_coupl_LJ *tcLJ; -+} -+t_coupl_rec; -+static void -+pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile, -+ t_filenm fnm[]) -+{ -+ static FILE *prop; -+ static FILE **out = ((void *) 0); -+ static FILE **qq = ((void *) 0); -+ static FILE **ip = ((void *) 0); -+ char buf[256]; -+ char *leg[] = { -+ "C12", "C6" -+ }; -+ char **raleg; -+ int i, j, index; -+ if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0)) -+ && (ip == ((void *) 0))) -+ { -+ for (i = j = 0; (i < eoObsNR); i++) -+ { -+ if (tcr->bObsUsed[i]) -+ { -+ raleg[j++] = -+ (__extension__ -+ (__builtin_constant_p (eoNames[i]) -+ && ((size_t) (const void *) ((eoNames[i]) + 1) - -+ (size_t) (const void *) (eoNames[i]) == -+ 1) ? (((const char *) (eoNames[i]))[0] == -+ '\0' ? (char *) calloc ((size_t) 1, -+ (size_t) 1) : ( -+ { -+ size_t -+ __len -+ = -+ strlen -+ (eoNames -+ [i]) -+ + -+ 1; -+ char -+ *__retval -+ = -+ (char -+ *) -+ malloc -+ (__len); -+ __retval;} -+ )): __strdup (eoNames[i]))); -+ raleg[j++] = -+ (__extension__ -+ (__builtin_constant_p (buf) -+ && ((size_t) (const void *) ((buf) + 1) - -+ (size_t) (const void *) (buf) == -+ 1) ? (((const char *) (buf))[0] == -+ '\0' ? (char *) calloc ((size_t) 1, -+ (size_t) 1) : ( -+ { -+ size_t -+ __len -+ = -+ strlen -+ (buf) -+ + -+ 1; -+ char -+ *__retval -+ = -+ (char -+ *) -+ malloc -+ (__len); -+ __retval;} -+ )): __strdup (buf))); -+ } -+ } -+ if (tcr->nLJ) -+ { -+ for (i = 0; (i < tcr->nLJ); i++) -+ { -+ if (tcr->tcLJ[i].bPrint) -+ { -+ xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])), -+ leg); -+ } -+ } -+ } -+ } -+} -+ -+void -+do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t, -+ int step, real ener[], t_forcerec * fr, t_inputrec * ir, -+ int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver, -+ int nmols, t_commrec * cr, matrix box, tensor virial, -+ tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt) -+{ -+ int i, j, ati, atj, atnr2, type, ftype; -+ real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf; -+ real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind; -+ int bTest, bPrint; -+ t_coupl_iparams *tip; -+ if (bPrint) -+ { -+ pr_ff (tcr, t, idef, cr, nfile, fnm); -+ } -+ for (i = 0; (i < eoObsNR); i++) -+ { -+ deviation[i] = -+ calc_deviation (tcr->av_value[i], tcr->act_value[i], -+ tcr->ref_value[i]); -+ prdev[i] = tcr->ref_value[i] - tcr->act_value[i]; -+ } -+ if (bPrint) -+ pr_dev (tcr, t, prdev, cr, nfile, fnm); -+ for (i = 0; (i < atnr2); i++) -+ { -+ factor = dt * deviation[tip->eObs]; -+ switch (ftype) -+ { -+ case F_BONDS: -+ if (fabs (tip->xi.harmonic.krA) > 1.2e-38) -+ idef->iparams[type].harmonic.krA *= -+ (1 + factor / tip->xi.harmonic.krA); -+ } -+ } -+} -Index: gcc/testsuite/gcc.target/powerpc/atomic-p7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,207 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-mcpu=power7 -O2" } */ -+/* { dg-final { scan-assembler-not "lbarx" } } */ -+/* { dg-final { scan-assembler-not "lharx" } } */ -+/* { dg-final { scan-assembler-times "lwarx" 18 } } */ -+/* { dg-final { scan-assembler-times "ldarx" 6 } } */ -+/* { dg-final { scan-assembler-not "lqarx" } } */ -+/* { dg-final { scan-assembler-not "stbcx" } } */ -+/* { dg-final { scan-assembler-not "sthcx" } } */ -+/* { dg-final { scan-assembler-times "stwcx" 18 } } */ -+/* { dg-final { scan-assembler-times "stdcx" 6 } } */ -+/* { dg-final { scan-assembler-not "stqcx" } } */ -+/* { dg-final { scan-assembler-times "bl __atomic" 6 } } */ -+/* { dg-final { scan-assembler-times "isync" 12 } } */ -+/* { dg-final { scan-assembler-times "lwsync" 8 } } */ -+/* { dg-final { scan-assembler-not "mtvsrd" } } */ -+/* { dg-final { scan-assembler-not "mtvsrwa" } } */ -+/* { dg-final { scan-assembler-not "mtvsrwz" } } */ -+/* { dg-final { scan-assembler-not "mfvsrd" } } */ -+/* { dg-final { scan-assembler-not "mfvsrwz" } } */ -+ -+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */ -+char -+char_fetch_add_relaxed (char *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+char -+char_fetch_sub_consume (char *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+char -+char_fetch_and_acquire (char *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+char -+char_fetch_ior_release (char *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+char -+char_fetch_xor_acq_rel (char *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+char -+char_fetch_nand_seq_cst (char *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+/* Test for the half word atomic operations on power8 using lharx/sthcx. */ -+short -+short_fetch_add_relaxed (short *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+short -+short_fetch_sub_consume (short *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+short -+short_fetch_and_acquire (short *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+short -+short_fetch_ior_release (short *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+short -+short_fetch_xor_acq_rel (short *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+short -+short_fetch_nand_seq_cst (short *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+/* Test for the word atomic operations on power8 using lwarx/stwcx. */ -+int -+int_fetch_add_relaxed (int *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+int -+int_fetch_sub_consume (int *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+int -+int_fetch_and_acquire (int *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+int -+int_fetch_ior_release (int *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+int -+int_fetch_xor_acq_rel (int *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+int -+int_fetch_nand_seq_cst (int *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */ -+long -+long_fetch_add_relaxed (long *ptr, long value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+long -+long_fetch_sub_consume (long *ptr, long value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+long -+long_fetch_and_acquire (long *ptr, long value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+long -+long_fetch_ior_release (long *ptr, long value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+long -+long_fetch_xor_acq_rel (long *ptr, long value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+long -+long_fetch_nand_seq_cst (long *ptr, long value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */ -+__int128_t -+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+__int128_t -+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+__int128_t -+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+__int128_t -+quad_fetch_ior_release (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+__int128_t -+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+__int128_t -+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -Index: gcc/testsuite/gcc.target/powerpc/recip-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/recip-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-3.c (.../branches/gcc-4_8-branch) -@@ -1,14 +1,14 @@ - /* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */ + /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_fprs } */ - /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power7" } */ --/* { dg-final { scan-assembler-times "xsrsqrtedp" 1 } } */ -+/* { dg-final { scan-assembler-times "xsrsqrtedp\|frsqrte\ " 1 } } */ - /* { dg-final { scan-assembler-times "xsmsub.dp\|fmsub\ " 1 } } */ --/* { dg-final { scan-assembler-times "xsmuldp" 4 } } */ -+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 4 } } */ - /* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 2 } } */ --/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */ --/* { dg-final { scan-assembler-times "fmsubs" 1 } } */ --/* { dg-final { scan-assembler-times "fmuls" 4 } } */ --/* { dg-final { scan-assembler-times "fnmsubs" 2 } } */ -+/* { dg-final { scan-assembler-times "xsrsqrtesp\|frsqrtes" 1 } } */ -+/* { dg-final { scan-assembler-times "xsmsub.sp\|fmsubs" 1 } } */ -+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */ -+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 1 } } */ - - double - rsqrt_d (double a) -Index: gcc/testsuite/gcc.target/powerpc/timode_off.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/timode_off.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/timode_off.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do assemble { target { lp64 } } } */ --/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ -+/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps -mcpu=power5" } */ - - typedef int TImode __attribute__ ((mode (TI))); - -@@ -46,6 +46,12 @@ - TImode r20 (void *x) { return *(TImode *) (x + 32748); } ++/* { dg-require-effective-target longdouble128 } */ + /* { dg-options "-O2 -mhard-float" } */ - /* test should really be == 616, see pr54110 */ -+/* When TImode is allowed in VSX registers, the allowable address modes for -+ TImode is just a single indirect address in order for the value to be loaded -+ and store in either GPR or VSX registers. This affects the generated code, -+ and it would cause this test to fail, when such an option is used. Fall -+ back to power5 to test the code. */ -+ - /* { dg-final { object-size text <= 700 } } */ - /* { dg-final { scan-assembler-not "(st|l)fd" } } */ - /* { dg-final { cleanup-saved-temps "timode_off" } } */ -Index: gcc/testsuite/gcc.target/powerpc/no-r11-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ - /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */ - /* { dg-options "-O2 -mpointers-to-nested-functions" } */ - - int -Index: gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,42 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */ -+ -+float load_sf (float *p) -+{ -+ float f = *p; -+ __asm__ ("# reg %x0" : "+v" (f)); -+ return f; -+} -+ -+double load_df (double *p) -+{ -+ double d = *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return d; -+} -+ -+double load_dfsf (float *p) -+{ -+ double d = (double) *p; -+ __asm__ ("# reg %x0" : "+v" (d)); -+ return d; -+} -+ -+void store_sf (float *p, float f) -+{ -+ __asm__ ("# reg %x0" : "+v" (f)); -+ *p = f; -+} -+ -+void store_df (double *p, double d) -+{ -+ __asm__ ("# reg %x0" : "+v" (d)); -+ *p = d; -+} -+ -+/* { dg-final { scan-assembler "lxsspx" } } */ -+/* { dg-final { scan-assembler "lxsdx" } } */ -+/* { dg-final { scan-assembler "stxsspx" } } */ -+/* { dg-final { scan-assembler "stxsdx" } } */ -Index: gcc/testsuite/gcc.target/powerpc/bool3-p8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,36 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-O2 -mcpu=power8" } */ -+/* { dg-final { scan-assembler "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]eqv " } } */ -+/* { dg-final { scan-assembler "\[ \t\]orc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+#ifndef TYPE -+#ifdef _ARCH_PPC64 -+#define TYPE __int128_t -+#else -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+#endif -+ -+#include "bool3.h" -Index: gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c + #include <stddef.h> +Index: gcc/testsuite/gcc.target/powerpc/htm-ttest.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+/* This checks the availability of the XL compiler intrinsics for -+ transactional execution with the expected prototypes. */ -+ +--- a/src/gcc/testsuite/gcc.target/powerpc/htm-ttest.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/htm-ttest.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,14 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_htm_ok } */ +/* { dg-options "-O2 -mhtm" } */ + -+#include <htmxlintrin.h> -+ -+void -+foo (void *TM_buff, long *result, unsigned char *code) -+{ -+ *result++ = __TM_simple_begin (); -+ *result++ = __TM_begin (TM_buff); -+ *result++ = __TM_end (); -+ __TM_abort (); -+ __TM_named_abort (*code); -+ __TM_resume (); -+ __TM_suspend (); -+ *result++ = __TM_is_user_abort (TM_buff); -+ *result++ = __TM_is_named_user_abort (TM_buff, code); -+ *result++ = __TM_is_illegal (TM_buff); -+ *result++ = __TM_is_footprint_exceeded (TM_buff); -+ *result++ = __TM_nesting_depth (TM_buff); -+ *result++ = __TM_is_nested_too_deep (TM_buff); -+ *result++ = __TM_is_conflict (TM_buff); -+ *result++ = __TM_is_failure_persistent (TM_buff); -+ *result++ = __TM_failure_address (TM_buff); -+ *result++ = __TM_failure_code (TM_buff); -+} -+ -Index: gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/rs6000-ldouble-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Test accuracy of long double division (glibc bug 15396). */ -+/* { dg-do run { target powerpc*-*-linux* powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* } } */ -+/* { dg-options "-mlong-double-128" } */ -+ -+extern void exit (int); -+extern void abort (void); -+ -+volatile long double a = 0x1p-1024L; -+volatile long double b = 0x3p-53L; -+volatile long double r; -+volatile long double expected = 0x1.55555555555555555555555555p-973L; -+ -+int -+main (void) -+{ -+ r = a / b; -+ /* Allow error up to 2ulp. */ -+ if (__builtin_fabsl (r - expected) > 0x1p-1073L) -+ abort (); -+ exit (0); -+} -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,249 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */ -+ -+#include <altivec.h> -+ -+typedef vector long long vll_sign; -+typedef vector unsigned long long vll_uns; -+typedef vector bool long long vll_bool; -+ -+typedef vector int vi_sign; -+typedef vector unsigned int vi_uns; -+typedef vector bool int vi_bool; -+ -+typedef vector short vs_sign; -+typedef vector unsigned short vs_uns; -+typedef vector bool short vs_bool; -+ -+typedef vector signed char vc_sign; -+typedef vector unsigned char vc_uns; -+typedef vector bool char vc_bool; -+ -+vll_sign vll_clz_1 (vll_sign a) -+{ -+ return __builtin_altivec_vclzd (a); -+} -+ -+vll_sign vll_clz_2 (vll_sign a) -+{ -+ return vec_vclz (a); -+} -+ -+vll_sign vll_clz_3 (vll_sign a) -+{ -+ return vec_vclzd (a); -+} -+ -+vll_uns vll_clz_4 (vll_uns a) -+{ -+ return vec_vclz (a); -+} -+ -+vll_uns vll_clz_5 (vll_uns a) -+{ -+ return vec_vclzd (a); -+} -+ -+vi_sign vi_clz_1 (vi_sign a) -+{ -+ return __builtin_altivec_vclzw (a); -+} -+ -+vi_sign vi_clz_2 (vi_sign a) -+{ -+ return vec_vclz (a); -+} -+ -+vi_sign vi_clz_3 (vi_sign a) -+{ -+ return vec_vclzw (a); -+} -+ -+vi_uns vi_clz_4 (vi_uns a) -+{ -+ return vec_vclz (a); -+} -+ -+vi_uns vi_clz_5 (vi_uns a) -+{ -+ return vec_vclzw (a); -+} -+ -+vs_sign vs_clz_1 (vs_sign a) -+{ -+ return __builtin_altivec_vclzh (a); -+} -+ -+vs_sign vs_clz_2 (vs_sign a) -+{ -+ return vec_vclz (a); -+} -+ -+vs_sign vs_clz_3 (vs_sign a) -+{ -+ return vec_vclzh (a); -+} -+ -+vs_uns vs_clz_4 (vs_uns a) -+{ -+ return vec_vclz (a); -+} -+ -+vs_uns vs_clz_5 (vs_uns a) -+{ -+ return vec_vclzh (a); -+} -+ -+vc_sign vc_clz_1 (vc_sign a) -+{ -+ return __builtin_altivec_vclzb (a); -+} -+ -+vc_sign vc_clz_2 (vc_sign a) -+{ -+ return vec_vclz (a); -+} -+ -+vc_sign vc_clz_3 (vc_sign a) -+{ -+ return vec_vclzb (a); -+} -+ -+vc_uns vc_clz_4 (vc_uns a) -+{ -+ return vec_vclz (a); -+} -+ -+vc_uns vc_clz_5 (vc_uns a) -+{ -+ return vec_vclzb (a); -+} -+ -+vll_sign vll_popcnt_1 (vll_sign a) -+{ -+ return __builtin_altivec_vpopcntd (a); -+} -+ -+vll_sign vll_popcnt_2 (vll_sign a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vll_sign vll_popcnt_3 (vll_sign a) -+{ -+ return vec_vpopcntd (a); -+} -+ -+vll_uns vll_popcnt_4 (vll_uns a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vll_uns vll_popcnt_5 (vll_uns a) -+{ -+ return vec_vpopcntd (a); -+} -+ -+vi_sign vi_popcnt_1 (vi_sign a) -+{ -+ return __builtin_altivec_vpopcntw (a); -+} -+ -+vi_sign vi_popcnt_2 (vi_sign a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vi_sign vi_popcnt_3 (vi_sign a) -+{ -+ return vec_vpopcntw (a); -+} -+ -+vi_uns vi_popcnt_4 (vi_uns a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vi_uns vi_popcnt_5 (vi_uns a) -+{ -+ return vec_vpopcntw (a); -+} -+ -+vs_sign vs_popcnt_1 (vs_sign a) -+{ -+ return __builtin_altivec_vpopcnth (a); -+} -+ -+vs_sign vs_popcnt_2 (vs_sign a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vs_sign vs_popcnt_3 (vs_sign a) -+{ -+ return vec_vpopcnth (a); -+} -+ -+vs_uns vs_popcnt_4 (vs_uns a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vs_uns vs_popcnt_5 (vs_uns a) -+{ -+ return vec_vpopcnth (a); -+} -+ -+vc_sign vc_popcnt_1 (vc_sign a) -+{ -+ return __builtin_altivec_vpopcntb (a); -+} -+ -+vc_sign vc_popcnt_2 (vc_sign a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vc_sign vc_popcnt_3 (vc_sign a) -+{ -+ return vec_vpopcntb (a); -+} -+ -+vc_uns vc_popcnt_4 (vc_uns a) -+{ -+ return vec_vpopcnt (a); -+} -+ -+vc_uns vc_popcnt_5 (vc_uns a) -+{ -+ return vec_vpopcntb (a); -+} -+ -+vc_uns vc_gbb_1 (vc_uns a) -+{ -+ return __builtin_altivec_vgbbd (a); -+} -+ -+vc_sign vc_gbb_2 (vc_sign a) -+{ -+ return vec_vgbbd (a); -+} -+ -+vc_uns vc_gbb_3 (vc_uns a) -+{ -+ return vec_vgbbd (a); -+} -+ -+/* { dg-final { scan-assembler-times "vclzd" 5 } } */ -+/* { dg-final { scan-assembler-times "vclzw" 5 } } */ -+/* { dg-final { scan-assembler-times "vclzh" 5 } } */ -+/* { dg-final { scan-assembler-times "vclzb" 5 } } */ -+ -+/* { dg-final { scan-assembler-times "vpopcntd" 5 } } */ -+/* { dg-final { scan-assembler-times "vpopcntw" 5 } } */ -+/* { dg-final { scan-assembler-times "vpopcnth" 5 } } */ -+/* { dg-final { scan-assembler-times "vpopcntb" 5 } } */ -+ -+/* { dg-final { scan-assembler-times "vgbbd" 3 } } */ -Index: gcc/testsuite/gcc.target/powerpc/bool3-av.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_altivec_ok } */ -+/* { dg-options "-O2 -mcpu=power6 -mabi=altivec -maltivec -mno-vsx" } */ -+/* { dg-final { scan-assembler "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+/* On altivec, for 128-bit types, ORC/ANDC/EQV might not show up, since the -+ vector unit doesn't support these, so the appropriate combine patterns may -+ not be generated. */ -+ -+#ifndef TYPE -+#ifdef _ARCH_PPC64 -+#define TYPE __int128_t -+#else -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+#endif -+ -+#include "bool3.h" -Index: gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,69 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN))) -+ -+#define DO_BUILTIN(PREFIX, TYPE, CLZ, POPCNT) \ -+TYPE PREFIX ## _a[SIZE] ALIGN_ATTR; \ -+TYPE PREFIX ## _b[SIZE] ALIGN_ATTR; \ -+ \ -+void \ -+PREFIX ## _clz (void) \ -+{ \ -+ unsigned long i; \ -+ \ -+ for (i = 0; i < SIZE; i++) \ -+ PREFIX ## _a[i] = CLZ (PREFIX ## _b[i]); \ -+} \ -+ \ -+void \ -+PREFIX ## _popcnt (void) \ -+{ \ -+ unsigned long i; \ -+ \ -+ for (i = 0; i < SIZE; i++) \ -+ PREFIX ## _a[i] = POPCNT (PREFIX ## _b[i]); \ -+} -+ -+#if !defined(DO_LONG_LONG) && !defined(DO_LONG) && !defined(DO_INT) && !defined(DO_SHORT) && !defined(DO_CHAR) -+#define DO_INT 1 -+#endif -+ -+#if DO_LONG_LONG -+/* At the moment, only int is auto vectorized. */ -+DO_BUILTIN (sll, long long, __builtin_clzll, __builtin_popcountll) -+DO_BUILTIN (ull, unsigned long long, __builtin_clzll, __builtin_popcountll) -+#endif -+ -+#if defined(_ARCH_PPC64) && DO_LONG -+DO_BUILTIN (sl, long, __builtin_clzl, __builtin_popcountl) -+DO_BUILTIN (ul, unsigned long, __builtin_clzl, __builtin_popcountl) -+#endif -+ -+#if DO_INT -+DO_BUILTIN (si, int, __builtin_clz, __builtin_popcount) -+DO_BUILTIN (ui, unsigned int, __builtin_clz, __builtin_popcount) -+#endif -+ -+#if DO_SHORT -+DO_BUILTIN (ss, short, __builtin_clz, __builtin_popcount) -+DO_BUILTIN (us, unsigned short, __builtin_clz, __builtin_popcount) -+#endif -+ -+#if DO_CHAR -+DO_BUILTIN (sc, signed char, __builtin_clz, __builtin_popcount) -+DO_BUILTIN (uc, unsigned char, __builtin_clz, __builtin_popcount) -+#endif -+ -+/* { dg-final { scan-assembler-times "vclzw" 2 } } */ -+/* { dg-final { scan-assembler-times "vpopcntw" 2 } } */ -Index: gcc/testsuite/gcc.target/powerpc/pr57949-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */ -+/* { dg-options "-O2 -mcpu=power7 -mno-compat-align-parm" } */ -+ -+/* Verify that vs is 16-byte aligned with -mcompat-align-parm. */ -+ -+typedef float v4sf __attribute__ ((vector_size (16))); -+struct s { long m; v4sf v; }; -+long n; -+v4sf ve; -+ -+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6, -+ long d7, long d8, long d9, struct s vs) { -+ n = vs.m; -+ ve = vs.v; -+} -+ -+/* { dg-final { scan-assembler "li \.\*,144" } } */ -+/* { dg-final { scan-assembler "ld \.\*,128\\(1\\)" } } */ -Index: gcc/testsuite/gcc.target/powerpc/atomic-p8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,237 @@ -+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+/* { dg-final { scan-assembler-times "lbarx" 7 } } */ -+/* { dg-final { scan-assembler-times "lharx" 7 } } */ -+/* { dg-final { scan-assembler-times "lwarx" 7 } } */ -+/* { dg-final { scan-assembler-times "ldarx" 7 } } */ -+/* { dg-final { scan-assembler-times "lqarx" 7 } } */ -+/* { dg-final { scan-assembler-times "stbcx" 7 } } */ -+/* { dg-final { scan-assembler-times "sthcx" 7 } } */ -+/* { dg-final { scan-assembler-times "stwcx" 7 } } */ -+/* { dg-final { scan-assembler-times "stdcx" 7 } } */ -+/* { dg-final { scan-assembler-times "stqcx" 7 } } */ -+/* { dg-final { scan-assembler-not "bl __atomic" } } */ -+/* { dg-final { scan-assembler-times "isync" 20 } } */ -+/* { dg-final { scan-assembler-times "lwsync" 10 } } */ -+/* { dg-final { scan-assembler-not "mtvsrd" } } */ -+/* { dg-final { scan-assembler-not "mtvsrwa" } } */ -+/* { dg-final { scan-assembler-not "mtvsrwz" } } */ -+/* { dg-final { scan-assembler-not "mfvsrd" } } */ -+/* { dg-final { scan-assembler-not "mfvsrwz" } } */ -+ -+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */ -+char -+char_fetch_add_relaxed (char *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+char -+char_fetch_sub_consume (char *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+char -+char_fetch_and_acquire (char *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+char -+char_fetch_ior_release (char *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+char -+char_fetch_xor_acq_rel (char *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+char -+char_fetch_nand_seq_cst (char *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+void -+char_val_compare_and_swap (char *p, int i, int j, char *q) -+{ -+ *q = __sync_val_compare_and_swap (p, i, j); -+} -+ -+/* Test for the half word atomic operations on power8 using lharx/sthcx. */ -+short -+short_fetch_add_relaxed (short *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+short -+short_fetch_sub_consume (short *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+short -+short_fetch_and_acquire (short *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+short -+short_fetch_ior_release (short *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+short -+short_fetch_xor_acq_rel (short *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+short -+short_fetch_nand_seq_cst (short *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+void -+short_val_compare_and_swap (short *p, int i, int j, short *q) -+{ -+ *q = __sync_val_compare_and_swap (p, i, j); -+} -+ -+/* Test for the word atomic operations on power8 using lwarx/stwcx. */ -+int -+int_fetch_add_relaxed (int *ptr, int value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+int -+int_fetch_sub_consume (int *ptr, int value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+int -+int_fetch_and_acquire (int *ptr, int value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+int -+int_fetch_ior_release (int *ptr, int value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+int -+int_fetch_xor_acq_rel (int *ptr, int value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+int -+int_fetch_nand_seq_cst (int *ptr, int value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+void -+int_val_compare_and_swap (int *p, int i, int j, int *q) -+{ -+ *q = __sync_val_compare_and_swap (p, i, j); -+} -+ -+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */ -+long -+long_fetch_add_relaxed (long *ptr, long value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+long -+long_fetch_sub_consume (long *ptr, long value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+long -+long_fetch_and_acquire (long *ptr, long value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+long -+long_fetch_ior_release (long *ptr, long value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+long -+long_fetch_xor_acq_rel (long *ptr, long value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} ++/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,3,30,31" { target { ilp32 } } } } */ ++/* { dg-final { scan-assembler "rldicl r?\[0-9\]+,r?\[0-9\]+,35,62" { target { lp64 } } } } */ + ++#include <htmintrin.h> +long -+long_fetch_nand_seq_cst (long *ptr, long value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+void -+long_val_compare_and_swap (long *p, long i, long j, long *q) -+{ -+ *q = __sync_val_compare_and_swap (p, i, j); -+} -+ -+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */ -+__int128_t -+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED); -+} -+ -+__int128_t -+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME); -+} -+ -+__int128_t -+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} -+ -+__int128_t -+quad_fetch_ior_release (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE); -+} -+ -+__int128_t -+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL); -+} -+ -+__int128_t -+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST); -+} -+ -+void -+quad_val_compare_and_swap (__int128_t *p, __int128_t i, __int128_t j, __int128_t *q) -+{ -+ *q = __sync_val_compare_and_swap (p, i, j); -+} -Index: gcc/testsuite/gcc.target/powerpc/sd-pwr6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* powerpc-ibm-aix* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power6 -mhard-dfp" } */ -+/* { dg-final { scan-assembler-not "lfiwzx" } } */ -+/* { dg-final { scan-assembler-times "lfd" 2 } } */ -+/* { dg-final { scan-assembler-times "dctdp" 2 } } */ -+/* { dg-final { scan-assembler-times "dadd" 1 } } */ -+/* { dg-final { scan-assembler-times "drsp" 1 } } */ -+ -+/* Test that for power6 we need to use a bounce buffer on the stack to load -+ SDmode variables because the power6 does not have a way to directly load -+ 32-bit values from memory. */ -+_Decimal32 a; -+ -+void inc_dec32 (void) -+{ -+ a += (_Decimal32) 1.0; -+} -Index: gcc/testsuite/gcc.target/powerpc/recip-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/recip-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-4.c (.../branches/gcc-4_8-branch) -@@ -7,8 +7,8 @@ - /* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */ - /* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */ - /* { dg-final { scan-assembler-times "xvmsub.sp" 1 } } */ --/* { dg-final { scan-assembler-times "xvmulsp" 4 } } */ --/* { dg-final { scan-assembler-times "xvnmsub.sp" 2 } } */ -+/* { dg-final { scan-assembler-times "xvmulsp" 2 } } */ -+/* { dg-final { scan-assembler-times "xvnmsub.sp" 1 } } */ - - #define SIZE 1024 - -Index: gcc/testsuite/gcc.target/powerpc/no-r11-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ - /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */ - /* { dg-options "-O2 -mno-pointers-to-nested-functions" } */ - - extern void ext_call (int (func) (void)); -Index: gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,130 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+typedef vector unsigned long long crypto_t; -+typedef vector unsigned long long v2di_t; -+typedef vector unsigned int v4si_t; -+typedef vector unsigned short v8hi_t; -+typedef vector unsigned char v16qi_t; -+ -+crypto_t crpyto1 (crypto_t a) -+{ -+ return __builtin_crypto_vsbox (a); -+} -+ -+crypto_t crypto2 (crypto_t a, crypto_t b) -+{ -+ return __builtin_crypto_vcipher (a, b); -+} -+ -+crypto_t crypto3 (crypto_t a, crypto_t b) -+{ -+ return __builtin_crypto_vcipherlast (a, b); -+} -+ -+crypto_t crypto4 (crypto_t a, crypto_t b) -+{ -+ return __builtin_crypto_vncipher (a, b); -+} -+ -+crypto_t crypto5 (crypto_t a, crypto_t b) -+{ -+ return __builtin_crypto_vncipherlast (a, b); -+} -+ -+v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c) -+{ -+ return __builtin_crypto_vpermxor (a, b, c); -+} -+ -+v8hi_t crypto6b (v8hi_t a, v8hi_t b, v8hi_t c) -+{ -+ return __builtin_crypto_vpermxor (a, b, c); -+} -+ -+v4si_t crypto6c (v4si_t a, v4si_t b, v4si_t c) -+{ -+ return __builtin_crypto_vpermxor (a, b, c); -+} -+ -+v2di_t crypto6d (v2di_t a, v2di_t b, v2di_t c) -+{ -+ return __builtin_crypto_vpermxor (a, b, c); -+} -+ -+v16qi_t crypto7a (v16qi_t a, v16qi_t b) -+{ -+ return __builtin_crypto_vpmsumb (a, b); -+} -+ -+v16qi_t crypto7b (v16qi_t a, v16qi_t b) -+{ -+ return __builtin_crypto_vpmsum (a, b); -+} -+ -+v8hi_t crypto7c (v8hi_t a, v8hi_t b) -+{ -+ return __builtin_crypto_vpmsumh (a, b); -+} -+ -+v8hi_t crypto7d (v8hi_t a, v8hi_t b) -+{ -+ return __builtin_crypto_vpmsum (a, b); -+} -+ -+v4si_t crypto7e (v4si_t a, v4si_t b) -+{ -+ return __builtin_crypto_vpmsumw (a, b); -+} -+ -+v4si_t crypto7f (v4si_t a, v4si_t b) -+{ -+ return __builtin_crypto_vpmsum (a, b); -+} -+ -+v2di_t crypto7g (v2di_t a, v2di_t b) -+{ -+ return __builtin_crypto_vpmsumd (a, b); -+} -+ -+v2di_t crypto7h (v2di_t a, v2di_t b) -+{ -+ return __builtin_crypto_vpmsum (a, b); -+} -+ -+v2di_t crypto8a (v2di_t a) -+{ -+ return __builtin_crypto_vshasigmad (a, 0, 8); -+} -+ -+v2di_t crypto8b (v2di_t a) -+{ -+ return __builtin_crypto_vshasigma (a, 0, 8); -+} -+ -+v4si_t crypto8c (v4si_t a) -+{ -+ return __builtin_crypto_vshasigmaw (a, 1, 15); -+} -+ -+v4si_t crypto8d (v4si_t a) -+{ -+ return __builtin_crypto_vshasigma (a, 1, 15); -+} -+ -+/* Note space is used after the instruction so that vcipherlast does not match -+ vcipher. */ -+/* { dg-final { scan-assembler-times "vcipher " 1 } } */ -+/* { dg-final { scan-assembler-times "vcipherlast " 1 } } */ -+/* { dg-final { scan-assembler-times "vncipher " 1 } } */ -+/* { dg-final { scan-assembler-times "vncipherlast " 1 } } */ -+/* { dg-final { scan-assembler-times "vpermxor " 4 } } */ -+/* { dg-final { scan-assembler-times "vpmsumb " 2 } } */ -+/* { dg-final { scan-assembler-times "vpmsumd " 2 } } */ -+/* { dg-final { scan-assembler-times "vpmsumh " 2 } } */ -+/* { dg-final { scan-assembler-times "vpmsumw " 2 } } */ -+/* { dg-final { scan-assembler-times "vsbox " 1 } } */ -+/* { dg-final { scan-assembler-times "vshasigmad " 2 } } */ -+/* { dg-final { scan-assembler-times "vshasigmaw " 2 } } */ -Index: gcc/testsuite/gcc.target/powerpc/pr42747.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr42747.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr42747.c (.../branches/gcc-4_8-branch) -@@ -5,4 +5,4 @@ - - double foo (double x) { return __builtin_sqrt (x); } - --/* { dg-final { scan-assembler "xssqrtdp" } } */ -+/* { dg-final { scan-assembler "xssqrtdp\|fsqrt" } } */ -Index: gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,26 @@ -+/* Test generation of DFP instructions for POWER6. */ -+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ -+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ -+ -+/* { dg-final { scan-assembler-times "fneg" 1 } } */ -+/* { dg-final { scan-assembler-times "fabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fnabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fmr" 0 } } */ -+ -+_Decimal64 -+func1 (_Decimal64 a, _Decimal64 b) -+{ -+ return -b; -+} -+ -+_Decimal64 -+func2 (_Decimal64 a, _Decimal64 b) -+{ -+ return __builtin_fabsd64 (b); -+} -+ -+_Decimal64 -+func3 (_Decimal64 a, _Decimal64 b) -+{ -+ return - __builtin_fabsd64 (b); -+} -Index: gcc/testsuite/gcc.target/powerpc/direct-move-float1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+/* { dg-final { scan-assembler "mtvsrd" } } */ -+/* { dg-final { scan-assembler "mfvsrd" } } */ -+/* { dg-final { scan-assembler "xscvdpspn" } } */ -+/* { dg-final { scan-assembler "xscvspdpn" } } */ -+ -+/* Check code generation for direct move for float types. */ -+ -+#define TYPE float -+#define IS_FLOAT 1 -+#define NO_ALTIVEC 1 -+#define VSX_REG_ATTR "ww" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/dfp-td-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* Test generation of DFP instructions for POWER6. */ -+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ -+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ -+ -+/* { dg-final { scan-assembler-times "fneg" 1 } } */ -+/* { dg-final { scan-assembler-times "fabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fnabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fmr" 0 } } */ -+ -+/* These tests verify we only generate fneg, fabs and fnabs -+ instructions and no fmr's since these are done in place. */ -+ -+_Decimal128 -+func1 (_Decimal128 a) -+{ -+ return -a; -+} -+ -+_Decimal128 -+func2 (_Decimal128 a) -+{ -+ return __builtin_fabsd128 (a); -+} -+ -+_Decimal128 -+func3 (_Decimal128 a) ++ttest (void) +{ -+ return - __builtin_fabsd128 (a); ++ return _HTM_STATE(__builtin_ttest()); +} -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c +Index: gcc/testsuite/gcc.target/alpha/pr61586.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,105 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#include <altivec.h> -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#ifndef ATTR_ALIGN -+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN))) -+#endif -+ -+#define DOIT(TYPE, PREFIX) \ -+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_eqv (a, b); \ -+} \ -+ \ -+TYPE PREFIX ## _eqv_arith (TYPE a, TYPE b) \ -+{ \ -+ return ~(a ^ b); \ -+} \ -+ \ -+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_nand (a, b); \ -+} \ -+ \ -+TYPE PREFIX ## _nand_arith1 (TYPE a, TYPE b) \ -+{ \ -+ return ~(a & b); \ -+} \ -+ \ -+TYPE PREFIX ## _nand_arith2 (TYPE a, TYPE b) \ -+{ \ -+ return (~a) | (~b); \ -+} \ -+ \ -+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_orc (a, b); \ -+} \ -+ \ -+TYPE PREFIX ## _orc_arith1 (TYPE a, TYPE b) \ -+{ \ -+ return (~ a) | b; \ -+} \ -+ \ -+TYPE PREFIX ## _orc_arith2 (TYPE a, TYPE b) \ -+{ \ -+ return a | (~ b); \ -+} -+ -+#define DOIT_FLOAT(TYPE, PREFIX) \ -+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_eqv (a, b); \ -+} \ -+ \ -+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_nand (a, b); \ -+} \ -+ \ -+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \ -+{ \ -+ return vec_orc (a, b); \ -+} -+ -+typedef vector signed char sign_char_vec; -+typedef vector short sign_short_vec; -+typedef vector int sign_int_vec; -+typedef vector long long sign_llong_vec; -+ -+typedef vector unsigned char uns_char_vec; -+typedef vector unsigned short uns_short_vec; -+typedef vector unsigned int uns_int_vec; -+typedef vector unsigned long long uns_llong_vec; -+ -+typedef vector float float_vec; -+typedef vector double double_vec; -+ -+DOIT(sign_char_vec, sign_char) -+DOIT(sign_short_vec, sign_short) -+DOIT(sign_int_vec, sign_int) -+DOIT(sign_llong_vec, sign_llong) -+ -+DOIT(uns_char_vec, uns_char) -+DOIT(uns_short_vec, uns_short) -+DOIT(uns_int_vec, uns_int) -+DOIT(uns_llong_vec, uns_llong) -+ -+DOIT_FLOAT(float_vec, float) -+DOIT_FLOAT(double_vec, double) -+ -+/* { dg-final { scan-assembler-times "xxleqv" 18 } } */ -+/* { dg-final { scan-assembler-times "xxlnand" 26 } } */ -+/* { dg-final { scan-assembler-times "xxlorc" 26 } } */ -Index: gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,87 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */ -+ -+#ifndef SIZE -+#define SIZE 1024 -+#endif -+ -+#ifndef ALIGN -+#define ALIGN 32 -+#endif -+ -+#ifndef ATTR_ALIGN -+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN))) -+#endif -+ -+#ifndef TYPE -+#define TYPE unsigned int -+#endif -+ -+TYPE in1 [SIZE] ATTR_ALIGN; -+TYPE in2 [SIZE] ATTR_ALIGN; -+TYPE eqv [SIZE] ATTR_ALIGN; -+TYPE nand1[SIZE] ATTR_ALIGN; -+TYPE nand2[SIZE] ATTR_ALIGN; -+TYPE orc1 [SIZE] ATTR_ALIGN; -+TYPE orc2 [SIZE] ATTR_ALIGN; -+ -+void -+do_eqv (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ { -+ eqv[i] = ~(in1[i] ^ in2[i]); -+ } -+} -+ -+void -+do_nand1 (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ { -+ nand1[i] = ~(in1[i] & in2[i]); -+ } -+} -+ -+void -+do_nand2 (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ { -+ nand2[i] = (~in1[i]) | (~in2[i]); -+ } -+} -+ -+void -+do_orc1 (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ { -+ orc1[i] = (~in1[i]) | in2[i]; -+ } -+} -+ -+void -+do_orc2 (void) -+{ -+ unsigned long i; -+ -+ for (i = 0; i < SIZE; i++) -+ { -+ orc1[i] = in1[i] | (~in2[i]); -+ } -+} -+ -+/* { dg-final { scan-assembler-times "xxleqv" 1 } } */ -+/* { dg-final { scan-assembler-times "xxlnand" 2 } } */ -+/* { dg-final { scan-assembler-times "xxlorc" 2 } } */ -Index: gcc/testsuite/gcc.target/powerpc/pr57949-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */ -+/* { dg-options "-O2 -mcpu=power7" } */ -+ -+/* Verify that vs is not 16-byte aligned in the absence of -mno-compat-align-parm. */ -+ -+typedef float v4sf __attribute__ ((vector_size (16))); -+struct s { long m; v4sf v; }; -+long n; -+v4sf ve; -+ -+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6, -+ long d7, long d8, long d9, struct s vs) { -+ n = vs.m; -+ ve = vs.v; -+} -+ -+/* { dg-final { scan-assembler "ld .\*,136\\(1\\)" } } */ -+/* { dg-final { scan-assembler "ld .\*,120\\(1\\)" } } */ -Index: gcc/testsuite/gcc.target/powerpc/recip-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/recip-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-5.c (.../branches/gcc-4_8-branch) -@@ -4,8 +4,16 @@ - /* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */ - /* { dg-final { scan-assembler-times "xvredp" 4 } } */ - /* { dg-final { scan-assembler-times "xvresp" 5 } } */ --/* { dg-final { scan-assembler-times "xsredp" 2 } } */ --/* { dg-final { scan-assembler-times "fres" 2 } } */ -+/* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */ -+/* { dg-final { scan-assembler-times "xsresp\|fres" 2 } } */ -+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */ -+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */ -+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 2 } } */ -+/* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 4 } } */ -+/* { dg-final { scan-assembler-times "xvmulsp" 7 } } */ -+/* { dg-final { scan-assembler-times "xvnmsub.sp" 5 } } */ -+/* { dg-final { scan-assembler-times "xvmuldp" 6 } } */ -+/* { dg-final { scan-assembler-times "xvnmsub.dp" 8 } } */ - - #include <altivec.h> - -Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c (.../branches/gcc-4_8-branch) -@@ -89,8 +89,10 @@ - long a1; - long a2; - long a3; -+#if _CALL_ELF != 2 - long a4; - long a5; -+#endif - parm_t slot[100]; - } stack_frame_t; - -Index: gcc/testsuite/gcc.target/powerpc/direct-move-float2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+/* Check whether we get the right bits for direct move at runtime. */ -+ -+#define TYPE float -+#define IS_FLOAT 1 -+#define NO_ALTIVEC 1 -+#define DO_MAIN -+#define VSX_REG_ATTR "ww" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/direct-move-double1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+/* { dg-final { scan-assembler "mtvsrd" } } */ -+/* { dg-final { scan-assembler "mfvsrd" } } */ -+ -+/* Check code generation for direct move for double types. */ -+ -+#define TYPE double -+#define IS_FLOAT 1 -+#define NO_ALTIVEC 1 -+#define VSX_REG_ATTR "ws" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/dfp-td-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* Test generation of DFP instructions for POWER6. */ -+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ -+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ -+ -+/* { dg-final { scan-assembler-times "fneg" 1 } } */ -+/* { dg-final { scan-assembler-times "fabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fnabs" 1 } } */ -+/* { dg-final { scan-assembler-times "fmr" 3 } } */ -+ -+/* These tests verify we generate fneg, fabs and fnabs and -+ associated fmr's since these are not done in place. */ -+ -+_Decimal128 -+func1 (_Decimal128 a, _Decimal128 b) -+{ -+ return -b; -+} -+ -+_Decimal128 -+func2 (_Decimal128 a, _Decimal128 b) -+{ -+ return __builtin_fabsd128 (b); -+} -+ -+_Decimal128 -+func3 (_Decimal128 a, _Decimal128 b) -+{ -+ return - __builtin_fabsd128 (b); -+} -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/gcc.target/alpha/pr61586.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/alpha/pr61586.c (.../branches/gcc-4_8-branch) @@ -0,0 +1,10 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+vector float dbl_to_float_p8 (double x) { return __builtin_vsx_xscvdpspn (x); } -+double float_to_dbl_p8 (vector float x) { return __builtin_vsx_xscvspdpn (x); } -+ -+/* { dg-final { scan-assembler "xscvdpspn" } } */ -+/* { dg-final { scan-assembler "xscvspdpn" } } */ -Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c (.../branches/gcc-4_8-branch) -@@ -16,9 +16,9 @@ - /* { dg-final { scan-assembler "xvrspiz" } } */ - /* { dg-final { scan-assembler "xsrdpi" } } */ - /* { dg-final { scan-assembler "xsrdpic" } } */ --/* { dg-final { scan-assembler "xsrdpim" } } */ --/* { dg-final { scan-assembler "xsrdpip" } } */ --/* { dg-final { scan-assembler "xsrdpiz" } } */ -+/* { dg-final { scan-assembler "xsrdpim\|frim" } } */ -+/* { dg-final { scan-assembler "xsrdpip\|frip" } } */ -+/* { dg-final { scan-assembler "xsrdpiz\|friz" } } */ - /* { dg-final { scan-assembler "xsmaxdp" } } */ - /* { dg-final { scan-assembler "xsmindp" } } */ - /* { dg-final { scan-assembler "xxland" } } */ -Index: gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,51 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_htm_ok } */ -+/* { dg-options "-O2 -mhtm" } */ -+ -+/* { dg-final { scan-assembler-times "tbegin\\." 1 } } */ -+/* { dg-final { scan-assembler-times "tend\\." 2 } } */ -+/* { dg-final { scan-assembler-times "tabort\\." 2 } } */ -+/* { dg-final { scan-assembler-times "tabortdc\\." 1 } } */ -+/* { dg-final { scan-assembler-times "tabortdci\\." 1 } } */ -+/* { dg-final { scan-assembler-times "tabortwc\\." 1 } } */ -+/* { dg-final { scan-assembler-times "tabortwci\\." 2 } } */ -+/* { dg-final { scan-assembler-times "tcheck\\." 1 } } */ -+/* { dg-final { scan-assembler-times "trechkpt\\." 1 } } */ -+/* { dg-final { scan-assembler-times "treclaim\\." 1 } } */ -+/* { dg-final { scan-assembler-times "tsr\\." 3 } } */ -+/* { dg-final { scan-assembler-times "mfspr" 4 } } */ -+/* { dg-final { scan-assembler-times "mtspr" 4 } } */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mieee" } */ + -+void use_builtins (long *p, char code, long *a, long *b) ++void foo (int *dimensions, double **params, int hh) +{ -+ p[0] = __builtin_tbegin (0); -+ p[1] = __builtin_tend (0); -+ p[2] = __builtin_tendall (); -+ p[3] = __builtin_tabort (0); -+ p[4] = __builtin_tabort (code); -+ -+ p[5] = __builtin_tabortdc (0xf, a[5], b[5]); -+ p[6] = __builtin_tabortdci (0xf, a[6], 13); -+ p[7] = __builtin_tabortwc (0xf, a[7], b[7]); -+ p[8] = __builtin_tabortwci (0xf, a[8], 13); -+ -+ p[9] = __builtin_tcheck (5); -+ p[10] = __builtin_trechkpt (); -+ p[11] = __builtin_treclaim (0); -+ p[12] = __builtin_tresume (); -+ p[13] = __builtin_tsuspend (); -+ p[14] = __builtin_tsr (0); -+ p[15] = __builtin_ttest (); /* This expands to a tabortwci. */ -+ -+ -+ p[16] = __builtin_get_texasr (); -+ p[17] = __builtin_get_texasru (); -+ p[18] = __builtin_get_tfhar (); -+ p[19] = __builtin_get_tfiar (); -+ -+ __builtin_set_texasr (a[20]); -+ __builtin_set_texasru (a[21]); -+ __builtin_set_tfhar (a[22]); -+ __builtin_set_tfiar (a[23]); ++ if (params[hh]) ++ ; ++ else if (dimensions[hh] > 0) ++ params[hh][0] = 1.0f; +} -Index: gcc/testsuite/gcc.target/powerpc/bool.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-options "-O2" } */ -+/* { dg-final { scan-assembler "eqv" } } */ -+/* { dg-final { scan-assembler "nand" } } */ -+/* { dg-final { scan-assembler "nor" } } */ -+ -+#ifndef TYPE -+#define TYPE unsigned long -+#endif -+ -+TYPE op1 (TYPE a, TYPE b) { return ~(a ^ b); } /* eqv */ -+TYPE op2 (TYPE a, TYPE b) { return ~(a & b); } /* nand */ -+TYPE op3 (TYPE a, TYPE b) { return ~(a | b); } /* nor */ -+ -Index: gcc/testsuite/gcc.target/powerpc/bool2-p5.c +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_altivec_ok } */ -+/* { dg-options "-O2 -mcpu=power5 -mabi=altivec -mno-altivec -mno-vsx" } */ -+/* { dg-final { scan-assembler "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]eqv " } } */ -+/* { dg-final { scan-assembler "\[ \t\]orc " } } */ -+/* { dg-final { scan-assembler "\[ \t\]nand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+#ifndef TYPE -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+ -+#include "bool2.h" -Index: gcc/testsuite/gcc.target/powerpc/fusion.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/fusion.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/fusion.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,24 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power7 -mtune=power8 -O3" } */ -+ -+#define LARGE 0x12345 -+ -+int fusion_uchar (unsigned char *p){ return p[LARGE]; } -+int fusion_schar (signed char *p){ return p[LARGE]; } -+int fusion_ushort (unsigned short *p){ return p[LARGE]; } -+int fusion_short (short *p){ return p[LARGE]; } -+int fusion_int (int *p){ return p[LARGE]; } -+unsigned fusion_uns (unsigned *p){ return p[LARGE]; } -+ -+vector double fusion_vector (vector double *p) { return p[2]; } -+ -+/* { dg-final { scan-assembler-times "gpr load fusion" 6 } } */ -+/* { dg-final { scan-assembler-times "vector load fusion" 1 } } */ -+/* { dg-final { scan-assembler-times "lbz" 2 } } */ -+/* { dg-final { scan-assembler-times "extsb" 1 } } */ -+/* { dg-final { scan-assembler-times "lhz" 2 } } */ -+/* { dg-final { scan-assembler-times "extsh" 1 } } */ -+/* { dg-final { scan-assembler-times "lwz" 2 } } */ -Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c (.../branches/gcc-4_8-branch) -@@ -107,8 +107,10 @@ - long a1; - long a2; - long a3; -+#if _CALL_ELF != 2 - long a4; - long a5; -+#endif - parm_t slot[100]; - } stack_frame_t; - -@@ -119,6 +121,12 @@ - vector int v; - } vector_int_t; - -+#ifdef __LITTLE_ENDIAN__ -+#define MAKE_SLOT(x, y) ((long)x | ((long)y << 32)) -+#else -+#define MAKE_SLOT(x, y) ((long)y | ((long)x << 32)) -+#endif -+ - /* Paramter passing. - s : gpr 3 - v : vpr 2 -@@ -226,8 +234,8 @@ - sp = __builtin_frame_address(0); - sp = sp->backchain; - -- if (sp->slot[2].l != 0x100000002ULL -- || sp->slot[4].l != 0x500000006ULL) -+ if (sp->slot[2].l != MAKE_SLOT (1, 2) -+ || sp->slot[4].l != MAKE_SLOT (5, 6)) - abort(); - } - -@@ -268,8 +276,8 @@ - sp = __builtin_frame_address(0); - sp = sp->backchain; - -- if (sp->slot[4].l != 0x100000002ULL -- || sp->slot[6].l != 0x500000006ULL) -+ if (sp->slot[4].l != MAKE_SLOT (1, 2) -+ || sp->slot[6].l != MAKE_SLOT (5, 6)) - abort(); - } - -@@ -296,8 +304,8 @@ - sp = __builtin_frame_address(0); - sp = sp->backchain; - -- if (sp->slot[4].l != 0x100000002ULL -- || sp->slot[6].l != 0x500000006ULL) -+ if (sp->slot[4].l != MAKE_SLOT (1, 2) -+ || sp->slot[6].l != MAKE_SLOT (5, 6)) - abort(); - } +--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,35 @@ ++/* Test AAPCS64 layout and __builtin_va_start. ++ ++ Pass named HFA/HVA argument on stack. */ ++ ++/* { dg-do run { target aarch64*-*-* } } */ ++ ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-14.c" ++#include "type-def.h" ++ ++struct hfa_fx2_t hfa_fx2 = {1.2f, 2.2f}; ++struct hfa_fx3_t hfa_fx3 = {3.2f, 4.2f, 5.2f}; ++vf4_t float32x4 = {6.2f, 7.2f, 8.2f, 9.2f}; ++vf4_t float32x4_2 = {10.2f, 11.2f, 12.2f, 13.2f}; ++ ++#include "abitest.h" ++#else ++ ARG (float, 1.0f, S0, 0) ++ ARG (float, 2.0f, S1, 1) ++ ARG (float, 3.0f, S2, 2) ++ ARG (float, 4.0f, S3, 3) ++ ARG (float, 5.0f, S4, 4) ++ ARG (float, 6.0f, S5, 5) ++ ARG (float, 7.0f, S6, 6) ++ ARG (struct hfa_fx3_t, hfa_fx3, STACK, 7) ++ /* Previous argument size has been rounded up to the nearest multiple of ++ 8 bytes. */ ++ ARG (struct hfa_fx2_t, hfa_fx2, STACK + 16, 8) ++ /* NSAA is rounded up to the nearest natural alignment of float32x4. */ ++ ARG (vf4_t, float32x4, STACK + 32, 9) ++ ARG (vf4_t, float32x4_2, STACK + 48, LAST_NAMED_ARG_ID) ++ DOTS ++ LAST_ANON (double, 123456789.987, STACK + 64, 11) ++#endif +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h +=================================================================== +--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h (.../branches/gcc-4_8-branch) +@@ -34,6 +34,13 @@ + float b; + }; -Index: gcc/testsuite/gcc.target/powerpc/direct-move-long1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+/* { dg-final { scan-assembler "mtvsrd" } } */ -+/* { dg-final { scan-assembler "mfvsrd" } } */ -+ -+/* Check code generation for direct move for long types. */ -+ -+#define TYPE long -+#define IS_INT 1 -+#define NO_ALTIVEC 1 -+#define VSX_REG_ATTR "d" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/direct-move-double2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+/* Check whether we get the right bits for direct move at runtime. */ -+ -+#define TYPE double -+#define IS_FLOAT 1 -+#define NO_ALTIVEC 1 -+#define DO_MAIN -+#define VSX_REG_ATTR "ws" -+ -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O2" } */ -+ -+#include <altivec.h> -+ -+typedef vector int v_sign; -+typedef vector unsigned int v_uns; -+ -+v_sign even_sign (v_sign a, v_sign b) -+{ -+ return vec_vmrgew (a, b); -+} -+ -+v_uns even_uns (v_uns a, v_uns b) -+{ -+ return vec_vmrgew (a, b); -+} -+ -+v_sign odd_sign (v_sign a, v_sign b) ++struct hfa_fx3_t +{ -+ return vec_vmrgow (a, b); -+} -+ -+v_uns odd_uns (v_uns a, v_uns b) -+{ -+ return vec_vmrgow (a, b); -+} -+ -+/* { dg-final { scan-assembler-times "vmrgew" 2 } } */ -+/* { dg-final { scan-assembler-times "vmrgow" 2 } } */ -Index: gcc/testsuite/gcc.target/powerpc/bool2.h -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool2.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* Test various logical operations. */ -+ -+TYPE arg1 (TYPE p, TYPE q) { return p & q; } /* AND */ -+TYPE arg2 (TYPE p, TYPE q) { return p | q; } /* OR */ -+TYPE arg3 (TYPE p, TYPE q) { return p ^ q; } /* XOR */ -+TYPE arg4 (TYPE p) { return ~ p; } /* NOR */ -+TYPE arg5 (TYPE p, TYPE q) { return ~(p & q); } /* NAND */ -+TYPE arg6 (TYPE p, TYPE q) { return ~(p | q); } /* NOR */ -+TYPE arg7 (TYPE p, TYPE q) { return ~(p ^ q); } /* EQV */ -+TYPE arg8 (TYPE p, TYPE q) { return (~p) & q; } /* ANDC */ -+TYPE arg9 (TYPE p, TYPE q) { return (~p) | q; } /* ORC */ -+TYPE arg10(TYPE p, TYPE q) { return (~p) ^ q; } /* EQV */ -+TYPE arg11(TYPE p, TYPE q) { return p & (~q); } /* ANDC */ -+TYPE arg12(TYPE p, TYPE q) { return p | (~q); } /* ORC */ -+TYPE arg13(TYPE p, TYPE q) { return p ^ (~q); } /* EQV */ ++ float a; ++ float b; ++ float c; ++}; + -+void ptr1 (TYPE *p) { p[0] = p[1] & p[2]; } /* AND */ -+void ptr2 (TYPE *p) { p[0] = p[1] | p[2]; } /* OR */ -+void ptr3 (TYPE *p) { p[0] = p[1] ^ p[2]; } /* XOR */ -+void ptr4 (TYPE *p) { p[0] = ~p[1]; } /* NOR */ -+void ptr5 (TYPE *p) { p[0] = ~(p[1] & p[2]); } /* NAND */ -+void ptr6 (TYPE *p) { p[0] = ~(p[1] | p[2]); } /* NOR */ -+void ptr7 (TYPE *p) { p[0] = ~(p[1] ^ p[2]); } /* EQV */ -+void ptr8 (TYPE *p) { p[0] = ~(p[1]) & p[2]; } /* ANDC */ -+void ptr9 (TYPE *p) { p[0] = (~p[1]) | p[2]; } /* ORC */ -+void ptr10(TYPE *p) { p[0] = (~p[1]) ^ p[2]; } /* EQV */ -+void ptr11(TYPE *p) { p[0] = p[1] & (~p[2]); } /* ANDC */ -+void ptr12(TYPE *p) { p[0] = p[1] | (~p[2]); } /* ORC */ -+void ptr13(TYPE *p) { p[0] = p[1] ^ (~p[2]); } /* EQV */ -Index: gcc/testsuite/gcc.target/powerpc/pr48258-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* { dg-do compile } */ - /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */ - /* { dg-require-effective-target powerpc_vsx_ok } */ - /* { dg-options "-O3 -mcpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */ - /* { dg-final { scan-assembler-times "xvaddsp" 3 } } */ -Index: gcc/testsuite/gcc.target/powerpc/quad-atomic.c + struct hfa_dx2_t + { + double a; +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/quad-atomic.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/quad-atomic.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,67 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ +--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,59 @@ ++/* Test AAPCS64 layout and __builtin_va_start. + -+/* Test whether we get the right bits for quad word atomic instructions. */ -+#include <stdlib.h> ++ Pass named HFA/HVA argument on stack. */ + -+static __int128_t quad_fetch_and (__int128_t *, __int128_t value) __attribute__((__noinline__)); -+static __int128_t quad_fetch_or (__int128_t *, __int128_t value) __attribute__((__noinline__)); -+static __int128_t quad_fetch_add (__int128_t *, __int128_t value) __attribute__((__noinline__)); ++/* { dg-do run { target aarch64*-*-* } } */ + -+static __int128_t -+quad_fetch_and (__int128_t *ptr, __int128_t value) -+{ -+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE); -+} ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-13.c" + -+static __int128_t -+quad_fetch_or (__int128_t *ptr, __int128_t value) ++struct float_float_t +{ -+ return __atomic_fetch_or (ptr, value, __ATOMIC_ACQUIRE); -+} ++ float a; ++ float b; ++} float_float; + -+static __int128_t -+quad_fetch_add (__int128_t *ptr, __int128_t value) ++union float_int_t +{ -+ return __atomic_fetch_add (ptr, value, __ATOMIC_ACQUIRE); -+} ++ float b8; ++ int b5; ++} float_int; + -+int -+main (void) ++#define HAS_DATA_INIT_FUNC ++void ++init_data () +{ -+ __int128_t result; -+ __int128_t value; -+ __int128_t and_input = ((((__int128_t) 0x1234567890abcdefULL) << 64) | ((__int128_t) 0xfedcba0987654321ULL)); -+ __int128_t and_value = ((((__int128_t) 0xfffffffffffffff0ULL) << 64) | ((__int128_t) 0xfffffffffffffff0ULL)); -+ __int128_t and_exp = ((((__int128_t) 0x1234567890abcde0ULL) << 64) | ((__int128_t) 0xfedcba0987654320ULL)); -+ -+ __int128_t or_input = ((((__int128_t) 0x1234567890abcdefULL) << 64) | ((__int128_t) 0xfedcba0987654321ULL)); -+ __int128_t or_value = ((((__int128_t) 0x0000000000000010ULL) << 64) | ((__int128_t) 0x000000000000000eULL)); -+ __int128_t or_exp = ((((__int128_t) 0x1234567890abcdffULL) << 64) | ((__int128_t) 0xfedcba098765432fULL)); -+ -+ __int128_t add_input = ((((__int128_t) 0x1234567890abcdefULL) << 64) | ((__int128_t) 0xfedcba0987654321ULL)); -+ __int128_t add_value = ((((__int128_t) 0x0000000001000000ULL) << 64) | ((__int128_t) 0x0000001000000000ULL)); -+ __int128_t add_exp = ((((__int128_t) 0x1234567891abcdefULL) << 64) | ((__int128_t) 0xfedcba1987654321ULL)); -+ -+ -+ value = and_input; -+ result = quad_fetch_and (&value, and_value); -+ if (result != and_input || value != and_exp) -+ abort (); -+ -+ value = or_input; -+ result = quad_fetch_or (&value, or_value); -+ if (result != or_input || value != or_exp) -+ abort (); ++ float_float.a = 1.2f; ++ float_float.b = 2.2f; + -+ value = add_input; -+ result = quad_fetch_add (&value, add_value); -+ if (result != add_input || value != add_exp) -+ abort (); -+ -+ return 0; ++ float_int.b8 = 4983.80f; +} + -Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c (.../branches/gcc-4_8-branch) -@@ -33,15 +33,27 @@ - - - /* Wrapper to save the GPRs and FPRs and then jump to the real function. */ -+#if _CALL_ELF != 2 -+#define FUNC_START(NAME) \ -+ "\t.globl\t" NAME "\n\t" \ -+ ".section \".opd\",\"aw\"\n\t" \ -+ ".align 3\n" \ -+ NAME ":\n\t" \ -+ ".quad .L." NAME ",.TOC.@tocbase,0\n\t" \ -+ ".text\n\t" \ -+ ".type " NAME ", @function\n" \ -+ ".L." NAME ":\n\t" ++#include "abitest.h" +#else -+#define FUNC_START(NAME) \ -+ "\t.globl\t" NAME "\n\t" \ -+ ".text\n\t" \ -+ NAME ":\n" \ -+ "0:\taddis 2,12,(.TOC.-0b)@ha\n\t" \ -+ "addi 2,2,(.TOC.-0b)@l\n\t" \ -+ ".localentry " NAME ",.-" NAME "\n\t" ++ ARG (float, 1.0f, S0, 0) ++ ARG (float, 2.0f, S1, 1) ++ ARG (float, 3.0f, S2, 2) ++ ARG (float, 4.0f, S3, 3) ++ ARG (float, 5.0f, S4, 4) ++ ARG (float, 6.0f, S5, 5) ++ ARG (float, 7.0f, S6, 6) ++ ARG (struct float_float_t, float_float, STACK, 7) ++ ARG (int, 9, W0, 8) ++ ARG (int, 10, W1, 9) ++ ARG (int, 11, W2, 10) ++ ARG (int, 12, W3, 11) ++ ARG (int, 13, W4, 12) ++ ARG (int, 14, W5, 13) ++ ARG (int, 15, W6, LAST_NAMED_ARG_ID) ++ DOTS ++ /* Note on the reason of using 'X7' instead of 'W7' here: ++ Using 'X7' makes sure the test works in the big-endian mode. ++ According to PCS rules B.4 and C.10, the size of float_int is rounded ++ to 8 bytes and prepared in the register X7 as if loaded via LDR from ++ the memory, with the content of the other 4 bytes unspecified. The ++ test framework will only compare the 4 relavent bytes. */ ++ ANON (union float_int_t, float_int, X7, 15) ++ LAST_ANON (long long, 12683143434LL, STACK + 8, 16) +#endif - #define WRAPPER(NAME) \ --__asm__ ("\t.globl\t" #NAME "_asm\n\t" \ -- ".section \".opd\",\"aw\"\n\t" \ -- ".align 3\n" \ -- #NAME "_asm:\n\t" \ -- ".quad .L." #NAME "_asm,.TOC.@tocbase,0\n\t" \ -- ".text\n\t" \ -- ".type " #NAME "_asm, @function\n" \ -- ".L." #NAME "_asm:\n\t" \ -+__asm__ (FUNC_START (#NAME "_asm") \ - "ld 11,gparms@got(2)\n\t" \ - "std 3,0(11)\n\t" \ - "std 4,8(11)\n\t" \ -@@ -75,8 +87,10 @@ - long a1; - long a2; - long a3; -+#if _CALL_ELF != 2 - long a4; - long a5; -+#endif - unsigned long slot[100]; - } stack_frame_t; - -Index: gcc/testsuite/gcc.target/powerpc/direct-move-long2.c +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ -+/* { dg-require-effective-target p8vector_hw } */ -+/* { dg-options "-mcpu=power8 -O2" } */ +--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,39 @@ ++/* Test AAPCS64 layout and __builtin_va_start. + -+/* Check whether we get the right bits for direct move at runtime. */ ++ Pass named __128int argument on stack. */ + -+#define TYPE long -+#define IS_INT 1 -+#define NO_ALTIVEC 1 -+#define DO_MAIN -+#define VSX_REG_ATTR "d" ++/* { dg-do run { target aarch64*-*-* } } */ + -+#include "direct-move.h" -Index: gcc/testsuite/gcc.target/powerpc/vsx-float0.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power7" } */ -+/* { dg-final { scan-assembler "xxlxor" } } */ ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-15.c" ++#include "type-def.h" + -+/* Test that we generate xxlor to clear a SFmode register. */ ++union int128_t qword; + -+float sum (float *p, unsigned long n) -+{ -+ float sum = 0.0f; /* generate xxlxor instead of load */ -+ while (n-- > 0) -+ sum += *p++; -+ -+ return sum; -+} -Index: gcc/testsuite/gcc.target/powerpc/ppc-target-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c (.../branches/gcc-4_8-branch) -@@ -5,8 +5,7 @@ - /* { dg-final { scan-assembler-times "fabs" 3 } } */ - /* { dg-final { scan-assembler-times "fnabs" 3 } } */ - /* { dg-final { scan-assembler-times "fsel" 3 } } */ --/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */ --/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */ -+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */ - - double normal1 (double, double); - double power5 (double, double) __attribute__((__target__("cpu=power5"))); -Index: gcc/testsuite/gcc.target/powerpc/pr60137.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/pr60137.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/pr60137.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_p8vector_ok } */ -+/* { dg-options "-mcpu=power8 -O3 -mno-vsx" } */ -+ -+/* target/60137, compiler got a 'could not split insn error'. */ -+ -+extern int target_flags; -+extern char fixed_regs[53]; -+extern char call_used_regs[53]; -+ -+void init_reg_sets_1(void) ++#define HAS_DATA_INIT_FUNC ++void ++init_data () +{ -+ int i; -+ for (i = 0; i < 53; i++) -+ fixed_regs[i] = call_used_regs[i] = (call_used_regs[i] &((target_flags & 0x02000000) ? 2 : 1)) != 0; ++ /* Init signed quad-word integer. */ ++ qword.l64 = 0xfdb9753102468aceLL; ++ qword.h64 = 0xeca8642013579bdfLL; +} -Index: gcc/testsuite/gcc.target/powerpc/bool3.h -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool3.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,186 @@ -+/* Test forcing 128-bit logical types into GPR registers. */ -+ -+#if defined(NO_ASM) -+#define FORCE_REG1(X) -+#define FORCE_REG2(X,Y) + ++#include "abitest.h" +#else -+#if defined(USE_ALTIVEC) -+#define REG_CLASS "+v" -+#define PRINT_REG1 "# altivec reg %0" -+#define PRINT_REG2 "# altivec reg %0, %1" -+ -+#elif defined(USE_FPR) -+#define REG_CLASS "+d" -+#define PRINT_REG1 "# fpr reg %0" -+#define PRINT_REG2 "# fpr reg %0, %1" -+ -+#elif defined(USE_VSX) -+#define REG_CLASS "+wa" -+#define PRINT_REG1 "# vsx reg %x0" -+#define PRINT_REG2 "# vsx reg %x0, %x1" -+ ++ ARG (int, 1, W0, 0) ++ ARG (int, 2, W1, 1) ++ ARG (int, 3, W2, 2) ++ ARG (int, 4, W3, 3) ++ ARG (int, 5, W4, 4) ++ ARG (int, 6, W5, 5) ++ ARG (int, 7, W6, 6) ++ ARG (__int128, qword.i, STACK, LAST_NAMED_ARG_ID) ++ DOTS ++#ifndef __AAPCS64_BIG_ENDIAN__ ++ LAST_ANON (int, 8, STACK + 16, 8) +#else -+#define REG_CLASS "+r" -+#define PRINT_REG1 "# gpr reg %0" -+#define PRINT_REG2 "# gpr reg %0, %1" ++ LAST_ANON (int, 8, STACK + 20, 8) +#endif -+ -+#define FORCE_REG1(X) __asm__ (PRINT_REG1 : REG_CLASS (X)) -+#define FORCE_REG2(X,Y) __asm__ (PRINT_REG2 : REG_CLASS (X), REG_CLASS (Y)) +#endif +Index: gcc/testsuite/gcc.target/avr/torture/pr61443.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/avr/torture/pr61443.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/avr/torture/pr61443.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,134 @@ ++/* { dg-do run } */ ++/* { dg-options "-std=gnu99" } */ + -+void ptr1 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a & b; /* AND */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} -+ -+void ptr2 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a | b; /* OR */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} -+ -+void ptr3 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a ^ b; /* XOR */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} -+ -+void ptr4 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b; -+ -+ FORCE_REG1 (a); -+ b = ~a; /* NOR */ -+ FORCE_REG1 (b); -+ p[0] = b; -+} -+ -+void ptr5 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = ~(a & b); /* NAND */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} -+ -+void ptr6 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; ++#include <stdlib.h> ++#include <stdarg.h> + -+ FORCE_REG2 (a, b); -+ c = ~(a | b); /* AND */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} ++#define NC __attribute__((noinline,noclone)) + -+void ptr7 (TYPE *p) ++void NC vfun (char n, ...) +{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; ++ va_list ap; + -+ FORCE_REG2 (a, b); -+ c = ~(a ^ b); /* EQV */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} ++ va_start (ap, n); + -+void ptr8 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; ++ switch (n) ++ { ++ default: ++ abort(); ++ case 1: ++ if (11 != va_arg (ap, int)) ++ abort(); ++ break; ++ case 2: ++ if (2222 != va_arg (ap, int)) ++ abort(); ++ break; ++ case 3: ++ if (333333 != va_arg (ap, __int24)) ++ abort(); ++ break; ++ case 4: ++ if (44444444 != va_arg (ap, long)) ++ abort(); ++ break; ++ case 8: ++ if (8888888888888888 != va_arg (ap, long long)) ++ abort(); ++ break; ++ } + -+ FORCE_REG2 (a, b); -+ c = (~a) & b; /* ANDC */ -+ FORCE_REG1 (c); -+ p[0] = c; ++ va_end (ap); +} + -+void ptr9 (TYPE *p) -+{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = (~a) | b; /* ORC */ -+ FORCE_REG1 (c); -+ p[0] = c; -+} + -+void ptr10 (TYPE *p) ++void NC boo_qi (const __flash char *p) +{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = (~a) ^ b; /* EQV */ -+ FORCE_REG1 (c); -+ p[0] = c; ++ vfun (1, *p); +} + -+void ptr11 (TYPE *p) ++void NC boox_qi (const __memx char *p) +{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a & (~b); /* ANDC */ -+ FORCE_REG1 (c); -+ p[0] = c; ++ vfun (1, *p); +} + -+void ptr12 (TYPE *p) ++void NC boo_hi (const __flash int *p) +{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a | (~b); /* ORC */ -+ FORCE_REG1 (c); -+ p[0] = c; ++ vfun (2, *p); +} + -+void ptr13 (TYPE *p) ++void NC boox_hi (const __memx int *p) +{ -+ TYPE a = p[1]; -+ TYPE b = p[2]; -+ TYPE c; -+ -+ FORCE_REG2 (a, b); -+ c = a ^ (~b); /* AND */ -+ FORCE_REG1 (c); -+ p[0] = c; ++ vfun (2, *p); +} -Index: gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c (.../branches/gcc-4_8-branch) -@@ -19,19 +19,6 @@ - return __builtin_shuffle(x, (V){ 4,5,6,7, 4,5,6,7, 4,5,6,7, 4,5,6,7, }); - } - --V p2(V x, V y) --{ -- return __builtin_shuffle(x, y, -- (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 }); -- --} -- --V p4(V x, V y) --{ -- return __builtin_shuffle(x, y, -- (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 }); --} -- - V h1(V x, V y) - { - return __builtin_shuffle(x, y, -@@ -72,5 +59,3 @@ - /* { dg-final { scan-assembler "vspltb" } } */ - /* { dg-final { scan-assembler "vsplth" } } */ - /* { dg-final { scan-assembler "vspltw" } } */ --/* { dg-final { scan-assembler "vpkuhum" } } */ --/* { dg-final { scan-assembler "vpkuwum" } } */ -Index: gcc/testsuite/gcc.target/powerpc/bool2-p7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ -+/* { dg-do compile { target { powerpc*-*-* } } } */ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-O2 -mcpu=power7" } */ -+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxland " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlxor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlnor " } } */ -+/* { dg-final { scan-assembler "\[ \t\]xxlandc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */ -+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */ -+ -+#ifndef TYPE -+typedef int v4si __attribute__ ((vector_size (16))); -+#define TYPE v4si -+#endif -+ -+#include "bool2.h" -Index: gcc/testsuite/gcc.target/microblaze/others/mem_reload.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/microblaze/others/mem_reload.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/microblaze/others/mem_reload.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,74 @@ -+/* { dg-options "-O2 -fPIC" } */ -+ -+typedef struct test_struct -+{ -+ unsigned long long h[8]; -+ unsigned long long Nl,Nh; -+ union { -+ unsigned long long d[16]; -+ unsigned char p[(16*8)]; -+ } u; -+ unsigned int num,md_len; -+} TEST_STRUCT; -+ -+static const unsigned long long K512[12] = { -+ 0x428a2f98d728ae22,0x7137449123ef65cd, -+ 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc, -+ 0x3956c25bf348b538,0x59f111f1b605d019, -+ 0x923f82a4af194f9b,0xab1c5ed5da6d8118, -+ 0xd807aa98a3030242,0x12835b0145706fbe, -+ 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2}; + -+#define ROTR(x,s) (((x)>>s) | (x)<<(64-s)) -+#define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39)) -+#define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41)) -+#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) -+#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) -+ -+#define ROUND_00_15(i,a,b,c,d,e,f,g,h) do { \ -+ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; \ -+ h = Sigma0(a) + Maj(a,b,c); \ -+ d += T1; h += T1; } while (0) -+ -+#define ROUND_16_80(i,a,b,c,d,e,f,g,h,X) do { \ -+ T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \ -+ ROUND_00_15(i,a,b,c,d,e,f,g,h); } while (0) -+ -+static void testfunc1 (TEST_STRUCT *ctx, const void *in, unsigned int num) ++void NC boo_psi (const __flash __int24 *p) +{ -+ const unsigned long long *W=in; -+ unsigned long long a,b,c,d,e,f,g,h,s0,s1,T1; -+ unsigned long long X[16]; -+ int i; -+ -+ while (num--) { -+ -+ T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h); -+ T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g); -+ T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f); -+ T1 = X[3] = W[3]; ROUND_00_15(3,f,g,h,a,b,c,d,e); -+ T1 = X[4] = W[4]; ROUND_00_15(4,e,f,g,h,a,b,c,d); -+ T1 = X[5] = W[5]; ROUND_00_15(5,d,e,f,g,h,a,b,c); -+ T1 = X[6] = W[6]; ROUND_00_15(6,c,d,e,f,g,h,a,b); -+ T1 = X[7] = W[7]; ROUND_00_15(7,b,c,d,e,f,g,h,a); -+ T1 = X[8] = W[8]; ROUND_00_15(8,a,b,c,d,e,f,g,h); -+ T1 = X[9] = W[9]; ROUND_00_15(9,h,a,b,c,d,e,f,g); -+ -+ for (i=16;i<80;i+=8) -+ { -+ ROUND_16_80(i+0,a,b,c,d,e,f,g,h,X); -+ } -+ -+ ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h; -+ } ++ vfun (3, *p); +} + -+int testfunc2 (TEST_STRUCT *c, const void *_data, unsigned int len) ++void NC boox_psi (const __memx __int24 *p) +{ -+ const unsigned char *data=(const unsigned char *)_data; -+ -+ unsigned char *p=(unsigned char *)c->u.p; -+ -+ testfunc1 (c,p,0); -+ testfunc1 (c,data,len/sizeof(c->u)); ++ vfun (3, *p); +} -Index: gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/microblaze/others/builtin-trap.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+/* { dg-do compile } */ + -+void trap () ++void NC boo_si (const __flash long *p) +{ -+ __builtin_trap (); ++ vfun (4, *p); +} + -+/* { dg-final { scan-assembler "brki\tr0,-1" } } */ -\ No newline at end of file -Index: gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/microblaze/isa/fcmp4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+/* { dg-options "-O3 -mcpu=v6.00.a -mhard-float" } */ -+ -+void float_func(float f1, float f2, float f3) ++void NC boox_si (const __memx long *p) +{ -+ /* { dg-final { scan-assembler "fcmp\.eq\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ -+ /* { dg-final { scan-assembler "fcmp\.le\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ -+ if(f1==f2 && f1<=f3) -+ print ("f1 eq f2 && f1 le f3"); ++ vfun (4, *p); +} -Index: gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c (.../branches/gcc-4_8-branch) -@@ -1,8 +1,14 @@ - /* { dg-do compile } */ - /* { dg-options "-O2" } */ - --#include "../../../config/aarch64/arm_neon.h" -+#include <arm_neon.h> - -+/* Used to force a variable to a SIMD register. */ -+#define force_simd(V1) asm volatile ("mov %d0, %1.d[0]" \ -+ : "=w"(V1) \ -+ : "w"(V1) \ -+ : /* No clobbers */); + - /* { dg-final { scan-assembler-times "\\tadd\\tx\[0-9\]+" 2 } } */ - - uint64x1_t -@@ -31,7 +37,12 @@ - uint64x1_t - test_vceqd_s64 (int64x1_t a, int64x1_t b) - { -- return vceqd_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vceqd_s64 (a, b); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmeq\\td\[0-9\]+, d\[0-9\]+, #?0" 1 } } */ -@@ -39,7 +50,11 @@ - uint64x1_t - test_vceqzd_s64 (int64x1_t a) - { -- return vceqzd_s64 (a); -+ uint64x1_t res; -+ force_simd (a); -+ res = vceqzd_s64 (a); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmge\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 2 } } */ -@@ -47,21 +62,36 @@ - uint64x1_t - test_vcged_s64 (int64x1_t a, int64x1_t b) - { -- return vcged_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcged_s64 (a, b); -+ force_simd (res); -+ return res; - } - - uint64x1_t - test_vcled_s64 (int64x1_t a, int64x1_t b) - { -- return vcled_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcled_s64 (a, b); -+ force_simd (res); -+ return res; - } - --/* { dg-final { scan-assembler-times "\\tcmge\\td\[0-9\]+, d\[0-9\]+, #?0" 1 } } */ -+/* Idiom recognition will cause this testcase not to generate -+ the expected cmge instruction, so do not check for it. */ - - uint64x1_t - test_vcgezd_s64 (int64x1_t a) - { -- return vcgezd_s64 (a); -+ uint64x1_t res; -+ force_simd (a); -+ res = vcgezd_s64 (a); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmhs\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 1 } } */ -@@ -69,7 +99,12 @@ - uint64x1_t - test_vcged_u64 (uint64x1_t a, uint64x1_t b) - { -- return vcged_u64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcged_u64 (a, b); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmgt\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 2 } } */ -@@ -77,13 +112,23 @@ - uint64x1_t - test_vcgtd_s64 (int64x1_t a, int64x1_t b) - { -- return vcgtd_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcgtd_s64 (a, b); -+ force_simd (res); -+ return res; - } - - uint64x1_t - test_vcltd_s64 (int64x1_t a, int64x1_t b) - { -- return vcltd_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcltd_s64 (a, b); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmgt\\td\[0-9\]+, d\[0-9\]+, #?0" 1 } } */ -@@ -91,7 +136,11 @@ - uint64x1_t - test_vcgtzd_s64 (int64x1_t a) - { -- return vcgtzd_s64 (a); -+ uint64x1_t res; -+ force_simd (a); -+ res = vcgtzd_s64 (a); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmhi\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 1 } } */ -@@ -99,7 +148,12 @@ - uint64x1_t - test_vcgtd_u64 (uint64x1_t a, uint64x1_t b) - { -- return vcgtd_u64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vcgtd_u64 (a, b); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tcmle\\td\[0-9\]+, d\[0-9\]+, #?0" 1 } } */ -@@ -107,15 +161,24 @@ - uint64x1_t - test_vclezd_s64 (int64x1_t a) - { -- return vclezd_s64 (a); -+ uint64x1_t res; -+ force_simd (a); -+ res = vclezd_s64 (a); -+ force_simd (res); -+ return res; - } - --/* { dg-final { scan-assembler-times "\\tcmlt\\td\[0-9\]+, d\[0-9\]+, #?0" 1 } } */ -+/* Idiom recognition will cause this testcase not to generate -+ the expected cmlt instruction, so do not check for it. */ - - uint64x1_t - test_vcltzd_s64 (int64x1_t a) - { -- return vcltzd_s64 (a); -+ uint64x1_t res; -+ force_simd (a); -+ res = vcltzd_s64 (a); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\tdup\\tb\[0-9\]+, v\[0-9\]+\.b" 2 } } */ -@@ -179,13 +242,23 @@ - int64x1_t - test_vtst_s64 (int64x1_t a, int64x1_t b) - { -- return vtstd_s64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vtstd_s64 (a, b); -+ force_simd (res); -+ return res; - } - - uint64x1_t - test_vtst_u64 (uint64x1_t a, uint64x1_t b) - { -- return vtstd_u64 (a, b); -+ uint64x1_t res; -+ force_simd (a); -+ force_simd (b); -+ res = vtstd_s64 (a, b); -+ force_simd (res); -+ return res; - } - - /* { dg-final { scan-assembler-times "\\taddp\\td\[0-9\]+, v\[0-9\]+\.2d" 1 } } */ -@@ -722,8 +795,11 @@ - return vrshld_u64 (a, b); - } - --/* { dg-final { scan-assembler-times "\\tasr\\tx\[0-9\]+" 1 } } */ -+/* Other intrinsics can generate an asr instruction (vcltzd, vcgezd), -+ so we cannot check scan-assembler-times. */ - -+/* { dg-final { scan-assembler "\\tasr\\tx\[0-9\]+" } } */ -+ - int64x1_t - test_vshrd_n_s64 (int64x1_t a) - { -Index: gcc/testsuite/gcc.target/i386/pr59405.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59405.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59405.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,24 @@ -+/* { dg-do run } */ -+/* { dg-options "-mmmx -mfpmath=387" } */ -+ -+#include "mmx-check.h" -+ -+#include <mmintrin.h> -+ -+typedef float float32x2_t __attribute__ ((vector_size (8))); -+ -+float -+foo32x2_be (float32x2_t x) ++void NC boo_di (const __flash long long *p) +{ -+ _mm_empty (); -+ return x[1]; ++ vfun (8, *p); +} + -+static void -+mmx_test (void) ++void NC boox_di (const __memx long long *p) +{ -+ float32x2_t b = { 0.0f, 1.0f }; -+ -+ if (foo32x2_be (b) != 1.0f) -+ abort (); ++ vfun (8, *p); +} -Index: gcc/testsuite/gcc.target/i386/pr59794-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* PR target/59794 */ -+/* { dg-do compile { target { ia32 } } } */ -+/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */ -+ -+typedef int __v4si __attribute__ ((__vector_size__ (16))); + -+extern __v4si x; -+ -+__v4si -+foo (void) -+{ /* { dg-warning "SSE vector return without SSE enabled changes the ABI" } */ -+ return x; -+} -Index: gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile { target lp64 } } */ --/* { dg-options "-O2 -mavx -mabi=ms -mtune=generic -dp" } */ -+/* { dg-options "-O2 -mavx -mabi=ms -maccumulate-outgoing-args -dp" } */ - - typedef float __m256 __attribute__ ((__vector_size__ (32), __may_alias__)); - -Index: gcc/testsuite/gcc.target/i386/pr54694.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr54694.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr54694.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O" } */ ++const __flash char f_qi = 11; ++const __flash int f_hi = 2222; ++const __flash __int24 f_psi = 333333; ++const __flash long f_si = 44444444; ++const __flash long long f_di = 8888888888888888; + -+register void *hfp __asm__("%ebp"); /* { dg-message "note: for" } */ ++const __memx char x_qi = 11; ++const __memx int x_hi = 2222; ++const __memx __int24 x_psi = 333333; ++const __memx long x_si = 44444444; ++const __memx long long x_di = 8888888888888888; + -+extern void g(void *); ++char r_qi = 11; ++int r_hi = 2222; ++__int24 r_psi = 333333; ++long r_si = 44444444; ++long long r_di = 8888888888888888; + -+void f(int x) /* { dg-error "frame pointer required" } */ ++int main (void) +{ -+ g(__builtin_alloca(x)); -+} -Index: gcc/testsuite/gcc.target/i386/pr59470.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59470.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59470.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+/* PR middle-end/58956 */ -+/* PR middle-end/59470 */ -+/* { dg-do run } */ -+/* { dg-options "-O2" } */ ++ boo_qi (&f_qi); ++ boo_hi (&f_hi); ++ boo_psi (&f_psi); ++ boo_si (&f_si); ++ boo_di (&f_di); + -+int a, b, d[1024]; ++ boox_qi (&x_qi); ++ boox_hi (&x_hi); ++ boox_psi (&x_psi); ++ boox_si (&x_si); ++ boox_di (&x_di); + -+int -+main () -+{ -+ int c = a; -+ asm ("{movl $6, (%2); movl $1, %0|mov dword ptr [%2], 6; mov %0, 1}" -+ : "=r" (d[c]) : "rm" (b), "r" (&a) : "memory"); -+ if (d[0] != 1 || d[6] != 0) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.target/i386/pr59034-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59034-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59034-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+/* { dg-do compile { target { ! { ia32 } } } } */ -+/* { dg-require-effective-target maybe_x32 } */ -+/* { dg-options "-O -mx32 -mtune=corei7 -maddress-mode=short" } */ ++ boox_qi (&r_qi); ++ boox_hi (&r_hi); ++ boox_psi (&r_psi); ++ boox_si (&r_si); ++ boox_di (&r_di); + -+extern int foo(int, ...); -+int bar(void) { -+ long double l = 1.2345E6; -+ foo(0, l); -+ return 0; -+} -Index: gcc/testsuite/gcc.target/i386/pr58690.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr58690.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr58690.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-do compile { target { ! { ia32 } } } } */ -+/* { dg-require-effective-target maybe_x32 } */ -+/* { dg-options "-O2 -mx32 -maddress-mode=short" } */ -+ -+struct gomp_thread -+{ -+ char foo[41]; -+}; -+extern __thread struct gomp_thread gomp_tls_data; -+void -+foo (void) -+{ -+ __builtin_memset (&gomp_tls_data, '\0', sizeof (gomp_tls_data)); ++ exit (0); +} -Index: gcc/testsuite/gcc.target/i386/avx-vmovapd-256-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/avx-vmovapd-256-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/avx-vmovapd-256-2.c (.../branches/gcc-4_8-branch) -@@ -15,7 +15,7 @@ - avx_test (void) - { - union256d u; -- double e [4] __attribute__ ((aligned (8))) = {0.0}; -+ double e [4] __attribute__ ((aligned (32))) = {0.0}; - - u.x = _mm256_set_pd (39578.467285, 7856.342941, 85632.783567, 47563.234215); - -Index: gcc/testsuite/gcc.target/i386/pr9771-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr9771-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr9771-1.c (.../branches/gcc-4_8-branch) -@@ -45,7 +45,17 @@ - exit(0); - } - --int main() -+/* main usually performs dynamic realignment of the stack in case -+ _start would fail to properly align the stack, but for dynamic -+ stack realignment we need frame pointer which is incompatible -+ with -ffixed-ebp and the global register var. So, cheat here -+ and hide from the compiler that main is really main. */ -+#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) -+#define ASMNAME2(prefix, cname) STRING (prefix) cname -+#define STRING(x) #x -+int real_main() __asm (ASMNAME ("main")); -+ -+int real_main() - { - test(); - return 0; -Index: gcc/testsuite/gcc.target/i386/pr60700.c +Index: gcc/testsuite/gcc.target/i386/pr61423.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr60700.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr60700.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,59 @@ -+/* PR rtl-optimization/60700 */ +--- a/src/gcc/testsuite/gcc.target/i386/pr61423.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr61423.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,38 @@ ++/* PR target/61423 */ +/* { dg-do run { target ia32 } } */ -+/* { dg-options "-O3 -march=i686" } */ -+ -+int -+__attribute__((noinline)) -+foo (void) -+{ -+ return 0; -+} ++/* { dg-options "-O1 -ftree-vectorize -msse2 -mfpmath=387 -mtune=core2" } */ + -+void *g = (void *)1; ++#define N 1024 ++static unsigned int A[N]; + -+struct st { -+ char data[36]; /* must be greater than 32. */ -+}; -+ -+int ++double +__attribute__((noinline)) -+repro(struct st **out) ++func (void) +{ -+ int status = 0; -+ -+ *out = 0; -+ -+ status = foo(); -+ if (status != 0) { -+ return status; -+ } -+ -+ if (0 == g) { -+ status = 999; -+ return status; -+ } -+ -+ *out = (struct st *)__builtin_malloc(sizeof(struct st)); -+ if (0 == *out) { -+ status = 42; -+ return status; -+ } ++ unsigned int sum = 0; ++ unsigned i; ++ double t; + -+ __builtin_memset(*out, 0, sizeof(struct st)); ++ for (i = 0; i < N; i++) ++ sum += A[i]; + -+ return status; ++ t = sum; ++ return t; +} + +int +main () +{ -+ struct st *p; -+ int ret = repro (&p); -+ unsigned int i; -+ -+ for (i = 0; i < sizeof (p->data)/sizeof (p->data[0]); i++) -+ if (p->data[i] != 0) -+ __builtin_abort (); -+ -+ return ret; -+} -Index: gcc/testsuite/gcc.target/i386/pr59794-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* PR target/59794 */ -+/* { dg-prune-output "ABI for passing parameters" } */ -+/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */ ++ unsigned i; ++ double d; + -+typedef double __v2df __attribute__ ((__vector_size__ (16))); ++ for(i = 0; i < N; i++) ++ A[i] = 1; + -+extern __v2df x; ++ d = func(); + -+extern void bar (__v2df); -+void -+foo (void) -+{ -+ bar (x); /* { dg-message "warning: SSE vector argument without SSE enabled changes the ABI" } */ -+} -Index: gcc/testsuite/gcc.target/i386/pr57003.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr57003.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr57003.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* PR rtl-optimization/57003 */ - /* { dg-do run } */ --/* { dg-options "-O2" } */ -+/* { dg-options "-O2 -maccumulate-outgoing-args" } */ - - #define N 2001 - unsigned short *b, *c, *d; -Index: gcc/testsuite/gcc.target/i386/pr59929.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59929.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59929.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,55 @@ -+/* { dg-do run } */ -+/* { dg-options "-O0 -mno-accumulate-outgoing-args" } */ -+/* { dg-options "-O0 -mno-accumulate-outgoing-args -mx32 -maddress-mode=short" { target x32 } } */ -+ -+void -+__attribute__ ((noinline)) -+test (float x1, float x2, float x3, float x4, float x5, float x6, -+ float x7, float x8, float x9, float x10, float x11, float x12, -+ float x13, float x14, float x15, float x16) -+{ -+ if (x1 != 91 -+ || x2 != 92 -+ || x3 != 93 -+ || x4 != 94 -+ || x5 != 95 -+ || x6 != 96 -+ || x7 != 97 -+ || x8 != 98 -+ || x9 != 99 -+ || x10 != 100 -+ || x11 != 101 -+ || x12 != 102 -+ || x13 != 103 -+ || x14 != 104 -+ || x15 != 105 -+ || x16 != 106) ++ if (d != 1024.0) + __builtin_abort (); -+} -+ -+float x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, -+ x14, x15, x16; + -+int -+main () -+{ -+ x1 = 91; -+ x2 = 92; -+ x3 = 93; -+ x4 = 94; -+ x5 = 95; -+ x6 = 96; -+ x7 = 97; -+ x8 = 98; -+ x9 = 99; -+ x10 = 100; -+ x11 = 101; -+ x12 = 102; -+ x13 = 103; -+ x14 = 104; -+ x15 = 105; -+ x16 = 106; -+ test (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, -+ x14, x15, x16); + return 0; +} -Index: gcc/testsuite/gcc.target/i386/pr59794-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* PR target/59794 */ -+/* { dg-do compile { target { ! ia32 } } } */ -+/* { dg-options "-O2 -mno-sse" } */ -+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */ -+ -+typedef int __v4si __attribute__ ((__vector_size__ (16))); -+ -+extern __v4si x; -+ -+__v4si -+foo (void) -+{ /* { dg-error "SSE register return with SSE disabled" } */ -+ return x; -+} -Index: gcc/testsuite/gcc.target/i386/avx-vzeroupper-18.c +Index: gcc/testsuite/gcc.target/i386/pr60901.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-18.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-18.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile { target lp64 } } */ --/* { dg-options "-O0 -mavx -mabi=ms -mtune=generic -dp" } */ -+/* { dg-options "-O0 -mavx -mabi=ms -maccumulate-outgoing-args -dp" } */ - - typedef float __m256 __attribute__ ((__vector_size__ (32), __may_alias__)); - -Index: gcc/testsuite/gcc.target/i386/sse2-movapd-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/sse2-movapd-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/sse2-movapd-1.c (.../branches/gcc-4_8-branch) -@@ -25,7 +25,7 @@ - TEST (void) - { - union128d u; -- double e[2] __attribute__ ((aligned (8))) = {2134.3343,1234.635654}; -+ double e[2] __attribute__ ((aligned (16))) = {2134.3343,1234.635654}; - - u.x = test (e); - -Index: gcc/testsuite/gcc.target/i386/pr59021.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59021.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59021.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mavx -mvzeroupper" } */ -+ -+extern void abort (void); -+ -+struct S { -+ int i1; -+ int i2; -+ int i3; -+}; -+ -+typedef double v4df __attribute__ ((vector_size (32))); -+ -+extern int foo (v4df, int i1, int i2, int i3, int i4, int i5, struct S s); -+ -+void bar (v4df v, struct S s) -+{ -+ int r = foo (v, 1, 2, 3, 4, 5, s); -+ if (r) -+ abort (); -+} -+ -+/* { dg-final { scan-assembler-not "vzeroupper" } } */ -Index: gcc/testsuite/gcc.target/i386/pr59034-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59034-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59034-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+/* { dg-do compile { target { ! { ia32 } } } } */ -+/* { dg-require-effective-target maybe_x32 } */ -+/* { dg-options "-O -mx32 -mtune=corei7 -maddress-mode=long" } */ -+ -+extern int foo(int, ...); -+int bar(void) { -+ long double l = 1.2345E6; -+ foo(0, l); -+ return 0; -+} -Index: gcc/testsuite/gcc.target/i386/pr59794-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* PR target/59794 */ -+/* { dg-prune-output "ABI for passing parameters" } */ -+/* { dg-options "-O2 -mno-avx" } */ -+/* { dg-skip-if "no AVX vector" { *-*-mingw* } } */ -+ -+typedef int __v8si __attribute__ ((__vector_size__ (32))); +--- a/src/gcc/testsuite/gcc.target/i386/pr60901.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr60901.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,17 @@ ++/* { dg-options "-O -fselective-scheduling -fschedule-insns -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-tree-dominator-opts" } */ + -+extern __v8si x; ++extern int n; ++extern void bar (void); ++extern int baz (int); + -+extern void bar (__v8si); +void +foo (void) +{ -+ bar (x); /* { dg-message "warning: AVX vector argument without AVX enabled changes the ABI" } */ -+} -Index: gcc/testsuite/gcc.target/i386/pr59839.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59839.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59839.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+/* PR target/59839 */ -+/* { dg-do compile } */ -+/* { dg-options "-O0 -mavx2" } */ -+ -+#include <x86intrin.h> -+ -+void -+test (const float *x) -+{ -+ __m256i i = _mm256_set1_epi32 (1); -+ __m256 d = _mm256_i32gather_ps (x, i, 1); -+} -Index: gcc/testsuite/gcc.target/i386/xop-frczX.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/xop-frczX.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/xop-frczX.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,60 @@ -+/* { dg-do run } */ -+/* { dg-require-effective-target xop } */ -+/* { dg-options "-O2 -mxop" } */ -+ -+#include "xop-check.h" -+ -+#include <x86intrin.h> -+ -+void -+check_mm_vmfrcz_sd (__m128d __A, __m128d __B) -+{ -+ union128d a, b, c; -+ double d[2]; -+ -+ a.x = __A; -+ b.x = __B; -+ c.x = _mm_frcz_sd (__A, __B); -+ d[0] = b.a[0] - (int)b.a[0] ; -+ d[1] = a.a[1]; -+ if (check_union128d (c, d)) -+ abort (); -+} -+ -+void -+check_mm_vmfrcz_ss (__m128 __A, __m128 __B) -+{ -+ union128 a, b, c; -+ float f[4]; -+ -+ a.x = __A; -+ b.x = __B; -+ c.x = _mm_frcz_ss (__A, __B); -+ f[0] = b.a[0] - (int)b.a[0] ; -+ f[1] = a.a[1]; -+ f[2] = a.a[2]; -+ f[3] = a.a[3]; -+ if (check_union128 (c, f)) -+ abort (); -+} -+ -+static void -+xop_test (void) -+{ -+ union128 a, b; -+ union128d c,d; -+ int i; -+ -+ for (i = 0; i < 4; i++) -+ { -+ a.a[i] = i + 3.5; -+ b.a[i] = i + 7.9; -+ } -+ for (i = 0; i < 2; i++) ++ int i, j; ++ for (j = 0; j < n; j++) + { -+ c.a[i] = i + 3.5; -+ d.a[i] = i + 7.987654321; ++ for (i = 1; i < j; i++) ++ bar (); ++ baz (0); + } -+ check_mm_vmfrcz_ss (a.x, b.x); -+ check_mm_vmfrcz_sd (c.x, d.x); -+} -Index: gcc/testsuite/gcc.target/i386/pr59794-7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* PR target/59794 */ -+/* { dg-options "-O2 -mno-avx" } */ -+/* { dg-skip-if "no AVX vector" { *-*-mingw* } } */ -+ -+typedef int __v8si __attribute__ ((__vector_size__ (32))); -+ -+extern __v8si x; -+ -+__v8si -+foo (void) -+{ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" } */ -+ return x; -+} -Index: gcc/testsuite/gcc.target/i386/pr59625.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59625.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59625.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,36 @@ -+/* PR target/59625 */ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mtune=atom" } */ -+ -+int -+foo (void) -+{ -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ asm goto ("" : : : : lab); -+ return 0; -+lab: -+ return 1; -+} -+ -+/* Verify we don't consider asm goto as a jump for four jumps limit -+ optimization. asm goto doesn't have to contain a jump at all, -+ the branching to labels can happen through different means. */ -+/* { dg-final { scan-assembler-not "(p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*){8}p2align" } } */ -Index: gcc/testsuite/gcc.target/i386/sse2-movapd-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/sse2-movapd-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/sse2-movapd-2.c (.../branches/gcc-4_8-branch) -@@ -25,7 +25,7 @@ - TEST (void) - { - union128d u; -- double e[2] __attribute__ ((aligned (8))) = {0.0}; -+ double e[2] __attribute__ ((aligned (16))) = {0.0}; - - u.x = _mm_set_pd (2134.3343,1234.635654); - -Index: gcc/testsuite/gcc.target/i386/sse-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/sse-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/sse-5.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,7 @@ - /* { dg-do compile } */ - /* { dg-require-effective-target ia32 } */ --/* { dg-options "-Winline -Wno-psabi -O2 -mno-sse" } */ -+/* { dg-prune-output "ABI for passing parameters" } */ -+/* { dg-options "-Winline -O2 -mno-sse" } */ - - typedef double v2df __attribute__ ((vector_size (16))); - v2df p; -Index: gcc/testsuite/gcc.target/i386/pr39162.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr39162.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr39162.c (.../branches/gcc-4_8-branch) -@@ -1,11 +1,14 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -Wno-psabi -msse2 -mno-avx" } */ -+/* { dg-prune-output "ABI for passing parameters" } */ -+/* { dg-options "-O2 -msse2 -mno-avx" } */ - /* { dg-additional-options "-mabi=sysv" { target x86_64-*-mingw* } } */ - - typedef long long __m256i __attribute__ ((__vector_size__ (32), __may_alias__)); - --__m256i -+extern __m256i y; -+ -+void - bar (__m256i x) /* { dg-warning "AVX" "" } */ - { -- return x; -+ y = x; - } -Index: gcc/testsuite/gcc.target/i386/pr58137.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr58137.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr58137.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O3 -mavx2" } */ -+ -+typedef unsigned int U32; -+ -+struct sv { -+ void* sv_any; -+ U32 sv_refcnt; -+ U32 sv_flags; -+}; -+typedef struct sv SV; -+ -+struct xrv { -+ SV * xrv_rv; -+}; -+typedef struct xrv XRV; -+ -+extern XRV * PL_xrv_root; -+ -+void -+more_xrv (void) -+{ -+ register XRV* xrv; -+ register XRV* xrvend; -+ xrv = PL_xrv_root; -+ xrvend = &xrv[200 / sizeof (XRV) - 1]; -+ while (xrv < xrvend) -+ { -+ xrv->xrv_rv = (SV*)(xrv + 1); -+ xrv++; -+ } -+ xrv->xrv_rv = 0; -+} -Index: gcc/testsuite/gcc.target/i386/pr59794-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* PR target/59794 */ -+/* { dg-do compile { target { ia32 } } } */ -+/* { dg-options "-O2 -mno-mmx" } */ -+/* { dg-skip-if "no MMX vector" { *-*-mingw* } } */ -+ -+typedef int __v2si __attribute__ ((__vector_size__ (8))); -+ -+extern __v2si x; -+ -+__v2si -+foo (void) -+{ /* { dg-warning "MMX vector return without MMX enabled changes the ABI" } */ -+ return x; +} -Index: gcc/testsuite/gcc.target/i386/avx-vzeroupper-16.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-16.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/avx-vzeroupper-16.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile { target lp64 } } */ --/* { dg-options "-O2 -mavx -mabi=ms -mtune=generic -dp" } */ -+/* { dg-options "-O2 -mavx -mabi=ms -maccumulate-outgoing-args -dp" } */ - - typedef float __m256 __attribute__ ((__vector_size__ (32), __may_alias__)); - -Index: gcc/testsuite/gcc.target/i386/pr30315.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr30315.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr30315.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* { dg-do compile } */ - /* { dg-options "-O2" } */ --/* { dg-final { scan-assembler-times "cmp" 4 } } */ -+/* { dg-final { scan-assembler-not "cmp" } } */ - - extern void abort (void); - int c; -@@ -34,39 +34,10 @@ - } - #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b) - --#define MINUSCC(T, t) \ --T minuscc##t (T a, T b) \ --{ \ -- T difference = a - b; \ -- if (difference > a) \ -- abort (); \ -- return difference; \ --} -- --#define DECCC(T, t) \ --T deccc##t (T a, T b) \ --{ \ -- T difference = a - b; \ -- if (difference > a) \ -- c --; \ -- return difference; \ --} -- --#define MINUSCCONLY(T, t) \ --void minuscconly##t (T a, T b) \ --{ \ -- T difference = a - b; \ -- if (difference > a) \ -- abort (); \ --} -- - #define TEST(T, t) \ - PLUSCC(T, t) \ - PLUSCCONLY(T, t) \ -- INCCC(T, t) \ -- MINUSCC(T, t) \ -- MINUSCCONLY(T, t) \ -- DECCC(T, t) -+ INCCC(T, t) - - TEST (unsigned long, l) - TEST (unsigned int, i) -@@ -84,14 +55,3 @@ - - PLUSCCZEXT(a) - PLUSCCZEXT(b) -- --#define MINUSCCZEXT \ --unsigned long minuscczext (unsigned int a, unsigned int b) \ --{ \ -- unsigned int difference = a - b; \ -- if (difference > a) \ -- abort (); \ -- return difference; \ --} -- --MINUSCCZEXT -Index: gcc/testsuite/gcc.target/i386/pr43869.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr43869.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr43869.c (.../branches/gcc-4_8-branch) -@@ -1,4 +1,5 @@ - /* { dg-do compile { target lp64 } } */ -+/* { dg-options "-maccumulate-outgoing-args" } */ - - int __attribute__((__noinline__)) - bugged(float f1, float f2, float f3, float f4, -Index: gcc/testsuite/gcc.target/i386/pr43546.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr43546.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr43546.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+/* PR target/43546 */ -+/* { dg-do compile } */ -+/* { dg-options "-O1" } */ -+/* { dg-additional-options "-mpreferred-stack-boundary=2 -msseregparm -msse" { target ia32 } } */ -+ -+extern void bar (double); -+ -+void -+foo (void) -+{ -+ bar (1.0); -+} -Index: gcc/testsuite/gcc.target/i386/pr43662.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr43662.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr43662.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile { target lp64 } } */ --/* { dg-options "-O2" } */ -+/* { dg-options "-O2 -maccumulate-outgoing-args" } */ - - void __attribute__ ((ms_abi)) foo (void) - { -Index: gcc/testsuite/gcc.target/i386/avx-vmovapd-256-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/avx-vmovapd-256-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/avx-vmovapd-256-1.c (.../branches/gcc-4_8-branch) -@@ -15,7 +15,7 @@ - avx_test (void) - { - union256d u; -- double e [4] __attribute__ ((aligned (8))) = {41124.234,2344.2354,8653.65635,856.43576}; -+ double e [4] __attribute__ ((aligned (32))) = {41124.234,2344.2354,8653.65635,856.43576}; - - u.x = test (e); - -Index: gcc/testsuite/gcc.target/i386/nest-1.c +Index: gcc/testsuite/gcc.target/i386/pr61446.c =================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/nest-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/nest-1.c (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/gcc.target/i386/pr61446.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr61446.c (.../branches/gcc-4_8-branch) @@ -0,0 +1,14 @@ -+/* { dg-do compile { target llp64 } } */ -+/* { dg-options "" } */ ++/* PR rtl-optimization/61446 */ + -+void foo (int i) -+{ -+ void nested (void) -+ { -+ char arr[(1U << 31) + 4U]; -+ arr[i] = 0; -+ } -+ -+ nested (); -+} -+ -Index: gcc/testsuite/gcc.target/i386/pr59794-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/i386/pr59794-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/i386/pr59794-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* PR target/59794 */ +/* { dg-do compile { target { ia32 } } } */ -+/* { dg-options "-O2 -mno-mmx" } */ -+/* { dg-skip-if "no MMX vector" { *-*-mingw* } } */ -+ -+typedef int __v2si __attribute__ ((__vector_size__ (8))); -+ -+extern __v2si x; -+ -+extern void bar (__v2si); -+void -+foo (void) -+{ -+ bar (x); /* { dg-message "warning: MMX vector argument without MMX enabled changes the ABI" } */ -+} -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c (.../branches/gcc-4_8-branch) -@@ -1,7 +1,7 @@ - /* Test for cross x86_64<->w64 abi standard calls. - */ - /* { dg-do compile } */ --/* { dg-options "-mno-sse" } */ -+/* { dg-options "-mno-sse -maccumulate-outgoing-args" } */ - #include "callabi.h" - - long double -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c (.../branches/gcc-4_8-branch) -@@ -2,7 +2,7 @@ - */ - /* Origin: Kai Tietz <kai.tietz@onevision.com> */ - /* { dg-do run } */ --/* { dg-options "-std=gnu99" } */ -+/* { dg-options "-std=gnu99 -maccumulate-outgoing-args" } */ - #include "callabi.h" - - extern __SIZE_TYPE__ strlen (const char *); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c (.../branches/gcc-4_8-branch) -@@ -2,7 +2,7 @@ - */ - /* Origin: Kai Tietz <kai.tietz@onevision.com> */ - /* { dg-do run } */ --/* { dg-options "-std=gnu99" } */ -+/* { dg-options "-std=gnu99 -maccumulate-outgoing-args" } */ - #include "callabi.h" - - extern void abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c (.../branches/gcc-4_8-branch) -@@ -2,7 +2,7 @@ - */ - /* Origin: Kai Tietz <kai.tietz@onevision.com> */ - /* { dg-do run } */ --/* { dg-options "-std=gnu99" } */ -+/* { dg-options "-std=gnu99 -maccumulate-outgoing-args" } */ - #include "callabi.h" - - extern void abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* Test for cross x86_64<->w64 abi va_list calls. */ - /* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin -maccumulate-outgoing-args" } */ - /* { dg-additional-sources "vaarg-4b.c" } */ - - extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* Test for cross x86_64<->w64 abi va_list calls. */ - /* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin -maccumulate-outgoing-args" } */ - /* { dg-additional-sources "vaarg-5b.c" } */ - - extern void __attribute__ ((sysv_abi)) abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Test for cross x86_64<->w64 abi va_list calls. */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin -maccumulate-outgoing-args" } */ - - #include <stdarg.h> - -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Test for cross x86_64<->w64 abi va_list calls. */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin -maccumulate-outgoing-args" } */ - - #include <stdarg.h> - -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mabi=sysv" } */ -+/* { dg-options "-O2 -mabi=sysv -maccumulate-outgoing-args" } */ - - __attribute__ ((ms_abi)) - int foo (void) -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mabi=sysv" } */ -+/* { dg-options "-O2 -mabi=sysv -maccumulate-outgoing-args" } */ - - extern int glb1, gbl2, gbl3; - -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c (.../branches/gcc-4_8-branch) -@@ -2,7 +2,7 @@ - */ - /* Origin: Kai Tietz <kai.tietz@onevision.com> */ - /* { dg-do run } */ --/* { dg-options "-std=gnu99 -ffast-math" } */ -+/* { dg-options "-std=gnu99 -ffast-math -maccumulate-outgoing-args" } */ - #include "callabi.h" - - extern void abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* Test for cross x86_64<->w64 abi standard calls via variable. */ - /* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin -maccumulate-outgoing-args" } */ - /* { dg-additional-sources "func-indirect-2b.c" } */ - - extern void __attribute__ ((sysv_abi)) abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c (.../branches/gcc-4_8-branch) -@@ -2,7 +2,7 @@ - */ - /* Origin: Kai Tietz <kai.tietz@onevision.com> */ - /* { dg-do run } */ --/* { dg-options "-std=gnu99 -ffast-math" } */ -+/* { dg-options "-std=gnu99 -ffast-math -maccumulate-outgoing-args" } */ - #include "callabi.h" - - extern void abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - /* Test for cross x86_64<->w64 abi standard calls. */ - /* { dg-do run { target i?86-*-linux* x86_64-*-linux* } } */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin -maccumulate-outgoing-args" } */ - /* { dg-additional-sources "func-2b.c" } */ - - extern void __attribute__ ((sysv_abi)) abort (void); -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Test for cross x86_64<->w64 abi standard calls via variable. */ --/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ -+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin -maccumulate-outgoing-args" } */ - - typedef int (*func)(void *, char *, char *, short, long long); - -Index: gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Test for cross x86_64<->w64 abi standard calls. */ --/* { dg-options "-mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */ -+/* { dg-options "-mabi=ms -std=gnu99 -ffast-math -fno-builtin -maccumulate-outgoing-args" } */ - - long double func_cross (long double a, double b, float c, long d, int e, - char f) -Index: gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c (.../branches/gcc-4_8-branch) -@@ -1,37 +0,0 @@ --/* This checks the availability of the XL compiler intrinsics for -- transactional execution with the expected prototypes. */ -- --/* { dg-do compile } */ --/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -- --#include <htmxlintrin.h> -- --int a = 0; --unsigned long g; -- --int --foo () --{ -- struct __htm_tdb *tdb_struct; -- void * const tdb = tdb_struct; -- long result; -- unsigned char code; -- -- result = __TM_simple_begin (); -- result = __TM_begin (tdb); -- result = __TM_end (); -- __TM_abort (); -- __TM_named_abort (42); -- __TM_non_transactional_store (&g, 42); -- result = __TM_nesting_depth (tdb); -- -- result = __TM_is_user_abort (tdb); -- result = __TM_is_named_user_abort (tdb, &code); -- result = __TM_is_illegal (tdb); -- result = __TM_is_footprint_exceeded (tdb); -- result = __TM_is_nested_too_deep (tdb); -- result = __TM_is_conflict (tdb); -- result = __TM_is_failure_persistent (result); -- result = __TM_failure_address (tdb); -- result = __TM_failure_code (tdb); --} -Index: gcc/testsuite/gcc.target/s390/htm-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-1.c (.../branches/gcc-4_8-branch) -@@ -1,73 +0,0 @@ --/* This checks the availability of the low-level builtins introduced -- for transactional execution. */ -- --/* { dg-do compile } */ --/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -- --#include <stdint.h> --#include <htmintrin.h> -- --int global = 0; --uint64_t g; --struct __htm_tdb global_tdb; -- --int --foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t *mem64) --{ -- -- int cc; -- int n; -- -- cc = __builtin_tbegin (0); -- cc = __builtin_tbegin (tdb); -- cc = __builtin_tbegin (&global_tdb); -- -- cc = __builtin_tbegin_nofloat (0); -- cc = __builtin_tbegin_nofloat (&global_tdb); -- -- cc = __builtin_tbegin_retry (0, 42); -- cc = __builtin_tbegin_retry (0, reg); -- cc = __builtin_tbegin_retry (0, *mem); -- cc = __builtin_tbegin_retry (0, global); -- cc = __builtin_tbegin_retry (tdb, 42); -- cc = __builtin_tbegin_retry (&global_tdb, 42); -- -- cc = __builtin_tbegin_retry_nofloat (0, 42); -- cc = __builtin_tbegin_retry_nofloat (0, reg); -- cc = __builtin_tbegin_retry_nofloat (0, *mem); -- cc = __builtin_tbegin_retry_nofloat (0, global); -- cc = __builtin_tbegin_retry_nofloat (&global_tdb, 42); -- -- __builtin_tbeginc (); -- -- n = __builtin_tx_nesting_depth(); -- -- __builtin_non_tx_store(&g, 23); -- __builtin_non_tx_store(mem64, 23); -- __builtin_non_tx_store(&g, reg); -- __builtin_non_tx_store(&g, *mem); -- __builtin_non_tx_store(&g, global); -- -- __builtin_tabort (42 + 255); -- __builtin_tabort (reg); -- /* { dg-final { scan-assembler-times "tabort\t255" 1 } } */ -- __builtin_tabort (reg + 255); -- __builtin_tabort (*mem); -- __builtin_tabort (global); -- /* Here global + 255 gets reloaded into a reg. Better would be to -- just reload global or *mem and get the +255 for free as address -- arithmetic. */ -- __builtin_tabort (*mem + 255); -- __builtin_tabort (global + 255); -- -- __builtin_tend(); -- -- __builtin_tx_assist (23); -- __builtin_tx_assist (reg); -- __builtin_tx_assist (*mem); -- __builtin_tx_assist (global); --} -- --/* Make sure the tdb NULL argument ends up as immediate value in the -- instruction. */ --/* { dg-final { scan-assembler-times "tbegin\t0," 10 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,27 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+inline void hp2(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((always_inline)) -+void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+int main (void) -+{ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,27 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=0" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+inline void hp2(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((always_inline)) -+void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+int main (void) -+{ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,27 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=1" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+inline void hp2(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((always_inline)) -+void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+int main (void) -+{ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do compile } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=-1" } */ -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,28 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do compile } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=1000000" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(1000000))) -+void hp2(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(1000001))) -+void hp3(void) -+{ /* { dg-error "requested 'hotpatch' attribute is not a non-negative integer constant or too large .max. 1000000." } */ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do compile } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=1000001" } */ -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* { dg-excess-errors "argument to '-mhotpatch=' is too large .max. 1000000." } */ -Index: gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,165 @@ -+/* This checks the availability of the low-level builtins introduced -+ for transactional execution. */ -+ -+/* { dg-do compile } */ -+/* { dg-require-effective-target htm } */ -+/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -+ -+#include <stdint.h> -+#include <htmintrin.h> -+ -+int global = 0; -+uint64_t g; -+struct __htm_tdb global_tdb; -+ -+int -+foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t *mem64) -+{ -+ -+ int cc; -+ int n; -+ -+ __builtin_tbegin ((void *)0); -+ __builtin_tbegin ((void *)-99999); -+ __builtin_tbegin ((void *)99999); -+ while (__builtin_tbegin ((void *)0) != 0) -+ { -+ } -+ cc = __builtin_tbegin ((void *)0x12345678); -+ cc = __builtin_tbegin (tdb); -+ cc = __builtin_tbegin (&global_tdb); -+ cc = __builtin_tbegin ((void *)(long long)(reg + 0x12345678)); -+ cc = __builtin_tbegin ((void *)(long long)(reg)); -+ -+ __builtin_tbegin_nofloat ((void *)0); -+ __builtin_tbegin_nofloat ((void *)-99999); -+ __builtin_tbegin_nofloat ((void *)99999); -+ cc = __builtin_tbegin_nofloat ((void *)0x12345678); -+ cc = __builtin_tbegin_nofloat (tdb); -+ cc = __builtin_tbegin_nofloat (&global_tdb); -+ cc = __builtin_tbegin_nofloat ((void *)(long long)(reg + 0x12345678)); -+ cc = __builtin_tbegin_nofloat ((void *)(long long)(reg)); -+ -+ __builtin_tbegin_retry ((void *)0, 0); -+ cc = __builtin_tbegin_retry ((void *)0, 1); -+ cc = __builtin_tbegin_retry ((void *)0, -1); -+ cc = __builtin_tbegin_retry ((void *)0, 42); -+ cc = __builtin_tbegin_retry ((void *)0, reg); -+ cc = __builtin_tbegin_retry ((void *)0, *mem); -+ cc = __builtin_tbegin_retry ((void *)0, global); -+ cc = __builtin_tbegin_retry (tdb, 42); -+ cc = __builtin_tbegin_retry (&global_tdb, 42); -+ cc = __builtin_tbegin_retry ((void *)0x12345678, global); -+ cc = __builtin_tbegin_retry ( -+ (void *)(long long) (reg + 0x12345678), global + 1); -+ cc = __builtin_tbegin_retry ( -+ (void *)(long long)(reg), global - 1); -+ -+ __builtin_tbegin_retry_nofloat ((void *)0, 0); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, 1); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, -1); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, 42); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, reg); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, *mem); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0, global); -+ cc = __builtin_tbegin_retry_nofloat (tdb, 42); -+ cc = __builtin_tbegin_retry_nofloat (&global_tdb, 42); -+ cc = __builtin_tbegin_retry_nofloat ((void *)0x12345678, global); -+ cc = __builtin_tbegin_retry_nofloat ( -+ (void *)(long long) (reg + 0x12345678), global + 1); -+ cc = __builtin_tbegin_retry_nofloat ( -+ (void *)(long long)(reg), global - 1); -+ -+ __builtin_tbeginc (); -+ -+ __builtin_tx_nesting_depth (); -+ n = __builtin_tx_nesting_depth (); -+ -+ __builtin_non_tx_store (mem64, 0); -+ { -+ const uint64_t val_var = 0x1122334455667788; -+ -+ __builtin_non_tx_store (mem64, val_var); -+ } -+ __builtin_non_tx_store (mem64, (uint64_t)reg); -+ __builtin_non_tx_store (mem64, g); -+ __builtin_non_tx_store ((uint64_t *)0, 0); -+ __builtin_non_tx_store ((uint64_t *)0x12345678, 0); -+ __builtin_non_tx_store (&g, 23); -+ __builtin_non_tx_store (&g, reg); -+ __builtin_non_tx_store (&g, *mem); -+ __builtin_non_tx_store (&g, global); -+ -+ __builtin_tend(); -+ -+ __builtin_tx_assist (0); -+ __builtin_tx_assist (1); -+ __builtin_tx_assist (reg); -+ __builtin_tx_assist (*mem); -+ __builtin_tx_assist (global); -+} -+ -+/* The taborts must go into separate function since they are -+ "noreturn". */ -+ -+void -+tabort1 () -+{ -+ __builtin_tabort (256); -+} -+ -+void -+tabort2 (int reg) -+{ -+ __builtin_tabort (reg); -+} -+ -+void -+tabort3 (int reg) -+{ -+ /* { dg-final { scan-assembler-times "tabort\t255" 1 } } */ -+ __builtin_tabort (reg + 255); -+} -+ -+void -+tabort4 (int *mem) -+{ -+ __builtin_tabort (*mem); -+} -+ -+void -+tabort5 () -+{ -+ __builtin_tabort (global); -+} -+ -+void -+tabort6 (int *mem) -+{ -+ /* Here global + 255 gets reloaded into a reg. Better would be to -+ just reload global or *mem and get the +255 for free as address -+ arithmetic. */ -+ __builtin_tabort (*mem + 255); -+} -+ -+void -+tabort7 () -+{ -+ __builtin_tabort (global + 255); -+} -+ -+void -+tabort8 () -+{ -+ __builtin_tabort (-1); -+} -+ -+ -+/* Make sure the tdb NULL argument ends up as immediate value in the -+ instruction. */ -+/* { dg-final { scan-assembler-times "tbegin\t0," 17 } } */ -+/* { dg-final { scan-assembler-times "tbegin\t" 41 } } */ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "tbeginc\t" 1 } } */ -+/* { dg-final { scan-assembler-times "tabort\t" 8 } } */ -+/* { dg-final { scan-assembler "ppa\t" } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,68 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mno-hotpatch" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch)) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch)) -+inline void hp2(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch)) -+__attribute__ ((always_inline)) -+void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+__attribute__ ((hotpatch(0))) -+void hp4(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(0))) -+inline void hp5(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(0))) -+__attribute__ ((always_inline)) -+void hp6(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp6' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+__attribute__ ((hotpatch(1))) -+void hp7(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(1))) -+inline void hp8(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch(1))) -+__attribute__ ((always_inline)) -+void hp9(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp9' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+int main (void) -+{ -+ return 0; -+} -Index: gcc/testsuite/gcc.target/s390/htm-builtins-compile-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* { dg-do compile } */ -+/* { dg-require-effective-target htm } */ -+/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -+ -+void must_not_compile1 (void) -+{ -+ __builtin_tabort (0); /* { dg-error "Invalid transaction abort code:" } */ -+} -+ -+void must_not_compile2 (void) -+{ -+ __builtin_tabort (255); /* { dg-error "Invalid transaction abort code:" } */ -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,23 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch" } */ -+ -+#include <stdio.h> -+ -+int hp1(void) -+{ -+ int nested1(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */ -+ { return 1; } -+ -+ __attribute__ ((hotpatch)) -+ int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */ -+ { return 1; } -+ -+ return nested1() - nested2(); -+} -+ -+int main (void) -+{ -+ return hp1(); -+} -Index: gcc/testsuite/gcc.target/s390/htm-builtins-compile-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-builtins-compile-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* This checks the availability of the XL compiler intrinsics for -+ transactional execution with the expected prototypes. */ -+ -+/* { dg-do compile } */ -+/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -+ -+#include <htmxlintrin.h> -+ -+int a = 0; -+unsigned long g; -+ -+int -+foo () -+{ -+ struct __htm_tdb *tdb_struct; -+ void * const tdb = tdb_struct; -+ long result; -+ unsigned char code; -+ -+ result = __TM_simple_begin (); -+ result = __TM_begin (tdb); -+ result = __TM_end (); -+ __TM_abort (); -+ __TM_named_abort (42); -+ __TM_non_transactional_store (&g, 42); -+ result = __TM_nesting_depth (tdb); -+ -+ result = __TM_is_user_abort (tdb); -+ result = __TM_is_named_user_abort (tdb, &code); -+ result = __TM_is_illegal (tdb); -+ result = __TM_is_footprint_exceeded (tdb); -+ result = __TM_is_nested_too_deep (tdb); -+ result = __TM_is_conflict (tdb); -+ result = __TM_is_failure_persistent (result); -+ result = __TM_failure_address (tdb); -+ result = __TM_failure_code (tdb); -+} -Index: gcc/testsuite/gcc.target/s390/s390.exp -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/s390.exp (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/s390.exp (.../branches/gcc-4_8-branch) -@@ -24,6 +24,19 @@ - # Load support procs. - load_lib gcc-dg.exp - -+# Return 1 if htm (etnd - extract nesting depth) instructions can be -+# compiled. -+proc check_effective_target_htm { } { -+ if { ![check_runtime s390_check_htm [subst { -+ int main (void) -+ { -+ unsigned int nd = 77; -+ asm (".insn rre,0xb2ec0000,%0,0" : "=d" (nd)); -+ return nd; -+ } -+ }]] } { return 0 } else { return 1 } -+} -+ - # If a testcase doesn't have special options, use these. - global DEFAULT_CFLAGS - if ![info exists DEFAULT_CFLAGS] then { -Index: gcc/testsuite/gcc.target/s390/hotpatch-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=0 --save-temps" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,26 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+inline void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((always_inline)) -+void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */ ++/* { dg-options "-O2 -march=corei7 -mfpmath=387" } */ + -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -+/* { dg-final { scan-assembler-not "nop\t0" } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch)) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch(1))) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/htm-builtins-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-builtins-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-builtins-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,1073 @@ -+/* Functional tests of the htm __builtin_... macros. */ -+ -+/* { dg-do run } */ -+/* { dg-require-effective-target htm } */ -+/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -+ -+/* ---------------------------- included header files ---------------------- */ -+ -+#include <stdio.h> -+#include <string.h> -+#include <stdint.h> -+#include <htmintrin.h> -+ -+/* ---------------------------- local definitions -------------------------- */ -+ -+#define DEFAULT_MAX_REPETITIONS 5 -+#define DEFAULT_REQUIRED_QUORUM ((DEFAULT_MAX_REPETITIONS) - 1) -+#define NUM_WARMUP_RUNS 10 -+ -+/* ---------------------------- local macros ------------------------------- */ -+ -+#define TEST_DF_REP(name) \ -+ { #name, name, DEFAULT_MAX_REPETITIONS, DEFAULT_REQUIRED_QUORUM } -+#define TEST_NO_REP(name) { #name, name, 1, 1 } -+ -+/* ---------------------------- local types -------------------------------- */ -+ -+typedef int (*test_func_t)(void); -+ -+typedef struct -+{ -+ const char *name; -+ test_func_t test_func; -+ int max_repetitions; -+ int required_quorum; -+} test_table_entry_t; -+ -+/* ---------------------------- local variables ---------------------------- */ -+ -+__attribute__ ((aligned(256))) static struct __htm_tdb local_tdb256; -+static struct __htm_tdb local_tdb; -+static int do_dump_tdb = 0; -+ -+/* ---------------------------- exported variables (globals) --------------- */ -+ -+__attribute__ ((aligned(256))) struct -+{ -+ float float_1; -+ float float_2; -+ float float_3; -+} global = { 1.0, 2.5, 0.0 }; -+ -+__attribute__ ((aligned(256))) struct -+{ -+ volatile uint64_t c1; -+ volatile uint64_t c2; -+ volatile uint64_t c3; -+} counters = { 0, 0, 0 }; -+ -+/* ---------------------------- local helper functions --------------------- */ -+ -+static void dump_tdb (struct __htm_tdb *tdb) -+{ -+ unsigned char *p; -+ int i; -+ int j; -+ -+ if (do_dump_tdb == 0) -+ { -+ return; -+ } -+ p = (unsigned char *)tdb; -+ for (i = 0; i < 16; i++) -+ { -+ fprintf (stderr, "0x%02x ", i * 16); -+ for (j = 0; j < 16; j++) -+ { -+ fprintf (stderr, "%02x", (int)p[i * 16 + j]); -+ if (j < 15) -+ { -+ fprintf (stderr, " "); -+ } -+ if (j == 7) -+ { -+ fprintf (stderr, " "); -+ } -+ } -+ fprintf (stderr, "\n"); -+ } -+ -+ return; -+} -+ -+/* ---------------------------- local test functions ----------------------- */ -+ -+/* Check values of the constants defined in htmintrin.h. */ -+static int test_constants (void) -+{ -+ if (_HTM_TBEGIN_STARTED != 0) -+ { -+ return 100 * _HTM_TBEGIN_STARTED + 1; -+ } -+ if (_HTM_TBEGIN_INDETERMINATE != 1) -+ { -+ return 100 * _HTM_TBEGIN_INDETERMINATE + 2; -+ } -+ if (_HTM_TBEGIN_TRANSIENT != 2) -+ { -+ return 100 * _HTM_TBEGIN_TRANSIENT + 3; -+ } -+ if (_HTM_TBEGIN_PERSISTENT != 3) -+ { -+ return 100 * _HTM_TBEGIN_PERSISTENT + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_ntstg_tend (void) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ __builtin_non_tx_store ((uint64_t *)&counters.c1, 1); -+ counters.c2 = 2; -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 5; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 2) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ } -+ else -+ { -+ return 100 * rc + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_ntstg_tabort (void) -+{ -+ float f; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ f = 0; -+ if (__builtin_tbegin ((void *)0) == 0) -+ { -+ __builtin_non_tx_store ((uint64_t *)&counters.c1, 1); -+ counters.c2 = 2; -+ f = 1; -+ __builtin_tabort (256); -+ return 1; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 0) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (f != 0) -+ { -+ return 100 * f + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_nofloat (void) ++unsigned long long ++foo (float a) +{ -+ int rc; ++ const double dfa = a; ++ const unsigned int hi = dfa / 0x1p32f; ++ const unsigned int lo = dfa - (double) hi * 0x1p32f; + -+ counters.c1 = 0; -+ counters.c2 = 0; -+ if ((rc = __builtin_tbegin_nofloat ((void *)0)) == 0) -+ { -+ __builtin_non_tx_store ((uint64_t *)&counters.c1, 1); -+ counters.c2 = 2; -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 5; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 2) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ } -+ else -+ { -+ return 100 * rc + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry (void) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ counters.c3 = 0; -+ if ((rc = __builtin_tbegin_retry ((void *)0, 5)) == 0) -+ { -+ int do_abort; -+ -+ do_abort = (counters.c1 == 0) ? 1 : 0; -+ __builtin_non_tx_store ( -+ (uint64_t *)&counters.c1, counters.c1 + 1); -+ if (do_abort == 1) -+ { -+ __builtin_tabort (256); -+ } -+ counters.c2 = counters.c2 + 10; -+ __builtin_non_tx_store ((uint64_t *)&counters.c3, 3); -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 5; -+ } -+ if (counters.c1 != 2) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 10) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (counters.c3 != 3) -+ { -+ return 100 * counters.c3 + 6; -+ } -+ } -+ else -+ { -+ return 100 * rc + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry_nofloat (void) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ counters.c3 = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat ((void *)0, 5)) == 0) -+ { -+ int do_abort; -+ -+ do_abort = (counters.c1 == 0) ? 1 : 0; -+ __builtin_non_tx_store ( -+ (uint64_t *)&counters.c1, counters.c1 + 1); -+ if (do_abort == 1) -+ { -+ __builtin_tabort (256); -+ } -+ counters.c2 = counters.c2 + 10; -+ __builtin_non_tx_store ((uint64_t *)&counters.c3, 3); -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 5; -+ } -+ if (counters.c1 != 2) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 10) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (counters.c3 != 3) -+ { -+ return 100 * counters.c3 + 6; -+ } -+ } -+ else -+ { -+ return 100 * rc + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_aborts (void) -+{ -+ float f; -+ int rc; -+ -+ f = 77; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ f = 88; -+ __builtin_tabort (256); -+ return 2; -+ } -+ else if (rc != 2) -+ { -+ return 3; -+ } -+ if (f != 77) -+ { -+ return 4; -+ } -+ f = 66; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ f = 99; -+ __builtin_tabort (257); -+ return 5; -+ } -+ else if (rc != 3) -+ { -+ return 100 * rc + 6; -+ } -+ if (f != 66) -+ { -+ return 100 * f + 7; -+ } -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ global.float_3 = global.float_1 + global.float_2; -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 8; -+ } -+ } -+ else -+ { -+ return 100 * rc + 9; -+ } -+ if (global.float_3 != global.float_1 + global.float_2) -+ { -+ return 100 * rc + 10; -+ } -+ -+ return 0; -+} -+ -+static __attribute__((noinline)) void indirect_abort(int abort_code) -+{ -+ __builtin_tabort (abort_code); -+ -+ return; -+} -+ -+static int test_tbegin_indirect_aborts (void) -+{ -+ float f; -+ int rc; -+ -+ f = 77; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ f = 88; -+ indirect_abort(256); -+ return 2; -+ } -+ else if (rc != 2) -+ { -+ return 100 * rc + 3; -+ } -+ if (f != 77) -+ { -+ return 100 * rc + 4; -+ } -+ f = 66; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ f = 99; -+ indirect_abort(257); -+ return 5; -+ } -+ else if (rc != 3) -+ { -+ return 100 * rc + 6; -+ } -+ if (f != 66) -+ { -+ return 100 * f + 7; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_nofloat_aborts (void) -+{ -+ int rc; -+ -+ if ((rc = __builtin_tbegin_nofloat ((void *)0)) == 0) -+ { -+ __builtin_tabort (256); -+ return 2; -+ } -+ if ((rc = __builtin_tbegin_nofloat ((void *)0)) == 0) -+ { -+ __builtin_tabort (257); -+ return 1005; -+ } -+ else if (rc != 3) -+ { -+ return 1000 * rc + 6; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_nofloat_indirect_aborts (void) -+{ -+ int rc; -+ -+ if ((rc = __builtin_tbegin_nofloat ((void *)0)) == 0) -+ { -+ indirect_abort (256); -+ return 2; -+ } -+ if ((rc = __builtin_tbegin_nofloat ((void *)0)) == 0) -+ { -+ indirect_abort (257); -+ return 1005; -+ } -+ else if (rc != 3) -+ { -+ return 1000 * rc + 6; -+ } -+ -+ return 0; -+} -+ -+static -+int _test_tbegin_retry_aborts (int retries, uint64_t abort_code) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ if ((rc = __builtin_tbegin_retry ((void *)0, retries)) == 0) -+ { -+ __builtin_non_tx_store ((uint64_t *)&counters.c1, counters.c1 + 1); -+ __builtin_tabort (abort_code); -+ return 2; -+ } -+ else -+ { -+ if ((abort_code & 1) == 0) -+ { -+ if (rc != 2) -+ { -+ return 100 * rc + 2003; -+ } -+ else if (counters.c1 != (uint64_t)retries + 1) -+ { -+ return 1000 * counters.c1 + 100 * retries + 4; -+ } -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 3005; -+ } -+ else if (counters.c1 != 1) -+ { -+ return 1000 * counters.c1 + 100 * retries + 6; -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry_aborts (void) -+{ -+ int rc; -+ int retries; -+ -+ for (retries = 1; retries <= 3; retries++) -+ { -+ rc = _test_tbegin_retry_aborts (retries, 256); -+ if (rc != 0) -+ { -+ return 10000 + rc; -+ } -+ } -+ for (retries = 1; retries <= 3; retries++) -+ { -+ rc = _test_tbegin_retry_aborts (retries, 257); -+ if (rc != 0) -+ { -+ return 20000 + rc; -+ } -+ } -+ if ((rc = __builtin_tbegin_retry ((void *)0, 5)) == 0) -+ { -+ global.float_3 = global.float_1 + global.float_2; -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 30000 + 100 * rc + 6; -+ } -+ } -+ else -+ { -+ return 30000 + 100 * rc + 7; -+ } -+ -+ return 0; -+} -+ -+static int _test_tbegin_retry_nofloat_aborts (int retries, uint64_t abort_code) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat ((void *)0, retries)) == 0) -+ { -+ __builtin_non_tx_store ((uint64_t *)&counters.c1, counters.c1 + 1); -+ __builtin_tabort (abort_code); -+ return 2; -+ } -+ else -+ { -+ if ((abort_code & 1) == 0) -+ { -+ if (rc != 2) -+ { -+ return 100 * rc + 2003; -+ } -+ else if (counters.c1 != (uint64_t)retries + 1) -+ { -+ return 1000 * counters.c1 + 100 * retries + 4; -+ } -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 3005; -+ } -+ else if (counters.c1 != 1) -+ { -+ return 1000 * counters.c1 + 100 * retries + 6; -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry_nofloat_aborts (void) -+{ -+ int rc; -+ int retries; -+ -+ for (retries = 1; retries <= 3; retries++) -+ { -+ rc = _test_tbegin_retry_nofloat_aborts (retries, 256); -+ if (rc != 0) -+ { -+ return 10 * retries + rc; -+ } -+ } -+ for (retries = 1; retries <= 3; retries++) -+ { -+ rc = _test_tbegin_retry_nofloat_aborts (retries, 257); -+ if (rc != 0) -+ { -+ return 10000 + 10 * retries + rc; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_tdb (void) -+{ -+ int rc; -+ -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin (&local_tdb)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 1; -+ } -+ if (local_tdb.format != 0) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 2; -+ } -+ } -+ else -+ { -+ return 100 * rc + 3; -+ } -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin (&local_tdb)) == 0) -+ { -+ __builtin_tabort (257); -+ return 4; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 5; -+ } -+ if (local_tdb.format != 1) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 6; -+ } -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin (&local_tdb256)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 1100 * rc + 1; -+ } -+ if (local_tdb256.format != 0) -+ { -+ dump_tdb (&local_tdb256); -+ return 1100 * local_tdb256.format + 2; -+ } -+ } -+ else -+ { -+ return 1100 * rc + 3; -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin (&local_tdb256)) == 0) -+ { -+ __builtin_tabort (257); -+ return 2004; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 2100 * rc + 5; -+ } -+ if (local_tdb256.format != 1) -+ { -+ dump_tdb (&local_tdb256); -+ return 2100 * local_tdb256.format + 6; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_nofloat_tdb (void) -+{ -+ int rc; -+ -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin_nofloat (&local_tdb)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 1; -+ } -+ if (local_tdb.format != 0) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 2; -+ } -+ } -+ else -+ { -+ return 3; -+ } -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin_nofloat (&local_tdb)) == 0) -+ { -+ __builtin_tabort (257); -+ return 4; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 5; -+ } -+ if (local_tdb.format != 1) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 6; -+ } -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_nofloat (&local_tdb256)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 1100 * rc + 1; -+ } -+ if (local_tdb256.format != 0) -+ { -+ dump_tdb (&local_tdb256); -+ return 1100 * local_tdb256.format + 2; -+ } -+ } -+ else -+ { -+ return 1003; -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_nofloat (&local_tdb256)) == 0) -+ { -+ __builtin_tabort (257); -+ return 2004; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 2100 * rc + 5; -+ } -+ if (local_tdb256.format != 1) -+ { -+ dump_tdb (&local_tdb256); -+ return 2100 * local_tdb256.format + 6; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry_tdb (void) -+{ -+ int rc; -+ -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_retry (&local_tdb256, 2)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 1100 * rc + 1; -+ } -+ if (local_tdb256.format != 0) -+ { -+ dump_tdb (&local_tdb256); -+ return 1100 * local_tdb256.format + 2; -+ } -+ } -+ else -+ { -+ return 1003; -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_retry (&local_tdb256, 2)) == 0) -+ { -+ __builtin_tabort (257); -+ return 2004; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 2100 * rc + 5; -+ } -+ if (local_tdb256.format != 1) -+ { -+ dump_tdb (&local_tdb256); -+ return 2100 * local_tdb256.format + 6; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_retry_nofloat_tdb (void) -+{ -+ int rc; -+ -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat (&local_tdb, 2)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 100 * rc + 1; -+ } -+ if (local_tdb.format != 0) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 2; -+ } -+ } -+ else -+ { -+ return 100 * rc + 3; -+ } -+ local_tdb.format = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat (&local_tdb, 2)) == 0) -+ { -+ __builtin_tabort (257); -+ return 4; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 5; -+ } -+ if (local_tdb.format != 1) -+ { -+ dump_tdb (&local_tdb); -+ return 100 * local_tdb.format + 6; -+ } -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat (&local_tdb256, 2)) == 0) -+ { -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 1100 * rc + 1; -+ } -+ if (local_tdb256.format != 0) -+ { -+ dump_tdb (&local_tdb256); -+ return 1100 * local_tdb256.format + 2; -+ } -+ } -+ else -+ { -+ return 1100 * rc + 3; -+ } -+ local_tdb256.format = 0; -+ if ((rc = __builtin_tbegin_retry_nofloat (&local_tdb256, 2)) == 0) -+ { -+ __builtin_tabort (257); -+ return 2004; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 2100 * rc + 5; -+ } -+ if (local_tdb256.format != 1) -+ { -+ dump_tdb (&local_tdb256); -+ return 2100 * local_tdb256.format + 6; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_etnd (void) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ counters.c3 = 0; -+ if ((rc = __builtin_tbegin ((void *)0)) == 0) -+ { -+ counters.c1 = __builtin_tx_nesting_depth (); -+ if (__builtin_tbegin ((void *)0) == 0) -+ { -+ counters.c2 = __builtin_tx_nesting_depth (); -+ if (__builtin_tbegin ((void *)0) == 0) -+ { -+ counters.c3 = __builtin_tx_nesting_depth (); -+ __builtin_tend (); -+ } -+ __builtin_tend (); -+ } -+ __builtin_tend (); -+ } -+ else -+ { -+ return 100 * rc + 1; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 2) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (counters.c3 != 3) -+ { -+ return 100 * counters.c3 + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbeginc (void) -+{ -+ int rc; -+ -+ counters.c1 = 0; -+ __builtin_tbeginc (); -+ counters.c1 = 1; -+ rc = __builtin_tend (); -+ if (rc != 0) -+ { -+ return 10000 * rc + 1; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100000 * counters.c1 + 3; -+ } -+ -+ return 0; -+} -+ -+/* ---------------------------- local testing framework functions ---------- */ -+ -+static int run_one_test (const test_table_entry_t *test_entry) -+{ -+ int do_print_passes; -+ int succeeded; -+ int rc; -+ int i; -+ -+ /* Warmup run to get all necessary data and instruction pages into the page -+ * tables. */ -+ { -+ int run; -+ -+ do_dump_tdb = 0; -+ for (run = 0; run < NUM_WARMUP_RUNS; run++) -+ { -+ test_entry->test_func (); -+ } -+ do_dump_tdb = 1; -+ } -+ do_print_passes = ( -+ test_entry->required_quorum != 1 || -+ test_entry->max_repetitions != 1); -+ printf ("RRR RUN %s\n", test_entry->name); -+ if (do_print_passes == 1) -+ { -+ printf ( -+ " (requires %d successful out of %d runs)\n", -+ test_entry->required_quorum, -+ test_entry->max_repetitions); -+ } -+ succeeded = 0; -+ rc = 0; -+ for (rc = 0, i = 0; i < test_entry->max_repetitions; i++) -+ { -+ if (do_print_passes == 1) -+ { -+ if (i == 0) -+ { -+ printf (" "); -+ } -+ else -+ { -+ printf (","); -+ } -+ } -+ rc = test_entry->test_func (); -+ if (rc == 0) -+ { -+ if (do_print_passes == 1) -+ { -+ printf (" success"); -+ } -+ succeeded++; -+ if (succeeded >= test_entry->required_quorum) -+ { -+ break; -+ } -+ } -+ else -+ { -+ printf (" failed (rc = %d)", rc); -+ } -+ } -+ if (do_print_passes == 1 || rc != 0) -+ { -+ printf ("\n"); -+ } -+ if (succeeded >= test_entry->required_quorum) -+ { -+ printf ("+++ OK %s\n", test_entry->name); -+ -+ return 0; -+ } -+ else -+ { -+ printf ("--- FAIL %s\n", test_entry->name); -+ -+ return (rc != 0) ? rc : -1; -+ } -+} -+ -+static int run_all_tests (const test_table_entry_t *test_table) -+{ -+ const test_table_entry_t *test; -+ int rc; -+ -+ for ( -+ rc = 0, test = &test_table[0]; -+ test->test_func != NULL && rc == 0; test++) -+ { -+ rc = run_one_test (test); -+ } -+ -+ return rc; -+} -+ -+/* ---------------------------- interface functions ------------------------ */ -+ -+int main (void) -+{ -+ const test_table_entry_t test_table[] = { -+ TEST_NO_REP (test_constants), -+ TEST_DF_REP (test_tbegin_ntstg_tend), -+ TEST_DF_REP (test_tbegin_ntstg_tabort), -+ TEST_DF_REP (test_tbegin_nofloat), -+ TEST_NO_REP (test_tbegin_retry), -+ TEST_NO_REP (test_tbegin_retry_nofloat), -+ TEST_DF_REP (test_tbegin_aborts), -+ TEST_DF_REP (test_tbegin_indirect_aborts), -+ TEST_DF_REP (test_tbegin_nofloat_aborts), -+ TEST_DF_REP (test_tbegin_nofloat_indirect_aborts), -+ TEST_NO_REP (test_tbegin_retry_aborts), -+ TEST_NO_REP (test_tbegin_retry_nofloat_aborts), -+ TEST_DF_REP (test_tbegin_tdb), -+ TEST_DF_REP (test_tbegin_nofloat_tdb), -+ TEST_NO_REP (test_tbegin_retry_tdb), -+ TEST_NO_REP (test_tbegin_retry_nofloat_tdb), -+ TEST_DF_REP (test_etnd), -+ TEST_DF_REP (test_tbeginc), -+ { (void *)0, 0, 0 } -+ }; -+ -+ { -+ int rc; -+ -+ rc = run_all_tests (test_table); -+ -+ return rc; -+ } -+} -Index: gcc/testsuite/gcc.target/s390/hotpatch-7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch(0))) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/htm-builtins-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/htm-builtins-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/htm-builtins-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,682 @@ -+/* Functional tests of the htm __TM_... macros. */ -+ -+/* { dg-do run } */ -+/* { dg-require-effective-target htm } */ -+/* { dg-options "-O3 -march=zEC12 -mzarch" } */ -+ -+/* ---------------------------- included header files ---------------------- */ -+ -+#include <stdio.h> -+#include <string.h> -+#include <inttypes.h> -+#include <htmxlintrin.h> -+ -+/* ---------------------------- local definitions -------------------------- */ -+ -+#define DEFAULT_MAX_REPETITIONS 5 -+#define DEFAULT_REQUIRED_QUORUM ((DEFAULT_MAX_REPETITIONS) - 1) -+#define DEFAULT_ABORT_ADDRESS (0x12345678u) -+ -+/* ---------------------------- local macros ------------------------------- */ -+ -+#define TEST_DF_REP(name) \ -+ { #name, name, DEFAULT_MAX_REPETITIONS, DEFAULT_REQUIRED_QUORUM } -+#define TEST_NO_REP(name) { #name, name, 1, 1 } -+ -+/* ---------------------------- local types -------------------------------- */ -+ -+typedef int (*test_func_t)(void); -+ -+typedef struct -+{ -+ const char *name; -+ test_func_t test_func; -+ int max_repetitions; -+ int required_quorum; -+} test_table_entry_t; -+ -+typedef enum -+{ -+ ABORT_T_SYSTEM = 0, -+ ABORT_T_USER = 1, -+} abort_user_t; -+ -+typedef enum -+{ -+ ABORT_T_NONE = 0, -+ ABORT_T_ILLEGAL, -+ ABORT_T_FOOTPRINT_EXCEEDED, -+ ABORT_T_NESTED_TOO_DEEP, -+ ABORT_T_CONFLICT, -+ -+ ABORT_T_INVALID_ABORT_CODE -+} abort_t; -+ -+/* ---------------------------- local variables ---------------------------- */ -+ -+__attribute__ ((aligned(256))) static struct __htm_tdb local_tdb256; -+static struct __htm_tdb local_tdb; -+ -+static abort_t const abort_classes[] = -+{ -+ ABORT_T_INVALID_ABORT_CODE, -+ ABORT_T_NONE, -+ ABORT_T_NONE, -+ ABORT_T_NONE, -+ -+ ABORT_T_ILLEGAL, -+ ABORT_T_NONE, -+ ABORT_T_NONE, -+ ABORT_T_FOOTPRINT_EXCEEDED, -+ -+ ABORT_T_FOOTPRINT_EXCEEDED, -+ ABORT_T_CONFLICT, -+ ABORT_T_CONFLICT, -+ ABORT_T_ILLEGAL, -+ -+ ABORT_T_NONE, -+ ABORT_T_NESTED_TOO_DEEP, -+ ABORT_T_NONE, -+ ABORT_T_NONE, -+ -+ ABORT_T_NONE -+}; -+ -+static size_t num_abort_classes = sizeof(abort_classes) / sizeof(abort_t); -+ -+/* ---------------------------- exported variables (globals) --------------- */ -+ -+int global_int = 0; -+uint64_t global_u64 = 0; -+float global_float_1 = 1.0; -+float global_float_2 = 2.5; -+float global_float_3 = 0.0; -+__attribute__ ((aligned(256))) struct -+{ -+ volatile uint64_t c1; -+ volatile uint64_t c2; -+ volatile uint64_t c3; -+} counters = { 0, 0, 0 }; -+ -+/* ---------------------------- local helper functions --------------------- */ -+ -+static void dump_tdb(struct __htm_tdb *tdb) -+{ -+ unsigned char *p; -+ int i; -+ int j; -+ -+ p = (unsigned char *)tdb; -+ for (i = 0; i < 16; i++) -+ { -+ fprintf(stderr, "0x%02x ", i * 16); -+ for (j = 0; j < 16; j++) -+ { -+ fprintf(stderr, "%02x", (int)p[i * 16 + j]); -+ if (j < 15) -+ { -+ fprintf(stderr, " "); -+ } -+ if (j == 7) -+ { -+ fprintf(stderr, " "); -+ } -+ } -+ fprintf(stderr, "\n"); -+ } -+ -+ return; -+} -+ -+static void make_fake_tdb(struct __htm_tdb *tdb) -+{ -+ memset(tdb, 0, sizeof(*tdb)); -+ tdb->format = 1; -+ tdb->nesting_depth = 1; -+ tdb->atia = DEFAULT_ABORT_ADDRESS; -+ tdb->abort_code = 11; -+ -+ return; -+} -+ -+static int check_abort_code_in_tdb(struct __htm_tdb *tdb, uint64_t abort_code) -+{ -+ long expect_rc; -+ long rc; -+ -+ if (abort_code != 0) -+ { -+ long addr; -+ -+ addr = __TM_failure_address(&local_tdb); -+ if (addr != DEFAULT_ABORT_ADDRESS) -+ { -+ return 11; -+ } -+ } -+ { -+ long long tdb_abort_code; -+ -+ tdb_abort_code = __TM_failure_code(tdb); -+ if ((uint64_t)tdb_abort_code != abort_code) -+ { -+ fprintf( -+ stderr, "tm_ac %" PRIu64 ", ac %" PRIu64 -+ ", tdb_ac %" PRIu64 "\n", -+ (uint64_t)tdb_abort_code, abort_code, -+ (uint64_t)tdb->abort_code); -+ return 10; -+ } -+ } -+ expect_rc = (abort_code >= 256) ? 1 : 0; -+ rc = __TM_is_user_abort(tdb); -+ if (rc != expect_rc) -+ { -+ fprintf(stderr, "rc %ld, expect_rc %ld\n", rc, expect_rc); -+ return 1; -+ } -+ { -+ unsigned char code; -+ -+ code = 0xffu; -+ rc = __TM_is_named_user_abort(tdb, &code); -+ if (rc != expect_rc) -+ { -+ fprintf( -+ stderr, "rc %ld, expect_rc %ld\n", rc, -+ expect_rc); -+ return 2; -+ } -+ if (expect_rc == 1 && code != abort_code - 256) -+ { -+ return 3; -+ } -+ } -+ if (abort_code > (uint64_t)num_abort_classes) -+ { -+ abort_code = (uint64_t)num_abort_classes; -+ } -+ expect_rc = (abort_classes[abort_code] == ABORT_T_ILLEGAL) ? 1 : 0; -+ rc = __TM_is_illegal(tdb); -+ if (rc != expect_rc) -+ { -+ dump_tdb(tdb); -+ fprintf(stderr, "rc %ld, expect_rc %ld\n", rc, expect_rc); -+ return 4; -+ } -+ expect_rc = -+ (abort_classes[abort_code] == ABORT_T_FOOTPRINT_EXCEEDED) ? -+ 1 : 0; -+ rc = __TM_is_footprint_exceeded(tdb); -+ if (rc != expect_rc) -+ { -+ dump_tdb(tdb); -+ fprintf(stderr, "rc %ld, expect_rc %ld\n", rc, expect_rc); -+ return 5; -+ } -+ expect_rc = -+ (abort_classes[abort_code] == ABORT_T_NESTED_TOO_DEEP) ? 1 : 0; -+ rc = __TM_is_nested_too_deep(tdb); -+ if (rc != expect_rc) -+ { -+ dump_tdb(tdb); -+ fprintf(stderr, "rc %ld, expect_rc %ld\n", rc, expect_rc); -+ return 6; -+ } -+ expect_rc = (abort_classes[abort_code] == ABORT_T_CONFLICT) ? 1 : 0; -+ rc = __TM_is_conflict(tdb); -+ if (rc != expect_rc) -+ { -+ dump_tdb(tdb); -+ fprintf(stderr, "rc %ld, expect_rc %ld\n", rc, expect_rc); -+ return 7; -+ } -+ -+ return 0; -+} -+ -+/* ---------------------------- local test functions ----------------------- */ -+ -+/* Not a test; make sure that the involved global cachelines are reserved for -+ * writing. */ -+static int init_cache(void) -+{ -+ make_fake_tdb(&local_tdb); -+ make_fake_tdb(&local_tdb256); -+ global_int = 0; -+ global_u64 = 0; -+ global_float_1 = 1.0; -+ global_float_2 = 2.5; -+ global_float_3 = 0.0; -+ counters.c1 = 0; -+ counters.c2 = 0; -+ counters.c3 = 0; -+ -+ return 0; -+} -+ -+static int test_abort_classification(void) -+{ -+ int i; -+ -+ make_fake_tdb(&local_tdb); -+ for (i = 0; i <= 256; i++) -+ { -+ int rc; -+ -+ local_tdb.abort_code = (uint64_t)i; -+ rc = check_abort_code_in_tdb(&local_tdb, (uint64_t)i); -+ if (rc != 0) -+ { -+ return 100 * i + rc; -+ } -+ } -+ -+ return 0; -+} -+ -+static int test_cc_classification(void) -+{ -+ long rc; -+ -+ rc = __TM_is_failure_persistent(0); -+ if (rc != 0) -+ { -+ return 1; -+ } -+ rc = __TM_is_failure_persistent(1); -+ if (rc != 0) -+ { -+ return 2; -+ } -+ rc = __TM_is_failure_persistent(2); -+ if (rc != 0) -+ { -+ return 3; -+ } -+ rc = __TM_is_failure_persistent(3); -+ if (rc != 1) -+ { -+ return 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_ntstg_tend(void) -+{ -+ long rc; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ if ((rc = __TM_simple_begin()) == 0) -+ { -+ __TM_non_transactional_store((uint64_t *)&counters.c1, 1); -+ counters.c2 = 2; -+ rc = __TM_end(); -+ if (rc != 0) -+ { -+ return 100 * rc + 5; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 2) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ } -+ else -+ { -+ return 100 * rc + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_ntstg_tabort(void) -+{ -+ register float f; -+ -+ counters.c1 = 0; -+ counters.c2 = 0; -+ f = 0; -+ if (__TM_simple_begin() == 0) -+ { -+ __TM_non_transactional_store((uint64_t *)&counters.c1, 1); -+ counters.c2 = 2; -+ f = 1; -+ __TM_named_abort(0); -+ return 1; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 0) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (f != 0) -+ { -+ return 100 * f + 4; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_aborts(void) -+{ -+ float f; -+ long rc; -+ -+ f = 77; -+ if ((rc = __TM_simple_begin()) == 0) -+ { -+ f = 88; -+ __TM_abort(); -+ return 2; -+ } -+ else if (rc != 2) -+ { -+ return 3; -+ } -+ if (f != 77) -+ { -+ return 4; -+ } -+ f = 66; -+ if ((rc = __TM_simple_begin()) == 0) -+ { -+ f = 99; -+ __TM_named_abort(3); -+ return 5; -+ } -+ else if (rc != 3) -+ { -+ return 100 * rc + 6; -+ } -+ if (f != 66) -+ { -+ return 100 * f + 7; -+ } -+ if ((rc = __TM_simple_begin()) == 0) -+ { -+ global_float_3 = global_float_1 + global_float_2; -+ rc = __TM_end(); -+ if (rc != 0) -+ { -+ return 100 * rc + 8; -+ } -+ } -+ else -+ { -+ return 100 * rc + 9; -+ } -+ if (global_float_3 != global_float_1 + global_float_2) -+ { -+ return 100 * rc + 10; -+ } -+ -+ return 0; -+} -+ -+static int test_tbegin_tdb(void) -+{ -+ long rc; -+ -+ local_tdb.format = 0; -+ if ((rc = __TM_begin(&local_tdb)) == 0) -+ { -+ rc = __TM_end(); -+ if (rc != 0) -+ { -+ return 100 * rc + 1; -+ } -+ if (local_tdb.format != 0) -+ { -+ dump_tdb(&local_tdb); -+ return 100 * local_tdb.format + 2; -+ } -+ } -+ else -+ { -+ return 100 * rc + 3; -+ } -+ local_tdb.format = 0; -+ if ((rc = __TM_begin(&local_tdb)) == 0) -+ { -+ __TM_named_abort(1); -+ return 4; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 100 * rc + 5; -+ } -+ if (local_tdb.format != 1) -+ { -+ dump_tdb(&local_tdb); -+ return 100 * local_tdb.format + 6; -+ } -+ } -+ local_tdb256.format = 0; -+ if ((rc = __TM_begin(&local_tdb256)) == 0) -+ { -+ rc = __TM_end(); -+ if (rc != 0) -+ { -+ return 1100 * rc + 1; -+ } -+ if (local_tdb256.format != 0) -+ { -+ dump_tdb(&local_tdb256); -+ return 1100 * local_tdb256.format + 2; -+ } -+ } -+ else -+ { -+ return 1100 * rc + 3; -+ } -+#if 1 /*!!!does not work*/ -+ local_tdb256.format = 0; -+ if ((rc = __TM_begin(&local_tdb256)) == 0) -+ { -+ __TM_named_abort(1); -+ return 2004; -+ } -+ else -+ { -+ if (rc != 3) -+ { -+ return 2100 * rc + 5; -+ } -+ if (local_tdb256.format != 1) -+ { -+ dump_tdb(&local_tdb256); -+ return 2100 * local_tdb256.format + 6; -+ } -+ } -+#endif -+ -+ return 0; -+} -+ -+static int test_etnd(void) -+{ -+ long rc; -+ -+ { -+ long nd; -+ -+ make_fake_tdb(&local_tdb); -+ local_tdb.nesting_depth = 0; -+ nd = __TM_nesting_depth(&local_tdb); -+ if (nd != 0) -+ { -+ return 1; -+ } -+ local_tdb.nesting_depth = 7; -+ nd = __TM_nesting_depth(&local_tdb); -+ if (nd != 7) -+ { -+ return 7; -+ } -+ local_tdb.format = 0; -+ nd = __TM_nesting_depth(&local_tdb); -+ if (nd != 0) -+ { -+ return 2; -+ } -+ } -+ counters.c1 = 0; -+ counters.c1 = 0; -+ counters.c2 = 0; -+ counters.c3 = 0; -+ if ((rc = __TM_simple_begin()) == 0) -+ { -+ counters.c1 = __TM_nesting_depth(0); -+ if (__TM_simple_begin() == 0) -+ { -+ counters.c2 = __TM_nesting_depth(0); -+ if (__TM_simple_begin() == 0) -+ { -+ counters.c3 = __TM_nesting_depth(0); -+ __TM_end(); -+ } -+ __TM_end(); -+ } -+ __TM_end(); -+ } -+ else -+ { -+ return 100 * rc + 1; -+ } -+ if (counters.c1 != 1) -+ { -+ return 100 * counters.c1 + 2; -+ } -+ if (counters.c2 != 2) -+ { -+ return 100 * counters.c2 + 3; -+ } -+ if (counters.c3 != 3) -+ { -+ return 100 * counters.c3 + 4; -+ } -+ -+ return 0; -+} -+ -+/* ---------------------------- local testing framework functions ---------- */ -+ -+static int run_one_test(const test_table_entry_t *test_entry) -+{ -+ int do_print_passes; -+ int succeeded; -+ int rc; -+ int i; -+ -+ do_print_passes = ( -+ test_entry->required_quorum != 1 || -+ test_entry->max_repetitions != 1); -+ printf("RRR RUN %s\n", test_entry->name); -+ if (do_print_passes == 1) -+ { -+ printf( -+ " (requires %d successful out of %d runs)\n", -+ test_entry->required_quorum, -+ test_entry->max_repetitions); -+ } -+ succeeded = 0; -+ rc = 0; -+ for (rc = 0, i = 0; i < test_entry->max_repetitions; i++) -+ { -+ if (do_print_passes == 1) -+ { -+ if (i == 0) -+ { -+ printf(" "); -+ } -+ else -+ { -+ printf(","); -+ } -+ } -+ rc = test_entry->test_func(); -+ if (rc == 0) -+ { -+ if (do_print_passes == 1) -+ { -+ printf(" success"); -+ } -+ succeeded++; -+ if (succeeded >= test_entry->required_quorum) -+ { -+ break; -+ } -+ } -+ else -+ { -+ printf(" failed (rc = %d)", rc); -+ } -+ } -+ if (do_print_passes == 1 || rc != 0) -+ { -+ printf("\n"); -+ } -+ if (succeeded >= test_entry->required_quorum) -+ { -+ printf("+++ OK %s\n", test_entry->name); -+ -+ return 0; -+ } -+ else -+ { -+ printf("--- FAIL %s\n", test_entry->name); -+ -+ return (rc != 0) ? rc : -1; -+ } -+} -+ -+static int run_all_tests(const test_table_entry_t *test_table) -+{ -+ const test_table_entry_t *test; -+ int rc; -+ -+ for ( -+ rc = 0, test = &test_table[0]; -+ test->test_func != NULL && rc == 0; test++) -+ { -+ rc = run_one_test(test); -+ } -+ -+ return rc; -+} -+ -+/* ---------------------------- interface functions ------------------------ */ -+ -+int main(void) -+{ -+ const test_table_entry_t test_table[] = { -+ TEST_NO_REP(init_cache), -+ TEST_NO_REP(test_abort_classification), -+ TEST_NO_REP(test_cc_classification), -+ TEST_DF_REP(test_tbegin_ntstg_tend), -+ TEST_DF_REP(test_tbegin_ntstg_tabort), -+ TEST_DF_REP(test_tbegin_aborts), -+ TEST_DF_REP(test_tbegin_tdb), -+ TEST_DF_REP(test_etnd), -+ { (void *)0, 0, 0 } -+ }; -+ -+ { -+ int rc; -+ -+ rc = run_all_tests(test_table); -+ -+ return rc; -+ } ++ return ((unsigned long long) hi << (4 * (8))) | lo; +} -Index: gcc/testsuite/gcc.target/s390/hotpatch-8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-8.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,28 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch)) -+inline void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+__attribute__ ((hotpatch)) -+__attribute__ ((always_inline)) -+void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */ -+{ -+ printf("hello, world!\n"); -+} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */ -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -+/* { dg-final { scan-assembler-not "nop\t0" } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-9.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-9.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-9.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch(2))) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-10.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-10.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-10.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mno-hotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+__attribute__ ((hotpatch(2))) -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-11.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-11.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-11.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mhotpatch -mno-hotpatch --save-temps" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -+/* { dg-final { scan-assembler-not "nop\t0" } } */ -Index: gcc/testsuite/gcc.target/s390/hotpatch-12.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/s390/hotpatch-12.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/s390/hotpatch-12.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* Functional tests for the function hotpatching feature. */ -+ -+/* { dg-do run } */ -+/* { dg-options "-O3 -mzarch -mno-hotpatch -mhotpatch=1 --save-temps" } */ -+ -+#include <stdio.h> -+ -+void hp1(void) -+{ -+ printf("hello, world!\n"); -+} -+ -+int main (void) -+{ -+ return 0; -+} -+ -+/* Check number of occurences of certain instructions. */ -+/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ -+/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ -Index: gcc/testsuite/gcc.target/mips/bswap-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+/* { dg-options "isa_rev>=2" } */ -+/* { dg-skip-if "bswap recognition needs expensive optimizations" { *-*-* } { "-O0" "-O1" } { "" } } */ -+ -+NOMIPS16 unsigned short -+foo (unsigned short x) -+{ -+ return ((x << 8) & 0xff00) | ((x >> 8) & 0xff); -+} -+ -+/* { dg-final { scan-assembler "\twsbh\t" } } */ -Index: gcc/testsuite/gcc.target/mips/bswap-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+/* { dg-options "isa_rev>=2" } */ -+ -+NOMIPS16 unsigned short -+foo (unsigned short x) -+{ -+ return __builtin_bswap16 (x); -+} -+ -+/* { dg-final { scan-assembler "\twsbh\t" } } */ -Index: gcc/testsuite/gcc.target/mips/pr59137.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/pr59137.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/pr59137.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* { dg-do run } */ -+/* { dg-options "-mno-plt" } */ -+ -+extern void abort (void); -+ -+struct lispstruct -+{ -+ int e; -+ int t; -+}; -+ -+struct lispstruct Cnil_body; -+struct lispstruct Ct_body; -+int nvalues; -+ -+struct lispstruct * __attribute__ ((noinline)) -+fLlistp (struct lispstruct *x0) -+{ -+ if (x0 == &Cnil_body -+ || (((unsigned long) x0 >= 0x80000000) ? 0 -+ : (!x0->e ? (x0 != &Cnil_body) : x0->t))) -+ x0 = &Ct_body; -+ else -+ x0 = &Cnil_body; -+ nvalues = 1; -+ return x0; -+} -+ -+int main () -+{ -+ if (fLlistp ((struct lispstruct *) 0xa0000001) != &Cnil_body) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.target/mips/bswap-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-options "isa_rev>=2" } */ -+/* { dg-skip-if "bswap recognition needs expensive optimizations" { *-*-* } { "-O0" "-O1" } { "" } } */ -+ -+NOMIPS16 unsigned int -+foo (unsigned int x) -+{ -+ return (((x << 24) & 0xff000000) -+ | ((x << 8) & 0xff0000) -+ | ((x >> 8) & 0xff00) -+ | ((x >> 24) & 0xff)); -+} -+ -+/* { dg-final { scan-assembler "\twsbh\t" } } */ -+/* { dg-final { scan-assembler "\tror\t" } } */ -Index: gcc/testsuite/gcc.target/mips/bswap-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-4.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+/* { dg-options "isa_rev>=2" } */ -+ -+NOMIPS16 unsigned int -+foo (unsigned int x) -+{ -+ return __builtin_bswap32 (x); -+} -+ -+/* { dg-final { scan-assembler "\twsbh\t" } } */ -+/* { dg-final { scan-assembler "\tror\t" } } */ -Index: gcc/testsuite/gcc.target/mips/bswap-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-5.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-options "isa_rev>=2 -mgp64" } */ -+/* { dg-skip-if "bswap recognition needs expensive optimizations" { *-*-* } { "-O0" "-O1" } { "" } } */ -+ -+typedef unsigned long long uint64_t; -+ -+NOMIPS16 uint64_t -+foo (uint64_t x) -+{ -+ return (((x << 56) & 0xff00000000000000ull) -+ | ((x << 40) & 0xff000000000000ull) -+ | ((x << 24) & 0xff0000000000ull) -+ | ((x << 8) & 0xff00000000ull) -+ | ((x >> 8) & 0xff000000) -+ | ((x >> 24) & 0xff0000) -+ | ((x >> 40) & 0xff00) -+ | ((x >> 56) & 0xff)); -+} -+ -+/* { dg-final { scan-assembler "\tdsbh\t" } } */ -+/* { dg-final { scan-assembler "\tdshd\t" } } */ -Index: gcc/testsuite/gcc.target/mips/bswap-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/mips/bswap-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/mips/bswap-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+/* { dg-options "isa_rev>=2 -mgp64" } */ -+ -+typedef unsigned long long uint64_t; -+ -+NOMIPS16 uint64_t -+foo (uint64_t x) -+{ -+ return __builtin_bswap64 (x); -+} -+ -+/* { dg-final { scan-assembler "\tdsbh\t" } } */ -+/* { dg-final { scan-assembler "\tdshd\t" } } */ -Index: gcc/testsuite/gcc.target/sh/pr51244-19.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/sh/pr51244-19.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/sh/pr51244-19.c (.../branches/gcc-4_8-branch) -@@ -22,11 +22,16 @@ - unwanted sequences. Thus, if we see any movt insns, something is not - working as expected. This test requires -O2 because the T bit stores - in question will be eliminated in additional insn split passes after -- reload. */ -+ reload. -+ -+ Notice: When this test case was initially added, the T bit optimization -+ was buggy and this test case resulted in wrong code. The movt -+ instructions actually have to be present in this case to get -+ correct code. */ - /* { dg-do compile { target "sh*-*-*" } } */ - /* { dg-options "-O2" } */ - /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */ --/* { dg-final { scan-assembler-not "movt" } } */ -+/* { dg-final { scan-assembler "movt" } } */ - - struct request - { -Index: gcc/testsuite/gcc.target/sh/pr54089-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.target/sh/pr54089-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.target/sh/pr54089-3.c (.../branches/gcc-4_8-branch) -@@ -5,7 +5,7 @@ - /* { dg-options "-O1" } */ - /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */ - /* { dg-final { scan-assembler-not "and" } } */ --/* { dg-final { scan-assembler-not "31" } } */ -+/* { dg-final { scan-assembler-not "#31" } } */ - - int - test00 (unsigned int a, int* b, int c, int* d, unsigned int e) -Index: gcc/testsuite/go.test/go-test.exp -=================================================================== ---- a/src/gcc/testsuite/go.test/go-test.exp (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/go.test/go-test.exp (.../branches/gcc-4_8-branch) -@@ -333,17 +333,16 @@ - } - - if { ( [file tail $test] == "select2.go" \ -- || [file tail $test] == "stack.go" ) \ -+ || [file tail $test] == "stack.go" \ -+ || [file tail $test] == "peano.go" ) \ - && ! [check_effective_target_split_stack] } { -- # chan/select2.go fails on targets without split stack, -- # because they allocate a large stack segment that blows -- # out the memory calculations. -+ # These tests fails on targets without split stack. - untested $name - continue - } - -- if { [file tail $test] == "rotate.go" } { -- # This test produces a temporary file that takes too long -+ if [string match "*go.test/test/rotate\[0123\].go" $test] { -+ # These tests produces a temporary file that takes too long - # to compile--5 minutes on my laptop without optimization. - # When compiling without optimization it tests nothing - # useful, since the point of the test is to see whether Index: gcc/testsuite/lib/target-supports.exp =================================================================== ---- a/src/gcc/testsuite/lib/target-supports.exp (.../tags/gcc_4_8_2_release) +--- a/src/gcc/testsuite/lib/target-supports.exp (.../tags/gcc_4_8_3_release) +++ b/src/gcc/testsuite/lib/target-supports.exp (.../branches/gcc-4_8-branch) -@@ -1311,6 +1311,32 @@ - return 0 +@@ -1790,6 +1790,15 @@ + }] } -+# Return 1 if the target supports executing power8 vector instructions, 0 -+# otherwise. Cache the result. ++# Return 1 if the target supports long double of 128 bits, ++# 0 otherwise. + -+proc check_p8vector_hw_available { } { -+ return [check_cached_effective_target p8vector_hw_available { -+ # Some simulators are known to not support VSX/power8 instructions. -+ # For now, disable on Darwin -+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} { -+ expr 0 -+ } else { -+ set options "-mpower8-vector" -+ check_runtime_nocache p8vector_hw_available { -+ int main() -+ { -+ #ifdef __MACH__ -+ asm volatile ("xxlorc vs0,vs0,vs0"); -+ #else -+ asm volatile ("xxlorc 0,0,0"); -+ #endif -+ return 0; -+ } -+ } $options -+ } ++proc check_effective_target_longdouble128 { } { ++ return [check_no_compiler_messages longdouble128 object { ++ int dummy[sizeof(long double) == 16 ? 1 : -1]; + }] +} + - # Return 1 if the target supports executing VSX instructions, 0 - # otherwise. Cache the result. + # Return 1 if the target supports double of 64 bits, + # 0 otherwise. -@@ -2672,6 +2698,33 @@ - } - } - -+# Return 1 if this is a PowerPC target supporting -mpower8-vector -+ -+proc check_effective_target_powerpc_p8vector_ok { } { -+ if { ([istarget powerpc*-*-*] -+ && ![istarget powerpc-*-linux*paired*]) -+ || [istarget rs6000-*-*] } { -+ # AltiVec is not supported on AIX before 5.3. -+ if { [istarget powerpc*-*-aix4*] -+ || [istarget powerpc*-*-aix5.1*] -+ || [istarget powerpc*-*-aix5.2*] } { -+ return 0 -+ } -+ return [check_no_compiler_messages powerpc_p8vector_ok object { -+ int main (void) { -+#ifdef __MACH__ -+ asm volatile ("xxlorc vs0,vs0,vs0"); -+#else -+ asm volatile ("xxlorc 0,0,0"); -+#endif -+ return 0; -+ } -+ } "-mpower8-vector"] -+ } else { -+ return 0 -+ } -+} -+ - # Return 1 if this is a PowerPC target supporting -mvsx - - proc check_effective_target_powerpc_vsx_ok { } { -@@ -2699,6 +2752,27 @@ - } - } - -+# Return 1 if this is a PowerPC target supporting -mhtm -+ -+proc check_effective_target_powerpc_htm_ok { } { -+ if { ([istarget powerpc*-*-*] -+ && ![istarget powerpc-*-linux*paired*]) -+ || [istarget rs6000-*-*] } { -+ # HTM is not supported on AIX yet. -+ if { [istarget powerpc*-*-aix*] } { -+ return 0 -+ } -+ return [check_no_compiler_messages powerpc_htm_ok object { -+ int main (void) { -+ asm volatile ("tbegin. 0"); -+ return 0; -+ } -+ } "-mhtm"] -+ } else { -+ return 0 -+ } -+} -+ - # Return 1 if this is a PowerPC target supporting -mcpu=cell. - - proc check_effective_target_powerpc_ppu_ok { } { -@@ -2794,6 +2868,22 @@ - } - } - -+# Return 1 if this is a PowerPC target using the ELFv2 ABI. -+ -+proc check_effective_target_powerpc_elfv2 { } { -+ if { [istarget powerpc*-*-*] } { -+ return [check_no_compiler_messages powerpc_elfv2 object { -+ #if _CALL_ELF != 2 -+ #error not ELF v2 ABI -+ #else -+ int dummy; -+ #endif -+ }] -+ } else { -+ return 0 -+ } -+} -+ - # Return 1 if this is a SPU target with a toolchain that - # supports automatic overlay generation. - -@@ -4499,6 +4589,7 @@ - switch $arg { - "vmx_hw" { set selected [check_vmx_hw_available] } - "vsx_hw" { set selected [check_vsx_hw_available] } -+ "p8vector_hw" { set selected [check_p8vector_hw_available] } - "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] } - "named_sections" { set selected [check_named_sections_available] } - "gc_sections" { set selected [check_gc_sections_available] } -@@ -4520,6 +4611,7 @@ - switch $arg { - "vmx_hw" { return 1 } - "vsx_hw" { return 1 } -+ "p8vector_hw" { return 1 } - "ppc_recip_hw" { return 1 } - "named_sections" { return 1 } - "gc_sections" { return 1 } -@@ -5077,7 +5169,9 @@ - } - - lappend DEFAULT_VECTCFLAGS "-maltivec" -- if [check_vsx_hw_available] { -+ if [check_p8vector_hw_available] { -+ lappend DEFAULT_VECTCFLAGS "-mpower8-vector" "-mno-allow-movmisalign" -+ } elseif [check_vsx_hw_available] { - lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign" - } - -Index: gcc/testsuite/gfortran.dg/shape_8.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/shape_8.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/shape_8.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+! { dg-do compile } -+! -+! PR 60450: [4.7/4.8 Regression] ICE with SHAPE intrinsic -+! -+! Contributed by Dave Allured <dave.allured@noaa.gov> -+ -+ real, allocatable :: x(:,:) -+ allocate (x(3,2), source=99.) -+ print *, shape (x / 10.0) -+end -Index: gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90 +Index: gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 =================================================================== ---- a/src/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+! { dg-do compile } -+! -+! PR fortran/58803 -+! -+! Contributed by Vittorio Zecca -+! -+! Was before ICEing due to a double free -+! -+ type t -+ procedure(real), pointer, nopass :: f1, f2 -+ end type -+ end -Index: gcc/testsuite/gfortran.dg/where_4.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/where_4.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/where_4.f90 (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 (.../branches/gcc-4_8-branch) +@@ -1,6 +1,6 @@ + ! { dg-require-effective-target fortran_large_real } +-! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } } +-! Test XFAILed on these platforms because the system's printf() lacks ++! { dg-do run { xfail powerpc*-apple-darwin* } } ++! Test XFAILed on this platform because the system's printf() lacks + ! proper support for denormalized long doubles. See PR24685 + ! + ! This tests that the default formats for formatted I/O of reals are +Index: gcc/testsuite/gfortran.dg/cray_pointers_10.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 (.../branches/gcc-4_8-branch) @@ -0,0 +1,18 @@ -+! { dg-do compile } -+! PR 60522 - this used to ICE. -+! Original test case Roger Ferrer Ibanez -+subroutine foo(a, b) -+ implicit none -+ integer, dimension(:), intent(inout) :: a -+ integer, dimension(:), intent(in) :: b -+ -+ where (b(:) > 0) -+ where (b(:) > 100) -+ a(lbound(a, 1):ubound(a, 1)) = b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) - 100 -+ elsewhere -+ a(lbound(a, 1):ubound(a, 1)) = b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) -+ end where -+ elsewhere -+ a(lbound(a, 1):ubound(a, 1)) = - b(lbound(b, 1):ubound(b, 1)) * b(lbound(b, 1):ubound(b, 1)) -+ end where -+end subroutine foo -Index: gcc/testsuite/gfortran.dg/gomp/pr59467.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/gomp/pr59467.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/gomp/pr59467.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,24 @@ -+! PR libgomp/59467 -+! { dg-do compile } -+! { dg-options "-fopenmp" } -+ FUNCTION t() -+ INTEGER :: a, b, t -+ a = 0 -+ b = 0 -+ !$OMP PARALLEL REDUCTION(+:b) -+ !$OMP SINGLE ! { dg-error "is not threadprivate or private in outer context" } -+ !$OMP ATOMIC WRITE -+ a = 6 -+ !$OMP END SINGLE COPYPRIVATE (a) -+ b = a -+ !$OMP END PARALLEL -+ t = b -+ b = 0 -+ !$OMP PARALLEL REDUCTION(+:b) -+ !$OMP SINGLE -+ !$OMP ATOMIC WRITE -+ b = 6 -+ !$OMP END SINGLE COPYPRIVATE (b) -+ !$OMP END PARALLEL -+ t = t + b -+ END FUNCTION -Index: gcc/testsuite/gfortran.dg/allocate_class_3.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/allocate_class_3.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/allocate_class_3.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,107 @@ +! { dg-do run } -+! Tests the fix for PR59414, comment #3, in which the allocate -+! expressions were not correctly being stripped to provide the -+! vpointer as an lhs to the pointer assignment of the vptr from -+! the SOURCE expression. ++! { dg-options "-fcray-pointer" } +! -+! Contributed by Antony Lewis <antony@cosmologist.info> ++! PR fortran/45187 +! -+module ObjectLists ++module foo + implicit none ++ real :: a ++ pointer(c_a, a) ++end module foo + -+ type :: t -+ integer :: i -+ end type -+ -+ type Object_array_pointer -+ class(t), pointer :: p(:) -+ end type -+ -+contains -+ -+ subroutine AddArray1 (P, Pt) -+ class(t) :: P(:) -+ class(Object_array_pointer) :: Pt -+ -+ select type (Pt) -+ class is (Object_array_pointer) -+ if (associated (Pt%P)) deallocate (Pt%P) -+ allocate(Pt%P(1:SIZE(P)), source=P) -+ end select -+ end subroutine -+ -+ subroutine AddArray2 (P, Pt) -+ class(t) :: P(:) -+ class(Object_array_pointer) :: Pt -+ -+ select type (Pt) -+ type is (Object_array_pointer) -+ if (associated (Pt%P)) deallocate (Pt%P) -+ allocate(Pt%P(1:SIZE(P)), source=P) -+ end select -+ end subroutine -+ -+ subroutine AddArray3 (P, Pt) -+ class(t) :: P -+ class(Object_array_pointer) :: Pt -+ -+ select type (Pt) -+ class is (Object_array_pointer) -+ if (associated (Pt%P)) deallocate (Pt%P) -+ allocate(Pt%P(1:4), source=P) -+ end select -+ end subroutine -+ -+ subroutine AddArray4 (P, Pt) -+ type(t) :: P(:) -+ class(Object_array_pointer) :: Pt -+ -+ select type (Pt) -+ class is (Object_array_pointer) -+ if (associated (Pt%P)) deallocate (Pt%P) -+ allocate(Pt%P(1:SIZE(P)), source=P) -+ end select -+ end subroutine -+end module -+ -+ use ObjectLists -+ type(Object_array_pointer), pointer :: Pt -+ class(t), pointer :: P(:) -+ -+ allocate (P(2), source = [t(1),t(2)]) -+ allocate (Pt, source = Object_array_pointer(NULL())) -+ call AddArray1 (P, Pt) -+ select type (x => Pt%p) -+ type is (t) -+ if (any (x%i .ne. [1,2])) call abort -+ end select -+ deallocate (P) -+ deallocate (pt) -+ -+ allocate (P(3), source = [t(3),t(4),t(5)]) -+ allocate (Pt, source = Object_array_pointer(NULL())) -+ call AddArray2 (P, Pt) -+ select type (x => Pt%p) -+ type is (t) -+ if (any (x%i .ne. [3,4,5])) call abort -+ end select -+ deallocate (P) -+ deallocate (pt) -+ -+ allocate (Pt, source = Object_array_pointer(NULL())) -+ call AddArray3 (t(6), Pt) -+ select type (x => Pt%p) -+ type is (t) -+ if (any (x%i .ne. [6,6,6,6])) call abort -+ end select -+ deallocate (pt) -+ -+ allocate (Pt, source = Object_array_pointer(NULL())) -+ call AddArray4 ([t(7), t(8)], Pt) -+ select type (x => Pt%p) -+ type is (t) -+ if (any (x%i .ne. [7,8])) call abort -+ end select -+ deallocate (pt) -+ end -+ -Index: gcc/testsuite/gfortran.dg/reshape_6.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/reshape_6.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/reshape_6.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+! { dg-do compile } -+! PR fortran/58989 -+! +program test -+ -+ real(8), dimension(4,4) :: fluxes -+ real(8), dimension(2,2,2,2) :: f -+ integer, dimension(3) :: dmmy -+ integer, parameter :: indx(4)=(/2,2,2,2/) -+ -+ fluxes = 1 -+ -+ dmmy = (/2,2,2/) -+ -+ f = reshape(fluxes,(/dmmy,2/)) ! Caused an ICE -+ f = reshape(fluxes,(/2,2,2,2/)) ! Works as expected -+ f = reshape(fluxes,indx) ! Works as expected -+ ++ use foo ++ real :: z ++ c_a = loc(z) ++ a = 42 ++ if (z /= 42) call abort +end program test -Index: gcc/testsuite/gfortran.dg/unresolved_fixup_2.f90 +Index: gcc/testsuite/gfortran.dg/oldstyle_5.f =================================================================== ---- a/src/gcc/testsuite/gfortran.dg/unresolved_fixup_2.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/unresolved_fixup_2.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,36 @@ -+! { dg-do compile } -+! -+! PR fortran/58007 -+! Unresolved fiixup while loading a module. -+! -+! This tests that the specification expression A%MAX_DEGREE in module BSR is -+! correctly loaded and resolved in program MAIN. -+! -+! Original testcase from Daniel Shapiro <shapero@uw.edu> -+ -+module matrix -+ type :: sparse_matrix -+ integer :: max_degree -+ end type -+end module -+ -+module bsr -+ use matrix -+ -+ type, extends(sparse_matrix) :: bsr_matrix -+ end type -+ -+ integer :: i1 -+ integer :: i2 -+ integer :: i3 -+contains -+ function get_neighbors (A) -+ type(bsr_matrix), intent(in) :: A -+ integer :: get_neighbors(A%max_degree) -+ end function -+end module -+ -+program main -+ use matrix -+ use bsr -+end -Index: gcc/testsuite/gfortran.dg/init_flag_12.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/init_flag_12.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/init_flag_12.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+! { dg-do compile } -+! { dg-options "-fno-automatic -finit-local-zero" } -+! -+! PR 55907: [4.7/4.8/4.9 Regression] ICE with -fno-automatic -finit-local-zero -+! -+! Contributed by J.R. Garcia <garcia.espinosa.jr@gmail.com> -+ -+subroutine cchaine (i) -+ implicit none -+ integer :: i -+ character(len=i) :: chaine -+ write(*,*) chaine -+end subroutine -Index: gcc/testsuite/gfortran.dg/derived_external_function_1.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/derived_external_function_1.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/derived_external_function_1.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,27 @@ -+! { dg-do run } -+! -+! PR fortran/58771 -+! -+! Contributed by Vittorio Secca <zeccav@gmail.com> -+! -+! ICEd on the write statement with f() because the derived type backend -+! declaration not built. -+! -+module m -+ type t -+ integer(4) g -+ end type -+end -+ -+type(t) function f() result(ff) -+ use m -+ ff%g = 42 -+end -+ -+ use m -+ character (20) :: line1, line2 -+ type(t) f -+ write (line1, *) f() -+ write (line2, *) 42_4 -+ if (line1 .ne. line2) call abort -+end -Index: gcc/testsuite/gfortran.dg/implicit_pure_4.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/implicit_pure_4.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/implicit_pure_4.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+! { dg-do compile } -+! -+! PR fortran/60543 -+! PR fortran/60283 -+! -+module m -+contains -+ REAL(8) FUNCTION random() -+ CALL RANDOM_NUMBER(random) -+ END FUNCTION random -+ REAL(8) FUNCTION random2() -+ block -+ block -+ block -+ CALL RANDOM_NUMBER(random2) -+ end block -+ end block -+ end block -+ END FUNCTION random2 -+end module m -+ -+! { dg-final { scan-module-absence "m" "IMPLICIT_PURE" } } -Index: gcc/testsuite/gfortran.dg/null_6.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/null_6.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/null_6.f90 (.../branches/gcc-4_8-branch) -@@ -30,5 +30,5 @@ - - subroutine test_PR34547_3 () - integer, allocatable :: i(:) -- print *, NULL(i) -+ print *, NULL(i) ! { dg-error "Invalid context for NULL" } - end subroutine test_PR34547_3 -Index: gcc/testsuite/gfortran.dg/fmt_en.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/fmt_en.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/fmt_en.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,186 @@ -+! { dg-do run } -+! PR60128 Invalid outputs with EN descriptors -+! Test case provided by Walt Brainerd. -+program pr60128 -+use ISO_FORTRAN_ENV -+ implicit none -+ integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]] -+ logical :: l_skip(4) = .false. -+ integer :: i -+ integer :: n_tst = 0, n_cnt = 0, n_skip = 0 -+ character(len=20) :: s, s1 -+ -+ open (unit = 10, file = 'fmt_en.res') -+! Check that the default rounding mode is to nearest and to even on tie. -+ do i=1,size(real_kinds) -+ if (i == 1) then -+ write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(1)), & -+ real(9.49999905,kind=j(1)), & -+ real(9.5,kind=j(1)), real(8.5,kind=j(1)) -+ write(s1, '(3PE10.3,2PE10.3)') real(987350.,kind=j(1)), & -+ real(98765.0,kind=j(1)) -+ else if (i == 2) then -+ write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(2)), & -+ real(9.49999905,kind=j(2)), & -+ real(9.5,kind=j(2)), real(8.5,kind=j(2)) -+ write(s1, '(3PE10.3,2PE10.3)') real(987350.,kind=j(2)), & -+ real(98765.0,kind=j(2)) -+ else if (i == 3) then -+ write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(3)), & -+ real(9.49999905,kind=j(3)), & -+ real(9.5,kind=j(3)), real(8.5,kind=j(3)) -+ write(s1, '(3PE10.3,2PE10.3)') real(987350.,kind=j(3)), & -+ real(98765.0,kind=j(3)) -+ else if (i == 4) then -+ write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(4)), & -+ real(9.49999905,kind=j(4)), & -+ real(9.5,kind=j(4)), real(8.5,kind=j(4)) -+ write(s1, '(3PE10.3,2PE10.3)') real(987350.,kind=j(4)), & -+ real(98765.0,kind=j(4)) -+ end if -+ if (s /= '-9.5 9.5 10. 8.' .or. s1 /= ' 987.4E+03 98.76E+03') then -+ l_skip(i) = .true. -+! print "('Unsupported rounding for real(',i0,')')", j(i) -+ end if -+ end do -+ -+ -+! Original test. -+ call checkfmt("(en15.2)", -.44444, " -444.44E-03") -+ -+! Test for the bug in comment 6. -+ call checkfmt("(en15.0)", 1.0, " 1.E+00") -+ call checkfmt("(en15.0)", 1.00000012, " 1.E+00") -+ call checkfmt("(en15.0)", 0.99999994, " 1.E+00") -+ call checkfmt("(en15.0)", 10.0, " 10.E+00") -+ call checkfmt("(en15.0)", 10.0000010, " 10.E+00") -+ call checkfmt("(en15.0)", 9.99999905, " 10.E+00") -+ call checkfmt("(en15.0)", 100.0, " 100.E+00") -+ call checkfmt("(en15.0)", 100.000008, " 100.E+00") -+ call checkfmt("(en15.0)", 99.9999924, " 100.E+00") -+ call checkfmt("(en15.0)", 1000.0, " 1.E+03") -+ call checkfmt("(en15.0)", 1000.00006, " 1.E+03") -+ call checkfmt("(en15.0)", 999.999939, " 1.E+03") -+ call checkfmt("(en15.0)", 9.5, " 10.E+00") -+ call checkfmt("(en15.0)", 9.50000095, " 10.E+00") -+ call checkfmt("(en15.0)", 9.49999905, " 9.E+00") -+ call checkfmt("(en15.0)", 99.5, " 100.E+00") -+ call checkfmt("(en15.0)", 99.5000076, " 100.E+00") -+ call checkfmt("(en15.0)", 99.4999924, " 99.E+00") -+ call checkfmt("(en15.0)", 999.5, " 1.E+03") -+ call checkfmt("(en15.0)", 999.500061, " 1.E+03") -+ call checkfmt("(en15.0)", 999.499939, " 999.E+00") -+ call checkfmt("(en15.0)", 9500.0, " 10.E+03") -+ call checkfmt("(en15.0)", 9500.00098, " 10.E+03") -+ call checkfmt("(en15.0)", 9499.99902, " 9.E+03") -+ call checkfmt("(en15.1)", 9950.0, " 10.0E+03") -+ call checkfmt("(en15.2)", 9995.0, " 10.00E+03") -+ call checkfmt("(en15.3)", 9999.5, " 10.000E+03") -+ call checkfmt("(en15.1)", 9.5, " 9.5E+00") -+ call checkfmt("(en15.1)", 9.50000095, " 9.5E+00") -+ call checkfmt("(en15.1)", 9.49999905, " 9.5E+00") -+ call checkfmt("(en15.1)", 0.099951, " 100.0E-03") -+ call checkfmt("(en15.1)", 0.009951, " 10.0E-03") -+ call checkfmt("(en15.1)", 0.000999951," 1.0E-03") -+ -+ call checkfmt("(en15.0)", -1.0, " -1.E+00") -+ call checkfmt("(en15.0)", -1.00000012, " -1.E+00") -+ call checkfmt("(en15.0)", -0.99999994, " -1.E+00") -+ call checkfmt("(en15.0)", -10.0, " -10.E+00") -+ call checkfmt("(en15.0)", -10.0000010, " -10.E+00") -+ call checkfmt("(en15.0)", -9.99999905, " -10.E+00") -+ call checkfmt("(en15.0)", -100.0, " -100.E+00") -+ call checkfmt("(en15.0)", -100.000008, " -100.E+00") -+ call checkfmt("(en15.0)", -99.9999924, " -100.E+00") -+ call checkfmt("(en15.0)", -1000.0, " -1.E+03") -+ call checkfmt("(en15.0)", -1000.00006, " -1.E+03") -+ call checkfmt("(en15.0)", -999.999939, " -1.E+03") -+ call checkfmt("(en15.0)", -9.5, " -10.E+00") -+ call checkfmt("(en15.0)", -9.50000095, " -10.E+00") -+ call checkfmt("(en15.0)", -9.49999905, " -9.E+00") -+ call checkfmt("(en15.0)", -99.5, " -100.E+00") -+ call checkfmt("(en15.0)", -99.5000076, " -100.E+00") -+ call checkfmt("(en15.0)", -99.4999924, " -99.E+00") -+ call checkfmt("(en15.0)", -999.5, " -1.E+03") -+ call checkfmt("(en15.0)", -999.500061, " -1.E+03") -+ call checkfmt("(en15.0)", -999.499939, " -999.E+00") -+ call checkfmt("(en15.0)", -9500.0, " -10.E+03") -+ call checkfmt("(en15.0)", -9500.00098, " -10.E+03") -+ call checkfmt("(en15.0)", -9499.99902, " -9.E+03") -+ call checkfmt("(en15.1)", -9950.0, " -10.0E+03") -+ call checkfmt("(en15.2)", -9995.0, " -10.00E+03") -+ call checkfmt("(en15.3)", -9999.5, " -10.000E+03") -+ call checkfmt("(en15.1)", -9.5, " -9.5E+00") -+ call checkfmt("(en15.1)", -9.50000095, " -9.5E+00") -+ call checkfmt("(en15.1)", -9.49999905, " -9.5E+00") -+ call checkfmt("(en15.1)", -0.099951, " -100.0E-03") -+ call checkfmt("(en15.1)", -0.009951, " -10.0E-03") -+ call checkfmt("(en15.1)", -0.000999951," -1.0E-03") -+ -+ call checkfmt("(en15.1)", 987350., " 987.4E+03") -+ call checkfmt("(en15.2)", 98735., " 98.74E+03") -+ call checkfmt("(en15.3)", 9873.5, " 9.874E+03") -+ call checkfmt("(en15.1)", 987650., " 987.6E+03") -+ call checkfmt("(en15.2)", 98765., " 98.76E+03") -+ call checkfmt("(en15.3)", 9876.5, " 9.876E+03") -+ call checkfmt("(en15.1)", 3.125E-02, " 31.2E-03") -+ call checkfmt("(en15.1)", 9.375E-02, " 93.8E-03") -+ call checkfmt("(en15.2)", 1.5625E-02, " 15.62E-03") -+ call checkfmt("(en15.2)", 4.6875E-02, " 46.88E-03") -+ call checkfmt("(en15.3)", 7.8125E-03, " 7.812E-03") -+ call checkfmt("(en15.3)", 2.34375E-02, " 23.438E-03") -+ call checkfmt("(en15.3)", 9.765625E-04," 976.562E-06") -+ call checkfmt("(en15.6)", 2.9296875E-03," 2.929688E-03") -+ -+ call checkfmt("(en15.1)", -987350., " -987.4E+03") -+ call checkfmt("(en15.2)", -98735., " -98.74E+03") -+ call checkfmt("(en15.3)", -9873.5, " -9.874E+03") -+ call checkfmt("(en15.1)", -987650., " -987.6E+03") -+ call checkfmt("(en15.2)", -98765., " -98.76E+03") -+ call checkfmt("(en15.3)", -9876.5, " -9.876E+03") -+ call checkfmt("(en15.1)", -3.125E-02, " -31.2E-03") -+ call checkfmt("(en15.1)", -9.375E-02, " -93.8E-03") -+ call checkfmt("(en15.2)", -1.5625E-02, " -15.62E-03") -+ call checkfmt("(en15.2)", -4.6875E-02, " -46.88E-03") -+ call checkfmt("(en15.3)", -7.8125E-03, " -7.812E-03") -+ call checkfmt("(en15.3)", -2.34375E-02, " -23.438E-03") -+ call checkfmt("(en15.3)", -9.765625E-04," -976.562E-06") -+ call checkfmt("(en15.6)", -2.9296875E-03," -2.929688E-03") -+ -+ ! print *, n_tst, n_cnt, n_skip -+ if (n_cnt /= 0) call abort -+ if (all(.not. l_skip)) write (10, *) "All kinds rounded to nearest" -+ close (10) -+ -+contains -+ subroutine checkfmt(fmt, x, cmp) -+ implicit none -+ integer :: i -+ character(len=*), intent(in) :: fmt -+ real, intent(in) :: x -+ character(len=*), intent(in) :: cmp -+ do i=1,size(real_kinds) -+ if (i == 1) then -+ write(s, fmt) real(x,kind=j(1)) -+ else if (i == 2) then -+ write(s, fmt) real(x,kind=j(2)) -+ else if (i == 3) then -+ write(s, fmt) real(x,kind=j(3)) -+ else if (i == 4) then -+ write(s, fmt) real(x,kind=j(4)) -+ end if -+ n_tst = n_tst + 1 -+ if (s /= cmp) then -+ if (l_skip(i)) then -+ n_skip = n_skip + 1 -+ else -+ print "(a,1x,a,' expected: ',1x,a)", fmt, s, cmp -+ n_cnt = n_cnt + 1 -+ end if -+ end if -+ end do -+ -+ end subroutine -+end program -+! { dg-final { scan-file fmt_en.res "All kinds rounded to nearest" { xfail { i?86-*-solaris2.9* hppa*-*-hpux* } } } } -+! { dg-final { cleanup-saved-temps } } -Index: gcc/testsuite/gfortran.dg/constructor_9.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/constructor_9.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/constructor_9.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+! { dg-do compile } -+! { dg-options "-Wall" } -+! -+! PR 58471: [4.8/4.9 Regression] ICE on invalid with missing type constructor and -Wall -+! -+! Contributed by Andrew Benson <abensonca@gmail.com> -+ -+module cf -+ implicit none -+ type :: cfmde -+ end type -+ interface cfmde -+ module procedure mdedc ! { dg-error "is neither function nor subroutine" } -+ end interface -+contains -+ subroutine cfi() -+ type(cfmde), pointer :: cfd -+ cfd=cfmde() ! { dg-error "Can't convert" } -+ end subroutine -+end module -+ -+! { dg-final { cleanup-modules "cf" } } -Index: gcc/testsuite/gfortran.dg/round_3.f08 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/round_3.f08 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/round_3.f08 (.../branches/gcc-4_8-branch) -@@ -16,19 +16,44 @@ - call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00") - call checkfmt("(RU,1P,G10.4E2)", 2.3456e5, "2.3456E+05") - -- call checkfmt("(RU,F2.0)", 0.09, "1.") ! 0. -+ call checkfmt("(RC,G10.2)", 99.5, " 0.10E+03") ! pr59774 -+ call checkfmt("(RC,G10.2)", 995., " 0.10E+04") ! pr59774 -+ call checkfmt("(RC,G10.3)", 999.5, " 0.100E+04") ! pr59774 -+ call checkfmt("(RC,G10.3)", 9995., " 0.100E+05") ! pr59774 -+ call checkfmt("(RU,G10.2)", .099, " 0.10 ") ! pr59774 -+ call checkfmt("(RC,G10.1)", .095, " 0.1 ") ! pr59774 -+ call checkfmt("(RU,G10.3)", .0999, " 0.100 ") ! pr59774 -+ call checkfmt("(RC,G10.2)", .0995, " 0.10 ") ! pr59774 -+ -+ call checkfmt("(RU,G9.3)", 891.1, " 892.") ! pr59836 -+ call checkfmt("(RD,G9.3)", -891.1, "-892.") ! pr59836 -+ -+ call checkfmt("(RU,F6.4)", 0.00006, "0.0001")! 0. -+ call checkfmt("(RU,F5.3)", 0.0007, "0.001") ! 0. -+ call checkfmt("(RU,F4.2)", 0.008, "0.01") ! 0. -+ call checkfmt("(RU,F3.1)", 0.09, "0.1") ! 0. -+ -+ call checkfmt("(RU,F2.0)", 0.09, "1.") ! 0. - call checkfmt("(RD,F3.0)", -0.09, "-1.") ! -0. -- call checkfmt("(RU,F2.0)", 2.0, "2.") ! 3. -- call checkfmt("(RD,F3.0)", -2.0, "-2.") ! -3. -- call checkfmt("(RU,F6.4)", 2.0, "2.0000") ! 2.0001 -- call checkfmt("(RD,F7.4)", -2.0, "-2.0000") ! -2.0001 -- call checkfmt("(RU,1P,E6.0E2)", 2.0, "2.E+00") ! 3.E+00 -+ call checkfmt("(RU,F2.0)", 0.9, "1.") ! pr59836 -+ call checkfmt("(RC,F2.0)", 0.4, "0.") ! pr59836 -+ call checkfmt("(RC,F2.0)", 0.5, "1.") ! pr59836 -+ call checkfmt("(RC,F2.0)", 0.6, "1.") ! pr59836 -+ call checkfmt("(RD,F3.0)", -0.9, "-1.") ! pr59836 -+ call checkfmt("(RC,F3.0)", -0.4, "-0.") ! pr59836 -+ call checkfmt("(RC,F3.0)", -0.5, "-1.") ! pr59836 -+ call checkfmt("(RC,F3.0)", -0.6, "-1.") ! pr59836 -+ call checkfmt("(RU,F2.0)", 2.0, "2.") ! 3. -+ call checkfmt("(RD,F3.0)", -2.0, "-2.") ! -3. -+ call checkfmt("(RU,F6.4)", 2.0, "2.0000") ! 2.0001 -+ call checkfmt("(RD,F7.4)", -2.0, "-2.0000") ! -2.0001 -+ call checkfmt("(RU,1P,E6.0E2)", 2.0, "2.E+00") ! 3.E+00 - call checkfmt("(RD,1P,E7.0E2)", -2.0, "-2.E+00") ! -3.E+00 -- call checkfmt("(RU,1P,E7.1E2)", 2.5, "2.5E+00") ! 2.6E+00 -+ call checkfmt("(RU,1P,E7.1E2)", 2.5, "2.5E+00") ! 2.6E+00 - call checkfmt("(RD,1P,E8.1E2)", -2.5, "-2.5E+00") ! -2.6E+00 - call checkfmt("(RU,1P,E10.4E2)", 2.5, "2.5000E+00") ! 2.5001E+00 - call checkfmt("(RD,1P,E11.4E2)", -2.5, "-2.5000E+00") ! -2.5001E+00 -- call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00") ! 3.E+00 -+ call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00") ! 3.E+00 - call checkfmt("(RD,1P,G7.0E2)", -2.0, "-2.E+00") ! -3.E+00 - call checkfmt("(RU,1P,G10.4E2)", 2.3456e5, "2.3456E+05") ! 2.3457E+05 - call checkfmt("(RD,1P,G11.4E2)", -2.3456e5, "-2.3456E+05") ! -2.3457E+05 -Index: gcc/testsuite/gfortran.dg/default_initialization_7.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/default_initialization_7.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/default_initialization_7.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+! { dg-do compile } -+! -+! PR fortran/57033 -+! ICE on a structure constructor of an extended derived type whose parent -+! type last component has a default initializer -+! -+! Contributed by Tilo Schwarz <tilo@tilo-schwarz.de> -+ -+program ice -+ -+type m -+ integer i -+ logical :: f = .false. -+end type m -+ -+type, extends(m) :: me -+end type me -+ -+type(me) meo -+ -+meo = me(1) ! ICE -+end program ice -Index: gcc/testsuite/gfortran.dg/proc_ptr_46.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/proc_ptr_46.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/proc_ptr_46.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+! { dg-do compile } -+! -+! PR fortran/49397 -+! -+! Invalid per IR F08/0060 and F2008Corr2, C729 -+! -+ -+! Print *,f() ! << Valid when uncommented -+Contains -+ Subroutine s -+ Procedure(Real),Pointer :: p -+ p => f ! { dg-error "Procedure pointer target 'f' at .1. must be either an intrinsic, host or use associated, referenced or have the EXTERNAL attribute" } -+ End Subroutine -+End -Index: gcc/testsuite/gfortran.dg/pr52370.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/pr52370.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/pr52370.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+! PR fortran/52370 -+! { dg-do compile } -+! { dg-options "-O1 -Wall" } -+ -+module pr52370 -+contains -+ subroutine foo(a,b) -+ real, intent(out) :: a -+ real, dimension(:), optional, intent(out) :: b -+ a=0.5 -+ if (present(b)) then -+ b=1.0 -+ end if -+ end subroutine foo -+end module pr52370 -+ -+program prg52370 -+ use pr52370 -+ real :: a -+ call foo(a) -+end program prg52370 -Index: gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+! { dg-do compile } -+! { dg-options "-ffrontend-optimize" } -+! -+! PR fortran/60341 -+! An unguarded union access was wrongly enabling a frontend optimization on a -+! string comparison, leading to an ICE. -+! -+! Original testcase from Steve Chapel <steve.chapel@a2pg.com>. -+! Reduced by Steven G. Kargl <kargl@gcc.gnu.org>. -+! -+ -+ subroutine modelg(ncm) -+ implicit none -+ integer, parameter :: pc = 30, pm = pc - 1 -+ integer i -+ character*4 catt(pm,2) -+ integer ncm,iatt(pm,pc) -+ do i=1,ncm -+ if (catt(i,1)//catt(i,2).eq.'central') exit -+ end do -+ iatt(i,4)=1 -+ end -Index: gcc/testsuite/gfortran.dg/list_read_12.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/list_read_12.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/list_read_12.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+! { dg-do run } -+! PR58324 Bogus end of file condition -+integer :: i, ios -+open(99, access='stream', form='unformatted') -+write(99) "5 a" -+close(99) -+ -+open(99, access='sequential', form='formatted') -+read(99, *, iostat=ios) i -+if (ios /= 0) call abort -+end -Index: gcc/testsuite/gfortran.dg/generic_28.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/generic_28.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/generic_28.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+! { dg-do compile } -+! -+! PR 58998: [4.8/4.9 Regression] Generic interface problem with gfortran -+! -+! Contributed by Paul van Delst -+ -+ interface iargc -+ procedure iargc_8 -+ end interface -+ -+contains -+ -+ integer(8) function iargc_8() -+ integer(4) iargc -+ iargc_8 = iargc() -+ end function -+ -+end -Index: gcc/testsuite/gfortran.dg/unresolved_fixup_1.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/unresolved_fixup_1.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/unresolved_fixup_1.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,44 @@ -+! { dg-do compile } -+! -+! PR fortran/58007 -+! Unresolved fixup while loading a module. -+! -+! This tests that the specification expression A%MAX_DEGREE in module BSR is -+! correctly loaded and resolved in program MAIN. -+! -+! Original testcase from Daniel Shapiro <shapero@uw.edu> -+! Reduced by Tobias Burnus <burnus@net-b.de> and Janus Weil <janus@gcc.gnu.org> -+ -+module matrix -+ type :: sparse_matrix -+ integer :: max_degree -+ end type -+contains -+ subroutine init_interface (A) -+ class(sparse_matrix), intent(in) :: A -+ end subroutine -+ real function get_value_interface() -+ end function -+end module -+ -+module ellpack -+ use matrix -+end module -+ -+module bsr -+ use matrix -+ type, extends(sparse_matrix) :: bsr_matrix -+ contains -+ procedure :: get_neighbors -+ end type -+contains -+ function get_neighbors (A) -+ class(bsr_matrix), intent(in) :: A -+ integer :: get_neighbors(A%max_degree) -+ end function -+end module -+ -+program main -+ use ellpack -+ use bsr -+end -Index: gcc/testsuite/gfortran.dg/null_5.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/null_5.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/null_5.f90 (.../branches/gcc-4_8-branch) -@@ -34,7 +34,7 @@ - end subroutine test_PR34547_1 - - subroutine test_PR34547_2 () -- print *, null () ! { dg-error "in data transfer statement requires MOLD" } -+ print *, null () ! { dg-error "Invalid context" } - end subroutine test_PR34547_2 - - subroutine test_PR34547_3 () -Index: gcc/testsuite/gfortran.dg/proc_ptr_43.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+! { dg-do compile } -+! -+! PR 58099: [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking -+! -+! Contributed by Daniel Price <daniel.price@monash.edu> -+ -+ implicit none -+ procedure(real), pointer :: wfunc -+ -+ wfunc => w_cubic -+ -+contains -+ -+ pure real function w_cubic(q2) -+ real, intent(in) :: q2 -+ w_cubic = 0. -+ end function -+ -+end -Index: gcc/testsuite/gfortran.dg/nan_7.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/nan_7.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/nan_7.f90 (.../branches/gcc-4_8-branch) -@@ -2,6 +2,7 @@ - ! { dg-options "-fno-range-check" } - ! { dg-require-effective-target fortran_real_16 } - ! { dg-require-effective-target fortran_integer_16 } -+! { dg-skip-if "" { "powerpc*le-*-*" } { "*" } { "" } } - ! PR47293 NAN not correctly read - character(len=200) :: str - real(16) :: r -Index: gcc/testsuite/gfortran.dg/typebound_generic_15.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+! { dg-do compile } -+! -+! PR 60231: [4.8/4.9 Regression] ICE on undefined generic -+! -+! Contributed by Antony Lewis <antony@cosmologist.info> -+ -+module Objects -+ -+ Type TObjectList -+ contains -+ procedure :: Add1 ! { dg-error "must be a module procedure" } -+ procedure :: Add2 ! { dg-error "must be a module procedure" } -+ generic :: Add => Add1, Add2 ! { dg-error "are ambiguous" } -+ end Type -+ -+end module -+ -+! { dg-final { cleanup-modules "Objects" } } -Index: gcc/testsuite/gfortran.dg/extends_15.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/extends_15.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/extends_15.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+! { dg-do compile } -+! -+! PR 58355: [4.7/4.8/4.9 Regression] [F03] ICE with TYPE, EXTENDS before parent TYPE defined -+! -+! Contributed by Andrew Benson <abensonca@gmail.com> -+ -+module ct -+ public :: t1 -+ -+ type, extends(t1) :: t2 ! { dg-error "has not been previously defined" } -+ -+ type :: t1 -+ end type -+end -+ -+! { dg-final { cleanup-modules "ct" } } -Index: gcc/testsuite/gfortran.dg/optional_class_1.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/optional_class_1.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/optional_class_1.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,45 @@ -+! { dg-do run } -+! -+! PR fortran/57445 -+! -+! Contributed by Tobias Burnus <burnus@gcc.gnu.org> -+! -+! Spurious assert was added at revision 192495 -+! -+module m -+ implicit none -+ type t -+ integer :: i -+ end type t -+contains -+ subroutine opt(xa, xc, xaa, xca) -+ type(t), allocatable, intent(out), optional :: xa -+ class(t), allocatable, intent(out), optional :: xc -+ type(t), allocatable, intent(out), optional :: xaa(:) -+ class(t), allocatable, intent(out), optional :: xca(:) -+ if (present (xca)) call foo_opt(xca=xca) -+ end subroutine opt -+ subroutine foo_opt(xa, xc, xaa, xca) -+ type(t), allocatable, intent(out), optional :: xa -+ class(t), allocatable, intent(out), optional :: xc -+ type(t), allocatable, intent(out), optional :: xaa(:) -+ class(t), allocatable, intent(out), optional :: xca(:) -+ if (present (xca)) then -+ if (allocated (xca)) deallocate (xca) -+ allocate (xca(3), source = [t(9),t(99),t(999)]) -+ end if -+ end subroutine foo_opt -+end module m -+ use m -+ class(t), allocatable :: xca(:) -+ allocate (xca(1), source = t(42)) -+ select type (xca) -+ type is (t) -+ if (any (xca%i .ne. [42])) call abort -+ end select -+ call opt (xca = xca) -+ select type (xca) -+ type is (t) -+ if (any (xca%i .ne. [9,99,999])) call abort -+ end select -+end -Index: gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,74 @@ +--- a/src/gcc/testsuite/gfortran.dg/oldstyle_5.f (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gfortran.dg/oldstyle_5.f (.../branches/gcc-4_8-branch) +@@ -0,0 +1,8 @@ ++C { dg-do compile } ++ TYPE T ++ INTEGER A(2)/1,2/ ! { dg-error "Invalid old style initialization for derived type component" } ++ END TYPE ++ TYPE S ++ INTEGER B/1/ ! { dg-error "Invalid old style initialization for derived type component" } ++ END TYPE ++ END +Index: gcc/testsuite/gfortran.dg/nint_2.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/nint_2.f90 (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gfortran.dg/nint_2.f90 (.../branches/gcc-4_8-branch) +@@ -4,7 +4,8 @@ + ! http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html + ! + ! { dg-do run } +-! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc*-*-linux* *-*-mingw* } { "-O0" } { "" } } ++! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc-*-linux* powerpc64-*-linux* *-*-mingw* } { "-O0" } { "" } } ++! Note that this doesn't fail on powerpc64le-*-linux*. + real(kind=8) :: a + integer(kind=8) :: i1, i2 + real :: b +Index: gcc/testsuite/gfortran.dg/allocatable_function_8.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/allocatable_function_8.f90 (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gfortran.dg/allocatable_function_8.f90 (.../branches/gcc-4_8-branch) +@@ -0,0 +1,47 @@ +! { dg-do run } ++! Test the fix for PR61459. +! -+! PR 59654: [4.8/4.9 Regression] [OOP] Broken function table with complex OO use case ++! Contributed by John Wingate <johnww@tds.net> +! -+! Contributed by Thomas Clune <Thomas.L.Clune@nasa.gov> ++module a + -+module TestResult_mod -+ implicit none -+ -+ type TestResult -+ integer :: numRun = 0 -+ contains -+ procedure :: run -+ procedure, nopass :: getNumRun -+ end type -+ -+contains -+ -+ subroutine run (this) -+ class (TestResult) :: this -+ this%numRun = this%numRun + 1 -+ end subroutine -+ -+ subroutine getNumRun() -+ end subroutine -+ -+end module -+ -+ -+module BaseTestRunner_mod -+ implicit none -+ -+ type :: BaseTestRunner -+ contains -+ procedure, nopass :: norun -+ end type ++ implicit none ++ private ++ public :: f_segfault, f_segfault_plus, f_workaround ++ integer, dimension(2,2) :: b = reshape([1,-1,1,1],[2,2]) + +contains + -+ function norun () result(result) -+ use TestResult_mod, only: TestResult -+ type (TestResult) :: result -+ end function -+ -+end module -+ -+ -+module TestRunner_mod -+ use BaseTestRunner_mod, only: BaseTestRunner -+ implicit none -+end module -+ ++ function f_segfault(x) ++ real, dimension(:), allocatable :: f_segfault ++ real, dimension(:), intent(in) :: x ++ allocate(f_segfault(2)) ++ f_segfault = matmul(b,x) ++ end function f_segfault ++ ++! Sefaulted without the ALLOCATE as well. ++ function f_segfault_plus(x) ++ real, dimension(:), allocatable :: f_segfault_plus ++ real, dimension(:), intent(in) :: x ++ f_segfault_plus = matmul(b,x) ++ end function f_segfault_plus ++ ++ function f_workaround(x) ++ real, dimension(:), allocatable :: f_workaround ++ real, dimension(:), intent(in) :: x ++ real, dimension(:), allocatable :: tmp ++ allocate(f_workaround(2),tmp(2)) ++ tmp = matmul(b,x) ++ f_workaround = tmp ++ end function f_workaround ++ ++end module a + +program main -+ use TestRunner_mod, only: BaseTestRunner -+ use TestResult_mod, only: TestResult -+ implicit none -+ -+ type (TestResult) :: result -+ -+ call runtest (result) -+ -+contains -+ -+ subroutine runtest (result) -+ use TestResult_mod, only: TestResult -+ class (TestResult) :: result -+ call result%run() -+ if (result%numRun /= 1) call abort() -+ end subroutine -+ -+end -+ -+! { dg-final { cleanup-modules "TestResult_mod BaseTestRunner_mod TestRunner_mod" } } -Index: gcc/testsuite/gfortran.dg/proc_ptr_45.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/proc_ptr_45.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/proc_ptr_45.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,24 @@ -+! { dg-do compile } -+! -+! PR fortran/49397 -+! -+! Valid per IR F08/0060 and F2008Corr2, C729 -+! -+Program m5 -+ Print *,f() -+Contains -+ Subroutine s -+ Procedure(Real),Pointer :: p -+ Print *,g() -+ p => f ! (1) -+ Print *,p() -+ p => g ! (2) -+ Print *,p() -+ End Subroutine -+End Program -+Function f() -+ f = 1 -+End Function -+Function g() -+ g = 2 -+End Function -Index: gcc/testsuite/gfortran.dg/pr59700.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/pr59700.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/pr59700.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,40 @@ -+! { dg-do run } -+! PR59700 Test case by Steve Kargl -+program foo -+ ++ use a + implicit none -+ -+ character(len=80) msg -+ integer, parameter :: fd = 10 -+ integer i1, i2, i3, i4 -+ real x1, x2, x3, x4 -+ complex c1, c2 -+ logical a -+ -+ open(unit=fd, status='scratch') -+ write(fd, '(A)') '1 2 3.4 q' -+ -+ rewind(fd) -+ msg = 'ok' -+ read(fd, *, err=10, iomsg=msg) i1, i2, i3, i4 -+10 if (msg /= 'Bad integer for item 3 in list input') call abort -+ rewind(fd) -+ msg = 'ok' -+ read(fd, *, err=20, iomsg=msg) x1, x2, x3, x4 -+20 if (msg /= 'Bad real number in item 4 of list input') call abort -+ rewind(fd) -+ msg = 'ok' -+ read(fd, *, err=30, iomsg=msg) i1, x2, x1, a -+30 if (msg /= 'Bad logical value while reading item 4') call abort -+ rewind(fd) -+ read(fd, *, err=31, iomsg=msg) i1, x2, a, x1 -+31 if (msg /= 'Bad repeat count in item 3 of list input') call abort -+ close(fd) -+ open(unit=fd, status='scratch') -+ write(fd, '(A)') '(1, 2) (3.4, q)' -+ rewind(fd) -+ msg = 'ok' -+ read(fd, *, err=40, iomsg=msg) c1, c2 -+40 if (msg /= 'Bad floating point number for item 2') call abort -+ close(fd) -+end program foo -Index: gcc/testsuite/gfortran.dg/ichar_3.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/ichar_3.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/ichar_3.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+! { dg-do compile } -+! -+! PR fortran/59599 -+! The call to ichar was triggering an ICE. -+! -+! Original testcase from Fran Martinez Fadrique <fmartinez@gmv.com> -+ -+character(1) cpk(2) -+integer res(2) -+cpk = 'a' -+res = ichar( cpk, kind=1 ) -+print *, ichar( cpk, kind=1 ) -+end -Index: gcc/testsuite/gfortran.dg/unlimited_polymorphic_15.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/unlimited_polymorphic_15.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/unlimited_polymorphic_15.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+! { dg-do compile } -+! -+! PR 59493: [OOP] ICE: Segfault on Class(*) pointer association -+! -+! Contributed by Hossein Talebi <talebi.hossein@gmail.com> -+ -+ implicit none -+ -+ type ty_mytype1 -+ end type -+ -+ class(ty_mytype1), allocatable, target:: cla1 -+ class(*), pointer :: ptr -+ -+ ptr => cla1 -+ -+end -Index: gcc/testsuite/gfortran.dg/fmt_g_1.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/fmt_g_1.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/fmt_g_1.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+! { dg-do run } -+! PR59771 Cleanup handling of Gw.0 and Gw.0Ee format -+! Test case prepared by Dominique d'Humieres <dominiq@lps.ens.fr> -+ PROGRAM FOO -+ character(len=60) :: buffer, buffer1 -+ -+ write (buffer ,'(6(1X,1PG9.0e2))') 0.0, 0.04, 0.06, 0.4, 0.6, 243.0 -+ write (buffer1,'(6(1X,1PE9.0e2))') 0.0, 0.04, 0.06, 0.4, 0.6, 243.0 -+ -+ if (buffer /= buffer1) call abort -+ end -Index: gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90 (.../branches/gcc-4_8-branch) ++ real, dimension(2) :: x = 1.0, y ++ y = f_workaround (x) ++ if (any (f_segfault (x) .ne. y)) call abort ++ if (any (f_segfault_plus (x) .ne. y)) call abort ++end program main +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c (.../branches/gcc-4_8-branch) @@ -0,0 +1,39 @@ -+! { dg-do run } -+! -+! PR fortran/59906 -+! -+! Contributed by H Anlauf <anlauf@gmx.de> -+! -+! Failed generate character scalar for scalarized loop for elemantal call. -+! -+program x -+ implicit none -+ call y('bbb') -+contains -+ -+ subroutine y(str) -+ character(len=*), intent(in) :: str -+ character(len=len_trim(str)) :: str_aux -+ character(len=3) :: str3 = 'abc' -+ -+ str_aux = str -+ -+ ! Compiled but did not give correct result -+ if (any (str_cmp((/'aaa','bbb'/), str) .neqv. [.FALSE.,.TRUE.])) call abort -+ -+ ! Did not compile -+ if (any (str_cmp((/'bbb', 'aaa'/), str_aux) .neqv. [.TRUE.,.FALSE.])) call abort -+ -+ ! Verify patch -+ if (any (str_cmp((/'bbb', 'aaa'/), str3) .neqv. [.FALSE.,.FALSE.])) call abort -+ if (any (str_cmp((/'bbb', 'aaa'/), 'aaa') .neqv. [.FALSE.,.TRUE.])) call abort -+ -+ end subroutine y -+ -+ elemental logical function str_cmp(str1, str2) -+ character(len=*), intent(in) :: str1 -+ character(len=*), intent(in) :: str2 -+ str_cmp = (str1 == str2) -+ end function str_cmp -+ -+end program x -Index: gcc/testsuite/gcc.c-torture/execute/20140212-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/20140212-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/20140212-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* PR rtl-optimization/60116 */ -+/* Reported by Zhendong Su <su@cs.ucdavis.edu> */ -+ -+extern void abort (void); -+ -+int a, b, c, d = 1, e, f = 1, h, i, k; -+char g, j; -+ -+void -+fn1 (void) -+{ -+ int l; -+ e = 0; -+ c = 0; -+ for (;;) -+ { -+ k = a && b; -+ j = k * 54; -+ g = j * 147; -+ l = ~g + (long long) e && 1; -+ if (d) -+ c = l; -+ else -+ h = i = l * 9UL; -+ if (f) -+ return; -+ } -+} -+ -+int -+main (void) -+{ -+ fn1 (); -+ if (c != 1) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr58984.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr58984.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr58984.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,57 @@ -+/* PR tree-optimization/58984 */ -+ -+struct S { int f0 : 8; int : 6; int f1 : 5; }; -+struct T { char f0; int : 6; int f1 : 5; }; -+ -+int a, *c = &a, e, n, b, m; -+ -+static int -+foo (struct S p) -+{ -+ const unsigned short *f[36]; -+ for (; e < 2; e++) -+ { -+ const unsigned short **i = &f[0]; -+ *c ^= 1; -+ if (p.f1) -+ { -+ *i = 0; -+ return b; -+ } -+ } -+ return 0; -+} -+ -+static int -+bar (struct T p) -+{ -+ const unsigned short *f[36]; -+ for (; e < 2; e++) -+ { -+ const unsigned short **i = &f[0]; -+ *c ^= 1; -+ if (p.f1) -+ { -+ *i = 0; -+ return b; -+ } -+ } -+ return 0; -+} ++#ifdef __INT32_TYPE__ ++typedef __INT32_TYPE__ int32_t; ++#else ++typedef int int32_t; ++#endif + -+int -+main () -+{ -+ struct S o = { 1, 1 }; -+ foo (o); -+ m = n || o.f0; -+ if (a != 1) -+ __builtin_abort (); -+ e = 0; -+ struct T p = { 1, 1 }; -+ bar (p); -+ m |= n || p.f0; -+ if (a != 0) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr60454.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr60454.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr60454.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#else +typedef unsigned uint32_t; +#endif + -+#define __fake_const_swab32(x) ((uint32_t)( \ -+ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ -+ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ -+ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 8) | \ -+ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) ) | \ -+ (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24))) ++#define __fake_const_swab32(x) ((uint32_t)( \ ++ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ ++ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ ++ (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ ++ (( (int32_t)(x) & (int32_t)0xff000000UL) >> 24))) + -+/* Previous version of bswap optimization would detect byte swap when none -+ happen. This test aims at catching such wrong detection to avoid -+ regressions. */ ++/* Previous version of bswap optimization failed to consider sign extension ++ and as a result would replace an expression *not* doing a bswap by a ++ bswap. */ + +__attribute__ ((noinline, noclone)) uint32_t -+fake_swap32 (uint32_t in) ++fake_bswap32 (uint32_t in) +{ + return __fake_const_swab32 (in); +} + -+int main(void) -+{ -+ if (sizeof (uint32_t) * __CHAR_BIT__ != 32) -+ return 0; -+ if (fake_swap32 (0x12345678UL) != 0x78567E12UL) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr60017.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr60017.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr60017.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+/* PR target/60017 */ -+ -+extern void abort (void); -+ -+struct S0 -+{ -+ short m0; -+ short m1; -+}; -+ -+struct S1 -+{ -+ unsigned m0:1; -+ char m1[2][2]; -+ struct S0 m2[2]; -+}; -+ -+struct S1 x = { 1, {{2, 3}, {4, 5}}, {{6, 7}, {8, 9}} }; -+ -+struct S1 func (void) -+{ -+ return x; -+} -+ -+int main (void) -+{ -+ struct S1 ret = func (); -+ -+ if (ret.m2[1].m1 != 9) -+ abort (); -+ -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/20131127-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/20131127-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/20131127-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* PR middle-end/59138 */ -+/* Testcase by John Regehr <regehr@cs.utah.edu> */ -+ -+extern void abort (void); -+ -+#pragma pack(1) -+ -+struct S0 { -+ int f0; -+ int f1; -+ int f2; -+ short f3; -+}; -+ -+short a = 1; -+ -+struct S0 b = { 1 }, c, d, e; -+ -+struct S0 fn1() { return c; } -+ -+void fn2 (void) -+{ -+ b = fn1 (); -+ a = 0; -+ d = e; -+} -+ -+int main (void) -+{ -+ fn2 (); -+ if (a != 0) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr59358.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr59358.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr59358.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,44 @@ -+/* PR tree-optimization/59358 */ -+ -+__attribute__((noinline, noclone)) int -+foo (int *x, int y) -+{ -+ int z = *x; -+ if (y > z && y <= 16) -+ while (y > z) -+ z *= 2; -+ return z; -+} -+ +int -+main () ++main(void) +{ -+ int i; -+ for (i = 1; i < 17; i++) -+ { -+ int j = foo (&i, 16); -+ int k; -+ if (i >= 8 && i <= 15) -+ k = 16 + (i - 8) * 2; -+ else if (i >= 4 && i <= 7) -+ k = 16 + (i - 4) * 4; -+ else if (i == 3) -+ k = 24; -+ else -+ k = 16; -+ if (j != k) -+ __builtin_abort (); -+ j = foo (&i, 7); -+ if (i >= 7) -+ k = i; -+ else if (i >= 4) -+ k = 8 + (i - 4) * 2; -+ else if (i == 3) -+ k = 12; -+ else -+ k = 8; -+ if (j != k) -+ __builtin_abort (); -+ } -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr60062.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr60062.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr60062.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,25 @@ -+/* PR target/60062 */ -+ -+int a; -+ -+static void -+foo (const char *p1, int p2) -+{ -+ if (__builtin_strcmp (p1, "hello") != 0) -+ __builtin_abort (); -+} -+ -+static void -+bar (const char *p1) -+{ -+ if (__builtin_strcmp (p1, "hello") != 0) -+ __builtin_abort (); -+} -+ -+__attribute__((optimize (0))) int -+main () -+{ -+ foo ("hello", a); -+ bar ("hello"); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr59014-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr59014-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr59014-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,23 @@ -+/* PR tree-optimization/59014 */ -+ -+__attribute__((noinline, noclone)) long long int -+foo (long long int x, long long int y) -+{ -+ if (((int) x | (int) y) != 0) -+ return 6; -+ return x + y; -+} -+ -+int -+main () -+{ -+ if (sizeof (long long) == sizeof (int)) ++ if (sizeof (int32_t) * __CHAR_BIT__ != 32) + return 0; -+ int shift_half = sizeof (int) * __CHAR_BIT__ / 2; -+ long long int x = (3LL << shift_half) << shift_half; -+ long long int y = (5LL << shift_half) << shift_half; -+ long long int z = foo (x, y); -+ if (z != ((8LL << shift_half) << shift_half)) ++ if (sizeof (uint32_t) * __CHAR_BIT__ != 32) ++ return 0; ++ if (fake_bswap32 (0x87654321) != 0xffffff87) + __builtin_abort (); + return 0; +} -Index: gcc/testsuite/gcc.c-torture/execute/pr59101.c +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-3.c =================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr59101.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr59101.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* PR target/59101 */ -+ -+__attribute__((noinline, noclone)) int -+foo (int a) -+{ -+ return (~a & 4102790424LL) > 0 | 6; -+} +--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,13 @@ ++short a = -1; ++int b; ++char c; + +int +main () +{ -+ if (foo (0) != 7) ++ c = a; ++ b = a | c; ++ if (b != -1) + __builtin_abort (); + return 0; +} -Index: gcc/testsuite/gcc.c-torture/execute/pr58831.c +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-2.c =================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr58831.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr58831.c (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c (.../branches/gcc-4_8-branch) @@ -0,0 +1,40 @@ -+#include <assert.h> -+ -+int a, *b, c, d, f, **i, p, q, *r; -+short o, j; ++#ifdef __INT16_TYPE__ ++typedef __INT16_TYPE__ int16_t; ++#else ++typedef short int16_t; ++#endif + -+static int __attribute__((noinline, noclone)) -+fn1 (int *p1, int **p2) -+{ -+ int **e = &b; -+ for (; p; p++) -+ *p1 = 1; -+ *e = *p2 = &d; ++#ifdef __UINT32_TYPE__ ++typedef __UINT32_TYPE__ uint32_t; ++#else ++typedef unsigned uint32_t; ++#endif + -+ assert (r); ++#define __fake_const_swab32(x) ((uint32_t)( \ ++ (((uint32_t) (x) & (uint32_t)0x000000ffUL) << 24) | \ ++ (((uint32_t)(int16_t)(x) & (uint32_t)0x00ffff00UL) << 8) | \ ++ (((uint32_t) (x) & (uint32_t)0x00ff0000UL) >> 8) | \ ++ (((uint32_t) (x) & (uint32_t)0xff000000UL) >> 24))) + -+ return c; -+} + -+static int ** __attribute__((noinline, noclone)) -+fn2 (void) -+{ -+ for (f = 0; f != 42; f++) -+ { -+ int *g[3] = {0, 0, 0}; -+ for (o = 0; o; o--) -+ for (; a > 1;) -+ { -+ int **h[1] = { &g[2] }; -+ } -+ } -+ return &r; -+} ++/* Previous version of bswap optimization failed to consider sign extension ++ and as a result would replace an expression *not* doing a bswap by a ++ bswap. */ + -+int -+main (void) -+{ -+ i = fn2 (); -+ fn1 (b, i); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr58726.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr58726.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr58726.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,26 @@ -+/* PR rtl-optimization/58726 */ -+ -+int a, c; -+union { int f1; int f2 : 1; } b; -+ -+short -+foo (short p) ++__attribute__ ((noinline, noclone)) uint32_t ++fake_bswap32 (uint32_t in) +{ -+ return p < 0 ? p : a; ++ return __fake_const_swab32 (in); +} + +int -+main () ++main(void) +{ -+ if (sizeof (short) * __CHAR_BIT__ != 16 -+ || sizeof (int) * __CHAR_BIT__ != 32) ++ if (sizeof (uint32_t) * __CHAR_BIT__ != 32) + return 0; -+ b.f1 = 56374; -+ unsigned short d; -+ int e = b.f2; -+ d = e == 0 ? b.f1 : 0; -+ c = foo (d); -+ if (c != (short) 56374) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr59014.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr59014.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr59014.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,25 @@ -+/* PR tree-optimization/59014 */ -+ -+int a = 2, b, c, d; -+ -+int -+foo () -+{ -+ for (;; c++) -+ if ((b > 0) | (a & 1)) -+ ; -+ else -+ { -+ d = a; -+ return 0; -+ } -+} -+ -+int -+main () -+{ -+ foo (); -+ if (d != 2) ++ if (sizeof (int16_t) * __CHAR_BIT__ != 16) ++ return 0; ++ if (fake_bswap32 (0x81828384) != 0xff838281) + __builtin_abort (); + return 0; +} -Index: gcc/testsuite/gcc.c-torture/execute/pr60072.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr60072.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr60072.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* PR target/60072 */ -+ -+int c = 1; -+ -+__attribute__ ((optimize (1))) -+static int *foo (int *p) -+{ -+ return p; -+} -+ -+int -+main () -+{ -+ *foo (&c) = 2; -+ return c - 2; -+} -Index: gcc/testsuite/gcc.c-torture/execute/20140326-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/20140326-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/20140326-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+int a; -+ -+int -+main (void) -+{ -+ char e[2] = { 0, 0 }, f = 0; -+ if (a == 131072) -+ f = e[a]; -+ return f; -+} -Index: gcc/testsuite/gcc.c-torture/execute/pr59388.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/execute/pr59388.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr59388.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* PR tree-optimization/59388 */ -+ -+int a; -+struct S { unsigned int f:1; } b; -+ -+int -+main () -+{ -+ a = (0 < b.f) | b.f; -+ return a; -+} -Index: gcc/testsuite/gcc.c-torture/compile/pr58970-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/compile/pr58970-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr58970-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* PR middle-end/58970 */ -+ -+struct T { int b : 1; }; -+struct S { struct T t[1]; }; -+ -+void -+foo (int x, struct S *s) -+{ -+ if (x == -1) -+ s->t[x].b = 0; -+} -Index: gcc/testsuite/gcc.c-torture/compile/pr59803.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/compile/pr59803.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr59803.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,27 @@ -+/* PR target/59803 */ -+ -+extern void baz (void) __attribute__ ((__noreturn__)); -+struct A { int g, h; }; -+extern struct A a; -+struct B { unsigned char i, j, k, l, m; }; -+int c, d, e; -+static int f; -+ -+void -+foo (void) -+{ -+ f = 1; -+} -+ -+void -+bar (struct B *x) -+{ -+ x->i = e; -+ x->k = c; -+ x->l = d; -+ x->j = a.h; -+ x->m = f; -+ if (x->i != e) baz (); -+ if (x->k != c) baz (); -+ if (x->j != a.h) baz (); -+} -Index: gcc/testsuite/gcc.c-torture/compile/pr58997.c +Index: gcc/testsuite/gcc.c-torture/compile/pr61684.c =================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/compile/pr58997.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr58997.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+/* PR rtl-optimization/58997 */ +--- a/src/gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,15 @@ ++/* PR tree-optimization/61684 */ + -+int a, b, c, e; ++int a, c; ++static int *b = 0; +short d; -+char h; ++static short **e = 0; + +void +foo () +{ -+ while (b) -+ { -+ d = a ? c : 1 % a; -+ c = d; -+ h = d; -+ if (!h) -+ while (e) -+ ; -+ } -+} -Index: gcc/testsuite/gcc.c-torture/compile/pr58970-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/compile/pr58970-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr58970-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* PR middle-end/58970 */ -+ -+struct T { char a : 8; char b : 1; }; -+struct S { char x; struct T t[1]; }; -+ -+void -+foo (int x, struct S *s) -+{ -+ if (x == -1) -+ s->t[x].b = 0; -+} -Index: gcc/testsuite/gcc.c-torture/compile/pr59362.c -=================================================================== ---- a/src/gcc/testsuite/gcc.c-torture/compile/pr59362.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr59362.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* PR tree-optimization/59362 */ -+ -+char * -+foo (char *r, int s) -+{ -+ r = __builtin___stpcpy_chk (r, "abc", __builtin_object_size (r, 1)); -+ if (s) -+ r = __builtin___stpcpy_chk (r, "d", __builtin_object_size (r, 1)); -+ return r; -+} -+ -+char *a; -+long int b; -+ -+void -+bar (void) -+{ -+ b = __builtin_object_size (0, 0); -+ a = __builtin___stpcpy_chk (0, "", b); -+ b = __builtin_object_size (a, 0); ++ for (; c < 1; c++) ++ ; ++ *e = &d; ++ a = d && (c && 1) & *b; +} -Index: gcc/testsuite/gnat.dg/opt32.adb +Index: gcc/testsuite/gnat.dg/opt39.adb =================================================================== ---- a/src/gcc/testsuite/gnat.dg/opt32.adb (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gnat.dg/opt32.adb (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ +--- a/src/gcc/testsuite/gnat.dg/opt39.adb (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gnat.dg/opt39.adb (.../branches/gcc-4_8-branch) +@@ -0,0 +1,31 @@ +-- { dg-do compile } -+-- { dg-options "-O2" } -+ -+with Ada.Containers; use Ada.Containers; -+with Ada.Containers.Vectors; -+ -+function Opt32 return Natural is ++-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" } + -+ package My_Vectors -+ is new Vectors (Index_Type => Natural, Element_Type => Integer); -+ use My_Vectors; ++procedure Opt39 (I : Integer) is + -+ V : Vector; ++ type Rec is record ++ I1 : Integer; ++ I2 : Integer; ++ I3 : Integer; ++ I4 : Integer; ++ I5 : Integer; ++ end record; + -+ function Sign_Changes return Natural is -+ Cur : Cursor := To_Cursor (V, 0); -+ R : Natural := 0; -+ Negative : Boolean; -+ begin -+ Negative := Element (Cur) < 0; ++ procedure Set (A : access Rec; I : Integer) is ++ Tmp : Rec := A.all; ++ begin ++ Tmp.I1 := I; ++ A.all := Tmp; ++ end; + -+ loop -+ Cur := Next (Cur); -+ exit when R > 100; -+ -+ if (Element (Cur) < 0) /= Negative then -+ Negative := not Negative; -+ R := R + 1; -+ end if; -+ end loop; -+ -+ return R; -+ end; ++ R : aliased Rec; + +begin -+ return Sign_Changes; ++ Set (R'Access, I); ++ if R.I1 /= I then ++ raise Program_Error; ++ end if; +end; -Index: gcc/testsuite/gcc.dg/pr58668.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr58668.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr58668.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,25 @@ -+/* PR rtl-optimization/58668 */ -+/* { dg-do compile } */ -+/* { dg-options "-O2" } */ -+/* { dg-additional-options "-mthumb" { target { { arm*-*-* } && arm_thumb2_ok } } } */ + -+void *fn1 (void *); -+void *fn2 (void *, const char *); -+void fn3 (void *); -+void fn4 (void *, int); -+ -+void * -+test (void *x) -+{ -+ void *a, *b; -+ if (!(a = fn1 (x))) -+ return (void *) 0; -+ if (!(b = fn2 (a, "w"))) -+ { -+ fn3 (a); -+ return (void *) 0; -+ } -+ fn3 (a); -+ fn4 (b, 1); -+ return b; -+} -Index: gcc/testsuite/gcc.dg/pr57518.c ++-- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } ++-- { dg-final { cleanup-tree-dump "optimized" } } +Index: gcc/testsuite/gnat.dg/overflow_fixed.adb =================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr57518.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr57518.c (.../branches/gcc-4_8-branch) -@@ -1,8 +1,8 @@ --/* PR rtl-optimization/57130 */ -+/* PR rtl-optimization/57518 */ - - /* { dg-do compile } */ - /* { dg-options "-O2 -fdump-rtl-ira" } */ --/* { dg-final { scan-rtl-dump-not "REG_EQUIV.*mem.*\"ip\"" "ira" } } */ -+/* { dg-final { scan-rtl-dump-not "REG_EQUIV\[^\n\]*mem\[^\n\]*\"ip\".*subreg" "ira" } } */ - - char ip[10]; - int total; -Index: gcc/testsuite/gcc.dg/builtin-object-size-14.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/builtin-object-size-14.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/builtin-object-size-14.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,28 @@ -+/* { dg-do run } */ -+/* { dg-options "-O2" } */ -+ -+extern void abort (void); -+extern char *strncpy(char *, const char *, __SIZE_TYPE__); -+ -+union u { -+ struct { -+ char vi[8]; -+ char pi[16]; -+ }; -+ char all[8+16+4]; -+}; -+ -+void __attribute__((noinline,noclone)) -+f(union u *u) -+{ -+ char vi[8+1]; -+ __builtin_strncpy(vi, u->vi, sizeof(u->vi)); -+ if (__builtin_object_size (u->all, 1) != -1) -+ abort (); -+} -+int main() -+{ -+ union u u; -+ f (&u); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/gomp/pr58809.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/gomp/pr58809.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/gomp/pr58809.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* PR middle-end/58809 */ -+/* { dg-do compile } */ -+/* { dg-options "-fopenmp -O" } */ -+ -+int i; -+#pragma omp threadprivate (i) -+ -+void foo() -+{ -+ _Complex int j; -+#pragma omp parallel copyin (i) reduction (&&:j) -+ ; -+} -Index: gcc/testsuite/gcc.dg/20050922-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/20050922-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/20050922-1.c (.../branches/gcc-4_8-branch) -@@ -4,7 +4,7 @@ - /* { dg-do run } */ - /* { dg-options "-O1 -std=c99" } */ - --#include <stdlib.h> -+extern void abort (void); - - #if __INT_MAX__ == 2147483647 - typedef unsigned int uint32_t; -Index: gcc/testsuite/gcc.dg/pr46309.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr46309.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr46309.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* PR tree-optimization/46309 */ --/* { dg-do compile } */ -+/* { dg-do compile { target { ! { cris*-*-* } } } } */ - /* { dg-options "-O2 -fdump-tree-reassoc-details" } */ - /* The transformation depends on BRANCH_COST being greater than 1 - (see the notes in the PR), so try to force that. */ -Index: gcc/testsuite/gcc.dg/pr60485-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr60485-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr60485-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,38 @@ -+/* { dg-do run } */ -+/* { dg-options "-O2" } */ -+ -+extern void abort (void); -+struct S { -+ int *i[4]; -+ int *p1; -+ int *p2; -+ int *p3; -+ int *p4; -+ int **x; -+}; -+int **b; -+int main() -+{ -+ int i = 1; -+ struct S s; -+ s.p3 = &i; -+ int **p; -+ if (b) -+ p = b; -+ else -+ p = &s.i[2]; -+ p += 4; -+ /* prevert fowrprop from creating an offsetted sd constraint and -+ preserve the pointer offsetting constraint. */ -+ s.x = p; -+ p = s.x; -+ if (!b) -+ { -+ int *z = *p; -+ /* z should point to i (and non-local/escaped). */ -+ *z = 0; -+ } -+ if (i != 0) -+ abort (); -+ return i; -+} -Index: gcc/testsuite/gcc.dg/atomic-store-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/atomic-store-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/atomic-store-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* { dg-do run } */ -+/* { dg-require-effective-target sync_int_128_runtime } */ -+/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ -+ -+__int128_t i; -+ -+int main() -+{ -+ __atomic_store_16(&i, -1, 0); -+ if (i != -1) -+ __builtin_abort(); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/guality/pr59776.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/guality/pr59776.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/guality/pr59776.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* PR debug/59776 */ -+/* { dg-do run } */ -+/* { dg-options "-g" } */ -+ -+#include "../nop.h" -+ -+struct S { float f, g; }; -+ -+__attribute__((noinline, noclone)) void -+foo (struct S *p) -+{ -+ struct S s1, s2; /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */ -+ s1 = *p; /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" } } */ -+ s2 = s1; /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" } } */ -+ *(int *) &s2.f = 0; /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" } } */ -+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" } } */ -+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" } } */ -+ s2 = s1; /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" } } */ -+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" } } */ -+ asm volatile (NOP : : : "memory"); -+} -+ -+int -+main () -+{ -+ struct S x = { 5.0f, 6.0f }; -+ foo (&x); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/pr59827.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr59827.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr59827.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* PR middle-end/59827 */ -+/* { dg-do compile } */ -+ -+int -+foo (int p[2][]) /* { dg-error "array type has incomplete element type" } */ -+{ -+ return p[0][0]; -+} -+ -+void -+bar (void) -+{ -+ int p[2][1]; -+ foo (p); /* { dg-error "type of formal parameter 1 is incomplete" } */ -+} -Index: gcc/testsuite/gcc.dg/vmx/stl-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/stl-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/stl-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,83 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ check (svuc[i] == i, "svuc"); -+ check (svsc[i] == i - 8, "svsc"); -+ check (svbc[i] == ((i % 2) ? 0xff : 0), "svbc"); -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ check (svus[i] == i, "svus"); -+ check (svss[i] == i - 4, "svss"); -+ check (svbs[i] == ((i % 2) ? 0xffff : 0), "svbs"); -+ check (svp[i] == i, "svp"); -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ check (svui[i] == i, "svui"); -+ check (svsi[i] == i - 2, "svsi"); -+ check (svbi[i] == ((i % 2) ? 0xffffffff : 0), "svbi"); -+ check (svf[i] == i * 1.0f, "svf"); -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; -+ vector signed char vsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8}; -+ vector bool char vbc = {255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0}; -+ vector unsigned short vus = {7,6,5,4,3,2,1,0}; -+ vector signed short vss = {3,2,1,0,-1,-2,-3,-4}; -+ vector bool short vbs = {65535,0,65535,0,65535,0,65535,0}; -+ vector pixel vp = {7,6,5,4,3,2,1,0}; -+ vector unsigned int vui = {3,2,1,0}; -+ vector signed int vsi = {1,0,-1,-2}; -+ vector bool int vbi = {0xffffffff,0,0xffffffff,0}; -+ vector float vf = {3.0,2.0,1.0,0.0}; -+#else -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel vp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector bool int vbi = {0,0xffffffff,0,0xffffffff}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+#endif -+ -+ vec_stl (vuc, 0, (vector unsigned char *)svuc); -+ vec_stl (vsc, 0, (vector signed char *)svsc); -+ vec_stl (vbc, 0, (vector bool char *)svbc); -+ vec_stl (vus, 0, (vector unsigned short *)svus); -+ vec_stl (vss, 0, (vector signed short *)svss); -+ vec_stl (vbs, 0, (vector bool short *)svbs); -+ vec_stl (vp, 0, (vector pixel *)svp); -+ vec_stl (vui, 0, (vector unsigned int *)svui); -+ vec_stl (vsi, 0, (vector signed int *)svsi); -+ vec_stl (vbi, 0, (vector bool int *)svbi); -+ vec_stl (vf, 0, (vector float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/perm-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/perm-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/perm-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,74 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; -+ vector signed char vsca = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector float vfa = {-4.0,-3.0,-2.0,-1.0}; -+ vector float vfb = {0.0,1.0,2.0,3.0}; -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vucp = {15,16,14,17,13,18,12,19,11,20,10,21,9,22,8,23}; -+ vector unsigned char vscp = {15,16,14,17,13,18,12,19,11,20,10,21,9,22,8,23}; -+ vector unsigned char vusp = {15,14,17,16,13,12,19,18,11,10,21,20,9,8,23,22}; -+ vector unsigned char vssp = {15,14,17,16,13,12,19,18,11,10,21,20,9,8,23,22}; -+ vector unsigned char vuip = {15,14,13,12,19,18,17,16,11,10,9,8,23,22,21,20}; -+ vector unsigned char vsip = {15,14,13,12,19,18,17,16,11,10,9,8,23,22,21,20}; -+ vector unsigned char vfp = {15,14,13,12,19,18,17,16,11,10,9,8,23,22,21,20}; -+#else -+ vector unsigned char vucp = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ vector unsigned char vscp = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ vector unsigned char vusp = {0,1,30,31,2,3,28,29,4,5,26,27,6,7,24,25}; -+ vector unsigned char vssp = {0,1,30,31,2,3,28,29,4,5,26,27,6,7,24,25}; -+ vector unsigned char vuip = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+ vector unsigned char vsip = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+ vector unsigned char vfp = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+#endif -+ -+ /* Result vectors. */ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector float vf; -+ -+ /* Expected result vectors. */ -+ vector unsigned char vucr = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ vector signed char vscr = {-16,15,-15,14,-14,13,-13,12,-12,11,-11,10,-10,9,-9,8}; -+ vector unsigned short vusr = {0,15,1,14,2,13,3,12}; -+ vector signed short vssr = {-8,7,-7,6,-6,5,-5,4}; -+ vector unsigned int vuir = {0,7,1,6}; -+ vector signed int vsir = {-4,3,-3,2}; -+ vector float vfr = {-4.0,3.0,-3.0,2.0}; -+ -+ vuc = vec_perm (vuca, vucb, vucp); -+ vsc = vec_perm (vsca, vscb, vscp); -+ vus = vec_perm (vusa, vusb, vusp); -+ vss = vec_perm (vssa, vssb, vssp); -+ vui = vec_perm (vuia, vuib, vuip); -+ vsi = vec_perm (vsia, vsib, vsip); -+ vf = vec_perm (vfa, vfb, vfp ); -+ -+ check (vec_all_eq (vuc, vucr), "vuc"); -+ check (vec_all_eq (vsc, vscr), "vsc"); -+ check (vec_all_eq (vus, vusr), "vus"); -+ check (vec_all_eq (vss, vssr), "vss"); -+ check (vec_all_eq (vui, vuir), "vui"); -+ check (vec_all_eq (vsi, vsir), "vsi"); -+ check (vec_all_eq (vf, vfr), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/insert-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/insert-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/insert-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,65 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char va = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vb = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vc = {0,1,2,3,4,5,6,7}; -+ vector signed short vd = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int ve = {0,1,2,3}; -+ vector signed int vf = {-2,-1,0,1}; -+ vector float vg = {-2.0f,-1.0f,0.0f,1.0f}; -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ check (vec_all_eq (vec_insert (16, va, 5), -+ ((vector unsigned char) -+ {0,1,2,3,4,5,6,7,8,9,16,11,12,13,14,15})), -+ "vec_insert (va LE)"); -+ check (vec_all_eq (vec_insert (-16, vb, 0), -+ ((vector signed char) -+ {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,-16})), -+ "vec_insert (vb LE)"); -+ check (vec_all_eq (vec_insert (16, vc, 7), -+ ((vector unsigned short){16,1,2,3,4,5,6,7})), -+ "vec_insert (vc LE)"); -+ check (vec_all_eq (vec_insert (-16, vd, 3), -+ ((vector signed short){-4,-3,-2,-1,-16,1,2,3})), -+ "vec_insert (vd LE)"); -+ check (vec_all_eq (vec_insert (16, ve, 2), -+ ((vector unsigned int){0,16,2,3})), -+ "vec_insert (ve LE)"); -+ check (vec_all_eq (vec_insert (-16, vf, 1), -+ ((vector signed int){-2,-1,-16,1})), -+ "vec_insert (vf LE)"); -+ check (vec_all_eq (vec_insert (-16.0f, vg, 0), -+ ((vector float){-2.0f,-1.0f,0.0f,-16.0f})), -+ "vec_insert (vg LE)"); -+#else -+ check (vec_all_eq (vec_insert (16, va, 5), -+ ((vector unsigned char) -+ {0,1,2,3,4,16,6,7,8,9,10,11,12,13,14,15})), -+ "vec_insert (va BE)"); -+ check (vec_all_eq (vec_insert (-16, vb, 0), -+ ((vector signed char) -+ {-16,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7})), -+ "vec_insert (vb BE)"); -+ check (vec_all_eq (vec_insert (16, vc, 7), -+ ((vector unsigned short){0,1,2,3,4,5,6,16})), -+ "vec_insert (vc BE)"); -+ check (vec_all_eq (vec_insert (-16, vd, 3), -+ ((vector signed short){-4,-3,-2,-16,0,1,2,3})), -+ "vec_insert (vd BE)"); -+ check (vec_all_eq (vec_insert (16, ve, 2), -+ ((vector unsigned int){0,1,16,3})), -+ "vec_insert (ve BE)"); -+ check (vec_all_eq (vec_insert (-16, vf, 1), -+ ((vector signed int){-2,-16,0,1})), -+ "vec_insert (vf BE)"); -+ check (vec_all_eq (vec_insert (-16.0f, vg, 0), -+ ((vector float){-16.0f,-1.0f,0.0f,1.0f})), -+ "vec_insert (vg BE)"); -+#endif -+} -+ -Index: gcc/testsuite/gcc.dg/vmx/ldl.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ldl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ldl.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,91 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ svbc[i] = (i % 2) ? 0xff : 0; -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ svbs[i] = (i % 2) ? 0xffff : 0; -+ svp[i] = i; -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svbi[i] = (i % 2) ? 0xffffffff : 0; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char evuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char evsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char evbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short evus = {0,1,2,3,4,5,6,7}; -+ vector signed short evss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short evbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel evp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int evui = {0,1,2,3}; -+ vector signed int evsi = {-2,-1,0,1}; -+ vector bool int evbi = {0,0xffffffff,0,0xffffffff}; -+ vector float evf = {0.0,1.0,2.0,3.0}; -+ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector bool char vbc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector bool short vbs; -+ vector pixel vp; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector bool int vbi; -+ vector float vf; -+ -+ init (); -+ -+ vuc = vec_ldl (0, (vector unsigned char *)svuc); -+ vsc = vec_ldl (0, (vector signed char *)svsc); -+ vbc = vec_ldl (0, (vector bool char *)svbc); -+ vus = vec_ldl (0, (vector unsigned short *)svus); -+ vss = vec_ldl (0, (vector signed short *)svss); -+ vbs = vec_ldl (0, (vector bool short *)svbs); -+ vp = vec_ldl (0, (vector pixel *)svp); -+ vui = vec_ldl (0, (vector unsigned int *)svui); -+ vsi = vec_ldl (0, (vector signed int *)svsi); -+ vbi = vec_ldl (0, (vector bool int *)svbi); -+ vf = vec_ldl (0, (vector float *)svf); -+ -+ check (vec_all_eq (vuc, evuc), "vuc"); -+ check (vec_all_eq (vsc, evsc), "vsc"); -+ check (vec_all_eq (vbc, evbc), "vbc"); -+ check (vec_all_eq (vus, evus), "vus"); -+ check (vec_all_eq (vss, evss), "vss"); -+ check (vec_all_eq (vbs, evbs), "vbs"); -+ check (vec_all_eq (vp, evp ), "vp" ); -+ check (vec_all_eq (vui, evui), "vui"); -+ check (vec_all_eq (vsi, evsi), "vsi"); -+ check (vec_all_eq (vbi, evbi), "vbi"); -+ check (vec_all_eq (vf, evf ), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/stl-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/stl-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/stl-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ check (svul[i] == i, "svul"); -+ check (svd[i] == i * 1.0, "svd"); -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned long long vul = {1,0}; -+ vector double vd = {1.0,0.0}; -+#else -+ vector unsigned long long vul = {0,1}; -+ vector double vd = {0.0,1.0}; -+#endif -+ -+ vec_stl (vul, 0, (vector unsigned long long *)svul); -+ vec_stl (vd, 0, (vector double *)svd); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/vsums.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/vsums.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/vsums.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ vector signed int va = {-7,11,-13,17}; -+ vector signed int vb = {0,0,0,128}; -+ vector signed int evd = {0,0,0,136}; -+ -+ vector signed int vd = vec_sums (va, vb); -+ -+ check (vec_all_eq (vd, evd), "sums"); -+} -Index: gcc/testsuite/gcc.dg/vmx/insert-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/insert-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/insert-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static int vec_long_long_eq (vector long long x, vector long long y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static int vec_dbl_eq (vector double x, vector double y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static void test() -+{ -+ vector long long vl = {0, 1}; -+ vector double vd = {0.0, 1.0}; -+ vector long long vlr = vec_insert (2, vl, 0); -+ vector double vdr = vec_insert (2.0, vd, 1); -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector long long vler = {0, 2}; -+ vector double vder = {2.0, 1.0}; -+#else -+ vector long long vler = {2, 1}; -+ vector double vder = {0.0, 2.0}; -+#endif -+ -+ check (vec_long_long_eq (vlr, vler), "vl"); -+ check (vec_dbl_eq (vdr, vder), "vd"); -+} -Index: gcc/testsuite/gcc.dg/vmx/unpack.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/unpack.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/unpack.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,67 @@ -+#include "harness.h" -+ -+#define BIG 4294967295 -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255}; -+ vector pixel vp = {(0<<15) + (1<<10) + (2<<5) + 3, -+ (1<<15) + (4<<10) + (5<<5) + 6, -+ (0<<15) + (7<<10) + (8<<5) + 9, -+ (1<<15) + (10<<10) + (11<<5) + 12, -+ (1<<15) + (13<<10) + (14<<5) + 15, -+ (0<<15) + (16<<10) + (17<<5) + 18, -+ (1<<15) + (19<<10) + (20<<5) + 21, -+ (0<<15) + (22<<10) + (23<<5) + 24}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,65535,0,0,0,65535,0}; -+ -+ /* Result vectors. */ -+ vector signed short vsch, vscl; -+ vector bool short vbsh, vbsl; -+ vector unsigned int vuih, vuil; -+ vector signed int vsih, vsil; -+ vector bool int vbih, vbil; -+ -+ /* Expected result vectors. */ -+ vector signed short vschr = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vsclr = {0,1,2,3,4,5,6,7}; -+ vector bool short vbshr = {0,65535,65535,0,0,0,65535,0}; -+ vector bool short vbslr = {65535,0,0,65535,65535,65535,0,65535}; -+ vector unsigned int vuihr = {(0<<24) + (1<<16) + (2<<8) + 3, -+ (65535<<24) + (4<<16) + (5<<8) + 6, -+ (0<<24) + (7<<16) + (8<<8) + 9, -+ (65535<<24) + (10<<16) + (11<<8) + 12}; -+ vector unsigned int vuilr = {(65535<<24) + (13<<16) + (14<<8) + 15, -+ (0<<24) + (16<<16) + (17<<8) + 18, -+ (65535<<24) + (19<<16) + (20<<8) + 21, -+ (0<<24) + (22<<16) + (23<<8) + 24}; -+ vector signed int vsihr = {-4,-3,-2,-1}; -+ vector signed int vsilr = {0,1,2,3}; -+ vector bool int vbihr = {0,BIG,BIG,0}; -+ vector bool int vbilr = {0,0,BIG,0}; -+ -+ vsch = vec_unpackh (vsc); -+ vscl = vec_unpackl (vsc); -+ vbsh = vec_unpackh (vbc); -+ vbsl = vec_unpackl (vbc); -+ vuih = vec_unpackh (vp); -+ vuil = vec_unpackl (vp); -+ vsih = vec_unpackh (vss); -+ vsil = vec_unpackl (vss); -+ vbih = vec_unpackh (vbs); -+ vbil = vec_unpackl (vbs); -+ -+ check (vec_all_eq (vsch, vschr), "vsch"); -+ check (vec_all_eq (vscl, vsclr), "vscl"); -+ check (vec_all_eq (vbsh, vbshr), "vbsh"); -+ check (vec_all_eq (vbsl, vbslr), "vbsl"); -+ check (vec_all_eq (vuih, vuihr), "vuih"); -+ check (vec_all_eq (vuil, vuilr), "vuil"); -+ check (vec_all_eq (vsih, vsihr), "vsih"); -+ check (vec_all_eq (vsil, vsilr), "vsil"); -+ check (vec_all_eq (vbih, vbihr), "vbih"); -+ check (vec_all_eq (vbil, vbilr), "vbil"); -+} -Index: gcc/testsuite/gcc.dg/vmx/splat.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/splat.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/splat.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,47 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {-2.0,-1.0,0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector unsigned char vucr; -+ vector signed char vscr; -+ vector unsigned short vusr; -+ vector signed short vssr; -+ vector unsigned int vuir; -+ vector signed int vsir; -+ vector float vfr; -+ -+ /* Expected result vectors. */ -+ vector unsigned char vucer = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; -+ vector signed char vscer = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -+ vector unsigned short vuser = {7,7,7,7,7,7,7,7}; -+ vector signed short vsser = {-4,-4,-4,-4,-4,-4,-4,-4}; -+ vector unsigned int vuier = {2,2,2,2}; -+ vector signed int vsier = {1,1,1,1}; -+ vector float vfer = {-1.0,-1.0,-1.0,-1.0}; -+ -+ vucr = vec_splat (vuc, 1); -+ vscr = vec_splat (vsc, 8); -+ vusr = vec_splat (vus, 7); -+ vssr = vec_splat (vss, 0); -+ vuir = vec_splat (vui, 2); -+ vsir = vec_splat (vsi, 3); -+ vfr = vec_splat (vf, 1); -+ -+ check (vec_all_eq (vucr, vucer), "vuc"); -+ check (vec_all_eq (vscr, vscer), "vsc"); -+ check (vec_all_eq (vusr, vuser), "vus"); -+ check (vec_all_eq (vssr, vsser), "vss"); -+ check (vec_all_eq (vuir, vuier), "vui"); -+ check (vec_all_eq (vsir, vsier), "vsi"); -+ check (vec_all_eq (vfr, vfer ), "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/ldl-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ldl-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ldl-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,44 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ svul[i] = i; -+ svd[i] = i * 1.0; -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned long long evul = {1,0}; -+ vector double evd = {1.0,0.0}; -+#else -+ vector unsigned long long evul = {0,1}; -+ vector double evd = {0.0,1.0}; -+#endif -+ -+ vector unsigned long long vul; -+ vector double vd; -+ unsigned i; -+ -+ init (); -+ -+ vul = vec_ldl (0, (vector unsigned long long *)svul); -+ vd = vec_ldl (0, (vector double *)svd); -+ -+ for (i = 0; i < 2; ++i) -+ { -+ check (vul[i] == evul[i], "vul"); -+ check (vd[i] == evd[i], "vd" ); -+ } -+} -Index: gcc/testsuite/gcc.dg/vmx/merge-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/merge-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/merge-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,96 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb -+ = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; -+ vector signed char vsca -+ = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector float vfa = {-4.0,-3.0,-2.0,-1.0}; -+ vector float vfb = {0.0,1.0,2.0,3.0}; -+ -+ /* Result vectors. */ -+ vector unsigned char vuch, vucl; -+ vector signed char vsch, vscl; -+ vector unsigned short vush, vusl; -+ vector signed short vssh, vssl; -+ vector unsigned int vuih, vuil; -+ vector signed int vsih, vsil; -+ vector float vfh, vfl; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vucrh = {24,8,25,9,26,10,27,11,28,12,29,13,30,14,31,15}; -+ vector unsigned char vucrl = {16,0,17,1,18,2,19,3,20,4,21,5,22,6,23,7}; -+ vector signed char vscrh = {8,-8,9,-7,10,-6,11,-5,12,-4,13,-3,14,-2,15,-1}; -+ vector signed char vscrl = {0,-16,1,-15,2,-14,3,-13,4,-12,5,-11,6,-10,7,-9}; -+ vector unsigned short vusrh = {12,4,13,5,14,6,15,7}; -+ vector unsigned short vusrl = {8,0,9,1,10,2,11,3}; -+ vector signed short vssrh = {4,-4,5,-3,6,-2,7,-1}; -+ vector signed short vssrl = {0,-8,1,-7,2,-6,3,-5}; -+ vector unsigned int vuirh = {6,2,7,3}; -+ vector unsigned int vuirl = {4,0,5,1}; -+ vector signed int vsirh = {2,-2,3,-1}; -+ vector signed int vsirl = {0,-4,1,-3}; -+ vector float vfrh = {2.0,-2.0,3.0,-1.0}; -+ vector float vfrl = {0.0,-4.0,1.0,-3.0}; -+#else -+ vector unsigned char vucrh = {0,16,1,17,2,18,3,19,4,20,5,21,6,22,7,23}; -+ vector unsigned char vucrl = {8,24,9,25,10,26,11,27,12,28,13,29,14,30,15,31}; -+ vector signed char vscrh = {-16,0,-15,1,-14,2,-13,3,-12,4,-11,5,-10,6,-9,7}; -+ vector signed char vscrl = {-8,8,-7,9,-6,10,-5,11,-4,12,-3,13,-2,14,-1,15}; -+ vector unsigned short vusrh = {0,8,1,9,2,10,3,11}; -+ vector unsigned short vusrl = {4,12,5,13,6,14,7,15}; -+ vector signed short vssrh = {-8,0,-7,1,-6,2,-5,3}; -+ vector signed short vssrl = {-4,4,-3,5,-2,6,-1,7}; -+ vector unsigned int vuirh = {0,4,1,5}; -+ vector unsigned int vuirl = {2,6,3,7}; -+ vector signed int vsirh = {-4,0,-3,1}; -+ vector signed int vsirl = {-2,2,-1,3}; -+ vector float vfrh = {-4.0,0.0,-3.0,1.0}; -+ vector float vfrl = {-2.0,2.0,-1.0,3.0}; -+#endif -+ -+ vuch = vec_mergeh (vuca, vucb); -+ vucl = vec_mergel (vuca, vucb); -+ vsch = vec_mergeh (vsca, vscb); -+ vscl = vec_mergel (vsca, vscb); -+ vush = vec_mergeh (vusa, vusb); -+ vusl = vec_mergel (vusa, vusb); -+ vssh = vec_mergeh (vssa, vssb); -+ vssl = vec_mergel (vssa, vssb); -+ vuih = vec_mergeh (vuia, vuib); -+ vuil = vec_mergel (vuia, vuib); -+ vsih = vec_mergeh (vsia, vsib); -+ vsil = vec_mergel (vsia, vsib); -+ vfh = vec_mergeh (vfa, vfb ); -+ vfl = vec_mergel (vfa, vfb ); -+ -+ check (vec_all_eq (vuch, vucrh), "vuch"); -+ check (vec_all_eq (vucl, vucrl), "vucl"); -+ check (vec_all_eq (vsch, vscrh), "vsch"); -+ check (vec_all_eq (vscl, vscrl), "vscl"); -+ check (vec_all_eq (vush, vusrh), "vush"); -+ check (vec_all_eq (vusl, vusrl), "vusl"); -+ check (vec_all_eq (vssh, vssrh), "vssh"); -+ check (vec_all_eq (vssl, vssrl), "vssl"); -+ check (vec_all_eq (vuih, vuirh), "vuih"); -+ check (vec_all_eq (vuil, vuirl), "vuil"); -+ check (vec_all_eq (vsih, vsirh), "vsih"); -+ check (vec_all_eq (vsil, vsirl), "vsil"); -+ check (vec_all_eq (vfh, vfrh), "vfh"); -+ check (vec_all_eq (vfl, vfrl), "vfl"); -+} -Index: gcc/testsuite/gcc.dg/vmx/splat-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/splat-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/splat-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {-2.0,-1.0,0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector unsigned int vuir; -+ vector signed int vsir; -+ vector float vfr; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned int vuier = {1,1,1,1}; -+ vector signed int vsier = {-2,-2,-2,-2}; -+ vector float vfer = {0.0,0.0,0.0,0.0}; -+#else -+ vector unsigned int vuier = {2,2,2,2}; -+ vector signed int vsier = {1,1,1,1}; -+ vector float vfer = {-1.0,-1.0,-1.0,-1.0}; -+#endif -+ -+ vuir = vec_splat (vui, 2); -+ vsir = vec_splat (vsi, 3); -+ vfr = vec_splat (vf, 1); -+ -+ check (vec_all_eq (vuir, vuier), "vui"); -+ check (vec_all_eq (vsir, vsier), "vsi"); -+ check (vec_all_eq (vfr, vfer ), "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/merge.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/merge.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/merge.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,77 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb -+ = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; -+ vector signed char vsca -+ = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector float vfa = {-4.0,-3.0,-2.0,-1.0}; -+ vector float vfb = {0.0,1.0,2.0,3.0}; -+ -+ /* Result vectors. */ -+ vector unsigned char vuch, vucl; -+ vector signed char vsch, vscl; -+ vector unsigned short vush, vusl; -+ vector signed short vssh, vssl; -+ vector unsigned int vuih, vuil; -+ vector signed int vsih, vsil; -+ vector float vfh, vfl; -+ -+ /* Expected result vectors. */ -+ vector unsigned char vucrh = {0,16,1,17,2,18,3,19,4,20,5,21,6,22,7,23}; -+ vector unsigned char vucrl = {8,24,9,25,10,26,11,27,12,28,13,29,14,30,15,31}; -+ vector signed char vscrh = {-16,0,-15,1,-14,2,-13,3,-12,4,-11,5,-10,6,-9,7}; -+ vector signed char vscrl = {-8,8,-7,9,-6,10,-5,11,-4,12,-3,13,-2,14,-1,15}; -+ vector unsigned short vusrh = {0,8,1,9,2,10,3,11}; -+ vector unsigned short vusrl = {4,12,5,13,6,14,7,15}; -+ vector signed short vssrh = {-8,0,-7,1,-6,2,-5,3}; -+ vector signed short vssrl = {-4,4,-3,5,-2,6,-1,7}; -+ vector unsigned int vuirh = {0,4,1,5}; -+ vector unsigned int vuirl = {2,6,3,7}; -+ vector signed int vsirh = {-4,0,-3,1}; -+ vector signed int vsirl = {-2,2,-1,3}; -+ vector float vfrh = {-4.0,0.0,-3.0,1.0}; -+ vector float vfrl = {-2.0,2.0,-1.0,3.0}; -+ -+ vuch = vec_mergeh (vuca, vucb); -+ vucl = vec_mergel (vuca, vucb); -+ vsch = vec_mergeh (vsca, vscb); -+ vscl = vec_mergel (vsca, vscb); -+ vush = vec_mergeh (vusa, vusb); -+ vusl = vec_mergel (vusa, vusb); -+ vssh = vec_mergeh (vssa, vssb); -+ vssl = vec_mergel (vssa, vssb); -+ vuih = vec_mergeh (vuia, vuib); -+ vuil = vec_mergel (vuia, vuib); -+ vsih = vec_mergeh (vsia, vsib); -+ vsil = vec_mergel (vsia, vsib); -+ vfh = vec_mergeh (vfa, vfb ); -+ vfl = vec_mergel (vfa, vfb ); -+ -+ check (vec_all_eq (vuch, vucrh), "vuch"); -+ check (vec_all_eq (vucl, vucrl), "vucl"); -+ check (vec_all_eq (vsch, vscrh), "vsch"); -+ check (vec_all_eq (vscl, vscrl), "vscl"); -+ check (vec_all_eq (vush, vusrh), "vush"); -+ check (vec_all_eq (vusl, vusrl), "vusl"); -+ check (vec_all_eq (vssh, vssrh), "vssh"); -+ check (vec_all_eq (vssl, vssrl), "vssl"); -+ check (vec_all_eq (vuih, vuirh), "vuih"); -+ check (vec_all_eq (vuil, vuirl), "vuil"); -+ check (vec_all_eq (vsih, vsirh), "vsih"); -+ check (vec_all_eq (vsil, vsirl), "vsil"); -+ check (vec_all_eq (vfh, vfrh), "vfh"); -+ check (vec_all_eq (vfl, vfrl), "vfl"); -+} -Index: gcc/testsuite/gcc.dg/vmx/vec-set.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/vec-set.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/vec-set.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+#include "harness.h" -+ -+vector short -+vec_set (short m) -+{ -+ return (vector short){m, 0, 0, 0, 0, 0, 0, 0}; -+} -+ -+static void test() -+{ -+ check (vec_all_eq (vec_set (7), -+ ((vector short){7, 0, 0, 0, 0, 0, 0, 0})), -+ "vec_set"); -+} -Index: gcc/testsuite/gcc.dg/vmx/ld-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ld-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ld-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,44 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ svul[i] = i; -+ svd[i] = i * 1.0; -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned long long evul = {1,0}; -+ vector double evd = {1.0,0.0}; -+#else -+ vector unsigned long long evul = {0,1}; -+ vector double evd = {0.0,1.0}; -+#endif -+ -+ vector unsigned long long vul; -+ vector double vd; -+ unsigned i; -+ -+ init (); -+ -+ vul = vec_ld (0, (vector unsigned long long *)svul); -+ vd = vec_ld (0, (vector double *)svd); -+ -+ for (i = 0; i < 2; ++i) -+ { -+ check (vul[i] == evul[i], "vul"); -+ check (vd[i] == evd[i], "vd" ); -+ } -+} -Index: gcc/testsuite/gcc.dg/vmx/extract.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/extract.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/extract.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char va = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vb = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vc = {0,1,2,3,4,5,6,7}; -+ vector signed short vd = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int ve = {0,1,2,3}; -+ vector signed int vf = {-2,-1,0,1}; -+ vector float vg = {-2.0f,-1.0f,0.0f,1.0f}; -+ -+ check (vec_extract (va, 5) == 5, "vec_extract (va, 5)"); -+ check (vec_extract (vb, 0) == -8, "vec_extract (vb, 0)"); -+ check (vec_extract (vc, 7) == 7, "vec_extract (vc, 7)"); -+ check (vec_extract (vd, 3) == -1, "vec_extract (vd, 3)"); -+ check (vec_extract (ve, 2) == 2, "vec_extract (ve, 2)"); -+ check (vec_extract (vf, 1) == -1, "vec_extract (vf, 1)"); -+ check (vec_extract (vg, 0) == -2.0f, "vec_extract (vg, 0)"); -+} -+ -Index: gcc/testsuite/gcc.dg/vmx/pack-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/pack-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/pack-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,136 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+#define BIG 4294967295 -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector bool short vbsa = {0,65535,65535,0,0,0,65535,0}; -+ vector bool short vbsb = {65535,0,0,65535,65535,65535,0,65535}; -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector bool int vbia = {0,BIG,BIG,BIG}; -+ vector bool int vbib = {BIG,0,0,0}; -+ vector unsigned int vipa = {(0<<24) + (2<<19) + (3<<11) + (4<<3), -+ (1<<24) + (5<<19) + (6<<11) + (7<<3), -+ (0<<24) + (8<<19) + (9<<11) + (10<<3), -+ (1<<24) + (11<<19) + (12<<11) + (13<<3)}; -+ vector unsigned int vipb = {(1<<24) + (14<<19) + (15<<11) + (16<<3), -+ (0<<24) + (17<<19) + (18<<11) + (19<<3), -+ (1<<24) + (20<<19) + (21<<11) + (22<<3), -+ (0<<24) + (23<<19) + (24<<11) + (25<<3)}; -+ vector unsigned short vusc = {0,256,1,257,2,258,3,259}; -+ vector unsigned short vusd = {4,260,5,261,6,262,7,263}; -+ vector signed short vssc = {-1,-128,0,127,-2,-129,1,128}; -+ vector signed short vssd = {-3,-130,2,129,-4,-131,3,130}; -+ vector unsigned int vuic = {0,65536,1,65537}; -+ vector unsigned int vuid = {2,65538,3,65539}; -+ vector signed int vsic = {-1,-32768,0,32767}; -+ vector signed int vsid = {-2,-32769,1,32768}; -+ -+ /* Result vectors. */ -+ vector unsigned char vucr; -+ vector signed char vscr; -+ vector bool char vbcr; -+ vector unsigned short vusr; -+ vector signed short vssr; -+ vector bool short vbsr; -+ vector pixel vpr; -+ vector unsigned char vucsr; -+ vector signed char vscsr; -+ vector unsigned short vussr; -+ vector signed short vsssr; -+ vector unsigned char vucsur1, vucsur2; -+ vector unsigned short vussur1, vussur2; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vucer = {8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7}; -+ vector signed char vscer = {0,1,2,3,4,5,6,7,-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector bool char vbcer = {255,0,0,255,255,255,0,255,0,255,255,0,0,0,255,0}; -+ vector unsigned short vuser = {4,5,6,7,0,1,2,3}; -+ vector signed short vsser = {0,1,2,3,-4,-3,-2,-1}; -+ vector bool short vbser = {65535,0,0,0,0,65535,65535,65535}; -+ vector pixel vper = {(1<<15) + (14<<10) + (15<<5) + 16, -+ (0<<15) + (17<<10) + (18<<5) + 19, -+ (1<<15) + (20<<10) + (21<<5) + 22, -+ (0<<15) + (23<<10) + (24<<5) + 25, -+ (0<<15) + (2<<10) + (3<<5) + 4, -+ (1<<15) + (5<<10) + (6<<5) + 7, -+ (0<<15) + (8<<10) + (9<<5) + 10, -+ (1<<15) + (11<<10) + (12<<5) + 13}; -+ vector unsigned char vucser = {4,255,5,255,6,255,7,255,0,255,1,255,2,255,3,255}; -+ vector signed char vscser = {-3,-128,2,127,-4,-128,3,127, -+ -1,-128,0,127,-2,-128,1,127}; -+ vector unsigned short vusser = {2,65535,3,65535,0,65535,1,65535}; -+ vector signed short vssser = {-2,-32768,1,32767,-1,-32768,0,32767}; -+ vector unsigned char vucsuer1 = {4,255,5,255,6,255,7,255,0,255,1,255,2,255,3,255}; -+ vector unsigned char vucsuer2 = {0,0,2,129,0,0,3,130,0,0,0,127,0,0,1,128}; -+ vector unsigned short vussuer1 = {2,65535,3,65535,0,65535,1,65535}; -+ vector unsigned short vussuer2 = {0,0,1,32768,0,0,0,32767}; -+#else -+ vector unsigned char vucer = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vscer = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbcer = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255}; -+ vector unsigned short vuser = {0,1,2,3,4,5,6,7}; -+ vector signed short vsser = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbser = {0,65535,65535,65535,65535,0,0,0}; -+ vector pixel vper = {(0<<15) + (2<<10) + (3<<5) + 4, -+ (1<<15) + (5<<10) + (6<<5) + 7, -+ (0<<15) + (8<<10) + (9<<5) + 10, -+ (1<<15) + (11<<10) + (12<<5) + 13, -+ (1<<15) + (14<<10) + (15<<5) + 16, -+ (0<<15) + (17<<10) + (18<<5) + 19, -+ (1<<15) + (20<<10) + (21<<5) + 22, -+ (0<<15) + (23<<10) + (24<<5) + 25}; -+ vector unsigned char vucser = {0,255,1,255,2,255,3,255,4,255,5,255,6,255,7,255}; -+ vector signed char vscser = {-1,-128,0,127,-2,-128,1,127, -+ -3,-128,2,127,-4,-128,3,127}; -+ vector unsigned short vusser = {0,65535,1,65535,2,65535,3,65535}; -+ vector signed short vssser = {-1,-32768,0,32767,-2,-32768,1,32767}; -+ vector unsigned char vucsuer1 = {0,255,1,255,2,255,3,255,4,255,5,255,6,255,7,255}; -+ vector unsigned char vucsuer2 = {0,0,0,127,0,0,1,128,0,0,2,129,0,0,3,130}; -+ vector unsigned short vussuer1 = {0,65535,1,65535,2,65535,3,65535}; -+ vector unsigned short vussuer2 = {0,0,0,32767,0,0,1,32768}; -+#endif -+ -+ vucr = vec_pack (vusa, vusb); -+ vscr = vec_pack (vssa, vssb); -+ vbcr = vec_pack (vbsa, vbsb); -+ vusr = vec_pack (vuia, vuib); -+ vssr = vec_pack (vsia, vsib); -+ vbsr = vec_pack (vbia, vbib); -+ vpr = vec_packpx (vipa, vipb); -+ vucsr = vec_packs (vusc, vusd); -+ vscsr = vec_packs (vssc, vssd); -+ vussr = vec_packs (vuic, vuid); -+ vsssr = vec_packs (vsic, vsid); -+ vucsur1 = vec_packsu (vusc, vusd); -+ vucsur2 = vec_packsu (vssc, vssd); -+ vussur1 = vec_packsu (vuic, vuid); -+ vussur2 = vec_packsu (vsic, vsid); -+ -+ check (vec_all_eq (vucr, vucer), "vucr"); -+ check (vec_all_eq (vscr, vscer), "vscr"); -+ check (vec_all_eq (vbcr, vbcer), "vbcr"); -+ check (vec_all_eq (vusr, vuser), "vusr"); -+ check (vec_all_eq (vssr, vsser), "vssr"); -+ check (vec_all_eq (vbsr, vbser), "vbsr"); -+ check (vec_all_eq (vpr, vper ), "vpr" ); -+ check (vec_all_eq (vucsr, vucser), "vucsr"); -+ check (vec_all_eq (vscsr, vscser), "vscsr"); -+ check (vec_all_eq (vussr, vusser), "vussr"); -+ check (vec_all_eq (vsssr, vssser), "vsssr"); -+ check (vec_all_eq (vucsur1, vucsuer1), "vucsur1"); -+ check (vec_all_eq (vucsur2, vucsuer2), "vucsur2"); -+ check (vec_all_eq (vussur1, vussuer1), "vussur1"); -+ check (vec_all_eq (vussur2, vussuer2), "vussur2"); -+} -Index: gcc/testsuite/gcc.dg/vmx/st-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/st-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/st-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,83 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ check (svuc[i] == i, "svuc"); -+ check (svsc[i] == i - 8, "svsc"); -+ check (svbc[i] == ((i % 2) ? 0xff : 0), "svbc"); -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ check (svus[i] == i, "svus"); -+ check (svss[i] == i - 4, "svss"); -+ check (svbs[i] == ((i % 2) ? 0xffff : 0), "svbs"); -+ check (svp[i] == i, "svp"); -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ check (svui[i] == i, "svui"); -+ check (svsi[i] == i - 2, "svsi"); -+ check (svbi[i] == ((i % 2) ? 0xffffffff : 0), "svbi"); -+ check (svf[i] == i * 1.0f, "svf"); -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; -+ vector signed char vsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8}; -+ vector bool char vbc = {255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0}; -+ vector unsigned short vus = {7,6,5,4,3,2,1,0}; -+ vector signed short vss = {3,2,1,0,-1,-2,-3,-4}; -+ vector bool short vbs = {65535,0,65535,0,65535,0,65535,0}; -+ vector pixel vp = {7,6,5,4,3,2,1,0}; -+ vector unsigned int vui = {3,2,1,0}; -+ vector signed int vsi = {1,0,-1,-2}; -+ vector bool int vbi = {0xffffffff,0,0xffffffff,0}; -+ vector float vf = {3.0,2.0,1.0,0.0}; -+#else -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel vp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector bool int vbi = {0,0xffffffff,0,0xffffffff}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+#endif -+ -+ vec_st (vuc, 0, (vector unsigned char *)svuc); -+ vec_st (vsc, 0, (vector signed char *)svsc); -+ vec_st (vbc, 0, (vector bool char *)svbc); -+ vec_st (vus, 0, (vector unsigned short *)svus); -+ vec_st (vss, 0, (vector signed short *)svss); -+ vec_st (vbs, 0, (vector bool short *)svbs); -+ vec_st (vp, 0, (vector pixel *)svp); -+ vec_st (vui, 0, (vector unsigned int *)svui); -+ vec_st (vsi, 0, (vector signed int *)svsi); -+ vec_st (vbi, 0, (vector bool int *)svbi); -+ vec_st (vf, 0, (vector float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c (.../branches/gcc-4_8-branch) -@@ -13,6 +13,20 @@ - #define DO_INLINE __attribute__ ((always_inline)) - #define DONT_INLINE __attribute__ ((noinline)) - -+#ifdef __LITTLE_ENDIAN__ -+static inline DO_INLINE int inline_me(vector signed short data) -+{ -+ union {vector signed short v; signed short s[8];} u; -+ signed short x; -+ unsigned char x1, x2; -+ -+ u.v = data; -+ x = u.s[7]; -+ x1 = (x >> 8) & 0xff; -+ x2 = x & 0xff; -+ return ((x2 << 8) | x1); -+} -+#else - static inline DO_INLINE int inline_me(vector signed short data) - { - union {vector signed short v; signed short s[8];} u; -@@ -19,6 +33,7 @@ - u.v = data; - return u.s[7]; - } -+#endif - - static DONT_INLINE int foo(vector signed short data) - { -Index: gcc/testsuite/gcc.dg/vmx/eg-5.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/eg-5.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/eg-5.c (.../branches/gcc-4_8-branch) -@@ -6,12 +6,10 @@ - { - /* Set result to a vector of f32 0's */ - vector float result = ((vector float){0.,0.,0.,0.}); -- - result = vec_madd (c0, vec_splat (v, 0), result); - result = vec_madd (c1, vec_splat (v, 1), result); - result = vec_madd (c2, vec_splat (v, 2), result); - result = vec_madd (c3, vec_splat (v, 3), result); -- - return result; - } - -Index: gcc/testsuite/gcc.dg/vmx/st-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/st-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/st-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ check (svul[i] == i, "svul"); -+ check (svd[i] == i * 1.0, "svd"); -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned long long vul = {1,0}; -+ vector double vd = {1.0,0.0}; -+#else -+ vector unsigned long long vul = {0,1}; -+ vector double vd = {0.0,1.0}; -+#endif -+ -+ vec_st (vul, 0, (vector unsigned long long *)svul); -+ vec_st (vd, 0, (vector double *)svd); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/lde.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/lde.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/lde.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,59 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector float vf; -+ -+ init (); -+ -+ vuc = vec_lde (9*1, (unsigned char *)svuc); -+ vsc = vec_lde (14*1, (signed char *)svsc); -+ vus = vec_lde (7*2, (unsigned short *)svus); -+ vss = vec_lde (1*2, (signed short *)svss); -+ vui = vec_lde (3*4, (unsigned int *)svui); -+ vsi = vec_lde (2*4, (signed int *)svsi); -+ vf = vec_lde (0*4, (float *)svf); -+ -+ check (vec_extract (vuc, 9) == 9, "vuc"); -+ check (vec_extract (vsc, 14) == 6, "vsc"); -+ check (vec_extract (vus, 7) == 7, "vus"); -+ check (vec_extract (vss, 1) == -3, "vss"); -+ check (vec_extract (vui, 3) == 3, "vui"); -+ check (vec_extract (vsi, 2) == 0, "vsi"); -+ check (vec_extract (vf, 0) == 0.0, "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/pack.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/pack.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/pack.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,108 @@ -+#include "harness.h" -+ -+#define BIG 4294967295 -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector bool short vbsa = {0,65535,65535,0,0,0,65535,0}; -+ vector bool short vbsb = {65535,0,0,65535,65535,65535,0,65535}; -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector bool int vbia = {0,BIG,BIG,BIG}; -+ vector bool int vbib = {BIG,0,0,0}; -+ vector unsigned int vipa = {(0<<24) + (2<<19) + (3<<11) + (4<<3), -+ (1<<24) + (5<<19) + (6<<11) + (7<<3), -+ (0<<24) + (8<<19) + (9<<11) + (10<<3), -+ (1<<24) + (11<<19) + (12<<11) + (13<<3)}; -+ vector unsigned int vipb = {(1<<24) + (14<<19) + (15<<11) + (16<<3), -+ (0<<24) + (17<<19) + (18<<11) + (19<<3), -+ (1<<24) + (20<<19) + (21<<11) + (22<<3), -+ (0<<24) + (23<<19) + (24<<11) + (25<<3)}; -+ vector unsigned short vusc = {0,256,1,257,2,258,3,259}; -+ vector unsigned short vusd = {4,260,5,261,6,262,7,263}; -+ vector signed short vssc = {-1,-128,0,127,-2,-129,1,128}; -+ vector signed short vssd = {-3,-130,2,129,-4,-131,3,130}; -+ vector unsigned int vuic = {0,65536,1,65537}; -+ vector unsigned int vuid = {2,65538,3,65539}; -+ vector signed int vsic = {-1,-32768,0,32767}; -+ vector signed int vsid = {-2,-32769,1,32768}; -+ -+ /* Result vectors. */ -+ vector unsigned char vucr; -+ vector signed char vscr; -+ vector bool char vbcr; -+ vector unsigned short vusr; -+ vector signed short vssr; -+ vector bool short vbsr; -+ vector pixel vpr; -+ vector unsigned char vucsr; -+ vector signed char vscsr; -+ vector unsigned short vussr; -+ vector signed short vsssr; -+ vector unsigned char vucsur1, vucsur2; -+ vector unsigned short vussur1, vussur2; -+ -+ /* Expected result vectors. */ -+ vector unsigned char vucer = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vscer = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbcer = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255}; -+ vector unsigned short vuser = {0,1,2,3,4,5,6,7}; -+ vector signed short vsser = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbser = {0,65535,65535,65535,65535,0,0,0}; -+ vector pixel vper = {(0<<15) + (2<<10) + (3<<5) + 4, -+ (1<<15) + (5<<10) + (6<<5) + 7, -+ (0<<15) + (8<<10) + (9<<5) + 10, -+ (1<<15) + (11<<10) + (12<<5) + 13, -+ (1<<15) + (14<<10) + (15<<5) + 16, -+ (0<<15) + (17<<10) + (18<<5) + 19, -+ (1<<15) + (20<<10) + (21<<5) + 22, -+ (0<<15) + (23<<10) + (24<<5) + 25}; -+ vector unsigned char vucser = {0,255,1,255,2,255,3,255,4,255,5,255,6,255,7,255}; -+ vector signed char vscser = {-1,-128,0,127,-2,-128,1,127, -+ -3,-128,2,127,-4,-128,3,127}; -+ vector unsigned short vusser = {0,65535,1,65535,2,65535,3,65535}; -+ vector signed short vssser = {-1,-32768,0,32767,-2,-32768,1,32767}; -+ vector unsigned char vucsuer1 = {0,255,1,255,2,255,3,255,4,255,5,255,6,255,7,255}; -+ vector unsigned char vucsuer2 = {0,0,0,127,0,0,1,128,0,0,2,129,0,0,3,130}; -+ vector unsigned short vussuer1 = {0,65535,1,65535,2,65535,3,65535}; -+ vector unsigned short vussuer2 = {0,0,0,32767,0,0,1,32768}; -+ -+ vucr = vec_pack (vusa, vusb); -+ vscr = vec_pack (vssa, vssb); -+ vbcr = vec_pack (vbsa, vbsb); -+ vusr = vec_pack (vuia, vuib); -+ vssr = vec_pack (vsia, vsib); -+ vbsr = vec_pack (vbia, vbib); -+ vpr = vec_packpx (vipa, vipb); -+ vucsr = vec_packs (vusc, vusd); -+ vscsr = vec_packs (vssc, vssd); -+ vussr = vec_packs (vuic, vuid); -+ vsssr = vec_packs (vsic, vsid); -+ vucsur1 = vec_packsu (vusc, vusd); -+ vucsur2 = vec_packsu (vssc, vssd); -+ vussur1 = vec_packsu (vuic, vuid); -+ vussur2 = vec_packsu (vsic, vsid); -+ -+ check (vec_all_eq (vucr, vucer), "vucr"); -+ check (vec_all_eq (vscr, vscer), "vscr"); -+ check (vec_all_eq (vbcr, vbcer), "vbcr"); -+ check (vec_all_eq (vusr, vuser), "vusr"); -+ check (vec_all_eq (vssr, vsser), "vssr"); -+ check (vec_all_eq (vbsr, vbser), "vbsr"); -+ check (vec_all_eq (vpr, vper ), "vpr" ); -+ check (vec_all_eq (vucsr, vucser), "vucsr"); -+ check (vec_all_eq (vscsr, vscser), "vscsr"); -+ check (vec_all_eq (vussr, vusser), "vussr"); -+ check (vec_all_eq (vsssr, vssser), "vsssr"); -+ check (vec_all_eq (vucsur1, vucsuer1), "vucsur1"); -+ check (vec_all_eq (vucsur2, vucsuer2), "vucsur2"); -+ check (vec_all_eq (vussur1, vussuer1), "vussur1"); -+ check (vec_all_eq (vussur2, vussuer2), "vussur2"); -+} -Index: gcc/testsuite/gcc.dg/vmx/unpack-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/unpack-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/unpack-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,88 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+#define BIG 4294967295 -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255}; -+ vector pixel vp = {(0<<15) + (1<<10) + (2<<5) + 3, -+ (1<<15) + (4<<10) + (5<<5) + 6, -+ (0<<15) + (7<<10) + (8<<5) + 9, -+ (1<<15) + (10<<10) + (11<<5) + 12, -+ (1<<15) + (13<<10) + (14<<5) + 15, -+ (0<<15) + (16<<10) + (17<<5) + 18, -+ (1<<15) + (19<<10) + (20<<5) + 21, -+ (0<<15) + (22<<10) + (23<<5) + 24}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,65535,0,0,0,65535,0}; -+ -+ /* Result vectors. */ -+ vector signed short vsch, vscl; -+ vector bool short vbsh, vbsl; -+ vector unsigned int vuih, vuil; -+ vector signed int vsih, vsil; -+ vector bool int vbih, vbil; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector signed short vschr = {0,1,2,3,4,5,6,7}; -+ vector signed short vsclr = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector bool short vbshr = {65535,0,0,65535,65535,65535,0,65535}; -+ vector bool short vbslr = {0,65535,65535,0,0,0,65535,0}; -+ vector unsigned int vuihr = {(65535<<24) + (13<<16) + (14<<8) + 15, -+ (0<<24) + (16<<16) + (17<<8) + 18, -+ (65535<<24) + (19<<16) + (20<<8) + 21, -+ (0<<24) + (22<<16) + (23<<8) + 24}; -+ vector unsigned int vuilr = {(0<<24) + (1<<16) + (2<<8) + 3, -+ (65535<<24) + (4<<16) + (5<<8) + 6, -+ (0<<24) + (7<<16) + (8<<8) + 9, -+ (65535<<24) + (10<<16) + (11<<8) + 12}; -+ vector signed int vsihr = {0,1,2,3}; -+ vector signed int vsilr = {-4,-3,-2,-1}; -+ vector bool int vbihr = {0,0,BIG,0}; -+ vector bool int vbilr = {0,BIG,BIG,0}; -+#else -+ vector signed short vschr = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vsclr = {0,1,2,3,4,5,6,7}; -+ vector bool short vbshr = {0,65535,65535,0,0,0,65535,0}; -+ vector bool short vbslr = {65535,0,0,65535,65535,65535,0,65535}; -+ vector unsigned int vuihr = {(0<<24) + (1<<16) + (2<<8) + 3, -+ (65535<<24) + (4<<16) + (5<<8) + 6, -+ (0<<24) + (7<<16) + (8<<8) + 9, -+ (65535<<24) + (10<<16) + (11<<8) + 12}; -+ vector unsigned int vuilr = {(65535<<24) + (13<<16) + (14<<8) + 15, -+ (0<<24) + (16<<16) + (17<<8) + 18, -+ (65535<<24) + (19<<16) + (20<<8) + 21, -+ (0<<24) + (22<<16) + (23<<8) + 24}; -+ vector signed int vsihr = {-4,-3,-2,-1}; -+ vector signed int vsilr = {0,1,2,3}; -+ vector bool int vbihr = {0,BIG,BIG,0}; -+ vector bool int vbilr = {0,0,BIG,0}; -+#endif -+ -+ vsch = vec_unpackh (vsc); -+ vscl = vec_unpackl (vsc); -+ vbsh = vec_unpackh (vbc); -+ vbsl = vec_unpackl (vbc); -+ vuih = vec_unpackh (vp); -+ vuil = vec_unpackl (vp); -+ vsih = vec_unpackh (vss); -+ vsil = vec_unpackl (vss); -+ vbih = vec_unpackh (vbs); -+ vbil = vec_unpackl (vbs); -+ -+ check (vec_all_eq (vsch, vschr), "vsch"); -+ check (vec_all_eq (vscl, vsclr), "vscl"); -+ check (vec_all_eq (vbsh, vbshr), "vbsh"); -+ check (vec_all_eq (vbsl, vbslr), "vbsl"); -+ check (vec_all_eq (vuih, vuihr), "vuih"); -+ check (vec_all_eq (vuil, vuilr), "vuil"); -+ check (vec_all_eq (vsih, vsihr), "vsih"); -+ check (vec_all_eq (vsil, vsilr), "vsil"); -+ check (vec_all_eq (vbih, vbihr), "vbih"); -+ check (vec_all_eq (vbil, vbilr), "vbil"); -+} -Index: gcc/testsuite/gcc.dg/vmx/st.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/st.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/st.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,67 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ check (svuc[i] == i, "svuc"); -+ check (svsc[i] == i - 8, "svsc"); -+ check (svbc[i] == ((i % 2) ? 0xff : 0), "svbc"); -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ check (svus[i] == i, "svus"); -+ check (svss[i] == i - 4, "svss"); -+ check (svbs[i] == ((i % 2) ? 0xffff : 0), "svbs"); -+ check (svp[i] == i, "svp"); -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ check (svui[i] == i, "svui"); -+ check (svsi[i] == i - 2, "svsi"); -+ check (svbi[i] == ((i % 2) ? 0xffffffff : 0), "svbi"); -+ check (svf[i] == i * 1.0f, "svf"); -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel vp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector bool int vbi = {0,0xffffffff,0,0xffffffff}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+ -+ vec_st (vuc, 0, (vector unsigned char *)svuc); -+ vec_st (vsc, 0, (vector signed char *)svsc); -+ vec_st (vbc, 0, (vector bool char *)svbc); -+ vec_st (vus, 0, (vector unsigned short *)svus); -+ vec_st (vss, 0, (vector signed short *)svss); -+ vec_st (vbs, 0, (vector bool short *)svbs); -+ vec_st (vp, 0, (vector pixel *)svp); -+ vec_st (vui, 0, (vector unsigned int *)svui); -+ vec_st (vsi, 0, (vector signed int *)svsi); -+ vec_st (vbi, 0, (vector bool int *)svbi); -+ vec_st (vf, 0, (vector float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/ste-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ste-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ste-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,53 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ check (svuc[9] == 9, "svuc"); -+ check (svsc[14] == 6, "svsc"); -+ check (svus[7] == 7, "svus"); -+ check (svss[1] == -3, "svss"); -+ check (svui[3] == 3, "svui"); -+ check (svsi[2] == 0, "svsi"); -+ check (svf[0] == 0.0, "svf"); -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; -+ vector signed char vsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8}; -+ vector unsigned short vus = {7,6,5,4,3,2,1,0}; -+ vector signed short vss = {3,2,1,0,-1,-2,-3,-4}; -+ vector unsigned int vui = {3,2,1,0}; -+ vector signed int vsi = {1,0,-1,-2}; -+ vector float vf = {3.0,2.0,1.0,0.0}; -+#else -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+#endif -+ -+ vec_ste (vuc, 9*1, (unsigned char *)svuc); -+ vec_ste (vsc, 14*1, (signed char *)svsc); -+ vec_ste (vus, 7*2, (unsigned short *)svus); -+ vec_ste (vss, 1*2, (signed short *)svss); -+ vec_ste (vui, 3*4, (unsigned int *)svui); -+ vec_ste (vsi, 2*4, (signed int *)svsi); -+ vec_ste (vf, 0*4, (float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/insert.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/insert.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/insert.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char va = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vb = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vc = {0,1,2,3,4,5,6,7}; -+ vector signed short vd = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int ve = {0,1,2,3}; -+ vector signed int vf = {-2,-1,0,1}; -+ vector float vg = {-2.0f,-1.0f,0.0f,1.0f}; -+ -+ check (vec_all_eq (vec_insert (16, va, 5), -+ ((vector unsigned char) -+ {0,1,2,3,4,16,6,7,8,9,10,11,12,13,14,15})), -+ "vec_insert (va)"); -+ check (vec_all_eq (vec_insert (-16, vb, 0), -+ ((vector signed char) -+ {-16,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7})), -+ "vec_insert (vb)"); -+ check (vec_all_eq (vec_insert (16, vc, 7), -+ ((vector unsigned short){0,1,2,3,4,5,6,16})), -+ "vec_insert (vc)"); -+ check (vec_all_eq (vec_insert (-16, vd, 3), -+ ((vector signed short){-4,-3,-2,-16,0,1,2,3})), -+ "vec_insert (vd)"); -+ check (vec_all_eq (vec_insert (16, ve, 2), -+ ((vector unsigned int){0,1,16,3})), -+ "vec_insert (ve)"); -+ check (vec_all_eq (vec_insert (-16, vf, 1), -+ ((vector signed int){-2,-16,0,1})), -+ "vec_insert (vf)"); -+ check (vec_all_eq (vec_insert (-16.0f, vg, 0), -+ ((vector float){-16.0f,-1.0f,0.0f,1.0f})), -+ "vec_insert (vg)"); -+} -+ -Index: gcc/testsuite/gcc.dg/vmx/ld-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ld-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ld-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,39 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ svul[i] = i; -+ svd[i] = i * 1.0; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned long long evul = {0,1}; -+ vector double evd = {0.0,1.0}; -+ -+ vector unsigned long long vul; -+ vector double vd; -+ unsigned i; -+ -+ init (); -+ -+ vul = vec_ld (0, (vector unsigned long long *)svul); -+ vd = vec_ld (0, (vector double *)svd); -+ -+ for (i = 0; i < 2; ++i) -+ { -+ check (vul[i] == evul[i], "vul"); -+ check (vd[i] == evd[i], "vd" ); -+ } -+} -Index: gcc/testsuite/gcc.dg/vmx/extract-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/extract-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/extract-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector long long vl = {0, 1}; -+ vector double vd = {0.0, 1.0}; -+ -+ check (vec_extract (vl, 0) == 0, "vec_extract, vl, 0"); -+ check (vec_extract (vd, 1) == 1.0, "vec_extract, vd, 1"); -+ check (vl[0] == 0, "[], vl, 0"); -+ check (vd[1] == 1.0, "[], vd, 0"); -+} -Index: gcc/testsuite/gcc.dg/vmx/perm.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/perm.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/perm.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,69 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb -+ = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; -+ vector unsigned char vucp = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ -+ vector signed char vsca -+ = {-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed char vscb = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vscp = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {8,9,10,11,12,13,14,15}; -+ vector unsigned char vusp = {0,1,30,31,2,3,28,29,4,5,26,27,6,7,24,25}; -+ -+ vector signed short vssa = {-8,-7,-6,-5,-4,-3,-2,-1}; -+ vector signed short vssb = {0,1,2,3,4,5,6,7}; -+ vector unsigned char vssp = {0,1,30,31,2,3,28,29,4,5,26,27,6,7,24,25}; -+ -+ vector unsigned int vuia = {0,1,2,3}; -+ vector unsigned int vuib = {4,5,6,7}; -+ vector unsigned char vuip = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+ -+ vector signed int vsia = {-4,-3,-2,-1}; -+ vector signed int vsib = {0,1,2,3}; -+ vector unsigned char vsip = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+ -+ vector float vfa = {-4.0,-3.0,-2.0,-1.0}; -+ vector float vfb = {0.0,1.0,2.0,3.0}; -+ vector unsigned char vfp = {0,1,2,3,28,29,30,31,4,5,6,7,24,25,26,27}; -+ -+ /* Result vectors. */ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector float vf; -+ -+ /* Expected result vectors. */ -+ vector unsigned char vucr = {0,31,1,30,2,29,3,28,4,27,5,26,6,25,7,24}; -+ vector signed char vscr = {-16,15,-15,14,-14,13,-13,12,-12,11,-11,10,-10,9,-9,8}; -+ vector unsigned short vusr = {0,15,1,14,2,13,3,12}; -+ vector signed short vssr = {-8,7,-7,6,-6,5,-5,4}; -+ vector unsigned int vuir = {0,7,1,6}; -+ vector signed int vsir = {-4,3,-3,2}; -+ vector float vfr = {-4.0,3.0,-3.0,2.0}; -+ -+ vuc = vec_perm (vuca, vucb, vucp); -+ vsc = vec_perm (vsca, vscb, vscp); -+ vus = vec_perm (vusa, vusb, vusp); -+ vss = vec_perm (vssa, vssb, vssp); -+ vui = vec_perm (vuia, vuib, vuip); -+ vsi = vec_perm (vsia, vsib, vsip); -+ vf = vec_perm (vfa, vfb, vfp ); -+ -+ check (vec_all_eq (vuc, vucr), "vuc"); -+ check (vec_all_eq (vsc, vscr), "vsc"); -+ check (vec_all_eq (vus, vusr), "vus"); -+ check (vec_all_eq (vss, vssr), "vss"); -+ check (vec_all_eq (vui, vuir), "vui"); -+ check (vec_all_eq (vsi, vsir), "vsi"); -+ check (vec_all_eq (vf, vfr), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/extract-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/extract-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/extract-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char va = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vb = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vc = {0,1,2,3,4,5,6,7}; -+ vector signed short vd = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int ve = {0,1,2,3}; -+ vector signed int vf = {-2,-1,0,1}; -+ vector float vg = {-2.0f,-1.0f,0.0f,1.0f}; -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ check (vec_extract (va, 5) == 10, "vec_extract (va, 5)"); -+ check (vec_extract (vb, 0) == 7, "vec_extract (vb, 0)"); -+ check (vec_extract (vc, 7) == 0, "vec_extract (vc, 7)"); -+ check (vec_extract (vd, 3) == 0, "vec_extract (vd, 3)"); -+ check (vec_extract (ve, 2) == 1, "vec_extract (ve, 2)"); -+ check (vec_extract (vf, 1) == 0, "vec_extract (vf, 1)"); -+ check (vec_extract (vg, 0) == 1.0f, "vec_extract (vg, 0)"); -+#else -+ check (vec_extract (va, 5) == 5, "vec_extract (va, 5)"); -+ check (vec_extract (vb, 0) == -8, "vec_extract (vb, 0)"); -+ check (vec_extract (vc, 7) == 7, "vec_extract (vc, 7)"); -+ check (vec_extract (vd, 3) == -1, "vec_extract (vd, 3)"); -+ check (vec_extract (ve, 2) == 2, "vec_extract (ve, 2)"); -+ check (vec_extract (vf, 1) == -1, "vec_extract (vf, 1)"); -+ check (vec_extract (vg, 0) == -2.0f, "vec_extract (vg, 0)"); -+#endif -+} -+ -Index: gcc/testsuite/gcc.dg/vmx/ldl-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ldl-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ldl-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,107 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ svbc[i] = (i % 2) ? 0xff : 0; -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ svbs[i] = (i % 2) ? 0xffff : 0; -+ svp[i] = i; -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svbi[i] = (i % 2) ? 0xffffffff : 0; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char evuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; -+ vector signed char evsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8}; -+ vector bool char evbc = {255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0}; -+ vector unsigned short evus = {7,6,5,4,3,2,1,0}; -+ vector signed short evss = {3,2,1,0,-1,-2,-3,-4}; -+ vector bool short evbs = {65535,0,65535,0,65535,0,65535,0}; -+ vector pixel evp = {7,6,5,4,3,2,1,0}; -+ vector unsigned int evui = {3,2,1,0}; -+ vector signed int evsi = {1,0,-1,-2}; -+ vector bool int evbi = {0xffffffff,0,0xffffffff,0}; -+ vector float evf = {3.0,2.0,1.0,0.0}; -+#else -+ vector unsigned char evuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char evsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char evbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short evus = {0,1,2,3,4,5,6,7}; -+ vector signed short evss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short evbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel evp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int evui = {0,1,2,3}; -+ vector signed int evsi = {-2,-1,0,1}; -+ vector bool int evbi = {0,0xffffffff,0,0xffffffff}; -+ vector float evf = {0.0,1.0,2.0,3.0}; -+#endif -+ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector bool char vbc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector bool short vbs; -+ vector pixel vp; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector bool int vbi; -+ vector float vf; -+ -+ init (); -+ -+ vuc = vec_ldl (0, (vector unsigned char *)svuc); -+ vsc = vec_ldl (0, (vector signed char *)svsc); -+ vbc = vec_ldl (0, (vector bool char *)svbc); -+ vus = vec_ldl (0, (vector unsigned short *)svus); -+ vss = vec_ldl (0, (vector signed short *)svss); -+ vbs = vec_ldl (0, (vector bool short *)svbs); -+ vp = vec_ldl (0, (vector pixel *)svp); -+ vui = vec_ldl (0, (vector unsigned int *)svui); -+ vsi = vec_ldl (0, (vector signed int *)svsi); -+ vbi = vec_ldl (0, (vector bool int *)svbi); -+ vf = vec_ldl (0, (vector float *)svf); -+ -+ check (vec_all_eq (vuc, evuc), "vuc"); -+ check (vec_all_eq (vsc, evsc), "vsc"); -+ check (vec_all_eq (vbc, evbc), "vbc"); -+ check (vec_all_eq (vus, evus), "vus"); -+ check (vec_all_eq (vss, evss), "vss"); -+ check (vec_all_eq (vbs, evbs), "vbs"); -+ check (vec_all_eq (vp, evp ), "vp" ); -+ check (vec_all_eq (vui, evui), "vui"); -+ check (vec_all_eq (vsi, evsi), "vsi"); -+ check (vec_all_eq (vbi, evbi), "vbi"); -+ check (vec_all_eq (vf, evf ), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/mult-even-odd.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/mult-even-odd.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/mult-even-odd.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,43 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb = {2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3}; -+ vector signed char vsca = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector signed char vscb = {2,-3,2,-3,2,-3,2,-3,2,-3,2,-3,2,-3,2,-3}; -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {2,3,2,3,2,3,2,3}; -+ vector signed short vssa = {-4,-3,-2,-1,0,1,2,3}; -+ vector signed short vssb = {2,-3,2,-3,2,-3,2,-3}; -+ vector unsigned short vuse, vuso; -+ vector signed short vsse, vsso; -+ vector unsigned int vuie, vuio; -+ vector signed int vsie, vsio; -+ -+ vuse = vec_mule (vuca, vucb); -+ vuso = vec_mulo (vuca, vucb); -+ vsse = vec_mule (vsca, vscb); -+ vsso = vec_mulo (vsca, vscb); -+ vuie = vec_mule (vusa, vusb); -+ vuio = vec_mulo (vusa, vusb); -+ vsie = vec_mule (vssa, vssb); -+ vsio = vec_mulo (vssa, vssb); -+ -+ check (vec_all_eq (vuse, -+ ((vector unsigned short){0,4,8,12,16,20,24,28})), -+ "vuse"); -+ check (vec_all_eq (vuso, -+ ((vector unsigned short){3,9,15,21,27,33,39,45})), -+ "vuso"); -+ check (vec_all_eq (vsse, -+ ((vector signed short){-16,-12,-8,-4,0,4,8,12})), -+ "vsse"); -+ check (vec_all_eq (vsso, -+ ((vector signed short){21,15,9,3,-3,-9,-15,-21})), -+ "vsso"); -+ check (vec_all_eq (vuie, ((vector unsigned int){0,4,8,12})), "vuie"); -+ check (vec_all_eq (vuio, ((vector unsigned int){3,9,15,21})), "vuio"); -+ check (vec_all_eq (vsie, ((vector signed int){-8,-4,0,4})), "vsie"); -+ check (vec_all_eq (vsio, ((vector signed int){9,3,-3,-9})), "vsio"); -+} -Index: gcc/testsuite/gcc.dg/vmx/splat-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/splat-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/splat-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,59 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {-2.0,-1.0,0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector unsigned char vucr; -+ vector signed char vscr; -+ vector unsigned short vusr; -+ vector signed short vssr; -+ vector unsigned int vuir; -+ vector signed int vsir; -+ vector float vfr; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char vucer = {14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}; -+ vector signed char vscer = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; -+ vector unsigned short vuser = {0,0,0,0,0,0,0,0}; -+ vector signed short vsser = {3,3,3,3,3,3,3,3}; -+ vector unsigned int vuier = {1,1,1,1}; -+ vector signed int vsier = {-2,-2,-2,-2}; -+ vector float vfer = {0.0,0.0,0.0,0.0}; -+#else -+ vector unsigned char vucer = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; -+ vector signed char vscer = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -+ vector unsigned short vuser = {7,7,7,7,7,7,7,7}; -+ vector signed short vsser = {-4,-4,-4,-4,-4,-4,-4,-4}; -+ vector unsigned int vuier = {2,2,2,2}; -+ vector signed int vsier = {1,1,1,1}; -+ vector float vfer = {-1.0,-1.0,-1.0,-1.0}; -+#endif -+ -+ vucr = vec_splat (vuc, 1); -+ vscr = vec_splat (vsc, 8); -+ vusr = vec_splat (vus, 7); -+ vssr = vec_splat (vss, 0); -+ vuir = vec_splat (vui, 2); -+ vsir = vec_splat (vsi, 3); -+ vfr = vec_splat (vf, 1); -+ -+ check (vec_all_eq (vucr, vucer), "vuc"); -+ check (vec_all_eq (vscr, vscer), "vsc"); -+ check (vec_all_eq (vusr, vuser), "vus"); -+ check (vec_all_eq (vssr, vsser), "vss"); -+ check (vec_all_eq (vuir, vuier), "vui"); -+ check (vec_all_eq (vsir, vsier), "vsi"); -+ check (vec_all_eq (vfr, vfer ), "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/extract-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/extract-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/extract-vsx-be-order.c (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/gnat.dg/overflow_fixed.adb (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gnat.dg/overflow_fixed.adb (.../branches/gcc-4_8-branch) @@ -0,0 +1,19 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector long long vl = {0, 1}; -+ vector double vd = {0.0, 1.0}; -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ check (vec_extract (vl, 0) == 1, "vl, 0"); -+ check (vec_extract (vd, 1) == 0.0, "vd, 1"); -+#else -+ check (vec_extract (vl, 0) == 0, "vl, 0"); -+ check (vec_extract (vd, 1) == 1.0, "vd, 1"); -+#endif -+} -Index: gcc/testsuite/gcc.dg/vmx/ld-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ld-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ld-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,107 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ svbc[i] = (i % 2) ? 0xff : 0; -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ svbs[i] = (i % 2) ? 0xffff : 0; -+ svp[i] = i; -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svbi[i] = (i % 2) ? 0xffffffff : 0; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector unsigned char evuc = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; -+ vector signed char evsc = {7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8}; -+ vector bool char evbc = {255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0}; -+ vector unsigned short evus = {7,6,5,4,3,2,1,0}; -+ vector signed short evss = {3,2,1,0,-1,-2,-3,-4}; -+ vector bool short evbs = {65535,0,65535,0,65535,0,65535,0}; -+ vector pixel evp = {7,6,5,4,3,2,1,0}; -+ vector unsigned int evui = {3,2,1,0}; -+ vector signed int evsi = {1,0,-1,-2}; -+ vector bool int evbi = {0xffffffff,0,0xffffffff,0}; -+ vector float evf = {3.0,2.0,1.0,0.0}; -+#else -+ vector unsigned char evuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char evsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char evbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short evus = {0,1,2,3,4,5,6,7}; -+ vector signed short evss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short evbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel evp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int evui = {0,1,2,3}; -+ vector signed int evsi = {-2,-1,0,1}; -+ vector bool int evbi = {0,0xffffffff,0,0xffffffff}; -+ vector float evf = {0.0,1.0,2.0,3.0}; -+#endif -+ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector bool char vbc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector bool short vbs; -+ vector pixel vp; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector bool int vbi; -+ vector float vf; -+ -+ init (); -+ -+ vuc = vec_ld (0, (vector unsigned char *)svuc); -+ vsc = vec_ld (0, (vector signed char *)svsc); -+ vbc = vec_ld (0, (vector bool char *)svbc); -+ vus = vec_ld (0, (vector unsigned short *)svus); -+ vss = vec_ld (0, (vector signed short *)svss); -+ vbs = vec_ld (0, (vector bool short *)svbs); -+ vp = vec_ld (0, (vector pixel *)svp); -+ vui = vec_ld (0, (vector unsigned int *)svui); -+ vsi = vec_ld (0, (vector signed int *)svsi); -+ vbi = vec_ld (0, (vector bool int *)svbi); -+ vf = vec_ld (0, (vector float *)svf); -+ -+ check (vec_all_eq (vuc, evuc), "vuc"); -+ check (vec_all_eq (vsc, evsc), "vsc"); -+ check (vec_all_eq (vbc, evbc), "vbc"); -+ check (vec_all_eq (vus, evus), "vus"); -+ check (vec_all_eq (vss, evss), "vss"); -+ check (vec_all_eq (vbs, evbs), "vbs"); -+ check (vec_all_eq (vp, evp ), "vp" ); -+ check (vec_all_eq (vui, evui), "vui"); -+ check (vec_all_eq (vsi, evsi), "vsi"); -+ check (vec_all_eq (vbi, evbi), "vbi"); -+ check (vec_all_eq (vf, evf ), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/ld.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ld.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ld.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,91 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ svbc[i] = (i % 2) ? 0xff : 0; -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ svbs[i] = (i % 2) ? 0xffff : 0; -+ svp[i] = i; -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svbi[i] = (i % 2) ? 0xffffffff : 0; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char evuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char evsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char evbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short evus = {0,1,2,3,4,5,6,7}; -+ vector signed short evss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short evbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel evp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int evui = {0,1,2,3}; -+ vector signed int evsi = {-2,-1,0,1}; -+ vector bool int evbi = {0,0xffffffff,0,0xffffffff}; -+ vector float evf = {0.0,1.0,2.0,3.0}; ++-- { dg-do run } ++-- { dg-options "-gnato -O" } + -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector bool char vbc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector bool short vbs; -+ vector pixel vp; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector bool int vbi; -+ vector float vf; ++procedure Overflow_Fixed is + -+ init (); -+ -+ vuc = vec_ld (0, (vector unsigned char *)svuc); -+ vsc = vec_ld (0, (vector signed char *)svsc); -+ vbc = vec_ld (0, (vector bool char *)svbc); -+ vus = vec_ld (0, (vector unsigned short *)svus); -+ vss = vec_ld (0, (vector signed short *)svss); -+ vbs = vec_ld (0, (vector bool short *)svbs); -+ vp = vec_ld (0, (vector pixel *)svp); -+ vui = vec_ld (0, (vector unsigned int *)svui); -+ vsi = vec_ld (0, (vector signed int *)svsi); -+ vbi = vec_ld (0, (vector bool int *)svbi); -+ vf = vec_ld (0, (vector float *)svf); -+ -+ check (vec_all_eq (vuc, evuc), "vuc"); -+ check (vec_all_eq (vsc, evsc), "vsc"); -+ check (vec_all_eq (vbc, evbc), "vbc"); -+ check (vec_all_eq (vus, evus), "vus"); -+ check (vec_all_eq (vss, evss), "vss"); -+ check (vec_all_eq (vbs, evbs), "vbs"); -+ check (vec_all_eq (vp, evp ), "vp" ); -+ check (vec_all_eq (vui, evui), "vui"); -+ check (vec_all_eq (vsi, evsi), "vsi"); -+ check (vec_all_eq (vbi, evbi), "vbi"); -+ check (vec_all_eq (vf, evf ), "vf" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/sn7153.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/sn7153.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/sn7153.c (.../branches/gcc-4_8-branch) -@@ -34,7 +34,11 @@ - - void validate_sat() - { -+#ifdef __LITTLE_ENDIAN__ -+ if (vec_any_ne(vec_splat(vec_mfvscr(), 0), ((vector unsigned short){1,1,1,1,1,1,1,1}))) -+#else - if (vec_any_ne(vec_splat(vec_mfvscr(), 7), ((vector unsigned short){1,1,1,1,1,1,1,1}))) -+#endif - { - union {vector unsigned short v; unsigned short s[8];} u; - u.v = vec_mfvscr(); -Index: gcc/testsuite/gcc.dg/vmx/stl.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/stl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/stl.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,67 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned char svbc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned short svbs[8] __attribute__ ((aligned (16))); -+static unsigned short svp[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static unsigned int svbi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 16; ++i) -+ { -+ check (svuc[i] == i, "svuc"); -+ check (svsc[i] == i - 8, "svsc"); -+ check (svbc[i] == ((i % 2) ? 0xff : 0), "svbc"); -+ } -+ for (i = 0; i < 8; ++i) -+ { -+ check (svus[i] == i, "svus"); -+ check (svss[i] == i - 4, "svss"); -+ check (svbs[i] == ((i % 2) ? 0xffff : 0), "svbs"); -+ check (svp[i] == i, "svp"); -+ } -+ for (i = 0; i < 4; ++i) -+ { -+ check (svui[i] == i, "svui"); -+ check (svsi[i] == i - 2, "svsi"); -+ check (svbi[i] == ((i % 2) ? 0xffffffff : 0), "svbi"); -+ check (svf[i] == i * 1.0f, "svf"); -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector bool char vbc = {0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector bool short vbs = {0,65535,0,65535,0,65535,0,65535}; -+ vector pixel vp = {0,1,2,3,4,5,6,7}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector bool int vbi = {0,0xffffffff,0,0xffffffff}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+ -+ vec_stl (vuc, 0, (vector unsigned char *)svuc); -+ vec_stl (vsc, 0, (vector signed char *)svsc); -+ vec_stl (vbc, 0, (vector bool char *)svbc); -+ vec_stl (vus, 0, (vector unsigned short *)svus); -+ vec_stl (vss, 0, (vector signed short *)svss); -+ vec_stl (vbs, 0, (vector bool short *)svbs); -+ vec_stl (vp, 0, (vector pixel *)svp); -+ vec_stl (vui, 0, (vector unsigned int *)svui); -+ vec_stl (vsi, 0, (vector signed int *)svsi); -+ vec_stl (vbi, 0, (vector bool int *)svbi); -+ vec_stl (vf, 0, (vector float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/st-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/st-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/st-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ check (svul[i] == i, "svul"); -+ check (svd[i] == i * 1.0, "svd"); -+ } -+} ++ type Unsigned_8_Bit is mod 2**8; + -+static void test () -+{ -+ vector unsigned long long vul = {0,1}; -+ vector double vd = {0.0,1.0}; -+ -+ vec_st (vul, 0, (vector unsigned long long *)svul); -+ vec_st (vd, 0, (vector double *)svd); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/sum2s.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/sum2s.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/sum2s.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+#include "harness.h" -+ -+static void test() -+{ -+ vector signed int vsia = {-10,1,2,3}; -+ vector signed int vsib = {100,101,102,-103}; -+ vector signed int vsir; -+ vector signed int vsier = {0,92,0,-98}; -+ -+ vsir = vec_sum2s (vsia, vsib); -+ -+ check (vec_all_eq (vsir, vsier), "vsir"); -+} -Index: gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/merge-vsx-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,51 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static int vec_long_long_eq (vector long long x, vector long long y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static int vec_double_eq (vector double x, vector double y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector long long vla = {-2,-1}; -+ vector long long vlb = {0,1}; -+ vector double vda = {-2.0,-1.0}; -+ vector double vdb = {0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector long long vlh, vll; -+ vector double vdh, vdl; -+ -+ /* Expected result vectors. */ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector long long vlrh = {1,-1}; -+ vector long long vlrl = {0,-2}; -+ vector double vdrh = {1.0,-1.0}; -+ vector double vdrl = {0.0,-2.0}; -+#else -+ vector long long vlrh = {-2,0}; -+ vector long long vlrl = {-1,1}; -+ vector double vdrh = {-2.0,0.0}; -+ vector double vdrl = {-1.0,1.0}; -+#endif -+ -+ vlh = vec_mergeh (vla, vlb); -+ vll = vec_mergel (vla, vlb); -+ vdh = vec_mergeh (vda, vdb); -+ vdl = vec_mergel (vda, vdb); -+ -+ check (vec_long_long_eq (vlh, vlrh), "vlh"); -+ check (vec_long_long_eq (vll, vlrl), "vll"); -+ check (vec_double_eq (vdh, vdrh), "vdh" ); -+ check (vec_double_eq (vdl, vdrl), "vdl" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/mult-even-odd-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/mult-even-odd-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/mult-even-odd-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,64 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector unsigned char vuca = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector unsigned char vucb = {2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3}; -+ vector signed char vsca = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector signed char vscb = {2,-3,2,-3,2,-3,2,-3,2,-3,2,-3,2,-3,2,-3}; -+ vector unsigned short vusa = {0,1,2,3,4,5,6,7}; -+ vector unsigned short vusb = {2,3,2,3,2,3,2,3}; -+ vector signed short vssa = {-4,-3,-2,-1,0,1,2,3}; -+ vector signed short vssb = {2,-3,2,-3,2,-3,2,-3}; -+ vector unsigned short vuse, vuso; -+ vector signed short vsse, vsso; -+ vector unsigned int vuie, vuio; -+ vector signed int vsie, vsio; -+ -+ vuse = vec_mule (vuca, vucb); -+ vuso = vec_mulo (vuca, vucb); -+ vsse = vec_mule (vsca, vscb); -+ vsso = vec_mulo (vsca, vscb); -+ vuie = vec_mule (vusa, vusb); -+ vuio = vec_mulo (vusa, vusb); -+ vsie = vec_mule (vssa, vssb); -+ vsio = vec_mulo (vssa, vssb); -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ check (vec_all_eq (vuse, -+ ((vector unsigned short){3,9,15,21,27,33,39,45})), -+ "vuse"); -+ check (vec_all_eq (vuso, -+ ((vector unsigned short){0,4,8,12,16,20,24,28})), -+ "vuso"); -+ check (vec_all_eq (vsse, -+ ((vector signed short){21,15,9,3,-3,-9,-15,-21})), -+ "vsse"); -+ check (vec_all_eq (vsso, -+ ((vector signed short){-16,-12,-8,-4,0,4,8,12})), -+ "vsso"); -+ check (vec_all_eq (vuie, ((vector unsigned int){3,9,15,21})), "vuie"); -+ check (vec_all_eq (vuio, ((vector unsigned int){0,4,8,12})), "vuio"); -+ check (vec_all_eq (vsie, ((vector signed int){9,3,-3,-9})), "vsie"); -+ check (vec_all_eq (vsio, ((vector signed int){-8,-4,0,4})), "vsio"); -+#else -+ check (vec_all_eq (vuse, -+ ((vector unsigned short){0,4,8,12,16,20,24,28})), -+ "vuse"); -+ check (vec_all_eq (vuso, -+ ((vector unsigned short){3,9,15,21,27,33,39,45})), -+ "vuso"); -+ check (vec_all_eq (vsse, -+ ((vector signed short){-16,-12,-8,-4,0,4,8,12})), -+ "vsse"); -+ check (vec_all_eq (vsso, -+ ((vector signed short){21,15,9,3,-3,-9,-15,-21})), -+ "vsso"); -+ check (vec_all_eq (vuie, ((vector unsigned int){0,4,8,12})), "vuie"); -+ check (vec_all_eq (vuio, ((vector unsigned int){3,9,15,21})), "vuio"); -+ check (vec_all_eq (vsie, ((vector signed int){-8,-4,0,4})), "vsie"); -+ check (vec_all_eq (vsio, ((vector signed int){9,3,-3,-9})), "vsio"); -+#endif -+} -Index: gcc/testsuite/gcc.dg/vmx/insert-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/insert-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/insert-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,28 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static int vec_long_long_eq (vector long long x, vector long long y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static int vec_dbl_eq (vector double x, vector double y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static void test() -+{ -+ vector long long vl = {0, 1}; -+ vector double vd = {0.0, 1.0}; -+ vector long long vlr = vec_insert (2, vl, 0); -+ vector double vdr = vec_insert (2.0, vd, 1); -+ vector long long vler = {2, 1}; -+ vector double vder = {0.0, 2.0}; -+ -+ check (vec_long_long_eq (vlr, vler), "vl"); -+ check (vec_dbl_eq (vdr, vder), "vd"); -+} -Index: gcc/testsuite/gcc.dg/vmx/vsums-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/vsums-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/vsums-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector signed int va = {-7,11,-13,17}; -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector signed int vb = {128,0,0,0}; -+ vector signed int evd = {136,0,0,0}; -+#else -+ vector signed int vb = {0,0,0,128}; -+ vector signed int evd = {0,0,0,136}; -+#endif -+ -+ vector signed int vd = vec_sums (va, vb); -+ -+ check (vec_all_eq (vd, evd), "sums"); -+} -Index: gcc/testsuite/gcc.dg/vmx/ldl-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ldl-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ldl-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,39 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ svul[i] = i; -+ svd[i] = i * 1.0; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned long long evul = {0,1}; -+ vector double evd = {0.0,1.0}; -+ -+ vector unsigned long long vul; -+ vector double vd; -+ unsigned i; -+ -+ init (); -+ -+ vul = vec_ldl (0, (vector unsigned long long *)svul); -+ vd = vec_ldl (0, (vector double *)svd); -+ -+ for (i = 0; i < 2; ++i) -+ { -+ check (vul[i] == evul[i], "vul"); -+ check (vd[i] == evd[i], "vd" ); -+ } -+} -Index: gcc/testsuite/gcc.dg/vmx/ste.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/ste.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/ste.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,41 @@ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ check (svuc[9] == 9, "svuc"); -+ check (svsc[14] == 6, "svsc"); -+ check (svus[7] == 7, "svus"); -+ check (svss[1] == -3, "svss"); -+ check (svui[3] == 3, "svui"); -+ check (svsi[2] == 0, "svsi"); -+ check (svf[0] == 0.0, "svf"); -+} -+ -+static void test () -+{ -+ vector unsigned char vuc = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7}; -+ vector unsigned short vus = {0,1,2,3,4,5,6,7}; -+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3}; -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {0.0,1.0,2.0,3.0}; -+ -+ vec_ste (vuc, 9*1, (unsigned char *)svuc); -+ vec_ste (vsc, 14*1, (signed char *)svsc); -+ vec_ste (vus, 7*2, (unsigned short *)svus); -+ vec_ste (vss, 1*2, (signed short *)svss); -+ vec_ste (vui, 3*4, (unsigned int *)svui); -+ vec_ste (vsi, 2*4, (signed int *)svsi); -+ vec_ste (vf, 0*4, (float *)svf); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/vmx/lde-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/lde-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/lde-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,73 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static unsigned char svuc[16] __attribute__ ((aligned (16))); -+static signed char svsc[16] __attribute__ ((aligned (16))); -+static unsigned short svus[8] __attribute__ ((aligned (16))); -+static signed short svss[8] __attribute__ ((aligned (16))); -+static unsigned int svui[4] __attribute__ ((aligned (16))); -+static signed int svsi[4] __attribute__ ((aligned (16))); -+static float svf[4] __attribute__ ((aligned (16))); -+ -+static void init () -+{ -+ int i; -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ for (i = 15; i >= 0; --i) -+#else -+ for (i = 0; i < 16; ++i) -+#endif -+ { -+ svuc[i] = i; -+ svsc[i] = i - 8; -+ } -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ for (i = 7; i >= 0; --i) -+#else -+ for (i = 0; i < 8; ++i) -+#endif -+ { -+ svus[i] = i; -+ svss[i] = i - 4; -+ } -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ for (i = 3; i >= 0; --i) -+#else -+ for (i = 0; i < 4; ++i) -+#endif -+ { -+ svui[i] = i; -+ svsi[i] = i - 2; -+ svf[i] = i * 1.0f; -+ } -+} -+ -+static void test () -+{ -+ vector unsigned char vuc; -+ vector signed char vsc; -+ vector unsigned short vus; -+ vector signed short vss; -+ vector unsigned int vui; -+ vector signed int vsi; -+ vector float vf; -+ -+ init (); -+ -+ vuc = vec_lde (9*1, (unsigned char *)svuc); -+ vsc = vec_lde (14*1, (signed char *)svsc); -+ vus = vec_lde (7*2, (unsigned short *)svus); -+ vss = vec_lde (1*2, (signed short *)svss); -+ vui = vec_lde (3*4, (unsigned int *)svui); -+ vsi = vec_lde (2*4, (signed int *)svsi); -+ vf = vec_lde (0*4, (float *)svf); -+ -+ check (vec_extract (vuc, 9) == 9, "vuc"); -+ check (vec_extract (vsc, 14) == 6, "vsc"); -+ check (vec_extract (vus, 7) == 7, "vus"); -+ check (vec_extract (vss, 1) == -3, "vss"); -+ check (vec_extract (vui, 3) == 3, "vui"); -+ check (vec_extract (vsi, 2) == 0, "vsi"); -+ check (vec_extract (vf, 0) == 0.0, "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/splat-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/splat-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/splat-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector unsigned int vui = {0,1,2,3}; -+ vector signed int vsi = {-2,-1,0,1}; -+ vector float vf = {-2.0,-1.0,0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector unsigned int vuir; -+ vector signed int vsir; -+ vector float vfr; -+ -+ /* Expected result vectors. */ -+ vector unsigned int vuier = {2,2,2,2}; -+ vector signed int vsier = {1,1,1,1}; -+ vector float vfer = {-1.0,-1.0,-1.0,-1.0}; -+ -+ vuir = vec_splat (vui, 2); -+ vsir = vec_splat (vsi, 3); -+ vfr = vec_splat (vf, 1); -+ -+ check (vec_all_eq (vuir, vuier), "vui"); -+ check (vec_all_eq (vsir, vsier), "vsi"); -+ check (vec_all_eq (vfr, vfer ), "vf"); -+} -Index: gcc/testsuite/gcc.dg/vmx/sum2s-be-order.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/sum2s-be-order.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/sum2s-be-order.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+/* { dg-options "-maltivec=be -mabi=altivec -std=gnu99 -mno-vsx" } */ -+ -+#include "harness.h" -+ -+static void test() -+{ -+ vector signed int vsia = {-10,1,2,3}; -+ vector signed int vsib = {100,101,102,-103}; -+ vector signed int vsir; -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ vector signed int vsier = {91,0,107,0}; -+#else -+ vector signed int vsier = {0,92,0,-98}; -+#endif -+ -+ vsir = vec_sum2s (vsia, vsib); -+ -+ check (vec_all_eq (vsir, vsier), "vsir"); -+} -Index: gcc/testsuite/gcc.dg/vmx/merge-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/merge-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/merge-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,44 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ ++ procedure Fixed_To_Eight (Value : Duration) is ++ Item : Unsigned_8_Bit; ++ begin ++ Item := Unsigned_8_Bit(Value); ++ raise Program_Error; ++ exception ++ when Constraint_Error => null; -- expected case ++ end; + -+#include "harness.h" -+ -+static int vec_long_long_eq (vector long long x, vector long long y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static int vec_double_eq (vector double x, vector double y) -+{ -+ return (x[0] == y[0] && x[1] == y[1]); -+} -+ -+static void test() -+{ -+ /* Input vectors. */ -+ vector long long vla = {-2,-1}; -+ vector long long vlb = {0,1}; -+ vector double vda = {-2.0,-1.0}; -+ vector double vdb = {0.0,1.0}; -+ -+ /* Result vectors. */ -+ vector long long vlh, vll; -+ vector double vdh, vdl; -+ -+ /* Expected result vectors. */ -+ vector long long vlrh = {-2,0}; -+ vector long long vlrl = {-1,1}; -+ vector double vdrh = {-2.0,0.0}; -+ vector double vdrl = {-1.0,1.0}; -+ -+ vlh = vec_mergeh (vla, vlb); -+ vll = vec_mergel (vla, vlb); -+ vdh = vec_mergeh (vda, vdb); -+ vdl = vec_mergel (vda, vdb); -+ -+ check (vec_long_long_eq (vlh, vlrh), "vlh"); -+ check (vec_long_long_eq (vll, vlrl), "vll"); -+ check (vec_double_eq (vdh, vdrh), "vdh" ); -+ check (vec_double_eq (vdl, vdrl), "vdl" ); -+} -Index: gcc/testsuite/gcc.dg/vmx/stl-vsx.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vmx/stl-vsx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vmx/stl-vsx.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -+/* { dg-require-effective-target powerpc_vsx_ok } */ -+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx" } */ -+ -+#include "harness.h" -+ -+static unsigned long long svul[2] __attribute__ ((aligned (16))); -+static double svd[2] __attribute__ ((aligned (16))); -+ -+static void check_arrays () -+{ -+ unsigned int i; -+ for (i = 0; i < 2; ++i) -+ { -+ check (svul[i] == i, "svul"); -+ check (svd[i] == i * 1.0, "svd"); -+ } -+} -+ -+static void test () -+{ -+ vector unsigned long long vul = {0,1}; -+ vector double vd = {0.0,1.0}; -+ -+ vec_stl (vul, 0, (vector unsigned long long *)svul); -+ vec_stl (vd, 0, (vector double *)svd); -+ -+ check_arrays (); -+} -Index: gcc/testsuite/gcc.dg/strlenopt-4gf.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/strlenopt-4gf.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/strlenopt-4gf.c (.../branches/gcc-4_8-branch) -@@ -7,13 +7,13 @@ - #include "strlenopt-4.c" - - /* { dg-final { scan-tree-dump-times "strlen \\(" 1 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 4 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 1 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__strcat_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 5 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "memcpy \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "memcpy \\(" 4 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "stpcpy \\(" 5 "strlen" } } */ - /* { dg-final { cleanup-tree-dump "strlen" } } */ -Index: gcc/testsuite/gcc.dg/pr59351.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr59351.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr59351.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+/* { dg-do compile } */ -+/* { dg-options "-std=c99 -Wpedantic" } */ -+ -+unsigned int -+foo (void) -+{ -+ return sizeof ((int[]) {}); /* { dg-warning "ISO C forbids empty initializer braces" } */ -+} -Index: gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,7 @@ - /* { dg-do compile } */ - /* { dg-options "-O2 -Wall" } */ - /* { dg-options "-O2 -Wall -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ -+/* { dg-options "-O2 -Wall -msse2" { target { i?86-*-* x86_64-*-* } } } */ - - typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); - -Index: gcc/testsuite/gcc.dg/builtin-object-size-8.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/builtin-object-size-8.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/builtin-object-size-8.c (.../branches/gcc-4_8-branch) -@@ -1,4 +1,4 @@ --/* { dg-do run { xfail *-*-* } } */ -+/* { dg-do run } */ - /* { dg-options "-O2" } */ - - typedef __SIZE_TYPE__ size_t; -Index: gcc/testsuite/gcc.dg/20050922-2.c ++begin ++ Fixed_To_Eight (-0.5); ++end; +Index: gcc/testsuite/gnat.dg/aliasing1.adb =================================================================== ---- a/src/gcc/testsuite/gcc.dg/20050922-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/20050922-2.c (.../branches/gcc-4_8-branch) -@@ -4,7 +4,8 @@ - /* { dg-do run } */ - /* { dg-options "-O1 -std=c99" } */ +--- a/src/gcc/testsuite/gnat.dg/aliasing1.adb (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gnat.dg/aliasing1.adb (.../branches/gcc-4_8-branch) +@@ -18,5 +18,5 @@ --#include <stdlib.h> -+extern void abort (void); -+extern void exit (int); + end Aliasing1; - #if __INT_MAX__ == 2147483647 - typedef unsigned int uint32_t; -Index: gcc/testsuite/gcc.dg/pr59860.c +--- { dg-final { scan-tree-dump-not "__gnat_rcheck" "optimized" } } ++-- { dg-final { scan-tree-dump-not "gnat_rcheck" "optimized" } } + -- { dg-final { cleanup-tree-dump "optimized" } } +Index: gcc/testsuite/gcc.dg/pr60866.c =================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr59860.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr59860.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O" } */ +--- a/src/gcc/testsuite/gcc.dg/pr60866.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.dg/pr60866.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,18 @@ ++/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ ++/* { dg-options "-O -fselective-scheduling -fno-if-conversion -fschedule-insns" } */ + -+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) char * __attribute__ ((__nothrow__ , __leaf__)) -+strcat (char *__restrict __dest, const char *__restrict __src) -+{ -+ return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1)); -+} -+static char raw_decode; -+void foo (char **argv, char *outfilename) -+{ -+ if (**argv == 'r') -+ raw_decode = 1; -+ strcat (outfilename, raw_decode ? ".raw" : ".wav"); -+} -Index: gcc/testsuite/gcc.dg/stack-usage-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/stack-usage-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/stack-usage-1.c (.../branches/gcc-4_8-branch) -@@ -38,7 +38,11 @@ - # endif - #elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \ - || defined (__PPC64__) --# define SIZE 180 -+# if _CALL_ELF == 2 -+# define SIZE 208 -+# else -+# define SIZE 180 -+# endif - #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \ - || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2) - # if defined (__ALTIVEC__) -Index: gcc/testsuite/gcc.dg/pr59011.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr59011.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr59011.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+/* PR middle-end/59011 */ -+/* { dg-do compile } */ -+/* { dg-options "-std=gnu99" } */ ++int n; + +void -+foo (int m) ++foo (int w, int **dnroot, int **dn) +{ -+ int a[m]; -+ void -+ bar (void) -+ { -+ { -+ int -+ baz (void) ++ int *child; ++ int *xchild = xchild; ++ for (; w < n; w++) ++ if (!dnroot) + { -+ return a[0]; ++ dnroot = dn; ++ for (child = *dn; child; child = xchild) ++ ; + } -+ } -+ a[0] = 42; -+ } -+ bar (); +} -Index: gcc/testsuite/gcc.dg/pr58805.c +Index: gcc/testsuite/gcc.dg/torture/pr61383-1.c =================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr58805.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr58805.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,24 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ -+ -+/* Type that matches the 'p' constraint. */ -+#define TYPE void * -+ -+static inline -+void bar (TYPE *r) -+{ -+ TYPE t; -+ __asm__ ("" : "=&p" (t), "=p" (*r)); -+} -+ -+void -+foo (int n, TYPE *x, TYPE *y) -+{ -+ if (n == 0) -+ bar (x); -+ else -+ bar (y); -+} -+ -+/* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */ -+/* { dg-final { cleanup-tree-dump "pre" } } */ -Index: gcc/testsuite/gcc.dg/strlenopt-14gf.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/strlenopt-14gf.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/strlenopt-14gf.c (.../branches/gcc-4_8-branch) -@@ -11,14 +11,14 @@ - memcpy. */ - /* { dg-final { scan-tree-dump-times "strlen \\(" 4 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__mempcpy_chk \\(" 2 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__mempcpy_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__strcat_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 3 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "memcpy \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "mempcpy \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "memcpy \\(" 1 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "mempcpy \\(" 2 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "stpcpy \\(" 2 "strlen" } } */ - /* { dg-final { cleanup-tree-dump "strlen" } } */ -Index: gcc/testsuite/gcc.dg/torture/pr57425-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57425-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57425-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ -+/* { dg-do run } */ -+ -+extern void abort (void) __attribute__((noreturn)); -+ -+int -+main () -+{ -+ int sum = 0; -+ { -+ int a[20]; -+ int *c; -+ c = a; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 0; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ { -+ long b[10]; -+ long *c; -+ c = b; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 1; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ -+ if (sum != 1) -+ abort(); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr57425-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57425-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57425-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ -+/* { dg-do run } */ -+ -+extern void abort (void) __attribute__((noreturn)); -+ -+int -+main () -+{ -+ int sum = 0; -+ { -+ long a[20]; -+ long *c; -+ c = a; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 0; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ { -+ long long b[10]; -+ long long *c; -+ c = b; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 1; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ -+ if (sum != 1) -+ abort(); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59047.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59047.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59047.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,39 @@ +--- a/src/gcc/testsuite/gcc.dg/torture/pr61383-1.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/pr61383-1.c (.../branches/gcc-4_8-branch) +@@ -0,0 +1,35 @@ +/* { dg-do run } */ + -+extern void abort (void); -+ -+struct -+{ -+ int f0; -+ int f1:1; -+ int f2:2; -+} a = {0, 0, 1}; -+ -+int b, c, *d, e, f; ++int a, b = 1, c, d, e, f, g; + +int +fn1 () +{ -+ for (; b < 1; ++b) -+ { -+ for (e = 0; e < 1; e = 1) -+ { -+ int **g = &d; -+ *g = &c; -+ } -+ *d = 0; -+ f = a.f1; -+ if (f) -+ return 0; -+ } -+ return 0; -+} -+ -+int -+main () -+{ -+ fn1 (); -+ if (b != 1) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr58956.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58956.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58956.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,30 @@ -+/* { dg-do run } */ -+ -+extern void abort (void); -+ -+struct S -+{ -+ int f0; -+} a = {1}, b, g, *c = &b, **f = &c; -+ -+int *d, **e = &d, h; -+ -+struct S -+foo () -+{ -+ *e = &h; -+ if (!d) -+ __builtin_unreachable (); -+ *f = &g; -+ return a; -+} -+ -+int -+main () -+{ -+ struct S *i = c; -+ *i = foo (); -+ if (b.f0 != 1) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr60183.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr60183.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr60183.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,38 @@ -+/* { dg-do run } */ -+ -+/* Large so an out-of-bound read will crash. */ -+unsigned char c[0x30001] = { 1 }; -+int j = 2; -+ -+static void -+foo (unsigned long *x, unsigned char *y) -+{ -+ int i; -+ unsigned long w = x[0]; -+ for (i = 0; i < j; i++) -+ { -+ w += *y; -+ y += 0x10000; -+ w += *y; -+ y += 0x10000; -+ } -+ x[1] = w; -+} -+ -+__attribute__ ((noinline, noclone)) void -+bar (unsigned long *x) -+{ -+ foo (x, c); -+} -+ -+int -+main () -+{ -+ unsigned long a[2] = { 0, -1UL }; -+ asm volatile (""::"r" (c):"memory"); -+ c[0] = 0; -+ bar (a); -+ if (a[1] != 0) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr57517.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57517.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57517.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+/* { dg-do compile } */ -+ -+int x[1024], y[1024], z[1024], w[1024]; -+void foo (void) -+{ -+ int i; -+ for (i = 1; i < 1024; ++i) -+ { -+ int a = x[i]; -+ int b = y[i]; -+ int c = x[i-1]; -+ int d = y[i-1]; -+ if (w[i]) -+ z[i] = (a + b) + (c + d); -+ } -+} -Index: gcc/testsuite/gcc.dg/torture/pr59891.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59891.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59891.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+/* PR c/59891 */ -+ -+unsigned int a; -+ -+int -+main () -+{ -+ return (0 ? a : 0) ? : 0 % 0; /* { dg-warning "division by zero" } */ -+} -Index: gcc/testsuite/gcc.dg/torture/pr59164.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59164.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59164.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+ -+int a, d, e; -+long b[10]; -+int c[10][8]; -+ -+int fn1(p1) -+{ -+ return 1 >> p1; -+} -+ -+void fn2(void) -+{ -+ int f; -+ for (a=1; a <= 4; a++) -+ { -+ f = fn1(0 < c[a][0]); -+ if (f || d) -+ e = b[a] = 1; -+ } -+} -Index: gcc/testsuite/gcc.dg/torture/pr58779.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58779.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58779.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+/* { dg-do run } */ -+ -+int a, c; -+ -+int main () -+{ -+ int e = -1; -+ short d = (c <= 0) ^ e; -+ if ((unsigned int) a - (a || d) <= (unsigned int) a) -+ __builtin_abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59139.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59139.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59139.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+ -+int a, b, c, d, e; -+int fn1(p1, p2) { return p2 == 0 ? p1 : 1 % p2; } -+ -+void fn2() -+{ -+ c = 0; -+ for (;; c = (unsigned short)c) -+ { -+ b = 2; -+ for (; b; b = a) -+ { -+ e = fn1(2, c && 1); -+ d = c == 0 ? e : c; -+ if (d) -+ return; -+ } -+ } -+} -Index: gcc/testsuite/gcc.dg/torture/pr58079.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58079.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58079.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,107 @@ -+/* { dg-options "-mlong-calls" { target mips*-*-* } } */ -+ -+typedef unsigned char u8; -+typedef unsigned short u16; -+typedef unsigned int __kernel_size_t; -+typedef __kernel_size_t size_t; -+struct list_head { -+ struct list_head *next; -+}; -+ -+struct dmx_ts_feed { -+ int is_filtering; -+}; -+struct dmx_section_feed { -+ u16 secbufp; -+ u16 seclen; -+ u16 tsfeedp; -+}; -+ -+typedef int (*dmx_ts_cb) ( -+ const u8 * buffer1, -+ size_t buffer1_length, -+ const u8 * buffer2, -+ size_t buffer2_length -+); -+ -+struct dvb_demux_feed { -+ union { -+ struct dmx_ts_feed ts; -+ struct dmx_section_feed sec; -+ } feed; -+ union { -+ dmx_ts_cb ts; -+ } cb; -+ int type; -+ u16 pid; -+ int ts_type; -+ struct list_head list_head; -+}; -+ -+struct dvb_demux { -+ int (*stop_feed)(struct dvb_demux_feed *feed); -+ struct list_head feed_list; -+}; -+ -+ -+static -+inline -+__attribute__((always_inline)) -+u8 -+payload(const u8 *tsp) -+{ -+ if (tsp[3] & 0x20) { -+ return 184 - 1 - tsp[4]; -+ } -+ return 184; -+} -+ -+static -+inline -+__attribute__((always_inline)) -+int -+dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, const u8 *buf) -+{ -+ int count = payload(buf); -+ int p; -+ if (count == 0) -+ return -1; -+ return feed->cb.ts(&buf[p], count, ((void *)0), 0); -+} -+ -+static -+inline -+__attribute__((always_inline)) -+void -+dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) -+{ -+ switch (feed->type) { -+ case 0: -+ if (feed->ts_type & 1) { -+ dvb_dmx_swfilter_payload(feed, buf); -+ } -+ if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) -+ feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; -+ } -+} -+ -+static -+void -+dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) -+{ -+ struct dvb_demux_feed *feed; -+ int dvr_done = 0; -+ -+ for (feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = ((&demux->feed_list)->next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );}); __builtin_prefetch(feed->list_head.next), &feed->list_head != (&demux->feed_list); feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = (feed->list_head.next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );})) { -+ if (((((feed)->type == 0) && ((feed)->feed.ts.is_filtering) && (((feed)->ts_type & (1 | 8)) == 1))) && (dvr_done++)) -+ dvb_dmx_swfilter_packet_type(feed, buf); -+ else if (feed->pid == 0x2000) -+ feed->cb.ts(buf, 188, ((void *)0), 0); -+ } -+} -+void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) -+{ -+ while (count--) { -+ dvb_dmx_swfilter_packet(demux, buf); -+ } -+} -Index: gcc/testsuite/gcc.dg/torture/pr58830.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58830.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58830.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,42 @@ -+/* { dg-do run } */ -+/* { dg-additional-options "-ftree-pre -ftree-partial-pre" } */ -+ -+extern void abort (void); -+ -+int b, c, d, f, g, h, i, j[6], *l = &b, *m, n, *o, r; -+char k; -+ -+static int -+foo () -+{ -+ char *p = &k; -+ -+ for (; d; d++) -+ if (i) -+ h = 0; -+ else -+ h = c || (r = 0); -+ -+ for (f = 0; f < 2; f++) -+ { -+ unsigned int q; -+ *l = 0; -+ if (n) -+ *m = g; -+ if (g) -+ o = 0; -+ for (q = -8; q >= 5; q++) -+ (*p)--; -+ } -+ -+ return 0; -+} -+ -+int -+main () -+{ -+ foo (); -+ if (j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ^ (k & 15)] != 0) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59715.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59715.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59715.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* { dg-do run } */ -+ -+extern void abort (void); -+ -+int a = 2, b; -+ -+int -+main () -+{ -+ int c; -+ if (!b) -+ { -+ b = a; -+ c = a == 0 ? 1 : 1 % a; -+ if (c) -+ b = 0; -+ } -+ if (b != 0) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr60115.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr60115.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr60115.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-do run } */ -+ -+int a, b[2]; -+ -+int -+main () -+{ -+lbl: -+ for (; a; a--) -+ if (b[10000]) -+ goto lbl; -+ -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59903.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59903.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59903.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,56 @@ -+/* { dg-do compile } */ -+ -+int a, b, c, d, e, f, g, h, i[3], l, m, n, o, p, q, r; -+ -+struct S0 -+{ -+ int f0; -+ int f1; -+ int f2; -+ int f3; -+} j; -+ -+static int -+fn1 (int p1) -+{ -+ return p1 || ((p1 > 0) > (e << 1)); -+} -+ -+static struct S0 -+fn2 (struct S0 p1) -+{ -+ char s; -+ struct S0 t = {0,0,0,0}; -+ int u = 2; ++ int h; + for (;;) + { -+ if (i[0]) -+ break; -+ for (m = 0; m < 4; m++) -+ for (p1.f0 = 0; p1.f0 < 3; p1.f0++) -+ { -+ j = t; -+ t.f3 = i[p1.f0]; -+ o = b || 1 >> b ? 0 : a < 0; -+ q = 1 % d; -+ if ((g < fn1 ((1 ^ (q & 1)) | n)) ^ u) -+ j.f3 |= p % 2; -+ s = j.f3 > 0 ? j.f3 : j.f3 << 1; -+ r = l = s && p1.f1 * c; -+ h = p1.f1; -+ } -+ } -+ return p1; -+} -+ -+int -+main () -+{ -+ for (;f;) -+ { -+ struct S0 v = {0,0,0,0}; -+ fn2 (v); -+ j.f3 = 0; -+ } -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr58143-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58143-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58143-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,51 @@ -+/* { dg-do run } */ -+/* { dg-additional-options "-fstrict-overflow" } */ -+ -+extern void abort (void); -+ -+int a, b, c, d, e, f, g, h = 1, i; -+ -+int foo (int p) -+{ -+ return p < 0 && a < - __INT_MAX__ - 1 - p ? 0 : 1; -+} -+ -+int *bar () -+{ -+ int j; -+ i = h ? 0 : 1 % h; -+ for (j = 0; j < 1; j++) -+ for (d = 0; d; d++) -+ for (e = 1; e;) -+ return 0; -+ return 0; -+} -+ -+int baz () -+{ -+ for (; b >= 0; b--) -+ for (c = 1; c >= 0; c--) -+ { -+ int *k = &c; -+ for (;;) -+ { -+ for (f = 0; f < 1; f++) -+ { -+ g = foo (*k); -+ bar (); -+ } -+ if (*k) -+ break; -+ return 0; -+ } -+ } -+ return 0; -+} -+ -+int main () -+{ -+ baz (); -+ if (b != 0) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr58143-2.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58143-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58143-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,34 @@ -+/* { dg-do run } */ -+/* { dg-additional-options "-fstrict-overflow" } */ -+ -+int a, b, d, e, f, *g, h, i; -+volatile int c; -+ -+char foo (unsigned char p) -+{ -+ return p + 1; -+} -+ -+int bar () -+{ -+ for (h = 0; h < 3; h = foo (h)) -+ { -+ c; -+ for (f = 0; f < 1; f++) ++ g = b; ++ g = g ? 0 : 1 % g; ++ e = a + 1; ++ for (; d < 1; d = e) + { -+ i = a && 0 < -__INT_MAX__ - h ? 0 : 1; -+ if (e) -+ for (; d;) -+ b = 0; ++ if (f == 0) ++ h = 0; + else -+ g = 0; -+ } -+ } -+ return 0; -+} -+ -+int main () -+{ -+ bar (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr58941.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58941.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58941.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+/* { dg-do run } */ -+ -+extern void abort (void); -+ -+typedef struct { -+ int msgLength; -+ unsigned char data[1000]; -+} SMsg; -+ -+typedef struct { -+ int dummy; -+ int d[0]; -+} SData; -+ -+int condition = 3; -+ -+int main() -+{ -+ SMsg msg; -+ SData *pData = (SData*)(msg.data); -+ unsigned int i = 0; -+ for (i = 0; i < 1; i++) -+ { -+ pData->d[i] = 0; -+ if(condition & 1) -+ pData->d[i] |= 0x55; -+ if(condition & 2) -+ pData->d[i] |= 0xaa; -+ } -+ if (pData->d[0] != 0xff) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr57488.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57488.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57488.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,58 @@ -+/* { dg-do run } */ -+ -+extern void abort (void); -+ -+int i, j, *pj = &j, **ppj = &pj; -+int x, *px = &x; -+ -+short s, *ps = &s, k; -+ -+unsigned short u, *pu = &u, **ppu = &pu; -+ -+char c, *pc = &c; -+ -+unsigned char v = 48; -+ -+static int -+bar (int p) -+{ -+ p = k; -+ *px = **ppu = i; -+ *ppj = &p; -+ if (**ppj) -+ *pj = p; -+ return p; -+} -+ -+void __attribute__((noinline)) -+foo () -+{ -+ for (; i <= 3; i++) -+ for (; j; j--); -+ -+ u ^= bar (*pj); -+ -+ for (k = 1; k >= 0; k--) -+ { -+ int l; -+ bar (0); -+ for (l = 1; l < 5; l++) -+ { -+ int m; -+ for (m = 6; m; m--) -+ { -+ v--; -+ *ps = *pc; -+ } ++ h = 1 % f; ++ if (f < 1) ++ c = 0; ++ else if (h) ++ break; + } ++ if (b) ++ return 0; + } +} + +int +main () +{ -+ foo (); -+ if (v != 0) -+ abort (); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr57569.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57569.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57569.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* { dg-do run } */ -+ -+extern void abort (void) __attribute__((noreturn)); -+ -+struct S { int f0; } a; -+ -+int b, e, *d = &b, f; -+ -+void -+fn1 () -+{ -+ int **g[9][6]; -+ int ***h = &g[6][3]; -+ for (; e < 9; e++) { -+ f = 0; -+ for (; f < 6; f++) -+ g[e][f] = &d; -+ } -+ ***h = 0; -+} -+ -+void -+fn2 () -+{ + fn1 (); -+ struct S c[4][10] = {}; -+ a = c[3][9]; -+} -+ -+int -+main () -+{ -+ fn2 (); -+ if (a.f0 != 0) -+ abort (); + return 0; +} -Index: gcc/testsuite/gcc.dg/torture/pr58143-3.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr58143-3.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr58143-3.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+/* { dg-do run } */ -+/* { dg-additional-options "-fstrict-overflow" } */ -+ -+int a, b, c, d, e; -+ -+int -+main () -+{ -+ for (b = 4; b > -30; b--) -+ for (; c;) -+ for (;;) -+ { -+ e = a > __INT_MAX__ - b; -+ if (d) -+ break; -+ } -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59288.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59288.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59288.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+/* { dg-do compile } */ -+ -+void -+baz (int *d) -+{ -+ long int i, j, k; -+ for (i = 0, j = 0, k = 0; i < 512; i = (int) i + 1, j = (int) j + 1, k = (int) k + 3) -+ d[i] = j ^ (i * 3) ^ (2 * k + 2); -+} -Index: gcc/testsuite/gcc.dg/torture/pr57425-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr57425-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr57425-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,37 @@ -+/* { dg-do run } */ -+ -+extern void abort (void) __attribute__((noreturn)); -+ -+union setconflict -+{ -+ int a[20]; -+ long b[10]; -+}; -+ -+int -+main () -+{ -+ int sum = 0; -+ { -+ union setconflict a; -+ int *c; -+ c = a.a; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 0; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ { -+ union setconflict a; -+ long *c; -+ c = a.b; -+ asm ("": "=r" (c):"0" (c)); -+ *c = 1; -+ asm ("": "=r" (c):"0" (c)); -+ sum += *c; -+ } -+ -+ if (sum != 1) -+ abort(); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/torture/pr59330.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/torture/pr59330.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/torture/pr59330.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+/* { dg-do run } */ -+ -+void free(void *ptr) -+{ -+} -+ -+void *foo(void) -+{ -+ return 0; -+} -+ -+int main(void) -+{ -+ void *p = foo(); -+ free(p); -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/tree-ssa/predcom-6.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/tree-ssa/predcom-6.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/predcom-6.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+/* { dg-do run } */ -+/* { dg-options "-O3" } */ -+ -+int a, c, e[5][2]; -+unsigned int d; -+ -+int -+main () -+{ -+ for (d = 0; d < 2; d++) -+ if (a ? 0 : e[c + 3][d] & e[c + 4][d]) -+ break; -+ return 0; -+} -Index: gcc/testsuite/gcc.dg/tree-ssa/predcom-7.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/tree-ssa/predcom-7.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/tree-ssa/predcom-7.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+/* { dg-do run } */ -+/* { dg-options "-O3 -fdump-tree-pcom-details" } */ -+ -+int b, f, d[5][2]; -+unsigned int c; -+ -+int -+main () -+{ -+ for (c = 0; c < 2; c++) -+ if (d[b + 3][c] & d[b + 4][c]) -+ if (f) -+ break; -+ return 0; -+} -+ -+/* { dg-final { scan-tree-dump "Executing predictive commoning" "pcom" } } */ -+/* { dg-final { cleanup-tree-dump "pcom" } } */ -Index: gcc/testsuite/gcc.dg/strlenopt-4.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/strlenopt-4.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/strlenopt-4.c (.../branches/gcc-4_8-branch) -@@ -66,16 +66,10 @@ - return 0; - } - --/* For targets providing a movstr pattern strcat is already decomposed -- into strlen + strcpy by fold_builtin_strcat. */ -- --/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ --/* { dg-final { scan-tree-dump-times "strlen \\(" 6 "strlen" { target s390*-*-* } } } */ -+/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "memcpy \\(" 4 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "strcpy \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ --/* { dg-final { scan-tree-dump-times "strcpy \\(" 6 "strlen" { target s390*-*-* } } } */ --/* { dg-final { scan-tree-dump-times "strcat \\(" 3 "strlen" { target { ! s390*-*-* } } } } */ --/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" { target s390*-*-* } } } */ -+/* { dg-final { scan-tree-dump-times "strcpy \\(" 3 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "strcat \\(" 3 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ - /* { dg-final { cleanup-tree-dump "strlen" } } */ -Index: gcc/testsuite/gcc.dg/pr56824.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr56824.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr56824.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+/* PR preprocessor/56824 */ -+/* { dg-do compile } */ -+/* { dg-options "-Waggregate-return" } */ -+ -+struct S { int i; }; -+struct S foo (void); -+ -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Waggregate-return" -+ -+int -+main () -+{ -+ foo (); -+ return 0; -+} -+ -+#pragma GCC diagnostic pop -Index: gcc/testsuite/gcc.dg/ipa/pr55260.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/ipa/pr55260.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/ipa/pr55260.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,38 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-inline -fipa-cp-clone" } */ -+ -+typedef struct { -+ int *ptr; -+ int len; -+} string; -+typedef struct { -+ string nantstr; -+ int *nant; -+} malv; -+typedef struct { -+ int *nor; -+} list_heads; -+int b; -+list_heads *fn1(string, int *, unsigned); -+void fn2(malv *p1, list_heads *p2, unsigned p3) { -+ string a = p1->nantstr; -+ fn1(a, p1->nant, p3); -+} -+ -+void fn3(unsigned p1) { fn2(0, 0, p1); } -+ -+list_heads *fn1(string p1, int *p2, unsigned p3) { -+ while (1) { -+ if (p3) -+ fn3(1); -+ if (b) -+ return 0; -+ fn3(1); -+ } -+} -+ -+void fn5() { -+ list_heads c; -+ c.nor = 0; -+ fn2(0, &c, 1); -+} -Index: gcc/testsuite/gcc.dg/ipa/pr59610.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/ipa/pr59610.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/ipa/pr59610.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2" } */ -+ -+struct A { int a; }; -+extern void *y; -+ -+__attribute__((optimize (0))) void -+foo (void *p, struct A x) -+{ -+ foo (y, x); -+} -Index: gcc/testsuite/gcc.dg/pr60485-1.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr60485-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr60485-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-do run } */ -+/* { dg-options "-O2" } */ -+ -+extern void abort (void); -+struct S { -+ int *i[4]; -+ int *p1; -+ int *p2; -+ int *p3; -+ int *p4; -+}; -+int **b; -+int main() -+{ -+ int i = 1; -+ struct S s; -+ s.p3 = &i; -+ int **p; -+ if (b) -+ p = b; -+ else -+ p = &s.i[2]; -+ p += 4; -+ if (!b) -+ **p = 0; -+ if (i != 0) -+ abort (); -+ return i; -+} -Index: gcc/testsuite/gcc.dg/strlenopt-1f.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/strlenopt-1f.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/strlenopt-1f.c (.../branches/gcc-4_8-branch) -@@ -6,13 +6,13 @@ - #include "strlenopt-1.c" - - /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 3 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 1 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__strcat_chk \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "memcpy \\(" 0 "strlen" } } */ --/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "memcpy \\(" 3 "strlen" } } */ -+/* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */ - /* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */ - /* { dg-final { cleanup-tree-dump "strlen" } } */ -Index: gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c (.../branches/gcc-4_8-branch) -@@ -1,4 +1,5 @@ - /* { dg-require-effective-target vect_int } */ -+/* { dg-skip-if "cost too high" { powerpc*le-*-* } { "*" } { "" } } */ - - #include <stdarg.h> - #include "../../tree-vect.h" -Index: gcc/testsuite/gcc.dg/vect/pr60382.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vect/pr60382.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vect/pr60382.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+#include "tree-vect.h" -+ -+int a, b, c, e, f; -+ -+void -+foo () -+{ -+ for (b = 0; b < 3; b++) -+ if (e) -+ { -+ for (c = 0; c < 4; c++) -+ { -+ if (b) -+ continue; -+ f = 1; -+ for (a = 0; a < 2; a++) -+ f |= 1; -+ } -+ for (;;) -+ ; -+ } -+} -+ -+int -+main () -+{ -+ check_vect (); -+ foo (); -+ return 0; -+} -+ -+/* { dg-final { cleanup-tree-dump "vect" } } */ -Index: gcc/testsuite/gcc.dg/vect/pr60276.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/vect/pr60276.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/vect/pr60276.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,52 @@ -+/* { dg-do run } */ -+ -+extern void abort (void); -+ -+static void -+foo (int *out, const int *lp, unsigned samples) -+{ -+ int x, target; -+ for (x = 0, target = 0; x < (int)samples; x += 2, target++) -+ { -+ out[x] = lp[target]; -+ out[x - 1] = out[x - 2] + out[x]; -+ } -+} -+ -+static void -+foo_novec (int *out, const int *lp, unsigned samples) -+{ -+ int x, target; -+ for (x = 0, target = 0; x < (int)samples; x += 2, target++) -+ { -+ out[x] = lp[target]; -+ out[x - 1] = out[x - 2] + out[x]; -+ __asm__ volatile ("" : : : "memory"); -+ } -+} -+ -+int main(void) -+{ -+ const int lp[25] = { -+ 0, 2, 4, 6, 8, -+ 10, 12, 14, 16, -+ 18, 20, 22, 24, -+ 26, 28, 30, 32, -+ 34, 36, 38, 40, -+ 42, 44, 46, 48, -+ }; -+ int out[49] = {0}; -+ int out2[49] = {0}; -+ int s; -+ -+ foo (out + 2, lp + 1, 48); -+ foo_novec (out2 + 2, lp + 1, 48); -+ -+ for (s = 0; s < 49; s++) -+ if (out[s] != out2[s]) -+ abort (); -+ -+ return 0; -+} -+ -+/* { dg-final { cleanup-tree-dump "vect" } } */ -Index: gcc/testsuite/gcc.dg/pr53060.c -=================================================================== ---- a/src/gcc/testsuite/gcc.dg/pr53060.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gcc.dg/pr53060.c (.../branches/gcc-4_8-branch) -@@ -25,3 +25,4 @@ - - /* Ignore a warning that is irrelevant to the purpose of this test. */ - /* { dg-prune-output ".*GCC vector returned by reference.*" } */ -+/* { dg-prune-output "changes the ABI" } */ Index: gcc/testsuite/ChangeLog =================================================================== ---- a/src/gcc/testsuite/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/gcc/testsuite/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/gcc/testsuite/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,1573 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-04-05 David Edelsohn <dje.gcc@gmail.com> -+ -+ * gcc.target/powerpc/sd-vsx.c: Skip on AIX. -+ * gcc.target/powerpc/sd-pwr6.c: Same. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from trunk -+ 2014-03-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/p8vector-int128-1.c: New test to test ISA -+ 2.07 128-bit arithmetic. -+ * gcc.target/powerpc/p8vector-int128-2.c: Likewise. -+ -+ * gcc.target/powerpc/timode_off.c: Restrict cpu type to power5, -+ due to when TImode is allowed in VSX registers, the allowable -+ address modes for TImode is just a single indirect address in -+ order for the value to be loaded and store in either GPR or VSX -+ registers. This affects the generated code, and it would cause -+ this test to fail, when such an option is used. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r207699. -+ 2014-02-11 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60137 -+ * gcc.target/powerpc/pr60137.c: New file. -+ -+ Backport from mainline r207808. -+ 2014-02-15 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/60203 -+ * gcc.target/powerpc/pr60203.c: New testsuite. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Little Endian Vector API Support -+ Backport from mainline r206590 -+ 2014-01-13 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/insert.c: New. -+ * gcc.dg/vmx/insert-be-order.c: New. -+ * gcc.dg/vmx/extract.c: New. -+ * gcc.dg/vmx/extract-be-order.c: New. -+ -+ Backport from mainline r206641 -+ 2014-01-15 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ -+ * gcc.dg/vmx/mult-even-odd.c: New. -+ * gcc.dg/vmx/mult-even-odd-be-order.c: New. -+ -+ Backport from mainline r206926 -+ 2014-01-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/insert-vsx-be-order.c: New. -+ * gcc.dg/vmx/extract-vsx.c: New. -+ * gcc.dg/vmx/extract-vsx-be-order.c: New. -+ * gcc.dg/vmx/insert-vsx.c: New. -+ -+ Backport from mainline r207262 -+ 2014-01-29 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/merge-be-order.c: New. -+ * gcc.dg/vmx/merge.c: New. -+ * gcc.dg/vmx/merge-vsx-be-order.c: New. -+ * gcc.dg/vmx/merge-vsx.c: New. -+ -+ Backport from mainline r207318 -+ 2014-01-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/splat.c: New. -+ * gcc.dg/vmx/splat-vsx.c: New. -+ * gcc.dg/vmx/splat-be-order.c: New. -+ * gcc.dg/vmx/splat-vsx-be-order.c: New. -+ * gcc.dg/vmx/eg-5.c: Remove special casing for little endian. -+ * gcc.dg/vmx/sn7153.c: Add special casing for little endian. -+ -+ Backport from mainline r207414 -+ 2014-02-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/vsums.c: New. -+ * gcc.dg/vmx/vsums-be-order.c: New. -+ -+ Backport from mainline r207415 -+ 2014-02-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/3b-15.c: Remove special handling for little endian. -+ * gcc.dg/vmx/perm.c: New. -+ * gcc.dg/vmx/perm-be-order.c: New. -+ -+ Backport from mainline r207520 -+ 2014-02-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/pack.c: New. -+ * gcc.dg/vmx/pack-be-order.c: New. -+ * gcc.dg/vmx/unpack.c: New. -+ * gcc.dg/vmx/unpack-be-order.c: New. -+ -+ Backport from mainline r207521 -+ 2014-02-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/sum2s.c: New. -+ * gcc.dg/vmx/sum2s-be-order.c: New. -+ -+ Backport from mainline 208019 -+ 2014-02-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/ld.c: New test. -+ * gcc.dg/vmx/ld-be-order.c: New test. -+ * gcc.dg/vmx/ld-vsx.c: New test. -+ * gcc.dg/vmx/ld-vsx-be-order.c: New test. -+ * gcc.dg/vmx/ldl.c: New test. -+ * gcc.dg/vmx/ldl-be-order.c: New test. -+ * gcc.dg/vmx/ldl-vsx.c: New test. -+ * gcc.dg/vmx/ldl-vsx-be-order.c: New test. -+ * gcc.dg/vmx/st.c: New test. -+ * gcc.dg/vmx/st-be-order.c: New test. -+ * gcc.dg/vmx/st-vsx.c: New test. -+ * gcc.dg/vmx/st-vsx-be-order.c: New test. -+ * gcc.dg/vmx/stl.c: New test. -+ * gcc.dg/vmx/stl-be-order.c: New test. -+ * gcc.dg/vmx/stl-vsx.c: New test. -+ * gcc.dg/vmx/stl-vsx-be-order.c: New test. -+ -+ Backport from mainline 208021 -+ 2014-02-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/vsums.c: Check entire result vector. -+ * gcc.dg/vmx/vsums-be-order.c: Likewise. -+ -+ Backport from mainline 208049 -+ 2014-02-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/lde.c: New test. -+ * gcc.dg/vmx/lde-be-order.c: New test. -+ * gcc.dg/vmx/ste.c: New test. -+ * gcc.dg/vmx/ste-be-order.c: New test. -+ -+ Backport from mainline 208120 -+ 2014-02-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/ld-vsx.c: Don't use vec_all_eq. -+ * gcc.dg/vmx/ld-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/ldl-vsx.c: Likewise. -+ * gcc.dg/vmx/ldl-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/merge-vsx.c: Likewise. -+ * gcc.dg/vmx/merge-vsx-be-order.c: Likewise. -+ -+ Backport from mainline 208321 -+ 2014-03-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/extract-vsx.c: Replace "vector long" with "vector -+ long long" throughout. -+ * gcc.dg/vmx/extract-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/insert-vsx.c: Likewise. -+ * gcc.dg/vmx/insert-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/ld-vsx.c: Likewise. -+ * gcc.dg/vmx/ld-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/ldl-vsx.c: Likewise. -+ * gcc.dg/vmx/ldl-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/merge-vsx.c: Likewise. -+ * gcc.dg/vmx/merge-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/st-vsx.c: Likewise. -+ * gcc.dg/vmx/st-vsx-be-order.c: Likewise. -+ * gcc.dg/vmx/stl-vsx.c: Likewise. -+ * gcc.dg/vmx/stl-vsx-be-order.c: Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Back port from mainline -+ 2014-01-23 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59909 -+ * gcc.target/powerpc/quad-atomic.c: New file to test power8 quad -+ word atomic functions at runtime. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-10-23 Pat Haugen <pthaugen@us.ibm.com> -+ -+ * gcc.target/powerpc/direct-move.h: Fix header for executable tests. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ PR target/56843 -+ * gcc.target/powerpc/recip-1.c: Modify expected output. -+ * gcc.target/powerpc/recip-3.c: Likewise. -+ * gcc.target/powerpc/recip-4.c: Likewise. -+ * gcc.target/powerpc/recip-5.c: Add expected output for iterations. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com> -+ -+ * gcc.target/powerpc/dfp-dd-2.c: New test. -+ * gcc.target/powerpc/dfp-td-2.c: Likewise. -+ * gcc.target/powerpc/dfp-td-3.c: Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ ELFv2 ABI Support -+ Backport from mainline r204808: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * gcc.target/powerpc/ppc64-abi-1.c (stack_frame_t): Remove -+ compiler and linker field if _CALL_ELF == 2. -+ * gcc.target/powerpc/ppc64-abi-2.c (stack_frame_t): Likewise. -+ * gcc.target/powerpc/ppc64-abi-dfp-1.c (stack_frame_t): Likewise. -+ * gcc.dg/stack-usage-1.c (SIZE): Update value for _CALL_ELF == 2. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * gcc.target/powerpc/ppc64-abi-dfp-1.c (FUNC_START): New macro. -+ (WRAPPER): Use it. -+ * gcc.target/powerpc/no-r11-1.c: Skip on powerpc_elfv2. -+ * gcc.target/powerpc/no-r11-2.c: Skip on powerpc_elfv2. -+ * gcc.target/powerpc/no-r11-3.c: Skip on powerpc_elfv2. -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * lib/target-supports.exp (check_effective_target_powerpc_elfv2): -+ New function. -+ * gcc.target/powerpc/pr57949-1.c: Disable for powerpc_elfv2. -+ * gcc.target/powerpc/pr57949-2.c: Likewise. -+ -+ Backport from mainline r204799: -+ -+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * g++.dg/eh/ppc64-sighandle-cr.C: New test. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline r201750. -+ Note: Default setting of -mcompat-align-parm inverted! -+ -+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ PR target/57949 -+ * gcc.target/powerpc/pr57949-1.c: New. -+ * gcc.target/powerpc/pr57949-2.c: New. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Little Endian Vector Support -+ Backport from mainline r205638 -+ 2013-12-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: Skip for little -+ endian. -+ -+ Backport from mainline r205146 -+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/pr48258-1.c: Skip for little endian. -+ -+ Backport from mainline r204862 -+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/3b-15.c: Revise for little endian. -+ -+ Backport from mainline r204321 -+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com> -+ -+ * gcc.dg/vmx/vec-set.c: New. -+ -+ Backport from mainline r204138 -+ 2013-10-28 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant. -+ * gcc.dg/vmx/eg-5.c: Likewise. -+ -+ Backport from mainline r203930 -+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com> -+ -+ * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack -+ tests into... -+ * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is -+ restricted to big-endian targets. -+ -+ Backport from mainline r203246 -+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/pr43154.c: Skip for ppc64 little endian. -+ * gcc.target/powerpc/fusion.c: Likewise. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-11-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * gfortran.dg/nan_7.f90: Disable for little endian PowerPC. -+ -+ Backport from mainline r205106: -+ -+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * gcc.target/powerpc/darwin-longlong.c (msw): Make endian-safe. -+ -+ Backport from mainline r205046: -+ -+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> -+ -+ * gcc.target/powerpc/ppc64-abi-2.c (MAKE_SLOT): New macro to -+ construct parameter slot value in endian-independent way. -+ (fcevv, fciievv, fcvevv): Use it. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Power8 HTM Support -+ Backport from mainline -+ * lib/target-supports.exp (check_effective_target_powerpc_htm_ok): New -+ function to test if HTM is available. -+ * gcc.target/powerpc/htm-xl-intrin-1.c: New test. -+ * gcc.target/powerpc/htm-builtin-1.c: New test. -+ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Power8 Base Support -+ Backport from mainline -+ 2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59054 -+ * gcc.target/powerpc/direct-move.h (VSX_REG_ATTR): Allow test to -+ specify an appropriate register class for VSX operations. -+ (load_vsx): Use it. -+ (load_gpr_to_vsx): Likewise. -+ (load_vsx_to_gpr): Likewise. -+ * gcc.target/powerpc/direct-move-vint1.c: Use an appropriate -+ register class for VSX registers that the type can handle. Remove -+ checks for explicit number of instructions generated, just check -+ if the instruction is generated. -+ * gcc.target/powerpc/direct-move-vint2.c: Likewise. -+ * gcc.target/powerpc/direct-move-float1.c: Likewise. -+ * gcc.target/powerpc/direct-move-float2.c: Likewise. -+ * gcc.target/powerpc/direct-move-double1.c: Likewise. -+ * gcc.target/powerpc/direct-move-double2.c: Likewise. -+ * gcc.target/powerpc/direct-move-long1.c: Likewise. -+ * gcc.target/powerpc/direct-move-long2.c: Likewise. -+ -+ * gcc.target/powerpc/bool3-av.c: Limit to 64-bit mode for now. -+ * gcc.target/powerpc/bool3-p7.c: Likewise. -+ * gcc.target/powerpc/bool3-p8.c: Likewise. -+ -+ * gcc.target/powerpc/p8vector-ldst.c: Just check that the -+ appropriate instructions are generated, don't check the count. -+ -+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/59054 -+ * gcc.target/powerpc/pr59054.c: New test. -+ -+ 2013-08-22 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/pr57744.c: Declare abort. -+ -+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com> -+ -+ * gcc.target/powerpc/pr57744.c: Fix typo. -+ -+ Back port from mainline -+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/p8vector-fp.c: New test for floating point -+ scalar operations when using -mupper-regs-sf and -mupper-regs-df. -+ * gcc.target/powerpc/ppc-target-1.c: Update tests to allow either -+ VSX scalar operations or the traditional floating point form of -+ the instruction. -+ * gcc.target/powerpc/ppc-target-2.c: Likewise. -+ * gcc.target/powerpc/recip-3.c: Likewise. -+ * gcc.target/powerpc/recip-5.c: Likewise. -+ * gcc.target/powerpc/pr72747.c: Likewise. -+ * gcc.target/powerpc/vsx-builtin-3.c: Likewise. -+ -+ Back port from mainline -+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf -+ and -mupper-regs-df. -+ -+ Back port from mainline -+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/58673 -+ * gcc.target/powerpc/pr58673-1.c: New file to test whether -+ -mquad-word + -mno-vsx-timode causes errors. -+ * gcc.target/powerpc/pr58673-2.c: Likewise. -+ -+ -+ Backport from trunk. -+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/bool2.h: New file, test the code generation -+ of logical operations for power5, altivec, power7, and power8 systems. -+ * gcc.target/powerpc/bool2-p5.c: Likewise. -+ * gcc.target/powerpc/bool2-av.c: Likewise. -+ * gcc.target/powerpc/bool2-p7.c: Likewise. -+ * gcc.target/powerpc/bool2-p8.c: Likewise. -+ * gcc.target/powerpc/bool3.h: Likewise. -+ * gcc.target/powerpc/bool3-av.c: Likewise. -+ * gcc.target/powerpc/bool2-p7.c: Likewise. -+ * gcc.target/powerpc/bool2-p8.c: Likewise. -+ -+ Backport from trunk. -+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/fusion.c: New file, test power8 fusion support. -+ -+ Back port from the trunk -+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ PR target/57744 -+ * gcc.target/powerpc/pr57744.c: New test to make sure lqarx and -+ stqcx. get even registers. -+ -+ Back port from the trunk -+ -+ 2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * gcc.target/powerpc/atomic-p7.c: New file, add tests for atomic -+ load/store instructions on power7, power8. -+ * gcc.target/powerpc/atomic-p8.c: Likewise. -+ -+ Back port from the trunk -+ -+ 2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * gcc.target/powerpc/direct-move-vint1.c: New tests for power8 -+ direct move instructions. -+ * gcc.target/powerpc/direct-move-vint2.c: Likewise. -+ * gcc.target/powerpc/direct-move.h: Likewise. -+ * gcc.target/powerpc/direct-move-float1.c: Likewise. -+ * gcc.target/powerpc/direct-move-float2.c: Likewise. -+ * gcc.target/powerpc/direct-move-double1.c: Likewise. -+ * gcc.target/powerpc/direct-move-double2.c: Likewise. -+ * gcc.target/powerpc/direct-move-long1.c: Likewise. -+ * gcc.target/powerpc/direct-move-long2.c: Likewise. -+ -+ Backport from the trunk -+ -+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * gcc.target/powerpc/p8vector-builtin-1.c: New test to test -+ power8 builtin functions. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c: New -+ tests to test power8 auto-vectorization. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c: Likewise. -+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c: Likewise. -+ -+ * gcc.target/powerpc/crypto-builtin-1.c: Use effective target -+ powerpc_p8vector_ok instead of powerpc_vsx_ok. -+ -+ * gcc.target/powerpc/bool.c: New file, add eqv, nand, nor tests. -+ -+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8 -+ support. -+ (check_effective_target_powerpc_p8vector_ok): Likewise. -+ (is-effective-target): Likewise. -+ (check_vect_support_and_set_flags): Likewise. -+ -+ Backport from trunk -+ -+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com> -+ Pat Haugen <pthaugen@us.ibm.com> -+ Peter Bergner <bergner@vnet.ibm.com> -+ -+ * gcc.target/powerpc/crypto-builtin-1.c: New file, test for power8 -+ crypto builtins. -+ -+ Backport from mainline -+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com> -+ -+ * gcc.target/powerpc/mmfpgpr.c: New test. -+ * gcc.target/powerpc/sd-vsx.c: Likewise. -+ * gcc.target/powerpc/sd-pwr6.c: Likewise. -+ * gcc.target/powerpc/vsx-float0.c: Likewise. -+ -+2014-04-01 Dominique d'Humieres <dominiq@lps.ens.fr> -+ -+ PR libfortran/60128 -+ * gfortran.dg/fmt_en.f90: Skip unsupported rounding tests. -+ XFAIL for i?86-*-solaris2.9* and hppa*-*-hpux*. -+ -+2014-03-31 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-03-31 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR rtl-optimization/60700 -+ * gcc.target/i386/pr60700.c: New test. -+ -+2014-03-28 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR rtl-optimization/60700 -+ Backport from mainline -+ 2013-07-30 Zhenqiang Chen <zhenqiang.chen@linaro.org> -+ -+ * gcc.target/arm/pr57637.c: New testcase. -+ -+2014-04-28 Thomas Koenig <tkoenig@gcc.gnu.org> -+ -+ PR fortran/60522 -+ * gfortran.dg/where_4.f90: New test case. -+ -+2014-03-26 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/60419 -+ * g++.dg/ipa/pr60419.C: New test. -+ -+2014-03-26 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc.c-torture/execute/20140326-1.c: New test. -+ -+2014-03-20 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/60543 -+ PR fortran/60283 -+ * gfortran.dg/implicit_pure_4.f90: New. -+ -+2014-03-17 Mikael Pettersson <mikpelinux@gmail.com> -+ Committed by Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline: -+ -+ 2013-06-16 Joern Rennecke <joern.rennecke@embecosm.com> -+ -+ PR rtl-optimization/57425 -+ PR rtl-optimization/57569 -+ * gcc.dg/torture/pr57425-1.c, gcc.dg/torture/pr57425-2.c: New files. -+ * gcc.dg/torture/pr57425-3.c, gcc.dg/torture/pr57569.c: Likewise. -+ -+2014-03-17 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-03-11 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60429 -+ PR tree-optimization/60485 -+ * gcc.dg/pr60485-1.c: New testcase. -+ * gcc.dg/pr60485-2.c: Likewise. -+ -+2014-03-15 Dominique d'Humieres <dominiq@lps.ens.fr> -+ -+ Backport from mainline -+ PR libfortran/60128 -+ * gfortran.dg/fmt_en.f90: New test. -+ -+2014-03-15 Jerry DeLisle <jvdelisle@gcc.gnu> -+ -+ Backport from mainline -+ PR libfortran/58324 -+ * gfortran.dg/list_read_12.f90: New test. -+ -+2014-03-13 Joey Ye <joey.ye@arm.com> -+ -+ Backport from mainline -+ 2014-03-12 Thomas Preud'homme <thomas.preudhomme@arm.com> -+ -+ PR tree-optimization/60454 -+ * gcc.c-torture/execute/pr60454.c: New test. -+ -+2014-03-08 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/60450 -+ * gfortran.dg/shape_8.f90: New. -+ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ Backport from mainline -+ 2014-02-19 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/37743 -+ * g++.dg/ext/builtin-bswap1.C: New test. -+ * c-c++-common/pr37743.c: New test. -+ -+ PR preprocessor/58844 -+ * c-c++-common/cpp/pr58844-1.c: New test. -+ * c-c++-common/cpp/pr58844-2.c: New test. -+ -+ 2014-02-13 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/43546 -+ * gcc.target/i386/pr43546.c: New test. -+ -+ 2014-02-12 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/60101 -+ * c-c++-common/pr60101.c: New test. -+ -+ 2014-02-11 Jakub Jelinek <jakub@redhat.com> -+ -+ PR fortran/52370 -+ * gfortran.dg/pr52370.f90: New test. -+ -+ PR debug/59776 -+ * gcc.dg/guality/pr59776.c: New test. -+ -+ 2014-02-07 Jakub Jelinek <jakub@redhat.com> -+ -+ PR preprocessor/56824 -+ * gcc.dg/pr56824.c: New test. -+ -+ 2014-02-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/60062 -+ * gcc.c-torture/execute/pr60062.c: New test. -+ * gcc.c-torture/execute/pr60072.c: New test. -+ -+ 2014-02-04 Jakub Jelinek <jakub@redhat.com> -+ -+ PR ipa/60026 -+ * c-c++-common/torture/pr60026.c: New test. -+ -+ 2014-02-05 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/57499 -+ * g++.dg/torture/pr57499.C: New test. -+ -+ 2014-03-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR preprocessor/60400 -+ * c-c++-common/cpp/pr60400.c: New test. -+ * c-c++-common/cpp/pr60400-1.h: New file. -+ * c-c++-common/cpp/pr60400-2.h: New file. -+ -+2014-03-04 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60382 -+ * gcc.dg/vect/pr60382.c: New testcase. -+ -+2014-03-02 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/60341 -+ * gfortran.dg/str_comp_optimize_1.f90: New test. -+ -+2014-02-25 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-02-21 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60276 -+ * gcc.dg/vect/pr60276.c: New testcase. -+ -+2014-02-25 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-02-14 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60183 -+ * gcc.dg/torture/pr60183.c: New testcase. -+ -+2014-02-24 Fabien Chêne <fabien@gcc.gnu.org> -+ -+ PR c++/37140 -+ * g++.dg/template/using27.C: New. -+ * g++.dg/template/using28.C: New. -+ * g++.dg/template/using29.C: New. -+ -+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ * gcc/testsuite/gcc.target/microblaze/others/mem_reload.c: New test. -+ -+2014-02-22 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/59599 -+ * gfortran.dg/ichar_3.f90: New test. -+ -+2014-02-21 Steven G. Kargl <kargl@gcc.gnu.org> -+ -+ Backport from mainline -+ PR fortran/59700 -+ * gfortran.dg/pr59700.f90: New test. -+ -+2014-02-21 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/55260 -+ * gcc.dg/ipa/pr55260.c: New test. -+ -+2014-02-19 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/49397 -+ * gfortran.dg/proc_ptr_45.f90: New. -+ * gfortran.dg/proc_ptr_46.f90: New. -+ -+2014-02-19 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-02-19 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59794 -+ * gcc.target/i386/pr39162.c: Add dg-prune-output. -+ (dg-options): Remove -Wno-psabi. -+ * gcc.target/i386/pr59794-2.c: Ditto. -+ * gcc.target/i386/sse-5.c: Ditto. -+ -+2014-02-19 Janus Weil <janus@gcc.gnu.org> -+ -+ Backports from mainline: -+ 2014-02-17 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/55907 -+ * gfortran.dg/init_flag_12.f90: New. -+ -+ 2014-02-18 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/60231 -+ * gfortran.dg/typebound_generic_15.f90: New. -+ -+2014-02-18 Kai Tietz <ktietz@redhat.com> -+ -+ PR target/60193 -+ * gcc.target/i386/nest-1.c: New testcase. -+ -+2014-02-18 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gnat.dg/opt32.adb: New test. -+ -+2014-02-15 Jerry DeLisle <jvdelisle@gcc.gnu> -+ Dominique d'Humieres <dominiq@lps.ens.fr> -+ -+ Backport from mainline -+ PR libfortran/59771 -+ PR libfortran/59774 -+ PR libfortran/59836 -+ * gfortran.dg/fmt_g_1.f90: New test. -+ * gfortran.dg/round_3.f08: New cases added. -+ -+2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ -+ * gcc.target/s390/hotpatch-compile-8.c: New test. -+ -+2014-02-12 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc.c-torture/execute/20140212-1.c: New test. -+ -+2014-02-10 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2014-01-30 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59903 -+ * gcc.dg/torture/pr59903.c: New testcase. -+ -+ 2014-02-10 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/60115 -+ * gcc.dg/torture/pr60115.c: New testcase. -+ -+2014-02-09 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-10-21 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/58803 -+ PR fortran/59395 -+ * gfortran.dg/proc_ptr_comp_38.f90: New. -+ -+2014-02-08 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/57033 -+ * gfortran.dg/default_initialization_7.f90: New test. -+ -+2014-02-07 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/59906 -+ * gfortran.dg/elemental_subroutine_9.f90 : New test -+ -+2014-02-04 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2014-02-02 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/60017 -+ * gcc.c-torture/execute/pr60017.c: New test. -+ -+2014-02-01 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/59414 -+ * gfortran.dg/allocate_class_3.f90 : New test -+ -+2014-01-30 David Holsgrove <david.holsgrove@xilinx.com> -+ -+ Backport from mainline. -+ * gcc.target/microblaze/isa/fcmp4.c: New. -+ -+2014-01-26 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/58007 -+ * gfortran.dg/unresolved_fixup_1.f90: New test. -+ * gfortran.dg/unresolved_fixup_2.f90: New test. -+ -+2014-01-24 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline. -+ 2014-01-23 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59929 -+ * gcc.target/i386/pr59929.c: New test. -+ -+2014-01-24 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/57524 -+ * g++.dg/ext/timevar2.C: New. -+ -+2014-01-23 David Holsgrove <david.holsgrove@xilinx.com> +@@ -1,3 +1,137 @@ ++2014-07-10 Eric Botcazou <ebotcazou@adacore.com> + -+ Backport from mainline. -+ * gcc.target/microblaze/others/builtin-trap.c: New test. ++ * gnat.dg/opt39.adb: New test. + -+2014-01-23 Marek Polacek <polacek@redhat.com> ++2014-07-08 Paul Thomas <pault@gcc.gnu.org> + -+ Backport from mainline -+ 2013-10-21 Marek Polacek <polacek@redhat.com> -+ -+ PR middle-end/58809 -+ * gcc.dg/gomp/pr58809.c: New test. -+ -+2014-01-23 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58809 -+ * c-c++-common/gomp/pr58809.c: New test. -+ -+2014-01-22 Marek Polacek <polacek@redhat.com> -+ -+ Backport from mainline -+ 2014-01-22 Marek Polacek <polacek@redhat.com> -+ -+ PR c/59891 -+ * gcc.dg/torture/pr59891.c: New test. -+ -+2014-01-21 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/59860 -+ * gcc.dg/strlenopt-4.c: Expect the same counts on s390*-* as on all -+ other targets. -+ -+2014-01-20 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/59860 -+ * gcc.dg/pr59860.c: New testcase. -+ -+2014-01-20 Marek Polacek <polacek@redhat.com> -+ -+ Backported from mainline -+ 2014-01-17 Marek Polacek <polacek@redhat.com> -+ -+ PR c++/59838 -+ * g++.dg/diagnostic/pr59838.C: New test. -+ -+2014-01-19 Paul Thomas <pault@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-01 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/34547 -+ * gfortran.dg/null_5.f90 : Include new error. -+ * gfortran.dg/null_6.f90 : Include new error. -+ -+2014-01-17 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-01-15 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59794 -+ * c-c++-common/convert-vec-1.c: Also prune ABI change for -+ Linux/x86. -+ * g++.dg/cpp0x/constexpr-53094-2.C: Likewise. -+ * g++.dg/ext/attribute-test-1.C: Likewise. -+ * g++.dg/ext/attribute-test-2.C: Likewise. -+ * g++.dg/ext/attribute-test-3.C: Likewise. -+ * g++.dg/ext/attribute-test-4.C: Likewise. -+ * g++.dg/torture/pr38565.C: Likewise. -+ * gcc.dg/pr53060.c: Likewise. -+ * c-c++-common/scal-to-vec2.c: Add -msse2 for x86. -+ * c-c++-common/vector-compare-2.c: Likewise. -+ * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: Likewise. -+ * g++.dg/conversion/simd1.C: Add -msse2 for x86. Adjust -+ dg-message line number. -+ -+2014-01-17 H.J. Lu <hongjiu.lu@intel.com> -+ -+ Backport from mainline -+ 2014-01-14 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/59794 -+ * gcc.target/i386/pr39162.c (y): New __m256i variable. -+ (bar): Change return type to void. Set y to x. -+ * gcc.target/i386/pr59794-1.c: New testcase. -+ * gcc.target/i386/pr59794-2.c: Likewise. -+ * gcc.target/i386/pr59794-3.c: Likewise. -+ * gcc.target/i386/pr59794-4.c: Likewise. -+ * gcc.target/i386/pr59794-5.c: Likewise. -+ * gcc.target/i386/pr59794-6.c: Likewise. -+ * gcc.target/i386/pr59794-7.c: Likewise. -+ -+2014-01-17 Matthias Klose <doko@ubuntu.com> -+ -+ Backport from the trunk: -+ 2014-01-09 Uros Bizjak <ubizjak@gmail.com> -+ * go.test/go-test.exp (go-gc-tests): Don't run peano.go on systems -+ which don't support -fsplit-stack. Skip rotate[0123].go tests. -+ -+2014-01-15 Kugan Vivekanandarajah <kuganv@linaro.org> -+ -+ Backport from mainline -+ 2014-01-15 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org> -+ Kugan Vivekanandarajah <kuganv@linaro.org> -+ -+ PR target/59695 -+ * g++.dg/pr59695.C: New testcase. -+ -+2014-01-17 Terry Guo <terry.guo@arm.com> -+ -+ * gcc.target/arm/pr59826.c: New test. -+ -+2014-01-16 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59839 -+ * gcc.target/i386/pr59839.c: New test. -+ -+ PR debug/54694 -+ * gcc.target/i386/pr9771-1.c (main): Rename to... -+ (real_main): ... this. Add __asm name "main". -+ (ASMNAME, ASMNAME2, STRING): Define. -+ -+2014-01-16 Marek Polacek <polacek@redhat.com> -+ -+ Backported from mainline -+ 2014-01-16 Marek Polacek <polacek@redhat.com> -+ -+ PR middle-end/59827 -+ * gcc.dg/pr59827.c: New test. -+ -+2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ -+ PR target/59803 -+ * gcc.c-torture/compile/pr59803.c: New testcase. -+ -+2014-01-10 Yufeng Zhang <yufeng.zhang@arm.com> -+ -+ * gcc.target/arm/neon/vst1Q_laneu64-1.c: New test. -+ -+2014-01-10 Hans-Peter Nilsson <hp@axis.com> -+ -+ * gcc.dg/pr46309.c: Disable for cris*-*-*. -+ -+2014-01-10 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/56060 -+ PR c++/59730 -+ * g++.dg/cpp0x/variadic144.C: New. -+ * g++.dg/cpp0x/variadic145.C: Likewise. -+ -+2014-01-10 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59715 -+ * gcc.dg/torture/pr59715.c: New testcase. -+ -+2014-01-09 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ * gcc.target/mips/bswap-1.c, gcc.target/mips/bswap-2.c, -+ gcc.target/mips/bswap-3.c, gcc.target/mips/bswap-4.c, -+ gcc.target/mips/bswap-5.c, gcc.target/mips/bswap-6.c: New tests. -+ -+2014-01-09 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ PR rtl-optimization/59137 -+ * gcc.target/mips/pr59137.c: New test. -+ -+2014-01-09 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-18 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59125 -+ PR tree-optimization/54570 -+ * gcc.dg/builtin-object-size-8.c: Un-xfail. -+ * gcc.dg/builtin-object-size-14.c: New testcase. -+ * gcc.dg/strlenopt-14gf.c: Adjust. -+ * gcc.dg/strlenopt-1f.c: Likewise. -+ * gcc.dg/strlenopt-4gf.c: Likewise. -+ -+ 2013-12-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59362 -+ * gcc.c-torture/compile/pr59362.c: New test. -+ -+2014-01-09 Richard Earnshaw <rearnsha@arm.com> -+ -+ PR rtl-optimization/54300 -+ * gcc.target/arm/pr54300.C: New test. -+ -+2014-01-08 Martin Jambor <mjambor@suse.cz> -+ -+ PR ipa/59610 -+ * gcc.dg/ipa/pr59610.c: New test. -+ -+2014-01-07 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/58668 -+ * gcc.dg/pr58668.c: New test. -+ -+ Backported from mainline -+ 2013-12-16 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58956 -+ PR middle-end/59470 -+ * gcc.target/i386/pr59470.c: New test. -+ -+2014-01-04 Janus Weil <janus@gcc.gnu.org> ++ PR fortran/61459 ++ PR fortran/58883 ++ * gfortran.dg/allocatable_function_8.f90 : New test + -+ Backport from mainline -+ 2014-01-02 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/59654 -+ * gfortran.dg/dynamic_dispatch_12.f90: New. -+ -+2014-01-03 Joseph Myers <joseph@codesourcery.com> -+ -+ * gcc.target/powerpc/rs6000-ldouble-3.c: New test. -+ -+2014-01-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59625 -+ * gcc.target/i386/pr59625.c: New test. -+ -+2014-01-01 Jakub Jelinek <jakub@redhat.com> -+ -+ PR rtl-optimization/59647 -+ * g++.dg/opt/pr59647.C: New test. -+ -+2013-12-31 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-30 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58998 -+ * gfortran.dg/generic_28.f90: New. -+ -+2013-12-20 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c++/59255 -+ * g++.dg/tree-prof/pr59255.C: New test. -+ -+2013-12-19 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ Backport from Mainline -+ 2013-05-01 James Greenhalgh <james.greenhalgh@arm.com> -+ -+ * gcc.target/aarch64/scalar_intrinsics.c (force_simd): New. -+ (test_vceqd_s64): Force arguments to SIMD registers. -+ (test_vceqzd_s64): Likewise. -+ (test_vcged_s64): Likewise. -+ (test_vcled_s64): Likewise. -+ (test_vcgezd_s64): Likewise. -+ (test_vcged_u64): Likewise. -+ (test_vcgtd_s64): Likewise. -+ (test_vcltd_s64): Likewise. -+ (test_vcgtzd_s64): Likewise. -+ (test_vcgtd_u64): Likewise. -+ (test_vclezd_s64): Likewise. -+ (test_vcltzd_s64): Likewise. -+ (test_vtst_s64): Likewise. -+ (test_vtst_u64): Likewise. -+ -+2013-12-19 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ Andreas Krebbel <Andreas.Krebbel@de.ibm.com> -+ -+ Backport from mainline -+ 2013-12-19 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ * gcc/testsuite/gcc.target/s390/hotpatch-1.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-2.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-3.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-4.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-5.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-6.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-7.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-8.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-9.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-10.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-11.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-12.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c: New test -+ * gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c: New test -+ -+2013-12-18 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-15 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/59493 -+ * gfortran.dg/unlimited_polymorphic_15.f90: New. -+ -+2013-12-15 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR testsuite/58630 -+ * gcc.target/i386/pr43662.c (dg-options): -+ Add -maccumulate-outgoing-args. -+ * gcc.target/i386/pr43869.c (dg-options): Ditto. -+ * gcc.target/i386/pr57003.c (dg-options): Ditto. -+ * gcc.target/i386/avx-vzeroupper-16.c (dg-options): -+ Remove -mtune=generic and add -maccumulate-outgoing-args instead. -+ * gcc.target/i386/avx-vzeroupper-17.c (dg-options): Ditto. -+ * gcc.target/i386/avx-vzeroupper-18.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/func-1.c (dg-options): -+ Add -maccumulate-outgoing-args. -+ * gcc.target/x86_64/abi/callabi/func-2a.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/func-2b.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/func-indirect.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/func-indirect-2a.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/func-indirect-2b.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/leaf-1.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/leaf-2.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/pr38891.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-1.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-2.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-3.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-4a.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-4b.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-5a.c (dg-options): Ditto. -+ * gcc.target/x86_64/abi/callabi/vaarg-5b.c (dg-options): Ditto. -+ -+2013-12-12 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/59470 -+ * g++.dg/opt/pr59470.C: New test. -+ -+ PR libgomp/59467 -+ * gfortran.dg/gomp/pr59467.f90: New test. -+ * c-c++-common/gomp/pr59467.c: New test. -+ -+2013-12-12 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-12-12 Ryan Mansfield <rmansfield@qnx.com> -+ -+ PR testsuite/59442 -+ * gcc.target/i386/sse2-movapd-1.c: Fix alignment attributes. -+ * gcc.target/i386/sse2-movapd-2.c: Likewise. -+ * gcc.target/i386/avx-vmovapd-256-1.c: Likewise. -+ * gcc.target/i386/avx-vmovapd-256-2.c: Likewise. -+ -+2013-12-08 Uros Bizjak <ubizjak@gmail.com> ++2014-07-04 Jakub Jelinek <jakub@redhat.com> + -+ Backport from mainline -+ 2013-12-06 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59405 -+ * gcc.target/i386/pr59405.c: New test. ++ PR tree-optimization/61684 ++ * gcc.c-torture/compile/pr61684.c: New test. + -+2013-12-06 Jakub Jelinek <jakub@redhat.com> ++2014-07-02 Jakub Jelinek <jakub@redhat.com> ++ Fritz Reese <Reese-Fritz@zai.com> + -+ PR tree-optimization/59388 -+ * gcc.c-torture/execute/pr59388.c: New test. ++ * gfortran.dg/oldstyle_5.f: New test. + -+2013-12-06 Richard Biener <rguenther@suse.de> ++2014-06-30 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline -+ 2013-11-28 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59330 -+ * gcc.dg/torture/pr59330.c: New testcase. -+ -+2013-12-06 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-27 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59288 -+ * gcc.dg/torture/pr59288.c: New testcase. -+ -+ 2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59164 -+ * gcc.dg/torture/pr59164.c: New testcase. ++ 2014-06-11 Thomas Preud'homme <thomas.preudhomme@arm.com> + -+ 2013-09-05 Richard Biener <rguenther@suse.de> ++ PR tree-optimization/61306 ++ * gcc.c-torture/execute/pr61306-1.c: New test. ++ * gcc.c-torture/execute/pr61306-2.c: Likewise. ++ * gcc.c-torture/execute/pr61306-3.c: Likewise. + -+ PR tree-optimization/58137 -+ * gcc.target/i386/pr58137.c: New testcase. ++2014-06-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + -+2013-12-06 Oleg Endo <olegendo@gcc.gnu.org> ++ * gfortran.dg/nint_2.f90: Don't XFAIL for powerpc64le-*-linux*. + -+ PR target/51244 -+ PR target/59343 -+ * gcc.target/sh/pr51244-19.c: Adjust test case. -+ -+2013-12-05 Richard Biener <rguenther@suse.de> ++2014-06-27 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline -+ 2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58956 -+ * gcc.dg/torture/pr58956.c: New testcase. -+ -+2013-12-04 Jakub Jelinek <jakub@redhat.com> ++ 2014-06-26 Uros Bizjak <ubizjak@gmail.com> + -+ PR c++/59268 -+ * g++.dg/cpp0x/constexpr-template6.C: New test. ++ PR target/61586 ++ * gcc.target/alpha/pr61586.c: New test. + -+ PR rtl-optimization/58726 -+ * gcc.c-torture/execute/pr58726.c: New test. ++2014-06-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + -+ PR target/59163 -+ * g++.dg/torture/pr59163.C: New test. ++ * gfortran.dg/default_format_denormal_2.f90: Remove xfail for ++ powerpc*-*-linux*. + -+2013-12-03 Marek Polacek <polacek@redhat.com> ++2014-06-18 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline -+ 2013-12-03 Marek Polacek <polacek@redhat.com> -+ -+ PR c/59351 -+ * gcc.dg/pr59351.c: New test. -+ -+2013-12-03 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/59011 -+ * gcc.dg/pr59011.c: New test. -+ -+ PR target/58864 -+ * g++.dg/opt/pr58864.C: New test. -+ -+2013-12-02 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59358 -+ * gcc.c-torture/execute/pr59358.c: New test. ++ 2014-06-13 Ilya Enkovich <ilya.enkovich@intel.com> + -+2013-12-02 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/59139 -+ * gcc.dg/torture/pr59139.c: New testcase. -+ -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> -+ -+ PR c++/59032 -+ * c-c++-common/pr59032.c: New testcase. -+ -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> -+ -+ PR middle-end/59037 -+ * c-c++-common/pr59037.c: New testcase. -+ -+2013-11-30 Paul Thomas <pault@gcc.gnu.org> ++ PR rtl-optimization/61094 ++ PR rtl-optimization/61446 ++ * gcc.target/i386/pr61446.c : New. + + Backport from mainline -+ 2013-11-04 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/57445 -+ * gfortran.dg/optional_class_1.f90 : New test -+ -+2013-11-29 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c/59280 -+ * c-c++-common/pr59280.c: New test. ++ 2014-06-06 Uros Bizjak <ubizjak@gmail.com> + -+2013-11-28 Jakub Jelinek <jakub@redhat.com> ++ PR target/61423 ++ * gcc.target/i386/pr61423.c: New test. + -+ PR c++/59297 -+ * g++.dg/gomp/pr59297.C: New test. -+ -+2013-11-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> -+ -+ Backport from mainline -+ 2013-11-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> -+ -+ * gcc.target/arm/vrinta-ce.c: New testcase. -+ -+2013-11-28 Uros Bizjak <ubizjak@gmail.com> ++2014-06-17 Yufeng Zhang <yufeng.zhang@arm.com> + + Backport from mainline -+ 2013-11-23 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/56788 -+ * config/i386/i386.c (bdesc_multi_arg) <IX86_BUILTIN_VFRCZSS>: -+ Declare as MULTI_ARG_1_SF instruction. -+ <IX86_BUILTIN_VFRCZSD>: Decleare as MULTI_ARG_1_DF instruction. -+ * config/i386/sse.md (*xop_vmfrcz<mode>2): Rename -+ from *xop_vmfrcz_<mode>. -+ * config/i386/xopintrin.h (_mm_frcz_ss): Use __builtin_ia32_movss -+ to merge scalar result with __A. -+ (_mm_frcz_sd): Use __builtin_ia32_movsd to merge scalar -+ result with __A. -+ -+2013-11-28 Terry Guo <terry.guo@arm.com> -+ -+ Backport mainline r205391 -+ 2013-11-26 Terry Guo <terry.guo@arm.com> + -+ * gcc.target/arm/thumb1-pic-high-reg.c: New case. -+ * gcc.target/arm/thumb1-pic-single-base.c: New case. ++ PR target/61483 ++ * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type. ++ * gcc.target/aarch64/aapcs64/va_arg-13.c: New test. ++ * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto. ++ * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto. + -+2013-11-27 Jakub Jelinek <jakub@redhat.com> ++2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + -+ Backported from mainline -+ 2013-11-27 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59014 -+ * gcc.c-torture/execute/pr59014-2.c: New test. -+ -+ 2013-11-26 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/59014 -+ * gcc.c-torture/execute/pr59014.c: New test. -+ -+2013-11-27 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc.c-torture/execute/20131127-1.c: New test. -+ -+2013-11-25 Vidya Praveen <vidyapraveen@arm.com> -+ -+ Backport from mainline -+ 2013-10-21 Vidya Praveen <vidyapraveen@arm.com> -+ -+ * gcc.dg/20050922-1.c: Remove stdlib.h and declare abort(). -+ * gcc.dg/20050922-1.c: Remove stdlib.h and declare abort() and exit(). -+ -+2013-11-20 Dominik Vogt <vogt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ * gcc.target/s390/htm-1.c: Rename to ... -+ * gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c: ... this -+ one. -+ * gcc.target/s390/htm-xl-intrin-1.c: Rename to ... -+ * gcc.target/s390/htm-builtins-compile-3.c: ... this one. -+ * gcc.target/s390/htm-builtins-compile-2.c: New testcase. -+ * gcc.target/s390/htm-builtins-1.c: New testcase. -+ * gcc.target/s390/htm-builtins-2.c: New testcase. -+ * gcc.target/s390/s390.exp: Add check for htm machine. -+ -+2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/57517 -+ * gfortran.fortran-torture/compile/pr57517.f90: New testcase. -+ * gcc.dg/torture/pr57517.c: Likewise. -+ -+2013-11-19 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-11-05 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58941 -+ * gcc.dg/torture/pr58941.c: New testcase. -+ -+2013-11-18 Richard Biener <rguenther@suse.de> -+ -+ Backport from mainline -+ 2013-10-21 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58794 -+ * c-c++-common/torture/pr58794-1.c: New testcase. -+ * c-c++-common/torture/pr58794-2.c: Likewise. -+ -+ 2013-10-21 Richard Biener <rguenther@suse.de> -+ -+ PR middle-end/58742 -+ * c-c++-common/fold-divmul-1.c: New testcase. -+ -+ 2013-11-06 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58653 -+ * gcc.dg/tree-ssa/predcom-6.c: New testcase. -+ * gcc.dg/tree-ssa/predcom-7.c: Likewise. -+ -+ PR tree-optimization/59047 -+ * gcc.dg/torture/pr59047.c: New testcase. -+ -+ 2013-10-15 Richard Biener <rguenther@suse.de> -+ -+ PR tree-optimization/58143 -+ * gcc.dg/torture/pr58143-1.c: New testcase. -+ * gcc.dg/torture/pr58143-2.c: Likewise. -+ * gcc.dg/torture/pr58143-3.c: Likewise. -+ -+2013-11-17 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-11-07 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58471 -+ * gfortran.dg/constructor_9.f90: New. -+ -+2013-11-16 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-09-20 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58099 -+ * gfortran.dg/proc_ptr_43.f90: New. -+ -+2013-11-16 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/58771 -+ * gfortran.dg/derived_external_function_1.f90 : New test ++ Backport from trunk. ++ PR fortran/45187 ++ * gfortran.dg/cray_pointers_10.f90: New file. + -+2013-11-14 Uros Bizjak <ubizjak@gmail.com> ++2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline -+ 2013-11-06 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/59021 -+ * gcc.target/i386/pr59021.c: New test. -+ -+2013-11-14 Jakub Jelinek <jakub@redhat.com> -+ -+ PR target/59101 -+ * gcc.c-torture/execute/pr59101.c: New test. -+ -+2013-11-11 Jakub Jelinek <jakub@redhat.com> + -+ Backported from mainline -+ 2013-11-06 Jakub Jelinek <jakub@redhat.com> ++ 2014-06-13 Peter Bergner <bergner@vnet.ibm.com> ++ PR target/61415 ++ * lib/target-supports.exp (check_effective_target_longdouble128): New. ++ * gcc.target/powerpc/pack02.c: Use it. ++ * gcc.target/powerpc/tfmode_off.c: Likewise. + -+ PR middle-end/58970 -+ * gcc.c-torture/compile/pr58970-1.c: New test. -+ * gcc.c-torture/compile/pr58970-2.c: New test. ++2014-06-12 Georg-Johann Lay <avr@gjlay.de> + -+ 2013-11-05 Jakub Jelinek <jakub@redhat.com> ++ Backport from 2014-06-12 trunk r211491 + -+ PR rtl-optimization/58997 -+ * gcc.c-torture/compile/pr58997.c: New test. ++ PR target/61443 ++ * gcc.target/avr/torture/pr61443.c: New test. + -+2013-11-10 Wei Mi <wmi@google.com> ++2014-06-04 Richard Biener <rguenther@suse.de> + -+ * gcc.dg/pr57518.c: Backport regex fix from r200720. ++ PR tree-optimization/61383 ++ * gcc.dg/torture/pr61383-1.c: New testcase. + -+2013-11-07 H.J. Lu <hongjiu.lu@intel.com> ++2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline -+ 2013-11-07 H.J. Lu <hongjiu.lu@intel.com> ++ 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + -+ PR target/59034 -+ * gcc.target/i386/pr59034-1.c: New test. -+ * gcc.target/i386/pr59034-2.c: Likewise. ++ PR rtl-optimization/60866 ++ * gcc.dg/pr60866.c: New test. + -+2013-11-06 Wei Mi <wmi@google.com> -+ -+ PR regression/58985 -+ * gcc.dg/pr57518.c: Add subreg in regexp pattern. -+ -+2013-11-05 Steven G. Kargl <kargl@gcc.gnu.org> -+ -+ PR fortran/58989 -+ * gfortran.dg/reshape_6.f90: New test. -+ -+2013-11-05 Jakub Jelinek <jakub@redhat.com> -+ -+ PR tree-optimization/58984 -+ * gcc.c-torture/execute/pr58984.c: New test. -+ -+2013-11-04 Marek Polacek <polacek@redhat.com> ++2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline -+ 2013-11-04 Marek Polacek <polacek@redhat.com> ++ 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + -+ PR c++/58979 -+ * g++.dg/diagnostic/pr58979.C: New test. ++ PR rtl-optimization/60901 ++ * gcc.target/i386/pr60901.c: New test. + -+2013-11-03 H.J. Lu <hongjiu.lu@intel.com> ++2014-05-28 Eric Botcazou <ebotcazou@adacore.com> + + Backport from mainline -+ 2013-10-12 H.J. Lu <hongjiu.lu@intel.com> -+ -+ PR target/58690 -+ * gcc.target/i386/pr58690.c: New test ++ 2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + -+2013-11-02 Janus Weil <janus@gcc.gnu.org> ++ * gnat.dg/overflow_fixed.adb: New test. + -+ Backport from mainline -+ 2013-09-23 Janus Weil <janus@gcc.gnu.org> ++2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + -+ PR fortran/58355 -+ * gfortran.dg/extends_15.f90: New. ++ * gnat.dg/aliasing1.adb (dg-final): Robustify pattern matching. + -+2013-10-29 Uros Bizjak <ubizjak@gmail.com> ++2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline -+ 2013-08-08 Richard Sandiford <rdsandiford@googlemail.com> -+ -+ PR rtl-optimization/58079 -+ * gcc.dg/torture/pr58079.c: New test. ++ 2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + -+2013-10-28 Tom de Vries <tom@codesourcery.com> -+ -+ * gcc.target/arm/require-pic-register-loc.c: New test. -+ -+2013-10-26 Uros Bizjak <ubizjak@gmail.com> -+ -+ Backport from mainline -+ 2013-10-22 Uros Bizjak <ubizjak@gmail.com> -+ -+ PR target/58779 -+ * gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY -+ and MINUSCCZEXT defines. Update scan-assembler dg directive. -+ * gcc.dg/torture/pr58779.c: New test. -+ -+2013-10-25 Richard Henderson <rth@redhat.com> -+ -+ PR rtl/58542 -+ * gcc.dg/atomic-store-6.c: New. -+ -+2013-10-25 Tom de Vries <tom@codesourcery.com> -+ -+ PR c++/58282 -+ * g++.dg/tm/noexcept-6.C: New test. -+ -+2013-10-25 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc.c-torture/execute/pr58831.c: New test. -+ -+2013-10-23 Tom de Vries <tom@codesourcery.com> -+ -+ PR tree-optimization/58805 -+ * gcc.dg/pr58805.c: New test. -+ -+2013-10-23 Richard Biener <rguenther@suse.de> -+ -+ * gcc.dg/torture/pr58830.c: New testcase. -+ -+ Backport from mainline -+ 2013-06-24 Richard Biener <rguenther@suse.de> ++ * gcc.target/powerpc/htm-ttest.c: New test. + -+ PR tree-optimization/57488 -+ * gcc.dg/torture/pr57488.c: New testcase. -+ -+2013-10-19 Oleg Endo <olegendo@gcc.gnu.org> -+ -+ * gcc.target/sh/pr54089-3.c: Fix test for load of constant 31. -+ -+2013-10-17 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/58596 -+ * g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New -+ -+2013-10-16 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/58633 -+ * g++.dg/cpp0x/decltype57.C: New. -+ * g++.dg/cpp0x/enum18.C: Revert r174385 changes. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -@@ -39,9 +1609,9 @@ - Backport from mainline - 2013-06-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> - -- * gcc.target/s390/htm-1.c: New file. -- * gcc.target/s390/htm-nofloat-1.c: New file. -- * gcc.target/s390/htm-xl-intrin-1.c: New file. -+ * gcc.target/s390/htm-1.c: New file. -+ * gcc.target/s390/htm-nofloat-1.c: New file. -+ * gcc.target/s390/htm-xl-intrin-1.c: New file. - - 2013-10-04 Tobias Burnus <burnus@net-b.de> - -@@ -307,8 +1877,8 @@ - Backport from mainline - 2013-08-12 Perez Read <netfirewall@gmail.com> - -- PR target/58132 -- * gcc.target/i386/movabs-1.c: New test. -+ PR target/58132 -+ * gcc.target/i386/movabs-1.c: New test. - - 2013-08-11 Janus Weil <janus@gcc.gnu.org> - -@@ -494,7 +2064,7 @@ - 2013-06-19 Wei Mi <wmi@google.com> - - PR rtl-optimization/57518 -- * testsuite/gcc.dg/pr57518.c: New test. -+ * gcc.dg/pr57518.c: New test. - - 2013-06-11 Tobias Burnus <burnus@net-b.de> - -@@ -623,8 +2193,8 @@ - - 2013-05-09 Martin Jambor <mjambor@suse.cz> - -- PR middle-end/56988 -- * gcc.dg/ipa/pr56988.c: New test. -+ PR middle-end/56988 -+ * gcc.dg/ipa/pr56988.c: New test. - - 2013-05-08 Marc Glisse <marc.glisse@inria.fr> - -@@ -701,7 +2271,7 @@ - 2013-04-25 Marek Polacek <polacek@redhat.com> - - PR tree-optimization/57066 -- * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. -+ * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. - - 2013-05-02 Jakub Jelinek <jakub@redhat.com> - -@@ -727,8 +2297,8 @@ - Backport from mainline - 2013-04-24 Vladimir Makarov <vmakarov@redhat.com> - -- PR rtl-optimizations/57046 -- * gcc.target/i386/pr57046.c: New test. -+ PR rtl-optimizations/57046 -+ * gcc.target/i386/pr57046.c: New test. - - 2013-05-02 Vladimir Makarov <vmakarov@redhat.com> - -@@ -735,8 +2305,8 @@ - Backport from mainline - 2013-04-22 Vladimir Makarov <vmakarov@redhat.com> - -- PR target/57018 -- * gcc.target/i386/pr57018.c: New test. -+ PR target/57018 -+ * gcc.target/i386/pr57018.c: New test. - - 2013-05-02 Vladimir Makarov <vmakarov@redhat.com> - -@@ -743,8 +2313,8 @@ - Backport from mainline - 2013-04-18 Jakub Jelinek <jakub@redhat.com> - -- PR rtl-optimization/56999 -- * g++.dg/opt/pr56999.C: New test. -+ PR rtl-optimization/56999 -+ * g++.dg/opt/pr56999.C: New test. - - 2013-05-02 Vladimir Makarov <vmakarov@redhat.com> - -@@ -751,8 +2321,8 @@ - Backport from mainline - 2013-04-19 Vladimir Makarov <vmakarov@redhat.com> - -- PR rtl-optimization/56847 -- * gcc.dg/pr56847.c: New test. -+ PR rtl-optimization/56847 -+ * gcc.dg/pr56847.c: New test. - - 2013-05-02 Ian Bolton <ian.bolton@arm.com> + 2014-05-22 Release Manager -@@ -1102,7 +2672,7 @@ - 2013-03-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/56737 -- * testsuite/gfortran.dg/fmt_cache_3.f90: New. -+ * gfortran.dg/fmt_cache_3.f90: New. - - 2013-04-02 Richard Biener <rguenther@suse.de> - -@@ -1636,7 +3206,7 @@ - 2013-02-20 Jan Hubicka <jh@suse.cz> - - PR tree-optimization/56265 -- * testsuite/g++.dg/ipa/devirt-11.C: New testcase. -+ * g++.dg/ipa/devirt-11.C: New testcase. - - 2013-02-20 Richard Biener <rguenther@suse.de> - -@@ -1823,11 +3393,9 @@ - - Avoid instrumenting duplicated memory access in the same basic block - * c-c++-common/asan/no-redundant-instrumentation-1.c: New test. -- * testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c: -- Likewise. -- * testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c: -- Likewise. -- * testsuite/c-c++-common/asan/inc.c: Likewise. -+ * c-c++-common/asan/no-redundant-instrumentation-2.c: Likewise. -+ * c-c++-common/asan/no-redundant-instrumentation-3.c: Likewise. -+ * c-c++-common/asan/inc.c: Likewise. - - 2013-02-12 Vladimir Makarov <vmakarov@redhat.com> - -Index: gcc/testsuite/gfortran.fortran-torture/compile/pr57517.f90 -=================================================================== ---- a/src/gcc/testsuite/gfortran.fortran-torture/compile/pr57517.f90 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/gfortran.fortran-torture/compile/pr57517.f90 (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+SUBROUTINE cal_helicity (uh, ph, phb, wavg, ims, ime, its, ite) -+ INTEGER, INTENT( IN ) :: ims, ime, its, ite -+ REAL, DIMENSION( ims:ime), INTENT( IN ) :: ph, phb, wavg -+ REAL, DIMENSION( ims:ime), INTENT( INOUT ) :: uh -+ INTEGER :: i -+ REAL :: zu -+ DO i = its, ite -+ zu = (ph(i ) + phb(i)) + (ph(i-1) + phb(i-1)) -+ IF (wavg(i) .GT. 0) THEN -+ uh(i) = uh(i) + zu -+ ENDIF -+ END DO -+END SUBROUTINE cal_helicity -Index: gcc/testsuite/g++.dg/ext/attribute-test-2.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/attribute-test-2.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/attribute-test-2.C (.../branches/gcc-4_8-branch) -@@ -50,3 +50,4 @@ - - /* Ignore a warning that is irrelevant to the purpose of this test. */ - /* { dg-prune-output ".*GCC vector returned by reference.*" } */ -+/* { dg-prune-output "changes the ABI" } */ -Index: gcc/testsuite/g++.dg/ext/attribute-test-3.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/attribute-test-3.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/attribute-test-3.C (.../branches/gcc-4_8-branch) -@@ -52,3 +52,4 @@ - - /* Ignore a warning that is irrelevant to the purpose of this test. */ - /* { dg-prune-output ".*GCC vector returned by reference.*" } */ -+/* { dg-prune-output "changes the ABI" } */ -Index: gcc/testsuite/g++.dg/ext/traits1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/traits1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/traits1.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+// PR c++/58504 -+ -+template<bool = __has_nothrow_assign(void)> struct A {}; -+A<> a; -Index: gcc/testsuite/g++.dg/ext/attribute-test-4.C + * GCC 4.8.3 released. +Index: gcc/testsuite/g++.dg/cpp0x/variadic158.C =================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/attribute-test-4.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/attribute-test-4.C (.../branches/gcc-4_8-branch) -@@ -49,3 +49,4 @@ - - /* Ignore a warning that is irrelevant to the purpose of this test. */ - /* { dg-prune-output ".*GCC vector returned by reference.*" } */ -+/* { dg-prune-output "changes the ABI" } */ -Index: gcc/testsuite/g++.dg/ext/stmtexpr15.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/stmtexpr15.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/stmtexpr15.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+// PR c++/59097 -+// { dg-options "" } -+ -+void foo() -+{ -+ int x[({ return; })]; // { dg-error "non-integral" } -+} -Index: gcc/testsuite/g++.dg/ext/vector25.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/vector25.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/vector25.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,6 @@ -+volatile int i __attribute__((vector_size(8))); -+ -+void foo() -+{ -+ i += i; -+} -Index: gcc/testsuite/g++.dg/ext/builtin-bswap1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/builtin-bswap1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/builtin-bswap1.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,22 @@ -+// PR c/37743 -+// { dg-do compile } -+ -+#if defined(__UINT32_TYPE__) && defined(__INT32_TYPE__) -+ -+void foo (__UINT32_TYPE__); -+void foo (__INT32_TYPE__); -+ -+void -+bar (__UINT32_TYPE__ x) -+{ -+ foo (__builtin_bswap32 (x)); -+} -+ -+#else -+ -+void -+bar () -+{ -+} -+ -+#endif -Index: gcc/testsuite/g++.dg/ext/attrib48.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/attrib48.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/attrib48.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,6 @@ -+// PR c++/54652 -+ -+typedef unsigned L __attribute__ ((aligned)); -+typedef unsigned L __attribute__ ((aligned)); -+ -+L l; -Index: gcc/testsuite/g++.dg/ext/vector27.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/vector27.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/vector27.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+// PR c++/58845 -+ -+void foo() -+{ -+ int v __attribute__((vector_size(8))); -+ v = v || v; // { dg-bogus "" "" { xfail *-*-* } } -+} -Index: gcc/testsuite/g++.dg/ext/timevar2.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/timevar2.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/timevar2.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+// PR c++/57524 -+// { dg-options "-ftime-report" } -+// { dg-prune-output "wall" } -+// { dg-prune-output "times" } -+// { dg-prune-output "TOTAL" } -+// { dg-prune-output "checks" } -+ -+namespace detail { -+namespace indirect_traits {} -+using namespace indirect_traits; -+void fn1() { -+using namespace detail; -+} -+} -Index: gcc/testsuite/g++.dg/ext/attribute-test-1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ext/attribute-test-1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ext/attribute-test-1.C (.../branches/gcc-4_8-branch) -@@ -36,3 +36,4 @@ - - /* Ignore a warning that is irrelevant to the purpose of this test. */ - /* { dg-prune-output ".*GCC vector returned by reference.*" } */ -+/* { dg-prune-output "changes the ABI" } */ -Index: gcc/testsuite/g++.dg/opt/pr59647.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/opt/pr59647.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/opt/pr59647.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,32 @@ -+// PR rtl-optimization/59647 -+// { dg-do compile } -+// { dg-options "-O2 -fno-tree-vrp" } -+// { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ia32 } } } -+ -+void f1 (int); -+void f2 (); -+double f3 (int); -+ -+struct A -+{ -+ int f4 () const -+ { -+ if (a == 0) -+ return 1; -+ return 0; -+ } -+ unsigned f5 () -+ { -+ if (!f4 ()) -+ f2 (); -+ return a; -+ } -+ int a; -+}; -+ -+void -+f6 (A *x) -+{ -+ unsigned b = x->f5 (); -+ f1 (b - 1 - f3 (x->f5 () - 1U)); -+} -Index: gcc/testsuite/g++.dg/opt/pr59470.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/opt/pr59470.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/opt/pr59470.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,188 @@ -+// PR middle-end/59470 -+// { dg-do run } -+// { dg-options "-O2 -fstack-protector" } -+// { dg-additional-options "-fPIC" { target fpic } } -+// { dg-require-effective-target fstack_protector } -+ -+struct A -+{ -+ int a1; -+ A () throw () : a1 (0) {} -+}; -+ -+struct B -+{ -+ unsigned int b1 () throw (); -+}; -+ -+__attribute__((noinline, noclone)) unsigned int -+B::b1 () throw () -+{ -+ asm volatile ("" : : : "memory"); -+ return 0; -+} -+ -+struct C -+{ -+ const A **c1; -+ void c2 (const A *, unsigned int); -+}; -+ -+__attribute__((noinline, noclone)) void -+C::c2 (const A *, unsigned int) -+{ -+ asm volatile ("" : : : "memory"); -+} -+ -+struct D -+{ -+ C *d1; -+}; -+ -+struct E -+{ -+ int e1; -+ int e2; -+ D e3; -+}; -+ -+struct F -+{ -+ virtual int f1 (const char * s, int n); -+}; -+ -+struct G -+{ -+ F *g1; -+ bool g2; -+ G & g3 (const char * ws, int len) -+ { -+ if (__builtin_expect (!g2, true) -+ && __builtin_expect (this->g1->f1 (ws, len) != len, false)) -+ g2 = true; -+ return *this; -+ } -+}; -+ -+struct H : public A -+{ -+ const char *h1; -+ unsigned int h2; -+ bool h3; -+ const char *h4; -+ char h5; -+ char h6; -+ char h7[31]; -+ bool h8; -+ H () : h1 (0), h2 (0), h4 (0), h5 (0), h6 (0), h8 (false) {} -+ void h9 (const D &) __attribute__((noinline, noclone)); -+}; -+ -+void -+H::h9 (const D &) -+{ -+ h3 = true; -+ __builtin_memset (h7, 0, sizeof (h7)); -+ asm volatile ("" : : : "memory"); -+}; -+ -+B b; -+ -+inline const H * -+foo (const D &x) -+{ -+ const unsigned int i = b.b1 (); -+ const A **j = x.d1->c1; -+ if (!j[i]) -+ { -+ H *k = 0; -+ try -+ { -+ k = new H; -+ k->h9 (x); -+ } -+ catch (...) -+ { -+ } -+ x.d1->c2 (k, i); -+ } -+ return static_cast <const H *>(j[i]); -+} -+ -+__attribute__((noinline, noclone)) int -+bar (char *x, unsigned long v, const char *y, int z, bool w) -+{ -+ asm volatile ("" : : "r" (x), "r" (v), "r" (y) : "memory"); -+ asm volatile ("" : : "r" (z), "r" (w) : "memory"); -+ return 8; -+} -+ -+__attribute__((noinline, noclone)) void -+baz (void *z, const char *g, unsigned int h, char s, E &e, char *n, char *c, int &l) -+{ -+ asm volatile ("" : : "r" (z), "r" (g), "r" (h) : "memory"); -+ asm volatile ("" : : "r" (s), "r" (&e), "r" (n) : "memory"); -+ asm volatile ("" : : "r" (c), "r" (&l) : "memory"); -+ if (n == c) -+ __builtin_abort (); -+ int i = 0; -+ asm ("" : "+r" (i)); -+ if (i == 0) -+ __builtin_exit (0); -+} -+ -+__attribute__((noinline, noclone)) G -+test (void *z, G s, E &x, char, long v) -+{ -+ const D &d = x.e3; -+ const H *h = foo (d); -+ const char *q = h->h7; -+ const int f = x.e2; -+ const int i = 5 * sizeof (long); -+ char *c = static_cast <char *>(__builtin_alloca (i)); -+ const int b = f & 74; -+ const bool e = (b != 64 && b != 8); -+ const unsigned long u = ((v > 0 || !e) ? (unsigned long) v : -(unsigned long) v); -+ int l = bar (c + i, u, q, f, e); -+ c += i - l; -+ if (h->h3) -+ { -+ char *c2 = static_cast <char *>(__builtin_alloca ((l + 1) * 2)); -+ baz (z, h->h1, h->h2, h->h6, x, c2 + 2, c, l); -+ c = c2 + 2; -+ } -+ if (__builtin_expect (e, true)) -+ { -+ } -+ else if ((f & 4096) && v) -+ { -+ { -+ const bool m = f & 176; -+ *--c = q[m]; -+ *--c = q[1]; -+ } -+ } -+ const int w = x.e1; -+ if (w > l) -+ { -+ char * c3 = static_cast <char *>(__builtin_alloca (w)); -+ c = c3; -+ } -+ return s.g3 (c, l); -+} -+ -+int -+main () -+{ -+ H h; -+ const A *j[1]; -+ C c; -+ G g; -+ E e; -+ h.h9 (e.e3); -+ j[0] = &h; -+ c.c1 = j; -+ e.e3.d1 = &c; -+ test (0, g, e, 0, 0); -+ __builtin_abort (); -+} -Index: gcc/testsuite/g++.dg/opt/pr58864.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/opt/pr58864.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/opt/pr58864.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+// PR target/58864 -+// { dg-do compile } -+// { dg-options "-Os" } -+// { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } -+ -+struct A { A (); ~A (); }; -+struct B { B (); }; -+ -+float d, e; -+ -+void -+foo () -+{ -+ A a; -+ float c = d; -+ while (1) -+ { -+ B b; -+ e = c ? -c : 0; -+ } -+} -Index: gcc/testsuite/g++.dg/tree-prof/pr59255.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/tree-prof/pr59255.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/tree-prof/pr59255.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+// PR c++/59255 -+// { dg-options "-O2 -std=c++11" } -+ -+struct S -+{ -+ __attribute__((noinline, noclone)) ~S () noexcept (true) -+ { -+ if (fn) -+ fn (1); -+ } -+ void (*fn) (int); -+}; -+ -+__attribute__((noinline, noclone)) void -+foo (int x) -+{ -+ if (x != 1) -+ throw 1; -+} -+ -+int -+main () -+{ -+ for (int i = 0; i < 100; i++) -+ { -+ S s; -+ s.fn = foo; -+ } -+} -Index: gcc/testsuite/g++.dg/gomp/for-20.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/gomp/for-20.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/gomp/for-20.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+// PR c++/60146 -+// { dg-do compile } -+// { dg-options -fopenmp } -+ -+int foo() { return 0; } -+ -+template<typename T> void bar() -+{ -+#pragma omp parallel for -+ for (T i = foo(); i < 8; ++i) {} -+} -+ -+void baz() -+{ -+ bar<int>(); -+} -Index: gcc/testsuite/g++.dg/gomp/pr59297.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/gomp/pr59297.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/gomp/pr59297.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,25 @@ -+// PR c++/59297 -+// { dg-do compile } -+// { dg-options "-fopenmp" } -+ -+template <typename T> -+struct A -+{ -+ ~A (); -+ const T &operator[] (int) const; -+}; -+ -+struct B -+{ -+ int &operator () (A <int>); -+}; -+ -+void -+foo (B &x, int &z) -+{ -+ A<A<int> > y; -+ #pragma omp atomic -+ x (y[0]) += 1; -+ #pragma omp atomic -+ z += x(y[1]); -+} -Index: gcc/testsuite/g++.dg/diagnostic/pr59838.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/diagnostic/pr59838.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/diagnostic/pr59838.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+// PR c++/59838 -+// { dg-do compile } -+ -+enum E { a, b = (E) a }; // { dg-error "conversion to incomplete type" } -Index: gcc/testsuite/g++.dg/diagnostic/pr58979.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/diagnostic/pr58979.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/diagnostic/pr58979.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+// PR c++/58979 -+// { dg-do compile } -+ -+int i = 0->*0; // { dg-error "invalid type argument of" } -Index: gcc/testsuite/g++.dg/conversion/simd1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/conversion/simd1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/conversion/simd1.C (.../branches/gcc-4_8-branch) -@@ -1,4 +1,5 @@ - /* { dg-do compile } */ -+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ - - /* Test overload resolution of vector types. - From Janis Johnson and Paolo Bonzini, based on PR/16882 */ -@@ -17,7 +18,7 @@ - void foo () - { - vss = vld(i, vscp); /* { dg-error "no matching function for call" } */ -- // { dg-message "candidate" "candidate note" { target *-*-* } 19 } -+ // { dg-message "candidate" "candidate note" { target *-*-* } 20 } - vss = vld(i, vssp); - vss = vld(i, cvssp); - } -Index: gcc/testsuite/g++.dg/tls/thread_local8.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/tls/thread_local8.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/tls/thread_local8.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+// PR c++/55800 -+// { dg-options "-std=c++11" } -+// { dg-require-alias "" } -+// { dg-require-effective-target tls } -+// { dg-final { scan-assembler "_ZTH12foo_instance" { target tls_native } } } -+ -+struct foo -+{ -+ foo(); -+}; -+ -+thread_local foo foo_instance; -Index: gcc/testsuite/g++.dg/tls/thread_local-ice2.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/tls/thread_local-ice2.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/tls/thread_local-ice2.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+// PR c++/58672 -+// { dg-options "-std=c++11" } -+// { dg-require-effective-target tls } -+ -+struct A -+{ -+ A(int); -+ i; // { dg-error "" } -+}; -+ -+thread_local A a(0); -Index: gcc/testsuite/g++.dg/tm/pr60004.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/tm/pr60004.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/tm/pr60004.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+// { dg-do compile } -+// { dg-options "-fgnu-tm" } -+ -+int a; -+int f() { -+ __transaction_atomic { -+ if (a == 5) -+ return 1; -+ } -+} -Index: gcc/testsuite/g++.dg/tm/noexcept-6.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/tm/noexcept-6.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/tm/noexcept-6.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,23 @@ -+// { dg-do compile } -+// { dg-options "-fno-exceptions -fgnu-tm -O -std=c++0x -fdump-tree-tmlower" } -+ -+struct TrueFalse -+{ -+ static constexpr bool v() { return true; } -+}; -+ -+int global; -+ -+template<typename T> int foo() -+{ -+ return __transaction_atomic noexcept(T::v()) (global + 1); -+} -+ -+int f1() -+{ -+ return foo<TrueFalse>(); -+} -+ -+/* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */ -+/* { dg-final { scan-tree-dump-times "__transaction_atomic" 1 "tmlower" } } */ -+/* { dg-final { cleanup-tree-dump "tmlower" } } */ -Index: gcc/testsuite/g++.dg/pr59695.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/pr59695.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/pr59695.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,125 @@ -+ -+/* PR target/59695 */ -+/* { dg-do run } */ -+/* { dg-options "-O0" } */ -+ -+#define DEFINE_VIRTUALS_FNS(i) virtual void xxx##i () {} \ -+ virtual void foo1_##i () {}\ -+ virtual void foo2_##i () {}\ -+ virtual void foo3_##i () {}\ -+ virtual void foo4_##i () {}\ -+ virtual void foo5_##i () {}\ -+ virtual void foo6_##i () {}\ -+ virtual void foo7_##i () {}\ -+ virtual void foo8_##i () {}\ -+ virtual void foo9_##i () {}\ -+ virtual void foo10_##i () {}\ -+ virtual void foo11_##i () {}\ -+ virtual void foo12_##i () {}\ -+ virtual void foo13_##i () {}\ -+ virtual void foo14_##i () {}\ -+ virtual void foo15_##i () {}\ -+ virtual void foo16_##i () {}\ -+ virtual void foo17_##i () {}\ -+ virtual void foo18_##i () {}\ -+ virtual void foo19_##i () {}\ -+ virtual void foo20_##i () {}\ -+ virtual void foo21_##i () {}\ -+ virtual void foo22_##i () {}\ -+ -+class base_class_2 -+{ -+ -+public: -+ /* Define lots of virtual functions */ -+ DEFINE_VIRTUALS_FNS (1) -+ DEFINE_VIRTUALS_FNS (2) -+ DEFINE_VIRTUALS_FNS (3) -+ DEFINE_VIRTUALS_FNS (4) -+ DEFINE_VIRTUALS_FNS (5) -+ DEFINE_VIRTUALS_FNS (6) -+ DEFINE_VIRTUALS_FNS (7) -+ DEFINE_VIRTUALS_FNS (8) -+ DEFINE_VIRTUALS_FNS (9) -+ DEFINE_VIRTUALS_FNS (10) -+ DEFINE_VIRTUALS_FNS (11) -+ DEFINE_VIRTUALS_FNS (12) -+ DEFINE_VIRTUALS_FNS (13) -+ DEFINE_VIRTUALS_FNS (14) -+ DEFINE_VIRTUALS_FNS (15) -+ DEFINE_VIRTUALS_FNS (16) -+ DEFINE_VIRTUALS_FNS (17) -+ DEFINE_VIRTUALS_FNS (18) -+ DEFINE_VIRTUALS_FNS (19) -+ DEFINE_VIRTUALS_FNS (20) -+ -+ base_class_2(); -+ virtual ~base_class_2 (); -+}; -+ -+base_class_2::base_class_2() -+{ -+} -+ -+base_class_2::~base_class_2 () -+{ -+} -+ -+class base_class_1 -+{ -+public: -+ virtual ~base_class_1(); -+ base_class_1(); -+}; -+ -+base_class_1::base_class_1() -+{ -+} -+ -+base_class_1::~base_class_1() -+{ -+} -+ -+class base_Impl_class : -+ virtual public base_class_2, public base_class_1 -+{ -+public: -+ base_Impl_class (); -+ virtual ~base_Impl_class (); -+}; -+ -+base_Impl_class::base_Impl_class () -+{ -+} -+ -+base_Impl_class::~base_Impl_class () -+{ -+} -+ -+ -+class test_cls : public base_Impl_class -+{ -+public: -+ test_cls(); -+ virtual ~test_cls(); -+}; -+ -+test_cls::test_cls() -+{ -+} -+ -+test_cls::~test_cls() -+{ -+} -+ -+int main() -+{ -+ test_cls *test = new test_cls; -+ base_class_2 *p1 = test; -+ -+ /* PR59695 destructor thunk offsets are not setup -+ correctly resulting in crash. */ -+ delete p1; -+ return 0; -+} -+ -Index: gcc/testsuite/g++.dg/cpp0x/initlist79.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/initlist79.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/initlist79.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+// PR c++/59646 -+// { dg-require-effective-target c++11 } -+ -+#include <initializer_list> -+ -+struct A {}; -+ -+std::initializer_list<volatile A> x = {{}}; -Index: gcc/testsuite/g++.dg/cpp0x/enum_base2.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/enum_base2.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/enum_base2.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+// PR c++/60187 -+// { dg-require-effective-target c++11 } -+ -+template<typename... T> struct A -+{ -+ enum E : T {}; // { dg-error "parameter pack" } -+}; -+ -+A<int> a; -Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+// PR c++/58596 +--- a/src/gcc/testsuite/g++.dg/cpp0x/variadic158.C (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic158.C (.../branches/gcc-4_8-branch) +@@ -0,0 +1,24 @@ ++// PR c++/61134 +// { dg-do compile { target c++11 } } + -+struct A -+{ -+ int i = [] { return decltype(i)(); }(); -+}; -Index: gcc/testsuite/g++.dg/cpp0x/variadic149.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic149.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic149.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+// PR c++/60248 -+// { dg-options "-std=c++11 -g -fabi-version=2" } -+ -+template<int...> struct A {}; -+ -+template<> struct A<0> -+{ -+ typedef enum { e } B; -+}; -+ -+A<0> a; -Index: gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C (.../branches/gcc-4_8-branch) -@@ -2,6 +2,7 @@ - // { dg-options "-std=gnu++11" } - // Ignore warning on some powerpc-ibm-aix configurations. - // { dg-prune-output "non-standard ABI extension" } -+// { dg-prune-output "changes the ABI" } - - typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4; - constexpr V4 build (float x, float y, float z) { return (V4){ x, y, z, 0 };} -Index: gcc/testsuite/g++.dg/cpp0x/defaulted48.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/defaulted48.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/defaulted48.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+// PR c++/60108 -+// { dg-require-effective-target c++11 } ++struct Base { }; + -+template<int> struct A -+{ -+ virtual ~A(); ++template <typename> ++struct Fixed { ++ typedef const char* name; +}; + -+template<typename> struct B : A<0>, A<1> -+{ -+ ~B() = default; -+}; ++template <typename VT, typename... Fields> ++void New(const char* name, ++ typename Fixed<Fields>::name... field_names); + -+struct C : B<bool> -+{ -+ C() {} -+}; -Index: gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,18 @@ -+// PR c++/60182 -+// { dg-require-effective-target c++11 } ++template <typename VT, typename... Fields> ++void CreateMetric(const char* name, ++ typename Fixed<Fields>::name... field_names, ++ const Base&) { } + -+class B {}; -+template <typename> using __allocator_base = B; -+template <typename> class F : __allocator_base<int> {}; -+class C {}; -+template <typename, typename = F<int> > class G : C {}; -+template <typename> class D; -+class A { -+ using Container = G<D<char>>; -+ A(); -+ A(D<char> const &); -+ Container m_elements; -+}; -+template <template <class, class> class C, class A = F<D<int>>> -+void doSomething(C<D<char>, A> &); -+A::A(D<char> const &) : A() { doSomething(m_elements); } -Index: gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/nsdmi-union3.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+// PR c++/58965 -+// { dg-require-effective-target c++11 } + -+void foo() ++void Fn() +{ -+ static union -+ { -+ int i = i; -+ }; ++ CreateMetric<int, const char*>("abcd", "def", Base()); +} -Index: gcc/testsuite/g++.dg/cpp0x/variadic144.C +Index: gcc/testsuite/g++.dg/cpp0x/variadic160.C =================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic144.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic144.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,15 @@ -+// PR c++/56060 +--- a/src/gcc/testsuite/g++.dg/cpp0x/variadic160.C (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic160.C (.../branches/gcc-4_8-branch) +@@ -0,0 +1,49 @@ ++// PR c++/61539 +// { dg-do compile { target c++11 } } + -+template<typename T> struct baz { }; -+template<typename T> T bar(); -+ -+template<typename T, typename ... U> -+baz<decltype(bar<T>()(bar<U> ...))> // { dg-error "cannot be used" } -+foo(); -+ -+int main() -+{ -+ foo<int>(); // { dg-error "no matching" } -+ return 0; -+} -Index: gcc/testsuite/g++.dg/cpp0x/enum18.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/enum18.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/enum18.C (.../branches/gcc-4_8-branch) -@@ -4,5 +4,5 @@ - int main(void) { - enum e {}; - e ev; -- ev.e::~e_u(); // { dg-error "e_u. has not been declared" } -+ ev.e::~e_u(); // { dg-error "" } - } -Index: gcc/testsuite/g++.dg/cpp0x/noexcept22.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/noexcept22.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/noexcept22.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+// PR c++/60046 -+// { dg-require-effective-target c++11 } -+ -+constexpr bool foo () { return noexcept (true); } -+template <typename T> -+struct V ++template <typename _CharT> class A; ++template <typename> class B; ++template <class charT> class C; ++template <> class C<char> +{ -+ void bar (V &) noexcept (foo ()) {} ++ virtual void xparse (int &, const B<A<char> > &) const; +}; -+template <typename T> -+struct W : public V <int> ++template <class T, class charT = char> class G : C<charT> +{ -+ void bar (W &x) { V <int>::bar (x); } ++public: ++ G (void *) {} ++ void default_value (const T &); ++ void xparse (int &, const B<A<charT> > &) const; +}; -+ -+int -+main () ++template <class T, class charT> ++void validate (int &, const B<A<charT> > &, T *, int); ++template <class T, class charT> ++void G<T, charT>::xparse (int &p1, const B<A<charT> > &p2) const +{ -+ W <int> a, b; -+ a.bar (b); ++ validate (p1, p2, (T *)0, 0); +} -Index: gcc/testsuite/g++.dg/cpp0x/initlist76.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/initlist76.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/initlist76.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,5 @@ -+// PR c++/58812 -+// { dg-require-effective-target c++11 } -+ -+int i; -+int&& j{{ i }}; // { dg-error "too many braces" } -Index: gcc/testsuite/g++.dg/cpp0x/access02.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/access02.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/access02.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,39 @@ -+// PR c++/58954 -+// { dg-require-effective-target c++11 } -+ -+template<class T> -+T&& declval(); -+ -+template<class T> -+struct foo_argument ++template <class T> G<T> *value (T *) { return new G<T>(0); } ++namespace Eigen +{ -+ template<class Ret, class C, class Arg> -+ static Arg test(Ret (C::*)(Arg)); -+ -+ typedef decltype(test(&T::template foo<>)) type; -+}; -+ -+template<class T, class> -+struct dependent { typedef T type; }; -+ -+template<class T> -+struct base ++template <typename T> struct D; ++template <typename, int, int, int = 0, int = 0, int = 0 > class F; ++template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, ++ int _MaxCols> ++struct D<F<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > +{ -+ template<class Ignore = void> -+ auto foo(int i) -> decltype(declval< -+ typename dependent<T&, Ignore>::type -+ >().foo_impl(i)); ++ typedef _Scalar Scalar; +}; -+ -+struct derived : base<derived> -+{ -+ friend struct base<derived>; -+private: -+ int foo_impl(int i); -+}; -+ -+int main() -+{ -+ foo_argument<derived>::type var = 0; -+ return var; -+} -Index: gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-template6.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,20 @@ -+// PR c++/59268 -+// { dg-do compile } -+// { dg-options "-std=c++11" } -+ -+template <typename> -+struct A ++template <typename, int, int, int, int, int _MaxCols> class F +{ -+ constexpr A (int) {} -+ virtual void foo () -+ { -+ constexpr A<void> a (0); -+ } ++public: ++ typedef typename Eigen::D<F>::Scalar Scalar; ++ F (const Scalar &, const Scalar &, const Scalar &); +}; -+ -+void -+bar () -+{ -+ A<int> a (3); -+ a.foo (); ++template <class... T> ++void validate (int &, const B<A<char> > &, Eigen::F<T...> *); +} -Index: gcc/testsuite/g++.dg/cpp0x/initlist78.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/initlist78.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/initlist78.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+// PR c++/58639 -+// { dg-require-effective-target c++11 } -+ -+struct node { -+ node &parent; -+}; -+ -+struct vector { -+ node n; -+}; -+ -+vector v({}); // { dg-error "" } -Index: gcc/testsuite/g++.dg/cpp0x/variadic148.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic148.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic148.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,6 @@ -+// PR c++/59989 -+// { dg-require-effective-target c++11 } -+ -+template<typename T> struct X {}; -+template<template<typename...> class D, typename ...U> int test(D<U...>*); -+int n = test<X, int>(0); // { dg-error "no match" } -Index: gcc/testsuite/g++.dg/cpp0x/nsdmi9.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/nsdmi9.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/nsdmi9.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+// PR c++/58162 -+// { dg-require-effective-target c++11 } -+ -+struct A { -+ A(); -+ A(A&&); -+}; -+ -+struct B { -+ A const a = A(); -+}; -+ -+B b; -Index: gcc/testsuite/g++.dg/cpp0x/deleted3.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/deleted3.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/deleted3.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+// PR c++/60216 -+// { dg-require-effective-target c++11 } -+ -+struct A ++int main (int, char *[]) +{ -+ template<typename T> A(T) = delete; -+}; -+ -+template<> A::A<int>(int) {} -+ -+A a(0); -Index: gcc/testsuite/g++.dg/cpp0x/variadic150.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic150.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic150.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,9 @@ -+// PR c++/60219 -+// { dg-require-effective-target c++11 } -+ -+template<typename..., int> void foo(); -+ -+void bar() -+{ -+ foo<0>; // { dg-error "" } ++ Eigen::F<double, 3, 1> a (0, 0, 0); ++ value (&a)->default_value (Eigen::F<double, 3, 1>(0, 0, 0)); +} -Index: gcc/testsuite/g++.dg/cpp0x/static_assert9.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/static_assert9.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/static_assert9.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+// PR c++/58837 -+// { dg-require-effective-target c++11 } -+ -+void f(); -+static_assert(f, ""); -+struct A {}; -+static_assert(A::~A, ""); // { dg-error "non-static member function" } -Index: gcc/testsuite/g++.dg/cpp0x/variadic145.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic145.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic145.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+// PR c++/59730 -+// { dg-do compile { target c++11 } } -+ -+template <typename> void declval(); -+template <typename> void forward(); -+template <typename> class D; -+template <typename _Functor, typename... _Bound_args> -+class D <_Functor(_Bound_args...)> { -+ template <typename... _Args, decltype(declval<_Functor>)> -+ void operator()(...) { -+ 0(forward<_Args>...); -+ } -+}; -Index: gcc/testsuite/g++.dg/cpp0x/decltype57.C +Index: gcc/testsuite/g++.dg/template/local-fn1.C =================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/decltype57.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/decltype57.C (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/g++.dg/template/local-fn1.C (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/g++.dg/template/local-fn1.C (.../branches/gcc-4_8-branch) @@ -0,0 +1,8 @@ -+// PR c++/58633 -+// { dg-do compile { target c++11 } } -+ -+void foo(int i) -+{ -+ typedef int I; -+ decltype(i.I::~I())* p; -+} -Index: gcc/testsuite/g++.dg/cpp0x/variadic147.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/cpp0x/variadic147.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic147.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,10 @@ -+// PR c++/58466 -+// { dg-require-effective-target c++11 } -+ -+template<char, char...> struct A; -+ -+template<typename> struct B; -+ -+template<char... C> struct B<A<C...>> {}; -+ -+B<A<'X'>> b; -Index: gcc/testsuite/g++.dg/eh/uncaught1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/eh/uncaught1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/eh/uncaught1.C (.../branches/gcc-4_8-branch) -@@ -13,7 +13,7 @@ - - static Check const data[] = { - { 0, 0, false }, // construct [0] -- { 1, 0, true }, // [1] = [0] -+ { 1, 0, false }, // [1] = [0] - { 0, 0, true }, // destruct [0] - { 2, 1, true }, // [2] = [1] - { 2, 2, true }, // destruct [2] -Index: gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,54 @@ -+// { dg-do run { target { powerpc64*-*-linux* } } } -+// { dg-options "-fexceptions -fnon-call-exceptions" } -+ -+#include <signal.h> -+#include <stdlib.h> -+#include <fenv.h> -+ -+#define SET_CR(R,V) __asm__ __volatile__ ("mtcrf %0,%1" : : "n" (1<<(7-R)), "r" (V<<(4*(7-R))) : "cr" #R) -+#define GET_CR(R) ({ int tmp; __asm__ __volatile__ ("mfcr %0" : "=r" (tmp)); (tmp >> 4*(7-R)) & 15; }) -+ -+void sighandler (int signo, siginfo_t * si, void * uc) -+{ -+ SET_CR(2, 3); -+ SET_CR(3, 2); -+ SET_CR(4, 1); -+ -+ throw 0; -+} -+ -+float test (float a, float b) __attribute__ ((__noinline__)); -+float test (float a, float b) -+{ -+ float x; -+ asm ("mtcrf %1,%2" : "=f" (x) : "n" (1 << (7-3)), "r" (0), "0" (b) : "cr3"); -+ return a / x; -+} -+ -+int main () -+{ -+ struct sigaction sa; -+ int status; -+ -+ sa.sa_sigaction = sighandler; -+ sa.sa_flags = SA_SIGINFO; -+ -+ status = sigaction (SIGFPE, & sa, NULL); -+ -+ feenableexcept (FE_DIVBYZERO); -+ -+ SET_CR(2, 6); -+ SET_CR(3, 9); -+ SET_CR(4, 12); -+ -+ try { -+ test (1, 0); -+ } -+ catch (...) { -+ return GET_CR(2) != 6 || GET_CR(3) != 9 || GET_CR(4) != 12; -+ } -+ -+ return 1; -+} -+ -+ -Index: gcc/testsuite/g++.dg/eh/uncaught4.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/eh/uncaught4.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/eh/uncaught4.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+// PR c++/41174 -+// { dg-do run } -+ -+#include <exception> -+ -+#define assert(E) if (!(E)) __builtin_abort(); ++// PR c++/60605 + -+struct e { -+ e() -+ { -+ assert( !std::uncaught_exception() ); -+ try { -+ throw 1; -+ } catch (int i) { -+ assert( !std::uncaught_exception() ); -+ throw; ++template <typename T = int> ++struct Foo { ++ void bar() { ++ void bug(); + } -+ } +}; -+ -+int main() -+{ -+ try { -+ throw e(); -+ } catch (int i) { -+ assert( !std::uncaught_exception() ); -+ } -+ assert( !std::uncaught_exception() ); -+} -Index: gcc/testsuite/g++.dg/inherit/virtual11.C +Index: gcc/testsuite/g++.dg/template/conv14.C =================================================================== ---- a/src/gcc/testsuite/g++.dg/inherit/virtual11.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/inherit/virtual11.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+// PR c++/59031 -+// { dg-do compile } -+// { dg-options "-fdump-tree-gimple " } -+class B { -+ public: -+ virtual int add (int a, int b) {return a+ b;} -+}; -+ -+class D : public B { -+}; -+ -+int foo (int a, int b) { -+ D d; -+ return d.add(a, b); -+} -+// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "gimple" } } -+// { dg-final { cleanup-tree-dump "gimple" } } -Index: gcc/testsuite/g++.dg/torture/pr38565.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/torture/pr38565.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/torture/pr38565.C (.../branches/gcc-4_8-branch) -@@ -1,6 +1,7 @@ - // { dg-do compile } - // Ignore warning on some powerpc-linux configurations. - // { dg-prune-output "non-standard ABI extension" } -+// { dg-prune-output "changes the ABI" } - #define vector __attribute__((vector_size(16) )) - vector unsigned int f(int a) - { -Index: gcc/testsuite/g++.dg/torture/pr57499.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/torture/pr57499.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/torture/pr57499.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,14 @@ -+// PR middle-end/57499 -+// { dg-do compile } -+ -+struct S -+{ -+ ~S () __attribute__ ((noreturn)) {} // { dg-warning "function does return" } -+}; -+ -+void -+foo () -+{ -+ S s; -+ throw 1; -+} -Index: gcc/testsuite/g++.dg/torture/pr59163.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/torture/pr59163.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/torture/pr59163.C (.../branches/gcc-4_8-branch) +--- a/src/gcc/testsuite/g++.dg/template/conv14.C (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/g++.dg/template/conv14.C (.../branches/gcc-4_8-branch) @@ -0,0 +1,30 @@ -+// PR target/59163 -+// { dg-do run } -+ -+struct A { float a[4]; }; -+struct B { int b; A a; }; -+ -+__attribute__((noinline, noclone)) void -+bar (A &a) -+{ -+ if (a.a[0] != 36.0f || a.a[1] != 42.0f || a.a[2] != 48.0f || a.a[3] != 54.0f) -+ __builtin_abort (); -+} -+ -+__attribute__((noinline, noclone)) void -+foo (A &a) -+{ -+ int i; -+ A c = a; -+ for (i = 0; i < 4; i++) -+ c.a[i] *= 6.0f; -+ a = c; -+ bar (a); -+} -+ -+int -+main () -+{ -+ B b = { 5, { 6, 7, 8, 9 } }; -+ foo (b.a); -+} -Index: gcc/testsuite/g++.dg/ipa/pr60419.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/ipa/pr60419.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/ipa/pr60419.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,80 @@ -+// PR middle-end/60419 -+// { dg-do compile } -+// { dg-options "-O2" } -+ -+struct C -+{ -+}; -+ -+struct I : C -+{ -+ I (); -+}; -+ -+struct J -+{ -+ void foo (); -+ J (); -+ virtual void foo (int &, int); -+}; -+ -+template <class> -+struct D -+{ -+ virtual void foo (I &) const; -+ void bar () -+ { -+ I p; -+ foo (p); -+ } -+}; -+ -+struct K : J, public D<int> -+{ -+}; -+ -+struct F -+{ -+ K *operator->(); -+}; -+ -+struct N : public K -+{ -+ void foo (int &, int); -+ I n; -+ void foo (I &) const {} -+}; -+ -+struct L : J -+{ -+ F l; -+}; -+ -+struct M : F -+{ -+ L *operator->(); -+}; -+ -+struct G -+{ -+ G (); -+}; ++// PR c++/61647 + -+M h; ++class XX; + -+G::G () -+try -+{ -+ N f; -+ f.bar (); -+ throw; -+} -+catch (int) -+{ -+} -+ -+void -+baz () -+{ -+ h->l->bar (); -+} -Index: gcc/testsuite/g++.dg/template/ref7.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/ref7.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/ref7.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+// PR c++/60274 -+ -+typedef const char *const& ProtocolIdType; -+ -+template <ProtocolIdType protocolId> -+struct C { -+ typedef int ProtocolVersion; -+ struct D { -+ ProtocolVersion GetProtocolVersion(); -+ }; -+}; -+template <ProtocolIdType protocolId> -+typename C<protocolId>::ProtocolVersion C<protocolId>::D::GetProtocolVersion() -+{ -+ return 1; -+} -Index: gcc/testsuite/g++.dg/template/using28.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/using28.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/using28.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,17 @@ -+// PR c++/37140 -+ -+struct C -+{ -+ static const int block_size = 1; -+}; -+ -+template <typename T> struct A { -+ typedef C type; -+}; ++template<typename Container, typename Key> ++struct Accessor; + -+template <typename T> struct B : public A<T> { -+ using typename A<T>::type; -+ static const int block_size = type::block_size; -+}; -+ -+template class B<int>; -Index: gcc/testsuite/g++.dg/template/shadow1.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/shadow1.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/shadow1.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+// PR c++/58632 -+ -+template<template<int I> class A> // { dg-message "shadows" } -+class A {}; // { dg-error "declaration" } -Index: gcc/testsuite/g++.dg/template/partial14.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/partial14.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/partial14.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,16 @@ -+// PR c++/59044 -+ -+template <class T> -+class C { -+private: -+ template <T a, T b> -+ struct Implementation {}; ++template<typename Container, typename Key, typename KeyStore = Key> ++class Variant { ++protected: ++ KeyStore index; ++ Container state; +public: -+ typedef typename Implementation<0, 0>::Typedef Type; -+}; -+ -+template <class T> -+template <T b> -+struct C<T>::Implementation<0, b> { typedef void Typedef; }; -+ -+template class C<unsigned>; -Index: gcc/testsuite/g++.dg/template/using27.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/using27.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/using27.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,33 @@ -+// PR c++/37140 ++ Variant(Container st, const Key& i) : index(i), state(st) {} + -+struct X -+{ -+ typedef int nested_type; -+}; -+ -+template <class T> -+struct A -+{ -+ typedef X type; -+}; -+ -+template <class T> -+struct B : A<T> -+{ -+ using typename A<T>::type; -+ typename type::nested_type x; -+}; -+ -+template <class T> -+struct C : B<T> -+{ -+ using typename B<T>::type; -+ typename type::nested_type y; -+}; -+ -+struct D : C<int> -+{ -+ using C<int>::type; -+ type::nested_type z; -+}; -+ -Index: gcc/testsuite/g++.dg/template/using29.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/using29.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/using29.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+// PR c++/58047 -+ -+template <int N> -+struct print_arg { }; -+ -+struct const_holder { -+ static const int CONSTANT = 42; -+}; -+ -+template <typename T> -+struct identity { -+ typedef T type; -+}; -+ -+template <class T> -+struct test_case : public identity<T> { -+ using typename identity<T>::type; -+ print_arg<type::CONSTANT> printer; -+}; -+ -+template struct test_case<const_holder>; -Index: gcc/testsuite/g++.dg/template/partial15.C -=================================================================== ---- a/src/gcc/testsuite/g++.dg/template/partial15.C (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/g++.dg/template/partial15.C (.../branches/gcc-4_8-branch) -@@ -0,0 +1,19 @@ -+// PR c++/57043 -+// { dg-do link } -+ -+template<typename D> struct complex { }; -+ -+template<typename Tp> -+complex<Tp> -+pow(const complex<Tp>& x, const complex<Tp>& y) { return complex<Tp>(); } -+ -+template<typename T, typename U> -+struct promote_2 { typedef T type; }; -+ -+template<typename Tp, typename Up> -+complex<typename promote_2<Tp, Up>::type> -+pow(const complex<Tp>& x, const complex<Up>& y); -+ -+complex<double> (*powcc)(const complex<double>&, const complex<double>&) = pow; -+ -+int main() {} -Index: gcc/testsuite/c-c++-common/cpp/pr60400-1.h -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/cpp/pr60400-1.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/cpp/pr60400-1.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,3 @@ -+??=ifndef PR60400_1_H -+??=define PR60400_1_H -+??=endif -Index: gcc/testsuite/c-c++-common/cpp/pr60400-2.h -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/cpp/pr60400-2.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/cpp/pr60400-2.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+??=ifndef PR60400_2_H -+??=define PR60400_2_H -+??=include "pr60400-1.h" -+??=endif -Index: gcc/testsuite/c-c++-common/cpp/pr60400.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/cpp/pr60400.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/cpp/pr60400.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* PR preprocessor/60400 */ -+/* { dg-do compile } */ -+/* { dg-options "-trigraphs -Wtrigraphs" } */ -+ -+??=include "pr60400-1.h" -+??=include "pr60400-2.h" -+ -+/* { dg-warning "trigraph" "" { target *-*-* } 1 } */ -+/* { dg-warning "trigraph" "" { target *-*-* } 2 } */ -+/* { dg-warning "trigraph" "" { target *-*-* } 3 } */ -+/* { dg-warning "trigraph" "" { target *-*-* } 4 } */ -+/* { dg-warning "trigraph" "" { target *-*-* } 5 } */ -+/* { dg-warning "trigraph" "" { target *-*-* } 6 } */ -Index: gcc/testsuite/c-c++-common/cpp/pr58844-1.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/cpp/pr58844-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/cpp/pr58844-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+/* PR preprocessor/58844 */ -+/* { dg-do compile } */ -+/* { dg-options "-ftrack-macro-expansion=0" } */ -+ -+#define A x######x -+int A = 1; -+#define A x######x /* { dg-message "previous definition" } */ -+#define A x##x /* { dg-warning "redefined" } */ -Index: gcc/testsuite/c-c++-common/cpp/pr58844-2.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/cpp/pr58844-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/cpp/pr58844-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+/* PR preprocessor/58844 */ -+/* { dg-do compile } */ -+/* { dg-options "-ftrack-macro-expansion=2" } */ -+ -+#define A x######x -+int A = 1; -+#define A x######x /* { dg-message "previous definition" } */ -+#define A x##x /* { dg-warning "redefined" } */ -Index: gcc/testsuite/c-c++-common/convert-vec-1.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/convert-vec-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/convert-vec-1.c (.../branches/gcc-4_8-branch) -@@ -1,3 +1,4 @@ - /* { dg-do compile } */ -+/* { dg-prune-output "changes the ABI" } */ - typedef float v2sf __attribute__ ((vector_size (8))); - v2sf sub (void) { return (v2sf) 0.0; } /* { dg-error "can't convert" } */ -Index: gcc/testsuite/c-c++-common/pr60101.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/pr60101.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/pr60101.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,112 @@ -+/* PR c/60101 */ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -Wall" } */ -+ -+extern int *a, b, *c, *d; -+ -+void -+foo (double _Complex *x, double _Complex *y, double _Complex *z, unsigned int l, int w) -+{ -+ unsigned int e = (unsigned int) a[3]; -+ double _Complex (*v)[l][4][e][l][4] = (double _Complex (*)[l][4][e][l][4]) z; -+ double _Complex (*f)[l][b][l] = (double _Complex (*)[l][b][l]) y; -+ unsigned int g = c[0] * c[1] * c[2]; -+ unsigned int h = d[0] + c[0] * (d[1] + c[1] * d[2]); -+ unsigned int i; -+ -+ for (i = 0; i < e; i++) -+ { -+ int j = e * d[3] + i; -+ -+ unsigned int n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11; -+ float _Complex s = 0.; -+ unsigned int t = 0; -+ -+ for (n0 = 0; n0 < l; n0++) -+ for (n1 = 0; n1 < l; n1++) -+ for (n2 = 0; n2 < l; n2++) -+ for (n3 = 0; n3 < l; n3++) -+ for (n4 = 0; n4 < l; n4++) -+ for (n5 = 0; n5 < l; n5++) -+ for (n6 = 0; n6 < l; n6++) -+ for (n7 = 0; n7 < l; n7++) -+ for (n8 = 0; n8 < l; n8++) -+ for (n9 = 0; n9 < l; n9++) -+ for (n10 = 0; n10 < l; n10++) -+ for (n11 = 0; n11 < l; n11++) -+ { -+ if (t % g == h) -+ s -+ += f[n0][n4][j][n8] * f[n1][n5][j][n9] * ~(f[n2][n6][w][n10]) * ~(f[n3][n7][w][n11]) -+ * (+0.25 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ - 0.5 * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ - 0.5 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ + 0.25 * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ - 0.5 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n10][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ + 0.25 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ - 0.5 * v[0][n3][0][i][n9][1] * v[0][n10][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 1. * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n2][0][i][n5][1] * v[0][n3][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n6][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ + 0.25 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n11][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ - 0.5 * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n6][1][i][n1][0] * v[0][n7][1][i][n0][0] -+ + 1. * v[0][n10][0][i][n9][1] * v[0][n3][0][i][n5][1] * v[0][n2][0][i][n4][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n6][1][i][n0][0] -+ + 0.5 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] * v[0][n10][0][i][n8][0] -+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n11][1][i][n1][0] * v[0][n7][1][i][n0][0] * v[0][n10][0][i][n8][0] -+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n0][0] * v[0][n10][0][i][n1][0] -+ + 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n1][0] * v[0][n10][0][i][n0][0] -+ + 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n0][0] * v[0][n10][0][i][n1][0] -+ - 0.5 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n3][0][i][n5][1] -+ * v[0][n11][1][i][n8][0] * v[0][n7][1][i][n1][0] * v[0][n10][0][i][n0][0] -+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] -+ * v[0][n7][1][i][n1][0] * v[0][n11][1][i][n0][0] * v[0][n3][0][i][n8][0] -+ - 0.25 * v[0][n6][1][i][n4][1] * v[0][n2][0][i][n9][1] * v[0][n10][0][i][n5][1] -+ * v[0][n7][1][i][n8][0] * v[0][n11][1][i][n0][0] * v[0][n3][0][i][n1][0]); -+ t++; -+ } -+ int u = (j - w + b) % b; -+ int q = (j >= w ? +1 : -1); -+ int r = q; -+ x[u] += r * s; ++ template<typename T> ++ operator T() const { ++ return Accessor<Container, KeyStore>::template get<T>(state, index); + } -+} -Index: gcc/testsuite/c-c++-common/pr59037.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/pr59037.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/pr59037.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,12 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O3" } */ -+ -+typedef int v4si __attribute__ ((vector_size (16))); -+ -+int -+main (int argc, char** argv) -+{ -+ v4si x = {0,1,2,3}; -+ x = (v4si) {(x)[3], (x)[2], (x)[1], (x)[0]}; -+ return x[4]; -+} -Index: gcc/testsuite/c-c++-common/pr59280.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/pr59280.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/pr59280.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,4 @@ -+/* PR c/59280 */ -+/* { dg-do compile } */ -+ -+void bar (char *) __attribute__((constructor(foo))); /* { dg-error "constructor priorities must be integers|was not declared|constructor priorities are not supported" } */ -Index: gcc/testsuite/c-c++-common/pr37743.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/pr37743.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/pr37743.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,13 @@ -+/* PR c/37743 */ -+/* This needs to be run only on targets where __UINT32_TYPE__ is defined -+ to unsigned int. */ -+/* { dg-do compile { target *-*-linux-gnu* } } */ -+/* { dg-options "-Wformat" } */ -+ -+int foo (const char *, ...) __attribute__ ((format (printf, 1, 2))); -+ -+void -+bar (unsigned int x) -+{ -+ foo ("%x", __builtin_bswap32 (x)); -+} -Index: gcc/testsuite/c-c++-common/fold-divmul-1.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/fold-divmul-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/fold-divmul-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,11 @@ -+/* { dg-do compile } */ -+/* { dg-options "-fdump-tree-original" } */ -+ -+int * -+fx (int *b, int *e) -+{ -+ return b + (e - b); -+} -+ -+/* { dg-final { scan-tree-dump-not "/\\\[ex\\\]" "original" } } */ -+/* { dg-final { cleanup-tree-dump "original" } } */ -Index: gcc/testsuite/c-c++-common/torture/pr58794-1.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/torture/pr58794-1.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/torture/pr58794-1.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,29 @@ -+/* { dg-do compile } */ -+ -+struct S0 -+{ -+ int f; +}; + -+struct S1 -+{ -+ struct S0 f1; -+ volatile int f2; -+}; -+ -+struct S2 -+{ -+ struct S1 g; -+} a, b; -+ -+static int *c[1][2] = {{0, (int *)&a.g.f2}}; -+static int d; -+ -+int -+main () -+{ -+ for (d = 0; d < 1; d++) -+ for (b.g.f1.f = 0; b.g.f1.f < 1; b.g.f1.f++) -+ *c[b.g.f1.f][d + 1] = 0; -+ return 0; -+} -Index: gcc/testsuite/c-c++-common/torture/pr58794-2.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/torture/pr58794-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/torture/pr58794-2.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+ -+struct S -+{ -+ volatile int f; -+} a; -+ -+unsigned int b; -+ -+static int *c[1][2] = {{0, (int *)&a.f}}; -+static unsigned int d; -+ -+int -+main () -+{ -+ for (; d < 1; d++) -+ for (; b < 1; b++) -+ *c[b][d + 1] = 0; -+ -+ return 0; -+} -Index: gcc/testsuite/c-c++-common/torture/pr60026.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/torture/pr60026.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/torture/pr60026.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,28 @@ -+/* PR ipa/60026 */ -+/* { dg-do compile } */ -+ -+struct S { int f; } a; -+ -+__attribute__((optimize (0))) -+struct S foo (int x, struct S y) -+{ -+ int b = y.f; -+ return a; -+} ++class AutoCleanVariant : public Variant<XX*, int> { ++public: ++ AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {} + -+void -+bar () -+{ -+ while (a.f) -+ { -+ struct S c = {0}; -+ foo (0, c); ++ template<typename T> ++ operator T() const { ++ return Variant<XX*, int>::operator T(); + } -+} -+ -+int -+main () -+{ -+ bar (); -+ return 0; -+} -Index: gcc/testsuite/c-c++-common/vector-compare-2.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/vector-compare-2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/vector-compare-2.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,7 @@ - /* { dg-do compile } */ - /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */ - /* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ -+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ - /* Ignore warning on some powerpc-ibm-aix configurations. */ - /* { dg-prune-output "non-standard ABI extension" } */ - -Index: gcc/testsuite/c-c++-common/gomp/pr58809.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/gomp/pr58809.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/gomp/pr58809.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,31 @@ -+/* PR middle-end/58809 */ -+/* { dg-do compile } */ -+/* { dg-options "-fopenmp" } */ -+ -+_Complex int j; -+_Complex double d; -+ -+void -+foo (void) -+{ -+ #pragma omp parallel reduction (&:j) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (|:j) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (^:j) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (min:j) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (max:j) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (&:d) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (|:d) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (^:d) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (min:d) /* { dg-error "has invalid type for" } */ -+ ; -+ #pragma omp parallel reduction (max:d) /* { dg-error "has invalid type for" } */ -+ ; -+} -Index: gcc/testsuite/c-c++-common/gomp/pr59467.c ++}; +Index: gcc/testsuite/g++.dg/template/ptrmem27.C =================================================================== ---- a/src/gcc/testsuite/c-c++-common/gomp/pr59467.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/gomp/pr59467.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,68 @@ -+/* PR libgomp/59467 */ -+ -+int v; +--- a/src/gcc/testsuite/g++.dg/template/ptrmem27.C (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/testsuite/g++.dg/template/ptrmem27.C (.../branches/gcc-4_8-branch) +@@ -0,0 +1,22 @@ ++// PR c++/61500 + -+void -+foo (void) -+{ -+ int x = 0, y = 0; -+ #pragma omp parallel -+ { -+ int z; -+ #pragma omp single copyprivate (x) /* { dg-error "is not threadprivate or private in outer context" } */ -+ { -+ #pragma omp atomic write -+ x = 6; -+ } -+ #pragma omp atomic read -+ z = x; -+ #pragma omp atomic -+ y += z; -+ } -+ #pragma omp parallel -+ { -+ int z; -+ #pragma omp single copyprivate (v) /* { dg-error "is not threadprivate or private in outer context" } */ -+ { -+ #pragma omp atomic write -+ v = 6; -+ } -+ #pragma omp atomic read -+ z = v; -+ #pragma omp atomic -+ y += z; -+ } -+ #pragma omp parallel private (x) -+ { -+ int z; -+ #pragma omp single copyprivate (x) -+ { -+ #pragma omp atomic write -+ x = 6; -+ } -+ #pragma omp atomic read -+ z = x; -+ #pragma omp atomic -+ y += z; -+ } -+ x = 0; -+ #pragma omp parallel reduction (+:x) -+ { -+ #pragma omp single copyprivate (x) -+ { -+ #pragma omp atomic write -+ x = 6; -+ } -+ #pragma omp atomic -+ y += x; -+ } -+ #pragma omp single copyprivate (x) -+ { -+ x = 7; -+ } -+ #pragma omp single copyprivate (v) /* { dg-error "is not threadprivate or private in outer context" } */ -+ { -+ #pragma omp atomic write -+ v = 6; -+ } -+} -Index: gcc/testsuite/c-c++-common/scal-to-vec2.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/scal-to-vec2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/scal-to-vec2.c (.../branches/gcc-4_8-branch) -@@ -1,6 +1,7 @@ - /* { dg-do compile } */ - /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */ - /* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ -+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ - /* Ignore warning on some powerpc-ibm-aix configurations. */ - /* { dg-prune-output "non-standard ABI extension" } */ - -Index: gcc/testsuite/c-c++-common/pr59032.c -=================================================================== ---- a/src/gcc/testsuite/c-c++-common/pr59032.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/testsuite/c-c++-common/pr59032.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,30 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2" } */ ++struct X { ++ int i; ++ int j; + -+void -+foo() -+{ -+ float v __attribute__((vector_size(8))); -+ v++; -+} ++ int foo(int X::* ptr); + -+void -+foo2 () -+{ -+ float v __attribute__((vector_size(8))); -+ ++v; -+} ++ template <int X::* ptr> ++ int bar(); ++}; + -+void -+foo3 () -+{ -+ float v __attribute__((vector_size(8))); -+ v--; ++int X::foo(int X::* ptr) { ++ int* p = &(this->*ptr); // OK. ++ return *p; +} + -+void -+foo4 () -+{ -+ float v __attribute__((vector_size(8))); -+ --v; ++template <int X::* ptr> ++int X::bar() { ++ int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode. ++ return *p; +} -Index: gcc/cp/typeck.c -=================================================================== ---- a/src/gcc/cp/typeck.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/typeck.c (.../branches/gcc-4_8-branch) -@@ -4103,6 +4103,11 @@ - case TRUTH_ORIF_EXPR: - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: -+ if (TREE_CODE (type0) == VECTOR_TYPE || TREE_CODE (type1) == VECTOR_TYPE) -+ { -+ sorry ("logical operation on vector type"); -+ return error_mark_node; -+ } - result_type = boolean_type_node; - break; - -@@ -5010,7 +5015,10 @@ - cp_truthvalue_conversion (tree expr) - { - tree type = TREE_TYPE (expr); -- if (TYPE_PTRDATAMEM_P (type)) -+ if (TYPE_PTRDATAMEM_P (type) -+ /* Avoid ICE on invalid use of non-static member function. */ -+ || (TREE_CODE (expr) == FUNCTION_DECL -+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (expr))) - return build_binary_op (EXPR_LOCATION (expr), - NE_EXPR, expr, nullptr_node, 1); - else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type)) -@@ -5588,7 +5596,9 @@ - inc = cxx_sizeof_nowarn (TREE_TYPE (argtype)); - } - else -- inc = integer_one_node; -+ inc = (TREE_CODE (argtype) == VECTOR_TYPE -+ ? build_one_cst (argtype) -+ : integer_one_node); - - inc = cp_convert (argtype, inc, complain); - -@@ -7194,8 +7204,7 @@ - side effect associated with any single compound assignment - operator. -- end note ] */ - lhs = stabilize_reference (lhs); -- if (TREE_SIDE_EFFECTS (rhs)) -- rhs = mark_rvalue_use (rhs); -+ rhs = rvalue (rhs); - rhs = stabilize_expr (rhs, &init); - newrhs = cp_build_binary_op (input_location, - modifycode, lhs, rhs, -@@ -7611,7 +7620,7 @@ - /* Handle null pointer to member function conversions. */ - if (null_ptr_cst_p (pfn)) - { -- pfn = build_c_cast (input_location, type, pfn); -+ pfn = cp_build_c_cast (type, pfn, complain); - return build_ptrmemfunc1 (to_type, - integer_zero_node, - pfn); -Index: gcc/cp/decl.c -=================================================================== ---- a/src/gcc/cp/decl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/decl.c (.../branches/gcc-4_8-branch) -@@ -1867,9 +1867,9 @@ - /* Merge the data types specified in the two decls. */ - newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); - -- /* If merge_types produces a non-typedef type, just use the old type. */ -- if (TREE_CODE (newdecl) == TYPE_DECL -- && newtype == DECL_ORIGINAL_TYPE (newdecl)) -+ /* For typedefs use the old type, as the new type's DECL_NAME points -+ at newdecl, which will be ggc_freed. */ -+ if (TREE_CODE (newdecl) == TYPE_DECL) - newtype = oldtype; - - if (TREE_CODE (newdecl) == VAR_DECL) -@@ -8193,7 +8193,9 @@ - abi_1_itype = error_mark_node; - } - -- size = maybe_constant_value (size); -+ if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type)) -+ size = maybe_constant_value (size); -+ - if (!TREE_CONSTANT (size)) - size = osize; - } -@@ -11891,7 +11893,10 @@ - - if (decl - && (DECL_CLASS_TEMPLATE_P (decl) -- || DECL_TEMPLATE_TEMPLATE_PARM_P (decl))) -+ /* If scope is ts_current we're defining a class, so ignore a -+ template template parameter. */ -+ || (scope != ts_current -+ && DECL_TEMPLATE_TEMPLATE_PARM_P (decl)))) - decl = DECL_TEMPLATE_RESULT (decl); - - if (decl && TREE_CODE (decl) == TYPE_DECL) -Index: gcc/cp/except.c +Index: gcc/cp/tree.c =================================================================== ---- a/src/gcc/cp/except.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/except.c (.../branches/gcc-4_8-branch) -@@ -380,6 +380,9 @@ - { - tree type = body ? TREE_TYPE (body) : void_type_node; +--- a/src/gcc/cp/tree.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/cp/tree.c (.../branches/gcc-4_8-branch) +@@ -97,6 +97,16 @@ + case IMAGPART_EXPR: + return lvalue_kind (TREE_OPERAND (ref, 0)); -+ if (!flag_exceptions) -+ return body; ++ case MEMBER_REF: ++ case DOTSTAR_EXPR: ++ if (TREE_CODE (ref) == MEMBER_REF) ++ op1_lvalue_kind = clk_ordinary; ++ else ++ op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); ++ if (TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (ref, 1)))) ++ op1_lvalue_kind = clk_none; ++ return op1_lvalue_kind; + - if (cond && !value_dependent_expression_p (cond)) - { - cond = cxx_constant_value (cond); + case COMPONENT_REF: + op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); + /* Look at the member designator. */ Index: gcc/cp/ChangeLog =================================================================== ---- a/src/gcc/cp/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/gcc/cp/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/gcc/cp/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,246 @@ -+2014-02-28 Jason Merrill <jason@redhat.com> -+ -+ PR c++/58845 -+ * typeck.c (cp_build_binary_op): Sorry on vector&&vector. -+ -+2014-02-26 Jason Merrill <jason@redhat.com> -+ -+ PR c++/60182 -+ * pt.c (unify): Ignore alias templates when deducing a template -+ template parameter. -+ -+2014-02-24 Jason Merrill <jason@redhat.com> -+ -+ PR c++/60146 -+ * pt.c (tsubst_omp_for_iterator): Don't let substitution of the -+ DECL_EXPR initialize a non-class iterator. -+ -+2014-02-24 Fabien Chêne <fabien@gcc.gnu.org> -+ PR c++/37140 -+ * parser.c (cp_parser_nonclass_name): Call strip_using_decl and -+ move the code handling dependent USING_DECLs... -+ * name-lookup.c (strip_using_decl): ...Here. -+ -+2014-02-21 Jason Merrill <jason@redhat.com> -+ -+ PR c++/60108 -+ * semantics.c (expand_or_defer_fn_1): Check DECL_DEFAULTED_FN. -+ -+ PR c++/60187 -+ * parser.c (cp_parser_enum_specifier): Call -+ check_for_bare_parameter_packs. -+ -+ PR c++/60216 -+ * pt.c (register_specialization): Copy DECL_DELETED_FN to clones. -+ -+ PR c++/60219 -+ * pt.c (coerce_template_parms): Bail if argument packing fails. -+ -+ PR c++/60248 -+ * mangle.c (mangle_decl): Don't make an alias for a TYPE_DECL. -+ -+2014-02-20 Jason Merrill <jason@redhat.com> -+ -+ PR c++/60274 -+ Revert: -+ PR c++/58606 -+ * pt.c (template_parm_to_arg): Call convert_from_reference. -+ (tsubst_template_arg): Don't strip reference refs. -+ -+2014-02-20 Kai Tietz <ktietz@redhat.com> -+ -+ PR c++/58873 -+ * parser.c (cp_parser_functional_cast): Treat NULL_TREE -+ valued type argument as error_mark_node. -+ -+ PR c++/58835 -+ * semantics.c (finish_fname): Handle error_mark_node. -+ -+2014-02-19 Jason Merrill <jason@redhat.com> -+ -+ PR c++/60046 -+ * pt.c (maybe_instantiate_noexcept): Don't instantiate exception -+ spec from template context. -+ -+2014-01-31 Jason Merrill <jason@redhat.com> -+ -+ PR c++/58672 -+ * decl2.c (handle_tls_init): Handle null init fn. -+ -+ PR c++/55800 -+ * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable. -+ -+ PR c++/59646 -+ * call.c (convert_like_real) [ck_aggr]: Set TARGET_EXPR_LIST_INIT_P. -+ [ck_list]: Check for error_mark_node. -+ -+ PR c++/57043 -+ * pt.c (fn_type_unification): Don't do DEDUCE_EXACT check -+ during partial ordering. -+ -+2014-01-30 Jason Merrill <jason@redhat.com> -+ -+ PR c++/57899 -+ * pt.c (instantiate_template_1): Save/restore local_specializations. -+ -+2014-01-29 Jason Merrill <jason@redhat.com> -+ -+ PR c++/59989 -+ * pt.c (expand_template_argument_pack): Correct -+ non_default_args_count calculation. -+ -+ PR c++/58466 -+ * pt.c (unify_pack_expansion): Call expand_template_argument_pack. -+ -+2014-01-28 Jason Merrill <jason@redhat.com> -+ -+ PR c++/58632 -+ * decl.c (lookup_and_check_tag): Ignore template parameters if -+ scope == ts_current. -+ * pt.c (check_template_shadow): Don't complain about the injected -+ class name. -+ -+2014-01-27 Jason Merrill <jason@redhat.com> -+ -+ PR c++/54652 -+ * decl.c (duplicate_decls): Always use oldtype for TYPE_DECL. -+ -+ PR c++/58504 -+ * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Use tsubst for -+ types. -+ -+ PR c++/58606 -+ * pt.c (template_parm_to_arg): Call convert_from_reference. -+ (tsubst_template_arg): Don't strip reference refs. -+ -+ PR c++/58639 -+ * call.c (build_aggr_conv): Reject value-initialization of reference. -+ -+ PR c++/58812 -+ * call.c (convert_like_real): Give helpful error about excess braces -+ for reference binding, too. -+ -+ PR c++/58814 -+ * typeck.c (cp_build_modify_expr): Make the RHS an rvalue before -+ stabilizing. -+ -+ PR c++/58837 -+ * typeck.c (cp_truthvalue_conversion): Use explicit comparison for -+ FUNCTION_DECL. -+ -+ PR c++/59097 -+ * decl.c (compute_array_index_type): Don't call -+ maybe_constant_value for a non-integral expression. -+ -+ PR c++/58965 -+ * mangle.c (write_guarded_var_name): Handle null DECL_NAME. -+ -+2014-01-24 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/57524 -+ * name-lookup.c (push_using_directive): Use timevar_cond_start. -+ -+2014-01-23 Jakub Jelinek <jakub@redhat.com> -+ -+ PR middle-end/58809 -+ * semantics.c (finish_omp_clauses): Reject MIN_EXPR, MAX_EXPR, -+ BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR on COMPLEX_TYPEs. -+ -+2014-01-20 Marek Polacek <polacek@redhat.com> -+ -+ Backported from mainline -+ 2014-01-17 Marek Polacek <polacek@redhat.com> -+ -+ PR c++/59838 -+ * cvt.c (ocp_convert): Don't segfault on non-existing -+ ENUM_UNDERLYING_TYPE. -+ -+2014-01-10 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/56060 -+ PR c++/59730 -+ * pt.c (type_dependent_expression_p): Handle EXPR_PACK_EXPANSION. -+ -+2013-12-12 Jason Merrill <jason@redhat.com> +@@ -1,3 +1,25 @@ ++2014-06-30 Jason Merrill <jason@redhat.com> + -+ PR c++/58954 -+ * pt.c (resolve_overloaded_unification): Discard access checks. ++ PR c++/61647 ++ * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. + -+2013-12-05 Jason Merrill <jason@redhat.com> ++ PR c++/61539 ++ * pt.c (unify_one_argument): Type/expression mismatch just causes ++ deduction failure. + -+ PR c++/59044 -+ PR c++/59052 -+ * pt.c (most_specialized_class): Use the partially instantiated -+ template for deduction. Drop the TMPL parameter. ++ PR c++/61500 ++ * tree.c (lvalue_kind): Handle MEMBER_REF and DOTSTAR_EXPR. + -+2013-12-04 Jakub Jelinek <jakub@redhat.com> ++2014-06-17 Jason Merrill <jason@redhat.com> + -+ PR c++/59268 -+ * pt.c (tsubst_copy_and_build): Handle POINTER_PLUS_EXPR. ++ PR c++/60605 ++ * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. + -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> ++2014-06-02 Jason Merrill <jason@redhat.com> + -+ PR c++/59032 -+ * typeck.c (cp_build_unary_op): Allow vector increment and decrement. ++ PR c++/61134 ++ * pt.c (pack_deducible_p): Handle canonicalization. + -+2013-11-27 Tom de Vries <tom@codesourcery.com> -+ Marc Glisse <marc.glisse@inria.fr> -+ -+ PR middle-end/59037 -+ * semantics.c (cxx_fold_indirect_ref): Don't create out-of-bounds -+ BIT_FIELD_REF. -+ -+2013-11-28 Jakub Jelinek <jakub@redhat.com> -+ -+ PR c++/59297 -+ * semantics.c (finish_omp_atomic): Call finish_expr_stmt -+ rather than add_stmt. -+ -+2013-11-23 Easwaran Raman <eraman@google.com> -+ -+ PR c++/59031 -+ * call.c (build_new_method_call_1): Comnpare function context -+ with BASELINK_BINFO type rather than instance type before -+ marking the call with LOOKUP_NONVIRTUAL. -+ -+2013-10-31 Jason Merrill <jason@redhat.com> -+ -+ PR c++/58162 -+ * parser.c (cp_parser_late_parse_one_default_arg): Set -+ TARGET_EXPR_DIRECT_INIT_P. -+ -+2013-11-11 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ * cvt.c (cp_convert_to_pointer): Call build_ptrmemfunc before -+ maybe_warn_zero_as_null_pointer_constant to avoid duplicate -+ -Wzero-as-null-pointer-constant diagnostics. -+ -+ * typeck.c (build_ptrmemfunc): Use cp_build_c_cast. -+ -+2013-10-25 Tom de Vries <tom@codesourcery.com> -+ -+ PR c++/58282 -+ * except.c (build_must_not_throw_expr): Handle -+ flag_exceptions. -+ -+2013-10-17 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/58596 -+ * semantics.c (lambda_expr_this_capture): Handle NSDMIs in the -+ cp_unevaluated_operand case. -+ -+2013-10-16 Paolo Carlini <paolo.carlini@oracle.com> -+ -+ PR c++/58633 -+ * parser.c (cp_parser_pseudo_destructor_name): Revert r174385 changes. -+ -+2013-10-16 Jason Merrill <jason@redhat.com> -+ -+ PR c++/57850 -+ * decl2.c (dump_tu): Split out from... -+ (cp_write_global_declarations): ...here. Call it in PCH mode. -+ - 2013-10-16 Release Manager + 2014-05-22 Release Manager - * GCC 4.8.2 released. + * GCC 4.8.3 released. Index: gcc/cp/pt.c =================================================================== ---- a/src/gcc/cp/pt.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/cp/pt.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/cp/pt.c (.../branches/gcc-4_8-branch) -@@ -170,7 +170,7 @@ - static tree tsubst_template_args (tree, tree, tsubst_flags_t, tree); - static tree tsubst_template_parms (tree, tree, tsubst_flags_t); - static void regenerate_decl_from_template (tree, tree); --static tree most_specialized_class (tree, tree, tsubst_flags_t); -+static tree most_specialized_class (tree, tsubst_flags_t); - static tree tsubst_aggr_type (tree, tree, tsubst_flags_t, tree, int); - static tree tsubst_arg_types (tree, tree, tree, tsubst_flags_t, tree); - static tree tsubst_function_type (tree, tree, tsubst_flags_t, tree); -@@ -1419,6 +1419,8 @@ - = DECL_DECLARED_INLINE_P (fn); - DECL_SOURCE_LOCATION (clone) - = DECL_SOURCE_LOCATION (fn); -+ DECL_DELETED_FN (clone) -+ = DECL_DELETED_FN (fn); - } - check_specialization_namespace (tmpl); - -@@ -3436,7 +3438,7 @@ - for (i = 0; i < num_packed; ++i, ++out_arg) - TREE_VEC_ELT (result_args, out_arg) = TREE_VEC_ELT(packed, i); - if (non_default_args_count > 0) -- non_default_args_count += num_packed; -+ non_default_args_count += num_packed - 1; - } - else - { -@@ -3491,6 +3493,11 @@ - || TEMPLATE_PARMS_FOR_INLINE (current_template_parms)) - return true; - -+ /* Don't complain about the injected class name, as we've already -+ complained about the class itself. */ -+ if (DECL_SELF_REFERENCE_P (decl)) -+ return false; -+ - error ("declaration of %q+#D", decl); - error (" shadows template parm %q+#D", olddecl); - return false; -@@ -4261,7 +4268,7 @@ - if (COMPLETE_TYPE_P (inst_type) - && CLASSTYPE_IMPLICIT_INSTANTIATION (inst_type)) - { -- tree spec = most_specialized_class (inst_type, maintmpl, tf_none); -+ tree spec = most_specialized_class (inst_type, tf_none); - if (spec && TREE_TYPE (spec) == type) - permerror (input_location, - "partial specialization of %qT after instantiation " -@@ -6672,6 +6679,8 @@ - /* Store this argument. */ - if (arg == error_mark_node) - lost++; -+ if (lost) -+ break; - TREE_VEC_ELT (new_inner_args, parm_idx) = arg; - - /* We are done with all of the arguments. */ -@@ -8572,7 +8581,7 @@ - - /* Determine what specialization of the original template to - instantiate. */ -- t = most_specialized_class (type, templ, tf_warning_or_error); -+ t = most_specialized_class (type, tf_warning_or_error); - if (t == error_mark_node) - { - TYPE_BEING_DEFINED (type) = 1; -@@ -12694,27 +12703,43 @@ - tsubst_expr ((NODE), args, complain, in_decl, \ - integral_constant_expression_p) - tree decl, init, cond, incr; -- bool init_decl; - - init = TREE_VEC_ELT (OMP_FOR_INIT (t), i); - gcc_assert (TREE_CODE (init) == MODIFY_EXPR); - decl = TREE_OPERAND (init, 0); - init = TREE_OPERAND (init, 1); -- /* Do this before substituting into decl to handle 'auto'. */ -- init_decl = (init && TREE_CODE (init) == DECL_EXPR); -- init = RECUR (init); -- decl = RECUR (decl); -- if (init_decl) -+ tree decl_expr = NULL_TREE; -+ if (init && TREE_CODE (init) == DECL_EXPR) - { -- gcc_assert (!processing_template_decl); -- init = DECL_INITIAL (decl); -- DECL_INITIAL (decl) = NULL_TREE; -+ /* We need to jump through some hoops to handle declarations in the -+ for-init-statement, since we might need to handle auto deduction, -+ but we need to keep control of initialization. */ -+ decl_expr = init; -+ init = DECL_INITIAL (DECL_EXPR_DECL (init)); -+ decl = tsubst_decl (decl, args, complain); - } -+ else -+ decl = RECUR (decl); -+ init = RECUR (init); - -+ tree auto_node = type_uses_auto (TREE_TYPE (decl)); -+ if (auto_node && init) -+ TREE_TYPE (decl) -+ = do_auto_deduction (TREE_TYPE (decl), init, auto_node); -+ - gcc_assert (!type_dependent_expression_p (decl)); - - if (!CLASS_TYPE_P (TREE_TYPE (decl))) - { -+ if (decl_expr) -+ { -+ /* Declare the variable, but don't let that initialize it. */ -+ tree init_sav = DECL_INITIAL (DECL_EXPR_DECL (decl_expr)); -+ DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = NULL_TREE; -+ RECUR (decl_expr); -+ DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = init_sav; -+ } -+ - cond = RECUR (TREE_VEC_ELT (OMP_FOR_COND (t), i)); - incr = TREE_VEC_ELT (OMP_FOR_INCR (t), i); - if (TREE_CODE (incr) == MODIFY_EXPR) -@@ -12731,8 +12756,14 @@ - return; - } - -- if (init && !init_decl) -+ if (decl_expr) - { -+ /* Declare and initialize the variable. */ -+ RECUR (decl_expr); -+ init = NULL_TREE; -+ } -+ else if (init) -+ { - tree c; - for (c = *clauses; c ; c = OMP_CLAUSE_CHAIN (c)) - { -@@ -13710,6 +13741,10 @@ - RETURN (r); - } - -+ case POINTER_PLUS_EXPR: -+ return fold_build_pointer_plus (RECUR (TREE_OPERAND (t, 0)), -+ RECUR (TREE_OPERAND (t, 1))); -+ - case SCOPE_REF: - RETURN (tsubst_qualified_id (t, args, complain, in_decl, /*done=*/true, - /*address_p=*/false)); -@@ -14471,12 +14506,12 @@ - - case TRAIT_EXPR: - { -- tree type1 = tsubst_copy (TRAIT_EXPR_TYPE1 (t), args, -- complain, in_decl); -+ tree type1 = tsubst (TRAIT_EXPR_TYPE1 (t), args, -+ complain, in_decl); - - tree type2 = TRAIT_EXPR_TYPE2 (t); - if (type2) -- type2 = tsubst_copy (type2, args, complain, in_decl); -+ type2 = tsubst (type2, args, complain, in_decl); - - RETURN (finish_trait_expr (TRAIT_EXPR_KIND (t), type1, type2)); - } -@@ -14778,6 +14813,8 @@ - /* Instantiation of the function happens in the context of the function - template, not the context of the overload resolution we're doing. */ - push_to_top_level (); -+ struct pointer_map_t *saved_local_specializations = local_specializations; -+ local_specializations = NULL; - /* If there are dependent arguments, e.g. because we're doing partial - ordering, make sure processing_template_decl stays set. */ - if (uses_template_parms (targ_ptr)) -@@ -14793,6 +14830,7 @@ - targ_ptr, complain, gen_tmpl); - if (DECL_CLASS_SCOPE_P (gen_tmpl)) - pop_nested_class (); -+ local_specializations = saved_local_specializations; - pop_from_top_level (); - - if (fndecl == error_mark_node) -@@ -15192,8 +15230,11 @@ - - /* If we're looking for an exact match, check that what we got - is indeed an exact match. It might not be if some template -- parameters are used in non-deduced contexts. */ -- if (strict == DEDUCE_EXACT) -+ parameters are used in non-deduced contexts. But don't check -+ for an exact match if we have dependent template arguments; -+ in that case we're doing partial ordering, and we already know -+ that we have two candidates that will provide the actual type. */ -+ if (strict == DEDUCE_EXACT && !any_dependent_template_arguments_p (targs)) - { - tree substed = TREE_TYPE (decl); - unsigned int i; -@@ -15749,7 +15790,7 @@ - if (subargs != error_mark_node - && !any_dependent_template_arguments_p (subargs)) - { -- elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE); -+ elem = TREE_TYPE (instantiate_template (fn, subargs, tf_none)); - if (try_one_overload (tparms, targs, tempargs, parm, - elem, strict, sub_strict, addr_p, explain_p) - && (!goodfn || !same_type_p (goodfn, elem))) -@@ -16207,6 +16248,9 @@ - tree pattern = PACK_EXPANSION_PATTERN (parm); - tree pack, packs = NULL_TREE; - int i, start = TREE_VEC_LENGTH (packed_parms) - 1; -+ -+ packed_args = expand_template_argument_pack (packed_args); -+ - int len = TREE_VEC_LENGTH (packed_args); - - /* Determine the parameter packs we will be deducing from the -@@ -16574,9 +16618,11 @@ - if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM - && !CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P (arg)) - return unify_template_deduction_failure (explain_p, parm, arg); -- +@@ -4308,7 +4308,8 @@ + in the template-parameter-list of the definition of a member of a + class template. */ + +- if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL) ++ if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL ++ || (TREE_CODE (decl) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (decl))) + /* You can't have a function template declaration in a local + scope, nor you can you define a member of a class template in a + local scope. */ +@@ -14934,7 +14935,7 @@ + continue; + for (packs = PACK_EXPANSION_PARAMETER_PACKS (type); + packs; packs = TREE_CHAIN (packs)) +- if (TREE_VALUE (packs) == parm) ++ if (template_args_equal (TREE_VALUE (packs), parm)) { - tree parmvec = TYPE_TI_ARGS (parm); -+ /* An alias template name is never deduced. */ -+ if (TYPE_ALIAS_P (arg)) -+ arg = strip_typedefs (arg); - tree argvec = INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (arg)); - tree full_argvec = add_to_template_args (targs, argvec); - tree parm_parms -@@ -17553,7 +17599,7 @@ - return -1; - } - --/* Determine which of two partial specializations of MAIN_TMPL is more -+/* Determine which of two partial specializations of TMPL is more - specialized. - - PAT1 is a TREE_LIST whose TREE_TYPE is the _TYPE node corresponding -@@ -17569,7 +17615,7 @@ - two templates is more specialized. */ - - static int --more_specialized_class (tree main_tmpl, tree pat1, tree pat2) -+more_specialized_class (tree tmpl, tree pat1, tree pat2) - { - tree targs; - tree tmpl1, tmpl2; -@@ -17584,7 +17630,7 @@ - types in the arguments, and we need our dependency check functions - to behave correctly. */ - ++processing_template_decl; -- targs = get_class_bindings (main_tmpl, TREE_VALUE (pat1), -+ targs = get_class_bindings (tmpl, TREE_VALUE (pat1), - CLASSTYPE_TI_ARGS (tmpl1), - CLASSTYPE_TI_ARGS (tmpl2)); - if (targs) -@@ -17593,7 +17639,7 @@ - any_deductions = true; - } - -- targs = get_class_bindings (main_tmpl, TREE_VALUE (pat2), -+ targs = get_class_bindings (tmpl, TREE_VALUE (pat2), - CLASSTYPE_TI_ARGS (tmpl2), - CLASSTYPE_TI_ARGS (tmpl1)); - if (targs) -@@ -17673,7 +17719,7 @@ - } - - /* Return the innermost template arguments that, when applied to a partial -- specialization of MAIN_TMPL whose innermost template parameters are -+ specialization of TMPL whose innermost template parameters are - TPARMS, and whose specialization arguments are SPEC_ARGS, yield the - ARGS. - -@@ -17688,7 +17734,7 @@ - is bound to `double'. */ - - static tree --get_class_bindings (tree main_tmpl, tree tparms, tree spec_args, tree args) -+get_class_bindings (tree tmpl, tree tparms, tree spec_args, tree args) - { - int i, ntparms = TREE_VEC_LENGTH (tparms); - tree deduced_args; -@@ -17728,8 +17774,8 @@ - `T' is `A' but unify () does not check whether `typename T::X' - is `int'. */ - spec_args = tsubst (spec_args, deduced_args, tf_none, NULL_TREE); -- spec_args = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (main_tmpl), -- spec_args, main_tmpl, -+ spec_args = coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl), -+ spec_args, tmpl, - tf_none, false, false); - if (spec_args == error_mark_node - /* We only need to check the innermost arguments; the other -@@ -17877,8 +17923,8 @@ - } - - /* Return the most specialized of the class template partial -- specializations of TMPL which can produce TYPE, a specialization of -- TMPL. The value returned is actually a TREE_LIST; the TREE_TYPE is -+ specializations which can produce TYPE, a specialization of some class -+ template. The value returned is actually a TREE_LIST; the TREE_TYPE is - a _TYPE node corresponding to the partial specialization, while the - TREE_PURPOSE is the set of template arguments that must be - substituted into the TREE_TYPE in order to generate TYPE. -@@ -17885,11 +17931,11 @@ - - If the choice of partial specialization is ambiguous, a diagnostic - is issued, and the error_mark_node is returned. If there are no -- partial specializations of TMPL matching TYPE, then NULL_TREE is -- returned. */ -+ partial specializations matching TYPE, then NULL_TREE is -+ returned, indicating that the primary template should be used. */ - - static tree --most_specialized_class (tree type, tree tmpl, tsubst_flags_t complain) -+most_specialized_class (tree type, tsubst_flags_t complain) - { - tree list = NULL_TREE; - tree t; -@@ -17896,11 +17942,11 @@ - tree champ; - int fate; - bool ambiguous_p; -- tree args; - tree outer_args = NULL_TREE; - -- tmpl = most_general_template (tmpl); -- args = CLASSTYPE_TI_ARGS (type); -+ tree tmpl = CLASSTYPE_TI_TEMPLATE (type); -+ tree main_tmpl = most_general_template (tmpl); -+ tree args = CLASSTYPE_TI_ARGS (type); - - /* For determining which partial specialization to use, only the - innermost args are interesting. */ -@@ -17910,7 +17956,7 @@ - args = INNERMOST_TEMPLATE_ARGS (args); + /* The template parameter pack is used in a function parameter + pack. If this is the end of the parameter list, the +@@ -15502,8 +15503,9 @@ + maybe_adjust_types_for_deduction (strict, &parm, &arg, arg_expr); } + else +- gcc_assert ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) +- == (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)); ++ if ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) ++ != (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)) ++ return unify_template_argument_mismatch (explain_p, parm, arg); + + /* For deduction from an init-list we need the actual list. */ + if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr)) +@@ -20009,7 +20011,12 @@ + return true; -- for (t = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); t; t = TREE_CHAIN (t)) -+ for (t = DECL_TEMPLATE_SPECIALIZATIONS (main_tmpl); t; t = TREE_CHAIN (t)) - { - tree partial_spec_args; - tree spec_args; -@@ -17944,8 +17990,7 @@ - - partial_spec_args = - coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl), -- add_to_template_args (outer_args, -- partial_spec_args), -+ partial_spec_args, - tmpl, tf_none, - /*require_all_args=*/true, - /*use_default_args=*/true); -@@ -18553,6 +18598,10 @@ - { - tree fntype, spec, noex, clone; - -+ /* Don't instantiate a noexcept-specification from template context. */ -+ if (processing_template_decl) -+ return; -+ - if (DECL_CLONED_FUNCTION_P (fn)) - fn = DECL_CLONED_FUNCTION (fn); - fntype = TREE_TYPE (fn); -@@ -19955,6 +20004,10 @@ - if (TREE_CODE (expression) == SCOPE_REF) - return false; - -+ /* Always dependent, on the number of arguments if nothing else. */ -+ if (TREE_CODE (expression) == EXPR_PACK_EXPANSION) -+ return true; -+ if (BASELINK_P (expression)) - expression = BASELINK_FUNCTIONS (expression); - -Index: gcc/cp/semantics.c -=================================================================== ---- a/src/gcc/cp/semantics.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/semantics.c (.../branches/gcc-4_8-branch) -@@ -2501,7 +2501,8 @@ - tree decl; - - decl = fname_decl (input_location, C_RID_CODE (id), id); -- if (processing_template_decl && current_function_decl) -+ if (processing_template_decl && current_function_decl -+ && decl != error_mark_node) - decl = DECL_NAME (decl); - return decl; - } -@@ -3853,7 +3854,7 @@ - linkage of all functions, and as that causes writes to - the data mapped in from the PCH file, it's advantageous - to mark the functions at this point. */ -- if (!DECL_IMPLICIT_INSTANTIATION (fn)) -+ if (!DECL_IMPLICIT_INSTANTIATION (fn) || DECL_DEFAULTED_FN (fn)) - { - /* This function must have external linkage, as - otherwise DECL_INTERFACE_KNOWN would have been -@@ -4291,7 +4292,8 @@ - error ("%qE has invalid type for %<reduction%>", t); - remove = true; - } -- else if (FLOAT_TYPE_P (TREE_TYPE (t))) -+ else if (FLOAT_TYPE_P (TREE_TYPE (t)) -+ || TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) - { - enum tree_code r_code = OMP_CLAUSE_REDUCTION_CODE (c); - switch (r_code) -@@ -4299,10 +4301,26 @@ - case PLUS_EXPR: - case MULT_EXPR: - case MINUS_EXPR: -+ break; - case MIN_EXPR: - case MAX_EXPR: -+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE) -+ r_code = ERROR_MARK; - break; -+ case BIT_AND_EXPR: -+ case BIT_XOR_EXPR: -+ case BIT_IOR_EXPR: - default: -+ r_code = ERROR_MARK; -+ break; -+ case TRUTH_ANDIF_EXPR: -+ case TRUTH_ORIF_EXPR: -+ if (FLOAT_TYPE_P (TREE_TYPE (t))) -+ r_code = ERROR_MARK; -+ break; -+ } -+ if (r_code == ERROR_MARK) -+ { - error ("%qE has invalid type for %<reduction(%s)%>", - t, operator_name_info[r_code].name); - remove = true; -@@ -5059,7 +5077,7 @@ - } - stmt = build2 (OMP_ATOMIC, void_type_node, integer_zero_node, stmt); - } -- add_stmt (stmt); -+ finish_expr_stmt (stmt); - } - - void -@@ -7543,7 +7561,7 @@ - unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; - tree index = bitsize_int (indexi); - -- if (offset/part_widthi <= TYPE_VECTOR_SUBPARTS (op00type)) -+ if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type)) - return fold_build3_loc (loc, - BIT_FIELD_REF, type, op00, - part_width, index); -@@ -9481,7 +9499,14 @@ - /* In unevaluated context this isn't an odr-use, so just return the - nearest 'this'. */ - if (cp_unevaluated_operand) -- return lookup_name (this_identifier); -+ { -+ /* In an NSDMI the fake 'this' pointer that we're using for -+ parsing is in scope_chain. */ -+ if (LAMBDA_EXPR_EXTRA_SCOPE (lambda) -+ && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL) -+ return scope_chain->x_current_class_ptr; -+ return lookup_name (this_identifier); -+ } - - /* Try to default capture 'this' if we can. */ - if (!this_capture -Index: gcc/cp/decl2.c -=================================================================== ---- a/src/gcc/cp/decl2.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/decl2.c (.../branches/gcc-4_8-branch) -@@ -2884,7 +2884,7 @@ - TREE_PUBLIC (fn) = TREE_PUBLIC (var); - DECL_ARTIFICIAL (fn) = true; - DECL_COMDAT (fn) = DECL_COMDAT (var); -- DECL_EXTERNAL (fn) = true; -+ DECL_EXTERNAL (fn) = DECL_EXTERNAL (var); - if (DECL_ONE_ONLY (var)) - make_decl_one_only (fn, cxx_comdat_group (fn)); - if (TREE_PUBLIC (var)) -@@ -3946,6 +3946,8 @@ - if (TREE_PUBLIC (var)) - { - tree single_init_fn = get_tls_init_fn (var); -+ if (single_init_fn == NULL_TREE) -+ continue; - cgraph_node *alias - = cgraph_same_body_alias (cgraph_get_create_node (fn), - single_init_fn, fn); -@@ -3960,6 +3962,22 @@ - expand_or_defer_fn (finish_function (0)); - } - -+/* The entire file is now complete. If requested, dump everything -+ to a file. */ -+ -+static void -+dump_tu (void) -+{ -+ int flags; -+ FILE *stream = dump_begin (TDI_tu, &flags); -+ -+ if (stream) -+ { -+ dump_node (global_namespace, flags & ~TDF_SLIM, stream); -+ dump_end (TDI_tu, stream); -+ } -+} -+ - /* This routine is called at the end of compilation. - Its job is to create all the code needed to initialize and - destroy the global aggregates. We do the destruction -@@ -3990,6 +4008,7 @@ - if (pch_file) - { - c_common_write_pch (); -+ dump_tu (); - return; - } - -@@ -4359,17 +4378,8 @@ - - /* The entire file is now complete. If requested, dump everything - to a file. */ -- { -- int flags; -- FILE *stream = dump_begin (TDI_tu, &flags); -+ dump_tu (); - -- if (stream) -- { -- dump_node (global_namespace, flags & ~TDF_SLIM, stream); -- dump_end (TDI_tu, stream); -- } -- } -- - if (flag_detailed_statistics) - { - dump_tree_statistics (); -Index: gcc/cp/parser.c -=================================================================== ---- a/src/gcc/cp/parser.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/parser.c (.../branches/gcc-4_8-branch) -@@ -6421,10 +6421,6 @@ - /* Look for the `~'. */ - cp_parser_require (parser, CPP_COMPL, RT_COMPL); - -- /* Once we see the ~, this has to be a pseudo-destructor. */ -- if (!processing_template_decl && !cp_parser_error_occurred (parser)) -- cp_parser_commit_to_tentative_parse (parser); -- - /* Look for the type-name again. We are not responsible for - checking that it matches the first type-name. */ - *type = cp_parser_nonclass_name (parser); -@@ -14168,25 +14164,7 @@ - /* Look up the type-name. */ - type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location); - -- if (TREE_CODE (type_decl) == USING_DECL) -- { -- if (!DECL_DEPENDENT_P (type_decl)) -- type_decl = strip_using_decl (type_decl); -- else if (USING_DECL_TYPENAME_P (type_decl)) -- { -- /* We have found a type introduced by a using -- declaration at class scope that refers to a dependent -- type. -- -- using typename :: [opt] nested-name-specifier unqualified-id ; -- */ -- type_decl = make_typename_type (TREE_TYPE (type_decl), -- DECL_NAME (type_decl), -- typename_type, tf_error); -- if (type_decl != error_mark_node) -- type_decl = TYPE_NAME (type_decl); -- } -- } -+ type_decl = strip_using_decl (type_decl); - - if (TREE_CODE (type_decl) != TYPE_DECL - && (objc_is_id (identifier) || objc_is_class_name (identifier))) -@@ -14742,7 +14720,8 @@ - { - underlying_type = grokdeclarator (NULL, &type_specifiers, TYPENAME, - /*initialized=*/0, NULL); -- if (underlying_type == error_mark_node) -+ if (underlying_type == error_mark_node -+ || check_for_bare_parameter_packs (underlying_type)) - underlying_type = NULL_TREE; - } - } -@@ -22209,6 +22188,9 @@ - tree cast; - bool nonconst_p; - -+ if (!type) -+ type = error_mark_node; -+ - if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) - { - maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS); -@@ -22576,6 +22558,9 @@ - && CONSTRUCTOR_IS_DIRECT_INIT (parsed_arg)) - flags = LOOKUP_NORMAL; - parsed_arg = digest_init_flags (TREE_TYPE (decl), parsed_arg, flags); -+ if (TREE_CODE (parsed_arg) == TARGET_EXPR) -+ /* This represents the whole initialization. */ -+ TARGET_EXPR_DIRECT_INIT_P (parsed_arg) = true; - } - } - -Index: gcc/cp/call.c -=================================================================== ---- a/src/gcc/cp/call.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/call.c (.../branches/gcc-4_8-branch) -@@ -892,6 +892,9 @@ - - if (i < CONSTRUCTOR_NELTS (ctor)) - val = CONSTRUCTOR_ELT (ctor, i)->value; -+ else if (TREE_CODE (ftype) == REFERENCE_TYPE) -+ /* Value-initialization of reference is ill-formed. */ -+ return NULL; - else - { - if (empty_ctor == NULL_TREE) -@@ -5806,9 +5809,11 @@ - && convs->kind != ck_ambig - && (convs->kind != ck_ref_bind - || convs->user_conv_p) -- && convs->kind != ck_rvalue -+ && (convs->kind != ck_rvalue -+ || SCALAR_TYPE_P (totype)) - && convs->kind != ck_base) - { -+ bool complained = false; - conversion *t = convs; - - /* Give a helpful error if this is bad because of excess braces. */ -@@ -5816,7 +5821,14 @@ - && SCALAR_TYPE_P (totype) - && CONSTRUCTOR_NELTS (expr) > 0 - && BRACE_ENCLOSED_INITIALIZER_P (CONSTRUCTOR_ELT (expr, 0)->value)) -- permerror (loc, "too many braces around initializer for %qT", totype); +- expression = BASELINK_FUNCTIONS (expression); + { -+ complained = true; -+ permerror (loc, "too many braces around initializer " -+ "for %qT", totype); -+ while (BRACE_ENCLOSED_INITIALIZER_P (expr) -+ && CONSTRUCTOR_NELTS (expr) == 1) -+ expr = CONSTRUCTOR_ELT (expr, 0)->value; ++ if (BASELINK_OPTYPE (expression) ++ && dependent_type_p (BASELINK_OPTYPE (expression))) ++ return true; ++ expression = BASELINK_FUNCTIONS (expression); + } - for (; t ; t = next_conversion (t)) + if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) { -@@ -5853,8 +5865,9 @@ - break; - } - -- permerror (loc, "invalid conversion from %qT to %qT", -- TREE_TYPE (expr), totype); -+ if (!complained) -+ permerror (loc, "invalid conversion from %qT to %qT", -+ TREE_TYPE (expr), totype); - if (fn) - permerror (DECL_SOURCE_LOCATION (fn), - " initializing argument %P of %qD", argnum, fn); -@@ -5999,6 +6012,8 @@ - to avoid the error about taking the address of a temporary. */ - array = cp_build_addr_expr (array, complain); - array = cp_convert (build_pointer_type (elttype), array, complain); -+ if (array == error_mark_node) -+ return error_mark_node; - - /* Build up the initializer_list object. */ - totype = complete_type (totype); -@@ -6023,8 +6038,11 @@ - return fold_if_not_in_template (expr); - } - expr = reshape_init (totype, expr, complain); -- return get_target_expr_sfinae (digest_init (totype, expr, complain), -+ expr = get_target_expr_sfinae (digest_init (totype, expr, complain), - complain); -+ if (expr != error_mark_node) -+ TARGET_EXPR_LIST_INIT_P (expr) = true; -+ return expr; - - default: - break; -@@ -7414,7 +7432,7 @@ - struct z_candidate *candidates = 0, *cand; - tree explicit_targs = NULL_TREE; - tree basetype = NULL_TREE; -- tree access_binfo; -+ tree access_binfo, binfo; - tree optype; - tree first_mem_arg = NULL_TREE; - tree instance_ptr; -@@ -7454,6 +7472,7 @@ - if (!conversion_path) - conversion_path = BASELINK_BINFO (fns); - access_binfo = BASELINK_ACCESS_BINFO (fns); -+ binfo = BASELINK_BINFO (fns); - optype = BASELINK_OPTYPE (fns); - fns = BASELINK_FUNCTIONS (fns); - if (TREE_CODE (fns) == TEMPLATE_ID_EXPR) -@@ -7697,13 +7716,13 @@ - { - /* Optimize away vtable lookup if we know that this - function can't be overridden. We need to check if -- the context and the instance type are the same, -+ the context and the type where we found fn are the same, - actually FN might be defined in a different class - type because of a using-declaration. In this case, we - do not want to perform a non-virtual call. */ - if (DECL_VINDEX (fn) && ! (flags & LOOKUP_NONVIRTUAL) - && same_type_ignoring_top_level_qualifiers_p -- (DECL_CONTEXT (fn), TREE_TYPE (instance)) -+ (DECL_CONTEXT (fn), BINFO_TYPE (binfo)) - && resolves_to_fixed_type_p (instance, 0)) - flags |= LOOKUP_NONVIRTUAL; - if (explicit_targs) -Index: gcc/cp/cvt.c -=================================================================== ---- a/src/gcc/cp/cvt.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/cvt.c (.../branches/gcc-4_8-branch) -@@ -203,13 +203,13 @@ - - if (null_ptr_cst_p (expr)) - { -- if (complain & tf_warning) -- maybe_warn_zero_as_null_pointer_constant (expr, loc); -- - if (TYPE_PTRMEMFUNC_P (type)) - return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0, - /*c_cast_p=*/false, complain); - -+ if (complain & tf_warning) -+ maybe_warn_zero_as_null_pointer_constant (expr, loc); -+ - /* A NULL pointer-to-data-member is represented by -1, not by - zero. */ - tree val = (TYPE_PTRDATAMEM_P (type) -@@ -743,6 +743,7 @@ - unspecified. */ - if ((complain & tf_warning) - && TREE_CODE (e) == INTEGER_CST -+ && ENUM_UNDERLYING_TYPE (type) - && !int_fits_type_p (e, ENUM_UNDERLYING_TYPE (type))) - warning_at (loc, OPT_Wconversion, - "the result of the conversion is unspecified because " -Index: gcc/cp/mangle.c -=================================================================== ---- a/src/gcc/cp/mangle.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/mangle.c (.../branches/gcc-4_8-branch) -@@ -3478,6 +3478,7 @@ - - if (G.need_abi_warning - /* Don't do this for a fake symbol we aren't going to emit anyway. */ -+ && TREE_CODE (decl) != TYPE_DECL - && !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl) - && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)) - { -@@ -3773,7 +3774,8 @@ - static void - write_guarded_var_name (const tree variable) - { -- if (strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0) -+ if (DECL_NAME (variable) -+ && strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0) - /* The name of a guard variable for a reference temporary should refer - to the reference, not the temporary. */ - write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4); -Index: gcc/cp/cp-tree.h -=================================================================== ---- a/src/gcc/cp/cp-tree.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/cp-tree.h (.../branches/gcc-4_8-branch) -@@ -344,7 +344,8 @@ - /* Returns true iff NODE is a BASELINK. */ - #define BASELINK_P(NODE) \ - (TREE_CODE (NODE) == BASELINK) --/* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */ -+/* The BINFO indicating the base in which lookup found the -+ BASELINK_FUNCTIONS. */ - #define BASELINK_BINFO(NODE) \ - (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo) - /* The functions referred to by the BASELINK; either a FUNCTION_DECL, -Index: gcc/cp/name-lookup.c -=================================================================== ---- a/src/gcc/cp/name-lookup.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cp/name-lookup.c (.../branches/gcc-4_8-branch) -@@ -394,7 +394,8 @@ - } - } - --/* Strip non dependent using declarations. */ -+/* Strip non dependent using declarations. If DECL is dependent, -+ surreptitiously create a typename_type and return it. */ - - tree - strip_using_decl (tree decl) -@@ -404,6 +405,23 @@ - - while (TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl)) - decl = USING_DECL_DECLS (decl); -+ -+ if (TREE_CODE (decl) == USING_DECL && DECL_DEPENDENT_P (decl) -+ && USING_DECL_TYPENAME_P (decl)) -+ { -+ /* We have found a type introduced by a using -+ declaration at class scope that refers to a dependent -+ type. -+ -+ using typename :: [opt] nested-name-specifier unqualified-id ; -+ */ -+ decl = make_typename_type (TREE_TYPE (decl), -+ DECL_NAME (decl), -+ typename_type, tf_error); -+ if (decl != error_mark_node) -+ decl = TYPE_NAME (decl); -+ } -+ - return decl; - } - -@@ -5605,9 +5623,9 @@ - push_using_directive (tree used) - { - tree ret; -- timevar_start (TV_NAME_LOOKUP); -+ bool subtime = timevar_cond_start (TV_NAME_LOOKUP); - ret = push_using_directive_1 (used); -- timevar_stop (TV_NAME_LOOKUP); -+ timevar_cond_stop (TV_NAME_LOOKUP, subtime); - return ret; - } - -Index: gcc/builtins.def -=================================================================== ---- a/src/gcc/builtins.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/builtins.def (.../branches/gcc-4_8-branch) -@@ -252,6 +252,9 @@ - DEF_LIB_BUILTIN (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) - DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSF, "fabsf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST) - DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSL, "fabsl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) -+DEF_GCC_BUILTIN (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST) -+DEF_GCC_BUILTIN (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST) -+DEF_GCC_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST) - DEF_C99_BUILTIN (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) - DEF_C99_BUILTIN (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) - DEF_C99_BUILTIN (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) -Index: gcc/mode-switching.c +Index: gcc/double-int.c =================================================================== ---- a/src/gcc/mode-switching.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/mode-switching.c (.../branches/gcc-4_8-branch) -@@ -568,12 +568,15 @@ - - info[bb->index].computing = last_mode; - /* Check for blocks without ANY mode requirements. -- N.B. because of MODE_AFTER, last_mode might still be different -- from no_mode. */ -+ N.B. because of MODE_AFTER, last_mode might still -+ be different from no_mode, in which case we need to -+ mark the block as nontransparent. */ - if (!any_set_required) - { - ptr = new_seginfo (no_mode, BB_END (bb), bb->index, live_now); - add_seginfo (info + bb->index, ptr); -+ if (last_mode != no_mode) -+ bitmap_clear_bit (transp[bb->index], j); - } - } - #if defined (MODE_ENTRY) && defined (MODE_EXIT) -Index: gcc/ipa-pure-const.c -=================================================================== ---- a/src/gcc/ipa-pure-const.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ipa-pure-const.c (.../branches/gcc-4_8-branch) -@@ -588,7 +588,7 @@ - /* Wrapper around check_decl for loads in local more. */ - - static bool --check_load (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+check_load (gimple, tree op, tree, void *data) - { - if (DECL_P (op)) - check_decl ((funct_state)data, op, false, false); -@@ -600,7 +600,7 @@ - /* Wrapper around check_decl for stores in local more. */ - - static bool --check_store (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+check_store (gimple, tree op, tree, void *data) - { - if (DECL_P (op)) - check_decl ((funct_state)data, op, true, false); -@@ -612,7 +612,7 @@ - /* Wrapper around check_decl for loads in ipa mode. */ - - static bool --check_ipa_load (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+check_ipa_load (gimple, tree op, tree, void *data) - { - if (DECL_P (op)) - check_decl ((funct_state)data, op, false, true); -@@ -624,7 +624,7 @@ - /* Wrapper around check_decl for stores in ipa mode. */ - - static bool --check_ipa_store (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+check_ipa_store (gimple, tree op, tree, void *data) - { - if (DECL_P (op)) - check_decl ((funct_state)data, op, true, true); -Index: gcc/cse.c -=================================================================== ---- a/src/gcc/cse.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cse.c (.../branches/gcc-4_8-branch) -@@ -1824,7 +1824,7 @@ - } - } - --/* Function called for each rtx to check whether true dependence exist. */ -+/* Function called for each rtx to check whether an anti dependence exist. */ - struct check_dependence_data - { - enum machine_mode mode; -@@ -1837,7 +1837,7 @@ - { - struct check_dependence_data *d = (struct check_dependence_data *) data; - if (*x && MEM_P (*x)) -- return canon_true_dependence (d->exp, d->mode, d->addr, *x, NULL_RTX); -+ return canon_anti_dependence (*x, true, d->exp, d->mode, d->addr); - else - return 0; - } -@@ -6082,6 +6082,18 @@ - return x; - } - -+ case UNSIGNED_FLOAT: -+ { -+ rtx new_rtx = cse_process_notes (XEXP (x, 0), object, changed); -+ /* We don't substitute negative VOIDmode constants into these rtx, -+ since they would impede folding. */ -+ if (GET_MODE (new_rtx) != VOIDmode -+ || (CONST_INT_P (new_rtx) && INTVAL (new_rtx) >= 0) -+ || (CONST_DOUBLE_P (new_rtx) && CONST_DOUBLE_HIGH (new_rtx) >= 0)) -+ validate_change (object, &XEXP (x, 0), new_rtx, 0); -+ return x; -+ } -+ - case REG: - i = REG_QTY (REGNO (x)); - +--- a/src/gcc/double-int.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/double-int.c (.../branches/gcc-4_8-branch) +@@ -616,7 +616,7 @@ + == (unsigned HOST_WIDE_INT) htwice) + && (labs_den <= ltwice))) + { +- if (*hquo < 0) ++ if (quo_neg) + /* quo = quo - 1; */ + add_double (*lquo, *hquo, + (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo); Index: gcc/tree-ssa-math-opts.c =================================================================== ---- a/src/gcc/tree-ssa-math-opts.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/tree-ssa-math-opts.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/tree-ssa-math-opts.c (.../branches/gcc-4_8-branch) -@@ -1718,7 +1718,9 @@ - - if (rhs_class == GIMPLE_BINARY_RHS) - { -+ int i; - struct symbolic_number n1, n2; -+ unsigned HOST_WIDEST_INT mask; - tree source_expr2; - - if (code != BIT_IOR_EXPR) -@@ -1744,6 +1746,15 @@ - return NULL_TREE; - - n->size = n1.size; -+ for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT) -+ { -+ unsigned HOST_WIDEST_INT masked1, masked2; -+ -+ masked1 = n1.n & mask; -+ masked2 = n2.n & mask; -+ if (masked1 && masked2 && masked1 != masked2) -+ return NULL_TREE; -+ } - n->n = n1.n | n2.n; - - if (!verify_symbolic_number_p (n, stmt)) -Index: gcc/sel-sched.c -=================================================================== ---- a/src/gcc/sel-sched.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/sel-sched.c (.../branches/gcc-4_8-branch) -@@ -1253,7 +1253,7 @@ - - if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) - add_to_hard_reg_set (®_rename_p->unavailable_hard_regs, -- Pmode, HARD_FRAME_POINTER_IS_FRAME_POINTER); -+ Pmode, HARD_FRAME_POINTER_REGNUM); - } - - #ifdef STACK_REGS -Index: gcc/gimple-low.c -=================================================================== ---- a/src/gcc/gimple-low.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gimple-low.c (.../branches/gcc-4_8-branch) -@@ -238,6 +238,7 @@ - break; - arg = gimple_call_arg (stmt, i); - if (p == error_mark_node -+ || DECL_ARG_TYPE (p) == error_mark_node - || arg == error_mark_node - || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg)) - && !fold_convertible_p (DECL_ARG_TYPE (p), arg))) -Index: gcc/tree-ssa-sink.c -=================================================================== ---- a/src/gcc/tree-ssa-sink.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-sink.c (.../branches/gcc-4_8-branch) -@@ -559,7 +559,7 @@ - execute_sink_code (void) - { - loop_optimizer_init (LOOPS_NORMAL); -- -+ split_critical_edges (); - connect_infinite_loops_to_exit (); - memset (&sink_stats, 0, sizeof (sink_stats)); - calculate_dominance_info (CDI_DOMINATORS); -Index: gcc/config.in -=================================================================== ---- a/src/gcc/config.in (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config.in (.../branches/gcc-4_8-branch) -@@ -363,6 +363,12 @@ - #endif - - -+/* Define if your assembler supports the 'ud2' mnemonic. */ -+#ifndef USED_FOR_TARGET -+#undef HAVE_AS_IX86_UD2 -+#endif -+ -+ - /* Define if your assembler supports the lituse_jsrdirect relocation. */ - #ifndef USED_FOR_TARGET - #undef HAVE_AS_JSRDIRECT_RELOCS -@@ -375,6 +381,12 @@ - #endif - - -+/* Define if your assembler supports LEON instructions. */ -+#ifndef USED_FOR_TARGET -+#undef HAVE_AS_LEON -+#endif -+ -+ - /* Define if the assembler won't complain about a line such as # 0 "" 2. */ - #ifndef USED_FOR_TARGET - #undef HAVE_AS_LINE_ZERO -Index: gcc/ifcvt.c -=================================================================== ---- a/src/gcc/ifcvt.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ifcvt.c (.../branches/gcc-4_8-branch) -@@ -115,7 +115,11 @@ - - while (1) - { -- if (CALL_P (insn) || NONJUMP_INSN_P (insn)) -+ if ((CALL_P (insn) || NONJUMP_INSN_P (insn)) -+ /* Don't count USE/CLOBBER insns, flow_find_cross_jump etc. -+ don't count them either and we need consistency. */ -+ && GET_CODE (PATTERN (insn)) != USE -+ && GET_CODE (PATTERN (insn)) != CLOBBER) - count++; - - if (insn == BB_END (bb)) -@@ -505,7 +509,10 @@ - n_insns -= 2 * n_matching; - } - -- if (then_start && else_start) -+ if (then_start -+ && else_start -+ && then_n_insns > n_matching -+ && else_n_insns > n_matching) - { - int longest_match = MIN (then_n_insns - n_matching, - else_n_insns - n_matching); -Index: gcc/expr.c -=================================================================== ---- a/src/gcc/expr.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/expr.c (.../branches/gcc-4_8-branch) -@@ -1994,12 +1994,14 @@ - HOST_WIDE_INT bytepos = INTVAL (XEXP (XVECEXP (src, 0, i), 1)); - enum machine_mode mode = GET_MODE (tmps[i]); - unsigned int bytelen = GET_MODE_SIZE (mode); -- unsigned int adj_bytelen = bytelen; -+ unsigned int adj_bytelen; - rtx dest = dst; - - /* Handle trailing fragments that run over the size of the struct. */ - if (ssize >= 0 && bytepos + (HOST_WIDE_INT) bytelen > ssize) - adj_bytelen = ssize - bytepos; -+ else -+ adj_bytelen = bytelen; - - if (GET_CODE (dst) == CONCAT) - { -@@ -2040,6 +2042,7 @@ - } - } - -+ /* Handle trailing fragments that run over the size of the struct. */ - if (ssize >= 0 && bytepos + (HOST_WIDE_INT) bytelen > ssize) - { - /* store_bit_field always takes its value from the lsb. -@@ -2057,16 +2060,22 @@ - tmps[i] = expand_shift (RSHIFT_EXPR, mode, tmps[i], - shift, tmps[i], 0); - } -- bytelen = adj_bytelen; -+ -+ /* Make sure not to write past the end of the struct. */ -+ store_bit_field (dest, -+ adj_bytelen * BITS_PER_UNIT, bytepos * BITS_PER_UNIT, -+ bytepos * BITS_PER_UNIT, ssize * BITS_PER_UNIT - 1, -+ VOIDmode, tmps[i]); - } - - /* Optimize the access just a bit. */ -- if (MEM_P (dest) -- && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (dest)) -- || MEM_ALIGN (dest) >= GET_MODE_ALIGNMENT (mode)) -- && bytepos * BITS_PER_UNIT % GET_MODE_ALIGNMENT (mode) == 0 -- && bytelen == GET_MODE_SIZE (mode)) -+ else if (MEM_P (dest) -+ && (!SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (dest)) -+ || MEM_ALIGN (dest) >= GET_MODE_ALIGNMENT (mode)) -+ && bytepos * BITS_PER_UNIT % GET_MODE_ALIGNMENT (mode) == 0 -+ && bytelen == GET_MODE_SIZE (mode)) - emit_move_insn (adjust_address (dest, mode, bytepos), tmps[i]); -+ - else - store_bit_field (dest, bytelen * BITS_PER_UNIT, bytepos * BITS_PER_UNIT, - 0, 0, mode, tmps[i]); -@@ -3602,12 +3611,21 @@ - into a new pseudo. This constant may be used in different modes, - and if not, combine will put things back together for us. */ - trunc_y = force_reg (srcmode, trunc_y); -- emit_unop_insn (ic, x, trunc_y, UNKNOWN); -+ -+ /* If x is a hard register, perform the extension into a pseudo, -+ so that e.g. stack realignment code is aware of it. */ -+ rtx target = x; -+ if (REG_P (x) && HARD_REGISTER_P (x)) -+ target = gen_reg_rtx (dstmode); -+ -+ emit_unop_insn (ic, target, trunc_y, UNKNOWN); - last_insn = get_last_insn (); - -- if (REG_P (x)) -+ if (REG_P (target)) - set_unique_reg_note (last_insn, REG_EQUAL, y); - -+ if (target != x) -+ return emit_move_insn (x, target); - return last_insn; - } - -@@ -4551,19 +4569,19 @@ - - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1)); - - /* If the adjustment is larger than bitpos, we would have a negative bit -- position for the lower bound and this may wreak havoc later. This can -- occur only if we have a non-null offset, so adjust offset and bitpos -- to make the lower bound non-negative. */ -+ position for the lower bound and this may wreak havoc later. Adjust -+ offset and bitpos to make the lower bound non-negative in that case. */ - if (bitoffset > *bitpos) - { - HOST_WIDE_INT adjust = bitoffset - *bitpos; -- - gcc_assert ((adjust % BITS_PER_UNIT) == 0); -- gcc_assert (*offset != NULL_TREE); - - *bitpos += adjust; -- *offset -- = size_binop (MINUS_EXPR, *offset, size_int (adjust / BITS_PER_UNIT)); -+ if (*offset == NULL_TREE) -+ *offset = size_int (-adjust / BITS_PER_UNIT); -+ else -+ *offset -+ = size_binop (MINUS_EXPR, *offset, size_int (adjust / BITS_PER_UNIT)); - *bitstart = 0; - } - else -@@ -4668,8 +4686,7 @@ - expand_insn (icode, 2, ops); - } - else -- store_bit_field (mem, GET_MODE_BITSIZE (mode), -- 0, 0, 0, mode, reg); -+ store_bit_field (mem, GET_MODE_BITSIZE (mode), 0, 0, 0, mode, reg); - return; - } - -@@ -4698,6 +4715,15 @@ - tem = get_inner_reference (to, &bitsize, &bitpos, &offset, &mode1, - &unsignedp, &volatilep, true); - -+ /* Make sure bitpos is not negative, it can wreak havoc later. */ -+ if (bitpos < 0) -+ { -+ gcc_assert (offset == NULL_TREE); -+ offset = size_int (bitpos >> (BITS_PER_UNIT == 8 -+ ? 3 : exact_log2 (BITS_PER_UNIT))); -+ bitpos &= BITS_PER_UNIT - 1; -+ } -+ - if (TREE_CODE (to) == COMPONENT_REF - && DECL_BIT_FIELD_TYPE (TREE_OPERAND (to, 1))) - get_bit_range (&bitregion_start, &bitregion_end, to, &bitpos, &offset); -Index: gcc/expr.h -=================================================================== ---- a/src/gcc/expr.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/expr.h (.../branches/gcc-4_8-branch) -@@ -521,8 +521,8 @@ - rtx, int); - #endif - --extern void locate_and_pad_parm (enum machine_mode, tree, int, int, tree, -- struct args_size *, -+extern void locate_and_pad_parm (enum machine_mode, tree, int, int, int, -+ tree, struct args_size *, - struct locate_and_pad_arg_data *); - - /* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary. */ -Index: gcc/go/go-gcc.cc -=================================================================== ---- a/src/gcc/go/go-gcc.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/go-gcc.cc (.../branches/gcc-4_8-branch) -@@ -232,6 +232,9 @@ - Bexpression* - convert_expression(Btype* type, Bexpression* expr, Location); - -+ Bexpression* -+ function_code_expression(Bfunction*, Location); -+ - // Statements. - - Bstatement* -@@ -334,6 +337,17 @@ - Bexpression* - label_address(Blabel*, Location); - -+ // Functions. -+ -+ Bfunction* -+ error_function() -+ { return this->make_function(error_mark_node); } -+ -+ Bfunction* -+ function(Btype* fntype, const std::string& name, const std::string& asm_name, -+ bool is_visible, bool is_declaration, bool is_inlinable, -+ bool disable_split_stack, bool in_unique_section, Location); -+ - private: - // Make a Bexpression from a tree. - Bexpression* -@@ -350,6 +364,10 @@ - make_type(tree t) - { return new Btype(t); } - -+ Bfunction* -+ make_function(tree t) -+ { return new Bfunction(t); } -+ - Btype* - fill_in_struct(Btype*, const std::vector<Btyped_identifier>&); - -@@ -966,6 +984,19 @@ - return tree_to_expr(ret); - } - -+// Get the address of a function. -+ -+Bexpression* -+Gcc_backend::function_code_expression(Bfunction* bfunc, Location location) -+{ -+ tree func = bfunc->get_tree(); -+ if (func == error_mark_node) -+ return this->error_expression(); -+ -+ tree ret = build_fold_addr_expr_loc(location.gcc_location(), func); -+ return this->make_expression(ret); -+} -+ - // An expression as a statement. - - Bstatement* -@@ -1724,6 +1755,56 @@ - return this->make_expression(ret); - } - -+// Declare or define a new function. -+ -+Bfunction* -+Gcc_backend::function(Btype* fntype, const std::string& name, -+ const std::string& asm_name, bool is_visible, -+ bool is_declaration, bool is_inlinable, -+ bool disable_split_stack, bool in_unique_section, -+ Location location) -+{ -+ tree functype = fntype->get_tree(); -+ if (functype != error_mark_node) -+ { -+ gcc_assert(FUNCTION_POINTER_TYPE_P(functype)); -+ functype = TREE_TYPE(functype); -+ } -+ tree id = get_identifier_from_string(name); -+ if (functype == error_mark_node || id == error_mark_node) -+ return this->error_function(); -+ -+ tree decl = build_decl(location.gcc_location(), FUNCTION_DECL, id, functype); -+ if (!asm_name.empty()) -+ SET_DECL_ASSEMBLER_NAME(decl, get_identifier_from_string(asm_name)); -+ if (is_visible) -+ TREE_PUBLIC(decl) = 1; -+ if (is_declaration) -+ DECL_EXTERNAL(decl) = 1; -+ else -+ { -+ tree restype = TREE_TYPE(functype); -+ tree resdecl = -+ build_decl(location.gcc_location(), RESULT_DECL, NULL_TREE, restype); -+ DECL_ARTIFICIAL(resdecl) = 1; -+ DECL_IGNORED_P(resdecl) = 1; -+ DECL_CONTEXT(resdecl) = decl; -+ DECL_RESULT(decl) = resdecl; -+ } -+ if (!is_inlinable) -+ DECL_UNINLINABLE(decl) = 1; -+ if (disable_split_stack) -+ { -+ tree attr = get_identifier("__no_split_stack__"); -+ DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); -+ } -+ if (in_unique_section) -+ resolve_unique_section(decl, 0, 1); -+ -+ go_preserve_from_gc(decl); -+ return new Bfunction(decl); -+} -+ - // The single backend. - - static Gcc_backend gcc_backend; -@@ -1799,3 +1880,9 @@ - { - return bv->get_tree(); - } -+ -+tree -+function_to_tree(Bfunction* bf) -+{ -+ return bf->get_tree(); -+} -Index: gcc/go/ChangeLog -=================================================================== ---- a/src/gcc/go/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,22 @@ -+2013-12-11 Ian Lance Taylor <iant@google.com> -+ -+ * go-lang.c (go_langhook_post_options): Disable sibling calls by -+ default. -+ -+2013-10-16 Ian Lance Taylor <iant@google.com> -+ -+ Bring in from mainline: -+ -+ 2013-10-11 Chris Manghane <cmang@google.com> -+ * go-gcc.cc (Gcc_backend::function_code_expression): New -+ function. -+ -+ 2013-10-10 Chris Manghane <cmang@google.com> -+ * go-gcc.cc (Backend::error_function): New function. -+ (Backend::function): New function. -+ (Backend::make_function): New function. -+ (function_to_tree): New function. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: gcc/go/go-lang.c -=================================================================== ---- a/src/gcc/go/go-lang.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/go-lang.c (.../branches/gcc-4_8-branch) -@@ -269,6 +269,10 @@ - if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; - -+ /* Tail call optimizations can confuse uses of runtime.Callers. */ -+ if (!global_options_set.x_flag_optimize_sibling_calls) -+ global_options.x_flag_optimize_sibling_calls = 0; -+ - /* Returning false means that the backend should be used. */ - return false; - } -Index: gcc/go/gofrontend/gogo.cc -=================================================================== ---- a/src/gcc/go/gofrontend/gogo.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/gogo.cc (.../branches/gcc-4_8-branch) -@@ -2822,7 +2822,10 @@ - if (orig_fntype->is_varargs()) - new_fntype->set_is_varargs(); - -- std::string name = orig_no->name() + "$recover"; -+ std::string name = orig_no->name(); -+ if (orig_fntype->is_method()) -+ name += "$" + orig_fntype->receiver()->type()->mangled_name(gogo); -+ name += "$recover"; - Named_object *new_no = gogo->start_function(name, new_fntype, false, - location); - Function *new_func = new_no->func_value(); -@@ -2916,7 +2919,25 @@ - && !orig_rec_no->var_value()->is_receiver()); - orig_rec_no->var_value()->set_is_receiver(); - -- const std::string& new_receiver_name(orig_fntype->receiver()->name()); -+ std::string new_receiver_name(orig_fntype->receiver()->name()); -+ if (new_receiver_name.empty()) -+ { -+ // Find the receiver. It was named "r.NNN" in -+ // Gogo::start_function. -+ for (Bindings::const_definitions_iterator p = -+ new_bindings->begin_definitions(); -+ p != new_bindings->end_definitions(); -+ ++p) -+ { -+ const std::string& pname((*p)->name()); -+ if (pname[0] == 'r' && pname[1] == '.') -+ { -+ new_receiver_name = pname; -+ break; -+ } -+ } -+ go_assert(!new_receiver_name.empty()); -+ } - Named_object* new_rec_no = new_bindings->lookup_local(new_receiver_name); - if (new_rec_no == NULL) - go_assert(saw_errors()); -@@ -3320,7 +3341,8 @@ - closure_var_(NULL), block_(block), location_(location), labels_(), - local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL), - is_sink_(false), results_are_named_(false), nointerface_(false), -- calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false), -+ is_unnamed_type_stub_method_(false), calls_recover_(false), -+ is_recover_thunk_(false), has_recover_thunk_(false), - in_unique_section_(false) - { - } -@@ -3819,6 +3841,81 @@ - *presults = results; - } - -+// Get the backend representation. -+ -+Bfunction* -+Function::get_or_make_decl(Gogo* gogo, Named_object* no) -+{ -+ if (this->fndecl_ == NULL) -+ { -+ std::string asm_name; -+ bool is_visible = false; -+ if (no->package() != NULL) -+ ; -+ else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) -+ ; -+ else if (Gogo::unpack_hidden_name(no->name()) == "init" -+ && !this->type_->is_method()) -+ ; -+ else if (Gogo::unpack_hidden_name(no->name()) == "main" -+ && gogo->is_main_package()) -+ is_visible = true; -+ // Methods have to be public even if they are hidden because -+ // they can be pulled into type descriptors when using -+ // anonymous fields. -+ else if (!Gogo::is_hidden_name(no->name()) -+ || this->type_->is_method()) -+ { -+ if (!this->is_unnamed_type_stub_method_) -+ is_visible = true; -+ std::string pkgpath = gogo->pkgpath_symbol(); -+ if (this->type_->is_method() -+ && Gogo::is_hidden_name(no->name()) -+ && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) -+ { -+ // This is a method we created for an unexported -+ // method of an imported embedded type. We need to -+ // use the pkgpath of the imported package to avoid -+ // a possible name collision. See bug478 for a test -+ // case. -+ pkgpath = Gogo::hidden_name_pkgpath(no->name()); -+ pkgpath = Gogo::pkgpath_for_symbol(pkgpath); -+ } -+ -+ asm_name = pkgpath; -+ asm_name.append(1, '.'); -+ asm_name.append(Gogo::unpack_hidden_name(no->name())); -+ if (this->type_->is_method()) -+ { -+ asm_name.append(1, '.'); -+ Type* rtype = this->type_->receiver()->type(); -+ asm_name.append(rtype->mangled_name(gogo)); -+ } -+ } -+ -+ // If a function calls the predeclared recover function, we -+ // can't inline it, because recover behaves differently in a -+ // function passed directly to defer. If this is a recover -+ // thunk that we built to test whether a function can be -+ // recovered, we can't inline it, because that will mess up -+ // our return address comparison. -+ bool is_inlinable = !(this->calls_recover_ || this->is_recover_thunk_); -+ -+ // If this is a thunk created to call a function which calls -+ // the predeclared recover function, we need to disable -+ // stack splitting for the thunk. -+ bool disable_split_stack = this->is_recover_thunk_; -+ -+ Btype* functype = this->type_->get_backend_fntype(gogo); -+ this->fndecl_ = -+ gogo->backend()->function(functype, no->get_id(gogo), asm_name, -+ is_visible, false, is_inlinable, -+ disable_split_stack, -+ this->in_unique_section_, this->location()); -+ } -+ return this->fndecl_; -+} -+ - // Class Block. - - Block::Block(Block* enclosing, Location location) -@@ -5110,6 +5207,75 @@ - go_unreachable(); - } - -+ -+// Return the external identifier for this object. -+ -+std::string -+Named_object::get_id(Gogo* gogo) -+{ -+ go_assert(!this->is_variable() && !this->is_result_variable()); -+ std::string decl_name; -+ if (this->is_function_declaration() -+ && !this->func_declaration_value()->asm_name().empty()) -+ decl_name = this->func_declaration_value()->asm_name(); -+ else if (this->is_type() -+ && Linemap::is_predeclared_location(this->type_value()->location())) -+ { -+ // We don't need the package name for builtin types. -+ decl_name = Gogo::unpack_hidden_name(this->name_); -+ } -+ else -+ { -+ std::string package_name; -+ if (this->package_ == NULL) -+ package_name = gogo->package_name(); -+ else -+ package_name = this->package_->package_name(); -+ -+ // Note that this will be misleading if this is an unexported -+ // method generated for an embedded imported type. In that case -+ // the unexported method should have the package name of the -+ // package from which it is imported, but we are going to give -+ // it our package name. Fixing this would require knowing the -+ // package name, but we only know the package path. It might be -+ // better to use package paths here anyhow. This doesn't affect -+ // the assembler code, because we always set that name in -+ // Function::get_or_make_decl anyhow. FIXME. -+ -+ decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); -+ -+ Function_type* fntype; -+ if (this->is_function()) -+ fntype = this->func_value()->type(); -+ else if (this->is_function_declaration()) -+ fntype = this->func_declaration_value()->type(); -+ else -+ fntype = NULL; -+ if (fntype != NULL && fntype->is_method()) -+ { -+ decl_name.push_back('.'); -+ decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); -+ } -+ } -+ if (this->is_type()) -+ { -+ unsigned int index; -+ const Named_object* in_function = this->type_value()->in_function(&index); -+ if (in_function != NULL) -+ { -+ decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); -+ if (index > 0) -+ { -+ char buf[30]; -+ snprintf(buf, sizeof buf, "%u", index); -+ decl_name += '$'; -+ decl_name += buf; -+ } -+ } -+ } -+ return decl_name; -+} -+ - // Class Bindings. - - Bindings::Bindings(Bindings* enclosing) -Index: gcc/go/gofrontend/runtime.def -=================================================================== ---- a/src/gcc/go/gofrontend/runtime.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/runtime.def (.../branches/gcc-4_8-branch) -@@ -68,6 +68,12 @@ - P1(STRING), R1(SLICE)) - - -+// Complex division. -+DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", -+ P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) -+DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", -+ P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) -+ - // Make a slice. - DEF_GO_RUNTIME(MAKESLICE1, "__go_make_slice1", P2(TYPE, UINTPTR), R1(SLICE)) - DEF_GO_RUNTIME(MAKESLICE2, "__go_make_slice2", P3(TYPE, UINTPTR, UINTPTR), -Index: gcc/go/gofrontend/gogo.h -=================================================================== ---- a/src/gcc/go/gofrontend/gogo.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/gogo.h (.../branches/gcc-4_8-branch) -@@ -48,6 +48,7 @@ - class Bblock; - class Bvariable; - class Blabel; -+class Bfunction; - - // This file declares the basic classes used to hold the internal - // representation of Go which is built by the parser. -@@ -952,6 +953,15 @@ - this->nointerface_ = true; - } - -+ // Record that this function is a stub method created for an unnamed -+ // type. -+ void -+ set_is_unnamed_type_stub_method() -+ { -+ go_assert(this->is_method()); -+ this->is_unnamed_type_stub_method_ = true; -+ } -+ - // Add a new field to the closure variable. - void - add_closure_field(Named_object* var, Location loc) -@@ -1089,17 +1099,13 @@ - this->descriptor_ = descriptor; - } - -- // Return the function's decl given an identifier. -- tree -- get_or_make_decl(Gogo*, Named_object*, tree id); -+ // Return the backend representation. -+ Bfunction* -+ get_or_make_decl(Gogo*, Named_object*); - - // Return the function's decl after it has been built. - tree -- get_decl() const -- { -- go_assert(this->fndecl_ != NULL); -- return this->fndecl_; -- } -+ get_decl() const; - - // Set the function decl to hold a tree of the function code. - void -@@ -1170,7 +1176,7 @@ - // The function descriptor, if any. - Expression* descriptor_; - // The function decl. -- tree fndecl_; -+ Bfunction* fndecl_; - // The defer stack variable. A pointer to this variable is used to - // distinguish the defer stack for one function from another. This - // is NULL unless we actually need a defer stack. -@@ -1181,6 +1187,9 @@ - bool results_are_named_ : 1; - // True if this method should not be included in the type descriptor. - bool nointerface_ : 1; -+ // True if this function is a stub method created for an unnamed -+ // type. -+ bool is_unnamed_type_stub_method_ : 1; - // True if this function calls the predeclared recover function. - bool calls_recover_ : 1; - // True if this a thunk built for a function which calls recover. -@@ -1265,9 +1274,9 @@ - has_descriptor() const - { return this->descriptor_ != NULL; } - -- // Return a decl for the function given an identifier. -- tree -- get_or_make_decl(Gogo*, Named_object*, tree id); -+ // Return a backend representation. -+ Bfunction* -+ get_or_make_decl(Gogo*, Named_object*); - - // If there is a descriptor, build it into the backend - // representation. -@@ -1290,7 +1299,7 @@ - // The function descriptor, if any. - Expression* descriptor_; - // The function decl if needed. -- tree fndecl_; -+ Bfunction* fndecl_; - }; - - // A variable. -@@ -2181,8 +2190,8 @@ - Bvariable* - get_backend_variable(Gogo*, Named_object* function); - -- // Return a tree for the external identifier for this object. -- tree -+ // Return the external identifier for this object. -+ std::string - get_id(Gogo*); - - // Return a tree representing this object. -Index: gcc/go/gofrontend/types.h -=================================================================== ---- a/src/gcc/go/gofrontend/types.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/types.h (.../branches/gcc-4_8-branch) -@@ -1138,6 +1138,13 @@ - Function_type* equal_fntype, Named_object** hash_fn, - Named_object** equal_fn); - -+ void -+ write_named_hash(Gogo*, Named_type*, Function_type* hash_fntype, -+ Function_type* equal_fntype); -+ -+ void -+ write_named_equal(Gogo*, Named_type*); -+ - // Build a composite literal for the uncommon type information. - Expression* - uncommon_type_constructor(Gogo*, Type* uncommon_type, -@@ -1717,7 +1724,8 @@ - Typed_identifier_list* results, Location location) - : Type(TYPE_FUNCTION), - receiver_(receiver), parameters_(parameters), results_(results), -- location_(location), is_varargs_(false), is_builtin_(false) -+ location_(location), is_varargs_(false), is_builtin_(false), -+ fnbtype_(NULL) - { } - - // Get the receiver. -@@ -1789,6 +1797,12 @@ - Function_type* - copy_with_receiver(Type*) const; - -+ // Return a copy of this type with the receiver treated as the first -+ // parameter. If WANT_POINTER_RECEIVER is true, the receiver is -+ // forced to be a pointer. -+ Function_type* -+ copy_with_receiver_as_param(bool want_pointer_receiver) const; -+ - // Return a copy of this type ignoring any receiver and using dummy - // names for all parameters. This is used for thunks for method - // values. -@@ -1798,6 +1812,11 @@ - static Type* - make_function_type_descriptor_type(); - -+ // Return the backend representation of this function type. This is used -+ // as the real type of a backend function declaration or defintion. -+ Btype* -+ get_backend_fntype(Gogo*); -+ - protected: - int - do_traverse(Traverse*); -@@ -1851,6 +1870,9 @@ - // Whether this is a special builtin function which can not simply - // be called. This is used for len, cap, etc. - bool is_builtin_; -+ // The backend representation of this type for backend function -+ // declarations and definitions. -+ Btype* fnbtype_; - }; - - // The type of a pointer. -@@ -1915,7 +1937,7 @@ - { - public: - explicit Struct_field(const Typed_identifier& typed_identifier) -- : typed_identifier_(typed_identifier), tag_(NULL) -+ : typed_identifier_(typed_identifier), tag_(NULL), is_imported_(false) - { } - - // The field name. -@@ -1926,6 +1948,10 @@ - bool - is_field_name(const std::string& name) const; - -+ // Return whether this struct field is an unexported field named NAME. -+ bool -+ is_unexported_field_name(Gogo*, const std::string& name) const; -+ - // Return whether this struct field is an embedded built-in type. - bool - is_embedded_builtin(Gogo*) const; -@@ -1963,6 +1989,11 @@ - set_tag(const std::string& tag) - { this->tag_ = new std::string(tag); } - -+ // Record that this field is defined in an imported struct. -+ void -+ set_is_imported() -+ { this->is_imported_ = true; } -+ - // Set the type. This is only used in error cases. - void - set_type(Type* type) -@@ -1973,6 +2004,8 @@ - Typed_identifier typed_identifier_; - // The field tag. This is NULL if the field has no tag. - std::string* tag_; -+ // Whether this field is defined in an imported struct. -+ bool is_imported_; - }; - - // A list of struct fields. -Index: gcc/go/gofrontend/parse.cc -=================================================================== ---- a/src/gcc/go/gofrontend/parse.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/parse.cc (.../branches/gcc-4_8-branch) -@@ -744,6 +744,8 @@ - return NULL; - - Parse::Names names; -+ if (receiver != NULL) -+ names[receiver->name()] = receiver; - if (params != NULL) - this->check_signature_names(params, &names); - if (results != NULL) -Index: gcc/go/gofrontend/import.h -=================================================================== ---- a/src/gcc/go/gofrontend/import.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/import.h (.../branches/gcc-4_8-branch) -@@ -149,6 +149,11 @@ - location() const - { return this->location_; } - -+ // Return the package we are importing. -+ Package* -+ package() const -+ { return this->package_; } -+ - // Return the next character. - int - peek_char() -Index: gcc/go/gofrontend/runtime.cc -=================================================================== ---- a/src/gcc/go/gofrontend/runtime.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/runtime.cc (.../branches/gcc-4_8-branch) -@@ -42,6 +42,8 @@ - RFT_RUNE, - // Go type float64, C type double. - RFT_FLOAT64, -+ // Go type complex64, C type __complex float. -+ RFT_COMPLEX64, - // Go type complex128, C type __complex double. - RFT_COMPLEX128, - // Go type string, C type struct __go_string. -@@ -126,6 +128,10 @@ - t = Type::lookup_float_type("float64"); - break; - -+ case RFT_COMPLEX64: -+ t = Type::lookup_complex_type("complex64"); -+ break; -+ - case RFT_COMPLEX128: - t = Type::lookup_complex_type("complex128"); - break; -@@ -216,6 +222,7 @@ - case RFT_UINTPTR: - case RFT_RUNE: - case RFT_FLOAT64: -+ case RFT_COMPLEX64: - case RFT_COMPLEX128: - case RFT_STRING: - case RFT_POINTER: -Index: gcc/go/gofrontend/expressions.h -=================================================================== ---- a/src/gcc/go/gofrontend/expressions.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/expressions.h (.../branches/gcc-4_8-branch) -@@ -1514,8 +1514,8 @@ - closure() - { return this->closure_; } - -- // Return a tree for the code for a function. -- static tree -+ // Return a backend expression for the code of a function. -+ static Bexpression* - get_code_pointer(Gogo*, Named_object* function, Location loc); - - protected: -Index: gcc/go/gofrontend/gogo-tree.cc -=================================================================== ---- a/src/gcc/go/gofrontend/gogo-tree.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/gogo-tree.cc (.../branches/gcc-4_8-branch) -@@ -985,74 +985,6 @@ - delete[] vec; - } - --// Get a tree for the identifier for a named object. -- --tree --Named_object::get_id(Gogo* gogo) --{ -- go_assert(!this->is_variable() && !this->is_result_variable()); -- std::string decl_name; -- if (this->is_function_declaration() -- && !this->func_declaration_value()->asm_name().empty()) -- decl_name = this->func_declaration_value()->asm_name(); -- else if (this->is_type() -- && Linemap::is_predeclared_location(this->type_value()->location())) -- { -- // We don't need the package name for builtin types. -- decl_name = Gogo::unpack_hidden_name(this->name_); -- } -- else -- { -- std::string package_name; -- if (this->package_ == NULL) -- package_name = gogo->package_name(); -- else -- package_name = this->package_->package_name(); -- -- // Note that this will be misleading if this is an unexported -- // method generated for an embedded imported type. In that case -- // the unexported method should have the package name of the -- // package from which it is imported, but we are going to give -- // it our package name. Fixing this would require knowing the -- // package name, but we only know the package path. It might be -- // better to use package paths here anyhow. This doesn't affect -- // the assembler code, because we always set that name in -- // Function::get_or_make_decl anyhow. FIXME. -- -- decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); -- -- Function_type* fntype; -- if (this->is_function()) -- fntype = this->func_value()->type(); -- else if (this->is_function_declaration()) -- fntype = this->func_declaration_value()->type(); -- else -- fntype = NULL; -- if (fntype != NULL && fntype->is_method()) -- { -- decl_name.push_back('.'); -- decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); -- } -- } -- if (this->is_type()) -- { -- unsigned int index; -- const Named_object* in_function = this->type_value()->in_function(&index); -- if (in_function != NULL) -- { -- decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); -- if (index > 0) -- { -- char buf[30]; -- snprintf(buf, sizeof buf, "%u", index); -- decl_name += '$'; -- decl_name += buf; -- } -- } -- } -- return get_identifier_from_string(decl_name); --} -- - // Get a tree for a named object. - - tree -@@ -1067,11 +999,6 @@ - return error_mark_node; - } - -- tree name; -- if (this->classification_ == NAMED_OBJECT_TYPE) -- name = NULL_TREE; -- else -- name = this->get_id(gogo); - tree decl; - switch (this->classification_) - { -@@ -1099,6 +1026,7 @@ - decl = error_mark_node; - else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) - { -+ tree name = get_identifier_from_string(this->get_id(gogo)); - decl = build_decl(named_constant->location().gcc_location(), - CONST_DECL, name, TREE_TYPE(expr_tree)); - DECL_INITIAL(decl) = expr_tree; -@@ -1161,7 +1089,7 @@ - case NAMED_OBJECT_FUNC: - { - Function* func = this->u_.func_value; -- decl = func->get_or_make_decl(gogo, this, name); -+ decl = function_to_tree(func->get_or_make_decl(gogo, this)); - if (decl != error_mark_node) - { - if (func->block() != NULL) -@@ -1286,124 +1214,13 @@ - return block_tree; - } - --// Get a tree for a function decl. -+// Get the backend representation. - --tree --Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) -+Bfunction* -+Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no) - { -- if (this->fndecl_ == NULL_TREE) -+ if (this->fndecl_ == NULL) - { -- tree functype = type_to_tree(this->type_->get_backend(gogo)); -- -- if (functype != error_mark_node) -- { -- // The type of a function comes back as a pointer to a -- // struct whose first field is the function, but we want the -- // real function type for a function declaration. -- go_assert(POINTER_TYPE_P(functype) -- && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); -- functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); -- go_assert(FUNCTION_POINTER_TYPE_P(functype)); -- functype = TREE_TYPE(functype); -- } -- -- if (functype == error_mark_node) -- this->fndecl_ = error_mark_node; -- else -- { -- tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, -- id, functype); -- -- this->fndecl_ = decl; -- -- if (no->package() != NULL) -- ; -- else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) -- ; -- else if (Gogo::unpack_hidden_name(no->name()) == "init" -- && !this->type_->is_method()) -- ; -- else if (Gogo::unpack_hidden_name(no->name()) == "main" -- && gogo->is_main_package()) -- TREE_PUBLIC(decl) = 1; -- // Methods have to be public even if they are hidden because -- // they can be pulled into type descriptors when using -- // anonymous fields. -- else if (!Gogo::is_hidden_name(no->name()) -- || this->type_->is_method()) -- { -- TREE_PUBLIC(decl) = 1; -- std::string pkgpath = gogo->pkgpath_symbol(); -- if (this->type_->is_method() -- && Gogo::is_hidden_name(no->name()) -- && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) -- { -- // This is a method we created for an unexported -- // method of an imported embedded type. We need to -- // use the pkgpath of the imported package to avoid -- // a possible name collision. See bug478 for a test -- // case. -- pkgpath = Gogo::hidden_name_pkgpath(no->name()); -- pkgpath = Gogo::pkgpath_for_symbol(pkgpath); -- } -- -- std::string asm_name = pkgpath; -- asm_name.append(1, '.'); -- asm_name.append(Gogo::unpack_hidden_name(no->name())); -- if (this->type_->is_method()) -- { -- asm_name.append(1, '.'); -- Type* rtype = this->type_->receiver()->type(); -- asm_name.append(rtype->mangled_name(gogo)); -- } -- SET_DECL_ASSEMBLER_NAME(decl, -- get_identifier_from_string(asm_name)); -- } -- -- // Why do we have to do this in the frontend? -- tree restype = TREE_TYPE(functype); -- tree resdecl = -- build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE, -- restype); -- DECL_ARTIFICIAL(resdecl) = 1; -- DECL_IGNORED_P(resdecl) = 1; -- DECL_CONTEXT(resdecl) = decl; -- DECL_RESULT(decl) = resdecl; -- -- // If a function calls the predeclared recover function, we -- // can't inline it, because recover behaves differently in a -- // function passed directly to defer. If this is a recover -- // thunk that we built to test whether a function can be -- // recovered, we can't inline it, because that will mess up -- // our return address comparison. -- if (this->calls_recover_ || this->is_recover_thunk_) -- DECL_UNINLINABLE(decl) = 1; -- -- // If this is a thunk created to call a function which calls -- // the predeclared recover function, we need to disable -- // stack splitting for the thunk. -- if (this->is_recover_thunk_) -- { -- tree attr = get_identifier("__no_split_stack__"); -- DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); -- } -- -- if (this->in_unique_section_) -- resolve_unique_section (decl, 0, 1); -- -- go_preserve_from_gc(decl); -- } -- } -- return this->fndecl_; --} -- --// Get a tree for a function declaration. -- --tree --Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) --{ -- if (this->fndecl_ == NULL_TREE) -- { - // Let Go code use an asm declaration to pick up a builtin - // function. - if (!this->asm_name_.empty()) -@@ -1412,58 +1229,46 @@ - builtin_functions.find(this->asm_name_); - if (p != builtin_functions.end()) - { -- this->fndecl_ = p->second; -+ this->fndecl_ = tree_to_function(p->second); - return this->fndecl_; - } - } - -- tree functype = type_to_tree(this->fntype_->get_backend(gogo)); -+ std::string asm_name; -+ if (this->asm_name_.empty()) -+ { -+ asm_name = (no->package() == NULL -+ ? gogo->pkgpath_symbol() -+ : no->package()->pkgpath_symbol()); -+ asm_name.append(1, '.'); -+ asm_name.append(Gogo::unpack_hidden_name(no->name())); -+ if (this->fntype_->is_method()) -+ { -+ asm_name.append(1, '.'); -+ Type* rtype = this->fntype_->receiver()->type(); -+ asm_name.append(rtype->mangled_name(gogo)); -+ } -+ } - -- if (functype != error_mark_node) -- { -- // The type of a function comes back as a pointer to a -- // struct whose first field is the function, but we want the -- // real function type for a function declaration. -- go_assert(POINTER_TYPE_P(functype) -- && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); -- functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); -- go_assert(FUNCTION_POINTER_TYPE_P(functype)); -- functype = TREE_TYPE(functype); -- } -+ Btype* functype = this->fntype_->get_backend_fntype(gogo); -+ this->fndecl_ = -+ gogo->backend()->function(functype, no->get_id(gogo), asm_name, -+ true, true, true, false, false, -+ this->location()); -+ } - -- tree decl; -- if (functype == error_mark_node) -- decl = error_mark_node; -- else -- { -- decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id, -- functype); -- TREE_PUBLIC(decl) = 1; -- DECL_EXTERNAL(decl) = 1; -- -- if (this->asm_name_.empty()) -- { -- std::string asm_name = (no->package() == NULL -- ? gogo->pkgpath_symbol() -- : no->package()->pkgpath_symbol()); -- asm_name.append(1, '.'); -- asm_name.append(Gogo::unpack_hidden_name(no->name())); -- if (this->fntype_->is_method()) -- { -- asm_name.append(1, '.'); -- Type* rtype = this->fntype_->receiver()->type(); -- asm_name.append(rtype->mangled_name(gogo)); -- } -- SET_DECL_ASSEMBLER_NAME(decl, -- get_identifier_from_string(asm_name)); -- } -- } -- this->fndecl_ = decl; -- go_preserve_from_gc(decl); -- } - return this->fndecl_; - } - -+// Return the function's decl after it has been built. -+ -+tree -+Function::get_decl() const -+{ -+ go_assert(this->fndecl_ != NULL); -+ return function_to_tree(this->fndecl_); -+} -+ - // We always pass the receiver to a method as a pointer. If the - // receiver is actually declared as a non-pointer type, then we copy - // the value into a local variable, so that it has the right type. In -@@ -1558,7 +1363,7 @@ - void - Function::build_tree(Gogo* gogo, Named_object* named_function) - { -- tree fndecl = this->fndecl_; -+ tree fndecl = this->get_decl(); - go_assert(fndecl != NULL_TREE); - - tree params = NULL_TREE; -@@ -1796,7 +1601,7 @@ - set = NULL_TREE; - else - set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, -- DECL_RESULT(this->fndecl_), retval); -+ DECL_RESULT(this->get_decl()), retval); - tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, - void_type_node, set); - append_to_statement_list(ret_stmt, &stmt_list); -@@ -1851,7 +1656,7 @@ - retval = this->return_value(gogo, named_function, end_loc, - &stmt_list); - set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, -- DECL_RESULT(this->fndecl_), retval); -+ DECL_RESULT(this->get_decl()), retval); - ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, - void_type_node, set); - -@@ -1869,7 +1674,7 @@ - *fini = stmt_list; - } - --// Return the value to assign to DECL_RESULT(this->fndecl_). This may -+// Return the value to assign to DECL_RESULT(this->get_decl()). This may - // also add statements to STMT_LIST, which need to be executed before - // the assignment. This is used for a return statement with no - // explicit values. -@@ -1902,7 +1707,7 @@ - } - else - { -- tree rettype = TREE_TYPE(DECL_RESULT(this->fndecl_)); -+ tree rettype = TREE_TYPE(DECL_RESULT(this->get_decl())); - retval = create_tmp_var(rettype, "RESULT"); - tree field = TYPE_FIELDS(rettype); - int index = 0; -@@ -2323,18 +2128,14 @@ - go_assert(m != NULL); - - Named_object* no = m->named_object(); -- -- tree fnid = no->get_id(this); -- -- tree fndecl; -+ Bfunction* bf; - if (no->is_function()) -- fndecl = no->func_value()->get_or_make_decl(this, no, fnid); -+ bf = no->func_value()->get_or_make_decl(this, no); - else if (no->is_function_declaration()) -- fndecl = no->func_declaration_value()->get_or_make_decl(this, no, -- fnid); -+ bf = no->func_declaration_value()->get_or_make_decl(this, no); - else - go_unreachable(); -- fndecl = build_fold_addr_expr(fndecl); -+ tree fndecl = build_fold_addr_expr(function_to_tree(bf)); - - elt = pointers->quick_push(empty); - elt->index = size_int(i); -@@ -2353,10 +2154,11 @@ - TREE_CONSTANT(decl) = 1; - DECL_INITIAL(decl) = constructor; - -- // If the interface type has hidden methods, then this is the only -- // definition of the table. Otherwise it is a comdat table which -- // may be defined in multiple packages. -- if (has_hidden_methods) -+ // If the interface type has hidden methods, and the table is for a -+ // named type, then this is the only definition of the table. -+ // Otherwise it is a comdat table which may be defined in multiple -+ // packages. -+ if (has_hidden_methods && type->named_type() != NULL) - TREE_PUBLIC(decl) = 1; - else - { -Index: gcc/go/gofrontend/lex.cc -=================================================================== ---- a/src/gcc/go/gofrontend/lex.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/lex.cc (.../branches/gcc-4_8-branch) -@@ -873,7 +873,28 @@ - && (cc < 'a' || cc > 'z') - && cc != '_' - && (cc < '0' || cc > '9')) -- break; -+ { -+ // Check for an invalid character here, as we get better -+ // error behaviour if we swallow them as part of the -+ // identifier we are building. -+ if ((cc >= ' ' && cc < 0x7f) -+ || cc == '\t' -+ || cc == '\r' -+ || cc == '\n') -+ break; -+ -+ this->lineoff_ = p - this->linebuf_; -+ error_at(this->location(), -+ "invalid character 0x%x in identifier", -+ cc); -+ if (!has_non_ascii_char) -+ { -+ buf.assign(pstart, p - pstart); -+ has_non_ascii_char = true; -+ } -+ if (!Lex::is_invalid_identifier(buf)) -+ buf.append("$INVALID$"); -+ } - ++p; - if (is_first) - { -Index: gcc/go/gofrontend/backend.h -=================================================================== ---- a/src/gcc/go/gofrontend/backend.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/backend.h (.../branches/gcc-4_8-branch) -@@ -23,7 +23,7 @@ - // The backend representation of a statement. - class Bstatement; - --// The backend representation of a function definition. -+// The backend representation of a function definition or declaration. - class Bfunction; - - // The backend representation of a block. -@@ -266,6 +266,11 @@ - virtual Bexpression* - convert_expression(Btype* type, Bexpression* expr, Location) = 0; - -+ // Create an expression for the address of a function. This is used to -+ // get the address of the code for a function. -+ virtual Bexpression* -+ function_code_expression(Bfunction*, Location) = 0; -+ - // Statements. +@@ -1537,7 +1537,7 @@ - // Create an error statement. This is used for cases which should -@@ -498,6 +503,32 @@ - // recover. - virtual Bexpression* - label_address(Blabel*, Location) = 0; -+ -+ // Functions. -+ -+ // Create an error function. This is used for cases which should -+ // not occur in a correct program, in order to keep the compilation -+ // going without crashing. -+ virtual Bfunction* -+ error_function() = 0; -+ -+ // Declare or define a function of FNTYPE. -+ // NAME is the Go name of the function. ASM_NAME, if not the empty string, is -+ // the name that should be used in the symbol table; this will be non-empty if -+ // a magic extern comment is used. -+ // IS_VISIBLE is true if this function should be visible outside of the -+ // current compilation unit. IS_DECLARATION is true if this is a function -+ // declaration rather than a definition; the function definition will be in -+ // another compilation unit. -+ // IS_INLINABLE is true if the function can be inlined. -+ // DISABLE_SPLIT_STACK is true if this function may not split the stack; this -+ // is used for the implementation of recover. -+ // IN_UNIQUE_SECTION is true if this function should be put into a unique -+ // location if possible; this is used for field tracking. -+ virtual Bfunction* -+ function(Btype* fntype, const std::string& name, const std::string& asm_name, -+ bool is_visible, bool is_declaration, bool is_inlinable, -+ bool disable_split_stack, bool in_unique_section, Location) = 0; + struct symbolic_number { + unsigned HOST_WIDEST_INT n; +- int size; ++ tree type; }; - // The backend interface has to define this function. -@@ -517,5 +548,6 @@ - extern tree stat_to_tree(Bstatement*); - extern tree block_to_tree(Bblock*); - extern tree var_to_tree(Bvariable*); -+extern tree function_to_tree(Bfunction*); - - #endif // !defined(GO_BACKEND_H) -Index: gcc/go/gofrontend/types.cc -=================================================================== ---- a/src/gcc/go/gofrontend/types.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/types.cc (.../branches/gcc-4_8-branch) -@@ -1834,7 +1834,9 @@ - bloc); - gogo->start_block(bloc); - -- if (this->struct_type() != NULL) -+ if (name != NULL && name->real_type()->named_type() != NULL) -+ this->write_named_hash(gogo, name, hash_fntype, equal_fntype); -+ else if (this->struct_type() != NULL) - this->struct_type()->write_hash_function(gogo, name, hash_fntype, - equal_fntype); - else if (this->array_type() != NULL) -@@ -1852,7 +1854,9 @@ - false, bloc); - gogo->start_block(bloc); - -- if (this->struct_type() != NULL) -+ if (name != NULL && name->real_type()->named_type() != NULL) -+ this->write_named_equal(gogo, name); -+ else if (this->struct_type() != NULL) - this->struct_type()->write_equal_function(gogo, name); - else if (this->array_type() != NULL) - this->array_type()->write_equal_function(gogo, name); -@@ -1865,6 +1869,100 @@ - gogo->finish_function(bloc); - } - -+// Write a hash function that simply calls the hash function for a -+// named type. This is used when one named type is defined as -+// another. This ensures that this case works when the other named -+// type is defined in another package and relies on calling hash -+// functions defined only in that package. -+ -+void -+Type::write_named_hash(Gogo* gogo, Named_type* name, -+ Function_type* hash_fntype, Function_type* equal_fntype) -+{ -+ Location bloc = Linemap::predeclared_location(); -+ -+ Named_type* base_type = name->real_type()->named_type(); -+ go_assert(base_type != NULL); -+ -+ // The pointer to the type we are going to hash. This is an -+ // unsafe.Pointer. -+ Named_object* key_arg = gogo->lookup("key", NULL); -+ go_assert(key_arg != NULL); -+ -+ // The size of the type we are going to hash. -+ Named_object* keysz_arg = gogo->lookup("key_size", NULL); -+ go_assert(keysz_arg != NULL); -+ -+ Named_object* hash_fn; -+ Named_object* equal_fn; -+ name->real_type()->type_functions(gogo, base_type, hash_fntype, equal_fntype, -+ &hash_fn, &equal_fn); -+ -+ // Call the hash function for the base type. -+ Expression* key_ref = Expression::make_var_reference(key_arg, bloc); -+ Expression* keysz_ref = Expression::make_var_reference(keysz_arg, bloc); -+ Expression_list* args = new Expression_list(); -+ args->push_back(key_ref); -+ args->push_back(keysz_ref); -+ Expression* func = Expression::make_func_reference(hash_fn, NULL, bloc); -+ Expression* call = Expression::make_call(func, args, false, bloc); -+ -+ // Return the hash of the base type. -+ Expression_list* vals = new Expression_list(); -+ vals->push_back(call); -+ Statement* s = Statement::make_return_statement(vals, bloc); -+ gogo->add_statement(s); -+} -+ -+// Write an equality function that simply calls the equality function -+// for a named type. This is used when one named type is defined as -+// another. This ensures that this case works when the other named -+// type is defined in another package and relies on calling equality -+// functions defined only in that package. -+ -+void -+Type::write_named_equal(Gogo* gogo, Named_type* name) -+{ -+ Location bloc = Linemap::predeclared_location(); -+ -+ // The pointers to the types we are going to compare. These have -+ // type unsafe.Pointer. -+ Named_object* key1_arg = gogo->lookup("key1", NULL); -+ Named_object* key2_arg = gogo->lookup("key2", NULL); -+ go_assert(key1_arg != NULL && key2_arg != NULL); -+ -+ Named_type* base_type = name->real_type()->named_type(); -+ go_assert(base_type != NULL); -+ -+ // Build temporaries with the base type. -+ Type* pt = Type::make_pointer_type(base_type); -+ -+ Expression* ref = Expression::make_var_reference(key1_arg, bloc); -+ ref = Expression::make_cast(pt, ref, bloc); -+ Temporary_statement* p1 = Statement::make_temporary(pt, ref, bloc); -+ gogo->add_statement(p1); -+ -+ ref = Expression::make_var_reference(key2_arg, bloc); -+ ref = Expression::make_cast(pt, ref, bloc); -+ Temporary_statement* p2 = Statement::make_temporary(pt, ref, bloc); -+ gogo->add_statement(p2); -+ -+ // Compare the values for equality. -+ Expression* t1 = Expression::make_temporary_reference(p1, bloc); -+ t1 = Expression::make_unary(OPERATOR_MULT, t1, bloc); -+ -+ Expression* t2 = Expression::make_temporary_reference(p2, bloc); -+ t2 = Expression::make_unary(OPERATOR_MULT, t2, bloc); -+ -+ Expression* cond = Expression::make_binary(OPERATOR_EQEQ, t1, t2, bloc); -+ -+ // Return the equality comparison. -+ Expression_list* vals = new Expression_list(); -+ vals->push_back(cond); -+ Statement* s = Statement::make_return_statement(vals, bloc); -+ gogo->add_statement(s); -+} -+ - // Return a composite literal for the type descriptor for a plain type - // of kind RUNTIME_TYPE_KIND named NAME. - -@@ -2164,26 +2262,9 @@ - - ++p; - go_assert(p->is_field_name("typ")); -- if (!only_value_methods && m->is_value_method()) -- { -- // This is a value method on a pointer type. Change the type of -- // the method to use a pointer receiver. The implementation -- // always uses a pointer receiver anyhow. -- Type* rtype = mtype->receiver()->type(); -- Type* prtype = Type::make_pointer_type(rtype); -- Typed_identifier* receiver = -- new Typed_identifier(mtype->receiver()->name(), prtype, -- mtype->receiver()->location()); -- mtype = Type::make_function_type(receiver, -- (mtype->parameters() == NULL -- ? NULL -- : mtype->parameters()->copy()), -- (mtype->results() == NULL -- ? NULL -- : mtype->results()->copy()), -- mtype->location()); -- } -- vals->push_back(Expression::make_type_descriptor(mtype, bloc)); -+ bool want_pointer_receiver = !only_value_methods && m->is_value_method(); -+ nonmethod_type = mtype->copy_with_receiver_as_param(want_pointer_receiver); -+ vals->push_back(Expression::make_type_descriptor(nonmethod_type, bloc)); - - ++p; - go_assert(p->is_field_name("tfn")); -@@ -3383,6 +3464,68 @@ - // Get the backend representation for a function type. - - Btype* -+Function_type::get_backend_fntype(Gogo* gogo) -+{ -+ if (this->fnbtype_ == NULL) -+ { -+ Backend::Btyped_identifier breceiver; -+ if (this->receiver_ != NULL) -+ { -+ breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); -+ -+ // We always pass the address of the receiver parameter, in -+ // order to make interface calls work with unknown types. -+ Type* rtype = this->receiver_->type(); -+ if (rtype->points_to() == NULL) -+ rtype = Type::make_pointer_type(rtype); -+ breceiver.btype = rtype->get_backend(gogo); -+ breceiver.location = this->receiver_->location(); -+ } -+ -+ std::vector<Backend::Btyped_identifier> bparameters; -+ if (this->parameters_ != NULL) -+ { -+ bparameters.resize(this->parameters_->size()); -+ size_t i = 0; -+ for (Typed_identifier_list::const_iterator p = -+ this->parameters_->begin(); p != this->parameters_->end(); -+ ++p, ++i) -+ { -+ bparameters[i].name = Gogo::unpack_hidden_name(p->name()); -+ bparameters[i].btype = p->type()->get_backend(gogo); -+ bparameters[i].location = p->location(); -+ } -+ go_assert(i == bparameters.size()); -+ } -+ -+ std::vector<Backend::Btyped_identifier> bresults; -+ if (this->results_ != NULL) -+ { -+ bresults.resize(this->results_->size()); -+ size_t i = 0; -+ for (Typed_identifier_list::const_iterator p = -+ this->results_->begin(); p != this->results_->end(); -+ ++p, ++i) -+ { -+ bresults[i].name = Gogo::unpack_hidden_name(p->name()); -+ bresults[i].btype = p->type()->get_backend(gogo); -+ bresults[i].location = p->location(); -+ } -+ go_assert(i == bresults.size()); -+ } -+ -+ this->fnbtype_ = gogo->backend()->function_type(breceiver, bparameters, -+ bresults, -+ this->location()); -+ -+ } -+ -+ return this->fnbtype_; -+} -+ -+// Get the backend representation for a Go function type. -+ -+Btype* - Function_type::do_get_backend(Gogo* gogo) + /* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic +@@ -1549,13 +1549,15 @@ + struct symbolic_number *n, + int count) { - // When we do anything with a function value other than call it, it -@@ -3395,57 +3538,9 @@ - gogo->backend()->placeholder_struct_type("__go_descriptor", loc); - Btype* ptr_struct_type = gogo->backend()->pointer_type(struct_type); - -- Backend::Btyped_identifier breceiver; -- if (this->receiver_ != NULL) -- { -- breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); -- -- // We always pass the address of the receiver parameter, in -- // order to make interface calls work with unknown types. -- Type* rtype = this->receiver_->type(); -- if (rtype->points_to() == NULL) -- rtype = Type::make_pointer_type(rtype); -- breceiver.btype = rtype->get_backend(gogo); -- breceiver.location = this->receiver_->location(); -- } -- -- std::vector<Backend::Btyped_identifier> bparameters; -- if (this->parameters_ != NULL) -- { -- bparameters.resize(this->parameters_->size()); -- size_t i = 0; -- for (Typed_identifier_list::const_iterator p = this->parameters_->begin(); -- p != this->parameters_->end(); -- ++p, ++i) -- { -- bparameters[i].name = Gogo::unpack_hidden_name(p->name()); -- bparameters[i].btype = p->type()->get_backend(gogo); -- bparameters[i].location = p->location(); -- } -- go_assert(i == bparameters.size()); -- } -- -- std::vector<Backend::Btyped_identifier> bresults; -- if (this->results_ != NULL) -- { -- bresults.resize(this->results_->size()); -- size_t i = 0; -- for (Typed_identifier_list::const_iterator p = this->results_->begin(); -- p != this->results_->end(); -- ++p, ++i) -- { -- bresults[i].name = Gogo::unpack_hidden_name(p->name()); -- bresults[i].btype = p->type()->get_backend(gogo); -- bresults[i].location = p->location(); -- } -- go_assert(i == bresults.size()); -- } -- -- Btype* fntype = gogo->backend()->function_type(breceiver, bparameters, -- bresults, loc); - std::vector<Backend::Btyped_identifier> fields(1); - fields[0].name = "code"; -- fields[0].btype = fntype; -+ fields[0].btype = this->get_backend_fntype(gogo); - fields[0].location = loc; - if (!gogo->backend()->set_placeholder_struct_type(struct_type, fields)) - return gogo->backend()->error_type(); -@@ -3821,6 +3916,32 @@ - return ret; - } - -+// Make a copy of a function type with the receiver as the first -+// parameter. ++ int bitsize = TYPE_PRECISION (n->type); + -+Function_type* -+Function_type::copy_with_receiver_as_param(bool want_pointer_receiver) const -+{ -+ go_assert(this->is_method()); -+ Typed_identifier_list* new_params = new Typed_identifier_list(); -+ Type* rtype = this->receiver_->type(); -+ if (want_pointer_receiver) -+ rtype = Type::make_pointer_type(rtype); -+ Typed_identifier receiver(this->receiver_->name(), rtype, -+ this->receiver_->location()); -+ new_params->push_back(receiver); -+ const Typed_identifier_list* orig_params = this->parameters_; -+ if (orig_params != NULL && !orig_params->empty()) -+ { -+ for (Typed_identifier_list::const_iterator p = orig_params->begin(); -+ p != orig_params->end(); -+ ++p) -+ new_params->push_back(*p); -+ } -+ return Type::make_function_type(NULL, new_params, this->results_, -+ this->location_); -+} -+ - // Make a copy of a function type ignoring any receiver and adding a - // closure parameter. - -@@ -4195,7 +4316,8 @@ - - // This is a horrible hack caused by the fact that we don't pack - // the names of builtin types. FIXME. -- if (nt != NULL -+ if (!this->is_imported_ -+ && nt != NULL - && nt->is_builtin() - && nt->name() == Gogo::unpack_hidden_name(name)) - return true; -@@ -4204,6 +4326,36 @@ - } - } - -+// Return whether this field is an unexported field named NAME. -+ -+bool -+Struct_field::is_unexported_field_name(Gogo* gogo, -+ const std::string& name) const -+{ -+ const std::string& field_name(this->field_name()); -+ if (Gogo::is_hidden_name(field_name) -+ && name == Gogo::unpack_hidden_name(field_name) -+ && gogo->pack_hidden_name(name, false) != field_name) -+ return true; -+ -+ // Check for the name of a builtin type. This is like the test in -+ // is_field_name, only there we return false if this->is_imported_, -+ // and here we return true. -+ if (this->is_imported_ && this->is_anonymous()) -+ { -+ Type* t = this->typed_identifier_.type(); -+ if (t->points_to() != NULL) -+ t = t->points_to(); -+ Named_type* nt = t->named_type(); -+ if (nt != NULL -+ && nt->is_builtin() -+ && nt->name() == Gogo::unpack_hidden_name(name)) -+ return true; -+ } -+ -+ return false; -+} -+ - // Return whether this field is an embedded built-in type. - - bool -@@ -4264,13 +4416,8 @@ - ++p) - { - Type* t = p->type(); -- if (t->is_undefined()) -+ if (p->is_anonymous()) - { -- error_at(p->location(), "struct field type is incomplete"); -- p->set_type(Type::make_error_type()); -- } -- else if (p->is_anonymous()) -- { - if (t->named_type() != NULL && t->points_to() != NULL) - { - error_at(p->location(), "embedded type may not be a pointer"); -@@ -4641,13 +4788,8 @@ - for (Struct_field_list::const_iterator pf = fields->begin(); - pf != fields->end(); - ++pf) -- { -- const std::string& field_name(pf->field_name()); -- if (Gogo::is_hidden_name(field_name) -- && name == Gogo::unpack_hidden_name(field_name) -- && gogo->pack_hidden_name(name, false) != field_name) -- return true; -- } -+ if (pf->is_unexported_field_name(gogo, name)) -+ return true; - } - return false; - } -@@ -5250,6 +5392,7 @@ - Type* ftype = imp->read_type(); - - Struct_field sf(Typed_identifier(name, ftype, imp->location())); -+ sf.set_is_imported(); - - if (imp->peek_char() == ' ') - { -@@ -9022,6 +9165,8 @@ - fntype->is_varargs(), location); - gogo->finish_function(fntype->location()); - -+ if (type->named_type() == NULL && stub->is_function()) -+ stub->func_value()->set_is_unnamed_type_stub_method(); - if (m->nointerface() && stub->is_function()) - stub->func_value()->set_nointerface(); - } -@@ -9289,7 +9434,9 @@ - else - { - bool is_unexported; -- if (!Gogo::is_hidden_name(name)) -+ // The test for 'a' and 'z' is to handle builtin names, -+ // which are not hidden. -+ if (!Gogo::is_hidden_name(name) && (name[0] < 'a' || name[0] > 'z')) - is_unexported = false; - else - { -Index: gcc/go/gofrontend/expressions.cc -=================================================================== ---- a/src/gcc/go/gofrontend/expressions.cc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/go/gofrontend/expressions.cc (.../branches/gcc-4_8-branch) -@@ -1219,7 +1219,7 @@ - - // Get the tree for the code of a function expression. - --tree -+Bexpression* - Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc) - { - Function_type* fntype; -@@ -1237,25 +1237,18 @@ - error_at(loc, - "invalid use of special builtin function %qs; must be called", - no->message_name().c_str()); -- return error_mark_node; -+ return gogo->backend()->error_expression(); - } - -- tree id = no->get_id(gogo); -- if (id == error_mark_node) -- return error_mark_node; -- -- tree fndecl; -+ Bfunction* fndecl; - if (no->is_function()) -- fndecl = no->func_value()->get_or_make_decl(gogo, no, id); -+ fndecl = no->func_value()->get_or_make_decl(gogo, no); - else if (no->is_function_declaration()) -- fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no, id); -+ fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no); - else - go_unreachable(); - -- if (fndecl == error_mark_node) -- return error_mark_node; -- -- return build_fold_addr_expr_loc(loc.gcc_location(), fndecl); -+ return gogo->backend()->function_code_expression(fndecl, loc); - } - - // Get the tree for a function expression. This is used when we take -@@ -1492,8 +1485,10 @@ - tree - Func_code_reference_expression::do_get_tree(Translate_context* context) - { -- return Func_expression::get_code_pointer(context->gogo(), this->function_, -- this->location()); -+ Bexpression* ret = -+ Func_expression::get_code_pointer(context->gogo(), this->function_, -+ this->location()); -+ return expr_to_tree(ret); - } - - // Make a reference to the code of a function. -@@ -3055,8 +3050,7 @@ - do_lower(Gogo*, Named_object*, Statement_inserter*, int); - - bool -- do_is_constant() const -- { return this->expr_->is_constant(); } -+ do_is_constant() const; - - bool - do_numeric_constant_value(Numeric_constant*) const; -@@ -3198,6 +3192,27 @@ - return this; - } - -+// Return whether a type conversion is a constant. -+ -+bool -+Type_conversion_expression::do_is_constant() const -+{ -+ if (!this->expr_->is_constant()) -+ return false; -+ -+ // A conversion to a type that may not be used as a constant is not -+ // a constant. For example, []byte(nil). -+ Type* type = this->type_; -+ if (type->integer_type() == NULL -+ && type->float_type() == NULL -+ && type->complex_type() == NULL -+ && !type->is_boolean_type() -+ && !type->is_string_type()) -+ return false; -+ -+ return true; -+} -+ - // Return the constant numeric value if there is one. - - bool -@@ -5586,6 +5601,15 @@ - subcontext.type = NULL; - } - -+ if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR) -+ { -+ // For a logical operation, the context does not determine the -+ // types of the operands. The operands must be some boolean -+ // type but if the context has a boolean type they do not -+ // inherit it. See http://golang.org/issue/3924. -+ subcontext.type = NULL; -+ } -+ - // Set the context for the left hand operand. - if (is_shift_op) - { -@@ -5967,6 +5991,43 @@ - right); - } - -+ // For complex division Go wants slightly different results than the -+ // GCC library provides, so we have our own runtime routine. -+ if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) -+ { -+ const char *name; -+ tree *pdecl; -+ Type* ctype; -+ static tree complex64_div_decl; -+ static tree complex128_div_decl; -+ switch (this->left_->type()->complex_type()->bits()) -+ { -+ case 64: -+ name = "__go_complex64_div"; -+ pdecl = &complex64_div_decl; -+ ctype = Type::lookup_complex_type("complex64"); -+ break; -+ case 128: -+ name = "__go_complex128_div"; -+ pdecl = &complex128_div_decl; -+ ctype = Type::lookup_complex_type("complex128"); -+ break; -+ default: -+ go_unreachable(); -+ } -+ Btype* cbtype = ctype->get_backend(gogo); -+ tree ctype_tree = type_to_tree(cbtype); -+ return Gogo::call_builtin(pdecl, -+ this->location(), -+ name, -+ 2, -+ ctype_tree, -+ ctype_tree, -+ fold_convert_loc(gccloc, ctype_tree, left), -+ type, -+ fold_convert_loc(gccloc, ctype_tree, right)); -+ } -+ - tree compute_type = excess_precision_type(type); - if (compute_type != NULL_TREE) - { -@@ -7191,6 +7252,15 @@ - if (this->code_ == BUILTIN_OFFSETOF) - { - Expression* arg = this->one_arg(); -+ -+ if (arg->bound_method_expression() != NULL -+ || arg->interface_field_reference_expression() != NULL) -+ { -+ this->report_error(_("invalid use of method value as argument " -+ "of Offsetof")); -+ return this; -+ } -+ - Field_reference_expression* farg = arg->field_reference_expression(); - while (farg != NULL) - { -@@ -7200,7 +7270,8 @@ - // it must not be reached through pointer indirections. - if (farg->expr()->deref() != farg->expr()) - { -- this->report_error(_("argument of Offsetof implies indirection of an embedded field")); -+ this->report_error(_("argument of Offsetof implies " -+ "indirection of an embedded field")); - return this; - } - // Go up until we reach the original base. -@@ -7476,7 +7547,7 @@ - switch (nc.to_unsigned_long(&v)) - { - case Numeric_constant::NC_UL_VALID: -- return true; -+ break; - case Numeric_constant::NC_UL_NOTINT: - error_at(e->location(), "non-integer %s argument to make", - is_length ? "len" : "cap"); -@@ -7488,8 +7559,23 @@ - case Numeric_constant::NC_UL_BIG: - // We don't want to give a compile-time error for a 64-bit - // value on a 32-bit target. -- return true; -+ break; - } -+ -+ mpz_t val; -+ if (!nc.to_int(&val)) -+ go_unreachable(); -+ int bits = mpz_sizeinbase(val, 2); -+ mpz_clear(val); -+ Type* int_type = Type::lookup_integer_type("int"); -+ if (bits >= int_type->integer_type()->bits()) -+ { -+ error_at(e->location(), "%s argument too large for make", -+ is_length ? "len" : "cap"); -+ return false; -+ } -+ -+ return true; - } - - if (e->type()->integer_type() != NULL) -@@ -7595,6 +7681,8 @@ - bool - Builtin_call_expression::do_is_constant() const - { -+ if (this->is_error_expression()) -+ return true; - switch (this->code_) - { - case BUILTIN_LEN: -@@ -9744,15 +9832,9 @@ - } - - tree fntype_tree = type_to_tree(fntype->get_backend(gogo)); -- if (fntype_tree == error_mark_node) -+ tree fnfield_type = type_to_tree(fntype->get_backend_fntype(gogo)); -+ if (fntype_tree == error_mark_node || fnfield_type == error_mark_node) - return error_mark_node; -- go_assert(POINTER_TYPE_P(fntype_tree)); -- if (TREE_TYPE(fntype_tree) == error_mark_node) -- return error_mark_node; -- go_assert(TREE_CODE(TREE_TYPE(fntype_tree)) == RECORD_TYPE); -- tree fnfield_type = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(fntype_tree))); -- if (fnfield_type == error_mark_node) -- return error_mark_node; - go_assert(FUNCTION_POINTER_TYPE_P(fnfield_type)); - tree rettype = TREE_TYPE(TREE_TYPE(fnfield_type)); - if (rettype == error_mark_node) -@@ -9763,7 +9845,7 @@ - if (func != NULL) - { - Named_object* no = func->named_object(); -- fn = Func_expression::get_code_pointer(gogo, no, location); -+ fn = expr_to_tree(Func_expression::get_code_pointer(gogo, no, location)); - if (!has_closure) - closure_tree = NULL_TREE; - else -@@ -10817,11 +10899,20 @@ - void - String_index_expression::do_check_types(Gogo*) - { -- if (this->start_->type()->integer_type() == NULL) -+ Numeric_constant nc; -+ unsigned long v; -+ if (this->start_->type()->integer_type() == NULL -+ && !this->start_->type()->is_error() -+ && (!this->start_->numeric_constant_value(&nc) -+ || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) - this->report_error(_("index must be integer")); - if (this->end_ != NULL - && this->end_->type()->integer_type() == NULL -- && !this->end_->is_nil_expression()) -+ && !this->end_->type()->is_error() -+ && !this->end_->is_nil_expression() -+ && !this->end_->is_error_expression() -+ && (!this->end_->numeric_constant_value(&nc) -+ || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) - this->report_error(_("slice end must be integer")); - - std::string sval; -Index: gcc/recog.c -=================================================================== ---- a/src/gcc/recog.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/recog.c (.../branches/gcc-4_8-branch) -@@ -3061,6 +3061,9 @@ - return 1; - } - -+/* Regno offset to be used in the register search. */ -+static int search_ofs; -+ - /* Try to find a hard register of mode MODE, matching the register class in - CLASS_STR, which is available at the beginning of insn CURRENT_INSN and - remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX, -@@ -3076,7 +3079,6 @@ - peep2_find_free_register (int from, int to, const char *class_str, - enum machine_mode mode, HARD_REG_SET *reg_set) - { -- static int search_ofs; - enum reg_class cl; - HARD_REG_SET live; - df_ref *def_rec; -@@ -3541,6 +3543,7 @@ - /* Initialize the regsets we're going to use. */ - for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) - peep2_insn_data[i].live_before = BITMAP_ALLOC (®_obstack); -+ search_ofs = 0; - live = BITMAP_ALLOC (®_obstack); - - FOR_EACH_BB_REVERSE (bb) -Index: gcc/ada/system-linux-s390x.ads -=================================================================== ---- a/src/gcc/ada/system-linux-s390x.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-s390x.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/s390x Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,9 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to ---- make this unit Pure instead of Preelaborable, see RM 13.7(36) -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -@@ -61,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/system-linux-alpha.ads -=================================================================== ---- a/src/gcc/ada/system-linux-alpha.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-alpha.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/alpha Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,9 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to ---- make this unit Pure instead of Preelaborable, see RM 13.7(36) -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -@@ -61,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/system-vxworks-arm.ads -=================================================================== ---- a/src/gcc/ada/system-vxworks-arm.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-vxworks-arm.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (VxWorks Version ARM) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,10 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to make this ---- unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005, this is ---- Pure in any case (AI-362). -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -Index: gcc/ada/system-linux-s390.ads -=================================================================== ---- a/src/gcc/ada/system-linux-s390.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-s390.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/s390 Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,9 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to ---- make this unit Pure instead of Preelaborable, see RM 13.7(36) -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -@@ -61,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/indepsw-darwin.adb -=================================================================== ---- a/src/gcc/ada/indepsw-darwin.adb (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/indepsw-darwin.adb (.../branches/gcc-4_8-branch) -@@ -0,0 +1,67 @@ -+------------------------------------------------------------------------------ -+-- -- -+-- GNAT COMPILER COMPONENTS -- -+-- -- -+-- I N D E P S W -- -+-- -- -+-- B o d y -- -+-- (Darwin version) -- -+-- -- -+-- Copyright (C) 2013, Free Software Foundation, Inc. -- -+-- -- -+-- GNAT is free software; you can redistribute it and/or modify it under -- -+-- terms of the GNU General Public License as published by the Free Soft- -- -+-- ware Foundation; either version 3, or (at your option) any later ver- -- -+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -+-- or FITNESS FOR A PARTICULAR PURPOSE. -- -+-- -- -+-- As a special exception under Section 7 of GPL version 3, you are granted -- -+-- additional permissions described in the GCC Runtime Library Exception, -- -+-- version 3.1, as published by the Free Software Foundation. -- -+-- -- -+-- You should have received a copy of the GNU General Public License and -- -+-- a copy of the GCC Runtime Library Exception along with this program; -- -+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -+-- <http://www.gnu.org/licenses/>. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+-- This is the Darwin version -+ -+package body Indepsw is -+ -+ Map_Switch : aliased constant String := "-Wl,-map,"; -+ -+ ------------- -+ -- Convert -- -+ ------------- -+ -+ procedure Convert -+ (Switch : Switch_Kind; -+ Argument : String; -+ To : out String_List_Access) -+ is -+ begin -+ case Switch is -+ when Map_File => -+ To := new Argument_List'(1 => new String'(Map_Switch & Argument)); -+ end case; -+ end Convert; -+ -+ ------------------ -+ -- Is_Supported -- -+ ------------------ -+ -+ function Is_Supported (Switch : Switch_Kind) return Boolean is -+ begin -+ case Switch is -+ when Map_File => -+ return True; -+ end case; -+ end Is_Supported; -+ -+end Indepsw; -Index: gcc/ada/system-linux-sparcv9.ads -=================================================================== ---- a/src/gcc/ada/system-linux-sparcv9.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-sparcv9.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU/Linux-SPARCV9 Version) -- - -- -- ---- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,9 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to ---- make this unit Pure instead of Preelaborable, see RM 13.7(36) -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -@@ -61,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/ChangeLog -=================================================================== ---- a/src/gcc/ada/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,60 @@ -+2014-03-30 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR ada/60703 -+ * system-linux-alpha.ads: Adjust for Ada 2005. -+ * system-linux-mips.ads: Likewise. -+ * system-linux-mips64el.ads: Likewise. -+ * system-linux-mipsel.ads: Likewise. -+ * system-linux-s390.ads: Likewise. -+ * system-linux-s390x.ads: Likewise. -+ * system-linux-sparc.ads: Likewise. -+ * system-linux-sparcv9.ads: Likewise. -+ * system-rtems.ads: Likewise. -+ * system-vxworks-arm.ads: Likewise. -+ -+2014-03-13 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR ada/51483 -+ * back_end.ads (Register_Type_Proc): Add 'precision' parameter. -+ * cstand.adb (Register_Float_Type): Add 'precision' parameter and use -+ it to set the RM size. Use directly 'size' for the Esize. -+ * gcc-interface/gigi.h (enumerate_modes): Add integer parameter. -+ * gcc-interface/misc.c (enumerate_modes): Likewise. Do not register -+ types for vector modes, pass the size in addition to the precision. -+ -+2014-01-12 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR ada/59772 -+ * gcc-interface/cuintp.c (build_cst_from_int): Use 32-bit integer type -+ as intermediate type. -+ (UI_To_gnu): Likewise. -+ -+2013-12-12 Eric Botcazou <ebotcazou@adacore.com> -+ Iain Sandoe <iain@codesourcery.com> -+ -+ PR ada/55946 -+ * gcc-interface/Make-lang.in (ada/doctools/xgnatugn): Use gnatmake. -+ * gcc-interface/Makefile.in (GCC_LINK): Add LDFLAGS. -+ (../../gnatmake): Remove LDFLAGS. -+ (../../gnatlink): Likewise. -+ -+2013-12-04 Eric Botcazou <ebotcazou@adacore.com> -+ -+ PR ada/59382 -+ * indepsw-darwin.adb: New file. -+ -+2013-10-19 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc-interface/utils.c (scale_by_factor_of): New function. -+ (rest_of_record_type_compilation): Use scale_by_factor_of in order to -+ scale the original offset for both rounding cases; in the second case, -+ take into accout the addend to compute the alignment. Tidy up. -+ -+2013-10-19 Eric Botcazou <ebotcazou@adacore.com> -+ -+ * gcc-interface/utils.c (gnat_set_type_context): New function. -+ (gnat_pushdecl): Use it to set the context of the type. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: gcc/ada/cstand.adb -=================================================================== ---- a/src/gcc/ada/cstand.adb (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/cstand.adb (.../branches/gcc-4_8-branch) -@@ -151,6 +151,7 @@ - Complex : Boolean; -- True iff type has real and imaginary parts - Count : Natural; -- Number of elements in vector, 0 otherwise - Float_Rep : Float_Rep_Kind; -- Representation used for fpt type -+ Precision : Positive; -- Precision of representation in bits - Size : Positive; -- Size of representation in bits - Alignment : Natural); -- Required alignment in bits - pragma Convention (C, Register_Float_Type); -@@ -2014,6 +2015,7 @@ - Complex : Boolean; - Count : Natural; - Float_Rep : Float_Rep_Kind; -+ Precision : Positive; - Size : Positive; - Alignment : Natural) - is -@@ -2063,14 +2065,25 @@ - - else - Write_Str ("mod 2**"); -- Write_Int (Int (Size / Positive'Max (1, Count))); -+ Write_Int (Int (Precision / Positive'Max (1, Count))); - Write_Line (";"); - end if; - -- Write_Str ("for " & T & "'Size use "); -- Write_Int (Int (Size)); -- Write_Line (";"); -+ if Precision = Size then -+ Write_Str ("for " & T (1 .. Last) & "'Size use "); -+ Write_Int (Int (Size)); -+ Write_Line (";"); - -+ else -+ Write_Str ("for " & T (1 .. Last) & "'Value_Size use "); -+ Write_Int (Int (Precision)); -+ Write_Line (";"); -+ -+ Write_Str ("for " & T (1 .. Last) & "'Object_Size use "); -+ Write_Int (Int (Size)); -+ Write_Line (";"); -+ end if; -+ - Write_Str ("for " & T & "'Alignment use "); - Write_Int (Int (Alignment / 8)); - Write_Line (";"); -@@ -2092,15 +2105,13 @@ - if Digs > 0 and then not Complex and then Count = 0 then - declare - Ent : constant Entity_Id := New_Standard_Entity; -- Esize : constant Pos := Pos ((Size + Alignment - 1) -- / Alignment * Alignment); - begin - Set_Defining_Identifier - (New_Node (N_Full_Type_Declaration, Stloc), Ent); - Make_Name (Ent, T (1 .. Last)); - Set_Scope (Ent, Standard_Standard); -- Build_Float_Type (Ent, Esize, Float_Rep, Pos (Digs)); -- Set_RM_Size (Ent, UI_From_Int (Int (Size))); -+ Build_Float_Type (Ent, Int (Size), Float_Rep, Pos (Digs)); -+ Set_RM_Size (Ent, UI_From_Int (Int (Precision))); - Set_Alignment (Ent, UI_From_Int (Int (Alignment / 8))); - - if No (Back_End_Float_Types) then -Index: gcc/ada/back_end.ads -=================================================================== ---- a/src/gcc/ada/back_end.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/back_end.ads (.../branches/gcc-4_8-branch) -@@ -55,6 +55,7 @@ - Complex : Boolean; -- True iff type has real and imaginary parts - Count : Natural; -- Number of elements in vector, 0 otherwise - Float_Rep : Float_Rep_Kind; -- Representation used for fpt type -+ Precision : Positive; -- Precision of representation in bits - Size : Positive; -- Size of representation in bits - Alignment : Natural); -- Required alignment in bits - pragma Convention (C, Register_Type_Proc); -Index: gcc/ada/system-linux-mipsel.ads -=================================================================== ---- a/src/gcc/ada/system-linux-mipsel.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-mipsel.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/MIPSEL Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -62,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/system-linux-mips.ads -=================================================================== ---- a/src/gcc/ada/system-linux-mips.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-mips.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/MIPS Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -62,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/system-linux-mips64el.ads -=================================================================== ---- a/src/gcc/ada/system-linux-mips64el.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-mips64el.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU-Linux/MIPS64EL Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -62,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/gcc-interface/utils.c -=================================================================== ---- a/src/gcc/ada/gcc-interface/utils.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/utils.c (.../branches/gcc-4_8-branch) -@@ -232,6 +232,7 @@ - static tree split_plus (tree, tree *); - static tree float_type_for_precision (int, enum machine_mode); - static tree convert_to_fat_pointer (tree, tree); -+static unsigned int scale_by_factor_of (tree, unsigned int); - static bool potential_alignment_gap (tree, tree, tree); - static void process_attributes (tree, struct attrib *); - -@@ -532,6 +533,22 @@ - free_binding_level = level; - } - -+/* Set the context of TYPE and its parallel types (if any) to CONTEXT. */ -+ -+static void -+gnat_set_type_context (tree type, tree context) -+{ -+ tree decl = TYPE_STUB_DECL (type); -+ -+ TYPE_CONTEXT (type) = context; -+ -+ while (decl && DECL_PARALLEL_TYPE (decl)) -+ { -+ TYPE_CONTEXT (DECL_PARALLEL_TYPE (decl)) = context; -+ decl = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (decl)); -+ } -+} -+ - /* Record DECL as belonging to the current lexical scope and use GNAT_NODE - for location information and flag propagation. */ - -@@ -613,7 +630,7 @@ - if (TREE_CODE (t) == POINTER_TYPE) - TYPE_NEXT_PTR_TO (t) = tt; - TYPE_NAME (tt) = DECL_NAME (decl); -- TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); -+ gnat_set_type_context (tt, DECL_CONTEXT (decl)); - TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); - DECL_ORIGINAL_TYPE (decl) = tt; - } -@@ -623,7 +640,7 @@ - /* We need a variant for the placeholder machinery to work. */ - tree tt = build_variant_type_copy (t); - TYPE_NAME (tt) = decl; -- TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); -+ gnat_set_type_context (tt, DECL_CONTEXT (decl)); - TREE_USED (tt) = TREE_USED (t); - TREE_TYPE (decl) = tt; - if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) -@@ -645,7 +662,7 @@ - if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) - { - TYPE_NAME (t) = decl; -- TYPE_CONTEXT (t) = DECL_CONTEXT (decl); -+ gnat_set_type_context (t, DECL_CONTEXT (decl)); - } - } - } -@@ -1692,93 +1709,74 @@ - TYPE_SIZE_UNIT (new_record_type) - = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT); - -- /* Now scan all the fields, replacing each field with a new -- field corresponding to the new encoding. */ -+ /* Now scan all the fields, replacing each field with a new field -+ corresponding to the new encoding. */ - for (old_field = TYPE_FIELDS (record_type); old_field; - old_field = DECL_CHAIN (old_field)) - { - tree field_type = TREE_TYPE (old_field); - tree field_name = DECL_NAME (old_field); -- tree new_field; - tree curpos = bit_position (old_field); -+ tree pos, new_field; - bool var = false; - unsigned int align = 0; -- tree pos; - -+ /* We're going to do some pattern matching below so remove as many -+ conversions as possible. */ -+ curpos = remove_conversions (curpos, true); -+ - /* See how the position was modified from the last position. - -- There are two basic cases we support: a value was added -- to the last position or the last position was rounded to -- a boundary and they something was added. Check for the -- first case first. If not, see if there is any evidence -- of rounding. If so, round the last position and try -- again. -+ There are two basic cases we support: a value was added -+ to the last position or the last position was rounded to -+ a boundary and they something was added. Check for the -+ first case first. If not, see if there is any evidence -+ of rounding. If so, round the last position and retry. - -- If this is a union, the position can be taken as zero. */ -- -- /* Some computations depend on the shape of the position expression, -- so strip conversions to make sure it's exposed. */ -- curpos = remove_conversions (curpos, true); -- -+ If this is a union, the position can be taken as zero. */ - if (TREE_CODE (new_record_type) == UNION_TYPE) -- pos = bitsize_zero_node, align = 0; -+ pos = bitsize_zero_node; - else - pos = compute_related_constant (curpos, last_pos); - -- if (!pos && TREE_CODE (curpos) == MULT_EXPR -+ if (!pos -+ && TREE_CODE (curpos) == MULT_EXPR - && host_integerp (TREE_OPERAND (curpos, 1), 1)) - { - tree offset = TREE_OPERAND (curpos, 0); - align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); -- -- /* An offset which is a bitwise AND with a mask increases the -- alignment according to the number of trailing zeros. */ -- offset = remove_conversions (offset, true); -- if (TREE_CODE (offset) == BIT_AND_EXPR -- && TREE_CODE (TREE_OPERAND (offset, 1)) == INTEGER_CST) -- { -- unsigned HOST_WIDE_INT mask -- = TREE_INT_CST_LOW (TREE_OPERAND (offset, 1)); -- unsigned int i; -- -- for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++) -- { -- if (mask & 1) -- break; -- mask >>= 1; -- align *= 2; -- } -- } -- -- pos = compute_related_constant (curpos, -- round_up (last_pos, align)); -+ align = scale_by_factor_of (offset, align); -+ last_pos = round_up (last_pos, align); -+ pos = compute_related_constant (curpos, last_pos); - } -- else if (!pos && TREE_CODE (curpos) == PLUS_EXPR -- && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST -+ else if (!pos -+ && TREE_CODE (curpos) == PLUS_EXPR -+ && host_integerp (TREE_OPERAND (curpos, 1), 1) - && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR -- && host_integerp (TREE_OPERAND -- (TREE_OPERAND (curpos, 0), 1), -- 1)) -+ && host_integerp -+ (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1)) - { -+ tree offset = TREE_OPERAND (TREE_OPERAND (curpos, 0), 0); -+ unsigned HOST_WIDE_INT addend -+ = tree_low_cst (TREE_OPERAND (curpos, 1), 1); - align -- = tree_low_cst -- (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); -- pos = compute_related_constant (curpos, -- round_up (last_pos, align)); -+ = tree_low_cst (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); -+ align = scale_by_factor_of (offset, align); -+ align = MIN (align, addend & -addend); -+ last_pos = round_up (last_pos, align); -+ pos = compute_related_constant (curpos, last_pos); - } -- else if (potential_alignment_gap (prev_old_field, old_field, -- pos)) -+ else if (potential_alignment_gap (prev_old_field, old_field, pos)) - { - align = TYPE_ALIGN (field_type); -- pos = compute_related_constant (curpos, -- round_up (last_pos, align)); -+ last_pos = round_up (last_pos, align); -+ pos = compute_related_constant (curpos, last_pos); - } - - /* If we can't compute a position, set it to zero. - -- ??? We really should abort here, but it's too much work -- to get this correct for all cases. */ -- -+ ??? We really should abort here, but it's too much work -+ to get this correct for all cases. */ - if (!pos) - pos = bitsize_zero_node; - -@@ -2553,6 +2551,32 @@ - return false; - } - -+/* Return VALUE scaled by the biggest power-of-2 factor of EXPR. */ -+ -+static unsigned int -+scale_by_factor_of (tree expr, unsigned int value) -+{ -+ expr = remove_conversions (expr, true); -+ -+ /* An expression which is a bitwise AND with a mask has a power-of-2 factor -+ corresponding to the number of trailing zeros of the mask. */ -+ if (TREE_CODE (expr) == BIT_AND_EXPR -+ && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST) -+ { -+ unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)); -+ unsigned int i = 0; -+ -+ while ((mask & 1) == 0 && i < HOST_BITS_PER_WIDE_INT) -+ { -+ mask >>= 1; -+ value *= 2; -+ i++; -+ } -+ } -+ -+ return value; -+} -+ - /* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true - unless we can prove these 2 fields are laid out in such a way that no gap - exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET -Index: gcc/ada/gcc-interface/Makefile.in -=================================================================== ---- a/src/gcc/ada/gcc-interface/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/Makefile.in (.../branches/gcc-4_8-branch) -@@ -2397,7 +2397,7 @@ - "GNATLINK=$(GNATLINK)" \ - "GNATBIND=$(GNATBIND)" - --GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) -+GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS) - - # Build directory for the tools. Let's copy the target-dependent - # sources using the same mechanism as for gnatlib. The other sources are -@@ -2519,12 +2519,10 @@ - - # Likewise for the tools - ../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS) -- $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \ -- $(TOOLS_LIBS) -+ +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) - - ../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS) -- $(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \ -- $(TOOLS_LIBS) -+ +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) - - ../stamp-gnatlib-$(RTSDIR): - @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \ -Index: gcc/ada/gcc-interface/cuintp.c -=================================================================== ---- a/src/gcc/ada/gcc-interface/cuintp.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/cuintp.c (.../branches/gcc-4_8-branch) -@@ -6,7 +6,7 @@ - * * - * C Implementation File * - * * -- * Copyright (C) 1992-2012, Free Software Foundation, Inc. * -+ * Copyright (C) 1992-2014, Free Software Foundation, Inc. * - * * - * GNAT is free software; you can redistribute it and/or modify it under * - * terms of the GNU General Public License as published by the Free Soft- * -@@ -59,8 +59,8 @@ - static tree - build_cst_from_int (tree type, HOST_WIDE_INT low) - { -- if (TREE_CODE (type) == REAL_TYPE) -- return convert (type, build_int_cst (NULL_TREE, low)); -+ if (SCALAR_FLOAT_TYPE_P (type)) -+ return convert (type, build_int_cst (gnat_type_for_size (32, 0), low)); - else - return build_int_cst_type (type, low); - } -@@ -99,20 +99,13 @@ - gcc_assert (Length > 0); - - /* The computations we perform below always require a type at least as -- large as an integer not to overflow. REAL types are always fine, but -+ large as an integer not to overflow. FP types are always fine, but - INTEGER or ENUMERAL types we are handed may be too short. We use a - base integer type node for the computations in this case and will -- convert the final result back to the incoming type later on. -- The base integer precision must be superior than 16. */ -+ convert the final result back to the incoming type later on. */ -+ if (!SCALAR_FLOAT_TYPE_P (comp_type) && TYPE_PRECISION (comp_type) < 32) -+ comp_type = gnat_type_for_size (32, 0); - -- if (TREE_CODE (comp_type) != REAL_TYPE -- && TYPE_PRECISION (comp_type) -- < TYPE_PRECISION (long_integer_type_node)) -- { -- comp_type = long_integer_type_node; -- gcc_assert (TYPE_PRECISION (comp_type) > 16); -- } -- - gnu_base = build_cst_from_int (comp_type, Base); - - gnu_ret = build_cst_from_int (comp_type, First); -Index: gcc/ada/gcc-interface/Make-lang.in -=================================================================== ---- a/src/gcc/ada/gcc-interface/Make-lang.in (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/Make-lang.in (.../branches/gcc-4_8-branch) -@@ -625,7 +625,7 @@ - ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb - -$(MKDIR) ada/doctools - $(CP) $^ ada/doctools -- cd ada/doctools && $(GNATMAKE) -q xgnatugn -+ cd ada/doctools && gnatmake -q xgnatugn - - # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on - # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info -Index: gcc/ada/gcc-interface/gigi.h -=================================================================== ---- a/src/gcc/ada/gcc-interface/gigi.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/gigi.h (.../branches/gcc-4_8-branch) -@@ -1014,7 +1014,7 @@ - /* This function is called by the front-end to enumerate all the supported - modes for the machine, as well as some predefined C types. */ - extern void enumerate_modes (void (*f) (const char *, int, int, int, int, int, -- int)); -+ int, int)); - - #ifdef __cplusplus - } -Index: gcc/ada/gcc-interface/misc.c -=================================================================== ---- a/src/gcc/ada/gcc-interface/misc.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/gcc-interface/misc.c (.../branches/gcc-4_8-branch) -@@ -648,7 +648,7 @@ - /* This function is called by the front-end to enumerate all the supported - modes for the machine, as well as some predefined C types. F is a function - which is called back with the parameters as listed below, first a string, -- then six ints. The name is any arbitrary null-terminated string and has -+ then seven ints. The name is any arbitrary null-terminated string and has - no particular significance, except for the case of predefined C types, where - it should be the name of the C type. For integer types, only signed types - should be listed, unsigned versions are assumed. The order of types should -@@ -664,11 +664,12 @@ - COMPLEX_P nonzero is this represents a complex mode - COUNT count of number of items, nonzero for vector mode - FLOAT_REP Float_Rep_Kind for FP, otherwise undefined -- SIZE number of bits used to store data -+ PRECISION number of bits used to store data -+ SIZE number of bits occupied by the mode - ALIGN number of bits to which mode is aligned. */ - - void --enumerate_modes (void (*f) (const char *, int, int, int, int, int, int)) -+enumerate_modes (void (*f) (const char *, int, int, int, int, int, int, int)) - { - const tree c_types[] - = { float_type_node, double_type_node, long_double_type_node }; -@@ -742,28 +743,26 @@ - - /* First register any C types for this mode that the front end - may need to know about, unless the mode should be skipped. */ -- -- if (!skip_p) -+ if (!skip_p && !vector_p) - for (nameloop = 0; nameloop < ARRAY_SIZE (c_types); nameloop++) - { -- tree typ = c_types[nameloop]; -- const char *nam = c_names[nameloop]; -+ tree type = c_types[nameloop]; -+ const char *name = c_names[nameloop]; - -- if (TYPE_MODE (typ) == i) -+ if (TYPE_MODE (type) == i) - { -- f (nam, digs, complex_p, -- vector_p ? GET_MODE_NUNITS (i) : 0, float_rep, -- TYPE_PRECISION (typ), TYPE_ALIGN (typ)); -+ f (name, digs, complex_p, 0, float_rep, TYPE_PRECISION (type), -+ TREE_INT_CST_LOW (TYPE_SIZE (type)), TYPE_ALIGN (type)); - skip_p = true; - } - } - - /* If no predefined C types were found, register the mode itself. */ -- - if (!skip_p) - f (GET_MODE_NAME (i), digs, complex_p, - vector_p ? GET_MODE_NUNITS (i) : 0, float_rep, -- GET_MODE_PRECISION (i), GET_MODE_ALIGNMENT (i)); -+ GET_MODE_PRECISION (i), GET_MODE_BITSIZE (i), -+ GET_MODE_ALIGNMENT (i)); - } - } - -Index: gcc/ada/system-linux-sparc.ads -=================================================================== ---- a/src/gcc/ada/system-linux-sparc.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-linux-sparc.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (GNU/Linux-SPARC Version) -- - -- -- ---- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -35,9 +35,10 @@ - ------------------------------------------------------------------------------ - - package System is --pragma Pure (System); ---- Note that we take advantage of the implementation permission to ---- make this unit Pure instead of Preelaborable, see RM 13.7(36) -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). - - type Name is (SYSTEM_NAME_GNAT); - System_Name : constant Name := SYSTEM_NAME_GNAT; -@@ -61,6 +62,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := 8; -Index: gcc/ada/system-rtems.ads -=================================================================== ---- a/src/gcc/ada/system-rtems.ads (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ada/system-rtems.ads (.../branches/gcc-4_8-branch) -@@ -7,7 +7,7 @@ - -- S p e c -- - -- (Compiler Version) -- - -- -- ---- Copyright (C) 1992-2011 Free Software Foundation, Inc. -- -+-- Copyright (C) 1992-2014 Free Software Foundation, Inc. -- - -- -- - -- This specification is derived from the Ada Reference Manual for use with -- - -- GNAT. The copyright notice above, and the license provisions that follow -- -@@ -34,9 +34,8 @@ - -- -- - ------------------------------------------------------------------------------ - ---- This version of System is a RTEMS version that is used in building ---- the compiler. This is based as closely as possible on the generic ---- version with the following exceptions: -+-- This version is for RTEMS. It is based as closely as possible on the -+-- generic version with the following exceptions: - -- + priority definitions - - package System is -@@ -67,6 +66,7 @@ - -- Storage-related Declarations - - type Address is private; -+ pragma Preelaborable_Initialization (Address); - Null_Address : constant Address; - - Storage_Unit : constant := Standard'Storage_Unit; -Index: gcc/tree-eh.c -=================================================================== ---- a/src/gcc/tree-eh.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-eh.c (.../branches/gcc-4_8-branch) -@@ -1357,9 +1357,6 @@ - x = gimple_seq_last_stmt (finally); - finally_loc = x ? gimple_location (x) : tf_loc; - -- /* Lower the finally block itself. */ -- lower_eh_constructs_1 (state, &finally); -- - /* Prepare for switch statement generation. */ - nlabels = tf->dest_array.length (); - return_index = nlabels; -@@ -1445,6 +1442,7 @@ - x = gimple_build_label (finally_label); - gimple_seq_add_stmt (&tf->top_p_seq, x); + if (count % 8 != 0) + return false; -+ lower_eh_constructs_1 (state, &finally); - gimple_seq_add_seq (&tf->top_p_seq, finally); + /* Zero out the extra bits of N in order to avoid them being shifted + into the significant bits. */ +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) +- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) ++ n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; - /* Redirect each incoming goto edge. */ -@@ -2502,12 +2500,6 @@ - restart: switch (code) { -- case TARGET_MEM_REF: -- if (TREE_CODE (TMR_BASE (expr)) == ADDR_EXPR -- && !TMR_INDEX (expr) && !TMR_INDEX2 (expr)) -- return false; -- return !TREE_THIS_NOTRAP (expr); -- - case COMPONENT_REF: - case REALPART_EXPR: - case IMAGPART_EXPR: -@@ -2534,10 +2526,36 @@ - return false; - return !in_array_bounds_p (expr); - -+ case TARGET_MEM_REF: - case MEM_REF: -+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR -+ && tree_could_trap_p (TREE_OPERAND (TREE_OPERAND (expr, 0), 0))) -+ return true; -+ if (TREE_THIS_NOTRAP (expr)) +@@ -1563,20 +1565,24 @@ + n->n <<= count; + break; + case RSHIFT_EXPR: ++ /* Arithmetic shift of signed type: result is dependent on the value. */ ++ if (!TYPE_UNSIGNED (n->type) ++ && (n->n & ((unsigned HOST_WIDEST_INT) 0xff << (bitsize - 8)))) + return false; -+ /* We cannot prove that the access is in-bounds when we have -+ variable-index TARGET_MEM_REFs. */ -+ if (code == TARGET_MEM_REF -+ && (TMR_INDEX (expr) || TMR_INDEX2 (expr))) -+ return true; - if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR) -- return false; -- /* Fallthru. */ -+ { -+ tree base = TREE_OPERAND (TREE_OPERAND (expr, 0), 0); -+ double_int off = mem_ref_offset (expr); -+ if (off.is_negative ()) -+ return true; -+ if (TREE_CODE (base) == STRING_CST) -+ return double_int::from_uhwi (TREE_STRING_LENGTH (base)).ule (off); -+ else if (DECL_SIZE_UNIT (base) == NULL_TREE -+ || TREE_CODE (DECL_SIZE_UNIT (base)) != INTEGER_CST -+ || tree_to_double_int (DECL_SIZE_UNIT (base)).ule (off)) -+ return true; -+ /* Now we are sure the first byte of the access is inside -+ the object. */ -+ return false; -+ } -+ return true; -+ - case INDIRECT_REF: - return !TREE_THIS_NOTRAP (expr); - -@@ -4166,8 +4184,11 @@ - /* If the block is totally empty, look for more unsplitting cases. */ - if (gsi_end_p (gsi)) - { -- /* For the degenerate case of an infinite loop bail out. */ -- if (infinite_empty_loop_p (e_out)) -+ /* For the degenerate case of an infinite loop bail out. -+ If bb has no successors and is totally empty, which can happen e.g. -+ because of incorrect noreturn attribute, bail out too. */ -+ if (e_out == NULL -+ || infinite_empty_loop_p (e_out)) - return ret; - - return ret | cleanup_empty_eh_unsplit (bb, e_out, lp); -@@ -4304,11 +4325,12 @@ - remove_unreachable_handlers (); - - /* Watch out for the region tree vanishing due to all unreachable. */ -- if (cfun->eh->region_tree && optimize) -+ if (cfun->eh->region_tree) - { - bool changed = false; - -- changed |= unsplit_all_eh (); -+ if (optimize) -+ changed |= unsplit_all_eh (); - changed |= cleanup_all_empty_eh (); - - if (changed) -Index: gcc/fortran/interface.c -=================================================================== ---- a/src/gcc/fortran/interface.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/interface.c (.../branches/gcc-4_8-branch) -@@ -1245,7 +1245,8 @@ - return FAILURE; - } - -- if (r1->ts.u.cl->length) -+ if (s1->ts.u.cl && s1->ts.u.cl->length -+ && s2->ts.u.cl && s2->ts.u.cl->length) - { - int compval = gfc_dep_compare_expr (r1->ts.u.cl->length, - r2->ts.u.cl->length); -@@ -1367,8 +1368,8 @@ - if (s1->attr.function && s2->attr.function) - { - /* If both are functions, check result characteristics. */ -- if (check_result_characteristics (s1, s2, errmsg, err_len) -- == FAILURE) -+ if (check_result_characteristics (s1, s2, errmsg, err_len) == FAILURE -+ || check_result_characteristics (s2, s1, errmsg, err_len) == FAILURE) - return 0; - } - -Index: gcc/fortran/intrinsic.c -=================================================================== ---- a/src/gcc/fortran/intrinsic.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/intrinsic.c (.../branches/gcc-4_8-branch) -@@ -4229,7 +4229,7 @@ - c->resolved_sym->attr.elemental = isym->elemental; - } - -- if (gfc_pure (NULL) && !isym->pure) -+ if (!isym->pure && gfc_pure (NULL)) - { - gfc_error ("Subroutine call to intrinsic '%s' at %L is not PURE", name, - &c->loc); -@@ -4236,6 +4236,9 @@ - return MATCH_ERROR; - } - -+ if (!isym->pure) -+ gfc_unset_implicit_pure (NULL); -+ - c->resolved_sym->attr.noreturn = isym->noreturn; - - return MATCH_YES; -Index: gcc/fortran/trans-expr.c -=================================================================== ---- a/src/gcc/fortran/trans-expr.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-expr.c (.../branches/gcc-4_8-branch) -@@ -355,7 +355,11 @@ - gfc_conv_expr_descriptor (parmse, e); - - if (e->rank != class_ts.u.derived->components->as->rank) -- class_array_data_assign (&block, ctree, parmse->expr, true); -+ { -+ gcc_assert (class_ts.u.derived->components->as->type -+ == AS_ASSUMED_RANK); -+ class_array_data_assign (&block, ctree, parmse->expr, false); -+ } - else - { - if (gfc_expr_attr (e).codimension) -@@ -670,7 +674,6 @@ - gfc_add_modify (&parmse->post, vptr, - fold_convert (TREE_TYPE (vptr), ctree)); - -- gcc_assert (!optional || (optional && !copyback)); - if (optional) - { - tree tmp2; -@@ -6343,7 +6346,13 @@ - /* Returns a reference to the scalar evaluated outside the loop - for this case. */ - gfc_conv_expr (se, expr); -- se->expr = gfc_build_addr_expr (NULL_TREE, se->expr); -+ -+ if (expr->ts.type == BT_CHARACTER -+ && expr->expr_type != EXPR_FUNCTION) -+ gfc_conv_string_parameter (se); -+ else -+ se->expr = gfc_build_addr_expr (NULL_TREE, se->expr); -+ - return; - } - -Index: gcc/fortran/trans-array.c -=================================================================== ---- a/src/gcc/fortran/trans-array.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-array.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Array translation routines -- Copyright (C) 2002-2013 Free Software Foundation, Inc. -+ Copyright (C) 2002-2014 Free Software Foundation, Inc. - Contributed by Paul Brook <paul@nowt.org> - and Steven Bosscher <s.bosscher@student.tudelft.nl> - -@@ -2487,6 +2487,11 @@ - a reference to the value. */ - gfc_conv_expr (&se, expr); - } -+ -+ /* Ensure that a pointer to the string is stored. */ -+ if (expr->ts.type == BT_CHARACTER) -+ gfc_conv_string_parameter (&se); -+ - gfc_add_block_to_block (&outer_loop->pre, &se.pre); - gfc_add_block_to_block (&outer_loop->post, &se.post); - if (gfc_is_class_scalar_expr (expr)) -@@ -7940,6 +7945,7 @@ - tree size1; - tree size2; - tree array1; -+ tree cond_null; - tree cond; - tree tmp; - tree tmp2; -@@ -8015,9 +8021,9 @@ - jump_label2 = gfc_build_label_decl (NULL_TREE); - - /* Allocate if data is NULL. */ -- cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, -+ cond_null = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, - array1, build_int_cst (TREE_TYPE (array1), 0)); -- tmp = build3_v (COND_EXPR, cond, -+ tmp = build3_v (COND_EXPR, cond_null, - build1_v (GOTO_EXPR, jump_label1), - build_empty_stmt (input_location)); - gfc_add_expr_to_block (&fblock, tmp); -@@ -8069,13 +8075,25 @@ - tmp = build1_v (LABEL_EXPR, jump_label1); - gfc_add_expr_to_block (&fblock, tmp); - -- size1 = gfc_conv_descriptor_size (desc, expr1->rank); -+ /* If the lhs has not been allocated, its bounds will not have been -+ initialized and so its size is set to zero. */ -+ size1 = gfc_create_var (gfc_array_index_type, NULL); -+ gfc_init_block (&alloc_block); -+ gfc_add_modify (&alloc_block, size1, gfc_index_zero_node); -+ gfc_init_block (&realloc_block); -+ gfc_add_modify (&realloc_block, size1, -+ gfc_conv_descriptor_size (desc, expr1->rank)); -+ tmp = build3_v (COND_EXPR, cond_null, -+ gfc_finish_block (&alloc_block), -+ gfc_finish_block (&realloc_block)); -+ gfc_add_expr_to_block (&fblock, tmp); - -- /* Get the rhs size. Fix both sizes. */ -+ /* Get the rhs size and fix it. */ - if (expr2) - desc2 = rss->info->data.array.descriptor; - else - desc2 = NULL_TREE; -+ - size2 = gfc_index_one_node; - for (n = 0; n < expr2->rank; n++) - { -@@ -8089,8 +8107,6 @@ - gfc_array_index_type, - tmp, size2); - } -- -- size1 = gfc_evaluate_now (size1, &fblock); - size2 = gfc_evaluate_now (size2, &fblock); - - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, -Index: gcc/fortran/symbol.c -=================================================================== ---- a/src/gcc/fortran/symbol.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/symbol.c (.../branches/gcc-4_8-branch) -@@ -1110,8 +1110,8 @@ - return FAILURE; - } - -- if (s == SAVE_EXPLICIT && gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ if (s == SAVE_EXPLICIT) -+ gfc_unset_implicit_pure (NULL); - - if (s == SAVE_EXPLICIT && attr->save == SAVE_EXPLICIT) - { -Index: gcc/fortran/class.c -=================================================================== ---- a/src/gcc/fortran/class.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/class.c (.../branches/gcc-4_8-branch) -@@ -2486,7 +2486,7 @@ - return NULL; - - /* Sometimes the typespec is passed from a single call. */ -- if (ts->type == BT_DERIVED) -+ if (ts->type == BT_DERIVED || ts->type == BT_CLASS) - return gfc_find_derived_vtab (ts->u.derived); - - /* Find the top-level namespace. */ -Index: gcc/fortran/decl.c -=================================================================== ---- a/src/gcc/fortran/decl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/decl.c (.../branches/gcc-4_8-branch) -@@ -510,10 +510,8 @@ - free (newdata); - return MATCH_ERROR; - } -+ gfc_unset_implicit_pure (gfc_current_ns->proc_name); - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -- - /* Mark the variable as having appeared in a data statement. */ - if (gfc_add_data (&sym->attr, sym->name, &sym->declared_at) == FAILURE) - { -@@ -571,10 +569,8 @@ - gfc_error ("DATA statement at %C is not allowed in a PURE procedure"); - return MATCH_ERROR; - } -+ gfc_unset_implicit_pure (gfc_current_ns->proc_name); - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -- - return MATCH_YES; - - cleanup: -@@ -1737,6 +1733,7 @@ - "a PURE procedure"); - return MATCH_ERROR; - } -+ gfc_unset_implicit_pure (gfc_current_ns->proc_name); - - /* Match NULL() initialization. */ - m = gfc_match_null (init); -@@ -2045,6 +2042,10 @@ - m = MATCH_ERROR; - } - -+ if (current_attr.flavor != FL_PARAMETER -+ && gfc_state_stack->state != COMP_DERIVED) -+ gfc_unset_implicit_pure (gfc_current_ns->proc_name); -+ - if (m != MATCH_YES) - goto cleanup; - } -@@ -5069,7 +5070,14 @@ - if (gfc_add_proc (&c->attr, name, NULL) == FAILURE) - return MATCH_ERROR; - -- c->tb = tb; -+ if (num == 1) -+ c->tb = tb; -+ else -+ { -+ c->tb = XCNEW (gfc_typebound_proc); -+ c->tb->where = gfc_current_locus; -+ *c->tb = *tb; -+ } - - /* Set interface. */ - if (proc_if != NULL) -@@ -7384,6 +7392,7 @@ - - - /* Check a derived type that is being extended. */ -+ - static gfc_symbol* - check_extended_derived_type (char *name) - { -@@ -7395,14 +7404,15 @@ - return NULL; - } - -+ extended = gfc_find_dt_in_generic (extended); -+ -+ /* F08:C428. */ - if (!extended) - { -- gfc_error ("No such symbol in TYPE definition at %C"); -+ gfc_error ("Symbol '%s' at %C has not been previously defined", name); - return NULL; - } - -- extended = gfc_find_dt_in_generic (extended); -- - if (extended->attr.flavor != FL_DERIVED) - { - gfc_error ("'%s' in EXTENDS expression at %C is not a " -Index: gcc/fortran/dump-parse-tree.c -=================================================================== ---- a/src/gcc/fortran/dump-parse-tree.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/dump-parse-tree.c (.../branches/gcc-4_8-branch) -@@ -110,7 +110,8 @@ + n->n >>= count; break; - - case BT_CHARACTER: -- show_expr (ts->u.cl->length); -+ if (ts->u.cl) -+ show_expr (ts->u.cl->length); - fprintf(dumpfile, " %d", ts->kind); + case LROTATE_EXPR: +- n->n = (n->n << count) | (n->n >> ((n->size * BITS_PER_UNIT) - count)); ++ n->n = (n->n << count) | (n->n >> (bitsize - count)); break; - -Index: gcc/fortran/gfortran.h -=================================================================== ---- a/src/gcc/fortran/gfortran.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/gfortran.h (.../branches/gcc-4_8-branch) -@@ -2830,6 +2830,7 @@ - int gfc_impure_variable (gfc_symbol *); - int gfc_pure (gfc_symbol *); - int gfc_implicit_pure (gfc_symbol *); -+void gfc_unset_implicit_pure (gfc_symbol *); - int gfc_elemental (gfc_symbol *); - gfc_try gfc_resolve_iterator (gfc_iterator *, bool, bool); - gfc_try find_forall_index (gfc_expr *, gfc_symbol *, int); -Index: gcc/fortran/ChangeLog -=================================================================== ---- a/src/gcc/fortran/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,246 @@ -+2014-03-29 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/60677 -+ * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Enlarge argument -+ list buffer. -+ -+2014-03-28 Mikael Morin <mikael@gcc.gnu.org> -+ Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/60576 -+ * trans-expr.c (gfc_conv_derived_to_class): Avoid -+ generation of out-of-bounds range expr. -+ -+2014-03-28 Thomas Koenig <tkoenig@gcc.gnu.org> -+ -+ PR fortran/60522 -+ * frontend-passes.c (cfe_code): Do not walk subtrees -+ for WHERE. -+ -+2014-03-20 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/60543 -+ PR fortran/60283 -+ * gfortran.h (gfc_unset_implicit_pure): New prototype. -+ * resolve.c (gfc_unset_implicit_pure): New. -+ (resolve_structure_cons, resolve_function, -+ pure_subroutine, resolve_ordinary_assign): Use it. -+ * decl.c (match_old_style_init, gfc_match_data, -+ match_pointer_init, variable_decl): Ditto. -+ * expr.c (gfc_check_pointer_assign): Ditto. -+ * intrinsic.c (gfc_intrinsic_sub_interface): Ditto. -+ * io.c (match_vtag, gfc_match_open, gfc_match_close, -+ match_filepos, gfc_match_inquire, gfc_match_print, -+ gfc_match_wait, check_io_constraints): Ditto. -+ * match.c (gfc_match_critical, gfc_match_stopcode, -+ lock_unlock_statement, sync_statement, gfc_match_allocate, -+ gfc_match_deallocate): Ditto. -+ * parse.c (decode_omp_directive): Ditto. -+ * symbol.c (gfc_add_save): Ditto. -+ -+2014-03-08 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/60450 -+ * simplify.c (gfc_simplify_shape): Only clear shape if it was really -+ created successfully. -+ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ Backport from mainline -+ 2014-02-11 Jakub Jelinek <jakub@redhat.com> -+ -+ PR fortran/52370 -+ * trans-decl.c (gfc_build_dummy_array_decl): Set TREE_NO_WARNING -+ on decl if sym->attr.optional. -+ -+2014-03-02 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/60341 -+ * frontend-passes.c (optimize_comparison): Guard two union accesses -+ with the corresponding tag checks. -+ -+2014-02-22 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/59599 -+ * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Calculate the -+ number of arguments. -+ -+2014-02-19 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/49397 -+ * expr.c (gfc_check_pointer_assign): Add check for -+ F2008Cor2, C729. -+ * trans-decl.c (gfc_get_symbol_decl): Correctly generate -+ external decl in a corner case. -+ -+2014-02-19 Janus Weil <janus@gcc.gnu.org> -+ -+ Backports from mainline: -+ 2014-02-17 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/55907 -+ * resolve.c (build_default_init_expr): Don't initialize character -+ variable if -fno-automatic is given. -+ -+ 2014-02-18 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/60231 -+ * resolve.c (check_generic_tbp_ambiguity): Check for presence of dummy -+ arguments to prevent ICE. -+ -+2014-02-09 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-10-21 Tobias Burnus <burnus@net-b.de> -+ -+ PR fortran/58803 -+ PR fortran/59395 -+ * decl.c (match_ppc_decl): Prevent later double free. -+ -+2014-02-08 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/57033 -+ * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer -+ dereference. -+ -+2014-02-07 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/59906 -+ * trans-stmt.c (gfc_add_loop_ss_code): In the case of character -+ SS_REFERENCE, use gfc_conv_string_parameter to ensure that a -+ pointer to the string is stored. -+ * trans-expr.c (gfc_conv_expr_reference): Likewise, use -+ gfc_conv_string_parameter to ensure that a pointer to is passed -+ to the elemental function. -+ -+2014-02-01 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/59414 -+ * trans-stmt.c (gfc_trans_allocate): Before the pointer -+ assignment to transfer the source _vptr to a class allocate -+ expression, the final class reference should be exposed. The -+ tail that includes the _data and array references is stored. -+ This reduced expression is transferred to 'lhs' and the _vptr -+ added. Then the tail is restored to the allocate expression. -+ -+2014-01-26 Mikael Morin <mikael@gcc.gnu.org> -+ -+ PR fortran/58007 -+ * module.c -+ (fp2, find_pointer2): Remove. -+ (mio_component_ref): Don't forcedfully set the containing derived type -+ symbol for loading. Remove unused argument. -+ (mio_ref): Update caller -+ (skip_list): New argument nest_level. Initialize level with the new -+ argument. -+ (read_module): Add forced pointer components association for derived -+ type symbols. -+ -+2014-01-19 Paul Thomas <pault@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-01 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/58410 -+ * trans-array.c (gfc_alloc_allocatable_for_assignment): Do not -+ use the array bounds of an unallocated array but set its size -+ to zero instead. -+ -+2014-01-19 Paul Thomas <pault@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-01 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/34547 -+ * resolve.c (resolve_transfer): EXPR_NULL is always in an -+ invalid context in a transfer statement. -+ -+2014-01-11 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-29 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/59612 -+ PR fortran/57042 -+ * dump-parse-tree.c (show_typespec): Check for charlen. -+ * invoke.texi: Fix documentation of -fdump-fortran-optimized and -+ -fdump-parse-tree. -+ -+2014-01-04 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2014-01-02 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/59654 -+ * resolve.c (resolve_typebound_procedures): No need to create the vtab -+ here. -+ -+2013-12-31 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-30 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58998 -+ * resolve.c (resolve_symbol): Check that symbol is not only flavorless -+ but also untyped. -+ -+2013-12-18 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-12-15 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/59493 -+ * class.c (gfc_find_intrinsic_vtab): Handle BT_CLASS. -+ -+2013-11-30 Paul Thomas <pault@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-11-04 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/57445 -+ * trans-expr.c (gfc_conv_class_to_class): Remove spurious -+ assert. -+ -+2013-11-17 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-11-07 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58471 -+ * primary.c (gfc_expr_attr): Check for result symbol. -+ -+2013-11-16 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-09-20 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58099 -+ * expr.c (gfc_check_pointer_assign): Remove second call to -+ 'gfc_compare_interfaces' with swapped arguments. -+ * interface.c (gfc_compare_interfaces): Symmetrize the call to -+ 'check_result_characteristics' by calling it with swapped arguments. -+ -+2013-11-16 Paul Thomas <pault@gcc.gnu.org> -+ -+ PR fortran/58771 -+ * trans-io.c (transfer_expr): If the backend_decl for a derived -+ type is missing, build it with gfc_typenode_for_spec. -+ -+2013-11-05 Steven G. Kargl <kargl@gcc.gnu.org> -+ -+ PR fortran/58989 -+ * check.c (gfc_check_reshape): ensure that shape is a constant -+ expression. -+ -+2013-11-02 Janus Weil <janus@gcc.gnu.org> -+ -+ Backport from mainline -+ 2013-09-23 Janus Weil <janus@gcc.gnu.org> -+ -+ PR fortran/58355 -+ * decl.c (check_extended_derived_type): Prevent segfault, modify error -+ message. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: gcc/fortran/trans-stmt.c -=================================================================== ---- a/src/gcc/fortran/trans-stmt.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-stmt.c (.../branches/gcc-4_8-branch) -@@ -5104,10 +5104,49 @@ - { - gfc_expr *lhs, *rhs; - gfc_se lse; -+ gfc_ref *ref, *class_ref, *tail; - -+ /* Find the last class reference. */ -+ class_ref = NULL; -+ for (ref = e->ref; ref; ref = ref->next) -+ { -+ if (ref->type == REF_COMPONENT -+ && ref->u.c.component->ts.type == BT_CLASS) -+ class_ref = ref; -+ -+ if (ref->next == NULL) -+ break; -+ } -+ -+ /* Remove and store all subsequent references after the -+ CLASS reference. */ -+ if (class_ref) -+ { -+ tail = class_ref->next; -+ class_ref->next = NULL; -+ } -+ else -+ { -+ tail = e->ref; -+ e->ref = NULL; -+ } -+ - lhs = gfc_expr_to_initialize (e); - gfc_add_vptr_component (lhs); - -+ /* Remove the _vptr component and restore the original tail -+ references. */ -+ if (class_ref) -+ { -+ gfc_free_ref_list (class_ref->next); -+ class_ref->next = tail; -+ } -+ else -+ { -+ gfc_free_ref_list (e->ref); -+ e->ref = tail; -+ } -+ - if (class_expr != NULL_TREE) - { - /* Polymorphic SOURCE: VPTR must be determined at run time. */ -Index: gcc/fortran/expr.c -=================================================================== ---- a/src/gcc/fortran/expr.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/expr.c (.../branches/gcc-4_8-branch) -@@ -3555,11 +3555,13 @@ - return FAILURE; - } - -- if (!gfc_compare_interfaces (s2, s1, name, 0, 1, -- err, sizeof(err), NULL, NULL)) -+ /* Check F2008Cor2, C729. */ -+ if (!s2->attr.intrinsic && s2->attr.if_source == IFSRC_UNKNOWN -+ && !s2->attr.external && !s2->attr.subroutine && !s2->attr.function) - { -- gfc_error ("Interface mismatch in procedure pointer assignment " -- "at %L: %s", &rvalue->where, err); -+ gfc_error ("Procedure pointer target '%s' at %L must be either an " -+ "intrinsic, host or use associated, referenced or have " -+ "the EXTERNAL attribute", s2->name, &rvalue->where); - return FAILURE; - } - -@@ -3679,9 +3681,8 @@ - } - - if (is_implicit_pure && gfc_impure_variable (rvalue->symtree->n.sym)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (gfc_current_ns->proc_name); - -- - if (gfc_has_vector_index (rvalue)) - { - gfc_error ("Pointer assignment with vector subscript " -Index: gcc/fortran/module.c -=================================================================== ---- a/src/gcc/fortran/module.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/module.c (.../branches/gcc-4_8-branch) -@@ -386,37 +386,6 @@ - } - - --/* Recursive function to find a pointer within a tree by brute force. */ -- --static pointer_info * --fp2 (pointer_info *p, const void *target) --{ -- pointer_info *q; -- -- if (p == NULL) -- return NULL; -- -- if (p->u.pointer == target) -- return p; -- -- q = fp2 (p->left, target); -- if (q != NULL) -- return q; -- -- return fp2 (p->right, target); --} -- -- --/* During reading, find a pointer_info node from the pointer value. -- This amounts to a brute-force search. */ -- --static pointer_info * --find_pointer2 (void *p) --{ -- return fp2 (pi_root, p); --} -- -- - /* Resolve any fixups using a known pointer. */ - - static void -@@ -2522,45 +2491,13 @@ - the namespace and is not loaded again. */ - - static void --mio_component_ref (gfc_component **cp, gfc_symbol *sym) -+mio_component_ref (gfc_component **cp) - { -- char name[GFC_MAX_SYMBOL_LEN + 1]; -- gfc_component *q; - pointer_info *p; - - p = mio_pointer_ref (cp); - if (p->type == P_UNKNOWN) - p->type = P_COMPONENT; -- -- if (iomode == IO_OUTPUT) -- mio_pool_string (&(*cp)->name); -- else -- { -- mio_internal_string (name); -- -- if (sym && sym->attr.is_class) -- sym = sym->components->ts.u.derived; -- -- /* It can happen that a component reference can be read before the -- associated derived type symbol has been loaded. Return now and -- wait for a later iteration of load_needed. */ -- if (sym == NULL) -- return; -- -- if (sym->components != NULL && p->u.pointer == NULL) -- { -- /* Symbol already loaded, so search by name. */ -- q = gfc_find_component (sym, name, true, true); -- -- if (q) -- associate_integer_pointer (p, q); -- } -- -- /* Make sure this symbol will eventually be loaded. */ -- p = find_pointer2 (sym); -- if (p->u.rsym.state == UNUSED) -- p->u.rsym.state = NEEDED; -- } - } - - -@@ -2917,7 +2854,7 @@ - - case REF_COMPONENT: - mio_symbol_ref (&r->u.c.sym); -- mio_component_ref (&r->u.c.component, r->u.c.sym); -+ mio_component_ref (&r->u.c.component); + case RROTATE_EXPR: +- n->n = (n->n >> count) | (n->n << ((n->size * BITS_PER_UNIT) - count)); ++ n->n = (n->n >> count) | (n->n << (bitsize - count)); break; - - case REF_SUBSTRING: -@@ -3772,7 +3709,9 @@ - - - /* Unlike most other routines, the address of the symbol node is already -- fixed on input and the name/module has already been filled in. */ -+ fixed on input and the name/module has already been filled in. -+ If you update the symbol format here, don't forget to update read_module -+ as well (look for "seek to the symbol's component list"). */ - - static void - mio_symbol (gfc_symbol *sym) -@@ -3782,6 +3721,7 @@ - mio_lparen (); - - mio_symbol_attribute (&sym->attr); -+ - mio_typespec (&sym->ts); - if (sym->ts.type == BT_CLASS) - sym->attr.class_ok = 1; -@@ -3812,7 +3752,6 @@ - - /* Note that components are always saved, even if they are supposed - to be private. Component access is checked during searching. */ -- - mio_component_list (&sym->components, sym->attr.vtype); - - if (sym->components != NULL) -@@ -3914,14 +3853,17 @@ - } - - --/* Skip a list between balanced left and right parens. */ -+/* Skip a list between balanced left and right parens. -+ By setting NEST_LEVEL one assumes that a number of NEST_LEVEL opening parens -+ have been already parsed by hand, and the remaining of the content is to be -+ skipped here. The default value is 0 (balanced parens). */ - - static void --skip_list (void) -+skip_list (int nest_level = 0) - { - int level; - -- level = 0; -+ level = nest_level; - do - { - switch (parse_atom ()) -@@ -4555,7 +4497,6 @@ - info->u.rsym.ns = atom_int; - - get_module_locus (&info->u.rsym.where); -- skip_list (); - - /* See if the symbol has already been loaded by a previous module. - If so, we reference the existing symbol and prevent it from -@@ -4566,11 +4507,57 @@ - - if (sym == NULL - || (sym->attr.flavor == FL_VARIABLE && info->u.rsym.ns !=1)) -- continue; -+ { -+ skip_list (); -+ continue; -+ } - - info->u.rsym.state = USED; - info->u.rsym.sym = sym; -+ /* The current symbol has already been loaded, so we can avoid loading -+ it again. However, if it is a derived type, some of its components -+ can be used in expressions in the module. To avoid the module loading -+ failing, we need to associate the module's component pointer indexes -+ with the existing symbol's component pointers. */ -+ if (sym->attr.flavor == FL_DERIVED) -+ { -+ gfc_component *c; - -+ /* First seek to the symbol's component list. */ -+ mio_lparen (); /* symbol opening. */ -+ skip_list (); /* skip symbol attribute. */ -+ skip_list (); /* typespec. */ -+ require_atom (ATOM_INTEGER); /* namespace ref. */ -+ require_atom (ATOM_INTEGER); /* common ref. */ -+ skip_list (); /* formal args. */ -+ /* no value. */ -+ skip_list (); /* array_spec. */ -+ require_atom (ATOM_INTEGER); /* result. */ -+ /* not a cray pointer. */ -+ -+ mio_lparen (); /* component list opening. */ -+ for (c = sym->components; c; c = c->next) -+ { -+ pointer_info *p; -+ const char *comp_name; -+ int n; -+ -+ mio_lparen (); /* component opening. */ -+ mio_integer (&n); -+ p = get_integer (n); -+ if (p->u.pointer == NULL) -+ associate_integer_pointer (p, c); -+ mio_pool_string (&comp_name); -+ gcc_assert (comp_name == c->name); -+ skip_list (1); /* component end. */ -+ } -+ mio_rparen (); /* component list closing. */ -+ -+ skip_list (1); /* symbol end. */ -+ } -+ else -+ skip_list (); -+ - /* Some symbols do not have a namespace (eg. formal arguments), - so the automatic "unique symtree" mechanism must be suppressed - by marking them as referenced. */ -Index: gcc/fortran/io.c -=================================================================== ---- a/src/gcc/fortran/io.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/io.c (.../branches/gcc-4_8-branch) -@@ -1309,7 +1309,8 @@ - return MATCH_ERROR; - } - -- if (gfc_pure (NULL) && gfc_impure_variable (result->symtree->n.sym)) -+ bool impure = gfc_impure_variable (result->symtree->n.sym); -+ if (impure && gfc_pure (NULL)) - { - gfc_error ("Variable %s cannot be assigned in PURE procedure at %C", - tag->name); -@@ -1317,8 +1318,8 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL) && gfc_impure_variable (result->symtree->n.sym)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ if (impure) -+ gfc_unset_implicit_pure (NULL); - - *v = result; - return MATCH_YES; -@@ -1838,8 +1839,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - warn = (open->err || open->iostat) ? true : false; - -@@ -2251,8 +2251,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - warn = (close->iostat || close->err) ? true : false; - -@@ -2419,8 +2418,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - new_st.op = op; - new_st.ext.filepos = fp; -@@ -3276,9 +3274,8 @@ - "an internal file in a PURE procedure", - io_kind_name (k)); - -- if (gfc_implicit_pure (NULL) && (k == M_READ || k == M_WRITE)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -- -+ if (k == M_READ || k == M_WRITE) -+ gfc_unset_implicit_pure (NULL); - } - - if (k != M_READ) -@@ -3809,8 +3806,7 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - return MATCH_YES; - } -@@ -3969,8 +3965,7 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - new_st.block = gfc_get_code (); - new_st.block->op = EXEC_IOLENGTH; -@@ -4023,8 +4018,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (inquire->id != NULL && inquire->pending == NULL) - { -@@ -4212,8 +4206,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - new_st.op = EXEC_WAIT; - new_st.ext.wait = wait; -Index: gcc/fortran/frontend-passes.c -=================================================================== ---- a/src/gcc/fortran/frontend-passes.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/frontend-passes.c (.../branches/gcc-4_8-branch) -@@ -623,12 +623,35 @@ - to insert statements as needed. */ - - static int --cfe_code (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, -- void *data ATTRIBUTE_UNUSED) -+cfe_code (gfc_code **c, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) - { - current_code = c; - inserted_block = NULL; - changed_statement = NULL; -+ -+ /* Do not do anything inside a WHERE statement; scalar assignments, BLOCKs -+ and allocation on assigment are prohibited inside WHERE, and finally -+ masking an expression would lead to wrong-code when replacing -+ -+ WHERE (a>0) -+ b = sum(foo(a) + foo(a)) -+ END WHERE -+ -+ with -+ -+ WHERE (a > 0) -+ tmp = foo(a) -+ b = sum(tmp + tmp) -+ END WHERE -+*/ -+ -+ if ((*c)->op == EXEC_WHERE) -+ { -+ *walk_subtrees = 0; -+ return 0; -+ } -+ -+ - return 0; - } - -@@ -1214,7 +1237,9 @@ - /* Replace A // B < A // C with B < C, and A // B < C // B - with A < C. */ - if (op1->ts.type == BT_CHARACTER && op2->ts.type == BT_CHARACTER -+ && op1->expr_type == EXPR_OP - && op1->value.op.op == INTRINSIC_CONCAT -+ && op2->expr_type == EXPR_OP - && op2->value.op.op == INTRINSIC_CONCAT) - { - gfc_expr *op1_left = op1->value.op.op1; -Index: gcc/fortran/resolve.c -=================================================================== ---- a/src/gcc/fortran/resolve.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/resolve.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Perform type resolution on the various structures. -- Copyright (C) 2001-2013 Free Software Foundation, Inc. -+ Copyright (C) 2001-2014 Free Software Foundation, Inc. - Contributed by Andy Vaught - - This file is part of GCC. -@@ -1259,9 +1259,10 @@ - } - - /* F2003, C1272 (3). */ -- if (gfc_pure (NULL) && cons->expr->expr_type == EXPR_VARIABLE -- && (gfc_impure_variable (cons->expr->symtree->n.sym) -- || gfc_is_coindexed (cons->expr))) -+ bool impure = cons->expr->expr_type == EXPR_VARIABLE -+ && (gfc_impure_variable (cons->expr->symtree->n.sym) -+ || gfc_is_coindexed (cons->expr)); -+ if (impure && gfc_pure (NULL)) - { - t = FAILURE; - gfc_error ("Invalid expression in the structure constructor for " -@@ -1269,12 +1270,8 @@ - comp->name, &cons->expr->where); - } - -- if (gfc_implicit_pure (NULL) -- && cons->expr->expr_type == EXPR_VARIABLE -- && (gfc_impure_variable (cons->expr->symtree->n.sym) -- || gfc_is_coindexed (cons->expr))) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -- -+ if (impure) -+ gfc_unset_implicit_pure (NULL); - } - - return t; -@@ -3295,8 +3292,7 @@ - t = FAILURE; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - } - - /* Functions without the RECURSIVE attribution are not allowed to -@@ -3361,8 +3357,7 @@ - gfc_error ("Subroutine call to '%s' at %L is not PURE", sym->name, - &c->loc); - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - } - - -@@ -8705,10 +8700,11 @@ - && exp->value.op.op == INTRINSIC_PARENTHESES) - exp = exp->value.op.op1; - -- if (exp && exp->expr_type == EXPR_NULL && exp->ts.type == BT_UNKNOWN) -+ if (exp && exp->expr_type == EXPR_NULL -+ && code->ext.dt) - { -- gfc_error ("NULL intrinsic at %L in data transfer statement requires " -- "MOLD=", &exp->where); -+ gfc_error ("Invalid context for NULL () intrinsic at %L", -+ &exp->where); - return; - } - -@@ -9612,7 +9608,7 @@ - if (lhs->expr_type == EXPR_VARIABLE - && lhs->symtree->n.sym != gfc_current_ns->proc_name - && lhs->symtree->n.sym->ns != gfc_current_ns) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (lhs->ts.type == BT_DERIVED - && lhs->expr_type == EXPR_VARIABLE -@@ -9620,11 +9616,11 @@ - && rhs->expr_type == EXPR_VARIABLE - && (gfc_impure_variable (rhs->symtree->n.sym) - || gfc_is_coindexed (rhs))) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - /* Fortran 2008, C1283. */ - if (gfc_is_coindexed (lhs)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - } - - /* F03:7.4.1.2. */ -@@ -11057,7 +11053,7 @@ - init_expr = NULL; - } - if (!init_expr && gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON -- && sym->ts.u.cl->length) -+ && sym->ts.u.cl->length && gfc_option.flag_max_stack_var_size != 0) - { - gfc_actual_arglist *arg; - init_expr = gfc_get_expr (); -@@ -11877,6 +11873,7 @@ - { - gfc_symbol *sym1, *sym2; - const char *pass1, *pass2; -+ gfc_formal_arglist *dummy_args; - - gcc_assert (t1->specific && t2->specific); - gcc_assert (!t1->specific->is_generic); -@@ -11899,19 +11896,33 @@ - return FAILURE; + default: + return false; } - -- /* Compare the interfaces. */ -+ /* Determine PASS arguments. */ - if (t1->specific->nopass) - pass1 = NULL; - else if (t1->specific->pass_arg) - pass1 = t1->specific->pass_arg; - else -- pass1 = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym)->sym->name; -+ { -+ dummy_args = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym); -+ if (dummy_args) -+ pass1 = dummy_args->sym->name; -+ else -+ pass1 = NULL; -+ } - if (t2->specific->nopass) - pass2 = NULL; - else if (t2->specific->pass_arg) - pass2 = t2->specific->pass_arg; - else -- pass2 = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym)->sym->name; -+ { -+ dummy_args = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym); -+ if (dummy_args) -+ pass2 = dummy_args->sym->name; -+ else -+ pass2 = NULL; -+ } -+ -+ /* Compare the interfaces. */ - if (gfc_compare_interfaces (sym1, sym2, sym2->name, !t1->is_operator, 0, - NULL, 0, pass1, pass2)) - { -@@ -12425,9 +12436,6 @@ - resolve_bindings_derived = derived; - resolve_bindings_result = SUCCESS; - -- /* Make sure the vtab has been generated. */ -- gfc_find_derived_vtab (derived); -- - if (derived->f2k_derived->tb_sym_root) - gfc_traverse_symtree (derived->f2k_derived->tb_sym_root, - &resolve_typebound_procedure); -@@ -13256,7 +13264,8 @@ - if (sym->attr.flavor == FL_UNKNOWN - || (sym->attr.flavor == FL_PROCEDURE && !sym->attr.intrinsic - && !sym->attr.generic && !sym->attr.external -- && sym->attr.if_source == IFSRC_UNKNOWN)) -+ && sym->attr.if_source == IFSRC_UNKNOWN -+ && sym->ts.type == BT_UNKNOWN)) - { - - /* If we find that a flavorless symbol is an interface in one of the -@@ -14376,6 +14385,33 @@ + /* Zero unused bits for size. */ +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) +- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) ++ n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; + return true; } +@@ -1593,7 +1599,7 @@ + if (TREE_CODE (lhs_type) != INTEGER_TYPE) + return false; -+void -+gfc_unset_implicit_pure (gfc_symbol *sym) -+{ -+ gfc_namespace *ns; -+ -+ if (sym == NULL) -+ { -+ /* Check if the current procedure is implicit_pure. Walk up -+ the procedure list until we find a procedure. */ -+ for (ns = gfc_current_ns; ns; ns = ns->parent) -+ { -+ sym = ns->proc_name; -+ if (sym == NULL) -+ return; -+ -+ if (sym->attr.flavor == FL_PROCEDURE) -+ break; -+ } -+ } -+ -+ if (sym->attr.flavor == FL_PROCEDURE) -+ sym->attr.implicit_pure = 0; -+ else -+ sym->attr.pure = 0; -+} -+ -+ - /* Test whether the current procedure is elemental or not. */ - - int -Index: gcc/fortran/trans-io.c -=================================================================== ---- a/src/gcc/fortran/trans-io.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-io.c (.../branches/gcc-4_8-branch) -@@ -243,16 +243,16 @@ - - /* The code to generate the error. */ - gfc_start_block (&block); -- -+ - arg1 = gfc_build_addr_expr (NULL_TREE, var); -- -+ - arg2 = build_int_cst (integer_type_node, error_code), -- -+ - asprintf (&message, "%s", _(msgid)); - arg3 = gfc_build_addr_expr (pchar_type_node, - gfc_build_localized_cstring_const (message)); - free (message); -- -+ - tmp = build_call_expr_loc (input_location, - gfor_fndecl_generate_error, 3, arg1, arg2, arg3); - -@@ -521,7 +521,7 @@ - gfc_trans_io_runtime_check (cond, var, LIBERROR_BAD_UNIT, - "Unit number in I/O statement too small", - &se.pre); -- -+ - /* UNIT numbers should be less than the max. */ - val = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].huge, 4); - cond = fold_build2_loc (input_location, GT_EXPR, boolean_type_node, -@@ -1000,7 +1000,7 @@ - if (p->convert) - mask |= set_string (&block, &post_block, var, IOPARM_open_convert, - p->convert); -- -+ - if (p->newunit) - mask |= set_parameter_ref (&block, &post_block, var, IOPARM_open_newunit, - p->newunit); -@@ -1234,7 +1234,7 @@ - { - mask |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_exist, - p->exist); -- -+ - if (p->unit && !p->iostat) - { - p->iostat = create_dummy_iostat (); -@@ -1322,7 +1322,7 @@ - if (p->pad) - mask |= set_string (&block, &post_block, var, IOPARM_inquire_pad, - p->pad); -- -+ - if (p->convert) - mask |= set_string (&block, &post_block, var, IOPARM_inquire_convert, - p->convert); -@@ -1547,7 +1547,7 @@ - tree dtype; - tree dt_parm_addr; - tree decl = NULL_TREE; -- int n_dim; -+ int n_dim; - int itype; - int rank = 0; - -@@ -2032,7 +2032,7 @@ - if (gfc_notification_std (GFC_STD_GNU) != SILENT) - { - gfc_error_now ("Derived type '%s' at %L has PRIVATE components", -- ts->u.derived->name, code != NULL ? &(code->loc) : -+ ts->u.derived->name, code != NULL ? &(code->loc) : - &gfc_current_locus); - return; - } -@@ -2041,7 +2041,7 @@ - ts->kind = ts->u.derived->ts.kind; - ts->f90_type = ts->u.derived->ts.f90_type; - } -- -+ - kind = ts->kind; - function = NULL; - arg2 = NULL; -@@ -2123,7 +2123,7 @@ - function = iocall[IOCALL_X_CHARACTER_WIDE]; - else - function = iocall[IOCALL_X_CHARACTER_WIDE_WRITE]; -- -+ - tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); - tmp = build_call_expr_loc (input_location, - function, 4, tmp, addr_expr, arg2, arg3); -@@ -2158,6 +2158,12 @@ - expr = build_fold_indirect_ref_loc (input_location, - expr); - -+ /* Make sure that the derived type has been built. An external -+ function, if only referenced in an io statement requires this -+ check (see PR58771). */ -+ if (ts->u.derived->backend_decl == NULL_TREE) -+ tmp = gfc_typenode_for_spec (ts); -+ - for (c = ts->u.derived->components; c; c = c->next) - { - field = c->backend_decl; -Index: gcc/fortran/trans-decl.c -=================================================================== ---- a/src/gcc/fortran/trans-decl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-decl.c (.../branches/gcc-4_8-branch) -@@ -1013,6 +1013,10 @@ - TREE_STATIC (decl) = 0; - DECL_EXTERNAL (decl) = 0; - -+ /* Avoid uninitialized warnings for optional dummy arguments. */ -+ if (sym->attr.optional) -+ TREE_NO_WARNING (decl) = 1; -+ - /* We should never get deferred shape arrays here. We used to because of - frontend bugs. */ - gcc_assert (sym->as->type != AS_DEFERRED); -@@ -1358,9 +1362,10 @@ - - if (sym->attr.flavor == FL_PROCEDURE) - { -- /* Catch function declarations. Only used for actual parameters, -+ /* Catch functions. Only used for actual parameters, - procedure pointers and procptr initialization targets. */ -- if (sym->attr.external || sym->attr.use_assoc || sym->attr.intrinsic) -+ if (sym->attr.external || sym->attr.use_assoc || sym->attr.intrinsic -+ || sym->attr.if_source != IFSRC_DECL) - { - decl = gfc_get_extern_function_decl (sym); - gfc_set_decl_location (decl, &sym->declared_at); -Index: gcc/fortran/match.c -=================================================================== ---- a/src/gcc/fortran/match.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/match.c (.../branches/gcc-4_8-branch) -@@ -1753,8 +1753,7 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (gfc_notify_std (GFC_STD_F2008, "CRITICAL statement at %C") - == FAILURE) -@@ -2683,8 +2682,7 @@ - goto cleanup; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (st == ST_STOP && gfc_find_state (COMP_CRITICAL) == SUCCESS) - { -@@ -2824,8 +2822,7 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (gfc_option.coarray == GFC_FCOARRAY_NONE) - { -@@ -3020,8 +3017,7 @@ - return MATCH_ERROR; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - if (gfc_notify_std (GFC_STD_F2008, "SYNC statement at %C") - == FAILURE) -@@ -3500,15 +3496,15 @@ - if (gfc_check_do_variable (tail->expr->symtree)) - goto cleanup; - -- if (gfc_pure (NULL) && gfc_impure_variable (tail->expr->symtree->n.sym)) -+ bool impure = gfc_impure_variable (tail->expr->symtree->n.sym); -+ if (impure && gfc_pure (NULL)) - { - gfc_error ("Bad allocate-object at %C for a PURE procedure"); - goto cleanup; - } - -- if (gfc_implicit_pure (NULL) -- && gfc_impure_variable (tail->expr->symtree->n.sym)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ if (impure) -+ gfc_unset_implicit_pure (NULL); - - if (tail->expr->ts.deferred) - { -@@ -3890,14 +3886,15 @@ - - sym = tail->expr->symtree->n.sym; - -- if (gfc_pure (NULL) && gfc_impure_variable (sym)) -+ bool impure = gfc_impure_variable (sym); -+ if (impure && gfc_pure (NULL)) - { - gfc_error ("Illegal allocate-object at %C for a PURE procedure"); - goto cleanup; - } - -- if (gfc_implicit_pure (NULL) && gfc_impure_variable (sym)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ if (impure) -+ gfc_unset_implicit_pure (NULL); - - if (gfc_is_coarray (tail->expr) - && gfc_find_state (COMP_DO_CONCURRENT) == SUCCESS) -Index: gcc/fortran/parse.c -=================================================================== ---- a/src/gcc/fortran/parse.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/parse.c (.../branches/gcc-4_8-branch) -@@ -550,8 +550,7 @@ - return ST_NONE; - } - -- if (gfc_implicit_pure (NULL)) -- gfc_current_ns->proc_name->attr.implicit_pure = 0; -+ gfc_unset_implicit_pure (NULL); - - old_locus = gfc_current_locus; - -Index: gcc/fortran/check.c -=================================================================== ---- a/src/gcc/fortran/check.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/check.c (.../branches/gcc-4_8-branch) -@@ -3208,7 +3208,7 @@ - "than %d elements", &shape->where, GFC_MAX_DIMENSIONS); - return FAILURE; - } -- else if (shape->expr_type == EXPR_ARRAY) -+ else if (shape->expr_type == EXPR_ARRAY && gfc_is_constant_expr (shape)) - { - gfc_expr *e; - int i, extent; -Index: gcc/fortran/primary.c -=================================================================== ---- a/src/gcc/fortran/primary.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/primary.c (.../branches/gcc-4_8-branch) -@@ -2252,7 +2252,7 @@ - case EXPR_FUNCTION: - gfc_clear_attr (&attr); - -- if (e->value.function.esym != NULL) -+ if (e->value.function.esym && e->value.function.esym->result) - { - gfc_symbol *sym = e->value.function.esym->result; - attr = sym->attr; -@@ -2540,7 +2540,8 @@ - if (parent && !comp) - break; - -- actual = actual->next; -+ if (actual) -+ actual = actual->next; - } - - if (build_actual_constructor (&comp_head, &ctor_head, sym) == FAILURE) -Index: gcc/fortran/trans-intrinsic.c -=================================================================== ---- a/src/gcc/fortran/trans-intrinsic.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/trans-intrinsic.c (.../branches/gcc-4_8-branch) -@@ -4684,9 +4684,11 @@ - static void - gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr) - { -- tree args[2], type, pchartype; -+ tree args[3], type, pchartype; -+ int nargs; - -- gfc_conv_intrinsic_function_args (se, expr, args, 2); -+ nargs = gfc_intrinsic_argument_list_length (expr); -+ gfc_conv_intrinsic_function_args (se, expr, args, nargs); - gcc_assert (POINTER_TYPE_P (TREE_TYPE (args[1]))); - pchartype = gfc_get_pchar_type (expr->value.function.actual->expr->ts.kind); - args[1] = fold_build1_loc (input_location, NOP_EXPR, pchartype, args[1]); -Index: gcc/fortran/simplify.c -=================================================================== ---- a/src/gcc/fortran/simplify.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/fortran/simplify.c (.../branches/gcc-4_8-branch) -@@ -5528,7 +5528,7 @@ - if (e == &gfc_bad_expr || range_check (e, "SHAPE") == &gfc_bad_expr) - { - gfc_free_expr (result); -- if (t) -+ if (t == SUCCESS) - gfc_clear_shape (shape, source->rank); - return &gfc_bad_expr; - } -@@ -5536,7 +5536,7 @@ - gfc_constructor_append_expr (&result->value.constructor, e, NULL); - } - -- if (t) -+ if (t == SUCCESS) - gfc_clear_shape (shape, source->rank); - - return result; -Index: gcc/configure.ac -=================================================================== ---- a/src/gcc/configure.ac (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/configure.ac (.../branches/gcc-4_8-branch) -@@ -1516,13 +1516,11 @@ - /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; - *) realsrcdir=../${srcdir};; - esac -- saved_CFLAGS="${CFLAGS}" - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ -- LDFLAGS="${LDFLAGS_FOR_BUILD}" \ -+ LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \ - ${realsrcdir}/configure \ - --enable-languages=${enable_languages-all} \ - --target=$target_alias --host=$build_alias --build=$build_alias -- CFLAGS="${saved_CFLAGS}" - - # We just finished tests for the build machine, so rename - # the file auto-build.h in the gcc directory. -@@ -1887,6 +1885,7 @@ - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - -@@ -3611,6 +3610,19 @@ - kasumi_fi_xor %f46, %f48, %f50, %f52],, - [AC_DEFINE(HAVE_AS_SPARC4, 1, - [Define if your assembler supports SPARC4 instructions.])]) -+ -+ gcc_GAS_CHECK_FEATURE([LEON instructions], -+ gcc_cv_as_sparc_leon,, -+ [-Aleon], -+ [.text -+ .register %g2, #scratch -+ .register %g3, #scratch -+ .align 4 -+ smac %g2, %g3, %g1 -+ umac %g2, %g3, %g1 -+ cas [[%g2]], %g3, %g1],, -+ [AC_DEFINE(HAVE_AS_LEON, 1, -+ [Define if your assembler supports LEON instructions.])]) - ;; - - changequote(,)dnl -@@ -3749,8 +3761,13 @@ - - # These two are used unconditionally by i386.[ch]; it is to be defined - # to 1 if the feature is present, 0 otherwise. -+ as_ix86_gotoff_in_data_opt= -+ if test x$gas = xyes; then -+ as_ix86_gotoff_in_data_opt="--32" -+ fi - gcc_GAS_CHECK_FEATURE([GOTOFF in data], -- gcc_cv_as_ix86_gotoff_in_data, [2,11,0],, -+ gcc_cv_as_ix86_gotoff_in_data, [2,11,0], -+ [$as_ix86_gotoff_in_data_opt], - [ .text - .L0: - nop -@@ -3772,6 +3789,12 @@ - [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, - [Define if the assembler supports 'rep <insn>, lock <insn>'.])]) - -+ gcc_GAS_CHECK_FEATURE([ud2 mnemonic], -+ gcc_cv_as_ix86_ud2,,, -+ [ud2],, -+ [AC_DEFINE(HAVE_AS_IX86_UD2, 1, -+ [Define if your assembler supports the 'ud2' mnemonic.])]) -+ - gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], - gcc_cv_as_ix86_tlsgdplt,,, - [call tls_gd@tlsgdplt], -@@ -5193,15 +5216,15 @@ - AC_MSG_CHECKING([for exported symbols]) - if test "x$export_sym_check" != x; then - echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c -- ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1 -- if $export_sym_check conftest | grep foobar > /dev/null; then -+ ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1 -+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - : # No need to use a flag - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([for -rdynamic]) -- ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1 -- if $export_sym_check conftest | grep foobar > /dev/null; then -+ ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1 -+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then - plugin_rdynamic=yes - pluginlibs="-rdynamic" - else -Index: gcc/function.c -=================================================================== ---- a/src/gcc/function.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/function.c (.../branches/gcc-4_8-branch) -@@ -2507,6 +2507,7 @@ - } - - locate_and_pad_parm (data->promoted_mode, data->passed_type, in_regs, -+ all->reg_parm_stack_space, - entry_parm ? data->partial : 0, current_function_decl, - &all->stack_args_size, &data->locate); - -@@ -3485,11 +3486,7 @@ - /* Adjust function incoming argument size for alignment and - minimum length. */ - --#ifdef REG_PARM_STACK_SPACE -- crtl->args.size = MAX (crtl->args.size, -- REG_PARM_STACK_SPACE (fndecl)); --#endif -- -+ crtl->args.size = MAX (crtl->args.size, all.reg_parm_stack_space); - crtl->args.size = CEIL_ROUND (crtl->args.size, - PARM_BOUNDARY / BITS_PER_UNIT); - -@@ -3693,6 +3690,9 @@ - IN_REGS is nonzero if the argument will be passed in registers. It will - never be set if REG_PARM_STACK_SPACE is not defined. - -+ REG_PARM_STACK_SPACE is the number of bytes of stack space reserved -+ for arguments which are passed in registers. -+ - FNDECL is the function in which the argument was defined. +- if (TYPE_PRECISION (lhs_type) != n->size * BITS_PER_UNIT) ++ if (TYPE_PRECISION (lhs_type) != TYPE_PRECISION (n->type)) + return false; - There are two types of rounding that are done. The first, controlled by -@@ -3713,7 +3713,8 @@ + return true; +@@ -1650,20 +1656,23 @@ + to initialize the symbolic number. */ + if (!source_expr1) + { ++ int size; ++ + /* Set up the symbolic number N by setting each byte to a + value between 1 and the byte size of rhs1. The highest + order byte is set to n->size and the lowest order + byte to 1. */ +- n->size = TYPE_PRECISION (TREE_TYPE (rhs1)); +- if (n->size % BITS_PER_UNIT != 0) ++ n->type = TREE_TYPE (rhs1); ++ size = TYPE_PRECISION (n->type); ++ if (size % BITS_PER_UNIT != 0) + return NULL_TREE; +- n->size /= BITS_PER_UNIT; ++ size /= BITS_PER_UNIT; + n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : + (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201); - void - locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs, -- int partial, tree fndecl ATTRIBUTE_UNUSED, -+ int reg_parm_stack_space, int partial, -+ tree fndecl ATTRIBUTE_UNUSED, - struct args_size *initial_offset_ptr, - struct locate_and_pad_arg_data *locate) - { -@@ -3720,12 +3721,8 @@ - tree sizetree; - enum direction where_pad; - unsigned int boundary, round_boundary; -- int reg_parm_stack_space = 0; - int part_size_in_regs; +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) ++ if (size < (int)sizeof (HOST_WIDEST_INT)) + n->n &= ((unsigned HOST_WIDEST_INT)1 << +- (n->size * BITS_PER_UNIT)) - 1; ++ (size * BITS_PER_UNIT)) - 1; --#ifdef REG_PARM_STACK_SPACE -- reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl); -- - /* If we have found a stack parm before we reach the end of the - area reserved for registers, skip that area. */ - if (! in_regs) -@@ -3743,7 +3740,6 @@ - initial_offset_ptr->constant = reg_parm_stack_space; + source_expr1 = rhs1; } - } --#endif /* REG_PARM_STACK_SPACE */ - - part_size_in_regs = (reg_parm_stack_space == 0 ? partial : 0); - -@@ -3806,11 +3802,7 @@ - - locate->slot_offset.constant += part_size_in_regs; - -- if (!in_regs --#ifdef REG_PARM_STACK_SPACE -- || REG_PARM_STACK_SPACE (fndecl) > 0 --#endif -- ) -+ if (!in_regs || reg_parm_stack_space > 0) - pad_to_arg_alignment (&locate->slot_offset, boundary, - &locate->alignment_pad); - -@@ -3830,11 +3822,7 @@ - pad_below (&locate->offset, passed_mode, sizetree); - - #else /* !ARGS_GROW_DOWNWARD */ -- if (!in_regs --#ifdef REG_PARM_STACK_SPACE -- || REG_PARM_STACK_SPACE (fndecl) > 0 --#endif -- ) -+ if (!in_regs || reg_parm_stack_space > 0) - pad_to_arg_alignment (initial_offset_ptr, boundary, - &locate->alignment_pad); - locate->slot_offset = *initial_offset_ptr; -@@ -5093,6 +5081,7 @@ - amount. BLKmode results are handled using the group load/store - machinery. */ - if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode -+ && REG_P (real_decl_rtl) - && targetm.calls.return_in_msb (TREE_TYPE (decl_result))) - { - emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl), -@@ -5509,22 +5498,45 @@ - except for any part that overlaps SRC (next loop). */ - bb_uses = &DF_LR_BB_INFO (bb)->use; - bb_defs = &DF_LR_BB_INFO (bb)->def; -- for (i = dregno; i < end_dregno; i++) -+ if (df_live) +@@ -1672,12 +1681,12 @@ { -- if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i)) -- next_block = NULL; -- CLEAR_REGNO_REG_SET (live_out, i); -- CLEAR_REGNO_REG_SET (live_in, i); -+ for (i = dregno; i < end_dregno; i++) -+ { -+ if (REGNO_REG_SET_P (bb_uses, i) || REGNO_REG_SET_P (bb_defs, i) -+ || REGNO_REG_SET_P (&DF_LIVE_BB_INFO (bb)->gen, i)) -+ next_block = NULL; -+ CLEAR_REGNO_REG_SET (live_out, i); -+ CLEAR_REGNO_REG_SET (live_in, i); -+ } -+ -+ /* Check whether BB clobbers SRC. We need to add INSN to BB if so. -+ Either way, SRC is now live on entry. */ -+ for (i = sregno; i < end_sregno; i++) -+ { -+ if (REGNO_REG_SET_P (bb_defs, i) -+ || REGNO_REG_SET_P (&DF_LIVE_BB_INFO (bb)->gen, i)) -+ next_block = NULL; -+ SET_REGNO_REG_SET (live_out, i); -+ SET_REGNO_REG_SET (live_in, i); -+ } - } -+ else -+ { -+ /* DF_LR_BB_INFO (bb)->def does not comprise the DF_REF_PARTIAL and -+ DF_REF_CONDITIONAL defs. So if DF_LIVE doesn't exist, i.e. -+ at -O1, just give up searching NEXT_BLOCK. */ -+ next_block = NULL; -+ for (i = dregno; i < end_dregno; i++) -+ { -+ CLEAR_REGNO_REG_SET (live_out, i); -+ CLEAR_REGNO_REG_SET (live_in, i); -+ } - -- /* Check whether BB clobbers SRC. We need to add INSN to BB if so. -- Either way, SRC is now live on entry. */ -- for (i = sregno; i < end_sregno; i++) -- { -- if (REGNO_REG_SET_P (bb_defs, i)) -- next_block = NULL; -- SET_REGNO_REG_SET (live_out, i); -- SET_REGNO_REG_SET (live_in, i); -+ for (i = sregno; i < end_sregno; i++) -+ { -+ SET_REGNO_REG_SET (live_out, i); -+ SET_REGNO_REG_SET (live_in, i); -+ } - } - - /* If we don't need to add the move to BB, look for a single -Index: gcc/print-rtl.c -=================================================================== ---- a/src/gcc/print-rtl.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/print-rtl.c (.../branches/gcc-4_8-branch) -@@ -582,6 +582,8 @@ - - if (MEM_EXPR (in_rtx)) - print_mem_expr (outfile, MEM_EXPR (in_rtx)); -+ else -+ fputc (' ', outfile); - - if (MEM_OFFSET_KNOWN_P (in_rtx)) - fprintf (outfile, "+" HOST_WIDE_INT_PRINT_DEC, MEM_OFFSET (in_rtx)); -Index: gcc/tree-vectorizer.h -=================================================================== ---- a/src/gcc/tree-vectorizer.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-vectorizer.h (.../branches/gcc-4_8-branch) -@@ -542,6 +542,10 @@ - is 1. */ - unsigned int gap; - -+ /* The minimum negative dependence distance this stmt participates in -+ or zero if none. */ -+ unsigned int min_neg_dist; -+ - /* Not all stmts in the loop need to be vectorized. e.g, the increment - of the loop induction variable and computation of array indexes. relevant - indicates whether the stmt needs to be vectorized. */ -@@ -593,6 +597,7 @@ - #define STMT_VINFO_GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep - #define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info) - #define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part -+#define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist - - #define GROUP_FIRST_ELEMENT(S) (S)->first_element - #define GROUP_NEXT_ELEMENT(S) (S)->next_element -Index: gcc/sdbout.c -=================================================================== ---- a/src/gcc/sdbout.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/sdbout.c (.../branches/gcc-4_8-branch) -@@ -1226,7 +1226,10 @@ - sdbout_parms (tree parms) - { - for (; parms; parms = TREE_CHAIN (parms)) -- if (DECL_NAME (parms)) -+ if (DECL_NAME (parms) -+ && TREE_TYPE (parms) != error_mark_node -+ && DECL_RTL_SET_P (parms) -+ && DECL_INCOMING_RTL (parms)) - { - int current_sym_value = 0; - const char *name = IDENTIFIER_POINTER (DECL_NAME (parms)); -@@ -1358,7 +1361,10 @@ - sdbout_reg_parms (tree parms) - { - for (; parms; parms = TREE_CHAIN (parms)) -- if (DECL_NAME (parms)) -+ if (DECL_NAME (parms) -+ && TREE_TYPE (parms) != error_mark_node -+ && DECL_RTL_SET_P (parms) -+ && DECL_INCOMING_RTL (parms)) - { - const char *name = IDENTIFIER_POINTER (DECL_NAME (parms)); - -Index: gcc/ipa-split.c -=================================================================== ---- a/src/gcc/ipa-split.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ipa-split.c (.../branches/gcc-4_8-branch) -@@ -136,7 +136,7 @@ - variable, check it if it is present in bitmap passed via DATA. */ - - static bool --test_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data) -+test_nonssa_use (gimple, tree t, tree, void *data) - { - t = get_base_address (t); - -@@ -229,7 +229,7 @@ - } - if (gimple_code (stmt) == GIMPLE_LABEL - && test_nonssa_use (stmt, gimple_label_label (stmt), -- non_ssa_vars)) -+ NULL_TREE, non_ssa_vars)) + case BIT_AND_EXPR: { - ok = false; - goto done; -@@ -258,7 +258,7 @@ - if (virtual_operand_p (gimple_phi_result (stmt))) - continue; - if (TREE_CODE (op) != SSA_NAME -- && test_nonssa_use (stmt, op, non_ssa_vars)) -+ && test_nonssa_use (stmt, op, op, non_ssa_vars)) - { - ok = false; - goto done; -@@ -670,7 +670,7 @@ - Return true when access to T prevents splitting the function. */ - - static bool --mark_nonssa_use (gimple stmt ATTRIBUTE_UNUSED, tree t, void *data) -+mark_nonssa_use (gimple, tree t, tree, void *data) - { - t = get_base_address (t); - -@@ -830,7 +830,7 @@ - if (TREE_CODE (op) == SSA_NAME) - bitmap_set_bit (used_ssa_names, SSA_NAME_VERSION (op)); - else -- can_split &= !mark_nonssa_use (stmt, op, non_ssa_vars); -+ can_split &= !mark_nonssa_use (stmt, op, op, non_ssa_vars); - } - } - return can_split; -Index: gcc/alias.c -=================================================================== ---- a/src/gcc/alias.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/alias.c (.../branches/gcc-4_8-branch) -@@ -156,7 +156,9 @@ - static alias_set_entry get_alias_set_entry (alias_set_type); - static bool nonoverlapping_component_refs_p (const_rtx, const_rtx); - static tree decl_for_component_ref (tree); --static int write_dependence_p (const_rtx, const_rtx, int); -+static int write_dependence_p (const_rtx, -+ const_rtx, enum machine_mode, rtx, -+ bool, bool, bool); - - static void memory_modified_1 (rtx, const_rtx, void *); - -@@ -2558,15 +2560,24 @@ - } - - /* Returns nonzero if a write to X might alias a previous read from -- (or, if WRITEP is nonzero, a write to) MEM. */ -+ (or, if WRITEP is true, a write to) MEM. -+ If X_CANONCALIZED is true, then X_ADDR is the canonicalized address of X, -+ and X_MODE the mode for that access. -+ If MEM_CANONICALIZED is true, MEM is canonicalized. */ - - static int --write_dependence_p (const_rtx mem, const_rtx x, int writep) -+write_dependence_p (const_rtx mem, -+ const_rtx x, enum machine_mode x_mode, rtx x_addr, -+ bool mem_canonicalized, bool x_canonicalized, bool writep) - { -- rtx x_addr, mem_addr; -+ rtx mem_addr; - rtx base; - int ret; - -+ gcc_checking_assert (x_canonicalized -+ ? (x_addr != NULL_RTX && x_mode != VOIDmode) -+ : (x_addr == NULL_RTX && x_mode == VOIDmode)); -+ - if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) - return 1; - -@@ -2590,17 +2601,21 @@ - if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x)) - return 1; - -- x_addr = XEXP (x, 0); - mem_addr = XEXP (mem, 0); -- if (!((GET_CODE (x_addr) == VALUE -- && GET_CODE (mem_addr) != VALUE -- && reg_mentioned_p (x_addr, mem_addr)) -- || (GET_CODE (x_addr) != VALUE -- && GET_CODE (mem_addr) == VALUE -- && reg_mentioned_p (mem_addr, x_addr)))) -+ if (!x_addr) - { -- x_addr = get_addr (x_addr); -- mem_addr = get_addr (mem_addr); -+ x_addr = XEXP (x, 0); -+ if (!((GET_CODE (x_addr) == VALUE -+ && GET_CODE (mem_addr) != VALUE -+ && reg_mentioned_p (x_addr, mem_addr)) -+ || (GET_CODE (x_addr) != VALUE -+ && GET_CODE (mem_addr) == VALUE -+ && reg_mentioned_p (mem_addr, x_addr)))) -+ { -+ x_addr = get_addr (x_addr); -+ if (!mem_canonicalized) -+ mem_addr = get_addr (mem_addr); -+ } - } - - if (! writep) -@@ -2616,11 +2631,16 @@ - GET_MODE (mem))) - return 0; - -- x_addr = canon_rtx (x_addr); -- mem_addr = canon_rtx (mem_addr); -+ if (!x_canonicalized) -+ { -+ x_addr = canon_rtx (x_addr); -+ x_mode = GET_MODE (x); -+ } -+ if (!mem_canonicalized) -+ mem_addr = canon_rtx (mem_addr); - - if ((ret = memrefs_conflict_p (SIZE_FOR_MODE (mem), mem_addr, -- SIZE_FOR_MODE (x), x_addr, 0)) != -1) -+ GET_MODE_SIZE (x_mode), x_addr, 0)) != -1) - return ret; - - if (nonoverlapping_memrefs_p (x, mem, false)) -@@ -2634,15 +2654,33 @@ - int - anti_dependence (const_rtx mem, const_rtx x) - { -- return write_dependence_p (mem, x, /*writep=*/0); -+ return write_dependence_p (mem, x, VOIDmode, NULL_RTX, -+ /*mem_canonicalized=*/false, -+ /*x_canonicalized*/false, /*writep=*/false); - } - -+/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X. -+ Also, consider X in X_MODE (which might be from an enclosing -+ STRICT_LOW_PART / ZERO_EXTRACT). -+ If MEM_CANONICALIZED is true, MEM is canonicalized. */ -+ -+int -+canon_anti_dependence (const_rtx mem, bool mem_canonicalized, -+ const_rtx x, enum machine_mode x_mode, rtx x_addr) -+{ -+ return write_dependence_p (mem, x, x_mode, x_addr, -+ mem_canonicalized, /*x_canonicalized=*/true, -+ /*writep=*/false); -+} -+ - /* Output dependence: X is written after store in MEM takes place. */ - - int - output_dependence (const_rtx mem, const_rtx x) - { -- return write_dependence_p (mem, x, /*writep=*/1); -+ return write_dependence_p (mem, x, VOIDmode, NULL_RTX, -+ /*mem_canonicalized=*/false, -+ /*x_canonicalized*/false, /*writep=*/true); - } - - -@@ -2871,17 +2909,14 @@ - /* Wipe the reg_seen array clean. */ - bitmap_clear (reg_seen); - -- /* Mark all hard registers which may contain an address. -- The stack, frame and argument pointers may contain an address. -- An argument register which can hold a Pmode value may contain -- an address even if it is not in BASE_REGS. -+ /* Initialize the alias information for this pass. */ -+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) -+ if (static_reg_base_value[i]) -+ { -+ new_reg_base_value[i] = static_reg_base_value[i]; -+ bitmap_set_bit (reg_seen, i); -+ } - -- The address expression is VOIDmode for an argument and -- Pmode for other registers. */ -- -- memcpy (new_reg_base_value, static_reg_base_value, -- FIRST_PSEUDO_REGISTER * sizeof (rtx)); -- - /* Walk the insns adding values to the new_reg_base_value array. */ - for (i = 0; i < rpo_cnt; i++) - { -Index: gcc/tree-vect-loop.c -=================================================================== ---- a/src/gcc/tree-vect-loop.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-vect-loop.c (.../branches/gcc-4_8-branch) -@@ -1537,7 +1537,7 @@ - - if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) - || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0 -- || LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo)) -+ || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required."); -@@ -2097,6 +2097,12 @@ - || (!check_reduction && flow_loop_nested_p (vect_loop, loop))); - - name = PHI_RESULT (phi); -+ /* ??? If there are no uses of the PHI result the inner loop reduction -+ won't be detected as possibly double-reduction by vectorizable_reduction -+ because that tries to walk the PHI arg from the preheader edge which -+ can be constant. See PR60382. */ -+ if (has_zero_uses (name)) -+ return NULL; - nloop_uses = 0; - FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name) - { -@@ -3115,7 +3121,6 @@ - stmt_vec_info stmt_vinfo = vinfo_for_stmt (iv_phi); - loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); - struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); -- tree scalar_type; - tree vectype; - int nunits; - edge pe = loop_preheader_edge (loop); -@@ -3122,7 +3127,6 @@ - struct loop *iv_loop; - basic_block new_bb; - tree new_vec, vec_init, vec_step, t; -- tree access_fn; - tree new_var; - tree new_name; - gimple init_stmt, induction_phi, new_stmt; -@@ -3130,7 +3134,6 @@ - tree init_expr, step_expr; - int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); - int i; -- bool ok; - int ncopies; - tree expr; - stmt_vec_info phi_info = vinfo_for_stmt (iv_phi); -@@ -3159,16 +3162,14 @@ - latch_e = loop_latch_edge (iv_loop); - loop_arg = PHI_ARG_DEF_FROM_EDGE (iv_phi, latch_e); - -- access_fn = analyze_scalar_evolution (iv_loop, PHI_RESULT (iv_phi)); -- gcc_assert (access_fn); -- STRIP_NOPS (access_fn); -- ok = vect_is_simple_iv_evolution (iv_loop->num, access_fn, -- &init_expr, &step_expr); -- gcc_assert (ok); -+ step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (phi_info); -+ gcc_assert (step_expr != NULL_TREE); -+ - pe = loop_preheader_edge (iv_loop); -+ init_expr = PHI_ARG_DEF_FROM_EDGE (iv_phi, -+ loop_preheader_edge (iv_loop)); - -- scalar_type = TREE_TYPE (init_expr); -- vectype = get_vectype_for_scalar_type (scalar_type); -+ vectype = get_vectype_for_scalar_type (TREE_TYPE (init_expr)); - resvectype = get_vectype_for_scalar_type (TREE_TYPE (PHI_RESULT (iv_phi))); - gcc_assert (vectype); - nunits = TYPE_VECTOR_SUBPARTS (vectype); -@@ -3177,6 +3178,16 @@ - gcc_assert (phi_info); - gcc_assert (ncopies >= 1); - -+ /* Convert the step to the desired type. */ -+ step_expr = force_gimple_operand (fold_convert (TREE_TYPE (vectype), -+ step_expr), -+ &stmts, true, NULL_TREE); -+ if (stmts) -+ { -+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts); -+ gcc_assert (!new_bb); -+ } -+ - /* Find the first insertion point in the BB. */ - si = gsi_after_labels (bb); - -@@ -3186,9 +3197,7 @@ - /* iv_loop is nested in the loop to be vectorized. init_expr had already - been created during vectorization of previous stmts. We obtain it - from the STMT_VINFO_VEC_STMT of the defining stmt. */ -- tree iv_def = PHI_ARG_DEF_FROM_EDGE (iv_phi, -- loop_preheader_edge (iv_loop)); -- vec_init = vect_get_vec_def_for_operand (iv_def, iv_phi, NULL); -+ vec_init = vect_get_vec_def_for_operand (init_expr, iv_phi, NULL); - /* If the initial value is not of proper type, convert it. */ - if (!useless_type_conversion_p (vectype, TREE_TYPE (vec_init))) - { -@@ -3211,8 +3220,11 @@ - - /* iv_loop is the loop to be vectorized. Create: - vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr) */ -- new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_"); -- new_name = force_gimple_operand (init_expr, &stmts, false, new_var); -+ new_var = vect_get_new_vect_var (TREE_TYPE (vectype), -+ vect_scalar_var, "var_"); -+ new_name = force_gimple_operand (fold_convert (TREE_TYPE (vectype), -+ init_expr), -+ &stmts, false, new_var); - if (stmts) - { - new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts); -@@ -3224,9 +3236,7 @@ - for (i = 1; i < nunits; i++) - { - /* Create: new_name_i = new_name + step_expr */ -- enum tree_code code = POINTER_TYPE_P (scalar_type) -- ? POINTER_PLUS_EXPR : PLUS_EXPR; -- init_stmt = gimple_build_assign_with_ops (code, new_var, -+ init_stmt = gimple_build_assign_with_ops (PLUS_EXPR, new_var, - new_name, step_expr); - new_name = make_ssa_name (new_var, init_stmt); - gimple_assign_set_lhs (init_stmt, new_name); -@@ -5564,8 +5574,9 @@ - && !STMT_VINFO_LIVE_P (stmt_info)) - continue; - -- if ((TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)) -- != (unsigned HOST_WIDE_INT) vectorization_factor) -+ if (STMT_VINFO_VECTYPE (stmt_info) -+ && (TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)) -+ != (unsigned HOST_WIDE_INT) vectorization_factor) - && dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, "multiple-types."); - -Index: gcc/ipa.c -=================================================================== ---- a/src/gcc/ipa.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ipa.c (.../branches/gcc-4_8-branch) -@@ -359,6 +359,8 @@ - { - if (file) - fprintf (file, " %s", cgraph_node_name (node)); -+ node->alias = false; -+ node->thunk.thunk_p = false; - cgraph_node_remove_callees (node); - ipa_remove_all_references (&node->symbol.ref_list); - changed = true; -Index: gcc/lra-coalesce.c -=================================================================== ---- a/src/gcc/lra-coalesce.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/lra-coalesce.c (.../branches/gcc-4_8-branch) -@@ -221,9 +221,12 @@ - basic_block bb; - rtx mv, set, insn, next, *sorted_moves; - int i, mv_num, sregno, dregno; -+ unsigned int regno; - int coalesced_moves; - int max_regno = max_reg_num (); - bitmap_head involved_insns_bitmap; -+ bitmap_head result_pseudo_vals_bitmap; -+ bitmap_iterator bi; - - timevar_push (TV_LRA_COALESCE); - -@@ -318,6 +321,34 @@ +- int i; ++ int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; + unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2); + unsigned HOST_WIDEST_INT tmp = val; + + /* Only constants masking full bytes are allowed. */ +- for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT) ++ for (i = 0; i < size; i++, tmp >>= BITS_PER_UNIT) + if ((tmp & 0xff) != 0 && (tmp & 0xff) != 0xff) + return NULL_TREE; + +@@ -1693,12 +1702,22 @@ + break; + CASE_CONVERT: + { +- int type_size; ++ int type_size, old_type_size; ++ tree type; + +- type_size = TYPE_PRECISION (gimple_expr_type (stmt)); ++ type = gimple_expr_type (stmt); ++ type_size = TYPE_PRECISION (type); + if (type_size % BITS_PER_UNIT != 0) + return NULL_TREE; + ++ /* Sign extension: result is dependent on the value. */ ++ old_type_size = TYPE_PRECISION (n->type); ++ if (!TYPE_UNSIGNED (n->type) ++ && type_size > old_type_size ++ && n->n & ++ ((unsigned HOST_WIDEST_INT) 0xff << (old_type_size - 8))) ++ return NULL_TREE; ++ + if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) + { + /* If STMT casts to a smaller type mask out the bits not +@@ -1705,7 +1724,7 @@ + belonging to the target type. */ + n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1; } +- n->size = type_size / BITS_PER_UNIT; ++ n->type = type; } - } -+ /* If we have situation after inheritance pass: -+ -+ r1 <- ... insn originally setting p1 -+ i1 <- r1 setting inheritance i1 from reload r1 -+ ... -+ ... <- ... p2 ... dead p2 -+ .. -+ p1 <- i1 -+ r2 <- i1 -+ ...<- ... r2 ... -+ -+ And we are coalescing p1 and p2 using p1. In this case i1 and p1 -+ should have different values, otherwise they can get the same -+ hard reg and this is wrong for insn using p2 before coalescing. -+ So invalidate such inheritance pseudo values. */ -+ bitmap_initialize (&result_pseudo_vals_bitmap, ®_obstack); -+ EXECUTE_IF_SET_IN_BITMAP (&coalesced_pseudos_bitmap, 0, regno, bi) -+ bitmap_set_bit (&result_pseudo_vals_bitmap, -+ lra_reg_info[first_coalesced_pseudo[regno]].val); -+ EXECUTE_IF_SET_IN_BITMAP (&lra_inheritance_pseudos, 0, regno, bi) -+ if (bitmap_bit_p (&result_pseudo_vals_bitmap, lra_reg_info[regno].val)) -+ { -+ lra_set_regno_unique_value (regno); -+ if (lra_dump_file != NULL) -+ fprintf (lra_dump_file, -+ " Make unique value for inheritance r%d\n", regno); -+ } -+ bitmap_clear (&result_pseudo_vals_bitmap); - bitmap_clear (&used_pseudos_bitmap); - bitmap_clear (&involved_insns_bitmap); - bitmap_clear (&coalesced_pseudos_bitmap); -Index: gcc/tree-vect-data-refs.c -=================================================================== ---- a/src/gcc/tree-vect-data-refs.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-vect-data-refs.c (.../branches/gcc-4_8-branch) -@@ -739,6 +739,13 @@ - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "dependence distance negative."); -+ /* Record a negative dependence distance to later limit the -+ amount of stmt copying / unrolling we can perform. -+ Only need to handle read-after-write dependence. */ -+ if (DR_IS_READ (drb) -+ && (STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) == 0 -+ || STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) > (unsigned)dist)) -+ STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) = dist; - continue; - } - -Index: gcc/gimplify.c -=================================================================== ---- a/src/gcc/gimplify.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gimplify.c (.../branches/gcc-4_8-branch) -@@ -2060,6 +2060,9 @@ - /* Nonlocal VLAs seen in the current function. */ - static struct pointer_set_t *nonlocal_vlas; - -+/* The VAR_DECLs created for nonlocal VLAs for debug info purposes. */ -+static tree nonlocal_vla_vars; -+ - /* Gimplify a VAR_DECL or PARM_DECL. Return GS_OK if we expanded a - DECL_VALUE_EXPR, and it's worth re-examining things. */ - -@@ -2106,14 +2109,13 @@ - ctx = ctx->outer_context; - if (!ctx && !pointer_set_insert (nonlocal_vlas, decl)) - { -- tree copy = copy_node (decl), block; -+ tree copy = copy_node (decl); - - lang_hooks.dup_lang_specific_decl (copy); - SET_DECL_RTL (copy, 0); - TREE_USED (copy) = 1; -- block = DECL_INITIAL (current_function_decl); -- DECL_CHAIN (copy) = BLOCK_VARS (block); -- BLOCK_VARS (block) = copy; -+ DECL_CHAIN (copy) = nonlocal_vla_vars; -+ nonlocal_vla_vars = copy; - SET_DECL_VALUE_EXPR (copy, unshare_expr (value_expr)); - DECL_HAS_VALUE_EXPR_P (copy) = 1; - } -@@ -4369,7 +4371,7 @@ - unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; - tree index = bitsize_int (indexi); - if (offset / part_widthi -- <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (addrtype))) -+ < TYPE_VECTOR_SUBPARTS (TREE_TYPE (addrtype))) - return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (addr, 0), - part_width, index); - } -@@ -6131,7 +6133,7 @@ - region's REDUCTION clause. */ - - static bool --omp_check_private (struct gimplify_omp_ctx *ctx, tree decl) -+omp_check_private (struct gimplify_omp_ctx *ctx, tree decl, bool copyprivate) - { - splay_tree_node n; - -@@ -6140,8 +6142,11 @@ - ctx = ctx->outer_context; - if (ctx == NULL) - return !(is_global_var (decl) -- /* References might be private, but might be shared too. */ -- || lang_hooks.decls.omp_privatize_by_reference (decl)); -+ /* References might be private, but might be shared too, -+ when checking for copyprivate, assume they might be -+ private, otherwise assume they might be shared. */ -+ || (!copyprivate -+ && lang_hooks.decls.omp_privatize_by_reference (decl))); - - n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); - if (n != NULL) -@@ -6267,12 +6272,36 @@ - remove = true; - break; - } -+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_COPYPRIVATE -+ && !remove -+ && !omp_check_private (ctx, decl, true)) -+ { -+ remove = true; -+ if (is_global_var (decl)) -+ { -+ if (DECL_THREAD_LOCAL_P (decl)) -+ remove = false; -+ else if (DECL_HAS_VALUE_EXPR_P (decl)) -+ { -+ tree value = get_base_address (DECL_VALUE_EXPR (decl)); -+ -+ if (value -+ && DECL_P (value) -+ && DECL_THREAD_LOCAL_P (value)) -+ remove = false; -+ } -+ } -+ if (remove) -+ error_at (OMP_CLAUSE_LOCATION (c), -+ "copyprivate variable %qE is not threadprivate" -+ " or private in outer context", DECL_NAME (decl)); -+ } - do_notice: - if (outer_ctx) - omp_notice_variable (outer_ctx, decl, true); - if (check_non_private - && region_type == ORT_WORKSHARE -- && omp_check_private (ctx, decl)) -+ && omp_check_private (ctx, decl, false)) - { - error ("%s variable %qE is private in outer context", - check_non_private, DECL_NAME (decl)); -@@ -8261,6 +8290,21 @@ - - if (nonlocal_vlas) - { -+ if (nonlocal_vla_vars) -+ { -+ /* tree-nested.c may later on call declare_vars (..., true); -+ which relies on BLOCK_VARS chain to be the tail of the -+ gimple_bind_vars chain. Ensure we don't violate that -+ assumption. */ -+ if (gimple_bind_block (outer_bind) -+ == DECL_INITIAL (current_function_decl)) -+ declare_vars (nonlocal_vla_vars, outer_bind, true); -+ else -+ BLOCK_VARS (DECL_INITIAL (current_function_decl)) -+ = chainon (BLOCK_VARS (DECL_INITIAL (current_function_decl)), -+ nonlocal_vla_vars); -+ nonlocal_vla_vars = NULL_TREE; -+ } - pointer_set_destroy (nonlocal_vlas); - nonlocal_vlas = NULL; - } -Index: gcc/calls.c -=================================================================== ---- a/src/gcc/calls.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/calls.c (.../branches/gcc-4_8-branch) -@@ -983,6 +983,7 @@ - - for (i = 0; i < num_actuals; i++) - if (args[i].reg != 0 && ! args[i].pass_on_stack -+ && GET_CODE (args[i].reg) != PARALLEL - && args[i].mode == BLKmode - && MEM_P (args[i].value) - && (MEM_ALIGN (args[i].value) -@@ -1327,6 +1328,7 @@ - #else - args[i].reg != 0, - #endif -+ reg_parm_stack_space, - args[i].pass_on_stack ? 0 : args[i].partial, - fndecl, args_size, &args[i].locate); - #ifdef BLOCK_REG_PADDING -@@ -3171,7 +3173,9 @@ - group load/store machinery below. */ - if (!structure_value_addr - && !pcc_struct_value -+ && TYPE_MODE (rettype) != VOIDmode - && TYPE_MODE (rettype) != BLKmode -+ && REG_P (valreg) - && targetm.calls.return_in_msb (rettype)) - { - if (shift_return_value (TYPE_MODE (rettype), false, valreg)) -@@ -3734,7 +3738,8 @@ - #else - argvec[count].reg != 0, - #endif -- 0, NULL_TREE, &args_size, &argvec[count].locate); -+ reg_parm_stack_space, 0, -+ NULL_TREE, &args_size, &argvec[count].locate); - - if (argvec[count].reg == 0 || argvec[count].partial != 0 - || reg_parm_stack_space > 0) -@@ -3821,7 +3826,7 @@ - #else - argvec[count].reg != 0, - #endif -- argvec[count].partial, -+ reg_parm_stack_space, argvec[count].partial, - NULL_TREE, &args_size, &argvec[count].locate); - args_size.constant += argvec[count].locate.size.constant; - gcc_assert (!argvec[count].locate.size.var); -Index: gcc/tree-dfa.c -=================================================================== ---- a/src/gcc/tree-dfa.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-dfa.c (.../branches/gcc-4_8-branch) -@@ -386,7 +386,6 @@ - double_int bit_offset = double_int_zero; - HOST_WIDE_INT hbit_offset; - bool seen_variable_array_ref = false; -- tree base_type; - - /* First get the final access size from just the outermost expression. */ - if (TREE_CODE (exp) == COMPONENT_REF) -@@ -417,8 +416,6 @@ - and find the ultimate containing object. */ - while (1) - { -- base_type = TREE_TYPE (exp); -- - switch (TREE_CODE (exp)) - { - case BIT_FIELD_REF: -@@ -543,7 +540,38 @@ - case VIEW_CONVERT_EXPR: break; - -+ case TARGET_MEM_REF: -+ /* Via the variable index or index2 we can reach the -+ whole object. Still hand back the decl here. */ -+ if (TREE_CODE (TMR_BASE (exp)) == ADDR_EXPR -+ && (TMR_INDEX (exp) || TMR_INDEX2 (exp))) -+ { -+ exp = TREE_OPERAND (TMR_BASE (exp), 0); -+ bit_offset = double_int_zero; -+ maxsize = -1; -+ goto done; -+ } -+ /* Fallthru. */ - case MEM_REF: -+ /* We need to deal with variable arrays ending structures such as -+ struct { int length; int a[1]; } x; x.a[d] -+ struct { struct { int a; int b; } a[1]; } x; x.a[d].a -+ struct { struct { int a[1]; } a[1]; } x; x.a[0][d], x.a[d][0] -+ struct { int len; union { int a[1]; struct X x; } u; } x; x.u.a[d] -+ where we do not know maxsize for variable index accesses to -+ the array. The simplest way to conservatively deal with this -+ is to punt in the case that offset + maxsize reaches the -+ base type boundary. This needs to include possible trailing -+ padding that is there for alignment purposes. */ -+ if (seen_variable_array_ref -+ && maxsize != -1 -+ && (!bit_offset.fits_shwi () -+ || !host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1) -+ || (bit_offset.to_shwi () + maxsize -+ == (HOST_WIDE_INT) TREE_INT_CST_LOW -+ (TYPE_SIZE (TREE_TYPE (exp)))))) -+ maxsize = -1; -+ - /* Hand back the decl for MEM[&decl, off]. */ - if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR) - { -@@ -565,37 +593,6 @@ - } - goto done; - -- case TARGET_MEM_REF: -- /* Hand back the decl for MEM[&decl, off]. */ -- if (TREE_CODE (TMR_BASE (exp)) == ADDR_EXPR) -- { -- /* Via the variable index or index2 we can reach the -- whole object. */ -- if (TMR_INDEX (exp) || TMR_INDEX2 (exp)) -- { -- exp = TREE_OPERAND (TMR_BASE (exp), 0); -- bit_offset = double_int_zero; -- maxsize = -1; -- goto done; -- } -- if (integer_zerop (TMR_OFFSET (exp))) -- exp = TREE_OPERAND (TMR_BASE (exp), 0); -- else -- { -- double_int off = mem_ref_offset (exp); -- off = off.alshift (BITS_PER_UNIT == 8 -- ? 3 : exact_log2 (BITS_PER_UNIT), -- HOST_BITS_PER_DOUBLE_INT); -- off += bit_offset; -- if (off.fits_shwi ()) -- { -- bit_offset = off; -- exp = TREE_OPERAND (TMR_BASE (exp), 0); -- } -- } -- } -- goto done; -- default: - goto done; - } -@@ -602,8 +599,18 @@ +@@ -1718,7 +1737,7 @@ - exp = TREE_OPERAND (exp, 0); - } -+ -+ /* We need to deal with variable arrays ending structures. */ -+ if (seen_variable_array_ref -+ && maxsize != -1 -+ && (!bit_offset.fits_shwi () -+ || !host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1) -+ || (bit_offset.to_shwi () + maxsize -+ == (HOST_WIDE_INT) -+ TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp)))))) -+ maxsize = -1; -+ - done: -- - if (!bit_offset.fits_shwi ()) + if (rhs_class == GIMPLE_BINARY_RHS) { - *poffset = 0; -@@ -615,24 +622,6 @@ - - hbit_offset = bit_offset.to_shwi (); - -- /* We need to deal with variable arrays ending structures such as -- struct { int length; int a[1]; } x; x.a[d] -- struct { struct { int a; int b; } a[1]; } x; x.a[d].a -- struct { struct { int a[1]; } a[1]; } x; x.a[0][d], x.a[d][0] -- struct { int len; union { int a[1]; struct X x; } u; } x; x.u.a[d] -- where we do not know maxsize for variable index accesses to -- the array. The simplest way to conservatively deal with this -- is to punt in the case that offset + maxsize reaches the -- base type boundary. This needs to include possible trailing padding -- that is there for alignment purposes. */ -- -- if (seen_variable_array_ref -- && maxsize != -1 -- && (!host_integerp (TYPE_SIZE (base_type), 1) -- || (hbit_offset + maxsize -- == (signed) TREE_INT_CST_LOW (TYPE_SIZE (base_type))))) -- maxsize = -1; -- - /* In case of a decl or constant base object we can do better. */ - - if (DECL_P (exp)) -Index: gcc/gimple-fold.c -=================================================================== ---- a/src/gcc/gimple-fold.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gimple-fold.c (.../branches/gcc-4_8-branch) -@@ -178,7 +178,7 @@ - /* Make sure we create a cgraph node for functions we'll reference. - They can be non-existent if the reference comes from an entry - of an external vtable for example. */ -- cgraph_get_create_node (base); -+ cgraph_get_create_real_symbol_node (base); - } - /* Fixup types in global initializers. */ - if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) -@@ -866,6 +866,7 @@ - break; - case BUILT_IN_STRCPY: - case BUILT_IN_STRNCPY: -+ case BUILT_IN_STRCAT: - arg_idx = 1; - type = 0; - break; -@@ -941,6 +942,13 @@ - val[1]); - break; - -+ case BUILT_IN_STRCAT: -+ if (val[1] && is_gimple_val (val[1]) && nargs == 2) -+ result = fold_builtin_strcat (loc, gimple_call_arg (stmt, 0), -+ gimple_call_arg (stmt, 1), -+ val[1]); -+ break; -+ - case BUILT_IN_FPUTS: - if (nargs == 2) - result = fold_builtin_fputs (loc, gimple_call_arg (stmt, 0), -Index: gcc/cfgexpand.c -=================================================================== ---- a/src/gcc/cfgexpand.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cfgexpand.c (.../branches/gcc-4_8-branch) -@@ -331,7 +331,7 @@ - enter its partition number into bitmap DATA. */ - - static bool --visit_op (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+visit_op (gimple, tree op, tree, void *data) - { - bitmap active = (bitmap)data; - op = get_base_address (op); -@@ -351,7 +351,7 @@ - from bitmap DATA. */ +- int i; ++ int i, size; + struct symbolic_number n1, n2; + unsigned HOST_WIDEST_INT mask; + tree source_expr2; +@@ -1742,11 +1761,12 @@ + source_expr2 = find_bswap_1 (rhs2_stmt, &n2, limit - 1); - static bool --visit_conflict (gimple stmt ATTRIBUTE_UNUSED, tree op, void *data) -+visit_conflict (gimple, tree op, tree, void *data) - { - bitmap active = (bitmap)data; - op = get_base_address (op); -@@ -385,7 +385,7 @@ - edge e; - edge_iterator ei; - gimple_stmt_iterator gsi; -- bool (*visit)(gimple, tree, void *); -+ walk_stmt_load_store_addr_fn visit; + if (source_expr1 != source_expr2 +- || n1.size != n2.size) ++ || TYPE_PRECISION (n1.type) != TYPE_PRECISION (n2.type)) + return NULL_TREE; - bitmap_clear (work); - FOR_EACH_EDGE (e, ei, bb->preds) -@@ -4707,14 +4707,18 @@ - if (e->insns.r) +- n->size = n1.size; +- for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT) ++ n->type = n1.type; ++ size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; ++ for (i = 0, mask = 0xff; i < size; i++, mask <<= BITS_PER_UNIT) { - rebuild_jump_labels_chain (e->insns.r); -- /* Avoid putting insns before parm_birth_insn. */ -+ /* Put insns after parm birth, but before -+ NOTE_INSNS_FUNCTION_BEG. */ - if (e->src == ENTRY_BLOCK_PTR -- && single_succ_p (ENTRY_BLOCK_PTR) -- && parm_birth_insn) -+ && single_succ_p (ENTRY_BLOCK_PTR)) - { - rtx insns = e->insns.r; - e->insns.r = NULL_RTX; -- emit_insn_after_noloc (insns, parm_birth_insn, e->dest); -+ if (NOTE_P (parm_birth_insn) -+ && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) -+ emit_insn_before_noloc (insns, parm_birth_insn, e->dest); -+ else -+ emit_insn_after_noloc (insns, parm_birth_insn, e->dest); - } - else - commit_one_edge_insertion (e); -Index: gcc/cselib.c -=================================================================== ---- a/src/gcc/cselib.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cselib.c (.../branches/gcc-4_8-branch) -@@ -2260,8 +2260,8 @@ - continue; - } - if (num_mems < PARAM_VALUE (PARAM_MAX_CSELIB_MEMORY_LOCATIONS) -- && ! canon_true_dependence (mem_rtx, GET_MODE (mem_rtx), -- mem_addr, x, NULL_RTX)) -+ && ! canon_anti_dependence (x, false, mem_rtx, -+ GET_MODE (mem_rtx), mem_addr)) - { - has_mem = true; - num_mems++; -Index: gcc/tree-ssa-pre.c -=================================================================== ---- a/src/gcc/tree-ssa-pre.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-pre.c (.../branches/gcc-4_8-branch) -@@ -3664,6 +3664,12 @@ - if (dump_file && dump_flags & TDF_DETAILS) - fprintf (dump_file, "Starting insert iteration %d\n", num_iterations); - new_stuff = insert_aux (ENTRY_BLOCK_PTR); -+ -+ /* Clear the NEW sets before the next iteration. We have already -+ fully propagated its contents. */ -+ if (new_stuff) -+ FOR_ALL_BB (bb) -+ bitmap_set_free (NEW_SETS (bb)); - } - statistics_histogram_event (cfun, "insert iterations", num_iterations); - } -Index: gcc/cfgcleanup.c -=================================================================== ---- a/src/gcc/cfgcleanup.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/cfgcleanup.c (.../branches/gcc-4_8-branch) -@@ -1293,7 +1293,6 @@ - { - rtx i1, i2, last1, last2, afterlast1, afterlast2; - int ninsns = 0; -- rtx p1; - enum replace_direction dir, last_dir, afterlast_dir; - bool follow_fallthru, did_fallthru; - -@@ -1321,8 +1320,9 @@ - || (returnjump_p (i2) && !side_effects_p (PATTERN (i2)))) - { - last2 = i2; -- /* Count everything except for unconditional jump as insn. */ -- if (!simplejump_p (i2) && !returnjump_p (i2) && last1) -+ /* Count everything except for unconditional jump as insn. -+ Don't count any jumps if dir_p is NULL. */ -+ if (!simplejump_p (i2) && !returnjump_p (i2) && last1 && dir_p) - ninsns++; - i2 = PREV_INSN (i2); - } -@@ -1373,8 +1373,8 @@ - last1 = i1, last2 = i2; - afterlast_dir = last_dir; - last_dir = dir; -- p1 = PATTERN (i1); -- if (!(GET_CODE (p1) == USE || GET_CODE (p1) == CLOBBER)) -+ if (GET_CODE (PATTERN (i1)) != USE -+ && GET_CODE (PATTERN (i1)) != CLOBBER) - ninsns++; - } + unsigned HOST_WIDEST_INT masked1, masked2; -@@ -1420,7 +1420,8 @@ - /* Like flow_find_cross_jump, except start looking for a matching sequence from - the head of the two blocks. Do not include jumps at the end. - If STOP_AFTER is nonzero, stop after finding that many matching -- instructions. */ -+ instructions. If STOP_AFTER is zero, count all INSN_P insns, if it is -+ non-zero, only count active insns. */ +@@ -1785,7 +1805,7 @@ - int - flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1, -@@ -1492,7 +1493,10 @@ + struct symbolic_number n; + tree source_expr; +- int limit; ++ int limit, bitsize; - beforelast1 = last1, beforelast2 = last2; - last1 = i1, last2 = i2; -- ninsns++; -+ if (!stop_after -+ || (GET_CODE (PATTERN (i1)) != USE -+ && GET_CODE (PATTERN (i1)) != CLOBBER)) -+ ninsns++; - } + /* The last parameter determines the depth search limit. It usually + correlates directly to the number of bytes to be touched. We +@@ -1800,13 +1820,14 @@ + return NULL_TREE; - if (i1 == BB_END (bb1) || i2 == BB_END (bb2) -Index: gcc/simplify-rtx.c -=================================================================== ---- a/src/gcc/simplify-rtx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/simplify-rtx.c (.../branches/gcc-4_8-branch) -@@ -639,11 +639,16 @@ - XEXP (op, 0), origmode); - } - -- /* Simplify (truncate:SI (op:DI (x:DI) (y:DI))) -- to (op:SI (truncate:SI (x:DI)) (truncate:SI (x:DI))). */ -- if (GET_CODE (op) == PLUS -- || GET_CODE (op) == MINUS -- || GET_CODE (op) == MULT) -+ /* If the machine can perform operations in the truncated mode, distribute -+ the truncation, i.e. simplify (truncate:QI (op:SI (x:SI) (y:SI))) into -+ (op:QI (truncate:QI (x:SI)) (truncate:QI (y:SI))). */ -+ if (1 -+#ifdef WORD_REGISTER_OPERATIONS -+ && precision >= BITS_PER_WORD -+#endif -+ && (GET_CODE (op) == PLUS -+ || GET_CODE (op) == MINUS -+ || GET_CODE (op) == MULT)) + /* Zero out the extra bits of N and CMP. */ +- if (n.size < (int)sizeof (HOST_WIDEST_INT)) ++ bitsize = TYPE_PRECISION (n.type); ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) { - rtx op0 = simplify_gen_unary (TRUNCATE, mode, XEXP (op, 0), op_mode); - if (op0) -Index: gcc/tree-ssa-live.c -=================================================================== ---- a/src/gcc/tree-ssa-live.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-live.c (.../branches/gcc-4_8-branch) -@@ -394,7 +394,8 @@ - { - /* When a global var becomes used for the first time also walk its - initializer (non global ones don't have any). */ -- if (set_is_used (t) && is_global_var (t)) -+ if (set_is_used (t) && is_global_var (t) -+ && DECL_CONTEXT (t) == current_function_decl) - mark_all_vars_used (&DECL_INITIAL (t)); - } - /* remove_unused_scope_block_p requires information about labels -Index: gcc/tree-sra.c -=================================================================== ---- a/src/gcc/tree-sra.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-sra.c (.../branches/gcc-4_8-branch) -@@ -1161,8 +1161,7 @@ - GIMPLE_ASM operands with memory constrains which cannot be scalarized. */ + unsigned HOST_WIDEST_INT mask = +- ((unsigned HOST_WIDEST_INT)1 << (n.size * BITS_PER_UNIT)) - 1; ++ ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; - static bool --asm_visit_addr (gimple stmt ATTRIBUTE_UNUSED, tree op, -- void *data ATTRIBUTE_UNUSED) -+asm_visit_addr (gimple, tree op, tree, void *) - { - op = get_base_address (op); - if (op -@@ -2890,6 +2889,10 @@ - lacc); - else - drhs = NULL_TREE; -+ if (drhs -+ && !useless_type_conversion_p (lacc->type, TREE_TYPE (drhs))) -+ drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, -+ lacc->type, drhs); - ds = gimple_build_debug_bind (get_access_replacement (lacc), - drhs, gsi_stmt (*old_gsi)); - gsi_insert_after (new_gsi, ds, GSI_NEW_STMT); -@@ -4868,6 +4871,14 @@ - return false; + n.n &= mask; +- cmp >>= (sizeof (HOST_WIDEST_INT) - n.size) * BITS_PER_UNIT; ++ cmp >>= sizeof (HOST_WIDEST_INT) * BITS_PER_UNIT - bitsize; } -+ if (!opt_for_fn (node->symbol.decl, optimize) -+ || !opt_for_fn (node->symbol.decl, flag_ipa_sra)) -+ { -+ if (dump_file) -+ fprintf (dump_file, "Function not optimized.\n"); -+ return false; -+ } -+ - if (DECL_VIRTUAL_P (current_function_decl)) - { - if (dump_file) -Index: gcc/tree-predcom.c + /* A complete byte swap should make the symbolic number to start +Index: gcc/tree-ssa-ifcombine.c =================================================================== ---- a/src/gcc/tree-predcom.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-predcom.c (.../branches/gcc-4_8-branch) -@@ -1323,90 +1323,43 @@ - gsi_insert_after (&bsi, new_stmt, GSI_NEW_STMT); - } - --/* Returns the reference to the address of REF in the ITER-th iteration of -- LOOP, or NULL if we fail to determine it (ITER may be negative). We -- try to preserve the original shape of the reference (not rewrite it -- as an indirect ref to the address), to make tree_could_trap_p in -- prepare_initializers_chain return false more often. */ -+/* Returns a memory reference to DR in the ITER-th iteration of -+ the loop it was analyzed in. Append init stmts to STMTS. */ - --static tree --ref_at_iteration (struct loop *loop, tree ref, int iter) -+static tree -+ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts) - { -- tree idx, *idx_p, type, val, op0 = NULL_TREE, ret; -- affine_iv iv; -- bool ok; -- -- if (handled_component_p (ref)) -+ tree off = DR_OFFSET (dr); -+ tree coff = DR_INIT (dr); -+ if (iter == 0) -+ ; -+ else if (TREE_CODE (DR_STEP (dr)) == INTEGER_CST) -+ coff = size_binop (PLUS_EXPR, coff, -+ size_binop (MULT_EXPR, DR_STEP (dr), ssize_int (iter))); -+ else -+ off = size_binop (PLUS_EXPR, off, -+ size_binop (MULT_EXPR, DR_STEP (dr), ssize_int (iter))); -+ tree addr = fold_build_pointer_plus (DR_BASE_ADDRESS (dr), off); -+ addr = force_gimple_operand_1 (addr, stmts, is_gimple_mem_ref_addr, -+ NULL_TREE); -+ tree alias_ptr = fold_convert (reference_alias_ptr_type (DR_REF (dr)), coff); -+ /* While data-ref analysis punts on bit offsets it still handles -+ bitfield accesses at byte boundaries. Cope with that. Note that -+ we cannot simply re-apply the outer COMPONENT_REF because the -+ byte-granular portion of it is already applied via DR_INIT and -+ DR_OFFSET, so simply build a BIT_FIELD_REF knowing that the bits -+ start at offset zero. */ -+ if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF -+ && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1))) +--- a/src/gcc/tree-ssa-ifcombine.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/tree-ssa-ifcombine.c (.../branches/gcc-4_8-branch) +@@ -105,7 +105,11 @@ { -- op0 = ref_at_iteration (loop, TREE_OPERAND (ref, 0), iter); -- if (!op0) -- return NULL_TREE; -+ tree field = TREE_OPERAND (DR_REF (dr), 1); -+ return build3 (BIT_FIELD_REF, TREE_TYPE (DR_REF (dr)), -+ build2 (MEM_REF, DECL_BIT_FIELD_TYPE (field), -+ addr, alias_ptr), -+ DECL_SIZE (field), bitsize_zero_node); - } -- else if (!INDIRECT_REF_P (ref) -- && TREE_CODE (ref) != MEM_REF) -- return unshare_expr (ref); -- -- if (TREE_CODE (ref) == MEM_REF) -- { -- ret = unshare_expr (ref); -- idx = TREE_OPERAND (ref, 0); -- idx_p = &TREE_OPERAND (ret, 0); -- } -- else if (TREE_CODE (ref) == COMPONENT_REF) -- { -- /* Check that the offset is loop invariant. */ -- if (TREE_OPERAND (ref, 2) -- && !expr_invariant_in_loop_p (loop, TREE_OPERAND (ref, 2))) -- return NULL_TREE; -- -- return build3 (COMPONENT_REF, TREE_TYPE (ref), op0, -- unshare_expr (TREE_OPERAND (ref, 1)), -- unshare_expr (TREE_OPERAND (ref, 2))); -- } -- else if (TREE_CODE (ref) == ARRAY_REF) -- { -- /* Check that the lower bound and the step are loop invariant. */ -- if (TREE_OPERAND (ref, 2) -- && !expr_invariant_in_loop_p (loop, TREE_OPERAND (ref, 2))) -- return NULL_TREE; -- if (TREE_OPERAND (ref, 3) -- && !expr_invariant_in_loop_p (loop, TREE_OPERAND (ref, 3))) -- return NULL_TREE; -- -- ret = build4 (ARRAY_REF, TREE_TYPE (ref), op0, NULL_TREE, -- unshare_expr (TREE_OPERAND (ref, 2)), -- unshare_expr (TREE_OPERAND (ref, 3))); -- idx = TREE_OPERAND (ref, 1); -- idx_p = &TREE_OPERAND (ret, 1); -- } - else -- return NULL_TREE; -- -- ok = simple_iv (loop, loop, idx, &iv, true); -- if (!ok) -- return NULL_TREE; -- iv.base = expand_simple_operations (iv.base); -- if (integer_zerop (iv.step)) -- *idx_p = unshare_expr (iv.base); -- else -- { -- type = TREE_TYPE (iv.base); -- if (POINTER_TYPE_P (type)) -- { -- val = fold_build2 (MULT_EXPR, sizetype, iv.step, -- size_int (iter)); -- val = fold_build_pointer_plus (iv.base, val); -- } -- else -- { -- val = fold_build2 (MULT_EXPR, type, iv.step, -- build_int_cst_type (type, iter)); -- val = fold_build2 (PLUS_EXPR, type, iv.base, val); -- } -- *idx_p = unshare_expr (val); -- } -- -- return ret; -+ return fold_build2 (MEM_REF, TREE_TYPE (DR_REF (dr)), addr, alias_ptr); - } - - /* Get the initialization expression for the INDEX-th temporary variable -@@ -2068,7 +2021,11 @@ - - stmt = find_common_use_stmt (&name1, &name2); - -- if (!stmt) -+ if (!stmt -+ /* A simple post-dominance check - make sure the combination -+ is executed under the same condition as the references. */ -+ || (gimple_bb (stmt) != gimple_bb (r1->stmt) -+ && gimple_bb (stmt) != gimple_bb (r2->stmt))) - return false; - - acode = gimple_assign_rhs_code (stmt); -@@ -2365,14 +2322,10 @@ - if (chain->inits[i] != NULL_TREE) - continue; - -- init = ref_at_iteration (loop, DR_REF (dr), (int) i - n); -- if (!init) -- return false; -- -+ init = ref_at_iteration (dr, (int) i - n, &stmts); - if (!chain->all_always_accessed && tree_could_trap_p (init)) - return false; + gimple stmt = gsi_stmt (gsi); -- init = force_gimple_operand (init, &stmts, false, NULL_TREE); - if (stmts) - gsi_insert_seq_on_edge_immediate (entry, stmts); - -@@ -2449,6 +2402,7 @@ - if (!components) - { - free_data_refs (datarefs); -+ free_affine_expand_cache (&name_expansions); - return false; - } - -Index: gcc/loop-iv.c -=================================================================== ---- a/src/gcc/loop-iv.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/loop-iv.c (.../branches/gcc-4_8-branch) -@@ -425,7 +425,9 @@ - && !iv->first_special) - { - rtx val = get_iv_value (iv, const0_rtx); -- val = lowpart_subreg (mode, val, iv->extend_mode); -+ val = lowpart_subreg (mode, val, -+ iv->extend == IV_UNKNOWN_EXTEND -+ ? iv->mode : iv->extend_mode); - - iv->base = val; - iv->extend = IV_UNKNOWN_EXTEND; -@@ -465,8 +467,14 @@ - && !iv->first_special) - { - rtx val = get_iv_value (iv, const0_rtx); -+ if (iv->extend_mode != iv->mode -+ && iv->extend != IV_UNKNOWN_EXTEND -+ && iv->extend != extend) -+ val = lowpart_subreg (iv->mode, val, iv->extend_mode); - val = simplify_gen_unary (iv_extend_to_rtx_code (extend), mode, -- val, iv->extend_mode); -+ val, -+ iv->extend == extend -+ ? iv->extend_mode : iv->mode); - iv->base = val; - iv->extend = IV_UNKNOWN_EXTEND; - iv->mode = iv->extend_mode = mode; -Index: gcc/ipa-prop.c -=================================================================== ---- a/src/gcc/ipa-prop.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ipa-prop.c (.../branches/gcc-4_8-branch) -@@ -623,16 +623,22 @@ - if (parm_ainfo && parm_ainfo->parm_modified) - return false; - -- gcc_checking_assert (gimple_vuse (stmt) != NULL_TREE); -- ao_ref_init (&refd, parm_load); -- /* We can cache visited statements only when parm_ainfo is available and when -- we are looking at a naked load of the whole parameter. */ -- if (!parm_ainfo || TREE_CODE (parm_load) != PARM_DECL) -- visited_stmts = NULL; -+ if (optimize) -+ { -+ gcc_checking_assert (gimple_vuse (stmt) != NULL_TREE); -+ ao_ref_init (&refd, parm_load); -+ /* We can cache visited statements only when parm_ainfo is available and -+ when we are looking at a naked load of the whole parameter. */ -+ if (!parm_ainfo || TREE_CODE (parm_load) != PARM_DECL) -+ visited_stmts = NULL; -+ else -+ visited_stmts = &parm_ainfo->parm_visited_statements; -+ walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified, -+ visited_stmts); -+ } - else -- visited_stmts = &parm_ainfo->parm_visited_statements; -- walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified, -- visited_stmts); -+ modified = true; ++ if (is_gimple_debug (stmt)) ++ continue; + - if (parm_ainfo && modified) - parm_ainfo->parm_modified = true; - return !modified; -@@ -740,7 +746,7 @@ - ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor_t> descriptors, - struct param_analysis_info *parms_ainfo, gimple stmt, - tree op, int *index_p, HOST_WIDE_INT *offset_p, -- bool *by_ref_p) -+ HOST_WIDE_INT *size_p, bool *by_ref_p) - { - int index; - HOST_WIDE_INT size, max_size; -@@ -758,6 +764,8 @@ - { - *index_p = index; - *by_ref_p = false; -+ if (size_p) -+ *size_p = size; - return true; - } - return false; -@@ -800,6 +808,8 @@ - { - *index_p = index; - *by_ref_p = true; -+ if (size_p) -+ *size_p = size; - return true; + if (gimple_has_side_effects (stmt) ++ || gimple_could_trap_p (stmt) + || gimple_vuse (stmt)) + return false; } - return false; -@@ -814,7 +824,7 @@ - bool *by_ref_p) - { - return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p, -- offset_p, by_ref_p); -+ offset_p, NULL, by_ref_p); +@@ -197,7 +201,8 @@ + while (is_gimple_assign (stmt) + && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)) + && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt))) +- <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))) ++ <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))) ++ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME) + || gimple_assign_ssa_name_copy_p (stmt))) + stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); + +Index: gcc/sel-sched-ir.c +=================================================================== +--- a/src/gcc/sel-sched-ir.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/sel-sched-ir.c (.../branches/gcc-4_8-branch) +@@ -162,7 +162,7 @@ + static void free_av_set (basic_block); + static void invalidate_av_set (basic_block); + static void extend_insn_data (void); +-static void sel_init_new_insn (insn_t, int); ++static void sel_init_new_insn (insn_t, int, int = -1); + static void finish_insns (void); + + /* Various list functions. */ +@@ -4011,9 +4011,10 @@ + return seqno; } - /* Given that an actual argument is an SSA_NAME (given in NAME) and is a result -@@ -1051,7 +1061,8 @@ - return; - parm = TREE_OPERAND (expr, 0); - index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm)); -- gcc_assert (index >= 0); -+ if (index < 0) -+ return; - - cond_bb = single_pred (assign_bb); - cond = last_stmt (cond_bb); -@@ -1462,6 +1473,9 @@ - { - struct cgraph_edge *cs; - -+ if (!optimize) -+ return; -+ - for (cs = node->callees; cs; cs = cs->next_callee) - { - struct cgraph_node *callee = cgraph_function_or_thunk_node (cs->callee, -@@ -1646,7 +1660,7 @@ - if (gimple_assign_single_p (def) - && ipa_load_from_parm_agg_1 (info->descriptors, parms_ainfo, def, - gimple_assign_rhs1 (def), &index, &offset, -- &by_ref)) -+ NULL, &by_ref)) - { - struct cgraph_edge *cs = ipa_note_param_call (node, index, call); - cs->indirect_info->offset = offset; -@@ -1847,8 +1861,7 @@ - passed in DATA. */ - - static bool --visit_ref_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED, -- tree op, void *data) -+visit_ref_for_mod_analysis (gimple, tree op, tree, void *data) +-/* Compute seqno for INSN by its preds or succs. */ ++/* Compute seqno for INSN by its preds or succs. Use OLD_SEQNO to compute ++ seqno in corner cases. */ + static int +-get_seqno_for_a_jump (insn_t insn) ++get_seqno_for_a_jump (insn_t insn, int old_seqno) { - struct ipa_node_params *info = (struct ipa_node_params *) data; - -@@ -2126,7 +2139,6 @@ - we may create the first reference to the object in the unit. */ - if (!callee || callee->global.inlined_to) - { -- struct cgraph_node *first_clone = callee; - - /* We are better to ensure we can refer to it. - In the case of static functions we are out of luck, since we already -@@ -2142,31 +2154,7 @@ - xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid); - return NULL; - } -- -- /* Create symbol table node. Even if inline clone exists, we can not take -- it as a target of non-inlined call. */ -- callee = cgraph_create_node (target); -- -- /* OK, we previously inlined the function, then removed the offline copy and -- now we want it back for external call. This can happen when devirtualizing -- while inlining function called once that happens after extern inlined and -- virtuals are already removed. In this case introduce the external node -- and make it available for call. */ -- if (first_clone) -- { -- first_clone->clone_of = callee; -- callee->clones = first_clone; -- symtab_prevail_in_asm_name_hash ((symtab_node)callee); -- symtab_insert_node_to_hashtable ((symtab_node)callee); -- if (dump_file) -- fprintf (dump_file, "ipa-prop: Introduced new external node " -- "(%s/%i) and turned into root of the clone tree.\n", -- xstrdup (cgraph_node_name (callee)), callee->uid); -- } -- else if (dump_file) -- fprintf (dump_file, "ipa-prop: Introduced new external node " -- "(%s/%i).\n", -- xstrdup (cgraph_node_name (callee)), callee->uid); -+ callee = cgraph_get_create_real_symbol_node (target); - } - ipa_check_create_node_params (); - -@@ -3902,7 +3890,7 @@ - struct ipa_agg_replacement_value *v; - gimple stmt = gsi_stmt (gsi); - tree rhs, val, t; -- HOST_WIDE_INT offset; -+ HOST_WIDE_INT offset, size; - int index; - bool by_ref, vce; - -@@ -3929,13 +3917,15 @@ - continue; - - if (!ipa_load_from_parm_agg_1 (descriptors, parms_ainfo, stmt, -- rhs, &index, &offset, &by_ref)) -+ rhs, &index, &offset, &size, &by_ref)) - continue; - for (v = aggval; v; v = v->next) - if (v->index == index - && v->offset == offset) - break; -- if (!v || v->by_ref != by_ref) -+ if (!v -+ || v->by_ref != by_ref -+ || tree_low_cst (TYPE_SIZE (TREE_TYPE (v->value)), 0) != size) - continue; - - gcc_checking_assert (is_gimple_ip_invariant (v->value)); -Index: gcc/tree-ssa-dce.c -=================================================================== ---- a/src/gcc/tree-ssa-dce.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-dce.c (.../branches/gcc-4_8-branch) -@@ -1307,26 +1307,19 @@ - stats.total++; - - /* We can mark a call to free as not necessary if the -- defining statement of its argument is an allocation -- function and that is not necessary itself. */ -- if (gimple_call_builtin_p (stmt, BUILT_IN_FREE)) -+ defining statement of its argument is not necessary -+ (and thus is getting removed). */ -+ if (gimple_plf (stmt, STMT_NECESSARY) -+ && gimple_call_builtin_p (stmt, BUILT_IN_FREE)) - { - tree ptr = gimple_call_arg (stmt, 0); -- tree callee2; -- gimple def_stmt; -- if (TREE_CODE (ptr) != SSA_NAME) -- continue; -- def_stmt = SSA_NAME_DEF_STMT (ptr); -- if (!is_gimple_call (def_stmt) -- || gimple_plf (def_stmt, STMT_NECESSARY)) -- continue; -- callee2 = gimple_call_fndecl (def_stmt); -- if (callee2 == NULL_TREE -- || DECL_BUILT_IN_CLASS (callee2) != BUILT_IN_NORMAL -- || (DECL_FUNCTION_CODE (callee2) != BUILT_IN_MALLOC -- && DECL_FUNCTION_CODE (callee2) != BUILT_IN_CALLOC)) -- continue; -- gimple_set_plf (stmt, STMT_NECESSARY, false); -+ if (TREE_CODE (ptr) == SSA_NAME) -+ { -+ gimple def_stmt = SSA_NAME_DEF_STMT (ptr); -+ if (!gimple_nop_p (def_stmt) -+ && !gimple_plf (def_stmt, STMT_NECESSARY)) -+ gimple_set_plf (stmt, STMT_NECESSARY, false); -+ } - } - - /* If GSI is not necessary then remove it. */ -Index: gcc/tree-ssa-ter.c -=================================================================== ---- a/src/gcc/tree-ssa-ter.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-ter.c (.../branches/gcc-4_8-branch) -@@ -590,6 +590,30 @@ - } - - -+/* Helper function for find_ssaname_in_stores. Called via walk_tree to -+ find a SSA_NAME DATA somewhere in *TP. */ -+ -+static tree -+find_ssaname (tree *tp, int *walk_subtrees, void *data) -+{ -+ tree var = (tree) data; -+ if (*tp == var) -+ return var; -+ else if (IS_TYPE_OR_DECL_P (*tp)) -+ *walk_subtrees = 0; -+ return NULL_TREE; -+} -+ -+/* Helper function for find_replaceable_in_bb. Return true if SSA_NAME DATA -+ is used somewhere in T, which is a store in the statement. Called via -+ walk_stmt_load_store_addr_ops. */ -+ -+static bool -+find_ssaname_in_store (gimple, tree, tree t, void *data) -+{ -+ return walk_tree (&t, find_ssaname, data, NULL) != NULL_TREE; -+} -+ - /* This function processes basic block BB, and looks for variables which can - be replaced by their expressions. Results are stored in the table TAB. */ + int seqno; -@@ -643,8 +667,7 @@ - /* If the stmt does a memory store and the replacement - is a load aliasing it avoid creating overlapping - assignments which we cannot expand correctly. */ -- if (gimple_vdef (stmt) -- && gimple_assign_single_p (stmt)) -+ if (gimple_vdef (stmt)) - { - gimple def_stmt = SSA_NAME_DEF_STMT (use); - while (is_gimple_assign (def_stmt) -@@ -653,9 +676,29 @@ - = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt)); - if (gimple_vuse (def_stmt) - && gimple_assign_single_p (def_stmt) -- && refs_may_alias_p (gimple_assign_lhs (stmt), -- gimple_assign_rhs1 (def_stmt))) -- same_root_var = true; -+ && stmt_may_clobber_ref_p (stmt, -+ gimple_assign_rhs1 (def_stmt))) -+ { -+ /* For calls, it is not a problem if USE is among -+ call's arguments or say OBJ_TYPE_REF argument, -+ all those necessarily need to be evaluated before -+ the call that may clobber the memory. But if -+ LHS of the call refers to USE, expansion might -+ evaluate it after the call, prevent TER in that -+ case. -+ For inline asm, allow TER of loads into input -+ arguments, but disallow TER for USEs that occur -+ somewhere in outputs. */ -+ if (is_gimple_call (stmt) -+ || gimple_code (stmt) == GIMPLE_ASM) -+ { -+ if (walk_stmt_load_store_ops (stmt, use, NULL, -+ find_ssaname_in_store)) -+ same_root_var = true; -+ } -+ else -+ same_root_var = true; -+ } - } - - /* Mark expression as replaceable unless stmt is volatile, or the -Index: gcc/ira.c -=================================================================== ---- a/src/gcc/ira.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/ira.c (.../branches/gcc-4_8-branch) -@@ -4742,6 +4742,18 @@ - if (need_dce && optimize) - run_fast_dce (); +@@ -4069,8 +4070,16 @@ + if (seqno < 0) + seqno = get_seqno_by_succs (insn); -+ /* Diagnose uses of the hard frame pointer when it is used as a global -+ register. Often we can get away with letting the user appropriate -+ the frame pointer, but we should let them know when code generation -+ makes that impossible. */ -+ if (global_regs[HARD_FRAME_POINTER_REGNUM] && frame_pointer_needed) ++ if (seqno < 0) + { -+ tree decl = global_regs_decl[HARD_FRAME_POINTER_REGNUM]; -+ error_at (DECL_SOURCE_LOCATION (current_function_decl), -+ "frame pointer required, but reserved"); -+ inform (DECL_SOURCE_LOCATION (decl), "for %qD", decl); ++ /* The only case where this could be here legally is that the only ++ unscheduled insn was a conditional jump that got removed and turned ++ into this unconditional one. Initialize from the old seqno ++ of that jump passed down to here. */ ++ seqno = old_seqno; + } + - timevar_pop (TV_IRA); + gcc_assert (seqno >= 0); +- + return seqno; } - -Index: gcc/rtl.h -=================================================================== ---- a/src/gcc/rtl.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/rtl.h (.../branches/gcc-4_8-branch) -@@ -2705,6 +2705,8 @@ - const_rtx, rtx); - extern int read_dependence (const_rtx, const_rtx); - extern int anti_dependence (const_rtx, const_rtx); -+extern int canon_anti_dependence (const_rtx, bool, -+ const_rtx, enum machine_mode, rtx); - extern int output_dependence (const_rtx, const_rtx); - extern int may_alias_p (const_rtx, const_rtx); - extern void init_alias_target (void); -@@ -2789,6 +2791,8 @@ - #define fatal_insn_not_found(insn) \ - _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) - -+/* reginfo.c */ -+extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER]; - - - #endif /* ! GCC_RTL_H */ -Index: gcc/tree-vect-stmts.c -=================================================================== ---- a/src/gcc/tree-vect-stmts.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-vect-stmts.c (.../branches/gcc-4_8-branch) -@@ -4369,6 +4369,20 @@ - return false; - } - -+ /* Invalidate assumptions made by dependence analysis when vectorization -+ on the unrolled body effectively re-orders stmts. */ -+ if (ncopies > 1 -+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0 -+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo) -+ > STMT_VINFO_MIN_NEG_DIST (stmt_info))) -+ { -+ if (dump_enabled_p ()) -+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, -+ "cannot perform implicit CSE when unrolling " -+ "with negative dependence distance\n"); -+ return false; -+ } -+ - if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) - return false; - -@@ -4425,6 +4439,20 @@ - else if (!vect_grouped_load_supported (vectype, group_size)) - return false; - } -+ -+ /* Invalidate assumptions made by dependence analysis when vectorization -+ on the unrolled body effectively re-orders stmts. */ -+ if (!PURE_SLP_STMT (stmt_info) -+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0 -+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo) -+ > STMT_VINFO_MIN_NEG_DIST (stmt_info))) -+ { -+ if (dump_enabled_p ()) -+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, -+ "cannot perform implicit CSE when performing " -+ "group loads with negative dependence distance\n"); -+ return false; -+ } - } - -@@ -6054,8 +6082,7 @@ - corresponding to that mode. The theory is that any use that - would cause problems with this will disable vectorization anyway. */ - else if (!SCALAR_FLOAT_TYPE_P (scalar_type) -- && !INTEGRAL_TYPE_P (scalar_type) -- && !POINTER_TYPE_P (scalar_type)) -+ && !INTEGRAL_TYPE_P (scalar_type)) - scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1); - - /* We can't build a vector type of elements with alignment bigger than -Index: gcc/tree-ssa-phiprop.c -=================================================================== ---- a/src/gcc/tree-ssa-phiprop.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-phiprop.c (.../branches/gcc-4_8-branch) -@@ -307,6 +307,12 @@ - gimple def_stmt; - tree vuse; - -+ /* Only replace loads in blocks that post-dominate the PHI node. That -+ makes sure we don't end up speculating loads. */ -+ if (!dominated_by_p (CDI_POST_DOMINATORS, -+ bb, gimple_bb (use_stmt))) -+ continue; -+ - /* Check whether this is a load of *ptr. */ - if (!(is_gimple_assign (use_stmt) - && TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME -@@ -378,6 +384,7 @@ - size_t n; - - calculate_dominance_info (CDI_DOMINATORS); -+ calculate_dominance_info (CDI_POST_DOMINATORS); - - n = num_ssa_names; - phivn = XCNEWVEC (struct phiprop_d, n); -@@ -395,6 +402,8 @@ - bbs.release (); - free (phivn); - -+ free_dominance_info (CDI_POST_DOMINATORS); -+ - return 0; +@@ -4250,22 +4259,24 @@ } -Index: gcc/tree-object-size.c -=================================================================== ---- a/src/gcc/tree-object-size.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-object-size.c (.../branches/gcc-4_8-branch) -@@ -64,7 +64,7 @@ - the subobject (innermost array or field with address taken). - object_sizes[2] is lower bound for number of bytes till the end of - the object and object_sizes[3] lower bound for subobject. */ --static unsigned HOST_WIDE_INT *object_sizes[4]; -+static vec<unsigned HOST_WIDE_INT> object_sizes[4]; - - /* Bitmaps what object sizes have been computed already. */ - static bitmap computed[4]; -@@ -493,7 +493,7 @@ - - if (TREE_CODE (ptr) == SSA_NAME - && POINTER_TYPE_P (TREE_TYPE (ptr)) -- && object_sizes[object_size_type] != NULL) -+ && computed[object_size_type] != NULL) - { - if (!bitmap_bit_p (computed[object_size_type], SSA_NAME_VERSION (ptr))) - { -@@ -501,6 +501,8 @@ - bitmap_iterator bi; - unsigned int i; - -+ if (num_ssa_names > object_sizes[object_size_type].length ()) -+ object_sizes[object_size_type].safe_grow (num_ssa_names); - if (dump_file) - { - fprintf (dump_file, "Computing %s %sobject size for ", -@@ -1162,12 +1164,12 @@ + /* This is used to initialize spurious jumps generated by +- sel_redirect_edge (). */ ++ sel_redirect_edge (). OLD_SEQNO is used for initializing seqnos ++ in corner cases within get_seqno_for_a_jump. */ + static void +-init_simplejump_data (insn_t insn) ++init_simplejump_data (insn_t insn, int old_seqno) { - int object_size_type; - -- if (object_sizes[0]) -+ if (computed[0]) - return; - - for (object_size_type = 0; object_size_type <= 3; object_size_type++) - { -- object_sizes[object_size_type] = XNEWVEC (unsigned HOST_WIDE_INT, num_ssa_names); -+ object_sizes[object_size_type].safe_grow (num_ssa_names); - computed[object_size_type] = BITMAP_ALLOC (NULL); - } - -@@ -1184,9 +1186,8 @@ - - for (object_size_type = 0; object_size_type <= 3; object_size_type++) - { -- free (object_sizes[object_size_type]); -+ object_sizes[object_size_type].release (); - BITMAP_FREE (computed[object_size_type]); -- object_sizes[object_size_type] = NULL; - } + init_expr (INSN_EXPR (insn), vinsn_create (insn, false), 0, + REG_BR_PROB_BASE, 0, 0, 0, 0, 0, 0, + vNULL, true, false, false, + false, true); +- INSN_SEQNO (insn) = get_seqno_for_a_jump (insn); ++ INSN_SEQNO (insn) = get_seqno_for_a_jump (insn, old_seqno); + init_first_time_insn_data (insn); } -@@ -1202,18 +1203,11 @@ - gimple_stmt_iterator i; - for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) - { -- tree callee, result; -+ tree result; - gimple call = gsi_stmt (i); -- -- if (gimple_code (call) != GIMPLE_CALL) -+ if (!gimple_call_builtin_p (call, BUILT_IN_OBJECT_SIZE)) - continue; - -- callee = gimple_call_fndecl (call); -- if (!callee -- || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL -- || DECL_FUNCTION_CODE (callee) != BUILT_IN_OBJECT_SIZE) -- continue; -- - init_object_sizes (); - result = fold_call_stmt (call, false); - if (!result) -@@ -1240,20 +1234,32 @@ - continue; - } - -+ gcc_assert (TREE_CODE (result) == INTEGER_CST); -+ - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Simplified\n "); - print_gimple_stmt (dump_file, call, 0, dump_flags); -+ fprintf (dump_file, " to "); -+ print_generic_expr (dump_file, result, 0); -+ fprintf (dump_file, "\n"); - } - -- if (!update_call_from_tree (&i, result)) -- gcc_unreachable (); -+ tree lhs = gimple_call_lhs (call); -+ if (!lhs) -+ continue; - -- if (dump_file && (dump_flags & TDF_DETAILS)) -+ /* Propagate into all uses and fold those stmts. */ -+ gimple use_stmt; -+ imm_use_iterator iter; -+ FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs) - { -- fprintf (dump_file, "to\n "); -- print_gimple_stmt (dump_file, gsi_stmt (i), 0, dump_flags); -- fprintf (dump_file, "\n"); -+ use_operand_p use_p; -+ FOR_EACH_IMM_USE_ON_STMT (use_p, iter) -+ SET_USE (use_p, result); -+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt); -+ fold_stmt (&gsi); -+ update_stmt (gsi_stmt (gsi)); - } - } - } -Index: gcc/combine.c -=================================================================== ---- a/src/gcc/combine.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/combine.c (.../branches/gcc-4_8-branch) -@@ -3884,15 +3884,19 @@ - - PATTERN (undobuf.other_insn) = other_pat; - -- /* If any of the notes in OTHER_INSN were REG_UNUSED, ensure that they -- are still valid. Then add any non-duplicate notes added by -- recog_for_combine. */ -+ /* If any of the notes in OTHER_INSN were REG_DEAD or REG_UNUSED, -+ ensure that they are still valid. Then add any non-duplicate -+ notes added by recog_for_combine. */ - for (note = REG_NOTES (undobuf.other_insn); note; note = next) - { - next = XEXP (note, 1); - -- if (REG_NOTE_KIND (note) == REG_UNUSED -- && ! reg_set_p (XEXP (note, 0), PATTERN (undobuf.other_insn))) -+ if ((REG_NOTE_KIND (note) == REG_DEAD -+ && !reg_referenced_p (XEXP (note, 0), -+ PATTERN (undobuf.other_insn))) -+ ||(REG_NOTE_KIND (note) == REG_UNUSED -+ && !reg_set_p (XEXP (note, 0), -+ PATTERN (undobuf.other_insn)))) - remove_note (undobuf.other_insn, note); - } - -@@ -5798,8 +5802,15 @@ - return x; - } - -- /* If the code changed, return a whole new comparison. */ -- if (new_code != code) -+ /* If the code changed, return a whole new comparison. -+ We also need to avoid using SUBST in cases where -+ simplify_comparison has widened a comparison with a CONST_INT, -+ since in that case the wider CONST_INT may fail the sanity -+ checks in do_SUBST. */ -+ if (new_code != code -+ || (CONST_INT_P (op1) -+ && GET_MODE (op0) != GET_MODE (XEXP (x, 0)) -+ && GET_MODE (op0) != GET_MODE (XEXP (x, 1)))) - return gen_rtx_fmt_ee (new_code, mode, op0, op1); - - /* Otherwise, keep this operation, but maybe change its operands. -@@ -7991,7 +8002,7 @@ - if (code == CALL || code == ASM_OPERANDS || code == CLOBBER) - return x; - -- /* We want to perform the operation is its present mode unless we know -+ /* We want to perform the operation in its present mode unless we know - that the operation is valid in MODE, in which case we do the operation - in MODE. */ - op_mode = ((GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (x)) -@@ -8427,9 +8438,10 @@ - GET_MODE (x), GEN_INT (mask), - XEXP (x, 1)); - if (temp && CONST_INT_P (temp)) -- SUBST (XEXP (x, 0), -- force_to_mode (XEXP (x, 0), GET_MODE (x), -- INTVAL (temp), next_select)); -+ x = simplify_gen_binary (code, GET_MODE (x), -+ force_to_mode (XEXP (x, 0), GET_MODE (x), -+ INTVAL (temp), next_select), -+ XEXP (x, 1)); - } - break; - -@@ -8497,14 +8509,16 @@ - /* We have no way of knowing if the IF_THEN_ELSE can itself be - written in a narrower mode. We play it safe and do not do so. */ - -- SUBST (XEXP (x, 1), -- gen_lowpart_or_truncate (GET_MODE (x), -- force_to_mode (XEXP (x, 1), mode, -- mask, next_select))); -- SUBST (XEXP (x, 2), -- gen_lowpart_or_truncate (GET_MODE (x), -- force_to_mode (XEXP (x, 2), mode, -- mask, next_select))); -+ op0 = gen_lowpart_or_truncate (GET_MODE (x), -+ force_to_mode (XEXP (x, 1), mode, -+ mask, next_select)); -+ op1 = gen_lowpart_or_truncate (GET_MODE (x), -+ force_to_mode (XEXP (x, 2), mode, -+ mask, next_select)); -+ if (op0 != XEXP (x, 1) || op1 != XEXP (x, 2)) -+ x = simplify_gen_ternary (IF_THEN_ELSE, GET_MODE (x), -+ GET_MODE (XEXP (x, 0)), XEXP (x, 0), -+ op0, op1); - break; - - default: -Index: gcc/bb-reorder.c -=================================================================== ---- a/src/gcc/bb-reorder.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/bb-reorder.c (.../branches/gcc-4_8-branch) -@@ -1685,9 +1685,8 @@ - edge e; - edge_iterator ei; - -- /* Find EDGE_CAN_FALLTHRU edge. */ - FOR_EACH_EDGE (e, ei, cur_bb->succs) -- if (e->flags & EDGE_CAN_FALLTHRU) -+ if (e->flags & EDGE_FALLTHRU) - { - fall_thru = e; - break; -Index: gcc/tree-flow.h -=================================================================== ---- a/src/gcc/tree-flow.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-flow.h (.../branches/gcc-4_8-branch) -@@ -425,6 +425,7 @@ - basic_block, tree); - void remove_edge_and_dominated_blocks (edge); - bool tree_node_can_be_shared (tree); -+extern unsigned int split_critical_edges (void); - - /* In tree-cfgcleanup.c */ - extern bitmap cfgcleanup_altered_bbs; -Index: gcc/config.gcc -=================================================================== ---- a/src/gcc/config.gcc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config.gcc (.../branches/gcc-4_8-branch) -@@ -420,7 +420,7 @@ - ;; - powerpc*-*-*) - cpu_type=rs6000 -- extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h" -+ extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h" - need_64bit_hwint=yes - case x$with_cpu in - xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500) -@@ -1761,6 +1761,14 @@ - tmake_file="${tmake_file} microblaze/t-microblaze-linux" - ;; - microblaze*-*-rtems*) -+ case $target in -+ microblazeel-*) -+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0" -+ ;; -+ microblaze-*) -+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321" -+ ;; -+ esac - tm_file="${tm_file} dbxelf.h" - tm_file="${tm_file} microblaze/rtems.h rtems.h newlib-stdint.h" - c_target_objs="${c_target_objs} microblaze-c.o" -@@ -2073,7 +2081,7 @@ - tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" - case ${target} in - powerpc*le-*-*) -- tm_file="${tm_file} rs6000/sysv4le.h" ;; -+ tm_file="${tm_file} rs6000/sysv4le.h" ;; - esac - maybe_biarch=yes - case ${target} in -@@ -2096,6 +2104,19 @@ - fi - tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h" - tmake_file="$tmake_file rs6000/t-linux64" -+ case ${target} in -+ powerpc*le-*-*) -+ tmake_file="$tmake_file rs6000/t-linux64le" -+ case ${enable_targets} in -+ all | *powerpc64-* | *powerpc-*) -+ tmake_file="$tmake_file rs6000/t-linux64lebe" ;; -+ esac ;; -+ *) -+ case ${enable_targets} in -+ all | *powerpc64le-* | *powerpcle-*) -+ tmake_file="$tmake_file rs6000/t-linux64bele" ;; -+ esac ;; -+ esac - extra_options="${extra_options} rs6000/linux64.opt" - ;; - *) -@@ -2963,11 +2984,18 @@ - with_cpu=8540 - fi - ;; -- sparc-leon*-*) -- with_cpu=v8; -- ;; - sparc*-*-*) -- with_cpu="`echo ${target} | sed 's/-.*$//'`" -+ case ${target} in -+ *-leon-*) -+ with_cpu=leon -+ ;; -+ *-leon[3-9]*) -+ with_cpu=leon3 -+ ;; -+ *) -+ with_cpu="`echo ${target} | sed 's/-.*$//'`" -+ ;; -+ esac - ;; - esac - -@@ -3494,7 +3522,7 @@ - ;; - - powerpc*-*-* | rs6000-*-*) -- supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64" -+ supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64" - - for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do - eval "val=\$with_$which" -@@ -3531,6 +3559,16 @@ - ;; - esac - done -+ -+ case "$with_abi" in -+ "" | elfv1 | elfv2 ) -+ #OK -+ ;; -+ *) -+ echo "Unknown ABI used in --with-abi=$with_abi" -+ exit 1 -+ ;; -+ esac - ;; - - s390*-*-*) -@@ -3587,7 +3625,7 @@ - case ${val} in - "" | sparc | sparcv9 | sparc64 \ - | v7 | cypress \ -- | v8 | supersparc | hypersparc | leon \ -+ | v8 | supersparc | hypersparc | leon | leon3 \ - | sparclite | f930 | f934 | sparclite86x \ - | sparclet | tsc701 \ - | v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \ -@@ -3745,15 +3783,6 @@ - cxx_target_objs="${cxx_target_objs} sh-c.o" - ;; - -- sparc-leon*-*) -- if test x$with_tune = x ; then -- with_tune=leon; -- fi -- -- # The SPARC port checks this value at compile-time. -- target_cpu_default2="TARGET_CPU_$with_cpu" -- ;; -- - sparc*-*-*) - # Some standard aliases. - case x$with_cpu in -@@ -3765,6 +3794,17 @@ - ;; - esac - -+ if test x$with_tune = x ; then -+ case ${target} in -+ *-leon-*) -+ with_tune=leon -+ ;; -+ *-leon[3-9]*) -+ with_tune=leon3 -+ ;; -+ esac -+ fi -+ - # The SPARC port checks this value at compile-time. - target_cpu_default2="TARGET_CPU_$with_cpu" - ;; -Index: gcc/reginfo.c -=================================================================== ---- a/src/gcc/reginfo.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/reginfo.c (.../branches/gcc-4_8-branch) -@@ -85,7 +85,7 @@ - char global_regs[FIRST_PSEUDO_REGISTER]; - - /* Declaration for the global register. */ --static tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER]; -+tree global_regs_decl[FIRST_PSEUDO_REGISTER]; - - /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used - in dataflow more conveniently. */ -@@ -620,40 +620,35 @@ - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -+ && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) - found_mode = mode; - -- if (found_mode != VOIDmode) -- return found_mode; -- - for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -+ && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) - found_mode = mode; - -- if (found_mode != VOIDmode) -- return found_mode; -- - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -+ && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) - found_mode = mode; - -- if (found_mode != VOIDmode) -- return found_mode; -- - for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT); - mode != VOIDmode; - mode = GET_MODE_WIDER_MODE (mode)) - if ((unsigned) hard_regno_nregs[regno][mode] == nregs - && HARD_REGNO_MODE_OK (regno, mode) -- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) -+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) -+ && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) - found_mode = mode; - - if (found_mode != VOIDmode) -Index: gcc/Makefile.in -=================================================================== ---- a/src/gcc/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/Makefile.in (.../branches/gcc-4_8-branch) -@@ -1827,7 +1827,7 @@ - "$(MULTILIB_EXCLUSIONS)" \ - "$(MULTILIB_OSDIRNAMES)" \ - "$(MULTILIB_REQUIRED)" \ -- "$(MULTIARCH_DIRNAME)" \ -+ "$(if $(MULTILIB_OSDIRNAMES),,$(MULTIARCH_DIRNAME))" \ - "$(MULTILIB_REUSE)" \ - "@enable_multilib@" \ - > tmp-mlib.h; \ -@@ -2256,7 +2256,7 @@ - $(FUNCTION_H) $(TM_H) coretypes.h \ - $(TREE_PASS_H) $(BASIC_BLOCK_H) $(BITMAP_H) \ - $(FLAGS_H) $(HASHTAB_H) pointer-set.h \ -- $(GIMPLE_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H) -+ $(GIMPLE_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H) $(PARAMS_H) - tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ - $(TREE_H) $(TM_P_H) $(EXPR_H) $(DIAGNOSTIC_H) \ - toplev.h $(FUNCTION_H) $(TM_H) coretypes.h \ -@@ -3037,7 +3037,7 @@ - $(TM_H) coretypes.h $(GIMPLE_H) \ - $(TREE_PASS_H) $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \ - $(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H) \ -- $(GIMPLE_PRETTY_PRINT_H) langhooks.h -+ $(GIMPLE_PRETTY_PRINT_H) langhooks.h $(OPTABS_H) - tree-complex.o : tree-complex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ - $(TM_H) $(FLAGS_H) $(TREE_FLOW_H) $(GIMPLE_H) \ - tree-iterator.h $(TREE_PASS_H) tree-ssa-propagate.h -@@ -3276,12 +3276,12 @@ - $(TM_H) $(RTL_H) $(REGS_H) insn-config.h insn-codes.h $(DF_H) \ - $(RECOG_H) output.h addresses.h $(REGS_H) hard-reg-set.h $(FLAGS_H) \ - $(FUNCTION_H) $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) \ -- ira.h rtl-error.h $(LRA_INT_H) -+ ira.h rtl-error.h $(LRA_INT_H) $(OPTABS_H) - lra-eliminations.o : lra-eliminations.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \ - $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \ - $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) ira.h \ -- rtl-error.h $(LRA_INT_H) -+ rtl-error.h $(LRA_INT_H) $(OPTABS_H) - lra-lives.o : lra-lives.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \ - $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \ -Index: gcc/gimple.c -=================================================================== ---- a/src/gcc/gimple.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gimple.c (.../branches/gcc-4_8-branch) -@@ -3841,42 +3841,46 @@ - - /* For the statement STMT call the callbacks VISIT_LOAD, VISIT_STORE and - VISIT_ADDR if non-NULL on loads, store and address-taken operands -- passing the STMT, the base of the operand and DATA to it. The base -- will be either a decl, an indirect reference (including TARGET_MEM_REF) -- or the argument of an address expression. -+ passing the STMT, the base of the operand, the operand itself containing -+ the base and DATA to it. The base will be either a decl, an indirect -+ reference (including TARGET_MEM_REF) or the argument of an address -+ expression. - Returns the results of these callbacks or'ed. */ - - bool - walk_stmt_load_store_addr_ops (gimple stmt, void *data, -- bool (*visit_load)(gimple, tree, void *), -- bool (*visit_store)(gimple, tree, void *), -- bool (*visit_addr)(gimple, tree, void *)) -+ walk_stmt_load_store_addr_fn visit_load, -+ walk_stmt_load_store_addr_fn visit_store, -+ walk_stmt_load_store_addr_fn visit_addr) - { - bool ret = false; - unsigned i; - if (gimple_assign_single_p (stmt)) - { -- tree lhs, rhs; -+ tree lhs, rhs, arg; - if (visit_store) - { -- lhs = get_base_loadstore (gimple_assign_lhs (stmt)); -+ arg = gimple_assign_lhs (stmt); -+ lhs = get_base_loadstore (arg); - if (lhs) -- ret |= visit_store (stmt, lhs, data); -+ ret |= visit_store (stmt, lhs, arg, data); - } -- rhs = gimple_assign_rhs1 (stmt); -+ arg = gimple_assign_rhs1 (stmt); -+ rhs = arg; - while (handled_component_p (rhs)) - rhs = TREE_OPERAND (rhs, 0); - if (visit_addr) - { - if (TREE_CODE (rhs) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), arg, data); - else if (TREE_CODE (rhs) == TARGET_MEM_REF - && TREE_CODE (TMR_BASE (rhs)) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (rhs), 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (rhs), 0), arg, -+ data); - else if (TREE_CODE (rhs) == OBJ_TYPE_REF - && TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs), -- 0), data); -+ 0), arg, data); - else if (TREE_CODE (rhs) == CONSTRUCTOR) - { - unsigned int ix; -@@ -3884,23 +3888,23 @@ - - FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), ix, val) - if (TREE_CODE (val) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (val, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (val, 0), arg, data); - else if (TREE_CODE (val) == OBJ_TYPE_REF - && TREE_CODE (OBJ_TYPE_REF_OBJECT (val)) == ADDR_EXPR) - ret |= visit_addr (stmt, - TREE_OPERAND (OBJ_TYPE_REF_OBJECT (val), -- 0), data); -+ 0), arg, data); - } - lhs = gimple_assign_lhs (stmt); - if (TREE_CODE (lhs) == TARGET_MEM_REF - && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (lhs), 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (lhs), 0), lhs, data); - } - if (visit_load) - { - rhs = get_base_loadstore (rhs); - if (rhs) -- ret |= visit_load (stmt, rhs, data); -+ ret |= visit_load (stmt, rhs, arg, data); - } - } - else if (visit_addr -@@ -3913,7 +3917,7 @@ - if (op == NULL_TREE) - ; - else if (TREE_CODE (op) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - /* COND_EXPR and VCOND_EXPR rhs1 argument is a comparison - tree with two operands. */ - else if (i == 1 && COMPARISON_CLASS_P (op)) -@@ -3920,10 +3924,10 @@ - { - if (TREE_CODE (TREE_OPERAND (op, 0)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 0), -- 0), data); -+ 0), op, data); - if (TREE_CODE (TREE_OPERAND (op, 1)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 1), -- 0), data); -+ 0), op, data); - } - } - } -@@ -3931,26 +3935,26 @@ - { - if (visit_store) - { -- tree lhs = gimple_call_lhs (stmt); -- if (lhs) -+ tree arg = gimple_call_lhs (stmt); -+ if (arg) - { -- lhs = get_base_loadstore (lhs); -+ tree lhs = get_base_loadstore (arg); - if (lhs) -- ret |= visit_store (stmt, lhs, data); -+ ret |= visit_store (stmt, lhs, arg, data); - } - } - if (visit_load || visit_addr) - for (i = 0; i < gimple_call_num_args (stmt); ++i) - { -- tree rhs = gimple_call_arg (stmt, i); -+ tree arg = gimple_call_arg (stmt, i); - if (visit_addr -- && TREE_CODE (rhs) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), data); -+ && TREE_CODE (arg) == ADDR_EXPR) -+ ret |= visit_addr (stmt, TREE_OPERAND (arg, 0), arg, data); - else if (visit_load) - { -- rhs = get_base_loadstore (rhs); -+ tree rhs = get_base_loadstore (arg); - if (rhs) -- ret |= visit_load (stmt, rhs, data); -+ ret |= visit_load (stmt, rhs, arg, data); - } - } - if (visit_addr -@@ -3957,12 +3961,13 @@ - && gimple_call_chain (stmt) - && TREE_CODE (gimple_call_chain (stmt)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (stmt), 0), -- data); -+ gimple_call_chain (stmt), data); - if (visit_addr - && gimple_call_return_slot_opt_p (stmt) - && gimple_call_lhs (stmt) != NULL_TREE - && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt)))) -- ret |= visit_addr (stmt, gimple_call_lhs (stmt), data); -+ ret |= visit_addr (stmt, gimple_call_lhs (stmt), -+ gimple_call_lhs (stmt), data); - } - else if (gimple_code (stmt) == GIMPLE_ASM) - { -@@ -3978,7 +3983,7 @@ - tree link = gimple_asm_output_op (stmt, i); - tree op = get_base_loadstore (TREE_VALUE (link)); - if (op && visit_store) -- ret |= visit_store (stmt, op, data); -+ ret |= visit_store (stmt, op, TREE_VALUE (link), data); - if (visit_addr) - { - constraint = TREE_STRING_POINTER -@@ -3987,7 +3992,7 @@ - parse_output_constraint (&constraint, i, 0, 0, &allows_mem, - &allows_reg, &is_inout); - if (op && !allows_reg && allows_mem) -- ret |= visit_addr (stmt, op, data); -+ ret |= visit_addr (stmt, op, TREE_VALUE (link), data); - } - } - if (visit_load || visit_addr) -@@ -3997,7 +4002,7 @@ - tree op = TREE_VALUE (link); - if (visit_addr - && TREE_CODE (op) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - else if (visit_load || visit_addr) - { - op = get_base_loadstore (op); -@@ -4004,7 +4009,7 @@ - if (op) - { - if (visit_load) -- ret |= visit_load (stmt, op, data); -+ ret |= visit_load (stmt, op, TREE_VALUE (link), data); - if (visit_addr) - { - constraint = TREE_STRING_POINTER -@@ -4013,7 +4018,8 @@ - 0, oconstraints, - &allows_mem, &allows_reg); - if (!allows_reg && allows_mem) -- ret |= visit_addr (stmt, op, data); -+ ret |= visit_addr (stmt, op, TREE_VALUE (link), -+ data); - } - } - } -@@ -4026,12 +4032,12 @@ - { - if (visit_addr - && TREE_CODE (op) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - else if (visit_load) - { -- op = get_base_loadstore (op); -- if (op) -- ret |= visit_load (stmt, op, data); -+ tree base = get_base_loadstore (op); -+ if (base) -+ ret |= visit_load (stmt, base, op, data); - } - } - } -@@ -4042,7 +4048,7 @@ - { - tree op = PHI_ARG_DEF (stmt, i); - if (TREE_CODE (op) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - } - } - else if (visit_addr -@@ -4050,7 +4056,7 @@ - { - tree op = gimple_goto_dest (stmt); - if (TREE_CODE (op) == ADDR_EXPR) -- ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); -+ ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - } - - return ret; -@@ -4061,8 +4067,8 @@ - - bool - walk_stmt_load_store_ops (gimple stmt, void *data, -- bool (*visit_load)(gimple, tree, void *), -- bool (*visit_store)(gimple, tree, void *)) -+ walk_stmt_load_store_addr_fn visit_load, -+ walk_stmt_load_store_addr_fn visit_store) - { - return walk_stmt_load_store_addr_ops (stmt, data, - visit_load, visit_store, NULL); -@@ -4071,8 +4077,7 @@ - /* Helper for gimple_ior_addresses_taken_1. */ - - static bool --gimple_ior_addresses_taken_1 (gimple stmt ATTRIBUTE_UNUSED, -- tree addr, void *data) -+gimple_ior_addresses_taken_1 (gimple, tree addr, tree, void *data) + /* Perform deferred initialization of insns. This is used to process +- a new jump that may be created by redirect_edge. */ +-void +-sel_init_new_insn (insn_t insn, int flags) ++ a new jump that may be created by redirect_edge. OLD_SEQNO is used ++ for initializing simplejumps in init_simplejump_data. */ ++static void ++sel_init_new_insn (insn_t insn, int flags, int old_seqno) { - bitmap addresses_taken = (bitmap)data; - addr = get_base_address (addr); -Index: gcc/tree-ssa-structalias.c -=================================================================== ---- a/src/gcc/tree-ssa-structalias.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-structalias.c (.../branches/gcc-4_8-branch) -@@ -949,24 +949,27 @@ - bitmap_set_bit (result, i); - else - { -- unsigned HOST_WIDE_INT fieldoffset = vi->offset + offset; -+ HOST_WIDE_INT fieldoffset = vi->offset + offset; -+ unsigned HOST_WIDE_INT size = vi->size; - - /* If the offset makes the pointer point to before the - variable use offset zero for the field lookup. */ -- if (offset < 0 -- && fieldoffset > vi->offset) -- fieldoffset = 0; -- -- if (offset != 0) -+ if (fieldoffset < 0) -+ vi = lookup_vi_for_tree (vi->decl); -+ else - vi = first_or_preceding_vi_for_offset (vi, fieldoffset); - -- bitmap_set_bit (result, vi->id); -- /* If the result is not exactly at fieldoffset include the next -- field as well. See get_constraint_for_ptr_offset for more -- rationale. */ -- if (vi->offset != fieldoffset -- && vi->next != NULL) -- bitmap_set_bit (result, vi->next->id); -+ do -+ { -+ bitmap_set_bit (result, vi->id); -+ if (!vi->next) -+ break; -+ -+ /* We have to include all fields that overlap the current field -+ shifted by offset. */ -+ vi = vi->next; -+ } -+ while (vi->offset < fieldoffset + size); - } - } - -@@ -1607,16 +1610,21 @@ + /* We create data structures for bb when the first insn is emitted in it. */ + if (INSN_P (insn) +@@ -4292,7 +4303,7 @@ + if (flags & INSN_INIT_TODO_SIMPLEJUMP) { - varinfo_t v = get_varinfo (j); - HOST_WIDE_INT fieldoffset = v->offset + roffset; -+ unsigned HOST_WIDE_INT size = v->size; - unsigned int t; - - if (v->is_full_var) -- fieldoffset = v->offset; -+ ; - else if (roffset != 0) -- v = first_vi_for_offset (v, fieldoffset); -- /* If the access is outside of the variable we can ignore it. */ -- if (!v) -- continue; -+ { -+ if (fieldoffset < 0) -+ v = lookup_vi_for_tree (v->decl); -+ else -+ v = first_or_preceding_vi_for_offset (v, fieldoffset); -+ } - -+ /* We have to include all fields that overlap the current field -+ shifted by roffset. */ - do - { - t = find (v->id); -@@ -1633,16 +1641,13 @@ - && add_graph_edge (graph, lhs, t)) - flag |= bitmap_ior_into (sol, get_varinfo (t)->solution); - -- /* If the variable is not exactly at the requested offset -- we have to include the next one. */ -- if (v->offset == (unsigned HOST_WIDE_INT)fieldoffset -+ if (v->is_full_var - || v->next == NULL) - break; - - v = v->next; -- fieldoffset = v->offset; - } -- while (1); -+ while (v->offset < fieldoffset + size); + extend_insn_data (); +- init_simplejump_data (insn); ++ init_simplejump_data (insn, old_seqno); } - done: -@@ -1705,15 +1710,20 @@ - varinfo_t v = get_varinfo (j); - unsigned int t; - HOST_WIDE_INT fieldoffset = v->offset + loff; -+ unsigned HOST_WIDE_INT size = v->size; - - if (v->is_full_var) -- fieldoffset = v->offset; -+ ; - else if (loff != 0) -- v = first_vi_for_offset (v, fieldoffset); -- /* If the access is outside of the variable we can ignore it. */ -- if (!v) -- continue; -+ { -+ if (fieldoffset < 0) -+ v = lookup_vi_for_tree (v->decl); -+ else -+ v = first_or_preceding_vi_for_offset (v, fieldoffset); -+ } - -+ /* We have to include all fields that overlap the current field -+ shifted by loff. */ - do - { - if (v->may_have_pointers) -@@ -1739,16 +1749,13 @@ - bitmap_set_bit (changed, t); - } - -- /* If the variable is not exactly at the requested offset -- we have to include the next one. */ -- if (v->offset == (unsigned HOST_WIDE_INT)fieldoffset -+ if (v->is_full_var - || v->next == NULL) - break; - - v = v->next; -- fieldoffset = v->offset; - } -- while (1); -+ while (v->offset < fieldoffset + size); - } + gcc_assert (CONTAINING_RGN (BLOCK_NUM (insn)) +@@ -5578,8 +5589,7 @@ } -@@ -2997,35 +3004,30 @@ - varinfo_t temp; - unsigned HOST_WIDE_INT offset = curr->offset + rhsoffset; - -- /* Search the sub-field which overlaps with the -- pointed-to offset. If the result is outside of the variable -- we have to provide a conservative result, as the variable is -- still reachable from the resulting pointer (even though it -- technically cannot point to anything). The last and first -- sub-fields are such conservative results. -- ??? If we always had a sub-field for &object + 1 then -- we could represent this in a more precise way. */ -+ /* If curr->offset + rhsoffset is less than zero adjust it. */ - if (rhsoffset < 0 - && curr->offset < offset) - offset = 0; -+ -+ /* We have to include all fields that overlap the current -+ field shifted by rhsoffset. And we include at least -+ the last or the first field of the variable to represent -+ reachability of off-bound addresses, in particular &object + 1, -+ conservatively correct. */ - temp = first_or_preceding_vi_for_offset (curr, offset); -- -- /* If the found variable is not exactly at the pointed to -- result, we have to include the next variable in the -- solution as well. Otherwise two increments by offset / 2 -- do not result in the same or a conservative superset -- solution. */ -- if (temp->offset != offset -- && temp->next != NULL) -+ c.var = temp->id; -+ c.offset = 0; -+ temp = temp->next; -+ while (temp -+ && temp->offset < offset + curr->size) - { - struct constraint_expr c2; -- c2.var = temp->next->id; -+ c2.var = temp->id; - c2.type = ADDRESSOF; - c2.offset = 0; - results->safe_push (c2); -+ temp = temp->next; - } -- c.var = temp->id; -- c.offset = 0; - } - else - c.offset = rhsoffset; -Index: gcc/gimple.h -=================================================================== ---- a/src/gcc/gimple.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/gimple.h (.../branches/gcc-4_8-branch) -@@ -176,6 +176,9 @@ - /* Nonzero if this statement contains volatile operands. */ - unsigned has_volatile_ops : 1; - -+ /* Padding to get subcode to 16 bit alignment. */ -+ unsigned pad : 1; -+ - /* The SUBCODE field can be used for tuple-specific flags for tuples - that do not require subcodes. Note that SUBCODE should be at - least as wide as tree codes, as several tuples store tree codes -@@ -888,13 +891,14 @@ - extern alias_set_type gimple_get_alias_set (tree); - extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *, - unsigned *); -+typedef bool (*walk_stmt_load_store_addr_fn) (gimple, tree, tree, void *); - extern bool walk_stmt_load_store_addr_ops (gimple, void *, -- bool (*)(gimple, tree, void *), -- bool (*)(gimple, tree, void *), -- bool (*)(gimple, tree, void *)); -+ walk_stmt_load_store_addr_fn, -+ walk_stmt_load_store_addr_fn, -+ walk_stmt_load_store_addr_fn); - extern bool walk_stmt_load_store_ops (gimple, void *, -- bool (*)(gimple, tree, void *), -- bool (*)(gimple, tree, void *)); -+ walk_stmt_load_store_addr_fn, -+ walk_stmt_load_store_addr_fn); - extern bool gimple_ior_addresses_taken (bitmap, gimple); - extern bool gimple_call_builtin_p (gimple, enum built_in_class); - extern bool gimple_call_builtin_p (gimple, enum built_in_function); -Index: gcc/tree-cfg.c -=================================================================== ---- a/src/gcc/tree-cfg.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-cfg.c (.../branches/gcc-4_8-branch) -@@ -104,7 +104,6 @@ - static void assign_discriminator (location_t, basic_block); - static edge gimple_redirect_edge_and_branch (edge, basic_block); - static edge gimple_try_redirect_by_replacing_jump (edge, basic_block); --static unsigned int split_critical_edges (void); - - /* Various helpers. */ - static inline bool stmt_starts_bb_p (gimple, gimple); -@@ -1535,6 +1534,11 @@ - - FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name) - { -+ /* Mark the block if we change the last stmt in it. */ -+ if (cfgcleanup_altered_bbs -+ && stmt_ends_bb_p (stmt)) -+ bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index); -+ - FOR_EACH_IMM_USE_ON_STMT (use, imm_iter) - { - replace_exp (use, val); -@@ -1559,11 +1563,6 @@ - gimple orig_stmt = stmt; - size_t i; - -- /* Mark the block if we changed the last stmt in it. */ -- if (cfgcleanup_altered_bbs -- && stmt_ends_bb_p (stmt)) -- bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index); -- - /* FIXME. It shouldn't be required to keep TREE_CONSTANT - on ADDR_EXPRs up-to-date on GIMPLE. Propagation will - only change sth from non-invariant to invariant, and only -@@ -3513,11 +3512,10 @@ - case PLUS_EXPR: - case MINUS_EXPR: - { -- /* We use regular PLUS_EXPR and MINUS_EXPR for vectors. -- ??? This just makes the checker happy and may not be what is -- intended. */ -- if (TREE_CODE (lhs_type) == VECTOR_TYPE -- && POINTER_TYPE_P (TREE_TYPE (lhs_type))) -+ tree lhs_etype = lhs_type; -+ tree rhs1_etype = rhs1_type; -+ tree rhs2_etype = rhs2_type; -+ if (TREE_CODE (lhs_type) == VECTOR_TYPE) - { - if (TREE_CODE (rhs1_type) != VECTOR_TYPE - || TREE_CODE (rhs2_type) != VECTOR_TYPE) -@@ -3525,22 +3523,13 @@ - error ("invalid non-vector operands to vector valued plus"); - return true; - } -- lhs_type = TREE_TYPE (lhs_type); -- rhs1_type = TREE_TYPE (rhs1_type); -- rhs2_type = TREE_TYPE (rhs2_type); -- /* PLUS_EXPR is commutative, so we might end up canonicalizing -- the pointer to 2nd place. */ -- if (POINTER_TYPE_P (rhs2_type)) -- { -- tree tem = rhs1_type; -- rhs1_type = rhs2_type; -- rhs2_type = tem; -- } -- goto do_pointer_plus_expr_check; -+ lhs_etype = TREE_TYPE (lhs_type); -+ rhs1_etype = TREE_TYPE (rhs1_type); -+ rhs2_etype = TREE_TYPE (rhs2_type); - } -- if (POINTER_TYPE_P (lhs_type) -- || POINTER_TYPE_P (rhs1_type) -- || POINTER_TYPE_P (rhs2_type)) -+ if (POINTER_TYPE_P (lhs_etype) -+ || POINTER_TYPE_P (rhs1_etype) -+ || POINTER_TYPE_P (rhs2_etype)) - { - error ("invalid (pointer) operands to plus/minus"); - return true; -@@ -3552,7 +3541,6 @@ - - case POINTER_PLUS_EXPR: - { --do_pointer_plus_expr_check: - if (!POINTER_TYPE_P (rhs1_type) - || !useless_type_conversion_p (lhs_type, rhs1_type) - || !ptrofftype_p (rhs2_type)) -@@ -7658,7 +7646,7 @@ - - /* Split all critical edges. */ - --static unsigned int -+unsigned int - split_critical_edges (void) - { - basic_block bb; -Index: gcc/passes.c -=================================================================== ---- a/src/gcc/passes.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/passes.c (.../branches/gcc-4_8-branch) -@@ -1398,6 +1398,7 @@ - /* After CCP we rewrite no longer addressed locals into SSA - form if possible. */ - NEXT_PASS (pass_forwprop); -+ NEXT_PASS (pass_object_sizes); - /* pass_build_alias is a dummy pass that ensures that we - execute TODO_rebuild_alias at this point. */ - NEXT_PASS (pass_build_alias); -@@ -1435,7 +1436,6 @@ - NEXT_PASS (pass_dce); - NEXT_PASS (pass_forwprop); - NEXT_PASS (pass_phiopt); -- NEXT_PASS (pass_object_sizes); - NEXT_PASS (pass_strlen); - NEXT_PASS (pass_ccp); - /* After CCP we rewrite no longer addressed locals into SSA -Index: gcc/tree-ssa-reassoc.c + /* A wrapper for redirect_edge_and_branch_force, which also initializes +- data structures for possibly created bb and insns. Returns the newly +- added bb or NULL, when a bb was not needed. */ ++ data structures for possibly created bb and insns. */ + void + sel_redirect_edge_and_branch_force (edge e, basic_block to) + { +@@ -5586,6 +5596,7 @@ + basic_block jump_bb, src, orig_dest = e->dest; + int prev_max_uid; + rtx jump; ++ int old_seqno = -1; + + /* This function is now used only for bookkeeping code creation, where + we'll never get the single pred of orig_dest block and thus will not +@@ -5594,8 +5605,13 @@ + && !single_pred_p (orig_dest)); + src = e->src; + prev_max_uid = get_max_uid (); ++ /* Compute and pass old_seqno down to sel_init_new_insn only for the case ++ when the conditional jump being redirected may become unconditional. */ ++ if (any_condjump_p (BB_END (src)) ++ && INSN_SEQNO (BB_END (src)) >= 0) ++ old_seqno = INSN_SEQNO (BB_END (src)); ++ + jump_bb = redirect_edge_and_branch_force (e, to); +- + if (jump_bb != NULL) + sel_add_bb (jump_bb); + +@@ -5607,7 +5623,8 @@ + + jump = find_new_jump (src, jump_bb, prev_max_uid); + if (jump) +- sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); ++ sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, ++ old_seqno); + set_immediate_dominator (CDI_DOMINATORS, to, + recompute_dominator (CDI_DOMINATORS, to)); + set_immediate_dominator (CDI_DOMINATORS, orig_dest, +@@ -5626,6 +5643,7 @@ + edge redirected; + bool recompute_toporder_p = false; + bool maybe_unreachable = single_pred_p (orig_dest); ++ int old_seqno = -1; + + latch_edge_p = (pipelining_p + && current_loop_nest +@@ -5634,6 +5652,12 @@ + src = e->src; + prev_max_uid = get_max_uid (); + ++ /* Compute and pass old_seqno down to sel_init_new_insn only for the case ++ when the conditional jump being redirected may become unconditional. */ ++ if (any_condjump_p (BB_END (src)) ++ && INSN_SEQNO (BB_END (src)) >= 0) ++ old_seqno = INSN_SEQNO (BB_END (src)); ++ + redirected = redirect_edge_and_branch (e, to); + + gcc_assert (redirected && !last_added_blocks.exists ()); +@@ -5654,7 +5678,7 @@ + + jump = find_new_jump (src, NULL, prev_max_uid); + if (jump) +- sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); ++ sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, old_seqno); + + /* Only update dominator info when we don't have unreachable blocks. + Otherwise we'll update in maybe_tidy_empty_bb. */ +Index: gcc/fortran/trans-expr.c =================================================================== ---- a/src/gcc/tree-ssa-reassoc.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssa-reassoc.c (.../branches/gcc-4_8-branch) -@@ -1980,8 +1980,15 @@ +--- a/src/gcc/fortran/trans-expr.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/fortran/trans-expr.c (.../branches/gcc-4_8-branch) +@@ -7096,7 +7096,7 @@ - tem = fold_convert_loc (loc, optype, tem); - gsi = gsi_for_stmt (stmt); -- tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true, -- GSI_SAME_STMT); -+ /* In rare cases range->exp can be equal to lhs of stmt. -+ In that case we have to insert after the stmt rather then before -+ it. */ -+ if (op == range->exp) -+ tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, false, -+ GSI_SAME_STMT); -+ else -+ tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true, -+ GSI_SAME_STMT); + res_desc = gfc_evaluate_now (desc, &se->pre); + gfc_conv_descriptor_data_set (&se->pre, res_desc, null_pointer_node); +- se->expr = gfc_build_addr_expr (TREE_TYPE (se->expr), res_desc); ++ se->expr = gfc_build_addr_expr (NULL_TREE, res_desc); - /* If doing inter-bb range test optimization, update the - stmts immediately. Start with changing the first range test -Index: gcc/config/s390/s390.c + /* Free the lhs after the function call and copy the result data to + the lhs descriptor. */ +Index: gcc/fortran/decl.c =================================================================== ---- a/src/gcc/config/s390/s390.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/s390.c (.../branches/gcc-4_8-branch) -@@ -407,6 +407,65 @@ - bytes on a z10 (or higher) CPU. */ - #define PREDICT_DISTANCE (TARGET_Z10 ? 384 : 2048) - -+static const int s390_hotpatch_trampoline_halfwords_default = 12; -+static const int s390_hotpatch_trampoline_halfwords_max = 1000000; -+static int s390_hotpatch_trampoline_halfwords = -1; -+ -+/* Return the argument of the given hotpatch attribute or the default value if -+ no argument is present. */ -+ -+static inline int -+get_hotpatch_attribute (tree hotpatch_attr) -+{ -+ const_tree args; -+ -+ args = TREE_VALUE (hotpatch_attr); -+ -+ return (args) ? -+ TREE_INT_CST_LOW (TREE_VALUE (args)): -+ s390_hotpatch_trampoline_halfwords_default; -+} -+ -+/* Check whether the hotpatch attribute is applied to a function and, if it has -+ an argument, the argument is valid. */ -+ -+static tree -+s390_handle_hotpatch_attribute (tree *node, tree name, tree args, -+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs) -+{ -+ if (TREE_CODE (*node) != FUNCTION_DECL) -+ { -+ warning (OPT_Wattributes, "%qE attribute only applies to functions", -+ name); -+ *no_add_attrs = true; -+ } -+ else if (args) -+ { -+ tree expr = TREE_VALUE (args); -+ -+ if (TREE_CODE (expr) != INTEGER_CST -+ || !INTEGRAL_TYPE_P (TREE_TYPE (expr)) -+ || TREE_INT_CST_HIGH (expr) != 0 -+ || TREE_INT_CST_LOW (expr) > (unsigned int) -+ s390_hotpatch_trampoline_halfwords_max) -+ { -+ error ("requested %qE attribute is not a non-negative integer" -+ " constant or too large (max. %d)", name, -+ s390_hotpatch_trampoline_halfwords_max); -+ *no_add_attrs = true; -+ } -+ } -+ -+ return NULL_TREE; -+} -+ -+static const struct attribute_spec s390_attribute_table[] = { -+ { "hotpatch", 0, 1, true, false, false, s390_handle_hotpatch_attribute, false -+ }, -+ /* End element. */ -+ { NULL, 0, 0, false, false, false, NULL, false } -+}; -+ - /* Return the alignment for LABEL. We default to the -falign-labels - value except for the literal pool base label. */ - int -@@ -883,7 +942,8 @@ - { - /* For CCRAWmode put the required cc mask into the second - operand. */ -- if (GET_MODE (XVECEXP (*op0, 0, 0)) == CCRAWmode) -+ if (GET_MODE (XVECEXP (*op0, 0, 0)) == CCRAWmode -+ && INTVAL (*op1) >= 0 && INTVAL (*op1) <= 3) - *op1 = gen_rtx_CONST_INT (VOIDmode, 1 << (3 - INTVAL (*op1))); - *op0 = XVECEXP (*op0, 0, 0); - *code = new_code; -@@ -1594,6 +1654,46 @@ - static void - s390_option_override (void) - { -+ unsigned int i; -+ cl_deferred_option *opt; -+ vec<cl_deferred_option> *v = -+ (vec<cl_deferred_option> *) s390_deferred_options; -+ -+ if (v) -+ FOR_EACH_VEC_ELT (*v, i, opt) -+ { -+ switch (opt->opt_index) -+ { -+ case OPT_mhotpatch: -+ s390_hotpatch_trampoline_halfwords = (opt->value) ? -+ s390_hotpatch_trampoline_halfwords_default : -1; -+ break; -+ case OPT_mhotpatch_: -+ { -+ int val; -+ -+ val = integral_argument (opt->arg); -+ if (val == -1) -+ { -+ /* argument is not a plain number */ -+ error ("argument to %qs should be a non-negative integer", -+ "-mhotpatch="); -+ break; -+ } -+ else if (val > s390_hotpatch_trampoline_halfwords_max) -+ { -+ error ("argument to %qs is too large (max. %d)", -+ "-mhotpatch=", s390_hotpatch_trampoline_halfwords_max); -+ break; -+ } -+ s390_hotpatch_trampoline_halfwords = val; -+ break; -+ } -+ default: -+ gcc_unreachable (); -+ } -+ } -+ - /* Set up function hooks. */ - init_machine_status = s390_init_machine_status; - -@@ -3015,15 +3115,22 @@ - prefer ADDR_REGS. If 'class' is not a superset - of ADDR_REGS, e.g. FP_REGS, reject this reload. */ - case CONST: -- /* A larl operand with odd addend will get fixed via secondary -- reload. So don't request it to be pushed into literal -- pool. */ -+ /* Symrefs cannot be pushed into the literal pool with -fPIC -+ so we *MUST NOT* return NO_REGS for these cases -+ (s390_cannot_force_const_mem will return true). -+ -+ On the other hand we MUST return NO_REGS for symrefs with -+ invalid addend which might have been pushed to the literal -+ pool (no -fPIC). Usually we would expect them to be -+ handled via secondary reload but this does not happen if -+ they are used as literal pool slot replacement in reload -+ inheritance (see emit_input_reload_insns). */ - if (TARGET_CPU_ZARCH - && GET_CODE (XEXP (op, 0)) == PLUS - && GET_CODE (XEXP (XEXP(op, 0), 0)) == SYMBOL_REF - && GET_CODE (XEXP (XEXP(op, 0), 1)) == CONST_INT) - { -- if (reg_class_subset_p (ADDR_REGS, rclass)) -+ if (flag_pic && reg_class_subset_p (ADDR_REGS, rclass)) - return ADDR_REGS; - else - return NO_REGS; -@@ -4683,7 +4790,7 @@ - int smode_bsize, mode_bsize; - rtx op, clobber; - -- if (bitsize + bitpos > GET_MODE_SIZE (mode)) -+ if (bitsize + bitpos > GET_MODE_BITSIZE (mode)) - return false; - - /* Generate INSERT IMMEDIATE (IILL et al). */ -@@ -5311,6 +5418,101 @@ - gcc_unreachable (); - } - -+/* Returns -1 if the function should not be made hotpatchable. Otherwise it -+ returns a number >= 0 that is the desired size of the hotpatch trampoline -+ in halfwords. */ -+ -+static int s390_function_num_hotpatch_trampoline_halfwords (tree decl, -+ bool do_warn) -+{ -+ tree attr; -+ -+ if (DECL_DECLARED_INLINE_P (decl) -+ || DECL_ARTIFICIAL (decl) -+ || MAIN_NAME_P (DECL_NAME (decl))) -+ { -+ /* - Explicitly inlined functions cannot be hotpatched. -+ - Artificial functions need not be hotpatched. -+ - Making the main function hotpatchable is useless. */ -+ return -1; -+ } -+ attr = lookup_attribute ("hotpatch", DECL_ATTRIBUTES (decl)); -+ if (attr || s390_hotpatch_trampoline_halfwords >= 0) -+ { -+ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl))) -+ { -+ if (do_warn) -+ warning (OPT_Wattributes, "function %qE with the %qs attribute" -+ " is not hotpatchable", DECL_NAME (decl), "always_inline"); -+ return -1; -+ } -+ else -+ { -+ return (attr) ? -+ get_hotpatch_attribute (attr) : s390_hotpatch_trampoline_halfwords; -+ } -+ } -+ -+ return -1; -+} -+ -+/* Hook to determine if one function can safely inline another. */ -+ -+static bool -+s390_can_inline_p (tree caller, tree callee) -+{ -+ if (s390_function_num_hotpatch_trampoline_halfwords (callee, false) >= 0) -+ return false; -+ -+ return default_target_can_inline_p (caller, callee); -+} -+ -+/* Write the extra assembler code needed to declare a function properly. */ -+ -+void -+s390_asm_output_function_label (FILE *asm_out_file, const char *fname, -+ tree decl) -+{ -+ int hotpatch_trampoline_halfwords = -1; -+ -+ if (decl) -+ { -+ hotpatch_trampoline_halfwords = -+ s390_function_num_hotpatch_trampoline_halfwords (decl, true); -+ if (hotpatch_trampoline_halfwords >= 0 -+ && decl_function_context (decl) != NULL_TREE) +--- a/src/gcc/fortran/decl.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/fortran/decl.c (.../branches/gcc-4_8-branch) +@@ -1996,6 +1996,13 @@ + if (gfc_notify_std (GFC_STD_GNU, "Old-style " + "initialization at %C") == FAILURE) + return MATCH_ERROR; ++ else if (gfc_current_state () == COMP_DERIVED) + { -+ warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch, -+ "hotpatching is not compatible with nested functions"); -+ hotpatch_trampoline_halfwords = -1; ++ gfc_error ("Invalid old style initialization for derived type " ++ "component at %C"); ++ m = MATCH_ERROR; ++ goto cleanup; + } -+ } -+ -+ if (hotpatch_trampoline_halfwords > 0) -+ { -+ int i; -+ -+ /* Add a trampoline code area before the function label and initialize it -+ with two-byte nop instructions. This area can be overwritten with code -+ that jumps to a patched version of the function. */ -+ for (i = 0; i < hotpatch_trampoline_halfwords; i++) -+ asm_fprintf (asm_out_file, "\tnopr\t%%r7\n"); -+ /* Note: The function label must be aligned so that (a) the bytes of the -+ following nop do not cross a cacheline boundary, and (b) a jump address -+ (eight bytes for 64 bit targets, 4 bytes for 32 bit targets) can be -+ stored directly before the label without crossing a cacheline -+ boundary. All this is necessary to make sure the trampoline code can -+ be changed atomically. */ -+ } -+ -+ ASM_OUTPUT_LABEL (asm_out_file, fname); -+ -+ /* Output a four-byte nop if hotpatching is enabled. This can be overwritten -+ atomically with a relative backwards jump to the trampoline area. */ -+ if (hotpatch_trampoline_halfwords >= 0) -+ asm_fprintf (asm_out_file, "\tnop\t0\n"); -+} -+ - /* Output machine-dependent UNSPECs occurring in address constant X - in assembler syntax to stdio stream FILE. Returns true if the - constant X could be recognized, false otherwise. */ -@@ -7846,6 +8048,9 @@ - { - bb = BASIC_BLOCK (bb_index); - -+ if (!bb) -+ continue; -+ - FOR_BB_INSNS (bb, insn) - { - rtx ite, cc, pat, target; -@@ -7959,7 +8164,10 @@ - if (!result) - return; - -- PATTERN (tbegin_insn) = XVECEXP (PATTERN (tbegin_insn), 0, 0); -+ PATTERN (tbegin_insn) = gen_rtx_PARALLEL (VOIDmode, -+ gen_rtvec (2, -+ XVECEXP (PATTERN (tbegin_insn), 0, 0), -+ XVECEXP (PATTERN (tbegin_insn), 0, 1))); - INSN_CODE (tbegin_insn) = -1; - df_insn_rescan (tbegin_insn); - -@@ -9568,61 +9776,47 @@ - void - s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p) - { -- const int CC0 = 1 << 3; -- const int CC1 = 1 << 2; -- const int CC3 = 1 << 0; -- rtx abort_label = gen_label_rtx (); -- rtx leave_label = gen_label_rtx (); -+ rtx retry_plus_two = gen_reg_rtx (SImode); - rtx retry_reg = gen_reg_rtx (SImode); - rtx retry_label = NULL_RTX; -- rtx jump; -- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1); - if (retry != NULL_RTX) - { - emit_move_insn (retry_reg, retry); -+ emit_insn (gen_addsi3 (retry_plus_two, retry_reg, const2_rtx)); -+ emit_insn (gen_addsi3 (retry_reg, retry_reg, const1_rtx)); - retry_label = gen_label_rtx (); - emit_label (retry_label); - } - - if (clobber_fprs_p) -- emit_insn (gen_tbegin_1 (tdb, -- gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK))); -+ emit_insn (gen_tbegin_1 (gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK), tdb)); - else -- emit_insn (gen_tbegin_nofloat_1 (tdb, -- gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK))); -+ emit_insn (gen_tbegin_nofloat_1 (gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK), -+ tdb)); - -- jump = s390_emit_jump (abort_label, -- gen_rtx_NE (VOIDmode, -- gen_rtx_REG (CCRAWmode, CC_REGNUM), -- gen_rtx_CONST_INT (VOIDmode, CC0))); -- -- JUMP_LABEL (jump) = abort_label; -- LABEL_NUSES (abort_label) = 1; -- add_reg_note (jump, REG_BR_PROB, very_unlikely); -- -- /* Initialize CC return value. */ -- emit_move_insn (dest, const0_rtx); -- -- s390_emit_jump (leave_label, NULL_RTX); -- LABEL_NUSES (leave_label) = 1; -- emit_barrier (); -- -- /* Abort handler code. */ -- -- emit_label (abort_label); -+ emit_move_insn (dest, gen_rtx_UNSPEC (SImode, -+ gen_rtvec (1, gen_rtx_REG (CCRAWmode, -+ CC_REGNUM)), -+ UNSPEC_CC_TO_INT)); - if (retry != NULL_RTX) - { -+ const int CC0 = 1 << 3; -+ const int CC1 = 1 << 2; -+ const int CC3 = 1 << 0; -+ rtx jump; - rtx count = gen_reg_rtx (SImode); -+ rtx leave_label = gen_label_rtx (); -+ -+ /* Exit for success and permanent failures. */ - jump = s390_emit_jump (leave_label, - gen_rtx_EQ (VOIDmode, - gen_rtx_REG (CCRAWmode, CC_REGNUM), -- gen_rtx_CONST_INT (VOIDmode, CC1 | CC3))); -- LABEL_NUSES (leave_label) = 2; -- add_reg_note (jump, REG_BR_PROB, very_unlikely); -+ gen_rtx_CONST_INT (VOIDmode, CC0 | CC1 | CC3))); -+ LABEL_NUSES (leave_label) = 1; - - /* CC2 - transient failure. Perform retry with ppa. */ -- emit_move_insn (count, retry); -+ emit_move_insn (count, retry_plus_two); - emit_insn (gen_subsi3 (count, count, retry_reg)); - emit_insn (gen_tx_assist (count)); - jump = emit_jump_insn (gen_doloop_si64 (retry_label, -@@ -9630,13 +9824,8 @@ - retry_reg)); - JUMP_LABEL (jump) = retry_label; - LABEL_NUSES (retry_label) = 1; -+ emit_label (leave_label); + return match_old_style_init (name); } -- -- emit_move_insn (dest, gen_rtx_UNSPEC (SImode, -- gen_rtvec (1, gen_rtx_REG (CCRAWmode, -- CC_REGNUM)), -- UNSPEC_CC_TO_INT)); -- emit_label (leave_label); - } - - /* Builtins. */ -@@ -9674,6 +9863,9 @@ - s390_init_builtins (void) - { - tree ftype, uint64_type; -+ tree returns_twice_attr = tree_cons (get_identifier ("returns_twice"), -+ NULL, NULL); -+ tree noreturn_attr = tree_cons (get_identifier ("noreturn"), NULL, NULL); - - /* void foo (void) */ - ftype = build_function_type_list (void_type_node, NULL_TREE); -@@ -9684,7 +9876,7 @@ - ftype = build_function_type_list (void_type_node, integer_type_node, - NULL_TREE); - add_builtin_function ("__builtin_tabort", ftype, -- S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, NULL_TREE); -+ S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, noreturn_attr); - add_builtin_function ("__builtin_tx_assist", ftype, - S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); - -@@ -9691,10 +9883,10 @@ - /* int foo (void *) */ - ftype = build_function_type_list (integer_type_node, ptr_type_node, NULL_TREE); - add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN, -- BUILT_IN_MD, NULL, NULL_TREE); -+ BUILT_IN_MD, NULL, returns_twice_attr); - add_builtin_function ("__builtin_tbegin_nofloat", ftype, - S390_BUILTIN_TBEGIN_NOFLOAT, -- BUILT_IN_MD, NULL, NULL_TREE); -+ BUILT_IN_MD, NULL, returns_twice_attr); - - /* int foo (void *, int) */ - ftype = build_function_type_list (integer_type_node, ptr_type_node, -@@ -9702,11 +9894,11 @@ - add_builtin_function ("__builtin_tbegin_retry", ftype, - S390_BUILTIN_TBEGIN_RETRY, - BUILT_IN_MD, -- NULL, NULL_TREE); -+ NULL, returns_twice_attr); - add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype, - S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, - BUILT_IN_MD, -- NULL, NULL_TREE); -+ NULL, returns_twice_attr); - - /* int foo (void) */ - ftype = build_function_type_list (integer_type_node, NULL_TREE); -@@ -11622,6 +11814,12 @@ - #undef TARGET_CANONICALIZE_COMPARISON - #define TARGET_CANONICALIZE_COMPARISON s390_canonicalize_comparison - -+#undef TARGET_ATTRIBUTE_TABLE -+#define TARGET_ATTRIBUTE_TABLE s390_attribute_table -+ -+#undef TARGET_CAN_INLINE_P -+#define TARGET_CAN_INLINE_P s390_can_inline_p -+ - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-s390.h" -Index: gcc/config/s390/s390.h -=================================================================== ---- a/src/gcc/config/s390/s390.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/s390.h (.../branches/gcc-4_8-branch) -@@ -217,7 +217,7 @@ - #define STACK_BOUNDARY 64 - - /* Allocation boundary (in *bits*) for the code of a function. */ --#define FUNCTION_BOUNDARY 32 -+#define FUNCTION_BOUNDARY 64 - - /* There is no point aligning anything to a rounder boundary than this. */ - #define BIGGEST_ALIGNMENT 64 -@@ -878,6 +878,9 @@ - fputc ('\n', (FILE)); \ - } while (0) - -+#undef ASM_OUTPUT_FUNCTION_LABEL -+#define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \ -+ s390_asm_output_function_label (FILE, NAME, DECL) - - /* Miscellaneous parameters. */ - -Index: gcc/config/s390/s390.md -=================================================================== ---- a/src/gcc/config/s390/s390.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/s390.md (.../branches/gcc-4_8-branch) -@@ -147,6 +147,7 @@ - - ; Transactional Execution support - UNSPECV_TBEGIN -+ UNSPECV_TBEGIN_TDB - UNSPECV_TBEGINC - UNSPECV_TEND - UNSPECV_TABORT -@@ -9896,9 +9897,10 @@ - - (define_insn "tbegin_1" - [(set (reg:CCRAW CC_REGNUM) -- (unspec_volatile:CCRAW [(match_operand:BLK 0 "memory_operand" "=Q") -- (match_operand 1 "const_int_operand" " D")] -+ (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")] - UNSPECV_TBEGIN)) -+ (set (match_operand:BLK 1 "memory_operand" "=Q") -+ (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB)) - (clobber (reg:DF 16)) - (clobber (reg:DF 17)) - (clobber (reg:DF 18)) -@@ -9917,18 +9919,19 @@ - (clobber (reg:DF 31))] - ; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is - ; not supposed to be used for immediates (see genpreds.c). -- "TARGET_HTM && INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 0xffff" -- "tbegin\t%0,%x1" -+ "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" -+ "tbegin\t%1,%x0" - [(set_attr "op_type" "SIL")]) - - ; Same as above but without the FPR clobbers - (define_insn "tbegin_nofloat_1" - [(set (reg:CCRAW CC_REGNUM) -- (unspec_volatile:CCRAW [(match_operand:BLK 0 "memory_operand" "=Q") -- (match_operand 1 "const_int_operand" " D")] -- UNSPECV_TBEGIN))] -- "TARGET_HTM && INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 0xffff" -- "tbegin\t%0,%x1" -+ (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")] -+ UNSPECV_TBEGIN)) -+ (set (match_operand:BLK 1 "memory_operand" "=Q") -+ (unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))] -+ "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" -+ "tbegin\t%1,%x0" - [(set_attr "op_type" "SIL")]) - - -@@ -10012,15 +10015,12 @@ - ; Transaction perform processor assist - - (define_expand "tx_assist" -- [(set (match_dup 1) (const_int 0)) -- (unspec_volatile [(match_operand:SI 0 "register_operand" "") -- (match_dup 1) -+ [(unspec_volatile [(match_operand:SI 0 "register_operand" "") -+ (reg:SI GPR0_REGNUM) - (const_int 1)] - UNSPECV_PPA)] - "TARGET_HTM" --{ -- operands[1] = gen_reg_rtx (SImode); --}) -+ "") - - (define_insn "*ppa" - [(unspec_volatile [(match_operand:SI 0 "register_operand" "d") -@@ -10028,5 +10028,5 @@ - (match_operand 2 "const_int_operand" "I")] - UNSPECV_PPA)] - "TARGET_HTM && INTVAL (operands[2]) < 16" -- "ppa\t%0,%1,1" -+ "ppa\t%0,%1,%2" - [(set_attr "op_type" "RRF")]) -Index: gcc/config/s390/s390.opt -=================================================================== ---- a/src/gcc/config/s390/s390.opt (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/s390.opt (.../branches/gcc-4_8-branch) -@@ -96,6 +96,14 @@ - Target Report RejectNegative Negative(msoft-float) InverseMask(SOFT_FLOAT, HARD_FLOAT) - Enable hardware floating point - -+mhotpatch -+Target Report Var(s390_deferred_options) Defer -+Prepend the function label with 12 two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching. -+ -+mhotpatch= -+Target RejectNegative Report Joined Var(s390_deferred_options) Defer -+Prepend the function label with the given number of two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching. -+ - mlong-double-128 - Target Report RejectNegative Negative(mlong-double-64) Mask(LONG_DOUBLE_128) - Use 128-bit long double -Index: gcc/config/s390/htmxlintrin.h -=================================================================== ---- a/src/gcc/config/s390/htmxlintrin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/htmxlintrin.h (.../branches/gcc-4_8-branch) -@@ -33,13 +33,20 @@ - the IBM XL compiler. For documentation please see the "z/OS XL - C/C++ Programming Guide" publically available on the web. */ - --extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -+/* FIXME: __TM_simple_begin and __TM_begin should be marked -+ __always_inline__ as well but this currently produces an error -+ since the tbegin builtins are "returns_twice" and setjmp_call_p -+ (calls.c) therefore identifies the functions as calling setjmp. -+ The tree inliner currently refuses to inline functions calling -+ setjmp. */ -+ -+long - __TM_simple_begin () - { - return __builtin_tbegin_nofloat (0); - } - --extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -+long - __TM_begin (void* const tdb) - { - return __builtin_tbegin_nofloat (tdb); -@@ -78,7 +85,7 @@ - if (depth != 0) - return depth; - -- if (tdb->format == 0) -+ if (tdb->format != 1) - return 0; - return tdb->nesting_depth; - } -@@ -90,7 +97,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- if (tdb->format == 0) -+ if (tdb->format != 1) - return 0; - - return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE); -@@ -101,7 +108,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- if (tdb->format == 0) -+ if (tdb->format != 1) - return 0; - - if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE) -@@ -117,7 +124,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- return (tdb->format == 0 -+ return (tdb->format == 1 - && (tdb->abort_code == 4 /* unfiltered program interruption */ - || tdb->abort_code == 11 /* restricted instruction */)); - } -@@ -127,7 +134,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- return (tdb->format == 0 -+ return (tdb->format == 1 - && (tdb->abort_code == 7 /* fetch overflow */ - || tdb->abort_code == 8 /* store overflow */)); - } -@@ -137,7 +144,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- return tdb->format == 0 && tdb->abort_code == 13; /* depth exceeded */ -+ return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */ - } - - extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -@@ -145,7 +152,7 @@ - { - struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; - -- return (tdb->format == 0 -+ return (tdb->format == 1 - && (tdb->abort_code == 9 /* fetch conflict */ - || tdb->abort_code == 10 /* store conflict */)); - } -Index: gcc/config/s390/s390-protos.h -=================================================================== ---- a/src/gcc/config/s390/s390-protos.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/s390/s390-protos.h (.../branches/gcc-4_8-branch) -@@ -110,5 +110,6 @@ - extern int s390_branch_condition_mask (rtx); - extern int s390_compare_and_branch_condition_mask (rtx); - extern bool s390_extzv_shift_ok (int, int, unsigned HOST_WIDE_INT); -+extern void s390_asm_output_function_label (FILE *, const char *, tree); - - #endif /* RTX_CODE */ -Index: gcc/config/sparc/t-rtems -=================================================================== ---- a/src/gcc/config/sparc/t-rtems (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/t-rtems (.../branches/gcc-4_8-branch) -@@ -17,6 +17,6 @@ - # <http://www.gnu.org/licenses/>. - # - --MULTILIB_OPTIONS = msoft-float mcpu=v8 --MULTILIB_DIRNAMES = soft v8 -+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3 -+MULTILIB_DIRNAMES = soft v8 leon3 - MULTILIB_MATCHES = msoft-float=mno-fpu -Index: gcc/config/sparc/sparc.md +Index: gcc/fortran/ChangeLog =================================================================== ---- a/src/gcc/config/sparc/sparc.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc.md (.../branches/gcc-4_8-branch) -@@ -206,7 +206,7 @@ - ;; 'f' for all DF/TFmode values, including those that are specific to the v8. - - ;; Attribute for cpu type. --;; These must match the values for enum processor_type in sparc.h. -+;; These must match the values of the enum processor_type in sparc-opts.h. - (define_attr "cpu" - "v7, - cypress, -@@ -214,6 +214,7 @@ - supersparc, - hypersparc, - leon, -+ leon3, - sparclite, - f930, - f934, -@@ -284,7 +285,8 @@ - (const_string "none")) - - (define_attr "pic" "false,true" -- (symbol_ref "(flag_pic != 0 ? PIC_TRUE : PIC_FALSE)")) -+ (symbol_ref "(flag_pic != 0 -+ ? PIC_TRUE : PIC_FALSE)")) - - (define_attr "calls_alloca" "false,true" - (symbol_ref "(cfun->calls_alloca != 0 -@@ -306,6 +308,10 @@ - (symbol_ref "(TARGET_FLAT != 0 - ? FLAT_TRUE : FLAT_FALSE)")) - -+(define_attr "fix_ut699" "false,true" -+ (symbol_ref "(sparc_fix_ut699 != 0 -+ ? FIX_UT699_TRUE : FIX_UT699_FALSE)")) -+ - ;; Length (in # of insns). - ;; Beware that setting a length greater or equal to 3 for conditional branches - ;; has a side-effect (see output_cbranch and output_v9branch). -@@ -420,32 +426,18 @@ - [(set_attr "length" "2") - (set_attr "type" "multi")]) - --;; Attributes for instruction and branch scheduling --(define_attr "tls_call_delay" "false,true" -- (symbol_ref "(tls_call_delay (insn) -- ? TLS_CALL_DELAY_TRUE : TLS_CALL_DELAY_FALSE)")) -- -+;; Attributes for branch scheduling - (define_attr "in_call_delay" "false,true" -- (cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") -- (const_string "false") -- (eq_attr "type" "load,fpload,store,fpstore") -- (if_then_else (eq_attr "length" "1") -- (const_string "true") -- (const_string "false"))] -- (if_then_else (and (eq_attr "length" "1") -- (eq_attr "tls_call_delay" "true")) -- (const_string "true") -- (const_string "false")))) -+ (symbol_ref "(eligible_for_call_delay (insn) -+ ? IN_CALL_DELAY_TRUE : IN_CALL_DELAY_FALSE)")) - --(define_attr "eligible_for_sibcall_delay" "false,true" -+(define_attr "in_sibcall_delay" "false,true" - (symbol_ref "(eligible_for_sibcall_delay (insn) -- ? ELIGIBLE_FOR_SIBCALL_DELAY_TRUE -- : ELIGIBLE_FOR_SIBCALL_DELAY_FALSE)")) -+ ? IN_SIBCALL_DELAY_TRUE : IN_SIBCALL_DELAY_FALSE)")) - --(define_attr "eligible_for_return_delay" "false,true" -+(define_attr "in_return_delay" "false,true" - (symbol_ref "(eligible_for_return_delay (insn) -- ? ELIGIBLE_FOR_RETURN_DELAY_TRUE -- : ELIGIBLE_FOR_RETURN_DELAY_FALSE)")) -+ ? IN_RETURN_DELAY_TRUE : IN_RETURN_DELAY_FALSE)")) - - ;; ??? !v9: Should implement the notion of predelay slots for floating-point - ;; branches. This would allow us to remove the nop always inserted before -@@ -460,41 +452,34 @@ - ;; because it prevents us from moving back the final store of inner loops. - - (define_attr "in_branch_delay" "false,true" -- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") -- (eq_attr "length" "1")) -- (const_string "true") -- (const_string "false"))) -+ (cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") -+ (const_string "false") -+ (and (eq_attr "fix_ut699" "true") (eq_attr "type" "load,sload")) -+ (const_string "false") -+ (and (eq_attr "fix_ut699" "true") -+ (and (eq_attr "type" "fpload,fp,fpmove,fpmul,fpdivs,fpsqrts") -+ (eq_attr "fptype" "single"))) -+ (const_string "false") -+ (eq_attr "length" "1") -+ (const_string "true") -+ ] (const_string "false"))) - --(define_attr "in_uncond_branch_delay" "false,true" -- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") -- (eq_attr "length" "1")) -- (const_string "true") -- (const_string "false"))) -- --(define_attr "in_annul_branch_delay" "false,true" -- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") -- (eq_attr "length" "1")) -- (const_string "true") -- (const_string "false"))) -- - (define_delay (eq_attr "type" "call") - [(eq_attr "in_call_delay" "true") (nil) (nil)]) - - (define_delay (eq_attr "type" "sibcall") -- [(eq_attr "eligible_for_sibcall_delay" "true") (nil) (nil)]) -+ [(eq_attr "in_sibcall_delay" "true") (nil) (nil)]) - -+(define_delay (eq_attr "type" "return") -+ [(eq_attr "in_return_delay" "true") (nil) (nil)]) -+ - (define_delay (eq_attr "type" "branch") -- [(eq_attr "in_branch_delay" "true") -- (nil) (eq_attr "in_annul_branch_delay" "true")]) -+ [(eq_attr "in_branch_delay" "true") (nil) (eq_attr "in_branch_delay" "true")]) - - (define_delay (eq_attr "type" "uncond_branch") -- [(eq_attr "in_uncond_branch_delay" "true") -- (nil) (nil)]) -+ [(eq_attr "in_branch_delay" "true") (nil) (nil)]) - --(define_delay (eq_attr "type" "return") -- [(eq_attr "eligible_for_return_delay" "true") (nil) (nil)]) - -- - ;; Include SPARC DFA schedulers - - (include "cypress.md") -@@ -5548,7 +5533,7 @@ - [(set (match_operand:DF 0 "register_operand" "=e") - (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "f")) - (float_extend:DF (match_operand:SF 2 "register_operand" "f"))))] -- "(TARGET_V8 || TARGET_V9) && TARGET_FPU" -+ "(TARGET_V8 || TARGET_V9) && TARGET_FPU && !sparc_fix_ut699" - "fsmuld\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "fptype" "double")]) -@@ -5575,22 +5560,39 @@ - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fdivq\t%1, %2, %0" -- [(set_attr "type" "fpdivd")]) -+ [(set_attr "type" "fpdivs")]) - --(define_insn "divdf3" -+(define_expand "divdf3" - [(set (match_operand:DF 0 "register_operand" "=e") - (div:DF (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" -+ "") +--- a/src/gcc/fortran/ChangeLog (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/fortran/ChangeLog (.../branches/gcc-4_8-branch) +@@ -1,3 +1,30 @@ ++2014-07-08 Paul Thomas <pault@gcc.gnu.org> + -+(define_insn "*divdf3_nofix" -+ [(set (match_operand:DF 0 "register_operand" "=e") -+ (div:DF (match_operand:DF 1 "register_operand" "e") -+ (match_operand:DF 2 "register_operand" "e")))] -+ "TARGET_FPU && !sparc_fix_ut699" - "fdivd\t%1, %2, %0" - [(set_attr "type" "fpdivd") - (set_attr "fptype" "double")]) - -+(define_insn "*divdf3_fix" -+ [(set (match_operand:DF 0 "register_operand" "=e") -+ (div:DF (match_operand:DF 1 "register_operand" "e") -+ (match_operand:DF 2 "register_operand" "e")))] -+ "TARGET_FPU && sparc_fix_ut699" -+ "fdivd\t%1, %2, %0\n\tstd\t%0, [%%sp-8]" -+ [(set_attr "type" "fpdivd") -+ (set_attr "fptype" "double") -+ (set_attr "length" "2")]) ++ PR fortran/61459 ++ PR fortran/58883 ++ * trans-expr.c (fcncall_realloc_result): Use the natural type ++ for the address expression of 'res_desc'. + - (define_insn "divsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] -- "TARGET_FPU" -+ "TARGET_FPU && !sparc_fix_ut699" - "fdivs\t%1, %2, %0" - [(set_attr "type" "fpdivs")]) - -@@ -5789,20 +5791,35 @@ - (sqrt:TF (match_operand:TF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fsqrtq\t%1, %0" -- [(set_attr "type" "fpsqrtd")]) -+ [(set_attr "type" "fpsqrts")]) - --(define_insn "sqrtdf2" -+(define_expand "sqrtdf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (sqrt:DF (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU" -+ "") ++2014-07-02 Jakub Jelinek <jakub@redhat.com> ++ Fritz Reese <Reese-Fritz@zai.com> + -+(define_insn "*sqrtdf2_nofix" -+ [(set (match_operand:DF 0 "register_operand" "=e") -+ (sqrt:DF (match_operand:DF 1 "register_operand" "e")))] -+ "TARGET_FPU && !sparc_fix_ut699" - "fsqrtd\t%1, %0" - [(set_attr "type" "fpsqrtd") - (set_attr "fptype" "double")]) - -+(define_insn "*sqrtdf2_fix" -+ [(set (match_operand:DF 0 "register_operand" "=e") -+ (sqrt:DF (match_operand:DF 1 "register_operand" "e")))] -+ "TARGET_FPU && sparc_fix_ut699" -+ "fsqrtd\t%1, %0\n\tstd\t%0, [%%sp-8]" -+ [(set_attr "type" "fpsqrtd") -+ (set_attr "fptype" "double") -+ (set_attr "length" "2")]) ++ * decl.c (variable_decl): Reject old style initialization ++ for derived type components. + - (define_insn "sqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (sqrt:SF (match_operand:SF 1 "register_operand" "f")))] -- "TARGET_FPU" -+ "TARGET_FPU && !sparc_fix_ut699" - "fsqrts\t%1, %0" - [(set_attr "type" "fpsqrts")]) - -Index: gcc/config/sparc/t-sparc -=================================================================== ---- a/src/gcc/config/sparc/t-sparc (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/t-sparc (.../branches/gcc-4_8-branch) -@@ -23,7 +23,7 @@ - insn-codes.h conditions.h output.h $(INSN_ATTR_H) $(FLAGS_H) \ - $(FUNCTION_H) $(EXCEPT_H) $(EXPR_H) $(OPTABS_H) $(RECOG_H) \ - $(DIAGNOSTIC_CORE_H) $(GGC_H) $(TM_P_H) debug.h $(TARGET_H) \ -- $(TARGET_DEF_H) $(COMMON_TARGET_H) $(GIMPLE_H) \ -+ $(TARGET_DEF_H) $(COMMON_TARGET_H) $(GIMPLE_H) $(TREE_PASS_H) \ - langhooks.h reload.h $(PARAMS_H) $(DF_H) $(OPTS_H) \ - gt-sparc.h - -Index: gcc/config/sparc/sparc.opt -=================================================================== ---- a/src/gcc/config/sparc/sparc.opt (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc.opt (.../branches/gcc-4_8-branch) -@@ -146,6 +146,9 @@ - Enum(sparc_processor_type) String(leon) Value(PROCESSOR_LEON) - - EnumValue -+Enum(sparc_processor_type) String(leon3) Value(PROCESSOR_LEON3) ++2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + -+EnumValue - Enum(sparc_processor_type) String(sparclite) Value(PROCESSOR_SPARCLITE) - - EnumValue -@@ -201,9 +204,19 @@ - Enable workaround for single erratum of AT697F processor - (corresponding to erratum #13 of AT697E processor) - -+mfix-ut699 -+Target Report RejectNegative Var(sparc_fix_ut699) -+Enable workarounds for the errata of the UT699 processor ++ Backport from trunk. ++ PR fortran/45187 ++ * trans-decl.c (gfc_create_module_variable): Don't create ++ Cray-pointee decls twice. + - Mask(LONG_DOUBLE_128) - ;; Use 128-bit long double - -+Mask(LEON) -+;; Generate code for LEON ++2014-05-26 Janne Blomqvist <jb@gcc.gnu.org> + -+Mask(LEON3) -+;; Generate code for LEON3 ++ Backport from mainline ++ PR libfortran/61310 ++ * intrinsics.texi (CTIME): Remove mention of locale-dependent ++ behavior. + - Mask(SPARCLITE) - ;; Generate code for SPARClite - -Index: gcc/config/sparc/sync.md -=================================================================== ---- a/src/gcc/config/sparc/sync.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sync.md (.../branches/gcc-4_8-branch) -@@ -161,7 +161,8 @@ - (match_operand:SI 5 "const_int_operand" "") ;; is_weak - (match_operand:SI 6 "const_int_operand" "") ;; mod_s - (match_operand:SI 7 "const_int_operand" "")] ;; mod_f -- "TARGET_V9 && (<MODE>mode != DImode || TARGET_ARCH64 || TARGET_V8PLUS)" -+ "(TARGET_V9 || TARGET_LEON3) -+ && (<MODE>mode != DImode || TARGET_ARCH64 || TARGET_V8PLUS)" - { - sparc_expand_compare_and_swap (operands); - DONE; -@@ -176,7 +177,7 @@ - [(match_operand:I48MODE 2 "register_operand" "") - (match_operand:I48MODE 3 "register_operand" "")] - UNSPECV_CAS))])] -- "TARGET_V9" -+ "TARGET_V9 || TARGET_LEON3" - "") + 2014-05-22 Release Manager - (define_insn "*atomic_compare_and_swap<mode>_1" -@@ -187,7 +188,7 @@ - [(match_operand:I48MODE 2 "register_operand" "r") - (match_operand:I48MODE 3 "register_operand" "0")] - UNSPECV_CAS))] -- "TARGET_V9 && (<MODE>mode == SImode || TARGET_ARCH64)" -+ "(TARGET_V9 || TARGET_LEON3) && (<MODE>mode != DImode || TARGET_ARCH64)" - "cas<modesuffix>\t%1, %2, %0" - [(set_attr "type" "multi")]) - -@@ -220,7 +221,7 @@ - (match_operand:SI 1 "memory_operand" "") - (match_operand:SI 2 "register_operand" "") - (match_operand:SI 3 "const_int_operand" "")] -- "TARGET_V8 || TARGET_V9" -+ "(TARGET_V8 || TARGET_V9) && !sparc_fix_ut699" - { - enum memmodel model = (enum memmodel) INTVAL (operands[3]); - -@@ -236,7 +237,7 @@ - UNSPECV_SWAP)) - (set (match_dup 1) - (match_operand:SI 2 "register_operand" "0"))] -- "TARGET_V8 || TARGET_V9" -+ "(TARGET_V8 || TARGET_V9) && !sparc_fix_ut699" - "swap\t%1, %0" - [(set_attr "type" "multi")]) - -@@ -244,7 +245,7 @@ - [(match_operand:QI 0 "register_operand" "") - (match_operand:QI 1 "memory_operand" "") - (match_operand:SI 2 "const_int_operand" "")] -- "" -+ "!sparc_fix_ut699" - { - enum memmodel model = (enum memmodel) INTVAL (operands[2]); - rtx ret; -@@ -268,6 +269,6 @@ - (unspec_volatile:QI [(match_operand:QI 1 "memory_operand" "+m")] - UNSPECV_LDSTUB)) - (set (match_dup 1) (const_int -1))] -- "" -+ "!sparc_fix_ut699" - "ldstub\t%1, %0" - [(set_attr "type" "multi")]) -Index: gcc/config/sparc/sparc-opts.h -=================================================================== ---- a/src/gcc/config/sparc/sparc-opts.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc-opts.h (.../branches/gcc-4_8-branch) -@@ -30,6 +30,7 @@ - PROCESSOR_SUPERSPARC, - PROCESSOR_HYPERSPARC, - PROCESSOR_LEON, -+ PROCESSOR_LEON3, - PROCESSOR_SPARCLITE, - PROCESSOR_F930, - PROCESSOR_F934, -Index: gcc/config/sparc/sparc-protos.h -=================================================================== ---- a/src/gcc/config/sparc/sparc-protos.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc-protos.h (.../branches/gcc-4_8-branch) -@@ -84,9 +84,9 @@ - extern int mems_ok_for_ldd_peep (rtx, rtx, rtx); - extern int empty_delay_slot (rtx); - extern int emit_cbcond_nop (rtx); -+extern int eligible_for_call_delay (rtx); - extern int eligible_for_return_delay (rtx); - extern int eligible_for_sibcall_delay (rtx); --extern int tls_call_delay (rtx); - extern int emit_move_sequence (rtx, enum machine_mode); - extern int fp_sethi_p (rtx); - extern int fp_mov_p (rtx); -Index: gcc/config/sparc/sparc.c + * GCC 4.8.3 released. +Index: gcc/fortran/trans-decl.c =================================================================== ---- a/src/gcc/config/sparc/sparc.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc.c (.../branches/gcc-4_8-branch) -@@ -52,6 +52,7 @@ - #include "params.h" - #include "df.h" - #include "opts.h" -+#include "tree-pass.h" - - /* Processor costs */ - -@@ -226,6 +227,30 @@ - }; - - static const -+struct processor_costs leon3_costs = { -+ COSTS_N_INSNS (1), /* int load */ -+ COSTS_N_INSNS (1), /* int signed load */ -+ COSTS_N_INSNS (1), /* int zeroed load */ -+ COSTS_N_INSNS (1), /* float load */ -+ COSTS_N_INSNS (1), /* fmov, fneg, fabs */ -+ COSTS_N_INSNS (1), /* fadd, fsub */ -+ COSTS_N_INSNS (1), /* fcmp */ -+ COSTS_N_INSNS (1), /* fmov, fmovr */ -+ COSTS_N_INSNS (1), /* fmul */ -+ COSTS_N_INSNS (14), /* fdivs */ -+ COSTS_N_INSNS (15), /* fdivd */ -+ COSTS_N_INSNS (22), /* fsqrts */ -+ COSTS_N_INSNS (23), /* fsqrtd */ -+ COSTS_N_INSNS (5), /* imul */ -+ COSTS_N_INSNS (5), /* imulX */ -+ 0, /* imul bit factor */ -+ COSTS_N_INSNS (35), /* idiv */ -+ COSTS_N_INSNS (35), /* idivX */ -+ COSTS_N_INSNS (1), /* movcc/movr */ -+ 0, /* shift penalty */ -+}; -+ -+static const - struct processor_costs sparclet_costs = { - COSTS_N_INSNS (3), /* int load */ - COSTS_N_INSNS (3), /* int signed load */ -@@ -538,7 +563,6 @@ - HOST_WIDE_INT, tree); - static bool sparc_can_output_mi_thunk (const_tree, HOST_WIDE_INT, - HOST_WIDE_INT, const_tree); --static void sparc_reorg (void); - static struct machine_function * sparc_init_machine_status (void); - static bool sparc_cannot_force_const_mem (enum machine_mode, rtx); - static rtx sparc_tls_get_addr (void); -@@ -680,9 +704,6 @@ - #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK - #define TARGET_ASM_CAN_OUTPUT_MI_THUNK sparc_can_output_mi_thunk - --#undef TARGET_MACHINE_DEPENDENT_REORG --#define TARGET_MACHINE_DEPENDENT_REORG sparc_reorg -- - #undef TARGET_RTX_COSTS - #define TARGET_RTX_COSTS sparc_rtx_costs - #undef TARGET_ADDRESS_COST -@@ -804,6 +825,306 @@ - - struct gcc_target targetm = TARGET_INITIALIZER; - -+/* Return the memory reference contained in X if any, zero otherwise. */ -+ -+static rtx -+mem_ref (rtx x) -+{ -+ if (GET_CODE (x) == SIGN_EXTEND || GET_CODE (x) == ZERO_EXTEND) -+ x = XEXP (x, 0); -+ -+ if (MEM_P (x)) -+ return x; -+ -+ return NULL_RTX; -+} -+ -+/* We use a machine specific pass to enable workarounds for errata. -+ We need to have the (essentially) final form of the insn stream in order -+ to properly detect the various hazards. Therefore, this machine specific -+ pass runs as late as possible. The pass is inserted in the pass pipeline -+ at the end of sparc_option_override. */ -+ -+static bool -+sparc_gate_work_around_errata (void) -+{ -+ /* The only errata we handle are those of the AT697F and UT699. */ -+ return sparc_fix_at697f != 0 || sparc_fix_ut699 != 0; -+} -+ -+static unsigned int -+sparc_do_work_around_errata (void) -+{ -+ rtx insn, next; -+ -+ /* Force all instructions to be split into their final form. */ -+ split_all_insns_noflow (); -+ -+ /* Now look for specific patterns in the insn stream. */ -+ for (insn = get_insns (); insn; insn = next) -+ { -+ bool insert_nop = false; -+ rtx set; -+ -+ /* Look into the instruction in a delay slot. */ -+ if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE) -+ insn = XVECEXP (PATTERN (insn), 0, 1); -+ -+ /* Look for a single-word load into an odd-numbered FP register. */ -+ if (sparc_fix_at697f -+ && NONJUMP_INSN_P (insn) -+ && (set = single_set (insn)) != NULL_RTX -+ && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4 -+ && MEM_P (SET_SRC (set)) -+ && REG_P (SET_DEST (set)) -+ && REGNO (SET_DEST (set)) > 31 -+ && REGNO (SET_DEST (set)) % 2 != 0) -+ { -+ /* The wrong dependency is on the enclosing double register. */ -+ const unsigned int x = REGNO (SET_DEST (set)) - 1; -+ unsigned int src1, src2, dest; -+ int code; -+ -+ next = next_active_insn (insn); -+ if (!next) -+ break; -+ /* If the insn is a branch, then it cannot be problematic. */ -+ if (!NONJUMP_INSN_P (next) || GET_CODE (PATTERN (next)) == SEQUENCE) -+ continue; -+ -+ extract_insn (next); -+ code = INSN_CODE (next); -+ -+ switch (code) -+ { -+ case CODE_FOR_adddf3: -+ case CODE_FOR_subdf3: -+ case CODE_FOR_muldf3: -+ case CODE_FOR_divdf3: -+ dest = REGNO (recog_data.operand[0]); -+ src1 = REGNO (recog_data.operand[1]); -+ src2 = REGNO (recog_data.operand[2]); -+ if (src1 != src2) -+ { -+ /* Case [1-4]: -+ ld [address], %fx+1 -+ FPOPd %f{x,y}, %f{y,x}, %f{x,y} */ -+ if ((src1 == x || src2 == x) -+ && (dest == src1 || dest == src2)) -+ insert_nop = true; -+ } -+ else -+ { -+ /* Case 5: -+ ld [address], %fx+1 -+ FPOPd %fx, %fx, %fx */ -+ if (src1 == x -+ && dest == src1 -+ && (code == CODE_FOR_adddf3 || code == CODE_FOR_muldf3)) -+ insert_nop = true; -+ } -+ break; -+ -+ case CODE_FOR_sqrtdf2: -+ dest = REGNO (recog_data.operand[0]); -+ src1 = REGNO (recog_data.operand[1]); -+ /* Case 6: -+ ld [address], %fx+1 -+ fsqrtd %fx, %fx */ -+ if (src1 == x && dest == src1) -+ insert_nop = true; -+ break; -+ -+ default: -+ break; -+ } -+ } -+ -+ /* Look for a single-word load into an integer register. */ -+ else if (sparc_fix_ut699 -+ && NONJUMP_INSN_P (insn) -+ && (set = single_set (insn)) != NULL_RTX -+ && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) <= 4 -+ && mem_ref (SET_SRC (set)) != NULL_RTX -+ && REG_P (SET_DEST (set)) -+ && REGNO (SET_DEST (set)) < 32) -+ { -+ /* There is no problem if the second memory access has a data -+ dependency on the first single-cycle load. */ -+ rtx x = SET_DEST (set); -+ -+ next = next_active_insn (insn); -+ if (!next) -+ break; -+ /* If the insn is a branch, then it cannot be problematic. */ -+ if (!NONJUMP_INSN_P (next) || GET_CODE (PATTERN (next)) == SEQUENCE) -+ continue; -+ -+ /* Look for a second memory access to/from an integer register. */ -+ if ((set = single_set (next)) != NULL_RTX) -+ { -+ rtx src = SET_SRC (set); -+ rtx dest = SET_DEST (set); -+ rtx mem; -+ -+ /* LDD is affected. */ -+ if ((mem = mem_ref (src)) != NULL_RTX -+ && REG_P (dest) -+ && REGNO (dest) < 32 -+ && !reg_mentioned_p (x, XEXP (mem, 0))) -+ insert_nop = true; -+ -+ /* STD is *not* affected. */ -+ else if (MEM_P (dest) -+ && GET_MODE_SIZE (GET_MODE (dest)) <= 4 -+ && (src == CONST0_RTX (GET_MODE (dest)) -+ || (REG_P (src) -+ && REGNO (src) < 32 -+ && REGNO (src) != REGNO (x))) -+ && !reg_mentioned_p (x, XEXP (dest, 0))) -+ insert_nop = true; -+ } -+ } -+ -+ /* Look for a single-word load/operation into an FP register. */ -+ else if (sparc_fix_ut699 -+ && NONJUMP_INSN_P (insn) -+ && (set = single_set (insn)) != NULL_RTX -+ && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4 -+ && REG_P (SET_DEST (set)) -+ && REGNO (SET_DEST (set)) > 31) -+ { -+ /* Number of instructions in the problematic window. */ -+ const int n_insns = 4; -+ /* The problematic combination is with the sibling FP register. */ -+ const unsigned int x = REGNO (SET_DEST (set)); -+ const unsigned int y = x ^ 1; -+ rtx after; -+ int i; -+ -+ next = next_active_insn (insn); -+ if (!next) -+ break; -+ /* If the insn is a branch, then it cannot be problematic. */ -+ if (!NONJUMP_INSN_P (next) || GET_CODE (PATTERN (next)) == SEQUENCE) -+ continue; -+ -+ /* Look for a second load/operation into the sibling FP register. */ -+ if (!((set = single_set (next)) != NULL_RTX -+ && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4 -+ && REG_P (SET_DEST (set)) -+ && REGNO (SET_DEST (set)) == y)) -+ continue; -+ -+ /* Look for a (possible) store from the FP register in the next N -+ instructions, but bail out if it is again modified or if there -+ is a store from the sibling FP register before this store. */ -+ for (after = next, i = 0; i < n_insns; i++) -+ { -+ bool branch_p; -+ -+ after = next_active_insn (after); -+ if (!after) -+ break; -+ -+ /* This is a branch with an empty delay slot. */ -+ if (!NONJUMP_INSN_P (after)) -+ { -+ if (++i == n_insns) -+ break; -+ branch_p = true; -+ after = NULL_RTX; -+ } -+ /* This is a branch with a filled delay slot. */ -+ else if (GET_CODE (PATTERN (after)) == SEQUENCE) -+ { -+ if (++i == n_insns) -+ break; -+ branch_p = true; -+ after = XVECEXP (PATTERN (after), 0, 1); -+ } -+ /* This is a regular instruction. */ -+ else -+ branch_p = false; -+ -+ if (after && (set = single_set (after)) != NULL_RTX) -+ { -+ const rtx src = SET_SRC (set); -+ const rtx dest = SET_DEST (set); -+ const unsigned int size = GET_MODE_SIZE (GET_MODE (dest)); -+ -+ /* If the FP register is again modified before the store, -+ then the store isn't affected. */ -+ if (REG_P (dest) -+ && (REGNO (dest) == x -+ || (REGNO (dest) == y && size == 8))) -+ break; -+ -+ if (MEM_P (dest) && REG_P (src)) -+ { -+ /* If there is a store from the sibling FP register -+ before the store, then the store is not affected. */ -+ if (REGNO (src) == y || (REGNO (src) == x && size == 8)) -+ break; -+ -+ /* Otherwise, the store is affected. */ -+ if (REGNO (src) == x && size == 4) -+ { -+ insert_nop = true; -+ break; -+ } -+ } -+ } -+ -+ /* If we have a branch in the first M instructions, then we -+ cannot see the (M+2)th instruction so we play safe. */ -+ if (branch_p && i <= (n_insns - 2)) -+ { -+ insert_nop = true; -+ break; -+ } -+ } -+ } -+ -+ else -+ next = NEXT_INSN (insn); -+ -+ if (insert_nop) -+ emit_insn_before (gen_nop (), next); -+ } -+ -+ return 0; -+} -+ -+struct rtl_opt_pass pass_work_around_errata = -+{ -+ { -+ RTL_PASS, -+ "errata", /* name */ -+ OPTGROUP_NONE, /* optinfo_flags */ -+ sparc_gate_work_around_errata, /* gate */ -+ sparc_do_work_around_errata, /* execute */ -+ NULL, /* sub */ -+ NULL, /* next */ -+ 0, /* static_pass_number */ -+ TV_MACH_DEP, /* tv_id */ -+ 0, /* properties_required */ -+ 0, /* properties_provided */ -+ 0, /* properties_destroyed */ -+ 0, /* todo_flags_start */ -+ TODO_verify_rtl_sharing, /* todo_flags_finish */ -+ } -+}; -+ -+struct register_pass_info insert_pass_work_around_errata = -+{ -+ &pass_work_around_errata.pass, /* pass */ -+ "dbr", /* reference_pass_name */ -+ 1, /* ref_pass_instance_number */ -+ PASS_POS_INSERT_AFTER /* po_op */ -+}; -+ -+/* Helpers for TARGET_DEBUG_OPTIONS. */ - static void - dump_target_flag_bits (const int flags) - { -@@ -888,6 +1209,7 @@ - { TARGET_CPU_supersparc, PROCESSOR_SUPERSPARC }, - { TARGET_CPU_hypersparc, PROCESSOR_HYPERSPARC }, - { TARGET_CPU_leon, PROCESSOR_LEON }, -+ { TARGET_CPU_leon3, PROCESSOR_LEON3 }, - { TARGET_CPU_sparclite, PROCESSOR_F930 }, - { TARGET_CPU_sparclite86x, PROCESSOR_SPARCLITE86X }, - { TARGET_CPU_sparclet, PROCESSOR_TSC701 }, -@@ -902,7 +1224,7 @@ - }; - const struct cpu_default *def; - /* Table of values for -m{cpu,tune}=. This must match the order of -- the PROCESSOR_* enumeration. */ -+ the enum processor_type in sparc-opts.h. */ - static struct cpu_table { - const char *const name; - const int disable; -@@ -914,8 +1236,8 @@ - /* TI TMS390Z55 supersparc */ - { "supersparc", MASK_ISA, MASK_V8 }, - { "hypersparc", MASK_ISA, MASK_V8|MASK_FPU }, -- /* LEON */ -- { "leon", MASK_ISA, MASK_V8|MASK_FPU }, -+ { "leon", MASK_ISA, MASK_V8|MASK_LEON|MASK_FPU }, -+ { "leon3", MASK_ISA, MASK_V8|MASK_LEON3|MASK_FPU }, - { "sparclite", MASK_ISA, MASK_SPARCLITE }, - /* The Fujitsu MB86930 is the original sparclite chip, with no FPU. */ - { "f930", MASK_ISA|MASK_FPU, MASK_SPARCLITE }, -@@ -1075,6 +1397,9 @@ - #ifndef HAVE_AS_SPARC4 - & ~MASK_CBCOND - #endif -+#ifndef HAVE_AS_LEON -+ & ~(MASK_LEON | MASK_LEON3) -+#endif - ); - - /* If -mfpu or -mno-fpu was explicitly used, don't override with -@@ -1164,6 +1489,9 @@ - case PROCESSOR_LEON: - sparc_costs = &leon_costs; - break; -+ case PROCESSOR_LEON3: -+ sparc_costs = &leon3_costs; -+ break; - case PROCESSOR_SPARCLET: - case PROCESSOR_TSC701: - sparc_costs = &sparclet_costs; -@@ -1200,6 +1528,10 @@ - /* Choose the most relaxed model for the processor. */ - else if (TARGET_V9) - sparc_memory_model = SMM_RMO; -+ else if (TARGET_LEON3) -+ sparc_memory_model = SMM_TSO; -+ else if (TARGET_LEON) -+ sparc_memory_model = SMM_SC; - else if (TARGET_V8) - sparc_memory_model = SMM_PSO; - else -@@ -1241,6 +1573,13 @@ - pessimizes for double floating-point registers. */ - if (!global_options_set.x_flag_ira_share_save_slots) - flag_ira_share_save_slots = 0; -+ -+ /* We register a machine specific pass to work around errata, if any. -+ The pass mut be scheduled as late as possible so that we have the -+ (essentially) final form of the insn stream to work on. -+ Registering the pass must be done at start up. It's convenient to -+ do it here. */ -+ register_pass (&insert_pass_work_around_errata); - } - - /* Miscellaneous utilities. */ -@@ -3090,10 +3429,13 @@ - /* Return nonzero if TRIAL can go into the call delay slot. */ - - int --tls_call_delay (rtx trial) -+eligible_for_call_delay (rtx trial) - { - rtx pat; - -+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE) -+ return 0; -+ - /* Binutils allows - call __tls_get_addr, %tgd_call (foo) - add %l7, %o0, %o0, %tgd_add (foo) -@@ -3175,11 +3517,7 @@ - - /* If we have the 'return' instruction, anything that does not use - local or output registers and can go into a delay slot wins. */ -- else if (return_p -- && TARGET_V9 -- && !epilogue_renumber (&pat, 1) -- && get_attr_in_uncond_branch_delay (trial) -- == IN_UNCOND_BRANCH_DELAY_TRUE) -+ else if (return_p && TARGET_V9 && !epilogue_renumber (&pat, 1)) - return 1; - - /* The 'restore src1,src2,dest' pattern for SImode. */ -@@ -3222,22 +3560,21 @@ - int regno; - rtx pat; - -- if (GET_CODE (trial) != INSN) -- return 0; -- -- if (get_attr_length (trial) != 1) -- return 0; -- - /* If the function uses __builtin_eh_return, the eh_return machinery - occupies the delay slot. */ - if (crtl->calls_eh_return) - return 0; - -+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE) -+ return 0; -+ - /* In the case of a leaf or flat function, anything can go into the slot. */ - if (sparc_leaf_function_p || TARGET_FLAT) -- return -- get_attr_in_uncond_branch_delay (trial) == IN_UNCOND_BRANCH_DELAY_TRUE; -+ return 1; - -+ if (!NONJUMP_INSN_P (trial)) -+ return 0; -+ - pat = PATTERN (trial); - if (GET_CODE (pat) == PARALLEL) - { -@@ -3256,9 +3593,7 @@ - if (regno >= 8 && regno < 24) - return 0; - } -- return !epilogue_renumber (&pat, 1) -- && (get_attr_in_uncond_branch_delay (trial) -- == IN_UNCOND_BRANCH_DELAY_TRUE); -+ return !epilogue_renumber (&pat, 1); - } - - if (GET_CODE (pat) != SET) -@@ -3278,10 +3613,7 @@ - instruction, it can probably go in. But restore will not work - with FP_REGS. */ - if (! SPARC_INT_REG_P (regno)) -- return (TARGET_V9 -- && !epilogue_renumber (&pat, 1) -- && get_attr_in_uncond_branch_delay (trial) -- == IN_UNCOND_BRANCH_DELAY_TRUE); -+ return TARGET_V9 && !epilogue_renumber (&pat, 1); - - return eligible_for_restore_insn (trial, true); - } -@@ -3293,10 +3625,10 @@ - { - rtx pat; - -- if (GET_CODE (trial) != INSN || GET_CODE (PATTERN (trial)) != SET) -+ if (get_attr_in_branch_delay (trial) == IN_BRANCH_DELAY_FALSE) - return 0; - -- if (get_attr_length (trial) != 1) -+ if (!NONJUMP_INSN_P (trial)) - return 0; - - pat = PATTERN (trial); -@@ -3315,6 +3647,9 @@ - return 1; +--- a/src/gcc/fortran/trans-decl.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/fortran/trans-decl.c (.../branches/gcc-4_8-branch) +@@ -4084,8 +4084,8 @@ } -+ if (GET_CODE (pat) != SET) -+ return 0; -+ - /* Otherwise, only operations which can be done in tandem with - a `restore' insn can go into the delay slot. */ - if (GET_CODE (SET_DEST (pat)) != REG -@@ -10355,7 +10690,8 @@ - tmp = e0.add_with_sign (tmp, false, &add1_ovf); - if (tmp.is_negative ()) - tmp = tmp.neg_with_overflow (&neg2_ovf); -- -+ else -+ neg2_ovf = false; - result = result.add_with_sign (tmp, false, &add2_ovf); - overflow |= neg1_ovf | neg2_ovf | add1_ovf | add2_ovf; - } -@@ -10897,107 +11233,6 @@ - return (vcall_offset >= -32768 || ! fixed_regs[5]); - } - --/* We use the machine specific reorg pass to enable workarounds for errata. */ -- --static void --sparc_reorg (void) --{ -- rtx insn, next; -- -- /* The only erratum we handle for now is that of the AT697F processor. */ -- if (!sparc_fix_at697f) -- return; -- -- /* We need to have the (essentially) final form of the insn stream in order -- to properly detect the various hazards. Run delay slot scheduling. */ -- if (optimize > 0 && flag_delayed_branch) -- { -- cleanup_barriers (); -- dbr_schedule (get_insns ()); -- } -- -- /* Now look for specific patterns in the insn stream. */ -- for (insn = get_insns (); insn; insn = next) -- { -- bool insert_nop = false; -- rtx set; -- -- /* Look for a single-word load into an odd-numbered FP register. */ -- if (NONJUMP_INSN_P (insn) -- && (set = single_set (insn)) != NULL_RTX -- && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4 -- && MEM_P (SET_SRC (set)) -- && REG_P (SET_DEST (set)) -- && REGNO (SET_DEST (set)) > 31 -- && REGNO (SET_DEST (set)) % 2 != 0) -- { -- /* The wrong dependency is on the enclosing double register. */ -- unsigned int x = REGNO (SET_DEST (set)) - 1; -- unsigned int src1, src2, dest; -- int code; -- -- /* If the insn has a delay slot, then it cannot be problematic. */ -- next = next_active_insn (insn); -- if (NONJUMP_INSN_P (next) && GET_CODE (PATTERN (next)) == SEQUENCE) -- code = -1; -- else -- { -- extract_insn (next); -- code = INSN_CODE (next); -- } -- -- switch (code) -- { -- case CODE_FOR_adddf3: -- case CODE_FOR_subdf3: -- case CODE_FOR_muldf3: -- case CODE_FOR_divdf3: -- dest = REGNO (recog_data.operand[0]); -- src1 = REGNO (recog_data.operand[1]); -- src2 = REGNO (recog_data.operand[2]); -- if (src1 != src2) -- { -- /* Case [1-4]: -- ld [address], %fx+1 -- FPOPd %f{x,y}, %f{y,x}, %f{x,y} */ -- if ((src1 == x || src2 == x) -- && (dest == src1 || dest == src2)) -- insert_nop = true; -- } -- else -- { -- /* Case 5: -- ld [address], %fx+1 -- FPOPd %fx, %fx, %fx */ -- if (src1 == x -- && dest == src1 -- && (code == CODE_FOR_adddf3 || code == CODE_FOR_muldf3)) -- insert_nop = true; -- } -- break; -- -- case CODE_FOR_sqrtdf2: -- dest = REGNO (recog_data.operand[0]); -- src1 = REGNO (recog_data.operand[1]); -- /* Case 6: -- ld [address], %fx+1 -- fsqrtd %fx, %fx */ -- if (src1 == x && dest == src1) -- insert_nop = true; -- break; -- -- default: -- break; -- } -- } -- else -- next = NEXT_INSN (insn); -- -- if (insert_nop) -- emit_insn_after (gen_nop (), insn); -- } --} -- - /* How to allocate a 'struct machine_function'. */ - - static struct machine_function * -Index: gcc/config/sparc/leon.md -=================================================================== ---- a/src/gcc/config/sparc/leon.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/leon.md (.../branches/gcc-4_8-branch) -@@ -17,40 +17,48 @@ - ;; along with GCC; see the file COPYING3. If not see - ;; <http://www.gnu.org/licenses/>. - -+;; Leon is a single-issue processor. - - (define_automaton "leon") - --(define_cpu_unit "leon_memory, leon_fpalu" "leon") --(define_cpu_unit "leon_fpmds" "leon") --(define_cpu_unit "write_buf" "leon") -+(define_cpu_unit "leon_memory" "leon") - - (define_insn_reservation "leon_load" 1 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "load,sload,fpload")) -+ (and (eq_attr "cpu" "leon") (eq_attr "type" "load,sload")) - "leon_memory") - --(define_insn_reservation "leon_store" 1 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "store,fpstore")) -- "leon_memory+write_buf") -- --(define_insn_reservation "leon_fp_alu" 1 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "fp,fpmove")) -- "leon_fpalu, nothing") -+;; Use a double reservation to work around the load pipeline hazard on UT699. -+(define_insn_reservation "leon3_load" 1 -+ (and (eq_attr "cpu" "leon3") (eq_attr "type" "load,sload")) -+ "leon_memory*2") - --(define_insn_reservation "leon_fp_mult" 1 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "fpmul")) -- "leon_fpmds, nothing") -+(define_insn_reservation "leon_store" 2 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "store")) -+ "leon_memory*2") - --(define_insn_reservation "leon_fp_div" 16 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "fpdivs,fpdivd")) -- "leon_fpmds, nothing*15") -+;; This describes Gaisler Research's FPU - --(define_insn_reservation "leon_fp_sqrt" 23 -- (and (eq_attr "cpu" "leon") -- (eq_attr "type" "fpsqrts,fpsqrtd")) -- "leon_fpmds, nothing*21") -+(define_automaton "grfpu") + /* Don't generate variables from other modules. Variables from +- COMMONs will already have been generated. */ +- if (sym->attr.use_assoc || sym->attr.in_common) ++ COMMONs and Cray pointees will already have been generated. */ ++ if (sym->attr.use_assoc || sym->attr.in_common || sym->attr.cray_pointee) + return; -+(define_cpu_unit "grfpu_alu" "grfpu") -+(define_cpu_unit "grfpu_ds" "grfpu") -+ -+(define_insn_reservation "leon_fp_alu" 4 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fp,fpcmp,fpmul")) -+ "grfpu_alu, nothing*3") -+ -+(define_insn_reservation "leon_fp_divs" 16 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpdivs")) -+ "grfpu_ds*14, nothing*2") -+ -+(define_insn_reservation "leon_fp_divd" 17 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpdivd")) -+ "grfpu_ds*15, nothing*2") -+ -+(define_insn_reservation "leon_fp_sqrts" 24 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpsqrts")) -+ "grfpu_ds*22, nothing*2") -+ -+(define_insn_reservation "leon_fp_sqrtd" 25 -+ (and (eq_attr "cpu" "leon,leon3") (eq_attr "type" "fpsqrtd")) -+ "grfpu_ds*23, nothing*2") -Index: gcc/config/sparc/sparc.h + /* Equivalenced variables arrive here after creation. */ +Index: gcc/function.c =================================================================== ---- a/src/gcc/config/sparc/sparc.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sparc/sparc.h (.../branches/gcc-4_8-branch) -@@ -136,21 +136,22 @@ - #define TARGET_CPU_supersparc 2 - #define TARGET_CPU_hypersparc 3 - #define TARGET_CPU_leon 4 --#define TARGET_CPU_sparclite 5 --#define TARGET_CPU_f930 5 /* alias */ --#define TARGET_CPU_f934 5 /* alias */ --#define TARGET_CPU_sparclite86x 6 --#define TARGET_CPU_sparclet 7 --#define TARGET_CPU_tsc701 7 /* alias */ --#define TARGET_CPU_v9 8 /* generic v9 implementation */ --#define TARGET_CPU_sparcv9 8 /* alias */ --#define TARGET_CPU_sparc64 8 /* alias */ --#define TARGET_CPU_ultrasparc 9 --#define TARGET_CPU_ultrasparc3 10 --#define TARGET_CPU_niagara 11 --#define TARGET_CPU_niagara2 12 --#define TARGET_CPU_niagara3 13 --#define TARGET_CPU_niagara4 14 -+#define TARGET_CPU_leon3 5 -+#define TARGET_CPU_sparclite 6 -+#define TARGET_CPU_f930 6 /* alias */ -+#define TARGET_CPU_f934 6 /* alias */ -+#define TARGET_CPU_sparclite86x 7 -+#define TARGET_CPU_sparclet 8 -+#define TARGET_CPU_tsc701 8 /* alias */ -+#define TARGET_CPU_v9 9 /* generic v9 implementation */ -+#define TARGET_CPU_sparcv9 9 /* alias */ -+#define TARGET_CPU_sparc64 9 /* alias */ -+#define TARGET_CPU_ultrasparc 10 -+#define TARGET_CPU_ultrasparc3 11 -+#define TARGET_CPU_niagara 12 -+#define TARGET_CPU_niagara2 13 -+#define TARGET_CPU_niagara3 14 -+#define TARGET_CPU_niagara4 15 - - #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \ - || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \ -@@ -232,9 +233,10 @@ - #define ASM_CPU32_DEFAULT_SPEC "" - #endif - --#if TARGET_CPU_DEFAULT == TARGET_CPU_leon -+#if TARGET_CPU_DEFAULT == TARGET_CPU_leon \ -+ || TARGET_CPU_DEFAULT == TARGET_CPU_leon3 - #define CPP_CPU32_DEFAULT_SPEC "-D__leon__ -D__sparc_v8__" --#define ASM_CPU32_DEFAULT_SPEC "" -+#define ASM_CPU32_DEFAULT_SPEC AS_LEON_FLAG - #endif - - #endif -@@ -282,6 +284,7 @@ - %{mcpu=supersparc:-D__supersparc__ -D__sparc_v8__} \ - %{mcpu=hypersparc:-D__hypersparc__ -D__sparc_v8__} \ - %{mcpu=leon:-D__leon__ -D__sparc_v8__} \ -+%{mcpu=leon3:-D__leon__ -D__sparc_v8__} \ - %{mcpu=v9:-D__sparc_v9__} \ - %{mcpu=ultrasparc:-D__sparc_v9__} \ - %{mcpu=ultrasparc3:-D__sparc_v9__} \ -@@ -329,7 +332,8 @@ - %{mcpu=v8:-Av8} \ - %{mcpu=supersparc:-Av8} \ - %{mcpu=hypersparc:-Av8} \ --%{mcpu=leon:-Av8} \ -+%{mcpu=leon:" AS_LEON_FLAG "} \ -+%{mcpu=leon3:" AS_LEON_FLAG "} \ - %{mv8plus:-Av8plus} \ - %{mcpu=v9:-Av9} \ - %{mcpu=ultrasparc:%{!mv8plus:-Av9a}} \ -@@ -1754,6 +1758,12 @@ - #define AS_NIAGARA4_FLAG "-Av9" AS_NIAGARA3_FLAG +--- a/src/gcc/function.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/function.c (.../branches/gcc-4_8-branch) +@@ -1354,9 +1354,13 @@ + #define STACK_POINTER_OFFSET 0 #endif -+#ifdef HAVE_AS_LEON -+#define AS_LEON_FLAG "-Aleon" -+#else -+#define AS_LEON_FLAG "-Av8" ++#if defined (REG_PARM_STACK_SPACE) && !defined (INCOMING_REG_PARM_STACK_SPACE) ++#define INCOMING_REG_PARM_STACK_SPACE REG_PARM_STACK_SPACE +#endif + - /* We use gcc _mcount for profiling. */ - #define NO_PROFILE_COUNTERS 0 - -Index: gcc/config/i386/i386.h -=================================================================== ---- a/src/gcc/config/i386/i386.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/i386.h (.../branches/gcc-4_8-branch) -@@ -197,10 +197,10 @@ + /* If not defined, pick an appropriate default for the offset of dynamically + allocated memory depending on the value of ACCUMULATE_OUTGOING_ARGS, +- REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ ++ INCOMING_REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ - /* Macros used in the machine description to test the flags. */ + #ifndef STACK_DYNAMIC_OFFSET --/* configure can arrange to make this 2, to force a 486. */ -+/* configure can arrange to change it. */ +@@ -1368,12 +1372,12 @@ + `crtl->outgoing_args_size'. Nevertheless, we must allow + for it when allocating stack dynamic objects. */ - #ifndef TARGET_CPU_DEFAULT --#define TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT_generic -+#define TARGET_CPU_DEFAULT PROCESSOR_GENERIC32 +-#if defined(REG_PARM_STACK_SPACE) ++#ifdef INCOMING_REG_PARM_STACK_SPACE + #define STACK_DYNAMIC_OFFSET(FNDECL) \ + ((ACCUMULATE_OUTGOING_ARGS \ + ? (crtl->outgoing_args_size \ + + (OUTGOING_REG_PARM_STACK_SPACE ((!(FNDECL) ? NULL_TREE : TREE_TYPE (FNDECL))) ? 0 \ +- : REG_PARM_STACK_SPACE (FNDECL))) \ ++ : INCOMING_REG_PARM_STACK_SPACE (FNDECL))) \ + : 0) + (STACK_POINTER_OFFSET)) + #else + #define STACK_DYNAMIC_OFFSET(FNDECL) \ +@@ -2211,8 +2215,9 @@ #endif + all->args_so_far = pack_cumulative_args (&all->args_so_far_v); - #ifndef TARGET_FPMATH_DEFAULT -@@ -591,43 +591,6 @@ - /* Target Pragmas. */ - #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas () - --enum target_cpu_default --{ -- TARGET_CPU_DEFAULT_generic = 0, -- -- TARGET_CPU_DEFAULT_i386, -- TARGET_CPU_DEFAULT_i486, -- TARGET_CPU_DEFAULT_pentium, -- TARGET_CPU_DEFAULT_pentium_mmx, -- TARGET_CPU_DEFAULT_pentiumpro, -- TARGET_CPU_DEFAULT_pentium2, -- TARGET_CPU_DEFAULT_pentium3, -- TARGET_CPU_DEFAULT_pentium4, -- TARGET_CPU_DEFAULT_pentium_m, -- TARGET_CPU_DEFAULT_prescott, -- TARGET_CPU_DEFAULT_nocona, -- TARGET_CPU_DEFAULT_core2, -- TARGET_CPU_DEFAULT_corei7, -- TARGET_CPU_DEFAULT_haswell, -- TARGET_CPU_DEFAULT_atom, -- -- TARGET_CPU_DEFAULT_geode, -- TARGET_CPU_DEFAULT_k6, -- TARGET_CPU_DEFAULT_k6_2, -- TARGET_CPU_DEFAULT_k6_3, -- TARGET_CPU_DEFAULT_athlon, -- TARGET_CPU_DEFAULT_athlon_sse, -- TARGET_CPU_DEFAULT_k8, -- TARGET_CPU_DEFAULT_amdfam10, -- TARGET_CPU_DEFAULT_bdver1, -- TARGET_CPU_DEFAULT_bdver2, -- TARGET_CPU_DEFAULT_bdver3, -- TARGET_CPU_DEFAULT_btver1, -- TARGET_CPU_DEFAULT_btver2, -- -- TARGET_CPU_DEFAULT_max --}; -- - #ifndef CC1_SPEC - #define CC1_SPEC "%(cc1_cpu) " +-#ifdef REG_PARM_STACK_SPACE +- all->reg_parm_stack_space = REG_PARM_STACK_SPACE (current_function_decl); ++#ifdef INCOMING_REG_PARM_STACK_SPACE ++ all->reg_parm_stack_space ++ = INCOMING_REG_PARM_STACK_SPACE (current_function_decl); + #endif + } + +@@ -4518,6 +4523,7 @@ + /* ??? This could be set on a per-function basis by the front-end + but is this worth the hassle? */ + cfun->can_throw_non_call_exceptions = flag_non_call_exceptions; ++ cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions; + } + } + +Index: gcc/common.opt +=================================================================== +--- a/src/gcc/common.opt (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/common.opt (.../branches/gcc-4_8-branch) +@@ -1226,6 +1226,10 @@ + Common Report Var(flag_tm) + Enable support for GNU transactional memory + ++fgnu-unique ++Common Report Var(flag_gnu_unique) Init(1) ++Use STB_GNU_UNIQUE if supported by the assembler ++ + floop-flatten + Common Ignore + Does nothing. Preserved for backward compatibility. +Index: gcc/sched-deps.c +=================================================================== +--- a/src/gcc/sched-deps.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/sched-deps.c (.../branches/gcc-4_8-branch) +@@ -2744,7 +2744,8 @@ + Consider for instance a volatile asm that changes the fpu rounding + mode. An insn should not be moved across this even if it only uses + pseudo-regs because it might give an incorrectly rounded result. */ +- if (code != ASM_OPERANDS || MEM_VOLATILE_P (x)) ++ if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x)) ++ && !DEBUG_INSN_P (insn)) + reg_pending_barrier = TRUE_BARRIER; + + /* For all ASM_OPERANDS, we must traverse the vector of input operands. +Index: gcc/config/alpha/alpha.c +=================================================================== +--- a/src/gcc/config/alpha/alpha.c (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/config/alpha/alpha.c (.../branches/gcc-4_8-branch) +@@ -8658,6 +8658,11 @@ + } + break; + ++ case BARRIER: ++ /* __builtin_unreachable can expand to no code at all, ++ leaving (barrier) RTXes in the instruction stream. */ ++ goto close_shadow_notrapb; ++ + case JUMP_INSN: + case CALL_INSN: + case CODE_LABEL: +@@ -8673,6 +8678,7 @@ + n = emit_insn_before (gen_trapb (), i); + PUT_MODE (n, TImode); + PUT_MODE (i, TImode); ++ close_shadow_notrapb: + trap_pending = 0; + shadow.used.i = 0; + shadow.used.fp = 0; +Index: gcc/config/elfos.h +=================================================================== +--- a/src/gcc/config/elfos.h (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/config/elfos.h (.../branches/gcc-4_8-branch) +@@ -287,7 +287,7 @@ + /* Write the extra assembler code needed to declare an object properly. */ + + #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT +-#define USE_GNU_UNIQUE_OBJECT 1 ++#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique + #else + #define USE_GNU_UNIQUE_OBJECT 0 #endif -@@ -2089,25 +2052,27 @@ - with x86-64 medium memory model */ - #define DEFAULT_LARGE_SECTION_THRESHOLD 65536 - --/* Which processor to tune code generation for. */ -+/* Which processor to tune code generation for. These must be in sync -+ with processor_target_table in i386.c. */ - - enum processor_type - { -- PROCESSOR_I386 = 0, /* 80386 */ -+ PROCESSOR_GENERIC32 = 0, -+ PROCESSOR_GENERIC64, -+ PROCESSOR_I386, /* 80386 */ - PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */ - PROCESSOR_PENTIUM, - PROCESSOR_PENTIUMPRO, -- PROCESSOR_GEODE, -- PROCESSOR_K6, -- PROCESSOR_ATHLON, - PROCESSOR_PENTIUM4, -- PROCESSOR_K8, - PROCESSOR_NOCONA, - PROCESSOR_CORE2, - PROCESSOR_COREI7, - PROCESSOR_HASWELL, -- PROCESSOR_GENERIC32, -- PROCESSOR_GENERIC64, -+ PROCESSOR_ATOM, -+ PROCESSOR_GEODE, -+ PROCESSOR_K6, -+ PROCESSOR_ATHLON, -+ PROCESSOR_K8, - PROCESSOR_AMDFAM10, - PROCESSOR_BDVER1, - PROCESSOR_BDVER2, -@@ -2114,7 +2079,6 @@ - PROCESSOR_BDVER3, - PROCESSOR_BTVER1, - PROCESSOR_BTVER2, -- PROCESSOR_ATOM, - PROCESSOR_max - }; - Index: gcc/config/i386/i386.md =================================================================== ---- a/src/gcc/config/i386/i386.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/i386/i386.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/i386/i386.md (.../branches/gcc-4_8-branch) -@@ -363,6 +363,13 @@ - (const_string "unknown")] - (const_string "integer"))) - -+;; The minimum required alignment of vector mode memory operands of the SSE -+;; (non-VEX/EVEX) instruction in bits, if it is different from -+;; GET_MODE_ALIGNMENT of the operand, otherwise 0. If an instruction has -+;; multiple alternatives, this should be conservative maximum of those minimum -+;; required alignments. -+(define_attr "ssememalign" "" (const_int 0)) -+ - ;; The (bounding maximum) length of an instruction immediate. - (define_attr "length_immediate" "" - (cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave, -@@ -1570,7 +1577,7 @@ - split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]); - - operands[1] = gen_lowpart (DImode, operands[2]); -- operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx, -+ operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, stack_pointer_rtx, - GEN_INT (4))); - }) - -@@ -1587,7 +1594,7 @@ - split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]); - - operands[1] = gen_lowpart (DImode, operands[2]); -- operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (DImode, stack_pointer_rtx, -+ operands[2] = gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, stack_pointer_rtx, - GEN_INT (4))); - }) - -@@ -2715,7 +2722,20 @@ - "reload_completed" - [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) - (set (mem:SF (reg:P SP_REG)) (match_dup 1))] -- "operands[2] = GEN_INT (-GET_MODE_SIZE (<P:MODE>mode));") -+{ -+ rtx op = XEXP (operands[0], 0); -+ if (GET_CODE (op) == PRE_DEC) -+ { -+ gcc_assert (!TARGET_64BIT); -+ op = GEN_INT (-4); -+ } -+ else -+ { -+ op = XEXP (XEXP (op, 1), 1); -+ gcc_assert (CONST_INT_P (op)); -+ } -+ operands[2] = op; -+}) - - (define_split - [(set (match_operand:SF 0 "push_operand") -@@ -5443,6 +5463,12 @@ - mode = SImode; - - ix86_split_lea_for_addr (curr_insn, operands, mode); -+ -+ /* Zero-extend return register to DImode for zero-extended addresses. */ -+ if (mode != <MODE>mode) -+ emit_insn (gen_zero_extendsidi2 -+ (operands[0], gen_lowpart (mode, operands[0]))); -+ - DONE; - } - [(set_attr "type" "lea") -@@ -6589,7 +6615,7 @@ - (set_attr "use_carry" "1") - (set_attr "mode" "<MODE>")]) - --;; Overflow setting add and subtract instructions -+;; Overflow setting add instructions - - (define_insn "*add<mode>3_cconly_overflow" - [(set (reg:CCC FLAGS_REG) -@@ -6604,43 +6630,31 @@ - [(set_attr "type" "alu") +@@ -5339,66 +5339,37 @@ + + ;; Avoid store forwarding (partial memory) stall penalty by extending + ;; SImode value to DImode through XMM register instead of pushing two +-;; SImode values to stack. Note that even !TARGET_INTER_UNIT_MOVES +-;; targets benefit from this optimization. Also note that fild +-;; loads from memory only. ++;; SImode values to stack. Also note that fild loads from memory only. + +-(define_insn "*floatunssi<mode>2_1" +- [(set (match_operand:X87MODEF 0 "register_operand" "=f,f") ++(define_insn_and_split "*floatunssi<mode>2_i387_with_xmm" ++ [(set (match_operand:X87MODEF 0 "register_operand" "=f") + (unsigned_float:X87MODEF +- (match_operand:SI 1 "nonimmediate_operand" "x,m"))) +- (clobber (match_operand:DI 2 "memory_operand" "=m,m")) +- (clobber (match_scratch:SI 3 "=X,x"))] ++ (match_operand:SI 1 "nonimmediate_operand" "rm"))) ++ (clobber (match_scratch:DI 3 "=x")) ++ (clobber (match_operand:DI 2 "memory_operand" "=m"))] + "!TARGET_64BIT + && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) +- && TARGET_SSE" ++ && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES" + "#" ++ "&& reload_completed" ++ [(set (match_dup 3) (zero_extend:DI (match_dup 1))) ++ (set (match_dup 2) (match_dup 3)) ++ (set (match_dup 0) ++ (float:X87MODEF (match_dup 2)))] ++ "" + [(set_attr "type" "multi") (set_attr "mode" "<MODE>")]) --(define_insn "*sub<mode>3_cconly_overflow" -+(define_insn "*add<mode>3_cc_overflow" - [(set (reg:CCC FLAGS_REG) - (compare:CCC -- (minus:SWI -- (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>") -- (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m")) -- (match_dup 0)))] -- "" -- "cmp{<imodesuffix>}\t{%1, %0|%0, %1}" -- [(set_attr "type" "icmp") -- (set_attr "mode" "<MODE>")]) +-(define_split +- [(set (match_operand:X87MODEF 0 "register_operand") +- (unsigned_float:X87MODEF +- (match_operand:SI 1 "register_operand"))) +- (clobber (match_operand:DI 2 "memory_operand")) +- (clobber (match_scratch:SI 3))] +- "!TARGET_64BIT +- && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) +- && TARGET_SSE +- && reload_completed" +- [(set (match_dup 2) (match_dup 1)) +- (set (match_dup 0) +- (float:X87MODEF (match_dup 2)))] +- "operands[1] = simplify_gen_subreg (DImode, operands[1], SImode, 0);") - --(define_insn "*<plusminus_insn><mode>3_cc_overflow" -- [(set (reg:CCC FLAGS_REG) -- (compare:CCC -- (plusminus:SWI -- (match_operand:SWI 1 "nonimmediate_operand" "<comm>0,0") -+ (plus:SWI -+ (match_operand:SWI 1 "nonimmediate_operand" "%0,0") - (match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m")) - (match_dup 1))) - (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>") -- (plusminus:SWI (match_dup 1) (match_dup 2)))] -- "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)" -- "<plusminus_mnemonic>{<imodesuffix>}\t{%2, %0|%0, %2}" -+ (plus:SWI (match_dup 1) (match_dup 2)))] -+ "ix86_binary_operator_ok (PLUS, <MODE>mode, operands)" -+ "add{<imodesuffix>}\t{%2, %0|%0, %2}" - [(set_attr "type" "alu") - (set_attr "mode" "<MODE>")]) - --(define_insn "*<plusminus_insn>si3_zext_cc_overflow" -+(define_insn "*addsi3_zext_cc_overflow" - [(set (reg:CCC FLAGS_REG) - (compare:CCC -- (plusminus:SI -- (match_operand:SI 1 "nonimmediate_operand" "<comm>0") -+ (plus:SI -+ (match_operand:SI 1 "nonimmediate_operand" "%0") - (match_operand:SI 2 "x86_64_general_operand" "rme")) - (match_dup 1))) - (set (match_operand:DI 0 "register_operand" "=r") -- (zero_extend:DI (plusminus:SI (match_dup 1) (match_dup 2))))] -- "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands)" -- "<plusminus_mnemonic>{l}\t{%2, %k0|%k0, %2}" -+ (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] -+ "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)" -+ "add{l}\t{%2, %k0|%k0, %2}" - [(set_attr "type" "alu") - (set_attr "mode" "SI")]) - -@@ -8012,7 +8026,18 @@ - (const_int 0))) - (set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm") - (and:DI (match_dup 1) (match_dup 2)))] -- "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) -+ "TARGET_64BIT -+ && ix86_match_ccmode -+ (insn, -+ /* If we are going to emit andl instead of andq, and the operands[2] -+ constant might have the SImode sign bit set, make sure the sign -+ flag isn't tested, because the instruction will set the sign flag -+ based on bit 31 rather than bit 63. If it isn't CONST_INT, -+ conservatively assume it might have bit 31 set. */ -+ (satisfies_constraint_Z (operands[2]) -+ && (!CONST_INT_P (operands[2]) -+ || val_signbit_known_set_p (SImode, INTVAL (operands[2])))) -+ ? CCZmode : CCNOmode) - && ix86_binary_operator_ok (AND, DImode, operands)" - "@ - and{l}\t{%k2, %k0|%k0, %k2} -@@ -17569,7 +17594,13 @@ - (define_insn "trap" - [(trap_if (const_int 1) (const_int 6))] - "" -- { return ASM_SHORT "0x0b0f"; } -+{ -+#ifdef HAVE_AS_IX86_UD2 -+ return "ud2"; -+#else -+ return ASM_SHORT "0x0b0f"; -+#endif -+} - [(set_attr "length" "2")]) - - (define_expand "prefetch" -Index: gcc/config/i386/f16cintrin.h -=================================================================== ---- a/src/gcc/config/i386/f16cintrin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/f16cintrin.h (.../branches/gcc-4_8-branch) -@@ -35,7 +35,7 @@ - extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__)) - _cvtsh_ss (unsigned short __S) - { -- __v8hi __H = __extension__ (__v8hi){ __S, 0, 0, 0, 0, 0, 0, 0 }; -+ __v8hi __H = __extension__ (__v8hi){ (short) __S, 0, 0, 0, 0, 0, 0, 0 }; - __v4sf __A = __builtin_ia32_vcvtph2ps (__H); - return __builtin_ia32_vec_ext_v4sf (__A, 0); - } -Index: gcc/config/i386/t-rtems -=================================================================== ---- a/src/gcc/config/i386/t-rtems (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/t-rtems (.../branches/gcc-4_8-branch) -@@ -17,11 +17,10 @@ - # <http://www.gnu.org/licenses/>. - # - --MULTILIB_OPTIONS = mtune=i486/mtune=pentium/mtune=pentiumpro \ --msoft-float -+MULTILIB_OPTIONS = mtune=i486/mtune=pentium/mtune=pentiumpro msoft-float - MULTILIB_DIRNAMES= m486 mpentium mpentiumpro soft-float --MULTILIB_MATCHES = msoft-float=mno-m80387 --MULTILIB_MATCHES += mtune?pentium=mtune?k6 mtune?pentiumpro=mtune?mathlon -+MULTILIB_MATCHES = msoft-float=mno-80387 -+MULTILIB_MATCHES += mtune?pentium=mtune?k6 mtune?pentiumpro=mtune?athlon - MULTILIB_EXCEPTIONS = \ - mtune=pentium/*msoft-float* \ - mtune=pentiumpro/*msoft-float* -Index: gcc/config/i386/winnt.c -=================================================================== ---- a/src/gcc/config/i386/winnt.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/winnt.c (.../branches/gcc-4_8-branch) -@@ -547,8 +547,9 @@ - sets 'discard' characteristic, rather than telling linker - to warn of size or content mismatch, so do the same. */ - bool discard = (flags & SECTION_CODE) -- || lookup_attribute ("selectany", -- DECL_ATTRIBUTES (decl)); -+ || (TREE_CODE (decl) != IDENTIFIER_NODE -+ && lookup_attribute ("selectany", -+ DECL_ATTRIBUTES (decl))); - fprintf (asm_out_file, "\t.linkonce %s\n", - (discard ? "discard" : "same_size")); - } -Index: gcc/config/i386/sse.md -=================================================================== ---- a/src/gcc/config/i386/sse.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/sse.md (.../branches/gcc-4_8-branch) -@@ -605,6 +605,7 @@ - } - [(set_attr "type" "ssemov") - (set_attr "movu" "1") -+ (set_attr "ssememalign" "8") - (set_attr "prefix" "maybe_vex") - (set (attr "mode") - (cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") -@@ -634,6 +635,7 @@ - } - [(set_attr "type" "ssemov") - (set_attr "movu" "1") -+ (set_attr "ssememalign" "8") - (set_attr "prefix" "maybe_vex") - (set (attr "mode") - (cond [(ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") -@@ -663,6 +665,7 @@ - } - [(set_attr "type" "ssemov") - (set_attr "movu" "1") -+ (set_attr "ssememalign" "8") - (set (attr "prefix_data16") - (if_then_else - (match_test "TARGET_AVX") -@@ -696,6 +699,7 @@ - } - [(set_attr "type" "ssemov") - (set_attr "movu" "1") -+ (set_attr "ssememalign" "8") - (set (attr "prefix_data16") - (if_then_else - (match_test "TARGET_AVX") -@@ -721,6 +725,7 @@ - "%vlddqu\t{%1, %0|%0, %1}" - [(set_attr "type" "ssemov") - (set_attr "movu" "1") -+ (set_attr "ssememalign" "8") - (set (attr "prefix_data16") - (if_then_else - (match_test "TARGET_AVX") -@@ -1001,6 +1006,7 @@ - vrcpss\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "isa" "noavx,avx") - (set_attr "type" "sse") -+ (set_attr "ssememalign" "32") - (set_attr "atom_sse_attr" "rcp") - (set_attr "btver2_sse_attr" "rcp") - (set_attr "prefix" "orig,vex") -@@ -1089,6 +1095,7 @@ - vrsqrtss\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "isa" "noavx,avx") - (set_attr "type" "sse") -+ (set_attr "ssememalign" "32") - (set_attr "prefix" "orig,vex") - (set_attr "mode" "SF")]) - -@@ -2844,6 +2851,7 @@ - "%vcvtdq2pd\t{%1, %0|%0, %q1}" - [(set_attr "type" "ssecvt") - (set_attr "prefix" "maybe_vex") -+ (set_attr "ssememalign" "64") - (set_attr "mode" "V2DF")]) - - (define_insn "avx_cvtpd2dq256" -@@ -3572,6 +3580,7 @@ - %vmovhps\t{%2, %0|%0, %2}" - [(set_attr "isa" "noavx,avx,noavx,avx,*") - (set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix" "orig,vex,orig,vex,maybe_vex") - (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")]) - -@@ -3617,6 +3626,7 @@ - %vmovlps\t{%2, %H0|%H0, %2}" - [(set_attr "isa" "noavx,avx,noavx,avx,*") - (set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix" "orig,vex,orig,vex,maybe_vex") - (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")]) - -@@ -3941,6 +3951,7 @@ - %vmovhlps\t{%1, %d0|%d0, %1} - %vmovlps\t{%H1, %d0|%d0, %H1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "V2SF,V4SF,V2SF")]) - -@@ -3980,6 +3991,7 @@ - %vmovlps\t{%2, %H0|%H0, %2}" - [(set_attr "isa" "noavx,avx,noavx,avx,*") - (set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix" "orig,vex,orig,vex,maybe_vex") - (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")]) - -@@ -4033,6 +4045,7 @@ - %vmovlps\t{%2, %0|%0, %2}" - [(set_attr "isa" "noavx,avx,noavx,avx,*") - (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "length_immediate" "1,1,*,*,*") - (set_attr "prefix" "orig,vex,orig,vex,maybe_vex") - (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")]) -@@ -4642,7 +4655,8 @@ - vmovlpd\t{%H1, %2, %0|%0, %2, %H1} - %vmovhpd\t{%1, %0|%0, %1}" - [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*") -- (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov") -+ (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_data16" "*,*,*,1,*,1") - (set_attr "prefix" "orig,vex,maybe_vex,orig,vex,maybe_vex") - (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")]) -@@ -4744,6 +4758,7 @@ - %vmovlpd\t{%2, %H0|%H0, %2}" - [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*") - (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_data16" "*,*,*,1,*,1") - (set_attr "prefix" "orig,vex,maybe_vex,orig,vex,maybe_vex") - (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")]) -@@ -4982,6 +4997,7 @@ - movhlps\t{%1, %0|%0, %1} - movlps\t{%H1, %0|%0, %H1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "mode" "V2SF,V4SF,V2SF")]) - - ;; Avoid combining registers from different units in a single alternative, -@@ -5077,6 +5093,7 @@ - #" - [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*") - (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_data16" "1,*,*,*,*,*,*") - (set_attr "prefix" "orig,vex,orig,vex,*,*,*") - (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")]) -@@ -5145,6 +5162,7 @@ - (const_string "imov") - ] - (const_string "ssemov"))) -+ (set_attr "ssememalign" "64") - (set_attr "prefix_data16" "*,1,*,*,*,*,1,*,*,*,*") - (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*,*,*") - (set_attr "prefix" "maybe_vex,orig,vex,orig,vex,orig,orig,vex,*,*,*") -@@ -5189,6 +5207,7 @@ - (const_string "1") - (const_string "*"))) - (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*") -+ (set_attr "ssememalign" "64") - (set_attr "prefix" "orig,vex,orig,vex,maybe_vex,orig,orig,vex,maybe_vex") - (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")]) - -@@ -8736,6 +8755,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>bw\t{%1, %0|%0, %q1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -8766,6 +8786,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>bd\t{%1, %0|%0, %k1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "32") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -8791,6 +8812,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>wd\t{%1, %0|%0, %q1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -8818,6 +8840,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>bq\t{%1, %0|%0, %w1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "16") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -8845,6 +8868,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>wq\t{%1, %0|%0, %k1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "32") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -8868,6 +8892,7 @@ - "TARGET_SSE4_1" - "%vpmov<extsuffix>dq\t{%1, %0|%0, %q1}" - [(set_attr "type" "ssemov") -+ (set_attr "ssememalign" "64") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "mode" "TI")]) -@@ -9151,6 +9176,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "none,load") - (set_attr "mode" "TI")]) -@@ -9213,6 +9239,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "load") - (set_attr "mode" "TI")]) -@@ -9240,6 +9267,7 @@ - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") - (set_attr "prefix" "maybe_vex") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "btver2_decode" "vector") - (set_attr "memory" "none,load") -@@ -9267,6 +9295,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "btver2_decode" "vector") -@@ -9293,6 +9322,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "none,load,none,load") - (set_attr "btver2_decode" "vector,vector,vector,vector") -@@ -9346,6 +9376,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "none,load") - (set_attr "mode" "TI")]) -@@ -9399,6 +9430,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "load") - (set_attr "mode" "TI")]) -@@ -9421,6 +9453,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "memory" "none,load") -@@ -9445,6 +9478,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "prefix" "maybe_vex") - (set_attr "memory" "none,load") -@@ -9469,6 +9503,7 @@ - [(set_attr "type" "sselog") - (set_attr "prefix_data16" "1") - (set_attr "prefix_extra" "1") -+ (set_attr "ssememalign" "8") - (set_attr "length_immediate" "1") - (set_attr "memory" "none,load,none,load") - (set_attr "prefix" "maybe_vex") -@@ -10213,7 +10248,6 @@ - [(set_attr "type" "ssecvt1") - (set_attr "mode" "<MODE>")]) - --;; scalar insns - (define_expand "xop_vmfrcz<mode>2" - [(set (match_operand:VF_128 0 "register_operand") - (vec_merge:VF_128 -@@ -10220,14 +10254,12 @@ - (unspec:VF_128 - [(match_operand:VF_128 1 "nonimmediate_operand")] - UNSPEC_FRCZ) -- (match_dup 3) -+ (match_dup 2) - (const_int 1)))] - "TARGET_XOP" +-(define_split +- [(set (match_operand:X87MODEF 0 "register_operand") +- (unsigned_float:X87MODEF +- (match_operand:SI 1 "memory_operand"))) +- (clobber (match_operand:DI 2 "memory_operand")) +- (clobber (match_scratch:SI 3))] +- "!TARGET_64BIT +- && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) +- && TARGET_SSE +- && reload_completed" +- [(set (match_dup 2) (match_dup 3)) +- (set (match_dup 0) +- (float:X87MODEF (match_dup 2)))] -{ -- operands[3] = CONST0_RTX (<MODE>mode); +- emit_move_insn (operands[3], operands[1]); +- operands[3] = simplify_gen_subreg (DImode, operands[3], SImode, 0); -}) -+ "operands[2] = CONST0_RTX (<MODE>mode);") - --(define_insn "*xop_vmfrcz_<mode>" -+(define_insn "*xop_vmfrcz<mode>2" - [(set (match_operand:VF_128 0 "register_operand" "=x") - (vec_merge:VF_128 - (unspec:VF_128 -Index: gcc/config/i386/xopintrin.h -=================================================================== ---- a/src/gcc/config/i386/xopintrin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/i386/xopintrin.h (.../branches/gcc-4_8-branch) -@@ -745,13 +745,17 @@ - extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) - _mm_frcz_ss (__m128 __A, __m128 __B) - { -- return (__m128) __builtin_ia32_vfrczss ((__v4sf)__A, (__v4sf)__B); -+ return (__m128) __builtin_ia32_movss ((__v4sf)__A, -+ (__v4sf) -+ __builtin_ia32_vfrczss ((__v4sf)__B)); - } - - extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) - _mm_frcz_sd (__m128d __A, __m128d __B) - { -- return (__m128d) __builtin_ia32_vfrczsd ((__v2df)__A, (__v2df)__B); -+ return (__m128d) __builtin_ia32_movsd ((__v2df)__A, -+ (__v2df) -+ __builtin_ia32_vfrczsd ((__v2df)__B)); - } - - extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +- + (define_expand "floatunssi<mode>2" + [(parallel + [(set (match_operand:X87MODEF 0 "register_operand") + (unsigned_float:X87MODEF + (match_operand:SI 1 "nonimmediate_operand"))) +- (clobber (match_dup 2)) +- (clobber (match_scratch:SI 3))])] ++ (clobber (match_scratch:DI 3)) ++ (clobber (match_dup 2))])] + "!TARGET_64BIT + && ((TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) +- && TARGET_SSE) ++ && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES) + || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))" + { + if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) Index: gcc/config/i386/driver-i386.c =================================================================== ---- a/src/gcc/config/i386/driver-i386.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/i386/driver-i386.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/i386/driver-i386.c (.../branches/gcc-4_8-branch) -@@ -126,6 +126,18 @@ - case 0x0c: - level1->sizekb = 16; level1->assoc = 4; level1->line = 32; - break; -+ case 0x0d: -+ level1->sizekb = 16; level1->assoc = 4; level1->line = 64; -+ break; -+ case 0x0e: -+ level1->sizekb = 24; level1->assoc = 6; level1->line = 64; -+ break; -+ case 0x21: -+ level2->sizekb = 256; level2->assoc = 8; level2->line = 64; -+ break; -+ case 0x24: -+ level2->sizekb = 1024; level2->assoc = 16; level2->line = 64; -+ break; - case 0x2c: - level1->sizekb = 32; level1->assoc = 8; level1->line = 64; - break; -@@ -162,6 +174,9 @@ - case 0x45: - level2->sizekb = 2048; level2->assoc = 4; level2->line = 32; - break; -+ case 0x48: -+ level2->sizekb = 3072; level2->assoc = 12; level2->line = 64; -+ break; - case 0x49: - if (xeon_mp) - break; -@@ -203,6 +218,9 @@ - case 0x7f: - level2->sizekb = 512; level2->assoc = 2; level2->line = 64; - break; -+ case 0x80: -+ level2->sizekb = 512; level2->assoc = 8; level2->line = 64; -+ break; - case 0x82: - level2->sizekb = 256; level2->assoc = 8; level2->line = 32; - break; -@@ -470,6 +488,28 @@ - has_xsaveopt = eax & bit_XSAVEOPT; - } - -+ /* Check cpuid level of extended features. */ -+ __cpuid (0x80000000, ext_level, ebx, ecx, edx); -+ -+ if (ext_level > 0x80000000) -+ { -+ __cpuid (0x80000001, eax, ebx, ecx, edx); -+ -+ has_lahf_lm = ecx & bit_LAHF_LM; -+ has_sse4a = ecx & bit_SSE4a; -+ has_abm = ecx & bit_ABM; -+ has_lwp = ecx & bit_LWP; -+ has_fma4 = ecx & bit_FMA4; -+ has_xop = ecx & bit_XOP; -+ has_tbm = ecx & bit_TBM; -+ has_lzcnt = ecx & bit_LZCNT; -+ has_prfchw = ecx & bit_PRFCHW; -+ -+ has_longmode = edx & bit_LM; -+ has_3dnowp = edx & bit_3DNOWP; -+ has_3dnow = edx & bit_3DNOW; -+ } -+ - /* Get XCR_XFEATURE_ENABLED_MASK register with xgetbv. */ - #define XCR_XFEATURE_ENABLED_MASK 0x0 - #define XSTATE_FP 0x1 -@@ -488,33 +528,12 @@ - has_avx2 = 0; - has_fma = 0; - has_fma4 = 0; -+ has_f16c = 0; - has_xop = 0; - has_xsave = 0; - has_xsaveopt = 0; - } - -- /* Check cpuid level of extended features. */ -- __cpuid (0x80000000, ext_level, ebx, ecx, edx); -- -- if (ext_level > 0x80000000) -- { -- __cpuid (0x80000001, eax, ebx, ecx, edx); -- -- has_lahf_lm = ecx & bit_LAHF_LM; -- has_sse4a = ecx & bit_SSE4a; -- has_abm = ecx & bit_ABM; -- has_lwp = ecx & bit_LWP; -- has_fma4 = ecx & bit_FMA4; -- has_xop = ecx & bit_XOP; -- has_tbm = ecx & bit_TBM; -- has_lzcnt = ecx & bit_LZCNT; -- has_prfchw = ecx & bit_PRFCHW; -- -- has_longmode = edx & bit_LM; -- has_3dnowp = edx & bit_3DNOWP; -- has_3dnow = edx & bit_3DNOW; -- } -- - if (!arch) - { - if (vendor == signature_AMD_ebx +@@ -713,6 +713,11 @@ + /* Assume Core 2. */ + cpu = "core2"; + } ++ else if (has_longmode) ++ /* Perhaps some emulator? Assume x86-64, otherwise gcc ++ -march=native would be unusable for 64-bit compilations, ++ as all the CPUs below are 32-bit only. */ ++ cpu = "x86-64"; + else if (has_sse3) + /* It is Core Duo. */ + cpu = "pentium-m"; Index: gcc/config/i386/i386.c =================================================================== ---- a/src/gcc/config/i386/i386.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/i386/i386.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/i386/i386.c (.../branches/gcc-4_8-branch) -@@ -1378,7 +1378,7 @@ - 8, /* MMX or SSE register to integer */ - 8, /* size of l1 cache. */ - 1024, /* size of l2 cache. */ -- 128, /* size of prefetch block */ -+ 64, /* size of prefetch block */ - 8, /* number of parallel prefetches */ - 1, /* Branch cost */ - COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */ -@@ -1894,10 +1894,10 @@ - m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_AMDFAM10 | m_BDVER | m_GENERIC, - - /* X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL */ -- m_COREI7 | m_AMDFAM10 | m_BDVER | m_BTVER, -+ m_COREI7 | m_HASWELL | m_AMDFAM10 | m_BDVER | m_BTVER, - - /* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL */ -- m_COREI7 | m_BDVER, -+ m_COREI7 | m_HASWELL| m_BDVER, - - /* X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL */ - m_BDVER , -@@ -2409,6 +2409,7 @@ - /* Processor target table, indexed by processor number */ - struct ptt - { -+ const char *const name; /* processor name */ - const struct processor_costs *cost; /* Processor costs */ - const int align_loop; /* Default alignments. */ - const int align_loop_max_skip; -@@ -2417,67 +2418,32 @@ - const int align_func; - }; - -+/* This table must be in sync with enum processor_type in i386.h. */ - static const struct ptt processor_target_table[PROCESSOR_max] = - { -- {&i386_cost, 4, 3, 4, 3, 4}, -- {&i486_cost, 16, 15, 16, 15, 16}, -- {&pentium_cost, 16, 7, 16, 7, 16}, -- {&pentiumpro_cost, 16, 15, 16, 10, 16}, -- {&geode_cost, 0, 0, 0, 0, 0}, -- {&k6_cost, 32, 7, 32, 7, 32}, -- {&athlon_cost, 16, 7, 16, 7, 16}, -- {&pentium4_cost, 0, 0, 0, 0, 0}, -- {&k8_cost, 16, 7, 16, 7, 16}, -- {&nocona_cost, 0, 0, 0, 0, 0}, -- /* Core 2 */ -- {&core_cost, 16, 10, 16, 10, 16}, -- /* Core i7 */ -- {&core_cost, 16, 10, 16, 10, 16}, -- /* Core avx2 */ -- {&core_cost, 16, 10, 16, 10, 16}, -- {&generic32_cost, 16, 7, 16, 7, 16}, -- {&generic64_cost, 16, 10, 16, 10, 16}, -- {&amdfam10_cost, 32, 24, 32, 7, 32}, -- {&bdver1_cost, 16, 10, 16, 7, 11}, -- {&bdver2_cost, 16, 10, 16, 7, 11}, -- {&bdver3_cost, 16, 10, 16, 7, 11}, -- {&btver1_cost, 16, 10, 16, 7, 11}, -- {&btver2_cost, 16, 10, 16, 7, 11}, -- {&atom_cost, 16, 15, 16, 7, 16} -+ {"generic", &generic32_cost, 16, 7, 16, 7, 16}, -+ {"generic", &generic64_cost, 16, 10, 16, 10, 16}, -+ {"i386", &i386_cost, 4, 3, 4, 3, 4}, -+ {"i486", &i486_cost, 16, 15, 16, 15, 16}, -+ {"pentium", &pentium_cost, 16, 7, 16, 7, 16}, -+ {"pentiumpro", &pentiumpro_cost, 16, 15, 16, 10, 16}, -+ {"pentium4", &pentium4_cost, 0, 0, 0, 0, 0}, -+ {"nocona", &nocona_cost, 0, 0, 0, 0, 0}, -+ {"core2", &core_cost, 16, 10, 16, 10, 16}, -+ {"corei7", &core_cost, 16, 10, 16, 10, 16}, -+ {"core-avx2", &core_cost, 16, 10, 16, 10, 16}, -+ {"atom", &atom_cost, 16, 15, 16, 7, 16}, -+ {"geode", &geode_cost, 0, 0, 0, 0, 0}, -+ {"k6", &k6_cost, 32, 7, 32, 7, 32}, -+ {"athlon", &athlon_cost, 16, 7, 16, 7, 16}, -+ {"k8", &k8_cost, 16, 7, 16, 7, 16}, -+ {"amdfam10", &amdfam10_cost, 32, 24, 32, 7, 32}, -+ {"bdver1", &bdver1_cost, 16, 10, 16, 7, 11}, -+ {"bdver2", &bdver2_cost, 16, 10, 16, 7, 11}, -+ {"bdver3", &bdver3_cost, 16, 10, 16, 7, 11}, -+ {"btver1", &btver1_cost, 16, 10, 16, 7, 11}, -+ {"btver2", &btver2_cost, 16, 10, 16, 7, 11} - }; -- --static const char *const cpu_names[TARGET_CPU_DEFAULT_max] = --{ -- "generic", -- "i386", -- "i486", -- "pentium", -- "pentium-mmx", -- "pentiumpro", -- "pentium2", -- "pentium3", -- "pentium4", -- "pentium-m", -- "prescott", -- "nocona", -- "core2", -- "corei7", -- "core-avx2", -- "atom", -- "geode", -- "k6", -- "k6-2", -- "k6-3", -- "athlon", -- "athlon-4", -- "k8", -- "amdfam10", -- "bdver1", -- "bdver2", -- "bdver3", -- "btver1", -- "btver2" --}; - - static bool - gate_insert_vzeroupper (void) -@@ -2983,7 +2949,7 @@ - {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3, - PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 - | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 -- | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX -+ | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4 - | PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C - | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE - | PTA_XSAVEOPT}, -@@ -3125,7 +3091,8 @@ - ix86_tune_string = ix86_arch_string; - if (!ix86_tune_string) - { -- ix86_tune_string = cpu_names[TARGET_CPU_DEFAULT]; -+ ix86_tune_string -+ = processor_target_table[TARGET_CPU_DEFAULT].name; - ix86_tune_defaulted = 1; - } - -@@ -4078,19 +4045,15 @@ - = ix86_target_string (ptr->x_ix86_isa_flags, ptr->x_target_flags, - NULL, NULL, ptr->x_ix86_fpmath, false); - -+ gcc_assert (ptr->arch < PROCESSOR_max); - fprintf (file, "%*sarch = %d (%s)\n", - indent, "", -- ptr->arch, -- ((ptr->arch < TARGET_CPU_DEFAULT_max) -- ? cpu_names[ptr->arch] -- : "<unknown>")); -+ ptr->arch, processor_target_table[ptr->arch].name); - -+ gcc_assert (ptr->tune < PROCESSOR_max); - fprintf (file, "%*stune = %d (%s)\n", - indent, "", -- ptr->tune, -- ((ptr->tune < TARGET_CPU_DEFAULT_max) -- ? cpu_names[ptr->tune] -- : "<unknown>")); -+ ptr->tune, processor_target_table[ptr->tune].name); - - fprintf (file, "%*sbranch_cost = %d\n", indent, "", ptr->branch_cost); - -@@ -5213,7 +5176,12 @@ - /* Use register calling convention for local functions when possible. */ - if (decl - && TREE_CODE (decl) == FUNCTION_DECL -- && optimize -+ /* Caller and callee must agree on the calling convention, so -+ checking here just optimize means that with -+ __attribute__((optimize (...))) caller could use regparm convention -+ and callee not, or vice versa. Instead look at whether the callee -+ is optimized or not. */ -+ && opt_for_fn (decl, optimize) - && !(profile_flag && !flag_fentry)) - { - /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */ -@@ -5409,6 +5377,17 @@ - bool win; - int j; - -+ /* For pre-AVX disallow unaligned loads/stores where the -+ instructions don't support it. */ -+ if (!TARGET_AVX -+ && VECTOR_MODE_P (GET_MODE (op)) -+ && misaligned_operand (op, GET_MODE (op))) -+ { -+ int min_align = get_attr_ssememalign (insn); -+ if (min_align == 0) -+ return false; -+ } -+ - /* A unary operator may be accepted by the predicate, but it - is irrelevant for matching constraints. */ - if (UNARY_P (op)) -@@ -5747,9 +5726,9 @@ - cum->nregs = 0; - cum->sse_nregs = 0; - cum->mmx_nregs = 0; -- cum->warn_avx = 0; -- cum->warn_sse = 0; -- cum->warn_mmx = 0; -+ cum->warn_avx = false; -+ cum->warn_sse = false; -+ cum->warn_mmx = false; - return; - } - -@@ -5790,10 +5769,14 @@ - - The midde-end can't deal with the vector types > 16 bytes. In this - case, we return the original mode and warn ABI change if CUM isn't -- NULL. */ -+ NULL. - -+ If INT_RETURN is true, warn ABI change if the vector mode isn't -+ available for function return value. */ -+ - static enum machine_mode --type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum) -+type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum, -+ bool in_return) - { - enum machine_mode mode = TYPE_MODE (type); - -@@ -5819,33 +5802,61 @@ - if (size == 32 && !TARGET_AVX) +@@ -20505,7 +20505,7 @@ + t1 = gen_reg_rtx (V32QImode); + t2 = gen_reg_rtx (V32QImode); + t3 = gen_reg_rtx (V32QImode); +- vt2 = GEN_INT (128); ++ vt2 = GEN_INT (-128); + for (i = 0; i < 32; i++) + vec[i] = vt2; + vt = gen_rtx_CONST_VECTOR (V32QImode, gen_rtvec_v (32, vec)); +@@ -24640,13 +24640,17 @@ + { + edge e; + edge_iterator ei; +- /* Assume that region is SCC, i.e. all immediate predecessors +- of non-head block are in the same region. */ ++ ++ /* Regions are SCCs with the exception of selective ++ scheduling with pipelining of outer blocks enabled. ++ So also check that immediate predecessors of a non-head ++ block are in the same region. */ + FOR_EACH_EDGE (e, ei, bb->preds) { - static bool warnedavx; -+ static bool warnedavx_ret; - -- if (cum -- && !warnedavx -- && cum->warn_avx) -+ if (cum && cum->warn_avx && !warnedavx) - { -- warnedavx = true; -- warning (0, "AVX vector argument without AVX " -- "enabled changes the ABI"); -+ if (warning (OPT_Wpsabi, "AVX vector argument " -+ "without AVX enabled changes the ABI")) -+ warnedavx = true; - } -+ else if (in_return && !warnedavx_ret) -+ { -+ if (warning (OPT_Wpsabi, "AVX vector return " -+ "without AVX enabled changes the ABI")) -+ warnedavx_ret = true; -+ } -+ - return TYPE_MODE (type); + /* Avoid creating of loop-carried dependencies through +- using topological odering in region. */ +- if (BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) ++ using topological ordering in the region. */ ++ if (rgn == CONTAINING_RGN (e->src->index) ++ && BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) + add_dependee_for_func_arg (first_arg, e->src); } -- else if ((size == 8 || size == 16) && !TARGET_SSE) -+ else if (((size == 8 && TARGET_64BIT) || size == 16) -+ && !TARGET_SSE) - { - static bool warnedsse; -+ static bool warnedsse_ret; - -- if (cum -- && !warnedsse -- && cum->warn_sse) -+ if (cum && cum->warn_sse && !warnedsse) - { -- warnedsse = true; -- warning (0, "SSE vector argument without SSE " -- "enabled changes the ABI"); -+ if (warning (OPT_Wpsabi, "SSE vector argument " -+ "without SSE enabled changes the ABI")) -+ warnedsse = true; - } -- return mode; -+ else if (!TARGET_64BIT && in_return && !warnedsse_ret) -+ { -+ if (warning (OPT_Wpsabi, "SSE vector return " -+ "without SSE enabled changes the ABI")) -+ warnedsse_ret = true; -+ } - } -- else -- return mode; -+ else if ((size == 8 && !TARGET_64BIT) && !TARGET_MMX) -+ { -+ static bool warnedmmx; -+ static bool warnedmmx_ret; -+ -+ if (cum && cum->warn_mmx && !warnedmmx) -+ { -+ if (warning (OPT_Wpsabi, "MMX vector argument " -+ "without MMX enabled changes the ABI")) -+ warnedmmx = true; -+ } -+ else if (in_return && !warnedmmx_ret) -+ { -+ if (warning (OPT_Wpsabi, "MMX vector return " -+ "without MMX enabled changes the ABI")) -+ warnedmmx_ret = true; -+ } -+ } -+ return mode; } - - gcc_unreachable (); -@@ -6190,25 +6201,28 @@ - case CHImode: - case CQImode: - { -- int size = (bit_offset % 64)+ (int) GET_MODE_BITSIZE (mode); -+ int size = bit_offset + (int) GET_MODE_BITSIZE (mode); - -- if (size <= 32) -+ /* Analyze last 128 bits only. */ -+ size = (size - 1) & 0x7f; -+ -+ if (size < 32) - { - classes[0] = X86_64_INTEGERSI_CLASS; - return 1; - } -- else if (size <= 64) -+ else if (size < 64) - { - classes[0] = X86_64_INTEGER_CLASS; - return 1; - } -- else if (size <= 64+32) -+ else if (size < 64+32) - { - classes[0] = X86_64_INTEGER_CLASS; - classes[1] = X86_64_INTEGERSI_CLASS; - return 2; - } -- else if (size <= 64+64) -+ else if (size < 64+64) - { - classes[0] = classes[1] = X86_64_INTEGER_CLASS; - return 2; -@@ -6475,7 +6489,7 @@ - if (n == 2 - && regclass[0] == X86_64_INTEGER_CLASS - && regclass[1] == X86_64_INTEGER_CLASS -- && (mode == CDImode || mode == TImode || mode == TFmode) -+ && (mode == CDImode || mode == TImode) - && intreg[0] + 1 == intreg[1]) - return gen_rtx_REG (mode, intreg[0]); - -@@ -6725,7 +6739,7 @@ - words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - - if (type) -- mode = type_natural_mode (type, NULL); -+ mode = type_natural_mode (type, NULL, false); - - if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI) - function_arg_advance_ms_64 (cum, bytes, words); -@@ -6753,8 +6767,6 @@ - enum machine_mode orig_mode, const_tree type, - HOST_WIDE_INT bytes, HOST_WIDE_INT words) - { -- static bool warnedsse, warnedmmx; -- - /* Avoid the AL settings for the Unix64 ABI. */ - if (mode == VOIDmode) - return constm1_rtx; -@@ -6811,12 +6823,6 @@ - case V2DFmode: - if (!type || !AGGREGATE_TYPE_P (type)) - { -- if (!TARGET_SSE && !warnedsse && cum->warn_sse) -- { -- warnedsse = true; -- warning (0, "SSE vector argument without SSE enabled " -- "changes the ABI"); -- } - if (cum->sse_nregs) - return gen_reg_or_parallel (mode, orig_mode, - cum->sse_regno + FIRST_SSE_REG); -@@ -6849,12 +6855,6 @@ - case V1DImode: - if (!type || !AGGREGATE_TYPE_P (type)) - { -- if (!TARGET_MMX && !warnedmmx && cum->warn_mmx) -- { -- warnedmmx = true; -- warning (0, "MMX vector argument without MMX enabled " -- "changes the ABI"); -- } - if (cum->mmx_nregs) - return gen_reg_or_parallel (mode, orig_mode, - cum->mmx_regno + FIRST_MMX_REG); -@@ -6977,7 +6977,7 @@ - /* To simplify the code below, represent vector types with a vector mode - even if MMX/SSE are not active. */ - if (type && TREE_CODE (type) == VECTOR_TYPE) -- mode = type_natural_mode (type, cum); -+ mode = type_natural_mode (type, cum, false); - - if (TARGET_64BIT && (cum ? cum->call_abi : ix86_abi) == MS_ABI) - arg = function_arg_ms_64 (cum, mode, omode, named, bytes); -@@ -7235,9 +7235,15 @@ - switch (regno) - { - case AX_REG: -+ case DX_REG: - return true; -+ case DI_REG: -+ case SI_REG: -+ return TARGET_64BIT && ix86_abi != MS_ABI; - -- case FIRST_FLOAT_REG: -+ /* Complex values are returned in %st(0)/%st(1) pair. */ -+ case ST0_REG: -+ case ST1_REG: - /* TODO: The function should depend on current function ABI but - builtins.c would need updating then. Therefore we use the - default ABI. */ -@@ -7245,10 +7251,12 @@ - return false; - return TARGET_FLOAT_RETURNS_IN_80387; - -- case FIRST_SSE_REG: -+ /* Complex values are returned in %xmm0/%xmm1 pair. */ -+ case XMM0_REG: -+ case XMM1_REG: - return TARGET_SSE; - -- case FIRST_MMX_REG: -+ case MM0_REG: - if (TARGET_MACHO || TARGET_64BIT) - return false; - return TARGET_MMX; -@@ -7420,7 +7428,7 @@ - enum machine_mode mode, orig_mode; - - orig_mode = TYPE_MODE (valtype); -- mode = type_natural_mode (valtype, NULL); -+ mode = type_natural_mode (valtype, NULL, true); - return ix86_function_value_1 (valtype, fntype_or_decl, orig_mode, mode); - } - -@@ -7535,7 +7543,7 @@ - #ifdef SUBTARGET_RETURN_IN_MEMORY - return SUBTARGET_RETURN_IN_MEMORY (type, fntype); - #else -- const enum machine_mode mode = type_natural_mode (type, NULL); -+ const enum machine_mode mode = type_natural_mode (type, NULL, true); - - if (TARGET_64BIT) - { -@@ -7549,52 +7557,6 @@ - #endif - } - --/* When returning SSE vector types, we have a choice of either -- (1) being abi incompatible with a -march switch, or -- (2) generating an error. -- Given no good solution, I think the safest thing is one warning. -- The user won't be able to use -Werror, but.... -- -- Choose the STRUCT_VALUE_RTX hook because that's (at present) only -- called in response to actually generating a caller or callee that -- uses such a type. As opposed to TARGET_RETURN_IN_MEMORY, which is called -- via aggregate_value_p for general type probing from tree-ssa. */ -- --static rtx --ix86_struct_value_rtx (tree type, int incoming ATTRIBUTE_UNUSED) --{ -- static bool warnedsse, warnedmmx; -- -- if (!TARGET_64BIT && type) -- { -- /* Look at the return type of the function, not the function type. */ -- enum machine_mode mode = TYPE_MODE (TREE_TYPE (type)); -- -- if (!TARGET_SSE && !warnedsse) -- { -- if (mode == TImode -- || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16)) -- { -- warnedsse = true; -- warning (0, "SSE vector return without SSE enabled " -- "changes the ABI"); -- } -- } -- -- if (!TARGET_MMX && !warnedmmx) -- { -- if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 8) -- { -- warnedmmx = true; -- warning (0, "MMX vector return without MMX enabled " -- "changes the ABI"); -- } -- } -- } -- -- return NULL; --} -- - - /* Create the va_list data type. */ - -@@ -8019,7 +7981,7 @@ - size = int_size_in_bytes (type); - rsize = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - -- nat_mode = type_natural_mode (type, NULL); -+ nat_mode = type_natural_mode (type, NULL, false); - switch (nat_mode) - { - case V8SFmode: -@@ -10560,18 +10522,20 @@ - } - m->fs.sp_offset += allocate; - -+ /* Use stack_pointer_rtx for relative addressing so that code -+ works for realigned stack, too. */ - if (r10_live && eax_live) - { -- t = choose_baseaddr (m->fs.sp_offset - allocate); -+ t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, eax); - emit_move_insn (gen_rtx_REG (word_mode, R10_REG), - gen_frame_mem (word_mode, t)); -- t = choose_baseaddr (m->fs.sp_offset - allocate - UNITS_PER_WORD); -+ t = plus_constant (Pmode, t, UNITS_PER_WORD); - emit_move_insn (gen_rtx_REG (word_mode, AX_REG), - gen_frame_mem (word_mode, t)); - } - else if (eax_live || r10_live) - { -- t = choose_baseaddr (m->fs.sp_offset - allocate); -+ t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, eax); - emit_move_insn (gen_rtx_REG (word_mode, - (eax_live ? AX_REG : R10_REG)), - gen_frame_mem (word_mode, t)); -@@ -11561,30 +11525,6 @@ - } - } - --/* Determine if op is suitable SUBREG RTX for address. */ -- --static bool --ix86_address_subreg_operand (rtx op) --{ -- enum machine_mode mode; -- -- if (!REG_P (op)) -- return false; -- -- mode = GET_MODE (op); -- -- if (GET_MODE_CLASS (mode) != MODE_INT) -- return false; -- -- /* Don't allow SUBREGs that span more than a word. It can lead to spill -- failures when the register is one word out of a two word structure. */ -- if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) -- return false; -- -- /* Allow only SUBREGs of non-eliminable hard registers. */ -- return register_no_elim_operand (op, mode); --} -- - /* Extract the parts of an RTL expression that is a valid memory address - for an instruction. Return 0 if the structure of the address is - grossly off. Return -1 if the address contains ASHIFT, so it is not -@@ -11641,7 +11581,7 @@ - base = addr; - else if (GET_CODE (addr) == SUBREG) - { -- if (ix86_address_subreg_operand (SUBREG_REG (addr))) -+ if (REG_P (SUBREG_REG (addr))) - base = addr; - else - return 0; -@@ -11705,7 +11645,7 @@ - break; - - case SUBREG: -- if (!ix86_address_subreg_operand (SUBREG_REG (op))) -+ if (!REG_P (SUBREG_REG (op))) - return 0; - /* FALLTHRU */ - -@@ -11750,19 +11690,6 @@ - scale = 1 << scale; - retval = -1; - } -- else if (CONST_INT_P (addr)) -- { -- if (!x86_64_immediate_operand (addr, VOIDmode)) -- return 0; -- -- /* Constant addresses are sign extended to 64bit, we have to -- prevent addresses from 0x80000000 to 0xffffffff in x32 mode. */ -- if (TARGET_X32 -- && val_signbit_known_set_p (SImode, INTVAL (addr))) -- return 0; -- -- disp = addr; -- } - else - disp = addr; /* displacement */ - -@@ -11771,18 +11698,12 @@ - if (REG_P (index)) - ; - else if (GET_CODE (index) == SUBREG -- && ix86_address_subreg_operand (SUBREG_REG (index))) -+ && REG_P (SUBREG_REG (index))) - ; - else - return 0; - } - --/* Address override works only on the (%reg) part of %fs:(%reg). */ -- if (seg != SEG_DEFAULT -- && ((base && GET_MODE (base) != word_mode) -- || (index && GET_MODE (index) != word_mode))) -- return 0; -- - /* Extract the integral value of scale. */ - if (scale_rtx) - { -@@ -12258,6 +12179,45 @@ - return false; - } - -+/* Determine if op is suitable RTX for an address register. -+ Return naked register if a register or a register subreg is -+ found, otherwise return NULL_RTX. */ -+ -+static rtx -+ix86_validate_address_register (rtx op) -+{ -+ enum machine_mode mode = GET_MODE (op); -+ -+ /* Only SImode or DImode registers can form the address. */ -+ if (mode != SImode && mode != DImode) -+ return NULL_RTX; -+ -+ if (REG_P (op)) -+ return op; -+ else if (GET_CODE (op) == SUBREG) -+ { -+ rtx reg = SUBREG_REG (op); -+ -+ if (!REG_P (reg)) -+ return NULL_RTX; -+ -+ mode = GET_MODE (reg); -+ -+ /* Don't allow SUBREGs that span more than a word. It can -+ lead to spill failures when the register is one word out -+ of a two word structure. */ -+ if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) -+ return NULL_RTX; -+ -+ /* Allow only SUBREGs of non-eliminable hard registers. */ -+ if (register_no_elim_operand (reg, mode)) -+ return reg; -+ } -+ -+ /* Op is not a register. */ -+ return NULL_RTX; -+} -+ - /* Recognizes RTL expressions that are valid memory addresses for an - instruction. The MODE argument is the machine mode for the MEM - expression that wants to use this address. -@@ -12273,6 +12233,7 @@ - struct ix86_address parts; - rtx base, index, disp; - HOST_WIDE_INT scale; -+ enum ix86_address_seg seg; - - if (ix86_decompose_address (addr, &parts) <= 0) - /* Decomposition failed. */ -@@ -12282,23 +12243,16 @@ - index = parts.index; - disp = parts.disp; - scale = parts.scale; -+ seg = parts.seg; - - /* Validate base register. */ - if (base) - { -- rtx reg; -+ rtx reg = ix86_validate_address_register (base); - -- if (REG_P (base)) -- reg = base; -- else if (GET_CODE (base) == SUBREG && REG_P (SUBREG_REG (base))) -- reg = SUBREG_REG (base); -- else -- /* Base is not a register. */ -+ if (reg == NULL_RTX) - return false; - -- if (GET_MODE (base) != SImode && GET_MODE (base) != DImode) -- return false; -- - if ((strict && ! REG_OK_FOR_BASE_STRICT_P (reg)) - || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (reg))) - /* Base is not valid. */ -@@ -12308,19 +12262,11 @@ - /* Validate index register. */ - if (index) - { -- rtx reg; -+ rtx reg = ix86_validate_address_register (index); - -- if (REG_P (index)) -- reg = index; -- else if (GET_CODE (index) == SUBREG && REG_P (SUBREG_REG (index))) -- reg = SUBREG_REG (index); -- else -- /* Index is not a register. */ -+ if (reg == NULL_RTX) - return false; - -- if (GET_MODE (index) != SImode && GET_MODE (index) != DImode) -- return false; -- - if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (reg)) - || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (reg))) - /* Index is not valid. */ -@@ -12332,6 +12278,12 @@ - && GET_MODE (base) != GET_MODE (index)) - return false; - -+ /* Address override works only on the (%reg) part of %fs:(%reg). */ -+ if (seg != SEG_DEFAULT -+ && ((base && GET_MODE (base) != word_mode) -+ || (index && GET_MODE (index) != word_mode))) -+ return false; -+ - /* Validate scale factor. */ - if (scale != 1) - { -@@ -12453,6 +12405,12 @@ - && !x86_64_immediate_operand (disp, VOIDmode)) - /* Displacement is out of range. */ - return false; -+ /* In x32 mode, constant addresses are sign extended to 64bit, so -+ we have to prevent addresses from 0x80000000 to 0xffffffff. */ -+ else if (TARGET_X32 && !(index || base) -+ && CONST_INT_P (disp) -+ && val_signbit_known_set_p (SImode, INTVAL (disp))) -+ return false; - } - - /* Everything looks valid. */ -@@ -13817,8 +13775,6 @@ - Those same assemblers have the same but opposite lossage on cmov. */ - if (mode == CCmode) - suffix = fp ? "nbe" : "a"; -- else if (mode == CCCmode) -- suffix = "b"; - else - gcc_unreachable (); - break; -@@ -13840,8 +13796,12 @@ - } - break; - case LTU: -- gcc_assert (mode == CCmode || mode == CCCmode); -- suffix = "b"; -+ if (mode == CCmode) -+ suffix = "b"; -+ else if (mode == CCCmode) -+ suffix = "c"; -+ else -+ gcc_unreachable (); - break; - case GE: - switch (mode) -@@ -13861,9 +13821,12 @@ - } - break; - case GEU: -- /* ??? As above. */ -- gcc_assert (mode == CCmode || mode == CCCmode); -- suffix = fp ? "nb" : "ae"; -+ if (mode == CCmode) -+ suffix = fp ? "nb" : "ae"; -+ else if (mode == CCCmode) -+ suffix = "nc"; -+ else -+ gcc_unreachable (); - break; - case LE: - gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode); -@@ -13870,11 +13833,8 @@ - suffix = "le"; - break; - case LEU: -- /* ??? As above. */ - if (mode == CCmode) - suffix = "be"; -- else if (mode == CCCmode) -- suffix = fp ? "nb" : "ae"; - else - gcc_unreachable (); - break; -@@ -15340,7 +15300,7 @@ - rtx arg = XEXP (XEXP (link, 0), 0); - - if (ix86_check_avx256_register (&arg, NULL)) -- return AVX_U128_ANY; -+ return AVX_U128_DIRTY; - } - } - -@@ -15460,8 +15420,8 @@ - { - bool avx_reg256_found = false; - note_stores (pat, ix86_check_avx256_stores, &avx_reg256_found); -- if (!avx_reg256_found) -- return AVX_U128_CLEAN; -+ -+ return avx_reg256_found ? AVX_U128_DIRTY : AVX_U128_CLEAN; - } - - /* Otherwise, return current mode. Remember that if insn -@@ -17350,10 +17310,20 @@ - if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun)) - return false; - -- /* Check it is correct to split here. */ -- if (!ix86_ok_to_clobber_flags(insn)) -+ /* The "at least two components" test below might not catch simple -+ move or zero extension insns if parts.base is non-NULL and parts.disp -+ is const0_rtx as the only components in the address, e.g. if the -+ register is %rbp or %r13. As this test is much cheaper and moves or -+ zero extensions are the common case, do this check first. */ -+ if (REG_P (operands[1]) -+ || (SImode_address_operand (operands[1], VOIDmode) -+ && REG_P (XEXP (operands[1], 0)))) - return false; - -+ /* Check if it is OK to split here. */ -+ if (!ix86_ok_to_clobber_flags (insn)) -+ return false; -+ - ok = ix86_decompose_address (operands[1], &parts); - gcc_assert (ok); - -@@ -18486,12 +18456,7 @@ - return CCmode; - case GTU: /* CF=0 & ZF=0 */ - case LEU: /* CF=1 | ZF=1 */ -- /* Detect overflow checks. They need just the carry flag. */ -- if (GET_CODE (op0) == MINUS -- && rtx_equal_p (op1, XEXP (op0, 0))) -- return CCCmode; -- else -- return CCmode; -+ return CCmode; - /* Codes possibly doable only with sign flag when - comparing against zero. */ - case GE: /* SF=OF or SF=0 */ -@@ -20500,7 +20465,7 @@ - return; - - case V8SFmode: -- mask = gen_lowpart (V8SFmode, mask); -+ mask = gen_lowpart (V8SImode, mask); - if (one_operand_shuffle) - emit_insn (gen_avx2_permvarv8sf (target, op0, mask)); - else -@@ -21740,6 +21705,21 @@ - return SImode; - } - -+/* Copy the address to a Pmode register. This is used for x32 to -+ truncate DImode TLS address to a SImode register. */ -+ -+static rtx -+ix86_copy_addr_to_reg (rtx addr) -+{ -+ if (GET_MODE (addr) == Pmode) -+ return copy_addr_to_reg (addr); -+ else -+ { -+ gcc_assert (GET_MODE (addr) == DImode && Pmode == SImode); -+ return gen_rtx_SUBREG (SImode, copy_to_mode_reg (DImode, addr), 0); -+ } -+} -+ - /* When SRCPTR is non-NULL, output simple loop to move memory - pointer to SRCPTR to DESTPTR via chunks of MODE unrolled UNROLL times, - overall size is COUNT specified in bytes. When SRCPTR is NULL, output the -@@ -22728,8 +22708,8 @@ - gcc_assert (alg != no_stringop); - if (!count) - count_exp = copy_to_mode_reg (GET_MODE (count_exp), count_exp); -- destreg = copy_addr_to_reg (XEXP (dst, 0)); -- srcreg = copy_addr_to_reg (XEXP (src, 0)); -+ destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); -+ srcreg = ix86_copy_addr_to_reg (XEXP (src, 0)); - switch (alg) - { - case libcall: -@@ -23119,7 +23099,7 @@ - gcc_assert (alg != no_stringop); - if (!count) - count_exp = copy_to_mode_reg (counter_mode (count_exp), count_exp); -- destreg = copy_addr_to_reg (XEXP (dst, 0)); -+ destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); - switch (alg) - { - case libcall: -@@ -24988,7 +24968,8 @@ - int - ix86_data_alignment (tree type, int align) - { -- int max_align = optimize_size ? BITS_PER_WORD : MIN (256, MAX_OFILE_ALIGNMENT); -+ int max_align -+ = optimize_size ? BITS_PER_WORD : MIN (256, MAX_OFILE_ALIGNMENT); - - if (AGGREGATE_TYPE_P (type) - && TYPE_SIZE (type) -@@ -27984,8 +27965,8 @@ - { OPTION_MASK_ISA_XOP, CODE_FOR_xop_shlv8hi3, "__builtin_ia32_vpshlw", IX86_BUILTIN_VPSHLW, UNKNOWN, (int)MULTI_ARG_2_HI }, - { OPTION_MASK_ISA_XOP, CODE_FOR_xop_shlv16qi3, "__builtin_ia32_vpshlb", IX86_BUILTIN_VPSHLB, UNKNOWN, (int)MULTI_ARG_2_QI }, - -- { OPTION_MASK_ISA_XOP, CODE_FOR_xop_vmfrczv4sf2, "__builtin_ia32_vfrczss", IX86_BUILTIN_VFRCZSS, UNKNOWN, (int)MULTI_ARG_2_SF }, -- { OPTION_MASK_ISA_XOP, CODE_FOR_xop_vmfrczv2df2, "__builtin_ia32_vfrczsd", IX86_BUILTIN_VFRCZSD, UNKNOWN, (int)MULTI_ARG_2_DF }, -+ { OPTION_MASK_ISA_XOP, CODE_FOR_xop_vmfrczv4sf2, "__builtin_ia32_vfrczss", IX86_BUILTIN_VFRCZSS, UNKNOWN, (int)MULTI_ARG_1_SF }, -+ { OPTION_MASK_ISA_XOP, CODE_FOR_xop_vmfrczv2df2, "__builtin_ia32_vfrczsd", IX86_BUILTIN_VFRCZSD, UNKNOWN, (int)MULTI_ARG_1_DF }, - { OPTION_MASK_ISA_XOP, CODE_FOR_xop_frczv4sf2, "__builtin_ia32_vfrczps", IX86_BUILTIN_VFRCZPS, UNKNOWN, (int)MULTI_ARG_1_SF }, - { OPTION_MASK_ISA_XOP, CODE_FOR_xop_frczv2df2, "__builtin_ia32_vfrczpd", IX86_BUILTIN_VFRCZPD, UNKNOWN, (int)MULTI_ARG_1_DF }, - { OPTION_MASK_ISA_XOP, CODE_FOR_xop_frczv8sf2, "__builtin_ia32_vfrczps256", IX86_BUILTIN_VFRCZPS256, UNKNOWN, (int)MULTI_ARG_1_SF2 }, -@@ -31245,11 +31226,12 @@ - - static rtx - ix86_expand_special_args_builtin (const struct builtin_description *d, -- tree exp, rtx target) -+ tree exp, rtx target) - { - tree arg; - rtx pat, op; - unsigned int i, nargs, arg_adjust, memory; -+ bool aligned_mem = false; - struct - { - rtx op; -@@ -31295,6 +31277,15 @@ - nargs = 1; - klass = load; - memory = 0; -+ switch (icode) -+ { -+ case CODE_FOR_sse4_1_movntdqa: -+ case CODE_FOR_avx2_movntdqa: -+ aligned_mem = true; -+ break; -+ default: -+ break; -+ } - break; - case VOID_FTYPE_PV2SF_V4SF: - case VOID_FTYPE_PV4DI_V4DI: -@@ -31312,6 +31303,26 @@ - klass = store; - /* Reserve memory operand for target. */ - memory = ARRAY_SIZE (args); -+ switch (icode) -+ { -+ /* These builtins and instructions require the memory -+ to be properly aligned. */ -+ case CODE_FOR_avx_movntv4di: -+ case CODE_FOR_sse2_movntv2di: -+ case CODE_FOR_avx_movntv8sf: -+ case CODE_FOR_sse_movntv4sf: -+ case CODE_FOR_sse4a_vmmovntv4sf: -+ case CODE_FOR_avx_movntv4df: -+ case CODE_FOR_sse2_movntv2df: -+ case CODE_FOR_sse4a_vmmovntv2df: -+ case CODE_FOR_sse2_movntidi: -+ case CODE_FOR_sse_movntq: -+ case CODE_FOR_sse2_movntisi: -+ aligned_mem = true; -+ break; -+ default: -+ break; -+ } - break; - case V4SF_FTYPE_V4SF_PCV2SF: - case V2DF_FTYPE_V2DF_PCDOUBLE: -@@ -31368,6 +31379,17 @@ - { - op = force_reg (Pmode, convert_to_mode (Pmode, op, 1)); - target = gen_rtx_MEM (tmode, op); -+ /* target at this point has just BITS_PER_UNIT MEM_ALIGN -+ on it. Try to improve it using get_pointer_alignment, -+ and if the special builtin is one that requires strict -+ mode alignment, also from it's GET_MODE_ALIGNMENT. -+ Failure to do so could lead to ix86_legitimate_combined_insn -+ rejecting all changes to such insns. */ -+ unsigned int align = get_pointer_alignment (arg); -+ if (aligned_mem && align < GET_MODE_ALIGNMENT (tmode)) -+ align = GET_MODE_ALIGNMENT (tmode); -+ if (MEM_ALIGN (target) < align) -+ set_mem_align (target, align); - } - else - target = force_reg (tmode, op); -@@ -31413,8 +31435,17 @@ - /* This must be the memory operand. */ - op = force_reg (Pmode, convert_to_mode (Pmode, op, 1)); - op = gen_rtx_MEM (mode, op); -- gcc_assert (GET_MODE (op) == mode -- || GET_MODE (op) == VOIDmode); -+ /* op at this point has just BITS_PER_UNIT MEM_ALIGN -+ on it. Try to improve it using get_pointer_alignment, -+ and if the special builtin is one that requires strict -+ mode alignment, also from it's GET_MODE_ALIGNMENT. -+ Failure to do so could lead to ix86_legitimate_combined_insn -+ rejecting all changes to such insns. */ -+ unsigned int align = get_pointer_alignment (arg); -+ if (aligned_mem && align < GET_MODE_ALIGNMENT (mode)) -+ align = GET_MODE_ALIGNMENT (mode); -+ if (MEM_ALIGN (op) < align) -+ set_mem_align (op, align); - } - else - { -@@ -32208,7 +32239,9 @@ - mode4 = insn_data[icode].operand[5].mode; - - if (target == NULL_RTX -- || GET_MODE (target) != insn_data[icode].operand[0].mode) -+ || GET_MODE (target) != insn_data[icode].operand[0].mode -+ || !insn_data[icode].operand[0].predicate (target, -+ GET_MODE (target))) - subtarget = gen_reg_rtx (insn_data[icode].operand[0].mode); - else - subtarget = target; -@@ -33879,10 +33912,10 @@ - { - /* We implement the move patterns for all vector modes into and - out of SSE registers, even when no operation instructions -- are available. OImode move is available only when AVX is -- enabled. */ -- return ((TARGET_AVX && mode == OImode) -- || VALID_AVX256_REG_MODE (mode) -+ are available. OImode and AVX modes are available only when -+ AVX is enabled. */ -+ return ((TARGET_AVX -+ && VALID_AVX256_REG_OR_OI_MODE (mode)) - || VALID_SSE_REG_MODE (mode) - || VALID_SSE2_REG_MODE (mode) - || VALID_MMX_REG_MODE (mode) -@@ -35020,7 +35053,7 @@ - { - tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, fnaddr), UNSPEC_GOTPCREL); - tmp = gen_rtx_CONST (Pmode, tmp); -- fnaddr = gen_rtx_MEM (Pmode, tmp); -+ fnaddr = gen_const_mem (Pmode, tmp); - } - } - else -@@ -35040,8 +35073,9 @@ - output_set_got (tmp, NULL_RTX); - - fnaddr = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, fnaddr), UNSPEC_GOT); -- fnaddr = gen_rtx_PLUS (Pmode, fnaddr, tmp); -- fnaddr = gen_rtx_MEM (Pmode, fnaddr); -+ fnaddr = gen_rtx_CONST (Pmode, fnaddr); -+ fnaddr = gen_rtx_PLUS (Pmode, tmp, fnaddr); -+ fnaddr = gen_const_mem (Pmode, fnaddr); - } - } - -@@ -35232,7 +35266,10 @@ - The smallest offset in the page INSN can start is the case where START - ends on the offset 0. Offset of INSN is then NBYTES - sizeof (INSN). - We add p2align to 16byte window with maxskip 15 - NBYTES + sizeof (INSN). -- */ -+ -+ Don't consider asm goto as jump, while it can contain a jump, it doesn't -+ have to, control transfer to label(s) can be performed through other -+ means, and also we estimate minimum length of all asm stmts as 0. */ - for (insn = start; insn; insn = NEXT_INSN (insn)) - { - int min_size; -@@ -35260,6 +35297,7 @@ - { - start = NEXT_INSN (start); - if ((JUMP_P (start) -+ && asm_noperands (PATTERN (start)) < 0 - && GET_CODE (PATTERN (start)) != ADDR_VEC - && GET_CODE (PATTERN (start)) != ADDR_DIFF_VEC) - || CALL_P (start)) -@@ -35278,6 +35316,7 @@ - fprintf (dump_file, "Insn %i estimated to %i bytes\n", - INSN_UID (insn), min_size); - if ((JUMP_P (insn) -+ && asm_noperands (PATTERN (insn)) < 0 - && GET_CODE (PATTERN (insn)) != ADDR_VEC - && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC) - || CALL_P (insn)) -@@ -35289,6 +35328,7 @@ - { - start = NEXT_INSN (start); - if ((JUMP_P (start) -+ && asm_noperands (PATTERN (start)) < 0 - && GET_CODE (PATTERN (start)) != ADDR_VEC - && GET_CODE (PATTERN (start)) != ADDR_DIFF_VEC) - || CALL_P (start)) -@@ -39371,7 +39411,9 @@ - else - dfinal.perm[i] = e; - } -- dfinal.op0 = gen_reg_rtx (dfinal.vmode); -+ -+ if (!d->testing_p) -+ dfinal.op0 = gen_reg_rtx (dfinal.vmode); - dfinal.op1 = dfinal.op0; - dfinal.one_operand_p = true; - dremap.target = dfinal.op0; -@@ -39806,6 +39848,9 @@ - return false; - gcc_assert (!d->one_operand_p); - -+ if (d->testing_p) -+ return true; -+ - nelt = d->nelt; - eltsz = GET_MODE_SIZE (GET_MODE_INNER (d->vmode)); - -@@ -40005,6 +40050,8 @@ - switch (d->vmode) - { - case V4DFmode: -+ if (d->testing_p) -+ break; - t1 = gen_reg_rtx (V4DFmode); - t2 = gen_reg_rtx (V4DFmode); - -@@ -40024,6 +40071,8 @@ - { - int mask = odd ? 0xdd : 0x88; - -+ if (d->testing_p) -+ break; - t1 = gen_reg_rtx (V8SFmode); - t2 = gen_reg_rtx (V8SFmode); - t3 = gen_reg_rtx (V8SFmode); -@@ -40065,6 +40114,8 @@ - return expand_vec_perm_pshufb2 (d); - else - { -+ if (d->testing_p) -+ break; - /* We need 2*log2(N)-1 operations to achieve odd/even - with interleave. */ - t1 = gen_reg_rtx (V8HImode); -@@ -40086,6 +40137,8 @@ - return expand_vec_perm_pshufb2 (d); - else - { -+ if (d->testing_p) -+ break; - t1 = gen_reg_rtx (V16QImode); - t2 = gen_reg_rtx (V16QImode); - t3 = gen_reg_rtx (V16QImode); -@@ -40118,6 +40171,9 @@ - return expand_vec_perm_even_odd_1 (&d_copy, odd); - } - -+ if (d->testing_p) -+ break; -+ - t1 = gen_reg_rtx (V4DImode); - t2 = gen_reg_rtx (V4DImode); - -@@ -40144,6 +40200,9 @@ - return expand_vec_perm_even_odd_1 (&d_copy, odd); - } - -+ if (d->testing_p) -+ break; -+ - t1 = gen_reg_rtx (V8SImode); - t2 = gen_reg_rtx (V8SImode); - -@@ -40236,6 +40295,8 @@ - case V16QImode: - /* These can be implemented via interleave. We save one insn by - stopping once we have promoted to V4SImode and then use pshufd. */ -+ if (d->testing_p) -+ return true; - do - { - rtx dest; -@@ -42473,8 +42534,6 @@ - - #undef TARGET_PROMOTE_PROTOTYPES - #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true --#undef TARGET_STRUCT_VALUE_RTX --#define TARGET_STRUCT_VALUE_RTX ix86_struct_value_rtx - #undef TARGET_SETUP_INCOMING_VARARGS - #define TARGET_SETUP_INCOMING_VARARGS ix86_setup_incoming_varargs - #undef TARGET_MUST_PASS_IN_STACK -Index: gcc/config/tilegx/tilegx.md -=================================================================== ---- a/src/gcc/config/tilegx/tilegx.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilegx/tilegx.md (.../branches/gcc-4_8-branch) -@@ -5076,10 +5076,8 @@ - - ;; Network intrinsics - --;; Note the "pseudo" text is handled specially by the --;; asm_output_opcode routine. If the output is an empty string, the --;; instruction would bypass the asm_output_opcode routine, bypassing --;; the bundle handling code. -+;; Note the this barrier is of type "nothing," which is deleted after -+;; the final scheduling pass so that nothing is emitted for it. - (define_insn "tilegx_network_barrier" - [(unspec_volatile:SI [(const_int 0)] UNSPEC_NETWORK_BARRIER)] - "" -Index: gcc/config/tilegx/tilegx-c.c -=================================================================== ---- a/src/gcc/config/tilegx/tilegx-c.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilegx/tilegx-c.c (.../branches/gcc-4_8-branch) -@@ -47,6 +47,9 @@ - if (TARGET_32BIT) - builtin_define ("__tilegx32__"); - -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); -+ - TILEGX_CPU_CPP_ENDIAN_BUILTINS (); - GNU_USER_TARGET_OS_CPP_BUILTINS (); - } -Index: gcc/config/tilegx/sync.md -=================================================================== ---- a/src/gcc/config/tilegx/sync.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilegx/sync.md (.../branches/gcc-4_8-branch) -@@ -150,15 +150,22 @@ - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -+ rtx addend; - enum memmodel model = (enum memmodel) INTVAL (operands[3]); - - if (operands[2] != const0_rtx) -- emit_move_insn (operands[2], gen_rtx_NEG (<MODE>mode, operands[2])); -+ { -+ addend = gen_reg_rtx (<MODE>mode); -+ emit_move_insn (addend, -+ gen_rtx_MINUS (<MODE>mode, const0_rtx, operands[2])); -+ } -+ else -+ addend = operands[2]; - - tilegx_pre_atomic_barrier (model); - emit_insn (gen_atomic_fetch_add_bare<mode> (operands[0], - operands[1], -- operands[2])); -+ addend)); - tilegx_post_atomic_barrier (model); - DONE; - }) -Index: gcc/config/tilegx/tilegx.c -=================================================================== ---- a/src/gcc/config/tilegx/tilegx.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilegx/tilegx.c (.../branches/gcc-4_8-branch) -@@ -702,6 +702,16 @@ - } - - -+/* Implement TARGET_EXPAND_TO_RTL_HOOK. */ -+static void -+tilegx_expand_to_rtl_hook (void) -+{ -+ /* Exclude earlier sets of crtl->uses_pic_offset_table, because we -+ only care about uses actually emitted. */ -+ crtl->uses_pic_offset_table = 0; -+} -+ -+ - /* Implement TARGET_SHIFT_TRUNCATION_MASK. DImode shifts use the mode - matching insns and therefore guarantee that the shift count is - modulo 64. SImode shifts sometimes use the 64 bit version so do -@@ -3543,6 +3553,12 @@ - } - if (!pat) - return NULL_RTX; -+ -+ /* If we are generating a prefetch, tell the scheduler not to move -+ it around. */ -+ if (GET_CODE (pat) == PREFETCH) -+ PREFETCH_SCHEDULE_BARRIER_P (pat) = true; -+ - emit_insn (pat); - - if (nonvoid) -@@ -4368,10 +4384,12 @@ - basic_block bb; - FOR_EACH_BB (bb) - { -- rtx insn, next; -+ rtx insn, next, prev; - rtx end = NEXT_INSN (BB_END (bb)); - -- for (insn = next_insn_to_bundle (BB_HEAD (bb), end); insn; insn = next) -+ prev = NULL_RTX; -+ for (insn = next_insn_to_bundle (BB_HEAD (bb), end); insn; -+ prev = insn, insn = next) - { - next = next_insn_to_bundle (NEXT_INSN (insn), end); - -@@ -4396,6 +4414,18 @@ - PUT_MODE (insn, SImode); - } - } -+ -+ /* Delete barrier insns, because they can mess up the -+ emitting of bundle braces. If it is end-of-bundle, then -+ the previous insn must be marked end-of-bundle. */ -+ if (get_attr_type (insn) == TYPE_NOTHING) { -+ if (GET_MODE (insn) == QImode && prev != NULL -+ && GET_MODE (prev) == SImode) -+ { -+ PUT_MODE (prev, QImode); -+ } -+ delete_insn (insn); -+ } - } - } - } -@@ -5498,6 +5528,9 @@ - #undef TARGET_RTX_COSTS - #define TARGET_RTX_COSTS tilegx_rtx_costs - -+#undef TARGET_EXPAND_TO_RTL_HOOK -+#define TARGET_EXPAND_TO_RTL_HOOK tilegx_expand_to_rtl_hook -+ - #undef TARGET_SHIFT_TRUNCATION_MASK - #define TARGET_SHIFT_TRUNCATION_MASK tilegx_shift_truncation_mask - -Index: gcc/config/sh/predicates.md -=================================================================== ---- a/src/gcc/config/sh/predicates.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/predicates.md (.../branches/gcc-4_8-branch) -@@ -389,6 +389,12 @@ - XEXP (XEXP (op, 0), 1), - TARGET_SH2A, true)"))) - -+;; Returns true if OP is a displacement address that can fit into a -+;; 16 bit (non-SH2A) memory load / store insn. -+(define_predicate "short_displacement_mem_operand" -+ (match_test "sh_disp_addr_displacement (op) -+ <= sh_max_mov_insn_displacement (GET_MODE (op), false)")) -+ - ;; Returns 1 if the operand can be used in an SH2A movu.{b|w} insn. - (define_predicate "zero_extend_movu_operand" - (and (match_operand 0 "displacement_mem_operand") -@@ -413,6 +419,11 @@ - if (t_reg_operand (op, mode)) - return 0; - -+ /* Disallow PC relative QImode loads, since these is no insn to do that -+ and an imm8 load should be used instead. */ -+ if (IS_PC_RELATIVE_LOAD_ADDR_P (op) && GET_MODE (op) == QImode) -+ return false; -+ - if (MEM_P (op)) - { - rtx inside = XEXP (op, 0); -Index: gcc/config/sh/sh-protos.h -=================================================================== ---- a/src/gcc/config/sh/sh-protos.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/sh-protos.h (.../branches/gcc-4_8-branch) -@@ -159,6 +159,8 @@ - extern bool sh_cfun_trap_exit_p (void); - extern rtx sh_find_equiv_gbr_addr (rtx cur_insn, rtx mem); - extern int sh_eval_treg_value (rtx op); -+extern HOST_WIDE_INT sh_disp_addr_displacement (rtx mem_op); -+extern int sh_max_mov_insn_displacement (machine_mode mode, bool consider_sh2a); - - /* Result value of sh_find_set_of_reg. */ - struct set_of_reg -Index: gcc/config/sh/sh.c -=================================================================== ---- a/src/gcc/config/sh/sh.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/sh.c (.../branches/gcc-4_8-branch) -@@ -310,9 +310,7 @@ - static void sh_conditional_register_usage (void); - static bool sh_legitimate_constant_p (enum machine_mode, rtx); - static int mov_insn_size (enum machine_mode, bool); --static int max_mov_insn_displacement (enum machine_mode, bool); - static int mov_insn_alignment_mask (enum machine_mode, bool); --static HOST_WIDE_INT disp_addr_displacement (rtx); - static bool sequence_insn_p (rtx); - static void sh_canonicalize_comparison (int *, rtx *, rtx *, bool); - static void sh_canonicalize_comparison (enum rtx_code&, rtx&, rtx&, -@@ -3628,8 +3626,8 @@ - - /* Determine the maximum possible displacement for a move insn for the - specified mode. */ --static int --max_mov_insn_displacement (enum machine_mode mode, bool consider_sh2a) -+int -+sh_max_mov_insn_displacement (machine_mode mode, bool consider_sh2a) - { - /* The 4 byte displacement move insns are the same as the 2 byte - versions but take a 12 bit displacement. All we need to do is to -@@ -3665,8 +3663,8 @@ - } - - /* Return the displacement value of a displacement address. */ --static inline HOST_WIDE_INT --disp_addr_displacement (rtx x) -+HOST_WIDE_INT -+sh_disp_addr_displacement (rtx x) - { - gcc_assert (satisfies_constraint_Sdd (x)); - return INTVAL (XEXP (XEXP (x, 0), 1)); -@@ -3703,12 +3701,12 @@ - HImode and QImode loads/stores with displacement put pressure on - R0 which will most likely require another reg copy. Thus account - a higher cost for that. */ -- if (offset > 0 && offset <= max_mov_insn_displacement (mode, false)) -+ if (offset > 0 && offset <= sh_max_mov_insn_displacement (mode, false)) - return (mode == HImode || mode == QImode) ? 2 : 1; - - /* The displacement would fit into a 4 byte move insn (SH2A). */ - if (TARGET_SH2A -- && offset > 0 && offset <= max_mov_insn_displacement (mode, true)) -+ && offset > 0 && offset <= sh_max_mov_insn_displacement (mode, true)) - return 2; - - /* The displacement is probably out of range and will require extra -@@ -10218,7 +10216,7 @@ - else - { - const HOST_WIDE_INT offset = INTVAL (op); -- const int max_disp = max_mov_insn_displacement (mode, consider_sh2a); -+ const int max_disp = sh_max_mov_insn_displacement (mode, consider_sh2a); - const int align_mask = mov_insn_alignment_mask (mode, consider_sh2a); - - /* If the mode does not support any displacement always return false. -@@ -10404,7 +10402,7 @@ - effectively disable the small displacement insns. */ - const int mode_sz = GET_MODE_SIZE (mode); - const int mov_insn_sz = mov_insn_size (mode, false); -- const int max_disp = max_mov_insn_displacement (mode, false); -+ const int max_disp = sh_max_mov_insn_displacement (mode, false); - const int max_disp_next = max_disp + mov_insn_sz; - HOST_WIDE_INT align_modifier = offset > 127 ? mov_insn_sz : 0; - HOST_WIDE_INT offset_adjust; -@@ -13165,7 +13163,8 @@ - the insns must have the appropriate alternatives. */ - if ((mode == QImode || mode == HImode) && rclass != R0_REGS - && satisfies_constraint_Sdd (x) -- && disp_addr_displacement (x) <= max_mov_insn_displacement (mode, false)) -+ && sh_disp_addr_displacement (x) -+ <= sh_max_mov_insn_displacement (mode, false)) - return R0_REGS; - - /* When reload is trying to address a QImode or HImode subreg on the stack, -Index: gcc/config/sh/constraints.md -=================================================================== ---- a/src/gcc/config/sh/constraints.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/constraints.md (.../branches/gcc-4_8-branch) -@@ -221,6 +221,7 @@ - (define_constraint "Q" - "A pc relative load operand." - (and (match_code "mem") -+ (match_test "GET_MODE (op) != QImode") - (match_test "IS_PC_RELATIVE_LOAD_ADDR_P (XEXP (op, 0))"))) - - (define_constraint "Bsc" -@@ -295,13 +296,15 @@ - - (define_memory_constraint "Sdd" - "A memory reference that uses displacement addressing." -- (and (match_test "MEM_P (op) && GET_CODE (XEXP (op, 0)) == PLUS") -+ (and (match_code "mem") -+ (match_test "GET_CODE (XEXP (op, 0)) == PLUS") - (match_test "REG_P (XEXP (XEXP (op, 0), 0))") - (match_test "CONST_INT_P (XEXP (XEXP (op, 0), 1))"))) - - (define_memory_constraint "Snd" - "A memory reference that excludes displacement addressing." -- (match_test "! satisfies_constraint_Sdd (op)")) -+ (and (match_code "mem") -+ (match_test "! satisfies_constraint_Sdd (op)"))) - - (define_memory_constraint "Sbv" - "A memory reference, as used in SH2A bclr.b, bset.b, etc." -Index: gcc/config/sh/sh.md -=================================================================== ---- a/src/gcc/config/sh/sh.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/sh.md (.../branches/gcc-4_8-branch) -@@ -2152,6 +2152,7 @@ - (udiv:SI (reg:SI R4_REG) (reg:SI R5_REG))) - (clobber (reg:SI T_REG)) - (clobber (reg:SI PR_REG)) -+ (clobber (reg:SI R1_REG)) - (clobber (reg:SI R4_REG)) - (use (match_operand:SI 1 "arith_reg_operand" "r"))] - "TARGET_SH1 && TARGET_DIVIDE_CALL_DIV1" -@@ -6831,34 +6832,9 @@ - prepare_move_operands (operands, QImode); - }) - --;; If movqi_reg_reg is specified as an alternative of movqi, movqi will be --;; selected to copy QImode regs. If one of them happens to be allocated --;; on the stack, reload will stick to movqi insn and generate wrong --;; displacement addressing because of the generic m alternatives. --;; With the movqi_reg_reg being specified before movqi it will be initially --;; picked to load/store regs. If the regs regs are on the stack reload --;; try other insns and not stick to movqi_reg_reg, unless there were spilled --;; pseudos in which case 'm' constraints pertain. --;; The same applies to the movhi variants. --;; --;; Notice, that T bit is not allowed as a mov src operand here. This is to --;; avoid things like (set (reg:QI) (subreg:QI (reg:SI T_REG) 0)), which --;; introduces zero extensions after T bit stores and redundant reg copies. --;; --;; FIXME: We can't use 'arith_reg_operand' (which disallows T_REG) as a --;; predicate for the mov src operand because reload will have trouble --;; reloading MAC subregs otherwise. For that probably special patterns --;; would be required. --(define_insn "*mov<mode>_reg_reg" -- [(set (match_operand:QIHI 0 "arith_reg_dest" "=r,m,*z") -- (match_operand:QIHI 1 "register_operand" "r,*z,m"))] -- "TARGET_SH1 && !t_reg_operand (operands[1], VOIDmode)" -- "@ -- mov %1,%0 -- mov.<bw> %1,%0 -- mov.<bw> %1,%0" -- [(set_attr "type" "move,store,load")]) -- -+;; Specifying the displacement addressing load / store patterns separately -+;; before the generic movqi / movhi pattern allows controlling the order -+;; in which load / store insns are selected in a more fine grained way. - ;; FIXME: The non-SH2A and SH2A variants should be combined by adding - ;; "enabled" attribute as it is done in other targets. - (define_insn "*mov<mode>_store_mem_disp04" -@@ -6908,38 +6884,44 @@ - [(set_attr "type" "load") - (set_attr "length" "2,2,4")]) - --;; The m constraints basically allow any kind of addresses to be used with any --;; source/target register as the other operand. This is not true for --;; displacement addressing modes on anything but SH2A. That's why the --;; specialized load/store insns are specified above. --(define_insn "*movqi" -- [(set (match_operand:QI 0 "general_movdst_operand" "=r,r,m,r,l") -- (match_operand:QI 1 "general_movsrc_operand" "i,m,r,l,r"))] -+;; The order of the constraint alternatives is important here. -+;; Q/r has to come first, otherwise PC relative loads might wrongly get -+;; placed into delay slots. Since there is no QImode PC relative load, the -+;; Q constraint and general_movsrc_operand will reject it for QImode. -+;; The Snd alternatives should come before Sdd in order to avoid a preference -+;; of using r0 als the register operand for addressing modes other than -+;; displacement addressing. -+;; The Sdd alternatives allow only r0 as register operand, even though on -+;; SH2A any register could be allowed by switching to a 32 bit insn. -+;; Generally sticking to the r0 is preferrable, since it generates smaller -+;; code. Obvious r0 reloads can then be eliminated with a peephole on SH2A. -+(define_insn "*mov<mode>" -+ [(set (match_operand:QIHI 0 "general_movdst_operand" -+ "=r,r,r,Snd,r, Sdd,z, r,l") -+ (match_operand:QIHI 1 "general_movsrc_operand" -+ "Q,r,i,r, Snd,z, Sdd,l,r"))] - "TARGET_SH1 -- && (arith_reg_operand (operands[0], QImode) -- || arith_reg_operand (operands[1], QImode))" -+ && (arith_reg_operand (operands[0], <MODE>mode) -+ || arith_reg_operand (operands[1], <MODE>mode))" - "@ -+ mov.<bw> %1,%0 - mov %1,%0 -- mov.b %1,%0 -- mov.b %1,%0 -- sts %1,%0 -- lds %1,%0" -- [(set_attr "type" "movi8,load,store,prget,prset")]) -- --(define_insn "*movhi" -- [(set (match_operand:HI 0 "general_movdst_operand" "=r,r,r,m,r,l") -- (match_operand:HI 1 "general_movsrc_operand" "Q,i,m,r,l,r"))] -- "TARGET_SH1 -- && (arith_reg_operand (operands[0], HImode) -- || arith_reg_operand (operands[1], HImode))" -- "@ -- mov.w %1,%0 - mov %1,%0 -- mov.w %1,%0 -- mov.w %1,%0 -+ mov.<bw> %1,%0 -+ mov.<bw> %1,%0 -+ mov.<bw> %1,%0 -+ mov.<bw> %1,%0 - sts %1,%0 - lds %1,%0" -- [(set_attr "type" "pcload,movi8,load,store,prget,prset")]) -+ [(set_attr "type" "pcload,move,movi8,store,load,store,load,prget,prset") -+ (set (attr "length") -+ (cond [(and (match_operand 0 "displacement_mem_operand") -+ (not (match_operand 0 "short_displacement_mem_operand"))) -+ (const_int 4) -+ (and (match_operand 1 "displacement_mem_operand") -+ (not (match_operand 1 "short_displacement_mem_operand"))) -+ (const_int 4)] -+ (const_int 2)))]) - - (define_insn "*movqi_media" - [(set (match_operand:QI 0 "general_movdst_operand" "=r,r,r,m") -@@ -8427,11 +8409,9 @@ - - while (true) - { -- /* It's not safe to go beyond the current basic block after reload. */ - set_of_reg s1 = sh_find_set_of_reg (tested_reg, s0.insn, -- reload_completed -- ? prev_nonnote_insn_bb -- : prev_nonnote_insn); -+ prev_nonnote_insn); -+ - if (s1.set_src == NULL_RTX) - break; - -@@ -8449,15 +8429,25 @@ - continue; - } - -- /* It's only safe to remove the testing insn if the T bit is not -- modified between the testing insn and the insn that stores the -- T bit. Notice that some T bit stores such as negc also modify -- the T bit. */ -- if (modified_between_p (get_t_reg_rtx (), s1.insn, testing_insn) -- || modified_in_p (get_t_reg_rtx (), s1.insn)) -- operands[2] = NULL_RTX; -+ /* It's only safe to remove the testing insn if the T bit is not -+ modified between the testing insn and the insn that stores the -+ T bit. Notice that some T bit stores such as negc also modify -+ the T bit. */ -+ if (modified_between_p (get_t_reg_rtx (), s1.insn, testing_insn) -+ || modified_in_p (get_t_reg_rtx (), s1.insn) -+ || !no_labels_between_p (s1.insn, testing_insn)) -+ operands[2] = NULL_RTX; -+ else -+ { -+ /* If the insn that sets the tested reg has a REG_DEAD note on -+ the T bit remove that note since we're extending the usage -+ of the T bit. */ -+ rtx n = find_regno_note (s1.insn, REG_DEAD, T_REG); -+ if (n != NULL_RTX) -+ remove_note (s1.insn, n); -+ } - -- break; -+ break; - } - - if (operands[2] == NULL_RTX) -Index: gcc/config/sh/sh.opt -=================================================================== ---- a/src/gcc/config/sh/sh.opt (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/sh/sh.opt (.../branches/gcc-4_8-branch) -@@ -21,7 +21,7 @@ - ;; Used for various architecture options. - Mask(SH_E) - --;; Set if the default precision of th FPU is single. -+;; Set if the default precision of the FPU is single. - Mask(FPU_SINGLE) - - ;; Set if the a double-precision FPU is present but is restricted to Index: gcc/config/microblaze/predicates.md =================================================================== ---- a/src/gcc/config/microblaze/predicates.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/microblaze/predicates.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/microblaze/predicates.md (.../branches/gcc-4_8-branch) -@@ -85,6 +85,10 @@ +@@ -85,10 +85,6 @@ (ior (match_operand 0 "const_0_operand") (match_operand 0 "register_operand"))) -+(define_predicate "reg_or_mem_operand" -+ (ior (match_operand 0 "memory_operand") -+ (match_operand 0 "register_operand"))) -+ +-(define_predicate "reg_or_mem_operand" +- (ior (match_operand 0 "memory_operand") +- (match_operand 0 "register_operand"))) +- ;; Return if the operand is either the PC or a label_ref. (define_special_predicate "pc_or_label_operand" (ior (match_code "pc,label_ref") -@@ -119,3 +123,7 @@ - ;; Test for valid PIC call operand - (define_predicate "call_insn_plt_operand" - (match_test "PLT_ADDR_P (op)")) -+ -+;; Return if the code of this rtx pattern is a comparison. -+(define_predicate "cmp_op" -+ (match_code "gt,ge,gtu,geu,lt,le,ltu,leu")) Index: gcc/config/microblaze/microblaze.md =================================================================== ---- a/src/gcc/config/microblaze/microblaze.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/microblaze/microblaze.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/microblaze/microblaze.md (.../branches/gcc-4_8-branch) -@@ -74,7 +74,7 @@ - ;; bshift Shift operations - - (define_attr "type" -- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt" -+ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap" - (const_string "unknown")) - - ;; Main data type used by the insn -@@ -365,7 +365,8 @@ - [(set (match_operand:HI 0 "register_operand" "=r") - (bswap:HI (match_operand:HI 1 "register_operand" "r")))] - "TARGET_REORDER" -- "swaph %0, %1" -+ "swapb %0, %1 -+ swaph %0, %0" - ) - - ;;---------------------------------------------------------------- -@@ -1118,6 +1119,18 @@ +@@ -1119,18 +1119,6 @@ } ) -+;;Load and store reverse -+(define_insn "movsi4_rev" -+ [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q") -+ (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))] -+ "TARGET_REORDER" -+ "@ -+ lwr\t%0,%y1,r0 -+ swr\t%1,%y0,r0" -+ [(set_attr "type" "load,store") -+ (set_attr "mode" "SI") -+ (set_attr "length" "4,4")]) -+ +-;;Load and store reverse +-(define_insn "movsi4_rev" +- [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q") +- (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))] +- "TARGET_REORDER" +- "@ +- lwr\t%0,%y1,r0 +- swr\t%1,%y0,r0" +- [(set_attr "type" "load,store") +- (set_attr "mode" "SI") +- (set_attr "length" "4,4")]) +- ;; 32-bit floating point moves (define_expand "movsf" -@@ -1472,7 +1485,7 @@ - (set_attr "length" "124")] - ) - --(define_insn "*ashlri_reg" -+(define_insn "*ashrsi_reg" - [(set (match_operand:SI 0 "register_operand" "=&d") - (ashiftrt:SI (match_operand:SI 1 "register_operand" "d") - (match_operand:SI 2 "register_operand" "d")))] -@@ -1561,7 +1574,7 @@ - (set_attr "length" "124")] - ) - --(define_insn "*lshlri_reg" -+(define_insn "*lshrsi_reg" - [(set (match_operand:SI 0 "register_operand" "=&d") - (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") - (match_operand:SI 2 "register_operand" "d")))] -@@ -1622,34 +1635,12 @@ - (set_attr "length" "4")] - ) - --(define_insn "signed_compare" -- [(set (match_operand:SI 0 "register_operand" "=d") -- (unspec -- [(match_operand:SI 1 "register_operand" "d") -- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMP))] -- "" -- "cmp\t%0,%1,%2" -- [(set_attr "type" "arith") -- (set_attr "mode" "SI") -- (set_attr "length" "4")]) -- --(define_insn "unsigned_compare" -- [(set (match_operand:SI 0 "register_operand" "=d") -- (unspec -- [(match_operand:SI 1 "register_operand" "d") -- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMPU))] -- "" -- "cmpu\t%0,%1,%2" -- [(set_attr "type" "arith") -- (set_attr "mode" "SI") -- (set_attr "length" "4")]) -- - ;;---------------------------------------------------------------- - ;; Setting a register from an floating point comparison. - ;;---------------------------------------------------------------- - (define_insn "cstoresf4" - [(set (match_operand:SI 0 "register_operand" "=r") -- (match_operator 1 "comparison_operator" -+ (match_operator:SI 1 "ordered_comparison_operator" - [(match_operand:SF 2 "register_operand" "r") - (match_operand:SF 3 "register_operand" "r")]))] - "TARGET_HARD_FLOAT" -@@ -1678,7 +1669,7 @@ - - (define_expand "cbranchsf4" - [(set (pc) -- (if_then_else (match_operator 0 "comparison_operator" -+ (if_then_else (match_operator 0 "ordered_comparison_operator" - [(match_operand:SF 1 "register_operand") - (match_operand:SF 2 "register_operand")]) - (label_ref (match_operand 3 "")) -@@ -1717,6 +1708,47 @@ - (set_attr "length" "4")] - ) - -+(define_insn "branch_compare" -+ [(set (pc) -+ (if_then_else (match_operator:SI 0 "cmp_op" -+ [(match_operand:SI 1 "register_operand" "d") -+ (match_operand:SI 2 "register_operand" "d") -+ ]) -+ (label_ref (match_operand 3)) -+ (pc))) -+ (clobber(reg:SI R_TMP))] -+ "" -+ { -+ operands[4] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM); -+ enum rtx_code code = GET_CODE (operands[0]); -+ -+ if (code == GT || code == LE) -+ { -+ output_asm_insn ("cmp\tr18,%z1,%z2", operands); -+ code = swap_condition (code); -+ } -+ else if (code == GTU || code == LEU) -+ { -+ output_asm_insn ("cmpu\tr18,%z1,%z2", operands); -+ code = swap_condition (code); -+ } -+ else if (code == GE || code == LT) -+ { -+ output_asm_insn ("cmp\tr18,%z2,%z1", operands); -+ } -+ else if (code == GEU || code == LTU) -+ { -+ output_asm_insn ("cmpu\tr18,%z2,%z1", operands); -+ } -+ -+ operands[0] = gen_rtx_fmt_ee (signed_condition (code), SImode, operands[4], const0_rtx); -+ return "b%C0i%?\tr18,%3"; -+ } -+ [(set_attr "type" "branch") -+ (set_attr "mode" "none") -+ (set_attr "length" "12")] -+) -+ - ;;---------------------------------------------------------------- - ;; Unconditional branches - ;;---------------------------------------------------------------- -@@ -2201,6 +2233,14 @@ - (set_attr "mode" "none") - (set_attr "length" "4")]) - -+;; Trap instruction pattern for __builtin_trap. Same as the glibc ABORT_INSTRUCTION -+(define_insn "trap" -+ [(trap_if (const_int 1) (const_int 0))] -+ "" -+ "brki\tr0,-1" -+ [(set_attr "type" "trap")] -+) -+ - ;; The insn to set GOT. The hardcoded number "8" accounts for $pc difference - ;; between "mfs" and "addik" instructions. - (define_insn "set_got" -Index: gcc/config/microblaze/microblaze.c -=================================================================== ---- a/src/gcc/config/microblaze/microblaze.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/microblaze/microblaze.c (.../branches/gcc-4_8-branch) -@@ -1609,21 +1609,28 @@ - microblaze_version_to_int (const char *version) - { - const char *p, *v; -- const char *tmpl = "vX.YY.Z"; -+ const char *tmpl = "vXX.YY.Z"; - int iver = 0; - - p = version; - v = tmpl; - -- while (*v) -+ while (*p) - { - if (*v == 'X') - { /* Looking for major */ -- if (!(*p >= '0' && *p <= '9')) -- return -1; -- iver += (int) (*p - '0'); -- iver *= 10; -- } -+ if (*p == '.') -+ { -+ *v++; -+ } -+ else -+ { -+ if (!(*p >= '0' && *p <= '9')) -+ return -1; -+ iver += (int) (*p - '0'); -+ iver *= 10; -+ } -+ } - else if (*v == 'Y') - { /* Looking for minor */ - if (!(*p >= '0' && *p <= '9')) -@@ -3064,6 +3071,73 @@ - return result; - } - -+static void -+microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, -+ HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, -+ tree function) -+{ -+ rtx this_rtx, insn, funexp; -+ -+ reload_completed = 1; -+ epilogue_completed = 1; -+ -+ /* Mark the end of the (empty) prologue. */ -+ emit_note (NOTE_INSN_PROLOGUE_END); -+ -+ /* Find the "this" pointer. If the function returns a structure, -+ the structure return pointer is in MB_ABI_FIRST_ARG_REGNUM. */ -+ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) -+ this_rtx = gen_rtx_REG (Pmode, (MB_ABI_FIRST_ARG_REGNUM + 1)); -+ else -+ this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM); -+ -+ /* Apply the constant offset, if required. */ -+ if (delta) -+ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta))); -+ -+ /* Apply the offset from the vtable, if required. */ -+ if (vcall_offset) -+ { -+ rtx vcall_offset_rtx = GEN_INT (vcall_offset); -+ rtx temp1 = gen_rtx_REG (Pmode, MB_ABI_TEMP1_REGNUM); -+ -+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx)); -+ -+ rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx); -+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc)); -+ -+ emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1)); -+ } -+ -+ /* Generate a tail call to the target function. */ -+ if (!TREE_USED (function)) -+ { -+ assemble_external (function); -+ TREE_USED (function) = 1; -+ } -+ -+ funexp = XEXP (DECL_RTL (function), 0); -+ rtx temp2 = gen_rtx_REG (Pmode, MB_ABI_TEMP2_REGNUM); -+ -+ if (flag_pic) -+ emit_move_insn (temp2, expand_pic_symbol_ref (Pmode, funexp)); -+ else -+ emit_move_insn (temp2, funexp); -+ -+ emit_insn (gen_indirect_jump (temp2)); -+ -+ /* Run just enough of rest_of_compilation. This sequence was -+ "borrowed" from rs6000.c. */ -+ insn = get_insns (); -+ shorten_branches (insn); -+ final_start_function (insn, file, 1); -+ final (insn, file, 1); -+ final_end_function (); -+ -+ reload_completed = 0; -+ epilogue_completed = 0; -+} -+ - bool - microblaze_expand_move (enum machine_mode mode, rtx operands[]) - { -@@ -3234,67 +3308,47 @@ - emit_move_insn (mem, fnaddr); - } - --/* Emit instruction to perform compare. -- cmp is (compare_op op0 op1). */ --static rtx --microblaze_emit_compare (enum machine_mode mode, rtx cmp, enum rtx_code *cmp_code) -+/* Generate conditional branch -- first, generate test condition, -+ second, generate correct branch instruction. */ -+ -+void -+microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[]) - { -- rtx cmp_op0 = XEXP (cmp, 0); -- rtx cmp_op1 = XEXP (cmp, 1); -+ enum rtx_code code = GET_CODE (operands[0]); -+ rtx cmp_op0 = operands[1]; -+ rtx cmp_op1 = operands[2]; -+ rtx label1 = operands[3]; - rtx comp_reg = gen_reg_rtx (SImode); -- enum rtx_code code = *cmp_code; -- -+ rtx condition; -+ - gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG)); - - /* If comparing against zero, just test source reg. */ -- if (cmp_op1 == const0_rtx) -- return cmp_op0; -+ if (cmp_op1 == const0_rtx) -+ { -+ comp_reg = cmp_op0; -+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx); -+ emit_jump_insn (gen_condjump (condition, label1)); -+ } - -- if (code == EQ || code == NE) -+ else if (code == EQ || code == NE) - { - /* Use xor for equal/not-equal comparison. */ - emit_insn (gen_xorsi3 (comp_reg, cmp_op0, cmp_op1)); -+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx); -+ emit_jump_insn (gen_condjump (condition, label1)); - } -- else if (code == GT || code == GTU || code == LE || code == LEU) -+ else - { -- /* MicroBlaze compare is not symmetrical. */ -- /* Swap argument order. */ -+ /* Generate compare and branch in single instruction. */ - cmp_op1 = force_reg (mode, cmp_op1); -- if (code == GT || code == LE) -- emit_insn (gen_signed_compare (comp_reg, cmp_op0, cmp_op1)); -- else -- emit_insn (gen_unsigned_compare (comp_reg, cmp_op0, cmp_op1)); -- /* Translate test condition. */ -- *cmp_code = swap_condition (code); -+ condition = gen_rtx_fmt_ee (code, mode, cmp_op0, cmp_op1); -+ emit_jump_insn (gen_branch_compare(condition, cmp_op0, cmp_op1, label1)); - } -- else /* if (code == GE || code == GEU || code == LT || code == LTU) */ -- { -- cmp_op1 = force_reg (mode, cmp_op1); -- if (code == GE || code == LT) -- emit_insn (gen_signed_compare (comp_reg, cmp_op1, cmp_op0)); -- else -- emit_insn (gen_unsigned_compare (comp_reg, cmp_op1, cmp_op0)); -- } -- -- return comp_reg; - } - --/* Generate conditional branch -- first, generate test condition, -- second, generate correct branch instruction. */ - - void --microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[]) --{ -- enum rtx_code code = GET_CODE (operands[0]); -- rtx comp; -- rtx condition; -- -- comp = microblaze_emit_compare (mode, operands[0], &code); -- condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp, const0_rtx); -- emit_jump_insn (gen_condjump (condition, operands[3])); --} -- --void - microblaze_expand_conditional_branch_sf (rtx operands[]) - { - rtx condition; -@@ -3501,6 +3555,12 @@ - #undef TARGET_SECONDARY_RELOAD - #define TARGET_SECONDARY_RELOAD microblaze_secondary_reload - -+#undef TARGET_ASM_OUTPUT_MI_THUNK -+#define TARGET_ASM_OUTPUT_MI_THUNK microblaze_asm_output_mi_thunk -+ -+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK -+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true -+ - #undef TARGET_SCHED_ADJUST_COST - #define TARGET_SCHED_ADJUST_COST microblaze_adjust_cost - -Index: gcc/config/microblaze/microblaze.h +Index: gcc/config/avr/avr-fixed.md =================================================================== ---- a/src/gcc/config/microblaze/microblaze.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/microblaze/microblaze.h (.../branches/gcc-4_8-branch) -@@ -213,6 +213,12 @@ - #define STRICT_ALIGNMENT 1 - #define PCC_BITFIELD_TYPE_MATTERS 1 - -+#undef SIZE_TYPE -+#define SIZE_TYPE "unsigned int" -+ -+#undef PTRDIFF_TYPE -+#define PTRDIFF_TYPE "int" -+ - #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ - ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ - && (ALIGN) < BITS_PER_WORD \ -@@ -407,9 +413,6 @@ - || GET_MODE (X) == VOIDmode) \ - ? (GR_REGS) : (CLASS)))) - --#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ -- (GET_MODE_CLASS (MODE) == MODE_INT) -- - /* Stack layout; function entry, exit and calling. */ - - #define STACK_GROWS_DOWNWARD -Index: gcc/config/avr/avr.c -=================================================================== ---- a/src/gcc/config/avr/avr.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/avr/avr.c (.../branches/gcc-4_8-branch) -@@ -587,10 +587,14 @@ - const char *name; - - name = DECL_ASSEMBLER_NAME_SET_P (decl) -- /* Remove the leading '*' added in set_user_assembler_name. */ -- ? 1 + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)) -+ ? IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)) - : IDENTIFIER_POINTER (DECL_NAME (decl)); - -+ /* Skip a leading '*' that might still prefix the assembler name, -+ e.g. in non-LTO runs. */ -+ -+ name = default_strip_name_encoding (name); -+ - /* Silently ignore 'signal' if 'interrupt' is present. AVR-LibC startet - using this when it switched from SIGNAL and INTERRUPT to ISR. */ - -@@ -6806,8 +6810,8 @@ - - /* Work out the shortest sequence. */ - -- avr_out_plus_1 (op, &len_minus, MINUS, &cc_plus, code_sat, sign, out_label); -- avr_out_plus_1 (op, &len_plus, PLUS, &cc_minus, code_sat, sign, out_label); -+ avr_out_plus_1 (op, &len_minus, MINUS, &cc_minus, code_sat, sign, out_label); -+ avr_out_plus_1 (op, &len_plus, PLUS, &cc_plus, code_sat, sign, out_label); - - if (plen) - { -Index: gcc/config/cris/cris.md -=================================================================== ---- a/src/gcc/config/cris/cris.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/cris/cris.md (.../branches/gcc-4_8-branch) -@@ -758,7 +758,7 @@ - (match_operand:SI 1 "const_int_operand" "")) - (match_operand:SI 2 "register_operand" ""))]) - (match_operand 3 "register_operand" "")) -- (set (match_operand:SI 4 "register_operand" "") -+ (set (match_operand:SI 4 "cris_nonsp_register_operand" "") - (plus:SI (mult:SI (match_dup 0) - (match_dup 1)) - (match_dup 2)))])] -@@ -859,7 +859,7 @@ - (match_operand:SI 0 "cris_bdap_operand" "") - (match_operand:SI 1 "cris_bdap_operand" ""))]) - (match_operand 2 "register_operand" "")) -- (set (match_operand:SI 3 "register_operand" "") -+ (set (match_operand:SI 3 "cris_nonsp_register_operand" "") - (plus:SI (match_dup 0) (match_dup 1)))])] - "reload_completed && reg_overlap_mentioned_p (operands[3], operands[2])" - [(set (match_dup 4) (match_dup 2)) -@@ -3960,7 +3960,7 @@ - ;; up. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 4 "cris_operand_extend_operator" - [(match_operand 1 "register_operand" "") -@@ -3990,7 +3990,7 @@ - ;; Call this op-extend-split-rx=rz - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 4 "cris_plus_or_bound_operator" - [(match_operand 1 "register_operand" "") -@@ -4018,7 +4018,7 @@ - ;; Call this op-extend-split-swapped - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 4 "cris_plus_or_bound_operator" - [(match_operator -@@ -4044,7 +4044,7 @@ - ;; bound. Call this op-extend-split-swapped-rx=rz. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 4 "cris_plus_or_bound_operator" - [(match_operator -@@ -4075,7 +4075,7 @@ - ;; Call this op-extend. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 3 "cris_orthogonal_operator" - [(match_operand 1 "register_operand" "") -@@ -4099,7 +4099,7 @@ - ;; Call this op-split-rx=rz - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 3 "cris_commutative_orth_op" - [(match_operand 2 "memory_operand" "") -@@ -4123,7 +4123,7 @@ - ;; Call this op-split-swapped. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 3 "cris_commutative_orth_op" - [(match_operand 1 "register_operand" "") -@@ -4146,7 +4146,7 @@ - ;; Call this op-split-swapped-rx=rz. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 3 "cris_orthogonal_operator" - [(match_operand 2 "memory_operand" "") -@@ -4555,10 +4555,11 @@ - ;; We're not allowed to generate copies of registers with different mode - ;; until after reload; copying pseudos upsets reload. CVS as of - ;; 2001-08-24, unwind-dw2-fde.c, _Unwind_Find_FDE ICE in --;; cselib_invalidate_regno. -+;; cselib_invalidate_regno. Also, don't do this for the stack-pointer, -+;; as we don't want it set temporarily to an invalid value. - - (define_split ; indir_to_reg_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operand 1 "indirect_operand" ""))] - "reload_completed - && REG_P (operands[0]) -@@ -4574,7 +4575,7 @@ - ;; As the above, but MOVS and MOVU. - - (define_split -- [(set (match_operand 0 "register_operand" "") -+ [(set (match_operand 0 "cris_nonsp_register_operand" "") - (match_operator - 4 "cris_extend_operator" - [(match_operand 1 "indirect_operand" "")]))] -Index: gcc/config/cris/predicates.md -=================================================================== ---- a/src/gcc/config/cris/predicates.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/cris/predicates.md (.../branches/gcc-4_8-branch) -@@ -76,6 +76,10 @@ - (match_test "cris_simple_address_operand (XEXP (op, 0), - Pmode)")))) - -+(define_predicate "cris_nonsp_register_operand" -+ (and (match_operand 0 "register_operand") -+ (match_test "op != stack_pointer_rtx"))) -+ - ;; The caller needs to use :SI. - (define_predicate "cris_bdap_sign_extend_operand" - ; Disabled until <URL:http://gcc.gnu.org/ml/gcc-patches/2005-10/msg01376.html> -Index: gcc/config/m68k/m68k.c -=================================================================== ---- a/src/gcc/config/m68k/m68k.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/m68k/m68k.c (.../branches/gcc-4_8-branch) -@@ -3325,12 +3325,12 @@ - latehalf[1] = adjust_address (operands[1], SImode, 0); - } +--- a/src/gcc/config/avr/avr-fixed.md (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/config/avr/avr-fixed.md (.../branches/gcc-4_8-branch) +@@ -430,8 +430,8 @@ + } -- /* If insn is effectively movd N(sp),-(sp) then we will do the -- high word first. We should use the adjusted operand 1 (which is N+4(sp)) -- for the low word as well, to compensate for the first decrement of sp. */ -+ /* If insn is effectively movd N(REG),-(REG) then we will do the high -+ word first. We should use the adjusted operand 1 (which is N+4(REG)) -+ for the low word as well, to compensate for the first decrement of -+ REG. */ - if (optype0 == PUSHOP -- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM -- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1])) -+ && reg_overlap_mentioned_p (XEXP (XEXP (operands[0], 0), 0), operands[1])) - operands[1] = middlehalf[1] = latehalf[1]; + // Input and output of the libgcc function +- const unsigned int regno_in[] = { -1, 22, 22, -1, 18 }; +- const unsigned int regno_out[] = { -1, 24, 24, -1, 22 }; ++ const unsigned int regno_in[] = { -1U, 22, 22, -1U, 18 }; ++ const unsigned int regno_out[] = { -1U, 24, 24, -1U, 22 }; - /* For (set (reg:DI N) (mem:DI ... (reg:SI N) ...)), -Index: gcc/config/aarch64/aarch64-simd.md + operands[3] = gen_rtx_REG (<MODE>mode, regno_out[(size_t) GET_MODE_SIZE (<MODE>mode)]); + operands[4] = gen_rtx_REG (<MODE>mode, regno_in[(size_t) GET_MODE_SIZE (<MODE>mode)]); +Index: gcc/config/avr/avr.md =================================================================== ---- a/src/gcc/config/aarch64/aarch64-simd.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/aarch64/aarch64-simd.md (.../branches/gcc-4_8-branch) -@@ -21,7 +21,7 @@ - - ; Main data types used by the insntructions - --(define_attr "simd_mode" "unknown,none,V8QI,V16QI,V4HI,V8HI,V2SI,V4SI,V2DI,V2SF,V4SF,V2DF,OI,CI,XI,DI,DF,SI,HI,QI" -+(define_attr "simd_mode" "unknown,none,V8QI,V16QI,V4HI,V8HI,V2SI,V4SI,V2DI,V2SF,V4SF,V2DF,OI,CI,XI,DI,DF,SI,SF,HI,QI" - (const_string "unknown")) - - -@@ -1548,12 +1548,12 @@ - - case LTU: - case GEU: -- emit_insn (gen_aarch64_cmhs<mode> (mask, operands[4], operands[5])); -+ emit_insn (gen_aarch64_cmgeu<mode> (mask, operands[4], operands[5])); - break; - - case LEU: - case GTU: -- emit_insn (gen_aarch64_cmhi<mode> (mask, operands[4], operands[5])); -+ emit_insn (gen_aarch64_cmgtu<mode> (mask, operands[4], operands[5])); - break; - - case NE: -@@ -3034,48 +3034,181 @@ - ) - - --;; cm(eq|ge|le|lt|gt) -+;; cm(eq|ge|gt|lt|le) -+;; Note, we have constraints for Dz and Z as different expanders -+;; have different ideas of what should be passed to this pattern. - --(define_insn "aarch64_cm<cmp><mode>" -+(define_insn "aarch64_cm<optab><mode>" - [(set (match_operand:<V_cmp_result> 0 "register_operand" "=w,w") -- (unspec:<V_cmp_result> -- [(match_operand:VSDQ_I_DI 1 "register_operand" "w,w") -- (match_operand:VSDQ_I_DI 2 "aarch64_simd_reg_or_zero" "w,Z")] -- VCMP_S))] -+ (neg:<V_cmp_result> -+ (COMPARISONS:<V_cmp_result> -+ (match_operand:VDQ 1 "register_operand" "w,w") -+ (match_operand:VDQ 2 "aarch64_simd_reg_or_zero" "w,ZDz") -+ )))] - "TARGET_SIMD" - "@ -- cm<cmp>\t%<v>0<Vmtype>, %<v>1<Vmtype>, %<v>2<Vmtype> -- cm<cmp>\t%<v>0<Vmtype>, %<v>1<Vmtype>, #0" -+ cm<n_optab>\t%<v>0<Vmtype>, %<v><cmp_1><Vmtype>, %<v><cmp_2><Vmtype> -+ cm<optab>\t%<v>0<Vmtype>, %<v>1<Vmtype>, #0" - [(set_attr "simd_type" "simd_cmp") - (set_attr "simd_mode" "<MODE>")] - ) - --;; cm(hs|hi|tst) -+(define_insn_and_split "aarch64_cm<optab>di" -+ [(set (match_operand:DI 0 "register_operand" "=w,w,r") -+ (neg:DI -+ (COMPARISONS:DI -+ (match_operand:DI 1 "register_operand" "w,w,r") -+ (match_operand:DI 2 "aarch64_simd_reg_or_zero" "w,ZDz,r") -+ )))] -+ "TARGET_SIMD" -+ "@ -+ cm<n_optab>\t%d0, %d<cmp_1>, %d<cmp_2> -+ cm<optab>\t%d0, %d1, #0 -+ #" -+ "reload_completed -+ /* We need to prevent the split from -+ happening in the 'w' constraint cases. */ -+ && GP_REGNUM_P (REGNO (operands[0])) -+ && GP_REGNUM_P (REGNO (operands[1]))" -+ [(set (reg:CC CC_REGNUM) -+ (compare:CC -+ (match_dup 1) -+ (match_dup 2))) -+ (set (match_dup 0) -+ (neg:DI -+ (COMPARISONS:DI -+ (match_operand 3 "cc_register" "") -+ (const_int 0))))] -+ { -+ enum machine_mode mode = SELECT_CC_MODE (<CMP>, operands[1], operands[2]); -+ rtx cc_reg = aarch64_gen_compare_reg (<CMP>, operands[1], operands[2]); -+ rtx comparison = gen_rtx_<CMP> (mode, operands[1], operands[2]); -+ emit_insn (gen_cstoredi_neg (operands[0], comparison, cc_reg)); -+ DONE; -+ } -+ [(set_attr "simd_type" "simd_cmp") -+ (set_attr "simd_mode" "DI")] -+) - --(define_insn "aarch64_cm<cmp><mode>" -+;; cm(hs|hi) -+ -+(define_insn "aarch64_cm<optab><mode>" - [(set (match_operand:<V_cmp_result> 0 "register_operand" "=w") -- (unspec:<V_cmp_result> -- [(match_operand:VSDQ_I_DI 1 "register_operand" "w") -- (match_operand:VSDQ_I_DI 2 "register_operand" "w")] -- VCMP_U))] -+ (neg:<V_cmp_result> -+ (UCOMPARISONS:<V_cmp_result> -+ (match_operand:VDQ 1 "register_operand" "w") -+ (match_operand:VDQ 2 "register_operand" "w") -+ )))] - "TARGET_SIMD" -- "cm<cmp>\t%<v>0<Vmtype>, %<v>1<Vmtype>, %<v>2<Vmtype>" -+ "cm<n_optab>\t%<v>0<Vmtype>, %<v><cmp_1><Vmtype>, %<v><cmp_2><Vmtype>" - [(set_attr "simd_type" "simd_cmp") - (set_attr "simd_mode" "<MODE>")] - ) - --;; fcm(eq|ge|le|lt|gt) -+(define_insn_and_split "aarch64_cm<optab>di" -+ [(set (match_operand:DI 0 "register_operand" "=w,r") -+ (neg:DI -+ (UCOMPARISONS:DI -+ (match_operand:DI 1 "register_operand" "w,r") -+ (match_operand:DI 2 "aarch64_simd_reg_or_zero" "w,r") -+ )))] -+ "TARGET_SIMD" -+ "@ -+ cm<n_optab>\t%d0, %d<cmp_1>, %d<cmp_2> -+ #" -+ "reload_completed -+ /* We need to prevent the split from -+ happening in the 'w' constraint cases. */ -+ && GP_REGNUM_P (REGNO (operands[0])) -+ && GP_REGNUM_P (REGNO (operands[1]))" -+ [(set (reg:CC CC_REGNUM) -+ (compare:CC -+ (match_dup 1) -+ (match_dup 2))) -+ (set (match_dup 0) -+ (neg:DI -+ (UCOMPARISONS:DI -+ (match_operand 3 "cc_register" "") -+ (const_int 0))))] -+ { -+ enum machine_mode mode = SELECT_CC_MODE (<CMP>, operands[1], operands[2]); -+ rtx cc_reg = aarch64_gen_compare_reg (<CMP>, operands[1], operands[2]); -+ rtx comparison = gen_rtx_<CMP> (mode, operands[1], operands[2]); -+ emit_insn (gen_cstoredi_neg (operands[0], comparison, cc_reg)); -+ DONE; -+ } -+ [(set_attr "simd_type" "simd_cmp") -+ (set_attr "simd_mode" "DI")] -+) - --(define_insn "aarch64_cm<cmp><mode>" -+;; cmtst -+ -+(define_insn "aarch64_cmtst<mode>" -+ [(set (match_operand:<V_cmp_result> 0 "register_operand" "=w") -+ (neg:<V_cmp_result> -+ (ne:<V_cmp_result> -+ (and:VDQ -+ (match_operand:VDQ 1 "register_operand" "w") -+ (match_operand:VDQ 2 "register_operand" "w")) -+ (vec_duplicate:<V_cmp_result> (const_int 0)))))] -+ "TARGET_SIMD" -+ "cmtst\t%<v>0<Vmtype>, %<v>1<Vmtype>, %<v>2<Vmtype>" -+ [(set_attr "simd_type" "simd_cmp") -+ (set_attr "simd_mode" "<MODE>")] -+) -+ -+(define_insn_and_split "aarch64_cmtstdi" -+ [(set (match_operand:DI 0 "register_operand" "=w,r") -+ (neg:DI -+ (ne:DI -+ (and:DI -+ (match_operand:DI 1 "register_operand" "w,r") -+ (match_operand:DI 2 "register_operand" "w,r")) -+ (const_int 0))))] -+ "TARGET_SIMD" -+ "@ -+ cmtst\t%d0, %d1, %d2 -+ #" -+ "reload_completed -+ /* We need to prevent the split from -+ happening in the 'w' constraint cases. */ -+ && GP_REGNUM_P (REGNO (operands[0])) -+ && GP_REGNUM_P (REGNO (operands[1]))" -+ [(set (reg:CC_NZ CC_REGNUM) -+ (compare:CC_NZ -+ (and:DI (match_dup 1) -+ (match_dup 2)) -+ (const_int 0))) -+ (set (match_dup 0) -+ (neg:DI -+ (ne:DI -+ (match_operand 3 "cc_register" "") -+ (const_int 0))))] -+ { -+ rtx and_tree = gen_rtx_AND (DImode, operands[1], operands[2]); -+ enum machine_mode mode = SELECT_CC_MODE (NE, and_tree, const0_rtx); -+ rtx cc_reg = aarch64_gen_compare_reg (NE, and_tree, const0_rtx); -+ rtx comparison = gen_rtx_NE (mode, and_tree, const0_rtx); -+ emit_insn (gen_cstoredi_neg (operands[0], comparison, cc_reg)); -+ DONE; -+ } -+ [(set_attr "simd_type" "simd_cmp") -+ (set_attr "simd_mode" "DI")] -+) +--- a/src/gcc/config/avr/avr.md (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/config/avr/avr.md (.../branches/gcc-4_8-branch) +@@ -367,6 +367,15 @@ + "" + { + int i; + -+;; fcm(eq|ge|gt|le|lt) ++ // Avoid (subreg (mem)) for non-generic address spaces below. Because ++ // of the poor addressing capabilities of these spaces it's better to ++ // load them in one chunk. And it avoids PR61443. + -+(define_insn "aarch64_cm<optab><mode>" - [(set (match_operand:<V_cmp_result> 0 "register_operand" "=w,w") -- (unspec:<V_cmp_result> -- [(match_operand:VDQF 1 "register_operand" "w,w") -- (match_operand:VDQF 2 "aarch64_simd_reg_or_zero" "w,Dz")] -- VCMP_S))] -+ (neg:<V_cmp_result> -+ (COMPARISONS:<V_cmp_result> -+ (match_operand:VALLF 1 "register_operand" "w,w") -+ (match_operand:VALLF 2 "aarch64_simd_reg_or_zero" "w,YDz") -+ )))] - "TARGET_SIMD" - "@ -- fcm<cmp>\t%<v>0<Vmtype>, %<v>1<Vmtype>, %<v>2<Vmtype> -- fcm<cmp>\t%<v>0<Vmtype>, %<v>1<Vmtype>, 0" -+ fcm<n_optab>\t%<v>0<Vmtype>, %<v><cmp_1><Vmtype>, %<v><cmp_2><Vmtype> -+ fcm<optab>\t%<v>0<Vmtype>, %<v>1<Vmtype>, 0" - [(set_attr "simd_type" "simd_fcmp") - (set_attr "simd_mode" "<MODE>")] - ) -Index: gcc/config/aarch64/predicates.md -=================================================================== ---- a/src/gcc/config/aarch64/predicates.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/aarch64/predicates.md (.../branches/gcc-4_8-branch) -@@ -31,6 +31,11 @@ - (ior (match_operand 0 "register_operand") - (match_test "op == const0_rtx")))) - -+(define_predicate "aarch64_reg_or_fp_zero" -+ (and (match_code "reg,subreg,const_double") -+ (ior (match_operand 0 "register_operand") -+ (match_test "aarch64_float_const_zero_rtx_p (op)")))) ++ if (MEM_P (operands[0]) ++ && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0]))) ++ operands[0] = copy_to_mode_reg (<MODE>mode, operands[0]); + - (define_predicate "aarch64_reg_zero_or_m1_or_1" - (and (match_code "reg,subreg,const_int") - (ior (match_operand 0 "register_operand") + for (i = GET_MODE_SIZE (<MODE>mode) - 1; i >= 0; --i) + { + rtx part = simplify_gen_subreg (QImode, operands[0], <MODE>mode, i); +Index: gcc/config/avr/avr.h +=================================================================== +--- a/src/gcc/config/avr/avr.h (.../tags/gcc_4_8_3_release) ++++ b/src/gcc/config/avr/avr.h (.../branches/gcc-4_8-branch) +@@ -250,18 +250,18 @@ + #define REG_CLASS_CONTENTS { \ + {0x00000000,0x00000000}, /* NO_REGS */ \ + {0x00000001,0x00000000}, /* R0_REG */ \ +- {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ +- {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ +- {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ ++ {3u << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ ++ {3u << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ ++ {3u << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ + {0x00000000,0x00000003}, /* STACK_REG, STACK */ \ +- {(3 << REG_Y) | (3 << REG_Z), \ ++ {(3u << REG_Y) | (3u << REG_Z), \ + 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \ +- {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \ ++ {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z), \ + 0x00000000}, /* POINTER_REGS, r26 - r31 */ \ +- {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \ ++ {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z) | (3u << REG_W), \ + 0x00000000}, /* ADDW_REGS, r24 - r31 */ \ + {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \ +- {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \ ++ {(3u << REG_X)|(3u << REG_Y)|(3u << REG_Z)|(3u << REG_W)|(0xffu << 16),\ + 0x00000000}, /* LD_REGS, r16 - r31 */ \ + {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \ + {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \ Index: gcc/config/aarch64/arm_neon.h =================================================================== ---- a/src/gcc/config/aarch64/arm_neon.h (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/aarch64/arm_neon.h (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/aarch64/arm_neon.h (.../branches/gcc-4_8-branch) -@@ -19551,7 +19551,7 @@ - __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) - vcge_u8 (uint8x8_t __a, uint8x8_t __b) - { -- return (uint8x8_t) __builtin_aarch64_cmhsv8qi ((int8x8_t) __a, -+ return (uint8x8_t) __builtin_aarch64_cmgeuv8qi ((int8x8_t) __a, - (int8x8_t) __b); - } - -@@ -19558,7 +19558,7 @@ - __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) - vcge_u16 (uint16x4_t __a, uint16x4_t __b) - { -- return (uint16x4_t) __builtin_aarch64_cmhsv4hi ((int16x4_t) __a, -+ return (uint16x4_t) __builtin_aarch64_cmgeuv4hi ((int16x4_t) __a, - (int16x4_t) __b); - } - -@@ -19565,7 +19565,7 @@ - __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) - vcge_u32 (uint32x2_t __a, uint32x2_t __b) - { -- return (uint32x2_t) __builtin_aarch64_cmhsv2si ((int32x2_t) __a, -+ return (uint32x2_t) __builtin_aarch64_cmgeuv2si ((int32x2_t) __a, - (int32x2_t) __b); - } - -@@ -19572,7 +19572,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vcge_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhsdi ((int64x1_t) __a, -+ return (uint64x1_t) __builtin_aarch64_cmgeudi ((int64x1_t) __a, - (int64x1_t) __b); - } - -@@ -19603,7 +19603,7 @@ - __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) - vcgeq_u8 (uint8x16_t __a, uint8x16_t __b) - { -- return (uint8x16_t) __builtin_aarch64_cmhsv16qi ((int8x16_t) __a, -+ return (uint8x16_t) __builtin_aarch64_cmgeuv16qi ((int8x16_t) __a, - (int8x16_t) __b); - } - -@@ -19610,7 +19610,7 @@ - __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) - vcgeq_u16 (uint16x8_t __a, uint16x8_t __b) - { -- return (uint16x8_t) __builtin_aarch64_cmhsv8hi ((int16x8_t) __a, -+ return (uint16x8_t) __builtin_aarch64_cmgeuv8hi ((int16x8_t) __a, - (int16x8_t) __b); - } - -@@ -19617,7 +19617,7 @@ - __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) - vcgeq_u32 (uint32x4_t __a, uint32x4_t __b) - { -- return (uint32x4_t) __builtin_aarch64_cmhsv4si ((int32x4_t) __a, -+ return (uint32x4_t) __builtin_aarch64_cmgeuv4si ((int32x4_t) __a, - (int32x4_t) __b); - } - -@@ -19624,7 +19624,7 @@ - __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) - vcgeq_u64 (uint64x2_t __a, uint64x2_t __b) - { -- return (uint64x2_t) __builtin_aarch64_cmhsv2di ((int64x2_t) __a, -+ return (uint64x2_t) __builtin_aarch64_cmgeuv2di ((int64x2_t) __a, - (int64x2_t) __b); - } - -@@ -19637,7 +19637,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vcged_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhsdi ((int64x1_t) __a, -+ return (uint64x1_t) __builtin_aarch64_cmgeudi ((int64x1_t) __a, - (int64x1_t) __b); - } - -@@ -19676,7 +19676,7 @@ - __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) - vcgt_u8 (uint8x8_t __a, uint8x8_t __b) - { -- return (uint8x8_t) __builtin_aarch64_cmhiv8qi ((int8x8_t) __a, -+ return (uint8x8_t) __builtin_aarch64_cmgtuv8qi ((int8x8_t) __a, - (int8x8_t) __b); - } - -@@ -19683,7 +19683,7 @@ - __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) - vcgt_u16 (uint16x4_t __a, uint16x4_t __b) - { -- return (uint16x4_t) __builtin_aarch64_cmhiv4hi ((int16x4_t) __a, -+ return (uint16x4_t) __builtin_aarch64_cmgtuv4hi ((int16x4_t) __a, - (int16x4_t) __b); - } - -@@ -19690,7 +19690,7 @@ - __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) - vcgt_u32 (uint32x2_t __a, uint32x2_t __b) - { -- return (uint32x2_t) __builtin_aarch64_cmhiv2si ((int32x2_t) __a, -+ return (uint32x2_t) __builtin_aarch64_cmgtuv2si ((int32x2_t) __a, - (int32x2_t) __b); - } - -@@ -19697,7 +19697,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vcgt_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhidi ((int64x1_t) __a, -+ return (uint64x1_t) __builtin_aarch64_cmgtudi ((int64x1_t) __a, - (int64x1_t) __b); - } - -@@ -19728,7 +19728,7 @@ - __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) - vcgtq_u8 (uint8x16_t __a, uint8x16_t __b) - { -- return (uint8x16_t) __builtin_aarch64_cmhiv16qi ((int8x16_t) __a, -+ return (uint8x16_t) __builtin_aarch64_cmgtuv16qi ((int8x16_t) __a, - (int8x16_t) __b); - } - -@@ -19735,7 +19735,7 @@ - __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) - vcgtq_u16 (uint16x8_t __a, uint16x8_t __b) - { -- return (uint16x8_t) __builtin_aarch64_cmhiv8hi ((int16x8_t) __a, -+ return (uint16x8_t) __builtin_aarch64_cmgtuv8hi ((int16x8_t) __a, - (int16x8_t) __b); - } - -@@ -19742,7 +19742,7 @@ - __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) - vcgtq_u32 (uint32x4_t __a, uint32x4_t __b) - { -- return (uint32x4_t) __builtin_aarch64_cmhiv4si ((int32x4_t) __a, -+ return (uint32x4_t) __builtin_aarch64_cmgtuv4si ((int32x4_t) __a, - (int32x4_t) __b); - } - -@@ -19749,7 +19749,7 @@ - __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) - vcgtq_u64 (uint64x2_t __a, uint64x2_t __b) - { -- return (uint64x2_t) __builtin_aarch64_cmhiv2di ((int64x2_t) __a, -+ return (uint64x2_t) __builtin_aarch64_cmgtuv2di ((int64x2_t) __a, - (int64x2_t) __b); - } - -@@ -19762,7 +19762,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vcgtd_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhidi ((int64x1_t) __a, -+ return (uint64x1_t) __builtin_aarch64_cmgtudi ((int64x1_t) __a, - (int64x1_t) __b); - } - -@@ -19801,7 +19801,7 @@ - __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) - vcle_u8 (uint8x8_t __a, uint8x8_t __b) - { -- return (uint8x8_t) __builtin_aarch64_cmhsv8qi ((int8x8_t) __b, -+ return (uint8x8_t) __builtin_aarch64_cmgeuv8qi ((int8x8_t) __b, - (int8x8_t) __a); - } - -@@ -19808,7 +19808,7 @@ - __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) - vcle_u16 (uint16x4_t __a, uint16x4_t __b) - { -- return (uint16x4_t) __builtin_aarch64_cmhsv4hi ((int16x4_t) __b, -+ return (uint16x4_t) __builtin_aarch64_cmgeuv4hi ((int16x4_t) __b, - (int16x4_t) __a); - } - -@@ -19815,7 +19815,7 @@ - __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) - vcle_u32 (uint32x2_t __a, uint32x2_t __b) - { -- return (uint32x2_t) __builtin_aarch64_cmhsv2si ((int32x2_t) __b, -+ return (uint32x2_t) __builtin_aarch64_cmgeuv2si ((int32x2_t) __b, - (int32x2_t) __a); - } - -@@ -19822,7 +19822,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vcle_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhsdi ((int64x1_t) __b, -+ return (uint64x1_t) __builtin_aarch64_cmgeudi ((int64x1_t) __b, - (int64x1_t) __a); - } - -@@ -19853,7 +19853,7 @@ - __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) - vcleq_u8 (uint8x16_t __a, uint8x16_t __b) - { -- return (uint8x16_t) __builtin_aarch64_cmhsv16qi ((int8x16_t) __b, -+ return (uint8x16_t) __builtin_aarch64_cmgeuv16qi ((int8x16_t) __b, - (int8x16_t) __a); - } - -@@ -19860,7 +19860,7 @@ - __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) - vcleq_u16 (uint16x8_t __a, uint16x8_t __b) - { -- return (uint16x8_t) __builtin_aarch64_cmhsv8hi ((int16x8_t) __b, -+ return (uint16x8_t) __builtin_aarch64_cmgeuv8hi ((int16x8_t) __b, - (int16x8_t) __a); - } - -@@ -19867,7 +19867,7 @@ - __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) - vcleq_u32 (uint32x4_t __a, uint32x4_t __b) - { -- return (uint32x4_t) __builtin_aarch64_cmhsv4si ((int32x4_t) __b, -+ return (uint32x4_t) __builtin_aarch64_cmgeuv4si ((int32x4_t) __b, - (int32x4_t) __a); - } - -@@ -19874,7 +19874,7 @@ - __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) - vcleq_u64 (uint64x2_t __a, uint64x2_t __b) - { -- return (uint64x2_t) __builtin_aarch64_cmhsv2di ((int64x2_t) __b, -+ return (uint64x2_t) __builtin_aarch64_cmgeuv2di ((int64x2_t) __b, - (int64x2_t) __a); - } - -@@ -19919,7 +19919,7 @@ - __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) - vclt_u8 (uint8x8_t __a, uint8x8_t __b) - { -- return (uint8x8_t) __builtin_aarch64_cmhiv8qi ((int8x8_t) __b, -+ return (uint8x8_t) __builtin_aarch64_cmgtuv8qi ((int8x8_t) __b, - (int8x8_t) __a); - } - -@@ -19926,7 +19926,7 @@ - __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) - vclt_u16 (uint16x4_t __a, uint16x4_t __b) - { -- return (uint16x4_t) __builtin_aarch64_cmhiv4hi ((int16x4_t) __b, -+ return (uint16x4_t) __builtin_aarch64_cmgtuv4hi ((int16x4_t) __b, - (int16x4_t) __a); - } - -@@ -19933,7 +19933,7 @@ - __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) - vclt_u32 (uint32x2_t __a, uint32x2_t __b) - { -- return (uint32x2_t) __builtin_aarch64_cmhiv2si ((int32x2_t) __b, -+ return (uint32x2_t) __builtin_aarch64_cmgtuv2si ((int32x2_t) __b, - (int32x2_t) __a); - } - -@@ -19940,7 +19940,7 @@ - __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) - vclt_u64 (uint64x1_t __a, uint64x1_t __b) - { -- return (uint64x1_t) __builtin_aarch64_cmhidi ((int64x1_t) __b, -+ return (uint64x1_t) __builtin_aarch64_cmgtudi ((int64x1_t) __b, - (int64x1_t) __a); - } - -@@ -19971,7 +19971,7 @@ - __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) - vcltq_u8 (uint8x16_t __a, uint8x16_t __b) - { -- return (uint8x16_t) __builtin_aarch64_cmhiv16qi ((int8x16_t) __b, -+ return (uint8x16_t) __builtin_aarch64_cmgtuv16qi ((int8x16_t) __b, - (int8x16_t) __a); - } - -@@ -19978,7 +19978,7 @@ - __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) - vcltq_u16 (uint16x8_t __a, uint16x8_t __b) - { -- return (uint16x8_t) __builtin_aarch64_cmhiv8hi ((int16x8_t) __b, -+ return (uint16x8_t) __builtin_aarch64_cmgtuv8hi ((int16x8_t) __b, - (int16x8_t) __a); - } - -@@ -19985,7 +19985,7 @@ - __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) - vcltq_u32 (uint32x4_t __a, uint32x4_t __b) - { -- return (uint32x4_t) __builtin_aarch64_cmhiv4si ((int32x4_t) __b, -+ return (uint32x4_t) __builtin_aarch64_cmgtuv4si ((int32x4_t) __b, - (int32x4_t) __a); +@@ -13815,7 +13815,7 @@ + int16x4_t result; + __asm__ ("sqdmulh %0.4h,%1.4h,%2.h[0]" + : "=w"(result) +- : "w"(a), "w"(b) ++ : "w"(a), "x"(b) + : /* No clobbers */); + return result; } - -@@ -19992,7 +19992,7 @@ - __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) - vcltq_u64 (uint64x2_t __a, uint64x2_t __b) - { -- return (uint64x2_t) __builtin_aarch64_cmhiv2di ((int64x2_t) __b, -+ return (uint64x2_t) __builtin_aarch64_cmgtuv2di ((int64x2_t) __b, - (int64x2_t) __a); +@@ -13837,7 +13837,7 @@ + int16x8_t result; + __asm__ ("sqdmulh %0.8h,%1.8h,%2.h[0]" + : "=w"(result) +- : "w"(a), "w"(b) ++ : "w"(a), "x"(b) + : /* No clobbers */); + return result; } - Index: gcc/config/aarch64/aarch64.md =================================================================== ---- a/src/gcc/config/aarch64/aarch64.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/aarch64/aarch64.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/aarch64/aarch64.md (.../branches/gcc-4_8-branch) -@@ -2211,7 +2211,7 @@ - (set_attr "mode" "SI")] - ) - --(define_insn "*cstore<mode>_neg" -+(define_insn "cstore<mode>_neg" - [(set (match_operand:ALLI 0 "register_operand" "=r") - (neg:ALLI (match_operator:ALLI 1 "aarch64_comparison_operator" - [(match_operand 2 "cc_register" "") (const_int 0)])))] -Index: gcc/config/aarch64/aarch64-simd-builtins.def -=================================================================== ---- a/src/gcc/config/aarch64/aarch64-simd-builtins.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/aarch64/aarch64-simd-builtins.def (.../branches/gcc-4_8-branch) -@@ -217,8 +217,8 @@ - BUILTIN_VSDQ_I_DI (BINOP, cmle) - BUILTIN_VSDQ_I_DI (BINOP, cmlt) - /* Implemented by aarch64_cm<cmp><mode>. */ -- BUILTIN_VSDQ_I_DI (BINOP, cmhs) -- BUILTIN_VSDQ_I_DI (BINOP, cmhi) -+ BUILTIN_VSDQ_I_DI (BINOP, cmgeu) -+ BUILTIN_VSDQ_I_DI (BINOP, cmgtu) - BUILTIN_VSDQ_I_DI (BINOP, cmtst) - - /* Implemented by aarch64_<fmaxmin><mode>. */ +@@ -3292,6 +3292,7 @@ + (unspec:DI [(match_operand:DI 0 "aarch64_valid_symref" "S")] + UNSPEC_TLSDESC)) + (clobber (reg:DI LR_REGNUM)) ++ (clobber (reg:CC CC_REGNUM)) + (clobber (match_scratch:DI 1 "=r"))] + "TARGET_TLS_DESC" + "adrp\\tx0, %A0\;ldr\\t%1, [x0, #%L0]\;add\\tx0, x0, %L0\;.tlsdesccall\\t%0\;blr\\t%1" Index: gcc/config/aarch64/aarch64.c =================================================================== ---- a/src/gcc/config/aarch64/aarch64.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/aarch64/aarch64.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/aarch64/aarch64.c (.../branches/gcc-4_8-branch) -@@ -2274,7 +2274,7 @@ - if (ncount < zcount) - { - emit_move_insn (gen_rtx_REG (Pmode, regnum), -- GEN_INT ((~val) & 0xffff)); -+ GEN_INT (val | ~(HOST_WIDE_INT) 0xffff)); - tval = 0xffff; - } - else -Index: gcc/config/aarch64/iterators.md -=================================================================== ---- a/src/gcc/config/aarch64/iterators.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/aarch64/iterators.md (.../branches/gcc-4_8-branch) -@@ -83,6 +83,9 @@ - ;; Vector Float modes. - (define_mode_iterator VDQF [V2SF V4SF V2DF]) - -+;; All Float modes. -+(define_mode_iterator VALLF [V2SF V4SF V2DF SF DF]) -+ - ;; Vector Float modes with 2 elements. - (define_mode_iterator V2F [V2SF V2DF]) - -@@ -213,13 +216,6 @@ - UNSPEC_URSHL ; Used in aarch64-simd.md. - UNSPEC_SQRSHL ; Used in aarch64-simd.md. - UNSPEC_UQRSHL ; Used in aarch64-simd.md. -- UNSPEC_CMEQ ; Used in aarch64-simd.md. -- UNSPEC_CMLE ; Used in aarch64-simd.md. -- UNSPEC_CMLT ; Used in aarch64-simd.md. -- UNSPEC_CMGE ; Used in aarch64-simd.md. -- UNSPEC_CMGT ; Used in aarch64-simd.md. -- UNSPEC_CMHS ; Used in aarch64-simd.md. -- UNSPEC_CMHI ; Used in aarch64-simd.md. - UNSPEC_SSLI ; Used in aarch64-simd.md. - UNSPEC_USLI ; Used in aarch64-simd.md. - UNSPEC_SSRI ; Used in aarch64-simd.md. -@@ -227,7 +223,6 @@ - UNSPEC_SSHLL ; Used in aarch64-simd.md. - UNSPEC_USHLL ; Used in aarch64-simd.md. - UNSPEC_ADDP ; Used in aarch64-simd.md. -- UNSPEC_CMTST ; Used in aarch64-simd.md. - UNSPEC_FMAX ; Used in aarch64-simd.md. - UNSPEC_FMIN ; Used in aarch64-simd.md. - UNSPEC_BSL ; Used in aarch64-simd.md. -@@ -251,6 +246,7 @@ - - ;; For scalar usage of vector/FP registers - (define_mode_attr v [(QI "b") (HI "h") (SI "s") (DI "d") -+ (SF "s") (DF "d") - (V8QI "") (V16QI "") - (V4HI "") (V8HI "") - (V2SI "") (V4SI "") -@@ -305,7 +301,8 @@ - (V4SF ".4s") (V2DF ".2d") - (DI "") (SI "") - (HI "") (QI "") -- (TI "")]) -+ (TI "") (SF "") -+ (DF "")]) - - ;; Register suffix narrowed modes for VQN. - (define_mode_attr Vmntype [(V8HI ".8b") (V4SI ".4h") -@@ -444,7 +441,8 @@ - (V2SI "V2SI") (V4SI "V4SI") - (DI "DI") (V2DI "V2DI") - (V2SF "V2SI") (V4SF "V4SI") -- (V2DF "V2DI")]) -+ (V2DF "V2DI") (DF "DI") -+ (SF "SI")]) - - ;; Lower case mode of results of comparison operations. - (define_mode_attr v_cmp_result [(V8QI "v8qi") (V16QI "v16qi") -@@ -452,7 +450,8 @@ - (V2SI "v2si") (V4SI "v4si") - (DI "di") (V2DI "v2di") - (V2SF "v2si") (V4SF "v4si") -- (V2DF "v2di")]) -+ (V2DF "v2di") (DF "di") -+ (SF "si")]) - - ;; Vm for lane instructions is restricted to FP_LO_REGS. - (define_mode_attr vwx [(V4HI "x") (V8HI "x") (HI "x") -@@ -543,6 +542,12 @@ - ;; Code iterator for signed variants of vector saturating binary ops. - (define_code_iterator SBINQOPS [ss_plus ss_minus]) - -+;; Comparison operators for <F>CM. -+(define_code_iterator COMPARISONS [lt le eq ge gt]) -+ -+;; Unsigned comparison operators. -+(define_code_iterator UCOMPARISONS [ltu leu geu gtu]) -+ - ;; ------------------------------------------------------------------- - ;; Code Attributes - ;; ------------------------------------------------------------------- -@@ -571,8 +576,29 @@ - (eq "eq") - (ne "ne") - (lt "lt") -- (ge "ge")]) -+ (ge "ge") -+ (le "le") -+ (gt "gt") -+ (ltu "ltu") -+ (leu "leu") -+ (geu "geu") -+ (gtu "gtu")]) - -+;; For comparison operators we use the FCM* and CM* instructions. -+;; As there are no CMLE or CMLT instructions which act on 3 vector -+;; operands, we must use CMGE or CMGT and swap the order of the -+;; source operands. -+ -+(define_code_attr n_optab [(lt "gt") (le "ge") (eq "eq") (ge "ge") (gt "gt") -+ (ltu "hi") (leu "hs") (geu "hs") (gtu "hi")]) -+(define_code_attr cmp_1 [(lt "2") (le "2") (eq "1") (ge "1") (gt "1") -+ (ltu "2") (leu "2") (geu "1") (gtu "1")]) -+(define_code_attr cmp_2 [(lt "1") (le "1") (eq "2") (ge "2") (gt "2") -+ (ltu "1") (leu "1") (geu "2") (gtu "2")]) -+ -+(define_code_attr CMP [(lt "LT") (le "LE") (eq "EQ") (ge "GE") (gt "GT") -+ (ltu "LTU") (leu "LEU") (geu "GEU") (gtu "GTU")]) -+ - ;; Optab prefix for sign/zero-extending operations - (define_code_attr su_optab [(sign_extend "") (zero_extend "u") - (div "") (udiv "u") -@@ -680,11 +706,6 @@ - UNSPEC_SQSHRN UNSPEC_UQSHRN - UNSPEC_SQRSHRN UNSPEC_UQRSHRN]) - --(define_int_iterator VCMP_S [UNSPEC_CMEQ UNSPEC_CMGE UNSPEC_CMGT -- UNSPEC_CMLE UNSPEC_CMLT]) -- --(define_int_iterator VCMP_U [UNSPEC_CMHS UNSPEC_CMHI UNSPEC_CMTST]) -- - (define_int_iterator PERMUTE [UNSPEC_ZIP1 UNSPEC_ZIP2 - UNSPEC_TRN1 UNSPEC_TRN2 - UNSPEC_UZP1 UNSPEC_UZP2]) -@@ -768,12 +789,6 @@ - (UNSPEC_RADDHN2 "add") - (UNSPEC_RSUBHN2 "sub")]) - --(define_int_attr cmp [(UNSPEC_CMGE "ge") (UNSPEC_CMGT "gt") -- (UNSPEC_CMLE "le") (UNSPEC_CMLT "lt") -- (UNSPEC_CMEQ "eq") -- (UNSPEC_CMHS "hs") (UNSPEC_CMHI "hi") -- (UNSPEC_CMTST "tst")]) -- - (define_int_attr offsetlr [(UNSPEC_SSLI "1") (UNSPEC_USLI "1") - (UNSPEC_SSRI "0") (UNSPEC_USRI "0")]) - -Index: gcc/config/rs6000/power8.md -=================================================================== ---- a/src/gcc/config/rs6000/power8.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/power8.md (.../branches/gcc-4_8-branch) -@@ -0,0 +1,373 @@ -+;; Scheduling description for IBM POWER8 processor. -+;; Copyright (C) 2013 Free Software Foundation, Inc. -+;; -+;; Contributed by Pat Haugen (pthaugen@us.ibm.com). -+ -+;; This file is part of GCC. -+;; -+;; GCC is free software; you can redistribute it and/or modify it -+;; under the terms of the GNU General Public License as published -+;; by the Free Software Foundation; either version 3, or (at your -+;; option) any later version. -+;; -+;; GCC is distributed in the hope that it will be useful, but WITHOUT -+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -+;; License for more details. -+;; -+;; You should have received a copy of the GNU General Public License -+;; along with GCC; see the file COPYING3. If not see -+;; <http://www.gnu.org/licenses/>. -+ -+(define_automaton "power8fxu,power8lsu,power8vsu,power8misc") -+ -+(define_cpu_unit "fxu0_power8,fxu1_power8" "power8fxu") -+(define_cpu_unit "lu0_power8,lu1_power8" "power8lsu") -+(define_cpu_unit "lsu0_power8,lsu1_power8" "power8lsu") -+(define_cpu_unit "vsu0_power8,vsu1_power8" "power8vsu") -+(define_cpu_unit "bpu_power8,cru_power8" "power8misc") -+(define_cpu_unit "du0_power8,du1_power8,du2_power8,du3_power8,du4_power8,\ -+ du5_power8,du6_power8" "power8misc") -+ -+ -+; Dispatch group reservations -+(define_reservation "DU_any_power8" -+ "du0_power8|du1_power8|du2_power8|du3_power8|du4_power8|\ -+ du5_power8") -+ -+; 2-way Cracked instructions go in slots 0-1 -+; (can also have a second in slots 3-4 if insns are adjacent) -+(define_reservation "DU_cracked_power8" -+ "du0_power8+du1_power8") -+ -+; Insns that are first in group -+(define_reservation "DU_first_power8" -+ "du0_power8") -+ -+; Insns that are first and last in group -+(define_reservation "DU_both_power8" -+ "du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+\ -+ du5_power8+du6_power8") -+ -+; Dispatch slots are allocated in order conforming to program order. -+(absence_set "du0_power8" "du1_power8,du2_power8,du3_power8,du4_power8,\ -+ du5_power8,du6_power8") -+(absence_set "du1_power8" "du2_power8,du3_power8,du4_power8,du5_power8,\ -+ du6_power8") -+(absence_set "du2_power8" "du3_power8,du4_power8,du5_power8,du6_power8") -+(absence_set "du3_power8" "du4_power8,du5_power8,du6_power8") -+(absence_set "du4_power8" "du5_power8,du6_power8") -+(absence_set "du5_power8" "du6_power8") -+ -+ -+; Execution unit reservations -+(define_reservation "FXU_power8" -+ "fxu0_power8|fxu1_power8") -+ -+(define_reservation "LU_power8" -+ "lu0_power8|lu1_power8") -+ -+(define_reservation "LSU_power8" -+ "lsu0_power8|lsu1_power8") -+ -+(define_reservation "LU_or_LSU_power8" -+ "lu0_power8|lu1_power8|lsu0_power8|lsu1_power8") -+ -+(define_reservation "VSU_power8" -+ "vsu0_power8|vsu1_power8") -+ -+ -+; LS Unit -+(define_insn_reservation "power8-load" 3 -+ (and (eq_attr "type" "load") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,LU_or_LSU_power8") -+ -+(define_insn_reservation "power8-load-update" 3 -+ (and (eq_attr "type" "load_u,load_ux") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,LU_or_LSU_power8+FXU_power8") -+ -+(define_insn_reservation "power8-load-ext" 3 -+ (and (eq_attr "type" "load_ext") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,LU_or_LSU_power8,FXU_power8") -+ -+(define_insn_reservation "power8-load-ext-update" 3 -+ (and (eq_attr "type" "load_ext_u,load_ext_ux") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,LU_or_LSU_power8+FXU_power8,FXU_power8") -+ -+(define_insn_reservation "power8-fpload" 5 -+ (and (eq_attr "type" "fpload,vecload") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,LU_power8") -+ -+(define_insn_reservation "power8-fpload-update" 5 -+ (and (eq_attr "type" "fpload_u,fpload_ux") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,LU_power8+FXU_power8") -+ -+(define_insn_reservation "power8-store" 5 ; store-forwarding latency -+ (and (eq_attr "type" "store,store_u") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,LSU_power8+LU_power8") -+ -+(define_insn_reservation "power8-store-update-indexed" 5 -+ (and (eq_attr "type" "store_ux") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,LSU_power8+LU_power8") -+ -+(define_insn_reservation "power8-fpstore" 5 -+ (and (eq_attr "type" "fpstore") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,LSU_power8+VSU_power8") -+ -+(define_insn_reservation "power8-fpstore-update" 5 -+ (and (eq_attr "type" "fpstore_u,fpstore_ux") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,LSU_power8+VSU_power8") -+ -+(define_insn_reservation "power8-vecstore" 5 -+ (and (eq_attr "type" "vecstore") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,LSU_power8+VSU_power8") -+ -+(define_insn_reservation "power8-larx" 3 -+ (and (eq_attr "type" "load_l") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,LU_or_LSU_power8") -+ -+(define_insn_reservation "power8-stcx" 10 -+ (and (eq_attr "type" "store_c") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,LSU_power8+LU_power8") -+ -+(define_insn_reservation "power8-sync" 1 -+ (and (eq_attr "type" "sync,isync") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,LSU_power8") -+ -+ -+; FX Unit -+(define_insn_reservation "power8-1cyc" 1 -+ (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\ -+ var_shift_rotate,exts,isel") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,FXU_power8") -+ -+; Extra cycle to LU/LSU -+(define_bypass 2 "power8-1cyc" -+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\ -+ power8-vecstore,power8-larx,power8-stcx") -+; "power8-load,power8-load-update,power8-load-ext,\ -+; power8-load-ext-update,power8-fpload,power8-fpload-update,\ -+; power8-store,power8-store-update,power8-store-update-indexed,\ -+; power8-fpstore,power8-fpstore-update,power8-vecstore,\ -+; power8-larx,power8-stcx") -+ -+(define_insn_reservation "power8-2cyc" 2 -+ (and (eq_attr "type" "cntlz,popcnt") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,FXU_power8") -+ -+(define_insn_reservation "power8-two" 2 -+ (and (eq_attr "type" "two") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8+DU_any_power8,FXU_power8,FXU_power8") -+ -+(define_insn_reservation "power8-three" 3 -+ (and (eq_attr "type" "three") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8+DU_any_power8+DU_any_power8,FXU_power8,FXU_power8,FXU_power8") -+ -+; cmp - Normal compare insns -+(define_insn_reservation "power8-cmp" 2 -+ (and (eq_attr "type" "cmp") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,FXU_power8") -+ -+; fast_compare : add./and./nor./etc -+(define_insn_reservation "power8-fast-compare" 2 -+ (and (eq_attr "type" "fast_compare") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,FXU_power8") -+ -+; compare : rldicl./exts./etc -+; delayed_compare : rlwinm./slwi./etc -+; var_delayed_compare : rlwnm./slw./etc -+(define_insn_reservation "power8-compare" 2 -+ (and (eq_attr "type" "compare,delayed_compare,var_delayed_compare") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,FXU_power8,FXU_power8") -+ -+; Extra cycle to LU/LSU -+(define_bypass 3 "power8-fast-compare,power8-compare" -+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\ -+ power8-vecstore,power8-larx,power8-stcx") -+ -+; 5 cycle CR latency -+(define_bypass 5 "power8-fast-compare,power8-compare" -+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch") -+ -+(define_insn_reservation "power8-mul" 4 -+ (and (eq_attr "type" "imul,imul2,imul3,lmul") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,FXU_power8") -+ -+(define_insn_reservation "power8-mul-compare" 4 -+ (and (eq_attr "type" "imul_compare,lmul_compare") -+ (eq_attr "cpu" "power8")) -+ "DU_cracked_power8,FXU_power8") -+ -+; Extra cycle to LU/LSU -+(define_bypass 5 "power8-mul,power8-mul-compare" -+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\ -+ power8-vecstore,power8-larx,power8-stcx") -+ -+; 7 cycle CR latency -+(define_bypass 7 "power8-mul,power8-mul-compare" -+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch") -+ -+; FXU divides are not pipelined -+(define_insn_reservation "power8-idiv" 37 -+ (and (eq_attr "type" "idiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,fxu0_power8*37|fxu1_power8*37") -+ -+(define_insn_reservation "power8-ldiv" 68 -+ (and (eq_attr "type" "ldiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,fxu0_power8*68|fxu1_power8*68") -+ -+(define_insn_reservation "power8-mtjmpr" 5 -+ (and (eq_attr "type" "mtjmpr") -+ (eq_attr "cpu" "power8")) -+ "DU_first_power8,FXU_power8") -+ -+; Should differentiate between 1 cr field and > 1 since mtocrf is not microcode -+(define_insn_reservation "power8-mtcr" 3 -+ (and (eq_attr "type" "mtcr") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,FXU_power8") -+ -+ -+; CR Unit -+(define_insn_reservation "power8-mfjmpr" 5 -+ (and (eq_attr "type" "mfjmpr") -+ (eq_attr "cpu" "power8")) -+ "DU_first_power8,cru_power8+FXU_power8") -+ -+(define_insn_reservation "power8-crlogical" 3 -+ (and (eq_attr "type" "cr_logical,delayed_cr") -+ (eq_attr "cpu" "power8")) -+ "DU_first_power8,cru_power8") -+ -+(define_insn_reservation "power8-mfcr" 5 -+ (and (eq_attr "type" "mfcr") -+ (eq_attr "cpu" "power8")) -+ "DU_both_power8,cru_power8") -+ -+(define_insn_reservation "power8-mfcrf" 3 -+ (and (eq_attr "type" "mfcrf") -+ (eq_attr "cpu" "power8")) -+ "DU_first_power8,cru_power8") -+ -+ -+; BR Unit -+; Branches take dispatch slot 7, but reserve any remaining prior slots to -+; prevent other insns from grabbing them once this is assigned. -+(define_insn_reservation "power8-branch" 3 -+ (and (eq_attr "type" "jmpreg,branch") -+ (eq_attr "cpu" "power8")) -+ "(du6_power8\ -+ |du5_power8+du6_power8\ -+ |du4_power8+du5_power8+du6_power8\ -+ |du3_power8+du4_power8+du5_power8+du6_power8\ -+ |du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\ -+ |du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\ -+ |du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+\ -+ du6_power8),bpu_power8") -+ -+; Branch updating LR/CTR feeding mf[lr|ctr] -+(define_bypass 4 "power8-branch" "power8-mfjmpr") -+ -+ -+; VS Unit (includes FP/VSX/VMX/DFP/Crypto) -+(define_insn_reservation "power8-fp" 6 -+ (and (eq_attr "type" "fp,dmul") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+; Additional 3 cycles for any CR result -+(define_bypass 9 "power8-fp" "power8-crlogical,power8-mfcr*,power8-branch") -+ -+(define_insn_reservation "power8-fpcompare" 8 -+ (and (eq_attr "type" "fpcompare") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-sdiv" 27 -+ (and (eq_attr "type" "sdiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-ddiv" 33 -+ (and (eq_attr "type" "ddiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-sqrt" 32 -+ (and (eq_attr "type" "ssqrt") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-dsqrt" 44 -+ (and (eq_attr "type" "dsqrt") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-vecsimple" 2 -+ (and (eq_attr "type" "vecperm,vecsimple,veccmp") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-vecnormal" 6 -+ (and (eq_attr "type" "vecfloat,vecdouble") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_bypass 7 "power8-vecnormal" -+ "power8-vecsimple,power8-veccomplex,power8-fpstore*,\ -+ power8-vecstore") -+ -+(define_insn_reservation "power8-veccomplex" 7 -+ (and (eq_attr "type" "veccomplex") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-vecfdiv" 25 -+ (and (eq_attr "type" "vecfdiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-vecdiv" 31 -+ (and (eq_attr "type" "vecdiv") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-mffgpr" 5 -+ (and (eq_attr "type" "mffgpr") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-mftgpr" 6 -+ (and (eq_attr "type" "mftgpr") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -+(define_insn_reservation "power8-crypto" 7 -+ (and (eq_attr "type" "crypto") -+ (eq_attr "cpu" "power8")) -+ "DU_any_power8,VSU_power8") -+ -Index: gcc/config/rs6000/vector.md -=================================================================== ---- a/src/gcc/config/rs6000/vector.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/vector.md (.../branches/gcc-4_8-branch) -@@ -24,28 +24,28 @@ - - - ;; Vector int modes --(define_mode_iterator VEC_I [V16QI V8HI V4SI]) -+(define_mode_iterator VEC_I [V16QI V8HI V4SI V2DI]) - - ;; Vector float modes - (define_mode_iterator VEC_F [V4SF V2DF]) - - ;; Vector arithmetic modes --(define_mode_iterator VEC_A [V16QI V8HI V4SI V4SF V2DF]) -+(define_mode_iterator VEC_A [V16QI V8HI V4SI V2DI V4SF V2DF]) - - ;; Vector modes that need alginment via permutes - (define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF]) - - ;; Vector logical modes --(define_mode_iterator VEC_L [V16QI V8HI V4SI V2DI V4SF V2DF TI]) -+(define_mode_iterator VEC_L [V16QI V8HI V4SI V2DI V4SF V2DF V1TI TI]) - - ;; Vector modes for moves. Don't do TImode here. --(define_mode_iterator VEC_M [V16QI V8HI V4SI V2DI V4SF V2DF]) -+(define_mode_iterator VEC_M [V16QI V8HI V4SI V2DI V4SF V2DF V1TI]) - - ;; Vector modes for types that don't need a realignment under VSX --(define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF]) -+(define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF V1TI]) - - ;; Vector comparison modes --(define_mode_iterator VEC_C [V16QI V8HI V4SI V4SF V2DF]) -+(define_mode_iterator VEC_C [V16QI V8HI V4SI V2DI V4SF V2DF]) - - ;; Vector init/extract modes - (define_mode_iterator VEC_E [V16QI V8HI V4SI V2DI V4SF V2DF]) -@@ -54,7 +54,8 @@ - (define_mode_iterator VEC_64 [V2DI V2DF]) - - ;; Vector reload iterator --(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF DF TI]) -+(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF V1TI -+ SF SD SI DF DD DI TI]) - - ;; Base type from vector mode - (define_mode_attr VEC_base [(V16QI "QI") -@@ -63,6 +64,7 @@ - (V2DI "DI") - (V4SF "SF") - (V2DF "DF") -+ (V1TI "TI") - (TI "TI")]) - - ;; Same size integer type for floating point data -@@ -88,7 +90,8 @@ - (smax "smax")]) - - --;; Vector move instructions. -+;; Vector move instructions. Little-endian VSX loads and stores require -+;; special handling to circumvent "element endianness." - (define_expand "mov<mode>" - [(set (match_operand:VEC_M 0 "nonimmediate_operand" "") - (match_operand:VEC_M 1 "any_operand" ""))] -@@ -104,6 +107,15 @@ - && !vlogical_operand (operands[1], <MODE>mode)) - operands[1] = force_reg (<MODE>mode, operands[1]); - } -+ if (!BYTES_BIG_ENDIAN -+ && VECTOR_MEM_VSX_P (<MODE>mode) -+ && !gpr_or_gpr_p (operands[0], operands[1]) -+ && (memory_operand (operands[0], <MODE>mode) -+ ^ memory_operand (operands[1], <MODE>mode))) -+ { -+ rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode); -+ DONE; -+ } - }) - - ;; Generic vector floating point load/store instructions. These will match -@@ -126,7 +138,9 @@ - (match_operand:VEC_L 1 "input_operand" ""))] - "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode) - && reload_completed -- && gpr_or_gpr_p (operands[0], operands[1])" -+ && gpr_or_gpr_p (operands[0], operands[1]) -+ && !direct_move_p (operands[0], operands[1]) -+ && !quad_load_store_p (operands[0], operands[1])" - [(pc)] - { - rs6000_split_multireg_move (operands[0], operands[1]); -@@ -249,7 +263,7 @@ - [(set (match_operand:VEC_F 0 "vfloat_operand" "") - (mult:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "") - (match_operand:VEC_F 2 "vfloat_operand" "")))] -- "VECTOR_UNIT_VSX_P (<MODE>mode) || VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - { - if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode)) - { -@@ -395,7 +409,7 @@ - (match_operand:VEC_I 5 "vint_operand" "")]) - (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - " - { - if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2], -@@ -451,7 +465,7 @@ - (match_operand:VEC_I 5 "vint_operand" "")]) - (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - " - { - if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2], -@@ -505,7 +519,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (gtu:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - (define_expand "vector_geu<mode>" -@@ -512,7 +526,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (geu:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - (define_insn_and_split "*vector_uneq<mode>" -@@ -595,8 +609,8 @@ - (ge:VEC_F (match_dup 2) - (match_dup 1))) - (set (match_dup 0) -- (not:VEC_F (ior:VEC_F (match_dup 3) -- (match_dup 4))))] -+ (and:VEC_F (not:VEC_F (match_dup 3)) -+ (not:VEC_F (match_dup 4))))] - " - { - operands[3] = gen_reg_rtx (<MODE>mode); -@@ -708,48 +722,19 @@ - "") - - --;; Vector logical instructions --(define_expand "xor<mode>3" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (xor:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "") -- (match_operand:VEC_L 2 "vlogical_operand" "")))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -+;; Vector count leading zeros -+(define_expand "clz<mode>2" -+ [(set (match_operand:VEC_I 0 "register_operand" "") -+ (clz:VEC_I (match_operand:VEC_I 1 "register_operand" "")))] -+ "TARGET_P8_VECTOR") - --(define_expand "ior<mode>3" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "") -- (match_operand:VEC_L 2 "vlogical_operand" "")))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -+;; Vector population count -+(define_expand "popcount<mode>2" -+ [(set (match_operand:VEC_I 0 "register_operand" "") -+ (popcount:VEC_I (match_operand:VEC_I 1 "register_operand" "")))] -+ "TARGET_P8_VECTOR") - --(define_expand "and<mode>3" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (and:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "") -- (match_operand:VEC_L 2 "vlogical_operand" "")))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -- --(define_expand "one_cmpl<mode>2" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (not:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -- --(define_expand "nor<mode>3" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (not:VEC_L (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "") -- (match_operand:VEC_L 2 "vlogical_operand" ""))))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -- --(define_expand "andc<mode>3" -- [(set (match_operand:VEC_L 0 "vlogical_operand" "") -- (and:VEC_L (not:VEC_L (match_operand:VEC_L 2 "vlogical_operand" "")) -- (match_operand:VEC_L 1 "vlogical_operand" "")))] -- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" -- "") -- -+ - ;; Same size conversions - (define_expand "float<VEC_int><mode>2" - [(set (match_operand:VEC_F 0 "vfloat_operand" "") -@@ -889,7 +874,7 @@ - { - rtx reg = gen_reg_rtx (V4SFmode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], true); -+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvspdp (operands[0], reg)); - DONE; - }) -@@ -901,7 +886,7 @@ - { - rtx reg = gen_reg_rtx (V4SFmode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], false); -+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvspdp (operands[0], reg)); - DONE; - }) -@@ -913,7 +898,7 @@ - { - rtx reg = gen_reg_rtx (V4SImode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], true); -+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg)); - DONE; - }) -@@ -925,7 +910,7 @@ - { - rtx reg = gen_reg_rtx (V4SImode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], false); -+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg)); - DONE; - }) -@@ -937,7 +922,7 @@ - { - rtx reg = gen_reg_rtx (V4SImode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], true); -+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg)); - DONE; - }) -@@ -949,7 +934,7 @@ - { - rtx reg = gen_reg_rtx (V4SImode); - -- rs6000_expand_interleave (reg, operands[1], operands[1], false); -+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN); - emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg)); - DONE; - }) -@@ -963,8 +948,19 @@ - (match_operand:V16QI 3 "vlogical_operand" "")] - "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" - { -- emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], operands[2], -- operands[3])); -+ if (BYTES_BIG_ENDIAN) -+ emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], -+ operands[2], operands[3])); -+ else -+ { -+ /* We have changed lvsr to lvsl, so to complete the transformation -+ of vperm for LE, we must swap the inputs. */ -+ rtx unspec = gen_rtx_UNSPEC (<MODE>mode, -+ gen_rtvec (3, operands[2], -+ operands[1], operands[3]), -+ UNSPEC_VPERM); -+ emit_move_insn (operands[0], unspec); -+ } - DONE; - }) - -@@ -1064,7 +1060,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (rotate:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - ;; Expanders for arithmetic shift left on each vector element -@@ -1072,7 +1068,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (ashift:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - ;; Expanders for logical shift right on each vector element -@@ -1080,7 +1076,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (lshiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - ;; Expanders for arithmetic shift right on each vector element -@@ -1088,7 +1084,7 @@ - [(set (match_operand:VEC_I 0 "vint_operand" "") - (ashiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "") - (match_operand:VEC_I 2 "vint_operand" "")))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)" - "") - - ;; Vector reduction expanders for VSX -Index: gcc/config/rs6000/constraints.md -=================================================================== ---- a/src/gcc/config/rs6000/constraints.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/constraints.md (.../branches/gcc-4_8-branch) -@@ -52,22 +52,62 @@ - "@internal") - - ;; Use w as a prefix to add VSX modes --;; vector double (V2DF) -+;; any VSX register -+(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]" -+ "Any VSX register if the -mvsx option was used or NO_REGS.") -+ - (define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]" -- "@internal") -+ "VSX vector register to hold vector double data or NO_REGS.") - --;; vector float (V4SF) - (define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]" -- "@internal") -+ "VSX vector register to hold vector float data or NO_REGS.") - --;; scalar double (DF) -+(define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]" -+ "If -mmfpgpr was used, a floating point register or NO_REGS.") -+ -+(define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]" -+ "Floating point register if the LFIWAX instruction is enabled or NO_REGS.") -+ -+(define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]" -+ "VSX register if direct move instructions are enabled, or NO_REGS.") -+ -+;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use -+;; direct move directly, and movsf can't to move between the register sets. -+;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode -+(define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).") -+ -+(define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]" -+ "General purpose register if 64-bit instructions are enabled or NO_REGS.") -+ - (define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]" -- "@internal") -+ "VSX vector register to hold scalar double values or NO_REGS.") - --;; any VSX register --(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]" -- "@internal") -+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]" -+ "VSX vector register to hold 128 bit integer or NO_REGS.") - -+(define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]" -+ "Altivec register to use for float/32-bit int loads/stores or NO_REGS.") -+ -+(define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]" -+ "Altivec register to use for double loads/stores or NO_REGS.") -+ -+(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]" -+ "FP or VSX register to perform float operations under -mvsx or NO_REGS.") -+ -+(define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]" -+ "Floating point register if the STFIWX instruction is enabled or NO_REGS.") -+ -+(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]" -+ "VSX vector register to hold scalar float values or NO_REGS.") -+ -+(define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]" -+ "Floating point register if the LFIWZX instruction is enabled or NO_REGS.") -+ -+;; Lq/stq validates the address for load/store quad -+(define_memory_constraint "wQ" -+ "Memory operand suitable for the load/store quad instructions" -+ (match_operand 0 "quad_memory_operand")) -+ - ;; Altivec style load/store that ignores the bottom bits of the address - (define_memory_constraint "wZ" - "Indexed or indirect memory operand, ignoring the bottom 4 bits" -Index: gcc/config/rs6000/predicates.md -=================================================================== ---- a/src/gcc/config/rs6000/predicates.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/predicates.md (.../branches/gcc-4_8-branch) -@@ -124,6 +124,11 @@ - (and (match_code "const_int") - (match_test "INTVAL (op) >= -16 && INTVAL (op) <= 15"))) - -+;; Return 1 if op is a unsigned 3-bit constant integer. -+(define_predicate "u3bit_cint_operand" -+ (and (match_code "const_int") -+ (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7"))) -+ - ;; Return 1 if op is a unsigned 5-bit constant integer. - (define_predicate "u5bit_cint_operand" - (and (match_code "const_int") -@@ -135,6 +140,11 @@ - (and (match_code "const_int") - (match_test "INTVAL (op) >= -128 && INTVAL (op) <= 127"))) - -+;; Return 1 if op is a unsigned 10-bit constant integer. -+(define_predicate "u10bit_cint_operand" -+ (and (match_code "const_int") -+ (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 1023"))) -+ - ;; Return 1 if op is a constant integer that can fit in a D field. - (define_predicate "short_cint_operand" - (and (match_code "const_int") -@@ -166,6 +176,11 @@ - (and (match_code "const_int") - (match_test "IN_RANGE (INTVAL (op), 2, 3)"))) - -+;; Match op = 0..15 -+(define_predicate "const_0_to_15_operand" -+ (and (match_code "const_int") -+ (match_test "IN_RANGE (INTVAL (op), 0, 15)"))) -+ - ;; Return 1 if op is a register that is not special. - (define_predicate "gpc_reg_operand" - (match_operand 0 "register_operand") -@@ -182,9 +197,95 @@ - if (REGNO (op) >= ARG_POINTER_REGNUM && !CA_REGNO_P (REGNO (op))) - return 1; - -+ if (TARGET_VSX && VSX_REGNO_P (REGNO (op))) -+ return 1; -+ - return INT_REGNO_P (REGNO (op)) || FP_REGNO_P (REGNO (op)); - }) - -+;; Return 1 if op is a general purpose register. Unlike gpc_reg_operand, don't -+;; allow floating point or vector registers. -+(define_predicate "int_reg_operand" -+ (match_operand 0 "register_operand") -+{ -+ if ((TARGET_E500_DOUBLE || TARGET_SPE) && invalid_e500_subreg (op, mode)) -+ return 0; -+ -+ if (GET_CODE (op) == SUBREG) -+ op = SUBREG_REG (op); -+ -+ if (!REG_P (op)) -+ return 0; -+ -+ if (REGNO (op) >= FIRST_PSEUDO_REGISTER) -+ return 1; -+ -+ return INT_REGNO_P (REGNO (op)); -+}) -+ -+;; Like int_reg_operand, but only return true for base registers -+(define_predicate "base_reg_operand" -+ (match_operand 0 "int_reg_operand") -+{ -+ if (GET_CODE (op) == SUBREG) -+ op = SUBREG_REG (op); -+ -+ if (!REG_P (op)) -+ return 0; -+ -+ return (REGNO (op) != FIRST_GPR_REGNO); -+}) -+ -+;; Return 1 if op is a HTM specific SPR register. -+(define_predicate "htm_spr_reg_operand" -+ (match_operand 0 "register_operand") -+{ -+ if (!TARGET_HTM) -+ return 0; -+ -+ if (GET_CODE (op) == SUBREG) -+ op = SUBREG_REG (op); -+ -+ if (!REG_P (op)) -+ return 0; -+ -+ switch (REGNO (op)) -+ { -+ case TFHAR_REGNO: -+ case TFIAR_REGNO: -+ case TEXASR_REGNO: -+ return 1; -+ default: -+ break; -+ } -+ -+ /* Unknown SPR. */ -+ return 0; -+}) -+ -+;; Return 1 if op is a general purpose register that is an even register -+;; which suitable for a load/store quad operation -+(define_predicate "quad_int_reg_operand" -+ (match_operand 0 "register_operand") -+{ -+ HOST_WIDE_INT r; -+ -+ if (!TARGET_QUAD_MEMORY && !TARGET_QUAD_MEMORY_ATOMIC) -+ return 0; -+ -+ if (GET_CODE (op) == SUBREG) -+ op = SUBREG_REG (op); -+ -+ if (!REG_P (op)) -+ return 0; -+ -+ r = REGNO (op); -+ if (r >= FIRST_PSEUDO_REGISTER) -+ return 1; -+ -+ return (INT_REGNO_P (r) && ((r & 1) == 0)); -+}) -+ - ;; Return 1 if op is a register that is a condition register field. - (define_predicate "cc_reg_operand" - (match_operand 0 "register_operand") -@@ -315,6 +416,11 @@ - && CONST_DOUBLE_HIGH (op) == 0") - (match_operand 0 "gpc_reg_operand")))) - -+;; Like reg_or_logical_cint_operand, but allow vsx registers -+(define_predicate "vsx_reg_or_cint_operand" -+ (ior (match_operand 0 "vsx_register_operand") -+ (match_operand 0 "reg_or_logical_cint_operand"))) -+ - ;; Return 1 if operand is a CONST_DOUBLE that can be set in a register - ;; with no more than one instruction per word. - (define_predicate "easy_fp_constant" -@@ -333,6 +439,11 @@ - && mode != DImode) - return 1; - -+ /* The constant 0.0 is easy under VSX. */ -+ if ((mode == SFmode || mode == DFmode || mode == SDmode || mode == DDmode) -+ && VECTOR_UNIT_VSX_P (DFmode) && op == CONST0_RTX (mode)) -+ return 1; -+ - if (DECIMAL_FLOAT_MODE_P (mode)) - return 0; - -@@ -521,6 +632,55 @@ - (and (match_operand 0 "memory_operand") - (match_test "offsettable_nonstrict_memref_p (op)"))) - -+;; Return 1 if the operand is suitable for load/store quad memory. -+;; This predicate only checks for non-atomic loads/stores. -+(define_predicate "quad_memory_operand" -+ (match_code "mem") -+{ -+ rtx addr, op0, op1; -+ int ret; -+ -+ if (!TARGET_QUAD_MEMORY) -+ ret = 0; -+ -+ else if (!memory_operand (op, mode)) -+ ret = 0; -+ -+ else if (GET_MODE_SIZE (GET_MODE (op)) != 16) -+ ret = 0; -+ -+ else if (MEM_ALIGN (op) < 128) -+ ret = 0; -+ -+ else -+ { -+ addr = XEXP (op, 0); -+ if (int_reg_operand (addr, Pmode)) -+ ret = 1; -+ -+ else if (GET_CODE (addr) != PLUS) -+ ret = 0; -+ -+ else -+ { -+ op0 = XEXP (addr, 0); -+ op1 = XEXP (addr, 1); -+ ret = (int_reg_operand (op0, Pmode) -+ && GET_CODE (op1) == CONST_INT -+ && IN_RANGE (INTVAL (op1), -32768, 32767) -+ && (INTVAL (op1) & 15) == 0); -+ } -+ } -+ -+ if (TARGET_DEBUG_ADDR) -+ { -+ fprintf (stderr, "\nquad_memory_operand, ret = %s\n", ret ? "true" : "false"); -+ debug_rtx (op); -+ } -+ -+ return ret; -+}) -+ - ;; Return 1 if the operand is an indexed or indirect memory operand. - (define_predicate "indexed_or_indirect_operand" - (match_code "mem") -@@ -535,6 +695,19 @@ - return indexed_or_indirect_address (op, mode); - }) - -+;; Like indexed_or_indirect_operand, but also allow a GPR register if direct -+;; moves are supported. -+(define_predicate "reg_or_indexed_operand" -+ (match_code "mem,reg") -+{ -+ if (MEM_P (op)) -+ return indexed_or_indirect_operand (op, mode); -+ else if (TARGET_DIRECT_MOVE) -+ return register_operand (op, mode); -+ return -+ 0; -+}) -+ - ;; Return 1 if the operand is an indexed or indirect memory operand with an - ;; AND -16 in it, used to recognize when we need to switch to Altivec loads - ;; to realign loops instead of VSX (altivec silently ignores the bottom bits, -@@ -560,6 +733,28 @@ - && REG_P (XEXP (op, 1)))") - (match_operand 0 "address_operand"))) - -+;; Return 1 if the operand is an index-form address. -+(define_special_predicate "indexed_address" -+ (match_test "(GET_CODE (op) == PLUS -+ && REG_P (XEXP (op, 0)) -+ && REG_P (XEXP (op, 1)))")) -+ -+;; Return 1 if the operand is a MEM with an update-form address. This may -+;; also include update-indexed form. -+(define_special_predicate "update_address_mem" -+ (match_test "(MEM_P (op) -+ && (GET_CODE (XEXP (op, 0)) == PRE_INC -+ || GET_CODE (XEXP (op, 0)) == PRE_DEC -+ || GET_CODE (XEXP (op, 0)) == PRE_MODIFY))")) -+ -+;; Return 1 if the operand is a MEM with an update-indexed-form address. Note -+;; that PRE_INC/PRE_DEC will always be non-indexed (i.e. non X-form) since the -+;; increment is based on the mode size and will therefor always be a const. -+(define_special_predicate "update_indexed_address_mem" -+ (match_test "(MEM_P (op) -+ && GET_CODE (XEXP (op, 0)) == PRE_MODIFY -+ && indexed_address (XEXP (XEXP (op, 0), 1), mode))")) -+ - ;; Used for the destination of the fix_truncdfsi2 expander. - ;; If stfiwx will be used, the result goes to memory; otherwise, - ;; we're going to emit a store and a load of a subreg, so the dest is a -@@ -883,7 +1078,8 @@ - (and (match_code "symbol_ref") - (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) - && ((SYMBOL_REF_LOCAL_P (op) -- && (DEFAULT_ABI != ABI_AIX -+ && ((DEFAULT_ABI != ABI_AIX -+ && DEFAULT_ABI != ABI_ELFv2) - || !SYMBOL_REF_EXTERNAL_P (op))) - || (op == XEXP (DECL_RTL (current_function_decl), - 0)))"))) -@@ -1364,6 +1560,26 @@ - return 1; - }) - -+;; Return 1 if OP is valid for crsave insn, known to be a PARALLEL. -+(define_predicate "crsave_operation" -+ (match_code "parallel") -+{ -+ int count = XVECLEN (op, 0); -+ int i; -+ -+ for (i = 1; i < count; i++) -+ { -+ rtx exp = XVECEXP (op, 0, i); -+ -+ if (GET_CODE (exp) != USE -+ || GET_CODE (XEXP (exp, 0)) != REG -+ || GET_MODE (XEXP (exp, 0)) != CCmode -+ || ! CR_REGNO_P (REGNO (XEXP (exp, 0)))) -+ return 0; -+ } -+ return 1; -+}) -+ - ;; Return 1 if OP is valid for lmw insn, known to be a PARALLEL. - (define_predicate "lmw_operation" - (match_code "parallel") -@@ -1534,3 +1750,99 @@ +@@ -1201,6 +1201,7 @@ + CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); + int ncrn, nvrn, nregs; + bool allocate_ncrn, allocate_nvrn; ++ HOST_WIDE_INT size; - return GET_CODE (op) == UNSPEC && XINT (op, 1) == UNSPEC_TOCREL; - }) -+ -+;; Match the first insn (addis) in fusing the combination of addis and loads to -+;; GPR registers on power8. -+(define_predicate "fusion_gpr_addis" -+ (match_code "const_int,high,plus") -+{ -+ HOST_WIDE_INT value; -+ rtx int_const; -+ -+ if (GET_CODE (op) == HIGH) -+ return 1; -+ -+ if (CONST_INT_P (op)) -+ int_const = op; -+ -+ else if (GET_CODE (op) == PLUS -+ && base_reg_operand (XEXP (op, 0), Pmode) -+ && CONST_INT_P (XEXP (op, 1))) -+ int_const = XEXP (op, 1); -+ -+ else -+ return 0; -+ -+ /* Power8 currently will only do the fusion if the top 11 bits of the addis -+ value are all 1's or 0's. */ -+ value = INTVAL (int_const); -+ if ((value & (HOST_WIDE_INT)0xffff) != 0) -+ return 0; -+ -+ if ((value & (HOST_WIDE_INT)0xffff0000) == 0) -+ return 0; -+ -+ return (IN_RANGE (value >> 16, -32, 31)); -+}) -+ -+;; Match the second insn (lbz, lhz, lwz, ld) in fusing the combination of addis -+;; and loads to GPR registers on power8. -+(define_predicate "fusion_gpr_mem_load" -+ (match_code "mem,sign_extend,zero_extend") -+{ -+ rtx addr; -+ -+ /* Handle sign/zero extend. */ -+ if (GET_CODE (op) == ZERO_EXTEND -+ || (TARGET_P8_FUSION_SIGN && GET_CODE (op) == SIGN_EXTEND)) -+ { -+ op = XEXP (op, 0); -+ mode = GET_MODE (op); -+ } -+ -+ if (!MEM_P (op)) -+ return 0; -+ -+ switch (mode) -+ { -+ case QImode: -+ case HImode: -+ case SImode: -+ break; -+ -+ case DImode: -+ if (!TARGET_POWERPC64) -+ return 0; -+ break; -+ -+ default: -+ return 0; -+ } -+ -+ addr = XEXP (op, 0); -+ if (GET_CODE (addr) == PLUS) -+ { -+ rtx base = XEXP (addr, 0); -+ rtx offset = XEXP (addr, 1); -+ -+ return (base_reg_operand (base, GET_MODE (base)) -+ && satisfies_constraint_I (offset)); -+ } -+ -+ else if (GET_CODE (addr) == LO_SUM) -+ { -+ rtx base = XEXP (addr, 0); -+ rtx offset = XEXP (addr, 1); -+ -+ if (!base_reg_operand (base, GET_MODE (base))) -+ return 0; -+ -+ else if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64)) -+ return small_toc_ref (offset, GET_MODE (offset)); -+ -+ else if (TARGET_ELF && !TARGET_POWERPC64) -+ return CONSTANT_P (offset); -+ } -+ -+ return 0; -+}) -Index: gcc/config/rs6000/ppc-asm.h -=================================================================== ---- a/src/gcc/config/rs6000/ppc-asm.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/ppc-asm.h (.../branches/gcc-4_8-branch) -@@ -256,7 +256,30 @@ - * the real function with one or two leading periods respectively. - */ + /* We need to do this once per argument. */ + if (pcum->aapcs_arg_processed) +@@ -1208,6 +1209,11 @@ + + pcum->aapcs_arg_processed = true; + ++ /* Size in bytes, rounded to the nearest multiple of 8 bytes. */ ++ size ++ = AARCH64_ROUND_UP (type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode), ++ UNITS_PER_WORD); ++ + allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode); + allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v, + mode, +@@ -1258,10 +1264,8 @@ + } + + ncrn = pcum->aapcs_ncrn; +- nregs = ((type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode)) +- + UNITS_PER_WORD - 1) / UNITS_PER_WORD; ++ nregs = size / UNITS_PER_WORD; + +- + /* C6 - C9. though the sign and zero extension semantics are + handled elsewhere. This is the case where the argument fits + entirely general registers. */ +@@ -1309,13 +1313,12 @@ + pcum->aapcs_nextncrn = NUM_ARG_REGS; + + /* The argument is passed on stack; record the needed number of words for +- this argument (we can re-use NREGS) and align the total size if +- necessary. */ ++ this argument and align the total size if necessary. */ + on_stack: +- pcum->aapcs_stack_words = nregs; ++ pcum->aapcs_stack_words = size / UNITS_PER_WORD; + if (aarch64_function_arg_alignment (mode, type) == 16 * BITS_PER_UNIT) + pcum->aapcs_stack_size = AARCH64_ROUND_UP (pcum->aapcs_stack_size, +- 16 / UNITS_PER_WORD) + 1; ++ 16 / UNITS_PER_WORD); + return; + } --#if defined (__powerpc64__) -+#if defined(__powerpc64__) && _CALL_ELF == 2 -+ -+/* Defining "toc" above breaks @toc in assembler code. */ -+#undef toc -+ -+#define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) -+#define JUMP_TARGET(name) FUNC_NAME(name) -+#define FUNC_START(name) \ -+ .type FUNC_NAME(name),@function; \ -+ .globl FUNC_NAME(name); \ -+FUNC_NAME(name): \ -+0: addis 2,12,(.TOC.-0b)@ha; \ -+ addi 2,2,(.TOC.-0b)@l; \ -+ .localentry FUNC_NAME(name),.-FUNC_NAME(name) -+ -+#define HIDDEN_FUNC(name) \ -+ FUNC_START(name) \ -+ .hidden FUNC_NAME(name); -+ -+#define FUNC_END(name) \ -+ .size FUNC_NAME(name),.-FUNC_NAME(name) -+ -+#elif defined (__powerpc64__) -+ - #define FUNC_NAME(name) GLUE(.,name) - #define JUMP_TARGET(name) FUNC_NAME(name) - #define FUNC_START(name) \ Index: gcc/config/rs6000/htm.md =================================================================== ---- a/src/gcc/config/rs6000/htm.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/htm.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/htm.md (.../branches/gcc-4_8-branch) -@@ -0,0 +1,366 @@ -+;; Hardware Transactional Memory (HTM) patterns. -+;; Copyright (C) 2013 Free Software Foundation, Inc. -+;; Contributed by Peter Bergner <bergner@vnet.ibm.com>. -+ -+;; This file is part of GCC. -+ -+;; GCC is free software; you can redistribute it and/or modify it -+;; under the terms of the GNU General Public License as published -+;; by the Free Software Foundation; either version 3, or (at your -+;; option) any later version. -+ -+;; GCC is distributed in the hope that it will be useful, but WITHOUT -+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -+;; License for more details. -+ -+;; You should have received a copy of the GNU General Public License -+;; along with GCC; see the file COPYING3. If not see -+;; <http://www.gnu.org/licenses/>. -+ -+(define_constants -+ [(TFHAR_SPR 128) -+ (TFIAR_SPR 129) -+ (TEXASR_SPR 130) -+ (TEXASRU_SPR 131) -+ (MAX_HTM_OPERANDS 4) -+ ]) -+ -+;; -+;; UNSPEC_VOLATILE usage -+;; -+ -+(define_c_enum "unspecv" -+ [UNSPECV_HTM_TABORT -+ UNSPECV_HTM_TABORTDC -+ UNSPECV_HTM_TABORTDCI -+ UNSPECV_HTM_TABORTWC -+ UNSPECV_HTM_TABORTWCI -+ UNSPECV_HTM_TBEGIN -+ UNSPECV_HTM_TCHECK -+ UNSPECV_HTM_TEND -+ UNSPECV_HTM_TRECHKPT -+ UNSPECV_HTM_TRECLAIM -+ UNSPECV_HTM_TSR -+ UNSPECV_HTM_MFSPR -+ UNSPECV_HTM_MTSPR -+ ]) -+ -+ -+(define_expand "tabort" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand:SI 1 "int_reg_operand" "")] -+ UNSPECV_HTM_TABORT)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tabort_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand:SI 0 "int_reg_operand" "r")] -+ UNSPECV_HTM_TABORT))] -+ "TARGET_HTM" -+ "tabort. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tabortdc" -+ [(set (match_dup 4) -+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n") -+ (match_operand:SI 2 "gpc_reg_operand" "r") -+ (match_operand:SI 3 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TABORTDC)) -+ (set (match_dup 5) -+ (eq:SI (match_dup 4) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 5)))] -+ "TARGET_HTM" -+{ -+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[5] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tabortdc_internal" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n") -+ (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand:SI 2 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TABORTDC))] -+ "TARGET_HTM" -+ "tabortdc. %0,%1,%2" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tabortdci" -+ [(set (match_dup 4) -+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n") -+ (match_operand:SI 2 "gpc_reg_operand" "r") -+ (match_operand 3 "s5bit_cint_operand" "n")] -+ UNSPECV_HTM_TABORTDCI)) -+ (set (match_dup 5) -+ (eq:SI (match_dup 4) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 5)))] -+ "TARGET_HTM" -+{ -+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[5] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tabortdci_internal" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n") -+ (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand 2 "s5bit_cint_operand" "n")] -+ UNSPECV_HTM_TABORTDCI))] -+ "TARGET_HTM" -+ "tabortdci. %0,%1,%2" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tabortwc" -+ [(set (match_dup 4) -+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n") -+ (match_operand:SI 2 "gpc_reg_operand" "r") -+ (match_operand:SI 3 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TABORTWC)) -+ (set (match_dup 5) -+ (eq:SI (match_dup 4) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 5)))] -+ "TARGET_HTM" -+{ -+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[5] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tabortwc_internal" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n") -+ (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand:SI 2 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TABORTWC))] -+ "TARGET_HTM" -+ "tabortwc. %0,%1,%2" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tabortwci" -+ [(set (match_dup 4) -+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n") -+ (match_operand:SI 2 "gpc_reg_operand" "r") -+ (match_operand 3 "s5bit_cint_operand" "n")] -+ UNSPECV_HTM_TABORTWCI)) -+ (set (match_dup 5) -+ (eq:SI (match_dup 4) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 5)))] -+ "TARGET_HTM" -+{ -+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[5] = gen_reg_rtx (SImode); -+}) -+ -+(define_expand "ttest" -+ [(set (match_dup 1) -+ (unspec_volatile:CC [(const_int 0) -+ (reg:SI 0) -+ (const_int 0)] -+ UNSPECV_HTM_TABORTWCI)) -+ (set (subreg:CC (match_dup 2) 0) (match_dup 1)) -+ (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24))) -+ (parallel [(set (match_operand:SI 0 "int_reg_operand" "") -+ (and:SI (match_dup 3) (const_int 15))) -+ (clobber (scratch:CC))])] -+ "TARGET_HTM" -+{ -+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[2] = gen_reg_rtx (SImode); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tabortwci_internal" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n") -+ (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand 2 "s5bit_cint_operand" "n")] -+ UNSPECV_HTM_TABORTWCI))] -+ "TARGET_HTM" -+ "tabortwci. %0,%1,%2" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tbegin" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TBEGIN)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tbegin_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TBEGIN))] -+ "TARGET_HTM" -+ "tbegin. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tcheck" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand 1 "u3bit_cint_operand" "n")] -+ UNSPECV_HTM_TCHECK)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tcheck_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "u3bit_cint_operand" "n")] -+ UNSPECV_HTM_TCHECK))] -+ "TARGET_HTM" -+ "tcheck. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tend" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TEND)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tend_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TEND))] -+ "TARGET_HTM" -+ "tend. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "trechkpt" -+ [(set (match_dup 1) -+ (unspec_volatile:CC [(const_int 0)] -+ UNSPECV_HTM_TRECHKPT)) -+ (set (match_dup 2) -+ (eq:SI (match_dup 1) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 2)))] -+ "TARGET_HTM" -+{ -+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[2] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*trechkpt_internal" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(const_int 0)] -+ UNSPECV_HTM_TRECHKPT))] -+ "TARGET_HTM" -+ "trechkpt." -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "treclaim" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand:SI 1 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TRECLAIM)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*treclaim_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")] -+ UNSPECV_HTM_TRECLAIM))] -+ "TARGET_HTM" -+ "treclaim. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_expand "tsr" -+ [(set (match_dup 2) -+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TSR)) -+ (set (match_dup 3) -+ (eq:SI (match_dup 2) -+ (const_int 0))) -+ (set (match_operand:SI 0 "int_reg_operand" "") -+ (minus:SI (const_int 1) (match_dup 3)))] -+ "TARGET_HTM" -+{ -+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO); -+ operands[3] = gen_reg_rtx (SImode); -+}) -+ -+(define_insn "*tsr_internal" -+ [(set (match_operand:CC 1 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")] -+ UNSPECV_HTM_TSR))] -+ "TARGET_HTM" -+ "tsr. %0" -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_insn "htm_mfspr_<mode>" -+ [(set (match_operand:P 0 "gpc_reg_operand" "=r") -+ (unspec_volatile:P [(match_operand 1 "u10bit_cint_operand" "n") -+ (match_operand:P 2 "htm_spr_reg_operand" "")] -+ UNSPECV_HTM_MFSPR))] -+ "TARGET_HTM" -+ "mfspr %0,%1"; -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -+ -+(define_insn "htm_mtspr_<mode>" -+ [(set (match_operand:P 2 "htm_spr_reg_operand" "") -+ (unspec_volatile:P [(match_operand:P 0 "gpc_reg_operand" "r") -+ (match_operand 1 "u10bit_cint_operand" "n")] -+ UNSPECV_HTM_MTSPR))] -+ "TARGET_HTM" -+ "mtspr %1,%0"; -+ [(set_attr "type" "htm") -+ (set_attr "length" "4")]) -Index: gcc/config/rs6000/rs6000-modes.def -=================================================================== ---- a/src/gcc/config/rs6000/rs6000-modes.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/rs6000-modes.def (.../branches/gcc-4_8-branch) -@@ -38,6 +38,12 @@ - VECTOR_MODES (INT, 16); /* V16QI V8HI V4SI V2DI */ - VECTOR_MODES (INT, 32); /* V32QI V16HI V8SI V4DI */ - VECTOR_MODE (INT, DI, 1); -+VECTOR_MODE (INT, TI, 1); - VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */ - VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */ - VECTOR_MODES (FLOAT, 32); /* V16HF V8SF V4DF */ -+ -+/* Replacement for TImode that only is allowed in GPRs. We also use PTImode -+ for quad memory atomic operations to force getting an even/odd register -+ combination. */ -+PARTIAL_INT_MODE (TI); -Index: gcc/config/rs6000/rs6000-cpus.def -=================================================================== ---- a/src/gcc/config/rs6000/rs6000-cpus.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/rs6000-cpus.def (.../branches/gcc-4_8-branch) -@@ -28,7 +28,7 @@ - ALTIVEC, since in general it isn't a win on power6. In ISA 2.04, fsel, - fre, fsqrt, etc. were no longer documented as optional. Group masks by - server and embedded. */ --#define ISA_2_5_MASKS_EMBEDDED (ISA_2_2_MASKS \ -+#define ISA_2_5_MASKS_EMBEDDED (ISA_2_4_MASKS \ - | OPTION_MASK_CMPB \ - | OPTION_MASK_RECIP_PRECISION \ - | OPTION_MASK_PPC_GFXOPT \ -@@ -38,6 +38,8 @@ - - /* For ISA 2.06, don't add ISEL, since in general it isn't a win, but - altivec is a win so enable it. */ -+ /* OPTION_MASK_VSX_TIMODE should be set, but disable it for now until -+ PR 58587 is fixed. */ - #define ISA_2_6_MASKS_EMBEDDED (ISA_2_5_MASKS_EMBEDDED | OPTION_MASK_POPCNTD) - #define ISA_2_6_MASKS_SERVER (ISA_2_5_MASKS_SERVER \ - | OPTION_MASK_POPCNTD \ -@@ -44,6 +46,16 @@ - | OPTION_MASK_ALTIVEC \ - | OPTION_MASK_VSX) - -+/* For now, don't provide an embedded version of ISA 2.07. */ -+#define ISA_2_7_MASKS_SERVER (ISA_2_6_MASKS_SERVER \ -+ | OPTION_MASK_P8_FUSION \ -+ | OPTION_MASK_P8_VECTOR \ -+ | OPTION_MASK_CRYPTO \ -+ | OPTION_MASK_DIRECT_MOVE \ -+ | OPTION_MASK_HTM \ -+ | OPTION_MASK_QUAD_MEMORY \ -+ | OPTION_MASK_QUAD_MEMORY_ATOMIC) -+ - #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) - - /* Deal with ports that do not have -mstrict-align. */ -@@ -60,23 +72,30 @@ - /* Mask of all options to set the default isa flags based on -mcpu=<xxx>. */ - #define POWERPC_MASKS (OPTION_MASK_ALTIVEC \ - | OPTION_MASK_CMPB \ -+ | OPTION_MASK_CRYPTO \ - | OPTION_MASK_DFP \ -+ | OPTION_MASK_DIRECT_MOVE \ - | OPTION_MASK_DLMZB \ - | OPTION_MASK_FPRND \ -+ | OPTION_MASK_HTM \ - | OPTION_MASK_ISEL \ - | OPTION_MASK_MFCRF \ - | OPTION_MASK_MFPGPR \ - | OPTION_MASK_MULHW \ - | OPTION_MASK_NO_UPDATE \ -+ | OPTION_MASK_P8_FUSION \ -+ | OPTION_MASK_P8_VECTOR \ - | OPTION_MASK_POPCNTB \ - | OPTION_MASK_POPCNTD \ - | OPTION_MASK_POWERPC64 \ - | OPTION_MASK_PPC_GFXOPT \ - | OPTION_MASK_PPC_GPOPT \ -+ | OPTION_MASK_QUAD_MEMORY \ - | OPTION_MASK_RECIP_PRECISION \ - | OPTION_MASK_SOFT_FLOAT \ - | OPTION_MASK_STRICT_ALIGN_OPTIONAL \ -- | OPTION_MASK_VSX) -+ | OPTION_MASK_VSX \ -+ | OPTION_MASK_VSX_TIMODE) - - #endif - -@@ -166,10 +185,7 @@ - POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF - | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD - | MASK_VSX | MASK_RECIP_PRECISION) --RS6000_CPU ("power8", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ -- POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF -- | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD -- | MASK_VSX | MASK_RECIP_PRECISION) -+RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) - RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0) - RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64) - RS6000_CPU ("rs64", PROCESSOR_RS64A, MASK_PPC_GFXOPT | MASK_POWERPC64) -Index: gcc/config/rs6000/t-linux64bele -=================================================================== ---- a/src/gcc/config/rs6000/t-linux64bele (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/t-linux64bele (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+#rs6000/t-linux64end -+ -+MULTILIB_OPTIONS += mlittle -+MULTILIB_DIRNAMES += le -+MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) -+MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} -Index: gcc/config/rs6000/htmintrin.h -=================================================================== ---- a/src/gcc/config/rs6000/htmintrin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/htmintrin.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,131 @@ -+/* Hardware Transactional Memory (HTM) intrinsics. -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ Contributed by Peter Bergner <bergner@vnet.ibm.com>. -+ -+ This file is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3 of the License, or (at your option) -+ any later version. -+ -+ This file is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ Under Section 7 of GPL version 3, you are granted additional -+ permissions described in the GCC Runtime Library Exception, version -+ 3.1, as published by the Free Software Foundation. -+ -+ You should have received a copy of the GNU General Public License and -+ a copy of the GCC Runtime Library Exception along with this program; -+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#ifndef __HTM__ -+# error "HTM instruction set not enabled" -+#endif /* __HTM__ */ -+ -+#ifndef _HTMINTRIN_H -+#define _HTMINTRIN_H -+ -+#include <stdint.h> -+ -+typedef uint64_t texasr_t; -+typedef uint32_t texasru_t; -+typedef uint32_t texasrl_t; -+typedef uintptr_t tfiar_t; -+typedef uintptr_t tfhar_t; -+ -+#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3) -+#define _HTM_NONTRANSACTIONAL 0x0 -+#define _HTM_SUSPENDED 0x1 -+#define _HTM_TRANSACTIONAL 0x2 -+ -+/* The following macros use the IBM bit numbering for BITNUM -+ as used in the ISA documentation. */ -+ -+#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \ -+ (((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1)) -+#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \ -+ (((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1)) -+ -+#define _TEXASR_FAILURE_CODE(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 7, 8) -+#define _TEXASRU_FAILURE_CODE(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8) -+ -+#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 7, 1) -+#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1) -+ -+#define _TEXASR_DISALLOWED(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 8, 1) -+#define _TEXASRU_DISALLOWED(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1) -+ -+#define _TEXASR_NESTING_OVERFLOW(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 9, 1) -+#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1) -+ -+#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 10, 1) -+#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1) -+ -+#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 11, 1) -+#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1) -+ -+#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 12, 1) -+#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1) -+ -+#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 13, 1) -+#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1) -+ -+#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 14, 1) -+#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1) -+ -+#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 15, 1) -+#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1) -+ -+#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 16, 1) -+#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1) -+ -+#define _TEXASR_ABORT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 31, 1) -+#define _TEXASRU_ABORT(TEXASRU) \ -+ _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1) -+ -+ -+#define _TEXASR_SUSPENDED(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 32, 1) -+ -+#define _TEXASR_PRIVILEGE(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 35, 2) -+ -+#define _TEXASR_FAILURE_SUMMARY(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 36, 1) -+ -+#define _TEXASR_TFIAR_EXACT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 37, 1) -+ -+#define _TEXASR_ROT(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 38, 1) -+ -+#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \ -+ _TEXASR_EXTRACT_BITS(TEXASR, 63, 12) -+ -+#endif /* _HTMINTRIN_H */ +@@ -179,7 +179,7 @@ + (const_int 0)] + UNSPECV_HTM_TABORTWCI)) + (set (subreg:CC (match_dup 2) 0) (match_dup 1)) +- (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24))) ++ (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 28))) + (parallel [(set (match_operand:SI 0 "int_reg_operand" "") + (and:SI (match_dup 3) (const_int 15))) + (clobber (scratch:CC))])] Index: gcc/config/rs6000/rs6000-protos.h =================================================================== ---- a/src/gcc/config/rs6000/rs6000-protos.h (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/rs6000-protos.h (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/rs6000-protos.h (.../branches/gcc-4_8-branch) -@@ -50,12 +50,19 @@ - extern rtx find_addr_reg (rtx); - extern rtx gen_easy_altivec_constant (rtx); - extern const char *output_vec_const_move (rtx *); -+extern const char *rs6000_output_move_128bit (rtx *); -+extern bool rs6000_move_128bit_ok_p (rtx []); -+extern bool rs6000_split_128bit_ok_p (rtx []); - extern void rs6000_expand_vector_init (rtx, rtx); - extern void paired_expand_vector_init (rtx, rtx); - extern void rs6000_expand_vector_set (rtx, rtx, int); - extern void rs6000_expand_vector_extract (rtx, rtx, int); - extern bool altivec_expand_vec_perm_const (rtx op[4]); -+extern void altivec_expand_vec_perm_le (rtx op[4]); - extern bool rs6000_expand_vec_perm_const (rtx op[4]); -+extern void altivec_expand_lvx_be (rtx, rtx, enum machine_mode, unsigned); -+extern void altivec_expand_stvx_be (rtx, rtx, enum machine_mode, unsigned); -+extern void altivec_expand_stvex_be (rtx, rtx, enum machine_mode, unsigned); - extern void rs6000_expand_extract_even (rtx, rtx, rtx); - extern void rs6000_expand_interleave (rtx, rtx, rtx, bool); - extern void build_mask64_2_operands (rtx, rtx *); -@@ -70,6 +77,11 @@ - extern int registers_ok_for_quad_peep (rtx, rtx); - extern int mems_ok_for_quad_peep (rtx, rtx); - extern bool gpr_or_gpr_p (rtx, rtx); -+extern bool direct_move_p (rtx, rtx); -+extern bool quad_load_store_p (rtx, rtx); -+extern bool fusion_gpr_load_p (rtx *, bool); -+extern void expand_fusion_gpr_load (rtx *); -+extern const char *emit_fusion_gpr_load (rtx *); - extern enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx, - enum reg_class); - extern enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class, -@@ -116,6 +128,7 @@ - extern void rs6000_fatal_bad_address (rtx); - extern rtx create_TOC_reference (rtx, rtx); - extern void rs6000_split_multireg_move (rtx, rtx); -+extern void rs6000_emit_le_vsx_move (rtx, rtx, enum machine_mode); - extern void rs6000_emit_move (rtx, rtx, enum machine_mode); - extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode); - extern rtx (*rs6000_legitimize_reload_address_ptr) (rtx, enum machine_mode, -@@ -135,9 +148,11 @@ - extern rtx rs6000_address_for_altivec (rtx); - extern rtx rs6000_allocate_stack_temp (enum machine_mode, bool, bool); - extern int rs6000_loop_align (rtx); -+extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool, rtx); - #endif /* RTX_CODE */ - - #ifdef TREE_CODE -+extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); - extern unsigned int rs6000_special_round_type_align (tree, unsigned int, - unsigned int); - extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, -@@ -146,6 +161,7 @@ +@@ -161,7 +161,7 @@ extern rtx rs6000_libcall_value (enum machine_mode); extern rtx rs6000_va_arg (tree, tree); extern int function_ok_for_sibcall (tree); -+extern int rs6000_reg_parm_stack_space (tree); +-extern int rs6000_reg_parm_stack_space (tree); ++extern int rs6000_reg_parm_stack_space (tree, bool); extern void rs6000_elf_declare_function_name (FILE *, const char *, tree); extern bool rs6000_elf_in_small_data_p (const_tree); #ifdef ARGS_SIZE_RTX -@@ -170,7 +186,8 @@ - extern void rs6000_emit_epilogue (int); - extern void rs6000_emit_eh_reg_restore (rtx, rtx); - extern const char * output_isel (rtx *); --extern void rs6000_call_indirect_aix (rtx, rtx, rtx); -+extern void rs6000_call_aix (rtx, rtx, rtx, rtx); -+extern void rs6000_sibcall_aix (rtx, rtx, rtx, rtx); - extern void rs6000_aix_asm_output_dwarf_table_ref (char *); - extern void get_ppc476_thunk_name (char name[32]); - extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins); -Index: gcc/config/rs6000/t-rs6000 -=================================================================== ---- a/src/gcc/config/rs6000/t-rs6000 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/t-rs6000 (.../branches/gcc-4_8-branch) -@@ -60,6 +60,7 @@ - $(srcdir)/config/rs6000/power5.md \ - $(srcdir)/config/rs6000/power6.md \ - $(srcdir)/config/rs6000/power7.md \ -+ $(srcdir)/config/rs6000/power8.md \ - $(srcdir)/config/rs6000/cell.md \ - $(srcdir)/config/rs6000/xfpu.md \ - $(srcdir)/config/rs6000/a2.md \ -@@ -70,6 +71,8 @@ - $(srcdir)/config/rs6000/vector.md \ - $(srcdir)/config/rs6000/vsx.md \ - $(srcdir)/config/rs6000/altivec.md \ -+ $(srcdir)/config/rs6000/crypto.md \ -+ $(srcdir)/config/rs6000/htm.md \ - $(srcdir)/config/rs6000/spe.md \ - $(srcdir)/config/rs6000/dfp.md \ - $(srcdir)/config/rs6000/paired.md -Index: gcc/config/rs6000/htmxlintrin.h -=================================================================== ---- a/src/gcc/config/rs6000/htmxlintrin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/htmxlintrin.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,208 @@ -+/* XL compiler Hardware Transactional Memory (HTM) execution intrinsics. -+ Copyright (C) 2013 Free Software Foundation, Inc. -+ Contributed by Peter Bergner <bergner@vnet.ibm.com>. -+ -+ This file is free software; you can redistribute it and/or modify it under -+ the terms of the GNU General Public License as published by the Free -+ Software Foundation; either version 3 of the License, or (at your option) -+ any later version. -+ -+ This file is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ for more details. -+ -+ Under Section 7 of GPL version 3, you are granted additional -+ permissions described in the GCC Runtime Library Exception, version -+ 3.1, as published by the Free Software Foundation. -+ -+ You should have received a copy of the GNU General Public License and -+ a copy of the GCC Runtime Library Exception along with this program; -+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -+ <http://www.gnu.org/licenses/>. */ -+ -+#ifndef __HTM__ -+# error "HTM instruction set not enabled" -+#endif /* __HTM__ */ -+ -+#ifndef _HTMXLINTRIN_H -+#define _HTMXLINTRIN_H -+ -+#include <stdint.h> -+#include <htmintrin.h> -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#define _TEXASR_PTR(TM_BUF) \ -+ ((texasr_t *)((TM_BUF)+0)) -+#define _TEXASRU_PTR(TM_BUF) \ -+ ((texasru_t *)((TM_BUF)+0)) -+#define _TEXASRL_PTR(TM_BUF) \ -+ ((texasrl_t *)((TM_BUF)+4)) -+#define _TFIAR_PTR(TM_BUF) \ -+ ((tfiar_t *)((TM_BUF)+8)) -+ -+typedef char TM_buff_type[16]; -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_simple_begin (void) -+{ -+ if (__builtin_expect (__builtin_tbegin (0), 1)) -+ return 1; -+ return 0; -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_begin (void* const TM_buff) -+{ -+ *_TEXASRL_PTR (TM_buff) = 0; -+ if (__builtin_expect (__builtin_tbegin (0), 1)) -+ return 1; -+#ifdef __powerpc64__ -+ *_TEXASR_PTR (TM_buff) = __builtin_get_texasr (); -+#else -+ *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru (); -+ *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr (); -+#endif -+ *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar (); -+ return 0; -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_end (void) -+{ -+ if (__builtin_expect (__builtin_tend (0), 1)) -+ return 1; -+ return 0; -+} -+ -+extern __inline void -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_abort (void) -+{ -+ __builtin_tabort (0); -+} -+ -+extern __inline void -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_named_abort (unsigned char const code) -+{ -+ __builtin_tabort (code); -+} -+ -+extern __inline void -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_resume (void) -+{ -+ __builtin_tresume (); -+} -+ -+extern __inline void -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_suspend (void) -+{ -+ __builtin_tsuspend (); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_user_abort (void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ return _TEXASRU_ABORT (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_named_user_abort (void* const TM_buff, unsigned char *code) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ -+ *code = _TEXASRU_FAILURE_CODE (texasru); -+ return _TEXASRU_ABORT (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_illegal (void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ return _TEXASRU_DISALLOWED (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_footprint_exceeded (void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ return _TEXASRU_FOOTPRINT_OVERFLOW (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_nesting_depth (void* const TM_buff) -+{ -+ texasrl_t texasrl; -+ -+ if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL) -+ { -+ texasrl = *_TEXASRL_PTR (TM_buff); -+ if (!_TEXASR_FAILURE_SUMMARY (texasrl)) -+ texasrl = 0; -+ } -+ else -+ texasrl = (texasrl_t) __builtin_get_texasr (); -+ -+ return _TEXASR_TRANSACTION_LEVEL (texasrl); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_nested_too_deep(void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ return _TEXASRU_NESTING_OVERFLOW (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_conflict(void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ /* Return TEXASR bits 11 (Self-Induced Conflict) through -+ 14 (Translation Invalidation Conflict). */ -+ return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0; -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_is_failure_persistent(void* const TM_buff) -+{ -+ texasru_t texasru = *_TEXASRU_PTR (TM_buff); -+ return _TEXASRU_FAILURE_PERSISTENT (texasru); -+} -+ -+extern __inline long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_failure_address(void* const TM_buff) -+{ -+ return *_TFIAR_PTR (TM_buff); -+} -+ -+extern __inline long long -+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) -+__TM_failure_code(void* const TM_buff) -+{ -+ return *_TEXASR_PTR (TM_buff); -+} -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _HTMXLINTRIN_H */ Index: gcc/config/rs6000/rs6000-builtin.def =================================================================== ---- a/src/gcc/config/rs6000/rs6000-builtin.def (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/rs6000-builtin.def (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/rs6000-builtin.def (.../branches/gcc-4_8-branch) -@@ -30,7 +30,8 @@ - RS6000_BUILTIN_A -- ABS builtins - RS6000_BUILTIN_D -- DST builtins - RS6000_BUILTIN_E -- SPE EVSEL builtins. -- RS6000_BUILTIN_P -- Altivec and VSX predicate builtins -+ RS6000_BUILTIN_H -- HTM builtins -+ RS6000_BUILTIN_P -- Altivec, VSX, ISA 2.07 vector predicate builtins - RS6000_BUILTIN_Q -- Paired floating point VSX predicate builtins - RS6000_BUILTIN_S -- SPE predicate builtins - RS6000_BUILTIN_X -- special builtins -@@ -66,6 +67,10 @@ - #error "RS6000_BUILTIN_E is not defined." - #endif - -+#ifndef RS6000_BUILTIN_H -+ #error "RS6000_BUILTIN_H is not defined." -+#endif -+ - #ifndef RS6000_BUILTIN_P - #error "RS6000_BUILTIN_P is not defined." - #endif -@@ -301,6 +306,174 @@ - | RS6000_BTC_SPECIAL), \ - CODE_FOR_nothing) /* ICODE */ - -+/* ISA 2.07 (power8) vector convenience macros. */ -+/* For the instructions that are encoded as altivec instructions use -+ __builtin_altivec_ as the builtin name. */ -+#define BU_P8V_AV_1(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_altivec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_P8V_AV_2(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_2 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_altivec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_BINARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_P8V_AV_3(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_3 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_altivec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_TERNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_P8V_AV_P(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_P (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_altivec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_PREDICATE), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+/* For the instructions encoded as VSX instructions use __builtin_vsx as the -+ builtin name. */ -+#define BU_P8V_VSX_1(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_vsx_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_P8V_OVERLOAD_1(ENUM, NAME) \ -+ RS6000_BUILTIN_1 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \ -+ "__builtin_vec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+#define BU_P8V_OVERLOAD_2(ENUM, NAME) \ -+ RS6000_BUILTIN_2 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \ -+ "__builtin_vec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_BINARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+#define BU_P8V_OVERLOAD_3(ENUM, NAME) \ -+ RS6000_BUILTIN_3 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \ -+ "__builtin_vec_" NAME, /* NAME */ \ -+ RS6000_BTM_P8_VECTOR, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_TERNARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+/* Crypto convenience macros. */ -+#define BU_CRYPTO_1(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_CRYPTO_2(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_BINARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_CRYPTO_3(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_TERNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_CRYPTO_OVERLOAD_1(ENUM, NAME) \ -+ RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+#define BU_CRYPTO_OVERLOAD_2(ENUM, NAME) \ -+ RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_BINARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+#define BU_CRYPTO_OVERLOAD_3(ENUM, NAME) \ -+ RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_crypto_" NAME, /* NAME */ \ -+ RS6000_BTM_CRYPTO, /* MASK */ \ -+ (RS6000_BTC_OVERLOADED /* ATTR */ \ -+ | RS6000_BTC_TERNARY), \ -+ CODE_FOR_nothing) /* ICODE */ -+ -+/* HTM convenience macros. */ -+#define BU_HTM_0(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ RS6000_BTC_ ## ATTR, /* ATTR */ \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_HTM_1(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_UNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_HTM_2(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_BINARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_HTM_3(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_TERNARY), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_HTM_SPR0(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_SPR), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ -+#define BU_HTM_SPR1(ENUM, NAME, ATTR, ICODE) \ -+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \ -+ "__builtin_" NAME, /* NAME */ \ -+ RS6000_BTM_HTM, /* MASK */ \ -+ (RS6000_BTC_ ## ATTR /* ATTR */ \ -+ | RS6000_BTC_UNARY \ -+ | RS6000_BTC_SPR \ -+ | RS6000_BTC_VOID), \ -+ CODE_FOR_ ## ICODE) /* ICODE */ -+ - /* SPE convenience macros. */ - #define BU_SPE_1(ENUM, NAME, ATTR, ICODE) \ - RS6000_BUILTIN_1 (SPE_BUILTIN_ ## ENUM, /* ENUM */ \ -@@ -414,6 +587,7 @@ - BU_ALTIVEC_3 (VMSUMUHS, "vmsumuhs", SAT, altivec_vmsumuhs) - BU_ALTIVEC_3 (VMSUMSHS, "vmsumshs", SAT, altivec_vmsumshs) - BU_ALTIVEC_3 (VNMSUBFP, "vnmsubfp", FP, nfmsv4sf4) -+BU_ALTIVEC_3 (VPERM_1TI, "vperm_1ti", CONST, altivec_vperm_v1ti) - BU_ALTIVEC_3 (VPERM_2DF, "vperm_2df", CONST, altivec_vperm_v2df) - BU_ALTIVEC_3 (VPERM_2DI, "vperm_2di", CONST, altivec_vperm_v2di) - BU_ALTIVEC_3 (VPERM_4SF, "vperm_4sf", CONST, altivec_vperm_v4sf) -@@ -420,6 +594,7 @@ - BU_ALTIVEC_3 (VPERM_4SI, "vperm_4si", CONST, altivec_vperm_v4si) - BU_ALTIVEC_3 (VPERM_8HI, "vperm_8hi", CONST, altivec_vperm_v8hi) - BU_ALTIVEC_3 (VPERM_16QI, "vperm_16qi", CONST, altivec_vperm_v16qi_uns) -+BU_ALTIVEC_3 (VPERM_1TI_UNS, "vperm_1ti_uns", CONST, altivec_vperm_v1ti_uns) - BU_ALTIVEC_3 (VPERM_2DI_UNS, "vperm_2di_uns", CONST, altivec_vperm_v2di_uns) - BU_ALTIVEC_3 (VPERM_4SI_UNS, "vperm_4si_uns", CONST, altivec_vperm_v4si_uns) - BU_ALTIVEC_3 (VPERM_8HI_UNS, "vperm_8hi_uns", CONST, altivec_vperm_v8hi_uns) -@@ -430,10 +605,12 @@ - BU_ALTIVEC_3 (VSEL_16QI, "vsel_16qi", CONST, vector_select_v16qi) - BU_ALTIVEC_3 (VSEL_2DF, "vsel_2df", CONST, vector_select_v2df) - BU_ALTIVEC_3 (VSEL_2DI, "vsel_2di", CONST, vector_select_v2di) -+BU_ALTIVEC_3 (VSEL_1TI, "vsel_1ti", CONST, vector_select_v1ti) - BU_ALTIVEC_3 (VSEL_4SI_UNS, "vsel_4si_uns", CONST, vector_select_v4si_uns) - BU_ALTIVEC_3 (VSEL_8HI_UNS, "vsel_8hi_uns", CONST, vector_select_v8hi_uns) - BU_ALTIVEC_3 (VSEL_16QI_UNS, "vsel_16qi_uns", CONST, vector_select_v16qi_uns) - BU_ALTIVEC_3 (VSEL_2DI_UNS, "vsel_2di_uns", CONST, vector_select_v2di_uns) -+BU_ALTIVEC_3 (VSEL_1TI_UNS, "vsel_1ti_uns", CONST, vector_select_v1ti_uns) - BU_ALTIVEC_3 (VSLDOI_16QI, "vsldoi_16qi", CONST, altivec_vsldoi_v16qi) - BU_ALTIVEC_3 (VSLDOI_8HI, "vsldoi_8hi", CONST, altivec_vsldoi_v8hi) - BU_ALTIVEC_3 (VSLDOI_4SI, "vsldoi_4si", CONST, altivec_vsldoi_v4si) -@@ -626,6 +803,8 @@ - BU_ALTIVEC_X (LD_INTERNAL_2df, "ld_internal_2df", MEM) - BU_ALTIVEC_X (ST_INTERNAL_2di, "st_internal_2di", MEM) - BU_ALTIVEC_X (LD_INTERNAL_2di, "ld_internal_2di", MEM) -+BU_ALTIVEC_X (ST_INTERNAL_1ti, "st_internal_1ti", MEM) -+BU_ALTIVEC_X (LD_INTERNAL_1ti, "ld_internal_1ti", MEM) - BU_ALTIVEC_X (MTVSCR, "mtvscr", MISC) - BU_ALTIVEC_X (MFVSCR, "mfvscr", MISC) - BU_ALTIVEC_X (DSSALL, "dssall", MISC) -@@ -636,8 +815,26 @@ - BU_ALTIVEC_X (LVEHX, "lvehx", MEM) - BU_ALTIVEC_X (LVEWX, "lvewx", MEM) - BU_ALTIVEC_X (LVXL, "lvxl", MEM) -+BU_ALTIVEC_X (LVXL_V2DF, "lvxl_v2df", MEM) -+BU_ALTIVEC_X (LVXL_V2DI, "lvxl_v2di", MEM) -+BU_ALTIVEC_X (LVXL_V4SF, "lvxl_v4sf", MEM) -+BU_ALTIVEC_X (LVXL_V4SI, "lvxl_v4si", MEM) -+BU_ALTIVEC_X (LVXL_V8HI, "lvxl_v8hi", MEM) -+BU_ALTIVEC_X (LVXL_V16QI, "lvxl_v16qi", MEM) - BU_ALTIVEC_X (LVX, "lvx", MEM) -+BU_ALTIVEC_X (LVX_V2DF, "lvx_v2df", MEM) -+BU_ALTIVEC_X (LVX_V2DI, "lvx_v2di", MEM) -+BU_ALTIVEC_X (LVX_V4SF, "lvx_v4sf", MEM) -+BU_ALTIVEC_X (LVX_V4SI, "lvx_v4si", MEM) -+BU_ALTIVEC_X (LVX_V8HI, "lvx_v8hi", MEM) -+BU_ALTIVEC_X (LVX_V16QI, "lvx_v16qi", MEM) - BU_ALTIVEC_X (STVX, "stvx", MEM) -+BU_ALTIVEC_X (STVX_V2DF, "stvx_v2df", MEM) -+BU_ALTIVEC_X (STVX_V2DI, "stvx_v2di", MEM) -+BU_ALTIVEC_X (STVX_V4SF, "stvx_v4sf", MEM) -+BU_ALTIVEC_X (STVX_V4SI, "stvx_v4si", MEM) -+BU_ALTIVEC_X (STVX_V8HI, "stvx_v8hi", MEM) -+BU_ALTIVEC_X (STVX_V16QI, "stvx_v16qi", MEM) - BU_ALTIVEC_C (LVLX, "lvlx", MEM) - BU_ALTIVEC_C (LVLXL, "lvlxl", MEM) - BU_ALTIVEC_C (LVRX, "lvrx", MEM) -@@ -646,6 +843,12 @@ - BU_ALTIVEC_X (STVEHX, "stvehx", MEM) - BU_ALTIVEC_X (STVEWX, "stvewx", MEM) - BU_ALTIVEC_X (STVXL, "stvxl", MEM) -+BU_ALTIVEC_X (STVXL_V2DF, "stvxl_v2df", MEM) -+BU_ALTIVEC_X (STVXL_V2DI, "stvxl_v2di", MEM) -+BU_ALTIVEC_X (STVXL_V4SF, "stvxl_v4sf", MEM) -+BU_ALTIVEC_X (STVXL_V4SI, "stvxl_v4si", MEM) -+BU_ALTIVEC_X (STVXL_V8HI, "stvxl_v8hi", MEM) -+BU_ALTIVEC_X (STVXL_V16QI, "stvxl_v16qi", MEM) - BU_ALTIVEC_C (STVLX, "stvlx", MEM) - BU_ALTIVEC_C (STVLXL, "stvlxl", MEM) - BU_ALTIVEC_C (STVRX, "stvrx", MEM) -@@ -904,6 +1107,7 @@ - BU_VSX_3 (XVNMADDDP, "xvnmadddp", CONST, nfmav2df4) - BU_VSX_3 (XVNMSUBDP, "xvnmsubdp", CONST, nfmsv2df4) - -+BU_VSX_3 (XXSEL_1TI, "xxsel_1ti", CONST, vector_select_v1ti) - BU_VSX_3 (XXSEL_2DI, "xxsel_2di", CONST, vector_select_v2di) - BU_VSX_3 (XXSEL_2DF, "xxsel_2df", CONST, vector_select_v2df) - BU_VSX_3 (XXSEL_4SF, "xxsel_4sf", CONST, vector_select_v4sf) -@@ -910,11 +1114,13 @@ - BU_VSX_3 (XXSEL_4SI, "xxsel_4si", CONST, vector_select_v4si) - BU_VSX_3 (XXSEL_8HI, "xxsel_8hi", CONST, vector_select_v8hi) - BU_VSX_3 (XXSEL_16QI, "xxsel_16qi", CONST, vector_select_v16qi) -+BU_VSX_3 (XXSEL_1TI_UNS, "xxsel_1ti_uns", CONST, vector_select_v1ti_uns) - BU_VSX_3 (XXSEL_2DI_UNS, "xxsel_2di_uns", CONST, vector_select_v2di_uns) - BU_VSX_3 (XXSEL_4SI_UNS, "xxsel_4si_uns", CONST, vector_select_v4si_uns) - BU_VSX_3 (XXSEL_8HI_UNS, "xxsel_8hi_uns", CONST, vector_select_v8hi_uns) - BU_VSX_3 (XXSEL_16QI_UNS, "xxsel_16qi_uns", CONST, vector_select_v16qi_uns) - -+BU_VSX_3 (VPERM_1TI, "vperm_1ti", CONST, altivec_vperm_v1ti) - BU_VSX_3 (VPERM_2DI, "vperm_2di", CONST, altivec_vperm_v2di) - BU_VSX_3 (VPERM_2DF, "vperm_2df", CONST, altivec_vperm_v2df) - BU_VSX_3 (VPERM_4SF, "vperm_4sf", CONST, altivec_vperm_v4sf) -@@ -921,11 +1127,13 @@ - BU_VSX_3 (VPERM_4SI, "vperm_4si", CONST, altivec_vperm_v4si) - BU_VSX_3 (VPERM_8HI, "vperm_8hi", CONST, altivec_vperm_v8hi) - BU_VSX_3 (VPERM_16QI, "vperm_16qi", CONST, altivec_vperm_v16qi) -+BU_VSX_3 (VPERM_1TI_UNS, "vperm_1ti_uns", CONST, altivec_vperm_v1ti_uns) - BU_VSX_3 (VPERM_2DI_UNS, "vperm_2di_uns", CONST, altivec_vperm_v2di_uns) - BU_VSX_3 (VPERM_4SI_UNS, "vperm_4si_uns", CONST, altivec_vperm_v4si_uns) - BU_VSX_3 (VPERM_8HI_UNS, "vperm_8hi_uns", CONST, altivec_vperm_v8hi_uns) - BU_VSX_3 (VPERM_16QI_UNS, "vperm_16qi_uns", CONST, altivec_vperm_v16qi_uns) - -+BU_VSX_3 (XXPERMDI_1TI, "xxpermdi_1ti", CONST, vsx_xxpermdi_v1ti) - BU_VSX_3 (XXPERMDI_2DF, "xxpermdi_2df", CONST, vsx_xxpermdi_v2df) - BU_VSX_3 (XXPERMDI_2DI, "xxpermdi_2di", CONST, vsx_xxpermdi_v2di) - BU_VSX_3 (XXPERMDI_4SF, "xxpermdi_4sf", CONST, vsx_xxpermdi_v4sf) -@@ -932,6 +1140,7 @@ - BU_VSX_3 (XXPERMDI_4SI, "xxpermdi_4si", CONST, vsx_xxpermdi_v4si) - BU_VSX_3 (XXPERMDI_8HI, "xxpermdi_8hi", CONST, vsx_xxpermdi_v8hi) - BU_VSX_3 (XXPERMDI_16QI, "xxpermdi_16qi", CONST, vsx_xxpermdi_v16qi) -+BU_VSX_3 (SET_1TI, "set_1ti", CONST, vsx_set_v1ti) - BU_VSX_3 (SET_2DF, "set_2df", CONST, vsx_set_v2df) - BU_VSX_3 (SET_2DI, "set_2di", CONST, vsx_set_v2di) - BU_VSX_3 (XXSLDWI_2DI, "xxsldwi_2di", CONST, vsx_xxsldwi_v2di) -@@ -1012,7 +1221,7 @@ - BU_VSX_1 (XVRESP, "xvresp", CONST, vsx_frev4sf2) - - BU_VSX_1 (XSCVDPSP, "xscvdpsp", CONST, vsx_xscvdpsp) --BU_VSX_1 (XSCVSPDP, "xscvspdp", CONST, vsx_xscvdpsp) -+BU_VSX_1 (XSCVSPDP, "xscvspdp", CONST, vsx_xscvspdp) - BU_VSX_1 (XVCVDPSP, "xvcvdpsp", CONST, vsx_xvcvdpsp) - BU_VSX_1 (XVCVSPDP, "xvcvspdp", CONST, vsx_xvcvspdp) - BU_VSX_1 (XSTSQRTDP_FE, "xstsqrtdp_fe", CONST, vsx_tsqrtdf2_fe) -@@ -1052,9 +1261,9 @@ - - BU_VSX_1 (XSRDPI, "xsrdpi", CONST, vsx_xsrdpi) - BU_VSX_1 (XSRDPIC, "xsrdpic", CONST, vsx_xsrdpic) --BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, vsx_floordf2) --BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, vsx_ceildf2) --BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, vsx_btruncdf2) -+BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, floordf2) -+BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, ceildf2) -+BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, btruncdf2) - - /* VSX predicate functions. */ - BU_VSX_P (XVCMPEQSP_P, "xvcmpeqsp_p", CONST, vector_eq_v4sf_p) -@@ -1066,6 +1275,7 @@ - - /* VSX builtins that are handled as special cases. */ - BU_VSX_X (LXSDX, "lxsdx", MEM) -+BU_VSX_X (LXVD2X_V1TI, "lxvd2x_v1ti", MEM) - BU_VSX_X (LXVD2X_V2DF, "lxvd2x_v2df", MEM) - BU_VSX_X (LXVD2X_V2DI, "lxvd2x_v2di", MEM) - BU_VSX_X (LXVDSX, "lxvdsx", MEM) -@@ -1074,6 +1284,7 @@ - BU_VSX_X (LXVW4X_V8HI, "lxvw4x_v8hi", MEM) - BU_VSX_X (LXVW4X_V16QI, "lxvw4x_v16qi", MEM) - BU_VSX_X (STXSDX, "stxsdx", MEM) -+BU_VSX_X (STXVD2X_V1TI, "stxsdx_v1ti", MEM) - BU_VSX_X (STXVD2X_V2DF, "stxsdx_v2df", MEM) - BU_VSX_X (STXVD2X_V2DI, "stxsdx_v2di", MEM) - BU_VSX_X (STXVW4X_V4SF, "stxsdx_v4sf", MEM) -@@ -1104,10 +1315,13 @@ - BU_VSX_X (XSNMSUBADP, "xsnmsubadp", FP) - BU_VSX_X (XSNMSUBMDP, "xsnmsubmdp", FP) - BU_VSX_X (XSSUBDP, "xssubdp", FP) -+BU_VSX_X (VEC_INIT_V1TI, "vec_init_v1ti", CONST) - BU_VSX_X (VEC_INIT_V2DF, "vec_init_v2df", CONST) - BU_VSX_X (VEC_INIT_V2DI, "vec_init_v2di", CONST) -+BU_VSX_X (VEC_SET_V1TI, "vec_set_v1ti", CONST) - BU_VSX_X (VEC_SET_V2DF, "vec_set_v2df", CONST) - BU_VSX_X (VEC_SET_V2DI, "vec_set_v2di", CONST) -+BU_VSX_X (VEC_EXT_V1TI, "vec_ext_v1ti", CONST) - BU_VSX_X (VEC_EXT_V2DF, "vec_ext_v2df", CONST) - BU_VSX_X (VEC_EXT_V2DI, "vec_ext_v2di", CONST) - -@@ -1132,6 +1346,189 @@ - BU_VSX_OVERLOAD_X (LD, "ld") - BU_VSX_OVERLOAD_X (ST, "st") - -+/* 1 argument VSX instructions added in ISA 2.07. */ -+BU_P8V_VSX_1 (XSCVSPDPN, "xscvspdpn", CONST, vsx_xscvspdpn) -+BU_P8V_VSX_1 (XSCVDPSPN, "xscvdpspn", CONST, vsx_xscvdpspn) -+ -+/* 1 argument altivec instructions added in ISA 2.07. */ -+BU_P8V_AV_1 (ABS_V2DI, "abs_v2di", CONST, absv2di2) -+BU_P8V_AV_1 (VUPKHSW, "vupkhsw", CONST, altivec_vupkhsw) -+BU_P8V_AV_1 (VUPKLSW, "vupklsw", CONST, altivec_vupklsw) -+BU_P8V_AV_1 (VCLZB, "vclzb", CONST, clzv16qi2) -+BU_P8V_AV_1 (VCLZH, "vclzh", CONST, clzv8hi2) -+BU_P8V_AV_1 (VCLZW, "vclzw", CONST, clzv4si2) -+BU_P8V_AV_1 (VCLZD, "vclzd", CONST, clzv2di2) -+BU_P8V_AV_1 (VPOPCNTB, "vpopcntb", CONST, popcountv16qi2) -+BU_P8V_AV_1 (VPOPCNTH, "vpopcnth", CONST, popcountv8hi2) -+BU_P8V_AV_1 (VPOPCNTW, "vpopcntw", CONST, popcountv4si2) -+BU_P8V_AV_1 (VPOPCNTD, "vpopcntd", CONST, popcountv2di2) -+BU_P8V_AV_1 (VGBBD, "vgbbd", CONST, p8v_vgbbd) -+ -+/* 2 argument altivec instructions added in ISA 2.07. */ -+BU_P8V_AV_2 (VADDCUQ, "vaddcuq", CONST, altivec_vaddcuq) -+BU_P8V_AV_2 (VADDUDM, "vaddudm", CONST, addv2di3) -+BU_P8V_AV_2 (VADDUQM, "vadduqm", CONST, altivec_vadduqm) -+BU_P8V_AV_2 (VMINSD, "vminsd", CONST, sminv2di3) -+BU_P8V_AV_2 (VMAXSD, "vmaxsd", CONST, smaxv2di3) -+BU_P8V_AV_2 (VMINUD, "vminud", CONST, uminv2di3) -+BU_P8V_AV_2 (VMAXUD, "vmaxud", CONST, umaxv2di3) -+BU_P8V_AV_2 (VMRGEW, "vmrgew", CONST, p8_vmrgew) -+BU_P8V_AV_2 (VMRGOW, "vmrgow", CONST, p8_vmrgow) -+BU_P8V_AV_2 (VPKUDUM, "vpkudum", CONST, altivec_vpkudum) -+BU_P8V_AV_2 (VPKSDSS, "vpksdss", CONST, altivec_vpksdss) -+BU_P8V_AV_2 (VPKUDUS, "vpkudus", CONST, altivec_vpkudus) -+BU_P8V_AV_2 (VPKSDUS, "vpksdus", CONST, altivec_vpksdus) -+BU_P8V_AV_2 (VRLD, "vrld", CONST, vrotlv2di3) -+BU_P8V_AV_2 (VSLD, "vsld", CONST, vashlv2di3) -+BU_P8V_AV_2 (VSRD, "vsrd", CONST, vlshrv2di3) -+BU_P8V_AV_2 (VSRAD, "vsrad", CONST, vashrv2di3) -+BU_P8V_AV_2 (VSUBCUQ, "vsubcuq", CONST, altivec_vsubcuq) -+BU_P8V_AV_2 (VSUBUDM, "vsubudm", CONST, subv2di3) -+BU_P8V_AV_2 (VSUBUQM, "vsubuqm", CONST, altivec_vsubuqm) -+ -+BU_P8V_AV_2 (EQV_V16QI, "eqv_v16qi", CONST, eqvv16qi3) -+BU_P8V_AV_2 (EQV_V8HI, "eqv_v8hi", CONST, eqvv8hi3) -+BU_P8V_AV_2 (EQV_V4SI, "eqv_v4si", CONST, eqvv4si3) -+BU_P8V_AV_2 (EQV_V2DI, "eqv_v2di", CONST, eqvv2di3) -+BU_P8V_AV_2 (EQV_V1TI, "eqv_v1ti", CONST, eqvv1ti3) -+BU_P8V_AV_2 (EQV_V4SF, "eqv_v4sf", CONST, eqvv4sf3) -+BU_P8V_AV_2 (EQV_V2DF, "eqv_v2df", CONST, eqvv2df3) -+ -+BU_P8V_AV_2 (NAND_V16QI, "nand_v16qi", CONST, nandv16qi3) -+BU_P8V_AV_2 (NAND_V8HI, "nand_v8hi", CONST, nandv8hi3) -+BU_P8V_AV_2 (NAND_V4SI, "nand_v4si", CONST, nandv4si3) -+BU_P8V_AV_2 (NAND_V2DI, "nand_v2di", CONST, nandv2di3) -+BU_P8V_AV_2 (NAND_V1TI, "nand_v1ti", CONST, nandv1ti3) -+BU_P8V_AV_2 (NAND_V4SF, "nand_v4sf", CONST, nandv4sf3) -+BU_P8V_AV_2 (NAND_V2DF, "nand_v2df", CONST, nandv2df3) -+ -+BU_P8V_AV_2 (ORC_V16QI, "orc_v16qi", CONST, orcv16qi3) -+BU_P8V_AV_2 (ORC_V8HI, "orc_v8hi", CONST, orcv8hi3) -+BU_P8V_AV_2 (ORC_V4SI, "orc_v4si", CONST, orcv4si3) -+BU_P8V_AV_2 (ORC_V2DI, "orc_v2di", CONST, orcv2di3) -+BU_P8V_AV_2 (ORC_V1TI, "orc_v1ti", CONST, orcv1ti3) -+BU_P8V_AV_2 (ORC_V4SF, "orc_v4sf", CONST, orcv4sf3) -+BU_P8V_AV_2 (ORC_V2DF, "orc_v2df", CONST, orcv2df3) -+ -+/* 3 argument altivec instructions added in ISA 2.07. */ -+BU_P8V_AV_3 (VADDEUQM, "vaddeuqm", CONST, altivec_vaddeuqm) -+BU_P8V_AV_3 (VADDECUQ, "vaddecuq", CONST, altivec_vaddecuq) -+BU_P8V_AV_3 (VSUBEUQM, "vsubeuqm", CONST, altivec_vsubeuqm) -+BU_P8V_AV_3 (VSUBECUQ, "vsubecuq", CONST, altivec_vsubecuq) -+ -+/* Vector comparison instructions added in ISA 2.07. */ -+BU_P8V_AV_2 (VCMPEQUD, "vcmpequd", CONST, vector_eqv2di) -+BU_P8V_AV_2 (VCMPGTSD, "vcmpgtsd", CONST, vector_gtv2di) -+BU_P8V_AV_2 (VCMPGTUD, "vcmpgtud", CONST, vector_gtuv2di) -+ -+/* Vector comparison predicate instructions added in ISA 2.07. */ -+BU_P8V_AV_P (VCMPEQUD_P, "vcmpequd_p", CONST, vector_eq_v2di_p) -+BU_P8V_AV_P (VCMPGTSD_P, "vcmpgtsd_p", CONST, vector_gt_v2di_p) -+BU_P8V_AV_P (VCMPGTUD_P, "vcmpgtud_p", CONST, vector_gtu_v2di_p) -+ -+/* ISA 2.07 vector overloaded 1 argument functions. */ -+BU_P8V_OVERLOAD_1 (VUPKHSW, "vupkhsw") -+BU_P8V_OVERLOAD_1 (VUPKLSW, "vupklsw") -+BU_P8V_OVERLOAD_1 (VCLZ, "vclz") -+BU_P8V_OVERLOAD_1 (VCLZB, "vclzb") -+BU_P8V_OVERLOAD_1 (VCLZH, "vclzh") -+BU_P8V_OVERLOAD_1 (VCLZW, "vclzw") -+BU_P8V_OVERLOAD_1 (VCLZD, "vclzd") -+BU_P8V_OVERLOAD_1 (VPOPCNT, "vpopcnt") -+BU_P8V_OVERLOAD_1 (VPOPCNTB, "vpopcntb") -+BU_P8V_OVERLOAD_1 (VPOPCNTH, "vpopcnth") -+BU_P8V_OVERLOAD_1 (VPOPCNTW, "vpopcntw") -+BU_P8V_OVERLOAD_1 (VPOPCNTD, "vpopcntd") -+BU_P8V_OVERLOAD_1 (VGBBD, "vgbbd") -+ -+/* ISA 2.07 vector overloaded 2 argument functions. */ -+BU_P8V_OVERLOAD_2 (EQV, "eqv") -+BU_P8V_OVERLOAD_2 (NAND, "nand") -+BU_P8V_OVERLOAD_2 (ORC, "orc") -+BU_P8V_OVERLOAD_2 (VADDCUQ, "vaddcuq") -+BU_P8V_OVERLOAD_2 (VADDUDM, "vaddudm") -+BU_P8V_OVERLOAD_2 (VADDUQM, "vadduqm") -+BU_P8V_OVERLOAD_2 (VMAXSD, "vmaxsd") -+BU_P8V_OVERLOAD_2 (VMAXUD, "vmaxud") -+BU_P8V_OVERLOAD_2 (VMINSD, "vminsd") -+BU_P8V_OVERLOAD_2 (VMINUD, "vminud") -+BU_P8V_OVERLOAD_2 (VMRGEW, "vmrgew") -+BU_P8V_OVERLOAD_2 (VMRGOW, "vmrgow") -+BU_P8V_OVERLOAD_2 (VPKSDSS, "vpksdss") -+BU_P8V_OVERLOAD_2 (VPKSDUS, "vpksdus") -+BU_P8V_OVERLOAD_2 (VPKUDUM, "vpkudum") -+BU_P8V_OVERLOAD_2 (VPKUDUS, "vpkudus") -+BU_P8V_OVERLOAD_2 (VRLD, "vrld") -+BU_P8V_OVERLOAD_2 (VSLD, "vsld") -+BU_P8V_OVERLOAD_2 (VSRAD, "vsrad") -+BU_P8V_OVERLOAD_2 (VSRD, "vsrd") -+BU_P8V_OVERLOAD_2 (VSUBCUQ, "vsubcuq") -+BU_P8V_OVERLOAD_2 (VSUBUDM, "vsubudm") -+BU_P8V_OVERLOAD_2 (VSUBUQM, "vsubuqm") -+ -+/* ISA 2.07 vector overloaded 3 argument functions. */ -+BU_P8V_OVERLOAD_3 (VADDECUQ, "vaddecuq") -+BU_P8V_OVERLOAD_3 (VADDEUQM, "vaddeuqm") -+BU_P8V_OVERLOAD_3 (VSUBECUQ, "vsubecuq") -+BU_P8V_OVERLOAD_3 (VSUBEUQM, "vsubeuqm") -+ -+ -+/* 1 argument crypto functions. */ -+BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox) -+ -+/* 2 argument crypto functions. */ -+BU_CRYPTO_2 (VCIPHER, "vcipher", CONST, crypto_vcipher) -+BU_CRYPTO_2 (VCIPHERLAST, "vcipherlast", CONST, crypto_vcipherlast) -+BU_CRYPTO_2 (VNCIPHER, "vncipher", CONST, crypto_vncipher) -+BU_CRYPTO_2 (VNCIPHERLAST, "vncipherlast", CONST, crypto_vncipherlast) -+BU_CRYPTO_2 (VPMSUMB, "vpmsumb", CONST, crypto_vpmsumb) -+BU_CRYPTO_2 (VPMSUMH, "vpmsumh", CONST, crypto_vpmsumh) -+BU_CRYPTO_2 (VPMSUMW, "vpmsumw", CONST, crypto_vpmsumw) -+BU_CRYPTO_2 (VPMSUMD, "vpmsumd", CONST, crypto_vpmsumd) -+ -+/* 3 argument crypto functions. */ -+BU_CRYPTO_3 (VPERMXOR_V2DI, "vpermxor_v2di", CONST, crypto_vpermxor_v2di) -+BU_CRYPTO_3 (VPERMXOR_V4SI, "vpermxor_v4si", CONST, crypto_vpermxor_v4si) -+BU_CRYPTO_3 (VPERMXOR_V8HI, "vpermxor_v8hi", CONST, crypto_vpermxor_v8hi) -+BU_CRYPTO_3 (VPERMXOR_V16QI, "vpermxor_v16qi", CONST, crypto_vpermxor_v16qi) -+BU_CRYPTO_3 (VSHASIGMAW, "vshasigmaw", CONST, crypto_vshasigmaw) -+BU_CRYPTO_3 (VSHASIGMAD, "vshasigmad", CONST, crypto_vshasigmad) -+ -+/* 2 argument crypto overloaded functions. */ -+BU_CRYPTO_OVERLOAD_2 (VPMSUM, "vpmsum") -+ -+/* 3 argument crypto overloaded functions. */ -+BU_CRYPTO_OVERLOAD_3 (VPERMXOR, "vpermxor") -+BU_CRYPTO_OVERLOAD_3 (VSHASIGMA, "vshasigma") -+ -+ -+/* HTM functions. */ -+BU_HTM_1 (TABORT, "tabort", MISC, tabort) -+BU_HTM_3 (TABORTDC, "tabortdc", MISC, tabortdc) -+BU_HTM_3 (TABORTDCI, "tabortdci", MISC, tabortdci) -+BU_HTM_3 (TABORTWC, "tabortwc", MISC, tabortwc) -+BU_HTM_3 (TABORTWCI, "tabortwci", MISC, tabortwci) -+BU_HTM_1 (TBEGIN, "tbegin", MISC, tbegin) -+BU_HTM_1 (TCHECK, "tcheck", MISC, tcheck) -+BU_HTM_1 (TEND, "tend", MISC, tend) -+BU_HTM_0 (TENDALL, "tendall", MISC, tend) -+BU_HTM_0 (TRECHKPT, "trechkpt", MISC, trechkpt) -+BU_HTM_1 (TRECLAIM, "treclaim", MISC, treclaim) -+BU_HTM_0 (TRESUME, "tresume", MISC, tsr) -+BU_HTM_0 (TSUSPEND, "tsuspend", MISC, tsr) -+BU_HTM_1 (TSR, "tsr", MISC, tsr) -+BU_HTM_0 (TTEST, "ttest", MISC, ttest) -+ -+BU_HTM_SPR0 (GET_TFHAR, "get_tfhar", MISC, nothing) -+BU_HTM_SPR1 (SET_TFHAR, "set_tfhar", MISC, nothing) -+BU_HTM_SPR0 (GET_TFIAR, "get_tfiar", MISC, nothing) -+BU_HTM_SPR1 (SET_TFIAR, "set_tfiar", MISC, nothing) -+BU_HTM_SPR0 (GET_TEXASR, "get_texasr", MISC, nothing) -+BU_HTM_SPR1 (SET_TEXASR, "set_texasr", MISC, nothing) -+BU_HTM_SPR0 (GET_TEXASRU, "get_texasru", MISC, nothing) -+BU_HTM_SPR1 (SET_TEXASRU, "set_texasru", MISC, nothing) -+ -+ - /* 3 argument paired floating point builtins. */ - BU_PAIRED_3 (MSUB, "msub", FP, fmsv2sf4) - BU_PAIRED_3 (MADD, "madd", FP, fmav2sf4) -@@ -1430,10 +1827,10 @@ - RS6000_BTC_FP) - - BU_SPECIAL_X (RS6000_BUILTIN_GET_TB, "__builtin_ppc_get_timebase", -- RS6000_BTM_ALWAYS, RS6000_BTC_MISC) -+ RS6000_BTM_ALWAYS, RS6000_BTC_MISC) - - BU_SPECIAL_X (RS6000_BUILTIN_MFTB, "__builtin_ppc_mftb", -- RS6000_BTM_ALWAYS, RS6000_BTC_MISC) -+ RS6000_BTM_ALWAYS, RS6000_BTC_MISC) - - /* Darwin CfString builtin. */ - BU_SPECIAL_X (RS6000_BUILTIN_CFSTRING, "__builtin_cfstring", RS6000_BTM_ALWAYS, -Index: gcc/config/rs6000/rs6000-c.c -=================================================================== ---- a/src/gcc/config/rs6000/rs6000-c.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/rs6000-c.c (.../branches/gcc-4_8-branch) -@@ -90,6 +90,8 @@ - static GTY(()) tree __bool_keyword; - static GTY(()) tree bool_keyword; - static GTY(()) tree _Bool_keyword; -+static GTY(()) tree __int128_type; -+static GTY(()) tree __uint128_type; - - /* Preserved across calls. */ - static tree expand_bool_pixel; -@@ -122,9 +124,10 @@ - static void - init_vector_keywords (void) - { -- /* Keywords without two leading underscores are context-sensitive, -- and hence implemented as conditional macros, controlled by the -- rs6000_macro_to_expand() function below. */ -+ /* Keywords without two leading underscores are context-sensitive, and hence -+ implemented as conditional macros, controlled by the -+ rs6000_macro_to_expand() function below. If we have ISA 2.07 64-bit -+ support, record the __int128_t and __uint128_t types. */ - - __vector_keyword = get_identifier ("__vector"); - C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL; -@@ -146,6 +149,12 @@ - - _Bool_keyword = get_identifier ("_Bool"); - C_CPP_HASHNODE (_Bool_keyword)->flags |= NODE_CONDITIONAL; -+ -+ if (TARGET_VADDUQM) -+ { -+ __int128_type = get_identifier ("__int128_t"); -+ __uint128_type = get_identifier ("__uint128_t"); -+ } - } - - /* Called to decide whether a conditional macro should be expanded. -@@ -221,7 +230,8 @@ - || rid_code == RID_SHORT || rid_code == RID_SIGNED - || rid_code == RID_INT || rid_code == RID_CHAR - || rid_code == RID_FLOAT -- || (rid_code == RID_DOUBLE && TARGET_VSX)) -+ || (rid_code == RID_DOUBLE && TARGET_VSX) -+ || (rid_code == RID_INT128 && TARGET_VADDUQM)) - { - expand_this = C_CPP_HASHNODE (__vector_keyword); - /* If the next keyword is bool or pixel, it -@@ -248,6 +258,13 @@ - expand_bool_pixel = __bool_keyword; - } - } -+ -+ /* Support vector __int128_t, but we don't need to worry about bool -+ or pixel on this type. */ -+ else if (TARGET_VADDUQM -+ && (ident == C_CPP_HASHNODE (__int128_type) -+ || ident == C_CPP_HASHNODE (__uint128_type))) -+ expand_this = C_CPP_HASHNODE (__vector_keyword); - } - } - else if (expand_bool_pixel && ident == C_CPP_HASHNODE (__pixel_keyword)) -@@ -315,6 +332,8 @@ - rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6X"); - if ((flags & OPTION_MASK_POPCNTD) != 0) - rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7"); -+ if ((flags & OPTION_MASK_DIRECT_MOVE) != 0) -+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8"); - if ((flags & OPTION_MASK_SOFT_FLOAT) != 0) - rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT"); - if ((flags & OPTION_MASK_RECIP_PRECISION) != 0) -@@ -331,6 +350,16 @@ - } - if ((flags & OPTION_MASK_VSX) != 0) - rs6000_define_or_undefine_macro (define_p, "__VSX__"); -+ if ((flags & OPTION_MASK_HTM) != 0) -+ rs6000_define_or_undefine_macro (define_p, "__HTM__"); -+ if ((flags & OPTION_MASK_P8_VECTOR) != 0) -+ rs6000_define_or_undefine_macro (define_p, "__POWER8_VECTOR__"); -+ if ((flags & OPTION_MASK_QUAD_MEMORY) != 0) -+ rs6000_define_or_undefine_macro (define_p, "__QUAD_MEMORY__"); -+ if ((flags & OPTION_MASK_QUAD_MEMORY_ATOMIC) != 0) -+ rs6000_define_or_undefine_macro (define_p, "__QUAD_MEMORY_ATOMIC__"); -+ if ((flags & OPTION_MASK_CRYPTO) != 0) -+ rs6000_define_or_undefine_macro (define_p, "__CRYPTO__"); - - /* options from the builtin masks. */ - if ((bu_mask & RS6000_BTM_SPE) != 0) -@@ -453,7 +482,11 @@ - case ABI_AIX: - builtin_define ("_CALL_AIXDESC"); - builtin_define ("_CALL_AIX"); -+ builtin_define ("_CALL_ELF=1"); - break; -+ case ABI_ELFv2: -+ builtin_define ("_CALL_ELF=2"); -+ break; - case ABI_DARWIN: - builtin_define ("_CALL_DARWIN"); - break; -@@ -465,6 +498,13 @@ - if (TARGET_SOFT_FLOAT || !TARGET_FPRS) - builtin_define ("__NO_FPRS__"); - -+ /* Whether aggregates passed by value are aligned to a 16 byte boundary -+ if their alignment is 16 bytes or larger. */ -+ if ((TARGET_MACHO && rs6000_darwin64_abi) -+ || DEFAULT_ABI == ABI_ELFv2 -+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) -+ builtin_define ("__STRUCT_PARM_ALIGN__=16"); -+ - /* Generate defines for Xilinx FPU. */ - if (rs6000_xilinx_fpu) - { -@@ -505,6 +545,8 @@ - RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ABS, P8V_BUILTIN_ABS_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_ABS, VSX_BUILTIN_XVABSDP, -@@ -577,6 +619,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHSH, - RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHPX, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_pixel_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH, -@@ -583,6 +629,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH, - RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX, -@@ -601,6 +651,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_UNPACKL, ALTIVEC_BUILTIN_VUPKLSH, - RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW, -+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, -+ { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX, -@@ -651,10 +705,27 @@ - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUWM, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_ADD, VSX_BUILTIN_XVADDDP, - RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, - { ALTIVEC_BUILTIN_VEC_VADDFP, ALTIVEC_BUILTIN_VADDFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_VADDUWM, ALTIVEC_BUILTIN_VADDUWM, -@@ -937,6 +1008,10 @@ - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQUW, - RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQFP, - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPEQ, VSX_BUILTIN_XVCMPEQDP, -@@ -975,6 +1050,10 @@ - RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTSW, - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTUD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTSD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTFP, - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPGT, VSX_BUILTIN_XVCMPGTDP, -@@ -1021,6 +1100,10 @@ - RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTSW, - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTUD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTSD, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTFP, - RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_CMPLT, VSX_BUILTIN_XVCMPGTDP, -@@ -1045,54 +1128,54 @@ - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { VSX_BUILTIN_VEC_DIV, VSX_BUILTIN_XVDIVDP, - RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V2DF, - RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V2DI, - RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V2DI, - RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_unsigned_V2DI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V2DI, - RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V2DI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SF, - RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SF, - RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_long, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V8HI, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V16QI, - RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V16QI, - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V16QI, - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V16QI, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX, -+ { ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX_V16QI, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, - { ALTIVEC_BUILTIN_VEC_LDE, ALTIVEC_BUILTIN_LVEBX, - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, -@@ -1130,55 +1213,55 @@ - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, - { ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF, - RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF, - RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_long, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, - RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, - RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, - ~RS6000_BTI_unsigned_V16QI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DF, - RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, - RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, - RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_unsigned_V2DI, 0 }, -- { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL, -+ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, - RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_LVSL, ALTIVEC_BUILTIN_LVSL, - RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, -@@ -1418,6 +1501,18 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXSW, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_MAX, VSX_BUILTIN_XVMAXDP, -@@ -1604,6 +1699,18 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINSW, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_MIN, VSX_BUILTIN_XVMINDP, -@@ -1786,6 +1893,12 @@ - RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_PACK, ALTIVEC_BUILTIN_VPKUWUM, - RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM, - RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM, -@@ -1812,6 +1925,10 @@ - RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKUDUS, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKSDSS, -+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKSHSS, ALTIVEC_BUILTIN_VPKSHSS, - RS6000_BTI_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKUHUS, ALTIVEC_BUILTIN_VPKUHUS, -@@ -1824,6 +1941,8 @@ - RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_PACKSU, ALTIVEC_BUILTIN_VPKSWUS, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKSDUS, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKSWUS, ALTIVEC_BUILTIN_VPKSWUS, - RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VPKSHUS, ALTIVEC_BUILTIN_VPKSHUS, -@@ -1844,6 +1963,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_RL, ALTIVEC_BUILTIN_VRLW, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW, -@@ -1868,6 +1991,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_SL, ALTIVEC_BUILTIN_VSLW, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTDP, - RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 }, - { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTSP, -@@ -2032,6 +2159,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_SR, ALTIVEC_BUILTIN_VSRW, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW, -@@ -2056,6 +2187,10 @@ - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_SRA, ALTIVEC_BUILTIN_VSRAW, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRAD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW, - RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW, -@@ -2196,10 +2331,27 @@ - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 }, - { ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBUWM, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_SUB, VSX_BUILTIN_XVSUBDP, - RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, - { ALTIVEC_BUILTIN_VEC_VSUBFP, ALTIVEC_BUILTIN_VSUBFP, - RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, - { ALTIVEC_BUILTIN_VEC_VSUBUWM, ALTIVEC_BUILTIN_VSUBUWM, -@@ -2730,63 +2882,63 @@ - RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_NOT_OPAQUE }, - { ALTIVEC_BUILTIN_VEC_SLD, ALTIVEC_BUILTIN_VSLDOI_16QI, - RS6000_BTI_bool_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_NOT_OPAQUE }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DF, - RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DI, - RS6000_BTI_void, RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DI, - RS6000_BTI_void, RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_unsigned_V2DI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DI, - RS6000_BTI_void, RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_bool_V2DI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SF, - RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SF, - RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI }, -- { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX, -+ { ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V8HI, - RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI }, - { ALTIVEC_BUILTIN_VEC_STE, ALTIVEC_BUILTIN_STVEBX, - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI }, -@@ -2858,64 +3010,64 @@ - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void }, - { ALTIVEC_BUILTIN_VEC_STVEBX, ALTIVEC_BUILTIN_STVEBX, - RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_void }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SF, - RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SF, - RS6000_BTI_void, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V4SI, - RS6000_BTI_void, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V16QI, - RS6000_BTI_void, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V8HI, - RS6000_BTI_void, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V2DF, - RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V2DF, - RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V2DI, - RS6000_BTI_void, RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V2DI, - RS6000_BTI_void, RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_unsigned_V2DI }, -- { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL, -+ { ALTIVEC_BUILTIN_VEC_STL, ALTIVEC_BUILTIN_STVXL_V2DI, - RS6000_BTI_void, RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, - ~RS6000_BTI_bool_V2DI }, - { ALTIVEC_BUILTIN_VEC_STVLX, ALTIVEC_BUILTIN_STVLX, -@@ -3327,6 +3479,20 @@ - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI }, - { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P, - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI }, - { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P, - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF }, - { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P, -@@ -3372,11 +3538,503 @@ - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI }, - { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P, - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI }, -+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI }, - { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P, - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF }, - { ALTIVEC_BUILTIN_VEC_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P, - RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF }, - -+ /* Power8 vector overloaded functions. */ -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SF, -+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, -+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DF, -+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -+ -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SF, -+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, -+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DF, -+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -+ -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_bool_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_bool_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_bool_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SF, -+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 }, -+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DF, -+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, -+ -+ { P8V_BUILTIN_VEC_VADDCUQ, P8V_BUILTIN_VADDCUQ, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { P8V_BUILTIN_VEC_VADDCUQ, P8V_BUILTIN_VADDCUQ, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VADDUQM, P8V_BUILTIN_VADDUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { P8V_BUILTIN_VEC_VADDUQM, P8V_BUILTIN_VADDUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VADDECUQ, P8V_BUILTIN_VADDECUQ, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI }, -+ { P8V_BUILTIN_VEC_VADDECUQ, P8V_BUILTIN_VADDECUQ, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI }, -+ -+ { P8V_BUILTIN_VEC_VADDEUQM, P8V_BUILTIN_VADDEUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI }, -+ { P8V_BUILTIN_VEC_VADDEUQM, P8V_BUILTIN_VADDEUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI }, -+ -+ { P8V_BUILTIN_VEC_VSUBECUQ, P8V_BUILTIN_VSUBECUQ, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI }, -+ { P8V_BUILTIN_VEC_VSUBECUQ, P8V_BUILTIN_VSUBECUQ, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI }, -+ -+ { P8V_BUILTIN_VEC_VSUBEUQM, P8V_BUILTIN_VSUBEUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI }, -+ { P8V_BUILTIN_VEC_VSUBEUQM, P8V_BUILTIN_VSUBEUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI }, -+ -+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 }, -+ { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB, -+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH, -+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW, -+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM, -+ RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPKSDSS, P8V_BUILTIN_VPKSDSS, -+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPKUDUS, P8V_BUILTIN_VPKUDUS, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VPKSDUS, P8V_BUILTIN_VPKSDUS, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRAD, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSUBCUQ, P8V_BUILTIN_VSUBCUQ, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBCUQ, P8V_BUILTIN_VSUBCUQ, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VSUBUQM, P8V_BUILTIN_VSUBUQM, -+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, 0 }, -+ { P8V_BUILTIN_VEC_VSUBUQM, P8V_BUILTIN_VSUBUQM, -+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V1TI, -+ RS6000_BTI_unsigned_V1TI, 0 }, -+ -+ { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW, -+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 }, -+ { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW, -+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 }, -+ -+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, -+ RS6000_BTI_V16QI, 0, 0, 0 }, -+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD, -+ RS6000_BTI_unsigned_V16QI, 0, 0, 0 }, -+ -+ /* Crypto builtins. */ -+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI }, -+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI }, -+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI }, -+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI }, -+ -+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMB, -+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V16QI, 0 }, -+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMH, -+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, -+ RS6000_BTI_unsigned_V8HI, 0 }, -+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_unsigned_V4SI, 0 }, -+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_unsigned_V2DI, 0 }, -+ -+ { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAW, -+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI }, -+ { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAD, -+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, -+ RS6000_BTI_INTSI, RS6000_BTI_INTSI }, -+ - { (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 } - }; - -@@ -3560,6 +4218,10 @@ - unsigned_p = TYPE_UNSIGNED (type); - switch (TYPE_MODE (type)) - { -+ case TImode: -+ type = (unsigned_p ? unsigned_V1TI_type_node : V1TI_type_node); -+ size = 1; -+ break; - case DImode: - type = (unsigned_p ? unsigned_V2DI_type_node : V2DI_type_node); - size = 2; -@@ -3591,7 +4253,7 @@ - return build_constructor (type, vec); - } - -- /* For now use pointer tricks to do the extaction, unless we are on VSX -+ /* For now use pointer tricks to do the extraction, unless we are on VSX - extracting a double from a constant offset. */ - if (fcode == ALTIVEC_BUILTIN_VEC_EXTRACT) - { -@@ -3619,6 +4281,17 @@ - if (!INTEGRAL_TYPE_P (TREE_TYPE (arg2))) - goto bad; - -+ /* If we are targeting little-endian, but -maltivec=be has been -+ specified to override the element order, adjust the element -+ number accordingly. */ -+ if (!BYTES_BIG_ENDIAN && rs6000_altivec_element_order == 2) -+ { -+ unsigned int last_elem = TYPE_VECTOR_SUBPARTS (arg1_type) - 1; -+ arg2 = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (arg2), -+ build_int_cstu (TREE_TYPE (arg2), last_elem), -+ arg2); -+ } -+ - /* If we can use the VSX xxpermdi instruction, use that for extract. */ - mode = TYPE_MODE (arg1_type); - if ((mode == V2DFmode || mode == V2DImode) && VECTOR_MEM_VSX_P (mode) -@@ -3636,6 +4309,14 @@ - if (call) - return build_call_expr (call, 2, arg1, arg2); - } -+ else if (mode == V1TImode && VECTOR_MEM_VSX_P (mode) -+ && TREE_CODE (arg2) == INTEGER_CST -+ && TREE_INT_CST_HIGH (arg2) == 0 -+ && TREE_INT_CST_LOW (arg2) == 0) -+ { -+ tree call = rs6000_builtin_decls[VSX_BUILTIN_VEC_EXT_V1TI]; -+ return build_call_expr (call, 2, arg1, arg2); -+ } - - /* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2). */ - arg1_inner_type = TREE_TYPE (arg1_type); -@@ -3666,7 +4347,7 @@ - return stmt; - } - -- /* For now use pointer tricks to do the insertation, unless we are on VSX -+ /* For now use pointer tricks to do the insertion, unless we are on VSX - inserting a double to a constant offset.. */ - if (fcode == ALTIVEC_BUILTIN_VEC_INSERT) - { -@@ -3696,6 +4377,17 @@ - if (!INTEGRAL_TYPE_P (TREE_TYPE (arg2))) - goto bad; - -+ /* If we are targeting little-endian, but -maltivec=be has been -+ specified to override the element order, adjust the element -+ number accordingly. */ -+ if (!BYTES_BIG_ENDIAN && rs6000_altivec_element_order == 2) -+ { -+ unsigned int last_elem = TYPE_VECTOR_SUBPARTS (arg1_type) - 1; -+ arg2 = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (arg2), -+ build_int_cstu (TREE_TYPE (arg2), last_elem), -+ arg2); -+ } -+ - /* If we can use the VSX xxpermdi instruction, use that for insert. */ - mode = TYPE_MODE (arg1_type); - if ((mode == V2DFmode || mode == V2DImode) && VECTOR_UNIT_VSX_P (mode) -@@ -3715,7 +4407,18 @@ - if (call) - return build_call_expr (call, 3, arg1, arg0, arg2); - } -+ else if (mode == V1TImode && VECTOR_UNIT_VSX_P (mode) -+ && TREE_CODE (arg2) == INTEGER_CST -+ && TREE_INT_CST_HIGH (arg2) == 0 -+ && TREE_INT_CST_LOW (arg2) == 0) -+ { -+ tree call = rs6000_builtin_decls[VSX_BUILTIN_VEC_SET_V1TI]; - -+ /* Note, __builtin_vec_insert_<xxx> has vector and scalar types -+ reversed. */ -+ return build_call_expr (call, 3, arg1, arg0, arg2); -+ } -+ - /* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2) = arg0. */ - arg1_inner_type = TREE_TYPE (arg1_type); - arg2 = build_binary_op (loc, BIT_AND_EXPR, arg2, -@@ -3824,7 +4527,8 @@ - && (desc->op2 == RS6000_BTI_NOT_OPAQUE - || rs6000_builtin_type_compatible (types[1], desc->op2)) - && (desc->op3 == RS6000_BTI_NOT_OPAQUE -- || rs6000_builtin_type_compatible (types[2], desc->op3))) -+ || rs6000_builtin_type_compatible (types[2], desc->op3)) -+ && rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE) - return altivec_build_resolved_builtin (args, n, desc); - - bad: -Index: gcc/config/rs6000/rs6000.opt -=================================================================== ---- a/src/gcc/config/rs6000/rs6000.opt (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/rs6000.opt (.../branches/gcc-4_8-branch) -@@ -1,6 +1,6 @@ - ; Options for the rs6000 port of the compiler - ; --; Copyright (C) 2005-2013 Free Software Foundation, Inc. -+; Copyright (C) 2005-2014 Free Software Foundation, Inc. - ; Contributed by Aldy Hernandez <aldy@quesejoda.com>. - ; - ; This file is part of GCC. -@@ -137,6 +137,14 @@ - Target Report Mask(ALTIVEC) Var(rs6000_isa_flags) - Use AltiVec instructions - -+maltivec=le -+Target Report RejectNegative Var(rs6000_altivec_element_order, 1) Save -+Generate Altivec instructions using little-endian element order -+ -+maltivec=be -+Target Report RejectNegative Var(rs6000_altivec_element_order, 2) -+Generate Altivec instructions using big-endian element order -+ - mhard-dfp - Target Report Mask(DFP) Var(rs6000_isa_flags) - Use decimal floating point instructions -@@ -181,13 +189,16 @@ - Target Report Mask(VSX) Var(rs6000_isa_flags) - Use vector/scalar (VSX) instructions - -+mvsx-scalar-float -+Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1) -+; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default) -+ - mvsx-scalar-double --Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(-1) --; If -mvsx, use VSX arithmetic instructions for scalar double (on by default) -+Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(1) -+; If -mvsx, use VSX arithmetic instructions for DFmode (on by default) - - mvsx-scalar-memory --Target Undocumented Report Var(TARGET_VSX_SCALAR_MEMORY) --; If -mvsx, use VSX scalar memory reference instructions for scalar double (off by default) -+Target Undocumented Report Alias(mupper-regs-df) - - mvsx-align-128 - Target Undocumented Report Var(TARGET_VSX_ALIGN_128) -@@ -363,6 +374,14 @@ - Target RejectNegative Var(rs6000_spe_abi, 0) - Do not use the SPE ABI extensions - -+mabi=elfv1 -+Target RejectNegative Var(rs6000_elf_abi, 1) Save -+Use the ELFv1 ABI -+ -+mabi=elfv2 -+Target RejectNegative Var(rs6000_elf_abi, 2) -+Use the ELFv2 ABI -+ - ; These are here for testing during development only, do not document - ; in the manual please. - -@@ -443,6 +462,10 @@ - Target RejectNegative Joined UInteger Var(rs6000_long_double_type_size) Save - -mlong-double-<n> Specify size of long double (64 or 128 bits) - -+mlra -+Target Report Var(rs6000_lra_flag) Init(0) Save -+Use LRA instead of reload -+ - msched-costly-dep= - Target RejectNegative Joined Var(rs6000_sched_costly_dep_str) - Determine which dependences between insns are considered costly -@@ -514,3 +537,51 @@ - msave-toc-indirect - Target Report Var(TARGET_SAVE_TOC_INDIRECT) Save - Control whether we save the TOC in the prologue for indirect calls or generate the save inline -+ -+mvsx-timode -+Target Undocumented Mask(VSX_TIMODE) Var(rs6000_isa_flags) -+Allow 128-bit integers in VSX registers -+ -+mpower8-fusion -+Target Report Mask(P8_FUSION) Var(rs6000_isa_flags) -+Fuse certain integer operations together for better performance on power8 -+ -+mpower8-fusion-sign -+Target Undocumented Mask(P8_FUSION_SIGN) Var(rs6000_isa_flags) -+Allow sign extension in fusion operations -+ -+mpower8-vector -+Target Report Mask(P8_VECTOR) Var(rs6000_isa_flags) -+Use/do not use vector and scalar instructions added in ISA 2.07. -+ -+mcrypto -+Target Report Mask(CRYPTO) Var(rs6000_isa_flags) -+Use ISA 2.07 crypto instructions -+ -+mdirect-move -+Target Report Mask(DIRECT_MOVE) Var(rs6000_isa_flags) -+Use ISA 2.07 direct move between GPR & VSX register instructions -+ -+mhtm -+Target Report Mask(HTM) Var(rs6000_isa_flags) -+Use ISA 2.07 transactional memory (HTM) instructions -+ -+mquad-memory -+Target Report Mask(QUAD_MEMORY) Var(rs6000_isa_flags) -+Generate the quad word memory instructions (lq/stq). -+ -+mquad-memory-atomic -+Target Report Mask(QUAD_MEMORY_ATOMIC) Var(rs6000_isa_flags) -+Generate the quad word memory atomic instructions (lqarx/stqcx). -+ -+mcompat-align-parm -+Target Report Var(rs6000_compat_align_parm) Init(1) Save -+Generate aggregate parameter passing code with at most 64-bit alignment. -+ -+mupper-regs-df -+Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags) -+Allow double variables in upper registers with -mcpu=power7 or -mvsx -+ -+mupper-regs-sf -+Target Undocumented Mask(UPPER_REGS_SF) Var(rs6000_isa_flags) -+Allow float variables in upper registers with -mcpu=power8 or -mp8-vector -Index: gcc/config/rs6000/linux64.h -=================================================================== ---- a/src/gcc/config/rs6000/linux64.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/linux64.h (.../branches/gcc-4_8-branch) -@@ -25,9 +25,6 @@ - - #ifndef RS6000_BI_ARCH - --#undef DEFAULT_ABI --#define DEFAULT_ABI ABI_AIX -- - #undef TARGET_64BIT - #define TARGET_64BIT 1 - -@@ -74,7 +71,11 @@ - #undef PROCESSOR_DEFAULT - #define PROCESSOR_DEFAULT PROCESSOR_POWER7 - #undef PROCESSOR_DEFAULT64 -+#ifdef LINUX64_DEFAULT_ABI_ELFv2 -+#define PROCESSOR_DEFAULT64 PROCESSOR_POWER8 -+#else - #define PROCESSOR_DEFAULT64 PROCESSOR_POWER7 -+#endif - - /* We don't need to generate entries in .fixup, except when - -mrelocatable or -mrelocatable-lib is given. */ -@@ -88,6 +89,12 @@ - #define INVALID_64BIT "-m%s not supported in this configuration" - #define INVALID_32BIT INVALID_64BIT - -+#ifdef LINUX64_DEFAULT_ABI_ELFv2 -+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1) -+#else -+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2) -+#endif -+ - #undef SUBSUBTARGET_OVERRIDE_OPTIONS - #define SUBSUBTARGET_OVERRIDE_OPTIONS \ - do \ -@@ -102,6 +109,12 @@ - error (INVALID_64BIT, "call"); \ - } \ - dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \ -+ if (ELFv2_ABI_CHECK) \ -+ { \ -+ rs6000_current_abi = ABI_ELFv2; \ -+ if (dot_symbols) \ -+ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \ -+ } \ - if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ - { \ - rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ -@@ -136,8 +149,11 @@ - SET_CMODEL (CMODEL_MEDIUM); \ - if (rs6000_current_cmodel != CMODEL_SMALL) \ - { \ -- TARGET_NO_FP_IN_TOC = 0; \ -- TARGET_NO_SUM_IN_TOC = 0; \ -+ if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \ -+ TARGET_NO_FP_IN_TOC \ -+ = rs6000_current_cmodel == CMODEL_MEDIUM; \ -+ if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \ -+ TARGET_NO_SUM_IN_TOC = 0; \ - } \ - } \ - } \ -@@ -351,7 +367,11 @@ - #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" - - #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" --#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1" -+#ifdef LINUX64_DEFAULT_ABI_ELFv2 -+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}" -+#else -+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}" -+#endif - #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" - #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" - #if DEFAULT_LIBC == LIBC_UCLIBC -Index: gcc/config/rs6000/darwin.h -=================================================================== ---- a/src/gcc/config/rs6000/darwin.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/darwin.h (.../branches/gcc-4_8-branch) -@@ -205,7 +205,8 @@ - "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", \ - "vrsave", "vscr", \ - "spe_acc", "spefscr", \ -- "sfp" \ -+ "sfp", \ -+ "tfhar", "tfiar", "texasr" \ - } - - /* This outputs NAME to FILE. */ +@@ -622,20 +622,13 @@ + | RS6000_BTC_TERNARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + +-/* Miscellaneous builtins. */ +-#define BU_MISC_1(ENUM, NAME, ATTR, ICODE) \ ++/* 128-bit long double floating point builtins. */ ++#define BU_LDBL128_2(ENUM, NAME, ATTR, ICODE) \ + RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ + "__builtin_" NAME, /* NAME */ \ +- RS6000_BTM_HARD_FLOAT, /* MASK */ \ ++ (RS6000_BTM_HARD_FLOAT /* MASK */ \ ++ | RS6000_BTM_LDBL128), \ + (RS6000_BTC_ ## ATTR /* ATTR */ \ +- | RS6000_BTC_UNARY), \ +- CODE_FOR_ ## ICODE) /* ICODE */ +- +-#define BU_MISC_2(ENUM, NAME, ATTR, ICODE) \ +- RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ +- "__builtin_" NAME, /* NAME */ \ +- RS6000_BTM_HARD_FLOAT, /* MASK */ \ +- (RS6000_BTC_ ## ATTR /* ATTR */ \ + | RS6000_BTC_BINARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + +@@ -1593,10 +1586,8 @@ + BU_DFP_MISC_2 (PACK_TD, "pack_dec128", CONST, packtd) + BU_DFP_MISC_2 (UNPACK_TD, "unpack_dec128", CONST, unpacktd) + +-BU_MISC_2 (PACK_TF, "pack_longdouble", CONST, packtf) +-BU_MISC_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) +-BU_MISC_1 (UNPACK_TF_0, "longdouble_dw0", CONST, unpacktf_0) +-BU_MISC_1 (UNPACK_TF_1, "longdouble_dw1", CONST, unpacktf_1) ++BU_LDBL128_2 (PACK_TF, "pack_longdouble", CONST, packtf) ++BU_LDBL128_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) + + BU_P7_MISC_2 (PACK_V1TI, "pack_vector_int128", CONST, packv1ti) + BU_P7_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST, unpackv1ti) Index: gcc/config/rs6000/rs6000.c =================================================================== ---- a/src/gcc/config/rs6000/rs6000.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/rs6000.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/rs6000.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - /* Subroutines used for code generation on IBM RS/6000. -- Copyright (C) 1991-2013 Free Software Foundation, Inc. -+ Copyright (C) 1991-2014 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - - This file is part of GCC. -@@ -56,6 +56,7 @@ - #include "intl.h" - #include "params.h" - #include "tm-constrs.h" -+#include "ira.h" - #include "opts.h" - #include "tree-vectorizer.h" - #include "dumpfile.h" -@@ -96,6 +97,7 @@ - int spe_gp_save_offset; /* offset to save spe 64-bit gprs */ - int varargs_save_offset; /* offset to save the varargs registers */ - int ehrd_offset; /* offset to EH return data */ -+ int ehcr_offset; /* offset to EH CR field data */ - int reg_size; /* register size (4 or 8) */ - HOST_WIDE_INT vars_size; /* variable save area size */ - int parm_size; /* outgoing parameter size */ -@@ -139,6 +141,8 @@ - 64-bits wide and is allocated early enough so that the offset - does not overflow the 16-bit load/store offset field. */ - rtx sdmode_stack_slot; -+ /* Flag if r2 setup is needed with ELFv2 ABI. */ -+ bool r2_setup_needed; - } machine_function; - - /* Support targetm.vectorize.builtin_mask_for_load. */ -@@ -189,9 +193,6 @@ - /* Map register number to register class. */ - enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER]; - --/* Reload functions based on the type and the vector unit. */ --static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2]; -- - static int dbg_cost_ctrl; - - /* Built in types. */ -@@ -289,6 +290,105 @@ - don't link in rs6000-c.c, so we can't call it directly. */ - void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT); - -+/* Simplfy register classes into simpler classifications. We assume -+ GPR_REG_TYPE - FPR_REG_TYPE are ordered so that we can use a simple range -+ check for standard register classes (gpr/floating/altivec/vsx) and -+ floating/vector classes (float/altivec/vsx). */ -+ -+enum rs6000_reg_type { -+ NO_REG_TYPE, -+ PSEUDO_REG_TYPE, -+ GPR_REG_TYPE, -+ VSX_REG_TYPE, -+ ALTIVEC_REG_TYPE, -+ FPR_REG_TYPE, -+ SPR_REG_TYPE, -+ CR_REG_TYPE, -+ SPE_ACC_TYPE, -+ SPEFSCR_REG_TYPE -+}; -+ -+/* Map register class to register type. */ -+static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES]; -+ -+/* First/last register type for the 'normal' register types (i.e. general -+ purpose, floating point, altivec, and VSX registers). */ -+#define IS_STD_REG_TYPE(RTYPE) IN_RANGE(RTYPE, GPR_REG_TYPE, FPR_REG_TYPE) -+ -+#define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE) -+ -+ -+/* Register classes we care about in secondary reload or go if legitimate -+ address. We only need to worry about GPR, FPR, and Altivec registers here, -+ along an ANY field that is the OR of the 3 register classes. */ -+ -+enum rs6000_reload_reg_type { -+ RELOAD_REG_GPR, /* General purpose registers. */ -+ RELOAD_REG_FPR, /* Traditional floating point regs. */ -+ RELOAD_REG_VMX, /* Altivec (VMX) registers. */ -+ RELOAD_REG_ANY, /* OR of GPR, FPR, Altivec masks. */ -+ N_RELOAD_REG -+}; -+ -+/* For setting up register classes, loop through the 3 register classes mapping -+ into real registers, and skip the ANY class, which is just an OR of the -+ bits. */ -+#define FIRST_RELOAD_REG_CLASS RELOAD_REG_GPR -+#define LAST_RELOAD_REG_CLASS RELOAD_REG_VMX -+ -+/* Map reload register type to a register in the register class. */ -+struct reload_reg_map_type { -+ const char *name; /* Register class name. */ -+ int reg; /* Register in the register class. */ -+}; -+ -+static const struct reload_reg_map_type reload_reg_map[N_RELOAD_REG] = { -+ { "Gpr", FIRST_GPR_REGNO }, /* RELOAD_REG_GPR. */ -+ { "Fpr", FIRST_FPR_REGNO }, /* RELOAD_REG_FPR. */ -+ { "VMX", FIRST_ALTIVEC_REGNO }, /* RELOAD_REG_VMX. */ -+ { "Any", -1 }, /* RELOAD_REG_ANY. */ -+}; -+ -+/* Mask bits for each register class, indexed per mode. Historically the -+ compiler has been more restrictive which types can do PRE_MODIFY instead of -+ PRE_INC and PRE_DEC, so keep track of sepaate bits for these two. */ -+typedef unsigned char addr_mask_type; -+ -+#define RELOAD_REG_VALID 0x01 /* Mode valid in register.. */ -+#define RELOAD_REG_MULTIPLE 0x02 /* Mode takes multiple registers. */ -+#define RELOAD_REG_INDEXED 0x04 /* Reg+reg addressing. */ -+#define RELOAD_REG_OFFSET 0x08 /* Reg+offset addressing. */ -+#define RELOAD_REG_PRE_INCDEC 0x10 /* PRE_INC/PRE_DEC valid. */ -+#define RELOAD_REG_PRE_MODIFY 0x20 /* PRE_MODIFY valid. */ -+ -+/* Register type masks based on the type, of valid addressing modes. */ -+struct rs6000_reg_addr { -+ enum insn_code reload_load; /* INSN to reload for loading. */ -+ enum insn_code reload_store; /* INSN to reload for storing. */ -+ enum insn_code reload_fpr_gpr; /* INSN to move from FPR to GPR. */ -+ enum insn_code reload_gpr_vsx; /* INSN to move from GPR to VSX. */ -+ enum insn_code reload_vsx_gpr; /* INSN to move from VSX to GPR. */ -+ addr_mask_type addr_mask[(int)N_RELOAD_REG]; /* Valid address masks. */ -+}; -+ -+static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES]; -+ -+/* Helper function to say whether a mode supports PRE_INC or PRE_DEC. */ -+static inline bool -+mode_supports_pre_incdec_p (enum machine_mode mode) -+{ -+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC) -+ != 0); -+} -+ -+/* Helper function to say whether a mode supports PRE_MODIFY. */ -+static inline bool -+mode_supports_pre_modify_p (enum machine_mode mode) -+{ -+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY) -+ != 0); -+} -+ - - /* Target cpu costs. */ - -@@ -828,6 +928,25 @@ - 12, /* prefetch streams */ - }; - -+/* Instruction costs on POWER8 processors. */ -+static const -+struct processor_costs power8_cost = { -+ COSTS_N_INSNS (3), /* mulsi */ -+ COSTS_N_INSNS (3), /* mulsi_const */ -+ COSTS_N_INSNS (3), /* mulsi_const9 */ -+ COSTS_N_INSNS (3), /* muldi */ -+ COSTS_N_INSNS (19), /* divsi */ -+ COSTS_N_INSNS (35), /* divdi */ -+ COSTS_N_INSNS (3), /* fp */ -+ COSTS_N_INSNS (3), /* dmul */ -+ COSTS_N_INSNS (14), /* sdiv */ -+ COSTS_N_INSNS (17), /* ddiv */ -+ 128, /* cache line size */ -+ 32, /* l1 cache */ -+ 256, /* l2 cache */ -+ 12, /* prefetch streams */ -+}; -+ - /* Instruction costs on POWER A2 processors. */ - static const - struct processor_costs ppca2_cost = { -@@ -855,6 +974,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -878,6 +998,9 @@ - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \ - { NAME, ICODE, MASK, ATTR }, - -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \ -+ { NAME, ICODE, MASK, ATTR }, -+ - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \ - { NAME, ICODE, MASK, ATTR }, - -@@ -908,6 +1031,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -948,6 +1072,7 @@ - static void paired_init_builtins (void); - static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx); - static void spe_init_builtins (void); -+static void htm_init_builtins (void); - static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx); - static rtx spe_expand_evsel_builtin (enum insn_code, tree, rtx); - static int rs6000_emit_int_cmove (rtx, rtx, rtx, rtx); -@@ -1020,6 +1145,13 @@ - static void rs6000_print_builtin_options (FILE *, int, const char *, - HOST_WIDE_INT); - -+static enum rs6000_reg_type register_to_reg_type (rtx, bool *); -+static bool rs6000_secondary_reload_move (enum rs6000_reg_type, -+ enum rs6000_reg_type, -+ enum machine_mode, -+ secondary_reload_info *, -+ bool); -+ - /* Hash table stuff for keeping track of TOC entries. */ - - struct GTY(()) toc_hash_struct -@@ -1068,7 +1200,9 @@ - /* SPE registers. */ - "spe_acc", "spefscr", - /* Soft frame pointer. */ -- "sfp" -+ "sfp", -+ /* HTM SPR registers. */ -+ "tfhar", "tfiar", "texasr" - }; - - #ifdef TARGET_REGNAMES -@@ -1094,7 +1228,9 @@ - /* SPE registers. */ - "spe_acc", "spefscr", - /* Soft frame pointer. */ -- "sfp" -+ "sfp", -+ /* HTM SPR registers. */ -+ "tfhar", "tfiar", "texasr" - }; - #endif - -@@ -1316,6 +1452,9 @@ - #undef TARGET_RETURN_IN_MEMORY - #define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory - -+#undef TARGET_RETURN_IN_MSB -+#define TARGET_RETURN_IN_MSB rs6000_return_in_msb -+ - #undef TARGET_SETUP_INCOMING_VARARGS - #define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs - -@@ -1425,6 +1564,9 @@ - #undef TARGET_MODE_DEPENDENT_ADDRESS_P - #define TARGET_MODE_DEPENDENT_ADDRESS_P rs6000_mode_dependent_address_p - -+#undef TARGET_LRA_P -+#define TARGET_LRA_P rs6000_lra_p -+ - #undef TARGET_CAN_ELIMINATE - #define TARGET_CAN_ELIMINATE rs6000_can_eliminate - -@@ -1513,8 +1655,9 @@ - { - unsigned HOST_WIDE_INT reg_size; - -+ /* TF/TD modes are special in that they always take 2 registers. */ - if (FP_REGNO_P (regno)) -- reg_size = (VECTOR_MEM_VSX_P (mode) -+ reg_size = ((VECTOR_MEM_VSX_P (mode) && mode != TDmode && mode != TFmode) - ? UNITS_PER_VSX_WORD - : UNITS_PER_FP_WORD); - -@@ -1546,16 +1689,39 @@ - { - int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1; - -+ /* PTImode can only go in GPRs. Quad word memory operations require even/odd -+ register combinations, and use PTImode where we need to deal with quad -+ word memory operations. Don't allow quad words in the argument or frame -+ pointer registers, just registers 0..31. */ -+ if (mode == PTImode) -+ return (IN_RANGE (regno, FIRST_GPR_REGNO, LAST_GPR_REGNO) -+ && IN_RANGE (last_regno, FIRST_GPR_REGNO, LAST_GPR_REGNO) -+ && ((regno & 1) == 0)); -+ - /* VSX registers that overlap the FPR registers are larger than for non-VSX - implementations. Don't allow an item to be split between a FP register -- and an Altivec register. */ -- if (VECTOR_MEM_VSX_P (mode)) -+ and an Altivec register. Allow TImode in all VSX registers if the user -+ asked for it. */ -+ if (TARGET_VSX && VSX_REGNO_P (regno) -+ && (VECTOR_MEM_VSX_P (mode) -+ || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode) -+ || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode)) -+ || (TARGET_VSX_TIMODE && mode == TImode) -+ || (TARGET_VADDUQM && mode == V1TImode))) - { - if (FP_REGNO_P (regno)) - return FP_REGNO_P (last_regno); - - if (ALTIVEC_REGNO_P (regno)) -- return ALTIVEC_REGNO_P (last_regno); -+ { -+ if (mode == SFmode && !TARGET_UPPER_REGS_SF) -+ return 0; -+ -+ if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF) -+ return 0; -+ -+ return ALTIVEC_REGNO_P (last_regno); -+ } - } - - /* The GPRs can hold any mode, but values bigger than one register -@@ -1564,10 +1730,12 @@ - return INT_REGNO_P (last_regno); - - /* The float registers (except for VSX vector modes) can only hold floating -- modes and DImode. This excludes the 32-bit decimal float mode for -- now. */ -+ modes and DImode. */ - if (FP_REGNO_P (regno)) - { -+ if (TARGET_SOFT_FLOAT || !TARGET_FPRS) -+ return 0; -+ - if (SCALAR_FLOAT_MODE_P (mode) - && (mode != TDmode || (regno % 2) == 0) - && FP_REGNO_P (last_regno)) -@@ -1593,16 +1761,12 @@ - - /* AltiVec only in AldyVec registers. */ - if (ALTIVEC_REGNO_P (regno)) -- return VECTOR_MEM_ALTIVEC_OR_VSX_P (mode); -+ return (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) -+ || mode == V1TImode); - -- /* ...but GPRs can hold SIMD data on the SPE in one register. */ -- if (SPE_SIMD_REGNO_P (regno) && TARGET_SPE && SPE_VECTOR_MODE (mode)) -- return 1; -+ /* We cannot put non-VSX TImode or PTImode anywhere except general register -+ and it must be able to fit within the register set. */ - -- /* We cannot put TImode anywhere except general register and it must be able -- to fit within the register set. In the future, allow TImode in the -- Altivec or VSX registers. */ -- - return GET_MODE_SIZE (mode) <= UNITS_PER_WORD; - } - -@@ -1674,10 +1838,77 @@ - comma = ""; - } - -+ len += fprintf (stderr, "%sreg-class = %s", comma, -+ reg_class_names[(int)rs6000_regno_regclass[r]]); -+ comma = ", "; -+ -+ if (len > 70) -+ { -+ fprintf (stderr, ",\n\t"); -+ comma = ""; -+ } -+ - fprintf (stderr, "%sregno = %d\n", comma, r); - } - } - -+static const char * -+rs6000_debug_vector_unit (enum rs6000_vector v) -+{ -+ const char *ret; -+ -+ switch (v) -+ { -+ case VECTOR_NONE: ret = "none"; break; -+ case VECTOR_ALTIVEC: ret = "altivec"; break; -+ case VECTOR_VSX: ret = "vsx"; break; -+ case VECTOR_P8_VECTOR: ret = "p8_vector"; break; -+ case VECTOR_PAIRED: ret = "paired"; break; -+ case VECTOR_SPE: ret = "spe"; break; -+ case VECTOR_OTHER: ret = "other"; break; -+ default: ret = "unknown"; break; -+ } -+ -+ return ret; -+} -+ -+/* Print the address masks in a human readble fashion. */ -+DEBUG_FUNCTION void -+rs6000_debug_print_mode (ssize_t m) -+{ -+ ssize_t rc; -+ -+ fprintf (stderr, "Mode: %-5s", GET_MODE_NAME (m)); -+ for (rc = 0; rc < N_RELOAD_REG; rc++) -+ { -+ addr_mask_type mask = reg_addr[m].addr_mask[rc]; -+ fprintf (stderr, -+ " %s: %c%c%c%c%c%c", -+ reload_reg_map[rc].name, -+ (mask & RELOAD_REG_VALID) != 0 ? 'v' : ' ', -+ (mask & RELOAD_REG_MULTIPLE) != 0 ? 'm' : ' ', -+ (mask & RELOAD_REG_INDEXED) != 0 ? 'i' : ' ', -+ (mask & RELOAD_REG_OFFSET) != 0 ? 'o' : ' ', -+ (mask & RELOAD_REG_PRE_INCDEC) != 0 ? '+' : ' ', -+ (mask & RELOAD_REG_PRE_MODIFY) != 0 ? '+' : ' '); -+ } -+ -+ if (rs6000_vector_unit[m] != VECTOR_NONE -+ || rs6000_vector_mem[m] != VECTOR_NONE -+ || (reg_addr[m].reload_store != CODE_FOR_nothing) -+ || (reg_addr[m].reload_load != CODE_FOR_nothing)) -+ { -+ fprintf (stderr, -+ " Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c", -+ rs6000_debug_vector_unit (rs6000_vector_unit[m]), -+ rs6000_debug_vector_unit (rs6000_vector_mem[m]), -+ (reg_addr[m].reload_store != CODE_FOR_nothing) ? 's' : '*', -+ (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*'); -+ } -+ -+ fputs ("\n", stderr); -+} -+ - #define DEBUG_FMT_ID "%-32s= " - #define DEBUG_FMT_D DEBUG_FMT_ID "%d\n" - #define DEBUG_FMT_WX DEBUG_FMT_ID "%#.12" HOST_WIDE_INT_PRINT "x: " -@@ -1690,6 +1921,7 @@ - static const char *const tf[2] = { "false", "true" }; - const char *nl = (const char *)0; - int m; -+ size_t m1, m2, v; - char costly_num[20]; - char nop_num[20]; - char flags_buffer[40]; -@@ -1700,20 +1932,69 @@ - const char *cmodel_str; - struct cl_target_option cl_opts; - -- /* Map enum rs6000_vector to string. */ -- static const char *rs6000_debug_vector_unit[] = { -- "none", -- "altivec", -- "vsx", -- "paired", -- "spe", -- "other" -+ /* Modes we want tieable information on. */ -+ static const enum machine_mode print_tieable_modes[] = { -+ QImode, -+ HImode, -+ SImode, -+ DImode, -+ TImode, -+ PTImode, -+ SFmode, -+ DFmode, -+ TFmode, -+ SDmode, -+ DDmode, -+ TDmode, -+ V8QImode, -+ V4HImode, -+ V2SImode, -+ V16QImode, -+ V8HImode, -+ V4SImode, -+ V2DImode, -+ V1TImode, -+ V32QImode, -+ V16HImode, -+ V8SImode, -+ V4DImode, -+ V2TImode, -+ V2SFmode, -+ V4SFmode, -+ V2DFmode, -+ V8SFmode, -+ V4DFmode, -+ CCmode, -+ CCUNSmode, -+ CCEQmode, - }; - -- fprintf (stderr, "Register information: (last virtual reg = %d)\n", -- LAST_VIRTUAL_REGISTER); -- rs6000_debug_reg_print (0, 31, "gr"); -- rs6000_debug_reg_print (32, 63, "fp"); -+ /* Virtual regs we are interested in. */ -+ const static struct { -+ int regno; /* register number. */ -+ const char *name; /* register name. */ -+ } virtual_regs[] = { -+ { STACK_POINTER_REGNUM, "stack pointer:" }, -+ { TOC_REGNUM, "toc: " }, -+ { STATIC_CHAIN_REGNUM, "static chain: " }, -+ { RS6000_PIC_OFFSET_TABLE_REGNUM, "pic offset: " }, -+ { HARD_FRAME_POINTER_REGNUM, "hard frame: " }, -+ { ARG_POINTER_REGNUM, "arg pointer: " }, -+ { FRAME_POINTER_REGNUM, "frame pointer:" }, -+ { FIRST_PSEUDO_REGISTER, "first pseudo: " }, -+ { FIRST_VIRTUAL_REGISTER, "first virtual:" }, -+ { VIRTUAL_INCOMING_ARGS_REGNUM, "incoming_args:" }, -+ { VIRTUAL_STACK_VARS_REGNUM, "stack_vars: " }, -+ { VIRTUAL_STACK_DYNAMIC_REGNUM, "stack_dynamic:" }, -+ { VIRTUAL_OUTGOING_ARGS_REGNUM, "outgoing_args:" }, -+ { VIRTUAL_CFA_REGNUM, "cfa (frame): " }, -+ { VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM, "stack boundry:" }, -+ { LAST_VIRTUAL_REGISTER, "last virtual: " }, -+ }; -+ -+ fputs ("\nHard register information:\n", stderr); -+ rs6000_debug_reg_print (FIRST_GPR_REGNO, LAST_GPR_REGNO, "gr"); -+ rs6000_debug_reg_print (FIRST_FPR_REGNO, LAST_FPR_REGNO, "fp"); - rs6000_debug_reg_print (FIRST_ALTIVEC_REGNO, - LAST_ALTIVEC_REGNO, - "vs"); -@@ -1726,6 +2007,10 @@ - rs6000_debug_reg_print (SPE_ACC_REGNO, SPE_ACC_REGNO, "spe_a"); - rs6000_debug_reg_print (SPEFSCR_REGNO, SPEFSCR_REGNO, "spe_f"); - -+ fputs ("\nVirtual/stack/frame registers:\n", stderr); -+ for (v = 0; v < ARRAY_SIZE (virtual_regs); v++) -+ fprintf (stderr, "%s regno = %3d\n", virtual_regs[v].name, virtual_regs[v].regno); -+ - fprintf (stderr, - "\n" - "d reg_class = %s\n" -@@ -1734,7 +2019,19 @@ - "wa reg_class = %s\n" - "wd reg_class = %s\n" - "wf reg_class = %s\n" -- "ws reg_class = %s\n\n", -+ "wg reg_class = %s\n" -+ "wl reg_class = %s\n" -+ "wm reg_class = %s\n" -+ "wr reg_class = %s\n" -+ "ws reg_class = %s\n" -+ "wt reg_class = %s\n" -+ "wu reg_class = %s\n" -+ "wv reg_class = %s\n" -+ "ww reg_class = %s\n" -+ "wx reg_class = %s\n" -+ "wy reg_class = %s\n" -+ "wz reg_class = %s\n" -+ "\n", - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_d]], - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_f]], - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_v]], -@@ -1741,18 +2038,51 @@ - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wa]], - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wd]], - reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wf]], -- reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]]); -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wg]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wl]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wm]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wu]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wv]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ww]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wy]], -+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wz]]); - -+ nl = "\n"; - for (m = 0; m < NUM_MACHINE_MODES; ++m) -- if (rs6000_vector_unit[m] || rs6000_vector_mem[m]) -- { -- nl = "\n"; -- fprintf (stderr, "Vector mode: %-5s arithmetic: %-8s move: %-8s\n", -- GET_MODE_NAME (m), -- rs6000_debug_vector_unit[ rs6000_vector_unit[m] ], -- rs6000_debug_vector_unit[ rs6000_vector_mem[m] ]); -- } -+ rs6000_debug_print_mode (m); - -+ fputs ("\n", stderr); -+ -+ for (m1 = 0; m1 < ARRAY_SIZE (print_tieable_modes); m1++) -+ { -+ enum machine_mode mode1 = print_tieable_modes[m1]; -+ bool first_time = true; -+ -+ nl = (const char *)0; -+ for (m2 = 0; m2 < ARRAY_SIZE (print_tieable_modes); m2++) -+ { -+ enum machine_mode mode2 = print_tieable_modes[m2]; -+ if (mode1 != mode2 && MODES_TIEABLE_P (mode1, mode2)) -+ { -+ if (first_time) -+ { -+ fprintf (stderr, "Tieable modes %s:", GET_MODE_NAME (mode1)); -+ nl = "\n"; -+ first_time = false; -+ } -+ -+ fprintf (stderr, " %s", GET_MODE_NAME (mode2)); -+ } -+ } -+ -+ if (!first_time) -+ fputs ("\n", stderr); -+ } -+ - if (nl) - fputs (nl, stderr); - -@@ -1913,6 +2243,7 @@ - { - case ABI_NONE: abi_str = "none"; break; - case ABI_AIX: abi_str = "aix"; break; -+ case ABI_ELFv2: abi_str = "ELFv2"; break; - case ABI_V4: abi_str = "V4"; break; - case ABI_DARWIN: abi_str = "darwin"; break; - default: abi_str = "unknown"; break; -@@ -1935,6 +2266,13 @@ - if (TARGET_LINK_STACK) - fprintf (stderr, DEBUG_FMT_S, "link_stack", "true"); - -+ if (targetm.lra_p ()) -+ fprintf (stderr, DEBUG_FMT_S, "lra", "true"); -+ -+ if (TARGET_P8_FUSION) -+ fprintf (stderr, DEBUG_FMT_S, "p8 fusion", -+ (TARGET_P8_FUSION_SIGN) ? "zero+sign" : "zero"); -+ - fprintf (stderr, DEBUG_FMT_S, "plt-format", - TARGET_SECURE_PLT ? "secure" : "bss"); - fprintf (stderr, DEBUG_FMT_S, "struct-return", -@@ -1954,11 +2292,106 @@ - (int)RS6000_BUILTIN_COUNT); - } - -+ -+/* Update the addr mask bits in reg_addr to help secondary reload and go if -+ legitimate address support to figure out the appropriate addressing to -+ use. */ -+ -+static void -+rs6000_setup_reg_addr_masks (void) -+{ -+ ssize_t rc, reg, m, nregs; -+ addr_mask_type any_addr_mask, addr_mask; -+ -+ for (m = 0; m < NUM_MACHINE_MODES; ++m) -+ { -+ /* SDmode is special in that we want to access it only via REG+REG -+ addressing on power7 and above, since we want to use the LFIWZX and -+ STFIWZX instructions to load it. */ -+ bool indexed_only_p = (m == SDmode && TARGET_NO_SDMODE_STACK); -+ -+ any_addr_mask = 0; -+ for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++) -+ { -+ addr_mask = 0; -+ reg = reload_reg_map[rc].reg; -+ -+ /* Can mode values go in the GPR/FPR/Altivec registers? */ -+ if (reg >= 0 && rs6000_hard_regno_mode_ok_p[m][reg]) -+ { -+ nregs = rs6000_hard_regno_nregs[m][reg]; -+ addr_mask |= RELOAD_REG_VALID; -+ -+ /* Indicate if the mode takes more than 1 physical register. If -+ it takes a single register, indicate it can do REG+REG -+ addressing. */ -+ if (nregs > 1 || m == BLKmode) -+ addr_mask |= RELOAD_REG_MULTIPLE; -+ else -+ addr_mask |= RELOAD_REG_INDEXED; -+ -+ /* Figure out if we can do PRE_INC, PRE_DEC, or PRE_MODIFY -+ addressing. Restrict addressing on SPE for 64-bit types -+ because of the SUBREG hackery used to address 64-bit floats in -+ '32-bit' GPRs. To simplify secondary reload, don't allow -+ update forms on scalar floating point types that can go in the -+ upper registers. */ -+ -+ if (TARGET_UPDATE -+ && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR) -+ && GET_MODE_SIZE (m) <= 8 -+ && !VECTOR_MODE_P (m) -+ && !COMPLEX_MODE_P (m) -+ && !indexed_only_p -+ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m) == 8) -+ && !(m == DFmode && TARGET_UPPER_REGS_DF) -+ && !(m == SFmode && TARGET_UPPER_REGS_SF)) -+ { -+ addr_mask |= RELOAD_REG_PRE_INCDEC; -+ -+ /* PRE_MODIFY is more restricted than PRE_INC/PRE_DEC in that -+ we don't allow PRE_MODIFY for some multi-register -+ operations. */ -+ switch (m) -+ { -+ default: -+ addr_mask |= RELOAD_REG_PRE_MODIFY; -+ break; -+ -+ case DImode: -+ if (TARGET_POWERPC64) -+ addr_mask |= RELOAD_REG_PRE_MODIFY; -+ break; -+ -+ case DFmode: -+ case DDmode: -+ if (TARGET_DF_INSN) -+ addr_mask |= RELOAD_REG_PRE_MODIFY; -+ break; -+ } -+ } -+ } -+ -+ /* GPR and FPR registers can do REG+OFFSET addressing, except -+ possibly for SDmode. */ -+ if ((addr_mask != 0) && !indexed_only_p -+ && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR)) -+ addr_mask |= RELOAD_REG_OFFSET; -+ -+ reg_addr[m].addr_mask[rc] = addr_mask; -+ any_addr_mask |= addr_mask; -+ } -+ -+ reg_addr[m].addr_mask[RELOAD_REG_ANY] = any_addr_mask; -+ } -+} -+ -+ - /* Initialize the various global tables that are based on register size. */ - static void - rs6000_init_hard_regno_mode_ok (bool global_init_p) - { -- int r, m, c; -+ ssize_t r, m, c; - int align64; - int align32; - -@@ -1987,21 +2420,55 @@ - rs6000_regno_regclass[VSCR_REGNO] = VRSAVE_REGS; - rs6000_regno_regclass[SPE_ACC_REGNO] = SPE_ACC_REGS; - rs6000_regno_regclass[SPEFSCR_REGNO] = SPEFSCR_REGS; -+ rs6000_regno_regclass[TFHAR_REGNO] = SPR_REGS; -+ rs6000_regno_regclass[TFIAR_REGNO] = SPR_REGS; -+ rs6000_regno_regclass[TEXASR_REGNO] = SPR_REGS; - rs6000_regno_regclass[ARG_POINTER_REGNUM] = BASE_REGS; - rs6000_regno_regclass[FRAME_POINTER_REGNUM] = BASE_REGS; - -- /* Precalculate vector information, this must be set up before the -- rs6000_hard_regno_nregs_internal below. */ -- for (m = 0; m < NUM_MACHINE_MODES; ++m) -+ /* Precalculate register class to simpler reload register class. We don't -+ need all of the register classes that are combinations of different -+ classes, just the simple ones that have constraint letters. */ -+ for (c = 0; c < N_REG_CLASSES; c++) -+ reg_class_to_reg_type[c] = NO_REG_TYPE; -+ -+ reg_class_to_reg_type[(int)GENERAL_REGS] = GPR_REG_TYPE; -+ reg_class_to_reg_type[(int)BASE_REGS] = GPR_REG_TYPE; -+ reg_class_to_reg_type[(int)VSX_REGS] = VSX_REG_TYPE; -+ reg_class_to_reg_type[(int)VRSAVE_REGS] = SPR_REG_TYPE; -+ reg_class_to_reg_type[(int)VSCR_REGS] = SPR_REG_TYPE; -+ reg_class_to_reg_type[(int)LINK_REGS] = SPR_REG_TYPE; -+ reg_class_to_reg_type[(int)CTR_REGS] = SPR_REG_TYPE; -+ reg_class_to_reg_type[(int)LINK_OR_CTR_REGS] = SPR_REG_TYPE; -+ reg_class_to_reg_type[(int)CR_REGS] = CR_REG_TYPE; -+ reg_class_to_reg_type[(int)CR0_REGS] = CR_REG_TYPE; -+ reg_class_to_reg_type[(int)SPE_ACC_REGS] = SPE_ACC_TYPE; -+ reg_class_to_reg_type[(int)SPEFSCR_REGS] = SPEFSCR_REG_TYPE; -+ -+ if (TARGET_VSX) - { -- rs6000_vector_unit[m] = rs6000_vector_mem[m] = VECTOR_NONE; -- rs6000_vector_reload[m][0] = CODE_FOR_nothing; -- rs6000_vector_reload[m][1] = CODE_FOR_nothing; -+ reg_class_to_reg_type[(int)FLOAT_REGS] = VSX_REG_TYPE; -+ reg_class_to_reg_type[(int)ALTIVEC_REGS] = VSX_REG_TYPE; - } -+ else -+ { -+ reg_class_to_reg_type[(int)FLOAT_REGS] = FPR_REG_TYPE; -+ reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE; -+ } - -- for (c = 0; c < (int)(int)RS6000_CONSTRAINT_MAX; c++) -- rs6000_constraints[c] = NO_REGS; -+ /* Precalculate the valid memory formats as well as the vector information, -+ this must be set up before the rs6000_hard_regno_nregs_internal calls -+ below. */ -+ gcc_assert ((int)VECTOR_NONE == 0); -+ memset ((void *) &rs6000_vector_unit[0], '\0', sizeof (rs6000_vector_unit)); -+ memset ((void *) &rs6000_vector_mem[0], '\0', sizeof (rs6000_vector_unit)); - -+ gcc_assert ((int)CODE_FOR_nothing == 0); -+ memset ((void *) ®_addr[0], '\0', sizeof (reg_addr)); -+ -+ gcc_assert ((int)NO_REGS == 0); -+ memset ((void *) &rs6000_constraints[0], '\0', sizeof (rs6000_constraints)); -+ - /* The VSX hardware allows native alignment for vectors, but control whether the compiler - believes it can use native alignment or still uses 128-bit alignment. */ - if (TARGET_VSX && !TARGET_VSX_ALIGN_128) -@@ -2062,13 +2529,19 @@ - } - } - -- /* V2DImode, only allow under VSX, which can do V2DI insert/splat/extract. -- Altivec doesn't have 64-bit support. */ -+ /* V2DImode, full mode depends on ISA 2.07 vector mode. Allow under VSX to -+ do insert/splat/extract. Altivec doesn't have 64-bit integer support. */ - if (TARGET_VSX) - { - rs6000_vector_mem[V2DImode] = VECTOR_VSX; -- rs6000_vector_unit[V2DImode] = VECTOR_NONE; -+ rs6000_vector_unit[V2DImode] -+ = (TARGET_P8_VECTOR) ? VECTOR_P8_VECTOR : VECTOR_NONE; - rs6000_vector_align[V2DImode] = align64; -+ -+ rs6000_vector_mem[V1TImode] = VECTOR_VSX; -+ rs6000_vector_unit[V1TImode] -+ = (TARGET_P8_VECTOR) ? VECTOR_P8_VECTOR : VECTOR_NONE; -+ rs6000_vector_align[V1TImode] = 128; - } - - /* DFmode, see if we want to use the VSX unit. */ -@@ -2076,14 +2549,48 @@ - { - rs6000_vector_unit[DFmode] = VECTOR_VSX; - rs6000_vector_mem[DFmode] -- = (TARGET_VSX_SCALAR_MEMORY ? VECTOR_VSX : VECTOR_NONE); -+ = (TARGET_UPPER_REGS_DF ? VECTOR_VSX : VECTOR_NONE); - rs6000_vector_align[DFmode] = align64; - } - -+ /* Allow TImode in VSX register and set the VSX memory macros. */ -+ if (TARGET_VSX && TARGET_VSX_TIMODE) -+ { -+ rs6000_vector_mem[TImode] = VECTOR_VSX; -+ rs6000_vector_align[TImode] = align64; -+ } -+ - /* TODO add SPE and paired floating point vector support. */ - - /* Register class constraints for the constraints that depend on compile -- switches. */ -+ switches. When the VSX code was added, different constraints were added -+ based on the type (DFmode, V2DFmode, V4SFmode). For the vector types, all -+ of the VSX registers are used. The register classes for scalar floating -+ point types is set, based on whether we allow that type into the upper -+ (Altivec) registers. GCC has register classes to target the Altivec -+ registers for load/store operations, to select using a VSX memory -+ operation instead of the traditional floating point operation. The -+ constraints are: -+ -+ d - Register class to use with traditional DFmode instructions. -+ f - Register class to use with traditional SFmode instructions. -+ v - Altivec register. -+ wa - Any VSX register. -+ wd - Preferred register class for V2DFmode. -+ wf - Preferred register class for V4SFmode. -+ wg - Float register for power6x move insns. -+ wl - Float register if we can do 32-bit signed int loads. -+ wm - VSX register for ISA 2.07 direct move operations. -+ wr - GPR if 64-bit mode is permitted. -+ ws - Register class to do ISA 2.06 DF operations. -+ wu - Altivec register for ISA 2.07 VSX SF/SI load/stores. -+ wv - Altivec register for ISA 2.06 VSX DF/DI load/stores. -+ wt - VSX register for TImode in VSX registers. -+ ww - Register class to do SF conversions in with VSX operations. -+ wx - Float register if we can do 32-bit int stores. -+ wy - Register class to do ISA 2.07 SF operations. -+ wz - Float register if we can do 32-bit unsigned int loads. */ -+ - if (TARGET_HARD_FLOAT && TARGET_FPRS) - rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS; - -@@ -2092,64 +2599,164 @@ - - if (TARGET_VSX) - { -- /* At present, we just use VSX_REGS, but we have different constraints -- based on the use, in case we want to fine tune the default register -- class used. wa = any VSX register, wf = register class to use for -- V4SF, wd = register class to use for V2DF, and ws = register classs to -- use for DF scalars. */ - rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS; -+ rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS; - rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS; -- rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS; -- rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY -- ? VSX_REGS -- : FLOAT_REGS); -+ -+ if (TARGET_VSX_TIMODE) -+ rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS; -+ -+ if (TARGET_UPPER_REGS_DF) -+ { -+ rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS; -+ rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS; -+ } -+ else -+ rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS; - } - -+ /* Add conditional constraints based on various options, to allow us to -+ collapse multiple insn patterns. */ - if (TARGET_ALTIVEC) - rs6000_constraints[RS6000_CONSTRAINT_v] = ALTIVEC_REGS; - -- /* Set up the reload helper functions. */ -+ if (TARGET_MFPGPR) -+ rs6000_constraints[RS6000_CONSTRAINT_wg] = FLOAT_REGS; -+ -+ if (TARGET_LFIWAX) -+ rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS; -+ -+ if (TARGET_DIRECT_MOVE) -+ rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS; -+ -+ if (TARGET_POWERPC64) -+ rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS; -+ -+ if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF) -+ { -+ rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS; -+ rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS; -+ rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS; -+ } -+ else if (TARGET_P8_VECTOR) -+ { -+ rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS; -+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS; -+ } -+ else if (TARGET_VSX) -+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS; -+ -+ if (TARGET_STFIWX) -+ rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS; -+ -+ if (TARGET_LFIWZX) -+ rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS; -+ -+ /* Set up the reload helper and direct move functions. */ - if (TARGET_VSX || TARGET_ALTIVEC) - { - if (TARGET_64BIT) - { -- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_di_store; -- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_di_load; -- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_di_store; -- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_di_load; -- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_di_store; -- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_di_load; -- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_di_store; -- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_di_load; -- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_di_store; -- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_di_load; -- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_di_store; -- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_di_load; -- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY) -+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_di_store; -+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_di_load; -+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_di_store; -+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_di_load; -+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_di_store; -+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_di_load; -+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_di_store; -+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_di_load; -+ reg_addr[V1TImode].reload_store = CODE_FOR_reload_v1ti_di_store; -+ reg_addr[V1TImode].reload_load = CODE_FOR_reload_v1ti_di_load; -+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_di_store; -+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_di_load; -+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_di_store; -+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_di_load; -+ if (TARGET_VSX && TARGET_UPPER_REGS_DF) - { -- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_di_store; -- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_di_load; -+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store; -+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load; -+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store; -+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load; - } -+ if (TARGET_P8_VECTOR) -+ { -+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_di_store; -+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_di_load; -+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_di_store; -+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_di_load; -+ } -+ if (TARGET_VSX_TIMODE) -+ { -+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_di_store; -+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_di_load; -+ } -+ if (TARGET_DIRECT_MOVE) -+ { -+ if (TARGET_POWERPC64) -+ { -+ reg_addr[TImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxti; -+ reg_addr[V1TImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv1ti; -+ reg_addr[V2DFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2df; -+ reg_addr[V2DImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2di; -+ reg_addr[V4SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4sf; -+ reg_addr[V4SImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4si; -+ reg_addr[V8HImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hi; -+ reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi; -+ reg_addr[SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxsf; -+ -+ reg_addr[TImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprti; -+ reg_addr[V1TImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv1ti; -+ reg_addr[V2DFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2df; -+ reg_addr[V2DImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2di; -+ reg_addr[V4SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4sf; -+ reg_addr[V4SImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4si; -+ reg_addr[V8HImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hi; -+ reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi; -+ reg_addr[SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprsf; -+ } -+ else -+ { -+ reg_addr[DImode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdi; -+ reg_addr[DDmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdd; -+ reg_addr[DFmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdf; -+ } -+ } - } - else - { -- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_si_store; -- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_si_load; -- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_si_store; -- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_si_load; -- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_si_store; -- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_si_load; -- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_si_store; -- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_si_load; -- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_si_store; -- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_si_load; -- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_si_store; -- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_si_load; -- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY) -+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_si_store; -+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_si_load; -+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_si_store; -+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_si_load; -+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_si_store; -+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_si_load; -+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_si_store; -+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_si_load; -+ reg_addr[V1TImode].reload_store = CODE_FOR_reload_v1ti_si_store; -+ reg_addr[V1TImode].reload_load = CODE_FOR_reload_v1ti_si_load; -+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_si_store; -+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_si_load; -+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_si_store; -+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_si_load; -+ if (TARGET_VSX && TARGET_UPPER_REGS_DF) - { -- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_si_store; -- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_si_load; -+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store; -+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load; -+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store; -+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load; - } -+ if (TARGET_P8_VECTOR) -+ { -+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_si_store; -+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_si_load; -+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_si_store; -+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_si_load; -+ } -+ if (TARGET_VSX_TIMODE) -+ { -+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_si_store; -+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_si_load; -+ } - } - } - -@@ -2267,6 +2874,11 @@ - } - } - -+ /* Update the addr mask bits in reg_addr to help secondary reload and go if -+ legitimate address support to figure out the appropriate addressing to -+ use. */ -+ rs6000_setup_reg_addr_masks (); -+ - if (global_init_p || TARGET_DEBUG_TARGET) - { - if (TARGET_DEBUG_REG) -@@ -2369,16 +2981,19 @@ - HOST_WIDE_INT - rs6000_builtin_mask_calculate (void) - { -- return (((TARGET_ALTIVEC) ? RS6000_BTM_ALTIVEC : 0) -- | ((TARGET_VSX) ? RS6000_BTM_VSX : 0) -- | ((TARGET_SPE) ? RS6000_BTM_SPE : 0) -- | ((TARGET_PAIRED_FLOAT) ? RS6000_BTM_PAIRED : 0) -- | ((TARGET_FRE) ? RS6000_BTM_FRE : 0) -- | ((TARGET_FRES) ? RS6000_BTM_FRES : 0) -- | ((TARGET_FRSQRTE) ? RS6000_BTM_FRSQRTE : 0) -- | ((TARGET_FRSQRTES) ? RS6000_BTM_FRSQRTES : 0) -- | ((TARGET_POPCNTD) ? RS6000_BTM_POPCNTD : 0) -- | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL : 0)); -+ return (((TARGET_ALTIVEC) ? RS6000_BTM_ALTIVEC : 0) -+ | ((TARGET_VSX) ? RS6000_BTM_VSX : 0) -+ | ((TARGET_SPE) ? RS6000_BTM_SPE : 0) -+ | ((TARGET_PAIRED_FLOAT) ? RS6000_BTM_PAIRED : 0) -+ | ((TARGET_FRE) ? RS6000_BTM_FRE : 0) -+ | ((TARGET_FRES) ? RS6000_BTM_FRES : 0) -+ | ((TARGET_FRSQRTE) ? RS6000_BTM_FRSQRTE : 0) -+ | ((TARGET_FRSQRTES) ? RS6000_BTM_FRSQRTES : 0) -+ | ((TARGET_POPCNTD) ? RS6000_BTM_POPCNTD : 0) -+ | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL : 0) -+ | ((TARGET_P8_VECTOR) ? RS6000_BTM_P8_VECTOR : 0) -+ | ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0) -+ | ((TARGET_HTM) ? RS6000_BTM_HTM : 0)); +@@ -3014,7 +3014,8 @@ + | ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0) + | ((TARGET_HTM) ? RS6000_BTM_HTM : 0) + | ((TARGET_DFP) ? RS6000_BTM_DFP : 0) +- | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0)); ++ | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0) ++ | ((TARGET_LONG_DOUBLE_128) ? RS6000_BTM_LDBL128 : 0)); } /* Override command line options. Mostly we process the processor type and -@@ -2415,7 +3030,8 @@ - calculation works better for RTL loop invariant motion on targets - with enough (>= 32) registers. It is an expensive optimization. - So it is on only for peak performance. */ -- if (optimize >= 3 && global_init_p) -+ if (optimize >= 3 && global_init_p -+ && !global_options_set.x_flag_ira_loop_pressure) - flag_ira_loop_pressure = 1; - - /* Set the pointer size. */ -@@ -2609,6 +3225,24 @@ - } - } - -+ /* If little-endian, default to -mstrict-align on older processors. -+ Testing for htm matches power8 and later. */ -+ if (!BYTES_BIG_ENDIAN -+ && !(processor_target_table[tune_index].target_enable & OPTION_MASK_HTM)) -+ rs6000_isa_flags |= ~rs6000_isa_flags_explicit & OPTION_MASK_STRICT_ALIGN; -+ -+ /* -maltivec={le,be} implies -maltivec. */ -+ if (rs6000_altivec_element_order != 0) -+ rs6000_isa_flags |= OPTION_MASK_ALTIVEC; -+ -+ /* Disallow -maltivec=le in big endian mode for now. This is not -+ known to be useful for anyone. */ -+ if (BYTES_BIG_ENDIAN && rs6000_altivec_element_order == 1) -+ { -+ warning (0, N_("-maltivec=le not allowed for big-endian targets")); -+ rs6000_altivec_element_order = 0; -+ } -+ - /* Add some warnings for VSX. */ - if (TARGET_VSX) - { -@@ -2619,15 +3253,13 @@ - if (rs6000_isa_flags_explicit & OPTION_MASK_VSX) - msg = N_("-mvsx requires hardware floating point"); - else -- rs6000_isa_flags &= ~ OPTION_MASK_VSX; -+ { -+ rs6000_isa_flags &= ~ OPTION_MASK_VSX; -+ rs6000_isa_flags_explicit |= OPTION_MASK_VSX; -+ } - } - else if (TARGET_PAIRED_FLOAT) - msg = N_("-mvsx and -mpaired are incompatible"); -- /* The hardware will allow VSX and little endian, but until we make sure -- things like vector select, etc. work don't allow VSX on little endian -- systems at this point. */ -- else if (!BYTES_BIG_ENDIAN) -- msg = N_("-mvsx used with little endian code"); - else if (TARGET_AVOID_XFORM > 0) - msg = N_("-mvsx needs indexed addressing"); - else if (!TARGET_ALTIVEC && (rs6000_isa_flags_explicit -@@ -2647,9 +3279,24 @@ - } - } - -+ /* If hard-float/altivec/vsx were explicitly turned off then don't allow -+ the -mcpu setting to enable options that conflict. */ -+ if ((!TARGET_HARD_FLOAT || !TARGET_ALTIVEC || !TARGET_VSX) -+ && (rs6000_isa_flags_explicit & (OPTION_MASK_SOFT_FLOAT -+ | OPTION_MASK_ALTIVEC -+ | OPTION_MASK_VSX)) != 0) -+ rs6000_isa_flags &= ~((OPTION_MASK_P8_VECTOR | OPTION_MASK_CRYPTO -+ | OPTION_MASK_DIRECT_MOVE) -+ & ~rs6000_isa_flags_explicit); -+ -+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) -+ rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags); -+ - /* For the newer switches (vsx, dfp, etc.) set some of the older options, - unless the user explicitly used the -mno-<option> to disable the code. */ -- if (TARGET_VSX) -+ if (TARGET_P8_VECTOR || TARGET_DIRECT_MOVE || TARGET_CRYPTO) -+ rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~rs6000_isa_flags_explicit); -+ else if (TARGET_VSX) - rs6000_isa_flags |= (ISA_2_6_MASKS_SERVER & ~rs6000_isa_flags_explicit); - else if (TARGET_POPCNTD) - rs6000_isa_flags |= (ISA_2_6_MASKS_EMBEDDED & ~rs6000_isa_flags_explicit); -@@ -2664,6 +3311,92 @@ - else if (TARGET_ALTIVEC) - rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~rs6000_isa_flags_explicit); - -+ if (TARGET_CRYPTO && !TARGET_ALTIVEC) -+ { -+ if (rs6000_isa_flags_explicit & OPTION_MASK_CRYPTO) -+ error ("-mcrypto requires -maltivec"); -+ rs6000_isa_flags &= ~OPTION_MASK_CRYPTO; -+ } -+ -+ if (TARGET_DIRECT_MOVE && !TARGET_VSX) -+ { -+ if (rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE) -+ error ("-mdirect-move requires -mvsx"); -+ rs6000_isa_flags &= ~OPTION_MASK_DIRECT_MOVE; -+ } -+ -+ if (TARGET_P8_VECTOR && !TARGET_ALTIVEC) -+ { -+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) -+ error ("-mpower8-vector requires -maltivec"); -+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; -+ } -+ -+ if (TARGET_P8_VECTOR && !TARGET_VSX) -+ { -+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) -+ error ("-mpower8-vector requires -mvsx"); -+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; -+ } -+ -+ if (TARGET_VSX_TIMODE && !TARGET_VSX) -+ { -+ if (rs6000_isa_flags_explicit & OPTION_MASK_VSX_TIMODE) -+ error ("-mvsx-timode requires -mvsx"); -+ rs6000_isa_flags &= ~OPTION_MASK_VSX_TIMODE; -+ } -+ -+ /* The quad memory instructions only works in 64-bit mode. In 32-bit mode, -+ silently turn off quad memory mode. */ -+ if ((TARGET_QUAD_MEMORY || TARGET_QUAD_MEMORY_ATOMIC) && !TARGET_POWERPC64) -+ { -+ if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY) != 0) -+ warning (0, N_("-mquad-memory requires 64-bit mode")); -+ -+ if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY_ATOMIC) != 0) -+ warning (0, N_("-mquad-memory-atomic requires 64-bit mode")); -+ -+ rs6000_isa_flags &= ~(OPTION_MASK_QUAD_MEMORY -+ | OPTION_MASK_QUAD_MEMORY_ATOMIC); -+ } -+ -+ /* Non-atomic quad memory load/store are disabled for little endian, since -+ the words are reversed, but atomic operations can still be done by -+ swapping the words. */ -+ if (TARGET_QUAD_MEMORY && !WORDS_BIG_ENDIAN) -+ { -+ if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY) != 0) -+ warning (0, N_("-mquad-memory is not available in little endian mode")); -+ -+ rs6000_isa_flags &= ~OPTION_MASK_QUAD_MEMORY; -+ } -+ -+ /* Assume if the user asked for normal quad memory instructions, they want -+ the atomic versions as well, unless they explicity told us not to use quad -+ word atomic instructions. */ -+ if (TARGET_QUAD_MEMORY -+ && !TARGET_QUAD_MEMORY_ATOMIC -+ && ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY_ATOMIC) == 0)) -+ rs6000_isa_flags |= OPTION_MASK_QUAD_MEMORY_ATOMIC; -+ -+ /* Enable power8 fusion if we are tuning for power8, even if we aren't -+ generating power8 instructions. */ -+ if (!(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION)) -+ rs6000_isa_flags |= (processor_target_table[tune_index].target_enable -+ & OPTION_MASK_P8_FUSION); -+ -+ /* Power8 does not fuse sign extended loads with the addis. If we are -+ optimizing at high levels for speed, convert a sign extended load into a -+ zero extending load, and an explicit sign extension. */ -+ if (TARGET_P8_FUSION -+ && !(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION_SIGN) -+ && optimize_function_for_speed_p (cfun) -+ && optimize >= 3) -+ rs6000_isa_flags |= OPTION_MASK_P8_FUSION_SIGN; -+ -+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) -+ rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags); -+ - /* E500mc does "better" if we inline more aggressively. Respect the - user's opinion, though. */ - if (rs6000_block_move_inline_limit == 0 -@@ -2787,9 +3520,13 @@ - - /* Place FP constants in the constant pool instead of TOC - if section anchors enabled. */ -- if (flag_section_anchors) -+ if (flag_section_anchors -+ && !global_options_set.x_TARGET_NO_FP_IN_TOC) - TARGET_NO_FP_IN_TOC = 1; - -+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) -+ rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags); -+ - #ifdef SUBTARGET_OVERRIDE_OPTIONS - SUBTARGET_OVERRIDE_OPTIONS; - #endif -@@ -2800,6 +3537,9 @@ - SUB3TARGET_OVERRIDE_OPTIONS; - #endif - -+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) -+ rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags); -+ - /* For the E500 family of cores, reset the single/double FP flags to let us - check that they remain constant across attributes or pragmas. Also, - clear a possible request for string instructions, not supported and which -@@ -2849,16 +3589,19 @@ - && rs6000_cpu != PROCESSOR_POWER5 - && rs6000_cpu != PROCESSOR_POWER6 - && rs6000_cpu != PROCESSOR_POWER7 -+ && rs6000_cpu != PROCESSOR_POWER8 - && rs6000_cpu != PROCESSOR_PPCA2 - && rs6000_cpu != PROCESSOR_CELL - && rs6000_cpu != PROCESSOR_PPC476); - rs6000_sched_groups = (rs6000_cpu == PROCESSOR_POWER4 - || rs6000_cpu == PROCESSOR_POWER5 -- || rs6000_cpu == PROCESSOR_POWER7); -+ || rs6000_cpu == PROCESSOR_POWER7 -+ || rs6000_cpu == PROCESSOR_POWER8); - rs6000_align_branch_targets = (rs6000_cpu == PROCESSOR_POWER4 - || rs6000_cpu == PROCESSOR_POWER5 - || rs6000_cpu == PROCESSOR_POWER6 - || rs6000_cpu == PROCESSOR_POWER7 -+ || rs6000_cpu == PROCESSOR_POWER8 - || rs6000_cpu == PROCESSOR_PPCE500MC - || rs6000_cpu == PROCESSOR_PPCE500MC64 - || rs6000_cpu == PROCESSOR_PPCE5500 -@@ -2988,7 +3731,7 @@ - - /* We should always be splitting complex arguments, but we can't break - Linux and Darwin ABIs at the moment. For now, only AIX is fixed. */ -- if (DEFAULT_ABI != ABI_AIX) -+ if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) - targetm.calls.split_complex_arg = NULL; - } - -@@ -3102,6 +3845,10 @@ - rs6000_cost = &power7_cost; - break; - -+ case PROCESSOR_POWER8: -+ rs6000_cost = &power8_cost; -+ break; -+ - case PROCESSOR_PPCA2: - rs6000_cost = &ppca2_cost; - break; -@@ -3274,7 +4021,8 @@ - && (rs6000_cpu == PROCESSOR_POWER4 - || rs6000_cpu == PROCESSOR_POWER5 - || rs6000_cpu == PROCESSOR_POWER6 -- || rs6000_cpu == PROCESSOR_POWER7)) -+ || rs6000_cpu == PROCESSOR_POWER7 -+ || rs6000_cpu == PROCESSOR_POWER8)) - return 5; - else - return align_loops_log; -@@ -3493,6 +4241,8 @@ - { - case SFmode: - return V4SFmode; -+ case TImode: -+ return V1TImode; - case DImode: - return V2DImode; - case SImode: -@@ -3813,6 +4563,22 @@ - enum built_in_function fn = DECL_FUNCTION_CODE (fndecl); - switch (fn) - { -+ case BUILT_IN_CLZIMAX: -+ case BUILT_IN_CLZLL: -+ case BUILT_IN_CLZL: -+ case BUILT_IN_CLZ: -+ if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n) -+ { -+ if (out_mode == QImode && out_n == 16) -+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZB]; -+ else if (out_mode == HImode && out_n == 8) -+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZH]; -+ else if (out_mode == SImode && out_n == 4) -+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZW]; -+ else if (out_mode == DImode && out_n == 2) -+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZD]; -+ } -+ break; - case BUILT_IN_COPYSIGN: - if (VECTOR_UNIT_VSX_P (V2DFmode) - && out_mode == DFmode && out_n == 2 -@@ -3828,6 +4594,22 @@ - if (VECTOR_UNIT_ALTIVEC_P (V4SFmode)) - return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF]; - break; -+ case BUILT_IN_POPCOUNTIMAX: -+ case BUILT_IN_POPCOUNTLL: -+ case BUILT_IN_POPCOUNTL: -+ case BUILT_IN_POPCOUNT: -+ if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n) -+ { -+ if (out_mode == QImode && out_n == 16) -+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTB]; -+ else if (out_mode == HImode && out_n == 8) -+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTH]; -+ else if (out_mode == SImode && out_n == 4) -+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTW]; -+ else if (out_mode == DImode && out_n == 2) -+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTD]; -+ } -+ break; - case BUILT_IN_SQRT: - if (VECTOR_UNIT_VSX_P (V2DFmode) - && out_mode == DFmode && out_n == 2 -@@ -4043,7 +4825,11 @@ - putc ('\n', file); - } - -- if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2)) -+ if (DEFAULT_ABI == ABI_ELFv2) -+ fprintf (file, "\t.abiversion 2\n"); -+ -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2 -+ || (TARGET_ELF && flag_pic == 2)) - { - switch_to_section (toc_section); - switch_to_section (text_section); -@@ -4230,7 +5016,7 @@ - HOST_WIDE_INT splat_val; - HOST_WIDE_INT msb_val; - -- if (mode == V2DImode || mode == V2DFmode) -+ if (mode == V2DImode || mode == V2DFmode || mode == V1TImode) +@@ -6109,7 +6110,8 @@ return false; - nunits = GET_MODE_NUNITS (mode); -@@ -4239,7 +5025,7 @@ - - val = const_vector_elt_as_int (op, BYTES_BIG_ENDIAN ? nunits - 1 : 0); - splat_val = val; -- msb_val = val > 0 ? 0 : -1; -+ msb_val = val >= 0 ? 0 : -1; - - /* Construct the value to be splatted, if possible. If not, return 0. */ - for (i = 2; i <= copies; i *= 2) -@@ -4274,15 +5060,16 @@ - - /* Check if VAL is present in every STEP-th element, and the - other elements are filled with its most significant bit. */ -- for (i = 0; i < nunits - 1; ++i) -+ for (i = 1; i < nunits; ++i) - { - HOST_WIDE_INT desired_val; -- if (((BYTES_BIG_ENDIAN ? i + 1 : i) & (step - 1)) == 0) -+ unsigned elt = BYTES_BIG_ENDIAN ? nunits - 1 - i : i; -+ if ((i & (step - 1)) == 0) - desired_val = val; - else - desired_val = msb_val; - -- if (desired_val != const_vector_elt_as_int (op, i)) -+ if (desired_val != const_vector_elt_as_int (op, elt)) - return false; - } - -@@ -4308,7 +5095,7 @@ - if (mode == V2DFmode) - return zero_constant (op, mode); - -- if (mode == V2DImode) -+ else if (mode == V2DImode) - { - /* In case the compiler is built 32-bit, CONST_DOUBLE constants are not - easy. */ -@@ -4326,6 +5113,10 @@ - return false; - } - -+ /* V1TImode is a special container for TImode. Ignore for now. */ -+ else if (mode == V1TImode) -+ return false; -+ - /* Start with a vspltisw. */ - step = GET_MODE_NUNITS (mode) / 4; - copies = 1; -@@ -4407,7 +5198,7 @@ - if (zero_constant (vec, mode)) - return "xxlxor %x0,%x0,%x0"; - -- if (mode == V2DImode -+ if ((mode == V2DImode || mode == V1TImode) - && INTVAL (CONST_VECTOR_ELT (vec, 0)) == -1 - && INTVAL (CONST_VECTOR_ELT (vec, 1)) == -1) - return "vspltisw %0,-1"; -@@ -4698,9 +5489,12 @@ - { - rtx freg = gen_reg_rtx (V4SFmode); - rtx sreg = force_reg (SFmode, XVECEXP (vals, 0, 0)); -+ rtx cvt = ((TARGET_XSCVDPSPN) -+ ? gen_vsx_xscvdpspn_scalar (freg, sreg) -+ : gen_vsx_xscvdpsp_scalar (freg, sreg)); - -- emit_insn (gen_vsx_xscvdpsp_scalar (freg, sreg)); -- emit_insn (gen_vsx_xxspltw_v4sf (target, freg, const0_rtx)); -+ emit_insn (cvt); -+ emit_insn (gen_vsx_xxspltw_v4sf_direct (target, freg, const0_rtx)); - } - else - { -@@ -4790,6 +5584,13 @@ - return; - } - -+ /* Simplify setting single element vectors like V1TImode. */ -+ if (GET_MODE_SIZE (mode) == GET_MODE_SIZE (inner_mode) && elt == 0) -+ { -+ emit_move_insn (target, gen_lowpart (mode, val)); -+ return; -+ } -+ - /* Load single variable value. */ - mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode)); - emit_move_insn (adjust_address_nv (mem, inner_mode, 0), val); -@@ -4811,10 +5612,27 @@ - XVECEXP (mask, 0, elt*width + i) - = GEN_INT (i + 0x10); - x = gen_rtx_CONST_VECTOR (V16QImode, XVEC (mask, 0)); -- x = gen_rtx_UNSPEC (mode, -- gen_rtvec (3, target, reg, -- force_reg (V16QImode, x)), -- UNSPEC_VPERM); -+ -+ if (BYTES_BIG_ENDIAN) -+ x = gen_rtx_UNSPEC (mode, -+ gen_rtvec (3, target, reg, -+ force_reg (V16QImode, x)), -+ UNSPEC_VPERM); -+ else -+ { -+ /* Invert selector. */ -+ rtx splat = gen_rtx_VEC_DUPLICATE (V16QImode, -+ gen_rtx_CONST_INT (QImode, -1)); -+ rtx tmp = gen_reg_rtx (V16QImode); -+ emit_move_insn (tmp, splat); -+ x = gen_rtx_MINUS (V16QImode, tmp, force_reg (V16QImode, x)); -+ emit_move_insn (tmp, x); -+ -+ /* Permute with operands reversed and adjusted selector. */ -+ x = gen_rtx_UNSPEC (mode, gen_rtvec (3, reg, target, tmp), -+ UNSPEC_VPERM); -+ } -+ - emit_insn (gen_rtx_SET (VOIDmode, target, x)); - } - -@@ -4833,6 +5651,10 @@ - { - default: - break; -+ case V1TImode: -+ gcc_assert (elt == 0 && inner_mode == TImode); -+ emit_move_insn (target, gen_lowpart (TImode, vec)); -+ break; - case V2DFmode: - emit_insn (gen_vsx_extract_v2df (target, vec, GEN_INT (elt))); - return; -@@ -4938,7 +5760,7 @@ - purpose. */ - if (GET_CODE (op) == SUBREG - && (mode == SImode || mode == DImode || mode == TImode -- || mode == DDmode || mode == TDmode) -+ || mode == DDmode || mode == TDmode || mode == PTImode) - && REG_P (SUBREG_REG (op)) - && (GET_MODE (SUBREG_REG (op)) == DFmode - || GET_MODE (SUBREG_REG (op)) == TFmode)) -@@ -4951,6 +5773,7 @@ - && REG_P (SUBREG_REG (op)) - && (GET_MODE (SUBREG_REG (op)) == DImode - || GET_MODE (SUBREG_REG (op)) == TImode -+ || GET_MODE (SUBREG_REG (op)) == PTImode - || GET_MODE (SUBREG_REG (op)) == DDmode - || GET_MODE (SUBREG_REG (op)) == TDmode)) - return true; -@@ -4966,6 +5789,48 @@ - return false; - } - -+/* Return alignment of TYPE. Existing alignment is ALIGN. HOW -+ selects whether the alignment is abi mandated, optional, or -+ both abi and optional alignment. */ -+ -+unsigned int -+rs6000_data_alignment (tree type, unsigned int align, enum data_align how) -+{ -+ if (how != align_opt) -+ { -+ if (TREE_CODE (type) == VECTOR_TYPE) -+ { -+ if ((TARGET_SPE && SPE_VECTOR_MODE (TYPE_MODE (type))) -+ || (TARGET_PAIRED_FLOAT && PAIRED_VECTOR_MODE (TYPE_MODE (type)))) -+ { -+ if (align < 64) -+ align = 64; -+ } -+ else if (align < 128) -+ align = 128; -+ } -+ else if (TARGET_E500_DOUBLE -+ && TREE_CODE (type) == REAL_TYPE -+ && TYPE_MODE (type) == DFmode) -+ { -+ if (align < 64) -+ align = 64; -+ } -+ } -+ -+ if (how != align_abi) -+ { -+ if (TREE_CODE (type) == ARRAY_TYPE -+ && TYPE_MODE (TREE_TYPE (type)) == QImode) -+ { -+ if (align < BITS_PER_WORD) -+ align = BITS_PER_WORD; -+ } -+ } -+ -+ return align; -+} -+ - /* AIX increases natural record alignment to doubleword if the first - field is an FP double while the FP fields remain word aligned. */ - -@@ -5087,6 +5952,73 @@ - || (REG_P (op1) && INT_REGNO_P (REGNO (op1)))); - } - -+/* Return true if this is a move direct operation between GPR registers and -+ floating point/VSX registers. */ -+ -+bool -+direct_move_p (rtx op0, rtx op1) -+{ -+ int regno0, regno1; -+ -+ if (!REG_P (op0) || !REG_P (op1)) -+ return false; -+ -+ if (!TARGET_DIRECT_MOVE && !TARGET_MFPGPR) -+ return false; -+ -+ regno0 = REGNO (op0); -+ regno1 = REGNO (op1); -+ if (regno0 >= FIRST_PSEUDO_REGISTER || regno1 >= FIRST_PSEUDO_REGISTER) -+ return false; -+ -+ if (INT_REGNO_P (regno0)) -+ return (TARGET_DIRECT_MOVE) ? VSX_REGNO_P (regno1) : FP_REGNO_P (regno1); -+ -+ else if (INT_REGNO_P (regno1)) -+ { -+ if (TARGET_MFPGPR && FP_REGNO_P (regno0)) -+ return true; -+ -+ else if (TARGET_DIRECT_MOVE && VSX_REGNO_P (regno0)) -+ return true; -+ } -+ -+ return false; -+} -+ -+/* Return true if this is a load or store quad operation. This function does -+ not handle the atomic quad memory instructions. */ -+ -+bool -+quad_load_store_p (rtx op0, rtx op1) -+{ -+ bool ret; -+ -+ if (!TARGET_QUAD_MEMORY) -+ ret = false; -+ -+ else if (REG_P (op0) && MEM_P (op1)) -+ ret = (quad_int_reg_operand (op0, GET_MODE (op0)) -+ && quad_memory_operand (op1, GET_MODE (op1)) -+ && !reg_overlap_mentioned_p (op0, op1)); -+ -+ else if (MEM_P (op0) && REG_P (op1)) -+ ret = (quad_memory_operand (op0, GET_MODE (op0)) -+ && quad_int_reg_operand (op1, GET_MODE (op1))); -+ -+ else -+ ret = false; -+ -+ if (TARGET_DEBUG_ADDR) -+ { -+ fprintf (stderr, "\n========== quad_load_store, return %s\n", -+ ret ? "true" : "false"); -+ debug_rtx (gen_rtx_SET (VOIDmode, op0, op1)); -+ } -+ -+ return ret; -+} -+ - /* Given an address, return a constant offset term if one exists. */ - - static rtx -@@ -5170,7 +6102,12 @@ - case V4SImode: - case V2DFmode: - case V2DImode: -- /* AltiVec/VSX vector modes. Only reg+reg addressing is valid. */ -+ case V1TImode: -+ case TImode: -+ /* AltiVec/VSX vector modes. Only reg+reg addressing is valid. While -+ TImode is not a vector mode, if we want to use the VSX registers to -+ move it around, we need to restrict ourselves to reg+reg -+ addressing. */ - if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)) - return false; - break; -@@ -5184,6 +6121,13 @@ - return false; - break; + extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD; +- gcc_assert (extra >= 0); ++ if (extra < 0) ++ extra = 0; -+ case SDmode: -+ /* If we can do direct load/stores of SDmode, restrict it to reg+reg -+ addressing for the LFIWZX and STFIWX instructions. */ -+ if (TARGET_NO_SDMODE_STACK) -+ return false; -+ break; -+ - default: - break; - } -@@ -5211,8 +6155,8 @@ - && regnum <= LAST_VIRTUAL_POINTER_REGISTER); - } - --/* Return true if memory accesses to OP are known to never straddle -- a 32k boundary. */ -+/* Return true if a MODE sized memory accesses to OP plus OFFSET -+ is known to not straddle a 32k boundary. */ + if (GET_CODE (addr) == LO_SUM) + /* For lo_sum addresses, we must allow any offset except one that +@@ -10497,10 +10499,9 @@ + list, or passes any parameter in memory. */ static bool - offsettable_ok_by_alignment (rtx op, HOST_WIDE_INT offset, -@@ -5219,15 +6163,16 @@ - enum machine_mode mode) - { - tree decl, type; -- unsigned HOST_WIDE_INT dsize, dalign; -+ unsigned HOST_WIDE_INT dsize, dalign, lsb, mask; - - if (GET_CODE (op) != SYMBOL_REF) +-rs6000_function_parms_need_stack (tree fun) ++rs6000_function_parms_need_stack (tree fun, bool incoming) + { +- function_args_iterator args_iter; +- tree arg_type; ++ tree fntype, result; + CUMULATIVE_ARGS args_so_far_v; + cumulative_args_t args_so_far; + +@@ -10507,26 +10508,57 @@ + if (!fun) + /* Must be a libcall, all of which only use reg parms. */ return false; - -+ dsize = GET_MODE_SIZE (mode); - decl = SYMBOL_REF_DECL (op); - if (!decl) - { -- if (GET_MODE_SIZE (mode) == 0) -+ if (dsize == 0) - return false; - - /* -fsection-anchors loses the original SYMBOL_REF_DECL when -@@ -5234,68 +6179,78 @@ - replacing memory addresses with an anchor plus offset. We - could find the decl by rummaging around in the block->objects - VEC for the given offset but that seems like too much work. */ -- dalign = 1; -+ dalign = BITS_PER_UNIT; - if (SYMBOL_REF_HAS_BLOCK_INFO_P (op) - && SYMBOL_REF_ANCHOR_P (op) - && SYMBOL_REF_BLOCK (op) != NULL) - { - struct object_block *block = SYMBOL_REF_BLOCK (op); -- HOST_WIDE_INT lsb, mask; - -- /* Given the alignment of the block.. */ - dalign = block->alignment; -- mask = dalign / BITS_PER_UNIT - 1; -- -- /* ..and the combined offset of the anchor and any offset -- to this block object.. */ - offset += SYMBOL_REF_BLOCK_OFFSET (op); -- lsb = offset & -offset; -+ } -+ else if (CONSTANT_POOL_ADDRESS_P (op)) -+ { -+ /* It would be nice to have get_pool_align().. */ -+ enum machine_mode cmode = get_pool_mode (op); - -- /* ..find how many bits of the alignment we know for the -- object. */ -- mask &= lsb - 1; -- dalign = mask + 1; -+ dalign = GET_MODE_ALIGNMENT (cmode); - } -- return dalign >= GET_MODE_SIZE (mode); - } -- -- if (DECL_P (decl)) -+ else if (DECL_P (decl)) - { -- if (TREE_CODE (decl) == FUNCTION_DECL) -- return true; -+ dalign = DECL_ALIGN (decl); - -- if (!DECL_SIZE_UNIT (decl)) -- return false; -+ if (dsize == 0) -+ { -+ /* Allow BLKmode when the entire object is known to not -+ cross a 32k boundary. */ -+ if (!DECL_SIZE_UNIT (decl)) -+ return false; - -- if (!host_integerp (DECL_SIZE_UNIT (decl), 1)) -- return false; -+ if (!host_integerp (DECL_SIZE_UNIT (decl), 1)) -+ return false; - -- dsize = tree_low_cst (DECL_SIZE_UNIT (decl), 1); -- if (dsize > 32768) -- return false; -+ dsize = tree_low_cst (DECL_SIZE_UNIT (decl), 1); -+ if (dsize > 32768) -+ return false; - -- dalign = DECL_ALIGN_UNIT (decl); -- return dalign >= dsize; -+ return dalign / BITS_PER_UNIT >= dsize; -+ } - } -+ else -+ { -+ type = TREE_TYPE (decl); - -- type = TREE_TYPE (decl); -+ dalign = TYPE_ALIGN (type); -+ if (CONSTANT_CLASS_P (decl)) -+ dalign = CONSTANT_ALIGNMENT (decl, dalign); -+ else -+ dalign = DATA_ALIGNMENT (decl, dalign); - -- if (TREE_CODE (decl) == STRING_CST) -- dsize = TREE_STRING_LENGTH (decl); -- else if (TYPE_SIZE_UNIT (type) -- && host_integerp (TYPE_SIZE_UNIT (type), 1)) -- dsize = tree_low_cst (TYPE_SIZE_UNIT (type), 1); -- else -- return false; -- if (dsize > 32768) -- return false; -+ if (dsize == 0) -+ { -+ /* BLKmode, check the entire object. */ -+ if (TREE_CODE (decl) == STRING_CST) -+ dsize = TREE_STRING_LENGTH (decl); -+ else if (TYPE_SIZE_UNIT (type) -+ && host_integerp (TYPE_SIZE_UNIT (type), 1)) -+ dsize = tree_low_cst (TYPE_SIZE_UNIT (type), 1); -+ else -+ return false; -+ if (dsize > 32768) -+ return false; - -- dalign = TYPE_ALIGN (type); -- if (CONSTANT_CLASS_P (decl)) -- dalign = CONSTANT_ALIGNMENT (decl, dalign); -- else -- dalign = DATA_ALIGNMENT (decl, dalign); -- dalign /= BITS_PER_UNIT; -+ return dalign / BITS_PER_UNIT >= dsize; -+ } -+ } + -+ /* Find how many bits of the alignment we know for this access. */ -+ mask = dalign / BITS_PER_UNIT - 1; -+ lsb = offset & -offset; -+ mask &= lsb - 1; -+ dalign = mask + 1; -+ - return dalign >= dsize; - } ++ fntype = fun; + if (!TYPE_P (fun)) +- fun = TREE_TYPE (fun); ++ fntype = TREE_TYPE (fun); -@@ -5387,7 +6342,7 @@ - return false; - if (!reg_offset_addressing_ok_p (mode)) - return virtual_stack_registers_memory_p (x); -- if (legitimate_constant_pool_address_p (x, mode, strict)) -+ if (legitimate_constant_pool_address_p (x, mode, strict || lra_in_progress)) + /* Varargs functions need the parameter save area. */ +- if (!prototype_p (fun) || stdarg_p (fun)) ++ if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype)) return true; - if (GET_CODE (XEXP (x, 1)) != CONST_INT) - return false; -@@ -5416,7 +6371,7 @@ - - /* If we are using VSX scalar loads, restrict ourselves to reg+reg - addressing. */ -- if (mode == DFmode && VECTOR_MEM_VSX_P (DFmode)) -+ if (VECTOR_MEM_VSX_P (mode)) - return false; - if (!worst_case) -@@ -5428,12 +6383,14 @@ - break; - - case TFmode: -- case TDmode: -- case TImode: - if (TARGET_E500_DOUBLE) - return (SPE_CONST_OFFSET_OK (offset) - && SPE_CONST_OFFSET_OK (offset + 8)); -+ /* fall through */ - -+ case TDmode: -+ case TImode: -+ case PTImode: - extra = 8; - if (!worst_case) - break; -@@ -5526,9 +6483,21 @@ +- INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX); ++ INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fntype, NULL_RTX); + args_so_far = pack_cumulative_args (&args_so_far_v); - if (TARGET_ELF || TARGET_MACHO) +- if (aggregate_value_p (TREE_TYPE (fun), fun)) ++ /* When incoming, we will have been passed the function decl. ++ It is necessary to use the decl to handle K&R style functions, ++ where TYPE_ARG_TYPES may not be available. */ ++ if (incoming) { -- if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic) -+ bool large_toc_ok; -+ -+ if (DEFAULT_ABI == ABI_V4 && flag_pic) - return false; -- if (TARGET_TOC) -+ /* LRA don't use LEGITIMIZE_RELOAD_ADDRESS as it usually calls -+ push_reload from reload pass code. LEGITIMIZE_RELOAD_ADDRESS -+ recognizes some LO_SUM addresses as valid although this -+ function says opposite. In most cases, LRA through different -+ transformations can generate correct code for address reloads. -+ It can not manage only some LO_SUM cases. So we need to add -+ code analogous to one in rs6000_legitimize_reload_address for -+ LOW_SUM here saying that some addresses are still valid. */ -+ large_toc_ok = (lra_in_progress && TARGET_CMODEL != CMODEL_SMALL -+ && small_toc_ref (x, VOIDmode)); -+ if (TARGET_TOC && ! large_toc_ok) - return false; - if (GET_MODE_NUNITS (mode) != 1) - return false; -@@ -5538,7 +6507,7 @@ - && (mode == DFmode || mode == DDmode))) - return false; - -- return CONSTANT_P (x); -+ return CONSTANT_P (x) || large_toc_ok; +- tree type = build_pointer_type (TREE_TYPE (fun)); +- rs6000_parm_needs_stack (args_so_far, type); ++ gcc_assert (DECL_P (fun)); ++ result = DECL_RESULT (fun); } - - return false; -@@ -5582,8 +6551,11 @@ - if (GET_CODE (x) == PLUS && XEXP (x, 1) == const0_rtx) - return force_reg (Pmode, XEXP (x, 0)); - -+ /* For TImode with load/store quad, restrict addresses to just a single -+ pointer, so it works with both GPRs and VSX registers. */ - /* Make sure both operands are registers. */ -- else if (GET_CODE (x) == PLUS) -+ else if (GET_CODE (x) == PLUS -+ && (mode != TImode || !TARGET_QUAD_MEMORY)) - return gen_rtx_PLUS (Pmode, - force_reg (Pmode, XEXP (x, 0)), - force_reg (Pmode, XEXP (x, 1))); -@@ -5603,11 +6575,12 @@ - case TFmode: - case TDmode: - case TImode: -+ case PTImode: - /* As in legitimate_offset_address_p we do not assume - worst-case. The mode here is just a hint as to the registers - used. A TImode is usually in gprs, but may actually be in - fprs. Leave worst-case scenario for reload to handle via -- insn constraints. */ -+ insn constraints. PTImode is only GPRs. */ - extra = 8; - break; - default: -@@ -6099,10 +7072,13 @@ - 1, const0_rtx, Pmode); - - r3 = gen_rtx_REG (Pmode, 3); -- if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT) -- insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx); -- else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT) -- insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx); -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ if (TARGET_64BIT) -+ insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx); -+ else -+ insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx); -+ } - else if (DEFAULT_ABI == ABI_V4) - insn = gen_tls_gd_sysvsi (r3, got, addr, tga, const0_rtx); - else -@@ -6121,10 +7097,13 @@ - 1, const0_rtx, Pmode); - - r3 = gen_rtx_REG (Pmode, 3); -- if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT) -- insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx); -- else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT) -- insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx); -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ if (TARGET_64BIT) -+ insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx); -+ else -+ insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx); -+ } - else if (DEFAULT_ABI == ABI_V4) - insn = gen_tls_ld_sysvsi (r3, got, tga, const0_rtx); - else -@@ -6239,7 +7218,6 @@ - && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (sym), - get_pool_mode (sym))) - || (TARGET_CMODEL == CMODEL_MEDIUM -- && !CONSTANT_POOL_ADDRESS_P (sym) - && SYMBOL_REF_LOCAL_P (sym))); - } - -@@ -6338,7 +7316,7 @@ - && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode - || mode == DDmode || mode == TDmode - || mode == DImode)) -- && VECTOR_MEM_NONE_P (mode)) -+ && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode))) - { - HOST_WIDE_INT val = INTVAL (XEXP (x, 1)); - HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000; -@@ -6369,7 +7347,7 @@ - - if (GET_CODE (x) == SYMBOL_REF - && reg_offset_p -- && VECTOR_MEM_NONE_P (mode) -+ && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode)) - && !SPE_VECTOR_MODE (mode) - #if TARGET_MACHO - && DEFAULT_ABI == ABI_DARWIN -@@ -6395,6 +7373,8 @@ - mem is sufficiently aligned. */ - && mode != TFmode - && mode != TDmode -+ && (mode != TImode || !TARGET_VSX_TIMODE) -+ && mode != PTImode - && (mode != DImode || TARGET_POWERPC64) - && ((mode != DFmode && mode != DDmode) || TARGET_POWERPC64 - || (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT))) -@@ -6515,15 +7495,9 @@ - return 0; - if (legitimate_indirect_address_p (x, reg_ok_strict)) - return 1; -- if ((GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC) -- && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) -- && !SPE_VECTOR_MODE (mode) -- && mode != TFmode -- && mode != TDmode -- /* Restrict addressing for DI because of our SUBREG hackery. */ -- && !(TARGET_E500_DOUBLE -- && (mode == DFmode || mode == DDmode || mode == DImode)) -- && TARGET_UPDATE -+ if (TARGET_UPDATE -+ && (GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC) -+ && mode_supports_pre_incdec_p (mode) - && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict)) - return 1; - if (virtual_stack_registers_memory_p (x)) -@@ -6531,8 +7505,16 @@ - if (reg_offset_p && legitimate_small_data_p (mode, x)) - return 1; - if (reg_offset_p -- && legitimate_constant_pool_address_p (x, mode, reg_ok_strict)) -+ && legitimate_constant_pool_address_p (x, mode, -+ reg_ok_strict || lra_in_progress)) - return 1; -+ /* For TImode, if we have load/store quad and TImode in VSX registers, only -+ allow register indirect addresses. This will allow the values to go in -+ either GPRs or VSX registers without reloading. The vector types would -+ tend to go into VSX registers, so we allow REG+REG, while TImode seems -+ somewhat split, in that some uses are GPR based, and some VSX based. */ -+ if (mode == TImode && TARGET_QUAD_MEMORY && TARGET_VSX_TIMODE) -+ return 0; - /* If not REG_OK_STRICT (before reload) let pass any stack offset. */ - if (! reg_ok_strict - && reg_offset_p -@@ -6544,8 +7526,7 @@ - return 1; - if (rs6000_legitimate_offset_address_p (mode, x, reg_ok_strict, false)) - return 1; -- if (mode != TImode -- && mode != TFmode -+ if (mode != TFmode - && mode != TDmode - && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT) - || TARGET_POWERPC64 -@@ -6552,23 +7533,13 @@ - || (mode != DFmode && mode != DDmode) - || (TARGET_E500_DOUBLE && mode != DDmode)) - && (TARGET_POWERPC64 || mode != DImode) -+ && (mode != TImode || VECTOR_MEM_VSX_P (TImode)) -+ && mode != PTImode - && !avoiding_indexed_address_p (mode) - && legitimate_indexed_address_p (x, reg_ok_strict)) - return 1; -- if (GET_CODE (x) == PRE_MODIFY -- && mode != TImode -- && mode != TFmode -- && mode != TDmode -- && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT) -- || TARGET_POWERPC64 -- || ((mode != DFmode && mode != DDmode) || TARGET_E500_DOUBLE)) -- && (TARGET_POWERPC64 || mode != DImode) -- && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) -- && !SPE_VECTOR_MODE (mode) -- /* Restrict addressing for DI because of our SUBREG hackery. */ -- && !(TARGET_E500_DOUBLE -- && (mode == DFmode || mode == DDmode || mode == DImode)) -- && TARGET_UPDATE -+ if (TARGET_UPDATE && GET_CODE (x) == PRE_MODIFY -+ && mode_supports_pre_modify_p (mode) - && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict) - && (rs6000_legitimate_offset_address_p (mode, XEXP (x, 1), - reg_ok_strict, false) -@@ -6589,10 +7560,13 @@ - bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict); - fprintf (stderr, - "\nrs6000_legitimate_address_p: return = %s, mode = %s, " -- "strict = %d, code = %s\n", -+ "strict = %d, reload = %s, code = %s\n", - ret ? "true" : "false", - GET_MODE_NAME (mode), - reg_ok_strict, -+ (reload_completed -+ ? "after" -+ : (reload_in_progress ? "progress" : "before")), - GET_RTX_NAME (GET_CODE (x))); - debug_rtx (x); - -@@ -6758,7 +7732,7 @@ - - /* The TOC register is not killed across calls in a way that is - visible to the compiler. */ -- if (DEFAULT_ABI == ABI_AIX) -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - call_really_used_regs[2] = 0; - - if (DEFAULT_ABI == ABI_V4 -@@ -6818,6 +7792,7 @@ - fixed_regs[i] = call_used_regs[i] = call_really_used_regs[i] = 1; - } - } -+ - - /* Try to output insns to set TARGET equal to the constant C if it can - be done in less than N insns. Do all computations in MODE. -@@ -7006,7 +7981,7 @@ - } - - /* Helper for the following. Get rid of [r+r] memory refs -- in cases where it won't work (TImode, TFmode, TDmode). */ -+ in cases where it won't work (TImode, TFmode, TDmode, PTImode). */ - - static void - rs6000_eliminate_indexed_memrefs (rtx operands[2]) -@@ -7031,6 +8006,131 @@ - copy_addr_to_reg (XEXP (operands[1], 0))); - } - -+/* Generate a vector of constants to permute MODE for a little-endian -+ storage operation by swapping the two halves of a vector. */ -+static rtvec -+rs6000_const_vec (enum machine_mode mode) -+{ -+ int i, subparts; -+ rtvec v; -+ -+ switch (mode) -+ { -+ case V1TImode: -+ subparts = 1; -+ break; -+ case V2DFmode: -+ case V2DImode: -+ subparts = 2; -+ break; -+ case V4SFmode: -+ case V4SImode: -+ subparts = 4; -+ break; -+ case V8HImode: -+ subparts = 8; -+ break; -+ case V16QImode: -+ subparts = 16; -+ break; -+ default: -+ gcc_unreachable(); -+ } -+ -+ v = rtvec_alloc (subparts); -+ -+ for (i = 0; i < subparts / 2; ++i) -+ RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i + subparts / 2); -+ for (i = subparts / 2; i < subparts; ++i) -+ RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i - subparts / 2); -+ -+ return v; -+} -+ -+/* Generate a permute rtx that represents an lxvd2x, stxvd2x, or xxpermdi -+ for a VSX load or store operation. */ -+rtx -+rs6000_gen_le_vsx_permute (rtx source, enum machine_mode mode) -+{ -+ rtx par = gen_rtx_PARALLEL (VOIDmode, rs6000_const_vec (mode)); -+ return gen_rtx_VEC_SELECT (mode, source, par); -+} -+ -+/* Emit a little-endian load from vector memory location SOURCE to VSX -+ register DEST in mode MODE. The load is done with two permuting -+ insn's that represent an lxvd2x and xxpermdi. */ -+void -+rs6000_emit_le_vsx_load (rtx dest, rtx source, enum machine_mode mode) -+{ -+ rtx tmp, permute_mem, permute_reg; -+ -+ /* Use V2DImode to do swaps of types with 128-bit scalare parts (TImode, -+ V1TImode). */ -+ if (mode == TImode || mode == V1TImode) -+ { -+ mode = V2DImode; -+ dest = gen_lowpart (V2DImode, dest); -+ source = adjust_address (source, V2DImode, 0); -+ } -+ -+ tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (dest) : dest; -+ permute_mem = rs6000_gen_le_vsx_permute (source, mode); -+ permute_reg = rs6000_gen_le_vsx_permute (tmp, mode); -+ emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_mem)); -+ emit_insn (gen_rtx_SET (VOIDmode, dest, permute_reg)); -+} -+ -+/* Emit a little-endian store to vector memory location DEST from VSX -+ register SOURCE in mode MODE. The store is done with two permuting -+ insn's that represent an xxpermdi and an stxvd2x. */ -+void -+rs6000_emit_le_vsx_store (rtx dest, rtx source, enum machine_mode mode) -+{ -+ rtx tmp, permute_src, permute_tmp; -+ -+ /* Use V2DImode to do swaps of types with 128-bit scalare parts (TImode, -+ V1TImode). */ -+ if (mode == TImode || mode == V1TImode) -+ { -+ mode = V2DImode; -+ dest = adjust_address (dest, V2DImode, 0); -+ source = gen_lowpart (V2DImode, source); -+ } -+ -+ tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (source) : source; -+ permute_src = rs6000_gen_le_vsx_permute (source, mode); -+ permute_tmp = rs6000_gen_le_vsx_permute (tmp, mode); -+ emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_src)); -+ emit_insn (gen_rtx_SET (VOIDmode, dest, permute_tmp)); -+} -+ -+/* Emit a sequence representing a little-endian VSX load or store, -+ moving data from SOURCE to DEST in mode MODE. This is done -+ separately from rs6000_emit_move to ensure it is called only -+ during expand. LE VSX loads and stores introduced later are -+ handled with a split. The expand-time RTL generation allows -+ us to optimize away redundant pairs of register-permutes. */ -+void -+rs6000_emit_le_vsx_move (rtx dest, rtx source, enum machine_mode mode) -+{ -+ gcc_assert (!BYTES_BIG_ENDIAN -+ && VECTOR_MEM_VSX_P (mode) -+ && !gpr_or_gpr_p (dest, source) -+ && (MEM_P (source) ^ MEM_P (dest))); -+ -+ if (MEM_P (source)) -+ { -+ gcc_assert (REG_P (dest) || GET_CODE (dest) == SUBREG); -+ rs6000_emit_le_vsx_load (dest, source, mode); -+ } + else -+ { -+ if (!REG_P (source)) -+ source = force_reg (mode, source); -+ rs6000_emit_le_vsx_store (dest, source, mode); -+ } -+} -+ - /* Emit a move from SOURCE to DEST in mode MODE. */ - void - rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode) -@@ -7149,8 +8249,71 @@ - cfun->machine->sdmode_stack_slot = - eliminate_regs (cfun->machine->sdmode_stack_slot, VOIDmode, NULL_RTX); ++ result = TREE_TYPE (fntype); -+ -+ if (lra_in_progress -+ && mode == SDmode -+ && REG_P (operands[0]) && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER -+ && reg_preferred_class (REGNO (operands[0])) == NO_REGS -+ && (REG_P (operands[1]) -+ || (GET_CODE (operands[1]) == SUBREG -+ && REG_P (SUBREG_REG (operands[1]))))) +- FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter) +- if (rs6000_parm_needs_stack (args_so_far, arg_type)) +- return true; ++ if (result && aggregate_value_p (result, fntype)) + { -+ int regno = REGNO (GET_CODE (operands[1]) == SUBREG -+ ? SUBREG_REG (operands[1]) : operands[1]); -+ enum reg_class cl; -+ -+ if (regno >= FIRST_PSEUDO_REGISTER) -+ { -+ cl = reg_preferred_class (regno); -+ gcc_assert (cl != NO_REGS); -+ regno = ira_class_hard_regs[cl][0]; -+ } -+ if (FP_REGNO_P (regno)) -+ { -+ if (GET_MODE (operands[0]) != DDmode) -+ operands[0] = gen_rtx_SUBREG (DDmode, operands[0], 0); -+ emit_insn (gen_movsd_store (operands[0], operands[1])); -+ } -+ else if (INT_REGNO_P (regno)) -+ emit_insn (gen_movsd_hardfloat (operands[0], operands[1])); -+ else -+ gcc_unreachable(); -+ return; ++ if (!TYPE_P (result)) ++ result = TREE_TYPE (result); ++ result = build_pointer_type (result); ++ rs6000_parm_needs_stack (args_so_far, result); + } -+ if (lra_in_progress -+ && mode == SDmode -+ && (REG_P (operands[0]) -+ || (GET_CODE (operands[0]) == SUBREG -+ && REG_P (SUBREG_REG (operands[0])))) -+ && REG_P (operands[1]) && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER -+ && reg_preferred_class (REGNO (operands[1])) == NO_REGS) -+ { -+ int regno = REGNO (GET_CODE (operands[0]) == SUBREG -+ ? SUBREG_REG (operands[0]) : operands[0]); -+ enum reg_class cl; -+ -+ if (regno >= FIRST_PSEUDO_REGISTER) -+ { -+ cl = reg_preferred_class (regno); -+ gcc_assert (cl != NO_REGS); -+ regno = ira_class_hard_regs[cl][0]; -+ } -+ if (FP_REGNO_P (regno)) -+ { -+ if (GET_MODE (operands[1]) != DDmode) -+ operands[1] = gen_rtx_SUBREG (DDmode, operands[1], 0); -+ emit_insn (gen_movsd_load (operands[0], operands[1])); -+ } -+ else if (INT_REGNO_P (regno)) -+ emit_insn (gen_movsd_hardfloat (operands[0], operands[1])); -+ else -+ gcc_unreachable(); -+ return; -+ } -+ - if (reload_in_progress - && mode == SDmode -+ && cfun->machine->sdmode_stack_slot != NULL_RTX - && MEM_P (operands[0]) - && rtx_equal_p (operands[0], cfun->machine->sdmode_stack_slot) - && REG_P (operands[1])) -@@ -7163,7 +8326,9 @@ - } - else if (INT_REGNO_P (REGNO (operands[1]))) - { -- rtx mem = adjust_address_nv (operands[0], mode, 4); -+ rtx mem = operands[0]; -+ if (BYTES_BIG_ENDIAN) -+ mem = adjust_address_nv (mem, mode, 4); - mem = eliminate_regs (mem, VOIDmode, NULL_RTX); - emit_insn (gen_movsd_hardfloat (mem, operands[1])); - } -@@ -7175,6 +8340,7 @@ - && mode == SDmode - && REG_P (operands[0]) - && MEM_P (operands[1]) -+ && cfun->machine->sdmode_stack_slot != NULL_RTX - && rtx_equal_p (operands[1], cfun->machine->sdmode_stack_slot)) - { - if (FP_REGNO_P (REGNO (operands[0]))) -@@ -7185,7 +8351,9 @@ - } - else if (INT_REGNO_P (REGNO (operands[0]))) - { -- rtx mem = adjust_address_nv (operands[1], mode, 4); -+ rtx mem = operands[1]; -+ if (BYTES_BIG_ENDIAN) -+ mem = adjust_address_nv (mem, mode, 4); - mem = eliminate_regs (mem, VOIDmode, NULL_RTX); - emit_insn (gen_movsd_hardfloat (operands[0], mem)); - } -@@ -7230,6 +8398,7 @@ - case V1DImode: - case V2DFmode: - case V2DImode: -+ case V1TImode: - if (CONSTANT_P (operands[1]) - && !easy_vector_constant (operands[1], mode)) - operands[1] = force_const_mem (mode, operands[1]); -@@ -7388,6 +8557,11 @@ - break; - case TImode: -+ if (!VECTOR_MEM_VSX_P (TImode)) -+ rs6000_eliminate_indexed_memrefs (operands); -+ break; -+ -+ case PTImode: - rs6000_eliminate_indexed_memrefs (operands); - break; - -@@ -7426,18 +8600,231 @@ - } - - /* Nonzero if we can use a floating-point register to pass this arg. */ --#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \ -+#define USE_FP_FOR_ARG_P(CUM,MODE) \ - (SCALAR_FLOAT_MODE_P (MODE) \ - && (CUM)->fregno <= FP_ARG_MAX_REG \ - && TARGET_HARD_FLOAT && TARGET_FPRS) - - /* Nonzero if we can use an AltiVec register to pass this arg. */ --#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,TYPE,NAMED) \ -+#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,NAMED) \ - (ALTIVEC_OR_VSX_VECTOR_MODE (MODE) \ - && (CUM)->vregno <= ALTIVEC_ARG_MAX_REG \ - && TARGET_ALTIVEC_ABI \ - && (NAMED)) - -+/* Walk down the type tree of TYPE counting consecutive base elements. -+ If *MODEP is VOIDmode, then set it to the first valid floating point -+ or vector type. If a non-floating point or vector type is found, or -+ if a floating point or vector type that doesn't match a non-VOIDmode -+ *MODEP is found, then return -1, otherwise return the count in the -+ sub-tree. */ -+ -+static int -+rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep) -+{ -+ enum machine_mode mode; -+ HOST_WIDE_INT size; -+ -+ switch (TREE_CODE (type)) ++ if (incoming) + { -+ case REAL_TYPE: -+ mode = TYPE_MODE (type); -+ if (!SCALAR_FLOAT_MODE_P (mode)) -+ return -1; -+ -+ if (*modep == VOIDmode) -+ *modep = mode; -+ -+ if (*modep == mode) -+ return 1; -+ -+ break; -+ -+ case COMPLEX_TYPE: -+ mode = TYPE_MODE (TREE_TYPE (type)); -+ if (!SCALAR_FLOAT_MODE_P (mode)) -+ return -1; -+ -+ if (*modep == VOIDmode) -+ *modep = mode; -+ -+ if (*modep == mode) -+ return 2; -+ -+ break; -+ -+ case VECTOR_TYPE: -+ if (!TARGET_ALTIVEC_ABI || !TARGET_ALTIVEC) -+ return -1; -+ -+ /* Use V4SImode as representative of all 128-bit vector types. */ -+ size = int_size_in_bytes (type); -+ switch (size) -+ { -+ case 16: -+ mode = V4SImode; -+ break; -+ default: -+ return -1; -+ } -+ -+ if (*modep == VOIDmode) -+ *modep = mode; -+ -+ /* Vector modes are considered to be opaque: two vectors are -+ equivalent for the purposes of being homogeneous aggregates -+ if they are the same size. */ -+ if (*modep == mode) -+ return 1; -+ -+ break; -+ -+ case ARRAY_TYPE: -+ { -+ int count; -+ tree index = TYPE_DOMAIN (type); -+ -+ /* Can't handle incomplete types. */ -+ if (!COMPLETE_TYPE_P (type)) -+ return -1; -+ -+ count = rs6000_aggregate_candidate (TREE_TYPE (type), modep); -+ if (count == -1 -+ || !index -+ || !TYPE_MAX_VALUE (index) -+ || !host_integerp (TYPE_MAX_VALUE (index), 1) -+ || !TYPE_MIN_VALUE (index) -+ || !host_integerp (TYPE_MIN_VALUE (index), 1) -+ || count < 0) -+ return -1; -+ -+ count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1) -+ - tree_low_cst (TYPE_MIN_VALUE (index), 1)); -+ -+ /* There must be no padding. */ -+ if (!host_integerp (TYPE_SIZE (type), 1) -+ || (tree_low_cst (TYPE_SIZE (type), 1) -+ != count * GET_MODE_BITSIZE (*modep))) -+ return -1; -+ -+ return count; -+ } -+ -+ case RECORD_TYPE: -+ { -+ int count = 0; -+ int sub_count; -+ tree field; -+ -+ /* Can't handle incomplete types. */ -+ if (!COMPLETE_TYPE_P (type)) -+ return -1; -+ -+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) -+ { -+ if (TREE_CODE (field) != FIELD_DECL) -+ continue; -+ -+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep); -+ if (sub_count < 0) -+ return -1; -+ count += sub_count; -+ } -+ -+ /* There must be no padding. */ -+ if (!host_integerp (TYPE_SIZE (type), 1) -+ || (tree_low_cst (TYPE_SIZE (type), 1) -+ != count * GET_MODE_BITSIZE (*modep))) -+ return -1; -+ -+ return count; -+ } -+ -+ case UNION_TYPE: -+ case QUAL_UNION_TYPE: -+ { -+ /* These aren't very interesting except in a degenerate case. */ -+ int count = 0; -+ int sub_count; -+ tree field; -+ -+ /* Can't handle incomplete types. */ -+ if (!COMPLETE_TYPE_P (type)) -+ return -1; -+ -+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) -+ { -+ if (TREE_CODE (field) != FIELD_DECL) -+ continue; -+ -+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep); -+ if (sub_count < 0) -+ return -1; -+ count = count > sub_count ? count : sub_count; -+ } -+ -+ /* There must be no padding. */ -+ if (!host_integerp (TYPE_SIZE (type), 1) -+ || (tree_low_cst (TYPE_SIZE (type), 1) -+ != count * GET_MODE_BITSIZE (*modep))) -+ return -1; -+ -+ return count; -+ } -+ -+ default: -+ break; -+ } -+ -+ return -1; -+} -+ -+/* If an argument, whose type is described by TYPE and MODE, is a homogeneous -+ float or vector aggregate that shall be passed in FP/vector registers -+ according to the ELFv2 ABI, return the homogeneous element mode in -+ *ELT_MODE and the number of elements in *N_ELTS, and return TRUE. -+ -+ Otherwise, set *ELT_MODE to MODE and *N_ELTS to 1, and return FALSE. */ -+ -+static bool -+rs6000_discover_homogeneous_aggregate (enum machine_mode mode, const_tree type, -+ enum machine_mode *elt_mode, -+ int *n_elts) -+{ -+ /* Note that we do not accept complex types at the top level as -+ homogeneous aggregates; these types are handled via the -+ targetm.calls.split_complex_arg mechanism. Complex types -+ can be elements of homogeneous aggregates, however. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && type && AGGREGATE_TYPE_P (type)) -+ { -+ enum machine_mode field_mode = VOIDmode; -+ int field_count = rs6000_aggregate_candidate (type, &field_mode); -+ -+ if (field_count > 0) -+ { -+ int n_regs = (SCALAR_FLOAT_MODE_P (field_mode)? -+ (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1); -+ -+ /* The ELFv2 ABI allows homogeneous aggregates to occupy -+ up to AGGR_ARG_NUM_REG registers. */ -+ if (field_count * n_regs <= AGGR_ARG_NUM_REG) -+ { -+ if (elt_mode) -+ *elt_mode = field_mode; -+ if (n_elts) -+ *n_elts = field_count; -+ return true; -+ } -+ } -+ } -+ -+ if (elt_mode) -+ *elt_mode = mode; -+ if (n_elts) -+ *n_elts = 1; -+ return false; -+} -+ - /* Return a nonzero value to say to return the function value in - memory, just as large structures are always returned. TYPE will be - the data type of the value, and FNTYPE will be the type of the -@@ -7490,6 +8877,16 @@ - /* Otherwise fall through to more conventional ABI rules. */ - } - -+ /* The ELFv2 ABI returns homogeneous VFP aggregates in registers */ -+ if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (type), type, -+ NULL, NULL)) -+ return false; -+ -+ /* The ELFv2 ABI returns aggregates up to 16B in registers */ -+ if (DEFAULT_ABI == ABI_ELFv2 && AGGREGATE_TYPE_P (type) -+ && (unsigned HOST_WIDE_INT) int_size_in_bytes (type) <= 16) -+ return false; -+ - if (AGGREGATE_TYPE_P (type) - && (aix_struct_return - || (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8)) -@@ -7521,6 +8918,19 @@ - return false; - } - -+/* Specify whether values returned in registers should be at the most -+ significant end of a register. We want aggregates returned by -+ value to match the way aggregates are passed to functions. */ -+ -+static bool -+rs6000_return_in_msb (const_tree valtype) -+{ -+ return (DEFAULT_ABI == ABI_ELFv2 -+ && BYTES_BIG_ENDIAN -+ && AGGREGATE_TYPE_P (valtype) -+ && FUNCTION_ARG_PADDING (TYPE_MODE (valtype), valtype) == upward); -+} -+ - #ifdef HAVE_AS_GNU_ATTRIBUTE - /* Return TRUE if a call to function FNDECL may be one that - potentially affects the function calling ABI of the object file. */ -@@ -7657,7 +9067,7 @@ - static bool - rs6000_must_pass_in_stack (enum machine_mode mode, const_tree type) - { -- if (DEFAULT_ABI == ABI_AIX || TARGET_64BIT) -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2 || TARGET_64BIT) - return must_pass_in_stack_var_size (mode, type); - else - return must_pass_in_stack_var_size_or_pad (mode, type); -@@ -7738,6 +9148,11 @@ - static unsigned int - rs6000_function_arg_boundary (enum machine_mode mode, const_tree type) - { -+ enum machine_mode elt_mode; -+ int n_elts; -+ -+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts); -+ - if (DEFAULT_ABI == ABI_V4 - && (GET_MODE_SIZE (mode) == 8 - || (TARGET_HARD_FLOAT -@@ -7749,12 +9164,13 @@ - && int_size_in_bytes (type) >= 8 - && int_size_in_bytes (type) < 16)) - return 64; -- else if (ALTIVEC_OR_VSX_VECTOR_MODE (mode) -+ else if (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode) - || (type && TREE_CODE (type) == VECTOR_TYPE - && int_size_in_bytes (type) >= 16)) - return 128; -- else if (TARGET_MACHO -- && rs6000_darwin64_abi -+ else if (((TARGET_MACHO && rs6000_darwin64_abi) -+ || DEFAULT_ABI == ABI_ELFv2 -+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) - && mode == BLKmode - && type && TYPE_ALIGN (type) > 64) - return 128; -@@ -7762,6 +9178,16 @@ - return PARM_BOUNDARY; - } - -+/* The offset in words to the start of the parameter save area. */ -+ -+static unsigned int -+rs6000_parm_offset (void) -+{ -+ return (DEFAULT_ABI == ABI_V4 ? 2 -+ : DEFAULT_ABI == ABI_ELFv2 ? 4 -+ : 6); -+} -+ - /* For a function parm of MODE and TYPE, return the starting word in - the parameter area. NWORDS of the parameter area are already used. */ - -@@ -7770,11 +9196,9 @@ - unsigned int nwords) - { - unsigned int align; -- unsigned int parm_offset; - - align = rs6000_function_arg_boundary (mode, type) / PARM_BOUNDARY - 1; -- parm_offset = DEFAULT_ABI == ABI_V4 ? 2 : 6; -- return nwords + (-(parm_offset + nwords) & align); -+ return nwords + (-(rs6000_parm_offset () + nwords) & align); - } - - /* Compute the size (in words) of a function argument. */ -@@ -7881,7 +9305,7 @@ - - if (TREE_CODE (ftype) == RECORD_TYPE) - rs6000_darwin64_record_arg_advance_recurse (cum, ftype, bitpos); -- else if (USE_FP_FOR_ARG_P (cum, mode, ftype)) -+ else if (USE_FP_FOR_ARG_P (cum, mode)) - { - unsigned n_fpregs = (GET_MODE_SIZE (mode) + 7) >> 3; - rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0); -@@ -7922,7 +9346,7 @@ - else - cum->words += n_fpregs; - } -- else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, 1)) -+ else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, 1)) - { - rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0); - cum->vregno++; -@@ -7959,6 +9383,11 @@ - rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, enum machine_mode mode, - const_tree type, bool named, int depth) - { -+ enum machine_mode elt_mode; -+ int n_elts; -+ -+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts); -+ - /* Only tick off an argument if we're not recursing. */ - if (depth == 0) - cum->nargs_prototype--; -@@ -7979,15 +9408,16 @@ - #endif - - if (TARGET_ALTIVEC_ABI -- && (ALTIVEC_OR_VSX_VECTOR_MODE (mode) -+ && (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode) - || (type && TREE_CODE (type) == VECTOR_TYPE - && int_size_in_bytes (type) == 16))) - { - bool stack = false; - -- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)) -+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named)) - { -- cum->vregno++; -+ cum->vregno += n_elts; -+ - if (!TARGET_ALTIVEC) - error ("cannot pass argument in vector register because" - " altivec instructions are disabled, use -maltivec" -@@ -7996,7 +9426,8 @@ - /* PowerPC64 Linux and AIX allocate GPRs for a vector argument - even if it is going to be passed in a vector register. - Darwin does the same for variable-argument functions. */ -- if ((DEFAULT_ABI == ABI_AIX && TARGET_64BIT) -+ if (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ && TARGET_64BIT) - || (cum->stdarg && DEFAULT_ABI != ABI_V4)) - stack = true; - } -@@ -8007,15 +9438,13 @@ - { - int align; - -- /* Vector parameters must be 16-byte aligned. This places -- them at 2 mod 4 in terms of words in 32-bit mode, since -- the parameter save area starts at offset 24 from the -- stack. In 64-bit mode, they just have to start on an -- even word, since the parameter save area is 16-byte -- aligned. Space for GPRs is reserved even if the argument -- will be passed in memory. */ -+ /* Vector parameters must be 16-byte aligned. In 32-bit -+ mode this means we need to take into account the offset -+ to the parameter save area. In 64-bit mode, they just -+ have to start on an even word, since the parameter save -+ area is 16-byte aligned. */ - if (TARGET_32BIT) -- align = (2 - cum->words) & 3; -+ align = -(rs6000_parm_offset () + cum->words) & 3; - else - align = cum->words & 1; - cum->words += align + rs6000_arg_size (mode, type); -@@ -8140,15 +9569,15 @@ - - cum->words = align_words + n_words; - -- if (SCALAR_FLOAT_MODE_P (mode) -+ if (SCALAR_FLOAT_MODE_P (elt_mode) - && TARGET_HARD_FLOAT && TARGET_FPRS) - { - /* _Decimal128 must be passed in an even/odd float register pair. - This assumes that the register number is odd when fregno is - odd. */ -- if (mode == TDmode && (cum->fregno % 2) == 1) -+ if (elt_mode == TDmode && (cum->fregno % 2) == 1) - cum->fregno++; -- cum->fregno += (GET_MODE_SIZE (mode) + 7) >> 3; -+ cum->fregno += n_elts * ((GET_MODE_SIZE (elt_mode) + 7) >> 3); - } - - if (TARGET_DEBUG_ARG) -@@ -8358,7 +9787,7 @@ - - if (TREE_CODE (ftype) == RECORD_TYPE) - rs6000_darwin64_record_arg_recurse (cum, ftype, bitpos, rvec, k); -- else if (cum->named && USE_FP_FOR_ARG_P (cum, mode, ftype)) -+ else if (cum->named && USE_FP_FOR_ARG_P (cum, mode)) - { - unsigned n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3; - #if 0 -@@ -8386,7 +9815,7 @@ - if (mode == TFmode || mode == TDmode) - cum->fregno++; - } -- else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, ftype, 1)) -+ else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, 1)) - { - rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k); - rvec[(*k)++] -@@ -8503,6 +9932,84 @@ - return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); - } - -+/* We have an argument of MODE and TYPE that goes into FPRs or VRs, -+ but must also be copied into the parameter save area starting at -+ offset ALIGN_WORDS. Fill in RVEC with the elements corresponding -+ to the GPRs and/or memory. Return the number of elements used. */ -+ -+static int -+rs6000_psave_function_arg (enum machine_mode mode, const_tree type, -+ int align_words, rtx *rvec) -+{ -+ int k = 0; -+ -+ if (align_words < GP_ARG_NUM_REG) -+ { -+ int n_words = rs6000_arg_size (mode, type); -+ -+ if (align_words + n_words > GP_ARG_NUM_REG -+ || mode == BLKmode -+ || (TARGET_32BIT && TARGET_POWERPC64)) -+ { -+ /* If this is partially on the stack, then we only -+ include the portion actually in registers here. */ -+ enum machine_mode rmode = TARGET_32BIT ? SImode : DImode; -+ int i = 0; -+ -+ if (align_words + n_words > GP_ARG_NUM_REG) -+ { -+ /* Not all of the arg fits in gprs. Say that it goes in memory -+ too, using a magic NULL_RTX component. Also see comment in -+ rs6000_mixed_function_arg for why the normal -+ function_arg_partial_nregs scheme doesn't work in this case. */ -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); -+ } -+ -+ do -+ { -+ rtx r = gen_rtx_REG (rmode, GP_ARG_MIN_REG + align_words); -+ rtx off = GEN_INT (i++ * GET_MODE_SIZE (rmode)); -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); -+ } -+ while (++align_words < GP_ARG_NUM_REG && --n_words != 0); -+ } -+ else -+ { -+ /* The whole arg fits in gprs. */ -+ rtx r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); -+ } -+ } -+ else -+ { -+ /* It's entirely in memory. */ -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); -+ } -+ -+ return k; -+} -+ -+/* RVEC is a vector of K components of an argument of mode MODE. -+ Construct the final function_arg return value from it. */ -+ -+static rtx -+rs6000_finish_function_arg (enum machine_mode mode, rtx *rvec, int k) -+{ -+ gcc_assert (k >= 1); -+ -+ /* Avoid returning a PARALLEL in the trivial cases. */ -+ if (k == 1) -+ { -+ if (XEXP (rvec[0], 0) == NULL_RTX) -+ return NULL_RTX; -+ -+ if (GET_MODE (XEXP (rvec[0], 0)) == mode) -+ return XEXP (rvec[0], 0); -+ } -+ -+ return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); -+} -+ - /* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. -@@ -8537,6 +10044,8 @@ - { - CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - enum rs6000_abi abi = DEFAULT_ABI; -+ enum machine_mode elt_mode; -+ int n_elts; - - /* Return a marker to indicate whether CR1 needs to set or clear the - bit that V.4 uses to say fp args were passed in registers. -@@ -8563,6 +10072,8 @@ - return GEN_INT (cum->call_cookie & ~CALL_LIBCALL); - } - -+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts); -+ - if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type)) - { - rtx rslt = rs6000_darwin64_record_arg (cum, type, named, /*retval= */false); -@@ -8571,33 +10082,30 @@ - /* Else fall through to usual handling. */ - } - -- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)) -- if (TARGET_64BIT && ! cum->prototype) -- { -- /* Vector parameters get passed in vector register -- and also in GPRs or memory, in absence of prototype. */ -- int align_words; -- rtx slot; -- align_words = (cum->words + 1) & ~1; -+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named)) -+ { -+ rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1]; -+ rtx r, off; -+ int i, k = 0; - -- if (align_words >= GP_ARG_NUM_REG) -- { -- slot = NULL_RTX; -- } -- else -- { -- slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); -- } -- return gen_rtx_PARALLEL (mode, -- gen_rtvec (2, -- gen_rtx_EXPR_LIST (VOIDmode, -- slot, const0_rtx), -- gen_rtx_EXPR_LIST (VOIDmode, -- gen_rtx_REG (mode, cum->vregno), -- const0_rtx))); -- } -- else -- return gen_rtx_REG (mode, cum->vregno); -+ /* Do we also need to pass this argument in the parameter -+ save area? */ -+ if (TARGET_64BIT && ! cum->prototype) -+ { -+ int align_words = (cum->words + 1) & ~1; -+ k = rs6000_psave_function_arg (mode, type, align_words, rvec); -+ } -+ -+ /* Describe where this argument goes in the vector registers. */ -+ for (i = 0; i < n_elts && cum->vregno + i <= ALTIVEC_ARG_MAX_REG; i++) -+ { -+ r = gen_rtx_REG (elt_mode, cum->vregno + i); -+ off = GEN_INT (i * GET_MODE_SIZE (elt_mode)); -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); -+ } -+ -+ return rs6000_finish_function_arg (mode, rvec, k); -+ } - else if (TARGET_ALTIVEC_ABI - && (ALTIVEC_OR_VSX_VECTOR_MODE (mode) - || (type && TREE_CODE (type) == VECTOR_TYPE -@@ -8612,13 +10120,13 @@ - int align, align_words, n_words; - enum machine_mode part_mode; - -- /* Vector parameters must be 16-byte aligned. This places them at -- 2 mod 4 in terms of words in 32-bit mode, since the parameter -- save area starts at offset 24 from the stack. In 64-bit mode, -- they just have to start on an even word, since the parameter -- save area is 16-byte aligned. */ -+ /* Vector parameters must be 16-byte aligned. In 32-bit -+ mode this means we need to take into account the offset -+ to the parameter save area. In 64-bit mode, they just -+ have to start on an even word, since the parameter save -+ area is 16-byte aligned. */ - if (TARGET_32BIT) -- align = (2 - cum->words) & 3; -+ align = -(rs6000_parm_offset () + cum->words) & 3; - else - align = cum->words & 1; - align_words = cum->words + align; -@@ -8696,92 +10204,44 @@ - - /* _Decimal128 must be passed in an even/odd float register pair. - This assumes that the register number is odd when fregno is odd. */ -- if (mode == TDmode && (cum->fregno % 2) == 1) -+ if (elt_mode == TDmode && (cum->fregno % 2) == 1) - cum->fregno++; - -- if (USE_FP_FOR_ARG_P (cum, mode, type)) -+ if (USE_FP_FOR_ARG_P (cum, elt_mode)) - { -- rtx rvec[GP_ARG_NUM_REG + 1]; -- rtx r; -- int k; -- bool needs_psave; -- enum machine_mode fmode = mode; -- unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3; -+ rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1]; -+ rtx r, off; -+ int i, k = 0; -+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; - -- if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1) -- { -- /* Currently, we only ever need one reg here because complex -- doubles are split. */ -- gcc_assert (cum->fregno == FP_ARG_MAX_REG -- && (fmode == TFmode || fmode == TDmode)); -+ /* Do we also need to pass this argument in the parameter -+ save area? */ -+ if (type && (cum->nargs_prototype <= 0 -+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ && TARGET_XL_COMPAT -+ && align_words >= GP_ARG_NUM_REG))) -+ k = rs6000_psave_function_arg (mode, type, align_words, rvec); - -- /* Long double or _Decimal128 split over regs and memory. */ -- fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode; -- } -- -- /* Do we also need to pass this arg in the parameter save -- area? */ -- needs_psave = (type -- && (cum->nargs_prototype <= 0 -- || (DEFAULT_ABI == ABI_AIX -- && TARGET_XL_COMPAT -- && align_words >= GP_ARG_NUM_REG))); -- -- if (!needs_psave && mode == fmode) -- return gen_rtx_REG (fmode, cum->fregno); -- -- k = 0; -- if (needs_psave) -+ /* Describe where this argument goes in the fprs. */ -+ for (i = 0; i < n_elts -+ && cum->fregno + i * n_fpreg <= FP_ARG_MAX_REG; i++) - { -- /* Describe the part that goes in gprs or the stack. -- This piece must come first, before the fprs. */ -- if (align_words < GP_ARG_NUM_REG) -+ /* Check if the argument is split over registers and memory. -+ This can only ever happen for long double or _Decimal128; -+ complex types are handled via split_complex_arg. */ -+ enum machine_mode fmode = elt_mode; -+ if (cum->fregno + (i + 1) * n_fpreg > FP_ARG_MAX_REG + 1) - { -- unsigned long n_words = rs6000_arg_size (mode, type); -+ gcc_assert (fmode == TFmode || fmode == TDmode); -+ fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode; -+ } - -- if (align_words + n_words > GP_ARG_NUM_REG -- || (TARGET_32BIT && TARGET_POWERPC64)) -- { -- /* If this is partially on the stack, then we only -- include the portion actually in registers here. */ -- enum machine_mode rmode = TARGET_32BIT ? SImode : DImode; -- rtx off; -- int i = 0; -- if (align_words + n_words > GP_ARG_NUM_REG) -- /* Not all of the arg fits in gprs. Say that it -- goes in memory too, using a magic NULL_RTX -- component. Also see comment in -- rs6000_mixed_function_arg for why the normal -- function_arg_partial_nregs scheme doesn't work -- in this case. */ -- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, -- const0_rtx); -- do -- { -- r = gen_rtx_REG (rmode, -- GP_ARG_MIN_REG + align_words); -- off = GEN_INT (i++ * GET_MODE_SIZE (rmode)); -- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); -- } -- while (++align_words < GP_ARG_NUM_REG && --n_words != 0); -- } -- else -- { -- /* The whole arg fits in gprs. */ -- r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); -- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); -- } -- } -- else -- /* It's entirely in memory. */ -- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); -+ r = gen_rtx_REG (fmode, cum->fregno + i * n_fpreg); -+ off = GEN_INT (i * GET_MODE_SIZE (elt_mode)); -+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); - } - -- /* Describe where this piece goes in the fprs. */ -- r = gen_rtx_REG (fmode, cum->fregno); -- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx); -- -- return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec)); -+ return rs6000_finish_function_arg (mode, rvec, k); - } - else if (align_words < GP_ARG_NUM_REG) - { -@@ -8788,9 +10248,6 @@ - if (TARGET_32BIT && TARGET_POWERPC64) - return rs6000_mixed_function_arg (mode, type, align_words); - -- if (mode == BLKmode) -- mode = Pmode; -- - return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words); - } - else -@@ -8809,16 +10266,32 @@ - tree type, bool named) - { - CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); -+ bool passed_in_gprs = true; - int ret = 0; - int align_words; -+ enum machine_mode elt_mode; -+ int n_elts; - -+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts); -+ - if (DEFAULT_ABI == ABI_V4) - return 0; - -- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named) -- && cum->nargs_prototype >= 0) -- return 0; -+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named)) -+ { -+ /* If we are passing this arg in the fixed parameter save area -+ (gprs or memory) as well as VRs, we do not use the partial -+ bytes mechanism; instead, rs6000_function_arg will return a -+ PARALLEL including a memory element as necessary. */ -+ if (TARGET_64BIT && ! cum->prototype) -+ return 0; - -+ /* Otherwise, we pass in VRs only. Check for partial copies. */ -+ passed_in_gprs = false; -+ if (cum->vregno + n_elts > ALTIVEC_ARG_MAX_REG + 1) -+ ret = (ALTIVEC_ARG_MAX_REG + 1 - cum->vregno) * 16; -+ } -+ - /* In this complicated case we just disable the partial_nregs code. */ - if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type)) - return 0; -@@ -8825,26 +10298,30 @@ - - align_words = rs6000_parm_start (mode, type, cum->words); - -- if (USE_FP_FOR_ARG_P (cum, mode, type)) -+ if (USE_FP_FOR_ARG_P (cum, elt_mode)) - { -+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; -+ - /* If we are passing this arg in the fixed parameter save area -- (gprs or memory) as well as fprs, then this function should -- return the number of partial bytes passed in the parameter -- save area rather than partial bytes passed in fprs. */ -+ (gprs or memory) as well as FPRs, we do not use the partial -+ bytes mechanism; instead, rs6000_function_arg will return a -+ PARALLEL including a memory element as necessary. */ - if (type - && (cum->nargs_prototype <= 0 -- || (DEFAULT_ABI == ABI_AIX -+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - && TARGET_XL_COMPAT - && align_words >= GP_ARG_NUM_REG))) - return 0; -- else if (cum->fregno + ((GET_MODE_SIZE (mode) + 7) >> 3) -- > FP_ARG_MAX_REG + 1) -- ret = (FP_ARG_MAX_REG + 1 - cum->fregno) * 8; -- else if (cum->nargs_prototype >= 0) -- return 0; -+ -+ /* Otherwise, we pass in FPRs only. Check for partial copies. */ -+ passed_in_gprs = false; -+ if (cum->fregno + n_elts * n_fpreg > FP_ARG_MAX_REG + 1) -+ ret = ((FP_ARG_MAX_REG + 1 - cum->fregno) -+ * MIN (8, GET_MODE_SIZE (elt_mode))); - } - -- if (align_words < GP_ARG_NUM_REG -+ if (passed_in_gprs -+ && align_words < GP_ARG_NUM_REG - && GP_ARG_NUM_REG < align_words + rs6000_arg_size (mode, type)) - ret = (GP_ARG_NUM_REG - align_words) * (TARGET_32BIT ? 4 : 8); - -@@ -8925,6 +10402,139 @@ - return 0; - } - -+/* Process parameter of type TYPE after ARGS_SO_FAR parameters were -+ already processes. Return true if the parameter must be passed -+ (fully or partially) on the stack. */ -+ -+static bool -+rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type) -+{ -+ enum machine_mode mode; -+ int unsignedp; -+ rtx entry_parm; -+ -+ /* Catch errors. */ -+ if (type == NULL || type == error_mark_node) -+ return true; -+ -+ /* Handle types with no storage requirement. */ -+ if (TYPE_MODE (type) == VOIDmode) -+ return false; -+ -+ /* Handle complex types. */ -+ if (TREE_CODE (type) == COMPLEX_TYPE) -+ return (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type)) -+ || rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type))); -+ -+ /* Handle transparent aggregates. */ -+ if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE) -+ && TYPE_TRANSPARENT_AGGR (type)) -+ type = TREE_TYPE (first_field (type)); -+ -+ /* See if this arg was passed by invisible reference. */ -+ if (pass_by_reference (get_cumulative_args (args_so_far), -+ TYPE_MODE (type), type, true)) -+ type = build_pointer_type (type); -+ -+ /* Find mode as it is passed by the ABI. */ -+ unsignedp = TYPE_UNSIGNED (type); -+ mode = promote_mode (type, TYPE_MODE (type), &unsignedp); -+ -+ /* If we must pass in stack, we need a stack. */ -+ if (rs6000_must_pass_in_stack (mode, type)) -+ return true; -+ -+ /* If there is no incoming register, we need a stack. */ -+ entry_parm = rs6000_function_arg (args_so_far, mode, type, true); -+ if (entry_parm == NULL) -+ return true; -+ -+ /* Likewise if we need to pass both in registers and on the stack. */ -+ if (GET_CODE (entry_parm) == PARALLEL -+ && XEXP (XVECEXP (entry_parm, 0, 0), 0) == NULL_RTX) -+ return true; -+ -+ /* Also true if we're partially in registers and partially not. */ -+ if (rs6000_arg_partial_bytes (args_so_far, mode, type, true) != 0) -+ return true; -+ -+ /* Update info on where next arg arrives in registers. */ -+ rs6000_function_arg_advance (args_so_far, mode, type, true); -+ return false; -+} -+ -+/* Return true if FUN has no prototype, has a variable argument -+ list, or passes any parameter in memory. */ -+ -+static bool -+rs6000_function_parms_need_stack (tree fun) -+{ -+ function_args_iterator args_iter; -+ tree arg_type; -+ CUMULATIVE_ARGS args_so_far_v; -+ cumulative_args_t args_so_far; -+ -+ if (!fun) -+ /* Must be a libcall, all of which only use reg parms. */ -+ return false; -+ if (!TYPE_P (fun)) -+ fun = TREE_TYPE (fun); -+ -+ /* Varargs functions need the parameter save area. */ -+ if (!prototype_p (fun) || stdarg_p (fun)) -+ return true; -+ -+ INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX); -+ args_so_far = pack_cumulative_args (&args_so_far_v); -+ -+ if (aggregate_value_p (TREE_TYPE (fun), fun)) -+ { -+ tree type = build_pointer_type (TREE_TYPE (fun)); -+ rs6000_parm_needs_stack (args_so_far, type); -+ } -+ -+ FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter) -+ if (rs6000_parm_needs_stack (args_so_far, arg_type)) -+ return true; -+ -+ return false; -+} -+ -+/* Return the size of the REG_PARM_STACK_SPACE are for FUN. This is -+ usually a constant depending on the ABI. However, in the ELFv2 ABI -+ the register parameter area is optional when calling a function that -+ has a prototype is scope, has no variable argument list, and passes -+ all parameters in registers. */ -+ -+int -+rs6000_reg_parm_stack_space (tree fun) -+{ -+ int reg_parm_stack_space; -+ -+ switch (DEFAULT_ABI) -+ { -+ default: -+ reg_parm_stack_space = 0; -+ break; -+ -+ case ABI_AIX: -+ case ABI_DARWIN: -+ reg_parm_stack_space = TARGET_64BIT ? 64 : 32; -+ break; -+ -+ case ABI_ELFv2: -+ /* ??? Recomputing this every time is a bit expensive. Is there -+ a place to cache this information? */ -+ if (rs6000_function_parms_need_stack (fun)) -+ reg_parm_stack_space = TARGET_64BIT ? 64 : 32; -+ else -+ reg_parm_stack_space = 0; -+ break; -+ } -+ -+ return reg_parm_stack_space; -+} -+ - static void - rs6000_move_block_from_reg (int regno, rtx x, int nregs) - { -@@ -9306,8 +10916,10 @@ - We don't need to check for pass-by-reference because of the test above. - We can return a simplifed answer, since we know there's no offset to add. */ - -- if (TARGET_MACHO -- && rs6000_darwin64_abi -+ if (((TARGET_MACHO -+ && rs6000_darwin64_abi) -+ || DEFAULT_ABI == ABI_ELFv2 -+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) - && integer_zerop (TYPE_SIZE (type))) - { - unsigned HOST_WIDE_INT align, boundary; -@@ -9602,6 +11214,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9615,6 +11228,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9633,6 +11247,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9646,6 +11261,7 @@ - { MASK, ICODE, NAME, ENUM }, - - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9664,6 +11280,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9677,6 +11294,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9693,6 +11311,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9704,6 +11323,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \ - { MASK, ICODE, NAME, ENUM }, - -@@ -9725,6 +11345,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9736,6 +11357,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) \ -@@ -9755,6 +11377,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9768,6 +11391,7 @@ - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \ - { MASK, ICODE, NAME, ENUM }, - -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9785,6 +11409,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9796,6 +11421,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) \ - { MASK, ICODE, NAME, ENUM }, -@@ -9816,6 +11442,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9829,6 +11456,7 @@ - - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9846,8 +11474,9 @@ - #undef RS6000_BUILTIN_2 - #undef RS6000_BUILTIN_3 - #undef RS6000_BUILTIN_A -+#undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E --#undef RS6000_BUILTIN_D -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -9861,6 +11490,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -@@ -9871,6 +11501,7 @@ - #include "rs6000-builtin.def" - }; - -+/* HTM builtins. */ - #undef RS6000_BUILTIN_1 - #undef RS6000_BUILTIN_2 - #undef RS6000_BUILTIN_3 -@@ -9877,11 +11508,42 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S - #undef RS6000_BUILTIN_X - -+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \ -+ { MASK, ICODE, NAME, ENUM }, -+ -+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) -+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE) -+ -+static const struct builtin_description bdesc_htm[] = -+{ -+#include "rs6000-builtin.def" -+}; -+ -+#undef RS6000_BUILTIN_1 -+#undef RS6000_BUILTIN_2 -+#undef RS6000_BUILTIN_3 -+#undef RS6000_BUILTIN_A -+#undef RS6000_BUILTIN_D -+#undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H -+#undef RS6000_BUILTIN_P -+#undef RS6000_BUILTIN_Q -+#undef RS6000_BUILTIN_S -+ - /* Return true if a builtin function is overloaded. */ - bool - rs6000_overloaded_builtin_p (enum rs6000_builtins fncode) -@@ -10189,7 +11851,101 @@ - return target; - } - -+/* Return a constant vector for use as a little-endian permute control vector -+ to reverse the order of elements of the given vector mode. */ - static rtx -+swap_selector_for_mode (enum machine_mode mode) -+{ -+ /* These are little endian vectors, so their elements are reversed -+ from what you would normally expect for a permute control vector. */ -+ unsigned int swap2[16] = {7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8}; -+ unsigned int swap4[16] = {3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12}; -+ unsigned int swap8[16] = {1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14}; -+ unsigned int swap16[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; -+ unsigned int *swaparray, i; -+ rtx perm[16]; -+ -+ switch (mode) -+ { -+ case V2DFmode: -+ case V2DImode: -+ swaparray = swap2; -+ break; -+ case V4SFmode: -+ case V4SImode: -+ swaparray = swap4; -+ break; -+ case V8HImode: -+ swaparray = swap8; -+ break; -+ case V16QImode: -+ swaparray = swap16; -+ break; -+ default: -+ gcc_unreachable (); -+ } -+ -+ for (i = 0; i < 16; ++i) -+ perm[i] = GEN_INT (swaparray[i]); -+ -+ return force_reg (V16QImode, gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm))); -+} -+ -+/* Generate code for an "lvx", "lvxl", or "lve*x" built-in for a little endian target -+ with -maltivec=be specified. Issue the load followed by an element-reversing -+ permute. */ -+void -+altivec_expand_lvx_be (rtx op0, rtx op1, enum machine_mode mode, unsigned unspec) -+{ -+ rtx tmp = gen_reg_rtx (mode); -+ rtx load = gen_rtx_SET (VOIDmode, tmp, op1); -+ rtx lvx = gen_rtx_UNSPEC (mode, gen_rtvec (1, const0_rtx), unspec); -+ rtx par = gen_rtx_PARALLEL (mode, gen_rtvec (2, load, lvx)); -+ rtx sel = swap_selector_for_mode (mode); -+ rtx vperm = gen_rtx_UNSPEC (mode, gen_rtvec (3, tmp, tmp, sel), UNSPEC_VPERM); -+ -+ gcc_assert (REG_P (op0)); -+ emit_insn (par); -+ emit_insn (gen_rtx_SET (VOIDmode, op0, vperm)); -+} -+ -+/* Generate code for a "stvx" or "stvxl" built-in for a little endian target -+ with -maltivec=be specified. Issue the store preceded by an element-reversing -+ permute. */ -+void -+altivec_expand_stvx_be (rtx op0, rtx op1, enum machine_mode mode, unsigned unspec) -+{ -+ rtx tmp = gen_reg_rtx (mode); -+ rtx store = gen_rtx_SET (VOIDmode, op0, tmp); -+ rtx stvx = gen_rtx_UNSPEC (mode, gen_rtvec (1, const0_rtx), unspec); -+ rtx par = gen_rtx_PARALLEL (mode, gen_rtvec (2, store, stvx)); -+ rtx sel = swap_selector_for_mode (mode); -+ rtx vperm; -+ -+ gcc_assert (REG_P (op1)); -+ vperm = gen_rtx_UNSPEC (mode, gen_rtvec (3, op1, op1, sel), UNSPEC_VPERM); -+ emit_insn (gen_rtx_SET (VOIDmode, tmp, vperm)); -+ emit_insn (par); -+} -+ -+/* Generate code for a "stve*x" built-in for a little endian target with -maltivec=be -+ specified. Issue the store preceded by an element-reversing permute. */ -+void -+altivec_expand_stvex_be (rtx op0, rtx op1, enum machine_mode mode, unsigned unspec) -+{ -+ enum machine_mode inner_mode = GET_MODE_INNER (mode); -+ rtx tmp = gen_reg_rtx (mode); -+ rtx stvx = gen_rtx_UNSPEC (inner_mode, gen_rtvec (1, tmp), unspec); -+ rtx sel = swap_selector_for_mode (mode); -+ rtx vperm; -+ -+ gcc_assert (REG_P (op1)); -+ vperm = gen_rtx_UNSPEC (mode, gen_rtvec (3, op1, op1, sel), UNSPEC_VPERM); -+ emit_insn (gen_rtx_SET (VOIDmode, tmp, vperm)); -+ emit_insn (gen_rtx_SET (VOIDmode, op0, stvx)); -+} -+ -+static rtx - altivec_expand_lv_builtin (enum insn_code icode, tree exp, rtx target, bool blk) - { - rtx pat, addr; -@@ -10351,7 +12107,198 @@ - return NULL_RTX; - } - -+/* Return the appropriate SPR number associated with the given builtin. */ -+static inline HOST_WIDE_INT -+htm_spr_num (enum rs6000_builtins code) -+{ -+ if (code == HTM_BUILTIN_GET_TFHAR -+ || code == HTM_BUILTIN_SET_TFHAR) -+ return TFHAR_SPR; -+ else if (code == HTM_BUILTIN_GET_TFIAR -+ || code == HTM_BUILTIN_SET_TFIAR) -+ return TFIAR_SPR; -+ else if (code == HTM_BUILTIN_GET_TEXASR -+ || code == HTM_BUILTIN_SET_TEXASR) -+ return TEXASR_SPR; -+ gcc_assert (code == HTM_BUILTIN_GET_TEXASRU -+ || code == HTM_BUILTIN_SET_TEXASRU); -+ return TEXASRU_SPR; -+} -+ -+/* Return the appropriate SPR regno associated with the given builtin. */ -+static inline HOST_WIDE_INT -+htm_spr_regno (enum rs6000_builtins code) -+{ -+ if (code == HTM_BUILTIN_GET_TFHAR -+ || code == HTM_BUILTIN_SET_TFHAR) -+ return TFHAR_REGNO; -+ else if (code == HTM_BUILTIN_GET_TFIAR -+ || code == HTM_BUILTIN_SET_TFIAR) -+ return TFIAR_REGNO; -+ gcc_assert (code == HTM_BUILTIN_GET_TEXASR -+ || code == HTM_BUILTIN_SET_TEXASR -+ || code == HTM_BUILTIN_GET_TEXASRU -+ || code == HTM_BUILTIN_SET_TEXASRU); -+ return TEXASR_REGNO; -+} -+ -+/* Return the correct ICODE value depending on whether we are -+ setting or reading the HTM SPRs. */ -+static inline enum insn_code -+rs6000_htm_spr_icode (bool nonvoid) -+{ -+ if (nonvoid) -+ return (TARGET_64BIT) ? CODE_FOR_htm_mfspr_di : CODE_FOR_htm_mfspr_si; -+ else -+ return (TARGET_64BIT) ? CODE_FOR_htm_mtspr_di : CODE_FOR_htm_mtspr_si; -+} -+ -+/* Expand the HTM builtin in EXP and store the result in TARGET. -+ Store true in *EXPANDEDP if we found a builtin to expand. */ - static rtx -+htm_expand_builtin (tree exp, rtx target, bool * expandedp) -+{ -+ tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); -+ bool nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node; -+ enum rs6000_builtins fcode = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl); -+ const struct builtin_description *d; -+ size_t i; -+ -+ *expandedp = false; -+ -+ /* Expand the HTM builtins. */ -+ d = bdesc_htm; -+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++) -+ if (d->code == fcode) -+ { -+ rtx op[MAX_HTM_OPERANDS], pat; -+ int nopnds = 0; -+ tree arg; -+ call_expr_arg_iterator iter; -+ unsigned attr = rs6000_builtin_info[fcode].attr; -+ enum insn_code icode = d->icode; -+ -+ if (attr & RS6000_BTC_SPR) -+ icode = rs6000_htm_spr_icode (nonvoid); -+ -+ if (nonvoid) -+ { -+ enum machine_mode tmode = insn_data[icode].operand[0].mode; -+ if (!target -+ || GET_MODE (target) != tmode -+ || !(*insn_data[icode].operand[0].predicate) (target, tmode)) -+ target = gen_reg_rtx (tmode); -+ op[nopnds++] = target; -+ } -+ -+ FOR_EACH_CALL_EXPR_ARG (arg, iter, exp) -+ { -+ const struct insn_operand_data *insn_op; -+ -+ if (arg == error_mark_node || nopnds >= MAX_HTM_OPERANDS) -+ return NULL_RTX; -+ -+ insn_op = &insn_data[icode].operand[nopnds]; -+ -+ op[nopnds] = expand_normal (arg); -+ -+ if (!(*insn_op->predicate) (op[nopnds], insn_op->mode)) -+ { -+ if (!strcmp (insn_op->constraint, "n")) -+ { -+ int arg_num = (nonvoid) ? nopnds : nopnds + 1; -+ if (!CONST_INT_P (op[nopnds])) -+ error ("argument %d must be an unsigned literal", arg_num); -+ else -+ error ("argument %d is an unsigned literal that is " -+ "out of range", arg_num); -+ return const0_rtx; -+ } -+ op[nopnds] = copy_to_mode_reg (insn_op->mode, op[nopnds]); -+ } -+ -+ nopnds++; -+ } -+ -+ /* Handle the builtins for extended mnemonics. These accept -+ no arguments, but map to builtins that take arguments. */ -+ switch (fcode) -+ { -+ case HTM_BUILTIN_TENDALL: /* Alias for: tend. 1 */ -+ case HTM_BUILTIN_TRESUME: /* Alias for: tsr. 1 */ -+ op[nopnds++] = GEN_INT (1); -+#ifdef ENABLE_CHECKING -+ attr |= RS6000_BTC_UNARY; -+#endif -+ break; -+ case HTM_BUILTIN_TSUSPEND: /* Alias for: tsr. 0 */ -+ op[nopnds++] = GEN_INT (0); -+#ifdef ENABLE_CHECKING -+ attr |= RS6000_BTC_UNARY; -+#endif -+ break; -+ default: -+ break; -+ } -+ -+ /* If this builtin accesses SPRs, then pass in the appropriate -+ SPR number and SPR regno as the last two operands. */ -+ if (attr & RS6000_BTC_SPR) -+ { -+ op[nopnds++] = gen_rtx_CONST_INT (Pmode, htm_spr_num (fcode)); -+ op[nopnds++] = gen_rtx_REG (Pmode, htm_spr_regno (fcode)); -+ } -+ -+#ifdef ENABLE_CHECKING -+ int expected_nopnds = 0; -+ if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_UNARY) -+ expected_nopnds = 1; -+ else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_BINARY) -+ expected_nopnds = 2; -+ else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_TERNARY) -+ expected_nopnds = 3; -+ if (!(attr & RS6000_BTC_VOID)) -+ expected_nopnds += 1; -+ if (attr & RS6000_BTC_SPR) -+ expected_nopnds += 2; -+ -+ gcc_assert (nopnds == expected_nopnds && nopnds <= MAX_HTM_OPERANDS); -+#endif -+ -+ switch (nopnds) -+ { -+ case 0: -+ pat = GEN_FCN (icode) (NULL_RTX); -+ break; -+ case 1: -+ pat = GEN_FCN (icode) (op[0]); -+ break; -+ case 2: -+ pat = GEN_FCN (icode) (op[0], op[1]); -+ break; -+ case 3: -+ pat = GEN_FCN (icode) (op[0], op[1], op[2]); -+ break; -+ case 4: -+ pat = GEN_FCN (icode) (op[0], op[1], op[2], op[3]); -+ break; -+ default: -+ gcc_unreachable (); -+ } -+ if (!pat) -+ return NULL_RTX; -+ emit_insn (pat); -+ -+ *expandedp = true; -+ if (nonvoid) -+ return target; -+ return const0_rtx; -+ } -+ -+ return NULL_RTX; -+} ++ tree parm; + -+static rtx - rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target) - { - rtx pat; -@@ -10427,7 +12374,28 @@ - return const0_rtx; - } - } -+ else if (icode == CODE_FOR_crypto_vshasigmaw -+ || icode == CODE_FOR_crypto_vshasigmad) -+ { -+ /* Check whether the 2nd and 3rd arguments are integer constants and in -+ range and prepare arguments. */ -+ STRIP_NOPS (arg1); -+ if (TREE_CODE (arg1) != INTEGER_CST -+ || !IN_RANGE (TREE_INT_CST_LOW (arg1), 0, 1)) -+ { -+ error ("argument 2 must be 0 or 1"); -+ return const0_rtx; -+ } - -+ STRIP_NOPS (arg2); -+ if (TREE_CODE (arg2) != INTEGER_CST -+ || !IN_RANGE (TREE_INT_CST_LOW (arg2), 0, 15)) -+ { -+ error ("argument 3 must be in the range 0..15"); -+ return const0_rtx; -+ } -+ } -+ - if (target == 0 - || GET_MODE (target) != tmode - || ! (*insn_data[icode].operand[0].predicate) (target, tmode)) -@@ -10481,6 +12449,8 @@ - break; - case ALTIVEC_BUILTIN_LD_INTERNAL_2di: - icode = CODE_FOR_vector_altivec_load_v2di; -+ case ALTIVEC_BUILTIN_LD_INTERNAL_1ti: -+ icode = CODE_FOR_vector_altivec_load_v1ti; - break; - default: - *expandedp = false; -@@ -10540,6 +12510,8 @@ - break; - case ALTIVEC_BUILTIN_ST_INTERNAL_2di: - icode = CODE_FOR_vector_altivec_store_v2di; -+ case ALTIVEC_BUILTIN_ST_INTERNAL_1ti: -+ icode = CODE_FOR_vector_altivec_store_v1ti; - break; - default: - *expandedp = false; -@@ -10632,21 +12604,33 @@ - enum machine_mode tmode = TYPE_MODE (type); - enum machine_mode inner_mode = GET_MODE_INNER (tmode); - int i, n_elt = GET_MODE_NUNITS (tmode); -- rtvec v = rtvec_alloc (n_elt); - - gcc_assert (VECTOR_MODE_P (tmode)); - gcc_assert (n_elt == call_expr_nargs (exp)); - -- for (i = 0; i < n_elt; ++i) -+ if (!target || !register_operand (target, tmode)) -+ target = gen_reg_rtx (tmode); -+ -+ /* If we have a vector compromised of a single element, such as V1TImode, do -+ the initialization directly. */ -+ if (n_elt == 1 && GET_MODE_SIZE (tmode) == GET_MODE_SIZE (inner_mode)) - { -- rtx x = expand_normal (CALL_EXPR_ARG (exp, i)); -- RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x); -+ rtx x = expand_normal (CALL_EXPR_ARG (exp, 0)); -+ emit_move_insn (target, gen_lowpart (tmode, x)); - } -+ else -+ { -+ rtvec v = rtvec_alloc (n_elt); - -- if (!target || !register_operand (target, tmode)) -- target = gen_reg_rtx (tmode); -+ for (i = 0; i < n_elt; ++i) -+ { -+ rtx x = expand_normal (CALL_EXPR_ARG (exp, i)); -+ RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x); -+ } - -- rs6000_expand_vector_init (target, gen_rtx_PARALLEL (tmode, v)); -+ rs6000_expand_vector_init (target, gen_rtx_PARALLEL (tmode, v)); -+ } -+ - return target; - } - -@@ -10769,8 +12753,19 @@ - - switch (fcode) - { -+ case ALTIVEC_BUILTIN_STVX_V2DF: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2df, exp); -+ case ALTIVEC_BUILTIN_STVX_V2DI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2di, exp); -+ case ALTIVEC_BUILTIN_STVX_V4SF: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4sf, exp); - case ALTIVEC_BUILTIN_STVX: -+ case ALTIVEC_BUILTIN_STVX_V4SI: - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4si, exp); -+ case ALTIVEC_BUILTIN_STVX_V8HI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v8hi, exp); -+ case ALTIVEC_BUILTIN_STVX_V16QI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v16qi, exp); - case ALTIVEC_BUILTIN_STVEBX: - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, exp); - case ALTIVEC_BUILTIN_STVEHX: -@@ -10777,8 +12772,19 @@ - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, exp); - case ALTIVEC_BUILTIN_STVEWX: - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, exp); -+ case ALTIVEC_BUILTIN_STVXL_V2DF: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v2df, exp); -+ case ALTIVEC_BUILTIN_STVXL_V2DI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v2di, exp); -+ case ALTIVEC_BUILTIN_STVXL_V4SF: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v4sf, exp); - case ALTIVEC_BUILTIN_STVXL: -- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl, exp); -+ case ALTIVEC_BUILTIN_STVXL_V4SI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v4si, exp); -+ case ALTIVEC_BUILTIN_STVXL_V8HI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v8hi, exp); -+ case ALTIVEC_BUILTIN_STVXL_V16QI: -+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v16qi, exp); - - case ALTIVEC_BUILTIN_STVLX: - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvlx, exp); -@@ -10789,6 +12795,8 @@ - case ALTIVEC_BUILTIN_STVRXL: - return altivec_expand_stv_builtin (CODE_FOR_altivec_stvrxl, exp); - -+ case VSX_BUILTIN_STXVD2X_V1TI: -+ return altivec_expand_stv_builtin (CODE_FOR_vsx_store_v1ti, exp); - case VSX_BUILTIN_STXVD2X_V2DF: - return altivec_expand_stv_builtin (CODE_FOR_vsx_store_v2df, exp); - case VSX_BUILTIN_STXVD2X_V2DI: -@@ -10869,6 +12877,7 @@ - case ALTIVEC_BUILTIN_VEC_INIT_V4SF: - case VSX_BUILTIN_VEC_INIT_V2DF: - case VSX_BUILTIN_VEC_INIT_V2DI: -+ case VSX_BUILTIN_VEC_INIT_V1TI: - return altivec_expand_vec_init_builtin (TREE_TYPE (exp), exp, target); - - case ALTIVEC_BUILTIN_VEC_SET_V4SI: -@@ -10877,6 +12886,7 @@ - case ALTIVEC_BUILTIN_VEC_SET_V4SF: - case VSX_BUILTIN_VEC_SET_V2DF: - case VSX_BUILTIN_VEC_SET_V2DI: -+ case VSX_BUILTIN_VEC_SET_V1TI: - return altivec_expand_vec_set_builtin (exp); - - case ALTIVEC_BUILTIN_VEC_EXT_V4SI: -@@ -10885,6 +12895,7 @@ - case ALTIVEC_BUILTIN_VEC_EXT_V4SF: - case VSX_BUILTIN_VEC_EXT_V2DF: - case VSX_BUILTIN_VEC_EXT_V2DI: -+ case VSX_BUILTIN_VEC_EXT_V1TI: - return altivec_expand_vec_ext_builtin (exp, target); - - default: -@@ -10922,12 +12933,44 @@ - case ALTIVEC_BUILTIN_LVEWX: - return altivec_expand_lv_builtin (CODE_FOR_altivec_lvewx, - exp, target, false); -+ case ALTIVEC_BUILTIN_LVXL_V2DF: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v2df, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVXL_V2DI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v2di, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVXL_V4SF: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v4sf, -+ exp, target, false); - case ALTIVEC_BUILTIN_LVXL: -- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl, -+ case ALTIVEC_BUILTIN_LVXL_V4SI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v4si, - exp, target, false); -+ case ALTIVEC_BUILTIN_LVXL_V8HI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v8hi, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVXL_V16QI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v16qi, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVX_V2DF: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2df, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVX_V2DI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2di, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVX_V4SF: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4sf, -+ exp, target, false); - case ALTIVEC_BUILTIN_LVX: -+ case ALTIVEC_BUILTIN_LVX_V4SI: - return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4si, - exp, target, false); -+ case ALTIVEC_BUILTIN_LVX_V8HI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v8hi, -+ exp, target, false); -+ case ALTIVEC_BUILTIN_LVX_V16QI: -+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v16qi, -+ exp, target, false); - case ALTIVEC_BUILTIN_LVLX: - return altivec_expand_lv_builtin (CODE_FOR_altivec_lvlx, - exp, target, true); -@@ -10940,6 +12983,9 @@ - case ALTIVEC_BUILTIN_LVRXL: - return altivec_expand_lv_builtin (CODE_FOR_altivec_lvrxl, - exp, target, true); -+ case VSX_BUILTIN_LXVD2X_V1TI: -+ return altivec_expand_lv_builtin (CODE_FOR_vsx_load_v1ti, -+ exp, target, false); - case VSX_BUILTIN_LXVD2X_V2DF: - return altivec_expand_lv_builtin (CODE_FOR_vsx_load_v2df, - exp, target, false); -@@ -11411,6 +13457,8 @@ - error ("Builtin function %s is only valid for the cell processor", name); - else if ((fnmask & RS6000_BTM_VSX) != 0) - error ("Builtin function %s requires the -mvsx option", name); -+ else if ((fnmask & RS6000_BTM_HTM) != 0) -+ error ("Builtin function %s requires the -mhtm option", name); - else if ((fnmask & RS6000_BTM_ALTIVEC) != 0) - error ("Builtin function %s requires the -maltivec option", name); - else if ((fnmask & RS6000_BTM_PAIRED) != 0) -@@ -11515,7 +13563,8 @@ - case ALTIVEC_BUILTIN_MASK_FOR_LOAD: - case ALTIVEC_BUILTIN_MASK_FOR_STORE: - { -- int icode = (int) CODE_FOR_altivec_lvsr; -+ int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr -+ : (int) CODE_FOR_altivec_lvsl); - enum machine_mode tmode = insn_data[icode].operand[0].mode; - enum machine_mode mode = insn_data[icode].operand[1].mode; - tree arg; -@@ -11590,7 +13639,14 @@ - if (success) - return ret; - } -+ if (TARGET_HTM) -+ { -+ ret = htm_expand_builtin (exp, target, &success); - -+ if (success) -+ return ret; -+ } -+ - gcc_assert (TARGET_ALTIVEC || TARGET_VSX || TARGET_SPE || TARGET_PAIRED_FLOAT); - - /* Handle simple unary operations. */ -@@ -11648,6 +13704,14 @@ - opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node); - opaque_V4SI_type_node = build_opaque_vector_type (intSI_type_node, 4); - -+ /* We use V1TI mode as a special container to hold __int128_t items that -+ must live in VSX registers. */ -+ if (intTI_type_node) -+ { -+ V1TI_type_node = build_vector_type (intTI_type_node, 1); -+ unsigned_V1TI_type_node = build_vector_type (unsigned_intTI_type_node, 1); -+ } -+ - /* The 'vector bool ...' types must be kept distinct from 'vector unsigned ...' - types, especially in C++ land. Similarly, 'vector pixel' is distinct from - 'vector unsigned short'. */ -@@ -11670,6 +13734,8 @@ - uintSI_type_internal_node = unsigned_intSI_type_node; - intDI_type_internal_node = intDI_type_node; - uintDI_type_internal_node = unsigned_intDI_type_node; -+ intTI_type_internal_node = intTI_type_node; -+ uintTI_type_internal_node = unsigned_intTI_type_node; - float_type_internal_node = float_type_node; - double_type_internal_node = double_type_node; - void_type_internal_node = void_type_node; -@@ -11682,8 +13748,12 @@ - builtin_mode_to_type[SImode][1] = unsigned_intSI_type_node; - builtin_mode_to_type[DImode][0] = intDI_type_node; - builtin_mode_to_type[DImode][1] = unsigned_intDI_type_node; -+ builtin_mode_to_type[TImode][0] = intTI_type_node; -+ builtin_mode_to_type[TImode][1] = unsigned_intTI_type_node; - builtin_mode_to_type[SFmode][0] = float_type_node; - builtin_mode_to_type[DFmode][0] = double_type_node; -+ builtin_mode_to_type[V1TImode][0] = V1TI_type_node; -+ builtin_mode_to_type[V1TImode][1] = unsigned_V1TI_type_node; - builtin_mode_to_type[V2SImode][0] = V2SI_type_node; - builtin_mode_to_type[V2SFmode][0] = V2SF_type_node; - builtin_mode_to_type[V2DImode][0] = V2DI_type_node; -@@ -11752,15 +13822,42 @@ - tdecl = add_builtin_type ("__vector double", V2DF_type_node); - TYPE_NAME (V2DF_type_node) = tdecl; - -- tdecl = add_builtin_type ("__vector long", V2DI_type_node); -- TYPE_NAME (V2DI_type_node) = tdecl; -+ if (TARGET_POWERPC64) -+ { -+ tdecl = add_builtin_type ("__vector long", V2DI_type_node); -+ TYPE_NAME (V2DI_type_node) = tdecl; - -- tdecl = add_builtin_type ("__vector unsigned long", unsigned_V2DI_type_node); -- TYPE_NAME (unsigned_V2DI_type_node) = tdecl; -+ tdecl = add_builtin_type ("__vector unsigned long", -+ unsigned_V2DI_type_node); -+ TYPE_NAME (unsigned_V2DI_type_node) = tdecl; - -- tdecl = add_builtin_type ("__vector __bool long", bool_V2DI_type_node); -- TYPE_NAME (bool_V2DI_type_node) = tdecl; -+ tdecl = add_builtin_type ("__vector __bool long", bool_V2DI_type_node); -+ TYPE_NAME (bool_V2DI_type_node) = tdecl; ++ for (parm = DECL_ARGUMENTS (fun); ++ parm && parm != void_list_node; ++ parm = TREE_CHAIN (parm)) ++ if (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (parm))) ++ return true; + } + else + { -+ tdecl = add_builtin_type ("__vector long long", V2DI_type_node); -+ TYPE_NAME (V2DI_type_node) = tdecl; - -+ tdecl = add_builtin_type ("__vector unsigned long long", -+ unsigned_V2DI_type_node); -+ TYPE_NAME (unsigned_V2DI_type_node) = tdecl; -+ -+ tdecl = add_builtin_type ("__vector __bool long long", -+ bool_V2DI_type_node); -+ TYPE_NAME (bool_V2DI_type_node) = tdecl; -+ } -+ -+ if (V1TI_type_node) -+ { -+ tdecl = add_builtin_type ("__vector __int128", V1TI_type_node); -+ TYPE_NAME (V1TI_type_node) = tdecl; -+ -+ tdecl = add_builtin_type ("__vector unsigned __int128", -+ unsigned_V1TI_type_node); -+ TYPE_NAME (unsigned_V1TI_type_node) = tdecl; -+ } -+ - /* Paired and SPE builtins are only available if you build a compiler with - the appropriate options, so only create those builtins with the - appropriate compiler option. Create Altivec and VSX builtins on machines -@@ -11772,6 +13869,9 @@ - spe_init_builtins (); - if (TARGET_EXTRA_BUILTINS) - altivec_init_builtins (); -+ if (TARGET_HTM) -+ htm_init_builtins (); -+ - if (TARGET_EXTRA_BUILTINS || TARGET_SPE || TARGET_PAIRED_FLOAT) - rs6000_common_init_builtins (); - -@@ -12117,6 +14217,10 @@ - = build_function_type_list (integer_type_node, - integer_type_node, V4SI_type_node, - V4SI_type_node, NULL_TREE); -+ tree int_ftype_int_v2di_v2di -+ = build_function_type_list (integer_type_node, -+ integer_type_node, V2DI_type_node, -+ V2DI_type_node, NULL_TREE); - tree void_ftype_v4si - = build_function_type_list (void_type_node, V4SI_type_node, NULL_TREE); - tree v8hi_ftype_void -@@ -12199,6 +14303,8 @@ - = build_function_type_list (integer_type_node, - integer_type_node, V2DF_type_node, - V2DF_type_node, NULL_TREE); -+ tree v2di_ftype_v2di -+ = build_function_type_list (V2DI_type_node, V2DI_type_node, NULL_TREE); - tree v4si_ftype_v4si - = build_function_type_list (V4SI_type_node, V4SI_type_node, NULL_TREE); - tree v8hi_ftype_v8hi -@@ -12224,10 +14330,58 @@ - def_builtin ("__builtin_altivec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEHX); - def_builtin ("__builtin_altivec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEWX); - def_builtin ("__builtin_altivec_lvxl", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVXL); -+ def_builtin ("__builtin_altivec_lvxl_v2df", v2df_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V2DF); -+ def_builtin ("__builtin_altivec_lvxl_v2di", v2di_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V2DI); -+ def_builtin ("__builtin_altivec_lvxl_v4sf", v4sf_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V4SF); -+ def_builtin ("__builtin_altivec_lvxl_v4si", v4si_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V4SI); -+ def_builtin ("__builtin_altivec_lvxl_v8hi", v8hi_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V8HI); -+ def_builtin ("__builtin_altivec_lvxl_v16qi", v16qi_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVXL_V16QI); - def_builtin ("__builtin_altivec_lvx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVX); -+ def_builtin ("__builtin_altivec_lvx_v2df", v2df_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V2DF); -+ def_builtin ("__builtin_altivec_lvx_v2di", v2di_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V2DI); -+ def_builtin ("__builtin_altivec_lvx_v4sf", v4sf_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V4SF); -+ def_builtin ("__builtin_altivec_lvx_v4si", v4si_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V4SI); -+ def_builtin ("__builtin_altivec_lvx_v8hi", v8hi_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V8HI); -+ def_builtin ("__builtin_altivec_lvx_v16qi", v16qi_ftype_long_pcvoid, -+ ALTIVEC_BUILTIN_LVX_V16QI); - def_builtin ("__builtin_altivec_stvx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVX); -+ def_builtin ("__builtin_altivec_stvx_v2df", void_ftype_v2df_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V2DF); -+ def_builtin ("__builtin_altivec_stvx_v2di", void_ftype_v2di_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V2DI); -+ def_builtin ("__builtin_altivec_stvx_v4sf", void_ftype_v4sf_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V4SF); -+ def_builtin ("__builtin_altivec_stvx_v4si", void_ftype_v4si_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V4SI); -+ def_builtin ("__builtin_altivec_stvx_v8hi", void_ftype_v8hi_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V8HI); -+ def_builtin ("__builtin_altivec_stvx_v16qi", void_ftype_v16qi_long_pvoid, -+ ALTIVEC_BUILTIN_STVX_V16QI); - def_builtin ("__builtin_altivec_stvewx", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVEWX); - def_builtin ("__builtin_altivec_stvxl", void_ftype_v4si_long_pvoid, ALTIVEC_BUILTIN_STVXL); -+ def_builtin ("__builtin_altivec_stvxl_v2df", void_ftype_v2df_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V2DF); -+ def_builtin ("__builtin_altivec_stvxl_v2di", void_ftype_v2di_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V2DI); -+ def_builtin ("__builtin_altivec_stvxl_v4sf", void_ftype_v4sf_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V4SF); -+ def_builtin ("__builtin_altivec_stvxl_v4si", void_ftype_v4si_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V4SI); -+ def_builtin ("__builtin_altivec_stvxl_v8hi", void_ftype_v8hi_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V8HI); -+ def_builtin ("__builtin_altivec_stvxl_v16qi", void_ftype_v16qi_long_pvoid, -+ ALTIVEC_BUILTIN_STVXL_V16QI); - def_builtin ("__builtin_altivec_stvebx", void_ftype_v16qi_long_pvoid, ALTIVEC_BUILTIN_STVEBX); - def_builtin ("__builtin_altivec_stvehx", void_ftype_v8hi_long_pvoid, ALTIVEC_BUILTIN_STVEHX); - def_builtin ("__builtin_vec_ld", opaque_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LD); -@@ -12334,6 +14488,9 @@ - case VOIDmode: - type = int_ftype_int_opaque_opaque; - break; -+ case V2DImode: -+ type = int_ftype_int_v2di_v2di; -+ break; - case V4SImode: - type = int_ftype_int_v4si_v4si; - break; -@@ -12367,6 +14524,9 @@ - - switch (mode0) - { -+ case V2DImode: -+ type = v2di_ftype_v2di; -+ break; - case V4SImode: - type = v4si_ftype_v4si; - break; -@@ -12497,8 +14657,109 @@ - ftype = build_function_type_list (intDI_type_node, V2DI_type_node, - integer_type_node, NULL_TREE); - def_builtin ("__builtin_vec_ext_v2di", ftype, VSX_BUILTIN_VEC_EXT_V2DI); -+ -+ -+ if (V1TI_type_node) -+ { -+ tree v1ti_ftype_long_pcvoid -+ = build_function_type_list (V1TI_type_node, -+ long_integer_type_node, pcvoid_type_node, -+ NULL_TREE); -+ tree void_ftype_v1ti_long_pvoid -+ = build_function_type_list (void_type_node, -+ V1TI_type_node, long_integer_type_node, -+ pvoid_type_node, NULL_TREE); -+ def_builtin ("__builtin_vsx_lxvd2x_v1ti", v1ti_ftype_long_pcvoid, -+ VSX_BUILTIN_LXVD2X_V1TI); -+ def_builtin ("__builtin_vsx_stxvd2x_v1ti", void_ftype_v1ti_long_pvoid, -+ VSX_BUILTIN_STXVD2X_V1TI); -+ ftype = build_function_type_list (V1TI_type_node, intTI_type_node, -+ NULL_TREE, NULL_TREE); -+ def_builtin ("__builtin_vec_init_v1ti", ftype, VSX_BUILTIN_VEC_INIT_V1TI); -+ ftype = build_function_type_list (V1TI_type_node, V1TI_type_node, -+ intTI_type_node, -+ integer_type_node, NULL_TREE); -+ def_builtin ("__builtin_vec_set_v1ti", ftype, VSX_BUILTIN_VEC_SET_V1TI); -+ ftype = build_function_type_list (intTI_type_node, V1TI_type_node, -+ integer_type_node, NULL_TREE); -+ def_builtin ("__builtin_vec_ext_v1ti", ftype, VSX_BUILTIN_VEC_EXT_V1TI); -+ } -+ - } - -+static void -+htm_init_builtins (void) -+{ -+ HOST_WIDE_INT builtin_mask = rs6000_builtin_mask; -+ const struct builtin_description *d; -+ size_t i; -+ -+ d = bdesc_htm; -+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++) -+ { -+ tree op[MAX_HTM_OPERANDS], type; -+ HOST_WIDE_INT mask = d->mask; -+ unsigned attr = rs6000_builtin_info[d->code].attr; -+ bool void_func = (attr & RS6000_BTC_VOID); -+ int attr_args = (attr & RS6000_BTC_TYPE_MASK); -+ int nopnds = 0; -+ tree argtype = (attr & RS6000_BTC_SPR) ? long_unsigned_type_node -+ : unsigned_type_node; -+ -+ if ((mask & builtin_mask) != mask) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "htm_builtin, skip binary %s\n", d->name); -+ continue; -+ } -+ -+ if (d->name == 0) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "htm_builtin, bdesc_htm[%ld] no name\n", -+ (long unsigned) i); -+ continue; -+ } -+ -+ op[nopnds++] = (void_func) ? void_type_node : argtype; -+ -+ if (attr_args == RS6000_BTC_UNARY) -+ op[nopnds++] = argtype; -+ else if (attr_args == RS6000_BTC_BINARY) -+ { -+ op[nopnds++] = argtype; -+ op[nopnds++] = argtype; -+ } -+ else if (attr_args == RS6000_BTC_TERNARY) -+ { -+ op[nopnds++] = argtype; -+ op[nopnds++] = argtype; -+ op[nopnds++] = argtype; -+ } -+ -+ switch (nopnds) -+ { -+ case 1: -+ type = build_function_type_list (op[0], NULL_TREE); -+ break; -+ case 2: -+ type = build_function_type_list (op[0], op[1], NULL_TREE); -+ break; -+ case 3: -+ type = build_function_type_list (op[0], op[1], op[2], NULL_TREE); -+ break; -+ case 4: -+ type = build_function_type_list (op[0], op[1], op[2], op[3], -+ NULL_TREE); -+ break; -+ default: -+ gcc_unreachable (); -+ } -+ -+ def_builtin (d->name, type, d->code); -+ } -+} -+ - /* Hash function for builtin functions with up to 3 arguments and a return - type. */ - static unsigned -@@ -12572,11 +14833,27 @@ - are type correct. */ - switch (builtin) - { -+ /* unsigned 1 argument functions. */ -+ case CRYPTO_BUILTIN_VSBOX: -+ case P8V_BUILTIN_VGBBD: -+ h.uns_p[0] = 1; -+ h.uns_p[1] = 1; -+ break; -+ - /* unsigned 2 argument functions. */ - case ALTIVEC_BUILTIN_VMULEUB_UNS: - case ALTIVEC_BUILTIN_VMULEUH_UNS: - case ALTIVEC_BUILTIN_VMULOUB_UNS: - case ALTIVEC_BUILTIN_VMULOUH_UNS: -+ case CRYPTO_BUILTIN_VCIPHER: -+ case CRYPTO_BUILTIN_VCIPHERLAST: -+ case CRYPTO_BUILTIN_VNCIPHER: -+ case CRYPTO_BUILTIN_VNCIPHERLAST: -+ case CRYPTO_BUILTIN_VPMSUMB: -+ case CRYPTO_BUILTIN_VPMSUMH: -+ case CRYPTO_BUILTIN_VPMSUMW: -+ case CRYPTO_BUILTIN_VPMSUMD: -+ case CRYPTO_BUILTIN_VPMSUM: - h.uns_p[0] = 1; - h.uns_p[1] = 1; - h.uns_p[2] = 1; -@@ -12599,6 +14876,14 @@ - case VSX_BUILTIN_XXSEL_8HI_UNS: - case VSX_BUILTIN_XXSEL_4SI_UNS: - case VSX_BUILTIN_XXSEL_2DI_UNS: -+ case CRYPTO_BUILTIN_VPERMXOR: -+ case CRYPTO_BUILTIN_VPERMXOR_V2DI: -+ case CRYPTO_BUILTIN_VPERMXOR_V4SI: -+ case CRYPTO_BUILTIN_VPERMXOR_V8HI: -+ case CRYPTO_BUILTIN_VPERMXOR_V16QI: -+ case CRYPTO_BUILTIN_VSHASIGMAW: -+ case CRYPTO_BUILTIN_VSHASIGMAD: -+ case CRYPTO_BUILTIN_VSHASIGMA: - h.uns_p[0] = 1; - h.uns_p[1] = 1; - h.uns_p[2] = 1; -@@ -12740,9 +15025,24 @@ - else - { - enum insn_code icode = d->icode; -- if (d->name == 0 || icode == CODE_FOR_nothing) -- continue; -+ if (d->name == 0) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, bdesc_3arg[%ld] no name\n", -+ (long unsigned)i); - -+ continue; -+ } -+ -+ if (icode == CODE_FOR_nothing) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, skip ternary %s (no code)\n", -+ d->name); -+ -+ continue; -+ } -+ - type = builtin_function_type (insn_data[icode].operand[0].mode, - insn_data[icode].operand[1].mode, - insn_data[icode].operand[2].mode, -@@ -12780,9 +15080,24 @@ - else - { - enum insn_code icode = d->icode; -- if (d->name == 0 || icode == CODE_FOR_nothing) -- continue; -+ if (d->name == 0) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, bdesc_2arg[%ld] no name\n", -+ (long unsigned)i); - -+ continue; -+ } -+ -+ if (icode == CODE_FOR_nothing) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, skip binary %s (no code)\n", -+ d->name); -+ -+ continue; -+ } -+ - mode0 = insn_data[icode].operand[0].mode; - mode1 = insn_data[icode].operand[1].mode; - mode2 = insn_data[icode].operand[2].mode; -@@ -12842,9 +15157,24 @@ - else - { - enum insn_code icode = d->icode; -- if (d->name == 0 || icode == CODE_FOR_nothing) -- continue; -+ if (d->name == 0) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, bdesc_1arg[%ld] no name\n", -+ (long unsigned)i); - -+ continue; -+ } -+ -+ if (icode == CODE_FOR_nothing) -+ { -+ if (TARGET_DEBUG_BUILTIN) -+ fprintf (stderr, "rs6000_builtin, skip unary %s (no code)\n", -+ d->name); -+ -+ continue; -+ } -+ - mode0 = insn_data[icode].operand[0].mode; - mode1 = insn_data[icode].operand[1].mode; - -@@ -13631,7 +15961,7 @@ - static bool eliminated = false; - rtx ret; - -- if (mode != SDmode) -+ if (mode != SDmode || TARGET_NO_SDMODE_STACK) - ret = assign_stack_local (mode, GET_MODE_SIZE (mode), 0); - else - { -@@ -13660,6 +15990,17 @@ - return ret; - } - -+/* Return the mode to be used for memory when a secondary memory -+ location is needed. For SDmode values we need to use DDmode, in -+ all other cases we can use the same mode. */ -+enum machine_mode -+rs6000_secondary_memory_needed_mode (enum machine_mode mode) -+{ -+ if (mode == SDmode) -+ return DDmode; -+ return mode; -+} -+ - static tree - rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) - { -@@ -13690,31 +16031,228 @@ - return NULL_TREE; - } - --enum reload_reg_type { -- GPR_REGISTER_TYPE, -- VECTOR_REGISTER_TYPE, -- OTHER_REGISTER_TYPE --}; -+/* Classify a register type. Because the FMRGOW/FMRGEW instructions only work -+ on traditional floating point registers, and the VMRGOW/VMRGEW instructions -+ only work on the traditional altivec registers, note if an altivec register -+ was chosen. */ - --static enum reload_reg_type --rs6000_reload_register_type (enum reg_class rclass) -+static enum rs6000_reg_type -+register_to_reg_type (rtx reg, bool *is_altivec) - { -- switch (rclass) -+ HOST_WIDE_INT regno; -+ enum reg_class rclass; -+ -+ if (GET_CODE (reg) == SUBREG) -+ reg = SUBREG_REG (reg); -+ -+ if (!REG_P (reg)) -+ return NO_REG_TYPE; -+ -+ regno = REGNO (reg); -+ if (regno >= FIRST_PSEUDO_REGISTER) - { -- case GENERAL_REGS: -- case BASE_REGS: -- return GPR_REGISTER_TYPE; -+ if (!lra_in_progress && !reload_in_progress && !reload_completed) -+ return PSEUDO_REG_TYPE; - -- case FLOAT_REGS: -- case ALTIVEC_REGS: -- case VSX_REGS: -- return VECTOR_REGISTER_TYPE; -+ regno = true_regnum (reg); -+ if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER) -+ return PSEUDO_REG_TYPE; -+ } - -- default: -- return OTHER_REGISTER_TYPE; -+ gcc_assert (regno >= 0); -+ -+ if (is_altivec && ALTIVEC_REGNO_P (regno)) -+ *is_altivec = true; ++ function_args_iterator args_iter; ++ tree arg_type; + -+ rclass = rs6000_regno_regclass[regno]; -+ return reg_class_to_reg_type[(int)rclass]; -+} -+ -+/* Helper function for rs6000_secondary_reload to return true if a move to a -+ different register classe is really a simple move. */ -+ -+static bool -+rs6000_secondary_reload_simple_move (enum rs6000_reg_type to_type, -+ enum rs6000_reg_type from_type, -+ enum machine_mode mode) -+{ -+ int size; -+ -+ /* Add support for various direct moves available. In this function, we only -+ look at cases where we don't need any extra registers, and one or more -+ simple move insns are issued. At present, 32-bit integers are not allowed -+ in FPR/VSX registers. Single precision binary floating is not a simple -+ move because we need to convert to the single precision memory layout. -+ The 4-byte SDmode can be moved. */ -+ size = GET_MODE_SIZE (mode); -+ if (TARGET_DIRECT_MOVE -+ && ((mode == SDmode) || (TARGET_POWERPC64 && size == 8)) -+ && ((to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) -+ || (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE))) -+ return true; -+ -+ else if (TARGET_MFPGPR && TARGET_POWERPC64 && size == 8 -+ && ((to_type == GPR_REG_TYPE && from_type == FPR_REG_TYPE) -+ || (to_type == FPR_REG_TYPE && from_type == GPR_REG_TYPE))) -+ return true; -+ -+ else if ((size == 4 || (TARGET_POWERPC64 && size == 8)) -+ && ((to_type == GPR_REG_TYPE && from_type == SPR_REG_TYPE) -+ || (to_type == SPR_REG_TYPE && from_type == GPR_REG_TYPE))) -+ return true; -+ -+ return false; -+} -+ -+/* Power8 helper function for rs6000_secondary_reload, handle all of the -+ special direct moves that involve allocating an extra register, return the -+ insn code of the helper function if there is such a function or -+ CODE_FOR_nothing if not. */ -+ -+static bool -+rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, -+ enum rs6000_reg_type from_type, -+ enum machine_mode mode, -+ secondary_reload_info *sri, -+ bool altivec_p) -+{ -+ bool ret = false; -+ enum insn_code icode = CODE_FOR_nothing; -+ int cost = 0; -+ int size = GET_MODE_SIZE (mode); -+ -+ if (TARGET_POWERPC64) -+ { -+ if (size == 16) -+ { -+ /* Handle moving 128-bit values from GPRs to VSX point registers on -+ power8 when running in 64-bit mode using XXPERMDI to glue the two -+ 64-bit values back together. */ -+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) -+ { -+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */ -+ icode = reg_addr[mode].reload_vsx_gpr; -+ } -+ -+ /* Handle moving 128-bit values from VSX point registers to GPRs on -+ power8 when running in 64-bit mode using XXPERMDI to get access to the -+ bottom 64-bit value. */ -+ else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) -+ { -+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */ -+ icode = reg_addr[mode].reload_gpr_vsx; -+ } -+ } -+ -+ else if (mode == SFmode) -+ { -+ if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) -+ { -+ cost = 3; /* xscvdpspn, mfvsrd, and. */ -+ icode = reg_addr[mode].reload_gpr_vsx; -+ } -+ -+ else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) -+ { -+ cost = 2; /* mtvsrz, xscvspdpn. */ -+ icode = reg_addr[mode].reload_vsx_gpr; -+ } -+ } - } -+ -+ if (TARGET_POWERPC64 && size == 16) -+ { -+ /* Handle moving 128-bit values from GPRs to VSX point registers on -+ power8 when running in 64-bit mode using XXPERMDI to glue the two -+ 64-bit values back together. */ -+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) -+ { -+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */ -+ icode = reg_addr[mode].reload_vsx_gpr; -+ } -+ -+ /* Handle moving 128-bit values from VSX point registers to GPRs on -+ power8 when running in 64-bit mode using XXPERMDI to get access to the -+ bottom 64-bit value. */ -+ else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) -+ { -+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */ -+ icode = reg_addr[mode].reload_gpr_vsx; -+ } -+ } -+ -+ else if (!TARGET_POWERPC64 && size == 8) -+ { -+ /* Handle moving 64-bit values from GPRs to floating point registers on -+ power8 when running in 32-bit mode using FMRGOW to glue the two 32-bit -+ values back together. Altivec register classes must be handled -+ specially since a different instruction is used, and the secondary -+ reload support requires a single instruction class in the scratch -+ register constraint. However, right now TFmode is not allowed in -+ Altivec registers, so the pattern will never match. */ -+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE && !altivec_p) -+ { -+ cost = 3; /* 2 mtvsrwz's, 1 fmrgow. */ -+ icode = reg_addr[mode].reload_fpr_gpr; -+ } -+ } -+ -+ if (icode != CODE_FOR_nothing) -+ { -+ ret = true; -+ if (sri) -+ { -+ sri->icode = icode; -+ sri->extra_cost = cost; -+ } -+ } -+ -+ return ret; - } - -+/* Return whether a move between two register classes can be done either -+ directly (simple move) or via a pattern that uses a single extra temporary -+ (using power8's direct move in this case. */ -+ -+static bool -+rs6000_secondary_reload_move (enum rs6000_reg_type to_type, -+ enum rs6000_reg_type from_type, -+ enum machine_mode mode, -+ secondary_reload_info *sri, -+ bool altivec_p) -+{ -+ /* Fall back to load/store reloads if either type is not a register. */ -+ if (to_type == NO_REG_TYPE || from_type == NO_REG_TYPE) -+ return false; -+ -+ /* If we haven't allocated registers yet, assume the move can be done for the -+ standard register types. */ -+ if ((to_type == PSEUDO_REG_TYPE && from_type == PSEUDO_REG_TYPE) -+ || (to_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (from_type)) -+ || (from_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (to_type))) -+ return true; -+ -+ /* Moves to the same set of registers is a simple move for non-specialized -+ registers. */ -+ if (to_type == from_type && IS_STD_REG_TYPE (to_type)) -+ return true; -+ -+ /* Check whether a simple move can be done directly. */ -+ if (rs6000_secondary_reload_simple_move (to_type, from_type, mode)) -+ { -+ if (sri) -+ { -+ sri->icode = CODE_FOR_nothing; -+ sri->extra_cost = 0; -+ } -+ return true; -+ } -+ -+ /* Now check if we can do it in a few steps. */ -+ return rs6000_secondary_reload_direct_move (to_type, from_type, mode, sri, -+ altivec_p); -+} -+ - /* Inform reload about cases where moving X with a mode MODE to a register in - RCLASS requires an extra scratch or immediate register. Return the class - needed for the immediate register. -@@ -13738,12 +16276,36 @@ - bool default_p = false; - - sri->icode = CODE_FOR_nothing; -+ icode = ((in_p) -+ ? reg_addr[mode].reload_load -+ : reg_addr[mode].reload_store); - -- /* Convert vector loads and stores into gprs to use an additional base -- register. */ -- icode = rs6000_vector_reload[mode][in_p != false]; -- if (icode != CODE_FOR_nothing) -+ if (REG_P (x) || register_operand (x, mode)) - { -+ enum rs6000_reg_type to_type = reg_class_to_reg_type[(int)rclass]; -+ bool altivec_p = (rclass == ALTIVEC_REGS); -+ enum rs6000_reg_type from_type = register_to_reg_type (x, &altivec_p); -+ -+ if (!in_p) -+ { -+ enum rs6000_reg_type exchange = to_type; -+ to_type = from_type; -+ from_type = exchange; -+ } -+ -+ /* Can we do a direct move of some sort? */ -+ if (rs6000_secondary_reload_move (to_type, from_type, mode, sri, -+ altivec_p)) -+ { -+ icode = (enum insn_code)sri->icode; -+ default_p = false; -+ ret = NO_REGS; -+ } ++ FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter) ++ if (rs6000_parm_needs_stack (args_so_far, arg_type)) ++ return true; + } + -+ /* Handle vector moves with reload helper functions. */ -+ if (ret == ALL_REGS && icode != CODE_FOR_nothing) -+ { - ret = NO_REGS; - sri->icode = CODE_FOR_nothing; - sri->extra_cost = 0; -@@ -13754,14 +16316,23 @@ - - /* Loads to and stores from gprs can do reg+offset, and wouldn't need - an extra register in that case, but it would need an extra -- register if the addressing is reg+reg or (reg+reg)&(-16). */ -+ register if the addressing is reg+reg or (reg+reg)&(-16). Special -+ case load/store quad. */ - if (rclass == GENERAL_REGS || rclass == BASE_REGS) - { -- if (!legitimate_indirect_address_p (addr, false) -- && !rs6000_legitimate_offset_address_p (TImode, addr, -- false, true)) -+ if (TARGET_POWERPC64 && TARGET_QUAD_MEMORY -+ && GET_MODE_SIZE (mode) == 16 -+ && quad_memory_operand (x, mode)) - { - sri->icode = icode; -+ sri->extra_cost = 2; -+ } -+ -+ else if (!legitimate_indirect_address_p (addr, false) -+ && !rs6000_legitimate_offset_address_p (PTImode, addr, -+ false, true)) -+ { -+ sri->icode = icode; - /* account for splitting the loads, and converting the - address from reg+reg to reg. */ - sri->extra_cost = (((TARGET_64BIT) ? 3 : 5) -@@ -13768,8 +16339,20 @@ - + ((GET_CODE (addr) == AND) ? 1 : 0)); - } - } -- /* Loads to and stores from vector registers can only do reg+reg -- addressing. Altivec registers can also do (reg+reg)&(-16). */ -+ /* Allow scalar loads to/from the traditional floating point -+ registers, even if VSX memory is set. */ -+ else if ((rclass == FLOAT_REGS || rclass == NO_REGS) -+ && (GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8) -+ && (legitimate_indirect_address_p (addr, false) -+ || legitimate_indirect_address_p (addr, false) -+ || rs6000_legitimate_offset_address_p (mode, addr, -+ false, true))) -+ -+ ; -+ /* Loads to and stores from vector registers can only do reg+reg -+ addressing. Altivec registers can also do (reg+reg)&(-16). Allow -+ scalar modes loading up the traditional floating point registers -+ to use offset addresses. */ - else if (rclass == VSX_REGS || rclass == ALTIVEC_REGS - || rclass == FLOAT_REGS || rclass == NO_REGS) - { -@@ -13813,12 +16396,12 @@ - else - { - enum reg_class xclass = REGNO_REG_CLASS (regno); -- enum reload_reg_type rtype1 = rs6000_reload_register_type (rclass); -- enum reload_reg_type rtype2 = rs6000_reload_register_type (xclass); -+ enum rs6000_reg_type rtype1 = reg_class_to_reg_type[(int)rclass]; -+ enum rs6000_reg_type rtype2 = reg_class_to_reg_type[(int)xclass]; - - /* If memory is needed, use default_secondary_reload to create the - stack slot. */ -- if (rtype1 != rtype2 || rtype1 == OTHER_REGISTER_TYPE) -+ if (rtype1 != rtype2 || !IS_STD_REG_TYPE (rtype1)) - default_p = true; - else - ret = NO_REGS; -@@ -13828,7 +16411,7 @@ - default_p = true; - } - else if (TARGET_POWERPC64 -- && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE -+ && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE - && MEM_P (x) - && GET_MODE_SIZE (GET_MODE (x)) >= UNITS_PER_WORD) - { -@@ -13867,7 +16450,7 @@ - default_p = true; - } - else if (!TARGET_POWERPC64 -- && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE -+ && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE - && MEM_P (x) - && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD) - { -@@ -13945,6 +16528,36 @@ - return ret; - } - -+/* Better tracing for rs6000_secondary_reload_inner. */ -+ -+static void -+rs6000_secondary_reload_trace (int line, rtx reg, rtx mem, rtx scratch, -+ bool store_p) -+{ -+ rtx set, clobber; -+ -+ gcc_assert (reg != NULL_RTX && mem != NULL_RTX && scratch != NULL_RTX); -+ -+ fprintf (stderr, "rs6000_secondary_reload_inner:%d, type = %s\n", line, -+ store_p ? "store" : "load"); -+ -+ if (store_p) -+ set = gen_rtx_SET (VOIDmode, mem, reg); -+ else -+ set = gen_rtx_SET (VOIDmode, reg, mem); -+ -+ clobber = gen_rtx_CLOBBER (VOIDmode, scratch); -+ debug_rtx (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber))); -+} -+ -+static void -+rs6000_secondary_reload_fail (int line, rtx reg, rtx mem, rtx scratch, -+ bool store_p) -+{ -+ rs6000_secondary_reload_trace (line, reg, mem, scratch, store_p); -+ gcc_unreachable (); -+} -+ - /* Fixup reload addresses for Altivec or VSX loads/stores to change SP+offset - to SP+reg addressing. */ - -@@ -13963,21 +16576,16 @@ - rtx cc_clobber; - - if (TARGET_DEBUG_ADDR) -- { -- fprintf (stderr, "\nrs6000_secondary_reload_inner, type = %s\n", -- store_p ? "store" : "load"); -- fprintf (stderr, "reg:\n"); -- debug_rtx (reg); -- fprintf (stderr, "mem:\n"); -- debug_rtx (mem); -- fprintf (stderr, "scratch:\n"); -- debug_rtx (scratch); -- } -+ rs6000_secondary_reload_trace (__LINE__, reg, mem, scratch, store_p); - -- gcc_assert (regno >= 0 && regno < FIRST_PSEUDO_REGISTER); -- gcc_assert (GET_CODE (mem) == MEM); -+ if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); -+ -+ if (GET_CODE (mem) != MEM) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); -+ - rclass = REGNO_REG_CLASS (regno); -- addr = XEXP (mem, 0); -+ addr = find_replacement (&XEXP (mem, 0)); - - switch (rclass) - { -@@ -13988,25 +16596,31 @@ - if (GET_CODE (addr) == AND) - { - and_op2 = XEXP (addr, 1); -- addr = XEXP (addr, 0); -+ addr = find_replacement (&XEXP (addr, 0)); - } - - if (GET_CODE (addr) == PRE_MODIFY) - { -- scratch_or_premodify = XEXP (addr, 0); -- gcc_assert (REG_P (scratch_or_premodify)); -- gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS); -- addr = XEXP (addr, 1); -+ scratch_or_premodify = find_replacement (&XEXP (addr, 0)); -+ if (!REG_P (scratch_or_premodify)) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); -+ -+ addr = find_replacement (&XEXP (addr, 1)); -+ if (GET_CODE (addr) != PLUS) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - } - - if (GET_CODE (addr) == PLUS - && (and_op2 != NULL_RTX -- || !rs6000_legitimate_offset_address_p (TImode, addr, -+ || !rs6000_legitimate_offset_address_p (PTImode, addr, - false, true))) - { -+ /* find_replacement already recurses into both operands of -+ PLUS so we don't need to call it here. */ - addr_op1 = XEXP (addr, 0); - addr_op2 = XEXP (addr, 1); -- gcc_assert (legitimate_indirect_address_p (addr_op1, false)); -+ if (!legitimate_indirect_address_p (addr_op1, false)) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - - if (!REG_P (addr_op2) - && (GET_CODE (addr_op2) != CONST_INT -@@ -14034,7 +16648,7 @@ - scratch_or_premodify = scratch; - } - else if (!legitimate_indirect_address_p (addr, false) -- && !rs6000_legitimate_offset_address_p (TImode, addr, -+ && !rs6000_legitimate_offset_address_p (PTImode, addr, - false, true)) - { - if (TARGET_DEBUG_ADDR) -@@ -14050,9 +16664,21 @@ - } - break; - -- /* Float/Altivec registers can only handle reg+reg addressing. Move -- other addresses into a scratch register. */ -+ /* Float registers can do offset+reg addressing for scalar types. */ - case FLOAT_REGS: -+ if (legitimate_indirect_address_p (addr, false) /* reg */ -+ || legitimate_indexed_address_p (addr, false) /* reg+reg */ -+ || ((GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8) -+ && and_op2 == NULL_RTX -+ && scratch_or_premodify == scratch -+ && rs6000_legitimate_offset_address_p (mode, addr, false, false))) -+ break; -+ -+ /* If this isn't a legacy floating point load/store, fall through to the -+ VSX defaults. */ -+ -+ /* VSX/Altivec registers can only handle reg+reg addressing. Move other -+ addresses into a scratch register. */ - case VSX_REGS: - case ALTIVEC_REGS: - -@@ -14066,35 +16692,35 @@ - || !VECTOR_MEM_ALTIVEC_P (mode))) - { - and_op2 = XEXP (addr, 1); -- addr = XEXP (addr, 0); -+ addr = find_replacement (&XEXP (addr, 0)); - } - - /* If we aren't using a VSX load, save the PRE_MODIFY register and use it - as the address later. */ - if (GET_CODE (addr) == PRE_MODIFY -- && (!VECTOR_MEM_VSX_P (mode) -+ && ((ALTIVEC_OR_VSX_VECTOR_MODE (mode) -+ && (rclass != FLOAT_REGS -+ || (GET_MODE_SIZE (mode) != 4 && GET_MODE_SIZE (mode) != 8))) - || and_op2 != NULL_RTX - || !legitimate_indexed_address_p (XEXP (addr, 1), false))) - { -- scratch_or_premodify = XEXP (addr, 0); -- gcc_assert (legitimate_indirect_address_p (scratch_or_premodify, -- false)); -- gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS); -- addr = XEXP (addr, 1); -+ scratch_or_premodify = find_replacement (&XEXP (addr, 0)); -+ if (!legitimate_indirect_address_p (scratch_or_premodify, false)) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); -+ -+ addr = find_replacement (&XEXP (addr, 1)); -+ if (GET_CODE (addr) != PLUS) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - } - - if (legitimate_indirect_address_p (addr, false) /* reg */ - || legitimate_indexed_address_p (addr, false) /* reg+reg */ -- || GET_CODE (addr) == PRE_MODIFY /* VSX pre-modify */ - || (GET_CODE (addr) == AND /* Altivec memory */ -+ && rclass == ALTIVEC_REGS - && GET_CODE (XEXP (addr, 1)) == CONST_INT - && INTVAL (XEXP (addr, 1)) == -16 -- && VECTOR_MEM_ALTIVEC_P (mode)) -- || (rclass == FLOAT_REGS /* legacy float mem */ -- && GET_MODE_SIZE (mode) == 8 -- && and_op2 == NULL_RTX -- && scratch_or_premodify == scratch -- && rs6000_legitimate_offset_address_p (mode, addr, false, false))) -+ && (legitimate_indirect_address_p (XEXP (addr, 0), false) -+ || legitimate_indexed_address_p (XEXP (addr, 0), false)))) - ; - - else if (GET_CODE (addr) == PLUS) -@@ -14101,7 +16727,8 @@ - { - addr_op1 = XEXP (addr, 0); - addr_op2 = XEXP (addr, 1); -- gcc_assert (REG_P (addr_op1)); -+ if (!REG_P (addr_op1)) -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - - if (TARGET_DEBUG_ADDR) - { -@@ -14120,7 +16747,8 @@ - } - - else if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == CONST -- || GET_CODE (addr) == CONST_INT || REG_P (addr)) -+ || GET_CODE (addr) == CONST_INT || GET_CODE (addr) == LO_SUM -+ || REG_P (addr)) - { - if (TARGET_DEBUG_ADDR) - { -@@ -14136,12 +16764,12 @@ - } - - else -- gcc_unreachable (); -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - - break; - - default: -- gcc_unreachable (); -+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p); - } - - /* If the original address involved a pre-modify that we couldn't use the VSX -@@ -14188,7 +16816,7 @@ - /* Adjust the address if it changed. */ - if (addr != XEXP (mem, 0)) - { -- mem = change_address (mem, mode, addr); -+ mem = replace_equiv_address_nv (mem, addr); - if (TARGET_DEBUG_ADDR) - fprintf (stderr, "\nrs6000_secondary_reload_inner, mem adjusted.\n"); - } -@@ -14253,8 +16881,10 @@ - return; - } - --/* Allocate a 64-bit stack slot to be used for copying SDmode -- values through if this function has any SDmode references. */ -+/* Allocate a 64-bit stack slot to be used for copying SDmode values through if -+ this function has any SDmode references. If we are on a power7 or later, we -+ don't need the 64-bit stack slot since the LFIWZX and STIFWX instructions -+ can load/store the value. */ - - static void - rs6000_alloc_sdmode_stack_slot (void) -@@ -14264,7 +16894,14 @@ - gimple_stmt_iterator gsi; - - gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX); -+ /* We use a different approach for dealing with the secondary -+ memory in LRA. */ -+ if (ira_use_lra_p) -+ return; - -+ if (TARGET_NO_SDMODE_STACK) -+ return; -+ - FOR_EACH_BB (bb) - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { -@@ -14325,8 +16962,7 @@ - { - enum machine_mode mode = GET_MODE (x); - -- if (VECTOR_UNIT_VSX_P (mode) -- && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass)) -+ if (TARGET_VSX && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass)) - return rclass; - - if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode) -@@ -14334,8 +16970,14 @@ - && easy_vector_constant (x, mode)) - return ALTIVEC_REGS; - -- if (CONSTANT_P (x) && reg_classes_intersect_p (rclass, FLOAT_REGS)) -- return NO_REGS; -+ if ((CONSTANT_P (x) || GET_CODE (x) == PLUS)) -+ { -+ if (reg_class_subset_p (GENERAL_REGS, rclass)) -+ return GENERAL_REGS; -+ if (reg_class_subset_p (BASE_REGS, rclass)) -+ return BASE_REGS; -+ return NO_REGS; -+ } - - if (GET_MODE_CLASS (mode) == MODE_INT && rclass == NON_SPECIAL_REGS) - return GENERAL_REGS; -@@ -14349,7 +16991,8 @@ - if (GET_MODE_SIZE (mode) <= 8) - return FLOAT_REGS; - -- if (VECTOR_UNIT_ALTIVEC_P (mode) || VECTOR_MEM_ALTIVEC_P (mode)) -+ if (VECTOR_UNIT_ALTIVEC_P (mode) || VECTOR_MEM_ALTIVEC_P (mode) -+ || mode == V1TImode) - return ALTIVEC_REGS; - - return rclass; -@@ -14381,60 +17024,45 @@ - set and vice versa. */ - - static bool --rs6000_secondary_memory_needed (enum reg_class class1, -- enum reg_class class2, -+rs6000_secondary_memory_needed (enum reg_class from_class, -+ enum reg_class to_class, - enum machine_mode mode) - { -- if (class1 == class2) -- return false; -+ enum rs6000_reg_type from_type, to_type; -+ bool altivec_p = ((from_class == ALTIVEC_REGS) -+ || (to_class == ALTIVEC_REGS)); - -- /* Under VSX, there are 3 register classes that values could be in (VSX_REGS, -- ALTIVEC_REGS, and FLOAT_REGS). We don't need to use memory to copy -- between these classes. But we need memory for other things that can go in -- FLOAT_REGS like SFmode. */ -- if (TARGET_VSX -- && (VECTOR_MEM_VSX_P (mode) || VECTOR_UNIT_VSX_P (mode)) -- && (class1 == VSX_REGS || class1 == ALTIVEC_REGS -- || class1 == FLOAT_REGS)) -- return (class2 != VSX_REGS && class2 != ALTIVEC_REGS -- && class2 != FLOAT_REGS); -+ /* If a simple/direct move is available, we don't need secondary memory */ -+ from_type = reg_class_to_reg_type[(int)from_class]; -+ to_type = reg_class_to_reg_type[(int)to_class]; - -- if (class1 == VSX_REGS || class2 == VSX_REGS) -- return true; -+ if (rs6000_secondary_reload_move (to_type, from_type, mode, -+ (secondary_reload_info *)0, altivec_p)) -+ return false; - -- if (class1 == FLOAT_REGS -- && (!TARGET_MFPGPR || !TARGET_POWERPC64 -- || ((mode != DFmode) -- && (mode != DDmode) -- && (mode != DImode)))) -+ /* If we have a floating point or vector register class, we need to use -+ memory to transfer the data. */ -+ if (IS_FP_VECT_REG_TYPE (from_type) || IS_FP_VECT_REG_TYPE (to_type)) - return true; - -- if (class2 == FLOAT_REGS -- && (!TARGET_MFPGPR || !TARGET_POWERPC64 -- || ((mode != DFmode) -- && (mode != DDmode) -- && (mode != DImode)))) -- return true; -- -- if (class1 == ALTIVEC_REGS || class2 == ALTIVEC_REGS) -- return true; -- return false; } - /* Debug version of rs6000_secondary_memory_needed. */ - static bool --rs6000_debug_secondary_memory_needed (enum reg_class class1, -- enum reg_class class2, -+rs6000_debug_secondary_memory_needed (enum reg_class from_class, -+ enum reg_class to_class, - enum machine_mode mode) - { -- bool ret = rs6000_secondary_memory_needed (class1, class2, mode); -+ bool ret = rs6000_secondary_memory_needed (from_class, to_class, mode); - - fprintf (stderr, -- "rs6000_secondary_memory_needed, return: %s, class1 = %s, " -- "class2 = %s, mode = %s\n", -- ret ? "true" : "false", reg_class_names[class1], -- reg_class_names[class2], GET_MODE_NAME (mode)); -+ "rs6000_secondary_memory_needed, return: %s, from_class = %s, " -+ "to_class = %s, mode = %s\n", -+ ret ? "true" : "false", -+ reg_class_names[from_class], -+ reg_class_names[to_class], -+ GET_MODE_NAME (mode)); - - return ret; - } -@@ -14498,15 +17126,21 @@ - /* Constants, memory, and FP registers can go into FP registers. */ - if ((regno == -1 || FP_REGNO_P (regno)) - && (rclass == FLOAT_REGS || rclass == NON_SPECIAL_REGS)) -- return (mode != SDmode) ? NO_REGS : GENERAL_REGS; -+ return (mode != SDmode || lra_in_progress) ? NO_REGS : GENERAL_REGS; - - /* Memory, and FP/altivec registers can go into fp/altivec registers under -- VSX. */ -+ VSX. However, for scalar variables, use the traditional floating point -+ registers so that we can use offset+register addressing. */ - if (TARGET_VSX - && (regno == -1 || VSX_REGNO_P (regno)) - && VSX_REG_CLASS_P (rclass)) -- return NO_REGS; -+ { -+ if (GET_MODE_SIZE (mode) < 16) -+ return FLOAT_REGS; - -+ return NO_REGS; -+ } -+ - /* Memory, and AltiVec registers can go into AltiVec registers. */ - if ((regno == -1 || ALTIVEC_REGNO_P (regno)) - && rclass == ALTIVEC_REGS) -@@ -14550,8 +17184,42 @@ - if (from_size != to_size) - { - enum reg_class xclass = (TARGET_VSX) ? VSX_REGS : FLOAT_REGS; -- return ((from_size < 8 || to_size < 8 || TARGET_IEEEQUAD) -- && reg_classes_intersect_p (xclass, rclass)); -+ -+ if (reg_classes_intersect_p (xclass, rclass)) -+ { -+ unsigned to_nregs = hard_regno_nregs[FIRST_FPR_REGNO][to]; -+ unsigned from_nregs = hard_regno_nregs[FIRST_FPR_REGNO][from]; -+ -+ /* Don't allow 64-bit types to overlap with 128-bit types that take a -+ single register under VSX because the scalar part of the register -+ is in the upper 64-bits, and not the lower 64-bits. Types like -+ TFmode/TDmode that take 2 scalar register can overlap. 128-bit -+ IEEE floating point can't overlap, and neither can small -+ values. */ -+ -+ if (TARGET_IEEEQUAD && (to == TFmode || from == TFmode)) -+ return true; -+ -+ /* TDmode in floating-mode registers must always go into a register -+ pair with the most significant word in the even-numbered register -+ to match ISA requirements. In little-endian mode, this does not -+ match subreg numbering, so we cannot allow subregs. */ -+ if (!BYTES_BIG_ENDIAN && (to == TDmode || from == TDmode)) -+ return true; -+ -+ if (from_size < 8 || to_size < 8) -+ return true; -+ -+ if (from_size == 8 && (8 * to_nregs) != to_size) -+ return true; -+ -+ if (to_size == 8 && (8 * from_nregs) != from_size) -+ return true; -+ -+ return false; -+ } -+ else -+ return false; - } - - if (TARGET_E500_DOUBLE -@@ -14565,10 +17233,19 @@ - /* Since the VSX register set includes traditional floating point registers - and altivec registers, just check for the size being different instead of - trying to check whether the modes are vector modes. Otherwise it won't -- allow say DF and DI to change classes. */ -+ allow say DF and DI to change classes. For types like TFmode and TDmode -+ that take 2 64-bit registers, rather than a single 128-bit register, don't -+ allow subregs of those types to other 128 bit types. */ - if (TARGET_VSX && VSX_REG_CLASS_P (rclass)) -- return (from_size != 8 && from_size != 16); -+ { -+ unsigned num_regs = (from_size + 15) / 16; -+ if (hard_regno_nregs[FIRST_FPR_REGNO][to] > num_regs -+ || hard_regno_nregs[FIRST_FPR_REGNO][from] > num_regs) -+ return true; - -+ return (from_size != 8 && from_size != 16); -+ } -+ - if (TARGET_ALTIVEC && rclass == ALTIVEC_REGS - && (ALTIVEC_VECTOR_MODE (from) + ALTIVEC_VECTOR_MODE (to)) == 1) - return true; -@@ -14598,6 +17275,186 @@ - return ret; - } - -+/* Return a string to do a move operation of 128 bits of data. */ -+ -+const char * -+rs6000_output_move_128bit (rtx operands[]) -+{ -+ rtx dest = operands[0]; -+ rtx src = operands[1]; -+ enum machine_mode mode = GET_MODE (dest); -+ int dest_regno; -+ int src_regno; -+ bool dest_gpr_p, dest_fp_p, dest_vmx_p, dest_vsx_p; -+ bool src_gpr_p, src_fp_p, src_vmx_p, src_vsx_p; -+ -+ if (REG_P (dest)) -+ { -+ dest_regno = REGNO (dest); -+ dest_gpr_p = INT_REGNO_P (dest_regno); -+ dest_fp_p = FP_REGNO_P (dest_regno); -+ dest_vmx_p = ALTIVEC_REGNO_P (dest_regno); -+ dest_vsx_p = dest_fp_p | dest_vmx_p; -+ } -+ else -+ { -+ dest_regno = -1; -+ dest_gpr_p = dest_fp_p = dest_vmx_p = dest_vsx_p = false; -+ } -+ -+ if (REG_P (src)) -+ { -+ src_regno = REGNO (src); -+ src_gpr_p = INT_REGNO_P (src_regno); -+ src_fp_p = FP_REGNO_P (src_regno); -+ src_vmx_p = ALTIVEC_REGNO_P (src_regno); -+ src_vsx_p = src_fp_p | src_vmx_p; -+ } -+ else -+ { -+ src_regno = -1; -+ src_gpr_p = src_fp_p = src_vmx_p = src_vsx_p = false; -+ } -+ -+ /* Register moves. */ -+ if (dest_regno >= 0 && src_regno >= 0) -+ { -+ if (dest_gpr_p) -+ { -+ if (src_gpr_p) -+ return "#"; -+ -+ else if (TARGET_VSX && TARGET_DIRECT_MOVE && src_vsx_p) -+ return "#"; -+ } -+ -+ else if (TARGET_VSX && dest_vsx_p) -+ { -+ if (src_vsx_p) -+ return "xxlor %x0,%x1,%x1"; -+ -+ else if (TARGET_DIRECT_MOVE && src_gpr_p) -+ return "#"; -+ } -+ -+ else if (TARGET_ALTIVEC && dest_vmx_p && src_vmx_p) -+ return "vor %0,%1,%1"; -+ -+ else if (dest_fp_p && src_fp_p) -+ return "#"; -+ } -+ -+ /* Loads. */ -+ else if (dest_regno >= 0 && MEM_P (src)) -+ { -+ if (dest_gpr_p) -+ { -+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src)) -+ return "lq %0,%1"; -+ else -+ return "#"; -+ } -+ -+ else if (TARGET_ALTIVEC && dest_vmx_p -+ && altivec_indexed_or_indirect_operand (src, mode)) -+ return "lvx %0,%y1"; -+ -+ else if (TARGET_VSX && dest_vsx_p) -+ { -+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode) -+ return "lxvw4x %x0,%y1"; -+ else -+ return "lxvd2x %x0,%y1"; -+ } -+ -+ else if (TARGET_ALTIVEC && dest_vmx_p) -+ return "lvx %0,%y1"; -+ -+ else if (dest_fp_p) -+ return "#"; -+ } -+ -+ /* Stores. */ -+ else if (src_regno >= 0 && MEM_P (dest)) -+ { -+ if (src_gpr_p) -+ { -+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src)) -+ return "stq %1,%0"; -+ else -+ return "#"; -+ } -+ -+ else if (TARGET_ALTIVEC && src_vmx_p -+ && altivec_indexed_or_indirect_operand (src, mode)) -+ return "stvx %1,%y0"; -+ -+ else if (TARGET_VSX && src_vsx_p) -+ { -+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode) -+ return "stxvw4x %x1,%y0"; -+ else -+ return "stxvd2x %x1,%y0"; -+ } -+ -+ else if (TARGET_ALTIVEC && src_vmx_p) -+ return "stvx %1,%y0"; -+ -+ else if (src_fp_p) -+ return "#"; -+ } -+ -+ /* Constants. */ -+ else if (dest_regno >= 0 -+ && (GET_CODE (src) == CONST_INT -+ || GET_CODE (src) == CONST_DOUBLE -+ || GET_CODE (src) == CONST_VECTOR)) -+ { -+ if (dest_gpr_p) -+ return "#"; -+ -+ else if (TARGET_VSX && dest_vsx_p && zero_constant (src, mode)) -+ return "xxlxor %x0,%x0,%x0"; -+ -+ else if (TARGET_ALTIVEC && dest_vmx_p) -+ return output_vec_const_move (operands); -+ } -+ -+ if (TARGET_DEBUG_ADDR) -+ { -+ fprintf (stderr, "\n===== Bad 128 bit move:\n"); -+ debug_rtx (gen_rtx_SET (VOIDmode, dest, src)); -+ } -+ -+ gcc_unreachable (); -+} -+ -+/* Validate a 128-bit move. */ -+bool -+rs6000_move_128bit_ok_p (rtx operands[]) -+{ -+ enum machine_mode mode = GET_MODE (operands[0]); -+ return (gpc_reg_operand (operands[0], mode) -+ || gpc_reg_operand (operands[1], mode)); -+} -+ -+/* Return true if a 128-bit move needs to be split. */ -+bool -+rs6000_split_128bit_ok_p (rtx operands[]) -+{ -+ if (!reload_completed) -+ return false; -+ -+ if (!gpr_or_gpr_p (operands[0], operands[1])) -+ return false; -+ -+ if (quad_load_store_p (operands[0], operands[1])) -+ return false; -+ -+ return true; -+} -+ -+ - /* Given a comparison operation, return the bit number in CCR to test. We - know this is a valid comparison. - -@@ -14823,6 +17680,7 @@ - ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "L."); - break; - -+ case ABI_ELFv2: - case ABI_V4: - case ABI_DARWIN: - break; -@@ -15302,7 +18160,7 @@ - return; - - case 'Y': -- /* Like 'L', for third word of TImode */ -+ /* Like 'L', for third word of TImode/PTImode */ - if (REG_P (x)) - fputs (reg_names[REGNO (x) + 2], file); - else if (MEM_P (x)) -@@ -15352,7 +18210,7 @@ - return; - - case 'Z': -- /* Like 'L', for last word of TImode. */ -+ /* Like 'L', for last word of TImode/PTImode. */ - if (REG_P (x)) - fputs (reg_names[REGNO (x) + 3], file); - else if (MEM_P (x)) -@@ -15383,7 +18241,8 @@ - if ((TARGET_SPE || TARGET_E500_DOUBLE) - && (GET_MODE_SIZE (GET_MODE (x)) == 8 - || GET_MODE (x) == TFmode -- || GET_MODE (x) == TImode)) -+ || GET_MODE (x) == TImode -+ || GET_MODE (x) == PTImode)) - { - /* Handle [reg]. */ - if (REG_P (tmp)) -@@ -16766,7 +19625,8 @@ - } - - /* A subroutine of the atomic operation splitters. Emit a load-locked -- instruction in MODE. */ -+ instruction in MODE. For QI/HImode, possibly use a pattern than includes -+ the zero_extend operation. */ - - static void - emit_load_locked (enum machine_mode mode, rtx reg, rtx mem) -@@ -16775,12 +19635,26 @@ - - switch (mode) - { -+ case QImode: -+ fn = gen_load_lockedqi; -+ break; -+ case HImode: -+ fn = gen_load_lockedhi; -+ break; - case SImode: -- fn = gen_load_lockedsi; -+ if (GET_MODE (mem) == QImode) -+ fn = gen_load_lockedqi_si; -+ else if (GET_MODE (mem) == HImode) -+ fn = gen_load_lockedhi_si; -+ else -+ fn = gen_load_lockedsi; - break; - case DImode: - fn = gen_load_lockeddi; - break; -+ case TImode: -+ fn = gen_load_lockedti; -+ break; - default: - gcc_unreachable (); - } -@@ -16797,6 +19671,12 @@ - - switch (mode) - { -+ case QImode: -+ fn = gen_store_conditionalqi; -+ break; -+ case HImode: -+ fn = gen_store_conditionalhi; -+ break; - case SImode: - fn = gen_store_conditionalsi; - break; -@@ -16803,6 +19683,9 @@ - case DImode: - fn = gen_store_conditionaldi; - break; -+ case TImode: -+ fn = gen_store_conditionalti; -+ break; - default: - gcc_unreachable (); - } -@@ -16949,7 +19832,7 @@ - { - rtx boolval, retval, mem, oldval, newval, cond; - rtx label1, label2, x, mask, shift; -- enum machine_mode mode; -+ enum machine_mode mode, orig_mode; - enum memmodel mod_s, mod_f; - bool is_weak; - -@@ -16961,23 +19844,30 @@ - is_weak = (INTVAL (operands[5]) != 0); - mod_s = (enum memmodel) INTVAL (operands[6]); - mod_f = (enum memmodel) INTVAL (operands[7]); -- mode = GET_MODE (mem); -+ orig_mode = mode = GET_MODE (mem); - - mask = shift = NULL_RTX; - if (mode == QImode || mode == HImode) - { -- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask); -- -- /* Shift and mask OLDVAL into position with the word. */ -+ /* Before power8, we didn't have access to lbarx/lharx, so generate a -+ lwarx and shift/mask operations. With power8, we need to do the -+ comparison in SImode, but the store is still done in QI/HImode. */ - oldval = convert_modes (SImode, mode, oldval, 1); -- oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift, -- NULL_RTX, 1, OPTAB_LIB_WIDEN); - -- /* Shift and mask NEWVAL into position within the word. */ -- newval = convert_modes (SImode, mode, newval, 1); -- newval = expand_simple_binop (SImode, ASHIFT, newval, shift, -- NULL_RTX, 1, OPTAB_LIB_WIDEN); -+ if (!TARGET_SYNC_HI_QI) -+ { -+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask); - -+ /* Shift and mask OLDVAL into position with the word. */ -+ oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift, -+ NULL_RTX, 1, OPTAB_LIB_WIDEN); -+ -+ /* Shift and mask NEWVAL into position within the word. */ -+ newval = convert_modes (SImode, mode, newval, 1); -+ newval = expand_simple_binop (SImode, ASHIFT, newval, shift, -+ NULL_RTX, 1, OPTAB_LIB_WIDEN); -+ } -+ - /* Prepare to adjust the return value. */ - retval = gen_reg_rtx (SImode); - mode = SImode; -@@ -17005,7 +19895,25 @@ - } - - cond = gen_reg_rtx (CCmode); -- x = gen_rtx_COMPARE (CCmode, x, oldval); -+ /* If we have TImode, synthesize a comparison. */ -+ if (mode != TImode) -+ x = gen_rtx_COMPARE (CCmode, x, oldval); -+ else -+ { -+ rtx xor1_result = gen_reg_rtx (DImode); -+ rtx xor2_result = gen_reg_rtx (DImode); -+ rtx or_result = gen_reg_rtx (DImode); -+ rtx new_word0 = simplify_gen_subreg (DImode, x, TImode, 0); -+ rtx new_word1 = simplify_gen_subreg (DImode, x, TImode, 8); -+ rtx old_word0 = simplify_gen_subreg (DImode, oldval, TImode, 0); -+ rtx old_word1 = simplify_gen_subreg (DImode, oldval, TImode, 8); -+ -+ emit_insn (gen_xordi3 (xor1_result, new_word0, old_word0)); -+ emit_insn (gen_xordi3 (xor2_result, new_word1, old_word1)); -+ emit_insn (gen_iordi3 (or_result, xor1_result, xor2_result)); -+ x = gen_rtx_COMPARE (CCmode, or_result, const0_rtx); -+ } -+ - emit_insn (gen_rtx_SET (VOIDmode, cond, x)); - - x = gen_rtx_NE (VOIDmode, cond, const0_rtx); -@@ -17015,7 +19923,7 @@ - if (mask) - x = rs6000_mask_atomic_subword (retval, newval, mask); - -- emit_store_conditional (mode, cond, mem, x); -+ emit_store_conditional (orig_mode, cond, mem, x); - - if (!is_weak) - { -@@ -17033,6 +19941,8 @@ - - if (shift) - rs6000_finish_atomic_subword (operands[1], retval, shift); -+ else if (mode != GET_MODE (operands[1])) -+ convert_move (operands[1], retval, 1); - - /* In all cases, CR0 contains EQ on success, and NE on failure. */ - x = gen_rtx_EQ (SImode, cond, const0_rtx); -@@ -17056,7 +19966,7 @@ - mode = GET_MODE (mem); - - mask = shift = NULL_RTX; -- if (mode == QImode || mode == HImode) -+ if (!TARGET_SYNC_HI_QI && (mode == QImode || mode == HImode)) - { - mem = rs6000_adjust_atomic_subword (mem, &shift, &mask); - -@@ -17105,53 +20015,70 @@ - { - enum memmodel model = (enum memmodel) INTVAL (model_rtx); - enum machine_mode mode = GET_MODE (mem); -+ enum machine_mode store_mode = mode; - rtx label, x, cond, mask, shift; - rtx before = orig_before, after = orig_after; - - mask = shift = NULL_RTX; -+ /* On power8, we want to use SImode for the operation. On previous systems, -+ use the operation in a subword and shift/mask to get the proper byte or -+ halfword. */ - if (mode == QImode || mode == HImode) - { -- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask); -+ if (TARGET_SYNC_HI_QI) -+ { -+ val = convert_modes (SImode, mode, val, 1); - -- /* Shift and mask VAL into position with the word. */ -- val = convert_modes (SImode, mode, val, 1); -- val = expand_simple_binop (SImode, ASHIFT, val, shift, -- NULL_RTX, 1, OPTAB_LIB_WIDEN); -- -- switch (code) -+ /* Prepare to adjust the return value. */ -+ before = gen_reg_rtx (SImode); -+ if (after) -+ after = gen_reg_rtx (SImode); -+ mode = SImode; -+ } -+ else - { -- case IOR: -- case XOR: -- /* We've already zero-extended VAL. That is sufficient to -- make certain that it does not affect other bits. */ -- mask = NULL; -- break; -+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask); - -- case AND: -- /* If we make certain that all of the other bits in VAL are -- set, that will be sufficient to not affect other bits. */ -- x = gen_rtx_NOT (SImode, mask); -- x = gen_rtx_IOR (SImode, x, val); -- emit_insn (gen_rtx_SET (VOIDmode, val, x)); -- mask = NULL; -- break; -+ /* Shift and mask VAL into position with the word. */ -+ val = convert_modes (SImode, mode, val, 1); -+ val = expand_simple_binop (SImode, ASHIFT, val, shift, -+ NULL_RTX, 1, OPTAB_LIB_WIDEN); - -- case NOT: -- case PLUS: -- case MINUS: -- /* These will all affect bits outside the field and need -- adjustment via MASK within the loop. */ -- break; -+ switch (code) -+ { -+ case IOR: -+ case XOR: -+ /* We've already zero-extended VAL. That is sufficient to -+ make certain that it does not affect other bits. */ -+ mask = NULL; -+ break; - -- default: -- gcc_unreachable (); -+ case AND: -+ /* If we make certain that all of the other bits in VAL are -+ set, that will be sufficient to not affect other bits. */ -+ x = gen_rtx_NOT (SImode, mask); -+ x = gen_rtx_IOR (SImode, x, val); -+ emit_insn (gen_rtx_SET (VOIDmode, val, x)); -+ mask = NULL; -+ break; -+ -+ case NOT: -+ case PLUS: -+ case MINUS: -+ /* These will all affect bits outside the field and need -+ adjustment via MASK within the loop. */ -+ break; -+ -+ default: -+ gcc_unreachable (); -+ } -+ -+ /* Prepare to adjust the return value. */ -+ before = gen_reg_rtx (SImode); -+ if (after) -+ after = gen_reg_rtx (SImode); -+ store_mode = mode = SImode; - } -- -- /* Prepare to adjust the return value. */ -- before = gen_reg_rtx (SImode); -- if (after) -- after = gen_reg_rtx (SImode); -- mode = SImode; - } - - mem = rs6000_pre_atomic_barrier (mem, model); -@@ -17184,9 +20111,11 @@ - NULL_RTX, 1, OPTAB_LIB_WIDEN); - x = rs6000_mask_atomic_subword (before, x, mask); - } -+ else if (store_mode != mode) -+ x = convert_modes (store_mode, mode, x, 1); - - cond = gen_reg_rtx (CCmode); -- emit_store_conditional (mode, cond, mem, x); -+ emit_store_conditional (store_mode, cond, mem, x); - - x = gen_rtx_NE (VOIDmode, cond, const0_rtx); - emit_unlikely_jump (x, label); -@@ -17195,11 +20124,22 @@ - - if (shift) - { -+ /* QImode/HImode on machines without lbarx/lharx where we do a lwarx and -+ then do the calcuations in a SImode register. */ - if (orig_before) - rs6000_finish_atomic_subword (orig_before, before, shift); - if (orig_after) - rs6000_finish_atomic_subword (orig_after, after, shift); - } -+ else if (store_mode != mode) -+ { -+ /* QImode/HImode on machines with lbarx/lharx where we do the native -+ operation and then do the calcuations in a SImode register. */ -+ if (orig_before) -+ convert_move (orig_before, before, 1); -+ if (orig_after) -+ convert_move (orig_after, after, 1); -+ } - else if (orig_after && after != orig_after) - emit_move_insn (orig_after, after); - } -@@ -17239,6 +20179,39 @@ - - gcc_assert (reg_mode_size * nregs == GET_MODE_SIZE (mode)); - -+ /* TDmode residing in FP registers is special, since the ISA requires that -+ the lower-numbered word of a register pair is always the most significant -+ word, even in little-endian mode. This does not match the usual subreg -+ semantics, so we cannnot use simplify_gen_subreg in those cases. Access -+ the appropriate constituent registers "by hand" in little-endian mode. -+ -+ Note we do not need to check for destructive overlap here since TDmode -+ can only reside in even/odd register pairs. */ -+ if (FP_REGNO_P (reg) && DECIMAL_FLOAT_MODE_P (mode) && !BYTES_BIG_ENDIAN) -+ { -+ rtx p_src, p_dst; -+ int i; -+ -+ for (i = 0; i < nregs; i++) -+ { -+ if (REG_P (src) && FP_REGNO_P (REGNO (src))) -+ p_src = gen_rtx_REG (reg_mode, REGNO (src) + nregs - 1 - i); -+ else -+ p_src = simplify_gen_subreg (reg_mode, src, mode, -+ i * reg_mode_size); -+ -+ if (REG_P (dst) && FP_REGNO_P (REGNO (dst))) -+ p_dst = gen_rtx_REG (reg_mode, REGNO (dst) + nregs - 1 - i); -+ else -+ p_dst = simplify_gen_subreg (reg_mode, dst, mode, -+ i * reg_mode_size); -+ -+ emit_insn (gen_rtx_SET (VOIDmode, p_dst, p_src)); -+ } -+ -+ return; -+ } -+ - if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst))) - { - /* Move register range backwards, if we might have destructive -@@ -17693,7 +20666,7 @@ - } - else - { -- gcc_checking_assert (DEFAULT_ABI == ABI_AIX); -+ gcc_checking_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2); - if (info->first_fp_reg_save > 61) - strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; - strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; -@@ -17704,7 +20677,8 @@ - by the static chain. It would require too much fiddling and the - static chain is rarely used anyway. FPRs are saved w.r.t the stack - pointer on Darwin, and AIX uses r1 or r12. */ -- if (using_static_chain_p && DEFAULT_ABI != ABI_AIX) -+ if (using_static_chain_p -+ && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)) - strategy |= ((DEFAULT_ABI == ABI_DARWIN ? 0 : SAVE_INLINE_FPRS) - | SAVE_INLINE_GPRS - | SAVE_INLINE_VRS | REST_INLINE_VRS); -@@ -17837,7 +20811,35 @@ - The required alignment for AIX configurations is two words (i.e., 8 - or 16 bytes). - -+ The ELFv2 ABI is a variant of the AIX ABI. Stack frames look like: - -+ SP----> +---------------------------------------+ -+ | Back chain to caller | 0 -+ +---------------------------------------+ -+ | Save area for CR | 8 -+ +---------------------------------------+ -+ | Saved LR | 16 -+ +---------------------------------------+ -+ | Saved TOC pointer | 24 -+ +---------------------------------------+ -+ | Parameter save area (P) | 32 -+ +---------------------------------------+ -+ | Alloca space (A) | 32+P -+ +---------------------------------------+ -+ | Local variable space (L) | 32+P+A -+ +---------------------------------------+ -+ | Save area for AltiVec registers (W) | 32+P+A+L -+ +---------------------------------------+ -+ | AltiVec alignment padding (Y) | 32+P+A+L+W -+ +---------------------------------------+ -+ | Save area for GP registers (G) | 32+P+A+L+W+Y -+ +---------------------------------------+ -+ | Save area for FP registers (F) | 32+P+A+L+W+Y+G -+ +---------------------------------------+ -+ old SP->| back chain to caller's caller | 32+P+A+L+W+Y+G+F -+ +---------------------------------------+ -+ -+ - V.4 stack frames look like: - - SP----> +---------------------------------------+ -@@ -17897,6 +20899,7 @@ - rs6000_stack_t *info_ptr = &stack_info; - int reg_size = TARGET_32BIT ? 4 : 8; - int ehrd_size; -+ int ehcr_size; - int save_align; - int first_gp; - HOST_WIDE_INT non_fixed_size; -@@ -17990,6 +20993,18 @@ - else - ehrd_size = 0; - -+ /* In the ELFv2 ABI, we also need to allocate space for separate -+ CR field save areas if the function calls __builtin_eh_return. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return) -+ { -+ /* This hard-codes that we have three call-saved CR fields. */ -+ ehcr_size = 3 * reg_size; -+ /* We do *not* use the regular CR save mechanism. */ -+ info_ptr->cr_save_p = 0; -+ } -+ else -+ ehcr_size = 0; -+ - /* Determine various sizes. */ - info_ptr->reg_size = reg_size; - info_ptr->fixed_size = RS6000_SAVE_AREA; -@@ -18029,6 +21044,7 @@ - gcc_unreachable (); - - case ABI_AIX: -+ case ABI_ELFv2: - case ABI_DARWIN: - info_ptr->fp_save_offset = - info_ptr->fp_size; - info_ptr->gp_save_offset = info_ptr->fp_save_offset - info_ptr->gp_size; -@@ -18058,6 +21074,8 @@ - } - else - info_ptr->ehrd_offset = info_ptr->gp_save_offset - ehrd_size; -+ -+ info_ptr->ehcr_offset = info_ptr->ehrd_offset - ehcr_size; - info_ptr->cr_save_offset = reg_size; /* first word when 64-bit. */ - info_ptr->lr_save_offset = 2*reg_size; - break; -@@ -18120,6 +21138,7 @@ - + info_ptr->spe_gp_size - + info_ptr->spe_padding_size - + ehrd_size -+ + ehcr_size - + info_ptr->cr_size - + info_ptr->vrsave_size, - save_align); -@@ -18133,7 +21152,7 @@ - - /* Determine if we need to save the link register. */ - if (info_ptr->calls_p -- || (DEFAULT_ABI == ABI_AIX -+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - && crtl->profile - && !TARGET_PROFILE_KERNEL) - || (DEFAULT_ABI == ABI_V4 && cfun->calls_alloca) -@@ -18279,6 +21298,7 @@ - default: abi_string = "Unknown"; break; - case ABI_NONE: abi_string = "NONE"; break; - case ABI_AIX: abi_string = "AIX"; break; -+ case ABI_ELFv2: abi_string = "ELFv2"; break; - case ABI_DARWIN: abi_string = "Darwin"; break; - case ABI_V4: abi_string = "V.4"; break; - } -@@ -18400,7 +21420,8 @@ - /* Currently we don't optimize very well between prolog and body - code and for PIC code the code can be actually quite bad, so - don't try to be too clever here. */ -- if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic)) -+ if (count != 0 -+ || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic)) - { - cfun->machine->ra_needs_full_frame = 1; - -@@ -18459,13 +21480,13 @@ - return false; - } - -- /* Under the AIX ABI we can't allow calls to non-local functions, -- because the callee may have a different TOC pointer to the -- caller and there's no way to ensure we restore the TOC when we -- return. With the secure-plt SYSV ABI we can't make non-local -+ /* Under the AIX or ELFv2 ABIs we can't allow calls to non-local -+ functions, because the callee may have a different TOC pointer to -+ the caller and there's no way to ensure we restore the TOC when -+ we return. With the secure-plt SYSV ABI we can't make non-local - calls when -fpic/PIC because the plt call stubs use r30. */ - if (DEFAULT_ABI == ABI_DARWIN -- || (DEFAULT_ABI == ABI_AIX -+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - && decl - && !DECL_EXTERNAL (decl) - && (*targetm.binds_local_p) (decl)) -@@ -18566,7 +21587,7 @@ - rtx dest; - dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM); - -- if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic) -+ if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic) - { - char buf[30]; - rtx lab, tmp1, tmp2, got; -@@ -18594,7 +21615,7 @@ - emit_insn (gen_load_toc_v4_pic_si ()); - emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO)); - } -- else if (TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2) -+ else if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2) - { - char buf[30]; - rtx temp0 = (fromprolog -@@ -18642,7 +21663,7 @@ - } - else - { -- gcc_assert (DEFAULT_ABI == ABI_AIX); -+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2); - - if (TARGET_32BIT) - emit_insn (gen_load_toc_aix_si (dest)); -@@ -19047,7 +22068,7 @@ - - static rtx - rs6000_frame_related (rtx insn, rtx reg, HOST_WIDE_INT val, -- rtx reg2, rtx rreg) -+ rtx reg2, rtx rreg, rtx split_reg) - { - rtx real, temp; - -@@ -19138,6 +22159,11 @@ - } - } - -+ /* If a store insn has been split into multiple insns, the -+ true source register is given by split_reg. */ -+ if (split_reg != NULL_RTX) -+ real = gen_rtx_SET (VOIDmode, SET_DEST (real), split_reg); -+ - RTX_FRAME_RELATED_P (insn) = 1; - add_reg_note (insn, REG_FRAME_RELATED_EXPR, real); - -@@ -19245,7 +22271,7 @@ - reg = gen_rtx_REG (mode, regno); - insn = emit_insn (gen_frame_store (reg, frame_reg, offset)); - return rs6000_frame_related (insn, frame_reg, frame_reg_to_sp, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - } - - /* Emit an offset memory reference suitable for a frame store, while -@@ -19361,7 +22387,7 @@ - if ((sel & SAVRES_LR)) - suffix = "_x"; - } -- else if (DEFAULT_ABI == ABI_AIX) -+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - { - #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) - /* No out-of-line save/restore routines for GPRs on AIX. */ -@@ -19502,7 +22528,7 @@ - static inline unsigned - ptr_regno_for_savres (int sel) - { -- if (DEFAULT_ABI == ABI_AIX) -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - return (sel & SAVRES_REG) == SAVRES_FPR || (sel & SAVRES_LR) ? 1 : 12; - return DEFAULT_ABI == ABI_DARWIN && (sel & SAVRES_REG) == SAVRES_FPR ? 1 : 11; - } -@@ -19587,6 +22613,43 @@ - return insn; - } - -+/* Emit code to store CR fields that need to be saved into REG. */ -+ -+static void -+rs6000_emit_move_from_cr (rtx reg) -+{ -+ /* Only the ELFv2 ABI allows storing only selected fields. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && TARGET_MFCRF) -+ { -+ int i, cr_reg[8], count = 0; -+ -+ /* Collect CR fields that must be saved. */ -+ for (i = 0; i < 8; i++) -+ if (save_reg_p (CR0_REGNO + i)) -+ cr_reg[count++] = i; -+ -+ /* If it's just a single one, use mfcrf. */ -+ if (count == 1) -+ { -+ rtvec p = rtvec_alloc (1); -+ rtvec r = rtvec_alloc (2); -+ RTVEC_ELT (r, 0) = gen_rtx_REG (CCmode, CR0_REGNO + cr_reg[0]); -+ RTVEC_ELT (r, 1) = GEN_INT (1 << (7 - cr_reg[0])); -+ RTVEC_ELT (p, 0) -+ = gen_rtx_SET (VOIDmode, reg, -+ gen_rtx_UNSPEC (SImode, r, UNSPEC_MOVESI_FROM_CR)); -+ -+ emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); -+ return; -+ } -+ -+ /* ??? It might be better to handle count == 2 / 3 cases here -+ as well, using logical operations to combine the values. */ -+ } -+ -+ emit_insn (gen_movesi_from_cr (reg)); -+} -+ - /* Determine whether the gp REG is really used. */ - - static bool -@@ -19652,6 +22715,17 @@ - #define NOT_INUSE(R) do {} while (0) - #endif - -+ if (DEFAULT_ABI == ABI_ELFv2) -+ { -+ cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM); -+ -+ /* With -mminimal-toc we may generate an extra use of r2 below. */ -+ if (!TARGET_SINGLE_PIC_BASE -+ && TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0) -+ cfun->machine->r2_setup_needed = true; -+ } -+ -+ - if (flag_stack_usage_info) - current_function_static_stack_size = info->total_size; - -@@ -19766,7 +22840,7 @@ - - insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); - rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off, -- treg, GEN_INT (-info->total_size)); -+ treg, GEN_INT (-info->total_size), NULL_RTX); - sp_off = frame_off = info->total_size; - } - -@@ -19851,7 +22925,7 @@ - - insn = emit_move_insn (mem, reg); - rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - END_USE (0); - } - } -@@ -19858,7 +22932,7 @@ - - /* If we need to save CR, put it into r12 or r11. Choose r12 except when - r12 will be needed by out-of-line gpr restore. */ -- cr_save_regno = (DEFAULT_ABI == ABI_AIX -+ cr_save_regno = ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - && !(strategy & (SAVE_INLINE_GPRS - | SAVE_NOINLINE_GPRS_SAVES_LR)) - ? 11 : 12); -@@ -19867,21 +22941,9 @@ - && REGNO (frame_reg_rtx) != cr_save_regno - && !(using_static_chain_p && cr_save_regno == 11)) - { -- rtx set; -- - cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno); - START_USE (cr_save_regno); -- insn = emit_insn (gen_movesi_from_cr (cr_save_rtx)); -- RTX_FRAME_RELATED_P (insn) = 1; -- /* Now, there's no way that dwarf2out_frame_debug_expr is going -- to understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)'. -- But that's OK. All we have to do is specify that _one_ condition -- code register is saved in this stack slot. The thrower's epilogue -- will then restore all the call-saved registers. -- We use CR2_REGNO (70) to be compatible with gcc-2.95 on Linux. */ -- set = gen_rtx_SET (VOIDmode, cr_save_rtx, -- gen_rtx_REG (SImode, CR2_REGNO)); -- add_reg_note (insn, REG_FRAME_RELATED_EXPR, set); -+ rs6000_emit_move_from_cr (cr_save_rtx); - } - - /* Do any required saving of fpr's. If only one or two to save, do -@@ -19919,7 +22981,7 @@ - info->lr_save_offset, - DFmode, sel); - rs6000_frame_related (insn, ptr_reg, sp_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - if (lr) - END_USE (0); - } -@@ -19998,7 +23060,7 @@ - SAVRES_SAVE | SAVRES_GPR); - - rs6000_frame_related (insn, spe_save_area_ptr, sp_off - save_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - } - - /* Move the static chain pointer back. */ -@@ -20048,7 +23110,7 @@ - info->lr_save_offset + ptr_off, - reg_mode, sel); - rs6000_frame_related (insn, ptr_reg, sp_off - ptr_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - if (lr) - END_USE (0); - } -@@ -20064,7 +23126,7 @@ - info->gp_save_offset + frame_off + reg_size * i); - insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); - rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - } - else if (!WORLD_SAVE_P (info)) - { -@@ -20133,7 +23195,8 @@ - be updated if we arrived at this function via a plt call or - toc adjusting stub. */ - emit_move_insn (tmp_reg_si, gen_rtx_MEM (SImode, tmp_reg)); -- toc_restore_insn = TARGET_32BIT ? 0x80410014 : 0xE8410028; -+ toc_restore_insn = ((TARGET_32BIT ? 0x80410000 : 0xE8410000) -+ + RS6000_TOC_SAVE_SLOT); - hi = gen_int_mode (toc_restore_insn & ~0xffff, SImode); - emit_insn (gen_xorsi3 (tmp_reg_si, tmp_reg_si, hi)); - compare_result = gen_rtx_REG (CCUNSmode, CR0_REGNO); -@@ -20152,7 +23215,7 @@ - LABEL_NUSES (toc_save_done) += 1; - - save_insn = emit_frame_save (frame_reg_rtx, reg_mode, -- TOC_REGNUM, frame_off + 5 * reg_size, -+ TOC_REGNUM, frame_off + RS6000_TOC_SAVE_SLOT, - sp_off - frame_off); - - emit_label (toc_save_done); -@@ -20192,28 +23255,123 @@ - rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, - GEN_INT (info->cr_save_offset + frame_off)); - rtx mem = gen_frame_mem (SImode, addr); -- /* See the large comment above about why CR2_REGNO is used. */ -- rtx magic_eh_cr_reg = gen_rtx_REG (SImode, CR2_REGNO); - - /* If we didn't copy cr before, do so now using r0. */ - if (cr_save_rtx == NULL_RTX) - { -- rtx set; -- - START_USE (0); - cr_save_rtx = gen_rtx_REG (SImode, 0); -- insn = emit_insn (gen_movesi_from_cr (cr_save_rtx)); -- RTX_FRAME_RELATED_P (insn) = 1; -- set = gen_rtx_SET (VOIDmode, cr_save_rtx, magic_eh_cr_reg); -- add_reg_note (insn, REG_FRAME_RELATED_EXPR, set); -+ rs6000_emit_move_from_cr (cr_save_rtx); - } -- insn = emit_move_insn (mem, cr_save_rtx); -+ -+ /* Saving CR requires a two-instruction sequence: one instruction -+ to move the CR to a general-purpose register, and a second -+ instruction that stores the GPR to memory. -+ -+ We do not emit any DWARF CFI records for the first of these, -+ because we cannot properly represent the fact that CR is saved in -+ a register. One reason is that we cannot express that multiple -+ CR fields are saved; another reason is that on 64-bit, the size -+ of the CR register in DWARF (4 bytes) differs from the size of -+ a general-purpose register. -+ -+ This means if any intervening instruction were to clobber one of -+ the call-saved CR fields, we'd have incorrect CFI. To prevent -+ this from happening, we mark the store to memory as a use of -+ those CR fields, which prevents any such instruction from being -+ scheduled in between the two instructions. */ -+ rtx crsave_v[9]; -+ int n_crsave = 0; -+ int i; -+ -+ crsave_v[n_crsave++] = gen_rtx_SET (VOIDmode, mem, cr_save_rtx); -+ for (i = 0; i < 8; i++) -+ if (save_reg_p (CR0_REGNO + i)) -+ crsave_v[n_crsave++] -+ = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i)); -+ -+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, -+ gen_rtvec_v (n_crsave, crsave_v))); - END_USE (REGNO (cr_save_rtx)); - -- rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off, -- NULL_RTX, NULL_RTX); -+ /* Now, there's no way that dwarf2out_frame_debug_expr is going to -+ understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)', -+ so we need to construct a frame expression manually. */ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ /* Update address to be stack-pointer relative, like -+ rs6000_frame_related would do. */ -+ addr = gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM), -+ GEN_INT (info->cr_save_offset + sp_off)); -+ mem = gen_frame_mem (SImode, addr); -+ -+ if (DEFAULT_ABI == ABI_ELFv2) -+ { -+ /* In the ELFv2 ABI we generate separate CFI records for each -+ CR field that was actually saved. They all point to the -+ same 32-bit stack slot. */ -+ rtx crframe[8]; -+ int n_crframe = 0; -+ -+ for (i = 0; i < 8; i++) -+ if (save_reg_p (CR0_REGNO + i)) -+ { -+ crframe[n_crframe] -+ = gen_rtx_SET (VOIDmode, mem, -+ gen_rtx_REG (SImode, CR0_REGNO + i)); -+ -+ RTX_FRAME_RELATED_P (crframe[n_crframe]) = 1; -+ n_crframe++; -+ } -+ -+ add_reg_note (insn, REG_FRAME_RELATED_EXPR, -+ gen_rtx_PARALLEL (VOIDmode, -+ gen_rtvec_v (n_crframe, crframe))); -+ } -+ else -+ { -+ /* In other ABIs, by convention, we use a single CR regnum to -+ represent the fact that all call-saved CR fields are saved. -+ We use CR2_REGNO to be compatible with gcc-2.95 on Linux. */ -+ rtx set = gen_rtx_SET (VOIDmode, mem, -+ gen_rtx_REG (SImode, CR2_REGNO)); -+ add_reg_note (insn, REG_FRAME_RELATED_EXPR, set); -+ } - } - -+ /* In the ELFv2 ABI we need to save all call-saved CR fields into -+ *separate* slots if the routine calls __builtin_eh_return, so -+ that they can be independently restored by the unwinder. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return) -+ { -+ int i, cr_off = info->ehcr_offset; -+ rtx crsave; -+ -+ /* ??? We might get better performance by using multiple mfocrf -+ instructions. */ -+ crsave = gen_rtx_REG (SImode, 0); -+ emit_insn (gen_movesi_from_cr (crsave)); -+ -+ for (i = 0; i < 8; i++) -+ if (!call_used_regs[CR0_REGNO + i]) -+ { -+ rtvec p = rtvec_alloc (2); -+ RTVEC_ELT (p, 0) -+ = gen_frame_store (crsave, frame_reg_rtx, cr_off + frame_off); -+ RTVEC_ELT (p, 1) -+ = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i)); -+ -+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ add_reg_note (insn, REG_FRAME_RELATED_EXPR, -+ gen_frame_store (gen_rtx_REG (SImode, CR0_REGNO + i), -+ sp_reg_rtx, cr_off + sp_off)); -+ -+ cr_off += reg_size; -+ } -+ } -+ - /* Update stack and set back pointer unless this is V.4, - for which it was done previously. */ - if (!WORLD_SAVE_P (info) && info->push_p -@@ -20291,7 +23449,7 @@ - info->altivec_save_offset + ptr_off, - 0, V4SImode, SAVRES_SAVE | SAVRES_VR); - rs6000_frame_related (insn, scratch_reg, sp_off - ptr_off, -- NULL_RTX, NULL_RTX); -+ NULL_RTX, NULL_RTX, NULL_RTX); - if (REGNO (frame_reg_rtx) == REGNO (scratch_reg)) - { - /* The oddity mentioned above clobbered our frame reg. */ -@@ -20307,7 +23465,7 @@ - for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i) - if (info->vrsave_mask & ALTIVEC_REG_BIT (i)) - { -- rtx areg, savereg, mem; -+ rtx areg, savereg, mem, split_reg; - int offset; - - offset = (info->altivec_save_offset + frame_off -@@ -20325,8 +23483,18 @@ - - insn = emit_move_insn (mem, savereg); - -+ /* When we split a VSX store into two insns, we need to make -+ sure the DWARF info knows which register we are storing. -+ Pass it in to be used on the appropriate note. */ -+ if (!BYTES_BIG_ENDIAN -+ && GET_CODE (PATTERN (insn)) == SET -+ && GET_CODE (SET_SRC (PATTERN (insn))) == VEC_SELECT) -+ split_reg = savereg; -+ else -+ split_reg = NULL_RTX; -+ - rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off, -- areg, GEN_INT (offset)); -+ areg, GEN_INT (offset), split_reg); - } - } - -@@ -20350,7 +23518,8 @@ - be using r12 as frame_reg_rtx and r11 as the static chain - pointer for nested functions. */ - save_regno = 12; -- if (DEFAULT_ABI == ABI_AIX && !using_static_chain_p) -+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ && !using_static_chain_p) - save_regno = 11; - else if (REGNO (frame_reg_rtx) == 12) - { -@@ -20389,7 +23558,7 @@ - can use register 0. This allows us to use a plain 'blr' to return - from the procedure more often. */ - int save_LR_around_toc_setup = (TARGET_ELF -- && DEFAULT_ABI != ABI_AIX -+ && DEFAULT_ABI == ABI_V4 - && flag_pic - && ! info->lr_save_p - && EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0); -@@ -20451,7 +23620,7 @@ - if (rs6000_save_toc_in_prologue_p ()) - { - rtx reg = gen_rtx_REG (reg_mode, TOC_REGNUM); -- emit_insn (gen_frame_store (reg, sp_reg_rtx, 5 * reg_size)); -+ emit_insn (gen_frame_store (reg, sp_reg_rtx, RS6000_TOC_SAVE_SLOT)); - } - } - -@@ -20492,6 +23661,49 @@ - } - } - -+ /* ELFv2 ABI r2 setup code and local entry point. This must follow -+ immediately after the global entry point label. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && cfun->machine->r2_setup_needed) -+ { -+ const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); -+ -+ fprintf (file, "0:\taddis 2,12,.TOC.-0b@ha\n"); -+ fprintf (file, "\taddi 2,2,.TOC.-0b@l\n"); -+ -+ fputs ("\t.localentry\t", file); -+ assemble_name (file, name); -+ fputs (",.-", file); -+ assemble_name (file, name); -+ fputs ("\n", file); -+ } -+ -+ /* Output -mprofile-kernel code. This needs to be done here instead of -+ in output_function_profile since it must go after the ELFv2 ABI -+ local entry point. */ -+ if (TARGET_PROFILE_KERNEL) -+ { -+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2); -+ gcc_assert (!TARGET_32BIT); -+ -+ asm_fprintf (file, "\tmflr %s\n", reg_names[0]); -+ asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]); -+ -+ /* In the ELFv2 ABI we have no compiler stack word. It must be -+ the resposibility of _mcount to preserve the static chain -+ register if required. */ -+ if (DEFAULT_ABI != ABI_ELFv2 -+ && cfun->static_chain_decl != NULL) -+ { -+ asm_fprintf (file, "\tstd %s,24(%s)\n", -+ reg_names[STATIC_CHAIN_REGNUM], reg_names[1]); -+ fprintf (file, "\tbl %s\n", RS6000_MCOUNT); -+ asm_fprintf (file, "\tld %s,24(%s)\n", -+ reg_names[STATIC_CHAIN_REGNUM], reg_names[1]); -+ } -+ else -+ fprintf (file, "\tbl %s\n", RS6000_MCOUNT); -+ } -+ - rs6000_pic_labelno++; - } - -@@ -20544,6 +23756,7 @@ - - if (using_mfcr_multiple && count > 1) - { -+ rtx insn; - rtvec p; - int ndx; - -@@ -20561,16 +23774,43 @@ - gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR)); - ndx++; - } -- emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); -+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); - gcc_assert (ndx == count); -+ -+ /* For the ELFv2 ABI we generate a CFA_RESTORE for each -+ CR field separately. */ -+ if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap) -+ { -+ for (i = 0; i < 8; i++) -+ if (save_reg_p (CR0_REGNO + i)) -+ add_reg_note (insn, REG_CFA_RESTORE, -+ gen_rtx_REG (SImode, CR0_REGNO + i)); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ } - } - else - for (i = 0; i < 8; i++) - if (save_reg_p (CR0_REGNO + i)) -- emit_insn (gen_movsi_to_cr_one (gen_rtx_REG (CCmode, CR0_REGNO + i), -- reg)); -+ { -+ rtx insn = emit_insn (gen_movsi_to_cr_one -+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg)); - -- if (!exit_func && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap)) -+ /* For the ELFv2 ABI we generate a CFA_RESTORE for each -+ CR field separately, attached to the insn that in fact -+ restores this particular CR field. */ -+ if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap) -+ { -+ add_reg_note (insn, REG_CFA_RESTORE, -+ gen_rtx_REG (SImode, CR0_REGNO + i)); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ } -+ } -+ -+ /* For other ABIs, we just generate a single CFA_RESTORE for CR2. */ -+ if (!exit_func && DEFAULT_ABI != ABI_ELFv2 -+ && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap)) - { - rtx insn = get_last_insn (); - rtx cr = gen_rtx_REG (SImode, CR2_REGNO); -@@ -20611,10 +23851,22 @@ - static rtx - add_crlr_cfa_restore (const rs6000_stack_t *info, rtx cfa_restores) - { -- if (info->cr_save_p) -+ if (DEFAULT_ABI == ABI_ELFv2) -+ { -+ int i; -+ for (i = 0; i < 8; i++) -+ if (save_reg_p (CR0_REGNO + i)) -+ { -+ rtx cr = gen_rtx_REG (SImode, CR0_REGNO + i); -+ cfa_restores = alloc_reg_note (REG_CFA_RESTORE, cr, -+ cfa_restores); -+ } -+ } -+ else if (info->cr_save_p) - cfa_restores = alloc_reg_note (REG_CFA_RESTORE, - gen_rtx_REG (SImode, CR2_REGNO), - cfa_restores); -+ - if (info->lr_save_p) - cfa_restores = alloc_reg_note (REG_CFA_RESTORE, - gen_rtx_REG (Pmode, LR_REGNO), -@@ -21112,6 +24364,35 @@ - || (!restoring_GPRs_inline - && info->first_fp_reg_save == 64)); +@@ -10537,7 +10569,7 @@ + all parameters in registers. */ -+ /* In the ELFv2 ABI we need to restore all call-saved CR fields from -+ *separate* slots if the routine calls __builtin_eh_return, so -+ that they can be independently restored by the unwinder. */ -+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return) -+ { -+ int i, cr_off = info->ehcr_offset; -+ -+ for (i = 0; i < 8; i++) -+ if (!call_used_regs[CR0_REGNO + i]) -+ { -+ rtx reg = gen_rtx_REG (SImode, 0); -+ emit_insn (gen_frame_load (reg, frame_reg_rtx, -+ cr_off + frame_off)); -+ -+ insn = emit_insn (gen_movsi_to_cr_one -+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg)); -+ -+ if (!exit_func && flag_shrink_wrap) -+ { -+ add_reg_note (insn, REG_CFA_RESTORE, -+ gen_rtx_REG (SImode, CR0_REGNO + i)); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ } -+ -+ cr_off += reg_size; -+ } -+ } -+ - /* Get the old lr if we saved it. If we are restoring registers - out-of-line, then the out-of-line routines can do this for us. */ - if (restore_lr && restoring_GPRs_inline) -@@ -21155,7 +24436,7 @@ - { - rtx reg = gen_rtx_REG (reg_mode, 2); - emit_insn (gen_frame_load (reg, frame_reg_rtx, -- frame_off + 5 * reg_size)); -+ frame_off + RS6000_TOC_SAVE_SLOT)); - } - - for (i = 0; ; ++i) -@@ -21441,6 +24722,7 @@ - if (! restoring_FPRs_inline) - { - int i; -+ int reg; - rtx sym; - - if (flag_shrink_wrap) -@@ -21449,10 +24731,9 @@ - sym = rs6000_savres_routine_sym (info, - SAVRES_FPR | (lr ? SAVRES_LR : 0)); - RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode, sym); -- RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode, -- gen_rtx_REG (Pmode, -- DEFAULT_ABI == ABI_AIX -- ? 1 : 11)); -+ reg = (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)? 1 : 11; -+ RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, reg)); -+ - for (i = 0; i < 64 - info->first_fp_reg_save; i++) - { - rtx reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i); -@@ -21530,7 +24811,8 @@ - - System V.4 Powerpc's (and the embedded ABI derived from it) use a - different traceback table. */ -- if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive -+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ && ! flag_inhibit_size_directive - && rs6000_traceback != traceback_none && !cfun->is_thunk) - { - const char *fname = NULL; -@@ -21858,6 +25140,12 @@ - SIBLING_CALL_P (insn) = 1; - emit_barrier (); - -+ /* Ensure we have a global entry point for the thunk. ??? We could -+ avoid that if the target routine doesn't need a global entry point, -+ but we do not know whether this is the case at this point. */ -+ if (DEFAULT_ABI == ABI_ELFv2) -+ cfun->machine->r2_setup_needed = true; -+ - /* Run just enough of rest_of_compilation to get the insns emitted. - There's not really enough bulk here to make other passes such as - instruction scheduling worth while. Note that use_thunk calls -@@ -22554,7 +25842,7 @@ - if (TARGET_PROFILE_KERNEL) - return; - -- if (DEFAULT_ABI == ABI_AIX) -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - { - #ifndef NO_PROFILE_COUNTERS - # define NO_PROFILE_COUNTERS 0 -@@ -22698,29 +25986,9 @@ - break; - - case ABI_AIX: -+ case ABI_ELFv2: - case ABI_DARWIN: -- if (!TARGET_PROFILE_KERNEL) -- { -- /* Don't do anything, done in output_profile_hook (). */ -- } -- else -- { -- gcc_assert (!TARGET_32BIT); -- -- asm_fprintf (file, "\tmflr %s\n", reg_names[0]); -- asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]); -- -- if (cfun->static_chain_decl != NULL) -- { -- asm_fprintf (file, "\tstd %s,24(%s)\n", -- reg_names[STATIC_CHAIN_REGNUM], reg_names[1]); -- fprintf (file, "\tbl %s\n", RS6000_MCOUNT); -- asm_fprintf (file, "\tld %s,24(%s)\n", -- reg_names[STATIC_CHAIN_REGNUM], reg_names[1]); -- } -- else -- fprintf (file, "\tbl %s\n", RS6000_MCOUNT); -- } -+ /* Don't do anything, done in output_profile_hook (). */ - break; - } - } -@@ -22846,6 +26114,7 @@ - || rs6000_cpu_attr == CPU_POWER4 - || rs6000_cpu_attr == CPU_POWER5 - || rs6000_cpu_attr == CPU_POWER7 -+ || rs6000_cpu_attr == CPU_POWER8 - || rs6000_cpu_attr == CPU_CELL) - && recog_memoized (dep_insn) - && (INSN_CODE (dep_insn) >= 0)) -@@ -23128,7 +26397,8 @@ - if (rs6000_cpu_attr == CPU_CELL) - return get_attr_cell_micro (insn) == CELL_MICRO_ALWAYS; - -- if (rs6000_sched_groups) -+ if (rs6000_sched_groups -+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5)) - { - enum attr_type type = get_attr_type (insn); - if (type == TYPE_LOAD_EXT_U -@@ -23153,7 +26423,8 @@ - || GET_CODE (PATTERN (insn)) == CLOBBER) - return false; - -- if (rs6000_sched_groups) -+ if (rs6000_sched_groups -+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5)) - { - enum attr_type type = get_attr_type (insn); - if (type == TYPE_LOAD_U || type == TYPE_STORE_U -@@ -23432,6 +26703,8 @@ - case CPU_POWER6: - case CPU_POWER7: - return 5; -+ case CPU_POWER8: -+ return 7; - default: - return 1; - } -@@ -24059,6 +27332,39 @@ - break; - } - break; -+ case PROCESSOR_POWER8: -+ type = get_attr_type (insn); -+ -+ switch (type) -+ { -+ case TYPE_CR_LOGICAL: -+ case TYPE_DELAYED_CR: -+ case TYPE_MFCR: -+ case TYPE_MFCRF: -+ case TYPE_MTCR: -+ case TYPE_COMPARE: -+ case TYPE_DELAYED_COMPARE: -+ case TYPE_VAR_DELAYED_COMPARE: -+ case TYPE_IMUL_COMPARE: -+ case TYPE_LMUL_COMPARE: -+ case TYPE_SYNC: -+ case TYPE_ISYNC: -+ case TYPE_LOAD_L: -+ case TYPE_STORE_C: -+ case TYPE_LOAD_U: -+ case TYPE_LOAD_UX: -+ case TYPE_LOAD_EXT: -+ case TYPE_LOAD_EXT_U: -+ case TYPE_LOAD_EXT_UX: -+ case TYPE_STORE_UX: -+ case TYPE_VECSTORE: -+ case TYPE_MFJMPR: -+ case TYPE_MTJMPR: -+ return true; -+ default: -+ break; -+ } -+ break; - default: - break; - } -@@ -24137,6 +27443,25 @@ - break; - } - break; -+ case PROCESSOR_POWER8: -+ type = get_attr_type (insn); -+ -+ switch (type) -+ { -+ case TYPE_MFCR: -+ case TYPE_MTCR: -+ case TYPE_ISYNC: -+ case TYPE_SYNC: -+ case TYPE_LOAD_L: -+ case TYPE_STORE_C: -+ case TYPE_LOAD_EXT_U: -+ case TYPE_LOAD_EXT_UX: -+ case TYPE_STORE_UX: -+ return true; -+ default: -+ break; -+ } -+ break; - default: - break; - } -@@ -24226,8 +27551,9 @@ - if (can_issue_more && !is_branch_slot_insn (next_insn)) - can_issue_more--; - -- /* Power6 and Power7 have special group ending nop. */ -- if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7) -+ /* Do we have a special group ending nop? */ -+ if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7 -+ || rs6000_cpu_attr == CPU_POWER8) - { - nop = gen_group_ending_nop (); - emit_insn_before (nop, next_insn); -@@ -24598,6 +27924,11 @@ - ret = (TARGET_32BIT) ? 12 : 24; - break; - -+ case ABI_ELFv2: -+ gcc_assert (!TARGET_32BIT); -+ ret = 32; -+ break; -+ - case ABI_DARWIN: - case ABI_V4: - ret = (TARGET_32BIT) ? 40 : 48; -@@ -24653,6 +27984,7 @@ - break; - - /* Under V.4/eabi/darwin, __trampoline_setup does the real work. */ -+ case ABI_ELFv2: - case ABI_DARWIN: - case ABI_V4: - emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"), -@@ -24743,6 +28075,9 @@ - unsigned_p = TYPE_UNSIGNED (type); - switch (mode) - { -+ case TImode: -+ result = (unsigned_p ? unsigned_V1TI_type_node : V1TI_type_node); -+ break; - case DImode: - result = (unsigned_p ? unsigned_V2DI_type_node : V2DI_type_node); - break; -@@ -24947,7 +28282,7 @@ - static void - rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED) - { -- if (DEFAULT_ABI == ABI_AIX -+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - && TARGET_MINIMAL_TOC - && !TARGET_RELOCATABLE) - { -@@ -24968,7 +28303,8 @@ + int +-rs6000_reg_parm_stack_space (tree fun) ++rs6000_reg_parm_stack_space (tree fun, bool incoming) + { + int reg_parm_stack_space; + +@@ -10555,7 +10587,7 @@ + case ABI_ELFv2: + /* ??? Recomputing this every time is a bit expensive. Is there + a place to cache this information? */ +- if (rs6000_function_parms_need_stack (fun)) ++ if (rs6000_function_parms_need_stack (fun, incoming)) + reg_parm_stack_space = TARGET_64BIT ? 64 : 32; else - fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); - } -- else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) -+ else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ && !TARGET_RELOCATABLE) - fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + reg_parm_stack_space = 0; +@@ -13544,11 +13576,15 @@ + else if ((fnmask & (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) + == (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) + error ("Builtin function %s requires the -mhard-dfp and" +- "-mpower8-vector options", name); ++ " -mpower8-vector options", name); + else if ((fnmask & RS6000_BTM_DFP) != 0) + error ("Builtin function %s requires the -mhard-dfp option", name); + else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0) + error ("Builtin function %s requires the -mpower8-vector option", name); ++ else if ((fnmask & (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) ++ == (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) ++ error ("Builtin function %s requires the -mhard-float and" ++ " -mlong-double-128 options", name); + else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0) + error ("Builtin function %s requires the -mhard-float option", name); else - { -@@ -25518,7 +28854,7 @@ - { - if (flag_pic) - return 3; -- else if (DEFAULT_ABI == ABI_AIX) -+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) - return 2; - else - return 0; -@@ -25594,7 +28930,7 @@ - void - rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) - { -- if (TARGET_64BIT) -+ if (TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2) - { - fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", file); - ASM_OUTPUT_LABEL (file, name); -@@ -25660,8 +28996,7 @@ - fprintf (file, "%s:\n", desc_name); - fprintf (file, "\t.long %s\n", orig_name); - fputs ("\t.long _GLOBAL_OFFSET_TABLE_\n", file); -- if (DEFAULT_ABI == ABI_AIX) -- fputs ("\t.long 0\n", file); -+ fputs ("\t.long 0\n", file); - fprintf (file, "\t.previous\n"); - } - ASM_OUTPUT_LABEL (file, name); -@@ -25690,7 +29025,7 @@ - } - #endif - #if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) -- if (TARGET_32BIT) -+ if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2) - file_end_indicate_exec_stack (); - #endif - } -@@ -25829,10 +29164,23 @@ - name, suffix[smclass], flags & SECTION_ENTSIZE); - } - -+#define IN_NAMED_SECTION(DECL) \ -+ ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \ -+ && DECL_SECTION_NAME (DECL) != NULL_TREE) -+ - static section * - rs6000_xcoff_select_section (tree decl, int reloc, -- unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) -+ unsigned HOST_WIDE_INT align) - { -+ /* Place variables with alignment stricter than BIGGEST_ALIGNMENT into -+ named section. */ -+ if (align > BIGGEST_ALIGNMENT) -+ { -+ resolve_unique_section (decl, reloc, true); -+ if (IN_NAMED_SECTION (decl)) -+ return get_named_section (decl, NULL, reloc); -+ } -+ - if (decl_readonly_section (decl, reloc)) - { - if (TREE_PUBLIC (decl)) -@@ -25870,10 +29218,12 @@ - { - const char *name; - -- /* Use select_section for private and uninitialized data. */ -+ /* Use select_section for private data and uninitialized data with -+ alignment <= BIGGEST_ALIGNMENT. */ - if (!TREE_PUBLIC (decl) - || DECL_COMMON (decl) -- || DECL_INITIAL (decl) == NULL_TREE -+ || (DECL_INITIAL (decl) == NULL_TREE -+ && DECL_ALIGN (decl) <= BIGGEST_ALIGNMENT) - || DECL_INITIAL (decl) == error_mark_node - || (flag_zero_initialized_in_bss - && initializer_zerop (DECL_INITIAL (decl)))) -@@ -26430,7 +29780,8 @@ - /* For those processors that have slow LR/CTR moves, make them more - expensive than memory in order to bias spills to memory .*/ - else if ((rs6000_cpu == PROCESSOR_POWER6 -- || rs6000_cpu == PROCESSOR_POWER7) -+ || rs6000_cpu == PROCESSOR_POWER7 -+ || rs6000_cpu == PROCESSOR_POWER8) - && reg_classes_intersect_p (rclass, LINK_OR_CTR_REGS)) - ret = 6 * hard_regno_nregs[0][mode]; - -@@ -26440,7 +29791,7 @@ - } - - /* If we have VSX, we can easily move between FPR or Altivec registers. */ -- else if (VECTOR_UNIT_VSX_P (mode) -+ else if (VECTOR_MEM_VSX_P (mode) - && reg_classes_intersect_p (to, VSX_REGS) - && reg_classes_intersect_p (from, VSX_REGS)) - ret = 2 * hard_regno_nregs[32][mode]; -@@ -26481,7 +29832,8 @@ - - if (reg_classes_intersect_p (rclass, GENERAL_REGS)) - ret = 4 * hard_regno_nregs[0][mode]; -- else if (reg_classes_intersect_p (rclass, FLOAT_REGS)) -+ else if ((reg_classes_intersect_p (rclass, FLOAT_REGS) -+ || reg_classes_intersect_p (rclass, VSX_REGS))) - ret = 4 * hard_regno_nregs[32][mode]; - else if (reg_classes_intersect_p (rclass, ALTIVEC_REGS)) - ret = 4 * hard_regno_nregs[FIRST_ALTIVEC_REGNO][mode]; -@@ -26643,54 +29995,26 @@ - emit_insn (gen_rtx_SET (VOIDmode, dst, r)); - } - --/* Newton-Raphson approximation of floating point divide with just 2 passes -- (either single precision floating point, or newer machines with higher -- accuracy estimates). Support both scalar and vector divide. Assumes no -- trapping math and finite arguments. */ -+/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P, -+ add a reg_note saying that this was a division. Support both scalar and -+ vector divide. Assumes no trapping math and finite arguments. */ - --static void --rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d) -+void -+rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p) - { - enum machine_mode mode = GET_MODE (dst); -- rtx x0, e0, e1, y1, u0, v0; -- enum insn_code code = optab_handler (smul_optab, mode); -- insn_gen_fn gen_mul = GEN_FCN (code); -- rtx one = rs6000_load_constant_and_splat (mode, dconst1); -+ rtx one, x0, e0, x1, xprev, eprev, xnext, enext, u, v; -+ int i; - -- gcc_assert (code != CODE_FOR_nothing); -+ /* Low precision estimates guarantee 5 bits of accuracy. High -+ precision estimates guarantee 14 bits of accuracy. SFmode -+ requires 23 bits of accuracy. DFmode requires 52 bits of -+ accuracy. Each pass at least doubles the accuracy, leading -+ to the following. */ -+ int passes = (TARGET_RECIP_PRECISION) ? 1 : 3; -+ if (mode == DFmode || mode == V2DFmode) -+ passes++; - -- /* x0 = 1./d estimate */ -- x0 = gen_reg_rtx (mode); -- emit_insn (gen_rtx_SET (VOIDmode, x0, -- gen_rtx_UNSPEC (mode, gen_rtvec (1, d), -- UNSPEC_FRES))); -- -- e0 = gen_reg_rtx (mode); -- rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - (d * x0) */ -- -- e1 = gen_reg_rtx (mode); -- rs6000_emit_madd (e1, e0, e0, e0); /* e1 = (e0 * e0) + e0 */ -- -- y1 = gen_reg_rtx (mode); -- rs6000_emit_madd (y1, e1, x0, x0); /* y1 = (e1 * x0) + x0 */ -- -- u0 = gen_reg_rtx (mode); -- emit_insn (gen_mul (u0, n, y1)); /* u0 = n * y1 */ -- -- v0 = gen_reg_rtx (mode); -- rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - (d * u0) */ -- -- rs6000_emit_madd (dst, v0, y1, u0); /* dst = (v0 * y1) + u0 */ --} -- --/* Newton-Raphson approximation of floating point divide that has a low -- precision estimate. Assumes no trapping math and finite arguments. */ -- --static void --rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d) --{ -- enum machine_mode mode = GET_MODE (dst); -- rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one; - enum insn_code code = optab_handler (smul_optab, mode); - insn_gen_fn gen_mul = GEN_FCN (code); - -@@ -26704,47 +30028,45 @@ - gen_rtx_UNSPEC (mode, gen_rtvec (1, d), - UNSPEC_FRES))); - -- e0 = gen_reg_rtx (mode); -- rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - d * x0 */ -+ /* Each iteration but the last calculates x_(i+1) = x_i * (2 - d * x_i). */ -+ if (passes > 1) { - -- y1 = gen_reg_rtx (mode); -- rs6000_emit_madd (y1, e0, x0, x0); /* y1 = x0 + e0 * x0 */ -+ /* e0 = 1. - d * x0 */ -+ e0 = gen_reg_rtx (mode); -+ rs6000_emit_nmsub (e0, d, x0, one); - -- e1 = gen_reg_rtx (mode); -- emit_insn (gen_mul (e1, e0, e0)); /* e1 = e0 * e0 */ -+ /* x1 = x0 + e0 * x0 */ -+ x1 = gen_reg_rtx (mode); -+ rs6000_emit_madd (x1, e0, x0, x0); - -- y2 = gen_reg_rtx (mode); -- rs6000_emit_madd (y2, e1, y1, y1); /* y2 = y1 + e1 * y1 */ -+ for (i = 0, xprev = x1, eprev = e0; i < passes - 2; -+ ++i, xprev = xnext, eprev = enext) { -+ -+ /* enext = eprev * eprev */ -+ enext = gen_reg_rtx (mode); -+ emit_insn (gen_mul (enext, eprev, eprev)); - -- e2 = gen_reg_rtx (mode); -- emit_insn (gen_mul (e2, e1, e1)); /* e2 = e1 * e1 */ -+ /* xnext = xprev + enext * xprev */ -+ xnext = gen_reg_rtx (mode); -+ rs6000_emit_madd (xnext, enext, xprev, xprev); -+ } - -- y3 = gen_reg_rtx (mode); -- rs6000_emit_madd (y3, e2, y2, y2); /* y3 = y2 + e2 * y2 */ -+ } else -+ xprev = x0; - -- u0 = gen_reg_rtx (mode); -- emit_insn (gen_mul (u0, n, y3)); /* u0 = n * y3 */ -+ /* The last iteration calculates x_(i+1) = n * x_i * (2 - d * x_i). */ - -- v0 = gen_reg_rtx (mode); -- rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - d * u0 */ -+ /* u = n * xprev */ -+ u = gen_reg_rtx (mode); -+ emit_insn (gen_mul (u, n, xprev)); - -- rs6000_emit_madd (dst, v0, y3, u0); /* dst = u0 + v0 * y3 */ --} -+ /* v = n - (d * u) */ -+ v = gen_reg_rtx (mode); -+ rs6000_emit_nmsub (v, d, u, n); - --/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P, -- add a reg_note saying that this was a division. Support both scalar and -- vector divide. Assumes no trapping math and finite arguments. */ -+ /* dst = (v * xprev) + u */ -+ rs6000_emit_madd (dst, v, xprev, u); - --void --rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p) --{ -- enum machine_mode mode = GET_MODE (dst); -- -- if (RS6000_RECIP_HIGH_PRECISION_P (mode)) -- rs6000_emit_swdiv_high_precision (dst, n, d); -- else -- rs6000_emit_swdiv_low_precision (dst, n, d); -- - if (note_p) - add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d)); - } -@@ -26758,7 +30080,16 @@ - enum machine_mode mode = GET_MODE (src); - rtx x0 = gen_reg_rtx (mode); - rtx y = gen_reg_rtx (mode); -- int passes = (TARGET_RECIP_PRECISION) ? 2 : 3; -+ -+ /* Low precision estimates guarantee 5 bits of accuracy. High -+ precision estimates guarantee 14 bits of accuracy. SFmode -+ requires 23 bits of accuracy. DFmode requires 52 bits of -+ accuracy. Each pass at least doubles the accuracy, leading -+ to the following. */ -+ int passes = (TARGET_RECIP_PRECISION) ? 1 : 3; -+ if (mode == DFmode || mode == V2DFmode) -+ passes++; -+ - REAL_VALUE_TYPE dconst3_2; - int i; - rtx halfthree; -@@ -26920,6 +30251,137 @@ - } - } - -+/* Expand an Altivec constant permutation for little endian mode. -+ There are two issues: First, the two input operands must be -+ swapped so that together they form a double-wide array in LE -+ order. Second, the vperm instruction has surprising behavior -+ in LE mode: it interprets the elements of the source vectors -+ in BE mode ("left to right") and interprets the elements of -+ the destination vector in LE mode ("right to left"). To -+ correct for this, we must subtract each element of the permute -+ control vector from 31. -+ -+ For example, suppose we want to concatenate vr10 = {0, 1, 2, 3} -+ with vr11 = {4, 5, 6, 7} and extract {0, 2, 4, 6} using a vperm. -+ We place {0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27} in vr12 to -+ serve as the permute control vector. Then, in BE mode, -+ -+ vperm 9,10,11,12 -+ -+ places the desired result in vr9. However, in LE mode the -+ vector contents will be -+ -+ vr10 = 00000003 00000002 00000001 00000000 -+ vr11 = 00000007 00000006 00000005 00000004 -+ -+ The result of the vperm using the same permute control vector is -+ -+ vr9 = 05000000 07000000 01000000 03000000 -+ -+ That is, the leftmost 4 bytes of vr10 are interpreted as the -+ source for the rightmost 4 bytes of vr9, and so on. -+ -+ If we change the permute control vector to -+ -+ vr12 = {31,20,29,28,23,22,21,20,15,14,13,12,7,6,5,4} -+ -+ and issue -+ -+ vperm 9,11,10,12 -+ -+ we get the desired -+ -+ vr9 = 00000006 00000004 00000002 00000000. */ -+ -+void -+altivec_expand_vec_perm_const_le (rtx operands[4]) -+{ -+ unsigned int i; -+ rtx perm[16]; -+ rtx constv, unspec; -+ rtx target = operands[0]; -+ rtx op0 = operands[1]; -+ rtx op1 = operands[2]; -+ rtx sel = operands[3]; -+ -+ /* Unpack and adjust the constant selector. */ -+ for (i = 0; i < 16; ++i) -+ { -+ rtx e = XVECEXP (sel, 0, i); -+ unsigned int elt = 31 - (INTVAL (e) & 31); -+ perm[i] = GEN_INT (elt); -+ } -+ -+ /* Expand to a permute, swapping the inputs and using the -+ adjusted selector. */ -+ if (!REG_P (op0)) -+ op0 = force_reg (V16QImode, op0); -+ if (!REG_P (op1)) -+ op1 = force_reg (V16QImode, op1); -+ -+ constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm)); -+ constv = force_reg (V16QImode, constv); -+ unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, constv), -+ UNSPEC_VPERM); -+ if (!REG_P (target)) -+ { -+ rtx tmp = gen_reg_rtx (V16QImode); -+ emit_move_insn (tmp, unspec); -+ unspec = tmp; -+ } -+ -+ emit_move_insn (target, unspec); -+} -+ -+/* Similarly to altivec_expand_vec_perm_const_le, we must adjust the -+ permute control vector. But here it's not a constant, so we must -+ generate a vector splat/subtract to do the adjustment. */ -+ -+void -+altivec_expand_vec_perm_le (rtx operands[4]) -+{ -+ rtx splat, unspec; -+ rtx target = operands[0]; -+ rtx op0 = operands[1]; -+ rtx op1 = operands[2]; -+ rtx sel = operands[3]; -+ rtx tmp = target; -+ rtx splatreg = gen_reg_rtx (V16QImode); -+ enum machine_mode mode = GET_MODE (target); -+ -+ /* Get everything in regs so the pattern matches. */ -+ if (!REG_P (op0)) -+ op0 = force_reg (mode, op0); -+ if (!REG_P (op1)) -+ op1 = force_reg (mode, op1); -+ if (!REG_P (sel)) -+ sel = force_reg (V16QImode, sel); -+ if (!REG_P (target)) -+ tmp = gen_reg_rtx (mode); -+ -+ /* SEL = splat(31) - SEL. */ -+ /* We want to subtract from 31, but we can't vspltisb 31 since -+ it's out of range. -1 works as well because only the low-order -+ five bits of the permute control vector elements are used. */ -+ splat = gen_rtx_VEC_DUPLICATE (V16QImode, -+ gen_rtx_CONST_INT (QImode, -1)); -+ emit_move_insn (splatreg, splat); -+ sel = gen_rtx_MINUS (V16QImode, splatreg, sel); -+ emit_move_insn (splatreg, sel); -+ -+ /* Permute with operands reversed and adjusted selector. */ -+ unspec = gen_rtx_UNSPEC (mode, gen_rtvec (3, op1, op0, splatreg), UNSPEC_VPERM); -+ -+ /* Copy into target, possibly by way of a register. */ -+ if (!REG_P (target)) -+ { -+ emit_move_insn (tmp, unspec); -+ unspec = tmp; -+ } -+ -+ emit_move_insn (target, unspec); -+} -+ - /* Expand an Altivec constant permutation. Return true if we match - an efficient implementation; false to fall back to VPERM. */ - -@@ -26927,26 +30389,43 @@ - altivec_expand_vec_perm_const (rtx operands[4]) - { - struct altivec_perm_insn { -+ HOST_WIDE_INT mask; - enum insn_code impl; - unsigned char perm[16]; - }; - static const struct altivec_perm_insn patterns[] = { -- { CODE_FOR_altivec_vpkuhum, -+ { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuhum_direct, - { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } }, -- { CODE_FOR_altivec_vpkuwum, -+ { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuwum_direct, - { 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 } }, -- { CODE_FOR_altivec_vmrghb, -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghb_direct -+ : CODE_FOR_altivec_vmrglb_direct), - { 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23 } }, -- { CODE_FOR_altivec_vmrghh, -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghh_direct -+ : CODE_FOR_altivec_vmrglh_direct), - { 0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23 } }, -- { CODE_FOR_altivec_vmrghw, -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghw_direct -+ : CODE_FOR_altivec_vmrglw_direct), - { 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 } }, -- { CODE_FOR_altivec_vmrglb, -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglb_direct -+ : CODE_FOR_altivec_vmrghb_direct), - { 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 } }, -- { CODE_FOR_altivec_vmrglh, -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglh_direct -+ : CODE_FOR_altivec_vmrghh_direct), - { 8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 } }, -- { CODE_FOR_altivec_vmrglw, -- { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } } -+ { OPTION_MASK_ALTIVEC, -+ (BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglw_direct -+ : CODE_FOR_altivec_vmrghw_direct), -+ { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } }, -+ { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgew, -+ { 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 24, 25, 26, 27 } }, -+ { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgow, -+ { 4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31 } } - }; - - unsigned int i, j, elt, which; -@@ -27003,7 +30482,9 @@ - break; - if (i == 16) - { -- emit_insn (gen_altivec_vspltb (target, op0, GEN_INT (elt))); -+ if (!BYTES_BIG_ENDIAN) -+ elt = 15 - elt; -+ emit_insn (gen_altivec_vspltb_direct (target, op0, GEN_INT (elt))); - return true; - } - -@@ -27014,9 +30495,10 @@ - break; - if (i == 16) - { -+ int field = BYTES_BIG_ENDIAN ? elt / 2 : 7 - elt / 2; - x = gen_reg_rtx (V8HImode); -- emit_insn (gen_altivec_vsplth (x, gen_lowpart (V8HImode, op0), -- GEN_INT (elt / 2))); -+ emit_insn (gen_altivec_vsplth_direct (x, gen_lowpart (V8HImode, op0), -+ GEN_INT (field))); - emit_move_insn (target, gen_lowpart (V16QImode, x)); - return true; - } -@@ -27032,9 +30514,10 @@ - break; - if (i == 16) - { -+ int field = BYTES_BIG_ENDIAN ? elt / 4 : 3 - elt / 4; - x = gen_reg_rtx (V4SImode); -- emit_insn (gen_altivec_vspltw (x, gen_lowpart (V4SImode, op0), -- GEN_INT (elt / 4))); -+ emit_insn (gen_altivec_vspltw_direct (x, gen_lowpart (V4SImode, op0), -+ GEN_INT (field))); - emit_move_insn (target, gen_lowpart (V16QImode, x)); - return true; - } -@@ -27046,6 +30529,9 @@ - { - bool swapped; - -+ if ((patterns[j].mask & rs6000_isa_flags) == 0) -+ continue; -+ - elt = patterns[j].perm[0]; - if (perm[0] == elt) - swapped = false; -@@ -27069,7 +30555,30 @@ - enum machine_mode omode = insn_data[icode].operand[0].mode; - enum machine_mode imode = insn_data[icode].operand[1].mode; - -- if (swapped) -+ /* For little-endian, don't use vpkuwum and vpkuhum if the -+ underlying vector type is not V4SI and V8HI, respectively. -+ For example, using vpkuwum with a V8HI picks up the even -+ halfwords (BE numbering) when the even halfwords (LE -+ numbering) are what we need. */ -+ if (!BYTES_BIG_ENDIAN -+ && icode == CODE_FOR_altivec_vpkuwum_direct -+ && ((GET_CODE (op0) == REG -+ && GET_MODE (op0) != V4SImode) -+ || (GET_CODE (op0) == SUBREG -+ && GET_MODE (XEXP (op0, 0)) != V4SImode))) -+ continue; -+ if (!BYTES_BIG_ENDIAN -+ && icode == CODE_FOR_altivec_vpkuhum_direct -+ && ((GET_CODE (op0) == REG -+ && GET_MODE (op0) != V8HImode) -+ || (GET_CODE (op0) == SUBREG -+ && GET_MODE (XEXP (op0, 0)) != V8HImode))) -+ continue; -+ -+ /* For little-endian, the two input operands must be swapped -+ (or swapped back) to ensure proper right-to-left numbering -+ from 0 to 2N-1. */ -+ if (swapped ^ !BYTES_BIG_ENDIAN) - x = op0, op0 = op1, op1 = x; - if (imode != V16QImode) - { -@@ -27087,6 +30596,12 @@ - } - } - -+ if (!BYTES_BIG_ENDIAN) -+ { -+ altivec_expand_vec_perm_const_le (operands); -+ return true; -+ } -+ - return false; - } - -@@ -27135,7 +30650,6 @@ - vmode = GET_MODE (target); - gcc_assert (GET_MODE_NUNITS (vmode) == 2); - dmode = mode_for_vector (GET_MODE_INNER (vmode), 4); -- - x = gen_rtx_VEC_CONCAT (dmode, op0, op1); - v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1)); - x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v)); -@@ -27231,7 +30745,7 @@ - unsigned i, high, nelt = GET_MODE_NUNITS (vmode); - rtx perm[16]; - -- high = (highp == BYTES_BIG_ENDIAN ? 0 : nelt / 2); -+ high = (highp ? 0 : nelt / 2); - for (i = 0; i < nelt / 2; i++) - { - perm[i * 2] = GEN_INT (i + high); -@@ -27286,6 +30800,8 @@ - { - enum machine_mode mode; - unsigned int regno; -+ enum machine_mode elt_mode; -+ int n_elts; - - /* Special handling for structs in darwin64. */ - if (TARGET_MACHO -@@ -27305,6 +30821,36 @@ - /* Otherwise fall through to standard ABI rules. */ - } - -+ /* The ELFv2 ABI returns homogeneous VFP aggregates in registers. */ -+ if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (valtype), valtype, -+ &elt_mode, &n_elts)) -+ { -+ int first_reg, n_regs, i; -+ rtx par; -+ -+ if (SCALAR_FLOAT_MODE_P (elt_mode)) -+ { -+ /* _Decimal128 must use even/odd register pairs. */ -+ first_reg = (elt_mode == TDmode) ? FP_ARG_RETURN + 1 : FP_ARG_RETURN; -+ n_regs = (GET_MODE_SIZE (elt_mode) + 7) >> 3; -+ } -+ else -+ { -+ first_reg = ALTIVEC_ARG_RETURN; -+ n_regs = 1; -+ } -+ -+ par = gen_rtx_PARALLEL (TYPE_MODE (valtype), rtvec_alloc (n_elts)); -+ for (i = 0; i < n_elts; i++) -+ { -+ rtx r = gen_rtx_REG (elt_mode, first_reg + i * n_regs); -+ rtx off = GEN_INT (i * GET_MODE_SIZE (elt_mode)); -+ XVECEXP (par, 0, i) = gen_rtx_EXPR_LIST (VOIDmode, r, off); -+ } -+ -+ return par; -+ } -+ - if (TARGET_32BIT && TARGET_POWERPC64 && TYPE_MODE (valtype) == DImode) - { - /* Long long return value need be split in -mpowerpc64, 32bit ABI. */ -@@ -27417,6 +30963,13 @@ - } - - -+/* Return true if we use LRA instead of reload pass. */ -+static bool -+rs6000_lra_p (void) -+{ -+ return rs6000_lra_flag; -+} -+ - /* Given FROM and TO register numbers, say whether this elimination is allowed. - Frame pointer elimination is automatically handled. - -@@ -27679,22 +31232,33 @@ - { - { "altivec", OPTION_MASK_ALTIVEC, false, true }, - { "cmpb", OPTION_MASK_CMPB, false, true }, -+ { "crypto", OPTION_MASK_CRYPTO, false, true }, -+ { "direct-move", OPTION_MASK_DIRECT_MOVE, false, true }, - { "dlmzb", OPTION_MASK_DLMZB, false, true }, - { "fprnd", OPTION_MASK_FPRND, false, true }, - { "hard-dfp", OPTION_MASK_DFP, false, true }, -+ { "htm", OPTION_MASK_HTM, false, true }, - { "isel", OPTION_MASK_ISEL, false, true }, - { "mfcrf", OPTION_MASK_MFCRF, false, true }, - { "mfpgpr", OPTION_MASK_MFPGPR, false, true }, - { "mulhw", OPTION_MASK_MULHW, false, true }, - { "multiple", OPTION_MASK_MULTIPLE, false, true }, -- { "update", OPTION_MASK_NO_UPDATE, true , true }, - { "popcntb", OPTION_MASK_POPCNTB, false, true }, - { "popcntd", OPTION_MASK_POPCNTD, false, true }, -+ { "power8-fusion", OPTION_MASK_P8_FUSION, false, true }, -+ { "power8-fusion-sign", OPTION_MASK_P8_FUSION_SIGN, false, true }, -+ { "power8-vector", OPTION_MASK_P8_VECTOR, false, true }, - { "powerpc-gfxopt", OPTION_MASK_PPC_GFXOPT, false, true }, - { "powerpc-gpopt", OPTION_MASK_PPC_GPOPT, false, true }, -+ { "quad-memory", OPTION_MASK_QUAD_MEMORY, false, true }, -+ { "quad-memory-atomic", OPTION_MASK_QUAD_MEMORY_ATOMIC, false, true }, - { "recip-precision", OPTION_MASK_RECIP_PRECISION, false, true }, - { "string", OPTION_MASK_STRING, false, true }, -+ { "update", OPTION_MASK_NO_UPDATE, true , true }, -+ { "upper-regs-df", OPTION_MASK_UPPER_REGS_DF, false, false }, -+ { "upper-regs-sf", OPTION_MASK_UPPER_REGS_SF, false, false }, - { "vsx", OPTION_MASK_VSX, false, true }, -+ { "vsx-timode", OPTION_MASK_VSX_TIMODE, false, true }, - #ifdef OPTION_MASK_64BIT - #if TARGET_AIX_OS - { "aix64", OPTION_MASK_64BIT, false, false }, -@@ -27734,6 +31298,9 @@ - { "frsqrtes", RS6000_BTM_FRSQRTES, false, false }, - { "popcntd", RS6000_BTM_POPCNTD, false, false }, - { "cell", RS6000_BTM_CELL, false, false }, -+ { "power8-vector", RS6000_BTM_P8_VECTOR, false, false }, -+ { "crypto", RS6000_BTM_CRYPTO, false, false }, -+ { "htm", RS6000_BTM_HTM, false, false }, +@@ -31413,6 +31449,7 @@ + { "htm", RS6000_BTM_HTM, false, false }, + { "hard-dfp", RS6000_BTM_DFP, false, false }, + { "hard-float", RS6000_BTM_HARD_FLOAT, false, false }, ++ { "long-double-128", RS6000_BTM_LDBL128, false, false }, }; /* Option variables that we want to support inside attribute((target)) and -@@ -28250,7 +31817,6 @@ - size_t cur_column; - size_t max_column = 76; - const char *comma = ""; -- const char *nl = "\n"; - - if (indent) - start_column += fprintf (file, "%*s", indent, ""); -@@ -28281,7 +31847,6 @@ - fprintf (stderr, ", \\\n%*s", (int)start_column, ""); - cur_column = start_column + len; - comma = ""; -- nl = "\n\n"; - } - - fprintf (file, "%s%s%s%s", comma, prefix, no_str, -@@ -28291,7 +31856,7 @@ - } - } - -- fputs (nl, file); -+ fputs ("\n", file); - } - - /* Helper function to print the current isa options on a line. */ -@@ -28467,118 +32032,149 @@ - } - - --/* A function pointer under AIX is a pointer to a data area whose first word -- contains the actual address of the function, whose second word contains a -- pointer to its TOC, and whose third word contains a value to place in the -- static chain register (r11). Note that if we load the static chain, our -- "trampoline" need not have any executable code. */ - -+/* Expand code to perform a call under the AIX or ELFv2 ABI. */ -+ - void --rs6000_call_indirect_aix (rtx value, rtx func_desc, rtx flag) -+rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie) - { -+ rtx toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM); -+ rtx toc_load = NULL_RTX; -+ rtx toc_restore = NULL_RTX; - rtx func_addr; -- rtx toc_reg; -- rtx sc_reg; -- rtx stack_ptr; -- rtx stack_toc_offset; -- rtx stack_toc_mem; -- rtx func_toc_offset; -- rtx func_toc_mem; -- rtx func_sc_offset; -- rtx func_sc_mem; -+ rtx abi_reg = NULL_RTX; -+ rtx call[4]; -+ int n_call; - rtx insn; -- rtx (*call_func) (rtx, rtx, rtx, rtx); -- rtx (*call_value_func) (rtx, rtx, rtx, rtx, rtx); - -- stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM); -- toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM); -+ /* Handle longcall attributes. */ -+ if (INTVAL (cookie) & CALL_LONG) -+ func_desc = rs6000_longcall_ref (func_desc); - -- /* Load up address of the actual function. */ -- func_desc = force_reg (Pmode, func_desc); -- func_addr = gen_reg_rtx (Pmode); -- emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc)); -- -- if (TARGET_32BIT) -+ /* Handle indirect calls. */ -+ if (GET_CODE (func_desc) != SYMBOL_REF -+ || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (func_desc))) - { -+ /* Save the TOC into its reserved slot before the call, -+ and prepare to restore it after the call. */ -+ rtx stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM); -+ rtx stack_toc_offset = GEN_INT (RS6000_TOC_SAVE_SLOT); -+ rtx stack_toc_mem = gen_frame_mem (Pmode, -+ gen_rtx_PLUS (Pmode, stack_ptr, -+ stack_toc_offset)); -+ toc_restore = gen_rtx_SET (VOIDmode, toc_reg, stack_toc_mem); - -- stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_32BIT); -- func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_32BIT); -- func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_32BIT); -- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS) -- { -- call_func = gen_call_indirect_aix32bit; -- call_value_func = gen_call_value_indirect_aix32bit; -- } -+ /* Can we optimize saving the TOC in the prologue or -+ do we need to do it at every call? */ -+ if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca) -+ cfun->machine->save_toc_in_prologue = true; - else - { -- call_func = gen_call_indirect_aix32bit_nor11; -- call_value_func = gen_call_value_indirect_aix32bit_nor11; -+ MEM_VOLATILE_P (stack_toc_mem) = 1; -+ emit_move_insn (stack_toc_mem, toc_reg); - } -- } -- else -- { -- stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_64BIT); -- func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_64BIT); -- func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_64BIT); -- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS) -+ -+ if (DEFAULT_ABI == ABI_ELFv2) - { -- call_func = gen_call_indirect_aix64bit; -- call_value_func = gen_call_value_indirect_aix64bit; -+ /* A function pointer in the ELFv2 ABI is just a plain address, but -+ the ABI requires it to be loaded into r12 before the call. */ -+ func_addr = gen_rtx_REG (Pmode, 12); -+ emit_move_insn (func_addr, func_desc); -+ abi_reg = func_addr; - } - else - { -- call_func = gen_call_indirect_aix64bit_nor11; -- call_value_func = gen_call_value_indirect_aix64bit_nor11; -- } -- } -+ /* A function pointer under AIX is a pointer to a data area whose -+ first word contains the actual address of the function, whose -+ second word contains a pointer to its TOC, and whose third word -+ contains a value to place in the static chain register (r11). -+ Note that if we load the static chain, our "trampoline" need -+ not have any executable code. */ - -- /* Reserved spot to store the TOC. */ -- stack_toc_mem = gen_frame_mem (Pmode, -- gen_rtx_PLUS (Pmode, -- stack_ptr, -- stack_toc_offset)); -+ /* Load up address of the actual function. */ -+ func_desc = force_reg (Pmode, func_desc); -+ func_addr = gen_reg_rtx (Pmode); -+ emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc)); - -- gcc_assert (cfun); -- gcc_assert (cfun->machine); -+ /* Prepare to load the TOC of the called function. Note that the -+ TOC load must happen immediately before the actual call so -+ that unwinding the TOC registers works correctly. See the -+ comment in frob_update_context. */ -+ rtx func_toc_offset = GEN_INT (GET_MODE_SIZE (Pmode)); -+ rtx func_toc_mem = gen_rtx_MEM (Pmode, -+ gen_rtx_PLUS (Pmode, func_desc, -+ func_toc_offset)); -+ toc_load = gen_rtx_USE (VOIDmode, func_toc_mem); - -- /* Can we optimize saving the TOC in the prologue or do we need to do it at -- every call? */ -- if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca) -- cfun->machine->save_toc_in_prologue = true; -- -+ /* If we have a static chain, load it up. */ -+ if (TARGET_POINTERS_TO_NESTED_FUNCTIONS) -+ { -+ rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); -+ rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode)); -+ rtx func_sc_mem = gen_rtx_MEM (Pmode, -+ gen_rtx_PLUS (Pmode, func_desc, -+ func_sc_offset)); -+ emit_move_insn (sc_reg, func_sc_mem); -+ abi_reg = sc_reg; -+ } -+ } -+ } - else - { -- MEM_VOLATILE_P (stack_toc_mem) = 1; -- emit_move_insn (stack_toc_mem, toc_reg); -+ /* Direct calls use the TOC: for local calls, the callee will -+ assume the TOC register is set; for non-local calls, the -+ PLT stub needs the TOC register. */ -+ abi_reg = toc_reg; -+ func_addr = func_desc; - } - -- /* Calculate the address to load the TOC of the called function. We don't -- actually load this until the split after reload. */ -- func_toc_mem = gen_rtx_MEM (Pmode, -- gen_rtx_PLUS (Pmode, -- func_desc, -- func_toc_offset)); -+ /* Create the call. */ -+ call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_addr), flag); -+ if (value != NULL_RTX) -+ call[0] = gen_rtx_SET (VOIDmode, value, call[0]); -+ n_call = 1; - -- /* If we have a static chain, load it up. */ -- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS) -- { -- func_sc_mem = gen_rtx_MEM (Pmode, -- gen_rtx_PLUS (Pmode, -- func_desc, -- func_sc_offset)); -+ if (toc_load) -+ call[n_call++] = toc_load; -+ if (toc_restore) -+ call[n_call++] = toc_restore; - -- sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); -- emit_move_insn (sc_reg, func_sc_mem); -- } -+ call[n_call++] = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, LR_REGNO)); - -+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (n_call, call)); -+ insn = emit_call_insn (insn); -+ -+ /* Mention all registers defined by the ABI to hold information -+ as uses in CALL_INSN_FUNCTION_USAGE. */ -+ if (abi_reg) -+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), abi_reg); -+} -+ -+/* Expand code to perform a sibling call under the AIX or ELFv2 ABI. */ -+ -+void -+rs6000_sibcall_aix (rtx value, rtx func_desc, rtx flag, rtx cookie) -+{ -+ rtx call[2]; -+ rtx insn; -+ -+ gcc_assert (INTVAL (cookie) == 0); -+ - /* Create the call. */ -- if (value) -- insn = call_value_func (value, func_addr, flag, func_toc_mem, -- stack_toc_mem); -- else -- insn = call_func (func_addr, flag, func_toc_mem, stack_toc_mem); -+ call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_desc), flag); -+ if (value != NULL_RTX) -+ call[0] = gen_rtx_SET (VOIDmode, value, call[0]); - -- emit_call_insn (insn); -+ call[1] = simple_return_rtx; -+ -+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (2, call)); -+ insn = emit_call_insn (insn); -+ -+ /* Note use of the TOC register. */ -+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, TOC_REGNUM)); -+ /* We need to also mark a use of the link register since the function we -+ sibling-call to will use it to return to our caller. */ -+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, LR_REGNO)); - } - - /* Return whether we need to always update the saved TOC pointer when we update -@@ -28679,6 +32275,661 @@ - add_to_hard_reg_set (&set->set, Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM); - } - -+ -+/* Helper function for rs6000_split_logical to emit a logical instruction after -+ spliting the operation to single GPR registers. -+ -+ DEST is the destination register. -+ OP1 and OP2 are the input source registers. -+ CODE is the base operation (AND, IOR, XOR, NOT). -+ MODE is the machine mode. -+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT. -+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT. -+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT. -+ CLOBBER_REG is either NULL or a scratch register of type CC to allow -+ formation of the AND instructions. */ -+ -+static void -+rs6000_split_logical_inner (rtx dest, -+ rtx op1, -+ rtx op2, -+ enum rtx_code code, -+ enum machine_mode mode, -+ bool complement_final_p, -+ bool complement_op1_p, -+ bool complement_op2_p, -+ rtx clobber_reg) -+{ -+ rtx bool_rtx; -+ rtx set_rtx; -+ -+ /* Optimize AND of 0/0xffffffff and IOR/XOR of 0. */ -+ if (op2 && GET_CODE (op2) == CONST_INT -+ && (mode == SImode || (mode == DImode && TARGET_POWERPC64)) -+ && !complement_final_p && !complement_op1_p && !complement_op2_p) -+ { -+ HOST_WIDE_INT mask = GET_MODE_MASK (mode); -+ HOST_WIDE_INT value = INTVAL (op2) & mask; -+ -+ /* Optimize AND of 0 to just set 0. Optimize AND of -1 to be a move. */ -+ if (code == AND) -+ { -+ if (value == 0) -+ { -+ emit_insn (gen_rtx_SET (VOIDmode, dest, const0_rtx)); -+ return; -+ } -+ -+ else if (value == mask) -+ { -+ if (!rtx_equal_p (dest, op1)) -+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1)); -+ return; -+ } -+ } -+ -+ /* Optimize IOR/XOR of 0 to be a simple move. Split large operations -+ into separate ORI/ORIS or XORI/XORIS instrucitons. */ -+ else if (code == IOR || code == XOR) -+ { -+ if (value == 0) -+ { -+ if (!rtx_equal_p (dest, op1)) -+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1)); -+ return; -+ } -+ } -+ } -+ -+ if (complement_op1_p) -+ op1 = gen_rtx_NOT (mode, op1); -+ -+ if (complement_op2_p) -+ op2 = gen_rtx_NOT (mode, op2); -+ -+ bool_rtx = ((code == NOT) -+ ? gen_rtx_NOT (mode, op1) -+ : gen_rtx_fmt_ee (code, mode, op1, op2)); -+ -+ if (complement_final_p) -+ bool_rtx = gen_rtx_NOT (mode, bool_rtx); -+ -+ set_rtx = gen_rtx_SET (VOIDmode, dest, bool_rtx); -+ -+ /* Is this AND with an explicit clobber? */ -+ if (clobber_reg) -+ { -+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, clobber_reg); -+ set_rtx = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set_rtx, clobber)); -+ } -+ -+ emit_insn (set_rtx); -+ return; -+} -+ -+/* Split a DImode AND/IOR/XOR with a constant on a 32-bit system. These -+ operations are split immediately during RTL generation to allow for more -+ optimizations of the AND/IOR/XOR. -+ -+ OPERANDS is an array containing the destination and two input operands. -+ CODE is the base operation (AND, IOR, XOR, NOT). -+ MODE is the machine mode. -+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT. -+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT. -+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT. -+ CLOBBER_REG is either NULL or a scratch register of type CC to allow -+ formation of the AND instructions. */ -+ -+static void -+rs6000_split_logical_di (rtx operands[3], -+ enum rtx_code code, -+ bool complement_final_p, -+ bool complement_op1_p, -+ bool complement_op2_p, -+ rtx clobber_reg) -+{ -+ const HOST_WIDE_INT lower_32bits = HOST_WIDE_INT_C(0xffffffff); -+ const HOST_WIDE_INT upper_32bits = ~ lower_32bits; -+ const HOST_WIDE_INT sign_bit = HOST_WIDE_INT_C(0x80000000); -+ enum hi_lo { hi = 0, lo = 1 }; -+ rtx op0_hi_lo[2], op1_hi_lo[2], op2_hi_lo[2]; -+ size_t i; -+ -+ op0_hi_lo[hi] = gen_highpart (SImode, operands[0]); -+ op1_hi_lo[hi] = gen_highpart (SImode, operands[1]); -+ op0_hi_lo[lo] = gen_lowpart (SImode, operands[0]); -+ op1_hi_lo[lo] = gen_lowpart (SImode, operands[1]); -+ -+ if (code == NOT) -+ op2_hi_lo[hi] = op2_hi_lo[lo] = NULL_RTX; -+ else -+ { -+ if (GET_CODE (operands[2]) != CONST_INT) -+ { -+ op2_hi_lo[hi] = gen_highpart_mode (SImode, DImode, operands[2]); -+ op2_hi_lo[lo] = gen_lowpart (SImode, operands[2]); -+ } -+ else -+ { -+ HOST_WIDE_INT value = INTVAL (operands[2]); -+ HOST_WIDE_INT value_hi_lo[2]; -+ -+ gcc_assert (!complement_final_p); -+ gcc_assert (!complement_op1_p); -+ gcc_assert (!complement_op2_p); -+ -+ value_hi_lo[hi] = value >> 32; -+ value_hi_lo[lo] = value & lower_32bits; -+ -+ for (i = 0; i < 2; i++) -+ { -+ HOST_WIDE_INT sub_value = value_hi_lo[i]; -+ -+ if (sub_value & sign_bit) -+ sub_value |= upper_32bits; -+ -+ op2_hi_lo[i] = GEN_INT (sub_value); -+ -+ /* If this is an AND instruction, check to see if we need to load -+ the value in a register. */ -+ if (code == AND && sub_value != -1 && sub_value != 0 -+ && !and_operand (op2_hi_lo[i], SImode)) -+ op2_hi_lo[i] = force_reg (SImode, op2_hi_lo[i]); -+ } -+ } -+ } -+ -+ for (i = 0; i < 2; i++) -+ { -+ /* Split large IOR/XOR operations. */ -+ if ((code == IOR || code == XOR) -+ && GET_CODE (op2_hi_lo[i]) == CONST_INT -+ && !complement_final_p -+ && !complement_op1_p -+ && !complement_op2_p -+ && clobber_reg == NULL_RTX -+ && !logical_const_operand (op2_hi_lo[i], SImode)) -+ { -+ HOST_WIDE_INT value = INTVAL (op2_hi_lo[i]); -+ HOST_WIDE_INT hi_16bits = value & HOST_WIDE_INT_C(0xffff0000); -+ HOST_WIDE_INT lo_16bits = value & HOST_WIDE_INT_C(0x0000ffff); -+ rtx tmp = gen_reg_rtx (SImode); -+ -+ /* Make sure the constant is sign extended. */ -+ if ((hi_16bits & sign_bit) != 0) -+ hi_16bits |= upper_32bits; -+ -+ rs6000_split_logical_inner (tmp, op1_hi_lo[i], GEN_INT (hi_16bits), -+ code, SImode, false, false, false, -+ NULL_RTX); -+ -+ rs6000_split_logical_inner (op0_hi_lo[i], tmp, GEN_INT (lo_16bits), -+ code, SImode, false, false, false, -+ NULL_RTX); -+ } -+ else -+ rs6000_split_logical_inner (op0_hi_lo[i], op1_hi_lo[i], op2_hi_lo[i], -+ code, SImode, complement_final_p, -+ complement_op1_p, complement_op2_p, -+ clobber_reg); -+ } -+ -+ return; -+} -+ -+/* Split the insns that make up boolean operations operating on multiple GPR -+ registers. The boolean MD patterns ensure that the inputs either are -+ exactly the same as the output registers, or there is no overlap. -+ -+ OPERANDS is an array containing the destination and two input operands. -+ CODE is the base operation (AND, IOR, XOR, NOT). -+ MODE is the machine mode. -+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT. -+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT. -+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT. -+ CLOBBER_REG is either NULL or a scratch register of type CC to allow -+ formation of the AND instructions. */ -+ -+void -+rs6000_split_logical (rtx operands[3], -+ enum rtx_code code, -+ bool complement_final_p, -+ bool complement_op1_p, -+ bool complement_op2_p, -+ rtx clobber_reg) -+{ -+ enum machine_mode mode = GET_MODE (operands[0]); -+ enum machine_mode sub_mode; -+ rtx op0, op1, op2; -+ int sub_size, regno0, regno1, nregs, i; -+ -+ /* If this is DImode, use the specialized version that can run before -+ register allocation. */ -+ if (mode == DImode && !TARGET_POWERPC64) -+ { -+ rs6000_split_logical_di (operands, code, complement_final_p, -+ complement_op1_p, complement_op2_p, -+ clobber_reg); -+ return; -+ } -+ -+ op0 = operands[0]; -+ op1 = operands[1]; -+ op2 = (code == NOT) ? NULL_RTX : operands[2]; -+ sub_mode = (TARGET_POWERPC64) ? DImode : SImode; -+ sub_size = GET_MODE_SIZE (sub_mode); -+ regno0 = REGNO (op0); -+ regno1 = REGNO (op1); -+ -+ gcc_assert (reload_completed); -+ gcc_assert (IN_RANGE (regno0, FIRST_GPR_REGNO, LAST_GPR_REGNO)); -+ gcc_assert (IN_RANGE (regno1, FIRST_GPR_REGNO, LAST_GPR_REGNO)); -+ -+ nregs = rs6000_hard_regno_nregs[(int)mode][regno0]; -+ gcc_assert (nregs > 1); -+ -+ if (op2 && REG_P (op2)) -+ gcc_assert (IN_RANGE (REGNO (op2), FIRST_GPR_REGNO, LAST_GPR_REGNO)); -+ -+ for (i = 0; i < nregs; i++) -+ { -+ int offset = i * sub_size; -+ rtx sub_op0 = simplify_subreg (sub_mode, op0, mode, offset); -+ rtx sub_op1 = simplify_subreg (sub_mode, op1, mode, offset); -+ rtx sub_op2 = ((code == NOT) -+ ? NULL_RTX -+ : simplify_subreg (sub_mode, op2, mode, offset)); -+ -+ rs6000_split_logical_inner (sub_op0, sub_op1, sub_op2, code, sub_mode, -+ complement_final_p, complement_op1_p, -+ complement_op2_p, clobber_reg); -+ } -+ -+ return; -+} -+ -+ -+/* Return true if the peephole2 can combine a load involving a combination of -+ an addis instruction and a load with an offset that can be fused together on -+ a power8. -+ -+ The operands are: -+ operands[0] register set with addis -+ operands[1] value set via addis -+ operands[2] target register being loaded -+ operands[3] D-form memory reference using operands[0]. -+ -+ In addition, we are passed a boolean that is true if this is a peephole2, -+ and we can use see if the addis_reg is dead after the insn and can be -+ replaced by the target register. */ -+ -+bool -+fusion_gpr_load_p (rtx *operands, bool peep2_p) -+{ -+ rtx addis_reg = operands[0]; -+ rtx addis_value = operands[1]; -+ rtx target = operands[2]; -+ rtx mem = operands[3]; -+ rtx addr; -+ rtx base_reg; -+ -+ /* Validate arguments. */ -+ if (!base_reg_operand (addis_reg, GET_MODE (addis_reg))) -+ return false; -+ -+ if (!base_reg_operand (target, GET_MODE (target))) -+ return false; -+ -+ if (!fusion_gpr_addis (addis_value, GET_MODE (addis_value))) -+ return false; -+ -+ if (!fusion_gpr_mem_load (mem, GET_MODE (mem))) -+ return false; -+ -+ /* Allow sign/zero extension. */ -+ if (GET_CODE (mem) == ZERO_EXTEND -+ || (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN)) -+ mem = XEXP (mem, 0); -+ -+ if (!MEM_P (mem)) -+ return false; -+ -+ addr = XEXP (mem, 0); /* either PLUS or LO_SUM. */ -+ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) -+ return false; -+ -+ /* Validate that the register used to load the high value is either the -+ register being loaded, or we can safely replace its use in a peephole2. -+ -+ If this is a peephole2, we assume that there are 2 instructions in the -+ peephole (addis and load), so we want to check if the target register was -+ not used in the memory address and the register to hold the addis result -+ is dead after the peephole. */ -+ if (REGNO (addis_reg) != REGNO (target)) -+ { -+ if (!peep2_p) -+ return false; -+ -+ if (reg_mentioned_p (target, mem)) -+ return false; -+ -+ if (!peep2_reg_dead_p (2, addis_reg)) -+ return false; -+ -+ /* If the target register being loaded is the stack pointer, we must -+ avoid loading any other value into it, even temporarily. */ -+ if (REG_P (target) && REGNO (target) == STACK_POINTER_REGNUM) -+ return false; -+ } -+ -+ base_reg = XEXP (addr, 0); -+ return REGNO (addis_reg) == REGNO (base_reg); -+} -+ -+/* During the peephole2 pass, adjust and expand the insns for a load fusion -+ sequence. We adjust the addis register to use the target register. If the -+ load sign extends, we adjust the code to do the zero extending load, and an -+ explicit sign extension later since the fusion only covers zero extending -+ loads. -+ -+ The operands are: -+ operands[0] register set with addis (to be replaced with target) -+ operands[1] value set via addis -+ operands[2] target register being loaded -+ operands[3] D-form memory reference using operands[0]. */ -+ -+void -+expand_fusion_gpr_load (rtx *operands) -+{ -+ rtx addis_value = operands[1]; -+ rtx target = operands[2]; -+ rtx orig_mem = operands[3]; -+ rtx new_addr, new_mem, orig_addr, offset; -+ enum rtx_code plus_or_lo_sum; -+ enum machine_mode target_mode = GET_MODE (target); -+ enum machine_mode extend_mode = target_mode; -+ enum machine_mode ptr_mode = Pmode; -+ enum rtx_code extend = UNKNOWN; -+ rtx addis_reg = ((ptr_mode == target_mode) -+ ? target -+ : simplify_subreg (ptr_mode, target, target_mode, 0)); -+ -+ if (GET_CODE (orig_mem) == ZERO_EXTEND -+ || (TARGET_P8_FUSION_SIGN && GET_CODE (orig_mem) == SIGN_EXTEND)) -+ { -+ extend = GET_CODE (orig_mem); -+ orig_mem = XEXP (orig_mem, 0); -+ target_mode = GET_MODE (orig_mem); -+ } -+ -+ gcc_assert (MEM_P (orig_mem)); -+ -+ orig_addr = XEXP (orig_mem, 0); -+ plus_or_lo_sum = GET_CODE (orig_addr); -+ gcc_assert (plus_or_lo_sum == PLUS || plus_or_lo_sum == LO_SUM); -+ -+ offset = XEXP (orig_addr, 1); -+ new_addr = gen_rtx_fmt_ee (plus_or_lo_sum, ptr_mode, addis_reg, offset); -+ new_mem = change_address (orig_mem, target_mode, new_addr); -+ -+ if (extend != UNKNOWN) -+ new_mem = gen_rtx_fmt_e (ZERO_EXTEND, extend_mode, new_mem); -+ -+ emit_insn (gen_rtx_SET (VOIDmode, addis_reg, addis_value)); -+ emit_insn (gen_rtx_SET (VOIDmode, target, new_mem)); -+ -+ if (extend == SIGN_EXTEND) -+ { -+ int sub_off = ((BYTES_BIG_ENDIAN) -+ ? GET_MODE_SIZE (extend_mode) - GET_MODE_SIZE (target_mode) -+ : 0); -+ rtx sign_reg -+ = simplify_subreg (target_mode, target, extend_mode, sub_off); -+ -+ emit_insn (gen_rtx_SET (VOIDmode, target, -+ gen_rtx_SIGN_EXTEND (extend_mode, sign_reg))); -+ } -+ -+ return; -+} -+ -+/* Return a string to fuse an addis instruction with a gpr load to the same -+ register that we loaded up the addis instruction. The code is complicated, -+ so we call output_asm_insn directly, and just return "". -+ -+ The operands are: -+ operands[0] register set with addis (must be same reg as target). -+ operands[1] value set via addis -+ operands[2] target register being loaded -+ operands[3] D-form memory reference using operands[0]. */ -+ -+const char * -+emit_fusion_gpr_load (rtx *operands) -+{ -+ rtx addis_reg = operands[0]; -+ rtx addis_value = operands[1]; -+ rtx target = operands[2]; -+ rtx mem = operands[3]; -+ rtx fuse_ops[10]; -+ rtx addr; -+ rtx load_offset; -+ const char *addis_str = NULL; -+ const char *load_str = NULL; -+ const char *extend_insn = NULL; -+ const char *mode_name = NULL; -+ char insn_template[80]; -+ enum machine_mode mode; -+ const char *comment_str = ASM_COMMENT_START; -+ bool sign_p = false; -+ -+ gcc_assert (REG_P (addis_reg) && REG_P (target)); -+ gcc_assert (REGNO (addis_reg) == REGNO (target)); -+ -+ if (*comment_str == ' ') -+ comment_str++; -+ -+ /* Allow sign/zero extension. */ -+ if (GET_CODE (mem) == ZERO_EXTEND) -+ mem = XEXP (mem, 0); -+ -+ else if (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN) -+ { -+ sign_p = true; -+ mem = XEXP (mem, 0); -+ } -+ -+ gcc_assert (MEM_P (mem)); -+ addr = XEXP (mem, 0); -+ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) -+ gcc_unreachable (); -+ -+ load_offset = XEXP (addr, 1); -+ -+ /* Now emit the load instruction to the same register. */ -+ mode = GET_MODE (mem); -+ switch (mode) -+ { -+ case QImode: -+ mode_name = "char"; -+ load_str = "lbz"; -+ extend_insn = "extsb %0,%0"; -+ break; -+ -+ case HImode: -+ mode_name = "short"; -+ load_str = "lhz"; -+ extend_insn = "extsh %0,%0"; -+ break; -+ -+ case SImode: -+ mode_name = "int"; -+ load_str = "lwz"; -+ extend_insn = "extsw %0,%0"; -+ break; -+ -+ case DImode: -+ if (TARGET_POWERPC64) -+ { -+ mode_name = "long"; -+ load_str = "ld"; -+ } -+ else -+ gcc_unreachable (); -+ break; -+ -+ default: -+ gcc_unreachable (); -+ } -+ -+ /* Emit the addis instruction. */ -+ fuse_ops[0] = target; -+ if (satisfies_constraint_L (addis_value)) -+ { -+ fuse_ops[1] = addis_value; -+ addis_str = "lis %0,%v1"; -+ } -+ -+ else if (GET_CODE (addis_value) == PLUS) -+ { -+ rtx op0 = XEXP (addis_value, 0); -+ rtx op1 = XEXP (addis_value, 1); -+ -+ if (REG_P (op0) && CONST_INT_P (op1) -+ && satisfies_constraint_L (op1)) -+ { -+ fuse_ops[1] = op0; -+ fuse_ops[2] = op1; -+ addis_str = "addis %0,%1,%v2"; -+ } -+ } -+ -+ else if (GET_CODE (addis_value) == HIGH) -+ { -+ rtx value = XEXP (addis_value, 0); -+ if (GET_CODE (value) == UNSPEC && XINT (value, 1) == UNSPEC_TOCREL) -+ { -+ fuse_ops[1] = XVECEXP (value, 0, 0); /* symbol ref. */ -+ fuse_ops[2] = XVECEXP (value, 0, 1); /* TOC register. */ -+ if (TARGET_ELF) -+ addis_str = "addis %0,%2,%1@toc@ha"; -+ -+ else if (TARGET_XCOFF) -+ addis_str = "addis %0,%1@u(%2)"; -+ -+ else -+ gcc_unreachable (); -+ } -+ -+ else if (GET_CODE (value) == PLUS) -+ { -+ rtx op0 = XEXP (value, 0); -+ rtx op1 = XEXP (value, 1); -+ -+ if (GET_CODE (op0) == UNSPEC -+ && XINT (op0, 1) == UNSPEC_TOCREL -+ && CONST_INT_P (op1)) -+ { -+ fuse_ops[1] = XVECEXP (op0, 0, 0); /* symbol ref. */ -+ fuse_ops[2] = XVECEXP (op0, 0, 1); /* TOC register. */ -+ fuse_ops[3] = op1; -+ if (TARGET_ELF) -+ addis_str = "addis %0,%2,%1+%3@toc@ha"; -+ -+ else if (TARGET_XCOFF) -+ addis_str = "addis %0,%1+%3@u(%2)"; -+ -+ else -+ gcc_unreachable (); -+ } -+ } -+ -+ else if (satisfies_constraint_L (value)) -+ { -+ fuse_ops[1] = value; -+ addis_str = "lis %0,%v1"; -+ } -+ -+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (value)) -+ { -+ fuse_ops[1] = value; -+ addis_str = "lis %0,%1@ha"; -+ } -+ } -+ -+ if (!addis_str) -+ fatal_insn ("Could not generate addis value for fusion", addis_value); -+ -+ sprintf (insn_template, "%s\t\t%s gpr load fusion, type %s", addis_str, -+ comment_str, mode_name); -+ output_asm_insn (insn_template, fuse_ops); -+ -+ /* Emit the D-form load instruction. */ -+ if (CONST_INT_P (load_offset) && satisfies_constraint_I (load_offset)) -+ { -+ sprintf (insn_template, "%s %%0,%%1(%%0)", load_str); -+ fuse_ops[1] = load_offset; -+ output_asm_insn (insn_template, fuse_ops); -+ } -+ -+ else if (GET_CODE (load_offset) == UNSPEC -+ && XINT (load_offset, 1) == UNSPEC_TOCREL) -+ { -+ if (TARGET_ELF) -+ sprintf (insn_template, "%s %%0,%%1@toc@l(%%0)", load_str); -+ -+ else if (TARGET_XCOFF) -+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str); -+ -+ else -+ gcc_unreachable (); -+ -+ fuse_ops[1] = XVECEXP (load_offset, 0, 0); -+ output_asm_insn (insn_template, fuse_ops); -+ } -+ -+ else if (GET_CODE (load_offset) == PLUS -+ && GET_CODE (XEXP (load_offset, 0)) == UNSPEC -+ && XINT (XEXP (load_offset, 0), 1) == UNSPEC_TOCREL -+ && CONST_INT_P (XEXP (load_offset, 1))) -+ { -+ rtx tocrel_unspec = XEXP (load_offset, 0); -+ if (TARGET_ELF) -+ sprintf (insn_template, "%s %%0,%%1+%%2@toc@l(%%0)", load_str); -+ -+ else if (TARGET_XCOFF) -+ sprintf (insn_template, "%s %%0,%%1+%%2@l(%%0)", load_str); -+ -+ else -+ gcc_unreachable (); -+ -+ fuse_ops[1] = XVECEXP (tocrel_unspec, 0, 0); -+ fuse_ops[2] = XEXP (load_offset, 1); -+ output_asm_insn (insn_template, fuse_ops); -+ } -+ -+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (load_offset)) -+ { -+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str); -+ -+ fuse_ops[1] = load_offset; -+ output_asm_insn (insn_template, fuse_ops); -+ } -+ -+ else -+ fatal_insn ("Unable to generate load offset for fusion", load_offset); -+ -+ /* Handle sign extension. The peephole2 pass generates this as a separate -+ insn, but we handle it just in case it got reattached. */ -+ if (sign_p) -+ { -+ gcc_assert (extend_insn != NULL); -+ output_asm_insn (extend_insn, fuse_ops); -+ } -+ -+ return ""; -+} -+ -+ - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-rs6000.h" Index: gcc/config/rs6000/vsx.md =================================================================== ---- a/src/gcc/config/rs6000/vsx.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/vsx.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/vsx.md (.../branches/gcc-4_8-branch) -@@ -34,12 +34,21 @@ - (define_mode_iterator VSX_F [V4SF V2DF]) - - ;; Iterator for logical types supported by VSX --(define_mode_iterator VSX_L [V16QI V8HI V4SI V2DI V4SF V2DF TI]) -+(define_mode_iterator VSX_L [V16QI V8HI V4SI V2DI V4SF V2DF V1TI TI]) +@@ -24,6 +24,13 @@ + ;; Iterator for the 2 64-bit vector types + (define_mode_iterator VSX_D [V2DF V2DI]) - ;; Iterator for memory move. Handle TImode specially to allow - ;; it to use gprs as well as vsx registers. --(define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF]) -+(define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF V1TI]) - -+(define_mode_iterator VSX_M2 [V16QI -+ V8HI -+ V4SI ++;; Iterator for the 2 64-bit vector types + 128-bit types that are loaded with ++;; lxvd2x to properly handle swapping words on little endian ++(define_mode_iterator VSX_LE [V2DF + V2DI -+ V4SF -+ V2DF + V1TI -+ (TI "TARGET_VSX_TIMODE")]) -+ - ;; Map into the appropriate load/store name based on the type - (define_mode_attr VSm [(V16QI "vw4") - (V8HI "vw4") -@@ -48,7 +57,8 @@ - (V2DF "vd2") - (V2DI "vd2") - (DF "d") -- (TI "vw4")]) -+ (V1TI "vd2") -+ (TI "vd2")]) - - ;; Map into the appropriate suffix based on the type - (define_mode_attr VSs [(V16QI "sp") -@@ -59,7 +69,8 @@ - (V2DI "dp") - (DF "dp") - (SF "sp") -- (TI "sp")]) -+ (V1TI "dp") -+ (TI "dp")]) - - ;; Map the register class used - (define_mode_attr VSr [(V16QI "v") -@@ -70,7 +81,8 @@ - (V2DF "wd") - (DF "ws") - (SF "d") -- (TI "wd")]) -+ (V1TI "v") -+ (TI "wt")]) - - ;; Map the register class used for float<->int conversions - (define_mode_attr VSr2 [(V2DF "wd") -@@ -115,7 +127,7 @@ - (V4SF "v") - (V2DI "v") - (V2DF "v") -- (TI "v") -+ (V1TI "v") - (DF "s")]) - - ;; Appropriate type for add ops (and other simple FP ops) -@@ -173,7 +185,8 @@ - (V2DF "vecdouble")]) - - ;; Map the scalar mode for a vector type --(define_mode_attr VS_scalar [(V2DF "DF") -+(define_mode_attr VS_scalar [(V1TI "TI") -+ (V2DF "DF") - (V2DI "DI") - (V4SF "SF") - (V4SI "SI") -@@ -184,7 +197,8 @@ - (define_mode_attr VS_double [(V4SI "V8SI") - (V4SF "V8SF") - (V2DI "V4DI") -- (V2DF "V4DF")]) -+ (V2DF "V4DF") -+ (V1TI "V2TI")]) - - ;; Constants for creating unspecs - (define_c_enum "unspec" -@@ -192,6 +206,8 @@ - UNSPEC_VSX_CVDPSXWS - UNSPEC_VSX_CVDPUXWS - UNSPEC_VSX_CVSPDP -+ UNSPEC_VSX_CVSPDPN -+ UNSPEC_VSX_CVDPSPN - UNSPEC_VSX_CVSXWDP - UNSPEC_VSX_CVUXWDP - UNSPEC_VSX_CVSXDSP -@@ -204,80 +220,397 @@ - UNSPEC_VSX_ROUND_I - UNSPEC_VSX_ROUND_IC - UNSPEC_VSX_SLDWI -+ UNSPEC_VSX_XXSPLTW - ]) - - ;; VSX moves --(define_insn "*vsx_mov<mode>" -- [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,*Y,*r,*r,<VSr>,?wa,*r,v,wZ,v") -- (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,Y,r,j,j,j,W,v,wZ"))] -- "VECTOR_MEM_VSX_P (<MODE>mode) -- && (register_operand (operands[0], <MODE>mode) -- || register_operand (operands[1], <MODE>mode))" -+ -+;; The patterns for LE permuted loads and stores come before the general -+;; VSX moves so they match first. -+(define_insn_and_split "*vsx_le_perm_load_<mode>" -+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") -+ (match_operand:VSX_D 1 "memory_operand" "Z"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ [(set (match_dup 2) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 1) (const_int 0)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 2) -+ (parallel [(const_int 1) (const_int 0)])))] -+ " - { -- switch (which_alternative) -- { -- case 0: -- case 3: -- gcc_assert (MEM_P (operands[0]) -- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY); -- return "stx<VSm>x %x1,%y0"; -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0]) -+ : operands[0]; -+} -+ " -+ [(set_attr "type" "vecload") -+ (set_attr "length" "8")]) - -- case 1: -- case 4: -- gcc_assert (MEM_P (operands[1]) -- && GET_CODE (XEXP (operands[1], 0)) != PRE_INC -- && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC -- && GET_CODE (XEXP (operands[1], 0)) != PRE_MODIFY); -- return "lx<VSm>x %x0,%y1"; -+(define_insn_and_split "*vsx_le_perm_load_<mode>" -+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") -+ (match_operand:VSX_W 1 "memory_operand" "Z"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ [(set (match_dup 2) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 2) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+ " -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0]) -+ : operands[0]; -+} -+ " -+ [(set_attr "type" "vecload") -+ (set_attr "length" "8")]) - -- case 2: -- case 5: -- return "xxlor %x0,%x1,%x1"; -+(define_insn_and_split "*vsx_le_perm_load_v8hi" -+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") -+ (match_operand:V8HI 1 "memory_operand" "Z"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ [(set (match_dup 2) -+ (vec_select:V8HI -+ (match_dup 1) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)]))) -+ (set (match_dup 0) -+ (vec_select:V8HI -+ (match_dup 2) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+ " -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0]) -+ : operands[0]; -+} -+ " -+ [(set_attr "type" "vecload") -+ (set_attr "length" "8")]) - -- case 6: -- case 7: -- case 8: -- case 11: -- return "#"; -+(define_insn_and_split "*vsx_le_perm_load_v16qi" -+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa") -+ (match_operand:V16QI 1 "memory_operand" "Z"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ [(set (match_dup 2) -+ (vec_select:V16QI -+ (match_dup 1) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)]))) -+ (set (match_dup 0) -+ (vec_select:V16QI -+ (match_dup 2) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+ " -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0]) -+ : operands[0]; -+} -+ " -+ [(set_attr "type" "vecload") -+ (set_attr "length" "8")]) - -- case 9: -- case 10: -- return "xxlxor %x0,%x0,%x0"; -+(define_insn "*vsx_le_perm_store_<mode>" -+ [(set (match_operand:VSX_D 0 "memory_operand" "=Z") -+ (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ [(set_attr "type" "vecstore") -+ (set_attr "length" "12")]) - -- case 12: -- return output_vec_const_move (operands); -+(define_split -+ [(set (match_operand:VSX_D 0 "memory_operand" "") -+ (match_operand:VSX_D 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" -+ [(set (match_dup 2) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 1) (const_int 0)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 2) -+ (parallel [(const_int 1) (const_int 0)])))] -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) -+ : operands[1]; -+}) - -- case 13: -- gcc_assert (MEM_P (operands[0]) -- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY); -- return "stvx %1,%y0"; -+;; The post-reload split requires that we re-permute the source -+;; register in case it is still live. -+(define_split -+ [(set (match_operand:VSX_D 0 "memory_operand" "") -+ (match_operand:VSX_D 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" -+ [(set (match_dup 1) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 1) (const_int 0)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 1) (const_int 0)]))) -+ (set (match_dup 1) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 1) (const_int 0)])))] -+ "") - -- case 14: -- gcc_assert (MEM_P (operands[0]) -- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC -- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY); -- return "lvx %0,%y1"; -+(define_insn "*vsx_le_perm_store_<mode>" -+ [(set (match_operand:VSX_W 0 "memory_operand" "=Z") -+ (match_operand:VSX_W 1 "vsx_register_operand" "+wa"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ [(set_attr "type" "vecstore") -+ (set_attr "length" "12")]) - -- default: -- gcc_unreachable (); -- } -+(define_split -+ [(set (match_operand:VSX_W 0 "memory_operand" "") -+ (match_operand:VSX_W 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" -+ [(set (match_dup 2) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 2) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) -+ : operands[1]; -+}) -+ -+;; The post-reload split requires that we re-permute the source -+;; register in case it is still live. -+(define_split -+ [(set (match_operand:VSX_W 0 "memory_operand" "") -+ (match_operand:VSX_W 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" -+ [(set (match_dup 1) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)]))) -+ (set (match_dup 0) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)]))) -+ (set (match_dup 1) -+ (vec_select:<MODE> -+ (match_dup 1) -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+ "") -+ -+(define_insn "*vsx_le_perm_store_v8hi" -+ [(set (match_operand:V8HI 0 "memory_operand" "=Z") -+ (match_operand:V8HI 1 "vsx_register_operand" "+wa"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ [(set_attr "type" "vecstore") -+ (set_attr "length" "12")]) -+ -+(define_split -+ [(set (match_operand:V8HI 0 "memory_operand" "") -+ (match_operand:V8HI 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" -+ [(set (match_dup 2) -+ (vec_select:V8HI -+ (match_dup 1) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)]))) -+ (set (match_dup 0) -+ (vec_select:V8HI -+ (match_dup 2) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) -+ : operands[1]; -+}) -+ -+;; The post-reload split requires that we re-permute the source -+;; register in case it is still live. -+(define_split -+ [(set (match_operand:V8HI 0 "memory_operand" "") -+ (match_operand:V8HI 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" -+ [(set (match_dup 1) -+ (vec_select:V8HI -+ (match_dup 1) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)]))) -+ (set (match_dup 0) -+ (vec_select:V8HI -+ (match_dup 1) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)]))) -+ (set (match_dup 1) -+ (vec_select:V8HI -+ (match_dup 1) -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+ "") -+ -+(define_insn "*vsx_le_perm_store_v16qi" -+ [(set (match_operand:V16QI 0 "memory_operand" "=Z") -+ (match_operand:V16QI 1 "vsx_register_operand" "+wa"))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX" -+ "#" -+ [(set_attr "type" "vecstore") -+ (set_attr "length" "12")]) -+ -+(define_split -+ [(set (match_operand:V16QI 0 "memory_operand" "") -+ (match_operand:V16QI 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" -+ [(set (match_dup 2) -+ (vec_select:V16QI -+ (match_dup 1) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)]))) -+ (set (match_dup 0) -+ (vec_select:V16QI -+ (match_dup 2) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+{ -+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) -+ : operands[1]; -+}) -+ -+;; The post-reload split requires that we re-permute the source -+;; register in case it is still live. -+(define_split -+ [(set (match_operand:V16QI 0 "memory_operand" "") -+ (match_operand:V16QI 1 "vsx_register_operand" ""))] -+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" -+ [(set (match_dup 1) -+ (vec_select:V16QI -+ (match_dup 1) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)]))) -+ (set (match_dup 0) -+ (vec_select:V16QI -+ (match_dup 1) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)]))) -+ (set (match_dup 1) -+ (vec_select:V16QI -+ (match_dup 1) -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+ "") -+ -+ -+(define_insn "*vsx_mov<mode>" -+ [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,wQ,?&r,??Y,??r,??r,<VSr>,?wa,*r,v,wZ, v") -+ (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,wQ,r,Y,r,j,j,j,W,v,wZ"))] -+ "VECTOR_MEM_VSX_P (<MODE>mode) -+ && (register_operand (operands[0], <MODE>mode) -+ || register_operand (operands[1], <MODE>mode))" -+{ -+ return rs6000_output_move_128bit (operands); - } -- [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,*,*,*,vecsimple,vecsimple,*,*,vecstore,vecload")]) -+ [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,load,store,store,load, *,vecsimple,vecsimple,*, *,vecstore,vecload") -+ (set_attr "length" "4,4,4,4,4,4,12,12,12,12,16,4,4,*,16,4,4")]) - --;; Unlike other VSX moves, allow the GPRs, since a normal use of TImode is for --;; unions. However for plain data movement, slightly favor the vector loads --(define_insn "*vsx_movti" -- [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,?Y,?r,?r,wa,v,v,wZ") -- (match_operand:TI 1 "input_operand" "wa,Z,wa,r,Y,r,j,W,wZ,v"))] -- "VECTOR_MEM_VSX_P (TImode) -+;; Unlike other VSX moves, allow the GPRs even for reloading, since a normal -+;; use of TImode is for unions. However for plain data movement, slightly -+;; favor the vector loads -+(define_insn "*vsx_movti_64bit" -+ [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v,v,wZ,wQ,&r,Y,r,r,?r") -+ (match_operand:TI 1 "input_operand" "wa,Z,wa,O,W,wZ,v,r,wQ,r,Y,r,n"))] -+ "TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode) - && (register_operand (operands[0], TImode) - || register_operand (operands[1], TImode))" - { -+ return rs6000_output_move_128bit (operands); -+} -+ [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store,load,store,load,*,*") -+ (set_attr "length" "4,4,4,4,16,4,4,8,8,8,8,8,8")]) -+ -+(define_insn "*vsx_movti_32bit" -+ [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v, v,wZ,Q,Y,????r,????r,????r,r") -+ (match_operand:TI 1 "input_operand" "wa, Z,wa, O,W,wZ, v,r,r, Q, Y, r,n"))] -+ "! TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode) -+ && (register_operand (operands[0], TImode) -+ || register_operand (operands[1], TImode))" -+{ - switch (which_alternative) - { - case 0: -@@ -290,27 +623,45 @@ - return "xxlor %x0,%x1,%x1"; - - case 3: -+ return "xxlxor %x0,%x0,%x0"; -+ - case 4: -+ return output_vec_const_move (operands); -+ - case 5: -- return "#"; -+ return "stvx %1,%y0"; - - case 6: -- return "xxlxor %x0,%x0,%x0"; -+ return "lvx %0,%y1"; - - case 7: -- return output_vec_const_move (operands); -+ if (TARGET_STRING) -+ return \"stswi %1,%P0,16\"; - - case 8: -- return "stvx %1,%y0"; -+ return \"#\"; - - case 9: -- return "lvx %0,%y1"; -+ /* If the address is not used in the output, we can use lsi. Otherwise, -+ fall through to generating four loads. */ -+ if (TARGET_STRING -+ && ! reg_overlap_mentioned_p (operands[0], operands[1])) -+ return \"lswi %0,%P1,16\"; -+ /* ... fall through ... */ - -+ case 10: -+ case 11: -+ case 12: -+ return \"#\"; - default: - gcc_unreachable (); - } - } -- [(set_attr "type" "vecstore,vecload,vecsimple,*,*,*,vecsimple,*,vecstore,vecload")]) -+ [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store_ux,store_ux,load_ux,load_ux, *, *") -+ (set_attr "length" " 4, 4, 4, 4, 8, 4, 4, 16, 16, 16, 16,16,16") -+ (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING") -+ (const_string "always") -+ (const_string "conditional")))]) - - ;; Explicit load/store expanders for the builtin functions - (define_expand "vsx_load_<mode>" -@@ -320,46 +671,48 @@ - "") - - (define_expand "vsx_store_<mode>" -- [(set (match_operand:VEC_M 0 "memory_operand" "") -- (match_operand:VEC_M 1 "vsx_register_operand" ""))] -+ [(set (match_operand:VSX_M 0 "memory_operand" "") -+ (match_operand:VSX_M 1 "vsx_register_operand" ""))] - "VECTOR_MEM_VSX_P (<MODE>mode)" - "") - - --;; VSX scalar and vector floating point arithmetic instructions -+;; VSX vector floating point arithmetic instructions. The VSX scalar -+;; instructions are now combined with the insn for the traditional floating -+;; point unit. - (define_insn "*vsx_add<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (plus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>add<VSs> %x0,%x1,%x2" -+ "xvadd<VSs> %x0,%x1,%x2" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "*vsx_sub<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (minus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>sub<VSs> %x0,%x1,%x2" -+ "xvsub<VSs> %x0,%x1,%x2" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "*vsx_mul<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (mult:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>mul<VSs> %x0,%x1,%x2" -- [(set_attr "type" "<VStype_mul>") -+ "xvmul<VSs> %x0,%x1,%x2" -+ [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_mul>")]) - - (define_insn "*vsx_div<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (div:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>div<VSs> %x0,%x1,%x2" -+ "xvdiv<VSs> %x0,%x1,%x2" - [(set_attr "type" "<VStype_div>") - (set_attr "fp_type" "<VSfptype_div>")]) - -@@ -402,94 +755,72 @@ - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_fre<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")] - UNSPEC_FRES))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>re<VSs> %x0,%x1" -+ "xvre<VSs> %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "*vsx_neg<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (neg:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>neg<VSs> %x0,%x1" -+ "xvneg<VSs> %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "*vsx_abs<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>abs<VSs> %x0,%x1" -+ "xvabs<VSs> %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_nabs<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (neg:VSX_B -- (abs:VSX_B -- (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (neg:VSX_F -+ (abs:VSX_F -+ (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa"))))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>nabs<VSs> %x0,%x1" -+ "xvnabs<VSs> %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_smax<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (smax:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>max<VSs> %x0,%x1,%x2" -+ "xvmax<VSs> %x0,%x1,%x2" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "*vsx_smin<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (smin:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>min<VSs> %x0,%x1,%x2" -+ "xvmin<VSs> %x0,%x1,%x2" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - --;; Special VSX version of smin/smax for single precision floating point. Since --;; both numbers are rounded to single precision, we can just use the DP version --;; of the instruction. -- --(define_insn "*vsx_smaxsf3" -- [(set (match_operand:SF 0 "vsx_register_operand" "=f") -- (smax:SF (match_operand:SF 1 "vsx_register_operand" "f") -- (match_operand:SF 2 "vsx_register_operand" "f")))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "xsmaxdp %x0,%x1,%x2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_d")]) -- --(define_insn "*vsx_sminsf3" -- [(set (match_operand:SF 0 "vsx_register_operand" "=f") -- (smin:SF (match_operand:SF 1 "vsx_register_operand" "f") -- (match_operand:SF 2 "vsx_register_operand" "f")))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "xsmindp %x0,%x1,%x2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_d")]) -- - (define_insn "*vsx_sqrt<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (sqrt:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>sqrt<VSs> %x0,%x1" -+ "xvsqrt<VSs> %x0,%x1" - [(set_attr "type" "<VStype_sqrt>") - (set_attr "fp_type" "<VSfptype_sqrt>")]) - - (define_insn "*vsx_rsqrte<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")] - UNSPEC_RSQRT))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>rsqrte<VSs> %x0,%x1" -+ "xvrsqrte<VSs> %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - -@@ -528,27 +859,11 @@ - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - --;; Fused vector multiply/add instructions Support the classical DF versions of --;; fma, which allows the target to be a separate register from the 3 inputs. --;; Under VSX, the target must be either the addend or the first multiply. --;; Where we can, also do the same for the Altivec V4SF fmas. -+;; Fused vector multiply/add instructions. Support the classical Altivec -+;; versions of fma, which allows the target to be a separate register from the -+;; 3 inputs. Under VSX, the target must be either the addend or the first -+;; multiply. - --(define_insn "*vsx_fmadf4" -- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") -- (fma:DF -- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") -- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") -- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "@ -- xsmaddadp %x0,%x1,%x2 -- xsmaddmdp %x0,%x1,%x3 -- xsmaddadp %x0,%x1,%x2 -- xsmaddmdp %x0,%x1,%x3 -- fmadd %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- - (define_insn "*vsx_fmav4sf4" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v") - (fma:V4SF -@@ -578,23 +893,6 @@ - xvmaddmdp %x0,%x1,%x3" - [(set_attr "type" "vecdouble")]) - --(define_insn "*vsx_fmsdf4" -- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") -- (fma:DF -- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") -- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") -- (neg:DF -- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "@ -- xsmsubadp %x0,%x1,%x2 -- xsmsubmdp %x0,%x1,%x3 -- xsmsubadp %x0,%x1,%x2 -- xsmsubmdp %x0,%x1,%x3 -- fmsub %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- - (define_insn "*vsx_fms<mode>4" - [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa") - (fma:VSX_F -@@ -604,29 +902,12 @@ - (match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" - "@ -- x<VSv>msuba<VSs> %x0,%x1,%x2 -- x<VSv>msubm<VSs> %x0,%x1,%x3 -- x<VSv>msuba<VSs> %x0,%x1,%x2 -- x<VSv>msubm<VSs> %x0,%x1,%x3" -+ xvmsuba<VSs> %x0,%x1,%x2 -+ xvmsubm<VSs> %x0,%x1,%x3 -+ xvmsuba<VSs> %x0,%x1,%x2 -+ xvmsubm<VSs> %x0,%x1,%x3" - [(set_attr "type" "<VStype_mul>")]) - --(define_insn "*vsx_nfmadf4" -- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") -- (neg:DF -- (fma:DF -- (match_operand:DF 1 "vsx_register_operand" "ws,ws,wa,wa,d") -- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") -- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "@ -- xsnmaddadp %x0,%x1,%x2 -- xsnmaddmdp %x0,%x1,%x3 -- xsnmaddadp %x0,%x1,%x2 -- xsnmaddmdp %x0,%x1,%x3 -- fnmadd %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- - (define_insn "*vsx_nfma<mode>4" - [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa") - (neg:VSX_F -@@ -636,31 +917,13 @@ - (match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" - "@ -- x<VSv>nmadda<VSs> %x0,%x1,%x2 -- x<VSv>nmaddm<VSs> %x0,%x1,%x3 -- x<VSv>nmadda<VSs> %x0,%x1,%x2 -- x<VSv>nmaddm<VSs> %x0,%x1,%x3" -+ xvnmadda<VSs> %x0,%x1,%x2 -+ xvnmaddm<VSs> %x0,%x1,%x3 -+ xvnmadda<VSs> %x0,%x1,%x2 -+ xvnmaddm<VSs> %x0,%x1,%x3" - [(set_attr "type" "<VStype_mul>") - (set_attr "fp_type" "<VSfptype_mul>")]) - --(define_insn "*vsx_nfmsdf4" -- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") -- (neg:DF -- (fma:DF -- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") -- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") -- (neg:DF -- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))))] -- "VECTOR_UNIT_VSX_P (DFmode)" -- "@ -- xsnmsubadp %x0,%x1,%x2 -- xsnmsubmdp %x0,%x1,%x3 -- xsnmsubadp %x0,%x1,%x2 -- xsnmsubmdp %x0,%x1,%x3 -- fnmsub %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- - (define_insn "*vsx_nfmsv4sf4" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v") - (neg:V4SF -@@ -722,16 +985,6 @@ - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - --;; Floating point scalar compare --(define_insn "*vsx_cmpdf_internal1" -- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,?y") -- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "ws,wa") -- (match_operand:DF 2 "gpc_reg_operand" "ws,wa")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && VECTOR_UNIT_VSX_P (DFmode)" -- "xscmpudp %0,%x1,%x2" -- [(set_attr "type" "fpcompare")]) -- - ;; Compare vectors producing a vector result and a predicate, setting CR6 to - ;; indicate a combined status - (define_insn "*vsx_eq_<mode>_p" -@@ -798,13 +1051,13 @@ - - ;; Copy sign - (define_insn "vsx_copysign<mode>3" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (unspec:VSX_B -- [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa") -- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (unspec:VSX_F -+ [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa") -+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")] - UNSPEC_COPYSIGN))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>cpsgn<VSs> %x0,%x2,%x1" -+ "xvcpsgn<VSs> %x0,%x2,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - -@@ -865,10 +1118,10 @@ - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_btrunc<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (fix:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>r<VSs>iz %x0,%x1" -+ "xvr<VSs>iz %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - -@@ -882,20 +1135,20 @@ - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_floor<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")] - UNSPEC_FRIM))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>r<VSs>im %x0,%x1" -+ "xvr<VSs>im %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - - (define_insn "vsx_ceil<mode>2" -- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa") -- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")] -+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa") -+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")] - UNSPEC_FRIP))] - "VECTOR_UNIT_VSX_P (<MODE>mode)" -- "x<VSv>r<VSs>ip %x0,%x1" -+ "xvr<VSs>ip %x0,%x1" - [(set_attr "type" "<VStype_simple>") - (set_attr "fp_type" "<VSfptype_simple>")]) - -@@ -942,6 +1195,40 @@ - "xscvspdp %x0,%x1" - [(set_attr "type" "fp")]) - -+;; ISA 2.07 xscvdpspn/xscvspdpn that does not raise an error on signalling NaNs -+(define_insn "vsx_xscvdpspn" -+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,?wa") -+ (unspec:V4SF [(match_operand:DF 1 "vsx_register_operand" "wd,wa")] -+ UNSPEC_VSX_CVDPSPN))] -+ "TARGET_XSCVDPSPN" -+ "xscvdpspn %x0,%x1" -+ [(set_attr "type" "fp")]) -+ -+(define_insn "vsx_xscvspdpn" -+ [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa") -+ (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")] -+ UNSPEC_VSX_CVSPDPN))] -+ "TARGET_XSCVSPDPN" -+ "xscvspdpn %x0,%x1" -+ [(set_attr "type" "fp")]) -+ -+(define_insn "vsx_xscvdpspn_scalar" -+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") -+ (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")] -+ UNSPEC_VSX_CVDPSPN))] -+ "TARGET_XSCVDPSPN" -+ "xscvdpspn %x0,%x1" -+ [(set_attr "type" "fp")]) -+ -+;; Used by direct move to move a SFmode value from GPR to VSX register -+(define_insn "vsx_xscvspdpn_directmove" -+ [(set (match_operand:SF 0 "vsx_register_operand" "=wa") -+ (unspec:SF [(match_operand:SF 1 "vsx_register_operand" "wa")] -+ UNSPEC_VSX_CVSPDPN))] -+ "TARGET_XSCVSPDPN" -+ "xscvspdpn %x0,%x1" -+ [(set_attr "type" "fp")]) -+ - ;; Convert from 64-bit to 32-bit types - ;; Note, favor the Altivec registers since the usual use of these instructions - ;; is in vector converts and we need to use the Altivec vperm instruction. -@@ -1027,73 +1314,21 @@ - (set_attr "fp_type" "<VSfptype_simple>")]) - - --;; Logical and permute operations --(define_insn "*vsx_and<mode>3" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (and:VSX_L -- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa") -- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxland %x0,%x1,%x2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*vsx_ior<mode>3" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (ior:VSX_L (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa") -- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxlor %x0,%x1,%x2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*vsx_xor<mode>3" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (xor:VSX_L -- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa") -- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxlxor %x0,%x1,%x2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*vsx_one_cmpl<mode>2" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (not:VSX_L -- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxlnor %x0,%x1,%x1" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*vsx_nor<mode>3" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (not:VSX_L -- (ior:VSX_L -- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa") -- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxlnor %x0,%x1,%x2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*vsx_andc<mode>3" -- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa") -- (and:VSX_L -- (not:VSX_L -- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")) -- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))] -- "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxlandc %x0,%x1,%x2" -- [(set_attr "type" "vecsimple")]) -- -- - ;; Permute operations - - ;; Build a V2DF/V2DI vector from two scalars - (define_insn "vsx_concat_<mode>" -- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa") -- (unspec:VSX_D -- [(match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa") -- (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")] -- UNSPEC_VSX_CONCAT))] -+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=<VSr>,?wa") -+ (vec_concat:VSX_D -+ (match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa") -+ (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")))] - "VECTOR_MEM_VSX_P (<MODE>mode)" -- "xxpermdi %x0,%x1,%x2,0" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "xxpermdi %x0,%x1,%x2,0"; -+ else -+ return "xxpermdi %x0,%x2,%x1,0"; -+} - [(set_attr "type" "vecperm")]) - - ;; Special purpose concat using xxpermdi to glue two single precision values -@@ -1106,9 +1341,176 @@ - (match_operand:SF 2 "vsx_register_operand" "f,f")] - UNSPEC_VSX_CONCAT))] - "VECTOR_MEM_VSX_P (V2DFmode)" -- "xxpermdi %x0,%x1,%x2,0" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "xxpermdi %x0,%x1,%x2,0"; -+ else -+ return "xxpermdi %x0,%x2,%x1,0"; -+} - [(set_attr "type" "vecperm")]) - -+;; xxpermdi for little endian loads and stores. We need several of -+;; these since the form of the PARALLEL differs by mode. -+(define_insn "*vsx_xxpermdi2_le_<mode>" -+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") -+ (vec_select:VSX_D -+ (match_operand:VSX_D 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 1) (const_int 0)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "xxpermdi %x0,%x1,%x1,2" -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "*vsx_xxpermdi4_le_<mode>" -+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") -+ (vec_select:VSX_W -+ (match_operand:VSX_W 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "xxpermdi %x0,%x1,%x1,2" -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "*vsx_xxpermdi8_le_V8HI" -+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") -+ (vec_select:V8HI -+ (match_operand:V8HI 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)" -+ "xxpermdi %x0,%x1,%x1,2" -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "*vsx_xxpermdi16_le_V16QI" -+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa") -+ (vec_select:V16QI -+ (match_operand:V16QI 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)" -+ "xxpermdi %x0,%x1,%x1,2" -+ [(set_attr "type" "vecperm")]) -+ -+;; lxvd2x for little endian loads. We need several of -+;; these since the form of the PARALLEL differs by mode. -+(define_insn "*vsx_lxvd2x2_le_<mode>" -+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") -+ (vec_select:VSX_D -+ (match_operand:VSX_D 1 "memory_operand" "Z") -+ (parallel [(const_int 1) (const_int 0)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "lxvd2x %x0,%y1" -+ [(set_attr "type" "vecload")]) -+ -+(define_insn "*vsx_lxvd2x4_le_<mode>" -+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") -+ (vec_select:VSX_W -+ (match_operand:VSX_W 1 "memory_operand" "Z") -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "lxvd2x %x0,%y1" -+ [(set_attr "type" "vecload")]) -+ -+(define_insn "*vsx_lxvd2x8_le_V8HI" -+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") -+ (vec_select:V8HI -+ (match_operand:V8HI 1 "memory_operand" "Z") -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)" -+ "lxvd2x %x0,%y1" -+ [(set_attr "type" "vecload")]) -+ -+(define_insn "*vsx_lxvd2x16_le_V16QI" -+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa") -+ (vec_select:V16QI -+ (match_operand:V16QI 1 "memory_operand" "Z") -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)" -+ "lxvd2x %x0,%y1" -+ [(set_attr "type" "vecload")]) -+ -+;; stxvd2x for little endian stores. We need several of -+;; these since the form of the PARALLEL differs by mode. -+(define_insn "*vsx_stxvd2x2_le_<mode>" -+ [(set (match_operand:VSX_D 0 "memory_operand" "=Z") -+ (vec_select:VSX_D -+ (match_operand:VSX_D 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 1) (const_int 0)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "stxvd2x %x1,%y0" -+ [(set_attr "type" "vecstore")]) -+ -+(define_insn "*vsx_stxvd2x4_le_<mode>" -+ [(set (match_operand:VSX_W 0 "memory_operand" "=Z") -+ (vec_select:VSX_W -+ (match_operand:VSX_W 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 2) (const_int 3) -+ (const_int 0) (const_int 1)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" -+ "stxvd2x %x1,%y0" -+ [(set_attr "type" "vecstore")]) -+ -+(define_insn "*vsx_stxvd2x8_le_V8HI" -+ [(set (match_operand:V8HI 0 "memory_operand" "=Z") -+ (vec_select:V8HI -+ (match_operand:V8HI 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 4) (const_int 5) -+ (const_int 6) (const_int 7) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)" -+ "stxvd2x %x1,%y0" -+ [(set_attr "type" "vecstore")]) -+ -+(define_insn "*vsx_stxvd2x16_le_V16QI" -+ [(set (match_operand:V16QI 0 "memory_operand" "=Z") -+ (vec_select:V16QI -+ (match_operand:V16QI 1 "vsx_register_operand" "wa") -+ (parallel [(const_int 8) (const_int 9) -+ (const_int 10) (const_int 11) -+ (const_int 12) (const_int 13) -+ (const_int 14) (const_int 15) -+ (const_int 0) (const_int 1) -+ (const_int 2) (const_int 3) -+ (const_int 4) (const_int 5) -+ (const_int 6) (const_int 7)])))] -+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)" -+ "stxvd2x %x1,%y0" -+ [(set_attr "type" "vecstore")]) -+ -+;; Convert a TImode value into V1TImode -+(define_expand "vsx_set_v1ti" -+ [(match_operand:V1TI 0 "nonimmediate_operand" "") -+ (match_operand:V1TI 1 "nonimmediate_operand" "") -+ (match_operand:TI 2 "input_operand" "") -+ (match_operand:QI 3 "u5bit_cint_operand" "")] -+ "VECTOR_MEM_VSX_P (V1TImode)" -+{ -+ if (operands[3] != const0_rtx) -+ gcc_unreachable (); -+ -+ emit_move_insn (operands[0], gen_lowpart (V1TImode, operands[1])); -+ DONE; -+}) -+ - ;; Set the element of a V2DI/VD2F mode - (define_insn "vsx_set_<mode>" - [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa") -@@ -1118,9 +1520,10 @@ - UNSPEC_VSX_SET))] - "VECTOR_MEM_VSX_P (<MODE>mode)" - { -- if (INTVAL (operands[3]) == 0) -+ int idx_first = BYTES_BIG_ENDIAN ? 0 : 1; -+ if (INTVAL (operands[3]) == idx_first) - return \"xxpermdi %x0,%x2,%x1,1\"; -- else if (INTVAL (operands[3]) == 1) -+ else if (INTVAL (operands[3]) == 1 - idx_first) - return \"xxpermdi %x0,%x1,%x2,0\"; - else - gcc_unreachable (); -@@ -1135,8 +1538,12 @@ - [(match_operand:QI 2 "u5bit_cint_operand" "i,i,i")])))] - "VECTOR_MEM_VSX_P (<MODE>mode)" - { -+ int fldDM; - gcc_assert (UINTVAL (operands[2]) <= 1); -- operands[3] = GEN_INT (INTVAL (operands[2]) << 1); -+ fldDM = INTVAL (operands[2]) << 1; -+ if (!BYTES_BIG_ENDIAN) -+ fldDM = 3 - fldDM; -+ operands[3] = GEN_INT (fldDM); - return \"xxpermdi %x0,%x1,%x1,%3\"; - } - [(set_attr "type" "vecperm")]) -@@ -1149,9 +1556,28 @@ - (parallel [(const_int 0)])))] - "VECTOR_MEM_VSX_P (<MODE>mode) && WORDS_BIG_ENDIAN" - "lxsd%U1x %x0,%y1" -- [(set_attr "type" "fpload") -+ [(set (attr "type") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (const_string "fpload"))) - (set_attr "length" "4")]) - -+;; Optimize extracting element 1 from memory for little endian -+(define_insn "*vsx_extract_<mode>_one_le" -+ [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa") -+ (vec_select:<VS_scalar> -+ (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z") -+ (parallel [(const_int 1)])))] -+ "VECTOR_MEM_VSX_P (<MODE>mode) && !WORDS_BIG_ENDIAN" -+ "lxsd%U1x %x0,%y1" -+ [(set (attr "type") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (const_string "fpload"))) -+ (set_attr "length" "4")]) -+ - ;; Extract a SF element from V4SF - (define_insn_and_split "vsx_extract_v4sf" - [(set (match_operand:SF 0 "vsx_register_operand" "=f,f") -@@ -1172,7 +1598,7 @@ - rtx op2 = operands[2]; - rtx op3 = operands[3]; - rtx tmp; -- HOST_WIDE_INT ele = INTVAL (op2); -+ HOST_WIDE_INT ele = BYTES_BIG_ENDIAN ? INTVAL (op2) : 3 - INTVAL (op2); - - if (ele == 0) - tmp = op1; -@@ -1213,11 +1639,22 @@ - if (<MODE>mode != V2DImode) - { - target = gen_lowpart (V2DImode, target); -- op0 = gen_lowpart (V2DImode, target); -- op1 = gen_lowpart (V2DImode, target); -+ op0 = gen_lowpart (V2DImode, op0); -+ op1 = gen_lowpart (V2DImode, op1); - } - } -- emit_insn (gen (target, op0, op1, perm0, perm1)); -+ /* In little endian mode, vsx_xxpermdi2_<mode>_1 will perform a -+ transformation we don't want; it is necessary for -+ rs6000_expand_vec_perm_const_1 but not for this use. So we -+ prepare for that by reversing the transformation here. */ -+ if (BYTES_BIG_ENDIAN) -+ emit_insn (gen (target, op0, op1, perm0, perm1)); -+ else -+ { -+ rtx p0 = GEN_INT (3 - INTVAL (perm1)); -+ rtx p1 = GEN_INT (3 - INTVAL (perm0)); -+ emit_insn (gen (target, op1, op0, p0, p1)); -+ } - DONE; - }) - -@@ -1231,9 +1668,32 @@ - (match_operand 4 "const_2_to_3_operand" "")])))] - "VECTOR_MEM_VSX_P (<MODE>mode)" - { -- int mask = (INTVAL (operands[3]) << 1) | (INTVAL (operands[4]) - 2); -+ int op3, op4, mask; -+ -+ /* For little endian, swap operands and invert/swap selectors -+ to get the correct xxpermdi. The operand swap sets up the -+ inputs as a little endian array. The selectors are swapped -+ because they are defined to use big endian ordering. The -+ selectors are inverted to get the correct doublewords for -+ little endian ordering. */ -+ if (BYTES_BIG_ENDIAN) -+ { -+ op3 = INTVAL (operands[3]); -+ op4 = INTVAL (operands[4]); -+ } -+ else -+ { -+ op3 = 3 - INTVAL (operands[4]); -+ op4 = 3 - INTVAL (operands[3]); -+ } -+ -+ mask = (op3 << 1) | (op4 - 2); - operands[3] = GEN_INT (mask); -- return "xxpermdi %x0,%x1,%x2,%3"; -+ -+ if (BYTES_BIG_ENDIAN) -+ return "xxpermdi %x0,%x1,%x2,%3"; -+ else -+ return "xxpermdi %x0,%x2,%x1,%3"; - } - [(set_attr "type" "vecperm")]) - -@@ -1252,25 +1712,57 @@ - - ;; Expanders for builtins - (define_expand "vsx_mergel_<mode>" -- [(set (match_operand:VSX_D 0 "vsx_register_operand" "") -- (vec_select:VSX_D -- (vec_concat:<VS_double> -- (match_operand:VSX_D 1 "vsx_register_operand" "") -- (match_operand:VSX_D 2 "vsx_register_operand" "")) -- (parallel [(const_int 1) (const_int 3)])))] -+ [(use (match_operand:VSX_D 0 "vsx_register_operand" "")) -+ (use (match_operand:VSX_D 1 "vsx_register_operand" "")) -+ (use (match_operand:VSX_D 2 "vsx_register_operand" ""))] - "VECTOR_MEM_VSX_P (<MODE>mode)" -- "") -+{ -+ rtvec v; -+ rtx x; - -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (2, GEN_INT (0), GEN_INT (2)); -+ x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (2, GEN_INT (1), GEN_INT (3)); -+ x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (<MODE>mode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ - (define_expand "vsx_mergeh_<mode>" -- [(set (match_operand:VSX_D 0 "vsx_register_operand" "") -- (vec_select:VSX_D -- (vec_concat:<VS_double> -- (match_operand:VSX_D 1 "vsx_register_operand" "") -- (match_operand:VSX_D 2 "vsx_register_operand" "")) -- (parallel [(const_int 0) (const_int 2)])))] -+ [(use (match_operand:VSX_D 0 "vsx_register_operand" "")) -+ (use (match_operand:VSX_D 1 "vsx_register_operand" "")) -+ (use (match_operand:VSX_D 2 "vsx_register_operand" ""))] - "VECTOR_MEM_VSX_P (<MODE>mode)" -- "") -+{ -+ rtvec v; -+ rtx x; ++ (TI "VECTOR_MEM_VSX_P (TImode)")]) ++ + ;; Iterator for the 2 32-bit vector types + (define_mode_iterator VSX_W [V4SF V4SI]) + +@@ -228,8 +235,8 @@ + ;; The patterns for LE permuted loads and stores come before the general + ;; VSX moves so they match first. + (define_insn_and_split "*vsx_le_perm_load_<mode>" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (match_operand:VSX_D 1 "memory_operand" "Z"))] ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") ++ (match_operand:VSX_LE 1 "memory_operand" "Z"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" + "!BYTES_BIG_ENDIAN && TARGET_VSX" +@@ -342,8 +349,8 @@ + (set_attr "length" "8")]) -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (2, GEN_INT (1), GEN_INT (3)); -+ x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (2, GEN_INT (0), GEN_INT (2)); -+ x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (<MODE>mode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ - ;; V2DF/V2DI splat - (define_insn "vsx_splat_<mode>" - [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,wd,wd,?wa,?wa,?wa") -@@ -1295,6 +1787,20 @@ - (parallel - [(match_operand:QI 2 "u5bit_cint_operand" "i,i")]))))] - "VECTOR_MEM_VSX_P (<MODE>mode)" -+{ -+ if (!BYTES_BIG_ENDIAN) -+ operands[2] = GEN_INT (3 - INTVAL (operands[2])); -+ -+ return "xxspltw %x0,%x1,%2"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "vsx_xxspltw_<mode>_direct" -+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa") -+ (unspec:VSX_W [(match_operand:VSX_W 1 "vsx_register_operand" "wf,wa") -+ (match_operand:QI 2 "u5bit_cint_operand" "i,i")] -+ UNSPEC_VSX_XXSPLTW))] -+ "VECTOR_MEM_VSX_P (<MODE>mode)" - "xxspltw %x0,%x1,%2" - [(set_attr "type" "vecperm")]) + (define_insn "*vsx_le_perm_store_<mode>" +- [(set (match_operand:VSX_D 0 "memory_operand" "=Z") +- (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") ++ (match_operand:VSX_LE 1 "vsx_register_operand" "+wa"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" + [(set_attr "type" "vecstore") +@@ -350,8 +357,8 @@ + (set_attr "length" "12")]) -@@ -1483,3 +1989,27 @@ - }" - [(set_attr "length" "20") - (set_attr "type" "veccomplex")]) -+ -+ -+;; Power8 Vector fusion. The fused ops must be physically adjacent. -+(define_peephole -+ [(set (match_operand:P 0 "base_reg_operand" "") -+ (match_operand:P 1 "short_cint_operand" "")) -+ (set (match_operand:VSX_M2 2 "vsx_register_operand" "") -+ (mem:VSX_M2 (plus:P (match_dup 0) -+ (match_operand:P 3 "int_reg_operand" ""))))] -+ "TARGET_VSX && TARGET_P8_FUSION" -+ "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3" -+ [(set_attr "length" "8") -+ (set_attr "type" "vecload")]) -+ -+(define_peephole -+ [(set (match_operand:P 0 "base_reg_operand" "") -+ (match_operand:P 1 "short_cint_operand" "")) -+ (set (match_operand:VSX_M2 2 "vsx_register_operand" "") -+ (mem:VSX_M2 (plus:P (match_operand:P 3 "int_reg_operand" "") -+ (match_dup 0))))] -+ "TARGET_VSX && TARGET_P8_FUSION" -+ "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3" -+ [(set_attr "length" "8") -+ (set_attr "type" "vecload")]) + (define_split +- [(set (match_operand:VSX_D 0 "memory_operand" "") +- (match_operand:VSX_D 1 "vsx_register_operand" ""))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "") ++ (match_operand:VSX_LE 1 "vsx_register_operand" ""))] + "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" + [(set (match_dup 2) + (vec_select:<MODE> +@@ -369,8 +376,8 @@ + ;; The post-reload split requires that we re-permute the source + ;; register in case it is still live. + (define_split +- [(set (match_operand:VSX_D 0 "memory_operand" "") +- (match_operand:VSX_D 1 "vsx_register_operand" ""))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "") ++ (match_operand:VSX_LE 1 "vsx_register_operand" ""))] + "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" + [(set (match_dup 1) + (vec_select:<MODE> +@@ -1352,9 +1359,9 @@ + ;; xxpermdi for little endian loads and stores. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_xxpermdi2_le_<mode>" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "vsx_register_operand" "wa") ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "vsx_register_operand" "wa") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" + "xxpermdi %x0,%x1,%x1,2" +@@ -1401,9 +1408,9 @@ + ;; lxvd2x for little endian loads. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_lxvd2x2_le_<mode>" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "memory_operand" "Z") ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "memory_operand" "Z") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" + "lxvd2x %x0,%y1" +@@ -1450,9 +1457,9 @@ + ;; stxvd2x for little endian stores. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_stxvd2x2_le_<mode>" +- [(set (match_operand:VSX_D 0 "memory_operand" "=Z") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "vsx_register_operand" "wa") ++ [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "vsx_register_operand" "wa") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" + "stxvd2x %x1,%y0" +@@ -1606,7 +1613,7 @@ + { + if (GET_CODE (op3) == SCRATCH) + op3 = gen_reg_rtx (V4SFmode); +- emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, op2)); ++ emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, GEN_INT (ele))); + tmp = op3; + } + emit_insn (gen_vsx_xscvspdp_scalar2 (op0, tmp)); Index: gcc/config/rs6000/rs6000.h =================================================================== ---- a/src/gcc/config/rs6000/rs6000.h (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/rs6000.h (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/rs6000.h (.../branches/gcc-4_8-branch) -@@ -92,7 +92,7 @@ - #ifdef HAVE_AS_POWER8 - #define ASM_CPU_POWER8_SPEC "-mpower8" - #else --#define ASM_CPU_POWER8_SPEC "-mpower4 -maltivec" -+#define ASM_CPU_POWER8_SPEC ASM_CPU_POWER7_SPEC - #endif - - #ifdef HAVE_AS_DCI -@@ -164,6 +164,7 @@ - %{mcpu=e6500: -me6500} \ - %{maltivec: -maltivec} \ - %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \ -+%{mpower8-vector|mcrypto|mdirect-move|mhtm: %{!mcpu*: %(asm_cpu_power8)}} \ - -many" - - #define CPP_DEFAULT_SPEC "" -@@ -277,6 +278,21 @@ - #define TARGET_POPCNTD 0 - #endif - -+/* Define the ISA 2.07 flags as 0 if the target assembler does not support the -+ waitasecond instruction. Allow -mpower8-fusion, since it does not add new -+ instructions. */ -+ -+#ifndef HAVE_AS_POWER8 -+#undef TARGET_DIRECT_MOVE -+#undef TARGET_CRYPTO -+#undef TARGET_HTM -+#undef TARGET_P8_VECTOR -+#define TARGET_DIRECT_MOVE 0 -+#define TARGET_CRYPTO 0 -+#define TARGET_HTM 0 -+#define TARGET_P8_VECTOR 0 -+#endif -+ - /* Define TARGET_LWSYNC_INSTRUCTION if the assembler knows about lwsync. If - not, generate the lwsync code as an integer constant. */ - #ifdef HAVE_AS_LWSYNC -@@ -386,6 +402,7 @@ - #define TARGET_DEBUG_TARGET (rs6000_debug & MASK_DEBUG_TARGET) - #define TARGET_DEBUG_BUILTIN (rs6000_debug & MASK_DEBUG_BUILTIN) - -+/* Describe the vector unit used for arithmetic operations. */ - extern enum rs6000_vector rs6000_vector_unit[]; - - #define VECTOR_UNIT_NONE_P(MODE) \ -@@ -394,12 +411,25 @@ - #define VECTOR_UNIT_VSX_P(MODE) \ - (rs6000_vector_unit[(MODE)] == VECTOR_VSX) - -+#define VECTOR_UNIT_P8_VECTOR_P(MODE) \ -+ (rs6000_vector_unit[(MODE)] == VECTOR_P8_VECTOR) -+ - #define VECTOR_UNIT_ALTIVEC_P(MODE) \ - (rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC) - -+#define VECTOR_UNIT_VSX_OR_P8_VECTOR_P(MODE) \ -+ (IN_RANGE ((int)rs6000_vector_unit[(MODE)], \ -+ (int)VECTOR_VSX, \ -+ (int)VECTOR_P8_VECTOR)) -+ -+/* VECTOR_UNIT_ALTIVEC_OR_VSX_P is used in places where we are using either -+ altivec (VMX) or VSX vector instructions. P8 vector support is upwards -+ compatible, so allow it as well, rather than changing all of the uses of the -+ macro. */ - #define VECTOR_UNIT_ALTIVEC_OR_VSX_P(MODE) \ -- (rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC \ -- || rs6000_vector_unit[(MODE)] == VECTOR_VSX) -+ (IN_RANGE ((int)rs6000_vector_unit[(MODE)], \ -+ (int)VECTOR_ALTIVEC, \ -+ (int)VECTOR_P8_VECTOR)) - - /* Describe whether to use VSX loads or Altivec loads. For now, just use the - same unit as the vector unit we are using, but we may want to migrate to -@@ -412,12 +442,21 @@ - #define VECTOR_MEM_VSX_P(MODE) \ - (rs6000_vector_mem[(MODE)] == VECTOR_VSX) - -+#define VECTOR_MEM_P8_VECTOR_P(MODE) \ -+ (rs6000_vector_mem[(MODE)] == VECTOR_VSX) -+ - #define VECTOR_MEM_ALTIVEC_P(MODE) \ - (rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC) - -+#define VECTOR_MEM_VSX_OR_P8_VECTOR_P(MODE) \ -+ (IN_RANGE ((int)rs6000_vector_mem[(MODE)], \ -+ (int)VECTOR_VSX, \ -+ (int)VECTOR_P8_VECTOR)) -+ - #define VECTOR_MEM_ALTIVEC_OR_VSX_P(MODE) \ -- (rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC \ -- || rs6000_vector_mem[(MODE)] == VECTOR_VSX) -+ (IN_RANGE ((int)rs6000_vector_mem[(MODE)], \ -+ (int)VECTOR_ALTIVEC, \ -+ (int)VECTOR_P8_VECTOR)) - - /* Return the alignment of a given vector type, which is set based on the - vector unit use. VSX for instance can load 32 or 64 bit aligned words -@@ -429,6 +468,15 @@ - ? rs6000_vector_align[(MODE)] \ - : (int)GET_MODE_BITSIZE ((MODE))) - -+/* Determine the element order to use for vector instructions. By -+ default we use big-endian element order when targeting big-endian, -+ and little-endian element order when targeting little-endian. For -+ programs being ported from BE Power to LE Power, it can sometimes -+ be useful to use big-endian element order when targeting little-endian. -+ This is set via -maltivec=be, for example. */ -+#define VECTOR_ELT_ORDER_BIG \ -+ (BYTES_BIG_ENDIAN || (rs6000_altivec_element_order == 2)) -+ - /* Alignment options for fields in structures for sub-targets following - AIX-like ABI. - ALIGN_POWER word-aligns FP doubles (default AIX ABI). -@@ -479,16 +527,38 @@ - #define TARGET_FCTIDUZ TARGET_POPCNTD - #define TARGET_FCTIWUZ TARGET_POPCNTD - -+#define TARGET_XSCVDPSPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR) -+#define TARGET_XSCVSPDPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR) -+#define TARGET_VADDUQM (TARGET_P8_VECTOR && TARGET_POWERPC64) -+ -+/* Byte/char syncs were added as phased in for ISA 2.06B, but are not present -+ in power7, so conditionalize them on p8 features. TImode syncs need quad -+ memory support. */ -+#define TARGET_SYNC_HI_QI (TARGET_QUAD_MEMORY \ -+ || TARGET_QUAD_MEMORY_ATOMIC \ -+ || TARGET_DIRECT_MOVE) -+ -+#define TARGET_SYNC_TI TARGET_QUAD_MEMORY_ATOMIC -+ -+/* Power7 has both 32-bit load and store integer for the FPRs, so we don't need -+ to allocate the SDmode stack slot to get the value into the proper location -+ in the register. */ -+#define TARGET_NO_SDMODE_STACK (TARGET_LFIWZX && TARGET_STFIWX && TARGET_DFP) -+ - /* In switching from using target_flags to using rs6000_isa_flags, the options - machinery creates OPTION_MASK_<xxx> instead of MASK_<xxx>. For now map - OPTION_MASK_<xxx> back into MASK_<xxx>. */ - #define MASK_ALTIVEC OPTION_MASK_ALTIVEC - #define MASK_CMPB OPTION_MASK_CMPB -+#define MASK_CRYPTO OPTION_MASK_CRYPTO - #define MASK_DFP OPTION_MASK_DFP -+#define MASK_DIRECT_MOVE OPTION_MASK_DIRECT_MOVE - #define MASK_DLMZB OPTION_MASK_DLMZB - #define MASK_EABI OPTION_MASK_EABI - #define MASK_FPRND OPTION_MASK_FPRND -+#define MASK_P8_FUSION OPTION_MASK_P8_FUSION - #define MASK_HARD_FLOAT OPTION_MASK_HARD_FLOAT -+#define MASK_HTM OPTION_MASK_HTM - #define MASK_ISEL OPTION_MASK_ISEL - #define MASK_MFCRF OPTION_MASK_MFCRF - #define MASK_MFPGPR OPTION_MASK_MFPGPR -@@ -495,6 +565,7 @@ - #define MASK_MULHW OPTION_MASK_MULHW - #define MASK_MULTIPLE OPTION_MASK_MULTIPLE - #define MASK_NO_UPDATE OPTION_MASK_NO_UPDATE -+#define MASK_P8_VECTOR OPTION_MASK_P8_VECTOR - #define MASK_POPCNTB OPTION_MASK_POPCNTB - #define MASK_POPCNTD OPTION_MASK_POPCNTD - #define MASK_PPC_GFXOPT OPTION_MASK_PPC_GFXOPT -@@ -505,6 +576,7 @@ - #define MASK_STRING OPTION_MASK_STRING - #define MASK_UPDATE OPTION_MASK_UPDATE - #define MASK_VSX OPTION_MASK_VSX -+#define MASK_VSX_TIMODE OPTION_MASK_VSX_TIMODE - - #ifndef IN_LIBGCC2 - #define MASK_POWERPC64 OPTION_MASK_POWERPC64 -@@ -558,6 +630,25 @@ - || rs6000_cpu == PROCESSOR_PPC8548) - - -+/* Whether SF/DF operations are supported on the E500. */ -+#define TARGET_SF_SPE (TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT \ -+ && !TARGET_FPRS) -+ -+#define TARGET_DF_SPE (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT \ -+ && !TARGET_FPRS && TARGET_E500_DOUBLE) -+ -+/* Whether SF/DF operations are supported by by the normal floating point unit -+ (or the vector/scalar unit). */ -+#define TARGET_SF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \ -+ && TARGET_SINGLE_FLOAT) -+ -+#define TARGET_DF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \ -+ && TARGET_DOUBLE_FLOAT) -+ -+/* Whether SF/DF operations are supported by any hardware. */ -+#define TARGET_SF_INSN (TARGET_SF_FPR || TARGET_SF_SPE) -+#define TARGET_DF_INSN (TARGET_DF_FPR || TARGET_DF_SPE) -+ - /* Which machine supports the various reciprocal estimate instructions. */ - #define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \ - && TARGET_FPRS && TARGET_SINGLE_FLOAT) -@@ -595,9 +686,6 @@ - #define RS6000_RECIP_AUTO_RSQRTE_P(MODE) \ - (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RSQRTE) - --#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \ -- ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION) -- - /* The default CPU for TARGET_OPTION_OVERRIDE. */ - #define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT - -@@ -760,12 +848,6 @@ - /* No data type wants to be aligned rounder than this. */ - #define BIGGEST_ALIGNMENT 128 - --/* A C expression to compute the alignment for a variables in the -- local store. TYPE is the data type, and ALIGN is the alignment -- that the object would ordinarily have. */ --#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ -- DATA_ALIGNMENT (TYPE, ALIGN) -- - /* Alignment of field after `int : 0' in a structure. */ - #define EMPTY_FIELD_BOUNDARY 32 - -@@ -775,8 +857,15 @@ - /* A bit-field declared as `int' forces `int' alignment for the struct. */ - #define PCC_BITFIELD_TYPE_MATTERS 1 - --/* Make strings word-aligned so strcpy from constants will be faster. -- Make vector constants quadword aligned. */ -+enum data_align { align_abi, align_opt, align_both }; -+ -+/* A C expression to compute the alignment for a variables in the -+ local store. TYPE is the data type, and ALIGN is the alignment -+ that the object would ordinarily have. */ -+#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ -+ rs6000_data_alignment (TYPE, ALIGN, align_both) -+ -+/* Make strings word-aligned so strcpy from constants will be faster. */ - #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ - (TREE_CODE (EXP) == STRING_CST \ - && (STRICT_ALIGNMENT || !optimize_size) \ -@@ -784,21 +873,14 @@ - ? BITS_PER_WORD \ - : (ALIGN)) - --/* Make arrays of chars word-aligned for the same reasons. -- Align vectors to 128 bits. Align SPE vectors and E500 v2 doubles to -+/* Make arrays of chars word-aligned for the same reasons. */ -+#define DATA_ALIGNMENT(TYPE, ALIGN) \ -+ rs6000_data_alignment (TYPE, ALIGN, align_opt) -+ -+/* Align vectors to 128 bits. Align SPE vectors and E500 v2 doubles to - 64 bits. */ --#define DATA_ALIGNMENT(TYPE, ALIGN) \ -- (TREE_CODE (TYPE) == VECTOR_TYPE \ -- ? (((TARGET_SPE && SPE_VECTOR_MODE (TYPE_MODE (TYPE))) \ -- || (TARGET_PAIRED_FLOAT && PAIRED_VECTOR_MODE (TYPE_MODE (TYPE)))) \ -- ? 64 : 128) \ -- : ((TARGET_E500_DOUBLE \ -- && TREE_CODE (TYPE) == REAL_TYPE \ -- && TYPE_MODE (TYPE) == DFmode) \ -- ? 64 \ -- : (TREE_CODE (TYPE) == ARRAY_TYPE \ -- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ -- && (ALIGN) < BITS_PER_WORD) ? BITS_PER_WORD : (ALIGN))) -+#define DATA_ABI_ALIGNMENT(TYPE, ALIGN) \ -+ rs6000_data_alignment (TYPE, ALIGN, align_abi) - - /* Nonzero if move instructions will actually fail to work - when given unaligned data. */ -@@ -842,15 +924,17 @@ - in inline functions. - - Another pseudo (not included in DWARF_FRAME_REGISTERS) is soft frame -- pointer, which is eventually eliminated in favor of SP or FP. */ -+ pointer, which is eventually eliminated in favor of SP or FP. - --#define FIRST_PSEUDO_REGISTER 114 -+ The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS. */ - -+#define FIRST_PSEUDO_REGISTER 117 -+ - /* This must be included for pre gcc 3.0 glibc compatibility. */ - #define PRE_GCC3_DWARF_FRAME_REGISTERS 77 - - /* Add 32 dwarf columns for synthetic SPE registers. */ --#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 1) + 32) -+#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 4) + 32) - - /* The SPE has an additional 32 synthetic registers, with DWARF debug - info numbering for these registers starting at 1200. While eh_frame -@@ -866,7 +950,7 @@ - We must map them here to avoid huge unwinder tables mostly consisting - of unused space. */ - #define DWARF_REG_TO_UNWIND_COLUMN(r) \ -- ((r) > 1200 ? ((r) - 1200 + FIRST_PSEUDO_REGISTER - 1) : (r)) -+ ((r) > 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r)) - - /* Use standard DWARF numbering for DWARF debugging information. */ - #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO) -@@ -906,7 +990,7 @@ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1 \ -- , 1, 1, 1 \ -+ , 1, 1, 1, 1, 1, 1 \ - } - - /* 1 for registers not available across function calls. -@@ -926,7 +1010,7 @@ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1 \ -- , 1, 1, 1 \ -+ , 1, 1, 1, 1, 1, 1 \ - } - - /* Like `CALL_USED_REGISTERS' except this macro doesn't require that -@@ -945,7 +1029,7 @@ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0 \ -- , 0, 0, 0 \ -+ , 0, 0, 0, 0, 0, 0 \ - } - - #define TOTAL_ALTIVEC_REGS (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1) -@@ -984,6 +1068,9 @@ - vrsave, vscr (fixed) - spe_acc, spefscr (fixed) - sfp (fixed) -+ tfhar (fixed) -+ tfiar (fixed) -+ texasr (fixed) - */ - - #if FIXED_R2 == 1 -@@ -1004,7 +1091,9 @@ - - #define REG_ALLOC_ORDER \ - {32, \ -- 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \ -+ /* move fr13 (ie 45) later, so if we need TFmode, it does */ \ -+ /* not use fr14 which is a saved register. */ \ -+ 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 45, \ - 33, \ - 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \ - 50, 49, 48, 47, 46, \ -@@ -1023,7 +1112,7 @@ - 96, 95, 94, 93, 92, 91, \ - 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, \ - 109, 110, \ -- 111, 112, 113 \ -+ 111, 112, 113, 114, 115, 116 \ - } - - /* True if register is floating-point. */ -@@ -1064,8 +1153,11 @@ - #define VINT_REGNO_P(N) ALTIVEC_REGNO_P (N) - - /* Alternate name for any vector register supporting logical operations, no -- matter which instruction set(s) are available. */ --#define VLOGICAL_REGNO_P(N) VFLOAT_REGNO_P (N) -+ matter which instruction set(s) are available. Allow GPRs as well as the -+ vector registers. */ -+#define VLOGICAL_REGNO_P(N) \ -+ (INT_REGNO_P (N) || ALTIVEC_REGNO_P (N) \ -+ || (TARGET_VSX && FP_REGNO_P (N))) \ - - /* Return number of consecutive hard regs needed starting at reg REGNO - to hold something of mode MODE. */ -@@ -1106,7 +1198,7 @@ - - #define ALTIVEC_OR_VSX_VECTOR_MODE(MODE) \ - (ALTIVEC_VECTOR_MODE (MODE) || VSX_VECTOR_MODE (MODE) \ -- || (MODE) == V2DImode) -+ || (MODE) == V2DImode || (MODE) == V1TImode) - - #define SPE_VECTOR_MODE(MODE) \ - ((MODE) == V4HImode \ -@@ -1125,28 +1217,32 @@ - /* Value is 1 if it is a good idea to tie two pseudo registers - when one has mode MODE1 and one has mode MODE2. - If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, -- for any hard reg, then this must be 0 for correct output. */ --#define MODES_TIEABLE_P(MODE1, MODE2) \ -- (SCALAR_FLOAT_MODE_P (MODE1) \ -+ for any hard reg, then this must be 0 for correct output. -+ -+ PTImode cannot tie with other modes because PTImode is restricted to even -+ GPR registers, and TImode can go in any GPR as well as VSX registers (PR -+ 57744). */ -+#define MODES_TIEABLE_P(MODE1, MODE2) \ -+ ((MODE1) == PTImode \ -+ ? (MODE2) == PTImode \ -+ : (MODE2) == PTImode \ -+ ? 0 \ -+ : SCALAR_FLOAT_MODE_P (MODE1) \ - ? SCALAR_FLOAT_MODE_P (MODE2) \ - : SCALAR_FLOAT_MODE_P (MODE2) \ -- ? SCALAR_FLOAT_MODE_P (MODE1) \ -+ ? 0 \ - : GET_MODE_CLASS (MODE1) == MODE_CC \ - ? GET_MODE_CLASS (MODE2) == MODE_CC \ - : GET_MODE_CLASS (MODE2) == MODE_CC \ -- ? GET_MODE_CLASS (MODE1) == MODE_CC \ -+ ? 0 \ - : SPE_VECTOR_MODE (MODE1) \ - ? SPE_VECTOR_MODE (MODE2) \ - : SPE_VECTOR_MODE (MODE2) \ -- ? SPE_VECTOR_MODE (MODE1) \ -- : ALTIVEC_VECTOR_MODE (MODE1) \ -- ? ALTIVEC_VECTOR_MODE (MODE2) \ -- : ALTIVEC_VECTOR_MODE (MODE2) \ -- ? ALTIVEC_VECTOR_MODE (MODE1) \ -+ ? 0 \ - : ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \ - ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \ - : ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \ -- ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \ -+ ? 0 \ - : 1) - - /* Post-reload, we can't use any new AltiVec registers, as we already -@@ -1240,6 +1336,7 @@ - VSCR_REGS, - SPE_ACC_REGS, - SPEFSCR_REGS, -+ SPR_REGS, - NON_SPECIAL_REGS, - LINK_REGS, - CTR_REGS, -@@ -1270,6 +1367,7 @@ - "VSCR_REGS", \ - "SPE_ACC_REGS", \ - "SPEFSCR_REGS", \ -+ "SPR_REGS", \ - "NON_SPECIAL_REGS", \ - "LINK_REGS", \ - "CTR_REGS", \ -@@ -1299,6 +1397,7 @@ - { 0x00000000, 0x00000000, 0x00000000, 0x00004000 }, /* VSCR_REGS */ \ - { 0x00000000, 0x00000000, 0x00000000, 0x00008000 }, /* SPE_ACC_REGS */ \ - { 0x00000000, 0x00000000, 0x00000000, 0x00010000 }, /* SPEFSCR_REGS */ \ -+ { 0x00000000, 0x00000000, 0x00000000, 0x00040000 }, /* SPR_REGS */ \ - { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000 }, /* NON_SPECIAL_REGS */ \ - { 0x00000000, 0x00000000, 0x00000002, 0x00000000 }, /* LINK_REGS */ \ - { 0x00000000, 0x00000000, 0x00000004, 0x00000000 }, /* CTR_REGS */ \ -@@ -1309,7 +1408,7 @@ - { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */ \ - { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000 }, /* NON_FLOAT_REGS */ \ - { 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* CA_REGS */ \ -- { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0003ffff } /* ALL_REGS */ \ -+ { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0007ffff } /* ALL_REGS */ \ - } - - /* The same information, inverted: -@@ -1337,7 +1436,18 @@ - RS6000_CONSTRAINT_wa, /* Any VSX register */ - RS6000_CONSTRAINT_wd, /* VSX register for V2DF */ - RS6000_CONSTRAINT_wf, /* VSX register for V4SF */ -+ RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */ -+ RS6000_CONSTRAINT_wl, /* FPR register for LFIWAX */ -+ RS6000_CONSTRAINT_wm, /* VSX register for direct move */ -+ RS6000_CONSTRAINT_wr, /* GPR register if 64-bit */ - RS6000_CONSTRAINT_ws, /* VSX register for DF */ -+ RS6000_CONSTRAINT_wt, /* VSX register for TImode */ -+ RS6000_CONSTRAINT_wu, /* Altivec register for float load/stores. */ -+ RS6000_CONSTRAINT_wv, /* Altivec register for double load/stores. */ -+ RS6000_CONSTRAINT_ww, /* FP or VSX register for vsx float ops. */ -+ RS6000_CONSTRAINT_wx, /* FPR register for STFIWX */ -+ RS6000_CONSTRAINT_wy, /* VSX register for SF */ -+ RS6000_CONSTRAINT_wz, /* FPR register for LFIWZX */ - RS6000_CONSTRAINT_MAX - }; - -@@ -1425,21 +1535,14 @@ - arguments. */ - #define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0) - --/* Size of the outgoing register save area */ --#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \ -- || DEFAULT_ABI == ABI_DARWIN) \ -- ? (TARGET_64BIT ? 64 : 32) \ -- : 0) -- - /* Size of the fixed area on the stack */ - #define RS6000_SAVE_AREA \ -- (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) ? 24 : 8) \ -+ ((DEFAULT_ABI == ABI_V4 ? 8 : DEFAULT_ABI == ABI_ELFv2 ? 16 : 24) \ - << (TARGET_64BIT ? 1 : 0)) - --/* MEM representing address to save the TOC register */ --#define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \ -- plus_constant (Pmode, stack_pointer_rtx, \ -- (TARGET_32BIT ? 20 : 40))) -+/* Stack offset for toc save slot. */ -+#define RS6000_TOC_SAVE_SLOT \ -+ ((DEFAULT_ABI == ABI_ELFv2 ? 12 : 20) << (TARGET_64BIT ? 1 : 0)) - - /* Align an address */ - #define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1)) -@@ -1489,7 +1592,7 @@ +@@ -1593,8 +1593,15 @@ /* Define this if stack space is still allocated for a parameter passed in a register. The value is the number of bytes allocated to this area. */ --#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE -+#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL)) +-#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL)) ++#define REG_PARM_STACK_SPACE(FNDECL) \ ++ rs6000_reg_parm_stack_space ((FNDECL), false) ++/* Define this macro if space guaranteed when compiling a function body ++ is different to space required when making a call, a situation that ++ can arise with K&R style function definitions. */ ++#define INCOMING_REG_PARM_STACK_SPACE(FNDECL) \ ++ rs6000_reg_parm_stack_space ((FNDECL), true) ++ /* Define this if the above stack space is to be considered part of the space allocated by the caller. */ -@@ -1522,7 +1625,7 @@ - NONLOCAL needs twice Pmode to maintain both backchain and SP. */ - #define STACK_SAVEAREA_MODE(LEVEL) \ - (LEVEL == SAVE_FUNCTION ? VOIDmode \ -- : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : TImode) : Pmode) -+ : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : PTImode) : Pmode) - - /* Minimum and maximum general purpose registers used to hold arguments. */ - #define GP_ARG_MIN_REG 3 -@@ -1533,9 +1636,8 @@ - #define FP_ARG_MIN_REG 33 - #define FP_ARG_AIX_MAX_REG 45 - #define FP_ARG_V4_MAX_REG 40 --#define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX \ -- || DEFAULT_ABI == ABI_DARWIN) \ -- ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG) -+#define FP_ARG_MAX_REG (DEFAULT_ABI == ABI_V4 \ -+ ? FP_ARG_V4_MAX_REG : FP_ARG_AIX_MAX_REG) - #define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1) - - /* Minimum and maximum AltiVec registers used to hold arguments. */ -@@ -1543,10 +1645,17 @@ - #define ALTIVEC_ARG_MAX_REG (ALTIVEC_ARG_MIN_REG + 11) - #define ALTIVEC_ARG_NUM_REG (ALTIVEC_ARG_MAX_REG - ALTIVEC_ARG_MIN_REG + 1) - -+/* Maximum number of registers per ELFv2 homogeneous aggregate argument. */ -+#define AGGR_ARG_NUM_REG 8 -+ - /* Return registers */ - #define GP_ARG_RETURN GP_ARG_MIN_REG - #define FP_ARG_RETURN FP_ARG_MIN_REG - #define ALTIVEC_ARG_RETURN (FIRST_ALTIVEC_REGNO + 2) -+#define FP_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? FP_ARG_RETURN \ -+ : (FP_ARG_RETURN + AGGR_ARG_NUM_REG - 1)) -+#define ALTIVEC_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? ALTIVEC_ARG_RETURN \ -+ : (ALTIVEC_ARG_RETURN + AGGR_ARG_NUM_REG - 1)) - - /* Flags for the call/call_value rtl operations set up by function_arg */ - #define CALL_NORMAL 0x00000000 /* no special processing */ -@@ -1566,8 +1675,10 @@ - On RS/6000, this is r3, fp1, and v2 (for AltiVec). */ - #define FUNCTION_VALUE_REGNO_P(N) \ - ((N) == GP_ARG_RETURN \ -- || ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT && TARGET_FPRS) \ -- || ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI)) -+ || ((N) >= FP_ARG_RETURN && (N) <= FP_ARG_MAX_RETURN \ -+ && TARGET_HARD_FLOAT && TARGET_FPRS) \ -+ || ((N) >= ALTIVEC_ARG_RETURN && (N) <= ALTIVEC_ARG_MAX_RETURN \ -+ && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI)) - - /* 1 if N is a possible register number for function argument passing. - On RS/6000, these are r3-r10 and fp1-fp13. -@@ -1691,11 +1802,8 @@ - /* Number of bytes into the frame return addresses can be found. See - rs6000_stack_info in rs6000.c for more information on how the different - abi's store the return address. */ --#define RETURN_ADDRESS_OFFSET \ -- ((DEFAULT_ABI == ABI_AIX \ -- || DEFAULT_ABI == ABI_DARWIN) ? (TARGET_32BIT ? 8 : 16) : \ -- (DEFAULT_ABI == ABI_V4) ? 4 : \ -- (internal_error ("RETURN_ADDRESS_OFFSET not supported"), 0)) -+#define RETURN_ADDRESS_OFFSET \ -+ ((DEFAULT_ABI == ABI_V4 ? 4 : 8) << (TARGET_64BIT ? 1 : 0)) - - /* The current return address is in link register (65). The return address - of anything farther back is accessed normally at an offset of 8 from the -@@ -2215,6 +2323,9 @@ - &rs6000_reg_names[111][0], /* spe_acc */ \ - &rs6000_reg_names[112][0], /* spefscr */ \ - &rs6000_reg_names[113][0], /* sfp */ \ -+ &rs6000_reg_names[114][0], /* tfhar */ \ -+ &rs6000_reg_names[115][0], /* tfiar */ \ -+ &rs6000_reg_names[116][0], /* texasr */ \ - } - - /* Table of additional register names to use in user input. */ -@@ -2268,7 +2379,9 @@ - {"vs48", 93}, {"vs49", 94}, {"vs50", 95}, {"vs51", 96}, \ - {"vs52", 97}, {"vs53", 98}, {"vs54", 99}, {"vs55", 100}, \ - {"vs56", 101},{"vs57", 102},{"vs58", 103},{"vs59", 104}, \ -- {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108} } -+ {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108}, \ -+ /* Transactional Memory Facility (HTM) Registers. */ \ -+ {"tfhar", 114}, {"tfiar", 115}, {"texasr", 116} } - - /* This is how to output an element of a case-vector that is relative. */ - -@@ -2357,7 +2470,12 @@ - #define RS6000_BTC_ATTR_MASK 0x00000700 /* Mask of the attributes. */ - - /* Miscellaneous information. */ --#define RS6000_BTC_OVERLOADED 0x4000000 /* function is overloaded. */ -+#define RS6000_BTC_SPR 0x01000000 /* function references SPRs. */ -+#define RS6000_BTC_VOID 0x02000000 /* function has no return value. */ -+#define RS6000_BTC_OVERLOADED 0x04000000 /* function is overloaded. */ -+#define RS6000_BTC_32BIT 0x08000000 /* function references SPRs. */ -+#define RS6000_BTC_64BIT 0x10000000 /* function references SPRs. */ -+#define RS6000_BTC_MISC_MASK 0x1f000000 /* Mask of the misc info. */ - - /* Convenience macros to document the instruction type. */ - #define RS6000_BTC_MEM RS6000_BTC_MISC /* load/store touches mem. */ -@@ -2369,6 +2487,9 @@ + #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 +@@ -2483,8 +2490,8 @@ + #define RS6000_BTC_SAT RS6000_BTC_MISC /* saturate sets VSCR. */ + + /* Builtin targets. For now, we reuse the masks for those options that are in +- target flags, and pick two random bits for SPE and paired which aren't in +- target_flags. */ ++ target flags, and pick three random bits for SPE, paired and ldbl128 which ++ aren't in target_flags. */ #define RS6000_BTM_ALWAYS 0 /* Always enabled. */ #define RS6000_BTM_ALTIVEC MASK_ALTIVEC /* VMX/altivec vectors. */ #define RS6000_BTM_VSX MASK_VSX /* VSX (vector/scalar). */ -+#define RS6000_BTM_P8_VECTOR MASK_P8_VECTOR /* ISA 2.07 vector. */ -+#define RS6000_BTM_CRYPTO MASK_CRYPTO /* crypto funcs. */ -+#define RS6000_BTM_HTM MASK_HTM /* hardware TM funcs. */ - #define RS6000_BTM_SPE MASK_STRING /* E500 */ - #define RS6000_BTM_PAIRED MASK_MULHW /* 750CL paired insns. */ - #define RS6000_BTM_FRE MASK_POPCNTB /* FRE instruction. */ -@@ -2380,10 +2501,13 @@ +@@ -2501,6 +2508,7 @@ + #define RS6000_BTM_CELL MASK_FPRND /* Target is cell powerpc. */ + #define RS6000_BTM_DFP MASK_DFP /* Decimal floating point. */ + #define RS6000_BTM_HARD_FLOAT MASK_SOFT_FLOAT /* Hardware floating point. */ ++#define RS6000_BTM_LDBL128 MASK_MULTIPLE /* 128-bit long double. */ #define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \ | RS6000_BTM_VSX \ -+ | RS6000_BTM_P8_VECTOR \ -+ | RS6000_BTM_CRYPTO \ - | RS6000_BTM_FRE \ - | RS6000_BTM_FRES \ - | RS6000_BTM_FRSQRTE \ - | RS6000_BTM_FRSQRTES \ -+ | RS6000_BTM_HTM \ +@@ -2514,7 +2522,8 @@ | RS6000_BTM_POPCNTD \ - | RS6000_BTM_CELL) - -@@ -2395,6 +2519,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -2406,6 +2531,7 @@ - #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) ENUM, - #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) ENUM, - #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) ENUM, -+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) ENUM, - #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) ENUM, - #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) ENUM, - #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) ENUM, -@@ -2424,6 +2550,7 @@ - #undef RS6000_BUILTIN_A - #undef RS6000_BUILTIN_D - #undef RS6000_BUILTIN_E -+#undef RS6000_BUILTIN_H - #undef RS6000_BUILTIN_P - #undef RS6000_BUILTIN_Q - #undef RS6000_BUILTIN_S -@@ -2437,6 +2564,7 @@ - RS6000_BTI_opaque_p_V2SI, - RS6000_BTI_opaque_V4SI, - RS6000_BTI_V16QI, -+ RS6000_BTI_V1TI, - RS6000_BTI_V2SI, - RS6000_BTI_V2SF, - RS6000_BTI_V2DI, -@@ -2446,6 +2574,7 @@ - RS6000_BTI_V4SF, - RS6000_BTI_V8HI, - RS6000_BTI_unsigned_V16QI, -+ RS6000_BTI_unsigned_V1TI, - RS6000_BTI_unsigned_V8HI, - RS6000_BTI_unsigned_V4SI, - RS6000_BTI_unsigned_V2DI, -@@ -2471,6 +2600,8 @@ - RS6000_BTI_UINTSI, /* unsigned_intSI_type_node */ - RS6000_BTI_INTDI, /* intDI_type_node */ - RS6000_BTI_UINTDI, /* unsigned_intDI_type_node */ -+ RS6000_BTI_INTTI, /* intTI_type_node */ -+ RS6000_BTI_UINTTI, /* unsigned_intTI_type_node */ - RS6000_BTI_float, /* float_type_node */ - RS6000_BTI_double, /* double_type_node */ - RS6000_BTI_void, /* void_type_node */ -@@ -2483,6 +2614,7 @@ - #define opaque_p_V2SI_type_node (rs6000_builtin_types[RS6000_BTI_opaque_p_V2SI]) - #define opaque_V4SI_type_node (rs6000_builtin_types[RS6000_BTI_opaque_V4SI]) - #define V16QI_type_node (rs6000_builtin_types[RS6000_BTI_V16QI]) -+#define V1TI_type_node (rs6000_builtin_types[RS6000_BTI_V1TI]) - #define V2DI_type_node (rs6000_builtin_types[RS6000_BTI_V2DI]) - #define V2DF_type_node (rs6000_builtin_types[RS6000_BTI_V2DF]) - #define V2SI_type_node (rs6000_builtin_types[RS6000_BTI_V2SI]) -@@ -2492,6 +2624,7 @@ - #define V4SF_type_node (rs6000_builtin_types[RS6000_BTI_V4SF]) - #define V8HI_type_node (rs6000_builtin_types[RS6000_BTI_V8HI]) - #define unsigned_V16QI_type_node (rs6000_builtin_types[RS6000_BTI_unsigned_V16QI]) -+#define unsigned_V1TI_type_node (rs6000_builtin_types[RS6000_BTI_unsigned_V1TI]) - #define unsigned_V8HI_type_node (rs6000_builtin_types[RS6000_BTI_unsigned_V8HI]) - #define unsigned_V4SI_type_node (rs6000_builtin_types[RS6000_BTI_unsigned_V4SI]) - #define unsigned_V2DI_type_node (rs6000_builtin_types[RS6000_BTI_unsigned_V2DI]) -@@ -2518,6 +2651,8 @@ - #define uintSI_type_internal_node (rs6000_builtin_types[RS6000_BTI_UINTSI]) - #define intDI_type_internal_node (rs6000_builtin_types[RS6000_BTI_INTDI]) - #define uintDI_type_internal_node (rs6000_builtin_types[RS6000_BTI_UINTDI]) -+#define intTI_type_internal_node (rs6000_builtin_types[RS6000_BTI_INTTI]) -+#define uintTI_type_internal_node (rs6000_builtin_types[RS6000_BTI_UINTTI]) - #define float_type_internal_node (rs6000_builtin_types[RS6000_BTI_float]) - #define double_type_internal_node (rs6000_builtin_types[RS6000_BTI_double]) - #define void_type_internal_node (rs6000_builtin_types[RS6000_BTI_void]) -Index: gcc/config/rs6000/altivec.md -=================================================================== ---- a/src/gcc/config/rs6000/altivec.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/altivec.md (.../branches/gcc-4_8-branch) -@@ -41,15 +41,12 @@ - UNSPEC_VMULOSB - UNSPEC_VMULOUH - UNSPEC_VMULOSH -- UNSPEC_VPKUHUM -- UNSPEC_VPKUWUM - UNSPEC_VPKPX -- UNSPEC_VPKSHSS -- UNSPEC_VPKSWSS -- UNSPEC_VPKUHUS -- UNSPEC_VPKSHUS -- UNSPEC_VPKUWUS -- UNSPEC_VPKSWUS -+ UNSPEC_VPACK_SIGN_SIGN_SAT -+ UNSPEC_VPACK_SIGN_UNS_SAT -+ UNSPEC_VPACK_UNS_UNS_SAT -+ UNSPEC_VPACK_UNS_UNS_MOD -+ UNSPEC_VPACK_UNS_UNS_MOD_DIRECT - UNSPEC_VSLV4SI - UNSPEC_VSLO - UNSPEC_VSR -@@ -71,12 +68,12 @@ - UNSPEC_VLOGEFP - UNSPEC_VEXPTEFP - UNSPEC_VLSDOI -- UNSPEC_VUPKHSB -+ UNSPEC_VUNPACK_HI_SIGN -+ UNSPEC_VUNPACK_LO_SIGN -+ UNSPEC_VUNPACK_HI_SIGN_DIRECT -+ UNSPEC_VUNPACK_LO_SIGN_DIRECT - UNSPEC_VUPKHPX -- UNSPEC_VUPKHSH -- UNSPEC_VUPKLSB - UNSPEC_VUPKLPX -- UNSPEC_VUPKLSH - UNSPEC_DST - UNSPEC_DSTT - UNSPEC_DSTST -@@ -134,6 +131,17 @@ - UNSPEC_VUPKLS_V4SF - UNSPEC_VUPKHU_V4SF - UNSPEC_VUPKLU_V4SF -+ UNSPEC_VGBBD -+ UNSPEC_VMRGH_DIRECT -+ UNSPEC_VMRGL_DIRECT -+ UNSPEC_VSPLT_DIRECT -+ UNSPEC_VSUMSWS_DIRECT -+ UNSPEC_VADDCUQ -+ UNSPEC_VADDEUQM -+ UNSPEC_VADDECUQ -+ UNSPEC_VSUBCUQ -+ UNSPEC_VSUBEUQM -+ UNSPEC_VSUBECUQ - ]) - - (define_c_enum "unspecv" -@@ -146,6 +154,8 @@ - - ;; Vec int modes - (define_mode_iterator VI [V4SI V8HI V16QI]) -+;; Like VI, but add ISA 2.07 integer vector ops -+(define_mode_iterator VI2 [V4SI V8HI V16QI V2DI]) - ;; Short vec in modes - (define_mode_iterator VIshort [V8HI V16QI]) - ;; Vec float modes -@@ -154,14 +164,25 @@ - (define_mode_iterator V [V4SI V8HI V16QI V4SF]) - ;; Vec modes for move/logical/permute ops, include vector types for move not - ;; otherwise handled by altivec (v2df, v2di, ti) --(define_mode_iterator VM [V4SI V8HI V16QI V4SF V2DF V2DI TI]) -+(define_mode_iterator VM [V4SI V8HI V16QI V4SF V2DF V2DI V1TI TI]) - - ;; Like VM, except don't do TImode --(define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI]) -+(define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI V1TI]) - --(define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")]) --(define_mode_attr VI_scalar [(V4SI "SI") (V8HI "HI") (V16QI "QI")]) -+(define_mode_attr VI_char [(V2DI "d") (V4SI "w") (V8HI "h") (V16QI "b")]) -+(define_mode_attr VI_scalar [(V2DI "DI") (V4SI "SI") (V8HI "HI") (V16QI "QI")]) -+(define_mode_attr VI_unit [(V16QI "VECTOR_UNIT_ALTIVEC_P (V16QImode)") -+ (V8HI "VECTOR_UNIT_ALTIVEC_P (V8HImode)") -+ (V4SI "VECTOR_UNIT_ALTIVEC_P (V4SImode)") -+ (V2DI "VECTOR_UNIT_P8_VECTOR_P (V2DImode)") -+ (V1TI "VECTOR_UNIT_ALTIVEC_P (V1TImode)")]) - -+;; Vector pack/unpack -+(define_mode_iterator VP [V2DI V4SI V8HI]) -+(define_mode_attr VP_small [(V2DI "V4SI") (V4SI "V8HI") (V8HI "V16QI")]) -+(define_mode_attr VP_small_lc [(V2DI "v4si") (V4SI "v8hi") (V8HI "v16qi")]) -+(define_mode_attr VU_char [(V2DI "w") (V4SI "h") (V8HI "b")]) -+ - ;; Vector move instructions. - (define_insn "*altivec_mov<mode>" - [(set (match_operand:VM2 0 "nonimmediate_operand" "=Z,v,v,*Y,*r,*r,v,v") -@@ -378,10 +399,10 @@ - - ;; add - (define_insn "add<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (plus:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (plus:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vaddu<VI_char>m %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -398,7 +419,7 @@ - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") - (match_operand:V4SI 2 "register_operand" "v")] - UNSPEC_VADDCUW))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)" - "vaddcuw %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -405,10 +426,10 @@ - (define_insn "altivec_vaddu<VI_char>s" - [(set (match_operand:VI 0 "register_operand" "=v") - (unspec:VI [(match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")] -+ (match_operand:VI 2 "register_operand" "v")] - UNSPEC_VADDU)) - (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -+ "<VI_unit>" - "vaddu<VI_char>s %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -418,16 +439,16 @@ - (match_operand:VI 2 "register_operand" "v")] - UNSPEC_VADDS)) - (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "vadds<VI_char>s %0,%1,%2" - [(set_attr "type" "vecsimple")]) - - ;; sub - (define_insn "sub<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (minus:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (minus:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vsubu<VI_char>m %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -444,7 +465,7 @@ - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") - (match_operand:V4SI 2 "register_operand" "v")] - UNSPEC_VSUBCUW))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)" - "vsubcuw %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -454,7 +475,7 @@ - (match_operand:VI 2 "register_operand" "v")] - UNSPEC_VSUBU)) - (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "vsubu<VI_char>s %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -464,7 +485,7 @@ - (match_operand:VI 2 "register_operand" "v")] - UNSPEC_VSUBS)) - (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "vsubs<VI_char>s %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -483,7 +504,7 @@ - (unspec:VI [(match_operand:VI 1 "register_operand" "v") - (match_operand:VI 2 "register_operand" "v")] - UNSPEC_VAVGS))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "vavgs<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -492,31 +513,31 @@ - (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v") - (match_operand:V4SF 2 "register_operand" "v")] - UNSPEC_VCMPBFP))] -- "TARGET_ALTIVEC" -+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)" - "vcmpbfp %0,%1,%2" - [(set_attr "type" "veccmp")]) - - (define_insn "*altivec_eq<mode>" -- [(set (match_operand:VI 0 "altivec_register_operand" "=v") -- (eq:VI (match_operand:VI 1 "altivec_register_operand" "v") -- (match_operand:VI 2 "altivec_register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v") -+ (eq:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") -+ (match_operand:VI2 2 "altivec_register_operand" "v")))] -+ "<VI_unit>" - "vcmpequ<VI_char> %0,%1,%2" - [(set_attr "type" "veccmp")]) - - (define_insn "*altivec_gt<mode>" -- [(set (match_operand:VI 0 "altivec_register_operand" "=v") -- (gt:VI (match_operand:VI 1 "altivec_register_operand" "v") -- (match_operand:VI 2 "altivec_register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v") -+ (gt:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") -+ (match_operand:VI2 2 "altivec_register_operand" "v")))] -+ "<VI_unit>" - "vcmpgts<VI_char> %0,%1,%2" - [(set_attr "type" "veccmp")]) - - (define_insn "*altivec_gtu<mode>" -- [(set (match_operand:VI 0 "altivec_register_operand" "=v") -- (gtu:VI (match_operand:VI 1 "altivec_register_operand" "v") -- (match_operand:VI 2 "altivec_register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v") -+ (gtu:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") -+ (match_operand:VI2 2 "altivec_register_operand" "v")))] -+ "<VI_unit>" - "vcmpgtu<VI_char> %0,%1,%2" - [(set_attr "type" "veccmp")]) - -@@ -642,7 +663,7 @@ - convert_move (small_swap, swap, 0); - - low_product = gen_reg_rtx (V4SImode); -- emit_insn (gen_vec_widen_umult_odd_v8hi (low_product, one, two)); -+ emit_insn (gen_altivec_vmulouh (low_product, one, two)); - - high_product = gen_reg_rtx (V4SImode); - emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero)); -@@ -666,14 +687,23 @@ - rtx high = gen_reg_rtx (V4SImode); - rtx low = gen_reg_rtx (V4SImode); - -- emit_insn (gen_vec_widen_smult_even_v8hi (even, operands[1], operands[2])); -- emit_insn (gen_vec_widen_smult_odd_v8hi (odd, operands[1], operands[2])); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmulesh (even, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulosh (odd, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (high, even, odd)); -+ emit_insn (gen_altivec_vmrglw_direct (low, even, odd)); -+ emit_insn (gen_altivec_vpkuwum_direct (operands[0], high, low)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulosh (even, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulesh (odd, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (high, odd, even)); -+ emit_insn (gen_altivec_vmrglw_direct (low, odd, even)); -+ emit_insn (gen_altivec_vpkuwum_direct (operands[0], low, high)); -+ } - -- emit_insn (gen_altivec_vmrghw (high, even, odd)); -- emit_insn (gen_altivec_vmrglw (low, even, odd)); -- -- emit_insn (gen_altivec_vpkuwum (operands[0], high, low)); -- - DONE; - }") - -@@ -744,18 +774,18 @@ - ;; max - - (define_insn "umax<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (umax:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (umax:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vmaxu<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - - (define_insn "smax<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (smax:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (smax:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vmaxs<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -768,18 +798,18 @@ - [(set_attr "type" "veccmp")]) - - (define_insn "umin<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (umin:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (umin:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vminu<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - - (define_insn "smin<mode>3" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (smin:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (smin:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vmins<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -823,9 +853,41 @@ - "vmladduhm %0,%1,%2,%3" - [(set_attr "type" "veccomplex")]) - --(define_insn "altivec_vmrghb" -+(define_expand "altivec_vmrghb" -+ [(use (match_operand:V16QI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (16, GEN_INT (8), GEN_INT (24), GEN_INT (9), GEN_INT (25), -+ GEN_INT (10), GEN_INT (26), GEN_INT (11), GEN_INT (27), -+ GEN_INT (12), GEN_INT (28), GEN_INT (13), GEN_INT (29), -+ GEN_INT (14), GEN_INT (30), GEN_INT (15), GEN_INT (31)); -+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (16, GEN_INT (0), GEN_INT (16), GEN_INT (1), GEN_INT (17), -+ GEN_INT (2), GEN_INT (18), GEN_INT (3), GEN_INT (19), -+ GEN_INT (4), GEN_INT (20), GEN_INT (5), GEN_INT (21), -+ GEN_INT (6), GEN_INT (22), GEN_INT (7), GEN_INT (23)); -+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V16QImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrghb_internal" - [(set (match_operand:V16QI 0 "register_operand" "=v") -- (vec_select:V16QI -+ (vec_select:V16QI - (vec_concat:V32QI - (match_operand:V16QI 1 "register_operand" "v") - (match_operand:V16QI 2 "register_operand" "v")) -@@ -838,12 +900,54 @@ - (const_int 6) (const_int 22) - (const_int 7) (const_int 23)])))] - "TARGET_ALTIVEC" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrghb %0,%1,%2"; -+ else -+ return "vmrglb %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrghb_direct" -+ [(set (match_operand:V16QI 0 "register_operand" "=v") -+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") -+ (match_operand:V16QI 2 "register_operand" "v")] -+ UNSPEC_VMRGH_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrghb %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vmrghh" -+(define_expand "altivec_vmrghh" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (8, GEN_INT (4), GEN_INT (12), GEN_INT (5), GEN_INT (13), -+ GEN_INT (6), GEN_INT (14), GEN_INT (7), GEN_INT (15)); -+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (8, GEN_INT (0), GEN_INT (8), GEN_INT (1), GEN_INT (9), -+ GEN_INT (2), GEN_INT (10), GEN_INT (3), GEN_INT (11)); -+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V8HImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrghh_internal" - [(set (match_operand:V8HI 0 "register_operand" "=v") -- (vec_select:V8HI -+ (vec_select:V8HI - (vec_concat:V16HI - (match_operand:V8HI 1 "register_operand" "v") - (match_operand:V8HI 2 "register_operand" "v")) -@@ -852,10 +956,50 @@ - (const_int 2) (const_int 10) - (const_int 3) (const_int 11)])))] - "TARGET_ALTIVEC" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrghh %0,%1,%2"; -+ else -+ return "vmrglh %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrghh_direct" -+ [(set (match_operand:V8HI 0 "register_operand" "=v") -+ (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") -+ (match_operand:V8HI 2 "register_operand" "v")] -+ UNSPEC_VMRGH_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrghh %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vmrghw" -+(define_expand "altivec_vmrghw" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V4SI 1 "register_operand" "")) -+ (use (match_operand:V4SI 2 "register_operand" ""))] -+ "VECTOR_MEM_ALTIVEC_P (V4SImode)" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (4, GEN_INT (2), GEN_INT (6), GEN_INT (3), GEN_INT (7)); -+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (4, GEN_INT (0), GEN_INT (4), GEN_INT (1), GEN_INT (5)); -+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V4SImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrghw_internal" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (vec_select:V4SI - (vec_concat:V8SI -@@ -864,6 +1008,20 @@ - (parallel [(const_int 0) (const_int 4) - (const_int 1) (const_int 5)])))] - "VECTOR_MEM_ALTIVEC_P (V4SImode)" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrghw %0,%1,%2"; -+ else -+ return "vmrglw %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrghw_direct" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:V4SI 2 "register_operand" "v")] -+ UNSPEC_VMRGH_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrghw %0,%1,%2" - [(set_attr "type" "vecperm")]) - -@@ -876,10 +1034,47 @@ - (parallel [(const_int 0) (const_int 4) - (const_int 1) (const_int 5)])))] - "VECTOR_MEM_ALTIVEC_P (V4SFmode)" -- "vmrghw %0,%1,%2" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrghw %0,%1,%2"; -+ else -+ return "vmrglw %0,%2,%1"; -+} - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vmrglb" -+(define_expand "altivec_vmrglb" -+ [(use (match_operand:V16QI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (16, GEN_INT (0), GEN_INT (16), GEN_INT (1), GEN_INT (17), -+ GEN_INT (2), GEN_INT (18), GEN_INT (3), GEN_INT (19), -+ GEN_INT (4), GEN_INT (20), GEN_INT (5), GEN_INT (21), -+ GEN_INT (6), GEN_INT (22), GEN_INT (7), GEN_INT (23)); -+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (16, GEN_INT (8), GEN_INT (24), GEN_INT (9), GEN_INT (25), -+ GEN_INT (10), GEN_INT (26), GEN_INT (11), GEN_INT (27), -+ GEN_INT (12), GEN_INT (28), GEN_INT (13), GEN_INT (29), -+ GEN_INT (14), GEN_INT (30), GEN_INT (15), GEN_INT (31)); -+ x = gen_rtx_VEC_CONCAT (V32QImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V16QImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrglb_internal" - [(set (match_operand:V16QI 0 "register_operand" "=v") - (vec_select:V16QI - (vec_concat:V32QI -@@ -894,10 +1089,52 @@ - (const_int 14) (const_int 30) - (const_int 15) (const_int 31)])))] - "TARGET_ALTIVEC" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrglb %0,%1,%2"; -+ else -+ return "vmrghb %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrglb_direct" -+ [(set (match_operand:V16QI 0 "register_operand" "=v") -+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") -+ (match_operand:V16QI 2 "register_operand" "v")] -+ UNSPEC_VMRGL_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrglb %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vmrglh" -+(define_expand "altivec_vmrglh" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (8, GEN_INT (0), GEN_INT (8), GEN_INT (1), GEN_INT (9), -+ GEN_INT (2), GEN_INT (10), GEN_INT (3), GEN_INT (11)); -+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (8, GEN_INT (4), GEN_INT (12), GEN_INT (5), GEN_INT (13), -+ GEN_INT (6), GEN_INT (14), GEN_INT (7), GEN_INT (15)); -+ x = gen_rtx_VEC_CONCAT (V16HImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V8HImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrglh_internal" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (vec_select:V8HI - (vec_concat:V16HI -@@ -908,10 +1145,50 @@ - (const_int 6) (const_int 14) - (const_int 7) (const_int 15)])))] - "TARGET_ALTIVEC" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrglh %0,%1,%2"; -+ else -+ return "vmrghh %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrglh_direct" -+ [(set (match_operand:V8HI 0 "register_operand" "=v") -+ (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") -+ (match_operand:V8HI 2 "register_operand" "v")] -+ UNSPEC_VMRGL_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrglh %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vmrglw" -+(define_expand "altivec_vmrglw" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V4SI 1 "register_operand" "")) -+ (use (match_operand:V4SI 2 "register_operand" ""))] -+ "VECTOR_MEM_ALTIVEC_P (V4SImode)" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ v = gen_rtvec (4, GEN_INT (0), GEN_INT (4), GEN_INT (1), GEN_INT (5)); -+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[2], operands[1]); -+ } -+ else -+ { -+ v = gen_rtvec (4, GEN_INT (2), GEN_INT (6), GEN_INT (3), GEN_INT (7)); -+ x = gen_rtx_VEC_CONCAT (V8SImode, operands[1], operands[2]); -+ } -+ -+ x = gen_rtx_VEC_SELECT (V4SImode, x, gen_rtx_PARALLEL (VOIDmode, v)); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vmrglw_internal" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (vec_select:V4SI - (vec_concat:V8SI -@@ -920,6 +1197,20 @@ - (parallel [(const_int 2) (const_int 6) - (const_int 3) (const_int 7)])))] - "VECTOR_MEM_ALTIVEC_P (V4SImode)" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrglw %0,%1,%2"; -+ else -+ return "vmrghw %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vmrglw_direct" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:V4SI 2 "register_operand" "v")] -+ UNSPEC_VMRGL_DIRECT))] -+ "TARGET_ALTIVEC" - "vmrglw %0,%1,%2" - [(set_attr "type" "vecperm")]) - -@@ -932,10 +1223,154 @@ - (parallel [(const_int 2) (const_int 6) - (const_int 3) (const_int 7)])))] - "VECTOR_MEM_ALTIVEC_P (V4SFmode)" -- "vmrglw %0,%1,%2" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrglw %0,%1,%2"; -+ else -+ return "vmrghw %0,%2,%1"; -+} - [(set_attr "type" "vecperm")]) - --(define_insn "vec_widen_umult_even_v16qi" -+;; Power8 vector merge even/odd -+(define_insn "p8_vmrgew" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (vec_select:V4SI -+ (vec_concat:V8SI -+ (match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:V4SI 2 "register_operand" "v")) -+ (parallel [(const_int 0) (const_int 4) -+ (const_int 2) (const_int 6)])))] -+ "TARGET_P8_VECTOR" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrgew %0,%1,%2"; -+ else -+ return "vmrgow %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "p8_vmrgow" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (vec_select:V4SI -+ (vec_concat:V8SI -+ (match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:V4SI 2 "register_operand" "v")) -+ (parallel [(const_int 1) (const_int 5) -+ (const_int 3) (const_int 7)])))] -+ "TARGET_P8_VECTOR" -+{ -+ if (BYTES_BIG_ENDIAN) -+ return "vmrgow %0,%1,%2"; -+ else -+ return "vmrgew %0,%2,%1"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_expand "vec_widen_umult_even_v16qi" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_smult_even_v16qi" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_umult_even_v8hi" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_smult_even_v8hi" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_umult_odd_v16qi" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_smult_odd_v16qi" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:V16QI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_umult_odd_v8hi" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_expand "vec_widen_smult_odd_v8hi" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:V8HI 2 "register_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2])); -+ else -+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2])); -+ DONE; -+}) -+ -+(define_insn "altivec_vmuleub" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") - (match_operand:V16QI 2 "register_operand" "v")] -@@ -944,43 +1379,25 @@ - "vmuleub %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "vec_widen_smult_even_v16qi" -+(define_insn "altivec_vmuloub" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") - (match_operand:V16QI 2 "register_operand" "v")] -- UNSPEC_VMULESB))] -+ UNSPEC_VMULOUB))] - "TARGET_ALTIVEC" -- "vmulesb %0,%1,%2" -+ "vmuloub %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "vec_widen_umult_even_v8hi" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VMULEUH))] -- "TARGET_ALTIVEC" -- "vmuleuh %0,%1,%2" -- [(set_attr "type" "veccomplex")]) -- --(define_insn "vec_widen_smult_even_v8hi" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VMULESH))] -- "TARGET_ALTIVEC" -- "vmulesh %0,%1,%2" -- [(set_attr "type" "veccomplex")]) -- --(define_insn "vec_widen_umult_odd_v16qi" -+(define_insn "altivec_vmulesb" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") - (match_operand:V16QI 2 "register_operand" "v")] -- UNSPEC_VMULOUB))] -+ UNSPEC_VMULESB))] - "TARGET_ALTIVEC" -- "vmuloub %0,%1,%2" -+ "vmulesb %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "vec_widen_smult_odd_v16qi" -+(define_insn "altivec_vmulosb" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") - (match_operand:V16QI 2 "register_operand" "v")] -@@ -989,19 +1406,37 @@ - "vmulosb %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "vec_widen_umult_odd_v8hi" -+(define_insn "altivec_vmuleuh" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") - (match_operand:V8HI 2 "register_operand" "v")] -+ UNSPEC_VMULEUH))] -+ "TARGET_ALTIVEC" -+ "vmuleuh %0,%1,%2" -+ [(set_attr "type" "veccomplex")]) -+ -+(define_insn "altivec_vmulouh" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") -+ (match_operand:V8HI 2 "register_operand" "v")] - UNSPEC_VMULOUH))] - "TARGET_ALTIVEC" - "vmulouh %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "vec_widen_smult_odd_v8hi" -+(define_insn "altivec_vmulesh" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") - (match_operand:V8HI 2 "register_operand" "v")] -+ UNSPEC_VMULESH))] -+ "TARGET_ALTIVEC" -+ "vmulesh %0,%1,%2" -+ [(set_attr "type" "veccomplex")]) -+ -+(define_insn "altivec_vmulosh" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") -+ (match_operand:V8HI 2 "register_operand" "v")] - UNSPEC_VMULOSH))] - "TARGET_ALTIVEC" - "vmulosh %0,%1,%2" -@@ -1008,74 +1443,7 @@ - [(set_attr "type" "veccomplex")]) - - --;; logical ops. Have the logical ops follow the memory ops in --;; terms of whether to prefer VSX or Altivec -- --(define_insn "*altivec_and<mode>3" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (and:VM (match_operand:VM 1 "register_operand" "v") -- (match_operand:VM 2 "register_operand" "v")))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vand %0,%1,%2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*altivec_ior<mode>3" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (ior:VM (match_operand:VM 1 "register_operand" "v") -- (match_operand:VM 2 "register_operand" "v")))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vor %0,%1,%2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*altivec_xor<mode>3" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (xor:VM (match_operand:VM 1 "register_operand" "v") -- (match_operand:VM 2 "register_operand" "v")))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vxor %0,%1,%2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*altivec_one_cmpl<mode>2" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (not:VM (match_operand:VM 1 "register_operand" "v")))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vnor %0,%1,%1" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*altivec_nor<mode>3" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (not:VM (ior:VM (match_operand:VM 1 "register_operand" "v") -- (match_operand:VM 2 "register_operand" "v"))))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vnor %0,%1,%2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "*altivec_andc<mode>3" -- [(set (match_operand:VM 0 "register_operand" "=v") -- (and:VM (not:VM (match_operand:VM 2 "register_operand" "v")) -- (match_operand:VM 1 "register_operand" "v")))] -- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)" -- "vandc %0,%1,%2" -- [(set_attr "type" "vecsimple")]) -- --(define_insn "altivec_vpkuhum" -- [(set (match_operand:V16QI 0 "register_operand" "=v") -- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VPKUHUM))] -- "TARGET_ALTIVEC" -- "vpkuhum %0,%1,%2" -- [(set_attr "type" "vecperm")]) -- --(define_insn "altivec_vpkuwum" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -- (match_operand:V4SI 2 "register_operand" "v")] -- UNSPEC_VPKUWUM))] -- "TARGET_ALTIVEC" -- "vpkuwum %0,%1,%2" -- [(set_attr "type" "vecperm")]) -- -+;; Vector pack/unpack - (define_insn "altivec_vpkpx" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -@@ -1082,74 +1450,95 @@ - (match_operand:V4SI 2 "register_operand" "v")] - UNSPEC_VPKPX))] - "TARGET_ALTIVEC" -- "vpkpx %0,%1,%2" -+ "* -+ { -+ if (VECTOR_ELT_ORDER_BIG) -+ return \"vpkpx %0,%1,%2\"; -+ else -+ return \"vpkpx %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vpkshss" -- [(set (match_operand:V16QI 0 "register_operand" "=v") -- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VPKSHSS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkshss %0,%1,%2" -+(define_insn "altivec_vpks<VI_char>ss" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_SIGN_SIGN_SAT))] -+ "<VI_unit>" -+ "* -+ { -+ if (VECTOR_ELT_ORDER_BIG) -+ return \"vpks<VI_char>ss %0,%1,%2\"; -+ else -+ return \"vpks<VI_char>ss %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vpkswss" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -- (match_operand:V4SI 2 "register_operand" "v")] -- UNSPEC_VPKSWSS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkswss %0,%1,%2" -+(define_insn "altivec_vpks<VI_char>us" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_SIGN_UNS_SAT))] -+ "<VI_unit>" -+ "* -+ { -+ if (VECTOR_ELT_ORDER_BIG) -+ return \"vpks<VI_char>us %0,%1,%2\"; -+ else -+ return \"vpks<VI_char>us %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vpkuhus" -- [(set (match_operand:V16QI 0 "register_operand" "=v") -- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VPKUHUS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkuhus %0,%1,%2" -+(define_insn "altivec_vpku<VI_char>us" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_UNS_UNS_SAT))] -+ "<VI_unit>" -+ "* -+ { -+ if (VECTOR_ELT_ORDER_BIG) -+ return \"vpku<VI_char>us %0,%1,%2\"; -+ else -+ return \"vpku<VI_char>us %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vpkshus" -- [(set (match_operand:V16QI 0 "register_operand" "=v") -- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VPKSHUS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkshus %0,%1,%2" -+(define_insn "altivec_vpku<VI_char>um" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_UNS_UNS_MOD))] -+ "<VI_unit>" -+ "* -+ { -+ if (VECTOR_ELT_ORDER_BIG) -+ return \"vpku<VI_char>um %0,%1,%2\"; -+ else -+ return \"vpku<VI_char>um %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) + | RS6000_BTM_CELL \ + | RS6000_BTM_DFP \ +- | RS6000_BTM_HARD_FLOAT) ++ | RS6000_BTM_HARD_FLOAT \ ++ | RS6000_BTM_LDBL128) --(define_insn "altivec_vpkuwus" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -- (match_operand:V4SI 2 "register_operand" "v")] -- UNSPEC_VPKUWUS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkuwus %0,%1,%2" -+(define_insn "altivec_vpku<VI_char>um_direct" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_UNS_UNS_MOD_DIRECT))] -+ "<VI_unit>" -+ "* -+ { -+ if (BYTES_BIG_ENDIAN) -+ return \"vpku<VI_char>um %0,%1,%2\"; -+ else -+ return \"vpku<VI_char>um %0,%2,%1\"; -+ }" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vpkswus" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -- (match_operand:V4SI 2 "register_operand" "v")] -- UNSPEC_VPKSWUS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -- "TARGET_ALTIVEC" -- "vpkswus %0,%1,%2" -- [(set_attr "type" "vecperm")]) -- - (define_insn "*altivec_vrl<VI_char>" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (rotate:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (rotate:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vrl<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -1172,26 +1561,26 @@ - [(set_attr "type" "vecperm")]) - - (define_insn "*altivec_vsl<VI_char>" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (ashift:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (ashift:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vsl<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - - (define_insn "*altivec_vsr<VI_char>" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (lshiftrt:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (lshiftrt:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vsr<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - - (define_insn "*altivec_vsra<VI_char>" -- [(set (match_operand:VI 0 "register_operand" "=v") -- (ashiftrt:VI (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v")))] -- "TARGET_ALTIVEC" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (ashiftrt:VI2 (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v")))] -+ "<VI_unit>" - "vsra<VI_char> %0,%1,%2" - [(set_attr "type" "vecsimple")]) - -@@ -1233,15 +1622,29 @@ - "vsum4s<VI_char>s %0,%1,%2" - [(set_attr "type" "veccomplex")]) - -+;; FIXME: For the following two patterns, the scratch should only be -+;; allocated for !VECTOR_ELT_ORDER_BIG, and the instructions should -+;; be emitted separately. - (define_insn "altivec_vsum2sws" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") - (match_operand:V4SI 2 "register_operand" "v")] - UNSPEC_VSUM2SWS)) -- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] -+ (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR)) -+ (clobber (match_scratch:V4SI 3 "=v"))] - "TARGET_ALTIVEC" -- "vsum2sws %0,%1,%2" -- [(set_attr "type" "veccomplex")]) -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vsum2sws %0,%1,%2"; -+ else -+ return "vsldoi %3,%2,%2,12\n\tvsum2sws %3,%1,%3\n\tvsldoi %0,%3,%3,4"; -+} -+ [(set_attr "type" "veccomplex") -+ (set (attr "length") -+ (if_then_else -+ (match_test "VECTOR_ELT_ORDER_BIG") -+ (const_string "4") -+ (const_string "12")))]) - - (define_insn "altivec_vsumsws" - [(set (match_operand:V4SI 0 "register_operand" "=v") -@@ -1248,12 +1651,54 @@ - (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") - (match_operand:V4SI 2 "register_operand" "v")] - UNSPEC_VSUMSWS)) -+ (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR)) -+ (clobber (match_scratch:V4SI 3 "=v"))] -+ "TARGET_ALTIVEC" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vsumsws %0,%1,%2"; -+ else -+ return "vspltw %3,%2,0\n\tvsumsws %3,%1,%3\n\tvsldoi %0,%3,%3,12"; -+} -+ [(set_attr "type" "veccomplex") -+ (set (attr "length") -+ (if_then_else -+ (match_test "(VECTOR_ELT_ORDER_BIG)") -+ (const_string "4") -+ (const_string "12")))]) -+ -+(define_insn "altivec_vsumsws_direct" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:V4SI 2 "register_operand" "v")] -+ UNSPEC_VSUMSWS_DIRECT)) - (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] - "TARGET_ALTIVEC" - "vsumsws %0,%1,%2" - [(set_attr "type" "veccomplex")]) - --(define_insn "altivec_vspltb" -+(define_expand "altivec_vspltb" -+ [(use (match_operand:V16QI 0 "register_operand" "")) -+ (use (match_operand:V16QI 1 "register_operand" "")) -+ (use (match_operand:QI 2 "u5bit_cint_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. We have to reflect -+ the actual selected index for the splat in the RTL. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ operands[2] = GEN_INT (15 - INTVAL (operands[2])); -+ -+ v = gen_rtvec (1, operands[2]); -+ x = gen_rtx_VEC_SELECT (QImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); -+ x = gen_rtx_VEC_DUPLICATE (V16QImode, x); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vspltb_internal" - [(set (match_operand:V16QI 0 "register_operand" "=v") - (vec_duplicate:V16QI - (vec_select:QI (match_operand:V16QI 1 "register_operand" "v") -@@ -1260,10 +1705,48 @@ - (parallel - [(match_operand:QI 2 "u5bit_cint_operand" "")]))))] - "TARGET_ALTIVEC" -+{ -+ /* For true LE, this adjusts the selected index. For LE with -+ -maltivec=be, this reverses what was done in the define_expand -+ because the instruction already has big-endian bias. */ -+ if (!BYTES_BIG_ENDIAN) -+ operands[2] = GEN_INT (15 - INTVAL (operands[2])); -+ -+ return "vspltb %0,%1,%2"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vspltb_direct" -+ [(set (match_operand:V16QI 0 "register_operand" "=v") -+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") -+ (match_operand:QI 2 "u5bit_cint_operand" "i")] -+ UNSPEC_VSPLT_DIRECT))] -+ "TARGET_ALTIVEC" - "vspltb %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vsplth" -+(define_expand "altivec_vsplth" -+ [(use (match_operand:V8HI 0 "register_operand" "")) -+ (use (match_operand:V8HI 1 "register_operand" "")) -+ (use (match_operand:QI 2 "u5bit_cint_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. We have to reflect -+ the actual selected index for the splat in the RTL. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ operands[2] = GEN_INT (7 - INTVAL (operands[2])); -+ -+ v = gen_rtvec (1, operands[2]); -+ x = gen_rtx_VEC_SELECT (HImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); -+ x = gen_rtx_VEC_DUPLICATE (V8HImode, x); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vsplth_internal" - [(set (match_operand:V8HI 0 "register_operand" "=v") - (vec_duplicate:V8HI - (vec_select:HI (match_operand:V8HI 1 "register_operand" "v") -@@ -1270,10 +1753,48 @@ - (parallel - [(match_operand:QI 2 "u5bit_cint_operand" "")]))))] - "TARGET_ALTIVEC" -+{ -+ /* For true LE, this adjusts the selected index. For LE with -+ -maltivec=be, this reverses what was done in the define_expand -+ because the instruction already has big-endian bias. */ -+ if (!BYTES_BIG_ENDIAN) -+ operands[2] = GEN_INT (7 - INTVAL (operands[2])); -+ -+ return "vsplth %0,%1,%2"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vsplth_direct" -+ [(set (match_operand:V8HI 0 "register_operand" "=v") -+ (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") -+ (match_operand:QI 2 "u5bit_cint_operand" "i")] -+ UNSPEC_VSPLT_DIRECT))] -+ "TARGET_ALTIVEC" - "vsplth %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vspltw" -+(define_expand "altivec_vspltw" -+ [(use (match_operand:V4SI 0 "register_operand" "")) -+ (use (match_operand:V4SI 1 "register_operand" "")) -+ (use (match_operand:QI 2 "u5bit_cint_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. We have to reflect -+ the actual selected index for the splat in the RTL. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ operands[2] = GEN_INT (3 - INTVAL (operands[2])); -+ -+ v = gen_rtvec (1, operands[2]); -+ x = gen_rtx_VEC_SELECT (SImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); -+ x = gen_rtx_VEC_DUPLICATE (V4SImode, x); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vspltw_internal" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (vec_duplicate:V4SI - (vec_select:SI (match_operand:V4SI 1 "register_operand" "v") -@@ -1280,10 +1801,48 @@ - (parallel - [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))] - "TARGET_ALTIVEC" -+{ -+ /* For true LE, this adjusts the selected index. For LE with -+ -maltivec=be, this reverses what was done in the define_expand -+ because the instruction already has big-endian bias. */ -+ if (!BYTES_BIG_ENDIAN) -+ operands[2] = GEN_INT (3 - INTVAL (operands[2])); -+ -+ return "vspltw %0,%1,%2"; -+} -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "altivec_vspltw_direct" -+ [(set (match_operand:V4SI 0 "register_operand" "=v") -+ (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") -+ (match_operand:QI 2 "u5bit_cint_operand" "i")] -+ UNSPEC_VSPLT_DIRECT))] -+ "TARGET_ALTIVEC" - "vspltw %0,%1,%2" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vspltsf" -+(define_expand "altivec_vspltsf" -+ [(use (match_operand:V4SF 0 "register_operand" "")) -+ (use (match_operand:V4SF 1 "register_operand" "")) -+ (use (match_operand:QI 2 "u5bit_cint_operand" ""))] -+ "TARGET_ALTIVEC" -+{ -+ rtvec v; -+ rtx x; -+ -+ /* Special handling for LE with -maltivec=be. We have to reflect -+ the actual selected index for the splat in the RTL. */ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ operands[2] = GEN_INT (3 - INTVAL (operands[2])); -+ -+ v = gen_rtvec (1, operands[2]); -+ x = gen_rtx_VEC_SELECT (SFmode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); -+ x = gen_rtx_VEC_DUPLICATE (V4SFmode, x); -+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], x)); -+ DONE; -+}) -+ -+(define_insn "*altivec_vspltsf_internal" - [(set (match_operand:V4SF 0 "register_operand" "=v") - (vec_duplicate:V4SF - (vec_select:SF (match_operand:V4SF 1 "register_operand" "v") -@@ -1290,7 +1849,15 @@ - (parallel - [(match_operand:QI 2 "u5bit_cint_operand" "i")]))))] - "VECTOR_UNIT_ALTIVEC_P (V4SFmode)" -- "vspltw %0,%1,%2" -+{ -+ /* For true LE, this adjusts the selected index. For LE with -+ -maltivec=be, this reverses what was done in the define_expand -+ because the instruction already has big-endian bias. */ -+ if (!BYTES_BIG_ENDIAN) -+ operands[2] = GEN_INT (3 - INTVAL (operands[2])); -+ -+ return "vspltw %0,%1,%2"; -+} - [(set_attr "type" "vecperm")]) - - (define_insn "altivec_vspltis<VI_char>" -@@ -1308,7 +1875,7 @@ - "vrfiz %0,%1" - [(set_attr "type" "vecfloat")]) - --(define_insn "altivec_vperm_<mode>" -+(define_expand "altivec_vperm_<mode>" - [(set (match_operand:VM 0 "register_operand" "=v") - (unspec:VM [(match_operand:VM 1 "register_operand" "v") - (match_operand:VM 2 "register_operand" "v") -@@ -1315,10 +1882,25 @@ - (match_operand:V16QI 3 "register_operand" "v")] - UNSPEC_VPERM))] - "TARGET_ALTIVEC" -+{ -+ if (!VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_vec_perm_le (operands); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_vperm_<mode>_internal" -+ [(set (match_operand:VM 0 "register_operand" "=v") -+ (unspec:VM [(match_operand:VM 1 "register_operand" "v") -+ (match_operand:VM 2 "register_operand" "v") -+ (match_operand:V16QI 3 "register_operand" "v")] -+ UNSPEC_VPERM))] -+ "TARGET_ALTIVEC" - "vperm %0,%1,%2,%3" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vperm_<mode>_uns" -+(define_expand "altivec_vperm_<mode>_uns" - [(set (match_operand:VM 0 "register_operand" "=v") - (unspec:VM [(match_operand:VM 1 "register_operand" "v") - (match_operand:VM 2 "register_operand" "v") -@@ -1325,6 +1907,21 @@ - (match_operand:V16QI 3 "register_operand" "v")] - UNSPEC_VPERM_UNS))] - "TARGET_ALTIVEC" -+{ -+ if (!VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_vec_perm_le (operands); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_vperm_<mode>_uns_internal" -+ [(set (match_operand:VM 0 "register_operand" "=v") -+ (unspec:VM [(match_operand:VM 1 "register_operand" "v") -+ (match_operand:VM 2 "register_operand" "v") -+ (match_operand:V16QI 3 "register_operand" "v")] -+ UNSPEC_VPERM_UNS))] -+ "TARGET_ALTIVEC" - "vperm %0,%1,%2,%3" - [(set_attr "type" "vecperm")]) - -@@ -1335,7 +1932,12 @@ - (match_operand:V16QI 3 "register_operand" "")] - UNSPEC_VPERM))] - "TARGET_ALTIVEC" -- "") -+{ -+ if (!BYTES_BIG_ENDIAN) { -+ altivec_expand_vec_perm_le (operands); -+ DONE; -+ } -+}) - - (define_expand "vec_perm_constv16qi" - [(match_operand:V16QI 0 "register_operand" "") -@@ -1476,52 +2078,72 @@ - "vsldoi %0,%1,%2,%3" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupkhsb" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] -- UNSPEC_VUPKHSB))] -- "TARGET_ALTIVEC" -- "vupkhsb %0,%1" -+(define_insn "altivec_vupkhs<VU_char>" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_HI_SIGN))] -+ "<VI_unit>" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vupkhs<VU_char> %0,%1"; -+ else -+ return "vupkls<VU_char> %0,%1"; -+} - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupkhpx" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKHPX))] -- "TARGET_ALTIVEC" -- "vupkhpx %0,%1" -+(define_insn "*altivec_vupkhs<VU_char>_direct" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_HI_SIGN_DIRECT))] -+ "<VI_unit>" -+ "vupkhs<VU_char> %0,%1" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupkhsh" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKHSH))] -- "TARGET_ALTIVEC" -- "vupkhsh %0,%1" -+(define_insn "altivec_vupkls<VU_char>" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_LO_SIGN))] -+ "<VI_unit>" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vupkls<VU_char> %0,%1"; -+ else -+ return "vupkhs<VU_char> %0,%1"; -+} - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupklsb" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] -- UNSPEC_VUPKLSB))] -- "TARGET_ALTIVEC" -- "vupklsb %0,%1" -+(define_insn "*altivec_vupkls<VU_char>_direct" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_LO_SIGN_DIRECT))] -+ "<VI_unit>" -+ "vupkls<VU_char> %0,%1" - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupklpx" -+(define_insn "altivec_vupkhpx" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKLPX))] -+ UNSPEC_VUPKHPX))] - "TARGET_ALTIVEC" -- "vupklpx %0,%1" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vupkhpx %0,%1"; -+ else -+ return "vupklpx %0,%1"; -+} - [(set_attr "type" "vecperm")]) - --(define_insn "altivec_vupklsh" -+(define_insn "altivec_vupklpx" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKLSH))] -+ UNSPEC_VUPKLPX))] - "TARGET_ALTIVEC" -- "vupklsh %0,%1" -+{ -+ if (VECTOR_ELT_ORDER_BIG) -+ return "vupklpx %0,%1"; -+ else -+ return "vupkhpx %0,%1"; -+} - [(set_attr "type" "vecperm")]) - - ;; Compare vectors producing a vector result and a predicate, setting CR6 to -@@ -1528,37 +2150,37 @@ - ;; indicate a combined status - (define_insn "*altivec_vcmpequ<VI_char>_p" - [(set (reg:CC 74) -- (unspec:CC [(eq:CC (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v"))] -+ (unspec:CC [(eq:CC (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v"))] - UNSPEC_PREDICATE)) -- (set (match_operand:VI 0 "register_operand" "=v") -- (eq:VI (match_dup 1) -- (match_dup 2)))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ (set (match_operand:VI2 0 "register_operand" "=v") -+ (eq:VI2 (match_dup 1) -+ (match_dup 2)))] -+ "<VI_unit>" - "vcmpequ<VI_char>. %0,%1,%2" - [(set_attr "type" "veccmp")]) - - (define_insn "*altivec_vcmpgts<VI_char>_p" - [(set (reg:CC 74) -- (unspec:CC [(gt:CC (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v"))] -+ (unspec:CC [(gt:CC (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v"))] - UNSPEC_PREDICATE)) -- (set (match_operand:VI 0 "register_operand" "=v") -- (gt:VI (match_dup 1) -- (match_dup 2)))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ (set (match_operand:VI2 0 "register_operand" "=v") -+ (gt:VI2 (match_dup 1) -+ (match_dup 2)))] -+ "<VI_unit>" - "vcmpgts<VI_char>. %0,%1,%2" - [(set_attr "type" "veccmp")]) - - (define_insn "*altivec_vcmpgtu<VI_char>_p" - [(set (reg:CC 74) -- (unspec:CC [(gtu:CC (match_operand:VI 1 "register_operand" "v") -- (match_operand:VI 2 "register_operand" "v"))] -+ (unspec:CC [(gtu:CC (match_operand:VI2 1 "register_operand" "v") -+ (match_operand:VI2 2 "register_operand" "v"))] - UNSPEC_PREDICATE)) -- (set (match_operand:VI 0 "register_operand" "=v") -- (gtu:VI (match_dup 1) -- (match_dup 2)))] -- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" -+ (set (match_operand:VI2 0 "register_operand" "=v") -+ (gtu:VI2 (match_dup 1) -+ (match_dup 2)))] -+ "<VI_unit>" - "vcmpgtu<VI_char>. %0,%1,%2" - [(set_attr "type" "veccmp")]) - -@@ -1710,12 +2332,26 @@ - ;; Parallel some of the LVE* and STV*'s with unspecs because some have - ;; identical rtl but different instructions-- and gcc gets confused. - --(define_insn "altivec_lve<VI_char>x" -+(define_expand "altivec_lve<VI_char>x" - [(parallel - [(set (match_operand:VI 0 "register_operand" "=v") - (match_operand:VI 1 "memory_operand" "Z")) - (unspec [(const_int 0)] UNSPEC_LVE)])] - "TARGET_ALTIVEC" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_lvx_be (operands[0], operands[1], <MODE>mode, UNSPEC_LVE); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_lve<VI_char>x_internal" -+ [(parallel -+ [(set (match_operand:VI 0 "register_operand" "=v") -+ (match_operand:VI 1 "memory_operand" "Z")) -+ (unspec [(const_int 0)] UNSPEC_LVE)])] -+ "TARGET_ALTIVEC" - "lve<VI_char>x %0,%y1" - [(set_attr "type" "vecload")]) - -@@ -1728,46 +2364,114 @@ - "lvewx %0,%y1" - [(set_attr "type" "vecload")]) - --(define_insn "altivec_lvxl" -+(define_expand "altivec_lvxl_<mode>" - [(parallel -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (match_operand:V4SI 1 "memory_operand" "Z")) -+ [(set (match_operand:VM2 0 "register_operand" "=v") -+ (match_operand:VM2 1 "memory_operand" "Z")) - (unspec [(const_int 0)] UNSPEC_SET_VSCR)])] - "TARGET_ALTIVEC" -- "lvxl %0,%y1" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_lvx_be (operands[0], operands[1], <MODE>mode, UNSPEC_SET_VSCR); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_lvxl_<mode>_internal" -+ [(parallel -+ [(set (match_operand:VM2 0 "register_operand" "=v") -+ (match_operand:VM2 1 "memory_operand" "Z")) -+ (unspec [(const_int 0)] UNSPEC_SET_VSCR)])] -+ "TARGET_ALTIVEC" -+ "lvx %0,%y1" - [(set_attr "type" "vecload")]) - --(define_insn "altivec_lvx_<mode>" -+(define_expand "altivec_lvx_<mode>" - [(parallel - [(set (match_operand:VM2 0 "register_operand" "=v") - (match_operand:VM2 1 "memory_operand" "Z")) - (unspec [(const_int 0)] UNSPEC_LVX)])] - "TARGET_ALTIVEC" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_lvx_be (operands[0], operands[1], <MODE>mode, UNSPEC_LVX); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_lvx_<mode>_internal" -+ [(parallel -+ [(set (match_operand:VM2 0 "register_operand" "=v") -+ (match_operand:VM2 1 "memory_operand" "Z")) -+ (unspec [(const_int 0)] UNSPEC_LVX)])] -+ "TARGET_ALTIVEC" - "lvx %0,%y1" - [(set_attr "type" "vecload")]) - --(define_insn "altivec_stvx_<mode>" -+(define_expand "altivec_stvx_<mode>" - [(parallel - [(set (match_operand:VM2 0 "memory_operand" "=Z") - (match_operand:VM2 1 "register_operand" "v")) - (unspec [(const_int 0)] UNSPEC_STVX)])] - "TARGET_ALTIVEC" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_stvx_be (operands[0], operands[1], <MODE>mode, UNSPEC_STVX); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_stvx_<mode>_internal" -+ [(parallel -+ [(set (match_operand:VM2 0 "memory_operand" "=Z") -+ (match_operand:VM2 1 "register_operand" "v")) -+ (unspec [(const_int 0)] UNSPEC_STVX)])] -+ "TARGET_ALTIVEC" - "stvx %1,%y0" - [(set_attr "type" "vecstore")]) - --(define_insn "altivec_stvxl" -+(define_expand "altivec_stvxl_<mode>" - [(parallel -- [(set (match_operand:V4SI 0 "memory_operand" "=Z") -- (match_operand:V4SI 1 "register_operand" "v")) -+ [(set (match_operand:VM2 0 "memory_operand" "=Z") -+ (match_operand:VM2 1 "register_operand" "v")) - (unspec [(const_int 0)] UNSPEC_STVXL)])] - "TARGET_ALTIVEC" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_stvx_be (operands[0], operands[1], <MODE>mode, UNSPEC_STVXL); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_stvxl_<mode>_internal" -+ [(parallel -+ [(set (match_operand:VM2 0 "memory_operand" "=Z") -+ (match_operand:VM2 1 "register_operand" "v")) -+ (unspec [(const_int 0)] UNSPEC_STVXL)])] -+ "TARGET_ALTIVEC" - "stvxl %1,%y0" - [(set_attr "type" "vecstore")]) - --(define_insn "altivec_stve<VI_char>x" -+(define_expand "altivec_stve<VI_char>x" - [(set (match_operand:<VI_scalar> 0 "memory_operand" "=Z") - (unspec:<VI_scalar> [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVE))] - "TARGET_ALTIVEC" -+{ -+ if (!BYTES_BIG_ENDIAN && VECTOR_ELT_ORDER_BIG) -+ { -+ altivec_expand_stvex_be (operands[0], operands[1], <MODE>mode, UNSPEC_STVE); -+ DONE; -+ } -+}) -+ -+(define_insn "*altivec_stve<VI_char>x_internal" -+ [(set (match_operand:<VI_scalar> 0 "memory_operand" "=Z") -+ (unspec:<VI_scalar> [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVE))] -+ "TARGET_ALTIVEC" - "stve<VI_char>x %1,%y0" - [(set_attr "type" "vecstore")]) - -@@ -1779,20 +2483,28 @@ - [(set_attr "type" "vecstore")]) - - ;; Generate --;; vspltis? SCRATCH0,0 -+;; xxlxor/vxor SCRATCH0,SCRATCH0,SCRATCH0 - ;; vsubu?m SCRATCH2,SCRATCH1,%1 - ;; vmaxs? %0,%1,SCRATCH2" - (define_expand "abs<mode>2" -- [(set (match_dup 2) (vec_duplicate:VI (const_int 0))) -- (set (match_dup 3) -- (minus:VI (match_dup 2) -- (match_operand:VI 1 "register_operand" "v"))) -- (set (match_operand:VI 0 "register_operand" "=v") -- (smax:VI (match_dup 1) (match_dup 3)))] -- "TARGET_ALTIVEC" -+ [(set (match_dup 2) (match_dup 3)) -+ (set (match_dup 4) -+ (minus:VI2 (match_dup 2) -+ (match_operand:VI2 1 "register_operand" "v"))) -+ (set (match_operand:VI2 0 "register_operand" "=v") -+ (smax:VI2 (match_dup 1) (match_dup 4)))] -+ "<VI_unit>" - { -- operands[2] = gen_reg_rtx (GET_MODE (operands[0])); -- operands[3] = gen_reg_rtx (GET_MODE (operands[0])); -+ int i, n_elt = GET_MODE_NUNITS (<MODE>mode); -+ rtvec v = rtvec_alloc (n_elt); -+ -+ /* Create an all 0 constant. */ -+ for (i = 0; i < n_elt; ++i) -+ RTVEC_ELT (v, i) = const0_rtx; -+ -+ operands[2] = gen_reg_rtx (<MODE>mode); -+ operands[3] = gen_rtx_CONST_VECTOR (<MODE>mode, v); -+ operands[4] = gen_reg_rtx (<MODE>mode); - }) - - ;; Generate -@@ -1844,7 +2556,7 @@ - - emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); - emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero)); -- emit_insn (gen_altivec_vsumsws (dest, vtmp1, vzero)); -+ emit_insn (gen_altivec_vsumsws_direct (dest, vtmp1, vzero)); - DONE; - }) - -@@ -1860,7 +2572,7 @@ - - emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); - emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero)); -- emit_insn (gen_altivec_vsumsws (dest, vtmp1, vzero)); -+ emit_insn (gen_altivec_vsumsws_direct (dest, vtmp1, vzero)); - DONE; - }) - -@@ -1950,50 +2662,20 @@ - DONE; - }") - --(define_expand "vec_unpacks_hi_v16qi" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] -- UNSPEC_VUPKHSB))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vupkhsb (operands[0], operands[1])); -- DONE; --}") -+(define_expand "vec_unpacks_hi_<VP_small_lc>" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_HI_SIGN_DIRECT))] -+ "<VI_unit>" -+ "") - --(define_expand "vec_unpacks_hi_v8hi" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKHSH))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vupkhsh (operands[0], operands[1])); -- DONE; --}") -+(define_expand "vec_unpacks_lo_<VP_small_lc>" -+ [(set (match_operand:VP 0 "register_operand" "=v") -+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] -+ UNSPEC_VUNPACK_LO_SIGN_DIRECT))] -+ "<VI_unit>" -+ "") - --(define_expand "vec_unpacks_lo_v16qi" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")] -- UNSPEC_VUPKLSB))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vupklsb (operands[0], operands[1])); -- DONE; --}") -- --(define_expand "vec_unpacks_lo_v8hi" -- [(set (match_operand:V4SI 0 "register_operand" "=v") -- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] -- UNSPEC_VUPKLSH))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vupklsh (operands[0], operands[1])); -- DONE; --}") -- - (define_insn "vperm_v8hiv4si" - [(set (match_operand:V4SI 0 "register_operand" "=v") - (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") -@@ -2025,25 +2707,26 @@ - rtx vzero = gen_reg_rtx (V8HImode); - rtx mask = gen_reg_rtx (V16QImode); - rtvec v = rtvec_alloc (16); -+ bool be = BYTES_BIG_ENDIAN; - - emit_insn (gen_altivec_vspltish (vzero, const0_rtx)); - -- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0); -- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1); -- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2); -- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3); -- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4); -- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5); -- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6); -- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7); -+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 7); -+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 0 : 16); -+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 16 : 6); -+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 1 : 16); -+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 5); -+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 2 : 16); -+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 16 : 4); -+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 3 : 16); -+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 3); -+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 4 : 16); -+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 : 2); -+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 5 : 16); -+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 1); -+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 6 : 16); -+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 : 0); -+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 7 : 16); - - emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v))); - emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask)); -@@ -2060,25 +2743,26 @@ - rtx vzero = gen_reg_rtx (V4SImode); - rtx mask = gen_reg_rtx (V16QImode); - rtvec v = rtvec_alloc (16); -+ bool be = BYTES_BIG_ENDIAN; - - emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); - -- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0); -- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1); -- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2); -- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3); -- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4); -- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5); -- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6); -- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7); -+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 7); -+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 17 : 6); -+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 0 : 17); -+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 1 : 16); -+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 5); -+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 17 : 4); -+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 2 : 17); -+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 3 : 16); -+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 3); -+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 17 : 2); -+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 4 : 17); -+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 5 : 16); -+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 1); -+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 : 0); -+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 6 : 17); -+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 7 : 16); - - emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v))); - emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask)); -@@ -2095,25 +2779,26 @@ - rtx vzero = gen_reg_rtx (V8HImode); - rtx mask = gen_reg_rtx (V16QImode); - rtvec v = rtvec_alloc (16); -+ bool be = BYTES_BIG_ENDIAN; - - emit_insn (gen_altivec_vspltish (vzero, const0_rtx)); - -- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8); -- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9); -- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10); -- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11); -- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12); -- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13); -- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14); -- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15); -+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15); -+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 8 : 16); -+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 16 : 14); -+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 9 : 16); -+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13); -+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 10 : 16); -+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 16 : 12); -+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16); -+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11); -+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 12 : 16); -+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 : 10); -+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16); -+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 9); -+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 14 : 16); -+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 : 8); -+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16); - - emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v))); - emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask)); -@@ -2130,25 +2815,26 @@ - rtx vzero = gen_reg_rtx (V4SImode); - rtx mask = gen_reg_rtx (V16QImode); - rtvec v = rtvec_alloc (16); -+ bool be = BYTES_BIG_ENDIAN; - - emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); - -- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8); -- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9); -- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10); -- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11); -- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12); -- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13); -- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16); -- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17); -- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14); -- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15); -+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15); -+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 17 : 14); -+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 8 : 17); -+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 9 : 16); -+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13); -+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 17 : 12); -+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 10 : 17); -+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16); -+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11); -+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 17 : 10); -+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 12 : 17); -+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16); -+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 9); -+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 : 8); -+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 14 : 17); -+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16); - - emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v))); - emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask)); -@@ -2166,9 +2852,18 @@ - rtx ve = gen_reg_rtx (V8HImode); - rtx vo = gen_reg_rtx (V8HImode); - -- emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghh_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghh_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2183,9 +2878,18 @@ - rtx ve = gen_reg_rtx (V8HImode); - rtx vo = gen_reg_rtx (V8HImode); - -- emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglh_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglh_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2200,9 +2904,18 @@ - rtx ve = gen_reg_rtx (V8HImode); - rtx vo = gen_reg_rtx (V8HImode); - -- emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghh_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghh_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2217,9 +2930,18 @@ - rtx ve = gen_reg_rtx (V8HImode); - rtx vo = gen_reg_rtx (V8HImode); - -- emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglh_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglh_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2234,9 +2956,18 @@ - rtx ve = gen_reg_rtx (V4SImode); - rtx vo = gen_reg_rtx (V4SImode); - -- emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2251,9 +2982,18 @@ - rtx ve = gen_reg_rtx (V4SImode); - rtx vo = gen_reg_rtx (V4SImode); - -- emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglw_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglw_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2268,9 +3008,18 @@ - rtx ve = gen_reg_rtx (V4SImode); - rtx vo = gen_reg_rtx (V4SImode); - -- emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrghw_direct (operands[0], vo, ve)); -+ } - DONE; - }") - -@@ -2285,35 +3034,28 @@ - rtx ve = gen_reg_rtx (V4SImode); - rtx vo = gen_reg_rtx (V4SImode); - -- emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2])); -- emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2])); -- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); -+ if (BYTES_BIG_ENDIAN) -+ { -+ emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglw_direct (operands[0], ve, vo)); -+ } -+ else -+ { -+ emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2])); -+ emit_insn (gen_altivec_vmrglw_direct (operands[0], vo, ve)); -+ } - DONE; - }") - --(define_expand "vec_pack_trunc_v8hi" -- [(set (match_operand:V16QI 0 "register_operand" "=v") -- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") -- (match_operand:V8HI 2 "register_operand" "v")] -- UNSPEC_VPKUHUM))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2])); -- DONE; --}") -- --(define_expand "vec_pack_trunc_v4si" -- [(set (match_operand:V8HI 0 "register_operand" "=v") -- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") -- (match_operand:V4SI 2 "register_operand" "v")] -- UNSPEC_VPKUWUM))] -- "TARGET_ALTIVEC" -- " --{ -- emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2])); -- DONE; --}") -+(define_expand "vec_pack_trunc_<mode>" -+ [(set (match_operand:<VP_small> 0 "register_operand" "=v") -+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") -+ (match_operand:VP 2 "register_operand" "v")] -+ UNSPEC_VPACK_UNS_UNS_MOD))] -+ "<VI_unit>" -+ "") - - (define_expand "altivec_negv4sf2" - [(use (match_operand:V4SF 0 "register_operand" "")) -@@ -2460,3 +3202,123 @@ - emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx)); - DONE; - }") -+ -+ -+;; Power8 vector instructions encoded as Altivec instructions -+ -+;; Vector count leading zeros -+(define_insn "*p8v_clz<mode>2" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (clz:VI2 (match_operand:VI2 1 "register_operand" "v")))] -+ "TARGET_P8_VECTOR" -+ "vclz<wd> %0,%1" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+;; Vector population count -+(define_insn "*p8v_popcount<mode>2" -+ [(set (match_operand:VI2 0 "register_operand" "=v") -+ (popcount:VI2 (match_operand:VI2 1 "register_operand" "v")))] -+ "TARGET_P8_VECTOR" -+ "vpopcnt<wd> %0,%1" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+;; Vector Gather Bits by Bytes by Doubleword -+(define_insn "p8v_vgbbd" -+ [(set (match_operand:V16QI 0 "register_operand" "=v") -+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")] -+ UNSPEC_VGBBD))] -+ "TARGET_P8_VECTOR" -+ "vgbbd %0,%1" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+ -+;; 128-bit binary integer arithmetic -+;; We have a special container type (V1TImode) to allow operations using the -+;; ISA 2.07 128-bit binary support to target the VMX/altivec registers without -+;; having to worry about the register allocator deciding GPRs are better. -+ -+(define_insn "altivec_vadduqm" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (plus:V1TI (match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v")))] -+ "TARGET_VADDUQM" -+ "vadduqm %0,%1,%2" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vaddcuq" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v")] -+ UNSPEC_VADDCUQ))] -+ "TARGET_VADDUQM" -+ "vaddcuq %0,%1,%2" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vsubuqm" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (minus:V1TI (match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v")))] -+ "TARGET_VADDUQM" -+ "vsubuqm %0,%1,%2" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vsubcuq" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v")] -+ UNSPEC_VSUBCUQ))] -+ "TARGET_VADDUQM" -+ "vsubcuq %0,%1,%2" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vaddeuqm" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v") -+ (match_operand:V1TI 3 "register_operand" "v")] -+ UNSPEC_VADDEUQM))] -+ "TARGET_VADDUQM" -+ "vaddeuqm %0,%1,%2,%3" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vaddecuq" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v") -+ (match_operand:V1TI 3 "register_operand" "v")] -+ UNSPEC_VADDECUQ))] -+ "TARGET_VADDUQM" -+ "vaddecuq %0,%1,%2,%3" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vsubeuqm" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v") -+ (match_operand:V1TI 3 "register_operand" "v")] -+ UNSPEC_VSUBEUQM))] -+ "TARGET_VADDUQM" -+ "vsubeuqm %0,%1,%2,%3" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -+(define_insn "altivec_vsubecuq" -+ [(set (match_operand:V1TI 0 "register_operand" "=v") -+ (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") -+ (match_operand:V1TI 2 "register_operand" "v") -+ (match_operand:V1TI 3 "register_operand" "v")] -+ UNSPEC_VSUBECUQ))] -+ "TARGET_VADDUQM" -+ "vsubecuq %0,%1,%2,%3" -+ [(set_attr "length" "4") -+ (set_attr "type" "vecsimple")]) -+ -Index: gcc/config/rs6000/sysv4le.h -=================================================================== ---- a/src/gcc/config/rs6000/sysv4le.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/sysv4le.h (.../branches/gcc-4_8-branch) -@@ -22,9 +22,6 @@ - #undef TARGET_DEFAULT - #define TARGET_DEFAULT MASK_LITTLE_ENDIAN - --#undef CC1_ENDIAN_DEFAULT_SPEC --#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_little)" -- - #undef DEFAULT_ASM_ENDIAN - #define DEFAULT_ASM_ENDIAN " -mlittle" - -@@ -34,3 +31,7 @@ - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" } -+ -+/* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */ -+#define LINUX64_DEFAULT_ABI_ELFv2 -+ -Index: gcc/config/rs6000/dfp.md -=================================================================== ---- a/src/gcc/config/rs6000/dfp.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/dfp.md (.../branches/gcc-4_8-branch) -@@ -29,77 +29,6 @@ - ]) - - --(define_expand "movsd" -- [(set (match_operand:SD 0 "nonimmediate_operand" "") -- (match_operand:SD 1 "any_operand" ""))] -- "TARGET_HARD_FLOAT && TARGET_FPRS" -- "{ rs6000_emit_move (operands[0], operands[1], SDmode); DONE; }") -- --(define_split -- [(set (match_operand:SD 0 "gpc_reg_operand" "") -- (match_operand:SD 1 "const_double_operand" ""))] -- "reload_completed -- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) -- || (GET_CODE (operands[0]) == SUBREG -- && GET_CODE (SUBREG_REG (operands[0])) == REG -- && REGNO (SUBREG_REG (operands[0])) <= 31))" -- [(set (match_dup 2) (match_dup 3))] -- " --{ -- long l; -- REAL_VALUE_TYPE rv; -- -- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l); -- -- if (! TARGET_POWERPC64) -- operands[2] = operand_subword (operands[0], 0, 0, SDmode); -- else -- operands[2] = gen_lowpart (SImode, operands[0]); -- -- operands[3] = gen_int_mode (l, SImode); --}") -- --(define_insn "movsd_hardfloat" -- [(set (match_operand:SD 0 "nonimmediate_operand" "=r,r,m,f,*c*l,!r,*h,!r,!r") -- (match_operand:SD 1 "input_operand" "r,m,r,f,r,h,0,G,Fn"))] -- "(gpc_reg_operand (operands[0], SDmode) -- || gpc_reg_operand (operands[1], SDmode)) -- && (TARGET_HARD_FLOAT && TARGET_FPRS)" -- "@ -- mr %0,%1 -- lwz%U1%X1 %0,%1 -- stw%U0%X0 %1,%0 -- fmr %0,%1 -- mt%0 %1 -- mf%1 %0 -- nop -- # -- #" -- [(set_attr "type" "*,load,store,fp,mtjmpr,mfjmpr,*,*,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,8")]) -- --(define_insn "movsd_softfloat" -- [(set (match_operand:SD 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,r,*h") -- (match_operand:SD 1 "input_operand" "r,r,h,m,r,I,L,R,G,Fn,0"))] -- "(gpc_reg_operand (operands[0], SDmode) -- || gpc_reg_operand (operands[1], SDmode)) -- && (TARGET_SOFT_FLOAT || !TARGET_FPRS)" -- "@ -- mr %0,%1 -- mt%0 %1 -- mf%1 %0 -- lwz%U1%X1 %0,%1 -- stw%U0%X0 %1,%0 -- li %0,%1 -- lis %0,%v1 -- la %0,%a1 -- # -- # -- nop" -- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,4")]) -- - (define_insn "movsd_store" - [(set (match_operand:DD 0 "nonimmediate_operand" "=m") - (unspec:DD [(match_operand:SD 1 "input_operand" "d")] -@@ -108,7 +37,14 @@ - || gpc_reg_operand (operands[1], SDmode)) - && TARGET_HARD_FLOAT && TARGET_FPRS" - "stfd%U0%X0 %1,%0" -- [(set_attr "type" "fpstore") -+ [(set (attr "type") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore")))) - (set_attr "length" "4")]) - - (define_insn "movsd_load" -@@ -119,7 +55,14 @@ - || gpc_reg_operand (operands[1], DDmode)) - && TARGET_HARD_FLOAT && TARGET_FPRS" - "lfd%U1%X1 %0,%1" -- [(set_attr "type" "fpload") -+ [(set (attr "type") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload")))) - (set_attr "length" "4")]) - - ;; Hardware support for decimal floating point operations. -@@ -182,211 +125,6 @@ - "fnabs %0,%1" - [(set_attr "type" "fp")]) - --(define_expand "movdd" -- [(set (match_operand:DD 0 "nonimmediate_operand" "") -- (match_operand:DD 1 "any_operand" ""))] -- "" -- "{ rs6000_emit_move (operands[0], operands[1], DDmode); DONE; }") -- --(define_split -- [(set (match_operand:DD 0 "gpc_reg_operand" "") -- (match_operand:DD 1 "const_int_operand" ""))] -- "! TARGET_POWERPC64 && reload_completed -- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) -- || (GET_CODE (operands[0]) == SUBREG -- && GET_CODE (SUBREG_REG (operands[0])) == REG -- && REGNO (SUBREG_REG (operands[0])) <= 31))" -- [(set (match_dup 2) (match_dup 4)) -- (set (match_dup 3) (match_dup 1))] -- " --{ -- int endian = (WORDS_BIG_ENDIAN == 0); -- HOST_WIDE_INT value = INTVAL (operands[1]); -- -- operands[2] = operand_subword (operands[0], endian, 0, DDmode); -- operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode); --#if HOST_BITS_PER_WIDE_INT == 32 -- operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx; --#else -- operands[4] = GEN_INT (value >> 32); -- operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000); --#endif --}") -- --(define_split -- [(set (match_operand:DD 0 "gpc_reg_operand" "") -- (match_operand:DD 1 "const_double_operand" ""))] -- "! TARGET_POWERPC64 && reload_completed -- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) -- || (GET_CODE (operands[0]) == SUBREG -- && GET_CODE (SUBREG_REG (operands[0])) == REG -- && REGNO (SUBREG_REG (operands[0])) <= 31))" -- [(set (match_dup 2) (match_dup 4)) -- (set (match_dup 3) (match_dup 5))] -- " --{ -- int endian = (WORDS_BIG_ENDIAN == 0); -- long l[2]; -- REAL_VALUE_TYPE rv; -- -- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l); -- -- operands[2] = operand_subword (operands[0], endian, 0, DDmode); -- operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode); -- operands[4] = gen_int_mode (l[endian], SImode); -- operands[5] = gen_int_mode (l[1 - endian], SImode); --}") -- --(define_split -- [(set (match_operand:DD 0 "gpc_reg_operand" "") -- (match_operand:DD 1 "const_double_operand" ""))] -- "TARGET_POWERPC64 && reload_completed -- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) -- || (GET_CODE (operands[0]) == SUBREG -- && GET_CODE (SUBREG_REG (operands[0])) == REG -- && REGNO (SUBREG_REG (operands[0])) <= 31))" -- [(set (match_dup 2) (match_dup 3))] -- " --{ -- int endian = (WORDS_BIG_ENDIAN == 0); -- long l[2]; -- REAL_VALUE_TYPE rv; --#if HOST_BITS_PER_WIDE_INT >= 64 -- HOST_WIDE_INT val; --#endif -- -- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l); -- -- operands[2] = gen_lowpart (DImode, operands[0]); -- /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */ --#if HOST_BITS_PER_WIDE_INT >= 64 -- val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32 -- | ((HOST_WIDE_INT)(unsigned long)l[1 - endian])); -- -- operands[3] = gen_int_mode (val, DImode); --#else -- operands[3] = immed_double_const (l[1 - endian], l[endian], DImode); --#endif --}") -- --;; Don't have reload use general registers to load a constant. First, --;; it might not work if the output operand is the equivalent of --;; a non-offsettable memref, but also it is less efficient than loading --;; the constant into an FP register, since it will probably be used there. --;; The "??" is a kludge until we can figure out a more reasonable way --;; of handling these non-offsettable values. --(define_insn "*movdd_hardfloat32" -- [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r") -- (match_operand:DD 1 "input_operand" "r,m,r,d,m,d,G,H,F"))] -- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS -- && (gpc_reg_operand (operands[0], DDmode) -- || gpc_reg_operand (operands[1], DDmode))" -- "* --{ -- switch (which_alternative) -- { -- default: -- gcc_unreachable (); -- case 0: -- case 1: -- case 2: -- return \"#\"; -- case 3: -- return \"fmr %0,%1\"; -- case 4: -- return \"lfd%U1%X1 %0,%1\"; -- case 5: -- return \"stfd%U0%X0 %1,%0\"; -- case 6: -- case 7: -- case 8: -- return \"#\"; -- } --}" -- [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*") -- (set_attr "length" "8,16,16,4,4,4,8,12,16")]) -- --(define_insn "*movdd_softfloat32" -- [(set (match_operand:DD 0 "nonimmediate_operand" "=r,r,m,r,r,r") -- (match_operand:DD 1 "input_operand" "r,m,r,G,H,F"))] -- "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) -- && (gpc_reg_operand (operands[0], DDmode) -- || gpc_reg_operand (operands[1], DDmode))" -- "#" -- [(set_attr "type" "two,load,store,*,*,*") -- (set_attr "length" "8,8,8,8,12,16")]) -- --; ld/std require word-aligned displacements -> 'Y' constraint. --; List Y->r and r->Y before r->r for reload. --(define_insn "*movdd_hardfloat64_mfpgpr" -- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d") -- (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))] -- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS -- && (gpc_reg_operand (operands[0], DDmode) -- || gpc_reg_operand (operands[1], DDmode))" -- "@ -- std%U0%X0 %1,%0 -- ld%U1%X1 %0,%1 -- mr %0,%1 -- fmr %0,%1 -- lfd%U1%X1 %0,%1 -- stfd%U0%X0 %1,%0 -- mt%0 %1 -- mf%1 %0 -- nop -- # -- # -- # -- mftgpr %0,%1 -- mffgpr %0,%1" -- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")]) -- --; ld/std require word-aligned displacements -> 'Y' constraint. --; List Y->r and r->Y before r->r for reload. --(define_insn "*movdd_hardfloat64" -- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r") -- (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))] -- "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS -- && (gpc_reg_operand (operands[0], DDmode) -- || gpc_reg_operand (operands[1], DDmode))" -- "@ -- std%U0%X0 %1,%0 -- ld%U1%X1 %0,%1 -- mr %0,%1 -- fmr %0,%1 -- lfd%U1%X1 %0,%1 -- stfd%U0%X0 %1,%0 -- mt%0 %1 -- mf%1 %0 -- nop -- # -- # -- #" -- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")]) -- --(define_insn "*movdd_softfloat64" -- [(set (match_operand:DD 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h") -- (match_operand:DD 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))] -- "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) -- && (gpc_reg_operand (operands[0], DDmode) -- || gpc_reg_operand (operands[1], DDmode))" -- "@ -- ld%U1%X1 %0,%1 -- std%U0%X0 %1,%0 -- mr %0,%1 -- mt%0 %1 -- mf%1 %0 -- # -- # -- # -- nop" -- [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*") -- (set_attr "length" "4,4,4,4,4,8,12,16,4")]) -- - (define_expand "negtd2" - [(set (match_operand:TD 0 "gpc_reg_operand" "") - (neg:TD (match_operand:TD 1 "gpc_reg_operand" "")))] -@@ -410,40 +148,25 @@ - "") - - (define_insn "*abstd2_fpr" -- [(set (match_operand:TD 0 "gpc_reg_operand" "=d") -- (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d")))] -+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") -+ (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS" -- "fabs %0,%1" -- [(set_attr "type" "fp")]) -+ "@ -+ fabs %0,%1 -+ fabs %0,%1\;fmr %L0,%L1" -+ [(set_attr "type" "fp") -+ (set_attr "length" "4,8")]) + /* Define builtin enum index. */ - (define_insn "*nabstd2_fpr" -- [(set (match_operand:TD 0 "gpc_reg_operand" "=d") -- (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d"))))] -+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") -+ (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS" -- "fnabs %0,%1" -- [(set_attr "type" "fp")]) -+ "@ -+ fnabs %0,%1 -+ fnabs %0,%1\;fmr %L0,%L1" -+ [(set_attr "type" "fp") -+ (set_attr "length" "4,8")]) - --(define_expand "movtd" -- [(set (match_operand:TD 0 "general_operand" "") -- (match_operand:TD 1 "any_operand" ""))] -- "TARGET_HARD_FLOAT && TARGET_FPRS" -- "{ rs6000_emit_move (operands[0], operands[1], TDmode); DONE; }") -- --; It's important to list the Y->r and r->Y moves before r->r because --; otherwise reload, given m->r, will try to pick r->r and reload it, --; which doesn't make progress. --(define_insn_and_split "*movtd_internal" -- [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r") -- (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))] -- "TARGET_HARD_FLOAT && TARGET_FPRS -- && (gpc_reg_operand (operands[0], TDmode) -- || gpc_reg_operand (operands[1], TDmode))" -- "#" -- "&& reload_completed" -- [(pc)] --{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; } -- [(set_attr "length" "8,8,8,20,20,16")]) -- - ;; Hardware support for decimal floating point operations. - - (define_insn "extendddtd2" -Index: gcc/config/rs6000/t-linux64 -=================================================================== ---- a/src/gcc/config/rs6000/t-linux64 (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/t-linux64 (.../branches/gcc-4_8-branch) -@@ -25,8 +25,8 @@ - # it doesn't tell anything about the 32bit libraries on those systems. Set - # MULTILIB_OSDIRNAMES according to what is found on the target. - --MULTILIB_OPTIONS = m64/m32 --MULTILIB_DIRNAMES = 64 32 --MULTILIB_EXTRA_OPTS = fPIC --MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:powerpc64-linux-gnu) --MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) -+MULTILIB_OPTIONS := m64/m32 -+MULTILIB_DIRNAMES := 64 32 -+MULTILIB_EXTRA_OPTS := -+MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) -+MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) -Index: gcc/config/rs6000/sync.md -=================================================================== ---- a/src/gcc/config/rs6000/sync.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/sync.md (.../branches/gcc-4_8-branch) -@@ -1,5 +1,5 @@ - ;; Machine description for PowerPC synchronization instructions. --;; Copyright (C) 2005-2013 Free Software Foundation, Inc. -+;; Copyright (C) 2005-2014 Free Software Foundation, Inc. - ;; Contributed by Geoffrey Keating. - - ;; This file is part of GCC. -@@ -18,14 +18,23 @@ - ;; along with GCC; see the file COPYING3. If not see - ;; <http://www.gnu.org/licenses/>. - --(define_mode_attr larx [(SI "lwarx") (DI "ldarx")]) --(define_mode_attr stcx [(SI "stwcx.") (DI "stdcx.")]) -+(define_mode_attr larx [(QI "lbarx") -+ (HI "lharx") -+ (SI "lwarx") -+ (DI "ldarx") -+ (TI "lqarx")]) - -+(define_mode_attr stcx [(QI "stbcx.") -+ (HI "sthcx.") -+ (SI "stwcx.") -+ (DI "stdcx.") -+ (TI "stqcx.")]) -+ - (define_code_iterator FETCHOP [plus minus ior xor and]) - (define_code_attr fetchop_name - [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")]) - (define_code_attr fetchop_pred -- [(plus "add_operand") (minus "gpc_reg_operand") -+ [(plus "add_operand") (minus "int_reg_operand") - (ior "logical_operand") (xor "logical_operand") (and "and_operand")]) - - (define_expand "mem_thread_fence" -@@ -129,16 +138,7 @@ - case MEMMODEL_CONSUME: - case MEMMODEL_ACQUIRE: - case MEMMODEL_SEQ_CST: -- if (GET_MODE (operands[0]) == QImode) -- emit_insn (gen_loadsync_qi (operands[0])); -- else if (GET_MODE (operands[0]) == HImode) -- emit_insn (gen_loadsync_hi (operands[0])); -- else if (GET_MODE (operands[0]) == SImode) -- emit_insn (gen_loadsync_si (operands[0])); -- else if (GET_MODE (operands[0]) == DImode) -- emit_insn (gen_loadsync_di (operands[0])); -- else -- gcc_unreachable (); -+ emit_insn (gen_loadsync_<mode> (operands[0])); - break; - default: - gcc_unreachable (); -@@ -170,14 +170,26 @@ - DONE; - }) - --;; ??? Power ISA 2.06B says that there *is* a load-{byte,half}-and-reserve --;; opcode that is "phased-in". Not implemented as of Power7, so not yet used, --;; but let's prepare the macros anyway. -+;; Any supported integer mode that has atomic l<x>arx/st<x>cx. instrucitons -+;; other than the quad memory operations, which have special restrictions. -+;; Byte/halfword atomic instructions were added in ISA 2.06B, but were phased -+;; in and did not show up until power8. TImode atomic lqarx/stqcx. require -+;; special handling due to even/odd register requirements. -+(define_mode_iterator ATOMIC [(QI "TARGET_SYNC_HI_QI") -+ (HI "TARGET_SYNC_HI_QI") -+ SI -+ (DI "TARGET_POWERPC64")]) - --(define_mode_iterator ATOMIC [SI (DI "TARGET_POWERPC64")]) -+;; Types that we should provide atomic instructions for. - -+(define_mode_iterator AINT [QI -+ HI -+ SI -+ (DI "TARGET_POWERPC64") -+ (TI "TARGET_SYNC_TI")]) -+ - (define_insn "load_locked<mode>" -- [(set (match_operand:ATOMIC 0 "gpc_reg_operand" "=r") -+ [(set (match_operand:ATOMIC 0 "int_reg_operand" "=r") - (unspec_volatile:ATOMIC - [(match_operand:ATOMIC 1 "memory_operand" "Z")] UNSPECV_LL))] - "" -@@ -184,21 +196,159 @@ - "<larx> %0,%y1" - [(set_attr "type" "load_l")]) - -+(define_insn "load_locked<QHI:mode>_si" -+ [(set (match_operand:SI 0 "int_reg_operand" "=r") -+ (unspec_volatile:SI -+ [(match_operand:QHI 1 "memory_operand" "Z")] UNSPECV_LL))] -+ "TARGET_SYNC_HI_QI" -+ "<QHI:larx> %0,%y1" -+ [(set_attr "type" "load_l")]) -+ -+;; Use PTImode to get even/odd register pairs. -+ -+;; Use a temporary register to force getting an even register for the -+;; lqarx/stqcrx. instructions. Under AT 7.0, we need use an explicit copy, -+;; even in big endian mode, unless we are using the LRA register allocator. In -+;; GCC 4.9, the register allocator is smart enough to assign a even/odd -+;; register pair. -+ -+;; On little endian systems where non-atomic quad word load/store instructions -+;; are not used, the address can be register+offset, so make sure the address -+;; is indexed or indirect before register allocation. -+ -+(define_expand "load_lockedti" -+ [(use (match_operand:TI 0 "quad_int_reg_operand" "")) -+ (use (match_operand:TI 1 "memory_operand" ""))] -+ "TARGET_SYNC_TI" -+{ -+ rtx op0 = operands[0]; -+ rtx op1 = operands[1]; -+ rtx pti = gen_reg_rtx (PTImode); -+ -+ if (!indexed_or_indirect_operand (op1, TImode)) -+ { -+ rtx old_addr = XEXP (op1, 0); -+ rtx new_addr = force_reg (Pmode, old_addr); -+ operands[1] = op1 = change_address (op1, TImode, new_addr); -+ } -+ -+ emit_insn (gen_load_lockedpti (pti, op1)); -+ if (WORDS_BIG_ENDIAN && rs6000_lra_flag) -+ emit_move_insn (op0, gen_lowpart (TImode, pti)); -+ else -+ { -+ rtx op0_lo = gen_lowpart (DImode, op0); -+ rtx op0_hi = gen_highpart (DImode, op0); -+ rtx pti_lo = gen_lowpart (DImode, pti); -+ rtx pti_hi = gen_highpart (DImode, pti); -+ -+ emit_insn (gen_rtx_CLOBBER (VOIDmode, op0)); -+ if (WORDS_BIG_ENDIAN) -+ { -+ emit_move_insn (op0_hi, pti_hi); -+ emit_move_insn (op0_lo, pti_lo); -+ } -+ else -+ { -+ emit_move_insn (op0_hi, pti_lo); -+ emit_move_insn (op0_lo, pti_hi); -+ } -+ } -+ DONE; -+}) -+ -+(define_insn "load_lockedpti" -+ [(set (match_operand:PTI 0 "quad_int_reg_operand" "=&r") -+ (unspec_volatile:PTI -+ [(match_operand:TI 1 "indexed_or_indirect_operand" "Z")] UNSPECV_LL))] -+ "TARGET_SYNC_TI -+ && !reg_mentioned_p (operands[0], operands[1]) -+ && quad_int_reg_operand (operands[0], PTImode)" -+ "lqarx %0,%y1" -+ [(set_attr "type" "load_l")]) -+ - (define_insn "store_conditional<mode>" - [(set (match_operand:CC 0 "cc_reg_operand" "=x") - (unspec_volatile:CC [(const_int 0)] UNSPECV_SC)) - (set (match_operand:ATOMIC 1 "memory_operand" "=Z") -- (match_operand:ATOMIC 2 "gpc_reg_operand" "r"))] -+ (match_operand:ATOMIC 2 "int_reg_operand" "r"))] - "" - "<stcx> %2,%y1" - [(set_attr "type" "store_c")]) - -+;; Use a temporary register to force getting an even register for the -+;; lqarx/stqcrx. instructions. Under AT 7.0, we need use an explicit copy, -+;; even in big endian mode. In GCC 4.9, the register allocator is smart enough -+;; to assign a even/odd register pair. -+ -+;; On little endian systems where non-atomic quad word load/store instructions -+;; are not used, the address can be register+offset, so make sure the address -+;; is indexed or indirect before register allocation. -+ -+(define_expand "store_conditionalti" -+ [(use (match_operand:CC 0 "cc_reg_operand" "")) -+ (use (match_operand:TI 1 "memory_operand" "")) -+ (use (match_operand:TI 2 "quad_int_reg_operand" ""))] -+ "TARGET_SYNC_TI" -+{ -+ rtx op0 = operands[0]; -+ rtx op1 = operands[1]; -+ rtx op2 = operands[2]; -+ rtx addr = XEXP (op1, 0); -+ rtx pti_mem; -+ rtx pti_reg; -+ -+ if (!indexed_or_indirect_operand (op1, TImode)) -+ { -+ rtx new_addr = force_reg (Pmode, addr); -+ operands[1] = op1 = change_address (op1, TImode, new_addr); -+ addr = new_addr; -+ } -+ -+ pti_mem = change_address (op1, PTImode, addr); -+ pti_reg = gen_reg_rtx (PTImode); -+ -+ if (WORDS_BIG_ENDIAN && rs6000_lra_flag) -+ emit_move_insn (pti_reg, gen_lowpart (PTImode, op2)); -+ else -+ { -+ rtx op2_lo = gen_lowpart (DImode, op2); -+ rtx op2_hi = gen_highpart (DImode, op2); -+ rtx pti_lo = gen_lowpart (DImode, pti_reg); -+ rtx pti_hi = gen_highpart (DImode, pti_reg); -+ -+ emit_insn (gen_rtx_CLOBBER (VOIDmode, op0)); -+ if (WORDS_BIG_ENDIAN) -+ { -+ emit_move_insn (pti_hi, op2_hi); -+ emit_move_insn (pti_lo, op2_lo); -+ } -+ else -+ { -+ emit_move_insn (pti_hi, op2_lo); -+ emit_move_insn (pti_lo, op2_hi); -+ } -+ } -+ -+ emit_insn (gen_store_conditionalpti (op0, pti_mem, pti_reg)); -+ DONE; -+}) -+ -+(define_insn "store_conditionalpti" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x") -+ (unspec_volatile:CC [(const_int 0)] UNSPECV_SC)) -+ (set (match_operand:PTI 1 "indexed_or_indirect_operand" "=Z") -+ (match_operand:PTI 2 "quad_int_reg_operand" "r"))] -+ "TARGET_SYNC_TI && quad_int_reg_operand (operands[2], PTImode)" -+ "stqcx. %2,%y1" -+ [(set_attr "type" "store_c")]) -+ - (define_expand "atomic_compare_and_swap<mode>" -- [(match_operand:SI 0 "gpc_reg_operand" "") ;; bool out -- (match_operand:INT1 1 "gpc_reg_operand" "") ;; val out -- (match_operand:INT1 2 "memory_operand" "") ;; memory -- (match_operand:INT1 3 "reg_or_short_operand" "") ;; expected -- (match_operand:INT1 4 "gpc_reg_operand" "") ;; desired -+ [(match_operand:SI 0 "int_reg_operand" "") ;; bool out -+ (match_operand:AINT 1 "int_reg_operand" "") ;; val out -+ (match_operand:AINT 2 "memory_operand" "") ;; memory -+ (match_operand:AINT 3 "reg_or_short_operand" "") ;; expected -+ (match_operand:AINT 4 "int_reg_operand" "") ;; desired - (match_operand:SI 5 "const_int_operand" "") ;; is_weak - (match_operand:SI 6 "const_int_operand" "") ;; model succ - (match_operand:SI 7 "const_int_operand" "")] ;; model fail -@@ -209,9 +359,9 @@ - }) - - (define_expand "atomic_exchange<mode>" -- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output -- (match_operand:INT1 1 "memory_operand" "") ;; memory -- (match_operand:INT1 2 "gpc_reg_operand" "") ;; input -+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output -+ (match_operand:AINT 1 "memory_operand" "") ;; memory -+ (match_operand:AINT 2 "int_reg_operand" "") ;; input - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -@@ -220,9 +370,9 @@ - }) - - (define_expand "atomic_<fetchop_name><mode>" -- [(match_operand:INT1 0 "memory_operand" "") ;; memory -- (FETCHOP:INT1 (match_dup 0) -- (match_operand:INT1 1 "<fetchop_pred>" "")) ;; operand -+ [(match_operand:AINT 0 "memory_operand" "") ;; memory -+ (FETCHOP:AINT (match_dup 0) -+ (match_operand:AINT 1 "<fetchop_pred>" "")) ;; operand - (match_operand:SI 2 "const_int_operand" "")] ;; model - "" - { -@@ -232,8 +382,8 @@ - }) - - (define_expand "atomic_nand<mode>" -- [(match_operand:INT1 0 "memory_operand" "") ;; memory -- (match_operand:INT1 1 "gpc_reg_operand" "") ;; operand -+ [(match_operand:AINT 0 "memory_operand" "") ;; memory -+ (match_operand:AINT 1 "int_reg_operand" "") ;; operand - (match_operand:SI 2 "const_int_operand" "")] ;; model - "" - { -@@ -243,10 +393,10 @@ - }) - - (define_expand "atomic_fetch_<fetchop_name><mode>" -- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output -- (match_operand:INT1 1 "memory_operand" "") ;; memory -- (FETCHOP:INT1 (match_dup 1) -- (match_operand:INT1 2 "<fetchop_pred>" "")) ;; operand -+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output -+ (match_operand:AINT 1 "memory_operand" "") ;; memory -+ (FETCHOP:AINT (match_dup 1) -+ (match_operand:AINT 2 "<fetchop_pred>" "")) ;; operand - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -@@ -256,9 +406,9 @@ - }) - - (define_expand "atomic_fetch_nand<mode>" -- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output -- (match_operand:INT1 1 "memory_operand" "") ;; memory -- (match_operand:INT1 2 "gpc_reg_operand" "") ;; operand -+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output -+ (match_operand:AINT 1 "memory_operand" "") ;; memory -+ (match_operand:AINT 2 "int_reg_operand" "") ;; operand - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -@@ -268,10 +418,10 @@ - }) - - (define_expand "atomic_<fetchop_name>_fetch<mode>" -- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output -- (match_operand:INT1 1 "memory_operand" "") ;; memory -- (FETCHOP:INT1 (match_dup 1) -- (match_operand:INT1 2 "<fetchop_pred>" "")) ;; operand -+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output -+ (match_operand:AINT 1 "memory_operand" "") ;; memory -+ (FETCHOP:AINT (match_dup 1) -+ (match_operand:AINT 2 "<fetchop_pred>" "")) ;; operand - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -@@ -281,9 +431,9 @@ - }) - - (define_expand "atomic_nand_fetch<mode>" -- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output -- (match_operand:INT1 1 "memory_operand" "") ;; memory -- (match_operand:INT1 2 "gpc_reg_operand" "") ;; operand -+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output -+ (match_operand:AINT 1 "memory_operand" "") ;; memory -+ (match_operand:AINT 2 "int_reg_operand" "") ;; operand - (match_operand:SI 3 "const_int_operand" "")] ;; model - "" - { -Index: gcc/config/rs6000/crypto.md -=================================================================== ---- a/src/gcc/config/rs6000/crypto.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/crypto.md (.../branches/gcc-4_8-branch) -@@ -0,0 +1,101 @@ -+;; Cryptographic instructions added in ISA 2.07 -+;; Copyright (C) 2012-2013 Free Software Foundation, Inc. -+;; Contributed by Michael Meissner (meissner@linux.vnet.ibm.com) -+ -+;; This file is part of GCC. -+ -+;; GCC is free software; you can redistribute it and/or modify it -+;; under the terms of the GNU General Public License as published -+;; by the Free Software Foundation; either version 3, or (at your -+;; option) any later version. -+ -+;; GCC is distributed in the hope that it will be useful, but WITHOUT -+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -+;; License for more details. -+ -+;; You should have received a copy of the GNU General Public License -+;; along with GCC; see the file COPYING3. If not see -+;; <http://www.gnu.org/licenses/>. -+ -+(define_c_enum "unspec" -+ [UNSPEC_VCIPHER -+ UNSPEC_VNCIPHER -+ UNSPEC_VCIPHERLAST -+ UNSPEC_VNCIPHERLAST -+ UNSPEC_VSBOX -+ UNSPEC_VSHASIGMA -+ UNSPEC_VPERMXOR -+ UNSPEC_VPMSUM]) -+ -+;; Iterator for VPMSUM/VPERMXOR -+(define_mode_iterator CR_mode [V16QI V8HI V4SI V2DI]) -+ -+(define_mode_attr CR_char [(V16QI "b") -+ (V8HI "h") -+ (V4SI "w") -+ (V2DI "d")]) -+ -+;; Iterator for VSHASIGMAD/VSHASIGMAW -+(define_mode_iterator CR_hash [V4SI V2DI]) -+ -+;; Iterator for the other crypto functions -+(define_int_iterator CR_code [UNSPEC_VCIPHER -+ UNSPEC_VNCIPHER -+ UNSPEC_VCIPHERLAST -+ UNSPEC_VNCIPHERLAST]) -+ -+(define_int_attr CR_insn [(UNSPEC_VCIPHER "vcipher") -+ (UNSPEC_VNCIPHER "vncipher") -+ (UNSPEC_VCIPHERLAST "vcipherlast") -+ (UNSPEC_VNCIPHERLAST "vncipherlast")]) -+ -+;; 2 operand crypto instructions -+(define_insn "crypto_<CR_insn>" -+ [(set (match_operand:V2DI 0 "register_operand" "=v") -+ (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v") -+ (match_operand:V2DI 2 "register_operand" "v")] -+ CR_code))] -+ "TARGET_CRYPTO" -+ "<CR_insn> %0,%1,%2" -+ [(set_attr "type" "crypto")]) -+ -+(define_insn "crypto_vpmsum<CR_char>" -+ [(set (match_operand:CR_mode 0 "register_operand" "=v") -+ (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v") -+ (match_operand:CR_mode 2 "register_operand" "v")] -+ UNSPEC_VPMSUM))] -+ "TARGET_CRYPTO" -+ "vpmsum<CR_char> %0,%1,%2" -+ [(set_attr "type" "crypto")]) -+ -+;; 3 operand crypto instructions -+(define_insn "crypto_vpermxor_<mode>" -+ [(set (match_operand:CR_mode 0 "register_operand" "=v") -+ (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v") -+ (match_operand:CR_mode 2 "register_operand" "v") -+ (match_operand:CR_mode 3 "register_operand" "v")] -+ UNSPEC_VPERMXOR))] -+ "TARGET_CRYPTO" -+ "vpermxor %0,%1,%2,%3" -+ [(set_attr "type" "crypto")]) -+ -+;; 1 operand crypto instruction -+(define_insn "crypto_vsbox" -+ [(set (match_operand:V2DI 0 "register_operand" "=v") -+ (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")] -+ UNSPEC_VSBOX))] -+ "TARGET_CRYPTO" -+ "vsbox %0,%1" -+ [(set_attr "type" "crypto")]) -+ -+;; Hash crypto instructions -+(define_insn "crypto_vshasigma<CR_char>" -+ [(set (match_operand:CR_hash 0 "register_operand" "=v") -+ (unspec:CR_hash [(match_operand:CR_hash 1 "register_operand" "v") -+ (match_operand:SI 2 "const_0_to_1_operand" "n") -+ (match_operand:SI 3 "const_0_to_15_operand" "n")] -+ UNSPEC_VSHASIGMA))] -+ "TARGET_CRYPTO" -+ "vshasigma<CR_char> %0,%1,%2,%3" -+ [(set_attr "type" "crypto")]) Index: gcc/config/rs6000/rs6000.md =================================================================== ---- a/src/gcc/config/rs6000/rs6000.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/rs6000/rs6000.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/rs6000/rs6000.md (.../branches/gcc-4_8-branch) -@@ -25,10 +25,14 @@ - ;; - - (define_constants -- [(STACK_POINTER_REGNUM 1) -+ [(FIRST_GPR_REGNO 0) -+ (STACK_POINTER_REGNUM 1) - (TOC_REGNUM 2) - (STATIC_CHAIN_REGNUM 11) - (HARD_FRAME_POINTER_REGNUM 31) -+ (LAST_GPR_REGNO 31) -+ (FIRST_FPR_REGNO 32) -+ (LAST_FPR_REGNO 63) - (LR_REGNO 65) - (CTR_REGNO 66) - (ARG_POINTER_REGNUM 67) -@@ -49,18 +53,9 @@ - (SPE_ACC_REGNO 111) - (SPEFSCR_REGNO 112) - (FRAME_POINTER_REGNUM 113) -- -- ; ABI defined stack offsets for storing the TOC pointer with AIX calls. -- (TOC_SAVE_OFFSET_32BIT 20) -- (TOC_SAVE_OFFSET_64BIT 40) -- -- ; Function TOC offset in the AIX function descriptor. -- (AIX_FUNC_DESC_TOC_32BIT 4) -- (AIX_FUNC_DESC_TOC_64BIT 8) -- -- ; Static chain offset in the AIX function descriptor. -- (AIX_FUNC_DESC_SC_32BIT 8) -- (AIX_FUNC_DESC_SC_64BIT 16) -+ (TFHAR_REGNO 114) -+ (TFIAR_REGNO 115) -+ (TEXASR_REGNO 116) - ]) - - ;; -@@ -123,6 +118,12 @@ - UNSPEC_LFIWZX - UNSPEC_FCTIWUZ - UNSPEC_GRP_END_NOP -+ UNSPEC_P8V_FMRGOW -+ UNSPEC_P8V_MTVSRWZ -+ UNSPEC_P8V_RELOAD_FROM_GPR -+ UNSPEC_P8V_MTVSRD -+ UNSPEC_P8V_XXPERMDI -+ UNSPEC_P8V_RELOAD_FROM_VSX - ]) - - ;; -@@ -142,7 +143,7 @@ - - ;; Define an insn type attribute. This is used in function unit delay - ;; computations. --(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt" -+(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt,crypto,htm" - (const_string "integer")) - - ;; Define floating point instruction sub-types for use with Xfpu.md -@@ -164,7 +165,7 @@ - ;; Processor type -- this attribute must exactly match the processor_type - ;; enumeration in rs6000.h. - --(define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan" -+(define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan,power8" - (const (symbol_ref "rs6000_cpu_attr"))) - - -@@ -197,6 +198,7 @@ - (include "power5.md") - (include "power6.md") - (include "power7.md") -+(include "power8.md") - (include "cell.md") - (include "xfpu.md") - (include "a2.md") -@@ -215,7 +217,7 @@ - (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")]) - - ; Any supported integer mode. --(define_mode_iterator INT [QI HI SI DI TI]) -+(define_mode_iterator INT [QI HI SI DI TI PTI]) - - ; Any supported integer mode that fits in one register. - (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")]) -@@ -223,6 +225,12 @@ - ; extend modes for DImode - (define_mode_iterator QHSI [QI HI SI]) - -+; QImode or HImode for small atomic ops -+(define_mode_iterator QHI [QI HI]) -+ -+; HImode or SImode for sign extended fusion ops -+(define_mode_iterator HSI [HI SI]) -+ - ; SImode or DImode, even if DImode doesn't fit in GPRs. - (define_mode_iterator SDI [SI DI]) - -@@ -230,6 +238,10 @@ - ; (one with a '.') will compare; and the size used for arithmetic carries. - (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")]) - -+; Iterator to add PTImode along with TImode (TImode can go in VSX registers, -+; PTImode is GPR only) -+(define_mode_iterator TI2 [TI PTI]) -+ - ; Any hardware-supported floating-point mode - (define_mode_iterator FP [ - (SF "TARGET_HARD_FLOAT -@@ -253,6 +265,50 @@ - (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)") - ]) - -+; Floating point move iterators to combine binary and decimal moves -+(define_mode_iterator FMOVE32 [SF SD]) -+(define_mode_iterator FMOVE64 [DF DD]) -+(define_mode_iterator FMOVE64X [DI DF DD]) -+(define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128") -+ (TD "TARGET_HARD_FLOAT && TARGET_FPRS")]) -+ -+; Iterators for 128 bit types for direct move -+(define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE") -+ (V16QI "") -+ (V8HI "") -+ (V4SI "") -+ (V4SF "") -+ (V2DI "") -+ (V2DF "") -+ (V1TI "")]) -+ -+; Whether a floating point move is ok, don't allow SD without hardware FP -+(define_mode_attr fmove_ok [(SF "") -+ (DF "") -+ (SD "TARGET_HARD_FLOAT && TARGET_FPRS") -+ (DD "")]) -+ -+; Convert REAL_VALUE to the appropriate bits -+(define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE") -+ (DF "REAL_VALUE_TO_TARGET_DOUBLE") -+ (SD "REAL_VALUE_TO_TARGET_DECIMAL32") -+ (DD "REAL_VALUE_TO_TARGET_DECIMAL64")]) -+ -+; Definitions for load to 32-bit fpr register -+(define_mode_attr f32_lr [(SF "f") (SD "wz")]) -+(define_mode_attr f32_lm [(SF "m") (SD "Z")]) -+(define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")]) -+(define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")]) -+ -+; Definitions for store from 32-bit fpr register -+(define_mode_attr f32_sr [(SF "f") (SD "wx")]) -+(define_mode_attr f32_sm [(SF "m") (SD "Z")]) -+(define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")]) -+(define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")]) -+ -+; Definitions for 32-bit fpr direct move -+(define_mode_attr f32_dm [(SF "wn") (SD "wm")]) -+ - ; These modes do not fit in integer registers in 32-bit mode. - ; but on e500v2, the gpr are 64 bit registers - (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD]) -@@ -263,6 +319,25 @@ - ; Iterator for just SF/DF - (define_mode_iterator SFDF [SF DF]) - -+; SF/DF suffix for traditional floating instructions -+(define_mode_attr Ftrad [(SF "s") (DF "")]) -+ -+; SF/DF suffix for VSX instructions -+(define_mode_attr Fvsx [(SF "sp") (DF "dp")]) -+ -+; SF/DF constraint for arithmetic on traditional floating point registers -+(define_mode_attr Ff [(SF "f") (DF "d")]) -+ -+; SF/DF constraint for arithmetic on VSX registers -+(define_mode_attr Fv [(SF "wy") (DF "ws")]) -+ -+; s/d suffix for things like fp_addsub_s/fp_addsub_d -+(define_mode_attr Fs [(SF "s") (DF "d")]) -+ -+; FRE/FRES support -+(define_mode_attr Ffre [(SF "fres") (DF "fre")]) -+(define_mode_attr FFRE [(SF "FRES") (DF "FRE")]) -+ - ; Conditional returns. - (define_code_iterator any_return [return simple_return]) - (define_code_attr return_pred [(return "direct_return ()") -@@ -271,7 +346,14 @@ - - ; Various instructions that come in SI and DI forms. - ; A generic w/d attribute, for things like cmpw/cmpd. --(define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")]) -+(define_mode_attr wd [(QI "b") -+ (HI "h") -+ (SI "w") -+ (DI "d") -+ (V16QI "b") -+ (V8HI "h") -+ (V4SI "w") -+ (V2DI "d")]) - - ; DImode bits - (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")]) -@@ -297,6 +379,8 @@ - - (define_mode_attr rreg [(SF "f") - (DF "ws") -+ (TF "f") -+ (TD "f") - (V4SF "wf") - (V2DF "wd")]) - -@@ -311,6 +395,83 @@ - - (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT") - (DF "TARGET_DOUBLE_FLOAT")]) -+ -+;; Mode iterator for logical operations on 128-bit types -+(define_mode_iterator BOOL_128 [TI -+ PTI -+ (V16QI "TARGET_ALTIVEC") -+ (V8HI "TARGET_ALTIVEC") -+ (V4SI "TARGET_ALTIVEC") -+ (V4SF "TARGET_ALTIVEC") -+ (V2DI "TARGET_ALTIVEC") -+ (V2DF "TARGET_ALTIVEC") -+ (V1TI "TARGET_ALTIVEC")]) -+ -+;; For the GPRs we use 3 constraints for register outputs, two that are the -+;; same as the output register, and a third where the output register is an -+;; early clobber, so we don't have to deal with register overlaps. For the -+;; vector types, we prefer to use the vector registers. For TI mode, allow -+;; either. -+ -+;; Mode attribute for boolean operation register constraints for output -+(define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v") -+ (PTI "&r,r,r") -+ (V16QI "wa,v,&?r,?r,?r") -+ (V8HI "wa,v,&?r,?r,?r") -+ (V4SI "wa,v,&?r,?r,?r") -+ (V4SF "wa,v,&?r,?r,?r") -+ (V2DI "wa,v,&?r,?r,?r") -+ (V2DF "wa,v,&?r,?r,?r") -+ (V1TI "wa,v,&?r,?r,?r")]) -+ -+;; Mode attribute for boolean operation register constraints for operand1 -+(define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v") -+ (PTI "r,0,r") -+ (V16QI "wa,v,r,0,r") -+ (V8HI "wa,v,r,0,r") -+ (V4SI "wa,v,r,0,r") -+ (V4SF "wa,v,r,0,r") -+ (V2DI "wa,v,r,0,r") -+ (V2DF "wa,v,r,0,r") -+ (V1TI "wa,v,r,0,r")]) -+ -+;; Mode attribute for boolean operation register constraints for operand2 -+(define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v") -+ (PTI "r,r,0") -+ (V16QI "wa,v,r,r,0") -+ (V8HI "wa,v,r,r,0") -+ (V4SI "wa,v,r,r,0") -+ (V4SF "wa,v,r,r,0") -+ (V2DI "wa,v,r,r,0") -+ (V2DF "wa,v,r,r,0") -+ (V1TI "wa,v,r,r,0")]) -+ -+;; Mode attribute for boolean operation register constraints for operand1 -+;; for one_cmpl. To simplify things, we repeat the constraint where 0 -+;; is used for operand1 or operand2 -+(define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v") -+ (PTI "r,0,0") -+ (V16QI "wa,v,r,0,0") -+ (V8HI "wa,v,r,0,0") -+ (V4SI "wa,v,r,0,0") -+ (V4SF "wa,v,r,0,0") -+ (V2DI "wa,v,r,0,0") -+ (V2DF "wa,v,r,0,0") -+ (V1TI "wa,v,r,0,0")]) -+ -+;; Mode attribute for the clobber of CC0 for AND expansion. -+;; For the 128-bit types, we never do AND immediate, but we need to -+;; get the correct number of X's for the number of operands. -+(define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X") -+ (PTI "X,X,X") -+ (V16QI "X,X,X,X,X") -+ (V8HI "X,X,X,X,X") -+ (V4SI "X,X,X,X,X") -+ (V4SF "X,X,X,X,X") -+ (V2DI "X,X,X,X,X") -+ (V2DF "X,X,X,X,X") -+ (V1TI "X,X,X,X,X")]) -+ - - ;; Start with fixed-point load and store insns. Here we put only the more - ;; complex forms. Basic data transfer is done later. -@@ -324,11 +485,19 @@ - (define_insn "*zero_extend<mode>di2_internal1" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))] -- "TARGET_POWERPC64" -+ "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)" - "@ - l<wd>z%U1%X1 %0,%1 - rldicl %0,%1,0,<dbits>" -- [(set_attr "type" "load,*")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*")])]) +@@ -737,7 +737,7 @@ - (define_insn "*zero_extend<mode>di2_internal2" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -@@ -382,6 +551,29 @@ - (const_int 0)))] - "") - -+(define_insn "*zero_extendsidi2_lfiwzx" -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu") -+ (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))] -+ "TARGET_POWERPC64 && TARGET_LFIWZX" -+ "@ -+ lwz%U1%X1 %0,%1 -+ rldicl %0,%1,0,32 -+ mtvsrwz %x0,%1 -+ lfiwzx %0,%y1 -+ lxsiwzx %x0,%y1" -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*") -+ (const_string "mffgpr") -+ (const_string "fpload") -+ (const_string "fpload")])]) -+ - (define_insn "extendqidi2" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))] -@@ -454,7 +646,15 @@ + (define_insn "*extendsidi2_lfiwax" + [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu") +- (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))] ++ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))] + "TARGET_POWERPC64 && TARGET_LFIWAX" "@ - lha%U1%X1 %0,%1 - extsh %0,%1" -- [(set_attr "type" "load_ext,exts")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_u") -+ (const_string "load_ext"))) -+ (const_string "exts")])]) - - (define_insn "" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") -@@ -521,16 +721,47 @@ - "TARGET_POWERPC64" - "") + lwa%U1%X1 %0,%1 +@@ -760,7 +760,7 @@ --(define_insn "" -+(define_insn "*extendsidi2_lfiwax" -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu") -+ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))] -+ "TARGET_POWERPC64 && TARGET_LFIWAX" -+ "@ -+ lwa%U1%X1 %0,%1 -+ extsw %0,%1 -+ mtvsrwa %x0,%1 -+ lfiwax %0,%y1 -+ lxsiwax %x0,%y1" -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_u") -+ (const_string "load_ext"))) -+ (const_string "exts") -+ (const_string "mffgpr") -+ (const_string "fpload") -+ (const_string "fpload")])]) -+ -+(define_insn "*extendsidi2_nocell" + (define_insn "*extendsidi2_nocell" [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))] -- "TARGET_POWERPC64 && rs6000_gen_cell_microcode" -+ "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX" +- (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))] ++ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))] + "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX" "@ lwa%U1%X1 %0,%1 - extsw %0,%1" -- [(set_attr "type" "load_ext,exts")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_u") -+ (const_string "load_ext"))) -+ (const_string "exts")])]) - --(define_insn "" -+(define_insn "*extendsidi2_nocell" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))] - "TARGET_POWERPC64 && !rs6000_gen_cell_microcode" -@@ -602,7 +833,15 @@ - "@ - lbz%U1%X1 %0,%1 - rlwinm %0,%1,0,0xff" -- [(set_attr "type" "load,*")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*")])]) - - (define_insn "" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -@@ -722,7 +961,15 @@ - "@ - lbz%U1%X1 %0,%1 - rlwinm %0,%1,0,0xff" -- [(set_attr "type" "load,*")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*")])]) - - (define_insn "" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -@@ -848,7 +1095,15 @@ - "@ - lhz%U1%X1 %0,%1 - rlwinm %0,%1,0,0xffff" -- [(set_attr "type" "load,*")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*")])]) - - (define_insn "" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -@@ -915,7 +1170,15 @@ - "@ - lha%U1%X1 %0,%1 - extsh %0,%1" -- [(set_attr "type" "load_ext,exts")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ext_u") -+ (const_string "load_ext"))) -+ (const_string "exts")])]) - - (define_insn "" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") -@@ -1658,7 +1921,19 @@ - FAIL; - }) - --(define_insn "one_cmpl<mode>2" -+(define_expand "one_cmpl<mode>2" -+ [(set (match_operand:SDI 0 "gpc_reg_operand" "") -+ (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))] -+ "" -+{ -+ if (<MODE>mode == DImode && !TARGET_POWERPC64) -+ { -+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX); -+ DONE; -+ } -+}) -+ -+(define_insn "*one_cmpl<mode>2" - [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") - (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))] +@@ -15847,26 +15847,6 @@ "" -@@ -1935,7 +2210,9 @@ - [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") - (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))] - "TARGET_CMPB && TARGET_POPCNTB" -- "prty<wd> %0,%1") -+ "prty<wd> %0,%1" -+ [(set_attr "length" "4") -+ (set_attr "type" "popcnt")]) - - (define_expand "parity<mode>2" - [(set (match_operand:GPR 0 "gpc_reg_operand" "") -@@ -2412,7 +2689,7 @@ - (match_operand:SI 2 "gpc_reg_operand" "r,r")) - (const_int 0))) - (clobber (match_scratch:SI 3 "=r,r"))] -- "" -+ "TARGET_32BIT" - "@ - mullw. %3,%1,%2 - #" -@@ -2425,7 +2702,7 @@ - (match_operand:SI 2 "gpc_reg_operand" "")) - (const_int 0))) - (clobber (match_scratch:SI 3 ""))] -- "reload_completed" -+ "TARGET_32BIT && reload_completed" - [(set (match_dup 3) - (mult:SI (match_dup 1) (match_dup 2))) - (set (match_dup 0) -@@ -2440,7 +2717,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (mult:SI (match_dup 1) (match_dup 2)))] -- "" -+ "TARGET_32BIT" - "@ - mullw. %0,%1,%2 - #" -@@ -2454,7 +2731,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "") - (mult:SI (match_dup 1) (match_dup 2)))] -- "reload_completed" -+ "TARGET_32BIT && reload_completed" - [(set (match_dup 0) - (mult:SI (match_dup 1) (match_dup 2))) - (set (match_dup 3) -@@ -3698,13 +3975,13 @@ - (const_int 0)))] - "") - --(define_insn "*rotlsi3_internal7" -+(define_insn "*rotlsi3_internal7le" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (zero_extend:SI - (subreg:QI - (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))] -- "" -+ "!BYTES_BIG_ENDIAN" - "rlw%I2nm %0,%1,%h2,0xff" - [(set (attr "cell_micro") - (if_then_else (match_operand:SI 2 "const_int_operand" "") -@@ -3711,7 +3988,20 @@ - (const_string "not") - (const_string "always")))]) - --(define_insn "*rotlsi3_internal8" -+(define_insn "*rotlsi3_internal7be" -+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r") -+ (zero_extend:SI -+ (subreg:QI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))] -+ "BYTES_BIG_ENDIAN" -+ "rlw%I2nm %0,%1,%h2,0xff" -+ [(set (attr "cell_micro") -+ (if_then_else (match_operand:SI 2 "const_int_operand" "") -+ (const_string "not") -+ (const_string "always")))]) -+ -+(define_insn "*rotlsi3_internal8le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:SI - (subreg:QI -@@ -3719,7 +4009,7 @@ - (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 "=r,r,r,r"))] -- "" -+ "!BYTES_BIG_ENDIAN" - "@ - rlwnm. %3,%1,%2,0xff - rlwinm. %3,%1,%h2,0xff -@@ -3728,6 +4018,23 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotlsi3_internal8be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:SI -+ (subreg:QI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 "=r,r,r,r"))] -+ "BYTES_BIG_ENDIAN" -+ "@ -+ rlwnm. %3,%1,%2,0xff -+ rlwinm. %3,%1,%h2,0xff -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:SI -@@ -3736,7 +4043,7 @@ - (match_operand:SI 2 "reg_or_cint_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 ""))] -- "reload_completed" -+ "!BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 3) - (zero_extend:SI (subreg:QI - (rotate:SI (match_dup 1) -@@ -3746,7 +4053,25 @@ - (const_int 0)))] - "") - --(define_insn "*rotlsi3_internal9" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:SI -+ (subreg:QI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "reg_or_cint_operand" "")) 3)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 ""))] -+ "BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:SI (subreg:QI -+ (rotate:SI (match_dup 1) -+ (match_dup 2)) 3))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotlsi3_internal9le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:SI - (subreg:QI -@@ -3755,7 +4080,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") - (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] -- "" -+ "!BYTES_BIG_ENDIAN" - "@ - rlwnm. %0,%1,%2,0xff - rlwinm. %0,%1,%h2,0xff -@@ -3764,6 +4089,24 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotlsi3_internal9be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:SI -+ (subreg:QI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") -+ (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))] -+ "BYTES_BIG_ENDIAN" -+ "@ -+ rlwnm. %0,%1,%2,0xff -+ rlwinm. %0,%1,%h2,0xff -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:SI -@@ -3773,7 +4116,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "") - (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] -- "reload_completed" -+ "!BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 0) - (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -3781,20 +4124,48 @@ - (const_int 0)))] - "") - --(define_insn "*rotlsi3_internal10" -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:SI -+ (subreg:QI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "reg_or_cint_operand" "")) 3)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "") -+ (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))] -+ "BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotlsi3_internal10le" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (zero_extend:SI - (subreg:HI - (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") - (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))] -- "" -+ "!BYTES_BIG_ENDIAN" - "@ - rlwnm %0,%1,%2,0xffff - rlwinm %0,%1,%h2,0xffff" - [(set_attr "type" "var_shift_rotate,integer")]) - -+(define_insn "*rotlsi3_internal10be" -+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:SI -+ (subreg:HI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -+ (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))] -+ "BYTES_BIG_ENDIAN" -+ "@ -+ rlwnm %0,%1,%2,0xffff -+ rlwinm %0,%1,%h2,0xffff" -+ [(set_attr "type" "var_shift_rotate,integer")]) - --(define_insn "*rotlsi3_internal11" -+(define_insn "*rotlsi3_internal11le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:SI - (subreg:HI -@@ -3802,7 +4173,7 @@ - (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 "=r,r,r,r"))] -- "" -+ "!BYTES_BIG_ENDIAN" - "@ - rlwnm. %3,%1,%2,0xffff - rlwinm. %3,%1,%h2,0xffff -@@ -3811,6 +4182,23 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotlsi3_internal11be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:SI -+ (subreg:HI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 "=r,r,r,r"))] -+ "BYTES_BIG_ENDIAN" -+ "@ -+ rlwnm. %3,%1,%2,0xffff -+ rlwinm. %3,%1,%h2,0xffff -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:SI -@@ -3819,7 +4207,7 @@ - (match_operand:SI 2 "reg_or_cint_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 ""))] -- "reload_completed" -+ "!BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 3) - (zero_extend:SI (subreg:HI - (rotate:SI (match_dup 1) -@@ -3829,7 +4217,25 @@ - (const_int 0)))] - "") - --(define_insn "*rotlsi3_internal12" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:SI -+ (subreg:HI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "reg_or_cint_operand" "")) 2)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 ""))] -+ "BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:SI (subreg:HI -+ (rotate:SI (match_dup 1) -+ (match_dup 2)) 2))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotlsi3_internal12le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:SI - (subreg:HI -@@ -3838,7 +4244,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") - (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] -- "" -+ "!BYTES_BIG_ENDIAN" - "@ - rlwnm. %0,%1,%2,0xffff - rlwinm. %0,%1,%h2,0xffff -@@ -3847,6 +4253,24 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotlsi3_internal12be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:SI -+ (subreg:HI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") -+ (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))] -+ "BYTES_BIG_ENDIAN" -+ "@ -+ rlwnm. %0,%1,%2,0xffff -+ rlwinm. %0,%1,%h2,0xffff -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:SI -@@ -3856,7 +4280,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "") - (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] -- "reload_completed" -+ "!BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 0) - (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -3864,6 +4288,23 @@ - (const_int 0)))] - "") - -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:SI -+ (subreg:HI -+ (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "reg_or_cint_operand" "")) 2)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "") -+ (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))] -+ "BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ - (define_insn "ashlsi3" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -@@ -4054,7 +4495,7 @@ - # - # - #" -- [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,4,8,8,8")]) - - (define_split -@@ -4086,7 +4527,7 @@ - # - # - #" -- [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,4,8,8,8")]) - - (define_split -@@ -4177,16 +4618,25 @@ - (const_int 0)))] - "") - --(define_insn "" -+(define_insn "*lshiftrt_internal1le" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (zero_extend:SI - (subreg:QI - (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "const_int_operand" "i")) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (255))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" - "rlwinm %0,%1,%s2,0xff") - --(define_insn "" -+(define_insn "*lshiftrt_internal1be" -+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r") -+ (zero_extend:SI -+ (subreg:QI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand:SI 2 "const_int_operand" "i")) 3)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" -+ "rlwinm %0,%1,%s2,0xff") -+ -+(define_insn "*lshiftrt_internal2le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") - (compare:CC - (zero_extend:SI -@@ -4195,7 +4645,7 @@ - (match_operand:SI 2 "const_int_operand" "i,i")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 "=r,r"))] -- "includes_rshift_p (operands[2], GEN_INT (255))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" - "@ - rlwinm. %3,%1,%s2,0xff - #" -@@ -4202,6 +4652,22 @@ - [(set_attr "type" "delayed_compare") - (set_attr "length" "4,8")]) - -+(define_insn "*lshiftrt_internal2be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:QI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -+ (match_operand:SI 2 "const_int_operand" "i,i")) 3)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 "=r,r"))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" -+ "@ -+ rlwinm. %3,%1,%s2,0xff -+ #" -+ [(set_attr "type" "delayed_compare") -+ (set_attr "length" "4,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC -@@ -4211,7 +4677,7 @@ - (match_operand:SI 2 "const_int_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 ""))] -- "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" - [(set (match_dup 3) - (zero_extend:SI (subreg:QI - (lshiftrt:SI (match_dup 1) -@@ -4221,7 +4687,26 @@ - (const_int 0)))] - "") - --(define_insn "" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:QI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "const_int_operand" "")) 3)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 ""))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:SI (subreg:QI -+ (lshiftrt:SI (match_dup 1) -+ (match_dup 2)) 3))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*lshiftrt_internal3le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y") - (compare:CC - (zero_extend:SI -@@ -4231,7 +4716,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (255))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" - "@ - rlwinm. %0,%1,%s2,0xff - #" -@@ -4238,6 +4723,23 @@ - [(set_attr "type" "delayed_compare") - (set_attr "length" "4,8")]) - -+(define_insn "*lshiftrt_internal3be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:QI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -+ (match_operand:SI 2 "const_int_operand" "i,i")) 3)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))" -+ "@ -+ rlwinm. %0,%1,%s2,0xff -+ #" -+ [(set_attr "type" "delayed_compare") -+ (set_attr "length" "4,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC -@@ -4248,7 +4750,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "") - (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" - [(set (match_dup 0) - (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -4256,16 +4758,43 @@ - (const_int 0)))] - "") - --(define_insn "" -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:QI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "const_int_operand" "")) 3)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "") -+ (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*lshiftrt_internal4le" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (zero_extend:SI - (subreg:HI - (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") - (match_operand:SI 2 "const_int_operand" "i")) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (65535))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" - "rlwinm %0,%1,%s2,0xffff") - --(define_insn "" -+(define_insn "*lshiftrt_internal4be" -+ [(set (match_operand:SI 0 "gpc_reg_operand" "=r") -+ (zero_extend:SI -+ (subreg:HI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") -+ (match_operand:SI 2 "const_int_operand" "i")) 2)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" -+ "rlwinm %0,%1,%s2,0xffff") -+ -+(define_insn "*lshiftrt_internal5le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") - (compare:CC - (zero_extend:SI -@@ -4274,7 +4803,7 @@ - (match_operand:SI 2 "const_int_operand" "i,i")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 "=r,r"))] -- "includes_rshift_p (operands[2], GEN_INT (65535))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" - "@ - rlwinm. %3,%1,%s2,0xffff - #" -@@ -4281,6 +4810,22 @@ - [(set_attr "type" "delayed_compare") - (set_attr "length" "4,8")]) - -+(define_insn "*lshiftrt_internal5be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:HI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -+ (match_operand:SI 2 "const_int_operand" "i,i")) 2)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 "=r,r"))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" -+ "@ -+ rlwinm. %3,%1,%s2,0xffff -+ #" -+ [(set_attr "type" "delayed_compare") -+ (set_attr "length" "4,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC -@@ -4290,7 +4835,7 @@ - (match_operand:SI 2 "const_int_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:SI 3 ""))] -- "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" - [(set (match_dup 3) - (zero_extend:SI (subreg:HI - (lshiftrt:SI (match_dup 1) -@@ -4300,7 +4845,26 @@ - (const_int 0)))] - "") - --(define_insn "" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:HI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "const_int_operand" "")) 2)) -+ (const_int 0))) -+ (clobber (match_scratch:SI 3 ""))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:SI (subreg:HI -+ (lshiftrt:SI (match_dup 1) -+ (match_dup 2)) 2))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*lshiftrt_internal5le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y") - (compare:CC - (zero_extend:SI -@@ -4310,7 +4874,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (65535))" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" - "@ - rlwinm. %0,%1,%s2,0xffff - #" -@@ -4317,6 +4881,23 @@ - [(set_attr "type" "delayed_compare") - (set_attr "length" "4,8")]) - -+(define_insn "*lshiftrt_internal5be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:HI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -+ (match_operand:SI 2 "const_int_operand" "i,i")) 2)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))" -+ "@ -+ rlwinm. %0,%1,%s2,0xffff -+ #" -+ [(set_attr "type" "delayed_compare") -+ (set_attr "length" "4,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC -@@ -4327,7 +4908,7 @@ - (const_int 0))) - (set (match_operand:SI 0 "gpc_reg_operand" "") - (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] -- "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" -+ "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" - [(set (match_dup 0) - (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -4335,6 +4916,24 @@ - (const_int 0)))] - "") - -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC -+ (zero_extend:SI -+ (subreg:HI -+ (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "") -+ (match_operand:SI 2 "const_int_operand" "")) 2)) -+ (const_int 0))) -+ (set (match_operand:SI 0 "gpc_reg_operand" "") -+ (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))] -+ "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ - (define_insn "ashrsi3" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") - (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") -@@ -4455,224 +5054,226 @@ - (const_int 0)))] - "") - --;; Floating-point insns, excluding normal data motion. --;; --;; PowerPC has a full set of single-precision floating point instructions. --;; --;; For the POWER architecture, we pretend that we have both SFmode and --;; DFmode insns, while, in fact, all fp insns are actually done in double. --;; The only conversions we will do will be when storing to memory. In that --;; case, we will use the "frsp" instruction before storing. --;; --;; Note that when we store into a single-precision memory location, we need to --;; use the frsp insn first. If the register being stored isn't dead, we --;; need a scratch register for the frsp. But this is difficult when the store --;; is done by reload. It is not incorrect to do the frsp on the register in --;; this case, we just lose precision that we would have otherwise gotten but --;; is not guaranteed. Perhaps this should be tightened up at some point. -+ -+;; Floating-point insns, excluding normal data motion. We combine the SF/DF -+;; modes here, and also add in conditional vsx/power8-vector support to access -+;; values in the traditional Altivec registers if the appropriate -+;; -mupper-regs-{df,sf} option is enabled. - --(define_expand "extendsfdf2" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -+(define_expand "abs<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN" - "") - --(define_insn_and_split "*extendsfdf2_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d") -- (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" -+(define_insn "*abs<mode>2_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" - "@ -- # -- fmr %0,%1 -- lfs%U1%X1 %0,%1" -- "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])" -- [(const_int 0)] --{ -- emit_note (NOTE_INSN_DELETED); -- DONE; --} -- [(set_attr "type" "fp,fp,fpload")]) -+ fabs %0,%1 -+ xsabsdp %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_expand "truncdfsf2" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -+(define_insn "*nabs<mode>2_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (neg:SFDF -+ (abs:SFDF -+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fnabs %0,%1 -+ xsnabsdp %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_insn "*truncdfsf2_fpr" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" -- "frsp %0,%1" -- [(set_attr "type" "fp")]) -- --(define_expand "negsf2" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" -+(define_expand "neg<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN" - "") - --(define_insn "*negsf2" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fneg %0,%1" -- [(set_attr "type" "fp")]) -+(define_insn "*neg<mode>2_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fneg %0,%1 -+ xsnegdp %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_expand "abssf2" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" -+(define_expand "add<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN" - "") - --(define_insn "*abssf2" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fabs %0,%1" -- [(set_attr "type" "fp")]) -+(define_insn "*add<mode>3_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fadd<Ftrad> %0,%1,%2 -+ xsadd<Fvsx> %x0,%x1,%x2" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_insn "" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fnabs %0,%1" -- [(set_attr "type" "fp")]) -- --(define_expand "addsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" -+(define_expand "sub<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN" - "") - --(define_insn "" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f") -- (match_operand:SF 2 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fadds %0,%1,%2" -+(define_insn "*sub<mode>3_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fsub<Ftrad> %0,%1,%2 -+ xssub<Fvsx> %x0,%x1,%x2" - [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_s")]) -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_expand "subsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" -+(define_expand "mul<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN" - "") - --(define_insn "" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fsubs %0,%1,%2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_s")]) -+(define_insn "*mul<mode>3_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fmul<Ftrad> %0,%1,%2 -+ xsmul<Fvsx> %x0,%x1,%x2" -+ [(set_attr "type" "dmul") -+ (set_attr "fp_type" "fp_mul_<Fs>")]) - --(define_expand "mulsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" -+(define_expand "div<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")))] -+ "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU" - "") - --(define_insn "" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") -- (match_operand:SF 2 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fmuls %0,%1,%2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_mul_s")]) -+(define_insn "*div<mode>3_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU" -+ "@ -+ fdiv<Ftrad> %0,%1,%2 -+ xsdiv<Fvsx> %x0,%x1,%x2" -+ [(set_attr "type" "<Fs>div") -+ (set_attr "fp_type" "fp_div_<Fs>")]) - --(define_expand "divsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (div:SF (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" -- "") -+(define_insn "sqrt<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU -+ && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))" -+ "@ -+ fsqrt<Ftrad> %0,%1 -+ xssqrt<Fvsx> %x0,%x1" -+ [(set_attr "type" "<Fs>sqrt") -+ (set_attr "fp_type" "fp_sqrt_<Fs>")]) - --(define_insn "" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (div:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS -- && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" -- "fdivs %0,%1,%2" -- [(set_attr "type" "sdiv")]) -+;; Floating point reciprocal approximation -+(define_insn "fre<Fs>" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")] -+ UNSPEC_FRES))] -+ "TARGET_<FFRE>" -+ "@ -+ fre<Ftrad> %0,%1 -+ xsre<Fvsx> %x0,%x1" -+ [(set_attr "type" "fp")]) - --(define_insn "fres" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))] -- "TARGET_FRES" -- "fres %0,%1" -+(define_insn "*rsqrt<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")] -+ UNSPEC_RSQRT))] -+ "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)" -+ "@ -+ frsqrte<Ftrad> %0,%1 -+ xsrsqrte<Fvsx> %x0,%x1" - [(set_attr "type" "fp")]) - --; builtin fmaf support --(define_insn "*fmasf4_fpr" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f") -- (match_operand:SF 3 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fmadds %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_s")]) -+;; Floating point comparisons -+(define_insn "*cmp<mode>_fpr" -+ [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y") -+ (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fcmpu %0,%1,%2 -+ xscmpudp %0,%x1,%x2" -+ [(set_attr "type" "fpcompare")]) - --(define_insn "*fmssf4_fpr" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f") -- (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fmsubs %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_s")]) -+;; Floating point conversions -+(define_expand "extendsfdf2" -+ [(set (match_operand:DF 0 "gpc_reg_operand" "") -+ (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))] -+ "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -+ "") - --(define_insn "*nfmasf4_fpr" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f") -- (match_operand:SF 3 "gpc_reg_operand" "f"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fnmadds %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_s")]) -+(define_insn_and_split "*extendsfdf2_fpr" -+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv") -+ (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))] -+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" -+ "@ -+ # -+ fmr %0,%1 -+ lfs%U1%X1 %0,%1 -+ # -+ xxlor %x0,%x1,%x1 -+ lxsspx %x0,%y1" -+ "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])" -+ [(const_int 0)] -+{ -+ emit_note (NOTE_INSN_DELETED); -+ DONE; -+} -+ [(set_attr_alternative "type" -+ [(const_string "fp") -+ (const_string "fp") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (const_string "fp") -+ (const_string "vecsimple") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload")))])]) - --(define_insn "*nfmssf4_fpr" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f") -- (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fnmsubs %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_s")]) -- --(define_expand "sqrtsf2" -+(define_expand "truncdfsf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))] -- "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) -- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT -- && !TARGET_SIMPLE_FPU" -+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))] -+ "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" "") --(define_insn "" -+(define_insn "*truncdfsf2_fpr" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] -- "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT -- && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" -- "fsqrts %0,%1" -- [(set_attr "type" "ssqrt")]) -- --(define_insn "*rsqrtsf_internal1" -- [(set (match_operand:SF 0 "gpc_reg_operand" "=f") -- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] -- UNSPEC_RSQRT))] -- "TARGET_FRSQRTES" -- "frsqrtes %0,%1" -+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))] -+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" -+ "frsp %0,%1" - [(set_attr "type" "fp")]) - - ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in -@@ -4742,12 +5343,14 @@ - ;; Use an unspec rather providing an if-then-else in RTL, to prevent the - ;; compiler from optimizing -0.0 - (define_insn "copysign<mode>3_fcpsgn" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>") -- (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")] -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")] - UNSPEC_COPYSIGN))] -- "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)" -- "fcpsgn %0,%2,%1" -+ "TARGET_<MODE>_FPR && TARGET_CMPB" -+ "@ -+ fcpsgn %0,%2,%1 -+ xscpsgn<Fvsx> %x0,%x2,%x1" - [(set_attr "type" "fp")]) - - ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a -@@ -4754,27 +5357,70 @@ - ;; fsel instruction and some auxiliary computations. Then we just have a - ;; single DEFINE_INSN for fsel and the define_splits to make them if made by - ;; combine. --(define_expand "smaxsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")) -- (match_dup 1) -- (match_dup 2)))] -- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS -- && TARGET_SINGLE_FLOAT && !flag_trapping_math" -- "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}") -+;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we -+;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary -+;; computations. Then we just have a single DEFINE_INSN for fsel and the -+;; define_splits to make them if made by combine. On VSX machines we have the -+;; min/max instructions. -+;; -+;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector -+;; to allow either DF/SF to use only traditional registers. - --(define_expand "sminsf3" -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "") -- (match_operand:SF 2 "gpc_reg_operand" "")) -- (match_dup 2) -- (match_dup 1)))] -- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS -- && TARGET_SINGLE_FLOAT && !flag_trapping_math" -- "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}") -+(define_expand "smax<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")) -+ (match_dup 1) -+ (match_dup 2)))] -+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math" -+{ -+ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); -+ DONE; -+}) - -+(define_insn "*smax<mode>3_vsx" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR && TARGET_VSX" -+ "xsmaxdp %x0,%x1,%x2" -+ [(set_attr "type" "fp")]) -+ -+(define_expand "smin<mode>3" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")) -+ (match_dup 2) -+ (match_dup 1)))] -+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math" -+{ -+ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); -+ DONE; -+}) -+ -+(define_insn "*smin<mode>3_vsx" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))] -+ "TARGET_<MODE>_FPR && TARGET_VSX" -+ "xsmindp %x0,%x1,%x2" -+ [(set_attr "type" "fp")]) -+ - (define_split -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -+ (match_operator:SFDF 3 "min_max_operator" -+ [(match_operand:SFDF 1 "gpc_reg_operand" "") -+ (match_operand:SFDF 2 "gpc_reg_operand" "")]))] -+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math -+ && !TARGET_VSX" -+ [(const_int 0)] -+{ -+ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1], -+ operands[2]); -+ DONE; -+}) -+ -+(define_split - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (match_operator:SF 3 "min_max_operator" - [(match_operand:SF 1 "gpc_reg_operand" "") -@@ -4904,208 +5550,9 @@ - "fsel %0,%1,%2,%3" - [(set_attr "type" "fp")]) - --(define_expand "negdf2" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -- --(define_insn "*negdf2_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fneg %0,%1" -- [(set_attr "type" "fp")]) -- --(define_expand "absdf2" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -- --(define_insn "*absdf2_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fabs %0,%1" -- [(set_attr "type" "fp")]) -- --(define_insn "*nabsdf2_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fnabs %0,%1" -- [(set_attr "type" "fp")]) -- --(define_expand "adddf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -- --(define_insn "*adddf3_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d") -- (match_operand:DF 2 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fadd %0,%1,%2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_d")]) -- --(define_expand "subdf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -- --(define_insn "*subdf3_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d") -- (match_operand:DF 2 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fsub %0,%1,%2" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_addsub_d")]) -- --(define_expand "muldf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" -- "") -- --(define_insn "*muldf3_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d") -- (match_operand:DF 2 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fmul %0,%1,%2" -- [(set_attr "type" "dmul") -- (set_attr "fp_type" "fp_mul_d")]) -- --(define_expand "divdf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (div:DF (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")))] -- "TARGET_HARD_FLOAT -- && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE) -- && !TARGET_SIMPLE_FPU" -- "") -- --(define_insn "*divdf3_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (div:DF (match_operand:DF 1 "gpc_reg_operand" "d") -- (match_operand:DF 2 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fdiv %0,%1,%2" -- [(set_attr "type" "ddiv")]) -- --(define_insn "*fred_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=f") -- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))] -- "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)" -- "fre %0,%1" -- [(set_attr "type" "fp")]) -- --(define_insn "*rsqrtdf_internal1" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] -- UNSPEC_RSQRT))] -- "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)" -- "frsqrte %0,%1" -- [(set_attr "type" "fp")]) -- --; builtin fma support --(define_insn "*fmadf4_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=f") -- (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") -- (match_operand:DF 2 "gpc_reg_operand" "f") -- (match_operand:DF 3 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && VECTOR_UNIT_NONE_P (DFmode)" -- "fmadd %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- --(define_insn "*fmsdf4_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=f") -- (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") -- (match_operand:DF 2 "gpc_reg_operand" "f") -- (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && VECTOR_UNIT_NONE_P (DFmode)" -- "fmsub %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- --(define_insn "*nfmadf4_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=f") -- (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") -- (match_operand:DF 2 "gpc_reg_operand" "f") -- (match_operand:DF 3 "gpc_reg_operand" "f"))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && VECTOR_UNIT_NONE_P (DFmode)" -- "fnmadd %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- --(define_insn "*nfmsdf4_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=f") -- (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") -- (match_operand:DF 2 "gpc_reg_operand" "f") -- (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && VECTOR_UNIT_NONE_P (DFmode)" -- "fnmsub %0,%1,%2,%3" -- [(set_attr "type" "fp") -- (set_attr "fp_type" "fp_maddsub_d")]) -- --(define_expand "sqrtdf2" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))] -- "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" -- "") -- --(define_insn "*sqrtdf2_fpr" -- [(set (match_operand:DF 0 "gpc_reg_operand" "=d") -- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] -- "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fsqrt %0,%1" -- [(set_attr "type" "dsqrt")]) -- - ;; The conditional move instructions allow us to perform max and min - ;; operations even when - --(define_expand "smaxdf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")) -- (match_dup 1) -- (match_dup 2)))] -- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !flag_trapping_math" -- "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}") -- --(define_expand "smindf3" -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "") -- (match_operand:DF 2 "gpc_reg_operand" "")) -- (match_dup 2) -- (match_dup 1)))] -- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !flag_trapping_math" -- "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}") -- - (define_split - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (match_operator:DF 3 "min_max_operator" -@@ -5159,12 +5606,15 @@ - ; We don't define lfiwax/lfiwzx with the normal definition, because we - ; don't want to support putting SImode in FPR registers. - (define_insn "lfiwax" -- [(set (match_operand:DI 0 "gpc_reg_operand" "=d") -- (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")] -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm") -+ (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")] - UNSPEC_LFIWAX))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX" -- "lfiwax %0,%y1" -- [(set_attr "type" "fpload")]) -+ "@ -+ lfiwax %0,%y1 -+ lxsiwax %x0,%y1 -+ mtvsrwa %x0,%1" -+ [(set_attr "type" "fpload,fpload,mffgpr")]) - - ; This split must be run before register allocation because it allocates the - ; memory slot that is needed to move values to/from the FPR. We don't allocate -@@ -5186,7 +5636,8 @@ - rtx src = operands[1]; - rtx tmp; - -- if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64) -+ if (!MEM_P (src) && TARGET_POWERPC64 -+ && (TARGET_MFPGPR || TARGET_DIRECT_MOVE)) - tmp = convert_to_mode (DImode, src, false); - else - { -@@ -5235,12 +5686,15 @@ - (set_attr "type" "fpload")]) - - (define_insn "lfiwzx" -- [(set (match_operand:DI 0 "gpc_reg_operand" "=d") -- (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")] -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm") -+ (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")] - UNSPEC_LFIWZX))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX" -- "lfiwzx %0,%y1" -- [(set_attr "type" "fpload")]) -+ "@ -+ lfiwzx %0,%y1 -+ lxsiwzx %x0,%y1 -+ mtvsrwz %x0,%1" -+ [(set_attr "type" "fpload,fpload,mftgpr")]) - - (define_insn_and_split "floatunssi<mode>2_lfiwzx" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d") -@@ -5257,7 +5711,8 @@ - rtx src = operands[1]; - rtx tmp; - -- if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64) -+ if (!MEM_P (src) && TARGET_POWERPC64 -+ && (TARGET_MFPGPR || TARGET_DIRECT_MOVE)) - tmp = convert_to_mode (DImode, src, true); - else - { -@@ -5548,7 +6003,7 @@ - emit_insn (gen_stfiwx (dest, tmp)); - DONE; - } -- else if (TARGET_MFPGPR && TARGET_POWERPC64) -+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE)) - { - dest = gen_lowpart (DImode, dest); - emit_move_insn (dest, tmp); -@@ -5642,7 +6097,7 @@ - emit_insn (gen_stfiwx (dest, tmp)); - DONE; - } -- else if (TARGET_MFPGPR && TARGET_POWERPC64) -+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE)) - { - dest = gen_lowpart (DImode, dest); - emit_move_insn (dest, tmp); -@@ -5781,66 +6236,52 @@ - [(set (match_operand:DI 0 "gpc_reg_operand" "=d") - (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")] - UNSPEC_FCTID))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>" -+ "TARGET_<MODE>_FPR && TARGET_FPRND" - "fctid %0,%1" - [(set_attr "type" "fp")]) - --(define_expand "btrunc<mode>2" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] -+(define_insn "btrunc<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")] - UNSPEC_FRIZ))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>" -- "") -+ "TARGET_<MODE>_FPR && TARGET_FPRND" -+ "@ -+ friz %0,%1 -+ xsrdpiz %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_insn "*btrunc<mode>2_fpr" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")] -- UNSPEC_FRIZ))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> -- && !VECTOR_UNIT_VSX_P (<MODE>mode)" -- "friz %0,%1" -- [(set_attr "type" "fp")]) +-;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0 +-;; and __builtin_longdouble_dw1 to optimize glibc. Add support for these +-;; builtins here. - --(define_expand "ceil<mode>2" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] -+(define_insn "ceil<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")] - UNSPEC_FRIP))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>" -- "") -+ "TARGET_<MODE>_FPR && TARGET_FPRND" -+ "@ -+ frip %0,%1 -+ xsrdpip %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_insn "*ceil<mode>2_fpr" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")] -- UNSPEC_FRIP))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> -- && !VECTOR_UNIT_VSX_P (<MODE>mode)" -- "frip %0,%1" -- [(set_attr "type" "fp")]) -- --(define_expand "floor<mode>2" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] -+(define_insn "floor<mode>2" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>") -+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")] - UNSPEC_FRIM))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>" -- "") -+ "TARGET_<MODE>_FPR && TARGET_FPRND" -+ "@ -+ frim %0,%1 -+ xsrdpim %x0,%x1" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - --(define_insn "*floor<mode>2_fpr" -- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>") -- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")] -- UNSPEC_FRIM))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> -- && !VECTOR_UNIT_VSX_P (<MODE>mode)" -- "frim %0,%1" -- [(set_attr "type" "fp")]) -- - ;; No VSX equivalent to frin - (define_insn "round<mode>2" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")] - UNSPEC_FRIN))] -- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>" -+ "TARGET_<MODE>_FPR && TARGET_FPRND" - "frin %0,%1" -- [(set_attr "type" "fp")]) -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_addsub_<Fs>")]) - - ; An UNSPEC is used so we don't have to support SImode in FP registers. - (define_insn "stfiwx" -@@ -6260,11 +6701,11 @@ - [(set_attr "type" "two,three") - (set_attr "length" "8,12")]) - --(define_insn "*ashrdisi3_noppc64" -+(define_insn "*ashrdisi3_noppc64be" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r") - (const_int 32)) 4))] -- "TARGET_32BIT && !TARGET_POWERPC64" -+ "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN" - "* - { - if (REGNO (operands[0]) == REGNO (operands[1])) -@@ -6551,19 +6992,31 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal7" -+(define_insn "*rotldi3_internal7le" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (zero_extend:DI - (subreg:QI - (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") - (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))] -- "TARGET_POWERPC64" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN" - "@ - rldcl %0,%1,%2,56 - rldicl %0,%1,%H2,56" - [(set_attr "type" "var_shift_rotate,integer")]) - --(define_insn "*rotldi3_internal8" -+(define_insn "*rotldi3_internal7be" -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:DI -+ (subreg:QI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl %0,%1,%2,56 -+ rldicl %0,%1,%H2,56" -+ [(set_attr "type" "var_shift_rotate,integer")]) -+ -+(define_insn "*rotldi3_internal8le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:QI -@@ -6571,7 +7024,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 "=r,r,r,r"))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %3,%1,%2,56 - rldicl. %3,%1,%H2,56 -@@ -6580,6 +7033,23 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal8be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:QI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 "=r,r,r,r"))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %3,%1,%2,56 -+ rldicl. %3,%1,%H2,56 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6588,7 +7058,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 ""))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 3) - (zero_extend:DI (subreg:QI - (rotate:DI (match_dup 1) -@@ -6598,7 +7068,25 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal9" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:QI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 7)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 ""))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:DI (subreg:QI -+ (rotate:DI (match_dup 1) -+ (match_dup 2)) 7))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotldi3_internal9le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:QI -@@ -6607,7 +7095,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") - (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %0,%1,%2,56 - rldicl. %0,%1,%H2,56 -@@ -6616,6 +7104,24 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal9be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:QI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") -+ (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %0,%1,%2,56 -+ rldicl. %0,%1,%H2,56 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6625,7 +7131,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "") - (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 0) - (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -6633,19 +7139,48 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal10" -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:QI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 7)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "") -+ (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotldi3_internal10le" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (zero_extend:DI - (subreg:HI - (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") - (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))] -- "TARGET_POWERPC64" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN" - "@ - rldcl %0,%1,%2,48 - rldicl %0,%1,%H2,48" - [(set_attr "type" "var_shift_rotate,integer")]) - --(define_insn "*rotldi3_internal11" -+(define_insn "*rotldi3_internal10be" -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:DI -+ (subreg:HI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl %0,%1,%2,48 -+ rldicl %0,%1,%H2,48" -+ [(set_attr "type" "var_shift_rotate,integer")]) -+ -+(define_insn "*rotldi3_internal11le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:HI -@@ -6653,7 +7188,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 "=r,r,r,r"))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %3,%1,%2,48 - rldicl. %3,%1,%H2,48 -@@ -6662,6 +7197,23 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal11be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:HI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 "=r,r,r,r"))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %3,%1,%2,48 -+ rldicl. %3,%1,%H2,48 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6670,7 +7222,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 ""))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 3) - (zero_extend:DI (subreg:HI - (rotate:DI (match_dup 1) -@@ -6680,7 +7232,25 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal12" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:HI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 6)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 ""))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:DI (subreg:HI -+ (rotate:DI (match_dup 1) -+ (match_dup 2)) 6))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotldi3_internal12le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:HI -@@ -6689,7 +7259,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") - (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %0,%1,%2,48 - rldicl. %0,%1,%H2,48 -@@ -6698,6 +7268,24 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal12be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:HI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") -+ (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %0,%1,%2,48 -+ rldicl. %0,%1,%H2,48 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6707,7 +7295,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "") - (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 0) - (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -6715,19 +7303,48 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal13" -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:HI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 6)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "") -+ (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotldi3_internal13le" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (zero_extend:DI - (subreg:SI - (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") - (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))] -- "TARGET_POWERPC64" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN" - "@ - rldcl %0,%1,%2,32 - rldicl %0,%1,%H2,32" - [(set_attr "type" "var_shift_rotate,integer")]) - --(define_insn "*rotldi3_internal14" -+(define_insn "*rotldi3_internal13be" -+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") -+ (zero_extend:DI -+ (subreg:SI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl %0,%1,%2,32 -+ rldicl %0,%1,%H2,32" -+ [(set_attr "type" "var_shift_rotate,integer")]) -+ -+(define_insn "*rotldi3_internal14le" - [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:SI -@@ -6735,7 +7352,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 "=r,r,r,r"))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %3,%1,%2,32 - rldicl. %3,%1,%H2,32 -@@ -6744,6 +7361,23 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal14be" -+ [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:SI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 "=r,r,r,r"))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %3,%1,%2,32 -+ rldicl. %3,%1,%H2,32 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6752,7 +7386,7 @@ - (match_operand:DI 2 "reg_or_cint_operand" "")) 0)) - (const_int 0))) - (clobber (match_scratch:DI 3 ""))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 3) - (zero_extend:DI (subreg:SI - (rotate:DI (match_dup 1) -@@ -6762,7 +7396,25 @@ - (const_int 0)))] - "") - --(define_insn "*rotldi3_internal15" -+(define_split -+ [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:SI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 4)) -+ (const_int 0))) -+ (clobber (match_scratch:DI 3 ""))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 3) -+ (zero_extend:DI (subreg:SI -+ (rotate:DI (match_dup 1) -+ (match_dup 2)) 4))) -+ (set (match_dup 0) -+ (compare:CC (match_dup 3) -+ (const_int 0)))] -+ "") -+ -+(define_insn "*rotldi3_internal15le" - [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") - (compare:CC (zero_extend:DI - (subreg:SI -@@ -6771,7 +7423,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") - (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_64BIT" -+ "TARGET_64BIT && !BYTES_BIG_ENDIAN" - "@ - rldcl. %0,%1,%2,32 - rldicl. %0,%1,%H2,32 -@@ -6780,6 +7432,24 @@ - [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") - (set_attr "length" "4,4,8,8")]) - -+(define_insn "*rotldi3_internal15be" -+ [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y") -+ (compare:CC (zero_extend:DI -+ (subreg:SI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r") -+ (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r") -+ (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))] -+ "TARGET_64BIT && BYTES_BIG_ENDIAN" -+ "@ -+ rldcl. %0,%1,%2,32 -+ rldicl. %0,%1,%H2,32 -+ # -+ #" -+ [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare") -+ (set_attr "length" "4,4,8,8")]) -+ - (define_split - [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") - (compare:CC (zero_extend:DI -@@ -6789,7 +7459,7 @@ - (const_int 0))) - (set (match_operand:DI 0 "gpc_reg_operand" "") - (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))] -- "TARGET_POWERPC64 && reload_completed" -+ "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed" - [(set (match_dup 0) - (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0))) - (set (match_dup 3) -@@ -6797,6 +7467,23 @@ - (const_int 0)))] - "") - -+(define_split -+ [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "") -+ (compare:CC (zero_extend:DI -+ (subreg:SI -+ (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "") -+ (match_operand:DI 2 "reg_or_cint_operand" "")) 4)) -+ (const_int 0))) -+ (set (match_operand:DI 0 "gpc_reg_operand" "") -+ (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))] -+ "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed" -+ [(set (match_dup 0) -+ (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4))) -+ (set (match_dup 3) -+ (compare:CC (match_dup 0) -+ (const_int 0)))] -+ "") -+ - (define_expand "ashldi3" - [(set (match_operand:DI 0 "gpc_reg_operand" "") - (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "") -@@ -7195,10 +7882,19 @@ - [(parallel - [(set (match_operand:DI 0 "gpc_reg_operand" "") - (and:DI (match_operand:DI 1 "gpc_reg_operand" "") -- (match_operand:DI 2 "and64_2_operand" ""))) -+ (match_operand:DI 2 "reg_or_cint_operand" ""))) - (clobber (match_scratch:CC 3 ""))])] -- "TARGET_POWERPC64" -- "") -+ "" -+{ -+ if (!TARGET_POWERPC64) -+ { -+ rtx cc = gen_rtx_SCRATCH (CCmode); -+ rs6000_split_logical (operands, AND, false, false, false, cc); -+ DONE; -+ } -+ else if (!and64_2_operand (operands[2], DImode)) -+ operands[2] = force_reg (DImode, operands[2]); -+}) - - (define_insn "anddi3_mc" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r") -@@ -7379,12 +8075,18 @@ - (define_expand "iordi3" - [(set (match_operand:DI 0 "gpc_reg_operand" "") - (ior:DI (match_operand:DI 1 "gpc_reg_operand" "") -- (match_operand:DI 2 "reg_or_logical_cint_operand" "")))] -- "TARGET_POWERPC64" -- " -+ (match_operand:DI 2 "reg_or_cint_operand" "")))] -+ "" - { -- if (non_logical_cint_operand (operands[2], DImode)) -+ if (!TARGET_POWERPC64) - { -+ rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX); -+ DONE; -+ } -+ else if (!reg_or_logical_cint_operand (operands[2], DImode)) -+ operands[2] = force_reg (DImode, operands[2]); -+ else if (non_logical_cint_operand (operands[2], DImode)) -+ { - HOST_WIDE_INT value; - rtx tmp = ((!can_create_pseudo_p () - || rtx_equal_p (operands[0], operands[1])) -@@ -7408,15 +8110,21 @@ - emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff))); - DONE; - } --}") -+}) - - (define_expand "xordi3" - [(set (match_operand:DI 0 "gpc_reg_operand" "") - (xor:DI (match_operand:DI 1 "gpc_reg_operand" "") -- (match_operand:DI 2 "reg_or_logical_cint_operand" "")))] -- "TARGET_POWERPC64" -- " -+ (match_operand:DI 2 "reg_or_cint_operand" "")))] -+ "" - { -+ if (!TARGET_POWERPC64) -+ { -+ rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX); -+ DONE; -+ } -+ else if (!reg_or_logical_cint_operand (operands[2], DImode)) -+ operands[2] = force_reg (DImode, operands[2]); - if (non_logical_cint_operand (operands[2], DImode)) - { - HOST_WIDE_INT value; -@@ -7442,7 +8150,7 @@ - emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff))); - DONE; - } --}") -+}) - - (define_insn "*booldi3_internal1" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") -@@ -7678,7 +8386,385 @@ - (compare:CC (match_dup 0) - (const_int 0)))] - "") -+ -+;; Eqv operation. -+(define_insn "*eqv<mode>3" -+ [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") -+ (not:GPR -+ (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r") -+ (match_operand:GPR 2 "gpc_reg_operand" "r"))))] -+ "" -+ "eqv %0,%1,%2" -+ [(set_attr "type" "integer") -+ (set_attr "length" "4")]) -+ - -+;; 128-bit logical operations expanders -+ -+(define_expand "and<mode>3" -+ [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (and:BOOL_128 -+ (match_operand:BOOL_128 1 "vlogical_operand" "") -+ (match_operand:BOOL_128 2 "vlogical_operand" ""))) -+ (clobber (match_scratch:CC 3 ""))])] -+ "" -+ "") -+ -+(define_expand "ior<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "") -+ (match_operand:BOOL_128 2 "vlogical_operand" "")))] -+ "" -+ "") -+ -+(define_expand "xor<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "") -+ (match_operand:BOOL_128 2 "vlogical_operand" "")))] -+ "" -+ "") -+ -+(define_expand "one_cmpl<mode>2" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))] -+ "" -+ "") -+ -+(define_expand "nor<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (and:BOOL_128 -+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")) -+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))] -+ "" -+ "") -+ -+(define_expand "andc<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (and:BOOL_128 -+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" "")) -+ (match_operand:BOOL_128 1 "vlogical_operand" "")))] -+ "" -+ "") -+ -+;; Power8 vector logical instructions. -+(define_expand "eqv<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (not:BOOL_128 -+ (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "") -+ (match_operand:BOOL_128 2 "vlogical_operand" ""))))] -+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR" -+ "") -+ -+;; Rewrite nand into canonical form -+(define_expand "nand<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (ior:BOOL_128 -+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")) -+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))] -+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR" -+ "") -+ -+;; The canonical form is to have the negated element first, so we need to -+;; reverse arguments. -+(define_expand "orc<mode>3" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "") -+ (ior:BOOL_128 -+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" "")) -+ (match_operand:BOOL_128 1 "vlogical_operand" "")))] -+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR" -+ "") -+ -+;; 128-bit logical operations insns and split operations -+(define_insn_and_split "*and<mode>3_internal" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (and:BOOL_128 -+ (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>") -+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))) -+ (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))] -+ "" -+{ -+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxland %x0,%x1,%x2"; -+ -+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode)) -+ return "vand %0,%1,%2"; -+ -+ return "#"; -+} -+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, AND, false, false, false, operands[3]); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+;; 128-bit IOR/XOR -+(define_insn_and_split "*bool<mode>3_internal" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (match_operator:BOOL_128 3 "boolean_or_operator" -+ [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>") -+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))] -+ "" -+{ -+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxl%q3 %x0,%x1,%x2"; -+ -+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode)) -+ return "v%q3 %0,%1,%2"; -+ -+ return "#"; -+} -+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false, -+ NULL_RTX); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+;; 128-bit ANDC/ORC -+(define_insn_and_split "*boolc<mode>3_internal1" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (match_operator:BOOL_128 3 "boolean_operator" -+ [(not:BOOL_128 -+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>")) -+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))] -+ "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)" -+{ -+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxl%q3 %x0,%x1,%x2"; -+ -+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode)) -+ return "v%q3 %0,%1,%2"; -+ -+ return "#"; -+} -+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)) -+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false, -+ NULL_RTX); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+(define_insn_and_split "*boolc<mode>3_internal2" -+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r") -+ (match_operator:TI2 3 "boolean_operator" -+ [(not:TI2 -+ (match_operand:TI2 1 "int_reg_operand" "r,0,r")) -+ (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))] -+ "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)" -+ "#" -+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false, -+ NULL_RTX); -+ DONE; -+} -+ [(set_attr "type" "integer") -+ (set (attr "length") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16")))]) -+ -+;; 128-bit NAND/NOR -+(define_insn_and_split "*boolcc<mode>3_internal1" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (match_operator:BOOL_128 3 "boolean_operator" -+ [(not:BOOL_128 -+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")) -+ (not:BOOL_128 -+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))] -+ "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)" -+{ -+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxl%q3 %x0,%x1,%x2"; -+ -+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode)) -+ return "v%q3 %0,%1,%2"; -+ -+ return "#"; -+} -+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)) -+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true, -+ NULL_RTX); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+(define_insn_and_split "*boolcc<mode>3_internal2" -+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r") -+ (match_operator:TI2 3 "boolean_operator" -+ [(not:TI2 -+ (match_operand:TI2 1 "int_reg_operand" "r,0,r")) -+ (not:TI2 -+ (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))] -+ "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)" -+ "#" -+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true, -+ NULL_RTX); -+ DONE; -+} -+ [(set_attr "type" "integer") -+ (set (attr "length") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16")))]) -+ -+ -+;; 128-bit EQV -+(define_insn_and_split "*eqv<mode>3_internal1" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (not:BOOL_128 -+ (xor:BOOL_128 -+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>") -+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))] -+ "TARGET_P8_VECTOR" -+{ -+ if (vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxleqv %x0,%x1,%x2"; -+ -+ return "#"; -+} -+ "TARGET_P8_VECTOR && reload_completed -+ && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+(define_insn_and_split "*eqv<mode>3_internal2" -+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r") -+ (not:TI2 -+ (xor:TI2 -+ (match_operand:TI2 1 "int_reg_operand" "r,0,r") -+ (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))] -+ "!TARGET_P8_VECTOR" -+ "#" -+ "reload_completed && !TARGET_P8_VECTOR" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX); -+ DONE; -+} -+ [(set_attr "type" "integer") -+ (set (attr "length") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16")))]) -+ -+;; 128-bit one's complement -+(define_insn_and_split "*one_cmpl<mode>3_internal" -+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>") -+ (not:BOOL_128 -+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))] -+ "" -+{ -+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode)) -+ return "xxlnor %x0,%x1,%x1"; -+ -+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode)) -+ return "vnor %0,%1,%1"; -+ -+ return "#"; -+} -+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)" -+ [(const_int 0)] -+{ -+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX); -+ DONE; -+} -+ [(set (attr "type") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "vecsimple") -+ (const_string "integer"))) -+ (set (attr "length") -+ (if_then_else -+ (match_test "vsx_register_operand (operands[0], <MODE>mode)") -+ (const_string "4") -+ (if_then_else -+ (match_test "TARGET_POWERPC64") -+ (const_string "8") -+ (const_string "16"))))]) -+ -+ - ;; Now define ways of moving data around. - - ;; Set up a register with a value from the GOT table -@@ -7765,7 +8851,31 @@ - mt%0 %1 - mt%0 %1 - nop" -- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*") -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "mfjmpr") -+ (const_string "mtjmpr") -+ (const_string "*") -+ (const_string "*")]) -+ - (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")]) - - (define_insn "*movsi_internal1_single" -@@ -7787,7 +8897,44 @@ - nop - stfs%U0%X0 %1,%0 - lfs%U1%X1 %0,%1" -- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*") -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "mfjmpr") -+ (const_string "mtjmpr") -+ (const_string "*") -+ (const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload")))]) - (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")]) - - ;; Split a load of a large constant into the appropriate two-insn -@@ -7822,7 +8969,7 @@ - cmp<wd>i %2,%0,0 - mr. %0,%1 - #" -- [(set_attr "type" "cmp,compare,cmp") -+ [(set_attr "type" "cmp,fast_compare,cmp") - (set_attr "length" "4,4,8")]) - - (define_split -@@ -7850,7 +8997,26 @@ - mf%1 %0 - mt%0 %1 - nop" -- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")]) -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "*") -+ (const_string "mfjmpr") -+ (const_string "mtjmpr") -+ (const_string "*")])]) - - (define_expand "mov<mode>" - [(set (match_operand:INT 0 "general_operand" "") -@@ -7871,7 +9037,26 @@ - mf%1 %0 - mt%0 %1 - nop" -- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")]) -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "*") -+ (const_string "mfjmpr") -+ (const_string "mtjmpr") -+ (const_string "*")])]) - - ;; Here is how to move condition codes around. When we store CC data in - ;; an integer register or memory, we store just the high-order 4 bits. -@@ -7899,7 +9084,7 @@ - mf%1 %0 - mt%0 %1 - lwz%U1%X1 %0,%1 -- stw%U0%U1 %1,%0" -+ stw%U0%X0 %1,%0" - [(set (attr "type") - (cond [(eq_attr "alternative" "0,3") - (const_string "cr_logical") -@@ -7912,9 +9097,23 @@ - (eq_attr "alternative" "9") - (const_string "mtjmpr") - (eq_attr "alternative" "10") -- (const_string "load") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], -+ VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) - (eq_attr "alternative" "11") -- (const_string "store") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], -+ VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) - (match_test "TARGET_MFCRF") - (const_string "mfcrf") - ] -@@ -7926,15 +9125,17 @@ - ;; can produce floating-point values in fixed-point registers. Unless the - ;; value is a simple constant or already in memory, we deal with this by - ;; allocating memory and copying the value explicitly via that memory location. --(define_expand "movsf" -- [(set (match_operand:SF 0 "nonimmediate_operand" "") -- (match_operand:SF 1 "any_operand" ""))] -- "" -- "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }") - -+;; Move 32-bit binary/decimal floating point -+(define_expand "mov<mode>" -+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "") -+ (match_operand:FMOVE32 1 "any_operand" ""))] -+ "<fmove_ok>" -+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }") -+ - (define_split -- [(set (match_operand:SF 0 "gpc_reg_operand" "") -- (match_operand:SF 1 "const_double_operand" ""))] -+ [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "") -+ (match_operand:FMOVE32 1 "const_double_operand" ""))] - "reload_completed - && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) - || (GET_CODE (operands[0]) == SUBREG -@@ -7947,10 +9148,10 @@ - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_SINGLE (rv, l); -+ <real_value_to_target> (rv, l); - - if (! TARGET_POWERPC64) -- operands[2] = operand_subword (operands[0], 0, 0, SFmode); -+ operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode); - else - operands[2] = gen_lowpart (SImode, operands[0]); - -@@ -7957,11 +9158,11 @@ - operands[3] = gen_int_mode (l, SImode); - }") - --(define_insn "*movsf_hardfloat" -- [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,!r,*h,!r,!r") -- (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,h,0,G,Fn"))] -- "(gpc_reg_operand (operands[0], SFmode) -- || gpc_reg_operand (operands[1], SFmode)) -+(define_insn "mov<mode>_hardfloat" -+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wu,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r") -+ (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wu,r,<f32_dm>,r,h,0,G,Fn"))] -+ "(gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode)) - && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)" - "@ - mr %0,%1 -@@ -7968,21 +9169,68 @@ - lwz%U1%X1 %0,%1 - stw%U0%X0 %1,%0 - fmr %0,%1 -- lfs%U1%X1 %0,%1 -- stfs%U0%X0 %1,%0 -+ xxlor %x0,%x1,%x1 -+ xxlxor %x0,%x0,%x0 -+ <f32_li> -+ <f32_si> -+ <f32_lv> -+ <f32_sv> -+ mtvsrwz %x0,%1 -+ mfvsrwz %0,%x1 - mt%0 %1 - mf%1 %0 - nop - # - #" -- [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")]) -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "fp") -+ (const_string "vecsimple") -+ (const_string "vecsimple") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (const_string "fpload") -+ (const_string "fpstore") -+ (const_string "mftgpr") -+ (const_string "mffgpr") -+ (const_string "mtjmpr") -+ (const_string "mfjmpr") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*")]) -+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")]) - --(define_insn "*movsf_softfloat" -- [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h") -- (match_operand:SF 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))] -- "(gpc_reg_operand (operands[0], SFmode) -- || gpc_reg_operand (operands[1], SFmode)) -+(define_insn "*mov<mode>_softfloat" -+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h") -+ (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))] -+ "(gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode)) - && (TARGET_SOFT_FLOAT || !TARGET_FPRS)" - "@ - mr %0,%1 -@@ -7995,19 +9243,42 @@ - # - # - nop" -- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*") -+ [(set_attr_alternative "type" -+ [(const_string "*") -+ (const_string "mtjmpr") -+ (const_string "mfjmpr") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*")]) - (set_attr "length" "4,4,4,4,4,4,4,4,8,4")]) - - --(define_expand "movdf" +-(define_expand "unpacktf_0" - [(set (match_operand:DF 0 "nonimmediate_operand" "") -- (match_operand:DF 1 "any_operand" ""))] -+;; Move 64-bit binary/decimal floating point -+(define_expand "mov<mode>" -+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "") -+ (match_operand:FMOVE64 1 "any_operand" ""))] - "" -- "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }") -+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }") - - (define_split -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (match_operand:DF 1 "const_int_operand" ""))] -+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "") -+ (match_operand:FMOVE64 1 "const_int_operand" ""))] - "! TARGET_POWERPC64 && reload_completed - && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) - || (GET_CODE (operands[0]) == SUBREG -@@ -8020,8 +9291,8 @@ - int endian = (WORDS_BIG_ENDIAN == 0); - HOST_WIDE_INT value = INTVAL (operands[1]); - -- operands[2] = operand_subword (operands[0], endian, 0, DFmode); -- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode); -+ operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode); -+ operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode); - #if HOST_BITS_PER_WIDE_INT == 32 - operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx; - #else -@@ -8031,8 +9302,8 @@ - }") - - (define_split -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (match_operand:DF 1 "const_double_operand" ""))] -+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "") -+ (match_operand:FMOVE64 1 "const_double_operand" ""))] - "! TARGET_POWERPC64 && reload_completed - && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) - || (GET_CODE (operands[0]) == SUBREG -@@ -8047,17 +9318,17 @@ - REAL_VALUE_TYPE rv; - - REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_DOUBLE (rv, l); -+ <real_value_to_target> (rv, l); - -- operands[2] = operand_subword (operands[0], endian, 0, DFmode); -- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode); -+ operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode); -+ operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode); - operands[4] = gen_int_mode (l[endian], SImode); - operands[5] = gen_int_mode (l[1 - endian], SImode); - }") - - (define_split -- [(set (match_operand:DF 0 "gpc_reg_operand" "") -- (match_operand:DF 1 "const_double_operand" ""))] -+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "") -+ (match_operand:FMOVE64 1 "const_double_operand" ""))] - "TARGET_POWERPC64 && reload_completed - && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31) - || (GET_CODE (operands[0]) == SUBREG -@@ -8074,7 +9345,7 @@ - #endif - - REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]); -- REAL_VALUE_TO_TARGET_DOUBLE (rv, l); -+ <real_value_to_target> (rv, l); - - operands[2] = gen_lowpart (DImode, operands[0]); - /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */ -@@ -8099,22 +9370,19 @@ - ;; since the D-form version of the memory instructions does not need a GPR for - ;; reloading. - --(define_insn "*movdf_hardfloat32" -- [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r") -- (match_operand:DF 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))] -+(define_insn "*mov<mode>_hardfloat32" -+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r") -+ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))] - "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && (gpc_reg_operand (operands[0], DFmode) -- || gpc_reg_operand (operands[1], DFmode))" -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "@ - stfd%U0%X0 %1,%0 - lfd%U1%X1 %0,%1 - fmr %0,%1 - lxsd%U1x %x0,%y1 -- lxsd%U1x %x0,%y1 - stxsd%U0x %x1,%y0 -- stxsd%U0x %x1,%y0 - xxlor %x0,%x1,%x1 -- xxlor %x0,%x1,%x1 - xxlxor %x0,%x0,%x0 - # - # -@@ -8122,115 +9390,141 @@ - # - # - #" -- [(set_attr "type" "fpstore,fpload,fp,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,store,load,two,fp,fp,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")]) -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (const_string "fp") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (const_string "fpload")) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (const_string "fpstore")) -+ (const_string "vecsimple") -+ (const_string "vecsimple") -+ (const_string "store") -+ (const_string "load") -+ (const_string "two") -+ (const_string "fp") -+ (const_string "fp") -+ (const_string "*")]) -+ (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")]) - --(define_insn "*movdf_softfloat32" -- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,r,r,r") -- (match_operand:DF 1 "input_operand" "r,Y,r,G,H,F"))] -+(define_insn "*mov<mode>_softfloat32" -+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r") -+ (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))] - "! TARGET_POWERPC64 -- && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) -- || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE) -- && (gpc_reg_operand (operands[0], DFmode) -- || gpc_reg_operand (operands[1], DFmode))" -+ && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) -+ || TARGET_SOFT_FLOAT -+ || (<MODE>mode == DDmode && TARGET_E500_DOUBLE)) -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "#" - [(set_attr "type" "store,load,two,*,*,*") - (set_attr "length" "8,8,8,8,12,16")]) - --;; Reload patterns to support gpr load/store with misaligned mem. --;; and multiple gpr load/store at offset >= 0xfffc --(define_expand "reload_<mode>_store" -- [(parallel [(match_operand 0 "memory_operand" "=m") -- (match_operand 1 "gpc_reg_operand" "r") -- (match_operand:GPR 2 "register_operand" "=&b")])] -- "" --{ -- rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true); -- DONE; --}) -- --(define_expand "reload_<mode>_load" -- [(parallel [(match_operand 0 "gpc_reg_operand" "=r") -- (match_operand 1 "memory_operand" "m") -- (match_operand:GPR 2 "register_operand" "=b")])] +- (unspec:DF [(match_operand:TF 1 "register_operand" "") +- (const_int 0)] +- UNSPEC_UNPACK_128BIT))] - "" --{ -- rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false); -- DONE; --}) -- - ; ld/std require word-aligned displacements -> 'Y' constraint. - ; List Y->r and r->Y before r->r for reload. --(define_insn "*movdf_hardfloat64_mfpgpr" -- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,m,d,d,wa,*c*l,!r,*h,!r,!r,!r,r,d") -- (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))] -- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS -- && TARGET_DOUBLE_FLOAT -- && (gpc_reg_operand (operands[0], DFmode) -- || gpc_reg_operand (operands[1], DFmode))" -+(define_insn "*mov<mode>_hardfloat64" -+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm") -+ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))] -+ "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "@ -- std%U0%X0 %1,%0 -- ld%U1%X1 %0,%1 -- mr %0,%1 -- xxlor %x0,%x1,%x1 -- xxlor %x0,%x1,%x1 -- lxsd%U1x %x0,%y1 -- lxsd%U1x %x0,%y1 -- stxsd%U0x %x1,%y0 -- stxsd%U0x %x1,%y0 - stfd%U0%X0 %1,%0 - lfd%U1%X1 %0,%1 - fmr %0,%1 -+ lxsd%U1x %x0,%y1 -+ stxsd%U0x %x1,%y0 -+ xxlor %x0,%x1,%x1 - xxlxor %x0,%x0,%x0 -- mt%0 %1 -- mf%1 %0 -- nop -- # -- # -- # -- mftgpr %0,%1 -- mffgpr %0,%1" -- [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fpstore,fpload,fp,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")]) -- --; ld/std require word-aligned displacements -> 'Y' constraint. --; List Y->r and r->Y before r->r for reload. --(define_insn "*movdf_hardfloat64" -- [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,Y,r,!r,ws,?wa,Z,?Z,ws,?wa,wa,*c*l,!r,*h,!r,!r,!r") -- (match_operand:DF 1 "input_operand" "d,m,d,r,Y,r,Z,Z,ws,wa,ws,wa,j,r,h,0,G,H,F"))] -- "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS -- && TARGET_DOUBLE_FLOAT -- && (gpc_reg_operand (operands[0], DFmode) -- || gpc_reg_operand (operands[1], DFmode))" -- "@ -- stfd%U0%X0 %1,%0 -- lfd%U1%X1 %0,%1 -- fmr %0,%1 - std%U0%X0 %1,%0 - ld%U1%X1 %0,%1 - mr %0,%1 -- lxsd%U1x %x0,%y1 -- lxsd%U1x %x0,%y1 -- stxsd%U0x %x1,%y0 -- stxsd%U0x %x1,%y0 -- xxlor %x0,%x1,%x1 -- xxlor %x0,%x1,%x1 -- xxlxor %x0,%x0,%x0 - mt%0 %1 - mf%1 %0 - nop - # - # -- #" -- [(set_attr "type" "fpstore,fpload,fp,store,load,*,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,mtjmpr,mfjmpr,*,*,*,*") -- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")]) -+ # -+ mftgpr %0,%1 -+ mffgpr %0,%1 -+ mfvsrd %0,%x1 -+ mtvsrd %x0,%1" -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (const_string "fp") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (const_string "fpload")) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (const_string "fpstore")) -+ (const_string "vecsimple") -+ (const_string "vecsimple") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*") -+ (const_string "mtjmpr") -+ (const_string "mfjmpr") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "mftgpr") -+ (const_string "mffgpr") -+ (const_string "mftgpr") -+ (const_string "mffgpr")]) -+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")]) - --(define_insn "*movdf_softfloat64" -- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h") -- (match_operand:DF 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))] -+(define_insn "*mov<mode>_softfloat64" -+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h") -+ (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))] - "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) -- && (gpc_reg_operand (operands[0], DFmode) -- || gpc_reg_operand (operands[1], DFmode))" -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "@ - std%U0%X0 %1,%0 - ld%U1%X1 %0,%1 -@@ -8241,38 +9535,87 @@ - # - # - nop" -- [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*") -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*") -+ (const_string "mtjmpr") -+ (const_string "mfjmpr") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*")]) - (set_attr "length" "4,4,4,4,4,8,12,16,4")]) - --(define_expand "movtf" -- [(set (match_operand:TF 0 "general_operand" "") -- (match_operand:TF 1 "any_operand" ""))] -- "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128" -- "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }") -+(define_expand "mov<mode>" -+ [(set (match_operand:FMOVE128 0 "general_operand" "") -+ (match_operand:FMOVE128 1 "any_operand" ""))] -+ "" -+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }") - - ;; It's important to list Y->r and r->Y before r->r because otherwise - ;; reload, given m->r, will try to pick r->r and reload it, which - ;; doesn't make progress. --(define_insn_and_split "*movtf_internal" -- [(set (match_operand:TF 0 "nonimmediate_operand" "=m,d,d,Y,r,r") -- (match_operand:TF 1 "input_operand" "d,m,d,r,YGHF,r"))] -- "!TARGET_IEEEQUAD -- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128 -- && (gpc_reg_operand (operands[0], TFmode) -- || gpc_reg_operand (operands[1], TFmode))" -+ -+;; We can't split little endian direct moves of TDmode, because the words are -+;; not swapped like they are for TImode or TFmode. Subregs therefore are -+;; problematical. Don't allow direct move for this case. -+ -+(define_insn_and_split "*mov<mode>_64bit_dm" -+ [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm") -+ (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))] -+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 -+ && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN) -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "#" - "&& reload_completed" - [(pc)] - { rs6000_split_multireg_move (operands[0], operands[1]); DONE; } -+ [(set_attr "length" "8,8,8,12,12,8,8,8")]) -+ -+(define_insn_and_split "*movtd_64bit_nodm" -+ [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r") -+ (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))] -+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN -+ && (gpc_reg_operand (operands[0], TDmode) -+ || gpc_reg_operand (operands[1], TDmode))" -+ "#" -+ "&& reload_completed" -+ [(pc)] -+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; } -+ [(set_attr "length" "8,8,8,12,12,8")]) -+ -+(define_insn_and_split "*mov<mode>_32bit" -+ [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r") -+ (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))] -+ "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64 -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" -+ "#" -+ "&& reload_completed" -+ [(pc)] -+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; } - [(set_attr "length" "8,8,8,20,20,16")]) - --(define_insn_and_split "*movtf_softfloat" -- [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=Y,r,r") -- (match_operand:TF 1 "input_operand" "r,YGHF,r"))] -- "!TARGET_IEEEQUAD -- && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128 -- && (gpc_reg_operand (operands[0], TFmode) -- || gpc_reg_operand (operands[1], TFmode))" -+(define_insn_and_split "*mov<mode>_softfloat" -+ [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r") -+ (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))] -+ "(TARGET_SOFT_FLOAT || !TARGET_FPRS) -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "#" - "&& reload_completed" - [(pc)] -@@ -8557,6 +9900,252 @@ - operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word); - }") - -+;; Reload helper functions used by rs6000_secondary_reload. The patterns all -+;; must have 3 arguments, and scratch register constraint must be a single -+;; constraint. -+ -+;; Reload patterns to support gpr load/store with misaligned mem. -+;; and multiple gpr load/store at offset >= 0xfffc -+(define_expand "reload_<mode>_store" -+ [(parallel [(match_operand 0 "memory_operand" "=m") -+ (match_operand 1 "gpc_reg_operand" "r") -+ (match_operand:GPR 2 "register_operand" "=&b")])] -+ "" -+{ -+ rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true); -+ DONE; -+}) -+ -+(define_expand "reload_<mode>_load" -+ [(parallel [(match_operand 0 "gpc_reg_operand" "=r") -+ (match_operand 1 "memory_operand" "m") -+ (match_operand:GPR 2 "register_operand" "=b")])] -+ "" -+{ -+ rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false); -+ DONE; -+}) -+ -+ -+;; Power8 merge instructions to allow direct move to/from floating point -+;; registers in 32-bit mode. We use TF mode to get two registers to move the -+;; individual 32-bit parts across. Subreg doesn't work too well on the TF -+;; value, since it is allocated in reload and not all of the flow information -+;; is setup for it. We have two patterns to do the two moves between gprs and -+;; fprs. There isn't a dependancy between the two, but we could potentially -+;; schedule other instructions between the two instructions. TFmode is -+;; currently limited to traditional FPR registers. If/when this is changed, we -+;; will need to revist %L to make sure it works with VSX registers, or add an -+;; %x version of %L. -+ -+(define_insn "p8_fmrgow_<mode>" -+ [(set (match_operand:FMOVE64X 0 "register_operand" "=d") -+ (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")] -+ UNSPEC_P8V_FMRGOW))] -+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "fmrgow %0,%1,%L1" -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn "p8_mtvsrwz_1" -+ [(set (match_operand:TF 0 "register_operand" "=d") -+ (unspec:TF [(match_operand:SI 1 "register_operand" "r")] -+ UNSPEC_P8V_MTVSRWZ))] -+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mtvsrwz %x0,%1" -+ [(set_attr "type" "mftgpr")]) -+ -+(define_insn "p8_mtvsrwz_2" -+ [(set (match_operand:TF 0 "register_operand" "+d") -+ (unspec:TF [(match_dup 0) -+ (match_operand:SI 1 "register_operand" "r")] -+ UNSPEC_P8V_MTVSRWZ))] -+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mtvsrwz %L0,%1" -+ [(set_attr "type" "mftgpr")]) -+ -+(define_insn_and_split "reload_fpr_from_gpr<mode>" -+ [(set (match_operand:FMOVE64X 0 "register_operand" "=ws") -+ (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")] -+ UNSPEC_P8V_RELOAD_FROM_GPR)) -+ (clobber (match_operand:TF 2 "register_operand" "=d"))] -+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "#" -+ "&& reload_completed" -+ [(const_int 0)] -+{ -+ rtx dest = operands[0]; -+ rtx src = operands[1]; -+ rtx tmp = operands[2]; -+ rtx gpr_hi_reg = gen_highpart (SImode, src); -+ rtx gpr_lo_reg = gen_lowpart (SImode, src); -+ -+ emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg)); -+ emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg)); -+ emit_insn (gen_p8_fmrgow_<mode> (dest, tmp)); -+ DONE; -+} -+ [(set_attr "length" "12") -+ (set_attr "type" "three")]) -+ -+;; Move 128 bit values from GPRs to VSX registers in 64-bit mode -+(define_insn "p8_mtvsrd_1" -+ [(set (match_operand:TF 0 "register_operand" "=ws") -+ (unspec:TF [(match_operand:DI 1 "register_operand" "r")] -+ UNSPEC_P8V_MTVSRD))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mtvsrd %0,%1" -+ [(set_attr "type" "mftgpr")]) -+ -+(define_insn "p8_mtvsrd_2" -+ [(set (match_operand:TF 0 "register_operand" "+ws") -+ (unspec:TF [(match_dup 0) -+ (match_operand:DI 1 "register_operand" "r")] -+ UNSPEC_P8V_MTVSRD))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mtvsrd %L0,%1" -+ [(set_attr "type" "mftgpr")]) -+ -+(define_insn "p8_xxpermdi_<mode>" -+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa") -+ (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")] -+ UNSPEC_P8V_XXPERMDI))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "xxpermdi %x0,%1,%L1,0" -+ [(set_attr "type" "vecperm")]) -+ -+(define_insn_and_split "reload_vsx_from_gpr<mode>" -+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa") -+ (unspec:FMOVE128_GPR -+ [(match_operand:FMOVE128_GPR 1 "register_operand" "r")] -+ UNSPEC_P8V_RELOAD_FROM_GPR)) -+ (clobber (match_operand:TF 2 "register_operand" "=ws"))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "#" -+ "&& reload_completed" -+ [(const_int 0)] -+{ -+ rtx dest = operands[0]; -+ rtx src = operands[1]; -+ rtx tmp = operands[2]; -+ rtx gpr_hi_reg = gen_highpart (DImode, src); -+ rtx gpr_lo_reg = gen_lowpart (DImode, src); -+ -+ emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg)); -+ emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg)); -+ emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp)); -+} -+ [(set_attr "length" "12") -+ (set_attr "type" "three")]) -+ -+(define_split -+ [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "") -+ (match_operand:FMOVE128_GPR 1 "input_operand" ""))] -+ "reload_completed -+ && (int_reg_operand (operands[0], <MODE>mode) -+ || int_reg_operand (operands[1], <MODE>mode))" -+ [(pc)] -+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }) -+ -+;; Move SFmode to a VSX from a GPR register. Because scalar floating point -+;; type is stored internally as double precision in the VSX registers, we have -+;; to convert it from the vector format. -+ -+(define_insn_and_split "reload_vsx_from_gprsf" -+ [(set (match_operand:SF 0 "register_operand" "=wa") -+ (unspec:SF [(match_operand:SF 1 "register_operand" "r")] -+ UNSPEC_P8V_RELOAD_FROM_GPR)) -+ (clobber (match_operand:DI 2 "register_operand" "=r"))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "#" -+ "&& reload_completed" -+ [(const_int 0)] -+{ -+ rtx op0 = operands[0]; -+ rtx op1 = operands[1]; -+ rtx op2 = operands[2]; -+ rtx op0_di = simplify_gen_subreg (DImode, op0, SFmode, 0); -+ rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0); -+ -+ /* Move SF value to upper 32-bits for xscvspdpn. */ -+ emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32))); -+ emit_move_insn (op0_di, op2); -+ emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0)); -+ DONE; -+} -+ [(set_attr "length" "8") -+ (set_attr "type" "two")]) -+ -+;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a -+;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value, -+;; and then doing a move of that. -+(define_insn "p8_mfvsrd_3_<mode>" -+ [(set (match_operand:DF 0 "register_operand" "=r") -+ (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")] -+ UNSPEC_P8V_RELOAD_FROM_VSX))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mfvsrd %0,%x1" -+ [(set_attr "type" "mftgpr")]) -+ -+(define_insn_and_split "reload_gpr_from_vsx<mode>" -+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r") -+ (unspec:FMOVE128_GPR -+ [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")] -+ UNSPEC_P8V_RELOAD_FROM_VSX)) -+ (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "#" -+ "&& reload_completed" -+ [(const_int 0)] -+{ -+ rtx dest = operands[0]; -+ rtx src = operands[1]; -+ rtx tmp = operands[2]; -+ rtx gpr_hi_reg = gen_highpart (DFmode, dest); -+ rtx gpr_lo_reg = gen_lowpart (DFmode, dest); -+ -+ emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src)); -+ emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3))); -+ emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp)); -+} -+ [(set_attr "length" "12") -+ (set_attr "type" "three")]) -+ -+;; Move SFmode to a GPR from a VSX register. Because scalar floating point -+;; type is stored internally as double precision, we have to convert it to the -+;; vector format. -+ -+(define_insn_and_split "reload_gpr_from_vsxsf" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec:SF [(match_operand:SF 1 "register_operand" "wa")] -+ UNSPEC_P8V_RELOAD_FROM_VSX)) -+ (clobber (match_operand:V4SF 2 "register_operand" "=wa"))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "#" -+ "&& reload_completed" -+ [(const_int 0)] -+{ -+ rtx op0 = operands[0]; -+ rtx op1 = operands[1]; -+ rtx op2 = operands[2]; -+ rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0); -+ -+ emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1)); -+ emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2)); -+ emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32))); -+ DONE; -+} -+ [(set_attr "length" "12") -+ (set_attr "type" "three")]) -+ -+(define_insn "p8_mfvsrd_4_disf" -+ [(set (match_operand:DI 0 "register_operand" "=r") -+ (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")] -+ UNSPEC_P8V_RELOAD_FROM_VSX))] -+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE" -+ "mfvsrd %0,%x1" -+ [(set_attr "type" "mftgpr")]) -+ -+ - ;; Next come the multi-word integer load and store and the load and store - ;; multiple insns. - -@@ -8565,8 +10154,8 @@ - ;; Use of fprs is disparaged slightly otherwise reload prefers to reload - ;; a gpr into a fpr instead of reloading an invalid 'Y' address - (define_insn "*movdi_internal32" -- [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa") -- (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))] -+ [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r") -+ (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))] - "! TARGET_POWERPC64 - && (gpc_reg_operand (operands[0], DImode) - || gpc_reg_operand (operands[1], DImode))" -@@ -8577,15 +10166,34 @@ - stfd%U0%X0 %1,%0 - lfd%U1%X1 %0,%1 - fmr %0,%1 -- # -- xxlxor %x0,%x0,%x0" -- [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")]) -+ #" -+ [(set_attr_alternative "type" -+ [(const_string "store") -+ (const_string "load") -+ (const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (const_string "fp") -+ (const_string "*")])]) - - (define_split - [(set (match_operand:DI 0 "gpc_reg_operand" "") - (match_operand:DI 1 "const_int_operand" ""))] - "! TARGET_POWERPC64 && reload_completed -- && gpr_or_gpr_p (operands[0], operands[1])" -+ && gpr_or_gpr_p (operands[0], operands[1]) -+ && !direct_move_p (operands[0], operands[1])" - [(set (match_dup 2) (match_dup 4)) - (set (match_dup 3) (match_dup 1))] - " -@@ -8607,14 +10215,15 @@ - [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "") - (match_operand:DIFD 1 "input_operand" ""))] - "reload_completed && !TARGET_POWERPC64 -- && gpr_or_gpr_p (operands[0], operands[1])" -+ && gpr_or_gpr_p (operands[0], operands[1]) -+ && !direct_move_p (operands[0], operands[1])" - [(pc)] - { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }) - --(define_insn "*movdi_mfpgpr" -- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*d") -- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*d,r"))] -- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS -+(define_insn "*movdi_internal64" -+ [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm") -+ (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))] -+ "TARGET_POWERPC64 - && (gpc_reg_operand (operands[0], DImode) - || gpc_reg_operand (operands[1], DImode))" - "@ -@@ -8631,33 +10240,52 @@ - mt%0 %1 - nop - mftgpr %0,%1 -- mffgpr %0,%1" -- [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr") -- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")]) -+ mffgpr %0,%1 -+ mfvsrd %0,%x1 -+ mtvsrd %x0,%1" -+ [(set_attr_alternative "type" -+ [(if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "load_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "load_u") -+ (const_string "load"))) -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (const_string "*") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "fpstore_u") -+ (const_string "fpstore"))) -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[1], VOIDmode)") -+ (const_string "fpload_u") -+ (const_string "fpload"))) -+ (const_string "fp") -+ (const_string "mfjmpr") -+ (const_string "mtjmpr") -+ (const_string "*") -+ (const_string "mftgpr") -+ (const_string "mffgpr") -+ (const_string "mftgpr") -+ (const_string "mffgpr")]) -+ (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")]) - --(define_insn "*movdi_internal64" -- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,?wa") -- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,O"))] -- "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS) -- && (gpc_reg_operand (operands[0], DImode) -- || gpc_reg_operand (operands[1], DImode))" -- "@ -- std%U0%X0 %1,%0 -- ld%U1%X1 %0,%1 -- mr %0,%1 -- li %0,%1 -- lis %0,%v1 -- # -- stfd%U0%X0 %1,%0 -- lfd%U1%X1 %0,%1 -- fmr %0,%1 -- mf%1 %0 -- mt%0 %1 -- nop -- xxlxor %x0,%x0,%x0" -- [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,vecsimple") -- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")]) -- - ;; immediate value valid for a single instruction hiding in a const_double - (define_insn "" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") -@@ -8719,14 +10347,16 @@ - FAIL; - }") - --;; TImode is similar, except that we usually want to compute the address into --;; a register and use lsi/stsi (the exception is during reload). -+;; TImode/PTImode is similar, except that we usually want to compute the -+;; address into a register and use lsi/stsi (the exception is during reload). - --(define_insn "*movti_string" -- [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r") -- (match_operand:TI 1 "input_operand" "r,r,Q,Y,r,n"))] -+(define_insn "*mov<mode>_string" -+ [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r") -+ (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))] - "! TARGET_POWERPC64 -- && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))" -+ && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode)) -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode))" - "* - { - switch (which_alternative) -@@ -8756,27 +10386,32 @@ - (const_string "always") - (const_string "conditional")))]) - --(define_insn "*movti_ppc64" -- [(set (match_operand:TI 0 "nonimmediate_operand" "=Y,r,r") -- (match_operand:TI 1 "input_operand" "r,Y,r"))] -- "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode) -- || gpc_reg_operand (operands[1], TImode))) -- && VECTOR_MEM_NONE_P (TImode)" -- "#" -- [(set_attr "type" "store,load,*")]) -+(define_insn "*mov<mode>_ppc64" -+ [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r") -+ (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))] -+ "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode) -+ && (gpc_reg_operand (operands[0], <MODE>mode) -+ || gpc_reg_operand (operands[1], <MODE>mode)))" -+{ -+ return rs6000_output_move_128bit (operands); -+} -+ [(set_attr "type" "store,store,load,load,*,*") -+ (set_attr "length" "8")]) - - (define_split -- [(set (match_operand:TI 0 "gpc_reg_operand" "") -- (match_operand:TI 1 "const_double_operand" ""))] -- "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)" -+ [(set (match_operand:TI2 0 "int_reg_operand" "") -+ (match_operand:TI2 1 "const_double_operand" ""))] -+ "TARGET_POWERPC64 -+ && (VECTOR_MEM_NONE_P (<MODE>mode) -+ || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))" - [(set (match_dup 2) (match_dup 4)) - (set (match_dup 3) (match_dup 5))] - " - { - operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0, -- TImode); -+ <MODE>mode); - operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0, -- TImode); -+ <MODE>mode); - if (GET_CODE (operands[1]) == CONST_DOUBLE) - { - operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1])); -@@ -8792,10 +10427,12 @@ - }") - - (define_split -- [(set (match_operand:TI 0 "nonimmediate_operand" "") -- (match_operand:TI 1 "input_operand" ""))] -- "reload_completed && VECTOR_MEM_NONE_P (TImode) -- && gpr_or_gpr_p (operands[0], operands[1])" -+ [(set (match_operand:TI2 0 "nonimmediate_operand" "") -+ (match_operand:TI2 1 "input_operand" ""))] -+ "reload_completed -+ && gpr_or_gpr_p (operands[0], operands[1]) -+ && !direct_move_p (operands[0], operands[1]) -+ && !quad_load_store_p (operands[0], operands[1])" - [(pc)] - { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }) - -@@ -9651,7 +11288,7 @@ - (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] - UNSPEC_TLSGD) - (clobber (reg:SI LR_REGNO))] -- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX" -+ "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)" - { - if (TARGET_CMODEL != CMODEL_SMALL) - return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;" -@@ -9723,7 +11360,7 @@ - (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD))) - (set (match_dup 0) - (lo_sum:TLSmode (match_dup 3) -- (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))] -+ (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))] - " - { - operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode); -@@ -9746,7 +11383,8 @@ - (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>" - [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") - (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b") -- (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] -+ (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b") -+ (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] - UNSPEC_TLSGD)))] - "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL" - "addi %0,%1,%2@got@tlsgd@l" -@@ -9759,7 +11397,8 @@ - (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")] - UNSPEC_TLSGD) - (clobber (reg:SI LR_REGNO))] -- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS" -+ "HAVE_AS_TLS && TARGET_TLS_MARKERS -+ && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)" - "bl %z1(%3@tlsgd)\;nop" - [(set_attr "type" "branch") - (set_attr "length" "8")]) -@@ -9791,7 +11430,7 @@ - (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")] - UNSPEC_TLSLD) - (clobber (reg:SI LR_REGNO))] -- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX" -+ "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)" - { - if (TARGET_CMODEL != CMODEL_SMALL) - return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;" -@@ -9858,7 +11497,7 @@ - (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD))) - (set (match_dup 0) - (lo_sum:TLSmode (match_dup 2) -- (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))] -+ (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))] - " - { - operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode); -@@ -9881,7 +11520,9 @@ - (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>" - [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") - (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b") -- (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))] -+ (unspec:TLSmode [(const_int 0) -+ (match_operand:TLSmode 2 "gpc_reg_operand" "b")] -+ UNSPEC_TLSLD)))] - "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL" - "addi %0,%1,%&@got@tlsld@l" - [(set_attr "length" "4")]) -@@ -9892,7 +11533,8 @@ - (match_operand 2 "" "g"))) - (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD) - (clobber (reg:SI LR_REGNO))] -- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS" -+ "HAVE_AS_TLS && TARGET_TLS_MARKERS -+ && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)" - "bl %z1(%&@tlsld)\;nop" - [(set_attr "type" "branch") - (set_attr "length" "8")]) -@@ -9953,7 +11595,7 @@ - (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL))) - (set (match_dup 0) - (lo_sum:TLSmode (match_dup 3) -- (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))] -+ (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))] - " - { - operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode); -@@ -9976,7 +11618,8 @@ - (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>" - [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r") - (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b") -- (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] -+ (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b") -+ (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] - UNSPEC_TLSGOTDTPREL)))] - "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL" - "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)" -@@ -10022,7 +11665,7 @@ - (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL))) - (set (match_dup 0) - (lo_sum:TLSmode (match_dup 3) -- (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))] -+ (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))] - " - { - operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode); -@@ -10045,7 +11688,8 @@ - (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>" - [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r") - (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b") -- (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] -+ (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b") -+ (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] - UNSPEC_TLSGOTTPREL)))] - "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL" - "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)" -@@ -10261,7 +11905,7 @@ - [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (unspec:SI [(const_int 0)] UNSPEC_TOC)) - (use (reg:SI 2))])] -- "DEFAULT_ABI == ABI_AIX && TARGET_32BIT" -+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT" - "* - { - char buf[30]; -@@ -10276,7 +11920,7 @@ - [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_TOC)) - (use (reg:DI 2))])] -- "DEFAULT_ABI == ABI_AIX && TARGET_64BIT" -+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT" - "* - { - char buf[30]; -@@ -10306,7 +11950,7 @@ - [(parallel [(set (reg:SI LR_REGNO) - (match_operand:SI 0 "immediate_operand" "s")) - (use (unspec [(match_dup 0)] UNSPEC_TOC))])] -- "TARGET_ELF && DEFAULT_ABI != ABI_AIX -+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 - && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))" - "") - -@@ -10314,7 +11958,7 @@ - [(set (reg:SI LR_REGNO) - (match_operand:SI 0 "immediate_operand" "s")) - (use (unspec [(match_dup 0)] UNSPEC_TOC))] -- "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX -+ "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 - && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))" - "bcl 20,31,%0\\n%0:" - [(set_attr "type" "branch") -@@ -10324,7 +11968,7 @@ - [(set (reg:SI LR_REGNO) - (match_operand:SI 0 "immediate_operand" "s")) - (use (unspec [(match_dup 0)] UNSPEC_TOC))] -- "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX -+ "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 - && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))" - "* - { -@@ -10344,7 +11988,7 @@ - (label_ref (match_operand 1 "" ""))] - UNSPEC_TOCPTR)) - (match_dup 1)])] -- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2" -+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2" - "") - - (define_insn "load_toc_v4_PIC_1b_normal" -@@ -10353,7 +11997,7 @@ - (label_ref (match_operand 1 "" ""))] - UNSPEC_TOCPTR)) - (match_dup 1)] -- "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2" -+ "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2" - "bcl 20,31,$+8\;.long %0-$" - [(set_attr "type" "branch") - (set_attr "length" "8")]) -@@ -10364,7 +12008,7 @@ - (label_ref (match_operand 1 "" ""))] - UNSPEC_TOCPTR)) - (match_dup 1)] -- "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2" -+ "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2" - "* - { - char name[32]; -@@ -10382,7 +12026,7 @@ - (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b") - (minus:SI (match_operand:SI 2 "immediate_operand" "s") - (match_operand:SI 3 "immediate_operand" "s")))))] -- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2" -+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2" - "lwz %0,%2-%3(%1)" - [(set_attr "type" "load")]) - -@@ -10392,7 +12036,7 @@ - (high:SI - (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s") - (match_operand:SI 3 "symbol_ref_operand" "s")))))] -- "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic" -+ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic" - "addis %0,%1,%2-%3@ha") - - (define_insn "load_toc_v4_PIC_3c" -@@ -10400,7 +12044,7 @@ - (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b") - (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s") - (match_operand:SI 3 "symbol_ref_operand" "s"))))] -- "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic" -+ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic" - "addi %0,%1,%2-%3@l") - - ;; If the TOC is shared over a translation unit, as happens with all -@@ -10542,8 +12186,13 @@ - - operands[0] = XEXP (operands[0], 0); - -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]); -+ DONE; -+ } -+ - if (GET_CODE (operands[0]) != SYMBOL_REF -- || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0])) - || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0)) - { - if (INTVAL (operands[2]) & CALL_LONG) -@@ -10556,12 +12205,6 @@ - operands[0] = force_reg (Pmode, operands[0]); - break; - -- case ABI_AIX: -- /* AIX function pointers are really pointers to a three word -- area. */ -- rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]); -- DONE; -- - default: - gcc_unreachable (); - } -@@ -10587,8 +12230,13 @@ - - operands[1] = XEXP (operands[1], 0); - -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]); -+ DONE; -+ } -+ - if (GET_CODE (operands[1]) != SYMBOL_REF -- || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1])) - || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0)) - { - if (INTVAL (operands[3]) & CALL_LONG) -@@ -10601,12 +12249,6 @@ - operands[1] = force_reg (Pmode, operands[1]); - break; - -- case ABI_AIX: -- /* AIX function pointers are really pointers to a three word -- area. */ -- rs6000_call_indirect_aix (operands[0], operands[1], operands[2]); -- DONE; -- - default: - gcc_unreachable (); - } -@@ -10698,136 +12340,7 @@ - [(set_attr "type" "branch") - (set_attr "length" "4,8")]) - --;; Call to indirect functions with the AIX abi using a 3 word descriptor. --;; Operand0 is the addresss of the function to call --;; Operand1 is the flag for System V.4 for unprototyped or FP registers --;; Operand2 is the location in the function descriptor to load r2 from --;; Operand3 is the stack location to hold the current TOC pointer - --(define_insn "call_indirect_aix<ptrsize>" -- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) -- (match_operand 1 "" "g,g")) -- (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>")) -- (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -- (use (reg:P STATIC_CHAIN_REGNUM)) -- (clobber (reg:P LR_REGNO))] -- "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS" -- "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3" -- [(set_attr "type" "jmpreg") -- (set_attr "length" "12")]) -- --;; Like call_indirect_aix<ptrsize>, but no use of the static chain --;; Operand0 is the addresss of the function to call --;; Operand1 is the flag for System V.4 for unprototyped or FP registers --;; Operand2 is the location in the function descriptor to load r2 from --;; Operand3 is the stack location to hold the current TOC pointer -- --(define_insn "call_indirect_aix<ptrsize>_nor11" -- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) -- (match_operand 1 "" "g,g")) -- (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>")) -- (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -- (clobber (reg:P LR_REGNO))] -- "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" -- "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3" -- [(set_attr "type" "jmpreg") -- (set_attr "length" "12")]) -- --;; Operand0 is the return result of the function --;; Operand1 is the addresss of the function to call --;; Operand2 is the flag for System V.4 for unprototyped or FP registers --;; Operand3 is the location in the function descriptor to load r2 from --;; Operand4 is the stack location to hold the current TOC pointer -- --(define_insn "call_value_indirect_aix<ptrsize>" -- [(set (match_operand 0 "" "") -- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) -- (match_operand 2 "" "g,g"))) -- (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -- (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>")) -- (use (reg:P STATIC_CHAIN_REGNUM)) -- (clobber (reg:P LR_REGNO))] -- "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS" -- "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4" -- [(set_attr "type" "jmpreg") -- (set_attr "length" "12")]) -- --;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain --;; Operand0 is the return result of the function --;; Operand1 is the addresss of the function to call --;; Operand2 is the flag for System V.4 for unprototyped or FP registers --;; Operand3 is the location in the function descriptor to load r2 from --;; Operand4 is the stack location to hold the current TOC pointer -- --(define_insn "call_value_indirect_aix<ptrsize>_nor11" -- [(set (match_operand 0 "" "") -- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) -- (match_operand 2 "" "g,g"))) -- (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -- (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>")) -- (clobber (reg:P LR_REGNO))] -- "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS" -- "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4" -- [(set_attr "type" "jmpreg") -- (set_attr "length" "12")]) -- --;; Call to function which may be in another module. Restore the TOC --;; pointer (r2) after the call unless this is System V. --;; Operand2 is nonzero if we are using the V.4 calling sequence and --;; either the function was not prototyped, or it was prototyped as a --;; variable argument function. It is > 0 if FP registers were passed --;; and < 0 if they were not. -- --(define_insn "*call_nonlocal_aix32" -- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s")) -- (match_operand 1 "" "g")) -- (use (match_operand:SI 2 "immediate_operand" "O")) -- (clobber (reg:SI LR_REGNO))] -- "TARGET_32BIT -- && DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[2]) & CALL_LONG) == 0" -- "bl %z0\;nop" -- [(set_attr "type" "branch") -- (set_attr "length" "8")]) -- --(define_insn "*call_nonlocal_aix64" -- [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s")) -- (match_operand 1 "" "g")) -- (use (match_operand:SI 2 "immediate_operand" "O")) -- (clobber (reg:SI LR_REGNO))] -- "TARGET_64BIT -- && DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[2]) & CALL_LONG) == 0" -- "bl %z0\;nop" -- [(set_attr "type" "branch") -- (set_attr "length" "8")]) -- --(define_insn "*call_value_nonlocal_aix32" -- [(set (match_operand 0 "" "") -- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s")) -- (match_operand 2 "" "g"))) -- (use (match_operand:SI 3 "immediate_operand" "O")) -- (clobber (reg:SI LR_REGNO))] -- "TARGET_32BIT -- && DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[3]) & CALL_LONG) == 0" -- "bl %z1\;nop" -- [(set_attr "type" "branch") -- (set_attr "length" "8")]) -- --(define_insn "*call_value_nonlocal_aix64" -- [(set (match_operand 0 "" "") -- (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s")) -- (match_operand 2 "" "g"))) -- (use (match_operand:SI 3 "immediate_operand" "O")) -- (clobber (reg:SI LR_REGNO))] -- "TARGET_64BIT -- && DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[3]) & CALL_LONG) == 0" -- "bl %z1\;nop" -- [(set_attr "type" "branch") -- (set_attr "length" "8")]) -- - ;; A function pointer under System V is just a normal pointer - ;; operands[0] is the function pointer - ;; operands[1] is the stack size to clean up -@@ -11009,6 +12522,104 @@ - [(set_attr "type" "branch,branch") - (set_attr "length" "4,8")]) - -+ -+;; Call to AIX abi function in the same module. -+ -+(define_insn "*call_local_aix<mode>" -+ [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s")) -+ (match_operand 1 "" "g")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "bl %z0" -+ [(set_attr "type" "branch") -+ (set_attr "length" "4")]) -+ -+(define_insn "*call_value_local_aix<mode>" -+ [(set (match_operand 0 "" "") -+ (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s")) -+ (match_operand 2 "" "g"))) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "bl %z1" -+ [(set_attr "type" "branch") -+ (set_attr "length" "4")]) -+ -+;; Call to AIX abi function which may be in another module. -+;; Restore the TOC pointer (r2) after the call. -+ -+(define_insn "*call_nonlocal_aix<mode>" -+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s")) -+ (match_operand 1 "" "g")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "bl %z0\;nop" -+ [(set_attr "type" "branch") -+ (set_attr "length" "8")]) -+ -+(define_insn "*call_value_nonlocal_aix<mode>" -+ [(set (match_operand 0 "" "") -+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s")) -+ (match_operand 2 "" "g"))) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "bl %z1\;nop" -+ [(set_attr "type" "branch") -+ (set_attr "length" "8")]) -+ -+;; Call to indirect functions with the AIX abi using a 3 word descriptor. -+;; Operand0 is the addresss of the function to call -+;; Operand2 is the location in the function descriptor to load r2 from -+;; Operand3 is the stack location to hold the current TOC pointer -+ -+(define_insn "*call_indirect_aix<mode>" -+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) -+ (match_operand 1 "" "g,g")) -+ (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>")) -+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX" -+ "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3" -+ [(set_attr "type" "jmpreg") -+ (set_attr "length" "12")]) -+ -+(define_insn "*call_value_indirect_aix<mode>" -+ [(set (match_operand 0 "" "") -+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) -+ (match_operand 2 "" "g,g"))) -+ (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -+ (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_AIX" -+ "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4" -+ [(set_attr "type" "jmpreg") -+ (set_attr "length" "12")]) -+ -+;; Call to indirect functions with the ELFv2 ABI. -+;; Operand0 is the addresss of the function to call -+;; Operand2 is the stack location to hold the current TOC pointer -+ -+(define_insn "*call_indirect_elfv2<mode>" -+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l")) -+ (match_operand 1 "" "g,g")) -+ (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_ELFv2" -+ "b%T0l\;<ptrload> 2,%2" -+ [(set_attr "type" "jmpreg") -+ (set_attr "length" "8")]) -+ -+(define_insn "*call_value_indirect_elfv2<mode>" -+ [(set (match_operand 0 "" "") -+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l")) -+ (match_operand 2 "" "g,g"))) -+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>")) -+ (clobber (reg:P LR_REGNO))] -+ "DEFAULT_ABI == ABI_ELFv2" -+ "b%T1l\;<ptrload> 2,%3" -+ [(set_attr "type" "jmpreg") -+ (set_attr "length" "8")]) -+ -+ - ;; Call subroutine returning any type. - (define_expand "untyped_call" - [(parallel [(call (match_operand 0 "" "") -@@ -11056,8 +12667,41 @@ - gcc_assert (GET_CODE (operands[1]) == CONST_INT); - - operands[0] = XEXP (operands[0], 0); -+ -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]); -+ DONE; -+ } - }") - -+(define_expand "sibcall_value" -+ [(parallel [(set (match_operand 0 "register_operand" "") -+ (call (mem:SI (match_operand 1 "address_operand" "")) -+ (match_operand 2 "" ""))) -+ (use (match_operand 3 "" "")) -+ (use (reg:SI LR_REGNO)) -+ (simple_return)])] -+ "" -+ " -+{ -+#if TARGET_MACHO -+ if (MACHOPIC_INDIRECT) -+ operands[1] = machopic_indirect_call_target (operands[1]); -+#endif -+ -+ gcc_assert (GET_CODE (operands[1]) == MEM); -+ gcc_assert (GET_CODE (operands[2]) == CONST_INT); -+ -+ operands[1] = XEXP (operands[1], 0); -+ -+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) -+ { -+ rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]); -+ DONE; -+ } -+}") -+ - ;; this and similar patterns must be marked as using LR, otherwise - ;; dataflow will try to delete the store into it. This is true - ;; even when the actual reg to jump to is in CTR, when LR was -@@ -11123,7 +12767,6 @@ - [(set_attr "type" "branch") - (set_attr "length" "4,8")]) - -- - (define_insn "*sibcall_value_local64" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s")) -@@ -11145,35 +12788,6 @@ - [(set_attr "type" "branch") - (set_attr "length" "4,8")]) - --(define_insn "*sibcall_nonlocal_aix<mode>" -- [(call (mem:SI (match_operand:P 0 "call_operand" "s,c")) -- (match_operand 1 "" "g,g")) -- (use (match_operand:SI 2 "immediate_operand" "O,O")) -- (use (reg:SI LR_REGNO)) -- (simple_return)] -- "DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[2]) & CALL_LONG) == 0" -- "@ -- b %z0 -- b%T0" -- [(set_attr "type" "branch") -- (set_attr "length" "4")]) -- --(define_insn "*sibcall_value_nonlocal_aix<mode>" -- [(set (match_operand 0 "" "") -- (call (mem:SI (match_operand:P 1 "call_operand" "s,c")) -- (match_operand 2 "" "g,g"))) -- (use (match_operand:SI 3 "immediate_operand" "O,O")) -- (use (reg:SI LR_REGNO)) -- (simple_return)] -- "DEFAULT_ABI == ABI_AIX -- && (INTVAL (operands[3]) & CALL_LONG) == 0" -- "@ -- b %z1 -- b%T1" -- [(set_attr "type" "branch") -- (set_attr "length" "4")]) +- "") - - (define_insn "*sibcall_nonlocal_sysv<mode>" - [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c")) - (match_operand 1 "" "")) -@@ -11204,27 +12818,6 @@ - [(set_attr "type" "branch") - (set_attr "length" "4,8,4,8")]) - --(define_expand "sibcall_value" -- [(parallel [(set (match_operand 0 "register_operand" "") -- (call (mem:SI (match_operand 1 "address_operand" "")) -- (match_operand 2 "" ""))) -- (use (match_operand 3 "" "")) -- (use (reg:SI LR_REGNO)) -- (simple_return)])] +-(define_expand "unpacktf_1" +- [(set (match_operand:DF 0 "nonimmediate_operand" "") +- (unspec:DF [(match_operand:TF 1 "register_operand" "") +- (const_int 1)] +- UNSPEC_UNPACK_128BIT))] - "" -- " --{ --#if TARGET_MACHO -- if (MACHOPIC_INDIRECT) -- operands[1] = machopic_indirect_call_target (operands[1]); --#endif -- -- gcc_assert (GET_CODE (operands[1]) == MEM); -- gcc_assert (GET_CODE (operands[2]) == CONST_INT); -- -- operands[1] = XEXP (operands[1], 0); --}") -- - (define_insn "*sibcall_value_nonlocal_sysv<mode>" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c")) -@@ -11256,6 +12849,31 @@ - [(set_attr "type" "branch") - (set_attr "length" "4,8,4,8")]) - -+;; AIX ABI sibling call patterns. -+ -+(define_insn "*sibcall_aix<mode>" -+ [(call (mem:SI (match_operand:P 0 "call_operand" "s,c")) -+ (match_operand 1 "" "g,g")) -+ (simple_return)] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "@ -+ b %z0 -+ b%T0" -+ [(set_attr "type" "branch") -+ (set_attr "length" "4")]) -+ -+(define_insn "*sibcall_value_aix<mode>" -+ [(set (match_operand 0 "" "") -+ (call (mem:SI (match_operand:P 1 "call_operand" "s,c")) -+ (match_operand 2 "" "g,g"))) -+ (simple_return)] -+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2" -+ "@ -+ b %z1 -+ b%T1" -+ [(set_attr "type" "branch") -+ (set_attr "length" "4")]) -+ - (define_expand "sibcall_epilogue" - [(use (const_int 0))] - "" -@@ -11294,7 +12912,14 @@ - operands[1] = gen_rtx_REG (Pmode, 0); - return "st<wd>%U0%X0 %1,%0"; - } -- [(set_attr "type" "store") -+ [(set (attr "type") -+ (if_then_else -+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)") -+ (const_string "store_ux") -+ (if_then_else -+ (match_test "update_address_mem (operands[0], VOIDmode)") -+ (const_string "store_u") -+ (const_string "store")))) - (set_attr "length" "4")]) - - (define_insn "probe_stack_range<P:mode>" -@@ -11589,23 +13214,6 @@ - [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2))) - (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))]) - --(define_insn "*cmpsf_internal1" -- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") -- (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f") -- (match_operand:SF 2 "gpc_reg_operand" "f")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" -- "fcmpu %0,%1,%2" -- [(set_attr "type" "fpcompare")]) -- --(define_insn "*cmpdf_internal1" -- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") -- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d") -- (match_operand:DF 2 "gpc_reg_operand" "d")))] -- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT -- && !VECTOR_UNIT_VSX_P (DFmode)" -- "fcmpu %0,%1,%2" -- [(set_attr "type" "fpcompare")]) -- - ;; Only need to compare second words if first words equal - (define_insn "*cmptf_internal1" - [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") -@@ -13501,6 +15109,14 @@ - "mfcr %0" - [(set_attr "type" "mfcr")]) - -+(define_insn "*crsave" -+ [(match_parallel 0 "crsave_operation" -+ [(set (match_operand:SI 1 "memory_operand" "=m") -+ (match_operand:SI 2 "gpc_reg_operand" "r"))])] -+ "" -+ "stw %2,%1" -+ [(set_attr "type" "store")]) -+ - (define_insn "*stmw" - [(match_parallel 0 "stmw_operation" - [(set (match_operand:SI 1 "memory_operand" "=m") -@@ -13885,7 +15501,7 @@ - (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))] - "TARGET_POPCNTD" - "bpermd %0,%1,%2" -- [(set_attr "type" "integer")]) -+ [(set_attr "type" "popcnt")]) - - - ;; Builtin fma support. Handle -@@ -13900,6 +15516,20 @@ - "" - "") - -+(define_insn "*fma<mode>4_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>") -+ (fma:SFDF -+ (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0") -+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fmadd<Ftrad> %0,%1,%2,%3 -+ xsmadda<Fvsx> %x0,%x1,%x2 -+ xsmaddm<Fvsx> %x0,%x1,%x3" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_maddsub_<Fs>")]) -+ - ; Altivec only has fma and nfms. - (define_expand "fms<mode>4" - [(set (match_operand:FMA_F 0 "register_operand" "") -@@ -13910,6 +15540,20 @@ - "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "") - -+(define_insn "*fms<mode>4_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>") -+ (fma:SFDF -+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0") -+ (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fmsub<Ftrad> %0,%1,%2,%3 -+ xsmsuba<Fvsx> %x0,%x1,%x2 -+ xsmsubm<Fvsx> %x0,%x1,%x3" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_maddsub_<Fs>")]) -+ - ;; If signed zeros are ignored, -(a * b - c) = -a * b + c. - (define_expand "fnma<mode>4" - [(set (match_operand:FMA_F 0 "register_operand" "") -@@ -13943,6 +15587,21 @@ - "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" - "") - -+(define_insn "*nfma<mode>4_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>") -+ (neg:SFDF -+ (fma:SFDF -+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0") -+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fnmadd<Ftrad> %0,%1,%2,%3 -+ xsnmadda<Fvsx> %x0,%x1,%x2 -+ xsnmaddm<Fvsx> %x0,%x1,%x3" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_maddsub_<Fs>")]) -+ - ; Not an official optab name, but used from builtins. - (define_expand "nfms<mode>4" - [(set (match_operand:FMA_F 0 "register_operand" "") -@@ -13954,6 +15613,23 @@ - "" - "") - -+(define_insn "*nfmssf4_fpr" -+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>") -+ (neg:SFDF -+ (fma:SFDF -+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>") -+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0") -+ (neg:SFDF -+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))] -+ "TARGET_<MODE>_FPR" -+ "@ -+ fnmsub<Ftrad> %0,%1,%2,%3 -+ xsnmsuba<Fvsx> %x0,%x1,%x2 -+ xsnmsubm<Fvsx> %x0,%x1,%x3" -+ [(set_attr "type" "fp") -+ (set_attr "fp_type" "fp_maddsub_<Fs>")]) -+ -+ - (define_expand "rs6000_get_timebase" - [(use (match_operand:DI 0 "gpc_reg_operand" ""))] - "" -@@ -14020,7 +15696,44 @@ - }) - - -+;; Power8 fusion support for fusing an addis instruction with a D-form load of -+;; a GPR. The addis instruction must be adjacent to the load, and use the same -+;; register that is being loaded. The fused ops must be physically adjacent. - -+;; We use define_peephole for the actual addis/load, and the register used to -+;; hold the addis value must be the same as the register being loaded. We use -+;; define_peephole2 to change the register used for addis to be the register -+;; being loaded, since we can look at whether it is dead after the load insn. -+ -+(define_peephole -+ [(set (match_operand:P 0 "base_reg_operand" "") -+ (match_operand:P 1 "fusion_gpr_addis" "")) -+ (set (match_operand:INT1 2 "base_reg_operand" "") -+ (match_operand:INT1 3 "fusion_gpr_mem_load" ""))] -+ "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)" -+{ -+ return emit_fusion_gpr_load (operands); -+} -+ [(set_attr "type" "load") -+ (set_attr "length" "8")]) -+ -+(define_peephole2 -+ [(set (match_operand:P 0 "base_reg_operand" "") -+ (match_operand:P 1 "fusion_gpr_addis" "")) -+ (set (match_operand:INT1 2 "base_reg_operand" "") -+ (match_operand:INT1 3 "fusion_gpr_mem_load" ""))] -+ "TARGET_P8_FUSION -+ && (REGNO (operands[0]) != REGNO (operands[2]) -+ || GET_CODE (operands[3]) == SIGN_EXTEND) -+ && fusion_gpr_load_p (operands, true)" -+ [(const_int 0)] -+{ -+ expand_fusion_gpr_load (operands); -+ DONE; -+}) -+ -+ -+ - (include "sync.md") - (include "vector.md") - (include "vsx.md") -@@ -14028,3 +15741,5 @@ - (include "spe.md") - (include "dfp.md") - (include "paired.md") -+(include "crypto.md") -+(include "htm.md") -Index: gcc/config/rs6000/t-linux64le -=================================================================== ---- a/src/gcc/config/rs6000/t-linux64le (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/t-linux64le (.../branches/gcc-4_8-branch) -@@ -0,0 +1,3 @@ -+#rs6000/t-linux64le -+ -+MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) -Index: gcc/config/rs6000/t-linux64lebe -=================================================================== ---- a/src/gcc/config/rs6000/t-linux64lebe (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/t-linux64lebe (.../branches/gcc-4_8-branch) -@@ -0,0 +1,7 @@ -+#rs6000/t-linux64leend -+ -+MULTILIB_OPTIONS += mbig -+MULTILIB_DIRNAMES += be -+MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) -+MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} -Index: gcc/config/rs6000/rs6000-opts.h -=================================================================== ---- a/src/gcc/config/rs6000/rs6000-opts.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/rs6000-opts.h (.../branches/gcc-4_8-branch) -@@ -59,7 +59,8 @@ - PROCESSOR_POWER7, - PROCESSOR_CELL, - PROCESSOR_PPCA2, -- PROCESSOR_TITAN -+ PROCESSOR_TITAN, -+ PROCESSOR_POWER8 - }; - - /* FP processor type. */ -@@ -100,7 +101,8 @@ - /* Enumeration to give which calling sequence to use. */ - enum rs6000_abi { - ABI_NONE, -- ABI_AIX, /* IBM's AIX */ -+ ABI_AIX, /* IBM's AIX, or Linux ELFv1 */ -+ ABI_ELFv2, /* Linux ELFv2 ABI */ - ABI_V4, /* System V.4/eabi */ - ABI_DARWIN /* Apple's Darwin (OS X kernel) */ - }; -@@ -131,11 +133,14 @@ - CMODEL_LARGE - }; - --/* Describe which vector unit to use for a given machine mode. */ -+/* Describe which vector unit to use for a given machine mode. The -+ VECTOR_MEM_* and VECTOR_UNIT_* macros assume that Altivec, VSX, and -+ P8_VECTOR are contiguous. */ - enum rs6000_vector { - VECTOR_NONE, /* Type is not a vector or not supported */ - VECTOR_ALTIVEC, /* Use altivec for vector processing */ - VECTOR_VSX, /* Use VSX for vector processing */ -+ VECTOR_P8_VECTOR, /* Use ISA 2.07 VSX for vector processing */ - VECTOR_PAIRED, /* Use paired floating point for vectors */ - VECTOR_SPE, /* Use SPE for vector processing */ - VECTOR_OTHER /* Some other vector unit */ -Index: gcc/config/rs6000/option-defaults.h -=================================================================== ---- a/src/gcc/config/rs6000/option-defaults.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/option-defaults.h (.../branches/gcc-4_8-branch) -@@ -54,6 +54,7 @@ - --with-float is ignored if -mhard-float or -msoft-float are - specified. */ - #define OPTION_DEFAULT_SPECS \ -+ {"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, \ - {"tune", "%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}" }, \ - {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \ - {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \ -Index: gcc/config/rs6000/driver-rs6000.c -=================================================================== ---- a/src/gcc/config/rs6000/driver-rs6000.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/driver-rs6000.c (.../branches/gcc-4_8-branch) -@@ -167,7 +167,7 @@ - - if (fd != -1) - { -- char buf[1024]; -+ static char buf[1024]; - ElfW(auxv_t) *av; - ssize_t n; - -Index: gcc/config/rs6000/altivec.h -=================================================================== ---- a/src/gcc/config/rs6000/altivec.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/altivec.h (.../branches/gcc-4_8-branch) -@@ -321,6 +321,50 @@ - #define vec_vsx_st __builtin_vec_vsx_st - #endif - -+#ifdef _ARCH_PWR8 -+/* Vector additions added in ISA 2.07. */ -+#define vec_eqv __builtin_vec_eqv -+#define vec_nand __builtin_vec_nand -+#define vec_orc __builtin_vec_orc -+#define vec_vaddcuq __builtin_vec_vaddcuq -+#define vec_vaddudm __builtin_vec_vaddudm -+#define vec_vadduqm __builtin_vec_vadduqm -+#define vec_vclz __builtin_vec_vclz -+#define vec_vclzb __builtin_vec_vclzb -+#define vec_vclzd __builtin_vec_vclzd -+#define vec_vclzh __builtin_vec_vclzh -+#define vec_vclzw __builtin_vec_vclzw -+#define vec_vaddecuq __builtin_vec_vaddecuq -+#define vec_vaddeuqm __builtin_vec_vaddeuqm -+#define vec_vsubecuq __builtin_vec_vsubecuq -+#define vec_vsubeuqm __builtin_vec_vsubeuqm -+#define vec_vgbbd __builtin_vec_vgbbd -+#define vec_vmaxsd __builtin_vec_vmaxsd -+#define vec_vmaxud __builtin_vec_vmaxud -+#define vec_vminsd __builtin_vec_vminsd -+#define vec_vminud __builtin_vec_vminud -+#define vec_vmrgew __builtin_vec_vmrgew -+#define vec_vmrgow __builtin_vec_vmrgow -+#define vec_vpksdss __builtin_vec_vpksdss -+#define vec_vpksdus __builtin_vec_vpksdus -+#define vec_vpkudum __builtin_vec_vpkudum -+#define vec_vpkudus __builtin_vec_vpkudus -+#define vec_vpopcnt __builtin_vec_vpopcnt -+#define vec_vpopcntb __builtin_vec_vpopcntb -+#define vec_vpopcntd __builtin_vec_vpopcntd -+#define vec_vpopcnth __builtin_vec_vpopcnth -+#define vec_vpopcntw __builtin_vec_vpopcntw -+#define vec_vrld __builtin_vec_vrld -+#define vec_vsld __builtin_vec_vsld -+#define vec_vsrad __builtin_vec_vsrad -+#define vec_vsrd __builtin_vec_vsrd -+#define vec_vsubcuq __builtin_vec_vsubcuq -+#define vec_vsubudm __builtin_vec_vsubudm -+#define vec_vsubuqm __builtin_vec_vsubuqm -+#define vec_vupkhsw __builtin_vec_vupkhsw -+#define vec_vupklsw __builtin_vec_vupklsw -+#endif -+ - /* Predicates. - For C++, we use templates in order to allow non-parenthesized arguments. - For C, instead, we use macros since non-parenthesized arguments were -Index: gcc/config/rs6000/sysv4.h -=================================================================== ---- a/src/gcc/config/rs6000/sysv4.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/rs6000/sysv4.h (.../branches/gcc-4_8-branch) -@@ -45,7 +45,7 @@ - & (OPTION_MASK_RELOCATABLE \ - | OPTION_MASK_MINIMAL_TOC)) \ - && flag_pic > 1) \ -- || DEFAULT_ABI == ABI_AIX) -+ || DEFAULT_ABI != ABI_V4) - - #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE) - #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) -@@ -147,7 +147,7 @@ - rs6000_sdata_name); \ - } \ - \ -- else if (flag_pic && DEFAULT_ABI != ABI_AIX \ -+ else if (flag_pic && DEFAULT_ABI == ABI_V4 \ - && (rs6000_sdata == SDATA_EABI \ - || rs6000_sdata == SDATA_SYSV)) \ - { \ -@@ -173,7 +173,7 @@ - error ("-mrelocatable and -mno-minimal-toc are incompatible"); \ - } \ - \ -- if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \ -+ if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \ - { \ - rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ - error ("-mrelocatable and -mcall-%s are incompatible", \ -@@ -180,7 +180,7 @@ - rs6000_abi_name); \ - } \ - \ -- if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \ -+ if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \ - { \ - flag_pic = 0; \ - error ("-fPIC and -mcall-%s are incompatible", \ -@@ -193,7 +193,7 @@ - } \ - \ - /* Treat -fPIC the same as -mrelocatable. */ \ -- if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \ -+ if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \ - { \ - rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \ - TARGET_NO_FP_IN_TOC = 1; \ -@@ -317,7 +317,7 @@ - - /* Put PC relative got entries in .got2. */ - #define MINIMAL_TOC_SECTION_ASM_OP \ -- (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \ -+ (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI == ABI_V4) \ - ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") - - #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\"" -@@ -522,8 +522,6 @@ - #define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT) \ - "%{mlittle|mlittle-endian:" LITTLE_OPT ";" \ - "mbig|mbig-endian:" BIG_OPT ";" \ -- "mcall-aixdesc|mcall-freebsd|mcall-netbsd|" \ -- "mcall-openbsd|mcall-linux:" BIG_OPT ";" \ - "mcall-i960-old:" LITTLE_OPT ";" \ - ":" DEFAULT_OPT "}" - -@@ -536,25 +534,12 @@ - %{memb|msdata=eabi: -memb}" \ - ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) - --#define CC1_ENDIAN_BIG_SPEC "" -- --#define CC1_ENDIAN_LITTLE_SPEC "\ --%{!mstrict-align: %{!mno-strict-align: \ -- %{!mcall-i960-old: \ -- -mstrict-align \ -- } \ --}}" -- --#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)" +- "") - - #ifndef CC1_SECURE_PLT_DEFAULT_SPEC - #define CC1_SECURE_PLT_DEFAULT_SPEC "" - #endif - --/* Pass -G xxx to the compiler and set correct endian mode. */ -+/* Pass -G xxx to the compiler. */ - #define CC1_SPEC "%{G*} %(cc1_cpu)" \ -- ENDIAN_SELECT(" %(cc1_endian_big)", " %(cc1_endian_little)", \ -- " %(cc1_endian_default)") \ - "%{meabi: %{!mcall-*: -mcall-sysv }} \ - %{!meabi: %{!mno-eabi: \ - %{mrelocatable: -meabi } \ -@@ -908,9 +893,6 @@ - { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ - { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ - { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ -- { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \ -- { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ -- { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \ - { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ - { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ - { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ -Index: gcc/config/tilepro/tilepro-c.c -=================================================================== ---- a/src/gcc/config/tilepro/tilepro-c.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilepro/tilepro-c.c (.../branches/gcc-4_8-branch) -@@ -44,6 +44,11 @@ - builtin_define ("__tile_chip__=1"); - builtin_define ("__tile_chip_rev__=0"); - -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); -+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); -+ - TILEPRO_CPU_CPP_ENDIAN_BUILTINS (); - GNU_USER_TARGET_OS_CPP_BUILTINS (); - } -Index: gcc/config/tilepro/tilepro.c -=================================================================== ---- a/src/gcc/config/tilepro/tilepro.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilepro/tilepro.c (.../branches/gcc-4_8-branch) -@@ -3167,6 +3167,12 @@ - } - if (!pat) - return NULL_RTX; -+ -+ /* If we are generating a prefetch, tell the scheduler not to move -+ it around. */ -+ if (GET_CODE (pat) == PREFETCH) -+ PREFETCH_SCHEDULE_BARRIER_P (pat) = true; -+ - emit_insn (pat); - - if (nonvoid) -Index: gcc/config/tilepro/tilepro.md -=================================================================== ---- a/src/gcc/config/tilepro/tilepro.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/tilepro/tilepro.md (.../branches/gcc-4_8-branch) -@@ -795,7 +795,7 @@ - - (define_expand "ctzdi2" - [(set (match_operand:DI 0 "register_operand" "") -- (ctz:DI (match_operand:DI 1 "reg_or_0_operand" "")))] -+ (ctz:DI (match_operand:DI 1 "register_operand" "")))] - "" - { - rtx lo, hi, ctz_lo, ctz_hi, ctz_hi_plus_32, result; -@@ -823,7 +823,7 @@ - - (define_expand "clzdi2" - [(set (match_operand:DI 0 "register_operand" "") -- (clz:DI (match_operand:DI 1 "reg_or_0_operand" "")))] -+ (clz:DI (match_operand:DI 1 "register_operand" "")))] - "" - { - rtx lo, hi, clz_lo, clz_hi, clz_lo_plus_32, result; -@@ -851,7 +851,7 @@ - - (define_expand "ffsdi2" - [(set (match_operand:DI 0 "register_operand" "") -- (ffs:DI (match_operand:DI 1 "reg_or_0_operand" "")))] -+ (ffs:DI (match_operand:DI 1 "register_operand" "")))] - "" - { - rtx lo, hi, ctz_lo, ctz_hi, ctz_hi_plus_32, ctz, ctz_plus_1,ctz_cond; + (define_insn_and_split "unpack<mode>_dm" + [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m") + (unspec:<FP128_64> Index: gcc/config/arm/arm.c =================================================================== ---- a/src/gcc/config/arm/arm.c (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/arm/arm.c (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/arm/arm.c (.../branches/gcc-4_8-branch) -@@ -5425,7 +5425,8 @@ - if (!crtl->uses_pic_offset_table) - { - gcc_assert (can_create_pseudo_p ()); -- if (arm_pic_register != INVALID_REGNUM) -+ if (arm_pic_register != INVALID_REGNUM -+ && !(TARGET_THUMB1 && arm_pic_register > LAST_LO_REGNUM)) - { - if (!cfun->machine->pic_reg) - cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register); -@@ -5451,7 +5452,12 @@ - crtl->uses_pic_offset_table = 1; - start_sequence (); - -- arm_load_pic_register (0UL); -+ if (TARGET_THUMB1 && arm_pic_register != INVALID_REGNUM -+ && arm_pic_register > LAST_LO_REGNUM) -+ emit_move_insn (cfun->machine->pic_reg, -+ gen_rtx_REG (Pmode, arm_pic_register)); -+ else -+ arm_load_pic_register (0UL); - - seq = get_insns (); - end_sequence (); -@@ -5709,6 +5715,14 @@ - emit_insn (gen_movsi (pic_offset_table_rtx, pic_tmp)); - emit_insn (gen_pic_add_dot_plus_four (pic_reg, pic_reg, labelno)); - } -+ else if (arm_pic_register != INVALID_REGNUM -+ && arm_pic_register > LAST_LO_REGNUM -+ && REGNO (pic_reg) <= LAST_LO_REGNUM) -+ { -+ emit_insn (gen_pic_load_addr_unified (pic_reg, pic_rtx, labelno)); -+ emit_move_insn (gen_rtx_REG (Pmode, arm_pic_register), pic_reg); -+ emit_use (gen_rtx_REG (Pmode, arm_pic_register)); -+ } - else - emit_insn (gen_pic_load_addr_unified (pic_reg, pic_rtx, labelno)); - } -@@ -21279,7 +21293,11 @@ - type_mode); - } - -- op[argc] = expand_normal (arg[argc]); -+ /* Use EXPAND_MEMORY for NEON_ARG_MEMORY to ensure a MEM_P -+ be returned. */ -+ op[argc] = expand_expr (arg[argc], NULL_RTX, VOIDmode, -+ (thisarg == NEON_ARG_MEMORY -+ ? EXPAND_MEMORY : EXPAND_NORMAL)); - - switch (thisarg) - { -@@ -21298,6 +21316,9 @@ - break; - - case NEON_ARG_MEMORY: -+ /* Check if expand failed. */ -+ if (op[argc] == const0_rtx) -+ return 0; - gcc_assert (MEM_P (op[argc])); - PUT_MODE (op[argc], mode[argc]); - /* ??? arm_neon.h uses the same built-in functions for signed -@@ -23555,6 +23576,7 @@ - num_regs = bit_count (saved_regs_mask); - if ((offsets->outgoing_args != (1 + num_regs)) || cfun->calls_alloca) - { -+ emit_insn (gen_blockage ()); - /* Unwind the stack to just below the saved registers. */ - emit_insn (gen_addsi3 (stack_pointer_rtx, - hard_frame_pointer_rtx, -@@ -23583,8 +23605,8 @@ - - if (crtl->calls_eh_return) - emit_insn (gen_addsi3 (stack_pointer_rtx, -- stack_pointer_rtx, -- GEN_INT (ARM_EH_STACKADJ_REGNUM))); -+ stack_pointer_rtx, -+ gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM))); - - if (IS_STACKALIGN (func_type)) - /* Restore the original stack pointer. Before prologue, the stack was -Index: gcc/config/arm/arm.h -=================================================================== ---- a/src/gcc/config/arm/arm.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/arm.h (.../branches/gcc-4_8-branch) -@@ -1213,11 +1213,15 @@ - VFPv2. - In big-endian mode, modes greater than word size (i.e. DFmode) are stored in - VFP registers in little-endian order. We can't describe that accurately to -- GCC, so avoid taking subregs of such values. */ --#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ -- (TARGET_VFP && TARGET_BIG_END \ -- && (GET_MODE_SIZE (FROM) > UNITS_PER_WORD \ -- || GET_MODE_SIZE (TO) > UNITS_PER_WORD) \ -+ GCC, so avoid taking subregs of such values. -+ The only exception is going from a 128-bit to a 64-bit type. In that case -+ the data layout happens to be consistent for big-endian, so we explicitly allow -+ that case. */ -+#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ -+ (TARGET_VFP && TARGET_BIG_END \ -+ && !(GET_MODE_SIZE (FROM) == 16 && GET_MODE_SIZE (TO) == 8) \ -+ && (GET_MODE_SIZE (FROM) > UNITS_PER_WORD \ -+ || GET_MODE_SIZE (TO) > UNITS_PER_WORD) \ - && reg_classes_intersect_p (VFP_REGS, (CLASS))) - - /* The class value for index registers, and the one for base regs. */ -Index: gcc/config/arm/vfp.md -=================================================================== ---- a/src/gcc/config/arm/vfp.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/vfp.md (.../branches/gcc-4_8-branch) -@@ -1264,6 +1264,7 @@ - "TARGET_HARD_FLOAT && TARGET_FPU_ARMV8 <vfp_double_cond>" - "vrint<vrint_variant>%?.<V_if_elem>\\t%<V_reg>0, %<V_reg>1" - [(set_attr "predicable" "<vrint_predicable>") -+ (set_attr "conds" "<vrint_conds>") - (set_attr "type" "f_rint<vfp_type>")] - ) - -@@ -1280,7 +1281,8 @@ - (match_operand:SDF 2 "register_operand" "<F_constraint>")))] - "TARGET_HARD_FLOAT && TARGET_FPU_ARMV8 <vfp_double_cond>" - "vmaxnm.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" -- [(set_attr "type" "f_minmax<vfp_type>")] -+ [(set_attr "type" "f_minmax<vfp_type>") -+ (set_attr "conds" "unconditional")] - ) - - (define_insn "smin<mode>3" -@@ -1289,7 +1291,8 @@ - (match_operand:SDF 2 "register_operand" "<F_constraint>")))] - "TARGET_HARD_FLOAT && TARGET_FPU_ARMV8 <vfp_double_cond>" - "vminnm.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" -- [(set_attr "type" "f_minmax<vfp_type>")] -+ [(set_attr "type" "f_minmax<vfp_type>") -+ (set_attr "conds" "unconditional")] - ) - - ;; Unimplemented insns: -Index: gcc/config/arm/ldmstm.md -=================================================================== ---- a/src/gcc/config/arm/ldmstm.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/ldmstm.md (.../branches/gcc-4_8-branch) -@@ -23,15 +23,15 @@ - - (define_insn "*ldm4_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_operand:SI 5 "s_register_operand" "rk"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" -@@ -41,15 +41,15 @@ - - (define_insn "*thumb_ldm4_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_operand:SI 5 "s_register_operand" "l"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 4" -@@ -60,15 +60,15 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int 16))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 5))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 5" -@@ -80,15 +80,15 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 5 "s_register_operand" "+&l") - (plus:SI (match_dup 5) (const_int 16))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_dup 5))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 5" -@@ -98,13 +98,13 @@ - (define_insn "*stm4_ia" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (match_operand:SI 5 "s_register_operand" "rk")) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 12))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" - "stm%(ia%)\t%5, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -115,13 +115,13 @@ - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int 16))) - (set (mem:SI (match_dup 5)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 12))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 5" - "stm%(ia%)\t%5!, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -132,13 +132,13 @@ - [(set (match_operand:SI 5 "s_register_operand" "+&l") - (plus:SI (match_dup 5) (const_int 16))) - (set (mem:SI (match_dup 5)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 12))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "low_register_operand" ""))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 5" - "stm%(ia%)\t%5!, {%1, %2, %3, %4}" - [(set_attr "type" "store4")]) -@@ -145,16 +145,16 @@ - - (define_insn "*ldm4_ib" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 16))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" -@@ -166,16 +166,16 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int 16))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 12)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int 16))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 5" -@@ -186,13 +186,13 @@ - (define_insn "*stm4_ib" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 12))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 16))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "stm%(ib%)\t%5, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -203,13 +203,13 @@ - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int 16))) - (set (mem:SI (plus:SI (match_dup 5) (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 12))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int 16))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 5" - "stm%(ib%)\t%5!, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -217,16 +217,16 @@ - - (define_insn "*ldm4_da" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") - (const_int -12)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -4)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 5)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "ldm%(da%)\t%5, {%1, %2, %3, %4}" -@@ -237,16 +237,16 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int -16))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -12)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -4)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 5)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 5" - "ldm%(da%)\t%5!, {%1, %2, %3, %4}" -@@ -256,13 +256,13 @@ - (define_insn "*stm4_da" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") (const_int -12))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -4))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 5)) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "stm%(da%)\t%5, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -273,13 +273,13 @@ - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int -16))) - (set (mem:SI (plus:SI (match_dup 5) (const_int -12))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -4))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 5)) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 5" - "stm%(da%)\t%5!, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -287,16 +287,16 @@ - - (define_insn "*ldm4_db" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") - (const_int -16)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -12)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" -@@ -308,16 +308,16 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int -16))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -16)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -12)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -8)))) -- (set (match_operand:SI 4 "arm_hard_register_operand" "") -+ (set (match_operand:SI 4 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 5) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 5" -@@ -328,13 +328,13 @@ - (define_insn "*stm4_db" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 5 "s_register_operand" "rk") (const_int -16))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -12))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -8))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -4))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" - "stm%(db%)\t%5, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -345,13 +345,13 @@ - [(set (match_operand:SI 5 "s_register_operand" "+&rk") - (plus:SI (match_dup 5) (const_int -16))) - (set (mem:SI (plus:SI (match_dup 5) (const_int -16))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -12))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -8))) -- (match_operand:SI 3 "arm_hard_register_operand" "")) -+ (match_operand:SI 3 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 5) (const_int -4))) -- (match_operand:SI 4 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 4 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 5" - "stm%(db%)\t%5!, {%1, %2, %3, %4}" - [(set_attr "type" "store4") -@@ -466,12 +466,12 @@ - - (define_insn "*ldm3_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_operand:SI 4 "s_register_operand" "rk"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" -@@ -481,12 +481,12 @@ - - (define_insn "*thumb_ldm3_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_operand:SI 4 "s_register_operand" "l"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 3" -@@ -497,12 +497,12 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int 12))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 4))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" -@@ -514,12 +514,12 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 4 "s_register_operand" "+&l") - (plus:SI (match_dup 4) (const_int 12))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_dup 4))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 4" -@@ -529,11 +529,11 @@ - (define_insn "*stm3_ia" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (match_operand:SI 4 "s_register_operand" "rk")) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" - "stm%(ia%)\t%4, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -544,11 +544,11 @@ - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int 12))) - (set (mem:SI (match_dup 4)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" - "stm%(ia%)\t%4!, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -559,11 +559,11 @@ - [(set (match_operand:SI 4 "s_register_operand" "+&l") - (plus:SI (match_dup 4) (const_int 12))) - (set (mem:SI (match_dup 4)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 8))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "low_register_operand" ""))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 4" - "stm%(ia%)\t%4!, {%1, %2, %3}" - [(set_attr "type" "store3")]) -@@ -570,13 +570,13 @@ - - (define_insn "*ldm3_ib" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 12))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" -@@ -588,13 +588,13 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int 12))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int 12))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" -@@ -605,11 +605,11 @@ - (define_insn "*stm3_ib" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 12))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "stm%(ib%)\t%4, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -620,11 +620,11 @@ - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int 12))) - (set (mem:SI (plus:SI (match_dup 4) (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int 12))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "stm%(ib%)\t%4!, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -632,13 +632,13 @@ - - (define_insn "*ldm3_da" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") - (const_int -8)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 4)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "ldm%(da%)\t%4, {%1, %2, %3}" -@@ -649,13 +649,13 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int -12))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -8)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -4)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 4)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "ldm%(da%)\t%4!, {%1, %2, %3}" -@@ -665,11 +665,11 @@ - (define_insn "*stm3_da" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") (const_int -8))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 4)) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "stm%(da%)\t%4, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -680,11 +680,11 @@ - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int -12))) - (set (mem:SI (plus:SI (match_dup 4) (const_int -8))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -4))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 4)) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 4" - "stm%(da%)\t%4!, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -692,13 +692,13 @@ - - (define_insn "*ldm3_db" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") - (const_int -12)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" -@@ -710,13 +710,13 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int -12))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -12)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -8)))) -- (set (match_operand:SI 3 "arm_hard_register_operand" "") -+ (set (match_operand:SI 3 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 4) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" -@@ -727,11 +727,11 @@ - (define_insn "*stm3_db" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 4 "s_register_operand" "rk") (const_int -12))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -4))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" - "stm%(db%)\t%4, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -742,11 +742,11 @@ - [(set (match_operand:SI 4 "s_register_operand" "+&rk") - (plus:SI (match_dup 4) (const_int -12))) - (set (mem:SI (plus:SI (match_dup 4) (const_int -12))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -8))) -- (match_operand:SI 2 "arm_hard_register_operand" "")) -+ (match_operand:SI 2 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 4) (const_int -4))) -- (match_operand:SI 3 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 3 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 4" - "stm%(db%)\t%4!, {%1, %2, %3}" - [(set_attr "type" "store3") -@@ -847,9 +847,9 @@ - - (define_insn "*ldm2_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_operand:SI 3 "s_register_operand" "rk"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 2" -@@ -859,9 +859,9 @@ - - (define_insn "*thumb_ldm2_ia" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_operand:SI 3 "s_register_operand" "l"))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 4))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 2" -@@ -872,9 +872,9 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int 8))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 3))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" -@@ -886,9 +886,9 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 3 "s_register_operand" "+&l") - (plus:SI (match_dup 3) (const_int 8))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "low_register_operand" "") - (mem:SI (match_dup 3))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "low_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 4))))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 3" -@@ -898,9 +898,9 @@ - (define_insn "*stm2_ia" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (match_operand:SI 3 "s_register_operand" "rk")) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 2" - "stm%(ia%)\t%3, {%1, %2}" - [(set_attr "type" "store2") -@@ -911,9 +911,9 @@ - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int 8))) - (set (mem:SI (match_dup 3)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" - "stm%(ia%)\t%3!, {%1, %2}" - [(set_attr "type" "store2") -@@ -924,9 +924,9 @@ - [(set (match_operand:SI 3 "s_register_operand" "+&l") - (plus:SI (match_dup 3) (const_int 8))) - (set (mem:SI (match_dup 3)) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "low_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int 4))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "low_register_operand" ""))])] - "TARGET_THUMB1 && XVECLEN (operands[0], 0) == 3" - "stm%(ia%)\t%3!, {%1, %2}" - [(set_attr "type" "store2")]) -@@ -933,10 +933,10 @@ - - (define_insn "*ldm2_ib" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 8))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 2" -@@ -948,10 +948,10 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int 8))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int 8))))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" -@@ -962,9 +962,9 @@ - (define_insn "*stm2_ib" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 2" - "stm%(ib%)\t%3, {%1, %2}" - [(set_attr "type" "store2") -@@ -975,9 +975,9 @@ - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int 8))) - (set (mem:SI (plus:SI (match_dup 3) (const_int 4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int 8))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "stm%(ib%)\t%3!, {%1, %2}" - [(set_attr "type" "store2") -@@ -985,10 +985,10 @@ - - (define_insn "*ldm2_da" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") - (const_int -4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 3)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 2" - "ldm%(da%)\t%3, {%1, %2}" -@@ -999,10 +999,10 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int -8))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int -4)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (match_dup 3)))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "ldm%(da%)\t%3!, {%1, %2}" -@@ -1012,9 +1012,9 @@ - (define_insn "*stm2_da" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") (const_int -4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 3)) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 2" - "stm%(da%)\t%3, {%1, %2}" - [(set_attr "type" "store2") -@@ -1025,9 +1025,9 @@ - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int -8))) - (set (mem:SI (plus:SI (match_dup 3) (const_int -4))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (match_dup 3)) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_ARM && XVECLEN (operands[0], 0) == 3" - "stm%(da%)\t%3!, {%1, %2}" - [(set_attr "type" "store2") -@@ -1035,10 +1035,10 @@ - - (define_insn "*ldm2_db" - [(match_parallel 0 "load_multiple_operation" -- [(set (match_operand:SI 1 "arm_hard_register_operand" "") -+ [(set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") - (const_int -8)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 2" -@@ -1050,10 +1050,10 @@ - [(match_parallel 0 "load_multiple_operation" - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int -8))) -- (set (match_operand:SI 1 "arm_hard_register_operand" "") -+ (set (match_operand:SI 1 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int -8)))) -- (set (match_operand:SI 2 "arm_hard_register_operand" "") -+ (set (match_operand:SI 2 "arm_hard_general_register_operand" "") - (mem:SI (plus:SI (match_dup 3) - (const_int -4))))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" -@@ -1064,9 +1064,9 @@ - (define_insn "*stm2_db" - [(match_parallel 0 "store_multiple_operation" - [(set (mem:SI (plus:SI (match_operand:SI 3 "s_register_operand" "rk") (const_int -8))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int -4))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 2" - "stm%(db%)\t%3, {%1, %2}" - [(set_attr "type" "store2") -@@ -1077,9 +1077,9 @@ - [(set (match_operand:SI 3 "s_register_operand" "+&rk") - (plus:SI (match_dup 3) (const_int -8))) - (set (mem:SI (plus:SI (match_dup 3) (const_int -8))) -- (match_operand:SI 1 "arm_hard_register_operand" "")) -+ (match_operand:SI 1 "arm_hard_general_register_operand" "")) - (set (mem:SI (plus:SI (match_dup 3) (const_int -4))) -- (match_operand:SI 2 "arm_hard_register_operand" ""))])] -+ (match_operand:SI 2 "arm_hard_general_register_operand" ""))])] - "TARGET_32BIT && XVECLEN (operands[0], 0) == 3" - "stm%(db%)\t%3!, {%1, %2}" - [(set_attr "type" "store2") -Index: gcc/config/arm/predicates.md -=================================================================== ---- a/src/gcc/config/arm/predicates.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/predicates.md (.../branches/gcc-4_8-branch) -@@ -31,11 +31,11 @@ - || REGNO_REG_CLASS (REGNO (op)) != NO_REGS)); - }) - --;; Any hard register. --(define_predicate "arm_hard_register_operand" -+;; Any general register. -+(define_predicate "arm_hard_general_register_operand" - (match_code "reg") - { -- return REGNO (op) < FIRST_PSEUDO_REGISTER; -+ return REGNO (op) <= LAST_ARM_REGNUM; - }) - - ;; A low register. -@@ -76,6 +76,12 @@ - && REGNO_REG_CLASS (REGNO (op)) == VFP_REGS))); - }) - -+(define_predicate "vfp_hard_register_operand" -+ (match_code "reg") -+{ -+ return (IS_VFP_REGNUM (REGNO (op))); -+}) -+ - (define_predicate "zero_operand" - (and (match_code "const_int,const_double,const_vector") - (match_test "op == CONST0_RTX (mode)"))) -Index: gcc/config/arm/arm-ldmstm.ml -=================================================================== ---- a/src/gcc/config/arm/arm-ldmstm.ml (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/arm-ldmstm.ml (.../branches/gcc-4_8-branch) -@@ -67,10 +67,13 @@ - Printf.sprintf ("(match_operand:SI %d \"s_register_operand\" \"%s%s\")") - (nregs + 1) (inout_constr op_type) (constr thumb) - -+let reg_predicate thumb = -+ if thumb then "low_register_operand" else "arm_hard_general_register_operand" -+ - let write_ldm_set thumb nregs offset opnr first = - let indent = " " in - Printf.printf "%s" (if first then " [" else indent); -- Printf.printf "(set (match_operand:SI %d \"arm_hard_register_operand\" \"\")\n" opnr; -+ Printf.printf "(set (match_operand:SI %d \"%s\" \"\")\n" opnr (reg_predicate thumb); - Printf.printf "%s (mem:SI " indent; - begin if offset != 0 then Printf.printf "(plus:SI " end; - Printf.printf "%s" (destreg nregs first IN thumb); -@@ -84,7 +87,7 @@ - begin if offset != 0 then Printf.printf "(plus:SI " end; - Printf.printf "%s" (destreg nregs first IN thumb); - begin if offset != 0 then Printf.printf " (const_int %d))" offset end; -- Printf.printf ")\n%s (match_operand:SI %d \"arm_hard_register_operand\" \"\"))" indent opnr -+ Printf.printf ")\n%s (match_operand:SI %d \"%s\" \"\"))" indent opnr (reg_predicate thumb) - - let write_ldm_peep_set extra_indent nregs opnr first = - let indent = " " ^ extra_indent in -Index: gcc/config/arm/iterators.md -=================================================================== ---- a/src/gcc/config/arm/iterators.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/arm/iterators.md (.../branches/gcc-4_8-branch) -@@ -493,6 +493,10 @@ - (UNSPEC_VRINTA "no") (UNSPEC_VRINTM "no") - (UNSPEC_VRINTR "yes") (UNSPEC_VRINTX "yes")]) - -+(define_int_attr vrint_conds [(UNSPEC_VRINTZ "nocond") (UNSPEC_VRINTP "unconditional") -+ (UNSPEC_VRINTA "unconditional") (UNSPEC_VRINTM "unconditional") -+ (UNSPEC_VRINTR "nocond") (UNSPEC_VRINTX "nocond")]) -+ - (define_int_attr nvrint_variant [(UNSPEC_NVRINTZ "z") (UNSPEC_NVRINTP "p") - (UNSPEC_NVRINTA "a") (UNSPEC_NVRINTM "m") - (UNSPEC_NVRINTX "x") (UNSPEC_NVRINTN "n")]) +@@ -24476,9 +24476,13 @@ + fputs (":\n", file); + if (flag_pic) + { +- /* Output ".word .LTHUNKn-7-.LTHUNKPCn". */ ++ /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn". */ + rtx tem = XEXP (DECL_RTL (function), 0); +- tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7)); ++ /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC ++ pipeline offset is four rather than eight. Adjust the offset ++ accordingly. */ ++ tem = plus_constant (GET_MODE (tem), tem, ++ TARGET_THUMB1_ONLY ? -3 : -7); + tem = gen_rtx_MINUS (GET_MODE (tem), + tem, + gen_rtx_SYMBOL_REF (Pmode, Index: gcc/config/arm/arm.md =================================================================== ---- a/src/gcc/config/arm/arm.md (.../tags/gcc_4_8_2_release) +--- a/src/gcc/config/arm/arm.md (.../tags/gcc_4_8_3_release) +++ b/src/gcc/config/arm/arm.md (.../branches/gcc-4_8-branch) -@@ -11036,7 +11036,7 @@ - [(set (match_operand:SI 1 "s_register_operand" "+rk") - (plus:SI (match_dup 1) - (match_operand:SI 2 "const_int_operand" "I"))) -- (set (match_operand:DF 3 "arm_hard_register_operand" "") -+ (set (match_operand:DF 3 "vfp_hard_register_operand" "") - (mem:DF (match_dup 1)))])] - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP" - "* -@@ -11270,7 +11270,9 @@ - (match_operand:SI 1 "" "") - (match_operand:SI 2 "" ""))] - "TARGET_32BIT && arm_arch5e" -- "pld\\t%a0") -+ "pld\\t%a0" -+ [(set_attr "type" "load1")] -+) - - ;; General predication pattern - -Index: gcc/config/pa/pa.c -=================================================================== ---- a/src/gcc/config/pa/pa.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/pa/pa.c (.../branches/gcc-4_8-branch) -@@ -912,9 +912,12 @@ - legitimize_tls_address (rtx addr) - { - rtx ret, insn, tmp, t1, t2, tp; -- enum tls_model model = SYMBOL_REF_TLS_MODEL (addr); - -- switch (model) -+ /* Currently, we can't handle anything but a SYMBOL_REF. */ -+ if (GET_CODE (addr) != SYMBOL_REF) -+ return addr; -+ -+ switch (SYMBOL_REF_TLS_MODEL (addr)) - { - case TLS_MODEL_GLOBAL_DYNAMIC: - tmp = gen_reg_rtx (Pmode); -@@ -1035,7 +1038,7 @@ - && !REG_POINTER (XEXP (x, 1))) - return gen_rtx_PLUS (Pmode, XEXP (x, 1), XEXP (x, 0)); - -- if (PA_SYMBOL_REF_TLS_P (x)) -+ if (pa_tls_referenced_p (x)) - return legitimize_tls_address (x); - else if (flag_pic) - return legitimize_pic_address (x, mode, gen_reg_rtx (Pmode)); -@@ -1916,9 +1919,10 @@ - not consider them legitimate constants. Loop optimizations can - call the emit_move_xxx with one as a source. */ - if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode)) -+ || (GET_CODE (operand1) == HIGH -+ && symbolic_operand (XEXP (operand1, 0), mode)) - || function_label_operand (operand1, VOIDmode) -- || (GET_CODE (operand1) == HIGH -- && symbolic_operand (XEXP (operand1, 0), mode))) -+ || pa_tls_referenced_p (operand1)) - { - int ishighonly = 0; - -@@ -2625,7 +2629,7 @@ - if (optype0 == REGOP) - latehalf[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); - else if (optype0 == OFFSOP) -- latehalf[0] = adjust_address (operands[0], SImode, 4); -+ latehalf[0] = adjust_address_nv (operands[0], SImode, 4); - else - latehalf[0] = operands[0]; - -@@ -2632,7 +2636,7 @@ - if (optype1 == REGOP) - latehalf[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); - else if (optype1 == OFFSOP) -- latehalf[1] = adjust_address (operands[1], SImode, 4); -+ latehalf[1] = adjust_address_nv (operands[1], SImode, 4); - else if (optype1 == CNSTOP) - split_double (operands[1], &operands[1], &latehalf[1]); - else -@@ -7539,7 +7543,7 @@ - if (!TARGET_LONG_CALLS && distance < MAX_PCREL17F_OFFSET) - return 8; - -- if (TARGET_LONG_ABS_CALL && !flag_pic) -+ if (!flag_pic) - return 12; - - return 24; -@@ -8104,7 +8108,8 @@ - return 12; - - if (TARGET_FAST_INDIRECT_CALLS -- || (!TARGET_PORTABLE_RUNTIME -+ || (!TARGET_LONG_CALLS -+ && !TARGET_PORTABLE_RUNTIME - && ((TARGET_PA_20 && !TARGET_SOM && distance < 7600000) - || distance < MAX_PCREL17F_OFFSET))) - return 8; -@@ -10397,7 +10402,7 @@ - /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not - legitimate constants. The other variants can't be handled by - the move patterns after reload starts. */ -- if (PA_SYMBOL_REF_TLS_P (x)) -+ if (pa_tls_referenced_p (x)) - return false; - - if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE) -@@ -10522,13 +10527,13 @@ - - /* When INT14_OK_STRICT is false, a secondary reload is needed - to adjust the displacement of SImode and DImode floating point -- instructions. So, we return false when STRICT is true. We -+ instructions but this may fail when the register also needs -+ reloading. So, we return false when STRICT is true. We - also reject long displacements for float mode addresses since - the majority of accesses will use floating point instructions - that don't support 14-bit offsets. */ - if (!INT14_OK_STRICT -- && reload_in_progress -- && strict -+ && (strict || !(reload_in_progress || reload_completed)) - && mode != QImode - && mode != HImode) - return false; -@@ -10588,8 +10593,7 @@ - return true; - - if (!INT14_OK_STRICT -- && reload_in_progress -- && strict -+ && (strict || !(reload_in_progress || reload_completed)) - && mode != QImode - && mode != HImode) - return false; -Index: gcc/config/pa/pa.h -=================================================================== ---- a/src/gcc/config/pa/pa.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/pa/pa.h (.../branches/gcc-4_8-branch) -@@ -784,9 +784,9 @@ - - #define MAX_REGS_PER_ADDRESS 2 - --/* Non-TLS symbolic references. */ --#define PA_SYMBOL_REF_TLS_P(RTX) \ -- (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0) -+/* TLS symbolic reference. */ -+#define PA_SYMBOL_REF_TLS_P(X) \ -+ (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (X) != 0) - - /* Recognize any constant value that is a valid address except - for symbolic addresses. We get better CSE by rejecting them -@@ -796,7 +796,8 @@ - #define CONSTANT_ADDRESS_P(X) \ - ((GET_CODE (X) == LABEL_REF \ - || (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (X)) \ -- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ -+ || GET_CODE (X) == CONST_INT \ -+ || (GET_CODE (X) == CONST && !pa_tls_referenced_p (X)) \ - || GET_CODE (X) == HIGH) \ - && (reload_in_progress || reload_completed \ - || ! pa_symbolic_expression_p (X))) -Index: gcc/config/mips/driver-native.c -=================================================================== ---- a/src/gcc/config/mips/driver-native.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/mips/driver-native.c (.../branches/gcc-4_8-branch) -@@ -58,11 +58,17 @@ - if (strncmp (buf, "cpu model", sizeof ("cpu model") - 1) == 0) - { - if (strstr (buf, "Godson2 V0.2") != NULL -- || strstr (buf, "Loongson-2 V0.2") != NULL) -+ || strstr (buf, "Loongson-2 V0.2") != NULL -+ || strstr (buf, "Loongson-2E") != NULL) - cpu = "loongson2e"; - else if (strstr (buf, "Godson2 V0.3") != NULL -- || strstr (buf, "Loongson-2 V0.3") != NULL) -+ || strstr (buf, "Loongson-2 V0.3") != NULL -+ || strstr (buf, "Loongson-2F") != NULL) - cpu = "loongson2f"; -+ else if (strstr (buf, "Godson3 V0.5") != NULL -+ || strstr (buf, "Loongson-3 V0.5") != NULL -+ || strstr (buf, "Loongson-3A") != NULL) -+ cpu = "loongson3a"; - else if (strstr (buf, "SiByte SB1") != NULL) - cpu = "sb1"; - else if (strstr (buf, "R5000") != NULL) -Index: gcc/config/mips/mips.md -=================================================================== ---- a/src/gcc/config/mips/mips.md (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/mips/mips.md (.../branches/gcc-4_8-branch) -@@ -73,6 +73,11 @@ - UNSPEC_STORE_LEFT - UNSPEC_STORE_RIGHT - -+ ;; Integer operations that are too cumbersome to describe directly. -+ UNSPEC_WSBH -+ UNSPEC_DSBH -+ UNSPEC_DSHD -+ - ;; Floating-point moves. - UNSPEC_LOAD_LOW - UNSPEC_LOAD_HIGH -@@ -1294,20 +1299,32 @@ - - ;; Combiner patterns for unsigned byte-add. - --(define_insn "*baddu_si" -+(define_insn "*baddu_si_eb" - [(set (match_operand:SI 0 "register_operand" "=d") - (zero_extend:SI -- (plus:QI (match_operand:QI 1 "register_operand" "d") -- (match_operand:QI 2 "register_operand" "d"))))] -- "ISA_HAS_BADDU" -+ (subreg:QI -+ (plus:SI (match_operand:SI 1 "register_operand" "d") -+ (match_operand:SI 2 "register_operand" "d")) 3)))] -+ "ISA_HAS_BADDU && BYTES_BIG_ENDIAN" - "baddu\\t%0,%1,%2" - [(set_attr "alu_type" "add")]) - -+(define_insn "*baddu_si_el" -+ [(set (match_operand:SI 0 "register_operand" "=d") -+ (zero_extend:SI -+ (subreg:QI -+ (plus:SI (match_operand:SI 1 "register_operand" "d") -+ (match_operand:SI 2 "register_operand" "d")) 0)))] -+ "ISA_HAS_BADDU && !BYTES_BIG_ENDIAN" -+ "baddu\\t%0,%1,%2" -+ [(set_attr "alu_type" "add")]) -+ - (define_insn "*baddu_di<mode>" - [(set (match_operand:GPR 0 "register_operand" "=d") - (zero_extend:GPR -- (plus:QI (truncate:QI (match_operand:DI 1 "register_operand" "d")) -- (truncate:QI (match_operand:DI 2 "register_operand" "d")))))] -+ (truncate:QI -+ (plus:DI (match_operand:DI 1 "register_operand" "d") -+ (match_operand:DI 2 "register_operand" "d")))))] - "ISA_HAS_BADDU && TARGET_64BIT" - "baddu\\t%0,%1,%2" - [(set_attr "alu_type" "add")]) -@@ -5367,6 +5384,56 @@ - } - [(set_attr "type" "shift") - (set_attr "mode" "<MODE>")]) -+ -+(define_insn "bswaphi2" -+ [(set (match_operand:HI 0 "register_operand" "=d") -+ (bswap:HI (match_operand:HI 1 "register_operand" "d")))] -+ "ISA_HAS_WSBH" -+ "wsbh\t%0,%1" -+ [(set_attr "type" "shift")]) -+ -+(define_insn_and_split "bswapsi2" -+ [(set (match_operand:SI 0 "register_operand" "=d") -+ (bswap:SI (match_operand:SI 1 "register_operand" "d")))] -+ "ISA_HAS_WSBH && ISA_HAS_ROR" -+ "#" -+ "" -+ [(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_WSBH)) -+ (set (match_dup 0) (rotatert:SI (match_dup 0) (const_int 16)))] -+ "" -+ [(set_attr "length" "8")]) -+ -+(define_insn_and_split "bswapdi2" -+ [(set (match_operand:DI 0 "register_operand" "=d") -+ (bswap:DI (match_operand:DI 1 "register_operand" "d")))] -+ "TARGET_64BIT && ISA_HAS_WSBH" -+ "#" -+ "" -+ [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_DSBH)) -+ (set (match_dup 0) (unspec:DI [(match_dup 0)] UNSPEC_DSHD))] -+ "" -+ [(set_attr "length" "8")]) -+ -+(define_insn "wsbh" -+ [(set (match_operand:SI 0 "register_operand" "=d") -+ (unspec:SI [(match_operand:SI 1 "register_operand" "d")] UNSPEC_WSBH))] -+ "ISA_HAS_WSBH" -+ "wsbh\t%0,%1" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "dsbh" -+ [(set (match_operand:DI 0 "register_operand" "=d") -+ (unspec:DI [(match_operand:DI 1 "register_operand" "d")] UNSPEC_DSBH))] -+ "TARGET_64BIT && ISA_HAS_WSBH" -+ "dsbh\t%0,%1" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "dshd" -+ [(set (match_operand:DI 0 "register_operand" "=d") -+ (unspec:DI [(match_operand:DI 1 "register_operand" "d")] UNSPEC_DSHD))] -+ "TARGET_64BIT && ISA_HAS_WSBH" -+ "dshd\t%0,%1" -+ [(set_attr "type" "shift")]) - - ;; - ;; .................... -Index: gcc/config/mips/mips.c -=================================================================== ---- a/src/gcc/config/mips/mips.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/mips/mips.c (.../branches/gcc-4_8-branch) -@@ -3560,17 +3560,6 @@ - } - } - --/* Return the cost of an operand X that can be trucated for free. -- SPEED says whether we're optimizing for size or speed. */ -- --static int --mips_truncated_op_cost (rtx x, bool speed) --{ -- if (GET_CODE (x) == TRUNCATE) -- x = XEXP (x, 0); -- return set_src_cost (x, speed); --} -- - /* Implement TARGET_RTX_COSTS. */ - - static bool -@@ -3951,13 +3940,12 @@ - case ZERO_EXTEND: - if (outer_code == SET - && ISA_HAS_BADDU -+ && (GET_CODE (XEXP (x, 0)) == TRUNCATE -+ || GET_CODE (XEXP (x, 0)) == SUBREG) - && GET_MODE (XEXP (x, 0)) == QImode -- && GET_CODE (XEXP (x, 0)) == PLUS) -+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS) - { -- rtx plus = XEXP (x, 0); -- *total = (COSTS_N_INSNS (1) -- + mips_truncated_op_cost (XEXP (plus, 0), speed) -- + mips_truncated_op_cost (XEXP (plus, 1), speed)); -+ *total = set_src_cost (XEXP (XEXP (x, 0), 0), speed); - return true; - } - *total = mips_zero_extend_cost (mode, XEXP (x, 0)); -@@ -8057,7 +8045,7 @@ - case 't': - { - int truth = (code == NE) == (letter == 'T'); -- fputc ("zfnt"[truth * 2 + (GET_MODE (op) == CCmode)], file); -+ fputc ("zfnt"[truth * 2 + ST_REG_P (REGNO (XEXP (op, 0)))], file); - } - break; - -Index: gcc/config/mips/mips.h -=================================================================== ---- a/src/gcc/config/mips/mips.h (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/config/mips/mips.h (.../branches/gcc-4_8-branch) -@@ -949,6 +949,11 @@ - || TARGET_SMARTMIPS) \ - && !TARGET_MIPS16) - -+/* ISA has the WSBH (word swap bytes within halfwords) instruction. -+ 64-bit targets also provide DSBH and DSHD. */ -+#define ISA_HAS_WSBH ((ISA_MIPS32R2 || ISA_MIPS64R2) \ -+ && !TARGET_MIPS16) -+ - /* ISA has data prefetch instructions. This controls use of 'pref'. */ - #define ISA_HAS_PREFETCH ((ISA_MIPS4 \ - || TARGET_LOONGSON_2EF \ -Index: gcc/params.def -=================================================================== ---- a/src/gcc/params.def (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/params.def (.../branches/gcc-4_8-branch) -@@ -1014,6 +1014,12 @@ - "strength reduction", - 50, 1, 999999) - -+DEFPARAM (PARAM_UNINIT_CONTROL_DEP_ATTEMPTS, -+ "uninit-control-dep-attempts", -+ "Maximum number of nested calls to search for control dependencies " -+ "during uninitialized variable analysis", -+ 1000, 1, 0) -+ - /* - Local variables: - mode:c -Index: gcc/tree-ssanames.c -=================================================================== ---- a/src/gcc/tree-ssanames.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/tree-ssanames.c (.../branches/gcc-4_8-branch) -@@ -128,7 +128,7 @@ - - /* The node was cleared out when we put it on the free list, so - there is no need to do so again here. */ -- gcc_assert (ssa_name (SSA_NAME_VERSION (t)) == NULL); -+ gcc_assert ((*SSANAMES (fn))[SSA_NAME_VERSION (t)] == NULL); - (*SSANAMES (fn))[SSA_NAME_VERSION (t)] = t; - } - else -Index: gcc/regcprop.c -=================================================================== ---- a/src/gcc/regcprop.c (.../tags/gcc_4_8_2_release) -+++ b/src/gcc/regcprop.c (.../branches/gcc-4_8-branch) -@@ -747,6 +747,7 @@ - int n_ops, i, alt, predicated; - bool is_asm, any_replacements; - rtx set; -+ rtx link; - bool replaced[MAX_RECOG_OPERANDS]; - bool changed = false; - struct kill_set_value_data ksvd; -@@ -815,6 +816,23 @@ - if (recog_op_alt[i][alt].earlyclobber) - kill_value (recog_data.operand[i], vd); - -+ /* If we have dead sets in the insn, then we need to note these as we -+ would clobbers. */ -+ for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) -+ { -+ if (REG_NOTE_KIND (link) == REG_UNUSED) -+ { -+ kill_value (XEXP (link, 0), vd); -+ /* Furthermore, if the insn looked like a single-set, -+ but the dead store kills the source value of that -+ set, then we can no-longer use the plain move -+ special case below. */ -+ if (set -+ && reg_overlap_mentioned_p (XEXP (link, 0), SET_SRC (set))) -+ set = NULL; -+ } -+ } -+ - /* Special-case plain move instructions, since we may well - be able to do the move from a different register class. */ - if (set && REG_P (SET_SRC (set))) -Index: libgo/configure -=================================================================== ---- a/src/libgo/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/configure (.../branches/gcc-4_8-branch) -@@ -6501,7 +6501,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6519,7 +6519,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6538,7 +6541,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -11105,7 +11111,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11108 "configure" -+#line 11114 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11211,7 +11217,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11214 "configure" -+#line 11220 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -14700,7 +14706,7 @@ - fi - - --for ac_func in accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat -+for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat - do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` - ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -Index: libgo/Makefile.in -=================================================================== ---- a/src/libgo/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/Makefile.in (.../branches/gcc-4_8-branch) -@@ -195,7 +195,7 @@ - @LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo - am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ - go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ -- go-callers.lo go-can-convert-interface.lo go-cgo.lo \ -+ go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ - go-check-interface.lo go-construct-map.lo \ - go-convert-interface.lo go-copy.lo go-defer.lo \ - go-deferred-recover.lo go-eface-compare.lo \ -@@ -757,6 +757,7 @@ - runtime/go-caller.c \ - runtime/go-callers.c \ - runtime/go-can-convert-interface.c \ -+ runtime/go-cdiv.c \ - runtime/go-cgo.c \ - runtime/go-check-interface.c \ - runtime/go-construct-map.c \ -@@ -1446,7 +1447,7 @@ - go/go/build/build.go \ - go/go/build/doc.go \ - go/go/build/read.go \ -- syslist.go -+ go/go/build/syslist.go - - go_go_doc_files = \ - go/go/doc/comment.go \ -@@ -2368,6 +2369,7 @@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@ -@@ -2554,6 +2556,13 @@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-can-convert-interface.lo `test -f 'runtime/go-can-convert-interface.c' || echo '$(srcdir)/'`runtime/go-can-convert-interface.c - -+go-cdiv.lo: runtime/go-cdiv.c -+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cdiv.lo -MD -MP -MF $(DEPDIR)/go-cdiv.Tpo -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c -+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.lo' libtool=yes @AMDEPBACKSLASH@ -+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c -+ - go-cgo.lo: runtime/go-cgo.c - @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cgo.lo -MD -MP -MF $(DEPDIR)/go-cgo.Tpo -c -o go-cgo.lo `test -f 'runtime/go-cgo.c' || echo '$(srcdir)/'`runtime/go-cgo.c - @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo -@@ -5062,15 +5071,6 @@ - @$(CHECK) - .PHONY: go/build/check - --syslist.go: s-syslist; @true --s-syslist: Makefile -- echo '// Generated automatically by make.' >syslist.go.tmp -- echo 'package build' >>syslist.go.tmp -- echo 'const goosList = "$(GOOS)"' >>syslist.go.tmp -- echo 'const goarchList = "$(GOARCH)"' >>syslist.go.tmp -- $(SHELL) $(srcdir)/../move-if-change syslist.go.tmp syslist.go -- $(STAMP) $@ -- - @go_include@ go/doc.lo.dep - go/doc.lo.dep: $(go_go_doc_files) - $(BUILDDEPS) -Index: libgo/runtime/go-defer.c -=================================================================== ---- a/src/libgo/runtime/go-defer.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-defer.c (.../branches/gcc-4_8-branch) -@@ -27,6 +27,7 @@ - n->__pfn = pfn; - n->__arg = arg; - n->__retaddr = NULL; -+ n->__makefunc_can_recover = 0; - g->defer = n; - } - -Index: libgo/runtime/go-defer.h -=================================================================== ---- a/src/libgo/runtime/go-defer.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-defer.h (.../branches/gcc-4_8-branch) -@@ -34,4 +34,10 @@ - set by __go_set_defer_retaddr which is called by the thunks - created by defer statements. */ - const void *__retaddr; -+ -+ /* Set to true if a function created by reflect.MakeFunc is -+ permitted to recover. The return address of such a function -+ function will be somewhere in libffi, so __retaddr is not -+ useful. */ -+ _Bool __makefunc_can_recover; - }; -Index: libgo/runtime/go-int-array-to-string.c -=================================================================== ---- a/src/libgo/runtime/go-int-array-to-string.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-int-array-to-string.c (.../branches/gcc-4_8-branch) -@@ -30,6 +30,8 @@ - - if (v < 0 || v > 0x10ffff) - v = 0xfffd; -+ else if (0xd800 <= v && v <= 0xdfff) -+ v = 0xfffd; - - if (v <= 0x7f) - slen += 1; -@@ -56,6 +58,8 @@ - character. */ - if (v < 0 || v > 0x10ffff) - v = 0xfffd; -+ else if (0xd800 <= v && v <= 0xdfff) -+ v = 0xfffd; - - if (v <= 0x7f) - *s++ = v; -Index: libgo/runtime/go-nosys.c -=================================================================== ---- a/src/libgo/runtime/go-nosys.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-nosys.c (.../branches/gcc-4_8-branch) -@@ -43,6 +43,17 @@ - } - #endif - -+#ifndef HAVE_DUP3 -+int -+dup3 (int oldfd __attribute__ ((unused)), -+ int newfd __attribute__ ((unused)), -+ int flags __attribute__ ((unused))) -+{ -+ errno = ENOSYS; -+ return -1; -+} -+#endif -+ - #ifndef HAVE_EPOLL_CREATE1 - int - epoll_create1 (int flags __attribute__ ((unused))) -@@ -112,6 +123,18 @@ - } - #endif - -+#ifndef HAVE_GETXATTR -+ssize_t -+getxattr (const char *path __attribute__ ((unused)), -+ const char *name __attribute__ ((unused)), -+ void *value __attribute__ ((unused)), -+ size_t size __attribute__ ((unused))) -+{ -+ errno = ENOSYS; -+ return -1; -+} -+#endif -+ - #ifndef HAVE_INOTIFY_ADD_WATCH - int - inotify_add_watch (int fd __attribute__ ((unused)), -@@ -151,6 +174,17 @@ - } - #endif - -+#ifndef HAVE_LISTXATTR -+ssize_t -+listxattr (const char *path __attribute__ ((unused)), -+ char *list __attribute__ ((unused)), -+ size_t size __attribute__ ((unused))) -+{ -+ errno = ENOSYS; -+ return -1; -+} -+#endif -+ - #ifndef HAVE_MKDIRAT - int - mkdirat (int dirfd __attribute__ ((unused)), -@@ -196,6 +230,16 @@ - } - #endif - -+#ifndef HAVE_REMOVEXATTR -+int -+removexattr (const char *path __attribute__ ((unused)), -+ const char *name __attribute__ ((unused))) -+{ -+ errno = ENOSYS; -+ return -1; -+} -+#endif -+ - #ifndef HAVE_RENAMEAT - int - renameat (int olddirfd __attribute__ ((unused)), -@@ -208,6 +252,19 @@ - } - #endif - -+#ifndef HAVE_SETXATTR -+int -+setxattr (const char *path __attribute__ ((unused)), -+ const char *name __attribute__ ((unused)), -+ const void *value __attribute__ ((unused)), -+ size_t size __attribute__ ((unused)), -+ int flags __attribute__ ((unused))) -+{ -+ errno = ENOSYS; -+ return -1; -+} -+#endif -+ - #ifndef HAVE_SPLICE - int - splice (int fd __attribute__ ((unused)), -Index: libgo/runtime/runtime.h -=================================================================== ---- a/src/libgo/runtime/runtime.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/runtime.h (.../branches/gcc-4_8-branch) -@@ -440,7 +440,7 @@ - }; - void runtime_hashinit(void); - --void runtime_traceback(); -+void runtime_traceback(void); - void runtime_tracebackothers(G*); - - /* -@@ -756,6 +756,7 @@ - extern _Bool __go_file_line(uintptr, String*, String*, intgo *); - extern byte* runtime_progname(); - extern void runtime_main(void*); -+extern uint32 runtime_in_callers; - - int32 getproccount(void); - -Index: libgo/runtime/proc.c -=================================================================== ---- a/src/libgo/runtime/proc.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/proc.c (.../branches/gcc-4_8-branch) -@@ -1716,10 +1716,30 @@ - // entersyscall is going to return immediately after. - - void runtime_entersyscall(void) __attribute__ ((no_split_stack)); -+static void doentersyscall(void) __attribute__ ((no_split_stack, noinline)); - - void - runtime_entersyscall() - { -+ // Save the registers in the g structure so that any pointers -+ // held in registers will be seen by the garbage collector. -+ getcontext(&g->gcregs); -+ -+ // Do the work in a separate function, so that this function -+ // doesn't save any registers on its own stack. If this -+ // function does save any registers, we might store the wrong -+ // value in the call to getcontext. -+ // -+ // FIXME: This assumes that we do not need to save any -+ // callee-saved registers to access the TLS variable g. We -+ // don't want to put the ucontext_t on the stack because it is -+ // large and we can not split the stack here. -+ doentersyscall(); -+} -+ -+static void -+doentersyscall() -+{ - if(m->profilehz > 0) - runtime_setprof(false); - -@@ -1736,10 +1756,6 @@ - } - #endif - -- // Save the registers in the g structure so that any pointers -- // held in registers will be seen by the garbage collector. -- getcontext(&g->gcregs); -- - g->status = Gsyscall; - - if(runtime_atomicload(&runtime_sched.sysmonwait)) { // TODO: fast atomic -@@ -2239,6 +2255,14 @@ - if(prof.fn == nil || prof.hz == 0) - return; - -+ if(runtime_atomicload(&runtime_in_callers) > 0) { -+ // If SIGPROF arrived while already fetching runtime -+ // callers we can have trouble on older systems -+ // because the unwind library calls dl_iterate_phdr -+ // which was not recursive in the past. -+ return; -+ } -+ - runtime_lock(&prof); - if(prof.fn == nil) { - runtime_unlock(&prof); -Index: libgo/runtime/mgc0.c -=================================================================== ---- a/src/libgo/runtime/mgc0.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/mgc0.c (.../branches/gcc-4_8-branch) -@@ -174,7 +174,7 @@ - Obj *roots; - uint32 nroot; - uint32 rootcap; --} work; -+} work __attribute__((aligned(8))); - - enum { - GC_DEFAULT_PTR = GC_NUM_INSTR, -@@ -239,8 +239,7 @@ - // (Manually inlined copy of MHeap_LookupMaybe.) - k = (uintptr)obj>>PageShift; - x = k; -- if(sizeof(void*) == 8) -- x -= (uintptr)runtime_mheap->arena_start>>PageShift; -+ x -= (uintptr)runtime_mheap->arena_start>>PageShift; - s = runtime_mheap->map[x]; - if(s == nil || k < s->start || k - s->start >= s->npages || s->state != MSpanInUse) - return false; -@@ -418,8 +417,7 @@ - // (Manually inlined copy of MHeap_LookupMaybe.) - k = (uintptr)obj>>PageShift; - x = k; -- if(sizeof(void*) == 8) -- x -= (uintptr)arena_start>>PageShift; -+ x -= (uintptr)arena_start>>PageShift; - s = runtime_mheap->map[x]; - if(s == nil || k < s->start || k - s->start >= s->npages || s->state != MSpanInUse) - continue; -@@ -466,8 +464,7 @@ - // Ask span about size class. - // (Manually inlined copy of MHeap_Lookup.) - x = (uintptr)obj >> PageShift; -- if(sizeof(void*) == 8) -- x -= (uintptr)arena_start>>PageShift; -+ x -= (uintptr)arena_start>>PageShift; - s = runtime_mheap->map[x]; - - PREFETCH(obj); -@@ -585,8 +582,7 @@ - if(t == nil) - return; - x = (uintptr)obj >> PageShift; -- if(sizeof(void*) == 8) -- x -= (uintptr)(runtime_mheap->arena_start)>>PageShift; -+ x -= (uintptr)(runtime_mheap->arena_start)>>PageShift; - s = runtime_mheap->map[x]; - objstart = (byte*)((uintptr)s->start<<PageShift); - if(s->sizeclass != 0) { -Index: libgo/runtime/go-signal.c -=================================================================== ---- a/src/libgo/runtime/go-signal.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-signal.c (.../branches/gcc-4_8-branch) -@@ -234,7 +234,7 @@ - G *g; - - g = runtime_g (); -- runtime_traceback (g); -+ runtime_traceback (); - runtime_tracebackothers (g); - - /* The gc library calls runtime_dumpregs here, and provides -@@ -399,6 +399,9 @@ - { - G *gp; - M *mp; -+#ifdef USING_SPLIT_STACK -+ void *stack_context[10]; -+#endif - - /* We are now running on the stack registered via sigaltstack. - (Actually there is a small span of time between runtime_siginit -@@ -409,7 +412,7 @@ - if (gp != NULL) - { - #ifdef USING_SPLIT_STACK -- __splitstack_getcontext (&gp->stack_context[0]); -+ __splitstack_getcontext (&stack_context[0]); - #endif - } - -@@ -432,7 +435,7 @@ - if (gp != NULL) - { - #ifdef USING_SPLIT_STACK -- __splitstack_setcontext (&gp->stack_context[0]); -+ __splitstack_setcontext (&stack_context[0]); - #endif - } - } -Index: libgo/runtime/go-callers.c -=================================================================== ---- a/src/libgo/runtime/go-callers.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-callers.c (.../branches/gcc-4_8-branch) -@@ -11,6 +11,13 @@ - #include "runtime.h" - #include "array.h" - -+/* This is set to non-zero when calling backtrace_full. This is used -+ to avoid getting hanging on a recursive lock in dl_iterate_phdr on -+ older versions of glibc when a SIGPROF signal arrives while -+ collecting a backtrace. */ -+ -+uint32 runtime_in_callers; -+ - /* Argument passed to callback function. */ - - struct callers_data -@@ -111,8 +118,10 @@ - data.skip = skip + 1; - data.index = 0; - data.max = m; -+ runtime_xadd (&runtime_in_callers, 1); - backtrace_full (__go_get_backtrace_state (), 0, callback, error_callback, - &data); -+ runtime_xadd (&runtime_in_callers, -1); - return data.index; - } - -Index: libgo/runtime/go-cdiv.c -=================================================================== ---- a/src/libgo/runtime/go-cdiv.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-cdiv.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,46 @@ -+/* go-cdiv.c -- complex division routines -+ -+ Copyright 2013 The Go Authors. All rights reserved. -+ Use of this source code is governed by a BSD-style -+ license that can be found in the LICENSE file. */ -+ -+/* Calls to these functions are generated by the Go frontend for -+ division of complex64 or complex128. We use these because Go's -+ complex division expects slightly different results from the GCC -+ default. When dividing NaN+1.0i / 0+0i, Go expects NaN+NaNi but -+ GCC generates NaN+Infi. NaN+Infi seems wrong seems the rules of -+ C99 Annex G specify that if either side of a complex number is Inf, -+ the the whole number is Inf, but an operation involving NaN ought -+ to result in NaN, not Inf. */ -+ -+__complex float -+__go_complex64_div (__complex float a, __complex float b) -+{ -+ if (__builtin_expect (b == 0+0i, 0)) -+ { -+ if (!__builtin_isinff (__real__ a) -+ && !__builtin_isinff (__imag__ a) -+ && (__builtin_isnanf (__real__ a) || __builtin_isnanf (__imag__ a))) -+ { -+ /* Pass "1" to nanf to match math/bits.go. */ -+ return __builtin_nanf("1") + __builtin_nanf("1")*1i; -+ } -+ } -+ return a / b; -+} -+ -+__complex double -+__go_complex128_div (__complex double a, __complex double b) -+{ -+ if (__builtin_expect (b == 0+0i, 0)) -+ { -+ if (!__builtin_isinf (__real__ a) -+ && !__builtin_isinf (__imag__ a) -+ && (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a))) -+ { -+ /* Pass "1" to nan to match math/bits.go. */ -+ return __builtin_nan("1") + __builtin_nan("1")*1i; -+ } -+ } -+ return a / b; -+} -Index: libgo/runtime/go-reflect-call.c -=================================================================== ---- a/src/libgo/runtime/go-reflect-call.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-reflect-call.c (.../branches/gcc-4_8-branch) -@@ -98,9 +98,12 @@ - const struct __go_struct_field *fields; - int i; +@@ -7630,12 +7630,13 @@ + + (define_insn "*arm_cmpdi_unsigned" + [(set (reg:CC_CZ CC_REGNUM) +- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r") +- (match_operand:DI 1 "arm_di_operand" "rDi")))] ++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r,r") ++ (match_operand:DI 1 "arm_di_operand" "rDi,rDi")))] + "TARGET_32BIT" + "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1" + [(set_attr "conds" "set") +- (set_attr "length" "8")] ++ (set_attr "arch" "a,t2") ++ (set_attr "length" "8,10")] + ) -+ field_count = descriptor->__fields.__count; -+ if (field_count == 0) { -+ return &ffi_type_void; -+ } - ret = (ffi_type *) __go_alloc (sizeof (ffi_type)); - ret->type = FFI_TYPE_STRUCT; -- field_count = descriptor->__fields.__count; - fields = (const struct __go_struct_field *) descriptor->__fields.__values; - ret->elements = (ffi_type **) __go_alloc ((field_count + 1) - * sizeof (ffi_type *)); -Index: libgo/runtime/go-recover.c + (define_insn "*arm_cmpdi_zero" +Index: libgfortran/intrinsics/ctime.c =================================================================== ---- a/src/libgo/runtime/go-recover.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-recover.c (.../branches/gcc-4_8-branch) -@@ -16,12 +16,14 @@ - __go_can_recover--this is, the thunk. */ - - _Bool --__go_can_recover (const void* retaddr) -+__go_can_recover (const void *retaddr) - { - G *g; - struct __go_defer_stack *d; - const char* ret; - const char* dret; -+ Location loc; -+ const byte *name; +--- a/src/libgfortran/intrinsics/ctime.c (.../tags/gcc_4_8_3_release) ++++ b/src/libgfortran/intrinsics/ctime.c (.../branches/gcc-4_8-branch) +@@ -31,31 +31,53 @@ + #include <string.h> - g = runtime_g (); -@@ -52,9 +54,80 @@ - #endif +-/* strftime-like function that fills a C string with %c format which +- is identical to ctime in the default locale. As ctime and ctime_r +- are poorly specified and their usage not recommended, the +- implementation instead uses strftime. */ ++/* Maximum space a ctime-like string might need. A "normal" ctime ++ string is 26 bytes, and in our case 24 bytes as we don't include ++ the trailing newline and null. However, the longest possible year ++ number is -2,147,481,748 (1900 - 2,147,483,648, since tm_year is a ++ 32-bit signed integer) so an extra 7 bytes are needed. */ ++#define CTIME_BUFSZ 31 - dret = (const char *) d->__retaddr; -- return ret <= dret && ret + 16 >= dret; -+ if (ret <= dret && ret + 16 >= dret) -+ return 1; +-static size_t +-strctime (char *s, size_t max, const time_t *timep) + -+ /* If the function calling recover was created by reflect.MakeFunc, -+ then RETADDR will be somewhere in libffi. Our caller is -+ permitted to recover if it was called from libffi. */ -+ if (!d->__makefunc_can_recover) -+ return 0; ++/* Thread-safe ctime-like function that fills a Fortran ++ string. ctime_r is a portability headache and marked as obsolescent ++ in POSIX 2008, which recommends strftime in its place. However, ++ strftime(..., "%c",...) doesn't produce ctime-like output on ++ MinGW, so do it manually with snprintf. */ + -+ if (runtime_callers (2, &loc, 1) < 1) -+ return 0; -+ -+ /* If we have no function name, then we weren't called by Go code. -+ Guess that we were called by libffi. */ -+ if (loc.function.len == 0) -+ return 1; -+ -+ if (loc.function.len < 4) -+ return 0; -+ name = loc.function.str; -+ if (*name == '_') ++static int ++gf_ctime (char *s, size_t max, const time_t timev) + { + struct tm ltm; + int failed; ++ char buf[CTIME_BUFSZ + 1]; + /* Some targets provide a localtime_r based on a draft of the POSIX + standard where the return type is int rather than the + standardized struct tm*. */ +- __builtin_choose_expr (__builtin_classify_type (localtime_r (timep, <m)) ++ __builtin_choose_expr (__builtin_classify_type (localtime_r (&timev, <m)) + == 5, +- failed = localtime_r (timep, <m) == NULL, +- failed = localtime_r (timep, <m) != 0); ++ failed = localtime_r (&timev, <m) == NULL, ++ failed = localtime_r (&timev, <m) != 0); + if (failed) +- return 0; +- return strftime (s, max, "%c", <m); ++ goto blank; ++ int n = snprintf (buf, sizeof (buf), ++ "%3.3s %3.3s%3d %.2d:%.2d:%.2d %d", ++ "SunMonTueWedThuFriSat" + ltm.tm_wday * 3, ++ "JanFebMarAprMayJunJulAugSepOctNovDec" + ltm.tm_mon * 3, ++ ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, ++ 1900 + ltm.tm_year); ++ if (n < 0) ++ goto blank; ++ if ((size_t) n <= max) + { -+ if (loc.function.len < 5) -+ return 0; -+ ++name; ++ cf_strcpy (s, max, buf); ++ return n; + } -+ -+ if (name[0] == 'f' && name[1] == 'f' && name[2] == 'i' && name[3] == '_') -+ return 1; -+ -+ /* We may also be called by reflect.makeFuncImpl.call, for a -+ function created by reflect.MakeFunc. */ -+ if (__builtin_strstr ((const char *) name, "makeFuncImpl") != NULL) -+ return 1; -+ ++ blank: ++ memset (s, ' ', max); + return 0; } -+/* This function is called when code is about to enter a function -+ created by reflect.MakeFunc. It is called by the function stub -+ used by MakeFunc. If the stub is permitted to call recover, then a -+ real MakeFunc function is permitted to call recover. */ -+ -+void -+__go_makefunc_can_recover (const void *retaddr) -+{ -+ struct __go_defer_stack *d; -+ -+ d = runtime_g ()->defer; -+ if (d != NULL -+ && !d->__makefunc_can_recover -+ && __go_can_recover (retaddr)) -+ d->__makefunc_can_recover = 1; -+} -+ -+/* This function is called when code is about to exit a function -+ created by reflect.MakeFunc. It is called by the function stub -+ used by MakeFunc. It clears the __makefunc_can_recover field. -+ It's OK to always clear this field, because __go_can_recover will -+ only be called by a stub created for a function that calls recover. -+ That stub will not call a function created by reflect.MakeFunc, so -+ by the time we get here any caller higher up on the call stack no -+ longer needs the information. */ -+ -+void -+__go_makefunc_returning (void) -+{ -+ struct __go_defer_stack *d; -+ -+ d = runtime_g ()->defer; -+ if (d != NULL) -+ d->__makefunc_can_recover = 0; -+} -+ - /* This is only called when it is valid for the caller to recover the - value on top of the panic stack, if there is one. */ - -Index: libgo/runtime/malloc.goc -=================================================================== ---- a/src/libgo/runtime/malloc.goc (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/malloc.goc (.../branches/gcc-4_8-branch) -@@ -541,8 +541,7 @@ - - // (Manually inlined copy of runtime_MHeap_Lookup) - p = (uintptr)v>>PageShift; -- if(sizeof(void*) == 8) -- p -= (uintptr)runtime_mheap->arena_start >> PageShift; -+ p -= (uintptr)runtime_mheap->arena_start >> PageShift; - s = runtime_mheap->map[p]; - - if(s->sizeclass == 0) { -Index: libgo/runtime/go-make-slice.c -=================================================================== ---- a/src/libgo/runtime/go-make-slice.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/go-make-slice.c (.../branches/gcc-4_8-branch) -@@ -34,7 +34,10 @@ - std = (const struct __go_slice_type *) td; +-/* In the default locale, the date and time representation fits in 26 +- bytes. However, other locales might need more space. */ +-#define CSZ 100 - ilen = (intgo) len; -- if (ilen < 0 || (uintptr_t) ilen != len) -+ if (ilen < 0 -+ || (uintptr_t) ilen != len -+ || (std->__element_type->__size > 0 -+ && len > MaxMem / std->__element_type->__size)) - runtime_panicstring ("makeslice: len out of range"); - - icap = (intgo) cap; -Index: libgo/runtime/mheap.c -=================================================================== ---- a/src/libgo/runtime/mheap.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/runtime/mheap.c (.../branches/gcc-4_8-branch) -@@ -150,8 +150,7 @@ - runtime_MSpan_Init(t, s->start + npage, s->npages - npage); - s->npages = npage; - p = t->start; -- if(sizeof(void*) == 8) -- p -= ((uintptr)h->arena_start>>PageShift); -+ p -= ((uintptr)h->arena_start>>PageShift); - if(p > 0) - h->map[p-1] = s; - h->map[p] = t; -@@ -169,8 +168,7 @@ - s->elemsize = (sizeclass==0 ? s->npages<<PageShift : (uintptr)runtime_class_to_size[sizeclass]); - s->types.compression = MTypes_Empty; - p = s->start; -- if(sizeof(void*) == 8) -- p -= ((uintptr)h->arena_start>>PageShift); -+ p -= ((uintptr)h->arena_start>>PageShift); - for(n=0; n<npage; n++) - h->map[p+n] = s; - return s; -@@ -241,8 +239,7 @@ - mstats.mspan_sys = h->spanalloc.sys; - runtime_MSpan_Init(s, (uintptr)v>>PageShift, ask>>PageShift); - p = s->start; -- if(sizeof(void*) == 8) -- p -= ((uintptr)h->arena_start>>PageShift); -+ p -= ((uintptr)h->arena_start>>PageShift); - h->map[p] = s; - h->map[p + s->npages - 1] = s; - s->state = MSpanInUse; -@@ -259,8 +256,7 @@ - uintptr p; - - p = (uintptr)v; -- if(sizeof(void*) == 8) -- p -= (uintptr)h->arena_start; -+ p -= (uintptr)h->arena_start; - return h->map[p >> PageShift]; - } - -@@ -281,8 +277,7 @@ - return nil; - p = (uintptr)v>>PageShift; - q = p; -- if(sizeof(void*) == 8) -- q -= (uintptr)h->arena_start >> PageShift; -+ q -= (uintptr)h->arena_start >> PageShift; - s = h->map[q]; - if(s == nil || p < s->start || p - s->start >= s->npages) - return nil; -@@ -332,8 +327,7 @@ - - // Coalesce with earlier, later spans. - p = s->start; -- if(sizeof(void*) == 8) -- p -= (uintptr)h->arena_start >> PageShift; -+ p -= (uintptr)h->arena_start >> PageShift; - if(p > 0 && (t = h->map[p-1]) != nil && t->state != MSpanInUse) { - tp = (uintptr*)(t->start<<PageShift); - *tp |= *sp; // propagate "needs zeroing" mark -Index: libgo/testsuite/gotest -=================================================================== ---- a/src/libgo/testsuite/gotest (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/testsuite/gotest (.../branches/gcc-4_8-branch) -@@ -369,7 +369,7 @@ + extern void fdate (char **, gfc_charlen_type *); + export_proto(fdate); +@@ -64,8 +86,8 @@ + fdate (char ** date, gfc_charlen_type * date_len) { - text="T" - case "$GOARCH" in -- ppc64) text="D" ;; -+ ppc64) text="[TD]" ;; - esac - - symtogo='sed -e s/_test/XXXtest/ -e s/.*_\([^_]*\.\)/\1/ -e s/XXXtest/_test/' -Index: libgo/mksysinfo.sh -=================================================================== ---- a/src/libgo/mksysinfo.sh (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/mksysinfo.sh (.../branches/gcc-4_8-branch) -@@ -1035,6 +1035,10 @@ - grep '^const _LOCK_' gen-sysinfo.go | - sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} - -+# The PRIO constants. -+grep '^const _PRIO_' gen-sysinfo.go | \ -+ sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} -+ - # The GNU/Linux LINUX_REBOOT flags. - grep '^const _LINUX_REBOOT_' gen-sysinfo.go | - sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} -Index: libgo/config.h.in -=================================================================== ---- a/src/libgo/config.h.in (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/config.h.in (.../branches/gcc-4_8-branch) -@@ -39,6 +39,9 @@ - /* Define to 1 if you have the `dl_iterate_phdr' function. */ - #undef HAVE_DL_ITERATE_PHDR - -+/* Define to 1 if you have the `dup3' function. */ -+#undef HAVE_DUP3 -+ - /* Define to 1 if you have the `epoll_create1' function. */ - #undef HAVE_EPOLL_CREATE1 - -@@ -66,6 +69,9 @@ - /* Define if _Unwind_GetIPInfo is available. */ - #undef HAVE_GETIPINFO - -+/* Define to 1 if you have the `getxattr' function. */ -+#undef HAVE_GETXATTR -+ - /* Define to 1 if you have the `inotify_add_watch' function. */ - #undef HAVE_INOTIFY_ADD_WATCH - -@@ -111,6 +117,9 @@ - /* Define to 1 if you have the <linux/rtnetlink.h> header file. */ - #undef HAVE_LINUX_RTNETLINK_H - -+/* Define to 1 if you have the `listxattr' function. */ -+#undef HAVE_LISTXATTR -+ - /* Define to 1 if the system has the type `loff_t'. */ - #undef HAVE_LOFF_T - -@@ -171,6 +180,9 @@ - /* Define to 1 if you have the `pipe2' function. */ - #undef HAVE_PIPE2 - -+/* Define to 1 if you have the `removexattr' function. */ -+#undef HAVE_REMOVEXATTR -+ - /* Define to 1 if you have the `renameat' function. */ - #undef HAVE_RENAMEAT - -@@ -180,6 +192,9 @@ - /* Define to 1 if you have the `setenv' function. */ - #undef HAVE_SETENV - -+/* Define to 1 if you have the `setxattr' function. */ -+#undef HAVE_SETXATTR -+ - /* Define to 1 if you have the `sinl' function. */ - #undef HAVE_SINL - -Index: libgo/configure.ac -=================================================================== ---- a/src/libgo/configure.ac (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/configure.ac (.../branches/gcc-4_8-branch) -@@ -503,7 +503,7 @@ - AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) - AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) - --AC_CHECK_FUNCS(accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat) -+AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat) - AC_TYPE_OFF_T - AC_CHECK_TYPES([loff_t]) - -Index: libgo/config/libtool.m4 -=================================================================== ---- a/src/libgo/config/libtool.m4 (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/config/libtool.m4 (.../branches/gcc-4_8-branch) -@@ -1225,7 +1225,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -1239,7 +1239,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -1258,7 +1261,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -Index: libgo/go/reflect/value.go -=================================================================== ---- a/src/libgo/go/reflect/value.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/value.go (.../branches/gcc-4_8-branch) -@@ -98,6 +98,7 @@ - flagIndir - flagAddr - flagMethod -+ flagMethodFn // gccgo: first fn parameter is always pointer - flagKindShift = iota - flagKindWidth = 5 // there are 27 kinds - flagKindMask flag = 1<<flagKindWidth - 1 -@@ -433,7 +434,7 @@ - if v.flag&flagMethod != 0 { - nin++ - } -- firstPointer := len(in) > 0 && t.In(0).Kind() != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ) -+ firstPointer := len(in) > 0 && t.In(0).Kind() != Ptr && v.flag&flagMethodFn != 0 - params := make([]unsafe.Pointer, nin) - off := 0 - if v.flag&flagMethod != 0 { -@@ -484,33 +485,6 @@ - return ret - } - --// gccgo specific test to see if typ is a method. We can tell by --// looking at the string to see if there is a receiver. We need this --// because for gccgo all methods take pointer receivers. --func isMethod(t *rtype) bool { -- if Kind(t.kind) != Func { -- return false -- } -- s := *t.string -- parens := 0 -- params := 0 -- sawRet := false -- for i, c := range s { -- if c == '(' { -- if parens == 0 { -- params++ -- } -- parens++ -- } else if c == ')' { -- parens-- -- } else if parens == 0 && c == ' ' && s[i+1] != '(' && !sawRet { -- params++ -- sawRet = true -- } -- } -- return params > 2 --} -- - // methodReceiver returns information about the receiver - // described by v. The Value v may or may not have the - // flagMethod bit set, so the kind cached in v.flag should -@@ -917,6 +891,16 @@ - v = makeMethodValue("Interface", v) - } - -+ if v.flag&flagMethodFn != 0 { -+ if v.typ.Kind() != Func { -+ panic("reflect: MethodFn of non-Func") -+ } -+ ft := (*funcType)(unsafe.Pointer(v.typ)) -+ if ft.in[0].Kind() != Ptr { -+ v = makeValueMethod(v) -+ } -+ } -+ - k := v.kind() - if k == Interface { - // Special case: return the element inside the interface. -@@ -1230,8 +1214,7 @@ - // created via reflect have the same underlying code pointer, - // so their Pointers are equal. The function used here must - // match the one used in makeMethodValue. -- // This is not properly implemented for gccgo. -- f := Zero -+ f := makeFuncStub - return **(**uintptr)(unsafe.Pointer(&f)) - } - p := v.val -Index: libgo/go/reflect/makefuncgo_386.go -=================================================================== ---- a/src/libgo/go/reflect/makefuncgo_386.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/makefuncgo_386.go (.../branches/gcc-4_8-branch) -@@ -14,8 +14,10 @@ - // registers that might hold result values. - type i386Regs struct { - esp uint32 -- eax uint32 // Value to return in %eax. -- st0 uint64 // Value to return in %st(0). -+ eax uint32 // Value to return in %eax. -+ st0 float64 // Value to return in %st(0). -+ sr bool // Set to true if hidden struct pointer. -+ sf bool // Set to true if returning float - } - - // MakeFuncStubGo implements the 386 calling convention for MakeFunc. -@@ -56,10 +58,13 @@ - in := make([]Value, 0, len(ftyp.in)) - ap := uintptr(regs.esp) - -+ regs.sr = false -+ regs.sf = false - var retPtr unsafe.Pointer - if retStruct { - retPtr = *(*unsafe.Pointer)(unsafe.Pointer(ap)) - ap += ptrSize -+ regs.sr = true - } - - for _, rt := range ftyp.in { -@@ -77,7 +82,7 @@ - - // Call the real function. - -- out := c.fn(in) -+ out := c.call(in) - - if len(out) != len(ftyp.out) { - panic("reflect: wrong return count from function created by MakeFunc") -@@ -123,13 +128,16 @@ - - v := out[0] - w := v.iword() -- if v.Kind() != Ptr && v.Kind() != UnsafePointer { -- w = loadIword(unsafe.Pointer(w), v.typ.size) -- } - switch v.Kind() { -- case Float32, Float64: -- regs.st0 = uint64(uintptr(w)) -+ case Ptr, UnsafePointer: -+ regs.eax = uint32(uintptr(w)) -+ case Float32: -+ regs.st0 = float64(*(*float32)(unsafe.Pointer(w))) -+ regs.sf = true -+ case Float64: -+ regs.st0 = *(*float64)(unsafe.Pointer(w)) -+ regs.sf = true - default: -- regs.eax = uint32(uintptr(w)) -+ regs.eax = uint32(uintptr(loadIword(unsafe.Pointer(w), v.typ.size))) - } - } -Index: libgo/go/reflect/makefunc_amd64.S -=================================================================== ---- a/src/libgo/go/reflect/makefunc_amd64.S (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/makefunc_amd64.S (.../branches/gcc-4_8-branch) -@@ -61,6 +61,14 @@ - movdqa %xmm6, 0xa0(%rsp) - movdqa %xmm7, 0xb0(%rsp) - -+ /* For MakeFunc functions that call recover. */ -+ movq 8(%rbp), %rdi -+#ifdef __PIC__ -+ call __go_makefunc_can_recover@PLT -+#else -+ call __go_makefunc_can_recover -+#endif -+ - # Get function type. - #ifdef __PIC__ - call __go_get_closure@PLT -@@ -77,6 +85,13 @@ - call reflect.MakeFuncStubGo - #endif - -+ /* MakeFunc functions can no longer call recover. */ -+#ifdef __PIC__ -+ call __go_makefunc_returning@PLT -+#else -+ call __go_makefunc_returning -+#endif -+ - # The structure will be updated with any return values. Load - # all possible return registers before returning to the caller. - -Index: libgo/go/reflect/type.go -=================================================================== ---- a/src/libgo/go/reflect/type.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/type.go (.../branches/gcc-4_8-branch) -@@ -508,7 +508,7 @@ - m.Type = toType(mt) - x := new(unsafe.Pointer) - *x = unsafe.Pointer(&p.tfn) -- m.Func = Value{mt, unsafe.Pointer(x), fl | flagIndir} -+ m.Func = Value{mt, unsafe.Pointer(x), fl | flagIndir | flagMethodFn} - m.Index = i - return - } -Index: libgo/go/reflect/makefunc_386.S -=================================================================== ---- a/src/libgo/go/reflect/makefunc_386.S (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/makefunc_386.S (.../branches/gcc-4_8-branch) -@@ -25,9 +25,13 @@ - struct { - esp uint32 // 0x0 - eax uint32 // 0x4 -- st0 uint64 // 0x8 -+ st0 float64 // 0x8 -+ sr bool // 0x10 -+ sf bool // 0x11 - } -- */ -+ The sr field is set by the function to a non-zero value if -+ the function takes a struct hidden pointer that must be -+ popped off the stack. */ - - pushl %ebp - .LCFI0: -@@ -45,7 +49,16 @@ - leal 8(%ebp), %eax /* Set esp field in struct. */ - movl %eax, -24(%ebp) - -+ /* For MakeFunc functions that call recover. */ -+ movl 4(%ebp), %eax -+ movl %eax, (%esp) - #ifdef __PIC__ -+ call __go_makefunc_can_recover@PLT -+#else -+ call __go_makefunc_can_recover -+#endif -+ -+#ifdef __PIC__ - call __go_get_closure@PLT - #else - call __go_get_closure -@@ -62,9 +75,20 @@ - call reflect.MakeFuncStubGo - #endif - -+ /* MakeFunc functions can no longer call recover. */ -+#ifdef __PIC__ -+ call __go_makefunc_returning@PLT -+#else -+ call __go_makefunc_returning -+#endif -+ - /* Set return registers. */ - - movl -20(%ebp), %eax -+ -+ cmpb $0, -7(%ebp) -+ je 2f -+ - fldl -16(%ebp) - - #ifdef __SSE2__ -@@ -73,12 +97,20 @@ - movsd -16(%ebp), %xmm0 - #endif - -+2: -+ movb -8(%ebp), %dl -+ - addl $36, %esp - popl %ebx - .LCFI3: - popl %ebp - .LCFI4: -+ -+ testb %dl,%dl -+ jne 1f - ret -+1: -+ ret $4 - .LFE1: - #ifdef __ELF__ - .size reflect.makeFuncStub, . - reflect.makeFuncStub -Index: libgo/go/reflect/all_test.go -=================================================================== ---- a/src/libgo/go/reflect/all_test.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/all_test.go (.../branches/gcc-4_8-branch) -@@ -1430,6 +1430,46 @@ - } - } - -+type emptyStruct struct{} -+ -+type nonEmptyStruct struct { -+ member int -+} -+ -+func returnEmpty() emptyStruct { -+ return emptyStruct{} -+} -+ -+func takesEmpty(e emptyStruct) { -+} -+ -+func returnNonEmpty(i int) nonEmptyStruct { -+ return nonEmptyStruct{member: i} -+} -+ -+func takesNonEmpty(n nonEmptyStruct) int { -+ return n.member -+} -+ -+func TestCallWithStruct(t *testing.T) { -+ r := ValueOf(returnEmpty).Call([]Value{}) -+ if len(r) != 1 || r[0].Type() != TypeOf(emptyStruct{}) { -+ t.Errorf("returning empty struct returned %s instead", r) -+ } -+ r = ValueOf(takesEmpty).Call([]Value{ValueOf(emptyStruct{})}) -+ if len(r) != 0 { -+ t.Errorf("takesEmpty returned values: %s", r) -+ } -+ r = ValueOf(returnNonEmpty).Call([]Value{ValueOf(42)}) -+ if len(r) != 1 || r[0].Type() != TypeOf(nonEmptyStruct{}) || r[0].Field(0).Int() != 42 { -+ t.Errorf("returnNonEmpty returned %s", r) -+ } -+ r = ValueOf(takesNonEmpty).Call([]Value{ValueOf(nonEmptyStruct{member: 42})}) -+ if len(r) != 1 || r[0].Type() != TypeOf(1) || r[0].Int() != 42 { -+ t.Errorf("takesNonEmpty returned %s", r) -+ } -+} -+ - func TestMakeFunc(t *testing.T) { - switch runtime.GOARCH { - case "amd64", "386": -@@ -1587,9 +1627,13 @@ - } - } - --/* Not yet implemented for gccgo -+func TestMethodValue(t *testing.T) { -+ switch runtime.GOARCH { -+ case "amd64", "386": -+ default: -+ t.Skip("reflect method values not implemented for " + runtime.GOARCH) -+ } - --func TestMethodValue(t *testing.T) { - p := Point{3, 4} - var i int64 - -@@ -1658,8 +1702,6 @@ - } - } - --*/ -- - // Reflect version of $GOROOT/test/method5.go - - // Concrete types implementing M method. -@@ -1744,7 +1786,12 @@ - func (t4 Tm4) M(x int, b byte) (byte, int) { return b, x + 40 } - - func TestMethod5(t *testing.T) { -- /* Not yet used for gccgo -+ switch runtime.GOARCH { -+ case "amd64", "386": -+ default: -+ t.Skip("reflect method values not implemented for " + runtime.GOARCH) -+ } -+ - CheckF := func(name string, f func(int, byte) (byte, int), inc int) { - b, x := f(1000, 99) - if b != 99 || x != 1000+inc { -@@ -1751,7 +1798,6 @@ - t.Errorf("%s(1000, 99) = %v, %v, want 99, %v", name, b, x, 1000+inc) - } - } -- */ - - CheckV := func(name string, i Value, inc int) { - bx := i.Method(0).Call([]Value{ValueOf(1000), ValueOf(byte(99))}) -@@ -1761,9 +1807,7 @@ - t.Errorf("direct %s.M(1000, 99) = %v, %v, want 99, %v", name, b, x, 1000+inc) - } - -- /* Not yet implemented for gccgo - CheckF(name+".M", i.Method(0).Interface().(func(int, byte) (byte, int)), inc) -- */ - } - - var TinterType = TypeOf(new(Tinter)).Elem() -Index: libgo/go/reflect/makefunc.go -=================================================================== ---- a/src/libgo/go/reflect/makefunc.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/makefunc.go (.../branches/gcc-4_8-branch) -@@ -17,6 +17,11 @@ - code uintptr - typ *funcType - fn func([]Value) []Value -+ -+ // For gccgo we use the same entry point for functions and for -+ // method values. -+ method int -+ rcvr Value + time_t now = time(NULL); +- *date = xmalloc (CSZ); +- *date_len = strctime (*date, CSZ, &now); ++ *date = xmalloc (CTIME_BUFSZ); ++ *date_len = gf_ctime (*date, CTIME_BUFSZ, now); } - // MakeFunc returns a new function of the given Type -@@ -61,7 +66,7 @@ - dummy := makeFuncStub - code := **(**uintptr)(unsafe.Pointer(&dummy)) - -- impl := &makeFuncImpl{code: code, typ: ftyp, fn: fn} -+ impl := &makeFuncImpl{code: code, typ: ftyp, fn: fn, method: -1} - - return Value{t, unsafe.Pointer(&impl), flag(Func<<flagKindShift) | flagIndir} - } -@@ -85,15 +90,94 @@ - panic("reflect: internal error: invalid use of makePartialFunc") - } -+ switch runtime.GOARCH { -+ case "amd64", "386": -+ default: -+ panic("reflect.makeMethodValue not implemented for " + runtime.GOARCH) -+ } -+ - // Ignoring the flagMethod bit, v describes the receiver, not the method type. - fl := v.flag & (flagRO | flagAddr | flagIndir) - fl |= flag(v.typ.Kind()) << flagKindShift - rcvr := Value{v.typ, v.val, fl} - -+ // v.Type returns the actual type of the method value. -+ ft := v.Type().(*rtype) -+ -+ // Indirect Go func value (dummy) to obtain -+ // actual code address. (A Go func value is a pointer -+ // to a C function pointer. http://golang.org/s/go11func.) -+ dummy := makeFuncStub -+ code := **(**uintptr)(unsafe.Pointer(&dummy)) -+ - // Cause panic if method is not appropriate. - // The panic would still happen during the call if we omit this, - // but we want Interface() and other operations to fail early. -- methodReceiver(op, rcvr, int(v.flag)>>flagMethodShift) -+ t, _, _ := methodReceiver(op, rcvr, int(v.flag)>>flagMethodShift) - -- panic("reflect makeMethodValue not implemented") -+ fv := &makeFuncImpl{ -+ code: code, -+ typ: (*funcType)(unsafe.Pointer(t)), -+ method: int(v.flag) >> flagMethodShift, -+ rcvr: rcvr, -+ } -+ -+ return Value{ft, unsafe.Pointer(&fv), v.flag&flagRO | flag(Func)<<flagKindShift | flagIndir} +@@ -76,10 +98,7 @@ + fdate_sub (char * date, gfc_charlen_type date_len) + { + time_t now = time(NULL); +- char *s = xmalloc (date_len + 1); +- size_t n = strctime (s, date_len + 1, &now); +- fstrcpy (date, date_len, s, n); +- free (s); ++ gf_ctime (date, date_len, now); } -+ -+// makeValueMethod takes a method function and returns a function that -+// takes a value receiver and calls the real method with a pointer to -+// it. -+func makeValueMethod(v Value) Value { -+ typ := v.typ -+ if typ.Kind() != Func { -+ panic("reflect: call of makeValueMethod with non-Func type") -+ } -+ if v.flag&flagMethodFn == 0 { -+ panic("reflect: call of makeValueMethod with non-MethodFn") -+ } -+ -+ switch runtime.GOARCH { -+ case "amd64", "386": -+ default: -+ panic("reflect.makeValueMethod not implemented for " + runtime.GOARCH) -+ } -+ -+ t := typ.common() -+ ftyp := (*funcType)(unsafe.Pointer(t)) -+ -+ // Indirect Go func value (dummy) to obtain -+ // actual code address. (A Go func value is a pointer -+ // to a C function pointer. http://golang.org/s/go11func.) -+ dummy := makeFuncStub -+ code := **(**uintptr)(unsafe.Pointer(&dummy)) -+ -+ impl := &makeFuncImpl{ -+ code: code, -+ typ: ftyp, -+ method: -2, -+ rcvr: v, -+ } -+ -+ return Value{t, unsafe.Pointer(&impl), flag(Func<<flagKindShift) | flagIndir} -+} -+ -+// Call the function represented by a makeFuncImpl. -+func (c *makeFuncImpl) call(in []Value) []Value { -+ if c.method == -1 { -+ return c.fn(in) -+ } else if c.method == -2 { -+ if c.typ.IsVariadic() { -+ return c.rcvr.CallSlice(in) -+ } else { -+ return c.rcvr.Call(in) -+ } -+ } else { -+ m := c.rcvr.Method(c.method) -+ if c.typ.IsVariadic() { -+ return m.CallSlice(in) -+ } else { -+ return m.Call(in) -+ } -+ } -+} -Index: libgo/go/reflect/makefuncgo_amd64.go -=================================================================== ---- a/src/libgo/go/reflect/makefuncgo_amd64.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/reflect/makefuncgo_amd64.go (.../branches/gcc-4_8-branch) -@@ -319,7 +319,7 @@ - // All the real arguments have been found and turned into - // Value's. Call the real function. - -- out := c.fn(in) -+ out := c.call(in) - - if len(out) != len(ftyp.out) { - panic("reflect: wrong return count from function created by MakeFunc") -Index: libgo/go/net/fd_unix.go -=================================================================== ---- a/src/libgo/go/net/fd_unix.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/net/fd_unix.go (.../branches/gcc-4_8-branch) -@@ -9,6 +9,7 @@ - import ( - "io" - "os" -+ "runtime" - "sync" - "syscall" - "time" -@@ -90,6 +91,16 @@ - if err == nil || err == syscall.EISCONN { - break - } -+ -+ // On Solaris we can see EINVAL if the socket has -+ // already been accepted and closed by the server. -+ // Treat this as a successful connection--writes to -+ // the socket will see EOF. For details and a test -+ // case in C see http://golang.org/issue/6828. -+ if runtime.GOOS == "solaris" && err == syscall.EINVAL { -+ break -+ } -+ - if err != syscall.EINPROGRESS && err != syscall.EALREADY && err != syscall.EINTR { - return err - } -Index: libgo/go/go/build/build.go -=================================================================== ---- a/src/libgo/go/go/build/build.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/go/build/build.go (.../branches/gcc-4_8-branch) -@@ -429,7 +429,7 @@ - switch ctxt.Compiler { - case "gccgo": - dir, elem := pathpkg.Split(p.ImportPath) -- pkga = "pkg/gccgo/" + dir + "lib" + elem + ".a" -+ pkga = "pkg/gccgo_" + ctxt.GOOS + "_" + ctxt.GOARCH + "/" + dir + "lib" + elem + ".a" - case "gc": - suffix := "" - if ctxt.InstallSuffix != "" { -Index: libgo/go/go/build/syslist.go -=================================================================== ---- a/src/libgo/go/go/build/syslist.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/go/build/syslist.go (.../branches/gcc-4_8-branch) -@@ -0,0 +1,8 @@ -+// Copyright 2011 The Go Authors. All rights reserved. -+// Use of this source code is governed by a BSD-style -+// license that can be found in the LICENSE file. -+ -+package build -+ -+const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows solaris " -+const goarchList = "386 amd64 arm alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 " -Index: libgo/go/syscall/libcall_linux.go -=================================================================== ---- a/src/libgo/go/syscall/libcall_linux.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/syscall/libcall_linux.go (.../branches/gcc-4_8-branch) -@@ -190,6 +190,9 @@ - //sys Adjtimex(buf *Timex) (state int, err error) - //adjtimex(buf *Timex) _C_int -+//sysnb Dup3(oldfd int, newfd int, flags int) (err error) -+//dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int -+ - //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) - //faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int -@@ -268,6 +271,9 @@ - return origlen - len(buf), count, names +@@ -91,8 +110,8 @@ + PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t) + { + time_t now = t; +- *date = xmalloc (CSZ); +- *date_len = strctime (*date, CSZ, &now); ++ *date = xmalloc (CTIME_BUFSZ); ++ *date_len = gf_ctime (*date, CTIME_BUFSZ, now); } -+//sys Getxattr(path string, attr string, dest []byte) (sz int, err error) -+//getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t -+ - //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) - //inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int - -@@ -283,6 +289,9 @@ - //sys Klogctl(typ int, buf []byte) (n int, err error) - //klogctl(typ _C_int, bufp *byte, len _C_int) _C_int - -+//sys Listxattr(path string, dest []byte) (sz int, err error) -+//listxattr(path *byte, list *byte, size Size_t) Ssize_t -+ - //sys Mkdirat(dirfd int, path string, mode uint32) (err error) - //mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int - -@@ -305,6 +314,9 @@ - //sys PivotRoot(newroot string, putold string) (err error) - //pivot_root(newroot *byte, putold *byte) _C_int -+//sys Removexattr(path string, attr string) (err error) -+//removexattr(path *byte, name *byte) _C_int -+ - //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) - //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int - -@@ -338,6 +350,9 @@ - //sysnb Setresuid(ruid int, eguid int, suid int) (err error) - //setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int - -+//sys Setxattr(path string, attr string, data []byte, flags int) (err error) -+//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int -+ - //sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) - //splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t - func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { -Index: libgo/go/syscall/socket.go -=================================================================== ---- a/src/libgo/go/syscall/socket.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/syscall/socket.go (.../branches/gcc-4_8-branch) -@@ -25,7 +25,7 @@ - Pad [96]int8 +@@ -103,8 +122,5 @@ + ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len) + { + time_t now = *t; +- char *s = xmalloc (date_len + 1); +- size_t n = strctime (s, date_len + 1, &now); +- fstrcpy (date, date_len, s, n); +- free (s); ++ gf_ctime (date, date_len, now); } - --const SizeofSockaddrAny = 0x1c -+const SizeofSockaddrAny = 0x6c - - type SockaddrInet4 struct { - Port int -Index: libgo/go/syscall/libcall_posix.go -=================================================================== ---- a/src/libgo/go/syscall/libcall_posix.go (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/go/syscall/libcall_posix.go (.../branches/gcc-4_8-branch) -@@ -238,6 +238,9 @@ - //sysnb Getppid() (ppid int) - //getppid() Pid_t - -+//sys Getpriority(which int, who int) (prio int, err error) -+//getpriority(which _C_int, who _C_int) _C_int -+ - //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) - //getrlimit(resource _C_int, rlim *Rlimit) _C_int - -@@ -307,6 +310,9 @@ - //sysnb Setpgid(pid int, pgid int) (err error) - //setpgid(pid Pid_t, pgid Pid_t) _C_int - -+//sys Setpriority(which int, who int, prio int) (err error) -+//setpriority(which _C_int, who _C_int, prio _C_int) _C_int -+ - //sysnb Setreuid(ruid int, euid int) (err error) - //setreuid(ruid Uid_t, euid Uid_t) _C_int - -Index: libgo/Makefile.am -=================================================================== ---- a/src/libgo/Makefile.am (.../tags/gcc_4_8_2_release) -+++ b/src/libgo/Makefile.am (.../branches/gcc-4_8-branch) -@@ -424,6 +424,7 @@ - runtime/go-caller.c \ - runtime/go-callers.c \ - runtime/go-can-convert-interface.c \ -+ runtime/go-cdiv.c \ - runtime/go-cgo.c \ - runtime/go-check-interface.c \ - runtime/go-construct-map.c \ -@@ -1254,7 +1255,7 @@ - go/go/build/build.go \ - go/go/build/doc.go \ - go/go/build/read.go \ -- syslist.go -+ go/go/build/syslist.go - go_go_doc_files = \ - go/go/doc/comment.go \ - go/go/doc/doc.go \ -@@ -2712,15 +2713,6 @@ - @$(CHECK) - .PHONY: go/build/check - --syslist.go: s-syslist; @true --s-syslist: Makefile -- echo '// Generated automatically by make.' >syslist.go.tmp -- echo 'package build' >>syslist.go.tmp -- echo 'const goosList = "$(GOOS)"' >>syslist.go.tmp -- echo 'const goarchList = "$(GOARCH)"' >>syslist.go.tmp -- $(SHELL) $(srcdir)/../move-if-change syslist.go.tmp syslist.go -- $(STAMP) $@ -- - @go_include@ go/doc.lo.dep - go/doc.lo.dep: $(go_go_doc_files) - $(BUILDDEPS) -Index: config.sub -=================================================================== ---- a/src/config.sub (.../tags/gcc_4_8_2_release) -+++ b/src/config.sub (.../branches/gcc-4_8-branch) -@@ -1,10 +1,8 @@ - #! /bin/sh - # Configuration validation subroutine script. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, --# 2011, 2012, 2013 Free Software Foundation, Inc. -+# Copyright 1992-2013 Free Software Foundation, Inc. - --timestamp='2013-01-11' -+timestamp='2013-10-01' - - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by -@@ -70,9 +68,7 @@ - version="\ - GNU config.sub ($timestamp) - --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, --2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, --2012, 2013 Free Software Foundation, Inc. -+Copyright 1992-2013 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -256,12 +252,12 @@ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ -- | arc \ -+ | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ -- | c4x | clipper \ -+ | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ -@@ -269,6 +265,7 @@ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ -+ | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ -@@ -297,10 +294,10 @@ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ -- | nios | nios2 \ -+ | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ -- | or32 \ -+ | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ -@@ -328,7 +325,7 @@ - c6x) - basic_machine=tic6x-unknown - ;; -- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) -+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; -@@ -370,13 +367,13 @@ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ -- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ -+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ -- | clipper-* | craynv-* | cydra-* \ -+ | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ -@@ -385,6 +382,7 @@ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ -+ | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ -@@ -414,7 +412,7 @@ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ -- | nios-* | nios2-* \ -+ | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ -@@ -798,7 +796,7 @@ - os=-mingw64 - ;; - mingw32) -- basic_machine=i386-pc -+ basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) -@@ -834,7 +832,7 @@ - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) -- basic_machine=i386-pc -+ basic_machine=i686-pc - os=-msys - ;; - mvs) -@@ -1550,6 +1548,9 @@ - c4x-* | tic4x-*) - os=-coff - ;; -+ c8051-*) -+ os=-elf -+ ;; - hexagon-*) - os=-elf - ;; -@@ -1593,6 +1594,9 @@ - mips*-*) - os=-elf - ;; -+ or1k-*) -+ os=-elf -+ ;; - or32-*) - os=-coff - ;; -Index: libobjc/configure -=================================================================== ---- a/src/libobjc/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libobjc/configure (.../branches/gcc-4_8-branch) -@@ -6056,7 +6056,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6081,7 +6081,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6100,7 +6103,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10595,7 +10601,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10598 "configure" -+#line 10604 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10701,7 +10707,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10704 "configure" -+#line 10710 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11472,7 +11478,7 @@ - enableval=$enable_sjlj_exceptions; : - else - cat > conftest.$ac_ext << EOF --#line 11475 "configure" -+#line 11481 "configure" - @interface Frob - @end - @implementation Frob -Index: libgfortran/configure -=================================================================== ---- a/src/libgfortran/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/configure (.../branches/gcc-4_8-branch) -@@ -8062,7 +8062,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -8087,7 +8087,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -8106,7 +8109,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -12333,7 +12339,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 12336 "configure" -+#line 12342 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -12439,7 +12445,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 12442 "configure" -+#line 12448 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H Index: libgfortran/ChangeLog =================================================================== ---- a/src/libgfortran/ChangeLog (.../tags/gcc_4_8_2_release) +--- a/src/libgfortran/ChangeLog (.../tags/gcc_4_8_3_release) +++ b/src/libgfortran/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,56 @@ -+2014-03-15 Dominique d'Humieres <dominiq@lps.ens.fr> +@@ -1,3 +1,21 @@ ++2014-05-26 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from mainline -+ PR libgfortran/60128 -+ * io/write_float.def (output_float): Remove unused variable -+ nzero_real. Replace a double space with a single one. -+ (determine_en_precision): Fix wrong handling of the EN format. -+ -+2014-03-15 Jerry DeLisle <jvdelisle@gcc.gnu> -+ -+ Backport from mainline -+ PR libfortran/58324 -+ PR libfortran/38199 -+ * io/list_read.c (finish_list_read): Read one character to check -+ for the end of the file. If it is the end, then issue the file -+ end error message. If not, use eat_line to reach the end -+ without giving error. The next attempt to read will then -+ issue the error as described above. -+ * io/read.c (read_decimal): Quickly skip spaces to avoid calls -+ to next_char. -+ * io/unit.c (is_trim_ok): New helper function to check various -+ conditions to see if its OK to trim the internal unit string. -+ (get_internal_unit): Use LEN_TRIM to shorten selected internal -+ unit strings for optimizing READ. Enable this optimization for -+ formatted READ. -+ -+2014-02-21 Jerry DeLisle <jvdelisle@gcc.gnu> -+ Dominique d'Humieres <dominiq@lps.ens.fr> -+ Steven G. Kargl <kargl@gcc.gnu.org> -+ -+ Backport from mainline -+ PR libfortran/59700 -+ PR libfortran/59764 -+ * io/io.h (struct st_parameter_dt): Assign expanded_read flag to -+ unused bit. Define new variable line_buffer_pos. -+ * io/list_read.c (free_saved, next_char, l_push_char, -+ read_logical, read_real): Replace use of item_count with -+ line_buffer_pos for line_buffer look ahead. -+ (read_logical, read_integer, parse_real, read_real, check_type): -+ Adjust location of free_line to after generating error messages -+ to retain the correct item count for the message. -+ -+2014-02-15 Jerry DeLisle <jvdelisle@gcc.gnu> -+ Dominique d'Humieres <dominiq@lps.ens.fr> -+ -+ Backport from mainline -+ PR libfortran/59771 -+ PR libfortran/59774 -+ PR libfortran/59836 -+ * io/write_float.def (output_float): Fix wrong handling of the -+ Fw.0 format. -+ (output_float_FMT_G_): Fixes rounding issues with -m32. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libgfortran/io/list_read.c -=================================================================== ---- a/src/libgfortran/io/list_read.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/io/list_read.c (.../branches/gcc-4_8-branch) -@@ -118,7 +118,7 @@ - static void - free_line (st_parameter_dt *dtp) - { -- dtp->u.p.item_count = 0; -+ dtp->u.p.line_buffer_pos = 0; - dtp->u.p.line_buffer_enabled = 0; - - if (dtp->u.p.line_buffer == NULL) -@@ -150,15 +150,15 @@ - { - dtp->u.p.at_eol = 0; - -- c = dtp->u.p.line_buffer[dtp->u.p.item_count]; -- if (c != '\0' && dtp->u.p.item_count < 64) -+ c = dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos]; -+ if (c != '\0' && dtp->u.p.line_buffer_pos < 64) - { -- dtp->u.p.line_buffer[dtp->u.p.item_count] = '\0'; -- dtp->u.p.item_count++; -+ dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos] = '\0'; -+ dtp->u.p.line_buffer_pos++; - goto done; - } - -- dtp->u.p.item_count = 0; -+ dtp->u.p.line_buffer_pos = 0; - dtp->u.p.line_buffer_enabled = 0; - } - -@@ -640,7 +640,7 @@ - if (dtp->u.p.line_buffer == NULL) - dtp->u.p.line_buffer = xcalloc (SCRATCH_SIZE, 1); - -- dtp->u.p.line_buffer[dtp->u.p.item_count++] = c; -+ dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos++] = c; - } - - -@@ -750,7 +750,7 @@ - { - dtp->u.p.nml_read_error = 1; - dtp->u.p.line_buffer_enabled = 1; -- dtp->u.p.item_count = 0; -+ dtp->u.p.line_buffer_pos = 0; - return; - } - -@@ -758,14 +758,17 @@ - - bad_logical: - -- free_line (dtp); -- - if (nml_bad_return (dtp, c)) -- return; -+ { -+ free_line (dtp); -+ return; -+ } - -+ - free_saved (dtp); - if (c == EOF) - { -+ free_line (dtp); - hit_eof (dtp); - return; - } -@@ -773,6 +776,7 @@ - eat_line (dtp); - snprintf (message, MSGLEN, "Bad logical value while reading item %d", - dtp->u.p.item_count); -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - return; - -@@ -913,9 +917,9 @@ - else if (c != '\n') - eat_line (dtp); - -- free_line (dtp); - snprintf (message, MSGLEN, "Bad integer for item %d in list input", - dtp->u.p.item_count); -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - - return; -@@ -1298,9 +1302,9 @@ - else if (c != '\n') - eat_line (dtp); - -- free_line (dtp); - snprintf (message, MSGLEN, "Bad floating point number for item %d", - dtp->u.p.item_count); -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - - return 1; -@@ -1406,9 +1410,9 @@ - else if (c != '\n') - eat_line (dtp); - -- free_line (dtp); - snprintf (message, MSGLEN, "Bad complex value in item %d of list input", - dtp->u.p.item_count); -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - } - -@@ -1770,7 +1774,7 @@ - { - dtp->u.p.nml_read_error = 1; - dtp->u.p.line_buffer_enabled = 1; -- dtp->u.p.item_count = 0; -+ dtp->u.p.line_buffer_pos = 0; - return; - } - -@@ -1789,9 +1793,9 @@ - else if (c != '\n') - eat_line (dtp); - -- free_line (dtp); - snprintf (message, MSGLEN, "Bad real number in item %d of list input", - dtp->u.p.item_count); -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - } - -@@ -1806,11 +1810,10 @@ - - if (dtp->u.p.saved_type != BT_UNKNOWN && dtp->u.p.saved_type != type) - { -- free_line (dtp); - snprintf (message, MSGLEN, "Read type %s where %s was expected for item %d", - type_name (dtp->u.p.saved_type), type_name (type), - dtp->u.p.item_count); -- -+ free_line (dtp); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); - return 1; - } -@@ -1820,12 +1823,12 @@ - - if (dtp->u.p.saved_length != len) - { -- free_line (dtp); - snprintf (message, MSGLEN, - "Read kind %d %s where kind %d is required for item %d", - dtp->u.p.saved_length, type_name (dtp->u.p.saved_type), len, - dtp->u.p.item_count); - generate_error (&dtp->common, LIBERROR_READ_VALUE, message); -+ free_line (dtp); - return 1; - } - -@@ -2031,8 +2034,6 @@ - void - finish_list_read (st_parameter_dt *dtp) - { -- int err; -- - free_saved (dtp); - - fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode); -@@ -2043,12 +2044,22 @@ - return; - } - -- err = eat_line (dtp); -- if (err == LIBERROR_END) -+ if (!is_internal_unit (dtp)) - { -- free_line (dtp); -- hit_eof (dtp); -+ int c; -+ c = next_char (dtp); -+ if (c == EOF) -+ { -+ free_line (dtp); -+ hit_eof (dtp); -+ return; -+ } -+ if (c != '\n') -+ eat_line (dtp); - } -+ -+ free_line (dtp); -+ - } - - /* NAMELIST INPUT -Index: libgfortran/io/read.c -=================================================================== ---- a/src/libgfortran/io/read.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/io/read.c (.../branches/gcc-4_8-branch) -@@ -655,7 +655,13 @@ - - if (c == ' ') - { -- if (dtp->u.p.blank_status == BLANK_NULL) continue; -+ if (dtp->u.p.blank_status == BLANK_NULL) -+ { -+ /* Skip spaces. */ -+ for ( ; w > 0; p++, w--) -+ if (*p != ' ') break; -+ continue; -+ } - if (dtp->u.p.blank_status == BLANK_ZERO) c = '0'; - } - -Index: libgfortran/io/io.h -=================================================================== ---- a/src/libgfortran/io/io.h (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/io/io.h (.../branches/gcc-4_8-branch) -@@ -424,7 +424,10 @@ - unsigned g0_no_blanks : 1; - /* Used to signal use of free_format_data. */ - unsigned format_not_saved : 1; -- /* 14 unused bits. */ -+ /* A flag used to identify when a non-standard expanded namelist read -+ has occurred. */ -+ unsigned expanded_read : 1; -+ /* 13 unused bits. */ - - /* Used for ungetc() style functionality. Possible values - are an unsigned char, EOF, or EOF - 1 used to mark the -@@ -441,9 +444,8 @@ - char *line_buffer; - struct format_data *fmt; - namelist_info *ionml; -- /* A flag used to identify when a non-standard expanded namelist read -- has occurred. */ -- int expanded_read; -+ /* Current position within the look-ahead line buffer. */ -+ int line_buffer_pos; - /* Storage area for values except for strings. Must be - large enough to hold a complex value (two reals) of the - largest kind. */ -Index: libgfortran/io/unit.c -=================================================================== ---- a/src/libgfortran/io/unit.c (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/io/unit.c (.../branches/gcc-4_8-branch) -@@ -29,6 +29,7 @@ - #include "unix.h" - #include <stdlib.h> - #include <string.h> -+#include <stdbool.h> - - - /* IO locking rules: -@@ -375,6 +376,38 @@ - } - - -+/* Helper function to check rank, stride, format string, and namelist. -+ This is used for optimization. You can't trim out blanks or shorten -+ the string if trailing spaces are significant. */ -+static bool -+is_trim_ok (st_parameter_dt *dtp) -+{ -+ /* Check rank and stride. */ -+ if (dtp->internal_unit_desc -+ && (GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc) > 1 -+ || GFC_DESCRIPTOR_STRIDE(dtp->internal_unit_desc, 0) != 1)) -+ return false; -+ /* Format strings can not have 'BZ' or '/'. */ -+ if (dtp->common.flags & IOPARM_DT_HAS_FORMAT) -+ { -+ char *p = dtp->format; -+ off_t i; -+ if (dtp->common.flags & IOPARM_DT_HAS_BLANK) -+ return false; -+ for (i = 0; i < dtp->format_len; i++) -+ { -+ if (p[i] == '/') return false; -+ if (p[i] == 'b' || p[i] == 'B') -+ if (p[i+1] == 'z' || p[i+1] == 'Z') -+ return false; -+ } -+ } -+ if (dtp->u.p.ionml) /* A namelist. */ -+ return false; -+ return true; -+} -+ -+ - gfc_unit * - get_internal_unit (st_parameter_dt *dtp) - { -@@ -402,6 +435,22 @@ - some other file I/O unit. */ - iunit->unit_number = -1; - -+ /* As an optimization, adjust the unit record length to not -+ include trailing blanks. This will not work under certain conditions -+ where trailing blanks have significance. */ -+ if (dtp->u.p.mode == READING && is_trim_ok (dtp)) -+ { -+ int len; -+ if (dtp->common.unit == 0) -+ len = string_len_trim (dtp->internal_unit_len, -+ dtp->internal_unit); -+ else -+ len = string_len_trim_char4 (dtp->internal_unit_len, -+ (const gfc_char4_t*) dtp->internal_unit); -+ dtp->internal_unit_len = len; -+ iunit->recl = dtp->internal_unit_len; -+ } -+ - /* Set up the looping specification from the array descriptor, if any. */ - - if (is_array_io (dtp)) -@@ -414,27 +463,6 @@ - - start_record *= iunit->recl; - } -- else -- { -- /* If we are not processing an array, adjust the unit record length not -- to include trailing blanks for list-formatted reads. */ -- if (dtp->u.p.mode == READING && !(dtp->common.flags & IOPARM_DT_HAS_FORMAT)) -- { -- if (dtp->common.unit == 0) -- { -- dtp->internal_unit_len = -- string_len_trim (dtp->internal_unit_len, dtp->internal_unit); -- iunit->recl = dtp->internal_unit_len; -- } -- else -- { -- dtp->internal_unit_len = -- string_len_trim_char4 (dtp->internal_unit_len, -- (const gfc_char4_t*) dtp->internal_unit); -- iunit->recl = dtp->internal_unit_len; -- } -- } -- } - - /* Set initial values for unit parameters. */ - if (dtp->common.unit) -Index: libgfortran/io/write_float.def -=================================================================== ---- a/src/libgfortran/io/write_float.def (.../tags/gcc_4_8_2_release) -+++ b/src/libgfortran/io/write_float.def (.../branches/gcc-4_8-branch) -@@ -125,8 +125,6 @@ - int nzero; - /* Number of digits after the decimal point. */ - int nafter; -- /* Number of zeros after the decimal point, whatever the precision. */ -- int nzero_real; - int leadzero; - int nblanks; - int ndigits, edigits; -@@ -138,7 +136,6 @@ - p = dtp->u.p.scale_factor; - - rchar = '5'; -- nzero_real = -1; - - /* We should always know the field width and precision. */ - if (d < 0) -@@ -191,7 +188,7 @@ - if (nafter < 0) - nafter = 0; - nafter = d; -- nzero = nzero_real = 0; -+ nzero = 0; - } - else /* p < 0 */ - { -@@ -211,7 +208,6 @@ - nafter = d + nbefore; - nbefore = 0; - } -- nzero_real = nzero; - if (nzero > d) - nzero = d; - } -@@ -218,7 +214,7 @@ - } - else - { -- nzero = nzero_real = 0; -+ nzero = 0; - nafter = d; - } - -@@ -373,7 +369,7 @@ - updown: - - rchar = '0'; -- if (w > 0 && d == 0 && p == 0) -+ if (ft != FMT_F && w > 0 && d == 0 && p == 0) - nbefore = 1; - /* Scan for trailing zeros to see if we really need to round it. */ - for(i = nbefore + nafter; i < ndigits; i++) -@@ -386,13 +382,14 @@ - do_rnd: - - if (nbefore + nafter == 0) -+ /* Handle the case Fw.0 and value < 1.0 */ - { - ndigits = 0; -- if (nzero_real == d && digits[0] >= rchar) -+ if (digits[0] >= rchar) - { - /* We rounded to zero but shouldn't have */ -- nzero--; -- nafter = 1; -+ nbefore = 1; -+ digits--; - digits[0] = '1'; - ndigits = 1; - } -@@ -990,7 +987,7 @@ - int d = f->u.real.d;\ - int w = f->u.real.w;\ - fnode newf;\ -- GFC_REAL_ ## x rexp_d, r = 0.5;\ -+ GFC_REAL_ ## x exp_d, r = 0.5, r_sc;\ - int low, high, mid;\ - int ubound, lbound;\ - char *p, pad = ' ';\ -@@ -997,6 +994,7 @@ - int save_scale_factor, nb = 0;\ - try result;\ - int nprinted, precision;\ -+ volatile GFC_REAL_ ## x temp;\ - \ - save_scale_factor = dtp->u.p.scale_factor;\ - \ -@@ -1015,10 +1013,13 @@ - break;\ - }\ - \ -- rexp_d = calculate_exp_ ## x (-d);\ -- if ((m > 0.0 && ((m < 0.1 - 0.1 * r * rexp_d) || (rexp_d * (m + r) >= 1.0)))\ -+ exp_d = calculate_exp_ ## x (d);\ -+ r_sc = (1 - r / exp_d);\ -+ temp = 0.1 * r_sc;\ -+ if ((m > 0.0 && ((m < temp) || (r >= (exp_d - m))))\ - || ((m == 0.0) && !(compile_options.allow_std\ -- & (GFC_STD_F2003 | GFC_STD_F2008))))\ -+ & (GFC_STD_F2003 | GFC_STD_F2008)))\ -+ || d == 0)\ - { \ - newf.format = FMT_E;\ - newf.u.real.w = w;\ -@@ -1038,10 +1039,9 @@ - \ - while (low <= high)\ - { \ -- volatile GFC_REAL_ ## x temp;\ - mid = (low + high) / 2;\ - \ -- temp = (calculate_exp_ ## x (mid - 1) * (1 - r * rexp_d));\ -+ temp = (calculate_exp_ ## x (mid - 1) * r_sc);\ - \ - if (m < temp)\ - { \ -@@ -1121,14 +1121,36 @@ - /* EN format is tricky since the number of significant digits depends - on the magnitude. Solve it by first printing a temporary value and - figure out the number of significant digits from the printed -- exponent. */ -+ exponent. Values y, 0.95*10.0**e <= y <10.0**e, are rounded to -+ 10.0**e even when the final result will not be rounded to 10.0**e. -+ For these values the exponent returned by atoi has to be decremented -+ by one. The values y in the ranges -+ (1000.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*(n+1)) -+ (100.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*n+2) -+ (10.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*n+1) -+ are correctly rounded respectively to 1.0...0*10.0*(3*(n+1)), -+ 100.0...0*10.0*(3*n), and 10.0...0*10.0*(3*n), where 0...0 -+ represents d zeroes, by the lines 279 to 297. */ - - #define EN_PREC(x,y)\ - {\ -- GFC_REAL_ ## x tmp; \ -- tmp = * (GFC_REAL_ ## x *)source; \ -+ volatile GFC_REAL_ ## x tmp, one = 1.0;\ -+ tmp = * (GFC_REAL_ ## x *)source;\ - if (isfinite (tmp)) \ -- nprinted = DTOA(y,0,tmp); \ -+ {\ -+ nprinted = DTOA(y,0,tmp);\ -+ int e = atoi (&buffer[4]);\ -+ if (buffer[1] == '1')\ -+ {\ -+ tmp = (calculate_exp_ ## x (-e)) * tmp;\ -+ tmp = one - (tmp < 0 ? -tmp : tmp); \ -+ if (tmp > 0)\ -+ e = e - 1;\ -+ }\ -+ nbefore = e%3;\ -+ if (nbefore < 0)\ -+ nbefore = 3 + nbefore;\ -+ }\ - else\ - nprinted = -1;\ - }\ -@@ -1140,6 +1162,7 @@ - int nprinted; - char buffer[10]; - const size_t size = 10; -+ int nbefore; /* digits before decimal point - 1. */ - - switch (len) - { -@@ -1172,16 +1195,6 @@ - if (nprinted == -1) - return -1; - -- int e = atoi (&buffer[5]); -- int nbefore; /* digits before decimal point - 1. */ -- if (e >= 0) -- nbefore = e % 3; -- else -- { -- nbefore = (-e) % 3; -- if (nbefore != 0) -- nbefore = 3 - nbefore; -- } - int prec = f->u.real.d + nbefore; - if (dtp->u.p.current_unit->round_status != ROUND_UNSPECIFIED - && dtp->u.p.current_unit->round_status != ROUND_PROCDEFINED) -Index: libffi/configure -=================================================================== ---- a/src/libffi/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/configure (.../branches/gcc-4_8-branch) -@@ -613,6 +613,7 @@ - FFI_EXEC_TRAMPOLINE_TABLE - FFI_EXEC_TRAMPOLINE_TABLE_FALSE - FFI_EXEC_TRAMPOLINE_TABLE_TRUE -+HAVE_LONG_DOUBLE_VARIANT - HAVE_LONG_DOUBLE - ALLOCA - TILE_FALSE -@@ -6392,7 +6393,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6417,7 +6418,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6436,7 +6440,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10900,7 +10907,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10903 "configure" -+#line 10910 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11006,7 +11013,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11009 "configure" -+#line 11016 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11443,6 +11450,7 @@ - - - TARGETDIR="unknown" -+HAVE_LONG_DOUBLE_VARIANT=0 - case "$host" in - aarch64*-*-*) - TARGET=AARCH64; TARGETDIR=aarch64 -@@ -11540,6 +11548,7 @@ - - powerpc*-*-linux* | powerpc-*-sysv*) - TARGET=POWERPC; TARGETDIR=powerpc -+ HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc-*-amigaos*) - TARGET=POWERPC; TARGETDIR=powerpc -@@ -11555,6 +11564,7 @@ - ;; - powerpc-*-freebsd* | powerpc-*-openbsd*) - TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc -+ HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc64-*-freebsd*) - TARGET=POWERPC; TARGETDIR=powerpc -@@ -12230,17 +12240,25 @@ - # Also AC_SUBST this variable for ffi.h. - if test -z "$HAVE_LONG_DOUBLE"; then - HAVE_LONG_DOUBLE=0 -- if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then -- if test $ac_cv_sizeof_long_double != 0; then -+ if test $ac_cv_sizeof_long_double != 0; then -+ if test $HAVE_LONG_DOUBLE_VARIANT != 0; then -+ -+$as_echo "#define HAVE_LONG_DOUBLE_VARIANT 1" >>confdefs.h -+ - HAVE_LONG_DOUBLE=1 -+ else -+ if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then -+ HAVE_LONG_DOUBLE=1 - - $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h - -+ fi - fi - fi - fi - - -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 - $as_echo_n "checking whether byte ordering is bigendian... " >&6; } - if test "${ac_cv_c_bigendian+set}" = set; then : -Index: libffi/Makefile.in -=================================================================== ---- a/src/libffi/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/Makefile.in (.../branches/gcc-4_8-branch) -@@ -48,10 +48,10 @@ - @IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S - @M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c - @M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S --@POWERPC_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S -+@POWERPC_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S - @POWERPC_AIX_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S - @POWERPC_DARWIN_TRUE@am__append_16 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S --@POWERPC_FREEBSD_TRUE@am__append_17 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S -+@POWERPC_FREEBSD_TRUE@am__append_17 = src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/sysv.S src/powerpc/ppc_closure.S - @AARCH64_TRUE@am__append_18 = src/aarch64/sysv.S src/aarch64/ffi.c - @ARM_TRUE@am__append_19 = src/arm/sysv.S src/arm/ffi.c - @ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__append_20 = src/arm/trampoline.S -@@ -133,7 +133,9 @@ - @IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo - @M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo - @M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo --@POWERPC_TRUE@am__objects_14 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ -+@POWERPC_TRUE@am__objects_14 = src/powerpc/ffi.lo \ -+@POWERPC_TRUE@ src/powerpc/ffi_sysv.lo \ -+@POWERPC_TRUE@ src/powerpc/ffi_linux64.lo src/powerpc/sysv.lo \ - @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ - @POWERPC_TRUE@ src/powerpc/linux64.lo \ - @POWERPC_TRUE@ src/powerpc/linux64_closure.lo -@@ -144,6 +146,7 @@ - @POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ - @POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo - @POWERPC_FREEBSD_TRUE@am__objects_17 = src/powerpc/ffi.lo \ -+@POWERPC_FREEBSD_TRUE@ src/powerpc/ffi_sysv.lo \ - @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ - @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo - @AARCH64_TRUE@am__objects_18 = src/aarch64/sysv.lo src/aarch64/ffi.lo -@@ -278,6 +281,7 @@ - FGREP = @FGREP@ - GREP = @GREP@ - HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -@@ -387,10 +391,12 @@ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ -- src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \ -- src/powerpc/linux64.S src/powerpc/linux64_closure.S \ -- src/powerpc/ppc_closure.S src/powerpc/asm.h \ -- src/powerpc/aix.S src/powerpc/darwin.S \ -+ src/m68k/ffitarget.h \ -+ src/powerpc/ffi.c src/powerpc/ffi_powerpc.h \ -+ src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \ -+ src/powerpc/sysv.S src/powerpc/linux64.S \ -+ src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ -+ src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ -@@ -711,6 +717,10 @@ - @: > src/powerpc/$(DEPDIR)/$(am__dirstamp) - src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -+src/powerpc/ffi_sysv.lo: src/powerpc/$(am__dirstamp) \ -+ src/powerpc/$(DEPDIR)/$(am__dirstamp) -+src/powerpc/ffi_linux64.lo: src/powerpc/$(am__dirstamp) \ -+ src/powerpc/$(DEPDIR)/$(am__dirstamp) - src/powerpc/sysv.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) - src/powerpc/ppc_closure.lo: src/powerpc/$(am__dirstamp) \ -@@ -912,6 +922,10 @@ - -rm -f src/powerpc/ffi.lo - -rm -f src/powerpc/ffi_darwin.$(OBJEXT) - -rm -f src/powerpc/ffi_darwin.lo -+ -rm -f src/powerpc/ffi_linux64.$(OBJEXT) -+ -rm -f src/powerpc/ffi_linux64.lo -+ -rm -f src/powerpc/ffi_sysv.$(OBJEXT) -+ -rm -f src/powerpc/ffi_sysv.lo - -rm -f src/powerpc/linux64.$(OBJEXT) - -rm -f src/powerpc/linux64.lo - -rm -f src/powerpc/linux64_closure.$(OBJEXT) -@@ -1009,6 +1023,8 @@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin_closure.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_darwin.Plo@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_linux64.Plo@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_sysv.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64_closure.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ppc_closure.Plo@am__quote@ -Index: libffi/include/ffi.h.in -=================================================================== ---- a/src/libffi/include/ffi.h.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/include/ffi.h.in (.../branches/gcc-4_8-branch) -@@ -207,6 +207,11 @@ - #endif - } ffi_cif; - -+#if HAVE_LONG_DOUBLE_VARIANT -+/* Used to adjust size/alignment of ffi types. */ -+void ffi_prep_types (ffi_abi abi); -+# endif -+ - /* Used internally, but overridden by some architectures */ - ffi_status ffi_prep_cif_core(ffi_cif *cif, - ffi_abi abi, -Index: libffi/include/Makefile.in -=================================================================== ---- a/src/libffi/include/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/include/Makefile.in (.../branches/gcc-4_8-branch) -@@ -113,6 +113,7 @@ - FGREP = @FGREP@ - GREP = @GREP@ - HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -Index: libffi/fficonfig.h.in -=================================================================== ---- a/src/libffi/fficonfig.h.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/fficonfig.h.in (.../branches/gcc-4_8-branch) -@@ -73,6 +73,9 @@ - /* Define if you have the long double type and it is bigger than a double */ - #undef HAVE_LONG_DOUBLE - -+/* Define if you support more than one size of the long double type */ -+#undef HAVE_LONG_DOUBLE_VARIANT -+ - /* Define to 1 if you have the `memcpy' function. */ - #undef HAVE_MEMCPY - -Index: libffi/src/powerpc/ppc_closure.S -=================================================================== ---- a/src/libffi/src/powerpc/ppc_closure.S (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ppc_closure.S (.../branches/gcc-4_8-branch) -@@ -31,7 +31,7 @@ - - .file "ppc_closure.S" - --#ifndef __powerpc64__ -+#ifndef POWERPC64 - - ENTRY(ffi_closure_SYSV) - .LFB1: -@@ -238,7 +238,7 @@ - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) - lwz %r5,112+8(%r1) -- bl .Luint128 -+ b .Luint128 - - # The return types below are only used when the ABI type is FFI_SYSV. - # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. -@@ -378,8 +378,7 @@ - .align 2 - .LEFDE1: - --#endif -- - #if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits - #endif -+#endif -Index: libffi/src/powerpc/ffitarget.h -=================================================================== ---- a/src/libffi/src/powerpc/ffitarget.h (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ffitarget.h (.../branches/gcc-4_8-branch) -@@ -60,45 +60,76 @@ - typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - --#ifdef POWERPC -- FFI_SYSV, -- FFI_GCC_SYSV, -- FFI_LINUX64, -- FFI_LINUX, -- FFI_LINUX_SOFT_FLOAT, --# if defined(POWERPC64) -- FFI_DEFAULT_ABI = FFI_LINUX64, --# elif defined(__NO_FPRS__) -- FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, --# elif (__LDBL_MANT_DIG__ == 106) -- FFI_DEFAULT_ABI = FFI_LINUX, --# else -- FFI_DEFAULT_ABI = FFI_GCC_SYSV, --# endif --#endif -- --#ifdef POWERPC_AIX -+#if defined (POWERPC_AIX) - FFI_AIX, - FFI_DARWIN, - FFI_DEFAULT_ABI = FFI_AIX, --#endif -+ FFI_LAST_ABI - --#ifdef POWERPC_DARWIN -+#elif defined (POWERPC_DARWIN) - FFI_AIX, - FFI_DARWIN, - FFI_DEFAULT_ABI = FFI_DARWIN, --#endif -+ FFI_LAST_ABI - --#ifdef POWERPC_FREEBSD -- FFI_SYSV, -- FFI_GCC_SYSV, -- FFI_LINUX64, -- FFI_LINUX, -- FFI_LINUX_SOFT_FLOAT, -- FFI_DEFAULT_ABI = FFI_SYSV, -+#else -+ /* The FFI_COMPAT values are used by old code. Since libffi may be -+ a shared library we have to support old values for backwards -+ compatibility. */ -+ FFI_COMPAT_SYSV, -+ FFI_COMPAT_GCC_SYSV, -+ FFI_COMPAT_LINUX64, -+ FFI_COMPAT_LINUX, -+ FFI_COMPAT_LINUX_SOFT_FLOAT, ++ PR libfortran/61310 ++ * intrinsics/ctime.c (strctime): Rename to gf_ctime, use snprintf ++ instead of strftime. ++ (fdate): Use gf_ctime. ++ (fdate_sub): Likewise. ++ (ctime): Likewise. ++ (ctime_sub): Likewise. + -+# if defined (POWERPC64) -+ /* This bit, always set in new code, must not be set in any of the -+ old FFI_COMPAT values that might be used for 64-bit linux. We -+ only need worry about FFI_COMPAT_LINUX64, but to be safe avoid -+ all old values. */ -+ FFI_LINUX = 8, -+ /* This and following bits can reuse FFI_COMPAT values. */ -+ FFI_LINUX_STRUCT_ALIGN = 1, -+ FFI_LINUX_LONG_DOUBLE_128 = 2, -+ FFI_DEFAULT_ABI = (FFI_LINUX -+# ifdef __STRUCT_PARM_ALIGN__ -+ | FFI_LINUX_STRUCT_ALIGN -+# endif -+# ifdef __LONG_DOUBLE_128__ -+ | FFI_LINUX_LONG_DOUBLE_128 -+# endif -+ ), -+ FFI_LAST_ABI = 12 ++2014-05-25 Janne Blomqvist <jb@gcc.gnu.org> + -+# else -+ /* This bit, always set in new code, must not be set in any of the -+ old FFI_COMPAT values that might be used for 32-bit linux/sysv/bsd. */ -+ FFI_SYSV = 8, -+ /* This and following bits can reuse FFI_COMPAT values. */ -+ FFI_SYSV_SOFT_FLOAT = 1, -+ FFI_SYSV_STRUCT_RET = 2, -+ FFI_SYSV_IBM_LONG_DOUBLE = 4, -+ FFI_SYSV_LONG_DOUBLE_128 = 16, ++ Backport from trunk. ++ PR libfortran/61187 ++ * io/unix.c (raw_close): Check if s->fd is -1. ++ (fd_to_stream): Check return value of fstat(), handle error. + -+ FFI_DEFAULT_ABI = (FFI_SYSV -+# ifdef __NO_FPRS__ -+ | FFI_SYSV_SOFT_FLOAT -+# endif -+# if (defined (__SVR4_STRUCT_RETURN) \ -+ || defined (POWERPC_FREEBSD) && !defined (__AIX_STRUCT_RETURN)) -+ | FFI_SYSV_STRUCT_RET -+# endif -+# if __LDBL_MANT_DIG__ == 106 -+ | FFI_SYSV_IBM_LONG_DOUBLE -+# endif -+# ifdef __LONG_DOUBLE_128__ -+ | FFI_SYSV_LONG_DOUBLE_128 -+# endif -+ ), -+ FFI_LAST_ABI = 32 -+# endif - #endif + 2014-05-22 Release Manager -- FFI_LAST_ABI - } ffi_abi; - #endif - -@@ -106,6 +137,10 @@ - - #define FFI_CLOSURES 1 - #define FFI_NATIVE_RAW_API 0 -+#if defined (POWERPC) || defined (POWERPC_FREEBSD) -+# define FFI_TARGET_SPECIFIC_VARIADIC 1 -+# define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs -+#endif - - /* For additional types like the below, take care about the order in - ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ -@@ -113,19 +148,26 @@ - /* Needed for soft-float long-double-128 support. */ - #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) - --/* Needed for FFI_SYSV small structure returns. -- We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are -- defined in ffi.c, to determine the exact return type and its size. */ -+/* Needed for FFI_SYSV small structure returns. */ - #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) - --#if defined(POWERPC64) || defined(POWERPC_AIX) -+/* Used by ELFv2 for homogenous structure returns. */ -+#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_TYPE_LAST + 1) -+#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_TYPE_LAST + 2) -+#define FFI_V2_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 3) -+ -+#if _CALL_ELF == 2 -+# define FFI_TRAMPOLINE_SIZE 32 -+#else -+# if defined(POWERPC64) || defined(POWERPC_AIX) - # if defined(POWERPC_DARWIN64) - # define FFI_TRAMPOLINE_SIZE 48 - # else - # define FFI_TRAMPOLINE_SIZE 24 - # endif --#else /* POWERPC || POWERPC_AIX */ -+# else /* POWERPC || POWERPC_AIX */ - # define FFI_TRAMPOLINE_SIZE 40 -+# endif - #endif - - #ifndef LIBFFI_ASM -Index: libffi/src/powerpc/ffi.c + * GCC 4.8.3 released. +Index: libgfortran/io/unix.c =================================================================== ---- a/src/libffi/src/powerpc/ffi.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ffi.c (.../branches/gcc-4_8-branch) -@@ -1,5 +1,6 @@ - /* ----------------------------------------------------------------------- -- ffi.c - Copyright (C) 2011 Anthony Green -+ ffi.c - Copyright (C) 2013 IBM -+ Copyright (C) 2011 Anthony Green - Copyright (C) 2011 Kyle Moffett - Copyright (C) 2008 Red Hat, Inc - Copyright (C) 2007, 2008 Free Software Foundation, Inc -@@ -27,966 +28,104 @@ - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - --#include <ffi.h> --#include <ffi_common.h> -+#include "ffi.h" -+#include "ffi_common.h" -+#include "ffi_powerpc.h" - --#include <stdlib.h> --#include <stdio.h> -- -- --extern void ffi_closure_SYSV (void); --extern void FFI_HIDDEN ffi_closure_LINUX64 (void); -- --enum { -- /* The assembly depends on these exact flags. */ -- FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ -- FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ --#ifndef __NO_FPRS__ -- FLAG_RETURNS_FP = 1 << (31-29), --#endif -- FLAG_RETURNS_64BITS = 1 << (31-28), -- -- FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ -- -- FLAG_ARG_NEEDS_COPY = 1 << (31- 7), --#ifndef __NO_FPRS__ -- FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ --#endif -- FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), -- FLAG_RETVAL_REFERENCE = 1 << (31- 4) --}; -- --/* About the SYSV ABI. */ --#define ASM_NEEDS_REGISTERS 4 --#define NUM_GPR_ARG_REGISTERS 8 --#ifndef __NO_FPRS__ --# define NUM_FPR_ARG_REGISTERS 8 --#endif -- --/* ffi_prep_args_SYSV is called by the assembly routine once stack space -- has been allocated for the function's arguments. -- -- The stack layout we want looks like this: -- -- | Return address from ffi_call_SYSV 4bytes | higher addresses -- |--------------------------------------------| -- | Previous backchain pointer 4 | stack pointer here -- |--------------------------------------------|<+ <<< on entry to -- | Saved r28-r31 4*4 | | ffi_call_SYSV -- |--------------------------------------------| | -- | GPR registers r3-r10 8*4 | | ffi_call_SYSV -- |--------------------------------------------| | -- | FPR registers f1-f8 (optional) 8*8 | | -- |--------------------------------------------| | stack | -- | Space for copied structures | | grows | -- |--------------------------------------------| | down V -- | Parameters that didn't fit in registers | | -- |--------------------------------------------| | lower addresses -- | Space for callee's LR 4 | | -- |--------------------------------------------| | stack pointer here -- | Current backchain pointer 4 |-/ during -- |--------------------------------------------| <<< ffi_call_SYSV -- --*/ -- --void --ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) -+#if HAVE_LONG_DOUBLE_VARIANT -+/* Adjust ffi_type_longdouble. */ -+void FFI_HIDDEN -+ffi_prep_types (ffi_abi abi) +--- a/src/libgfortran/io/unix.c (.../tags/gcc_4_8_3_release) ++++ b/src/libgfortran/io/unix.c (.../branches/gcc-4_8-branch) +@@ -407,7 +407,9 @@ { -- const unsigned bytes = ecif->cif->bytes; -- const unsigned flags = ecif->cif->flags; -- -- typedef union { -- char *c; -- unsigned *u; -- long long *ll; -- float *f; -- double *d; -- } valp; -- -- /* 'stacktop' points at the previous backchain pointer. */ -- valp stacktop; -- -- /* 'gpr_base' points at the space for gpr3, and grows upwards as -- we use GPR registers. */ -- valp gpr_base; -- int intarg_count; -- --#ifndef __NO_FPRS__ -- /* 'fpr_base' points at the space for fpr1, and grows upwards as -- we use FPR registers. */ -- valp fpr_base; -- int fparg_count; --#endif -- -- /* 'copy_space' grows down as we put structures in it. It should -- stay 16-byte aligned. */ -- valp copy_space; -- -- /* 'next_arg' grows up as we put parameters in it. */ -- valp next_arg; -- -- int i; -- ffi_type **ptr; --#ifndef __NO_FPRS__ -- double double_tmp; --#endif -- union { -- void **v; -- char **c; -- signed char **sc; -- unsigned char **uc; -- signed short **ss; -- unsigned short **us; -- unsigned int **ui; -- long long **ll; -- float **f; -- double **d; -- } p_argv; -- size_t struct_copy_size; -- unsigned gprvalue; -- -- stacktop.c = (char *) stack + bytes; -- gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; -- intarg_count = 0; --#ifndef __NO_FPRS__ -- fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; -- fparg_count = 0; -- copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); --#else -- copy_space.c = gpr_base.c; --#endif -- next_arg.u = stack + 2; -- -- /* Check that everything starts aligned properly. */ -- FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); -- FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); -- FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); -- FFI_ASSERT ((bytes & 0xF) == 0); -- FFI_ASSERT (copy_space.c >= next_arg.c); -- -- /* Deal with return values that are actually pass-by-reference. */ -- if (flags & FLAG_RETVAL_REFERENCE) -- { -- *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; -- intarg_count++; -- } -- -- /* Now for the arguments. */ -- p_argv.v = ecif->avalue; -- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; -- i > 0; -- i--, ptr++, p_argv.v++) -- { -- unsigned short typenum = (*ptr)->type; -- -- /* We may need to handle some values depending on ABI */ -- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { -- if (typenum == FFI_TYPE_FLOAT) -- typenum = FFI_TYPE_UINT32; -- if (typenum == FFI_TYPE_DOUBLE) -- typenum = FFI_TYPE_UINT64; -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_UINT128; -- } else if (ecif->cif->abi != FFI_LINUX) { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_STRUCT; --#endif -- } -- -- /* Now test the translated value */ -- switch (typenum) { --#ifndef __NO_FPRS__ -- case FFI_TYPE_FLOAT: -- /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ -- double_tmp = **p_argv.f; -- if (fparg_count >= NUM_FPR_ARG_REGISTERS) -- { -- *next_arg.f = (float) double_tmp; -- next_arg.u += 1; -- intarg_count++; -- } -- else -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; -- -- case FFI_TYPE_DOUBLE: -- /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ -- double_tmp = **p_argv.d; -- -- if (fparg_count >= NUM_FPR_ARG_REGISTERS) -- { -- if (intarg_count >= NUM_GPR_ARG_REGISTERS -- && intarg_count % 2 != 0) -- { -- intarg_count++; -- next_arg.u++; -- } -- *next_arg.d = double_tmp; -- next_arg.u += 2; -- } -- else -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; -- --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- double_tmp = (*p_argv.d)[0]; -- -- if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) -- { -- if (intarg_count >= NUM_GPR_ARG_REGISTERS -- && intarg_count % 2 != 0) -- { -- intarg_count++; -- next_arg.u++; -- } -- *next_arg.d = double_tmp; -- next_arg.u += 2; -- double_tmp = (*p_argv.d)[1]; -- *next_arg.d = double_tmp; -- next_arg.u += 2; -- } -- else -- { -- *fpr_base.d++ = double_tmp; -- double_tmp = (*p_argv.d)[1]; -- *fpr_base.d++ = double_tmp; -- } -- -- fparg_count += 2; -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; --#endif --#endif /* have FPRs */ -- -- /* -- * The soft float ABI for long doubles works like this, a long double -- * is passed in four consecutive GPRs if available. A maximum of 2 -- * long doubles can be passed in gprs. If we do not have 4 GPRs -- * left, the long double is passed on the stack, 4-byte aligned. -- */ -- case FFI_TYPE_UINT128: { -- unsigned int int_tmp = (*p_argv.ui)[0]; -- unsigned int ii; -- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { -- if (intarg_count < NUM_GPR_ARG_REGISTERS) -- intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; -- *(next_arg.u++) = int_tmp; -- for (ii = 1; ii < 4; ii++) { -- int_tmp = (*p_argv.ui)[ii]; -- *(next_arg.u++) = int_tmp; -- } -- } else { -- *(gpr_base.u++) = int_tmp; -- for (ii = 1; ii < 4; ii++) { -- int_tmp = (*p_argv.ui)[ii]; -- *(gpr_base.u++) = int_tmp; -- } -- } -- intarg_count += 4; -- break; -- } -- -- case FFI_TYPE_UINT64: -- case FFI_TYPE_SINT64: -- if (intarg_count == NUM_GPR_ARG_REGISTERS-1) -- intarg_count++; -- if (intarg_count >= NUM_GPR_ARG_REGISTERS) -- { -- if (intarg_count % 2 != 0) -- { -- intarg_count++; -- next_arg.u++; -- } -- *next_arg.ll = **p_argv.ll; -- next_arg.u += 2; -- } -- else -- { -- /* whoops: abi states only certain register pairs -- * can be used for passing long long int -- * specifically (r3,r4), (r5,r6), (r7,r8), -- * (r9,r10) and if next arg is long long but -- * not correct starting register of pair then skip -- * until the proper starting register -- */ -- if (intarg_count % 2 != 0) -- { -- intarg_count ++; -- gpr_base.u++; -- } -- *gpr_base.ll++ = **p_argv.ll; -- } -- intarg_count += 2; -- break; -- -- case FFI_TYPE_STRUCT: -- struct_copy_size = ((*ptr)->size + 15) & ~0xF; -- copy_space.c -= struct_copy_size; -- memcpy (copy_space.c, *p_argv.c, (*ptr)->size); -- -- gprvalue = (unsigned long) copy_space.c; -- -- FFI_ASSERT (copy_space.c > next_arg.c); -- FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); -- goto putgpr; -- -- case FFI_TYPE_UINT8: -- gprvalue = **p_argv.uc; -- goto putgpr; -- case FFI_TYPE_SINT8: -- gprvalue = **p_argv.sc; -- goto putgpr; -- case FFI_TYPE_UINT16: -- gprvalue = **p_argv.us; -- goto putgpr; -- case FFI_TYPE_SINT16: -- gprvalue = **p_argv.ss; -- goto putgpr; -- -- case FFI_TYPE_INT: -- case FFI_TYPE_UINT32: -- case FFI_TYPE_SINT32: -- case FFI_TYPE_POINTER: -- -- gprvalue = **p_argv.ui; -- -- putgpr: -- if (intarg_count >= NUM_GPR_ARG_REGISTERS) -- *next_arg.u++ = gprvalue; -- else -- *gpr_base.u++ = gprvalue; -- intarg_count++; -- break; -- } -- } -- -- /* Check that we didn't overrun the stack... */ -- FFI_ASSERT (copy_space.c >= next_arg.c); -- FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); --#ifndef __NO_FPRS__ -- FFI_ASSERT (fpr_base.u -- <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); --#endif -- FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); -+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+# ifdef POWERPC64 -+ ffi_prep_types_linux64 (abi); -+# else -+ ffi_prep_types_sysv (abi); -+# endif -+# endif - } -- --/* About the LINUX64 ABI. */ --enum { -- NUM_GPR_ARG_REGISTERS64 = 8, -- NUM_FPR_ARG_REGISTERS64 = 13 --}; --enum { ASM_NEEDS_REGISTERS64 = 4 }; -- --/* ffi_prep_args64 is called by the assembly routine once stack space -- has been allocated for the function's arguments. -- -- The stack layout we want looks like this: -- -- | Ret addr from ffi_call_LINUX64 8bytes | higher addresses -- |--------------------------------------------| -- | CR save area 8bytes | -- |--------------------------------------------| -- | Previous backchain pointer 8 | stack pointer here -- |--------------------------------------------|<+ <<< on entry to -- | Saved r28-r31 4*8 | | ffi_call_LINUX64 -- |--------------------------------------------| | -- | GPR registers r3-r10 8*8 | | -- |--------------------------------------------| | -- | FPR registers f1-f13 (optional) 13*8 | | -- |--------------------------------------------| | -- | Parameter save area | | -- |--------------------------------------------| | -- | TOC save area 8 | | -- |--------------------------------------------| | stack | -- | Linker doubleword 8 | | grows | -- |--------------------------------------------| | down V -- | Compiler doubleword 8 | | -- |--------------------------------------------| | lower addresses -- | Space for callee's LR 8 | | -- |--------------------------------------------| | -- | CR save area 8 | | -- |--------------------------------------------| | stack pointer here -- | Current backchain pointer 8 |-/ during -- |--------------------------------------------| <<< ffi_call_LINUX64 -- --*/ -- --void FFI_HIDDEN --ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) --{ -- const unsigned long bytes = ecif->cif->bytes; -- const unsigned long flags = ecif->cif->flags; -- -- typedef union { -- char *c; -- unsigned long *ul; -- float *f; -- double *d; -- } valp; -- -- /* 'stacktop' points at the previous backchain pointer. */ -- valp stacktop; -- -- /* 'next_arg' points at the space for gpr3, and grows upwards as -- we use GPR registers, then continues at rest. */ -- valp gpr_base; -- valp gpr_end; -- valp rest; -- valp next_arg; -- -- /* 'fpr_base' points at the space for fpr3, and grows upwards as -- we use FPR registers. */ -- valp fpr_base; -- int fparg_count; -- -- int i, words; -- ffi_type **ptr; -- double double_tmp; -- union { -- void **v; -- char **c; -- signed char **sc; -- unsigned char **uc; -- signed short **ss; -- unsigned short **us; -- signed int **si; -- unsigned int **ui; -- unsigned long **ul; -- float **f; -- double **d; -- } p_argv; -- unsigned long gprvalue; -- -- stacktop.c = (char *) stack + bytes; -- gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; -- gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; -- rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; -- fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; -- fparg_count = 0; -- next_arg.ul = gpr_base.ul; -- -- /* Check that everything starts aligned properly. */ -- FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); -- FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); -- FFI_ASSERT ((bytes & 0xF) == 0); -- -- /* Deal with return values that are actually pass-by-reference. */ -- if (flags & FLAG_RETVAL_REFERENCE) -- *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; -- -- /* Now for the arguments. */ -- p_argv.v = ecif->avalue; -- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; -- i > 0; -- i--, ptr++, p_argv.v++) -- { -- switch ((*ptr)->type) -- { -- case FFI_TYPE_FLOAT: -- double_tmp = **p_argv.f; -- *next_arg.f = (float) double_tmp; -- if (++next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- if (fparg_count < NUM_FPR_ARG_REGISTERS64) -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; -- -- case FFI_TYPE_DOUBLE: -- double_tmp = **p_argv.d; -- *next_arg.d = double_tmp; -- if (++next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- if (fparg_count < NUM_FPR_ARG_REGISTERS64) -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; -- --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- double_tmp = (*p_argv.d)[0]; -- *next_arg.d = double_tmp; -- if (++next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- if (fparg_count < NUM_FPR_ARG_REGISTERS64) -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- double_tmp = (*p_argv.d)[1]; -- *next_arg.d = double_tmp; -- if (++next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- if (fparg_count < NUM_FPR_ARG_REGISTERS64) -- *fpr_base.d++ = double_tmp; -- fparg_count++; -- FFI_ASSERT (__LDBL_MANT_DIG__ == 106); -- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -- break; - #endif - -- case FFI_TYPE_STRUCT: -- words = ((*ptr)->size + 7) / 8; -- if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) -- { -- size_t first = gpr_end.c - next_arg.c; -- memcpy (next_arg.c, *p_argv.c, first); -- memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); -- next_arg.c = rest.c + words * 8 - first; -- } -- else -- { -- char *where = next_arg.c; -- --#ifndef __LITTLE_ENDIAN__ -- /* Structures with size less than eight bytes are passed -- left-padded. */ -- if ((*ptr)->size < 8) -- where += 8 - (*ptr)->size; --#endif -- memcpy (where, *p_argv.c, (*ptr)->size); -- next_arg.ul += words; -- if (next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- } -- break; -- -- case FFI_TYPE_UINT8: -- gprvalue = **p_argv.uc; -- goto putgpr; -- case FFI_TYPE_SINT8: -- gprvalue = **p_argv.sc; -- goto putgpr; -- case FFI_TYPE_UINT16: -- gprvalue = **p_argv.us; -- goto putgpr; -- case FFI_TYPE_SINT16: -- gprvalue = **p_argv.ss; -- goto putgpr; -- case FFI_TYPE_UINT32: -- gprvalue = **p_argv.ui; -- goto putgpr; -- case FFI_TYPE_INT: -- case FFI_TYPE_SINT32: -- gprvalue = **p_argv.si; -- goto putgpr; -- -- case FFI_TYPE_UINT64: -- case FFI_TYPE_SINT64: -- case FFI_TYPE_POINTER: -- gprvalue = **p_argv.ul; -- putgpr: -- *next_arg.ul++ = gprvalue; -- if (next_arg.ul == gpr_end.ul) -- next_arg.ul = rest.ul; -- break; -- } -- } -- -- FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS -- || (next_arg.ul >= gpr_base.ul -- && next_arg.ul <= gpr_base.ul + 4)); --} -- -- -- - /* Perform machine dependent cif processing */ --ffi_status -+ffi_status FFI_HIDDEN - ffi_prep_cif_machdep (ffi_cif *cif) - { -- /* All this is for the SYSV and LINUX64 ABI. */ -- int i; -- ffi_type **ptr; -- unsigned bytes; -- int fparg_count = 0, intarg_count = 0; -- unsigned flags = 0; -- unsigned struct_copy_size = 0; -- unsigned type = cif->rtype->type; -- unsigned size = cif->rtype->size; -- -- if (cif->abi != FFI_LINUX64) -- { -- /* All the machine-independent calculation of cif->bytes will be wrong. -- Redo the calculation for SYSV. */ -- -- /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ -- bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); -- -- /* Space for the GPR registers. */ -- bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); -- } -- else -- { -- /* 64-bit ABI. */ -- -- /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp -- regs. */ -- bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); -- -- /* Space for the mandatory parm save area and general registers. */ -- bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); -- } -- -- /* Return value handling. The rules for SYSV are as follows: -- - 32-bit (or less) integer values are returned in gpr3; -- - Structures of size <= 4 bytes also returned in gpr3; -- - 64-bit integer values and structures between 5 and 8 bytes are returned -- in gpr3 and gpr4; -- - Single/double FP values are returned in fpr1; -- - Larger structures are allocated space and a pointer is passed as -- the first argument. -- - long doubles (if not equivalent to double) are returned in -- fpr1,fpr2 for Linux and as for large structs for SysV. -- For LINUX64: -- - integer values in gpr3; -- - Structures/Unions by reference; -- - Single/double FP values in fpr1, long double in fpr1,fpr2. -- - soft-float float/doubles are treated as UINT32/UINT64 respectivley. -- - soft-float long doubles are returned in gpr3-gpr6. */ -- /* First translate for softfloat/nonlinux */ -- if (cif->abi == FFI_LINUX_SOFT_FLOAT) { -- if (type == FFI_TYPE_FLOAT) -- type = FFI_TYPE_UINT32; -- if (type == FFI_TYPE_DOUBLE) -- type = FFI_TYPE_UINT64; -- if (type == FFI_TYPE_LONGDOUBLE) -- type = FFI_TYPE_UINT128; -- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- if (type == FFI_TYPE_LONGDOUBLE) -- type = FFI_TYPE_STRUCT; -+#ifdef POWERPC64 -+ return ffi_prep_cif_linux64 (cif); -+#else -+ return ffi_prep_cif_sysv (cif); - #endif -- } -+} - -- switch (type) -- { --#ifndef __NO_FPRS__ --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- flags |= FLAG_RETURNS_128BITS; -- /* Fall through. */ -+ffi_status FFI_HIDDEN -+ffi_prep_cif_machdep_var (ffi_cif *cif, -+ unsigned int nfixedargs MAYBE_UNUSED, -+ unsigned int ntotalargs MAYBE_UNUSED) -+{ -+#ifdef POWERPC64 -+ return ffi_prep_cif_linux64_var (cif, nfixedargs, ntotalargs); -+#else -+ return ffi_prep_cif_sysv (cif); - #endif -- case FFI_TYPE_DOUBLE: -- flags |= FLAG_RETURNS_64BITS; -- /* Fall through. */ -- case FFI_TYPE_FLOAT: -- flags |= FLAG_RETURNS_FP; -- break; --#endif -- -- case FFI_TYPE_UINT128: -- flags |= FLAG_RETURNS_128BITS; -- /* Fall through. */ -- case FFI_TYPE_UINT64: -- case FFI_TYPE_SINT64: -- flags |= FLAG_RETURNS_64BITS; -- break; -- -- case FFI_TYPE_STRUCT: -- /* -- * The final SYSV ABI says that structures smaller or equal 8 bytes -- * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them -- * in memory. -- * -- * NOTE: The assembly code can safely assume that it just needs to -- * store both r3 and r4 into a 8-byte word-aligned buffer, as -- * we allocate a temporary buffer in ffi_call() if this flag is -- * set. -- */ -- if (cif->abi == FFI_SYSV && size <= 8) -- flags |= FLAG_RETURNS_SMST; -- intarg_count++; -- flags |= FLAG_RETVAL_REFERENCE; -- /* Fall through. */ -- case FFI_TYPE_VOID: -- flags |= FLAG_RETURNS_NOTHING; -- break; -- -- default: -- /* Returns 32-bit integer, or similar. Nothing to do here. */ -- break; -- } -- -- if (cif->abi != FFI_LINUX64) -- /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the -- first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest -- goes on the stack. Structures and long doubles (if not equivalent -- to double) are passed as a pointer to a copy of the structure. -- Stuff on the stack needs to keep proper alignment. */ -- for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) -- { -- unsigned short typenum = (*ptr)->type; -- -- /* We may need to handle some values depending on ABI */ -- if (cif->abi == FFI_LINUX_SOFT_FLOAT) { -- if (typenum == FFI_TYPE_FLOAT) -- typenum = FFI_TYPE_UINT32; -- if (typenum == FFI_TYPE_DOUBLE) -- typenum = FFI_TYPE_UINT64; -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_UINT128; -- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_STRUCT; --#endif -- } -- -- switch (typenum) { --#ifndef __NO_FPRS__ -- case FFI_TYPE_FLOAT: -- fparg_count++; -- /* floating singles are not 8-aligned on stack */ -- break; -- --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- fparg_count++; -- /* Fall thru */ --#endif -- case FFI_TYPE_DOUBLE: -- fparg_count++; -- /* If this FP arg is going on the stack, it must be -- 8-byte-aligned. */ -- if (fparg_count > NUM_FPR_ARG_REGISTERS -- && intarg_count >= NUM_GPR_ARG_REGISTERS -- && intarg_count % 2 != 0) -- intarg_count++; -- break; --#endif -- case FFI_TYPE_UINT128: -- /* -- * A long double in FFI_LINUX_SOFT_FLOAT can use only a set -- * of four consecutive gprs. If we do not have enough, we -- * have to adjust the intarg_count value. -- */ -- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 -- && intarg_count < NUM_GPR_ARG_REGISTERS) -- intarg_count = NUM_GPR_ARG_REGISTERS; -- intarg_count += 4; -- break; -- -- case FFI_TYPE_UINT64: -- case FFI_TYPE_SINT64: -- /* 'long long' arguments are passed as two words, but -- either both words must fit in registers or both go -- on the stack. If they go on the stack, they must -- be 8-byte-aligned. -- -- Also, only certain register pairs can be used for -- passing long long int -- specifically (r3,r4), (r5,r6), -- (r7,r8), (r9,r10). -- */ -- if (intarg_count == NUM_GPR_ARG_REGISTERS-1 -- || intarg_count % 2 != 0) -- intarg_count++; -- intarg_count += 2; -- break; -- -- case FFI_TYPE_STRUCT: -- /* We must allocate space for a copy of these to enforce -- pass-by-value. Pad the space up to a multiple of 16 -- bytes (the maximum alignment required for anything under -- the SYSV ABI). */ -- struct_copy_size += ((*ptr)->size + 15) & ~0xF; -- /* Fall through (allocate space for the pointer). */ -- -- case FFI_TYPE_POINTER: -- case FFI_TYPE_INT: -- case FFI_TYPE_UINT32: -- case FFI_TYPE_SINT32: -- case FFI_TYPE_UINT16: -- case FFI_TYPE_SINT16: -- case FFI_TYPE_UINT8: -- case FFI_TYPE_SINT8: -- /* Everything else is passed as a 4-byte word in a GPR, either -- the object itself or a pointer to it. */ -- intarg_count++; -- break; -- default: -- FFI_ASSERT (0); -- } -- } -- else -- for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) -- { -- switch ((*ptr)->type) -- { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- if (cif->abi == FFI_LINUX_SOFT_FLOAT) -- intarg_count += 4; -- else -- { -- fparg_count += 2; -- intarg_count += 2; -- } -- break; --#endif -- case FFI_TYPE_FLOAT: -- case FFI_TYPE_DOUBLE: -- fparg_count++; -- intarg_count++; -- break; -- -- case FFI_TYPE_STRUCT: -- intarg_count += ((*ptr)->size + 7) / 8; -- break; -- -- case FFI_TYPE_POINTER: -- case FFI_TYPE_UINT64: -- case FFI_TYPE_SINT64: -- case FFI_TYPE_INT: -- case FFI_TYPE_UINT32: -- case FFI_TYPE_SINT32: -- case FFI_TYPE_UINT16: -- case FFI_TYPE_SINT16: -- case FFI_TYPE_UINT8: -- case FFI_TYPE_SINT8: -- /* Everything else is passed as a 8-byte word in a GPR, either -- the object itself or a pointer to it. */ -- intarg_count++; -- break; -- default: -- FFI_ASSERT (0); -- } -- } -- --#ifndef __NO_FPRS__ -- if (fparg_count != 0) -- flags |= FLAG_FP_ARGUMENTS; --#endif -- if (intarg_count > 4) -- flags |= FLAG_4_GPR_ARGUMENTS; -- if (struct_copy_size != 0) -- flags |= FLAG_ARG_NEEDS_COPY; -- -- if (cif->abi != FFI_LINUX64) -- { --#ifndef __NO_FPRS__ -- /* Space for the FPR registers, if needed. */ -- if (fparg_count != 0) -- bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); --#endif -- -- /* Stack space. */ -- if (intarg_count > NUM_GPR_ARG_REGISTERS) -- bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); --#ifndef __NO_FPRS__ -- if (fparg_count > NUM_FPR_ARG_REGISTERS) -- bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); --#endif -- } -- else -- { --#ifndef __NO_FPRS__ -- /* Space for the FPR registers, if needed. */ -- if (fparg_count != 0) -- bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); --#endif -- -- /* Stack space. */ -- if (intarg_count > NUM_GPR_ARG_REGISTERS64) -- bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); -- } -- -- /* The stack space allocated needs to be a multiple of 16 bytes. */ -- bytes = (bytes + 15) & ~0xF; -- -- /* Add in the space for the copied structures. */ -- bytes += struct_copy_size; -- -- cif->flags = flags; -- cif->bytes = bytes; -- -- return FFI_OK; - } - --extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, -- void (*fn)(void)); --extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, -- unsigned long, unsigned long *, -- void (*fn)(void)); -- - void - ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) - { -- /* -- * The final SYSV ABI says that structures smaller or equal 8 bytes -- * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them -- * in memory. -- * -- * Just to keep things simple for the assembly code, we will always -- * bounce-buffer struct return values less than or equal to 8 bytes. -- * This allows the ASM to handle SYSV small structures by directly -- * writing r3 and r4 to memory without worrying about struct size. -- */ -- unsigned int smst_buffer[2]; -+ /* The final SYSV ABI says that structures smaller or equal 8 bytes -+ are returned in r3/r4. A draft ABI used by linux instead returns -+ them in memory. -+ -+ We bounce-buffer SYSV small struct return values so that sysv.S -+ can write r3 and r4 to memory without worrying about struct size. -+ -+ For ELFv2 ABI, use a bounce buffer for homogeneous structs too, -+ for similar reasons. */ -+ unsigned long smst_buffer[8]; - extended_cif ecif; -- unsigned int rsize = 0; - - ecif.cif = cif; - ecif.avalue = avalue; - -- /* Ensure that we have a valid struct return value */ - ecif.rvalue = rvalue; -- if (cif->rtype->type == FFI_TYPE_STRUCT) { -- rsize = cif->rtype->size; -- if (rsize <= 8) -- ecif.rvalue = smst_buffer; -- else if (!rvalue) -- ecif.rvalue = alloca(rsize); -- } -+ if ((cif->flags & FLAG_RETURNS_SMST) != 0) -+ ecif.rvalue = smst_buffer; -+ /* Ensure that we have a valid struct return value. -+ FIXME: Isn't this just papering over a user problem? */ -+ else if (!rvalue && cif->rtype->type == FFI_TYPE_STRUCT) -+ ecif.rvalue = alloca (cif->rtype->size); - -- switch (cif->abi) -- { --#ifndef POWERPC64 --# ifndef __NO_FPRS__ -- case FFI_SYSV: -- case FFI_GCC_SYSV: -- case FFI_LINUX: --# endif -- case FFI_LINUX_SOFT_FLOAT: -- ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); -- break; -+#ifdef POWERPC64 -+ ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); - #else -- case FFI_LINUX64: -- ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); -- break; -+ ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); - #endif -- default: -- FFI_ASSERT (0); -- break; -- } - - /* Check for a bounce-buffered return value */ - if (rvalue && ecif.rvalue == smst_buffer) -- memcpy(rvalue, smst_buffer, rsize); -+ { -+ unsigned int rsize = cif->rtype->size; -+#ifndef __LITTLE_ENDIAN__ -+ /* The SYSV ABI returns a structure of up to 4 bytes in size -+ left-padded in r3. */ -+# ifndef POWERPC64 -+ if (rsize <= 4) -+ memcpy (rvalue, (char *) smst_buffer + 4 - rsize, rsize); -+ else -+# endif -+ /* The SYSV ABI returns a structure of up to 8 bytes in size -+ left-padded in r3/r4, and the ELFv2 ABI similarly returns a -+ structure of up to 8 bytes in size left-padded in r3. */ -+ if (rsize <= 8) -+ memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize); -+ else -+#endif -+ memcpy (rvalue, smst_buffer, rsize); -+ } - } - - --#ifndef POWERPC64 --#define MIN_CACHE_LINE_SIZE 8 -- --static void --flush_icache (char *wraddr, char *xaddr, int size) --{ -- int i; -- for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) -- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" -- : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); -- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" -- : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) -- : "memory"); --} --#endif -- - ffi_status - ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, -@@ -995,487 +134,8 @@ - void *codeloc) - { - #ifdef POWERPC64 -- void **tramp = (void **) &closure->tramp[0]; -- -- if (cif->abi != FFI_LINUX64) -- return FFI_BAD_ABI; -- /* Copy function address and TOC from ffi_closure_LINUX64. */ -- memcpy (tramp, (char *) ffi_closure_LINUX64, 16); -- tramp[2] = codeloc; -+ return ffi_prep_closure_loc_linux64 (closure, cif, fun, user_data, codeloc); - #else -- unsigned int *tramp; -- -- if (! (cif->abi == FFI_GCC_SYSV -- || cif->abi == FFI_SYSV -- || cif->abi == FFI_LINUX -- || cif->abi == FFI_LINUX_SOFT_FLOAT)) -- return FFI_BAD_ABI; -- -- tramp = (unsigned int *) &closure->tramp[0]; -- tramp[0] = 0x7c0802a6; /* mflr r0 */ -- tramp[1] = 0x4800000d; /* bl 10 <trampoline_initial+0x10> */ -- tramp[4] = 0x7d6802a6; /* mflr r11 */ -- tramp[5] = 0x7c0803a6; /* mtlr r0 */ -- tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ -- tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ -- tramp[8] = 0x7c0903a6; /* mtctr r0 */ -- tramp[9] = 0x4e800420; /* bctr */ -- *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */ -- *(void **) &tramp[3] = codeloc; /* context */ -- -- /* Flush the icache. */ -- flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); -+ return ffi_prep_closure_loc_sysv (closure, cif, fun, user_data, codeloc); - #endif -- -- closure->cif = cif; -- closure->fun = fun; -- closure->user_data = user_data; -- -- return FFI_OK; - } -- --typedef union --{ -- float f; -- double d; --} ffi_dblfl; -- --int ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *, -- ffi_dblfl *, unsigned long *); -- --/* Basically the trampoline invokes ffi_closure_SYSV, and on -- * entry, r11 holds the address of the closure. -- * After storing the registers that could possibly contain -- * parameters to be passed into the stack frame and setting -- * up space for a return value, ffi_closure_SYSV invokes the -- * following helper function to do most of the work -- */ -- --int --ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, -- unsigned long *pgr, ffi_dblfl *pfr, -- unsigned long *pst) --{ -- /* rvalue is the pointer to space for return value in closure assembly */ -- /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ -- /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ -- /* pst is the pointer to outgoing parameter stack in original caller */ -- -- void ** avalue; -- ffi_type ** arg_types; -- long i, avn; --#ifndef __NO_FPRS__ -- long nf = 0; /* number of floating registers already used */ --#endif -- long ng = 0; /* number of general registers already used */ -- -- ffi_cif *cif = closure->cif; -- unsigned size = cif->rtype->size; -- unsigned short rtypenum = cif->rtype->type; -- -- avalue = alloca (cif->nargs * sizeof (void *)); -- -- /* First translate for softfloat/nonlinux */ -- if (cif->abi == FFI_LINUX_SOFT_FLOAT) { -- if (rtypenum == FFI_TYPE_FLOAT) -- rtypenum = FFI_TYPE_UINT32; -- if (rtypenum == FFI_TYPE_DOUBLE) -- rtypenum = FFI_TYPE_UINT64; -- if (rtypenum == FFI_TYPE_LONGDOUBLE) -- rtypenum = FFI_TYPE_UINT128; -- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- if (rtypenum == FFI_TYPE_LONGDOUBLE) -- rtypenum = FFI_TYPE_STRUCT; --#endif -- } -- -- -- /* Copy the caller's structure return value address so that the closure -- returns the data directly to the caller. -- For FFI_SYSV the result is passed in r3/r4 if the struct size is less -- or equal 8 bytes. */ -- if (rtypenum == FFI_TYPE_STRUCT && ((cif->abi != FFI_SYSV) || (size > 8))) { -- rvalue = (void *) *pgr; -- ng++; -- pgr++; -- } -- -- i = 0; -- avn = cif->nargs; -- arg_types = cif->arg_types; -- -- /* Grab the addresses of the arguments from the stack frame. */ -- while (i < avn) { -- unsigned short typenum = arg_types[i]->type; -- -- /* We may need to handle some values depending on ABI */ -- if (cif->abi == FFI_LINUX_SOFT_FLOAT) { -- if (typenum == FFI_TYPE_FLOAT) -- typenum = FFI_TYPE_UINT32; -- if (typenum == FFI_TYPE_DOUBLE) -- typenum = FFI_TYPE_UINT64; -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_UINT128; -- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) { --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- if (typenum == FFI_TYPE_LONGDOUBLE) -- typenum = FFI_TYPE_STRUCT; --#endif -- } -- -- switch (typenum) { --#ifndef __NO_FPRS__ -- case FFI_TYPE_FLOAT: -- /* unfortunately float values are stored as doubles -- * in the ffi_closure_SYSV code (since we don't check -- * the type in that routine). -- */ -- -- /* there are 8 64bit floating point registers */ -- -- if (nf < 8) -- { -- double temp = pfr->d; -- pfr->f = (float) temp; -- avalue[i] = pfr; -- nf++; -- pfr++; -- } -- else -- { -- /* FIXME? here we are really changing the values -- * stored in the original calling routines outgoing -- * parameter stack. This is probably a really -- * naughty thing to do but... -- */ -- avalue[i] = pst; -- pst += 1; -- } -- break; -- -- case FFI_TYPE_DOUBLE: -- /* On the outgoing stack all values are aligned to 8 */ -- /* there are 8 64bit floating point registers */ -- -- if (nf < 8) -- { -- avalue[i] = pfr; -- nf++; -- pfr++; -- } -- else -- { -- if (((long) pst) & 4) -- pst++; -- avalue[i] = pst; -- pst += 2; -- } -- break; -- --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- if (nf < 7) -- { -- avalue[i] = pfr; -- pfr += 2; -- nf += 2; -- } -- else -- { -- if (((long) pst) & 4) -- pst++; -- avalue[i] = pst; -- pst += 4; -- nf = 8; -- } -- break; --#endif --#endif /* have FPRS */ -- -- case FFI_TYPE_UINT128: -- /* -- * Test if for the whole long double, 4 gprs are available. -- * otherwise the stuff ends up on the stack. -- */ -- if (ng < 5) { -- avalue[i] = pgr; -- pgr += 4; -- ng += 4; -- } else { -- avalue[i] = pst; -- pst += 4; -- ng = 8+4; -- } -- break; -- -- case FFI_TYPE_SINT8: -- case FFI_TYPE_UINT8: --#ifndef __LITTLE_ENDIAN__ -- /* there are 8 gpr registers used to pass values */ -- if (ng < 8) -- { -- avalue[i] = (char *) pgr + 3; -- ng++; -- pgr++; -- } -- else -- { -- avalue[i] = (char *) pst + 3; -- pst++; -- } -- break; --#endif -- case FFI_TYPE_SINT16: -- case FFI_TYPE_UINT16: --#ifndef __LITTLE_ENDIAN__ -- /* there are 8 gpr registers used to pass values */ -- if (ng < 8) -- { -- avalue[i] = (char *) pgr + 2; -- ng++; -- pgr++; -- } -- else -- { -- avalue[i] = (char *) pst + 2; -- pst++; -- } -- break; --#endif -- case FFI_TYPE_SINT32: -- case FFI_TYPE_UINT32: -- case FFI_TYPE_POINTER: -- /* there are 8 gpr registers used to pass values */ -- if (ng < 8) -- { -- avalue[i] = pgr; -- ng++; -- pgr++; -- } -- else -- { -- avalue[i] = pst; -- pst++; -- } -- break; -- -- case FFI_TYPE_STRUCT: -- /* Structs are passed by reference. The address will appear in a -- gpr if it is one of the first 8 arguments. */ -- if (ng < 8) -- { -- avalue[i] = (void *) *pgr; -- ng++; -- pgr++; -- } -- else -- { -- avalue[i] = (void *) *pst; -- pst++; -- } -- break; -- -- case FFI_TYPE_SINT64: -- case FFI_TYPE_UINT64: -- /* passing long long ints are complex, they must -- * be passed in suitable register pairs such as -- * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) -- * and if the entire pair aren't available then the outgoing -- * parameter stack is used for both but an alignment of 8 -- * must will be kept. So we must either look in pgr -- * or pst to find the correct address for this type -- * of parameter. -- */ -- if (ng < 7) -- { -- if (ng & 0x01) -- { -- /* skip r4, r6, r8 as starting points */ -- ng++; -- pgr++; -- } -- avalue[i] = pgr; -- ng += 2; -- pgr += 2; -- } -- else -- { -- if (((long) pst) & 4) -- pst++; -- avalue[i] = pst; -- pst += 2; -- ng = 8; -- } -- break; -- -- default: -- FFI_ASSERT (0); -- } -- -- i++; -- } -- -- -- (closure->fun) (cif, rvalue, avalue, closure->user_data); -- -- /* Tell ffi_closure_SYSV how to perform return type promotions. -- Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4 -- we have to tell ffi_closure_SYSV how to treat them. We combine the base -- type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct. -- So a one byte struct gets the return type 16. Return type 1 to 15 are -- already used and we never have a struct with size zero. That is the reason -- for the subtraction of 1. See the comment in ffitarget.h about ordering. -- */ -- if (cif->abi == FFI_SYSV && rtypenum == FFI_TYPE_STRUCT && size <= 8) -- return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; -- return rtypenum; --} -- --int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, -- unsigned long *, ffi_dblfl *); -- --int FFI_HIDDEN --ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, -- unsigned long *pst, ffi_dblfl *pfr) --{ -- /* rvalue is the pointer to space for return value in closure assembly */ -- /* pst is the pointer to parameter save area -- (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ -- /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ -- -- void **avalue; -- ffi_type **arg_types; -- long i, avn; -- ffi_cif *cif; -- ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; -- -- cif = closure->cif; -- avalue = alloca (cif->nargs * sizeof (void *)); -- -- /* Copy the caller's structure return value address so that the closure -- returns the data directly to the caller. */ -- if (cif->rtype->type == FFI_TYPE_STRUCT) -- { -- rvalue = (void *) *pst; -- pst++; -- } -- -- i = 0; -- avn = cif->nargs; -- arg_types = cif->arg_types; -- -- /* Grab the addresses of the arguments from the stack frame. */ -- while (i < avn) -- { -- switch (arg_types[i]->type) -- { -- case FFI_TYPE_SINT8: -- case FFI_TYPE_UINT8: --#ifndef __LITTLE_ENDIAN__ -- avalue[i] = (char *) pst + 7; -- pst++; -- break; --#endif -- case FFI_TYPE_SINT16: -- case FFI_TYPE_UINT16: --#ifndef __LITTLE_ENDIAN__ -- avalue[i] = (char *) pst + 6; -- pst++; -- break; --#endif -- case FFI_TYPE_SINT32: -- case FFI_TYPE_UINT32: --#ifndef __LITTLE_ENDIAN__ -- avalue[i] = (char *) pst + 4; -- pst++; -- break; --#endif -- case FFI_TYPE_SINT64: -- case FFI_TYPE_UINT64: -- case FFI_TYPE_POINTER: -- avalue[i] = pst; -- pst++; -- break; -- -- case FFI_TYPE_STRUCT: --#ifndef __LITTLE_ENDIAN__ -- /* Structures with size less than eight bytes are passed -- left-padded. */ -- if (arg_types[i]->size < 8) -- avalue[i] = (char *) pst + 8 - arg_types[i]->size; -- else --#endif -- avalue[i] = pst; -- pst += (arg_types[i]->size + 7) / 8; -- break; -- -- case FFI_TYPE_FLOAT: -- /* unfortunately float values are stored as doubles -- * in the ffi_closure_LINUX64 code (since we don't check -- * the type in that routine). -- */ -- -- /* there are 13 64bit floating point registers */ -- -- if (pfr < end_pfr) -- { -- double temp = pfr->d; -- pfr->f = (float) temp; -- avalue[i] = pfr; -- pfr++; -- } -- else -- avalue[i] = pst; -- pst++; -- break; -- -- case FFI_TYPE_DOUBLE: -- /* On the outgoing stack all values are aligned to 8 */ -- /* there are 13 64bit floating point registers */ -- -- if (pfr < end_pfr) -- { -- avalue[i] = pfr; -- pfr++; -- } -- else -- avalue[i] = pst; -- pst++; -- break; -- --#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -- case FFI_TYPE_LONGDOUBLE: -- if (pfr + 1 < end_pfr) -- { -- avalue[i] = pfr; -- pfr += 2; -- } -- else -- { -- if (pfr < end_pfr) -- { -- /* Passed partly in f13 and partly on the stack. -- Move it all to the stack. */ -- *pst = *(unsigned long *) pfr; -- pfr++; -- } -- avalue[i] = pst; -- } -- pst += 2; -- break; --#endif -- -- default: -- FFI_ASSERT (0); -- } -- -- i++; -- } -- -- -- (closure->fun) (cif, rvalue, avalue, closure->user_data); -- -- /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ -- return cif->rtype->type; --} -Index: libffi/src/powerpc/sysv.S -=================================================================== ---- a/src/libffi/src/powerpc/sysv.S (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/sysv.S (.../branches/gcc-4_8-branch) -@@ -30,7 +30,7 @@ - #include <ffi.h> - #include <powerpc/asm.h> - --#ifndef __powerpc64__ -+#ifndef POWERPC64 - .globl ffi_prep_args_SYSV - ENTRY(ffi_call_SYSV) - .LFB1: -@@ -213,8 +213,8 @@ - .uleb128 0x1c - .align 2 - .LEFDE1: --#endif - - #if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits - #endif -+#endif -Index: libffi/src/powerpc/linux64_closure.S -=================================================================== ---- a/src/libffi/src/powerpc/linux64_closure.S (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/linux64_closure.S (.../branches/gcc-4_8-branch) -@@ -30,18 +30,25 @@ - - .file "linux64_closure.S" - --#ifdef __powerpc64__ -+#ifdef POWERPC64 - FFI_HIDDEN (ffi_closure_LINUX64) - .globl ffi_closure_LINUX64 -+# if _CALL_ELF == 2 -+ .text -+ffi_closure_LINUX64: -+ addis %r2, %r12, .TOC.-ffi_closure_LINUX64@ha -+ addi %r2, %r2, .TOC.-ffi_closure_LINUX64@l -+ .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64 -+# else - .section ".opd","aw" - .align 3 - ffi_closure_LINUX64: --#ifdef _CALL_LINUX -+# ifdef _CALL_LINUX - .quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0 - .type ffi_closure_LINUX64,@function - .text - .L.ffi_closure_LINUX64: --#else -+# else - FFI_HIDDEN (.ffi_closure_LINUX64) - .globl .ffi_closure_LINUX64 - .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 -@@ -49,61 +56,101 @@ - .type .ffi_closure_LINUX64,@function - .text - .ffi_closure_LINUX64: --#endif -+# endif -+# endif -+ -+# if _CALL_ELF == 2 -+# 32 byte special reg save area + 64 byte parm save area -+# + 64 byte retval area + 13*8 fpr save area + round to 16 -+# define STACKFRAME 272 -+# define PARMSAVE 32 -+# define RETVAL PARMSAVE+64 -+# else -+# 48 bytes special reg save area + 64 bytes parm save area -+# + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 -+# define STACKFRAME 240 -+# define PARMSAVE 48 -+# define RETVAL PARMSAVE+64 -+# endif -+ - .LFB1: -- # save general regs into parm save area -- std %r3, 48(%r1) -- std %r4, 56(%r1) -- std %r5, 64(%r1) -- std %r6, 72(%r1) -+# if _CALL_ELF == 2 -+ ld %r12, FFI_TRAMPOLINE_SIZE(%r11) # closure->cif - mflr %r0 -+ lwz %r12, 28(%r12) # cif->flags -+ mtcrf 0x40, %r12 -+ addi %r12, %r1, PARMSAVE -+ bt 7, .Lparmsave -+ # Our caller has not allocated a parameter save area. -+ # We need to allocate one here and use it to pass gprs to -+ # ffi_closure_helper_LINUX64. -+ addi %r12, %r1, -STACKFRAME+PARMSAVE -+.Lparmsave: -+ std %r0, 16(%r1) -+ # Save general regs into parm save area -+ std %r3, 0(%r12) -+ std %r4, 8(%r12) -+ std %r5, 16(%r12) -+ std %r6, 24(%r12) -+ std %r7, 32(%r12) -+ std %r8, 40(%r12) -+ std %r9, 48(%r12) -+ std %r10, 56(%r12) - -- std %r7, 80(%r1) -- std %r8, 88(%r1) -- std %r9, 96(%r1) -- std %r10, 104(%r1) -+ # load up the pointer to the parm save area -+ mr %r5, %r12 -+# else -+ mflr %r0 -+ # Save general regs into parm save area -+ # This is the parameter save area set up by our caller. -+ std %r3, PARMSAVE+0(%r1) -+ std %r4, PARMSAVE+8(%r1) -+ std %r5, PARMSAVE+16(%r1) -+ std %r6, PARMSAVE+24(%r1) -+ std %r7, PARMSAVE+32(%r1) -+ std %r8, PARMSAVE+40(%r1) -+ std %r9, PARMSAVE+48(%r1) -+ std %r10, PARMSAVE+56(%r1) -+ - std %r0, 16(%r1) - -- # mandatory 48 bytes special reg save area + 64 bytes parm save area -- # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 -- stdu %r1, -240(%r1) --.LCFI0: -+ # load up the pointer to the parm save area -+ addi %r5, %r1, PARMSAVE -+# endif - - # next save fpr 1 to fpr 13 -- stfd %f1, 128+(0*8)(%r1) -- stfd %f2, 128+(1*8)(%r1) -- stfd %f3, 128+(2*8)(%r1) -- stfd %f4, 128+(3*8)(%r1) -- stfd %f5, 128+(4*8)(%r1) -- stfd %f6, 128+(5*8)(%r1) -- stfd %f7, 128+(6*8)(%r1) -- stfd %f8, 128+(7*8)(%r1) -- stfd %f9, 128+(8*8)(%r1) -- stfd %f10, 128+(9*8)(%r1) -- stfd %f11, 128+(10*8)(%r1) -- stfd %f12, 128+(11*8)(%r1) -- stfd %f13, 128+(12*8)(%r1) -+ stfd %f1, -104+(0*8)(%r1) -+ stfd %f2, -104+(1*8)(%r1) -+ stfd %f3, -104+(2*8)(%r1) -+ stfd %f4, -104+(3*8)(%r1) -+ stfd %f5, -104+(4*8)(%r1) -+ stfd %f6, -104+(5*8)(%r1) -+ stfd %f7, -104+(6*8)(%r1) -+ stfd %f8, -104+(7*8)(%r1) -+ stfd %f9, -104+(8*8)(%r1) -+ stfd %f10, -104+(9*8)(%r1) -+ stfd %f11, -104+(10*8)(%r1) -+ stfd %f12, -104+(11*8)(%r1) -+ stfd %f13, -104+(12*8)(%r1) - -- # set up registers for the routine that actually does the work -- # get the context pointer from the trampoline -- mr %r3, %r11 -+ # load up the pointer to the saved fpr registers */ -+ addi %r6, %r1, -104 - -- # now load up the pointer to the result storage -- addi %r4, %r1, 112 -+ # load up the pointer to the result storage -+ addi %r4, %r1, -STACKFRAME+RETVAL - -- # now load up the pointer to the parameter save area -- # in the previous frame -- addi %r5, %r1, 240 + 48 -+ stdu %r1, -STACKFRAME(%r1) -+.LCFI0: - -- # now load up the pointer to the saved fpr registers */ -- addi %r6, %r1, 128 -+ # get the context pointer from the trampoline -+ mr %r3, %r11 - - # make the call --#ifdef _CALL_LINUX -+# if defined _CALL_LINUX || _CALL_ELF == 2 - bl ffi_closure_helper_LINUX64 --#else -+# else - bl .ffi_closure_helper_LINUX64 --#endif -+# endif - .Lret: - - # now r3 contains the return type -@@ -112,10 +159,12 @@ - - # look up the proper starting point in table - # by using return type as offset -+ ld %r0, STACKFRAME+16(%r1) -+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT -+ bge .Lsmall - mflr %r4 # move address of .Lret to r4 - sldi %r3, %r3, 4 # now multiply return type by 16 - addi %r4, %r4, .Lret_type0 - .Lret -- ld %r0, 240+16(%r1) - add %r3, %r3, %r4 # add contents of table to table address - mtctr %r3 - bctr # jump to it -@@ -128,117 +177,175 @@ - .Lret_type0: - # case FFI_TYPE_VOID - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - nop - # case FFI_TYPE_INT --#ifdef __LITTLE_ENDIAN__ -- lwa %r3, 112+0(%r1) --#else -- lwa %r3, 112+4(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lwa %r3, RETVAL+0(%r1) -+# else -+ lwa %r3, RETVAL+4(%r1) -+# endif - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_FLOAT -- lfs %f1, 112+0(%r1) -+ lfs %f1, RETVAL+0(%r1) - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_DOUBLE -- lfd %f1, 112+0(%r1) -+ lfd %f1, RETVAL+0(%r1) - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_LONGDOUBLE -- lfd %f1, 112+0(%r1) -+ lfd %f1, RETVAL+0(%r1) - mtlr %r0 -- lfd %f2, 112+8(%r1) -+ lfd %f2, RETVAL+8(%r1) - b .Lfinish - # case FFI_TYPE_UINT8 --#ifdef __LITTLE_ENDIAN__ -- lbz %r3, 112+0(%r1) --#else -- lbz %r3, 112+7(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lbz %r3, RETVAL+0(%r1) -+# else -+ lbz %r3, RETVAL+7(%r1) -+# endif - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_SINT8 --#ifdef __LITTLE_ENDIAN__ -- lbz %r3, 112+0(%r1) --#else -- lbz %r3, 112+7(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lbz %r3, RETVAL+0(%r1) -+# else -+ lbz %r3, RETVAL+7(%r1) -+# endif - extsb %r3,%r3 - mtlr %r0 - b .Lfinish - # case FFI_TYPE_UINT16 --#ifdef __LITTLE_ENDIAN__ -- lhz %r3, 112+0(%r1) --#else -- lhz %r3, 112+6(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lhz %r3, RETVAL+0(%r1) -+# else -+ lhz %r3, RETVAL+6(%r1) -+# endif - mtlr %r0 - .Lfinish: -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_SINT16 --#ifdef __LITTLE_ENDIAN__ -- lha %r3, 112+0(%r1) --#else -- lha %r3, 112+6(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lha %r3, RETVAL+0(%r1) -+# else -+ lha %r3, RETVAL+6(%r1) -+# endif - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_UINT32 --#ifdef __LITTLE_ENDIAN__ -- lwz %r3, 112+0(%r1) --#else -- lwz %r3, 112+4(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lwz %r3, RETVAL+0(%r1) -+# else -+ lwz %r3, RETVAL+4(%r1) -+# endif - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_SINT32 --#ifdef __LITTLE_ENDIAN__ -- lwa %r3, 112+0(%r1) --#else -- lwa %r3, 112+4(%r1) --#endif -+# ifdef __LITTLE_ENDIAN__ -+ lwa %r3, RETVAL+0(%r1) -+# else -+ lwa %r3, RETVAL+4(%r1) -+# endif - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_UINT64 -- ld %r3, 112+0(%r1) -+ ld %r3, RETVAL+0(%r1) - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_SINT64 -- ld %r3, 112+0(%r1) -+ ld %r3, RETVAL+0(%r1) - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - # case FFI_TYPE_STRUCT - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr - nop - # case FFI_TYPE_POINTER -- ld %r3, 112+0(%r1) -+ ld %r3, RETVAL+0(%r1) - mtlr %r0 -- addi %r1, %r1, 240 -+ addi %r1, %r1, STACKFRAME - blr --# esac -+# case FFI_V2_TYPE_FLOAT_HOMOG -+ lfs %f1, RETVAL+0(%r1) -+ lfs %f2, RETVAL+4(%r1) -+ lfs %f3, RETVAL+8(%r1) -+ b .Lmorefloat -+# case FFI_V2_TYPE_DOUBLE_HOMOG -+ lfd %f1, RETVAL+0(%r1) -+ lfd %f2, RETVAL+8(%r1) -+ lfd %f3, RETVAL+16(%r1) -+ lfd %f4, RETVAL+24(%r1) -+ mtlr %r0 -+ lfd %f5, RETVAL+32(%r1) -+ lfd %f6, RETVAL+40(%r1) -+ lfd %f7, RETVAL+48(%r1) -+ lfd %f8, RETVAL+56(%r1) -+ addi %r1, %r1, STACKFRAME -+ blr -+.Lmorefloat: -+ lfs %f4, RETVAL+12(%r1) -+ mtlr %r0 -+ lfs %f5, RETVAL+16(%r1) -+ lfs %f6, RETVAL+20(%r1) -+ lfs %f7, RETVAL+24(%r1) -+ lfs %f8, RETVAL+28(%r1) -+ addi %r1, %r1, STACKFRAME -+ blr -+.Lsmall: -+# ifdef __LITTLE_ENDIAN__ -+ ld %r3,RETVAL+0(%r1) -+ mtlr %r0 -+ ld %r4,RETVAL+8(%r1) -+ addi %r1, %r1, STACKFRAME -+ blr -+# else -+ # A struct smaller than a dword is returned in the low bits of r3 -+ # ie. right justified. Larger structs are passed left justified -+ # in r3 and r4. The return value area on the stack will have -+ # the structs as they are usually stored in memory. -+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes? -+ neg %r5, %r3 -+ ld %r3,RETVAL+0(%r1) -+ blt .Lsmalldown -+ mtlr %r0 -+ ld %r4,RETVAL+8(%r1) -+ addi %r1, %r1, STACKFRAME -+ blr -+.Lsmalldown: -+ addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7 -+ mtlr %r0 -+ sldi %r5, %r5, 3 -+ addi %r1, %r1, STACKFRAME -+ srd %r3, %r3, %r5 -+ blr -+# endif -+ - .LFE1: - .long 0 - .byte 0,12,0,1,128,0,0,0 --#ifdef _CALL_LINUX -+# if _CALL_ELF == 2 -+ .size ffi_closure_LINUX64,.-ffi_closure_LINUX64 -+# else -+# ifdef _CALL_LINUX - .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 --#else -+# else - .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 --#endif -+# endif -+# endif - - .section .eh_frame,EH_FRAME_FLAGS,@progbits - .Lframe1: -@@ -267,14 +374,14 @@ - .byte 0x2 # DW_CFA_advance_loc1 - .byte .LCFI0-.LFB1 - .byte 0xe # DW_CFA_def_cfa_offset -- .uleb128 240 -+ .uleb128 STACKFRAME - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x41 - .sleb128 -2 - .align 3 - .LEFDE1: --#endif - --#if defined __ELF__ && defined __linux__ -+# if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -+# endif - #endif -Index: libffi/src/powerpc/ffi_powerpc.h -=================================================================== ---- a/src/libffi/src/powerpc/ffi_powerpc.h (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ffi_powerpc.h (.../branches/gcc-4_8-branch) -@@ -0,0 +1,77 @@ -+/* ----------------------------------------------------------------------- -+ ffi_powerpc.h - Copyright (C) 2013 IBM -+ Copyright (C) 2011 Anthony Green -+ Copyright (C) 2011 Kyle Moffett -+ Copyright (C) 2008 Red Hat, Inc -+ Copyright (C) 2007, 2008 Free Software Foundation, Inc -+ Copyright (c) 1998 Geoffrey Keating -+ -+ PowerPC Foreign Function Interface -+ -+ Permission is hereby granted, free of charge, to any person obtaining -+ a copy of this software and associated documentation files (the -+ ``Software''), to deal in the Software without restriction, including -+ without limitation the rights to use, copy, modify, merge, publish, -+ distribute, sublicense, and/or sell copies of the Software, and to -+ permit persons to whom the Software is furnished to do so, subject to -+ the following conditions: -+ -+ The above copyright notice and this permission notice shall be included -+ in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ OTHER DEALINGS IN THE SOFTWARE. -+ ----------------------------------------------------------------------- */ -+ -+enum { -+ /* The assembly depends on these exact flags. */ -+ /* These go in cr7 */ -+ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ -+ FLAG_RETURNS_NOTHING = 1 << (31-30), -+ FLAG_RETURNS_FP = 1 << (31-29), -+ FLAG_RETURNS_64BITS = 1 << (31-28), -+ -+ /* This goes in cr6 */ -+ FLAG_RETURNS_128BITS = 1 << (31-27), -+ -+ FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */ -+ -+ /* These go in cr1 */ -+ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), /* Used by sysv code */ -+ FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, /* Used by linux64 code */ -+ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ -+ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), -+ FLAG_RETVAL_REFERENCE = 1 << (31- 4) -+}; -+ -+typedef union -+{ -+ float f; -+ double d; -+} ffi_dblfl; -+ -+void FFI_HIDDEN ffi_closure_SYSV (void); -+void FFI_HIDDEN ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, -+ void (*)(void)); -+ -+void FFI_HIDDEN ffi_prep_types_sysv (ffi_abi); -+ffi_status FFI_HIDDEN ffi_prep_cif_sysv (ffi_cif *); -+int FFI_HIDDEN ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *, -+ ffi_dblfl *, unsigned long *); -+ -+void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, unsigned long, -+ unsigned long *, void (*)(void)); -+void FFI_HIDDEN ffi_closure_LINUX64 (void); -+ -+void FFI_HIDDEN ffi_prep_types_linux64 (ffi_abi); -+ffi_status FFI_HIDDEN ffi_prep_cif_linux64 (ffi_cif *); -+ffi_status FFI_HIDDEN ffi_prep_cif_linux64_var (ffi_cif *, unsigned int, -+ unsigned int); -+void FFI_HIDDEN ffi_prep_args64 (extended_cif *, unsigned long *const); -+int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, -+ unsigned long *, ffi_dblfl *); -Index: libffi/src/powerpc/ffi_sysv.c -=================================================================== ---- a/src/libffi/src/powerpc/ffi_sysv.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ffi_sysv.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,931 @@ -+/* ----------------------------------------------------------------------- -+ ffi_sysv.c - Copyright (C) 2013 IBM -+ Copyright (C) 2011 Anthony Green -+ Copyright (C) 2011 Kyle Moffett -+ Copyright (C) 2008 Red Hat, Inc -+ Copyright (C) 2007, 2008 Free Software Foundation, Inc -+ Copyright (c) 1998 Geoffrey Keating -+ -+ PowerPC Foreign Function Interface -+ -+ Permission is hereby granted, free of charge, to any person obtaining -+ a copy of this software and associated documentation files (the -+ ``Software''), to deal in the Software without restriction, including -+ without limitation the rights to use, copy, modify, merge, publish, -+ distribute, sublicense, and/or sell copies of the Software, and to -+ permit persons to whom the Software is furnished to do so, subject to -+ the following conditions: -+ -+ The above copyright notice and this permission notice shall be included -+ in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ OTHER DEALINGS IN THE SOFTWARE. -+ ----------------------------------------------------------------------- */ -+ -+#include "ffi.h" -+ -+#ifndef POWERPC64 -+#include "ffi_common.h" -+#include "ffi_powerpc.h" -+ -+ -+/* About the SYSV ABI. */ -+#define ASM_NEEDS_REGISTERS 4 -+#define NUM_GPR_ARG_REGISTERS 8 -+#define NUM_FPR_ARG_REGISTERS 8 -+ -+ -+#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+/* Adjust size of ffi_type_longdouble. */ -+void FFI_HIDDEN -+ffi_prep_types_sysv (ffi_abi abi) -+{ -+ if ((abi & (FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128)) == FFI_SYSV) -+ { -+ ffi_type_longdouble.size = 8; -+ ffi_type_longdouble.alignment = 8; -+ } -+ else -+ { -+ ffi_type_longdouble.size = 16; -+ ffi_type_longdouble.alignment = 16; -+ } -+} -+#endif -+ -+/* Transform long double, double and float to other types as per abi. */ -+static int -+translate_float (int abi, int type) -+{ -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ if (type == FFI_TYPE_LONGDOUBLE -+ && (abi & FFI_SYSV_LONG_DOUBLE_128) == 0) -+ type = FFI_TYPE_DOUBLE; -+#endif -+ if ((abi & FFI_SYSV_SOFT_FLOAT) != 0) -+ { -+ if (type == FFI_TYPE_FLOAT) -+ type = FFI_TYPE_UINT32; -+ else if (type == FFI_TYPE_DOUBLE) -+ type = FFI_TYPE_UINT64; -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ else if (type == FFI_TYPE_LONGDOUBLE) -+ type = FFI_TYPE_UINT128; -+ } -+ else if ((abi & FFI_SYSV_IBM_LONG_DOUBLE) == 0) -+ { -+ if (type == FFI_TYPE_LONGDOUBLE) -+ type = FFI_TYPE_STRUCT; -+#endif -+ } -+ return type; -+} -+ -+/* Perform machine dependent cif processing */ -+static ffi_status -+ffi_prep_cif_sysv_core (ffi_cif *cif) -+{ -+ ffi_type **ptr; -+ unsigned bytes; -+ unsigned i, fparg_count = 0, intarg_count = 0; -+ unsigned flags = cif->flags; -+ unsigned struct_copy_size = 0; -+ unsigned type = cif->rtype->type; -+ unsigned size = cif->rtype->size; -+ -+ /* The machine-independent calculation of cif->bytes doesn't work -+ for us. Redo the calculation. */ -+ -+ /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ -+ bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); -+ -+ /* Space for the GPR registers. */ -+ bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); -+ -+ /* Return value handling. The rules for SYSV are as follows: -+ - 32-bit (or less) integer values are returned in gpr3; -+ - Structures of size <= 4 bytes also returned in gpr3; -+ - 64-bit integer values and structures between 5 and 8 bytes are returned -+ in gpr3 and gpr4; -+ - Larger structures are allocated space and a pointer is passed as -+ the first argument. -+ - Single/double FP values are returned in fpr1; -+ - long doubles (if not equivalent to double) are returned in -+ fpr1,fpr2 for Linux and as for large structs for SysV. */ -+ -+ type = translate_float (cif->abi, type); -+ -+ switch (type) -+ { -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ flags |= FLAG_RETURNS_128BITS; -+ /* Fall through. */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ flags |= FLAG_RETURNS_64BITS; -+ /* Fall through. */ -+ case FFI_TYPE_FLOAT: -+ flags |= FLAG_RETURNS_FP; -+#ifdef __NO_FPRS__ -+ return FFI_BAD_ABI; -+#endif -+ break; -+ -+ case FFI_TYPE_UINT128: -+ flags |= FLAG_RETURNS_128BITS; -+ /* Fall through. */ -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ flags |= FLAG_RETURNS_64BITS; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ /* The final SYSV ABI says that structures smaller or equal 8 bytes -+ are returned in r3/r4. A draft ABI used by linux instead -+ returns them in memory. */ -+ if ((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8) -+ { -+ flags |= FLAG_RETURNS_SMST; -+ break; -+ } -+ intarg_count++; -+ flags |= FLAG_RETVAL_REFERENCE; -+ /* Fall through. */ -+ case FFI_TYPE_VOID: -+ flags |= FLAG_RETURNS_NOTHING; -+ break; -+ -+ default: -+ /* Returns 32-bit integer, or similar. Nothing to do here. */ -+ break; -+ } -+ -+ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the -+ first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest -+ goes on the stack. Structures and long doubles (if not equivalent -+ to double) are passed as a pointer to a copy of the structure. -+ Stuff on the stack needs to keep proper alignment. */ -+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) -+ { -+ unsigned short typenum = (*ptr)->type; -+ -+ typenum = translate_float (cif->abi, typenum); -+ -+ switch (typenum) -+ { -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ fparg_count++; -+ /* Fall thru */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ fparg_count++; -+ /* If this FP arg is going on the stack, it must be -+ 8-byte-aligned. */ -+ if (fparg_count > NUM_FPR_ARG_REGISTERS -+ && intarg_count >= NUM_GPR_ARG_REGISTERS -+ && intarg_count % 2 != 0) -+ intarg_count++; -+#ifdef __NO_FPRS__ -+ return FFI_BAD_ABI; -+#endif -+ break; -+ -+ case FFI_TYPE_FLOAT: -+ fparg_count++; -+#ifdef __NO_FPRS__ -+ return FFI_BAD_ABI; -+#endif -+ break; -+ -+ case FFI_TYPE_UINT128: -+ /* A long double in FFI_LINUX_SOFT_FLOAT can use only a set -+ of four consecutive gprs. If we do not have enough, we -+ have to adjust the intarg_count value. */ -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 -+ && intarg_count < NUM_GPR_ARG_REGISTERS) -+ intarg_count = NUM_GPR_ARG_REGISTERS; -+ intarg_count += 4; -+ break; -+ -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ /* 'long long' arguments are passed as two words, but -+ either both words must fit in registers or both go -+ on the stack. If they go on the stack, they must -+ be 8-byte-aligned. -+ -+ Also, only certain register pairs can be used for -+ passing long long int -- specifically (r3,r4), (r5,r6), -+ (r7,r8), (r9,r10). */ -+ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 -+ || intarg_count % 2 != 0) -+ intarg_count++; -+ intarg_count += 2; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ /* We must allocate space for a copy of these to enforce -+ pass-by-value. Pad the space up to a multiple of 16 -+ bytes (the maximum alignment required for anything under -+ the SYSV ABI). */ -+ struct_copy_size += ((*ptr)->size + 15) & ~0xF; -+ /* Fall through (allocate space for the pointer). */ -+ -+ case FFI_TYPE_POINTER: -+ case FFI_TYPE_INT: -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_UINT16: -+ case FFI_TYPE_SINT16: -+ case FFI_TYPE_UINT8: -+ case FFI_TYPE_SINT8: -+ /* Everything else is passed as a 4-byte word in a GPR, either -+ the object itself or a pointer to it. */ -+ intarg_count++; -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ } -+ } -+ -+ if (fparg_count != 0) -+ flags |= FLAG_FP_ARGUMENTS; -+ if (intarg_count > 4) -+ flags |= FLAG_4_GPR_ARGUMENTS; -+ if (struct_copy_size != 0) -+ flags |= FLAG_ARG_NEEDS_COPY; -+ -+ /* Space for the FPR registers, if needed. */ -+ if (fparg_count != 0) -+ bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); -+ -+ /* Stack space. */ -+ if (intarg_count > NUM_GPR_ARG_REGISTERS) -+ bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); -+ if (fparg_count > NUM_FPR_ARG_REGISTERS) -+ bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); -+ -+ /* The stack space allocated needs to be a multiple of 16 bytes. */ -+ bytes = (bytes + 15) & ~0xF; -+ -+ /* Add in the space for the copied structures. */ -+ bytes += struct_copy_size; -+ -+ cif->flags = flags; -+ cif->bytes = bytes; -+ -+ return FFI_OK; -+} -+ -+ffi_status FFI_HIDDEN -+ffi_prep_cif_sysv (ffi_cif *cif) -+{ -+ if ((cif->abi & FFI_SYSV) == 0) -+ { -+ /* This call is from old code. Translate to new ABI values. */ -+ cif->flags |= FLAG_COMPAT; -+ switch (cif->abi) -+ { -+ default: -+ return FFI_BAD_ABI; -+ -+ case FFI_COMPAT_SYSV: -+ cif->abi = FFI_SYSV | FFI_SYSV_STRUCT_RET | FFI_SYSV_LONG_DOUBLE_128; -+ break; -+ -+ case FFI_COMPAT_GCC_SYSV: -+ cif->abi = FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128; -+ break; -+ -+ case FFI_COMPAT_LINUX: -+ cif->abi = (FFI_SYSV | FFI_SYSV_IBM_LONG_DOUBLE -+ | FFI_SYSV_LONG_DOUBLE_128); -+ break; -+ -+ case FFI_COMPAT_LINUX_SOFT_FLOAT: -+ cif->abi = (FFI_SYSV | FFI_SYSV_SOFT_FLOAT | FFI_SYSV_IBM_LONG_DOUBLE -+ | FFI_SYSV_LONG_DOUBLE_128); -+ break; -+ } -+ } -+ return ffi_prep_cif_sysv_core (cif); -+} -+ -+/* ffi_prep_args_SYSV is called by the assembly routine once stack space -+ has been allocated for the function's arguments. -+ -+ The stack layout we want looks like this: -+ -+ | Return address from ffi_call_SYSV 4bytes | higher addresses -+ |--------------------------------------------| -+ | Previous backchain pointer 4 | stack pointer here -+ |--------------------------------------------|<+ <<< on entry to -+ | Saved r28-r31 4*4 | | ffi_call_SYSV -+ |--------------------------------------------| | -+ | GPR registers r3-r10 8*4 | | ffi_call_SYSV -+ |--------------------------------------------| | -+ | FPR registers f1-f8 (optional) 8*8 | | -+ |--------------------------------------------| | stack | -+ | Space for copied structures | | grows | -+ |--------------------------------------------| | down V -+ | Parameters that didn't fit in registers | | -+ |--------------------------------------------| | lower addresses -+ | Space for callee's LR 4 | | -+ |--------------------------------------------| | stack pointer here -+ | Current backchain pointer 4 |-/ during -+ |--------------------------------------------| <<< ffi_call_SYSV -+ -+*/ -+ -+void FFI_HIDDEN -+ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) -+{ -+ const unsigned bytes = ecif->cif->bytes; -+ const unsigned flags = ecif->cif->flags; -+ -+ typedef union -+ { -+ char *c; -+ unsigned *u; -+ long long *ll; -+ float *f; -+ double *d; -+ } valp; -+ -+ /* 'stacktop' points at the previous backchain pointer. */ -+ valp stacktop; -+ -+ /* 'gpr_base' points at the space for gpr3, and grows upwards as -+ we use GPR registers. */ -+ valp gpr_base; -+ int intarg_count; -+ -+#ifndef __NO_FPRS__ -+ /* 'fpr_base' points at the space for fpr1, and grows upwards as -+ we use FPR registers. */ -+ valp fpr_base; -+ int fparg_count; -+#endif -+ -+ /* 'copy_space' grows down as we put structures in it. It should -+ stay 16-byte aligned. */ -+ valp copy_space; -+ -+ /* 'next_arg' grows up as we put parameters in it. */ -+ valp next_arg; -+ -+ int i; -+ ffi_type **ptr; -+#ifndef __NO_FPRS__ -+ double double_tmp; -+#endif -+ union -+ { -+ void **v; -+ char **c; -+ signed char **sc; -+ unsigned char **uc; -+ signed short **ss; -+ unsigned short **us; -+ unsigned int **ui; -+ long long **ll; -+ float **f; -+ double **d; -+ } p_argv; -+ size_t struct_copy_size; -+ unsigned gprvalue; -+ -+ stacktop.c = (char *) stack + bytes; -+ gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; -+ intarg_count = 0; -+#ifndef __NO_FPRS__ -+ fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; -+ fparg_count = 0; -+ copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); -+#else -+ copy_space.c = gpr_base.c; -+#endif -+ next_arg.u = stack + 2; -+ -+ /* Check that everything starts aligned properly. */ -+ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); -+ FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); -+ FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); -+ FFI_ASSERT ((bytes & 0xF) == 0); -+ FFI_ASSERT (copy_space.c >= next_arg.c); -+ -+ /* Deal with return values that are actually pass-by-reference. */ -+ if (flags & FLAG_RETVAL_REFERENCE) -+ { -+ *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; -+ intarg_count++; -+ } -+ -+ /* Now for the arguments. */ -+ p_argv.v = ecif->avalue; -+ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; -+ i > 0; -+ i--, ptr++, p_argv.v++) -+ { -+ unsigned int typenum = (*ptr)->type; -+ -+ typenum = translate_float (ecif->cif->abi, typenum); -+ -+ /* Now test the translated value */ -+ switch (typenum) -+ { -+#ifndef __NO_FPRS__ -+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ double_tmp = (*p_argv.d)[0]; -+ -+ if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) -+ { -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS -+ && intarg_count % 2 != 0) -+ { -+ intarg_count++; -+ next_arg.u++; -+ } -+ *next_arg.d = double_tmp; -+ next_arg.u += 2; -+ double_tmp = (*p_argv.d)[1]; -+ *next_arg.d = double_tmp; -+ next_arg.u += 2; -+ } -+ else -+ { -+ *fpr_base.d++ = double_tmp; -+ double_tmp = (*p_argv.d)[1]; -+ *fpr_base.d++ = double_tmp; -+ } -+ -+ fparg_count += 2; -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+# endif -+ case FFI_TYPE_DOUBLE: -+ double_tmp = **p_argv.d; -+ -+ if (fparg_count >= NUM_FPR_ARG_REGISTERS) -+ { -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS -+ && intarg_count % 2 != 0) -+ { -+ intarg_count++; -+ next_arg.u++; -+ } -+ *next_arg.d = double_tmp; -+ next_arg.u += 2; -+ } -+ else -+ *fpr_base.d++ = double_tmp; -+ fparg_count++; -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+ -+ case FFI_TYPE_FLOAT: -+ double_tmp = **p_argv.f; -+ if (fparg_count >= NUM_FPR_ARG_REGISTERS) -+ { -+ *next_arg.f = (float) double_tmp; -+ next_arg.u += 1; -+ intarg_count++; -+ } -+ else -+ *fpr_base.d++ = double_tmp; -+ fparg_count++; -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+#endif /* have FPRs */ -+ -+ case FFI_TYPE_UINT128: -+ /* The soft float ABI for long doubles works like this, a long double -+ is passed in four consecutive GPRs if available. A maximum of 2 -+ long doubles can be passed in gprs. If we do not have 4 GPRs -+ left, the long double is passed on the stack, 4-byte aligned. */ -+ { -+ unsigned int int_tmp; -+ unsigned int ii; -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) -+ { -+ if (intarg_count < NUM_GPR_ARG_REGISTERS) -+ intarg_count = NUM_GPR_ARG_REGISTERS; -+ for (ii = 0; ii < 4; ii++) -+ { -+ int_tmp = (*p_argv.ui)[ii]; -+ *next_arg.u++ = int_tmp; -+ } -+ } -+ else -+ { -+ for (ii = 0; ii < 4; ii++) -+ { -+ int_tmp = (*p_argv.ui)[ii]; -+ *gpr_base.u++ = int_tmp; -+ } -+ } -+ intarg_count += 4; -+ break; -+ } -+ -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ if (intarg_count == NUM_GPR_ARG_REGISTERS-1) -+ intarg_count++; -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS) -+ { -+ if (intarg_count % 2 != 0) -+ { -+ intarg_count++; -+ next_arg.u++; -+ } -+ *next_arg.ll = **p_argv.ll; -+ next_arg.u += 2; -+ } -+ else -+ { -+ /* The abi states only certain register pairs can be -+ used for passing long long int specifically (r3,r4), -+ (r5,r6), (r7,r8), (r9,r10). If next arg is long long -+ but not correct starting register of pair then skip -+ until the proper starting register. */ -+ if (intarg_count % 2 != 0) -+ { -+ intarg_count ++; -+ gpr_base.u++; -+ } -+ *gpr_base.ll++ = **p_argv.ll; -+ } -+ intarg_count += 2; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ struct_copy_size = ((*ptr)->size + 15) & ~0xF; -+ copy_space.c -= struct_copy_size; -+ memcpy (copy_space.c, *p_argv.c, (*ptr)->size); -+ -+ gprvalue = (unsigned long) copy_space.c; -+ -+ FFI_ASSERT (copy_space.c > next_arg.c); -+ FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); -+ goto putgpr; -+ -+ case FFI_TYPE_UINT8: -+ gprvalue = **p_argv.uc; -+ goto putgpr; -+ case FFI_TYPE_SINT8: -+ gprvalue = **p_argv.sc; -+ goto putgpr; -+ case FFI_TYPE_UINT16: -+ gprvalue = **p_argv.us; -+ goto putgpr; -+ case FFI_TYPE_SINT16: -+ gprvalue = **p_argv.ss; -+ goto putgpr; -+ -+ case FFI_TYPE_INT: -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_POINTER: -+ -+ gprvalue = **p_argv.ui; -+ -+ putgpr: -+ if (intarg_count >= NUM_GPR_ARG_REGISTERS) -+ *next_arg.u++ = gprvalue; -+ else -+ *gpr_base.u++ = gprvalue; -+ intarg_count++; -+ break; -+ } -+ } -+ -+ /* Check that we didn't overrun the stack... */ -+ FFI_ASSERT (copy_space.c >= next_arg.c); -+ FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); -+ /* The assert below is testing that the number of integer arguments agrees -+ with the number found in ffi_prep_cif_machdep(). However, intarg_count -+ is incremented whenever we place an FP arg on the stack, so account for -+ that before our assert test. */ -+#ifndef __NO_FPRS__ -+ if (fparg_count > NUM_FPR_ARG_REGISTERS) -+ intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; -+ FFI_ASSERT (fpr_base.u -+ <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); -+#endif -+ FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); -+} -+ -+#define MIN_CACHE_LINE_SIZE 8 -+ -+static void -+flush_icache (char *wraddr, char *xaddr, int size) -+{ -+ int i; -+ for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) -+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" -+ : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); -+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" -+ : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) -+ : "memory"); -+} -+ -+ffi_status FFI_HIDDEN -+ffi_prep_closure_loc_sysv (ffi_closure *closure, -+ ffi_cif *cif, -+ void (*fun) (ffi_cif *, void *, void **, void *), -+ void *user_data, -+ void *codeloc) -+{ -+ unsigned int *tramp; -+ -+ if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI) -+ return FFI_BAD_ABI; -+ -+ tramp = (unsigned int *) &closure->tramp[0]; -+ tramp[0] = 0x7c0802a6; /* mflr r0 */ -+ tramp[1] = 0x4800000d; /* bl 10 <trampoline_initial+0x10> */ -+ tramp[4] = 0x7d6802a6; /* mflr r11 */ -+ tramp[5] = 0x7c0803a6; /* mtlr r0 */ -+ tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ -+ tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ -+ tramp[8] = 0x7c0903a6; /* mtctr r0 */ -+ tramp[9] = 0x4e800420; /* bctr */ -+ *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */ -+ *(void **) &tramp[3] = codeloc; /* context */ -+ -+ /* Flush the icache. */ -+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); -+ -+ closure->cif = cif; -+ closure->fun = fun; -+ closure->user_data = user_data; -+ -+ return FFI_OK; -+} -+ -+/* Basically the trampoline invokes ffi_closure_SYSV, and on -+ entry, r11 holds the address of the closure. -+ After storing the registers that could possibly contain -+ parameters to be passed into the stack frame and setting -+ up space for a return value, ffi_closure_SYSV invokes the -+ following helper function to do most of the work. */ -+ -+int -+ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, -+ unsigned long *pgr, ffi_dblfl *pfr, -+ unsigned long *pst) -+{ -+ /* rvalue is the pointer to space for return value in closure assembly */ -+ /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ -+ /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ -+ /* pst is the pointer to outgoing parameter stack in original caller */ -+ -+ void ** avalue; -+ ffi_type ** arg_types; -+ long i, avn; -+#ifndef __NO_FPRS__ -+ long nf = 0; /* number of floating registers already used */ -+#endif -+ long ng = 0; /* number of general registers already used */ -+ -+ ffi_cif *cif = closure->cif; -+ unsigned size = cif->rtype->size; -+ unsigned short rtypenum = cif->rtype->type; -+ -+ avalue = alloca (cif->nargs * sizeof (void *)); -+ -+ /* First translate for softfloat/nonlinux */ -+ rtypenum = translate_float (cif->abi, rtypenum); -+ -+ /* Copy the caller's structure return value address so that the closure -+ returns the data directly to the caller. -+ For FFI_SYSV the result is passed in r3/r4 if the struct size is less -+ or equal 8 bytes. */ -+ if (rtypenum == FFI_TYPE_STRUCT -+ && !((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8)) -+ { -+ rvalue = (void *) *pgr; -+ ng++; -+ pgr++; -+ } -+ -+ i = 0; -+ avn = cif->nargs; -+ arg_types = cif->arg_types; -+ -+ /* Grab the addresses of the arguments from the stack frame. */ -+ while (i < avn) { -+ unsigned short typenum = arg_types[i]->type; -+ -+ /* We may need to handle some values depending on ABI. */ -+ typenum = translate_float (cif->abi, typenum); -+ -+ switch (typenum) -+ { -+#ifndef __NO_FPRS__ -+ case FFI_TYPE_FLOAT: -+ /* Unfortunately float values are stored as doubles -+ in the ffi_closure_SYSV code (since we don't check -+ the type in that routine). */ -+ if (nf < NUM_FPR_ARG_REGISTERS) -+ { -+ /* FIXME? here we are really changing the values -+ stored in the original calling routines outgoing -+ parameter stack. This is probably a really -+ naughty thing to do but... */ -+ double temp = pfr->d; -+ pfr->f = (float) temp; -+ avalue[i] = pfr; -+ nf++; -+ pfr++; -+ } -+ else -+ { -+ avalue[i] = pst; -+ pst += 1; -+ } -+ break; -+ -+ case FFI_TYPE_DOUBLE: -+ if (nf < NUM_FPR_ARG_REGISTERS) -+ { -+ avalue[i] = pfr; -+ nf++; -+ pfr++; -+ } -+ else -+ { -+ if (((long) pst) & 4) -+ pst++; -+ avalue[i] = pst; -+ pst += 2; -+ } -+ break; -+ -+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ if (nf < NUM_FPR_ARG_REGISTERS - 1) -+ { -+ avalue[i] = pfr; -+ pfr += 2; -+ nf += 2; -+ } -+ else -+ { -+ if (((long) pst) & 4) -+ pst++; -+ avalue[i] = pst; -+ pst += 4; -+ nf = 8; -+ } -+ break; -+# endif -+#endif -+ -+ case FFI_TYPE_UINT128: -+ /* Test if for the whole long double, 4 gprs are available. -+ otherwise the stuff ends up on the stack. */ -+ if (ng < NUM_GPR_ARG_REGISTERS - 3) -+ { -+ avalue[i] = pgr; -+ pgr += 4; -+ ng += 4; -+ } -+ else -+ { -+ avalue[i] = pst; -+ pst += 4; -+ ng = 8+4; -+ } -+ break; -+ -+ case FFI_TYPE_SINT8: -+ case FFI_TYPE_UINT8: -+#ifndef __LITTLE_ENDIAN__ -+ if (ng < NUM_GPR_ARG_REGISTERS) -+ { -+ avalue[i] = (char *) pgr + 3; -+ ng++; -+ pgr++; -+ } -+ else -+ { -+ avalue[i] = (char *) pst + 3; -+ pst++; -+ } -+ break; -+#endif -+ -+ case FFI_TYPE_SINT16: -+ case FFI_TYPE_UINT16: -+#ifndef __LITTLE_ENDIAN__ -+ if (ng < NUM_GPR_ARG_REGISTERS) -+ { -+ avalue[i] = (char *) pgr + 2; -+ ng++; -+ pgr++; -+ } -+ else -+ { -+ avalue[i] = (char *) pst + 2; -+ pst++; -+ } -+ break; -+#endif -+ -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_POINTER: -+ if (ng < NUM_GPR_ARG_REGISTERS) -+ { -+ avalue[i] = pgr; -+ ng++; -+ pgr++; -+ } -+ else -+ { -+ avalue[i] = pst; -+ pst++; -+ } -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ /* Structs are passed by reference. The address will appear in a -+ gpr if it is one of the first 8 arguments. */ -+ if (ng < NUM_GPR_ARG_REGISTERS) -+ { -+ avalue[i] = (void *) *pgr; -+ ng++; -+ pgr++; -+ } -+ else -+ { -+ avalue[i] = (void *) *pst; -+ pst++; -+ } -+ break; -+ -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_UINT64: -+ /* Passing long long ints are complex, they must -+ be passed in suitable register pairs such as -+ (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) -+ and if the entire pair aren't available then the outgoing -+ parameter stack is used for both but an alignment of 8 -+ must will be kept. So we must either look in pgr -+ or pst to find the correct address for this type -+ of parameter. */ -+ if (ng < NUM_GPR_ARG_REGISTERS - 1) -+ { -+ if (ng & 1) -+ { -+ /* skip r4, r6, r8 as starting points */ -+ ng++; -+ pgr++; -+ } -+ avalue[i] = pgr; -+ ng += 2; -+ pgr += 2; -+ } -+ else -+ { -+ if (((long) pst) & 4) -+ pst++; -+ avalue[i] = pst; -+ pst += 2; -+ ng = NUM_GPR_ARG_REGISTERS; -+ } -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ } -+ -+ i++; -+ } -+ -+ (closure->fun) (cif, rvalue, avalue, closure->user_data); -+ -+ /* Tell ffi_closure_SYSV how to perform return type promotions. -+ Because the FFI_SYSV ABI returns the structures <= 8 bytes in -+ r3/r4 we have to tell ffi_closure_SYSV how to treat them. We -+ combine the base type FFI_SYSV_TYPE_SMALL_STRUCT with the size of -+ the struct less one. We never have a struct with size zero. -+ See the comment in ffitarget.h about ordering. */ -+ if (rtypenum == FFI_TYPE_STRUCT -+ && (cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8) -+ return FFI_SYSV_TYPE_SMALL_STRUCT - 1 + size; -+ return rtypenum; -+} -+#endif -Index: libffi/src/powerpc/linux64.S -=================================================================== ---- a/src/libffi/src/powerpc/linux64.S (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/linux64.S (.../branches/gcc-4_8-branch) -@@ -29,18 +29,25 @@ - #include <fficonfig.h> - #include <ffi.h> - --#ifdef __powerpc64__ -+#ifdef POWERPC64 - .hidden ffi_call_LINUX64 - .globl ffi_call_LINUX64 -+# if _CALL_ELF == 2 -+ .text -+ffi_call_LINUX64: -+ addis %r2, %r12, .TOC.-ffi_call_LINUX64@ha -+ addi %r2, %r2, .TOC.-ffi_call_LINUX64@l -+ .localentry ffi_call_LINUX64, . - ffi_call_LINUX64 -+# else - .section ".opd","aw" - .align 3 - ffi_call_LINUX64: --#ifdef _CALL_LINUX -+# ifdef _CALL_LINUX - .quad .L.ffi_call_LINUX64,.TOC.@tocbase,0 - .type ffi_call_LINUX64,@function - .text - .L.ffi_call_LINUX64: --#else -+# else - .hidden .ffi_call_LINUX64 - .globl .ffi_call_LINUX64 - .quad .ffi_call_LINUX64,.TOC.@tocbase,0 -@@ -48,7 +55,8 @@ - .type .ffi_call_LINUX64,@function - .text - .ffi_call_LINUX64: --#endif -+# endif -+# endif - .LFB1: - mflr %r0 - std %r28, -32(%r1) -@@ -63,26 +71,35 @@ - mr %r31, %r5 /* flags, */ - mr %r30, %r6 /* rvalue, */ - mr %r29, %r7 /* function address. */ -+/* Save toc pointer, not for the ffi_prep_args64 call, but for the later -+ bctrl function call. */ -+# if _CALL_ELF == 2 -+ std %r2, 24(%r1) -+# else - std %r2, 40(%r1) -+# endif - - /* Call ffi_prep_args64. */ - mr %r4, %r1 --#ifdef _CALL_LINUX -+# if defined _CALL_LINUX || _CALL_ELF == 2 - bl ffi_prep_args64 --#else -+# else - bl .ffi_prep_args64 --#endif -+# endif - -- ld %r0, 0(%r29) -+# if _CALL_ELF == 2 -+ mr %r12, %r29 -+# else -+ ld %r12, 0(%r29) - ld %r2, 8(%r29) - ld %r11, 16(%r29) -- -+# endif - /* Now do the call. */ - /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40, %r31 - - /* Get the address to call into CTR. */ -- mtctr %r0 -+ mtctr %r12 - /* Load all those argument registers. */ - ld %r3, -32-(8*8)(%r28) - ld %r4, -32-(7*8)(%r28) -@@ -117,12 +134,17 @@ - - /* This must follow the call immediately, the unwinder - uses this to find out if r2 has been saved or not. */ -+# if _CALL_ELF == 2 -+ ld %r2, 24(%r1) -+# else - ld %r2, 40(%r1) -+# endif - - /* Now, deal with the return value. */ - mtcrf 0x01, %r31 -- bt- 30, .Ldone_return_value -- bt- 29, .Lfp_return_value -+ bt 31, .Lstruct_return_value -+ bt 30, .Ldone_return_value -+ bt 29, .Lfp_return_value - std %r3, 0(%r30) - /* Fall through... */ - -@@ -130,7 +152,7 @@ - /* Restore the registers we used and return. */ - mr %r1, %r28 - ld %r0, 16(%r28) -- ld %r28, -32(%r1) -+ ld %r28, -32(%r28) - mtlr %r0 - ld %r29, -24(%r1) - ld %r30, -16(%r1) -@@ -147,14 +169,48 @@ - .Lfloat_return_value: - stfs %f1, 0(%r30) - b .Ldone_return_value -+ -+.Lstruct_return_value: -+ bf 29, .Lsmall_struct -+ bf 28, .Lfloat_homog_return_value -+ stfd %f1, 0(%r30) -+ stfd %f2, 8(%r30) -+ stfd %f3, 16(%r30) -+ stfd %f4, 24(%r30) -+ stfd %f5, 32(%r30) -+ stfd %f6, 40(%r30) -+ stfd %f7, 48(%r30) -+ stfd %f8, 56(%r30) -+ b .Ldone_return_value -+ -+.Lfloat_homog_return_value: -+ stfs %f1, 0(%r30) -+ stfs %f2, 4(%r30) -+ stfs %f3, 8(%r30) -+ stfs %f4, 12(%r30) -+ stfs %f5, 16(%r30) -+ stfs %f6, 20(%r30) -+ stfs %f7, 24(%r30) -+ stfs %f8, 28(%r30) -+ b .Ldone_return_value -+ -+.Lsmall_struct: -+ std %r3, 0(%r30) -+ std %r4, 8(%r30) -+ b .Ldone_return_value -+ - .LFE1: - .long 0 - .byte 0,12,0,1,128,4,0,0 --#ifdef _CALL_LINUX -+# if _CALL_ELF == 2 -+ .size ffi_call_LINUX64,.-ffi_call_LINUX64 -+# else -+# ifdef _CALL_LINUX - .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 --#else -+# else - .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 --#endif -+# endif -+# endif + int retval; + +- if (s->fd != STDOUT_FILENO ++ if (s->fd == -1) ++ retval = -1; ++ else if (s->fd != STDOUT_FILENO + && s->fd != STDERR_FILENO + && s->fd != STDIN_FILENO) + retval = close (s->fd); +@@ -983,7 +985,15 @@ - .section .eh_frame,EH_FRAME_FLAGS,@progbits - .Lframe1: -@@ -197,8 +253,8 @@ - .uleb128 0x4 - .align 3 - .LEFDE1: --#endif + /* Get the current length of the file. */ --#if defined __ELF__ && defined __linux__ -+# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 - .section .note.GNU-stack,"",@progbits -+# endif - #endif -Index: libffi/src/powerpc/ffi_linux64.c -=================================================================== ---- a/src/libffi/src/powerpc/ffi_linux64.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/powerpc/ffi_linux64.c (.../branches/gcc-4_8-branch) -@@ -0,0 +1,942 @@ -+/* ----------------------------------------------------------------------- -+ ffi_linux64.c - Copyright (C) 2013 IBM -+ Copyright (C) 2011 Anthony Green -+ Copyright (C) 2011 Kyle Moffett -+ Copyright (C) 2008 Red Hat, Inc -+ Copyright (C) 2007, 2008 Free Software Foundation, Inc -+ Copyright (c) 1998 Geoffrey Keating -+ -+ PowerPC Foreign Function Interface -+ -+ Permission is hereby granted, free of charge, to any person obtaining -+ a copy of this software and associated documentation files (the -+ ``Software''), to deal in the Software without restriction, including -+ without limitation the rights to use, copy, modify, merge, publish, -+ distribute, sublicense, and/or sell copies of the Software, and to -+ permit persons to whom the Software is furnished to do so, subject to -+ the following conditions: -+ -+ The above copyright notice and this permission notice shall be included -+ in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR -+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ OTHER DEALINGS IN THE SOFTWARE. -+ ----------------------------------------------------------------------- */ -+ -+#include "ffi.h" -+ -+#ifdef POWERPC64 -+#include "ffi_common.h" -+#include "ffi_powerpc.h" -+ -+ -+/* About the LINUX64 ABI. */ -+enum { -+ NUM_GPR_ARG_REGISTERS64 = 8, -+ NUM_FPR_ARG_REGISTERS64 = 13 -+}; -+enum { ASM_NEEDS_REGISTERS64 = 4 }; -+ -+ -+#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+/* Adjust size of ffi_type_longdouble. */ -+void FFI_HIDDEN -+ffi_prep_types_linux64 (ffi_abi abi) -+{ -+ if ((abi & (FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128)) == FFI_LINUX) -+ { -+ ffi_type_longdouble.size = 8; -+ ffi_type_longdouble.alignment = 8; -+ } -+ else -+ { -+ ffi_type_longdouble.size = 16; -+ ffi_type_longdouble.alignment = 16; -+ } -+} -+#endif -+ -+ -+#if _CALL_ELF == 2 -+static unsigned int -+discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum) -+{ -+ switch (t->type) -+ { -+ case FFI_TYPE_FLOAT: -+ case FFI_TYPE_DOUBLE: -+ *elnum = 1; -+ return (int) t->type; -+ -+ case FFI_TYPE_STRUCT:; -+ { -+ unsigned int base_elt = 0, total_elnum = 0; -+ ffi_type **el = t->elements; -+ while (*el) -+ { -+ unsigned int el_elt, el_elnum = 0; -+ el_elt = discover_homogeneous_aggregate (*el, &el_elnum); -+ if (el_elt == 0 -+ || (base_elt && base_elt != el_elt)) -+ return 0; -+ base_elt = el_elt; -+ total_elnum += el_elnum; -+ if (total_elnum > 8) -+ return 0; -+ el++; -+ } -+ *elnum = total_elnum; -+ return base_elt; -+ } -+ -+ default: -+ return 0; -+ } -+} -+#endif -+ -+ -+/* Perform machine dependent cif processing */ -+static ffi_status -+ffi_prep_cif_linux64_core (ffi_cif *cif) -+{ -+ ffi_type **ptr; -+ unsigned bytes; -+ unsigned i, fparg_count = 0, intarg_count = 0; -+ unsigned flags = cif->flags; -+#if _CALL_ELF == 2 -+ unsigned int elt, elnum; -+#endif -+ -+#if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE -+ /* If compiled without long double support.. */ -+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) -+ return FFI_BAD_ABI; -+#endif -+ -+ /* The machine-independent calculation of cif->bytes doesn't work -+ for us. Redo the calculation. */ -+#if _CALL_ELF == 2 -+ /* Space for backchain, CR, LR, TOC and the asm's temp regs. */ -+ bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long); -+ -+ /* Space for the general registers. */ -+ bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long); -+#else -+ /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp -+ regs. */ -+ bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); -+ -+ /* Space for the mandatory parm save area and general registers. */ -+ bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); -+#endif -+ -+ /* Return value handling. */ -+ switch (cif->rtype->type) -+ { -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) -+ flags |= FLAG_RETURNS_128BITS; -+ /* Fall through. */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ flags |= FLAG_RETURNS_64BITS; -+ /* Fall through. */ -+ case FFI_TYPE_FLOAT: -+ flags |= FLAG_RETURNS_FP; -+ break; -+ -+ case FFI_TYPE_UINT128: -+ flags |= FLAG_RETURNS_128BITS; -+ /* Fall through. */ -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ flags |= FLAG_RETURNS_64BITS; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+#if _CALL_ELF == 2 -+ elt = discover_homogeneous_aggregate (cif->rtype, &elnum); -+ if (elt) -+ { -+ if (elt == FFI_TYPE_DOUBLE) -+ flags |= FLAG_RETURNS_64BITS; -+ flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST; -+ break; -+ } -+ if (cif->rtype->size <= 16) -+ { -+ flags |= FLAG_RETURNS_SMST; -+ break; -+ } -+#endif -+ intarg_count++; -+ flags |= FLAG_RETVAL_REFERENCE; -+ /* Fall through. */ -+ case FFI_TYPE_VOID: -+ flags |= FLAG_RETURNS_NOTHING; -+ break; -+ -+ default: -+ /* Returns 32-bit integer, or similar. Nothing to do here. */ -+ break; -+ } -+ -+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) -+ { -+ unsigned int align; -+ -+ switch ((*ptr)->type) -+ { -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) -+ { -+ fparg_count++; -+ intarg_count++; -+ } -+ /* Fall through. */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ case FFI_TYPE_FLOAT: -+ fparg_count++; -+ intarg_count++; -+ if (fparg_count > NUM_FPR_ARG_REGISTERS64) -+ flags |= FLAG_ARG_NEEDS_PSAVE; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) -+ { -+ align = (*ptr)->alignment; -+ if (align > 16) -+ align = 16; -+ align = align / 8; -+ if (align > 1) -+ intarg_count = ALIGN (intarg_count, align); -+ } -+ intarg_count += ((*ptr)->size + 7) / 8; -+#if _CALL_ELF == 2 -+ elt = discover_homogeneous_aggregate (*ptr, &elnum); -+ if (elt) -+ { -+ fparg_count += elnum; -+ if (fparg_count > NUM_FPR_ARG_REGISTERS64) -+ flags |= FLAG_ARG_NEEDS_PSAVE; -+ } -+ else -+#endif -+ { -+ if (intarg_count > NUM_GPR_ARG_REGISTERS64) -+ flags |= FLAG_ARG_NEEDS_PSAVE; -+ } -+ break; -+ -+ case FFI_TYPE_POINTER: -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_INT: -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_UINT16: -+ case FFI_TYPE_SINT16: -+ case FFI_TYPE_UINT8: -+ case FFI_TYPE_SINT8: -+ /* Everything else is passed as a 8-byte word in a GPR, either -+ the object itself or a pointer to it. */ -+ intarg_count++; -+ if (intarg_count > NUM_GPR_ARG_REGISTERS64) -+ flags |= FLAG_ARG_NEEDS_PSAVE; -+ break; -+ default: -+ FFI_ASSERT (0); -+ } -+ } -+ -+ if (fparg_count != 0) -+ flags |= FLAG_FP_ARGUMENTS; -+ if (intarg_count > 4) -+ flags |= FLAG_4_GPR_ARGUMENTS; -+ -+ /* Space for the FPR registers, if needed. */ -+ if (fparg_count != 0) -+ bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); -+ -+ /* Stack space. */ -+#if _CALL_ELF == 2 -+ if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0) -+ bytes += intarg_count * sizeof (long); -+#else -+ if (intarg_count > NUM_GPR_ARG_REGISTERS64) -+ bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); -+#endif -+ -+ /* The stack space allocated needs to be a multiple of 16 bytes. */ -+ bytes = (bytes + 15) & ~0xF; -+ -+ cif->flags = flags; -+ cif->bytes = bytes; -+ -+ return FFI_OK; -+} -+ -+ffi_status FFI_HIDDEN -+ffi_prep_cif_linux64 (ffi_cif *cif) -+{ -+ if ((cif->abi & FFI_LINUX) != 0) -+ cif->nfixedargs = cif->nargs; -+#if _CALL_ELF != 2 -+ else if (cif->abi == FFI_COMPAT_LINUX64) -+ { -+ /* This call is from old code. Don't touch cif->nfixedargs -+ since old code will be using a smaller cif. */ -+ cif->flags |= FLAG_COMPAT; -+ /* Translate to new abi value. */ -+ cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128; -+ } -+#endif -+ else -+ return FFI_BAD_ABI; -+ return ffi_prep_cif_linux64_core (cif); -+} -+ -+ffi_status FFI_HIDDEN -+ffi_prep_cif_linux64_var (ffi_cif *cif, -+ unsigned int nfixedargs, -+ unsigned int ntotalargs MAYBE_UNUSED) -+{ -+ if ((cif->abi & FFI_LINUX) != 0) -+ cif->nfixedargs = nfixedargs; -+#if _CALL_ELF != 2 -+ else if (cif->abi == FFI_COMPAT_LINUX64) -+ { -+ /* This call is from old code. Don't touch cif->nfixedargs -+ since old code will be using a smaller cif. */ -+ cif->flags |= FLAG_COMPAT; -+ /* Translate to new abi value. */ -+ cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128; -+ } -+#endif -+ else -+ return FFI_BAD_ABI; -+#if _CALL_ELF == 2 -+ cif->flags |= FLAG_ARG_NEEDS_PSAVE; -+#endif -+ return ffi_prep_cif_linux64_core (cif); -+} -+ -+ -+/* ffi_prep_args64 is called by the assembly routine once stack space -+ has been allocated for the function's arguments. -+ -+ The stack layout we want looks like this: -+ -+ | Ret addr from ffi_call_LINUX64 8bytes | higher addresses -+ |--------------------------------------------| -+ | CR save area 8bytes | -+ |--------------------------------------------| -+ | Previous backchain pointer 8 | stack pointer here -+ |--------------------------------------------|<+ <<< on entry to -+ | Saved r28-r31 4*8 | | ffi_call_LINUX64 -+ |--------------------------------------------| | -+ | GPR registers r3-r10 8*8 | | -+ |--------------------------------------------| | -+ | FPR registers f1-f13 (optional) 13*8 | | -+ |--------------------------------------------| | -+ | Parameter save area | | -+ |--------------------------------------------| | -+ | TOC save area 8 | | -+ |--------------------------------------------| | stack | -+ | Linker doubleword 8 | | grows | -+ |--------------------------------------------| | down V -+ | Compiler doubleword 8 | | -+ |--------------------------------------------| | lower addresses -+ | Space for callee's LR 8 | | -+ |--------------------------------------------| | -+ | CR save area 8 | | -+ |--------------------------------------------| | stack pointer here -+ | Current backchain pointer 8 |-/ during -+ |--------------------------------------------| <<< ffi_call_LINUX64 -+ -+*/ -+ -+void FFI_HIDDEN -+ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) -+{ -+ const unsigned long bytes = ecif->cif->bytes; -+ const unsigned long flags = ecif->cif->flags; -+ -+ typedef union -+ { -+ char *c; -+ unsigned long *ul; -+ float *f; -+ double *d; -+ size_t p; -+ } valp; -+ -+ /* 'stacktop' points at the previous backchain pointer. */ -+ valp stacktop; -+ -+ /* 'next_arg' points at the space for gpr3, and grows upwards as -+ we use GPR registers, then continues at rest. */ -+ valp gpr_base; -+ valp gpr_end; -+ valp rest; -+ valp next_arg; -+ -+ /* 'fpr_base' points at the space for fpr3, and grows upwards as -+ we use FPR registers. */ -+ valp fpr_base; -+ unsigned int fparg_count; -+ -+ unsigned int i, words, nargs, nfixedargs; -+ ffi_type **ptr; -+ double double_tmp; -+ union -+ { -+ void **v; -+ char **c; -+ signed char **sc; -+ unsigned char **uc; -+ signed short **ss; -+ unsigned short **us; -+ signed int **si; -+ unsigned int **ui; -+ unsigned long **ul; -+ float **f; -+ double **d; -+ } p_argv; -+ unsigned long gprvalue; -+ unsigned long align; -+ -+ stacktop.c = (char *) stack + bytes; -+ gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; -+ gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; -+#if _CALL_ELF == 2 -+ rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64; -+#else -+ rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; -+#endif -+ fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; -+ fparg_count = 0; -+ next_arg.ul = gpr_base.ul; -+ -+ /* Check that everything starts aligned properly. */ -+ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); -+ FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); -+ FFI_ASSERT ((bytes & 0xF) == 0); -+ -+ /* Deal with return values that are actually pass-by-reference. */ -+ if (flags & FLAG_RETVAL_REFERENCE) -+ *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; -+ -+ /* Now for the arguments. */ -+ p_argv.v = ecif->avalue; -+ nargs = ecif->cif->nargs; -+#if _CALL_ELF != 2 -+ nfixedargs = (unsigned) -1; -+ if ((flags & FLAG_COMPAT) == 0) -+#endif -+ nfixedargs = ecif->cif->nfixedargs; -+ for (ptr = ecif->cif->arg_types, i = 0; -+ i < nargs; -+ i++, ptr++, p_argv.v++) +- fstat (fd, &statbuf); ++ if (fstat (fd, &statbuf) == -1) + { -+#if _CALL_ELF == 2 -+ unsigned int elt, elnum; -+#endif -+ -+ switch ((*ptr)->type) -+ { -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) -+ { -+ double_tmp = (*p_argv.d)[0]; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) -+ { -+ *fpr_base.d++ = double_tmp; -+# if _CALL_ELF != 2 -+ if ((flags & FLAG_COMPAT) != 0) -+ *next_arg.d = double_tmp; -+# endif -+ } -+ else -+ *next_arg.d = double_tmp; -+ if (++next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ fparg_count++; -+ double_tmp = (*p_argv.d)[1]; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) -+ { -+ *fpr_base.d++ = double_tmp; -+# if _CALL_ELF != 2 -+ if ((flags & FLAG_COMPAT) != 0) -+ *next_arg.d = double_tmp; -+# endif -+ } -+ else -+ *next_arg.d = double_tmp; -+ if (++next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ fparg_count++; -+ FFI_ASSERT (__LDBL_MANT_DIG__ == 106); -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+ } -+ /* Fall through. */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ double_tmp = **p_argv.d; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) -+ { -+ *fpr_base.d++ = double_tmp; -+#if _CALL_ELF != 2 -+ if ((flags & FLAG_COMPAT) != 0) -+ *next_arg.d = double_tmp; -+#endif -+ } -+ else -+ *next_arg.d = double_tmp; -+ if (++next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ fparg_count++; -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+ -+ case FFI_TYPE_FLOAT: -+ double_tmp = **p_argv.f; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) -+ { -+ *fpr_base.d++ = double_tmp; -+#if _CALL_ELF != 2 -+ if ((flags & FLAG_COMPAT) != 0) -+ *next_arg.f = (float) double_tmp; -+#endif -+ } -+ else -+ *next_arg.f = (float) double_tmp; -+ if (++next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ fparg_count++; -+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ if ((ecif->cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) -+ { -+ align = (*ptr)->alignment; -+ if (align > 16) -+ align = 16; -+ if (align > 1) -+ next_arg.p = ALIGN (next_arg.p, align); -+ } -+#if _CALL_ELF == 2 -+ elt = discover_homogeneous_aggregate (*ptr, &elnum); -+ if (elt) -+ { -+ union { -+ void *v; -+ float *f; -+ double *d; -+ } arg; -+ -+ arg.v = *p_argv.v; -+ if (elt == FFI_TYPE_FLOAT) -+ { -+ do -+ { -+ double_tmp = *arg.f++; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 -+ && i < nfixedargs) -+ *fpr_base.d++ = double_tmp; -+ else -+ *next_arg.f = (float) double_tmp; -+ if (++next_arg.f == gpr_end.f) -+ next_arg.f = rest.f; -+ fparg_count++; -+ } -+ while (--elnum != 0); -+ if ((next_arg.p & 3) != 0) -+ { -+ if (++next_arg.f == gpr_end.f) -+ next_arg.f = rest.f; -+ } -+ } -+ else -+ do -+ { -+ double_tmp = *arg.d++; -+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) -+ *fpr_base.d++ = double_tmp; -+ else -+ *next_arg.d = double_tmp; -+ if (++next_arg.d == gpr_end.d) -+ next_arg.d = rest.d; -+ fparg_count++; -+ } -+ while (--elnum != 0); -+ } -+ else -+#endif -+ { -+ words = ((*ptr)->size + 7) / 8; -+ if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) -+ { -+ size_t first = gpr_end.c - next_arg.c; -+ memcpy (next_arg.c, *p_argv.c, first); -+ memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); -+ next_arg.c = rest.c + words * 8 - first; -+ } -+ else -+ { -+ char *where = next_arg.c; -+ -+#ifndef __LITTLE_ENDIAN__ -+ /* Structures with size less than eight bytes are passed -+ left-padded. */ -+ if ((*ptr)->size < 8) -+ where += 8 - (*ptr)->size; -+#endif -+ memcpy (where, *p_argv.c, (*ptr)->size); -+ next_arg.ul += words; -+ if (next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ } -+ } -+ break; -+ -+ case FFI_TYPE_UINT8: -+ gprvalue = **p_argv.uc; -+ goto putgpr; -+ case FFI_TYPE_SINT8: -+ gprvalue = **p_argv.sc; -+ goto putgpr; -+ case FFI_TYPE_UINT16: -+ gprvalue = **p_argv.us; -+ goto putgpr; -+ case FFI_TYPE_SINT16: -+ gprvalue = **p_argv.ss; -+ goto putgpr; -+ case FFI_TYPE_UINT32: -+ gprvalue = **p_argv.ui; -+ goto putgpr; -+ case FFI_TYPE_INT: -+ case FFI_TYPE_SINT32: -+ gprvalue = **p_argv.si; -+ goto putgpr; -+ -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_POINTER: -+ gprvalue = **p_argv.ul; -+ putgpr: -+ *next_arg.ul++ = gprvalue; -+ if (next_arg.ul == gpr_end.ul) -+ next_arg.ul = rest.ul; -+ break; -+ } ++ s->st_dev = s->st_ino = -1; ++ s->file_length = 0; ++ if (errno == EBADF) ++ s->fd = -1; ++ raw_init (s); ++ return (stream *) s; + } -+ -+ FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS -+ || (next_arg.ul >= gpr_base.ul -+ && next_arg.ul <= gpr_base.ul + 4)); -+} -+ -+ -+#if _CALL_ELF == 2 -+#define MIN_CACHE_LINE_SIZE 8 -+ -+static void -+flush_icache (char *wraddr, char *xaddr, int size) -+{ -+ int i; -+ for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) -+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" -+ : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); -+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" -+ : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) -+ : "memory"); -+} -+#endif -+ -+ffi_status -+ffi_prep_closure_loc_linux64 (ffi_closure *closure, -+ ffi_cif *cif, -+ void (*fun) (ffi_cif *, void *, void **, void *), -+ void *user_data, -+ void *codeloc) -+{ -+#if _CALL_ELF == 2 -+ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; -+ -+ if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) -+ return FFI_BAD_ABI; -+ -+ tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ -+ tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ -+ tramp[2] = 0x7d8903a6; /* mtctr 12 */ -+ tramp[3] = 0x4e800420; /* bctr */ -+ /* 1: .quad function_addr */ -+ /* 2: .quad context */ -+ *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; -+ *(void **) &tramp[6] = codeloc; -+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); -+#else -+ void **tramp = (void **) &closure->tramp[0]; -+ -+ if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) -+ return FFI_BAD_ABI; -+ -+ /* Copy function address and TOC from ffi_closure_LINUX64. */ -+ memcpy (tramp, (char *) ffi_closure_LINUX64, 16); -+ tramp[2] = codeloc; -+#endif -+ -+ closure->cif = cif; -+ closure->fun = fun; -+ closure->user_data = user_data; -+ -+ return FFI_OK; -+} -+ -+ -+int FFI_HIDDEN -+ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, -+ unsigned long *pst, ffi_dblfl *pfr) -+{ -+ /* rvalue is the pointer to space for return value in closure assembly */ -+ /* pst is the pointer to parameter save area -+ (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ -+ /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ -+ -+ void **avalue; -+ ffi_type **arg_types; -+ unsigned long i, avn, nfixedargs; -+ ffi_cif *cif; -+ ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; -+ unsigned long align; -+ -+ cif = closure->cif; -+ avalue = alloca (cif->nargs * sizeof (void *)); -+ -+ /* Copy the caller's structure return value address so that the -+ closure returns the data directly to the caller. */ -+ if (cif->rtype->type == FFI_TYPE_STRUCT -+ && (cif->flags & FLAG_RETURNS_SMST) == 0) -+ { -+ rvalue = (void *) *pst; -+ pst++; -+ } -+ -+ i = 0; -+ avn = cif->nargs; -+#if _CALL_ELF != 2 -+ nfixedargs = (unsigned) -1; -+ if ((cif->flags & FLAG_COMPAT) == 0) -+#endif -+ nfixedargs = cif->nfixedargs; -+ arg_types = cif->arg_types; -+ -+ /* Grab the addresses of the arguments from the stack frame. */ -+ while (i < avn) -+ { -+ unsigned int elt, elnum; -+ -+ switch (arg_types[i]->type) -+ { -+ case FFI_TYPE_SINT8: -+ case FFI_TYPE_UINT8: -+#ifndef __LITTLE_ENDIAN__ -+ avalue[i] = (char *) pst + 7; -+ pst++; -+ break; -+#endif -+ -+ case FFI_TYPE_SINT16: -+ case FFI_TYPE_UINT16: -+#ifndef __LITTLE_ENDIAN__ -+ avalue[i] = (char *) pst + 6; -+ pst++; -+ break; -+#endif -+ -+ case FFI_TYPE_SINT32: -+ case FFI_TYPE_UINT32: -+#ifndef __LITTLE_ENDIAN__ -+ avalue[i] = (char *) pst + 4; -+ pst++; -+ break; -+#endif -+ -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_UINT64: -+ case FFI_TYPE_POINTER: -+ avalue[i] = pst; -+ pst++; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) -+ { -+ align = arg_types[i]->alignment; -+ if (align > 16) -+ align = 16; -+ if (align > 1) -+ pst = (unsigned long *) ALIGN ((size_t) pst, align); -+ } -+ elt = 0; -+#if _CALL_ELF == 2 -+ elt = discover_homogeneous_aggregate (arg_types[i], &elnum); -+#endif -+ if (elt) -+ { -+ union { -+ void *v; -+ unsigned long *ul; -+ float *f; -+ double *d; -+ size_t p; -+ } to, from; -+ -+ /* Repackage the aggregate from its parts. The -+ aggregate size is not greater than the space taken by -+ the registers so store back to the register/parameter -+ save arrays. */ -+ if (pfr + elnum <= end_pfr) -+ to.v = pfr; -+ else -+ to.v = pst; -+ -+ avalue[i] = to.v; -+ from.ul = pst; -+ if (elt == FFI_TYPE_FLOAT) -+ { -+ do -+ { -+ if (pfr < end_pfr && i < nfixedargs) -+ { -+ *to.f = (float) pfr->d; -+ pfr++; -+ } -+ else -+ *to.f = *from.f; -+ to.f++; -+ from.f++; -+ } -+ while (--elnum != 0); -+ } -+ else -+ { -+ do -+ { -+ if (pfr < end_pfr && i < nfixedargs) -+ { -+ *to.d = pfr->d; -+ pfr++; -+ } -+ else -+ *to.d = *from.d; -+ to.d++; -+ from.d++; -+ } -+ while (--elnum != 0); -+ } -+ } -+ else -+ { -+#ifndef __LITTLE_ENDIAN__ -+ /* Structures with size less than eight bytes are passed -+ left-padded. */ -+ if (arg_types[i]->size < 8) -+ avalue[i] = (char *) pst + 8 - arg_types[i]->size; -+ else -+#endif -+ avalue[i] = pst; -+ } -+ pst += (arg_types[i]->size + 7) / 8; -+ break; -+ -+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) -+ { -+ if (pfr + 1 < end_pfr && i + 1 < nfixedargs) -+ { -+ avalue[i] = pfr; -+ pfr += 2; -+ } -+ else -+ { -+ if (pfr < end_pfr && i < nfixedargs) -+ { -+ /* Passed partly in f13 and partly on the stack. -+ Move it all to the stack. */ -+ *pst = *(unsigned long *) pfr; -+ pfr++; -+ } -+ avalue[i] = pst; -+ } -+ pst += 2; -+ break; -+ } -+ /* Fall through. */ -+#endif -+ case FFI_TYPE_DOUBLE: -+ /* On the outgoing stack all values are aligned to 8 */ -+ /* there are 13 64bit floating point registers */ -+ -+ if (pfr < end_pfr && i < nfixedargs) -+ { -+ avalue[i] = pfr; -+ pfr++; -+ } -+ else -+ avalue[i] = pst; -+ pst++; -+ break; -+ -+ case FFI_TYPE_FLOAT: -+ if (pfr < end_pfr && i < nfixedargs) -+ { -+ /* Float values are stored as doubles in the -+ ffi_closure_LINUX64 code. Fix them here. */ -+ pfr->f = (float) pfr->d; -+ avalue[i] = pfr; -+ pfr++; -+ } -+ else -+ avalue[i] = pst; -+ pst++; -+ break; -+ -+ default: -+ FFI_ASSERT (0); -+ } -+ -+ i++; -+ } -+ -+ -+ (closure->fun) (cif, rvalue, avalue, closure->user_data); -+ -+ /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ -+ if ((cif->flags & FLAG_RETURNS_SMST) != 0) -+ { -+ if ((cif->flags & FLAG_RETURNS_FP) == 0) -+ return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1; -+ else if ((cif->flags & FLAG_RETURNS_64BITS) != 0) -+ return FFI_V2_TYPE_DOUBLE_HOMOG; -+ else -+ return FFI_V2_TYPE_FLOAT_HOMOG; -+ } -+ return cif->rtype->type; -+} -+#endif -Index: libffi/src/types.c -=================================================================== ---- a/src/libffi/src/types.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/types.c (.../branches/gcc-4_8-branch) -@@ -44,6 +44,17 @@ - id, NULL \ - } - -+#define FFI_NONCONST_TYPEDEF(name, type, id) \ -+struct struct_align_##name { \ -+ char c; \ -+ type x; \ -+}; \ -+ffi_type ffi_type_##name = { \ -+ sizeof(type), \ -+ offsetof(struct struct_align_##name, x), \ -+ id, NULL \ -+} -+ - /* Size and alignment are fake here. They must not be 0. */ - const ffi_type ffi_type_void = { - 1, 1, FFI_TYPE_VOID, NULL -@@ -73,5 +84,9 @@ - # endif - const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; - #elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -+# if HAVE_LONG_DOUBLE_VARIANT -+FFI_NONCONST_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); -+# else - FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); -+# endif - #endif -Index: libffi/src/prep_cif.c -=================================================================== ---- a/src/libffi/src/prep_cif.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/src/prep_cif.c (.../branches/gcc-4_8-branch) -@@ -126,6 +126,10 @@ - - cif->flags = 0; - -+#if HAVE_LONG_DOUBLE_VARIANT -+ ffi_prep_types (abi); -+#endif -+ - /* Initialize the return type if necessary */ - if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) - return FFI_BAD_TYPEDEF; -Index: libffi/ChangeLog -=================================================================== ---- a/src/libffi/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,39 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport mainline r205844. -+ 2013-11-18 Alan Modra <amodra@gmail.com> -+ * src/powerpc/ffitarget.h: Import from upstream. -+ * src/powerpc/ffi_powerpc.h: Likewise. -+ * src/powerpc/ffi.c: Likewise. -+ * src/powerpc/ffi_sysv.c: Likewise. -+ * src/powerpc/ffi_linux64.c: Likewise. -+ * src/powerpc/sysv.S: Likewise. -+ * src/powerpc/ppc_closure.S: Likewise. -+ * src/powerpc/linux64.S: Likewise. -+ * src/powerpc/linux64_closure.S: Likewise. -+ * src/types.c: Likewise. -+ * Makefile.am (EXTRA_DIST): Add new src/powerpc files. -+ (nodist_libffi_la_SOURCES <POWERPC, POWERPC_FREEBSD>): Likewise. -+ * configure.ac (HAVE_LONG_DOUBLE_VARIANT): Define for powerpc. -+ * include/ffi.h.in (ffi_prep_types): Declare. -+ * src/prep_cif.c (ffi_prep_cif_core): Call ffi_prep_types. -+ * configure: Regenerate. -+ * fficonfig.h.in: Regenerate. -+ * Makefile.in: Regenerate. -+ * man/Makefile.in: Regenerate. -+ * include/Makefile.in: Regenerate. -+ * testsuite/Makefile.in: Regenerate. -+ -+ * src/powerpc/ppc_closure.S: Don't bl .Luint128. -+ -+ * src/powerpc/ffitarget.h: Import from upstream. -+ * src/powerpc/ffi.c: Likewise. -+ * src/powerpc/linux64.S: Likewise. -+ * src/powerpc/linux64_closure.S: Likewise. -+ * doc/libffi.texi: Likewise. -+ * testsuite/libffi.call/cls_double_va.c: Likewise. -+ * testsuite/libffi.call/cls_longdouble_va.c: Likewise. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libffi/testsuite/Makefile.in -=================================================================== ---- a/src/libffi/testsuite/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/testsuite/Makefile.in (.../branches/gcc-4_8-branch) -@@ -88,6 +88,7 @@ - FGREP = @FGREP@ - GREP = @GREP@ - HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -Index: libffi/testsuite/libffi.call/cls_double_va.c -=================================================================== ---- a/src/libffi/testsuite/libffi.call/cls_double_va.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/testsuite/libffi.call/cls_double_va.c (.../branches/gcc-4_8-branch) -@@ -38,7 +38,7 @@ - - /* This printf call is variadic */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, -- arg_types) == FFI_OK); -+ arg_types) == FFI_OK); - - args[0] = &format; - args[1] = &doubleArg; -@@ -45,19 +45,17 @@ - args[2] = NULL; - - ffi_call(&cif, FFI_FN(printf), &res, args); -- // { dg-output "7.0" } -+ /* { dg-output "7.0" } */ - printf("res: %d\n", (int) res); -- // { dg-output "\nres: 4" } -+ /* { dg-output "\nres: 4" } */ - -- /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ -- CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); -+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, -+ code) == FFI_OK); - -- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); -- -- res = ((int(*)(char*, double))(code))(format, doubleArg); -- // { dg-output "\n7.0" } -+ res = ((int(*)(char*, ...))(code))(format, doubleArg); -+ /* { dg-output "\n7.0" } */ - printf("res: %d\n", (int) res); -- // { dg-output "\nres: 4" } -+ /* { dg-output "\nres: 4" } */ - - exit(0); - } -Index: libffi/testsuite/libffi.call/cls_longdouble_va.c -=================================================================== ---- a/src/libffi/testsuite/libffi.call/cls_longdouble_va.c (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/testsuite/libffi.call/cls_longdouble_va.c (.../branches/gcc-4_8-branch) -@@ -38,7 +38,7 @@ - - /* This printf call is variadic */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, -- arg_types) == FFI_OK); -+ arg_types) == FFI_OK); - - args[0] = &format; - args[1] = &ldArg; -@@ -45,20 +45,17 @@ - args[2] = NULL; - - ffi_call(&cif, FFI_FN(printf), &res, args); -- // { dg-output "7.0" } -+ /* { dg-output "7.0" } */ - printf("res: %d\n", (int) res); -- // { dg-output "\nres: 4" } -+ /* { dg-output "\nres: 4" } */ - -- /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ -- CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, -- arg_types) == FFI_OK); -+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, -+ code) == FFI_OK); - -- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); -- -- res = ((int(*)(char*, long double))(code))(format, ldArg); -- // { dg-output "\n7.0" } -+ res = ((int(*)(char*, ...))(code))(format, ldArg); -+ /* { dg-output "\n7.0" } */ - printf("res: %d\n", (int) res); -- // { dg-output "\nres: 4" } -+ /* { dg-output "\nres: 4" } */ - - exit(0); - } -Index: libffi/configure.ac -=================================================================== ---- a/src/libffi/configure.ac (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/configure.ac (.../branches/gcc-4_8-branch) -@@ -65,6 +65,7 @@ - AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) - - TARGETDIR="unknown" -+HAVE_LONG_DOUBLE_VARIANT=0 - case "$host" in - aarch64*-*-*) - TARGET=AARCH64; TARGETDIR=aarch64 -@@ -162,6 +163,7 @@ - - powerpc*-*-linux* | powerpc-*-sysv*) - TARGET=POWERPC; TARGETDIR=powerpc -+ HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc-*-amigaos*) - TARGET=POWERPC; TARGETDIR=powerpc -@@ -177,6 +179,7 @@ - ;; - powerpc-*-freebsd* | powerpc-*-openbsd*) - TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc -+ HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc64-*-freebsd*) - TARGET=POWERPC; TARGETDIR=powerpc -@@ -273,14 +276,20 @@ - # Also AC_SUBST this variable for ffi.h. - if test -z "$HAVE_LONG_DOUBLE"; then - HAVE_LONG_DOUBLE=0 -- if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then -- if test $ac_cv_sizeof_long_double != 0; then -+ if test $ac_cv_sizeof_long_double != 0; then -+ if test $HAVE_LONG_DOUBLE_VARIANT != 0; then -+ AC_DEFINE(HAVE_LONG_DOUBLE_VARIANT, 1, [Define if you support more than one size of the long double type]) - HAVE_LONG_DOUBLE=1 -- AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) -+ else -+ if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then -+ HAVE_LONG_DOUBLE=1 -+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) -+ fi - fi - fi - fi - AC_SUBST(HAVE_LONG_DOUBLE) -+AC_SUBST(HAVE_LONG_DOUBLE_VARIANT) - - AC_C_BIGENDIAN - -Index: libffi/Makefile.am -=================================================================== ---- a/src/libffi/Makefile.am (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/Makefile.am (.../branches/gcc-4_8-branch) -@@ -15,10 +15,12 @@ - src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ - src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ - src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ -- src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \ -- src/powerpc/linux64.S src/powerpc/linux64_closure.S \ -- src/powerpc/ppc_closure.S src/powerpc/asm.h \ -- src/powerpc/aix.S src/powerpc/darwin.S \ -+ src/m68k/ffitarget.h \ -+ src/powerpc/ffi.c src/powerpc/ffi_powerpc.h \ -+ src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \ -+ src/powerpc/sysv.S src/powerpc/linux64.S \ -+ src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ -+ src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ - src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ - src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ - src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ -@@ -179,7 +181,7 @@ - nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S - endif - if POWERPC --nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S -+nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S - endif - if POWERPC_AIX - nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S -@@ -188,7 +190,7 @@ - nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S - endif - if POWERPC_FREEBSD --nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S -+nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/sysv.S src/powerpc/ppc_closure.S - endif - if AARCH64 - nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c -Index: libffi/man/Makefile.in -=================================================================== ---- a/src/libffi/man/Makefile.in (.../tags/gcc_4_8_2_release) -+++ b/src/libffi/man/Makefile.in (.../branches/gcc-4_8-branch) -@@ -111,6 +111,7 @@ - FGREP = @FGREP@ - GREP = @GREP@ - HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ - INSTALL = @INSTALL@ - INSTALL_DATA = @INSTALL_DATA@ - INSTALL_PROGRAM = @INSTALL_PROGRAM@ -Index: libssp/configure -=================================================================== ---- a/src/libssp/configure (.../tags/gcc_4_8_2_release) -+++ b/src/libssp/configure (.../branches/gcc-4_8-branch) -@@ -6385,7 +6385,7 @@ - rm -rf conftest* - ;; - --x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ - s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext -@@ -6410,7 +6410,10 @@ - ;; - esac - ;; -- ppc64-*linux*|powerpc64-*linux*) -+ powerpc64le-*linux*) -+ LD="${LD-ld} -m elf32lppclinux" -+ ;; -+ powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) -@@ -6429,7 +6432,10 @@ - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; -- ppc*-*linux*|powerpc*-*linux*) -+ powerpcle-*linux*) -+ LD="${LD-ld} -m elf64lppc" -+ ;; -+ powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) -@@ -10658,7 +10664,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10661 "configure" -+#line 10667 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -10764,7 +10770,7 @@ - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10767 "configure" -+#line 10773 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -Index: libcpp/macro.c -=================================================================== ---- a/src/libcpp/macro.c (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/macro.c (.../branches/gcc-4_8-branch) -@@ -1108,21 +1108,22 @@ - - if (macro->paramc == 0) - { -+ unsigned tokens_count = macro_real_token_count (macro); - if (CPP_OPTION (pfile, track_macro_expansion)) - { -- unsigned int i, count = macro->count; -+ unsigned int i; - const cpp_token *src = macro->exp.tokens; - const struct line_map *map; - source_location *virt_locs = NULL; -- _cpp_buff *macro_tokens = -- tokens_buff_new (pfile, count, &virt_locs); -+ _cpp_buff *macro_tokens -+ = tokens_buff_new (pfile, tokens_count, &virt_locs); - - /* Create a macro map to record the locations of the - tokens that are involved in the expansion. LOCATION - is the location of the macro expansion point. */ -- map = linemap_enter_macro (pfile->line_table, -- node, location, count); -- for (i = 0; i < count; ++i) -+ map = linemap_enter_macro (pfile->line_table, -+ node, location, tokens_count); -+ for (i = 0; i < tokens_count; ++i) - { - tokens_buff_add_token (macro_tokens, virt_locs, - src, src->src_loc, -@@ -1134,16 +1135,12 @@ - virt_locs, - (const cpp_token **) - macro_tokens->base, -- count); -- num_macro_tokens_counter += count; -+ tokens_count); - } - else -- { -- unsigned tokens_count = macro_real_token_count (macro); -- _cpp_push_token_context (pfile, node, macro->exp.tokens, -- tokens_count); -- num_macro_tokens_counter += tokens_count; -- } -+ _cpp_push_token_context (pfile, node, macro->exp.tokens, -+ tokens_count); -+ num_macro_tokens_counter += tokens_count; - } - - if (pragma_buff) -Index: libcpp/line-map.c -=================================================================== ---- a/src/libcpp/line-map.c (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/line-map.c (.../branches/gcc-4_8-branch) -@@ -1024,6 +1024,11 @@ - bool pre_virtual_p, post_virtual_p; - source_location l0 = pre, l1 = post; - -+ if (IS_ADHOC_LOC (l0)) -+ l0 = set->location_adhoc_data_map.data[l0 & MAX_SOURCE_LOCATION].locus; -+ if (IS_ADHOC_LOC (l1)) -+ l1 = set->location_adhoc_data_map.data[l1 & MAX_SOURCE_LOCATION].locus; -+ - if (l0 == l1) - return 0; - -Index: libcpp/files.c -=================================================================== ---- a/src/libcpp/files.c (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/files.c (.../branches/gcc-4_8-branch) -@@ -983,6 +983,7 @@ - { - struct cpp_dir *dir; - _cpp_file *file; -+ bool stacked; - - dir = search_path_head (pfile, fname, angle_brackets, type); - if (!dir) -@@ -993,19 +994,26 @@ - if (type == IT_DEFAULT && file == NULL) - return false; - -- /* Compensate for the increment in linemap_add that occurs in -- _cpp_stack_file. In the case of a normal #include, we're -- currently at the start of the line *following* the #include. A -- separate source_location for this location makes no sense (until -- we do the LC_LEAVE), and complicates LAST_SOURCE_LINE_LOCATION. -- This does not apply if we found a PCH file (in which case -- linemap_add is not called) or we were included from the -- command-line. */ -+ /* Compensate for the increment in linemap_add that occurs if -+ _cpp_stack_file actually stacks the file. In the case of a -+ normal #include, we're currently at the start of the line -+ *following* the #include. A separate source_location for this -+ location makes no sense (until we do the LC_LEAVE), and -+ complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we -+ found a PCH file (in which case linemap_add is not called) or we -+ were included from the command-line. */ - if (file->pchname == NULL && file->err_no == 0 - && type != IT_CMDLINE && type != IT_DEFAULT) - pfile->line_table->highest_location--; - -- return _cpp_stack_file (pfile, file, type == IT_IMPORT); -+ stacked = _cpp_stack_file (pfile, file, type == IT_IMPORT); -+ -+ if (!stacked) -+ /* _cpp_stack_file didn't stack the file, so let's rollback the -+ compensation dance we performed above. */ -+ pfile->line_table->highest_location++; -+ -+ return stacked; - } - - /* Could not open FILE. The complication is dependency output. */ -Index: libcpp/ChangeLog -=================================================================== ---- a/src/libcpp/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,36 @@ -+2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ Backport from mainline -+ 2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com> -+ -+ * lex.c (search_line_fast): Correct for little endian. -+ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ Backport from mainline -+ 2014-02-19 Jakub Jelinek <jakub@redhat.com> -+ -+ PR preprocessor/58844 -+ * macro.c (enter_macro_context): Only push -+ macro_real_token_count (macro) tokens rather than -+ macro->count tokens, regardless of -+ CPP_OPTION (pfile, track-macro-expansion). -+ -+ 2014-02-07 Jakub Jelinek <jakub@redhat.com> -+ -+ PR preprocessor/56824 -+ * line-map.c (linemap_compare_locations): Look through adhoc locations -+ for both l0 and l1. -+ -+2014-03-06 Jakub Jelinek <jakub@redhat.com> -+ -+ PR preprocessor/60400 -+ Backport from mainline -+ 2013-06-24 Dehao Chen <dehao@google.com> -+ -+ * files.c (_cpp_stack_include): Fix the highest_location when header -+ file is guarded by #ifndef and is included twice. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libcpp/lex.c -=================================================================== ---- a/src/libcpp/lex.c (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/lex.c (.../branches/gcc-4_8-branch) -@@ -559,8 +559,13 @@ - beginning with all ones and shifting in zeros according to the - mis-alignment. The LVSR instruction pulls the exact shift we - want from the address. */ -+#ifdef __BIG_ENDIAN__ - mask = __builtin_vec_lvsr(0, s); - mask = __builtin_vec_perm(zero, ones, mask); -+#else -+ mask = __builtin_vec_lvsl(0, s); -+ mask = __builtin_vec_perm(ones, zero, mask); -+#endif - data &= mask; - - /* While altivec loads mask addresses, we still need to align S so -@@ -624,7 +629,11 @@ - /* L now contains 0xff in bytes for which we matched one of the - relevant characters. We can find the byte index by finding - its bit index and dividing by 8. */ -+#ifdef __BIG_ENDIAN__ - l = __builtin_clzl(l) >> 3; -+#else -+ l = __builtin_ctzl(l) >> 3; -+#endif - return s + l; - - #undef N -Index: libcpp/po/pt_BR.po -=================================================================== ---- a/src/libcpp/po/pt_BR.po (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/po/pt_BR.po (.../branches/gcc-4_8-branch) -@@ -0,0 +1,908 @@ -+# Brazilian Portuguese translation for cpplib -+# Copyright (C) 2013 Free Software Foundation, Inc. -+# This file is distributed under the same license as the gcc package. -+# Rafael Ferreira <rafael.f.f1@gmail.com>, 2013. -+# -+msgid "" -+msgstr "" -+"Project-Id-Version: cpplib 4.8.0\n" -+"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" -+"POT-Creation-Date: 2013-03-15 17:42+0000\n" -+"PO-Revision-Date: 2013-12-18 03:12-0300\n" -+"Last-Translator: Rafael Ferreira <rafael.f.f1@gmail.com>\n" -+"Language-Team: Brazilian Portuguese <ldpbr-translation@lists.sourceforge.net>\n" -+"Language: pt_BR\n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"X-Generator: Poedit 1.5.7\n" -+"Plural-Forms: nplurals=2; plural=(n > 1);\n" -+ -+#: charset.c:673 -+#, c-format -+msgid "conversion from %s to %s not supported by iconv" -+msgstr "sem suporte a conversão de %s para %s por iconv" -+ -+#: charset.c:676 -+msgid "iconv_open" -+msgstr "iconv_open" -+ -+#: charset.c:684 -+#, c-format -+msgid "no iconv implementation, cannot convert from %s to %s" -+msgstr "nenhuma implementação iconv, não foi possível converter de %s para %s" -+ -+#: charset.c:780 -+#, c-format -+msgid "character 0x%lx is not in the basic source character set\n" -+msgstr "caractere 0x%lx não está no conjunto de caracteres fonte básico\n" -+ -+#: charset.c:797 charset.c:1443 -+msgid "converting to execution character set" -+msgstr "convertendo para conjunto de caracteres da execução" -+ -+#: charset.c:803 -+#, c-format -+msgid "character 0x%lx is not unibyte in execution character set" -+msgstr "caractere 0x%lx não é unibyte no conjunto de caracteres de execução" -+ -+#: charset.c:927 -+#, c-format -+msgid "Character %x might not be NFKC" -+msgstr "Caractere %x pode não ser NFKC" -+ -+#: charset.c:993 -+msgid "universal character names are only valid in C++ and C99" -+msgstr "nomes de caractere universais são válidos apenas em C++ e C99" -+ -+#: charset.c:996 -+#, c-format -+msgid "the meaning of '\\%c' is different in traditional C" -+msgstr "o significado de \"\\%c\" é diferente em C tradicional" -+ -+#: charset.c:1005 -+msgid "In _cpp_valid_ucn but not a UCN" -+msgstr "Em _cpp_valid_ucn, mas não é um UCN" -+ -+#: charset.c:1030 -+#, c-format -+msgid "incomplete universal character name %.*s" -+msgstr "nome de caractere universal incompleto %.*s" -+ -+#: charset.c:1045 -+#, c-format -+msgid "%.*s is not a valid universal character" -+msgstr "%.*s não é um caractere universal válido" -+ -+#: charset.c:1055 lex.c:1117 -+msgid "'$' in identifier or number" -+msgstr "\"$\" em identificador ou número" -+ -+#: charset.c:1065 -+#, c-format -+msgid "universal character %.*s is not valid in an identifier" -+msgstr "caractere universal %.*s não é válido em um identificador" -+ -+#: charset.c:1069 -+#, c-format -+msgid "universal character %.*s is not valid at the start of an identifier" -+msgstr "caractere universal %.*s não é válido no começo de um identificador" -+ -+#: charset.c:1101 charset.c:1673 -+msgid "converting UCN to source character set" -+msgstr "convertendo UCN para conjunto de caracteres fonte" -+ -+#: charset.c:1105 -+msgid "converting UCN to execution character set" -+msgstr "convertendo UCN para conjunto de caracteres de execução" -+ -+#: charset.c:1177 -+msgid "the meaning of '\\x' is different in traditional C" -+msgstr "o significado de \"\\x\" é diferente em C tradicional" -+ -+#: charset.c:1194 -+msgid "\\x used with no following hex digits" -+msgstr "\\x usado com nenhum dígito hexa" -+ -+#: charset.c:1201 -+msgid "hex escape sequence out of range" -+msgstr "sequência de escape hexa fora de alcance" -+ -+#: charset.c:1239 -+msgid "octal escape sequence out of range" -+msgstr "sequência de escape octal fora de alcance" -+ -+#: charset.c:1305 -+msgid "the meaning of '\\a' is different in traditional C" -+msgstr "o significado de \"\\a\" é diferente em C tradicional" -+ -+#: charset.c:1312 -+#, c-format -+msgid "non-ISO-standard escape sequence, '\\%c'" -+msgstr "sequência de escape não padrão ISO, \"\\%c\"" -+ -+#: charset.c:1320 -+#, c-format -+msgid "unknown escape sequence: '\\%c'" -+msgstr "sequência de escape desconhecida: \"\\%c\"" -+ -+#: charset.c:1328 -+#, c-format -+msgid "unknown escape sequence: '\\%s'" -+msgstr "sequência de escape desconhecida: \"\\%s\"" -+ -+#: charset.c:1335 -+msgid "converting escape sequence to execution character set" -+msgstr "convertendo sequência de escape para conjunto de caracteres de execução" -+ -+#: charset.c:1508 charset.c:1572 -+msgid "character constant too long for its type" -+msgstr "constante caractere muito longa para seu tipo" -+ -+#: charset.c:1511 -+msgid "multi-character character constant" -+msgstr "constante de caractere multi-caractere" -+ -+#: charset.c:1611 -+msgid "empty character constant" -+msgstr "constante caractere vazia" -+ -+#: charset.c:1720 -+#, c-format -+msgid "failure to convert %s to %s" -+msgstr "falha ao converter %s para %s" -+ -+#: directives.c:224 directives.c:250 -+#, c-format -+msgid "extra tokens at end of #%s directive" -+msgstr "tokens extras ao final da diretiva %#s" -+ -+#: directives.c:357 -+#, c-format -+msgid "#%s is a GCC extension" -+msgstr "#%s é uma extensão GCC" -+ -+#: directives.c:362 -+#, c-format -+msgid "#%s is a deprecated GCC extension" -+msgstr "#%s é uma extensão GCC obsoleta" -+ -+#: directives.c:375 -+msgid "suggest not using #elif in traditional C" -+msgstr "sugere-se não usar #elif em C tradicional" -+ -+#: directives.c:378 -+#, c-format -+msgid "traditional C ignores #%s with the # indented" -+msgstr "C tradicional ignora #%s com o # com recuo" -+ -+#: directives.c:382 -+#, c-format -+msgid "suggest hiding #%s from traditional C with an indented #" -+msgstr "sugere-se ocultar #%s do C tradicional com um # com recuo" -+ -+#: directives.c:408 -+msgid "embedding a directive within macro arguments is not portable" -+msgstr "embutir uma diretiva dentro de argumentos macro não é portátil" -+ -+#: directives.c:428 -+msgid "style of line directive is a GCC extension" -+msgstr "estilo de diretiva de linha é uma extensão GCC" -+ -+#: directives.c:483 -+#, c-format -+msgid "invalid preprocessing directive #%s" -+msgstr "diretiva de preprocessamento inválida #%s" -+ -+#: directives.c:551 -+msgid "\"defined\" cannot be used as a macro name" -+msgstr "\"defined\" não pode ser usado como um nome de macro" -+ -+#: directives.c:557 -+#, c-format -+msgid "\"%s\" cannot be used as a macro name as it is an operator in C++" -+msgstr "\"%s\" não pode ser usado como um nome de macro, pois é um operador em C++" -+ -+#: directives.c:560 -+#, c-format -+msgid "no macro name given in #%s directive" -+msgstr "nenhum nome de macro fornecido na diretiva #%s" -+ -+#: directives.c:563 -+msgid "macro names must be identifiers" -+msgstr "nomes de macro devem ser identificadores" -+ -+#: directives.c:612 -+#, c-format -+msgid "undefining \"%s\"" -+msgstr "removendo definição de \"%s\"" -+ -+#: directives.c:667 -+msgid "missing terminating > character" -+msgstr "faltando caractere terminador >" -+ -+#: directives.c:726 -+#, c-format -+msgid "#%s expects \"FILENAME\" or <FILENAME>" -+msgstr "#%s espera \"NOME DE ARQUIVO\" OU <NOME DE ARQUIVO>" -+ -+#: directives.c:772 -+#, c-format -+msgid "empty filename in #%s" -+msgstr "nome de arquivo vazio em #%s" -+ -+#: directives.c:782 -+msgid "#include nested too deeply" -+msgstr "#include aninhado profundo demais" -+ -+#: directives.c:823 -+msgid "#include_next in primary source file" -+msgstr "#include_next no arquivo fonte primário" -+ -+#: directives.c:849 -+#, c-format -+msgid "invalid flag \"%s\" in line directive" -+msgstr "opção inválida \"%s\" na diretiva line" -+ -+#: directives.c:909 -+msgid "unexpected end of file after #line" -+msgstr "fim de arquivo inesperado após #line" -+ -+#: directives.c:912 -+#, c-format -+msgid "\"%s\" after #line is not a positive integer" -+msgstr "\"%s\" após #line não é um inteiro positivo" -+ -+#: directives.c:918 directives.c:920 -+msgid "line number out of range" -+msgstr "número da linha fora de alcance" -+ -+#: directives.c:933 directives.c:1013 -+#, c-format -+msgid "\"%s\" is not a valid filename" -+msgstr "\"%s\" não é um nome de arquivo válido" -+ -+#: directives.c:973 -+#, c-format -+msgid "\"%s\" after # is not a positive integer" -+msgstr "\"%s\" após # não é um inteiro positivo" -+ -+#: directives.c:1068 directives.c:1070 directives.c:1072 directives.c:1658 -+#, c-format -+msgid "%s" -+msgstr "%s" -+ -+#: directives.c:1096 -+#, c-format -+msgid "invalid #%s directive" -+msgstr "diretiva inválida #%s" -+ -+#: directives.c:1159 -+#, c-format -+msgid "registering pragmas in namespace \"%s\" with mismatched name expansion" -+msgstr "registrando pragmas em espaço de nomes \"%s\" com expansão de nome incompatível" -+ -+#: directives.c:1168 -+#, c-format -+msgid "registering pragma \"%s\" with name expansion and no namespace" -+msgstr "registrando pragma \"%s\" com expansão de nome e nenhum espaço de nomes" -+ -+#: directives.c:1186 -+#, c-format -+msgid "registering \"%s\" as both a pragma and a pragma namespace" -+msgstr "registrando \"%s\" como tanto um pragma e um espaço de nomes de pragma" -+ -+#: directives.c:1189 -+#, c-format -+msgid "#pragma %s %s is already registered" -+msgstr "#pragma %s %s já está registrado" -+ -+#: directives.c:1192 -+#, c-format -+msgid "#pragma %s is already registered" -+msgstr "#pragma %s já está registrado" -+ -+#: directives.c:1222 -+msgid "registering pragma with NULL handler" -+msgstr "registrando pragma com manipulador NULO" -+ -+#: directives.c:1439 -+msgid "#pragma once in main file" -+msgstr "#pragma ocorre uma vez no arquivo principal" -+ -+#: directives.c:1462 -+msgid "invalid #pragma push_macro directive" -+msgstr "diretiva inválida #pragma push_macro" -+ -+#: directives.c:1517 -+msgid "invalid #pragma pop_macro directive" -+msgstr "diretiva inválida #pragma pop_macro" -+ -+#: directives.c:1572 -+msgid "invalid #pragma GCC poison directive" -+msgstr "diretiva inválida #pragma GCC poison" -+ -+#: directives.c:1581 -+#, c-format -+msgid "poisoning existing macro \"%s\"" -+msgstr "envenenando macro existente \"%s\"" -+ -+#: directives.c:1600 -+msgid "#pragma system_header ignored outside include file" -+msgstr "#pragma system_header ignorado fora do arquivo include" -+ -+#: directives.c:1625 -+#, c-format -+msgid "cannot find source file %s" -+msgstr "não foi possível localizar o arquivo fonte %s" -+ -+#: directives.c:1629 -+#, c-format -+msgid "current file is older than %s" -+msgstr "arquivo atual é mais velho do que %s" -+ -+#: directives.c:1653 -+#, c-format -+msgid "invalid \"#pragma GCC %s\" directive" -+msgstr "diretiva inválida \"#pragma GCC %s\"" -+ -+#: directives.c:1847 -+msgid "_Pragma takes a parenthesized string literal" -+msgstr "_Pragma leva uma literal de string entre parenteses" -+ -+#: directives.c:1968 -+msgid "#else without #if" -+msgstr "#else sem #if" -+ -+#: directives.c:1973 -+msgid "#else after #else" -+msgstr "#else após #else" -+ -+#: directives.c:1975 directives.c:2008 -+msgid "the conditional began here" -+msgstr "a condicional começou aqui" -+ -+#: directives.c:2001 -+msgid "#elif without #if" -+msgstr "#elif sem #if" -+ -+#: directives.c:2006 -+msgid "#elif after #else" -+msgstr "#elif após #else" -+ -+#: directives.c:2044 -+msgid "#endif without #if" -+msgstr "#endif sem #if" -+ -+#: directives.c:2124 -+msgid "missing '(' after predicate" -+msgstr "faltando \"(\" após predicado" -+ -+#: directives.c:2139 -+msgid "missing ')' to complete answer" -+msgstr "faltando \")\" para uma resposta completa" -+ -+#: directives.c:2159 -+msgid "predicate's answer is empty" -+msgstr "resposta do predicado está vazia" -+ -+#: directives.c:2186 -+msgid "assertion without predicate" -+msgstr "asserção sem predicado" -+ -+#: directives.c:2189 -+msgid "predicate must be an identifier" -+msgstr "predicado deve ser um identificador" -+ -+#: directives.c:2275 -+#, c-format -+msgid "\"%s\" re-asserted" -+msgstr "\"%s\" re-assertado" -+ -+#: directives.c:2567 -+#, c-format -+msgid "unterminated #%s" -+msgstr "#%s não terminado" -+ -+#: directives-only.c:221 lex.c:2234 traditional.c:162 -+msgid "unterminated comment" -+msgstr "comentário não terminado" -+ -+#: errors.c:234 -+msgid "stdout" -+msgstr "saída padrão" -+ -+#: errors.c:236 -+#, c-format -+msgid "%s: %s" -+msgstr "%s: %s" -+ -+#: expr.c:479 expr.c:577 -+msgid "fixed-point constants are a GCC extension" -+msgstr "constantes de ponto fixo (fixed-point constants) é uma extensão GCC" -+ -+#: expr.c:504 -+msgid "invalid prefix \"0b\" for floating constant" -+msgstr "prefixo inválido \"0b\" para constante flutuante" -+ -+#: expr.c:514 -+msgid "use of C99 hexadecimal floating constant" -+msgstr "uso de constante flutuante hexadecimal de C99" -+ -+#: expr.c:545 -+#, c-format -+msgid "invalid suffix \"%.*s\" on floating constant" -+msgstr "sufixo inválido \"%.*s\" na constante flutuante" -+ -+#: expr.c:556 expr.c:616 -+#, c-format -+msgid "traditional C rejects the \"%.*s\" suffix" -+msgstr "C tradicional rejeita o sufixo \"%.*s\"" -+ -+#: expr.c:564 -+msgid "suffix for double constant is a GCC extension" -+msgstr "sufixo para constante dupla (suffix for double constant) é uma extensão GCC" -+ -+#: expr.c:570 -+#, c-format -+msgid "invalid suffix \"%.*s\" with hexadecimal floating constant" -+msgstr "sufixo inválido \"%.*s\" com constante flutuante hexadecimal" -+ -+#: expr.c:581 -+msgid "decimal float constants are a GCC extension" -+msgstr "constantes flutuante decimais (decimal float constants) é uma extensão GCC" -+ -+#: expr.c:599 -+#, c-format -+msgid "invalid suffix \"%.*s\" on integer constant" -+msgstr "sufixo inválido \"%.*s\" em constante inteiro" -+ -+#: expr.c:624 -+msgid "use of C++0x long long integer constant" -+msgstr "uso de constante longo longo inteiro de C++0x" -+ -+#: expr.c:625 -+msgid "use of C99 long long integer constant" -+msgstr "uso de constante longo longo inteiro de C99" -+ -+#: expr.c:641 -+msgid "imaginary constants are a GCC extension" -+msgstr "constantes imaginárias (imaginary constants) é uma extensão GCC" -+ -+#: expr.c:644 -+msgid "binary constants are a GCC extension" -+msgstr "constantes binárias (binary constants) é uma extensão GCC" -+ -+#: expr.c:737 -+msgid "integer constant is too large for its type" -+msgstr "constante inteira é muito grande para seu tipo" -+ -+#: expr.c:768 -+msgid "integer constant is so large that it is unsigned" -+msgstr "constante inteira é tão grande que não está assinada" -+ -+#: expr.c:863 -+msgid "missing ')' after \"defined\"" -+msgstr "faltando \")\" após \"defined\"" -+ -+#: expr.c:870 -+msgid "operator \"defined\" requires an identifier" -+msgstr "operador \"defined\" requer um identificador" -+ -+#: expr.c:878 -+#, c-format -+msgid "(\"%s\" is an alternative token for \"%s\" in C++)" -+msgstr "(\"%s\" é um token alternativo para \"%s\" em C++)" -+ -+#: expr.c:888 -+msgid "this use of \"defined\" may not be portable" -+msgstr "esse uso de \"defined\" pode não ser portátil" -+ -+#: expr.c:948 -+msgid "user-defined literal in preprocessor expression" -+msgstr "literal definida pelo usuário em expressão do preprocessador" -+ -+#: expr.c:953 -+msgid "floating constant in preprocessor expression" -+msgstr "constante flutuante em expressão do preprocessador" -+ -+#: expr.c:959 -+msgid "imaginary number in preprocessor expression" -+msgstr "número imaginário em expressão do preprocessador" -+ -+#: expr.c:1007 -+#, c-format -+msgid "\"%s\" is not defined" -+msgstr "\"%s\" não está definido" -+ -+#: expr.c:1020 -+msgid "assertions are a GCC extension" -+msgstr "asserções (assertions) é uma extensão GCC" -+ -+#: expr.c:1023 -+msgid "assertions are a deprecated extension" -+msgstr "asserções (assertions) é uma extensão obsoleta" -+ -+#: expr.c:1268 -+#, c-format -+msgid "unbalanced stack in %s" -+msgstr "pilha não balanceada em %s" -+ -+#: expr.c:1288 -+#, c-format -+msgid "impossible operator '%u'" -+msgstr "operador impossível \"%u\"" -+ -+#: expr.c:1389 -+msgid "missing ')' in expression" -+msgstr "faltando \")\" na expressão" -+ -+#: expr.c:1418 -+msgid "'?' without following ':'" -+msgstr "\"?\" sem estar seguido por \":\"" -+ -+#: expr.c:1428 -+msgid "integer overflow in preprocessor expression" -+msgstr "estouro de inteiro em expressão do preprocessador" -+ -+#: expr.c:1433 -+msgid "missing '(' in expression" -+msgstr "faltando \"(\" na expressão" -+ -+#: expr.c:1465 -+#, c-format -+msgid "the left operand of \"%s\" changes sign when promoted" -+msgstr "o operador à esquerda de \"%s\" altera o sinal quando promovido" -+ -+#: expr.c:1470 -+#, c-format -+msgid "the right operand of \"%s\" changes sign when promoted" -+msgstr "o operador à direita de \"%s\" altera o sinal quando promovido" -+ -+#: expr.c:1729 -+msgid "traditional C rejects the unary plus operator" -+msgstr "C tradicional rejeita o operador unário mais" -+ -+#: expr.c:1812 -+msgid "comma operator in operand of #if" -+msgstr "operador vírgula em operando de #if" -+ -+#: expr.c:1948 -+msgid "division by zero in #if" -+msgstr "divisão por zero em #if" -+ -+#: files.c:505 -+msgid "NULL directory in find_file" -+msgstr "diretório NULO em find_file" -+ -+#: files.c:553 -+msgid "one or more PCH files were found, but they were invalid" -+msgstr "um ou mais arquivos PCH foram encontrados, mas são inválidos" -+ -+#: files.c:556 -+msgid "use -Winvalid-pch for more information" -+msgstr "use -Winvalid-pch para mais informações" -+ -+#: files.c:660 -+#, c-format -+msgid "%s is a block device" -+msgstr "%s é um dispositivo de bloco" -+ -+#: files.c:677 -+#, c-format -+msgid "%s is too large" -+msgstr "%s é muito grande" -+ -+#: files.c:717 -+#, c-format -+msgid "%s is shorter than expected" -+msgstr "%s é muito menor do que esperado" -+ -+#: files.c:953 -+#, c-format -+msgid "no include path in which to search for %s" -+msgstr "não foi incluído nenhum caminho no qual se possa procurar por %s" -+ -+#: files.c:1381 -+msgid "Multiple include guards may be useful for:\n" -+msgstr "Múltiplos include guards podem ser úteis para:\n" -+ -+#: init.c:524 -+msgid "cppchar_t must be an unsigned type" -+msgstr "cppchar_t deve ser um tipo não assinado" -+ -+#: init.c:528 -+#, c-format -+msgid "preprocessor arithmetic has maximum precision of %lu bits; target requires %lu bits" -+msgstr "aritmética do preprocessador possui uma precisão máxima de %lu bits; o alvo requer %lu bits" -+ -+#: init.c:535 -+msgid "CPP arithmetic must be at least as precise as a target int" -+msgstr "aritmética do CPP deve ser pelo menos tão precisa quanto um int alvo" -+ -+#: init.c:538 -+msgid "target char is less than 8 bits wide" -+msgstr "char alvo é menor do que 8 bits" -+ -+#: init.c:542 -+msgid "target wchar_t is narrower than target char" -+msgstr "wchar_t alvo é mais estreito do que o char alvo" -+ -+#: init.c:546 -+msgid "target int is narrower than target char" -+msgstr "int alvo é mais estreito do que o char alvo" -+ -+#: init.c:551 -+msgid "CPP half-integer narrower than CPP character" -+msgstr "meio-inteiro do CPP é mais estreito do que o caractere do CPP" -+ -+#: init.c:555 -+#, c-format -+msgid "CPP on this host cannot handle wide character constants over %lu bits, but the target requires %lu bits" -+msgstr "CPP nesta máquina não consegue manipular constantes de wide character acima de %lu bits, mas o alvo requer %lu bits" -+ -+#: lex.c:910 -+msgid "backslash and newline separated by space" -+msgstr "barra invertida e nova linha separadas por espaço" -+ -+#: lex.c:915 -+msgid "backslash-newline at end of file" -+msgstr "barra invertida e nova linha no final do arquivo" -+ -+#: lex.c:931 -+#, c-format -+msgid "trigraph ??%c converted to %c" -+msgstr "trígrafo ??%c convertido para %c" -+ -+#: lex.c:939 -+#, c-format -+msgid "trigraph ??%c ignored, use -trigraphs to enable" -+msgstr "trígrafo ??%c ignorado, use -trigraphs para habilitá-lo" -+ -+#: lex.c:988 -+msgid "\"/*\" within comment" -+msgstr "\"/*\" dentro de comentário" -+ -+#: lex.c:1046 -+#, c-format -+msgid "%s in preprocessing directive" -+msgstr "%s em diretiva de preprocessamento" -+ -+#: lex.c:1055 -+msgid "null character(s) ignored" -+msgstr "um ou mais caracteres nulos ignorados" -+ -+#: lex.c:1092 -+#, c-format -+msgid "`%.*s' is not in NFKC" -+msgstr "\"%.*s\" não está em NFKC" -+ -+#: lex.c:1095 -+#, c-format -+msgid "`%.*s' is not in NFC" -+msgstr "\"%.*s\" não está em NFC" -+ -+#: lex.c:1164 lex.c:1241 -+#, c-format -+msgid "attempt to use poisoned \"%s\"" -+msgstr "tentativa de usar \"%s\" envenenado" -+ -+#: lex.c:1172 lex.c:1249 -+msgid "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro" -+msgstr "__VA_ARGS__ pode aparecer apenas na expansão de uma macro variádica C99" -+ -+#: lex.c:1178 lex.c:1255 -+#, c-format -+msgid "identifier \"%s\" is a special operator name in C++" -+msgstr "identificador \"%s\" é o nome de um operador especial em C++" -+ -+#: lex.c:1399 -+msgid "raw string delimiter longer than 16 characters" -+msgstr "delimitador de string não tratada (raw) maior do que 16 caracteres" -+ -+#: lex.c:1402 -+#, c-format -+msgid "invalid character '%c' in raw string delimiter" -+msgstr "caractere inválido \"%c\" em delimitador de string não tratada (raw)" -+ -+#: lex.c:1525 lex.c:1547 -+msgid "unterminated raw string" -+msgstr "string não tratada (raw) não terminada" -+ -+#: lex.c:1573 lex.c:1706 -+msgid "invalid suffix on literal; C++11 requires a space between literal and identifier" -+msgstr "sufixo inválido em literal; C++11 requer um espaço entre literal e identificador" -+ -+#: lex.c:1684 -+msgid "null character(s) preserved in literal" -+msgstr "um ou mais caracteres nulos preservados em literal" -+ -+#: lex.c:1687 -+#, c-format -+msgid "missing terminating %c character" -+msgstr "faltando o caractere de terminação %c" -+ -+#: lex.c:2245 -+msgid "C++ style comments are not allowed in ISO C90" -+msgstr "comentários no estilo C++ não são permitidos em ISO C90" -+ -+#: lex.c:2247 -+msgid "(this will be reported only once per input file)" -+msgstr "(isso será relatado apenas uma vez por arquivo de entrada)" -+ -+#: lex.c:2252 -+msgid "multi-line comment" -+msgstr "comentário multilinha" -+ -+#: lex.c:2583 -+#, c-format -+msgid "unspellable token %s" -+msgstr "token %s impronunciável" -+ -+#: macro.c:191 -+#, c-format -+msgid "macro \"%s\" is not used" -+msgstr "macro \"%s\" não é usada" -+ -+#: macro.c:229 macro.c:426 -+#, c-format -+msgid "invalid built-in macro \"%s\"" -+msgstr "macro interna inválida \"%s\"" -+ -+#: macro.c:263 -+msgid "could not determine file timestamp" -+msgstr "não foi possível determinar o arquivo de marca de tempo" -+ -+#: macro.c:361 -+msgid "could not determine date and time" -+msgstr "não foi possível determinar a data e a hora" -+ -+#: macro.c:377 -+msgid "__COUNTER__ expanded inside directive with -fdirectives-only" -+msgstr "__COUNTER__ expandido dentro diretiva com -fdirectives-only" -+ -+#: macro.c:535 -+msgid "invalid string literal, ignoring final '\\'" -+msgstr "literal de string inválida, ignorando final \"\\\"" -+ -+#: macro.c:597 -+#, c-format -+msgid "pasting \"%s\" and \"%s\" does not give a valid preprocessing token" -+msgstr "colar \"%s\" em \"%s\" não resulta em nenhum token de preprocessamento válido" -+ -+#: macro.c:719 -+msgid "ISO C99 requires rest arguments to be used" -+msgstr "ISO C99 requer que argumentos restantes sejam usados" -+ -+#: macro.c:724 -+#, c-format -+msgid "macro \"%s\" requires %u arguments, but only %u given" -+msgstr "macro \"%s\" requer %u argumentos, mas apenas %u foram fornecidos" -+ -+#: macro.c:729 -+#, c-format -+msgid "macro \"%s\" passed %u arguments, but takes just %u" -+msgstr "macro \"%s\" passou %u argumentos, mas usa apenas %u" -+ -+#: macro.c:923 traditional.c:680 -+#, c-format -+msgid "unterminated argument list invoking macro \"%s\"" -+msgstr "lista de argumentos interminável chamando macro \"%s\"" -+ -+#: macro.c:1074 -+#, c-format -+msgid "function-like macro \"%s\" must be used with arguments in traditional C" -+msgstr "macro \"%s\" do tipo função deve ser usada com argumento em C tradicional" -+ -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33305 -+#: macro.c:1746 -+#, c-format -+msgid "invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98" -+msgstr "chamando macro %s argumento %d: argumentos de macro vazios estão indefinidos em ISO C90 e ISO C++98" -+ -+#: macro.c:2708 -+#, c-format -+msgid "duplicate macro parameter \"%s\"" -+msgstr "parâmetro de macro \"%s\" duplicado" -+ -+#: macro.c:2754 -+#, c-format -+msgid "\"%s\" may not appear in macro parameter list" -+msgstr "\"%s\" não pode aparecer na lista de parâmetros de macro" -+ -+#: macro.c:2762 -+msgid "macro parameters must be comma-separated" -+msgstr "parâmetros de macro devem ser separados por vírgula" -+ -+#: macro.c:2779 -+msgid "parameter name missing" -+msgstr "faltando nome de parâmetro" -+ -+#: macro.c:2797 -+msgid "anonymous variadic macros were introduced in C99" -+msgstr "macros variádicas anônimas foram introduzidas em C99" -+ -+#: macro.c:2802 -+msgid "ISO C does not permit named variadic macros" -+msgstr "ISO C não permite macros variádicas nomeadas" -+ -+#: macro.c:2811 -+msgid "missing ')' in macro parameter list" -+msgstr "faltando \")\" na lista de parâmetros de macro" -+ -+#: macro.c:2860 -+msgid "'##' cannot appear at either end of a macro expansion" -+msgstr "\"##\" não pode aparecer no final da expansão de macro" -+ -+#: macro.c:2895 -+msgid "ISO C99 requires whitespace after the macro name" -+msgstr "ISO C99 requer espaço em branco após o nome de macro" -+ -+#: macro.c:2919 -+msgid "missing whitespace after the macro name" -+msgstr "faltando espaço em branco após o nome de macro" -+ -+#: macro.c:2953 -+msgid "'#' is not followed by a macro parameter" -+msgstr "\"#\" não está seguido por um parâmetro de macro" -+ -+#: macro.c:3111 -+#, c-format -+msgid "\"%s\" redefined" -+msgstr "\"%s\" re-definido" -+ -+#: macro.c:3117 -+msgid "this is the location of the previous definition" -+msgstr "essa é a localização da definição anterior" -+ -+#: macro.c:3178 -+#, c-format -+msgid "macro argument \"%s\" would be stringified in traditional C" -+msgstr "argumento de macro \"%s\" estaria em uma string no C tradicional" -+ -+#: macro.c:3205 -+#, c-format -+msgid "invalid hash type %d in cpp_macro_definition" -+msgstr "tipo de hash inválido %d em cpp_macro_definition" -+ -+#: pch.c:87 pch.c:345 pch.c:359 pch.c:377 pch.c:383 pch.c:392 pch.c:399 -+msgid "while writing precompiled header" -+msgstr "enquanto realizava escrita de header pré-compilado" -+ -+#: pch.c:619 -+#, c-format -+msgid "%s: not used because `%.*s' is poisoned" -+msgstr "%s: não usado porque \"%.*s\" está envenenado" -+ -+#: pch.c:641 -+#, c-format -+msgid "%s: not used because `%.*s' not defined" -+msgstr "%s: não usado porque \"%.*s\" não está definido" -+ -+#: pch.c:653 -+#, c-format -+msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'" -+msgstr "%s: não usado porque \"%.*s\" está definido como \"%s\", e não \"%.*s\"" -+ -+#: pch.c:694 -+#, c-format -+msgid "%s: not used because `%s' is defined" -+msgstr "%s: não usado porque \"%s\" está definido" -+ -+#: pch.c:714 -+#, c-format -+msgid "%s: not used because `__COUNTER__' is invalid" -+msgstr "%s: não usado porque \"__COUNTER__\" é inválido" -+ -+#: pch.c:723 pch.c:898 -+msgid "while reading precompiled header" -+msgstr "enquanto realizava leitura de header pré-compilado" -+ -+#: traditional.c:750 -+#, c-format -+msgid "detected recursion whilst expanding macro \"%s\"" -+msgstr "detectada recursão enquanto expandia macro \"%s\"" -+ -+#: traditional.c:968 -+msgid "syntax error in macro parameter list" -+msgstr "erro de sintaxe na lista de parâmetros de macro" -Index: libcpp/po/ChangeLog -=================================================================== ---- a/src/libcpp/po/ChangeLog (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/po/ChangeLog (.../branches/gcc-4_8-branch) -@@ -1,3 +1,11 @@ -+2013-12-18 Joseph Myers <joseph@codesourcery.com> -+ -+ * pt_BR.po: New. -+ -+2013-11-01 Joseph Myers <joseph@codesourcery.com> -+ -+ * tr.po: Update. -+ - 2013-10-16 Release Manager - - * GCC 4.8.2 released. -Index: libcpp/po/tr.po -=================================================================== ---- a/src/libcpp/po/tr.po (.../tags/gcc_4_8_2_release) -+++ b/src/libcpp/po/tr.po (.../branches/gcc-4_8-branch) -@@ -1,20 +1,22 @@ - # Turkish translations for cpplib messages. - # Copyright (C) 2007 Free Software Foundation, Inc. -+# This file is distributed under the same license as the gcc package. - # - # Nilgün Belma Bugüner <nilgun@buguner.name.tr>, 2001, ..., 2007. -+# Volkan Gezer <vlkngzr@gmail.com>, 2013. - msgid "" - msgstr "" --"Project-Id-Version: cpplib 4.2.0\n" -+"Project-Id-Version: cpplib 4.8.0\n" - "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" --"POT-Creation-Date: 2013-02-24 01:05+0000\n" --"PO-Revision-Date: 2007-05-23 01:17+0300\n" --"Last-Translator: Nilgün Belma Bugüner <nilgun@buguner.name.tr>\n" -+"POT-Creation-Date: 2013-03-15 17:42+0000\n" -+"PO-Revision-Date: 2013-11-01 22:29+0100\n" -+"Last-Translator: Volkan Gezer <vlkngzr@gmail.com>\n" - "Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n" - "Language: tr\n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" --"X-Generator: KBabel 1.11.4\n" -+"X-Generator: Lokalize 1.5\n" - "Plural-Forms: nplurals=2; plural=(n != 1);\n" - - #: charset.c:673 -@@ -121,10 +123,9 @@ - msgstr "ISO standardı olmayan önceleme dizgesi, '\\%c'" - - #: charset.c:1320 --#, fuzzy, c-format --#| msgid "unknown escape sequence '\\%c'" -+#, c-format - msgid "unknown escape sequence: '\\%c'" --msgstr "bilinmeyen önceleme dizgesi '\\%c'" -+msgstr "bilinmeyen kaçış dizgesi: '\\%c'" - - #: charset.c:1328 - #, c-format -@@ -163,10 +164,9 @@ - msgstr "#%s bir GCC uzantısıdır" - - #: directives.c:362 --#, fuzzy, c-format --#| msgid "#%s is a GCC extension" -+#, c-format - msgid "#%s is a deprecated GCC extension" --msgstr "#%s bir GCC uzantısıdır" -+msgstr "#%s eskimiş bir GCC uzantısıdır" - - #: directives.c:375 - msgid "suggest not using #elif in traditional C" -@@ -247,7 +247,7 @@ - - #: directives.c:909 - msgid "unexpected end of file after #line" --msgstr "" -+msgstr "#line satırından sonra beklenmeyen dosya sonu" - - #: directives.c:912 - #, c-format -@@ -271,7 +271,7 @@ - #: directives.c:1068 directives.c:1070 directives.c:1072 directives.c:1658 - #, c-format - msgid "%s" --msgstr "" -+msgstr "%s" - - #: directives.c:1096 - #, c-format -@@ -312,16 +312,12 @@ - msgstr "main dosyasında '#pragma once'" - - #: directives.c:1462 --#, fuzzy --#| msgid "invalid #pragma GCC poison directive" - msgid "invalid #pragma push_macro directive" --msgstr "geçersiz #pragma GCC poison yönergesi" -+msgstr "geçersiz #pragma güdümlü_makro yönergesi" - - #: directives.c:1517 --#, fuzzy --#| msgid "invalid #pragma GCC poison directive" - msgid "invalid #pragma pop_macro directive" --msgstr "geçersiz #pragma GCC poison yönergesi" -+msgstr "geçersiz #pragma güdümlü_makro yönergesi" - - #: directives.c:1572 - msgid "invalid #pragma GCC poison directive" -@@ -347,10 +343,9 @@ - msgstr "mevcut dosya %s den daha eski" - - #: directives.c:1653 --#, fuzzy, c-format --#| msgid "invalid #pragma GCC poison directive" -+#, c-format - msgid "invalid \"#pragma GCC %s\" directive" --msgstr "geçersiz #pragma GCC poison yönergesi" -+msgstr "geçersiz \"#pragma GCC %s\" yönergesi" - - #: directives.c:1847 - msgid "_Pragma takes a parenthesized string literal" -@@ -405,7 +400,7 @@ - msgid "\"%s\" re-asserted" - msgstr "\"%s\" tekrar olumlanmış" - --#: directives.c:2566 -+#: directives.c:2567 - #, c-format - msgid "unterminated #%s" - msgstr "sonlandırılmamış #%s" -@@ -424,16 +419,12 @@ - msgstr "%s: %s" - - #: expr.c:479 expr.c:577 --#, fuzzy --#| msgid "imaginary constants are a GCC extension" - msgid "fixed-point constants are a GCC extension" --msgstr "sanal sabitler bir GCC genişletmesidir" -+msgstr "sabit noktalı sabitler bir GCC uzantısıdır" - - #: expr.c:504 --#, fuzzy --#| msgid "invalid suffix \"%.*s\" on floating constant" - msgid "invalid prefix \"0b\" for floating constant" --msgstr "gerçel sabitin \"%.*s\" soneki geçersiz" -+msgstr "kayan nokta için geçerisz \"0b\" öntakısı" - - #: expr.c:514 - msgid "use of C99 hexadecimal floating constant" -@@ -450,10 +441,8 @@ - msgstr "geleneksel C \"%.*s\" sonekini kullanmaz" - - #: expr.c:564 --#, fuzzy --#| msgid "imaginary constants are a GCC extension" - msgid "suffix for double constant is a GCC extension" --msgstr "sanal sabitler bir GCC genişletmesidir" -+msgstr "çift sabit için öntakı bir GCC uzantısıdır" - - #: expr.c:570 - #, c-format -@@ -461,10 +450,8 @@ - msgstr "onaltılık kayan sabitli \"%.*s\" soneki geçersiz" - - #: expr.c:581 --#, fuzzy --#| msgid "imaginary constants are a GCC extension" - msgid "decimal float constants are a GCC extension" --msgstr "sanal sabitler bir GCC genişletmesidir" -+msgstr "onluk kayan sabitler bir GCC uzantısıdır" - - #: expr.c:599 - #, c-format -@@ -472,10 +459,8 @@ - msgstr "tamsayı sabitte sonek \"%.*s\" soneki geçersiz" - - #: expr.c:624 --#, fuzzy --#| msgid "use of C99 long long integer constant" - msgid "use of C++0x long long integer constant" --msgstr "ISO C99 long long tamsayı sabitleri yasaklar" -+msgstr "ISO C++0x long long tamsayı sabitlerinin kullanımı" - - #: expr.c:625 - msgid "use of C99 long long integer constant" -@@ -486,10 +471,8 @@ - msgstr "sanal sabitler bir GCC genişletmesidir" - - #: expr.c:644 --#, fuzzy --#| msgid "imaginary constants are a GCC extension" - msgid "binary constants are a GCC extension" --msgstr "sanal sabitler bir GCC genişletmesidir" -+msgstr "ikili sabitler bir GCC uzantısıdır" - - #: expr.c:737 - msgid "integer constant is too large for its type" -@@ -517,10 +500,8 @@ - msgstr "\"defined\" bu kullanımıyla uyarlanabilir olmayabilir" - - #: expr.c:948 --#, fuzzy --#| msgid "integer overflow in preprocessor expression" - msgid "user-defined literal in preprocessor expression" --msgstr "önişlemci ifadesinde tamsayı taşması" -+msgstr "önişleyici ifadesinde kullanıcı tanımlı bağımlı" - - #: expr.c:953 - msgid "floating constant in preprocessor expression" -@@ -536,20 +517,17 @@ - msgstr "\"%s\" tanımlı değil" - - #: expr.c:1020 --#, fuzzy --#| msgid "#%s is a GCC extension" - msgid "assertions are a GCC extension" --msgstr "#%s bir GCC uzantısıdır" -+msgstr "belirteçler bir GCC uzantısıdır" - - #: expr.c:1023 - msgid "assertions are a deprecated extension" --msgstr "" -+msgstr "belirteçler artık kullanılmayan bir ifadedir" - - #: expr.c:1268 --#, fuzzy, c-format --#| msgid "unbalanced stack in #if" -+#, c-format - msgid "unbalanced stack in %s" --msgstr "#if ifadesinde karşılıksız yığın" -+msgstr "%s içinde dengelenmemiş yığın" - - #: expr.c:1288 - #, c-format -@@ -594,39 +572,39 @@ - msgid "division by zero in #if" - msgstr "#if içinde sıfırla bölme" - --#: files.c:504 -+#: files.c:505 - msgid "NULL directory in find_file" - msgstr "find_file içinde boş dizin" - --#: files.c:542 -+#: files.c:553 - msgid "one or more PCH files were found, but they were invalid" - msgstr "bir veya daha fazla PCH dosyası bulundu ama bunlar geçersiz" - --#: files.c:545 -+#: files.c:556 - msgid "use -Winvalid-pch for more information" - msgstr "daha fazla bilgi almak için -Winvalid-pch kullanın" - --#: files.c:643 -+#: files.c:660 - #, c-format - msgid "%s is a block device" - msgstr "%s bir blok aygıtıdır" - --#: files.c:660 -+#: files.c:677 - #, c-format - msgid "%s is too large" - msgstr "%s çok büyük" - --#: files.c:700 -+#: files.c:717 - #, c-format - msgid "%s is shorter than expected" - msgstr "%s beklenenden daha kısa" - --#: files.c:935 -+#: files.c:953 - #, c-format - msgid "no include path in which to search for %s" - msgstr "%s için aranacaklar içinde başlık dosyaları yolu yok" - --#: files.c:1363 -+#: files.c:1381 - msgid "Multiple include guards may be useful for:\n" - msgstr "Çoklu include önlemleri aşağıdakiler için kullanışlı olabilir:\n" - -@@ -717,27 +695,24 @@ - #: lex.c:1178 lex.c:1255 - #, c-format - msgid "identifier \"%s\" is a special operator name in C++" --msgstr "" -+msgstr "\"%s\" belirteci, C++'da özel bir işleç adıdır" - - #: lex.c:1399 - msgid "raw string delimiter longer than 16 characters" --msgstr "" -+msgstr "ham dizge ayracı 16 karakterden uzun" - - #: lex.c:1402 --#, fuzzy, c-format --#| msgid "universal character %.*s is not valid in an identifier" -+#, c-format - msgid "invalid character '%c' in raw string delimiter" --msgstr "evrensel karakter %.*s bir belirteç içinde geçerli değil" -+msgstr "ham dizge ayracında geçersiz karakter '%c'" - - #: lex.c:1525 lex.c:1547 --#, fuzzy --#| msgid "unterminated #%s" - msgid "unterminated raw string" --msgstr "sonlandırılmamış #%s" -+msgstr "bitirilmemiş ham dizge" - - #: lex.c:1573 lex.c:1706 - msgid "invalid suffix on literal; C++11 requires a space between literal and identifier" --msgstr "" -+msgstr "geçersiz ifade soneki; C++11 ifade ve tanımlayıcı arasında bir boşluk gerektirir" - - #: lex.c:1684 - msgid "null character(s) preserved in literal" -@@ -785,7 +760,7 @@ - - #: macro.c:377 - msgid "__COUNTER__ expanded inside directive with -fdirectives-only" --msgstr "" -+msgstr "__COUNTER__ -fdirectives-only ile talimat içerisinde genişletildi" - - #: macro.c:535 - msgid "invalid string literal, ignoring final '\\'" -@@ -823,7 +798,7 @@ - #: macro.c:1746 - #, c-format - msgid "invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98" --msgstr "" -+msgstr "%s makrosu %d argümanı uygulanıyor: ISO C90 ve ISO C++98 içerisinde boş makro argümanları tanımsızdır" - - #: macro.c:2708 - #, c-format -@@ -890,38 +865,36 @@ - msgid "invalid hash type %d in cpp_macro_definition" - msgstr "cpp_macro_definition içindeki isimli yapı türü %d geçersiz" - --#: pch.c:87 pch.c:335 pch.c:347 pch.c:365 pch.c:371 pch.c:380 pch.c:387 -+#: pch.c:87 pch.c:345 pch.c:359 pch.c:377 pch.c:383 pch.c:392 pch.c:399 - msgid "while writing precompiled header" - msgstr "önderlemeli başlık yazılırken" - --#: pch.c:607 --#, fuzzy, c-format --#| msgid "%s: not used because `%s' is defined" -+#: pch.c:619 -+#, c-format - msgid "%s: not used because `%.*s' is poisoned" --msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" -+msgstr "%s: `%.*s' zehirli olduğu için kullanılmadı" - --#: pch.c:629 -+#: pch.c:641 - #, c-format - msgid "%s: not used because `%.*s' not defined" - msgstr "%s: `%.*s' tanımlı olmadığından kullanılmadı" - --#: pch.c:641 -+#: pch.c:653 - #, c-format - msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'" - msgstr "%s: `%.*s' kullanılmadı çünkü `%s' olarak tanımlı, `%.*s' değil" - --#: pch.c:682 -+#: pch.c:694 - #, c-format - msgid "%s: not used because `%s' is defined" - msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" - --#: pch.c:702 --#, fuzzy, c-format --#| msgid "%s: not used because `%s' is defined" -+#: pch.c:714 -+#, c-format - msgid "%s: not used because `__COUNTER__' is invalid" --msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" -+msgstr "%s: `__COUNTER__' geçersiz olduğundan kullanılmadı" - --#: pch.c:711 pch.c:886 -+#: pch.c:723 pch.c:898 - msgid "while reading precompiled header" - msgstr "önderlemeli başlık okunurken" + s->st_dev = statbuf.st_dev; + s->st_ino = statbuf.st_ino; Index: . =================================================================== ---- a/src/. (.../tags/gcc_4_8_2_release) +--- a/src/. (.../tags/gcc_4_8_3_release) +++ b/src/. (.../branches/gcc-4_8-branch) Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo - Merged /trunk:r202766,204547,206123-206126,206395,206628,207387 + Merged /trunk:r211733 diff --git a/debian/patches/sys-auxv-header.diff b/debian/patches/sys-auxv-header.diff index 4f7b97f..1c4f598 100644 --- a/debian/patches/sys-auxv-header.diff +++ b/debian/patches/sys-auxv-header.diff @@ -4,7 +4,7 @@ Index: b/src/gcc/configure.ac =================================================================== --- a/src/gcc/configure.ac +++ b/src/gcc/configure.ac -@@ -942,6 +942,7 @@ +@@ -942,6 +942,7 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \ fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ sys/resource.h sys/param.h sys/times.h sys/stat.h \ @@ -16,7 +16,7 @@ Index: b/src/gcc/config.in =================================================================== --- a/src/gcc/config.in +++ b/src/gcc/config.in -@@ -1446,6 +1446,12 @@ +@@ -1452,6 +1452,12 @@ #endif @@ -33,7 +33,7 @@ Index: b/src/gcc/config/rs6000/driver-rs6000.c =================================================================== --- a/src/gcc/config/rs6000/driver-rs6000.c +++ b/src/gcc/config/rs6000/driver-rs6000.c -@@ -31,6 +31,10 @@ +@@ -31,6 +31,10 @@ along with GCC; see the file COPYING3. # include <link.h> #endif diff --git a/debian/rules.conf b/debian/rules.conf index 13ff3fb..0ae979d 100644 --- a/debian/rules.conf +++ b/debian/rules.conf @@ -89,6 +89,7 @@ ifeq ($(with_shared_libgcc),yes) LIBGCC_DEP := libgcc$(GCC_SONAME)$(LS)$(AQ) (>= $(DEB_LIBGCC_VERSION)) $(eval $(call gen_multilib_deps,gcc,,$(DEB_LIBGCC_VERSION))) endif +LIBGCC_DEV_DEP := libgcc-$(BASE_VERSION)-dev$(LS)$(AQ) (>= $(DEB_VERSION)) $(foreach x,stdc++ gomp ssp gfortran itm objc atomic asan quadmath go, \ $(eval $(call gen_multilib_deps,$(x),,$$$${gcc:Version}))) $(foreach x,gcc stdc++ gfortran objc go, \ @@ -175,6 +176,10 @@ ifeq ($(multiarch_stage1),yes) endif DPKG_BUILD_DEP = dpkg-dev (>= $(DPKGV)), +ifeq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH)) + TARGET_QUAL = :$(DEB_TARGET_ARCH) +endif + # The binutils version needed. # The oldest suitable versions for the various platforms can be found in # INSTALL/specific.html ; we take a tighter dependency if possible to be on @@ -387,6 +392,13 @@ endif AUTO_BUILD_DEP := m4, libtool, AUTO_BUILD_DEP += autoconf2.64, +# ensure that the common libs, built from the next GCC version are available +ifeq ($(PKGSOURCE),gcc-$(BASE_VERSION)) + ifneq ($(with_common_libs),yes) + BASE_BUILD_DEP = gcc-4.9-base, + endif +endif + ifneq ($(DEB_CROSS),yes) JAVA_BUILD_DEP := zlib1g-dev, libantlr-java, python, libffi-dev, @@ -586,6 +598,7 @@ ctrl_flags += \ -DLIBC_BIARCH_BUILD_DEP="$(LIBC_BIARCH_BUILD_DEP)" \ -DLIBC_DBG_DEP="$(LIBC_DBG_DEP)" \ -DFORTRAN_BUILD_DEP="$(FORTRAN_BUILD_DEP)" \ + -DBASE_BUILD_DEP="$(BASE_BUILD_DEP)" \ -DGNAT_BUILD_DEP="$(GNAT_BUILD_DEP)" \ -DJAVA_BUILD_DEP="$(JAVA_BUILD_DEP)" \ -DGO_BUILD_DEP="$(GO_BUILD_DEP)" \ @@ -655,6 +668,8 @@ ifdef DEB_STAGE addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgcc) addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgcc) endif + else + LIBGCC_DEV_DEP := endif else languages = c c++ fortran objc objpp @@ -942,6 +957,7 @@ substvars-file: echo 'gnat:Version=$(DEB_GNAT_VERSION)'; \ echo 'binutils:Version=$(BINUTILSV)'; \ echo 'dep:libgcc=$(LIBGCC_DEP)'; \ + echo 'dep:libgccdev=$(LIBGCC_DEV_DEP)'; \ echo 'dep:libgccbiarch=$(libgccbiarch)'; \ echo 'dep:libgccbiarchdev=$(libgccbiarchdev)'; \ echo 'dep:libc=$(LIBC_DEP) (>= $(libc_ver))'; \ @@ -1186,6 +1202,7 @@ versioned-files: -e 's/@java_priority@/$(java_priority)/g' \ -e 's/@gcc_priority@/$(subst .,,$(BASE_VERSION))/g' \ -e 's/@TARGET@/$(DEB_TARGET_GNU_TYPE)/g' \ + -e 's/@TARGET_QUAL@/$(TARGET_QUAL)/g' \ $$f > $$f2; \ touch -r $$f $$f2; \ done diff --git a/debian/rules.d/binary-base.mk b/debian/rules.d/binary-base.mk index 391cf6b..0fa3b09 100644 --- a/debian/rules.d/binary-base.mk +++ b/debian/rules.d/binary-base.mk @@ -38,7 +38,11 @@ endif dh_installchangelogs -p$(p_base) dh_compress -p$(p_base) dh_fixperms -p$(p_base) +ifeq ($(with_deps_on_target_arch_pkgs),yes) + $(cross_gencontrol) dh_gencontrol -p$(p_base) -- -v$(DEB_VERSION) $(common_substvars) +else dh_gencontrol -p$(p_base) -- -v$(DEB_VERSION) $(common_substvars) +endif dh_installdeb -p$(p_base) dh_md5sums -p$(p_base) dh_builddeb -p$(p_base) diff --git a/debian/rules.d/binary-cxx.mk b/debian/rules.d/binary-cxx.mk index 8ce3e0a..5612b0f 100644 --- a/debian/rules.d/binary-cxx.mk +++ b/debian/rules.d/binary-cxx.mk @@ -61,7 +61,8 @@ endif echo "TEST COMPARE BEGIN" ifeq ($(with_check),yes) # more than one libgo.sum, avoid it - cp -p $$(find $(builddir) -mindepth 3 -name '*.sum' ! -name libgo.sum) \ + cp -p $$(find $(builddir)/gcc/testsuite -maxdepth 2 \( -name '*.sum' -o -name '*.log' \)) \ + $$(find $(buildlibdir)/*/testsuite -maxdepth 1 \( -name '*.sum' -o -name '*.log' \) ! -name 'libgo.*') \ $(d_cxx)/$(docdir)/$(p_xbase)/test-summaries/ ifeq ($(with_go),yes) cp -p $(buildlibdir)/libgo/libgo.sum \ @@ -84,13 +85,16 @@ ifeq ($(with_check),yes) fi; \ done endif + if which xz 2>&1 >/dev/null; then \ + xz -9v $(d_cxx)/$(docdir)/$(p_xbase)/test-summaries/*; \ + fi else echo "Nothing to compare (testsuite not run)" endif echo "TEST COMPARE END" dh_strip -p$(p_cxx) - dh_compress -p$(p_cxx) + dh_compress -p$(p_cxx) -X.log.xz -X.sum.xz dh_fixperms -p$(p_cxx) dh_shlibdeps -p$(p_cxx) dh_gencontrol -p$(p_cxx) -- -v$(DEB_VERSION) $(common_substvars) diff --git a/debian/rules.d/binary-hppa64.mk b/debian/rules.d/binary-hppa64.mk index b7be9bc..62864cb 100644 --- a/debian/rules.d/binary-hppa64.mk +++ b/debian/rules.d/binary-hppa64.mk @@ -13,9 +13,9 @@ $(binary_stamp)-hppa64: $(install_hppa64_stamp) : # provide as and ld links dh_link -p $(p_hppa64) \ /usr/bin/hppa64-linux-gnu-as \ - /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(GCC_VERSION)/as \ + /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/as \ /usr/bin/hppa64-linux-gnu-ld \ - /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(GCC_VERSION)/ld + /$(hppa64libexecdir)/gcc/hppa64-linux-gnu/$(versiondir)/ld debian/dh_doclink -p$(p_hppa64) $(p_xbase) debian/dh_rmemptydirs -p$(p_hppa64) diff --git a/debian/rules.d/binary-java.mk b/debian/rules.d/binary-java.mk index da1f978..8ca4a9f 100644 --- a/debian/rules.d/binary-java.mk +++ b/debian/rules.d/binary-java.mk @@ -425,14 +425,6 @@ $(binary_stamp)-java: $(install_stamp) # DH_COMPAT=2 dh_movefiles -p$(p_jqt) $(files_jqt) #endif -# FIXME -# $(jvm_dir) $(PF)/lib/jvm/$(jvm_name_long) \ - -# FIXME this actually is in p_jlib ... -# dh_link -p$(p_jrehl) \ -# $(PF)/lib/security/classpath.security \ -# $(jvm_dir)/jre/lib/security/java.security - dh_link -p$(p_jrehl) \ $(jvm_dir) $(PF)/lib/jvm/java-gcj$(pkg_ver) \ $(PF)/bin/gij$(pkg_ver) $(jvm_dir)/bin/gij \ @@ -456,9 +448,13 @@ ifneq ($(DEB_TARGET_ARCH_CPU),$(java_cpu)) endif dh_link -p$(p_jlib) \ - etc/java/cacerts-gcj $(jvm_dir)/jre/lib/cacerts \ + /etc/java/cacerts-gcj /$(jvm_dir)/jre/lib/cacerts \ $(foreach i, jvm javamath, \ - $(gcj_vlibdir)/lib$(i).so $(jvm_dir)/lib/lib$(i).so) + /$(gcj_vlibdir)/lib$(i).so /$(jvm_dir)/lib/lib$(i).so) + + dh_link -p$(p_jlib) \ + /etc/security/classpath.security \ + /$(jvm_dir)/jre/lib/security/java.security dh_link -p$(p_jlibx) \ $(foreach i, jawt, $(gcj_vlibdir)/lib$(i).so $(jvm_dir)/lib/lib$(i).so) diff --git a/debian/rules.d/binary-libstdcxx.mk b/debian/rules.d/binary-libstdcxx.mk index 3359019..3d2041d 100644 --- a/debian/rules.d/binary-libstdcxx.mk +++ b/debian/rules.d/binary-libstdcxx.mk @@ -122,15 +122,11 @@ dirs_dbg = \ $(docdir) \ $(PF)/lib/debug/$(usr_lib) \ $(usr_lib)/debug \ + $(PF)/share/gdb/auto-load/$(usr_lib)/debug \ $(gcc_lib_dir) files_dbg = \ $(usr_lib)/debug/libstdc++.{a,so*} -ifneq ($(DEB_CROSS),yes) - dirs_dbg += $(PF)/share/gcc-$(BASE_VERSION)/python - files_dbg += $(PF)/share/gcc-$(BASE_VERSION)/python/libstdcxx -endif - dirs_pic = \ $(docdir) \ $(gcc_lib_dir) @@ -184,7 +180,19 @@ define __do_libstdcxx dh_installdirs -p$(p_l) \ $(docdir) \ - $(usr_lib$(2)) + $(usr_lib$(2)) \ + $(PF)/share/gdb/auto-load/$(usr_lib$(2)) + + $(if $(2),, + dh_installdirs -p$(p_l) \ + $(PF)/share/gcc-$(BASE_VERSION)/python + DH_COMPAT=2 dh_movefiles -p$(p_l) \ + $(PF)/share/gcc-$(BASE_VERSION)/python/libstdcxx + ) + cp -p $(d)/$(usr_lib$(2))/libstdc++.so.*.py \ + $(d_l)/$(PF)/share/gdb/auto-load/$(usr_lib$(2))/. + sed -i -e "/^libdir *=/s,=.*,= '/$(usr_lib$(2))'," \ + $(d_l)/$(PF)/share/gdb/auto-load/$(usr_lib$(2))/libstdc++.so.*.py cp -a $(d)/$(usr_lib$(2))/libstdc++.so.*[0-9] \ $(d_l)/$(usr_lib$(2))/. @@ -221,10 +229,6 @@ define __do_libstdcxx_dbg $(PF)/lib/debug/$(usr_lib$(2)) \ $(usr_lib$(2)) - cp -p $(d)/$(usr_lib$(2))/libstdc++.so.*.py \ - $(d_d)/$(PF)/lib/debug/$(usr_lib$(2))/. - sed -i -e "/^libdir *=/s,=.*,= '/$(usr_lib$(2))'," \ - $(d_d)/$(PF)/lib/debug/$(usr_lib$(2))/libstdc++.so.*.py $(if $(filter yes,$(with_lib$(2)cxx)), cp -a $(d)/$(usr_lib$(2))/libstdc++.so.*[0-9] \ $(d_d)/$(usr_lib$(2))/.; @@ -420,9 +424,9 @@ endif $(d_pic)/$(gcc_lib_dir)/libstdc++_pic.map cp -p $(d)/$(usr_lib)/libstdc++.so.*.py \ - $(d_dbg)/$(PF)/lib/debug/$(usr_lib)/ + $(d_dbg)/$(PF)/share/gdb/auto-load/$(usr_lib)/debug/. sed -i -e "/^libdir *=/s,=.*,= '/$(usr_lib)'," \ - $(d_dbg)/$(PF)/lib/debug/$(usr_lib)/libstdc++.so.*.py + $(d_dbg)/$(PF)/share/gdb/auto-load/$(usr_lib)/debug/libstdc++.so.*.py ifeq ($(with_libcxx),yes) cp -a $(d)/$(usr_lib)/libstdc++.so.*[0-9] \ $(d_dbg)/$(usr_lib)/ diff --git a/debian/rules.defs b/debian/rules.defs index cb9c72f..b1a8a26 100644 --- a/debian/rules.defs +++ b/debian/rules.defs @@ -309,7 +309,7 @@ endif # build using fsf or linaro ifeq ($(distribution),Ubuntu) ifeq (,$(findstring gnat, $(PKGSOURCE))) - ifneq (,$(findstring $(DEB_TARGET_ARCH),amd64 i386 arm64 armel armhf)) + ifneq (,$(findstring $(DEB_TARGET_ARCH),arm64 armel armhf)) with_linaro_branch = yes endif endif @@ -343,6 +343,11 @@ with_common_libs := yes # XXX: should with_common_libs be "yes" only if this is the default compiler # version on the targeted arch? +ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy dapper hardy jaunty karmic lucid maverick oneiric precise quantal raring saucy trusty)) + with_common_pkgs := + with_common_libs := +endif + # is this a multiarch-enabled build? ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick)) with_multiarch_lib := yes @@ -427,6 +432,8 @@ ifneq ($(DEB_STAGE),stage1) else ifneq ($(with_deps_on_target_arch_pkgs),yes) with_gccxbase := yes + else + with_gccbase := yes endif endif endif @@ -739,10 +746,8 @@ with_go := $(call envfilt, go, , , $(with_go)) # Build all packages needed for Go development ifneq (,$(findstring gcc, $(PKGSOURCE))) ifeq ($(with_go),yes) - ifeq ($(with_common_libs),yes) - with_libgo := yes - endif enabled_languages += go + with_libgo := yes endif endif @@ -893,10 +898,9 @@ ifeq ($(with_objc),yes) ifeq ($(with_dev),yes) with_objcdev := yes endif - # libobjc soname change in 4.7 - #ifeq ($(with_common_libs),yes) + ifeq ($(with_common_libs),yes) with_libobjc := yes - #endif + endif enabled_languages += objc endif @@ -969,7 +973,7 @@ ifneq (,$(filter $(DEB_TARGET_ARCH),$(gomp_no_archs))) endif # itm -------------------- -itm_archs = amd64 i386 x32 ppc64 ppc64el +itm_archs = amd64 arm64 i386 x32 ppc64 ppc64el ifneq (,$(filter $(DEB_TARGET_ARCH),$(itm_archs))) with_itm := yes endif @@ -992,7 +996,7 @@ endif # asan / sanitizer -------------------- with_asan := with_asan := $(call envfilt, asan, , , $(with_asan)) -asan_archs = amd64 armel armhf i386 powerpc ppc64 sparc sparc64 x32 +asan_archs = amd64 armel armhf i386 powerpc ppc64 x32 sparc sparc64 ifneq (,$(filter $(DEB_TARGET_ARCH),$(asan_archs))) with_asan := yes endif @@ -1089,7 +1093,9 @@ else endif # libasan ----------------- - ifeq ($(with_asan)-$(with_common_libs),yes-yes) + # soname change in 4.9 + ifeq ($(with_asan),yes) + #ifeq ($(with_asan)-$(with_common_libs),yes-yes) #ifneq ($(DEB_CROSS),yes) with_libasan := yes #endif @@ -1179,7 +1185,7 @@ ifeq ($(REVERSE_CROSS),yes) with_check := disabled for reverse cross build endif check_no_cpus := m68k -check_no_systems := gnu +check_no_systems := gnu kfreebsd-gnu ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(check_no_cpus))) with_check := disabled for cpu $(DEB_TARGET_ARCH_CPU) endif diff --git a/debian/rules.patch b/debian/rules.patch index db1bf44..bd74e45 100644 --- a/debian/rules.patch +++ b/debian/rules.patch @@ -14,10 +14,12 @@ series_file ?= $(patchdir)/series debian_patches = \ svn-updates \ + $(if $(with_linaro_branch),pr61208-revert) \ $(if $(with_linaro_branch),gcc-linaro) \ $(if $(with_linaro_branch),gcc-linaro-no-local) \ -# svn-updates$(if $(with_linaro_branch),-linaro) \ +# FIXME: pr61208 requires Linaro 4.9-2014.04. +# $(if $(with_linaro_branch),pr61208-linaro) \ ifeq ($(with_java),yes) # debian_patches += \ @@ -75,7 +77,6 @@ debian_patches += \ $(if $(with_linaro_branch),,arm-sanitizer) \ libgo-setcontext-config \ pr57211 \ - gcc-auto-build \ kfreebsd-unwind \ libgcc-no-limits-h \ kfreebsd-boehm-gc \ @@ -90,13 +91,23 @@ debian_patches += \ $(if $(with_linaro_branch),aarch64-call-frame-info) \ $(if $(with_linaro_branch),aarch64-abi-fix) \ fix-ffi_call_VFP-with-no-VFP-argument \ - pr58595 \ $(if $(with_linaro_branch),pr60034) \ - pr60609 \ - gcc-rs6000-update \ - -gdb_depends := $(shell dpkg -s gdb | grep '^Depends:.*libpython3') -ifneq (,$(findstring libpython3,$(gdb_depends))) + pr61106 \ + pr61126 \ + pr57653 \ + libitm-aarch64 \ + pr61046 \ + pr61336 \ + gcc-setmultilib-fix \ + gcc-elfv2-abi-warn1 \ + gcc-elfv2-abi-warn2 \ + gcc-elfv2-abi-warn3 \ + gcc-elfv2-abi-warn4 \ + +# FIXME: still necessary for cross building the native compiler? +# gcc-auto-build \ + +ifeq (,$(filter $(distrelease),wheezy squeeze dapper hardy lucid maverick natty oneiric precise quantal raring)) debian_patches += libstdc++-python3 endif @@ -167,11 +178,11 @@ endif ifeq ($(with_d),yes) debian_patches += \ - gdc-updates \ gdc-4.8 \ gdc-versym-cpu \ gdc-versym-os \ gdc-frontend-posix +# gdc-updates \ # gdc-multiarch ifneq ($(GFDL_INVARIANT_FREE),yes) debian_patches += gdc-4.8-doc @@ -269,7 +280,6 @@ debian_patches += gcc-ice-hack gcc-ice-apport #debian_patches += gold-and-ld debian_patches += libjava-fixed-symlinks -debian_patches += libstdc++-arm-wno-abi ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel)) # timeouts on the buildd's, Debian diff --git a/debian/rules2 b/debian/rules2 index f4b51dc..7d77f1b 100644 --- a/debian/rules2 +++ b/debian/rules2 @@ -1448,6 +1448,7 @@ $(check_stamp): $(build_stamp) $(build_locale_stamp) ln -sf gcc $(builddir)/prev-gcc ln -sf $(DEB_TARGET_GNU_TYPE) $(builddir)/prev-$(DEB_TARGET_GNU_TYPE) +ifeq (0,1) ifneq ($(with_common_libs),yes) ifeq ($(with_cxx),yes) : # libstdc++6 built from newer gcc-4.x source, run testsuite against the installed lib @@ -1480,6 +1481,7 @@ ifneq ($(with_common_libs),yes) | xargs -r rm -f endif endif +endif ifeq ($(start_logwatch),yes) : # start logwatch script for regular output during test runs @@ -2198,8 +2200,10 @@ $(install_hppa64_stamp): $(build_hppa64_stamp) install ifeq ($(versioned_packages),yes) - mv $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-cpp \ - $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-cpp$(pkg_ver) + for i in cpp gcc-ar gcc-nm gcc-ranlib; do \ + mv -f $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i \ + $(d_hppa64)/$(PF)/bin/hppa64-linux-gnu-$$i$(pkg_ver); \ + done endif ifneq ($(single_package),yes) |